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