diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-02-14 16:53:39 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-02-15 07:02:36 +0100 |
commit | aa58c380894dd384f6ce1efc62b3932136f2f477 (patch) | |
tree | ca6af6905afd398da0541c71733393540ab8be2e /dbaccess | |
parent | 0cb4f304abf6f8dd6b40eb800788d2fe80581813 (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')
-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 50e56df9ef41..07dcc09ed7f8 100644 --- a/dbaccess/source/filter/xml/xmlColumn.cxx +++ b/dbaccess/source/filter/xml/xmlColumn.cxx @@ -124,7 +124,7 @@ void OXMLColumn::endFastElement(sal_Int32 ) 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); @@ -136,7 +136,7 @@ void OXMLColumn::endFastElement(sal_Int32 ) 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); @@ -153,7 +153,7 @@ void OXMLColumn::endFastElement(sal_Int32 ) 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 d88d0fa8b15e..20aac7489ede 100644 --- a/dbaccess/source/filter/xml/xmlExport.cxx +++ b/dbaccess/source/filter/xml/xmlExport.cxx @@ -235,25 +235,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 )); @@ -1134,15 +1134,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; @@ -1188,8 +1188,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) { @@ -1219,7 +1219,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 ) ); @@ -1247,10 +1247,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 50a1bbedcdd7..7027e0f0d4a2 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"); } @@ -159,7 +159,7 @@ void OTableStylesContext::EndElement() rtl::Reference < SvXMLImportPropertyMapper > OTableStylesContext::GetImportPropertyMapper( - sal_uInt16 nFamily ) const + XmlStyleFamily nFamily ) const { rtl::Reference < SvXMLImportPropertyMapper > xMapper = SvXMLStylesContext::GetImportPropertyMapper(nFamily); @@ -167,27 +167,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; } } @@ -195,7 +196,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, @@ -205,35 +206,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; @@ -245,14 +247,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 4d36a34eb82b..d0a1a4151d63 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; @@ -99,8 +99,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 77861056ce94..fb12f83f24ae 100644 --- a/dbaccess/source/filter/xml/xmlTable.cxx +++ b/dbaccess/source/filter/xml/xmlTable.cxx @@ -178,7 +178,7 @@ void OXMLTable::endFastElement(sal_Int32 ) 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); |