Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
e392f758
Kaydet (Commit)
e392f758
authored
Kas 11, 2014
tarafından
Kohei Yoshida
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Move this code to the context class.
Change-Id: I387dba24993d418a2b3923eac992ad2506229704
üst
ff5aad0a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
130 additions
and
117 deletions
+130
-117
clipcontext.hxx
sc/inc/clipcontext.hxx
+2
-0
clipcontext.cxx
sc/source/core/data/clipcontext.cxx
+127
-0
document10.cxx
sc/source/core/data/document10.cxx
+1
-117
No files found.
sc/inc/clipcontext.hxx
Dosyayı görüntüle @
e392f758
...
@@ -50,6 +50,7 @@ class CopyFromClipContext : public ClipContextBase
...
@@ -50,6 +50,7 @@ class CopyFromClipContext : public ClipContextBase
SCROW
mnDestRow2
;
SCROW
mnDestRow2
;
SCTAB
mnTabStart
;
SCTAB
mnTabStart
;
SCTAB
mnTabEnd
;
SCTAB
mnTabEnd
;
ScDocument
&
mrDestDoc
;
ScDocument
*
mpRefUndoDoc
;
ScDocument
*
mpRefUndoDoc
;
ScDocument
*
mpClipDoc
;
ScDocument
*
mpClipDoc
;
InsertDeleteFlags
mnInsertFlag
;
InsertDeleteFlags
mnInsertFlag
;
...
@@ -106,6 +107,7 @@ public:
...
@@ -106,6 +107,7 @@ public:
void
setSingleCellColumnSize
(
size_t
nSize
);
void
setSingleCellColumnSize
(
size_t
nSize
);
ScCellValue
&
getSingleCell
(
size_t
nColOffset
);
ScCellValue
&
getSingleCell
(
size_t
nColOffset
);
void
setSingleCell
(
const
ScAddress
&
rSrcPos
,
const
ScColumn
&
rSrcCol
);
const
ScPatternAttr
*
getSingleCellPattern
(
size_t
nColOffset
)
const
;
const
ScPatternAttr
*
getSingleCellPattern
(
size_t
nColOffset
)
const
;
void
setSingleCellPattern
(
size_t
nColOffset
,
const
ScPatternAttr
*
pAttr
);
void
setSingleCellPattern
(
size_t
nColOffset
,
const
ScPatternAttr
*
pAttr
);
...
...
sc/source/core/data/clipcontext.cxx
Dosyayı görüntüle @
e392f758
...
@@ -12,6 +12,9 @@
...
@@ -12,6 +12,9 @@
#include "mtvelements.hxx"
#include "mtvelements.hxx"
#include <column.hxx>
#include <column.hxx>
#include <scitems.hxx>
#include <scitems.hxx>
#include <tokenarray.hxx>
#include <editutil.hxx>
#include <clipparam.hxx>
#include <svl/intitem.hxx>
#include <svl/intitem.hxx>
...
@@ -34,6 +37,7 @@ CopyFromClipContext::CopyFromClipContext(ScDocument& rDoc,
...
@@ -34,6 +37,7 @@ CopyFromClipContext::CopyFromClipContext(ScDocument& rDoc,
mnDestCol1
(
-
1
),
mnDestCol2
(
-
1
),
mnDestCol1
(
-
1
),
mnDestCol2
(
-
1
),
mnDestRow1
(
-
1
),
mnDestRow2
(
-
1
),
mnDestRow1
(
-
1
),
mnDestRow2
(
-
1
),
mnTabStart
(
-
1
),
mnTabEnd
(
-
1
),
mnTabStart
(
-
1
),
mnTabEnd
(
-
1
),
mrDestDoc
(
rDoc
),
mpRefUndoDoc
(
pRefUndoDoc
),
mpClipDoc
(
pClipDoc
),
mpRefUndoDoc
(
pRefUndoDoc
),
mpClipDoc
(
pClipDoc
),
mnInsertFlag
(
nInsertFlag
),
mnDeleteFlag
(
IDF_NONE
),
mnInsertFlag
(
nInsertFlag
),
mnDeleteFlag
(
IDF_NONE
),
mpCondFormatList
(
NULL
),
mpCondFormatList
(
NULL
),
...
@@ -119,6 +123,129 @@ ScCellValue& CopyFromClipContext::getSingleCell( size_t nColOffset )
...
@@ -119,6 +123,129 @@ ScCellValue& CopyFromClipContext::getSingleCell( size_t nColOffset )
return
maSingleCells
[
nColOffset
];
return
maSingleCells
[
nColOffset
];
}
}
void
CopyFromClipContext
::
setSingleCell
(
const
ScAddress
&
rSrcPos
,
const
ScColumn
&
rSrcCol
)
{
SCCOL
nColOffset
=
rSrcPos
.
Col
()
-
mpClipDoc
->
GetClipParam
().
getWholeRange
().
aStart
.
Col
();
ScCellValue
&
rSrcCell
=
getSingleCell
(
nColOffset
);
if
(
isAsLink
())
{
ScSingleRefData
aRef
;
aRef
.
InitAddress
(
rSrcPos
);
aRef
.
SetFlag3D
(
true
);
ScTokenArray
aArr
;
aArr
.
AddSingleReference
(
aRef
);
rSrcCell
.
set
(
new
ScFormulaCell
(
mpClipDoc
,
rSrcPos
,
aArr
));
}
else
{
rSrcCell
.
assign
(
*
mpClipDoc
,
rSrcPos
);
// Check the paste flag to see whether we want to paste this cell. If the
// flag says we don't want to paste this cell, we'll return with true.
InsertDeleteFlags
nFlags
=
getInsertFlag
();
bool
bNumeric
=
(
nFlags
&
IDF_VALUE
)
!=
IDF_NONE
;
bool
bDateTime
=
(
nFlags
&
IDF_DATETIME
)
!=
IDF_NONE
;
bool
bString
=
(
nFlags
&
IDF_STRING
)
!=
IDF_NONE
;
bool
bBoolean
=
(
nFlags
&
IDF_SPECIAL_BOOLEAN
)
!=
IDF_NONE
;
bool
bFormula
=
(
nFlags
&
IDF_FORMULA
)
!=
IDF_NONE
;
switch
(
rSrcCell
.
meType
)
{
case
CELLTYPE_VALUE
:
{
bool
bPaste
=
isDateCell
(
rSrcCol
,
rSrcPos
.
Row
())
?
bDateTime
:
bNumeric
;
if
(
!
bPaste
)
// Don't paste this.
rSrcCell
.
clear
();
}
break
;
case
CELLTYPE_STRING
:
case
CELLTYPE_EDIT
:
{
if
(
!
bString
)
// Skip pasting.
rSrcCell
.
clear
();
}
break
;
case
CELLTYPE_FORMULA
:
{
if
(
bBoolean
)
{
// Check if this formula cell is a boolean cell, and if so, go ahead and paste it.
ScTokenArray
*
pCode
=
rSrcCell
.
mpFormula
->
GetCode
();
if
(
pCode
&&
pCode
->
GetLen
()
==
1
)
{
const
formula
::
FormulaToken
*
p
=
pCode
->
First
();
if
(
p
->
GetOpCode
()
==
ocTrue
||
p
->
GetOpCode
()
==
ocFalse
)
// This is a boolean formula. Good.
break
;
}
}
if
(
bFormula
)
// Good.
break
;
sal_uInt16
nErr
=
rSrcCell
.
mpFormula
->
GetErrCode
();
if
(
nErr
)
{
// error codes are cloned with values
if
(
!
bNumeric
)
// Error code is treated as numeric value. Don't paste it.
rSrcCell
.
clear
();
}
else
if
(
rSrcCell
.
mpFormula
->
IsValue
())
{
bool
bPaste
=
isDateCell
(
rSrcCol
,
rSrcPos
.
Row
())
?
bDateTime
:
bNumeric
;
if
(
!
bPaste
)
{
// Don't paste this.
rSrcCell
.
clear
();
break
;
}
// Turn this into a numeric cell.
rSrcCell
.
set
(
rSrcCell
.
mpFormula
->
GetValue
());
}
else
if
(
bString
)
{
svl
::
SharedString
aStr
=
rSrcCell
.
mpFormula
->
GetString
();
if
(
aStr
.
isEmpty
())
{
// do not clone empty string
rSrcCell
.
clear
();
break
;
}
// Turn this into a string or edit cell.
if
(
rSrcCell
.
mpFormula
->
IsMultilineResult
())
{
// TODO : Add shared string support to the edit engine to
// make this process simpler.
ScFieldEditEngine
&
rEngine
=
mrDestDoc
.
GetEditEngine
();
rEngine
.
SetText
(
rSrcCell
.
mpFormula
->
GetString
().
getString
());
boost
::
scoped_ptr
<
EditTextObject
>
pObj
(
rEngine
.
CreateTextObject
());
pObj
->
NormalizeString
(
mrDestDoc
.
GetSharedStringPool
());
rSrcCell
.
set
(
*
pObj
);
}
else
rSrcCell
.
set
(
rSrcCell
.
mpFormula
->
GetString
());
}
else
// We don't want to paste this.
rSrcCell
.
clear
();
}
break
;
case
CELLTYPE_NONE
:
default
:
// There is nothing to paste.
rSrcCell
.
clear
();
}
}
}
const
ScPatternAttr
*
CopyFromClipContext
::
getSingleCellPattern
(
size_t
nColOffset
)
const
const
ScPatternAttr
*
CopyFromClipContext
::
getSingleCellPattern
(
size_t
nColOffset
)
const
{
{
assert
(
nColOffset
<
maSinglePatterns
.
size
());
assert
(
nColOffset
<
maSinglePatterns
.
size
());
...
...
sc/source/core/data/document10.cxx
Dosyayı görüntüle @
e392f758
...
@@ -104,123 +104,7 @@ bool ScDocument::CopyOneCellFromClip(
...
@@ -104,123 +104,7 @@ bool ScDocument::CopyOneCellFromClip(
if
((
rCxt
.
getInsertFlag
()
&
(
IDF_NOTE
|
IDF_ADDNOTES
))
!=
IDF_NONE
)
if
((
rCxt
.
getInsertFlag
()
&
(
IDF_NOTE
|
IDF_ADDNOTES
))
!=
IDF_NONE
)
rCxt
.
setSingleCellNote
(
nColOffset
,
pClipDoc
->
GetNote
(
aSrcPos
));
rCxt
.
setSingleCellNote
(
nColOffset
,
pClipDoc
->
GetNote
(
aSrcPos
));
ScCellValue
&
rSrcCell
=
rCxt
.
getSingleCell
(
nColOffset
);
rCxt
.
setSingleCell
(
aSrcPos
,
pSrcTab
->
aCol
[
aSrcPos
.
Col
()]);
if
(
rCxt
.
isAsLink
())
{
ScSingleRefData
aRef
;
aRef
.
InitAddress
(
aSrcPos
);
aRef
.
SetFlag3D
(
true
);
ScTokenArray
aArr
;
aArr
.
AddSingleReference
(
aRef
);
rSrcCell
.
set
(
new
ScFormulaCell
(
pClipDoc
,
aSrcPos
,
aArr
));
}
else
{
rSrcCell
.
assign
(
*
pClipDoc
,
aSrcPos
);
// Check the paste flag to see whether we want to paste this cell. If the
// flag says we don't want to paste this cell, we'll return with true.
InsertDeleteFlags
nFlags
=
rCxt
.
getInsertFlag
();
bool
bNumeric
=
(
nFlags
&
IDF_VALUE
)
!=
IDF_NONE
;
bool
bDateTime
=
(
nFlags
&
IDF_DATETIME
)
!=
IDF_NONE
;
bool
bString
=
(
nFlags
&
IDF_STRING
)
!=
IDF_NONE
;
bool
bBoolean
=
(
nFlags
&
IDF_SPECIAL_BOOLEAN
)
!=
IDF_NONE
;
bool
bFormula
=
(
nFlags
&
IDF_FORMULA
)
!=
IDF_NONE
;
switch
(
rSrcCell
.
meType
)
{
case
CELLTYPE_VALUE
:
{
bool
bPaste
=
rCxt
.
isDateCell
(
pSrcTab
->
aCol
[
aSrcPos
.
Col
()],
aSrcPos
.
Row
())
?
bDateTime
:
bNumeric
;
if
(
!
bPaste
)
// Don't paste this.
rSrcCell
.
clear
();
}
break
;
case
CELLTYPE_STRING
:
case
CELLTYPE_EDIT
:
{
if
(
!
bString
)
// Skip pasting.
rSrcCell
.
clear
();
}
break
;
case
CELLTYPE_FORMULA
:
{
if
(
bBoolean
)
{
// Check if this formula cell is a boolean cell, and if so, go ahead and paste it.
ScTokenArray
*
pCode
=
rSrcCell
.
mpFormula
->
GetCode
();
if
(
pCode
&&
pCode
->
GetLen
()
==
1
)
{
const
formula
::
FormulaToken
*
p
=
pCode
->
First
();
if
(
p
->
GetOpCode
()
==
ocTrue
||
p
->
GetOpCode
()
==
ocFalse
)
// This is a boolean formula. Good.
break
;
}
}
if
(
bFormula
)
// Good.
break
;
sal_uInt16
nErr
=
rSrcCell
.
mpFormula
->
GetErrCode
();
if
(
nErr
)
{
// error codes are cloned with values
if
(
!
bNumeric
)
// Error code is treated as numeric value. Don't paste it.
rSrcCell
.
clear
();
}
else
if
(
rSrcCell
.
mpFormula
->
IsValue
())
{
bool
bPaste
=
rCxt
.
isDateCell
(
pSrcTab
->
aCol
[
aSrcPos
.
Col
()],
aSrcPos
.
Row
())
?
bDateTime
:
bNumeric
;
if
(
!
bPaste
)
{
// Don't paste this.
rSrcCell
.
clear
();
break
;
}
// Turn this into a numeric cell.
rSrcCell
.
set
(
rSrcCell
.
mpFormula
->
GetValue
());
}
else
if
(
bString
)
{
svl
::
SharedString
aStr
=
rSrcCell
.
mpFormula
->
GetString
();
if
(
aStr
.
isEmpty
())
{
// do not clone empty string
rSrcCell
.
clear
();
break
;
}
// Turn this into a string or edit cell.
if
(
rSrcCell
.
mpFormula
->
IsMultilineResult
())
{
// TODO : Add shared string support to the edit engine to
// make this process simpler.
ScFieldEditEngine
&
rEngine
=
GetEditEngine
();
rEngine
.
SetText
(
rSrcCell
.
mpFormula
->
GetString
().
getString
());
boost
::
scoped_ptr
<
EditTextObject
>
pObj
(
rEngine
.
CreateTextObject
());
pObj
->
NormalizeString
(
GetSharedStringPool
());
rSrcCell
.
set
(
*
pObj
);
}
else
rSrcCell
.
set
(
rSrcCell
.
mpFormula
->
GetString
());
}
else
// We don't want to paste this.
rSrcCell
.
clear
();
}
break
;
case
CELLTYPE_NONE
:
default
:
// There is nothing to paste.
rSrcCell
.
clear
();
}
}
}
}
// All good. Proceed with the pasting.
// All good. Proceed with the pasting.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment