[Libreoffice-commits] core.git: 8 commits - chart2/source cui/source desktop/source framework/source include/sfx2 include/vcl sc/source sc/uiconfig sd/inc sd/source sd/uiconfig sfx2/inc sfx2/Library_sfx.mk sfx2/source svx/inc svx/source sw/source vcl/source
Maxim Monastirsky
momonasmon at gmail.com
Sun Apr 23 16:54:40 UTC 2017
chart2/source/controller/sidebar/ChartAxisPanel.cxx | 1
chart2/source/controller/sidebar/ChartElementsPanel.cxx | 1
chart2/source/controller/sidebar/ChartErrorBarPanel.cxx | 1
chart2/source/controller/sidebar/ChartSeriesPanel.cxx | 1
cui/source/customize/cfg.cxx | 183 +++-----------
desktop/source/app/app.cxx | 1
framework/source/fwi/helper/mischelper.cxx | 2
framework/source/uielement/popuptoolbarcontroller.cxx | 16 -
framework/source/uielement/toolbarsmenucontroller.cxx | 1
include/sfx2/imagemgr.hxx | 39 ---
include/sfx2/tbxctrl.hxx | 3
include/vcl/toolbox.hxx | 1
sc/source/ui/miscdlgs/optsolver.cxx | 9
sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx | 1
sc/uiconfig/scalc/toolbar/notebookbarshortcuts.xml | 2
sd/inc/pch/precompiled_sd.hxx | 1
sd/source/ui/annotations/annotationmanager.cxx | 8
sd/source/ui/slideshow/slideshowimpl.cxx | 10
sd/source/ui/view/ViewShellBase.cxx | 6
sd/source/ui/view/outlview.cxx | 6
sd/source/ui/view/viewoverlaymanager.cxx | 1
sd/uiconfig/simpress/ui/annotationmenu.ui | 10
sfx2/Library_sfx.mk | 1
sfx2/inc/pch/precompiled_sfx.hxx | 1
sfx2/source/appl/app.cxx | 1
sfx2/source/appl/imagemgr.cxx | 202 ----------------
sfx2/source/dialog/recfloat.cxx | 1
sfx2/source/dialog/templdlg.cxx | 76 +-----
sfx2/source/sidebar/ControllerItem.cxx | 1
sfx2/source/sidebar/SidebarPanelBase.cxx | 1
sfx2/source/sidebar/SidebarToolBox.cxx | 9
sfx2/source/sidebar/Tools.cxx | 20 -
sfx2/source/toolbox/tbxitem.cxx | 6
sfx2/source/view/viewsh.cxx | 1
svx/inc/pch/precompiled_svx.hxx | 1
svx/source/form/formtoolbars.cxx | 8
svx/source/form/tbxform.cxx | 1
svx/source/sidebar/possize/PosSizePropertyPanel.cxx | 1
svx/source/sidebar/shapes/DefaultShapesPanel.cxx | 3
svx/source/tbxctrls/bulletsnumbering.cxx | 5
svx/source/tbxctrls/tbcontrl.cxx | 3
svx/source/tbxctrls/tbxdrctl.cxx | 1
sw/source/uibase/lingu/olmenu.cxx | 74 +----
sw/source/uibase/ribbar/workctrl.cxx | 1
sw/source/uibase/sidebar/WrapPropertyPanel.cxx | 18 -
vcl/source/window/toolbox2.cxx | 21 -
46 files changed, 139 insertions(+), 622 deletions(-)
New commits:
commit 1974711b215ae265b335bf592a4be3f31e15e237
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Fri Apr 21 13:06:10 2017 +0300
Toolbars can't be nested
This is not supported by framework.
Change-Id: I4afde5243130e1ec1ac5c3126d755331842601e5
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index 41ca29d8d4c5..1733de47707d 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -523,8 +523,7 @@ bool GetToolbarItemData(
OUString& rLabel,
sal_uInt16& rType,
bool& rIsVisible,
- sal_Int32& rStyle,
- uno::Reference< container::XIndexAccess >& rSubMenu )
+ sal_Int32& rStyle )
{
try
{
@@ -541,10 +540,6 @@ bool GetToolbarItemData(
{
aProp[i].Value >>= rStyle;
}
- else if ( aProp[i].Name == ITEM_DESCRIPTOR_CONTAINER )
- {
- aProp[i].Value >>= rSubMenu;
- }
else if ( aProp[i].Name == ITEM_DESCRIPTOR_LABEL )
{
aProp[i].Value >>= rLabel;
@@ -4273,7 +4268,6 @@ void ToolbarSaveInData::LoadToolbar(
for ( sal_Int32 nIndex = 0; nIndex < xToolbarSettings->getCount(); ++nIndex )
{
- uno::Reference< container::XIndexAccess > xSubMenu;
OUString aCommandURL;
OUString aLabel;
bool bIsVisible;
@@ -4282,7 +4276,7 @@ void ToolbarSaveInData::LoadToolbar(
sal_uInt16 nType( css::ui::ItemType::DEFAULT );
bool bItem = GetToolbarItemData( xToolbarSettings, nIndex, aCommandURL,
- aLabel, nType, bIsVisible, nStyle, xSubMenu );
+ aLabel, nType, bIsVisible, nStyle );
if ( bItem )
{
@@ -4322,20 +4316,16 @@ void ToolbarSaveInData::LoadToolbar(
}
SvxConfigEntry* pEntry = new SvxConfigEntry(
- aLabel, aCommandURL, xSubMenu.is() );
+ aLabel, aCommandURL, false );
pEntry->SetUserDefined( bIsUserDefined );
pEntry->SetVisible( bIsVisible );
+ pEntry->SetStyle( nStyle );
if ( !bUseDefaultLabel )
pEntry->SetName( aLabel );
- if ( !xSubMenu.is() )
- pEntry->SetStyle( nStyle );
pEntries->push_back( pEntry );
-
- if ( xSubMenu.is() )
- LoadToolbar( xSubMenu, pEntry );
}
else
{
commit fc613febe3b90260cb3a553311b7b438fb93f073
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Fri Apr 21 03:25:46 2017 +0300
tdf#101374 Don't confuse "Label" with "Name"
We compare the actual label of a command with the default
one, in order to determine whether the label was changed
by the user. The problem is that commands that were
inserted via the "Add Commands" dialog might have
different label by default, because it uses the "Name"
command property (from the theUICommandDescription
singleton), but the customization dialog assumes usage of
the "Label" property. Which means that if these properties
differ for some command, it will be considered as having
a modified label, and such label will be written to the
user profile, and stay there even after UI language change.
This commit does 2 things:
- Prefer using the "Label" property for inserted commands,
instead of copying the label that's shown in the "Add
Commands" dialog.
- Properly track whether we're using the default label or
a custom one.
Change-Id: I16ceb4d0bc92ad2a9f833fb09753962ad21a903b
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index bb9eb71ed25b..41ca29d8d4c5 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -23,6 +23,7 @@
#include <stdlib.h>
#include <time.h>
+#include <vcl/commandinfoprovider.hxx>
#include <vcl/help.hxx>
#include <vcl/layout.hxx>
#include <vcl/msgbox.hxx>
@@ -569,9 +570,7 @@ bool GetToolbarItemData(
}
uno::Sequence< beans::PropertyValue >
-ConvertSvxConfigEntry(
- const uno::Reference< container::XNameAccess >& xCommandToLabelMap,
- const SvxConfigEntry* pEntry )
+ConvertSvxConfigEntry( const SvxConfigEntry* pEntry )
{
uno::Sequence< beans::PropertyValue > aPropSeq( 3 );
@@ -581,50 +580,13 @@ ConvertSvxConfigEntry(
aPropSeq[1].Name = ITEM_DESCRIPTOR_TYPE;
aPropSeq[1].Value <<= css::ui::ItemType::DEFAULT;
- // If the name has not been changed and the name is the same as
- // in the default command to label map then the label can be stored
+ // If the name has not been changed, then the label can be stored
// as an empty string.
// It will be initialised again later using the command to label map.
aPropSeq[2].Name = ITEM_DESCRIPTOR_LABEL;
if ( !pEntry->HasChangedName() && !pEntry->GetCommand().isEmpty() )
{
- bool isDefaultName = false;
- try
- {
- uno::Any a( xCommandToLabelMap->getByName( pEntry->GetCommand() ) );
- uno::Sequence< beans::PropertyValue > tmpPropSeq;
- if ( a >>= tmpPropSeq )
- {
- for ( sal_Int32 i = 0; i < tmpPropSeq.getLength(); ++i )
- {
- if ( tmpPropSeq[i].Name == ITEM_DESCRIPTOR_LABEL )
- {
- OUString tmpLabel;
- tmpPropSeq[i].Value >>= tmpLabel;
-
- if ( tmpLabel.equals( pEntry->GetName() ) )
- {
- isDefaultName = true;
- }
-
- break;
- }
- }
- }
- }
- catch ( container::NoSuchElementException& )
- {
- // isDefaultName is left as FALSE
- }
-
- if ( isDefaultName )
- {
- aPropSeq[2].Value <<= OUString();
- }
- else
- {
- aPropSeq[2].Value <<= OUString( pEntry->GetName() );
- }
+ aPropSeq[2].Value <<= OUString();
}
else
{
@@ -635,9 +597,7 @@ ConvertSvxConfigEntry(
}
uno::Sequence< beans::PropertyValue >
-ConvertToolbarEntry(
- const uno::Reference< container::XNameAccess >& xCommandToLabelMap,
- const SvxConfigEntry* pEntry )
+ConvertToolbarEntry( const SvxConfigEntry* pEntry )
{
uno::Sequence< beans::PropertyValue > aPropSeq( 4 );
@@ -647,50 +607,13 @@ ConvertToolbarEntry(
aPropSeq[1].Name = ITEM_DESCRIPTOR_TYPE;
aPropSeq[1].Value <<= css::ui::ItemType::DEFAULT;
- // If the name has not been changed and the name is the same as
- // in the default command to label map then the label can be stored
+ // If the name has not been changed, then the label can be stored
// as an empty string.
// It will be initialised again later using the command to label map.
aPropSeq[2].Name = ITEM_DESCRIPTOR_LABEL;
if ( !pEntry->HasChangedName() && !pEntry->GetCommand().isEmpty() )
{
- bool isDefaultName = false;
- try
- {
- uno::Any a( xCommandToLabelMap->getByName( pEntry->GetCommand() ) );
- uno::Sequence< beans::PropertyValue > tmpPropSeq;
- if ( a >>= tmpPropSeq )
- {
- for ( sal_Int32 i = 0; i < tmpPropSeq.getLength(); ++i )
- {
- if ( tmpPropSeq[i].Name == ITEM_DESCRIPTOR_LABEL )
- {
- OUString tmpLabel;
- tmpPropSeq[i].Value >>= tmpLabel;
-
- if ( tmpLabel.equals( pEntry->GetName() ) )
- {
- isDefaultName = true;
- }
-
- break;
- }
- }
- }
- }
- catch ( container::NoSuchElementException& )
- {
- // isDefaultName is left as FALSE
- }
-
- if ( isDefaultName )
- {
- aPropSeq[2].Value <<= OUString();
- }
- else
- {
- aPropSeq[2].Value <<= OUString( pEntry->GetName() );
- }
+ aPropSeq[2].Value <<= OUString();
}
else
{
@@ -1078,6 +1001,8 @@ bool SaveInData::LoadSubMenus(
if ( bItem )
{
bool bIsUserDefined = true;
+ bool bUseDefaultLabel = false;
+
if ( nType == css::ui::ItemType::DEFAULT )
{
uno::Any a;
@@ -1095,6 +1020,7 @@ bool SaveInData::LoadSubMenus(
// to info service
if ( aLabel.isEmpty() )
{
+ bUseDefaultLabel = true;
uno::Sequence< beans::PropertyValue > aPropSeq;
if ( a >>= aPropSeq )
{
@@ -1109,16 +1035,18 @@ bool SaveInData::LoadSubMenus(
}
}
- if ( xSubMenu.is() )
- {
- // popup menu
- SvxConfigEntry* pEntry = new SvxConfigEntry(
- aLabel, aCommandURL, true );
+ SvxConfigEntry* pEntry = new SvxConfigEntry(
+ aLabel, aCommandURL, xSubMenu.is() );
- pEntry->SetUserDefined( bIsUserDefined );
+ pEntry->SetUserDefined( bIsUserDefined );
+ if ( !bUseDefaultLabel )
+ pEntry->SetName( aLabel );
- pEntries->push_back( pEntry );
+ pEntries->push_back( pEntry );
+ if ( xSubMenu.is() )
+ {
+ // popup menu
OUString subMenuTitle( rBaseTitle );
if ( !subMenuTitle.isEmpty() )
@@ -1134,13 +1062,6 @@ bool SaveInData::LoadSubMenus(
LoadSubMenus( xSubMenu, subMenuTitle, pEntry );
}
- else
- {
- SvxConfigEntry* pEntry = new SvxConfigEntry(
- aLabel, aCommandURL, false );
- pEntry->SetUserDefined( bIsUserDefined );
- pEntries->push_back( pEntry );
- }
}
else
{
@@ -1218,7 +1139,7 @@ void MenuSaveInData::Apply(
SvxConfigEntry* pEntryData = *iter;
uno::Sequence< beans::PropertyValue > aPropValueSeq =
- ConvertSvxConfigEntry( m_xCommandToLabelMap, pEntryData );
+ ConvertSvxConfigEntry( pEntryData );
uno::Reference< container::XIndexContainer > xSubMenuBar(
rFactory->createInstanceWithContext( xContext ),
@@ -1251,7 +1172,7 @@ void SaveInData::ApplyMenu(
if ( pEntry->IsPopup() )
{
uno::Sequence< beans::PropertyValue > aPropValueSeq =
- ConvertSvxConfigEntry( m_xCommandToLabelMap, pEntry );
+ ConvertSvxConfigEntry( pEntry );
uno::Reference< container::XIndexContainer > xSubMenuBar(
rFactory->createInstanceWithContext( xContext ),
@@ -1276,7 +1197,7 @@ void SaveInData::ApplyMenu(
else
{
uno::Sequence< beans::PropertyValue > aPropValueSeq =
- ConvertSvxConfigEntry( m_xCommandToLabelMap, pEntry );
+ ConvertSvxConfigEntry( pEntry );
rMenuBar->insertByIndex(
rMenuBar->getCount(), uno::Any( aPropValueSeq ));
}
@@ -2200,7 +2121,6 @@ SvxEntries* SvxConfigPage::FindParentForChild(
SvTreeListEntry* SvxConfigPage::AddFunction(
SvTreeListEntry* pTarget, bool bFront, bool bAllowDuplicates )
{
- OUString aDisplayName = m_pSelectorDlg->GetSelectedDisplayName();
OUString aURL = m_pSelectorDlg->GetScriptURL();
if ( aURL.isEmpty() )
@@ -2208,10 +2128,16 @@ SvTreeListEntry* SvxConfigPage::AddFunction(
return nullptr;
}
+ OUString aModuleId = vcl::CommandInfoProvider::GetModuleIdentifier( m_xFrame );
+ OUString aDisplayName = vcl::CommandInfoProvider::GetMenuLabelForCommand( aURL, aModuleId );
+
SvxConfigEntry* pNewEntryData =
new SvxConfigEntry( aDisplayName, aURL, false );
pNewEntryData->SetUserDefined();
+ if ( aDisplayName.isEmpty() )
+ pNewEntryData->SetName( m_pSelectorDlg->GetSelectedDisplayName() );
+
// check that this function is not already in the menu
SvxConfigEntry* pParent = GetTopLevelSelection();
@@ -2812,6 +2738,7 @@ IMPL_LINK_NOARG( SvxMenuConfigPage, AddSubmenuHdl, Button *, void )
SvxConfigEntry* pNewEntryData =
new SvxConfigEntry( aNewName, aNewName, true );
+ pNewEntryData->SetName( aNewName );
pNewEntryData->SetUserDefined();
InsertEntry( pNewEntryData );
@@ -2891,6 +2818,7 @@ SvxMainMenuOrganizerDialog::SvxMainMenuOrganizerDialog(
SvxConfigEntry* pNewEntryData =
new SvxConfigEntry( newname, newurl, true );
+ pNewEntryData->SetName( newname );
pNewEntryData->SetUserDefined();
pNewEntryData->SetMain();
@@ -4121,7 +4049,7 @@ void ToolbarSaveInData::ApplyToolbar(
if ( pEntry->IsPopup() )
{
uno::Sequence< beans::PropertyValue > aPropValueSeq =
- ConvertToolbarEntry( m_xCommandToLabelMap, pEntry );
+ ConvertToolbarEntry( pEntry );
uno::Reference< container::XIndexContainer > xSubMenuBar(
rFactory->createInstanceWithContext( xContext ),
@@ -4144,7 +4072,7 @@ void ToolbarSaveInData::ApplyToolbar(
else
{
uno::Sequence< beans::PropertyValue > aPropValueSeq =
- ConvertToolbarEntry( m_xCommandToLabelMap, pEntry );
+ ConvertToolbarEntry( pEntry );
rToolbarBar->insertByIndex(
rToolbarBar->getCount(), uno::Any( aPropValueSeq ));
@@ -4359,6 +4287,8 @@ void ToolbarSaveInData::LoadToolbar(
if ( bItem )
{
bool bIsUserDefined = true;
+ bool bUseDefaultLabel = false;
+
if ( nType == css::ui::ItemType::DEFAULT )
{
uno::Any a;
@@ -4376,6 +4306,7 @@ void ToolbarSaveInData::LoadToolbar(
// to info service
if ( aLabel.isEmpty() )
{
+ bUseDefaultLabel = true;
uno::Sequence< beans::PropertyValue > aPropSeq;
if ( a >>= aPropSeq )
{
@@ -4390,27 +4321,21 @@ void ToolbarSaveInData::LoadToolbar(
}
}
- if ( xSubMenu.is() )
- {
- SvxConfigEntry* pEntry = new SvxConfigEntry(
- aLabel, aCommandURL, true );
+ SvxConfigEntry* pEntry = new SvxConfigEntry(
+ aLabel, aCommandURL, xSubMenu.is() );
+
+ pEntry->SetUserDefined( bIsUserDefined );
+ pEntry->SetVisible( bIsVisible );
- pEntry->SetUserDefined( bIsUserDefined );
- pEntry->SetVisible( bIsVisible );
+ if ( !bUseDefaultLabel )
+ pEntry->SetName( aLabel );
+ if ( !xSubMenu.is() )
+ pEntry->SetStyle( nStyle );
- pEntries->push_back( pEntry );
+ pEntries->push_back( pEntry );
+ if ( xSubMenu.is() )
LoadToolbar( xSubMenu, pEntry );
- }
- else
- {
- SvxConfigEntry* pEntry = new SvxConfigEntry(
- aLabel, aCommandURL, false );
- pEntry->SetUserDefined( bIsUserDefined );
- pEntry->SetVisible( bIsVisible );
- pEntry->SetStyle( nStyle );
- pEntries->push_back( pEntry );
- }
}
else
{
commit fb698d5e81c8b4149c092305506d40e2f7ef7f5d
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Sun Apr 23 15:04:36 2017 +0300
Replace GetImage with CommandInfoProvider::GetImageForCommand
And move ToolBoxButtonSize->ImageType mapping code to a
common place.
Change-Id: If158f4b6f2750054fcf64491c2941706e7d3a329
diff --git a/chart2/source/controller/sidebar/ChartAxisPanel.cxx b/chart2/source/controller/sidebar/ChartAxisPanel.cxx
index 715f1e6c9700..cfad4732a591 100644
--- a/chart2/source/controller/sidebar/ChartAxisPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAxisPanel.cxx
@@ -25,7 +25,6 @@
#include "ChartController.hxx"
#include <sfx2/bindings.hxx>
#include <sfx2/dispatch.hxx>
-#include <sfx2/imagemgr.hxx>
#include <vcl/fixed.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/field.hxx>
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
index d25b9232ff3c..6ee81319f591 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
@@ -27,7 +27,6 @@
#include "ChartController.hxx"
#include <sfx2/bindings.hxx>
#include <sfx2/dispatch.hxx>
-#include <sfx2/imagemgr.hxx>
#include <vcl/fixed.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/field.hxx>
diff --git a/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx b/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
index f359d409f573..95100060cfb0 100644
--- a/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
@@ -26,7 +26,6 @@
#include "ChartController.hxx"
#include <sfx2/bindings.hxx>
#include <sfx2/dispatch.hxx>
-#include <sfx2/imagemgr.hxx>
#include <vcl/fixed.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/field.hxx>
diff --git a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
index 6e48a4688e7f..ca18efbabe77 100644
--- a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
@@ -32,7 +32,6 @@
#include "ChartController.hxx"
#include <sfx2/bindings.hxx>
#include <sfx2/dispatch.hxx>
-#include <sfx2/imagemgr.hxx>
#include <vcl/fixed.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/field.hxx>
diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxx
index 74ff9da3f400..7227f05bf847 100644
--- a/framework/source/uielement/popuptoolbarcontroller.cxx
+++ b/framework/source/uielement/popuptoolbarcontroller.cxx
@@ -56,16 +56,6 @@ using namespace framework;
namespace
{
-vcl::ImageType getImageType(ToolBoxButtonSize eSize)
-{
- vcl::ImageType eImageType = vcl::ImageType::Size16;
- if (eSize == ToolBoxButtonSize::Large)
- eImageType = vcl::ImageType::Size26;
- else if (eSize == ToolBoxButtonSize::Size32)
- eImageType = vcl::ImageType::Size32;
- return eImageType;
-}
-
typedef cppu::ImplInheritanceHelper< svt::ToolboxController,
css::lang::XServiceInfo >
ToolBarBase;
@@ -383,9 +373,7 @@ void GenericPopupToolbarController::functionExecuted( const OUString& rCommand )
pToolBox->SetItemText( nId, vcl::CommandInfoProvider::GetLabelForCommand( rCommand, m_sModuleName ) );
pToolBox->SetQuickHelpText( nId, vcl::CommandInfoProvider::GetTooltipForCommand( rCommand, m_xFrame ) );
- vcl::ImageType eImageType = getImageType(pToolBox->GetToolboxButtonSize());
-
- Image aImage = vcl::CommandInfoProvider::GetImageForCommand(rCommand, m_xFrame, eImageType);
+ Image aImage = vcl::CommandInfoProvider::GetImageForCommand(rCommand, m_xFrame, pToolBox->GetImageSize());
if ( !!aImage )
pToolBox->SetItemImage( nId, aImage );
}
@@ -497,7 +485,7 @@ void SaveToolbarController::updateImage()
if ( !getToolboxId( nId, &pToolBox ) )
return;
- vcl::ImageType eImageType = getImageType(pToolBox->GetToolboxButtonSize());
+ vcl::ImageType eImageType = pToolBox->GetImageSize();
Image aImage;
diff --git a/include/sfx2/imagemgr.hxx b/include/sfx2/imagemgr.hxx
deleted file mode 100644
index 36f914c53cdf..000000000000
--- a/include/sfx2/imagemgr.hxx
+++ /dev/null
@@ -1,39 +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_SFX2_IMAGEMGR_HXX
-#define INCLUDED_SFX2_IMAGEMGR_HXX
-
-#include <sal/config.h>
-#include <sfx2/dllapi.h>
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/frame/XFrame.hpp>
-
-#include <rtl/ustring.hxx>
-#include <vcl/image.hxx>
-
-SFX2_DLLPUBLIC Image SAL_CALL GetImage(
- const css::uno::Reference< css::frame::XFrame >& rFrame,
- const OUString& aURL,
- bool bBig
-);
-
-#endif // INCLUDED_SFX2_IMAGEMGR_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/tbxctrl.hxx b/include/sfx2/tbxctrl.hxx
index caa0cfe9bfad..e6002abb8001 100644
--- a/include/sfx2/tbxctrl.hxx
+++ b/include/sfx2/tbxctrl.hxx
@@ -157,9 +157,6 @@ protected:
// Must be called by subclass to set a new popup window instance
void SetPopupWindow( SfxPopupWindow* pWindow );
- // helper methods
- bool hasBigImages() const;
-
public:
// XComponent
virtual void SAL_CALL dispose() override;
diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx
index a200557a4a2f..650fe127f55c 100644
--- a/include/vcl/toolbox.hxx
+++ b/include/vcl/toolbox.hxx
@@ -336,6 +336,7 @@ public:
// sets a fixed button size (small, large or dontcare (==autosize))
void SetToolboxButtonSize( ToolBoxButtonSize eSize );
ToolBoxButtonSize GetToolboxButtonSize() const;
+ vcl::ImageType GetImageSize() const;
void SetAlign( WindowAlign eNewAlign = WindowAlign::Top );
WindowAlign GetAlign() const { return meAlign; }
diff --git a/sc/source/ui/miscdlgs/optsolver.cxx b/sc/source/ui/miscdlgs/optsolver.cxx
index 2d62a3308b37..8296542b6440 100644
--- a/sc/source/ui/miscdlgs/optsolver.cxx
+++ b/sc/source/ui/miscdlgs/optsolver.cxx
@@ -20,9 +20,9 @@
#include "rangelst.hxx"
#include "scitems.hxx"
#include <sfx2/bindings.hxx>
-#include <sfx2/imagemgr.hxx>
#include <svl/zforlist.hxx>
#include <vcl/builderfactory.hxx>
+#include <vcl/commandinfoprovider.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/svapp.hxx>
@@ -349,13 +349,8 @@ void ScOptSolverDlg::dispose()
void ScOptSolverDlg::Init(const ScAddress& rCursorPos)
{
- // Get the "Delete Rows" commandimagelist images from sfx instead of
- // adding a second copy to sc (see ScTbxInsertCtrl::StateChanged)
-
- OUString aSlotURL( "slot:" );
- aSlotURL += OUString::number( SID_DEL_ROWS );
uno::Reference<frame::XFrame> xFrame = GetBindings().GetActiveFrame();
- Image aDelNm = ::GetImage( xFrame, aSlotURL, false );
+ Image aDelNm = vcl::CommandInfoProvider::GetImageForCommand(".uno:DeleteRows", xFrame);
for (VclPtr<PushButton> & pButton : mpDelButton)
{
diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx
index b35720c8f72a..937387ec2ece 100644
--- a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx
+++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx
@@ -23,7 +23,6 @@
#include "scresid.hxx"
#include <sfx2/bindings.hxx>
#include <sfx2/dispatch.hxx>
-#include <sfx2/imagemgr.hxx>
#include <vcl/fixed.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/field.hxx>
diff --git a/sd/inc/pch/precompiled_sd.hxx b/sd/inc/pch/precompiled_sd.hxx
index 72edaa133137..27993c6c65be 100644
--- a/sd/inc/pch/precompiled_sd.hxx
+++ b/sd/inc/pch/precompiled_sd.hxx
@@ -346,7 +346,6 @@
#include <sfx2/docfilt.hxx>
#include <sfx2/fcontnr.hxx>
#include <sfx2/frame.hxx>
-#include <sfx2/imagemgr.hxx>
#include <sfx2/ipclient.hxx>
#include <sfx2/linkmgr.hxx>
#include <sfx2/msg.hxx>
diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx
index b2680c08bf11..b5802d726994 100644
--- a/sd/source/ui/annotations/annotationmanager.cxx
+++ b/sd/source/ui/annotations/annotationmanager.cxx
@@ -32,6 +32,7 @@
#include <comphelper/string.hxx>
#include <svx/svxids.hrc>
+#include <vcl/commandinfoprovider.hxx>
#include <vcl/settings.hxx>
#include <vcl/menu.hxx>
#include <vcl/msgbox.hxx>
@@ -46,7 +47,6 @@
#include <tools/datetime.hxx>
-#include <sfx2/imagemgr.hxx>
#include <sfx2/viewfrm.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/app.hxx>
@@ -1206,12 +1206,8 @@ void AnnotationManagerImpl::ExecuteAnnotationContextMenu( const Reference< XAnno
sal_uInt16 nId = pMenu->GetItemId( nPos );
if (!pMenu->IsItemEnabled(nId))
continue;
- OString sIdent = pMenu->GetItemIdent(nId);
- sal_uInt16 nSID = IdentToSID(sIdent);
- OUString sSlotURL( "slot:" );
- sSlotURL += OUString::number(nSID);
- Image aImage( GetImage( xFrame, sSlotURL, false ) );
+ Image aImage( vcl::CommandInfoProvider::GetImageForCommand( pMenu->GetItemCommand( nId ), xFrame ) );
if( !!aImage )
pMenu->SetItemImage( nId, aImage );
}
diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx
index 521e18f86ce3..888e49fdd367 100644
--- a/sd/source/ui/slideshow/slideshowimpl.cxx
+++ b/sd/source/ui/slideshow/slideshowimpl.cxx
@@ -40,7 +40,6 @@
#include <toolkit/helper/vclunohelper.hxx>
#include <sfx2/infobar.hxx>
-#include <sfx2/imagemgr.hxx>
#include <sfx2/request.hxx>
#include <sfx2/docfile.hxx>
#include <sfx2/app.hxx>
@@ -65,6 +64,7 @@
#include "res_bmp.hrc"
#include "sdresid.hxx"
#include <vcl/canvastools.hxx>
+#include <vcl/commandinfoprovider.hxx>
#include <vcl/settings.hxx>
#include "comphelper/anytostring.hxx"
@@ -2004,13 +2004,13 @@ IMPL_LINK_NOARG(SlideshowImpl, ContextMenuHdl, void*, void)
Reference< css::frame::XFrame > xFrame( pViewFrame->GetFrame().GetFrameInterface() );
if( xFrame.is() )
{
- pMenu->SetItemImage(pMenu->GetItemId("next"), GetImage(xFrame, "slot:10617" , false));
- pMenu->SetItemImage(pMenu->GetItemId("prev"), GetImage(xFrame, "slot:10618" , false));
+ pMenu->SetItemImage(pMenu->GetItemId("next"), vcl::CommandInfoProvider::GetImageForCommand(".uno:NextRecord", xFrame));
+ pMenu->SetItemImage(pMenu->GetItemId("prev"), vcl::CommandInfoProvider::GetImageForCommand(".uno:PrevRecord", xFrame));
if( pPageMenu )
{
- pPageMenu->SetItemImage(pPageMenu->GetItemId("first"), GetImage(xFrame, "slot:10616" , false));
- pPageMenu->SetItemImage(pPageMenu->GetItemId("last"), GetImage(xFrame, "slot:10619" , false));
+ pPageMenu->SetItemImage(pPageMenu->GetItemId("first"), vcl::CommandInfoProvider::GetImageForCommand(".uno:FirstRecord", xFrame));
+ pPageMenu->SetItemImage(pPageMenu->GetItemId("last"), vcl::CommandInfoProvider::GetImageForCommand(".uno:LastRecord", xFrame));
}
}
}
diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx
index f0cbddc14394..5821dde1d610 100644
--- a/sd/source/ui/view/outlview.cxx
+++ b/sd/source/ui/view/outlview.cxx
@@ -20,6 +20,7 @@
#include "OutlineView.hxx"
#include <editeng/forbiddencharacterstable.hxx>
#include <sfx2/progress.hxx>
+#include <vcl/commandinfoprovider.hxx>
#include <vcl/wrkwin.hxx>
#include <svx/svxids.hrc>
#include <editeng/outliner.hxx>
@@ -28,7 +29,6 @@
#include <editeng/lrspitem.hxx>
#include <svx/svdotext.hxx>
#include <sfx2/printer.hxx>
-#include <sfx2/imagemgr.hxx>
#include <sfx2/app.hxx>
#include <sfx2/bindings.hxx>
#include <svl/itempool.hxx>
@@ -146,9 +146,7 @@ OutlineView::OutlineView( DrawDocShell& rDocSh, vcl::Window* pWindow, OutlineVie
maBulletFont.SetShadow(false);
Reference<XFrame> xFrame (mrOutlineViewShell.GetViewShellBase().GetFrame()->GetFrame().GetFrameInterface(), UNO_QUERY);
-
- const OUString aSlotURL( ".uno:ShowSlide" );
- maSlideImage = GetImage( xFrame, aSlotURL, true );
+ maSlideImage = vcl::CommandInfoProvider::GetImageForCommand(".uno:ShowSlide", xFrame, vcl::ImageType::Size26);
// Tell undo manager of the document about the undo manager of the
// outliner, so that the former can synchronize with the later.
diff --git a/sd/source/ui/view/viewoverlaymanager.cxx b/sd/source/ui/view/viewoverlaymanager.cxx
index 44aa1f59e3d0..19254e201c9c 100644
--- a/sd/source/ui/view/viewoverlaymanager.cxx
+++ b/sd/source/ui/view/viewoverlaymanager.cxx
@@ -20,7 +20,6 @@
#include "sddll.hxx"
#include <com/sun/star/frame/XFrame.hpp>
-#include <sfx2/imagemgr.hxx>
#include <sfx2/viewfrm.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/app.hxx>
diff --git a/sd/uiconfig/simpress/ui/annotationmenu.ui b/sd/uiconfig/simpress/ui/annotationmenu.ui
index b5bf418e9784..0e8ba5f39645 100644
--- a/sd/uiconfig/simpress/ui/annotationmenu.ui
+++ b/sd/uiconfig/simpress/ui/annotationmenu.ui
@@ -9,6 +9,7 @@
<object class="GtkMenuItem" id="reply">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="action_name">.uno:ReplyToAnnotation</property>
<property name="label" translatable="yes">_Reply</property>
<property name="use_underline">True</property>
</object>
@@ -23,6 +24,7 @@
<object class="GtkCheckMenuItem" id="bold">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="action_name">.uno:Bold</property>
<property name="label" translatable="yes">_Bold</property>
<property name="use_underline">True</property>
</object>
@@ -31,6 +33,7 @@
<object class="GtkCheckMenuItem" id="italic">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="action_name">.uno:Italic</property>
<property name="label" translatable="yes">_Italic</property>
<property name="use_underline">True</property>
</object>
@@ -39,6 +42,7 @@
<object class="GtkCheckMenuItem" id="underline">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="action_name">.uno:Underline</property>
<property name="label" translatable="yes">_Underline</property>
<property name="use_underline">True</property>
</object>
@@ -47,6 +51,7 @@
<object class="GtkCheckMenuItem" id="strike">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="action_name">.uno:Strikeout</property>
<property name="label" translatable="yes">_Strikethrough</property>
<property name="use_underline">True</property>
</object>
@@ -61,6 +66,7 @@
<object class="GtkMenuItem" id="copy">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="action_name">.uno:Copy</property>
<property name="label" translatable="yes">_Copy</property>
<property name="use_underline">True</property>
</object>
@@ -69,6 +75,7 @@
<object class="GtkMenuItem" id="paste">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="action_name">.uno:Paste</property>
<property name="label" translatable="yes">_Paste</property>
<property name="use_underline">True</property>
</object>
@@ -83,6 +90,7 @@
<object class="GtkMenuItem" id="delete">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="action_name">.uno:DeleteAnnotation</property>
<property name="label" translatable="yes">_Delete Comment</property>
<property name="use_underline">True</property>
</object>
@@ -91,6 +99,7 @@
<object class="GtkMenuItem" id="deleteby">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="action_name">.uno:DeleteAllAnnotationByAuthor</property>
<property name="label" translatable="yes">Delete All Comments b_y %1</property>
<property name="use_underline">True</property>
</object>
@@ -99,6 +108,7 @@
<object class="GtkMenuItem" id="deleteall">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="action_name">.uno:DeleteAllAnnotation</property>
<property name="label" translatable="yes">Delete _All Comments</property>
<property name="use_underline">True</property>
</object>
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
index 2ad775dcc162..5b0ca8cccd85 100644
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -105,7 +105,6 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
sfx2/source/appl/fwkhelper \
sfx2/source/appl/helpdispatch \
sfx2/source/appl/helpinterceptor \
- sfx2/source/appl/imagemgr \
sfx2/source/appl/imestatuswindow \
sfx2/source/appl/impldde \
sfx2/source/appl/linkmgr2 \
diff --git a/sfx2/inc/pch/precompiled_sfx.hxx b/sfx2/inc/pch/precompiled_sfx.hxx
index 570c23b28def..7a3e57ac264d 100644
--- a/sfx2/inc/pch/precompiled_sfx.hxx
+++ b/sfx2/inc/pch/precompiled_sfx.hxx
@@ -460,7 +460,6 @@
#include <sfx2/frame.hxx>
#include <sfx2/frmdescr.hxx>
#include <sfx2/hintpost.hxx>
-#include <sfx2/imagemgr.hxx>
#include <sfx2/infobar.hxx>
#include <sfx2/ipclient.hxx>
#include <sfx2/linkmgr.hxx>
diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx
index 0b14446a7098..234fa72c0f95 100644
--- a/sfx2/source/appl/app.cxx
+++ b/sfx2/source/appl/app.cxx
@@ -100,7 +100,6 @@
#include <rtl/strbuf.hxx>
#include <memory>
#include <framework/sfxhelperfunctions.hxx>
-#include <sfx2/imagemgr.hxx>
#include "fwkhelper.hxx"
using namespace ::com::sun::star;
diff --git a/sfx2/source/appl/imagemgr.cxx b/sfx2/source/appl/imagemgr.cxx
deleted file mode 100644
index ad59dccc7a3a..000000000000
--- a/sfx2/source/appl/imagemgr.cxx
+++ /dev/null
@@ -1,202 +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 <sfx2/imagemgr.hxx>
-#include <com/sun/star/frame/XController.hpp>
-#include <com/sun/star/ui/XImageManager.hpp>
-#include <com/sun/star/frame/ModuleManager.hpp>
-#include <com/sun/star/ui/theModuleUIConfigurationManagerSupplier.hpp>
-#include <com/sun/star/ui/ImageType.hpp>
-#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
-
-#include <tools/globname.hxx>
-#include <tools/urlobj.hxx>
-#include <svtools/imagemgr.hxx>
-#include <comphelper/processfactory.hxx>
-#include <rtl/ustring.hxx>
-
-#include <sfx2/app.hxx>
-#include <sfx2/unoctitm.hxx>
-#include <sfx2/dispatch.hxx>
-#include <sfx2/msg.hxx>
-#include <sfx2/msgpool.hxx>
-#include <sfx2/viewfrm.hxx>
-#include <sfx2/module.hxx>
-#include <sfx2/objsh.hxx>
-#include <sfx2/docfac.hxx>
-
-#include <unordered_map>
-
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::frame;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::util;
-using namespace ::com::sun::star::ui;
-
-typedef std::unordered_map< OUString,
- WeakReference< XImageManager >,
- OUStringHash > ModuleIdToImagegMgr;
-
-
-Image SAL_CALL GetImage(
- const css::uno::Reference< css::frame::XFrame >& rFrame,
- const OUString& aURL,
- bool bBig
-)
-{
- // TODO/LATeR: shouldn't this become a method at SfxViewFrame?! That would save the UnoTunnel
- if ( !rFrame.is() )
- return Image();
-
- INetURLObject aObj( aURL );
- INetProtocol nProtocol = aObj.GetProtocol();
-
- Reference < XController > xController;
- Reference < XModel > xModel;
- if ( rFrame.is() )
- xController = rFrame->getController();
- if ( xController.is() )
- xModel = xController->getModel();
-
- OUString aCommandURL( aURL );
- if ( nProtocol == INetProtocol::Slot )
- {
- sal_uInt16 nId = ( sal_uInt16 ) aURL.copy(5).toInt32();
- const SfxSlot* pSlot = nullptr;
- if ( xModel.is() )
- {
- Reference < XUnoTunnel > xObj( xModel, UNO_QUERY );
- Sequence < sal_Int8 > aSeq( SvGlobalName( SFX_GLOBAL_CLASSID ).GetByteSequence() );
- sal_Int64 nHandle = xObj.is() ? xObj->getSomething( aSeq ) : 0;
- if ( nHandle )
- {
- SfxObjectShell* pDoc = reinterpret_cast<SfxObjectShell*>(sal::static_int_cast<sal_IntPtr>( nHandle ));
- SfxModule* pModule = pDoc->GetFactory().GetModule();
- pSlot = pModule->GetSlotPool()->GetSlot( nId );
- }
- }
- else
- pSlot = SfxSlotPool::GetSlotPool().GetSlot( nId );
-
- if ( pSlot )
- {
- aCommandURL = ".uno:";
- aCommandURL += OUString::createFromAscii( pSlot->GetUnoName() );
- }
- else
- aCommandURL.clear();
- }
-
- Reference< XImageManager > xDocImgMgr;
- if ( xModel.is() )
- {
- Reference< XUIConfigurationManagerSupplier > xSupplier( xModel, UNO_QUERY );
- if ( xSupplier.is() )
- {
- Reference< XUIConfigurationManager > xDocUICfgMgr( xSupplier->getUIConfigurationManager(), UNO_QUERY );
- xDocImgMgr.set( xDocUICfgMgr->getImageManager(), UNO_QUERY );
- }
- }
-
- sal_Int16 nImageType( css::ui::ImageType::COLOR_NORMAL| css::ui::ImageType::SIZE_DEFAULT );
- if ( bBig )
- nImageType |= css::ui::ImageType::SIZE_LARGE;
-
- if ( xDocImgMgr.is() )
- {
- Sequence< Reference< css::graphic::XGraphic > > aGraphicSeq;
- Sequence<OUString> aImageCmdSeq { aCommandURL };
-
- try
- {
- aGraphicSeq = xDocImgMgr->getImages( nImageType, aImageCmdSeq );
- Reference< css::graphic::XGraphic > xGraphic = aGraphicSeq[0];
- Image aImage( xGraphic );
-
- if ( !!aImage )
- return aImage;
- }
- catch (const Exception&)
- {
- }
- }
-
- static WeakReference< XModuleManager2 > s_xModuleManager;
-
- Reference< XModuleManager2 > xModuleManager = s_xModuleManager;
-
- if ( !xModuleManager.is() )
- {
- xModuleManager = ModuleManager::create(::comphelper::getProcessComponentContext());
- s_xModuleManager = xModuleManager;
- }
-
- try
- {
- if ( !aCommandURL.isEmpty() )
- {
- Reference< XImageManager > xModuleImageManager;
- OUString aModuleId = xModuleManager->identify( rFrame );
-
- static ModuleIdToImagegMgr s_aModuleIdToImageMgrMap;
-
- ModuleIdToImagegMgr::iterator pIter = s_aModuleIdToImageMgrMap.find( aModuleId );
- if ( pIter != s_aModuleIdToImageMgrMap.end() )
- xModuleImageManager = pIter->second;
- else
- {
- static WeakReference< XModuleUIConfigurationManagerSupplier > s_xModuleCfgMgrSupplier;
-
- Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgMgrSupplier = s_xModuleCfgMgrSupplier;
-
- if ( !xModuleCfgMgrSupplier.is() )
- {
- xModuleCfgMgrSupplier = theModuleUIConfigurationManagerSupplier::get(
- ::comphelper::getProcessComponentContext() );
-
- s_xModuleCfgMgrSupplier = xModuleCfgMgrSupplier;
- }
-
- Reference< XUIConfigurationManager > xUICfgMgr = xModuleCfgMgrSupplier->getUIConfigurationManager( aModuleId );
- xModuleImageManager.set( xUICfgMgr->getImageManager(), UNO_QUERY );
- s_aModuleIdToImageMgrMap.insert( ModuleIdToImagegMgr::value_type( aModuleId, xModuleImageManager ));
- }
-
- Sequence< Reference< css::graphic::XGraphic > > aGraphicSeq;
- Sequence<OUString> aImageCmdSeq { aCommandURL };
-
- aGraphicSeq = xModuleImageManager->getImages( nImageType, aImageCmdSeq );
-
- Reference< css::graphic::XGraphic > xGraphic = aGraphicSeq[0];
- Image aImage( xGraphic );
-
- if ( !!aImage )
- return aImage;
- else if ( nProtocol != INetProtocol::Uno && nProtocol != INetProtocol::Slot )
- return SvFileInformationManager::GetImageNoDefault( aObj, bBig );
- }
- }
- catch (const Exception&)
- {
- }
-
- return Image();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/dialog/recfloat.cxx b/sfx2/source/dialog/recfloat.cxx
index aebfd9c9fe1f..d80d89f965a1 100644
--- a/sfx2/source/dialog/recfloat.cxx
+++ b/sfx2/source/dialog/recfloat.cxx
@@ -30,7 +30,6 @@
#include <sfx2/dispatch.hxx>
#include <sfx2/viewfrm.hxx>
#include <sfx2/viewsh.hxx>
-#include <sfx2/imagemgr.hxx>
SFX_IMPL_FLOATINGWINDOW( SfxRecordingFloatWrapper_Impl, SID_RECORDING_FLOATWINDOW );
diff --git a/sfx2/source/sidebar/ControllerItem.cxx b/sfx2/source/sidebar/ControllerItem.cxx
index 2ebff3df3a8c..5bc39b3e664d 100644
--- a/sfx2/source/sidebar/ControllerItem.cxx
+++ b/sfx2/source/sidebar/ControllerItem.cxx
@@ -20,7 +20,6 @@
#include <sfx2/msgpool.hxx>
#include <sfx2/viewsh.hxx>
-#include <sfx2/imagemgr.hxx>
#include <sfx2/bindings.hxx>
#include <unotools/cmdoptions.hxx>
#include <vcl/commandinfoprovider.hxx>
diff --git a/sfx2/source/sidebar/SidebarPanelBase.cxx b/sfx2/source/sidebar/SidebarPanelBase.cxx
index 8c8db52d0731..e0d72cff36d2 100644
--- a/sfx2/source/sidebar/SidebarPanelBase.cxx
+++ b/sfx2/source/sidebar/SidebarPanelBase.cxx
@@ -21,7 +21,6 @@
#include <sfx2/sidebar/ILayoutableWindow.hxx>
#include <sfx2/sidebar/IContextChangeReceiver.hxx>
#include <sfx2/sidebar/SidebarModelUpdate.hxx>
-#include <sfx2/imagemgr.hxx>
#include <vcl/ctrl.hxx>
#include <vcl/layout.hxx>
#include <comphelper/processfactory.hxx>
diff --git a/sfx2/source/sidebar/SidebarToolBox.cxx b/sfx2/source/sidebar/SidebarToolBox.cxx
index 968366eab8f9..2dc0c5910c62 100644
--- a/sfx2/source/sidebar/SidebarToolBox.cxx
+++ b/sfx2/source/sidebar/SidebarToolBox.cxx
@@ -255,13 +255,6 @@ IMPL_LINK_NOARG(SidebarToolBox, ChangedIconSizeHandler, LinkParamNone*, void)
if (mbUseDefaultButtonSize)
SetToolboxButtonSize(GetDefaultButtonSize());
- vcl::ImageType eImageType = vcl::ImageType::Size16;
- ToolBoxButtonSize eSize = GetToolboxButtonSize();
- if (eSize == ToolBoxButtonSize::Large)
- eImageType = vcl::ImageType::Size26;
- else if (eSize == ToolBoxButtonSize::Size32)
- eImageType = vcl::ImageType::Size32;
-
for (auto const& it : maControllers)
{
Reference<frame::XSubToolbarController> xController(it.second, UNO_QUERY);
@@ -275,7 +268,7 @@ IMPL_LINK_NOARG(SidebarToolBox, ChangedIconSizeHandler, LinkParamNone*, void)
{
OUString aCommandURL = GetItemCommand(it.first);
css::uno::Reference<frame::XFrame> xFrame = SfxViewFrame::Current()->GetFrame().GetFrameInterface();
- Image aImage = vcl::CommandInfoProvider::GetImageForCommand(aCommandURL, xFrame, eImageType);
+ Image aImage = vcl::CommandInfoProvider::GetImageForCommand(aCommandURL, xFrame, GetImageSize());
SetItemImage(it.first, aImage);
}
}
diff --git a/sfx2/source/sidebar/Tools.cxx b/sfx2/source/sidebar/Tools.cxx
index b809f7ad96f5..e246599fd9c0 100644
--- a/sfx2/source/sidebar/Tools.cxx
+++ b/sfx2/source/sidebar/Tools.cxx
@@ -21,9 +21,9 @@
#include <sfx2/sidebar/Theme.hxx>
-#include <sfx2/imagemgr.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/namedvaluecollection.hxx>
+#include <vcl/commandinfoprovider.hxx>
#include <vcl/gradient.hxx>
#include <com/sun/star/frame/XDispatchProvider.hpp>
@@ -57,7 +57,7 @@ Image Tools::GetImage (
{
if (rsURL.startsWith(".uno:"))
{
- const Image aPanelImage (::GetImage(rxFrame, rsURL, false));
+ const Image aPanelImage(vcl::CommandInfoProvider::GetImageForCommand(rsURL, rxFrame));
return aPanelImage;
}
else
diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx
index b908b6f932f6..5aed453f2392 100644
--- a/sfx2/source/toolbox/tbxitem.cxx
+++ b/sfx2/source/toolbox/tbxitem.cxx
@@ -87,7 +87,6 @@
#include <sfx2/unoctitm.hxx>
#include "helpid.hrc"
#include "workwin.hxx"
-#include <sfx2/imagemgr.hxx>
#include <ctrlfactoryimpl.hxx>
using namespace ::com::sun::star;
@@ -572,11 +571,6 @@ Reference< css::awt::XWindow > SAL_CALL SfxToolBoxControl::createItemWindow( con
return VCLUnoHelper::GetInterface( CreateItemWindow( VCLUnoHelper::GetWindow( rParent )));
}
-bool SfxToolBoxControl::hasBigImages() const
-{
- return (GetToolBox().GetToolboxButtonSize() == ToolBoxButtonSize::Large);
-}
-
void SfxToolBoxControl::SetPopupWindow( SfxPopupWindow* pWindow )
{
pImpl->mpPopupWindow = pWindow;
diff --git a/svx/inc/pch/precompiled_svx.hxx b/svx/inc/pch/precompiled_svx.hxx
index f9aaba9f6051..201a708a4a03 100644
--- a/svx/inc/pch/precompiled_svx.hxx
+++ b/svx/inc/pch/precompiled_svx.hxx
@@ -324,7 +324,6 @@
#include <sfx2/dispatch.hxx>
#include <sfx2/dllapi.h>
#include <sfx2/dockwin.hxx>
-#include <sfx2/imagemgr.hxx>
#include <sfx2/itemconnect.hxx>
#include <sfx2/module.hxx>
#include <sfx2/objsh.hxx>
diff --git a/svx/source/form/tbxform.cxx b/svx/source/form/tbxform.cxx
index 467834bf9c54..23c97a7c0cbb 100644
--- a/svx/source/form/tbxform.cxx
+++ b/svx/source/form/tbxform.cxx
@@ -37,7 +37,6 @@
#include "fmhelp.hrc"
#include <sfx2/viewfrm.hxx>
#include <sfx2/viewsh.hxx>
-#include <sfx2/imagemgr.hxx>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
index 7ca72f4def9d..d94f52d4211b 100644
--- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
+++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
@@ -26,7 +26,6 @@
#include <sfx2/bindings.hxx>
#include <sfx2/viewsh.hxx>
#include <sfx2/objsh.hxx>
-#include <sfx2/imagemgr.hxx>
#include <svx/dlgutil.hxx>
#include <unotools/viewoptions.hxx>
#include <vcl/virdev.hxx>
diff --git a/svx/source/sidebar/shapes/DefaultShapesPanel.cxx b/svx/source/sidebar/shapes/DefaultShapesPanel.cxx
index a56e004fa670..c67e24a2328f 100644
--- a/svx/source/sidebar/shapes/DefaultShapesPanel.cxx
+++ b/svx/source/sidebar/shapes/DefaultShapesPanel.cxx
@@ -19,7 +19,6 @@
#include "DefaultShapesPanel.hxx"
#include <com/sun/star/lang/IllegalArgumentException.hpp>
-#include <sfx2/imagemgr.hxx>
#include <comphelper/dispatchcommand.hxx>
#include <vcl/outdev.hxx>
#include <vcl/commandinfoprovider.hxx>
@@ -131,7 +130,7 @@ void DefaultShapesPanel::populateShapes()
for(std::map<sal_uInt16, rtl::OUString>::size_type i = 0; i < aSet.second.size(); i++)
{
sSlotStr = aSet.second[i];
- aSlotImage = ::GetImage(mxFrame, sSlotStr, false);
+ aSlotImage = vcl::CommandInfoProvider::GetImageForCommand(sSlotStr, mxFrame);
sLabel = vcl::CommandInfoProvider::GetTooltipForCommand(sSlotStr, mxFrame);
aSet.first->InsertItem(i, aSlotImage, sLabel);
}
diff --git a/svx/source/tbxctrls/bulletsnumbering.cxx b/svx/source/tbxctrls/bulletsnumbering.cxx
index dbabd99ae6f7..bf81afb5e032 100644
--- a/svx/source/tbxctrls/bulletsnumbering.cxx
+++ b/svx/source/tbxctrls/bulletsnumbering.cxx
@@ -12,12 +12,12 @@
#include <comphelper/propertysequence.hxx>
#include <i18nlangtag/mslangid.hxx>
-#include <sfx2/imagemgr.hxx>
#include <svtools/popupwindowcontroller.hxx>
#include <svtools/toolbarmenu.hxx>
#include <svx/dialogs.hrc>
#include <svx/dialmgr.hxx>
#include <svx/numvset.hxx>
+#include <vcl/commandinfoprovider.hxx>
#include <vcl/toolbox.hxx>
#include <vcl/settings.hxx>
@@ -120,7 +120,8 @@ NumberingPopup::NumberingPopup( NumberingToolBoxControl& rController,
AddStatusListener( ".uno:CurrentOutlineType" );
}
- appendEntry( 1, aMoreItemText, ::GetImage( mrController.getFrameInterface(), ".uno:OutlineBullet", false ) );
+ appendEntry( 1, aMoreItemText,
+ vcl::CommandInfoProvider::GetImageForCommand( ".uno:OutlineBullet", mrController.getFrameInterface() ) );
SetOutputSizePixel( getMenuSize() );
mpValueSet->SetSelectHdl( LINK( this, NumberingPopup, VSSelectValueSetHdl ) );
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index e15a571fb1e2..41b4e8ed3f54 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -41,7 +41,6 @@
#include <svl/stritem.hxx>
#include <sfx2/tplpitem.hxx>
#include <sfx2/dispatch.hxx>
-#include <sfx2/imagemgr.hxx>
#include <sfx2/viewsh.hxx>
#include <sfx2/docfac.hxx>
#include <sfx2/templdlg.hxx>
@@ -2915,7 +2914,7 @@ sal_Bool SvxColorToolBoxControl::opensSubToolbar()
void SvxColorToolBoxControl::updateImage()
{
- Image aImage = GetImage( m_xFrame, m_aCommandURL, hasBigImages() );
+ Image aImage = vcl::CommandInfoProvider::GetImageForCommand(m_aCommandURL, m_xFrame, GetToolBox().GetImageSize());
if ( !!aImage )
{
GetToolBox().SetItemImage( GetId(), aImage );
diff --git a/svx/source/tbxctrls/tbxdrctl.cxx b/svx/source/tbxctrls/tbxdrctl.cxx
index 2cf2197108c3..cc45215d388a 100644
--- a/svx/source/tbxctrls/tbxdrctl.cxx
+++ b/svx/source/tbxctrls/tbxdrctl.cxx
@@ -23,7 +23,6 @@
#include <svl/aeitem.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/viewsh.hxx>
-#include <sfx2/imagemgr.hxx>
#include <sfx2/viewfrm.hxx>
#include <vcl/toolbox.hxx>
diff --git a/sw/source/uibase/ribbar/workctrl.cxx b/sw/source/uibase/ribbar/workctrl.cxx
index da384935b31e..f3bf91fec342 100644
--- a/sw/source/uibase/ribbar/workctrl.cxx
+++ b/sw/source/uibase/ribbar/workctrl.cxx
@@ -24,7 +24,6 @@
#include <sfx2/htmlmode.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/bindings.hxx>
-#include <sfx2/imagemgr.hxx>
#include <sfx2/msgpool.hxx>
#include <swmodule.hxx>
#include <view.hxx>
diff --git a/sw/source/uibase/sidebar/WrapPropertyPanel.cxx b/sw/source/uibase/sidebar/WrapPropertyPanel.cxx
index 08e5f9392190..d3954521b35a 100644
--- a/sw/source/uibase/sidebar/WrapPropertyPanel.cxx
+++ b/sw/source/uibase/sidebar/WrapPropertyPanel.cxx
@@ -25,8 +25,8 @@
#include <sfx2/bindings.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/sidebar/ControlFactory.hxx>
-#include <sfx2/imagemgr.hxx>
#include <svl/eitem.hxx>
+#include <vcl/commandinfoprovider.hxx>
#include <vcl/svapp.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/settings.hxx>
@@ -148,20 +148,20 @@ void WrapPropertyPanel::Initialize()
mpEnableContour->SetClickHdl(EnableContourLink);
mpSpacingLB->SetSelectHdl(LINK(this, WrapPropertyPanel, SpacingLBHdl));
- mpRBNoWrap->SetModeRadioImage(::GetImage(mxFrame, UNO_WRAPOFF, false));
+ mpRBNoWrap->SetModeRadioImage(vcl::CommandInfoProvider::GetImageForCommand(UNO_WRAPOFF, mxFrame));
if ( AllSettings::GetLayoutRTL() )
{
- mpRBWrapLeft->SetModeRadioImage(::GetImage(mxFrame, UNO_WRAPRIGHT, false));
- mpRBWrapRight->SetModeRadioImage(::GetImage(mxFrame, UNO_WRAPLEFT, false));
+ mpRBWrapLeft->SetModeRadioImage(vcl::CommandInfoProvider::GetImageForCommand(UNO_WRAPRIGHT, mxFrame));
+ mpRBWrapRight->SetModeRadioImage(vcl::CommandInfoProvider::GetImageForCommand(UNO_WRAPLEFT, mxFrame));
}
else
{
- mpRBWrapLeft->SetModeRadioImage(::GetImage(mxFrame, UNO_WRAPLEFT, false));
- mpRBWrapRight->SetModeRadioImage(::GetImage(mxFrame, UNO_WRAPRIGHT, false));
+ mpRBWrapLeft->SetModeRadioImage(vcl::CommandInfoProvider::GetImageForCommand(UNO_WRAPLEFT, mxFrame));
+ mpRBWrapRight->SetModeRadioImage(vcl::CommandInfoProvider::GetImageForCommand(UNO_WRAPRIGHT, mxFrame));
}
- mpRBWrapParallel->SetModeRadioImage(::GetImage(mxFrame, UNO_WRAPON, false));
- mpRBWrapThrough->SetModeRadioImage(::GetImage(mxFrame, UNO_WRAPTHROUGH, false));
- mpRBIdealWrap->SetModeRadioImage(::GetImage(mxFrame, UNO_WRAPIDEAL, false));
+ mpRBWrapParallel->SetModeRadioImage(vcl::CommandInfoProvider::GetImageForCommand(UNO_WRAPON, mxFrame));
+ mpRBWrapThrough->SetModeRadioImage(vcl::CommandInfoProvider::GetImageForCommand(UNO_WRAPTHROUGH, mxFrame));
+ mpRBIdealWrap->SetModeRadioImage(vcl::CommandInfoProvider::GetImageForCommand(UNO_WRAPIDEAL, mxFrame));
aCustomEntry = mpCustomEntry->GetText();
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index a8fd640005f1..4c74017a81f0 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -434,15 +434,7 @@ void ToolBox::InsertItem(const OUString& rCommand, const css::uno::Reference<css
OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(rFrame));
OUString aLabel(vcl::CommandInfoProvider::GetLabelForCommand(rCommand, aModuleName));
OUString aTooltip(vcl::CommandInfoProvider::GetTooltipForCommand(rCommand, rFrame));
-
- vcl::ImageType eImageType = vcl::ImageType::Size16;
-
- if (GetToolboxButtonSize() == ToolBoxButtonSize::Large)
- eImageType = vcl::ImageType::Size26;
- else if (GetToolboxButtonSize() == ToolBoxButtonSize::Size32)
- eImageType = vcl::ImageType::Size32;
-
- Image aImage(CommandInfoProvider::GetImageForCommand(rCommand, rFrame, eImageType));
+ Image aImage(CommandInfoProvider::GetImageForCommand(rCommand, rFrame, GetImageSize()));
sal_uInt16 nItemId = GetItemCount() + 1;
//TODO: ImplToolItems::size_type -> sal_uInt16!
@@ -633,6 +625,17 @@ ToolBoxButtonSize ToolBox::GetToolboxButtonSize() const
return mpData->meButtonSize;
}
+ImageType ToolBox::GetImageSize() const
+{
+ ImageType eImageType = ImageType::Size16;
+ if (mpData->meButtonSize == ToolBoxButtonSize::Large)
+ eImageType = ImageType::Size26;
+ else if (mpData->meButtonSize == ToolBoxButtonSize::Size32)
+ eImageType = ImageType::Size32;
+
+ return eImageType;
+}
+
/*static*/ Size ToolBox::GetDefaultImageSize(ToolBoxButtonSize eToolBoxButtonSize)
{
OutputDevice *pDefault = Application::GetDefaultDevice();
commit 94490fdf76ff9aec05774a6dbbb0b42d87812969
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Sun Apr 23 14:56:49 2017 +0300
tdf#95845 Use CommandInfoProvider
And a few unused theUICommandDescription includes.
Change-Id: Ic80dbfb91e5e7662723efe0cb4090416994adabd
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 10c3d916f886..4de87894332e 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -70,7 +70,6 @@
#include <com/sun/star/task/OfficeRestartManager.hpp>
#include <com/sun/star/task/XRestartManager.hpp>
#include <com/sun/star/document/XDocumentEventListener.hpp>
-#include <com/sun/star/frame/theUICommandDescription.hpp>
#include <com/sun/star/ui/theUIElementFactoryManager.hpp>
#include <com/sun/star/ui/theWindowStateConfiguration.hpp>
#include <com/sun/star/frame/thePopupMenuControllerFactory.hpp>
diff --git a/framework/source/fwi/helper/mischelper.cxx b/framework/source/fwi/helper/mischelper.cxx
index 7ce88b29c5fc..21a1b5512c47 100644
--- a/framework/source/fwi/helper/mischelper.cxx
+++ b/framework/source/fwi/helper/mischelper.cxx
@@ -19,8 +19,6 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/document/XDocumentLanguages.hpp>
-#include <com/sun/star/frame/ModuleManager.hpp>
-#include <com/sun/star/frame/theUICommandDescription.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/linguistic2/LanguageGuessing.hpp>
diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx
index 4fb7f5f45ff0..88c527669710 100644
--- a/framework/source/uielement/toolbarsmenucontroller.cxx
+++ b/framework/source/uielement/toolbarsmenucontroller.cxx
@@ -32,7 +32,6 @@
#include <com/sun/star/awt/MenuItemStyle.hpp>
#include <com/sun/star/frame/ModuleManager.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp>
-#include <com/sun/star/frame/theUICommandDescription.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/frame/XLayoutManager.hpp>
diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx
index 6c55b8c8a9e3..073735c1dad1 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -19,12 +19,6 @@
#include <comphelper/processfactory.hxx>
-#include <com/sun/star/frame/UnknownModuleException.hpp>
-#include <com/sun/star/frame/ModuleManager.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/frame/theUICommandDescription.hpp>
-
#include "ViewShellBase.hxx"
#include <algorithm>
#include "EventMultiplexer.hxx"
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index af4ee87f3c6f..bd5684b947a2 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -19,6 +19,7 @@
#include <memory>
+#include <vcl/commandinfoprovider.hxx>
#include <vcl/menu.hxx>
#include <vcl/settings.hxx>
#include <svl/intitem.hxx>
@@ -32,7 +33,6 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/frame/ModuleManager.hpp>
#include <com/sun/star/frame/UnknownModuleException.hpp>
-#include <com/sun/star/frame/theUICommandDescription.hpp>
#include <officecfg/Office/Common.hxx>
#include <sfx2/sfxhelp.hxx>
@@ -2154,24 +2154,6 @@ VclPtr<PopupMenu> SfxCommonTemplateDialog_Impl::CreateContextMenu()
return mxMenu;
}
-static OUString lcl_GetLabel(uno::Any& rAny)
-{
- OUString sRet;
- uno::Sequence< beans::PropertyValue >aPropSeq;
- if ( rAny >>= aPropSeq )
- {
- for( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ )
- {
- if ( aPropSeq[i].Name == "Label" )
- {
- aPropSeq[i].Value >>= sRet;
- break;
- }
- }
- }
- return sRet;
-}
-
SfxTemplateDialog_Impl::SfxTemplateDialog_Impl(SfxBindings* pB, SfxTemplatePanelControl* pDlgWindow)
: SfxCommonTemplateDialog_Impl(pB, pDlgWindow)
, m_pFloat(pDlgWindow)
@@ -2414,45 +2396,25 @@ IMPL_LINK( SfxTemplateDialog_Impl, ToolBoxRClick, ToolBox *, pBox, void )
{
//create a popup menu in Writer
ScopedVclPtrInstance<PopupMenu> pMenu;
- uno::Reference< container::XNameAccess > xNameAccess(
- frame::theUICommandDescription::get(
- ::comphelper::getProcessComponentContext()) );
- uno::Reference< container::XNameAccess > xUICommands;
OUString sTextDoc("com.sun.star.text.TextDocument");
- if(xNameAccess->hasByName(sTextDoc))
- {
- uno::Any a = xNameAccess->getByName( sTextDoc );
- a >>= xUICommands;
- }
- if(!xUICommands.is())
- return;
- try
- {
- uno::Any aCommand = xUICommands->getByName(".uno:StyleNewByExample");
- OUString sLabel = lcl_GetLabel( aCommand );
- pMenu->InsertItem( SID_STYLE_NEW_BY_EXAMPLE, sLabel );
- pMenu->SetHelpId(SID_STYLE_NEW_BY_EXAMPLE, HID_TEMPLDLG_NEWBYEXAMPLE);
-
- aCommand = xUICommands->getByName(".uno:StyleUpdateByExample");
- sLabel = lcl_GetLabel( aCommand );
-
- pMenu->InsertItem( SID_STYLE_UPDATE_BY_EXAMPLE, sLabel );
- pMenu->SetHelpId(SID_STYLE_UPDATE_BY_EXAMPLE, HID_TEMPLDLG_UPDATEBYEXAMPLE);
-
- aCommand = xUICommands->getByName(".uno:LoadStyles");
- sLabel = lcl_GetLabel( aCommand );
- pMenu->InsertItem( SID_TEMPLATE_LOAD, sLabel );
- pMenu->SetHelpId(SID_TEMPLATE_LOAD, ".uno:LoadStyles");
-
- pMenu->SetSelectHdl(LINK(this, SfxTemplateDialog_Impl, MenuSelectHdl));
- pMenu->Execute( pBox,
- pBox->GetItemRect(nEntry),
- PopupMenuFlags::ExecuteDown );
- pBox->EndSelection();
- }
- catch (const uno::Exception&)
- {
- }
+
+ OUString sLabel = vcl::CommandInfoProvider::GetPopupLabelForCommand(".uno:StyleNewByExample", sTextDoc);
+ pMenu->InsertItem( SID_STYLE_NEW_BY_EXAMPLE, sLabel );
+ pMenu->SetHelpId(SID_STYLE_NEW_BY_EXAMPLE, HID_TEMPLDLG_NEWBYEXAMPLE);
+
+ sLabel = vcl::CommandInfoProvider::GetPopupLabelForCommand(".uno:StyleUpdateByExample", sTextDoc);
+ pMenu->InsertItem( SID_STYLE_UPDATE_BY_EXAMPLE, sLabel );
+ pMenu->SetHelpId(SID_STYLE_UPDATE_BY_EXAMPLE, HID_TEMPLDLG_UPDATEBYEXAMPLE);
+
+ sLabel = vcl::CommandInfoProvider::GetPopupLabelForCommand(".uno:LoadStyles", sTextDoc);
+ pMenu->InsertItem( SID_TEMPLATE_LOAD, sLabel );
+ pMenu->SetHelpId(SID_TEMPLATE_LOAD, ".uno:LoadStyles");
+
+ pMenu->SetSelectHdl(LINK(this, SfxTemplateDialog_Impl, MenuSelectHdl));
+ pMenu->Execute( pBox,
+ pBox->GetItemRect(nEntry),
+ PopupMenuFlags::ExecuteDown );
+ pBox->EndSelection();
pBox->Invalidate();
}
}
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index a8ba5f70adc3..57408af1eb10 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -37,7 +37,6 @@
#include <com/sun/star/container/XContainerQuery.hpp>
#include <com/sun/star/frame/XStorable.hpp>
#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
-#include <com/sun/star/frame/theUICommandDescription.hpp>
#include <cppuhelper/implbase.hxx>
#include <osl/file.hxx>
diff --git a/sw/source/uibase/lingu/olmenu.cxx b/sw/source/uibase/lingu/olmenu.cxx
index 86aa66d8cc46..ef30e272192a 100644
--- a/sw/source/uibase/lingu/olmenu.cxx
+++ b/sw/source/uibase/lingu/olmenu.cxx
@@ -58,9 +58,9 @@
#include <linguistic/misc.hxx>
#include <osl/file.hxx>
#include <rtl/string.hxx>
+#include <vcl/commandinfoprovider.hxx>
#include <vcl/graphicfilter.hxx>
#include <sfx2/dispatch.hxx>
-#include <sfx2/imagemgr.hxx>
#include <sfx2/request.hxx>
#include <sfx2/sfxdlg.hxx>
#include <svl/itemset.hxx>
@@ -77,7 +77,6 @@
#include <map>
-#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/document/XDocumentLanguages.hpp>
#include <com/sun/star/frame/XStorable.hpp>
#include <com/sun/star/i18n/ScriptType.hpp>
@@ -86,7 +85,6 @@
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
#include <com/sun/star/system/SystemShellExecute.hpp>
-#include <com/sun/star/frame/theUICommandDescription.hpp>
using namespace ::com::sun::star;
@@ -216,45 +214,6 @@ void SwSpellPopup::fillLangPopupMenu(
pPopupMenu->InsertItem( nLangItemIdStart + MN_MORE_OFFSET, OUString(SW_RES( STR_LANGSTATUS_MORE )) );
}
-OUString RetrieveLabelFromCommand( const OUString& aCmdURL )
-{
- OUString aLabel;
- if ( !aCmdURL.isEmpty() )
- {
- try
- {
- uno::Reference< container::XNameAccess > const xNameAccess(
- frame::theUICommandDescription::get(
- ::comphelper::getProcessComponentContext() ),
- uno::UNO_QUERY_THROW );
- uno::Reference< container::XNameAccess > xUICommandLabels;
- uno::Any a = xNameAccess->getByName( "com.sun.star.text.TextDocument" );
- uno::Reference< container::XNameAccess > xUICommands;
- a >>= xUICommandLabels;
- OUString aStr;
- uno::Sequence< beans::PropertyValue > aPropSeq;
- a = xUICommandLabels->getByName( aCmdURL );
- if ( a >>= aPropSeq )
- {
- for ( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ )
- {
- if ( aPropSeq[i].Name == "Label" )
- {
- aPropSeq[i].Value >>= aStr;
- break;
- }
- }
- }
- aLabel = aStr;
- }
- catch (const uno::Exception&)
- {
- }
- }
-
- return aLabel;
-}
-
SwSpellPopup::SwSpellPopup(
SwWrtShell* pWrtSh,
const uno::Reference< linguistic2::XSpellAlternatives > &xAlt,
@@ -331,10 +290,14 @@ SwSpellPopup::SwSpellPopup(
}
}
+ uno::Reference< frame::XFrame > xFrame = pWrtSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface();
+ OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(xFrame));
+
OUString aIgnoreSelection( SW_RES( STR_IGNORE_SELECTION ) );
- OUString aSpellingAndGrammar = RetrieveLabelFromCommand( ".uno:SpellingAndGrammarDialog" );
- m_xPopupMenu->SetItemText(m_nSpellDialogId, aSpellingAndGrammar);
- m_xPopupMenu->SetItemText(m_nCorrectDialogId, RetrieveLabelFromCommand(".uno:AutoCorrectDlg"));
+ m_xPopupMenu->SetItemText(m_nSpellDialogId,
+ vcl::CommandInfoProvider::GetPopupLabelForCommand(".uno:SpellingAndGrammarDialog", aModuleName));
+ m_xPopupMenu->SetItemText(m_nCorrectDialogId,
+ vcl::CommandInfoProvider::GetPopupLabelForCommand(".uno:AutoCorrectDlg", aModuleName));
sal_uInt16 nItemPos = m_xPopupMenu->GetItemPos(m_nIgnoreWordId);
m_xPopupMenu->InsertItem(MN_IGNORE_SELECTION, aIgnoreSelection, MenuItemBits::NONE, OString(), nItemPos);
m_xPopupMenu->SetHelpId(MN_IGNORE_SELECTION, HID_LINGU_IGNORE_SELECTION);
@@ -448,11 +411,8 @@ SwSpellPopup::SwSpellPopup(
m_xPopupMenu->EnableItem(m_nLangParaMenuId);
if (bUseImagesInMenus)
- {
- uno::Reference< frame::XFrame > xFrame = pWrtSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface();
- Image rImg = ::GetImage( xFrame, ".uno:SpellingAndGrammarDialog", false );
- m_xPopupMenu->SetItemImage(m_nSpellDialogId, rImg);
- }
+ m_xPopupMenu->SetItemImage(m_nSpellDialogId,
+ vcl::CommandInfoProvider::GetImageForCommand(".uno:SpellingAndGrammarDialog", xFrame));
checkRedline();
m_xPopupMenu->RemoveDisabledEntries( true, true );
@@ -548,9 +508,12 @@ SwSpellPopup::SwSpellPopup(
m_xPopupMenu->InsertSeparator(OString(), nPos++);
}
+ uno::Reference< frame::XFrame > xFrame = pWrtSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface();
+ OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(xFrame));
+
OUString aIgnoreSelection( SW_RES( STR_IGNORE_SELECTION ) );
- OUString aSpellingAndGrammar = RetrieveLabelFromCommand( ".uno:SpellingAndGrammarDialog" );
- m_xPopupMenu->SetItemText(m_nSpellDialogId, aSpellingAndGrammar);
+ m_xPopupMenu->SetItemText(m_nSpellDialogId,
+ vcl::CommandInfoProvider::GetPopupLabelForCommand(".uno:SpellingAndGrammarDialog", aModuleName));
sal_uInt16 nItemPos = m_xPopupMenu->GetItemPos(m_nIgnoreWordId);
m_xPopupMenu->InsertItem(MN_IGNORE_SELECTION, aIgnoreSelection, MenuItemBits::NONE, OString(), nItemPos);
m_xPopupMenu->SetHelpId(MN_IGNORE_SELECTION, HID_LINGU_IGNORE_SELECTION);
@@ -610,11 +573,8 @@ SwSpellPopup::SwSpellPopup(
m_xPopupMenu->EnableItem(m_nLangParaMenuId);
if (bUseImagesInMenus)
- {
- uno::Reference< frame::XFrame > xFrame = pWrtSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface();
- Image rImg = ::GetImage( xFrame, ".uno:SpellingAndGrammarDialog", false );
- m_xPopupMenu->SetItemImage(m_nSpellDialogId, rImg);
- }
+ m_xPopupMenu->SetItemImage(m_nSpellDialogId,
+ vcl::CommandInfoProvider::GetImageForCommand(".uno:SpellingAndGrammarDialog", xFrame));
checkRedline();
m_xPopupMenu->RemoveDisabledEntries(true, true);
commit 654d78834c9e16cd5d57af6ad59b1dd3c80ca467
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Thu Apr 20 20:47:26 2017 +0300
No usage of the private:commandimage thing
Change-Id: I8e5c1431f095c875cda6f66f16a03af4bbd1d1fb
diff --git a/sfx2/source/sidebar/Tools.cxx b/sfx2/source/sidebar/Tools.cxx
index 901449d4a022..b809f7ad96f5 100644
--- a/sfx2/source/sidebar/Tools.cxx
+++ b/sfx2/source/sidebar/Tools.cxx
@@ -55,25 +55,11 @@ Image Tools::GetImage (
{
if (rsURL.getLength() > 0)
{
- const sal_Char sUnoCommandPrefix[] = ".uno:";
- const sal_Char sCommandImagePrefix[] = "private:commandimage/";
- const sal_Int32 nCommandImagePrefixLength = strlen(sCommandImagePrefix);
-
- if (rsURL.startsWith(sUnoCommandPrefix))
+ if (rsURL.startsWith(".uno:"))
{
const Image aPanelImage (::GetImage(rxFrame, rsURL, false));
return aPanelImage;
}
- else if (rsURL.startsWith(sCommandImagePrefix))
- {
- ::rtl::OUStringBuffer aCommandName;
- aCommandName.append(sUnoCommandPrefix);
- aCommandName.append(rsURL.copy(nCommandImagePrefixLength));
- const ::rtl::OUString sCommandName (aCommandName.makeStringAndClear());
-
- const Image aPanelImage (::GetImage(rxFrame, sCommandName, false));
- return aPanelImage;
- }
else
{
const Reference<XComponentContext> xContext (::comphelper::getProcessComponentContext());
commit a32fbca154991a93b6bef55f1c306a2fac5674b6
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Fri Apr 21 01:05:53 2017 +0300
Customization of notebookbar menu always possible
i.e. even when experimental features disabled. That's
the same behavior as for the notebookbar shortcuts
toolbar.
Change-Id: Ic87e5c8015f796f33042d1e348ea567681ae240d
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index 6ac6fbbe8bf8..bb9eb71ed25b 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -1354,8 +1354,6 @@ SvxEntries* ContextMenuSaveInData::GetEntries()
{
if ( !m_pRootEntry )
{
- bool bExperimental = SvtMiscOptions().IsExperimentalMode();
-
typedef std::unordered_map< OUString, bool, OUStringHash > MenuInfo;
MenuInfo aMenuInfo;
@@ -1380,9 +1378,6 @@ SvxEntries* ContextMenuSaveInData::GetEntries()
}
}
- if ( !bExperimental && aUrl.endsWith("notebookbar") )
- continue;
-
css::uno::Reference< css::container::XIndexAccess > xPopupMenu;
try
{
@@ -1431,9 +1426,6 @@ SvxEntries* ContextMenuSaveInData::GetEntries()
}
}
- if ( !bExperimental && aUrl.endsWith("notebookbar") )
- continue;
-
css::uno::Reference< css::container::XIndexAccess > xPopupMenu;
try
{
commit e780e7b4338e5773788ce66837d17f5be1dfb99b
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Tue Mar 28 02:37:35 2017 +0300
SID_FM_CONFIG isn't executable
It's only used to host a toolbox controller nowadays,
and has no defined execute method in the sdi file.
Change-Id: I20717d25190bb15b8ecff9d3a9038b05dac86b14
diff --git a/svx/source/form/formtoolbars.cxx b/svx/source/form/formtoolbars.cxx
index 1acfbfd5b1b8..71439b7da34a 100644
--- a/svx/source/form/formtoolbars.cxx
+++ b/svx/source/form/formtoolbars.cxx
@@ -79,13 +79,11 @@ namespace svxform
OUString FormToolboxes::getToolboxResourceName( sal_uInt16 _nSlotId )
{
- OSL_ENSURE( ( _nSlotId == SID_FM_MORE_CONTROLS ) || ( _nSlotId == SID_FM_FORM_DESIGN_TOOLS ) || ( _nSlotId == SID_FM_CONFIG ),
+ OSL_ENSURE( ( _nSlotId == SID_FM_MORE_CONTROLS ) || ( _nSlotId == SID_FM_FORM_DESIGN_TOOLS ),
"FormToolboxes::getToolboxResourceName: unsupported slot!" );
- const sal_Char* pToolBarName = "formcontrols";
- if ( _nSlotId == SID_FM_MORE_CONTROLS )
- pToolBarName = "moreformcontrols";
- else if ( _nSlotId == SID_FM_FORM_DESIGN_TOOLS )
+ const sal_Char* pToolBarName = "moreformcontrols";
+ if ( _nSlotId == SID_FM_FORM_DESIGN_TOOLS )
pToolBarName = "formdesign";
OUString aToolBarResStr( "private:resource/toolbar/" );
commit 218de75aaf92d947689b5ccb9f12087d0166f6ce
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Tue Mar 28 02:27:48 2017 +0300
Fix open command name
Change-Id: If5768a8f624a34b721ed14039ba5d2440aaf109d
diff --git a/sc/uiconfig/scalc/toolbar/notebookbarshortcuts.xml b/sc/uiconfig/scalc/toolbar/notebookbarshortcuts.xml
index 6bf1a4e8a4b3..e222a7855935 100644
--- a/sc/uiconfig/scalc/toolbar/notebookbarshortcuts.xml
+++ b/sc/uiconfig/scalc/toolbar/notebookbarshortcuts.xml
@@ -8,7 +8,7 @@
*
-->
<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink">
- <toolbar:toolbaritem xlink:href=".uno:Open"/>
+ <toolbar:toolbaritem xlink:href=".uno:OpenFromCalc"/>
<toolbar:toolbaritem xlink:href=".uno:Save"/>
<toolbar:toolbaritem xlink:href=".uno:Undo"/>
<toolbar:toolbaritem xlink:href=".uno:Redo"/>
More information about the Libreoffice-commits
mailing list