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

Generated by: LCOV version 1.11