Line data Source code
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 : #include <sfx2/dllapi.h>
24 : #include <sfx2/sfx.hrc>
25 : #include <svl/hint.hxx>
26 : #include <unotools/eventcfg.hxx>
27 : #include <rtl/ustring.hxx>
28 :
29 : #include <com/sun/star/uno/Sequence.hxx>
30 : #include <com/sun/star/beans/PropertyValue.hpp>
31 : #include <com/sun/star/frame/XController2.hpp>
32 : #include <com/sun/star/view/PrintableState.hpp>
33 :
34 : class SfxObjectShell;
35 :
36 :
37 :
38 0 : class SFX2_DLLPUBLIC SfxEventHint : public SfxHint
39 : {
40 : SfxObjectShell* pObjShell;
41 : OUString aEventName;
42 : sal_uInt16 nEventId;
43 :
44 : public:
45 : TYPEINFO_OVERRIDE();
46 0 : SfxEventHint( sal_uInt16 nId, const OUString& aName, SfxObjectShell *pObj = 0 )
47 : : pObjShell(pObj),
48 : aEventName(aName),
49 0 : nEventId(nId)
50 0 : {}
51 :
52 0 : sal_uInt16 GetEventId() const
53 0 : { return nEventId; }
54 :
55 0 : OUString GetEventName() const
56 0 : { return aEventName; }
57 :
58 0 : SfxObjectShell* GetObjShell() const
59 0 : { return pObjShell; }
60 : };
61 :
62 :
63 :
64 0 : class SFX2_DLLPUBLIC SfxViewEventHint : public SfxEventHint
65 : {
66 : ::com::sun::star::uno::Reference< css::frame::XController2 > xViewController;
67 :
68 : public:
69 : TYPEINFO_OVERRIDE();
70 :
71 0 : SfxViewEventHint( sal_uInt16 nId, const OUString& aName, SfxObjectShell *pObj, const css::uno::Reference< css::frame::XController >& xController )
72 : : SfxEventHint( nId, aName, pObj )
73 0 : , xViewController( xController, css::uno::UNO_QUERY )
74 0 : {}
75 :
76 0 : SfxViewEventHint( sal_uInt16 nId, const OUString& aName, SfxObjectShell *pObj, const css::uno::Reference< css::frame::XController2 >& xController )
77 : : SfxEventHint( nId, aName, pObj )
78 0 : , xViewController( xController )
79 0 : {}
80 :
81 0 : css::uno::Reference< css::frame::XController2 > GetController() const
82 0 : { return xViewController; }
83 : };
84 :
85 :
86 :
87 : class SfxNamedHint : public SfxHint
88 : {
89 : OUString _aEventName;
90 : SfxObjectShell* _pObjShell;
91 : OUString _aArgs;
92 :
93 : public:
94 : TYPEINFO_OVERRIDE();
95 :
96 : SfxNamedHint( const OUString& rName,
97 : const OUString& rArgs,
98 : SfxObjectShell *pObj = 0 )
99 : : _aEventName( rName ),
100 : _pObjShell( pObj),
101 : _aArgs( rArgs )
102 : {}
103 :
104 : SfxNamedHint( const OUString& rName,
105 : SfxObjectShell *pObj = 0 )
106 : : _aEventName( rName ),
107 : _pObjShell( pObj )
108 : {}
109 :
110 : const OUString& GetArgs() const { return _aArgs;}
111 : const OUString& GetName() const { return _aEventName; }
112 : SfxObjectShell* GetObjShell() const { return _pObjShell; }
113 : };
114 :
115 : class Printer;
116 :
117 0 : class SfxPrintingHint : public SfxViewEventHint
118 : {
119 : sal_Int32 mnPrintableState;
120 : com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > aOpts;
121 : public:
122 : TYPEINFO_OVERRIDE();
123 :
124 0 : SfxPrintingHint(
125 : sal_Int32 nEvent,
126 : const css::uno::Sequence < css::beans::PropertyValue >& rOpts,
127 : SfxObjectShell *pObj,
128 : const css::uno::Reference< css::frame::XController2 >& xController )
129 : : SfxViewEventHint(
130 : SFX_EVENT_PRINTDOC,
131 : GlobalEventConfig::GetEventName( STR_EVENT_PRINTDOC ),
132 : pObj,
133 : xController )
134 : , mnPrintableState( nEvent )
135 0 : , aOpts( rOpts )
136 0 : {}
137 :
138 0 : SfxPrintingHint( sal_Int32 nEvent )
139 : : SfxViewEventHint( SFX_EVENT_PRINTDOC, rtl::OUString(), 0, css::uno::Reference< css::frame::XController >() )
140 0 : , mnPrintableState( nEvent )
141 0 : {}
142 :
143 0 : sal_Int32 GetWhich() const { return mnPrintableState; }
144 0 : const css::uno::Sequence < css::beans::PropertyValue >& GetOptions() { return aOpts; }
145 : };
146 :
147 : #endif
148 :
149 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|