Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : // SMARTTAGS
21 :
22 : #ifndef _STMENU_HXX
23 : #define _STMENU_HXX
24 :
25 : #include <vcl/menu.hxx>
26 :
27 : #include <vector>
28 : #include <com/sun/star/smarttags/XSmartTagAction.hpp>
29 :
30 : #include <com/sun/star/container/XStringKeyMap.hpp>
31 : #include <com/sun/star/text/XTextRange.hpp>
32 :
33 : class SwView;
34 :
35 : /** Class: SwSmartTagPopup
36 :
37 : This class contains the implementation of the smarttag popup
38 : menu that is opened if a user clicks on an underlined word.
39 :
40 : The menu is built in the constructor and the actions for each
41 : menu entry are invoked in the excute-method.
42 : */
43 :
44 0 : class SwSmartTagPopup : public PopupMenu
45 : {
46 : SwView* mpSwView;
47 : com::sun::star::uno::Reference< com::sun::star::text::XTextRange > mxTextRange;
48 :
49 0 : struct InvokeAction
50 : {
51 : com::sun::star::uno::Reference< com::sun::star::smarttags::XSmartTagAction > mxAction;
52 : com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > mxSmartTagProperties;
53 : sal_uInt32 mnActionID;
54 0 : InvokeAction( com::sun::star::uno::Reference< com::sun::star::smarttags::XSmartTagAction > xAction,
55 : com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > xSmartTagProperties,
56 0 : sal_uInt32 nActionID ) : mxAction( xAction ), mxSmartTagProperties( xSmartTagProperties ), mnActionID( nActionID ) {}
57 : };
58 :
59 : std::vector< InvokeAction > maInvokeActions;
60 :
61 : using PopupMenu::Execute;
62 :
63 : public:
64 : SwSmartTagPopup( SwView* _pSwView,
65 : ::com::sun::star::uno::Sequence< rtl::OUString >& rSmartTagTypes,
66 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::container::XStringKeyMap > >& rStringKeyMaps,
67 : ::com::sun::star::uno::Reference< com::sun::star::text::XTextRange > xTextRange );
68 :
69 : sal_uInt16 Execute( const Rectangle& rPopupPos, Window* pWin );
70 : };
71 :
72 : #endif
73 :
74 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|