diff options
-rw-r--r-- | chart2/AllLangResTarget_chartcontroller.mk | 2 | ||||
-rw-r--r-- | chart2/UIConfig_chart2.mk | 5 | ||||
-rw-r--r-- | chart2/source/controller/inc/MenuResIds.hrc | 31 | ||||
-rw-r--r-- | chart2/source/controller/main/ChartController_Window.cxx | 57 | ||||
-rw-r--r-- | chart2/source/controller/menus/ShapeContextMenu.src | 117 | ||||
-rw-r--r-- | chart2/source/controller/menus/ShapeEditContextMenu.src | 58 | ||||
-rw-r--r-- | chart2/uiconfig/popupmenu/draw.xml | 31 | ||||
-rw-r--r-- | chart2/uiconfig/popupmenu/drawtext.xml | 17 | ||||
-rw-r--r-- | include/svtools/contextmenuhelper.hxx | 3 | ||||
-rw-r--r-- | officecfg/registry/data/org/openoffice/Office/UI/ChartWindowState.xcu | 10 | ||||
-rw-r--r-- | svtools/source/uno/contextmenuhelper.cxx | 13 |
11 files changed, 99 insertions, 245 deletions
diff --git a/chart2/AllLangResTarget_chartcontroller.mk b/chart2/AllLangResTarget_chartcontroller.mk index c80d68b54868..61d2f6257ba7 100644 --- a/chart2/AllLangResTarget_chartcontroller.mk +++ b/chart2/AllLangResTarget_chartcontroller.mk @@ -35,8 +35,6 @@ $(eval $(call gb_SrsTarget_add_files,chart2/res,\ $(eval $(call gb_SrsTarget_add_nonlocalizable_files,chart2/res,\ chart2/source/controller/dialogs/Bitmaps.src \ - chart2/source/controller/menus/ShapeContextMenu.src \ - chart2/source/controller/menus/ShapeEditContextMenu.src \ )) # vim: set noet sw=4 ts=4: diff --git a/chart2/UIConfig_chart2.mk b/chart2/UIConfig_chart2.mk index 1ddb6daf191f..59847fedc348 100644 --- a/chart2/UIConfig_chart2.mk +++ b/chart2/UIConfig_chart2.mk @@ -13,6 +13,11 @@ $(eval $(call gb_UIConfig_add_menubarfiles,modules/schart,\ chart2/uiconfig/menubar/menubar \ )) +$(eval $(call gb_UIConfig_add_popupmenufiles,modules/schart,\ + chart2/uiconfig/popupmenu/draw \ + chart2/uiconfig/popupmenu/drawtext \ +)) + $(eval $(call gb_UIConfig_add_statusbarfiles,modules/schart,\ chart2/uiconfig/statusbar/statusbar \ )) diff --git a/chart2/source/controller/inc/MenuResIds.hrc b/chart2/source/controller/inc/MenuResIds.hrc deleted file mode 100644 index ffb7af607117..000000000000 --- a/chart2/source/controller/inc/MenuResIds.hrc +++ /dev/null @@ -1,31 +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 CHART_MENURESIDS_HRC -#define CHART_MENURESIDS_HRC - -#include <svl/solar.hrc> - -// context menus - -#define RID_CONTEXTMENU_SHAPE (RID_APP_START + 1) -#define RID_CONTEXTMENU_SHAPEEDIT (RID_APP_START + 2) - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index eb438f85a585..4a9c18ea3c95 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -44,18 +44,20 @@ #include "AxisHelper.hxx" #include "LegendHelper.hxx" #include "servicenames_charttypes.hxx" -#include "MenuResIds.hrc" #include "DrawCommandDispatch.hxx" #include <com/sun/star/chart2/RelativePosition.hpp> #include <com/sun/star/chart2/RelativeSize.hpp> #include <com/sun/star/chart2/XRegressionCurveContainer.hpp> +#include <com/sun/star/awt/PopupMenuDirection.hpp> #include <com/sun/star/frame/DispatchHelper.hpp> #include <com/sun/star/frame/FrameSearchFlag.hpp> +#include <com/sun/star/frame/XPopupMenuController.hpp> #include <com/sun/star/util/XUpdatable.hpp> #include <comphelper/InlineContainer.hxx> #include <comphelper/propertysequence.hxx> +#include <comphelper/propertyvalue.hxx> #include <svtools/contextmenuhelper.hxx> #include <toolkit/awt/vclxmenu.hxx> @@ -950,27 +952,45 @@ void ChartController::execute_Command( const CommandEvent& rCEvt ) if( m_aSelection.isSelectionDifferentFromBeforeMouseDown() ) impl_notifySelectionChangeListeners(); + css::uno::Reference< css::awt::XPopupMenu > xPopupMenu( m_xCC->getServiceManager()->createInstanceWithContext( + "com.sun.star.awt.PopupMenu", m_xCC ), css::uno::UNO_QUERY ); + + Point aPos( rCEvt.GetMousePosPixel() ); + if( !rCEvt.IsMouseEvent() ) + { + SolarMutexGuard aGuard; + if(m_pChartWindow) + aPos = m_pChartWindow->GetPointerState().maPos; + } + if ( isShapeContext() ) { // #i12587# support for shapes in chart - PopupMenu aContextMenu( SchResId( m_pDrawViewWrapper->IsTextEdit() ? - RID_CONTEXTMENU_SHAPEEDIT : RID_CONTEXTMENU_SHAPE ) ); - ::svt::ContextMenuHelper aContextMenuHelper( m_xFrame ); - Point aPos( rCEvt.GetMousePosPixel() ); - if( !rCEvt.IsMouseEvent() ) - { - SolarMutexGuard aGuard; - if(m_pChartWindow) - aPos = m_pChartWindow->GetPointerState().maPos; - } - aContextMenuHelper.completeAndExecute( aPos, aContextMenu ); + OUString aMenuName = m_pDrawViewWrapper->IsTextEdit() ? OUString( "drawtext" ) : OUString( "draw" ); + css::uno::Sequence< css::uno::Any > aArgs( 3 ); + aArgs[0] <<= comphelper::makePropertyValue( "Value", aMenuName ); + aArgs[1] <<= comphelper::makePropertyValue( "Frame", m_xFrame ); + aArgs[2] <<= comphelper::makePropertyValue( "IsContextMenu", true ); + + css::uno::Reference< css::frame::XPopupMenuController > xPopupController( + m_xCC->getServiceManager()->createInstanceWithArgumentsAndContext( + "com.sun.star.comp.framework.ResourceMenuController", aArgs, m_xCC ), css::uno::UNO_QUERY ); + + if ( !xPopupController.is() || !xPopupMenu.is() ) + return; + + xPopupController->setPopupMenu( xPopupMenu ); + xPopupMenu->execute( css::uno::Reference< css::awt::XWindowPeer >( m_xFrame->getContainerWindow(), css::uno::UNO_QUERY ), + css::awt::Rectangle( aPos.X(), aPos.Y(), 0, 0 ), + css::awt::PopupMenuDirection::EXECUTE_DEFAULT ); + + css::uno::Reference< css::lang::XComponent > xComponent( xPopupController, css::uno::UNO_QUERY ); + if ( xComponent.is() ) + xComponent->dispose(); } else { // todo: the context menu should be specified by an xml file in uiconfig - uno::Reference< awt::XPopupMenu > xPopupMenu( - m_xCC->getServiceManager()->createInstanceWithContext( - "com.sun.star.awt.PopupMenu", m_xCC ), uno::UNO_QUERY ); if( xPopupMenu.is()) { sal_Int16 nUniqueId = 1; @@ -1218,13 +1238,6 @@ void ChartController::execute_Command( const CommandEvent& rCEvt ) lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:Paste" ); ::svt::ContextMenuHelper aContextMenuHelper( m_xFrame ); - Point aPos( rCEvt.GetMousePosPixel() ); - if( !rCEvt.IsMouseEvent() ) - { - SolarMutexGuard aGuard; - if(m_pChartWindow) - aPos = m_pChartWindow->GetPointerState().maPos; - } aContextMenuHelper.completeAndExecute( aPos, xPopupMenu ); } } diff --git a/chart2/source/controller/menus/ShapeContextMenu.src b/chart2/source/controller/menus/ShapeContextMenu.src deleted file mode 100644 index de00637356e9..000000000000 --- a/chart2/source/controller/menus/ShapeContextMenu.src +++ /dev/null @@ -1,117 +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 "MenuResIds.hrc" -#include "ShapeController.hrc" - -Menu RID_CONTEXTMENU_SHAPE -{ - ItemList = - { - MenuItem - { - Identifier = COMMAND_ID_FORMAT_LINE; - Command = ".uno:FormatLine"; - }; - MenuItem - { - Identifier = COMMAND_ID_FORMAT_AREA; - Command = ".uno:FormatArea"; - }; - MenuItem - { - Identifier = COMMAND_ID_TEXT_ATTRIBUTES; - Command = ".uno:TextAttributes"; - }; - MenuItem - { - Identifier = COMMAND_ID_TRANSFORM_DIALOG; - Command = ".uno:TransformDialog"; - }; - MenuItem - { - Separator = TRUE; - }; - MenuItem - { - Identifier = COMMAND_ID_OBJECT_TITLE_DESCRIPTION; - Command = ".uno:ObjectTitleDescription"; - }; - MenuItem - { - Identifier = COMMAND_ID_RENAME_OBJECT; - Command = ".uno:RenameObject"; - }; - MenuItem - { - Separator = TRUE; - }; - MenuItem - { - Identifier = COMMAND_ID_ARRANGE_ROW; - Command = ".uno:ArrangeRow"; - SubMenu = Menu - { - ItemList = - { - MenuItem - { - Identifier = COMMAND_ID_BRING_TO_FRONT; - Command = ".uno:BringToFront"; - }; - MenuItem - { - Identifier = COMMAND_ID_FORWARD; - Command = ".uno:Forward"; - }; - MenuItem - { - Identifier = COMMAND_ID_BACKWARD; - Command = ".uno:Backward"; - }; - MenuItem - { - Identifier = COMMAND_ID_SEND_TO_BACK; - Command = ".uno:SendToBack"; - }; - }; - }; - }; - MenuItem - { - Separator = TRUE; - }; - MenuItem - { - Identifier = COMMAND_ID_CUT; - Command = ".uno:Cut"; - }; - MenuItem - { - Identifier = COMMAND_ID_COPY; - Command = ".uno:Copy"; - }; - MenuItem - { - Identifier = COMMAND_ID_PASTE; - Command = ".uno:Paste"; - }; - }; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/menus/ShapeEditContextMenu.src b/chart2/source/controller/menus/ShapeEditContextMenu.src deleted file mode 100644 index 8e22df4f9fde..000000000000 --- a/chart2/source/controller/menus/ShapeEditContextMenu.src +++ /dev/null @@ -1,58 +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 "MenuResIds.hrc" -#include "ShapeController.hrc" - -Menu RID_CONTEXTMENU_SHAPEEDIT -{ - ItemList = - { - MenuItem - { - Identifier = COMMAND_ID_FONT_DIALOG; - Command = ".uno:FontDialog"; - }; - MenuItem - { - Identifier = COMMAND_ID_PARAGRAPH_DIALOG; - Command = ".uno:ParagraphDialog"; - }; - MenuItem - { - Separator = TRUE; - }; - MenuItem - { - Identifier = COMMAND_ID_CUT; - Command = ".uno:Cut"; - }; - MenuItem - { - Identifier = COMMAND_ID_COPY; - Command = ".uno:Copy"; - }; - MenuItem - { - Identifier = COMMAND_ID_PASTE; - Command = ".uno:Paste"; - }; - }; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/uiconfig/popupmenu/draw.xml b/chart2/uiconfig/popupmenu/draw.xml new file mode 100644 index 000000000000..195b54e9f73c --- /dev/null +++ b/chart2/uiconfig/popupmenu/draw.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * +--> +<menu:menupopup xmlns:menu="http://openoffice.org/2001/menu"> + <menu:menuitem menu:id=".uno:Cut"/> + <menu:menuitem menu:id=".uno:Copy"/> + <menu:menuitem menu:id=".uno:Paste"/> + <menu:menuseparator/> + <menu:menuitem menu:id=".uno:FormatLine"/> + <menu:menuitem menu:id=".uno:FormatArea"/> + <menu:menuitem menu:id=".uno:TextAttributes"/> + <menu:menuitem menu:id=".uno:TransformDialog"/> + <menu:menuseparator/> + <menu:menuitem menu:id=".uno:ObjectTitleDescription"/> + <menu:menuitem menu:id=".uno:RenameObject"/> + <menu:menuseparator/> + <menu:menu menu:id=".uno:ArrangeRow"> + <menu:menupopup> + <menu:menuitem menu:id=".uno:BringToFront"/> + <menu:menuitem menu:id=".uno:Forward"/> + <menu:menuitem menu:id=".uno:Backward"/> + <menu:menuitem menu:id=".uno:SendToBack"/> + </menu:menupopup> + </menu:menu> +</menu:menupopup> diff --git a/chart2/uiconfig/popupmenu/drawtext.xml b/chart2/uiconfig/popupmenu/drawtext.xml new file mode 100644 index 000000000000..a2c727cf1b65 --- /dev/null +++ b/chart2/uiconfig/popupmenu/drawtext.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * +--> +<menu:menupopup xmlns:menu="http://openoffice.org/2001/menu"> + <menu:menuitem menu:id=".uno:Cut"/> + <menu:menuitem menu:id=".uno:Copy"/> + <menu:menuitem menu:id=".uno:Paste"/> + <menu:menuseparator/> + <menu:menuitem menu:id=".uno:FontDialog"/> + <menu:menuitem menu:id=".uno:ParagraphDialog"/> +</menu:menupopup> diff --git a/include/svtools/contextmenuhelper.hxx b/include/svtools/contextmenuhelper.hxx index b200691de223..4a7b55fa66f5 100644 --- a/include/svtools/contextmenuhelper.hxx +++ b/include/svtools/contextmenuhelper.hxx @@ -55,9 +55,8 @@ class SVT_DLLPUBLIC ContextMenuHelper ContextMenuHelper( const css::uno::Reference< css::frame::XFrame >& xFrame ); ~ContextMenuHelper(); - // methods to complete a popup menu (set images, labels, enable/disable states) + // method to complete a popup menu (set images, labels, enable/disable states) // ATTENTION: The item ID's must be unique for the whole popup (inclusive the sub menus!) - void completeAndExecute( const Point& aPos, PopupMenu& aPopupMenu ); void completeAndExecute( const Point& aPos, const css::uno::Reference< css::awt::XPopupMenu >& xPopupMenu ); private: diff --git a/officecfg/registry/data/org/openoffice/Office/UI/ChartWindowState.xcu b/officecfg/registry/data/org/openoffice/Office/UI/ChartWindowState.xcu index b84d0b13cc82..d010c1626913 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/ChartWindowState.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/ChartWindowState.xcu @@ -20,6 +20,16 @@ <oor:component-data xmlns:install="http://openoffice.org/2004/installation" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" oor:name="ChartWindowState" oor:package="org.openoffice.Office.UI"> <node oor:name="UIElements"> <node oor:name="States"> + <node oor:name="private:resource/popupmenu/draw" oor:op="replace"> + <prop oor:name="UIName" oor:type="xs:string"> + <value xml:lang="en-US">Shape</value> + </prop> + </node> + <node oor:name="private:resource/popupmenu/drawtext" oor:op="replace"> + <prop oor:name="UIName" oor:type="xs:string"> + <value xml:lang="en-US">Shape Text</value> + </prop> + </node> <node oor:name="private:resource/toolbar/standardbar" oor:op="replace"> <prop oor:name="Docked" oor:type="xs:boolean"> <value>true</value> diff --git a/svtools/source/uno/contextmenuhelper.cxx b/svtools/source/uno/contextmenuhelper.cxx index dac728362090..e661dd30d031 100644 --- a/svtools/source/uno/contextmenuhelper.cxx +++ b/svtools/source/uno/contextmenuhelper.cxx @@ -266,19 +266,6 @@ ContextMenuHelper::~ContextMenuHelper() void ContextMenuHelper::completeAndExecute( const Point& aPos, - PopupMenu& rPopupMenu ) -{ - SolarMutexGuard aSolarGuard; - - associateUIConfigurationManagers(); - completeMenuProperties( &rPopupMenu ); - executePopupMenu( aPos, &rPopupMenu ); - resetAssociations(); -} - -void -ContextMenuHelper::completeAndExecute( - const Point& aPos, const uno::Reference< awt::XPopupMenu >& xPopupMenu ) { SolarMutexGuard aSolarGuard; |