LCOV - code coverage report
Current view: top level - libreoffice/sw/source/filter/ww8 - ww8par4.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 51 227 22.5 %
Date: 2012-12-27 Functions: 5 14 35.7 %
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             : 
      24             : #include <algorithm>
      25             : #include <functional>
      26             : #include <osl/endian.h>
      27             : #include <sot/storage.hxx>
      28             : #include <com/sun/star/drawing/XShape.hpp>
      29             : #include <hintids.hxx>
      30             : #include <svx/svdoole2.hxx>
      31             : #include <filter/msfilter/msdffimp.hxx>
      32             : #include <svx/unoapi.hxx>
      33             : 
      34             : #include <sot/exchange.hxx>
      35             : #include <swtypes.hxx>
      36             : #include <fmtanchr.hxx>
      37             : #include <fmtcntnt.hxx>
      38             : #include <dcontact.hxx>
      39             : #include <frmfmt.hxx>
      40             : #include <pam.hxx>
      41             : #include <ndgrf.hxx>
      42             : #include <docsh.hxx>            // fuer Ole-Node
      43             : #include <mdiexp.hxx>           // Progress
      44             : #include <redline.hxx>
      45             : #include <fltshell.hxx>
      46             : #include <unodraw.hxx>
      47             : #include <shellio.hxx>
      48             : #include <ndole.hxx>
      49             : 
      50             : #include <svtools/filter.hxx>
      51             : 
      52             : #include "ww8scan.hxx"
      53             : #include "ww8par.hxx"
      54             : #include "ww8par2.hxx"          // WWFlyPara::BoxUpWidth()
      55             : 
      56             : struct OLE_MFP
      57             : {
      58             :     sal_Int16 mm;       // 0x6  int
      59             :     sal_Int16 xExt;     // 0x8  int in 1/100 mm
      60             :     sal_Int16 yExt;     // 0xa  int in 1/100 mm
      61             :     sal_Int16 hMF;      // 0xc  int
      62             : };
      63             : 
      64             : using namespace ::com::sun::star;
      65             : 
      66           0 : static bool SwWw8ReadScaling(long& rX, long& rY, SvStorageRef& rSrc1)
      67             : {
      68             :     // Skalierungsfaktoren holen:
      69             :     //      Informationen in PIC-Stream ( durch ausprobieren )
      70             :     //      0x0  (l)cb
      71             :     //      0x08 .. 0x0a Flags ??
      72             :     //      0x08 Inh: 1 / 0
      73             :     //      0x09 Inh: 0,8,0x18
      74             :     //      0x0a Inh: immer 8, MAP_ANISOTROPIC ???
      75             :     //      0x0b Inh: immer 0
      76             :     //      0x0c, 0x10 Originalgroesse x,y in 1/100 mm
      77             :     //      0x14, 0x16 Originalgroesse x,y in tw
      78             :     //      0x2c, 0x30 Skalierung x,y in Promille
      79             :     //      0x34, 0x38, 0x3c, 0x40 Crop Left, Top, Right, Bot in tw
      80             : 
      81             :     SvStorageStreamRef xSrc3 = rSrc1->OpenSotStream( rtl::OUString("\3PIC"),
      82           0 :         STREAM_STD_READ | STREAM_NOCREATE);
      83           0 :     SvStorageStream* pS = xSrc3;
      84           0 :     pS->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
      85           0 :     pS->Seek( STREAM_SEEK_TO_END );
      86             : 
      87             :     OSL_ENSURE( pS->Tell() >=  76, "+OLE-PIC-Stream is shorter than 76 Byte" );
      88             : 
      89             :     sal_Int32 nOrgWidth,
      90             :           nOrgHeight,
      91             :           nScaleX,
      92             :           nScaleY,
      93             :           nCropLeft,
      94             :           nCropTop,
      95             :           nCropRight,
      96             :           nCropBottom;
      97           0 :     pS->Seek( 0x14 );
      98           0 :     *pS >> nOrgWidth    // Original Size in 1/100 mm
      99           0 :         >> nOrgHeight;
     100           0 :     pS->Seek( 0x2c );
     101           0 :     *pS >> nScaleX      // Scaling in Promille
     102           0 :         >> nScaleY
     103           0 :         >> nCropLeft    // Cropping in 1/100 mm
     104           0 :         >> nCropTop
     105           0 :         >> nCropRight
     106           0 :         >> nCropBottom;
     107             : 
     108           0 :     rX = nOrgWidth  - nCropLeft - nCropRight;
     109           0 :     rY = nOrgHeight - nCropTop  - nCropBottom;
     110           0 :     if (10 > nScaleX || 65536 < nScaleX || 10 > nScaleY || 65536 < nScaleY)
     111             :     {
     112             :         OSL_ENSURE( !pS, "+OLE-Scalinginformation in PIC-Stream wrong" );
     113           0 :         return false;
     114             :     }
     115             :     else
     116             :     {
     117           0 :         rX = (rX * nScaleX) / 1000;
     118           0 :         rY = (rY * nScaleY) / 1000;
     119             :     }
     120           0 :     return true;
     121             : }
     122             : 
     123           0 : static bool SwWw6ReadMetaStream(GDIMetaFile& rWMF, OLE_MFP* pMfp,
     124             :     SvStorageRef& rSrc1)
     125             : {
     126             :     SvStorageStreamRef xSrc2 = rSrc1->OpenSotStream( rtl::OUString("\3META"),
     127           0 :         STREAM_STD_READ | STREAM_NOCREATE);
     128           0 :     SvStorageStream* pSt = xSrc2;
     129           0 :     pSt->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
     130           0 :     sal_uLong nRead = pSt->Read( pMfp, sizeof(*pMfp ) );
     131             :                                 // Mini-Placable-Header lesen
     132           0 :     if (nRead != sizeof(*pMfp))
     133           0 :         return false;
     134             : 
     135             : #if defined  OSL_BIGENDIAN
     136             :     pMfp->mm = OSL_SWAPWORD( pMfp->mm );
     137             :     pMfp->xExt = OSL_SWAPWORD( pMfp->xExt );
     138             :     pMfp->yExt = OSL_SWAPWORD( pMfp->yExt );
     139             : #endif // OSL_BIGENDIAN
     140             : 
     141           0 :     if( pMfp->mm == 94 || pMfp->mm == 99 )
     142             :     {
     143             :         OSL_ENSURE( !pSt, "+OLE: Falscher Metafile-Typ" );
     144           0 :         return false;
     145             :     }
     146           0 :     if( pMfp->mm != 8 )
     147             :     {
     148             :         OSL_ENSURE( !pSt, "+OLE: Falscher Metafile-Typ ( nicht Anisotropic )" );
     149             :     }
     150           0 :     if( !pMfp->xExt || !pMfp->yExt )
     151             :     {
     152             :         OSL_ENSURE( !pSt, "+OLE: Groesse von 0 ???" );
     153           0 :         return false;
     154             :     }
     155           0 :     bool bOk = ReadWindowMetafile( *pSt, rWMF, NULL ) ? true : false;   // WMF lesen
     156             :                     // *pSt >> aWMF  geht nicht ohne placable Header
     157           0 :     if (!bOk || pSt->GetError() || rWMF.GetActionSize() == 0)
     158             :     {
     159             :         OSL_ENSURE( !pSt, "+OLE: Konnte Metafile nicht lesen" );
     160           0 :         return false;
     161             :     }
     162             : 
     163           0 :     rWMF.SetPrefMapMode( MapMode( MAP_100TH_MM ) );
     164             : 
     165             : 
     166             :     // MetaFile auf neue Groesse skalieren und
     167             :     // neue Groesse am MetaFile setzen
     168           0 :     Size        aOldSiz( rWMF.GetPrefSize() );
     169           0 :     Size        aNewSiz( pMfp->xExt, pMfp->yExt );
     170           0 :     Fraction    aFracX( aNewSiz.Width(), aOldSiz.Width() );
     171           0 :     Fraction    aFracY( aNewSiz.Height(), aOldSiz.Height() );
     172             : 
     173           0 :     rWMF.Scale( aFracX, aFracY );
     174           0 :     rWMF.SetPrefSize( aNewSiz );
     175             : 
     176           0 :     return true;
     177             : }
     178             : 
     179           0 : static bool SwWw6ReadMacPICTStream(Graphic& rGraph, SvStorageRef& rSrc1)
     180             : {
     181             :     // 03-META-Stream nicht da. Vielleicht ein 03-PICT ?
     182           0 :     SvStorageStreamRef xSrc4 = rSrc1->OpenSotStream(rtl::OUString("\3PICT"));
     183           0 :     SvStorageStream* pStp = xSrc4;
     184           0 :     pStp->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
     185             :     sal_uInt8 aTestA[10];        // Ist der 01Ole-Stream ueberhaupt vorhanden
     186           0 :     sal_uLong nReadTst = pStp->Read( aTestA, sizeof( aTestA ) );
     187           0 :     if (nReadTst != sizeof(aTestA))
     188           0 :         return false;
     189             : 
     190           0 :     pStp->Seek( STREAM_SEEK_TO_BEGIN );
     191             : 
     192             :     // Mac-Pict steht im 03PICT-StorageStream allerdings ohne die ersten 512
     193             :     // Bytes, die bei einem MAC-PICT egal sind ( werden nicht ausgewertet )
     194           0 :     return SwWW8ImplReader::GetPictGrafFromStream(rGraph, *pStp);
     195             : }
     196             : 
     197           0 : SwFlyFrmFmt* SwWW8ImplReader::InsertOle(SdrOle2Obj &rObject,
     198             :     const SfxItemSet &rFlySet, const SfxItemSet &rGrfSet)
     199             : {
     200           0 :     SfxObjectShell *pPersist = rDoc.GetPersist();
     201             :     OSL_ENSURE(pPersist, "No persist, cannot insert objects correctly");
     202           0 :     if (!pPersist)
     203           0 :         return 0;
     204             : 
     205           0 :     SwFlyFrmFmt *pRet = 0;
     206             : 
     207           0 :     SfxItemSet *pMathFlySet = 0;
     208           0 :     uno::Reference < embed::XClassifiedObject > xClass( rObject.GetObjRef(), uno::UNO_QUERY );
     209           0 :     if( xClass.is() )
     210             :     {
     211           0 :         SvGlobalName aClassName( xClass->getClassID() );
     212           0 :         if (SotExchange::IsMath(aClassName))
     213             :         {
     214             :             /*
     215             :             StarMath sets it own fixed size, so its counter productive to use the
     216             :             size word says it is. i.e. Don't attempt to override its size.
     217             :             */
     218           0 :             pMathFlySet = new SfxItemSet(rFlySet);
     219           0 :             pMathFlySet->ClearItem(RES_FRM_SIZE);
     220           0 :         }
     221             :     }
     222             : 
     223             :     /*
     224             :     Take complete responsibility of the object away from SdrOle2Obj and to
     225             :     me here locally. This utility class now owns the object.
     226             :     */
     227             : 
     228             :     // TODO/MBA: is the object inserted multiple times here? Testing!
     229             :     // And is it a problem that we now use the same naming scheme as in the other apps?
     230           0 :     sw::hack::DrawingOLEAdaptor aOLEObj(rObject, *pPersist);
     231           0 :     ::rtl::OUString sNewName;
     232           0 :     bool bSuccess = aOLEObj.TransferToDoc(sNewName);
     233             : 
     234             :     OSL_ENSURE(bSuccess, "Insert OLE failed");
     235           0 :     if (bSuccess)
     236             :     {
     237           0 :         const SfxItemSet *pFlySet = pMathFlySet ? pMathFlySet : &rFlySet;
     238           0 :         pRet = rDoc.InsertOLE(*pPaM, sNewName, rObject.GetAspect(), pFlySet, &rGrfSet, 0);
     239             :     }
     240           0 :     delete pMathFlySet;
     241           0 :     return pRet;
     242             : }
     243             : 
     244           4 : SwFrmFmt* SwWW8ImplReader::ImportOle(const Graphic* pGrf,
     245             :     const SfxItemSet* pFlySet, const SfxItemSet *pGrfSet, const Rectangle& aVisArea )
     246             : {
     247           4 :     ::SetProgressState(nProgress, mpDocShell);     // Update
     248           4 :     SwFrmFmt* pFmt = 0;
     249             : 
     250           4 :     GrafikCtor();
     251             : 
     252           4 :     Graphic aGraph;
     253           4 :     SdrObject* pRet = ImportOleBase(aGraph, pGrf, pFlySet, aVisArea );
     254             : 
     255             :     // create flyset
     256           4 :     SfxItemSet* pTempSet = 0;
     257           4 :     if( !pFlySet )
     258             :     {
     259           0 :         pTempSet = new SfxItemSet( rDoc.GetAttrPool(), RES_FRMATR_BEGIN,
     260           0 :             RES_FRMATR_END-1);
     261             : 
     262           0 :         pFlySet = pTempSet;
     263             : 
     264             :         // Abstand/Umrandung raus
     265           0 :         if (!mbNewDoc)
     266           0 :             Reader::ResetFrmFmtAttrs( *pTempSet );
     267             : 
     268           0 :         SwFmtAnchor aAnchor( FLY_AS_CHAR );
     269           0 :         aAnchor.SetAnchor( pPaM->GetPoint() );
     270           0 :         pTempSet->Put( aAnchor );
     271             : 
     272             :         const Size aSizeTwip = OutputDevice::LogicToLogic(
     273           0 :             aGraph.GetPrefSize(), aGraph.GetPrefMapMode(), MAP_TWIP );
     274             : 
     275             :         pTempSet->Put( SwFmtFrmSize( ATT_FIX_SIZE, aSizeTwip.Width(),
     276           0 :             aSizeTwip.Height() ) );
     277           0 :         pTempSet->Put( SwFmtVertOrient( 0, text::VertOrientation::TOP, text::RelOrientation::FRAME ));
     278             : 
     279           0 :         if( pSFlyPara )
     280             :         {
     281             :             // OLE im Rahmen ?  ok, Rahmen auf Bildgroesse vergroessern (
     282             :             // nur wenn Auto-Breite )
     283           0 :             pSFlyPara->BoxUpWidth( aSizeTwip.Width() );
     284           0 :         }
     285             :     }
     286             : 
     287           4 :     if (pRet)       // Ole-Object wurde eingefuegt
     288             :     {
     289           0 :         if (pRet->ISA(SdrOle2Obj))
     290             :         {
     291           0 :             pFmt = InsertOle(*((SdrOle2Obj*)pRet), *pFlySet, *pGrfSet);
     292           0 :             SdrObject::Free( pRet );        // das brauchen wir nicht mehr
     293             :         }
     294             :         else
     295           0 :             pFmt = rDoc.Insert(*pPaM, *pRet, pFlySet, NULL);
     296             :     }
     297           8 :     else if (
     298           4 :                 GRAPHIC_GDIMETAFILE == aGraph.GetType() ||
     299           4 :                 GRAPHIC_BITMAP == aGraph.GetType()
     300             :             )
     301             :     {
     302             :         pFmt = rDoc.Insert(*pPaM, aEmptyStr, aEmptyStr, &aGraph, pFlySet,
     303           0 :             pGrfSet, NULL);
     304             :     }
     305           4 :     delete pTempSet;
     306           4 :     return pFmt;
     307             : }
     308             : 
     309           0 : bool SwWW8ImplReader::ImportOleWMF(SvStorageRef xSrc1,GDIMetaFile &rWMF,
     310             :     long &rX,long &rY)
     311             : {
     312           0 :     bool bOk = false;
     313             :     OLE_MFP aMfp;
     314           0 :     if( SwWw6ReadMetaStream( rWMF, &aMfp, xSrc1 ) )
     315             :     {
     316             :         /*
     317             :         take scaling factor as found in PIC and apply it to graphic.
     318             :         */
     319           0 :         SwWw8ReadScaling( rX, rY, xSrc1 );
     320           0 :         Size aFinalSize, aOrigSize;
     321           0 :         aFinalSize.Width() = rX;
     322           0 :         aFinalSize.Height() = rY;
     323             :         aFinalSize = OutputDevice::LogicToLogic(
     324           0 :             aFinalSize, MAP_TWIP, rWMF.GetPrefMapMode() );
     325           0 :         aOrigSize = rWMF.GetPrefSize();
     326           0 :         Fraction aScaleX(aFinalSize.Width(),aOrigSize.Width());
     327           0 :         Fraction aScaleY(aFinalSize.Height(),aOrigSize.Height());
     328           0 :         rWMF.Scale( aScaleX, aScaleY );
     329           0 :         bOk = true;
     330             :     }
     331           0 :     return bOk;
     332             : }
     333             : 
     334           4 : SdrObject* SwWW8ImplReader::ImportOleBase( Graphic& rGraph,
     335             :     const Graphic* pGrf, const SfxItemSet* pFlySet, const Rectangle& aVisArea )
     336             : {
     337           4 :     SdrObject* pRet = 0;
     338             :     OSL_ENSURE( pStg, "ohne storage geht hier fast gar nichts!" );
     339             : 
     340           4 :     ::SetProgressState( nProgress, rDoc.GetDocShell() );     // Update
     341             : 
     342           4 :     long nX=0, nY=0;                // nX, nY is graphic size
     343           4 :     bool bOleOk = true;
     344             : 
     345           4 :     String aSrcStgName = rtl::OUString('_');
     346             :     // ergibt Name "_4711"
     347           4 :     aSrcStgName += String::CreateFromInt32( nObjLocFc );
     348             : 
     349           4 :     SvStorageRef xSrc0 = pStg->OpenSotStorage(rtl::OUString(SL::aObjectPool));
     350             :     SvStorageRef xSrc1 = xSrc0->OpenSotStorage( aSrcStgName,
     351           4 :             STREAM_READWRITE| STREAM_SHARE_DENYALL );
     352             : 
     353             : 
     354           4 :     if (pGrf)
     355             :     {
     356           4 :         rGraph = *pGrf;
     357             :         const Size aSizeTwip = OutputDevice::LogicToLogic(
     358           4 :             rGraph.GetPrefSize(), rGraph.GetPrefMapMode(), MAP_TWIP );
     359           4 :         nX = aSizeTwip.Width();
     360           4 :         nY = aSizeTwip.Height();
     361             :     }
     362             :     else
     363             :     {
     364           0 :         GDIMetaFile aWMF;
     365             : 
     366           0 :         if (ImportOleWMF(xSrc1,aWMF,nX,nY))
     367           0 :             rGraph = Graphic( aWMF );
     368           0 :         else if( SwWw6ReadMacPICTStream( rGraph, xSrc1 ) )
     369             :         {
     370             :             // 03-META-Stream nicht da. Vielleicht ein 03-PICT ?
     371             :             const Size aSizeTwip = OutputDevice::LogicToLogic(
     372           0 :                 rGraph.GetPrefSize(), rGraph.GetPrefMapMode(), MAP_TWIP );
     373           0 :             nX = aSizeTwip.Width();
     374           0 :             nY = aSizeTwip.Height();
     375             :             // PICT: kein WMF da -> Grafik statt OLE
     376           0 :             bOleOk = false;
     377           0 :         }
     378             :     }       // StorageStreams wieder zu
     379             : 
     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           8 :     if (GRAPHIC_GDIMETAFILE == rGraph.GetType() ||
     408           4 :         GRAPHIC_BITMAP == rGraph.GetType())
     409             :     {
     410           0 :         ::SetProgressState(nProgress, mpDocShell);     // Update
     411             : 
     412           0 :         if (bOleOk)
     413             :         {
     414           0 :             sal_uLong nOldPos = pDataStream->Tell();
     415           0 :             pDataStream->Seek(STREAM_SEEK_TO_END);
     416           0 :             SvStream *pTmpData = 0;
     417           0 :             if (nObjLocFc < pDataStream->Tell())
     418             :             {
     419           0 :                 pTmpData = pDataStream;
     420           0 :                 pTmpData->Seek( nObjLocFc );
     421             :             }
     422             : 
     423           0 :             sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT;
     424             : 
     425             :             {
     426             :                 SvStorageStreamRef xObjInfoSrc = xSrc1->OpenSotStream(rtl::OUString("\3ObjInfo"),
     427           0 :                     STREAM_STD_READ | STREAM_NOCREATE );
     428           0 :                 if ( xObjInfoSrc.Is() && !xObjInfoSrc->GetError() )
     429             :                 {
     430           0 :                     sal_uInt8 nByte = 0;
     431           0 :                     *xObjInfoSrc >> nByte;
     432           0 :                     if ( ( nByte >> 4 ) & embed::Aspects::MSOLE_ICON )
     433           0 :                         nAspect = embed::Aspects::MSOLE_ICON;
     434           0 :                 }
     435             :             }
     436             : 
     437           0 :             ErrCode nError = ERRCODE_NONE;
     438             :             pRet = SvxMSDffManager::CreateSdrOLEFromStorage(
     439             :                 aSrcStgName, xSrc0, mpDocShell->GetStorage(), rGraph, aRect, aVisArea, pTmpData, nError,
     440           0 :                 SwMSDffManager::GetFilterFlags(), nAspect );
     441           0 :             pDataStream->Seek( nOldPos );
     442             :         }
     443             :     }
     444           4 :     return pRet;
     445             : }
     446             : 
     447          26 : void SwWW8ImplReader::ReadRevMarkAuthorStrTabl( SvStream& rStrm,
     448             :     sal_Int32 nTblPos, sal_Int32 nTblSiz, SwDoc& rDocOut )
     449             : {
     450          26 :     ::std::vector<String> aAuthorNames;
     451          26 :     WW8ReadSTTBF( !bVer67, rStrm, nTblPos, nTblSiz, bVer67 ? 2 : 0,
     452          52 :         eStructCharSet, aAuthorNames );
     453             : 
     454          26 :     sal_uInt16 nCount = static_cast< sal_uInt16 >(aAuthorNames.size());
     455       16691 :     for( sal_uInt16 nAuthor = 0; nAuthor < nCount; ++nAuthor )
     456             :     {
     457             :         // Store author in doc
     458       16665 :         sal_uInt16 nSWId = rDocOut.InsertRedlineAuthor(aAuthorNames[nAuthor]);
     459             :         // Store matchpair
     460       16665 :         m_aAuthorInfos[nAuthor] = nSWId;
     461          26 :     }
     462          26 : }
     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" varient 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 : 0x6864, 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 formating)
     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          18 : }
     544             : 
     545             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10