1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef DBACCESS_DOCUMENTEVENTS_HXX
25 #define DBACCESS_DOCUMENTEVENTS_HXX
26 
27 /** === begin UNO includes === **/
28 #include <com/sun/star/container/XNameReplace.hpp>
29 #include <com/sun/star/beans/PropertyValue.hpp>
30 /** === end UNO includes === **/
31 
32 #include <cppuhelper/implbase1.hxx>
33 
34 #include <memory>
35 #include <map>
36 #include <boost/noncopyable.hpp>
37 
38 //........................................................................
39 namespace dbaccess
40 {
41 //........................................................................
42 
43     typedef ::std::map< ::rtl::OUString, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >
44             DocumentEventsData;
45 
46 	//====================================================================
47 	//= DocumentEvents
48 	//====================================================================
49     struct DocumentEvents_Data;
50 
51     typedef ::cppu::WeakImplHelper1 <   ::com::sun::star::container::XNameReplace
52                                     >   DocumentEvents_Base;
53 
54     class DocumentEvents    :public DocumentEvents_Base
55                             ,public ::boost::noncopyable
56 	{
57     public:
58         DocumentEvents( ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, DocumentEventsData& _rEventsData );
59         ~DocumentEvents();
60 
61         static bool needsSynchronousNotification( const ::rtl::OUString& _rEventName );
62 
63         // XInterface
64 	    virtual void SAL_CALL acquire() throw();
65 	    virtual void SAL_CALL release() throw();
66 
67         // XNameReplace
68         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);
69 
70         // XNameAccess
71         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);
72         virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames(  ) throw (::com::sun::star::uno::RuntimeException);
73         virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException);
74 
75         // XElementAccess
76         virtual ::com::sun::star::uno::Type SAL_CALL getElementType(  ) throw (::com::sun::star::uno::RuntimeException);
77         virtual ::sal_Bool SAL_CALL hasElements(  ) throw (::com::sun::star::uno::RuntimeException);
78 
79     private:
80         ::std::auto_ptr< DocumentEvents_Data >  m_pData;
81 	};
82 
83 //........................................................................
84 } // namespace dbaccess
85 //........................................................................
86 
87 #endif // DBACCESS_DOCUMENTEVENTS_HXX
88