diff options
author | Ariel Constenla-Haile <arielch@apache.org> | 2012-12-23 11:29:21 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-06-23 21:16:14 +0100 |
commit | 9052caae53ef6ec7eeab20f1ac56bd6310b4451b (patch) | |
tree | e3fa07a8a4bee383d9d17ae7e75500fdf88ac2da | |
parent | 1a07be5dbcd6010cd5f9a4b71c2a7648974bd6ba (diff) |
Resolves: #i121542# Unify the Menu API
(cherry picked from commit 399946b82f5efec19cd82d1c320d5aa9295d235d)
Conflicts:
chart2/source/controller/main/ChartController_Window.cxx
framework/source/uielement/langselectionmenucontroller.cxx
framework/source/uielement/popupmenucontroller.cxx
framework/source/uielement/recentfilesmenucontroller.cxx
framework/source/uielement/toolbarsmenucontroller.cxx
odk/examples/DevelopersGuide/GUI/UnoMenu.java
odk/examples/DevelopersGuide/GUI/UnoMenu2.java
odk/examples/cpp/StatusbarController/SelectionModeStatusbarController/SelectionModeStatusbarController.cxx
offapi/com/sun/star/awt/MenuBar.idl
offapi/com/sun/star/awt/MenuEvent.idl
offapi/com/sun/star/awt/MenuItemStyle.idl
offapi/com/sun/star/awt/MenuItemType.idl
offapi/com/sun/star/awt/MenuLogo.idl
offapi/com/sun/star/awt/PopupMenu.idl
offapi/com/sun/star/awt/PopupMenuDirection.idl
offapi/com/sun/star/awt/XMenu.idl
offapi/com/sun/star/awt/XMenuBar.idl
offapi/com/sun/star/awt/XMenuBarExtended.idl
offapi/com/sun/star/awt/XMenuExtended.idl
offapi/com/sun/star/awt/XMenuExtended2.idl
offapi/com/sun/star/awt/XMenuListener.idl
offapi/com/sun/star/awt/XPopupMenu.idl
offapi/com/sun/star/awt/XPopupMenuExtended.idl
offapi/com/sun/star/awt/makefile.mk
offapi/type_reference/types.rdb
svtools/inc/svtools/popupmenucontrollerbase.hxx
svtools/source/uno/popupmenucontrollerbase.cxx
svx/source/tbxctrls/extrusioncontrols.cxx
toolkit/inc/pch/precompiled_toolkit.hxx
toolkit/inc/toolkit/awt/vclxmenu.hxx
toolkit/inc/toolkit/helper/listenermultiplexer.hxx
toolkit/source/awt/vclxmenu.cxx
Change-Id: I3d9a1e109b9ff35901a3075b44a4c27e7c12b5c7
Related: #i121542# css::awt::XPopupMenu::execute() needs a Rectangle
(cherry picked from commit c01a6f4f370b72f0751cf4f5c11310682e2b3248)
Conflicts:
odk/examples/DevelopersGuide/GUI/UnoMenu2.java
offapi/type_reference/types.rdb
toolkit/inc/toolkit/awt/vclxmenu.hxx
Change-Id: I2cccc95086fe3d1522d03346e3c577fb2f21f621
41 files changed, 884 insertions, 1336 deletions
diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index 0c748f13d7c5..c1483131086e 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -132,12 +132,11 @@ bool lcl_MoveObjectLogic( void lcl_insertMenuCommand( const uno::Reference< awt::XPopupMenu > & xMenu, - const uno::Reference< awt::XMenuExtended > & xMenuEx, sal_Int16 nId, const OUString & rCommand ) { static OUString aEmptyString; xMenu->insertItem( nId, aEmptyString, 0, -1 ); - xMenuEx->setCommand( nId, rCommand ); + xMenu->setCommand( nId, rCommand ); } OUString lcl_getFormatCommandForObjectCID( const OUString& rCID ) @@ -1034,15 +1033,14 @@ void ChartController::execute_Command( const CommandEvent& rCEvt ) uno::Reference< awt::XPopupMenu > xPopupMenu( m_xCC->getServiceManager()->createInstanceWithContext( "com.sun.star.awt.PopupMenu", m_xCC ), uno::UNO_QUERY ); - uno::Reference< awt::XMenuExtended > xMenuEx( xPopupMenu, uno::UNO_QUERY ); - if( xPopupMenu.is() && xMenuEx.is()) + if( xPopupMenu.is()) { sal_Int16 nUniqueId = 1; ObjectType eObjectType = ObjectIdentifier::getObjectType( m_aSelection.getSelectedCID() ); Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram( getModel() ); OUString aFormatCommand( lcl_getFormatCommandForObjectCID( m_aSelection.getSelectedCID() ) ); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, aFormatCommand ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, aFormatCommand ); //some commands for dataseries and points: //----- @@ -1094,17 +1092,17 @@ void ChartController::execute_Command( const CommandEvent& rCEvt ) if( bIsPoint ) { if( bHasDataLabelAtPoint ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:FormatDataLabel" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatDataLabel" ); if( !bHasDataLabelAtPoint ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:InsertDataLabel" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertDataLabel" ); else - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:DeleteDataLabel" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteDataLabel" ); if( bSelectedPointIsFormatted ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:ResetDataPoint" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:ResetDataPoint" ); xPopupMenu->insertSeparator( -1 ); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:FormatDataSeries" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatDataSeries" ); } Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeOfSeries( xDiagram, xSeries ) ); @@ -1120,8 +1118,8 @@ void ChartController::execute_Command( const CommandEvent& rCEvt ) if( bJapaneseStyle ) { - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:FormatStockLoss" ); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:FormatStockGain" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatStockLoss" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatStockGain" ); } } } @@ -1132,62 +1130,61 @@ void ChartController::execute_Command( const CommandEvent& rCEvt ) } if( bHasDataLabelsAtSeries ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:FormatDataLabels" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatDataLabels" ); if( xTrendline.is() ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:FormatTrendline" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatTrendline" ); if( bHasEquation ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:FormatTrendlineEquation" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatTrendlineEquation" ); if( xMeanValue.is() ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:FormatMeanValue" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatMeanValue" ); if( bHasXErrorBars ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:FormatXErrorBars" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatXErrorBars" ); if( bHasYErrorBars ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:FormatYErrorBars" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatYErrorBars" ); xPopupMenu->insertSeparator( -1 ); if( !bHasDataLabelsAtSeries ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:InsertDataLabels" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertDataLabels" ); if( !xTrendline.is() ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:InsertTrendline" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertTrendline" ); else if( !bHasEquation ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:InsertTrendlineEquation" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertTrendlineEquation" ); if( !xMeanValue.is() ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:InsertMeanValue" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertMeanValue" ); if( !bHasXErrorBars ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:InsertXErrorBars" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertXErrorBars" ); if( !bHasYErrorBars ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:InsertYErrorBars" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertYErrorBars" ); if( bHasDataLabelsAtSeries || ( bHasDataLabelsAtPoints && bHasFormattedDataPointsOtherThanSelected ) ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:DeleteDataLabels" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteDataLabels" ); if( xTrendline.is() ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:DeleteTrendline" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteTrendline" ); if( bHasEquation ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:DeleteTrendlineEquation" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteTrendlineEquation" ); if( xMeanValue.is() ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:DeleteMeanValue" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteMeanValue" ); if( bHasXErrorBars ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:DeleteXErrorBars" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteXErrorBars" ); if( bHasYErrorBars ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:DeleteYErrorBars" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteYErrorBars" ); if( bHasFormattedDataPointsOtherThanSelected ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:ResetAllDataPoints" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:ResetAllDataPoints" ); xPopupMenu->insertSeparator( -1 ); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId, ".uno:ArrangeRow" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId, ".uno:ArrangeRow" ); uno::Reference< awt::XPopupMenu > xArrangePopupMenu( m_xCC->getServiceManager()->createInstanceWithContext( "com.sun.star.awt.PopupMenu", m_xCC ), uno::UNO_QUERY ); - uno::Reference< awt::XMenuExtended > xArrangeMenuEx( xArrangePopupMenu, uno::UNO_QUERY ); - if( xArrangePopupMenu.is() && xArrangeMenuEx.is()) + if( xArrangePopupMenu.is() ) { sal_Int16 nSubId = nUniqueId + 1; - lcl_insertMenuCommand( xArrangePopupMenu, xArrangeMenuEx, nSubId++, ".uno:Forward" ); - lcl_insertMenuCommand( xArrangePopupMenu, xArrangeMenuEx, nSubId, ".uno:Backward" ); + lcl_insertMenuCommand( xArrangePopupMenu, nSubId++, ".uno:Forward" ); + lcl_insertMenuCommand( xArrangePopupMenu, nSubId, ".uno:Backward" ); xPopupMenu->setPopupMenu( nUniqueId, xArrangePopupMenu ); nUniqueId = nSubId; } @@ -1195,17 +1192,17 @@ void ChartController::execute_Command( const CommandEvent& rCEvt ) } else if( OBJECTTYPE_DATA_CURVE == eObjectType ) { - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:FormatTrendlineEquation" ); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:InsertTrendlineEquation" ); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:InsertTrendlineEquationAndR2" ); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:InsertR2Value" ); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:DeleteTrendlineEquation" ); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:DeleteR2Value" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatTrendlineEquation" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertTrendlineEquation" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertTrendlineEquationAndR2" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertR2Value" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteTrendlineEquation" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteR2Value" ); } else if( OBJECTTYPE_DATA_CURVE_EQUATION == eObjectType ) { - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:InsertR2Value" ); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:DeleteR2Value" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertR2Value" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteR2Value" ); } //some commands for axes: and grids @@ -1229,38 +1226,38 @@ void ChartController::execute_Command( const CommandEvent& rCEvt ) bHasTitle = !TitleHelper::getCompleteString( xTitled->getTitleObject() ).isEmpty(); if( OBJECTTYPE_AXIS != eObjectType && bIsAxisVisible ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:FormatAxis" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatAxis" ); if( OBJECTTYPE_GRID != eObjectType && bIsMajorGridVisible && !bIsSecondaryAxis ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:FormatMajorGrid" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatMajorGrid" ); if( OBJECTTYPE_SUBGRID != eObjectType && bIsMinorGridVisible && !bIsSecondaryAxis ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:FormatMinorGrid" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatMinorGrid" ); xPopupMenu->insertSeparator( -1 ); if( OBJECTTYPE_AXIS != eObjectType && !bIsAxisVisible ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:InsertAxis" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertAxis" ); if( OBJECTTYPE_GRID != eObjectType && !bIsMajorGridVisible && !bIsSecondaryAxis ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:InsertMajorGrid" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertMajorGrid" ); if( OBJECTTYPE_SUBGRID != eObjectType && !bIsMinorGridVisible && !bIsSecondaryAxis ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:InsertMinorGrid" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertMinorGrid" ); if( !bHasTitle ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:InsertAxisTitle" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertAxisTitle" ); if( bIsAxisVisible ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:DeleteAxis" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteAxis" ); if( bIsMajorGridVisible && !bIsSecondaryAxis ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:DeleteMajorGrid" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteMajorGrid" ); if( bIsMinorGridVisible && !bIsSecondaryAxis ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:DeleteMinorGrid" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteMinorGrid" ); } } if( OBJECTTYPE_DATA_STOCK_LOSS == eObjectType ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:FormatStockGain" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatStockGain" ); else if( OBJECTTYPE_DATA_STOCK_GAIN == eObjectType ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:FormatStockLoss" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatStockLoss" ); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:TransformDialog" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:TransformDialog" ); if( OBJECTTYPE_PAGE == eObjectType || OBJECTTYPE_DIAGRAM == eObjectType || OBJECTTYPE_DIAGRAM_WALL == eObjectType @@ -1270,24 +1267,24 @@ void ChartController::execute_Command( const CommandEvent& rCEvt ) if( OBJECTTYPE_UNKNOWN != eObjectType ) xPopupMenu->insertSeparator( -1 ); bool bHasLegend = LegendHelper::hasLegend( xDiagram ); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:InsertTitles" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertTitles" ); if( !bHasLegend ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:InsertLegend" ); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:InsertRemoveAxes" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertLegend" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertRemoveAxes" ); if( bHasLegend ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:DeleteLegend" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteLegend" ); } //----- xPopupMenu->insertSeparator( -1 ); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:DiagramType" ); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:DataRanges" ); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:DiagramData" ); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:View3D" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DiagramType" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DataRanges" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DiagramData" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:View3D" ); xPopupMenu->insertSeparator( -1 ); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:Cut" ); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:Copy" ); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:Paste" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:Cut" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:Copy" ); + lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:Paste" ); ::svt::ContextMenuHelper aContextMenuHelper( m_xFrame ); Point aPos( rCEvt.GetMousePosPixel() ); diff --git a/framework/inc/uielement/controlmenucontroller.hxx b/framework/inc/uielement/controlmenucontroller.hxx index a5f4fcfd9fd2..9b86a6257a62 100644 --- a/framework/inc/uielement/controlmenucontroller.hxx +++ b/framework/inc/uielement/controlmenucontroller.hxx @@ -63,7 +63,7 @@ namespace framework virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); // XMenuListener - virtual void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL itemActivated( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); // XEventListener virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); diff --git a/framework/inc/uielement/fontmenucontroller.hxx b/framework/inc/uielement/fontmenucontroller.hxx index d642a9c37b17..df8c922fa725 100644 --- a/framework/inc/uielement/fontmenucontroller.hxx +++ b/framework/inc/uielement/fontmenucontroller.hxx @@ -57,7 +57,7 @@ namespace framework virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); // XMenuListener - virtual void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL itemActivated( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); // XEventListener virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); diff --git a/framework/inc/uielement/newmenucontroller.hxx b/framework/inc/uielement/newmenucontroller.hxx index f2ee4ac33f71..afacc16ded58 100644 --- a/framework/inc/uielement/newmenucontroller.hxx +++ b/framework/inc/uielement/newmenucontroller.hxx @@ -70,8 +70,8 @@ namespace framework virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); // XMenuListener - virtual void SAL_CALL select( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL itemSelected( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL itemActivated( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); // XEventListener virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); diff --git a/framework/inc/uielement/recentfilesmenucontroller.hxx b/framework/inc/uielement/recentfilesmenucontroller.hxx index fe5b59480c0d..1fb90a40e1af 100644 --- a/framework/inc/uielement/recentfilesmenucontroller.hxx +++ b/framework/inc/uielement/recentfilesmenucontroller.hxx @@ -48,8 +48,8 @@ namespace framework virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); // XMenuListener - virtual void SAL_CALL select( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL itemSelected( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL itemActivated( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); // XDispatchProvider virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL queryDispatch( const ::com::sun::star::util::URL& aURL, const OUString& sTarget, sal_Int32 nFlags ) throw( ::com::sun::star::uno::RuntimeException ); diff --git a/framework/inc/uielement/toolbarsmenucontroller.hxx b/framework/inc/uielement/toolbarsmenucontroller.hxx index 3547abbe3edc..638170f29455 100644 --- a/framework/inc/uielement/toolbarsmenucontroller.hxx +++ b/framework/inc/uielement/toolbarsmenucontroller.hxx @@ -67,8 +67,8 @@ namespace framework virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); // XMenuListener - virtual void SAL_CALL select( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL itemSelected( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL itemActivated( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); // XEventListener virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); diff --git a/framework/source/uielement/controlmenucontroller.cxx b/framework/source/uielement/controlmenucontroller.cxx index bda92e0932a9..a861194babd4 100644 --- a/framework/source/uielement/controlmenucontroller.cxx +++ b/framework/source/uielement/controlmenucontroller.cxx @@ -317,7 +317,7 @@ void ControlMenuController::impl_select(const Reference< XDispatch >& /*_xDispat } } -void SAL_CALL ControlMenuController::activate( const css::awt::MenuEvent& ) throw (RuntimeException) +void SAL_CALL ControlMenuController::itemActivated( const css::awt::MenuEvent& ) throw (RuntimeException) { osl::ResettableMutexGuard aLock( m_aMutex ); diff --git a/framework/source/uielement/fontmenucontroller.cxx b/framework/source/uielement/fontmenucontroller.cxx index 47e35095bde2..fd5186c42047 100644 --- a/framework/source/uielement/fontmenucontroller.cxx +++ b/framework/source/uielement/fontmenucontroller.cxx @@ -157,7 +157,7 @@ void FontMenuController::impl_select(const Reference< XDispatch >& _xDispatch,co _xDispatch->dispatch( aTargetURL, aArgs ); } -void SAL_CALL FontMenuController::activate( const css::awt::MenuEvent& ) throw (RuntimeException) +void SAL_CALL FontMenuController::itemActivated( const css::awt::MenuEvent& ) throw (RuntimeException) { osl::MutexGuard aLock( m_aMutex ); diff --git a/framework/source/uielement/langselectionmenucontroller.cxx b/framework/source/uielement/langselectionmenucontroller.cxx index db94d8f8ea65..38a4def0d0bb 100644 --- a/framework/source/uielement/langselectionmenucontroller.cxx +++ b/framework/source/uielement/langselectionmenucontroller.cxx @@ -33,7 +33,6 @@ #include <vcl/i18nhelp.hxx> #include <rtl/ustrbuf.hxx> #include <vcl/mnemonic.hxx> -#include <com/sun/star/awt/XMenuExtended.hpp> #include <comphelper/processfactory.hxx> #include <com/sun/star/document/XDocumentLanguages.hpp> diff --git a/framework/source/uielement/langselectionstatusbarcontroller.cxx b/framework/source/uielement/langselectionstatusbarcontroller.cxx index 8773c819bb0f..903da76e7326 100644 --- a/framework/source/uielement/langselectionstatusbarcontroller.cxx +++ b/framework/source/uielement/langselectionstatusbarcontroller.cxx @@ -184,10 +184,8 @@ throw (::com::sun::star::uno::RuntimeException) // now display the popup menu and execute every command ... Reference< awt::XWindowPeer > xParent( m_xParentWindow, UNO_QUERY ); - com::sun::star::awt::Rectangle aRectangle; - aRectangle.X = aPos.X; - aRectangle.Y = aPos.Y; - sal_Int16 nId = xPopupMenu->execute( xParent, aRectangle, com::sun::star::awt::PopupMenuDirection::EXECUTE_UP+16 ); + com::sun::star::awt::Rectangle aRect( aPos.X, aPos.Y, 0, 0 ); + sal_Int16 nId = xPopupMenu->execute( xParent, aRect, com::sun::star::awt::PopupMenuDirection::EXECUTE_UP+16 ); //click "More..." if ( nId && m_xFrame.is() ) { diff --git a/framework/source/uielement/newmenucontroller.cxx b/framework/source/uielement/newmenucontroller.cxx index dea64a4a1489..156979ccf2ce 100644 --- a/framework/source/uielement/newmenucontroller.cxx +++ b/framework/source/uielement/newmenucontroller.cxx @@ -388,7 +388,7 @@ void SAL_CALL NewMenuController::statusChanged( const FeatureStateEvent& ) throw } // XMenuListener -void SAL_CALL NewMenuController::select( const css::awt::MenuEvent& rEvent ) throw (RuntimeException) +void SAL_CALL NewMenuController::itemSelected( const css::awt::MenuEvent& rEvent ) throw (RuntimeException) { Reference< css::awt::XPopupMenu > xPopupMenu; Reference< XDispatch > xDispatch; @@ -444,7 +444,7 @@ void SAL_CALL NewMenuController::select( const css::awt::MenuEvent& rEvent ) thr } } -void SAL_CALL NewMenuController::activate( const css::awt::MenuEvent& ) throw (RuntimeException) +void SAL_CALL NewMenuController::itemActivated( const css::awt::MenuEvent& ) throw (RuntimeException) { SolarMutexGuard aSolarMutexGuard; if ( m_xFrame.is() && m_xPopupMenu.is() ) diff --git a/framework/source/uielement/popupmenucontroller.cxx b/framework/source/uielement/popupmenucontroller.cxx index d980f6e68cd2..759bad1c63ee 100644 --- a/framework/source/uielement/popupmenucontroller.cxx +++ b/framework/source/uielement/popupmenucontroller.cxx @@ -59,7 +59,7 @@ class PopupMenuControllerImpl }; //======================================================================== -// class PopupMenuController +// class PopupMenuController REMOVE REMOVE REMOVE //======================================================================== PopupMenuController::PopupMenuController( const Reference< uno::XComponentContext >& rxContext ) diff --git a/framework/source/uielement/recentfilesmenucontroller.cxx b/framework/source/uielement/recentfilesmenucontroller.cxx index 62197dab0aeb..47f08687d9cd 100644 --- a/framework/source/uielement/recentfilesmenucontroller.cxx +++ b/framework/source/uielement/recentfilesmenucontroller.cxx @@ -267,20 +267,18 @@ void SAL_CALL RecentFilesMenuController::statusChanged( const FeatureStateEvent& m_bDisabled = !Event.IsEnabled; } -void SAL_CALL RecentFilesMenuController::select( const css::awt::MenuEvent& rEvent ) throw (RuntimeException) +void SAL_CALL RecentFilesMenuController::itemSelected( const css::awt::MenuEvent& rEvent ) throw (RuntimeException) { - Reference< css::awt::XPopupMenu > xPopupMenu; - Reference< css::awt::XMenuExtended > xMenuExt; + Reference< css::awt::XPopupMenu > xPopupMenu; osl::ClearableMutexGuard aLock( m_aMutex ); - xPopupMenu = m_xPopupMenu; - xMenuExt = Reference< css::awt::XMenuExtended >( m_xPopupMenu, UNO_QUERY ); + xPopupMenu = m_xPopupMenu; aLock.clear(); - if ( xMenuExt.is() ) + if ( xPopupMenu.is() ) { - const OUString aCommand( xMenuExt->getCommand( rEvent.MenuId ) ); - OSL_TRACE( "RecentFilesMenuController::select() - Command : %s", + const OUString aCommand( xPopupMenu->getCommand( rEvent.MenuId ) ); + OSL_TRACE( "RecentFilesMenuController::itemSelected() - Command : %s", OUStringToOString( aCommand, RTL_TEXTENCODING_UTF8 ).getStr() ); if ( aCommand.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( CMD_CLEAR_LIST ) ) ) @@ -290,7 +288,7 @@ void SAL_CALL RecentFilesMenuController::select( const css::awt::MenuEvent& rEve } } -void SAL_CALL RecentFilesMenuController::activate( const css::awt::MenuEvent& ) throw (RuntimeException) +void SAL_CALL RecentFilesMenuController::itemActivated( const css::awt::MenuEvent& ) throw (RuntimeException) { osl::MutexGuard aLock( m_aMutex ); impl_setPopupMenu(); diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx index a93c96591aa9..a1d8cd78ae1a 100644 --- a/framework/source/uielement/toolbarsmenucontroller.cxx +++ b/framework/source/uielement/toolbarsmenucontroller.cxx @@ -163,8 +163,7 @@ void ToolbarsMenuController::addCommand( aLabel = rLabel; rPopupMenu->insertItem( nItemId, aLabel, 0, nItemId ); - Reference< awt::XMenuExtended > xMenuExtended( m_xPopupMenu, UNO_QUERY ); - xMenuExtended->setCommand( nItemId, rCommandURL ); + rPopupMenu->setCommand( nItemId, rCommandURL ); bool bInternal = ( rCommandURL.indexOf( STATIC_INTERNAL_CMD_PART ) == 0); if ( !bInternal ) @@ -354,9 +353,8 @@ void ToolbarsMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& r m_aCommandVector.clear(); // Retrieve layout manager for additional information - OUString aEmptyString; - Reference< awt::XMenuExtended > xMenuExtended( rPopupMenu, UNO_QUERY ); - Reference< XLayoutManager > xLayoutManager( getLayoutManagerFromFrame( m_xFrame )); + OUString aEmptyString; + Reference< XLayoutManager > xLayoutManager( getLayoutManagerFromFrame( m_xFrame )); m_bResetActive = sal_False; if ( xLayoutManager.is() ) @@ -467,7 +465,7 @@ void ToolbarsMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& r // Store complete uno-command so it can also be dispatched. This is necessary to support // the test tool! - xMenuExtended->setCommand( nIndex, aCmd ); + rPopupMenu->setCommand( nIndex, aCmd ); ++nIndex; } @@ -595,7 +593,7 @@ void SAL_CALL ToolbarsMenuController::statusChanged( const FeatureStateEvent& Ev } // XMenuListener -void SAL_CALL ToolbarsMenuController::select( const css::awt::MenuEvent& rEvent ) throw (RuntimeException) +void SAL_CALL ToolbarsMenuController::itemSelected( const css::awt::MenuEvent& rEvent ) throw (RuntimeException) { Reference< css::awt::XPopupMenu > xPopupMenu; Reference< XComponentContext > xContext; @@ -754,7 +752,7 @@ void SAL_CALL ToolbarsMenuController::select( const css::awt::MenuEvent& rEvent } } -void SAL_CALL ToolbarsMenuController::activate( const css::awt::MenuEvent& ) throw (RuntimeException) +void SAL_CALL ToolbarsMenuController::itemActivated( const css::awt::MenuEvent& ) throw (RuntimeException) { std::vector< OUString > aCmdVector; Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY ); diff --git a/include/svtools/popupmenucontrollerbase.hxx b/include/svtools/popupmenucontrollerbase.hxx index 1bec619259b0..e3f7020001c5 100644 --- a/include/svtools/popupmenucontrollerbase.hxx +++ b/include/svtools/popupmenucontrollerbase.hxx @@ -78,10 +78,10 @@ namespace svt virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) = 0; // XMenuListener - virtual void SAL_CALL highlight( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL select( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL deactivate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL itemHighlighted( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL itemSelected( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL itemActivated( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL itemDeactivated( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); // XDispatchProvider virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL queryDispatch( const ::com::sun::star::util::URL& aURL, const OUString& sTarget, sal_Int32 nFlags ) throw( ::com::sun::star::uno::RuntimeException ); diff --git a/include/toolkit/awt/vclxmenu.hxx b/include/toolkit/awt/vclxmenu.hxx index 32b7775e3427..77b0cfef221b 100644 --- a/include/toolkit/awt/vclxmenu.hxx +++ b/include/toolkit/awt/vclxmenu.hxx @@ -21,37 +21,41 @@ #define _TOOLKIT_AWT_VCLXMENU_HXX_ #include <toolkit/dllapi.h> -#include <com/sun/star/awt/XMenuBarExtended.hpp> -#include <com/sun/star/awt/XPopupMenuExtended.hpp> +#include <toolkit/helper/listenermultiplexer.hxx> + +#include <com/sun/star/awt/XMenuBar.hpp> +#include <com/sun/star/awt/XPopupMenu.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XTypeProvider.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp> + #include <cppuhelper/weak.hxx> #include <osl/mutex.hxx> #include <tools/link.hxx> -#include <toolkit/helper/listenermultiplexer.hxx> #include <vector> +namespace css = ::com::sun::star; + class Menu; class MenuBar; class VclSimpleEvent; class PopupMenu; typedef ::std::vector< - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >* + css::uno::Reference< css::awt::XPopupMenu >* > PopupMenuRefList; // ---------------------------------------------------- // class VCLXMenu // ---------------------------------------------------- -class TOOLKIT_DLLPUBLIC VCLXMenu : public ::com::sun::star::awt::XMenuBarExtended, - public ::com::sun::star::awt::XPopupMenuExtended, - public ::com::sun::star::lang::XServiceInfo, - public ::com::sun::star::lang::XTypeProvider, - public ::com::sun::star::lang::XUnoTunnel, +class TOOLKIT_DLLPUBLIC VCLXMenu : public css::awt::XMenuBar, + public css::awt::XPopupMenu, + public css::lang::XServiceInfo, + public css::lang::XTypeProvider, + public css::lang::XUnoTunnel, public ::cppu::OWeakObject { private: @@ -63,120 +67,94 @@ private: protected: ::osl::Mutex& GetMutex() { return maMutex; } - DECL_LINK( MenuEventListener, VclSimpleEvent* ); + DECL_LINK( MenuEventListener, VclSimpleEvent* ); - void ImplCreateMenu( sal_Bool bPopup ); + void ImplCreateMenu( sal_Bool bPopup ); public: - VCLXMenu(); - VCLXMenu( Menu* pMenu ); - ~VCLXMenu(); - - - Menu* GetMenu() const { return mpMenu; } - sal_Bool IsPopupMenu() const; - - // ::com::sun::star::uno::XInterface - ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL acquire() throw() { OWeakObject::acquire(); } - void SAL_CALL release() throw() { OWeakObject::release(); } - - // ::com::sun::star::lang::XUnoTunnel - static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw(); - static VCLXMenu* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ); - sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException); - - // ::com::sun::star::lang::XTypeProvider - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); - - // ::com::sun::star::awt::XMenu - void SAL_CALL addMenuListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL removeMenuListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL insertItem( sal_Int16 nItemId, const OUString& aText, sal_Int16 nItemStyle, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL removeItem( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException); - sal_Int16 SAL_CALL getItemCount( ) throw(::com::sun::star::uno::RuntimeException); - sal_Int16 SAL_CALL getItemId( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException); - sal_Int16 SAL_CALL getItemPos( sal_Int16 nId ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL enableItem( sal_Int16 nItemId, sal_Bool bEnable ) throw(::com::sun::star::uno::RuntimeException); - sal_Bool SAL_CALL isItemEnabled( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL setItemText( sal_Int16 nItemId, const OUString& aText ) throw(::com::sun::star::uno::RuntimeException); - OUString SAL_CALL getItemText( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL setPopupMenu( sal_Int16 nItemId, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >& aPopupMenu ) throw(::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > SAL_CALL getPopupMenu( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException); - - // ::com::sun::star::awt::XPopupMenu - void SAL_CALL insertSeparator( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL setDefaultItem( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException); - sal_Int16 SAL_CALL getDefaultItem( ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL checkItem( sal_Int16 nItemId, sal_Bool bCheck ) throw(::com::sun::star::uno::RuntimeException); - sal_Bool SAL_CALL isItemChecked( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException); - sal_Int16 SAL_CALL execute( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent, const ::com::sun::star::awt::Rectangle& Area, sal_Int16 Direction ) throw(::com::sun::star::uno::RuntimeException); - - // ::com::sun::star::awt::XMenuBar - - // ::com::sun::star::awt::XMenuExtended - virtual void SAL_CALL setCommand( sal_Int16 nItemId, const OUString& aCommand ) throw (::com::sun::star::uno::RuntimeException); - virtual OUString SAL_CALL getCommand( sal_Int16 nItemId ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setHelpCommand( sal_Int16 nItemId, const OUString& aHelp ) throw (::com::sun::star::uno::RuntimeException); - virtual OUString SAL_CALL getHelpCommand( sal_Int16 nItemId ) throw (::com::sun::star::uno::RuntimeException); - - // ======================================================================== - // ======================================================================== - // ======================================================================== - - // XMenuExtended2 Methods - virtual ::sal_Bool SAL_CALL isPopupMenu( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL clear( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::MenuItemType SAL_CALL getItemType( ::sal_Int16 nItemPos ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL hideDisabledEntries( ::sal_Bool bHide ) throw (::com::sun::star::uno::RuntimeException); - - // XMenuBarExtended Methods - - // XPopupMenuExtended Methods - virtual ::sal_Bool SAL_CALL isInExecute( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL endExecute( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setLogo( const ::com::sun::star::awt::MenuLogo& aMenuLogo ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::MenuLogo SAL_CALL getLogo( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL enableAutoMnemonics( ::sal_Bool bEnable ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setAcceleratorKeyEvent( ::sal_Int16 nItemId, const ::com::sun::star::awt::KeyEvent& aKeyEvent ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::KeyEvent SAL_CALL getAcceleratorKeyEvent( ::sal_Int16 nItemId ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setHelpText( ::sal_Int16 nItemId, const OUString& sHelpText ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); - virtual OUString SAL_CALL getHelpText( ::sal_Int16 nItemId ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setTipHelpText( ::sal_Int16 nItemId, const OUString& sTipHelpText ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); - virtual OUString SAL_CALL getTipHelpText( ::sal_Int16 nItemId ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setItemImage( ::sal_Int16 nItemId, const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& xGraphic, ::sal_Bool bScale ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > SAL_CALL getItemImage( ::sal_Int16 nItemId ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setItemImageAngle( ::sal_Int16 nItemId, ::sal_Int32 nAngle ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getItemImageAngle( ::sal_Int16 nItemId ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setItemImageMirrorMode( ::sal_Int16 nItemId, ::sal_Bool bMirror ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL isItemImageInMirrorMode( ::sal_Int16 nItemId ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); - - // ::com::sun::star::lang::XServiceInfo - virtual OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); - + VCLXMenu(); + VCLXMenu( Menu* pMenu ); + ~VCLXMenu(); + + + Menu* GetMenu() const { return mpMenu; } + sal_Bool IsPopupMenu() const; + + // css::uno::XInterface + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) throw(css::uno::RuntimeException); + void SAL_CALL acquire() throw() { OWeakObject::acquire(); } + void SAL_CALL release() throw() { OWeakObject::release(); } + + // css::lang::XUnoTunnel + static const css::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw(); + static VCLXMenu* GetImplementation( const css::uno::Reference< css::uno::XInterface >& rxIFace ); + sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& rIdentifier ) throw(css::uno::RuntimeException); + + // css::lang::XTypeProvider + css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() throw(css::uno::RuntimeException); + css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(css::uno::RuntimeException); + + // css::awt::XMenu + virtual void SAL_CALL addMenuListener( const css::uno::Reference< css::awt::XMenuListener >& xListener ) throw(css::uno::RuntimeException); + virtual void SAL_CALL removeMenuListener( const css::uno::Reference< css::awt::XMenuListener >& xListener ) throw(css::uno::RuntimeException); + virtual void SAL_CALL insertItem( sal_Int16 nItemId, const OUString& aText, sal_Int16 nItemStyle, sal_Int16 nPos ) throw(css::uno::RuntimeException); + virtual void SAL_CALL removeItem( sal_Int16 nPos, sal_Int16 nCount ) throw(css::uno::RuntimeException); + virtual void SAL_CALL clear( ) throw(css::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getItemCount( ) throw(css::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getItemId( sal_Int16 nPos ) throw(css::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getItemPos( sal_Int16 nId ) throw(css::uno::RuntimeException); + virtual css::awt::MenuItemType SAL_CALL getItemType( ::sal_Int16 nItemPos ) throw (css::uno::RuntimeException); + virtual void SAL_CALL enableItem( sal_Int16 nItemId, sal_Bool bEnable ) throw(css::uno::RuntimeException); + virtual sal_Bool SAL_CALL isItemEnabled( sal_Int16 nItemId ) throw(css::uno::RuntimeException); + virtual void SAL_CALL hideDisabledEntries( ::sal_Bool bHide ) throw (css::uno::RuntimeException); + virtual void SAL_CALL enableAutoMnemonics( ::sal_Bool bEnable ) throw (css::uno::RuntimeException); + virtual void SAL_CALL setItemText( sal_Int16 nItemId, const OUString& aText ) throw(css::uno::RuntimeException); + virtual OUString SAL_CALL getItemText( sal_Int16 nItemId ) throw(css::uno::RuntimeException); + virtual void SAL_CALL setCommand( sal_Int16 nItemId, const OUString& aCommand ) throw (css::uno::RuntimeException); + virtual OUString SAL_CALL getCommand( sal_Int16 nItemId ) throw (css::uno::RuntimeException); + virtual void SAL_CALL setHelpCommand( sal_Int16 nItemId, const OUString& aHelp ) throw (css::uno::RuntimeException); + virtual OUString SAL_CALL getHelpCommand( sal_Int16 nItemId ) throw (css::uno::RuntimeException); + virtual void SAL_CALL setHelpText( ::sal_Int16 nItemId, const OUString& sHelpText ) throw (css::uno::RuntimeException); + virtual OUString SAL_CALL getHelpText( ::sal_Int16 nItemId ) throw (css::uno::RuntimeException); + virtual void SAL_CALL setTipHelpText( ::sal_Int16 nItemId, const OUString& sTipHelpText ) throw (css::uno::RuntimeException); + virtual OUString SAL_CALL getTipHelpText( ::sal_Int16 nItemId ) throw (css::uno::RuntimeException); + + virtual ::sal_Bool SAL_CALL isPopupMenu( ) throw (css::uno::RuntimeException); + virtual void SAL_CALL setPopupMenu( sal_Int16 nItemId, const css::uno::Reference< css::awt::XPopupMenu >& aPopupMenu ) throw(css::uno::RuntimeException); + virtual css::uno::Reference< css::awt::XPopupMenu > SAL_CALL getPopupMenu( sal_Int16 nItemId ) throw(css::uno::RuntimeException); + + // css::awt::XPopupMenu + virtual void SAL_CALL insertSeparator( sal_Int16 nPos ) throw(css::uno::RuntimeException); + virtual void SAL_CALL setDefaultItem( sal_Int16 nItemId ) throw(css::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getDefaultItem( ) throw(css::uno::RuntimeException); + virtual void SAL_CALL checkItem( sal_Int16 nItemId, sal_Bool bCheck ) throw(css::uno::RuntimeException); + virtual sal_Bool SAL_CALL isItemChecked( sal_Int16 nItemId ) throw(css::uno::RuntimeException); + virtual ::sal_Int16 SAL_CALL execute( const css::uno::Reference< css::awt::XWindowPeer >& Parent, const css::awt::Rectangle& Position, ::sal_Int16 Direction ) throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL isInExecute( ) throw (css::uno::RuntimeException); + virtual void SAL_CALL endExecute( ) throw (css::uno::RuntimeException); + virtual void SAL_CALL setAcceleratorKeyEvent( ::sal_Int16 nItemId, const css::awt::KeyEvent& aKeyEvent ) throw (css::uno::RuntimeException); + virtual css::awt::KeyEvent SAL_CALL getAcceleratorKeyEvent( ::sal_Int16 nItemId ) throw (css::uno::RuntimeException); + virtual void SAL_CALL setItemImage( ::sal_Int16 nItemId, const css::uno::Reference< css::graphic::XGraphic >& xGraphic, ::sal_Bool bScale ) throw (css::uno::RuntimeException); + virtual css::uno::Reference< css::graphic::XGraphic > SAL_CALL getItemImage( ::sal_Int16 nItemId ) throw (css::uno::RuntimeException); + + // css::lang::XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (css::uno::RuntimeException); + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (css::uno::RuntimeException); }; -// ---------------------------------------------------- -// class VCLXMenuBar -// ---------------------------------------------------- class TOOLKIT_DLLPUBLIC VCLXMenuBar : public VCLXMenu { public: - VCLXMenuBar(); - VCLXMenuBar( MenuBar* pMenuBar ); + VCLXMenuBar(); + VCLXMenuBar( MenuBar* pMenuBar ); }; -// ---------------------------------------------------- -// class VCLXPopupMenu -// ---------------------------------------------------- class TOOLKIT_DLLPUBLIC VCLXPopupMenu : public VCLXMenu { public: - VCLXPopupMenu(); - VCLXPopupMenu( PopupMenu* pPopMenu ); + VCLXPopupMenu(); + VCLXPopupMenu( PopupMenu* pPopMenu ); }; #endif // _TOOLKIT_AWT_VCLXMENU_HXX_ diff --git a/include/toolkit/helper/listenermultiplexer.hxx b/include/toolkit/helper/listenermultiplexer.hxx index dc0626893e37..538abc95783c 100644 --- a/include/toolkit/helper/listenermultiplexer.hxx +++ b/include/toolkit/helper/listenermultiplexer.hxx @@ -217,10 +217,10 @@ DECL_LISTENERMULTIPLEXER_END // class MenuListenerMultiplexer // ---------------------------------------------------- DECL_LISTENERMULTIPLEXER_START( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener ) - void SAL_CALL highlight( const ::com::sun::star::awt::MenuEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL select( const ::com::sun::star::awt::MenuEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL deactivate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL itemHighlighted( const ::com::sun::star::awt::MenuEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL itemSelected( const ::com::sun::star::awt::MenuEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL itemActivated( const ::com::sun::star::awt::MenuEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL itemDeactivated( const ::com::sun::star::awt::MenuEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); DECL_LISTENERMULTIPLEXER_END // ---------------------------------------------------- diff --git a/odk/examples/DevelopersGuide/GUI/UnoMenu.java b/odk/examples/DevelopersGuide/GUI/UnoMenu.java index 86942f91c0d6..87e7fce68085 100644 --- a/odk/examples/DevelopersGuide/GUI/UnoMenu.java +++ b/odk/examples/DevelopersGuide/GUI/UnoMenu.java @@ -22,7 +22,6 @@ import com.sun.star.awt.Rectangle; import com.sun.star.awt.WindowAttribute; import com.sun.star.awt.WindowClass; import com.sun.star.awt.XMenuBar; -import com.sun.star.awt.XMenuExtended; import com.sun.star.awt.XMenuListener; import com.sun.star.awt.XPopupMenu; import com.sun.star.awt.XToolkit; @@ -64,21 +63,26 @@ public UnoMenu(XComponentContext _xContext, XMultiComponentFactory _xMCF) { XPopupMenu xPopupMenu = null; try{ // create a popup menu - Object oPopupMenu = m_xMCF.createInstanceWithContext("stardiv.Toolkit.VCLXPopupMenu", m_xContext); + Object oPopupMenu = m_xMCF.createInstanceWithContext("com.sun.star.awt.PopupMenu", m_xContext); xPopupMenu = UnoRuntime.queryInterface(XPopupMenu.class, oPopupMenu); - XMenuExtended xMenuExtended = UnoRuntime.queryInterface(XMenuExtended.class, xPopupMenu); - - xPopupMenu.insertItem((short) 0, "~First Entry", MenuItemStyle.AUTOCHECK, (short) 0); - xPopupMenu.insertItem((short) 1, "First ~Radio Entry", (short) (MenuItemStyle.RADIOCHECK + MenuItemStyle.AUTOCHECK), (short) 1); - xPopupMenu.insertItem((short) 2, "~Second Radio Entry", (short) (MenuItemStyle.RADIOCHECK + MenuItemStyle.AUTOCHECK), (short) 2); - xPopupMenu.insertItem((short) 3, "~Third RadioEntry",(short) (MenuItemStyle.RADIOCHECK + MenuItemStyle.AUTOCHECK), (short) 3); - xPopupMenu.insertSeparator((short)4); - xPopupMenu.insertItem((short) 4, "F~ifth Entry", (short) (MenuItemStyle.CHECKABLE + MenuItemStyle.AUTOCHECK), (short) 5); - xPopupMenu.insertItem((short) 5, "~Fourth Entry", (short) (MenuItemStyle.CHECKABLE + MenuItemStyle.AUTOCHECK), (short) 6); - xPopupMenu.enableItem((short) 1, false); - xPopupMenu.insertItem((short) 6, "~Sixth Entry", (short) 0, (short) 7); - xPopupMenu.insertItem((short) 7, "~Close Dialog", (short) 0, (short) 8); - xPopupMenu.checkItem((short) 2, true); + + // ID must start be > 0 + short nId = 1; + short nPos = 0; + + xPopupMenu.insertItem(nId++, "First Entry", MenuItemStyle.AUTOCHECK, nPos++); + xPopupMenu.insertItem(nId++, "First Radio Entry", (short) (MenuItemStyle.RADIOCHECK + MenuItemStyle.AUTOCHECK), nPos++); + xPopupMenu.insertItem(nId++, "Second Radio Entry", (short) (MenuItemStyle.RADIOCHECK + MenuItemStyle.AUTOCHECK), nPos++); + xPopupMenu.insertItem(nId++, "Third RadioEntry",(short) (MenuItemStyle.RADIOCHECK + MenuItemStyle.AUTOCHECK), nPos++); + xPopupMenu.insertSeparator(nPos++); + xPopupMenu.insertItem(nId++, "Fifth Entry", (short) (MenuItemStyle.CHECKABLE + MenuItemStyle.AUTOCHECK), nPos++); + xPopupMenu.insertItem(nId++, "Fourth Entry", (short) (MenuItemStyle.CHECKABLE + MenuItemStyle.AUTOCHECK), nPos++); + xPopupMenu.insertItem(nId++, "Sixth Entry", (short) 0, nPos++); + xPopupMenu.insertItem(nId++, "Close Dialog", (short) 0, nPos++); + + xPopupMenu.enableItem((short) 2, false); + xPopupMenu.checkItem((short) 3, true); + xPopupMenu.addMenuListener(this); }catch( Exception e ) { throw new java.lang.RuntimeException("cannot happen..."); @@ -90,12 +94,12 @@ public UnoMenu(XComponentContext _xContext, XMultiComponentFactory _xMCF) { public void addMenuBar(XTopWindow _xTopWindow, XMenuListener _xMenuListener){ try{ // create a menubar at the global MultiComponentFactory... - Object oMenuBar = m_xMCF.createInstanceWithContext("stardiv.Toolkit.VCLXMenuBar", m_xContext); + Object oMenuBar = m_xMCF.createInstanceWithContext("com.sun.star.awt.MenuBar", m_xContext); // add the menu items... XMenuBar xMenuBar = UnoRuntime.queryInterface(XMenuBar.class, oMenuBar); - xMenuBar.insertItem((short) 0, "~First MenuBar Item", com.sun.star.awt.MenuItemStyle.AUTOCHECK, (short) 0); - xMenuBar.insertItem((short) 1, "~Second MenuBar Item", com.sun.star.awt.MenuItemStyle.AUTOCHECK, (short) 1); - xMenuBar.setPopupMenu((short) 0, getPopupMenu()); + xMenuBar.insertItem((short) 1, "~First MenuBar Item", com.sun.star.awt.MenuItemStyle.AUTOCHECK, (short) 0); + xMenuBar.insertItem((short) 2, "~Second MenuBar Item", com.sun.star.awt.MenuItemStyle.AUTOCHECK, (short) 1); + xMenuBar.setPopupMenu((short) 1, getPopupMenu()); xMenuBar.addMenuListener(_xMenuListener); _xTopWindow.setMenuBar(xMenuBar); }catch( Exception e ) { @@ -154,31 +158,31 @@ public UnoMenu(XComponentContext _xContext, XMultiComponentFactory _xMCF) { addMenuBar(xTopWindow, this); } - public void select(MenuEvent menuEvent){ + public void itemSelected(MenuEvent menuEvent){ // find out which menu item has been triggered, // by getting the menu-id... switch (menuEvent.MenuId){ - case 0: + case 1: // add your menu-item-specific code here: break; - case 1: + case 2: // add your menu-item-specific code here: break; - case 7: + case 8: closeDialog(); default: //.. } } - public void highlight(MenuEvent menuEvent) { + public void itemHighlighted(MenuEvent menuEvent) { int i = 0; } - public void deactivate(MenuEvent menuEvent) { + public void itemDeactivated(MenuEvent menuEvent) { int i = 0; } - public void activate(MenuEvent menuEvent) { + public void itemActivated(MenuEvent menuEvent) { int i = 0; } diff --git a/odk/examples/DevelopersGuide/GUI/UnoMenu2.java b/odk/examples/DevelopersGuide/GUI/UnoMenu2.java index 0edae176bd71..ea53a99f02d8 100644 --- a/odk/examples/DevelopersGuide/GUI/UnoMenu2.java +++ b/odk/examples/DevelopersGuide/GUI/UnoMenu2.java @@ -95,9 +95,9 @@ public UnoMenu2(XComponentContext _xContext, XMultiComponentFactory _xMCF) { public void mousePressed(MouseEvent mouseEvent) { if (mouseEvent.PopupTrigger){ - Rectangle aRectangle = new Rectangle(mouseEvent.X, mouseEvent.Y, 0, 0); + Rectangle aPos = new Rectangle(mouseEvent.X, mouseEvent.Y, 0, 0); XControl xControl = UnoRuntime.queryInterface(XControl.class, mouseEvent.Source); - getPopupMenu().execute( xControl.getPeer(), aRectangle, com.sun.star.awt.PopupMenuDirection.DEFAULT); + getPopupMenu().execute( xControl.getPeer(), aPos, com.sun.star.awt.PopupMenuDirection.EXECUTE_DEFAULT); } } diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 929fe9ff9fcd..a96bcd49e7f5 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -1746,7 +1746,6 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/awt,\ MenuEvent \ MenuItemStyle \ MenuItemType \ - MenuLogo \ MessageBoxButtons \ MessageBoxCommand \ MouseButton \ @@ -1831,9 +1830,6 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/awt,\ XListBox \ XMenu \ XMenuBar \ - XMenuBarExtended \ - XMenuExtended \ - XMenuExtended2 \ XMenuListener \ XMessageBox \ XMessageBoxFactory \ @@ -1847,7 +1843,6 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/awt,\ XPatternField \ XPointer \ XPopupMenu \ - XPopupMenuExtended \ XPrinter \ XPrinterPropertySet \ XPrinterServer \ diff --git a/offapi/com/sun/star/awt/MenuBar.idl b/offapi/com/sun/star/awt/MenuBar.idl index 791a5f8e0c3c..ce28b1a7589f 100644 --- a/offapi/com/sun/star/awt/MenuBar.idl +++ b/offapi/com/sun/star/awt/MenuBar.idl @@ -21,12 +21,9 @@ #include <com/sun/star/awt/XMenuBar.idl> - module com { module sun { module star { module awt { - /** describes a menu for top-level windows. - <p>A menu bar can only be used by top-level windows. They support the interface com::sun::star::awt::XTopWindow to set an menu bar object. @@ -34,7 +31,6 @@ module com { module sun { module star { module awt { */ published service MenuBar : XMenuBar; - }; }; }; }; #endif diff --git a/offapi/com/sun/star/awt/MenuEvent.idl b/offapi/com/sun/star/awt/MenuEvent.idl index b1a2b43bba71..16820242b8e8 100644 --- a/offapi/com/sun/star/awt/MenuEvent.idl +++ b/offapi/com/sun/star/awt/MenuEvent.idl @@ -21,23 +21,18 @@ #include <com/sun/star/lang/EventObject.idl> - - - module com { module sun { module star { module awt { - +module com { module sun { module star { module awt { /** specifies a menu event. */ published struct MenuEvent: com::sun::star::lang::EventObject { - - /** contains the item id. + /** contains the item ID. */ short MenuId; }; - }; }; }; }; #endif diff --git a/offapi/com/sun/star/awt/MenuItemStyle.idl b/offapi/com/sun/star/awt/MenuItemStyle.idl index b0c6fef17539..194a732ae38c 100644 --- a/offapi/com/sun/star/awt/MenuItemStyle.idl +++ b/offapi/com/sun/star/awt/MenuItemStyle.idl @@ -19,36 +19,27 @@ #ifndef __com_sun_star_awt_MenuItemStyle_idl__ #define __com_sun_star_awt_MenuItemStyle_idl__ - - - module com { module sun { module star { module awt { - +module com { module sun { module star { module awt { /** These values are used to specify the properties of a menu item. - - <p>They may be expanded in future versions.</p> */ -published constants MenuItemStyle +constants MenuItemStyle { - /** specifies an item which can be checked independently. */ const short CHECKABLE = 1; - - /** specifies an item which can be checked dependent on the neighboring + /** specifies an item which can be checked dependent on the neighbouring items. */ const short RADIOCHECK = 2; - /** specifies to check this item automatically on select. */ const short AUTOCHECK = 4; }; - }; }; }; }; #endif diff --git a/offapi/com/sun/star/awt/MenuItemType.idl b/offapi/com/sun/star/awt/MenuItemType.idl index 714d34be593d..cd538a39c38b 100644 --- a/offapi/com/sun/star/awt/MenuItemType.idl +++ b/offapi/com/sun/star/awt/MenuItemType.idl @@ -19,15 +19,12 @@ #ifndef __com_sun_star_awt_MenuItemType_idl__ #define __com_sun_star_awt_MenuItemType_idl__ - - - module com { module sun { module star { module awt { - +module com { module sun { module star { module awt { /** specifies the type of a menu item, as returned by - com::sun::star::awt::XMenuExtended2::getItemType(). + com::sun::star::awt::XMenu::getItemType(). */ -enum MenuItemType +published enum MenuItemType { /** specifies that the menu item type is unknown. */ @@ -51,7 +48,6 @@ enum MenuItemType }; - }; }; }; }; #endif diff --git a/offapi/com/sun/star/awt/MenuLogo.idl b/offapi/com/sun/star/awt/MenuLogo.idl deleted file mode 100644 index 167f32fa2f6a..000000000000 --- a/offapi/com/sun/star/awt/MenuLogo.idl +++ /dev/null @@ -1,54 +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 __com_sun_star_awt_MenuLogo_idl__ -#define __com_sun_star_awt_MenuLogo_idl__ - -#include <com/sun/star/graphic/XGraphic.idl> -#include <com/sun/star/util/Color.idl> - - - module com { module sun { module star { module awt { - - -/** specifies a logo to be displayed on a menu, with a background gradient. - */ -struct MenuLogo -{ - /** specifies the logo image. - */ - ::com::sun::star::graphic::XGraphic Graphic; - - - /** specifies the color at the start point of the gradient. - */ - ::com::sun::star::util::Color StartColor; - - - /** specifies the color at the end point of the gradient. - */ - ::com::sun::star::util::Color EndColor; - -}; - - -}; }; }; }; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/awt/PopupMenu.idl b/offapi/com/sun/star/awt/PopupMenu.idl index 3edce5f6a242..5040da5d880f 100644 --- a/offapi/com/sun/star/awt/PopupMenu.idl +++ b/offapi/com/sun/star/awt/PopupMenu.idl @@ -21,19 +21,15 @@ #include <com/sun/star/awt/XPopupMenu.idl> - module com { module sun { module star { module awt { - -/** describes a pop-up menu which is a recursive container for commands - - <p>A pop-up menu can be used as a standalone object to display a context - menu. It's also possible to use a pop-up menu to integrate it into +/** describes a popup menu which is a recursive container for commands + <p>A popup menu can be used as a standalone object to display a context + menu. It's also possible to use a popup menu to integrate it into another menu.</p> */ published service PopupMenu : XPopupMenu; - }; }; }; }; #endif diff --git a/offapi/com/sun/star/awt/PopupMenuDirection.idl b/offapi/com/sun/star/awt/PopupMenuDirection.idl index 5ecb2e3f6b58..021ab5cf7a74 100644 --- a/offapi/com/sun/star/awt/PopupMenuDirection.idl +++ b/offapi/com/sun/star/awt/PopupMenuDirection.idl @@ -19,10 +19,7 @@ #ifndef __com_sun_star_awt_PopupMenuDirection_idl__ #define __com_sun_star_awt_PopupMenuDirection_idl__ - - - module com { module sun { module star { module awt { - +module com { module sun { module star { module awt { /** These values are used to specify the direction in which a pop-up menu will grow. @@ -31,44 +28,27 @@ */ published constants PopupMenuDirection { - - /** @deprecated - */ - const short DEFAULT = 0; - - - /** @deprecated - */ - const short DOWN = 1; - - /** opens on execute in a default direction. */ const short EXECUTE_DEFAULT = 0; - /** opens on execute downwards. */ const short EXECUTE_DOWN = 1; - /** opens on execute upwards. */ const short EXECUTE_UP = 2; - /** opens on execute to the left. */ const short EXECUTE_LEFT = 4; - /** opens on execute to the right. */ const short EXECUTE_RIGHT = 8; - }; - }; }; }; }; #endif diff --git a/offapi/com/sun/star/awt/XMenu.idl b/offapi/com/sun/star/awt/XMenu.idl index ba8fedc50434..6caa38125c43 100644 --- a/offapi/com/sun/star/awt/XMenu.idl +++ b/offapi/com/sun/star/awt/XMenu.idl @@ -20,98 +20,278 @@ #define __com_sun_star_awt_XMenu_idl__ #include <com/sun/star/uno/XInterface.idl> +#include <com/sun/star/awt/MenuItemType.idl> +module com { module sun { module star { module awt { - - module com { module sun { module star { module awt { - - published interface XPopupMenu; - published interface XMenuListener; - +published interface XPopupMenu; +published interface XMenuListener; /** specifies a simple menu. */ published interface XMenu: com::sun::star::uno::XInterface { - /** adds the specified menu listener to receive events from this menu. + + @param xListener + the XMenuListener to be added. */ void addMenuListener( [in] XMenuListener xListener ); - /** removes the specified menu listener so that it no longer receives events from this menu. + + @param xListener + the XMenuListener to be removed. */ void removeMenuListener( [in] XMenuListener xListener ); - /** inserts an item into the menu. - <p>The item is appended if the position is greater than or equal to - <code>getItemCount()</code> or if it is negative.</p> + <member>getItemCount()</member> or if it is negative.</p> + + @param nItemId + specifies the ID of the menu item to be insterted. + + @param aText + specifies the label of the menu item. + + @param nItemStyle + specifies the style of the menu item, as defined in + MenuItemStyle. + + @param nItemPos + specifies the position where the menu item will be insterted. */ void insertItem( [in] short nItemId, - [in] string aText, - [in] short nItemStyle, - [in] short nPos ); - + [in] string aText, + [in] short nItemStyle, + [in] short nItemPos ); /** removes one or more items from the menu. + + @param nItemPos + specifies the position of the (first) menu item to be removed. + + @param nCount + specifies the number of menu items to remove. */ - void removeItem( [in] short nPos, - [in] short nCount ); + void removeItem( [in] short nItemPos, + [in] short nCount ); + /** removes all items from the menu. + */ + void clear(); /** returns the number of items in the menu. + + @return + the number of items in this XMenu. */ short getItemCount(); + /** returns the ID of the item at the specified position. - /** returns the id of the item at the specified position. + @param nItemPos + specifies the position of the menu item for which the item ID is queried. + + @return + the ID of the menu item at the given position. */ - short getItemId( [in] short nPos ); + short getItemId( [in] short nItemPos ); + + /** returns the position of the item with the specified ID. + @param nItemId + specifies the ID of the menu item for which the item position is queried. - /** returns the position of the item with the specified id. + @return + the position of the menu item with the specified ID. */ - short getItemPos( [in] short nId ); + short getItemPos( [in] short nItemId ); + /** retrieves the type of the menu item. + + @param nItemPos + specifies the position of the menu item for which the item type is queried. + + @return + a MenuItemType indicating the item type. + */ + ::com::sun::star::awt::MenuItemType getItemType( [in] short nItemPos ); /** enables or disables the menu item. + + @param nItemId + specifies the menu item ID. + + @param bEnable + specifies whether the menu item should be enabled (`TRUE`) or + disabled (`FALSE`). */ void enableItem( [in] short nItemId, - [in] boolean bEnable ); - + [in] boolean bEnable ); /** returns the state of the menu item. + + @param nItemId + specifies the menu item ID. + + @return + `TRUE` if the item is enabled, `FALSE` otherwise. */ boolean isItemEnabled( [in] short nItemId ); + /** specifies whether disabled menu entries should be hidden, or not. + + @param bHide + if `TRUE`, disabled menu entries are hidden. + */ + void hideDisabledEntries( [in] boolean bHide ); + + /** specifies whether mnemonics are automatically assigned to menu items, or not. + + @param bEnable + if `TRUE`, mnemonics are automatically assigned to menu items. + */ + void enableAutoMnemonics( [in] boolean bEnable ); /** sets the text for the menu item. + + @param nItemId + specifies the ID of the menu item. + + @param aText + specifies the label of the menu item. */ void setItemText( [in] short nItemId, - [in] string aText ); - + [in] string aText ); /** returns the string for the given item id. + + @param nItemId + specifies the ID of the menu item. + + @return + the label of the menu item. */ string getItemText( [in] short nItemId ); + /** sets the command string for the menu item. + + @param nItemId + specifies the menu item ID for which the command should be set. + + @param aCommand + specifies the command for the menu item. + */ + void setCommand( [in] short nItemId, + [in] string aCommand ); + + /** retrieves the command string for the menu item. + + @param nItemId + specifies the menu item ID for which the command URL should be set. + + @return + the command of the menu item. + */ + string getCommand( [in] short nItemId ); + + /** sets the help command string for the menu item. + + @param nItemId + specifies the menu item ID for which the help command URL be set. + + @param aCommand + specifies the help command for the menu item. + */ + void setHelpCommand( [in] short nItemId, + [in] string aCommand ); + + /** retrieves the help command string for the menu item. + + @param nItemId + specifies the menu item ID for which the help command should be set. + + @return + the help command of the menu item. + */ + string getHelpCommand( [in] short nItemId ); + + /** sets the help text for the menu item. + + @param nItemId + specifies the menu item identifier for which the help text should be set. - /** sets the pop-up menu for a specified menu item. + @param sHelpText + specifies the help text for the menu item. + */ + void setHelpText( [in] short nItemId, + [in] string sHelpText ); + + /** retrieves the help text for the menu item. + + @param nItemId + specifies the menu item identifier for which the help text should be retrieved. + + @return + a string with the help text. + */ + string getHelpText( [in] short nItemId ); + + /** sets the tip help text for the menu item. + + @param nItemId + specifies the menu item identifier for which the tip help text should be set. + + @param sTipHelpText + specifies the tip help text for the menu item. + */ + void setTipHelpText( [in] short nItemId, + [in] string sTipHelpText ); + + /** retrieves the tip help text for the menu item. + + @param nItemId + specifies the menu item identifier for which the tip help text should be retrieved. + + @return + a string with the tip help text. + */ + string getTipHelpText( [in] short nItemId ); + + /** checks whether an XMenu is an XPopupMenu. + + @return + `TRUE` if the menu is a PopupMenu, + `FALSE` if it is a MenuBar. + */ + boolean isPopupMenu(); + + /** sets the popup menu for a specified menu item. + + @param nItemId + specifies the menu item ID for which the XPopupMenu should be set. + + @param aPopupMenu + specifies a XPopupMenu. */ void setPopupMenu( [in] short nItemId, - [in] XPopupMenu aPopupMenu ); + [in] XPopupMenu aPopupMenu ); + /** returns the popup menu from the menu item. - /** returns the pop-up menu from the menu item. + @param nItemId + specifies the menu item ID for which the XPopupMenu should be retrieved. + + @return + a XPopupMenu. */ XPopupMenu getPopupMenu( [in] short nItemId ); }; - }; }; }; }; #endif diff --git a/offapi/com/sun/star/awt/XMenuBar.idl b/offapi/com/sun/star/awt/XMenuBar.idl index f0d9c172656c..0bd07d942fbb 100644 --- a/offapi/com/sun/star/awt/XMenuBar.idl +++ b/offapi/com/sun/star/awt/XMenuBar.idl @@ -21,18 +21,14 @@ #include <com/sun/star/awt/XMenu.idl> - - - module com { module sun { module star { module awt { - +module com { module sun { module star { module awt { /** identifies a menu bar. */ -published interface XMenuBar: com::sun::star::awt::XMenu +published interface XMenuBar: XMenu { }; - }; }; }; }; #endif diff --git a/offapi/com/sun/star/awt/XMenuBarExtended.idl b/offapi/com/sun/star/awt/XMenuBarExtended.idl deleted file mode 100644 index 9e2bde637ebb..000000000000 --- a/offapi/com/sun/star/awt/XMenuBarExtended.idl +++ /dev/null @@ -1,49 +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 __com_sun_star_awt_XMenuBarExtended_idl__ -#define __com_sun_star_awt_XMenuBarExtended_idl__ - -#include <com/sun/star/awt/XMenuBar.idl> -#include <com/sun/star/awt/XMenuExtended2.idl> -#include <com/sun/star/graphic/XGraphic.idl> -#include <com/sun/star/awt/Rectangle.idl> - - - module com { module sun { module star { module awt { - - interface XMenuBarButtonListener; - - -/** multiple-inheritance interface designed to ease the use of all functions - available for a com::sun::star::awt::MenuBar. - - @since OOo 3.1 - */ - interface XMenuBarExtended -{ - interface com::sun::star::awt::XMenuExtended2; - interface com::sun::star::awt::XMenuBar; -}; - - -}; }; }; }; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/awt/XMenuExtended.idl b/offapi/com/sun/star/awt/XMenuExtended.idl deleted file mode 100644 index f5d2703b026f..000000000000 --- a/offapi/com/sun/star/awt/XMenuExtended.idl +++ /dev/null @@ -1,71 +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 __com_sun_star_awt_XMenuExtended_idl__ -#define __com_sun_star_awt_XMenuExtended_idl__ - -#include <com/sun/star/uno/XInterface.idl> - - -module com { module sun { module star { module awt { - -/** specifies extended menu functions. - */ - -interface XMenuExtended: com::sun::star::uno::XInterface -{ - /** sets the command string for the menu item. - - @param nItemId - specifies the menu item ID for which the command should be set. - - @param aCommand - specifies the command for the menu item. - */ - void setCommand( [in] short nItemId, [in] string aCommand ); - - /** retrieves the command string for the menu item. - - @param nItemId - specifies the menu item ID for which the command URL should be set. - */ - string getCommand( [in] short nItemId ); - - /** sets the help command string for the menu item. - - @param nItemId - specifies the menu item ID for which the help command URL be set. - - @param HelpCommand - specifies the help command for the menu item. - */ - void setHelpCommand( [in] short nItemId, [in] string HelpCommand ); - - /** retrieves the help command string for the menu item. - - @param nItemId - specifies the menu item ID for which the help command should be set. - */ - string getHelpCommand( [in] short nItemId ); -}; - -}; }; }; }; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/awt/XMenuExtended2.idl b/offapi/com/sun/star/awt/XMenuExtended2.idl deleted file mode 100644 index 4a0cd6b4876e..000000000000 --- a/offapi/com/sun/star/awt/XMenuExtended2.idl +++ /dev/null @@ -1,93 +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 __com_sun_star_awt_XMenuExtended2_idl__ -#define __com_sun_star_awt_XMenuExtended2_idl__ - -#include <com/sun/star/awt/XMenu.idl> -#include <com/sun/star/awt/XMenuExtended.idl> -#include <com/sun/star/awt/MenuItemType.idl> -#include <com/sun/star/container/NoSuchElementException.idl> - - -module com { module sun { module star { module awt { - -/** specifies extended menu functions. - */ - -interface XMenuExtended2 -{ - /** specifies some extended menu functions, like setting a command URL and a help command for a menu item.<br> - These functions are available for both menu bar and pop-up menu. - */ - interface com::sun::star::awt::XMenuExtended; - - /** specifies basic menu functions. - */ - interface com::sun::star::awt::XMenu; - - - - /** checks whether an XMenu is an XPopupMenu. - - @return - `TRUE` if the menu is a PopupMenu, `FALSE` if it is a MenuBar. - */ - boolean isPopupMenu(); - - //......................................................................... - - /** removes all items from the menu. - */ - void clear(); - - //......................................................................... - - /** retrieves the type of the menu item. - - @param nItemPos - specifies the position of the menu item for which the item type is queried. - - @throws com::sun::star::container::NoSuchElementException - if there is no menu item in the position specified in <var>nItemPos</var>. - - @see MenuItemType - */ - ::com::sun::star::awt::MenuItemType getItemType( [in] short nItemPos ) - raises ( ::com::sun::star::container::NoSuchElementException ); - - //......................................................................... - - /** specifies whether disabled menu entries should be hidden, or not. - - @param bHide - if `TRUE`, disabled menu entries are hidden. - - @see - com::sun::star::awt::XMenu::enableItem() - */ - void hideDisabledEntries( [in] boolean bHide ); - - -}; - -}; }; }; }; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/awt/XMenuListener.idl b/offapi/com/sun/star/awt/XMenuListener.idl index 1a6f9a0df65d..ea9fc8b56495 100644 --- a/offapi/com/sun/star/awt/XMenuListener.idl +++ b/offapi/com/sun/star/awt/XMenuListener.idl @@ -20,41 +20,32 @@ #define __com_sun_star_awt_XMenuListener_idl__ #include <com/sun/star/lang/XEventListener.idl> - #include <com/sun/star/awt/MenuEvent.idl> - - - module com { module sun { module star { module awt { - +module com { module sun { module star { module awt { /** makes it possible to receive menu events on a window. */ published interface XMenuListener: com::sun::star::lang::XEventListener { - /** is invoked when a menu item is highlighted. */ - void highlight( [in] com::sun::star::awt::MenuEvent rEvent ); - + void itemHighlighted( [in] MenuEvent aEvent ); /** is invoked when a menu item is selected. */ - void select( [in] com::sun::star::awt::MenuEvent rEvent ); - + void itemSelected( [in] MenuEvent aEvent ); /** is invoked when a menu is activated. */ - void activate( [in] com::sun::star::awt::MenuEvent rEvent ); - + void itemActivated( [in] MenuEvent aEvent ); /** is invoked when a menu is deactivated. */ - void deactivate( [in] com::sun::star::awt::MenuEvent rEvent ); + void itemDeactivated( [in] MenuEvent aEvent ); }; - }; }; }; }; #endif diff --git a/offapi/com/sun/star/awt/XPopupMenu.idl b/offapi/com/sun/star/awt/XPopupMenu.idl index 1e0ef33cf111..e39a1f2a25e0 100644 --- a/offapi/com/sun/star/awt/XPopupMenu.idl +++ b/offapi/com/sun/star/awt/XPopupMenu.idl @@ -19,56 +19,167 @@ #ifndef __com_sun_star_awt_XPopupMenu_idl__ #define __com_sun_star_awt_XPopupMenu_idl__ -#include <com/sun/star/awt/XMenu.idl> - +#include <com/sun/star/awt/KeyEvent.idl> #include <com/sun/star/awt/Rectangle.idl> +#include <com/sun/star/awt/XMenu.idl> +#include <com/sun/star/graphic/XGraphic.idl> +#include <com/sun/star/awt/XMenu.idl> - module com { module sun { module star { module awt { +#include <com/sun/star/awt/Rectangle.idl> - published interface XWindowPeer; +module com { module sun { module star { module awt { +published interface XWindowPeer; /** controls a pop-up menu. */ published interface XPopupMenu: XMenu { - /** inserts a separator at the specified position. - */ - void insertSeparator( [in] short nPos ); + @param nItemPos + specifies the position where the menu separator will be insterted. + */ + void insertSeparator( [in] short nItemPos ); /** sets the menu default item. + + @param nItemId + specifies the menu item identifier. */ void setDefaultItem( [in] short nItemId ); - /** returns the menu default item. + + @return + the ID of the default item. */ short getDefaultItem(); - /** sets the state of the item to be checked or unchecked. + + @param nItemId + specifies the menu item identifier. + + @param bCheck + specifies if the item is checked (`TRUE`) or unchecked (`FALSE`). */ void checkItem( [in] short nItemId, - [in] boolean bCheck ); - + [in] boolean bCheck ); /** returns whether the item is checked or unchecked. + + @param nItemId + specifies the menu item identifier. + + @return + `TRUE` if the item is checked, `FALSE` otherwise. */ boolean isItemChecked( [in] short nItemId ); + /** executes the popup menu and returns the selected item + or <code>0</code>, if cancelled. + + @param Parent + the parent window. + + @param Position + a <type>Rectangle</type> representing the coordinates system + where the popup menu should be executed. - /** executes the pop-up menu and returns the selected item - or <code>0</code>, if canceled. + @param Direction + the direction in which a popup menu will grow, as specified + by one of the PopupMenuDirection constants. + + @return + returns the selected item or <code>0</code>, if cancelled. */ short execute( [in] XWindowPeer Parent, - [in] Rectangle Area, - [in] short Direction ); + [in] Rectangle Position, + [in] short Direction ); -}; + /** queries if the PopupMenu is being. + <p>Returns `TRUE` only if the PopupMenu is being executed + as a result of invoking <member >XPopupMenu::execute()</member>; that is, + for a PopupMenu activated by a MenuBar item, + this methods returns `FALSE`.</p> + + @return + `TRUE` if the PopupMenu is being executed, + `FALSE` otherwise. + + @see <member >XPopupMenu::execute()</member> + */ + boolean isInExecute(); + + /** ends the execution of the PopupMenu. + <p><member scope="com::sun::star::awt">XPopupMenu::execute()</member> + will then return 0.</p> + + @see <member scope="com::sun::star::awt">XPopupMenu::execute()</member> + */ + void endExecute(); + + /** sets the KeyEvent for the menu item. + + <p>The KeyEvent is <b>only</b> used as a container to transport + the shortcut information, this methods only draws the text corresponding to + this keyboard shortcut. The client code is responsible for listening to + keyboard events (typicaly done via XUserInputInterception), + and dispatch the respective command.</p> + + @param nItemId + specifies the menu item identifier for which the KeyEvent should be set. + + @param aKeyEvent + specifies the KeyEvent for the menu item. + */ + void setAcceleratorKeyEvent( [in] short nItemId, + [in] KeyEvent aKeyEvent ); + + /** retrieves the KeyEvent for the menu item. + + <p>The KeyEvent is <b>only</b> used as a container to transport + the shortcut information, so that in this case + <member scope="::com::sun::star::lang::">EventObject::Source</member> is <NULL/>.</p> + + @param nItemId + specifies the menu item identifier for which the KeyEvent should be retrieved. + + @return + the KeyEvent struct assigned to the requested menu item. + */ + KeyEvent getAcceleratorKeyEvent( [in] short nItemId ); + + /** sets the image for the menu item. + + @param nItemId + specifies the menu item identifier for which the image should be set. + + @param xGraphic + specifies the image for the menu item. + + @param bScale + if `TRUE`, the image will be scaled to the standard size used internally by + the implementation. + */ + void setItemImage( [in] short nItemId, + [in] ::com::sun::star::graphic::XGraphic xGraphic, + [in] boolean bScale ); + + /** retrieves the image for the menu item. + + @param nItemId + specifies the menu item identifier for which the image should be retrieved. + + @return + a XGraphic reference to the current image for the requested menu item. + */ + ::com::sun::star::graphic::XGraphic getItemImage( [in] short nItemId ); + +}; }; }; }; }; diff --git a/offapi/com/sun/star/awt/XPopupMenuExtended.idl b/offapi/com/sun/star/awt/XPopupMenuExtended.idl deleted file mode 100644 index 4508b59543f9..000000000000 --- a/offapi/com/sun/star/awt/XPopupMenuExtended.idl +++ /dev/null @@ -1,327 +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 __com_sun_star_awt_XPopupMenuExtended_idl__ -#define __com_sun_star_awt_XPopupMenuExtended_idl__ - -#include <com/sun/star/uno/XInterface.idl> -#include <com/sun/star/awt/XPopupMenu.idl> -#include <com/sun/star/awt/XMenuExtended2.idl> -#include <com/sun/star/awt/MenuLogo.idl> -#include <com/sun/star/container/NoSuchElementException.idl> -#include <com/sun/star/awt/KeyEvent.idl> -#include <com/sun/star/graphic/XGraphic.idl> - - -module com { module sun { module star { module awt { - -/** specifies extended functions for a com::sun::star::awt::PopupMenu. - - @since OOo 3.1 - */ -interface XPopupMenuExtended -{ - /** specifies basic functions for a pop-up menu. - */ - interface ::com::sun::star::awt::XPopupMenu; - - /** specifies extended menu functions, available for both - com::sun::star::awt::MenuBar and - com::sun::star::awt::PopupMenu. - */ - interface ::com::sun::star::awt::XMenuExtended2; - - - /** queries if the com::sun::star::awt::PopupMenu - is being executed as a result of invoking - com::sun::star::awt::XPopupMenu::execute(); that is, - for a PopupMenu activated by a MenuBar item, - this methods returns `FALSE`. - - @return - `TRUE` if the com::sun::star::awt::PopupMenu - is being executed, `FALSE` otherwise. - - @see com::sun::star::awt::XPopupMenu::execute() - - @since OOo 3.1 - */ - boolean isInExecute(); - - /** ends the execution of the com::sun::star::awt::PopupMenu. - com::sun::star::awt::XPopupMenu::execute() will then return 0. - - @see com::sun::star::awt::XPopupMenu::execute() - - @since OOo 3.1 - */ - void endExecute(); - - - /** sets the MenuLogo for this PopupMenu. - - @param aMenuLogo - the MenuLogo. - - @since OOo 3.1 - */ - void setLogo( [in] ::com::sun::star::awt::MenuLogo aMenuLogo ); - - /** retrieves the MenuLogo for this PopupMenu. - - @return - the MenuLogo. - - @since OOo 3.1 - */ - ::com::sun::star::awt::MenuLogo getLogo(); - - - - - /** specifies whether mnemonics are automatically assigned to menu items, or not. - - @param bEnable - if `TRUE`, mnemonics are automatically assigned to menu items. - */ - void enableAutoMnemonics( [in] boolean bEnable ); - - - - /** sets the KeyEvent for the menu item. - - <p>The KeyEvent is <b>only</b> used as a container to transport - the shortcut information, this method only draws the text corresponding to - this keyboard shortcut. The client code is responsible for listening to - keyboard events (typically done via XUserInputInterception), - and dispatch the respective command.</p> - - @param nItemId - specifies the menu item identifier for which the KeyEvent should be set. - - @param aKeyEvent - specifies the KeyEvent for the menu item. - - @throws com::sun::star::container::NoSuchElementException - if there is no menu item with the identifier specified in <var>nItemId</var>. - - @since OOo 3.1 - */ - void setAcceleratorKeyEvent( [in] short nItemId, [in] ::com::sun::star::awt::KeyEvent aKeyEvent ) - raises ( ::com::sun::star::container::NoSuchElementException ); - - /** retrieves the KeyEvent for the menu item. - - <p>The KeyEvent is <b>only</b> used as a container to transport - the shortcut information, so that in this case - ::com::sun::star::lang::::EventObject::Source is `NULL`.</p> - - @param nItemId - specifies the menu item identifier for which the KeyEvent should be retrieved. - - @return - the KeyEvent struct assigned to the requested menu item. - - @throws com::sun::star::container::NoSuchElementException - if there is no menu item with the identifier specified in <var>nItemId</var>. - - @since OOo 3.1 - */ - ::com::sun::star::awt::KeyEvent getAcceleratorKeyEvent( [in] short nItemId ) - raises ( ::com::sun::star::container::NoSuchElementException ); - - - /** sets the help text for the menu item. - - @param nItemId - specifies the menu item identifier for which the help text should be set. - - @param sHelpText - specifies the help text for the menu item. - - @throws com::sun::star::container::NoSuchElementException - if there is no menu item with the identifier specified in <var>nItemId</var>. - - @since OOo 3.1 - */ - void setHelpText( [in] short nItemId, [in] string sHelpText ) - raises ( ::com::sun::star::container::NoSuchElementException ); - - /** retrieves the help text for the menu item. - - @param nItemId - specifies the menu item identifier for which the help text should be retrieved. - - @return - a string with the help text. - - @throws com::sun::star::container::NoSuchElementException - if there is no menu item with the identifier specified in <var>nItemId</var>. - - @since OOo 3.1 - */ - string getHelpText( [in] short nItemId ) - raises ( ::com::sun::star::container::NoSuchElementException ); - - - /** sets the tip help text for the menu item. - - @param nItemId - specifies the menu item identifier for which the tip help text should be set. - - @param sTipHelpText - specifies the tip help text for the menu item. - - @throws com::sun::star::container::NoSuchElementException - if there is no menu item with the identifier specified in <var>nItemId</var>. - - @since OOo 3.1 - */ - void setTipHelpText( [in] short nItemId, [in] string sTipHelpText ) - raises ( ::com::sun::star::container::NoSuchElementException ); - - /** retrieves the tip help text for the menu item. - - @param nItemId - specifies the menu item identifier for which the tip help text should be retrieved. - - @return - a string with the tip help text. - - @throws com::sun::star::container::NoSuchElementException - if there is no menu item with the identifier specified in <var>nItemId</var>. - - @since OOo 3.1 - */ - string getTipHelpText( [in] short nItemId ) - raises ( ::com::sun::star::container::NoSuchElementException ); - - - /** sets the image for the menu item. - - @param nItemId - specifies the menu item identifier for which the image should be set. - - @param xGraphic - specifies the image for the menu item. - - @param bScale - if `TRUE`, the image will be scaled to the standard size used internally by - the implementation. - - @throws com::sun::star::container::NoSuchElementException - if there is no menu item with the identifier specified in <var>nItemId</var>. - - @since OOo 3.1 - */ - void setItemImage( [in] short nItemId, - [in] ::com::sun::star::graphic::XGraphic xGraphic, - [in] boolean bScale ) - raises ( ::com::sun::star::container::NoSuchElementException ); - - /** retrieves the image for the menu item. - - @param nItemId - specifies the menu item identifier for which the image should be retrieved. - - @return - a ::com::sun::star::graphic::::XGraphic reference - to the current image for the requested menu item. - - @throws com::sun::star::container::NoSuchElementException - if there is no menu item with the identifier specified in <var>nItemId</var>. - - @since OOo 3.1 - */ - ::com::sun::star::graphic::XGraphic getItemImage( [in] short nItemId ) - raises ( ::com::sun::star::container::NoSuchElementException ); - - //............................................................................. - - - /** sets the rotation angle of a menu item image. - - @param nItemId - specifies the menu item identifier for which the image angle should be set. - - @param nAngle - specifies the rotation angle for the menu item image. - - @throws com::sun::star::container::NoSuchElementException - if there is no menu item with the identifier specified in <var>nItemId</var>. - - @since OOo 3.1 - */ - void setItemImageAngle( [in] short nItemId, [in] long nAngle ) - raises ( ::com::sun::star::container::NoSuchElementException ); - - /** retrieves the rotation angle of a menu item image. - - @param nItemId - specifies the menu item identifier for which the rotation angle should be retrieved. - - @return the rotation angle of the menu item image, or 0 if it has no rotation. - - @throws com::sun::star::container::NoSuchElementException - if there is no menu item with the identifier specified in <var>nItemId</var>. - - @since OOo 3.1 - */ - long getItemImageAngle( [in] short nItemId ) - raises ( ::com::sun::star::container::NoSuchElementException ); - - //............................................................................. - - /** sets the mirror mode of a menu item image. - - @param nItemId - specifies the menu item identifier for which the mirror mode should be set. - - @param bMirror - if `TRUE`, the item image is mirrored. - - @throws com::sun::star::container::NoSuchElementException - if there is no menu item with the identifier specified in <var>nItemId</var>. - - @since OOo 3.1 - */ - void setItemImageMirrorMode( [in] short nItemId, [in] boolean bMirror ) - raises ( ::com::sun::star::container::NoSuchElementException ); - - /** indicates whether the menu item image is mirrored. - - @param nItemId - specifies the menu item identifier for which the image mirror mode should be checked. - - @return `TRUE` if the item image is mirrored, `FALSE` otherwise. - - @throws com::sun::star::container::NoSuchElementException - if there is no menu item with the identifier specified in <var>nItemId</var>. - - @since OOo 3.1 - */ - boolean isItemImageInMirrorMode( [in] short nItemId ) - raises ( ::com::sun::star::container::NoSuchElementException ); - -}; - -}; }; }; }; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/type_reference/offapi.rdb b/offapi/type_reference/offapi.rdb Binary files differindex 33c46854a483..9bba5b01ef32 100644 --- a/offapi/type_reference/offapi.rdb +++ b/offapi/type_reference/offapi.rdb diff --git a/qadevOOo/tests/java/ifc/frame/_XPopupMenuController.java b/qadevOOo/tests/java/ifc/frame/_XPopupMenuController.java index dc3dbdbb932d..4808dab72b11 100644 --- a/qadevOOo/tests/java/ifc/frame/_XPopupMenuController.java +++ b/qadevOOo/tests/java/ifc/frame/_XPopupMenuController.java @@ -18,7 +18,9 @@ package ifc.frame; +import com.sun.star.graphic.XGraphic; import com.sun.star.awt.XPopupMenu; +import com.sun.star.awt.KeyEvent; import com.sun.star.frame.XPopupMenuController; import lib.MultiMethodTest; @@ -54,7 +56,7 @@ public class _XPopupMenuController extends MultiMethodTest { System.out.println("enableItem called."); } - public short execute(com.sun.star.awt.XWindowPeer xWindowPeer, com.sun.star.awt.Rectangle rectangle, short param) { + public short execute(com.sun.star.awt.XWindowPeer xWindowPeer, com.sun.star.awt.Rectangle pos, short param) { System.out.println("execute called."); return 0; } @@ -126,5 +128,94 @@ public class _XPopupMenuController extends MultiMethodTest { public void setPopupMenu(short param, com.sun.star.awt.XPopupMenu xPopupMenu) { System.out.println("setPopupMenu called."); } + + public XGraphic getItemImage(short param ) { + System.out.println("getItemImage called."); + return null; + } + + public void setItemImage(short param, XGraphic param1, boolean param2 ) { + System.out.println("setItemImage called."); + } + + public KeyEvent getAcceleratorKeyEvent(short param ) { + System.out.println("getAcceleratorKeyEvent called."); + return new KeyEvent(); + } + + public void setAcceleratorKeyEvent(short param, KeyEvent param1 ) { + System.out.println("setAcceleratorKeyEvent called."); + } + + public void endExecute() { + System.out.println("endExecute called."); + } + + public boolean isInExecute() { + System.out.println("isInExecute called."); + return false; + } + + public boolean isPopupMenu() { + System.out.println("isPopupMenu called."); + return true; + } + + public String getTipHelpText(short param ) { + System.out.println("getTipHelpText called."); + return null; + } + + public void setTipHelpText(short param, String param1 ) { + System.out.println("setTipHelpText called."); + } + + public String getHelpText(short param ) { + System.out.println("getHelpText called."); + return null; + } + + public void setHelpText(short param, String param1 ) { + System.out.println("setHelpText called."); + } + + public String getHelpCommand(short param ) { + System.out.println("getHelpCommand called."); + return null; + } + + public void setHelpCommand(short param, String param1 ) { + System.out.println("setHelpCommand called."); + } + + public String getCommand(short param ) { + System.out.println("getCommand called."); + return null; + } + + public void setCommand(short param, String param1 ) { + System.out.println("setCommand called."); + } + + public void enableAutoMnemonics(boolean param ) { + System.out.println("enableAutoMnemonics called."); + } + + public void hideDisabledEntries(boolean param ) { + System.out.println("hideDisabledEntries called."); + } + + public com.sun.star.awt.MenuItemType getItemType(short param ) { + System.out.println("getItemType called."); + return com.sun.star.awt.MenuItemType.DONTKNOW; + } + + public void setItemType(com.sun.star.awt.MenuItemType param ) { + System.out.println("setItemType called."); + } + + public void clear() { + System.out.println("clear called."); + } } } diff --git a/svtools/source/uno/popupmenucontrollerbase.cxx b/svtools/source/uno/popupmenucontrollerbase.cxx index 41d24b678c7f..a29dd2e201fa 100644 --- a/svtools/source/uno/popupmenucontrollerbase.cxx +++ b/svtools/source/uno/popupmenucontrollerbase.cxx @@ -24,7 +24,6 @@ #include <com/sun/star/awt/MenuItemStyle.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/lang/DisposedException.hpp> -#include <com/sun/star/awt/XMenuExtended.hpp> #include <com/sun/star/util/URLTransformer.hpp> #include <vcl/menu.hxx> @@ -85,14 +84,7 @@ void PopupMenuControllerBase::resetPopupMenu( com::sun::star::uno::Reference< co { if ( rPopupMenu.is() && rPopupMenu->getItemCount() > 0 ) { - VCLXPopupMenu* pPopupMenu = (VCLXPopupMenu *)VCLXMenu::GetImplementation( rPopupMenu ); - if ( pPopupMenu ) - { - SolarMutexGuard aSolarMutexGuard; - - PopupMenu* pVCLPopupMenu = (PopupMenu *)pPopupMenu->GetMenu(); - pVCLPopupMenu->Clear(); - } + rPopupMenu->clear(); } } @@ -129,7 +121,7 @@ void SAL_CALL PopupMenuControllerBase::disposing( const EventObject& ) throw ( R } // XMenuListener -void SAL_CALL PopupMenuControllerBase::highlight( const awt::MenuEvent& ) throw (RuntimeException) +void SAL_CALL PopupMenuControllerBase::itemHighlighted( const awt::MenuEvent& ) throw (RuntimeException) { } @@ -141,17 +133,16 @@ void PopupMenuControllerBase::impl_select(const Reference< XDispatch >& _xDispat _xDispatch->dispatch( aURL, aArgs ); } -void SAL_CALL PopupMenuControllerBase::select( const awt::MenuEvent& rEvent ) throw (RuntimeException) +void SAL_CALL PopupMenuControllerBase::itemSelected( const awt::MenuEvent& rEvent ) throw (RuntimeException) { throwIfDisposed(); osl::MutexGuard aLock( m_aMutex ); - Reference< awt::XMenuExtended > xExtMenu( m_xPopupMenu, UNO_QUERY ); - if( xExtMenu.is() ) + if( m_xPopupMenu.is() ) { Sequence<PropertyValue> aArgs; - dispatchCommand( xExtMenu->getCommand( rEvent.MenuId ), aArgs ); + dispatchCommand( m_xPopupMenu->getCommand( rEvent.MenuId ), aArgs ); } } @@ -186,11 +177,11 @@ IMPL_STATIC_LINK_NOINSTANCE( PopupMenuControllerBase, ExecuteHdl_Impl, PopupMenu return 0; } -void SAL_CALL PopupMenuControllerBase::activate( const awt::MenuEvent& ) throw (RuntimeException) +void SAL_CALL PopupMenuControllerBase::itemActivated( const awt::MenuEvent& ) throw (RuntimeException) { } -void SAL_CALL PopupMenuControllerBase::deactivate( const awt::MenuEvent& ) throw (RuntimeException) +void SAL_CALL PopupMenuControllerBase::itemDeactivated( const awt::MenuEvent& ) throw (RuntimeException) { } diff --git a/svx/source/tbxctrls/extrusioncontrols.cxx b/svx/source/tbxctrls/extrusioncontrols.cxx index cef5f887031e..38ca5144011c 100644 --- a/svx/source/tbxctrls/extrusioncontrols.cxx +++ b/svx/source/tbxctrls/extrusioncontrols.cxx @@ -20,11 +20,6 @@ #include <string> -#include <com/sun/star/util/XURLTransformer.hpp> -#include <com/sun/star/awt/MenuItemStyle.hpp> -#include <com/sun/star/awt/XPopupMenuExtended.hpp> -#include <com/sun/star/graphic/XGraphic.hpp> - #include <osl/mutex.hxx> #include <svtools/toolbarmenu.hxx> diff --git a/toolkit/source/awt/vclxmenu.cxx b/toolkit/source/awt/vclxmenu.cxx index cc8f39b39ff6..74e5a277d933 100644 --- a/toolkit/source/awt/vclxmenu.cxx +++ b/toolkit/source/awt/vclxmenu.cxx @@ -18,10 +18,11 @@ */ #include <toolkit/awt/vclxmenu.hxx> +#include <toolkit/helper/convert.hxx> #include <toolkit/helper/macros.hxx> #include <toolkit/helper/servicenames.hxx> #include <toolkit/helper/vclunohelper.hxx> -#include <toolkit/helper/convert.hxx> + #include <cppuhelper/typeprovider.hxx> #include <rtl/uuid.h> #include <osl/mutex.hxx> @@ -29,53 +30,27 @@ #include <vcl/menu.hxx> #include <vcl/keycod.hxx> #include <vcl/image.hxx> +#include <vcl/keycod.hxx> +#include <vcl/menu.hxx> #include <vcl/mnemonic.hxx> #include <vcl/svapp.hxx> #include <com/sun/star/awt/KeyModifier.hpp> - -#ifdef DBG_UTIL - #define THROW_MENUITEM_NOT_FOUND( Func, nItemId ) \ - if ( MENU_ITEM_NOTFOUND == mpMenu->GetItemPos( nItemId ) ) \ - throw ::com::sun::star::container::NoSuchElementException( \ - Func \ - ": There is no menu item with " \ - + OUString::valueOf( sal_Int32( nItemId ) ) \ - + " as identifier", \ - *this \ - ); - #define THROW_MENUPOS_NOT_FOUND( Func, nPos ) \ - if ( MENU_ITEM_NOTFOUND == sal_uInt16( nPos ) ) \ - throw ::com::sun::star::container::NoSuchElementException( \ - Func \ - ": There is no menu item at position " \ - + OUString::valueOf( sal_Int32( nPos ) ), \ - *this \ - ); -#else - #define THROW_MENUITEM_NOT_FOUND( Func, nItemId ) \ - if ( MENU_ITEM_NOTFOUND == mpMenu->GetItemPos( nItemId ) ) \ - throw ::com::sun::star::container::NoSuchElementException(); - #define THROW_MENUPOS_NOT_FOUND( Func, nPos ) \ - if ( MENU_ITEM_NOTFOUND == sal_uInt16( nPos ) ) \ - throw ::com::sun::star::container::NoSuchElementException(); -#endif - - -// ---------------------------------------------------- -// class VCLXMenu -// ---------------------------------------------------- +using rtl::OUString; +using rtl::OUStringBuffer; DBG_NAME(VCLXMenu) -VCLXMenu::VCLXMenu() : maMenuListeners( *this ) +VCLXMenu::VCLXMenu() + : maMenuListeners( *this ) { DBG_CTOR( VCLXMenu, 0 ); mpMenu = NULL; } -VCLXMenu::VCLXMenu( Menu* pMenu ) : maMenuListeners( *this ) +VCLXMenu::VCLXMenu( Menu* pMenu ) + : maMenuListeners( *this ) { DBG_CTOR( VCLXMenu, 0 ); mpMenu = pMenu; @@ -127,10 +102,10 @@ IMPL_LINK( VCLXMenu, MenuEventListener, VclSimpleEvent*, pEvent ) { if ( maMenuListeners.getLength() ) { - ::com::sun::star::awt::MenuEvent aEvent; + css::awt::MenuEvent aEvent; aEvent.Source = (::cppu::OWeakObject*)this; aEvent.MenuId = mpMenu->GetCurItemId(); - maMenuListeners.select( aEvent ); + maMenuListeners.itemSelected( aEvent ); } } break; @@ -143,10 +118,10 @@ IMPL_LINK( VCLXMenu, MenuEventListener, VclSimpleEvent*, pEvent ) { if ( maMenuListeners.getLength() ) { - ::com::sun::star::awt::MenuEvent aEvent; + css::awt::MenuEvent aEvent; aEvent.Source = (::cppu::OWeakObject*)this; aEvent.MenuId = mpMenu->GetCurItemId(); - maMenuListeners.highlight( aEvent ); + maMenuListeners.itemHighlighted( aEvent ); } } break; @@ -154,10 +129,10 @@ IMPL_LINK( VCLXMenu, MenuEventListener, VclSimpleEvent*, pEvent ) { if ( maMenuListeners.getLength() ) { - ::com::sun::star::awt::MenuEvent aEvent; + css::awt::MenuEvent aEvent; aEvent.Source = (::cppu::OWeakObject*)this; aEvent.MenuId = mpMenu->GetCurItemId(); - maMenuListeners.activate( aEvent ); + maMenuListeners.itemActivated( aEvent ); } } break; @@ -165,10 +140,10 @@ IMPL_LINK( VCLXMenu, MenuEventListener, VclSimpleEvent*, pEvent ) { if ( maMenuListeners.getLength() ) { - ::com::sun::star::awt::MenuEvent aEvent; + css::awt::MenuEvent aEvent; aEvent.Source = (::cppu::OWeakObject*)this; aEvent.MenuId = mpMenu->GetCurItemId(); - maMenuListeners.deactivate( aEvent ); + maMenuListeners.itemDeactivated( aEvent ); } } break; @@ -197,14 +172,8 @@ IMPL_LINK( VCLXMenu, MenuEventListener, VclSimpleEvent*, pEvent ) } -//============================================================================= -//============================================================================= -//============================================================================= - - -// ::com::sun::star::lang::XServiceInfo OUString SAL_CALL VCLXMenu::getImplementationName( ) -throw (::com::sun::star::uno::RuntimeException) +throw (css::uno::RuntimeException) { ::osl::ResettableGuard < ::osl::Mutex > aGuard( GetMutex() ); const sal_Bool bIsPopupMenu = IsPopupMenu(); @@ -219,15 +188,14 @@ throw (::com::sun::star::uno::RuntimeException) return implName; } - -::com::sun::star::uno::Sequence< OUString > SAL_CALL VCLXMenu::getSupportedServiceNames( ) -throw (::com::sun::star::uno::RuntimeException) +css::uno::Sequence< OUString > SAL_CALL VCLXMenu::getSupportedServiceNames( ) +throw (css::uno::RuntimeException) { ::osl::ResettableGuard < ::osl::Mutex > aGuard( GetMutex() ); const sal_Bool bIsPopupMenu = IsPopupMenu(); aGuard.clear(); - ::com::sun::star::uno::Sequence< OUString > aNames( 1 ); + css::uno::Sequence< OUString > aNames( 1 ); if ( bIsPopupMenu ) aNames[ 0 ] = OUString::createFromAscii( szServiceName2_PopupMenu ); else @@ -237,10 +205,11 @@ throw (::com::sun::star::uno::RuntimeException) } -::sal_Bool SAL_CALL VCLXMenu::supportsService( const OUString& rServiceName ) -throw (::com::sun::star::uno::RuntimeException) +::sal_Bool SAL_CALL VCLXMenu::supportsService( + const OUString& rServiceName ) +throw (css::uno::RuntimeException) { - ::com::sun::star::uno::Sequence< OUString > aServiceNames( getSupportedServiceNames() ); + css::uno::Sequence< OUString > aServiceNames( getSupportedServiceNames() ); if ( aServiceNames[ 0 ] == rServiceName ) return sal_True; @@ -249,46 +218,39 @@ throw (::com::sun::star::uno::RuntimeException) } -// ::com::sun::star::uno::XInterface -::com::sun::star::uno::Any VCLXMenu::queryInterface( const ::com::sun::star::uno::Type & rType ) -throw(::com::sun::star::uno::RuntimeException) +css::uno::Any VCLXMenu::queryInterface( + const css::uno::Type & rType ) +throw(css::uno::RuntimeException) { ::osl::ResettableGuard < ::osl::Mutex > aGuard( GetMutex() ); const sal_Bool bIsPopupMenu = IsPopupMenu(); aGuard.clear(); - ::com::sun::star::uno::Any aRet; + css::uno::Any aRet; if ( bIsPopupMenu ) aRet = ::cppu::queryInterface( rType, - (static_cast< ::com::sun::star::awt::XMenu* >((::com::sun::star::awt::XMenuBar*) this) ), - (static_cast< ::com::sun::star::awt::XPopupMenu* >(this)), - (static_cast< ::com::sun::star::awt::XPopupMenuExtended* >(this)), - (static_cast< ::com::sun::star::awt::XMenuExtended* >((::com::sun::star::awt::XPopupMenuExtended*) this) ), - (static_cast< ::com::sun::star::awt::XMenuExtended2* >((::com::sun::star::awt::XPopupMenuExtended*) this) ), - (static_cast< ::com::sun::star::lang::XTypeProvider* >(this)), - (static_cast< ::com::sun::star::lang::XServiceInfo* >(this)), - (static_cast< ::com::sun::star::lang::XUnoTunnel* >(this)) ); + (static_cast< css::awt::XMenu* >((css::awt::XMenuBar*) this) ), + (static_cast< css::awt::XPopupMenu* >(this)), + (static_cast< css::lang::XTypeProvider* >(this)), + (static_cast< css::lang::XServiceInfo* >(this)), + (static_cast< css::lang::XUnoTunnel* >(this)) ); else aRet = ::cppu::queryInterface( rType, - (static_cast< ::com::sun::star::awt::XMenu* >((::com::sun::star::awt::XMenuBar*) this) ), - (static_cast< ::com::sun::star::awt::XMenuBar* >(this)), - (static_cast< ::com::sun::star::awt::XMenuBarExtended* >(this)), - (static_cast< ::com::sun::star::awt::XMenuExtended* >((::com::sun::star::awt::XMenuBarExtended*) this) ), - (static_cast< ::com::sun::star::awt::XMenuExtended2* >((::com::sun::star::awt::XMenuBarExtended*) this) ), - (static_cast< ::com::sun::star::lang::XTypeProvider* >(this)), - (static_cast< ::com::sun::star::lang::XServiceInfo* >(this)), - (static_cast< ::com::sun::star::lang::XUnoTunnel* >(this)) ); + (static_cast< css::awt::XMenu* >((css::awt::XMenuBar*) this) ), + (static_cast< css::awt::XMenuBar* >(this)), + (static_cast< css::lang::XTypeProvider* >(this)), + (static_cast< css::lang::XServiceInfo* >(this)), + (static_cast< css::lang::XUnoTunnel* >(this)) ); return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType )); } -// ::com::sun::star::lang::XUnoTunnel + IMPL_XUNOTUNNEL( VCLXMenu ) -// ::com::sun::star::lang::XTypeProvider -::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > VCLXMenu::getTypes() -throw(::com::sun::star::uno::RuntimeException) +css::uno::Sequence< css::uno::Type > VCLXMenu::getTypes() +throw(css::uno::RuntimeException) { ::osl::ResettableGuard < ::osl::Mutex > aGuard( GetMutex() ); const sal_Bool bIsPopupMenu = IsPopupMenu(); @@ -305,13 +267,10 @@ throw(::com::sun::star::uno::RuntimeException) if( !pCollectionPopupMenu ) { static ::cppu::OTypeCollection collectionPopupMenu( - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenu>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenuExtended>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuExtended>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuExtended2>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XServiceInfo>* ) NULL ) ); + getCppuType( ( css::uno::Reference< css::lang::XTypeProvider>* ) NULL ), + getCppuType( ( css::uno::Reference< css::awt::XMenu>* ) NULL ), + getCppuType( ( css::uno::Reference< css::awt::XPopupMenu>* ) NULL ), + getCppuType( ( css::uno::Reference< css::lang::XServiceInfo>* ) NULL ) ); pCollectionPopupMenu = &collectionPopupMenu; } } @@ -326,13 +285,10 @@ throw(::com::sun::star::uno::RuntimeException) if( !pCollectionMenuBar ) { static ::cppu::OTypeCollection collectionMenuBar( - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenu>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBarExtended>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuExtended>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuExtended2>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XServiceInfo>* ) NULL ) ); + getCppuType( ( css::uno::Reference< css::lang::XTypeProvider>* ) NULL ), + getCppuType( ( css::uno::Reference< css::awt::XMenu>* ) NULL ), + getCppuType( ( css::uno::Reference< css::awt::XMenuBar>* ) NULL ), + getCppuType( ( css::uno::Reference< css::lang::XServiceInfo>* ) NULL ) ); pCollectionMenuBar = &collectionMenuBar; } } @@ -341,8 +297,8 @@ throw(::com::sun::star::uno::RuntimeException) } -::com::sun::star::uno::Sequence< sal_Int8 > VCLXMenu::getImplementationId() -throw(::com::sun::star::uno::RuntimeException) +css::uno::Sequence< sal_Int8 > VCLXMenu::getImplementationId() +throw(css::uno::RuntimeException) { ::osl::ResettableGuard < ::osl::Mutex > aGuard( GetMutex() ); const sal_Bool bIsPopupMenu = IsPopupMenu(); @@ -381,27 +337,30 @@ throw(::com::sun::star::uno::RuntimeException) } } - -//============================================================================= -//============================================================================= -//============================================================================= - - -void VCLXMenu::addMenuListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +void VCLXMenu::addMenuListener( + const css::uno::Reference< css::awt::XMenuListener >& rxListener ) +throw(css::uno::RuntimeException) { ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); maMenuListeners.addInterface( rxListener ); } -void VCLXMenu::removeMenuListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +void VCLXMenu::removeMenuListener( + const css::uno::Reference< css::awt::XMenuListener >& rxListener ) +throw(css::uno::RuntimeException) { ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); maMenuListeners.removeInterface( rxListener ); } -void VCLXMenu::insertItem( sal_Int16 nItemId, const OUString& aText, sal_Int16 nItemStyle, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException) +void VCLXMenu::insertItem( + sal_Int16 nItemId, + const OUString& aText, + sal_Int16 nItemStyle, + sal_Int16 nPos ) +throw(css::uno::RuntimeException) { SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -410,7 +369,10 @@ void VCLXMenu::insertItem( sal_Int16 nItemId, const OUString& aText, sal_Int16 n mpMenu->InsertItem(nItemId, aText, (MenuItemBits)nItemStyle, OString(), nPos); } -void VCLXMenu::removeItem( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException) +void VCLXMenu::removeItem( + sal_Int16 nPos, + sal_Int16 nCount ) +throw(css::uno::RuntimeException) { SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -425,7 +387,8 @@ void VCLXMenu::removeItem( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun:: } } -sal_Int16 VCLXMenu::getItemCount( ) throw(::com::sun::star::uno::RuntimeException) +sal_Int16 VCLXMenu::getItemCount( ) +throw(css::uno::RuntimeException) { SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -433,7 +396,9 @@ sal_Int16 VCLXMenu::getItemCount( ) throw(::com::sun::star::uno::RuntimeExcepti return mpMenu ? mpMenu->GetItemCount() : 0; } -sal_Int16 VCLXMenu::getItemId( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException) +sal_Int16 VCLXMenu::getItemId( + sal_Int16 nPos ) +throw(css::uno::RuntimeException) { SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -441,7 +406,9 @@ sal_Int16 VCLXMenu::getItemId( sal_Int16 nPos ) throw(::com::sun::star::uno::Run return mpMenu ? mpMenu->GetItemId( nPos ) : 0; } -sal_Int16 VCLXMenu::getItemPos( sal_Int16 nId ) throw(::com::sun::star::uno::RuntimeException) +sal_Int16 VCLXMenu::getItemPos( + sal_Int16 nId ) +throw(css::uno::RuntimeException) { SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -449,7 +416,10 @@ sal_Int16 VCLXMenu::getItemPos( sal_Int16 nId ) throw(::com::sun::star::uno::Run return mpMenu ? mpMenu->GetItemPos( nId ) : 0; } -void VCLXMenu::enableItem( sal_Int16 nItemId, sal_Bool bEnable ) throw(::com::sun::star::uno::RuntimeException) +void VCLXMenu::enableItem( + sal_Int16 nItemId, + sal_Bool bEnable ) +throw(css::uno::RuntimeException) { SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -458,7 +428,9 @@ void VCLXMenu::enableItem( sal_Int16 nItemId, sal_Bool bEnable ) throw(::com::su mpMenu->EnableItem( nItemId, bEnable ); } -sal_Bool VCLXMenu::isItemEnabled( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException) +sal_Bool VCLXMenu::isItemEnabled( + sal_Int16 nItemId ) +throw(css::uno::RuntimeException) { SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -466,7 +438,10 @@ sal_Bool VCLXMenu::isItemEnabled( sal_Int16 nItemId ) throw(::com::sun::star::un return mpMenu ? mpMenu->IsItemEnabled( nItemId ) : sal_False; } -void VCLXMenu::setItemText( sal_Int16 nItemId, const OUString& aText ) throw(::com::sun::star::uno::RuntimeException) +void VCLXMenu::setItemText( + sal_Int16 nItemId, + const OUString& aText ) +throw(css::uno::RuntimeException) { SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -475,7 +450,9 @@ void VCLXMenu::setItemText( sal_Int16 nItemId, const OUString& aText ) throw(::c mpMenu->SetItemText( nItemId, aText ); } -OUString VCLXMenu::getItemText( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException) +OUString VCLXMenu::getItemText( + sal_Int16 nItemId ) +throw(css::uno::RuntimeException) { SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -486,7 +463,10 @@ OUString VCLXMenu::getItemText( sal_Int16 nItemId ) throw(::com::sun::star::uno: return aItemText; } -void VCLXMenu::setPopupMenu( sal_Int16 nItemId, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >& rxPopupMenu ) throw(::com::sun::star::uno::RuntimeException) +void VCLXMenu::setPopupMenu( + sal_Int16 nItemId, + const css::uno::Reference< css::awt::XPopupMenu >& rxPopupMenu ) +throw(css::uno::RuntimeException) { SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -497,7 +477,7 @@ void VCLXMenu::setPopupMenu( sal_Int16 nItemId, const ::com::sun::star::uno::Ref if ( mpMenu && pVCLMenu && pVCLMenu->GetMenu() && pVCLMenu->IsPopupMenu() ) { // Selbst eine Ref halten! - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > * pNewRef = new ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > ; + css::uno::Reference< css::awt::XPopupMenu > * pNewRef = new css::uno::Reference< css::awt::XPopupMenu > ; *pNewRef = rxPopupMenu; maPopupMenuRefs.push_back( pNewRef ); @@ -505,18 +485,20 @@ void VCLXMenu::setPopupMenu( sal_Int16 nItemId, const ::com::sun::star::uno::Ref } } -::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > VCLXMenu::getPopupMenu( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException) +css::uno::Reference< css::awt::XPopupMenu > VCLXMenu::getPopupMenu( + sal_Int16 nItemId ) +throw(css::uno::RuntimeException) { SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > aRef; + css::uno::Reference< css::awt::XPopupMenu > aRef; Menu* pMenu = mpMenu ? mpMenu->GetPopupMenu( nItemId ) : NULL; if ( pMenu ) { for ( size_t n = maPopupMenuRefs.size(); n; ) { - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > * pRef = maPopupMenuRefs[ --n ]; + css::uno::Reference< css::awt::XPopupMenu > * pRef = maPopupMenuRefs[ --n ]; Menu* pM = ((VCLXMenu*)pRef->get())->GetMenu(); if ( pM == pMenu ) { @@ -534,8 +516,10 @@ void VCLXMenu::setPopupMenu( sal_Int16 nItemId, const ::com::sun::star::uno::Ref return aRef; } -// ::com::sun::star::awt::XPopupMenu -void VCLXMenu::insertSeparator( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException) +// css::awt::XPopupMenu +void VCLXMenu::insertSeparator( + sal_Int16 nPos ) +throw(css::uno::RuntimeException) { SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -544,7 +528,9 @@ void VCLXMenu::insertSeparator( sal_Int16 nPos ) throw(::com::sun::star::uno::Ru mpMenu->InsertSeparator(OString(), nPos); } -void VCLXMenu::setDefaultItem( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException) +void VCLXMenu::setDefaultItem( + sal_Int16 nItemId ) +throw(css::uno::RuntimeException) { SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -553,7 +539,8 @@ void VCLXMenu::setDefaultItem( sal_Int16 nItemId ) throw(::com::sun::star::uno:: mpMenu->SetDefaultItem( nItemId ); } -sal_Int16 VCLXMenu::getDefaultItem( ) throw(::com::sun::star::uno::RuntimeException) +sal_Int16 VCLXMenu::getDefaultItem( ) +throw(css::uno::RuntimeException) { SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -561,7 +548,10 @@ sal_Int16 VCLXMenu::getDefaultItem( ) throw(::com::sun::star::uno::RuntimeExcep return mpMenu ? mpMenu->GetDefaultItem() : 0; } -void VCLXMenu::checkItem( sal_Int16 nItemId, sal_Bool bCheck ) throw(::com::sun::star::uno::RuntimeException) +void VCLXMenu::checkItem( + sal_Int16 nItemId, + sal_Bool bCheck ) +throw(css::uno::RuntimeException) { SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -570,7 +560,9 @@ void VCLXMenu::checkItem( sal_Int16 nItemId, sal_Bool bCheck ) throw(::com::sun: mpMenu->CheckItem( nItemId, bCheck ); } -sal_Bool VCLXMenu::isItemChecked( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException) +sal_Bool VCLXMenu::isItemChecked( + sal_Int16 nItemId ) +throw(css::uno::RuntimeException) { SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -578,19 +570,30 @@ sal_Bool VCLXMenu::isItemChecked( sal_Int16 nItemId ) throw(::com::sun::star::un return mpMenu ? mpMenu->IsItemChecked( nItemId ) : sal_False; } -sal_Int16 VCLXMenu::execute( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& rxWindowPeer, const ::com::sun::star::awt::Rectangle& rArea, sal_Int16 nFlags ) throw(::com::sun::star::uno::RuntimeException) +sal_Int16 VCLXMenu::execute( + const css::uno::Reference< css::awt::XWindowPeer >& rxWindowPeer, + const css::awt::Rectangle& rPos, + sal_Int16 nFlags ) +throw(css::uno::RuntimeException) { SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); sal_Int16 nRet = 0; if ( mpMenu && IsPopupMenu() ) - nRet = ((PopupMenu*)mpMenu)->Execute( VCLUnoHelper::GetWindow( rxWindowPeer ), VCLRectangle(rArea), nFlags | POPUPMENU_NOMOUSEUPCLOSE ); + { + nRet = ((PopupMenu*)mpMenu)->Execute( VCLUnoHelper::GetWindow( rxWindowPeer ), + VCLRectangle( rPos ), + nFlags | POPUPMENU_NOMOUSEUPCLOSE ); + } return nRet; } -void SAL_CALL VCLXMenu::setCommand( sal_Int16 nItemId, const OUString& aCommand ) throw (::com::sun::star::uno::RuntimeException) +void SAL_CALL VCLXMenu::setCommand( + sal_Int16 nItemId, + const OUString& aCommand ) +throw (css::uno::RuntimeException) { SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -599,7 +602,9 @@ void SAL_CALL VCLXMenu::setCommand( sal_Int16 nItemId, const OUString& aCommand mpMenu->SetItemCommand( nItemId, aCommand ); } -OUString SAL_CALL VCLXMenu::getCommand( sal_Int16 nItemId ) throw (::com::sun::star::uno::RuntimeException) +OUString SAL_CALL VCLXMenu::getCommand( + sal_Int16 nItemId ) +throw (css::uno::RuntimeException) { SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -610,7 +615,10 @@ OUString SAL_CALL VCLXMenu::getCommand( sal_Int16 nItemId ) throw (::com::sun::s return aItemCommand; } -void SAL_CALL VCLXMenu::setHelpCommand( sal_Int16 nItemId, const OUString& aHelp ) throw (::com::sun::star::uno::RuntimeException) +void SAL_CALL VCLXMenu::setHelpCommand( + sal_Int16 nItemId, + const OUString& aHelp ) +throw (css::uno::RuntimeException) { SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -619,7 +627,9 @@ void SAL_CALL VCLXMenu::setHelpCommand( sal_Int16 nItemId, const OUString& aHelp mpMenu->SetHelpCommand( nItemId, aHelp ); } -OUString SAL_CALL VCLXMenu::getHelpCommand( sal_Int16 nItemId ) throw (::com::sun::star::uno::RuntimeException) +OUString SAL_CALL VCLXMenu::getHelpCommand( + sal_Int16 nItemId ) +throw (css::uno::RuntimeException) { SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -631,17 +641,11 @@ OUString SAL_CALL VCLXMenu::getHelpCommand( sal_Int16 nItemId ) throw (::com::su } -// ============================================================================ -// ============================================================================ -// ============================================================================ - - -// BEGIN ANONYMOUS NAMESPACE namespace { - Image lcl_XGraphic2VCLImage( - const css::uno::Reference< css::graphic::XGraphic >& xGraphic, - sal_Bool bResize ) + static Image lcl_XGraphic2VCLImage( + const css::uno::Reference< css::graphic::XGraphic >& xGraphic, + sal_Bool bResize ) { Image aImage; if ( !xGraphic.is() ) @@ -673,13 +677,9 @@ namespace return aImage; } - /** - As svtools builds after toolkit, we can not include/use - svtools/inc/acceleratorexecute.hxx - So I just copy here svt::AcceleratorExecute::st_AWTKey2VCLKey - and svt::AcceleratorExecute::st_VCLKey2AWTKey - */ - css::awt::KeyEvent lcl_VCLKey2AWTKey(const KeyCode& aVCLKey) + /** Copied from svtools/inc/acceleratorexecute.hxx */ + static css::awt::KeyEvent lcl_VCLKey2AWTKey( + const KeyCode& aVCLKey) { css::awt::KeyEvent aAWTKey; aAWTKey.Modifiers = 0; @@ -708,24 +708,19 @@ namespace return KeyCode(nKey, bShift, bMod1, bMod2, bMod3); } -} // END ANONYMOUS NAMESPACE - - -// ============================================================================ -// ============================================================================ -// ============================================================================ - +} -// XMenuExtended2 Methods -::sal_Bool SAL_CALL VCLXMenu::isPopupMenu( ) throw (::com::sun::star::uno::RuntimeException) +::sal_Bool SAL_CALL VCLXMenu::isPopupMenu( ) +throw (css::uno::RuntimeException) { SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); return IsPopupMenu(); } -void SAL_CALL VCLXMenu::clear( ) throw (::com::sun::star::uno::RuntimeException) +void SAL_CALL VCLXMenu::clear( ) +throw (css::uno::RuntimeException) { SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -734,26 +729,26 @@ void SAL_CALL VCLXMenu::clear( ) throw (::com::sun::star::uno::RuntimeException } -::com::sun::star::awt::MenuItemType SAL_CALL VCLXMenu::getItemType( ::sal_Int16 nItemPos ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) +css::awt::MenuItemType SAL_CALL VCLXMenu::getItemType( + ::sal_Int16 nItemPos ) +throw (css::uno::RuntimeException) { SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - ::com::sun::star::awt::MenuItemType aMenuItemType = - ::com::sun::star::awt::MenuItemType_DONTKNOW; + css::awt::MenuItemType aMenuItemType = + css::awt::MenuItemType_DONTKNOW; if ( mpMenu ) { - THROW_MENUPOS_NOT_FOUND( "VCLXMenu::getItemType()", nItemPos ) - aMenuItemType = ( (::com::sun::star::awt::MenuItemType) mpMenu->GetItemType( nItemPos ) ); + aMenuItemType = ( (css::awt::MenuItemType) mpMenu->GetItemType( nItemPos ) ); } return aMenuItemType; } -void SAL_CALL VCLXMenu::hideDisabledEntries( ::sal_Bool bHide ) -throw (::com::sun::star::uno::RuntimeException) +void SAL_CALL VCLXMenu::hideDisabledEntries( + ::sal_Bool bHide ) +throw (css::uno::RuntimeException) { SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -767,15 +762,8 @@ throw (::com::sun::star::uno::RuntimeException) } -// ============================================================================ -// ============================================================================ -// ============================================================================ - - -// XPopupMenuExtended Methods - ::sal_Bool SAL_CALL VCLXMenu::isInExecute( ) -throw (::com::sun::star::uno::RuntimeException) +throw (css::uno::RuntimeException) { SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -788,7 +776,7 @@ throw (::com::sun::star::uno::RuntimeException) void SAL_CALL VCLXMenu::endExecute() -throw (::com::sun::star::uno::RuntimeException) +throw (css::uno::RuntimeException) { SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -798,54 +786,9 @@ throw (::com::sun::star::uno::RuntimeException) } -void SAL_CALL VCLXMenu::setLogo( const ::com::sun::star::awt::MenuLogo& aMenuLogo ) -throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - if ( mpMenu ) - { - if ( aMenuLogo.Graphic.is() ) - { - Image aImage = lcl_XGraphic2VCLImage( aMenuLogo.Graphic, sal_False ); - MenuLogo aVCLMenuLogo; - - aVCLMenuLogo.aBitmap = aImage.GetBitmapEx(); - aVCLMenuLogo.aStartColor = Color( (sal_uInt32)(aMenuLogo.StartColor) ); - aVCLMenuLogo.aEndColor = Color( (sal_uInt32)(aMenuLogo.EndColor) ); - - mpMenu->SetLogo( aVCLMenuLogo ); - } - else - mpMenu->SetLogo(); - } -} - - -::com::sun::star::awt::MenuLogo SAL_CALL VCLXMenu::getLogo( ) -throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - ::com::sun::star::awt::MenuLogo aAWTMenuLogo; - if ( mpMenu ) - { - if ( mpMenu->HasLogo() ) - { - MenuLogo aVCLMenuLogo = mpMenu->GetLogo(); - aAWTMenuLogo.Graphic = Image(aVCLMenuLogo.aBitmap).GetXGraphic(); - aAWTMenuLogo.StartColor = aVCLMenuLogo.aStartColor.GetColor(); - aAWTMenuLogo.EndColor = aVCLMenuLogo.aEndColor.GetColor(); - } - } - return aAWTMenuLogo; -} - - -void SAL_CALL VCLXMenu::enableAutoMnemonics( ::sal_Bool bEnable ) -throw (::com::sun::star::uno::RuntimeException) +void SAL_CALL VCLXMenu::enableAutoMnemonics( + ::sal_Bool bEnable ) +throw (css::uno::RuntimeException) { SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -859,34 +802,32 @@ throw (::com::sun::star::uno::RuntimeException) } -void SAL_CALL VCLXMenu::setAcceleratorKeyEvent( ::sal_Int16 nItemId, - const ::com::sun::star::awt::KeyEvent& aKeyEvent ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) +void SAL_CALL VCLXMenu::setAcceleratorKeyEvent( + ::sal_Int16 nItemId, + const css::awt::KeyEvent& aKeyEvent ) +throw (css::uno::RuntimeException) { SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - if ( mpMenu && IsPopupMenu() ) + if ( mpMenu && IsPopupMenu() && MENU_ITEM_NOTFOUND != mpMenu->GetItemPos( nItemId ) ) { - THROW_MENUITEM_NOT_FOUND( "VCLXMenu::setAcceleratorKeyEvent()", nItemId ) KeyCode aVCLKeyCode = lcl_AWTKey2VCLKey( aKeyEvent ); mpMenu->SetAccelKey( nItemId, aVCLKeyCode ); } } -::com::sun::star::awt::KeyEvent SAL_CALL VCLXMenu::getAcceleratorKeyEvent( ::sal_Int16 nItemId ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) +css::awt::KeyEvent SAL_CALL VCLXMenu::getAcceleratorKeyEvent( + ::sal_Int16 nItemId ) +throw (css::uno::RuntimeException) { SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - ::com::sun::star::awt::KeyEvent aKeyEvent; - if ( mpMenu && IsPopupMenu() ) + css::awt::KeyEvent aKeyEvent; + if ( mpMenu && IsPopupMenu() && MENU_ITEM_NOTFOUND != mpMenu->GetItemPos( nItemId ) ) { - THROW_MENUITEM_NOT_FOUND( "VCLXMenu::getAcceleratorKeyEvent()", nItemId ) KeyCode nKeyCode = mpMenu->GetAccelKey( nItemId ); aKeyEvent = lcl_VCLKey2AWTKey( nKeyCode ); } @@ -895,32 +836,31 @@ throw ( ::com::sun::star::container::NoSuchElementException, } -void SAL_CALL VCLXMenu::setHelpText( ::sal_Int16 nItemId, const OUString& sHelpText ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) +void SAL_CALL VCLXMenu::setHelpText( + ::sal_Int16 nItemId, + const OUString& sHelpText ) +throw (css::uno::RuntimeException) { SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - if ( mpMenu && IsPopupMenu() ) + if ( mpMenu && MENU_ITEM_NOTFOUND != mpMenu->GetItemPos( nItemId ) ) { - THROW_MENUITEM_NOT_FOUND( "VCLXMenu::setHelpText()", nItemId ) mpMenu->SetHelpText( nItemId, sHelpText ); } } -OUString SAL_CALL VCLXMenu::getHelpText( ::sal_Int16 nItemId ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) +OUString SAL_CALL VCLXMenu::getHelpText( + ::sal_Int16 nItemId ) +throw (css::uno::RuntimeException) { SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); OUString sHelpText; - if ( mpMenu && IsPopupMenu() ) + if ( mpMenu && MENU_ITEM_NOTFOUND != mpMenu->GetItemPos( nItemId ) ) { - THROW_MENUITEM_NOT_FOUND( "VCLXMenu::getHelpText()", nItemId ) sHelpText = mpMenu->GetHelpText( nItemId ); } @@ -928,32 +868,31 @@ throw ( ::com::sun::star::container::NoSuchElementException, } -void SAL_CALL VCLXMenu::setTipHelpText( ::sal_Int16 nItemId, const OUString& sTipHelpText ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) +void SAL_CALL VCLXMenu::setTipHelpText( + ::sal_Int16 nItemId, + const OUString& sTipHelpText ) +throw (css::uno::RuntimeException) { SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - if ( mpMenu && IsPopupMenu() ) + if ( mpMenu && MENU_ITEM_NOTFOUND != mpMenu->GetItemPos( nItemId ) ) { - THROW_MENUITEM_NOT_FOUND( "VCLXMenu::setTipHelpText()", nItemId ) mpMenu->SetTipHelpText( nItemId, sTipHelpText ); } } -OUString SAL_CALL VCLXMenu::getTipHelpText( ::sal_Int16 nItemId ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) +OUString SAL_CALL VCLXMenu::getTipHelpText( + ::sal_Int16 nItemId ) +throw (css::uno::RuntimeException) { SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); OUString sTipHelpText; - if ( mpMenu && IsPopupMenu() ) + if ( mpMenu && MENU_ITEM_NOTFOUND != mpMenu->GetItemPos( nItemId ) ) { - THROW_MENUITEM_NOT_FOUND( "VCLXMenu::getTipHelpText()", nItemId ) sTipHelpText = mpMenu->GetTipHelpText( nItemId ); } return sTipHelpText; @@ -961,35 +900,34 @@ throw ( ::com::sun::star::container::NoSuchElementException, void SAL_CALL VCLXMenu::setItemImage( - ::sal_Int16 nItemId, - const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& xGraphic, ::sal_Bool bScale ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) + ::sal_Int16 nItemId, + const css::uno::Reference< css::graphic::XGraphic >& xGraphic, + ::sal_Bool bScale ) +throw (css::uno::RuntimeException) { SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - if ( mpMenu && IsPopupMenu() ) + if ( mpMenu && IsPopupMenu() && MENU_ITEM_NOTFOUND != mpMenu->GetItemPos( nItemId ) ) { - THROW_MENUITEM_NOT_FOUND( "VCLXMenu::setItemImage()", nItemId ) Image aImage = lcl_XGraphic2VCLImage( xGraphic, bScale ); mpMenu->SetItemImage( nItemId, aImage ); } } -::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > SAL_CALL VCLXMenu::getItemImage( ::sal_Int16 nItemId ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) +css::uno::Reference< css::graphic::XGraphic > SAL_CALL +VCLXMenu::getItemImage( + ::sal_Int16 nItemId ) +throw (css::uno::RuntimeException) { SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > rxGraphic; + css::uno::Reference< css::graphic::XGraphic > rxGraphic; - if ( mpMenu && IsPopupMenu() ) + if ( mpMenu && IsPopupMenu() && MENU_ITEM_NOTFOUND != mpMenu->GetItemPos( nItemId ) ) { - THROW_MENUITEM_NOT_FOUND( "VCLXMenu::getItemImage()", nItemId ) Image aImage = mpMenu->GetItemImage( nItemId ); if ( !!aImage ) rxGraphic = aImage.GetXGraphic(); @@ -997,75 +935,6 @@ throw ( ::com::sun::star::container::NoSuchElementException, return rxGraphic; } - -void SAL_CALL VCLXMenu::setItemImageAngle( ::sal_Int16 nItemId, ::sal_Int32 nAngle ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - if ( mpMenu && IsPopupMenu() ) - { - THROW_MENUITEM_NOT_FOUND( "VCLXMenu::setItemImageAngle()", nItemId ) - mpMenu->SetItemImageAngle( nItemId, nAngle ); - } -} - - -::sal_Int32 SAL_CALL VCLXMenu::getItemImageAngle( ::sal_Int16 nItemId ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - ::sal_Int32 nItemImageAngle( 0 ); - if ( mpMenu && IsPopupMenu() ) - { - THROW_MENUITEM_NOT_FOUND( "VCLXMenu::getItemImageAngle()", nItemId ) - nItemImageAngle = mpMenu->GetItemImageAngle( nItemId ); - } - return nItemImageAngle; -} - - -void SAL_CALL VCLXMenu::setItemImageMirrorMode( ::sal_Int16 nItemId, ::sal_Bool bMirror ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - if ( mpMenu && IsPopupMenu() ) - { - THROW_MENUITEM_NOT_FOUND( "VCLXMenu::setItemImageMirrorMode()", nItemId ) - mpMenu->SetItemImageMirrorMode( nItemId, bMirror ); - } -} - - -::sal_Bool SAL_CALL VCLXMenu::isItemImageInMirrorMode( ::sal_Int16 nItemId ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - sal_Bool bMirrorMode( sal_False ); - if ( mpMenu && IsPopupMenu() ) - { - THROW_MENUITEM_NOT_FOUND( "VCLXMenu::isItemImageInMirrorMode()", nItemId ) - bMirrorMode = mpMenu->GetItemImageMirrorMode( nItemId ); - } - return bMirrorMode; -} - - -// ---------------------------------------------------- -// class VCLXMenuBar -// ---------------------------------------------------- - DBG_NAME(VCLXMenuBar); VCLXMenuBar::VCLXMenuBar() @@ -1079,9 +948,6 @@ VCLXMenuBar::VCLXMenuBar( MenuBar* pMenuBar ) : VCLXMenu( (Menu *)pMenuBar ) DBG_CTOR( VCLXMenuBar, 0 ); } -// ---------------------------------------------------- -// class VCLXPopupMenu -// ---------------------------------------------------- DBG_NAME(VCLXPopupMenu); diff --git a/toolkit/source/helper/listenermultiplexer.cxx b/toolkit/source/helper/listenermultiplexer.cxx index 12302580bf3d..fbb34badbd6e 100644 --- a/toolkit/source/helper/listenermultiplexer.cxx +++ b/toolkit/source/helper/listenermultiplexer.cxx @@ -184,10 +184,10 @@ IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( AdjustmentListenerMultiplexer, ::com::s // class MenuListenerMultiplexer // ---------------------------------------------------- IMPL_LISTENERMULTIPLEXER_BASEMETHODS( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener ) -IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener, highlight, ::com::sun::star::awt::MenuEvent ) -IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener, select, ::com::sun::star::awt::MenuEvent ) -IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener, activate, ::com::sun::star::awt::MenuEvent ) -IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener, deactivate, ::com::sun::star::awt::MenuEvent ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener, itemHighlighted, ::com::sun::star::awt::MenuEvent ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener, itemSelected, ::com::sun::star::awt::MenuEvent ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener, itemActivated, ::com::sun::star::awt::MenuEvent ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener, itemDeactivated, ::com::sun::star::awt::MenuEvent ) // ---------------------------------------------------- // class TreeSelectionListenerMultiplexer |