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 _SFX_EVENTCONF_HXX 24 #define _SFX_EVENTCONF_HXX 25 26 #include "sal/config.h" 27 #include "sfx2/dllapi.h" 28 #include "sal/types.h" 29 #include <tools/rtti.hxx> 30 #include <vcl/fixed.hxx> 31 #include <vcl/button.hxx> 32 33 #define _SVSTDARR_USHORTS 34 #include <svl/svstdarr.hxx> // SvUShorts 35 #include <sfx2/event.hxx> 36 37 #include <sfx2/sfxsids.hrc> 38 #ifdef ITEMID_MACRO 39 #undef ITEMID_MACRO 40 #endif 41 #define ITEMID_MACRO SID_ATTR_MACROITEM 42 #include <svl/macitem.hxx> 43 44 class SfxObjectShell; 45 class SvxMacroTableDtor; 46 47 #define SFX_NO_EVENT USHRT_MAX 48 49 struct SFX2_DLLPUBLIC SfxEventName 50 { 51 sal_uInt16 mnId; 52 String maEventName; 53 String maUIName; 54 SfxEventNameSfxEventName55 SfxEventName( sal_uInt16 nId, 56 const String& rEventName, 57 const String& rUIName ) 58 : mnId( nId ) 59 , maEventName( rEventName ) 60 , maUIName( rUIName ) {} 61 }; 62 63 DECLARE_LIST( _SfxEventNamesList, SfxEventName* ) 64 65 class SFX2_DLLPUBLIC SfxEventNamesList : public _SfxEventNamesList 66 { 67 public: SfxEventNamesList(const sal_uInt16 nInitSz=0,const sal_uInt16 nReSz=1)68 SfxEventNamesList( const sal_uInt16 nInitSz = 0, const sal_uInt16 nReSz = 1 ): _SfxEventNamesList( nInitSz, nReSz ) {} SfxEventNamesList(const SfxEventNamesList & rCpy)69 SfxEventNamesList( const SfxEventNamesList &rCpy ) : _SfxEventNamesList() { *this = rCpy; } ~SfxEventNamesList()70 ~SfxEventNamesList() { DelDtor(); } 71 SfxEventNamesList& operator=( const SfxEventNamesList &rCpy ); 72 void DelDtor(); 73 }; 74 75 class SFX2_DLLPUBLIC SfxEventNamesItem : public SfxPoolItem 76 { 77 SfxEventNamesList aEventsList; 78 79 public: 80 TYPEINFO(); 81 SfxEventNamesItem(const sal_uInt16 nId)82 SfxEventNamesItem ( const sal_uInt16 nId ) : SfxPoolItem( nId ) {} 83 84 virtual int operator==( const SfxPoolItem& ) const; 85 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, 86 SfxMapUnit eCoreMetric, 87 SfxMapUnit ePresMetric, 88 XubString &rText, 89 const IntlWrapper * = 0 ) const; 90 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; 91 virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; 92 virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; 93 virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const; 94 GetEvents() const95 const SfxEventNamesList& GetEvents() const { return aEventsList;} SetEvents(const SfxEventNamesList & rList)96 void SetEvents( const SfxEventNamesList& rList ) { aEventsList = rList; } 97 void AddEvent( const String&, const String&, sal_uInt16 ); 98 }; 99 100 // ----------------------------------------------------------------------- 101 102 #define PROP_EVENT_TYPE "EventType" 103 #define PROP_LIBRARY "Library" 104 #define PROP_SCRIPT "Script" 105 #define PROP_MACRO_NAME "MacroName" 106 #define STAR_BASIC "StarBasic" 107 108 class SFX2_DLLPUBLIC SfxEventConfiguration 109 { 110 public: 111 static void ConfigureEvent( ::rtl::OUString aName, const SvxMacro&, SfxObjectShell* pObjSh); 112 static SvxMacro* ConvertToMacro( const com::sun::star::uno::Any& rElement, SfxObjectShell* pDoc, sal_Bool bBlowUp ); 113 }; 114 115 #endif 116