summaryrefslogtreecommitdiffstats
path: root/framework/source/uielement/popuptoolbarcontroller.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'framework/source/uielement/popuptoolbarcontroller.cxx')
-rw-r--r--framework/source/uielement/popuptoolbarcontroller.cxx30
1 files changed, 13 insertions, 17 deletions
diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxx
index 62ac260f6c77..b17e8a6bfc60 100644
--- a/framework/source/uielement/popuptoolbarcontroller.cxx
+++ b/framework/source/uielement/popuptoolbarcontroller.cxx
@@ -27,8 +27,9 @@
#include <svtools/toolboxcontroller.hxx>
#include <toolkit/awt/vclxmenu.hxx>
#include <toolkit/helper/vclunohelper.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <tools/urlobj.hxx>
+#include <utility>
#include <vcl/commandinfoprovider.hxx>
#include <vcl/menu.hxx>
#include <vcl/svapp.hxx>
@@ -70,7 +71,7 @@ public:
protected:
PopupMenuToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext,
- const OUString &rPopupCommand = OUString() );
+ OUString aPopupCommand = OUString() );
virtual void functionExecuted( const OUString &rCommand );
virtual ToolBoxItemBits getDropDownStyle() const;
void createPopupMenuController();
@@ -78,7 +79,7 @@ protected:
bool m_bHasController;
bool m_bResourceURL;
OUString m_aPopupCommand;
- css::uno::Reference< css::awt::XPopupMenu > m_xPopupMenu;
+ rtl::Reference< VCLXPopupMenu > m_xPopupMenu;
private:
css::uno::Reference< css::frame::XUIControllerFactory > m_xPopupMenuFactory;
@@ -87,11 +88,11 @@ private:
PopupMenuToolbarController::PopupMenuToolbarController(
const css::uno::Reference< css::uno::XComponentContext >& xContext,
- const OUString &rPopupCommand )
+ OUString aPopupCommand )
: ToolBarBase( xContext, css::uno::Reference< css::frame::XFrame >(), /*aCommandURL*/OUString() )
, m_bHasController( false )
, m_bResourceURL( false )
- , m_aPopupCommand( rPopupCommand )
+ , m_aPopupCommand(std::move( aPopupCommand ))
{
}
@@ -239,17 +240,14 @@ void PopupMenuToolbarController::createPopupMenuController()
else
{
css::uno::Sequence<css::uno::Any> aArgs {
- css::uno::makeAny(comphelper::makePropertyValue("Frame", m_xFrame)),
- css::uno::makeAny(comphelper::makePropertyValue("ModuleIdentifier", m_sModuleName)),
- css::uno::makeAny(comphelper::makePropertyValue("InToolbar", true))
+ css::uno::Any(comphelper::makePropertyValue("Frame", m_xFrame)),
+ css::uno::Any(comphelper::makePropertyValue("ModuleIdentifier", m_sModuleName)),
+ css::uno::Any(comphelper::makePropertyValue("InToolbar", true))
};
try
{
- m_xPopupMenu.set(
- m_xContext->getServiceManager()->createInstanceWithContext(
- "com.sun.star.awt.PopupMenu", m_xContext ),
- css::uno::UNO_QUERY_THROW );
+ m_xPopupMenu = new VCLXPopupMenu();
if (m_bResourceURL)
{
@@ -356,7 +354,7 @@ void GenericPopupToolbarController::statusChanged( const css::frame::FeatureStat
ToolBoxItemId nId;
if ( getToolboxId( nId, &pToolBox ) && pToolBox->IsItemEnabled( nId ) )
{
- Menu* pVclMenu = comphelper::getFromUnoTunnel<VCLXMenu>( m_xPopupMenu )->GetMenu();
+ Menu* pVclMenu = m_xPopupMenu->GetMenu();
pVclMenu->Activate();
pVclMenu->Deactivate();
}
@@ -696,8 +694,7 @@ void SAL_CALL NewToolbarController::execute( sal_Int16 /*KeyModifier*/ )
aURL = m_xPopupMenu->getCommand(m_nMenuId);
// TODO investigate how to wrap Get/SetUserValue in css::awt::XMenu
- VCLXMenu* pMenu = comphelper::getFromUnoTunnel<VCLXMenu>(m_xPopupMenu);
- MenuAttributes* pMenuAttributes(static_cast<MenuAttributes*>(pMenu->getUserValue(m_nMenuId)));
+ MenuAttributes* pMenuAttributes(static_cast<MenuAttributes*>(m_xPopupMenu->getUserValue(m_nMenuId)));
if ( pMenuAttributes )
aTarget = pMenuAttributes->aTargetFrame;
else
@@ -749,8 +746,7 @@ void SAL_CALL NewToolbarController::updateImage()
if ( m_xPopupMenu.is() && m_nMenuId )
{
aURL = m_xPopupMenu->getCommand(m_nMenuId);
- VCLXMenu* pMenu = comphelper::getFromUnoTunnel<VCLXMenu>(m_xPopupMenu);
- MenuAttributes* pMenuAttributes(static_cast<MenuAttributes*>(pMenu->getUserValue(m_nMenuId)));
+ MenuAttributes* pMenuAttributes(static_cast<MenuAttributes*>(m_xPopupMenu->getUserValue(m_nMenuId)));
if ( pMenuAttributes )
aImageId = pMenuAttributes->aImageId;
}