LCOV - code coverage report
Current view: top level - reportdesign/source/ui/inspection - DataProviderHandler.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 3 257 1.2 %
Date: 2014-11-03 Functions: 3 32 9.4 %
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           0 : DataProviderHandler::DataProviderHandler(uno::Reference< uno::XComponentContext > const & context)
      61             :     :DataProviderHandler_Base(m_aMutex)
      62             :     ,m_xContext(context)
      63           0 :     ,m_pInfoService( new OPropertyInfoService() )
      64             : {
      65             :     try
      66             :     {
      67           0 :         m_xFormComponentHandler = form::inspection::FormComponentPropertyHandler::create(m_xContext);
      68           0 :         m_xTypeConverter = script::Converter::create(m_xContext);
      69             : 
      70           0 :     }catch(const uno::Exception &)
      71             :     {
      72             :     }
      73           0 : }
      74             : 
      75           0 : OUString SAL_CALL DataProviderHandler::getImplementationName(  ) throw(uno::RuntimeException, std::exception)
      76             : {
      77           0 :     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           0 : uno::Sequence< OUString > SAL_CALL DataProviderHandler::getSupportedServiceNames(  ) throw(uno::RuntimeException, std::exception)
      86             : {
      87           0 :     return getSupportedServiceNames_static();
      88             : }
      89             : 
      90           4 : OUString DataProviderHandler::getImplementationName_Static(  ) throw(uno::RuntimeException)
      91             : {
      92           4 :     return OUString("com.sun.star.comp.report.DataProviderHandler");
      93             : }
      94             : 
      95           0 : uno::Sequence< OUString > DataProviderHandler::getSupportedServiceNames_static(  ) throw(uno::RuntimeException)
      96             : {
      97           0 :     uno::Sequence< OUString > aSupported(1);
      98           0 :     aSupported[0] = "com.sun.star.report.inspection.DataProviderHandler";
      99           0 :     return aSupported;
     100             : }
     101             : 
     102           0 : uno::Reference< uno::XInterface > SAL_CALL DataProviderHandler::create( const uno::Reference< uno::XComponentContext >& _rxContext )
     103             : {
     104           0 :     return *(new DataProviderHandler( _rxContext ));
     105             : }
     106             : // overload 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           0 : void SAL_CALL DataProviderHandler::disposing()
     111             : {
     112           0 :     ::comphelper::disposeComponent(m_xFormComponentHandler);
     113           0 :     ::comphelper::disposeComponent( m_xMasterDetails );
     114           0 :     ::comphelper::disposeComponent(m_xTypeConverter);
     115           0 : }
     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 = m_pInfoService->getPropertyId(PropertyName);
     173           0 :     switch(nId)
     174             :     {
     175             :         case PROPERTY_ID_CHARTTYPE:
     176             :             // TODO: We need a possiblity to get the UI of the selected chart type
     177             :             //if( m_xChartModel.is() )
     178             :             //{
     179             :             //    uno::Reference< chart2::XDiagram > xDiagram( m_xChartModel->getFirstDiagram() );
     180             :             //    if( xDiagram.is() )
     181             :             //    {
     182             :             //        OUString sChartTypes;
     183             :             //        uno::Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY_THROW );
     184             :             //        const uno::Sequence< uno::Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems());
     185             :             //        const uno::Reference< chart2::XCoordinateSystem >* pIter = aCooSysSeq.getConstArray();
     186             :             //        const uno::Reference< chart2::XCoordinateSystem >* pEnd     = pIter + aCooSysSeq.getLength();
     187             :             //        for(;pIter != pEnd;++pIter)
     188             :             //        {
     189             :             //            const uno::Reference< chart2::XChartTypeContainer > xCTCnt( *pIter, uno::UNO_QUERY_THROW );
     190             :             //            const uno::Sequence< uno::Reference< chart2::XChartType > > aCTSeq( xCTCnt->getChartTypes());
     191             :             //            const uno::Reference< chart2::XChartType >* pChartTypeIter = aCTSeq.getConstArray();
     192             :             //            const uno::Reference< chart2::XChartType >* pChartTypeEnd  = pChartTypeIter + aCTSeq.getLength();
     193             :             //            for(;pChartTypeIter != pChartTypeEnd;++pChartTypeIter)
     194             :             //            {
     195             :             //                sChartTypes += (*pChartTypeIter)->getChartType();
     196             :             //                sChartTypes += ";";
     197             :             //            }
     198             :             //        }
     199             :             //        aPropertyValue;// <<= sChartTypes;
     200             :             //    }
     201             :             //}
     202           0 :             break;
     203             :         case PROPERTY_ID_PREVIEW_COUNT:
     204           0 :             aPropertyValue <<= m_xDataProvider->getRowLimit();
     205           0 :             break;
     206             :         default:
     207           0 :             aPropertyValue = m_xFormComponentHandler->getPropertyValue( PropertyName );
     208           0 :             break;
     209             :     }
     210           0 :     return aPropertyValue;
     211             : }
     212             : 
     213           0 : void SAL_CALL DataProviderHandler::setPropertyValue(const OUString & PropertyName, const uno::Any & Value) throw (uno::RuntimeException, beans::UnknownPropertyException, std::exception)
     214             : {
     215           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     216           0 :     const sal_Int32 nId = m_pInfoService->getPropertyId(PropertyName);
     217           0 :     switch(nId)
     218             :     {
     219             :         case PROPERTY_ID_CHARTTYPE:
     220           0 :             break;
     221             :         case PROPERTY_ID_PREVIEW_COUNT:
     222           0 :             m_xDataProvider->setPropertyValue(PropertyName,Value);
     223           0 :             break;
     224             :         default:
     225           0 :             m_xFormComponentHandler->setPropertyValue(PropertyName, Value);
     226           0 :             break;
     227           0 :     }
     228           0 : }
     229             : 
     230           0 : void DataProviderHandler::impl_updateChartTitle_throw(const uno::Any& _aValue)
     231             : {
     232           0 :     uno::Reference<chart2::XTitled> xTitled(m_xChartModel,uno::UNO_QUERY);
     233           0 :     if ( xTitled.is() )
     234             :     {
     235           0 :         uno::Reference<chart2::XTitle> xTitle = xTitled->getTitleObject();
     236           0 :         if ( !xTitle.is() )
     237             :         {
     238           0 :             xTitle.set(m_xContext->getServiceManager()->createInstanceWithContext("com.sun.star.chart2.Title",m_xContext),uno::UNO_QUERY);
     239           0 :             xTitled->setTitleObject(xTitle);
     240             :         }
     241           0 :         if ( xTitle.is() )
     242             :         {
     243           0 :             uno::Reference< chart2::XFormattedString2> xFormatted = chart2::FormattedString::create(m_xContext);
     244           0 :             OUString sStr;
     245           0 :             _aValue >>= sStr;
     246           0 :             xFormatted->setString(sStr);
     247           0 :             uno::Sequence< uno::Reference< chart2::XFormattedString> > aArgs(1);
     248           0 :             aArgs[0] = xFormatted;
     249           0 :             xTitle->setText(aArgs);
     250           0 :         }
     251           0 :     }
     252           0 : }
     253             : 
     254           0 : beans::PropertyState SAL_CALL DataProviderHandler::getPropertyState(const OUString & PropertyName) throw (uno::RuntimeException, beans::UnknownPropertyException, std::exception)
     255             : {
     256           0 :     return m_xFormComponentHandler->getPropertyState(PropertyName);
     257             : }
     258             : 
     259           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)
     260             : {
     261           0 :     inspection::LineDescriptor aOut;
     262           0 :     const sal_Int32 nId = m_pInfoService->getPropertyId(PropertyName);
     263           0 :     switch(nId)
     264             :     {
     265             :         case PROPERTY_ID_CHARTTYPE:
     266           0 :             aOut.PrimaryButtonId = OUString::createFromAscii(UID_RPT_PROP_CHARTTYPE_DLG);
     267           0 :             aOut.Control = _xControlFactory->createPropertyControl(inspection::PropertyControlType::TextField , sal_True);
     268           0 :             aOut.HasPrimaryButton = sal_True;
     269           0 :             break;
     270             :         case PROPERTY_ID_PREVIEW_COUNT:
     271           0 :             aOut.Control = _xControlFactory->createPropertyControl(inspection::PropertyControlType::NumericField , sal_False);
     272           0 :             break;
     273             :         case PROPERTY_ID_MASTERFIELDS:
     274             :         case PROPERTY_ID_DETAILFIELDS:
     275           0 :             aOut.Control = _xControlFactory->createPropertyControl(inspection::PropertyControlType::StringListField , sal_False);
     276           0 :             aOut.PrimaryButtonId = OUString::createFromAscii(UID_RPT_PROP_DLG_LINKFIELDS);
     277           0 :             aOut.HasPrimaryButton = sal_True;
     278           0 :             break;
     279             :         default:
     280           0 :             aOut = m_xFormComponentHandler->describePropertyLine(PropertyName, _xControlFactory);
     281             :     }
     282           0 :     if ( nId != -1 )
     283             :     {
     284           0 :         aOut.Category = ((m_pInfoService->getPropertyUIFlags(nId ) & PROP_FLAG_DATA_PROPERTY) != 0) ?
     285             :                                     OUString("Data")
     286             :                                                         :
     287           0 :                                     OUString("General");
     288           0 :         aOut.HelpURL = HelpIdUrl::getHelpURL( m_pInfoService->getPropertyHelpId( nId ) );
     289           0 :         aOut.DisplayName = m_pInfoService->getPropertyTranslation(nId);
     290             :     }
     291           0 :     return aOut;
     292             : }
     293             : 
     294           0 : uno::Any SAL_CALL DataProviderHandler::convertToPropertyValue(const OUString & _rPropertyValue, const uno::Any & _rControlValue) throw (uno::RuntimeException, beans::UnknownPropertyException, std::exception)
     295             : {
     296           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     297           0 :     uno::Any aPropertyValue( _rControlValue );
     298           0 :     const sal_Int32 nId = m_pInfoService->getPropertyId(_rPropertyValue);
     299           0 :     switch(nId)
     300             :     {
     301             :         case PROPERTY_ID_CHARTTYPE:
     302           0 :             break;
     303             :         case PROPERTY_ID_PREVIEW_COUNT:
     304             :             try
     305             :             {
     306           0 :                 aPropertyValue = m_xTypeConverter->convertTo( _rControlValue, ::cppu::UnoType<sal_Int32>::get());
     307             :             }
     308           0 :             catch( const uno::Exception& )
     309             :             {
     310             :                 OSL_FAIL( "DataProviderHandler::convertToPropertyValue: caught an exception while converting via TypeConverter!" );
     311             :             }
     312           0 :             break;
     313             :         case PROPERTY_ID_MASTERFIELDS:
     314             :         case PROPERTY_ID_DETAILFIELDS:
     315           0 :             break;
     316             :         default:
     317           0 :             aPropertyValue = m_xFormComponentHandler->convertToPropertyValue(_rPropertyValue, _rControlValue);
     318             :     }
     319           0 :     return aPropertyValue;
     320             : }
     321             : 
     322           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)
     323             : {
     324           0 :     uno::Any aControlValue( _rPropertyValue );
     325           0 :     if ( !aControlValue.hasValue() )
     326             :         // NULL is converted to NULL
     327           0 :         return aControlValue;
     328             : 
     329           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     330           0 :     const sal_Int32 nId = m_pInfoService->getPropertyId(_rPropertyName);
     331           0 :     switch(nId)
     332             :     {
     333             :         case PROPERTY_ID_CHARTTYPE:
     334           0 :             break;
     335             :         case PROPERTY_ID_MASTERFIELDS:
     336             :         case PROPERTY_ID_DETAILFIELDS:
     337             :         case PROPERTY_ID_PREVIEW_COUNT:
     338             :             try
     339             :             {
     340           0 :                 aControlValue = m_xTypeConverter->convertTo( _rPropertyValue, ControlValueType);
     341             :             }
     342           0 :             catch( const uno::Exception& )
     343             :             {
     344             :                 OSL_FAIL( "GeometryHandler::convertToPropertyValue: caught an exception while converting via TypeConverter!" );
     345             :             }
     346           0 :             break;
     347             :         default:
     348           0 :             aControlValue = m_xFormComponentHandler->convertToControlValue(_rPropertyName, _rPropertyValue, ControlValueType);
     349             :     }
     350           0 :     return aControlValue;
     351             : }
     352             : 
     353           0 : void SAL_CALL DataProviderHandler::addPropertyChangeListener(const uno::Reference< beans::XPropertyChangeListener > & Listener) throw (uno::RuntimeException, lang::NullPointerException, std::exception)
     354             : {
     355           0 :     m_xFormComponentHandler->addPropertyChangeListener(Listener);
     356           0 : }
     357             : 
     358           0 : void SAL_CALL DataProviderHandler::removePropertyChangeListener(const uno::Reference< beans::XPropertyChangeListener > & _rxListener) throw (uno::RuntimeException, std::exception)
     359             : {
     360           0 :     m_xFormComponentHandler->removePropertyChangeListener(_rxListener);
     361           0 : }
     362             : 
     363           0 : uno::Sequence< beans::Property > SAL_CALL DataProviderHandler::getSupportedProperties() throw (uno::RuntimeException, std::exception)
     364             : {
     365           0 :     ::std::vector< beans::Property > aNewProps;
     366           0 :     if( m_xChartModel.is() )
     367             :     {
     368           0 :         rptui::OPropertyInfoService::getExcludeProperties( aNewProps, m_xFormComponentHandler );
     369           0 :         beans::Property aValue;
     370             :         static const OUString s_pProperties[] =
     371             :         {
     372             :              OUString(PROPERTY_CHARTTYPE)
     373             :             ,OUString(PROPERTY_MASTERFIELDS)
     374             :             ,OUString(PROPERTY_DETAILFIELDS)
     375             :             ,OUString(PROPERTY_PREVIEW_COUNT)
     376           0 :         };
     377             : 
     378           0 :         for (size_t nPos = 0; nPos < sizeof(s_pProperties)/sizeof(s_pProperties[0]) ;++nPos )
     379             :         {
     380           0 :             aValue.Name = s_pProperties[nPos];
     381           0 :             aNewProps.push_back(aValue);
     382           0 :         }
     383             :     }
     384           0 :     return aNewProps.empty() ? uno::Sequence< beans::Property > () : uno::Sequence< beans::Property > (&(*aNewProps.begin()),aNewProps.size());
     385             : }
     386             : 
     387           0 : uno::Sequence< OUString > SAL_CALL DataProviderHandler::getSupersededProperties() throw (uno::RuntimeException, std::exception)
     388             : {
     389           0 :     uno::Sequence< OUString > aRet(1);
     390           0 :     aRet[0] = PROPERTY_TITLE; // have a look at OPropertyInfoService::getExcludeProperties
     391           0 :     return aRet;
     392             : }
     393             : 
     394           0 : uno::Sequence< OUString > SAL_CALL DataProviderHandler::getActuatingProperties() throw (uno::RuntimeException, std::exception)
     395             : {
     396           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     397             : 
     398           0 :     uno::Sequence< OUString > aSeq(1);
     399           0 :     aSeq[0] = PROPERTY_TITLE;
     400           0 :     return ::comphelper::concatSequences(m_xFormComponentHandler->getActuatingProperties(),aSeq);
     401             : }
     402             : 
     403           0 : sal_Bool SAL_CALL DataProviderHandler::isComposable( const OUString& _rPropertyName ) throw (uno::RuntimeException, beans::UnknownPropertyException, std::exception)
     404             : {
     405           0 :     return m_pInfoService->isComposable( _rPropertyName, m_xFormComponentHandler );
     406             : }
     407             : 
     408           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)
     409             : {
     410           0 :     if ( !_rxInspectorUI.is() )
     411           0 :         throw lang::NullPointerException();
     412             : 
     413           0 :     inspection::InteractiveSelectionResult eResult = inspection::InteractiveSelectionResult_Cancelled;
     414           0 :     ::osl::ClearableMutexGuard aGuard( m_aMutex );
     415             : 
     416           0 :     const sal_Int32 nId = m_pInfoService->getPropertyId(PropertyName);
     417           0 :     switch(nId)
     418             :     {
     419             :         case PROPERTY_ID_CHARTTYPE:
     420           0 :             if ( impl_dialogChartType_nothrow(aGuard) )
     421           0 :                 eResult = inspection::InteractiveSelectionResult_ObtainedValue;
     422           0 :             break;
     423             :         case PROPERTY_ID_MASTERFIELDS:
     424             :         case PROPERTY_ID_DETAILFIELDS:
     425           0 :             if ( impl_dialogLinkedFields_nothrow( aGuard ) )
     426           0 :                 eResult = inspection::InteractiveSelectionResult_Success;
     427           0 :             break;
     428             :         default:
     429           0 :             eResult = m_xFormComponentHandler->onInteractivePropertySelection(PropertyName, Primary, out_Data, _rxInspectorUI);
     430             :     }
     431             : 
     432           0 :     return eResult;
     433             : }
     434             : 
     435           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)
     436             : {
     437           0 :     ::osl::ClearableMutexGuard aGuard( m_aMutex );
     438             : 
     439           0 :     if ( ActuatingPropertyName == PROPERTY_COMMAND )
     440             :     {
     441           0 :         if ( NewValue != OldValue )
     442             :         {
     443           0 :             uno::Reference< report::XReportDefinition> xReport = m_xReportComponent->getSection()->getReportDefinition();
     444           0 :             bool bDoEnableMasterDetailFields = xReport.is() && !xReport->getCommand().isEmpty() && !m_xDataProvider->getCommand().isEmpty();
     445           0 :             InspectorUI->enablePropertyUIElements( PROPERTY_DETAILFIELDS, inspection::PropertyLineElement::PrimaryButton, bDoEnableMasterDetailFields );
     446           0 :             InspectorUI->enablePropertyUIElements( PROPERTY_MASTERFIELDS, inspection::PropertyLineElement::PrimaryButton, bDoEnableMasterDetailFields );
     447             : 
     448           0 :             bool bModified = xReport->isModified();
     449             :             // this fills the chart again
     450           0 :             ::comphelper::NamedValueCollection aArgs;
     451           0 :             aArgs.put( "CellRangeRepresentation", uno::makeAny( OUString( "all" ) ) );
     452           0 :             aArgs.put( "HasCategories", uno::makeAny( sal_True ) );
     453           0 :             aArgs.put( "FirstCellAsLabel", uno::makeAny( sal_True ) );
     454           0 :             aArgs.put( "DataRowSource", uno::makeAny( chart::ChartDataRowSource_COLUMNS ) );
     455           0 :             uno::Reference< chart2::data::XDataReceiver > xReceiver(m_xChartModel,uno::UNO_QUERY_THROW);
     456           0 :             xReceiver->setArguments( aArgs.getPropertyValues() );
     457           0 :             if ( !bModified )
     458           0 :                 xReport->setModified(sal_False);
     459             :         }
     460           0 :         m_xFormComponentHandler->actuatingPropertyChanged(ActuatingPropertyName, NewValue, OldValue, InspectorUI, FirstTimeInit);
     461             :     }
     462           0 :     else if ( ActuatingPropertyName == PROPERTY_TITLE )
     463             :     {
     464           0 :         if ( NewValue != OldValue )
     465           0 :             impl_updateChartTitle_throw(NewValue);
     466             :     }
     467             :     else
     468             :     {
     469           0 :         const sal_Int32 nId = m_pInfoService->getPropertyId(ActuatingPropertyName);
     470           0 :         switch(nId)
     471             :         {
     472             : 
     473             :             case PROPERTY_ID_MASTERFIELDS:
     474           0 :                 break;
     475             :             case PROPERTY_ID_DETAILFIELDS:
     476           0 :                 break;
     477             :             default:
     478           0 :                 m_xFormComponentHandler->actuatingPropertyChanged(ActuatingPropertyName, NewValue, OldValue, InspectorUI, FirstTimeInit);
     479             :         }
     480           0 :     }
     481           0 : }
     482             : 
     483           0 : sal_Bool SAL_CALL DataProviderHandler::suspend(sal_Bool Suspend) throw (uno::RuntimeException, std::exception)
     484             : {
     485           0 :     return m_xFormComponentHandler->suspend(Suspend);
     486             : }
     487           0 : bool DataProviderHandler::impl_dialogLinkedFields_nothrow( ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const
     488             : {
     489           0 :     uno::Sequence<uno::Any> aSeq(6);
     490           0 :     beans::PropertyValue aParam;
     491           0 :     aParam.Name = "ParentWindow";
     492           0 :     aParam.Value <<= m_xContext->getValueByName("DialogParentWindow");
     493           0 :     aSeq[0] <<= aParam;
     494           0 :     aParam.Name = "Detail";
     495           0 :     aParam.Value <<= m_xDataProvider;
     496           0 :     aSeq[1] <<= aParam;
     497           0 :     aParam.Name = "Master";
     498           0 :     aParam.Value <<= m_xReportComponent->getSection()->getReportDefinition();
     499           0 :     aSeq[2] <<= aParam;
     500             : 
     501           0 :     aParam.Name = "Explanation";
     502           0 :     aParam.Value <<= OUString(ModuleRes(RID_STR_EXPLANATION));
     503           0 :     aSeq[3] <<= aParam;
     504           0 :     aParam.Name = "DetailLabel";
     505           0 :     aParam.Value <<= OUString(ModuleRes(RID_STR_DETAILLABEL));
     506           0 :     aSeq[4] <<= aParam;
     507           0 :     aParam.Name = "MasterLabel";
     508           0 :     aParam.Value <<= OUString(ModuleRes(RID_STR_MASTERLABEL));
     509           0 :     aSeq[5] <<= aParam;
     510             : 
     511             :     uno::Reference< ui::dialogs::XExecutableDialog > xDialog(
     512           0 :         m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
     513             :         OUString("org.openoffice.comp.form.ui.MasterDetailLinkDialog"),aSeq
     514           0 :             , m_xContext), uno::UNO_QUERY);
     515             : 
     516           0 :     _rClearBeforeDialog.clear();
     517           0 :     return ( xDialog->execute() != 0 );
     518             : }
     519             : 
     520           0 : bool DataProviderHandler::impl_dialogChartType_nothrow( ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const
     521             : {
     522           0 :     uno::Sequence<uno::Any> aSeq(2);
     523           0 :     beans::PropertyValue aParam;
     524           0 :     aParam.Name = "ParentWindow";
     525           0 :     aParam.Value <<= m_xContext->getValueByName("DialogParentWindow");
     526           0 :     aSeq[0] <<= aParam;
     527           0 :     aParam.Name = "ChartModel";
     528           0 :     aParam.Value <<= m_xChartModel;
     529           0 :     aSeq[1] <<= aParam;
     530             : 
     531             :     uno::Reference< ui::dialogs::XExecutableDialog > xDialog(
     532           0 :         m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
     533             :         OUString("com.sun.star.comp.chart2.ChartTypeDialog"),aSeq
     534           0 :             , m_xContext), uno::UNO_QUERY);
     535             : 
     536           0 :     _rClearBeforeDialog.clear();
     537           0 :     return ( xDialog->execute() != 0 );
     538             : }
     539             : 
     540           6 : } // namespace rptui
     541             : 
     542             : 
     543             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10