summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorAndre Fischer <af@apache.org>2013-04-19 08:51:45 +0000
committerMichael Meeks <michael.meeks@suse.com>2013-05-20 11:33:16 +0100
commit0b2c09a180f076230a1f1ac3ecf4725e82aada4c (patch)
treecd61de0a554320ae3c6c7c5ef9ef4c412e0dd3ac /sfx2
parentc991fb49aa174f300be0b978d89bc63e01e0aa2b (diff)
Resolves: #i121960# Extend the sidebar::ControllerItem to check Disabled state
Converted TextPropertyPanel to use this new functionality. (cherry picked from commit 5e32abe48b0833e4e370507a1e74fbb1ba98b5e3) Conflicts: officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu sfx2/inc/sfx2/sidebar/ControllerItem.hxx sfx2/source/sidebar/ControllerItem.cxx sfx2/source/sidebar/FocusManager.cxx sfx2/source/sidebar/SidebarChildWindow.cxx svx/Library_svx.mk svx/source/sidebar/text/TextPropertyPanel.cxx svx/source/sidebar/text/TextPropertyPanel.hrc svx/source/sidebar/text/TextPropertyPanel.hxx svx/source/sidebar/text/TextPropertyPanel.src svx/source/sidebar/text/TextUnderlineControl.hxx Change-Id: I3a25bb0a02e6165ceeb6dbd9e6ecd3e94051f594
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/Library_sfx.mk1
-rw-r--r--sfx2/source/sidebar/CommandInfoProvider.cxx354
-rw-r--r--sfx2/source/sidebar/CommandInfoProvider.hxx92
-rw-r--r--sfx2/source/sidebar/ControllerItem.cxx177
-rw-r--r--sfx2/source/sidebar/SidebarChildWindow.cxx12
5 files changed, 627 insertions, 9 deletions
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
index e32300c053f0..40d42832c517 100644
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -234,6 +234,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
sfx2/source/sidebar/SidebarPanelBase \
sfx2/source/sidebar/SidebarToolBox \
sfx2/source/sidebar/AsynchronousCall \
+ sfx2/source/sidebar/CommandInfoProvider \
sfx2/source/sidebar/Context \
sfx2/source/sidebar/ContextChangeBroadcaster \
sfx2/source/sidebar/ContextList \
diff --git a/sfx2/source/sidebar/CommandInfoProvider.cxx b/sfx2/source/sidebar/CommandInfoProvider.cxx
new file mode 100644
index 000000000000..dc254db718d0
--- /dev/null
+++ b/sfx2/source/sidebar/CommandInfoProvider.cxx
@@ -0,0 +1,354 @@
+/*
+ * 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 "CommandInfoProvider.hxx"
+
+#include <comphelper/processfactory.hxx>
+#include <svtools/acceleratorexecute.hxx>
+#include <cppuhelper/compbase1.hxx>
+#include <cppuhelper/basemutex.hxx>
+
+#include <com/sun/star/frame/XModuleManager.hpp>
+#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
+#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
+
+using namespace css;
+using namespace cssu;
+using ::rtl::OUString;
+
+
+#define A2S(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s))
+
+
+namespace
+{
+ typedef ::cppu::WeakComponentImplHelper1 <
+ css::lang::XEventListener
+ > FrameListenerInterfaceBase;
+ class FrameListener
+ : public ::cppu::BaseMutex,
+ public FrameListenerInterfaceBase
+ {
+ public:
+ FrameListener (sfx2::sidebar::CommandInfoProvider& rInfoProvider, const Reference<frame::XFrame>& rxFrame)
+ : FrameListenerInterfaceBase(m_aMutex),
+ mrInfoProvider(rInfoProvider),
+ mxFrame(rxFrame)
+ {
+ if (mxFrame.is())
+ mxFrame->addEventListener(this);
+ }
+ virtual ~FrameListener (void)
+ {
+ }
+ virtual void SAL_CALL disposing (void)
+ {
+ if (mxFrame.is())
+ mxFrame->removeEventListener(this);
+ }
+ virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent)
+ throw (cssu::RuntimeException)
+ {
+ (void)rEvent;
+ mrInfoProvider.SetFrame(NULL);
+ mxFrame = NULL;
+ }
+
+ private:
+ sfx2::sidebar::CommandInfoProvider& mrInfoProvider;
+ Reference<frame::XFrame> mxFrame;
+ };
+}
+
+
+
+namespace sfx2 { namespace sidebar {
+
+CommandInfoProvider& CommandInfoProvider::Instance (void)
+{
+ static CommandInfoProvider aProvider;
+ return aProvider;
+}
+
+
+
+
+CommandInfoProvider::CommandInfoProvider (void)
+ : mxServiceFactory(comphelper::getProcessServiceFactory()),
+ mxCachedDataFrame(),
+ mxCachedDocumentAcceleratorConfiguration(),
+ mxCachedModuleAcceleratorConfiguration(),
+ mxCachedGlobalAcceleratorConfiguration(),
+ msCachedModuleIdentifier(),
+ mxFrameListener()
+{
+}
+
+
+
+
+CommandInfoProvider::~CommandInfoProvider (void)
+{
+ if (mxFrameListener.is())
+ {
+ mxFrameListener->dispose();
+ mxFrameListener = NULL;
+ }
+}
+
+
+
+
+OUString CommandInfoProvider::GetLabelForCommand (
+ const OUString& rsCommandName,
+ const Reference<frame::XFrame>& rxFrame)
+{
+ SetFrame(rxFrame);
+
+ const OUString sLabel (GetCommandLabel(rsCommandName));
+ const OUString sShortCut (GetCommandShortcut(rsCommandName));
+ if (sShortCut.getLength() > 0)
+ return sLabel + A2S(" (") + sShortCut + A2S(")");
+ else
+ return sLabel;
+}
+
+
+
+
+void CommandInfoProvider::SetFrame (const Reference<frame::XFrame>& rxFrame)
+{
+ if (rxFrame != mxCachedDataFrame)
+ {
+ // Detach from the old frame.
+ if (mxFrameListener.is())
+ {
+ mxFrameListener->dispose();
+ mxFrameListener = NULL;
+ }
+
+ // Release objects that are tied to the old frame.
+ mxCachedDocumentAcceleratorConfiguration = NULL;
+ mxCachedModuleAcceleratorConfiguration = NULL;
+ msCachedModuleIdentifier = OUString();
+ mxCachedDataFrame = rxFrame;
+
+ // Connect to the new frame.
+ if (rxFrame.is())
+ mxFrameListener = new FrameListener(*this, rxFrame);
+ }
+}
+
+
+
+
+Reference<ui::XAcceleratorConfiguration> CommandInfoProvider::GetDocumentAcceleratorConfiguration (void)
+{
+ if ( ! mxCachedDocumentAcceleratorConfiguration.is())
+ {
+ // Get the accelerator configuration for the document.
+ if (mxCachedDataFrame.is())
+ {
+ Reference<frame::XController> xController = mxCachedDataFrame->getController();
+ if (xController.is())
+ {
+ Reference<frame::XModel> xModel (xController->getModel());
+ if (xModel.is())
+ {
+ Reference<ui::XUIConfigurationManagerSupplier> xSupplier (xModel, UNO_QUERY);
+ if (xSupplier.is())
+ {
+ Reference<ui::XUIConfigurationManager> xConfigurationManager(
+ xSupplier->getUIConfigurationManager(),
+ UNO_QUERY);
+ if (xConfigurationManager.is())
+ {
+ mxCachedDocumentAcceleratorConfiguration = Reference<ui::XAcceleratorConfiguration>(
+ xConfigurationManager->getShortCutManager(),
+ UNO_QUERY);
+ }
+ }
+ }
+ }
+ }
+ }
+ return mxCachedDocumentAcceleratorConfiguration;
+}
+
+
+
+
+Reference<ui::XAcceleratorConfiguration> CommandInfoProvider::GetModuleAcceleratorConfiguration (void)
+{
+ if ( ! mxCachedModuleAcceleratorConfiguration.is())
+ {
+ try
+ {
+ Reference<ui::XModuleUIConfigurationManagerSupplier> xSupplier (
+ mxServiceFactory->createInstance(A2S("com.sun.star.ui.ModuleUIConfigurationManagerSupplier")),
+ UNO_QUERY);
+ Reference<ui::XUIConfigurationManager> xManager (
+ xSupplier->getUIConfigurationManager(GetModuleIdentifier()));
+ if (xManager.is())
+ {
+ mxCachedModuleAcceleratorConfiguration = Reference<ui::XAcceleratorConfiguration>(
+ xManager->getShortCutManager(),
+ UNO_QUERY);
+ }
+ }
+ catch (Exception&)
+ {
+ }
+ }
+ return mxCachedModuleAcceleratorConfiguration;
+}
+
+
+
+
+Reference<ui::XAcceleratorConfiguration> CommandInfoProvider::GetGlobalAcceleratorConfiguration (void)
+{
+ // Get the global accelerator configuration.
+ if ( ! mxCachedGlobalAcceleratorConfiguration.is())
+ {
+ mxCachedGlobalAcceleratorConfiguration = Reference<ui::XAcceleratorConfiguration>(
+ mxServiceFactory->createInstance(A2S("com.sun.star.ui.GlobalAcceleratorConfiguration")),
+ UNO_QUERY);
+ }
+
+ return mxCachedGlobalAcceleratorConfiguration;
+}
+
+
+
+
+OUString CommandInfoProvider::GetModuleIdentifier (void)
+{
+ if (msCachedModuleIdentifier.getLength() == 0)
+ {
+ Reference<frame::XModuleManager> xModuleManager (
+ mxServiceFactory->createInstance(A2S("com.sun.star.frame.ModuleManager")),
+ UNO_QUERY);
+ if (xModuleManager.is())
+ msCachedModuleIdentifier = xModuleManager->identify(mxCachedDataFrame);
+ }
+ return msCachedModuleIdentifier;
+}
+
+
+
+
+OUString CommandInfoProvider::GetCommandShortcut (const OUString& rsCommandName)
+{
+ OUString sShortcut;
+
+ sShortcut = RetrieveShortcutsFromConfiguration(GetDocumentAcceleratorConfiguration(), rsCommandName);
+ if (sShortcut.getLength() > 0)
+ return sShortcut;
+
+ sShortcut = RetrieveShortcutsFromConfiguration(GetModuleAcceleratorConfiguration(), rsCommandName);
+ if (sShortcut.getLength() > 0)
+ return sShortcut;
+
+ sShortcut = RetrieveShortcutsFromConfiguration(GetGlobalAcceleratorConfiguration(), rsCommandName);
+ if (sShortcut.getLength() > 0)
+ return sShortcut;
+
+ return OUString();
+}
+
+
+
+
+OUString CommandInfoProvider::RetrieveShortcutsFromConfiguration(
+ const Reference<ui::XAcceleratorConfiguration>& rxConfiguration,
+ const OUString& rsCommandName)
+{
+ if (rxConfiguration.is())
+ {
+ try
+ {
+ Sequence<OUString> aCommands(1);
+ aCommands[0] = rsCommandName;
+
+ Sequence<Any> aKeyCodes (rxConfiguration->getPreferredKeyEventsForCommandList(aCommands));
+ if (aCommands.getLength() == 1)
+ {
+ css::awt::KeyEvent aKeyEvent;
+ if (aKeyCodes[0] >>= aKeyEvent)
+ {
+ return svt::AcceleratorExecute::st_AWTKey2VCLKey(aKeyEvent).GetName();
+ }
+ }
+ }
+ catch (lang::IllegalArgumentException&)
+ {
+ }
+ }
+ return OUString();
+}
+
+
+
+
+Sequence<beans::PropertyValue> CommandInfoProvider::GetCommandProperties (const OUString& rsCommandName)
+{
+ Sequence<beans::PropertyValue> aProperties;
+
+ try
+ {
+ const OUString sModuleIdentifier (GetModuleIdentifier());
+ if (sModuleIdentifier.getLength() > 0)
+ {
+ Reference<container::XNameAccess> xNameAccess (
+ mxServiceFactory->createInstance(
+ OUString::createFromAscii("com.sun.star.frame.UICommandDescription")),
+ UNO_QUERY);
+ Reference<container::XNameAccess> xUICommandLabels;
+ if (xNameAccess.is())
+ if (xNameAccess->getByName(sModuleIdentifier) >>= xUICommandLabels)
+ xUICommandLabels->getByName(rsCommandName) >>= aProperties;
+ }
+ }
+ catch (Exception&)
+ {
+ }
+
+ return aProperties;
+}
+
+
+
+
+OUString CommandInfoProvider::GetCommandLabel (const OUString& rsCommandName)
+{
+ const Sequence<beans::PropertyValue> aProperties (GetCommandProperties(rsCommandName));
+ for (sal_Int32 nIndex=0; nIndex<aProperties.getLength(); ++nIndex)
+ {
+ if (aProperties[nIndex].Name.equalsAscii("Name"))
+ {
+ OUString sLabel;
+ aProperties[nIndex].Value >>= sLabel;
+ return sLabel;
+ }
+ }
+ return OUString();
+}
+
+
+} } // end of namespace sfx2/framework
diff --git a/sfx2/source/sidebar/CommandInfoProvider.hxx b/sfx2/source/sidebar/CommandInfoProvider.hxx
new file mode 100644
index 000000000000..8278111858d2
--- /dev/null
+++ b/sfx2/source/sidebar/CommandInfoProvider.hxx
@@ -0,0 +1,92 @@
+/*
+ * 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 SIDEBAR_COMMAND_INFO_PROVIDER_HXX
+#define SIDEBAR_COMMAND_INFO_PROVIDER_HXX
+
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/ui/XAcceleratorConfiguration.hpp>
+
+
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+
+namespace sfx2 { namespace sidebar {
+
+/** Provide information about UNO commands like tooltip text with
+ keyboard accelerator.
+*/
+class CommandInfoProvider
+{
+public:
+ /** Return the singleton instance.
+
+ It caches some objects for the last XFrame object given to
+ GetLabelForCommand. These objects are release and created new
+ when that method is called with a different XFrame from the
+ last call.
+
+ Lifetime control should work but could be more elegant.
+ */
+ static CommandInfoProvider& Instance (void);
+
+ /** Return a label for the given command.
+ @param rsCommandName
+ The command name is expected to start with .uno:
+ @param rxFrame
+ The frame is used to identify the module and document.
+ @return
+ The returned label contains the keyboard accelerator, if
+ one is defined.
+ */
+ ::rtl::OUString GetLabelForCommand (
+ const ::rtl::OUString& rsCommandName,
+ const cssu::Reference<css::frame::XFrame>& rxFrame);
+
+ /** Do not call. Should be part of a local and hidden interface.
+ */
+ void SetFrame (const cssu::Reference<css::frame::XFrame>& rxFrame);
+
+ private:
+ cssu::Reference<css::lang::XMultiServiceFactory> mxServiceFactory;
+ cssu::Reference<css::frame::XFrame> mxCachedDataFrame;
+ cssu::Reference<css::ui::XAcceleratorConfiguration> mxCachedDocumentAcceleratorConfiguration;
+ cssu::Reference<css::ui::XAcceleratorConfiguration> mxCachedModuleAcceleratorConfiguration;
+ cssu::Reference<css::ui::XAcceleratorConfiguration> mxCachedGlobalAcceleratorConfiguration;
+ ::rtl::OUString msCachedModuleIdentifier;
+ cssu::Reference<css::lang::XComponent> mxFrameListener;
+
+ CommandInfoProvider (void);
+ ~CommandInfoProvider (void);
+
+ cssu::Reference<css::ui::XAcceleratorConfiguration> GetDocumentAcceleratorConfiguration (void);
+ cssu::Reference<css::ui::XAcceleratorConfiguration> GetModuleAcceleratorConfiguration (void);
+ cssu::Reference<css::ui::XAcceleratorConfiguration> GetGlobalAcceleratorConfiguration(void);
+ ::rtl::OUString GetModuleIdentifier (void);
+ ::rtl::OUString GetCommandShortcut (const ::rtl::OUString& rCommandName);
+ cssu::Sequence<css::beans::PropertyValue> GetCommandProperties (
+ const ::rtl::OUString& rsCommandName);
+ ::rtl::OUString GetCommandLabel (const ::rtl::OUString& rsCommandName);
+ rtl::OUString RetrieveShortcutsFromConfiguration(
+ const cssu::Reference<css::ui::XAcceleratorConfiguration>& rxConfiguration,
+ const rtl::OUString& rsCommandName);
+};
+
+} } // end of namespace sfx2/framework
+
+#endif
diff --git a/sfx2/source/sidebar/ControllerItem.cxx b/sfx2/source/sidebar/ControllerItem.cxx
index e00241250227..979dd8a3547b 100644
--- a/sfx2/source/sidebar/ControllerItem.cxx
+++ b/sfx2/source/sidebar/ControllerItem.cxx
@@ -17,14 +17,102 @@
*/
#include "sidebar/ControllerItem.hxx"
+#include <sfx2/msgpool.hxx>
+#include <sfx2/viewsh.hxx>
+#include "sfx2/imagemgr.hxx"
+#include "sfx2/bindings.hxx"
+#include <unotools/cmdoptions.hxx>
+#include "CommandInfoProvider.hxx"
+#include <vcl/svapp.hxx>
+#include <vcl/toolbox.hxx>
+
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XFrameActionListener.hpp>
+
+
+using namespace css;
+using namespace cssu;
+
+
+#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
+
+namespace
+{
+ typedef ::cppu::WeakComponentImplHelper1 <
+ css::frame::XFrameActionListener
+ > FrameActionListenerInterfaceBase;
+
+ class FrameActionListener
+ : public ::cppu::BaseMutex,
+ public FrameActionListenerInterfaceBase
+ {
+ public:
+ FrameActionListener (
+ sfx2::sidebar::ControllerItem& rControllerItem,
+ const Reference<frame::XFrame>& rxFrame)
+ : FrameActionListenerInterfaceBase(m_aMutex),
+ mrControllerItem(rControllerItem),
+ mxFrame(rxFrame)
+ {
+ if (mxFrame.is())
+ mxFrame->addFrameActionListener(this);
+ }
+ virtual ~FrameActionListener (void)
+ {
+ }
+ virtual void SAL_CALL disposing (void)
+ {
+ if (mxFrame.is())
+ mxFrame->removeFrameActionListener(this);
+ }
+ virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent)
+ throw (cssu::RuntimeException)
+ {
+ (void)rEvent;
+ mrControllerItem.ResetFrame();
+ mxFrame = NULL;
+ }
+ virtual void SAL_CALL frameAction (const css::frame::FrameActionEvent& rEvent)
+ throw (cssu::RuntimeException)
+ {
+ if (rEvent.Action == frame::FrameAction_CONTEXT_CHANGED)
+ mrControllerItem.NotifyFrameContextChange();
+ }
+
+ private:
+ sfx2::sidebar::ControllerItem& mrControllerItem;
+ Reference<frame::XFrame> mxFrame;
+ };
+}
+
namespace sfx2 { namespace sidebar {
ControllerItem::ControllerItem (
- const sal_uInt16 nInId,
+ const sal_uInt16 nSlotId,
SfxBindings &rBindings,
ItemUpdateReceiverInterface& rItemUpdateReceiver)
- : SfxControllerItem(nInId, rBindings),
- mrItemUpdateReceiver(rItemUpdateReceiver)
+ : SfxControllerItem(nSlotId, rBindings),
+ mrItemUpdateReceiver(rItemUpdateReceiver),
+ mxFrame(),
+ mxFrameActionListener(),
+ msCommandName()
+{
+}
+
+
+
+
+ControllerItem::ControllerItem (
+ const sal_uInt16 nSlotId,
+ SfxBindings &rBindings,
+ ItemUpdateReceiverInterface& rItemUpdateReceiver,
+ const ::rtl::OUString& rsCommandName,
+ const Reference<frame::XFrame>& rxFrame)
+ : SfxControllerItem(nSlotId, rBindings),
+ mrItemUpdateReceiver(rItemUpdateReceiver),
+ mxFrame(rxFrame),
+ mxFrameActionListener(new FrameActionListener(*this, mxFrame)),
+ msCommandName(rsCommandName)
{
}
@@ -33,6 +121,8 @@ ControllerItem::ControllerItem (
ControllerItem::~ControllerItem (void)
{
+ if (mxFrameActionListener.is())
+ mxFrameActionListener->dispose();
}
@@ -43,12 +133,91 @@ void ControllerItem::StateChanged (
SfxItemState eState,
const SfxPoolItem* pState)
{
- mrItemUpdateReceiver.NotifyItemUpdate(nSID, eState, pState);
+ mrItemUpdateReceiver.NotifyItemUpdate(nSID, eState, pState, IsEnabled());
+}
+
+
+
+
+bool ControllerItem::IsEnabled (void) const
+{
+ if ( ! SvtCommandOptions().HasEntries(SvtCommandOptions::CMDOPTION_DISABLED))
+ {
+ // There are no disabled commands.
+ return true;
+ }
+ else if (msCommandName.getLength() == 0)
+ {
+ // We were not given a command name at construction and can
+ // not check the state now. Assume the best and return true.
+ return true;
+ }
+ else if (SvtCommandOptions().Lookup(SvtCommandOptions::CMDOPTION_DISABLED, msCommandName))
+ {
+ // The command is part of a list of disabled commands.
+ return false;
+ }
+ else
+ return true;
+}
+
+
+
+
+void ControllerItem::RequestUpdate (void)
+{
+ SfxPoolItem* pState = NULL;
+ const SfxItemState eState (GetBindings().QueryState(GetId(), pState));
+ mrItemUpdateReceiver.NotifyItemUpdate(GetId(), eState, pState, IsEnabled());
}
+
+
+
+void ControllerItem::NotifyFrameContextChange (void)
+{
+ RequestUpdate();
+}
+
+
+
+
+void ControllerItem::ResetFrame (void)
+{
+ mxFrame = NULL;
+}
+
+
+
+
+::rtl::OUString ControllerItem::GetLabel (void) const
+{
+ return CommandInfoProvider::Instance().GetLabelForCommand(
+ A2S(".uno:")+msCommandName,
+ mxFrame);
+}
+
+
+
+
+Image ControllerItem::GetIcon (void) const
+{
+ return GetImage(mxFrame, A2S(".uno:")+msCommandName, sal_False);
+}
+
+
+
+
ControllerItem::ItemUpdateReceiverInterface::~ItemUpdateReceiverInterface()
{
}
+void ControllerItem::SetupToolBoxItem (ToolBox& rToolBox, const sal_uInt16 nIndex)
+{
+ rToolBox.SetQuickHelpText(nIndex, GetLabel());
+ rToolBox.SetItemImage(nIndex, GetIcon());
+}
+
+
} } // end of namespace sfx2::sidebar
diff --git a/sfx2/source/sidebar/SidebarChildWindow.cxx b/sfx2/source/sidebar/SidebarChildWindow.cxx
index 2fdf0a23d865..f02b37c54b40 100644
--- a/sfx2/source/sidebar/SidebarChildWindow.cxx
+++ b/sfx2/source/sidebar/SidebarChildWindow.cxx
@@ -30,23 +30,25 @@ SFX_IMPL_DOCKINGWINDOW_WITHID(SidebarChildWindow, SID_SIDEBAR);
SidebarChildWindow::SidebarChildWindow (
- Window* pSidebarParent,
+ Window* pParentWindow,
sal_uInt16 nId,
SfxBindings* pBindings,
- SfxChildWinInfo* pInfo )
- : SfxChildWindow(pSidebarParent, nId)
+ SfxChildWinInfo* pInfo)
+ : SfxChildWindow(pParentWindow, nId)
{
this->pWindow = new SidebarDockingWindow(
pBindings,
*this,
- pSidebarParent,
+ pParentWindow,
WB_STDDOCKWIN | WB_OWNERDRAWDECORATION | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK | WB_ROLLABLE);
eChildAlignment = SFX_ALIGN_RIGHT;
this->pWindow->SetHelpId(HID_SIDEBAR_WINDOW);
this->pWindow->SetOutputSizePixel(Size(300, 450));
- dynamic_cast<SfxDockingWindow*>(pWindow)->Initialize(pInfo);
+ SfxDockingWindow* pDockingParent = dynamic_cast<SfxDockingWindow*>(pParentWindow);
+ if (pDockingParent != NULL)
+ pDockingParent->Initialize(pInfo);
SetHideNotDelete(sal_True);
this->pWindow->Show();