LCOV - code coverage report
Current view: top level - libreoffice/sw/source/core/frmedt - feflyole.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 51 0.0 %
Date: 2012-12-17 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             : 
      86           0 : String SwFEShell::GetUniqueOLEName() const
      87             : {
      88           0 :     return GetDoc()->GetUniqueOLEName();
      89             : }
      90             : 
      91             : 
      92           0 : String SwFEShell::GetUniqueFrameName() const
      93             : {
      94           0 :     return GetDoc()->GetUniqueFrameName();
      95             : }
      96             : 
      97             : 
      98           0 : void SwFEShell::MakeObjVisible( const uno::Reference < embed::XEmbeddedObject >& xObj ) const
      99             : {
     100           0 :     SwFlyFrm *pFly = FindFlyFrm( xObj );
     101           0 :     if ( pFly )
     102             :     {
     103           0 :         SwRect aTmp( pFly->Prt() );
     104           0 :         aTmp += pFly->Frm().Pos();
     105           0 :         if ( !aTmp.IsOver( VisArea() ) )
     106             :         {
     107           0 :             ((SwFEShell*)this)->StartAction();
     108           0 :             ((SwFEShell*)this)->MakeVisible( aTmp );
     109           0 :             ((SwFEShell*)this)->EndAction();
     110             :         }
     111             :     }
     112           0 : }
     113             : 
     114           0 : sal_Bool SwFEShell::FinishOLEObj()                      // Server is terminated
     115             : {
     116           0 :     SfxInPlaceClient* pIPClient = GetSfxViewShell()->GetIPClient();
     117           0 :     if ( !pIPClient )
     118           0 :         return sal_False;
     119             : 
     120           0 :     sal_Bool bRet = pIPClient->IsObjectInPlaceActive();
     121           0 :     if( bRet )
     122             :     {
     123           0 :         uno::Reference < embed::XEmbeddedObject > xObj = pIPClient->GetObject();
     124           0 :         if( CNT_OLE == GetCntType() )
     125           0 :             ClearAutomaticContour();
     126             : 
     127           0 :         if( ((SwOleClient*)pIPClient)->IsCheckForOLEInCaption() !=
     128           0 :             IsCheckForOLEInCaption() )
     129           0 :             SetCheckForOLEInCaption( !IsCheckForOLEInCaption() );
     130             : 
     131             :         // leave UIActive state
     132           0 :         pIPClient->DeactivateObject();
     133             :     }
     134           0 :     return bRet;
     135             : }
     136             : 
     137             : 
     138             : 
     139             : 
     140             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10