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 #pragma once
20 
21 #include <sfx2/basedlgs.hxx>
22 #include <sfx2/tabdlg.hxx>
23 
24 #include <com/sun/star/container/XNameReplace.hpp>
25 #include <com/sun/star/util/XModifiable.hpp>
26 #include <com/sun/star/uno/Reference.hxx>
27 #include <rtl/ustring.hxx>
28 
29 #include <unordered_map>
30 #include <vector>
31 
32 typedef std::unordered_map< OUString, std::pair< OUString, OUString > > EventsHash;
33 
35 {
36  const char* pAsciiEventName;
37  const char* pEventResourceID;
38  EventDisplayName(const char* pAsciiName, const char* pResId)
39  : pAsciiEventName(pAsciiName)
40  , pEventResourceID(pResId)
41  {
42  }
43 };
44 
45 class SvxMacroTabPage_;
46 class SvTabListBox;
47 
49 
50 
52 {
53  DECL_LINK( SelectEvent_Impl, weld::TreeView&, void );
54  DECL_LINK( AssignDeleteHdl_Impl, weld::Button&, void );
55  DECL_LINK( DoubleClickHdl_Impl, weld::TreeView&, bool );
56 
57  static void GenericHandler_Impl( SvxMacroTabPage_* pThis, const weld::Button* pBtn );
58 
59  css::uno::Reference< css::container::XNameReplace > m_xAppEvents;
60 protected:
61  std::unique_ptr<SvxMacroTabPage_Impl> mpImpl;
62  css::uno::Reference< css::container::XNameReplace > m_xDocEvents;
63  css::uno::Reference< css::util::XModifiable > m_xModifiable;
67  std::vector< EventDisplayName > aDisplayNames;
68 
69  SvxMacroTabPage_(weld::Container* pPage, weld::DialogController* pController, const OUString& rUIXMLDescription, const OString& rID, const SfxItemSet& rItemSet);
70 
71  void EnableButtons();
72  static css::uno::Any GetPropsByName( const OUString& eventName, EventsHash& eventsHash );
73  static std::pair< OUString, OUString > GetPairFromAny( const css::uno::Any& aAny );
74 
75 public:
76 
77  virtual ~SvxMacroTabPage_() override;
78  void InitResources();
79 
80  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 );
81  virtual bool FillItemSet( SfxItemSet* rSet ) override;
82 
83  virtual void Reset( const SfxItemSet* ) override;
84 
85  void DisplayAppEvents( bool appEvents);
86  void SetReadOnly( bool bSet );
87  bool IsReadOnly() const override;
88 };
89 
91 {
92 public:
94  weld::Container* pPage, weld::DialogController* pController,
95  const css::uno::Reference< css::frame::XFrame >& _rxDocumentFrame,
96  const SfxItemSet& rSet,
97  css::uno::Reference< css::container::XNameReplace > const & xNameReplace,
98  sal_uInt16 nSelectedIndex
99  );
100 };
101 
102 // class SvxMacroAssignDlg --------------------------------------------------
103 
104 typedef const sal_uInt16* (*GetTabPageRanges)(); // gives international Which-values
105 
107 {
108 public:
109  SvxMacroAssignSingleTabDialog(weld::Window* pParent, const SfxItemSet& rOptionsSet);
110 
111 private:
112  DECL_LINK(OKHdl_Impl, weld::Button&, void);
113 };
114 
116 {
117 public:
119  weld::Window* pParent,
120  const css::uno::Reference< css::frame::XFrame >& _rxDocumentFrame,
121  const SfxItemSet& rSet,
122  const css::uno::Reference< css::container::XNameReplace >& xNameReplace,
123  sal_uInt16 nSelectedIndex
124  );
125 };
126 
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: macropg.cxx:170
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:603
static void GenericHandler_Impl(SvxMacroTabPage_ *pThis, const weld::Button *pBtn)
Definition: macropg.cxx:383
void DisplayAppEvents(bool appEvents)
Definition: macropg.cxx:301
SvxMacroTabPage_(weld::Container *pPage, weld::DialogController *pController, const OUString &rUIXMLDescription, const OString &rID, const SfxItemSet &rItemSet)
Definition: macropg.cxx:71
DECL_LINK(OKHdl_Impl, weld::Button &, void)
SvxMacroAssignSingleTabDialog(weld::Window *pParent, const SfxItemSet &rOptionsSet)
Definition: macropg.cxx:649
const char * pAsciiEventName
Definition: macropg.hxx:36
css::uno::Reference< css::util::XModifiable > m_xModifiable
Definition: macropg.hxx:63
EventsHash m_docEventsHash
Definition: macropg.hxx:65
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:574
std::vector< EventDisplayName > aDisplayNames
Definition: macropg.hxx:67
std::unique_ptr< SvxMacroTabPage_Impl > mpImpl
Definition: macropg.hxx:61
std::unordered_map< OUString, std::pair< OUString, OUString > > EventsHash
Definition: macropg.hxx:32
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:487
static css::uno::Any GetPropsByName(const OUString &eventName, EventsHash &eventsHash)
Definition: macropg.cxx:543
DECL_LINK(SelectEvent_Impl, weld::TreeView &, void)
css::uno::Reference< css::container::XNameReplace > m_xAppEvents
Definition: macropg.hxx:59
bool IsReadOnly() const override
Definition: macropg.cxx:264
EventDisplayName(const char *pAsciiName, const char *pResId)
Definition: macropg.hxx:38
static std::pair< OUString, OUString > GetPairFromAny(const css::uno::Any &aAny)
Definition: macropg.cxx:561
void EnableButtons()
Definition: macropg.cxx:59
void SetReadOnly(bool bSet)
Definition: macropg.cxx:259
virtual ~SvxMacroTabPage_() override
Definition: macropg.cxx:81
void InitResources()
Definition: macropg.cxx:86
css::uno::Reference< css::container::XNameReplace > m_xDocEvents
Definition: macropg.hxx:62
virtual void Reset(const SfxItemSet *) override
Definition: macropg.cxx:221
EventsHash m_appEventsHash
Definition: macropg.hxx:64
const char * pEventResourceID
Definition: macropg.hxx:37