LCOV - code coverage report
Current view: top level - sw/source/core/frmedt - feflyole.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 24 51 47.1 %
Date: 2012-08-25 Functions: 2 5 40.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 16 78 20.5 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <com/sun/star/embed/EmbedStates.hpp>
      30                 :            : 
      31                 :            : #include <sfx2/ipclient.hxx>
      32                 :            : #include <sfx2/viewsh.hxx>
      33                 :            : #include <sfx2/app.hxx>
      34                 :            : #include <unotools/moduleoptions.hxx>
      35                 :            : #include <sfx2/viewfrm.hxx>
      36                 :            : 
      37                 :            : #include <sot/exchange.hxx>
      38                 :            : #include <fmtcntnt.hxx>
      39                 :            : #include <fmtanchr.hxx>
      40                 :            : #include <fesh.hxx>
      41                 :            : #include <cntfrm.hxx>
      42                 :            : #include <frmfmt.hxx>
      43                 :            : #include <flyfrm.hxx>
      44                 :            : #include <pam.hxx>
      45                 :            : #include <doc.hxx>
      46                 :            : #include <ndtxt.hxx>
      47                 :            : #include <notxtfrm.hxx>
      48                 :            : #include <ndole.hxx>
      49                 :            : #include <swcli.hxx>
      50                 :            : 
      51                 :            : using namespace com::sun::star;
      52                 :            : 
      53                 :          6 : SwFlyFrm *SwFEShell::FindFlyFrm( const uno::Reference < embed::XEmbeddedObject >& xObj ) const
      54                 :            : {
      55                 :          6 :     SwFlyFrm *pFly = FindFlyFrm();
      56 [ #  # ][ #  # ]:          6 :     if ( pFly && pFly->Lower() && pFly->Lower()->IsNoTxtFrm() )
         [ -  + ][ -  + ]
      57                 :            :     {
      58                 :          0 :         SwOLENode *pNd = ((SwNoTxtFrm*)pFly->Lower())->GetNode()->GetOLENode();
      59 [ #  # ][ #  # ]:          0 :         if ( !pNd || pNd->GetOLEObj().GetOleRef() != xObj )
         [ #  # ][ #  # ]
           [ #  #  #  # ]
                 [ #  # ]
      60                 :          0 :             pFly = 0;
      61                 :            :     }
      62                 :            :     else
      63                 :          6 :         pFly = 0;
      64                 :            : 
      65         [ +  - ]:          6 :     if ( !pFly )
      66                 :            :     {
      67                 :            :         // No or wrong fly selected: we have to search.
      68                 :          6 :         sal_Bool bExist = sal_False;
      69                 :            :         SwStartNode *pStNd;
      70                 :          6 :         sal_uLong nSttIdx = GetNodes().GetEndOfAutotext().StartOfSectionIndex() + 1,
      71                 :          6 :               nEndIdx = GetNodes().GetEndOfAutotext().GetIndex();
      72   [ +  -  +  - ]:         18 :         while( nSttIdx < nEndIdx &&
                 [ +  - ]
      73                 :          6 :                 0 != (pStNd = GetNodes()[ nSttIdx ]->GetStartNode()) )
      74                 :            :         {
      75                 :          6 :             SwNode *pNd = GetNodes()[ nSttIdx+1 ];
      76 [ +  - ][ +  - ]:         18 :             if ( pNd->IsOLENode() &&
                 [ +  - ]
      77 [ +  - ][ +  - ]:         12 :                  ((SwOLENode*)pNd)->GetOLEObj().GetOleRef() == xObj )
         [ +  - ][ +  - ]
                 [ #  # ]
      78                 :            :             {
      79                 :          6 :                 bExist = sal_True;
      80         [ +  - ]:          6 :                 SwFrm *pFrm = ((SwOLENode*)pNd)->getLayoutFrm( GetLayout() );
      81         [ +  - ]:          6 :                 if ( pFrm )
      82                 :          6 :                     pFly = pFrm->FindFlyFrm();
      83                 :          6 :                 break;
      84                 :            :             }
      85                 :          0 :             nSttIdx = pStNd->EndOfSectionIndex() + 1;
      86                 :            :         }
      87                 :            : 
      88                 :            :         OSL_ENSURE( bExist, "OLE-Object unknown and FlyFrm not found." );
      89                 :            :         (void)bExist;
      90                 :            :     }
      91                 :          6 :     return pFly;
      92                 :            : }
      93                 :            : 
      94                 :            : 
      95                 :          0 : String SwFEShell::GetUniqueOLEName() const
      96                 :            : {
      97                 :          0 :     return GetDoc()->GetUniqueOLEName();
      98                 :            : }
      99                 :            : 
     100                 :            : 
     101                 :          0 : String SwFEShell::GetUniqueFrameName() const
     102                 :            : {
     103                 :          0 :     return GetDoc()->GetUniqueFrameName();
     104                 :            : }
     105                 :            : 
     106                 :            : 
     107                 :          0 : void SwFEShell::MakeObjVisible( const uno::Reference < embed::XEmbeddedObject >& xObj ) const
     108                 :            : {
     109                 :          0 :     SwFlyFrm *pFly = FindFlyFrm( xObj );
     110         [ #  # ]:          0 :     if ( pFly )
     111                 :            :     {
     112                 :          0 :         SwRect aTmp( pFly->Prt() );
     113                 :          0 :         aTmp += pFly->Frm().Pos();
     114 [ #  # ][ #  # ]:          0 :         if ( !aTmp.IsOver( VisArea() ) )
     115                 :            :         {
     116         [ #  # ]:          0 :             ((SwFEShell*)this)->StartAction();
     117         [ #  # ]:          0 :             ((SwFEShell*)this)->MakeVisible( aTmp );
     118         [ #  # ]:          0 :             ((SwFEShell*)this)->EndAction();
     119                 :            :         }
     120                 :            :     }
     121                 :          0 : }
     122                 :            : 
     123                 :         12 : sal_Bool SwFEShell::FinishOLEObj()                      // Server is terminated
     124                 :            : {
     125                 :         12 :     SfxInPlaceClient* pIPClient = GetSfxViewShell()->GetIPClient();
     126         [ +  - ]:         12 :     if ( !pIPClient )
     127                 :         12 :         return sal_False;
     128                 :            : 
     129                 :          0 :     sal_Bool bRet = pIPClient->IsObjectInPlaceActive();
     130         [ #  # ]:          0 :     if( bRet )
     131                 :            :     {
     132         [ #  # ]:          0 :         uno::Reference < embed::XEmbeddedObject > xObj = pIPClient->GetObject();
     133 [ #  # ][ #  # ]:          0 :         if( CNT_OLE == GetCntType() )
     134         [ #  # ]:          0 :             ClearAutomaticContour();
     135                 :            : 
     136         [ #  # ]:          0 :         if( ((SwOleClient*)pIPClient)->IsCheckForOLEInCaption() !=
     137                 :          0 :             IsCheckForOLEInCaption() )
     138                 :          0 :             SetCheckForOLEInCaption( !IsCheckForOLEInCaption() );
     139                 :            : 
     140                 :            :         // leave UIActive state
     141         [ #  # ]:          0 :         pIPClient->DeactivateObject();
     142                 :            :     }
     143                 :         12 :     return bRet;
     144                 :            : }
     145                 :            : 
     146                 :            : 
     147                 :            : 
     148                 :            : 
     149                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10