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 "propbrw.hxx" 29 #include "RptObject.hxx" 30 #include "ReportController.hxx" 31 #include <cppuhelper/component_context.hxx> 32 #ifndef _REPORT_DLGRESID_HRC 33 #include <RptResId.hrc> 34 #endif 35 #ifndef _RPTUI_SLOTID_HRC_ 36 #include "rptui_slotid.hrc" 37 #endif 38 #include <tools/debug.hxx> 39 #include <com/sun/star/awt/XLayoutConstrains.hpp> 40 #include <com/sun/star/inspection/ObjectInspector.hpp> 41 #include <com/sun/star/inspection/DefaultHelpProvider.hpp> 42 #ifndef _SVX_SVXIDS_HRC 43 #include <svx/svxids.hrc> 44 #endif 45 #include <vcl/stdtext.hxx> 46 #include <svx/svdview.hxx> 47 #include <svx/svdogrp.hxx> 48 #include <svx/svdpage.hxx> 49 #include <svx/svditer.hxx> 50 51 #ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ 52 #include <toolkit/unohlp.hxx> 53 #endif 54 #include <comphelper/property.hxx> 55 #include <comphelper/namecontainer.hxx> 56 #include <comphelper/composedprops.hxx> 57 #include <comphelper/stl_types.hxx> 58 #include <comphelper/types.hxx> 59 #include <comphelper/sequence.hxx> 60 #include <com/sun/star/beans/PropertyValue.hpp> 61 #include <com/sun/star/awt/PosSize.hpp> 62 #include <com/sun/star/lang/XServiceInfo.hpp> 63 #include <com/sun/star/report/inspection/DefaultComponentInspectorModel.hpp> 64 #include <comphelper/processfactory.hxx> 65 #include "SectionView.hxx" 66 #include "ReportSection.hxx" 67 #ifndef REPORTDESIGN_SHARED_UISTRINGS_HRC 68 #include "uistrings.hrc" 69 #endif 70 #include "DesignView.hxx" 71 #include "ViewsWindow.hxx" 72 #include "UITools.hxx" 73 #include <unotools/confignode.hxx> 74 75 namespace rptui 76 { 77 #define STD_WIN_SIZE_X 300 78 #define STD_WIN_SIZE_Y 350 79 80 using namespace ::com::sun::star; 81 using namespace uno; 82 using namespace lang; 83 using namespace frame; 84 using namespace beans; 85 using namespace container; 86 using namespace ::comphelper; 87 88 //---------------------------------------------------------------------------- 89 //----------------------------------------------------------------------- 90 namespace 91 { 92 static bool lcl_shouldEnableHelpSection( const Reference< XMultiServiceFactory >& _rxFactory ) 93 { 94 const ::rtl::OUString sConfigName( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.ReportDesign/PropertyBrowser/" ) ); 95 const ::rtl::OUString sPropertyName( RTL_CONSTASCII_USTRINGPARAM( "DirectHelp" ) ); 96 97 ::utl::OConfigurationTreeRoot aConfiguration( 98 ::utl::OConfigurationTreeRoot::createWithServiceFactory( _rxFactory, sConfigName ) ); 99 100 bool bEnabled = false; 101 OSL_VERIFY( aConfiguration.getNodeValue( sPropertyName ) >>= bEnabled ); 102 return bEnabled; 103 } 104 } 105 //----------------------------------------------------------------------- 106 //============================================================================ 107 // PropBrw 108 //============================================================================ 109 110 DBG_NAME( rpt_PropBrw ) 111 112 //---------------------------------------------------------------------------- 113 114 PropBrw::PropBrw(const Reference< XMultiServiceFactory >& _xORB,Window* pParent,ODesignView* _pDesignView) 115 :DockingWindow(pParent,WinBits(WB_STDMODELESS|WB_SIZEABLE|WB_3DLOOK|WB_ROLLABLE)) 116 ,m_xORB(_xORB) 117 ,m_pDesignView(_pDesignView) 118 ,m_pView( NULL ) 119 ,m_bInitialStateChange(sal_True) 120 { 121 DBG_CTOR( rpt_PropBrw,NULL); 122 123 Size aPropWinSize(STD_WIN_SIZE_X,STD_WIN_SIZE_Y); 124 SetOutputSizePixel(aPropWinSize); 125 126 try 127 { 128 // create a frame wrapper for myself 129 m_xMeAsFrame = Reference< XFrame >(m_xORB->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Frame"))), UNO_QUERY); 130 if (m_xMeAsFrame.is()) 131 { 132 m_xMeAsFrame->initialize( VCLUnoHelper::GetInterface ( this ) ); 133 m_xMeAsFrame->setName(::rtl::OUString::createFromAscii("report property browser")); // change name! 134 } 135 } 136 catch (Exception&) 137 { 138 DBG_ERROR("PropBrw::PropBrw: could not create/initialize my frame!"); 139 m_xMeAsFrame.clear(); 140 } 141 142 if (m_xMeAsFrame.is()) 143 { 144 Reference< XComponentContext > xOwnContext; 145 try 146 { 147 // our own component context 148 Reference< XPropertySet > xFactoryProperties( m_xORB, UNO_QUERY_THROW ); 149 xOwnContext.set( 150 xFactoryProperties->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) ), 151 UNO_QUERY_THROW ); 152 153 /*uno::Reference< XComponent> xModel = new OContextHelper(m_xORB,uno::Reference< XComponent>(m_pDesignView->getController().getModel(),uno::UNO_QUERY) ); 154 uno::Reference< XComponent> xDialogParentWindow = new OContextHelper(m_xORB,uno::Reference< XComponent>(VCLUnoHelper::GetInterface ( this ),uno::UNO_QUERY) ); 155 uno::Reference< XComponent> xConnection = new OContextHelper(m_xORB,uno::Reference< XComponent>(m_pDesignView->getController().getConnection(),uno::UNO_QUERY) );*/ 156 // a ComponentContext for the 157 ::cppu::ContextEntry_Init aHandlerContextInfo[] = 158 { 159 ::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ContextDocument" ) ), makeAny( m_pDesignView->getController().getModel() )), 160 ::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DialogParentWindow" ) ), makeAny( VCLUnoHelper::GetInterface ( this ) )), 161 ::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ActiveConnection" ) ), makeAny( m_pDesignView->getController().getConnection() ) ), 162 }; 163 m_xInspectorContext.set( 164 ::cppu::createComponentContext( aHandlerContextInfo, sizeof( aHandlerContextInfo ) / sizeof( aHandlerContextInfo[0] ), 165 xOwnContext ) ); 166 // create a property browser controller 167 bool bEnableHelpSection = lcl_shouldEnableHelpSection( m_xORB ); 168 Reference< inspection::XObjectInspectorModel> xInspectorModel( bEnableHelpSection 169 ? report::inspection::DefaultComponentInspectorModel::createWithHelpSection( m_xInspectorContext, 3, 8 ) 170 : report::inspection::DefaultComponentInspectorModel::createDefault( m_xInspectorContext ) ); 171 172 m_xBrowserController = inspection::ObjectInspector::createWithModel(m_xInspectorContext, xInspectorModel); 173 if ( !m_xBrowserController.is() ) 174 { 175 const ::rtl::OUString sServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.inspection.ObjectInspector" ) ); 176 ShowServiceNotAvailableError(pParent, sServiceName, sal_True); 177 } 178 else 179 { 180 m_xBrowserController->attachFrame(m_xMeAsFrame); 181 m_xBrowserComponentWindow = m_xMeAsFrame->getComponentWindow(); 182 OSL_ENSURE(m_xBrowserComponentWindow.is(), "PropBrw::PropBrw: attached the controller, but have no component window!"); 183 if ( bEnableHelpSection ) 184 { 185 uno::Reference< inspection::XObjectInspector > xInspector( m_xBrowserController, uno::UNO_QUERY_THROW ); 186 uno::Reference< inspection::XObjectInspectorUI > xInspectorUI( xInspector->getInspectorUI() ); 187 uno::Reference< uno::XInterface > xDefaultHelpProvider( inspection::DefaultHelpProvider::create( m_xInspectorContext, xInspectorUI ) ); 188 } 189 } 190 xFactoryProperties->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) ,makeAny(xOwnContext)); 191 } 192 catch (Exception&) 193 { 194 DBG_ERROR("PropBrw::PropBrw: could not create/initialize the browser controller!"); 195 try 196 { 197 ::comphelper::disposeComponent(m_xBrowserController); 198 ::comphelper::disposeComponent(m_xBrowserComponentWindow); 199 Reference< XPropertySet > xFactoryProperties( m_xORB, UNO_QUERY_THROW ); 200 if ( xOwnContext.is() ) 201 xFactoryProperties->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) ,makeAny(xOwnContext)); 202 } 203 catch(Exception&) { } 204 m_xBrowserController.clear(); 205 m_xBrowserComponentWindow.clear(); 206 } 207 } 208 209 if (m_xBrowserComponentWindow.is()) 210 { 211 212 m_xBrowserComponentWindow->setPosSize(0, 0, aPropWinSize.Width(), aPropWinSize.Height(), 213 awt::PosSize::WIDTH | awt::PosSize::HEIGHT | awt::PosSize::X | awt::PosSize::Y); 214 Resize(); 215 m_xBrowserComponentWindow->setVisible(sal_True); 216 } 217 ::rptui::notifySystemWindow(pParent,this,::comphelper::mem_fun(&TaskPaneList::AddWindow)); 218 } 219 220 //---------------------------------------------------------------------------- 221 222 PropBrw::~PropBrw() 223 { 224 if (m_xBrowserController.is()) 225 implDetachController(); 226 227 try 228 { 229 uno::Reference<container::XNameContainer> xName(m_xInspectorContext,uno::UNO_QUERY); 230 if ( xName.is() ) 231 { 232 const ::rtl::OUString pProps[] = { ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ContextDocument" ) ) 233 , ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DialogParentWindow" ) ) 234 , ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ActiveConnection" ) )}; 235 for (size_t i = 0; i < sizeof(pProps)/sizeof(pProps[0]); ++i) 236 xName->removeByName(pProps[i]); 237 } 238 } 239 catch(Exception&) 240 {} 241 242 ::rptui::notifySystemWindow(this,this,::comphelper::mem_fun(&TaskPaneList::RemoveWindow)); 243 244 DBG_DTOR( rpt_PropBrw,NULL); 245 } 246 // ----------------------------------------------------------------------------- 247 void PropBrw::setCurrentPage(const ::rtl::OUString& _sLastActivePage) 248 { 249 m_sLastActivePage = _sLastActivePage; 250 } 251 //---------------------------------------------------------------------------- 252 253 void PropBrw::implDetachController() 254 { 255 m_sLastActivePage = getCurrentPage(); 256 implSetNewObject( ); 257 258 if ( m_xMeAsFrame.is() ) 259 m_xMeAsFrame->setComponent( NULL, NULL ); 260 261 if ( m_xBrowserController.is() ) 262 m_xBrowserController->attachFrame( NULL ); 263 264 m_xMeAsFrame.clear(); 265 m_xBrowserController.clear(); 266 m_xBrowserComponentWindow.clear(); 267 } 268 //----------------------------------------------------------------------- 269 ::rtl::OUString PropBrw::getCurrentPage() const 270 { 271 ::rtl::OUString sCurrentPage; 272 try 273 { 274 if ( m_xBrowserController.is() ) 275 { 276 OSL_VERIFY( m_xBrowserController->getViewData() >>= sCurrentPage ); 277 } 278 279 if ( !sCurrentPage.getLength() ) 280 sCurrentPage = m_sLastActivePage; 281 } 282 catch( const Exception& ) 283 { 284 OSL_ENSURE( sal_False, "PropBrw::getCurrentPage: caught an exception while retrieving the current page!" ); 285 } 286 return sCurrentPage; 287 } 288 //---------------------------------------------------------------------------- 289 290 sal_Bool PropBrw::Close() 291 { 292 m_xLastSection.clear(); 293 // suspend the controller (it is allowed to veto) 294 if ( m_xMeAsFrame.is() ) 295 { 296 try 297 { 298 Reference< XController > xController( m_xMeAsFrame->getController() ); 299 if ( xController.is() && !xController->suspend( sal_True ) ) 300 return sal_False; 301 } 302 catch( const Exception& ) 303 { 304 OSL_ENSURE( sal_False, "FmPropBrw::Close: caught an exception while asking the controller!" ); 305 } 306 } 307 implDetachController(); 308 309 if( IsRollUp() ) 310 RollDown(); 311 312 m_pDesignView->getController().executeUnChecked(SID_PROPERTYBROWSER_LAST_PAGE,uno::Sequence< beans::PropertyValue>()); 313 314 return sal_True; 315 } 316 317 //---------------------------------------------------------------------------- 318 319 uno::Sequence< Reference<uno::XInterface> > PropBrw::CreateCompPropSet(const SdrMarkList& _rMarkList) 320 { 321 sal_uInt32 nMarkCount = _rMarkList.GetMarkCount(); 322 ::std::vector< uno::Reference< uno::XInterface> > aSets; 323 aSets.reserve(nMarkCount); 324 325 for(sal_uInt32 i=0;i<nMarkCount;++i) 326 { 327 SdrObject* pCurrent = _rMarkList.GetMark(i)->GetMarkedSdrObj(); 328 329 ::std::auto_ptr<SdrObjListIter> pGroupIterator; 330 if (pCurrent->IsGroupObject()) 331 { 332 pGroupIterator.reset(new SdrObjListIter(*pCurrent->GetSubList())); 333 pCurrent = pGroupIterator->IsMore() ? pGroupIterator->Next() : NULL; 334 } 335 336 while (pCurrent) 337 { 338 OObjectBase* pObj = dynamic_cast<OObjectBase*>(pCurrent); 339 if ( pObj ) 340 aSets.push_back(CreateComponentPair(pObj)); 341 342 // next element 343 pCurrent = pGroupIterator.get() && pGroupIterator->IsMore() ? pGroupIterator->Next() : NULL; 344 } 345 } 346 Reference<uno::XInterface> *pSets = aSets.empty() ? NULL : &aSets[0]; 347 return uno::Sequence< Reference<uno::XInterface> >(pSets, aSets.size()); 348 } 349 //---------------------------------------------------------------------------- 350 void PropBrw::implSetNewObject( const uno::Sequence< Reference<uno::XInterface> >& _aObjects ) 351 { 352 if ( m_xBrowserController.is() ) 353 { 354 try 355 { 356 m_xBrowserController->inspect(uno::Sequence< Reference<uno::XInterface> >()); 357 m_xBrowserController->inspect(_aObjects); 358 } 359 catch( const Exception& ) 360 { 361 OSL_ENSURE( sal_False, "FmPropBrw::StateChanged: caught an exception while setting the initial page!" ); 362 } 363 364 //Resize(); 365 } 366 SetText( GetHeadlineName(_aObjects) ); 367 } 368 369 //---------------------------------------------------------------------------- 370 371 ::rtl::OUString PropBrw::GetHeadlineName( const uno::Sequence< Reference<uno::XInterface> >& _aObjects ) 372 { 373 ::rtl::OUString aName; 374 if ( !_aObjects.getLength() ) 375 { 376 aName = String(ModuleRes(RID_STR_BRWTITLE_NO_PROPERTIES)); 377 } 378 else if ( _aObjects.getLength() == 1 ) // single selection 379 { 380 sal_uInt16 nResId = 0; 381 aName = String(ModuleRes(RID_STR_BRWTITLE_PROPERTIES)); 382 383 uno::Reference< container::XNameContainer > xNameCont(_aObjects[0],uno::UNO_QUERY); 384 Reference< lang::XServiceInfo > xServiceInfo( xNameCont->getByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReportComponent"))), UNO_QUERY ); 385 if ( xServiceInfo.is() ) 386 { 387 if ( xServiceInfo->supportsService( SERVICE_FIXEDTEXT ) ) 388 { 389 nResId = RID_STR_PROPTITLE_FIXEDTEXT; 390 } 391 else if ( xServiceInfo->supportsService( SERVICE_IMAGECONTROL ) ) 392 { 393 nResId = RID_STR_PROPTITLE_IMAGECONTROL; 394 } 395 else if ( xServiceInfo->supportsService( SERVICE_FORMATTEDFIELD ) ) 396 { 397 nResId = RID_STR_PROPTITLE_FORMATTED; 398 } 399 else if ( xServiceInfo->supportsService( SERVICE_SHAPE ) ) 400 { 401 nResId = RID_STR_PROPTITLE_SHAPE; 402 } 403 else if ( xServiceInfo->supportsService( SERVICE_REPORTDEFINITION ) ) 404 { 405 nResId = RID_STR_PROPTITLE_REPORT; 406 } 407 else if ( xServiceInfo->supportsService( SERVICE_SECTION ) ) 408 { 409 nResId = RID_STR_PROPTITLE_SECTION; 410 } 411 else if ( xServiceInfo->supportsService( SERVICE_FUNCTION ) ) 412 { 413 nResId = RID_STR_PROPTITLE_FUNCTION; 414 } 415 else if ( xServiceInfo->supportsService( SERVICE_GROUP ) ) 416 { 417 nResId = RID_STR_PROPTITLE_GROUP; 418 } 419 else if ( xServiceInfo->supportsService( SERVICE_FIXEDLINE ) ) 420 { 421 nResId = RID_STR_PROPTITLE_FIXEDLINE; 422 } 423 else 424 { 425 OSL_ENSURE(0,"Unknown service name!"); 426 nResId = RID_STR_CLASS_FORMATTEDFIELD; 427 } 428 429 if (nResId) 430 { 431 aName += String(ModuleRes(nResId)); 432 } 433 } 434 } 435 else // multiselection 436 { 437 aName = String(ModuleRes(RID_STR_BRWTITLE_PROPERTIES)); 438 aName += String(ModuleRes(RID_STR_BRWTITLE_MULTISELECT)); 439 } 440 441 return aName; 442 } 443 // ----------------------------------------------------------------------------- 444 uno::Reference< uno::XInterface> PropBrw::CreateComponentPair(OObjectBase* _pObj) 445 { 446 _pObj->initializeOle(); 447 return CreateComponentPair(_pObj->getAwtComponent(),_pObj->getReportComponent()); 448 } 449 //---------------------------------------------------------------------------- 450 uno::Reference< uno::XInterface> PropBrw::CreateComponentPair(const uno::Reference< uno::XInterface>& _xFormComponent 451 ,const uno::Reference< uno::XInterface>& _xReportComponent) 452 { 453 uno::Reference< container::XNameContainer > xNameCont = ::comphelper::NameContainer_createInstance(::getCppuType(static_cast<Reference<XInterface> * >(NULL))); 454 xNameCont->insertByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FormComponent")),uno::makeAny(_xFormComponent)); 455 xNameCont->insertByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReportComponent")),uno::makeAny(_xReportComponent)); 456 xNameCont->insertByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RowSet")) 457 ,uno::makeAny(uno::Reference< uno::XInterface>(m_pDesignView->getController().getRowSet()))); 458 459 return xNameCont.get(); 460 } 461 // ----------------------------------------------------------------------------- 462 ::Size PropBrw::getMinimumSize() const 463 { 464 ::Size aSize; 465 Reference< awt::XLayoutConstrains > xLayoutConstrains( m_xBrowserController, UNO_QUERY ); 466 if( xLayoutConstrains.is() ) 467 { 468 awt::Size aMinSize = xLayoutConstrains->getMinimumSize(); 469 aMinSize.Height += 4; 470 aMinSize.Width += 4; 471 aSize.setHeight( aMinSize.Height ); 472 aSize.setWidth( aMinSize.Width ); 473 } 474 return aSize; 475 } 476 //---------------------------------------------------------------------------- 477 void PropBrw::Resize() 478 { 479 Window::Resize(); 480 481 Reference< awt::XLayoutConstrains > xLayoutConstrains( m_xBrowserController, UNO_QUERY ); 482 if( xLayoutConstrains.is() ) 483 { 484 ::Size aMinSize = getMinimumSize(); 485 SetMinOutputSizePixel( aMinSize ); 486 ::Size aSize = GetOutputSizePixel(); 487 sal_Bool bResize = sal_False; 488 if( aSize.Width() < aMinSize.Width() ) 489 { 490 aSize.setWidth( aMinSize.Width() ); 491 bResize = sal_True; 492 } 493 if( aSize.Height() < aMinSize.Height() ) 494 { 495 aSize.setHeight( aMinSize.Height() ); 496 bResize = sal_True; 497 } 498 if( bResize ) 499 SetOutputSizePixel( aSize ); 500 } 501 // adjust size 502 if (m_xBrowserComponentWindow.is()) 503 { 504 Size aSize = GetOutputSizePixel(); 505 m_xBrowserComponentWindow->setPosSize(0, 0, aSize.Width(), aSize.Height(), 506 awt::PosSize::WIDTH | awt::PosSize::HEIGHT); 507 } 508 } 509 //---------------------------------------------------------------------------- 510 void PropBrw::Update( OSectionView* pNewView ) 511 { 512 try 513 { 514 if ( m_pView ) 515 { 516 EndListening( *(m_pView->GetModel()) ); 517 m_pView = NULL; 518 } 519 520 // set focus on initialization 521 if ( m_bInitialStateChange ) 522 { 523 // if we're just newly created, we want to have the focus 524 PostUserEvent( LINK( this, PropBrw, OnAsyncGetFocus ) ); 525 m_bInitialStateChange = sal_False; 526 // and additionally, we want to show the page which was active during 527 // our previous incarnation 528 if ( m_sLastActivePage.getLength() && m_xBrowserController.is() ) 529 { 530 try 531 { 532 m_xBrowserController->restoreViewData( makeAny( m_sLastActivePage ) ); 533 } 534 catch( const Exception& ) 535 { 536 OSL_ENSURE( sal_False, "FmPropBrw::StateChanged: caught an exception while setting the initial page!" ); 537 } 538 } 539 } 540 541 if ( !pNewView ) 542 return; 543 else 544 m_pView = pNewView; 545 546 uno::Sequence< Reference<uno::XInterface> > aMarkedObjects; 547 OViewsWindow* pViews = m_pView->getReportSection()->getSectionWindow()->getViewsWindow(); 548 const sal_uInt16 nSectionCount = pViews->getSectionCount(); 549 for (sal_uInt16 i = 0; i < nSectionCount; ++i) 550 { 551 ::boost::shared_ptr<OSectionWindow> pSectionWindow = pViews->getSectionWindow(i); 552 if ( pSectionWindow ) 553 { 554 const SdrMarkList& rMarkList = pSectionWindow->getReportSection().getSectionView().GetMarkedObjectList(); 555 aMarkedObjects = ::comphelper::concatSequences(aMarkedObjects,CreateCompPropSet( rMarkList )); 556 } 557 } 558 559 if ( aMarkedObjects.getLength() ) // multiple selection 560 { 561 m_xLastSection.clear(); 562 implSetNewObject( aMarkedObjects ); 563 } 564 else if ( m_xLastSection != m_pView->getReportSection()->getSection() ) 565 { 566 uno::Reference< uno::XInterface> xTemp(m_pView->getReportSection()->getSection()); 567 m_xLastSection = xTemp; 568 uno::Reference< container::XNameContainer > xNameCont = ::comphelper::NameContainer_createInstance(::getCppuType(static_cast<Reference<XInterface> * >(NULL))); 569 xNameCont->insertByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReportComponent")),uno::makeAny(xTemp)); 570 xTemp = xNameCont; 571 572 implSetNewObject( uno::Sequence< uno::Reference< uno::XInterface> >(&xTemp,1) ); 573 } 574 575 StartListening( *(m_pView->GetModel()) ); 576 } 577 catch ( Exception& ) 578 { 579 DBG_ERROR( "PropBrw::Update: Exception occured!" ); 580 } 581 } 582 //---------------------------------------------------------------------------- 583 void PropBrw::Update( const uno::Reference< uno::XInterface>& _xReportComponent) 584 { 585 if ( m_xLastSection != _xReportComponent ) 586 { 587 m_xLastSection = _xReportComponent; 588 try 589 { 590 if ( m_pView ) 591 { 592 EndListening( *(m_pView->GetModel()) ); 593 m_pView = NULL; 594 } // if ( m_pView ) 595 596 uno::Reference< uno::XInterface> xTemp(CreateComponentPair(_xReportComponent,_xReportComponent)); 597 implSetNewObject( uno::Sequence< uno::Reference< uno::XInterface> >(&xTemp,1) ); 598 } 599 catch ( Exception& ) 600 { 601 DBG_ERROR( "PropBrw::Update: Exception occured!" ); 602 } 603 } 604 } 605 //----------------------------------------------------------------------- 606 IMPL_LINK( PropBrw, OnAsyncGetFocus, void*, ) 607 { 608 if (m_xBrowserComponentWindow.is()) 609 m_xBrowserComponentWindow->setFocus(); 610 return 0L; 611 } 612 //---------------------------------------------------------------------------- 613 void PropBrw::LoseFocus() 614 { 615 DockingWindow::LoseFocus(); 616 m_pDesignView->getController().InvalidateAll(); 617 } 618 //---------------------------------------------------------------------------- 619 } 620