LCOV - code coverage report
Current view: top level - svx/source/svdraw - svdouno.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 240 0.0 %
Date: 2014-04-14 Functions: 0 39 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <svx/sdr/contact/viewcontactofunocontrol.hxx>
      21             : #include <svx/sdr/contact/viewobjectcontactofunocontrol.hxx>
      22             : #include <com/sun/star/container/XChild.hpp>
      23             : #include <com/sun/star/awt/XWindow.hpp>
      24             : #include <com/sun/star/awt/PosSize.hpp>
      25             : #include <com/sun/star/beans/XPropertySet.hpp>
      26             : #include <com/sun/star/io/XPersistObject.hpp>
      27             : #include <com/sun/star/io/XOutputStream.hpp>
      28             : #include <com/sun/star/io/XInputStream.hpp>
      29             : #include <com/sun/star/io/XActiveDataSink.hpp>
      30             : #include <com/sun/star/io/XActiveDataSource.hpp>
      31             : #include <com/sun/star/io/XObjectOutputStream.hpp>
      32             : #include <com/sun/star/io/XObjectInputStream.hpp>
      33             : #include <com/sun/star/util/XCloneable.hpp>
      34             : #include <comphelper/processfactory.hxx>
      35             : #include <comphelper/types.hxx>
      36             : #include <vcl/pdfextoutdevdata.hxx>
      37             : #include <svx/svdouno.hxx>
      38             : #include <svx/svdpagv.hxx>
      39             : #include <svx/svdmodel.hxx>
      40             : #include "svx/svdglob.hxx"
      41             : #include "svx/svdstr.hrc"
      42             : #include <svx/svdetc.hxx>
      43             : #include <svx/svdview.hxx>
      44             : #include <svx/svdorect.hxx>
      45             : #include "svx/svdviter.hxx"
      46             : #include <rtl/ref.hxx>
      47             : #include <set>
      48             : #include <memory>
      49             : #include <svx/sdrpagewindow.hxx>
      50             : #include <svx/sdrpaintwindow.hxx>
      51             : #include <tools/diagnose_ex.h>
      52             : #include <svx/svdograf.hxx>
      53             : 
      54             : using namespace ::com::sun::star;
      55             : using namespace ::sdr::contact;
      56             : 
      57             : 
      58             : //   Defines
      59             : 
      60             : 
      61             : 
      62             : //   Helper class SdrControlEventListenerImpl
      63             : 
      64             : #include <com/sun/star/lang/XEventListener.hpp>
      65             : 
      66             : #include <cppuhelper/implbase1.hxx>
      67             : 
      68             : 
      69           0 : class SdrControlEventListenerImpl : public ::cppu::WeakImplHelper1< ::com::sun::star::lang::XEventListener >
      70             : {
      71             : protected:
      72             :     SdrUnoObj*                  pObj;
      73             : 
      74             : public:
      75           0 :     SdrControlEventListenerImpl(SdrUnoObj* _pObj)
      76           0 :     :   pObj(_pObj)
      77           0 :     {}
      78             : 
      79             :     // XEventListener
      80             :     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      81             : 
      82             :     void StopListening(const uno::Reference< lang::XComponent >& xComp);
      83             :     void StartListening(const uno::Reference< lang::XComponent >& xComp);
      84             : };
      85             : 
      86             : // XEventListener
      87           0 : void SAL_CALL SdrControlEventListenerImpl::disposing( const ::com::sun::star::lang::EventObject& /*Source*/)
      88             :     throw(::com::sun::star::uno::RuntimeException, std::exception)
      89             : {
      90           0 :     if (pObj)
      91             :     {
      92           0 :         pObj->xUnoControlModel = NULL;
      93             :     }
      94           0 : }
      95             : 
      96           0 : void SdrControlEventListenerImpl::StopListening(const uno::Reference< lang::XComponent >& xComp)
      97             : {
      98           0 :     if (xComp.is())
      99           0 :         xComp->removeEventListener(this);
     100           0 : }
     101             : 
     102           0 : void SdrControlEventListenerImpl::StartListening(const uno::Reference< lang::XComponent >& xComp)
     103             : {
     104           0 :     if (xComp.is())
     105           0 :         xComp->addEventListener(this);
     106           0 : }
     107             : 
     108             : 
     109           0 : struct SdrUnoObjDataHolder
     110             : {
     111             :     mutable ::rtl::Reference< SdrControlEventListenerImpl >
     112             :                                     pEventListener;
     113             : };
     114             : 
     115             : 
     116             : namespace
     117             : {
     118           0 :     void lcl_ensureControlVisibility( SdrView* _pView, const SdrUnoObj* _pObject, bool _bVisible )
     119             :     {
     120             :         OSL_PRECOND( _pObject, "lcl_ensureControlVisibility: no object -> no survival!" );
     121             : 
     122           0 :         SdrPageView* pPageView = _pView ? _pView->GetSdrPageView() : NULL;
     123             :         DBG_ASSERT( pPageView, "lcl_ensureControlVisibility: no view found!" );
     124           0 :         if ( !pPageView )
     125           0 :             return;
     126             : 
     127           0 :         ViewContact& rUnoControlContact( _pObject->GetViewContact() );
     128             : 
     129           0 :         for ( sal_uInt32 i = 0; i < pPageView->PageWindowCount(); ++i )
     130             :         {
     131           0 :             const SdrPageWindow* pPageWindow = pPageView->GetPageWindow( i );
     132             :             DBG_ASSERT( pPageWindow, "lcl_ensureControlVisibility: invalid PageViewWindow!" );
     133           0 :             if ( !pPageWindow )
     134           0 :                 continue;
     135             : 
     136           0 :             if ( !pPageWindow->HasObjectContact() )
     137           0 :                 continue;
     138             : 
     139           0 :             ObjectContact& rPageViewContact( pPageWindow->GetObjectContact() );
     140           0 :             const ViewObjectContact& rViewObjectContact( rUnoControlContact.GetViewObjectContact( rPageViewContact ) );
     141           0 :             const ViewObjectContactOfUnoControl* pUnoControlContact = dynamic_cast< const ViewObjectContactOfUnoControl* >( &rViewObjectContact );
     142             :             DBG_ASSERT( pUnoControlContact, "lcl_ensureControlVisibility: wrong ViewObjectContact type!" );
     143           0 :             if ( !pUnoControlContact )
     144           0 :                 continue;
     145             : 
     146           0 :             pUnoControlContact->ensureControlVisibility( _bVisible );
     147             :         }
     148             :     }
     149             : }
     150             : 
     151             : 
     152             : //   SdrUnoObj
     153             : 
     154             : 
     155           0 : TYPEINIT1(SdrUnoObj, SdrRectObj);
     156             : 
     157           0 : SdrUnoObj::SdrUnoObj(const OUString& rModelName, bool _bOwnUnoControlModel)
     158           0 : :   m_pImpl( new SdrUnoObjDataHolder ),
     159           0 :     bOwnUnoControlModel( _bOwnUnoControlModel )
     160             : {
     161           0 :     bIsUnoObj = true;
     162             : 
     163           0 :     m_pImpl->pEventListener = new SdrControlEventListenerImpl(this);
     164             : 
     165             :     // only an owner may create independently
     166           0 :     if (!rModelName.isEmpty())
     167           0 :         CreateUnoControlModel(rModelName);
     168           0 : }
     169             : 
     170           0 : SdrUnoObj::SdrUnoObj(const OUString& rModelName,
     171             :                      const uno::Reference< lang::XMultiServiceFactory >& rxSFac,
     172             :                      bool _bOwnUnoControlModel)
     173           0 : :   m_pImpl( new SdrUnoObjDataHolder ),
     174           0 :     bOwnUnoControlModel( _bOwnUnoControlModel )
     175             : {
     176           0 :     bIsUnoObj = true;
     177             : 
     178           0 :     m_pImpl->pEventListener = new SdrControlEventListenerImpl(this);
     179             : 
     180             :     // only an owner may create independently
     181           0 :     if (!rModelName.isEmpty())
     182           0 :         CreateUnoControlModel(rModelName,rxSFac);
     183           0 : }
     184             : 
     185           0 : SdrUnoObj::~SdrUnoObj()
     186             : {
     187             :     try
     188             :     {
     189             :         // clean up the control model
     190           0 :         uno::Reference< lang::XComponent > xComp(xUnoControlModel, uno::UNO_QUERY);
     191           0 :         if (xComp.is())
     192             :         {
     193             :             // is the control model owned by its environment?
     194           0 :             uno::Reference< container::XChild > xContent(xUnoControlModel, uno::UNO_QUERY);
     195           0 :             if (xContent.is() && !xContent->getParent().is())
     196           0 :                 xComp->dispose();
     197             :             else
     198           0 :                 m_pImpl->pEventListener->StopListening(xComp);
     199           0 :         }
     200             :     }
     201           0 :     catch( const uno::Exception& )
     202             :     {
     203             :         OSL_FAIL( "SdrUnoObj::~SdrUnoObj: caught an exception!" );
     204             :     }
     205           0 :     delete m_pImpl;
     206           0 : }
     207             : 
     208           0 : void SdrUnoObj::SetModel(SdrModel* pNewModel)
     209             : {
     210           0 :     SdrRectObj::SetModel(pNewModel);
     211           0 : }
     212             : 
     213           0 : void SdrUnoObj::SetPage(SdrPage* pNewPage)
     214             : {
     215           0 :     SdrRectObj::SetPage(pNewPage);
     216           0 : }
     217             : 
     218           0 : void SdrUnoObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
     219             : {
     220           0 :     rInfo.bRotateFreeAllowed        =   false;
     221           0 :     rInfo.bRotate90Allowed          =   false;
     222           0 :     rInfo.bMirrorFreeAllowed        =   false;
     223           0 :     rInfo.bMirror45Allowed          =   false;
     224           0 :     rInfo.bMirror90Allowed          =   false;
     225           0 :     rInfo.bTransparenceAllowed = false;
     226           0 :     rInfo.bGradientAllowed = false;
     227           0 :     rInfo.bShearAllowed             =   false;
     228           0 :     rInfo.bEdgeRadiusAllowed        =   false;
     229           0 :     rInfo.bNoOrthoDesired           =   false;
     230           0 :     rInfo.bCanConvToPath            =   false;
     231           0 :     rInfo.bCanConvToPoly            =   false;
     232           0 :     rInfo.bCanConvToPathLineToArea  =   false;
     233           0 :     rInfo.bCanConvToPolyLineToArea  =   false;
     234           0 :     rInfo.bCanConvToContour = false;
     235           0 : }
     236             : 
     237           0 : sal_uInt16 SdrUnoObj::GetObjIdentifier() const
     238             : {
     239           0 :     return sal_uInt16(OBJ_UNO);
     240             : }
     241             : 
     242           0 : void SdrUnoObj::SetContextWritingMode( const sal_Int16 _nContextWritingMode )
     243             : {
     244             :     try
     245             :     {
     246           0 :         uno::Reference< beans::XPropertySet > xModelProperties( GetUnoControlModel(), uno::UNO_QUERY_THROW );
     247           0 :         xModelProperties->setPropertyValue(
     248             :             OUString(  "ContextWritingMode"  ),
     249             :             uno::makeAny( _nContextWritingMode )
     250           0 :         );
     251             :     }
     252           0 :     catch( const uno::Exception& )
     253             :     {
     254             :         DBG_UNHANDLED_EXCEPTION();
     255             :     }
     256           0 : }
     257             : 
     258           0 : OUString SdrUnoObj::TakeObjNameSingul() const
     259             : {
     260           0 :     OUStringBuffer sName(ImpGetResStr(STR_ObjNameSingulUno));
     261             : 
     262           0 :     OUString aName(GetName());
     263           0 :     if (!aName.isEmpty())
     264             :     {
     265           0 :         sName.append(' ');
     266           0 :         sName.append('\'');
     267           0 :         sName.append(aName);
     268           0 :         sName.append('\'');
     269             :     }
     270             : 
     271           0 :     return sName.makeStringAndClear();
     272             : }
     273             : 
     274           0 : OUString SdrUnoObj::TakeObjNamePlural() const
     275             : {
     276           0 :     return ImpGetResStr(STR_ObjNamePluralUno);
     277             : }
     278             : 
     279           0 : SdrUnoObj* SdrUnoObj::Clone() const
     280             : {
     281           0 :     return CloneHelper< SdrUnoObj >();
     282             : }
     283             : 
     284           0 : SdrUnoObj& SdrUnoObj::operator= (const SdrUnoObj& rObj)
     285             : {
     286           0 :     if( this == &rObj )
     287           0 :         return *this;
     288           0 :     SdrRectObj::operator= (rObj);
     289             : 
     290             :     // release the reference to the current control model
     291           0 :     SetUnoControlModel( NULL );
     292             : 
     293           0 :     aUnoControlModelTypeName = rObj.aUnoControlModelTypeName;
     294           0 :     aUnoControlTypeName = rObj.aUnoControlTypeName;
     295             : 
     296             :     // copy the uno control model
     297           0 :     const uno::Reference< awt::XControlModel > xSourceControlModel( rObj.GetUnoControlModel(), uno::UNO_QUERY );
     298           0 :     if ( xSourceControlModel.is() )
     299             :     {
     300             :         try
     301             :         {
     302           0 :             uno::Reference< util::XCloneable > xClone( xSourceControlModel, uno::UNO_QUERY_THROW );
     303           0 :             xUnoControlModel.set( xClone->createClone(), uno::UNO_QUERY_THROW );
     304             :         }
     305           0 :         catch( const uno::Exception& )
     306             :         {
     307             :             DBG_UNHANDLED_EXCEPTION();
     308             :         }
     309             :     }
     310             : 
     311             :     // get service name of the control from the control model
     312           0 :     uno::Reference< beans::XPropertySet > xSet(xUnoControlModel, uno::UNO_QUERY);
     313           0 :     if (xSet.is())
     314             :     {
     315           0 :         uno::Any aValue( xSet->getPropertyValue("DefaultControl") );
     316           0 :         OUString aStr;
     317             : 
     318           0 :         if( aValue >>= aStr )
     319           0 :             aUnoControlTypeName = aStr;
     320             :     }
     321             : 
     322           0 :     uno::Reference< lang::XComponent > xComp(xUnoControlModel, uno::UNO_QUERY);
     323           0 :     if (xComp.is())
     324           0 :         m_pImpl->pEventListener->StartListening(xComp);
     325           0 :     return *this;
     326             : }
     327             : 
     328           0 : void SdrUnoObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
     329             : {
     330           0 :     SdrRectObj::NbcResize(rRef,xFact,yFact);
     331             : 
     332           0 :     if (aGeo.nShearWink!=0 || aGeo.nDrehWink!=0)
     333             :     {
     334             :         // small correctures
     335           0 :         if (aGeo.nDrehWink>=9000 && aGeo.nDrehWink<27000)
     336             :         {
     337           0 :             aRect.Move(aRect.Left()-aRect.Right(),aRect.Top()-aRect.Bottom());
     338             :         }
     339             : 
     340           0 :         aGeo.nDrehWink  = 0;
     341           0 :         aGeo.nShearWink = 0;
     342           0 :         aGeo.nSin       = 0.0;
     343           0 :         aGeo.nCos       = 1.0;
     344           0 :         aGeo.nTan       = 0.0;
     345           0 :         SetRectsDirty();
     346             :     }
     347           0 : }
     348             : 
     349             : 
     350             : 
     351           0 : bool SdrUnoObj::hasSpecialDrag() const
     352             : {
     353             :     // no special drag; we have no rounding rect and
     354             :     // do want frame handles
     355           0 :     return false;
     356             : }
     357             : 
     358           0 : bool SdrUnoObj::supportsFullDrag() const
     359             : {
     360             :     // overloaded to have the possibility to enable/disable in debug and
     361             :     // to ckeck some things out. Current solution is working, so default is
     362             :     // enabled
     363             :     static bool bDoSupportFullDrag(true);
     364             : 
     365           0 :     return bDoSupportFullDrag;
     366             : }
     367             : 
     368           0 : SdrObject* SdrUnoObj::getFullDragClone() const
     369             : {
     370           0 :     SdrObject* pRetval = 0;
     371             :     static bool bHandleSpecial(false);
     372             : 
     373           0 :     if(bHandleSpecial)
     374             :     {
     375             :         // special handling for SdrUnoObj (FormControl). Create a SdrGrafObj
     376             :         // for drag containing the graphical representation. This does not work too
     377             :         // well, so the default is to simply clone
     378           0 :         pRetval = new SdrGrafObj(SdrDragView::GetObjGraphic(GetModel(), this), GetLogicRect());
     379             :     }
     380             :     else
     381             :     {
     382             :         // call parent (simply clone)
     383           0 :         pRetval = SdrRectObj::getFullDragClone();
     384             :     }
     385             : 
     386           0 :     return pRetval;
     387             : }
     388             : 
     389             : 
     390           0 : void SdrUnoObj::NbcSetLayer( SdrLayerID _nLayer )
     391             : {
     392           0 :     if ( GetLayer() == _nLayer )
     393             :     {   // redundant call -> not interested in doing anything here
     394           0 :         SdrRectObj::NbcSetLayer( _nLayer );
     395           0 :         return;
     396             :     }
     397             : 
     398             :     // we need some special handling here in case we're moved from an invisible layer
     399             :     // to a visible one, or vice versa
     400             :     // (relative to a layer. Remember that the visibility of a layer is a view attribute
     401             :     // - the same layer can be visible in one view, and invisible in another view, at the
     402             :     // same time)
     403             : 
     404             :     // collect all views in which our old layer is visible
     405           0 :     ::std::set< SdrView* > aPreviouslyVisible;
     406             : 
     407             :     {
     408           0 :         SdrViewIter aIter( this );
     409           0 :         for ( SdrView* pView = aIter.FirstView(); pView; pView = aIter.NextView() )
     410           0 :             aPreviouslyVisible.insert( pView );
     411             :     }
     412             : 
     413           0 :     SdrRectObj::NbcSetLayer( _nLayer );
     414             : 
     415             :     // collect all views in which our new layer is visible
     416           0 :     ::std::set< SdrView* > aNewlyVisible;
     417             : 
     418             :     {
     419           0 :         SdrViewIter aIter( this );
     420           0 :         for ( SdrView* pView = aIter.FirstView(); pView; pView = aIter.NextView() )
     421             :         {
     422           0 :             ::std::set< SdrView* >::const_iterator aPrevPos = aPreviouslyVisible.find( pView );
     423           0 :             if ( aPreviouslyVisible.end() != aPrevPos )
     424             :             {   // in pView, we were visible _before_ the layer change, and are
     425             :                 // visible _after_ the layer change, too
     426             :                 // -> we're not interested in this view at all
     427           0 :                 aPreviouslyVisible.erase( aPrevPos );
     428             :             }
     429             :             else
     430             :             {
     431             :                 // in pView, we were visible _before_ the layer change, and are
     432             :                 // _not_ visible after the layer change
     433             :                 // => remember this view, as our visibility there changed
     434           0 :                 aNewlyVisible.insert( pView );
     435             :             }
     436             :         }
     437             :     }
     438             : 
     439             :     // now aPreviouslyVisible contains all views where we became invisible
     440           0 :     ::std::set< SdrView* >::const_iterator aLoopViews;
     441           0 :     for (   aLoopViews = aPreviouslyVisible.begin();
     442           0 :             aLoopViews != aPreviouslyVisible.end();
     443             :             ++aLoopViews
     444             :         )
     445             :     {
     446           0 :         lcl_ensureControlVisibility( *aLoopViews, this, false );
     447             :     }
     448             : 
     449             :     // and aNewlyVisible all views where we became visible
     450           0 :     for (   aLoopViews = aNewlyVisible.begin();
     451           0 :             aLoopViews != aNewlyVisible.end();
     452             :             ++aLoopViews
     453             :         )
     454             :     {
     455           0 :         lcl_ensureControlVisibility( *aLoopViews, this, true );
     456           0 :     }
     457             : }
     458             : 
     459           0 : void SdrUnoObj::CreateUnoControlModel(const OUString& rModelName)
     460             : {
     461             :     DBG_ASSERT(!xUnoControlModel.is(), "model already exists");
     462             : 
     463           0 :     aUnoControlModelTypeName = rModelName;
     464             : 
     465           0 :     uno::Reference< awt::XControlModel >   xModel;
     466           0 :     uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
     467           0 :     if (!aUnoControlModelTypeName.isEmpty() )
     468             :     {
     469           0 :         xModel = uno::Reference< awt::XControlModel >(xContext->getServiceManager()->createInstanceWithContext(
     470           0 :             aUnoControlModelTypeName, xContext), uno::UNO_QUERY);
     471             : 
     472           0 :         if (xModel.is())
     473           0 :             SetChanged();
     474             :     }
     475             : 
     476           0 :     SetUnoControlModel(xModel);
     477           0 : }
     478             : 
     479           0 : void SdrUnoObj::CreateUnoControlModel(const OUString& rModelName,
     480             :                                       const uno::Reference< lang::XMultiServiceFactory >& rxSFac)
     481             : {
     482             :     DBG_ASSERT(!xUnoControlModel.is(), "model already exists");
     483             : 
     484           0 :     aUnoControlModelTypeName = rModelName;
     485             : 
     486           0 :     uno::Reference< awt::XControlModel >   xModel;
     487           0 :     if (!aUnoControlModelTypeName.isEmpty() && rxSFac.is() )
     488             :     {
     489           0 :         xModel = uno::Reference< awt::XControlModel >(rxSFac->createInstance(
     490           0 :             aUnoControlModelTypeName), uno::UNO_QUERY);
     491             : 
     492           0 :         if (xModel.is())
     493           0 :             SetChanged();
     494             :     }
     495             : 
     496           0 :     SetUnoControlModel(xModel);
     497           0 : }
     498             : 
     499           0 : void SdrUnoObj::SetUnoControlModel( const uno::Reference< awt::XControlModel >& xModel)
     500             : {
     501           0 :     if (xUnoControlModel.is())
     502             :     {
     503           0 :         uno::Reference< lang::XComponent > xComp(xUnoControlModel, uno::UNO_QUERY);
     504           0 :         if (xComp.is())
     505           0 :             m_pImpl->pEventListener->StopListening(xComp);
     506             :     }
     507             : 
     508           0 :     xUnoControlModel = xModel;
     509             : 
     510             :     // control model has to contain service name of the control
     511           0 :     if (xUnoControlModel.is())
     512             :     {
     513           0 :         uno::Reference< beans::XPropertySet > xSet(xUnoControlModel, uno::UNO_QUERY);
     514           0 :         if (xSet.is())
     515             :         {
     516           0 :             uno::Any aValue( xSet->getPropertyValue("DefaultControl") );
     517           0 :             OUString aStr;
     518           0 :             if( aValue >>= aStr )
     519           0 :                 aUnoControlTypeName = aStr;
     520             :         }
     521             : 
     522           0 :         uno::Reference< lang::XComponent > xComp(xUnoControlModel, uno::UNO_QUERY);
     523           0 :         if (xComp.is())
     524           0 :             m_pImpl->pEventListener->StartListening(xComp);
     525             :     }
     526             : 
     527             :     // invalidate all ViewObject contacts
     528           0 :     ViewContactOfUnoControl* pVC = NULL;
     529           0 :     if ( impl_getViewContact( pVC ) )
     530             :     {
     531             :         // flushViewObjectContacts() removes all existing VOCs for the local DrawHierarchy. This
     532             :         // is always allowed since they will be re-created on demand (and with the changed model)
     533           0 :         GetViewContact().flushViewObjectContacts(true);
     534             :     }
     535           0 : }
     536             : 
     537             : 
     538           0 : uno::Reference< awt::XControl > SdrUnoObj::GetUnoControl(const SdrView& _rView, const OutputDevice& _rOut) const
     539             : {
     540           0 :     uno::Reference< awt::XControl > xControl;
     541             : 
     542           0 :     SdrPageView* pPageView = _rView.GetSdrPageView();
     543             :     OSL_ENSURE( pPageView && GetPage() == pPageView->GetPage(), "SdrUnoObj::GetUnoControl: This object is not displayed in that particular view!" );
     544           0 :     if ( !pPageView || GetPage() != pPageView->GetPage() )
     545           0 :         return NULL;
     546             : 
     547           0 :     SdrPageWindow* pPageWindow = pPageView->FindPageWindow( _rOut );
     548             :     OSL_ENSURE( pPageWindow, "SdrUnoObj::GetUnoControl: did not find my SdrPageWindow!" );
     549           0 :     if ( !pPageWindow )
     550           0 :         return NULL;
     551             : 
     552           0 :     ViewObjectContact& rViewObjectContact( GetViewContact().GetViewObjectContact( pPageWindow->GetObjectContact() ) );
     553           0 :     ViewObjectContactOfUnoControl* pUnoContact = dynamic_cast< ViewObjectContactOfUnoControl* >( &rViewObjectContact );
     554             :     OSL_ENSURE( pUnoContact, "SdrUnoObj::GetUnoControl: wrong contact type!" );
     555           0 :     if ( pUnoContact )
     556           0 :         xControl = pUnoContact->getControl();
     557             : 
     558           0 :     return xControl;
     559             : }
     560             : 
     561             : 
     562           0 : uno::Reference< awt::XControl > SdrUnoObj::GetTemporaryControlForWindow(
     563             :     const Window& _rWindow, uno::Reference< awt::XControlContainer >& _inout_ControlContainer ) const
     564             : {
     565           0 :     uno::Reference< awt::XControl > xControl;
     566             : 
     567           0 :     ViewContactOfUnoControl* pVC = NULL;
     568           0 :     if ( impl_getViewContact( pVC ) )
     569           0 :         xControl = pVC->getTemporaryControlForWindow( _rWindow, _inout_ControlContainer );
     570             : 
     571           0 :     return xControl;
     572             : }
     573             : 
     574             : 
     575           0 : bool SdrUnoObj::impl_getViewContact( ViewContactOfUnoControl*& _out_rpContact ) const
     576             : {
     577           0 :     ViewContact& rViewContact( GetViewContact() );
     578           0 :     _out_rpContact = dynamic_cast< ViewContactOfUnoControl* >( &rViewContact );
     579             :     DBG_ASSERT( _out_rpContact, "SdrUnoObj::impl_getViewContact: could not find my ViewContact!" );
     580           0 :     return ( _out_rpContact != NULL );
     581             : }
     582             : 
     583             : 
     584           0 : ::sdr::contact::ViewContact* SdrUnoObj::CreateObjectSpecificViewContact()
     585             : {
     586           0 :   return new ::sdr::contact::ViewContactOfUnoControl( *this );
     587             : }
     588             : 
     589             : 
     590             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10