LibreOffice Module sfx2 (master) 1
event.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_SFX2_EVENT_HXX
20#define INCLUDED_SFX2_EVENT_HXX
21
22#include <sal/config.h>
23
24#include <ostream>
25
26#include <sfx2/dllapi.h>
27#include <svl/hint.hxx>
28#include <unotools/eventcfg.hxx>
29#include <rtl/ustring.hxx>
30
31#include <com/sun/star/uno/Sequence.hxx>
32#include <com/sun/star/frame/XController2.hpp>
33#include <com/sun/star/view/PrintableState.hpp>
34#include <utility>
35
36namespace com::sun::star::beans { struct PropertyValue; }
37
41enum class SvMacroItemId : sal_uInt16 {
42 NONE = 0,
43
44 // used by SwHTMLForm_Impl
53
54 // used by SwHTMLParser
55 OpenDoc,
59
60 // Events for Controls etc.
61 OnMouseOver = 5100,
62 OnClick = 5101,
63 OnMouseOut = 5102,
64
65 OnImageLoadDone = 10000,
66 OnImageLoadCancel = 10001,
67 OnImageLoadError = 10002,
68
69 SwObjectSelect = 20000,
70 SwStartInsGlossary = 20001,
71 SwEndInsGlossary = 20002,
72 SwFrmKeyInputAlpha = 20004,
74 SwFrmResize = 20006,
75 SwFrmMove = 20007,
76};
77
78template< typename charT, typename traits >
79inline std::basic_ostream<charT, traits> & operator <<(
80 std::basic_ostream<charT, traits> & stream, const SvMacroItemId& id )
81{
82 switch(id)
83 {
84 case SvMacroItemId::NONE: return stream << "NONE";
85 case SvMacroItemId::HtmlOnSubmitForm: return stream << "HtmlOnSubmitForm";
86 case SvMacroItemId::HtmlOnResetForm: return stream << "HtmlOnResetForm";
87 case SvMacroItemId::HtmlOnGetFocus: return stream << "HtmlOnGetFocus";
88 case SvMacroItemId::HtmlOnLoseFocus: return stream << "HtmlOnLoseFocus";
89 case SvMacroItemId::HtmlOnClick: return stream << "HtmlOnClick";
90 case SvMacroItemId::HtmlOnClickItem: return stream << "HtmlOnClickItem";
91 case SvMacroItemId::HtmlOnChange: return stream << "HtmlOnChange";
92 case SvMacroItemId::HtmlOnSelect: return stream << "HtmlOnSelect";
93 case SvMacroItemId::OpenDoc: return stream << "OpenDoc";
94 case SvMacroItemId::PrepareCloseDoc: return stream << "PrepareCloseDoc";
95 case SvMacroItemId::ActivateDoc: return stream << "ActivateDoc";
96 case SvMacroItemId::DeactivateDoc: return stream << "DeactivateDoc";
97 case SvMacroItemId::OnMouseOver: return stream << "OnMouseOver";
98 case SvMacroItemId::OnClick: return stream << "OnClick";
99 case SvMacroItemId::OnMouseOut: return stream << "OnMouseOut";
100 case SvMacroItemId::OnImageLoadDone: return stream << "OnImageLoadDone";
101 case SvMacroItemId::OnImageLoadCancel: return stream << "OnImageLoadCancel";
102 case SvMacroItemId::OnImageLoadError: return stream << "OnImageLoadError";
103 case SvMacroItemId::SwObjectSelect: return stream << "SwObjectSelect";
104 case SvMacroItemId::SwStartInsGlossary: return stream << "SwStartInsGlossary";
105 case SvMacroItemId::SwEndInsGlossary: return stream << "SwEndInsGlossary";
106 case SvMacroItemId::SwFrmKeyInputAlpha: return stream << "SwFrmKeyInputAlpha";
107 case SvMacroItemId::SwFrmKeyInputNoAlpha: return stream << "SwFrmKeyInputNoAlpha";
108 case SvMacroItemId::SwFrmResize: return stream << "SwFrmResize";
109 case SvMacroItemId::SwFrmMove: return stream << "SwFrmMove";
110 default: return stream << "unk(" << std::to_string(int(id)) << ")";
111 }
112}
113
114class SfxObjectShell;
115
116enum class SfxEventHintId {
117 NONE = 0,
119 CloseDoc,
120 CloseView,
121 CreateDoc,
126 OpenDoc,
129 PrintDoc,
130 SaveAsDoc,
133 SaveDoc,
136 SaveToDoc,
142 // SW events
149};
150
151template< typename charT, typename traits >
152inline std::basic_ostream<charT, traits> & operator <<(
153 std::basic_ostream<charT, traits> & stream, const SfxEventHintId& id )
154{
155 switch(id)
156 {
157 case SfxEventHintId::NONE: return stream << "NONE";
158 case SfxEventHintId::ActivateDoc: return stream << "ActivateDoc";
159 case SfxEventHintId::CloseDoc: return stream << "CloseDoc";
160 case SfxEventHintId::CloseView: return stream << "CloseView";
161 case SfxEventHintId::CreateDoc: return stream << "CreateDoc";
162 case SfxEventHintId::DeactivateDoc: return stream << "DeactivateDoc";
163 case SfxEventHintId::DocCreated: return stream << "DocCreated";
164 case SfxEventHintId::LoadFinished: return stream << "LoadFinished";
165 case SfxEventHintId::ModifyChanged: return stream << "ModifyChanged";
166 case SfxEventHintId::OpenDoc: return stream << "OpenDoc";
167 case SfxEventHintId::PrepareCloseDoc: return stream << "PrepareCloseDoc";
168 case SfxEventHintId::PrepareCloseView: return stream << "PrepareCloseView";
169 case SfxEventHintId::PrintDoc: return stream << "PrintDoc";
170 case SfxEventHintId::SaveAsDoc: return stream << "SaveAsDoc";
171 case SfxEventHintId::SaveAsDocDone: return stream << "SaveAsDocDone";
172 case SfxEventHintId::SaveAsDocFailed: return stream << "SaveAsDocFailed";
173 case SfxEventHintId::SaveDoc: return stream << "SaveDoc";
174 case SfxEventHintId::SaveDocDone: return stream << "SaveDocDone";
175 case SfxEventHintId::SaveDocFailed: return stream << "SaveDocFailed";
176 case SfxEventHintId::SaveToDoc: return stream << "SaveToDoc";
177 case SfxEventHintId::SaveToDocDone: return stream << "SaveToDocDone";
178 case SfxEventHintId::SaveToDocFailed: return stream << "SaveToDocFailed";
179 case SfxEventHintId::StorageChanged: return stream << "StorageChanged";
180 case SfxEventHintId::ViewCreated: return stream << "ViewCreated";
181 case SfxEventHintId::VisAreaChanged: return stream << "VisAreaChanged";
182 case SfxEventHintId::SwMailMerge: return stream << "SwMailMerge";
183 case SfxEventHintId::SwMailMergeEnd: return stream << "SwMailMergeEnd";
184 case SfxEventHintId::SwEventPageCount: return stream << "SwEventPageCount";
185 case SfxEventHintId::SwEventFieldMerge: return stream << "SwEventFieldMerge";
186 case SfxEventHintId::SwEventFieldMergeFinished: return stream << "SwEventFieldMergeFinished";
187 case SfxEventHintId::SwEventLayoutFinished: return stream << "SwEventLayoutFinished";
188 default: return stream << "unk(" << std::to_string(int(id)) << ")";
189 }
190}
191
193{
195 OUString aEventName;
197
198public:
199 SfxEventHint( SfxEventHintId nId, OUString aName, SfxObjectShell *pObj )
200 : pObjShell(pObj),
201 aEventName(std::move(aName)),
202 nEventId(nId)
203 {}
204
206 { return nEventId; }
207
208 const OUString& GetEventName() const
209 { return aEventName; }
210
212 { return pObjShell; }
213};
214
215
217{
218 css::uno::Reference< css::frame::XController2 > xViewController;
219
220public:
221 SfxViewEventHint( SfxEventHintId nId, const OUString& aName, SfxObjectShell *pObj, const css::uno::Reference< css::frame::XController >& xController )
222 : SfxEventHint( nId, aName, pObj )
223 , xViewController( xController, css::uno::UNO_QUERY )
224 {}
225
226 SfxViewEventHint( SfxEventHintId nId, const OUString& aName, SfxObjectShell *pObj, css::uno::Reference< css::frame::XController2 > xController )
227 : SfxEventHint( nId, aName, pObj )
228 , xViewController(std::move( xController ))
229 {}
230
231 const css::uno::Reference< css::frame::XController2 >& GetController() const
232 { return xViewController; }
233};
234
236{
237 css::view::PrintableState mnPrintableState;
238 css::uno::Sequence < css::beans::PropertyValue > aOpts;
239public:
241 css::view::PrintableState nState,
242 const css::uno::Sequence < css::beans::PropertyValue >& rOpts,
243 SfxObjectShell *pObj,
244 const css::uno::Reference< css::frame::XController2 >& xController )
248 pObj,
251 , aOpts( rOpts )
252 {}
253
254 SfxPrintingHint( css::view::PrintableState nState )
258 nullptr,
259 css::uno::Reference< css::frame::XController >() )
261 {}
262
263 css::view::PrintableState GetWhich() const { return mnPrintableState; }
264 const css::uno::Sequence < css::beans::PropertyValue >& GetOptions() const { return aOpts; }
265};
266
267#endif
268
269/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const OUString & GetEventName() const
Definition: event.hxx:208
SfxEventHint(SfxEventHintId nId, OUString aName, SfxObjectShell *pObj)
Definition: event.hxx:199
OUString aEventName
Definition: event.hxx:195
SfxObjectShell * GetObjShell() const
Definition: event.hxx:211
SfxEventHintId GetEventId() const
Definition: event.hxx:205
SfxObjectShell * pObjShell
Definition: event.hxx:194
SfxEventHintId nEventId
Definition: event.hxx:196
void ModifyChanged()
Definition: objmisc.cxx:317
css::uno::Sequence< css::beans::PropertyValue > aOpts
Definition: event.hxx:238
SfxPrintingHint(css::view::PrintableState nState)
Definition: event.hxx:254
css::view::PrintableState GetWhich() const
Definition: event.hxx:263
css::view::PrintableState mnPrintableState
Definition: event.hxx:237
SfxPrintingHint(css::view::PrintableState nState, const css::uno::Sequence< css::beans::PropertyValue > &rOpts, SfxObjectShell *pObj, const css::uno::Reference< css::frame::XController2 > &xController)
Definition: event.hxx:240
const css::uno::Sequence< css::beans::PropertyValue > & GetOptions() const
Definition: event.hxx:264
SfxViewEventHint(SfxEventHintId nId, const OUString &aName, SfxObjectShell *pObj, css::uno::Reference< css::frame::XController2 > xController)
Definition: event.hxx:226
const css::uno::Reference< css::frame::XController2 > & GetController() const
Definition: event.hxx:231
SfxViewEventHint(SfxEventHintId nId, const OUString &aName, SfxObjectShell *pObj, const css::uno::Reference< css::frame::XController > &xController)
Definition: event.hxx:221
css::uno::Reference< css::frame::XController2 > xViewController
Definition: event.hxx:218
#define SFX2_DLLPUBLIC
Definition: dllapi.h:29
Reference< XOutputStream > stream
sal_Int32 nState
SvMacroItemId
these values get stored in streams in a 16-bit value
Definition: event.hxx:41
std::basic_ostream< charT, traits > & operator<<(std::basic_ostream< charT, traits > &stream, const SvMacroItemId &id)
Definition: event.hxx:79
SfxEventHintId
Definition: event.hxx:116
GlobalEventId
OUString aName
NONE
Reference
sal_Int16 nId
Reference< XController > xController