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 : #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_STMENU_HXX
21 : #define INCLUDED_SW_SOURCE_UIBASE_INC_STMENU_HXX
22 :
23 : #include <vcl/menu.hxx>
24 :
25 : #include <vector>
26 : #include <com/sun/star/smarttags/XSmartTagAction.hpp>
27 :
28 : #include <com/sun/star/container/XStringKeyMap.hpp>
29 : #include <com/sun/star/text/XTextRange.hpp>
30 :
31 : class SwView;
32 :
33 : /** Class: SwSmartTagPopup
34 :
35 : This class contains the implementation of the smarttag popup
36 : menu that is opened if a user clicks on an underlined word.
37 :
38 : The menu is built in the constructor and the actions for each
39 : menu entry are invoked in the excute-method.
40 : */
41 :
42 0 : class SwSmartTagPopup : public PopupMenu
43 : {
44 : SwView* mpSwView;
45 : com::sun::star::uno::Reference< com::sun::star::text::XTextRange > mxTextRange;
46 :
47 0 : struct InvokeAction
48 : {
49 : com::sun::star::uno::Reference< com::sun::star::smarttags::XSmartTagAction > mxAction;
50 : com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > mxSmartTagProperties;
51 : sal_uInt32 mnActionID;
52 0 : InvokeAction( com::sun::star::uno::Reference< com::sun::star::smarttags::XSmartTagAction > xAction,
53 : com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > xSmartTagProperties,
54 0 : sal_uInt32 nActionID ) : mxAction( xAction ), mxSmartTagProperties( xSmartTagProperties ), mnActionID( nActionID ) {}
55 : };
56 :
57 : std::vector< InvokeAction > maInvokeActions;
58 :
59 : using PopupMenu::Execute;
60 :
61 : public:
62 : SwSmartTagPopup( SwView* _pSwView,
63 : ::com::sun::star::uno::Sequence< OUString >& rSmartTagTypes,
64 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::container::XStringKeyMap > >& rStringKeyMaps,
65 : ::com::sun::star::uno::Reference< com::sun::star::text::XTextRange > xTextRange );
66 :
67 : sal_uInt16 Execute( const Rectangle& rPopupPos, vcl::Window* pWin );
68 : };
69 :
70 : #endif
71 :
72 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|