From 1c70472740a2973d56312130ebade3d3ded425d0 Mon Sep 17 00:00:00 2001
From: Maxim Monastirsky <momonasmon@gmail.com>
Date: Fri, 17 Jul 2015 12:27:48 +0300
Subject: Convert dialog controls button to the generic controller

Change-Id: I3d03fba86139a3495e1cfd67b3f17149c73e3377
---
 basctl/Library_basctl.mk            |   1 -
 basctl/source/basicide/basidesh.cxx |   2 -
 basctl/source/basicide/tbxctl.cxx   | 143 ------------------------------------
 basctl/source/basicide/tbxctl.hxx   |  58 ---------------
 4 files changed, 204 deletions(-)
 delete mode 100644 basctl/source/basicide/tbxctl.cxx
 delete mode 100644 basctl/source/basicide/tbxctl.hxx

(limited to 'basctl')

diff --git a/basctl/Library_basctl.mk b/basctl/Library_basctl.mk
index a5dea6ec4bb3..ab3a9a67c20a 100644
--- a/basctl/Library_basctl.mk
+++ b/basctl/Library_basctl.mk
@@ -98,7 +98,6 @@ $(eval $(call gb_Library_add_exception_objects,basctl,\
 	basctl/source/basicide/register \
 	basctl/source/basicide/sbxitem \
 	basctl/source/basicide/scriptdocument \
-	basctl/source/basicide/tbxctl \
 	basctl/source/basicide/unomodel \
 	basctl/source/dlged/dlgedclip \
 	basctl/source/dlged/dlged \
diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx
index 742e48cd944d..8f98d3c1cea5 100644
--- a/basctl/source/basicide/basidesh.cxx
+++ b/basctl/source/basicide/basidesh.cxx
@@ -27,7 +27,6 @@
 #include <basdoc.hxx>
 #include <basicbox.hxx>
 #include <editeng/sizeitem.hxx>
-#include <tbxctl.hxx>
 #include <iderdll2.hxx>
 #include <basidectrlr.hxx>
 #include <localizationmgr.hxx>
@@ -167,7 +166,6 @@ Shell::Shell( SfxViewFrame* pFrame_, SfxViewShell* /* pOldShell */ ) :
 
 void Shell::Init()
 {
-    TbxControls::RegisterControl( SID_CHOOSE_CONTROLS );
     SvxPosSizeStatusBarControl::RegisterControl();
     SvxInsertStatusBarControl::RegisterControl();
     XmlSecStatusBarControl::RegisterControl( SID_SIGNATURE );
diff --git a/basctl/source/basicide/tbxctl.cxx b/basctl/source/basicide/tbxctl.cxx
deleted file mode 100644
index 8e193add4a82..000000000000
--- a/basctl/source/basicide/tbxctl.cxx
+++ /dev/null
@@ -1,143 +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 <svx/svxids.hrc>
-
-#include "idetemp.hxx"
-#include "tbxctl.hxx"
-
-#include <sfx2/dispatch.hxx>
-#include <sfx2/imagemgr.hxx>
-#include <sfx2/viewfrm.hxx>
-#include <svl/aeitem.hxx>
-#include <vcl/toolbox.hxx>
-
-namespace basctl
-{
-
-using namespace ::com::sun::star::uno;
-
-namespace
-{
-    OUString aSubToolBarResName( "private:resource/toolbar/insertcontrolsbar" );
-}
-
-SFX_IMPL_TOOLBOX_CONTROL( TbxControls, SfxAllEnumItem )
-
-/*************************************************************************
-|*
-|* Toolbox Class
-|*
-\************************************************************************/
-
-TbxControls::TbxControls( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
-        SfxToolBoxControl( nSlotId, nId, rTbx )
-{
-    nLastSlot = USHRT_MAX;
-
-    rTbx.SetItemBits( nId, ToolBoxItemBits::DROPDOWN | rTbx.GetItemBits( nId ) );
-    rTbx.Invalidate();
-}
-
-void TbxControls::StateChanged( sal_uInt16 nSID, SfxItemState eState,
-  const SfxPoolItem* pState )
-{
-    if( pState )
-    {
-        if (SfxAllEnumItem const* pItem = dynamic_cast<SfxAllEnumItem const*>(pState))
-        {
-            sal_uInt16 nTemp = 0;
-            sal_uInt16 nLastEnum = pItem->GetValue();
-            switch (nLastEnum)
-            {
-                case SVX_SNAP_PUSHBUTTON:       nTemp = SID_INSERT_PUSHBUTTON; break;
-                case SVX_SNAP_CHECKBOX:         nTemp = SID_INSERT_CHECKBOX; break;
-                case SVX_SNAP_RADIOBUTTON:      nTemp = SID_INSERT_RADIOBUTTON; break;
-                case SVX_SNAP_SPINBUTTON:       nTemp = SID_INSERT_SPINBUTTON; break;
-                case SVX_SNAP_FIXEDTEXT:        nTemp = SID_INSERT_FIXEDTEXT; break;
-                case SVX_SNAP_GROUPBOX:         nTemp = SID_INSERT_GROUPBOX; break;
-                case SVX_SNAP_LISTBOX:          nTemp = SID_INSERT_LISTBOX; break;
-                case SVX_SNAP_COMBOBOX:         nTemp = SID_INSERT_COMBOBOX; break;
-                case SVX_SNAP_EDIT:             nTemp = SID_INSERT_EDIT; break;
-                case SVX_SNAP_HSCROLLBAR:       nTemp = SID_INSERT_HSCROLLBAR; break;
-                case SVX_SNAP_VSCROLLBAR:       nTemp = SID_INSERT_VSCROLLBAR; break;
-                case SVX_SNAP_PREVIEW:          nTemp = SID_INSERT_PREVIEW; break;
-                case SVX_SNAP_URLBUTTON:        nTemp = SID_INSERT_URLBUTTON; break;
-                case SVX_SNAP_IMAGECONTROL:     nTemp = SID_INSERT_IMAGECONTROL; break;
-                case SVX_SNAP_PROGRESSBAR:      nTemp = SID_INSERT_PROGRESSBAR; break;
-                case SVX_SNAP_HFIXEDLINE:       nTemp = SID_INSERT_HFIXEDLINE; break;
-                case SVX_SNAP_VFIXEDLINE:       nTemp = SID_INSERT_VFIXEDLINE; break;
-                case SVX_SNAP_DATEFIELD:        nTemp = SID_INSERT_DATEFIELD; break;
-                case SVX_SNAP_TIMEFIELD:        nTemp = SID_INSERT_TIMEFIELD; break;
-                case SVX_SNAP_NUMERICFIELD:     nTemp = SID_INSERT_NUMERICFIELD; break;
-                case SVX_SNAP_CURRENCYFIELD:    nTemp = SID_INSERT_CURRENCYFIELD; break;
-                case SVX_SNAP_FORMATTEDFIELD:   nTemp = SID_INSERT_FORMATTEDFIELD; break;
-                case SVX_SNAP_PATTERNFIELD:     nTemp = SID_INSERT_PATTERNFIELD; break;
-                case SVX_SNAP_FILECONTROL:      nTemp = SID_INSERT_FILECONTROL; break;
-                case SVX_SNAP_TREECONTROL:      nTemp = SID_INSERT_TREECONTROL; break;
-            }
-            if( nTemp )
-            {
-                OUString aSlotURL( "slot:" );
-                aSlotURL += OUString::number( nTemp);
-                Image aImage = GetImage( m_xFrame,
-                                         aSlotURL,
-                                         hasBigImages()
-                                       );
-                ToolBox& rBox = GetToolBox();
-                rBox.SetItemImage(GetId(), aImage);
-                nLastSlot = nLastEnum;
-            }
-        }
-    }
-    SfxToolBoxControl::StateChanged( nSID, eState,pState );
-}
-
-void TbxControls::Select( sal_uInt16 nModifier )
-{
-    (void)nModifier;
-    SfxAllEnumItem aItem( SID_CHOOSE_CONTROLS, nLastSlot );
-    SfxViewFrame* pCurFrame = SfxViewFrame::Current();
-    DBG_ASSERT( pCurFrame != NULL, "No current view frame!" );
-    SfxDispatcher* pDispatcher = pCurFrame ? pCurFrame->GetDispatcher() : NULL;
-    if( pDispatcher )
-    {
-        pDispatcher->Execute( SID_CHOOSE_CONTROLS, SfxCallMode::SYNCHRON, &aItem, 0L );
-    }
-}
-
-/*************************************************************************
-|*
-|* the window is created here
-|* position of the toolbox can be requested with GetToolBox()
-|* rItemRect are the screen coordinates
-|*
-\************************************************************************/
-VclPtr<SfxPopupWindow> TbxControls::CreatePopupWindow()
-{
-    if ( GetSlotId() == SID_CHOOSE_CONTROLS )
-        createAndPositionSubToolBar( aSubToolBarResName );
-
-    return 0;
-}
-
-
-} // namespace basctl
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/tbxctl.hxx b/basctl/source/basicide/tbxctl.hxx
deleted file mode 100644
index 2eabe8cc6101..000000000000
--- a/basctl/source/basicide/tbxctl.hxx
+++ /dev/null
@@ -1,58 +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_BASCTL_SOURCE_BASICIDE_TBXCTL_HXX
-#define INCLUDED_BASCTL_SOURCE_BASICIDE_TBXCTL_HXX
-
-#include <sfx2/tbxctrl.hxx>
-
-namespace basctl
-{
-
-class TbxControls : public SfxToolBoxControl
-{
-private:
-
-    struct StateChangedInfo
-    {
-        ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager;
-        bool bDisabled;
-    };
-
-    sal_uInt16                  nLastSlot;
-
-protected:
-    virtual void            StateChanged( sal_uInt16 nSID, SfxItemState eState,
-                                          const SfxPoolItem* pState ) SAL_OVERRIDE;
-public:
-    SFX_DECL_TOOLBOX_CONTROL();
-
-    TbxControls(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
-    virtual ~TbxControls() {}
-
-    virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
-
-    using                       SfxToolBoxControl::Select;
-    void                        Select( sal_uInt16 nModifier ) SAL_OVERRIDE;
-};
-
-} // namespace basctl
-
-#endif // INCLUDED_BASCTL_SOURCE_BASICIDE_TBXCTL_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
-- 
cgit