summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-08-15 20:10:52 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-08-15 20:12:11 -0400
commitf10f5ca011c3d06d3470b9e21bda13d505cfe93e (patch)
tree3ab367be2b343b94d79c4d5445bd48eb178ae7eb /sc
parentb04b5cfca4bce863a28f0b8fef8b2cf02dda3be2 (diff)
Make this a separate function.
This code block happens to be a performance hot spot right now. Change-Id: I4fa2c4ea27cb6ae4c4331d0bb474eddc167b69fa
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/xml/xmlexprt.cxx68
-rw-r--r--sc/source/filter/xml/xmlexprt.hxx1
2 files changed, 39 insertions, 30 deletions
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 23fd58076b8a..1564b0bd171c 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -1101,6 +1101,41 @@ void ScXMLExport::ExportExternalRefCacheStyles()
}
}
+void ScXMLExport::ExportCellTextAutoStyles(const Reference <sheet::XSpreadsheet>& xTable)
+{
+ Reference<sheet::XCellRangesQuery> xCellRangesQuery (xTable, uno::UNO_QUERY);
+ if (!xCellRangesQuery.is())
+ return;
+
+ Reference<sheet::XSheetCellRanges> xSheetCellRanges(xCellRangesQuery->queryContentCells(sheet::CellFlags::FORMATTED));
+ if (!xSheetCellRanges.is())
+ return;
+
+ uno::Sequence< table::CellRangeAddress > aCellRangeAddresses (xSheetCellRanges->getRangeAddresses());
+ sal_uInt32 nCount(aCellRangeAddresses.getLength());
+ Reference<container::XEnumerationAccess> xCellsAccess(xSheetCellRanges->getCells());
+ if (!xCellsAccess.is())
+ return;
+
+ GetProgressBarHelper()->ChangeReference(GetProgressBarHelper()->GetReference() + nCount);
+ Reference<container::XEnumeration> xCells(xCellsAccess->createEnumeration());
+ if (!xCells.is())
+ return;
+
+ sal_uInt32 nCount2 = 0;
+ while (xCells->hasMoreElements())
+ {
+ Reference<text::XText> xText(xCells->nextElement(), uno::UNO_QUERY);
+ if (xText.is())
+ GetTextParagraphExport()->collectTextAutoStyles(xText, false, false);
+ ++nCount2;
+ IncrementProgressBar(false);
+ }
+
+ if (nCount2 > nCount)
+ GetProgressBarHelper()->SetReference(GetProgressBarHelper()->GetReference() + nCount2 - nCount);
+}
+
void ScXMLExport::WriteRowContent()
{
ScMyRowFormatRange aRange;
@@ -2428,37 +2463,10 @@ void ScXMLExport::_ExportAutoStyles()
}
}
}
- Reference<sheet::XCellRangesQuery> xCellRangesQuery (xTable, uno::UNO_QUERY);
- if (xCellRangesQuery.is())
- {
- Reference<sheet::XSheetCellRanges> xSheetCellRanges(xCellRangesQuery->queryContentCells(sheet::CellFlags::FORMATTED));
- if (xSheetCellRanges.is())
- {
- uno::Sequence< table::CellRangeAddress > aCellRangeAddresses (xSheetCellRanges->getRangeAddresses());
- sal_uInt32 nCount(aCellRangeAddresses.getLength());
- Reference<container::XEnumerationAccess> xCellsAccess(xSheetCellRanges->getCells());
- if (xCellsAccess.is())
- {
- GetProgressBarHelper()->ChangeReference(GetProgressBarHelper()->GetReference() + nCount);
- Reference<container::XEnumeration> xCells(xCellsAccess->createEnumeration());
- if (xCells.is())
- {
- sal_uInt32 nCount2(0);
- while (xCells->hasMoreElements())
- {
- Reference<text::XText> xText(xCells->nextElement(), uno::UNO_QUERY);
- if (xText.is())
- GetTextParagraphExport()->collectTextAutoStyles(xText, false, false);
- ++nCount2;
- IncrementProgressBar(false);
- }
- if(nCount2 > nCount)
- GetProgressBarHelper()->SetReference(GetProgressBarHelper()->GetReference() + nCount2 - nCount);
- }
- }
- }
- }
+
+ ExportCellTextAutoStyles(xTable);
}
+
pChangeTrackingExportHelper->CollectAutoStyles();
GetAutoStylePool()->exportXML(XML_STYLE_FAMILY_TABLE_COLUMN,
diff --git a/sc/source/filter/xml/xmlexprt.hxx b/sc/source/filter/xml/xmlexprt.hxx
index b3bfdb1c6e1d..1823af36581d 100644
--- a/sc/source/filter/xml/xmlexprt.hxx
+++ b/sc/source/filter/xml/xmlexprt.hxx
@@ -149,6 +149,7 @@ class ScXMLExport : public SvXMLExport
void CloseHeaderColumn();
void ExportColumns(const sal_Int32 nTable, const com::sun::star::table::CellRangeAddress& aColumnHeaderRange, const bool bHasColumnHeader);
void ExportExternalRefCacheStyles();
+ void ExportCellTextAutoStyles(const com::sun::star::uno::Reference<com::sun::star::sheet::XSpreadsheet>& xTable);
void ExportFormatRanges(const sal_Int32 nStartCol, const sal_Int32 nStartRow,
const sal_Int32 nEndCol, const sal_Int32 nEndRow, const sal_Int32 nSheet);
void WriteRowContent();