Related: #i122218# Replaced local tool box controller...
with existing GenericToolboxController (cleanup)
(cherry picked from commit 784ed0d2e9cc2de7e3de8420d4708ee5c4631a5c)
Conflicts:
svx/source/sidebar/insert/SimpleToolBoxController.cxx
svx/source/sidebar/insert/SimpleToolBoxController.hxx
Change-Id: I9c409c2979982ccd5d7a76c10db6c3f7dd59c307
diff --git a/svx/source/sidebar/insert/InsertPropertyPanel.cxx b/svx/source/sidebar/insert/InsertPropertyPanel.cxx
index fc40f92..2d30e6a 100644
--- a/svx/source/sidebar/insert/InsertPropertyPanel.cxx
+++ b/svx/source/sidebar/insert/InsertPropertyPanel.cxx
@@ -17,7 +17,6 @@
*/
#include "InsertPropertyPanel.hxx"
#include "InsertPropertyPanel.hrc"
#include "SimpleToolBoxController.hxx"
#include "sfx2/sidebar/CommandInfoProvider.hxx"
#include <sfx2/sidebar/Theme.hxx>
@@ -26,6 +25,7 @@
#include <svx/dialmgr.hxx>
#include <svtools/miscopt.hxx>
#include <svtools/generictoolboxcontroller.hxx>
#include <vcl/toolbox.hxx>
#include <sfx2/tbxctrl.hxx>
#include <framework/sfxhelperfunctions.hxx>
@@ -275,7 +275,12 @@ void InsertPropertyPanel::CreateController (
UNO_QUERY);
if ( ! aDescriptor.mxController.is())
aDescriptor.mxController.set(
static_cast<XWeak*>(new SimpleToolBoxController(mxFrame, *pToolBox, nItemId, sCommandName)),
static_cast<XWeak*>(new svt::GenericToolboxController(
::comphelper::getProcessServiceFactory(),
mxFrame,
pToolBox,
nItemId,
sCommandName)),
UNO_QUERY);
if ( ! aDescriptor.mxController.is())
return;
diff --git a/svx/source/sidebar/insert/SimpleToolBoxController.cxx b/svx/source/sidebar/insert/SimpleToolBoxController.cxx
deleted file mode 100644
index c60b6ef..0000000
--- a/svx/source/sidebar/insert/SimpleToolBoxController.cxx
+++ /dev/null
@@ -1,79 +0,0 @@
/*
* 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 "SimpleToolBoxController.hxx"
#include <comphelper/processfactory.hxx>
#include <vcl/toolbox.hxx>
#include <vcl/svapp.hxx>
using namespace ::com::sun::star;
namespace svx { namespace sidebar {
SimpleToolBoxController::SimpleToolBoxController(
const cssu::Reference<css::frame::XFrame>& rxFrame,
ToolBox& rToolBox,
const sal_uInt16 nItemId,
const rtl::OUString& rsCommand)
: svt::ToolboxController(comphelper::getComponentContext(comphelper::getProcessServiceFactory()),
rxFrame, rsCommand),
mrToolbox(rToolBox),
mnItemId(nItemId)
{
}
SimpleToolBoxController::~SimpleToolBoxController (void)
{
}
void SAL_CALL SimpleToolBoxController::statusChanged (const css::frame::FeatureStateEvent& rEvent)
throw (cssu::RuntimeException)
{
SolarMutexGuard aSolarMutexGuard;
if (m_bDisposed)
return;
mrToolbox.EnableItem(mnItemId, rEvent.IsEnabled);
sal_uInt16 nItemBits = mrToolbox.GetItemBits(mnItemId);
nItemBits &= ~TIB_CHECKABLE;
TriState eState = STATE_NOCHECK;
sal_Bool bValue = sal_False;
if (rEvent.State >>= bValue)
{
// Boolean, treat it as checked/unchecked
mrToolbox.CheckItem(mnItemId, bValue);
if ( bValue )
eState = STATE_CHECK;
nItemBits |= TIB_CHECKABLE;
}
mrToolbox.SetItemState(mnItemId, eState);
mrToolbox.SetItemBits(mnItemId, nItemBits);
}
} } // end of namespace svx::sidebar
diff --git a/svx/source/sidebar/insert/SimpleToolBoxController.hxx b/svx/source/sidebar/insert/SimpleToolBoxController.hxx
deleted file mode 100644
index b10bda7..0000000
--- a/svx/source/sidebar/insert/SimpleToolBoxController.hxx
+++ /dev/null
@@ -1,50 +0,0 @@
/*
* 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 SVX_SIDEBAR_INSERT_SIMPLE_TOOLBOX_CONTROLLER_HXX
#define SVX_SIDEBAR_INSERT_SIMPLE_TOOLBOX_CONTROLLER_HXX
#include <svtools/toolboxcontroller.hxx>
namespace css = ::com::sun::star;
namespace cssu = ::com::sun::star::uno;
namespace svx { namespace sidebar {
class SimpleToolBoxController : public svt::ToolboxController
{
public:
SimpleToolBoxController(
const cssu::Reference<css::frame::XFrame>& rxFrame,
ToolBox& rToolBox,
const sal_uInt16 nItTemId,
const rtl::OUString& rsComand);
virtual ~SimpleToolBoxController (void);
// XStatusListener
virtual void SAL_CALL statusChanged (const css::frame::FeatureStateEvent& rEvent)
throw (cssu::RuntimeException);
private:
ToolBox& mrToolbox;
const sal_uInt16 mnItemId;
};
} } // end of namespace svx::sidebar
#endif