LCOV - code coverage report
Current view: top level - sw/source/core/frmedt - feflyole.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 51 0.0 %
Date: 2014-04-14 Functions: 0 5 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 <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           0 : SwFlyFrm *SwFEShell::FindFlyFrm( const uno::Reference < embed::XEmbeddedObject >& xObj ) const
      45             : {
      46           0 :     SwFlyFrm *pFly = FindFlyFrm();
      47           0 :     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           0 :         pFly = 0;
      55             : 
      56           0 :     if ( !pFly )
      57             :     {
      58             :         // No or wrong fly selected: we have to search.
      59           0 :         bool bExist = false;
      60             :         SwStartNode *pStNd;
      61           0 :         sal_uLong nSttIdx = GetNodes().GetEndOfAutotext().StartOfSectionIndex() + 1,
      62           0 :               nEndIdx = GetNodes().GetEndOfAutotext().GetIndex();
      63           0 :         while( nSttIdx < nEndIdx &&
      64           0 :                 0 != (pStNd = GetNodes()[ nSttIdx ]->GetStartNode()) )
      65             :         {
      66           0 :             SwNode *pNd = GetNodes()[ nSttIdx+1 ];
      67           0 :             if ( pNd->IsOLENode() &&
      68           0 :                  ((SwOLENode*)pNd)->GetOLEObj().GetOleRef() == xObj )
      69             :             {
      70           0 :                 bExist = true;
      71           0 :                 SwFrm *pFrm = ((SwOLENode*)pNd)->getLayoutFrm( GetLayout() );
      72           0 :                 if ( pFrm )
      73           0 :                     pFly = pFrm->FindFlyFrm();
      74           0 :                 break;
      75             :             }
      76           0 :             nSttIdx = pStNd->EndOfSectionIndex() + 1;
      77             :         }
      78             : 
      79             :         OSL_ENSURE( bExist, "OLE-Object unknown and FlyFrm not found." );
      80             :         (void)bExist;
      81             :     }
      82           0 :     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           0 : sal_Bool SwFEShell::FinishOLEObj()                      // Server is terminated
     112             : {
     113           0 :     SfxInPlaceClient* pIPClient = GetSfxViewShell()->GetIPClient();
     114           0 :     if ( !pIPClient )
     115           0 :         return sal_False;
     116             : 
     117           0 :     sal_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             : }
     133             : 
     134             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10