LCOV - code coverage report
Current view: top level - svx/source/svdraw - svdouno.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 129 241 53.5 %
Date: 2014-11-03 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        1336 : class SdrControlEventListenerImpl : public ::cppu::WeakImplHelper1< ::com::sun::star::lang::XEventListener >
      69             : {
      70             : protected:
      71             :     SdrUnoObj*                  pObj;
      72             : 
      73             : public:
      74         674 :     SdrControlEventListenerImpl(SdrUnoObj* _pObj)
      75         674 :     :   pObj(_pObj)
      76         674 :     {}
      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         664 : void SAL_CALL SdrControlEventListenerImpl::disposing( const ::com::sun::star::lang::EventObject& /*Source*/)
      87             :     throw(::com::sun::star::uno::RuntimeException, std::exception)
      88             : {
      89         664 :     if (pObj)
      90             :     {
      91         664 :         pObj->xUnoControlModel = NULL;
      92             :     }
      93         664 : }
      94             : 
      95           4 : void SdrControlEventListenerImpl::StopListening(const uno::Reference< lang::XComponent >& xComp)
      96             : {
      97           4 :     if (xComp.is())
      98           4 :         xComp->removeEventListener(this);
      99           4 : }
     100             : 
     101         672 : void SdrControlEventListenerImpl::StartListening(const uno::Reference< lang::XComponent >& xComp)
     102             : {
     103         672 :     if (xComp.is())
     104         672 :         xComp->addEventListener(this);
     105         672 : }
     106             : 
     107             : 
     108        1342 : struct SdrUnoObjDataHolder
     109             : {
     110             :     mutable ::rtl::Reference< SdrControlEventListenerImpl >
     111             :                                     pEventListener;
     112             : };
     113             : 
     114             : 
     115             : namespace
     116             : {
     117         992 :     void lcl_ensureControlVisibility( SdrView* _pView, const SdrUnoObj* _pObject, bool _bVisible )
     118             :     {
     119             :         OSL_PRECOND( _pObject, "lcl_ensureControlVisibility: no object -> no survival!" );
     120             : 
     121         992 :         SdrPageView* pPageView = _pView ? _pView->GetSdrPageView() : NULL;
     122             :         DBG_ASSERT( pPageView, "lcl_ensureControlVisibility: no view found!" );
     123         992 :         if ( !pPageView )
     124         992 :             return;
     125             : 
     126         992 :         ViewContact& rUnoControlContact( _pObject->GetViewContact() );
     127             : 
     128        1984 :         for ( sal_uInt32 i = 0; i < pPageView->PageWindowCount(); ++i )
     129             :         {
     130         992 :             const SdrPageWindow* pPageWindow = pPageView->GetPageWindow( i );
     131             :             DBG_ASSERT( pPageWindow, "lcl_ensureControlVisibility: invalid PageViewWindow!" );
     132         992 :             if ( !pPageWindow )
     133           0 :                 continue;
     134             : 
     135         992 :             if ( !pPageWindow->HasObjectContact() )
     136         508 :                 continue;
     137             : 
     138         484 :             ObjectContact& rPageViewContact( pPageWindow->GetObjectContact() );
     139         484 :             const ViewObjectContact& rViewObjectContact( rUnoControlContact.GetViewObjectContact( rPageViewContact ) );
     140         484 :             const ViewObjectContactOfUnoControl* pUnoControlContact = dynamic_cast< const ViewObjectContactOfUnoControl* >( &rViewObjectContact );
     141             :             DBG_ASSERT( pUnoControlContact, "lcl_ensureControlVisibility: wrong ViewObjectContact type!" );
     142         484 :             if ( !pUnoControlContact )
     143           0 :                 continue;
     144             : 
     145         484 :             pUnoControlContact->ensureControlVisibility( _bVisible );
     146             :         }
     147             :     }
     148             : }
     149             : 
     150      122714 : TYPEINIT1(SdrUnoObj, SdrRectObj);
     151             : 
     152         674 : SdrUnoObj::SdrUnoObj(const OUString& rModelName, bool _bOwnUnoControlModel)
     153         674 : :   m_pImpl( new SdrUnoObjDataHolder ),
     154        1348 :     bOwnUnoControlModel( _bOwnUnoControlModel )
     155             : {
     156         674 :     bIsUnoObj = true;
     157             : 
     158         674 :     m_pImpl->pEventListener = new SdrControlEventListenerImpl(this);
     159             : 
     160             :     // only an owner may create independently
     161         674 :     if (!rModelName.isEmpty())
     162           0 :         CreateUnoControlModel(rModelName);
     163         674 : }
     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        1336 : SdrUnoObj::~SdrUnoObj()
     181             : {
     182             :     try
     183             :     {
     184             :         // clean up the control model
     185         668 :         uno::Reference< lang::XComponent > xComp(xUnoControlModel, uno::UNO_QUERY);
     186         668 :         if (xComp.is())
     187             :         {
     188             :             // is the control model owned by its environment?
     189         516 :             uno::Reference< container::XChild > xContent(xUnoControlModel, uno::UNO_QUERY);
     190         516 :             if (xContent.is() && !xContent->getParent().is())
     191         512 :                 xComp->dispose();
     192             :             else
     193           4 :                 m_pImpl->pEventListener->StopListening(xComp);
     194         668 :         }
     195             :     }
     196           0 :     catch( const uno::Exception& )
     197             :     {
     198             :         OSL_FAIL( "SdrUnoObj::~SdrUnoObj: caught an exception!" );
     199             :     }
     200         668 :     delete m_pImpl;
     201         668 : }
     202             : 
     203         672 : void SdrUnoObj::SetModel(SdrModel* pNewModel)
     204             : {
     205         672 :     SdrRectObj::SetModel(pNewModel);
     206         672 : }
     207             : 
     208        1234 : void SdrUnoObj::SetPage(SdrPage* pNewPage)
     209             : {
     210        1234 :     SdrRectObj::SetPage(pNewPage);
     211        1234 : }
     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        1010 : void SdrUnoObj::SetContextWritingMode( const sal_Int16 _nContextWritingMode )
     238             : {
     239             :     try
     240             :     {
     241        1014 :         uno::Reference< beans::XPropertySet > xModelProperties( GetUnoControlModel(), uno::UNO_QUERY_THROW );
     242        1006 :         xModelProperties->setPropertyValue(
     243             :             OUString(  "ContextWritingMode"  ),
     244             :             uno::makeAny( _nContextWritingMode )
     245        1006 :         );
     246             :     }
     247           4 :     catch( const uno::Exception& )
     248             :     {
     249             :         DBG_UNHANDLED_EXCEPTION();
     250             :     }
     251        1010 : }
     252             : 
     253         524 : OUString SdrUnoObj::TakeObjNameSingul() const
     254             : {
     255         524 :     OUStringBuffer sName(ImpGetResStr(STR_ObjNameSingulUno));
     256             : 
     257        1048 :     OUString aName(GetName());
     258         524 :     if (!aName.isEmpty())
     259             :     {
     260           0 :         sName.append(' ');
     261           0 :         sName.append('\'');
     262           0 :         sName.append(aName);
     263           0 :         sName.append('\'');
     264             :     }
     265             : 
     266        1048 :     return sName.makeStringAndClear();
     267             : }
     268             : 
     269           2 : OUString SdrUnoObj::TakeObjNamePlural() const
     270             : {
     271           2 :     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 :             aRect.Move(aRect.Left()-aRect.Right(),aRect.Top()-aRect.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           6 : bool SdrUnoObj::hasSpecialDrag() const
     347             : {
     348             :     // no special drag; we have no rounding rect and
     349             :     // do want frame handles
     350           6 :     return false;
     351             : }
     352             : 
     353           0 : bool SdrUnoObj::supportsFullDrag() const
     354             : {
     355             :     // overloaded to have the possibility to enable/disable in debug and
     356             :     // to ckeck 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        2358 : void SdrUnoObj::NbcSetLayer( SdrLayerID _nLayer )
     386             : {
     387        2358 :     if ( GetLayer() == _nLayer )
     388             :     {   // redundant call -> not interested in doing anything here
     389         544 :         SdrRectObj::NbcSetLayer( _nLayer );
     390        2902 :         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        1814 :     ::std::set< SdrView* > aPreviouslyVisible;
     401             : 
     402             :     {
     403        1814 :         SdrViewIter aIter( this );
     404        2262 :         for ( SdrView* pView = aIter.FirstView(); pView; pView = aIter.NextView() )
     405         448 :             aPreviouslyVisible.insert( pView );
     406             :     }
     407             : 
     408        1814 :     SdrRectObj::NbcSetLayer( _nLayer );
     409             : 
     410             :     // collect all views in which our new layer is visible
     411        3628 :     ::std::set< SdrView* > aNewlyVisible;
     412             : 
     413             :     {
     414        1814 :         SdrViewIter aIter( this );
     415        2358 :         for ( SdrView* pView = aIter.FirstView(); pView; pView = aIter.NextView() )
     416             :         {
     417         544 :             ::std::set< SdrView* >::const_iterator aPrevPos = aPreviouslyVisible.find( pView );
     418         544 :             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         544 :                 aNewlyVisible.insert( pView );
     430             :             }
     431             :         }
     432             :     }
     433             : 
     434             :     // now aPreviouslyVisible contains all views where we became invisible
     435        1814 :     ::std::set< SdrView* >::const_iterator aLoopViews;
     436        6786 :     for (   aLoopViews = aPreviouslyVisible.begin();
     437        4524 :             aLoopViews != aPreviouslyVisible.end();
     438             :             ++aLoopViews
     439             :         )
     440             :     {
     441         448 :         lcl_ensureControlVisibility( *aLoopViews, this, false );
     442             :     }
     443             : 
     444             :     // and aNewlyVisible all views where we became visible
     445        7074 :     for (   aLoopViews = aNewlyVisible.begin();
     446        4716 :             aLoopViews != aNewlyVisible.end();
     447             :             ++aLoopViews
     448             :         )
     449             :     {
     450         544 :         lcl_ensureControlVisibility( *aLoopViews, this, true );
     451        1814 :     }
     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         672 : void SdrUnoObj::SetUnoControlModel( const uno::Reference< awt::XControlModel >& xModel)
     495             : {
     496         672 :     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         672 :     xUnoControlModel = xModel;
     504             : 
     505             :     // control model has to contain service name of the control
     506         672 :     if (xUnoControlModel.is())
     507             :     {
     508         672 :         uno::Reference< beans::XPropertySet > xSet(xUnoControlModel, uno::UNO_QUERY);
     509         672 :         if (xSet.is())
     510             :         {
     511         672 :             uno::Any aValue( xSet->getPropertyValue("DefaultControl") );
     512        1344 :             OUString aStr;
     513         672 :             if( aValue >>= aStr )
     514        1344 :                 aUnoControlTypeName = aStr;
     515             :         }
     516             : 
     517        1344 :         uno::Reference< lang::XComponent > xComp(xUnoControlModel, uno::UNO_QUERY);
     518         672 :         if (xComp.is())
     519        1344 :             m_pImpl->pEventListener->StartListening(xComp);
     520             :     }
     521             : 
     522             :     // invalidate all ViewObject contacts
     523         672 :     ViewContactOfUnoControl* pVC = NULL;
     524         672 :     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         672 :         GetViewContact().flushViewObjectContacts(true);
     529             :     }
     530         672 : }
     531             : 
     532             : 
     533         192 : uno::Reference< awt::XControl > SdrUnoObj::GetUnoControl(const SdrView& _rView, const OutputDevice& _rOut) const
     534             : {
     535         192 :     uno::Reference< awt::XControl > xControl;
     536             : 
     537         192 :     SdrPageView* pPageView = _rView.GetSdrPageView();
     538             :     OSL_ENSURE( pPageView && GetPage() == pPageView->GetPage(), "SdrUnoObj::GetUnoControl: This object is not displayed in that particular view!" );
     539         192 :     if ( !pPageView || GetPage() != pPageView->GetPage() )
     540           0 :         return NULL;
     541             : 
     542         192 :     SdrPageWindow* pPageWindow = pPageView->FindPageWindow( _rOut );
     543             :     OSL_ENSURE( pPageWindow, "SdrUnoObj::GetUnoControl: did not find my SdrPageWindow!" );
     544         192 :     if ( !pPageWindow )
     545           0 :         return NULL;
     546             : 
     547         192 :     ViewObjectContact& rViewObjectContact( GetViewContact().GetViewObjectContact( pPageWindow->GetObjectContact() ) );
     548         192 :     ViewObjectContactOfUnoControl* pUnoContact = dynamic_cast< ViewObjectContactOfUnoControl* >( &rViewObjectContact );
     549             :     OSL_ENSURE( pUnoContact, "SdrUnoObj::GetUnoControl: wrong contact type!" );
     550         192 :     if ( pUnoContact )
     551         192 :         xControl = pUnoContact->getControl();
     552             : 
     553         192 :     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         672 : bool SdrUnoObj::impl_getViewContact( ViewContactOfUnoControl*& _out_rpContact ) const
     571             : {
     572         672 :     ViewContact& rViewContact( GetViewContact() );
     573         672 :     _out_rpContact = dynamic_cast< ViewContactOfUnoControl* >( &rViewContact );
     574             :     DBG_ASSERT( _out_rpContact, "SdrUnoObj::impl_getViewContact: could not find my ViewContact!" );
     575         672 :     return ( _out_rpContact != NULL );
     576             : }
     577             : 
     578             : 
     579         672 : ::sdr::contact::ViewContact* SdrUnoObj::CreateObjectSpecificViewContact()
     580             : {
     581         672 :   return new ::sdr::contact::ViewContactOfUnoControl( *this );
     582         651 : }
     583             : 
     584             : 
     585             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10