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 #ifndef REPORTDESIGN_API_REPORTENGINEJFREE_HXX 24 #define REPORTDESIGN_API_REPORTENGINEJFREE_HXX 25 26 #include <com/sun/star/report/XReportEngine.hpp> 27 #include <cppuhelper/compbase2.hxx> 28 #include <comphelper/broadcasthelper.hxx> 29 #include <comphelper/uno3.hxx> 30 #include <comphelper/types.hxx> 31 #include <cppuhelper/propertysetmixin.hxx> 32 #include <com/sun/star/uno/XComponentContext.hpp> 33 #include <com/sun/star/sdbc/XRowSet.hpp> 34 #include <comphelper/stl_types.hxx> 35 #include <comphelper/implementationreference.hxx> 36 #include <com/sun/star/lang/XServiceInfo.hpp> 37 38 namespace reportdesign 39 { 40 typedef ::cppu::WeakComponentImplHelper2< com::sun::star::report::XReportEngine 41 ,com::sun::star::lang::XServiceInfo> ReportEngineBase; 42 typedef ::cppu::PropertySetMixin<com::sun::star::report::XReportEngine> ReportEnginePropertySet; 43 44 class OReportEngineJFree : public comphelper::OMutexAndBroadcastHelper, 45 public ReportEngineBase, 46 public ReportEnginePropertySet 47 { 48 typedef ::std::multimap< ::rtl::OUString, ::com::sun::star::uno::Any , ::comphelper::UStringMixLess> TComponentMap; 49 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; 50 ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition > m_xReport; 51 ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator> m_StatusIndicator; 52 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xActiveConnection; 53 ::sal_Int32 m_nMaxRows; 54 private: 55 OReportEngineJFree(const OReportEngineJFree&); 56 OReportEngineJFree& operator=(const OReportEngineJFree&); set(const::rtl::OUString & _sProperty,const T & _Value,T & _member)57 template <typename T> void set( const ::rtl::OUString& _sProperty 58 ,const T& _Value 59 ,T& _member) 60 { 61 BoundListeners l; 62 { 63 ::osl::MutexGuard aGuard(m_aMutex); 64 prepareSet(_sProperty, ::com::sun::star::uno::makeAny(_member), ::com::sun::star::uno::makeAny(_Value), &l); 65 _member = _Value; 66 } 67 l.notify(); 68 } 69 70 /** returns the file url for a new model 71 * 72 * \return The new file url. 73 */ 74 ::rtl::OUString getNewOutputName(); 75 76 protected: 77 // TODO: VirtualFunctionFinder: This is virtual function! 78 // 79 virtual ~OReportEngineJFree(); 80 public: 81 typedef ::comphelper::ImplementationReference< OReportEngineJFree ,::com::sun::star::report::XReportEngine,::com::sun::star::uno::XWeak > TReportEngine; 82 83 OReportEngineJFree(const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& context); 84 85 DECLARE_XINTERFACE( ) 86 // ::com::sun::star::lang::XServiceInfo 87 virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); 88 virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); 89 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); 90 91 static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException ); 92 static ::rtl::OUString getImplementationName_Static(void) throw( ::com::sun::star::uno::RuntimeException ); 93 static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL 94 create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext); 95 private: 96 // com::sun::star::beans::XPropertySet 97 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); 98 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); 99 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); 100 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); 101 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); 102 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); 103 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); 104 105 // XReportEngine 106 // Attributes 107 virtual ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition > SAL_CALL getReportDefinition() throw (::com::sun::star::uno::RuntimeException) ; 108 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); 109 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getActiveConnection() throw (::com::sun::star::uno::RuntimeException); 110 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); 111 virtual ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > SAL_CALL getStatusIndicator() throw (::com::sun::star::uno::RuntimeException) ; 112 virtual void SAL_CALL setStatusIndicator( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator >& _statusindicator ) throw (::com::sun::star::uno::RuntimeException) ; 113 virtual ::sal_Int32 SAL_CALL getMaxRows() throw (::com::sun::star::uno::RuntimeException); 114 virtual void SAL_CALL setMaxRows( ::sal_Int32 _MaxRows ) throw (::com::sun::star::uno::RuntimeException); 115 // Methods 116 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) ; 117 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) ; 118 ::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) ; 119 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) ; 120 virtual void SAL_CALL interrupt( ) throw (::com::sun::star::lang::DisposedException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) ; 121 122 // XComponent 123 virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException); addEventListener(const::com::sun::star::uno::Reference<::com::sun::star::lang::XEventListener> & aListener)124 virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw(::com::sun::star::uno::RuntimeException) 125 { 126 cppu::WeakComponentImplHelperBase::addEventListener(aListener); 127 } removeEventListener(const::com::sun::star::uno::Reference<::com::sun::star::lang::XEventListener> & aListener)128 virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw(::com::sun::star::uno::RuntimeException) 129 { 130 cppu::WeakComponentImplHelperBase::removeEventListener(aListener); 131 } 132 }; 133 } 134 #endif //REPORTDESIGN_API_REPORTENGINEJFREE_HXX 135