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
0d2ce71a
Kaydet (Commit)
0d2ce71a
authored
Ock 26, 2015
tarafından
László Németh
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fdo#88810 avoid unnecessary massive O(U)String allocations in XLSX export
Change-Id: Ie6a024463e7ee9b0f4492b2431533708a578faf0
üst
6de91546
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
71 additions
and
3 deletions
+71
-3
address.hxx
sc/inc/address.hxx
+3
-0
address.cxx
sc/source/core/tool/address.cxx
+45
-0
xestream.cxx
sc/source/filter/excel/xestream.cxx
+10
-0
xetable.cxx
sc/source/filter/excel/xetable.cxx
+11
-3
xestream.hxx
sc/source/filter/inc/xestream.hxx
+2
-0
No files found.
sc/inc/address.hxx
Dosyayı görüntüle @
0d2ce71a
...
...
@@ -325,6 +325,9 @@ public:
ExternalInfo
*
pExtInfo
=
NULL
,
const
css
::
uno
::
Sequence
<
css
::
sheet
::
ExternalLinkInfo
>*
pExternalLinks
=
NULL
);
SC_DLLPUBLIC
bool
TryFormat
(
char
*
s
,
sal_uInt16
nFlags
=
0
,
const
ScDocument
*
pDocument
=
NULL
,
const
Details
&
rDetails
=
detailsOOOa1
)
const
;
SC_DLLPUBLIC
OUString
Format
(
sal_uInt16
nFlags
=
0
,
const
ScDocument
*
pDocument
=
NULL
,
const
Details
&
rDetails
=
detailsOOOa1
)
const
;
...
...
sc/source/core/tool/address.cxx
Dosyayı görüntüle @
0d2ce71a
...
...
@@ -1745,6 +1745,51 @@ static OUString getFileNameFromDoc( const ScDocument* pDoc )
return
sFileName
;
}
/** Tries to obtain a simple address without OUString/OString allocation
*
* @returns TRUE at success (it is enough to call OUString Format() at FALSE)
*
*/
bool
ScAddress
::
TryFormat
(
char
*
s
,
sal_uInt16
nFlags
,
const
ScDocument
*
pDoc
,
const
Details
&
rDetails
)
const
{
if
(
nFlags
&
SCA_VALID
)
nFlags
|=
(
SCA_VALID_ROW
|
SCA_VALID_COL
|
SCA_VALID_TAB
);
if
((
pDoc
&&
(
nFlags
&
SCA_VALID_TAB
)
&&
(
nTab
>=
pDoc
->
GetTableCount
()
||
(
nFlags
&
SCA_TAB_3D
)))
||
!
(
nFlags
&
SCA_VALID_COL
)
||
!
(
nFlags
&
SCA_VALID_ROW
)
||
(
nFlags
&
SCA_COL_ABSOLUTE
)
!=
0
||
(
nFlags
&
SCA_ROW_ABSOLUTE
)
!=
0
)
{
return
false
;
}
switch
(
rDetails
.
eConv
)
{
default
:
// Note: length of s (defined by SIMPLEADDRESSLEN) supports the following simple addresses
case
formula
:
:
FormulaGrammar
::
CONV_OOO
:
case
formula
:
:
FormulaGrammar
::
CONV_XL_A1
:
case
formula
:
:
FormulaGrammar
::
CONV_XL_OOX
:
if
(
nCol
>=
26
*
26
)
// TODO: extend it for full column range
return
false
;
if
(
nCol
<
26
)
*
s
=
'A'
+
nCol
;
else
{
*
s
=
'A'
+
nCol
/
26
-
1
;
s
++
;
*
s
=
'A'
+
nCol
%
26
;
}
sprintf
(
s
+
1
,
"%d"
,
nRow
+
1
);
break
;
case
formula
:
:
FormulaGrammar
::
CONV_XL_R1C1
:
// not used in XLSX export
return
false
;
}
return
true
;
}
OUString
ScAddress
::
Format
(
sal_uInt16
nFlags
,
const
ScDocument
*
pDoc
,
const
Details
&
rDetails
)
const
{
...
...
sc/source/filter/excel/xestream.cxx
Dosyayı görüntüle @
0d2ce71a
...
...
@@ -718,6 +718,11 @@ OString XclXmlUtils::ToOString( const OUString& s )
return
OUStringToOString
(
s
,
RTL_TEXTENCODING_UTF8
);
}
bool
XclXmlUtils
::
TryToChar
(
char
*
s
,
const
ScAddress
&
rAddress
)
{
return
rAddress
.
TryFormat
(
s
,
SCA_VALID
,
NULL
,
ScAddress
::
Details
(
FormulaGrammar
::
CONV_XL_A1
));
}
OString
XclXmlUtils
::
ToOString
(
const
ScAddress
&
rAddress
)
{
OUString
sAddress
(
rAddress
.
Format
(
SCA_VALID
,
NULL
,
ScAddress
::
Details
(
FormulaGrammar
::
CONV_XL_A1
)));
...
...
@@ -760,6 +765,11 @@ static ScAddress lcl_ToAddress( const XclAddress& rAddress )
return
aAddress
;
}
bool
XclXmlUtils
::
TryToChar
(
sal_Char
*
s
,
const
XclAddress
&
rAddress
)
{
return
TryToChar
(
s
,
lcl_ToAddress
(
rAddress
));
}
OString
XclXmlUtils
::
ToOString
(
const
XclAddress
&
rAddress
)
{
return
ToOString
(
lcl_ToAddress
(
rAddress
)
);
...
...
sc/source/filter/excel/xetable.cxx
Dosyayı görüntüle @
0d2ce71a
...
...
@@ -41,6 +41,11 @@ using namespace ::oox;
namespace
ApiScriptType
=
::
com
::
sun
::
star
::
i18n
::
ScriptType
;
// max string length of simple addresses (eg. ABC1000000\0)
#if MAXROWCOUNT_DEFINE < 9999999
#define SIMPLEADDRESSLEN 11
#endif
// Helper records for cell records
XclExpStringRec
::
XclExpStringRec
(
const
XclExpRoot
&
rRoot
,
const
OUString
&
rResult
)
:
...
...
@@ -630,9 +635,10 @@ static OString lcl_GetStyleId( XclExpXmlStream& rStrm, const XclExpCellBase& rCe
void
XclExpNumberCell
::
SaveXml
(
XclExpXmlStream
&
rStrm
)
{
char
fastAdr
[
SIMPLEADDRESSLEN
];
sax_fastparser
::
FSHelperPtr
&
rWorksheet
=
rStrm
.
GetCurrentStream
();
rWorksheet
->
startElement
(
XML_c
,
XML_r
,
XclXmlUtils
::
ToOString
(
GetXclPos
()
).
getStr
(),
XML_r
,
XclXmlUtils
::
T
ryToChar
(
fastAdr
,
GetXclPos
()
)
?
fastAdr
:
XclXmlUtils
::
T
oOString
(
GetXclPos
()
).
getStr
(),
XML_s
,
lcl_GetStyleId
(
rStrm
,
*
this
).
getStr
(),
XML_t
,
"n"
,
// OOXTODO: XML_cm, XML_vm, XML_ph
...
...
@@ -923,11 +929,12 @@ void XclExpFormulaCell::SaveXml( XclExpXmlStream& rStrm )
{
const
char
*
sType
=
NULL
;
OUString
sValue
;
char
fastAdr
[
SIMPLEADDRESSLEN
];
XclXmlUtils
::
GetFormulaTypeAndValue
(
mrScFmlaCell
,
sType
,
sValue
);
sax_fastparser
::
FSHelperPtr
&
rWorksheet
=
rStrm
.
GetCurrentStream
();
rWorksheet
->
startElement
(
XML_c
,
XML_r
,
XclXmlUtils
::
ToOString
(
GetXclPos
()
).
getStr
(),
XML_r
,
XclXmlUtils
::
T
ryToChar
(
fastAdr
,
GetXclPos
()
)
?
fastAdr
:
XclXmlUtils
::
T
oOString
(
GetXclPos
()
).
getStr
(),
XML_s
,
lcl_GetStyleId
(
rStrm
,
*
this
).
getStr
(),
XML_t
,
sType
,
// OOXTODO: XML_cm, XML_vm, XML_ph
...
...
@@ -1307,9 +1314,10 @@ bool XclExpRkCell::TryMerge( const XclExpCellBase& rCell )
void
XclExpRkCell
::
WriteXmlContents
(
XclExpXmlStream
&
rStrm
,
const
XclAddress
&
rAddress
,
sal_uInt32
nXFId
,
sal_uInt16
nRelCol
)
{
char
fastAdr
[
SIMPLEADDRESSLEN
];
sax_fastparser
::
FSHelperPtr
&
rWorksheet
=
rStrm
.
GetCurrentStream
();
rWorksheet
->
startElement
(
XML_c
,
XML_r
,
XclXmlUtils
::
ToOString
(
rAddress
).
getStr
(),
XML_r
,
XclXmlUtils
::
T
ryToChar
(
fastAdr
,
rAddress
)
?
fastAdr
:
XclXmlUtils
::
T
oOString
(
rAddress
).
getStr
(),
XML_s
,
lcl_GetStyleId
(
rStrm
,
nXFId
).
getStr
(),
XML_t
,
"n"
,
// OOXTODO: XML_cm, XML_vm, XML_ph
...
...
sc/source/filter/inc/xestream.hxx
Dosyayı görüntüle @
0d2ce71a
...
...
@@ -266,9 +266,11 @@ public:
static
OString
ToOString
(
const
Color
&
rColor
);
static
OString
ToOString
(
const
OUString
&
s
);
static
OString
ToOString
(
const
ScfUInt16Vec
&
rBuffer
);
static
bool
TryToChar
(
char
*
s
,
const
ScAddress
&
rRange
);
static
OString
ToOString
(
const
ScAddress
&
rRange
);
static
OString
ToOString
(
const
ScRange
&
rRange
);
static
OString
ToOString
(
const
ScRangeList
&
rRangeList
);
static
bool
TryToChar
(
char
*
s
,
const
XclAddress
&
rAddress
);
static
OString
ToOString
(
const
XclAddress
&
rAddress
);
static
OString
ToOString
(
const
XclExpString
&
s
);
static
OString
ToOString
(
const
XclRange
&
rRange
);
...
...
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