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 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_basctl.hxx" 30 31 32 #include "propbrw.hxx" 33 #include "dlgedobj.hxx" 34 35 #include "basidesh.hxx" 36 #include <iderid.hxx> 37 38 #ifndef _BASCTL_DLGRESID_HRC 39 #include <dlgresid.hrc> 40 #endif 41 #include <tools/debug.hxx> 42 #include <tools/diagnose_ex.h> 43 #include <sfx2/bindings.hxx> 44 #include <sfx2/childwin.hxx> 45 #include <sfx2/objitem.hxx> 46 47 #ifndef _SVX_SVXIDS_HRC 48 #include <svx/svxids.hrc> 49 #endif 50 #include <tools/shl.hxx> 51 #include <vcl/stdtext.hxx> 52 #include <svx/svdview.hxx> 53 #include <svx/svdogrp.hxx> 54 #include <svx/svdpage.hxx> 55 #include <svx/svditer.hxx> 56 #include <sfx2/viewsh.hxx> 57 58 #ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ 59 #include <toolkit/unohlp.hxx> 60 #endif 61 #include <comphelper/property.hxx> 62 #include <comphelper/composedprops.hxx> 63 #include <comphelper/stl_types.hxx> 64 #include <comphelper/types.hxx> 65 #include <com/sun/star/beans/PropertyValue.hpp> 66 #include <com/sun/star/awt/PosSize.hpp> 67 #include <com/sun/star/lang/XServiceInfo.hpp> 68 #include <com/sun/star/inspection/XObjectInspector.hpp> 69 #include <comphelper/processfactory.hxx> 70 #include <cppuhelper/component_context.hxx> 71 72 #include <sfx2/dispatch.hxx> 73 #include <sfx2/viewfrm.hxx> 74 75 using namespace ::com::sun::star; 76 using namespace ::com::sun::star::uno; 77 using namespace ::com::sun::star::lang; 78 using namespace ::com::sun::star::frame; 79 using namespace ::com::sun::star::beans; 80 using namespace ::com::sun::star::container; 81 using namespace ::comphelper; 82 83 //============================================================================ 84 // PropBrwMgr 85 //============================================================================ 86 87 SFX_IMPL_FLOATINGWINDOW(PropBrwMgr, SID_SHOW_PROPERTYBROWSER) 88 89 //---------------------------------------------------------------------------- 90 91 PropBrwMgr::PropBrwMgr( Window* _pParent, sal_uInt16 nId, 92 SfxBindings *pBindings, SfxChildWinInfo* pInfo) 93 :SfxChildWindow( _pParent, nId ) 94 { 95 // set current selection 96 SfxViewShell* pShell = SfxViewShell::Current(); 97 pWindow = new PropBrw( 98 ::comphelper::getProcessServiceFactory(), 99 pBindings, 100 this, 101 _pParent, 102 pShell ? pShell->GetCurrentDocument() : Reference< XModel >() 103 ); 104 105 eChildAlignment = SFX_ALIGN_NOALIGNMENT; 106 ((SfxFloatingWindow*)pWindow)->Initialize( pInfo ); 107 108 ((PropBrw*)pWindow)->Update( pShell ); 109 } 110 111 //---------------------------------------------------------------------------- 112 void PropBrw::Update( const SfxViewShell* _pShell ) 113 { 114 const BasicIDEShell* pBasicIDEShell = dynamic_cast< const BasicIDEShell* >( _pShell ); 115 OSL_ENSURE( pBasicIDEShell || !_pShell, "PropBrw::Update: invalid shell!" ); 116 if ( pBasicIDEShell ) 117 { 118 ImplUpdate( pBasicIDEShell->GetCurrentDocument(), pBasicIDEShell->GetCurDlgView() ); 119 } 120 else if ( _pShell ) 121 { 122 ImplUpdate( NULL, _pShell->GetDrawView() ); 123 } 124 else 125 { 126 ImplUpdate( NULL, NULL ); 127 } 128 } 129 130 //---------------------------------------------------------------------------- 131 132 const long STD_WIN_SIZE_X = 300; 133 const long STD_WIN_SIZE_Y = 350; 134 135 const long STD_MIN_SIZE_X = 250; 136 const long STD_MIN_SIZE_Y = 250; 137 138 const long STD_WIN_POS_X = 50; 139 const long STD_WIN_POS_Y = 50; 140 const long WIN_BORDER = 2; 141 const long MIN_WIN_SIZE_X = 50; 142 const long MIN_WIN_SIZE_Y = 50; 143 144 //---------------------------------------------------------------------------- 145 146 //============================================================================ 147 // PropBrw 148 //============================================================================ 149 150 DBG_NAME(PropBrw) 151 152 //---------------------------------------------------------------------------- 153 154 PropBrw::PropBrw( const Reference< XMultiServiceFactory >& _xORB, SfxBindings* _pBindings, PropBrwMgr* _pMgr, Window* _pParent, 155 const Reference< XModel >& _rxContextDocument ) 156 :SfxFloatingWindow( _pBindings, _pMgr, _pParent, WinBits( WB_STDMODELESS | WB_SIZEABLE | WB_3DLOOK | WB_ROLLABLE ) ) 157 ,m_bInitialStateChange(sal_True) 158 ,m_xORB(_xORB) 159 ,m_xContextDocument( _rxContextDocument ) 160 ,pView( NULL ) 161 { 162 DBG_CTOR(PropBrw,NULL); 163 164 Size aPropWinSize(STD_WIN_SIZE_X,STD_WIN_SIZE_Y); 165 SetMinOutputSizePixel(Size(STD_MIN_SIZE_X,STD_MIN_SIZE_Y)); 166 SetOutputSizePixel(aPropWinSize); 167 168 try 169 { 170 // create a frame wrapper for myself 171 m_xMeAsFrame = Reference< XFrame >(m_xORB->createInstance(::rtl::OUString::createFromAscii("com.sun.star.frame.Frame")), UNO_QUERY); 172 if (m_xMeAsFrame.is()) 173 { 174 m_xMeAsFrame->initialize( VCLUnoHelper::GetInterface ( this ) ); 175 m_xMeAsFrame->setName(::rtl::OUString::createFromAscii("form property browser")); // change name! 176 } 177 } 178 catch (Exception&) 179 { 180 DBG_ERROR("PropBrw::PropBrw: could not create/initialize my frame!"); 181 m_xMeAsFrame.clear(); 182 } 183 184 ImplReCreateController(); 185 } 186 187 //---------------------------------------------------------------------------- 188 189 void PropBrw::ImplReCreateController() 190 { 191 OSL_PRECOND( m_xMeAsFrame.is(), "PropBrw::ImplCreateController: no frame for myself!" ); 192 if ( !m_xMeAsFrame.is() ) 193 return; 194 195 if ( m_xBrowserController.is() ) 196 ImplDestroyController(); 197 198 try 199 { 200 Reference< XPropertySet > xFactoryProperties( m_xORB, UNO_QUERY_THROW ); 201 Reference< XComponentContext > xOwnContext( 202 xFactoryProperties->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) ), 203 UNO_QUERY_THROW ); 204 205 // a ComponentContext for the 206 ::cppu::ContextEntry_Init aHandlerContextInfo[] = 207 { 208 ::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DialogParentWindow" ) ), makeAny( VCLUnoHelper::GetInterface ( this ) ) ), 209 ::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ContextDocument" ) ), makeAny( m_xContextDocument ) ) 210 }; 211 Reference< XComponentContext > xInspectorContext( 212 ::cppu::createComponentContext( aHandlerContextInfo, sizeof( aHandlerContextInfo ) / sizeof( aHandlerContextInfo[0] ), 213 xOwnContext ) ); 214 215 // create a property browser controller 216 Reference< XMultiComponentFactory > xFactory( xInspectorContext->getServiceManager(), UNO_QUERY_THROW ); 217 static const ::rtl::OUString s_sControllerServiceName = ::rtl::OUString::createFromAscii("com.sun.star.awt.PropertyBrowserController"); 218 m_xBrowserController = Reference< XPropertySet >( 219 xFactory->createInstanceWithContext( s_sControllerServiceName, xInspectorContext ), UNO_QUERY 220 ); 221 if ( !m_xBrowserController.is() ) 222 { 223 ShowServiceNotAvailableError( GetParent(), s_sControllerServiceName, sal_True ); 224 } 225 else 226 { 227 Reference< XController > xAsXController( m_xBrowserController, UNO_QUERY ); 228 DBG_ASSERT(xAsXController.is(), "PropBrw::PropBrw: invalid controller object!"); 229 if (!xAsXController.is()) 230 { 231 ::comphelper::disposeComponent(m_xBrowserController); 232 m_xBrowserController.clear(); 233 } 234 else 235 { 236 xAsXController->attachFrame(m_xMeAsFrame); 237 m_xBrowserComponentWindow = m_xMeAsFrame->getComponentWindow(); 238 DBG_ASSERT(m_xBrowserComponentWindow.is(), "PropBrw::PropBrw: attached the controller, but have no component window!"); 239 } 240 } 241 242 Point aPropWinPos = Point( WIN_BORDER, WIN_BORDER ); 243 Size aPropWinSize(STD_WIN_SIZE_X,STD_WIN_SIZE_Y); 244 aPropWinSize.Width() -= (2*WIN_BORDER); 245 aPropWinSize.Height() -= (2*WIN_BORDER); 246 247 if ( m_xBrowserComponentWindow.is() ) 248 { 249 m_xBrowserComponentWindow->setPosSize(aPropWinPos.X(), aPropWinPos.Y(), aPropWinSize.Width(), aPropWinSize.Height(), 250 ::com::sun::star::awt::PosSize::WIDTH | ::com::sun::star::awt::PosSize::HEIGHT | 251 ::com::sun::star::awt::PosSize::X | ::com::sun::star::awt::PosSize::Y); 252 m_xBrowserComponentWindow->setVisible(sal_True); 253 } 254 } 255 catch (Exception&) 256 { 257 DBG_ERROR("PropBrw::PropBrw: could not create/initialize the browser controller!"); 258 try 259 { 260 ::comphelper::disposeComponent(m_xBrowserController); 261 ::comphelper::disposeComponent(m_xBrowserComponentWindow); 262 } 263 catch(Exception&) 264 { 265 } 266 267 m_xBrowserController.clear(); 268 m_xBrowserComponentWindow.clear(); 269 } 270 271 Resize(); 272 } 273 274 //---------------------------------------------------------------------------- 275 276 PropBrw::~PropBrw() 277 { 278 if ( m_xBrowserController.is() ) 279 ImplDestroyController(); 280 281 DBG_DTOR(PropBrw,NULL); 282 } 283 284 //---------------------------------------------------------------------------- 285 286 void PropBrw::ImplDestroyController() 287 { 288 implSetNewObject( Reference< XPropertySet >() ); 289 290 if ( m_xMeAsFrame.is() ) 291 m_xMeAsFrame->setComponent( NULL, NULL ); 292 293 Reference< XController > xAsXController( m_xBrowserController, UNO_QUERY ); 294 if ( xAsXController.is() ) 295 xAsXController->attachFrame( NULL ); 296 297 try 298 { 299 ::comphelper::disposeComponent( m_xBrowserController ); 300 } 301 catch( const Exception& ) 302 { 303 DBG_UNHANDLED_EXCEPTION(); 304 } 305 306 m_xBrowserController.clear(); 307 } 308 309 //---------------------------------------------------------------------------- 310 311 sal_Bool PropBrw::Close() 312 { 313 ImplDestroyController(); 314 315 if( IsRollUp() ) 316 RollDown(); 317 318 sal_Bool bClose = SfxFloatingWindow::Close(); 319 320 return bClose; 321 } 322 323 //---------------------------------------------------------------------------- 324 Sequence< Reference< XInterface > > 325 PropBrw::CreateMultiSelectionSequence( const SdrMarkList& _rMarkList ) 326 { 327 Sequence< Reference< XInterface > > aSeq; 328 InterfaceArray aInterfaces; 329 330 sal_uInt32 nMarkCount = _rMarkList.GetMarkCount(); 331 for( sal_uInt32 i = 0 ; i < nMarkCount ; i++ ) 332 { 333 SdrObject* pCurrent = _rMarkList.GetMark(i)->GetMarkedSdrObj(); 334 335 SdrObjListIter* pGroupIterator = NULL; 336 if (pCurrent->IsGroupObject()) 337 { 338 pGroupIterator = new SdrObjListIter(*pCurrent->GetSubList()); 339 pCurrent = pGroupIterator->IsMore() ? pGroupIterator->Next() : NULL; 340 } 341 342 while (pCurrent) 343 { 344 DlgEdObj* pDlgEdObj = PTR_CAST(DlgEdObj, pCurrent); 345 if (pDlgEdObj) 346 { 347 Reference< XInterface > xControlInterface(pDlgEdObj->GetUnoControlModel(), UNO_QUERY); 348 if (xControlInterface.is()) 349 aInterfaces.push_back(xControlInterface); 350 } 351 352 // next element 353 pCurrent = pGroupIterator && pGroupIterator->IsMore() ? pGroupIterator->Next() : NULL; 354 } 355 if (pGroupIterator) 356 delete pGroupIterator; 357 } 358 359 sal_Int32 nCount = aInterfaces.size(); 360 aSeq.realloc( nCount ); 361 Reference< XInterface >* pInterfaces = aSeq.getArray(); 362 for( sal_Int32 i = 0 ; i < nCount ; i++ ) 363 pInterfaces[i] = aInterfaces[i]; 364 365 return aSeq; 366 } 367 368 //---------------------------------------------------------------------------- 369 void PropBrw::implSetNewObjectSequence 370 ( const Sequence< Reference< XInterface > >& _rObjectSeq ) 371 { 372 Reference< inspection::XObjectInspector > xObjectInspector(m_xBrowserController, UNO_QUERY); 373 if ( xObjectInspector.is() ) 374 { 375 xObjectInspector->inspect( _rObjectSeq ); 376 377 ::rtl::OUString aText = ::rtl::OUString(String(IDEResId(RID_STR_BRWTITLE_PROPERTIES))); 378 aText += ::rtl::OUString(String(IDEResId(RID_STR_BRWTITLE_MULTISELECT))); 379 SetText( aText ); 380 } 381 } 382 383 //---------------------------------------------------------------------------- 384 385 void PropBrw::implSetNewObject( const Reference< XPropertySet >& _rxObject ) 386 { 387 if ( m_xBrowserController.is() ) 388 { 389 m_xBrowserController->setPropertyValue( 390 ::rtl::OUString::createFromAscii( "IntrospectedObject" ), 391 makeAny( _rxObject ) 392 ); 393 394 // set the new title according to the selected object 395 SetText( GetHeadlineName( _rxObject ) ); 396 } 397 } 398 399 //---------------------------------------------------------------------------- 400 401 ::rtl::OUString PropBrw::GetHeadlineName( const Reference< XPropertySet >& _rxObject ) 402 { 403 ::rtl::OUString aName; 404 Reference< lang::XServiceInfo > xServiceInfo( _rxObject, UNO_QUERY ); 405 406 if (xServiceInfo.is()) // single selection 407 { 408 sal_uInt16 nResId = 0; 409 aName = ::rtl::OUString(String(IDEResId(RID_STR_BRWTITLE_PROPERTIES))); 410 411 if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ) ) ) 412 { 413 nResId = RID_STR_CLASS_DIALOG; 414 } 415 else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlButtonModel" ) ) ) ) 416 { 417 nResId = RID_STR_CLASS_BUTTON; 418 } 419 else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlRadioButtonModel" ) ) ) ) 420 { 421 nResId = RID_STR_CLASS_RADIOBUTTON; 422 } 423 else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlCheckBoxModel" ) ) ) ) 424 { 425 nResId = RID_STR_CLASS_CHECKBOX; 426 } 427 else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlListBoxModel" ) ) ) ) 428 { 429 nResId = RID_STR_CLASS_LISTBOX; 430 } 431 else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlComboBoxModel" ) ) ) ) 432 { 433 nResId = RID_STR_CLASS_COMBOBOX; 434 } 435 else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlGroupBoxModel" ) ) ) ) 436 { 437 nResId = RID_STR_CLASS_GROUPBOX; 438 } 439 else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlEditModel" ) ) ) ) 440 { 441 nResId = RID_STR_CLASS_EDIT; 442 } 443 else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlFixedTextModel" ) ) ) ) 444 { 445 nResId = RID_STR_CLASS_FIXEDTEXT; 446 } 447 else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlImageControlModel" ) ) ) ) 448 { 449 nResId = RID_STR_CLASS_IMAGECONTROL; 450 } 451 else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlProgressBarModel" ) ) ) ) 452 { 453 nResId = RID_STR_CLASS_PROGRESSBAR; 454 } 455 else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlScrollBarModel" ) ) ) ) 456 { 457 nResId = RID_STR_CLASS_SCROLLBAR; 458 } 459 else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlFixedLineModel" ) ) ) ) 460 { 461 nResId = RID_STR_CLASS_FIXEDLINE; 462 } 463 else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDateFieldModel" ) ) ) ) 464 { 465 nResId = RID_STR_CLASS_DATEFIELD; 466 } 467 else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlTimeFieldModel" ) ) ) ) 468 { 469 nResId = RID_STR_CLASS_TIMEFIELD; 470 } 471 else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlNumericFieldModel" ) ) ) ) 472 { 473 nResId = RID_STR_CLASS_NUMERICFIELD; 474 } 475 else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlCurrencyFieldModel" ) ) ) ) 476 { 477 nResId = RID_STR_CLASS_CURRENCYFIELD; 478 } 479 else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlFormattedFieldModel" ) ) ) ) 480 { 481 nResId = RID_STR_CLASS_FORMATTEDFIELD; 482 } 483 else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlPatternFieldModel" ) ) ) ) 484 { 485 nResId = RID_STR_CLASS_PATTERNFIELD; 486 } 487 else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlFileControlModel" ) ) ) ) 488 { 489 nResId = RID_STR_CLASS_FILECONTROL; 490 } 491 else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.tree.TreeControlModel" ) ) ) ) 492 { 493 nResId = RID_STR_CLASS_TREECONTROL; 494 } 495 else 496 { 497 nResId = RID_STR_CLASS_CONTROL; 498 } 499 500 if (nResId) 501 { 502 aName += ::rtl::OUString( String(IDEResId(nResId)) ); 503 } 504 } 505 else if (!_rxObject.is()) // no properties 506 { 507 aName = ::rtl::OUString(String(IDEResId(RID_STR_BRWTITLE_NO_PROPERTIES))); 508 } 509 // #i73075 Handled in implSetNewObjectSequence 510 //else // multiselection 511 //{ 512 // aName = ::rtl::OUString(String(IDEResId(RID_STR_BRWTITLE_PROPERTIES))); 513 // aName += ::rtl::OUString(String(IDEResId(RID_STR_BRWTITLE_MULTISELECT))); 514 //} 515 516 return aName; 517 } 518 519 //---------------------------------------------------------------------------- 520 521 void PropBrw::FillInfo( SfxChildWinInfo& rInfo ) const 522 { 523 rInfo.bVisible = sal_False; 524 } 525 526 //---------------------------------------------------------------------------- 527 528 void PropBrw::Resize() 529 { 530 SfxFloatingWindow::Resize(); 531 532 // adjust size 533 Size aSize_ = GetOutputSizePixel(); 534 Size aPropWinSize( aSize_ ); 535 aPropWinSize.Width() -= (2*WIN_BORDER); 536 aPropWinSize.Height() -= (2*WIN_BORDER); 537 538 if (m_xBrowserComponentWindow.is()) 539 { 540 m_xBrowserComponentWindow->setPosSize(0, 0, aPropWinSize.Width(), aPropWinSize.Height(), 541 ::com::sun::star::awt::PosSize::WIDTH | ::com::sun::star::awt::PosSize::HEIGHT); 542 } 543 } 544 545 //---------------------------------------------------------------------------- 546 547 void PropBrw::ImplUpdate( const Reference< XModel >& _rxContextDocument, SdrView* pNewView ) 548 { 549 Reference< XModel > xContextDocument( _rxContextDocument ); 550 551 // if we should simply "empty" ourself, assume the context document didn't change 552 if ( !pNewView ) 553 { 554 OSL_ENSURE( !_rxContextDocument.is(), "PropBrw::ImplUpdate: no view, but a document?!" ); 555 xContextDocument = m_xContextDocument; 556 } 557 558 if ( xContextDocument != m_xContextDocument ) 559 { 560 m_xContextDocument = xContextDocument; 561 ImplReCreateController(); 562 } 563 564 try 565 { 566 if ( pView ) 567 { 568 EndListening( *(pView->GetModel()) ); 569 pView = NULL; 570 } 571 572 if ( !pNewView ) 573 return; 574 575 pView = pNewView; 576 577 // set focus on initialization 578 if ( m_bInitialStateChange ) 579 { 580 if ( m_xBrowserComponentWindow.is() ) 581 m_xBrowserComponentWindow->setFocus(); 582 m_bInitialStateChange = sal_False; 583 } 584 585 const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); 586 sal_uInt32 nMarkCount = rMarkList.GetMarkCount(); 587 588 if ( nMarkCount == 0 ) 589 { 590 EndListening( *(pView->GetModel()) ); 591 pView = NULL; 592 implSetNewObject( NULL ); 593 return; 594 } 595 596 Reference< XPropertySet > xNewObject; 597 Sequence< Reference< XInterface > > aNewObjects; 598 if ( nMarkCount == 1 ) 599 { 600 DlgEdObj* pDlgEdObj = PTR_CAST( DlgEdObj, rMarkList.GetMark(0)->GetMarkedSdrObj() ); 601 if ( pDlgEdObj ) 602 { 603 if ( pDlgEdObj->IsGroupObject() ) // group object 604 aNewObjects = CreateMultiSelectionSequence( rMarkList ); 605 else // single selection 606 xNewObject = xNewObject.query( pDlgEdObj->GetUnoControlModel() ); 607 } 608 } 609 else if ( nMarkCount > 1 ) // multiple selection 610 { 611 aNewObjects = CreateMultiSelectionSequence( rMarkList ); 612 } 613 614 if ( aNewObjects.getLength() ) 615 implSetNewObjectSequence( aNewObjects ); 616 else 617 implSetNewObject( xNewObject ); 618 619 StartListening( *(pView->GetModel()) ); 620 } 621 catch ( const PropertyVetoException& ) { /* silence */ } 622 catch ( const Exception& ) 623 { 624 DBG_UNHANDLED_EXCEPTION(); 625 } 626 } 627 628 //---------------------------------------------------------------------------- 629