Tag: cws_src680_rptchart01 User: oj Date: 2008-02-20 09:52:47+0000 Modified: dba/reportdesign/source/ui/inc/DataProviderHandler.hxx dba/reportdesign/source/ui/inspection/DataProviderHandler.cxx
Log: master detail handling File Changes: Directory: /dba/reportdesign/source/ui/inc/ =========================================== File [changed]: DataProviderHandler.hxx Url: http://dba.openoffice.org/source/browse/dba/reportdesign/source/ui/inc/DataProviderHandler.hxx?r1=1.1.2.3&r2=1.1.2.4 Delta lines: +8 -13 -------------------- --- DataProviderHandler.hxx 2008-02-13 07:12:47+0000 1.1.2.3 +++ DataProviderHandler.hxx 2008-02-20 09:52:44+0000 1.1.2.4 @@ -4,9 +4,9 @@ * * $RCSfile: DataProviderHandler.hxx,v $ * - * $Revision: 1.1.2.3 $ + * $Revision: 1.1.2.4 $ * - * last change: $Author: oj $ $Date: 2008/02/13 07:12:47 $ + * last change: $Author: oj $ $Date: 2008/02/20 09:52:44 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -39,24 +39,17 @@ #ifndef _SAL_CONFIG_H_ #include "sal/config.h" #endif -#ifndef _COM_SUN_STAR_UNO_XCOMPONENTCONTEXT_HPP_ -#include "com/sun/star/uno/XComponentContext.hpp" -#endif -#ifndef _CPPUHELPER_COMPBASE2_HXX_ + #include "cppuhelper/compbase2.hxx" -#endif -#ifndef _CPPUHELPER_BASEMUTEX_HXX_ #include "cppuhelper/basemutex.hxx" -#endif -#ifndef _COM_SUN_STAR_INSPECTION_XPROPERTYHANDLER_HPP_ + +#include "com/sun/star/uno/XComponentContext.hpp" #include "com/sun/star/inspection/XPropertyHandler.hpp" -#endif #include "com/sun/star/chart2/XChartDocument.hpp" #include "com/sun/star/chart2/data/XDatabaseDataProvider.hpp" #include "com/sun/star/report/XReportComponent.hpp" -#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include "com/sun/star/script/XTypeConverter.hpp" #include "com/sun/star/lang/XServiceInfo.hpp" -#endif #include <memory> @@ -134,6 +127,8 @@ ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent > m_xReportComponent; /// inspectee ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument> m_xChartModel; ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > m_xMasterDetails; + /// type converter, needed on various occasions + ::com::sun::star::uno::Reference< ::com::sun::star::script::XTypeConverter > m_xTypeConverter; ::std::auto_ptr< OPropertyInfoService > m_pInfoService; }; //........................................................................ Directory: /dba/reportdesign/source/ui/inspection/ ================================================== File [changed]: DataProviderHandler.cxx Url: http://dba.openoffice.org/source/browse/dba/reportdesign/source/ui/inspection/DataProviderHandler.cxx?r1=1.1.2.4&r2=1.1.2.5 Delta lines: +55 -29 --------------------- --- DataProviderHandler.cxx 2008-02-19 06:42:52+0000 1.1.2.4 +++ DataProviderHandler.cxx 2008-02-20 09:52:44+0000 1.1.2.5 @@ -4,9 +4,9 @@ * * $RCSfile: DataProviderHandler.cxx,v $ * - * $Revision: 1.1.2.4 $ + * $Revision: 1.1.2.5 $ * - * last change: $Author: oj $ $Date: 2008/02/19 06:42:52 $ + * last change: $Author: oj $ $Date: 2008/02/20 09:52:44 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -105,6 +105,7 @@ try { m_xFormComponentHandler.set(m_xContext->getServiceManager()->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.inspection.FormComponentPropertyHandler")),m_xContext),uno::UNO_QUERY_THROW); + m_xTypeConverter.set(m_xContext->getServiceManager()->createInstanceWithContext( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter" )),m_xContext),uno::UNO_QUERY_THROW); }catch(uno::Exception) { @@ -156,6 +157,7 @@ { ::comphelper::disposeComponent(m_xFormComponentHandler); ::comphelper::disposeComponent( m_xMasterDetails ); + ::comphelper::disposeComponent(m_xTypeConverter); } void SAL_CALL DataProviderHandler::addEventListener(const uno::Reference< lang::XEventListener > & xListener) throw (uno::RuntimeException) { @@ -251,6 +253,7 @@ //} break; case PROPERTY_ID_PREVIEW_COUNT: + aPropertyValue <<= m_xDataProvider->getRowLimit(); break; default: aPropertyValue = m_xFormComponentHandler->getPropertyValue( PropertyName ); @@ -268,6 +271,9 @@ { case PROPERTY_ID_CHARTTYPE: break; + case PROPERTY_ID_PREVIEW_COUNT: + m_xDataProvider->setPropertyValue(PropertyName,Value); + break; default: m_xFormComponentHandler->setPropertyValue(PropertyName, Value); if ( PropertyName == PROPERTY_COMMAND ) @@ -342,7 +348,19 @@ switch(nId) { case PROPERTY_ID_CHARTTYPE: + break; case PROPERTY_ID_PREVIEW_COUNT: + try + { + aPropertyValue = m_xTypeConverter->convertTo( _rControlValue, ::getCppuType((const sal_Int32*)0)); + } + catch( const uno::Exception& ) + { + OSL_ENSURE( sal_False, "DataProviderHandler::convertToPropertyValue: caught an exception while converting via TypeConverter!" ); + } + break; + case PROPERTY_ID_MASTERFIELDS: + case PROPERTY_ID_DETAILFIELDS: break; default: aPropertyValue = m_xFormComponentHandler->convertToPropertyValue(_rPropertyValue, _rControlValue); @@ -350,24 +368,33 @@ return aPropertyValue; } -uno::Any SAL_CALL DataProviderHandler::convertToControlValue(const ::rtl::OUString & _rPropertyValue, const uno::Any & PropertyValue, const uno::Type & ControlValueType) throw (uno::RuntimeException, beans::UnknownPropertyException) +uno::Any SAL_CALL DataProviderHandler::convertToControlValue(const ::rtl::OUString & _rPropertyName, const uno::Any & _rPropertyValue, const uno::Type & ControlValueType) throw (uno::RuntimeException, beans::UnknownPropertyException) { uno::Any aControlValue( _rPropertyValue ); if ( !aControlValue.hasValue() ) // NULL is converted to NULL return aControlValue; - uno::Any aPropertyValue(_rPropertyValue); - ::osl::MutexGuard aGuard( m_aMutex ); - const sal_Int32 nId = m_pInfoService->getPropertyId(_rPropertyValue); + const sal_Int32 nId = m_pInfoService->getPropertyId(_rPropertyName); switch(nId) { case PROPERTY_ID_CHARTTYPE: + break; + case PROPERTY_ID_MASTERFIELDS: + case PROPERTY_ID_DETAILFIELDS: case PROPERTY_ID_PREVIEW_COUNT: + try + { + aControlValue = m_xTypeConverter->convertTo( _rPropertyValue, ControlValueType); + } + catch( const uno::Exception& ) + { + OSL_ENSURE( sal_False, "GeometryHandler::convertToPropertyValue: caught an exception while converting via TypeConverter!" ); + } break; default: - aControlValue = m_xFormComponentHandler->convertToControlValue(_rPropertyValue, PropertyValue, ControlValueType); + aControlValue = m_xFormComponentHandler->convertToControlValue(_rPropertyName, _rPropertyValue, ControlValueType); } return aControlValue; } @@ -453,24 +480,27 @@ { ::osl::ClearableMutexGuard aGuard( m_aMutex ); - const sal_Int32 nId = m_pInfoService->getPropertyId(ActuatingPropertyName); - switch(nId) - { - case PROPERTY_ID_MASTERFIELDS: - break; - case PROPERTY_ID_DETAILFIELDS: - // in opposite to the other properties, here in real *two* properties are - // affected + if ( ActuatingPropertyName == PROPERTY_COMMAND ) { uno::Reference< report::XReportDefinition> xReport = m_xReportComponent->getSection()->getReportDefinition(); bool bDoEnableMasterDetailFields = xReport.is() && xReport->getCommand().getLength() && m_xDataProvider->getCommand().getLength(); InspectorUI->enablePropertyUIElements( PROPERTY_DETAILFIELDS, inspection::PropertyLineElement::PrimaryButton, bDoEnableMasterDetailFields ); InspectorUI->enablePropertyUIElements( PROPERTY_MASTERFIELDS, inspection::PropertyLineElement::PrimaryButton, bDoEnableMasterDetailFields ); } + else + { + const sal_Int32 nId = m_pInfoService->getPropertyId(ActuatingPropertyName); + switch(nId) + { + + case PROPERTY_ID_MASTERFIELDS: + break; + case PROPERTY_ID_DETAILFIELDS: break; default: m_xFormComponentHandler->actuatingPropertyChanged(ActuatingPropertyName, NewValue, OldValue, InspectorUI, FirstTimeInit); } + } } ::sal_Bool SAL_CALL DataProviderHandler::suspend(::sal_Bool Suspend) throw (uno::RuntimeException) @@ -479,12 +509,10 @@ } bool DataProviderHandler::impl_dialogLinkedFields_nothrow( ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const { - const uno::Reference< awt::XWindow> xInspectorWindow(m_xContext->getValueByName( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DialogParentWindow"))) ,uno::UNO_QUERY); - uno::Sequence<uno::Any> aSeq(6); beans::PropertyValue aParam; aParam.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParentWindow")); - aParam.Value <<= xInspectorWindow; + aParam.Value <<= m_xContext->getValueByName( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DialogParentWindow"))); aSeq[0] <<= aParam; aParam.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Detail")); aParam.Value <<= m_xDataProvider; @@ -514,12 +542,10 @@ // ----------------------------------------------------------------------------- bool DataProviderHandler::impl_dialogChartType_nothrow( ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const { - const uno::Reference< awt::XWindow> xInspectorWindow(m_xContext->getValueByName( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DialogParentWindow"))) ,uno::UNO_QUERY); - uno::Sequence<uno::Any> aSeq(2); beans::PropertyValue aParam; aParam.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParentWindow")); - aParam.Value <<= xInspectorWindow; + aParam.Value <<= m_xContext->getValueByName( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DialogParentWindow"))); aSeq[0] <<= aParam; aParam.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ChartModel")); aParam.Value <<= m_xChartModel; --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
