summaryrefslogtreecommitdiff
path: root/sc
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 /sc
parentdac1be92f22197c9e144ef36963547c46d12e77d (diff)
Convert insert buttons to the generic controller
Change-Id: If7c6c1c5000893fca4205162526b4b4035637c11
Diffstat (limited to 'sc')
-rw-r--r--sc/Library_sc.mk1
-rw-r--r--sc/sdi/scalc.sdi4
-rw-r--r--sc/sdi/tabvwsh.sdi4
-rw-r--r--sc/source/ui/app/scdll.cxx3
-rw-r--r--sc/source/ui/cctrl/tbinsert.cxx106
-rw-r--r--sc/source/ui/inc/tabvwsh.hxx6
-rw-r--r--sc/source/ui/inc/tbinsert.hxx44
-rw-r--r--sc/source/ui/view/tabvwsh4.cxx35
8 files changed, 4 insertions, 199 deletions
diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index c0644f865917..3fa8c746f180 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -381,7 +381,6 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/ui/cctrl/checklistmenu \
sc/source/ui/cctrl/dpcontrol \
sc/source/ui/cctrl/popmenu \
- sc/source/ui/cctrl/tbinsert \
sc/source/ui/cctrl/tbzoomsliderctrl \
sc/source/ui/condformat/condformatdlg \
sc/source/ui/condformat/condformatdlgentry \
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index aa9d0da8a10e..482107e0d4bd 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -3931,7 +3931,7 @@ SfxVoidItem InputLineMatrix FID_INPUTLINE_MATRIX
]
-SfxUInt16Item InsCellsCtrl SID_TBXCTL_INSCELLS
+SfxVoidItem InsCellsCtrl SID_TBXCTL_INSCELLS
[
/* flags: */
@@ -4209,7 +4209,7 @@ SfxVoidItem InsertContents FID_INS_CELL_CONTENTS
]
-SfxUInt16Item InsertCtrl SID_TBXCTL_INSERT
+SfxVoidItem InsertCtrl SID_TBXCTL_INSERT
[
/* flags: */
diff --git a/sc/sdi/tabvwsh.sdi b/sc/sdi/tabvwsh.sdi
index d2ff98931277..eeb9019ff362 100644
--- a/sc/sdi/tabvwsh.sdi
+++ b/sc/sdi/tabvwsh.sdi
@@ -267,8 +267,8 @@ shell ScTabViewShell
SID_STATUS_PAGESTYLE [ ExecMethod = Execute; StateMethod = GetState; ]
- SID_TBXCTL_INSERT [ ExecMethod = ExecTbx; StateMethod = GetTbxState; ]
- SID_TBXCTL_INSCELLS [ ExecMethod = ExecTbx; StateMethod = GetTbxState; ]
+ SID_TBXCTL_INSERT []
+ SID_TBXCTL_INSCELLS []
}
diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx
index 47b0534b835b..6095a1b3310b 100644
--- a/sc/source/ui/app/scdll.cxx
+++ b/sc/source/ui/app/scdll.cxx
@@ -85,7 +85,6 @@
#include <svx/lboxctrl.hxx>
#include <svx/verttexttbxctrl.hxx>
#include <svx/formatpaintbrushctrl.hxx>
-#include "tbinsert.hxx"
#include "tbzoomsliderctrl.hxx"
#include <svx/zoomsliderctrl.hxx>
@@ -154,8 +153,6 @@ void ScDLL::Init()
SfxRecentFilesToolBoxControl::RegisterControl(SID_OPEN_CALC, pMod);
// Own Controller
- ScTbxInsertCtrl ::RegisterControl(SID_TBXCTL_INSERT, pMod);
- ScTbxInsertCtrl ::RegisterControl(SID_TBXCTL_INSCELLS, pMod);
ScZoomSliderControl ::RegisterControl(SID_PREVIEW_SCALINGFACTOR, pMod);
// SvxToolboxController
diff --git a/sc/source/ui/cctrl/tbinsert.cxx b/sc/source/ui/cctrl/tbinsert.cxx
deleted file mode 100644
index 049949cc1a69..000000000000
--- a/sc/source/ui/cctrl/tbinsert.cxx
+++ /dev/null
@@ -1,106 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <string>
-
-#include <svl/intitem.hxx>
-#include <sfx2/dispatch.hxx>
-#include <sfx2/viewsh.hxx>
-#include <sfx2/viewfrm.hxx>
-#include <sfx2/imagemgr.hxx>
-#include <vcl/toolbox.hxx>
-
-#include "tbinsert.hxx"
-#include "global.hxx"
-#include "scmod.hxx"
-#include "scresid.hxx"
-#include "sc.hrc"
-
-SFX_IMPL_TOOLBOX_CONTROL( ScTbxInsertCtrl, SfxUInt16Item);
-
-// ToolBox - Controller
-
-ScTbxInsertCtrl::ScTbxInsertCtrl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
- SfxToolBoxControl( nSlotId, nId, rTbx ),
- nLastSlotId(0)
-{
- rTbx.SetItemBits( nId, ToolBoxItemBits::DROPDOWN | rTbx.GetItemBits( nId ) );
-}
-
-ScTbxInsertCtrl::~ScTbxInsertCtrl()
-{
-}
-
-void ScTbxInsertCtrl::StateChanged( sal_uInt16 /* nSID */, SfxItemState eState,
- const SfxPoolItem* pState )
-{
- GetToolBox().EnableItem( GetId(), (GetItemState(pState) != SfxItemState::DISABLED) );
-
- if( eState == SfxItemState::DEFAULT )
- {
-
- const SfxUInt16Item* pItem = PTR_CAST( SfxUInt16Item, pState );
- if(pItem)
- {
- nLastSlotId = pItem->GetValue();
- sal_uInt16 nImageId = nLastSlotId ? nLastSlotId : GetSlotId();
- OUString aSlotURL( "slot:" );
- aSlotURL += OUString::number( nImageId);
- Image aImage = GetImage( m_xFrame,
- aSlotURL,
- hasBigImages()
- );
- GetToolBox().SetItemImage(GetId(), aImage);
- }
- }
-}
-
-VclPtr<SfxPopupWindow> ScTbxInsertCtrl::CreatePopupWindow()
-{
- sal_uInt16 nSlotId = GetSlotId();
- if (nSlotId == SID_TBXCTL_INSERT)
- {
- OUString aInsertBarResStr( "private:resource/toolbar/insertbar" );
- createAndPositionSubToolBar( aInsertBarResStr );
- }
- else if (nSlotId == SID_TBXCTL_INSCELLS)
- {
- OUString aInsertCellsBarResStr( "private:resource/toolbar/insertcellsbar" );
- createAndPositionSubToolBar( aInsertCellsBarResStr );
- }
- return NULL;
-}
-
-void ScTbxInsertCtrl::Select( sal_uInt16 /*nSelectModifier*/ )
-{
- SfxViewShell* pCurSh( SfxViewShell::Current() );
- SfxDispatcher* pDispatch( 0 );
-
- if ( pCurSh )
- {
- SfxViewFrame* pViewFrame = pCurSh->GetViewFrame();
- if ( pViewFrame )
- pDispatch = pViewFrame->GetDispatcher();
- }
-
- if ( pDispatch )
- pDispatch->Execute(nLastSlotId);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index 1d7998945954..3a2536d7f9c4 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -92,9 +92,6 @@ enum ObjectSelectionType
class ScTabViewShell: public SfxViewShell, public ScDBFunc
{
private:
- static sal_uInt16 nInsertCtrlState;
- static sal_uInt16 nInsCellsCtrlState;
-
SvxHtmlOptions aHTMLOpt;
ObjectSelectionType eCurOST;
sal_uInt16 nDrawSfxId;
@@ -276,9 +273,6 @@ public:
void ExecImageMap( SfxRequest& rReq );
void GetImageMapState( SfxItemSet& rSet );
- void ExecTbx( SfxRequest& rReq );
- static void GetTbxState( SfxItemSet& rSet );
-
void ExecuteSave( SfxRequest& rReq );
void GetSaveState( SfxItemSet& rSet );
void ExecSearch( SfxRequest& rReq );
diff --git a/sc/source/ui/inc/tbinsert.hxx b/sc/source/ui/inc/tbinsert.hxx
deleted file mode 100644
index 07b6201db668..000000000000
--- a/sc/source/ui/inc/tbinsert.hxx
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_SC_SOURCE_UI_INC_TBINSERT_HXX
-#define INCLUDED_SC_SOURCE_UI_INC_TBINSERT_HXX
-
-#include <sfx2/tbxctrl.hxx>
-
-class ScTbxInsertCtrl : public SfxToolBoxControl
-{
- sal_uInt16 nLastSlotId;
- virtual void Select( sal_uInt16 nSelectModifier ) SAL_OVERRIDE;
-
-public:
- SFX_DECL_TOOLBOX_CONTROL();
-
- ScTbxInsertCtrl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rBox );
- virtual ~ScTbxInsertCtrl();
-
- virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
- virtual void StateChanged( sal_uInt16 nSID,
- SfxItemState eState,
- const SfxPoolItem* pState ) SAL_OVERRIDE;
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index cb57e3b442e0..8890c4b8c713 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -102,11 +102,6 @@ extern SfxViewShell* pScActiveViewShell; // global.cxx
using namespace com::sun::star;
-// STATIC DATA -----------------------------------------------------------
-
-sal_uInt16 ScTabViewShell::nInsertCtrlState = SID_INSERT_GRAPHIC;
-sal_uInt16 ScTabViewShell::nInsCellsCtrlState = 0;
-
void ScTabViewShell::Activate(bool bMDI)
{
SfxViewShell::Activate(bMDI);
@@ -1830,34 +1825,4 @@ ScNavigatorSettings* ScTabViewShell::GetNavigatorSettings()
return pNavSettings;
}
-void ScTabViewShell::ExecTbx( SfxRequest& rReq )
-{
- const SfxItemSet* pReqArgs = rReq.GetArgs();
- sal_uInt16 nSlot = rReq.GetSlot();
- const SfxPoolItem* pItem = NULL;
- if ( pReqArgs )
- pReqArgs->GetItemState( nSlot, true, &pItem );
-
- switch ( nSlot )
- {
- case SID_TBXCTL_INSERT:
- if ( pItem )
- nInsertCtrlState = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
- break;
- case SID_TBXCTL_INSCELLS:
- if ( pItem )
- nInsCellsCtrlState = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
- break;
- default:
- OSL_FAIL("Slot im Wald");
- }
- GetViewFrame()->GetBindings().Invalidate( nSlot );
-}
-
-void ScTabViewShell::GetTbxState( SfxItemSet& rSet )
-{
- rSet.Put( SfxUInt16Item( SID_TBXCTL_INSERT, nInsertCtrlState ) );
- rSet.Put( SfxUInt16Item( SID_TBXCTL_INSCELLS, nInsCellsCtrlState ) );
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */