1*9ee13d13SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*9ee13d13SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*9ee13d13SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*9ee13d13SAndrew Rist  * distributed with this work for additional information
6*9ee13d13SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*9ee13d13SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*9ee13d13SAndrew Rist  * "License"); you may not use this file except in compliance
9*9ee13d13SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*9ee13d13SAndrew Rist  *
11*9ee13d13SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*9ee13d13SAndrew Rist  *
13*9ee13d13SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*9ee13d13SAndrew Rist  * software distributed under the License is distributed on an
15*9ee13d13SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9ee13d13SAndrew Rist  * KIND, either express or implied.  See the License for the
17*9ee13d13SAndrew Rist  * specific language governing permissions and limitations
18*9ee13d13SAndrew Rist  * under the License.
19*9ee13d13SAndrew Rist  *
20*9ee13d13SAndrew Rist  *************************************************************/
21*9ee13d13SAndrew Rist 
22*9ee13d13SAndrew Rist 
23cdf0e10cSrcweir #ifndef REPORTDESIGN_API_REPORTENGINEJFREE_HXX
24cdf0e10cSrcweir #define REPORTDESIGN_API_REPORTENGINEJFREE_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <com/sun/star/report/XReportEngine.hpp>
27cdf0e10cSrcweir #include <cppuhelper/compbase2.hxx>
28cdf0e10cSrcweir #include <comphelper/broadcasthelper.hxx>
29cdf0e10cSrcweir #include <comphelper/uno3.hxx>
30cdf0e10cSrcweir #include <comphelper/types.hxx>
31cdf0e10cSrcweir #include <cppuhelper/propertysetmixin.hxx>
32cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp>
33cdf0e10cSrcweir #include <com/sun/star/sdbc/XRowSet.hpp>
34cdf0e10cSrcweir #include <comphelper/stl_types.hxx>
35cdf0e10cSrcweir #include <comphelper/implementationreference.hxx>
36cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
37cdf0e10cSrcweir 
38cdf0e10cSrcweir namespace reportdesign
39cdf0e10cSrcweir {
40cdf0e10cSrcweir 	typedef ::cppu::WeakComponentImplHelper2< com::sun::star::report::XReportEngine
41cdf0e10cSrcweir                                              ,com::sun::star::lang::XServiceInfo> ReportEngineBase;
42cdf0e10cSrcweir 	typedef ::cppu::PropertySetMixin<com::sun::star::report::XReportEngine> ReportEnginePropertySet;
43cdf0e10cSrcweir 
44cdf0e10cSrcweir 	class OReportEngineJFree : public comphelper::OMutexAndBroadcastHelper,
45cdf0e10cSrcweir 					public ReportEngineBase,
46cdf0e10cSrcweir 					public ReportEnginePropertySet
47cdf0e10cSrcweir 	{
48cdf0e10cSrcweir 		typedef ::std::multimap< ::rtl::OUString, ::com::sun::star::uno::Any , ::comphelper::UStringMixLess>			TComponentMap;
49cdf0e10cSrcweir 		::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >		m_xContext;
50cdf0e10cSrcweir 		::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition >		m_xReport;
51cdf0e10cSrcweir 		::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator>			m_StatusIndicator;
52cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >             m_xActiveConnection;
53cdf0e10cSrcweir         ::sal_Int32 											                            m_nMaxRows;
54cdf0e10cSrcweir 	private:
55cdf0e10cSrcweir 		OReportEngineJFree(const OReportEngineJFree&);
56cdf0e10cSrcweir 		OReportEngineJFree& operator=(const OReportEngineJFree&);
set(const::rtl::OUString & _sProperty,const T & _Value,T & _member)57cdf0e10cSrcweir 		template <typename T> void set(	 const ::rtl::OUString& _sProperty
58cdf0e10cSrcweir 										,const T& _Value
59cdf0e10cSrcweir 										,T& _member)
60cdf0e10cSrcweir 		{
61cdf0e10cSrcweir 			BoundListeners l;
62cdf0e10cSrcweir 			{
63cdf0e10cSrcweir 				::osl::MutexGuard aGuard(m_aMutex);
64cdf0e10cSrcweir 				prepareSet(_sProperty, ::com::sun::star::uno::makeAny(_member), ::com::sun::star::uno::makeAny(_Value), &l);
65cdf0e10cSrcweir 				_member = _Value;
66cdf0e10cSrcweir 			}
67cdf0e10cSrcweir 			l.notify();
68cdf0e10cSrcweir 		}
69cdf0e10cSrcweir 
70cdf0e10cSrcweir         /** returns the file url for a new model
71cdf0e10cSrcweir         *
72cdf0e10cSrcweir         * \return The new file url.
73cdf0e10cSrcweir         */
74cdf0e10cSrcweir         ::rtl::OUString getNewOutputName();
75cdf0e10cSrcweir 
76cdf0e10cSrcweir 	protected:
77cdf0e10cSrcweir         // TODO: VirtualFunctionFinder: This is virtual function!
78cdf0e10cSrcweir         //
79cdf0e10cSrcweir         virtual ~OReportEngineJFree();
80cdf0e10cSrcweir 	public:
81cdf0e10cSrcweir 		typedef ::comphelper::ImplementationReference< OReportEngineJFree	,::com::sun::star::report::XReportEngine,::com::sun::star::uno::XWeak > TReportEngine;
82cdf0e10cSrcweir 
83cdf0e10cSrcweir 		OReportEngineJFree(const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& context);
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 		DECLARE_XINTERFACE( )
86cdf0e10cSrcweir         // ::com::sun::star::lang::XServiceInfo
87cdf0e10cSrcweir 		virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
88cdf0e10cSrcweir 		virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException);
89cdf0e10cSrcweir 		virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException);
90cdf0e10cSrcweir 
91cdf0e10cSrcweir         static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException );
92cdf0e10cSrcweir 		static ::rtl::OUString getImplementationName_Static(void) throw( ::com::sun::star::uno::RuntimeException );
93cdf0e10cSrcweir         static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
94cdf0e10cSrcweir 			create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext);
95cdf0e10cSrcweir     private:
96cdf0e10cSrcweir 		// com::sun::star::beans::XPropertySet
97cdf0e10cSrcweir 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException);
98cdf0e10cSrcweir 		virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
99cdf0e10cSrcweir 		virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
100cdf0e10cSrcweir 		virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
101cdf0e10cSrcweir 		virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
102cdf0e10cSrcweir 		virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
103cdf0e10cSrcweir 		virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
104cdf0e10cSrcweir 
105cdf0e10cSrcweir 		// XReportEngine
106cdf0e10cSrcweir 			// Attributes
107cdf0e10cSrcweir 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition > SAL_CALL getReportDefinition() throw (::com::sun::star::uno::RuntimeException) ;
108cdf0e10cSrcweir 		virtual void SAL_CALL setReportDefinition( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition >& _reportdefinition ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
109cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getActiveConnection() throw (::com::sun::star::uno::RuntimeException);
110cdf0e10cSrcweir         virtual void SAL_CALL setActiveConnection( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _activeconnection ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
111cdf0e10cSrcweir 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > SAL_CALL getStatusIndicator() throw (::com::sun::star::uno::RuntimeException) ;
112cdf0e10cSrcweir 		virtual void SAL_CALL setStatusIndicator( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator >& _statusindicator ) throw (::com::sun::star::uno::RuntimeException) ;
113cdf0e10cSrcweir         virtual ::sal_Int32 SAL_CALL getMaxRows() throw (::com::sun::star::uno::RuntimeException);
114cdf0e10cSrcweir         virtual void SAL_CALL setMaxRows( ::sal_Int32 _MaxRows ) throw (::com::sun::star::uno::RuntimeException);
115cdf0e10cSrcweir 			// Methods
116cdf0e10cSrcweir 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > SAL_CALL createDocumentModel(  ) throw (::com::sun::star::lang::DisposedException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) ;
117cdf0e10cSrcweir 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > SAL_CALL createDocumentAlive( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _frame ) throw (::com::sun::star::lang::DisposedException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) ;
118cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > SAL_CALL createDocumentAlive( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _frame ,bool _bHidden) throw (::com::sun::star::lang::DisposedException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) ;
119cdf0e10cSrcweir 		virtual ::com::sun::star::util::URL SAL_CALL createDocument(  ) throw (::com::sun::star::lang::DisposedException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) ;
120cdf0e10cSrcweir 		virtual void SAL_CALL interrupt(  ) throw (::com::sun::star::lang::DisposedException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) ;
121cdf0e10cSrcweir 
122cdf0e10cSrcweir 		// XComponent
123cdf0e10cSrcweir 		virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
addEventListener(const::com::sun::star::uno::Reference<::com::sun::star::lang::XEventListener> & aListener)124cdf0e10cSrcweir 		virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw(::com::sun::star::uno::RuntimeException)
125cdf0e10cSrcweir 		{
126cdf0e10cSrcweir 			cppu::WeakComponentImplHelperBase::addEventListener(aListener);
127cdf0e10cSrcweir 		}
removeEventListener(const::com::sun::star::uno::Reference<::com::sun::star::lang::XEventListener> & aListener)128cdf0e10cSrcweir 		virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw(::com::sun::star::uno::RuntimeException)
129cdf0e10cSrcweir 		{
130cdf0e10cSrcweir 			cppu::WeakComponentImplHelperBase::removeEventListener(aListener);
131cdf0e10cSrcweir 		}
132cdf0e10cSrcweir 	};
133cdf0e10cSrcweir }
134cdf0e10cSrcweir #endif //REPORTDESIGN_API_REPORTENGINEJFREE_HXX
135