summaryrefslogtreecommitdiff
path: root/sw/source/uibase/app
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-01-12 17:08:31 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-01-13 01:05:09 +0100
commit53ef918a6839c8d587dec1bb635e6b39397c53d0 (patch)
tree92cefdb80b6b1dc7bfb9400b64c90301b3c5c7e1 /sw/source/uibase/app
parentefc06e9bb696110350ab3e14344de53db992280e (diff)
sw: lazy load table autoformats for style purposes
Commit b7138e03ebc8a33258c099c5cf6015970646a40e (GSoC Writer Table Styles; Import bugfix, 2016-07-26) changed the SwDoc ctor to always load the table autoformats, which is expensive for simple documents. Avoid the load in the ctor by switching to lazy-load and adding a way to count the number of styles without loading the autoformats when there would be none. (mpTableStyles -> m_pTableStyles was only necessary to see if there is access outside GetTableStyles() to this member, but there were not any.) Times for 100 hello world inputs: 3863 -> 2753 ms is spent in XHTML-load + ODT export + close (71% of original). Change-Id: I6737e7712c775573b56c8b0566e8e7fb615edee6 Reviewed-on: https://gerrit.libreoffice.org/47820 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sw/source/uibase/app')
-rw-r--r--sw/source/uibase/app/docstyle.cxx23
1 files changed, 13 insertions, 10 deletions
diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx
index a43fc90265dd..dbb7f0316241 100644
--- a/sw/source/uibase/app/docstyle.cxx
+++ b/sw/source/uibase/app/docstyle.cxx
@@ -3039,18 +3039,21 @@ SfxStyleSheetBase* SwStyleSheetIterator::First()
nSearchFamily == SfxStyleFamily::All )
{
const auto& aTableTemplateMap = SwTableAutoFormat::GetTableTemplateMap();
- const SwTableAutoFormatTable& rTableStyles = rDoc.GetTableStyles();
- for(size_t i = 0; i < rTableStyles.size(); ++i)
+ if (rDoc.HasTableStyles())
{
- const SwTableAutoFormat& rTableStyle = rTableStyles[i];
- for(size_t nBoxFormat = 0; nBoxFormat < aTableTemplateMap.size(); ++nBoxFormat)
+ const SwTableAutoFormatTable& rTableStyles = rDoc.GetTableStyles();
+ for(size_t i = 0; i < rTableStyles.size(); ++i)
{
- const sal_uInt32 nBoxIndex = aTableTemplateMap[nBoxFormat];
- const SwBoxAutoFormat& rBoxFormat = rTableStyle.GetBoxFormat(nBoxIndex);
- OUString sBoxFormatName;
- SwStyleNameMapper::FillProgName(rTableStyle.GetName(), sBoxFormatName, SwGetPoolIdFromName::CellStyle);
- sBoxFormatName += rTableStyle.GetTableTemplateCellSubName(rBoxFormat);
- aLst.Append( cCELLSTYLE, sBoxFormatName );
+ const SwTableAutoFormat& rTableStyle = rTableStyles[i];
+ for(size_t nBoxFormat = 0; nBoxFormat < aTableTemplateMap.size(); ++nBoxFormat)
+ {
+ const sal_uInt32 nBoxIndex = aTableTemplateMap[nBoxFormat];
+ const SwBoxAutoFormat& rBoxFormat = rTableStyle.GetBoxFormat(nBoxIndex);
+ OUString sBoxFormatName;
+ SwStyleNameMapper::FillProgName(rTableStyle.GetName(), sBoxFormatName, SwGetPoolIdFromName::CellStyle);
+ sBoxFormatName += rTableStyle.GetTableTemplateCellSubName(rBoxFormat);
+ aLst.Append( cCELLSTYLE, sBoxFormatName );
+ }
}
}
const SwCellStyleTable& rCellStyles = rDoc.GetCellStyles();