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 | |
parent | dac1be92f22197c9e144ef36963547c46d12e77d (diff) |
Convert insert buttons to the generic controller
Change-Id: If7c6c1c5000893fca4205162526b4b4035637c11
Diffstat (limited to 'sw/source/uibase')
-rw-r--r-- | sw/source/uibase/app/swmodule.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/inc/workctrl.hxx | 20 | ||||
-rw-r--r-- | sw/source/uibase/ribbar/workctrl.cxx | 89 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view2.cxx | 24 | ||||
-rw-r--r-- | sw/source/uibase/uiview/viewstat.cxx | 30 |
6 files changed, 0 insertions, 169 deletions
diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx index ba06d42122e4..611f0fc75f80 100644 --- a/sw/source/uibase/app/swmodule.cxx +++ b/sw/source/uibase/app/swmodule.cxx @@ -290,8 +290,6 @@ void SwDLL::RegisterControls() SvxTbxCtlDraw::RegisterControl(SID_INSERT_DRAW, pMod ); SvxTbxCtlAlign::RegisterControl(SID_OBJECT_ALIGN, pMod ); SwTbxAnchor::RegisterControl(FN_TOOL_ANCHOR, pMod ); - SwTbxInsertCtrl::RegisterControl(FN_INSERT_CTRL, pMod ); - SwTbxInsertCtrl::RegisterControl(FN_INSERT_OBJ_CTRL, pMod ); SwTbxFieldCtrl::RegisterControl(FN_INSERT_FIELD_CTRL, pMod ); SwTbxAutoTextCtrl::RegisterControl(FN_GLOSSARY_DLG, pMod ); svx::ParaLineSpacingPopup::RegisterControl(SID_ATTR_PARA_LINESPACE, pMod); diff --git a/sw/source/uibase/inc/workctrl.hxx b/sw/source/uibase/inc/workctrl.hxx index 910dcb26f7e2..31bf9736d2b5 100644 --- a/sw/source/uibase/inc/workctrl.hxx +++ b/sw/source/uibase/inc/workctrl.hxx @@ -52,26 +52,6 @@ class SwView; #define NID_TABLE_FORMULA_ERROR 20019 #define NID_COUNT 20 -class SwTbxInsertCtrl : public SfxToolBoxControl -{ - sal_uInt16 nLastSlotId; - - virtual void Select(sal_uInt16 nSelectModifier) SAL_OVERRIDE; - -public: - SFX_DECL_TOOLBOX_CONTROL(); - - SwTbxInsertCtrl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); - virtual ~SwTbxInsertCtrl(); - - virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE; - virtual void StateChanged( sal_uInt16 nSID, - SfxItemState eState, - const SfxPoolItem* pState ) SAL_OVERRIDE; - - virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; -}; - class SwTbxAutoTextCtrl : public SfxToolBoxControl { PopupMenu* pPopup; 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, diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx index e19673c65228..4125a91ce739 100644 --- a/sw/source/uibase/uiview/view.cxx +++ b/sw/source/uibase/uiview/view.cxx @@ -128,10 +128,6 @@ bool bDocSzUpdated = true; SvxSearchItem* SwView::m_pSrchItem = 0; -sal_uInt16 SwView::m_nInsertCtrlState = FN_INSERT_TABLE; -sal_uInt16 SwView::m_nWebInsertCtrlState = FN_INSERT_TABLE; -sal_uInt16 SwView::m_nInsertObjectCtrlState = SID_INSERT_DIAGRAM; - bool SwView::m_bExtra = false; bool SwView::m_bFound = false; bool SwView::m_bJustOpened = false; diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index a65b79af64ff..e47987fa2194 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -991,30 +991,6 @@ void SwView::Execute(SfxRequest &rReq) m_pShell->ExecuteSlot(rReq); } break; - case FN_INSERT_CTRL: - case FN_INSERT_OBJ_CTRL: - { - if(pArgs && SfxItemState::SET == pArgs->GetItemState(nSlot, false, &pItem)) - { - const sal_uInt16 nValue = static_cast<const SfxUInt16Item*>(pItem)->GetValue(); - switch ( nSlot ) - { - case FN_INSERT_CTRL: - { - bool bWeb = 0 != PTR_CAST(SwWebView, this); - if(bWeb) - SwView::m_nWebInsertCtrlState = nValue; - else - SwView::m_nInsertCtrlState = nValue; - } - break; - case FN_INSERT_OBJ_CTRL: SwView::m_nInsertObjectCtrlState = nValue ;break; - } - - } - GetViewFrame()->GetBindings().Invalidate( nSlot ); - } - break; #if defined WNT || defined UNX case SID_TWAIN_SELECT: case SID_TWAIN_TRANSFER: diff --git a/sw/source/uibase/uiview/viewstat.cxx b/sw/source/uibase/uiview/viewstat.cxx index aabd463de92d..a7d2c16a8539 100644 --- a/sw/source/uibase/uiview/viewstat.cxx +++ b/sw/source/uibase/uiview/viewstat.cxx @@ -191,42 +191,12 @@ void SwView::GetState(SfxItemSet &rSet) rSet.DisableItem(nWhich); } break; - case FN_INSERT_CTRL: - { - SfxImageItem aImgItem(nWhich, bWeb ? SwView::m_nWebInsertCtrlState : SwView::m_nInsertCtrlState); - SfxSlotPool& rPool = SfxSlotPool::GetSlotPool( GetViewFrame() ); - const SfxSlot* pSlot = rPool.GetSlot( aImgItem.GetValue() ); - if(pSlot && pSlot->IsMode( SfxSlotMode::IMAGEROTATION )) - { - if(m_pWrtShell->IsInVerticalText()) - aImgItem.SetRotation(2700); - if(m_pWrtShell->IsInRightToLeftText()) - aImgItem.SetMirrored(true); - } - rSet.Put(aImgItem); - } - break; - case FN_INSERT_OBJ_CTRL: if( bWeb || m_pWrtShell->CrsrInsideInputField() ) { rSet.DisableItem(nWhich); } - else - { - SfxImageItem aImgItem(nWhich, SwView::m_nInsertObjectCtrlState); - SfxSlotPool& rPool = SfxSlotPool::GetSlotPool( GetViewFrame() ); - const SfxSlot* pSlot = rPool.GetSlot( aImgItem.GetValue() ); - if(pSlot && pSlot->IsMode( SfxSlotMode::IMAGEROTATION )) - { - if (m_pWrtShell->IsInVerticalText()) - aImgItem.SetRotation(2700); - if (m_pWrtShell->IsInRightToLeftText()) - aImgItem.SetMirrored(true); - } - rSet.Put(aImgItem); - } break; case FN_UPDATE_TOX: |