summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2015-07-13 23:38:13 +0300
committerMaxim Monastirsky <momonasmon@gmail.com>2015-07-15 01:26:22 +0300
commit489af4ed790a233c94051d2f08e51d7c44ddba37 (patch)
treebc14552c25ac019f215f14193edf019d7ef0f68e /sw
parentdac1be92f22197c9e144ef36963547c46d12e77d (diff)
Convert insert buttons to the generic controller
Change-Id: If7c6c1c5000893fca4205162526b4b4035637c11
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/view.hxx4
-rw-r--r--sw/sdi/_viewsh.sdi4
-rw-r--r--sw/sdi/swriter.sdi4
-rw-r--r--sw/sdi/viewsh.sdi1
-rw-r--r--sw/source/uibase/app/swmodule.cxx2
-rw-r--r--sw/source/uibase/inc/workctrl.hxx20
-rw-r--r--sw/source/uibase/ribbar/workctrl.cxx89
-rw-r--r--sw/source/uibase/uiview/view.cxx4
-rw-r--r--sw/source/uibase/uiview/view2.cxx24
-rw-r--r--sw/source/uibase/uiview/viewstat.cxx30
10 files changed, 3 insertions, 179 deletions
diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx
index 2a21a2065da3..6df748b1c034 100644
--- a/sw/inc/view.hxx
+++ b/sw/inc/view.hxx
@@ -156,10 +156,6 @@ class SW_DLLPUBLIC SwView: public SfxViewShell
static VclPtr<SvxSearchDialog> m_pSrchDlg;
static SvxSearchItem *m_pSrchItem;
- static sal_uInt16 m_nInsertCtrlState;
- static sal_uInt16 m_nWebInsertCtrlState;
- static sal_uInt16 m_nInsertObjectCtrlState;
- static sal_uInt16 m_nInsertFieldCtrlState;
static sal_uInt16 m_nMoveType; // for buttons below the scrollbar (viewmdi)
static sal_Int32 m_nActMark; // current jump mark for unknown mark
diff --git a/sw/sdi/_viewsh.sdi b/sw/sdi/_viewsh.sdi
index 5e35f90c7f54..51d593748e33 100644
--- a/sw/sdi/_viewsh.sdi
+++ b/sw/sdi/_viewsh.sdi
@@ -531,10 +531,8 @@ interface BaseTextEditView
]
FN_INSERT_CTRL
[
- ExecMethod = Execute ;
- StateMethod = GetState ;
Export = FALSE;
- ]
+ ]
SID_ATTR_DEFTABSTOP
[
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index 03b94c1f28ae..201c7b079160 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -3710,7 +3710,7 @@ SfxStringItem InsertSection FN_INSERT_REGION
GroupId = GID_INSERT;
]
-SfxImageItem InsertCtrl FN_INSERT_CTRL
+SfxVoidItem InsertCtrl FN_INSERT_CTRL
[
/* flags: */
@@ -4133,7 +4133,7 @@ SfxVoidItem InsertNeutralParagraph FN_NUM_BULLET_NONUM
GroupId = GID_ENUMERATION;
]
-SfxImageItem InsertObjCtrl FN_INSERT_OBJ_CTRL
+SfxVoidItem InsertObjCtrl FN_INSERT_OBJ_CTRL
[
/* flags: */
diff --git a/sw/sdi/viewsh.sdi b/sw/sdi/viewsh.sdi
index db75fc1203e5..567d70476e5a 100644
--- a/sw/sdi/viewsh.sdi
+++ b/sw/sdi/viewsh.sdi
@@ -46,7 +46,6 @@ interface TextEditView : BaseTextEditView
// Slots, which are not needed in the WebDocShell
FN_INSERT_OBJ_CTRL
[
- ExecMethod = Execute ;
StateMethod = GetState ;
Export = FALSE ;
DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
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: