1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: eventcfg.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
33 #include "svtools/svldllapi.h"
34 #include <unotools/configitem.hxx>
35 #include <com/sun/star/document/XEventsSupplier.hpp>
36 #include <com/sun/star/container/XNameReplace.hpp>
37 #include <com/sun/star/frame/XFrame.hpp>
38 #include <cppuhelper/weakref.hxx>
39 #include <cppuhelper/implbase2.hxx>
43 typedef ::std::hash_map
< ::rtl::OUString
, ::rtl::OUString
, ::rtl::OUStringHash
, ::std::equal_to
< ::rtl::OUString
> > EventBindingHash
;
44 typedef ::std::vector
< ::com::sun::star::uno::WeakReference
< ::com::sun::star::frame::XFrame
> > FrameVector
;
45 typedef ::std::vector
< ::rtl::OUString
> SupportedEventsVector
;
47 class GlobalEventConfig_Impl
: public utl::ConfigItem
49 EventBindingHash m_eventBindingHash
;
50 FrameVector m_lFrames
;
51 SupportedEventsVector m_supportedEvents
;
53 void initBindingInfo();
56 GlobalEventConfig_Impl( );
57 ~GlobalEventConfig_Impl( );
59 void EstablishFrameCallback(const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& xFrame
);
60 void Notify( const com::sun::star::uno::Sequence
<rtl::OUString
>& aPropertyNames
);
63 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameReplace
> SAL_CALL
getEvents( ) throw (::com::sun::star::uno::RuntimeException
);
64 void SAL_CALL
replaceByName( const ::rtl::OUString
& aName
, const ::com::sun::star::uno::Any
& aElement
) throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::container::NoSuchElementException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
65 ::com::sun::star::uno::Any SAL_CALL
getByName( const ::rtl::OUString
& aName
) throw (::com::sun::star::container::NoSuchElementException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
66 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getElementNames( ) throw (::com::sun::star::uno::RuntimeException
);
67 ::sal_Bool SAL_CALL
hasByName( const ::rtl::OUString
& aName
) throw (::com::sun::star::uno::RuntimeException
);
68 ::com::sun::star::uno::Type SAL_CALL
getElementType( ) throw (::com::sun::star::uno::RuntimeException
);
69 ::sal_Bool SAL_CALL
hasElements( ) throw (::com::sun::star::uno::RuntimeException
);
73 class SVL_DLLPUBLIC GlobalEventConfig
:
74 public ::cppu::WeakImplHelper2
< ::com::sun::star::document::XEventsSupplier
, ::com::sun::star::container::XNameReplace
>
78 ~GlobalEventConfig( );
79 static ::osl::Mutex
& GetOwnStaticMutex();
81 void EstablishFrameCallback(const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& xFrame
);
82 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameReplace
> SAL_CALL
getEvents( ) throw (::com::sun::star::uno::RuntimeException
);
83 void SAL_CALL
replaceByName( const ::rtl::OUString
& aName
, const ::com::sun::star::uno::Any
& aElement
) throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::container::NoSuchElementException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
84 ::com::sun::star::uno::Any SAL_CALL
getByName( const ::rtl::OUString
& aName
) throw (::com::sun::star::container::NoSuchElementException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
85 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getElementNames( ) throw (::com::sun::star::uno::RuntimeException
);
86 ::sal_Bool SAL_CALL
hasByName( const ::rtl::OUString
& aName
) throw (::com::sun::star::uno::RuntimeException
);
87 ::com::sun::star::uno::Type SAL_CALL
getElementType( ) throw (::com::sun::star::uno::RuntimeException
);
88 ::sal_Bool SAL_CALL
hasElements( ) throw (::com::sun::star::uno::RuntimeException
);
92 static GlobalEventConfig_Impl
* m_pImpl
;
93 static sal_Int32 m_nRefCount
;
96 #endif // _EVENTCFG_HXX