LCOV - code coverage report
Current view: top level - sw/source/filter/ww8 - ww8par4.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 90 227 39.6 %
Date: 2014-04-11 Functions: 6 14 42.9 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <doc.hxx>
      21             : #include "writerhelper.hxx"
      22             : #include <com/sun/star/embed/XClassifiedObject.hpp>
      23             : #include <com/sun/star/embed/Aspects.hpp>
      24             : 
      25             : #include <algorithm>
      26             : #include <functional>
      27             : #include <osl/endian.h>
      28             : #include <sot/storage.hxx>
      29             : #include <com/sun/star/drawing/XShape.hpp>
      30             : #include <hintids.hxx>
      31             : #include <svx/svdoole2.hxx>
      32             : #include <filter/msfilter/msdffimp.hxx>
      33             : #include <filter/msfilter/sprmids.hxx>
      34             : #include <svx/unoapi.hxx>
      35             : 
      36             : #include <sot/exchange.hxx>
      37             : #include <swtypes.hxx>
      38             : #include <fmtanchr.hxx>
      39             : #include <fmtcntnt.hxx>
      40             : #include <dcontact.hxx>
      41             : #include <frmfmt.hxx>
      42             : #include <pam.hxx>
      43             : #include <ndgrf.hxx>
      44             : #include <docsh.hxx>
      45             : #include <mdiexp.hxx>
      46             : #include <redline.hxx>
      47             : #include <fltshell.hxx>
      48             : #include <unodraw.hxx>
      49             : #include <shellio.hxx>
      50             : #include <ndole.hxx>
      51             : 
      52             : #include <vcl/graphicfilter.hxx>
      53             : #include <vcl/wmf.hxx>
      54             : 
      55             : #include "ww8scan.hxx"
      56             : #include "ww8par.hxx"
      57             : #include "ww8par2.hxx"
      58             : 
      59             : struct OLE_MFP
      60             : {
      61             :     sal_Int16 mm;       // 0x6  int
      62             :     sal_Int16 xExt;     // 0x8  int in 1/100 mm
      63             :     sal_Int16 yExt;     // 0xa  int in 1/100 mm
      64             :     sal_Int16 hMF;      // 0xc  int
      65             : };
      66             : 
      67             : using namespace ::com::sun::star;
      68             : 
      69           0 : static bool SwWw8ReadScaling(long& rX, long& rY, SvStorageRef& rSrc1)
      70             : {
      71             :     // Skalierungsfaktoren holen:
      72             :     //      Informationen in PIC-Stream ( durch ausprobieren )
      73             :     //      0x0  (l)cb
      74             :     //      0x08 .. 0x0a Flags ??
      75             :     //      0x08 Inh: 1 / 0
      76             :     //      0x09 Inh: 0,8,0x18
      77             :     //      0x0a Inh: immer 8, MAP_ANISOTROPIC ???
      78             :     //      0x0b Inh: immer 0
      79             :     //      0x0c, 0x10 Originalgroesse x,y in 1/100 mm
      80             :     //      0x14, 0x16 Originalgroesse x,y in tw
      81             :     //      0x2c, 0x30 Skalierung x,y in Promille
      82             :     //      0x34, 0x38, 0x3c, 0x40 Crop Left, Top, Right, Bot in tw
      83             : 
      84             :     SvStorageStreamRef xSrc3 = rSrc1->OpenSotStream( OUString("\3PIC"),
      85           0 :         STREAM_STD_READ | STREAM_NOCREATE);
      86           0 :     SvStorageStream* pS = xSrc3;
      87           0 :     pS->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
      88           0 :     pS->Seek( STREAM_SEEK_TO_END );
      89             : 
      90             :     OSL_ENSURE( pS->Tell() >=  76, "+OLE-PIC-Stream is shorter than 76 Byte" );
      91             : 
      92             :     sal_Int32 nOrgWidth,
      93             :           nOrgHeight,
      94             :           nScaleX,
      95             :           nScaleY,
      96             :           nCropLeft,
      97             :           nCropTop,
      98             :           nCropRight,
      99             :           nCropBottom;
     100           0 :     pS->Seek( 0x14 );
     101           0 :     pS->ReadInt32( nOrgWidth )    // Original Size in 1/100 mm
     102           0 :        .ReadInt32( nOrgHeight );
     103           0 :     pS->Seek( 0x2c );
     104           0 :     pS->ReadInt32( nScaleX )      // Scaling in Promille
     105           0 :        .ReadInt32( nScaleY )
     106           0 :        .ReadInt32( nCropLeft )    // Cropping in 1/100 mm
     107           0 :        .ReadInt32( nCropTop )
     108           0 :        .ReadInt32( nCropRight )
     109           0 :        .ReadInt32( nCropBottom );
     110             : 
     111           0 :     rX = nOrgWidth  - nCropLeft - nCropRight;
     112           0 :     rY = nOrgHeight - nCropTop  - nCropBottom;
     113           0 :     if (10 > nScaleX || 65536 < nScaleX || 10 > nScaleY || 65536 < nScaleY)
     114             :     {
     115             :         OSL_ENSURE( !pS, "+OLE-Scalinginformation in PIC-Stream wrong" );
     116           0 :         return false;
     117             :     }
     118             :     else
     119             :     {
     120           0 :         rX = (rX * nScaleX) / 1000;
     121           0 :         rY = (rY * nScaleY) / 1000;
     122             :     }
     123           0 :     return true;
     124             : }
     125             : 
     126           0 : static bool SwWw6ReadMetaStream(GDIMetaFile& rWMF, OLE_MFP* pMfp,
     127             :     SvStorageRef& rSrc1)
     128             : {
     129             :     SvStorageStreamRef xSrc2 = rSrc1->OpenSotStream( OUString("\3META"),
     130           0 :         STREAM_STD_READ | STREAM_NOCREATE);
     131           0 :     SvStorageStream* pSt = xSrc2;
     132           0 :     pSt->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
     133           0 :     sal_uLong nRead = pSt->Read( pMfp, sizeof(*pMfp ) );
     134             :                                 // Mini-Placable-Header lesen
     135           0 :     if (nRead != sizeof(*pMfp))
     136           0 :         return false;
     137             : 
     138             : #if defined  OSL_BIGENDIAN
     139             :     pMfp->mm = OSL_SWAPWORD( pMfp->mm );
     140             :     pMfp->xExt = OSL_SWAPWORD( pMfp->xExt );
     141             :     pMfp->yExt = OSL_SWAPWORD( pMfp->yExt );
     142             : #endif // OSL_BIGENDIAN
     143             : 
     144           0 :     if( pMfp->mm == 94 || pMfp->mm == 99 )
     145             :     {
     146             :         OSL_ENSURE( !pSt, "+OLE: Falscher Metafile-Typ" );
     147           0 :         return false;
     148             :     }
     149           0 :     if( pMfp->mm != 8 )
     150             :     {
     151             :         OSL_ENSURE( !pSt, "+OLE: Falscher Metafile-Typ ( nicht Anisotropic )" );
     152             :     }
     153           0 :     if( !pMfp->xExt || !pMfp->yExt )
     154             :     {
     155             :         OSL_ENSURE( !pSt, "+OLE: Groesse von 0 ???" );
     156           0 :         return false;
     157             :     }
     158           0 :     bool bOk = ReadWindowMetafile( *pSt, rWMF, NULL ) ? true : false;   // WMF lesen
     159             :                     // *pSt >> aWMF  geht nicht ohne placable Header
     160           0 :     if (!bOk || pSt->GetError() || rWMF.GetActionSize() == 0)
     161             :     {
     162             :         OSL_ENSURE( !pSt, "+OLE: Konnte Metafile nicht lesen" );
     163           0 :         return false;
     164             :     }
     165             : 
     166           0 :     rWMF.SetPrefMapMode( MapMode( MAP_100TH_MM ) );
     167             : 
     168             :     // MetaFile auf neue Groesse skalieren und
     169             :     // neue Groesse am MetaFile setzen
     170           0 :     Size        aOldSiz( rWMF.GetPrefSize() );
     171           0 :     Size        aNewSiz( pMfp->xExt, pMfp->yExt );
     172           0 :     Fraction    aFracX( aNewSiz.Width(), aOldSiz.Width() );
     173           0 :     Fraction    aFracY( aNewSiz.Height(), aOldSiz.Height() );
     174             : 
     175           0 :     rWMF.Scale( aFracX, aFracY );
     176           0 :     rWMF.SetPrefSize( aNewSiz );
     177             : 
     178           0 :     return true;
     179             : }
     180             : 
     181           0 : static bool SwWw6ReadMacPICTStream(Graphic& rGraph, SvStorageRef& rSrc1)
     182             : {
     183             :     // 03-META-Stream nicht da. Vielleicht ein 03-PICT ?
     184           0 :     SvStorageStreamRef xSrc4 = rSrc1->OpenSotStream(OUString("\3PICT"));
     185           0 :     SvStorageStream* pStp = xSrc4;
     186           0 :     pStp->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
     187             :     sal_uInt8 aTestA[10];        // Ist der 01Ole-Stream ueberhaupt vorhanden
     188           0 :     sal_uLong nReadTst = pStp->Read( aTestA, sizeof( aTestA ) );
     189           0 :     if (nReadTst != sizeof(aTestA))
     190           0 :         return false;
     191             : 
     192           0 :     pStp->Seek( STREAM_SEEK_TO_BEGIN );
     193             : 
     194             :     // Mac-Pict steht im 03PICT-StorageStream allerdings ohne die ersten 512
     195             :     // Bytes, die bei einem MAC-PICT egal sind ( werden nicht ausgewertet )
     196           0 :     return SwWW8ImplReader::GetPictGrafFromStream(rGraph, *pStp);
     197             : }
     198             : 
     199          14 : SwFlyFrmFmt* SwWW8ImplReader::InsertOle(SdrOle2Obj &rObject,
     200             :     const SfxItemSet &rFlySet, const SfxItemSet &rGrfSet)
     201             : {
     202          14 :     SfxObjectShell *pPersist = rDoc.GetPersist();
     203             :     OSL_ENSURE(pPersist, "No persist, cannot insert objects correctly");
     204          14 :     if (!pPersist)
     205           0 :         return 0;
     206             : 
     207          14 :     SwFlyFrmFmt *pRet = 0;
     208             : 
     209          14 :     SfxItemSet *pMathFlySet = 0;
     210          14 :     uno::Reference < embed::XClassifiedObject > xClass( rObject.GetObjRef(), uno::UNO_QUERY );
     211          14 :     if( xClass.is() )
     212             :     {
     213          14 :         SvGlobalName aClassName( xClass->getClassID() );
     214          14 :         if (SotExchange::IsMath(aClassName))
     215             :         {
     216             :             /*
     217             :             StarMath sets it own fixed size, so its counter productive to use the
     218             :             size word says it is. i.e. Don't attempt to override its size.
     219             :             */
     220          10 :             pMathFlySet = new SfxItemSet(rFlySet);
     221          10 :             pMathFlySet->ClearItem(RES_FRM_SIZE);
     222          14 :         }
     223             :     }
     224             : 
     225             :     /*
     226             :     Take complete responsibility of the object away from SdrOle2Obj and to
     227             :     me here locally. This utility class now owns the object.
     228             :     */
     229             : 
     230             :     // TODO/MBA: is the object inserted multiple times here? Testing!
     231             :     // And is it a problem that we now use the same naming scheme as in the other apps?
     232          28 :     sw::hack::DrawingOLEAdaptor aOLEObj(rObject, *pPersist);
     233          28 :     OUString sNewName;
     234          14 :     bool bSuccess = aOLEObj.TransferToDoc(sNewName);
     235             : 
     236             :     OSL_ENSURE(bSuccess, "Insert OLE failed");
     237          14 :     if (bSuccess)
     238             :     {
     239          14 :         const SfxItemSet *pFlySet = pMathFlySet ? pMathFlySet : &rFlySet;
     240          14 :         pRet = rDoc.InsertOLE(*pPaM, sNewName, rObject.GetAspect(), pFlySet, &rGrfSet, 0);
     241             :     }
     242          14 :     delete pMathFlySet;
     243          28 :     return pRet;
     244             : }
     245             : 
     246           4 : SwFrmFmt* SwWW8ImplReader::ImportOle(const Graphic* pGrf,
     247             :     const SfxItemSet* pFlySet, const SfxItemSet *pGrfSet, const Rectangle& aVisArea )
     248             : {
     249           4 :     ::SetProgressState(nProgress, mpDocShell);     // Update
     250           4 :     SwFrmFmt* pFmt = 0;
     251             : 
     252           4 :     GrafikCtor();
     253             : 
     254           4 :     Graphic aGraph;
     255           4 :     SdrObject* pRet = ImportOleBase(aGraph, pGrf, pFlySet, aVisArea );
     256             : 
     257             :     // create flyset
     258           4 :     SfxItemSet* pTempSet = 0;
     259           4 :     if( !pFlySet )
     260             :     {
     261           0 :         pTempSet = new SfxItemSet( rDoc.GetAttrPool(), RES_FRMATR_BEGIN,
     262           0 :             RES_FRMATR_END-1);
     263             : 
     264           0 :         pFlySet = pTempSet;
     265             : 
     266             :         // Abstand/Umrandung raus
     267           0 :         if (!mbNewDoc)
     268           0 :             Reader::ResetFrmFmtAttrs( *pTempSet );
     269             : 
     270           0 :         SwFmtAnchor aAnchor( FLY_AS_CHAR );
     271           0 :         aAnchor.SetAnchor( pPaM->GetPoint() );
     272           0 :         pTempSet->Put( aAnchor );
     273             : 
     274             :         const Size aSizeTwip = OutputDevice::LogicToLogic(
     275           0 :             aGraph.GetPrefSize(), aGraph.GetPrefMapMode(), MAP_TWIP );
     276             : 
     277             :         pTempSet->Put( SwFmtFrmSize( ATT_FIX_SIZE, aSizeTwip.Width(),
     278           0 :             aSizeTwip.Height() ) );
     279           0 :         pTempSet->Put( SwFmtVertOrient( 0, text::VertOrientation::TOP, text::RelOrientation::FRAME ));
     280             : 
     281           0 :         if( pSFlyPara )
     282             :         {
     283             :             // OLE im Rahmen ?  ok, Rahmen auf Bildgroesse vergroessern (
     284             :             // nur wenn Auto-Breite )
     285           0 :             pSFlyPara->BoxUpWidth( aSizeTwip.Width() );
     286           0 :         }
     287             :     }
     288             : 
     289           4 :     if (pRet)       // Ole-Object wurde eingefuegt
     290             :     {
     291           3 :         if (pRet->ISA(SdrOle2Obj))
     292             :         {
     293           3 :             pFmt = InsertOle(*((SdrOle2Obj*)pRet), *pFlySet, *pGrfSet);
     294           3 :             SdrObject::Free( pRet );        // das brauchen wir nicht mehr
     295             :         }
     296             :         else
     297           0 :             pFmt = rDoc.InsertDrawObj(*pPaM, *pRet, *pFlySet );
     298             :     }
     299           1 :     else if (
     300           1 :                 GRAPHIC_GDIMETAFILE == aGraph.GetType() ||
     301           0 :                 GRAPHIC_BITMAP == aGraph.GetType()
     302             :             )
     303             :     {
     304             :         pFmt = rDoc.Insert(*pPaM, OUString(), OUString(), &aGraph, pFlySet,
     305           1 :             pGrfSet, NULL);
     306             :     }
     307           4 :     delete pTempSet;
     308           4 :     return pFmt;
     309             : }
     310             : 
     311           0 : bool SwWW8ImplReader::ImportOleWMF(SvStorageRef xSrc1,GDIMetaFile &rWMF,
     312             :     long &rX,long &rY)
     313             : {
     314           0 :     bool bOk = false;
     315             :     OLE_MFP aMfp;
     316           0 :     if( SwWw6ReadMetaStream( rWMF, &aMfp, xSrc1 ) )
     317             :     {
     318             :         /*
     319             :         take scaling factor as found in PIC and apply it to graphic.
     320             :         */
     321           0 :         SwWw8ReadScaling( rX, rY, xSrc1 );
     322           0 :         Size aFinalSize, aOrigSize;
     323           0 :         aFinalSize.Width() = rX;
     324           0 :         aFinalSize.Height() = rY;
     325             :         aFinalSize = OutputDevice::LogicToLogic(
     326           0 :             aFinalSize, MAP_TWIP, rWMF.GetPrefMapMode() );
     327           0 :         aOrigSize = rWMF.GetPrefSize();
     328           0 :         Fraction aScaleX(aFinalSize.Width(),aOrigSize.Width());
     329           0 :         Fraction aScaleY(aFinalSize.Height(),aOrigSize.Height());
     330           0 :         rWMF.Scale( aScaleX, aScaleY );
     331           0 :         bOk = true;
     332             :     }
     333           0 :     return bOk;
     334             : }
     335             : 
     336           4 : SdrObject* SwWW8ImplReader::ImportOleBase( Graphic& rGraph,
     337             :     const Graphic* pGrf, const SfxItemSet* pFlySet, const Rectangle& aVisArea )
     338             : {
     339           4 :     SdrObject* pRet = 0;
     340             :     OSL_ENSURE( pStg, "ohne storage geht hier fast gar nichts!" );
     341             : 
     342           4 :     ::SetProgressState( nProgress, rDoc.GetDocShell() );     // Update
     343             : 
     344           4 :     long nX=0, nY=0;                // nX, nY is graphic size
     345           4 :     bool bOleOk = true;
     346             : 
     347           4 :     OUString aSrcStgName('_');
     348             :     // ergibt Name "_4711"
     349           4 :     aSrcStgName += OUString::number( nObjLocFc );
     350             : 
     351           8 :     SvStorageRef xSrc0 = pStg->OpenSotStorage(OUString(SL::aObjectPool));
     352             :     SvStorageRef xSrc1 = xSrc0->OpenSotStorage( aSrcStgName,
     353           8 :             STREAM_READWRITE| STREAM_SHARE_DENYALL );
     354             : 
     355           4 :     if (pGrf)
     356             :     {
     357           4 :         rGraph = *pGrf;
     358             :         const Size aSizeTwip = OutputDevice::LogicToLogic(
     359           4 :             rGraph.GetPrefSize(), rGraph.GetPrefMapMode(), MAP_TWIP );
     360           4 :         nX = aSizeTwip.Width();
     361           4 :         nY = aSizeTwip.Height();
     362             :     }
     363             :     else
     364             :     {
     365           0 :         GDIMetaFile aWMF;
     366             : 
     367           0 :         if (ImportOleWMF(xSrc1,aWMF,nX,nY))
     368           0 :             rGraph = Graphic( aWMF );
     369           0 :         else if( SwWw6ReadMacPICTStream( rGraph, xSrc1 ) )
     370             :         {
     371             :             // 03-META-Stream nicht da. Vielleicht ein 03-PICT ?
     372             :             const Size aSizeTwip = OutputDevice::LogicToLogic(
     373           0 :                 rGraph.GetPrefSize(), rGraph.GetPrefMapMode(), MAP_TWIP );
     374           0 :             nX = aSizeTwip.Width();
     375           0 :             nY = aSizeTwip.Height();
     376             :             // PICT: kein WMF da -> Grafik statt OLE
     377           0 :             bOleOk = false;
     378           0 :         }
     379             :     }       // StorageStreams wieder zu
     380             : 
     381           4 :     Rectangle aRect(0, 0, nX, nY);
     382             : 
     383           4 :     if (pFlySet)
     384             :     {
     385           4 :         if (const SwFmtFrmSize* pSize =
     386           4 :             (const SwFmtFrmSize*)pFlySet->GetItem(RES_FRM_SIZE, false))
     387             :         {
     388           4 :             aRect.SetSize(pSize->GetSize());
     389             :         }
     390             :     }
     391             : 
     392           4 :     if (!(bIsHeader || bIsFooter))
     393             :     {
     394             :         //Can't put them in headers/footers :-(
     395           4 :         uno::Reference< drawing::XShape > xRef;
     396             :         OSL_ENSURE(pFormImpl, "Impossible");
     397           4 :         if (pFormImpl && pFormImpl->ReadOCXStream(xSrc1, &xRef, false))
     398             :         {
     399           0 :             pRet = GetSdrObjectFromXShape(xRef);
     400             :             OSL_ENSURE(pRet, "Impossible");
     401           0 :             if (pRet)
     402           0 :                 pRet->SetLogicRect(aRect);
     403           0 :             return pRet;
     404           4 :         }
     405             :     }
     406             : 
     407           4 :     if (GRAPHIC_GDIMETAFILE == rGraph.GetType() ||
     408           0 :         GRAPHIC_BITMAP == rGraph.GetType())
     409             :     {
     410           4 :         ::SetProgressState(nProgress, mpDocShell);     // Update
     411             : 
     412           4 :         if (bOleOk)
     413             :         {
     414           4 :             sal_uLong nOldPos = pDataStream->Tell();
     415           4 :             pDataStream->Seek(STREAM_SEEK_TO_END);
     416           4 :             SvStream *pTmpData = 0;
     417           4 :             if (nObjLocFc < pDataStream->Tell())
     418             :             {
     419           0 :                 pTmpData = pDataStream;
     420           0 :                 pTmpData->Seek( nObjLocFc );
     421             :             }
     422             : 
     423           4 :             sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT;
     424             : 
     425             :             {
     426             :                 SvStorageStreamRef xObjInfoSrc = xSrc1->OpenSotStream(OUString("\3ObjInfo"),
     427           4 :                     STREAM_STD_READ | STREAM_NOCREATE );
     428           4 :                 if ( xObjInfoSrc.Is() && !xObjInfoSrc->GetError() )
     429             :                 {
     430           4 :                     sal_uInt8 nByte = 0;
     431           4 :                     xObjInfoSrc->ReadUChar( nByte );
     432           4 :                     if ( ( nByte >> 4 ) & embed::Aspects::MSOLE_ICON )
     433           1 :                         nAspect = embed::Aspects::MSOLE_ICON;
     434           4 :                 }
     435             :             }
     436             : 
     437           4 :             ErrCode nError = ERRCODE_NONE;
     438             :             pRet = SvxMSDffManager::CreateSdrOLEFromStorage(
     439             :                 aSrcStgName, xSrc0, mpDocShell->GetStorage(), rGraph, aRect, aVisArea, pTmpData, nError,
     440           4 :                 SwMSDffManager::GetFilterFlags(), nAspect );
     441           4 :             pDataStream->Seek( nOldPos );
     442             :         }
     443             :     }
     444           8 :     return pRet;
     445             : }
     446             : 
     447          45 : void SwWW8ImplReader::ReadRevMarkAuthorStrTabl( SvStream& rStrm,
     448             :     sal_Int32 nTblPos, sal_Int32 nTblSiz, SwDoc& rDocOut )
     449             : {
     450          45 :     ::std::vector<OUString> aAuthorNames;
     451          45 :     WW8ReadSTTBF( !bVer67, rStrm, nTblPos, nTblSiz, bVer67 ? 2 : 0,
     452          90 :         eStructCharSet, aAuthorNames );
     453             : 
     454          45 :     sal_uInt16 nCount = static_cast< sal_uInt16 >(aAuthorNames.size());
     455       16729 :     for( sal_uInt16 nAuthor = 0; nAuthor < nCount; ++nAuthor )
     456             :     {
     457             :         // Store author in doc
     458       16684 :         sal_uInt16 nSWId = rDocOut.InsertRedlineAuthor(aAuthorNames[nAuthor]);
     459             :         // Store matchpair
     460       16684 :         m_aAuthorInfos[nAuthor] = nSWId;
     461          45 :     }
     462          45 : }
     463             : 
     464             : /*
     465             :    Revision Marks ( == Redlining )
     466             : */
     467             : // insert or delete content (change char attributes resp.)
     468           0 : void SwWW8ImplReader::Read_CRevisionMark(RedlineType_t eType,
     469             :     const sal_uInt8* pData, short nLen )
     470             : {
     471             :     // there *must* be a SprmCIbstRMark[Del] and a SprmCDttmRMark[Del]
     472             :     // pointing to the very same char position as our SprmCFRMark[Del]
     473           0 :     if (!pPlcxMan)
     474           0 :         return;
     475             :     const sal_uInt8* pSprmCIbstRMark;
     476             :     const sal_uInt8* pSprmCDttmRMark;
     477           0 :     if( nsRedlineType_t::REDLINE_FORMAT == eType )
     478             :     {
     479           0 :         pSprmCIbstRMark = pData+1;
     480           0 :         pSprmCDttmRMark = pData+3;
     481             :     }
     482             :     else
     483             :     {
     484             :         /*
     485             :          It is possible to have a number of date stamps for the created time
     486             :          of the change, (possibly a word bug) so we must use the "get a full
     487             :          list" variant of HasCharSprm and take the last one as the true one.
     488             :         */
     489           0 :         std::vector<const sal_uInt8 *> aResult;
     490           0 :         bool bIns = (nsRedlineType_t::REDLINE_INSERT == eType);
     491           0 :         if( bVer67 )
     492             :         {
     493           0 :             pPlcxMan->HasCharSprm(69, aResult);
     494           0 :             pSprmCIbstRMark = aResult.empty() ? 0 : aResult.back();
     495           0 :             aResult.clear();
     496           0 :             pPlcxMan->HasCharSprm(70, aResult);
     497           0 :             pSprmCDttmRMark = aResult.empty() ? 0 : aResult.back();
     498             :         }
     499             :         else
     500             :         {
     501           0 :             pPlcxMan->HasCharSprm( bIns ? 0x4804 : 0x4863, aResult);
     502           0 :             pSprmCIbstRMark = aResult.empty() ? 0 : aResult.back();
     503           0 :             aResult.clear();
     504           0 :             pPlcxMan->HasCharSprm( bIns ? 0x6805 : NS_sprm::LN_CDttmRMarkDel, aResult);
     505           0 :             pSprmCDttmRMark = aResult.empty() ? 0 : aResult.back();
     506           0 :         }
     507             :     }
     508             : 
     509           0 :     if (nLen < 0)
     510           0 :         mpRedlineStack->close(*pPaM->GetPoint(), eType, pTableDesc );
     511             :     else
     512             :     {
     513             :         // start of new revision mark, if not there default to first entry
     514           0 :         sal_uInt16 nWWAutNo = pSprmCIbstRMark ? SVBT16ToShort(pSprmCIbstRMark) : 0;
     515           0 :         sal_uInt32 nWWDate = pSprmCDttmRMark ? SVBT32ToUInt32(pSprmCDttmRMark): 0;
     516           0 :         DateTime aStamp(msfilter::util::DTTM2DateTime(nWWDate));
     517           0 :         sal_uInt16 nAuthorNo = m_aAuthorInfos[nWWAutNo];
     518           0 :         SwFltRedline  aNewAttr(eType, nAuthorNo, aStamp);
     519           0 :         NewAttr(aNewAttr);
     520             :     }
     521             : }
     522             : 
     523             : // insert new content
     524           0 : void SwWW8ImplReader::Read_CFRMark(sal_uInt16 , const sal_uInt8* pData, short nLen)
     525             : {
     526           0 :     Read_CRevisionMark( nsRedlineType_t::REDLINE_INSERT, pData, nLen );
     527           0 : }
     528             : 
     529             : // delete old content
     530           0 : void SwWW8ImplReader::Read_CFRMarkDel(sal_uInt16 , const sal_uInt8* pData, short nLen)
     531             : {
     532           0 :     Read_CRevisionMark( nsRedlineType_t::REDLINE_DELETE, pData, nLen );
     533           0 : }
     534             : 
     535             : // change properties of content ( == char formatting)
     536           0 : void SwWW8ImplReader::Read_CPropRMark(sal_uInt16 , const sal_uInt8* pData, short nLen)
     537             : {
     538             :     // complex (len is always 7)
     539             :     // 1 byte  - chp.fPropRMark
     540             :     // 2 bytes - chp.ibstPropRMark
     541             :     // 4 bytes - chp.dttmPropRMark;
     542           0 :     Read_CRevisionMark( nsRedlineType_t::REDLINE_FORMAT, pData, nLen );
     543          33 : }
     544             : 
     545             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10