[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - framework/inc framework/source
Maxim Monastirsky
momonasmon at gmail.com
Sun Jan 10 23:10:27 PST 2016
framework/inc/uielement/toolbarmerger.hxx | 6 ++++-
framework/source/uielement/addonstoolbarmanager.cxx | 6 +++--
framework/source/uielement/toolbarmanager.cxx | 2 +
framework/source/uielement/toolbarmerger.cxx | 23 ++++++++++++++------
4 files changed, 28 insertions(+), 9 deletions(-)
New commits:
commit f18fac7e726fca5379ec03588938748815292e39
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Sat Jan 9 22:46:16 2016 +0200
Fix Addons.xcu toolbar items width handling
This is useful for some complex controls (e.g. Combobox).
Regression of cb4177b5f6d2c63548fa544a19b36001c57193e4
Change-Id: I683cc20e9db72a4dd58d89063ec6bfcd05a1068e
(cherry picked from commit ee3cd777e187669f2d9dec156854c00cab948a50)
Reviewed-on: https://gerrit.libreoffice.org/21296
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
diff --git a/framework/inc/uielement/toolbarmerger.hxx b/framework/inc/uielement/toolbarmerger.hxx
index ea1ab34..4ad1467 100644
--- a/framework/inc/uielement/toolbarmerger.hxx
+++ b/framework/inc/uielement/toolbarmerger.hxx
@@ -44,6 +44,7 @@ struct AddonsParams
OUString aImageId;
OUString aTarget;
OUString aControlType;
+ sal_uInt16 nWidth;
};
struct AddonToolbarItem
@@ -54,6 +55,7 @@ struct AddonToolbarItem
OUString aTarget;
OUString aContext;
OUString aControlType;
+ sal_uInt16 nWidth;
};
typedef ::std::vector< AddonToolbarItem > AddonToolbarItemContainer;
@@ -79,7 +81,8 @@ class ToolBarMerger
OUString& rImageIdentifier,
OUString& rTarget,
OUString& rContext,
- OUString& rControlType );
+ OUString& rControlType,
+ sal_uInt16& rWidth );
static ReferenceToolbarPathInfo FindReferencePoint( ToolBox* pToolbar,
const OUString& rReferencePoint );
@@ -131,6 +134,7 @@ class ToolBarMerger
ToolBox* pToolbar,
const OUString& rCommandURL,
sal_uInt16 nId,
+ sal_uInt16 nWidth,
const OUString& rControlType );
static void CreateToolbarItem( ToolBox* pToolbox,
diff --git a/framework/source/uielement/addonstoolbarmanager.cxx b/framework/source/uielement/addonstoolbarmanager.cxx
index 8ca598a..7804108 100644
--- a/framework/source/uielement/addonstoolbarmanager.cxx
+++ b/framework/source/uielement/addonstoolbarmanager.cxx
@@ -228,10 +228,11 @@ void AddonsToolBarManager::FillToolbar( const Sequence< Sequence< PropertyValue
OUString aContext;
OUString aTarget;
OUString aControlType;
+ sal_uInt16 nWidth( 0 );
const Sequence< PropertyValue >& rSeq = rAddonToolbar[n];
- ToolBarMerger::ConvertSequenceToValues( rSeq, aURL, aTitle, aImageId, aTarget, aContext, aControlType );
+ ToolBarMerger::ConvertSequenceToValues( rSeq, aURL, aTitle, aImageId, aTarget, aContext, aControlType, nWidth );
if ( IsCorrectContext( aModuleIdentifier, aContext ))
{
@@ -262,6 +263,7 @@ void AddonsToolBarManager::FillToolbar( const Sequence< Sequence< PropertyValue
AddonsParams* pRuntimeItemData = new AddonsParams;
pRuntimeItemData->aImageId = aImageId;
pRuntimeItemData->aTarget = aTarget;
+ pRuntimeItemData->nWidth = nWidth;
m_pToolBar->SetItemData( nId, pRuntimeItemData );
m_pToolBar->SetItemCommand( nId, aURL );
@@ -307,7 +309,7 @@ void AddonsToolBarManager::FillToolbar( const Sequence< Sequence< PropertyValue
{
::cppu::OWeakObject* pController = nullptr;
- pController = ToolBarMerger::CreateController( m_xContext, m_xFrame, m_pToolBar, aURL, nId, aControlType );
+ pController = ToolBarMerger::CreateController( m_xContext, m_xFrame, m_pToolBar, aURL, nId, nWidth, aControlType );
xController.set( pController, UNO_QUERY );
}
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx
index bb80b25..f10e042 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -718,6 +718,7 @@ void ToolBarManager::CreateControllers()
{
// retrieve additional parameters
OUString aControlType = static_cast< AddonsParams* >( m_pToolBar->GetItemData( nId ))->aControlType;
+ sal_uInt16 nWidth = static_cast< AddonsParams* >( m_pToolBar->GetItemData( nId ))->nWidth;
Reference< XStatusListener > xStatusListener(
ToolBarMerger::CreateController( m_xContext,
@@ -725,6 +726,7 @@ void ToolBarManager::CreateControllers()
m_pToolBar,
aCommandURL,
nId,
+ nWidth,
aControlType ), UNO_QUERY );
xController = xStatusListener;
diff --git a/framework/source/uielement/toolbarmerger.cxx b/framework/source/uielement/toolbarmerger.cxx
index 8d12efb..4f97ee2 100644
--- a/framework/source/uielement/toolbarmerger.cxx
+++ b/framework/source/uielement/toolbarmerger.cxx
@@ -33,6 +33,7 @@ static const char MERGE_TOOLBAR_IMAGEID[] = "ImageIdentifier";
static const char MERGE_TOOLBAR_CONTEXT[] = "Context";
static const char MERGE_TOOLBAR_TARGET[] = "Target";
static const char MERGE_TOOLBAR_CONTROLTYPE[] = "ControlType";
+static const char MERGE_TOOLBAR_WIDTH[] = "Width";
static const char MERGECOMMAND_ADDAFTER[] = "AddAfter";
static const char MERGECOMMAND_ADDBEFORE[] = "AddBefore";
@@ -120,7 +121,8 @@ bool ToolBarMerger::ConvertSeqSeqToVector(
aAddonToolbarItem.aImageIdentifier,
aAddonToolbarItem.aTarget,
aAddonToolbarItem.aContext,
- aAddonToolbarItem.aControlType );
+ aAddonToolbarItem.aControlType,
+ aAddonToolbarItem.nWidth );
rContainer.push_back( aAddonToolbarItem );
}
@@ -184,7 +186,8 @@ void ToolBarMerger::ConvertSequenceToValues(
OUString& rImageIdentifier,
OUString& rTarget,
OUString& rContext,
- OUString& rControlType )
+ OUString& rControlType,
+ sal_uInt16& rWidth )
{
for ( sal_Int32 i = 0; i < rSequence.getLength(); i++ )
{
@@ -200,6 +203,12 @@ void ToolBarMerger::ConvertSequenceToValues(
rSequence[i].Value >>= rTarget;
else if ( rSequence[i].Name == MERGE_TOOLBAR_CONTROLTYPE )
rSequence[i].Value >>= rControlType;
+ else if ( rSequence[i].Name == MERGE_TOOLBAR_WIDTH )
+ {
+ sal_Int32 aValue = 0;
+ rSequence[i].Value >>= aValue;
+ rWidth = sal_uInt16( aValue );
+ }
}
}
@@ -622,6 +631,7 @@ bool ToolBarMerger::RemoveItems(
ToolBox* pToolbar,
const OUString& rCommandURL,
sal_uInt16 nId,
+ sal_uInt16 nWidth,
const OUString& rControlType )
{
::cppu::OWeakObject* pResult( nullptr );
@@ -629,15 +639,15 @@ bool ToolBarMerger::RemoveItems(
if ( rControlType == TOOLBARCONTROLLER_BUTTON )
pResult = new ButtonToolbarController( rxContext, pToolbar, rCommandURL );
else if ( rControlType == TOOLBARCONTROLLER_COMBOBOX )
- pResult = new ComboboxToolbarController( rxContext, xFrame, pToolbar, nId, 0, rCommandURL );
+ pResult = new ComboboxToolbarController( rxContext, xFrame, pToolbar, nId, nWidth, rCommandURL );
else if ( rControlType == TOOLBARCONTROLLER_EDIT )
- pResult = new EditToolbarController( rxContext, xFrame, pToolbar, nId, 0, rCommandURL );
+ pResult = new EditToolbarController( rxContext, xFrame, pToolbar, nId, nWidth, rCommandURL );
else if ( rControlType == TOOLBARCONTROLLER_SPINFIELD )
- pResult = new SpinfieldToolbarController( rxContext, xFrame, pToolbar, nId, 0, rCommandURL );
+ pResult = new SpinfieldToolbarController( rxContext, xFrame, pToolbar, nId, nWidth, rCommandURL );
else if ( rControlType == TOOLBARCONTROLLER_IMGBUTTON )
pResult = new ImageButtonToolbarController( rxContext, xFrame, pToolbar, nId, rCommandURL );
else if ( rControlType == TOOLBARCONTROLLER_DROPDOWNBOX )
- pResult = new DropdownToolbarController( rxContext, xFrame, pToolbar, nId, 0, rCommandURL );
+ pResult = new DropdownToolbarController( rxContext, xFrame, pToolbar, nId, nWidth, rCommandURL );
else if ( rControlType == TOOLBARCONTROLLER_DROPDOWNBTN )
pResult = new ToggleButtonToolbarController( rxContext, xFrame, pToolbar, nId,
ToggleButtonToolbarController::STYLE_DROPDOWNBUTTON, rCommandURL );
@@ -664,6 +674,7 @@ void ToolBarMerger::CreateToolbarItem( ToolBox* pToolbar, sal_uInt16 nPos, sal_u
pAddonParams->aImageId = rItem.aImageIdentifier;
pAddonParams->aTarget = rItem.aTarget;
pAddonParams->aControlType = rItem.aControlType;
+ pAddonParams->nWidth = rItem.nWidth;
pToolbar->SetItemData( nItemId, pAddonParams );
}
More information about the Libreoffice-commits
mailing list