1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // SMARTTAGS 25 26 #ifndef _STMENU_HXX 27 #define _STMENU_HXX 28 29 #ifndef _MENU_HXX //autogen 30 #include <vcl/menu.hxx> 31 #endif 32 33 #include <vector> 34 #include <com/sun/star/smarttags/XSmartTagAction.hpp> 35 36 #ifndef _COM_SUN_STAR_SMARTTAGS_XSTRINGKEYMAP_HPP_ 37 #include <com/sun/star/container/XStringKeyMap.hpp> 38 #endif 39 #include <com/sun/star/text/XTextRange.hpp> 40 41 class SwView; 42 43 /** Class: SwSmartTagPopup 44 45 This class contains the implementation of the smarttag popup 46 menu that is opened if a user clicks on an underlined word. 47 48 The menu is built in the constructor and the actions for each 49 menu entry are invoked in the excute-method. 50 */ 51 52 class SwSmartTagPopup : public PopupMenu 53 { 54 SwView* mpSwView; 55 com::sun::star::uno::Reference< com::sun::star::text::XTextRange > mxTextRange; 56 57 struct InvokeAction 58 { 59 com::sun::star::uno::Reference< com::sun::star::smarttags::XSmartTagAction > mxAction; 60 com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > mxSmartTagProperties; 61 sal_uInt32 mnActionID; InvokeActionSwSmartTagPopup::InvokeAction62 InvokeAction( com::sun::star::uno::Reference< com::sun::star::smarttags::XSmartTagAction > xAction, 63 com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > xSmartTagProperties, 64 sal_uInt32 nActionID ) : mxAction( xAction ), mxSmartTagProperties( xSmartTagProperties ), mnActionID( nActionID ) {} 65 }; 66 67 std::vector< InvokeAction > maInvokeActions; 68 69 using PopupMenu::Execute; 70 71 public: 72 SwSmartTagPopup( SwView* _pSwView, 73 ::com::sun::star::uno::Sequence< rtl::OUString >& rSmartTagTypes, 74 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::container::XStringKeyMap > >& rStringKeyMaps, 75 ::com::sun::star::uno::Reference< com::sun::star::text::XTextRange > xTextRange ); 76 77 sal_uInt16 Execute( const Rectangle& rPopupPos, Window* pWin ); 78 }; 79 80 #endif 81 82