LCOV - code coverage report
Current view: top level - sw/source/core/graphic - ndgrf.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 208 507 41.0 %
Date: 2012-08-25 Functions: 24 37 64.9 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 191 1012 18.9 %

           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 <hintids.hxx>
      30                 :            : #include <tools/helpers.hxx>
      31                 :            : #include <tools/urlobj.hxx>
      32                 :            : #include <svl/undo.hxx>
      33                 :            : #include <svl/fstathelper.hxx>
      34                 :            : #include <svtools/imap.hxx>
      35                 :            : #include <svtools/filter.hxx>
      36                 :            : #include <sot/storage.hxx>
      37                 :            : #include <sfx2/linkmgr.hxx>
      38                 :            : #include <editeng/boxitem.hxx>
      39                 :            : #include <sot/formats.hxx>
      40                 :            : #include <fmtfsize.hxx>
      41                 :            : #include <fmturl.hxx>
      42                 :            : #include <frmfmt.hxx>
      43                 :            : #include <doc.hxx>
      44                 :            : #include <frmatr.hxx>
      45                 :            : #include <grfatr.hxx>
      46                 :            : #include <swtypes.hxx>
      47                 :            : #include <ndgrf.hxx>
      48                 :            : #include <fmtcol.hxx>
      49                 :            : #include <hints.hxx>
      50                 :            : #include <swbaslnk.hxx>
      51                 :            : #include <pagefrm.hxx>
      52                 :            : #include <editsh.hxx>
      53                 :            : #include <pam.hxx>
      54                 :            : 
      55                 :            : #include <rtl/oustringostreaminserter.hxx>
      56                 :            : #include <unotools/ucbstreamhelper.hxx>
      57                 :            : #include <com/sun/star/embed/ElementModes.hpp>
      58                 :            : #include <com/sun/star/embed/XTransactedObject.hpp>
      59                 :            : #include <vcl/svapp.hxx>
      60                 :            : #include <com/sun/star/io/XSeekable.hpp>
      61                 :            : // #i73788#
      62                 :            : #include <retrieveinputstreamconsumer.hxx>
      63                 :            : 
      64                 :            : using namespace com::sun::star;
      65                 :            : 
      66                 :            : // --------------------
      67                 :            : // SwGrfNode
      68                 :            : // --------------------
      69                 :         90 : SwGrfNode::SwGrfNode(
      70                 :            :         const SwNodeIndex & rWhere,
      71                 :            :         const String& rGrfName, const String& rFltName,
      72                 :            :         const Graphic* pGraphic,
      73                 :            :         SwGrfFmtColl *pGrfColl,
      74                 :            :         SwAttrSet* pAutoAttr ) :
      75                 :            :     SwNoTxtNode( rWhere, ND_GRFNODE, pGrfColl, pAutoAttr ),
      76                 :            :     // #i73788#
      77                 :            :     mbLinkedInputStreamReady( false ),
      78 [ +  - ][ +  - ]:         90 :     mbIsStreamReadOnly( sal_False )
         [ +  - ][ +  - ]
      79                 :            : {
      80 [ +  - ][ +  - ]:         90 :     aGrfObj.SetSwapStreamHdl( LINK( this, SwGrfNode, SwapGraphic ) );
      81                 :            :     bInSwapIn = bChgTwipSize = bChgTwipSizeFromPixel = bLoadLowResGrf =
      82                 :         90 :         bFrameInPaint = bScaleImageMap = sal_False;
      83                 :            : 
      84                 :         90 :     bGrafikArrived = sal_True;
      85         [ +  - ]:         90 :     ReRead(rGrfName,rFltName, pGraphic, 0, sal_False);
      86                 :         90 : }
      87                 :            : 
      88                 :          2 : SwGrfNode::SwGrfNode( const SwNodeIndex & rWhere,
      89                 :            :                           const GraphicObject& rGrfObj,
      90                 :            :                       SwGrfFmtColl *pGrfColl, SwAttrSet* pAutoAttr ) :
      91                 :            :     SwNoTxtNode( rWhere, ND_GRFNODE, pGrfColl, pAutoAttr ),
      92                 :            :     // #i73788#
      93                 :            :     mbLinkedInputStreamReady( false ),
      94 [ +  - ][ +  - ]:          2 :     mbIsStreamReadOnly( sal_False )
         [ +  - ][ +  - ]
      95                 :            : {
      96         [ +  - ]:          2 :     aGrfObj = rGrfObj;
      97 [ +  - ][ +  - ]:          2 :     aGrfObj.SetSwapStreamHdl( LINK( this, SwGrfNode, SwapGraphic ) );
      98 [ +  - ][ +  - ]:          2 :     if( rGrfObj.HasUserData() && rGrfObj.IsSwappedOut() )
         [ +  - ][ +  - ]
      99         [ +  - ]:          2 :         aGrfObj.SetSwapState();
     100                 :            :     bInSwapIn = bChgTwipSize = bChgTwipSizeFromPixel= bLoadLowResGrf =
     101                 :          2 :         bFrameInPaint = bScaleImageMap = sal_False;
     102                 :          2 :     bGrafikArrived = sal_True;
     103                 :          2 : }
     104                 :            : 
     105                 :            : // Konstruktor fuer den SW/G-Reader. Dieser ctor wird verwendet,
     106                 :            : // wenn eine gelinkte Grafik gelesen wird. Sie liest diese NICHT ein.
     107                 :            : 
     108                 :            : 
     109                 :          0 : SwGrfNode::SwGrfNode( const SwNodeIndex & rWhere,
     110                 :            :                       const String& rGrfName, const String& rFltName,
     111                 :            :                       SwGrfFmtColl *pGrfColl,
     112                 :            :                       SwAttrSet* pAutoAttr ) :
     113                 :            :     SwNoTxtNode( rWhere, ND_GRFNODE, pGrfColl, pAutoAttr ),
     114                 :            :     // #i73788#
     115                 :            :     mbLinkedInputStreamReady( false ),
     116 [ #  # ][ #  # ]:          0 :     mbIsStreamReadOnly( sal_False )
         [ #  # ][ #  # ]
     117                 :            : {
     118 [ #  # ][ #  # ]:          0 :     aGrfObj.SetSwapStreamHdl( LINK( this, SwGrfNode, SwapGraphic ) );
     119                 :            : 
     120 [ #  # ][ #  # ]:          0 :     Graphic aGrf; aGrf.SetDefaultType();
     121         [ #  # ]:          0 :     aGrfObj.SetGraphic( aGrf, rGrfName );
     122                 :            : 
     123                 :            :     bInSwapIn = bChgTwipSize = bChgTwipSizeFromPixel = bLoadLowResGrf =
     124                 :          0 :         bFrameInPaint = bScaleImageMap = sal_False;
     125                 :          0 :     bGrafikArrived = sal_True;
     126                 :            : 
     127         [ #  # ]:          0 :     InsertLink( rGrfName, rFltName );
     128         [ #  # ]:          0 :     if( IsLinkedFile() )
     129                 :            :     {
     130 [ #  # ][ #  # ]:          0 :         INetURLObject aUrl( rGrfName );
     131 [ #  # ][ #  # ]:          0 :         if( INET_PROT_FILE == aUrl.GetProtocol() &&
                 [ #  # ]
     132 [ #  # ][ #  # ]:          0 :             FStatHelper::IsDocument( aUrl.GetMainURL( INetURLObject::NO_DECODE ) ))
         [ #  # ][ #  # ]
     133                 :            :         {
     134                 :            :             // File vorhanden, Verbindung herstellen ohne ein Update
     135         [ #  # ]:          0 :             ((SwBaseLink*)&refLink)->Connect();
     136         [ #  # ]:          0 :         }
     137         [ #  # ]:          0 :     }
     138                 :          0 : }
     139                 :            : 
     140                 :        102 : sal_Bool SwGrfNode::ReRead(
     141                 :            :     const String& rGrfName, const String& rFltName,
     142                 :            :     const Graphic* pGraphic, const GraphicObject* pGrfObj,
     143                 :            :     sal_Bool bNewGrf )
     144                 :            : {
     145                 :        102 :     sal_Bool bReadGrf = sal_False, bSetTwipSize = sal_True;
     146                 :            : 
     147                 :            :     OSL_ENSURE( pGraphic || pGrfObj || rGrfName.Len(),
     148                 :            :             "GraphicNode without a name, Graphic or GraphicObject" );
     149                 :            : 
     150                 :            :     // ReadRead mit Namen
     151         [ +  + ]:        102 :     if( refLink.Is() )
     152                 :            :     {
     153                 :            :         OSL_ENSURE( !bInSwapIn, "ReRead: stehe noch im SwapIn" );
     154                 :            : 
     155         [ +  - ]:          4 :         if( rGrfName.Len() )
     156                 :            :         {
     157                 :            :             // Besonderheit: steht im FltNamen DDE, handelt es sich um eine
     158                 :            :             //                  DDE-gelinkte Grafik
     159         [ +  - ]:          4 :             String sCmd( rGrfName );
     160         [ +  + ]:          4 :             if( rFltName.Len() )
     161                 :            :             {
     162                 :            :                 sal_uInt16 nNewType;
     163 [ +  - ][ -  + ]:          2 :                 if( rFltName.EqualsAscii( "DDE" ))
     164                 :          0 :                     nNewType = OBJECT_CLIENT_DDE;
     165                 :            :                 else
     166                 :            :                 {
     167         [ +  - ]:          2 :                     sfx2::MakeLnkName( sCmd, 0, rGrfName, aEmptyStr, &rFltName );
     168                 :          2 :                     nNewType = OBJECT_CLIENT_GRF;
     169                 :            :                 }
     170                 :            : 
     171         [ -  + ]:          2 :                 if( nNewType != refLink->GetObjType() )
     172                 :            :                 {
     173         [ #  # ]:          0 :                     refLink->Disconnect();
     174         [ #  # ]:          0 :                     ((SwBaseLink*)&refLink)->SetObjType( nNewType );
     175                 :            :                 }
     176                 :            :             }
     177                 :            : 
     178 [ +  - ][ +  - ]:          4 :             refLink->SetLinkSourceName( sCmd );
     179                 :            :         }
     180                 :            :         else        // kein Name mehr, Link aufheben
     181                 :            :         {
     182                 :          0 :             GetDoc()->GetLinkManager().Remove( refLink );
     183                 :          0 :             refLink.Clear();
     184                 :            :         }
     185                 :            : 
     186         [ -  + ]:          4 :         if( pGraphic )
     187                 :            :         {
     188                 :          0 :             aGrfObj.SetGraphic( *pGraphic, rGrfName );
     189                 :          0 :             bReadGrf = sal_True;
     190                 :            :         }
     191         [ -  + ]:          4 :         else if( pGrfObj )
     192                 :            :         {
     193                 :          0 :             aGrfObj = *pGrfObj;
     194 [ #  # ][ #  # ]:          0 :             if( pGrfObj->HasUserData() && pGrfObj->IsSwappedOut() )
                 [ #  # ]
     195                 :          0 :                 aGrfObj.SetSwapState();
     196                 :          0 :             aGrfObj.SetLink( rGrfName );
     197                 :          0 :             bReadGrf = sal_True;
     198                 :            :         }
     199                 :            :         else
     200                 :            :         {
     201                 :            :             // MIB 25.02.97: Daten der alten Grafik zuruecksetzen, damit
     202                 :            :             // die korrekte Ersatz-Darstellung erscheint, wenn die
     203                 :            :             // der neue Link nicht geladen werden konnte.
     204 [ +  - ][ +  - ]:          4 :             Graphic aGrf; aGrf.SetDefaultType();
     205         [ +  - ]:          4 :             aGrfObj.SetGraphic( aGrf, rGrfName );
     206                 :            : 
     207         [ +  - ]:          4 :             if( refLink.Is() )
     208                 :            :             {
     209 [ +  - ][ +  - ]:          4 :                 if( getLayoutFrm( GetDoc()->GetCurrentLayout() ) )
                 [ +  - ]
     210                 :            :                 {
     211         [ +  - ]:          4 :                     SwMsgPoolItem aMsgHint( RES_GRF_REREAD_AND_INCACHE );
     212 [ +  - ][ +  - ]:          4 :                     ModifyNotification( &aMsgHint, &aMsgHint );
     213                 :            :                 }
     214                 :            :                 // #i59688#
     215                 :            :                 // do not load linked graphic, if it isn't a new linked graphic.
     216                 :            : //                else {
     217         [ #  # ]:          0 :                 else if ( bNewGrf )
     218                 :            :                 {
     219                 :            :                     //TODO refLink->setInputStream(getInputStream());
     220         [ #  # ]:          0 :                     ((SwBaseLink*)&refLink)->SwapIn();
     221                 :            :                 }
     222                 :            :             }
     223         [ +  - ]:          4 :             bSetTwipSize = sal_False;
     224                 :            :         }
     225                 :            :     }
     226 [ +  + ][ +  - ]:         98 :     else if( pGraphic && !rGrfName.Len() )
                 [ +  + ]
     227                 :            :     {
     228                 :            :         // MIB 27.02.2001: Old stream must be deleted before the new one is set.
     229         [ -  + ]:         87 :         if( HasStreamName() )
     230                 :          0 :             DelStreamName();
     231                 :            : 
     232                 :         87 :         aGrfObj.SetGraphic( *pGraphic );
     233                 :         87 :         bReadGrf = sal_True;
     234                 :            :     }
     235 [ -  + ][ #  # ]:         11 :     else if( pGrfObj && !rGrfName.Len() )
                 [ -  + ]
     236                 :            :     {
     237                 :            :         // MIB 27.02.2001: Old stream must be deleted before the new one is set.
     238         [ #  # ]:          0 :         if( HasStreamName() )
     239                 :          0 :             DelStreamName();
     240                 :            : 
     241                 :          0 :         aGrfObj = *pGrfObj;
     242 [ #  # ][ #  # ]:          0 :         if( pGrfObj->HasUserData() && pGrfObj->IsSwappedOut() )
                 [ #  # ]
     243                 :          0 :             aGrfObj.SetSwapState();
     244                 :          0 :         bReadGrf = sal_True;
     245                 :            :     }
     246                 :            :         // Import einer Grafik:
     247                 :            :         // Ist die Grafik bereits geladen?
     248 [ +  + ][ -  + ]:         11 :     else if( !bNewGrf && GRAPHIC_NONE != aGrfObj.GetType() )
                 [ -  + ]
     249                 :          0 :         return sal_True;
     250                 :            : 
     251                 :            :     else
     252                 :            :     {
     253         [ -  + ]:         11 :         if( HasStreamName() )
     254                 :          0 :             DelStreamName();
     255                 :            : 
     256                 :            :         // einen neuen Grafik-Link anlegen
     257                 :         11 :         InsertLink( rGrfName, rFltName );
     258                 :            : 
     259         [ +  - ]:         11 :         if( GetNodes().IsDocNodes() )
     260                 :            :         {
     261         [ -  + ]:         11 :             if( pGraphic )
     262                 :            :             {
     263                 :          0 :                 aGrfObj.SetGraphic( *pGraphic, rGrfName );
     264                 :          0 :                 bReadGrf = sal_True;
     265                 :            :                 // Verbindung herstellen ohne ein Update; Grafik haben wir!
     266                 :          0 :                 ((SwBaseLink*)&refLink)->Connect();
     267                 :            :             }
     268         [ -  + ]:         11 :             else if( pGrfObj )
     269                 :            :             {
     270                 :          0 :                 aGrfObj = *pGrfObj;
     271                 :          0 :                 aGrfObj.SetLink( rGrfName );
     272                 :          0 :                 bReadGrf = sal_True;
     273                 :            :                 // Verbindung herstellen ohne ein Update; Grafik haben wir!
     274                 :          0 :                 ((SwBaseLink*)&refLink)->Connect();
     275                 :            :             }
     276                 :            :             else
     277                 :            :             {
     278                 :            :                 // MIB 25.02.97: Daten der alten Grafik zuruecksetzen, damit
     279                 :            :                 // die korrekte Ersatz-Darstellung erscheint, wenn die
     280                 :            :                 // der neue Kink nicht geladen werden konnte.
     281 [ +  - ][ +  - ]:         11 :                 Graphic aGrf; aGrf.SetDefaultType();
     282         [ +  - ]:         11 :                 aGrfObj.SetGraphic( aGrf, rGrfName );
     283                 :            :                 // #i59688# - do not load linked graphic, if it isn't a new linked graphic.
     284         [ +  + ]:         11 :                 if ( bNewGrf )
     285                 :            :                 {
     286         [ +  - ]:          8 :                     ((SwBaseLink*)&refLink)->SwapIn();
     287         [ +  - ]:         11 :                 }
     288                 :            :             }
     289                 :            :         }
     290                 :            :     }
     291                 :            : 
     292                 :            :     // Bug 39281: Size nicht sofort loeschen - Events auf ImageMaps
     293                 :            :     //            sollten nicht beim Austauschen nicht ins "leere greifen"
     294         [ +  + ]:        102 :     if( bSetTwipSize )
     295         [ +  - ]:         98 :         SetTwipSize( ::GetGraphicSizeTwip( aGrfObj.GetGraphic(), 0 ) );
     296                 :            : 
     297                 :            :     // erzeuge noch einen Update auf die Frames
     298 [ +  + ][ -  + ]:        102 :     if( bReadGrf && bNewGrf )
     299                 :            :     {
     300         [ #  # ]:          0 :         SwMsgPoolItem aMsgHint( RES_UPDATE_ATTR );
     301 [ #  # ][ #  # ]:          0 :         ModifyNotification( &aMsgHint, &aMsgHint );
     302                 :            :     }
     303                 :            : 
     304                 :        102 :     return bReadGrf;
     305                 :            : }
     306                 :            : 
     307                 :            : 
     308 [ +  - ][ +  - ]:         89 : SwGrfNode::~SwGrfNode()
         [ +  - ][ +  - ]
                 [ +  - ]
     309                 :            : {
     310                 :            :     // #i73788#
     311         [ +  - ]:         89 :     mpThreadConsumer.reset();
     312                 :            : 
     313                 :         89 :     SwDoc* pDoc = GetDoc();
     314         [ +  + ]:         89 :     if( refLink.Is() )
     315                 :            :     {
     316                 :            :         OSL_ENSURE( !bInSwapIn, "DTOR: stehe noch im SwapIn" );
     317 [ +  - ][ +  - ]:         11 :         pDoc->GetLinkManager().Remove( refLink );
     318         [ +  - ]:         11 :         refLink->Disconnect();
     319                 :            :     }
     320                 :            :     else
     321                 :            :     {
     322                 :            :         // #i40014# - A graphic node, which are in linked
     323                 :            :         // section, whose link is another section is the document, doesn't
     324                 :            :         // have to remove the stream from the storage.
     325                 :            :         // Because it's hard to detect this case here and it would only fix
     326                 :            :         // one problem with shared graphic files - there are also problems,
     327                 :            :         // a certain graphic file is referenced by two independent graphic nodes,
     328                 :            :         // brush item or drawing objects, the stream isn't no longer removed here.
     329                 :            :         // To do this stuff correct, a reference counting on shared streams
     330                 :            :         // inside one document have to be implemented.
     331                 :            : //        if( !pDoc->IsInDtor() && HasStreamName() )
     332                 :            : //          DelStreamName();
     333                 :            :     }
     334                 :            :     //#39289# Die Frames muessen hier bereits geloescht weil der DTor der
     335                 :            :     //Frms die Grafik noch fuer StopAnimation braucht.
     336         [ -  + ]:         89 :     if( GetDepends() )
     337         [ #  # ]:          0 :         DelFrms();
     338         [ -  + ]:        178 : }
     339                 :            : 
     340                 :            : 
     341                 :          0 : SwCntntNode *SwGrfNode::SplitCntntNode( const SwPosition & )
     342                 :            : {
     343                 :          0 :     return this;
     344                 :            : }
     345                 :            : 
     346                 :            : 
     347                 :         90 : SwGrfNode * SwNodes::MakeGrfNode( const SwNodeIndex & rWhere,
     348                 :            :                                 const String& rGrfName,
     349                 :            :                                 const String& rFltName,
     350                 :            :                                 const Graphic* pGraphic,
     351                 :            :                                 SwGrfFmtColl* pGrfColl,
     352                 :            :                                 SwAttrSet* pAutoAttr,
     353                 :            :                                 sal_Bool bDelayed )
     354                 :            : {
     355                 :            :     OSL_ENSURE( pGrfColl, "MakeGrfNode: Formatpointer ist 0." );
     356                 :            :     SwGrfNode *pNode;
     357                 :            :     // Delayed erzeugen nur aus dem SW/G-Reader
     358         [ -  + ]:         90 :     if( bDelayed )
     359                 :            :         pNode = new SwGrfNode( rWhere, rGrfName,
     360         [ #  # ]:          0 :                                 rFltName, pGrfColl, pAutoAttr );
     361                 :            :     else
     362                 :            :         pNode = new SwGrfNode( rWhere, rGrfName,
     363         [ +  - ]:         90 :                                 rFltName, pGraphic, pGrfColl, pAutoAttr );
     364                 :         90 :     return pNode;
     365                 :            : }
     366                 :            : 
     367                 :          2 : SwGrfNode * SwNodes::MakeGrfNode( const SwNodeIndex & rWhere,
     368                 :            :                                 const GraphicObject& rGrfObj,
     369                 :            :                                 SwGrfFmtColl* pGrfColl,
     370                 :            :                                 SwAttrSet* pAutoAttr )
     371                 :            : {
     372                 :            :     OSL_ENSURE( pGrfColl, "MakeGrfNode: Formatpointer ist 0." );
     373         [ +  - ]:          2 :     return new SwGrfNode( rWhere, rGrfObj, pGrfColl, pAutoAttr );
     374                 :            : }
     375                 :            : 
     376                 :            : 
     377                 :         99 : Size SwGrfNode::GetTwipSize() const
     378                 :            : {
     379                 :         99 :     return nGrfSize;
     380                 :            : }
     381                 :            : 
     382                 :            : 
     383                 :            : 
     384                 :          0 : sal_Bool SwGrfNode::ImportGraphic( SvStream& rStrm )
     385                 :            : {
     386         [ #  # ]:          0 :     Graphic aGraphic;
     387         [ #  # ]:          0 :     const String aGraphicURL( aGrfObj.GetUserData() );
     388 [ #  # ][ #  # ]:          0 :     if( !GraphicFilter::GetGraphicFilter().ImportGraphic( aGraphic, aGraphicURL, rStrm ) )
                 [ #  # ]
     389                 :            :     {
     390         [ #  # ]:          0 :         aGrfObj.SetGraphic( aGraphic );
     391         [ #  # ]:          0 :         aGrfObj.SetUserData( aGraphicURL );
     392                 :          0 :         return sal_True;
     393                 :            :     }
     394                 :            : 
     395 [ #  # ][ #  # ]:          0 :     return sal_False;
     396                 :            : }
     397                 :            : 
     398                 :            : // Returnwert:
     399                 :            : // -1 : ReRead erfolgreich
     400                 :            : //  0 : nicht geladen
     401                 :            : //  1 : Einlesen erfolgreich
     402                 :            : 
     403                 :         61 : short SwGrfNode::SwapIn( sal_Bool bWaitForData )
     404                 :            : {
     405         [ -  + ]:         61 :     if( bInSwapIn )                 // nicht rekuriv!!
     406                 :          0 :         return !aGrfObj.IsSwappedOut();
     407                 :            : 
     408                 :         61 :     short nRet = 0;
     409                 :         61 :     bInSwapIn = sal_True;
     410                 :         61 :     SwBaseLink* pLink = (SwBaseLink*)(::sfx2::SvBaseLink*) refLink;
     411                 :            : 
     412         [ +  + ]:         61 :     if( pLink )
     413                 :            :     {
     414   [ +  +  +  - ]:         28 :         if( GRAPHIC_NONE == aGrfObj.GetType() ||
                 [ +  - ]
     415                 :          4 :             GRAPHIC_DEFAULT == aGrfObj.GetType() )
     416                 :            :         {
     417                 :            :             // noch nicht geladener Link
     418                 :            :             //TODO pLink->setInputStream(getInputStream());
     419         [ +  + ]:         24 :             if( pLink->SwapIn( bWaitForData ) )
     420                 :          8 :                 nRet = -1;
     421         [ -  + ]:         16 :             else if( GRAPHIC_DEFAULT == aGrfObj.GetType() )
     422                 :            :             {
     423                 :            :                 // keine default Bitmap mehr, also neu Painten!
     424 [ #  # ][ #  # ]:          0 :                 aGrfObj.SetGraphic( Graphic() );
                 [ #  # ]
     425         [ #  # ]:          0 :                 SwMsgPoolItem aMsgHint( RES_GRAPHIC_PIECE_ARRIVED );
     426 [ #  # ][ #  # ]:          0 :                 ModifyNotification( &aMsgHint, &aMsgHint );
     427                 :            :             }
     428                 :            :         }
     429         [ #  # ]:          0 :         else if( aGrfObj.IsSwappedOut() ) {
     430                 :            :             // nachzuladender Link
     431                 :            :             //TODO pLink->setInputStream(getInputStream());
     432         [ #  # ]:          0 :             nRet = pLink->SwapIn( bWaitForData ) ? 1 : 0;
     433                 :            :         }
     434                 :            :         else
     435                 :          0 :             nRet = 1;
     436                 :            :     }
     437         [ -  + ]:         37 :     else if( aGrfObj.IsSwappedOut() )
     438                 :            :     {
     439                 :            :         // Die Grafik ist im Storage oder im TempFile drin
     440         [ #  # ]:          0 :         if( !HasStreamName() )
     441                 :          0 :             nRet = (short)aGrfObj.SwapIn();
     442                 :            :         else
     443                 :            :         {
     444                 :            : 
     445                 :            :             // #i48434# - usage of new method <_GetStreamForEmbedGrf(..)>
     446                 :            :             try
     447                 :            :             {
     448                 :            :                 // #i53025# - needed correction of new method <_GetStreamForEmbedGrf(..)>
     449 [ #  # ][ #  # ]:          0 :                 String aStrmName, aPicStgName;
     450         [ #  # ]:          0 :                 _GetStreamStorageNames( aStrmName, aPicStgName );
     451         [ #  # ]:          0 :                 uno::Reference < embed::XStorage > refPics = _GetDocSubstorageOrRoot( aPicStgName );
     452         [ #  # ]:          0 :                 SvStream* pStrm = _GetStreamForEmbedGrf( refPics, aStrmName );
     453         [ #  # ]:          0 :                 if ( pStrm )
     454                 :            :                 {
     455 [ #  # ][ #  # ]:          0 :                     if ( ImportGraphic( *pStrm ) )
     456                 :          0 :                         nRet = 1;
     457 [ #  # ][ #  # ]:          0 :                     delete pStrm;
     458 [ #  # ][ #  # ]:          0 :                 }
                 [ #  # ]
     459                 :            :             }
     460                 :          0 :             catch (const uno::Exception&)
     461                 :            :             {
     462                 :            :                 // #i48434#
     463                 :            :                 OSL_FAIL( "<SwGrfNode::SwapIn(..)> - unhandled exception!" );
     464                 :            :             }
     465                 :            :         }
     466                 :            : 
     467         [ #  # ]:          0 :         if( 1 == nRet )
     468                 :            :         {
     469         [ #  # ]:          0 :             SwMsgPoolItem aMsg( RES_GRAPHIC_SWAPIN );
     470 [ #  # ][ #  # ]:          0 :             ModifyNotification( &aMsg, &aMsg );
     471                 :            :         }
     472                 :            :     }
     473                 :            :     else
     474                 :         37 :         nRet = 1;
     475                 :            :     OSL_ENSURE( nRet, "Grafik kann nicht eingeswapt werden" );
     476                 :            : 
     477         [ +  + ]:         61 :     if( nRet )
     478                 :            :     {
     479 [ +  + ][ +  - ]:         45 :         if( !nGrfSize.Width() && !nGrfSize.Height() )
                 [ +  + ]
     480         [ +  - ]:         39 :             SetTwipSize( ::GetGraphicSizeTwip( aGrfObj.GetGraphic(), 0 ) );
     481                 :            :     }
     482                 :         61 :     bInSwapIn = sal_False;
     483                 :         61 :     return nRet;
     484                 :            : }
     485                 :            : 
     486                 :            : 
     487                 :          0 : short SwGrfNode::SwapOut()
     488                 :            : {
     489   [ #  #  #  #  :          0 :     if( aGrfObj.GetType() != GRAPHIC_DEFAULT &&
           #  # ][ #  # ]
                 [ #  # ]
     490                 :          0 :         aGrfObj.GetType() != GRAPHIC_NONE &&
     491                 :          0 :         !aGrfObj.IsSwappedOut() && !bInSwapIn )
     492                 :            :     {
     493         [ #  # ]:          0 :         if( !refLink.Is() )
     494                 :            :         {
     495                 :            :             // Das Swapping brauchen wir nur fuer Embedded Pictures
     496                 :            :             // Die Grafik wird in eine TempFile geschrieben, wenn
     497                 :            :             // sie frisch eingefuegt war, d.h. wenn es noch keinen
     498                 :            :             // Streamnamen im Storage gibt.
     499         [ #  # ]:          0 :             if( !HasStreamName() )
     500         [ #  # ]:          0 :                 if( !aGrfObj.SwapOut() )
     501                 :          0 :                     return 0;
     502                 :            :         }
     503                 :            :         // Geschriebene Grafiken oder Links werden jetzt weggeschmissen
     504                 :          0 :         return (short) aGrfObj.SwapOut( NULL );
     505                 :            :     }
     506                 :          0 :     return 1;
     507                 :            : }
     508                 :            : 
     509                 :            : 
     510                 :         50 : sal_Bool SwGrfNode::GetFileFilterNms( String* pFileNm, String* pFilterNm ) const
     511                 :            : {
     512                 :         50 :     sal_Bool bRet = sal_False;
     513 [ +  - ][ +  - ]:         50 :     if( refLink.Is() && refLink->GetLinkManager() )
                 [ +  - ]
     514                 :            :     {
     515                 :         50 :         sal_uInt16 nType = refLink->GetObjType();
     516         [ +  - ]:         50 :         if( OBJECT_CLIENT_GRF == nType )
     517                 :            :             bRet = refLink->GetLinkManager()->GetDisplayNames(
     518                 :         50 :                     refLink, 0, pFileNm, 0, pFilterNm );
     519 [ #  # ][ #  # ]:          0 :         else if( OBJECT_CLIENT_DDE == nType && pFileNm && pFilterNm )
                 [ #  # ]
     520                 :            :         {
     521 [ #  # ][ #  # ]:          0 :             String sApp, sTopic, sItem;
                 [ #  # ]
     522 [ #  # ][ #  # ]:          0 :             if( refLink->GetLinkManager()->GetDisplayNames(
     523         [ #  # ]:          0 :                     refLink, &sApp, &sTopic, &sItem ) )
     524                 :            :             {
     525 [ #  # ][ #  # ]:          0 :                 ( *pFileNm = sApp ) += sfx2::cTokenSeperator;
     526 [ #  # ][ #  # ]:          0 :                 ( *pFileNm += sTopic ) += sfx2::cTokenSeperator;
     527         [ #  # ]:          0 :                 *pFileNm += sItem;
     528         [ #  # ]:          0 :                 pFilterNm->AssignAscii( RTL_CONSTASCII_STRINGPARAM( "DDE" ));
     529                 :          0 :                 bRet = sal_True;
     530 [ #  # ][ #  # ]:          0 :             }
                 [ #  # ]
     531                 :            :         }
     532                 :            :     }
     533                 :         50 :     return bRet;
     534                 :            : }
     535                 :            : 
     536                 :            : 
     537                 :            : // Eine Grafik Undo-faehig machen. Falls sie sich bereits in
     538                 :            : // einem Storage befindet, muss sie geladen werden.
     539                 :            : 
     540                 :          2 : sal_Bool SwGrfNode::SavePersistentData()
     541                 :            : {
     542         [ +  - ]:          2 :     if( refLink.Is() )
     543                 :            :     {
     544                 :            :         OSL_ENSURE( !bInSwapIn, "SavePersistentData: stehe noch im SwapIn" );
     545                 :          2 :         GetDoc()->GetLinkManager().Remove( refLink );
     546                 :          2 :         return sal_True;
     547                 :            :     }
     548                 :            : 
     549                 :            :     // Erst mal reinswappen, falls sie im Storage ist
     550 [ #  # ][ #  # ]:          0 :     if( HasStreamName() && !SwapIn() )
                 [ #  # ]
     551                 :          0 :         return sal_False;
     552                 :            : 
     553                 :            :     // #i44367#
     554                 :            :     // Do not delete graphic file in storage, because the graphic file could
     555                 :            :     // be referenced by other graphic nodes.
     556                 :            :     // Because it's hard to detect this case here and it would only fix
     557                 :            :     // one problem with shared graphic files - there are also problems,
     558                 :            :     // a certain graphic file is referenced by two independent graphic nodes,
     559                 :            :     // brush item or drawing objects, the stream isn't no longer removed here.
     560                 :            :     // To do this stuff correct, a reference counting on shared streams
     561                 :            :     // inside one document have to be implemented.
     562                 :            :     // Important note: see also fix for #i40014#
     563                 :            : //    if( HasStreamName() )
     564                 :            : //        DelStreamName();
     565                 :            : 
     566                 :            :     // Und in TempFile rausswappen
     567                 :          2 :     return (sal_Bool) SwapOut();
     568                 :            : }
     569                 :            : 
     570                 :            : 
     571                 :          0 : sal_Bool SwGrfNode::RestorePersistentData()
     572                 :            : {
     573         [ #  # ]:          0 :     if( refLink.Is() )
     574                 :            :     {
     575                 :          0 :         IDocumentLinksAdministration* pIDLA = getIDocumentLinksAdministration();
     576                 :          0 :         refLink->SetVisible( pIDLA->IsVisibleLinks() );
     577                 :          0 :         pIDLA->GetLinkManager().InsertDDELink( refLink );
     578         [ #  # ]:          0 :         if( getIDocumentLayoutAccess()->GetCurrentLayout() )    //swmod 080218
     579                 :          0 :             refLink->Update();
     580                 :            :     }
     581                 :          0 :     return sal_True;
     582                 :            : }
     583                 :            : 
     584                 :            : 
     585                 :         11 : void SwGrfNode::InsertLink( const String& rGrfName, const String& rFltName )
     586                 :            : {
     587         [ +  - ]:         11 :     refLink = new SwBaseLink( sfx2::LINKUPDATE_ONCALL, FORMAT_GDIMETAFILE, this );
     588                 :            : 
     589                 :         11 :     IDocumentLinksAdministration* pIDLA = getIDocumentLinksAdministration();
     590         [ +  - ]:         11 :     if( GetNodes().IsDocNodes() )
     591                 :            :     {
     592                 :         11 :         refLink->SetVisible( pIDLA->IsVisibleLinks() );
     593         [ -  + ]:         11 :         if( rFltName.EqualsAscii( "DDE" ))
     594                 :            :         {
     595                 :          0 :             sal_uInt16 nTmp = 0;
     596 [ #  # ][ #  # ]:          0 :             String sApp, sTopic, sItem;
                 [ #  # ]
     597 [ #  # ][ #  # ]:          0 :             sApp = rGrfName.GetToken( 0, sfx2::cTokenSeperator, nTmp );
                 [ #  # ]
     598 [ #  # ][ #  # ]:          0 :             sTopic = rGrfName.GetToken( 0, sfx2::cTokenSeperator, nTmp );
                 [ #  # ]
     599 [ #  # ][ #  # ]:          0 :             sItem = rGrfName.Copy( nTmp );
                 [ #  # ]
     600         [ #  # ]:          0 :             pIDLA->GetLinkManager().InsertDDELink( refLink,
     601 [ #  # ][ #  # ]:          0 :                                             sApp, sTopic, sItem );
         [ #  # ][ #  # ]
     602                 :            :         }
     603                 :            :         else
     604                 :            :         {
     605                 :         11 :             sal_Bool bSync = rFltName.EqualsAscii( "SYNCHRON" );
     606                 :         11 :             refLink->SetSynchron( bSync );
     607                 :         11 :             refLink->SetContentType( SOT_FORMATSTR_ID_SVXB );
     608                 :            : 
     609                 :         11 :             pIDLA->GetLinkManager().InsertFileLink( *refLink,
     610                 :            :                                             OBJECT_CLIENT_GRF, rGrfName,
     611 [ -  + ][ +  - ]:         22 :                                 (!bSync && rFltName.Len() ? &rFltName : 0) );
     612                 :            :         }
     613                 :            :     }
     614                 :         11 :     aGrfObj.SetLink( rGrfName );
     615                 :         11 : }
     616                 :            : 
     617                 :            : 
     618                 :          0 : void SwGrfNode::ReleaseLink()
     619                 :            : {
     620         [ #  # ]:          0 :     if( refLink.Is() )
     621                 :            :     {
     622                 :            :         {
     623                 :          0 :             bInSwapIn = sal_True;
     624                 :          0 :             SwBaseLink* pLink = (SwBaseLink*)(::sfx2::SvBaseLink*) refLink;
     625                 :            :             //TODO pLink->setInputStream(getInputStream());
     626                 :          0 :             pLink->SwapIn( sal_True, sal_True );
     627                 :          0 :             bInSwapIn = sal_False;
     628                 :            :         }
     629                 :          0 :         getIDocumentLinksAdministration()->GetLinkManager().Remove( refLink );
     630                 :          0 :         refLink.Clear();
     631                 :          0 :         aGrfObj.SetLink();
     632                 :            :     }
     633                 :          0 : }
     634                 :            : 
     635                 :            : 
     636                 :        153 : void SwGrfNode::SetTwipSize( const Size& rSz )
     637                 :            : {
     638                 :        153 :     nGrfSize = rSz;
     639 [ -  + ][ #  # ]:        153 :     if( IsScaleImageMap() && nGrfSize.Width() && nGrfSize.Height() )
         [ #  # ][ -  + ]
     640                 :            :     {
     641                 :            :         // Image-Map an Grafik-Groesse anpassen
     642                 :          0 :         ScaleImageMap();
     643                 :            : 
     644                 :            :         // Image-Map nicht noch einmal skalieren
     645                 :          0 :         SetScaleImageMap( sal_False );
     646                 :            :     }
     647                 :        153 : }
     648                 :            : 
     649                 :          0 : void SwGrfNode::ScaleImageMap()
     650                 :            : {
     651 [ #  # ][ #  # ]:          0 :     if( !nGrfSize.Width() || !nGrfSize.Height() )
                 [ #  # ]
     652                 :            :         return;
     653                 :            : 
     654                 :            :     // dann die Image-Map skalieren
     655         [ #  # ]:          0 :     SwFrmFmt* pFmt = GetFlyFmt();
     656                 :            : 
     657         [ #  # ]:          0 :     if( !pFmt )
     658                 :            :         return;
     659                 :            : 
     660 [ #  # ][ #  # ]:          0 :     SwFmtURL aURL( pFmt->GetURL() );
     661         [ #  # ]:          0 :     if ( !aURL.GetMap() )
     662                 :            :         return;
     663                 :            : 
     664                 :          0 :     sal_Bool bScale = sal_False;
     665         [ #  # ]:          0 :     Fraction aScaleX( 1, 1 );
     666         [ #  # ]:          0 :     Fraction aScaleY( 1, 1 );
     667                 :            : 
     668         [ #  # ]:          0 :     const SwFmtFrmSize& rFrmSize = pFmt->GetFrmSize();
     669         [ #  # ]:          0 :     const SvxBoxItem& rBox = pFmt->GetBox();
     670                 :            : 
     671         [ #  # ]:          0 :     if( !rFrmSize.GetWidthPercent() )
     672                 :            :     {
     673                 :          0 :         SwTwips nWidth = rFrmSize.GetWidth();
     674                 :            : 
     675         [ #  # ]:          0 :         nWidth -= rBox.CalcLineSpace(BOX_LINE_LEFT) +
     676         [ #  # ]:          0 :                   rBox.CalcLineSpace(BOX_LINE_RIGHT);
     677                 :            : 
     678                 :            :         OSL_ENSURE( nWidth>0, "Gibt es 0 twip breite Grafiken!?" );
     679                 :            : 
     680         [ #  # ]:          0 :         if( nGrfSize.Width() != nWidth )
     681                 :            :         {
     682 [ #  # ][ #  # ]:          0 :             aScaleX = Fraction( nGrfSize.Width(), nWidth );
     683                 :          0 :             bScale = sal_True;
     684                 :            :         }
     685                 :            :     }
     686         [ #  # ]:          0 :     if( !rFrmSize.GetHeightPercent() )
     687                 :            :     {
     688                 :          0 :         SwTwips nHeight = rFrmSize.GetHeight();
     689                 :            : 
     690         [ #  # ]:          0 :         nHeight -= rBox.CalcLineSpace(BOX_LINE_TOP) +
     691         [ #  # ]:          0 :                    rBox.CalcLineSpace(BOX_LINE_BOTTOM);
     692                 :            : 
     693                 :            :         OSL_ENSURE( nHeight>0, "Gibt es 0 twip hohe Grafiken!?" );
     694                 :            : 
     695         [ #  # ]:          0 :         if( nGrfSize.Height() != nHeight )
     696                 :            :         {
     697 [ #  # ][ #  # ]:          0 :             aScaleY = Fraction( nGrfSize.Height(), nHeight );
     698                 :          0 :             bScale = sal_True;
     699                 :            :         }
     700                 :            :     }
     701                 :            : 
     702         [ #  # ]:          0 :     if( bScale )
     703                 :            :     {
     704         [ #  # ]:          0 :         aURL.GetMap()->Scale( aScaleX, aScaleY );
     705         [ #  # ]:          0 :         pFmt->SetFmtAttr( aURL );
     706 [ #  # ][ #  # ]:          0 :     }
     707                 :            : }
     708                 :            : 
     709                 :            : 
     710                 :          0 : void SwGrfNode::DelStreamName()
     711                 :            : {
     712         [ #  # ]:          0 :     if( HasStreamName() )
     713                 :            :     {
     714                 :            :         // Dann die Grafik im Storage loeschen
     715         [ #  # ]:          0 :         uno::Reference < embed::XStorage > xDocStg = GetDoc()->GetDocStorage();
     716         [ #  # ]:          0 :         if( xDocStg.is() )
     717                 :            :         {
     718                 :            :             try
     719                 :            :             {
     720 [ #  # ][ #  # ]:          0 :                 String aPicStgName, aStrmName;
     721         [ #  # ]:          0 :                 _GetStreamStorageNames( aStrmName, aPicStgName );
     722                 :          0 :                 uno::Reference < embed::XStorage > refPics = xDocStg;
     723         [ #  # ]:          0 :                 if ( aPicStgName.Len() )
     724 [ #  # ][ #  # ]:          0 :                     refPics = xDocStg->openStorageElement( aPicStgName, embed::ElementModes::READWRITE );
         [ #  # ][ #  # ]
     725 [ #  # ][ #  # ]:          0 :                 refPics->removeElement( aStrmName );
                 [ #  # ]
     726         [ #  # ]:          0 :                 uno::Reference < embed::XTransactedObject > xTrans( refPics, uno::UNO_QUERY );
     727         [ #  # ]:          0 :                 if ( xTrans.is() )
     728 [ #  # ][ #  # ]:          0 :                     xTrans->commit();
         [ #  # ][ #  # ]
                 [ #  # ]
     729                 :            :             }
     730         [ #  # ]:          0 :             catch (const uno::Exception&)
     731                 :            :             {
     732                 :            :                 // #i48434#
     733                 :            :                 OSL_FAIL( "<SwGrfNode::DelStreamName()> - unhandled exception!" );
     734                 :            :             }
     735                 :            :         }
     736                 :            : 
     737         [ #  # ]:          0 :         aGrfObj.SetUserData();
     738                 :            :     }
     739                 :          0 : }
     740                 :            : 
     741                 :            : /** helper method to get a substorage of the document storage for readonly access.
     742                 :            : 
     743                 :            :     OD, MAV 2005-08-17 #i53025#
     744                 :            :     A substorage with the specified name will be opened readonly. If the provided
     745                 :            :     name is empty the root storage will be returned.
     746                 :            : */
     747                 :          0 : uno::Reference< embed::XStorage > SwGrfNode::_GetDocSubstorageOrRoot( const String& aStgName ) const
     748                 :            : {
     749                 :            :     uno::Reference < embed::XStorage > refStor =
     750         [ #  # ]:          0 :         const_cast<SwGrfNode*>(this)->GetDoc()->GetDocStorage();
     751                 :            :     OSL_ENSURE( refStor.is(), "Kein Storage am Doc" );
     752                 :            : 
     753         [ #  # ]:          0 :     if ( aStgName.Len() )
     754                 :            :     {
     755         [ #  # ]:          0 :         if( refStor.is() )
     756 [ #  # ][ #  # ]:          0 :             return refStor->openStorageElement( aStgName, embed::ElementModes::READ );
                 [ #  # ]
     757                 :            :     }
     758                 :            : 
     759                 :          0 :     return refStor;
     760                 :            : }
     761                 :            : 
     762                 :            : /** helper method to determine stream for the embedded graphic.
     763                 :            : 
     764                 :            :     OD 2005-05-04 #i48434#
     765                 :            :     Important note: caller of this method has to handle the thrown exceptions
     766                 :            :     OD, MAV 2005-08-17 #i53025#
     767                 :            :     Storage, which should contain the stream of the embedded graphic, is
     768                 :            :     provided via parameter. Otherwise the returned stream will be closed
     769                 :            :     after the the method returns, because its parent stream is closed and deleted.
     770                 :            :     Proposed name of embedded graphic stream is also provided by parameter.
     771                 :            : 
     772                 :            :     @author OD
     773                 :            : */
     774                 :          0 : SvStream* SwGrfNode::_GetStreamForEmbedGrf(
     775                 :            :             const uno::Reference< embed::XStorage >& _refPics,
     776                 :            :             String& _aStrmName ) const
     777                 :            : {
     778                 :          0 :     SvStream* pStrm( 0L );
     779                 :            : 
     780 [ #  # ][ #  # ]:          0 :     if( _refPics.is() && _aStrmName.Len() )
                 [ #  # ]
     781                 :            :     {
     782                 :            :         // If stream doesn't exist in the storage, try access the graphic file by
     783                 :            :         // re-generating its name.
     784                 :            :         // A save action can have changed the filename of the embedded graphic,
     785                 :            :         // because a changed unique ID of the graphic is calculated.
     786                 :            :         // --> recursive calls of <GetUniqueID()> have to be avoided.
     787                 :            :         // Thus, use local static boolean to assure this.
     788 [ #  # ][ #  # ]:          0 :         if ( !_refPics->hasByName( _aStrmName ) ||
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  # ]
     789 [ #  # ][ #  # ]:          0 :                !_refPics->isStreamElement( _aStrmName ) )
         [ #  # ][ #  # ]
                 [ #  # ]
     790                 :            :         {
     791         [ #  # ]:          0 :             xub_StrLen nExtPos = _aStrmName.Search( '.' );
     792         [ #  # ]:          0 :             String aExtStr = _aStrmName.Copy( nExtPos );
     793         [ #  # ]:          0 :             if ( GetGrfObj().GetType() != GRAPHIC_NONE )
     794                 :            :             {
     795                 :          0 :                 _aStrmName = rtl::OStringToOUString(GetGrfObj().GetUniqueID(),
     796 [ #  # ][ #  # ]:          0 :                     RTL_TEXTENCODING_ASCII_US);
                 [ #  # ]
     797         [ #  # ]:          0 :                 _aStrmName += aExtStr;
     798         [ #  # ]:          0 :             }
     799                 :            :         }
     800                 :            : 
     801                 :            :         // assure that graphic file exist in the storage.
     802 [ #  # ][ #  # ]:          0 :         if ( _refPics->hasByName( _aStrmName ) &&
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  # ]
     803 [ #  # ][ #  # ]:          0 :              _refPics->isStreamElement( _aStrmName ) )
         [ #  # ][ #  # ]
                 [ #  # ]
     804                 :            :         {
     805 [ #  # ][ #  # ]:          0 :             uno::Reference < io::XStream > refStrm = _refPics->openStreamElement( _aStrmName, embed::ElementModes::READ );
                 [ #  # ]
     806         [ #  # ]:          0 :             pStrm = utl::UcbStreamHelper::CreateStream( refStrm );
     807                 :            :         }
     808                 :            :         else
     809                 :            :         {
     810                 :            :             OSL_FAIL( "<SwGrfNode::_GetStreamForEmbedGrf(..)> - embedded graphic file not found!" );
     811                 :            :         }
     812                 :            :     }
     813                 :            : 
     814                 :          0 :     return pStrm;
     815                 :            : }
     816                 :            : 
     817                 :            : 
     818                 :            : // #i53025# - stream couldn't be in a 3.1 - 5.2 storage any more.
     819                 :            : // Thus, removing corresponding code.
     820                 :          0 : void SwGrfNode::_GetStreamStorageNames( String& rStrmName,
     821                 :            :                                         String& rStorName ) const
     822                 :            : {
     823         [ #  # ]:          0 :     rStorName.Erase();
     824         [ #  # ]:          0 :     rStrmName.Erase();
     825                 :            : 
     826         [ #  # ]:          0 :     String aUserData( aGrfObj.GetUserData() );
     827         [ #  # ]:          0 :     if( !aUserData.Len() )
     828                 :          0 :         return;
     829                 :            : 
     830         [ #  # ]:          0 :     if (aNewStrmName.Len()>0) {
     831         [ #  # ]:          0 :         aUserData=aNewStrmName;
     832                 :            :     }
     833                 :            : 
     834         [ #  # ]:          0 :     String aProt( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package:" ) );
     835 [ #  # ][ #  # ]:          0 :     if( 0 == aUserData.CompareTo( aProt, aProt.Len() ) )
     836                 :            :     {
     837                 :            :         // 6.0 (XML) Package
     838         [ #  # ]:          0 :         xub_StrLen nPos = aUserData.Search( '/' );
     839         [ #  # ]:          0 :         if( STRING_NOTFOUND == nPos )
     840                 :            :         {
     841 [ #  # ][ #  # ]:          0 :             rStrmName = aUserData.Copy( aProt.Len() );
                 [ #  # ]
     842                 :            :         }
     843                 :            :         else
     844                 :            :         {
     845                 :          0 :             xub_StrLen nPathStart = aProt.Len();
     846 [ #  # ][ #  # ]:          0 :             if( 0 == aUserData.CompareToAscii( "./", 2 ) )
     847                 :          0 :                 nPathStart += 2;
     848 [ #  # ][ #  # ]:          0 :             rStorName = aUserData.Copy( nPathStart, nPos-nPathStart );
                 [ #  # ]
     849 [ #  # ][ #  # ]:          0 :             rStrmName = aUserData.Copy( nPos+1 );
                 [ #  # ]
     850                 :            :         }
     851                 :            :     }
     852                 :            :     else
     853                 :            :     {
     854                 :            :         OSL_FAIL( "<SwGrfNode::_GetStreamStorageNames(..)> - unknown graphic URL type. Code for handling 3.1 - 5.2 storages has been deleted by issue i53025." );
     855                 :            :     }
     856                 :            :     OSL_ENSURE( STRING_NOTFOUND == rStrmName.Search( '/' ),
     857 [ #  # ][ #  # ]:          0 :             "invalid graphic stream name" );
                 [ #  # ]
     858                 :            : }
     859                 :            : 
     860                 :          3 : SwCntntNode* SwGrfNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
     861                 :            : {
     862                 :            :     // kopiere die Formate in das andere Dokument:
     863         [ +  - ]:          3 :     SwGrfFmtColl* pColl = pDoc->CopyGrfColl( *GetGrfColl() );
     864                 :            : 
     865         [ +  - ]:          3 :     Graphic aTmpGrf;
     866                 :          3 :     SwBaseLink* pLink = (SwBaseLink*)(::sfx2::SvBaseLink*) refLink;
     867 [ -  + ][ -  + ]:          3 :     if( !pLink && HasStreamName() )
                 [ +  - ]
     868                 :            :     {
     869                 :            :         // #i48434# - usage of new method <_GetStreamForEmbedGrf(..)>
     870                 :            :         try
     871                 :            :         {
     872                 :            :             // #i53025# - needed correction of new method <_GetStreamForEmbedGrf(..)>
     873 [ #  # ][ #  # ]:          0 :             String aStrmName, aPicStgName;
     874         [ #  # ]:          0 :             _GetStreamStorageNames( aStrmName, aPicStgName );
     875         [ #  # ]:          0 :             uno::Reference < embed::XStorage > refPics = _GetDocSubstorageOrRoot( aPicStgName );
     876         [ #  # ]:          0 :             SvStream* pStrm = _GetStreamForEmbedGrf( refPics, aStrmName );
     877         [ #  # ]:          0 :             if ( pStrm )
     878                 :            :             {
     879         [ #  # ]:          0 :                 const String aGraphicURL( aGrfObj.GetUserData() );
     880 [ #  # ][ #  # ]:          0 :                 GraphicFilter::GetGraphicFilter().ImportGraphic( aTmpGrf, aGraphicURL, *pStrm );
     881 [ #  # ][ #  # ]:          0 :                 delete pStrm;
                 [ #  # ]
     882 [ #  # ][ #  # ]:          0 :             }
                 [ #  # ]
     883                 :            :         }
     884         [ #  # ]:          0 :         catch (const uno::Exception& e)
     885                 :            :         {
     886                 :            :             // #i48434#
     887                 :            :             SAL_WARN("sw", "<SwGrfNode::MakeCopy(..)> - unhandled exception!" << e.Message);
     888                 :            :         }
     889                 :            :     }
     890                 :            :     else
     891                 :            :     {
     892 [ +  - ][ -  + ]:          3 :         if( aGrfObj.IsSwappedOut() )
     893         [ #  # ]:          0 :             const_cast<SwGrfNode*>(this)->SwapIn();
     894 [ +  - ][ +  - ]:          3 :         aTmpGrf = aGrfObj.GetGraphic();
     895                 :            :     }
     896                 :            : 
     897 [ +  - ][ +  - ]:          3 :     const sfx2::LinkManager& rMgr = getIDocumentLinksAdministration()->GetLinkManager();
     898 [ +  - ][ +  - ]:          3 :     String sFile, sFilter;
     899         [ -  + ]:          3 :     if( IsLinkedFile() )
     900         [ #  # ]:          0 :         rMgr.GetDisplayNames( refLink, 0, &sFile, 0, &sFilter );
     901         [ -  + ]:          3 :     else if( IsLinkedDDE() )
     902                 :            :     {
     903 [ #  # ][ #  # ]:          0 :         String sTmp1, sTmp2;
     904         [ #  # ]:          0 :         rMgr.GetDisplayNames( refLink, &sTmp1, &sTmp2, &sFilter );
     905         [ #  # ]:          0 :         sfx2::MakeLnkName( sFile, &sTmp1, sTmp2, sFilter );
     906 [ #  # ][ #  # ]:          0 :         sFilter.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "DDE" ));
                 [ #  # ]
     907                 :            :     }
     908                 :            : 
     909         [ +  - ]:          3 :     SwGrfNode* pGrfNd = pDoc->GetNodes().MakeGrfNode( rIdx, sFile, sFilter,
     910                 :            :                                                     &aTmpGrf, pColl,
     911 [ +  - ][ +  - ]:          6 :                                             (SwAttrSet*)GetpSwAttrSet() );
     912 [ +  - ][ +  - ]:          3 :     pGrfNd->SetTitle( GetTitle() );
                 [ +  - ]
     913 [ +  - ][ +  - ]:          3 :     pGrfNd->SetDescription( GetDescription() );
                 [ +  - ]
     914 [ +  - ][ +  - ]:          3 :     pGrfNd->SetContour( HasContour(), HasAutomaticContour() );
     915 [ +  - ][ +  - ]:          3 :     return pGrfNd;
                 [ +  - ]
     916                 :            : }
     917                 :            : 
     918                 :          3 : IMPL_LINK( SwGrfNode, SwapGraphic, GraphicObject*, pGrfObj )
     919                 :            : {
     920                 :            :     SvStream* pRet;
     921                 :            : 
     922                 :            :     // Keep graphic while in swap in. That's at least important
     923                 :            :     // when breaking links, because in this situation a reschedule call and
     924                 :            :     // a DataChanged call lead to a paint of the graphic.
     925 [ +  - ][ +  - ]:          3 :     if( pGrfObj->IsInSwapOut() && (IsSelected() || bInSwapIn) )
         [ -  + ][ -  + ]
     926                 :          0 :         pRet = GRFMGR_AUTOSWAPSTREAM_NONE;
     927         [ -  + ]:          3 :     else if( refLink.Is() )
     928                 :            :     {
     929         [ #  # ]:          0 :         if( pGrfObj->IsInSwapIn() )
     930                 :            :         {
     931                 :            :             // then make it by your self
     932         [ #  # ]:          0 :             if( !bInSwapIn )
     933                 :            :             {
     934                 :          0 :                 sal_Bool bIsModifyLocked = IsModifyLocked();
     935                 :          0 :                 LockModify();
     936                 :          0 :                 SwapIn( sal_False );
     937         [ #  # ]:          0 :                 if( !bIsModifyLocked )
     938                 :          0 :                     UnlockModify();
     939                 :            :             }
     940                 :          0 :             pRet = GRFMGR_AUTOSWAPSTREAM_NONE;
     941                 :            :         }
     942                 :            :         else
     943                 :          0 :             pRet = GRFMGR_AUTOSWAPSTREAM_LINK;
     944                 :            :     }
     945                 :            :     else
     946                 :            :     {
     947                 :          3 :         pRet = GRFMGR_AUTOSWAPSTREAM_TEMP;
     948                 :            : 
     949         [ -  + ]:          3 :         if( HasStreamName() )
     950                 :            :         {
     951                 :            :             // #i48434# - usage of new method <_GetStreamForEmbedGrf(..)>
     952                 :            :             try
     953                 :            :             {
     954                 :            :                 // #i53025# - needed correction of new method <_GetStreamForEmbedGrf(..)>
     955 [ #  # ][ #  # ]:          0 :                 String aStrmName, aPicStgName;
     956         [ #  # ]:          0 :                 _GetStreamStorageNames( aStrmName, aPicStgName );
     957         [ #  # ]:          0 :                 uno::Reference < embed::XStorage > refPics = _GetDocSubstorageOrRoot( aPicStgName );
     958         [ #  # ]:          0 :                 SvStream* pStrm = _GetStreamForEmbedGrf( refPics, aStrmName );
     959         [ #  # ]:          0 :                 if ( pStrm )
     960                 :            :                 {
     961         [ #  # ]:          0 :                     if( pGrfObj->IsInSwapOut() )
     962                 :            :                     {
     963                 :          0 :                         pRet = GRFMGR_AUTOSWAPSTREAM_LINK;
     964                 :            :                     }
     965                 :            :                     else
     966                 :            :                     {
     967         [ #  # ]:          0 :                         ImportGraphic( *pStrm );
     968                 :          0 :                         pRet = GRFMGR_AUTOSWAPSTREAM_LOADED;
     969                 :            :                     }
     970 [ #  # ][ #  # ]:          0 :                     delete pStrm;
     971 [ #  # ][ #  # ]:          0 :                 }
                 [ #  # ]
     972                 :            :             }
     973                 :          0 :             catch (const uno::Exception&)
     974                 :            :             {
     975                 :            :                 // #i48434#
     976                 :            :                 OSL_FAIL( "<SwapGraphic> - unhandled exception!" );
     977                 :            :             }
     978                 :            :         }
     979                 :            :     }
     980                 :            : 
     981                 :          3 :     return (long)pRet;
     982                 :            : }
     983                 :            : 
     984                 :            : 
     985                 :            : // alle QuickDraw-Bitmaps eines speziellen Docs loeschen
     986                 :          0 : void DelAllGrfCacheEntries( SwDoc* pDoc )
     987                 :            : {
     988         [ #  # ]:          0 :     if( pDoc )
     989                 :            :     {
     990                 :            :         // alle Graphic-Links mit dem Namen aus dem Cache loeschen
     991         [ #  # ]:          0 :         const sfx2::LinkManager& rLnkMgr = pDoc->GetLinkManager();
     992                 :          0 :         const ::sfx2::SvBaseLinks& rLnks = rLnkMgr.GetLinks();
     993                 :            :         SwGrfNode* pGrfNd;
     994         [ #  # ]:          0 :         String sFileNm;
     995         [ #  # ]:          0 :         for( sal_uInt16 n = rLnks.size(); n; )
     996                 :            :         {
     997                 :          0 :             ::sfx2::SvBaseLink* pLnk = &(*rLnks[ --n ]);
     998 [ #  # ][ #  # ]:          0 :             if( pLnk && OBJECT_CLIENT_GRF == pLnk->GetObjType() &&
           [ #  #  #  # ]
         [ #  # ][ #  # ]
     999         [ #  # ]:          0 :                 rLnkMgr.GetDisplayNames( pLnk, 0, &sFileNm ) &&
    1000 [ #  # ][ #  # ]:          0 :                 pLnk->ISA( SwBaseLink ) && 0 != ( pGrfNd =
    1001                 :          0 :                 ((SwBaseLink*)pLnk)->GetCntntNode()->GetGrfNode()) )
    1002                 :            :             {
    1003         [ #  # ]:          0 :                 pGrfNd->GetGrfObj().ReleaseFromCache();
    1004                 :            :             }
    1005         [ #  # ]:          0 :         }
    1006                 :            :     }
    1007                 :          0 : }
    1008                 :            : 
    1009                 :            : // returns the with our graphic attributes filled Graphic-Attr-Structure
    1010                 :         64 : GraphicAttr& SwGrfNode::GetGraphicAttr( GraphicAttr& rGA,
    1011                 :            :                                         const SwFrm* pFrm ) const
    1012                 :            : {
    1013                 :         64 :     const SwAttrSet& rSet = GetSwAttrSet();
    1014                 :            : 
    1015                 :         64 :     rGA.SetDrawMode( (GraphicDrawMode)rSet.GetDrawModeGrf().GetValue() );
    1016                 :            : 
    1017                 :         64 :     const SwMirrorGrf & rMirror = rSet.GetMirrorGrf();
    1018                 :         64 :     sal_uLong nMirror = BMP_MIRROR_NONE;
    1019 [ #  # ][ #  # ]:         64 :     if( rMirror.IsGrfToggle() && pFrm && !pFrm->FindPageFrm()->OnRightPage() )
         [ -  + ][ -  + ]
    1020                 :            :     {
    1021   [ #  #  #  # ]:          0 :         switch( rMirror.GetValue() )
    1022                 :            :         {
    1023                 :          0 :         case RES_MIRROR_GRAPH_DONT:     nMirror = BMP_MIRROR_HORZ; break;
    1024                 :          0 :         case RES_MIRROR_GRAPH_VERT:     nMirror = BMP_MIRROR_NONE; break;
    1025                 :          0 :         case RES_MIRROR_GRAPH_HOR:  nMirror = BMP_MIRROR_HORZ|BMP_MIRROR_VERT;
    1026                 :          0 :                                     break;
    1027                 :          0 :         default:                    nMirror = BMP_MIRROR_VERT; break;
    1028                 :            :         }
    1029                 :            :     }
    1030                 :            :     else
    1031   [ -  -  -  + ]:         64 :         switch( rMirror.GetValue() )
    1032                 :            :         {
    1033                 :          0 :         case RES_MIRROR_GRAPH_BOTH:     nMirror = BMP_MIRROR_HORZ|BMP_MIRROR_VERT;
    1034                 :          0 :                                     break;
    1035                 :          0 :         case RES_MIRROR_GRAPH_VERT: nMirror = BMP_MIRROR_HORZ; break;
    1036                 :          0 :         case RES_MIRROR_GRAPH_HOR:  nMirror = BMP_MIRROR_VERT; break;
    1037                 :            :         }
    1038                 :            : 
    1039                 :         64 :     rGA.SetMirrorFlags( nMirror );
    1040                 :            : 
    1041                 :         64 :     const SwCropGrf& rCrop = rSet.GetCropGrf();
    1042                 :        128 :     rGA.SetCrop( TWIP_TO_MM100( rCrop.GetLeft() ),
    1043                 :        128 :                  TWIP_TO_MM100( rCrop.GetTop() ),
    1044                 :        128 :                  TWIP_TO_MM100( rCrop.GetRight() ),
    1045   [ +  -  +  -  :        448 :                  TWIP_TO_MM100( rCrop.GetBottom() ));
           +  - ][ +  - ]
    1046                 :            : 
    1047                 :         64 :     const SwRotationGrf& rRotation = rSet.GetRotationGrf();
    1048                 :         64 :     rGA.SetRotation( rRotation.GetValue() );
    1049                 :            : 
    1050                 :         64 :     rGA.SetLuminance( rSet.GetLuminanceGrf().GetValue() );
    1051                 :         64 :     rGA.SetContrast( rSet.GetContrastGrf().GetValue() );
    1052                 :         64 :     rGA.SetChannelR( rSet.GetChannelRGrf().GetValue() );
    1053                 :         64 :     rGA.SetChannelG( rSet.GetChannelGGrf().GetValue() );
    1054                 :         64 :     rGA.SetChannelB( rSet.GetChannelBGrf().GetValue() );
    1055                 :         64 :     rGA.SetGamma( rSet.GetGammaGrf().GetValue() );
    1056                 :         64 :     rGA.SetInvert( rSet.GetInvertGrf().GetValue() );
    1057                 :            : 
    1058                 :         64 :     const sal_uInt16 nTrans = rSet.GetTransparencyGrf().GetValue();
    1059                 :            :     rGA.SetTransparency( (sal_uInt8) FRound(
    1060                 :         64 :                                 Min( nTrans, (sal_uInt16) 100 )  * 2.55 ) );
    1061                 :            : 
    1062                 :         64 :     return rGA;
    1063                 :            : }
    1064                 :            : 
    1065                 :        423 : sal_Bool SwGrfNode::IsTransparent() const
    1066                 :            : {
    1067                 :        423 :     sal_Bool bRet = aGrfObj.IsTransparent();
    1068         [ -  + ]:        423 :     if( !bRet ) // ask the attribut
    1069                 :          0 :         bRet = 0 != GetSwAttrSet().GetTransparencyGrf().GetValue();
    1070                 :            : 
    1071                 :        423 :     return bRet;
    1072                 :            : }
    1073                 :            : 
    1074                 :            : 
    1075                 :          3 : sal_Bool SwGrfNode::IsSelected() const
    1076                 :            : {
    1077                 :          3 :     sal_Bool bRet = sal_False;
    1078                 :          3 :     const SwEditShell* pESh = GetDoc()->GetEditShell();
    1079         [ +  - ]:          3 :     if( pESh )
    1080                 :            :     {
    1081                 :          3 :         const SwNode* pN = this;
    1082                 :          3 :         const ViewShell* pV = pESh;
    1083         [ -  + ]:          3 :         do {
    1084   [ +  -  -  + ]:          6 :             if( pV->ISA( SwEditShell ) && pN == &((SwCrsrShell*)pV)
                 [ -  + ]
    1085                 :          3 :                                 ->GetCrsr()->GetPoint()->nNode.GetNode() )
    1086                 :            :             {
    1087                 :          0 :                 bRet = sal_True;
    1088                 :          0 :                 break;
    1089                 :            :             }
    1090                 :            :         }
    1091                 :          3 :         while( pESh != ( pV = (ViewShell*)pV->GetNext() ));
    1092                 :            :     }
    1093                 :          3 :     return bRet;
    1094                 :            : }
    1095                 :            : 
    1096                 :            : // #i73788#
    1097                 :          8 : boost::weak_ptr< SwAsyncRetrieveInputStreamThreadConsumer > SwGrfNode::GetThreadConsumer()
    1098                 :            : {
    1099         [ +  - ]:          8 :     return mpThreadConsumer;
    1100                 :            : }
    1101                 :            : 
    1102                 :         34 : void SwGrfNode::TriggerAsyncRetrieveInputStream()
    1103                 :            : {
    1104         [ -  + ]:         34 :     if ( !IsLinkedFile() )
    1105                 :            :     {
    1106                 :            :         OSL_FAIL( "<SwGrfNode::TriggerAsyncLoad()> - Method is misused. Method call is only valid for graphic nodes, which refer a linked graphic file" );
    1107                 :         34 :         return;
    1108                 :            :     }
    1109                 :            : 
    1110         [ +  + ]:         34 :     if ( mpThreadConsumer.get() == 0 )
    1111                 :            :     {
    1112 [ +  - ][ +  - ]:          8 :         mpThreadConsumer.reset( new SwAsyncRetrieveInputStreamThreadConsumer( *this ) );
                 [ +  - ]
    1113                 :            : 
    1114         [ +  - ]:          8 :         String sGrfNm;
    1115 [ +  - ][ +  - ]:          8 :         refLink->GetLinkManager()->GetDisplayNames( refLink, 0, &sGrfNm, 0, 0 );
    1116                 :            : 
    1117 [ +  - ][ +  - ]:          8 :         mpThreadConsumer->CreateThread( sGrfNm );
    1118                 :            :     }
    1119                 :            : }
    1120                 :            : 
    1121                 :         60 : bool SwGrfNode::IsLinkedInputStreamReady() const
    1122                 :            : {
    1123                 :         60 :     return mbLinkedInputStreamReady;
    1124                 :            : }
    1125                 :            : 
    1126                 :          8 : void SwGrfNode::ApplyInputStream(
    1127                 :            :     com::sun::star::uno::Reference<com::sun::star::io::XInputStream> xInputStream,
    1128                 :            :     const sal_Bool bIsStreamReadOnly )
    1129                 :            : {
    1130         [ +  - ]:          8 :     if ( IsLinkedFile() )
    1131                 :            :     {
    1132         [ -  + ]:          8 :         if ( xInputStream.is() )
    1133                 :            :         {
    1134         [ #  # ]:          0 :             mxInputStream = xInputStream;
    1135                 :          0 :             mbIsStreamReadOnly = bIsStreamReadOnly;
    1136                 :          0 :             mbLinkedInputStreamReady = true;
    1137         [ #  # ]:          0 :             SwMsgPoolItem aMsgHint( RES_LINKED_GRAPHIC_STREAM_ARRIVED );
    1138 [ #  # ][ #  # ]:          0 :             ModifyNotification( &aMsgHint, &aMsgHint );
    1139                 :            :         }
    1140                 :            :     }
    1141                 :          8 : }
    1142                 :            : 
    1143                 :          0 : void SwGrfNode::UpdateLinkWithInputStream()
    1144                 :            : {
    1145                 :            :     // --> OD #i85105#
    1146                 :            :     // do not work on link, if a <SwapIn> has been triggered.
    1147 [ #  # ][ #  # ]:          0 :     if ( !bInSwapIn && IsLinkedFile() )
                 [ #  # ]
    1148                 :            :     // <--
    1149                 :            :     {
    1150 [ #  # ][ #  # ]:          0 :         GetLink()->setStreamToLoadFrom( mxInputStream, mbIsStreamReadOnly );
                 [ #  # ]
    1151 [ #  # ][ #  # ]:          0 :         GetLink()->Update();
                 [ #  # ]
    1152         [ #  # ]:          0 :         SwMsgPoolItem aMsgHint( RES_GRAPHIC_ARRIVED );
    1153         [ #  # ]:          0 :         ModifyNotification( &aMsgHint, &aMsgHint );
    1154                 :            : 
    1155                 :            :         // #i88291#
    1156                 :          0 :         mxInputStream.clear();
    1157 [ #  # ][ #  # ]:          0 :         GetLink()->clearStreamToLoadFrom();
                 [ #  # ]
    1158                 :          0 :         mbLinkedInputStreamReady = false;
    1159 [ #  # ][ #  # ]:          0 :         mpThreadConsumer.reset();
    1160                 :            :     }
    1161                 :          0 : }
    1162                 :            : 
    1163                 :            : // #i90395#
    1164                 :         34 : bool SwGrfNode::IsAsyncRetrieveInputStreamPossible() const
    1165                 :            : {
    1166                 :         34 :     bool bRet = false;
    1167                 :            : 
    1168         [ +  - ]:         34 :     if ( IsLinkedFile() )
    1169                 :            :     {
    1170         [ +  - ]:         34 :         String sGrfNm;
    1171 [ +  - ][ +  - ]:         34 :         refLink->GetLinkManager()->GetDisplayNames( refLink, 0, &sGrfNm, 0, 0 );
    1172         [ +  - ]:         34 :         String sProtocol( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.pkg:" ) );
    1173 [ +  - ][ +  - ]:         34 :         if ( sGrfNm.CompareTo( sProtocol, sProtocol.Len() ) != 0 )
    1174                 :            :         {
    1175                 :         34 :             bRet = true;
    1176 [ +  - ][ +  - ]:         34 :         }
    1177                 :            :     }
    1178                 :            : 
    1179                 :         34 :     return bRet;
    1180                 :            : }
    1181                 :            : 
    1182                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10