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 /dbaccess/source | |
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 'dbaccess/source')
-rw-r--r-- | dbaccess/source/filter/xml/xmlAutoStyle.cxx | 4 | ||||
-rw-r--r-- | dbaccess/source/filter/xml/xmlAutoStyle.hxx | 2 | ||||
-rw-r--r-- | dbaccess/source/filter/xml/xmlColumn.cxx | 6 | ||||
-rw-r--r-- | dbaccess/source/filter/xml/xmlExport.cxx | 30 | ||||
-rw-r--r-- | dbaccess/source/filter/xml/xmlStyleImport.cxx | 42 | ||||
-rw-r--r-- | dbaccess/source/filter/xml/xmlStyleImport.hxx | 8 | ||||
-rw-r--r-- | dbaccess/source/filter/xml/xmlTable.cxx | 2 |
7 files changed, 48 insertions, 46 deletions
diff --git a/dbaccess/source/filter/xml/xmlAutoStyle.cxx b/dbaccess/source/filter/xml/xmlAutoStyle.cxx index c9e328867b7a..52b141358fdc 100644 --- a/dbaccess/source/filter/xml/xmlAutoStyle.cxx +++ b/dbaccess/source/filter/xml/xmlAutoStyle.cxx @@ -28,7 +28,7 @@ namespace dbaxml void OXMLAutoStylePoolP::exportStyleAttributes( SvXMLAttributeList& rAttrList, - sal_Int32 nFamily, + XmlStyleFamily nFamily, const std::vector< XMLPropertyState >& rProperties, const SvXMLExportPropertyMapper& rPropExp , const SvXMLUnitConverter& rUnitConverter, @@ -36,7 +36,7 @@ void OXMLAutoStylePoolP::exportStyleAttributes( ) const { SvXMLAutoStylePoolP::exportStyleAttributes( rAttrList, nFamily, rProperties, rPropExp, rUnitConverter, rNamespaceMap ); - if ( nFamily == XML_STYLE_FAMILY_TABLE_COLUMN ) + if ( nFamily == XmlStyleFamily::TABLE_COLUMN ) { rtl::Reference< XMLPropertySetMapper > aPropMapper = rODBExport.GetColumnStylesPropertySetMapper(); for (auto const& property : rProperties) diff --git a/dbaccess/source/filter/xml/xmlAutoStyle.hxx b/dbaccess/source/filter/xml/xmlAutoStyle.hxx index c8316cd7f1db..7287d4ef4320 100644 --- a/dbaccess/source/filter/xml/xmlAutoStyle.hxx +++ b/dbaccess/source/filter/xml/xmlAutoStyle.hxx @@ -32,7 +32,7 @@ namespace dbaxml virtual void exportStyleAttributes( SvXMLAttributeList& rAttrList, - sal_Int32 nFamily, + XmlStyleFamily nFamily, const std::vector< XMLPropertyState >& rProperties, const SvXMLExportPropertyMapper& rPropExp, const SvXMLUnitConverter& rUnitConverter, diff --git a/dbaccess/source/filter/xml/xmlColumn.cxx b/dbaccess/source/filter/xml/xmlColumn.cxx index fc90f490179c..f6f5f6148ed6 100644 --- a/dbaccess/source/filter/xml/xmlColumn.cxx +++ b/dbaccess/source/filter/xml/xmlColumn.cxx @@ -131,7 +131,7 @@ void OXMLColumn::EndElement() if ( pAutoStyles ) { OTableStyleContext* pAutoStyle = const_cast<OTableStyleContext*>( - dynamic_cast< const OTableStyleContext* >(pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_TABLE_COLUMN,m_sStyleName))); + dynamic_cast< const OTableStyleContext* >(pAutoStyles->FindStyleChildContext(XmlStyleFamily::TABLE_COLUMN,m_sStyleName))); if ( pAutoStyle ) { pAutoStyle->FillPropertySet(xProp); @@ -143,7 +143,7 @@ void OXMLColumn::EndElement() const SvXMLStylesContext* pAutoStyles = GetOwnImport().GetAutoStyles(); if ( pAutoStyles ) { - OTableStyleContext* pAutoStyle = const_cast<OTableStyleContext*>(dynamic_cast<const OTableStyleContext* >(pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_TABLE_CELL,m_sCellStyleName))); + OTableStyleContext* pAutoStyle = const_cast<OTableStyleContext*>(dynamic_cast<const OTableStyleContext* >(pAutoStyles->FindStyleChildContext(XmlStyleFamily::TABLE_CELL,m_sCellStyleName))); if ( pAutoStyle ) { pAutoStyle->FillPropertySet(xProp); @@ -160,7 +160,7 @@ void OXMLColumn::EndElement() const SvXMLStylesContext* pAutoStyles = GetOwnImport().GetAutoStyles(); if ( pAutoStyles ) { - OTableStyleContext* pAutoStyle = const_cast<OTableStyleContext*>(dynamic_cast< const OTableStyleContext* >(pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_TABLE_CELL,m_sCellStyleName))); + OTableStyleContext* pAutoStyle = const_cast<OTableStyleContext*>(dynamic_cast< const OTableStyleContext* >(pAutoStyles->FindStyleChildContext(XmlStyleFamily::TABLE_CELL,m_sCellStyleName))); if ( pAutoStyle ) { // we also have to do this on the table to import text-properties diff --git a/dbaccess/source/filter/xml/xmlExport.cxx b/dbaccess/source/filter/xml/xmlExport.cxx index cf9f3a75dff7..56dafef3c09b 100644 --- a/dbaccess/source/filter/xml/xmlExport.cxx +++ b/dbaccess/source/filter/xml/xmlExport.cxx @@ -226,25 +226,25 @@ ODBExport::ODBExport(const Reference< XComponentContext >& _rxContext, OUString m_xRowExportHelper = new OSpecialHandleXMLExportPropertyMapper(OXMLHelper::GetRowStylesPropertySetMapper()); GetAutoStylePool()->AddFamily( - XML_STYLE_FAMILY_TABLE_TABLE, + XmlStyleFamily::TABLE_TABLE, OUString(XML_STYLE_FAMILY_TABLE_TABLE_STYLES_NAME ), m_xExportHelper.get(), OUString(XML_STYLE_FAMILY_TABLE_TABLE_STYLES_PREFIX )); GetAutoStylePool()->AddFamily( - XML_STYLE_FAMILY_TABLE_COLUMN, + XmlStyleFamily::TABLE_COLUMN, OUString(XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_NAME ), m_xColumnExportHelper.get(), OUString(XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_PREFIX )); GetAutoStylePool()->AddFamily( - XML_STYLE_FAMILY_TABLE_CELL, + XmlStyleFamily::TABLE_CELL, OUString(XML_STYLE_FAMILY_TABLE_CELL_STYLES_NAME ), m_xCellExportHelper.get(), OUString(XML_STYLE_FAMILY_TABLE_CELL_STYLES_PREFIX )); GetAutoStylePool()->AddFamily( - XML_STYLE_FAMILY_TABLE_ROW, + XmlStyleFamily::TABLE_ROW, OUString(XML_STYLE_FAMILY_TABLE_ROW_STYLES_NAME ), m_xRowExportHelper.get(), OUString(XML_STYLE_FAMILY_TABLE_ROW_STYLES_PREFIX )); @@ -1125,15 +1125,15 @@ void ODBExport::exportTables(bool _bExportContext) void ODBExport::exportAutoStyle(XPropertySet* _xProp) { - typedef std::pair<TPropertyStyleMap*,sal_uInt16> TEnumMapperPair; + typedef std::pair<TPropertyStyleMap*,XmlStyleFamily> TEnumMapperPair; typedef std::pair< rtl::Reference < SvXMLExportPropertyMapper> , TEnumMapperPair> TExportPropMapperPair; Reference<XColumnsSupplier> xSup(_xProp,UNO_QUERY); if ( xSup.is() ) { const TExportPropMapperPair pExportHelper[] = { - TExportPropMapperPair(m_xExportHelper,TEnumMapperPair(&m_aAutoStyleNames,XML_STYLE_FAMILY_TABLE_TABLE )) - // ,TExportPropMapperPair(m_xCellExportHelper,TEnumMapperPair(&m_aCellAutoStyleNames,XML_STYLE_FAMILY_TABLE_CELL)) - ,TExportPropMapperPair(m_xRowExportHelper,TEnumMapperPair(&m_aRowAutoStyleNames,XML_STYLE_FAMILY_TABLE_ROW)) + TExportPropMapperPair(m_xExportHelper,TEnumMapperPair(&m_aAutoStyleNames,XmlStyleFamily::TABLE_TABLE )) + // ,TExportPropMapperPair(m_xCellExportHelper,TEnumMapperPair(&m_aCellAutoStyleNames,XmlStyleFamily::TABLE_CELL)) + ,TExportPropMapperPair(m_xRowExportHelper,TEnumMapperPair(&m_aRowAutoStyleNames,XmlStyleFamily::TABLE_ROW)) }; std::vector< XMLPropertyState > aPropertyStates; @@ -1179,8 +1179,8 @@ void ODBExport::exportAutoStyle(XPropertySet* _xProp) else { // here I know I have a column const TExportPropMapperPair pExportHelper[] = { - TExportPropMapperPair(m_xColumnExportHelper,TEnumMapperPair(&m_aAutoStyleNames,XML_STYLE_FAMILY_TABLE_COLUMN )) - ,TExportPropMapperPair(m_xCellExportHelper,TEnumMapperPair(&m_aCellAutoStyleNames,XML_STYLE_FAMILY_TABLE_CELL)) + TExportPropMapperPair(m_xColumnExportHelper,TEnumMapperPair(&m_aAutoStyleNames,XmlStyleFamily::TABLE_COLUMN )) + ,TExportPropMapperPair(m_xCellExportHelper,TEnumMapperPair(&m_aCellAutoStyleNames,XmlStyleFamily::TABLE_CELL)) }; for (const auto & i : pExportHelper) { @@ -1210,7 +1210,7 @@ void ODBExport::exportAutoStyle(XPropertySet* _xProp) } } - if ( XML_STYLE_FAMILY_TABLE_CELL == i.second.second ) + if ( XmlStyleFamily::TABLE_CELL == i.second.second ) std::copy( m_aCurrentPropertyStates.begin(), m_aCurrentPropertyStates.end(), std::back_inserter( aPropStates )); if ( !aPropStates.empty() ) i.second.first->emplace( _xProp,GetAutoStylePool()->Add( i.second.second, aPropStates ) ); @@ -1238,10 +1238,10 @@ void ODBExport::ExportAutoStyles_() if ( getExportFlags() & SvXMLExportFlags::CONTENT ) { collectComponentStyles(); - GetAutoStylePool()->exportXML(XML_STYLE_FAMILY_TABLE_TABLE); - GetAutoStylePool()->exportXML(XML_STYLE_FAMILY_TABLE_COLUMN); - GetAutoStylePool()->exportXML(XML_STYLE_FAMILY_TABLE_CELL); - GetAutoStylePool()->exportXML(XML_STYLE_FAMILY_TABLE_ROW); + GetAutoStylePool()->exportXML(XmlStyleFamily::TABLE_TABLE); + GetAutoStylePool()->exportXML(XmlStyleFamily::TABLE_COLUMN); + GetAutoStylePool()->exportXML(XmlStyleFamily::TABLE_CELL); + GetAutoStylePool()->exportXML(XmlStyleFamily::TABLE_ROW); exportDataStyles(); } } diff --git a/dbaccess/source/filter/xml/xmlStyleImport.cxx b/dbaccess/source/filter/xml/xmlStyleImport.cxx index e94d8e43e609..1a14ef10b406 100644 --- a/dbaccess/source/filter/xml/xmlStyleImport.cxx +++ b/dbaccess/source/filter/xml/xmlStyleImport.cxx @@ -48,7 +48,7 @@ using namespace xmloff::token; OTableStyleContext::OTableStyleContext( ODBFilter& rImport, sal_uInt16 nPrfx, const OUString& rLName, const Reference< XAttributeList > & xAttrList, - SvXMLStylesContext& rStyles, sal_uInt16 nFamily ) + SvXMLStylesContext& rStyles, XmlStyleFamily nFamily ) :XMLPropStyleContext( rImport, nPrfx, rLName, xAttrList, rStyles, nFamily, false ) ,pStyles(&rStyles) ,m_nNumberFormat(-1) @@ -66,25 +66,25 @@ void OTableStyleContext::FillPropertySet( { if ( !IsDefaultStyle() ) { - if ( GetFamily() == XML_STYLE_FAMILY_TABLE_TABLE ) + if ( GetFamily() == XmlStyleFamily::TABLE_TABLE ) { if ( !sPageStyle.isEmpty() ) { AddProperty(CTF_DB_MASTERPAGENAME, Any(sPageStyle)); } } - else if ( GetFamily() == XML_STYLE_FAMILY_TABLE_COLUMN ) + else if ( GetFamily() == XmlStyleFamily::TABLE_COLUMN ) { if ((m_nNumberFormat == -1) && !m_sDataStyleName.isEmpty()) { SvXMLNumFormatContext* pStyle = const_cast<SvXMLNumFormatContext*>(dynamic_cast< const SvXMLNumFormatContext* >(pStyles->FindStyleChildContext( - XML_STYLE_FAMILY_DATA_STYLE, m_sDataStyleName, true))); + XmlStyleFamily::DATA_STYLE, m_sDataStyleName, true))); if ( !pStyle ) { OTableStylesContext* pMyStyles = dynamic_cast<OTableStylesContext* >(GetOwnImport().GetAutoStyles()); if ( pMyStyles ) pStyle = const_cast<SvXMLNumFormatContext*>(dynamic_cast< const SvXMLNumFormatContext* >(pMyStyles-> - FindStyleChildContext(XML_STYLE_FAMILY_DATA_STYLE, m_sDataStyleName, true))); + FindStyleChildContext(XmlStyleFamily::DATA_STYLE, m_sDataStyleName, true))); else { OSL_FAIL("not possible to get style"); } @@ -162,7 +162,7 @@ void OTableStylesContext::EndElement() rtl::Reference < SvXMLImportPropertyMapper > OTableStylesContext::GetImportPropertyMapper( - sal_uInt16 nFamily ) const + XmlStyleFamily nFamily ) const { rtl::Reference < SvXMLImportPropertyMapper > xMapper = SvXMLStylesContext::GetImportPropertyMapper(nFamily); @@ -170,27 +170,28 @@ rtl::Reference < SvXMLImportPropertyMapper > { switch( nFamily ) { - case XML_STYLE_FAMILY_TABLE_TABLE: + case XmlStyleFamily::TABLE_TABLE: { if ( !m_xTableImpPropMapper.is() ) m_xTableImpPropMapper = new SvXMLImportPropertyMapper( const_cast<OTableStylesContext*>(this)->GetOwnImport().GetTableStylesPropertySetMapper(), const_cast<SvXMLImport&>(GetImport()) ); xMapper = m_xTableImpPropMapper; } break; - case XML_STYLE_FAMILY_TABLE_COLUMN: + case XmlStyleFamily::TABLE_COLUMN: { if ( !m_xColumnImpPropMapper.is() ) m_xColumnImpPropMapper = new SvXMLImportPropertyMapper( const_cast<OTableStylesContext*>(this)->GetOwnImport().GetColumnStylesPropertySetMapper(), const_cast<SvXMLImport&>(GetImport()) ); xMapper = m_xColumnImpPropMapper; } break; - case XML_STYLE_FAMILY_TABLE_CELL: + case XmlStyleFamily::TABLE_CELL: { if ( !m_xCellImpPropMapper.is() ) m_xCellImpPropMapper = new SvXMLImportPropertyMapper( const_cast<OTableStylesContext*>(this)->GetOwnImport().GetCellStylesPropertySetMapper(), const_cast<SvXMLImport&>(GetImport()) ); xMapper = m_xCellImpPropMapper; } break; + default: break; } } @@ -198,7 +199,7 @@ rtl::Reference < SvXMLImportPropertyMapper > } SvXMLStyleContext *OTableStylesContext::CreateStyleStyleChildContext( - sal_uInt16 nFamily, sal_uInt16 nPrefix, const OUString& rLocalName, + XmlStyleFamily nFamily, sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< xml::sax::XAttributeList > & xAttrList ) { SvXMLStyleContext *pStyle = SvXMLStylesContext::CreateStyleStyleChildContext( nFamily, nPrefix, @@ -208,35 +209,36 @@ SvXMLStyleContext *OTableStylesContext::CreateStyleStyleChildContext( { switch( nFamily ) { - case XML_STYLE_FAMILY_TABLE_TABLE: - case XML_STYLE_FAMILY_TABLE_COLUMN: - case XML_STYLE_FAMILY_TABLE_CELL: + case XmlStyleFamily::TABLE_TABLE: + case XmlStyleFamily::TABLE_COLUMN: + case XmlStyleFamily::TABLE_CELL: pStyle = new OTableStyleContext( GetOwnImport(), nPrefix, rLocalName, xAttrList, *this, nFamily ); break; + default: break; } } return pStyle; } -OUString OTableStylesContext::GetServiceName( sal_uInt16 nFamily ) const +OUString OTableStylesContext::GetServiceName( XmlStyleFamily nFamily ) const { OUString sServiceName = SvXMLStylesContext::GetServiceName(nFamily); if (sServiceName.isEmpty()) { switch( nFamily ) { - case XML_STYLE_FAMILY_TABLE_TABLE: + case XmlStyleFamily::TABLE_TABLE: sServiceName = XML_STYLE_FAMILY_TABLE_TABLE_STYLES_NAME; break; - case XML_STYLE_FAMILY_TABLE_COLUMN: + case XmlStyleFamily::TABLE_COLUMN: sServiceName = XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_NAME; break; - case XML_STYLE_FAMILY_TABLE_CELL: + case XmlStyleFamily::TABLE_CELL: sServiceName = XML_STYLE_FAMILY_TABLE_CELL_STYLES_NAME; break; - + default: break; } } return sServiceName; @@ -248,14 +250,14 @@ sal_Int32 OTableStylesContext::GetIndex(const sal_Int16 nContextID) { if (m_nNumberFormatIndex == -1) m_nNumberFormatIndex = - GetImportPropertyMapper(XML_STYLE_FAMILY_TABLE_COLUMN)->getPropertySetMapper()->FindEntryIndex(nContextID); + GetImportPropertyMapper(XmlStyleFamily::TABLE_COLUMN)->getPropertySetMapper()->FindEntryIndex(nContextID); return m_nNumberFormatIndex; } else if ( nContextID == CTF_DB_MASTERPAGENAME ) { if (m_nMasterPageNameIndex == -1) m_nMasterPageNameIndex = - GetImportPropertyMapper(XML_STYLE_FAMILY_TABLE_TABLE)->getPropertySetMapper()->FindEntryIndex(nContextID); + GetImportPropertyMapper(XmlStyleFamily::TABLE_TABLE)->getPropertySetMapper()->FindEntryIndex(nContextID); return m_nMasterPageNameIndex; } else diff --git a/dbaccess/source/filter/xml/xmlStyleImport.hxx b/dbaccess/source/filter/xml/xmlStyleImport.hxx index 6d8b72069f39..41d083079cd0 100644 --- a/dbaccess/source/filter/xml/xmlStyleImport.hxx +++ b/dbaccess/source/filter/xml/xmlStyleImport.hxx @@ -57,7 +57,7 @@ namespace dbaxml OTableStyleContext( ODBFilter& 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 ~OTableStyleContext() override; @@ -85,7 +85,7 @@ namespace dbaxml // Create a style context. virtual SvXMLStyleContext *CreateStyleStyleChildContext( - sal_uInt16 nFamily, + XmlStyleFamily nFamily, sal_uInt16 nPrefix, const OUString& rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList ) override; @@ -102,8 +102,8 @@ namespace dbaxml virtual void EndElement() override; virtual rtl::Reference < SvXMLImportPropertyMapper > GetImportPropertyMapper( - sal_uInt16 nFamily ) const override; - virtual OUString GetServiceName( sal_uInt16 nFamily ) const override; + XmlStyleFamily nFamily ) const override; + virtual OUString GetServiceName( XmlStyleFamily nFamily ) const override; sal_Int32 GetIndex(const sal_Int16 nContextID); }; diff --git a/dbaccess/source/filter/xml/xmlTable.cxx b/dbaccess/source/filter/xml/xmlTable.cxx index 7d574d09565e..fd5d46437a1f 100644 --- a/dbaccess/source/filter/xml/xmlTable.cxx +++ b/dbaccess/source/filter/xml/xmlTable.cxx @@ -190,7 +190,7 @@ void OXMLTable::EndElement() const SvXMLStylesContext* pAutoStyles = GetOwnImport().GetAutoStyles(); if ( pAutoStyles ) { - OTableStyleContext* pAutoStyle = const_cast<OTableStyleContext*>(dynamic_cast< const OTableStyleContext* >(pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_TABLE_TABLE,m_sStyleName))); + OTableStyleContext* pAutoStyle = const_cast<OTableStyleContext*>(dynamic_cast< const OTableStyleContext* >(pAutoStyles->FindStyleChildContext(XmlStyleFamily::TABLE_TABLE,m_sStyleName))); if ( pAutoStyle ) { pAutoStyle->FillPropertySet(m_xTable); |