diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-09-24 20:41:52 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-09-26 19:37:12 +0000 |
commit | 89804c14ee99721d252e30468342384fbc8926b2 (patch) | |
tree | a543fb27fe9333b4a204aabba4ef984a2cb09f57 /xmloff/source/style | |
parent | f626fd5f897796451685c06ce5f397a90aeaa8e6 (diff) |
implement prototype for more stable calc cell style names
This should ensure that as long as the style does not change the cell
style name is the same after an import export cycle.
Each ScPatternAttr stores a unique ID and we store the ID to name
mapping during import. During export if we find a ScPatternAttr that has
a key that is also stored in the map we write back the style name from
the map.
To avoid name collisions we block the style names from the import for
the export.
The missing piece to make this completely awesome is now to make sure
that styles are sorted by name during export. That way we can reduce the
diff between import and export even more.
Change-Id: Ie4fe2aa00f07efec27ea129e314ac0b6b7e0d8c0
Reviewed-on: https://gerrit.libreoffice.org/29255
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'xmloff/source/style')
-rw-r--r-- | xmloff/source/style/impastpl.cxx | 11 | ||||
-rw-r--r-- | xmloff/source/style/impastpl.hxx | 2 | ||||
-rw-r--r-- | xmloff/source/style/xmlaustp.cxx | 6 |
3 files changed, 18 insertions, 1 deletions
diff --git a/xmloff/source/style/impastpl.cxx b/xmloff/source/style/impastpl.cxx index f35b09862a76..7a4cbce8233f 100644 --- a/xmloff/source/style/impastpl.cxx +++ b/xmloff/source/style/impastpl.cxx @@ -244,7 +244,7 @@ XMLAutoStylePoolProperties::XMLAutoStylePoolProperties( XMLAutoStyleFamily& rFam sBuffer.append( OUString::number( rFamilyData.mnName ) ); msName = sBuffer.makeStringAndClear(); } - while (rFamilyData.maNameSet.find(msName) != rFamilyData.maNameSet.end()); + while (rFamilyData.maNameSet.find(msName) != rFamilyData.maNameSet.end() || rFamilyData.maReservedNameSet.find(msName) != rFamilyData.maReservedNameSet.end()); } #if OSL_DEBUG_LEVEL > 0 @@ -455,6 +455,15 @@ void SvXMLAutoStylePoolP_Impl::RegisterName( sal_Int32 nFamily, const OUString& (*iter)->maNameSet.insert(rName); } +// Adds a name to list +void SvXMLAutoStylePoolP_Impl::RegisterDefinedName( sal_Int32 nFamily, const OUString& rName ) +{ + std::unique_ptr<XMLAutoStyleFamily> pTemp(new XMLAutoStyleFamily(nFamily)); + auto const iter = m_FamilySet.find(pTemp); + assert(iter != m_FamilySet.end()); // family must be known + (*iter)->maReservedNameSet.insert(rName); +} + // Retrieve the list of registered names diff --git a/xmloff/source/style/impastpl.hxx b/xmloff/source/style/impastpl.hxx index c70c4da4d78f..45ea50995ffc 100644 --- a/xmloff/source/style/impastpl.hxx +++ b/xmloff/source/style/impastpl.hxx @@ -111,6 +111,7 @@ struct XMLAutoStyleFamily ParentSetType m_ParentSet; std::set<OUString> maNameSet; + std::set<OUString> maReservedNameSet; sal_uInt32 mnCount; sal_uInt32 mnName; OUString maStrPrefix; @@ -155,6 +156,7 @@ public: void SetFamilyPropSetMapper( sal_Int32 nFamily, const rtl::Reference < SvXMLExportPropertyMapper > & rMapper ); void RegisterName( sal_Int32 nFamily, const OUString& rName ); + void RegisterDefinedName( sal_Int32 nFamily, const OUString& rName ); void GetRegisteredNames( css::uno::Sequence<sal_Int32>& aFamilies, css::uno::Sequence<OUString>& aNames ); diff --git a/xmloff/source/style/xmlaustp.cxx b/xmloff/source/style/xmlaustp.cxx index 493d46913733..adb678d2d358 100644 --- a/xmloff/source/style/xmlaustp.cxx +++ b/xmloff/source/style/xmlaustp.cxx @@ -309,6 +309,12 @@ void SvXMLAutoStylePoolP::RegisterName( sal_Int32 nFamily, pImpl->RegisterName( nFamily, rName ); } +void SvXMLAutoStylePoolP::RegisterDefinedName( sal_Int32 nFamily, + const OUString& rName ) +{ + pImpl->RegisterDefinedName( nFamily, rName ); +} + void SvXMLAutoStylePoolP::GetRegisteredNames( uno::Sequence<sal_Int32>& rFamilies, uno::Sequence<OUString>& rNames ) |