1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef _SFXEVENT_HXX 24 #define _SFXEVENT_HXX 25 26 #include "sal/config.h" 27 #include "sfx2/dllapi.h" 28 #include <tools/string.hxx> 29 #include <svl/hint.hxx> 30 #include <unotools/eventcfg.hxx> 31 #include <rtl/ustring.hxx> 32 33 #include <com/sun/star/uno/Sequence.hxx> 34 #include <com/sun/star/beans/PropertyValue.hpp> 35 #include <com/sun/star/frame/XController2.hpp> 36 37 class SfxObjectShell; 38 39 //------------------------------------------------------------------- 40 41 class SFX2_DLLPUBLIC SfxEventHint : public SfxHint 42 { 43 SfxObjectShell* pObjShell; 44 ::rtl::OUString aEventName; 45 sal_uInt16 nEventId; 46 47 public: 48 TYPEINFO(); 49 SfxEventHint( sal_uInt16 nId, const ::rtl::OUString& aName, SfxObjectShell *pObj = 0 ) 50 : pObjShell(pObj), 51 aEventName(aName), 52 nEventId(nId) 53 {} 54 55 sal_uInt16 GetEventId() const 56 { return nEventId; } 57 58 ::rtl::OUString GetEventName() const 59 { return aEventName; } 60 61 SfxObjectShell* GetObjShell() const 62 { return pObjShell; } 63 }; 64 65 //------------------------------------------------------------------- 66 67 class SFX2_DLLPUBLIC SfxViewEventHint : public SfxEventHint 68 { 69 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController2 > xViewController; 70 71 public: 72 TYPEINFO(); 73 74 SfxViewEventHint( sal_uInt16 nId, const ::rtl::OUString& aName, SfxObjectShell *pObj, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& xController ) 75 : SfxEventHint( nId, aName, pObj ) 76 , xViewController( xController, ::com::sun::star::uno::UNO_QUERY ) 77 {} 78 79 SfxViewEventHint( sal_uInt16 nId, const ::rtl::OUString& aName, SfxObjectShell *pObj, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController2 >& xController ) 80 : SfxEventHint( nId, aName, pObj ) 81 , xViewController( xController ) 82 {} 83 84 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController2 > GetController() const 85 { 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 class SfxPrintingHint : public SfxHint 120 { 121 sal_Int32 nWhich; 122 com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > aOpts; 123 public: 124 TYPEINFO(); 125 SfxPrintingHint( sal_Int32 nEvent, const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& rOpts ) 126 : nWhich( nEvent ) 127 , aOpts( rOpts ) 128 {} 129 130 SfxPrintingHint( sal_Int32 nEvent ) 131 : nWhich( nEvent ) 132 {} 133 134 sal_Int32 GetWhich() const { return nWhich; } 135 const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& GetOptions() { return aOpts; } 136 }; 137 138 #endif 139