summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSumit Chauhan <sumitcn25@gmail.com>2019-07-05 17:13:26 +0530
committerSzymon Kłos <szymon.klos@collabora.com>2019-07-19 11:47:56 +0200
commit147e820cc1bd7110331a6ea73db678a4a6c324e0 (patch)
treef9dd0d7321c6c317097c6822b24f40a1f6ab3d38
parente6d23c144ccadbd962b5dfb953bf29e49a7f64a3 (diff)
Addons(extension) support is extended for NotebookBar
This patch adds the schema for the extensions to be available in Notebookbar. We will adding items in addons.xcs in future if needed. Change-Id: I0a3831983b9758fac0a6fa32213ad6da20d6a97f Reviewed-on: https://gerrit.libreoffice.org/75134 Tested-by: Jenkins Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
-rw-r--r--framework/source/fwe/classes/addonsoptions.cxx352
-rw-r--r--include/framework/addonsoptions.hxx47
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Addons.xcs105
3 files changed, 503 insertions, 1 deletions
diff --git a/framework/source/fwe/classes/addonsoptions.cxx b/framework/source/fwe/classes/addonsoptions.cxx
index 8bd00646294c..d0e5ece16c7f 100644
--- a/framework/source/fwe/classes/addonsoptions.cxx
+++ b/framework/source/fwe/classes/addonsoptions.cxx
@@ -75,7 +75,8 @@ using namespace ::com::sun::star;
#define INDEX_AUTOSIZE 9
#define INDEX_OWNERDRAW 10
#define INDEX_MANDATORY 11
-#define PROPERTYCOUNT_INDEX 12
+#define INDEX_STYLE 12
+#define PROPERTYCOUNT_INDEX 13
// The following order is mandatory. Please add properties at the end!
#define PROPERTYCOUNT_MENUITEM 6
@@ -104,6 +105,17 @@ using namespace ::com::sun::star;
#define OFFSET_TOOLBARITEM_WIDTH 6
// The following order is mandatory. Please add properties at the end!
+#define PROPERTYCOUNT_NOTEBOOKBARITEM 8
+#define OFFSET_NOTEBOOKBARITEM_URL 0
+#define OFFSET_NOTEBOOKBARITEM_TITLE 1
+#define OFFSET_NOTEBOOKBARITEM_IMAGEIDENTIFIER 2
+#define OFFSET_NOTEBOOKBARITEM_TARGET 3
+#define OFFSET_NOTEBOOKBARITEM_CONTEXT 4
+#define OFFSET_NOTEBOOKBARITEM_CONTROLTYPE 5
+#define OFFSET_NOTEBOOKBARITEM_WIDTH 6
+#define OFFSET_NOTEBOOKBARITEM_STYLE 7
+
+// The following order is mandatory. Please add properties at the end!
#define PROPERTYCOUNT_STATUSBARITEM 8
#define OFFSET_STATUSBARITEM_URL 0
#define OFFSET_STATUSBARITEM_TITLE 1
@@ -143,6 +155,15 @@ using namespace ::com::sun::star;
#define OFFSET_MERGETOOLBAR_MERGECONTEXT 5
#define OFFSET_MERGETOOLBAR_TOOLBARITEMS 6
+#define PROPERTYCOUNT_MERGE_NOTEBOOKBAR 7
+#define OFFSET_MERGENOTEBOOKBAR_NOTEBOOKBAR 0
+#define OFFSET_MERGENOTEBOOKBAR_MERGEPOINT 1
+#define OFFSET_MERGENOTEBOOKBAR_MERGECOMMAND 2
+#define OFFSET_MERGENOTEBOOKBAR_MERGECOMMANDPARAMETER 3
+#define OFFSET_MERGENOTEBOOKBAR_MERGEFALLBACK 4
+#define OFFSET_MERGENOTEBOOKBAR_MERGECONTEXT 5
+#define OFFSET_MERGENOTEBOOKBAR_NOTEBOOKBARITEMS 6
+
#define PROPERTYCOUNT_MERGE_STATUSBAR 6
#define OFFSET_MERGESTATUSBAR_MERGEPOINT 0
#define OFFSET_MERGESTATUSBAR_MERGECOMMAND 1
@@ -197,14 +218,18 @@ class AddonsOptions_Impl : public ConfigItem
bool HasAddonsMenu () const;
sal_Int32 GetAddonsToolBarCount() const;
+ sal_Int32 GetAddonsNotebookBarCount() const;
const Sequence< Sequence< PropertyValue > >& GetAddonsMenu () const { return m_aCachedMenuProperties;}
const Sequence< Sequence< PropertyValue > >& GetAddonsMenuBarPart () const { return m_aCachedMenuBarPartProperties;}
const Sequence< Sequence< PropertyValue > >& GetAddonsToolBarPart ( sal_uInt32 nIndex ) const;
+ const Sequence< Sequence< PropertyValue > >& GetAddonsNotebookBarPart ( sal_uInt32 nIndex ) const;
const OUString GetAddonsToolbarResourceName( sal_uInt32 nIndex ) const;
+ const OUString GetAddonsNotebookBarResourceName( sal_uInt32 nIndex ) const;
const Sequence< Sequence< PropertyValue > >& GetAddonsHelpMenu () const { return m_aCachedHelpMenuProperties;}
Image GetImageFromURL( const OUString& aURL, bool bBig, bool bNoScale );
const MergeMenuInstructionContainer& GetMergeMenuInstructions() const { return m_aCachedMergeMenuInsContainer;}
bool GetMergeToolbarInstructions( const OUString& rToolbarName, MergeToolbarInstructionContainer& rToolbarInstructions ) const;
+ bool GetMergeNotebookBarInstructions( const OUString& rNotebookBarName, MergeNotebookBarInstructionContainer& rNotebookBarInstructions ) const;
const MergeStatusbarInstructionContainer& GetMergeStatusbarInstructions() const { return m_aCachedStatusbarMergingInstructions;}
void ReadConfigurationData();
@@ -236,7 +261,9 @@ class AddonsOptions_Impl : public ConfigItem
typedef std::unordered_map< OUString, ImageEntry > ImageManager;
typedef std::unordered_map< OUString, sal_uInt32 > StringToIndexMap;
typedef std::vector< Sequence< Sequence< PropertyValue > > > AddonToolBars;
+ typedef std::vector< Sequence< Sequence< PropertyValue > > > AddonNotebookBars;
typedef std::unordered_map< OUString, MergeToolbarInstructionContainer > ToolbarMergingInstructions;
+ typedef std::unordered_map< OUString, MergeNotebookBarInstructionContainer > NotebookBarMergingInstructions;
/*-****************************************************************************************************
@short return list of key names of our configuration management which represent our module tree
@@ -250,19 +277,26 @@ class AddonsOptions_Impl : public ConfigItem
void ReadOfficeMenuBarSet( Sequence< Sequence< PropertyValue > >& aAddonOfficeMenuBarSeq );
void ReadOfficeToolBarSet( AddonToolBars& rAddonOfficeToolBars, std::vector< OUString >& rAddonOfficeToolBarResNames );
bool ReadToolBarItemSet( const OUString& rToolBarItemSetNodeName, Sequence< Sequence< PropertyValue > >& aAddonOfficeToolBarSeq );
+ void ReadOfficeNotebookBarSet( AddonNotebookBars& rAddonOfficeNotebookBars, std::vector< OUString >& rAddonOfficeNotebookBarResNames );
+ bool ReadNotebookBarItemSet( const OUString& rNotebookBarItemSetNodeName, Sequence< Sequence< PropertyValue > >& aAddonOfficeNotebookBarSeq );
+
void ReadOfficeHelpSet( Sequence< Sequence< PropertyValue > >& aAddonOfficeHelpMenuSeq );
void ReadImages( ImageManager& aImageManager );
void ReadMenuMergeInstructions( MergeMenuInstructionContainer& rContainer );
void ReadToolbarMergeInstructions( ToolbarMergingInstructions& rToolbarMergeMap );
+ void ReadNotebookBarMergeInstructions( NotebookBarMergingInstructions& rNotebookBarMergeMap );
void ReadStatusbarMergeInstructions( MergeStatusbarInstructionContainer& rContainer );
void ReadMergeMenuData( const OUString& aMergeAddonInstructionBase, Sequence< Sequence< PropertyValue > >& rMergeMenu );
bool ReadMergeToolbarData( const OUString& aMergeAddonInstructionBase, Sequence< Sequence< PropertyValue > >& rMergeToolbarItems );
+ bool ReadMergeNotebookBarData( const OUString& aMergeAddonInstructionBase, Sequence< Sequence< PropertyValue > >& rMergeNotebookBarItems );
bool ReadMergeStatusbarData( const OUString& aMergeAddonInstructionBase, Sequence< Sequence< PropertyValue > >& rMergeStatusbar );
bool ReadMenuItem( const OUString& aMenuItemNodeName, Sequence< PropertyValue >& aMenuItem, bool bIgnoreSubMenu = false );
bool ReadPopupMenu( const OUString& aPopupMenuNodeName, Sequence< PropertyValue >& aPopupMenu );
void AppendPopupMenu( Sequence< PropertyValue >& aTargetPopupMenu, const Sequence< PropertyValue >& rSourcePopupMenu );
bool ReadToolBarItem( const OUString& aToolBarItemNodeName, Sequence< PropertyValue >& aToolBarItem );
+ bool ReadNotebookBarItem( const OUString& aNotebookBarItemNodeName, Sequence< PropertyValue >& aNotebookBarItem );
+
bool ReadStatusBarItem( const OUString& aStatusbarItemNodeName, Sequence< PropertyValue >& aStatusbarItem );
std::unique_ptr<ImageEntry> ReadImageData( const OUString& aImagesNodeName );
void ReadAndAssociateImages( const OUString& aURL, const OUString& aImageId );
@@ -276,6 +310,8 @@ class AddonsOptions_Impl : public ConfigItem
Sequence< OUString > GetPropertyNamesMenuItem( const OUString& aPropertyRootNode ) const;
Sequence< OUString > GetPropertyNamesPopupMenu( const OUString& aPropertyRootNode ) const;
Sequence< OUString > GetPropertyNamesToolBarItem( const OUString& aPropertyRootNode ) const;
+ Sequence< OUString > GetPropertyNamesNotebookBarItem( const OUString& aPropertyRootNode ) const;
+
Sequence< OUString > GetPropertyNamesStatusbarItem( const OUString& aPropertyRootNode ) const;
Sequence< OUString > GetPropertyNamesImages( const OUString& aPropertyRootNode ) const;
bool CreateImageFromSequence( Image& rImage, Sequence< sal_Int8 >& rBitmapDataSeq ) const;
@@ -292,18 +328,23 @@ class AddonsOptions_Impl : public ConfigItem
OUString m_aPropImagesNames[PROPERTYCOUNT_IMAGES];
OUString m_aPropMergeMenuNames[PROPERTYCOUNT_MERGE_MENUBAR];
OUString m_aPropMergeToolbarNames[PROPERTYCOUNT_MERGE_TOOLBAR];
+ OUString m_aPropMergeNotebookBarNames[PROPERTYCOUNT_MERGE_NOTEBOOKBAR];
OUString m_aPropMergeStatusbarNames[PROPERTYCOUNT_MERGE_STATUSBAR];
OUString m_aPathDelimiter;
OUString m_aRootAddonPopupMenuURLPrexfix;
Sequence< Sequence< PropertyValue > > m_aCachedMenuProperties;
Sequence< Sequence< PropertyValue > > m_aCachedMenuBarPartProperties;
AddonToolBars m_aCachedToolBarPartProperties;
+ AddonNotebookBars m_aCachedNotebookBarPartProperties;
std::vector< OUString > m_aCachedToolBarPartResourceNames;
+ std::vector< OUString > m_aCachedNotebookBarPartResourceNames;
Sequence< Sequence< PropertyValue > > m_aCachedHelpMenuProperties;
ImageManager m_aImageManager;
Sequence< Sequence< PropertyValue > > m_aEmptyAddonToolBar;
+ Sequence< Sequence< PropertyValue > > m_aEmptyAddonNotebookBar;
MergeMenuInstructionContainer m_aCachedMergeMenuInsContainer;
ToolbarMergingInstructions m_aCachedToolbarMergingInstructions;
+ NotebookBarMergingInstructions m_aCachedNotebookBarMergingInstructions;
MergeStatusbarInstructionContainer m_aCachedStatusbarMergingInstructions;
};
@@ -337,6 +378,7 @@ AddonsOptions_Impl::AddonsOptions_Impl()
m_aPropNames[ INDEX_AUTOSIZE ] = "AutoSize";
m_aPropNames[ INDEX_OWNERDRAW ] = "OwnerDraw";
m_aPropNames[ INDEX_MANDATORY ] = "Mandatory";
+ m_aPropNames[ INDEX_STYLE ] = "Style";
// initialize array with fixed images property names
m_aPropImagesNames[ OFFSET_IMAGES_SMALL ] = "ImageSmall";
@@ -364,6 +406,14 @@ AddonsOptions_Impl::AddonsOptions_Impl()
m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGECONTEXT ] = "MergeContext";
m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_TOOLBARITEMS ] = "ToolBarItems";
+ m_aPropMergeNotebookBarNames[ OFFSET_MERGENOTEBOOKBAR_NOTEBOOKBAR ] = "MergeNotebookBar";
+ m_aPropMergeNotebookBarNames[ OFFSET_MERGENOTEBOOKBAR_MERGEPOINT ] = "MergePoint";
+ m_aPropMergeNotebookBarNames[ OFFSET_MERGENOTEBOOKBAR_MERGECOMMAND ] = "MergeCommand";
+ m_aPropMergeNotebookBarNames[ OFFSET_MERGENOTEBOOKBAR_MERGECOMMANDPARAMETER ] = "MergeCommandParameter";
+ m_aPropMergeNotebookBarNames[ OFFSET_MERGENOTEBOOKBAR_MERGEFALLBACK ] = "MergeFallback";
+ m_aPropMergeNotebookBarNames[ OFFSET_MERGENOTEBOOKBAR_MERGECONTEXT ] = "MergeContext";
+ m_aPropMergeNotebookBarNames[ OFFSET_MERGENOTEBOOKBAR_NOTEBOOKBARITEMS ] = "NotebookBarItems";
+
m_aPropMergeStatusbarNames[ OFFSET_MERGESTATUSBAR_MERGEPOINT ] = "MergePoint";
m_aPropMergeStatusbarNames[ OFFSET_MERGESTATUSBAR_MERGECOMMAND ] = "MergeCommand";
m_aPropMergeStatusbarNames[ OFFSET_MERGESTATUSBAR_MERGECOMMANDPARAMETER ] = "MergeCommandParameter";
@@ -392,23 +442,28 @@ void AddonsOptions_Impl::ReadConfigurationData()
m_aCachedMenuProperties = Sequence< Sequence< PropertyValue > >();
m_aCachedMenuBarPartProperties = Sequence< Sequence< PropertyValue > >();
m_aCachedToolBarPartProperties = AddonToolBars();
+ m_aCachedNotebookBarPartProperties = AddonNotebookBars();
m_aCachedHelpMenuProperties = Sequence< Sequence< PropertyValue > >();
m_aCachedToolBarPartResourceNames.clear();
+ m_aCachedNotebookBarPartResourceNames.clear();
m_aImageManager = ImageManager();
ReadAddonMenuSet( m_aCachedMenuProperties );
ReadOfficeMenuBarSet( m_aCachedMenuBarPartProperties );
ReadOfficeToolBarSet( m_aCachedToolBarPartProperties, m_aCachedToolBarPartResourceNames );
+ ReadOfficeNotebookBarSet( m_aCachedNotebookBarPartProperties, m_aCachedNotebookBarPartResourceNames );
ReadOfficeHelpSet( m_aCachedHelpMenuProperties );
ReadImages( m_aImageManager );
m_aCachedMergeMenuInsContainer.clear();
m_aCachedToolbarMergingInstructions.clear();
+ m_aCachedNotebookBarMergingInstructions.clear();
m_aCachedStatusbarMergingInstructions.clear();
ReadMenuMergeInstructions( m_aCachedMergeMenuInsContainer );
ReadToolbarMergeInstructions( m_aCachedToolbarMergingInstructions );
+ ReadNotebookBarMergeInstructions( m_aCachedNotebookBarMergingInstructions );
ReadStatusbarMergeInstructions( m_aCachedStatusbarMergingInstructions );
}
@@ -442,6 +497,13 @@ sal_Int32 AddonsOptions_Impl::GetAddonsToolBarCount() const
// public method
+sal_Int32 AddonsOptions_Impl::GetAddonsNotebookBarCount() const
+{
+ return m_aCachedNotebookBarPartProperties.size();
+}
+
+// public method
+
const Sequence< Sequence< PropertyValue > >& AddonsOptions_Impl::GetAddonsToolBarPart( sal_uInt32 nIndex ) const
{
if ( /*nIndex >= 0 &&*/ nIndex < m_aCachedToolBarPartProperties.size() )
@@ -452,6 +514,16 @@ const Sequence< Sequence< PropertyValue > >& AddonsOptions_Impl::GetAddonsToolBa
// public method
+const Sequence< Sequence< PropertyValue > >& AddonsOptions_Impl::GetAddonsNotebookBarPart( sal_uInt32 nIndex ) const
+{
+ if ( /*nIndex >= 0 &&*/ nIndex < m_aCachedNotebookBarPartProperties.size() )
+ return m_aCachedNotebookBarPartProperties[nIndex];
+ else
+ return m_aEmptyAddonNotebookBar;
+}
+
+// public method
+
const OUString AddonsOptions_Impl::GetAddonsToolbarResourceName( sal_uInt32 nIndex ) const
{
if ( nIndex < m_aCachedToolBarPartResourceNames.size() )
@@ -462,6 +534,16 @@ const OUString AddonsOptions_Impl::GetAddonsToolbarResourceName( sal_uInt32 nInd
// public method
+const OUString AddonsOptions_Impl::GetAddonsNotebookBarResourceName( sal_uInt32 nIndex ) const
+{
+ if ( nIndex < m_aCachedNotebookBarPartResourceNames.size() )
+ return m_aCachedNotebookBarPartResourceNames[nIndex];
+ else
+ return OUString();
+}
+
+// public method
+
bool AddonsOptions_Impl::GetMergeToolbarInstructions(
const OUString& rToolbarName,
MergeToolbarInstructionContainer& rToolbarInstructions ) const
@@ -478,6 +560,22 @@ bool AddonsOptions_Impl::GetMergeToolbarInstructions(
// public method
+bool AddonsOptions_Impl::GetMergeNotebookBarInstructions(
+ const OUString& rNotebookBarName,
+ MergeNotebookBarInstructionContainer& rNotebookBarInstructions ) const
+{
+ NotebookBarMergingInstructions::const_iterator pIter = m_aCachedNotebookBarMergingInstructions.find( rNotebookBarName );
+ if ( pIter != m_aCachedNotebookBarMergingInstructions.end() )
+ {
+ rNotebookBarInstructions = pIter->second;
+ return true;
+ }
+ else
+ return false;
+}
+
+// public method
+
static Image ScaleImage( const Image &rImage, bool bBig )
{
Size aSize = ToolBox::GetDefaultImageSize(bBig ? ToolBoxButtonSize::Large : ToolBoxButtonSize::Small);
@@ -710,6 +808,65 @@ bool AddonsOptions_Impl::ReadToolBarItemSet( const OUString& rToolBarItemSetNode
return ( static_cast<sal_uInt32>(rAddonOfficeToolBarSeq.getLength()) > nToolBarItemCount );
}
+void AddonsOptions_Impl::ReadOfficeNotebookBarSet(
+ AddonNotebookBars& rAddonOfficeNotebookBars,
+ std::vector<OUString>& rAddonOfficeNotebookBarResNames)
+{
+ // Read the OfficeToolBar set and fill property sequences
+ OUString aAddonNotebookBarNodeName("AddonUI/OfficeNotebookBar");
+ Sequence<OUString> aAddonNotebookBarNodeSeq = GetNodeNames(aAddonNotebookBarNodeName);
+ OUString aAddonNotebookBarNode(aAddonNotebookBarNodeName + m_aPathDelimiter);
+
+ sal_uInt32 nCount = aAddonNotebookBarNodeSeq.getLength();
+
+ for (sal_uInt32 n = 0; n < nCount; n++)
+ {
+ OUString aNotebookBarItemNode(aAddonNotebookBarNode + aAddonNotebookBarNodeSeq[n]);
+ rAddonOfficeNotebookBarResNames.push_back(aAddonNotebookBarNodeSeq[n]);
+ rAddonOfficeNotebookBars.push_back(m_aEmptyAddonNotebookBar);
+ ReadNotebookBarItemSet(aNotebookBarItemNode, rAddonOfficeNotebookBars[n]);
+ }
+}
+
+bool AddonsOptions_Impl::ReadNotebookBarItemSet(
+ const OUString& rNotebookBarItemSetNodeName,
+ Sequence<Sequence<PropertyValue>>& rAddonOfficeNotebookBarSeq)
+{
+ sal_uInt32 nNotebookBarItemCount = rAddonOfficeNotebookBarSeq.getLength();
+ OUString aAddonNotebookBarItemSetNode(rNotebookBarItemSetNodeName + m_aPathDelimiter);
+ Sequence<OUString> aAddonNotebookBarItemSetNodeSeq = GetNodeNames(rNotebookBarItemSetNodeName);
+ Sequence<PropertyValue> aNotebookBarItem(PROPERTYCOUNT_NOTEBOOKBARITEM);
+
+ // 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
+ = 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];
+
+ sal_uInt32 nCount = aAddonNotebookBarItemSetNodeSeq.getLength();
+ for (sal_uInt32 n = 0; n < nCount; n++)
+ {
+ OUString aNotebookBarItemNode(aAddonNotebookBarItemSetNode
+ + aAddonNotebookBarItemSetNodeSeq[n]);
+ // Read the NotebookBarItem
+ if (ReadNotebookBarItem(aNotebookBarItemNode, aNotebookBarItem))
+ {
+ // Successfully read a toolbar item, append to our list
+ sal_uInt32 nAddonCount = rAddonOfficeNotebookBarSeq.getLength();
+ rAddonOfficeNotebookBarSeq.realloc(nAddonCount + 1);
+ rAddonOfficeNotebookBarSeq[nAddonCount] = aNotebookBarItem;
+ }
+ }
+
+ return (static_cast<sal_uInt32>(rAddonOfficeNotebookBarSeq.getLength())
+ > nNotebookBarItemCount);
+}
+
void AddonsOptions_Impl::ReadImages( ImageManager& aImageManager )
{
// Read the user-defined Images set and fill image manager
@@ -925,6 +1082,90 @@ bool AddonsOptions_Impl::ReadMergeToolbarData( const OUString& aMergeAddonInstru
return ReadToolBarItemSet( aMergeToolbarBaseNode, rMergeToolbarItems );
}
+void AddonsOptions_Impl::ReadNotebookBarMergeInstructions(
+ NotebookBarMergingInstructions& rCachedNotebookBarMergingInstructions)
+{
+ const OUString aNotebookBarMergeRootName("AddonUI/OfficeNotebookBarMerging/");
+
+ Sequence<OUString> aAddonMergeNodesSeq = GetNodeNames(aNotebookBarMergeRootName);
+ sal_uInt32 nCount = aAddonMergeNodesSeq.getLength();
+
+ // Init the property value sequence
+ Sequence<OUString> aNodePropNames(6);
+
+ for (sal_uInt32 i = 0; i < nCount; i++)
+ {
+ OUString aMergeAddonInstructions(aNotebookBarMergeRootName + aAddonMergeNodesSeq[i]);
+
+ Sequence<OUString> aAddonInstMergeNodesSeq = GetNodeNames(aMergeAddonInstructions);
+ sal_uInt32 nCountAddons = aAddonInstMergeNodesSeq.getLength();
+
+ for (sal_uInt32 j = 0; j < nCountAddons; j++)
+ {
+ OUStringBuffer aMergeAddonInstructionBase(aMergeAddonInstructions);
+ aMergeAddonInstructionBase.append(m_aPathDelimiter);
+ aMergeAddonInstructionBase.append(aAddonInstMergeNodesSeq[j]);
+ aMergeAddonInstructionBase.append(m_aPathDelimiter);
+
+ // Create sequence for data access
+ OUStringBuffer aBuffer(aMergeAddonInstructionBase);
+ aBuffer.append(m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_NOTEBOOKBAR]);
+ aNodePropNames[0] = aBuffer.makeStringAndClear();
+
+ aBuffer = aMergeAddonInstructionBase;
+ aBuffer.append(m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_MERGEPOINT]);
+ aNodePropNames[1] = aBuffer.makeStringAndClear();
+
+ aBuffer = aMergeAddonInstructionBase;
+ aBuffer.append(m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_MERGECOMMAND]);
+ aNodePropNames[2] = aBuffer.makeStringAndClear();
+
+ aBuffer = aMergeAddonInstructionBase;
+ aBuffer.append(
+ m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_MERGECOMMANDPARAMETER]);
+ aNodePropNames[3] = aBuffer.makeStringAndClear();
+
+ aBuffer = aMergeAddonInstructionBase;
+ aBuffer.append(m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_MERGEFALLBACK]);
+ aNodePropNames[4] = aBuffer.makeStringAndClear();
+
+ aBuffer = aMergeAddonInstructionBase;
+ aBuffer.append(m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_MERGECONTEXT]);
+ aNodePropNames[5] = aBuffer.makeStringAndClear();
+
+ Sequence<Any> aNodePropValues = GetProperties(aNodePropNames);
+
+ MergeNotebookBarInstruction aMergeNotebookBarInstruction;
+ aNodePropValues[0] >>= aMergeNotebookBarInstruction.aMergeNotebookBar;
+ aNodePropValues[1] >>= aMergeNotebookBarInstruction.aMergePoint;
+ aNodePropValues[2] >>= aMergeNotebookBarInstruction.aMergeCommand;
+ aNodePropValues[3] >>= aMergeNotebookBarInstruction.aMergeCommandParameter;
+ aNodePropValues[4] >>= aMergeNotebookBarInstruction.aMergeFallback;
+ aNodePropValues[5] >>= aMergeNotebookBarInstruction.aMergeContext;
+
+ ReadMergeNotebookBarData(aMergeAddonInstructionBase.makeStringAndClear(),
+ aMergeNotebookBarInstruction.aMergeNotebookBarItems);
+
+ MergeNotebookBarInstructionContainer& rVector
+ = rCachedNotebookBarMergingInstructions[aMergeNotebookBarInstruction
+ .aMergeNotebookBar];
+ rVector.push_back(aMergeNotebookBarInstruction);
+ }
+ }
+}
+
+bool AddonsOptions_Impl::ReadMergeNotebookBarData(
+ const OUString& aMergeAddonInstructionBase,
+ Sequence<Sequence<PropertyValue>>& rMergeNotebookBarItems)
+{
+ OUStringBuffer aBuffer(aMergeAddonInstructionBase);
+ aBuffer.append(m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_NOTEBOOKBARITEMS]);
+
+ OUString aMergeNotebookBarBaseNode = aBuffer.makeStringAndClear();
+
+ return ReadNotebookBarItemSet(aMergeNotebookBarBaseNode, rMergeNotebookBarItems);
+}
+
void AddonsOptions_Impl::ReadStatusbarMergeInstructions( MergeStatusbarInstructionContainer& aContainer )
{
const OUString aStatusbarMergeRootName( "AddonUI/OfficeStatusbarMerging/" );
@@ -1233,6 +1474,61 @@ bool AddonsOptions_Impl::ReadToolBarItem( const OUString& aToolBarItemNodeName,
return bResult;
}
+bool AddonsOptions_Impl::ReadNotebookBarItem( const OUString& aNotebookBarItemNodeName, Sequence< PropertyValue >& aNotebookBarItem )
+{
+ bool bResult = false;
+ OUString aTitle;
+ OUString aURL;
+ OUString aAddonNotebookBarItemTreeNode( aNotebookBarItemNodeName + m_aPathDelimiter );
+
+ Sequence< Any > aNotebookBarItemNodePropValues = GetProperties( GetPropertyNamesNotebookBarItem( aAddonNotebookBarItemTreeNode ) );
+
+ // A toolbar item must have a command URL
+ if (( aNotebookBarItemNodePropValues[ OFFSET_NOTEBOOKBARITEM_URL ] >>= aURL ) && !aURL.isEmpty() )
+ {
+ if ( aURL == SEPARATOR_URL )
+ {
+ // 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();
+
+ bResult = true;
+ }
+ else if (( aNotebookBarItemNodePropValues[ OFFSET_NOTEBOOKBARITEM_TITLE ] >>= aTitle ) && !aTitle.isEmpty() )
+ {
+ // A normal toolbar item must also have title => read the other properties;
+ OUString aImageId;
+
+ // Try to map a user-defined image URL to our internal private image URL
+ 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 ];
+
+ // 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 ];
+
+ bResult = true;
+ }
+ }
+
+ return bResult;
+}
+
void AddonsOptions_Impl::ReadSubMenuEntries( const Sequence< OUString >& aSubMenuNodeNames, Sequence< Sequence< PropertyValue > >& rSubMenuSeq )
{
Sequence< PropertyValue > aMenuItem( PROPERTYCOUNT_MENUITEM );
@@ -1438,6 +1734,23 @@ Sequence< OUString > AddonsOptions_Impl::GetPropertyNamesToolBarItem( const OUSt
return lResult;
}
+Sequence< OUString > AddonsOptions_Impl::GetPropertyNamesNotebookBarItem( const OUString& aPropertyRootNode ) const
+{
+ Sequence< OUString > lResult( PROPERTYCOUNT_NOTEBOOKBARITEM );
+
+ // 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 ];
+
+ return lResult;
+}
+
Sequence< OUString > AddonsOptions_Impl::GetPropertyNamesStatusbarItem(
const OUString& aPropertyRootNode ) const
{
@@ -1516,6 +1829,14 @@ sal_Int32 AddonsOptions::GetAddonsToolBarCount() const
// public method
+sal_Int32 AddonsOptions::GetAddonsNotebookBarCount() const
+{
+ MutexGuard aGuard( GetOwnStaticMutex() );
+ return m_pImpl->GetAddonsNotebookBarCount();
+}
+
+// public method
+
const Sequence< Sequence< PropertyValue > >& AddonsOptions::GetAddonsMenu() const
{
MutexGuard aGuard( GetOwnStaticMutex() );
@@ -1540,6 +1861,14 @@ const Sequence< Sequence< PropertyValue > >& AddonsOptions::GetAddonsToolBarPart
// public method
+const Sequence< Sequence< PropertyValue > >& AddonsOptions::GetAddonsNotebookBarPart( sal_uInt32 nIndex ) const
+{
+ MutexGuard aGuard( GetOwnStaticMutex() );
+ return m_pImpl->GetAddonsNotebookBarPart( nIndex );
+}
+
+// public method
+
const OUString AddonsOptions::GetAddonsToolbarResourceName( sal_uInt32 nIndex ) const
{
MutexGuard aGuard( GetOwnStaticMutex() );
@@ -1548,6 +1877,14 @@ const OUString AddonsOptions::GetAddonsToolbarResourceName( sal_uInt32 nIndex )
// public method
+const OUString AddonsOptions::GetAddonsNotebookBarResourceName( sal_uInt32 nIndex ) const
+{
+ MutexGuard aGuard( GetOwnStaticMutex() );
+ return m_pImpl->GetAddonsNotebookBarResourceName( nIndex );
+}
+
+// public method
+
const Sequence< Sequence< PropertyValue > >& AddonsOptions::GetAddonsHelpMenu() const
{
MutexGuard aGuard( GetOwnStaticMutex() );
@@ -1573,6 +1910,19 @@ bool AddonsOptions::GetMergeToolbarInstructions(
rToolbarName, rToolbarInstructions );
}
+// public method
+
+bool AddonsOptions::GetMergeNotebookBarInstructions(
+ const OUString& rNotebookBarName,
+ MergeNotebookBarInstructionContainer& rNotebookBarInstructions ) const
+{
+ MutexGuard aGuard( GetOwnStaticMutex() );
+ return m_pImpl->GetMergeNotebookBarInstructions(
+ rNotebookBarName, rNotebookBarInstructions );
+}
+
+//public method
+
const MergeStatusbarInstructionContainer& AddonsOptions::GetMergeStatusbarInstructions() const
{
MutexGuard aGuard( GetOwnStaticMutex() );
diff --git a/include/framework/addonsoptions.hxx b/include/framework/addonsoptions.hxx
index 8a96f25970b7..ca7a464b61a0 100644
--- a/include/framework/addonsoptions.hxx
+++ b/include/framework/addonsoptions.hxx
@@ -68,6 +68,19 @@ struct FWE_DLLPUBLIC MergeToolbarInstruction
typedef ::std::vector< MergeToolbarInstruction > MergeToolbarInstructionContainer;
+struct FWE_DLLPUBLIC MergeNotebookBarInstruction
+{
+ OUString aMergeNotebookBar;
+ OUString aMergePoint;
+ OUString aMergeCommand;
+ OUString aMergeCommandParameter;
+ OUString aMergeFallback;
+ OUString aMergeContext;
+ css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aMergeNotebookBarItems;
+};
+
+typedef ::std::vector< MergeNotebookBarInstruction > MergeNotebookBarInstructionContainer;
+
struct FWE_DLLPUBLIC MergeStatusbarInstruction
{
OUString aMergePoint;
@@ -117,6 +130,14 @@ class FWE_DLLPUBLIC AddonsOptions
sal_Int32 GetAddonsToolBarCount() const ;
/*-****************************************************************************************************
+ @short returns number of addons notebookbar
+ @descr Call to retrieve the number of addons notebookbar
+
+ @return number of addons notebookar
+ *//*-*****************************************************************************************************/
+ sal_Int32 GetAddonsNotebookBarCount() const ;
+
+ /*-****************************************************************************************************
@short returns the complete addons menu
@descr Call it to get all entries of the addon menu.
We return a list of all nodes with its names and properties.
@@ -155,6 +176,24 @@ class FWE_DLLPUBLIC AddonsOptions
const OUString GetAddonsToolbarResourceName( sal_uInt32 nIndex ) const;
/*-****************************************************************************************************
+ @short Gets a NotebookBar part of an single addon
+ @return A complete
+
+ @onerror We return sal_False
+ *//*-*****************************************************************************************************/
+
+ const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > >& GetAddonsNotebookBarPart( sal_uInt32 nIndex ) const;
+
+ /*-****************************************************************************************************
+ @short Gets a unique NotebookBar resource name of an single addon
+ @return A complete
+
+ @onerror We return sal_False
+ *//*-*****************************************************************************************************/
+
+ const OUString GetAddonsNotebookBarResourceName( sal_uInt32 ) const;
+
+ /*-****************************************************************************************************
@short Retrieves all available merge instructions for the Office menu bar
@return The filled MergeMenuDefinitionContaier
@@ -172,6 +211,14 @@ class FWE_DLLPUBLIC AddonsOptions
bool GetMergeToolbarInstructions( const OUString& rToolbarName, MergeToolbarInstructionContainer& rToolbar ) const;
/*-****************************************************************************************************
+ @short Retrieves all available merge instructions for Notebookbar
+ @return The filled
+
+ @onerror We return sal_False
+ *//*-*****************************************************************************************************/
+ bool GetMergeNotebookBarInstructions( const OUString& rNotebookBarName, MergeNotebookBarInstructionContainer& rNotebookBar ) const;
+
+ /*-****************************************************************************************************
@short Gets the Add-On help menu part of all addon components registered
@return A complete
diff --git a/officecfg/registry/schema/org/openoffice/Office/Addons.xcs b/officecfg/registry/schema/org/openoffice/Office/Addons.xcs
index 2f83bcfd8c23..42643cddd245 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Addons.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Addons.xcs
@@ -295,6 +295,91 @@
<value>0</value>
</prop>
</group>
+ <group oor:name="MergeNotebookBarInstruction">
+ <info>
+ <desc>Describes a merge menu instruction of an external component. The name must be unique and should be written using a package-scheme like org.openoffice.external.applicationexecuter to minimize name clashes. A menu instruction describes how the attached menu items should be merged into the Office menubar.</desc>
+ </info>
+ <prop oor:name="MergeNotebookBar" oor:type="xs:string">
+ <info>
+ <desc>Defines the notebookbar interface.</desc>
+ </info>
+ </prop>
+ <prop oor:name="MergePoint" oor:type="xs:string">
+ <info>
+ <desc>Describes the command that should be used as a reference point for the merge command.</desc>
+ </info>
+ </prop>
+ <prop oor:name="MergeCommand" oor:type="xs:string">
+ <info>
+ <desc>A command to be processed for this merge menu instruction.</desc>
+ </info>
+ </prop>
+ <prop oor:name="MergeCommandParameter" oor:type="xs:string">
+ <info>
+ <desc>Optional parameters for a merge command. Interpretation depends on the individual command.</desc>
+ </info>
+ </prop>
+ <prop oor:name="MergeFallback" oor:type="xs:string">
+ <info>
+ <desc>A fallback command to be used if MergeCommand cannot be applied.</desc>
+ </info>
+ </prop>
+ <prop oor:name="MergeContext" oor:type="xs:string">
+ <info>
+ <desc>A property to define the context of this merge instruction. It can be empty or a colon separated list of the supported application modules.</desc>
+ </info>
+ </prop>
+ <set oor:name="NotebookBarItems" oor:node-type="NotebookBarItem">
+ <info>
+ <desc>Contains a list of notebookbar items used by an Add-On.</desc>
+ </info>
+ </set>
+ </group>
+ <group oor:name="NotebookBarItem">
+ <info>
+ <desc>Describes a toolbar item representing a function of an external component. The name must be unique and should be written using a package-scheme like org.openoffice.external.applicationexecuter to minimize name clashes.</desc>
+ </info>
+ <prop oor:name="URL" oor:type="xs:string">
+ <info>
+ <desc>A command URL which represents the function to execute.</desc>
+ </info>
+ </prop>
+ <prop oor:name="Title" oor:type="xs:string" oor:localized="true">
+ <info>
+ <desc>A localized string used to as the menu item title.</desc>
+ </info>
+ </prop>
+ <prop oor:name="ImageIdentifier" oor:type="xs:string">
+ <info>
+ <desc>A private URL used to reference an optional internal menu image. Example: private:image/3216 addresses the internal Office image with id=3216.</desc>
+ </info>
+ </prop>
+ <prop oor:name="Target" oor:type="xs:string">
+ <info>
+ <desc>This is the target URL which is used for the dispatch command. There are special URL's to address certain targets: _self, current frame; _default, default; _blank, create new frame.</desc>
+ </info>
+ </prop>
+ <prop oor:name="Context" oor:type="xs:string">
+ <info>
+ <desc>A property to define the context of a notebookbar item. It can be empty or a colon separated list of the supported application modules.</desc>
+ </info>
+ </prop>
+ <prop oor:name="ControlType" oor:type="xs:string">
+ <info>
+ <desc>A property to define the control type of the notebookbar item. It will be interpreted as OpenOffice.org default toggle button.</desc>
+ </info>
+ </prop>
+ <prop oor:name="Width" oor:type="xs:long">
+ <info>
+ <desc>A property to define the size of a toolbar item. This property works only ControlTypes which can have a dynamic size (e.g. comboboxes, edit fields, spin fields)</desc>
+ </info>
+ </prop>
+ <prop oor:name="Style" oor:type="xs:string">
+ <info>
+ <desc>A property to define the style of item in a notebookbar (e.g text, icon, text + icon)</desc>
+ </info>
+ </prop>
+ </group>
<group oor:name="UserDefinedImages">
<info>
<desc>A group of optional user-defined images. There are two ways to define image - 1. Embed the image data directly into the configuration. 2. Use file URLs to address external bitmap files. Embedded image data has a higher priority than file URLs.</desc>
@@ -365,6 +450,11 @@
<desc>Contains a list of merge menu instructions defined by an Add-On which specify how to merge menu items into the Office menubar.</desc>
</info>
</set>
+ <set oor:name="NotebookBarItems" oor:node-type="NotebookBarItem">
+ <info>
+ <desc>Contains a list of notebookbar items used by an Add-On.</desc>
+ </info>
+ </set>
<set oor:name="MergeToolBarItems" oor:node-type="MergeToolBarInstruction">
<info>
<desc>Contains a list of merge toolbar instructions defined by an Add-On which specify how to merge toolbar items into an existing toolbar.</desc>
@@ -375,6 +465,11 @@
<desc>Contains a list of merge status bar instructions defined by an Add-On which specify how to merge status bar items into an existing status bar.</desc>
</info>
</set>
+ <set oor:name="MergeNotebookBarItems" oor:node-type="MergeNotebookBarInstruction">
+ <info>
+ <desc>Contains a list of merge notebookbar instructions defined by an Add-On which specify how to merge notebookbar items into an existing toolbar.</desc>
+ </info>
+ </set>
</templates>
<component>
<group oor:name="AddonUI">
@@ -421,6 +516,16 @@
<desc>Contains a list of functions inserted into the Office help menu. The optional property 'Submenu' will be ignored for this set.</desc>
</info>
</set>
+ <set oor:name="OfficeNotebookBar" oor:node-type="NotebookBarItems">
+ <info>
+ <desc>Contains a list of sets of notebookbar items that are part of add-on notebookbar.</desc>
+ </info>
+ </set>
+ <set oor:name="OfficeNotebookBarMerging" oor:node-type="MergeNotebookBarItems">
+ <info>
+ <desc>Contains a list of notebookbar merging instructions of different add-ons. </desc>
+ </info>
+ </set>
</group>
</component>
</oor:component-schema>