summaryrefslogtreecommitdiff
path: root/reportdesign
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2016-10-16 01:27:10 +0300
committerMaxim Monastirsky <momonasmon@gmail.com>2016-10-15 23:16:22 +0000
commit970a66f8c919ea0524f216f40d21b3e2a8c88ccc (patch)
tree3bfa4a692a2576a97d45ba2df38ff2644f9d9689 /reportdesign
parentbd041161f3dc65a36245ce271007dce003529a9c (diff)
Use UNO registration for font name toolbox control
Should help to eventually get rid of the wrapper in reportdesign. Change-Id: I9fc94f2ed650561eb47f2f91939b3aa37f031c3b Reviewed-on: https://gerrit.libreoffice.org/29910 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Diffstat (limited to 'reportdesign')
-rw-r--r--reportdesign/source/ui/inc/toolboxcontroller.hxx2
-rw-r--r--reportdesign/source/ui/misc/toolboxcontroller.cxx75
2 files changed, 6 insertions, 71 deletions
diff --git a/reportdesign/source/ui/inc/toolboxcontroller.hxx b/reportdesign/source/ui/inc/toolboxcontroller.hxx
index 2b7e910293ff..66d1bb1b30b8 100644
--- a/reportdesign/source/ui/inc/toolboxcontroller.hxx
+++ b/reportdesign/source/ui/inc/toolboxcontroller.hxx
@@ -44,7 +44,6 @@ namespace rptui
TCommandState m_aStates;
TToolbarHelper m_pToolbarController;
sal_uInt16 m_nToolBoxId;
- sal_uInt16 m_nSlotId;
OToolboxController(const OToolboxController&) = delete;
void operator =(const OToolboxController&) = delete;
public:
@@ -78,7 +77,6 @@ namespace rptui
virtual OUString SAL_CALL getSubToolbarName( ) throw (css::uno::RuntimeException, std::exception) override;
virtual void SAL_CALL functionSelected( const OUString& aCommand ) throw (css::uno::RuntimeException, std::exception) override;
virtual void SAL_CALL updateImage( ) throw (css::uno::RuntimeException, std::exception) override;
- virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createItemWindow( const css::uno::Reference< css::awt::XWindow >& Parent ) throw (css::uno::RuntimeException, std::exception) override;
};
} // rptui
diff --git a/reportdesign/source/ui/misc/toolboxcontroller.cxx b/reportdesign/source/ui/misc/toolboxcontroller.cxx
index 5e058438c64d..c7f5b6afe78f 100644
--- a/reportdesign/source/ui/misc/toolboxcontroller.cxx
+++ b/reportdesign/source/ui/misc/toolboxcontroller.cxx
@@ -34,9 +34,6 @@
#include <svtools/menuoptions.hxx>
#include <osl/mutex.hxx>
#include <svx/svxids.hrc>
-#define ITEMID_FONT 3
-#include <editeng/fontitem.hxx>
-#include <editeng/fhgtitem.hxx>
#include <svx/tbcontrl.hxx>
#include <cppuhelper/supportsservice.hxx>
@@ -87,7 +84,6 @@ Reference< XInterface > OToolboxController::create(Reference< XComponentContext
OToolboxController::OToolboxController(const Reference< XComponentContext >& _rxORB)
: m_pToolbarController(nullptr)
,m_nToolBoxId(1)
- ,m_nSlotId(0)
{
osl_atomic_increment(&m_refCount);
m_xContext = _rxORB;
@@ -137,21 +133,16 @@ void SAL_CALL OToolboxController::initialize( const Sequence< Any >& _rArguments
break;
}
}
- if ( m_aCommandURL == ".uno:CharFontName" )
- {
- m_aStates.insert(TCommandState::value_type(OUString(".uno:CharFontName"),true));
- m_pToolbarController = new SvxFontNameToolBoxControl/*SvxStyleToolBoxControl*/(m_nSlotId = SID_ATTR_CHAR_FONT,m_nToolBoxId,*pToolBox);
- }
- else if ( m_aCommandURL == ".uno:FontColor" || m_aCommandURL == ".uno:Color" )
+ if ( m_aCommandURL == ".uno:FontColor" || m_aCommandURL == ".uno:Color" )
{
m_aStates.insert(TCommandState::value_type(OUString(".uno:FontColor"),true));
m_aStates.insert(TCommandState::value_type(OUString(".uno:Color"),true));
- m_pToolbarController = new SvxColorToolBoxControl(m_nSlotId = SID_ATTR_CHAR_COLOR2,m_nToolBoxId,*pToolBox);
+ m_pToolbarController = new SvxColorToolBoxControl(SID_ATTR_CHAR_COLOR2,m_nToolBoxId,*pToolBox);
}
else
{
m_aStates.insert(TCommandState::value_type(OUString(".uno:BackgroundColor"),true));
- m_pToolbarController = new SvxColorToolBoxControl(m_nSlotId = SID_BACKGROUND_COLOR,m_nToolBoxId,*pToolBox);
+ m_pToolbarController = new SvxColorToolBoxControl(SID_BACKGROUND_COLOR,m_nToolBoxId,*pToolBox);
}
TCommandState::const_iterator aIter = m_aStates.begin();
@@ -169,43 +160,8 @@ void SAL_CALL OToolboxController::statusChanged( const FeatureStateEvent& Event
{
::osl::MutexGuard aGuard(m_aMutex);
TCommandState::iterator aFind = m_aStates.find( Event.FeatureURL.Complete );
- if ( aFind != m_aStates.end() )
- {
- aFind->second = Event.IsEnabled;
- if ( m_pToolbarController.is() )
- {
- // All other status events will be processed here
- ToolBox& rTb = m_pToolbarController->GetToolBox();
- for ( sal_uInt16 i = 0; i < rTb.GetItemCount(); i++ )
- {
- sal_uInt16 nId = rTb.GetItemId( i );
- if ( nId == 0 )
- continue;
-
- OUString aCmd = rTb.GetItemCommand( nId );
- if ( aCmd == Event.FeatureURL.Complete )
- {
- // Enable/disable item
- rTb.EnableItem( nId, Event.IsEnabled );
- }
- }
-
- switch(m_nSlotId)
- {
- case SID_ATTR_CHAR_COLOR2:
- case SID_BACKGROUND_COLOR:
- m_pToolbarController->statusChanged( Event );
- break;
- case SID_ATTR_CHAR_FONT:
- {
- SvxFontItem aItem(ITEMID_FONT);
- aItem.PutValue(Event.State, 0);
- static_cast<SvxFontNameToolBoxControl*>(m_pToolbarController.get())->StateChanged(m_nSlotId,Event.IsEnabled ? SfxItemState::DEFAULT : SfxItemState::DISABLED,&aItem);
- }
- break;
- }
- }
- }
+ if ( aFind != m_aStates.end() && m_pToolbarController.is() )
+ m_pToolbarController->statusChanged( Event );
}
Reference< awt::XWindow > SAL_CALL OToolboxController::createPopupWindow() throw (RuntimeException, std::exception)
@@ -229,7 +185,7 @@ void SAL_CALL OToolboxController::execute( sal_Int16 KeyModifier ) throw (uno::R
sal_Bool SAL_CALL OToolboxController::opensSubToolbar() throw (uno::RuntimeException, std::exception)
{
- return ( m_nSlotId != SID_ATTR_CHAR_FONT );
+ return true;
}
OUString SAL_CALL OToolboxController::getSubToolbarName() throw (uno::RuntimeException, std::exception)
@@ -249,25 +205,6 @@ void SAL_CALL OToolboxController::updateImage( ) throw (uno::RuntimeException,
m_pToolbarController->updateImage();
}
-uno::Reference< awt::XWindow > SAL_CALL OToolboxController::createItemWindow( const uno::Reference< awt::XWindow >& _xParent)
-throw (uno::RuntimeException, std::exception)
-{
- uno::Reference< awt::XWindow > xWindow;
- if ( m_pToolbarController.is() )
- {
- switch(m_nSlotId)
- {
- case SID_ATTR_CHAR_FONT:
- xWindow = VCLUnoHelper::GetInterface(static_cast<SvxFontNameToolBoxControl*>(m_pToolbarController.get())->CreateItemWindow(VCLUnoHelper::GetWindow(_xParent)));
- break;
- default:
- ;
- }
- }
- return xWindow;
-}
-
-
} // rptui