diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2016-10-27 01:21:48 +0300 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2016-10-27 11:05:38 +0300 |
commit | 0438d3e63601c98e202e6b251da90fb17bd048c3 (patch) | |
tree | 34da08d9650d8665d98ea59734efacd230c89989 /dbaccess | |
parent | d8d110ce566b53467b6cad80affb89e73b7ab6fa (diff) |
dbaccess: OToolboxController is now unused
This also removes the only occurrence of the
"com.sun.star.frame.ToolboxController" service. However it shouldn't
be considered as API CHANGE, as no 3rd-party code should rely on
undocumented services, and fortunately a toolbox controller like this
has no use for 3rd-party anyway.
BTW there are other cases of using non-existent (unique) service
names for toolbox controllers in non-sfx2 modules, rather than using
the standard "com.sun.star.frame.ToolbarController". There is
OToolboxController in reportdesign (which I hope to remove soon too,
as it's just a wrapper around SvxColorToolBoxControl). And there was
also ShapeToolbarController in chart2 which I removed in
2aea9e37d697ce51efc5fb37ba50f1bf177e0445 ("Introduce generic sub toolbar
controller").
Change-Id: Iea8858be2406f32bb5a022920b4b1cee70603c09
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/Library_dbu.mk | 1 | ||||
-rw-r--r-- | dbaccess/source/ui/control/toolboxcontroller.cxx | 263 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/dbu_resource.hrc | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/toolboxcontroller.hxx | 66 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/uiservices.hxx | 1 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/uiservices.cxx | 1 | ||||
-rw-r--r-- | dbaccess/util/dbu.component | 3 |
7 files changed, 0 insertions, 337 deletions
diff --git a/dbaccess/Library_dbu.mk b/dbaccess/Library_dbu.mk index 00db4f87af86..6aa3f150a6b0 100644 --- a/dbaccess/Library_dbu.mk +++ b/dbaccess/Library_dbu.mk @@ -118,7 +118,6 @@ $(eval $(call gb_Library_add_exception_objects,dbu,\ dbaccess/source/ui/control/SqlNameEdit \ dbaccess/source/ui/control/TableGrantCtrl \ dbaccess/source/ui/control/tabletree \ - dbaccess/source/ui/control/toolboxcontroller \ dbaccess/source/ui/control/undosqledit \ dbaccess/source/ui/control/VertSplitView \ dbaccess/source/ui/dlg/admincontrols \ diff --git a/dbaccess/source/ui/control/toolboxcontroller.cxx b/dbaccess/source/ui/control/toolboxcontroller.cxx deleted file mode 100644 index 2208de1ae653..000000000000 --- a/dbaccess/source/ui/control/toolboxcontroller.cxx +++ /dev/null @@ -1,263 +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 "toolboxcontroller.hxx" -#include "uiservices.hxx" -#include <com/sun/star/ui/ImageType.hpp> -#include <com/sun/star/frame/XDispatchProvider.hpp> -#include <toolkit/helper/vclunohelper.hxx> -#include <vcl/menu.hxx> -#include <com/sun/star/ui/XUIConfigurationManager.hpp> -#include <com/sun/star/ui/theModuleUIConfigurationManagerSupplier.hpp> -#include <com/sun/star/ui/XImageManager.hpp> -#include <com/sun/star/graphic/XGraphic.hpp> -#include <vcl/svapp.hxx> -#include <vcl/toolbox.hxx> -#include "dbu_resource.hrc" -#include <svtools/miscopt.hxx> -#include <unotools/moduleoptions.hxx> -#include <tools/diagnose_ex.h> -#include <svtools/menuoptions.hxx> -#include <osl/mutex.hxx> -#include "dbu_reghelper.hxx" -#include "UITools.hxx" -#include <comphelper/processfactory.hxx> - -extern "C" void SAL_CALL createRegistryInfo_OToolboxController() -{ - static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::OToolboxController> aAutoRegistration; -} - -namespace dbaui -{ - using namespace svt; - using namespace ::com::sun::star::graphic; - using namespace com::sun::star::uno; - using namespace com::sun::star::beans; - using namespace com::sun::star::lang; - using namespace ::com::sun::star::frame; - using namespace ::com::sun::star::util; - using namespace ::com::sun::star::ui; - - namespace - { - void lcl_copy(Menu* _pMenu,sal_uInt16 _nMenuId,sal_uInt16 _nMenuPos,ToolBox* _pToolBox,sal_uInt16 _nToolId,const OUString& _sCommand) - { - if ( _pMenu->GetItemType(_nMenuPos) != MenuItemType::STRING ) - _pToolBox->SetItemImage(_nToolId, _pMenu->GetItemImage(_nMenuId)); - _pToolBox->SetItemCommand( _nToolId, _sCommand); - _pToolBox->SetHelpId(_nToolId, _pMenu->GetHelpId(_nMenuId)); - _pToolBox->SetHelpText(_nToolId, _pMenu->GetHelpText(_nMenuId)); - _pToolBox->SetQuickHelpText(_nToolId, _pMenu->GetTipHelpText(_nMenuId)); - _pToolBox->SetItemText(_nToolId, _pMenu->GetItemText(_nMenuId)); - } - } - - OToolboxController::OToolboxController(const Reference< XComponentContext >& _rxORB) - : m_nToolBoxId(1) - { - osl_atomic_increment(&m_refCount); - m_xContext = _rxORB; - osl_atomic_decrement(&m_refCount); - - } - IMPLEMENT_SERVICE_INFO_IMPLNAME_STATIC(OToolboxController, "com.sun.star.sdb.ApplicationToolboxController") - IMPLEMENT_SERVICE_INFO_SUPPORTS(OToolboxController) - IMPLEMENT_SERVICE_INFO_GETSUPPORTED1_STATIC(OToolboxController, "com.sun.star.frame.ToolboxController") - - Reference< XInterface > - SAL_CALL OToolboxController::Create(const Reference< XMultiServiceFactory >& _rxORB) - { - return static_cast< XServiceInfo* >(new OToolboxController( comphelper::getComponentContext(_rxORB) )); - } - - // XInterface - Any SAL_CALL OToolboxController::queryInterface( const Type& _rType ) throw (RuntimeException, std::exception) - { - Any aReturn = ToolboxController::queryInterface(_rType); - if (!aReturn.hasValue()) - aReturn = TToolboxController_BASE::queryInterface(_rType); - return aReturn; - } - void SAL_CALL OToolboxController::acquire() throw () - { - ToolboxController::acquire(); - } - void SAL_CALL OToolboxController::release() throw () - { - ToolboxController::release(); - } - void SAL_CALL OToolboxController::initialize( const Sequence< Any >& _rArguments ) throw (Exception, RuntimeException, std::exception) - { - ToolboxController::initialize(_rArguments); - SolarMutexGuard aSolarMutexGuard; - ::osl::MutexGuard aGuard(m_aMutex); - - if ( m_aCommandURL == ".uno:DBNewForm" ) - { - m_aStates.insert(TCommandState::value_type(OUString(".uno:DBNewForm") ,true)); - m_aStates.insert(TCommandState::value_type(OUString(".uno:DBNewView") ,true)); - m_aStates.insert(TCommandState::value_type(OUString(".uno:DBNewViewSQL") ,true)); - m_aStates.insert(TCommandState::value_type(OUString(".uno:DBNewQuery") ,true)); - m_aStates.insert(TCommandState::value_type(OUString(".uno:DBNewQuerySql") ,true)); - m_aStates.insert(TCommandState::value_type(OUString(".uno:DBNewReport") ,true)); - m_aStates.insert(TCommandState::value_type(OUString(".uno:DBNewReportAutoPilot"),true)); - m_aStates.insert(TCommandState::value_type(OUString(".uno:DBNewTable") ,true)); - } - else - { - m_aStates.insert(TCommandState::value_type(OUString(".uno:Refresh") ,true)); - m_aStates.insert(TCommandState::value_type(OUString(".uno:DBRebuildData") ,true)); - } - - TCommandState::const_iterator aIter = m_aStates.begin(); - TCommandState::const_iterator aEnd = m_aStates.end(); - for (; aIter != aEnd; ++aIter) - addStatusListener(aIter->first); - - VclPtr< ToolBox > pToolBox = static_cast<ToolBox*>(VCLUnoHelper::GetWindow(getParent()).get()); - if ( pToolBox ) - { - sal_uInt16 nCount = pToolBox->GetItemCount(); - for (sal_uInt16 nPos = 0; nPos < nCount; ++nPos) - { - sal_uInt16 nItemId = pToolBox->GetItemId(nPos); - if ( pToolBox->GetItemCommand(nItemId) == m_aCommandURL ) - { - m_nToolBoxId = nItemId; - break; - } - } - - // check if paste special is allowed, when not don't add DROPDOWN - pToolBox->SetItemBits(m_nToolBoxId,pToolBox->GetItemBits(m_nToolBoxId) | ToolBoxItemBits::DROPDOWN); - } - } - void SAL_CALL OToolboxController::statusChanged( const FeatureStateEvent& Event ) throw ( RuntimeException, std::exception ) - { - SolarMutexGuard aSolarMutexGuard; - ::osl::MutexGuard aGuard(m_aMutex); - TCommandState::iterator aFind = m_aStates.find( Event.FeatureURL.Complete ); - if ( aFind != m_aStates.end() ) - { - aFind->second = Event.IsEnabled; - if ( m_aCommandURL == aFind->first && !Event.IsEnabled ) - { - ScopedVclPtr<PopupMenu> pMenu(getMenu()); - sal_uInt16 nCount = pMenu->GetItemCount(); - for (sal_uInt16 i = 0; i < nCount; ++i) - { - sal_uInt16 nItemId = pMenu->GetItemId(i); - aFind = m_aStates.find(pMenu->GetItemCommand(nItemId)); - if ( aFind != m_aStates.end() && aFind->second ) - { - m_aCommandURL = aFind->first; - - VclPtr< ToolBox > pToolBox = static_cast<ToolBox*>(VCLUnoHelper::GetWindow(getParent()).get()); - lcl_copy(pMenu.get(),nItemId,i,pToolBox,m_nToolBoxId, m_aCommandURL); - break; - } - } - } - } - } - VclPtr<PopupMenu> OToolboxController::getMenu() - { - VclPtr<PopupMenu> pMenu; - if ( m_aStates.size() > 2 ) - { - pMenu = VclPtr<PopupMenu>::Create( ModuleRes( RID_MENU_APP_NEW ) ); - - try - { - Reference<XModuleUIConfigurationManagerSupplier> xModuleCfgMgrSupplier = theModuleUIConfigurationManagerSupplier::get( getContext() ); - Reference<XUIConfigurationManager> xUIConfigMgr = xModuleCfgMgrSupplier->getUIConfigurationManager( "com.sun.star.sdb.OfficeDatabaseDocument" ); - Reference<XImageManager> xImageMgr(xUIConfigMgr->getImageManager(),UNO_QUERY); - - Sequence< OUString> aSeq(1); - sal_uInt16 nCount = pMenu->GetItemCount(); - for (sal_uInt16 nPos = 0; nPos < nCount; ++nPos) - { - if ( pMenu->GetItemType( nPos ) == MenuItemType::SEPARATOR ) - continue; - - sal_uInt16 nItemId = pMenu->GetItemId(nPos); - aSeq[0] = pMenu->GetItemCommand(nItemId); - Sequence< Reference<XGraphic> > aImages = xImageMgr->getImages(ImageType::SIZE_DEFAULT, aSeq); - - Image aImage(aImages[0]); - pMenu->SetItemImage(nItemId,aImage); - TCommandState::const_iterator aFind = m_aStates.find( aSeq[0] ); - if ( aFind != m_aStates.end() ) - { - pMenu->EnableItem(nItemId,aFind->second); - } - } - } - catch(const Exception&) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - else - { - pMenu = VclPtr<PopupMenu>::Create( ModuleRes( RID_MENU_REFRESH_DATA ) ); - } - return pMenu; - } - - Reference< css::awt::XWindow > SAL_CALL OToolboxController::createPopupWindow() throw (RuntimeException, std::exception) - { - // execute the menu - SolarMutexGuard aSolarMutexGuard; - ::osl::MutexGuard aGuard(m_aMutex); - - VclPtr< ToolBox > pToolBox = static_cast<ToolBox*>(VCLUnoHelper::GetWindow(getParent()).get()); - ScopedVclPtr<PopupMenu> pMenu(getMenu()); - - sal_uInt16 nSelected = pMenu->Execute(pToolBox, pToolBox->GetItemRect( m_nToolBoxId ),PopupMenuFlags::ExecuteDown); - // "cleanup" the toolbox state - Point aPoint = pToolBox->GetItemRect( m_nToolBoxId ).TopLeft(); - MouseEvent aLeave( aPoint, 0, MouseEventModifiers::LEAVEWINDOW | MouseEventModifiers::SYNTHETIC ); - pToolBox->MouseMove( aLeave ); - pToolBox->SetItemDown( m_nToolBoxId, false); - - if ( nSelected ) - { - m_aCommandURL = pMenu->GetItemCommand(nSelected); - lcl_copy(pMenu.get(),nSelected,pMenu->GetItemPos(nSelected),pToolBox,m_nToolBoxId, m_aCommandURL); - - Reference<XDispatch> xDispatch = m_aListenerMap.find(m_aCommandURL)->second; - if ( xDispatch.is() ) - { - URL aUrl; - Sequence < PropertyValue > aArgs; - aUrl.Complete = m_aCommandURL; - OSL_ENSURE(!aUrl.Complete.isEmpty(),"Command is empty!"); - if ( getURLTransformer().is() ) - getURLTransformer()->parseStrict(aUrl); - xDispatch->dispatch(aUrl,aArgs); - - } - } - return Reference< css::awt::XWindow >(); - } -} // dbaui - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/ui/inc/dbu_resource.hrc b/dbaccess/source/ui/inc/dbu_resource.hrc index 01c1c789d6a9..83ccc950c905 100644 --- a/dbaccess/source/ui/inc/dbu_resource.hrc +++ b/dbaccess/source/ui/inc/dbu_resource.hrc @@ -134,10 +134,8 @@ #define RID_TABLEDESIGNROWPOPUPMENU RID_MENU_START + 7 #define RID_SBA_RTF_PKEYPOPUP RID_MENU_START + 9 #define RID_MENU_APP_EDIT RID_MENU_START + 10 -#define RID_MENU_APP_NEW RID_MENU_START + 11 #define RID_MENU_APP_PREVIEW RID_MENU_START + 12 #define MENU_BROWSER_DEFAULTCONTEXT RID_MENU_START + 14 -#define RID_MENU_REFRESH_DATA RID_MENU_START + 15 #define RID_MENU_JOINVIEW_CONNECTION RID_MENU_START + 16 #define RID_MENU_JOINVIEW_TABLE RID_MENU_START + 17 diff --git a/dbaccess/source/ui/inc/toolboxcontroller.hxx b/dbaccess/source/ui/inc/toolboxcontroller.hxx deleted file mode 100644 index 05fba565f1d5..000000000000 --- a/dbaccess/source/ui/inc/toolboxcontroller.hxx +++ /dev/null @@ -1,66 +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_DBACCESS_SOURCE_UI_INC_TOOLBOXCONTROLLER_HXX -#define INCLUDED_DBACCESS_SOURCE_UI_INC_TOOLBOXCONTROLLER_HXX - -#include <svtools/toolboxcontroller.hxx> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <cppuhelper/implbase1.hxx> -#include <vcl/vclptr.hxx> -#include "apitools.hxx" -#include "moduledbu.hxx" - -#include <map> -#include <memory> - -class PopupMenu; -namespace dbaui -{ - typedef ::cppu::ImplHelper1 < css::lang::XServiceInfo> TToolboxController_BASE; - - class OToolboxController : public ::svt::ToolboxController - ,public TToolboxController_BASE - { - typedef std::map<OUString, sal_Bool> TCommandState; - OModuleClient m_aModuleClient; - TCommandState m_aStates; - sal_uInt16 m_nToolBoxId; - - VclPtr<PopupMenu> getMenu(); - public: - OToolboxController(const css::uno::Reference< css::uno::XComponentContext >& _rxORB); - - // XInterface - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw (css::uno::RuntimeException, std::exception) override; - virtual void SAL_CALL acquire() throw () override; - virtual void SAL_CALL release() throw () override; - // XServiceInfo - DECLARE_SERVICE_INFO_STATIC(); - - // XInitialization - virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw (css::uno::Exception, css::uno::RuntimeException, std::exception) override; - // XStatusListener - virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) throw ( css::uno::RuntimeException, std::exception ) override; - // XToolbarController - virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createPopupWindow() throw (css::uno::RuntimeException, std::exception) override; - }; -} // dbaui -#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_TOOLBOXCONTROLLER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/ui/inc/uiservices.hxx b/dbaccess/source/ui/inc/uiservices.hxx index d013e7a63f8b..4a2f7d1b062a 100644 --- a/dbaccess/source/ui/inc/uiservices.hxx +++ b/dbaccess/source/ui/inc/uiservices.hxx @@ -47,7 +47,6 @@ void SAL_CALL createRegistryInfo_OSQLMessageDialog(); void SAL_CALL createRegistryInfo_OTableControl(); void SAL_CALL createRegistryInfo_OTableFilterDialog(); void SAL_CALL createRegistryInfo_OTextConnectionSettingsDialog(); -void SAL_CALL createRegistryInfo_OToolboxController(); void SAL_CALL createRegistryInfo_OUserSettingsDialog(); void SAL_CALL createRegistryInfo_OViewControl(); void SAL_CALL createRegistryInfo_SbaXGridControl(); diff --git a/dbaccess/source/ui/misc/uiservices.cxx b/dbaccess/source/ui/misc/uiservices.cxx index 3595b6d069a8..f5cd70f2ace9 100644 --- a/dbaccess/source/ui/misc/uiservices.cxx +++ b/dbaccess/source/ui/misc/uiservices.cxx @@ -53,7 +53,6 @@ extern "C" void SAL_CALL createRegistryInfo_DBU() createRegistryInfo_OUserSettingsDialog(); createRegistryInfo_OColumnControlModel(); createRegistryInfo_OColumnControl(); - createRegistryInfo_OToolboxController(); createRegistryInfo_CopyTableWizard(); createRegistryInfo_OTextConnectionSettingsDialog(); createRegistryInfo_LimitBoxController(); diff --git a/dbaccess/util/dbu.component b/dbaccess/util/dbu.component index 7dd325ceb445..bd7646a49fa4 100644 --- a/dbaccess/util/dbu.component +++ b/dbaccess/util/dbu.component @@ -42,9 +42,6 @@ <implementation name="com.sun.star.comp.sdb.DirectSQLDialog"> <service name="org.openoffice.comp.dbu.DirectSqlDialog"/> </implementation> - <implementation name="com.sun.star.sdb.ApplicationToolboxController"> - <service name="com.sun.star.frame.ToolboxController"/> - </implementation> <implementation name="com.sun.star.uno.comp.sdb.RowsetFilterDialog"> <service name="com.sun.star.sdb.FilterDialog"/> </implementation> |