diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2015-07-13 23:38:13 +0300 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2015-07-15 01:26:22 +0300 |
commit | 489af4ed790a233c94051d2f08e51d7c44ddba37 (patch) | |
tree | bc14552c25ac019f215f14193edf019d7ef0f68e /sw/source/uibase/ribbar | |
parent | dac1be92f22197c9e144ef36963547c46d12e77d (diff) |
Convert insert buttons to the generic controller
Change-Id: If7c6c1c5000893fca4205162526b4b4035637c11
Diffstat (limited to 'sw/source/uibase/ribbar')
-rw-r--r-- | sw/source/uibase/ribbar/workctrl.cxx | 89 |
1 files changed, 0 insertions, 89 deletions
diff --git a/sw/source/uibase/ribbar/workctrl.cxx b/sw/source/uibase/ribbar/workctrl.cxx index c56f9cbdf180..99d1cfd8ca9c 100644 --- a/sw/source/uibase/ribbar/workctrl.cxx +++ b/sw/source/uibase/ribbar/workctrl.cxx @@ -64,98 +64,9 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::frame; -SFX_IMPL_TOOLBOX_CONTROL( SwTbxInsertCtrl, SfxImageItem); SFX_IMPL_TOOLBOX_CONTROL( SwTbxAutoTextCtrl, SfxVoidItem ); SFX_IMPL_TOOLBOX_CONTROL( SwTbxFieldCtrl, SfxBoolItem ); -SwTbxInsertCtrl::SwTbxInsertCtrl( - sal_uInt16 nSlotId, - sal_uInt16 nId, - ToolBox& rTbx ) : - SfxToolBoxControl( nSlotId, nId, rTbx ), - nLastSlotId(FN_INSERT_CTRL == nSlotId ? FN_INSERT_TABLE : SID_INSERT_DIAGRAM) -{ - rTbx.SetItemBits( nId, ToolBoxItemBits::DROPDOWN | rTbx.GetItemBits( nId ) ); -} - -SwTbxInsertCtrl::~SwTbxInsertCtrl() -{ -} - -void SAL_CALL SwTbxInsertCtrl::update() throw (uno::RuntimeException, std::exception) -{ - ToolBox& rTbx = GetToolBox(); - OUString aSlotURL = "slot:" + OUString::number( nLastSlotId); - Image aImage = GetImage( m_xFrame, aSlotURL, hasBigImages() ); - - rTbx.SetItemImage(GetId(), aImage); - rTbx.Invalidate(); - - SfxToolBoxControl::update(); -} - -void SwTbxInsertCtrl::StateChanged( sal_uInt16 /*nSID*/, - SfxItemState eState, - const SfxPoolItem* pState ) -{ - sal_uInt16 nId = GetId(); - GetToolBox().EnableItem( nId, (GetItemState(pState) != SfxItemState::DISABLED) ); - - if( eState == SfxItemState::DEFAULT ) - { - const SfxImageItem* pItem = PTR_CAST( SfxImageItem, pState ); - if(pItem) - { - nLastSlotId = pItem->GetValue(); - if( nLastSlotId ) - nId = nLastSlotId; - - OUString aSlotURL = "slot:" + OUString::number( nId); - ToolBox& rBox = GetToolBox(); - Image aImage = GetImage( m_xFrame, aSlotURL, hasBigImages() ); - rBox.SetItemImage(GetId(), aImage); - rBox.SetItemImageMirrorMode( GetId(), false ); - rBox.SetItemImageAngle( GetId(), pItem->GetRotation() ); - rBox.SetItemImageMirrorMode( GetId(), pItem->IsMirrored() ); - } - } - -} - -VclPtr<SfxPopupWindow> SwTbxInsertCtrl::CreatePopupWindow() -{ - if(GetSlotId() == FN_INSERT_CTRL) - { - OUString aToolBarResStr( "private:resource/toolbar/insertbar" ); - createAndPositionSubToolBar( aToolBarResStr ); - } - else /* FN_INSERT_OBJ_CTRL */ - { - OUString aToolBarResStr( "private:resource/toolbar/insertobjectbar" ); - createAndPositionSubToolBar( aToolBarResStr ); - } - return NULL; -} - -void SwTbxInsertCtrl::Select( sal_uInt16 /*nSelectModifier*/ ) -{ - if( nLastSlotId ) - { - SfxViewShell* pCurSh( SfxViewShell::Current() ); - SfxDispatcher* pDispatch( 0 ); - - if ( pCurSh ) - { - SfxViewFrame* pViewFrame = pCurSh->GetViewFrame(); - if ( pViewFrame ) - pDispatch = pViewFrame->GetDispatcher(); - } - - if ( pDispatch ) - pDispatch->Execute(nLastSlotId); - } -} - SwTbxAutoTextCtrl::SwTbxAutoTextCtrl( sal_uInt16 nSlotId, sal_uInt16 nId, |