1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef _SFX_EVENTCONF_HXX
20 #define _SFX_EVENTCONF_HXX
22 #include "sal/config.h"
23 #include "sfx2/dllapi.h"
24 #include "sal/types.h"
25 #include <tools/rtti.hxx>
26 #include <vcl/fixed.hxx>
27 #include <vcl/button.hxx>
29 #include <sfx2/event.hxx>
31 #include <sfx2/sfxsids.hrc>
35 #define ITEMID_MACRO SID_ATTR_MACROITEM
36 #include <svl/macitem.hxx>
40 class SvxMacroTableDtor
;
42 struct SFX2_DLLPUBLIC SfxEventName
48 SfxEventName( sal_uInt16 nId
,
49 const String
& rEventName
,
50 const String
& rUIName
)
52 , maEventName( rEventName
)
53 , maUIName( rUIName
) {}
56 typedef ::std::vector
< SfxEventName
* > _SfxEventNamesList
;
58 class SFX2_DLLPUBLIC SfxEventNamesList
61 _SfxEventNamesList aEventNamesList
;
65 SfxEventNamesList() {}
66 SfxEventNamesList( const SfxEventNamesList
&rCpy
) { *this = rCpy
; }
67 ~SfxEventNamesList() { DelDtor(); }
68 SfxEventNamesList
& operator=( const SfxEventNamesList
&rCpy
);
70 size_t size() const { return aEventNamesList
.size(); };
72 SfxEventName
* at( size_t Index
) const
73 { return Index
< aEventNamesList
.size() ? aEventNamesList
[ Index
] : NULL
; }
75 void push_back( SfxEventName
* Item
) { aEventNamesList
.push_back( Item
); }
78 class SFX2_DLLPUBLIC SfxEventNamesItem
: public SfxPoolItem
80 SfxEventNamesList aEventsList
;
85 SfxEventNamesItem ( const sal_uInt16 nId
) : SfxPoolItem( nId
) {}
87 virtual int operator==( const SfxPoolItem
& ) const;
88 virtual SfxItemPresentation
GetPresentation( SfxItemPresentation ePres
,
89 SfxMapUnit eCoreMetric
,
90 SfxMapUnit ePresMetric
,
92 const IntlWrapper
* = 0 ) const;
93 virtual SfxPoolItem
* Clone( SfxItemPool
*pPool
= 0 ) const;
94 virtual SfxPoolItem
* Create(SvStream
&, sal_uInt16
) const;
95 virtual SvStream
& Store(SvStream
&, sal_uInt16 nItemVersion
) const;
96 virtual sal_uInt16
GetVersion( sal_uInt16 nFileFormatVersion
) const;
98 const SfxEventNamesList
& GetEvents() const { return aEventsList
;}
99 void SetEvents( const SfxEventNamesList
& rList
) { aEventsList
= rList
; }
100 void AddEvent( const String
&, const String
&, sal_uInt16
);
103 // -----------------------------------------------------------------------
105 #define PROP_EVENT_TYPE "EventType"
106 #define PROP_LIBRARY "Library"
107 #define PROP_SCRIPT "Script"
108 #define PROP_MACRO_NAME "MacroName"
109 #define STAR_BASIC "StarBasic"
111 class SFX2_DLLPUBLIC SfxEventConfiguration
114 static void ConfigureEvent( OUString aName
, const SvxMacro
&, SfxObjectShell
* pObjSh
);
115 static SvxMacro
* ConvertToMacro( const com::sun::star::uno::Any
& rElement
, SfxObjectShell
* pDoc
, sal_Bool bBlowUp
);
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */