1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // SMARTTAGS 29 30 #ifndef _STMENU_HXX 31 #define _STMENU_HXX 32 33 #ifndef _MENU_HXX //autogen 34 #include <vcl/menu.hxx> 35 #endif 36 37 #include <vector> 38 #include <com/sun/star/smarttags/XSmartTagAction.hpp> 39 40 #ifndef _COM_SUN_STAR_SMARTTAGS_XSTRINGKEYMAP_HPP_ 41 #include <com/sun/star/container/XStringKeyMap.hpp> 42 #endif 43 #include <com/sun/star/text/XTextRange.hpp> 44 45 class SwView; 46 47 /** Class: SwSmartTagPopup 48 49 This class contains the implementation of the smarttag popup 50 menu that is opened if a user clicks on an underlined word. 51 52 The menu is built in the constructor and the actions for each 53 menu entry are invoked in the excute-method. 54 */ 55 56 class SwSmartTagPopup : public PopupMenu 57 { 58 SwView* mpSwView; 59 com::sun::star::uno::Reference< com::sun::star::text::XTextRange > mxTextRange; 60 61 struct InvokeAction 62 { 63 com::sun::star::uno::Reference< com::sun::star::smarttags::XSmartTagAction > mxAction; 64 com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > mxSmartTagProperties; 65 sal_uInt32 mnActionID; 66 InvokeAction( com::sun::star::uno::Reference< com::sun::star::smarttags::XSmartTagAction > xAction, 67 com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > xSmartTagProperties, 68 sal_uInt32 nActionID ) : mxAction( xAction ), mxSmartTagProperties( xSmartTagProperties ), mnActionID( nActionID ) {} 69 }; 70 71 std::vector< InvokeAction > maInvokeActions; 72 73 using PopupMenu::Execute; 74 75 public: 76 SwSmartTagPopup( SwView* _pSwView, 77 ::com::sun::star::uno::Sequence< rtl::OUString >& rSmartTagTypes, 78 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::container::XStringKeyMap > >& rStringKeyMaps, 79 ::com::sun::star::uno::Reference< com::sun::star::text::XTextRange > xTextRange ); 80 81 sal_uInt16 Execute( const Rectangle& rPopupPos, Window* pWin ); 82 }; 83 84 #endif 85 86