diff options
Diffstat (limited to 'framework/source/fwe/xml/menudocumenthandler.cxx')
-rw-r--r-- | framework/source/fwe/xml/menudocumenthandler.cxx | 68 |
1 files changed, 28 insertions, 40 deletions
diff --git a/framework/source/fwe/xml/menudocumenthandler.cxx b/framework/source/fwe/xml/menudocumenthandler.cxx index f265f9260828..96e4b2324ba8 100644 --- a/framework/source/fwe/xml/menudocumenthandler.cxx +++ b/framework/source/fwe/xml/menudocumenthandler.cxx @@ -40,32 +40,30 @@ constexpr OUStringLiteral XMLNS_MENU = u"http://openoffice.org/2001/menu"; -constexpr OUStringLiteral ELEMENT_MENUBAR = u"http://openoffice.org/2001/menu^menubar"; -constexpr OUStringLiteral ELEMENT_MENU = u"http://openoffice.org/2001/menu^menu"; -constexpr OUStringLiteral ELEMENT_MENUPOPUP = u"http://openoffice.org/2001/menu^menupopup"; -constexpr OUStringLiteral ELEMENT_MENUITEM = u"http://openoffice.org/2001/menu^menuitem"; -constexpr OUStringLiteral ELEMENT_MENUSEPARATOR = u"http://openoffice.org/2001/menu^menuseparator"; +constexpr OUString ELEMENT_MENUBAR = u"http://openoffice.org/2001/menu^menubar"_ustr; +constexpr OUString ELEMENT_MENU = u"http://openoffice.org/2001/menu^menu"_ustr; +constexpr OUString ELEMENT_MENUPOPUP = u"http://openoffice.org/2001/menu^menupopup"_ustr; +constexpr OUString ELEMENT_MENUITEM = u"http://openoffice.org/2001/menu^menuitem"_ustr; +constexpr OUString ELEMENT_MENUSEPARATOR = u"http://openoffice.org/2001/menu^menuseparator"_ustr; constexpr OUStringLiteral ELEMENT_NS_MENUBAR = u"menu:menubar"; -constexpr OUStringLiteral ELEMENT_NS_MENU = u"menu:menu"; -constexpr OUStringLiteral ELEMENT_NS_MENUPOPUP = u"menu:menupopup"; -constexpr OUStringLiteral ELEMENT_NS_MENUITEM = u"menu:menuitem"; -constexpr OUStringLiteral ELEMENT_NS_MENUSEPARATOR = u"menu:menuseparator"; - -constexpr OUStringLiteral ATTRIBUTE_ID = u"http://openoffice.org/2001/menu^id"; -constexpr OUStringLiteral ATTRIBUTE_LABEL = u"http://openoffice.org/2001/menu^label"; -constexpr OUStringLiteral ATTRIBUTE_HELPID = u"http://openoffice.org/2001/menu^helpid"; -constexpr OUStringLiteral ATTRIBUTE_STYLE = u"http://openoffice.org/2001/menu^style"; - -constexpr OUStringLiteral ATTRIBUTE_NS_ID = u"menu:id"; -constexpr OUStringLiteral ATTRIBUTE_NS_LABEL = u"menu:label"; +constexpr OUString ELEMENT_NS_MENU = u"menu:menu"_ustr; +constexpr OUString ELEMENT_NS_MENUPOPUP = u"menu:menupopup"_ustr; +constexpr OUString ELEMENT_NS_MENUITEM = u"menu:menuitem"_ustr; +constexpr OUString ELEMENT_NS_MENUSEPARATOR = u"menu:menuseparator"_ustr; + +constexpr OUString ATTRIBUTE_ID = u"http://openoffice.org/2001/menu^id"_ustr; +constexpr OUString ATTRIBUTE_LABEL = u"http://openoffice.org/2001/menu^label"_ustr; +constexpr OUString ATTRIBUTE_HELPID = u"http://openoffice.org/2001/menu^helpid"_ustr; +constexpr OUString ATTRIBUTE_STYLE = u"http://openoffice.org/2001/menu^style"_ustr; + +constexpr OUString ATTRIBUTE_NS_ID = u"menu:id"_ustr; +constexpr OUString ATTRIBUTE_NS_LABEL = u"menu:label"_ustr; constexpr OUStringLiteral ATTRIBUTE_NS_HELPID = u"menu:helpid"; 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" @@ -73,12 +71,12 @@ constexpr OUStringLiteral MENUBAR_DOCTYPE = u"<!DOCTYPE menu:menubar PUBLIC \"-/ #define ATTRIBUTE_ITEMSTYLE_RADIO "radio" // Property names of a menu/menu item ItemDescriptor -constexpr OUStringLiteral ITEM_DESCRIPTOR_COMMANDURL = u"CommandURL"; -constexpr OUStringLiteral ITEM_DESCRIPTOR_HELPURL = u"HelpURL"; -constexpr OUStringLiteral ITEM_DESCRIPTOR_CONTAINER = u"ItemDescriptorContainer"; -constexpr OUStringLiteral ITEM_DESCRIPTOR_LABEL = u"Label"; -constexpr OUStringLiteral ITEM_DESCRIPTOR_TYPE = u"Type"; -constexpr OUStringLiteral ITEM_DESCRIPTOR_STYLE = u"Style"; +constexpr OUString ITEM_DESCRIPTOR_COMMANDURL = u"CommandURL"_ustr; +constexpr OUString ITEM_DESCRIPTOR_HELPURL = u"HelpURL"_ustr; +constexpr OUString ITEM_DESCRIPTOR_CONTAINER = u"ItemDescriptorContainer"_ustr; +constexpr OUString ITEM_DESCRIPTOR_LABEL = u"Label"_ustr; +constexpr OUString ITEM_DESCRIPTOR_TYPE = u"Type"_ustr; +constexpr OUString ITEM_DESCRIPTOR_STYLE = u"Style"_ustr; // using namespaces @@ -123,7 +121,6 @@ static void ExtractMenuParameters( const Sequence< PropertyValue >& rProp, if ( p.Name == ITEM_DESCRIPTOR_COMMANDURL ) { p.Value >>= rCommandURL; - rCommandURL = rCommandURL.intern(); } else if ( p.Name == ITEM_DESCRIPTOR_HELPURL ) { @@ -202,7 +199,7 @@ void ReadMenuDocumentHandlerBase::initPropertyCommon( pProps[5].Name = m_aType; // Common values - pProps[0].Value <<= rCommandURL.intern(); + pProps[0].Value <<= rCommandURL; pProps[1].Value <<= rHelpId; pProps[2].Value <<= Reference< XIndexContainer >(); pProps[3].Value <<= rLabel; @@ -381,7 +378,7 @@ void SAL_CALL OReadMenuBarHandler::startElement( initPropertyCommon( aSubMenuProp, aCommandId, aHelpId, aLabel, nItemBits ); aSubMenuProp.getArray()[2].Value <<= xSubItemContainer; - m_xMenuBarContainer->insertByIndex( m_xMenuBarContainer->getCount(), makeAny( aSubMenuProp ) ); + m_xMenuBarContainer->insertByIndex( m_xMenuBarContainer->getCount(), Any( aSubMenuProp ) ); } else { @@ -582,7 +579,7 @@ void SAL_CALL OReadMenuPopupHandler::startElement( initPropertyCommon( aSubMenuProp, aCommandId, aHelpId, aLabel, nItemBits ); aSubMenuProp.getArray()[2].Value <<= xSubItemContainer; - m_xMenuContainer->insertByIndex( m_xMenuContainer->getCount(), makeAny( aSubMenuProp ) ); + m_xMenuContainer->insertByIndex( m_xMenuContainer->getCount(), Any( aSubMenuProp ) ); } else { @@ -638,7 +635,7 @@ void SAL_CALL OReadMenuPopupHandler::startElement( initPropertyCommon( aMenuItem, aCommandId, aHelpId, aLabel, nItemBits ); aMenuItem.getArray()[2].Value <<= Reference< XIndexContainer >(); - m_xMenuContainer->insertByIndex( m_xMenuContainer->getCount(), makeAny( aMenuItem ) ); + m_xMenuContainer->insertByIndex( m_xMenuContainer->getCount(), Any( aMenuItem ) ); } m_nNextElementExpected = ELEM_CLOSE_MENUITEM; @@ -648,7 +645,7 @@ void SAL_CALL OReadMenuPopupHandler::startElement( Sequence< PropertyValue > aMenuSeparator{ comphelper::makePropertyValue( ITEM_DESCRIPTOR_TYPE, css::ui::ItemType::SEPARATOR_LINE) }; - m_xMenuContainer->insertByIndex( m_xMenuContainer->getCount(), makeAny( aMenuSeparator ) ); + m_xMenuContainer->insertByIndex( m_xMenuContainer->getCount(), Any( aMenuSeparator ) ); m_nNextElementExpected = ELEM_CLOSE_MENUSEPARATOR; } @@ -720,7 +717,6 @@ OWriteMenuDocumentHandler::OWriteMenuDocumentHandler( m_bIsMenuBar( bIsMenuBar ) { m_xEmptyList = new ::comphelper::AttributeList; - m_aAttributeType = ATTRIBUTE_TYPE_CDATA; } OWriteMenuDocumentHandler::~OWriteMenuDocumentHandler() @@ -742,12 +738,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 +787,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 +835,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 +863,6 @@ void OWriteMenuDocumentHandler::WriteMenuItem( const OUString& aCommandURL, cons } } pList->AddAttribute( ATTRIBUTE_NS_STYLE, - m_aAttributeType, aValue.makeStringAndClear() ); } |