LCOV - code coverage report
Current view: top level - sw/source/core/frmedt - feflyole.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 25 52 48.1 %
Date: 2015-06-13 12:38:46 Functions: 4 7 57.1 %
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 <com/sun/star/embed/EmbedStates.hpp>
      21             : 
      22             : #include <sfx2/ipclient.hxx>
      23             : #include <sfx2/viewsh.hxx>
      24             : #include <sfx2/app.hxx>
      25             : #include <unotools/moduleoptions.hxx>
      26             : #include <sfx2/viewfrm.hxx>
      27             : 
      28             : #include <sot/exchange.hxx>
      29             : #include <fmtcntnt.hxx>
      30             : #include <fmtanchr.hxx>
      31             : #include <fesh.hxx>
      32             : #include <cntfrm.hxx>
      33             : #include <frmfmt.hxx>
      34             : #include <flyfrm.hxx>
      35             : #include <pam.hxx>
      36             : #include <doc.hxx>
      37             : #include <ndtxt.hxx>
      38             : #include <notxtfrm.hxx>
      39             : #include <ndole.hxx>
      40             : #include <swcli.hxx>
      41             : 
      42             : using namespace com::sun::star;
      43             : 
      44          23 : SwFlyFrm *SwFEShell::FindFlyFrm( const uno::Reference < embed::XEmbeddedObject >& xObj ) const
      45             : {
      46          23 :     SwFlyFrm *pFly = FindFlyFrm();
      47          23 :     if ( pFly && pFly->Lower() && pFly->Lower()->IsNoTextFrm() )
      48             :     {
      49           0 :         SwOLENode *pNd = static_cast<SwNoTextFrm*>(pFly->Lower())->GetNode()->GetOLENode();
      50           0 :         if ( !pNd || pNd->GetOLEObj().GetOleRef() != xObj )
      51           0 :             pFly = 0;
      52             :     }
      53             :     else
      54          23 :         pFly = 0;
      55             : 
      56          23 :     if ( !pFly )
      57             :     {
      58             :         // No or wrong fly selected: we have to search.
      59          23 :         bool bExist = false;
      60             :         SwStartNode *pStNd;
      61          23 :         sal_uLong nSttIdx = GetNodes().GetEndOfAutotext().StartOfSectionIndex() + 1,
      62          23 :               nEndIdx = GetNodes().GetEndOfAutotext().GetIndex();
      63         115 :         while( nSttIdx < nEndIdx &&
      64          46 :                 0 != (pStNd = GetNodes()[ nSttIdx ]->GetStartNode()) )
      65             :         {
      66          46 :             SwNode *pNd = GetNodes()[ nSttIdx+1 ];
      67         164 :             if ( pNd->IsOLENode() &&
      68         124 :                  static_cast<SwOLENode*>(pNd)->GetOLEObj().GetOleRef() == xObj )
      69             :             {
      70          23 :                 bExist = true;
      71          23 :                 SwFrm *pFrm = static_cast<SwOLENode*>(pNd)->getLayoutFrm( GetLayout() );
      72          23 :                 if ( pFrm )
      73          23 :                     pFly = pFrm->FindFlyFrm();
      74          23 :                 break;
      75             :             }
      76          23 :             nSttIdx = pStNd->EndOfSectionIndex() + 1;
      77             :         }
      78             : 
      79             :         OSL_ENSURE( bExist, "OLE-Object unknown and FlyFrm not found." );
      80             :         (void)bExist;
      81             :     }
      82          23 :     return pFly;
      83             : }
      84             : 
      85           0 : OUString SwFEShell::GetUniqueOLEName() const
      86             : {
      87           0 :     return GetDoc()->GetUniqueOLEName();
      88             : }
      89             : 
      90           0 : OUString SwFEShell::GetUniqueFrameName() const
      91             : {
      92           0 :     return GetDoc()->GetUniqueFrameName();
      93             : }
      94             : 
      95           0 : void SwFEShell::MakeObjVisible( const uno::Reference < embed::XEmbeddedObject >& xObj ) const
      96             : {
      97           0 :     SwFlyFrm *pFly = FindFlyFrm( xObj );
      98           0 :     if ( pFly )
      99             :     {
     100           0 :         SwRect aTmp( pFly->Prt() );
     101           0 :         aTmp += pFly->Frm().Pos();
     102           0 :         if ( !aTmp.IsOver( VisArea() ) )
     103             :         {
     104           0 :             const_cast<SwFEShell*>(this)->StartAction();
     105           0 :             const_cast<SwFEShell*>(this)->MakeVisible( aTmp );
     106           0 :             const_cast<SwFEShell*>(this)->EndAction();
     107             :         }
     108             :     }
     109           0 : }
     110             : 
     111           8 : bool SwFEShell::FinishOLEObj()                      // Server is terminated
     112             : {
     113           8 :     SfxInPlaceClient* pIPClient = GetSfxViewShell()->GetIPClient();
     114           8 :     if ( !pIPClient )
     115           8 :         return false;
     116             : 
     117           0 :     bool bRet = pIPClient->IsObjectInPlaceActive();
     118           0 :     if( bRet )
     119             :     {
     120           0 :         uno::Reference < embed::XEmbeddedObject > xObj = pIPClient->GetObject();
     121           0 :         if( CNT_OLE == GetCntType() )
     122           0 :             ClearAutomaticContour();
     123             : 
     124           0 :         if( static_cast<SwOleClient*>(pIPClient)->IsCheckForOLEInCaption() !=
     125           0 :             IsCheckForOLEInCaption() )
     126           0 :             SetCheckForOLEInCaption( !IsCheckForOLEInCaption() );
     127             : 
     128             :         // leave UIActive state
     129           0 :         pIPClient->DeactivateObject();
     130             :     }
     131           0 :     return bRet;
     132         177 : }
     133             : 
     134             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11