LCOV - code coverage report
Current view: top level - reportdesign/source/ui/inspection - DataProviderHandler.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 22 256 8.6 %
Date: 2015-06-13 12:38:46 Functions: 7 30 23.3 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : #include "DataProviderHandler.hxx"
      20             : #include <com/sun/star/lang/XInitialization.hpp>
      21             : #include <comphelper/namedvaluecollection.hxx>
      22             : #include <comphelper/property.hxx>
      23             : #include <comphelper/types.hxx>
      24             : #include <cppuhelper/supportsservice.hxx>
      25             : #include "uistrings.hrc"
      26             : #include <toolkit/helper/vclunohelper.hxx>
      27             : #include <unotools/syslocale.hxx>
      28             : #include <com/sun/star/form/inspection/FormComponentPropertyHandler.hpp>
      29             : #include <com/sun/star/inspection/PropertyControlType.hpp>
      30             : #include <com/sun/star/inspection/PropertyLineElement.hpp>
      31             : #include <com/sun/star/chart/ChartDataRowSource.hpp>
      32             : #include <com/sun/star/chart2/FormattedString.hpp>
      33             : #include <com/sun/star/chart2/XDiagram.hpp>
      34             : #include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
      35             : #include <com/sun/star/chart2/XChartTypeContainer.hpp>
      36             : #include <com/sun/star/chart2/XChartType.hpp>
      37             : #include <com/sun/star/chart2/XTitled.hpp>
      38             : #include <com/sun/star/chart2/XTitle.hpp>
      39             : #include <com/sun/star/chart2/data/XDataReceiver.hpp>
      40             : #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
      41             : #include <com/sun/star/report/XReportDefinition.hpp>
      42             : #include <com/sun/star/report/XSection.hpp>
      43             : #include <com/sun/star/script/Converter.hpp>
      44             : #include <com/sun/star/inspection/XNumericControl.hpp>
      45             : #include <com/sun/star/container/XNameContainer.hpp>
      46             : #include <com/sun/star/util/MeasureUnit.hpp>
      47             : #include <tools/fldunit.hxx>
      48             : #include "metadata.hxx"
      49             : #include <vcl/svapp.hxx>
      50             : #include <osl/mutex.hxx>
      51             : #include "helpids.hrc"
      52             : #include "RptResId.hrc"
      53             : #include "PropertyForward.hxx"
      54             : 
      55             : namespace rptui
      56             : {
      57             : 
      58             : using namespace ::com::sun::star;
      59             : 
      60           1 : DataProviderHandler::DataProviderHandler(uno::Reference< uno::XComponentContext > const & context)
      61             :     :DataProviderHandler_Base(m_aMutex)
      62             :     ,m_xContext(context)
      63           1 :     ,m_pInfoService( new OPropertyInfoService() )
      64             : {
      65             :     try
      66             :     {
      67           1 :         m_xFormComponentHandler = form::inspection::FormComponentPropertyHandler::create(m_xContext);
      68           1 :         m_xTypeConverter = script::Converter::create(m_xContext);
      69             : 
      70           0 :     }catch(const uno::Exception &)
      71             :     {
      72             :     }
      73           1 : }
      74             : 
      75           1 : OUString SAL_CALL DataProviderHandler::getImplementationName(  ) throw(uno::RuntimeException, std::exception)
      76             : {
      77           1 :     return getImplementationName_Static();
      78             : }
      79             : 
      80           0 : sal_Bool SAL_CALL DataProviderHandler::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException, std::exception)
      81             : {
      82           0 :     return cppu::supportsService(this, ServiceName);
      83             : }
      84             : 
      85           1 : uno::Sequence< OUString > SAL_CALL DataProviderHandler::getSupportedServiceNames(  ) throw(uno::RuntimeException, std::exception)
      86             : {
      87           1 :     return getSupportedServiceNames_static();
      88             : }
      89             : 
      90           5 : OUString DataProviderHandler::getImplementationName_Static(  ) throw(uno::RuntimeException)
      91             : {
      92           5 :     return OUString("com.sun.star.comp.report.DataProviderHandler");
      93             : }
      94             : 
      95           2 : uno::Sequence< OUString > DataProviderHandler::getSupportedServiceNames_static(  ) throw(uno::RuntimeException)
      96             : {
      97           2 :     uno::Sequence< OUString > aSupported(1);
      98           2 :     aSupported[0] = "com.sun.star.report.inspection.DataProviderHandler";
      99           2 :     return aSupported;
     100             : }
     101             : 
     102           1 : uno::Reference< uno::XInterface > SAL_CALL DataProviderHandler::create( const uno::Reference< uno::XComponentContext >& _rxContext )
     103             : {
     104           1 :     return *(new DataProviderHandler( _rxContext ));
     105             : }
     106             : // override WeakComponentImplHelperBase::disposing()
     107             : // This function is called upon disposing the component,
     108             : // if your component needs special work when it becomes
     109             : // disposed, do it here.
     110           1 : void SAL_CALL DataProviderHandler::disposing()
     111             : {
     112           1 :     ::comphelper::disposeComponent(m_xFormComponentHandler);
     113           1 :     ::comphelper::disposeComponent( m_xMasterDetails );
     114           1 :     ::comphelper::disposeComponent(m_xTypeConverter);
     115           1 : }
     116           0 : void SAL_CALL DataProviderHandler::addEventListener(const uno::Reference< lang::XEventListener > & xListener) throw (uno::RuntimeException, std::exception)
     117             : {
     118           0 :     m_xFormComponentHandler->addEventListener(xListener);
     119           0 : }
     120             : 
     121           0 : void SAL_CALL DataProviderHandler::removeEventListener(const uno::Reference< lang::XEventListener > & aListener) throw (uno::RuntimeException, std::exception)
     122             : {
     123           0 :     m_xFormComponentHandler->removeEventListener(aListener);
     124           0 : }
     125             : 
     126             : // inspection::XPropertyHandler:
     127             : 
     128             : /********************************************************************************/
     129           0 : void SAL_CALL DataProviderHandler::inspect(const uno::Reference< uno::XInterface > & Component) throw (uno::RuntimeException, lang::NullPointerException, std::exception)
     130             : {
     131             :     try
     132             :     {
     133           0 :         uno::Reference< container::XNameContainer > xNameCont(Component,uno::UNO_QUERY);
     134           0 :         const OUString sFormComponent("FormComponent");
     135           0 :         if ( xNameCont->hasByName(sFormComponent) )
     136             :         {
     137           0 :             uno::Reference<beans::XPropertySet> xProp(xNameCont->getByName(sFormComponent),uno::UNO_QUERY);
     138           0 :             const OUString sModel("Model");
     139           0 :             if ( xProp.is() && xProp->getPropertySetInfo()->hasPropertyByName(sModel) )
     140             :             {
     141           0 :                 m_xChartModel.set(xProp->getPropertyValue(sModel),uno::UNO_QUERY);
     142           0 :                 if ( m_xChartModel.is() )
     143           0 :                     m_xFormComponent = m_xChartModel->getDataProvider();
     144           0 :             }
     145             :         }
     146           0 :         m_xDataProvider.set(m_xFormComponent,uno::UNO_QUERY);
     147           0 :         m_xReportComponent.set( xNameCont->getByName("ReportComponent"), uno::UNO_QUERY );
     148           0 :         if ( m_xDataProvider.is() )
     149             :         {
     150           0 :             ::boost::shared_ptr<AnyConverter> aNoConverter(new AnyConverter());
     151           0 :             TPropertyNamePair aPropertyMediation;
     152           0 :             aPropertyMediation.insert( TPropertyNamePair::value_type( PROPERTY_MASTERFIELDS, TPropertyConverter(PROPERTY_MASTERFIELDS,aNoConverter) ) );
     153           0 :             aPropertyMediation.insert( TPropertyNamePair::value_type( PROPERTY_DETAILFIELDS, TPropertyConverter(PROPERTY_DETAILFIELDS,aNoConverter) ) );
     154             : 
     155           0 :             m_xMasterDetails = new OPropertyMediator( m_xDataProvider.get(), m_xReportComponent.get(), aPropertyMediation,true );
     156           0 :         }
     157             :     }
     158           0 :     catch(const uno::Exception &)
     159             :     {
     160           0 :         throw lang::NullPointerException();
     161             :     }
     162           0 :     if ( m_xFormComponent.is() )
     163             :     {
     164           0 :         m_xFormComponentHandler->inspect(m_xFormComponent);
     165             :     }
     166           0 : }
     167             : 
     168           0 : uno::Any SAL_CALL DataProviderHandler::getPropertyValue(const OUString & PropertyName) throw (uno::RuntimeException, beans::UnknownPropertyException, std::exception)
     169             : {
     170           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     171           0 :     uno::Any aPropertyValue;
     172           0 :     const sal_Int32 nId = OPropertyInfoService::getPropertyId(PropertyName);
     173           0 :     switch(nId)
     174             :     {
     175             :         case PROPERTY_ID_CHARTTYPE:
     176             :             // TODO: We need a possibility to get the UI of the selected chart type
     177             :             // LEM: this business of ignoring ChartType seems very fishy!
     178             :             //if( m_xChartModel.is() )
     179             :             //{
     180             :             //    uno::Reference< chart2::XDiagram > xDiagram( m_xChartModel->getFirstDiagram() );
     181             :             //    if( xDiagram.is() )
     182             :             //    {
     183             :             //        OUString sChartTypes;
     184             :             //        uno::Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY_THROW );
     185             :             //        const uno::Sequence< uno::Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems());
     186             :             //        const uno::Reference< chart2::XCoordinateSystem >* pIter = aCooSysSeq.getConstArray();
     187             :             //        const uno::Reference< chart2::XCoordinateSystem >* pEnd     = pIter + aCooSysSeq.getLength();
     188             :             //        for(;pIter != pEnd;++pIter)
     189             :             //        {
     190             :             //            const uno::Reference< chart2::XChartTypeContainer > xCTCnt( *pIter, uno::UNO_QUERY_THROW );
     191             :             //            const uno::Sequence< uno::Reference< chart2::XChartType > > aCTSeq( xCTCnt->getChartTypes());
     192             :             //            const uno::Reference< chart2::XChartType >* pChartTypeIter = aCTSeq.getConstArray();
     193             :             //            const uno::Reference< chart2::XChartType >* pChartTypeEnd  = pChartTypeIter + aCTSeq.getLength();
     194             :             //            for(;pChartTypeIter != pChartTypeEnd;++pChartTypeIter)
     195             :             //            {
     196             :             //                sChartTypes += (*pChartTypeIter)->getChartType();
     197             :             //                sChartTypes += ";";
     198             :             //            }
     199             :             //        }
     200             :             //        aPropertyValue;// <<= sChartTypes;
     201             :             //    }
     202             :             //}
     203           0 :             break;
     204             :         case PROPERTY_ID_PREVIEW_COUNT:
     205           0 :             aPropertyValue <<= m_xDataProvider->getRowLimit();
     206           0 :             break;
     207             :         default:
     208           0 :             aPropertyValue = m_xFormComponentHandler->getPropertyValue( PropertyName );
     209           0 :             break;
     210             :     }
     211           0 :     return aPropertyValue;
     212             : }
     213             : 
     214           0 : void SAL_CALL DataProviderHandler::setPropertyValue(const OUString & PropertyName, const uno::Any & Value) throw (uno::RuntimeException, beans::UnknownPropertyException, std::exception)
     215             : {
     216           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     217           0 :     const sal_Int32 nId = OPropertyInfoService::getPropertyId(PropertyName);
     218           0 :     switch(nId)
     219             :     {
     220             :         case PROPERTY_ID_CHARTTYPE:
     221           0 :             break;
     222             :         case PROPERTY_ID_PREVIEW_COUNT:
     223           0 :             m_xDataProvider->setPropertyValue(PropertyName,Value);
     224           0 :             break;
     225             :         default:
     226           0 :             m_xFormComponentHandler->setPropertyValue(PropertyName, Value);
     227           0 :             break;
     228           0 :     }
     229           0 : }
     230             : 
     231           0 : void DataProviderHandler::impl_updateChartTitle_throw(const uno::Any& _aValue)
     232             : {
     233           0 :     uno::Reference<chart2::XTitled> xTitled(m_xChartModel,uno::UNO_QUERY);
     234           0 :     if ( xTitled.is() )
     235             :     {
     236           0 :         uno::Reference<chart2::XTitle> xTitle = xTitled->getTitleObject();
     237           0 :         if ( !xTitle.is() )
     238             :         {
     239           0 :             xTitle.set(m_xContext->getServiceManager()->createInstanceWithContext("com.sun.star.chart2.Title",m_xContext),uno::UNO_QUERY);
     240           0 :             xTitled->setTitleObject(xTitle);
     241             :         }
     242           0 :         if ( xTitle.is() )
     243             :         {
     244           0 :             uno::Reference< chart2::XFormattedString2> xFormatted = chart2::FormattedString::create(m_xContext);
     245           0 :             OUString sStr;
     246           0 :             _aValue >>= sStr;
     247           0 :             xFormatted->setString(sStr);
     248           0 :             uno::Sequence< uno::Reference< chart2::XFormattedString> > aArgs(1);
     249           0 :             aArgs[0] = xFormatted;
     250           0 :             xTitle->setText(aArgs);
     251           0 :         }
     252           0 :     }
     253           0 : }
     254             : 
     255           0 : beans::PropertyState SAL_CALL DataProviderHandler::getPropertyState(const OUString & PropertyName) throw (uno::RuntimeException, beans::UnknownPropertyException, std::exception)
     256             : {
     257           0 :     return m_xFormComponentHandler->getPropertyState(PropertyName);
     258             : }
     259             : 
     260           0 : inspection::LineDescriptor SAL_CALL DataProviderHandler::describePropertyLine(const OUString & PropertyName,  const uno::Reference< inspection::XPropertyControlFactory > & _xControlFactory) throw (beans::UnknownPropertyException, lang::NullPointerException,uno::RuntimeException, std::exception)
     261             : {
     262           0 :     inspection::LineDescriptor aOut;
     263           0 :     const sal_Int32 nId = OPropertyInfoService::getPropertyId(PropertyName);
     264           0 :     switch(nId)
     265             :     {
     266             :         case PROPERTY_ID_CHARTTYPE:
     267           0 :             aOut.PrimaryButtonId = UID_RPT_PROP_CHARTTYPE_DLG;
     268           0 :             aOut.Control = _xControlFactory->createPropertyControl(inspection::PropertyControlType::TextField , sal_True);
     269           0 :             aOut.HasPrimaryButton = sal_True;
     270           0 :             break;
     271             :         case PROPERTY_ID_PREVIEW_COUNT:
     272           0 :             aOut.Control = _xControlFactory->createPropertyControl(inspection::PropertyControlType::NumericField , sal_False);
     273           0 :             break;
     274             :         case PROPERTY_ID_MASTERFIELDS:
     275             :         case PROPERTY_ID_DETAILFIELDS:
     276           0 :             aOut.Control = _xControlFactory->createPropertyControl(inspection::PropertyControlType::StringListField , sal_False);
     277           0 :             aOut.PrimaryButtonId = UID_RPT_PROP_DLG_LINKFIELDS;
     278           0 :             aOut.HasPrimaryButton = sal_True;
     279           0 :             break;
     280             :         default:
     281           0 :             aOut = m_xFormComponentHandler->describePropertyLine(PropertyName, _xControlFactory);
     282             :     }
     283           0 :     if ( nId != -1 )
     284             :     {
     285           0 :         aOut.Category = ((OPropertyInfoService::getPropertyUIFlags(nId ) & PROP_FLAG_DATA_PROPERTY) != 0) ?
     286             :                                     OUString("Data")
     287             :                                                         :
     288           0 :                                     OUString("General");
     289           0 :         aOut.HelpURL = HelpIdUrl::getHelpURL( OPropertyInfoService::getPropertyHelpId( nId ) );
     290           0 :         aOut.DisplayName = OPropertyInfoService::getPropertyTranslation(nId);
     291             :     }
     292           0 :     return aOut;
     293             : }
     294             : 
     295           0 : uno::Any SAL_CALL DataProviderHandler::convertToPropertyValue(const OUString & _rPropertyValue, const uno::Any & _rControlValue) throw (uno::RuntimeException, beans::UnknownPropertyException, std::exception)
     296             : {
     297           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     298           0 :     uno::Any aPropertyValue( _rControlValue );
     299           0 :     const sal_Int32 nId = OPropertyInfoService::getPropertyId(_rPropertyValue);
     300           0 :     switch(nId)
     301             :     {
     302             :         case PROPERTY_ID_CHARTTYPE:
     303           0 :             break;
     304             :         case PROPERTY_ID_PREVIEW_COUNT:
     305             :             try
     306             :             {
     307           0 :                 aPropertyValue = m_xTypeConverter->convertTo( _rControlValue, ::cppu::UnoType<sal_Int32>::get());
     308             :             }
     309           0 :             catch( const uno::Exception& )
     310             :             {
     311             :                 OSL_FAIL( "DataProviderHandler::convertToPropertyValue: caught an exception while converting via TypeConverter!" );
     312             :             }
     313           0 :             break;
     314             :         case PROPERTY_ID_MASTERFIELDS:
     315             :         case PROPERTY_ID_DETAILFIELDS:
     316           0 :             break;
     317             :         default:
     318           0 :             aPropertyValue = m_xFormComponentHandler->convertToPropertyValue(_rPropertyValue, _rControlValue);
     319             :     }
     320           0 :     return aPropertyValue;
     321             : }
     322             : 
     323           0 : uno::Any SAL_CALL DataProviderHandler::convertToControlValue(const OUString & _rPropertyName, const uno::Any & _rPropertyValue, const uno::Type & ControlValueType) throw (uno::RuntimeException, beans::UnknownPropertyException, std::exception)
     324             : {
     325           0 :     uno::Any aControlValue( _rPropertyValue );
     326           0 :     if ( !aControlValue.hasValue() )
     327             :         // NULL is converted to NULL
     328           0 :         return aControlValue;
     329             : 
     330           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     331           0 :     const sal_Int32 nId = OPropertyInfoService::getPropertyId(_rPropertyName);
     332           0 :     switch(nId)
     333             :     {
     334             :         case PROPERTY_ID_CHARTTYPE:
     335           0 :             break;
     336             :         case PROPERTY_ID_MASTERFIELDS:
     337             :         case PROPERTY_ID_DETAILFIELDS:
     338             :         case PROPERTY_ID_PREVIEW_COUNT:
     339             :             try
     340             :             {
     341           0 :                 aControlValue = m_xTypeConverter->convertTo( _rPropertyValue, ControlValueType);
     342             :             }
     343           0 :             catch( const uno::Exception& )
     344             :             {
     345             :                 OSL_FAIL( "GeometryHandler::convertToPropertyValue: caught an exception while converting via TypeConverter!" );
     346             :             }
     347           0 :             break;
     348             :         default:
     349           0 :             aControlValue = m_xFormComponentHandler->convertToControlValue(_rPropertyName, _rPropertyValue, ControlValueType);
     350             :     }
     351           0 :     return aControlValue;
     352             : }
     353             : 
     354           0 : void SAL_CALL DataProviderHandler::addPropertyChangeListener(const uno::Reference< beans::XPropertyChangeListener > & Listener) throw (uno::RuntimeException, lang::NullPointerException, std::exception)
     355             : {
     356           0 :     m_xFormComponentHandler->addPropertyChangeListener(Listener);
     357           0 : }
     358             : 
     359           0 : void SAL_CALL DataProviderHandler::removePropertyChangeListener(const uno::Reference< beans::XPropertyChangeListener > & _rxListener) throw (uno::RuntimeException, std::exception)
     360             : {
     361           0 :     m_xFormComponentHandler->removePropertyChangeListener(_rxListener);
     362           0 : }
     363             : 
     364           0 : uno::Sequence< beans::Property > SAL_CALL DataProviderHandler::getSupportedProperties() throw (uno::RuntimeException, std::exception)
     365             : {
     366           0 :     ::std::vector< beans::Property > aNewProps;
     367           0 :     if( m_xChartModel.is() )
     368             :     {
     369           0 :         rptui::OPropertyInfoService::getExcludeProperties( aNewProps, m_xFormComponentHandler );
     370           0 :         beans::Property aValue;
     371             :         static const OUString s_pProperties[] =
     372             :         {
     373             :              OUString(PROPERTY_CHARTTYPE)
     374             :             ,OUString(PROPERTY_MASTERFIELDS)
     375             :             ,OUString(PROPERTY_DETAILFIELDS)
     376             :             ,OUString(PROPERTY_PREVIEW_COUNT)
     377           0 :         };
     378             : 
     379           0 :         for (size_t nPos = 0; nPos < sizeof(s_pProperties)/sizeof(s_pProperties[0]) ;++nPos )
     380             :         {
     381           0 :             aValue.Name = s_pProperties[nPos];
     382           0 :             aNewProps.push_back(aValue);
     383           0 :         }
     384             :     }
     385           0 :     return uno::Sequence< beans::Property >(aNewProps.data(), aNewProps.size());
     386             : }
     387             : 
     388           0 : uno::Sequence< OUString > SAL_CALL DataProviderHandler::getSupersededProperties() throw (uno::RuntimeException, std::exception)
     389             : {
     390           0 :     uno::Sequence< OUString > aRet(1);
     391           0 :     aRet[0] = PROPERTY_TITLE; // have a look at OPropertyInfoService::getExcludeProperties
     392           0 :     return aRet;
     393             : }
     394             : 
     395           0 : uno::Sequence< OUString > SAL_CALL DataProviderHandler::getActuatingProperties() throw (uno::RuntimeException, std::exception)
     396             : {
     397           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     398             : 
     399           0 :     uno::Sequence< OUString > aSeq(1);
     400           0 :     aSeq[0] = PROPERTY_TITLE;
     401           0 :     return ::comphelper::concatSequences(m_xFormComponentHandler->getActuatingProperties(),aSeq);
     402             : }
     403             : 
     404           0 : sal_Bool SAL_CALL DataProviderHandler::isComposable( const OUString& _rPropertyName ) throw (uno::RuntimeException, beans::UnknownPropertyException, std::exception)
     405             : {
     406           0 :     return OPropertyInfoService::isComposable( _rPropertyName, m_xFormComponentHandler );
     407             : }
     408             : 
     409           0 : inspection::InteractiveSelectionResult SAL_CALL DataProviderHandler::onInteractivePropertySelection(const OUString & PropertyName, sal_Bool Primary, uno::Any & out_Data, const uno::Reference< inspection::XObjectInspectorUI > & _rxInspectorUI) throw (uno::RuntimeException, beans::UnknownPropertyException, lang::NullPointerException, std::exception)
     410             : {
     411           0 :     if ( !_rxInspectorUI.is() )
     412           0 :         throw lang::NullPointerException();
     413             : 
     414           0 :     inspection::InteractiveSelectionResult eResult = inspection::InteractiveSelectionResult_Cancelled;
     415           0 :     ::osl::ClearableMutexGuard aGuard( m_aMutex );
     416             : 
     417           0 :     const sal_Int32 nId = OPropertyInfoService::getPropertyId(PropertyName);
     418           0 :     switch(nId)
     419             :     {
     420             :         case PROPERTY_ID_CHARTTYPE:
     421           0 :             if ( impl_dialogChartType_nothrow(aGuard) )
     422           0 :                 eResult = inspection::InteractiveSelectionResult_ObtainedValue;
     423           0 :             break;
     424             :         case PROPERTY_ID_MASTERFIELDS:
     425             :         case PROPERTY_ID_DETAILFIELDS:
     426           0 :             if ( impl_dialogLinkedFields_nothrow( aGuard ) )
     427           0 :                 eResult = inspection::InteractiveSelectionResult_Success;
     428           0 :             break;
     429             :         default:
     430           0 :             eResult = m_xFormComponentHandler->onInteractivePropertySelection(PropertyName, Primary, out_Data, _rxInspectorUI);
     431             :     }
     432             : 
     433           0 :     return eResult;
     434             : }
     435             : 
     436           0 : void SAL_CALL DataProviderHandler::actuatingPropertyChanged(const OUString & ActuatingPropertyName, const uno::Any & NewValue, const uno::Any & OldValue, const uno::Reference< inspection::XObjectInspectorUI > & InspectorUI, sal_Bool FirstTimeInit) throw (uno::RuntimeException, lang::NullPointerException, std::exception)
     437             : {
     438           0 :     ::osl::ClearableMutexGuard aGuard( m_aMutex );
     439             : 
     440           0 :     if ( ActuatingPropertyName == PROPERTY_COMMAND )
     441             :     {
     442           0 :         if ( NewValue != OldValue )
     443             :         {
     444           0 :             uno::Reference< report::XReportDefinition> xReport = m_xReportComponent->getSection()->getReportDefinition();
     445           0 :             bool bDoEnableMasterDetailFields = xReport.is() && !xReport->getCommand().isEmpty() && !m_xDataProvider->getCommand().isEmpty();
     446           0 :             InspectorUI->enablePropertyUIElements( PROPERTY_DETAILFIELDS, inspection::PropertyLineElement::PrimaryButton, bDoEnableMasterDetailFields );
     447           0 :             InspectorUI->enablePropertyUIElements( PROPERTY_MASTERFIELDS, inspection::PropertyLineElement::PrimaryButton, bDoEnableMasterDetailFields );
     448             : 
     449           0 :             bool bModified = xReport->isModified();
     450             :             // this fills the chart again
     451           0 :             ::comphelper::NamedValueCollection aArgs;
     452           0 :             aArgs.put( "CellRangeRepresentation", uno::makeAny( OUString( "all" ) ) );
     453           0 :             aArgs.put( "HasCategories", uno::makeAny( sal_True ) );
     454           0 :             aArgs.put( "FirstCellAsLabel", uno::makeAny( sal_True ) );
     455           0 :             aArgs.put( "DataRowSource", uno::makeAny( chart::ChartDataRowSource_COLUMNS ) );
     456           0 :             uno::Reference< chart2::data::XDataReceiver > xReceiver(m_xChartModel,uno::UNO_QUERY_THROW);
     457           0 :             xReceiver->setArguments( aArgs.getPropertyValues() );
     458           0 :             if ( !bModified )
     459           0 :                 xReport->setModified(sal_False);
     460             :         }
     461           0 :         m_xFormComponentHandler->actuatingPropertyChanged(ActuatingPropertyName, NewValue, OldValue, InspectorUI, FirstTimeInit);
     462             :     }
     463           0 :     else if ( ActuatingPropertyName == PROPERTY_TITLE )
     464             :     {
     465           0 :         if ( NewValue != OldValue )
     466           0 :             impl_updateChartTitle_throw(NewValue);
     467             :     }
     468             :     else
     469             :     {
     470           0 :         const sal_Int32 nId = OPropertyInfoService::getPropertyId(ActuatingPropertyName);
     471           0 :         switch(nId)
     472             :         {
     473             : 
     474             :             case PROPERTY_ID_MASTERFIELDS:
     475           0 :                 break;
     476             :             case PROPERTY_ID_DETAILFIELDS:
     477           0 :                 break;
     478             :             default:
     479           0 :                 m_xFormComponentHandler->actuatingPropertyChanged(ActuatingPropertyName, NewValue, OldValue, InspectorUI, FirstTimeInit);
     480             :         }
     481           0 :     }
     482           0 : }
     483             : 
     484           0 : sal_Bool SAL_CALL DataProviderHandler::suspend(sal_Bool Suspend) throw (uno::RuntimeException, std::exception)
     485             : {
     486           0 :     return m_xFormComponentHandler->suspend(Suspend);
     487             : }
     488           0 : bool DataProviderHandler::impl_dialogLinkedFields_nothrow( ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const
     489             : {
     490           0 :     uno::Sequence<uno::Any> aSeq(6);
     491           0 :     beans::PropertyValue aParam;
     492           0 :     aParam.Name = "ParentWindow";
     493           0 :     aParam.Value <<= m_xContext->getValueByName("DialogParentWindow");
     494           0 :     aSeq[0] <<= aParam;
     495           0 :     aParam.Name = "Detail";
     496           0 :     aParam.Value <<= m_xDataProvider;
     497           0 :     aSeq[1] <<= aParam;
     498           0 :     aParam.Name = "Master";
     499           0 :     aParam.Value <<= m_xReportComponent->getSection()->getReportDefinition();
     500           0 :     aSeq[2] <<= aParam;
     501             : 
     502           0 :     aParam.Name = "Explanation";
     503           0 :     aParam.Value <<= OUString(ModuleRes(RID_STR_EXPLANATION));
     504           0 :     aSeq[3] <<= aParam;
     505           0 :     aParam.Name = "DetailLabel";
     506           0 :     aParam.Value <<= OUString(ModuleRes(RID_STR_DETAILLABEL));
     507           0 :     aSeq[4] <<= aParam;
     508           0 :     aParam.Name = "MasterLabel";
     509           0 :     aParam.Value <<= OUString(ModuleRes(RID_STR_MASTERLABEL));
     510           0 :     aSeq[5] <<= aParam;
     511             : 
     512             :     uno::Reference< ui::dialogs::XExecutableDialog > xDialog(
     513           0 :         m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
     514             :         OUString("org.openoffice.comp.form.ui.MasterDetailLinkDialog"),aSeq
     515           0 :             , m_xContext), uno::UNO_QUERY);
     516             : 
     517           0 :     _rClearBeforeDialog.clear();
     518           0 :     return ( xDialog->execute() != 0 );
     519             : }
     520             : 
     521           0 : bool DataProviderHandler::impl_dialogChartType_nothrow( ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const
     522             : {
     523           0 :     uno::Sequence<uno::Any> aSeq(2);
     524           0 :     beans::PropertyValue aParam;
     525           0 :     aParam.Name = "ParentWindow";
     526           0 :     aParam.Value <<= m_xContext->getValueByName("DialogParentWindow");
     527           0 :     aSeq[0] <<= aParam;
     528           0 :     aParam.Name = "ChartModel";
     529           0 :     aParam.Value <<= m_xChartModel;
     530           0 :     aSeq[1] <<= aParam;
     531             : 
     532             :     uno::Reference< ui::dialogs::XExecutableDialog > xDialog(
     533           0 :         m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
     534             :         OUString("com.sun.star.comp.chart2.ChartTypeDialog"),aSeq
     535           0 :             , m_xContext), uno::UNO_QUERY);
     536             : 
     537           0 :     _rClearBeforeDialog.clear();
     538           0 :     return ( xDialog->execute() != 0 );
     539             : }
     540             : 
     541             : } // namespace rptui
     542             : 
     543             : 
     544             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11