diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-02-14 16:53:39 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2021-01-07 16:32:55 +0100 |
commit | fdb94a92ffcee585cc059223ab2cb354eb475d51 (patch) | |
tree | 517c904f6a2c072f2fa22c751ee66935132ca8a7 /xmloff | |
parent | 00aad6a4887642879fb3b7be9a87414655fbc94f (diff) |
convert XML_STYLE_FAMILY to scoped enum
Change-Id: I5335b0190a2f5a8111993c0c9c224c8a6a8f0cfb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88723
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff')
62 files changed, 401 insertions, 383 deletions
diff --git a/xmloff/inc/SchXMLAutoStylePoolP.hxx b/xmloff/inc/SchXMLAutoStylePoolP.hxx index ee0aecde6cc8..150d3816f3c5 100644 --- a/xmloff/inc/SchXMLAutoStylePoolP.hxx +++ b/xmloff/inc/SchXMLAutoStylePoolP.hxx @@ -29,7 +29,7 @@ class SchXMLAutoStylePoolP : public SvXMLAutoStylePoolP virtual void exportStyleAttributes( SvXMLAttributeList& rAttrList, - sal_Int32 nFamily, + XmlStyleFamily nFamily, const ::std::vector< XMLPropertyState >& rProperties, const SvXMLExportPropertyMapper& rPropExp , const SvXMLUnitConverter& rUnitConverter, diff --git a/xmloff/inc/StyleMap.hxx b/xmloff/inc/StyleMap.hxx index 887a1de3d52d..7fef6449472c 100644 --- a/xmloff/inc/StyleMap.hxx +++ b/xmloff/inc/StyleMap.hxx @@ -26,13 +26,15 @@ #include <boost/functional/hash.hpp> #include <unordered_map> +enum class XmlStyleFamily; + struct StyleNameKey_Impl { - sal_uInt16 const m_nFamily; - OUString const m_aName; + XmlStyleFamily m_nFamily; + OUString m_aName; - StyleNameKey_Impl( sal_uInt16 nFamily, - const OUString& rName ) : + StyleNameKey_Impl( XmlStyleFamily nFamily, + const OUString& rName ) : m_nFamily( nFamily ), m_aName( rName ) { diff --git a/xmloff/inc/XMLChartStyleContext.hxx b/xmloff/inc/XMLChartStyleContext.hxx index 2c28b670de06..9edd5f9d2cbd 100644 --- a/xmloff/inc/XMLChartStyleContext.hxx +++ b/xmloff/inc/XMLChartStyleContext.hxx @@ -40,7 +40,7 @@ public: SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList, - SvXMLStylesContext& rStyles, sal_uInt16 nFamily ); + SvXMLStylesContext& rStyles, XmlStyleFamily nFamily ); virtual ~XMLChartStyleContext() override; /// is called after all styles have been read to apply styles diff --git a/xmloff/qa/unit/uxmloff.cxx b/xmloff/qa/unit/uxmloff.cxx index 5a1df4b3203d..273eed259afe 100644 --- a/xmloff/qa/unit/uxmloff.cxx +++ b/xmloff/qa/unit/uxmloff.cxx @@ -75,13 +75,13 @@ void Test::testAutoStylePool() rtl::Reference< XMLChartExportPropertyMapper > xExportPropMapper( new XMLChartExportPropertyMapper( xSetMapper, *pExport ) ); - xPool->AddFamily( XML_STYLE_FAMILY_TEXT_PARAGRAPH, + xPool->AddFamily( XmlStyleFamily::TEXT_PARAGRAPH, GetXMLToken( XML_PARAGRAPH ), xExportPropMapper.get(), OUString( "Bob" ) ); std::vector< XMLPropertyState > aProperties; - OUString aName = xPool->Add( XML_STYLE_FAMILY_TEXT_PARAGRAPH, "", aProperties ); + OUString aName = xPool->Add( XmlStyleFamily::TEXT_PARAGRAPH, "", aProperties ); // not that interesting but worth checking bool bHack = (getenv("LIBO_ONEWAY_STABLE_ODF_EXPORT") != nullptr); @@ -91,7 +91,7 @@ void Test::testAutoStylePool() CPPUNIT_ASSERT_EQUAL_MESSAGE( "style / naming changed", OUString("Bob1"), aName ); // find ourselves again: - OUString aSameName = xPool->Find( XML_STYLE_FAMILY_TEXT_PARAGRAPH, "", aProperties ); + OUString aSameName = xPool->Find( XmlStyleFamily::TEXT_PARAGRAPH, "", aProperties ); CPPUNIT_ASSERT_EQUAL_MESSAGE( "same style not found", aName, aSameName ); } diff --git a/xmloff/source/chart/SchXMLAutoStylePoolP.cxx b/xmloff/source/chart/SchXMLAutoStylePoolP.cxx index bcb6c6e3b041..f4296bc484dd 100644 --- a/xmloff/source/chart/SchXMLAutoStylePoolP.cxx +++ b/xmloff/source/chart/SchXMLAutoStylePoolP.cxx @@ -34,7 +34,7 @@ SchXMLAutoStylePoolP::~SchXMLAutoStylePoolP() void SchXMLAutoStylePoolP::exportStyleAttributes( SvXMLAttributeList& rAttrList, - sal_Int32 nFamily, + XmlStyleFamily nFamily, const ::std::vector< XMLPropertyState >& rProperties, const SvXMLExportPropertyMapper& rPropExp , const SvXMLUnitConverter& rUnitConverter, @@ -44,7 +44,7 @@ void SchXMLAutoStylePoolP::exportStyleAttributes( SvXMLAutoStylePoolP::exportStyleAttributes( rAttrList, nFamily, rProperties, rPropExp, rUnitConverter, rNamespaceMap ); - if( nFamily == XML_STYLE_FAMILY_SCH_CHART_ID ) + if( nFamily == XmlStyleFamily::SCH_CHART_ID ) { for( const auto& rProp : rProperties ) { diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index 3c640dc546e6..ccefe210ff20 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -1001,7 +1001,7 @@ void SchXMLExportHelper_Impl::exportAutoStyles() mrExport.exportAutoDataStyles(); // export chart auto styles - mrAutoStylePool.exportXML( XML_STYLE_FAMILY_SCH_CHART_ID ); + mrAutoStylePool.exportXML( XmlStyleFamily::SCH_CHART_ID ); // export auto styles for additional shapes mrExport.GetShapeExport()->exportAutoStyles(); @@ -1025,26 +1025,26 @@ SchXMLExportHelper_Impl::SchXMLExportHelper_Impl( { // register chart auto-style family mrAutoStylePool.AddFamily( - XML_STYLE_FAMILY_SCH_CHART_ID, + XmlStyleFamily::SCH_CHART_ID, OUString( XML_STYLE_FAMILY_SCH_CHART_NAME ), mxExpPropMapper.get(), OUString( XML_STYLE_FAMILY_SCH_CHART_PREFIX )); // register shape family mrAutoStylePool.AddFamily( - XML_STYLE_FAMILY_SD_GRAPHICS_ID, + XmlStyleFamily::SD_GRAPHICS_ID, OUString( XML_STYLE_FAMILY_SD_GRAPHICS_NAME ), mxExpPropMapper.get(), OUString( XML_STYLE_FAMILY_SD_GRAPHICS_PREFIX )); // register paragraph family also for shapes mrAutoStylePool.AddFamily( - XML_STYLE_FAMILY_TEXT_PARAGRAPH, + XmlStyleFamily::TEXT_PARAGRAPH, GetXMLToken( XML_PARAGRAPH ), mxExpPropMapper.get(), OUString( 'P' )); // register text family also for shapes mrAutoStylePool.AddFamily( - XML_STYLE_FAMILY_TEXT_TEXT, + XmlStyleFamily::TEXT_TEXT, GetXMLToken( XML_TEXT ), mxExpPropMapper.get(), OUString( 'T' )); @@ -3480,7 +3480,7 @@ awt::Size SchXMLExportHelper_Impl::getPageSize( const Reference< chart2::XChartD void SchXMLExportHelper_Impl::CollectAutoStyle( const std::vector< XMLPropertyState >& aStates ) { if( !aStates.empty() ) - maAutoStyleNameQueue.push( GetAutoStylePoolP().Add( XML_STYLE_FAMILY_SCH_CHART_ID, aStates )); + maAutoStyleNameQueue.push( GetAutoStylePoolP().Add( XmlStyleFamily::SCH_CHART_ID, aStates )); } void SchXMLExportHelper_Impl::AddAutoStyleAttribute( const std::vector< XMLPropertyState >& aStates ) diff --git a/xmloff/source/chart/XMLChartStyleContext.cxx b/xmloff/source/chart/XMLChartStyleContext.cxx index 834c951bd1da..c0c33afc76f8 100644 --- a/xmloff/source/chart/XMLChartStyleContext.cxx +++ b/xmloff/source/chart/XMLChartStyleContext.cxx @@ -63,7 +63,7 @@ XMLChartStyleContext::XMLChartStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, const uno::Reference< xml::sax::XAttributeList > & xAttrList, - SvXMLStylesContext& rStyles, sal_uInt16 nFamily ) : + SvXMLStylesContext& rStyles, XmlStyleFamily nFamily ) : XMLShapeStyleContext( rImport, nPrfx, rLName, xAttrList, rStyles, nFamily ), mrStyles( rStyles ) @@ -82,7 +82,7 @@ void lcl_NumberFormatStyleToProperty( const OUString& rStyleName, const OUString if( !rStyleName.isEmpty()) { const SvXMLNumFormatContext* pStyle = static_cast<const SvXMLNumFormatContext *>(rStylesContext.FindStyleChildContext( - XML_STYLE_FAMILY_DATA_STYLE, rStyleName, true )); + XmlStyleFamily::DATA_STYLE, rStyleName, true )); if( pStyle ) { sal_Int32 nNumberFormat = const_cast<SvXMLNumFormatContext*>(pStyle)->GetKey(); diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx index e3cadf156730..f4e07e8b5288 100644 --- a/xmloff/source/core/xmlimp.cxx +++ b/xmloff/source/core/xmlimp.cxx @@ -1461,7 +1461,7 @@ OUString SvXMLImport::ResolveEmbeddedObjectURLFromBase64() return sRet; } -void SvXMLImport::AddStyleDisplayName( sal_uInt16 nFamily, +void SvXMLImport::AddStyleDisplayName( XmlStyleFamily nFamily, const OUString& rName, const OUString& rDisplayName ) { @@ -1488,11 +1488,11 @@ void SvXMLImport::AddStyleDisplayName( sal_uInt16 nFamily, ::std::pair<StyleMap::iterator,bool> aRes( mpStyleMap->insert( aValue ) ); SAL_WARN_IF( !aRes.second, "xmloff.core", - "duplicate style name of family " << nFamily << ": \"" << rName << "\""); + "duplicate style name of family " << static_cast<int>(nFamily) << ": \"" << rName << "\""); } -OUString SvXMLImport::GetStyleDisplayName( sal_uInt16 nFamily, +OUString SvXMLImport::GetStyleDisplayName( XmlStyleFamily nFamily, const OUString& rName ) const { OUString sName( rName ); diff --git a/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx b/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx index e502f4ea1aee..d78525247a90 100644 --- a/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx +++ b/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx @@ -49,7 +49,7 @@ using ::xmloff::token::XML_PARAGRAPH_PROPERTIES; XMLGraphicsDefaultStyle::XMLGraphicsDefaultStyle( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, const Reference< XAttributeList >& xAttrList, SvXMLStylesContext& rStyles ) -: XMLPropStyleContext( rImport, nPrfx, rLName, xAttrList, rStyles, XML_STYLE_FAMILY_SD_GRAPHICS_ID, true ) +: XMLPropStyleContext( rImport, nPrfx, rLName, xAttrList, rStyles, XmlStyleFamily::SD_GRAPHICS_ID, true ) { } diff --git a/xmloff/source/draw/XMLShapeStyleContext.cxx b/xmloff/source/draw/XMLShapeStyleContext.cxx index b301986afde1..b7036dd5df4e 100644 --- a/xmloff/source/draw/XMLShapeStyleContext.cxx +++ b/xmloff/source/draw/XMLShapeStyleContext.cxx @@ -54,7 +54,7 @@ XMLShapeStyleContext::XMLShapeStyleContext( const OUString& rLName, const uno::Reference< xml::sax::XAttributeList >& xAttrList, SvXMLStylesContext& rStyles, - sal_uInt16 nFamily) + XmlStyleFamily nFamily) : XMLPropStyleContext(rImport, nPrfx, rLName, xAttrList, rStyles, nFamily ), m_bIsNumRuleAlreadyConverted( false ) { @@ -199,15 +199,15 @@ void XMLShapeStyleContext::FillPropertySet( const Reference< beans::XPropertySet { CTF_SD_OLE_VIS_AREA_IMPORT_HEIGHT, -1 }, { -1, -1 } }; - static const sal_uInt16 aFamilies[] = + static const XmlStyleFamily aFamilies[] = { - XML_STYLE_FAMILY_SD_STROKE_DASH_ID, - XML_STYLE_FAMILY_SD_MARKER_ID, - XML_STYLE_FAMILY_SD_MARKER_ID, - XML_STYLE_FAMILY_SD_GRADIENT_ID, - XML_STYLE_FAMILY_SD_GRADIENT_ID, - XML_STYLE_FAMILY_SD_HATCH_ID, - XML_STYLE_FAMILY_SD_FILL_IMAGE_ID + XmlStyleFamily::SD_STROKE_DASH_ID, + XmlStyleFamily::SD_MARKER_ID, + XmlStyleFamily::SD_MARKER_ID, + XmlStyleFamily::SD_GRADIENT_ID, + XmlStyleFamily::SD_GRADIENT_ID, + XmlStyleFamily::SD_HATCH_ID, + XmlStyleFamily::SD_FILL_IMAGE_ID }; rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap = diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx index 62925fe6fa5d..37a71d140161 100644 --- a/xmloff/source/draw/sdxmlexp.cxx +++ b/xmloff/source/draw/sdxmlexp.cxx @@ -412,17 +412,17 @@ void SAL_CALL SdXMLExport::setSourceDocument( const Reference< lang::XComponent // add family name GetAutoStylePool()->AddFamily( - XML_STYLE_FAMILY_SD_GRAPHICS_ID, + XmlStyleFamily::SD_GRAPHICS_ID, OUString(XML_STYLE_FAMILY_SD_GRAPHICS_NAME), GetPropertySetMapper(), OUString(XML_STYLE_FAMILY_SD_GRAPHICS_PREFIX)); GetAutoStylePool()->AddFamily( - XML_STYLE_FAMILY_SD_PRESENTATION_ID, + XmlStyleFamily::SD_PRESENTATION_ID, OUString(XML_STYLE_FAMILY_SD_PRESENTATION_NAME), GetPropertySetMapper(), OUString(XML_STYLE_FAMILY_SD_PRESENTATION_PREFIX)); GetAutoStylePool()->AddFamily( - XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID, + XmlStyleFamily::SD_DRAWINGPAGE_ID, OUString(XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME), GetPresPagePropsMapper(), OUString(XML_STYLE_FAMILY_SD_DRAWINGPAGE_PREFIX)); @@ -1532,12 +1532,12 @@ OUString SdXMLExport::ImpCreatePresPageStyleName( const Reference<XDrawPage>& xD { // there are filtered properties -> hard attributes // try to find this style in AutoStylePool - sStyleName = GetAutoStylePool()->Find(XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID, sStyleName, aPropStates); + sStyleName = GetAutoStylePool()->Find(XmlStyleFamily::SD_DRAWINGPAGE_ID, sStyleName, aPropStates); if(sStyleName.isEmpty()) { // Style did not exist, add it to AutoStalePool - sStyleName = GetAutoStylePool()->Add(XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID, sStyleName, aPropStates); + sStyleName = GetAutoStylePool()->Add(XmlStyleFamily::SD_DRAWINGPAGE_ID, sStyleName, aPropStates); } } } @@ -1596,7 +1596,7 @@ void SdXMLExport::ImpWritePresentationStyles() aStEx->exportStyleFamily(xNamed->getName(), OUString(XML_STYLE_FAMILY_SD_PRESENTATION_NAME), aMapperRef, false, - XML_STYLE_FAMILY_SD_PRESENTATION_ID, &aPrefix); + XmlStyleFamily::SD_PRESENTATION_ID, &aPrefix); } } } @@ -2202,7 +2202,7 @@ void SdXMLExport::ExportAutoStyles_() } // export draw-page styles - GetAutoStylePool()->exportXML( XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID ); + GetAutoStylePool()->exportXML( XmlStyleFamily::SD_DRAWINGPAGE_ID ); exportAutoDataStyles(); diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index 6b995c4a5d76..2f4c93db58d8 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -191,12 +191,12 @@ XMLShapeExport::XMLShapeExport(SvXMLExport& rExp, */ mrExport.GetAutoStylePool()->AddFamily( - XML_STYLE_FAMILY_SD_GRAPHICS_ID, + XmlStyleFamily::SD_GRAPHICS_ID, XML_STYLE_FAMILY_SD_GRAPHICS_NAME, GetPropertySetMapper(), XML_STYLE_FAMILY_SD_GRAPHICS_PREFIX); mrExport.GetAutoStylePool()->AddFamily( - XML_STYLE_FAMILY_SD_PRESENTATION_ID, + XmlStyleFamily::SD_PRESENTATION_ID, XML_STYLE_FAMILY_SD_PRESENTATION_NAME, GetPropertySetMapper(), XML_STYLE_FAMILY_SD_PRESENTATION_PREFIX); @@ -359,7 +359,7 @@ void XMLShapeExport::collectShapeAutoStyles(const uno::Reference< drawing::XShap OUString aFamilyName; xStylePropSet->getPropertyValue("Family") >>= aFamilyName; if( !aFamilyName.isEmpty() && aFamilyName != "graphics" ) - aShapeInfo.mnFamily = XML_STYLE_FAMILY_SD_PRESENTATION_ID; + aShapeInfo.mnFamily = XmlStyleFamily::SD_PRESENTATION_ID; } } catch(const beans::UnknownPropertyException&) @@ -370,7 +370,7 @@ void XMLShapeExport::collectShapeAutoStyles(const uno::Reference< drawing::XShap } // get parent-style name - if(XML_STYLE_FAMILY_SD_PRESENTATION_ID == aShapeInfo.mnFamily) + if(XmlStyleFamily::SD_PRESENTATION_ID == aShapeInfo.mnFamily) { aParentName = msPresentationStylePrefix; } @@ -491,11 +491,11 @@ void XMLShapeExport::collectShapeAutoStyles(const uno::Reference< drawing::XShap if( nCount ) { - aShapeInfo.msTextStyleName = mrExport.GetAutoStylePool()->Find( XML_STYLE_FAMILY_TEXT_PARAGRAPH, "", aPropStates ); + aShapeInfo.msTextStyleName = mrExport.GetAutoStylePool()->Find( XmlStyleFamily::TEXT_PARAGRAPH, "", aPropStates ); if(aShapeInfo.msTextStyleName.isEmpty()) { // Style did not exist, add it to AutoStalePool - aShapeInfo.msTextStyleName = mrExport.GetAutoStylePool()->Add(XML_STYLE_FAMILY_TEXT_PARAGRAPH, "", aPropStates); + aShapeInfo.msTextStyleName = mrExport.GetAutoStylePool()->Add(XmlStyleFamily::TEXT_PARAGRAPH, "", aPropStates); } } } @@ -683,7 +683,7 @@ void XMLShapeExport::exportShape(const uno::Reference< drawing::XShape >& xShape // export style name if( !aShapeInfo.msStyleName.isEmpty() ) { - if(XML_STYLE_FAMILY_SD_GRAPHICS_ID == aShapeInfo.mnFamily) + if(XmlStyleFamily::SD_GRAPHICS_ID == aShapeInfo.mnFamily) mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME, mrExport.EncodeStyleName( aShapeInfo.msStyleName) ); else mrExport.AddAttribute(XML_NAMESPACE_PRESENTATION, XML_STYLE_NAME, mrExport.EncodeStyleName( aShapeInfo.msStyleName) ); @@ -1023,12 +1023,12 @@ void XMLShapeExport::exportAutoStyles() // ...for graphic { - GetExport().GetAutoStylePool()->exportXML( XML_STYLE_FAMILY_SD_GRAPHICS_ID ); + GetExport().GetAutoStylePool()->exportXML( XmlStyleFamily::SD_GRAPHICS_ID ); } // ...for presentation { - GetExport().GetAutoStylePool()->exportXML( XML_STYLE_FAMILY_SD_PRESENTATION_ID ); + GetExport().GetAutoStylePool()->exportXML( XmlStyleFamily::SD_PRESENTATION_ID ); } if( mxShapeTableExport.is() ) @@ -1338,7 +1338,7 @@ void XMLShapeExport::ExportGraphicDefaults() aStEx->exportDefaultStyle( xDefaults, XML_STYLE_FAMILY_SD_GRAPHICS_NAME, xPropertySetMapper ); // write graphic family styles - aStEx->exportStyleFamily("graphics", OUString(XML_STYLE_FAMILY_SD_GRAPHICS_NAME), xPropertySetMapper, false, XML_STYLE_FAMILY_SD_GRAPHICS_ID); + aStEx->exportStyleFamily("graphics", OUString(XML_STYLE_FAMILY_SD_GRAPHICS_NAME), xPropertySetMapper, false, XmlStyleFamily::SD_GRAPHICS_ID); } } catch(const lang::ServiceNotRegisteredException&) diff --git a/xmloff/source/draw/ximpbody.cxx b/xmloff/source/draw/ximpbody.cxx index e2015aedf1e6..1d4680cf0daa 100644 --- a/xmloff/source/draw/ximpbody.cxx +++ b/xmloff/source/draw/ximpbody.cxx @@ -151,7 +151,7 @@ SdXMLDrawPageContext::SdXMLDrawPageContext( SdXMLImport& rImport, { bool bDone(false); OUString sDisplayName( rImport.GetStyleDisplayName( - XML_STYLE_FAMILY_MASTER_PAGE, maMasterPageName ) ); + XmlStyleFamily::MASTER_PAGE, maMasterPageName ) ); for(sal_Int32 a = 0; !bDone && a < xMasterPages->getCount(); a++) { diff --git a/xmloff/source/draw/ximppage.cxx b/xmloff/source/draw/ximppage.cxx index af7fcdde026c..ca61699ac53f 100644 --- a/xmloff/source/draw/ximppage.cxx +++ b/xmloff/source/draw/ximppage.cxx @@ -332,7 +332,7 @@ void SdXMLGenericPageContext::EndElement() if( pStyles ) { const SdXMLNumberFormatImportContext* pSdNumStyle = - dynamic_cast< const SdXMLNumberFormatImportContext* >( pStyles->FindStyleChildContext( XML_STYLE_FAMILY_DATA_STYLE, aDateTimeFormat, true ) ); + dynamic_cast< const SdXMLNumberFormatImportContext* >( pStyles->FindStyleChildContext( XmlStyleFamily::DATA_STYLE, aDateTimeFormat, true ) ); if( pSdNumStyle ) { @@ -365,7 +365,7 @@ void SdXMLGenericPageContext::SetStyle( OUString const & rStyleName ) if (const SdXMLStylesContext* pStyles = dynamic_cast<const SdXMLStylesContext *>(pContext)) { const SvXMLStyleContext* pStyle = pStyles->FindStyleChildContext( - XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID, rStyleName); + XmlStyleFamily::SD_DRAWINGPAGE_ID, rStyleName); if (const XMLPropStyleContext* pPropStyle = dynamic_cast<const XMLPropStyleContext*>(pStyle)) { @@ -421,7 +421,7 @@ void SdXMLGenericPageContext::SetLayout() if (const SdXMLStylesContext* pStyles = dynamic_cast<const SdXMLStylesContext *>(pContext)) { - const SvXMLStyleContext* pStyle = pStyles->FindStyleChildContext( XML_STYLE_FAMILY_SD_PRESENTATIONPAGELAYOUT_ID, maPageLayoutName); + const SvXMLStyleContext* pStyle = pStyles->FindStyleChildContext( XmlStyleFamily::SD_PRESENTATIONPAGELAYOUT_ID, maPageLayoutName); if (const SdXMLPresentationPageLayoutContext* pLayout = dynamic_cast<const SdXMLPresentationPageLayoutContext*>(pStyle)) { @@ -481,7 +481,7 @@ void SdXMLGenericPageContext::SetPageMaster( OUString const & rsPageMasterName ) // #80012# GetStylesContext() replaced with GetAutoStylesContext() const SvXMLStylesContext* pAutoStyles = GetSdImport().GetShapeImport()->GetAutoStylesContext(); - const SvXMLStyleContext* pStyle = pAutoStyles ? pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_SD_PAGEMASTERCONEXT_ID, rsPageMasterName) : nullptr; + const SvXMLStyleContext* pStyle = pAutoStyles ? pAutoStyles->FindStyleChildContext(XmlStyleFamily::SD_PAGEMASTERCONEXT_ID, rsPageMasterName) : nullptr; if (const SdXMLPageMasterContext* pPageMaster = dynamic_cast<const SdXMLPageMasterContext*>(pStyle)) { diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx index 8bee4b376ba1..90bec969bcae 100644 --- a/xmloff/source/draw/ximpshap.cxx +++ b/xmloff/source/draw/ximpshap.cxx @@ -149,7 +149,7 @@ SdXMLShapeContext::SdXMLShapeContext( , mxShapes( rShapes ) , mxAttrList(xAttrList) , mbListContextPushed( false ) - , mnStyleFamily(XML_STYLE_FAMILY_SD_GRAPHICS_ID) + , mnStyleFamily(XmlStyleFamily::SD_GRAPHICS_ID) , mbIsPlaceholder(false) , mbClearDefaultAttributes( true ) , mbIsUserTransformed(false) @@ -652,10 +652,10 @@ void SdXMLShapeContext::SetStyle( bool bSupportsStyle /* = true */) uno::Reference< container::XNameAccess > xFamily; - if( XML_STYLE_FAMILY_SD_PRESENTATION_ID == mnStyleFamily ) + if( XmlStyleFamily::SD_PRESENTATION_ID == mnStyleFamily ) { aStyleName = GetImport().GetStyleDisplayName( - XML_STYLE_FAMILY_SD_PRESENTATION_ID, + XmlStyleFamily::SD_PRESENTATION_ID, aStyleName ); sal_Int32 nPos = aStyleName.lastIndexOf( '-' ); if( -1 != nPos ) @@ -671,7 +671,7 @@ void SdXMLShapeContext::SetStyle( bool bSupportsStyle /* = true */) // get graphics family xFamilies->getByName("graphics") >>= xFamily; aStyleName = GetImport().GetStyleDisplayName( - XML_STYLE_FAMILY_SD_GRAPHICS_ID, + XmlStyleFamily::SD_GRAPHICS_ID, aStyleName ); } @@ -727,7 +727,7 @@ void SdXMLShapeContext::SetStyle( bool bSupportsStyle /* = true */) if( nullptr == GetImport().GetShapeImport()->GetAutoStylesContext()) break; - const SvXMLStyleContext* pTempStyle = GetImport().GetShapeImport()->GetAutoStylesContext()->FindStyleChildContext(XML_STYLE_FAMILY_TEXT_PARAGRAPH, maTextStyleName); + const SvXMLStyleContext* pTempStyle = GetImport().GetShapeImport()->GetAutoStylesContext()->FindStyleChildContext(XmlStyleFamily::TEXT_PARAGRAPH, maTextStyleName); XMLPropStyleContext* pStyle = const_cast<XMLPropStyleContext*>(dynamic_cast<const XMLPropStyleContext*>( pTempStyle ) ); // use temp var, PTR_CAST is a bad macro, FindStyleChildContext will be called twice if( pStyle == nullptr ) break; @@ -845,7 +845,7 @@ void SdXMLShapeContext::processAttribute( sal_uInt16 nPrefix, const OUString& rL else if( IsXMLToken( rLocalName, XML_STYLE_NAME ) ) { maDrawStyleName = rValue; - mnStyleFamily = XML_STYLE_FAMILY_SD_PRESENTATION_ID; + mnStyleFamily = XmlStyleFamily::SD_PRESENTATION_ID; } } else if( XML_NAMESPACE_SVG == nPrefix ) @@ -913,7 +913,7 @@ bool SdXMLShapeContext::isPresentationShape() const { if( !maPresentationClass.isEmpty() && const_cast<SdXMLShapeContext*>(this)->GetImport().GetShapeImport()->IsPresentationShapesSupported() ) { - if(XML_STYLE_FAMILY_SD_PRESENTATION_ID == mnStyleFamily) + if(XmlStyleFamily::SD_PRESENTATION_ID == mnStyleFamily) { return true; } diff --git a/xmloff/source/draw/ximpshap.hxx b/xmloff/source/draw/ximpshap.hxx index fae45f88f00a..5231163429c9 100644 --- a/xmloff/source/draw/ximpshap.hxx +++ b/xmloff/source/draw/ximpshap.hxx @@ -61,7 +61,7 @@ protected: /// whether to restore list context (#91964#) bool mbListContextPushed; - sal_uInt16 mnStyleFamily; + XmlStyleFamily mnStyleFamily; bool mbIsPlaceholder; bool mbClearDefaultAttributes; bool mbIsUserTransformed; diff --git a/xmloff/source/draw/ximpstyl.cxx b/xmloff/source/draw/ximpstyl.cxx index 528ad043aa2e..014ba51b5469 100644 --- a/xmloff/source/draw/ximpstyl.cxx +++ b/xmloff/source/draw/ximpstyl.cxx @@ -156,15 +156,15 @@ static ContextID_Index_Pair const g_ContextIDs[MAX_SPECIAL_DRAW_STYLES+1] = { CTF_FILLBITMAPNAME , -1 }, { -1, -1 } }; -static sal_uInt16 const g_Families[MAX_SPECIAL_DRAW_STYLES] = +static XmlStyleFamily const g_Families[MAX_SPECIAL_DRAW_STYLES] = { - XML_STYLE_FAMILY_SD_STROKE_DASH_ID, - XML_STYLE_FAMILY_SD_MARKER_ID, - XML_STYLE_FAMILY_SD_MARKER_ID, - XML_STYLE_FAMILY_SD_GRADIENT_ID, - XML_STYLE_FAMILY_SD_GRADIENT_ID, - XML_STYLE_FAMILY_SD_HATCH_ID, - XML_STYLE_FAMILY_SD_FILL_IMAGE_ID + XmlStyleFamily::SD_STROKE_DASH_ID, + XmlStyleFamily::SD_MARKER_ID, + XmlStyleFamily::SD_MARKER_ID, + XmlStyleFamily::SD_GRADIENT_ID, + XmlStyleFamily::SD_GRADIENT_ID, + XmlStyleFamily::SD_HATCH_ID, + XmlStyleFamily::SD_FILL_IMAGE_ID }; @@ -175,8 +175,8 @@ XMLDrawingPageStyleContext::XMLDrawingPageStyleContext( const uno::Reference< xml::sax::XAttributeList >& xAttrList, SvXMLStylesContext& rStyles, ContextID_Index_Pair const pContextIDs[], - sal_uInt16 const pFamilies[]) - : XMLPropStyleContext(rImport, nPrefix, rLName, xAttrList, rStyles, XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID) + XmlStyleFamily const pFamilies[]) + : XMLPropStyleContext(rImport, nPrefix, rLName, xAttrList, rStyles, XmlStyleFamily::SD_DRAWINGPAGE_ID) , m_pFamilies(pFamilies) { size_t size(1); // for the -1 entry @@ -247,7 +247,7 @@ void SdXMLDrawingPageStyleContext::Finish( bool bOverwrite ) const SdXMLNumberFormatImportContext* pSdNumStyle = dynamic_cast< const SdXMLNumberFormatImportContext*> ( - GetStyles()->FindStyleChildContext( XML_STYLE_FAMILY_DATA_STYLE, sStyleName, true ) ); + GetStyles()->FindStyleChildContext( XmlStyleFamily::DATA_STYLE, sStyleName, true ) ); if( pSdNumStyle ) nStyle = pSdNumStyle->GetDrawKey(); @@ -305,7 +305,7 @@ SdXMLPageMasterStyleContext::SdXMLPageMasterStyleContext( sal_uInt16 nPrfx, const OUString& rLName, const uno::Reference< xml::sax::XAttributeList>& xAttrList) -: SvXMLStyleContext(rImport, nPrfx, rLName, xAttrList, XML_STYLE_FAMILY_SD_PAGEMASTERSTYLECONEXT_ID), +: SvXMLStyleContext(rImport, nPrfx, rLName, xAttrList, XmlStyleFamily::SD_PAGEMASTERSTYLECONEXT_ID), mnBorderBottom( 0 ), mnBorderLeft( 0 ), mnBorderRight( 0 ), @@ -386,7 +386,7 @@ SdXMLPageMasterContext::SdXMLPageMasterContext( sal_uInt16 nPrfx, const OUString& rLName, const uno::Reference< xml::sax::XAttributeList>& xAttrList) -: SvXMLStyleContext(rImport, nPrfx, rLName, xAttrList, XML_STYLE_FAMILY_SD_PAGEMASTERCONEXT_ID) +: SvXMLStyleContext(rImport, nPrfx, rLName, xAttrList, XmlStyleFamily::SD_PAGEMASTERCONEXT_ID) { // set family to something special at SvXMLStyleContext // for differences in search-methods @@ -435,7 +435,7 @@ SdXMLPresentationPageLayoutContext::SdXMLPresentationPageLayoutContext( sal_uInt16 nPrfx, const OUString& rLName, const uno::Reference< xml::sax::XAttributeList >& xAttrList) -: SvXMLStyleContext(rImport, nPrfx, rLName, xAttrList, XML_STYLE_FAMILY_SD_PRESENTATIONPAGELAYOUT_ID), +: SvXMLStyleContext(rImport, nPrfx, rLName, xAttrList, XmlStyleFamily::SD_PRESENTATIONPAGELAYOUT_ID), mnTypeId( AUTOLAYOUT_NONE ) { // set family to something special at SvXMLStyleContext @@ -792,7 +792,7 @@ SdXMLMasterPageContext::SdXMLMasterPageContext( if( msDisplayName.isEmpty() ) msDisplayName = msName; else if( msDisplayName != msName ) - GetImport().AddStyleDisplayName( XML_STYLE_FAMILY_MASTER_PAGE, msName, msDisplayName ); + GetImport().AddStyleDisplayName( XmlStyleFamily::MASTER_PAGE, msName, msDisplayName ); GetImport().GetShapeImport()->startPage( GetLocalShapesContext() ); @@ -854,7 +854,7 @@ SvXMLImportContextRef SdXMLMasterPageContext::CreateChildContext( XMLShapeStyleContext* pNew = new XMLShapeStyleContext( GetSdImport(), nPrefix, rLocalName, xAttrList, *GetSdImport().GetShapeImport()->GetStylesContext(), - XML_STYLE_FAMILY_SD_PRESENTATION_ID); + XmlStyleFamily::SD_PRESENTATION_ID); // add this style to the outer StylesContext class for later processing xContext = pNew; @@ -971,7 +971,7 @@ SvXMLStyleContext* SdXMLStylesContext::CreateStyleChildContext( } SvXMLStyleContext* SdXMLStylesContext::CreateStyleStyleChildContext( - sal_uInt16 nFamily, + XmlStyleFamily nFamily, sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< css::xml::sax::XAttributeList >& xAttrList) @@ -980,14 +980,15 @@ SvXMLStyleContext* SdXMLStylesContext::CreateStyleStyleChildContext( switch( nFamily ) { - case XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID: + case XmlStyleFamily::SD_DRAWINGPAGE_ID: pContext = new SdXMLDrawingPageStyleContext(GetSdImport(), nPrefix, rLocalName, xAttrList, *this ); break; - case XML_STYLE_FAMILY_TABLE_CELL: - case XML_STYLE_FAMILY_TABLE_COLUMN: - case XML_STYLE_FAMILY_TABLE_ROW: + case XmlStyleFamily::TABLE_CELL: + case XmlStyleFamily::TABLE_COLUMN: + case XmlStyleFamily::TABLE_ROW: pContext = new XMLShapeStyleContext( GetSdImport(), nPrefix, rLocalName, xAttrList, *this, nFamily ); break; + default: break; } // call base class @@ -998,7 +999,7 @@ SvXMLStyleContext* SdXMLStylesContext::CreateStyleStyleChildContext( } SvXMLStyleContext* SdXMLStylesContext::CreateDefaultStyleStyleChildContext( - sal_uInt16 nFamily, + XmlStyleFamily nFamily, sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< XAttributeList > & xAttrList ) @@ -1007,9 +1008,10 @@ SvXMLStyleContext* SdXMLStylesContext::CreateDefaultStyleStyleChildContext( switch( nFamily ) { - case XML_STYLE_FAMILY_SD_GRAPHICS_ID: + case XmlStyleFamily::SD_GRAPHICS_ID: pContext = new XMLGraphicsDefaultStyle(GetSdImport(), nPrefix, rLocalName, xAttrList, *this ); break; + default: break; } // call base class @@ -1020,13 +1022,13 @@ SvXMLStyleContext* SdXMLStylesContext::CreateDefaultStyleStyleChildContext( } rtl::Reference< SvXMLImportPropertyMapper > SdXMLStylesContext::GetImportPropertyMapper( - sal_uInt16 nFamily) const + XmlStyleFamily nFamily) const { rtl::Reference < SvXMLImportPropertyMapper > xMapper; switch( nFamily ) { - case XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID: + case XmlStyleFamily::SD_DRAWINGPAGE_ID: { if(!xPresImpPropMapper.is()) { @@ -1038,20 +1040,22 @@ rtl::Reference< SvXMLImportPropertyMapper > SdXMLStylesContext::GetImportPropert break; } - case XML_STYLE_FAMILY_TABLE_COLUMN: - case XML_STYLE_FAMILY_TABLE_ROW: - case XML_STYLE_FAMILY_TABLE_CELL: + case XmlStyleFamily::TABLE_COLUMN: + case XmlStyleFamily::TABLE_ROW: + case XmlStyleFamily::TABLE_CELL: { const rtl::Reference< XMLTableImport >& xTableImport( const_cast< SvXMLImport& >( GetImport() ).GetShapeImport()->GetShapeTableImport() ); switch( nFamily ) { - case XML_STYLE_FAMILY_TABLE_COLUMN: xMapper = xTableImport->GetColumnImportPropertySetMapper().get(); break; - case XML_STYLE_FAMILY_TABLE_ROW: xMapper = xTableImport->GetRowImportPropertySetMapper().get(); break; - case XML_STYLE_FAMILY_TABLE_CELL: xMapper = xTableImport->GetCellImportPropertySetMapper().get(); break; + case XmlStyleFamily::TABLE_COLUMN: xMapper = xTableImport->GetColumnImportPropertySetMapper().get(); break; + case XmlStyleFamily::TABLE_ROW: xMapper = xTableImport->GetRowImportPropertySetMapper().get(); break; + case XmlStyleFamily::TABLE_CELL: xMapper = xTableImport->GetCellImportPropertySetMapper().get(); break; + default: break; } break; } + default: break; } // call base class @@ -1137,7 +1141,7 @@ void SdXMLStylesContext::SetMasterPageStyles(SdXMLMasterPageContext const & rMas { uno::Reference< container::XNameAccess > xMasterPageStyles( rStyleFamilies->getByName(rMaster.GetDisplayName()), UNO_QUERY_THROW ); OUString sPrefix(rMaster.GetDisplayName() + "-"); - ImpSetGraphicStyles(xMasterPageStyles, XML_STYLE_FAMILY_SD_PRESENTATION_ID, sPrefix); + ImpSetGraphicStyles(xMasterPageStyles, XmlStyleFamily::SD_PRESENTATION_ID, sPrefix); } catch (const uno::Exception&) { @@ -1155,7 +1159,7 @@ void SdXMLStylesContext::ImpSetGraphicStyles() const const OUString sGraphicStyleName("graphics"); uno::Reference< container::XNameAccess > xGraphicPageStyles( GetSdImport().GetLocalDocStyleFamilies()->getByName(sGraphicStyleName), uno::UNO_QUERY_THROW ); - ImpSetGraphicStyles(xGraphicPageStyles, XML_STYLE_FAMILY_SD_GRAPHICS_ID, OUString()); + ImpSetGraphicStyles(xGraphicPageStyles, XmlStyleFamily::SD_GRAPHICS_ID, OUString()); } catch( uno::Exception& ) { @@ -1170,7 +1174,7 @@ void SdXMLStylesContext::ImpSetCellStyles() const const OUString sCellStyleName("cell"); uno::Reference< container::XNameAccess > xGraphicPageStyles( GetSdImport().GetLocalDocStyleFamilies()->getByName(sCellStyleName), uno::UNO_QUERY_THROW ); - ImpSetGraphicStyles(xGraphicPageStyles, XML_STYLE_FAMILY_TABLE_CELL, OUString()); + ImpSetGraphicStyles(xGraphicPageStyles, XmlStyleFamily::TABLE_CELL, OUString()); } catch( uno::Exception& ) { @@ -1212,7 +1216,7 @@ static bool canSkipReset(const OUString &rName, const XMLPropStyleContext* pProp // help function used by ImpSetGraphicStyles() and ImpSetMasterPageStyles() -void SdXMLStylesContext::ImpSetGraphicStyles( uno::Reference< container::XNameAccess > const & xPageStyles, sal_uInt16 nFamily, const OUString& rPrefix) const +void SdXMLStylesContext::ImpSetGraphicStyles( uno::Reference< container::XNameAccess > const & xPageStyles, XmlStyleFamily nFamily, const OUString& rPrefix) const { sal_Int32 nPrefLen(rPrefix.getLength()); diff --git a/xmloff/source/draw/ximpstyl.hxx b/xmloff/source/draw/ximpstyl.hxx index bc0a2b09aa23..14199352dd44 100644 --- a/xmloff/source/draw/ximpstyl.hxx +++ b/xmloff/source/draw/ximpstyl.hxx @@ -182,7 +182,7 @@ class SdXMLStylesContext : public SvXMLStylesContext void ImpSetGraphicStyles() const; void ImpSetCellStyles() const; void ImpSetGraphicStyles( css::uno::Reference< css::container::XNameAccess > const & xPageStyles, - sal_uInt16 nFamily, const OUString& rPrefix) const; + XmlStyleFamily nFamily, const OUString& rPrefix) const; protected: virtual SvXMLStyleContext* CreateStyleChildContext( @@ -191,13 +191,13 @@ protected: const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList) override; virtual SvXMLStyleContext *CreateStyleStyleChildContext( - sal_uInt16 nFamily, + XmlStyleFamily nFamily, sal_uInt16 nPrefix, const OUString& rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList) override; virtual SvXMLStyleContext *CreateDefaultStyleStyleChildContext( - sal_uInt16 nFamily, sal_uInt16 nPrefix, + XmlStyleFamily nFamily, sal_uInt16 nPrefix, const OUString& rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList ) override; @@ -210,7 +210,7 @@ public: bool bIsAutoStyle); virtual void EndElement() override; - virtual rtl::Reference< SvXMLImportPropertyMapper > GetImportPropertyMapper(sal_uInt16 nFamily) const override; + virtual rtl::Reference< SvXMLImportPropertyMapper > GetImportPropertyMapper(XmlStyleFamily nFamily) const override; void SetMasterPageStyles(SdXMLMasterPageContext const & rMaster) const; diff --git a/xmloff/source/forms/layerexport.cxx b/xmloff/source/forms/layerexport.cxx index 41dce892b047..c6d4500e991b 100644 --- a/xmloff/source/forms/layerexport.cxx +++ b/xmloff/source/forms/layerexport.cxx @@ -81,7 +81,7 @@ namespace xmloff // our style family m_rContext.GetAutoStylePool()->AddFamily( - XML_STYLE_FAMILY_CONTROL_ID, token::GetXMLToken(token::XML_PARAGRAPH), + XmlStyleFamily::CONTROL_ID, token::GetXMLToken(token::XML_PARAGRAPH), m_xStyleExportMapper.get(), OUString( XML_STYLE_FAMILY_CONTROL_PREFIX ) ); @@ -250,7 +250,7 @@ namespace xmloff void OFormLayerXMLExport_Impl::exportAutoStyles() { - m_rContext.GetAutoStylePool()->exportXML( XML_STYLE_FAMILY_CONTROL_ID ); + m_rContext.GetAutoStylePool()->exportXML( XmlStyleFamily::CONTROL_ID ); } void OFormLayerXMLExport_Impl::exportForms(const Reference< XDrawPage >& _rxDrawPage) @@ -588,7 +588,7 @@ namespace xmloff if ( !aPropertyStates.empty() ) { // add to the style pool - OUString sColumnStyleName = m_rContext.GetAutoStylePool()->Add( XML_STYLE_FAMILY_CONTROL_ID, aPropertyStates ); + OUString sColumnStyleName = m_rContext.GetAutoStylePool()->Add( XmlStyleFamily::CONTROL_ID, aPropertyStates ); OSL_ENSURE( m_aGridColumnStyles.end() == m_aGridColumnStyles.find( xColumnProperties ), "OFormLayerXMLExport_Impl::collectGridColumnStylesAndIds: already have a style for this column!" ); diff --git a/xmloff/source/forms/layerimport.cxx b/xmloff/source/forms/layerimport.cxx index 7bf0ed4177b1..038d55dd8661 100644 --- a/xmloff/source/forms/layerimport.cxx +++ b/xmloff/source/forms/layerimport.cxx @@ -235,7 +235,7 @@ void OFormLayerXMLImport_Impl::applyControlNumberStyle(const Reference< XPropert if (m_xAutoStyles.is()) { - const SvXMLStyleContext* pStyle = m_xAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_DATA_STYLE, _rControlNumerStyleName); + const SvXMLStyleContext* pStyle = m_xAutoStyles->FindStyleChildContext(XmlStyleFamily::DATA_STYLE, _rControlNumerStyleName); if (pStyle) { const SvXMLNumFormatContext* pDataStyle = static_cast<const SvXMLNumFormatContext*>(pStyle); @@ -320,7 +320,7 @@ const SvXMLStyleContext* OFormLayerXMLImport_Impl::getStyleElement(const OUStrin // did you use setAutoStyleContext? const SvXMLStyleContext* pControlStyle = - m_xAutoStyles.is() ? m_xAutoStyles->FindStyleChildContext( XML_STYLE_FAMILY_TEXT_PARAGRAPH, _rStyleName ) : nullptr; + m_xAutoStyles.is() ? m_xAutoStyles->FindStyleChildContext( XmlStyleFamily::TEXT_PARAGRAPH, _rStyleName ) : nullptr; OSL_ENSURE( pControlStyle || !m_xAutoStyles.is(), OStringBuffer("OFormLayerXMLImport_Impl::getStyleElement: did not find the style named \"").append(OUStringToOString(_rStyleName, RTL_TEXTENCODING_ASCII_US)).append("\"!").getStr() ); return pControlStyle; diff --git a/xmloff/source/style/DashStyle.cxx b/xmloff/source/style/DashStyle.cxx index 85173e11b9f2..4504f48ad44d 100644 --- a/xmloff/source/style/DashStyle.cxx +++ b/xmloff/source/style/DashStyle.cxx @@ -194,7 +194,7 @@ void XMLDashStyleImport::importXML( if( !aDisplayName.isEmpty() ) { - rImport.AddStyleDisplayName( XML_STYLE_FAMILY_SD_STROKE_DASH_ID, + rImport.AddStyleDisplayName( XmlStyleFamily::SD_STROKE_DASH_ID, rStrName, aDisplayName ); rStrName = aDisplayName; } diff --git a/xmloff/source/style/GradientStyle.cxx b/xmloff/source/style/GradientStyle.cxx index 177c21b80ba5..a58eff4fc42f 100644 --- a/xmloff/source/style/GradientStyle.cxx +++ b/xmloff/source/style/GradientStyle.cxx @@ -177,7 +177,7 @@ void XMLGradientStyleImport::importXML( if( !aDisplayName.isEmpty() ) { - rImport.AddStyleDisplayName( XML_STYLE_FAMILY_SD_GRADIENT_ID, rStrName, + rImport.AddStyleDisplayName( XmlStyleFamily::SD_GRADIENT_ID, rStrName, aDisplayName ); rStrName = aDisplayName; } diff --git a/xmloff/source/style/HatchStyle.cxx b/xmloff/source/style/HatchStyle.cxx index 899223754c61..ff83931b9551 100644 --- a/xmloff/source/style/HatchStyle.cxx +++ b/xmloff/source/style/HatchStyle.cxx @@ -140,7 +140,7 @@ void XMLHatchStyleImport::importXML( if( !aDisplayName.isEmpty() ) { - rImport.AddStyleDisplayName( XML_STYLE_FAMILY_SD_HATCH_ID, rStrName, + rImport.AddStyleDisplayName( XmlStyleFamily::SD_HATCH_ID, rStrName, aDisplayName ); rStrName = aDisplayName; } diff --git a/xmloff/source/style/ImageStyle.cxx b/xmloff/source/style/ImageStyle.cxx index 164f155fb02e..c01c252a9831 100644 --- a/xmloff/source/style/ImageStyle.cxx +++ b/xmloff/source/style/ImageStyle.cxx @@ -151,7 +151,7 @@ bool XMLImageStyle::importXML(uno::Reference<xml::sax::XAttributeList> const & x if( !aDisplayName.isEmpty() ) { - rImport.AddStyleDisplayName( XML_STYLE_FAMILY_SD_FILL_IMAGE_ID, + rImport.AddStyleDisplayName( XmlStyleFamily::SD_FILL_IMAGE_ID, rStrName, aDisplayName ); rStrName = aDisplayName; } diff --git a/xmloff/source/style/MarkerStyle.cxx b/xmloff/source/style/MarkerStyle.cxx index 134f2b593f76..d9c323a224f2 100644 --- a/xmloff/source/style/MarkerStyle.cxx +++ b/xmloff/source/style/MarkerStyle.cxx @@ -130,7 +130,7 @@ void XMLMarkerStyleImport::importXML( if( !aDisplayName.isEmpty() ) { - rImport.AddStyleDisplayName( XML_STYLE_FAMILY_SD_MARKER_ID, rStrName, + rImport.AddStyleDisplayName( XmlStyleFamily::SD_MARKER_ID, rStrName, aDisplayName ); rStrName = aDisplayName; } diff --git a/xmloff/source/style/PageMasterImportContext.cxx b/xmloff/source/style/PageMasterImportContext.cxx index 136711093d7c..c9365010e5ef 100644 --- a/xmloff/source/style/PageMasterImportContext.cxx +++ b/xmloff/source/style/PageMasterImportContext.cxx @@ -64,7 +64,7 @@ PageStyleContext::PageStyleContext( SvXMLImport& rImport, const uno::Reference< xml::sax::XAttributeList > & xAttrList, SvXMLStylesContext& rStyles, bool bDefaultStyle) : - XMLPropStyleContext( rImport, nPrfx, rLName, xAttrList, rStyles, XML_STYLE_FAMILY_PAGE_MASTER, bDefaultStyle), + XMLPropStyleContext( rImport, nPrfx, rLName, xAttrList, rStyles, XmlStyleFamily::PAGE_MASTER, bDefaultStyle), sPageUsage(), m_bIsFillStyleAlreadyConverted(false) // { @@ -226,12 +226,12 @@ void PageStyleContext::FillPropertySet_PageStyle( }; // the style families associated with the same index modulo 4 - static sal_uInt16 aFamilies[] = + static const XmlStyleFamily aFamilies[] = { - XML_STYLE_FAMILY_SD_GRADIENT_ID, - XML_STYLE_FAMILY_SD_GRADIENT_ID, - XML_STYLE_FAMILY_SD_HATCH_ID, - XML_STYLE_FAMILY_SD_FILL_IMAGE_ID + XmlStyleFamily::SD_GRADIENT_ID, + XmlStyleFamily::SD_GRADIENT_ID, + XmlStyleFamily::SD_HATCH_ID, + XmlStyleFamily::SD_FILL_IMAGE_ID }; // Fill PropertySet, but let it handle special properties not itself @@ -333,12 +333,12 @@ extern ContextID_Index_Pair const g_MasterPageContextIDs[] = {-1, -1} }; -extern sal_uInt16 const g_MasterPageFamilies[] = +extern XmlStyleFamily const g_MasterPageFamilies[] = { - XML_STYLE_FAMILY_SD_GRADIENT_ID, - XML_STYLE_FAMILY_SD_GRADIENT_ID, - XML_STYLE_FAMILY_SD_HATCH_ID, - XML_STYLE_FAMILY_SD_FILL_IMAGE_ID + XmlStyleFamily::SD_GRADIENT_ID, + XmlStyleFamily::SD_GRADIENT_ID, + XmlStyleFamily::SD_HATCH_ID, + XmlStyleFamily::SD_FILL_IMAGE_ID }; // text grid enhancement for better CJK support diff --git a/xmloff/source/style/PageMasterImportPropMapper.cxx b/xmloff/source/style/PageMasterImportPropMapper.cxx index 0b8565a570b3..52e97c947f03 100644 --- a/xmloff/source/style/PageMasterImportPropMapper.cxx +++ b/xmloff/source/style/PageMasterImportPropMapper.cxx @@ -62,7 +62,7 @@ bool PageMasterImportPropertyMapper::handleSpecialItem( if( CTF_PM_REGISTER_STYLE==nContextID ) { OUString sDisplayName( rImport.GetStyleDisplayName( - XML_STYLE_FAMILY_TEXT_PARAGRAPH, rValue ) ); + XmlStyleFamily::TEXT_PARAGRAPH, rValue ) ); Reference < XNameContainer > xParaStyles = rImport.GetTextImport()->GetParaStyles(); if( xParaStyles.is() && xParaStyles->hasByName( sDisplayName ) ) diff --git a/xmloff/source/style/PageMasterStyleMap.cxx b/xmloff/source/style/PageMasterStyleMap.cxx index 6da592e70841..232a2276bf2c 100644 --- a/xmloff/source/style/PageMasterStyleMap.cxx +++ b/xmloff/source/style/PageMasterStyleMap.cxx @@ -121,7 +121,7 @@ const XMLPropertyMapEntry aXMLPageMasterStyleMap[] = // based on the order used in this list. // Also need own defines for the used context flags (e.g. CTF_PM_FILLGRADIENTNAME instead of // CTF_FILLGRADIENTNAME) since these are used to *filter* up to which entry the attributes belong to the - // 'page-layout-properties' section (!), see SvXMLAutoStylePoolP_Impl::exportXML, look for XML_STYLE_FAMILY_PAGE_MASTER + // 'page-layout-properties' section (!), see SvXMLAutoStylePoolP_Impl::exportXML, look for XmlStyleFamily::PAGE_MASTER // note: these are duplicated below, in g_XMLPageMasterDrawingPageStyleMap PLMAP( "FillStyle", XML_NAMESPACE_DRAW, XML_FILL, XML_SW_TYPE_FILLSTYLE, 0 ), PLMAP( "FillColor", XML_NAMESPACE_DRAW, XML_FILL_COLOR, XML_TYPE_COLOR, 0 ), diff --git a/xmloff/source/style/TransGradientStyle.cxx b/xmloff/source/style/TransGradientStyle.cxx index 510713ca1ae8..55e7a7358f79 100644 --- a/xmloff/source/style/TransGradientStyle.cxx +++ b/xmloff/source/style/TransGradientStyle.cxx @@ -188,7 +188,7 @@ void XMLTransGradientStyleImport::importXML( if( !aDisplayName.isEmpty() ) { - rImport.AddStyleDisplayName( XML_STYLE_FAMILY_SD_GRADIENT_ID, rStrName, + rImport.AddStyleDisplayName( XmlStyleFamily::SD_GRADIENT_ID, rStrName, aDisplayName ); rStrName = aDisplayName; } diff --git a/xmloff/source/style/XMLFontStylesContext.cxx b/xmloff/source/style/XMLFontStylesContext.cxx index 0c8e18a66711..9ca17fe6951a 100644 --- a/xmloff/source/style/XMLFontStylesContext.cxx +++ b/xmloff/source/style/XMLFontStylesContext.cxx @@ -48,7 +48,7 @@ using namespace ::com::sun::star::awt; using namespace ::xmloff::token; -#define XML_STYLE_FAMILY_FONT 1 +#define XML_STYLE_FAMILY_FONT XmlStyleFamily::PAGE_MASTER enum XMLFontStyleAttrTokens { diff --git a/xmloff/source/style/XMLPageExport.cxx b/xmloff/source/style/XMLPageExport.cxx index 41f04b7df5f1..cef9694536d4 100644 --- a/xmloff/source/style/XMLPageExport.cxx +++ b/xmloff/source/style/XMLPageExport.cxx @@ -68,9 +68,9 @@ void XMLPageExport::collectPageMasterAutoStyle( if( !aPropStates.empty()) { OUString sParent; - rPageMasterName = rExport.GetAutoStylePool()->Find( XML_STYLE_FAMILY_PAGE_MASTER, sParent, aPropStates ); + rPageMasterName = rExport.GetAutoStylePool()->Find( XmlStyleFamily::PAGE_MASTER, sParent, aPropStates ); if (rPageMasterName.isEmpty()) - rPageMasterName = rExport.GetAutoStylePool()->Add(XML_STYLE_FAMILY_PAGE_MASTER, sParent, aPropStates); + rPageMasterName = rExport.GetAutoStylePool()->Add(XmlStyleFamily::PAGE_MASTER, sParent, aPropStates); } } } @@ -166,7 +166,7 @@ XMLPageExport::XMLPageExport( SvXMLExport& rExp ) : xPageMasterExportPropMapper = new XMLPageMasterExportPropMapper( xPageMasterPropSetMapper, rExp); - rExport.GetAutoStylePool()->AddFamily( XML_STYLE_FAMILY_PAGE_MASTER, XML_STYLE_FAMILY_PAGE_MASTER_NAME, + rExport.GetAutoStylePool()->AddFamily( XmlStyleFamily::PAGE_MASTER, XML_STYLE_FAMILY_PAGE_MASTER_NAME, xPageMasterExportPropMapper, XML_STYLE_FAMILY_PAGE_MASTER_PREFIX, false ); Reference< XStyleFamiliesSupplier > xFamiliesSupp( GetExport().GetModel(), @@ -213,7 +213,7 @@ void XMLPageExport::exportStyles( bool bUsed, bool bAutoStyles ) void XMLPageExport::exportAutoStyles() { - rExport.GetAutoStylePool()->exportXML(XML_STYLE_FAMILY_PAGE_MASTER); + rExport.GetAutoStylePool()->exportXML(XmlStyleFamily::PAGE_MASTER); } void XMLPageExport::exportDefaultStyle() diff --git a/xmloff/source/style/impastpl.cxx b/xmloff/source/style/impastpl.cxx index 13b600c21204..d28ba948acaf 100644 --- a/xmloff/source/style/impastpl.cxx +++ b/xmloff/source/style/impastpl.cxx @@ -43,7 +43,7 @@ using namespace ::xmloff::token; // ctor/dtor class XMLAutoStyleFamily XMLAutoStyleFamily::XMLAutoStyleFamily( - sal_Int32 nFamily, + XmlStyleFamily nFamily, const OUString& rStrName, const rtl::Reference < SvXMLExportPropertyMapper > &rMapper, const OUString& rStrPrefix, @@ -52,7 +52,7 @@ XMLAutoStyleFamily::XMLAutoStyleFamily( mnCount( 0 ), mnName( 0 ), maStrPrefix( rStrPrefix ), mbAsFamily( bAsFamily ) {} -XMLAutoStyleFamily::XMLAutoStyleFamily( sal_Int32 nFamily ) : +XMLAutoStyleFamily::XMLAutoStyleFamily( XmlStyleFamily nFamily ) : mnFamily(nFamily), mnCount(0), mnName(0), mbAsFamily(false) {} void XMLAutoStyleFamily::ClearEntries() @@ -346,7 +346,7 @@ SvXMLAutoStylePoolP_Impl::~SvXMLAutoStylePoolP_Impl() // Adds stylefamily-information to sorted list void SvXMLAutoStylePoolP_Impl::AddFamily( - sal_Int32 nFamily, + XmlStyleFamily nFamily, const OUString& rStrName, const rtl::Reference < SvXMLExportPropertyMapper > & rMapper, const OUString& rStrPrefix, @@ -381,7 +381,7 @@ void SvXMLAutoStylePoolP_Impl::AddFamily( } void SvXMLAutoStylePoolP_Impl::SetFamilyPropSetMapper( - sal_Int32 nFamily, + XmlStyleFamily nFamily, const rtl::Reference < SvXMLExportPropertyMapper > & rMapper ) { std::unique_ptr<XMLAutoStyleFamily> pTemp(new XMLAutoStyleFamily(nFamily)); @@ -391,7 +391,7 @@ void SvXMLAutoStylePoolP_Impl::SetFamilyPropSetMapper( } // Adds a name to list -void SvXMLAutoStylePoolP_Impl::RegisterName( sal_Int32 nFamily, const OUString& rName ) +void SvXMLAutoStylePoolP_Impl::RegisterName( XmlStyleFamily nFamily, const OUString& rName ) { std::unique_ptr<XMLAutoStyleFamily> pTemp(new XMLAutoStyleFamily(nFamily)); auto const iter = m_FamilySet.find(pTemp); @@ -401,7 +401,7 @@ void SvXMLAutoStylePoolP_Impl::RegisterName( sal_Int32 nFamily, const OUString& } // Adds a name to list -void SvXMLAutoStylePoolP_Impl::RegisterDefinedName( sal_Int32 nFamily, const OUString& rName ) +void SvXMLAutoStylePoolP_Impl::RegisterDefinedName( XmlStyleFamily nFamily, const OUString& rName ) { std::unique_ptr<XMLAutoStyleFamily> pTemp(new XMLAutoStyleFamily(nFamily)); auto const iter = m_FamilySet.find(pTemp); @@ -429,7 +429,7 @@ void SvXMLAutoStylePoolP_Impl::GetRegisteredNames( // iterate over names for (const auto& rName : rFamily.maNameSet) { - aFamilies.push_back( rFamily.mnFamily ); + aFamilies.push_back( static_cast<sal_Int32>(rFamily.mnFamily) ); aNames.push_back( rName ); } } @@ -448,7 +448,7 @@ void SvXMLAutoStylePoolP_Impl::GetRegisteredNames( // if not added, yet. bool SvXMLAutoStylePoolP_Impl::Add( - OUString& rName, sal_Int32 nFamily, const OUString& rParentName, + OUString& rName, XmlStyleFamily nFamily, const OUString& rParentName, const ::std::vector< XMLPropertyState >& rProperties, bool bDontSeek ) { std::unique_ptr<XMLAutoStyleFamily> pTemp(new XMLAutoStyleFamily(nFamily)); @@ -473,7 +473,7 @@ bool SvXMLAutoStylePoolP_Impl::Add( } bool SvXMLAutoStylePoolP_Impl::AddNamed( - const OUString& rName, sal_Int32 nFamily, const OUString& rParentName, + const OUString& rName, XmlStyleFamily nFamily, const OUString& rParentName, const ::std::vector< XMLPropertyState >& rProperties ) { // get family and parent the same way as in Add() @@ -502,7 +502,7 @@ bool SvXMLAutoStylePoolP_Impl::AddNamed( // Search for an array of XMLPropertyState ( vector< XMLPropertyState > ) in list -OUString SvXMLAutoStylePoolP_Impl::Find( sal_Int32 nFamily, +OUString SvXMLAutoStylePoolP_Impl::Find( XmlStyleFamily nFamily, const OUString& rParent, const vector< XMLPropertyState >& rProperties ) const { @@ -572,7 +572,7 @@ struct StyleComparator } void SvXMLAutoStylePoolP_Impl::exportXML( - sal_Int32 nFamily, + XmlStyleFamily nFamily, const SvXMLAutoStylePoolP *pAntiImpl) const { // Get list of parents for current family (nFamily) @@ -675,7 +675,7 @@ void SvXMLAutoStylePoolP_Impl::exportXML( sal_Int32 nStart(-1); sal_Int32 nEnd(-1); - if (nFamily == XML_STYLE_FAMILY_PAGE_MASTER) + if (nFamily == XmlStyleFamily::PAGE_MASTER) { nStart = 0; sal_Int32 nIndex = 0; diff --git a/xmloff/source/style/impastpl.hxx b/xmloff/source/style/impastpl.hxx index e6d04d3c1a73..e33f41a835ab 100644 --- a/xmloff/source/style/impastpl.hxx +++ b/xmloff/source/style/impastpl.hxx @@ -38,6 +38,7 @@ class XMLAutoStylePoolParent; struct XMLAutoStyleFamily; class SvXMLExportPropertyMapper; class SvXMLExport; +enum class XmlStyleFamily; // Properties of a pool @@ -100,7 +101,7 @@ struct XMLAutoStyleFamily typedef std::set<std::unique_ptr<XMLAutoStylePoolParent>, comphelper::UniquePtrValueLess<XMLAutoStylePoolParent>> ParentSetType; - sal_uInt32 const mnFamily; + XmlStyleFamily const mnFamily; OUString const maStrFamilyName; rtl::Reference<SvXMLExportPropertyMapper> mxMapper; @@ -112,11 +113,11 @@ struct XMLAutoStyleFamily OUString const maStrPrefix; bool const mbAsFamily; - XMLAutoStyleFamily( sal_Int32 nFamily, const OUString& rStrName, + XMLAutoStyleFamily( XmlStyleFamily nFamily, const OUString& rStrName, const rtl::Reference<SvXMLExportPropertyMapper>& rMapper, const OUString& rStrPrefix, bool bAsFamily ); - explicit XMLAutoStyleFamily( sal_Int32 nFamily ); + explicit XMLAutoStyleFamily( XmlStyleFamily nFamily ); XMLAutoStyleFamily(const XMLAutoStyleFamily&) = delete; XMLAutoStyleFamily& operator=(const XMLAutoStyleFamily&) = delete; @@ -144,32 +145,32 @@ public: SvXMLExport& GetExport() const { return rExport; } - void AddFamily( sal_Int32 nFamily, const OUString& rStrName, + void AddFamily( XmlStyleFamily nFamily, const OUString& rStrName, const rtl::Reference < SvXMLExportPropertyMapper > & rMapper, const OUString& rStrPrefix, bool bAsFamily ); - void SetFamilyPropSetMapper( sal_Int32 nFamily, + void SetFamilyPropSetMapper( XmlStyleFamily nFamily, const rtl::Reference < SvXMLExportPropertyMapper > & rMapper ); - void RegisterName( sal_Int32 nFamily, const OUString& rName ); - void RegisterDefinedName( sal_Int32 nFamily, const OUString& rName ); + void RegisterName( XmlStyleFamily nFamily, const OUString& rName ); + void RegisterDefinedName( XmlStyleFamily nFamily, const OUString& rName ); void GetRegisteredNames( css::uno::Sequence<sal_Int32>& aFamilies, css::uno::Sequence<OUString>& aNames ); bool Add( - OUString& rName, sal_Int32 nFamily, + OUString& rName, XmlStyleFamily nFamily, const OUString& rParentName, const ::std::vector< XMLPropertyState >& rProperties, bool bDontSeek = false ); bool AddNamed( - const OUString& rName, sal_Int32 nFamily, + const OUString& rName, XmlStyleFamily nFamily, const OUString& rParentName, const ::std::vector< XMLPropertyState >& rProperties ); - OUString Find( sal_Int32 nFamily, const OUString& rParent, + OUString Find( XmlStyleFamily nFamily, const OUString& rParent, const ::std::vector< XMLPropertyState >& rProperties ) const; - void exportXML( sal_Int32 nFamily, + void exportXML( XmlStyleFamily nFamily, const SvXMLAutoStylePoolP *pAntiImpl) const; void ClearEntries(); diff --git a/xmloff/source/style/prstylei.cxx b/xmloff/source/style/prstylei.cxx index bc4f0c4600fa..623014628355 100644 --- a/xmloff/source/style/prstylei.cxx +++ b/xmloff/source/style/prstylei.cxx @@ -148,7 +148,7 @@ static const OUStringLiteral gsFollowStyle( "FollowStyle" ); XMLPropStyleContext::XMLPropStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, const Reference< XAttributeList > & xAttrList, - SvXMLStylesContext& rStyles, sal_uInt16 nFamily, + SvXMLStylesContext& rStyles, XmlStyleFamily nFamily, bool bDefault ) : SvXMLStyleContext( rImport, nPrfx, rLName, xAttrList, nFamily, bDefault ) , mxStyles( &rStyles ) @@ -272,7 +272,7 @@ void XMLPropStyleContext::CreateAndInsert( bool bOverwrite ) // need to filter out old fill definitions when the new ones are used. The new // ones are used when a FillStyle is defined - const bool bTakeCareOfDrawingLayerFillStyle(xImpPrMap.is() && GetFamily() == XML_STYLE_FAMILY_TEXT_PARAGRAPH); + const bool bTakeCareOfDrawingLayerFillStyle(xImpPrMap.is() && GetFamily() == XmlStyleFamily::TEXT_PARAGRAPH); bool bDrawingLayerFillStylesUsed(false); if(bTakeCareOfDrawingLayerFillStyle) @@ -288,7 +288,7 @@ void XMLPropStyleContext::CreateAndInsert( bool bOverwrite ) } if( pSvXMLStylesContext->IsAutomaticStyle() - && ( GetFamily() == XML_STYLE_FAMILY_TEXT_TEXT || GetFamily() == XML_STYLE_FAMILY_TEXT_PARAGRAPH ) ) + && ( GetFamily() == XmlStyleFamily::TEXT_TEXT || GetFamily() == XmlStyleFamily::TEXT_PARAGRAPH ) ) { // Need to translate StyleName from temp MapNames to names // used in already imported items (already exist in the pool). This @@ -313,7 +313,7 @@ void XMLPropStyleContext::CreateAndInsert( bool bOverwrite ) sal_Int32 nLen = aValues.getLength(); if( nLen ) { - if( GetFamily() == XML_STYLE_FAMILY_TEXT_PARAGRAPH ) + if( GetFamily() == XmlStyleFamily::TEXT_PARAGRAPH ) { aValues.realloc( nLen + 2 ); PropertyValue *pProps = aValues.getArray() + nLen; @@ -343,7 +343,7 @@ void XMLPropStyleContext::CreateAndInsert( bool bOverwrite ) if( xAutoStyle.is() ) { Sequence< OUString > aPropNames(1); - aPropNames[0] = GetFamily() == XML_STYLE_FAMILY_TEXT_PARAGRAPH ? + aPropNames[0] = GetFamily() == XmlStyleFamily::TEXT_PARAGRAPH ? OUStringLiteral("ParaAutoStyleName") : OUStringLiteral("CharAutoStyleName"); Sequence< Any > aAny = xAutoStyle->getPropertyValues( aPropNames ); @@ -366,7 +366,7 @@ void XMLPropStyleContext::CreateAndInsert( bool bOverwrite ) Reference < XNameContainer > xFamilies = pSvXMLStylesContext->GetStylesContainer( GetFamily() ); if( !xFamilies.is() ) { - SAL_WARN("xmloff", "no styles container for family " << GetFamily()); + SAL_WARN("xmloff", "no styles container for family " << static_cast<int>(GetFamily())); return; } @@ -621,22 +621,22 @@ void XMLPropStyleContext::translateNameBasedDrawingLayerFillStyleDefinitionsToSt if(a.mnIndex != -1) { const OUString& rPropName = rMapper->GetEntryAPIName(a.mnIndex); - sal_uInt16 aStyleFamily(0); + XmlStyleFamily aStyleFamily(XmlStyleFamily::DATA_STYLE); if(rPropName == s_FillGradientName || rPropName == s_FillTransparenceGradientName) { - aStyleFamily = XML_STYLE_FAMILY_SD_GRADIENT_ID; + aStyleFamily = XmlStyleFamily::SD_GRADIENT_ID; } else if(rPropName == s_FillHatchName) { - aStyleFamily = XML_STYLE_FAMILY_SD_HATCH_ID; + aStyleFamily = XmlStyleFamily::SD_HATCH_ID; } else if(rPropName == s_FillBitmapName) { - aStyleFamily = XML_STYLE_FAMILY_SD_FILL_IMAGE_ID; + aStyleFamily = XmlStyleFamily::SD_FILL_IMAGE_ID; } - if(aStyleFamily) + if(aStyleFamily != XmlStyleFamily::DATA_STYLE) { OUString sStyleName; diff --git a/xmloff/source/style/styleexp.cxx b/xmloff/source/style/styleexp.cxx index 34cbcdc70905..3bc8190060ec 100644 --- a/xmloff/source/style/styleexp.cxx +++ b/xmloff/source/style/styleexp.cxx @@ -407,7 +407,7 @@ void XMLStyleExport::exportStyleFamily( const sal_Char *pFamily, const OUString& rXMLFamily, const rtl::Reference < SvXMLExportPropertyMapper >& rPropMapper, - bool bUsed, sal_uInt16 nFamily, const OUString* pPrefix) + bool bUsed, XmlStyleFamily nFamily, const OUString* pPrefix) { const OUString sFamily(OUString::createFromAscii(pFamily )); exportStyleFamily( sFamily, rXMLFamily, rPropMapper, bUsed, nFamily, @@ -417,7 +417,7 @@ void XMLStyleExport::exportStyleFamily( void XMLStyleExport::exportStyleFamily( const OUString& rFamily, const OUString& rXMLFamily, const rtl::Reference < SvXMLExportPropertyMapper >& rPropMapper, - bool bUsed, sal_uInt16 nFamily, const OUString* pPrefix) + bool bUsed, XmlStyleFamily nFamily, const OUString* pPrefix) { assert(GetExport().GetModel().is()); Reference< XStyleFamiliesSupplier > xFamiliesSupp( GetExport().GetModel(), UNO_QUERY ); diff --git a/xmloff/source/style/xmlaustp.cxx b/xmloff/source/style/xmlaustp.cxx index 61cc664c3180..3e8c910042c7 100644 --- a/xmloff/source/style/xmlaustp.cxx +++ b/xmloff/source/style/xmlaustp.cxx @@ -59,14 +59,14 @@ namespace void SvXMLAutoStylePoolP::exportStyleAttributes( SvXMLAttributeList&, - sal_Int32 nFamily, + XmlStyleFamily nFamily, const vector< XMLPropertyState >& rProperties, const SvXMLExportPropertyMapper& rPropExp, const SvXMLUnitConverter&, const SvXMLNamespaceMap& ) const { - if ( XML_STYLE_FAMILY_CONTROL_ID == nFamily ) + if ( XmlStyleFamily::CONTROL_ID == nFamily ) { // it's a control-related style const rtl::Reference< XMLPropertySetMapper >& aPropertyMapper = rPropExp.getPropertySetMapper(); @@ -81,7 +81,7 @@ void SvXMLAutoStylePoolP::exportStyleAttributes( } } - if( (XML_STYLE_FAMILY_SD_GRAPHICS_ID == nFamily) || (XML_STYLE_FAMILY_SD_PRESENTATION_ID == nFamily) ) + if( (XmlStyleFamily::SD_GRAPHICS_ID == nFamily) || (XmlStyleFamily::SD_PRESENTATION_ID == nFamily) ) { // it's a graphics style const rtl::Reference< XMLPropertySetMapper >& aPropertyMapper = rPropExp.getPropertySetMapper(); assert(aPropertyMapper.is()); @@ -137,7 +137,7 @@ void SvXMLAutoStylePoolP::exportStyleAttributes( } } - if( nFamily == XML_STYLE_FAMILY_PAGE_MASTER ) + if( nFamily == XmlStyleFamily::PAGE_MASTER ) { for( const auto& rProp : rProperties ) { @@ -169,14 +169,14 @@ void SvXMLAutoStylePoolP::exportStyleAttributes( void SvXMLAutoStylePoolP::exportStyleContent( const css::uno::Reference< css::xml::sax::XDocumentHandler > &, - sal_Int32 nFamily, + XmlStyleFamily nFamily, const vector< XMLPropertyState >& rProperties, const SvXMLExportPropertyMapper& rPropExp, const SvXMLUnitConverter&, const SvXMLNamespaceMap& ) const { - if( nFamily != XML_STYLE_FAMILY_PAGE_MASTER ) + if( nFamily != XmlStyleFamily::PAGE_MASTER ) return; sal_Int32 nHeaderStartIndex(-1); @@ -271,7 +271,7 @@ SvXMLExport& SvXMLAutoStylePoolP::GetExport() const // TODO: remove this void SvXMLAutoStylePoolP::AddFamily( - sal_Int32 nFamily, + XmlStyleFamily nFamily, const OUString& rStrName, SvXMLExportPropertyMapper* pMapper, const OUString& aStrPrefix ) @@ -281,7 +281,7 @@ void SvXMLAutoStylePoolP::AddFamily( } void SvXMLAutoStylePoolP::AddFamily( - sal_Int32 nFamily, + XmlStyleFamily nFamily, const OUString& rStrName, const rtl::Reference < SvXMLExportPropertyMapper > & rMapper, const OUString& rStrPrefix, @@ -291,19 +291,19 @@ void SvXMLAutoStylePoolP::AddFamily( } void SvXMLAutoStylePoolP::SetFamilyPropSetMapper( - sal_Int32 nFamily, + XmlStyleFamily nFamily, const rtl::Reference < SvXMLExportPropertyMapper > & rMapper ) { pImpl->SetFamilyPropSetMapper( nFamily, rMapper ); } -void SvXMLAutoStylePoolP::RegisterName( sal_Int32 nFamily, +void SvXMLAutoStylePoolP::RegisterName( XmlStyleFamily nFamily, const OUString& rName ) { pImpl->RegisterName( nFamily, rName ); } -void SvXMLAutoStylePoolP::RegisterDefinedName( sal_Int32 nFamily, +void SvXMLAutoStylePoolP::RegisterDefinedName( XmlStyleFamily nFamily, const OUString& rName ) { pImpl->RegisterDefinedName( nFamily, rName ); @@ -327,10 +327,10 @@ void SvXMLAutoStylePoolP::RegisterNames( const OUString* pNames = aNames.getConstArray(); sal_Int32 nCount = min( aFamilies.getLength(), aNames.getLength() ); for( sal_Int32 n = 0; n < nCount; n++ ) - RegisterName( pFamilies[n], pNames[n] ); + RegisterName( static_cast<XmlStyleFamily>(pFamilies[n]), pNames[n] ); } -OUString SvXMLAutoStylePoolP::Add( sal_Int32 nFamily, +OUString SvXMLAutoStylePoolP::Add( XmlStyleFamily nFamily, const vector< XMLPropertyState >& rProperties ) { OUString sName; @@ -338,7 +338,7 @@ OUString SvXMLAutoStylePoolP::Add( sal_Int32 nFamily, return sName; } -OUString SvXMLAutoStylePoolP::Add( sal_Int32 nFamily, +OUString SvXMLAutoStylePoolP::Add( XmlStyleFamily nFamily, const OUString& rParent, const vector< XMLPropertyState >& rProperties, bool bDontSeek ) { @@ -347,26 +347,26 @@ OUString SvXMLAutoStylePoolP::Add( sal_Int32 nFamily, return sName; } -bool SvXMLAutoStylePoolP::Add(OUString& rName, sal_Int32 nFamily, const OUString& rParent, const ::std::vector< XMLPropertyState >& rProperties ) +bool SvXMLAutoStylePoolP::Add(OUString& rName, XmlStyleFamily nFamily, const OUString& rParent, const ::std::vector< XMLPropertyState >& rProperties ) { return pImpl->Add(rName, nFamily, rParent, rProperties); } -bool SvXMLAutoStylePoolP::AddNamed( const OUString& rName, sal_Int32 nFamily, const OUString& rParent, +bool SvXMLAutoStylePoolP::AddNamed( const OUString& rName, XmlStyleFamily nFamily, const OUString& rParent, const ::std::vector< XMLPropertyState >& rProperties ) { return pImpl->AddNamed(rName, nFamily, rParent, rProperties); } -OUString SvXMLAutoStylePoolP::Find( sal_Int32 nFamily, +OUString SvXMLAutoStylePoolP::Find( XmlStyleFamily nFamily, const OUString& rParent, const vector< XMLPropertyState >& rProperties ) const { return pImpl->Find( nFamily, rParent, rProperties ); } -void SvXMLAutoStylePoolP::exportXML( sal_Int32 nFamily ) const +void SvXMLAutoStylePoolP::exportXML( XmlStyleFamily nFamily ) const { pImpl->exportXML( nFamily, this ); } diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx index 6711d4471606..bcc57bc87131 100644 --- a/xmloff/source/style/xmlnumfi.cxx +++ b/xmloff/source/style/xmlnumfi.cxx @@ -1482,7 +1482,7 @@ SvXMLNumFormatContext::SvXMLNumFormatContext( SvXMLImport& rImport, const uno::Reference<xml::sax::XAttributeList>& xAttrList, const sal_Int32 nTempKey, LanguageType nLang, SvXMLStylesContext& rStyles ) : - SvXMLStyleContext( rImport, nPrfx, rLName, xAttrList, XML_STYLE_FAMILY_DATA_STYLE ), + SvXMLStyleContext( rImport, nPrfx, rLName, xAttrList, XmlStyleFamily::DATA_STYLE ), pData( nullptr ), pStyles( &rStyles ), aMyConditions(), @@ -1644,7 +1644,7 @@ sal_Int32 SvXMLNumFormatContext::CreateAndInsert(SvNumberFormatter* pFormatter) for (size_t i = 0; i < aMyConditions.size(); i++) { SvXMLNumFormatContext* pStyle = const_cast<SvXMLNumFormatContext*>( static_cast<const SvXMLNumFormatContext *>(pStyles->FindStyleChildContext( - XML_STYLE_FAMILY_DATA_STYLE, aMyConditions[i].sMapName))); + XmlStyleFamily::DATA_STYLE, aMyConditions[i].sMapName))); if (this == pStyle) { SAL_INFO("xmloff.style", "invalid style:map references containing style"); diff --git a/xmloff/source/style/xmlnumi.cxx b/xmloff/source/style/xmlnumi.cxx index 710bb3ede574..57bc9d4a7155 100644 --- a/xmloff/source/style/xmlnumi.cxx +++ b/xmloff/source/style/xmlnumi.cxx @@ -485,7 +485,7 @@ Sequence<beans::PropertyValue> SvxXMLListLevelStyleContext_Impl::GetProperties() pProps[nPos++].Value <<= nIndentAt; OUString sDisplayTextStyleName = GetImport().GetStyleDisplayName( - XML_STYLE_FAMILY_TEXT_TEXT, sTextStyleName ); + XmlStyleFamily::TEXT_TEXT, sTextStyleName ); pProps[nPos].Name = "CharStyleName"; pProps[nPos++].Value <<= sDisplayTextStyleName; @@ -1016,7 +1016,7 @@ SvxXMLListStyleContext::SvxXMLListStyleContext( SvXMLImport& rImport, const OUString& rLName, const Reference< xml::sax::XAttributeList > & xAttrList, bool bOutl ) -: SvXMLStyleContext( rImport, nPrfx, rLName, xAttrList, bOutl ? XML_STYLE_FAMILY_TEXT_OUTLINE : XML_STYLE_FAMILY_TEXT_LIST ) +: SvXMLStyleContext( rImport, nPrfx, rLName, xAttrList, bOutl ? XmlStyleFamily::TEXT_OUTLINE : XmlStyleFamily::TEXT_LIST ) , bConsecutive( false ) , bOutline( bOutl ) { @@ -1026,7 +1026,7 @@ SvxXMLListStyleContext::SvxXMLListStyleContext( SvXMLImport& rImport, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList, bool bOutl ) -: SvXMLStyleContext( rImport, nElement, xAttrList, bOutl ? XML_STYLE_FAMILY_TEXT_OUTLINE : XML_STYLE_FAMILY_TEXT_LIST ) +: SvXMLStyleContext( rImport, nElement, xAttrList, bOutl ? XmlStyleFamily::TEXT_OUTLINE : XmlStyleFamily::TEXT_LIST ) , bConsecutive( false ) , bOutline( bOutl ) { @@ -1172,7 +1172,7 @@ void SvxXMLListStyleContext::CreateAndInsertLate( bool bOverwrite ) xPropSet->setPropertyValue( "Hidden", uno::makeAny( IsHidden( ) ) ); if( rName != GetName() ) - GetImport().AddStyleDisplayName( XML_STYLE_FAMILY_TEXT_LIST, + GetImport().AddStyleDisplayName( XmlStyleFamily::TEXT_LIST, GetName(), rName ); Any aAny = xPropSet->getPropertyValue( sNumberingRules ); diff --git a/xmloff/source/style/xmlstyle.cxx b/xmloff/source/style/xmlstyle.cxx index 542c5a532414..d702f9fdcdb5 100644 --- a/xmloff/source/style/xmlstyle.cxx +++ b/xmloff/source/style/xmlstyle.cxx @@ -98,9 +98,9 @@ void SvXMLStyleContext::SetAttribute( sal_uInt16 nPrefixKey, if( IsXMLToken( rLocalName, XML_FAMILY ) ) { if( IsXMLToken( rValue, XML_PARAGRAPH ) ) - mnFamily = sal_uInt16(SfxStyleFamily::Para); + mnFamily = XmlStyleFamily(SfxStyleFamily::Para); else if( IsXMLToken( rValue, XML_TEXT ) ) - mnFamily = sal_uInt16(SfxStyleFamily::Char); + mnFamily = XmlStyleFamily(SfxStyleFamily::Char); } else if( IsXMLToken( rLocalName, XML_NAME ) ) { @@ -137,7 +137,7 @@ SvXMLStyleContext::SvXMLStyleContext( SvXMLImport& rImp, sal_uInt16 nPrfx, const OUString& rLName, const uno::Reference< xml::sax::XAttributeList >&, - sal_uInt16 nFam, bool bDefault ) : + XmlStyleFamily nFam, bool bDefault ) : SvXMLImportContext( rImp, nPrfx, rLName ), mbHidden( false ), mnFamily( nFam ), @@ -151,7 +151,7 @@ SvXMLStyleContext::SvXMLStyleContext( SvXMLImport& rImp, sal_Int32 /*nElement*/, const css::uno::Reference< css::xml::sax::XFastAttributeList > &, - sal_uInt16 nFam, bool bDefault ) : + XmlStyleFamily nFam, bool bDefault ) : SvXMLImportContext( rImp ), mbHidden( false ), mnFamily( nFam ), @@ -209,13 +209,13 @@ bool SvXMLStyleContext::IsTransient() const class SvXMLStyleIndex_Impl { - OUString const sName; - sal_uInt16 const nFamily; + OUString sName; + XmlStyleFamily nFamily; const rtl::Reference<SvXMLStyleContext> mxStyle; public: - SvXMLStyleIndex_Impl( sal_uInt16 nFam, const OUString& rName ) : + SvXMLStyleIndex_Impl( XmlStyleFamily nFam, const OUString& rName ) : sName( rName ), nFamily( nFam ) { @@ -229,7 +229,7 @@ public: } const OUString& GetName() const { return sName; } - sal_uInt16 GetFamily() const { return nFamily; } + XmlStyleFamily GetFamily() const { return nFamily; } const SvXMLStyleContext *GetStyle() const { return mxStyle.get(); } }; @@ -277,7 +277,7 @@ public: inline void AddStyle( SvXMLStyleContext *pStyle ); void Clear(); - const SvXMLStyleContext *FindStyleChildContext( sal_uInt16 nFamily, + const SvXMLStyleContext *FindStyleChildContext( XmlStyleFamily nFamily, const OUString& rName, bool bCreateIndex ) const; bool IsAutomaticStyle() const { return bAutomaticStyle; } @@ -303,7 +303,7 @@ void SvXMLStylesContext_Impl::Clear() aStyles.clear(); } -const SvXMLStyleContext *SvXMLStylesContext_Impl::FindStyleChildContext( sal_uInt16 nFamily, +const SvXMLStyleContext *SvXMLStylesContext_Impl::FindStyleChildContext( XmlStyleFamily nFamily, const OUString& rName, bool bCreateIndex ) const { @@ -382,7 +382,7 @@ SvXMLStyleContext *SvXMLStylesContext::CreateStyleChildContext( sal_uInt16 p_nPr case XML_TOK_STYLE_STYLE: case XML_TOK_STYLE_DEFAULT_STYLE: { - sal_uInt16 nFamily = 0; + XmlStyleFamily nFamily = XmlStyleFamily::DATA_STYLE; sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; for( sal_Int16 i=0; i < nAttrCount; i++ ) { @@ -480,116 +480,118 @@ SvXMLStyleContext *SvXMLStylesContext::CreateStyleChildContext( sal_uInt16 p_nPr } SvXMLStyleContext *SvXMLStylesContext::CreateStyleStyleChildContext( - sal_uInt16 nFamily, sal_uInt16 nPrefix, const OUString& rLocalName, + XmlStyleFamily nFamily, sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< xml::sax::XAttributeList > & xAttrList ) { SvXMLStyleContext *pStyle = nullptr; switch( nFamily ) { - case XML_STYLE_FAMILY_TEXT_PARAGRAPH: - case XML_STYLE_FAMILY_TEXT_TEXT: - case XML_STYLE_FAMILY_TEXT_SECTION: + case XmlStyleFamily::TEXT_PARAGRAPH: + case XmlStyleFamily::TEXT_TEXT: + case XmlStyleFamily::TEXT_SECTION: pStyle = new XMLTextStyleContext( GetImport(), nPrefix, rLocalName, xAttrList, *this, nFamily ); break; - case XML_STYLE_FAMILY_TEXT_RUBY: + case XmlStyleFamily::TEXT_RUBY: pStyle = new XMLPropStyleContext( GetImport(), nPrefix, rLocalName, xAttrList, *this, nFamily ); break; - case XML_STYLE_FAMILY_SCH_CHART_ID: + case XmlStyleFamily::SCH_CHART_ID: pStyle = new XMLChartStyleContext( GetImport(), nPrefix, rLocalName, xAttrList, *this, nFamily ); break; - case XML_STYLE_FAMILY_SD_GRAPHICS_ID: - case XML_STYLE_FAMILY_SD_PRESENTATION_ID: - case XML_STYLE_FAMILY_SD_POOL_ID: + case XmlStyleFamily::SD_GRAPHICS_ID: + case XmlStyleFamily::SD_PRESENTATION_ID: + case XmlStyleFamily::SD_POOL_ID: pStyle = new XMLShapeStyleContext( GetImport(), nPrefix, rLocalName, xAttrList, *this, nFamily ); + break; + default: break; } return pStyle; } SvXMLStyleContext *SvXMLStylesContext::CreateDefaultStyleStyleChildContext( - sal_uInt16 /*nFamily*/, sal_uInt16 /*nPrefix*/, const OUString& /*rLocalName*/, + XmlStyleFamily /*nFamily*/, sal_uInt16 /*nPrefix*/, const OUString& /*rLocalName*/, const uno::Reference< xml::sax::XAttributeList > & ) { return nullptr; } -bool SvXMLStylesContext::InsertStyleFamily( sal_uInt16 ) const +bool SvXMLStylesContext::InsertStyleFamily( XmlStyleFamily ) const { return true; } -sal_uInt16 SvXMLStylesContext::GetFamily( const OUString& rValue ) +XmlStyleFamily SvXMLStylesContext::GetFamily( const OUString& rValue ) { - sal_uInt16 nFamily = 0U; + XmlStyleFamily nFamily = XmlStyleFamily::DATA_STYLE; if( IsXMLToken( rValue, XML_PARAGRAPH ) ) { - nFamily = XML_STYLE_FAMILY_TEXT_PARAGRAPH; + nFamily = XmlStyleFamily::TEXT_PARAGRAPH; } else if( IsXMLToken( rValue, XML_TEXT ) ) { - nFamily = XML_STYLE_FAMILY_TEXT_TEXT; + nFamily = XmlStyleFamily::TEXT_TEXT; } else if( IsXMLToken( rValue, XML_DATA_STYLE ) ) { - nFamily = XML_STYLE_FAMILY_DATA_STYLE; + nFamily = XmlStyleFamily::DATA_STYLE; } else if ( IsXMLToken( rValue, XML_SECTION ) ) { - nFamily = XML_STYLE_FAMILY_TEXT_SECTION; + nFamily = XmlStyleFamily::TEXT_SECTION; } else if( IsXMLToken( rValue, XML_TABLE ) ) { - nFamily = XML_STYLE_FAMILY_TABLE_TABLE; + nFamily = XmlStyleFamily::TABLE_TABLE; } else if( IsXMLToken( rValue, XML_TABLE_COLUMN ) ) - nFamily = XML_STYLE_FAMILY_TABLE_COLUMN; + nFamily = XmlStyleFamily::TABLE_COLUMN; else if( IsXMLToken( rValue, XML_TABLE_ROW ) ) - nFamily = XML_STYLE_FAMILY_TABLE_ROW; + nFamily = XmlStyleFamily::TABLE_ROW; else if( IsXMLToken( rValue, XML_TABLE_CELL ) ) - nFamily = XML_STYLE_FAMILY_TABLE_CELL; + nFamily = XmlStyleFamily::TABLE_CELL; else if ( rValue == XML_STYLE_FAMILY_SD_GRAPHICS_NAME ) { - nFamily = XML_STYLE_FAMILY_SD_GRAPHICS_ID; + nFamily = XmlStyleFamily::SD_GRAPHICS_ID; } else if ( rValue == XML_STYLE_FAMILY_SD_PRESENTATION_NAME ) { - nFamily = XML_STYLE_FAMILY_SD_PRESENTATION_ID; + nFamily = XmlStyleFamily::SD_PRESENTATION_ID; } else if ( rValue == XML_STYLE_FAMILY_SD_POOL_NAME ) { - nFamily = XML_STYLE_FAMILY_SD_POOL_ID; + nFamily = XmlStyleFamily::SD_POOL_ID; } else if ( rValue == XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME ) { - nFamily = XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID; + nFamily = XmlStyleFamily::SD_DRAWINGPAGE_ID; } else if ( rValue == XML_STYLE_FAMILY_SCH_CHART_NAME ) { - nFamily = XML_STYLE_FAMILY_SCH_CHART_ID; + nFamily = XmlStyleFamily::SCH_CHART_ID; } else if ( IsXMLToken( rValue, XML_RUBY ) ) { - nFamily = XML_STYLE_FAMILY_TEXT_RUBY; + nFamily = XmlStyleFamily::TEXT_RUBY; } return nFamily; } rtl::Reference < SvXMLImportPropertyMapper > SvXMLStylesContext::GetImportPropertyMapper( - sal_uInt16 nFamily ) const + XmlStyleFamily nFamily ) const { rtl::Reference < SvXMLImportPropertyMapper > xMapper; switch( nFamily ) { - case XML_STYLE_FAMILY_TEXT_PARAGRAPH: + case XmlStyleFamily::TEXT_PARAGRAPH: if( !mxParaImpPropMapper.is() ) { SvXMLStylesContext * pThis = const_cast<SvXMLStylesContext *>(this); @@ -599,7 +601,7 @@ rtl::Reference < SvXMLImportPropertyMapper > SvXMLStylesContext::GetImportProper } xMapper = mxParaImpPropMapper; break; - case XML_STYLE_FAMILY_TEXT_TEXT: + case XmlStyleFamily::TEXT_TEXT: if( !mxTextImpPropMapper.is() ) { SvXMLStylesContext * pThis = const_cast<SvXMLStylesContext *>(this); @@ -610,7 +612,7 @@ rtl::Reference < SvXMLImportPropertyMapper > SvXMLStylesContext::GetImportProper xMapper = mxTextImpPropMapper; break; - case XML_STYLE_FAMILY_TEXT_SECTION: + case XmlStyleFamily::TEXT_SECTION: // don't cache section mapper, as it's rarely used // *sigh*, cast to non-const, because this is a const method, // but SvXMLImport::GetTextImport() isn't. @@ -618,7 +620,7 @@ rtl::Reference < SvXMLImportPropertyMapper > SvXMLStylesContext::GetImportProper GetSectionImportPropertySetMapper(); break; - case XML_STYLE_FAMILY_TEXT_RUBY: + case XmlStyleFamily::TEXT_RUBY: // don't cache section mapper, as it's rarely used // *sigh*, cast to non-const, because this is a const method, // but SvXMLImport::GetTextImport() isn't. @@ -626,9 +628,9 @@ rtl::Reference < SvXMLImportPropertyMapper > SvXMLStylesContext::GetImportProper GetRubyImportPropertySetMapper(); break; - case XML_STYLE_FAMILY_SD_GRAPHICS_ID: - case XML_STYLE_FAMILY_SD_PRESENTATION_ID: - case XML_STYLE_FAMILY_SD_POOL_ID: + case XmlStyleFamily::SD_GRAPHICS_ID: + case XmlStyleFamily::SD_PRESENTATION_ID: + case XmlStyleFamily::SD_POOL_ID: if(!mxShapeImpPropMapper.is()) { rtl::Reference< XMLShapeImportHelper > aImpHelper = const_cast<SvXMLImport&>(GetImport()).GetShapeImport(); @@ -637,7 +639,7 @@ rtl::Reference < SvXMLImportPropertyMapper > SvXMLStylesContext::GetImportProper } xMapper = mxShapeImpPropMapper; break; - case XML_STYLE_FAMILY_SCH_CHART_ID: + case XmlStyleFamily::SCH_CHART_ID: if( ! mxChartImpPropMapper.is() ) { XMLPropertySetMapper *const pPropMapper = new XMLChartPropertySetMapper(nullptr); @@ -645,7 +647,7 @@ rtl::Reference < SvXMLImportPropertyMapper > SvXMLStylesContext::GetImportProper } xMapper = mxChartImpPropMapper; break; - case XML_STYLE_FAMILY_PAGE_MASTER: + case XmlStyleFamily::PAGE_MASTER: if( ! mxPageImpPropMapper.is() ) { XMLPropertySetMapper *pPropMapper = @@ -656,17 +658,18 @@ rtl::Reference < SvXMLImportPropertyMapper > SvXMLStylesContext::GetImportProper } xMapper = mxPageImpPropMapper; break; + default: break; } return xMapper; } -Reference < XAutoStyleFamily > SvXMLStylesContext::GetAutoStyles( sal_uInt16 nFamily ) const +Reference < XAutoStyleFamily > SvXMLStylesContext::GetAutoStyles( XmlStyleFamily nFamily ) const { Reference < XAutoStyleFamily > xAutoStyles; - if( XML_STYLE_FAMILY_TEXT_TEXT == nFamily || XML_STYLE_FAMILY_TEXT_PARAGRAPH == nFamily) + if( XmlStyleFamily::TEXT_TEXT == nFamily || XmlStyleFamily::TEXT_PARAGRAPH == nFamily) { - bool bPara = XML_STYLE_FAMILY_TEXT_PARAGRAPH == nFamily; + bool bPara = XmlStyleFamily::TEXT_PARAGRAPH == nFamily; OUString sName; if( !bPara && mxTextAutoStyles.is() ) xAutoStyles = mxTextAutoStyles; @@ -692,25 +695,26 @@ Reference < XAutoStyleFamily > SvXMLStylesContext::GetAutoStyles( sal_uInt16 nFa } Reference < XNameContainer > SvXMLStylesContext::GetStylesContainer( - sal_uInt16 nFamily ) const + XmlStyleFamily nFamily ) const { Reference < XNameContainer > xStyles; OUString sName; switch( nFamily ) { - case XML_STYLE_FAMILY_TEXT_PARAGRAPH: + case XmlStyleFamily::TEXT_PARAGRAPH: if( mxParaStyles.is() ) xStyles = mxParaStyles; else sName = "ParagraphStyles"; break; - case XML_STYLE_FAMILY_TEXT_TEXT: + case XmlStyleFamily::TEXT_TEXT: if( mxTextStyles.is() ) xStyles = mxTextStyles; else sName = "CharacterStyles"; break; + default: break; } if( !xStyles.is() && !sName.isEmpty() ) { @@ -725,13 +729,14 @@ Reference < XNameContainer > SvXMLStylesContext::GetStylesContainer( switch( nFamily ) { - case XML_STYLE_FAMILY_TEXT_PARAGRAPH: + case XmlStyleFamily::TEXT_PARAGRAPH: const_cast<SvXMLStylesContext *>(this)->mxParaStyles = xStyles; break; - case XML_STYLE_FAMILY_TEXT_TEXT: + case XmlStyleFamily::TEXT_TEXT: const_cast<SvXMLStylesContext *>(this)->mxTextStyles = xStyles; break; + default: break; } } } @@ -740,17 +745,18 @@ Reference < XNameContainer > SvXMLStylesContext::GetStylesContainer( return xStyles; } -OUString SvXMLStylesContext::GetServiceName( sal_uInt16 nFamily ) const +OUString SvXMLStylesContext::GetServiceName( XmlStyleFamily nFamily ) const { OUString sServiceName; switch( nFamily ) { - case XML_STYLE_FAMILY_TEXT_PARAGRAPH: + case XmlStyleFamily::TEXT_PARAGRAPH: sServiceName = gsParaStyleServiceName; break; - case XML_STYLE_FAMILY_TEXT_TEXT: + case XmlStyleFamily::TEXT_TEXT: sServiceName = gsTextStyleServiceName; break; + default: break; } return sServiceName; @@ -812,9 +818,9 @@ void SvXMLStylesContext::CopyAutoStylesToDoc() for( i = 0; i < nCount; i++ ) { SvXMLStyleContext *pStyle = GetStyle( i ); - if( !pStyle || ( pStyle->GetFamily() != XML_STYLE_FAMILY_TEXT_TEXT && - pStyle->GetFamily() != XML_STYLE_FAMILY_TEXT_PARAGRAPH && - pStyle->GetFamily() != XML_STYLE_FAMILY_TABLE_CELL ) ) + if( !pStyle || ( pStyle->GetFamily() != XmlStyleFamily::TEXT_TEXT && + pStyle->GetFamily() != XmlStyleFamily::TEXT_PARAGRAPH && + pStyle->GetFamily() != XmlStyleFamily::TABLE_CELL ) ) continue; pStyle->CreateAndInsert( false ); } @@ -870,7 +876,7 @@ void SvXMLStylesContext::FinishStyles( bool bOverwrite ) } const SvXMLStyleContext *SvXMLStylesContext::FindStyleChildContext( - sal_uInt16 nFamily, + XmlStyleFamily nFamily, const OUString& rName, bool bCreateIndex ) const { diff --git a/xmloff/source/table/XMLTableExport.cxx b/xmloff/source/table/XMLTableExport.cxx index a6b0f77d0272..2a3846d94c05 100644 --- a/xmloff/source/table/XMLTableExport.cxx +++ b/xmloff/source/table/XMLTableExport.cxx @@ -195,15 +195,15 @@ XMLTableExport::XMLTableExport(SvXMLExport& rExp, const rtl::Reference< SvXMLExp mxRowExportPropertySetMapper = new SvXMLExportPropertyMapper( new XMLPropertySetMapper( getRowPropertiesMap(), xFactoryRef.get(), true ) ); mxColumnExportPropertySetMapper = new SvXMLExportPropertyMapper( new XMLPropertySetMapper( getColumnPropertiesMap(), xFactoryRef.get(), true ) ); - mrExport.GetAutoStylePool()->AddFamily(XML_STYLE_FAMILY_TABLE_COLUMN, + mrExport.GetAutoStylePool()->AddFamily(XmlStyleFamily::TABLE_COLUMN, OUString(XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_NAME), mxColumnExportPropertySetMapper.get(), OUString(XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_PREFIX)); - mrExport.GetAutoStylePool()->AddFamily(XML_STYLE_FAMILY_TABLE_ROW, + mrExport.GetAutoStylePool()->AddFamily(XmlStyleFamily::TABLE_ROW, OUString(XML_STYLE_FAMILY_TABLE_ROW_STYLES_NAME), mxRowExportPropertySetMapper.get(), OUString(XML_STYLE_FAMILY_TABLE_ROW_STYLES_PREFIX)); - mrExport.GetAutoStylePool()->AddFamily(XML_STYLE_FAMILY_TABLE_CELL, + mrExport.GetAutoStylePool()->AddFamily(XmlStyleFamily::TABLE_CELL, OUString(XML_STYLE_FAMILY_TABLE_CELL_STYLES_NAME), mxCellExportPropertySetMapper.get(), OUString(XML_STYLE_FAMILY_TABLE_CELL_STYLES_PREFIX)); @@ -238,7 +238,7 @@ static bool has_states( const std::vector< XMLPropertyState >& xPropStates ) if( has_states( aPropStates ) ) { - const OUString sStyleName( mrExport.GetAutoStylePool()->Add(XML_STYLE_FAMILY_TABLE_COLUMN, aPropStates) ); + const OUString sStyleName( mrExport.GetAutoStylePool()->Add(XmlStyleFamily::TABLE_COLUMN, aPropStates) ); Reference< XInterface > xKey( xPropSet, UNO_QUERY ); xTableInfo->maColumnStyleMap[xKey] = sStyleName; } @@ -262,7 +262,7 @@ static bool has_states( const std::vector< XMLPropertyState >& xPropStates ) if( has_states( aRowPropStates ) ) { - const OUString sStyleName( mrExport.GetAutoStylePool()->Add(XML_STYLE_FAMILY_TABLE_ROW, aRowPropStates) ); + const OUString sStyleName( mrExport.GetAutoStylePool()->Add(XmlStyleFamily::TABLE_ROW, aRowPropStates) ); Reference< XInterface > xKey( xPropSet, UNO_QUERY ); xTableInfo->maRowStyleMap[xKey] = sStyleName; } @@ -288,7 +288,7 @@ static bool has_states( const std::vector< XMLPropertyState >& xPropStates ) OUString sStyleName; std::vector< XMLPropertyState > aCellPropStates( mxCellExportPropertySetMapper->Filter( xCellSet ) ); if( has_states( aCellPropStates ) ) - sStyleName = mrExport.GetAutoStylePool()->Add(XML_STYLE_FAMILY_TABLE_CELL, aCellPropStates); + sStyleName = mrExport.GetAutoStylePool()->Add(XmlStyleFamily::TABLE_CELL, aCellPropStates); else sStyleName = sParentStyleName; @@ -495,7 +495,7 @@ void XMLTableExport::exportTableStyles() aStEx.set(new XMLStyleExport(mrExport, mrExport.GetAutoStylePool().get())); } - aStEx->exportStyleFamily(sCellStyleName, OUString(XML_STYLE_FAMILY_TABLE_CELL_STYLES_NAME), mxCellExportPropertySetMapper.get(), true, XML_STYLE_FAMILY_TABLE_CELL); + aStEx->exportStyleFamily(sCellStyleName, OUString(XML_STYLE_FAMILY_TABLE_CELL_STYLES_NAME), mxCellExportPropertySetMapper.get(), true, XmlStyleFamily::TABLE_CELL); exportTableTemplates(); } @@ -507,9 +507,9 @@ void XMLTableExport::exportAutoStyles() if( !mbExportTables ) return; - mrExport.GetAutoStylePool()->exportXML( XML_STYLE_FAMILY_TABLE_COLUMN ); - mrExport.GetAutoStylePool()->exportXML( XML_STYLE_FAMILY_TABLE_ROW ); - mrExport.GetAutoStylePool()->exportXML( XML_STYLE_FAMILY_TABLE_CELL ); + mrExport.GetAutoStylePool()->exportXML( XmlStyleFamily::TABLE_COLUMN ); + mrExport.GetAutoStylePool()->exportXML( XmlStyleFamily::TABLE_ROW ); + mrExport.GetAutoStylePool()->exportXML( XmlStyleFamily::TABLE_CELL ); } const TableStyleElement* getTableStyleMap() diff --git a/xmloff/source/table/XMLTableImport.cxx b/xmloff/source/table/XMLTableImport.cxx index ddaae9f5e484..8c1da46a6eda 100644 --- a/xmloff/source/table/XMLTableImport.cxx +++ b/xmloff/source/table/XMLTableImport.cxx @@ -440,7 +440,7 @@ void XMLTableImportContext::InitColumns() { const XMLPropStyleContext* pStyle = dynamic_cast< const XMLPropStyleContext* >( - pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_TABLE_COLUMN, xInfo->msStyleName) ); + pAutoStyles->FindStyleChildContext(XmlStyleFamily::TABLE_COLUMN, xInfo->msStyleName) ); if( pStyle ) { @@ -513,7 +513,7 @@ SvXMLImportContext * XMLTableImportContext::ImportRow( sal_uInt16 nPrefix, const { const XMLPropStyleContext* pStyle = dynamic_cast< const XMLPropStyleContext* >( - pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_TABLE_ROW, sStyleName) ); + pAutoStyles->FindStyleChildContext(XmlStyleFamily::TABLE_ROW, sStyleName) ); if( pStyle ) { @@ -671,7 +671,7 @@ XMLCellImportContext::XMLCellImportContext( SvXMLImport& rImport, const Referenc { const XMLPropStyleContext* pStyle = dynamic_cast< const XMLPropStyleContext* >( - pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_TABLE_CELL, sStyleName) ); + pAutoStyles->FindStyleChildContext(XmlStyleFamily::TABLE_CELL, sStyleName) ); if( pStyle ) { @@ -743,7 +743,7 @@ void XMLCellImportContext::EndElement() // class XMLTableTemplateContext XMLTableTemplateContext::XMLTableTemplateContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, const Reference< XAttributeList >& xAttrList ) -: SvXMLStyleContext( rImport, nPrfx, rLName, xAttrList, XML_STYLE_FAMILY_TABLE_TEMPLATE_ID, false ) +: SvXMLStyleContext( rImport, nPrfx, rLName, xAttrList, XmlStyleFamily::TABLE_TEMPLATE_ID, false ) { } diff --git a/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx b/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx index d9ce1134ca1f..0a30ae683bae 100644 --- a/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx +++ b/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx @@ -126,7 +126,7 @@ XMLFootnoteConfigurationImportContext::XMLFootnoteConfigurationImportContext( sal_uInt16 nPrfx, const OUString& rLocalName, const Reference<XAttributeList> & xAttrList) -: SvXMLStyleContext(rImport, nPrfx, rLocalName, xAttrList, XML_STYLE_FAMILY_TEXT_FOOTNOTECONFIG) +: SvXMLStyleContext(rImport, nPrfx, rLocalName, xAttrList, XmlStyleFamily::TEXT_FOOTNOTECONFIG) , sNumFormat("1") , sNumSync("false") , nOffset(0) @@ -148,7 +148,7 @@ XMLFootnoteConfigurationImportContext::XMLFootnoteConfigurationImportContext( if( IsXMLToken( rValue, XML_ENDNOTE ) ) { bIsEndnote = true; - SetFamily( XML_STYLE_FAMILY_TEXT_FOOTNOTECONFIG ); + SetFamily( XmlStyleFamily::TEXT_FOOTNOTECONFIG ); } break; } @@ -353,28 +353,28 @@ void XMLFootnoteConfigurationImportContext::ProcessSettings( if (!sCitationStyle.isEmpty()) { aAny <<= GetImport().GetStyleDisplayName( - XML_STYLE_FAMILY_TEXT_TEXT, sCitationStyle ); + XmlStyleFamily::TEXT_TEXT, sCitationStyle ); rConfig->setPropertyValue(gsPropertyCharStyleName, aAny); } if (!sAnchorStyle.isEmpty()) { aAny <<= GetImport().GetStyleDisplayName( - XML_STYLE_FAMILY_TEXT_TEXT, sAnchorStyle ); + XmlStyleFamily::TEXT_TEXT, sAnchorStyle ); rConfig->setPropertyValue(gsPropertyAnchorCharStyleName, aAny); } if (!sPageStyle.isEmpty()) { aAny <<= GetImport().GetStyleDisplayName( - XML_STYLE_FAMILY_MASTER_PAGE, sPageStyle ); + XmlStyleFamily::MASTER_PAGE, sPageStyle ); rConfig->setPropertyValue(gsPropertyPageStyleName, aAny); } if (!sDefaultStyle.isEmpty()) { aAny <<= GetImport().GetStyleDisplayName( - XML_STYLE_FAMILY_TEXT_PARAGRAPH, sDefaultStyle ); + XmlStyleFamily::TEXT_PARAGRAPH, sDefaultStyle ); rConfig->setPropertyValue(gsPropertyParagraphStyleName, aAny); } diff --git a/xmloff/source/text/XMLIndexAlphabeticalSourceContext.cxx b/xmloff/source/text/XMLIndexAlphabeticalSourceContext.cxx index c9a80c6d6d6d..be28561eaf63 100644 --- a/xmloff/source/text/XMLIndexAlphabeticalSourceContext.cxx +++ b/xmloff/source/text/XMLIndexAlphabeticalSourceContext.cxx @@ -77,7 +77,7 @@ void XMLIndexAlphabeticalSourceContext::ProcessAttribute( { sMainEntryStyleName = rValue; OUString sDisplayStyleName = GetImport().GetStyleDisplayName( - XML_STYLE_FAMILY_TEXT_TEXT, sMainEntryStyleName ); + XmlStyleFamily::TEXT_TEXT, sMainEntryStyleName ); const Reference < css::container::XNameContainer >& rStyles = GetImport().GetTextImport()->GetTextStyles(); bMainEntryStyleNameOK = rStyles.is() && rStyles->hasByName( sDisplayStyleName ); @@ -169,7 +169,7 @@ void XMLIndexAlphabeticalSourceContext::EndElement() if (bMainEntryStyleNameOK) { aAny <<= GetImport().GetStyleDisplayName( - XML_STYLE_FAMILY_TEXT_TEXT, sMainEntryStyleName ); + XmlStyleFamily::TEXT_TEXT, sMainEntryStyleName ); rIndexPropertySet->setPropertyValue("MainEntryCharacterStyleName",aAny); } diff --git a/xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx b/xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx index 17b3c3d64e14..ad6eacb3073e 100644 --- a/xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx +++ b/xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx @@ -58,7 +58,7 @@ XMLIndexBibliographyConfigurationContext::XMLIndexBibliographyConfigurationConte sal_uInt16 nPrfx, const OUString& rLocalName, const Reference<XAttributeList> & xAttrList) : - SvXMLStyleContext(rImport, nPrfx, rLocalName, xAttrList, XML_STYLE_FAMILY_TEXT_BIBLIOGRAPHYCONFIG), + SvXMLStyleContext(rImport, nPrfx, rLocalName, xAttrList, XmlStyleFamily::TEXT_BIBLIOGRAPHYCONFIG), sSuffix(), sPrefix(), sAlgorithm(), diff --git a/xmloff/source/text/XMLIndexSimpleEntryContext.cxx b/xmloff/source/text/XMLIndexSimpleEntryContext.cxx index 3addf0827632..8811f4830917 100644 --- a/xmloff/source/text/XMLIndexSimpleEntryContext.cxx +++ b/xmloff/source/text/XMLIndexSimpleEntryContext.cxx @@ -72,7 +72,7 @@ void XMLIndexSimpleEntryContext::StartElement( { m_sCharStyleName = xAttrList->getValueByIndex(nAttr); OUString sDisplayStyleName = GetImport().GetStyleDisplayName( - XML_STYLE_FAMILY_TEXT_TEXT, m_sCharStyleName ); + XmlStyleFamily::TEXT_TEXT, m_sCharStyleName ); // #142494#: Check if style exists const Reference < css::container::XNameContainer > & rStyles = GetImport().GetTextImport()->GetTextStyles(); @@ -117,7 +117,7 @@ void XMLIndexSimpleEntryContext::FillPropertyValues( { rValues[1].Name = "CharacterStyleName"; aAny <<= GetImport().GetStyleDisplayName( - XML_STYLE_FAMILY_TEXT_TEXT, + XmlStyleFamily::TEXT_TEXT, m_sCharStyleName ); rValues[1].Value = aAny; } diff --git a/xmloff/source/text/XMLIndexTOCStylesContext.cxx b/xmloff/source/text/XMLIndexTOCStylesContext.cxx index 4139ce7606c3..f310776dfee0 100644 --- a/xmloff/source/text/XMLIndexTOCStylesContext.cxx +++ b/xmloff/source/text/XMLIndexTOCStylesContext.cxx @@ -93,7 +93,7 @@ void XMLIndexTOCStylesContext::EndElement() for(sal_Int32 i = 0; i < nCount; i++) { aStyleNamesSequence[i] = GetImport().GetStyleDisplayName( - XML_STYLE_FAMILY_TEXT_PARAGRAPH, + XmlStyleFamily::TEXT_PARAGRAPH, aStyleNames[i] ); } diff --git a/xmloff/source/text/XMLIndexTemplateContext.cxx b/xmloff/source/text/XMLIndexTemplateContext.cxx index 02d545cdd871..a248c27f662f 100644 --- a/xmloff/source/text/XMLIndexTemplateContext.cxx +++ b/xmloff/source/text/XMLIndexTemplateContext.cxx @@ -169,7 +169,7 @@ void XMLIndexTemplateContext::EndElement() { OUString sDisplayStyleName = GetImport().GetStyleDisplayName( - XML_STYLE_FAMILY_TEXT_PARAGRAPH, + XmlStyleFamily::TEXT_PARAGRAPH, sStyleName ); // #i50288#: Check if style exists const Reference < css::container::XNameContainer > & rStyles = diff --git a/xmloff/source/text/XMLIndexTitleTemplateContext.cxx b/xmloff/source/text/XMLIndexTitleTemplateContext.cxx index 08189caaadb4..d6d994b869a0 100644 --- a/xmloff/source/text/XMLIndexTitleTemplateContext.cxx +++ b/xmloff/source/text/XMLIndexTitleTemplateContext.cxx @@ -68,7 +68,7 @@ void XMLIndexTitleTemplateContext::StartElement( { sStyleName = xAttrList->getValueByIndex(nAttr); OUString sDisplayStyleName = GetImport().GetStyleDisplayName( - XML_STYLE_FAMILY_TEXT_PARAGRAPH, sStyleName ); + XmlStyleFamily::TEXT_PARAGRAPH, sStyleName ); const Reference < css::container::XNameContainer >& rStyles = GetImport().GetTextImport()->GetParaStyles(); bStyleNameOK = rStyles.is() && rStyles->hasByName( sDisplayStyleName ); @@ -86,7 +86,7 @@ void XMLIndexTitleTemplateContext::EndElement() if (bStyleNameOK) { aAny <<= GetImport().GetStyleDisplayName( - XML_STYLE_FAMILY_TEXT_PARAGRAPH, + XmlStyleFamily::TEXT_PARAGRAPH, sStyleName ); rTOCPropertySet->setPropertyValue("ParaStyleHeading", aAny); } diff --git a/xmloff/source/text/XMLLineNumberingImportContext.cxx b/xmloff/source/text/XMLLineNumberingImportContext.cxx index e7d2ae824e55..5c00a4ddf35c 100644 --- a/xmloff/source/text/XMLLineNumberingImportContext.cxx +++ b/xmloff/source/text/XMLLineNumberingImportContext.cxx @@ -59,7 +59,7 @@ XMLLineNumberingImportContext::XMLLineNumberingImportContext( sal_uInt16 nPrfx, const OUString& rLocalName, const Reference<XAttributeList> & xAttrList) -: SvXMLStyleContext(rImport, nPrfx, rLocalName, xAttrList, XML_STYLE_FAMILY_TEXT_LINENUMBERINGCONFIG) +: SvXMLStyleContext(rImport, nPrfx, rLocalName, xAttrList, XmlStyleFamily::TEXT_LINENUMBERINGCONFIG) , sNumFormat(GetXMLToken(XML_1)) , sNumLetterSync(GetXMLToken(XML_FALSE)) , nOffset(-1) @@ -223,10 +223,10 @@ void XMLLineNumberingImportContext::CreateAndInsert(bool) // set style name (if it exists) if ( GetImport().GetStyles()->FindStyleChildContext( - XML_STYLE_FAMILY_TEXT_TEXT, sStyleName ) != nullptr ) + XmlStyleFamily::TEXT_TEXT, sStyleName ) != nullptr ) { aAny <<= GetImport().GetStyleDisplayName( - XML_STYLE_FAMILY_TEXT_TEXT, sStyleName ); + XmlStyleFamily::TEXT_TEXT, sStyleName ); xLineNumbering->setPropertyValue(gsCharStyleName, aAny); } diff --git a/xmloff/source/text/XMLSectionExport.cxx b/xmloff/source/text/XMLSectionExport.cxx index 2b5e42f46056..fa4a38bd9069 100644 --- a/xmloff/source/text/XMLSectionExport.cxx +++ b/xmloff/source/text/XMLSectionExport.cxx @@ -86,14 +86,14 @@ void XMLSectionExport::ExportSectionStart( if (bAutoStyles) { // get PropertySet and add section style - GetParaExport().Add( XML_STYLE_FAMILY_TEXT_SECTION, xPropertySet ); + GetParaExport().Add( XmlStyleFamily::TEXT_SECTION, xPropertySet ); } else { // always export section style GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_STYLE_NAME, GetParaExport().Find( - XML_STYLE_FAMILY_TEXT_SECTION, + XmlStyleFamily::TEXT_SECTION, xPropertySet, "" ) ); // xml:id for RDF metadata diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx index 0f33c760a6ac..3ba523545b54 100644 --- a/xmloff/source/text/XMLTextFrameContext.cxx +++ b/xmloff/source/text/XMLTextFrameContext.cxx @@ -572,7 +572,7 @@ void XMLTextFrameContext_Impl::Create() if( !sStyleName.isEmpty() ) { OUString sDisplayStyleName( GetImport().GetStyleDisplayName( - XML_STYLE_FAMILY_SD_GRAPHICS_ID, sStyleName ) ); + XmlStyleFamily::SD_GRAPHICS_ID, sStyleName ) ); const Reference < XNameContainer > & rStyles = xTextImportHelper->GetFrameStyles(); if( rStyles.is() && diff --git a/xmloff/source/text/XMLTextListItemContext.cxx b/xmloff/source/text/XMLTextListItemContext.cxx index 7964d37aa310..0000785e5b5e 100644 --- a/xmloff/source/text/XMLTextListItemContext.cxx +++ b/xmloff/source/text/XMLTextListItemContext.cxx @@ -75,7 +75,7 @@ XMLTextListItemContext::XMLTextListItemContext( if ( !sListStyleOverrideName.isEmpty() ) { OUString sDisplayStyleName( - GetImport().GetStyleDisplayName( XML_STYLE_FAMILY_TEXT_LIST, + GetImport().GetStyleDisplayName( XmlStyleFamily::TEXT_LIST, sListStyleOverrideName ) ); const Reference < container::XNameContainer >& rNumStyles = rTxtImp.GetNumberingStyles(); diff --git a/xmloff/source/text/XMLTextMasterPageContext.cxx b/xmloff/source/text/XMLTextMasterPageContext.cxx index 5d5ab75f1a52..7288db7e138c 100644 --- a/xmloff/source/text/XMLTextMasterPageContext.cxx +++ b/xmloff/source/text/XMLTextMasterPageContext.cxx @@ -67,7 +67,7 @@ XMLTextMasterPageContext::XMLTextMasterPageContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, const Reference< XAttributeList > & xAttrList, bool bOverwrite ) -: SvXMLStyleContext( rImport, nPrfx, rLName, xAttrList, XML_STYLE_FAMILY_MASTER_PAGE ) +: SvXMLStyleContext( rImport, nPrfx, rLName, xAttrList, XmlStyleFamily::MASTER_PAGE ) , bInsertHeader( false ) , bInsertFooter( false ) , bInsertHeaderLeft( false ) @@ -112,7 +112,7 @@ XMLTextMasterPageContext::XMLTextMasterPageContext( SvXMLImport& rImport, if( !sDisplayName.isEmpty() ) { - rImport.AddStyleDisplayName( XML_STYLE_FAMILY_MASTER_PAGE, sName, + rImport.AddStyleDisplayName( XmlStyleFamily::MASTER_PAGE, sName, sDisplayName ); } else @@ -293,7 +293,7 @@ void XMLTextMasterPageContext::Finish( bool bOverwrite ) { OUString sDisplayFollow( GetImport().GetStyleDisplayName( - XML_STYLE_FAMILY_MASTER_PAGE, sFollow ) ); + XmlStyleFamily::MASTER_PAGE, sFollow ) ); if( sDisplayFollow.isEmpty() || !xPageStyles->hasByName( sDisplayFollow ) ) sDisplayFollow = xStyle->getName(); diff --git a/xmloff/source/text/XMLTextMasterStylesContext.cxx b/xmloff/source/text/XMLTextMasterStylesContext.cxx index c8af93f582ba..ea66b685aec8 100644 --- a/xmloff/source/text/XMLTextMasterStylesContext.cxx +++ b/xmloff/source/text/XMLTextMasterStylesContext.cxx @@ -31,7 +31,7 @@ using ::xmloff::token::IsXMLToken; using ::xmloff::token::XML_MASTER_PAGE; -bool XMLTextMasterStylesContext::InsertStyleFamily( sal_uInt16 ) const +bool XMLTextMasterStylesContext::InsertStyleFamily( XmlStyleFamily ) const { return true; } @@ -57,7 +57,7 @@ SvXMLStyleContext *XMLTextMasterStylesContext::CreateStyleChildContext( if( XML_NAMESPACE_STYLE == nPrefix && IsXMLToken( rLocalName, XML_MASTER_PAGE ) && - InsertStyleFamily( XML_STYLE_FAMILY_MASTER_PAGE ) ) + InsertStyleFamily( XmlStyleFamily::MASTER_PAGE ) ) pContext = new XMLTextMasterPageContext( GetImport(), nPrefix, rLocalName, xAttrList, @@ -69,7 +69,7 @@ SvXMLStyleContext *XMLTextMasterStylesContext::CreateStyleChildContext( } SvXMLStyleContext *XMLTextMasterStylesContext::CreateStyleStyleChildContext( - sal_uInt16 /*nFamily*/, + XmlStyleFamily /*nFamily*/, sal_uInt16 /*nPrefix*/, const OUString& /*rLocalName*/, const Reference< XAttributeList > & /*xAttrList*/ ) diff --git a/xmloff/source/text/XMLTextShapeStyleContext.cxx b/xmloff/source/text/XMLTextShapeStyleContext.cxx index a781cc60be07..32fda63d7c84 100644 --- a/xmloff/source/text/XMLTextShapeStyleContext.cxx +++ b/xmloff/source/text/XMLTextShapeStyleContext.cxx @@ -140,7 +140,7 @@ static const OUStringLiteral gsIsAutoUpdate( "IsAutoUpdate" ); XMLTextShapeStyleContext::XMLTextShapeStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, const Reference< XAttributeList > & xAttrList, - SvXMLStylesContext& rStyles, sal_uInt16 nFamily ) : + SvXMLStylesContext& rStyles, XmlStyleFamily nFamily ) : XMLShapeStyleContext( rImport, nPrfx, rLName, xAttrList, rStyles, nFamily ), bAutoUpdate( false ) diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx index a36cf98a54ec..249f51f35401 100644 --- a/xmloff/source/text/txtflde.cxx +++ b/xmloff/source/text/txtflde.cxx @@ -792,7 +792,7 @@ void XMLTextFieldExport::ExportFieldAutoStyle( if (FIELD_ID_COMBINED_CHARACTERS != nToken) { GetExport().GetTextParagraphExport()->Add( - XML_STYLE_FAMILY_TEXT_TEXT, xRangePropSet); + XmlStyleFamily::TEXT_TEXT, xRangePropSet); } // process special styles for each field (e.g. data styles) @@ -898,7 +898,7 @@ void XMLTextFieldExport::ExportFieldAutoStyle( "need proper PropertyState for combined characters"); const XMLPropertyState *aStates[] = { pCombinedCharactersPropertyState.get(), nullptr }; GetExport().GetTextParagraphExport()->Add( - XML_STYLE_FAMILY_TEXT_TEXT, xRangePropSet, + XmlStyleFamily::TEXT_TEXT, xRangePropSet, aStates); break; } diff --git a/xmloff/source/text/txtftne.cxx b/xmloff/source/text/txtftne.cxx index c41fad2fe63b..b794392cb687 100644 --- a/xmloff/source/text/txtftne.cxx +++ b/xmloff/source/text/txtftne.cxx @@ -79,7 +79,7 @@ void XMLTextParagraphExport::exportTextFootnote( if (bAutoStyles) { // handle formatting of citation mark - Add( XML_STYLE_FAMILY_TEXT_TEXT, rPropSet ); + Add( XmlStyleFamily::TEXT_TEXT, rPropSet ); // handle formatting within footnote exportTextFootnoteHelper(xFootnote, xText, rText, diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index ef739d273c6d..6ce86f35e0b7 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -1314,8 +1314,8 @@ OUString XMLTextImportHelper::ConvertStarFonts( const OUString& rChars, if( (rFlags & CONV_STAR_FONT_FLAGS_VALID) == 0 ) { XMLTextStyleContext *pStyle = nullptr; - sal_uInt16 nFamily = bPara ? XML_STYLE_FAMILY_TEXT_PARAGRAPH - : XML_STYLE_FAMILY_TEXT_TEXT; + XmlStyleFamily nFamily = bPara ? XmlStyleFamily::TEXT_PARAGRAPH + : XmlStyleFamily::TEXT_TEXT; if (!rStyleName.isEmpty() && m_xImpl->m_xAutoStyles.is()) { const SvXMLStyleContext* pTempStyle = @@ -1437,7 +1437,7 @@ static bool lcl_HasListStyle( const OUString& sStyleName, if ( !aParentStyle.isEmpty() ) { aParentStyle = - rImport.GetStyleDisplayName( XML_STYLE_FAMILY_TEXT_PARAGRAPH, + rImport.GetStyleDisplayName( XmlStyleFamily::TEXT_PARAGRAPH, aParentStyle ); } if ( aParentStyle.isEmpty() || !xParaStyles->hasByName( aParentStyle ) ) @@ -1520,8 +1520,8 @@ OUString XMLTextImportHelper::SetStyleAndAttrs( static const char s_PageDescName[] = "PageDescName"; static const char s_OutlineLevel[] = "OutlineLevel"; - const sal_uInt16 nFamily = bPara ? XML_STYLE_FAMILY_TEXT_PARAGRAPH - : XML_STYLE_FAMILY_TEXT_TEXT; + const XmlStyleFamily nFamily = bPara ? XmlStyleFamily::TEXT_PARAGRAPH + : XmlStyleFamily::TEXT_TEXT; XMLTextStyleContext *pStyle = nullptr; OUString sStyleName( rStyleName ); if (!sStyleName.isEmpty() && m_xImpl->m_xAutoStyles.is()) @@ -1752,7 +1752,7 @@ OUString XMLTextImportHelper::SetStyleAndAttrs( { OUString sDisplayName( rImport.GetStyleDisplayName( - XML_STYLE_FAMILY_MASTER_PAGE, + XmlStyleFamily::MASTER_PAGE, pStyle->GetMasterPageName()) ); if( sDisplayName.isEmpty() || (m_xImpl->m_xPageStyles.is() && @@ -1767,7 +1767,7 @@ OUString XMLTextImportHelper::SetStyleAndAttrs( { OUString sDisplayName( rImport.GetStyleDisplayName( - XML_STYLE_FAMILY_TEXT_TEXT, + XmlStyleFamily::TEXT_TEXT, pStyle->GetDropCapStyleName()) ); if (m_xImpl->m_xTextStyles->hasByName(sDisplayName) && xPropSetInfo->hasPropertyByName("DropCapCharStyleName")) @@ -2159,7 +2159,7 @@ void XMLTextImportHelper::SetHyperlink( { OUString sDisplayName( rImport.GetStyleDisplayName( - XML_STYLE_FAMILY_TEXT_TEXT, rStyleName ) ); + XmlStyleFamily::TEXT_TEXT, rStyleName ) ); if( !sDisplayName.isEmpty() && xPropSetInfo->hasPropertyByName(s_UnvisitedCharStyleName) && m_xImpl->m_xTextStyles->hasByName(sDisplayName)) @@ -2170,7 +2170,7 @@ void XMLTextImportHelper::SetHyperlink( sDisplayName = rImport.GetStyleDisplayName( - XML_STYLE_FAMILY_TEXT_TEXT, rVisitedStyleName ); + XmlStyleFamily::TEXT_TEXT, rVisitedStyleName ); if( !sDisplayName.isEmpty() && xPropSetInfo->hasPropertyByName(s_VisitedCharStyleName) && m_xImpl->m_xTextStyles->hasByName(sDisplayName)) @@ -2204,7 +2204,7 @@ void XMLTextImportHelper::SetRuby( { const SvXMLStyleContext* pTempStyle = static_cast<SvXMLStylesContext *>(m_xImpl->m_xAutoStyles.get())-> - FindStyleChildContext( XML_STYLE_FAMILY_TEXT_RUBY, + FindStyleChildContext( XmlStyleFamily::TEXT_RUBY, rStyleName, true ); XMLPropStyleContext *pStyle = const_cast<XMLPropStyleContext*>(dynamic_cast< const XMLPropStyleContext* >(pTempStyle)); @@ -2217,7 +2217,7 @@ void XMLTextImportHelper::SetRuby( { OUString sDisplayName( rImport.GetStyleDisplayName( - XML_STYLE_FAMILY_TEXT_TEXT, rTextStyleName ) ); + XmlStyleFamily::TEXT_TEXT, rTextStyleName ) ); if( (!sDisplayName.isEmpty()) && m_xImpl->m_xTextStyles->hasByName( sDisplayName )) { @@ -2447,7 +2447,7 @@ sal_Int32 XMLTextImportHelper::GetDataStyleKey(const OUString& sStyleName, const SvXMLStyleContext* pStyle = static_cast<SvXMLStylesContext *>(m_xImpl->m_xAutoStyles.get())-> - FindStyleChildContext( XML_STYLE_FAMILY_DATA_STYLE, + FindStyleChildContext( XmlStyleFamily::DATA_STYLE, sStyleName, true ); // get appropriate context @@ -2483,7 +2483,7 @@ const SvxXMLListStyleContext *XMLTextImportHelper::FindAutoListStyle( const OUSt { const SvXMLStyleContext* pTempStyle = static_cast<SvXMLStylesContext *>(m_xImpl->m_xAutoStyles.get())-> - FindStyleChildContext( XML_STYLE_FAMILY_TEXT_LIST, rName, + FindStyleChildContext( XmlStyleFamily::TEXT_LIST, rName, true ); pStyle = dynamic_cast< const SvxXMLListStyleContext* >(pTempStyle); } @@ -2498,7 +2498,7 @@ XMLPropStyleContext *XMLTextImportHelper::FindAutoFrameStyle( const OUString& rN { const SvXMLStyleContext* pTempStyle = static_cast<SvXMLStylesContext *>(m_xImpl->m_xAutoStyles.get())-> - FindStyleChildContext( XML_STYLE_FAMILY_SD_GRAPHICS_ID, rName, + FindStyleChildContext( XmlStyleFamily::SD_GRAPHICS_ID, rName, true ); pStyle = const_cast<XMLPropStyleContext*>(dynamic_cast< const XMLPropStyleContext* >(pTempStyle)); } @@ -2515,7 +2515,7 @@ XMLPropStyleContext* XMLTextImportHelper::FindSectionStyle( const SvXMLStyleContext* pTempStyle = static_cast<SvXMLStylesContext *>(m_xImpl->m_xAutoStyles.get())-> FindStyleChildContext( - XML_STYLE_FAMILY_TEXT_SECTION, + XmlStyleFamily::TEXT_SECTION, rName, true ); pStyle = const_cast<XMLPropStyleContext*>(dynamic_cast< const XMLPropStyleContext* >(pTempStyle)); } @@ -2532,7 +2532,7 @@ XMLPropStyleContext* XMLTextImportHelper::FindPageMaster( const SvXMLStyleContext* pTempStyle = static_cast<SvXMLStylesContext *>(m_xImpl->m_xAutoStyles.get())-> FindStyleChildContext( - XML_STYLE_FAMILY_PAGE_MASTER, + XmlStyleFamily::PAGE_MASTER, rName, true ); pStyle = const_cast<XMLPropStyleContext*>(dynamic_cast< const XMLPropStyleContext* >(pTempStyle)); } @@ -2548,7 +2548,7 @@ XMLPropStyleContext * XMLTextImportHelper::FindDrawingPage(OUString const& rName } SvXMLStyleContext const* pStyle( static_cast<SvXMLStylesContext *>(m_xImpl->m_xAutoStyles.get())->FindStyleChildContext( - XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID, rName, true)); + XmlStyleFamily::SD_DRAWINGPAGE_ID, rName, true)); assert(pStyle == nullptr || dynamic_cast<XMLPropStyleContext const*>(pStyle) != nullptr); return const_cast<XMLPropStyleContext*>(static_cast<XMLPropStyleContext const*>(pStyle)); } diff --git a/xmloff/source/text/txtlists.cxx b/xmloff/source/text/txtlists.cxx index a4ec881da6a3..0aded3f85f13 100644 --- a/xmloff/source/text/txtlists.cxx +++ b/xmloff/source/text/txtlists.cxx @@ -410,7 +410,7 @@ XMLTextListsHelper::MakeNumRule( if ( !i_StyleName.isEmpty() && i_StyleName != i_ParentStyleName ) { const OUString sDisplayStyleName( - i_rImport.GetStyleDisplayName( XML_STYLE_FAMILY_TEXT_LIST, + i_rImport.GetStyleDisplayName( XmlStyleFamily::TEXT_LIST, i_StyleName) ); const uno::Reference < container::XNameContainer >& rNumStyles( i_rImport.GetTextImport()->GetNumberingStyles() ); diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index 87ae58d56e18..2028bf2c6629 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -519,28 +519,29 @@ void FieldParamExporter::ExportParameter(const OUString& sKey, const OUString& s m_pExport->EndElement(XML_NAMESPACE_FIELD, XML_PARAM, false); } -void XMLTextParagraphExport::Add( sal_uInt16 nFamily, +void XMLTextParagraphExport::Add( XmlStyleFamily nFamily, const Reference < XPropertySet > & rPropSet, const XMLPropertyState** ppAddStates, bool bDontSeek ) { rtl::Reference < SvXMLExportPropertyMapper > xPropMapper; switch( nFamily ) { - case XML_STYLE_FAMILY_TEXT_PARAGRAPH: + case XmlStyleFamily::TEXT_PARAGRAPH: xPropMapper = GetParaPropMapper(); break; - case XML_STYLE_FAMILY_TEXT_TEXT: + case XmlStyleFamily::TEXT_TEXT: xPropMapper = GetTextPropMapper(); break; - case XML_STYLE_FAMILY_TEXT_FRAME: + case XmlStyleFamily::TEXT_FRAME: xPropMapper = GetAutoFramePropMapper(); break; - case XML_STYLE_FAMILY_TEXT_SECTION: + case XmlStyleFamily::TEXT_SECTION: xPropMapper = GetSectionPropMapper(); break; - case XML_STYLE_FAMILY_TEXT_RUBY: + case XmlStyleFamily::TEXT_RUBY: xPropMapper = GetRubyPropMapper(); break; + default: break; } SAL_WARN_IF( !xPropMapper.is(), "xmloff", "There is the property mapper?" ); @@ -563,7 +564,7 @@ void XMLTextParagraphExport::Add( sal_uInt16 nFamily, sal_uInt16 nIgnoreProps = 0; switch( nFamily ) { - case XML_STYLE_FAMILY_TEXT_PARAGRAPH: + case XmlStyleFamily::TEXT_PARAGRAPH: if( xPropSetInfo->hasPropertyByName( gsParaStyleName ) ) { rPropSet->getPropertyValue( gsParaStyleName ) >>= sParent; @@ -609,7 +610,7 @@ void XMLTextParagraphExport::Add( sal_uInt16 nFamily, } } break; - case XML_STYLE_FAMILY_TEXT_TEXT: + case XmlStyleFamily::TEXT_TEXT: { // Get parent and remove hyperlinks (they aren't of interest) rtl::Reference< XMLPropertySetMapper > xPM(xPropMapper->getPropertySetMapper()); @@ -637,16 +638,17 @@ void XMLTextParagraphExport::Add( sal_uInt16 nFamily, } } break; - case XML_STYLE_FAMILY_TEXT_FRAME: + case XmlStyleFamily::TEXT_FRAME: if( xPropSetInfo->hasPropertyByName( gsFrameStyleName ) ) { rPropSet->getPropertyValue( gsFrameStyleName ) >>= sParent; } break; - case XML_STYLE_FAMILY_TEXT_SECTION: - case XML_STYLE_FAMILY_TEXT_RUBY: + case XmlStyleFamily::TEXT_SECTION: + case XmlStyleFamily::TEXT_RUBY: ; // section styles have no parents break; + default: break; } if (aPropStates.size() - nIgnoreProps) { @@ -662,16 +664,17 @@ static bool lcl_validPropState( const XMLPropertyState& rState ) return rState.mnIndex != -1; } -void XMLTextParagraphExport::Add( sal_uInt16 nFamily, +void XMLTextParagraphExport::Add( XmlStyleFamily nFamily, MultiPropertySetHelper& rPropSetHelper, const Reference < XPropertySet > & rPropSet) { rtl::Reference < SvXMLExportPropertyMapper > xPropMapper; switch( nFamily ) { - case XML_STYLE_FAMILY_TEXT_PARAGRAPH: + case XmlStyleFamily::TEXT_PARAGRAPH: xPropMapper = GetParaPropMapper(); break; + default: break; } SAL_WARN_IF( !xPropMapper.is(), "xmloff", "There is the property mapper?" ); @@ -720,7 +723,7 @@ void XMLTextParagraphExport::Add( sal_uInt16 nFamily, OUString sParent, sCondParent; switch( nFamily ) { - case XML_STYLE_FAMILY_TEXT_PARAGRAPH: + case XmlStyleFamily::TEXT_PARAGRAPH: if( rPropSetHelper.hasProperty( PARA_STYLE_NAME_AUTO ) ) { rPropSetHelper.getValue( PARA_STYLE_NAME_AUTO, rPropSet, @@ -733,6 +736,7 @@ void XMLTextParagraphExport::Add( sal_uInt16 nFamily, } break; + default: break; } if( std::any_of( aPropStates.begin(), aPropStates.end(), lcl_validPropState ) ) @@ -745,8 +749,8 @@ void XMLTextParagraphExport::Add( sal_uInt16 nFamily, } OUString XMLTextParagraphExport::Find( - sal_uInt16 nFamily, - const Reference < XPropertySet > & rPropSet, + XmlStyleFamily nFamily, + const Reference < XPropertySet > & rPropSet, const OUString& rParent, const XMLPropertyState** ppAddStates) const { @@ -754,18 +758,19 @@ OUString XMLTextParagraphExport::Find( rtl::Reference < SvXMLExportPropertyMapper > xPropMapper; switch( nFamily ) { - case XML_STYLE_FAMILY_TEXT_PARAGRAPH: + case XmlStyleFamily::TEXT_PARAGRAPH: xPropMapper = GetParaPropMapper(); break; - case XML_STYLE_FAMILY_TEXT_FRAME: + case XmlStyleFamily::TEXT_FRAME: xPropMapper = GetAutoFramePropMapper(); break; - case XML_STYLE_FAMILY_TEXT_SECTION: + case XmlStyleFamily::TEXT_SECTION: xPropMapper = GetSectionPropMapper(); break; - case XML_STYLE_FAMILY_TEXT_RUBY: + case XmlStyleFamily::TEXT_RUBY: xPropMapper = GetRubyPropMapper(); break; + default: break; } SAL_WARN_IF( !xPropMapper.is(), "xmloff", "There is the property mapper?" ); if( !xPropMapper.is() ) @@ -855,7 +860,7 @@ OUString XMLTextParagraphExport::FindTextStyleAndHyperlink( aPropStates.erase( aFirstDel ); } sName = GetAutoStylePool().Find( - XML_STYLE_FAMILY_TEXT_TEXT, + XmlStyleFamily::TEXT_TEXT, OUString(), // AutoStyles should not have parents! aPropStates ); rbHasAutoStyle = true; @@ -1249,7 +1254,7 @@ XMLTextParagraphExport::XMLTextParagraphExport( OUString sFamily( GetXMLToken(XML_PARAGRAPH) ); OUString aPrefix(u'P'); - rAutoStylePool.AddFamily( XML_STYLE_FAMILY_TEXT_PARAGRAPH, sFamily, + rAutoStylePool.AddFamily( XmlStyleFamily::TEXT_PARAGRAPH, sFamily, xParaPropMapper, aPrefix ); xPropMapper = new XMLTextPropertySetMapper( TextPropMap::TEXT, true ); @@ -1257,7 +1262,7 @@ XMLTextParagraphExport::XMLTextParagraphExport( GetExport() ); sFamily = GetXMLToken(XML_TEXT); aPrefix = "T"; - rAutoStylePool.AddFamily( XML_STYLE_FAMILY_TEXT_TEXT, sFamily, + rAutoStylePool.AddFamily( XmlStyleFamily::TEXT_TEXT, sFamily, xTextPropMapper, aPrefix ); xPropMapper = new XMLTextPropertySetMapper( TextPropMap::AUTO_FRAME, true ); @@ -1265,7 +1270,7 @@ XMLTextParagraphExport::XMLTextParagraphExport( GetExport() ); sFamily = XML_STYLE_FAMILY_SD_GRAPHICS_NAME; aPrefix = "fr"; - rAutoStylePool.AddFamily( XML_STYLE_FAMILY_TEXT_FRAME, sFamily, + rAutoStylePool.AddFamily( XmlStyleFamily::TEXT_FRAME, sFamily, xAutoFramePropMapper, aPrefix ); xPropMapper = new XMLTextPropertySetMapper( TextPropMap::SECTION, true ); @@ -1273,14 +1278,14 @@ XMLTextParagraphExport::XMLTextParagraphExport( GetExport() ); sFamily = GetXMLToken( XML_SECTION ); aPrefix = "Sect" ; - rAutoStylePool.AddFamily( XML_STYLE_FAMILY_TEXT_SECTION, sFamily, + rAutoStylePool.AddFamily( XmlStyleFamily::TEXT_SECTION, sFamily, xSectionPropMapper, aPrefix ); xPropMapper = new XMLTextPropertySetMapper( TextPropMap::RUBY, true ); xRubyPropMapper = new SvXMLExportPropertyMapper( xPropMapper ); sFamily = GetXMLToken( XML_RUBY ); aPrefix = "Ru"; - rAutoStylePool.AddFamily( XML_STYLE_FAMILY_TEXT_RUBY, sFamily, + rAutoStylePool.AddFamily( XmlStyleFamily::TEXT_RUBY, sFamily, xRubyPropMapper, aPrefix ); xPropMapper = new XMLTextPropertySetMapper( TextPropMap::FRAME, true ); @@ -1434,24 +1439,24 @@ void XMLTextParagraphExport::collectTextAutoStylesOptimized( bool bIsProgress ) { Reference< XAutoStyles > xAutoStyleFamilies = xAutoStylesSupp->getAutoStyles(); OUString sName; - sal_uInt16 nFamily; + XmlStyleFamily nFamily; for ( int i = 0; i < 3; ++i ) { if ( 0 == i ) { sName = "CharacterStyles" ; - nFamily = XML_STYLE_FAMILY_TEXT_TEXT; + nFamily = XmlStyleFamily::TEXT_TEXT; } else if ( 1 == i ) { sName = "RubyStyles" ; - nFamily = XML_STYLE_FAMILY_TEXT_RUBY; + nFamily = XmlStyleFamily::TEXT_RUBY; } else { sName = "ParagraphStyles" ; - nFamily = XML_STYLE_FAMILY_TEXT_PARAGRAPH; + nFamily = XmlStyleFamily::TEXT_PARAGRAPH; } Any aAny = xAutoStyleFamilies->getByName( sName ); @@ -1558,7 +1563,7 @@ void XMLTextParagraphExport::collectTextAutoStylesOptimized( bool bIsProgress ) Any aAny = xSections->getByIndex( i ); Reference< XTextSection > xSection = *o3tl::doAccess<Reference<XTextSection>>(aAny); Reference < XPropertySet > xPSet( xSection, uno::UNO_QUERY ); - Add( XML_STYLE_FAMILY_TEXT_SECTION, xPSet ); + Add( XmlStyleFamily::TEXT_SECTION, xPSet ); } } } @@ -1895,7 +1900,7 @@ void XMLTextParagraphExport::exportParagraph( { if( bAutoStyles ) { - Add( XML_STYLE_FAMILY_TEXT_PARAGRAPH, rPropSetHelper, xPropSet ); + Add( XmlStyleFamily::TEXT_PARAGRAPH, rPropSetHelper, xPropSet ); } else { @@ -1932,7 +1937,7 @@ void XMLTextParagraphExport::exportParagraph( } } - OUString sAutoStyle = Find( XML_STYLE_FAMILY_TEXT_PARAGRAPH, xPropSet, sStyle ); + OUString sAutoStyle = Find( XmlStyleFamily::TEXT_PARAGRAPH, xPropSet, sStyle ); if ( sAutoStyle.isEmpty() ) sAutoStyle = sStyle; if( !sAutoStyle.isEmpty() ) @@ -1950,7 +1955,7 @@ void XMLTextParagraphExport::exportParagraph( xPropSet ) >>= sCondStyle; if( sCondStyle != sStyle ) { - sCondStyle = Find( XML_STYLE_FAMILY_TEXT_PARAGRAPH, xPropSet, + sCondStyle = Find( XmlStyleFamily::TEXT_PARAGRAPH, xPropSet, sCondStyle ); if( !sCondStyle.isEmpty() ) GetExport().AddAttribute( XML_NAMESPACE_TEXT, @@ -2786,11 +2791,11 @@ void XMLTextParagraphExport::exportAnyTextFrame( _collectTextEmbeddedAutoStyles( xPropSet ); // No text frame style for shapes (#i28745#) else if ( FrameType::Shape != eType ) - Add( XML_STYLE_FAMILY_TEXT_FRAME, xPropSet ); + Add( XmlStyleFamily::TEXT_FRAME, xPropSet ); if( pRangePropSet && lcl_txtpara_isBoundAsChar( xPropSet, xPropSet->getPropertySetInfo() ) ) - Add( XML_STYLE_FAMILY_TEXT_TEXT, *pRangePropSet ); + Add( XmlStyleFamily::TEXT_TEXT, *pRangePropSet ); switch( eType ) { @@ -2899,7 +2904,7 @@ void XMLTextParagraphExport::_exportTextFrame( OUString aMinHeightValue; OUString sMinWidthValue; - OUString sAutoStyle = Find( XML_STYLE_FAMILY_TEXT_FRAME, rPropSet, sStyle ); + OUString sAutoStyle = Find( XmlStyleFamily::TEXT_FRAME, rPropSet, sStyle ); if ( sAutoStyle.isEmpty() ) sAutoStyle = sStyle; if( !sAutoStyle.isEmpty() ) @@ -3060,7 +3065,7 @@ void XMLTextParagraphExport::_exportTextGraphic( rPropSet->getPropertyValue( gsFrameStyleName ) >>= sStyle; } - OUString sAutoStyle = Find( XML_STYLE_FAMILY_TEXT_FRAME, rPropSet, sStyle ); + OUString sAutoStyle = Find( XmlStyleFamily::TEXT_FRAME, rPropSet, sStyle ); if ( sAutoStyle.isEmpty() ) sAutoStyle = sStyle; if( !sAutoStyle.isEmpty() ) @@ -3437,7 +3442,7 @@ void XMLTextParagraphExport::exportTextRange( Reference< XPropertySet > xPropSet( rTextRange, UNO_QUERY ); if ( bAutoStyles ) { - Add( XML_STYLE_FAMILY_TEXT_TEXT, xPropSet ); + Add( XmlStyleFamily::TEXT_TEXT, xPropSet ); } else { @@ -3687,15 +3692,15 @@ void XMLTextParagraphExport::exportTextAutoStyles() mbCollected = true; exportTableAutoStyles(); - GetAutoStylePool().exportXML( XML_STYLE_FAMILY_TEXT_PARAGRAPH ); + GetAutoStylePool().exportXML( XmlStyleFamily::TEXT_PARAGRAPH ); - GetAutoStylePool().exportXML( XML_STYLE_FAMILY_TEXT_TEXT ); + GetAutoStylePool().exportXML( XmlStyleFamily::TEXT_TEXT ); - GetAutoStylePool().exportXML( XML_STYLE_FAMILY_TEXT_FRAME ); + GetAutoStylePool().exportXML( XmlStyleFamily::TEXT_FRAME ); - GetAutoStylePool().exportXML( XML_STYLE_FAMILY_TEXT_SECTION ); + GetAutoStylePool().exportXML( XmlStyleFamily::TEXT_SECTION ); - GetAutoStylePool().exportXML( XML_STYLE_FAMILY_TEXT_RUBY ); + GetAutoStylePool().exportXML( XmlStyleFamily::TEXT_RUBY ); maListAutoPool.exportXML(); } @@ -3715,7 +3720,7 @@ void XMLTextParagraphExport::exportRuby( { // ruby auto styles if (bStart) - Add( XML_STYLE_FAMILY_TEXT_RUBY, rPropSet ); + Add( XmlStyleFamily::TEXT_RUBY, rPropSet ); } else { @@ -3734,7 +3739,7 @@ void XMLTextParagraphExport::exportRuby( // ruby style GetExport().CheckAttrList(); - OUString sStyleName(Find(XML_STYLE_FAMILY_TEXT_RUBY, rPropSet, "")); + OUString sStyleName(Find(XmlStyleFamily::TEXT_RUBY, rPropSet, "")); SAL_WARN_IF(sStyleName.isEmpty(), "xmloff", "Can't find ruby style!"); GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_STYLE_NAME, sStyleName); diff --git a/xmloff/source/text/txtstyle.cxx b/xmloff/source/text/txtstyle.cxx index 543682d207ec..163d1485f4a5 100644 --- a/xmloff/source/text/txtstyle.cxx +++ b/xmloff/source/text/txtstyle.cxx @@ -140,13 +140,13 @@ void XMLTextParagraphExport::exportTextStyles( bool bUsed, bool bProg ) } } exportStyleFamily( "ParagraphStyles", GetXMLToken(XML_PARAGRAPH), GetParaPropMapper(), - bUsed, XML_STYLE_FAMILY_TEXT_PARAGRAPH); + bUsed, XmlStyleFamily::TEXT_PARAGRAPH); exportStyleFamily( "CharacterStyles", GetXMLToken(XML_TEXT), GetTextPropMapper(), - bUsed, XML_STYLE_FAMILY_TEXT_TEXT ); + bUsed, XmlStyleFamily::TEXT_TEXT ); // get shape export to make sure the frame family is added correctly. GetExport().GetShapeExport(); exportStyleFamily( "FrameStyles", OUString(XML_STYLE_FAMILY_SD_GRAPHICS_NAME), xFramePropMapper, - bUsed, XML_STYLE_FAMILY_TEXT_FRAME); + bUsed, XmlStyleFamily::TEXT_FRAME); exportNumStyles( bUsed ); if( !IsBlockMode() ) { diff --git a/xmloff/source/text/txtstyli.cxx b/xmloff/source/text/txtstyli.cxx index ac8c2198f189..a5422a01e4e9 100644 --- a/xmloff/source/text/txtstyli.cxx +++ b/xmloff/source/text/txtstyli.cxx @@ -128,7 +128,7 @@ void XMLTextStyleContext::SetAttribute( sal_uInt16 nPrefixKey, XMLTextStyleContext::XMLTextStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, const Reference< XAttributeList > & xAttrList, - SvXMLStylesContext& rStyles, sal_uInt16 nFamily, + SvXMLStylesContext& rStyles, XmlStyleFamily nFamily, bool bDefaultStyle ) : XMLPropStyleContext( rImport, nPrfx, rLName, xAttrList, rStyles, nFamily, bDefaultStyle ) , m_nOutlineLevel( -1 ) @@ -211,7 +211,7 @@ void XMLTextStyleContext::CreateAndInsert( bool bOverwrite ) } sal_uInt16 nCategory = ParagraphStyleCategory::TEXT; - if( XML_STYLE_FAMILY_TEXT_PARAGRAPH == GetFamily() && + if( XmlStyleFamily::TEXT_PARAGRAPH == GetFamily() && !m_sCategoryVal.isEmpty() && xStyle->isUserDefined() && xPropSetInfo->hasPropertyByName("Category") && SvXMLUnitConverter::convertEnum( nCategory, m_sCategoryVal, aCategoryMap)) @@ -238,9 +238,9 @@ void XMLTextStyleContext::CreateAndInsert( bool bOverwrite ) void XMLTextStyleContext::SetDefaults( ) { - if( ( GetFamily() == XML_STYLE_FAMILY_TEXT_PARAGRAPH ) || - ( GetFamily() == XML_STYLE_FAMILY_TABLE_TABLE ) || - ( GetFamily() == XML_STYLE_FAMILY_TABLE_ROW ) ) + if( ( GetFamily() == XmlStyleFamily::TEXT_PARAGRAPH ) || + ( GetFamily() == XmlStyleFamily::TABLE_TABLE ) || + ( GetFamily() == XmlStyleFamily::TABLE_ROW ) ) { Reference < XMultiServiceFactory > xFactory ( GetImport().GetModel(), UNO_QUERY); if (xFactory.is()) @@ -321,7 +321,7 @@ void XMLTextStyleContext::Finish( bool bOverwrite ) { // change list style name to display name OUString sDisplayListStyleName( - GetImport().GetStyleDisplayName(XML_STYLE_FAMILY_TEXT_LIST, + GetImport().GetStyleDisplayName(XmlStyleFamily::TEXT_LIST, m_sListStyleName)); // The families container must exist const Reference < XNameContainer >& rNumStyles = @@ -341,7 +341,7 @@ void XMLTextStyleContext::Finish( bool bOverwrite ) { // change list style name to display name OUString sDisplayDropCapTextStyleName( - GetImport().GetStyleDisplayName( XML_STYLE_FAMILY_TEXT_TEXT, + GetImport().GetStyleDisplayName( XmlStyleFamily::TEXT_TEXT, m_sDropCapTextStyleName)); // The families container must exist const Reference < XNameContainer >& rTextStyles = @@ -358,7 +358,7 @@ void XMLTextStyleContext::Finish( bool bOverwrite ) { OUString sDisplayName( GetImport().GetStyleDisplayName( - XML_STYLE_FAMILY_MASTER_PAGE, m_sMasterPageName)); + XmlStyleFamily::MASTER_PAGE, m_sMasterPageName)); // The families container must exist const Reference < XNameContainer >& rPageStyles = GetImport().GetTextImport()->GetPageStyles(); @@ -415,12 +415,12 @@ void XMLTextStyleContext::FillPropertySet( }; // the style families associated with the same index modulo 4 - static const sal_uInt16 aFamilies[] = + static const XmlStyleFamily aFamilies[] = { - XML_STYLE_FAMILY_SD_GRADIENT_ID, - XML_STYLE_FAMILY_SD_GRADIENT_ID, - XML_STYLE_FAMILY_SD_HATCH_ID, - XML_STYLE_FAMILY_SD_FILL_IMAGE_ID + XmlStyleFamily::SD_GRADIENT_ID, + XmlStyleFamily::SD_GRADIENT_ID, + XmlStyleFamily::SD_HATCH_ID, + XmlStyleFamily::SD_FILL_IMAGE_ID }; // get property set info @@ -429,13 +429,13 @@ void XMLTextStyleContext::FillPropertySet( bool bAutomatic = false; if(pSvXMLStylesContext->IsAutomaticStyle() && - (XML_STYLE_FAMILY_TEXT_TEXT == GetFamily() || XML_STYLE_FAMILY_TEXT_PARAGRAPH == GetFamily())) + (XmlStyleFamily::TEXT_TEXT == GetFamily() || XmlStyleFamily::TEXT_PARAGRAPH == GetFamily())) { bAutomatic = true; if( !GetAutoName().isEmpty() ) { - OUString sAutoProp = ( GetFamily() == XML_STYLE_FAMILY_TEXT_TEXT ) ? + OUString sAutoProp = ( GetFamily() == XmlStyleFamily::TEXT_TEXT ) ? OUString( "CharAutoStyleName" ): OUString( "ParaAutoStyleName" ); @@ -488,7 +488,7 @@ void XMLTextStyleContext::FillPropertySet( // value; if we didn't find one, we'll set to false, the file // format default. // border-model: same - if(IsDefaultStyle() && XML_STYLE_FAMILY_TABLE_ROW == GetFamily()) + if(IsDefaultStyle() && XmlStyleFamily::TABLE_ROW == GetFamily()) { OUString sIsSplitAllowed("IsSplitAllowed"); SAL_WARN_IF( !rPropSet->getPropertySetInfo()->hasPropertyByName( sIsSplitAllowed ), "xmloff", "property missing?" ); @@ -497,7 +497,7 @@ void XMLTextStyleContext::FillPropertySet( (aContextIDs[1].nIndex == -1) ? makeAny( false ) : GetProperties()[aContextIDs[1].nIndex].maValue ); } - if(IsDefaultStyle() && XML_STYLE_FAMILY_TABLE_TABLE == GetFamily()) + if(IsDefaultStyle() && XmlStyleFamily::TABLE_TABLE == GetFamily()) { OUString sCollapsingBorders("CollapsingBorders"); SAL_WARN_IF( !rPropSet->getPropertySetInfo()->hasPropertyByName( sCollapsingBorders ), "xmloff", "property missing?" ); |