[Libreoffice-commits] core.git: 8 commits - chart2/source dbaccess/inc dbaccess/Library_dbu.mk dbaccess/source dbaccess/uiconfig dbaccess/UIConfig_dbapp.mk dbaccess/UIConfig_dbbrowser.mk dbaccess/UIConfig_dbtdata.mk dbaccess/util framework/source officecfg/registry
Maxim Monastirsky
momonasmon at gmail.com
Thu Oct 27 08:25:42 UTC 2016
chart2/source/controller/chartcontroller.component | 2
chart2/source/controller/main/ToolbarController.cxx | 2
dbaccess/Library_dbu.mk | 1
dbaccess/UIConfig_dbapp.mk | 4
dbaccess/UIConfig_dbbrowser.mk | 4
dbaccess/UIConfig_dbtdata.mk | 4
dbaccess/inc/dbaccess_helpid.hrc | 7
dbaccess/source/ui/app/app.src | 65 --
dbaccess/source/ui/browser/sbabrw.src | 19
dbaccess/source/ui/control/toolboxcontroller.cxx | 263 ----------
dbaccess/source/ui/inc/dbu_resource.hrc | 2
dbaccess/source/ui/inc/toolboxcontroller.hxx | 66 --
dbaccess/source/ui/inc/uiservices.hxx | 1
dbaccess/source/ui/misc/uiservices.cxx | 1
dbaccess/uiconfig/dbapp/popupmenu/new.xml | 20
dbaccess/uiconfig/dbbrowser/popupmenu/refreshdata.xml | 13
dbaccess/uiconfig/dbtdata/popupmenu/refreshdata.xml | 13
dbaccess/util/dbu.component | 3
framework/source/uielement/menubarmanager.cxx | 14
framework/source/uielement/popuptoolbarcontroller.cxx | 86 +++
officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu | 56 +-
officecfg/registry/data/org/openoffice/Office/UI/DbuCommands.xcu | 17
22 files changed, 215 insertions(+), 448 deletions(-)
New commits:
commit 2dc980990316e1efd1c21ecc5050bbc134838f7a
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Thu Oct 27 10:08:16 2016 +0300
Make XServiceInfo match what's in .component file
also should match the entry in
officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
Change-Id: If5f532d428bfcd925123ab83df6185680a04249e
diff --git a/chart2/source/controller/chartcontroller.component b/chart2/source/controller/chartcontroller.component
index 2348063..01201cb 100644
--- a/chart2/source/controller/chartcontroller.component
+++ b/chart2/source/controller/chartcontroller.component
@@ -53,6 +53,6 @@
</implementation>
<implementation name="org.libreoffice.chart2.Chart2ToolboxController"
constructor="org_libreoffice_chart2_Chart2ToolboxController">
- <service name="com.sun.star.frame.ToolbarContoller"/>
+ <service name="com.sun.star.frame.ToolbarController"/>
</implementation>
</component>
diff --git a/chart2/source/controller/main/ToolbarController.cxx b/chart2/source/controller/main/ToolbarController.cxx
index b7f2d35..072804b 100644
--- a/chart2/source/controller/main/ToolbarController.cxx
+++ b/chart2/source/controller/main/ToolbarController.cxx
@@ -113,7 +113,7 @@ void ChartToolbarController::update()
OUString ChartToolbarController::getImplementationName()
throw (css::uno::RuntimeException, std::exception)
{
- return OUString("org.libreoffice.chart2.ChartToolbarController");
+ return OUString("org.libreoffice.chart2.Chart2ToolboxController");
}
sal_Bool ChartToolbarController::supportsService(OUString const & ServiceName)
commit 0438d3e63601c98e202e6b251da90fb17bd048c3
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Thu Oct 27 01:21:48 2016 +0300
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
diff --git a/dbaccess/Library_dbu.mk b/dbaccess/Library_dbu.mk
index 00db4f8..6aa3f15 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 2208de1..0000000
--- 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 01c1c78..83ccc95 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 05fba56..0000000
--- 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 d013e7a..4a2f7d1 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 3595b6d..f5cd70f 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 7dd325c..bd7646a 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>
commit d8d110ce566b53467b6cad80affb89e73b7ab6fa
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Wed Oct 26 21:06:42 2016 +0300
Fix .uno:Refresh controller registration
Amazing how this is broken for years, and no one ever
noticed.
Change-Id: I65efabad201169e6424a2b8573f6366e4b292e8a
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
index f6b1eebd..631d5a2 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
@@ -729,12 +729,26 @@
<value>org.libreoffice.chart2.Chart2ToolboxController</value>
</prop>
</node>
- <node oor:name="c2" oor:op="replace">
+ <node oor:name="TableRefreshControl" oor:op="replace">
<prop oor:name="Command">
<value>.uno:Refresh</value>
</prop>
<prop oor:name="Module">
- <value>com.sun.star.sdb.OfficeDatabaseDocument</value>
+ <value>com.sun.star.sdb.TableDataView</value>
+ </prop>
+ <prop oor:name="Controller">
+ <value>com.sun.star.comp.framework.GenericPopupToolbarController</value>
+ </prop>
+ <prop oor:name="Value">
+ <value>.uno:DBRefreshMenu;1</value>
+ </prop>
+ </node>
+ <node oor:name="DataBrowserRefreshControl" oor:op="replace">
+ <prop oor:name="Command">
+ <value>.uno:Refresh</value>
+ </prop>
+ <prop oor:name="Module">
+ <value>com.sun.star.sdb.DataSourceBrowser</value>
</prop>
<prop oor:name="Controller">
<value>com.sun.star.comp.framework.GenericPopupToolbarController</value>
commit ec0e60c53fd55b85e9bb968ea1593cd76d20d1d5
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Wed Oct 26 21:00:20 2016 +0300
Convert RID_MENU_REFRESH_DATA to xml
Change-Id: I22107396eaab848224f26eb54f8638a354c13509
diff --git a/dbaccess/UIConfig_dbbrowser.mk b/dbaccess/UIConfig_dbbrowser.mk
index 94f9c9f..421312d 100644
--- a/dbaccess/UIConfig_dbbrowser.mk
+++ b/dbaccess/UIConfig_dbbrowser.mk
@@ -13,6 +13,10 @@ $(eval $(call gb_UIConfig_add_menubarfiles,modules/dbbrowser,\
dbaccess/uiconfig/dbbrowser/menubar/compat \
))
+$(eval $(call gb_UIConfig_add_popupmenufiles,modules/dbbrowser,\
+ dbaccess/uiconfig/dbbrowser/popupmenu/refreshdata \
+))
+
$(eval $(call gb_UIConfig_add_toolbarfiles,modules/dbbrowser,\
dbaccess/uiconfig/dbbrowser/toolbar/toolbar \
))
diff --git a/dbaccess/UIConfig_dbtdata.mk b/dbaccess/UIConfig_dbtdata.mk
index 6fe0a85..2f8cb3f 100644
--- a/dbaccess/UIConfig_dbtdata.mk
+++ b/dbaccess/UIConfig_dbtdata.mk
@@ -13,6 +13,10 @@ $(eval $(call gb_UIConfig_add_menubarfiles,modules/dbtdata,\
dbaccess/uiconfig/dbtdata/menubar/menubar \
))
+$(eval $(call gb_UIConfig_add_popupmenufiles,modules/dbtdata,\
+ dbaccess/uiconfig/dbtdata/popupmenu/refreshdata \
+))
+
$(eval $(call gb_UIConfig_add_toolbarfiles,modules/dbtdata,\
dbaccess/uiconfig/dbtdata/toolbar/toolbar \
))
diff --git a/dbaccess/source/ui/browser/sbabrw.src b/dbaccess/source/ui/browser/sbabrw.src
index 0aba65f..e5fdae7 100644
--- a/dbaccess/source/ui/browser/sbabrw.src
+++ b/dbaccess/source/ui/browser/sbabrw.src
@@ -143,23 +143,4 @@ String STR_COULDNOTCONNECT_DATASOURCE
Text [ en-US ] = "The connection to the data source \"$name$\" could not be established.";
};
-Menu RID_MENU_REFRESH_DATA
-{
- ItemList =
- {
- MenuItem
- {
- Identifier = ID_BROWSER_REFRESH ;
- Text [ en-US ] = "Refresh";
- Command = ".uno:Refresh";
- };
- MenuItem
- {
- Identifier = ID_BROWSER_REFRESH_REBUILD;
- Command = ".uno:DBRebuildData";
- Text [ en-US ] = "Rebuild";
- };
- };
-};
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/uiconfig/dbbrowser/popupmenu/refreshdata.xml b/dbaccess/uiconfig/dbbrowser/popupmenu/refreshdata.xml
new file mode 100644
index 0000000..216c6c5
--- /dev/null
+++ b/dbaccess/uiconfig/dbbrowser/popupmenu/refreshdata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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/.
+ *
+-->
+<menu:menupopup xmlns:menu="http://openoffice.org/2001/menu">
+ <menu:menuitem menu:id=".uno:Refresh"/>
+ <menu:menuitem menu:id=".uno:DBRebuildData"/>
+</menu:menupopup>
diff --git a/dbaccess/uiconfig/dbtdata/popupmenu/refreshdata.xml b/dbaccess/uiconfig/dbtdata/popupmenu/refreshdata.xml
new file mode 100644
index 0000000..216c6c5
--- /dev/null
+++ b/dbaccess/uiconfig/dbtdata/popupmenu/refreshdata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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/.
+ *
+-->
+<menu:menupopup xmlns:menu="http://openoffice.org/2001/menu">
+ <menu:menuitem menu:id=".uno:Refresh"/>
+ <menu:menuitem menu:id=".uno:DBRebuildData"/>
+</menu:menupopup>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
index 4ef4e4b..f6b1eebd 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
@@ -411,6 +411,20 @@
<value>new</value>
</prop>
</node>
+ <node oor:name="c34" oor:op="replace">
+ <prop oor:name="Command">
+ <value>.uno:DBRefreshMenu</value>
+ </prop>
+ <prop oor:name="Module">
+ <value/>
+ </prop>
+ <prop oor:name="Controller">
+ <value>com.sun.star.comp.framework.ResourceMenuController</value>
+ </prop>
+ <prop oor:name="Value">
+ <value>refreshdata</value>
+ </prop>
+ </node>
</node>
<node oor:name="ToolBar">
<node oor:name="ZoomToolBox" oor:op="replace">
@@ -723,7 +737,10 @@
<value>com.sun.star.sdb.OfficeDatabaseDocument</value>
</prop>
<prop oor:name="Controller">
- <value>com.sun.star.sdb.ApplicationToolboxController</value>
+ <value>com.sun.star.comp.framework.GenericPopupToolbarController</value>
+ </prop>
+ <prop oor:name="Value">
+ <value>.uno:DBRefreshMenu;1</value>
</prop>
</node>
<node oor:name="c13" oor:op="replace">
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/DbuCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/DbuCommands.xcu
index 81deeef..3c44bef 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/DbuCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/DbuCommands.xcu
@@ -515,6 +515,11 @@
<value xml:lang="en-US">Preview</value>
</prop>
</node>
+ <node oor:name=".uno:DBRebuildData" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">Rebuild</value>
+ </prop>
+ </node>
<node oor:name=".uno:DBNewReport" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Report...</value>
commit 420e80dfd742bc2387741d8650d353a20c36e8c5
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Mon Oct 24 23:21:30 2016 +0300
Convert RID_MENU_APP_NEW to xml
Achieved by using GenericPopupToolbarController for the
associated toolbar button.
Change-Id: I406ff40e0c80d6db903de5629088d35487ab6416
diff --git a/dbaccess/UIConfig_dbapp.mk b/dbaccess/UIConfig_dbapp.mk
index 1611108..f810f4b 100644
--- a/dbaccess/UIConfig_dbapp.mk
+++ b/dbaccess/UIConfig_dbapp.mk
@@ -13,6 +13,10 @@ $(eval $(call gb_UIConfig_add_menubarfiles,modules/dbapp,\
dbaccess/uiconfig/dbapp/menubar/menubar \
))
+$(eval $(call gb_UIConfig_add_popupmenufiles,modules/dbapp,\
+ dbaccess/uiconfig/dbapp/popupmenu/new \
+))
+
$(eval $(call gb_UIConfig_add_statusbarfiles,modules/dbapp,\
dbaccess/uiconfig/dbapp/statusbar/statusbar \
))
diff --git a/dbaccess/inc/dbaccess_helpid.hrc b/dbaccess/inc/dbaccess_helpid.hrc
index 3280fe4..086bf7f 100644
--- a/dbaccess/inc/dbaccess_helpid.hrc
+++ b/dbaccess/inc/dbaccess_helpid.hrc
@@ -37,8 +37,6 @@
#define HID_CTL_QRYSQLEDIT "DBACCESS_HID_CTL_QRYSQLEDIT"
-#define HID_BROWSER_QUERY_CREATE_TEXT "DBACCESS_HID_BROWSER_QUERY_CREATE_TEXT"
-
#define HID_CTL_QRYDGNTAB "DBACCESS_HID_CTL_QRYDGNTAB"
#define HID_CTL_QRYDGNCRIT "DBACCESS_HID_CTL_QRYDGNCRIT"
#define HID_QRYDGN_ROW_VISIBLE "DBACCESS_HID_QRYDGN_ROW_VISIBLE"
@@ -54,8 +52,6 @@
#define HID_QUERY_ALIASNAME "DBACCESS_HID_QUERY_ALIASNAME"
#define HID_QUERY_DISTINCT "DBACCESS_HID_QUERY_DISTINCT"
-#define HID_BROWSER_QUERY_CREATE_DESIGN "DBACCESS_HID_BROWSER_QUERY_CREATE_DESIGN"
-
#define HID_TAB_DESIGN_FIELDCONTROL "DBACCESS_HID_TAB_DESIGN_FIELDCONTROL"
#define HID_TABLE_DESIGN_HELP_WINDOW "DBACCESS_HID_TABLE_DESIGN_HELP_WINDOW"
#define HID_TAB_DESIGN_DESCWIN "DBACCESS_HID_TAB_DESIGN_DESCWIN"
@@ -80,12 +76,10 @@
#define HID_TAB_ENT_NUMTYP "DBACCESS_HID_TAB_ENT_NUMTYP"
#define HID_TAB_ENT_LEN "DBACCESS_HID_TAB_ENT_LEN"
#define HID_TAB_ENT_SCALE "DBACCESS_HID_TAB_ENT_SCALE"
-#define HID_BROWSER_TABLE_CREATE_DESIGN "DBACCESS_HID_BROWSER_TABLE_CREATE_DESIGN"
#define HID_CTL_RELATIONTAB "DBACCESS_HID_CTL_RELATIONTAB"
#define HID_RELATIONDIALOG_LEFTFIELDCELL "DBACCESS_HID_RELATIONDIALOG_LEFTFIELDCELL"
#define HID_RELATIONDIALOG_RIGHTFIELDCELL "DBACCESS_HID_RELATIONDIALOG_RIGHTFIELDCELL"
#define HID_BROWSER_COLUMNINFO "DBACCESS_HID_BROWSER_COLUMNINFO"
-#define HID_BROWSER_VIEW_CREATE_DESIGN "DBACCESS_HID_BROWSER_VIEW_CREATE_DESIGN"
#define HID_CONFIRM_DROP_BUTTON_ALL "DBACCESS_HID_CONFIRM_DROP_BUTTON_ALL"
#define HID_DSADMIN_LDAP_HOSTNAME "DBACCESS_HID_DSADMIN_LDAP_HOSTNAME"
#define HID_DSBROWSER_DISCONNECTING "DBACCESS_HID_DSBROWSER_DISCONNECTING"
@@ -97,7 +91,6 @@
#define HID_QUERY_EDIT_JOINCONNECTION "DBACCESS_HID_QUERY_EDIT_JOINCONNECTION"
-#define HID_DOCUMENT_CREATE_REPWIZ "DBACCESS_HID_DOCUMENT_CREATE_REPWIZ"
#define HID_TAB_AUTOINCREMENTVALUE "DBACCESS_HID_TAB_AUTOINCREMENTVALUE"
#define HID_DSADMIN_DBASE_PATH "DBACCESS_HID_DSADMIN_DBASE_PATH"
diff --git a/dbaccess/source/ui/app/app.src b/dbaccess/source/ui/app/app.src
index 662d702..3b4f124 100644
--- a/dbaccess/source/ui/app/app.src
+++ b/dbaccess/source/ui/app/app.src
@@ -81,71 +81,6 @@ String RID_STR_REPORTS_CONTAINER
Text [ en-US ] = "Reports" ;
};
-Menu RID_MENU_APP_NEW
-{
- ItemList =
- {
- MenuItem
- {
- Identifier = SID_APP_NEW_FORM;
- Command = ".uno:DBNewForm";
- Text [ en-US ] = "Form..." ;
- };
- MenuItem
- {
- Identifier = SID_APP_NEW_REPORT;
- Command = ".uno:DBNewReport";
- Text [ en-US ] = "Report..." ;
- };
- MenuItem
- {
- Identifier = ID_DOCUMENT_CREATE_REPWIZ ;
- HelpID = HID_DOCUMENT_CREATE_REPWIZ ;
- Text [ en-US ] = "Report Wizard...";
- Command = ".uno:DBNewReportAutoPilot";
- };
- MenuItem
- {
- Identifier = ID_NEW_QUERY_DESIGN;
- HelpId = HID_BROWSER_QUERY_CREATE_DESIGN ;
- Text [ en-US ] = "New ~Query (Design View)" ;
- Command = ".uno:DBNewQuery";
- };
- MenuItem
- {
- Identifier = ID_NEW_QUERY_SQL;
- HelpId = HID_BROWSER_QUERY_CREATE_TEXT ;
- Text [ en-US ] = "New Query (~SQL View)" ;
- Command = ".uno:DBNewQuerySql";
- };
- MenuItem
- {
- Separator = TRUE;
- };
- MenuItem
- {
- Identifier = ID_NEW_TABLE_DESIGN;
- HelpId = HID_BROWSER_TABLE_CREATE_DESIGN ;
- Text [ en-US ] = "New ~Table Design" ;
- Command = ".uno:DBNewTable";
- };
- MenuItem
- {
- Identifier = ID_NEW_VIEW_DESIGN;
- HelpId = HID_BROWSER_VIEW_CREATE_DESIGN ;
- Text [ en-US ] = "New ~View Design" ;
- Command = ".uno:DBNewView";
- };
- MenuItem
- {
- Identifier = SID_DB_NEW_VIEW_SQL;
- Command = ".uno:DBNewViewSQL";
- Text [ en-US ] = "View (Simple)..." ;
- };
-
- };
-};
-
Menu RID_MENU_APP_EDIT
{
ItemList =
diff --git a/dbaccess/uiconfig/dbapp/popupmenu/new.xml b/dbaccess/uiconfig/dbapp/popupmenu/new.xml
new file mode 100644
index 0000000..a4068ae
--- /dev/null
+++ b/dbaccess/uiconfig/dbapp/popupmenu/new.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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/.
+ *
+-->
+<menu:menupopup xmlns:menu="http://openoffice.org/2001/menu">
+ <menu:menuitem menu:id=".uno:DBNewForm"/>
+ <menu:menuitem menu:id=".uno:DBNewReport"/>
+ <menu:menuitem menu:id=".uno:DBNewReportAutoPilot"/>
+ <menu:menuitem menu:id=".uno:DBNewQuery"/>
+ <menu:menuitem menu:id=".uno:DBNewQuerySql"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:DBNewTable"/>
+ <menu:menuitem menu:id=".uno:DBNewView"/>
+ <menu:menuitem menu:id=".uno:DBNewViewSQL"/>
+</menu:menupopup>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
index c91e8e1..4ef4e4b 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
@@ -397,6 +397,20 @@
<value>com.sun.star.comp.framework.ToolbarModeMenuController</value>
</prop>
</node>
+ <node oor:name="c33" oor:op="replace">
+ <prop oor:name="Command">
+ <value>.uno:DBNewMenu</value>
+ </prop>
+ <prop oor:name="Module">
+ <value>com.sun.star.sdb.OfficeDatabaseDocument</value>
+ </prop>
+ <prop oor:name="Controller">
+ <value>com.sun.star.comp.framework.ResourceMenuController</value>
+ </prop>
+ <prop oor:name="Value">
+ <value>new</value>
+ </prop>
+ </node>
</node>
<node oor:name="ToolBar">
<node oor:name="ZoomToolBox" oor:op="replace">
@@ -673,7 +687,10 @@
<value>com.sun.star.sdb.OfficeDatabaseDocument</value>
</prop>
<prop oor:name="Controller">
- <value>com.sun.star.sdb.ApplicationToolboxController</value>
+ <value>com.sun.star.comp.framework.GenericPopupToolbarController</value>
+ </prop>
+ <prop oor:name="Value">
+ <value>.uno:DBNewMenu;1</value>
</prop>
</node>
<node oor:name="org.libreoffice.comp.dbu.LimitBoxController" oor:op="replace">
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/DbuCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/DbuCommands.xcu
index 6b9ef33..81deeef 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/DbuCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/DbuCommands.xcu
@@ -367,6 +367,9 @@
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Query (Design View)...</value>
</prop>
+ <prop oor:name="PopupLabel" oor:type="xs:string">
+ <value xml:lang="en-US">New ~Query (Design View)</value>
+ </prop>
<prop oor:name="Properties" oor:type="xs:int">
<value>1</value>
</prop>
@@ -375,6 +378,9 @@
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Query (SQL View)...</value>
</prop>
+ <prop oor:name="PopupLabel" oor:type="xs:string">
+ <value xml:lang="en-US">New Query (~SQL View)</value>
+ </prop>
<prop oor:name="Properties" oor:type="xs:int">
<value>1</value>
</prop>
@@ -383,6 +389,9 @@
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Table Design...</value>
</prop>
+ <prop oor:name="PopupLabel" oor:type="xs:string">
+ <value xml:lang="en-US">New ~Table Design</value>
+ </prop>
<prop oor:name="Properties" oor:type="xs:int">
<value>1</value>
</prop>
@@ -391,6 +400,9 @@
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">View Design...</value>
</prop>
+ <prop oor:name="PopupLabel" oor:type="xs:string">
+ <value xml:lang="en-US">New ~View Design</value>
+ </prop>
<prop oor:name="Properties" oor:type="xs:int">
<value>1</value>
</prop>
commit 074449ee349ccfe67466fb1aa63f96e8792334aa
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Tue Oct 25 01:23:42 2016 +0300
GenericPopupToolbarController: deal with main command being disabled
Try to set another command from the dropdown, if there is any
enabled. Otherwise give up and disable the button altogether.
Change-Id: I7fa46a946826056d04851faee9c7ad85f00c3678
diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxx
index acf28d1..e3a840d 100644
--- a/framework/source/uielement/popuptoolbarcontroller.cxx
+++ b/framework/source/uielement/popuptoolbarcontroller.cxx
@@ -264,6 +264,12 @@ public:
GenericPopupToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext,
const css::uno::Sequence< css::uno::Any >& rxArgs );
+ // XInitialization
+ virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& rxArgs ) throw ( css::uno::Exception, css::uno::RuntimeException, std::exception ) override;
+
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) throw ( css::uno::RuntimeException, std::exception ) override;
+
// XServiceInfo
virtual OUString SAL_CALL getImplementationName() throw (css::uno::RuntimeException) override;
@@ -316,6 +322,46 @@ css::uno::Sequence<OUString> GenericPopupToolbarController::getSupportedServiceN
return {"com.sun.star.frame.ToolbarController"};
}
+void GenericPopupToolbarController::initialize( const css::uno::Sequence< css::uno::Any >& rxArgs )
+ throw ( css::uno::Exception, css::uno::RuntimeException, std::exception )
+{
+ PopupMenuToolbarController::initialize( rxArgs );
+ if ( m_bReplaceWithLast )
+ // Create early, so we can use the menu is statusChanged method.
+ createPopupMenuController();
+}
+
+void GenericPopupToolbarController::statusChanged( const css::frame::FeatureStateEvent& rEvent )
+ throw ( css::uno::RuntimeException, std::exception )
+{
+ SolarMutexGuard aGuard;
+
+ if ( m_bReplaceWithLast && !rEvent.IsEnabled && m_xPopupMenu.is() )
+ {
+ Menu* pVclMenu = VCLXMenu::GetImplementation( m_xPopupMenu )->GetMenu();
+
+ ToolBox* pToolBox = nullptr;
+ sal_uInt16 nId = 0;
+ if ( getToolboxId( nId, &pToolBox ) && pToolBox->IsItemEnabled( nId ) )
+ {
+ pVclMenu->Activate();
+ pVclMenu->Deactivate();
+ }
+
+ for ( sal_uInt16 i = 0; i < pVclMenu->GetItemCount(); ++i )
+ {
+ sal_uInt16 nItemId = pVclMenu->GetItemId( i );
+ if ( nItemId && pVclMenu->IsItemEnabled( nItemId ) && !pVclMenu->GetPopupMenu( nItemId ) )
+ {
+ functionExecuted( pVclMenu->GetItemCommand( nItemId ) );
+ return;
+ }
+ }
+ }
+
+ PopupMenuToolbarController::statusChanged( rEvent );
+}
+
void GenericPopupToolbarController::functionExecuted( const OUString& rCommand )
{
if ( m_bReplaceWithLast )
commit e59013d6e95846fbc8066bdd8ef3b4b132043e45
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Tue Oct 18 23:56:57 2016 +0300
GenericPopupToolbarController: Support replacing the main command
If a second arg is passed in the "Value" property, it will be
treated as boolean. If true - the button will be
ToolBoxItemBits::DROPDOWN, and will keep replacing the main
command with the last selected one from the dropdown. It will
also respond to status updates of that command, currently for
enabled/disabled and boolean (true treated as pressed) states.
Change-Id: I09a5c20e6d2a010867037754f036096246749ec4
diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxx
index ee8c0d3..acf28d1 100644
--- a/framework/source/uielement/popuptoolbarcontroller.cxx
+++ b/framework/source/uielement/popuptoolbarcontroller.cxx
@@ -272,7 +272,8 @@ public:
virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() throw (css::uno::RuntimeException) override;
private:
- bool m_bSplitButton;
+ bool m_bSplitButton, m_bReplaceWithLast;
+ void functionExecuted(const OUString &rCommand) override;
ToolBoxItemBits getDropDownStyle() const override;
};
@@ -280,19 +281,21 @@ GenericPopupToolbarController::GenericPopupToolbarController(
const css::uno::Reference< css::uno::XComponentContext >& xContext,
const css::uno::Sequence< css::uno::Any >& rxArgs )
: PopupMenuToolbarController( xContext )
- , m_bSplitButton( false )
+ , m_bReplaceWithLast( false )
{
css::beans::PropertyValue aPropValue;
for ( const auto& arg: rxArgs )
{
if ( ( arg >>= aPropValue ) && aPropValue.Name == "Value" )
{
- aPropValue.Value >>= m_aPopupCommand;
+ OUString aValue;
+ aPropValue.Value >>= aValue;
+ m_aPopupCommand = aValue.getToken(0, ';');
+ m_bReplaceWithLast = aValue.getToken(1, ';').toBoolean();
break;
}
}
- if ( !m_aPopupCommand.isEmpty() )
- m_bSplitButton = true;
+ m_bSplitButton = m_bReplaceWithLast || !m_aPopupCommand.isEmpty();
}
OUString GenericPopupToolbarController::getImplementationName()
@@ -313,6 +316,33 @@ css::uno::Sequence<OUString> GenericPopupToolbarController::getSupportedServiceN
return {"com.sun.star.frame.ToolbarController"};
}
+void GenericPopupToolbarController::functionExecuted( const OUString& rCommand )
+{
+ if ( m_bReplaceWithLast )
+ {
+ removeStatusListener( m_aCommandURL );
+
+ OUString aRealCommand( vcl::CommandInfoProvider::Instance().GetRealCommandForCommand( rCommand, m_xFrame ) );
+ m_aCommandURL = aRealCommand.isEmpty() ? rCommand : aRealCommand;
+ addStatusListener( m_aCommandURL );
+
+ ToolBox* pToolBox = nullptr;
+ sal_uInt16 nId = 0;
+ if ( getToolboxId( nId, &pToolBox ) )
+ {
+ pToolBox->SetItemCommand( nId, rCommand );
+ pToolBox->SetHelpText( nId, OUString() ); // Will retrieve the new one from help.
+ pToolBox->SetItemText( nId, vcl::CommandInfoProvider::Instance().GetLabelForCommand( rCommand, m_xFrame ) );
+ pToolBox->SetQuickHelpText( nId, vcl::CommandInfoProvider::Instance().GetTooltipForCommand( rCommand, m_xFrame ) );
+ Image aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand( rCommand,
+ pToolBox->GetToolboxButtonSize() == ToolBoxButtonSize::Large,
+ m_xFrame );
+ if ( !!aImage )
+ pToolBox->SetItemImage( nId, aImage );
+ }
+ }
+}
+
ToolBoxItemBits GenericPopupToolbarController::getDropDownStyle() const
{
return m_bSplitButton ? ToolBoxItemBits::DROPDOWN : ToolBoxItemBits::DROPDOWNONLY;
commit 853c9efd00f38fd9f2da0fe50a866bf1592e3451
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Wed Oct 26 17:23:38 2016 +0300
MenuBarManager should pass the menubar flag down
... to popup menu controllers it creates, similar to what
is does for child MenuBarManager instances. That way a
child ResourceMenuController placed inside a popup menu
won't mistakenly think it's inside the main menu.
Change-Id: I75eea28eeb38f16bfaaa5526752a957859ef0d32
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index 9817197..b167d71 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -53,6 +53,7 @@
#include <com/sun/star/util/URLTransformer.hpp>
#include <comphelper/processfactory.hxx>
+#include <comphelper/propertyvalue.hxx>
#include <comphelper/extract.hxx>
#include <svtools/menuoptions.hxx>
#include <svtools/javainteractionhandler.hxx>
@@ -1103,15 +1104,10 @@ bool MenuBarManager::CreatePopupMenuController( MenuItemHandler* pMenuItemHandle
if ( !m_xPopupMenuControllerFactory.is() )
return false;
- Sequence< Any > aSeq( 2 );
- PropertyValue aPropValue;
-
- aPropValue.Name = "ModuleIdentifier";
- aPropValue.Value <<= m_aModuleIdentifier;
- aSeq[0] <<= aPropValue;
- aPropValue.Name = "Frame";
- aPropValue.Value <<= m_xFrame;
- aSeq[1] <<= aPropValue;
+ Sequence< Any > aSeq( 3 );
+ aSeq[0] <<= comphelper::makePropertyValue( "ModuleIdentifier", m_aModuleIdentifier );
+ aSeq[1] <<= comphelper::makePropertyValue( "Frame", m_xFrame );
+ aSeq[2] <<= comphelper::makePropertyValue( "InToolbar", !m_bHasMenuBar );
Reference< XPopupMenuController > xPopupMenuController(
m_xPopupMenuControllerFactory->createInstanceWithArgumentsAndContext(
More information about the Libreoffice-commits
mailing list