Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _MACROPG_HXX
29 : : #define _MACROPG_HXX
30 : :
31 : : #include <sfx2/basedlgs.hxx>
32 : : #include <sfx2/tabdlg.hxx>
33 : :
34 : : #include <com/sun/star/container/XNameReplace.hpp>
35 : : #include <com/sun/star/util/XModifiable.hpp>
36 : : #include <com/sun/star/beans/PropertyValue.hpp>
37 : : #include <com/sun/star/uno/Reference.hxx>
38 : : #include <svl/macitem.hxx>
39 : : #include <vcl/lstbox.hxx>
40 : : #include <rtl/ustring.hxx>
41 : :
42 : : #include <boost/unordered_map.hpp>
43 : : #include <vector>
44 : :
45 : : typedef ::boost::unordered_map< ::rtl::OUString, ::std::pair< ::rtl::OUString, ::rtl::OUString >, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > EventsHash;
46 : :
47 : : struct EventDisplayName
48 : : {
49 : : const sal_Char* pAsciiEventName;
50 : : sal_uInt16 nEventResourceID;
51 : : EventDisplayName() : pAsciiEventName( NULL ), nEventResourceID(0) { }
52 : 0 : EventDisplayName( const sal_Char* _pAsciiName, const sal_uInt16 _nResId )
53 : : : pAsciiEventName( _pAsciiName )
54 : 0 : , nEventResourceID( _nResId )
55 : : {
56 : 0 : }
57 : : };
58 : : typedef ::std::vector< EventDisplayName > EventDisplayNames;
59 : :
60 : : class _SvxMacroTabPage;
61 : : class SvTabListBox;
62 : :
63 : : class _SvxMacroTabPage_Impl;
64 : :
65 : :
66 : : class _SvxMacroTabPage : public SfxTabPage
67 : : {
68 : : #if _SOLAR__PRIVATE
69 : : DECL_STATIC_LINK( _SvxMacroTabPage, SelectEvent_Impl, SvTabListBox * );
70 : : DECL_STATIC_LINK( _SvxMacroTabPage, AssignDeleteHdl_Impl, PushButton * );
71 : : DECL_STATIC_LINK( _SvxMacroTabPage, DoubleClickHdl_Impl, SvTabListBox * );
72 : :
73 : : static long GenericHandler_Impl( _SvxMacroTabPage* pThis, PushButton* pBtn );
74 : :
75 : : #endif
76 : : protected:
77 : : _SvxMacroTabPage_Impl* mpImpl;
78 : : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > m_xAppEvents;
79 : : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > m_xDocEvents;
80 : : ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifiable > m_xModifiable;
81 : : EventsHash m_appEventsHash;
82 : : EventsHash m_docEventsHash;
83 : : bool bReadOnly, bDocModified, bAppEvents, bInitialized;
84 : : EventDisplayNames aDisplayNames;
85 : :
86 : : _SvxMacroTabPage( Window* pParent, const ResId& rId, const SfxItemSet& rItemSet );
87 : :
88 : : void EnableButtons();
89 : : ::com::sun::star::uno::Any GetPropsByName( const ::rtl::OUString& eventName, EventsHash& eventsHash );
90 : : ::std::pair< ::rtl::OUString, ::rtl::OUString > GetPairFromAny( ::com::sun::star::uno::Any aAny );
91 : :
92 : : public:
93 : :
94 : : virtual ~_SvxMacroTabPage();
95 : : void InitResources();
96 : :
97 : : 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 );
98 : : virtual sal_Bool FillItemSet( SfxItemSet& rSet );
99 : :
100 : : using SfxTabPage::Reset;
101 : : virtual void Reset();
102 : :
103 : : void DisplayAppEvents( bool appEvents);
104 : : void SetReadOnly( sal_Bool bSet );
105 : : sal_Bool IsReadOnly() const;
106 : : };
107 : :
108 : : class SvxMacroTabPage : public _SvxMacroTabPage
109 : : {
110 : : public:
111 : : SvxMacroTabPage(
112 : : Window* pParent,
113 : : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxDocumentFrame,
114 : : const SfxItemSet& rSet,
115 : : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > xNameReplace,
116 : : sal_uInt16 nSelectedIndex
117 : : );
118 : : virtual ~SvxMacroTabPage();
119 : : };
120 : :
121 : : // class SvxMacroAssignDlg --------------------------------------------------
122 : :
123 : : typedef sal_uInt16* (*GetTabPageRanges)(); // gives international Which-values
124 : :
125 : : class SvxMacroAssignSingleTabDialog : public SfxModalDialog
126 : : {
127 : : public:
128 : : SvxMacroAssignSingleTabDialog( Window* pParent, const SfxItemSet& rOptionsSet, sal_uInt16 nUniqueId );
129 : :
130 : : virtual ~SvxMacroAssignSingleTabDialog();
131 : :
132 : : void SetTabPage( SfxTabPage* pTabPage );
133 : :
134 : : private:
135 : : SfxViewFrame* pFrame;
136 : :
137 : : FixedLine* pFixedLine;
138 : :
139 : : OKButton* pOKBtn;
140 : : CancelButton* pCancelBtn;
141 : : HelpButton* pHelpBtn;
142 : :
143 : : SfxTabPage* pPage;
144 : : const SfxItemSet* pOptions;
145 : : SfxItemSet* pOutSet;
146 : :
147 : : #if _SOLAR__PRIVATE
148 : : DECL_DLLPRIVATE_LINK( OKHdl_Impl, Button * );
149 : : #endif
150 : : };
151 : :
152 : :
153 : : class SvxMacroAssignDlg : public SvxMacroAssignSingleTabDialog
154 : : {
155 : : public:
156 : : SvxMacroAssignDlg(
157 : : Window* pParent,
158 : : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxDocumentFrame,
159 : : const SfxItemSet& rSet,
160 : : const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace >& xNameReplace,
161 : : sal_uInt16 nSelectedIndex
162 : : );
163 : : virtual ~SvxMacroAssignDlg();
164 : : };
165 : :
166 : : #endif
167 : :
168 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|