1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_CUI_SOURCE_INC_MACROPG_HXX
20 #define INCLUDED_CUI_SOURCE_INC_MACROPG_HXX
22 #include <sfx2/basedlgs.hxx>
23 #include <sfx2/tabdlg.hxx>
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>
33 #include <unordered_map>
36 typedef std::unordered_map
< OUString
, std::pair
< OUString
, OUString
>,
37 OUStringHash
, std::equal_to
< OUString
> > EventsHash
;
39 struct EventDisplayName
41 const sal_Char
* pAsciiEventName
;
42 sal_uInt16 nEventResourceID
;
43 EventDisplayName() : pAsciiEventName( NULL
), nEventResourceID(0) { }
44 EventDisplayName( const sal_Char
* _pAsciiName
, const sal_uInt16 _nResId
)
45 : pAsciiEventName( _pAsciiName
)
46 , nEventResourceID( _nResId
)
50 typedef ::std::vector
< EventDisplayName
> EventDisplayNames
;
52 class _SvxMacroTabPage
;
55 class _SvxMacroTabPage_Impl
;
58 class _SvxMacroTabPage
: public SfxTabPage
60 DECL_LINK( SelectEvent_Impl
, SvTabListBox
* );
61 DECL_LINK( AssignDeleteHdl_Impl
, PushButton
* );
62 DECL_LINK( DoubleClickHdl_Impl
, SvTabListBox
* );
64 static long GenericHandler_Impl( _SvxMacroTabPage
* pThis
, PushButton
* pBtn
);
67 _SvxMacroTabPage_Impl
* mpImpl
;
68 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameReplace
> m_xAppEvents
;
69 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameReplace
> m_xDocEvents
;
70 ::com::sun::star::uno::Reference
< ::com::sun::star::util::XModifiable
> m_xModifiable
;
71 EventsHash m_appEventsHash
;
72 EventsHash m_docEventsHash
;
73 bool bReadOnly
, bDocModified
, bAppEvents
, bInitialized
;
74 EventDisplayNames aDisplayNames
;
76 _SvxMacroTabPage( vcl::Window
* pParent
, const OString
& rID
, const OUString
& rUIXMLDescription
, const SfxItemSet
& rItemSet
);
79 static ::com::sun::star::uno::Any
GetPropsByName( const OUString
& eventName
, EventsHash
& eventsHash
);
80 static ::std::pair
< OUString
, OUString
> GetPairFromAny( ::com::sun::star::uno::Any aAny
);
84 virtual ~_SvxMacroTabPage();
85 virtual void dispose() SAL_OVERRIDE
;
88 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
);
89 virtual bool FillItemSet( SfxItemSet
* rSet
) SAL_OVERRIDE
;
91 virtual void Reset( const SfxItemSet
* ) SAL_OVERRIDE
;
93 void DisplayAppEvents( bool appEvents
);
94 void SetReadOnly( bool bSet
);
95 bool IsReadOnly() const SAL_OVERRIDE
;
98 class SvxMacroTabPage
: public _SvxMacroTabPage
102 vcl::Window
* pParent
,
103 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& _rxDocumentFrame
,
104 const SfxItemSet
& rSet
,
105 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameReplace
> xNameReplace
,
106 sal_uInt16 nSelectedIndex
110 // class SvxMacroAssignDlg --------------------------------------------------
112 typedef const sal_uInt16
* (*GetTabPageRanges
)(); // gives international Which-values
114 class SvxMacroAssignSingleTabDialog
: public SfxSingleTabDialog
117 SvxMacroAssignSingleTabDialog(vcl::Window
* pParent
, const SfxItemSet
& rOptionsSet
);
120 DECL_DLLPRIVATE_LINK( OKHdl_Impl
, Button
* );
124 class SvxMacroAssignDlg
: public SvxMacroAssignSingleTabDialog
128 vcl::Window
* pParent
,
129 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& _rxDocumentFrame
,
130 const SfxItemSet
& rSet
,
131 const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameReplace
>& xNameReplace
,
132 sal_uInt16 nSelectedIndex
138 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */