LCOV - code coverage report
Current view: top level - sw/source/core/frmedt - feflyole.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 25 52 48.1 %
Date: 2014-11-03 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          62 : SwFlyFrm *SwFEShell::FindFlyFrm( const uno::Reference < embed::XEmbeddedObject >& xObj ) const
      45             : {
      46          62 :     SwFlyFrm *pFly = FindFlyFrm();
      47          62 :     if ( pFly && pFly->Lower() && pFly->Lower()->IsNoTxtFrm() )
      48             :     {
      49           0 :         SwOLENode *pNd = ((SwNoTxtFrm*)pFly->Lower())->GetNode()->GetOLENode();
      50           0 :         if ( !pNd || pNd->GetOLEObj().GetOleRef() != xObj )
      51           0 :             pFly = 0;
      52             :     }
      53             :     else
      54          62 :         pFly = 0;
      55             : 
      56          62 :     if ( !pFly )
      57             :     {
      58             :         // No or wrong fly selected: we have to search.
      59          62 :         bool bExist = false;
      60             :         SwStartNode *pStNd;
      61          62 :         sal_uLong nSttIdx = GetNodes().GetEndOfAutotext().StartOfSectionIndex() + 1,
      62          62 :               nEndIdx = GetNodes().GetEndOfAutotext().GetIndex();
      63         278 :         while( nSttIdx < nEndIdx &&
      64         108 :                 0 != (pStNd = GetNodes()[ nSttIdx ]->GetStartNode()) )
      65             :         {
      66         108 :             SwNode *pNd = GetNodes()[ nSttIdx+1 ];
      67         392 :             if ( pNd->IsOLENode() &&
      68         312 :                  ((SwOLENode*)pNd)->GetOLEObj().GetOleRef() == xObj )
      69             :             {
      70          62 :                 bExist = true;
      71          62 :                 SwFrm *pFrm = ((SwOLENode*)pNd)->getLayoutFrm( GetLayout() );
      72          62 :                 if ( pFrm )
      73          62 :                     pFly = pFrm->FindFlyFrm();
      74          62 :                 break;
      75             :             }
      76          46 :             nSttIdx = pStNd->EndOfSectionIndex() + 1;
      77             :         }
      78             : 
      79             :         OSL_ENSURE( bExist, "OLE-Object unknown and FlyFrm not found." );
      80             :         (void)bExist;
      81             :     }
      82          62 :     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 :             ((SwFEShell*)this)->StartAction();
     105           0 :             ((SwFEShell*)this)->MakeVisible( aTmp );
     106           0 :             ((SwFEShell*)this)->EndAction();
     107             :         }
     108             :     }
     109           0 : }
     110             : 
     111          12 : bool SwFEShell::FinishOLEObj()                      // Server is terminated
     112             : {
     113          12 :     SfxInPlaceClient* pIPClient = GetSfxViewShell()->GetIPClient();
     114          12 :     if ( !pIPClient )
     115          12 :         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( ((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         270 : }
     133             : 
     134             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10