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 : #ifndef _MACROPG_HXX
20 : #define _MACROPG_HXX
21 :
22 : #include <sfx2/basedlgs.hxx>
23 : #include <sfx2/tabdlg.hxx>
24 :
25 : #include <com/sun/star/container/XNameReplace.hpp>
26 : #include <com/sun/star/util/XModifiable.hpp>
27 : #include <com/sun/star/beans/PropertyValue.hpp>
28 : #include <com/sun/star/uno/Reference.hxx>
29 : #include <svl/macitem.hxx>
30 : #include <vcl/lstbox.hxx>
31 : #include <rtl/ustring.hxx>
32 :
33 : #include <boost/unordered_map.hpp>
34 : #include <vector>
35 :
36 : typedef ::boost::unordered_map< ::rtl::OUString, ::std::pair< ::rtl::OUString, ::rtl::OUString >, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > EventsHash;
37 :
38 : struct EventDisplayName
39 : {
40 : const sal_Char* pAsciiEventName;
41 : sal_uInt16 nEventResourceID;
42 : EventDisplayName() : pAsciiEventName( NULL ), nEventResourceID(0) { }
43 0 : EventDisplayName( const sal_Char* _pAsciiName, const sal_uInt16 _nResId )
44 : : pAsciiEventName( _pAsciiName )
45 0 : , nEventResourceID( _nResId )
46 : {
47 0 : }
48 : };
49 : typedef ::std::vector< EventDisplayName > EventDisplayNames;
50 :
51 : class _SvxMacroTabPage;
52 : class SvTabListBox;
53 :
54 : class _SvxMacroTabPage_Impl;
55 :
56 :
57 : class _SvxMacroTabPage : public SfxTabPage
58 : {
59 : DECL_STATIC_LINK( _SvxMacroTabPage, SelectEvent_Impl, SvTabListBox * );
60 : DECL_STATIC_LINK( _SvxMacroTabPage, AssignDeleteHdl_Impl, PushButton * );
61 : DECL_STATIC_LINK( _SvxMacroTabPage, DoubleClickHdl_Impl, SvTabListBox * );
62 :
63 : static long GenericHandler_Impl( _SvxMacroTabPage* pThis, PushButton* pBtn );
64 :
65 : protected:
66 : _SvxMacroTabPage_Impl* mpImpl;
67 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > m_xAppEvents;
68 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > m_xDocEvents;
69 : ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifiable > m_xModifiable;
70 : EventsHash m_appEventsHash;
71 : EventsHash m_docEventsHash;
72 : bool bReadOnly, bDocModified, bAppEvents, bInitialized;
73 : EventDisplayNames aDisplayNames;
74 :
75 : _SvxMacroTabPage( Window* pParent, const ResId& rId, const SfxItemSet& rItemSet );
76 :
77 : void EnableButtons();
78 : ::com::sun::star::uno::Any GetPropsByName( const ::rtl::OUString& eventName, EventsHash& eventsHash );
79 : ::std::pair< ::rtl::OUString, ::rtl::OUString > GetPairFromAny( ::com::sun::star::uno::Any aAny );
80 :
81 : public:
82 :
83 : virtual ~_SvxMacroTabPage();
84 : void InitResources();
85 :
86 : 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 );
87 : virtual sal_Bool FillItemSet( SfxItemSet& rSet );
88 :
89 : using SfxTabPage::Reset;
90 : virtual void Reset();
91 :
92 : void DisplayAppEvents( bool appEvents);
93 : void SetReadOnly( sal_Bool bSet );
94 : sal_Bool IsReadOnly() const;
95 : };
96 :
97 : class SvxMacroTabPage : public _SvxMacroTabPage
98 : {
99 : public:
100 : SvxMacroTabPage(
101 : Window* pParent,
102 : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxDocumentFrame,
103 : const SfxItemSet& rSet,
104 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > xNameReplace,
105 : sal_uInt16 nSelectedIndex
106 : );
107 : virtual ~SvxMacroTabPage();
108 : };
109 :
110 : // class SvxMacroAssignDlg --------------------------------------------------
111 :
112 : typedef sal_uInt16* (*GetTabPageRanges)(); // gives international Which-values
113 :
114 : class SvxMacroAssignSingleTabDialog : public SfxModalDialog
115 : {
116 : public:
117 : SvxMacroAssignSingleTabDialog( Window* pParent, const SfxItemSet& rOptionsSet, sal_uInt16 nUniqueId );
118 :
119 : virtual ~SvxMacroAssignSingleTabDialog();
120 :
121 : void SetTabPage( SfxTabPage* pTabPage );
122 :
123 : private:
124 : FixedLine* pFixedLine;
125 :
126 : OKButton* pOKBtn;
127 : CancelButton* pCancelBtn;
128 : HelpButton* pHelpBtn;
129 :
130 : SfxTabPage* pPage;
131 : const SfxItemSet* pOptions;
132 : SfxItemSet* pOutSet;
133 :
134 : DECL_DLLPRIVATE_LINK( OKHdl_Impl, Button * );
135 : };
136 :
137 :
138 : class SvxMacroAssignDlg : public SvxMacroAssignSingleTabDialog
139 : {
140 : public:
141 : SvxMacroAssignDlg(
142 : Window* pParent,
143 : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxDocumentFrame,
144 : const SfxItemSet& rSet,
145 : const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace >& xNameReplace,
146 : sal_uInt16 nSelectedIndex
147 : );
148 : virtual ~SvxMacroAssignDlg();
149 : };
150 :
151 : #endif
152 :
153 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|