summaryrefslogtreecommitdiff
path: root/reportdesign
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2015-07-12 21:11:17 +0300
committerMaxim Monastirsky <momonasmon@gmail.com>2015-07-13 12:09:52 +0000
commit2aea9e37d697ce51efc5fb37ba50f1bf177e0445 (patch)
treec6564f6cc7a61c497be13b146ed00615652b85dc /reportdesign
parent9c2a8065add0da1e649633efa0795beddfa68eed (diff)
Introduce generic sub toolbar controller
Currently many toolbar controllers are basically doing the same thing - show some docked toolbar. So the idea here is to have one generic controller that will handle all these cases in a unified way. It will get the name of the toolbar that it's supposed to show from the configuration, based on the command it was registered for. Right now it can handle both simple (i.e. with DROPDOWNONLY bits) and split (i.e. with DROPDOWN bits) scenarios, where for split kind it replaces the function (and the image) of the main part of the button, with the last selected function, for easy reusing. A button is considered to be a split one, if the name of the initial default command was passed along with the sub toolbar name, otherwise it will be a simple button. The core change is in framework/. Other parts are a usage example, in form of converting the custom shapes buttons to this new controller. Change-Id: I087cc58c3db1889ca69a26546d4f00fe07e2a58d Reviewed-on: https://gerrit.libreoffice.org/16967 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Diffstat (limited to 'reportdesign')
-rw-r--r--reportdesign/inc/pch/precompiled_rptui.hxx1
-rw-r--r--reportdesign/source/ui/misc/toolboxcontroller.cxx62
2 files changed, 2 insertions, 61 deletions
diff --git a/reportdesign/inc/pch/precompiled_rptui.hxx b/reportdesign/inc/pch/precompiled_rptui.hxx
index d1d7c32023dd..00268a8a1ea2 100644
--- a/reportdesign/inc/pch/precompiled_rptui.hxx
+++ b/reportdesign/inc/pch/precompiled_rptui.hxx
@@ -257,7 +257,6 @@
#include <svx/svxdlg.hxx>
#include <svx/tbcontrl.hxx>
#include <svx/tbxcolorupdate.hxx>
-#include <svx/tbxcustomshapes.hxx>
#include <svx/unopage.hxx>
#include <svx/unoprov.hxx>
#include <svx/unoshape.hxx>
diff --git a/reportdesign/source/ui/misc/toolboxcontroller.cxx b/reportdesign/source/ui/misc/toolboxcontroller.cxx
index 9c9e84474477..390c9b99c259 100644
--- a/reportdesign/source/ui/misc/toolboxcontroller.cxx
+++ b/reportdesign/source/ui/misc/toolboxcontroller.cxx
@@ -39,7 +39,6 @@
#include <editeng/fhgtitem.hxx>
#include <svx/tbcontrl.hxx>
#include <editeng/colritem.hxx>
-#include <svx/tbxcustomshapes.hxx>
#include <cppuhelper/supportsservice.hxx>
@@ -140,37 +139,7 @@ void SAL_CALL OToolboxController::initialize( const Sequence< Any >& _rArguments
break;
}
}
- if ( m_aCommandURL == ".uno:BasicShapes" )
- {
- m_aStates.insert(TCommandState::value_type(OUString(".uno:BasicShapes"),sal_True));
- m_pToolbarController = new SvxTbxCtlCustomShapes(m_nSlotId = SID_DRAWTBX_CS_BASIC,m_nToolBoxId,*pToolBox);
- }
- else if ( m_aCommandURL == ".uno:SymbolShapes" )
- {
- m_aStates.insert(TCommandState::value_type(OUString(".uno:SymbolShapes"),sal_True));
- m_pToolbarController = new SvxTbxCtlCustomShapes(m_nSlotId = SID_DRAWTBX_CS_SYMBOL,m_nToolBoxId,*pToolBox);
- }
- else if ( m_aCommandURL == ".uno:ArrowShapes" )
- {
- m_aStates.insert(TCommandState::value_type(OUString(".uno:ArrowShapes"),sal_True));
- m_pToolbarController = new SvxTbxCtlCustomShapes(m_nSlotId = SID_DRAWTBX_CS_ARROW,m_nToolBoxId,*pToolBox);
- }
- else if ( m_aCommandURL == ".uno:FlowChartShapes" )
- {
- m_aStates.insert(TCommandState::value_type(OUString(".uno:FlowChartShapes"),sal_True));
- m_pToolbarController = new SvxTbxCtlCustomShapes(m_nSlotId = SID_DRAWTBX_CS_FLOWCHART,m_nToolBoxId,*pToolBox);
- }
- else if ( m_aCommandURL == ".uno:CalloutShapes" )
- {
- m_aStates.insert(TCommandState::value_type(OUString(".uno:CalloutShapes"),sal_True));
- m_pToolbarController = new SvxTbxCtlCustomShapes(m_nSlotId = SID_DRAWTBX_CS_CALLOUT,m_nToolBoxId,*pToolBox);
- }
- else if ( m_aCommandURL == ".uno:StarShapes" )
- {
- m_aStates.insert(TCommandState::value_type(OUString(".uno:StarShapes"),sal_True));
- m_pToolbarController = new SvxTbxCtlCustomShapes(m_nSlotId = SID_DRAWTBX_CS_STAR,m_nToolBoxId,*pToolBox);
- }
- else if ( m_aCommandURL == ".uno:CharFontName" )
+ if ( m_aCommandURL == ".uno:CharFontName" )
{
m_aStates.insert(TCommandState::value_type(OUString(".uno:CharFontName"),sal_True));
m_pToolbarController = new SvxFontNameToolBoxControl/*SvxStyleToolBoxControl*/(m_nSlotId = SID_ATTR_CHAR_FONT,m_nToolBoxId,*pToolBox);
@@ -208,9 +177,6 @@ void SAL_CALL OToolboxController::statusChanged( const FeatureStateEvent& Event
if ( m_pToolbarController.is() )
{
// All other status events will be processed here
- bool bSetCheckmark = false;
- bool bCheckmark = false;
- //m_pToolbarController->GetToolBox().Enable(Event.IsEnabled);
ToolBox& rTb = m_pToolbarController->GetToolBox();
for ( sal_uInt16 i = 0; i < rTb.GetItemCount(); i++ )
{
@@ -223,20 +189,6 @@ void SAL_CALL OToolboxController::statusChanged( const FeatureStateEvent& Event
{
// Enable/disable item
rTb.EnableItem( nId, Event.IsEnabled );
-
- // Checkmark
- if ( Event.State >>= bCheckmark )
- bSetCheckmark = true;
-
- if ( bSetCheckmark )
- rTb.CheckItem( nId, bCheckmark );
- else
- {
- OUString aItemText;
-
- if ( Event.State >>= aItemText )
- rTb.SetItemText( nId, aItemText );
- }
}
}
@@ -289,21 +241,11 @@ sal_Bool SAL_CALL OToolboxController::opensSubToolbar() throw (uno::RuntimeExcep
OUString SAL_CALL OToolboxController::getSubToolbarName() throw (uno::RuntimeException, std::exception)
{
- SolarMutexGuard aSolarMutexGuard;
- ::osl::MutexGuard aGuard(m_aMutex);
- if ( m_pToolbarController.is() )
- return m_pToolbarController->getSubToolbarName();
return OUString();
}
-void SAL_CALL OToolboxController::functionSelected( const OUString& rCommand ) throw (uno::RuntimeException, std::exception)
+void SAL_CALL OToolboxController::functionSelected( const OUString& /*rCommand*/ ) throw (uno::RuntimeException, std::exception)
{
- SolarMutexGuard aSolarMutexGuard;
- ::osl::MutexGuard aGuard(m_aMutex);
- if ( m_pToolbarController.is() )
- {
- m_pToolbarController->functionSelected(m_aCommandURL = rCommand);
- }
}
void SAL_CALL OToolboxController::updateImage( ) throw (uno::RuntimeException, std::exception)