sc/source/filter/xml/xmlexprt.cxx | 68 +++++++++++++++++++++----------------- sc/source/filter/xml/xmlexprt.hxx | 1 2 files changed, 39 insertions(+), 30 deletions(-)
New commits: commit f10f5ca011c3d06d3470b9e21bda13d505cfe93e Author: Kohei Yoshida <kohei.yosh...@gmail.com> Date: Thu Aug 15 20:10:52 2013 -0400 Make this a separate function. This code block happens to be a performance hot spot right now. Change-Id: I4fa2c4ea27cb6ae4c4331d0bb474eddc167b69fa diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index 23fd580..1564b0b 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 b3bfdb1..1823af3 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(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits