diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2016-10-04 23:13:56 +0300 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2016-10-05 15:35:40 +0300 |
commit | fd22d2d9e1935f19a900a339995827bc7a795cb7 (patch) | |
tree | 8be2c073d774245834631978e471998b79a22bc6 /svx | |
parent | c700ed71f457a141c8033d2ab863bf884c50fa96 (diff) |
Base SvxFrameToolBoxControl on PopupWindowController
Change-Id: I7666c7c5c99b1705bc8ece2913c2cdf9fdecced3
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/tbxctrls/tbcontrl.cxx | 73 | ||||
-rw-r--r-- | svx/util/svxcore.component | 4 |
2 files changed, 51 insertions, 26 deletions
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index cba6820ed361..ed9a38e84960 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -30,6 +30,7 @@ #include <vcl/vclptr.hxx> #include <svtools/valueset.hxx> #include <svtools/ctrlbox.hxx> +#include <svtools/popupwindowcontroller.hxx> #include <svl/style.hxx> #include <svtools/ctrltool.hxx> #include <svtools/borderhelper.hxx> @@ -115,7 +116,6 @@ using namespace ::com::sun::star::lang; SFX_IMPL_TOOLBOX_CONTROL( SvxStyleToolBoxControl, SfxTemplateItem ); SFX_IMPL_TOOLBOX_CONTROL( SvxFontNameToolBoxControl, SvxFontItem ); -SFX_IMPL_TOOLBOX_CONTROL( SvxFrameToolBoxControl, SvxBoxItem ); SFX_IMPL_TOOLBOX_CONTROL( SvxFrameLineStyleToolBoxControl, SvxLineItem ); SFX_IMPL_TOOLBOX_CONTROL( SvxSimpleUndoRedoController, SfxStringItem ); SFX_IMPL_TOOLBOX_CONTROL( SvxCurrencyToolBoxControl, SfxBoolItem ); @@ -1600,7 +1600,7 @@ Color BorderColorStatus::GetColor() SvxFrameWindow_Impl::SvxFrameWindow_Impl( sal_uInt16 nId, const Reference< XFrame >& rFrame, vcl::Window* pParentWindow ) : - SfxPopupWindow( nId, rFrame, pParentWindow, WinBits( WB_STDPOPUP | WB_OWNERDRAWDECORATION ) ), + SfxPopupWindow( nId, rFrame, pParentWindow, WB_STDPOPUP | WB_OWNERDRAWDECORATION | WB_CLOSEABLE | WB_MOVEABLE ), aFrameSet ( VclPtr<SvxFrmValueSet_Impl>::Create(this, WinBits( WB_ITEMBORDER | WB_DOUBLEBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT )) ), bParagraphMode(false) { @@ -2898,40 +2898,61 @@ void SvxColorToolBoxControl::RegisterControl(sal_uInt16 nSlotId, SfxModule *pMod // class SvxFrameToolBoxControl -------------------------------------------- -SvxFrameToolBoxControl::SvxFrameToolBoxControl( - sal_uInt16 nSlotId, - sal_uInt16 nId, - ToolBox& rTbx ) - : SfxToolBoxControl( nSlotId, nId, rTbx ) +class SvxFrameToolBoxControl : public svt::PopupWindowController +{ +public: + explicit SvxFrameToolBoxControl( const css::uno::Reference< css::uno::XComponentContext >& rContext ); + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& rArguments ) throw ( css::uno::Exception, css::uno::RuntimeException, std::exception ) override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() throw ( css::uno::RuntimeException, std::exception ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw ( css::uno::RuntimeException, std::exception ) override; + +private: + virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) override; + using svt::ToolboxController::createPopupWindow; +}; + +SvxFrameToolBoxControl::SvxFrameToolBoxControl( const css::uno::Reference< css::uno::XComponentContext >& rContext ) + : svt::PopupWindowController( rContext, nullptr, OUString() ) { - rTbx.SetItemBits( nId, ToolBoxItemBits::DROPDOWNONLY | rTbx.GetItemBits( nId ) ); } -VclPtr<SfxPopupWindow> SvxFrameToolBoxControl::CreatePopupWindow() +void SvxFrameToolBoxControl::initialize( const css::uno::Sequence< css::uno::Any >& rArguments ) + throw ( css::uno::Exception, css::uno::RuntimeException, std::exception ) { - VclPtr<SvxFrameWindow_Impl> pFrameWin = VclPtr<SvxFrameWindow_Impl>::Create( - GetSlotId(), m_xFrame, &GetToolBox() ); + svt::PopupWindowController::initialize( rArguments ); + ToolBox* pToolBox = nullptr; + sal_uInt16 nId = 0; + if ( getToolboxId( nId, &pToolBox ) ) + pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ToolBoxItemBits::DROPDOWNONLY ); +} - pFrameWin->StartPopupMode( &GetToolBox(), - FloatWinPopupFlags::GrabFocus | - FloatWinPopupFlags::AllowTearOff | - FloatWinPopupFlags::NoAppFocusClose ); - pFrameWin->StartSelection(); - SetPopupWindow( pFrameWin ); +VclPtr<vcl::Window> SvxFrameToolBoxControl::createPopupWindow( vcl::Window* pParent ) +{ + return VclPtr<SvxFrameWindow_Impl>::Create( 0, m_xFrame, pParent ); +} - return pFrameWin; +OUString SvxFrameToolBoxControl::getImplementationName() + throw ( css::uno::RuntimeException, std::exception ) +{ + return OUString( "com.sun.star.comp.svx.FrameToolBoxControl" ); } -void SvxFrameToolBoxControl::StateChanged( - sal_uInt16, SfxItemState eState, const SfxPoolItem* ) +css::uno::Sequence< OUString > SvxFrameToolBoxControl::getSupportedServiceNames() + throw ( css::uno::RuntimeException, std::exception ) { - sal_uInt16 nId = GetId(); - ToolBox& rTbx = GetToolBox(); + return { "com.sun.star.frame.ToolbarController" }; +} - rTbx.EnableItem( nId, SfxItemState::DISABLED != eState ); - rTbx.SetItemState( nId, (SfxItemState::DONTCARE == eState) - ? TRISTATE_INDET - : TRISTATE_FALSE ); +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +com_sun_star_comp_svx_FrameToolBoxControl_get_implementation( + css::uno::XComponentContext* rContext, + css::uno::Sequence<css::uno::Any> const & ) +{ + return cppu::acquire( new SvxFrameToolBoxControl( rContext ) ); } SvxFrameLineStyleToolBoxControl::SvxFrameLineStyleToolBoxControl( diff --git a/svx/util/svxcore.component b/svx/util/svxcore.component index 1e6d1c7ef793..8c8d42da1236 100644 --- a/svx/util/svxcore.component +++ b/svx/util/svxcore.component @@ -40,6 +40,10 @@ <implementation name="com.sun.star.comp.svx.FontworkCharacterSpacingController"> <service name="com.sun.star.frame.ToolbarController"/> </implementation> + <implementation name="com.sun.star.comp.svx.FrameToolBoxControl" + constructor="com_sun_star_comp_svx_FrameToolBoxControl_get_implementation"> + <service name="com.sun.star.frame.ToolbarController"/> + </implementation> <implementation name="com.sun.star.comp.Svx.GraphicExportHelper" constructor="com_sun_star_comp_Svx_GraphicExportHelper_get_implementation"> <service name="com.sun.star.document.BinaryStreamResolver"/> |