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 #include <unotools/resmgr.hxx>
29 
30 #include <unordered_map>
31 #include <vector>
32 
33 typedef std::unordered_map< OUString, std::pair< OUString, OUString > > EventsHash;
34 
36 {
37  const char* pAsciiEventName;
39  EventDisplayName(const char* pAsciiName, TranslateId pResId)
40  : pAsciiEventName(pAsciiName)
41  , pEventResourceID(pResId)
42  {
43  }
44 };
45 
46 class SvxMacroTabPage_;
47 class SvTabListBox;
48 
50 
51 
53 {
54  DECL_LINK( SelectEvent_Impl, weld::TreeView&, void );
55  DECL_LINK( AssignDeleteHdl_Impl, weld::Button&, void );
56  DECL_LINK( DoubleClickHdl_Impl, weld::TreeView&, bool );
57 
58  static void GenericHandler_Impl( SvxMacroTabPage_* pThis, const weld::Button* pBtn );
59 
60  css::uno::Reference< css::container::XNameReplace > m_xAppEvents;
61 protected:
62  std::unique_ptr<SvxMacroTabPage_Impl> mpImpl;
63  css::uno::Reference< css::container::XNameReplace > m_xDocEvents;
64  css::uno::Reference< css::util::XModifiable > m_xModifiable;
68  std::vector< EventDisplayName > aDisplayNames;
69 
70  SvxMacroTabPage_(weld::Container* pPage, weld::DialogController* pController, const OUString& rUIXMLDescription, const OString& rID, const SfxItemSet& rItemSet);
71 
72  void EnableButtons();
73  static css::uno::Any GetPropsByName( const OUString& eventName, EventsHash& eventsHash );
74  static std::pair< OUString, OUString > GetPairFromAny( const css::uno::Any& aAny );
75 
76 public:
77 
78  virtual ~SvxMacroTabPage_() override;
79  void InitResources();
80 
81  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 );
82  virtual bool FillItemSet( SfxItemSet* rSet ) override;
83 
84  virtual void Reset( const SfxItemSet* ) override;
85 
86  void DisplayAppEvents( bool appEvents);
87  void SetReadOnly( bool bSet );
88  bool IsReadOnly() const override;
89 };
90 
92 {
93 public:
95  weld::Container* pPage, weld::DialogController* pController,
96  const css::uno::Reference< css::frame::XFrame >& _rxDocumentFrame,
97  const SfxItemSet& rSet,
98  css::uno::Reference< css::container::XNameReplace > const & xNameReplace,
99  sal_uInt16 nSelectedIndex
100  );
101 };
102 
103 // class SvxMacroAssignDlg --------------------------------------------------
104 
105 typedef WhichRangesContainer (*GetTabPageRanges)(); // gives international Which-values
106 
108 {
109 public:
110  SvxMacroAssignSingleTabDialog(weld::Window* pParent, const SfxItemSet& rOptionsSet);
111 
112 private:
113  DECL_LINK(OKHdl_Impl, weld::Button&, void);
114 };
115 
117 {
118 public:
120  weld::Window* pParent,
121  const css::uno::Reference< css::frame::XFrame >& _rxDocumentFrame,
122  const SfxItemSet& rSet,
123  const css::uno::Reference< css::container::XNameReplace >& xNameReplace,
124  sal_uInt16 nSelectedIndex
125  );
126 };
127 
128 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: macropg.cxx:171
WhichRangesContainer(* GetTabPageRanges)()
Definition: macropg.hxx:105
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:609
static void GenericHandler_Impl(SvxMacroTabPage_ *pThis, const weld::Button *pBtn)
Definition: macropg.cxx:387
void DisplayAppEvents(bool appEvents)
Definition: macropg.cxx:302
SvxMacroTabPage_(weld::Container *pPage, weld::DialogController *pController, const OUString &rUIXMLDescription, const OString &rID, const SfxItemSet &rItemSet)
Definition: macropg.cxx:72
DECL_LINK(OKHdl_Impl, weld::Button &, void)
TranslateId pEventResourceID
Definition: macropg.hxx:38
SvxMacroAssignSingleTabDialog(weld::Window *pParent, const SfxItemSet &rOptionsSet)
Definition: macropg.cxx:655
const char * pAsciiEventName
Definition: macropg.hxx:37
css::uno::Reference< css::util::XModifiable > m_xModifiable
Definition: macropg.hxx:64
EventDisplayName(const char *pAsciiName, TranslateId pResId)
Definition: macropg.hxx:39
EventsHash m_docEventsHash
Definition: macropg.hxx:66
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:580
std::vector< EventDisplayName > aDisplayNames
Definition: macropg.hxx:68
std::unique_ptr< SvxMacroTabPage_Impl > mpImpl
Definition: macropg.hxx:62
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:491
static css::uno::Any GetPropsByName(const OUString &eventName, EventsHash &eventsHash)
Definition: macropg.cxx:549
DECL_LINK(SelectEvent_Impl, weld::TreeView &, void)
css::uno::Reference< css::container::XNameReplace > m_xAppEvents
Definition: macropg.hxx:60
bool IsReadOnly() const override
Definition: macropg.cxx:265
static std::pair< OUString, OUString > GetPairFromAny(const css::uno::Any &aAny)
Definition: macropg.cxx:567
void EnableButtons()
Definition: macropg.cxx:60
void SetReadOnly(bool bSet)
Definition: macropg.cxx:260
virtual ~SvxMacroTabPage_() override
Definition: macropg.cxx:82
void InitResources()
Definition: macropg.cxx:87
css::uno::Reference< css::container::XNameReplace > m_xDocEvents
Definition: macropg.hxx:63
virtual void Reset(const SfxItemSet *) override
Definition: macropg.cxx:222
EventsHash m_appEventsHash
Definition: macropg.hxx:65