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/uno/Reference.hxx>
28 #include <rtl/ustring.hxx>
30 #include <unordered_map>
33 typedef std::unordered_map
< OUString
, std::pair
< OUString
, OUString
> > EventsHash
;
35 struct EventDisplayName
37 const sal_Char
* pAsciiEventName
;
38 const char* pEventResourceID
;
39 EventDisplayName(const sal_Char
* pAsciiName
, const char* pResId
)
40 : pAsciiEventName(pAsciiName
)
41 , pEventResourceID(pResId
)
45 typedef std::vector
< EventDisplayName
> EventDisplayNames
;
47 class SvxMacroTabPage_
;
50 class SvxMacroTabPage_Impl
;
53 class SvxMacroTabPage_
: public SfxTabPage
55 DECL_LINK( SelectEvent_Impl
, weld::TreeView
&, void );
56 DECL_LINK( AssignDeleteHdl_Impl
, weld::Button
&, void );
57 DECL_LINK( DoubleClickHdl_Impl
, weld::TreeView
&, bool );
59 static void GenericHandler_Impl( SvxMacroTabPage_
* pThis
, const weld::Button
* pBtn
);
61 css::uno::Reference
< css::container::XNameReplace
> m_xAppEvents
;
63 std::unique_ptr
<SvxMacroTabPage_Impl
> mpImpl
;
64 css::uno::Reference
< css::container::XNameReplace
> m_xDocEvents
;
65 css::uno::Reference
< css::util::XModifiable
> m_xModifiable
;
66 EventsHash m_appEventsHash
;
67 EventsHash m_docEventsHash
;
68 bool bDocModified
, bAppEvents
, bInitialized
;
69 EventDisplayNames aDisplayNames
;
71 SvxMacroTabPage_(weld::Container
* pPage
, weld::DialogController
* pController
, const OUString
& rUIXMLDescription
, const OString
& rID
, const SfxItemSet
& rItemSet
);
74 static css::uno::Any
GetPropsByName( const OUString
& eventName
, EventsHash
& eventsHash
);
75 static std::pair
< OUString
, OUString
> GetPairFromAny( const css::uno::Any
& aAny
);
79 virtual ~SvxMacroTabPage_() override
;
82 void InitAndSetHandler( const css::uno::Reference
< css::container::XNameReplace
>& xAppEvents
, const css::uno::Reference
< css::container::XNameReplace
>& xDocEvents
, const css::uno::Reference
< css::util::XModifiable
>& xModifiable
);
83 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
85 virtual void Reset( const SfxItemSet
* ) override
;
87 void DisplayAppEvents( bool appEvents
);
88 void SetReadOnly( bool bSet
);
89 bool IsReadOnly() const override
;
92 class SvxMacroTabPage
: public SvxMacroTabPage_
96 weld::Container
* pPage
, weld::DialogController
* pController
,
97 const css::uno::Reference
< css::frame::XFrame
>& _rxDocumentFrame
,
98 const SfxItemSet
& rSet
,
99 css::uno::Reference
< css::container::XNameReplace
> const & xNameReplace
,
100 sal_uInt16 nSelectedIndex
104 // class SvxMacroAssignDlg --------------------------------------------------
106 typedef const sal_uInt16
* (*GetTabPageRanges
)(); // gives international Which-values
108 class SvxMacroAssignSingleTabDialog
: public SfxSingleTabDialogController
111 SvxMacroAssignSingleTabDialog(weld::Window
* pParent
, const SfxItemSet
& rOptionsSet
);
114 DECL_LINK(OKHdl_Impl
, weld::Button
&, void);
117 class SvxMacroAssignDlg
: public SvxMacroAssignSingleTabDialog
121 weld::Window
* pParent
,
122 const css::uno::Reference
< css::frame::XFrame
>& _rxDocumentFrame
,
123 const SfxItemSet
& rSet
,
124 const css::uno::Reference
< css::container::XNameReplace
>& xNameReplace
,
125 sal_uInt16 nSelectedIndex
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */