Update ooo320-m1
[ooovba.git] / svx / source / cui / macropg.hxx
blob31f1de9cbeb46ad6ea7cd4e6bfd912c035c03d67
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: macropg.hxx,v $
10 * $Revision: 1.11.166.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _MACROPG_HXX
31 #define _MACROPG_HXX
33 #include <sfx2/basedlgs.hxx>
34 #include <sfx2/tabdlg.hxx>
36 #include <com/sun/star/container/XNameReplace.hpp>
37 #include <com/sun/star/util/XModifiable.hpp>
38 #include <com/sun/star/beans/PropertyValue.hpp>
39 #include <com/sun/star/uno/Reference.hxx>
40 #include <svtools/macitem.hxx>
41 #ifndef _LSTBOX_HXX //autogen
42 #include <vcl/lstbox.hxx>
43 #endif
44 #include <rtl/ustring.hxx>
46 #include <hash_map>
47 #include <vector>
49 typedef ::std::hash_map< ::rtl::OUString, ::std::pair< ::rtl::OUString, ::rtl::OUString >, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > EventsHash;
51 struct EventDisplayName
53 const sal_Char* pAsciiEventName;
54 USHORT nEventResourceID;
55 EventDisplayName() : pAsciiEventName( NULL ), nEventResourceID(0) { }
56 EventDisplayName( const sal_Char* _pAsciiName, const USHORT _nResId )
57 : pAsciiEventName( _pAsciiName )
58 , nEventResourceID( _nResId )
62 typedef ::std::vector< EventDisplayName > EventDisplayNames;
64 class _SvxMacroTabPage;
65 class SvStringsDtor;
66 class SvTabListBox;
67 class Edit;
68 class String;
70 class _HeaderTabListBox;
71 class _SvxMacroTabPage_Impl;
74 class _SvxMacroTabPage : public SfxTabPage
76 #if _SOLAR__PRIVATE
77 DECL_STATIC_LINK( _SvxMacroTabPage, SelectEvent_Impl, SvTabListBox * );
78 DECL_STATIC_LINK( _SvxMacroTabPage, AssignDeleteHdl_Impl, PushButton * );
79 DECL_STATIC_LINK( _SvxMacroTabPage, DoubleClickHdl_Impl, SvTabListBox * );
81 static long GenericHandler_Impl( _SvxMacroTabPage* pThis, PushButton* pBtn );
83 #endif
84 protected:
85 _SvxMacroTabPage_Impl* mpImpl;
86 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > m_xAppEvents;
87 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > m_xDocEvents;
88 ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifiable > m_xModifiable;
89 EventsHash m_appEventsHash;
90 EventsHash m_docEventsHash;
91 bool bReadOnly, bDocModified, bAppEvents, bInitialized;
92 EventDisplayNames aDisplayNames;
94 _SvxMacroTabPage( Window* pParent, const ResId& rId, const SfxItemSet& rItemSet );
96 void EnableButtons( const String& rLanguage );
97 ::com::sun::star::uno::Any GetPropsByName( const ::rtl::OUString& eventName, EventsHash& eventsHash );
98 ::std::pair< ::rtl::OUString, ::rtl::OUString > GetPairFromAny( ::com::sun::star::uno::Any aAny );
100 public:
102 virtual ~_SvxMacroTabPage();
103 void InitResources();
105 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 );
106 virtual BOOL FillItemSet( SfxItemSet& rSet );
108 using SfxTabPage::Reset;
109 virtual void Reset();
111 void DisplayAppEvents( bool appEvents);
112 void SetReadOnly( BOOL bSet );
113 BOOL IsReadOnly() const;
116 class SvxMacroTabPage : public _SvxMacroTabPage
118 public:
119 SvxMacroTabPage(
120 Window* pParent,
121 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxDocumentFrame,
122 const SfxItemSet& rSet,
123 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > xNameReplace,
124 sal_uInt16 nSelectedIndex
126 virtual ~SvxMacroTabPage();
129 // class SvxMacroAssignDlg --------------------------------------------------
131 typedef USHORT* (*GetTabPageRanges)(); // liefert internationale Which-Werte
133 class SvxMacroAssignSingleTabDialog : public SfxModalDialog
135 public:
136 SvxMacroAssignSingleTabDialog( Window* pParent, const SfxItemSet& rOptionsSet, USHORT nUniqueId );
138 virtual ~SvxMacroAssignSingleTabDialog();
140 void SetTabPage( SfxTabPage* pTabPage );
141 // SfxTabPage* GetTabPage() const { return pPage; }
143 // OKButton* GetOKButton() const { return pOKBtn; }
144 // CancelButton* GetCancelButton() const { return pCancelBtn; }
146 private:
147 SfxViewFrame* pFrame;
149 FixedLine* pFixedLine;
151 OKButton* pOKBtn;
152 CancelButton* pCancelBtn;
153 HelpButton* pHelpBtn;
155 SfxTabPage* pPage;
156 const SfxItemSet* pOptions;
157 SfxItemSet* pOutSet;
159 #if _SOLAR__PRIVATE
160 DECL_DLLPRIVATE_LINK( OKHdl_Impl, Button * );
161 #endif
165 class SvxMacroAssignDlg : public SvxMacroAssignSingleTabDialog
167 public:
168 SvxMacroAssignDlg(
169 Window* pParent,
170 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxDocumentFrame,
171 const SfxItemSet& rSet,
172 const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace >& xNameReplace,
173 sal_uInt16 nSelectedIndex
175 virtual ~SvxMacroAssignDlg();
178 #endif