1*5b190011SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*5b190011SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*5b190011SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*5b190011SAndrew Rist * distributed with this work for additional information 6*5b190011SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*5b190011SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*5b190011SAndrew Rist * "License"); you may not use this file except in compliance 9*5b190011SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*5b190011SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*5b190011SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*5b190011SAndrew Rist * software distributed under the License is distributed on an 15*5b190011SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*5b190011SAndrew Rist * KIND, either express or implied. See the License for the 17*5b190011SAndrew Rist * specific language governing permissions and limitations 18*5b190011SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*5b190011SAndrew Rist *************************************************************/ 21*5b190011SAndrew Rist 22*5b190011SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sd.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "DrawController.hxx" 28cdf0e10cSrcweir #include "DrawDocShell.hxx" 29cdf0e10cSrcweir 30cdf0e10cSrcweir #include "DrawSubController.hxx" 31cdf0e10cSrcweir #include "sdpage.hxx" 32cdf0e10cSrcweir #include "ViewShellBase.hxx" 33cdf0e10cSrcweir #include "ViewShellManager.hxx" 34cdf0e10cSrcweir #include "FormShellManager.hxx" 35cdf0e10cSrcweir #include "Window.hxx" 36cdf0e10cSrcweir 37cdf0e10cSrcweir #include <comphelper/anytostring.hxx> 38cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 39cdf0e10cSrcweir #include <comphelper/sequence.hxx> 40cdf0e10cSrcweir #include <comphelper/stl_types.hxx> 41cdf0e10cSrcweir #include <cppuhelper/exc_hlp.hxx> 42cdf0e10cSrcweir #include <cppuhelper/bootstrap.hxx> 43cdf0e10cSrcweir 44cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp> 45cdf0e10cSrcweir #include <com/sun/star/drawing/framework/ConfigurationController.hpp> 46cdf0e10cSrcweir #include <com/sun/star/drawing/framework/ModuleController.hpp> 47cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp> 48cdf0e10cSrcweir 49cdf0e10cSrcweir #include "slideshow.hxx" 50cdf0e10cSrcweir 51cdf0e10cSrcweir #include <svx/fmshell.hxx> 52cdf0e10cSrcweir #include <vos/mutex.hxx> 53cdf0e10cSrcweir #include <vcl/svapp.hxx> 54cdf0e10cSrcweir #include <boost/shared_ptr.hpp> 55cdf0e10cSrcweir 56cdf0e10cSrcweir using namespace ::std; 57cdf0e10cSrcweir using ::rtl::OUString; 58cdf0e10cSrcweir using namespace ::cppu; 59cdf0e10cSrcweir using namespace ::vos; 60cdf0e10cSrcweir using namespace ::com::sun::star; 61cdf0e10cSrcweir using namespace ::com::sun::star::uno; 62cdf0e10cSrcweir using namespace ::com::sun::star::drawing::framework; 63cdf0e10cSrcweir 64cdf0e10cSrcweir namespace { 65cdf0e10cSrcweir static const ::com::sun::star::uno::Type saComponentTypeIdentifier ( 66cdf0e10cSrcweir ::getCppuType( (Reference<lang::XEventListener > *)0 )); 67cdf0e10cSrcweir static const ::com::sun::star::uno::Type saSelectionTypeIdentifier ( 68cdf0e10cSrcweir ::getCppuType( (Reference<view::XSelectionChangeListener > *)0 )); 69cdf0e10cSrcweir 70cdf0e10cSrcweir } // end of anonymous namespace 71cdf0e10cSrcweir 72cdf0e10cSrcweir namespace sd { 73cdf0e10cSrcweir 74cdf0e10cSrcweir DrawController::DrawController (ViewShellBase& rBase) throw() 75cdf0e10cSrcweir : DrawControllerInterfaceBase(&rBase), 76cdf0e10cSrcweir BroadcastHelperOwner(SfxBaseController::m_aMutex), 77cdf0e10cSrcweir OPropertySetHelper( static_cast<OBroadcastHelperVar< 78cdf0e10cSrcweir OMultiTypeInterfaceContainerHelper, 79cdf0e10cSrcweir OMultiTypeInterfaceContainerHelper::keyType>& >( 80cdf0e10cSrcweir BroadcastHelperOwner::maBroadcastHelper)), 81cdf0e10cSrcweir mpBase(&rBase), 82cdf0e10cSrcweir maLastVisArea(), 83cdf0e10cSrcweir mpCurrentPage(NULL), 84cdf0e10cSrcweir mbMasterPageMode(false), 85cdf0e10cSrcweir mbLayerMode(false), 86cdf0e10cSrcweir mbDisposing(false), 87cdf0e10cSrcweir mpPropertyArrayHelper(NULL), 88cdf0e10cSrcweir mxSubController(), 89cdf0e10cSrcweir mxConfigurationController(), 90cdf0e10cSrcweir mxModuleController() 91cdf0e10cSrcweir { 92cdf0e10cSrcweir ProvideFrameworkControllers(); 93cdf0e10cSrcweir } 94cdf0e10cSrcweir 95cdf0e10cSrcweir 96cdf0e10cSrcweir 97cdf0e10cSrcweir 98cdf0e10cSrcweir DrawController::~DrawController (void) throw() 99cdf0e10cSrcweir { 100cdf0e10cSrcweir } 101cdf0e10cSrcweir 102cdf0e10cSrcweir 103cdf0e10cSrcweir 104cdf0e10cSrcweir 105cdf0e10cSrcweir void DrawController::SetSubController ( 106cdf0e10cSrcweir const Reference<drawing::XDrawSubController>& rxSubController) 107cdf0e10cSrcweir { 108cdf0e10cSrcweir // Update the internal state. 109cdf0e10cSrcweir mxSubController = rxSubController; 110cdf0e10cSrcweir mpPropertyArrayHelper.reset(); 111cdf0e10cSrcweir maLastVisArea = Rectangle(); 112cdf0e10cSrcweir 113cdf0e10cSrcweir // Inform listeners about the changed state. 114cdf0e10cSrcweir FireSelectionChangeListener(); 115cdf0e10cSrcweir } 116cdf0e10cSrcweir 117cdf0e10cSrcweir 118cdf0e10cSrcweir 119cdf0e10cSrcweir 120cdf0e10cSrcweir // XInterface 121cdf0e10cSrcweir 122cdf0e10cSrcweir IMPLEMENT_FORWARD_XINTERFACE2( 123cdf0e10cSrcweir DrawController, 124cdf0e10cSrcweir DrawControllerInterfaceBase, 125cdf0e10cSrcweir OPropertySetHelper); 126cdf0e10cSrcweir 127cdf0e10cSrcweir 128cdf0e10cSrcweir // XTypeProvider 129cdf0e10cSrcweir 130cdf0e10cSrcweir Sequence<Type> SAL_CALL DrawController::getTypes (void) 131cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 132cdf0e10cSrcweir { 133cdf0e10cSrcweir ThrowIfDisposed(); 134cdf0e10cSrcweir // OPropertySetHelper does not provide getTypes, so we have to 135cdf0e10cSrcweir // implement this method manually and list its three interfaces. 136cdf0e10cSrcweir OTypeCollection aTypeCollection ( 137cdf0e10cSrcweir ::getCppuType (( const Reference<beans::XMultiPropertySet>*)NULL), 138cdf0e10cSrcweir ::getCppuType (( const Reference<beans::XFastPropertySet>*)NULL), 139cdf0e10cSrcweir ::getCppuType (( const Reference<beans::XPropertySet>*)NULL)); 140cdf0e10cSrcweir 141cdf0e10cSrcweir return ::comphelper::concatSequences( 142cdf0e10cSrcweir SfxBaseController::getTypes(), 143cdf0e10cSrcweir aTypeCollection.getTypes(), 144cdf0e10cSrcweir DrawControllerInterfaceBase::getTypes()); 145cdf0e10cSrcweir } 146cdf0e10cSrcweir 147cdf0e10cSrcweir IMPLEMENT_GET_IMPLEMENTATION_ID(DrawController); 148cdf0e10cSrcweir 149cdf0e10cSrcweir 150cdf0e10cSrcweir 151cdf0e10cSrcweir // XComponent 152cdf0e10cSrcweir 153cdf0e10cSrcweir 154cdf0e10cSrcweir void SAL_CALL DrawController::dispose (void) 155cdf0e10cSrcweir throw( RuntimeException ) 156cdf0e10cSrcweir { 157cdf0e10cSrcweir if( !mbDisposing ) 158cdf0e10cSrcweir { 159cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 160cdf0e10cSrcweir 161cdf0e10cSrcweir if( !mbDisposing ) 162cdf0e10cSrcweir { 163cdf0e10cSrcweir mbDisposing = true; 164cdf0e10cSrcweir 165cdf0e10cSrcweir boost::shared_ptr<ViewShell> pViewShell = mpBase->GetMainViewShell(); 166cdf0e10cSrcweir if ( pViewShell ) 167cdf0e10cSrcweir { 168cdf0e10cSrcweir pViewShell->DeactivateCurrentFunction(); 169cdf0e10cSrcweir DrawDocShell* pDocShell = pViewShell->GetDocSh(); 170cdf0e10cSrcweir if ( pDocShell != NULL ) 171cdf0e10cSrcweir pDocShell->SetDocShellFunction(0); 172cdf0e10cSrcweir } 173cdf0e10cSrcweir pViewShell.reset(); 174cdf0e10cSrcweir 175cdf0e10cSrcweir // When the controller has not been detached from its view 176cdf0e10cSrcweir // shell, i.e. mpViewShell is not NULL, then tell PaneManager 177cdf0e10cSrcweir // and ViewShellManager to clear the shell stack. 178cdf0e10cSrcweir if (mxSubController.is() && mpBase!=NULL) 179cdf0e10cSrcweir { 180cdf0e10cSrcweir mpBase->DisconnectAllClients(); 181cdf0e10cSrcweir mpBase->GetViewShellManager()->Shutdown(); 182cdf0e10cSrcweir } 183cdf0e10cSrcweir 184cdf0e10cSrcweir OPropertySetHelper::disposing(); 185cdf0e10cSrcweir 186cdf0e10cSrcweir DisposeFrameworkControllers(); 187cdf0e10cSrcweir 188cdf0e10cSrcweir SfxBaseController::dispose(); 189cdf0e10cSrcweir } 190cdf0e10cSrcweir } 191cdf0e10cSrcweir } 192cdf0e10cSrcweir 193cdf0e10cSrcweir 194cdf0e10cSrcweir 195cdf0e10cSrcweir 196cdf0e10cSrcweir void SAL_CALL DrawController::addEventListener( 197cdf0e10cSrcweir const Reference<lang::XEventListener >& xListener) 198cdf0e10cSrcweir throw (RuntimeException) 199cdf0e10cSrcweir { 200cdf0e10cSrcweir ThrowIfDisposed(); 201cdf0e10cSrcweir SfxBaseController::addEventListener( xListener ); 202cdf0e10cSrcweir } 203cdf0e10cSrcweir 204cdf0e10cSrcweir 205cdf0e10cSrcweir 206cdf0e10cSrcweir 207cdf0e10cSrcweir void SAL_CALL DrawController::removeEventListener ( 208cdf0e10cSrcweir const Reference<lang::XEventListener >& aListener) 209cdf0e10cSrcweir throw (RuntimeException) 210cdf0e10cSrcweir { 211cdf0e10cSrcweir if(!rBHelper.bDisposed && !rBHelper.bInDispose && !mbDisposing) 212cdf0e10cSrcweir SfxBaseController::removeEventListener( aListener ); 213cdf0e10cSrcweir } 214cdf0e10cSrcweir 215cdf0e10cSrcweir // XController 216cdf0e10cSrcweir ::sal_Bool SAL_CALL DrawController::suspend( ::sal_Bool Suspend ) throw (::com::sun::star::uno::RuntimeException) 217cdf0e10cSrcweir { 218cdf0e10cSrcweir if( Suspend ) 219cdf0e10cSrcweir { 220cdf0e10cSrcweir ViewShellBase* pViewShellBase = GetViewShellBase(); 221cdf0e10cSrcweir if( pViewShellBase ) 222cdf0e10cSrcweir { 223cdf0e10cSrcweir // do not allow suspend if a slideshow needs this controller! 224cdf0e10cSrcweir rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( *pViewShellBase ) ); 225cdf0e10cSrcweir if( xSlideShow.is() && xSlideShow->dependsOn(pViewShellBase) ) 226cdf0e10cSrcweir return sal_False; 227cdf0e10cSrcweir } 228cdf0e10cSrcweir } 229cdf0e10cSrcweir 230cdf0e10cSrcweir return SfxBaseController::suspend( Suspend ); 231cdf0e10cSrcweir } 232cdf0e10cSrcweir 233cdf0e10cSrcweir 234cdf0e10cSrcweir // XServiceInfo 235cdf0e10cSrcweir 236cdf0e10cSrcweir OUString SAL_CALL DrawController::getImplementationName( ) throw(RuntimeException) 237cdf0e10cSrcweir { 238cdf0e10cSrcweir // Do not throw an excepetion at the moment. This leads to a crash 239cdf0e10cSrcweir // under Solaris on relead. See issue i70929 for details. 240cdf0e10cSrcweir // ThrowIfDisposed(); 241cdf0e10cSrcweir return OUString( RTL_CONSTASCII_USTRINGPARAM( "DrawController" ) ); 242cdf0e10cSrcweir } 243cdf0e10cSrcweir 244cdf0e10cSrcweir 245cdf0e10cSrcweir 246cdf0e10cSrcweir static OUString ssServiceName (OUString::createFromAscii( 247cdf0e10cSrcweir "com.sun.star.drawing.DrawingDocumentDrawView")); 248cdf0e10cSrcweir 249cdf0e10cSrcweir sal_Bool SAL_CALL DrawController::supportsService ( 250cdf0e10cSrcweir const OUString& rsServiceName) 251cdf0e10cSrcweir throw(RuntimeException) 252cdf0e10cSrcweir { 253cdf0e10cSrcweir // Do not throw an excepetion at the moment. This leads to a crash 254cdf0e10cSrcweir // under Solaris on relead. See issue i70929 for details. 255cdf0e10cSrcweir // ThrowIfDisposed(); 256cdf0e10cSrcweir return rsServiceName.equals(ssServiceName); 257cdf0e10cSrcweir } 258cdf0e10cSrcweir 259cdf0e10cSrcweir 260cdf0e10cSrcweir 261cdf0e10cSrcweir 262cdf0e10cSrcweir Sequence<OUString> SAL_CALL DrawController::getSupportedServiceNames (void) 263cdf0e10cSrcweir throw(RuntimeException) 264cdf0e10cSrcweir { 265cdf0e10cSrcweir ThrowIfDisposed(); 266cdf0e10cSrcweir Sequence<OUString> aSupportedServices (1); 267cdf0e10cSrcweir OUString* pServices = aSupportedServices.getArray(); 268cdf0e10cSrcweir pServices[0] = ssServiceName; 269cdf0e10cSrcweir return aSupportedServices; 270cdf0e10cSrcweir } 271cdf0e10cSrcweir 272cdf0e10cSrcweir 273cdf0e10cSrcweir 274cdf0e10cSrcweir 275cdf0e10cSrcweir //------ XSelectionSupplier -------------------------------------------- 276cdf0e10cSrcweir 277cdf0e10cSrcweir sal_Bool SAL_CALL DrawController::select (const Any& aSelection) 278cdf0e10cSrcweir throw(lang::IllegalArgumentException, RuntimeException) 279cdf0e10cSrcweir { 280cdf0e10cSrcweir ThrowIfDisposed(); 281cdf0e10cSrcweir ::vos::OGuard aGuard (Application::GetSolarMutex()); 282cdf0e10cSrcweir 283cdf0e10cSrcweir if (mxSubController.is()) 284cdf0e10cSrcweir return mxSubController->select(aSelection); 285cdf0e10cSrcweir else 286cdf0e10cSrcweir return false; 287cdf0e10cSrcweir } 288cdf0e10cSrcweir 289cdf0e10cSrcweir 290cdf0e10cSrcweir 291cdf0e10cSrcweir 292cdf0e10cSrcweir Any SAL_CALL DrawController::getSelection() 293cdf0e10cSrcweir throw(RuntimeException) 294cdf0e10cSrcweir { 295cdf0e10cSrcweir ThrowIfDisposed(); 296cdf0e10cSrcweir ::vos::OGuard aGuard (Application::GetSolarMutex()); 297cdf0e10cSrcweir 298cdf0e10cSrcweir if (mxSubController.is()) 299cdf0e10cSrcweir return mxSubController->getSelection(); 300cdf0e10cSrcweir else 301cdf0e10cSrcweir return Any(); 302cdf0e10cSrcweir } 303cdf0e10cSrcweir 304cdf0e10cSrcweir 305cdf0e10cSrcweir 306cdf0e10cSrcweir 307cdf0e10cSrcweir void SAL_CALL DrawController::addSelectionChangeListener( 308cdf0e10cSrcweir const Reference< view::XSelectionChangeListener >& xListener) 309cdf0e10cSrcweir throw(RuntimeException) 310cdf0e10cSrcweir { 311cdf0e10cSrcweir if( mbDisposing ) 312cdf0e10cSrcweir throw lang::DisposedException(); 313cdf0e10cSrcweir 314cdf0e10cSrcweir BroadcastHelperOwner::maBroadcastHelper.addListener (saSelectionTypeIdentifier, xListener); 315cdf0e10cSrcweir } 316cdf0e10cSrcweir 317cdf0e10cSrcweir 318cdf0e10cSrcweir 319cdf0e10cSrcweir 320cdf0e10cSrcweir void SAL_CALL DrawController::removeSelectionChangeListener( 321cdf0e10cSrcweir const Reference< view::XSelectionChangeListener >& xListener ) 322cdf0e10cSrcweir throw(RuntimeException) 323cdf0e10cSrcweir { 324cdf0e10cSrcweir if (rBHelper.bDisposed) 325cdf0e10cSrcweir throw lang::DisposedException(); 326cdf0e10cSrcweir 327cdf0e10cSrcweir BroadcastHelperOwner::maBroadcastHelper.removeListener (saSelectionTypeIdentifier, xListener); 328cdf0e10cSrcweir } 329cdf0e10cSrcweir 330cdf0e10cSrcweir 331cdf0e10cSrcweir 332cdf0e10cSrcweir 333cdf0e10cSrcweir 334cdf0e10cSrcweir //===== lang::XEventListener ================================================ 335cdf0e10cSrcweir 336cdf0e10cSrcweir void SAL_CALL 337cdf0e10cSrcweir DrawController::disposing (const lang::EventObject& ) 338cdf0e10cSrcweir throw (uno::RuntimeException) 339cdf0e10cSrcweir { 340cdf0e10cSrcweir } 341cdf0e10cSrcweir 342cdf0e10cSrcweir 343cdf0e10cSrcweir 344cdf0e10cSrcweir 345cdf0e10cSrcweir //===== view::XSelectionChangeListener ====================================== 346cdf0e10cSrcweir 347cdf0e10cSrcweir void SAL_CALL 348cdf0e10cSrcweir DrawController::selectionChanged (const lang::EventObject& rEvent) 349cdf0e10cSrcweir throw (uno::RuntimeException) 350cdf0e10cSrcweir { 351cdf0e10cSrcweir ThrowIfDisposed(); 352cdf0e10cSrcweir // Have to forward the event to our selection change listeners. 353cdf0e10cSrcweir OInterfaceContainerHelper* pListeners = BroadcastHelperOwner::maBroadcastHelper.getContainer( 354cdf0e10cSrcweir ::getCppuType((Reference<view::XSelectionChangeListener>*)0)); 355cdf0e10cSrcweir if (pListeners) 356cdf0e10cSrcweir { 357cdf0e10cSrcweir // Re-send the event to all of our listeners. 358cdf0e10cSrcweir OInterfaceIteratorHelper aIterator (*pListeners); 359cdf0e10cSrcweir while (aIterator.hasMoreElements()) 360cdf0e10cSrcweir { 361cdf0e10cSrcweir try 362cdf0e10cSrcweir { 363cdf0e10cSrcweir view::XSelectionChangeListener* pListener = 364cdf0e10cSrcweir static_cast<view::XSelectionChangeListener*>( 365cdf0e10cSrcweir aIterator.next()); 366cdf0e10cSrcweir if (pListener != NULL) 367cdf0e10cSrcweir pListener->selectionChanged (rEvent); 368cdf0e10cSrcweir } 369cdf0e10cSrcweir catch (RuntimeException aException) 370cdf0e10cSrcweir { 371cdf0e10cSrcweir } 372cdf0e10cSrcweir } 373cdf0e10cSrcweir } 374cdf0e10cSrcweir } 375cdf0e10cSrcweir 376cdf0e10cSrcweir 377cdf0e10cSrcweir 378cdf0e10cSrcweir 379cdf0e10cSrcweir // XDrawView 380cdf0e10cSrcweir 381cdf0e10cSrcweir void SAL_CALL DrawController::setCurrentPage( const Reference< drawing::XDrawPage >& xPage ) 382cdf0e10cSrcweir throw(RuntimeException) 383cdf0e10cSrcweir { 384cdf0e10cSrcweir ThrowIfDisposed(); 385cdf0e10cSrcweir ::vos::OGuard aGuard (Application::GetSolarMutex()); 386cdf0e10cSrcweir 387cdf0e10cSrcweir if (mxSubController.is()) 388cdf0e10cSrcweir mxSubController->setCurrentPage(xPage); 389cdf0e10cSrcweir } 390cdf0e10cSrcweir 391cdf0e10cSrcweir 392cdf0e10cSrcweir 393cdf0e10cSrcweir 394cdf0e10cSrcweir Reference< drawing::XDrawPage > SAL_CALL DrawController::getCurrentPage (void) 395cdf0e10cSrcweir throw(RuntimeException) 396cdf0e10cSrcweir { 397cdf0e10cSrcweir ThrowIfDisposed(); 398cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex() ); 399cdf0e10cSrcweir Reference<drawing::XDrawPage> xPage; 400cdf0e10cSrcweir 401cdf0e10cSrcweir // Get current page from sub controller. 402cdf0e10cSrcweir if (mxSubController.is()) 403cdf0e10cSrcweir xPage = mxSubController->getCurrentPage(); 404cdf0e10cSrcweir 405cdf0e10cSrcweir // When there is not yet a sub controller (during initialization) then fall back 406cdf0e10cSrcweir // to the current page in mpCurrentPage. 407cdf0e10cSrcweir if ( ! xPage.is() && mpCurrentPage.is()) 408cdf0e10cSrcweir xPage = Reference<drawing::XDrawPage>(mpCurrentPage->getUnoPage(), UNO_QUERY); 409cdf0e10cSrcweir 410cdf0e10cSrcweir return xPage; 411cdf0e10cSrcweir } 412cdf0e10cSrcweir 413cdf0e10cSrcweir 414cdf0e10cSrcweir 415cdf0e10cSrcweir 416cdf0e10cSrcweir void DrawController::FireVisAreaChanged (const Rectangle& rVisArea) throw() 417cdf0e10cSrcweir { 418cdf0e10cSrcweir if( maLastVisArea != rVisArea ) 419cdf0e10cSrcweir { 420cdf0e10cSrcweir Any aNewValue; 421cdf0e10cSrcweir aNewValue <<= awt::Rectangle( 422cdf0e10cSrcweir rVisArea.Left(), 423cdf0e10cSrcweir rVisArea.Top(), 424cdf0e10cSrcweir rVisArea.GetWidth(), 425cdf0e10cSrcweir rVisArea.GetHeight() ); 426cdf0e10cSrcweir 427cdf0e10cSrcweir Any aOldValue; 428cdf0e10cSrcweir aOldValue <<= awt::Rectangle( 429cdf0e10cSrcweir maLastVisArea.Left(), 430cdf0e10cSrcweir maLastVisArea.Top(), 431cdf0e10cSrcweir maLastVisArea.GetWidth(), 432cdf0e10cSrcweir maLastVisArea.GetHeight() ); 433cdf0e10cSrcweir 434cdf0e10cSrcweir FirePropertyChange (PROPERTY_WORKAREA, aNewValue, aOldValue); 435cdf0e10cSrcweir 436cdf0e10cSrcweir maLastVisArea = rVisArea; 437cdf0e10cSrcweir } 438cdf0e10cSrcweir } 439cdf0e10cSrcweir 440cdf0e10cSrcweir 441cdf0e10cSrcweir 442cdf0e10cSrcweir 443cdf0e10cSrcweir void DrawController::FireSelectionChangeListener() throw() 444cdf0e10cSrcweir { 445cdf0e10cSrcweir OInterfaceContainerHelper * pLC = BroadcastHelperOwner::maBroadcastHelper.getContainer( 446cdf0e10cSrcweir saSelectionTypeIdentifier); 447cdf0e10cSrcweir if( pLC ) 448cdf0e10cSrcweir { 449cdf0e10cSrcweir Reference< XInterface > xSource( (XWeak*)this ); 450cdf0e10cSrcweir const lang::EventObject aEvent( xSource ); 451cdf0e10cSrcweir 452cdf0e10cSrcweir // Ueber alle Listener iterieren und Events senden 453cdf0e10cSrcweir OInterfaceIteratorHelper aIt( *pLC); 454cdf0e10cSrcweir while( aIt.hasMoreElements() ) 455cdf0e10cSrcweir { 456cdf0e10cSrcweir try 457cdf0e10cSrcweir { 458cdf0e10cSrcweir view::XSelectionChangeListener * pL = 459cdf0e10cSrcweir static_cast<view::XSelectionChangeListener*>(aIt.next()); 460cdf0e10cSrcweir if (pL != NULL) 461cdf0e10cSrcweir pL->selectionChanged( aEvent ); 462cdf0e10cSrcweir } 463cdf0e10cSrcweir catch (RuntimeException aException) 464cdf0e10cSrcweir { 465cdf0e10cSrcweir } 466cdf0e10cSrcweir } 467cdf0e10cSrcweir } 468cdf0e10cSrcweir } 469cdf0e10cSrcweir 470cdf0e10cSrcweir 471cdf0e10cSrcweir 472cdf0e10cSrcweir 473cdf0e10cSrcweir void DrawController::FireChangeEditMode (bool bMasterPageMode) throw() 474cdf0e10cSrcweir { 475cdf0e10cSrcweir if (bMasterPageMode != mbMasterPageMode ) 476cdf0e10cSrcweir { 477cdf0e10cSrcweir FirePropertyChange( 478cdf0e10cSrcweir PROPERTY_MASTERPAGEMODE, 479cdf0e10cSrcweir makeAny(bMasterPageMode), 480cdf0e10cSrcweir makeAny(mbMasterPageMode)); 481cdf0e10cSrcweir 482cdf0e10cSrcweir mbMasterPageMode = bMasterPageMode; 483cdf0e10cSrcweir } 484cdf0e10cSrcweir } 485cdf0e10cSrcweir 486cdf0e10cSrcweir 487cdf0e10cSrcweir 488cdf0e10cSrcweir 489cdf0e10cSrcweir void DrawController::FireChangeLayerMode (bool bLayerMode) throw() 490cdf0e10cSrcweir { 491cdf0e10cSrcweir if (bLayerMode != mbLayerMode) 492cdf0e10cSrcweir { 493cdf0e10cSrcweir FirePropertyChange( 494cdf0e10cSrcweir PROPERTY_LAYERMODE, 495cdf0e10cSrcweir makeAny(bLayerMode), 496cdf0e10cSrcweir makeAny(mbLayerMode)); 497cdf0e10cSrcweir 498cdf0e10cSrcweir mbLayerMode = bLayerMode; 499cdf0e10cSrcweir } 500cdf0e10cSrcweir } 501cdf0e10cSrcweir 502cdf0e10cSrcweir 503cdf0e10cSrcweir 504cdf0e10cSrcweir 505cdf0e10cSrcweir void DrawController::FireSwitchCurrentPage (SdPage* pNewCurrentPage) throw() 506cdf0e10cSrcweir { 507cdf0e10cSrcweir SdrPage* pCurrentPage = mpCurrentPage.get(); 508cdf0e10cSrcweir if (pNewCurrentPage != pCurrentPage) 509cdf0e10cSrcweir { 510cdf0e10cSrcweir try 511cdf0e10cSrcweir { 512cdf0e10cSrcweir Any aNewValue ( 513cdf0e10cSrcweir makeAny(Reference<drawing::XDrawPage>(pNewCurrentPage->getUnoPage(), UNO_QUERY))); 514cdf0e10cSrcweir 515cdf0e10cSrcweir Any aOldValue; 516cdf0e10cSrcweir if (pCurrentPage != NULL) 517cdf0e10cSrcweir { 518cdf0e10cSrcweir Reference<drawing::XDrawPage> xOldPage (pCurrentPage->getUnoPage(), UNO_QUERY); 519cdf0e10cSrcweir aOldValue <<= xOldPage; 520cdf0e10cSrcweir } 521cdf0e10cSrcweir 522cdf0e10cSrcweir FirePropertyChange(PROPERTY_CURRENTPAGE, aNewValue, aOldValue); 523cdf0e10cSrcweir 524cdf0e10cSrcweir mpCurrentPage.reset(pNewCurrentPage); 525cdf0e10cSrcweir } 526cdf0e10cSrcweir catch( uno::Exception& e ) 527cdf0e10cSrcweir { 528cdf0e10cSrcweir (void)e; 529cdf0e10cSrcweir DBG_ERROR( 530cdf0e10cSrcweir (::rtl::OString("sd::SdUnoDrawView::FireSwitchCurrentPage(), " 531cdf0e10cSrcweir "exception caught: ") + 532cdf0e10cSrcweir ::rtl::OUStringToOString( 533cdf0e10cSrcweir comphelper::anyToString( cppu::getCaughtException() ), 534cdf0e10cSrcweir RTL_TEXTENCODING_UTF8 )).getStr() ); 535cdf0e10cSrcweir } 536cdf0e10cSrcweir } 537cdf0e10cSrcweir } 538cdf0e10cSrcweir 539cdf0e10cSrcweir 540cdf0e10cSrcweir 541cdf0e10cSrcweir 542cdf0e10cSrcweir void DrawController::FirePropertyChange ( 543cdf0e10cSrcweir sal_Int32 nHandle, 544cdf0e10cSrcweir const Any& rNewValue, 545cdf0e10cSrcweir const Any& rOldValue) 546cdf0e10cSrcweir { 547cdf0e10cSrcweir try 548cdf0e10cSrcweir { 549cdf0e10cSrcweir fire (&nHandle, &rNewValue, &rOldValue, 1, sal_False); 550cdf0e10cSrcweir } 551cdf0e10cSrcweir catch (RuntimeException aException) 552cdf0e10cSrcweir { 553cdf0e10cSrcweir // Ignore this exception. Exceptions should be handled in the 554cdf0e10cSrcweir // fire() function so that all listeners are called. This is 555cdf0e10cSrcweir // not the case at the moment, so we simply ignore the 556cdf0e10cSrcweir // exception. 557cdf0e10cSrcweir } 558cdf0e10cSrcweir 559cdf0e10cSrcweir } 560cdf0e10cSrcweir 561cdf0e10cSrcweir 562cdf0e10cSrcweir 563cdf0e10cSrcweir 564cdf0e10cSrcweir ViewShellBase* DrawController::GetViewShellBase (void) 565cdf0e10cSrcweir { 566cdf0e10cSrcweir return mpBase; 567cdf0e10cSrcweir } 568cdf0e10cSrcweir 569cdf0e10cSrcweir 570cdf0e10cSrcweir 571cdf0e10cSrcweir 572cdf0e10cSrcweir void DrawController::ReleaseViewShellBase (void) 573cdf0e10cSrcweir { 574cdf0e10cSrcweir DisposeFrameworkControllers(); 575cdf0e10cSrcweir mpBase = NULL; 576cdf0e10cSrcweir } 577cdf0e10cSrcweir 578cdf0e10cSrcweir 579cdf0e10cSrcweir 580cdf0e10cSrcweir 581cdf0e10cSrcweir //===== XControllerManager ============================================================== 582cdf0e10cSrcweir 583cdf0e10cSrcweir Reference<XConfigurationController> SAL_CALL 584cdf0e10cSrcweir DrawController::getConfigurationController (void) 585cdf0e10cSrcweir throw (RuntimeException) 586cdf0e10cSrcweir { 587cdf0e10cSrcweir ThrowIfDisposed(); 588cdf0e10cSrcweir 589cdf0e10cSrcweir return mxConfigurationController; 590cdf0e10cSrcweir } 591cdf0e10cSrcweir 592cdf0e10cSrcweir 593cdf0e10cSrcweir 594cdf0e10cSrcweir 595cdf0e10cSrcweir Reference<XModuleController> SAL_CALL 596cdf0e10cSrcweir DrawController::getModuleController (void) 597cdf0e10cSrcweir throw (RuntimeException) 598cdf0e10cSrcweir { 599cdf0e10cSrcweir ThrowIfDisposed(); 600cdf0e10cSrcweir 601cdf0e10cSrcweir return mxModuleController; 602cdf0e10cSrcweir } 603cdf0e10cSrcweir 604cdf0e10cSrcweir 605cdf0e10cSrcweir 606cdf0e10cSrcweir 607cdf0e10cSrcweir //===== XUnoTunnel ============================================================ 608cdf0e10cSrcweir 609cdf0e10cSrcweir const Sequence<sal_Int8>& DrawController::getUnoTunnelId (void) 610cdf0e10cSrcweir { 611cdf0e10cSrcweir static ::com::sun::star::uno::Sequence<sal_Int8>* pSequence = NULL; 612cdf0e10cSrcweir if (pSequence == NULL) 613cdf0e10cSrcweir { 614cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard (::osl::Mutex::getGlobalMutex()); 615cdf0e10cSrcweir if (pSequence == NULL) 616cdf0e10cSrcweir { 617cdf0e10cSrcweir static ::com::sun::star::uno::Sequence<sal_Int8> aSequence (16); 618cdf0e10cSrcweir rtl_createUuid((sal_uInt8*)aSequence.getArray(), 0, sal_True); 619cdf0e10cSrcweir pSequence = &aSequence; 620cdf0e10cSrcweir } 621cdf0e10cSrcweir } 622cdf0e10cSrcweir return *pSequence; 623cdf0e10cSrcweir } 624cdf0e10cSrcweir 625cdf0e10cSrcweir 626cdf0e10cSrcweir 627cdf0e10cSrcweir 628cdf0e10cSrcweir sal_Int64 SAL_CALL DrawController::getSomething (const Sequence<sal_Int8>& rId) 629cdf0e10cSrcweir throw (RuntimeException) 630cdf0e10cSrcweir { 631cdf0e10cSrcweir sal_Int64 nResult = 0; 632cdf0e10cSrcweir 633cdf0e10cSrcweir if (rId.getLength() == 16 634cdf0e10cSrcweir && rtl_compareMemory(getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0) 635cdf0e10cSrcweir { 636cdf0e10cSrcweir nResult = sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); 637cdf0e10cSrcweir } 638cdf0e10cSrcweir 639cdf0e10cSrcweir return nResult; 640cdf0e10cSrcweir } 641cdf0e10cSrcweir 642cdf0e10cSrcweir 643cdf0e10cSrcweir 644cdf0e10cSrcweir 645cdf0e10cSrcweir //===== Properties ============================================================ 646cdf0e10cSrcweir 647cdf0e10cSrcweir void DrawController::FillPropertyTable ( 648cdf0e10cSrcweir ::std::vector<beans::Property>& rProperties) 649cdf0e10cSrcweir { 650cdf0e10cSrcweir rProperties.push_back( 651cdf0e10cSrcweir beans::Property( 652cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("VisibleArea") ), 653cdf0e10cSrcweir PROPERTY_WORKAREA, 654cdf0e10cSrcweir ::getCppuType((const ::com::sun::star::awt::Rectangle*)0), 655cdf0e10cSrcweir beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY)); 656cdf0e10cSrcweir rProperties.push_back( 657cdf0e10cSrcweir beans::Property( 658cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("SubController") ), 659cdf0e10cSrcweir PROPERTY_SUB_CONTROLLER, 660cdf0e10cSrcweir ::getCppuType((const Reference<drawing::XDrawSubController>*)0), 661cdf0e10cSrcweir beans::PropertyAttribute::BOUND)); 662cdf0e10cSrcweir rProperties.push_back( 663cdf0e10cSrcweir beans::Property( 664cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("CurrentPage") ), 665cdf0e10cSrcweir PROPERTY_CURRENTPAGE, 666cdf0e10cSrcweir ::getCppuType((const Reference< drawing::XDrawPage > *)0), 667cdf0e10cSrcweir beans::PropertyAttribute::BOUND )); 668cdf0e10cSrcweir rProperties.push_back( 669cdf0e10cSrcweir beans::Property( OUString( RTL_CONSTASCII_USTRINGPARAM("IsLayerMode") ), 670cdf0e10cSrcweir PROPERTY_LAYERMODE, 671cdf0e10cSrcweir ::getCppuBooleanType(), 672cdf0e10cSrcweir beans::PropertyAttribute::BOUND )); 673cdf0e10cSrcweir rProperties.push_back( 674cdf0e10cSrcweir beans::Property( OUString( RTL_CONSTASCII_USTRINGPARAM("IsMasterPageMode") ), 675cdf0e10cSrcweir PROPERTY_MASTERPAGEMODE, 676cdf0e10cSrcweir ::getCppuBooleanType(), 677cdf0e10cSrcweir beans::PropertyAttribute::BOUND )); 678cdf0e10cSrcweir rProperties.push_back( 679cdf0e10cSrcweir beans::Property( OUString( RTL_CONSTASCII_USTRINGPARAM("ActiveLayer") ), 680cdf0e10cSrcweir PROPERTY_ACTIVE_LAYER, 681cdf0e10cSrcweir ::getCppuBooleanType(), 682cdf0e10cSrcweir beans::PropertyAttribute::BOUND )); 683cdf0e10cSrcweir rProperties.push_back( 684cdf0e10cSrcweir beans::Property( OUString( RTL_CONSTASCII_USTRINGPARAM("ZoomValue") ), 685cdf0e10cSrcweir PROPERTY_ZOOMVALUE, 686cdf0e10cSrcweir ::getCppuType((const sal_Int16*)0), 687cdf0e10cSrcweir beans::PropertyAttribute::BOUND )); 688cdf0e10cSrcweir rProperties.push_back( 689cdf0e10cSrcweir beans::Property( OUString( RTL_CONSTASCII_USTRINGPARAM("ZoomType") ), 690cdf0e10cSrcweir PROPERTY_ZOOMTYPE, 691cdf0e10cSrcweir ::getCppuType((const sal_Int16*)0), 692cdf0e10cSrcweir beans::PropertyAttribute::BOUND )); 693cdf0e10cSrcweir rProperties.push_back( 694cdf0e10cSrcweir beans::Property( OUString( RTL_CONSTASCII_USTRINGPARAM("ViewOffset") ), 695cdf0e10cSrcweir PROPERTY_VIEWOFFSET, 696cdf0e10cSrcweir ::getCppuType((const ::com::sun::star::awt::Point*)0), 697cdf0e10cSrcweir beans::PropertyAttribute::BOUND )); 698cdf0e10cSrcweir rProperties.push_back( 699cdf0e10cSrcweir beans::Property( OUString( RTL_CONSTASCII_USTRINGPARAM("DrawViewMode") ), 700cdf0e10cSrcweir PROPERTY_DRAWVIEWMODE, 701cdf0e10cSrcweir ::getCppuType((const ::com::sun::star::awt::Point*)0), 702cdf0e10cSrcweir beans::PropertyAttribute::BOUND|beans::PropertyAttribute::READONLY|beans::PropertyAttribute::MAYBEVOID )); 703cdf0e10cSrcweir } 704cdf0e10cSrcweir 705cdf0e10cSrcweir 706cdf0e10cSrcweir 707cdf0e10cSrcweir 708cdf0e10cSrcweir IPropertyArrayHelper & DrawController::getInfoHelper() 709cdf0e10cSrcweir { 710cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 711cdf0e10cSrcweir 712cdf0e10cSrcweir if (mpPropertyArrayHelper.get() == NULL) 713cdf0e10cSrcweir { 714cdf0e10cSrcweir ::std::vector<beans::Property> aProperties; 715cdf0e10cSrcweir FillPropertyTable (aProperties); 716cdf0e10cSrcweir Sequence<beans::Property> aPropertySequence (aProperties.size()); 717cdf0e10cSrcweir for (unsigned int i=0; i<aProperties.size(); i++) 718cdf0e10cSrcweir aPropertySequence[i] = aProperties[i]; 719cdf0e10cSrcweir mpPropertyArrayHelper.reset(new OPropertyArrayHelper(aPropertySequence, sal_False)); 720cdf0e10cSrcweir } 721cdf0e10cSrcweir 722cdf0e10cSrcweir return *mpPropertyArrayHelper.get(); 723cdf0e10cSrcweir } 724cdf0e10cSrcweir 725cdf0e10cSrcweir 726cdf0e10cSrcweir 727cdf0e10cSrcweir 728cdf0e10cSrcweir Reference < beans::XPropertySetInfo > DrawController::getPropertySetInfo() 729cdf0e10cSrcweir throw ( ::com::sun::star::uno::RuntimeException) 730cdf0e10cSrcweir { 731cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex() ); 732cdf0e10cSrcweir 733cdf0e10cSrcweir static Reference < beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); 734cdf0e10cSrcweir return xInfo; 735cdf0e10cSrcweir } 736cdf0e10cSrcweir 737cdf0e10cSrcweir 738cdf0e10cSrcweir uno::Reference< form::runtime::XFormController > SAL_CALL DrawController::getFormController( const uno::Reference< form::XForm >& Form ) throw (uno::RuntimeException) 739cdf0e10cSrcweir { 740cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 741cdf0e10cSrcweir 742cdf0e10cSrcweir FmFormShell* pFormShell = mpBase->GetFormShellManager()->GetFormShell(); 743cdf0e10cSrcweir SdrView* pSdrView = mpBase->GetDrawView(); 744cdf0e10cSrcweir ::boost::shared_ptr<ViewShell> pViewShell = mpBase->GetMainViewShell(); 745cdf0e10cSrcweir ::sd::Window* pWindow = pViewShell ? pViewShell->GetActiveWindow() : NULL; 746cdf0e10cSrcweir 747cdf0e10cSrcweir uno::Reference< form::runtime::XFormController > xController( NULL ); 748cdf0e10cSrcweir if ( pFormShell && pSdrView && pWindow ) 749cdf0e10cSrcweir xController = pFormShell->GetFormController( Form, *pSdrView, *pWindow ); 750cdf0e10cSrcweir return xController; 751cdf0e10cSrcweir } 752cdf0e10cSrcweir 753cdf0e10cSrcweir ::sal_Bool SAL_CALL DrawController::isFormDesignMode( ) throw (uno::RuntimeException) 754cdf0e10cSrcweir { 755cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 756cdf0e10cSrcweir 757cdf0e10cSrcweir sal_Bool bIsDesignMode = sal_True; 758cdf0e10cSrcweir 759cdf0e10cSrcweir FmFormShell* pFormShell = mpBase->GetFormShellManager()->GetFormShell(); 760cdf0e10cSrcweir if ( pFormShell ) 761cdf0e10cSrcweir bIsDesignMode = pFormShell->IsDesignMode(); 762cdf0e10cSrcweir 763cdf0e10cSrcweir return bIsDesignMode; 764cdf0e10cSrcweir } 765cdf0e10cSrcweir 766cdf0e10cSrcweir void SAL_CALL DrawController::setFormDesignMode( ::sal_Bool _DesignMode ) throw (uno::RuntimeException) 767cdf0e10cSrcweir { 768cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 769cdf0e10cSrcweir 770cdf0e10cSrcweir FmFormShell* pFormShell = mpBase->GetFormShellManager()->GetFormShell(); 771cdf0e10cSrcweir if ( pFormShell ) 772cdf0e10cSrcweir pFormShell->SetDesignMode( _DesignMode ); 773cdf0e10cSrcweir } 774cdf0e10cSrcweir 775cdf0e10cSrcweir uno::Reference< awt::XControl > SAL_CALL DrawController::getControl( const uno::Reference< awt::XControlModel >& xModel ) throw (container::NoSuchElementException, uno::RuntimeException) 776cdf0e10cSrcweir { 777cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 778cdf0e10cSrcweir 779cdf0e10cSrcweir FmFormShell* pFormShell = mpBase->GetFormShellManager()->GetFormShell(); 780cdf0e10cSrcweir SdrView* pSdrView = mpBase->GetDrawView(); 781cdf0e10cSrcweir ::boost::shared_ptr<ViewShell> pViewShell = mpBase->GetMainViewShell(); 782cdf0e10cSrcweir ::sd::Window* pWindow = pViewShell ? pViewShell->GetActiveWindow() : NULL; 783cdf0e10cSrcweir 784cdf0e10cSrcweir uno::Reference< awt::XControl > xControl( NULL ); 785cdf0e10cSrcweir if ( pFormShell && pSdrView && pWindow ) 786cdf0e10cSrcweir pFormShell->GetFormControl( xModel, *pSdrView, *pWindow, xControl ); 787cdf0e10cSrcweir return xControl; 788cdf0e10cSrcweir } 789cdf0e10cSrcweir 790cdf0e10cSrcweir 791cdf0e10cSrcweir 792cdf0e10cSrcweir 793cdf0e10cSrcweir sal_Bool DrawController::convertFastPropertyValue ( 794cdf0e10cSrcweir Any & rConvertedValue, 795cdf0e10cSrcweir Any & rOldValue, 796cdf0e10cSrcweir sal_Int32 nHandle, 797cdf0e10cSrcweir const Any& rValue) 798cdf0e10cSrcweir throw ( com::sun::star::lang::IllegalArgumentException) 799cdf0e10cSrcweir { 800cdf0e10cSrcweir sal_Bool bResult = sal_False; 801cdf0e10cSrcweir 802cdf0e10cSrcweir if (nHandle == PROPERTY_SUB_CONTROLLER) 803cdf0e10cSrcweir { 804cdf0e10cSrcweir rOldValue <<= mxSubController; 805cdf0e10cSrcweir rConvertedValue <<= Reference<drawing::XDrawSubController>(rValue, UNO_QUERY); 806cdf0e10cSrcweir bResult = (rOldValue != rConvertedValue); 807cdf0e10cSrcweir } 808cdf0e10cSrcweir else if (mxSubController.is()) 809cdf0e10cSrcweir { 810cdf0e10cSrcweir rConvertedValue = rValue; 811cdf0e10cSrcweir try 812cdf0e10cSrcweir { 813cdf0e10cSrcweir rOldValue = mxSubController->getFastPropertyValue(nHandle); 814cdf0e10cSrcweir bResult = (rOldValue != rConvertedValue); 815cdf0e10cSrcweir } 816cdf0e10cSrcweir catch(beans::UnknownPropertyException aException) 817cdf0e10cSrcweir { 818cdf0e10cSrcweir // The prperty is unknown and thus an illegal argument to this method. 819cdf0e10cSrcweir throw com::sun::star::lang::IllegalArgumentException(); 820cdf0e10cSrcweir } 821cdf0e10cSrcweir } 822cdf0e10cSrcweir 823cdf0e10cSrcweir return bResult; 824cdf0e10cSrcweir } 825cdf0e10cSrcweir 826cdf0e10cSrcweir 827cdf0e10cSrcweir 828cdf0e10cSrcweir 829cdf0e10cSrcweir void DrawController::setFastPropertyValue_NoBroadcast ( 830cdf0e10cSrcweir sal_Int32 nHandle, 831cdf0e10cSrcweir const Any& rValue) 832cdf0e10cSrcweir throw ( com::sun::star::uno::Exception) 833cdf0e10cSrcweir { 834cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 835cdf0e10cSrcweir if (nHandle == PROPERTY_SUB_CONTROLLER) 836cdf0e10cSrcweir SetSubController(Reference<drawing::XDrawSubController>(rValue, UNO_QUERY)); 837cdf0e10cSrcweir else if (mxSubController.is()) 838cdf0e10cSrcweir mxSubController->setFastPropertyValue(nHandle, rValue); 839cdf0e10cSrcweir } 840cdf0e10cSrcweir 841cdf0e10cSrcweir 842cdf0e10cSrcweir 843cdf0e10cSrcweir 844cdf0e10cSrcweir void DrawController::getFastPropertyValue ( 845cdf0e10cSrcweir Any & rRet, 846cdf0e10cSrcweir sal_Int32 nHandle ) const 847cdf0e10cSrcweir { 848cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 849cdf0e10cSrcweir 850cdf0e10cSrcweir switch( nHandle ) 851cdf0e10cSrcweir { 852cdf0e10cSrcweir case PROPERTY_WORKAREA: 853cdf0e10cSrcweir rRet <<= awt::Rectangle( 854cdf0e10cSrcweir maLastVisArea.Left(), 855cdf0e10cSrcweir maLastVisArea.Top(), 856cdf0e10cSrcweir maLastVisArea.GetWidth(), 857cdf0e10cSrcweir maLastVisArea.GetHeight()); 858cdf0e10cSrcweir break; 859cdf0e10cSrcweir 860cdf0e10cSrcweir case PROPERTY_SUB_CONTROLLER: 861cdf0e10cSrcweir rRet <<= mxSubController; 862cdf0e10cSrcweir break; 863cdf0e10cSrcweir 864cdf0e10cSrcweir default: 865cdf0e10cSrcweir if (mxSubController.is()) 866cdf0e10cSrcweir rRet = mxSubController->getFastPropertyValue(nHandle); 867cdf0e10cSrcweir break; 868cdf0e10cSrcweir } 869cdf0e10cSrcweir } 870cdf0e10cSrcweir 871cdf0e10cSrcweir 872cdf0e10cSrcweir 873cdf0e10cSrcweir 874cdf0e10cSrcweir //----------------------------------------------------------------------------- 875cdf0e10cSrcweir 876cdf0e10cSrcweir void DrawController::ProvideFrameworkControllers (void) 877cdf0e10cSrcweir { 878cdf0e10cSrcweir ::vos::OGuard aGuard (Application::GetSolarMutex()); 879cdf0e10cSrcweir try 880cdf0e10cSrcweir { 881cdf0e10cSrcweir Reference<XController> xController (this); 882cdf0e10cSrcweir const Reference<XComponentContext> xContext ( 883cdf0e10cSrcweir ::comphelper::getProcessComponentContext() ); 884cdf0e10cSrcweir mxConfigurationController = ConfigurationController::create( 885cdf0e10cSrcweir xContext, 886cdf0e10cSrcweir xController); 887cdf0e10cSrcweir mxModuleController = ModuleController::create( 888cdf0e10cSrcweir xContext, 889cdf0e10cSrcweir xController); 890cdf0e10cSrcweir } 891cdf0e10cSrcweir catch (RuntimeException&) 892cdf0e10cSrcweir { 893cdf0e10cSrcweir mxConfigurationController = NULL; 894cdf0e10cSrcweir mxModuleController = NULL; 895cdf0e10cSrcweir } 896cdf0e10cSrcweir } 897cdf0e10cSrcweir 898cdf0e10cSrcweir 899cdf0e10cSrcweir 900cdf0e10cSrcweir 901cdf0e10cSrcweir void DrawController::DisposeFrameworkControllers (void) 902cdf0e10cSrcweir { 903cdf0e10cSrcweir Reference<XComponent> xComponent (mxModuleController, UNO_QUERY); 904cdf0e10cSrcweir if (xComponent.is()) 905cdf0e10cSrcweir xComponent->dispose(); 906cdf0e10cSrcweir 907cdf0e10cSrcweir xComponent = Reference<XComponent>(mxConfigurationController, UNO_QUERY); 908cdf0e10cSrcweir if (xComponent.is()) 909cdf0e10cSrcweir xComponent->dispose(); 910cdf0e10cSrcweir } 911cdf0e10cSrcweir 912cdf0e10cSrcweir 913cdf0e10cSrcweir 914cdf0e10cSrcweir 915cdf0e10cSrcweir void DrawController::ThrowIfDisposed (void) const 916cdf0e10cSrcweir throw (::com::sun::star::lang::DisposedException) 917cdf0e10cSrcweir { 918cdf0e10cSrcweir if (rBHelper.bDisposed || rBHelper.bInDispose || mbDisposing) 919cdf0e10cSrcweir { 920cdf0e10cSrcweir OSL_TRACE ("Calling disposed DrawController object. Throwing exception:"); 921cdf0e10cSrcweir throw lang::DisposedException ( 922cdf0e10cSrcweir OUString(RTL_CONSTASCII_USTRINGPARAM( 923cdf0e10cSrcweir "DrawController object has already been disposed")), 924cdf0e10cSrcweir const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this))); 925cdf0e10cSrcweir } 926cdf0e10cSrcweir } 927cdf0e10cSrcweir 928cdf0e10cSrcweir 929cdf0e10cSrcweir 930cdf0e10cSrcweir 931cdf0e10cSrcweir 932cdf0e10cSrcweir } // end of namespace sd 933cdf0e10cSrcweir 934cdf0e10cSrcweir 935