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 INCLUDED_SFX2_EVNTCONF_HXX
20 : #define INCLUDED_SFX2_EVNTCONF_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 : #include <sfx2/event.hxx>
29 : #include <sfx2/sfxsids.hrc>
30 : #include <svl/macitem.hxx>
31 : #include <vector>
32 :
33 : class SfxObjectShell;
34 : class SvxMacroTableDtor;
35 :
36 0 : struct SFX2_DLLPUBLIC SfxEventName
37 : {
38 : sal_uInt16 mnId;
39 : OUString maEventName;
40 : OUString maUIName;
41 :
42 0 : SfxEventName( sal_uInt16 nId,
43 : const OUString& rEventName,
44 : const OUString& rUIName )
45 : : mnId( nId )
46 : , maEventName( rEventName )
47 0 : , maUIName( rUIName ) {}
48 : };
49 :
50 : typedef ::std::vector< SfxEventName* > _SfxEventNamesList;
51 :
52 : class SFX2_DLLPUBLIC SfxEventNamesList
53 : {
54 : private:
55 : _SfxEventNamesList aEventNamesList;
56 : void DelDtor();
57 :
58 : public:
59 0 : SfxEventNamesList() {}
60 0 : SfxEventNamesList( const SfxEventNamesList &rCpy ) { *this = rCpy; }
61 0 : ~SfxEventNamesList() { DelDtor(); }
62 : SfxEventNamesList& operator=( const SfxEventNamesList &rCpy );
63 :
64 0 : size_t size() const { return aEventNamesList.size(); };
65 :
66 0 : SfxEventName* at( size_t Index ) const
67 0 : { return Index < aEventNamesList.size() ? aEventNamesList[ Index ] : NULL; }
68 :
69 0 : void push_back( SfxEventName* Item ) { aEventNamesList.push_back( Item ); }
70 : };
71 :
72 0 : class SFX2_DLLPUBLIC SfxEventNamesItem : public SfxPoolItem
73 : {
74 : SfxEventNamesList aEventsList;
75 :
76 : public:
77 : TYPEINFO_OVERRIDE();
78 :
79 0 : SfxEventNamesItem ( const sal_uInt16 nId ) : SfxPoolItem( nId ) {}
80 :
81 : virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
82 : virtual bool GetPresentation( SfxItemPresentation ePres,
83 : SfxMapUnit eCoreMetric,
84 : SfxMapUnit ePresMetric,
85 : OUString &rText,
86 : const IntlWrapper * = 0 ) const SAL_OVERRIDE;
87 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
88 : virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const SAL_OVERRIDE;
89 : virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const SAL_OVERRIDE;
90 : virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const SAL_OVERRIDE;
91 :
92 0 : const SfxEventNamesList& GetEvents() const { return aEventsList;}
93 : void SetEvents( const SfxEventNamesList& rList ) { aEventsList = rList; }
94 : void AddEvent( const OUString&, const OUString&, sal_uInt16 );
95 : };
96 :
97 :
98 :
99 : #define PROP_EVENT_TYPE "EventType"
100 : #define PROP_LIBRARY "Library"
101 : #define PROP_SCRIPT "Script"
102 : #define PROP_MACRO_NAME "MacroName"
103 : #define STAR_BASIC "StarBasic"
104 :
105 : class SFX2_DLLPUBLIC SfxEventConfiguration
106 : {
107 : public:
108 : static void ConfigureEvent( const OUString& aName, const SvxMacro&, SfxObjectShell* pObjSh);
109 : static SvxMacro* ConvertToMacro( const com::sun::star::uno::Any& rElement, SfxObjectShell* pDoc, bool bBlowUp );
110 : };
111 :
112 : #endif
113 :
114 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|