1 /*************************************************************************
2  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3  *
4  * Copyright 2000, 2010 Oracle and/or its affiliates.
5  *
6  * OpenOffice.org - a multi-platform office productivity suite
7  *
8  * This file is part of OpenOffice.org.
9  *
10  * OpenOffice.org is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU Lesser General Public License version 3
12  * only, as published by the Free Software Foundation.
13  *
14  * OpenOffice.org is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU Lesser General Public License version 3 for more details
18  * (a copy is included in the LICENSE file that accompanied this code).
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * version 3 along with OpenOffice.org.  If not, see
22  * <http://www.openoffice.org/license.html>
23  * for a copy of the LGPLv3 License.
24  *
25 ************************************************************************/
26 
27 #ifndef DBACCESS_DOCUMENTEVENTS_HXX
28 #define DBACCESS_DOCUMENTEVENTS_HXX
29 
30 /** === begin UNO includes === **/
31 #include <com/sun/star/container/XNameReplace.hpp>
32 #include <com/sun/star/beans/PropertyValue.hpp>
33 /** === end UNO includes === **/
34 
35 #include <cppuhelper/implbase1.hxx>
36 
37 #include <memory>
38 #include <map>
39 #include <boost/noncopyable.hpp>
40 
41 //........................................................................
42 namespace dbaccess
43 {
44 //........................................................................
45 
46     typedef ::std::map< ::rtl::OUString, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >
47             DocumentEventsData;
48 
49 	//====================================================================
50 	//= DocumentEvents
51 	//====================================================================
52     struct DocumentEvents_Data;
53 
54     typedef ::cppu::WeakImplHelper1 <   ::com::sun::star::container::XNameReplace
55                                     >   DocumentEvents_Base;
56 
57     class DocumentEvents    :public DocumentEvents_Base
58                             ,public ::boost::noncopyable
59 	{
60     public:
61         DocumentEvents( ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, DocumentEventsData& _rEventsData );
62         ~DocumentEvents();
63 
64         static bool needsSynchronousNotification( const ::rtl::OUString& _rEventName );
65 
66         // XInterface
67 	    virtual void SAL_CALL acquire() throw();
68 	    virtual void SAL_CALL release() throw();
69 
70         // XNameReplace
71         virtual 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);
72 
73         // XNameAccess
74         virtual ::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);
75         virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames(  ) throw (::com::sun::star::uno::RuntimeException);
76         virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException);
77 
78         // XElementAccess
79         virtual ::com::sun::star::uno::Type SAL_CALL getElementType(  ) throw (::com::sun::star::uno::RuntimeException);
80         virtual ::sal_Bool SAL_CALL hasElements(  ) throw (::com::sun::star::uno::RuntimeException);
81 
82     private:
83         ::std::auto_ptr< DocumentEvents_Data >  m_pData;
84 	};
85 
86 //........................................................................
87 } // namespace dbaccess
88 //........................................................................
89 
90 #endif // DBACCESS_DOCUMENTEVENTS_HXX
91