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