diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2023-01-15 13:43:31 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-01-15 12:32:29 +0000 |
commit | f2f008c52aaa88329c07f441de60d6fdfce9f0b3 (patch) | |
tree | e5676badaa6361adcc2b5d91e9f9cdc6aa645c1c /framework | |
parent | 9d2355b674d103fe8a73d2db716389980bb69e55 (diff) |
Merge SvXMLAttributeList to comphelper::AttributeList
And simplify the latter, to always use "CDATA" type (as the former did).
"CDATA" was used in all cases but one, where an empty string was used.
Change-Id: I1b3bfae40e29628e4094d9a6e58a69a66865874c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145526
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'framework')
-rw-r--r-- | framework/inc/acceleratorconst.h | 2 | ||||
-rw-r--r-- | framework/inc/xml/imagesdocumenthandler.hxx | 1 | ||||
-rw-r--r-- | framework/inc/xml/menudocumenthandler.hxx | 1 | ||||
-rw-r--r-- | framework/inc/xml/statusbardocumenthandler.hxx | 1 | ||||
-rw-r--r-- | framework/inc/xml/toolboxconfigurationdefines.hxx | 2 | ||||
-rw-r--r-- | framework/inc/xml/toolboxdocumenthandler.hxx | 1 | ||||
-rw-r--r-- | framework/source/fwe/xml/menudocumenthandler.cxx | 11 | ||||
-rw-r--r-- | framework/source/fwe/xml/saxnamespacefilter.cxx | 2 | ||||
-rw-r--r-- | framework/source/fwe/xml/statusbardocumenthandler.cxx | 17 | ||||
-rw-r--r-- | framework/source/fwe/xml/toolboxdocumenthandler.cxx | 9 | ||||
-rw-r--r-- | framework/source/xml/acceleratorconfigurationwriter.cxx | 16 | ||||
-rw-r--r-- | framework/source/xml/imagesdocumenthandler.cxx | 6 |
12 files changed, 11 insertions, 58 deletions
diff --git a/framework/inc/acceleratorconst.h b/framework/inc/acceleratorconst.h index 55f9435ffa51..ee45f8ef55a1 100644 --- a/framework/inc/acceleratorconst.h +++ b/framework/inc/acceleratorconst.h @@ -23,8 +23,6 @@ namespace framework{ -inline constexpr OUStringLiteral ATTRIBUTE_TYPE_CDATA = u"CDATA"; - // same items with a name space alias inline constexpr OUStringLiteral AL_ELEMENT_ACCELERATORLIST = u"accel:acceleratorlist"; inline constexpr OUStringLiteral AL_ELEMENT_ITEM = u"accel:item"; diff --git a/framework/inc/xml/imagesdocumenthandler.hxx b/framework/inc/xml/imagesdocumenthandler.hxx index d8cd84f4dfe4..ccdbe0e5b4cf 100644 --- a/framework/inc/xml/imagesdocumenthandler.hxx +++ b/framework/inc/xml/imagesdocumenthandler.hxx @@ -123,7 +123,6 @@ class OWriteImagesDocumentHandler final css::uno::Reference< css::xml::sax::XDocumentHandler > m_xWriteDocumentHandler; css::uno::Reference< css::xml::sax::XAttributeList > m_xEmptyList; OUString m_aXMLImageNS; - OUString m_aAttributeType; OUString m_aAttributeXlinkType; OUString m_aAttributeValueSimple; }; diff --git a/framework/inc/xml/menudocumenthandler.hxx b/framework/inc/xml/menudocumenthandler.hxx index f3a0238d0bd7..db72eb9171c2 100644 --- a/framework/inc/xml/menudocumenthandler.hxx +++ b/framework/inc/xml/menudocumenthandler.hxx @@ -213,7 +213,6 @@ class OWriteMenuDocumentHandler final css::uno::Reference< css::container::XIndexAccess > m_xMenuBarContainer; css::uno::Reference< css::xml::sax::XDocumentHandler > m_xWriteDocumentHandler; css::uno::Reference< css::xml::sax::XAttributeList > m_xEmptyList; - OUString m_aAttributeType; bool m_bIsMenuBar; }; diff --git a/framework/inc/xml/statusbardocumenthandler.hxx b/framework/inc/xml/statusbardocumenthandler.hxx index 829cd0b9745a..ba1ef7c364f8 100644 --- a/framework/inc/xml/statusbardocumenthandler.hxx +++ b/framework/inc/xml/statusbardocumenthandler.hxx @@ -125,7 +125,6 @@ class OWriteStatusBarDocumentHandler final css::uno::Reference< css::xml::sax::XAttributeList > m_xEmptyList; OUString m_aXMLStatusBarNS; OUString m_aXMLXlinkNS; - OUString m_aAttributeType; OUString m_aAttributeURL; }; diff --git a/framework/inc/xml/toolboxconfigurationdefines.hxx b/framework/inc/xml/toolboxconfigurationdefines.hxx index 399693044ec3..95a9c9802bc1 100644 --- a/framework/inc/xml/toolboxconfigurationdefines.hxx +++ b/framework/inc/xml/toolboxconfigurationdefines.hxx @@ -49,8 +49,6 @@ inline constexpr OUStringLiteral ELEMENT_NS_TOOLBARSEPARATOR = u"toolbar:toolbar inline constexpr OUStringLiteral ATTRIBUTE_XMLNS_TOOLBAR = u"xmlns:toolbar"; inline constexpr OUStringLiteral ATTRIBUTE_XMLNS_XLINK = u"xmlns:xlink"; -inline constexpr OUStringLiteral ATTRIBUTE_TYPE_CDATA = u"CDATA"; - #define ATTRIBUTE_BOOLEAN_TRUE "true" inline constexpr OUStringLiteral ATTRIBUTE_BOOLEAN_FALSE = u"false"; diff --git a/framework/inc/xml/toolboxdocumenthandler.hxx b/framework/inc/xml/toolboxdocumenthandler.hxx index 79657e5324e4..721d02936616 100644 --- a/framework/inc/xml/toolboxdocumenthandler.hxx +++ b/framework/inc/xml/toolboxdocumenthandler.hxx @@ -149,7 +149,6 @@ class OWriteToolBoxDocumentHandler final css::uno::Reference< css::container::XIndexAccess > m_rItemAccess; OUString m_aXMLToolbarNS; OUString m_aXMLXlinkNS; - OUString m_aAttributeType; OUString m_aAttributeURL; }; diff --git a/framework/source/fwe/xml/menudocumenthandler.cxx b/framework/source/fwe/xml/menudocumenthandler.cxx index cfb4e9f971c7..05b8d6257eff 100644 --- a/framework/source/fwe/xml/menudocumenthandler.cxx +++ b/framework/source/fwe/xml/menudocumenthandler.cxx @@ -64,8 +64,6 @@ constexpr OUStringLiteral ATTRIBUTE_NS_STYLE = u"menu:style"; constexpr OUStringLiteral ATTRIBUTE_XMLNS_MENU = u"xmlns:menu"; -constexpr OUStringLiteral ATTRIBUTE_TYPE_CDATA = u"CDATA"; - constexpr OUStringLiteral MENUBAR_DOCTYPE = u"<!DOCTYPE menu:menubar PUBLIC \"-//OpenOffice.org//DTD OfficeDocument 1.0//EN\" \"menubar.dtd\">"; #define ATTRIBUTE_ITEMSTYLE_TEXT "text" @@ -720,7 +718,6 @@ OWriteMenuDocumentHandler::OWriteMenuDocumentHandler( m_bIsMenuBar( bIsMenuBar ) { m_xEmptyList = new ::comphelper::AttributeList; - m_aAttributeType = ATTRIBUTE_TYPE_CDATA; } OWriteMenuDocumentHandler::~OWriteMenuDocumentHandler() @@ -742,12 +739,10 @@ void OWriteMenuDocumentHandler::WriteMenuDocument() } pList->AddAttribute( ATTRIBUTE_XMLNS_MENU, - m_aAttributeType, XMLNS_MENU ); if ( m_bIsMenuBar ) //FIXME pList->AddAttribute( ATTRIBUTE_NS_ID, - m_aAttributeType, "menubar" ); OUString aRootElement; @@ -793,12 +788,10 @@ void OWriteMenuDocumentHandler::WriteMenu( const Reference< XIndexAccess >& rMen rtl::Reference<::comphelper::AttributeList> pListMenu = new ::comphelper::AttributeList; pListMenu->AddAttribute( ATTRIBUTE_NS_ID, - m_aAttributeType, aCommandURL ); if ( !aLabel.isEmpty() ) pListMenu->AddAttribute( ATTRIBUTE_NS_LABEL, - m_aAttributeType, aLabel ); m_xWriteDocumentHandler->ignorableWhitespace( OUString() ); @@ -843,20 +836,17 @@ void OWriteMenuDocumentHandler::WriteMenuItem( const OUString& aCommandURL, cons rtl::Reference<::comphelper::AttributeList> pList = new ::comphelper::AttributeList; pList->AddAttribute( ATTRIBUTE_NS_ID, - m_aAttributeType, aCommandURL ); if ( !aHelpURL.isEmpty() ) { pList->AddAttribute( ATTRIBUTE_NS_HELPID, - m_aAttributeType, aHelpURL ); } if ( !aLabel.isEmpty() ) { pList->AddAttribute( ATTRIBUTE_NS_LABEL, - m_aAttributeType, aLabel ); } if ( nStyle > 0 ) @@ -874,7 +864,6 @@ void OWriteMenuDocumentHandler::WriteMenuItem( const OUString& aCommandURL, cons } } pList->AddAttribute( ATTRIBUTE_NS_STYLE, - m_aAttributeType, aValue.makeStringAndClear() ); } diff --git a/framework/source/fwe/xml/saxnamespacefilter.cxx b/framework/source/fwe/xml/saxnamespacefilter.cxx index ac1ff571c26a..b5349eb4887d 100644 --- a/framework/source/fwe/xml/saxnamespacefilter.cxx +++ b/framework/source/fwe/xml/saxnamespacefilter.cxx @@ -84,7 +84,7 @@ void SAL_CALL SaxNamespaceFilter::startElement( OUString aAttributeName = xAttribs->getNameByIndex(attributeIndex); OUString aValue = xAttribs->getValueByIndex(attributeIndex); OUString aNamespaceAttributeName = aXMLNamespaces.applyNSToAttributeName( aAttributeName ); - pNewList->AddAttribute( aNamespaceAttributeName, "CDATA", aValue ); + pNewList->AddAttribute(aNamespaceAttributeName, aValue); } } catch ( SAXException& e ) diff --git a/framework/source/fwe/xml/statusbardocumenthandler.cxx b/framework/source/fwe/xml/statusbardocumenthandler.cxx index 3786e2fbd298..09d42e9257f3 100644 --- a/framework/source/fwe/xml/statusbardocumenthandler.cxx +++ b/framework/source/fwe/xml/statusbardocumenthandler.cxx @@ -64,8 +64,6 @@ constexpr OUStringLiteral ELEMENT_NS_STATUSBARITEM = u"statusbar:statusbaritem"; constexpr OUStringLiteral ATTRIBUTE_XMLNS_STATUSBAR = u"xmlns:statusbar"; constexpr OUStringLiteral ATTRIBUTE_XMLNS_XLINK = u"xmlns:xlink"; -constexpr OUStringLiteral ATTRIBUTE_TYPE_CDATA = u"CDATA"; - constexpr OUStringLiteral ATTRIBUTE_BOOLEAN_TRUE = u"true"; constexpr OUStringLiteral ATTRIBUTE_BOOLEAN_FALSE = u"false"; @@ -461,7 +459,6 @@ OWriteStatusBarDocumentHandler::OWriteStatusBarDocumentHandler( m_xWriteDocumentHandler( rWriteDocumentHandler ) { m_xEmptyList = new ::comphelper::AttributeList; - m_aAttributeType = ATTRIBUTE_TYPE_CDATA; m_aXMLXlinkNS = XMLNS_XLINK_PREFIX; m_aXMLStatusBarNS = XMLNS_STATUSBAR_PREFIX; } @@ -485,11 +482,9 @@ void OWriteStatusBarDocumentHandler::WriteStatusBarDocument() rtl::Reference<::comphelper::AttributeList> pList = new ::comphelper::AttributeList; pList->AddAttribute( ATTRIBUTE_XMLNS_STATUSBAR, - m_aAttributeType, XMLNS_STATUSBAR ); pList->AddAttribute( ATTRIBUTE_XMLNS_XLINK, - m_aAttributeType, XMLNS_XLINK ); m_xWriteDocumentHandler->startElement( ELEMENT_NS_STATUSBAR, pList ); @@ -545,25 +540,22 @@ void OWriteStatusBarDocumentHandler::WriteStatusBarItem( } // save required attribute (URL) - pList->AddAttribute( m_aAttributeURL, m_aAttributeType, rCommandURL ); + pList->AddAttribute( m_aAttributeURL, rCommandURL ); // alignment if ( nStyle & ItemStyle::ALIGN_RIGHT ) { pList->AddAttribute( m_aXMLStatusBarNS + ATTRIBUTE_ALIGN, - m_aAttributeType, ATTRIBUTE_ALIGN_RIGHT ); } else if ( nStyle & ItemStyle::ALIGN_CENTER ) { pList->AddAttribute( m_aXMLStatusBarNS + ATTRIBUTE_ALIGN, - m_aAttributeType, ATTRIBUTE_ALIGN_CENTER ); } else { pList->AddAttribute( m_aXMLStatusBarNS + ATTRIBUTE_ALIGN, - m_aAttributeType, ATTRIBUTE_ALIGN_LEFT ); } @@ -571,13 +563,11 @@ void OWriteStatusBarDocumentHandler::WriteStatusBarItem( if ( nStyle & ItemStyle::DRAW_FLAT ) { pList->AddAttribute( m_aXMLStatusBarNS + ATTRIBUTE_STYLE, - m_aAttributeType, ATTRIBUTE_STYLE_FLAT ); } else if ( nStyle & ItemStyle::DRAW_OUT3D ) { pList->AddAttribute( m_aXMLStatusBarNS + ATTRIBUTE_STYLE, - m_aAttributeType, ATTRIBUTE_STYLE_OUT ); } @@ -585,7 +575,6 @@ void OWriteStatusBarDocumentHandler::WriteStatusBarItem( if ( nStyle & ItemStyle::AUTO_SIZE ) { pList->AddAttribute( m_aXMLStatusBarNS + ATTRIBUTE_AUTOSIZE, - m_aAttributeType, ATTRIBUTE_BOOLEAN_TRUE ); } @@ -593,7 +582,6 @@ void OWriteStatusBarDocumentHandler::WriteStatusBarItem( if ( nStyle & ItemStyle::OWNER_DRAW ) { pList->AddAttribute( m_aXMLStatusBarNS + ATTRIBUTE_OWNERDRAW, - m_aAttributeType, ATTRIBUTE_BOOLEAN_TRUE ); } @@ -601,7 +589,6 @@ void OWriteStatusBarDocumentHandler::WriteStatusBarItem( if ( nWidth > 0 ) { pList->AddAttribute( m_aXMLStatusBarNS + ATTRIBUTE_WIDTH, - m_aAttributeType, OUString::number( nWidth ) ); } @@ -609,7 +596,6 @@ void OWriteStatusBarDocumentHandler::WriteStatusBarItem( if ( nOffset != STATUSBAR_OFFSET ) { pList->AddAttribute( m_aXMLStatusBarNS + ATTRIBUTE_OFFSET, - m_aAttributeType, OUString::number( nOffset ) ); } @@ -617,7 +603,6 @@ void OWriteStatusBarDocumentHandler::WriteStatusBarItem( if ( !( nStyle & ItemStyle::MANDATORY ) ) { pList->AddAttribute( m_aXMLStatusBarNS + ATTRIBUTE_MANDATORY, - m_aAttributeType, ATTRIBUTE_BOOLEAN_FALSE ); } diff --git a/framework/source/fwe/xml/toolboxdocumenthandler.cxx b/framework/source/fwe/xml/toolboxdocumenthandler.cxx index 62202dea611f..28005b3172ff 100644 --- a/framework/source/fwe/xml/toolboxdocumenthandler.cxx +++ b/framework/source/fwe/xml/toolboxdocumenthandler.cxx @@ -563,7 +563,6 @@ OWriteToolBoxDocumentHandler::OWriteToolBoxDocumentHandler( m_rItemAccess( rItemAccess ) { m_xEmptyList = new ::comphelper::AttributeList; - m_aAttributeType = ATTRIBUTE_TYPE_CDATA; m_aXMLXlinkNS = XMLNS_XLINK_PREFIX; m_aXMLToolbarNS = XMLNS_TOOLBAR_PREFIX; } @@ -600,16 +599,13 @@ void OWriteToolBoxDocumentHandler::WriteToolBoxDocument() rtl::Reference<::comphelper::AttributeList> pList = new ::comphelper::AttributeList; pList->AddAttribute( ATTRIBUTE_XMLNS_TOOLBAR, - m_aAttributeType, XMLNS_TOOLBAR ); pList->AddAttribute( ATTRIBUTE_XMLNS_XLINK, - m_aAttributeType, XMLNS_XLINK ); if ( !aUIName.isEmpty() ) pList->AddAttribute( m_aXMLToolbarNS + ATTRIBUTE_UINAME, - m_aAttributeType, aUIName ); m_xWriteDocumentHandler->startElement( ELEMENT_NS_TOOLBAR, pList ); @@ -664,19 +660,17 @@ void OWriteToolBoxDocumentHandler::WriteToolBoxItem( } // save required attribute (URL) - pList->AddAttribute( m_aAttributeURL, m_aAttributeType, rCommandURL ); + pList->AddAttribute( m_aAttributeURL, rCommandURL ); if ( !rLabel.isEmpty() ) { pList->AddAttribute( m_aXMLToolbarNS + ATTRIBUTE_TEXT, - m_aAttributeType, rLabel ); } if ( !bVisible ) { pList->AddAttribute( m_aXMLToolbarNS + ATTRIBUTE_VISIBLE, - m_aAttributeType, ATTRIBUTE_BOOLEAN_FALSE ); } @@ -695,7 +689,6 @@ void OWriteToolBoxDocumentHandler::WriteToolBoxItem( } } pList->AddAttribute( m_aXMLToolbarNS + ATTRIBUTE_ITEMSTYLE, - m_aAttributeType, aValue.makeStringAndClear() ); } diff --git a/framework/source/xml/acceleratorconfigurationwriter.cxx b/framework/source/xml/acceleratorconfigurationwriter.cxx index 04e50f5ae6a7..645fd479c329 100644 --- a/framework/source/xml/acceleratorconfigurationwriter.cxx +++ b/framework/source/xml/acceleratorconfigurationwriter.cxx @@ -52,10 +52,10 @@ void AcceleratorConfigurationWriter::flush() rtl::Reference<::comphelper::AttributeList> pAttribs = new ::comphelper::AttributeList; pAttribs->AddAttribute( - "xmlns:accel", ATTRIBUTE_TYPE_CDATA, + "xmlns:accel", "http://openoffice.org/2001/accel"); pAttribs->AddAttribute( - "xmlns:xlink", ATTRIBUTE_TYPE_CDATA, "http://www.w3.org/1999/xlink"); + "xmlns:xlink", "http://www.w3.org/1999/xlink"); // generate xml xExtendedCFG->startDocument(); @@ -96,20 +96,20 @@ void AcceleratorConfigurationWriter::impl_ts_writeKeyCommandPair(const css::awt: OUString sKey = KeyMapping::get().mapCodeToIdentifier(aKey.KeyCode); // TODO check if key is empty! - pAttribs->AddAttribute("accel:code", ATTRIBUTE_TYPE_CDATA, sKey ); - pAttribs->AddAttribute("xlink:href", ATTRIBUTE_TYPE_CDATA, sCommand); + pAttribs->AddAttribute("accel:code", sKey ); + pAttribs->AddAttribute("xlink:href", sCommand); if ((aKey.Modifiers & css::awt::KeyModifier::SHIFT) == css::awt::KeyModifier::SHIFT) - pAttribs->AddAttribute("accel:shift", ATTRIBUTE_TYPE_CDATA, "true"); + pAttribs->AddAttribute("accel:shift", "true"); if ((aKey.Modifiers & css::awt::KeyModifier::MOD1) == css::awt::KeyModifier::MOD1) - pAttribs->AddAttribute("accel:mod1", ATTRIBUTE_TYPE_CDATA, "true"); + pAttribs->AddAttribute("accel:mod1", "true"); if ((aKey.Modifiers & css::awt::KeyModifier::MOD2) == css::awt::KeyModifier::MOD2) - pAttribs->AddAttribute("accel:mod2", ATTRIBUTE_TYPE_CDATA, "true"); + pAttribs->AddAttribute("accel:mod2", "true"); if ((aKey.Modifiers & css::awt::KeyModifier::MOD3) == css::awt::KeyModifier::MOD3) - pAttribs->AddAttribute("accel:mod3", ATTRIBUTE_TYPE_CDATA, "true"); + pAttribs->AddAttribute("accel:mod3", "true"); xConfig->ignorableWhitespace(OUString()); xConfig->startElement(AL_ELEMENT_ITEM, pAttribs); diff --git a/framework/source/xml/imagesdocumenthandler.cxx b/framework/source/xml/imagesdocumenthandler.cxx index ebdd5366f240..962c0a8bbd0e 100644 --- a/framework/source/xml/imagesdocumenthandler.cxx +++ b/framework/source/xml/imagesdocumenthandler.cxx @@ -48,7 +48,6 @@ constexpr OUStringLiteral ELEMENT_NS_ENTRY = u"image:entry"; #define ATTRIBUTE_MASKMODE "maskmode" #define ATTRIBUTE_HIGHCONTRASTURL "highcontrasturl" #define ATTRIBUTE_HIGHCONTRASTMASKURL "highcontrastmaskurl" -constexpr OUStringLiteral ATTRIBUTE_TYPE_CDATA = u"CDATA"; constexpr OUStringLiteral ATTRIBUTE_XMLNS_IMAGE = u"xmlns:image"; constexpr OUStringLiteral ATTRIBUTE_XMLNS_XLINK = u"xmlns:xlink"; @@ -288,7 +287,6 @@ OWriteImagesDocumentHandler::OWriteImagesDocumentHandler( m_xWriteDocumentHandler( rWriteDocumentHandler ) { m_xEmptyList = new ::comphelper::AttributeList; - m_aAttributeType = ATTRIBUTE_TYPE_CDATA; m_aXMLImageNS = XMLNS_IMAGE_PREFIX; m_aAttributeXlinkType = ATTRIBUTE_XLINK_TYPE; m_aAttributeValueSimple = ATTRIBUTE_XLINK_TYPE_VALUE; @@ -313,11 +311,9 @@ void OWriteImagesDocumentHandler::WriteImagesDocument() rtl::Reference<::comphelper::AttributeList> pList = new ::comphelper::AttributeList; pList->AddAttribute( ATTRIBUTE_XMLNS_IMAGE, - m_aAttributeType, XMLNS_IMAGE ); pList->AddAttribute( ATTRIBUTE_XMLNS_XLINK, - m_aAttributeType, XMLNS_XLINK ); m_xWriteDocumentHandler->startElement( ELEMENT_NS_IMAGESCONTAINER, pList ); @@ -339,7 +335,6 @@ void OWriteImagesDocumentHandler::WriteImageList( const ImageItemDescriptorList* // save required attributes pList->AddAttribute( m_aAttributeXlinkType, - m_aAttributeType, m_aAttributeValueSimple ); m_xWriteDocumentHandler->startElement( ELEMENT_NS_IMAGES, pList ); @@ -357,7 +352,6 @@ void OWriteImagesDocumentHandler::WriteImage( const ImageItemDescriptor* pImage rtl::Reference<::comphelper::AttributeList> pList = new ::comphelper::AttributeList; pList->AddAttribute( m_aXMLImageNS + ATTRIBUTE_COMMAND, - m_aAttributeType, pImage->aCommandURL ); m_xWriteDocumentHandler->startElement( ELEMENT_NS_ENTRY, pList ); |