1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: evntconf.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _SFX_EVENTCONF_HXX
31 #define _SFX_EVENTCONF_HXX
35 #ifndef _FIXED_HXX //autogen
36 #include <vcl/fixed.hxx>
38 #ifndef _SV_BUTTON_HXX
39 #include <vcl/button.hxx>
44 #define _SVSTDARR_USHORTS
45 #include <bf_svtools/svstdarr.hxx> // SvUShorts
46 #include <bf_sfx2/cfgitem.hxx>
47 #include <bf_sfx2/event.hxx>
49 #include <bf_sfx2/sfxsids.hrc>
53 #define ITEMID_MACRO SID_ATTR_MACROITEM
54 #include <bf_svtools/macitem.hxx>
58 class SfxMacroTabPage
;
59 class SfxMacroInfoArr_Impl
;
60 class SfxEventConfigItem_Impl
;
61 class SfxEventInfoArr_Impl
;
64 #define SFX_NO_EVENT USHRT_MAX
72 SfxEvent_Impl(const String
& rName
, USHORT nId
) :
78 SV_DECL_PTRARR(SfxEventArr_Impl
, SfxEvent_Impl
*, 5, 5)//STRIP008 ;
80 // -----------------------------------------------------------------------
82 #define PROP_EVENT_TYPE "EventType"
83 #define PROP_LIBRARY "Library"
84 #define PROP_SCRIPT "Script"
85 #define PROP_SCRIPT_URL "URL"
86 #define PROP_MACRO_NAME "MacroName"
87 #define STAR_BASIC "StarBasic"
88 #define JAVA_SCRIPT "JavaScript"
90 // -----------------------------------------------------------------------
92 typedef SvPtrarr SfxEventArr_Impl
;
95 class SfxEventConfiguration
97 friend class SfxEventConfigItem_Impl
;
99 SfxMacroInfoArr_Impl
* pArr
;
100 SfxEventArr_Impl
* pEventArr
;
101 SfxEventConfigItem_Impl
* pAppEventConfig
;
102 SfxEventConfigItem_Impl
* pDocEventConfig
;
103 sal_Bool bIgnoreConfigure
;
106 SfxEventConfiguration();
107 ~SfxEventConfiguration();
109 void RegisterEvent(USHORT nId
, const String
& rName
);
110 USHORT
GetEventCount() const
111 { return pEventArr
->Count()-1; }
112 void ConfigureEvent(USHORT nId
, const String
& rMacro
,
113 SfxObjectShell
* pObjSh
);
115 SvxMacroTableDtor
* GetAppEventTable();
117 static void RegisterEvent( USHORT nId
, const String
& rName
,
118 const String
& rMacroName
);
120 static BOOL
Import( SvStream
& rInStream
, SvStream
* pOutStream
, SfxObjectShell
* pDoc
=NULL
);
121 static BOOL
Export( SvStream
* pInStream
, SvStream
& rOutStream
, SfxObjectShell
* pDoc
=NULL
);
124 SfxEventConfigItem_Impl
* GetAppEventConfig_Impl();
125 const SfxEvent_Impl
* GetEvent_Impl(USHORT nPos
) const
126 { return (*pEventArr
)[nPos
+1]; }
127 BOOL
Warn_Impl( SfxObjectShell
*pDoc
, const SvxMacro
* pMacro
);
128 void PropagateEvents_Impl( SfxObjectShell
*pDoc
,
129 const SvxMacroTableDtor
& rTable
);
130 static ::rtl::OUString
GetEventName_Impl( ULONG nID
);
131 static ULONG
GetEventId_Impl( const ::rtl::OUString
& rEventName
);
132 ::com::sun::star::uno::Any
CreateEventData_Impl( const SvxMacro
*pMacro
);
134 static ULONG
GetPos_Impl( USHORT nID
, sal_Bool
&rFound
);
135 static ULONG
GetPos_Impl( const String
& rName
, sal_Bool
&rFound
);
140 class SfxEventConfigItem_Impl
: public SfxConfigItem
142 friend class SfxEventConfiguration
;
144 SvxMacroTableDtor aMacroTable
;
145 SfxEventConfiguration
*pEvConfig
;
146 SfxObjectShell
*pObjShell
;
151 void ConstructMacroTable();
155 SfxEventConfigItem_Impl( USHORT
,
156 SfxEventConfiguration
*,
157 SfxObjectShell
* pObjSh
= NULL
);
158 ~SfxEventConfigItem_Impl();
160 void Init( SfxConfigManager
* );
161 virtual int Load(SotStorage
&);
162 virtual BOOL
Store(SotStorage
&);
163 virtual String
GetStreamName() const;
164 virtual void UseDefault();
165 void ConfigureEvent( USHORT nPos
, SvxMacro
* );
170 }//end of namespace binfilter