connectivity: add neutral context parser
[LibreOffice.git] / include / sfx2 / evntconf.hxx
blob0233f0810cee75ab60b22ffa005de8caa477ebf7
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 INCLUDED_SFX2_EVNTCONF_HXX
20 #define INCLUDED_SFX2_EVNTCONF_HXX
22 #include <sal/config.h>
23 #include <sfx2/dllapi.h>
24 #include <sal/types.h>
25 #include <sfx2/event.hxx>
26 #include <svl/poolitem.hxx>
27 #include <memory>
28 #include <vector>
30 class SfxObjectShell;
31 class SvxMacro;
33 struct SFX2_DLLPUBLIC SfxEventName
35 SvMacroItemId mnId;
36 OUString maEventName;
37 OUString maUIName;
39 SfxEventName( SvMacroItemId nId,
40 const OUString& rEventName,
41 const OUString& rUIName )
42 : mnId( nId )
43 , maEventName( rEventName )
44 , maUIName( rUIName ) {}
47 class SFX2_DLLPUBLIC SfxEventNamesList
49 private:
50 ::std::vector< SfxEventName > aEventNamesList;
52 public:
53 SfxEventNamesList() {}
54 SfxEventNamesList( const SfxEventNamesList &rCpy ) { *this = rCpy; }
55 ~SfxEventNamesList();
56 SfxEventNamesList& operator=( const SfxEventNamesList &rCpy );
58 size_t size() const { return aEventNamesList.size(); };
60 SfxEventName& at( size_t Index ) { return aEventNamesList[ Index ]; }
61 SfxEventName const & at( size_t Index ) const { return aEventNamesList[ Index ]; }
63 void push_back( SfxEventName Item ) { aEventNamesList.push_back( std::move(Item) ); }
66 class SFX2_DLLPUBLIC SfxEventNamesItem final : public SfxPoolItem
68 SfxEventNamesList aEventsList;
70 public:
72 SfxEventNamesItem ( const sal_uInt16 nId ) : SfxPoolItem( nId ) {}
74 virtual bool operator==( const SfxPoolItem& ) const override;
75 virtual bool GetPresentation( SfxItemPresentation ePres,
76 MapUnit eCoreMetric,
77 MapUnit ePresMetric,
78 OUString &rText,
79 const IntlWrapper& ) const override;
80 virtual SfxEventNamesItem* Clone( SfxItemPool *pPool = nullptr ) const override;
82 const SfxEventNamesList& GetEvents() const { return aEventsList;}
83 void AddEvent( const OUString&, const OUString&, SvMacroItemId );
87 #define PROP_EVENT_TYPE "EventType"
88 #define PROP_LIBRARY "Library"
89 #define PROP_SCRIPT "Script"
90 #define PROP_MACRO_NAME "MacroName"
91 #define STAR_BASIC "StarBasic"
93 class SFX2_DLLPUBLIC SfxEventConfiguration
95 public:
96 static void ConfigureEvent( const OUString& aName, const SvxMacro&, SfxObjectShell const * pObjSh);
97 static std::unique_ptr<SvxMacro> ConvertToMacro( const css::uno::Any& rElement, SfxObjectShell* pDoc );
100 #endif
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */