xref: /aoo41x/main/cui/source/inc/macropg.hxx (revision c4eee24d)
1*c4eee24dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*c4eee24dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*c4eee24dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*c4eee24dSAndrew Rist  * distributed with this work for additional information
6*c4eee24dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*c4eee24dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*c4eee24dSAndrew Rist  * "License"); you may not use this file except in compliance
9*c4eee24dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*c4eee24dSAndrew Rist  *
11*c4eee24dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*c4eee24dSAndrew Rist  *
13*c4eee24dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*c4eee24dSAndrew Rist  * software distributed under the License is distributed on an
15*c4eee24dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*c4eee24dSAndrew Rist  * KIND, either express or implied.  See the License for the
17*c4eee24dSAndrew Rist  * specific language governing permissions and limitations
18*c4eee24dSAndrew Rist  * under the License.
19*c4eee24dSAndrew Rist  *
20*c4eee24dSAndrew Rist  *************************************************************/
21*c4eee24dSAndrew Rist 
22*c4eee24dSAndrew Rist 
23cdf0e10cSrcweir #ifndef _MACROPG_HXX
24cdf0e10cSrcweir #define _MACROPG_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <sfx2/basedlgs.hxx>
27cdf0e10cSrcweir #include <sfx2/tabdlg.hxx>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <com/sun/star/container/XNameReplace.hpp>
30cdf0e10cSrcweir #include <com/sun/star/util/XModifiable.hpp>
31cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp>
32cdf0e10cSrcweir #include <com/sun/star/uno/Reference.hxx>
33cdf0e10cSrcweir #include <svl/macitem.hxx>
34cdf0e10cSrcweir #ifndef _LSTBOX_HXX //autogen
35cdf0e10cSrcweir #include <vcl/lstbox.hxx>
36cdf0e10cSrcweir #endif
37cdf0e10cSrcweir #include <rtl/ustring.hxx>
38cdf0e10cSrcweir 
39cdf0e10cSrcweir #include <hash_map>
40cdf0e10cSrcweir #include <vector>
41cdf0e10cSrcweir 
42cdf0e10cSrcweir typedef ::std::hash_map< ::rtl::OUString, ::std::pair< ::rtl::OUString, ::rtl::OUString >, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > EventsHash;
43cdf0e10cSrcweir 
44cdf0e10cSrcweir struct EventDisplayName
45cdf0e10cSrcweir {
46cdf0e10cSrcweir     const sal_Char* pAsciiEventName;
47cdf0e10cSrcweir     sal_uInt16          nEventResourceID;
EventDisplayNameEventDisplayName48cdf0e10cSrcweir     EventDisplayName() : pAsciiEventName( NULL ), nEventResourceID(0) { }
EventDisplayNameEventDisplayName49cdf0e10cSrcweir     EventDisplayName( const sal_Char* _pAsciiName, const sal_uInt16 _nResId )
50cdf0e10cSrcweir         : pAsciiEventName( _pAsciiName )
51cdf0e10cSrcweir         , nEventResourceID( _nResId )
52cdf0e10cSrcweir     {
53cdf0e10cSrcweir     }
54cdf0e10cSrcweir };
55cdf0e10cSrcweir typedef ::std::vector< EventDisplayName >   EventDisplayNames;
56cdf0e10cSrcweir 
57cdf0e10cSrcweir class _SvxMacroTabPage;
58cdf0e10cSrcweir class SvStringsDtor;
59cdf0e10cSrcweir class SvTabListBox;
60cdf0e10cSrcweir class Edit;
61cdf0e10cSrcweir class String;
62cdf0e10cSrcweir 
63cdf0e10cSrcweir class _HeaderTabListBox;
64cdf0e10cSrcweir class _SvxMacroTabPage_Impl;
65cdf0e10cSrcweir 
66cdf0e10cSrcweir 
67cdf0e10cSrcweir class _SvxMacroTabPage : public SfxTabPage
68cdf0e10cSrcweir {
69cdf0e10cSrcweir #if _SOLAR__PRIVATE
70cdf0e10cSrcweir 	DECL_STATIC_LINK( _SvxMacroTabPage, SelectEvent_Impl, SvTabListBox * );
71cdf0e10cSrcweir 	DECL_STATIC_LINK( _SvxMacroTabPage, AssignDeleteHdl_Impl, PushButton * );
72cdf0e10cSrcweir 	DECL_STATIC_LINK( _SvxMacroTabPage, DoubleClickHdl_Impl, SvTabListBox * );
73cdf0e10cSrcweir 
74cdf0e10cSrcweir 	static long GenericHandler_Impl( _SvxMacroTabPage* pThis, PushButton* pBtn );
75cdf0e10cSrcweir 
76cdf0e10cSrcweir #endif
77cdf0e10cSrcweir protected:
78cdf0e10cSrcweir 	_SvxMacroTabPage_Impl*		mpImpl;
79cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > m_xAppEvents;
80cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > m_xDocEvents;
81cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifiable > m_xModifiable;
82cdf0e10cSrcweir 	EventsHash m_appEventsHash;
83cdf0e10cSrcweir 	EventsHash m_docEventsHash;
84cdf0e10cSrcweir 	bool bReadOnly, bDocModified, bAppEvents, bInitialized;
85cdf0e10cSrcweir     EventDisplayNames aDisplayNames;
86cdf0e10cSrcweir 
87cdf0e10cSrcweir 								_SvxMacroTabPage( Window* pParent, const ResId& rId, const SfxItemSet& rItemSet );
88cdf0e10cSrcweir 
89cdf0e10cSrcweir 	void						EnableButtons();
90cdf0e10cSrcweir 	::com::sun::star::uno::Any 	GetPropsByName( const ::rtl::OUString& eventName, EventsHash& eventsHash );
91cdf0e10cSrcweir 	::std::pair< ::rtl::OUString, ::rtl::OUString > GetPairFromAny( ::com::sun::star::uno::Any aAny );
92cdf0e10cSrcweir 
93cdf0e10cSrcweir public:
94cdf0e10cSrcweir 
95cdf0e10cSrcweir 	virtual						~_SvxMacroTabPage();
96cdf0e10cSrcweir     void                        InitResources();
97cdf0e10cSrcweir 
98cdf0e10cSrcweir 	void						InitAndSetHandler( ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > xAppEvents, ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > xDocEvents, ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifiable > xModifiable );
99cdf0e10cSrcweir 	virtual	sal_Bool				FillItemSet( SfxItemSet& rSet );
100cdf0e10cSrcweir 
101cdf0e10cSrcweir 	using SfxTabPage::Reset;
102cdf0e10cSrcweir 	virtual	void				Reset();
103cdf0e10cSrcweir 
104cdf0e10cSrcweir 	void						DisplayAppEvents( bool appEvents);
105cdf0e10cSrcweir 	void						SetReadOnly( sal_Bool bSet );
106cdf0e10cSrcweir 	sal_Bool						IsReadOnly() const;
107cdf0e10cSrcweir };
108cdf0e10cSrcweir 
109cdf0e10cSrcweir class SvxMacroTabPage : public _SvxMacroTabPage
110cdf0e10cSrcweir {
111cdf0e10cSrcweir public:
112cdf0e10cSrcweir 	SvxMacroTabPage(
113cdf0e10cSrcweir         Window* pParent,
114cdf0e10cSrcweir         const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxDocumentFrame,
115cdf0e10cSrcweir         const SfxItemSet& rSet,
116cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > xNameReplace,
117cdf0e10cSrcweir         sal_uInt16 nSelectedIndex
118cdf0e10cSrcweir     );
119cdf0e10cSrcweir 	virtual ~SvxMacroTabPage();
120cdf0e10cSrcweir };
121cdf0e10cSrcweir 
122cdf0e10cSrcweir // class SvxMacroAssignDlg --------------------------------------------------
123cdf0e10cSrcweir 
124cdf0e10cSrcweir typedef sal_uInt16*	(*GetTabPageRanges)(); // liefert internationale Which-Werte
125cdf0e10cSrcweir 
126cdf0e10cSrcweir class SvxMacroAssignSingleTabDialog : public SfxModalDialog
127cdf0e10cSrcweir {
128cdf0e10cSrcweir public:
129cdf0e10cSrcweir 	SvxMacroAssignSingleTabDialog( Window* pParent, const SfxItemSet& rOptionsSet, sal_uInt16 nUniqueId );
130cdf0e10cSrcweir 
131cdf0e10cSrcweir 	virtual             ~SvxMacroAssignSingleTabDialog();
132cdf0e10cSrcweir 
133cdf0e10cSrcweir 	void				SetTabPage( SfxTabPage* pTabPage );
134cdf0e10cSrcweir 	// SfxTabPage*			GetTabPage() const { return pPage; }
135cdf0e10cSrcweir 
136cdf0e10cSrcweir 	// OKButton*			GetOKButton() const { return pOKBtn; }
137cdf0e10cSrcweir 	// CancelButton*		GetCancelButton() const { return pCancelBtn; }
138cdf0e10cSrcweir 
139cdf0e10cSrcweir private:
140cdf0e10cSrcweir 	SfxViewFrame*       pFrame;
141cdf0e10cSrcweir 
142cdf0e10cSrcweir 	FixedLine*			pFixedLine;
143cdf0e10cSrcweir 
144cdf0e10cSrcweir 	OKButton*			pOKBtn;
145cdf0e10cSrcweir 	CancelButton*		pCancelBtn;
146cdf0e10cSrcweir 	HelpButton*			pHelpBtn;
147cdf0e10cSrcweir 
148cdf0e10cSrcweir 	SfxTabPage*			pPage;
149cdf0e10cSrcweir 	const SfxItemSet*	pOptions;
150cdf0e10cSrcweir 	SfxItemSet*			pOutSet;
151cdf0e10cSrcweir 
152cdf0e10cSrcweir #if _SOLAR__PRIVATE
153cdf0e10cSrcweir 	DECL_DLLPRIVATE_LINK( OKHdl_Impl, Button * );
154cdf0e10cSrcweir #endif
155cdf0e10cSrcweir };
156cdf0e10cSrcweir 
157cdf0e10cSrcweir 
158cdf0e10cSrcweir class SvxMacroAssignDlg : public SvxMacroAssignSingleTabDialog
159cdf0e10cSrcweir {
160cdf0e10cSrcweir public:
161cdf0e10cSrcweir 	SvxMacroAssignDlg(
162cdf0e10cSrcweir         Window* pParent,
163cdf0e10cSrcweir         const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxDocumentFrame,
164cdf0e10cSrcweir         const SfxItemSet& rSet,
165cdf0e10cSrcweir         const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace >& xNameReplace,
166cdf0e10cSrcweir         sal_uInt16 nSelectedIndex
167cdf0e10cSrcweir     );
168cdf0e10cSrcweir 	virtual	~SvxMacroAssignDlg();
169cdf0e10cSrcweir };
170cdf0e10cSrcweir 
171cdf0e10cSrcweir #endif
172