LibreOffice Module cui (master)  1
macropg.hxx
Go to the documentation of this file.
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 INCLUDED_CUI_SOURCE_INC_MACROPG_HXX
20 #define INCLUDED_CUI_SOURCE_INC_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/uno/Reference.hxx>
28 #include <rtl/ustring.hxx>
29 
30 #include <unordered_map>
31 #include <vector>
32 
34 
35 typedef std::unordered_map< OUString, std::pair< OUString, OUString > > EventsHash;
36 
38 {
40  const char* pEventResourceID;
41  EventDisplayName(const sal_Char* pAsciiName, const char* pResId)
42  : pAsciiEventName(pAsciiName)
43  , pEventResourceID(pResId)
44  {
45  }
46 };
47 typedef std::vector< EventDisplayName > EventDisplayNames;
48 
49 class SvxMacroTabPage_;
50 class SvTabListBox;
51 
53 
54 
56 {
57  DECL_LINK( SelectEvent_Impl, weld::TreeView&, void );
58  DECL_LINK( AssignDeleteHdl_Impl, weld::Button&, void );
59  DECL_LINK( DoubleClickHdl_Impl, weld::TreeView&, bool );
60 
61  static void GenericHandler_Impl( SvxMacroTabPage_* pThis, const weld::Button* pBtn );
62 
63  css::uno::Reference< css::container::XNameReplace > m_xAppEvents;
64 protected:
65  std::unique_ptr<SvxMacroTabPage_Impl> mpImpl;
66  css::uno::Reference< css::container::XNameReplace > m_xDocEvents;
67  css::uno::Reference< css::util::XModifiable > m_xModifiable;
72 
73  SvxMacroTabPage_(weld::Container* pPage, weld::DialogController* pController, const OUString& rUIXMLDescription, const OString& rID, const SfxItemSet& rItemSet);
74 
75  void EnableButtons();
76  static css::uno::Any GetPropsByName( const OUString& eventName, EventsHash& eventsHash );
77  static std::pair< OUString, OUString > GetPairFromAny( const css::uno::Any& aAny );
78 
79 public:
80 
81  virtual ~SvxMacroTabPage_() override;
82  void InitResources();
83 
84  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 );
85  virtual bool FillItemSet( SfxItemSet* rSet ) override;
86 
87  virtual void Reset( const SfxItemSet* ) override;
88 
89  void DisplayAppEvents( bool appEvents);
90  void SetReadOnly( bool bSet );
91  bool IsReadOnly() const override;
92 };
93 
95 {
96 public:
98  weld::Container* pPage, weld::DialogController* pController,
99  const css::uno::Reference< css::frame::XFrame >& _rxDocumentFrame,
100  const SfxItemSet& rSet,
101  css::uno::Reference< css::container::XNameReplace > const & xNameReplace,
102  sal_uInt16 nSelectedIndex
103  );
104 };
105 
106 // class SvxMacroAssignDlg --------------------------------------------------
107 
108 typedef const sal_uInt16* (*GetTabPageRanges)(); // gives international Which-values
109 
111 {
112 public:
113  SvxMacroAssignSingleTabDialog(weld::Window* pParent, const SfxItemSet& rOptionsSet);
114 
115 private:
116  DECL_LINK(OKHdl_Impl, weld::Button&, void);
117 };
118 
120 {
121 public:
123  weld::Window* pParent,
124  const css::uno::Reference< css::frame::XFrame >& _rxDocumentFrame,
125  const SfxItemSet& rSet,
126  const css::uno::Reference< css::container::XNameReplace >& xNameReplace,
127  sal_uInt16 nSelectedIndex
128  );
129 };
130 
131 #endif
132 
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: macropg.cxx:174
SvxMacroAssignDlg(weld::Window *pParent, const css::uno::Reference< css::frame::XFrame > &_rxDocumentFrame, const SfxItemSet &rSet, const css::uno::Reference< css::container::XNameReplace > &xNameReplace, sal_uInt16 nSelectedIndex)
Definition: macropg.cxx:615
static void GenericHandler_Impl(SvxMacroTabPage_ *pThis, const weld::Button *pBtn)
Definition: macropg.cxx:395
void DisplayAppEvents(bool appEvents)
Definition: macropg.cxx:305
SvxMacroTabPage_(weld::Container *pPage, weld::DialogController *pController, const OUString &rUIXMLDescription, const OString &rID, const SfxItemSet &rItemSet)
Definition: macropg.cxx:75
DECL_LINK(OKHdl_Impl, weld::Button &, void)
SvxMacroAssignSingleTabDialog(weld::Window *pParent, const SfxItemSet &rOptionsSet)
Definition: macropg.cxx:661
EventDisplayName(const sal_Char *pAsciiName, const char *pResId)
Definition: macropg.hxx:41
const sal_Char * pAsciiEventName
Definition: macropg.hxx:39
css::uno::Reference< css::util::XModifiable > m_xModifiable
Definition: macropg.hxx:67
EventDisplayNames aDisplayNames
Definition: macropg.hxx:71
EventsHash m_docEventsHash
Definition: macropg.hxx:69
SvxMacroTabPage(weld::Container *pPage, weld::DialogController *pController, const css::uno::Reference< css::frame::XFrame > &_rxDocumentFrame, const SfxItemSet &rSet, css::uno::Reference< css::container::XNameReplace > const &xNameReplace, sal_uInt16 nSelectedIndex)
Definition: macropg.cxx:586
char sal_Char
std::unique_ptr< SvxMacroTabPage_Impl > mpImpl
Definition: macropg.hxx:65
std::vector< EventDisplayName > EventDisplayNames
Definition: macropg.hxx:47
std::unordered_map< OUString, std::pair< OUString, OUString > > EventsHash
Definition: macropg.hxx:33
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)
Definition: macropg.cxx:499
static css::uno::Any GetPropsByName(const OUString &eventName, EventsHash &eventsHash)
Definition: macropg.cxx:555
DECL_LINK(SelectEvent_Impl, weld::TreeView &, void)
css::uno::Reference< css::container::XNameReplace > m_xAppEvents
Definition: macropg.hxx:63
bool IsReadOnly() const override
Definition: macropg.cxx:268
static std::pair< OUString, OUString > GetPairFromAny(const css::uno::Any &aAny)
Definition: macropg.cxx:573
void EnableButtons()
Definition: macropg.cxx:63
void SetReadOnly(bool bSet)
Definition: macropg.cxx:263
virtual ~SvxMacroTabPage_() override
Definition: macropg.cxx:85
void InitResources()
Definition: macropg.cxx:90
css::uno::Reference< css::container::XNameReplace > m_xDocEvents
Definition: macropg.hxx:66
virtual void Reset(const SfxItemSet *) override
Definition: macropg.cxx:225
EventsHash m_appEventsHash
Definition: macropg.hxx:68
const char * pEventResourceID
Definition: macropg.hxx:40