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