bump product version to 5.0.4.1
[LibreOffice.git] / sfx2 / source / inc / eventsupplier.hxx
blob31be811246cabf78dcf0cf1cc6ab6ae489d9de8e
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 .
20 #ifndef INCLUDED_SFX2_SOURCE_INC_EVENTSUPPLIER_HXX
21 #define INCLUDED_SFX2_SOURCE_INC_EVENTSUPPLIER_HXX
23 #include <sal/types.h>
25 #include <com/sun/star/container/XNameReplace.hpp>
26 #include <com/sun/star/document/XEventListener.hpp>
27 #include <com/sun/star/document/XEventBroadcaster.hpp>
28 #include <com/sun/star/document/XDocumentEventListener.hpp>
29 #include <com/sun/star/document/XEventsSupplier.hpp>
30 #include <com/sun/star/frame/XGlobalEventBroadcaster.hpp>
31 #include <com/sun/star/lang/XServiceInfo.hpp>
32 #include <com/sun/star/task/XJobExecutor.hpp>
33 #include <com/sun/star/uno/Reference.hxx>
34 #include <com/sun/star/uno/Type.hxx>
35 #include <cppuhelper/implbase2.hxx>
36 #include <comphelper/sequenceashashmap.hxx>
37 #include <sfx2/sfxuno.hxx>
39 #include <cppuhelper/interfacecontainer.hxx>
40 #include <svl/lstner.hxx>
41 #include <unotools/eventcfg.hxx>
43 namespace comphelper
45 class NamedValueCollection;
48 class SfxObjectShell;
49 class SvxMacro;
53 class SfxEvents_Impl : public ::cppu::WeakImplHelper2< css::container::XNameReplace, css::document::XEventListener >
55 css::uno::Sequence< OUString > maEventNames;
56 css::uno::Sequence< css::uno::Any > maEventData;
57 css::uno::Reference< css::document::XEventBroadcaster > mxBroadcaster;
58 ::osl::Mutex maMutex;
59 SfxObjectShell *mpObjShell;
61 public:
62 SfxEvents_Impl( SfxObjectShell* pShell,
63 css::uno::Reference< css::document::XEventBroadcaster > xBroadcaster );
64 virtual ~SfxEvents_Impl();
66 // --- XNameReplace ---
67 virtual void SAL_CALL replaceByName( const OUString & aName, const css::uno::Any & aElement )
68 throw( css::lang::IllegalArgumentException, css::container::NoSuchElementException,
69 css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
71 // --- XNameAccess ( parent of XNameReplace ) ---
72 virtual css::uno::Any SAL_CALL getByName( const OUString& aName )
73 throw( css::container::NoSuchElementException, css::lang::WrappedTargetException,
74 css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
75 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
76 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
78 // --- XElementAccess ( parent of XNameAccess ) ---
79 virtual css::uno::Type SAL_CALL getElementType() throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
80 virtual sal_Bool SAL_CALL hasElements() throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
82 // --- ::document::XEventListener ---
83 virtual void SAL_CALL notifyEvent( const css::document::EventObject& aEvent )
84 throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
86 // --- ::lang::XEventListener ---
87 virtual void SAL_CALL disposing( const css::lang::EventObject& Source )
88 throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
90 static SvxMacro* ConvertToMacro( const css::uno::Any& rElement, SfxObjectShell* pDoc, bool bNormalizeMacro );
91 static void NormalizeMacro( const css::uno::Any& rIn, css::uno::Any& rOut, SfxObjectShell* pDoc );
92 static void NormalizeMacro(
93 const ::comphelper::NamedValueCollection& i_eventDescriptor,
94 ::comphelper::NamedValueCollection& o_normalizedDescriptor,
95 SfxObjectShell* i_document );
96 static void Execute( css::uno::Any& aEventData, const css::document::DocumentEvent& aTrigger, SfxObjectShell* pDoc );
99 #endif
101 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */