summaryrefslogtreecommitdiff
path: root/framework/source/fwe
diff options
context:
space:
mode:
Diffstat (limited to 'framework/source/fwe')
-rw-r--r--framework/source/fwe/classes/actiontriggercontainer.cxx8
-rw-r--r--framework/source/fwe/classes/actiontriggerpropertyset.cxx3
-rw-r--r--framework/source/fwe/classes/actiontriggerseparatorpropertyset.cxx1
-rw-r--r--framework/source/fwe/classes/addonmenu.cxx17
-rw-r--r--framework/source/fwe/classes/addonsoptions.cxx432
-rw-r--r--framework/source/fwe/classes/framelistanalyzer.cxx2
-rw-r--r--framework/source/fwe/classes/imagewrapper.cxx86
-rw-r--r--framework/source/fwe/classes/rootactiontriggercontainer.cxx51
-rw-r--r--framework/source/fwe/classes/sfxhelperfunctions.cxx27
-rw-r--r--framework/source/fwe/dispatch/interaction.cxx5
-rw-r--r--framework/source/fwe/helper/actiontriggerhelper.cxx107
-rw-r--r--framework/source/fwe/helper/documentundoguard.cxx70
-rw-r--r--framework/source/fwe/helper/propertysetcontainer.cxx14
-rw-r--r--framework/source/fwe/helper/titlehelper.cxx226
-rw-r--r--framework/source/fwe/helper/undomanagerhelper.cxx137
-rw-r--r--framework/source/fwe/xml/menuconfiguration.cxx7
-rw-r--r--framework/source/fwe/xml/menudocumenthandler.cxx104
-rw-r--r--framework/source/fwe/xml/saxnamespacefilter.cxx2
-rw-r--r--framework/source/fwe/xml/statusbarconfiguration.cxx1
-rw-r--r--framework/source/fwe/xml/statusbardocumenthandler.cxx96
-rw-r--r--framework/source/fwe/xml/toolboxconfiguration.cxx1
-rw-r--r--framework/source/fwe/xml/toolboxdocumenthandler.cxx124
22 files changed, 666 insertions, 855 deletions
diff --git a/framework/source/fwe/classes/actiontriggercontainer.cxx b/framework/source/fwe/classes/actiontriggercontainer.cxx
index e6675cf17c96..360223e6eb67 100644
--- a/framework/source/fwe/classes/actiontriggercontainer.cxx
+++ b/framework/source/fwe/classes/actiontriggercontainer.cxx
@@ -87,11 +87,9 @@ Reference< XInterface > SAL_CALL ActionTriggerContainer::createInstanceWithArgum
Sequence< OUString > SAL_CALL ActionTriggerContainer::getAvailableServiceNames()
{
- Sequence< OUString > aSeq( 3 );
-
- aSeq[0] = SERVICENAME_ACTIONTRIGGER;
- aSeq[1] = SERVICENAME_ACTIONTRIGGERCONTAINER;
- aSeq[2] = SERVICENAME_ACTIONTRIGGERSEPARATOR;
+ Sequence< OUString > aSeq{ SERVICENAME_ACTIONTRIGGER,
+ SERVICENAME_ACTIONTRIGGERCONTAINER,
+ SERVICENAME_ACTIONTRIGGERSEPARATOR };
return aSeq;
}
diff --git a/framework/source/fwe/classes/actiontriggerpropertyset.cxx b/framework/source/fwe/classes/actiontriggerpropertyset.cxx
index 4592174df5ad..36790f9d7aa1 100644
--- a/framework/source/fwe/classes/actiontriggerpropertyset.cxx
+++ b/framework/source/fwe/classes/actiontriggerpropertyset.cxx
@@ -264,6 +264,7 @@ Sequence< Property > ActionTriggerPropertySet::impl_getStaticPropertyDescriptor(
};
}
+// static
bool ActionTriggerPropertySet::impl_tryToChangeProperty(
const OUString& sCurrentValue ,
const Any& aNewValue ,
@@ -298,6 +299,7 @@ bool ActionTriggerPropertySet::impl_tryToChangeProperty(
return bReturn;
}
+// static
bool ActionTriggerPropertySet::impl_tryToChangeProperty(
const Reference< XBitmap >& aCurrentValue ,
const Any& aNewValue ,
@@ -332,6 +334,7 @@ bool ActionTriggerPropertySet::impl_tryToChangeProperty(
return bReturn;
}
+// static
bool ActionTriggerPropertySet::impl_tryToChangeProperty(
const Reference< XInterface >& aCurrentValue ,
const Any& aNewValue ,
diff --git a/framework/source/fwe/classes/actiontriggerseparatorpropertyset.cxx b/framework/source/fwe/classes/actiontriggerseparatorpropertyset.cxx
index 104d765f5ca3..2f46ae5f0579 100644
--- a/framework/source/fwe/classes/actiontriggerseparatorpropertyset.cxx
+++ b/framework/source/fwe/classes/actiontriggerseparatorpropertyset.cxx
@@ -206,6 +206,7 @@ Sequence< Property > ActionTriggerSeparatorPropertySet::impl_getStaticPropertyDe
};
}
+// static
bool ActionTriggerSeparatorPropertySet::impl_tryToChangeProperty(
sal_Int16 aCurrentValue ,
const Any& aNewValue ,
diff --git a/framework/source/fwe/classes/addonmenu.cxx b/framework/source/fwe/classes/addonmenu.cxx
index 582460a0ed2c..db6a7435ac14 100644
--- a/framework/source/fwe/classes/addonmenu.cxx
+++ b/framework/source/fwe/classes/addonmenu.cxx
@@ -124,9 +124,9 @@ void AddonMenuManager::MergeAddonHelpMenu( const Reference< XFrame >& rFrame,
{
nInsSepAfterPos += ( pHelpMenu->GetItemCount() - nItemCount );
if ( pHelpMenu->GetItemType( nInsSepAfterPos ) != MenuItemType::SEPARATOR )
- pHelpMenu->InsertSeparator(OString(), nInsSepAfterPos);
+ pHelpMenu->InsertSeparator({}, nInsSepAfterPos);
}
- pHelpMenu->InsertSeparator(OString(), nItemCount);
+ pHelpMenu->InsertSeparator({}, nItemCount);
}
}
@@ -171,7 +171,7 @@ void AddonMenuManager::MergeAddonPopupMenus( const Reference< XFrame >& rFrame,
if ( pAddonPopupMenu->GetItemCount() > 0 )
{
- pMergeMenuBar->InsertItem( nId, aTitle, MenuItemBits::NONE, OString(), nInsertPos++ );
+ pMergeMenuBar->InsertItem( nId, aTitle, MenuItemBits::NONE, {}, nInsertPos++);
pMergeMenuBar->SetPopupMenu( nId, pAddonPopupMenu );
// Store the command URL into the VCL menu bar for later identification
@@ -233,12 +233,12 @@ void AddonMenuManager::BuildMenu( PopupMenu* pCurrent
// have already one before us
nElements = 0;
bInsertSeparator = false;
- pCurrentMenu->InsertSeparator(OString(), nInsPos);
+ pCurrentMenu->InsertSeparator({}, nInsPos);
nInsPos = AddonMenuManager::GetNextPos( nInsPos );
}
sal_uInt16 nId = nUniqueMenuId++;
- pCurrentMenu->InsertItem(nId, aTitle, MenuItemBits::NONE, OString(), nInsPos);
+ pCurrentMenu->InsertItem(nId, aTitle, MenuItemBits::NONE, {}, nInsPos);
nInsPos = AddonMenuManager::GetNextPos( nInsPos );
++nElements;
@@ -281,15 +281,14 @@ void AddonMenuManager::GetMenuEntry( const Sequence< PropertyValue >& rAddonMenu
}
// Check if the context string matches the provided xModel context
-bool AddonMenuManager::IsCorrectContext( std::u16string_view rModuleIdentifier, const OUString& rContext )
+bool AddonMenuManager::IsCorrectContext( std::u16string_view rModuleIdentifier, std::u16string_view rContext )
{
- if ( rContext.isEmpty() )
+ if ( rContext.empty() )
return true;
if ( !rModuleIdentifier.empty() )
{
- sal_Int32 nIndex = rContext.indexOf( rModuleIdentifier );
- return ( nIndex >= 0 );
+ return rContext.find( rModuleIdentifier ) != std::u16string_view::npos;
}
return false;
diff --git a/framework/source/fwe/classes/addonsoptions.cxx b/framework/source/fwe/classes/addonsoptions.cxx
index cd638a979522..6f9dc8d87130 100644
--- a/framework/source/fwe/classes/addonsoptions.cxx
+++ b/framework/source/fwe/classes/addonsoptions.cxx
@@ -43,7 +43,6 @@
// namespaces
-using namespace ::std;
using namespace ::utl;
using namespace ::osl;
using namespace ::com::sun::star::uno;
@@ -53,7 +52,7 @@ using namespace ::com::sun::star;
constexpr OUStringLiteral ROOTNODE_ADDONMENU = u"Office.Addons";
constexpr OUStringLiteral PATHDELIMITER = u"/";
-constexpr OUStringLiteral SEPARATOR_URL = u"private:separator";
+constexpr OUString SEPARATOR_URL = u"private:separator"_ustr;
#define PROPERTYNAME_URL ADDONSMENUITEM_STRING_URL
#define PROPERTYNAME_TITLE ADDONSMENUITEM_STRING_TITLE
@@ -296,16 +295,16 @@ class AddonsOptions_Impl : public ConfigItem
void ReadMergeStatusbarData( std::u16string_view aMergeAddonInstructionBase, Sequence< Sequence< PropertyValue > >& rMergeStatusbar );
bool ReadMenuItem( std::u16string_view aMenuItemNodeName, Sequence< PropertyValue >& aMenuItem, bool bIgnoreSubMenu = false );
bool ReadPopupMenu( std::u16string_view aPopupMenuNodeName, Sequence< PropertyValue >& aPopupMenu );
- void AppendPopupMenu( Sequence< PropertyValue >& aTargetPopupMenu, const Sequence< PropertyValue >& rSourcePopupMenu );
+ static void AppendPopupMenu( Sequence< PropertyValue >& aTargetPopupMenu, const Sequence< PropertyValue >& rSourcePopupMenu );
bool ReadToolBarItem( std::u16string_view aToolBarItemNodeName, Sequence< PropertyValue >& aToolBarItem );
bool ReadNotebookBarItem( std::u16string_view aNotebookBarItemNodeName, Sequence< PropertyValue >& aNotebookBarItem );
bool ReadStatusBarItem( std::u16string_view aStatusbarItemNodeName, Sequence< PropertyValue >& aStatusbarItem );
std::unique_ptr<ImageEntry> ReadImageData( std::u16string_view aImagesNodeName );
void ReadAndAssociateImages( const OUString& aURL, const OUString& aImageId );
- BitmapEx ReadImageFromURL( const OUString& aURL );
+ static BitmapEx ReadImageFromURL( const OUString& aURL );
bool HasAssociatedImages( const OUString& aURL );
- void SubstituteVariables( OUString& aURL );
+ static void SubstituteVariables( OUString& aURL );
void ReadSubMenuEntries( const Sequence< OUString >& aSubMenuNodeNames, Sequence< Sequence< PropertyValue > >& rSubMenu );
OUString GeneratePrefixURL();
@@ -320,7 +319,7 @@ class AddonsOptions_Impl : public ConfigItem
Sequence< OUString > GetPropertyNamesStatusbarItem( std::u16string_view aPropertyRootNode ) const;
Sequence< OUString > GetPropertyNamesImages( std::u16string_view aPropertyRootNode ) const;
- bool CreateImageFromSequence( BitmapEx& rImage, Sequence< sal_Int8 >& rBitmapDataSeq ) const;
+ static bool CreateImageFromSequence( BitmapEx& rImage, Sequence< sal_Int8 >& rBitmapDataSeq );
DECL_LINK(NotifyEvent, void*, void);
@@ -655,14 +654,14 @@ void AddonsOptions_Impl::ReadAddonMenuSet( Sequence< Sequence< PropertyValue > >
sal_uInt32 nCount = aAddonMenuNodeSeq.getLength();
sal_uInt32 nIndex = 0;
Sequence< PropertyValue > aMenuItem( PROPERTYCOUNT_MENUITEM );
-
+ auto pMenuItem = aMenuItem.getArray();
// Init the property value sequence
- aMenuItem[ OFFSET_MENUITEM_URL ].Name = m_aPropNames[ INDEX_URL ];
- aMenuItem[ OFFSET_MENUITEM_TITLE ].Name = m_aPropNames[ INDEX_TITLE ];
- aMenuItem[ OFFSET_MENUITEM_TARGET ].Name = m_aPropNames[ INDEX_TARGET ];
- aMenuItem[ OFFSET_MENUITEM_IMAGEIDENTIFIER ].Name = m_aPropNames[ INDEX_IMAGEIDENTIFIER];
- aMenuItem[ OFFSET_MENUITEM_CONTEXT ].Name = m_aPropNames[ INDEX_CONTEXT ];
- aMenuItem[ OFFSET_MENUITEM_SUBMENU ].Name = m_aPropNames[ INDEX_SUBMENU ]; // Submenu set!
+ pMenuItem[ OFFSET_MENUITEM_URL ].Name = m_aPropNames[ INDEX_URL ];
+ pMenuItem[ OFFSET_MENUITEM_TITLE ].Name = m_aPropNames[ INDEX_TITLE ];
+ pMenuItem[ OFFSET_MENUITEM_TARGET ].Name = m_aPropNames[ INDEX_TARGET ];
+ pMenuItem[ OFFSET_MENUITEM_IMAGEIDENTIFIER ].Name = m_aPropNames[ INDEX_IMAGEIDENTIFIER];
+ pMenuItem[ OFFSET_MENUITEM_CONTEXT ].Name = m_aPropNames[ INDEX_CONTEXT ];
+ pMenuItem[ OFFSET_MENUITEM_SUBMENU ].Name = m_aPropNames[ INDEX_SUBMENU ]; // Submenu set!
for ( sal_uInt32 n = 0; n < nCount; n++ )
{
@@ -674,7 +673,7 @@ void AddonsOptions_Impl::ReadAddonMenuSet( Sequence< Sequence< PropertyValue > >
// Successfully read a menu item, append to our list
sal_uInt32 nMenuItemCount = rAddonMenuSeq.getLength() + 1;
rAddonMenuSeq.realloc( nMenuItemCount );
- rAddonMenuSeq[nIndex++] = aMenuItem;
+ rAddonMenuSeq.getArray()[nIndex++] = aMenuItem;
}
}
}
@@ -689,14 +688,14 @@ void AddonsOptions_Impl::ReadOfficeHelpSet( Sequence< Sequence< PropertyValue >
sal_uInt32 nCount = aAddonHelpMenuNodeSeq.getLength();
sal_uInt32 nIndex = 0;
Sequence< PropertyValue > aMenuItem( PROPERTYCOUNT_MENUITEM );
-
+ auto pMenuItem = aMenuItem.getArray();
// Init the property value sequence
- aMenuItem[ OFFSET_MENUITEM_URL ].Name = m_aPropNames[ INDEX_URL ];
- aMenuItem[ OFFSET_MENUITEM_TITLE ].Name = m_aPropNames[ INDEX_TITLE ];
- aMenuItem[ OFFSET_MENUITEM_TARGET ].Name = m_aPropNames[ INDEX_TARGET ];
- aMenuItem[ OFFSET_MENUITEM_IMAGEIDENTIFIER ].Name = m_aPropNames[ INDEX_IMAGEIDENTIFIER];
- aMenuItem[ OFFSET_MENUITEM_CONTEXT ].Name = m_aPropNames[ INDEX_CONTEXT ];
- aMenuItem[ OFFSET_MENUITEM_SUBMENU ].Name = m_aPropNames[ INDEX_SUBMENU ]; // Submenu set!
+ pMenuItem[ OFFSET_MENUITEM_URL ].Name = m_aPropNames[ INDEX_URL ];
+ pMenuItem[ OFFSET_MENUITEM_TITLE ].Name = m_aPropNames[ INDEX_TITLE ];
+ pMenuItem[ OFFSET_MENUITEM_TARGET ].Name = m_aPropNames[ INDEX_TARGET ];
+ pMenuItem[ OFFSET_MENUITEM_IMAGEIDENTIFIER ].Name = m_aPropNames[ INDEX_IMAGEIDENTIFIER];
+ pMenuItem[ OFFSET_MENUITEM_CONTEXT ].Name = m_aPropNames[ INDEX_CONTEXT ];
+ pMenuItem[ OFFSET_MENUITEM_SUBMENU ].Name = m_aPropNames[ INDEX_SUBMENU ]; // Submenu set!
for ( sal_uInt32 n = 0; n < nCount; n++ )
{
@@ -708,7 +707,7 @@ void AddonsOptions_Impl::ReadOfficeHelpSet( Sequence< Sequence< PropertyValue >
// Successfully read a menu item, append to our list
sal_uInt32 nMenuItemCount = rAddonOfficeHelpMenuSeq.getLength() + 1;
rAddonOfficeHelpMenuSeq.realloc( nMenuItemCount );
- rAddonOfficeHelpMenuSeq[nIndex++] = aMenuItem;
+ rAddonOfficeHelpMenuSeq.getArray()[nIndex++] = aMenuItem;
}
}
}
@@ -723,15 +722,15 @@ void AddonsOptions_Impl::ReadOfficeMenuBarSet( Sequence< Sequence< PropertyValue
sal_uInt32 nCount = aAddonMenuBarNodeSeq.getLength();
sal_uInt32 nIndex = 0;
Sequence< PropertyValue > aPopupMenu( PROPERTYCOUNT_POPUPMENU );
-
+ auto pPopupMenu = aPopupMenu.getArray();
// Init the property value sequence
- aPopupMenu[ OFFSET_POPUPMENU_TITLE ].Name = m_aPropNames[ INDEX_TITLE ];
- aPopupMenu[ OFFSET_POPUPMENU_CONTEXT ].Name = m_aPropNames[ INDEX_CONTEXT];
- aPopupMenu[ OFFSET_POPUPMENU_SUBMENU ].Name = m_aPropNames[ INDEX_SUBMENU];
- aPopupMenu[ OFFSET_POPUPMENU_URL ].Name = m_aPropNames[ INDEX_URL ];
+ pPopupMenu[ OFFSET_POPUPMENU_TITLE ].Name = m_aPropNames[ INDEX_TITLE ];
+ pPopupMenu[ OFFSET_POPUPMENU_CONTEXT ].Name = m_aPropNames[ INDEX_CONTEXT];
+ pPopupMenu[ OFFSET_POPUPMENU_SUBMENU ].Name = m_aPropNames[ INDEX_SUBMENU];
+ pPopupMenu[ OFFSET_POPUPMENU_URL ].Name = m_aPropNames[ INDEX_URL ];
StringToIndexMap aTitleToIndexMap;
-
+ auto pAddonOfficeMenuBarSeq = rAddonOfficeMenuBarSeq.getArray();
for ( sal_uInt32 n = 0; n < nCount; n++ )
{
OUString aPopupMenuNode( aAddonMenuBarNode + aAddonMenuBarNodeSeq[n] );
@@ -747,7 +746,7 @@ void AddonsOptions_Impl::ReadOfficeMenuBarSet( Sequence< Sequence< PropertyValue
if ( pIter != aTitleToIndexMap.end() )
{
// title already there => concat both popup menus
- Sequence< PropertyValue >& rOldPopupMenu = rAddonOfficeMenuBarSeq[pIter->second];
+ Sequence< PropertyValue >& rOldPopupMenu = pAddonOfficeMenuBarSeq[pIter->second];
AppendPopupMenu( rOldPopupMenu, aPopupMenu );
}
else
@@ -755,7 +754,8 @@ void AddonsOptions_Impl::ReadOfficeMenuBarSet( Sequence< Sequence< PropertyValue
// not found
sal_uInt32 nMenuItemCount = rAddonOfficeMenuBarSeq.getLength() + 1;
rAddonOfficeMenuBarSeq.realloc( nMenuItemCount );
- rAddonOfficeMenuBarSeq[nIndex] = aPopupMenu;
+ pAddonOfficeMenuBarSeq = rAddonOfficeMenuBarSeq.getArray();
+ pAddonOfficeMenuBarSeq[nIndex] = aPopupMenu;
aTitleToIndexMap.emplace( aPopupTitle, nIndex );
++nIndex;
}
@@ -788,15 +788,15 @@ bool AddonsOptions_Impl::ReadToolBarItemSet( const OUString& rToolBarItemSetNode
OUString aAddonToolBarItemSetNode( rToolBarItemSetNodeName + m_aPathDelimiter );
Sequence< OUString > aAddonToolBarItemSetNodeSeq = GetNodeNames( rToolBarItemSetNodeName );
Sequence< PropertyValue > aToolBarItem( PROPERTYCOUNT_TOOLBARITEM );
-
+ auto pToolBarItem = aToolBarItem.getArray();
// Init the property value sequence
- aToolBarItem[ OFFSET_TOOLBARITEM_URL ].Name = m_aPropNames[ INDEX_URL ];
- aToolBarItem[ OFFSET_TOOLBARITEM_TITLE ].Name = m_aPropNames[ INDEX_TITLE ];
- aToolBarItem[ OFFSET_TOOLBARITEM_IMAGEIDENTIFIER ].Name = m_aPropNames[ INDEX_IMAGEIDENTIFIER];
- aToolBarItem[ OFFSET_TOOLBARITEM_TARGET ].Name = m_aPropNames[ INDEX_TARGET ];
- aToolBarItem[ OFFSET_TOOLBARITEM_CONTEXT ].Name = m_aPropNames[ INDEX_CONTEXT ];
- aToolBarItem[ OFFSET_TOOLBARITEM_CONTROLTYPE ].Name = m_aPropNames[ INDEX_CONTROLTYPE ];
- aToolBarItem[ OFFSET_TOOLBARITEM_WIDTH ].Name = m_aPropNames[ INDEX_WIDTH ];
+ pToolBarItem[ OFFSET_TOOLBARITEM_URL ].Name = m_aPropNames[ INDEX_URL ];
+ pToolBarItem[ OFFSET_TOOLBARITEM_TITLE ].Name = m_aPropNames[ INDEX_TITLE ];
+ pToolBarItem[ OFFSET_TOOLBARITEM_IMAGEIDENTIFIER ].Name = m_aPropNames[ INDEX_IMAGEIDENTIFIER];
+ pToolBarItem[ OFFSET_TOOLBARITEM_TARGET ].Name = m_aPropNames[ INDEX_TARGET ];
+ pToolBarItem[ OFFSET_TOOLBARITEM_CONTEXT ].Name = m_aPropNames[ INDEX_CONTEXT ];
+ pToolBarItem[ OFFSET_TOOLBARITEM_CONTROLTYPE ].Name = m_aPropNames[ INDEX_CONTROLTYPE ];
+ pToolBarItem[ OFFSET_TOOLBARITEM_WIDTH ].Name = m_aPropNames[ INDEX_WIDTH ];
sal_uInt32 nCount = aAddonToolBarItemSetNodeSeq.getLength();
for ( sal_uInt32 n = 0; n < nCount; n++ )
@@ -809,7 +809,7 @@ bool AddonsOptions_Impl::ReadToolBarItemSet( const OUString& rToolBarItemSetNode
// Successfully read a toolbar item, append to our list
sal_uInt32 nAddonCount = rAddonOfficeToolBarSeq.getLength();
rAddonOfficeToolBarSeq.realloc( nAddonCount+1 );
- rAddonOfficeToolBarSeq[nAddonCount] = aToolBarItem;
+ rAddonOfficeToolBarSeq.getArray()[nAddonCount] = aToolBarItem;
}
}
@@ -844,17 +844,17 @@ bool AddonsOptions_Impl::ReadNotebookBarItemSet(
OUString aAddonNotebookBarItemSetNode(rNotebookBarItemSetNodeName + m_aPathDelimiter);
Sequence<OUString> aAddonNotebookBarItemSetNodeSeq = GetNodeNames(rNotebookBarItemSetNodeName);
Sequence<PropertyValue> aNotebookBarItem(PROPERTYCOUNT_NOTEBOOKBARITEM);
-
+ auto pNotebookBarItem = aNotebookBarItem.getArray();
// Init the property value sequence
- aNotebookBarItem[OFFSET_NOTEBOOKBARITEM_URL].Name = m_aPropNames[INDEX_URL];
- aNotebookBarItem[OFFSET_NOTEBOOKBARITEM_TITLE].Name = m_aPropNames[INDEX_TITLE];
- aNotebookBarItem[OFFSET_NOTEBOOKBARITEM_IMAGEIDENTIFIER].Name
+ pNotebookBarItem[OFFSET_NOTEBOOKBARITEM_URL].Name = m_aPropNames[INDEX_URL];
+ pNotebookBarItem[OFFSET_NOTEBOOKBARITEM_TITLE].Name = m_aPropNames[INDEX_TITLE];
+ pNotebookBarItem[OFFSET_NOTEBOOKBARITEM_IMAGEIDENTIFIER].Name
= m_aPropNames[INDEX_IMAGEIDENTIFIER];
- aNotebookBarItem[OFFSET_NOTEBOOKBARITEM_TARGET].Name = m_aPropNames[INDEX_TARGET];
- aNotebookBarItem[OFFSET_NOTEBOOKBARITEM_CONTEXT].Name = m_aPropNames[INDEX_CONTEXT];
- aNotebookBarItem[OFFSET_NOTEBOOKBARITEM_CONTROLTYPE].Name = m_aPropNames[INDEX_CONTROLTYPE];
- aNotebookBarItem[OFFSET_NOTEBOOKBARITEM_WIDTH].Name = m_aPropNames[INDEX_WIDTH];
- aNotebookBarItem[OFFSET_NOTEBOOKBARITEM_STYLE].Name = m_aPropNames[INDEX_STYLE];
+ pNotebookBarItem[OFFSET_NOTEBOOKBARITEM_TARGET].Name = m_aPropNames[INDEX_TARGET];
+ pNotebookBarItem[OFFSET_NOTEBOOKBARITEM_CONTEXT].Name = m_aPropNames[INDEX_CONTEXT];
+ pNotebookBarItem[OFFSET_NOTEBOOKBARITEM_CONTROLTYPE].Name = m_aPropNames[INDEX_CONTROLTYPE];
+ pNotebookBarItem[OFFSET_NOTEBOOKBARITEM_WIDTH].Name = m_aPropNames[INDEX_WIDTH];
+ pNotebookBarItem[OFFSET_NOTEBOOKBARITEM_STYLE].Name = m_aPropNames[INDEX_STYLE];
sal_uInt32 nCount = aAddonNotebookBarItemSetNodeSeq.getLength();
for (sal_uInt32 n = 0; n < nCount; n++)
@@ -867,7 +867,7 @@ bool AddonsOptions_Impl::ReadNotebookBarItemSet(
// Successfully read a toolbar item, append to our list
sal_uInt32 nAddonCount = rAddonOfficeNotebookBarSeq.getLength();
rAddonOfficeNotebookBarSeq.realloc(nAddonCount + 1);
- rAddonOfficeNotebookBarSeq[nAddonCount] = aNotebookBarItem;
+ rAddonOfficeNotebookBarSeq.getArray()[nAddonCount] = aNotebookBarItem;
}
}
@@ -885,7 +885,6 @@ void AddonsOptions_Impl::ReadImages( ImageManager& aImageManager )
sal_uInt32 nCount = aAddonImagesNodeSeq.getLength();
// Init the property value sequence
- Sequence< OUString > aAddonImageItemNodePropNames( 1 );
OUString aURL;
for ( sal_uInt32 n = 0; n < nCount; n++ )
@@ -893,9 +892,9 @@ void AddonsOptions_Impl::ReadImages( ImageManager& aImageManager )
OUString aImagesItemNode( aAddonImagesNode + aAddonImagesNodeSeq[n] );
// Create sequence for data access
- aAddonImageItemNodePropNames[0] = aImagesItemNode +
+ Sequence< OUString > aAddonImageItemNodePropNames = { aImagesItemNode +
m_aPathDelimiter +
- m_aPropNames[ OFFSET_MENUITEM_URL ];
+ m_aPropNames[ OFFSET_MENUITEM_URL ] };
Sequence< Any > aAddonImageItemNodeValues = GetProperties( aAddonImageItemNodePropNames );
@@ -924,17 +923,12 @@ void AddonsOptions_Impl::ReadImages( ImageManager& aImageManager )
OUString AddonsOptions_Impl::GeneratePrefixURL()
{
// Create a unique prefixed Add-On popup menu URL so it can be identified later as a runtime popup menu.
- OUString aPopupMenuURL;
- OUStringBuffer aBuf( m_aRootAddonPopupMenuURLPrexfix.getLength() + 3 );
- aBuf.append( m_aRootAddonPopupMenuURLPrexfix );
- aBuf.append( ++m_nRootAddonPopupMenuId );
- aPopupMenuURL = aBuf.makeStringAndClear();
- return aPopupMenuURL;
+ return m_aRootAddonPopupMenuURLPrexfix + OUString::number( ++m_nRootAddonPopupMenuId );
}
void AddonsOptions_Impl::ReadMenuMergeInstructions( MergeMenuInstructionContainer& aContainer )
{
- static const OUStringLiteral aMenuMergeRootName( u"AddonUI/OfficeMenuBarMerging/" );
+ static constexpr OUString aMenuMergeRootName( u"AddonUI/OfficeMenuBarMerging/"_ustr );
Sequence< OUString > aAddonMergeNodesSeq = GetNodeNames( aMenuMergeRootName );
@@ -942,6 +936,7 @@ void AddonsOptions_Impl::ReadMenuMergeInstructions( MergeMenuInstructionContaine
// Init the property value sequence
Sequence< OUString > aNodePropNames( 5 );
+ auto pNodePropNames = aNodePropNames.getArray();
for ( sal_uInt32 i = 0; i < nCount; i++ )
{
@@ -958,19 +953,19 @@ void AddonsOptions_Impl::ReadMenuMergeInstructions( MergeMenuInstructionContaine
m_aPathDelimiter;
// Create sequence for data access
- aNodePropNames[0] = aMergeAddonInstructionBase +
+ pNodePropNames[0] = aMergeAddonInstructionBase +
m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGEPOINT ];
- aNodePropNames[1] = aMergeAddonInstructionBase +
+ pNodePropNames[1] = aMergeAddonInstructionBase +
m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGECOMMAND ];
- aNodePropNames[2] = aMergeAddonInstructionBase +
+ pNodePropNames[2] = aMergeAddonInstructionBase +
m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGECOMMANDPARAMETER ];
- aNodePropNames[3] = aMergeAddonInstructionBase +
+ pNodePropNames[3] = aMergeAddonInstructionBase +
m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGEFALLBACK ];
- aNodePropNames[4] = aMergeAddonInstructionBase +
+ pNodePropNames[4] = aMergeAddonInstructionBase +
m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGECONTEXT ];
Sequence< Any > aNodePropValues = GetProperties( aNodePropNames );
@@ -1005,13 +1000,14 @@ void AddonsOptions_Impl::ReadMergeMenuData( std::u16string_view aMergeAddonInstr
void AddonsOptions_Impl::ReadToolbarMergeInstructions( ToolbarMergingInstructions& rCachedToolbarMergingInstructions )
{
- static const OUStringLiteral aToolbarMergeRootName( u"AddonUI/OfficeToolbarMerging/" );
+ static constexpr OUString aToolbarMergeRootName( u"AddonUI/OfficeToolbarMerging/"_ustr );
Sequence< OUString > aAddonMergeNodesSeq = GetNodeNames( aToolbarMergeRootName );
sal_uInt32 nCount = aAddonMergeNodesSeq.getLength();
// Init the property value sequence
Sequence< OUString > aNodePropNames( 6 );
+ auto pNodePropNames = aNodePropNames.getArray();
for ( sal_uInt32 i = 0; i < nCount; i++ )
{
@@ -1028,22 +1024,22 @@ void AddonsOptions_Impl::ReadToolbarMergeInstructions( ToolbarMergingInstruction
m_aPathDelimiter;
// Create sequence for data access
- aNodePropNames[0] = aMergeAddonInstructionBase +
+ pNodePropNames[0] = aMergeAddonInstructionBase +
m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_TOOLBAR ];
- aNodePropNames[1] = aMergeAddonInstructionBase +
+ pNodePropNames[1] = aMergeAddonInstructionBase +
m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGEPOINT ];
- aNodePropNames[2] = aMergeAddonInstructionBase +
+ pNodePropNames[2] = aMergeAddonInstructionBase +
m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGECOMMAND ];
- aNodePropNames[3] = aMergeAddonInstructionBase +
+ pNodePropNames[3] = aMergeAddonInstructionBase +
m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGECOMMANDPARAMETER ];
- aNodePropNames[4] = aMergeAddonInstructionBase +
+ pNodePropNames[4] = aMergeAddonInstructionBase +
m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGEFALLBACK ];
- aNodePropNames[5] = aMergeAddonInstructionBase +
+ pNodePropNames[5] = aMergeAddonInstructionBase +
m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGECONTEXT ];
Sequence< Any > aNodePropValues = GetProperties( aNodePropNames );
@@ -1076,13 +1072,14 @@ void AddonsOptions_Impl::ReadMergeToolbarData( std::u16string_view aMergeAddonIn
void AddonsOptions_Impl::ReadNotebookBarMergeInstructions(
NotebookBarMergingInstructions& rCachedNotebookBarMergingInstructions)
{
- static const OUStringLiteral aNotebookBarMergeRootName(u"AddonUI/OfficeNotebookBarMerging/");
+ static constexpr OUString aNotebookBarMergeRootName(u"AddonUI/OfficeNotebookBarMerging/"_ustr);
Sequence<OUString> aAddonMergeNodesSeq = GetNodeNames(aNotebookBarMergeRootName);
sal_uInt32 nCount = aAddonMergeNodesSeq.getLength();
// Init the property value sequence
Sequence<OUString> aNodePropNames(6);
+ auto pNodePropNames = aNodePropNames.getArray();
for (sal_uInt32 i = 0; i < nCount; i++)
{
@@ -1099,22 +1096,22 @@ void AddonsOptions_Impl::ReadNotebookBarMergeInstructions(
m_aPathDelimiter;
// Create sequence for data access
- aNodePropNames[0] = aMergeAddonInstructionBase +
+ pNodePropNames[0] = aMergeAddonInstructionBase +
m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_NOTEBOOKBAR];
- aNodePropNames[1] = aMergeAddonInstructionBase +
+ pNodePropNames[1] = aMergeAddonInstructionBase +
m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_MERGEPOINT];
- aNodePropNames[2] = aMergeAddonInstructionBase +
+ pNodePropNames[2] = aMergeAddonInstructionBase +
m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_MERGECOMMAND];
- aNodePropNames[3] = aMergeAddonInstructionBase +
+ pNodePropNames[3] = aMergeAddonInstructionBase +
m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_MERGECOMMANDPARAMETER];
- aNodePropNames[4] = aMergeAddonInstructionBase +
+ pNodePropNames[4] = aMergeAddonInstructionBase +
m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_MERGEFALLBACK];
- aNodePropNames[5] = aMergeAddonInstructionBase +
+ pNodePropNames[5] = aMergeAddonInstructionBase +
m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_MERGECONTEXT];
Sequence<Any> aNodePropValues = GetProperties(aNodePropNames);
@@ -1150,12 +1147,13 @@ void AddonsOptions_Impl::ReadMergeNotebookBarData(
void AddonsOptions_Impl::ReadStatusbarMergeInstructions( MergeStatusbarInstructionContainer& aContainer )
{
- static const OUStringLiteral aStatusbarMergeRootName( u"AddonUI/OfficeStatusbarMerging/" );
+ static constexpr OUString aStatusbarMergeRootName( u"AddonUI/OfficeStatusbarMerging/"_ustr );
Sequence< OUString > aAddonMergeNodesSeq = GetNodeNames( aStatusbarMergeRootName );
sal_uInt32 nCount = aAddonMergeNodesSeq.getLength();
Sequence< OUString > aNodePropNames( 5 );
+ auto pNodePropNames = aNodePropNames.getArray();
for ( sal_uInt32 i = 0; i < nCount; i++ )
{
@@ -1172,19 +1170,19 @@ void AddonsOptions_Impl::ReadStatusbarMergeInstructions( MergeStatusbarInstructi
m_aPathDelimiter;
// Create sequence for data access
- aNodePropNames[0] = aMergeAddonInstructionBase +
+ pNodePropNames[0] = aMergeAddonInstructionBase +
m_aPropMergeMenuNames[ OFFSET_MERGESTATUSBAR_MERGEPOINT ];
- aNodePropNames[1] = aMergeAddonInstructionBase +
+ pNodePropNames[1] = aMergeAddonInstructionBase +
m_aPropMergeMenuNames[ OFFSET_MERGESTATUSBAR_MERGECOMMAND ];
- aNodePropNames[2] = aMergeAddonInstructionBase +
+ pNodePropNames[2] = aMergeAddonInstructionBase +
m_aPropMergeMenuNames[ OFFSET_MERGESTATUSBAR_MERGECOMMANDPARAMETER ];
- aNodePropNames[3] = aMergeAddonInstructionBase +
+ pNodePropNames[3] = aMergeAddonInstructionBase +
m_aPropMergeMenuNames[ OFFSET_MERGESTATUSBAR_MERGEFALLBACK ];
- aNodePropNames[4] = aMergeAddonInstructionBase +
+ pNodePropNames[4] = aMergeAddonInstructionBase +
m_aPropMergeMenuNames[ OFFSET_MERGESTATUSBAR_MERGECONTEXT ];
Sequence< Any > aNodePropValues = GetProperties( aNodePropNames );
@@ -1215,14 +1213,15 @@ void AddonsOptions_Impl::ReadMergeStatusbarData(
Sequence< OUString > aAddonStatusbarItemSetNodeSeq = GetNodeNames( aMergeStatusbarBaseNode );
Sequence< PropertyValue > aStatusbarItem( PROPERTYCOUNT_STATUSBARITEM );
- aStatusbarItem[ OFFSET_STATUSBARITEM_URL ].Name = m_aPropNames[ INDEX_URL ];
- aStatusbarItem[ OFFSET_STATUSBARITEM_TITLE ].Name = m_aPropNames[ INDEX_TITLE ];
- aStatusbarItem[ OFFSET_STATUSBARITEM_CONTEXT ].Name = m_aPropNames[ INDEX_CONTEXT ];
- aStatusbarItem[ OFFSET_STATUSBARITEM_ALIGN ].Name = m_aPropNames[ INDEX_ALIGN ];
- aStatusbarItem[ OFFSET_STATUSBARITEM_AUTOSIZE ].Name = m_aPropNames[ INDEX_AUTOSIZE ];
- aStatusbarItem[ OFFSET_STATUSBARITEM_OWNERDRAW ].Name = m_aPropNames[ INDEX_OWNERDRAW ];
- aStatusbarItem[ OFFSET_STATUSBARITEM_MANDATORY ].Name = m_aPropNames[ INDEX_MANDATORY ];
- aStatusbarItem[ OFFSET_STATUSBARITEM_WIDTH ].Name = m_aPropNames[ INDEX_WIDTH ];
+ auto pStatusbarItem = aStatusbarItem.getArray();
+ pStatusbarItem[ OFFSET_STATUSBARITEM_URL ].Name = m_aPropNames[ INDEX_URL ];
+ pStatusbarItem[ OFFSET_STATUSBARITEM_TITLE ].Name = m_aPropNames[ INDEX_TITLE ];
+ pStatusbarItem[ OFFSET_STATUSBARITEM_CONTEXT ].Name = m_aPropNames[ INDEX_CONTEXT ];
+ pStatusbarItem[ OFFSET_STATUSBARITEM_ALIGN ].Name = m_aPropNames[ INDEX_ALIGN ];
+ pStatusbarItem[ OFFSET_STATUSBARITEM_AUTOSIZE ].Name = m_aPropNames[ INDEX_AUTOSIZE ];
+ pStatusbarItem[ OFFSET_STATUSBARITEM_OWNERDRAW ].Name = m_aPropNames[ INDEX_OWNERDRAW ];
+ pStatusbarItem[ OFFSET_STATUSBARITEM_MANDATORY ].Name = m_aPropNames[ INDEX_MANDATORY ];
+ pStatusbarItem[ OFFSET_STATUSBARITEM_WIDTH ].Name = m_aPropNames[ INDEX_WIDTH ];
sal_uInt32 nCount = aAddonStatusbarItemSetNodeSeq.getLength();
for ( sal_uInt32 n = 0; n < nCount; n++ )
@@ -1233,7 +1232,7 @@ void AddonsOptions_Impl::ReadMergeStatusbarData(
{
sal_uInt32 nAddonCount = rMergeStatusbarItems.getLength();
rMergeStatusbarItems.realloc( nAddonCount+1 );
- rMergeStatusbarItems[nAddonCount] = aStatusbarItem;
+ rMergeStatusbarItems.getArray()[nAddonCount] = aStatusbarItem;
}
}
}
@@ -1251,18 +1250,19 @@ bool AddonsOptions_Impl::ReadStatusBarItem(
// Command URL is required
if (( aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_URL ] >>= aURL ) && aURL.getLength() > 0 )
{
- aStatusbarItem[ OFFSET_STATUSBARITEM_URL ].Value <<= aURL;
- aStatusbarItem[ OFFSET_STATUSBARITEM_TITLE ].Value = aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_TITLE ];
- aStatusbarItem[ OFFSET_STATUSBARITEM_CONTEXT ].Value = aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_CONTEXT ];
- aStatusbarItem[ OFFSET_STATUSBARITEM_ALIGN ].Value = aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_ALIGN ];
- aStatusbarItem[ OFFSET_STATUSBARITEM_AUTOSIZE ].Value = aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_AUTOSIZE ];
- aStatusbarItem[ OFFSET_STATUSBARITEM_OWNERDRAW ].Value = aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_OWNERDRAW ];
- aStatusbarItem[ OFFSET_STATUSBARITEM_MANDATORY ].Value = aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_MANDATORY ];
+ auto pStatusbarItem = aStatusbarItem.getArray();
+ pStatusbarItem[ OFFSET_STATUSBARITEM_URL ].Value <<= aURL;
+ pStatusbarItem[ OFFSET_STATUSBARITEM_TITLE ].Value = aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_TITLE ];
+ pStatusbarItem[ OFFSET_STATUSBARITEM_CONTEXT ].Value = aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_CONTEXT ];
+ pStatusbarItem[ OFFSET_STATUSBARITEM_ALIGN ].Value = aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_ALIGN ];
+ pStatusbarItem[ OFFSET_STATUSBARITEM_AUTOSIZE ].Value = aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_AUTOSIZE ];
+ pStatusbarItem[ OFFSET_STATUSBARITEM_OWNERDRAW ].Value = aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_OWNERDRAW ];
+ pStatusbarItem[ OFFSET_STATUSBARITEM_MANDATORY ].Value = aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_MANDATORY ];
// Configuration uses hyper for long. Therefore transform into sal_Int32
sal_Int64 nValue( 0 );
aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_WIDTH ] >>= nValue;
- aStatusbarItem[ OFFSET_STATUSBARITEM_WIDTH ].Value <<= sal_Int32( nValue );
+ pStatusbarItem[ OFFSET_STATUSBARITEM_WIDTH ].Value <<= sal_Int32( nValue );
bResult = true;
}
@@ -1279,7 +1279,8 @@ bool AddonsOptions_Impl::ReadMenuItem( std::u16string_view aMenuNodeName, Sequen
Sequence< Any > aMenuItemNodePropValues = GetProperties( GetPropertyNamesMenuItem( aAddonMenuItemTreeNode ) );
if (( aMenuItemNodePropValues[ OFFSET_MENUITEM_TITLE ] >>= aStrValue ) && !aStrValue.isEmpty() )
{
- aMenuItem[ OFFSET_MENUITEM_TITLE ].Value <<= aStrValue;
+ auto pMenuItem = aMenuItem.getArray();
+ pMenuItem[ OFFSET_MENUITEM_TITLE ].Value <<= aStrValue;
OUString aRootSubMenuName( aAddonMenuItemTreeNode + m_aPropNames[ INDEX_SUBMENU ] );
Sequence< OUString > aRootSubMenuNodeNames = GetNodeNames( aRootSubMenuName );
@@ -1294,10 +1295,10 @@ bool AddonsOptions_Impl::ReadMenuItem( std::u16string_view aMenuNodeName, Sequen
// A popup menu must have a title and can have a URL and ImageIdentifier
// Set the other property values to empty
- aMenuItem[ OFFSET_MENUITEM_URL ].Value <<= aPopupMenuURL;
- aMenuItem[ OFFSET_MENUITEM_TARGET ].Value <<= OUString();
- aMenuItem[ OFFSET_MENUITEM_IMAGEIDENTIFIER ].Value <<= aPopupMenuImageId;
- aMenuItem[ OFFSET_MENUITEM_CONTEXT ].Value = aMenuItemNodePropValues[ OFFSET_MENUITEM_CONTEXT ];
+ pMenuItem[ OFFSET_MENUITEM_URL ].Value <<= aPopupMenuURL;
+ pMenuItem[ OFFSET_MENUITEM_TARGET ].Value <<= OUString();
+ pMenuItem[ OFFSET_MENUITEM_IMAGEIDENTIFIER ].Value <<= aPopupMenuImageId;
+ pMenuItem[ OFFSET_MENUITEM_CONTEXT ].Value = aMenuItemNodePropValues[ OFFSET_MENUITEM_CONTEXT ];
// Continue to read the sub menu nodes
Sequence< Sequence< PropertyValue > > aSubMenuSeq;
@@ -1305,7 +1306,7 @@ bool AddonsOptions_Impl::ReadMenuItem( std::u16string_view aMenuNodeName, Sequen
for ( OUString& rName : asNonConstRange(aRootSubMenuNodeNames) )
rName = aSubMenuRootNodeName + rName;
ReadSubMenuEntries( aRootSubMenuNodeNames, aSubMenuSeq );
- aMenuItem[ OFFSET_MENUITEM_SUBMENU ].Value <<= aSubMenuSeq;
+ pMenuItem[ OFFSET_MENUITEM_SUBMENU ].Value <<= aSubMenuSeq;
bResult = true;
}
else if (( aMenuItemNodePropValues[ OFFSET_MENUITEM_URL ] >>= aStrValue ) && !aStrValue.isEmpty() )
@@ -1316,11 +1317,11 @@ bool AddonsOptions_Impl::ReadMenuItem( std::u16string_view aMenuNodeName, Sequen
aMenuItemNodePropValues[ OFFSET_MENUITEM_IMAGEIDENTIFIER ] >>= aMenuImageId;
ReadAndAssociateImages( aStrValue, aMenuImageId );
- aMenuItem[ OFFSET_MENUITEM_URL ].Value <<= aStrValue;
- aMenuItem[ OFFSET_MENUITEM_TARGET ].Value = aMenuItemNodePropValues[ OFFSET_MENUITEM_TARGET ];
- aMenuItem[ OFFSET_MENUITEM_IMAGEIDENTIFIER ].Value <<= aMenuImageId;
- aMenuItem[ OFFSET_MENUITEM_CONTEXT ].Value = aMenuItemNodePropValues[ OFFSET_MENUITEM_CONTEXT ];
- aMenuItem[ OFFSET_MENUITEM_SUBMENU ].Value <<= Sequence< Sequence< PropertyValue > >(); // Submenu set!
+ pMenuItem[ OFFSET_MENUITEM_URL ].Value <<= aStrValue;
+ pMenuItem[ OFFSET_MENUITEM_TARGET ].Value = aMenuItemNodePropValues[ OFFSET_MENUITEM_TARGET ];
+ pMenuItem[ OFFSET_MENUITEM_IMAGEIDENTIFIER ].Value <<= aMenuImageId;
+ pMenuItem[ OFFSET_MENUITEM_CONTEXT ].Value = aMenuItemNodePropValues[ OFFSET_MENUITEM_CONTEXT ];
+ pMenuItem[ OFFSET_MENUITEM_SUBMENU ].Value <<= Sequence< Sequence< PropertyValue > >(); // Submenu set!
bResult = true;
}
@@ -1328,12 +1329,14 @@ bool AddonsOptions_Impl::ReadMenuItem( std::u16string_view aMenuNodeName, Sequen
else if (( aMenuItemNodePropValues[ OFFSET_MENUITEM_URL ] >>= aStrValue ) &&
aStrValue == SEPARATOR_URL )
{
+ auto pMenuItem = aMenuItem.getArray();
+
// Separator
- aMenuItem[ OFFSET_MENUITEM_URL ].Value <<= aStrValue;
- aMenuItem[ OFFSET_MENUITEM_TARGET ].Value <<= OUString();
- aMenuItem[ OFFSET_MENUITEM_IMAGEIDENTIFIER ].Value <<= OUString();
- aMenuItem[ OFFSET_MENUITEM_CONTEXT ].Value <<= OUString();
- aMenuItem[ OFFSET_MENUITEM_SUBMENU ].Value <<= Sequence< Sequence< PropertyValue > >(); // Submenu set!
+ pMenuItem[ OFFSET_MENUITEM_URL ].Value <<= aStrValue;
+ pMenuItem[ OFFSET_MENUITEM_TARGET ].Value <<= OUString();
+ pMenuItem[ OFFSET_MENUITEM_IMAGEIDENTIFIER ].Value <<= OUString();
+ pMenuItem[ OFFSET_MENUITEM_CONTEXT ].Value <<= OUString();
+ pMenuItem[ OFFSET_MENUITEM_SUBMENU ].Value <<= Sequence< Sequence< PropertyValue > >(); // Submenu set!
bResult = true;
}
@@ -1350,7 +1353,8 @@ bool AddonsOptions_Impl::ReadPopupMenu( std::u16string_view aPopupMenuNodeName,
if (( aPopupMenuNodePropValues[ OFFSET_POPUPMENU_TITLE ] >>= aStrValue ) &&
!aStrValue.isEmpty() )
{
- aPopupMenu[ OFFSET_POPUPMENU_TITLE ].Value <<= aStrValue;
+ auto pPopupMenu = aPopupMenu.getArray();
+ pPopupMenu[ OFFSET_POPUPMENU_TITLE ].Value <<= aStrValue;
OUString aRootSubMenuName( aAddonPopupMenuTreeNode + m_aPropNames[ INDEX_SUBMENU ] );
Sequence< OUString > aRootSubMenuNodeNames = GetNodeNames( aRootSubMenuName );
@@ -1360,8 +1364,8 @@ bool AddonsOptions_Impl::ReadPopupMenu( std::u16string_view aPopupMenuNodeName,
// Set a unique prefixed Add-On popup menu URL so it can be identified later
OUString aPopupMenuURL = GeneratePrefixURL();
- aPopupMenu[ OFFSET_POPUPMENU_URL ].Value <<= aPopupMenuURL;
- aPopupMenu[ OFFSET_POPUPMENU_CONTEXT ].Value = aPopupMenuNodePropValues[ OFFSET_POPUPMENU_CONTEXT ];
+ pPopupMenu[ OFFSET_POPUPMENU_URL ].Value <<= aPopupMenuURL;
+ pPopupMenu[ OFFSET_POPUPMENU_CONTEXT ].Value = aPopupMenuNodePropValues[ OFFSET_POPUPMENU_CONTEXT ];
// Continue to read the sub menu nodes
Sequence< Sequence< PropertyValue > > aSubMenuSeq;
@@ -1369,7 +1373,7 @@ bool AddonsOptions_Impl::ReadPopupMenu( std::u16string_view aPopupMenuNodeName,
for ( OUString& rName : asNonConstRange(aRootSubMenuNodeNames) )
rName = aSubMenuRootNodeName + rName;
ReadSubMenuEntries( aRootSubMenuNodeNames, aSubMenuSeq );
- aPopupMenu[ OFFSET_POPUPMENU_SUBMENU ].Value <<= aSubMenuSeq;
+ pPopupMenu[ OFFSET_POPUPMENU_SUBMENU ].Value <<= aSubMenuSeq;
bResult = true;
}
}
@@ -1377,6 +1381,7 @@ bool AddonsOptions_Impl::ReadPopupMenu( std::u16string_view aPopupMenuNodeName,
return bResult;
}
+// static
void AddonsOptions_Impl::AppendPopupMenu( Sequence< PropertyValue >& rTargetPopupMenu, const Sequence< PropertyValue >& rSourcePopupMenu )
{
Sequence< Sequence< PropertyValue > > aTargetSubMenuSeq;
@@ -1387,9 +1392,10 @@ void AddonsOptions_Impl::AppendPopupMenu( Sequence< PropertyValue >& rTargetPopu
{
sal_uInt32 nIndex = aTargetSubMenuSeq.getLength();
aTargetSubMenuSeq.realloc( nIndex + aSourceSubMenuSeq.getLength() );
- for ( Sequence<PropertyValue> const & rSeq : std::as_const(aSourceSubMenuSeq) )
- aTargetSubMenuSeq[nIndex++] = rSeq;
- rTargetPopupMenu[ OFFSET_POPUPMENU_SUBMENU ].Value <<= aTargetSubMenuSeq;
+ auto pTargetSubMenuSeq = aTargetSubMenuSeq.getArray();
+ for (Sequence<PropertyValue> const& rSeq : aSourceSubMenuSeq)
+ pTargetSubMenuSeq[nIndex++] = rSeq;
+ rTargetPopupMenu.getArray()[ OFFSET_POPUPMENU_SUBMENU ].Value <<= aTargetSubMenuSeq;
}
}
@@ -1407,19 +1413,23 @@ bool AddonsOptions_Impl::ReadToolBarItem( std::u16string_view aToolBarItemNodeNa
OUString aTitle;
if ( aURL == SEPARATOR_URL )
{
+ auto pToolBarItem = aToolBarItem.getArray();
+
// A separator toolbar item only needs a URL
- aToolBarItem[ OFFSET_TOOLBARITEM_URL ].Value <<= aURL;
- aToolBarItem[ OFFSET_TOOLBARITEM_TITLE ].Value <<= OUString();
- aToolBarItem[ OFFSET_TOOLBARITEM_TARGET ].Value <<= OUString();
- aToolBarItem[ OFFSET_TOOLBARITEM_IMAGEIDENTIFIER ].Value <<= OUString();
- aToolBarItem[ OFFSET_TOOLBARITEM_CONTEXT ].Value <<= OUString();
- aToolBarItem[ OFFSET_TOOLBARITEM_CONTROLTYPE ].Value <<= OUString();
- aToolBarItem[ OFFSET_TOOLBARITEM_WIDTH ].Value <<= sal_Int32( 0 );
+ pToolBarItem[ OFFSET_TOOLBARITEM_URL ].Value <<= aURL;
+ pToolBarItem[ OFFSET_TOOLBARITEM_TITLE ].Value <<= OUString();
+ pToolBarItem[ OFFSET_TOOLBARITEM_TARGET ].Value <<= OUString();
+ pToolBarItem[ OFFSET_TOOLBARITEM_IMAGEIDENTIFIER ].Value <<= OUString();
+ pToolBarItem[ OFFSET_TOOLBARITEM_CONTEXT ].Value <<= OUString();
+ pToolBarItem[ OFFSET_TOOLBARITEM_CONTROLTYPE ].Value <<= OUString();
+ pToolBarItem[ OFFSET_TOOLBARITEM_WIDTH ].Value <<= sal_Int32( 0 );
bResult = true;
}
else if (( aToolBarItemNodePropValues[ OFFSET_TOOLBARITEM_TITLE ] >>= aTitle ) && !aTitle.isEmpty() )
{
+ auto pToolBarItem = aToolBarItem.getArray();
+
// A normal toolbar item must also have title => read the other properties;
OUString aImageId;
@@ -1427,17 +1437,17 @@ bool AddonsOptions_Impl::ReadToolBarItem( std::u16string_view aToolBarItemNodeNa
aToolBarItemNodePropValues[ OFFSET_TOOLBARITEM_IMAGEIDENTIFIER ] >>= aImageId;
ReadAndAssociateImages( aURL, aImageId );
- aToolBarItem[ OFFSET_TOOLBARITEM_URL ].Value <<= aURL;
- aToolBarItem[ OFFSET_TOOLBARITEM_TITLE ].Value <<= aTitle;
- aToolBarItem[ OFFSET_TOOLBARITEM_TARGET ].Value = aToolBarItemNodePropValues[ OFFSET_TOOLBARITEM_TARGET ];
- aToolBarItem[ OFFSET_TOOLBARITEM_IMAGEIDENTIFIER ].Value <<= aImageId;
- aToolBarItem[ OFFSET_TOOLBARITEM_CONTEXT ].Value = aToolBarItemNodePropValues[ OFFSET_TOOLBARITEM_CONTEXT ];
- aToolBarItem[ OFFSET_TOOLBARITEM_CONTROLTYPE ].Value = aToolBarItemNodePropValues[ OFFSET_TOOLBARITEM_CONTROLTYPE ];
+ pToolBarItem[ OFFSET_TOOLBARITEM_URL ].Value <<= aURL;
+ pToolBarItem[ OFFSET_TOOLBARITEM_TITLE ].Value <<= aTitle;
+ pToolBarItem[ OFFSET_TOOLBARITEM_TARGET ].Value = aToolBarItemNodePropValues[ OFFSET_TOOLBARITEM_TARGET ];
+ pToolBarItem[ OFFSET_TOOLBARITEM_IMAGEIDENTIFIER ].Value <<= aImageId;
+ pToolBarItem[ OFFSET_TOOLBARITEM_CONTEXT ].Value = aToolBarItemNodePropValues[ OFFSET_TOOLBARITEM_CONTEXT ];
+ pToolBarItem[ OFFSET_TOOLBARITEM_CONTROLTYPE ].Value = aToolBarItemNodePropValues[ OFFSET_TOOLBARITEM_CONTROLTYPE ];
// Configuration uses hyper for long. Therefore transform into sal_Int32
sal_Int64 nValue( 0 );
aToolBarItemNodePropValues[ OFFSET_TOOLBARITEM_WIDTH ] >>= nValue;
- aToolBarItem[ OFFSET_TOOLBARITEM_WIDTH ].Value <<= sal_Int32( nValue );
+ pToolBarItem[ OFFSET_TOOLBARITEM_WIDTH ].Value <<= sal_Int32( nValue );
bResult = true;
}
@@ -1460,20 +1470,24 @@ bool AddonsOptions_Impl::ReadNotebookBarItem( std::u16string_view aNotebookBarIt
OUString aTitle;
if ( aURL == SEPARATOR_URL )
{
+ auto pNotebookBarItem = aNotebookBarItem.getArray();
+
// A separator toolbar item only needs a URL
- aNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_URL ].Value <<= aURL;
- aNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_TITLE ].Value <<= OUString();
- aNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_TARGET ].Value <<= OUString();
- aNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_IMAGEIDENTIFIER ].Value <<= OUString();
- aNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_CONTEXT ].Value <<= OUString();
- aNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_CONTROLTYPE ].Value <<= OUString();
- aNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_WIDTH ].Value <<= sal_Int32( 0 );
- aNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_STYLE ].Value <<= OUString();
+ pNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_URL ].Value <<= aURL;
+ pNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_TITLE ].Value <<= OUString();
+ pNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_TARGET ].Value <<= OUString();
+ pNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_IMAGEIDENTIFIER ].Value <<= OUString();
+ pNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_CONTEXT ].Value <<= OUString();
+ pNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_CONTROLTYPE ].Value <<= OUString();
+ pNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_WIDTH ].Value <<= sal_Int32( 0 );
+ pNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_STYLE ].Value <<= OUString();
bResult = true;
}
else if (( aNotebookBarItemNodePropValues[ OFFSET_NOTEBOOKBARITEM_TITLE ] >>= aTitle ) && !aTitle.isEmpty() )
{
+ auto pNotebookBarItem = aNotebookBarItem.getArray();
+
// A normal toolbar item must also have title => read the other properties;
OUString aImageId;
@@ -1481,18 +1495,18 @@ bool AddonsOptions_Impl::ReadNotebookBarItem( std::u16string_view aNotebookBarIt
aNotebookBarItemNodePropValues[ OFFSET_NOTEBOOKBARITEM_IMAGEIDENTIFIER ] >>= aImageId;
ReadAndAssociateImages( aURL, aImageId );
- aNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_URL ].Value <<= aURL;
- aNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_TITLE ].Value <<= aTitle;
- aNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_TARGET ].Value = aNotebookBarItemNodePropValues[ OFFSET_NOTEBOOKBARITEM_TARGET ];
- aNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_IMAGEIDENTIFIER ].Value <<= aImageId;
- aNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_CONTEXT ].Value = aNotebookBarItemNodePropValues[ OFFSET_NOTEBOOKBARITEM_CONTEXT ];
- aNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_CONTROLTYPE ].Value = aNotebookBarItemNodePropValues[ OFFSET_NOTEBOOKBARITEM_CONTROLTYPE ];
+ pNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_URL ].Value <<= aURL;
+ pNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_TITLE ].Value <<= aTitle;
+ pNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_TARGET ].Value = aNotebookBarItemNodePropValues[ OFFSET_NOTEBOOKBARITEM_TARGET ];
+ pNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_IMAGEIDENTIFIER ].Value <<= aImageId;
+ pNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_CONTEXT ].Value = aNotebookBarItemNodePropValues[ OFFSET_NOTEBOOKBARITEM_CONTEXT ];
+ pNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_CONTROLTYPE ].Value = aNotebookBarItemNodePropValues[ OFFSET_NOTEBOOKBARITEM_CONTROLTYPE ];
// Configuration uses hyper for long. Therefore transform into sal_Int32
sal_Int64 nValue( 0 );
aNotebookBarItemNodePropValues[ OFFSET_NOTEBOOKBARITEM_WIDTH ] >>= nValue;
- aNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_WIDTH ].Value <<= sal_Int32( nValue );
- aNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_STYLE ].Value = aNotebookBarItemNodePropValues[ OFFSET_NOTEBOOKBARITEM_STYLE ];
+ pNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_WIDTH ].Value <<= sal_Int32( nValue );
+ pNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_STYLE ].Value = aNotebookBarItemNodePropValues[ OFFSET_NOTEBOOKBARITEM_STYLE ];
bResult = true;
}
@@ -1504,14 +1518,15 @@ bool AddonsOptions_Impl::ReadNotebookBarItem( std::u16string_view aNotebookBarIt
void AddonsOptions_Impl::ReadSubMenuEntries( const Sequence< OUString >& aSubMenuNodeNames, Sequence< Sequence< PropertyValue > >& rSubMenuSeq )
{
Sequence< PropertyValue > aMenuItem( PROPERTYCOUNT_MENUITEM );
+ auto pMenuItem = aMenuItem.getArray();
// Init the property value sequence
- aMenuItem[ OFFSET_MENUITEM_URL ].Name = PROPERTYNAME_URL;
- aMenuItem[ OFFSET_MENUITEM_TITLE ].Name = PROPERTYNAME_TITLE;
- aMenuItem[ OFFSET_MENUITEM_TARGET ].Name = PROPERTYNAME_TARGET;
- aMenuItem[ OFFSET_MENUITEM_IMAGEIDENTIFIER ].Name = PROPERTYNAME_IMAGEIDENTIFIER;
- aMenuItem[ OFFSET_MENUITEM_CONTEXT ].Name = PROPERTYNAME_CONTEXT;
- aMenuItem[ OFFSET_MENUITEM_SUBMENU ].Name = PROPERTYNAME_SUBMENU; // Submenu set!
+ pMenuItem[ OFFSET_MENUITEM_URL ].Name = PROPERTYNAME_URL;
+ pMenuItem[ OFFSET_MENUITEM_TITLE ].Name = PROPERTYNAME_TITLE;
+ pMenuItem[ OFFSET_MENUITEM_TARGET ].Name = PROPERTYNAME_TARGET;
+ pMenuItem[ OFFSET_MENUITEM_IMAGEIDENTIFIER ].Name = PROPERTYNAME_IMAGEIDENTIFIER;
+ pMenuItem[ OFFSET_MENUITEM_CONTEXT ].Name = PROPERTYNAME_CONTEXT;
+ pMenuItem[ OFFSET_MENUITEM_SUBMENU ].Name = PROPERTYNAME_SUBMENU; // Submenu set!
sal_uInt32 nIndex = 0;
sal_uInt32 nCount = aSubMenuNodeNames.getLength();
@@ -1521,7 +1536,7 @@ void AddonsOptions_Impl::ReadSubMenuEntries( const Sequence< OUString >& aSubMen
{
sal_uInt32 nSubMenuCount = rSubMenuSeq.getLength() + 1;
rSubMenuSeq.realloc( nSubMenuCount );
- rSubMenuSeq[nIndex++] = aMenuItem;
+ rSubMenuSeq.getArray()[nIndex++] = aMenuItem;
}
}
}
@@ -1533,12 +1548,14 @@ bool AddonsOptions_Impl::HasAssociatedImages( const OUString& aURL )
return ( pIter != m_aImageManager.end() );
}
+// static
void AddonsOptions_Impl::SubstituteVariables( OUString& aURL )
{
aURL = comphelper::getExpandedUri(
comphelper::getProcessComponentContext(), aURL);
}
+// static
BitmapEx AddonsOptions_Impl::ReadImageFromURL(const OUString& aImageURL)
{
BitmapEx aImage;
@@ -1550,7 +1567,7 @@ BitmapEx AddonsOptions_Impl::ReadImageFromURL(const OUString& aImageURL)
Graphic aGraphic;
GraphicFilter& rGF = GraphicFilter::GetGraphicFilter();
- rGF.ImportGraphic( aGraphic, OUString(), *pStream );
+ rGF.ImportGraphic( aGraphic, u"", *pStream );
BitmapEx aBitmapEx = aGraphic.GetBitmapEx();
@@ -1580,7 +1597,7 @@ void AddonsOptions_Impl::ReadAndAssociateImages( const OUString& aURL, const OUS
// Loop to create the two possible image names and try to read the bitmap files
static const char* aExtArray[] = { "_16", "_26" };
- for ( size_t i = 0; i < SAL_N_ELEMENTS(aExtArray); i++ )
+ for ( size_t i = 0; i < std::size(aExtArray); i++ )
{
OUStringBuffer aFileURL( aImageURL );
aFileURL.appendAscii( aExtArray[i] );
@@ -1637,7 +1654,8 @@ std::unique_ptr<AddonsOptions_Impl::ImageEntry> AddonsOptions_Impl::ReadImageDat
return pEntry;
}
-bool AddonsOptions_Impl::CreateImageFromSequence( BitmapEx& rImage, Sequence< sal_Int8 >& rBitmapDataSeq ) const
+// static
+bool AddonsOptions_Impl::CreateImageFromSequence( BitmapEx& rImage, Sequence< sal_Int8 >& rBitmapDataSeq )
{
bool bResult = false;
@@ -1662,14 +1680,15 @@ bool AddonsOptions_Impl::CreateImageFromSequence( BitmapEx& rImage, Sequence< sa
Sequence< OUString > AddonsOptions_Impl::GetPropertyNamesMenuItem( std::u16string_view aPropertyRootNode ) const
{
Sequence< OUString > lResult( PROPERTYCOUNT_MENUITEM );
+ auto plResult = lResult.getArray();
// Create property names dependent from the root node name
- lResult[OFFSET_MENUITEM_URL] = aPropertyRootNode + m_aPropNames[ INDEX_URL ];
- lResult[OFFSET_MENUITEM_TITLE] = aPropertyRootNode + m_aPropNames[ INDEX_TITLE ];
- lResult[OFFSET_MENUITEM_IMAGEIDENTIFIER] = aPropertyRootNode + m_aPropNames[ INDEX_IMAGEIDENTIFIER ];
- lResult[OFFSET_MENUITEM_TARGET] = aPropertyRootNode + m_aPropNames[ INDEX_TARGET ];
- lResult[OFFSET_MENUITEM_CONTEXT] = aPropertyRootNode + m_aPropNames[ INDEX_CONTEXT ];
- lResult[OFFSET_MENUITEM_SUBMENU] = aPropertyRootNode + m_aPropNames[ INDEX_SUBMENU ];
+ plResult[OFFSET_MENUITEM_URL] = aPropertyRootNode + m_aPropNames[ INDEX_URL ];
+ plResult[OFFSET_MENUITEM_TITLE] = aPropertyRootNode + m_aPropNames[ INDEX_TITLE ];
+ plResult[OFFSET_MENUITEM_IMAGEIDENTIFIER] = aPropertyRootNode + m_aPropNames[ INDEX_IMAGEIDENTIFIER ];
+ plResult[OFFSET_MENUITEM_TARGET] = aPropertyRootNode + m_aPropNames[ INDEX_TARGET ];
+ plResult[OFFSET_MENUITEM_CONTEXT] = aPropertyRootNode + m_aPropNames[ INDEX_CONTEXT ];
+ plResult[OFFSET_MENUITEM_SUBMENU] = aPropertyRootNode + m_aPropNames[ INDEX_SUBMENU ];
return lResult;
}
@@ -1678,11 +1697,12 @@ Sequence< OUString > AddonsOptions_Impl::GetPropertyNamesPopupMenu( std::u16stri
{
// The URL is automatically set and not read from the configuration.
Sequence< OUString > lResult( PROPERTYCOUNT_POPUPMENU-1 );
+ auto plResult = lResult.getArray();
// Create property names dependent from the root node name
- lResult[OFFSET_POPUPMENU_TITLE] = aPropertyRootNode + m_aPropNames[ INDEX_TITLE ];
- lResult[OFFSET_POPUPMENU_CONTEXT] = aPropertyRootNode + m_aPropNames[ INDEX_CONTEXT ];
- lResult[OFFSET_POPUPMENU_SUBMENU] = aPropertyRootNode + m_aPropNames[ INDEX_SUBMENU ];
+ plResult[OFFSET_POPUPMENU_TITLE] = aPropertyRootNode + m_aPropNames[ INDEX_TITLE ];
+ plResult[OFFSET_POPUPMENU_CONTEXT] = aPropertyRootNode + m_aPropNames[ INDEX_CONTEXT ];
+ plResult[OFFSET_POPUPMENU_SUBMENU] = aPropertyRootNode + m_aPropNames[ INDEX_SUBMENU ];
return lResult;
}
@@ -1690,15 +1710,16 @@ Sequence< OUString > AddonsOptions_Impl::GetPropertyNamesPopupMenu( std::u16stri
Sequence< OUString > AddonsOptions_Impl::GetPropertyNamesToolBarItem( std::u16string_view aPropertyRootNode ) const
{
Sequence< OUString > lResult( PROPERTYCOUNT_TOOLBARITEM );
+ auto plResult = lResult.getArray();
// Create property names dependent from the root node name
- lResult[0] = aPropertyRootNode + m_aPropNames[ INDEX_URL ];
- lResult[1] = aPropertyRootNode + m_aPropNames[ INDEX_TITLE ];
- lResult[2] = aPropertyRootNode + m_aPropNames[ INDEX_IMAGEIDENTIFIER];
- lResult[3] = aPropertyRootNode + m_aPropNames[ INDEX_TARGET ];
- lResult[4] = aPropertyRootNode + m_aPropNames[ INDEX_CONTEXT ];
- lResult[5] = aPropertyRootNode + m_aPropNames[ INDEX_CONTROLTYPE ];
- lResult[6] = aPropertyRootNode + m_aPropNames[ INDEX_WIDTH ];
+ plResult[0] = aPropertyRootNode + m_aPropNames[ INDEX_URL ];
+ plResult[1] = aPropertyRootNode + m_aPropNames[ INDEX_TITLE ];
+ plResult[2] = aPropertyRootNode + m_aPropNames[ INDEX_IMAGEIDENTIFIER];
+ plResult[3] = aPropertyRootNode + m_aPropNames[ INDEX_TARGET ];
+ plResult[4] = aPropertyRootNode + m_aPropNames[ INDEX_CONTEXT ];
+ plResult[5] = aPropertyRootNode + m_aPropNames[ INDEX_CONTROLTYPE ];
+ plResult[6] = aPropertyRootNode + m_aPropNames[ INDEX_WIDTH ];
return lResult;
}
@@ -1706,16 +1727,17 @@ Sequence< OUString > AddonsOptions_Impl::GetPropertyNamesToolBarItem( std::u16st
Sequence< OUString > AddonsOptions_Impl::GetPropertyNamesNotebookBarItem( std::u16string_view aPropertyRootNode ) const
{
Sequence< OUString > lResult( PROPERTYCOUNT_NOTEBOOKBARITEM );
+ auto plResult = lResult.getArray();
// Create property names dependent from the root node name
- lResult[0] = aPropertyRootNode + m_aPropNames[ INDEX_URL ];
- lResult[1] = aPropertyRootNode + m_aPropNames[ INDEX_TITLE ];
- lResult[2] = aPropertyRootNode + m_aPropNames[ INDEX_IMAGEIDENTIFIER];
- lResult[3] = aPropertyRootNode + m_aPropNames[ INDEX_TARGET ];
- lResult[4] = aPropertyRootNode + m_aPropNames[ INDEX_CONTEXT ];
- lResult[5] = aPropertyRootNode + m_aPropNames[ INDEX_CONTROLTYPE ];
- lResult[6] = aPropertyRootNode + m_aPropNames[ INDEX_WIDTH ];
- lResult[7] = aPropertyRootNode + m_aPropNames[ INDEX_STYLE ];
+ plResult[0] = aPropertyRootNode + m_aPropNames[ INDEX_URL ];
+ plResult[1] = aPropertyRootNode + m_aPropNames[ INDEX_TITLE ];
+ plResult[2] = aPropertyRootNode + m_aPropNames[ INDEX_IMAGEIDENTIFIER];
+ plResult[3] = aPropertyRootNode + m_aPropNames[ INDEX_TARGET ];
+ plResult[4] = aPropertyRootNode + m_aPropNames[ INDEX_CONTEXT ];
+ plResult[5] = aPropertyRootNode + m_aPropNames[ INDEX_CONTROLTYPE ];
+ plResult[6] = aPropertyRootNode + m_aPropNames[ INDEX_WIDTH ];
+ plResult[7] = aPropertyRootNode + m_aPropNames[ INDEX_STYLE ];
return lResult;
}
@@ -1724,15 +1746,16 @@ Sequence< OUString > AddonsOptions_Impl::GetPropertyNamesStatusbarItem(
std::u16string_view aPropertyRootNode ) const
{
Sequence< OUString > lResult( PROPERTYCOUNT_STATUSBARITEM );
+ auto plResult = lResult.getArray();
- lResult[0] = OUString( aPropertyRootNode + m_aPropNames[ INDEX_URL ] );
- lResult[1] = OUString( aPropertyRootNode + m_aPropNames[ INDEX_TITLE ] );
- lResult[2] = OUString( aPropertyRootNode + m_aPropNames[ INDEX_CONTEXT ] );
- lResult[3] = OUString( aPropertyRootNode + m_aPropNames[ INDEX_ALIGN ] );
- lResult[4] = OUString( aPropertyRootNode + m_aPropNames[ INDEX_AUTOSIZE ] );
- lResult[5] = OUString( aPropertyRootNode + m_aPropNames[ INDEX_OWNERDRAW ] );
- lResult[6] = OUString( aPropertyRootNode + m_aPropNames[ INDEX_MANDATORY ] );
- lResult[7] = OUString( aPropertyRootNode + m_aPropNames[ INDEX_WIDTH ] );
+ plResult[0] = OUString( aPropertyRootNode + m_aPropNames[ INDEX_URL ] );
+ plResult[1] = OUString( aPropertyRootNode + m_aPropNames[ INDEX_TITLE ] );
+ plResult[2] = OUString( aPropertyRootNode + m_aPropNames[ INDEX_CONTEXT ] );
+ plResult[3] = OUString( aPropertyRootNode + m_aPropNames[ INDEX_ALIGN ] );
+ plResult[4] = OUString( aPropertyRootNode + m_aPropNames[ INDEX_AUTOSIZE ] );
+ plResult[5] = OUString( aPropertyRootNode + m_aPropNames[ INDEX_OWNERDRAW ] );
+ plResult[6] = OUString( aPropertyRootNode + m_aPropNames[ INDEX_MANDATORY ] );
+ plResult[7] = OUString( aPropertyRootNode + m_aPropNames[ INDEX_WIDTH ] );
return lResult;
}
@@ -1740,16 +1763,17 @@ Sequence< OUString > AddonsOptions_Impl::GetPropertyNamesStatusbarItem(
Sequence< OUString > AddonsOptions_Impl::GetPropertyNamesImages( std::u16string_view aPropertyRootNode ) const
{
Sequence< OUString > lResult( PROPERTYCOUNT_IMAGES );
+ auto plResult = lResult.getArray();
// Create property names dependent from the root node name
- lResult[0] = aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_SMALL ];
- lResult[1] = aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_BIG ];
- lResult[2] = aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_SMALLHC ];
- lResult[3] = aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_BIGHC ];
- lResult[4] = aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_SMALL_URL ];
- lResult[5] = aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_BIG_URL ];
- lResult[6] = aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_SMALLHC_URL];
- lResult[7] = aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_BIGHC_URL ];
+ plResult[0] = aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_SMALL ];
+ plResult[1] = aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_BIG ];
+ plResult[2] = aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_SMALLHC ];
+ plResult[3] = aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_BIGHC ];
+ plResult[4] = aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_SMALL_URL ];
+ plResult[5] = aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_BIG_URL ];
+ plResult[6] = aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_SMALLHC_URL];
+ plResult[7] = aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_BIGHC_URL ];
return lResult;
}
diff --git a/framework/source/fwe/classes/framelistanalyzer.cxx b/framework/source/fwe/classes/framelistanalyzer.cxx
index 55edf314703c..d524d23fdf2f 100644
--- a/framework/source/fwe/classes/framelistanalyzer.cxx
+++ b/framework/source/fwe/classes/framelistanalyzer.cxx
@@ -29,7 +29,7 @@
#include <com/sun/star/frame/XFrame.hpp>
#include <comphelper/processfactory.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <sal/log.hxx>
namespace framework{
diff --git a/framework/source/fwe/classes/imagewrapper.cxx b/framework/source/fwe/classes/imagewrapper.cxx
deleted file mode 100644
index 978ef77a474f..000000000000
--- a/framework/source/fwe/classes/imagewrapper.cxx
+++ /dev/null
@@ -1,86 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <classes/imagewrapper.hxx>
-#include <comphelper/servicehelper.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/bitmapex.hxx>
-#include <vcl/BitmapTools.hxx>
-#include <tools/stream.hxx>
-#include <vcl/dibtools.hxx>
-
-using namespace com::sun::star::lang;
-using namespace com::sun::star::uno;
-
-namespace framework
-{
-
-static Sequence< sal_Int8 > const & impl_getStaticIdentifier()
-{
- static const sal_uInt8 pGUID[16] = { 0x46, 0xAD, 0x69, 0xFB, 0xA7, 0xBE, 0x44, 0x83, 0xB2, 0xA7, 0xB3, 0xEC, 0x59, 0x4A, 0xB7, 0x00 };
- static css::uno::Sequence< sal_Int8 > seqID(reinterpret_cast<const sal_Int8*>(pGUID), 16);
- return seqID;
-}
-
-ImageWrapper::ImageWrapper( const Image& aImage ) : m_aImage( aImage )
-{
-}
-
-ImageWrapper::~ImageWrapper()
-{
-}
-
-Sequence<sal_Int8> const& ImageWrapper::getUnoTunnelId() { return impl_getStaticIdentifier(); }
-
-// XBitmap
-css::awt::Size SAL_CALL ImageWrapper::getSize()
-{
- SolarMutexGuard aGuard;
-
- BitmapEx aBitmapEx( m_aImage.GetBitmapEx() );
- Size aBitmapSize( aBitmapEx.GetSizePixel() );
-
- return css::awt::Size( aBitmapSize.Width(), aBitmapSize.Height() );
-}
-
-Sequence< sal_Int8 > SAL_CALL ImageWrapper::getDIB()
-{
- SolarMutexGuard aGuard;
-
- SvMemoryStream aMem;
- WriteDIB(m_aImage.GetBitmapEx().GetBitmap(), aMem, false, true);
- return Sequence< sal_Int8 >( static_cast<sal_Int8 const *>(aMem.GetData()), aMem.Tell() );
-}
-
-Sequence< sal_Int8 > SAL_CALL ImageWrapper::getMaskDIB()
-{
- SolarMutexGuard aGuard;
-
- return vcl::bitmap::GetMaskDIB(m_aImage.GetBitmapEx());
-}
-
-// XUnoTunnel
-sal_Int64 SAL_CALL ImageWrapper::getSomething( const Sequence< sal_Int8 >& aIdentifier )
-{
- return comphelper::getSomethingImpl(aIdentifier, this);
-}
-
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/source/fwe/classes/rootactiontriggercontainer.cxx b/framework/source/fwe/classes/rootactiontriggercontainer.cxx
index f49cf9c70c5e..1493f08bf429 100644
--- a/framework/source/fwe/classes/rootactiontriggercontainer.cxx
+++ b/framework/source/fwe/classes/rootactiontriggercontainer.cxx
@@ -26,6 +26,7 @@
#include <cppuhelper/queryinterface.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <framework/actiontriggerhelper.hxx>
+#include <utility>
#include <vcl/svapp.hxx>
using namespace cppu;
@@ -37,17 +38,11 @@ using namespace com::sun::star::beans;
namespace framework
{
-const css::uno::Sequence<sal_Int8>& RootActionTriggerContainer::getUnoTunnelId() noexcept
-{
- static const sal_uInt8 pGUID[16] = { 0x17, 0x0F, 0xA2, 0xC9, 0xCA, 0x50, 0x4A, 0xD3, 0xA6, 0x3B, 0x39, 0x99, 0xC5, 0x96, 0x43, 0x27 };
- static css::uno::Sequence< sal_Int8 > seqID(reinterpret_cast<const sal_Int8*>(pGUID), 16);
- return seqID;
-}
-
-RootActionTriggerContainer::RootActionTriggerContainer( const Menu* pMenu, const OUString* pMenuIdentifier ) :
- m_bContainerCreated( false )
- , m_pMenu( pMenu )
- , m_pMenuIdentifier( pMenuIdentifier )
+RootActionTriggerContainer::RootActionTriggerContainer(css::uno::Reference<css::awt::XPopupMenu> xMenu,
+ const OUString* pMenuIdentifier)
+ : m_bContainerCreated(false)
+ , m_xMenu(std::move(xMenu))
+ , m_pMenuIdentifier(pMenuIdentifier)
{
}
@@ -62,7 +57,6 @@ Any SAL_CALL RootActionTriggerContainer::queryInterface( const Type& aType )
aType ,
static_cast< XMultiServiceFactory* >(this),
static_cast< XServiceInfo* >(this),
- static_cast< XUnoTunnel* >(this),
static_cast< XTypeProvider* >(this),
static_cast< XNamed* >(this));
@@ -104,12 +98,9 @@ Reference< XInterface > SAL_CALL RootActionTriggerContainer::createInstanceWithA
Sequence< OUString > SAL_CALL RootActionTriggerContainer::getAvailableServiceNames()
{
- Sequence< OUString > aSeq( 3 );
-
- aSeq[0] = SERVICENAME_ACTIONTRIGGER;
- aSeq[1] = SERVICENAME_ACTIONTRIGGERCONTAINER;
- aSeq[2] = SERVICENAME_ACTIONTRIGGERSEPARATOR;
-
+ Sequence< OUString > aSeq{ SERVICENAME_ACTIONTRIGGER,
+ SERVICENAME_ACTIONTRIGGERCONTAINER,
+ SERVICENAME_ACTIONTRIGGERSEPARATOR };
return aSeq;
}
@@ -152,11 +143,8 @@ sal_Int32 SAL_CALL RootActionTriggerContainer::getCount()
if ( !m_bContainerCreated )
{
- if ( m_pMenu )
- {
- SolarMutexGuard aSolarMutexGuard;
- return m_pMenu->GetItemCount();
- }
+ if ( m_xMenu )
+ return m_xMenu->getItemCount();
else
return 0;
}
@@ -184,12 +172,8 @@ Type SAL_CALL RootActionTriggerContainer::getElementType()
sal_Bool SAL_CALL RootActionTriggerContainer::hasElements()
{
- if ( m_pMenu )
- {
- SolarMutexGuard aSolarMutexGuard;
- return ( m_pMenu->GetItemCount() > 0 );
- }
-
+ if (m_xMenu)
+ return m_xMenu->getItemCount() > 0;
return false;
}
@@ -209,12 +193,6 @@ Sequence< OUString > SAL_CALL RootActionTriggerContainer::getSupportedServiceNam
return { SERVICENAME_ACTIONTRIGGERCONTAINER };
}
-// XUnoTunnel
-sal_Int64 SAL_CALL RootActionTriggerContainer::getSomething( const Sequence< sal_Int8 >& aIdentifier )
-{
- return comphelper::getSomethingImpl(aIdentifier, this);
-}
-
// XTypeProvider
Sequence< Type > SAL_CALL RootActionTriggerContainer::getTypes()
{
@@ -240,8 +218,7 @@ void RootActionTriggerContainer::FillContainer()
{
m_bContainerCreated = true;
ActionTriggerHelper::FillActionTriggerContainerFromMenu(
- this,
- m_pMenu );
+ this, m_xMenu);
}
OUString RootActionTriggerContainer::getName()
{
diff --git a/framework/source/fwe/classes/sfxhelperfunctions.cxx b/framework/source/fwe/classes/sfxhelperfunctions.cxx
index 06f48f1fe695..5a1cc0d716d5 100644
--- a/framework/source/fwe/classes/sfxhelperfunctions.cxx
+++ b/framework/source/fwe/classes/sfxhelperfunctions.cxx
@@ -24,7 +24,6 @@
#include <svtools/statusbarcontroller.hxx>
static pfunc_setToolBoxControllerCreator pToolBoxControllerCreator = nullptr;
-static pfunc_setWeldToolBoxControllerCreator pWeldToolBoxControllerCreator = nullptr;
static pfunc_setStatusBarControllerCreator pStatusBarControllerCreator = nullptr;
static pfunc_getRefreshToolbars pRefreshToolbars = nullptr;
static pfunc_createDockingWindow pCreateDockingWindow = nullptr;
@@ -58,28 +57,6 @@ rtl::Reference<svt::ToolboxController> CreateToolBoxController( const Reference<
return nullptr;
}
-pfunc_setWeldToolBoxControllerCreator SetWeldToolBoxControllerCreator( pfunc_setWeldToolBoxControllerCreator pSetWeldToolBoxControllerCreator )
-{
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- pfunc_setWeldToolBoxControllerCreator pOldSetToolBoxControllerCreator = pWeldToolBoxControllerCreator;
- pWeldToolBoxControllerCreator = pSetWeldToolBoxControllerCreator;
- return pOldSetToolBoxControllerCreator;
-}
-
-css::uno::Reference<css::frame::XToolbarController> CreateWeldToolBoxController( const Reference< XFrame >& rFrame, weld::Toolbar* pToolbar, weld::Builder* pBuilder, const OUString& aCommandURL )
-{
- pfunc_setWeldToolBoxControllerCreator pFactory = nullptr;
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- pFactory = pWeldToolBoxControllerCreator;
- }
-
- if ( pFactory )
- return (*pFactory)( rFrame, pToolbar, pBuilder, aCommandURL );
- else
- return nullptr;
-}
-
pfunc_setStatusBarControllerCreator SetStatusBarControllerCreator( pfunc_setStatusBarControllerCreator pSetStatusBarControllerCreator )
{
::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
@@ -132,7 +109,7 @@ pfunc_createDockingWindow SetDockingWindowCreator( pfunc_createDockingWindow pNe
return pOldFunc;
}
-void CreateDockingWindow( const css::uno::Reference< css::frame::XFrame >& rFrame, const OUString& rResourceURL )
+void CreateDockingWindow( const css::uno::Reference< css::frame::XFrame >& rFrame, std::u16string_view rResourceURL )
{
pfunc_createDockingWindow pFactory = nullptr;
{
@@ -153,7 +130,7 @@ pfunc_isDockingWindowVisible SetIsDockingWindowVisible( pfunc_isDockingWindowVis
return pOldFunc;
}
-bool IsDockingWindowVisible( const css::uno::Reference< css::frame::XFrame >& rFrame, const OUString& rResourceURL )
+bool IsDockingWindowVisible( const css::uno::Reference< css::frame::XFrame >& rFrame, std::u16string_view rResourceURL )
{
pfunc_isDockingWindowVisible pCall = nullptr;
{
diff --git a/framework/source/fwe/dispatch/interaction.cxx b/framework/source/fwe/dispatch/interaction.cxx
index 73be5153c37c..d0cf88e6f6f8 100644
--- a/framework/source/fwe/dispatch/interaction.cxx
+++ b/framework/source/fwe/dispatch/interaction.cxx
@@ -21,6 +21,7 @@
#include <framework/interaction.hxx>
#include <com/sun/star/document/XInteractionFilterSelect.hpp>
#include <com/sun/star/document/NoSuchFilterRequest.hpp>
+#include <utility>
using namespace ::com::sun::star;
@@ -191,9 +192,9 @@ class InteractionRequest_Impl : public ::cppu::WeakImplHelper< css::task::XInter
uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > m_lContinuations;
public:
- InteractionRequest_Impl( const css::uno::Any& aRequest,
+ InteractionRequest_Impl( css::uno::Any aRequest,
const css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > >& lContinuations )
- : m_aRequest(aRequest), m_lContinuations(lContinuations)
+ : m_aRequest(std::move(aRequest)), m_lContinuations(lContinuations)
{
}
diff --git a/framework/source/fwe/helper/actiontriggerhelper.cxx b/framework/source/fwe/helper/actiontriggerhelper.cxx
index d96e44cb9bae..88edd70beb79 100644
--- a/framework/source/fwe/helper/actiontriggerhelper.cxx
+++ b/framework/source/fwe/helper/actiontriggerhelper.cxx
@@ -20,17 +20,18 @@
#include <framework/actiontriggerhelper.hxx>
#include <classes/actiontriggerseparatorpropertyset.hxx>
#include <classes/rootactiontriggercontainer.hxx>
-#include <classes/imagewrapper.hxx>
#include <framework/addonsoptions.hxx>
+#include <com/sun/star/awt/XBitmap.hpp>
+#include <com/sun/star/awt/XPopupMenu.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/awt/XBitmap.hpp>
-#include <vcl/svapp.hxx>
+#include <toolkit/awt/vclxmenu.hxx>
#include <tools/stream.hxx>
-#include <comphelper/servicehelper.hxx>
-#include <cppuhelper/weak.hxx>
#include <vcl/dibtools.hxx>
+#include <vcl/graph.hxx>
+#include <vcl/svapp.hxx>
+#include <o3tl/string_view.hxx>
const sal_uInt16 START_ITEMID = 1000;
@@ -95,7 +96,8 @@ static void GetMenuItemAttributes( const Reference< XPropertySet >& xActionTrigg
}
}
-static void InsertSubMenuItems( Menu* pSubMenu, sal_uInt16& nItemId, const Reference< XIndexContainer >& xActionTriggerContainer )
+static void InsertSubMenuItems(const Reference<XPopupMenu>& rSubMenu, sal_uInt16& nItemId,
+ const Reference<XIndexContainer>& xActionTriggerContainer)
{
if ( !xActionTriggerContainer.is() )
return;
@@ -114,7 +116,7 @@ static void InsertSubMenuItems( Menu* pSubMenu, sal_uInt16& nItemId, const Refer
{
// Separator
SolarMutexGuard aGuard;
- pSubMenu->InsertSeparator();
+ rSubMenu->insertSeparator(i);
}
else
{
@@ -138,13 +140,13 @@ static void InsertSubMenuItems( Menu* pSubMenu, sal_uInt16& nItemId, const Refer
// command url but uses the item id as a unique identifier. These entries
// got a special url during conversion from menu=>actiontriggercontainer.
// Now we have to extract this special url and set the correct item id!!!
- nNewItemId = static_cast<sal_uInt16>(aCommandURL.copy( nIndex+aSlotURL.getLength() ).toInt32());
- pSubMenu->InsertItem( nNewItemId, aLabel );
+ nNewItemId = static_cast<sal_uInt16>(o3tl::toInt32(aCommandURL.subView( nIndex+aSlotURL.getLength() )));
+ rSubMenu->insertItem(nNewItemId, aLabel, 0, i);
}
else
{
- pSubMenu->InsertItem( nNewItemId, aLabel );
- pSubMenu->SetItemCommand( nNewItemId, aCommandURL );
+ rSubMenu->insertItem(nNewItemId, aLabel, 0, i);
+ rSubMenu->setCommand(nNewItemId, aCommandURL);
}
// handle bitmap
@@ -152,16 +154,11 @@ static void InsertSubMenuItems( Menu* pSubMenu, sal_uInt16& nItemId, const Refer
{
bool bImageSet = false;
- Reference< XUnoTunnel > xUnoTunnel( xBitmap, UNO_QUERY );
- // Try to get implementation pointer through XUnoTunnel
- if (auto pImageWrapper = comphelper::getFromUnoTunnel<ImageWrapper>(xUnoTunnel))
+ Reference<css::graphic::XGraphic> xGraphic(xBitmap, UNO_QUERY);
+ if (xGraphic.is())
{
- // This is our own optimized implementation of menu images!
- const Image& aMenuImage = pImageWrapper->GetImage();
-
- if ( !!aMenuImage )
- pSubMenu->SetItemImage( nNewItemId, aMenuImage );
-
+ // we can take the optimized route if XGraphic is supported
+ rSubMenu->setItemImage(nNewItemId, xGraphic, false);
bImageSet = true;
}
@@ -169,7 +166,6 @@ static void InsertSubMenuItems( Menu* pSubMenu, sal_uInt16& nItemId, const Refer
{
// This is an unknown implementation of a XBitmap interface. We have to
// use a more time consuming way to build an Image!
- Image aImage;
BitmapEx aBitmap;
Sequence< sal_Int8 > aDIBSeq;
@@ -185,30 +181,28 @@ static void InsertSubMenuItems( Menu* pSubMenu, sal_uInt16& nItemId, const Refer
Bitmap aMaskBitmap;
SvMemoryStream aMem( const_cast<sal_Int8 *>(aDIBSeq.getConstArray()), aDIBSeq.getLength(), StreamMode::READ );
ReadDIB(aMaskBitmap, aMem, true);
- aImage = Image(BitmapEx(aBitmap.GetBitmap(), aMaskBitmap));
+ aBitmap = BitmapEx(aBitmap.GetBitmap(), aMaskBitmap);
}
- else
- aImage = Image( aBitmap );
- if ( !!aImage )
- pSubMenu->SetItemImage( nNewItemId, aImage );
+ if (!aBitmap.IsEmpty())
+ rSubMenu->setItemImage(nNewItemId, Graphic(aBitmap).GetXGraphic(), false);
}
}
else
{
// Support add-on images for context menu interceptors
- Image aImage(aAddonOptions.GetImageFromURL(aCommandURL, false, true));
- if ( !!aImage )
- pSubMenu->SetItemImage( nNewItemId, aImage );
+ BitmapEx aBitmap(aAddonOptions.GetImageFromURL(aCommandURL, false, true));
+ if (!aBitmap.IsEmpty())
+ rSubMenu->setItemImage(nNewItemId, Graphic(aBitmap).GetXGraphic(), false);
}
if ( xSubContainer.is() )
{
- VclPtr<PopupMenu> pNewSubMenu = VclPtr<PopupMenu>::Create();
+ rtl::Reference xNewSubMenu(new VCLXPopupMenu);
// Sub menu (recursive call CreateSubMenu )
- InsertSubMenuItems( pNewSubMenu, nItemId, xSubContainer );
- pSubMenu->SetPopupMenu( nNewItemId, pNewSubMenu );
+ InsertSubMenuItems(xNewSubMenu, nItemId, xSubContainer);
+ rSubMenu->setPopupMenu(nNewItemId, xNewSubMenu);
}
}
}
@@ -232,7 +226,9 @@ static void InsertSubMenuItems( Menu* pSubMenu, sal_uInt16& nItemId, const Refer
// implementation helper ( ActionTrigger => menu )
/// @throws RuntimeException
-static Reference< XPropertySet > CreateActionTrigger( sal_uInt16 nItemId, const Menu* pMenu, const Reference< XIndexContainer >& rActionTriggerContainer )
+static Reference< XPropertySet > CreateActionTrigger(sal_uInt16 nItemId,
+ const Reference<XPopupMenu>& rMenu,
+ const Reference<XIndexContainer>& rActionTriggerContainer)
{
Reference< XPropertySet > xPropSet;
@@ -247,11 +243,11 @@ static Reference< XPropertySet > CreateActionTrigger( sal_uInt16 nItemId, const
try
{
// Retrieve the menu attributes and set them in our PropertySet
- OUString aLabel = pMenu->GetItemText( nItemId );
+ OUString aLabel = rMenu->getItemText(nItemId);
a <<= aLabel;
xPropSet->setPropertyValue("Text", a );
- OUString aCommandURL = pMenu->GetItemCommand( nItemId );
+ OUString aCommandURL = rMenu->getCommand(nItemId);
if ( aCommandURL.isEmpty() )
{
@@ -261,11 +257,9 @@ static Reference< XPropertySet > CreateActionTrigger( sal_uInt16 nItemId, const
a <<= aCommandURL;
xPropSet->setPropertyValue("CommandURL", a );
- Image aImage = pMenu->GetItemImage( nItemId );
- if ( !!aImage )
+ Reference<XBitmap> xBitmap(rMenu->getItemImage(nItemId), UNO_QUERY);
+ if (xBitmap.is())
{
- // We use our own optimized XBitmap implementation
- Reference< XBitmap > xBitmap = new ImageWrapper( aImage );
a <<= xBitmap;
xPropSet->setPropertyValue("Image", a );
}
@@ -306,21 +300,22 @@ static Reference< XIndexContainer > CreateActionTriggerContainer( const Referenc
return Reference< XIndexContainer >();
}
-static void FillActionTriggerContainerWithMenu( const Menu* pMenu, Reference< XIndexContainer > const & rActionTriggerContainer )
+static void FillActionTriggerContainerWithMenu(const Reference<XPopupMenu>& rMenu,
+ const Reference<XIndexContainer>& rActionTriggerContainer)
{
SolarMutexGuard aGuard;
- for ( sal_uInt16 nPos = 0; nPos < pMenu->GetItemCount(); nPos++ )
+ for (sal_uInt16 nPos = 0, nCount = rMenu->getItemCount(); nPos < nCount; ++nPos)
{
- sal_uInt16 nItemId = pMenu->GetItemId( nPos );
- ::MenuItemType nType = pMenu->GetItemType( nPos );
+ sal_uInt16 nItemId = rMenu->getItemId(nPos);
+ css::awt::MenuItemType nType = rMenu->getItemType(nPos);
try
{
Any a;
Reference< XPropertySet > xPropSet;
- if ( nType == ::MenuItemType::SEPARATOR )
+ if (nType == css::awt::MenuItemType_SEPARATOR)
{
xPropSet = CreateActionTriggerSeparator( rActionTriggerContainer );
@@ -329,20 +324,20 @@ static void FillActionTriggerContainerWithMenu( const Menu* pMenu, Reference< XI
}
else
{
- xPropSet = CreateActionTrigger( nItemId, pMenu, rActionTriggerContainer );
+ xPropSet = CreateActionTrigger(nItemId, rMenu, rActionTriggerContainer);
a <<= xPropSet;
rActionTriggerContainer->insertByIndex( nPos, a );
- PopupMenu* pPopupMenu = pMenu->GetPopupMenu( nItemId );
- if ( pPopupMenu )
+ css::uno::Reference<XPopupMenu> xPopupMenu = rMenu->getPopupMenu(nItemId);
+ if (xPopupMenu.is())
{
// recursive call to build next sub menu
Reference< XIndexContainer > xSubContainer = CreateActionTriggerContainer( rActionTriggerContainer );
a <<= xSubContainer;
xPropSet->setPropertyValue("SubContainer", a );
- FillActionTriggerContainerWithMenu( pPopupMenu, xSubContainer );
+ FillActionTriggerContainerWithMenu(xPopupMenu, xSubContainer);
}
}
}
@@ -353,27 +348,27 @@ static void FillActionTriggerContainerWithMenu( const Menu* pMenu, Reference< XI
}
void ActionTriggerHelper::CreateMenuFromActionTriggerContainer(
- Menu* pNewMenu,
- const Reference< XIndexContainer >& rActionTriggerContainer )
+ const Reference<XPopupMenu>& rNewMenu,
+ const Reference<XIndexContainer>& rActionTriggerContainer)
{
sal_uInt16 nItemId = START_ITEMID;
if ( rActionTriggerContainer.is() )
- InsertSubMenuItems( pNewMenu, nItemId, rActionTriggerContainer );
+ InsertSubMenuItems(rNewMenu, nItemId, rActionTriggerContainer);
}
void ActionTriggerHelper::FillActionTriggerContainerFromMenu(
Reference< XIndexContainer > const & xActionTriggerContainer,
- const Menu* pMenu )
+ const css::uno::Reference<XPopupMenu>& rMenu)
{
- FillActionTriggerContainerWithMenu( pMenu, xActionTriggerContainer );
+ FillActionTriggerContainerWithMenu(rMenu, xActionTriggerContainer);
}
Reference< XIndexContainer > ActionTriggerHelper::CreateActionTriggerContainerFromMenu(
- const Menu* pMenu,
+ const css::uno::Reference<XPopupMenu>& rMenu,
const OUString* pMenuIdentifier )
{
- return new RootActionTriggerContainer( pMenu, pMenuIdentifier );
+ return new RootActionTriggerContainer(rMenu, pMenuIdentifier);
}
}
diff --git a/framework/source/fwe/helper/documentundoguard.cxx b/framework/source/fwe/helper/documentundoguard.cxx
index 5f7d16041caa..f578d8682731 100644
--- a/framework/source/fwe/helper/documentundoguard.cxx
+++ b/framework/source/fwe/helper/documentundoguard.cxx
@@ -23,7 +23,7 @@
#include <cppuhelper/implbase.hxx>
#include <rtl/ref.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace framework
{
@@ -31,7 +31,6 @@ namespace framework
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::XInterface;
using ::com::sun::star::uno::UNO_QUERY;
- using ::com::sun::star::uno::UNO_QUERY_THROW;
using ::com::sun::star::uno::Exception;
using ::com::sun::star::document::XUndoManagerSupplier;
using ::com::sun::star::document::XUndoManager;
@@ -44,8 +43,6 @@ namespace framework
typedef ::cppu::WeakImplHelper < XUndoManagerListener
> UndoManagerContextListener_Base;
- namespace {
-
class UndoManagerContextListener : public UndoManagerContextListener_Base
{
public:
@@ -100,8 +97,6 @@ namespace framework
bool m_documentDisposed;
};
- }
-
void SAL_CALL UndoManagerContextListener::undoActionAdded( const UndoManagerEvent& )
{
// not interested in
@@ -162,60 +157,37 @@ namespace framework
m_documentDisposed = true;
}
- //= DocumentUndoGuard_Data
-
- struct DocumentUndoGuard_Data
- {
- Reference< XUndoManager > xUndoManager;
- ::rtl::Reference< UndoManagerContextListener > pContextListener;
- };
+ //= DocumentUndoGuard
- namespace
+ DocumentUndoGuard::DocumentUndoGuard( const Reference< XInterface >& i_undoSupplierComponent )
{
-
- void lcl_init( DocumentUndoGuard_Data& i_data, const Reference< XInterface >& i_undoSupplierComponent )
+ try
{
- try
- {
- Reference< XUndoManagerSupplier > xUndoSupplier( i_undoSupplierComponent, UNO_QUERY );
- if ( xUndoSupplier.is() )
- i_data.xUndoManager.set( xUndoSupplier->getUndoManager(), css::uno::UNO_SET_THROW );
+ Reference< XUndoManagerSupplier > xUndoSupplier( i_undoSupplierComponent, UNO_QUERY );
+ if ( xUndoSupplier.is() )
+ mxUndoManager.set( xUndoSupplier->getUndoManager(), css::uno::UNO_SET_THROW );
- if ( i_data.xUndoManager.is() )
- i_data.pContextListener.set( new UndoManagerContextListener( i_data.xUndoManager ) );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION("fwk");
- }
+ if ( mxUndoManager.is() )
+ mxContextListener.set( new UndoManagerContextListener( mxUndoManager ) );
}
-
- void lcl_restore( DocumentUndoGuard_Data& i_data )
+ catch( const Exception& )
{
- try
- {
- if ( i_data.pContextListener.is() )
- i_data.pContextListener->finish();
- i_data.pContextListener.clear();
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION("fwk");
- }
+ DBG_UNHANDLED_EXCEPTION("fwk");
}
}
- //= DocumentUndoGuard
-
- DocumentUndoGuard::DocumentUndoGuard( const Reference< XInterface >& i_undoSupplierComponent )
- :m_xData( new DocumentUndoGuard_Data )
- {
- lcl_init( *m_xData, i_undoSupplierComponent );
- }
-
DocumentUndoGuard::~DocumentUndoGuard()
{
- lcl_restore( *m_xData );
+ try
+ {
+ if ( mxContextListener.is() )
+ mxContextListener->finish();
+ mxContextListener.clear();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION("fwk");
+ }
}
} // namespace framework
diff --git a/framework/source/fwe/helper/propertysetcontainer.cxx b/framework/source/fwe/helper/propertysetcontainer.cxx
index ad7d639539b7..c766b40db56b 100644
--- a/framework/source/fwe/helper/propertysetcontainer.cxx
+++ b/framework/source/fwe/helper/propertysetcontainer.cxx
@@ -23,7 +23,7 @@
#include <cppuhelper/queryinterface.hxx>
#include <vcl/svapp.hxx>
-constexpr OUStringLiteral WRONG_TYPE_EXCEPTION = u"Only XPropertSet allowed!";
+constexpr OUString WRONG_TYPE_EXCEPTION = u"Only XPropertSet allowed!"_ustr;
using namespace cppu;
using namespace com::sun::star::uno;
@@ -73,7 +73,7 @@ Any SAL_CALL PropertySetContainer::queryInterface( const Type& rType )
// XIndexContainer
void SAL_CALL PropertySetContainer::insertByIndex( sal_Int32 Index, const css::uno::Any& Element )
{
- SolarMutexGuard g;
+ std::unique_lock g(m_aMutex);
sal_Int32 nSize = m_aPropertySetVector.size();
@@ -101,7 +101,7 @@ void SAL_CALL PropertySetContainer::insertByIndex( sal_Int32 Index, const css::u
void SAL_CALL PropertySetContainer::removeByIndex( sal_Int32 nIndex )
{
- SolarMutexGuard g;
+ std::unique_lock g(m_aMutex);
if ( static_cast<sal_Int32>(m_aPropertySetVector.size()) <= nIndex )
throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) );
@@ -112,6 +112,8 @@ void SAL_CALL PropertySetContainer::removeByIndex( sal_Int32 nIndex )
// XIndexReplace
void SAL_CALL PropertySetContainer::replaceByIndex( sal_Int32 Index, const css::uno::Any& Element )
{
+ std::unique_lock g(m_aMutex);
+
if ( static_cast<sal_Int32>(m_aPropertySetVector.size()) <= Index )
throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) );
@@ -130,14 +132,14 @@ void SAL_CALL PropertySetContainer::replaceByIndex( sal_Int32 Index, const css::
// XIndexAccess
sal_Int32 SAL_CALL PropertySetContainer::getCount()
{
- SolarMutexGuard g;
+ std::unique_lock g(m_aMutex);
return m_aPropertySetVector.size();
}
Any SAL_CALL PropertySetContainer::getByIndex( sal_Int32 Index )
{
- SolarMutexGuard g;
+ std::unique_lock g(m_aMutex);
if ( static_cast<sal_Int32>(m_aPropertySetVector.size()) <= Index )
throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) );
@@ -148,7 +150,7 @@ Any SAL_CALL PropertySetContainer::getByIndex( sal_Int32 Index )
// XElementAccess
sal_Bool SAL_CALL PropertySetContainer::hasElements()
{
- SolarMutexGuard g;
+ std::unique_lock g(m_aMutex);
return !( m_aPropertySetVector.empty() );
}
diff --git a/framework/source/fwe/helper/titlehelper.cxx b/framework/source/fwe/helper/titlehelper.cxx
index a3854489d0f8..58c28f8f8ef9 100644
--- a/framework/source/fwe/helper/titlehelper.cxx
+++ b/framework/source/fwe/helper/titlehelper.cxx
@@ -17,8 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <config_features.h>
-
#include <framework/titlehelper.hxx>
#include <classes/fwkresid.hxx>
#include <strings.hrc>
@@ -31,6 +29,7 @@
#include <com/sun/star/frame/XModel3.hpp>
#include <com/sun/star/document/XDocumentEventBroadcaster.hpp>
+#include <comphelper/configuration.hxx>
#include <unotools/configmgr.hxx>
#include <unotools/bootstrap.hxx>
#include <unotools/mediadescriptor.hxx>
@@ -38,7 +37,7 @@
#include <rtl/ustrbuf.hxx>
#include <osl/mutex.hxx>
#include <tools/urlobj.hxx>
-#include <vcl/skia/SkiaHelper.hxx>
+#include <utility>
#include <vcl/svapp.hxx>
@@ -48,55 +47,39 @@ using namespace css::frame;
namespace framework{
-TitleHelper::TitleHelper(const css::uno::Reference< css::uno::XComponentContext >& rxContext)
- : ::cppu::BaseMutex ()
- , m_xContext (rxContext)
+TitleHelper::TitleHelper(css::uno::Reference< css::uno::XComponentContext > xContext,
+ const css::uno::Reference< css::uno::XInterface >& xOwner,
+ const css::uno::Reference< css::frame::XUntitledNumbers >& xNumbers)
+ :
+ m_xContext (std::move(xContext))
+ , m_xOwner (xOwner)
+ , m_xUntitledNumbers(xNumbers)
, m_bExternalTitle (false)
, m_nLeasedNumber (css::frame::UntitledNumbersConst::INVALID_NUMBER)
- , m_aListener (m_aMutex)
-{
-}
-
-TitleHelper::~TitleHelper()
-{
-}
-
-void TitleHelper::setOwner(const css::uno::Reference< css::uno::XInterface >& xOwner)
{
- // SYNCHRONIZED ->
- {
- osl::MutexGuard aLock(m_aMutex);
-
- m_xOwner = xOwner;
- }
- // <- SYNCHRONIZED
-
- css::uno::Reference< css::frame::XModel > xModel(xOwner, css::uno::UNO_QUERY);
- if (xModel.is ())
+ if (css::uno::Reference<css::frame::XModel> xModel{ xOwner, css::uno::UNO_QUERY })
{
impl_startListeningForModel (xModel);
- return;
}
-
- css::uno::Reference< css::frame::XController > xController(xOwner, css::uno::UNO_QUERY);
- if (xController.is ())
+ else if (css::uno::Reference<css::frame::XController> xController{ xOwner,
+ css::uno::UNO_QUERY })
{
impl_startListeningForController (xController);
- return;
}
-
- css::uno::Reference< css::frame::XFrame > xFrame(xOwner, css::uno::UNO_QUERY);
- if (xFrame.is ())
+ else if (css::uno::Reference<css::frame::XFrame> xFrame{ xOwner, css::uno::UNO_QUERY })
{
impl_startListeningForFrame (xFrame);
- return;
}
}
+TitleHelper::~TitleHelper()
+{
+}
+
OUString SAL_CALL TitleHelper::getTitle()
{
// SYNCHRONIZED ->
- osl::MutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
// An external title will win always and disable all internal logic about
// creating/using a title value.
@@ -108,27 +91,20 @@ OUString SAL_CALL TitleHelper::getTitle()
if (!m_sTitle.isEmpty())
return m_sTitle;
- // Title seems to be unused till now ... do bootstraping
+ // Title seems to be unused till now ... do bootstrapping
+ aLock.unlock();
impl_updateTitle (true);
+ aLock.lock();
return m_sTitle;
// <- SYNCHRONIZED
}
-void TitleHelper::connectWithUntitledNumbers (const css::uno::Reference< css::frame::XUntitledNumbers >& xNumbers)
-{
- // SYNCHRONIZED ->
- osl::MutexGuard aLock(m_aMutex);
-
- m_xUntitledNumbers = xNumbers;
- // <- SYNCHRONIZED
-}
-
void SAL_CALL TitleHelper::setTitle(const OUString& sTitle)
{
// SYNCHRONIZED ->
{
- osl::MutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
m_bExternalTitle = true;
m_sTitle = sTitle;
@@ -140,14 +116,14 @@ void SAL_CALL TitleHelper::setTitle(const OUString& sTitle)
void SAL_CALL TitleHelper::addTitleChangeListener(const css::uno::Reference< css::frame::XTitleChangeListener >& xListener)
{
- // container is threadsafe by himself
- m_aListener.addInterface( cppu::UnoType<css::frame::XTitleChangeListener>::get(), xListener );
+ std::unique_lock aLock(m_aMutex);
+ m_aTitleChangeListeners.addInterface( aLock, xListener );
}
void SAL_CALL TitleHelper::removeTitleChangeListener(const css::uno::Reference< css::frame::XTitleChangeListener >& xListener)
{
- // container is threadsafe by himself
- m_aListener.removeInterface( cppu::UnoType<css::frame::XTitleChangeListener>::get(), xListener );
+ std::unique_lock aLock(m_aMutex);
+ m_aTitleChangeListeners.removeInterface( aLock, xListener );
}
void SAL_CALL TitleHelper::titleChanged(const css::frame::TitleChangedEvent& aEvent)
@@ -155,9 +131,9 @@ void SAL_CALL TitleHelper::titleChanged(const css::frame::TitleChangedEvent& aEv
css::uno::Reference< css::frame::XTitle > xSubTitle;
// SYNCHRONIZED ->
{
- osl::MutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
- xSubTitle.set(m_xSubTitle.get (), css::uno::UNO_QUERY);
+ xSubTitle = m_xSubTitle;
}
// <- SYNCHRONIZED
@@ -177,9 +153,9 @@ void SAL_CALL TitleHelper::documentEventOccured(const css::document::DocumentEve
css::uno::Reference< css::frame::XModel > xOwner;
// SYNCHRONIZED ->
{
- osl::MutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
- xOwner.set(m_xOwner.get (), css::uno::UNO_QUERY);
+ xOwner.set(m_xOwner, css::uno::UNO_QUERY);
}
// <- SYNCHRONIZED
@@ -199,9 +175,9 @@ void SAL_CALL TitleHelper::frameAction(const css::frame::FrameActionEvent& aEven
css::uno::Reference< css::frame::XFrame > xOwner;
// SYNCHRONIZED ->
{
- osl::MutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
- xOwner.set(m_xOwner.get (), css::uno::UNO_QUERY);
+ xOwner.set(m_xOwner, css::uno::UNO_QUERY);
}
// <- SYNCHRONIZED
@@ -228,10 +204,10 @@ void SAL_CALL TitleHelper::disposing(const css::lang::EventObject& aEvent)
::sal_Int32 nLeasedNumber;
// SYNCHRONIZED ->
{
- osl::MutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
xOwner = m_xOwner;
- xNumbers.set(m_xUntitledNumbers.get(), css::uno::UNO_QUERY);
+ xNumbers = m_xUntitledNumbers;
nLeasedNumber = m_nLeasedNumber;
}
// <- SYNCHRONIZED
@@ -254,10 +230,10 @@ void SAL_CALL TitleHelper::disposing(const css::lang::EventObject& aEvent)
// SYNCHRONIZED ->
{
- osl::MutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
- m_xOwner = nullptr;
- m_sTitle = OUString ();
+ m_xOwner.clear();
+ m_sTitle.clear();
m_nLeasedNumber = css::frame::UntitledNumbersConst::INVALID_NUMBER;
}
// <- SYNCHRONIZED
@@ -268,7 +244,7 @@ void TitleHelper::impl_sendTitleChangedEvent ()
css::uno::Reference<css::uno::XInterface> xOwner;
// SYNCHRONIZED ->
{
- osl::MutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
xOwner = m_xOwner;
}
@@ -279,53 +255,60 @@ void TitleHelper::impl_sendTitleChangedEvent ()
if( ! aEvent.Source.is() )
return;
- comphelper::OInterfaceContainerHelper2* pContainer = m_aListener.getContainer( cppu::UnoType<css::frame::XTitleChangeListener>::get());
- if ( ! pContainer)
- return;
-
- comphelper::OInterfaceIteratorHelper2 pIt( *pContainer );
+ std::unique_lock aLock(m_aMutex);
+ comphelper::OInterfaceIteratorHelper4 pIt( aLock, m_aTitleChangeListeners );
while ( pIt.hasMoreElements() )
{
+ aLock.unlock();
try
{
- static_cast<css::frame::XTitleChangeListener*>(pIt.next())->titleChanged( aEvent );
+ uno::Reference<css::frame::XTitleChangeListener> i = pIt.next();
+ i->titleChanged( aEvent );
}
catch(const css::uno::Exception&)
{
- pIt.remove();
+ aLock.lock();
+ pIt.remove(aLock);
+ aLock.unlock();
}
+ aLock.lock();
}
}
void TitleHelper::impl_updateTitle (bool init)
{
- css::uno::Reference< css::frame::XModel3 > xModel;
- css::uno::Reference< css::frame::XController > xController;
- css::uno::Reference< css::frame::XFrame > xFrame;
+ css::uno::Reference<css::uno::XInterface> xOwner;
+
// SYNCHRONIZED ->
{
- osl::MutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
- xModel.set (m_xOwner.get(), css::uno::UNO_QUERY);
- xController.set(m_xOwner.get(), css::uno::UNO_QUERY);
- xFrame.set (m_xOwner.get(), css::uno::UNO_QUERY);
+ xOwner = m_xOwner;
}
// <- SYNCHRONIZED
- if (xModel.is ())
+ if (css::uno::Reference<css::frame::XModel3> xModel{ xOwner, css::uno::UNO_QUERY })
{
impl_updateTitleForModel (xModel, init);
}
- else if (xController.is ())
+ else if (css::uno::Reference<css::frame::XController> xController{ xOwner,
+ css::uno::UNO_QUERY })
{
impl_updateTitleForController (xController, init);
}
- else if (xFrame.is ())
+ else if (css::uno::Reference<css::frame::XFrame> xFrame{ xOwner, css::uno::UNO_QUERY })
{
impl_updateTitleForFrame (xFrame, init);
}
}
+static OUString getURLFromModel(const css::uno::Reference< css::frame::XModel3 >& xModel)
+{
+ if (css::uno::Reference<css::frame::XStorable> xURLProvider{ xModel, css::uno::UNO_QUERY })
+ return xURLProvider->getLocation();
+ return {};
+}
+
void TitleHelper::impl_updateTitleForModel (const css::uno::Reference< css::frame::XModel3 >& xModel, bool init)
{
css::uno::Reference< css::uno::XInterface > xOwner;
@@ -333,7 +316,7 @@ void TitleHelper::impl_updateTitleForModel (const css::uno::Reference< css::fram
::sal_Int32 nLeasedNumber;
// SYNCHRONIZED ->
{
- osl::MutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
// external title won't be updated internally!
// It has to be set from outside new.
@@ -341,7 +324,7 @@ void TitleHelper::impl_updateTitleForModel (const css::uno::Reference< css::fram
return;
xOwner = m_xOwner;
- xNumbers.set (m_xUntitledNumbers.get(), css::uno::UNO_QUERY);
+ xNumbers = m_xUntitledNumbers;
nLeasedNumber = m_nLeasedNumber;
}
// <- SYNCHRONIZED
@@ -354,24 +337,27 @@ void TitleHelper::impl_updateTitleForModel (const css::uno::Reference< css::fram
return;
OUString sTitle;
- OUString sURL;
- css::uno::Reference< css::frame::XStorable > xURLProvider(xModel , css::uno::UNO_QUERY);
- if (xURLProvider.is())
- sURL = xURLProvider->getLocation ();
+ utl::MediaDescriptor aDescriptor(
+ xModel->getArgs2({ utl::MediaDescriptor::PROP_DOCUMENTTITLE,
+ utl::MediaDescriptor::PROP_SUGGESTEDSAVEASNAME }));
- utl::MediaDescriptor aDescriptor(xModel->getArgs2( { utl::MediaDescriptor::PROP_SUGGESTEDSAVEASNAME() } ));
- const OUString sSuggestedSaveAsName = aDescriptor.getUnpackedValueOrDefault(
- utl::MediaDescriptor::PROP_SUGGESTEDSAVEASNAME(), OUString());
-
- if (!sURL.isEmpty())
+ if (const OUString sMediaTitle = aDescriptor.getUnpackedValueOrDefault(
+ utl::MediaDescriptor::PROP_DOCUMENTTITLE, OUString());
+ !sMediaTitle.isEmpty())
+ {
+ sTitle = sMediaTitle;
+ }
+ else if (const OUString sURL = getURLFromModel(xModel); !sURL.isEmpty())
{
sTitle = impl_convertURL2Title(sURL);
if (nLeasedNumber != css::frame::UntitledNumbersConst::INVALID_NUMBER)
xNumbers->releaseNumber (nLeasedNumber);
nLeasedNumber = css::frame::UntitledNumbersConst::INVALID_NUMBER;
}
- else if (!sSuggestedSaveAsName.isEmpty())
+ else if (const OUString sSuggestedSaveAsName = aDescriptor.getUnpackedValueOrDefault(
+ utl::MediaDescriptor::PROP_SUGGESTEDSAVEASNAME, OUString());
+ !sSuggestedSaveAsName.isEmpty())
{
// tdf#121537 Use suggested save as name for title if file has not yet been saved
sTitle = sSuggestedSaveAsName;
@@ -381,20 +367,16 @@ void TitleHelper::impl_updateTitleForModel (const css::uno::Reference< css::fram
if (nLeasedNumber == css::frame::UntitledNumbersConst::INVALID_NUMBER)
nLeasedNumber = xNumbers->leaseNumber (xOwner);
- OUStringBuffer sNewTitle(256);
- sNewTitle.append (xNumbers->getUntitledPrefix ());
if (nLeasedNumber != css::frame::UntitledNumbersConst::INVALID_NUMBER)
- sNewTitle.append(nLeasedNumber);
+ sTitle = xNumbers->getUntitledPrefix() + OUString::number(nLeasedNumber);
else
- sNewTitle.append("?");
-
- sTitle = sNewTitle.makeStringAndClear ();
+ sTitle = xNumbers->getUntitledPrefix() + "?";
}
bool bChanged;
// SYNCHRONIZED ->
{
- osl::MutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
// WORKAROUND: the notification is currently sent always,
// can be changed after shared mode is supported per UNO API
@@ -416,7 +398,7 @@ void TitleHelper::impl_updateTitleForController (const css::uno::Reference< css:
::sal_Int32 nLeasedNumber;
// SYNCHRONIZED ->
{
- osl::MutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
// external title won't be updated internally!
// It has to be set from outside new.
@@ -424,7 +406,7 @@ void TitleHelper::impl_updateTitleForController (const css::uno::Reference< css:
return;
xOwner = m_xOwner;
- xNumbers.set (m_xUntitledNumbers.get(), css::uno::UNO_QUERY);
+ xNumbers = m_xUntitledNumbers;
nLeasedNumber = m_nLeasedNumber;
}
// <- SYNCHRONIZED
@@ -450,8 +432,7 @@ void TitleHelper::impl_updateTitleForController (const css::uno::Reference< css:
sTitle.append (xModelTitle->getTitle ());
if ( nLeasedNumber > 1 )
{
- sTitle.append(" : ");
- sTitle.append(nLeasedNumber);
+ sTitle.append(" : " + OUString::number(nLeasedNumber));
}
if (xModel.is ())
{
@@ -476,7 +457,7 @@ void TitleHelper::impl_updateTitleForController (const css::uno::Reference< css:
bool bChanged;
// SYNCHRONIZED ->
{
- osl::MutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
OUString sNewTitle = sTitle.makeStringAndClear ();
bChanged = !init && m_sTitle != sNewTitle;
@@ -496,7 +477,7 @@ void TitleHelper::impl_updateTitleForFrame (const css::uno::Reference< css::fram
// SYNCHRONIZED ->
{
- osl::MutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
// external title won't be updated internally!
// It has to be set from outside new.
@@ -513,18 +494,21 @@ void TitleHelper::impl_updateTitleForFrame (const css::uno::Reference< css::fram
impl_appendComponentTitle (sTitle, xComponent);
#ifndef MACOSX
- // fdo#70376: We want the window title to contain just the
- // document name (from the above "component title").
- impl_appendProductName (sTitle);
- impl_appendModuleName (sTitle);
- impl_appendDebugVersion (sTitle);
+ if (!comphelper::IsFuzzing())
+ {
+ // fdo#70376: We want the window title to contain just the
+ // document name (from the above "component title").
+ impl_appendProductName (sTitle);
+ impl_appendModuleName (sTitle);
+ impl_appendDebugVersion (sTitle);
+ }
#endif
impl_appendSafeMode (sTitle);
bool bChanged;
// SYNCHRONIZED ->
{
- osl::MutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
OUString sNewTitle = sTitle.makeStringAndClear ();
bChanged = !init && m_sTitle != sNewTitle;
@@ -536,6 +520,7 @@ void TitleHelper::impl_updateTitleForFrame (const css::uno::Reference< css::fram
impl_sendTitleChangedEvent ();
}
+// static
void TitleHelper::impl_appendComponentTitle ( OUStringBuffer& sTitle ,
const css::uno::Reference< css::uno::XInterface >& xComponent)
{
@@ -546,13 +531,17 @@ void TitleHelper::impl_appendComponentTitle ( OUStringBuffer&
sTitle.append (xTitle->getTitle ());
}
+// static
void TitleHelper::impl_appendProductName (OUStringBuffer& sTitle)
{
OUString name(utl::ConfigManager::getProductName());
if (!name.isEmpty())
{
if (!sTitle.isEmpty())
- sTitle.append(" - ");
+ {
+ OUString separator (FwkResId (STR_EMDASH_SEPARATOR));
+ sTitle.append(separator);
+ }
sTitle.append(name);
}
}
@@ -563,9 +552,9 @@ void TitleHelper::impl_appendModuleName (OUStringBuffer& sTitle)
css::uno::Reference< css::uno::XComponentContext > xContext;
// SYNCHRONIZED ->
{
- osl::MutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
- xOwner = m_xOwner.get();
+ xOwner = m_xOwner;
xContext = m_xContext;
}
// <- SYNCHRONIZED
@@ -592,6 +581,7 @@ void TitleHelper::impl_appendModuleName (OUStringBuffer& sTitle)
}
#ifdef DBG_UTIL
+// static
void TitleHelper::impl_appendDebugVersion (OUStringBuffer& sTitle)
{
OUString version(utl::ConfigManager::getProductVersion());
@@ -608,6 +598,7 @@ void TitleHelper::impl_appendDebugVersion (OUStringBuffer&)
}
#endif
+// static
void TitleHelper::impl_appendSafeMode (OUStringBuffer& sTitle)
{
if (Application::IsSafeModeEnabled())
@@ -647,10 +638,10 @@ void TitleHelper::impl_setSubTitle (const css::uno::Reference< css::frame::XTitl
css::uno::Reference< css::frame::XTitle > xOldSubTitle;
// SYNCHRONIZED ->
{
- osl::MutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
// ignore duplicate calls. Makes outside using of this helper more easy :-)
- xOldSubTitle.set(m_xSubTitle.get(), css::uno::UNO_QUERY);
+ xOldSubTitle = m_xSubTitle;
if (xOldSubTitle == xSubTitle)
return;
@@ -660,7 +651,7 @@ void TitleHelper::impl_setSubTitle (const css::uno::Reference< css::frame::XTitl
css::uno::Reference< css::frame::XTitleChangeBroadcaster > xOldBroadcaster(xOldSubTitle , css::uno::UNO_QUERY );
css::uno::Reference< css::frame::XTitleChangeBroadcaster > xNewBroadcaster(xSubTitle , css::uno::UNO_QUERY );
- css::uno::Reference< css::frame::XTitleChangeListener > xThis (static_cast< css::frame::XTitleChangeListener* >(this), css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::frame::XTitleChangeListener > xThis(this);
if (xOldBroadcaster.is())
xOldBroadcaster->removeTitleChangeListener (xThis);
@@ -669,7 +660,8 @@ void TitleHelper::impl_setSubTitle (const css::uno::Reference< css::frame::XTitl
xNewBroadcaster->addTitleChangeListener (xThis);
}
-OUString TitleHelper::impl_convertURL2Title(const OUString& sURL)
+// static
+OUString TitleHelper::impl_convertURL2Title(std::u16string_view sURL)
{
INetURLObject aURL (sURL);
OUString sTitle;
diff --git a/framework/source/fwe/helper/undomanagerhelper.cxx b/framework/source/fwe/helper/undomanagerhelper.cxx
index ef6a9da4a5b4..3a2fdd6c066b 100644
--- a/framework/source/fwe/helper/undomanagerhelper.cxx
+++ b/framework/source/fwe/helper/undomanagerhelper.cxx
@@ -29,17 +29,20 @@
#include <com/sun/star/util/NotLockedException.hpp>
#include <com/sun/star/util/XModifyListener.hpp>
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer4.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <comphelper/flagguard.hxx>
#include <comphelper/asyncnotification.hxx>
#include <svl/undo.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <osl/conditn.hxx>
+#include <vcl/svapp.hxx>
#include <functional>
+#include <mutex>
#include <stack>
#include <queue>
+#include <utility>
namespace framework
{
@@ -144,8 +147,8 @@ namespace framework
class UndoManagerRequest : public ::comphelper::AnyEvent
{
public:
- explicit UndoManagerRequest( ::std::function<void ()> const& i_request )
- :m_request( i_request )
+ explicit UndoManagerRequest( ::std::function<void ()> i_request )
+ :m_request(std::move( i_request ))
{
m_finishCondition.reset();
}
@@ -198,12 +201,14 @@ namespace framework
{
private:
::osl::Mutex m_aMutex;
- ::osl::Mutex m_aQueueMutex;
+ /// Use different mutex for listeners to prevent ABBA deadlocks
+ std::mutex m_aListenerMutex;
+ std::mutex m_aQueueMutex;
bool m_bAPIActionRunning;
bool m_bProcessingEvents;
sal_Int32 m_nLockCount;
- ::comphelper::OInterfaceContainerHelper2 m_aUndoListeners;
- ::comphelper::OInterfaceContainerHelper2 m_aModifyListeners;
+ ::comphelper::OInterfaceContainerHelper4<XUndoManagerListener> m_aUndoListeners;
+ ::comphelper::OInterfaceContainerHelper4<XModifyListener> m_aModifyListeners;
IUndoManagerImplementation& m_rUndoManagerImplementation;
::std::stack< bool > m_aContextVisibilities;
#if OSL_DEBUG_LEVEL > 0
@@ -221,8 +226,6 @@ namespace framework
:m_bAPIActionRunning( false )
,m_bProcessingEvents( false )
,m_nLockCount( 0 )
- ,m_aUndoListeners( m_aMutex )
- ,m_aModifyListeners( m_aMutex )
,m_rUndoManagerImplementation( i_undoManagerImpl )
{
getUndoManager().AddUndoListener( *this );
@@ -270,22 +273,26 @@ namespace framework
void addUndoManagerListener( const Reference< XUndoManagerListener >& i_listener )
{
- m_aUndoListeners.addInterface( i_listener );
+ std::unique_lock g(m_aListenerMutex);
+ m_aUndoListeners.addInterface( g, i_listener );
}
void removeUndoManagerListener( const Reference< XUndoManagerListener >& i_listener )
{
- m_aUndoListeners.removeInterface( i_listener );
+ std::unique_lock g(m_aListenerMutex);
+ m_aUndoListeners.removeInterface( g, i_listener );
}
void addModifyListener( const Reference< XModifyListener >& i_listener )
{
- m_aModifyListeners.addInterface( i_listener );
+ std::unique_lock g(m_aListenerMutex);
+ m_aModifyListeners.addInterface( g, i_listener );
}
void removeModifyListener( const Reference< XModifyListener >& i_listener )
{
- m_aModifyListeners.removeInterface( i_listener );
+ std::unique_lock g(m_aListenerMutex);
+ m_aModifyListeners.removeInterface( g, i_listener );
}
UndoManagerEvent
@@ -315,9 +322,11 @@ namespace framework
{
EventObject aEvent;
aEvent.Source = getXUndoManager();
- m_aUndoListeners.disposeAndClear( aEvent );
- m_aModifyListeners.disposeAndClear( aEvent );
-
+ {
+ std::unique_lock g(m_aListenerMutex);
+ m_aUndoListeners.disposeAndClear( g, aEvent );
+ m_aModifyListeners.disposeAndClear( g, aEvent );
+ }
::osl::MutexGuard aGuard( m_aMutex );
getUndoManager().RemoveUndoListener( *this );
@@ -335,7 +344,8 @@ namespace framework
void UndoManagerHelper_Impl::impl_notifyModified()
{
const EventObject aEvent( getXUndoManager() );
- m_aModifyListeners.notifyEach( &XModifyListener::modified, aEvent );
+ std::unique_lock g(m_aListenerMutex);
+ m_aModifyListeners.notifyEach( g, &XModifyListener::modified, aEvent );
}
void UndoManagerHelper_Impl::notify( OUString const& i_title,
@@ -349,7 +359,10 @@ namespace framework
// Fixing this properly would require outsourcing all the notifications into an own thread - which might lead
// to problems of its own, since clients might expect synchronous notifications.
- m_aUndoListeners.notifyEach( i_notificationMethod, aEvent );
+ {
+ std::unique_lock g(m_aListenerMutex);
+ m_aUndoListeners.notifyEach( g, i_notificationMethod, aEvent );
+ }
impl_notifyModified();
}
@@ -358,8 +371,10 @@ namespace framework
const EventObject aEvent( getXUndoManager() );
// TODO: the same comment as in the other notify, regarding SM locking applies here ...
-
- m_aUndoListeners.notifyEach( i_notificationMethod, aEvent );
+ {
+ std::unique_lock g(m_aListenerMutex);
+ m_aUndoListeners.notifyEach( g, i_notificationMethod, aEvent );
+ }
impl_notifyModified();
}
@@ -452,7 +467,7 @@ namespace framework
// create the request, and add it to our queue
::rtl::Reference< UndoManagerRequest > pRequest( new UndoManagerRequest( i_request ) );
{
- ::osl::MutexGuard aQueueGuard( m_aQueueMutex );
+ std::unique_lock aQueueGuard( m_aQueueMutex );
m_aEventQueue.push( pRequest );
}
@@ -470,7 +485,7 @@ namespace framework
{
pRequest.clear();
{
- ::osl::MutexGuard aQueueGuard( m_aQueueMutex );
+ std::unique_lock aQueueGuard( m_aQueueMutex );
if ( m_aEventQueue.empty() )
{
// reset the flag before releasing the queue mutex, otherwise it's possible that another thread
@@ -492,7 +507,7 @@ namespace framework
{
// no chance to process further requests, if the current one failed
// => discard them
- ::osl::MutexGuard aQueueGuard( m_aQueueMutex );
+ std::unique_lock aQueueGuard( m_aQueueMutex );
while ( !m_aEventQueue.empty() )
{
pRequest = m_aEventQueue.front();
@@ -535,7 +550,10 @@ namespace framework
aGuard.clear();
// <--- SYNCHRONIZED
- m_aUndoListeners.notifyEach( i_hidden ? &XUndoManagerListener::enteredHiddenContext : &XUndoManagerListener::enteredContext, aEvent );
+ {
+ std::unique_lock g(m_aListenerMutex);
+ m_aUndoListeners.notifyEach( g, i_hidden ? &XUndoManagerListener::enteredHiddenContext : &XUndoManagerListener::enteredContext, aEvent );
+ }
impl_notifyModified();
}
@@ -592,9 +610,12 @@ namespace framework
aGuard.clear();
// <--- SYNCHRONIZED
- if ( bHadRedoActions && !bHasRedoActions )
- m_aUndoListeners.notifyEach( &XUndoManagerListener::redoActionsCleared, aClearedEvent );
- m_aUndoListeners.notifyEach( notificationMethod, aContextEvent );
+ {
+ std::unique_lock g(m_aListenerMutex);
+ if ( bHadRedoActions && !bHasRedoActions )
+ m_aUndoListeners.notifyEach( g, &XUndoManagerListener::redoActionsCleared, aClearedEvent );
+ m_aUndoListeners.notifyEach( g, notificationMethod, aContextEvent );
+ }
impl_notifyModified();
}
@@ -668,31 +689,38 @@ namespace framework
aGuard.clear();
// <--- SYNCHRONIZED
- m_aUndoListeners.notifyEach( &XUndoManagerListener::undoActionAdded, aEventAdd );
- if ( bHadRedoActions && !bHasRedoActions )
- m_aUndoListeners.notifyEach( &XUndoManagerListener::redoActionsCleared, aEventClear );
+ {
+ std::unique_lock g(m_aListenerMutex);
+ m_aUndoListeners.notifyEach( g, &XUndoManagerListener::undoActionAdded, aEventAdd );
+ if ( bHadRedoActions && !bHasRedoActions )
+ m_aUndoListeners.notifyEach( g, &XUndoManagerListener::redoActionsCleared, aEventClear );
+ }
impl_notifyModified();
}
void UndoManagerHelper_Impl::impl_clear()
{
- // SYNCHRONIZED --->
- ::osl::ClearableMutexGuard aGuard( m_aMutex );
+ EventObject aEvent;
+ {
+ SolarMutexGuard aGuard;
+ ::osl::MutexGuard aGuard2( m_aMutex );
- SfxUndoManager& rUndoManager = getUndoManager();
- if ( rUndoManager.IsInListAction() )
- throw UndoContextNotClosedException( OUString(), getXUndoManager() );
+ SfxUndoManager& rUndoManager = getUndoManager();
+ if ( rUndoManager.IsInListAction() )
+ throw UndoContextNotClosedException( OUString(), getXUndoManager() );
- {
- ::comphelper::FlagGuard aNotificationGuard( m_bAPIActionRunning );
- rUndoManager.Clear();
- }
+ {
+ ::comphelper::FlagGuard aNotificationGuard( m_bAPIActionRunning );
+ rUndoManager.Clear();
+ }
- const EventObject aEvent( getXUndoManager() );
- aGuard.clear();
- // <--- SYNCHRONIZED
+ aEvent = EventObject( getXUndoManager() );
+ }
- m_aUndoListeners.notifyEach( &XUndoManagerListener::allActionsCleared, aEvent );
+ {
+ std::unique_lock g(m_aListenerMutex);
+ m_aUndoListeners.notifyEach( g, &XUndoManagerListener::allActionsCleared, aEvent );
+ }
impl_notifyModified();
}
@@ -714,7 +742,10 @@ namespace framework
aGuard.clear();
// <--- SYNCHRONIZED
- m_aUndoListeners.notifyEach( &XUndoManagerListener::redoActionsCleared, aEvent );
+ {
+ std::unique_lock g(m_aListenerMutex);
+ m_aUndoListeners.notifyEach( g, &XUndoManagerListener::redoActionsCleared, aEvent );
+ }
impl_notifyModified();
}
@@ -733,7 +764,10 @@ namespace framework
aGuard.clear();
// <--- SYNCHRONIZED
- m_aUndoListeners.notifyEach( &XUndoManagerListener::resetAll, aEvent );
+ {
+ std::unique_lock g(m_aListenerMutex);
+ m_aUndoListeners.notifyEach( g, &XUndoManagerListener::resetAll, aEvent );
+ }
impl_notifyModified();
}
@@ -743,7 +777,10 @@ namespace framework
aEvent.Source = getXUndoManager();
aEvent.UndoActionTitle = i_actionComment;
aEvent.UndoContextDepth = 0; // Undo can happen on level 0 only
- m_aUndoListeners.notifyEach( &XUndoManagerListener::actionUndone, aEvent );
+ {
+ std::unique_lock g(m_aListenerMutex);
+ m_aUndoListeners.notifyEach( g, &XUndoManagerListener::actionUndone, aEvent );
+ }
impl_notifyModified();
}
@@ -753,7 +790,10 @@ namespace framework
aEvent.Source = getXUndoManager();
aEvent.UndoActionTitle = i_actionComment;
aEvent.UndoContextDepth = 0; // Redo can happen on level 0 only
- m_aUndoListeners.notifyEach( &XUndoManagerListener::actionRedone, aEvent );
+ {
+ std::unique_lock g(m_aListenerMutex);
+ m_aUndoListeners.notifyEach( g, &XUndoManagerListener::actionRedone, aEvent );
+ }
impl_notifyModified();
}
@@ -958,9 +998,10 @@ namespace framework
: rUndoManager.GetRedoActionCount( SfxUndoManager::TopLevel );
Sequence< OUString > aTitles( nCount );
+ auto aTitlesRange = asNonConstRange(aTitles);
for ( size_t i=0; i<nCount; ++i )
{
- aTitles[i] = i_undo
+ aTitlesRange[i] = i_undo
? rUndoManager.GetUndoActionComment( i, SfxUndoManager::TopLevel )
: rUndoManager.GetRedoActionComment( i, SfxUndoManager::TopLevel );
}
diff --git a/framework/source/fwe/xml/menuconfiguration.cxx b/framework/source/fwe/xml/menuconfiguration.cxx
index fe6940d42348..1047422ed775 100644
--- a/framework/source/fwe/xml/menuconfiguration.cxx
+++ b/framework/source/fwe/xml/menuconfiguration.cxx
@@ -20,6 +20,7 @@
#include <menuconfiguration.hxx>
#include <addonmenu.hxx>
+#include <utility>
#include <xml/menudocumenthandler.hxx>
#include <xml/saxnamespacefilter.hxx>
@@ -33,7 +34,6 @@
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::xml::sax;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::io;
@@ -41,9 +41,8 @@ using namespace ::com::sun::star::io;
namespace framework
{
-MenuConfiguration::MenuConfiguration(
- const css::uno::Reference< css::uno::XComponentContext >& rxContext )
-: m_xContext( rxContext )
+MenuConfiguration::MenuConfiguration( css::uno::Reference< css::uno::XComponentContext > xContext )
+: m_xContext(std::move( xContext ))
{
}
diff --git a/framework/source/fwe/xml/menudocumenthandler.cxx b/framework/source/fwe/xml/menudocumenthandler.cxx
index c2c44447f3cc..96e4b2324ba8 100644
--- a/framework/source/fwe/xml/menudocumenthandler.cxx
+++ b/framework/source/fwe/xml/menudocumenthandler.cxx
@@ -31,6 +31,7 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <comphelper/processfactory.hxx>
+#include <comphelper/propertyvalue.hxx>
#include <comphelper/attributelist.hxx>
#ifdef ATTRIBUTE_HELPID
@@ -39,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"
@@ -72,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
@@ -122,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 )
{
@@ -191,20 +189,22 @@ void ReadMenuDocumentHandlerBase::initPropertyCommon(
Sequence< PropertyValue > &rProps, const OUString &rCommandURL,
const OUString &rHelpId, const OUString &rLabel, sal_Int16 nItemStyleBits )
{
- rProps[0].Name = m_aCommandURL;
- rProps[1].Name = m_aHelpURL;
- rProps[2].Name = m_aContainer;
- rProps[3].Name = m_aLabel;
- rProps[4].Name = m_aStyle;
- rProps[5].Name = m_aType;
+ auto pProps = rProps.getArray();
+
+ pProps[0].Name = m_aCommandURL;
+ pProps[1].Name = m_aHelpURL;
+ pProps[2].Name = m_aContainer;
+ pProps[3].Name = m_aLabel;
+ pProps[4].Name = m_aStyle;
+ pProps[5].Name = m_aType;
// Common values
- rProps[0].Value <<= rCommandURL.intern();
- rProps[1].Value <<= rHelpId;
- rProps[2].Value <<= Reference< XIndexContainer >();
- rProps[3].Value <<= rLabel;
- rProps[4].Value <<= nItemStyleBits;
- rProps[5].Value <<= css::ui::ItemType::DEFAULT;
+ pProps[0].Value <<= rCommandURL;
+ pProps[1].Value <<= rHelpId;
+ pProps[2].Value <<= Reference< XIndexContainer >();
+ pProps[3].Value <<= rLabel;
+ pProps[4].Value <<= nItemStyleBits;
+ pProps[5].Value <<= css::ui::ItemType::DEFAULT;
}
OReadMenuDocumentHandler::OReadMenuDocumentHandler(
@@ -376,9 +376,9 @@ void SAL_CALL OReadMenuBarHandler::startElement(
{
Sequence< PropertyValue > aSubMenuProp( 6 );
initPropertyCommon( aSubMenuProp, aCommandId, aHelpId, aLabel, nItemBits );
- aSubMenuProp[2].Value <<= xSubItemContainer;
+ aSubMenuProp.getArray()[2].Value <<= xSubItemContainer;
- m_xMenuBarContainer->insertByIndex( m_xMenuBarContainer->getCount(), makeAny( aSubMenuProp ) );
+ m_xMenuBarContainer->insertByIndex( m_xMenuBarContainer->getCount(), Any( aSubMenuProp ) );
}
else
{
@@ -577,9 +577,9 @@ void SAL_CALL OReadMenuPopupHandler::startElement(
{
Sequence< PropertyValue > aSubMenuProp( 6 );
initPropertyCommon( aSubMenuProp, aCommandId, aHelpId, aLabel, nItemBits );
- aSubMenuProp[2].Value <<= xSubItemContainer;
+ aSubMenuProp.getArray()[2].Value <<= xSubItemContainer;
- m_xMenuContainer->insertByIndex( m_xMenuContainer->getCount(), makeAny( aSubMenuProp ) );
+ m_xMenuContainer->insertByIndex( m_xMenuContainer->getCount(), Any( aSubMenuProp ) );
}
else
{
@@ -633,20 +633,19 @@ void SAL_CALL OReadMenuPopupHandler::startElement(
{
Sequence< PropertyValue > aMenuItem( 6 );
initPropertyCommon( aMenuItem, aCommandId, aHelpId, aLabel, nItemBits );
- aMenuItem[2].Value <<= Reference< XIndexContainer >();
+ 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;
}
else if ( rName == ELEMENT_MENUSEPARATOR )
{
- Sequence< PropertyValue > aMenuSeparator( 1 );
- aMenuSeparator[0].Name = ITEM_DESCRIPTOR_TYPE;
- aMenuSeparator[0].Value <<= css::ui::ItemType::SEPARATOR_LINE;
+ 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;
}
@@ -718,7 +717,6 @@ OWriteMenuDocumentHandler::OWriteMenuDocumentHandler(
m_bIsMenuBar( bIsMenuBar )
{
m_xEmptyList = new ::comphelper::AttributeList;
- m_aAttributeType = ATTRIBUTE_TYPE_CDATA;
}
OWriteMenuDocumentHandler::~OWriteMenuDocumentHandler()
@@ -740,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;
@@ -791,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() );
@@ -841,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 )
@@ -872,7 +863,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/statusbarconfiguration.cxx b/framework/source/fwe/xml/statusbarconfiguration.cxx
index ce974237b286..98130700ef26 100644
--- a/framework/source/fwe/xml/statusbarconfiguration.cxx
+++ b/framework/source/fwe/xml/statusbarconfiguration.cxx
@@ -29,7 +29,6 @@
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::xml::sax;
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::io;
using namespace ::com::sun::star::container;
diff --git a/framework/source/fwe/xml/statusbardocumenthandler.cxx b/framework/source/fwe/xml/statusbardocumenthandler.cxx
index 16f10f157660..cafd3258eca1 100644
--- a/framework/source/fwe/xml/statusbardocumenthandler.cxx
+++ b/framework/source/fwe/xml/statusbardocumenthandler.cxx
@@ -27,10 +27,10 @@
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/container/XIndexContainer.hpp>
-#include <vcl/svapp.hxx>
#include <vcl/status.hxx>
#include <comphelper/attributelist.hxx>
+#include <comphelper/propertyvalue.hxx>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
@@ -38,12 +38,12 @@ using namespace ::com::sun::star::xml::sax;
using namespace ::com::sun::star::ui;
using namespace ::com::sun::star::container;
-constexpr OUStringLiteral XMLNS_STATUSBAR = u"http://openoffice.org/2001/statusbar";
-constexpr OUStringLiteral XMLNS_XLINK = u"http://www.w3.org/1999/xlink";
+constexpr OUString XMLNS_STATUSBAR = u"http://openoffice.org/2001/statusbar"_ustr;
+constexpr OUString XMLNS_XLINK = u"http://www.w3.org/1999/xlink"_ustr;
constexpr OUStringLiteral XMLNS_STATUSBAR_PREFIX = u"statusbar:";
constexpr OUStringLiteral XMLNS_XLINK_PREFIX = u"xlink:";
-constexpr OUStringLiteral XMLNS_FILTER_SEPARATOR = u"^";
+constexpr OUString XMLNS_FILTER_SEPARATOR = u"^"_ustr;
#define ELEMENT_STATUSBAR "statusbar"
#define ELEMENT_STATUSBARITEM "statusbaritem"
@@ -58,24 +58,22 @@ constexpr OUStringLiteral XMLNS_FILTER_SEPARATOR = u"^";
#define ATTRIBUTE_HELPURL "helpid"
#define ATTRIBUTE_MANDATORY "mandatory"
-constexpr OUStringLiteral ELEMENT_NS_STATUSBAR = u"statusbar:statusbar";
-constexpr OUStringLiteral ELEMENT_NS_STATUSBARITEM = u"statusbar:statusbaritem";
+constexpr OUString ELEMENT_NS_STATUSBAR = u"statusbar:statusbar"_ustr;
+constexpr OUString ELEMENT_NS_STATUSBARITEM = u"statusbar:statusbaritem"_ustr;
constexpr OUStringLiteral ATTRIBUTE_XMLNS_STATUSBAR = u"xmlns:statusbar";
constexpr OUStringLiteral ATTRIBUTE_XMLNS_XLINK = u"xmlns:xlink";
-constexpr OUStringLiteral ATTRIBUTE_TYPE_CDATA = u"CDATA";
+constexpr OUString ATTRIBUTE_BOOLEAN_TRUE = u"true"_ustr;
+constexpr OUString ATTRIBUTE_BOOLEAN_FALSE = u"false"_ustr;
-constexpr OUStringLiteral ATTRIBUTE_BOOLEAN_TRUE = u"true";
-constexpr OUStringLiteral ATTRIBUTE_BOOLEAN_FALSE = u"false";
-
-constexpr OUStringLiteral ATTRIBUTE_ALIGN_LEFT = u"left";
-constexpr OUStringLiteral ATTRIBUTE_ALIGN_RIGHT = u"right";
-constexpr OUStringLiteral ATTRIBUTE_ALIGN_CENTER = u"center";
+constexpr OUString ATTRIBUTE_ALIGN_LEFT = u"left"_ustr;
+constexpr OUString ATTRIBUTE_ALIGN_RIGHT = u"right"_ustr;
+constexpr OUString ATTRIBUTE_ALIGN_CENTER = u"center"_ustr;
constexpr OUStringLiteral ATTRIBUTE_STYLE_IN = u"in";
-constexpr OUStringLiteral ATTRIBUTE_STYLE_OUT = u"out";
-constexpr OUStringLiteral ATTRIBUTE_STYLE_FLAT = u"flat";
+constexpr OUString ATTRIBUTE_STYLE_OUT = u"out"_ustr;
+constexpr OUString ATTRIBUTE_STYLE_FLAT = u"flat"_ustr;
constexpr OUStringLiteral STATUSBAR_DOCTYPE = u"<!DOCTYPE statusbar:statusbar PUBLIC \"-//OpenOffice.org//DTD OfficeDocument 1.0//EN\" \"statusbar.dtd\">";
@@ -83,12 +81,12 @@ namespace framework
{
// 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_OFFSET = u"Offset";
-constexpr OUStringLiteral ITEM_DESCRIPTOR_STYLE = u"Style";
-constexpr OUStringLiteral ITEM_DESCRIPTOR_WIDTH = u"Width";
-constexpr OUStringLiteral ITEM_DESCRIPTOR_TYPE = u"Type";
+constexpr OUString ITEM_DESCRIPTOR_COMMANDURL = u"CommandURL"_ustr;
+constexpr OUString ITEM_DESCRIPTOR_HELPURL = u"HelpURL"_ustr;
+constexpr OUString ITEM_DESCRIPTOR_OFFSET = u"Offset"_ustr;
+constexpr OUString ITEM_DESCRIPTOR_STYLE = u"Style"_ustr;
+constexpr OUString ITEM_DESCRIPTOR_WIDTH = u"Width"_ustr;
+constexpr OUString ITEM_DESCRIPTOR_TYPE = u"Type"_ustr;
static void ExtractStatusbarItemParameters(
const Sequence< PropertyValue >& rProp,
@@ -103,7 +101,6 @@ static void ExtractStatusbarItemParameters(
if ( rEntry.Name == ITEM_DESCRIPTOR_COMMANDURL )
{
rEntry.Value >>= rCommandURL;
- rCommandURL = rCommandURL.intern();
}
else if ( rEntry.Name == ITEM_DESCRIPTOR_HELPURL )
{
@@ -154,7 +151,7 @@ OReadStatusBarDocumentHandler::OReadStatusBarDocumentHandler(
m_aStatusBarItems( rStatusBarItems )
{
// create hash map
- for ( int i = 0; i < int(SB_XML_ENTRY_COUNT); i++ )
+ for ( int i = 0; i < SB_XML_ENTRY_COUNT; i++ )
{
if ( StatusBarEntries[i].nNamespace == SB_NS_STATUSBAR )
{
@@ -185,8 +182,6 @@ void SAL_CALL OReadStatusBarDocumentHandler::startDocument()
void SAL_CALL OReadStatusBarDocumentHandler::endDocument()
{
- SolarMutexGuard g;
-
if ( m_bStatusBarStartFound )
{
OUString aErrorMessage = getErrorLineString() + "No matching start or end element 'statusbar' found!";
@@ -197,8 +192,6 @@ void SAL_CALL OReadStatusBarDocumentHandler::endDocument()
void SAL_CALL OReadStatusBarDocumentHandler::startElement(
const OUString& aName, const Reference< XAttributeList > &xAttribs )
{
- SolarMutexGuard g;
-
StatusBarHashMap::const_iterator pStatusBarEntry = m_aStatusBarMap.find( aName );
if ( pStatusBarEntry == m_aStatusBarMap.end() )
return;
@@ -374,22 +367,16 @@ void SAL_CALL OReadStatusBarDocumentHandler::startElement(
}
else
{
- Sequence< PropertyValue > aStatusbarItemProp( 6 );
- aStatusbarItemProp[0].Name = ITEM_DESCRIPTOR_COMMANDURL;
- aStatusbarItemProp[1].Name = ITEM_DESCRIPTOR_HELPURL;
- aStatusbarItemProp[2].Name = ITEM_DESCRIPTOR_OFFSET;
- aStatusbarItemProp[3].Name = ITEM_DESCRIPTOR_STYLE;
- aStatusbarItemProp[4].Name = ITEM_DESCRIPTOR_WIDTH;
- aStatusbarItemProp[5].Name = ITEM_DESCRIPTOR_TYPE;
-
- aStatusbarItemProp[0].Value <<= aCommandURL;
- aStatusbarItemProp[1].Value <<= aHelpURL;
- aStatusbarItemProp[2].Value <<= nOffset;
- aStatusbarItemProp[3].Value <<= nItemBits;
- aStatusbarItemProp[4].Value <<= nWidth;
- aStatusbarItemProp[5].Value <<= css::ui::ItemType::DEFAULT;
-
- m_aStatusBarItems->insertByIndex( m_aStatusBarItems->getCount(), makeAny( aStatusbarItemProp ) );
+ Sequence< PropertyValue > aStatusbarItemProp{
+ comphelper::makePropertyValue(ITEM_DESCRIPTOR_COMMANDURL, aCommandURL),
+ comphelper::makePropertyValue(ITEM_DESCRIPTOR_HELPURL, aHelpURL),
+ comphelper::makePropertyValue(ITEM_DESCRIPTOR_OFFSET, nOffset),
+ comphelper::makePropertyValue(ITEM_DESCRIPTOR_STYLE, nItemBits),
+ comphelper::makePropertyValue(ITEM_DESCRIPTOR_WIDTH, nWidth),
+ comphelper::makePropertyValue(ITEM_DESCRIPTOR_TYPE, css::ui::ItemType::DEFAULT)
+ };
+
+ m_aStatusBarItems->insertByIndex( m_aStatusBarItems->getCount(), Any( aStatusbarItemProp ) );
}
}
break;
@@ -401,8 +388,6 @@ void SAL_CALL OReadStatusBarDocumentHandler::startElement(
void SAL_CALL OReadStatusBarDocumentHandler::endElement(const OUString& aName)
{
- SolarMutexGuard g;
-
StatusBarHashMap::const_iterator pStatusBarEntry = m_aStatusBarMap.find( aName );
if ( pStatusBarEntry == m_aStatusBarMap.end() )
return;
@@ -453,15 +438,11 @@ void SAL_CALL OReadStatusBarDocumentHandler::processingInstruction(
void SAL_CALL OReadStatusBarDocumentHandler::setDocumentLocator(
const Reference< XLocator > &xLocator)
{
- SolarMutexGuard g;
-
m_xLocator = xLocator;
}
OUString OReadStatusBarDocumentHandler::getErrorLineString()
{
- SolarMutexGuard g;
-
if ( m_xLocator.is() )
return "Line: " + OUString::number( m_xLocator->getLineNumber() ) + " - ";
else
@@ -477,7 +458,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;
}
@@ -488,8 +468,6 @@ OWriteStatusBarDocumentHandler::~OWriteStatusBarDocumentHandler()
void OWriteStatusBarDocumentHandler::WriteStatusBarDocument()
{
- SolarMutexGuard g;
-
m_xWriteDocumentHandler->startDocument();
// write DOCTYPE line!
@@ -503,11 +481,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 );
@@ -563,25 +539,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 );
}
@@ -589,13 +562,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 );
}
@@ -603,7 +574,6 @@ void OWriteStatusBarDocumentHandler::WriteStatusBarItem(
if ( nStyle & ItemStyle::AUTO_SIZE )
{
pList->AddAttribute( m_aXMLStatusBarNS + ATTRIBUTE_AUTOSIZE,
- m_aAttributeType,
ATTRIBUTE_BOOLEAN_TRUE );
}
@@ -611,7 +581,6 @@ void OWriteStatusBarDocumentHandler::WriteStatusBarItem(
if ( nStyle & ItemStyle::OWNER_DRAW )
{
pList->AddAttribute( m_aXMLStatusBarNS + ATTRIBUTE_OWNERDRAW,
- m_aAttributeType,
ATTRIBUTE_BOOLEAN_TRUE );
}
@@ -619,7 +588,6 @@ void OWriteStatusBarDocumentHandler::WriteStatusBarItem(
if ( nWidth > 0 )
{
pList->AddAttribute( m_aXMLStatusBarNS + ATTRIBUTE_WIDTH,
- m_aAttributeType,
OUString::number( nWidth ) );
}
@@ -627,7 +595,6 @@ void OWriteStatusBarDocumentHandler::WriteStatusBarItem(
if ( nOffset != STATUSBAR_OFFSET )
{
pList->AddAttribute( m_aXMLStatusBarNS + ATTRIBUTE_OFFSET,
- m_aAttributeType,
OUString::number( nOffset ) );
}
@@ -635,7 +602,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/toolboxconfiguration.cxx b/framework/source/fwe/xml/toolboxconfiguration.cxx
index d9e34baabc98..c88b3c01da2d 100644
--- a/framework/source/fwe/xml/toolboxconfiguration.cxx
+++ b/framework/source/fwe/xml/toolboxconfiguration.cxx
@@ -29,7 +29,6 @@
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::xml::sax;
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::io;
using namespace ::com::sun::star::container;
diff --git a/framework/source/fwe/xml/toolboxdocumenthandler.cxx b/framework/source/fwe/xml/toolboxdocumenthandler.cxx
index c5dc0f429483..7464939e1e03 100644
--- a/framework/source/fwe/xml/toolboxdocumenthandler.cxx
+++ b/framework/source/fwe/xml/toolboxdocumenthandler.cxx
@@ -30,12 +30,13 @@
#include <sal/config.h>
#include <sal/macros.h>
-#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
+#include <rtl/ref.hxx>
#include <rtl/ustrbuf.hxx>
#include <comphelper/attributelist.hxx>
#include <comphelper/propertysequence.hxx>
+#include <comphelper/propertyvalue.hxx>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
@@ -48,11 +49,11 @@ namespace framework
{
// Property names of a menu/menu item ItemDescriptor
-constexpr OUStringLiteral ITEM_DESCRIPTOR_COMMANDURL = u"CommandURL";
-constexpr OUStringLiteral ITEM_DESCRIPTOR_LABEL = u"Label";
-constexpr OUStringLiteral ITEM_DESCRIPTOR_TYPE = u"Type";
-constexpr OUStringLiteral ITEM_DESCRIPTOR_STYLE = u"Style";
-constexpr OUStringLiteral ITEM_DESCRIPTOR_VISIBLE = u"IsVisible";
+constexpr OUString ITEM_DESCRIPTOR_COMMANDURL = u"CommandURL"_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;
+constexpr OUString ITEM_DESCRIPTOR_VISIBLE = u"IsVisible"_ustr;
static void ExtractToolbarParameters( const Sequence< PropertyValue >& rProp,
OUString& rCommandURL,
@@ -64,10 +65,7 @@ static void ExtractToolbarParameters( const Sequence< PropertyValue >& rProp,
for ( const PropertyValue& rEntry : rProp )
{
if ( rEntry.Name == ITEM_DESCRIPTOR_COMMANDURL )
- {
rEntry.Value >>= rCommandURL;
- rCommandURL = rCommandURL.intern();
- }
else if ( rEntry.Name == ITEM_DESCRIPTOR_LABEL )
rEntry.Value >>= rLabel;
else if ( rEntry.Name == ITEM_DESCRIPTOR_TYPE )
@@ -84,12 +82,12 @@ namespace {
struct ToolboxStyleItem
{
sal_Int16 nBit;
- const char* attrName;
+ OUString attrName;
};
}
-const ToolboxStyleItem Styles[ ] = {
+constexpr ToolboxStyleItem Styles[ ] = {
{ css::ui::ItemStyle::RADIO_CHECK, ATTRIBUTE_ITEMSTYLE_RADIO },
{ css::ui::ItemStyle::ALIGN_LEFT, ATTRIBUTE_ITEMSTYLE_LEFT },
{ css::ui::ItemStyle::AUTO_SIZE, ATTRIBUTE_ITEMSTYLE_AUTO },
@@ -135,7 +133,7 @@ OReadToolBoxDocumentHandler::OReadToolBoxDocumentHandler( const Reference< XInde
m_aCommandURL( ITEM_DESCRIPTOR_COMMANDURL )
{
// create hash map
- for ( int i = 0; i < int(TB_XML_ENTRY_COUNT); i++ )
+ for ( int i = 0; i < TB_XML_ENTRY_COUNT; i++ )
{
if ( ToolBoxEntries[i].nNamespace == TB_NS_TOOLBAR )
{
@@ -151,16 +149,6 @@ OReadToolBoxDocumentHandler::OReadToolBoxDocumentHandler( const Reference< XInde
}
}
- // pre-calculate a hash code for all style strings to speed up xml read process
- m_nHashCode_Style_Radio = OUString( ATTRIBUTE_ITEMSTYLE_RADIO ).hashCode();
- m_nHashCode_Style_Left = OUString( ATTRIBUTE_ITEMSTYLE_LEFT ).hashCode();
- m_nHashCode_Style_AutoSize = OUString( ATTRIBUTE_ITEMSTYLE_AUTOSIZE ).hashCode();
- m_nHashCode_Style_DropDown = OUString( ATTRIBUTE_ITEMSTYLE_DROPDOWN ).hashCode();
- m_nHashCode_Style_Repeat = OUString( ATTRIBUTE_ITEMSTYLE_REPEAT ).hashCode();
- m_nHashCode_Style_DropDownOnly = OUString( ATTRIBUTE_ITEMSTYLE_DROPDOWNONLY ).hashCode();
- m_nHashCode_Style_Text = OUString( ATTRIBUTE_ITEMSTYLE_TEXT ).hashCode();
- m_nHashCode_Style_Image = OUString( ATTRIBUTE_ITEMSTYLE_IMAGE ).hashCode();
-
m_bToolBarStartFound = false;
m_bToolBarItemStartFound = false;
m_bToolBarSpaceStartFound = false;
@@ -179,8 +167,6 @@ void SAL_CALL OReadToolBoxDocumentHandler::startDocument()
void SAL_CALL OReadToolBoxDocumentHandler::endDocument()
{
- SolarMutexGuard g;
-
if ( m_bToolBarStartFound )
{
OUString aErrorMessage = getErrorLineString() + "No matching start or end element 'toolbar' found!";
@@ -191,8 +177,6 @@ void SAL_CALL OReadToolBoxDocumentHandler::endDocument()
void SAL_CALL OReadToolBoxDocumentHandler::startElement(
const OUString& aName, const Reference< XAttributeList > &xAttribs )
{
- SolarMutexGuard g;
-
ToolBoxHashMap::const_iterator pToolBoxEntry = m_aToolBoxMap.find( aName );
if ( pToolBoxEntry == m_aToolBoxMap.end() )
return;
@@ -233,7 +217,7 @@ void SAL_CALL OReadToolBoxDocumentHandler::startElement(
{
try
{
- xPropSet->setPropertyValue("UIName", makeAny( aUIName ) );
+ xPropSet->setPropertyValue("UIName", Any( aUIName ) );
}
catch ( const UnknownPropertyException& )
{
@@ -287,7 +271,7 @@ void SAL_CALL OReadToolBoxDocumentHandler::startElement(
case TB_ATTRIBUTE_URL:
{
bAttributeURL = true;
- aCommandURL = xAttribs->getValueByIndex( n ).intern();
+ aCommandURL = xAttribs->getValueByIndex( n );
}
break;
@@ -316,22 +300,21 @@ void SAL_CALL OReadToolBoxDocumentHandler::startElement(
OUString aToken = aTemp.getToken( 0, ' ', nIndex );
if ( !aToken.isEmpty() )
{
- sal_Int32 nHashCode = aToken.hashCode();
- if ( nHashCode == m_nHashCode_Style_Radio )
+ if ( aToken == ATTRIBUTE_ITEMSTYLE_RADIO )
nItemBits |= css::ui::ItemStyle::RADIO_CHECK;
- else if ( nHashCode == m_nHashCode_Style_Left )
+ else if ( aToken == ATTRIBUTE_ITEMSTYLE_LEFT )
nItemBits |= css::ui::ItemStyle::ALIGN_LEFT;
- else if ( nHashCode == m_nHashCode_Style_AutoSize )
+ else if ( aToken == ATTRIBUTE_ITEMSTYLE_AUTOSIZE )
nItemBits |= css::ui::ItemStyle::AUTO_SIZE;
- else if ( nHashCode == m_nHashCode_Style_Repeat )
+ else if ( aToken == ATTRIBUTE_ITEMSTYLE_REPEAT )
nItemBits |= css::ui::ItemStyle::REPEAT;
- else if ( nHashCode == m_nHashCode_Style_DropDownOnly )
+ else if ( aToken == ATTRIBUTE_ITEMSTYLE_DROPDOWNONLY )
nItemBits |= css::ui::ItemStyle::DROPDOWN_ONLY;
- else if ( nHashCode == m_nHashCode_Style_DropDown )
+ else if ( aToken == ATTRIBUTE_ITEMSTYLE_DROPDOWN )
nItemBits |= css::ui::ItemStyle::DROP_DOWN;
- else if ( nHashCode == m_nHashCode_Style_Text )
+ else if ( aToken == ATTRIBUTE_ITEMSTYLE_TEXT )
nItemBits |= css::ui::ItemStyle::TEXT;
- else if ( nHashCode == m_nHashCode_Style_Image )
+ else if ( aToken == ATTRIBUTE_ITEMSTYLE_IMAGE )
nItemBits |= css::ui::ItemStyle::ICON;
}
}
@@ -375,14 +358,14 @@ void SAL_CALL OReadToolBoxDocumentHandler::startElement(
}
auto aToolbarItemProp( comphelper::InitPropertySequence( {
- { m_aCommandURL, css::uno::makeAny( aCommandURL ) },
- { m_aLabel, css::uno::makeAny( aLabel ) },
- { m_aType, css::uno::makeAny( css::ui::ItemType::DEFAULT ) },
- { m_aStyle, css::uno::makeAny( nItemBits ) },
- { m_aIsVisible, css::uno::makeAny( bVisible ) },
+ { m_aCommandURL, css::uno::Any( aCommandURL ) },
+ { m_aLabel, css::uno::Any( aLabel ) },
+ { m_aType, css::uno::Any( css::ui::ItemType::DEFAULT ) },
+ { m_aStyle, css::uno::Any( nItemBits ) },
+ { m_aIsVisible, css::uno::Any( bVisible ) },
} ) );
- m_rItemContainer->insertByIndex( m_rItemContainer->getCount(), makeAny( aToolbarItemProp ) );
+ m_rItemContainer->insertByIndex( m_rItemContainer->getCount(), Any( aToolbarItemProp ) );
}
}
break;
@@ -400,14 +383,12 @@ void SAL_CALL OReadToolBoxDocumentHandler::startElement(
m_bToolBarSpaceStartFound = true;
- Sequence< PropertyValue > aToolbarItemProp( 2 );
- aToolbarItemProp[0].Name = m_aCommandURL;
- aToolbarItemProp[1].Name = m_aType;
-
- aToolbarItemProp[0].Value <<= OUString();
- aToolbarItemProp[1].Value <<= css::ui::ItemType::SEPARATOR_SPACE;
+ Sequence< PropertyValue > aToolbarItemProp{
+ comphelper::makePropertyValue(m_aCommandURL, OUString()),
+ comphelper::makePropertyValue(m_aType, css::ui::ItemType::SEPARATOR_SPACE)
+ };
- m_rItemContainer->insertByIndex( m_rItemContainer->getCount(), makeAny( aToolbarItemProp ) );
+ m_rItemContainer->insertByIndex( m_rItemContainer->getCount(), Any( aToolbarItemProp ) );
}
break;
@@ -424,14 +405,12 @@ void SAL_CALL OReadToolBoxDocumentHandler::startElement(
m_bToolBarBreakStartFound = true;
- Sequence< PropertyValue > aToolbarItemProp( 2 );
- aToolbarItemProp[0].Name = m_aCommandURL;
- aToolbarItemProp[1].Name = m_aType;
+ Sequence< PropertyValue > aToolbarItemProp{
+ comphelper::makePropertyValue(m_aCommandURL, OUString()),
+ comphelper::makePropertyValue(m_aType, css::ui::ItemType::SEPARATOR_LINEBREAK)
+ };
- aToolbarItemProp[0].Value <<= OUString();
- aToolbarItemProp[1].Value <<= css::ui::ItemType::SEPARATOR_LINEBREAK;
-
- m_rItemContainer->insertByIndex( m_rItemContainer->getCount(), makeAny( aToolbarItemProp ) );
+ m_rItemContainer->insertByIndex( m_rItemContainer->getCount(), Any( aToolbarItemProp ) );
}
break;
@@ -448,14 +427,12 @@ void SAL_CALL OReadToolBoxDocumentHandler::startElement(
m_bToolBarSeparatorStartFound = true;
- Sequence< PropertyValue > aToolbarItemProp( 2 );
- aToolbarItemProp[0].Name = m_aCommandURL;
- aToolbarItemProp[1].Name = m_aType;
-
- aToolbarItemProp[0].Value <<= OUString();
- aToolbarItemProp[1].Value <<= css::ui::ItemType::SEPARATOR_LINE;
+ Sequence< PropertyValue > aToolbarItemProp{
+ comphelper::makePropertyValue(m_aCommandURL, OUString()),
+ comphelper::makePropertyValue(m_aType, css::ui::ItemType::SEPARATOR_LINE)
+ };
- m_rItemContainer->insertByIndex( m_rItemContainer->getCount(), makeAny( aToolbarItemProp ) );
+ m_rItemContainer->insertByIndex( m_rItemContainer->getCount(), Any( aToolbarItemProp ) );
}
break;
@@ -466,8 +443,6 @@ void SAL_CALL OReadToolBoxDocumentHandler::startElement(
void SAL_CALL OReadToolBoxDocumentHandler::endElement(const OUString& aName)
{
- SolarMutexGuard g;
-
ToolBoxHashMap::const_iterator pToolBoxEntry = m_aToolBoxMap.find( aName );
if ( pToolBoxEntry == m_aToolBoxMap.end() )
return;
@@ -554,15 +529,11 @@ void SAL_CALL OReadToolBoxDocumentHandler::processingInstruction(
void SAL_CALL OReadToolBoxDocumentHandler::setDocumentLocator(
const Reference< XLocator > &xLocator)
{
- SolarMutexGuard g;
-
m_xLocator = xLocator;
}
OUString OReadToolBoxDocumentHandler::getErrorLineString()
{
- SolarMutexGuard g;
-
if ( m_xLocator.is() )
return "Line: " + OUString::number( m_xLocator->getLineNumber() ) + " - ";
else
@@ -578,7 +549,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;
}
@@ -589,8 +559,6 @@ OWriteToolBoxDocumentHandler::~OWriteToolBoxDocumentHandler()
void OWriteToolBoxDocumentHandler::WriteToolBoxDocument()
{
- SolarMutexGuard g;
-
m_xWriteDocumentHandler->startDocument();
// write DOCTYPE line!
@@ -617,16 +585,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 );
@@ -681,19 +646,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 );
}
@@ -708,11 +671,10 @@ void OWriteToolBoxDocumentHandler::WriteToolBoxItem(
{
if ( !aValue.isEmpty() )
aValue.append(" ");
- aValue.appendAscii( pStyle->attrName );
+ aValue.append( pStyle->attrName );
}
}
pList->AddAttribute( m_aXMLToolbarNS + ATTRIBUTE_ITEMSTYLE,
- m_aAttributeType,
aValue.makeStringAndClear() );
}