diff options
-rw-r--r-- | include/xmloff/xmlaustp.hxx | 3 | ||||
-rw-r--r-- | sc/inc/attarray.hxx | 6 | ||||
-rw-r--r-- | sc/inc/docpool.hxx | 2 | ||||
-rw-r--r-- | sc/inc/docuno.hxx | 2 | ||||
-rw-r--r-- | sc/inc/patattr.hxx | 4 | ||||
-rw-r--r-- | sc/inc/sheetdata.hxx | 5 | ||||
-rw-r--r-- | sc/inc/unonames.hxx | 1 | ||||
-rw-r--r-- | sc/inc/unowids.hxx | 3 | ||||
-rw-r--r-- | sc/source/core/data/attarray.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/docpool.cxx | 9 | ||||
-rw-r--r-- | sc/source/core/data/document.cxx | 8 | ||||
-rw-r--r-- | sc/source/core/data/patattr.cxx | 22 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlexprt.cxx | 29 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlimprt.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh.cxx | 11 | ||||
-rw-r--r-- | sc/source/ui/inc/docsh.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/unoobj/cellsuno.cxx | 10 | ||||
-rw-r--r-- | sc/source/ui/unoobj/docuno.cxx | 7 | ||||
-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 |
21 files changed, 143 insertions, 10 deletions
diff --git a/include/xmloff/xmlaustp.hxx b/include/xmloff/xmlaustp.hxx index 95b58b029ad4..a07cdbf32de2 100644 --- a/include/xmloff/xmlaustp.hxx +++ b/include/xmloff/xmlaustp.hxx @@ -87,6 +87,9 @@ public: /// Register a name that must not be used as a generated name. void RegisterName( sal_Int32 nFamily, const OUString& rName ); + /// Register a name that may only be used through AddNamed + void RegisterDefinedName(sal_Int32 nFamily, const OUString& rName); + /// retrieve the registered names (names + families) void GetRegisteredNames( css::uno::Sequence<sal_Int32>& aFamilies, diff --git a/sc/inc/attarray.hxx b/sc/inc/attarray.hxx index c24f658954dd..f22bc3444478 100644 --- a/sc/inc/attarray.hxx +++ b/sc/inc/attarray.hxx @@ -65,7 +65,11 @@ struct ScMergePatternState const ScPatternAttr* pOld1; ///< existing objects, temporary const ScPatternAttr* pOld2; - ScMergePatternState() : pItemSet(nullptr), pOld1(nullptr), pOld2(nullptr) {} + bool mbValidPatternId; + sal_uInt64 mnPatternId; + + ScMergePatternState() : pItemSet(nullptr), pOld1(nullptr), pOld2(nullptr), + mbValidPatternId(true), mnPatternId(0) {} }; struct ScAttrEntry diff --git a/sc/inc/docpool.hxx b/sc/inc/docpool.hxx index d3381ab8fdf7..8632ed430e9b 100644 --- a/sc/inc/docpool.hxx +++ b/sc/inc/docpool.hxx @@ -43,6 +43,8 @@ class SC_DLLPUBLIC ScDocumentPool: public SfxItemPool static sal_uInt16* pVersionMap11; static sal_uInt16* pVersionMap12; + sal_uInt64 mnCurrentMaxKey; + public: ScDocumentPool(); protected: diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx index 8e32685b8f2f..1487b0b2aa99 100644 --- a/sc/inc/docuno.hxx +++ b/sc/inc/docuno.hxx @@ -66,6 +66,7 @@ class ScTableSheetObj; class ScRangeList; class ScPrintUIOptions; class ScSheetSaveData; +struct ScFormatSaveData; class SC_DLLPUBLIC ScModelObj : public SfxBaseModel, public vcl::ITiledRenderable, @@ -132,6 +133,7 @@ public: void BeforeXMLLoading(); void AfterXMLLoading(); ScSheetSaveData* GetSheetSaveData(); + ScFormatSaveData* GetFormatSaveData(); void RepaintRange( const ScRange& rRange ); void RepaintRange( const ScRangeList& rRange ); diff --git a/sc/inc/patattr.hxx b/sc/inc/patattr.hxx index 244b9add84ff..f6a042e92517 100644 --- a/sc/inc/patattr.hxx +++ b/sc/inc/patattr.hxx @@ -52,6 +52,7 @@ class SC_DLLPUBLIC ScPatternAttr: public SfxSetItem { OUString* pName; ScStyleSheet* pStyle; + sal_uInt64 mnKey; public: ScPatternAttr(SfxItemSet* pItemSet, const OUString& rStyleName); ScPatternAttr(SfxItemSet* pItemSet); @@ -132,6 +133,9 @@ public: long GetRotateVal( const SfxItemSet* pCondSet ) const; sal_uInt8 GetRotateDir( const SfxItemSet* pCondSet ) const; + + void SetKey(sal_uInt64 nKey); + sal_uInt64 GetKey() const; }; #endif diff --git a/sc/inc/sheetdata.hxx b/sc/inc/sheetdata.hxx index e57e486922f0..107d2b5e2e9c 100644 --- a/sc/inc/sheetdata.hxx +++ b/sc/inc/sheetdata.hxx @@ -172,6 +172,11 @@ public: void SetInSupportedSave( bool bSet ); }; +struct ScFormatSaveData +{ + std::map<sal_uInt64, OUString> maIDToName; +}; + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx index 415399e1caef..e7ff39cbf595 100644 --- a/sc/inc/unonames.hxx +++ b/sc/inc/unonames.hxx @@ -103,6 +103,7 @@ #define SC_UNONAME_CELLVJUS_METHOD "VertJustifyMethod" #define SC_UNONAME_CELLORI "Orientation" #define SC_UNONAME_NUMFMT "NumberFormat" +#define SC_UNONAME_FORMATID "FormatID" #define SC_UNONAME_SHADOW "ShadowFormat" #define SC_UNONAME_TBLBORD "TableBorder" #define SC_UNONAME_TBLBORD2 "TableBorder2" diff --git a/sc/inc/unowids.hxx b/sc/inc/unowids.hxx index bd94159f760f..e099dd2c27fb 100644 --- a/sc/inc/unowids.hxx +++ b/sc/inc/unowids.hxx @@ -72,7 +72,8 @@ #define SC_WID_UNO_NAMES ( SC_WID_UNO_START + 42 ) #define SC_WID_UNO_TBLBORD2 ( SC_WID_UNO_START + 43 ) #define SC_WID_UNO_CONDFORMAT ( SC_WID_UNO_START + 44 ) -#define SC_WID_UNO_END ( SC_WID_UNO_START + 44 ) +#define SC_WID_UNO_FORMATID ( SC_WID_UNO_START + 45 ) +#define SC_WID_UNO_END ( SC_WID_UNO_START + 45 ) inline bool IsScUnoWid( sal_uInt16 nWid ) { diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx index a2aadccb6a7f..0f51713fae9f 100644 --- a/sc/source/core/data/attarray.cxx +++ b/sc/source/core/data/attarray.cxx @@ -925,6 +925,7 @@ void ScAttrArray::MergePatternArea( SCROW nStartRow, SCROW nEndRow, const SfxItemSet& rThisSet = pPattern->GetItemSet(); if (rState.pItemSet) { + rState.mbValidPatternId = false; if (bDeep) lcl_MergeDeep( *rState.pItemSet, rThisSet ); else @@ -935,6 +936,7 @@ void ScAttrArray::MergePatternArea( SCROW nStartRow, SCROW nEndRow, // first pattern - copied from parent rState.pItemSet = new SfxItemSet( *rThisSet.GetPool(), rThisSet.GetRanges() ); rState.pItemSet->Set( rThisSet, bDeep ); + rState.mnPatternId = pPattern->GetKey(); } rState.pOld2 = rState.pOld1; diff --git a/sc/source/core/data/docpool.cxx b/sc/source/core/data/docpool.cxx index e8f07f0e7111..94d177cac43e 100644 --- a/sc/source/core/data/docpool.cxx +++ b/sc/source/core/data/docpool.cxx @@ -190,7 +190,8 @@ ScDocumentPool::ScDocumentPool() : SfxItemPool ( OUString("ScDocumentPool"), ATTR_STARTINDEX, ATTR_ENDINDEX, - aItemInfos, nullptr, false/*bLoadRefCounts*/ ) + aItemInfos, nullptr, false/*bLoadRefCounts*/ ), + mnCurrentMaxKey(0) { // latin font from GetDefaultFonts is not used, DEFAULTFONT_LATIN_SPREADSHEET instead vcl::Font aStdFont = OutputDevice::GetDefaultFont( DefaultFontType::LATIN_SPREADSHEET, LANGUAGE_ENGLISH_US, @@ -609,6 +610,12 @@ const SfxPoolItem& ScDocumentPool::Put( const SfxPoolItem& rItem, sal_uInt16 nWh // Else Put must always happen, because it could be another Pool const SfxPoolItem& rNew = SfxItemPool::Put( rItem, nWhich ); + sal_uLong nRef = rNew.GetRefCount(); + if (nRef == 1) + { + ++mnCurrentMaxKey; + const_cast<ScPatternAttr&>(static_cast<const ScPatternAttr&>(rNew)).SetKey(mnCurrentMaxKey); + } CheckRef( rNew ); return rNew; } diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 96269cb622ae..9462a54e9bbf 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -4988,7 +4988,13 @@ ScPatternAttr* ScDocument::CreateSelectionPattern( const ScMarkData& rMark, bool OSL_ENSURE( aState.pItemSet, "SelectionPattern Null" ); if (aState.pItemSet) - return new ScPatternAttr( aState.pItemSet ); + { + ScPatternAttr* pPattern = new ScPatternAttr( aState.pItemSet ); + if (aState.mbValidPatternId) + pPattern->SetKey(aState.mnPatternId); + + return pPattern; + } else return new ScPatternAttr( GetPool() ); // empty } diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx index dd618e8c7d30..57e66f692a9a 100644 --- a/sc/source/core/data/patattr.cxx +++ b/sc/source/core/data/patattr.cxx @@ -68,27 +68,31 @@ using sc::TwipsToHMM; ScPatternAttr::ScPatternAttr( SfxItemSet* pItemSet, const OUString& rStyleName ) : SfxSetItem ( ATTR_PATTERN, pItemSet ), pName ( new OUString( rStyleName ) ), - pStyle ( nullptr ) + pStyle ( nullptr ), + mnKey(0) { } ScPatternAttr::ScPatternAttr( SfxItemSet* pItemSet ) : SfxSetItem ( ATTR_PATTERN, pItemSet ), pName ( nullptr ), - pStyle ( nullptr ) + pStyle ( nullptr ), + mnKey(0) { } ScPatternAttr::ScPatternAttr( SfxItemPool* pItemPool ) : SfxSetItem ( ATTR_PATTERN, new SfxItemSet( *pItemPool, ATTR_PATTERN_START, ATTR_PATTERN_END ) ), pName ( nullptr ), - pStyle ( nullptr ) + pStyle ( nullptr ), + mnKey(0) { } ScPatternAttr::ScPatternAttr( const ScPatternAttr& rPatternAttr ) : SfxSetItem ( rPatternAttr ), - pStyle ( rPatternAttr.pStyle ) + pStyle ( rPatternAttr.pStyle ), + mnKey(rPatternAttr.mnKey) { if (rPatternAttr.pName) pName = new OUString(*rPatternAttr.pName); @@ -1411,4 +1415,14 @@ sal_uInt8 ScPatternAttr::GetRotateDir( const SfxItemSet* pCondSet ) const return nRet; } +void ScPatternAttr::SetKey(sal_uInt64 nKey) +{ + mnKey = nKey; +} + +sal_uInt64 ScPatternAttr::GetKey() const +{ + return mnKey; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index 437df5d4ecda..8a0931c42db3 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -1908,6 +1908,17 @@ void ScXMLExport::ExportContent_() void ScXMLExport::ExportStyles_( bool bUsed ) { + Reference <sheet::XSpreadsheetDocument> xSpreadDoc( GetModel(), uno::UNO_QUERY ); + if (xSpreadDoc.is()) + { + ScFormatSaveData* pFormatData = ScModelObj::getImplementation(xSpreadDoc)->GetFormatSaveData(); + auto aAutoStylePool = GetAutoStylePool(); + for (const auto& rFormatInfo : pFormatData->maIDToName) + { + aAutoStylePool->RegisterDefinedName(XML_STYLE_FAMILY_TABLE_CELL, rFormatInfo.second); + } + } + if (!pSharedData) { SCTAB nTableCount(0); @@ -1965,6 +1976,10 @@ void ScXMLExport::AddStyleFromCells(const uno::Reference<beans::XPropertySet>& x const uno::Reference<sheet::XSpreadsheet>& xTable, sal_Int32 nTable, const OUString* pOldName) { + css::uno::Any aAny = xProperties->getPropertyValue("FormatID"); + sal_uInt64 nKey = 0; + aAny >>= nKey; + //! pass xCellRanges instead uno::Reference<sheet::XSheetCellRanges> xCellRanges( xProperties, uno::UNO_QUERY ); @@ -2048,8 +2063,20 @@ void ScXMLExport::AddStyleFromCells(const uno::Reference<beans::XPropertySet>& x else { OUString sName; + bool bAdded = false; + if (nKey) + { + Reference <sheet::XSpreadsheetDocument> xSpreadDoc( GetModel(), uno::UNO_QUERY ); + ScFormatSaveData* pFormatData = ScModelObj::getImplementation(xSpreadDoc)->GetFormatSaveData(); + auto itr = pFormatData->maIDToName.find(nKey); + if (itr != pFormatData->maIDToName.end()) + { + sName = itr->second; + bAdded = GetAutoStylePool()->AddNamed(sName, XML_STYLE_FAMILY_TABLE_CELL, sStyleName, aPropStates); + } + } bool bIsAutoStyle(true); - if (GetAutoStylePool()->Add(sName, XML_STYLE_FAMILY_TABLE_CELL, sStyleName, aPropStates)) + if (bAdded || GetAutoStylePool()->Add(sName, XML_STYLE_FAMILY_TABLE_CELL, sStyleName, aPropStates)) { OUString* pTemp(new OUString(sName)); if (!pCellStyles->AddStyleName(pTemp, nIndex)) diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index 55c49b33a513..018b56ed93cc 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -2835,6 +2835,14 @@ void ScXMLImport::SetStyleToRanges() sal_Int32 nNumberFormat(pStyle->GetNumberFormat()); SetType(xProperties, nNumberFormat, nPrevCellType, sPrevCurrency); + css::uno::Any aAny = xProperties->getPropertyValue("FormatID"); + sal_uInt64 nKey = 0; + if ((aAny >>= nKey) && nKey) + { + ScFormatSaveData* pFormatSaveData = ScModelObj::getImplementation(GetModel())->GetFormatSaveData(); + pFormatSaveData->maIDToName.insert(std::pair<sal_uInt64, OUString>(nKey, sPrevStyleName)); + } + // store first cell of first range for each style, once per sheet uno::Sequence<table::CellRangeAddress> aAddresses(xSheetCellRanges->getRangeAddresses()); pStyle->ApplyCondFormat(aAddresses); diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index a1b32f0f3c06..ca0b2a0bfe03 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -2686,6 +2686,7 @@ ScDocShell::ScDocShell( const ScDocShell& rShell ) : pPaintLockData ( nullptr ), pSolverSaveData ( nullptr ), pSheetSaveData ( nullptr ), + mpFormatSaveData( nullptr ), pModificator ( nullptr ) #if ENABLE_TELEPATHY , mpCollaboration( new ScCollaboration( this ) ) @@ -2731,6 +2732,7 @@ ScDocShell::ScDocShell( const SfxModelFlags i_nSfxCreationFlags ) : pPaintLockData ( nullptr ), pSolverSaveData ( nullptr ), pSheetSaveData ( nullptr ), + mpFormatSaveData( nullptr ), pModificator ( nullptr ) #if ENABLE_TELEPATHY , mpCollaboration( new ScCollaboration( this ) ) @@ -2782,6 +2784,7 @@ ScDocShell::~ScDocShell() delete pSolverSaveData; delete pSheetSaveData; + delete mpFormatSaveData; delete pOldAutoDBRange; if (pModificator) @@ -2962,6 +2965,14 @@ ScSheetSaveData* ScDocShell::GetSheetSaveData() return pSheetSaveData; } +ScFormatSaveData* ScDocShell::GetFormatSaveData() +{ + if (!mpFormatSaveData) + mpFormatSaveData = new ScFormatSaveData; + + return mpFormatSaveData; +} + namespace { void removeKeysIfExists(Reference<ui::XAcceleratorConfiguration>& xScAccel, const vector<const awt::KeyEvent*>& rKeys) diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx index 15faf2b53d6f..e7503b062e09 100644 --- a/sc/source/ui/inc/docsh.hxx +++ b/sc/source/ui/inc/docsh.hxx @@ -107,6 +107,7 @@ class SC_DLLPUBLIC ScDocShell final: public SfxObjectShell, public SfxListener ScPaintLockData* pPaintLockData; ScOptSolverSave* pSolverSaveData; ScSheetSaveData* pSheetSaveData; + ScFormatSaveData* mpFormatSaveData; ScDocShellModificator* pModificator; // #109979#; is used to load XML (created in BeforeXMLLoading and destroyed in AfterXMLLoading) #if ENABLE_TELEPATHY @@ -408,6 +409,7 @@ public: const ScOptSolverSave* GetSolverSaveData() const { return pSolverSaveData; } // may be null void SetSolverSaveData( const ScOptSolverSave& rData ); ScSheetSaveData* GetSheetSaveData(); + ScFormatSaveData* GetFormatSaveData(); static void ResetKeyBindings( ScOptionsUtil::KeyBindingType eType ); diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 509c04ac33e2..39f82fefb391 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -254,6 +254,7 @@ static const SfxItemPropertySet* lcl_GetCellsPropertySet() {OUString(SC_UNONAME_CELLVJUS_METHOD), ATTR_VER_JUSTIFY_METHOD, ::cppu::UnoType<sal_Int32>::get(), 0, 0 }, {OUString(SC_UNONAME_WRITING), ATTR_WRITINGDIR, cppu::UnoType<sal_Int16>::get(), 0, 0 }, {OUString(SC_UNONAME_HYPERLINK), ATTR_HYPERLINK, cppu::UnoType<OUString>::get(), 0, 0 }, + {OUString(SC_UNONAME_FORMATID), SC_WID_UNO_FORMATID, cppu::UnoType<sal_uInt64>::get(), 0, 0 }, { OUString(), 0, css::uno::Type(), 0, 0 } }; static SfxItemPropertySet aCellsPropertySet( aCellsPropertyMap_Impl ); @@ -364,6 +365,7 @@ static const SfxItemPropertySet* lcl_GetRangePropertySet() {OUString(SC_UNONAME_CELLVJUS), ATTR_VER_JUSTIFY, cppu::UnoType<sal_Int32>::get(), 0, 0 }, {OUString(SC_UNONAME_CELLVJUS_METHOD), ATTR_VER_JUSTIFY_METHOD, ::cppu::UnoType<sal_Int32>::get(), 0, 0 }, {OUString(SC_UNONAME_WRITING), ATTR_WRITINGDIR, cppu::UnoType<sal_Int16>::get(), 0, 0 }, + {OUString(SC_UNONAME_FORMATID), SC_WID_UNO_FORMATID, cppu::UnoType<sal_uInt64>::get(), 0, 0 }, { OUString(), 0, css::uno::Type(), 0, 0 } }; static SfxItemPropertySet aRangePropertySet( aRangePropertyMap_Impl ); @@ -478,6 +480,7 @@ static const SfxItemPropertySet* lcl_GetCellPropertySet() {OUString(SC_UNONAME_WRITING), ATTR_WRITINGDIR, cppu::UnoType<sal_Int16>::get(), 0, 0 }, {OUString(UNO_NAME_EDIT_CHAR_ESCAPEMENT), EE_CHAR_ESCAPEMENT, cppu::UnoType<sal_Int32>::get(), 0, 0 }, {OUString(SC_UNONAME_HYPERLINK), ATTR_HYPERLINK, cppu::UnoType<OUString>::get(), 0, 0 }, + {OUString(SC_UNONAME_FORMATID), SC_WID_UNO_FORMATID, cppu::UnoType<sal_uInt64>::get(), 0, 0 }, { OUString(), 0, css::uno::Type(), 0, 0 } }; static SfxItemPropertySet aCellPropertySet( aCellPropertyMap_Impl ); @@ -2619,6 +2622,13 @@ void ScCellRangesBase::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pE aRanges.Format(sRet, ScRefFlags::RANGE_ABS_3D, &pDocShell->GetDocument()); rAny <<= sRet; } + break; + case SC_WID_UNO_FORMATID: + { + const ScPatternAttr* pPattern = GetCurrentAttrsFlat(); + rAny <<= pPattern->GetKey(); + } + break; } } } diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index a5ba53739fdb..43151abaae3e 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -458,6 +458,13 @@ ScSheetSaveData* ScModelObj::GetSheetSaveData() return nullptr; } +ScFormatSaveData* ScModelObj::GetFormatSaveData() +{ + if (pDocShell) + return pDocShell->GetFormatSaveData(); + return nullptr; +} + void ScModelObj::RepaintRange( const ScRange& rRange ) { if (pDocShell) 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 ) |