xref: /trunk/main/svx/inc/svx/SmartTagCtl.hxx (revision 3334a7e6)
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 #ifndef _SVX_SMARTTAGSCONTROL_HXX
25 #define _SVX_SMARTTAGSCONTROL_HXX
26 
27 // include ---------------------------------------------------------------
28 
29 #include <tools/link.hxx>
30 #include <sfx2/mnuitem.hxx>
31 #include "svx/svxdllapi.h"
32 #include <com/sun/star/uno/Reference.hxx>
33 
34 #include <vector>
35 
36 class SfxBindings;
37 class SvxSmartTagItem;
38 class PopupMenu;
39 
40 namespace com { namespace sun { namespace star { namespace smarttags {
41     class XSmartTagAction;
42 } } } }
43 
44 namespace com { namespace sun { namespace star { namespace container {
45     class XStringKeyMap;
46 } } } }
47 
48 // class SvxFontMenuControl ----------------------------------------------
49 
50 class SVX_DLLPUBLIC SvxSmartTagsControl : public SfxMenuControl
51 {
52 private:
53     PopupMenu*                  mpMenu;
54 	Menu&			            mrParent;
55     const SvxSmartTagItem*      mpSmartTagItem;
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;
InvokeActionSvxSmartTagsControl::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 	void			FillMenu();
70     DECL_LINK( MenuSelect, PopupMenu * );
71 	virtual void	StateChanged( sal_uInt16 nSID, SfxItemState eState,
72 								  const SfxPoolItem* pState );
73 
74 public:
75 	SvxSmartTagsControl( sal_uInt16 nId, Menu&, SfxBindings& );
76 	~SvxSmartTagsControl();
77 
78 	virtual PopupMenu*  GetPopup() const;
79 	SFX_DECL_MENU_CONTROL();
80 };
81 
82 #endif
83