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 48603 : class SFX2_DLLPUBLIC SfxEventHint : public SfxHint
39 : {
40 : SfxObjectShell* pObjShell;
41 : OUString aEventName;
42 : sal_uInt16 nEventId;
43 :
44 : public:
45 41600 : SfxEventHint( sal_uInt16 nId, const OUString& aName, SfxObjectShell *pObj = 0 )
46 : : pObjShell(pObj),
47 : aEventName(aName),
48 41600 : nEventId(nId)
49 41600 : {}
50 :
51 220560 : sal_uInt16 GetEventId() const
52 220560 : { return nEventId; }
53 :
54 33406 : OUString GetEventName() const
55 33406 : { return aEventName; }
56 :
57 96106 : SfxObjectShell* GetObjShell() const
58 96106 : { return pObjShell; }
59 : };
60 :
61 :
62 :
63 15966 : class SFX2_DLLPUBLIC SfxViewEventHint : public SfxEventHint
64 : {
65 : ::com::sun::star::uno::Reference< css::frame::XController2 > xViewController;
66 :
67 : public:
68 9443 : SfxViewEventHint( sal_uInt16 nId, const OUString& aName, SfxObjectShell *pObj, const css::uno::Reference< css::frame::XController >& xController )
69 : : SfxEventHint( nId, aName, pObj )
70 9443 : , xViewController( xController, css::uno::UNO_QUERY )
71 9443 : {}
72 :
73 6523 : SfxViewEventHint( sal_uInt16 nId, const OUString& aName, SfxObjectShell *pObj, const css::uno::Reference< css::frame::XController2 >& xController )
74 : : SfxEventHint( nId, aName, pObj )
75 6523 : , xViewController( xController )
76 6523 : {}
77 :
78 12826 : css::uno::Reference< css::frame::XController2 > GetController() const
79 12826 : { return xViewController; }
80 : };
81 :
82 :
83 :
84 : class SfxNamedHint : public SfxHint
85 : {
86 : OUString _aEventName;
87 : SfxObjectShell* _pObjShell;
88 : OUString _aArgs;
89 :
90 : public:
91 : SfxNamedHint( const OUString& rName,
92 : const OUString& rArgs,
93 : SfxObjectShell *pObj = 0 )
94 : : _aEventName( rName ),
95 : _pObjShell( pObj),
96 : _aArgs( rArgs )
97 : {}
98 :
99 : SfxNamedHint( const OUString& rName,
100 : SfxObjectShell *pObj = 0 )
101 : : _aEventName( rName ),
102 : _pObjShell( pObj )
103 : {}
104 :
105 : const OUString& GetArgs() const { return _aArgs;}
106 : const OUString& GetName() const { return _aEventName; }
107 : SfxObjectShell* GetObjShell() const { return _pObjShell; }
108 : };
109 :
110 : class Printer;
111 :
112 0 : class SfxPrintingHint : public SfxViewEventHint
113 : {
114 : sal_Int32 mnPrintableState;
115 : com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > aOpts;
116 : public:
117 0 : SfxPrintingHint(
118 : sal_Int32 nEvent,
119 : const css::uno::Sequence < css::beans::PropertyValue >& rOpts,
120 : SfxObjectShell *pObj,
121 : const css::uno::Reference< css::frame::XController2 >& xController )
122 : : SfxViewEventHint(
123 : SFX_EVENT_PRINTDOC,
124 : GlobalEventConfig::GetEventName( GlobalEventId::PRINTDOC ),
125 : pObj,
126 : xController )
127 : , mnPrintableState( nEvent )
128 0 : , aOpts( rOpts )
129 0 : {}
130 :
131 0 : SfxPrintingHint( sal_Int32 nEvent )
132 : : SfxViewEventHint( SFX_EVENT_PRINTDOC, rtl::OUString(), 0, css::uno::Reference< css::frame::XController >() )
133 0 : , mnPrintableState( nEvent )
134 0 : {}
135 :
136 0 : sal_Int32 GetWhich() const { return mnPrintableState; }
137 0 : const css::uno::Sequence < css::beans::PropertyValue >& GetOptions() const { return aOpts; }
138 : };
139 :
140 : #endif
141 :
142 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|