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
33typedef std::pair<OUString, OUString> EventPair;
34typedef std::unordered_map<OUString, EventPair> EventsHash;
35
37{
38 const char* pAsciiEventName;
40 EventDisplayName(const char* pAsciiName, TranslateId pResId)
41 : pAsciiEventName(pAsciiName)
42 , pEventResourceID(pResId)
43 {
44 }
45};
46
48class SvTabListBox;
49
51
52
54{
55 DECL_LINK( SelectEvent_Impl, weld::TreeView&, void );
56 DECL_LINK( AssignDeleteHdl_Impl, weld::Button&, void );
57 DECL_LINK( DoubleClickHdl_Impl, weld::TreeView&, bool );
58 DECL_LINK( DeleteAllHdl_Impl, weld::Button&, void );
59
60 void GenericHandler_Impl(const weld::Button* pBtn);
61 const EventPair* LookupEvent(const OUString& rEventName);
62
63 css::uno::Reference< css::container::XNameReplace > m_xAppEvents;
64protected:
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 std::vector< EventDisplayName > aDisplayNames;
73
74 SvxMacroTabPage_(weld::Container* pPage, weld::DialogController* pController, const OUString& rUIXMLDescription, const OUString& rID, const SfxItemSet& rItemSet);
75
76 void EnableButtons();
77 static css::uno::Any GetPropsByName( const OUString& eventName, EventsHash& eventsHash );
78 static EventPair GetPairFromAny(const css::uno::Any& aAny);
79
80public:
81
82 virtual ~SvxMacroTabPage_() override;
83 void InitResources();
84
85 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 );
86 virtual bool FillItemSet( SfxItemSet* rSet ) override;
87
88 virtual void Reset( const SfxItemSet* ) override;
89
90 void DisplayAppEvents( bool appEvents);
91 void SetReadOnly( bool bSet );
92 bool IsReadOnly() const override;
93};
94
96{
97public:
99 weld::Container* pPage, weld::DialogController* pController,
100 const css::uno::Reference< css::frame::XFrame >& _rxDocumentFrame,
101 const SfxItemSet& rSet,
102 css::uno::Reference< css::container::XNameReplace > const & xNameReplace,
103 sal_uInt16 nSelectedIndex
104 );
105};
106
107// class SvxMacroAssignDlg --------------------------------------------------
108
109typedef WhichRangesContainer (*GetTabPageRanges)(); // gives international Which-values
110
112{
113public:
114 SvxMacroAssignSingleTabDialog(weld::Window* pParent, const SfxItemSet& rOptionsSet);
115
116private:
117 DECL_LINK(OKHdl_Impl, weld::Button&, void);
118};
119
121{
122public:
124 weld::Window* pParent,
125 const css::uno::Reference< css::frame::XFrame >& _rxDocumentFrame,
126 const SfxItemSet& rSet,
127 const css::uno::Reference< css::container::XNameReplace >& xNameReplace,
128 sal_uInt16 nSelectedIndex
129 );
130};
131
132/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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:662
DECL_LINK(OKHdl_Impl, weld::Button &, void)
SvxMacroAssignSingleTabDialog(weld::Window *pParent, const SfxItemSet &rOptionsSet)
Definition: macropg.cxx:708
static EventPair GetPairFromAny(const css::uno::Any &aAny)
Definition: macropg.cxx:619
DECL_LINK(AssignDeleteHdl_Impl, weld::Button &, void)
EventsHash m_docEventsHash
Definition: macropg.hxx:69
EventsHash m_appEventsHash
Definition: macropg.hxx:68
DECL_LINK(SelectEvent_Impl, weld::TreeView &, void)
css::uno::Reference< css::container::XNameReplace > m_xDocEvents
Definition: macropg.hxx:66
css::uno::Reference< css::util::XModifiable > m_xModifiable
Definition: macropg.hxx:67
virtual void Reset(const SfxItemSet *) override
Definition: macropg.cxx:225
void EnableButtons()
Definition: macropg.cxx:62
static css::uno::Any GetPropsByName(const OUString &eventName, EventsHash &eventsHash)
Definition: macropg.cxx:601
DECL_LINK(DoubleClickHdl_Impl, weld::TreeView &, bool)
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:542
css::uno::Reference< css::container::XNameReplace > m_xAppEvents
Definition: macropg.hxx:63
int m_nAssignedEvents
Definition: macropg.hxx:70
DECL_LINK(DeleteAllHdl_Impl, weld::Button &, void)
void GenericHandler_Impl(const weld::Button *pBtn)
Definition: macropg.cxx:411
std::vector< EventDisplayName > aDisplayNames
Definition: macropg.hxx:72
SvxMacroTabPage_(weld::Container *pPage, weld::DialogController *pController, const OUString &rUIXMLDescription, const OUString &rID, const SfxItemSet &rItemSet)
Definition: macropg.cxx:74
bool IsReadOnly() const override
Definition: macropg.cxx:268
void DisplayAppEvents(bool appEvents)
Definition: macropg.cxx:304
std::unique_ptr< SvxMacroTabPage_Impl > mpImpl
Definition: macropg.hxx:65
const EventPair * LookupEvent(const OUString &rEventName)
Definition: macropg.cxx:392
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: macropg.cxx:174
virtual ~SvxMacroTabPage_() override
Definition: macropg.cxx:85
void SetReadOnly(bool bSet)
Definition: macropg.cxx:263
void InitResources()
Definition: macropg.cxx:90
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:632
std::pair< OUString, OUString > EventPair
Definition: macropg.hxx:33
std::unordered_map< OUString, EventPair > EventsHash
Definition: macropg.hxx:34
WhichRangesContainer(* GetTabPageRanges)()
Definition: macropg.hxx:109
static SfxItemSet & rSet
EventDisplayName(const char *pAsciiName, TranslateId pResId)
Definition: macropg.hxx:40
const char * pAsciiEventName
Definition: macropg.hxx:38
TranslateId pEventResourceID
Definition: macropg.hxx:39