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