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 _SFX_EVENTCONF_HXX
20 : #define _SFX_EVENTCONF_HXX
21 :
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>
28 :
29 : #include <sfx2/event.hxx>
30 :
31 : #include <sfx2/sfxsids.hrc>
32 : #ifdef ITEMID_MACRO
33 : #undef ITEMID_MACRO
34 : #endif
35 : #define ITEMID_MACRO SID_ATTR_MACROITEM
36 : #include <svl/macitem.hxx>
37 : #include <vector>
38 :
39 : class SfxObjectShell;
40 : class SvxMacroTableDtor;
41 :
42 : struct SFX2_DLLPUBLIC SfxEventName
43 : {
44 : sal_uInt16 mnId;
45 : String maEventName;
46 : String maUIName;
47 :
48 : SfxEventName( sal_uInt16 nId,
49 : const String& rEventName,
50 : const String& rUIName )
51 : : mnId( nId )
52 : , maEventName( rEventName )
53 : , maUIName( rUIName ) {}
54 : };
55 :
56 : typedef ::std::vector< SfxEventName* > _SfxEventNamesList;
57 :
58 : class SFX2_DLLPUBLIC SfxEventNamesList
59 : {
60 : private:
61 : _SfxEventNamesList aEventNamesList;
62 : void DelDtor();
63 :
64 : public:
65 0 : SfxEventNamesList() {}
66 : SfxEventNamesList( const SfxEventNamesList &rCpy ) { *this = rCpy; }
67 0 : ~SfxEventNamesList() { DelDtor(); }
68 : SfxEventNamesList& operator=( const SfxEventNamesList &rCpy );
69 :
70 0 : size_t size() const { return aEventNamesList.size(); };
71 :
72 0 : SfxEventName* at( size_t Index ) const
73 0 : { return Index < aEventNamesList.size() ? aEventNamesList[ Index ] : NULL; }
74 :
75 : void push_back( SfxEventName* Item ) { aEventNamesList.push_back( Item ); }
76 : };
77 :
78 0 : class SFX2_DLLPUBLIC SfxEventNamesItem : public SfxPoolItem
79 : {
80 : SfxEventNamesList aEventsList;
81 :
82 : public:
83 : TYPEINFO();
84 :
85 0 : SfxEventNamesItem ( const sal_uInt16 nId ) : SfxPoolItem( nId ) {}
86 :
87 : virtual int operator==( const SfxPoolItem& ) const;
88 : virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
89 : SfxMapUnit eCoreMetric,
90 : SfxMapUnit ePresMetric,
91 : XubString &rText,
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;
97 :
98 0 : const SfxEventNamesList& GetEvents() const { return aEventsList;}
99 : void SetEvents( const SfxEventNamesList& rList ) { aEventsList = rList; }
100 : void AddEvent( const String&, const String&, sal_uInt16 );
101 : };
102 :
103 : // -----------------------------------------------------------------------
104 :
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"
110 :
111 : class SFX2_DLLPUBLIC SfxEventConfiguration
112 : {
113 : public:
114 : static void ConfigureEvent( ::rtl::OUString aName, const SvxMacro&, SfxObjectShell* pObjSh);
115 : static SvxMacro* ConvertToMacro( const com::sun::star::uno::Any& rElement, SfxObjectShell* pDoc, sal_Bool bBlowUp );
116 : };
117 :
118 : #endif
119 :
120 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|