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