LCOV - code coverage report
Current view: top level - vcl/source/filter/wmf - wmfwr.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 3 0.0 %
Date: 2014-04-14 Functions: 0 4 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_VCL_SOURCE_FILTER_WMF_WMFWR_HXX
      21             : #define INCLUDED_VCL_SOURCE_FILTER_WMF_WMFWR_HXX
      22             : 
      23             : #include <vcl/metaact.hxx>
      24             : #include <vcl/graph.hxx>
      25             : #include <vcl/gdimtf.hxx>
      26             : #include <vcl/virdev.hxx>
      27             : #include <vcl/fltcall.hxx>
      28             : 
      29             : #define MAXOBJECTHANDLES 16
      30             : 
      31           0 : struct WMFWriterAttrStackMember
      32             : {
      33             :     struct WMFWriterAttrStackMember * pSucc;
      34             :     Color aLineColor;
      35             :     Color aFillColor;
      36             :     Color aTextColor;
      37             :     LineInfo aLineInfo;
      38             :     TextAlign eTextAlign;
      39             :     RasterOp eRasterOp;
      40             :     Font aFont;
      41             :     MapMode aMapMode;
      42             :     Region aClipRegion;
      43             :     sal_uInt16 nFlags;
      44             : };
      45             : 
      46             : class StarSymbolToMSMultiFont;
      47             : class LineInfo;
      48             : namespace basegfx { class B2DPolygon; }
      49             : 
      50           0 : class WMFWriter
      51             : {
      52             : private:
      53             : 
      54             :     bool            bStatus;
      55             : 
      56             :     sal_uLong                   nLastPercent; // with which number pCallback was called last time.
      57             :     FilterConfigItem*       pFilterConfigItem;
      58             : 
      59             :     com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator;
      60             : 
      61             :     SvStream*               pWMF;
      62             :     VirtualDevice*          pVirDev;
      63             :     StarSymbolToMSMultiFont *pConvert;
      64             :     MapMode                 aTargetMapMode;
      65             :     Size                    aTargetSize;
      66             :     sal_uInt16                  nTargetDivisor;
      67             : 
      68             :     sal_uLong nMetafileHeaderPos;
      69             :     sal_uInt32 nMaxRecordSize; // in words
      70             :     sal_uLong nActRecordPos;
      71             : 
      72             :     // actual attribute in source metafile:
      73             :     Color     aSrcLineColor;
      74             :     Color     aSrcFillColor;
      75             :     Color     aSrcTextColor;
      76             :     LineInfo  aSrcLineInfo;
      77             :     RasterOp  eSrcRasterOp;
      78             :     FontAlign eSrcTextAlign;
      79             :     Font      aSrcFont;
      80             :     MapMode   aSrcMapMode;
      81             :     bool      bSrcIsClipping;
      82             :     Region    aSrcClipRegion;
      83             :     WMFWriterAttrStackMember * pAttrStack;
      84             : 
      85             :     sal_uInt32    eSrcHorTextAlign;
      86             : 
      87             :     // actual attribute in destination metafile:
      88             :     Color     aDstLineColor;
      89             :     Color     aDstFillColor;
      90             :     Color     aDstTextColor;
      91             :     LineInfo  aDstLineInfo;
      92             :     RasterOp  eDstROP2;
      93             :     FontAlign eDstTextAlign;
      94             :     Font      aDstFont;
      95             : 
      96             :     sal_uInt32    eDstHorTextAlign;
      97             : 
      98             :     bool      bDstIsClipping; // ???: not taken into account at the moment
      99             :     Region    aDstClipRegion; // ???: not taken into account at the moment
     100             :     bool bHandleAllocated[MAXOBJECTHANDLES];             // which handles have been assigned
     101             :     sal_uInt16 nDstPenHandle,nDstFontHandle,nDstBrushHandle; // which handles are owned by
     102             :                                                          // Selected-Objects
     103             :                                                          // 0xFFFF = none:
     104             : 
     105             :     // to prevent we have to compare all attributes at each operation:
     106             : 
     107             :     sal_uLong nNumberOfActions; // number of actions in the GDIMetafile
     108             :     sal_uLong nNumberOfBitmaps; // number of bitmaps
     109             :     sal_uLong nWrittenActions;  // number of processed actions while writing the directory
     110             :     sal_uLong nWrittenBitmaps;  // number of bitmaps written
     111             :     sal_uLong nActBitmapPercent; // percentage of next bitmap written.
     112             : 
     113             :     bool bEmbedEMF; // optionally embedd EMF data into WMF
     114             : 
     115             :     void MayCallback();
     116             :         // this functions calculates percentage using the above 5 parameters
     117             :         // and triggers a callback if needed. Puts bStatus to FALSE if the
     118             :         // users wants to abort.
     119             : 
     120             :     void CountActionsAndBitmaps(const GDIMetaFile & rMTF);
     121             :         // Counts bitmaps and actions (nNumberOfActions and nNumberOfBitmaps should
     122             :         // be initialised to 0 at start, as this method is recursive)
     123             : 
     124             :     void WritePointXY(const Point & rPoint);
     125             :     void WritePointYX(const Point & rPoint);
     126             :     sal_Int32 ScaleWidth( sal_Int32 nDX );
     127             :     void WriteSize(const Size & rSize);
     128             :     void WriteHeightWidth(const Size & rSize);
     129             :     void WriteRectangle(const Rectangle & rRect);
     130             :     void WriteColor(const Color & rColor);
     131             : 
     132             :     void WriteRecordHeader(sal_uInt32 nSizeWords, sal_uInt16 nType);
     133             :         // nSizeWords is the size of the all records in number of words.
     134             :         // If nSizeWords is unknown, then use 0 (see UpdateRecordHeader())
     135             : 
     136             :     void UpdateRecordHeader();
     137             :         // returns the size of the record after writing the parameters, if
     138             :         // nSizeWords was unknown upon calling WriteRecordHeader(..)
     139             :         // if needed it inserts a BYTE 0 to make number of bytes even
     140             : 
     141             :     void WMFRecord_Arc(const Rectangle & rRect, const Point & rStartPt, const Point & rEndPt);
     142             :     void WMFRecord_Chord(const Rectangle & rRect, const Point & rStartPt, const Point & rEndPt);
     143             :     void WMFRecord_CreateBrushIndirect(const Color& rColor);
     144             :     void WMFRecord_CreateFontIndirect(const Font & rFont);
     145             :     void WMFRecord_CreatePenIndirect(const Color& rColor, const LineInfo& rLineInfo );
     146             :     void WMFRecord_DeleteObject(sal_uInt16 nObjectHandle);
     147             :     void WMFRecord_Ellipse(const Rectangle & rRect);
     148             :     void WMFRecord_Escape( sal_uInt32 nEsc, sal_uInt32 nLen, const sal_Int8* pData );
     149             :     bool WMFRecord_Escape_Unicode( const Point& rPoint, const OUString& rStr, const sal_Int32 * pDXAry );
     150             :     void WMFRecord_ExtTextOut(const Point & rPoint, const OUString & rString, const sal_Int32 * pDXAry);
     151             : 
     152             :     void TrueExtTextOut(const Point & rPoint, const OUString & rString,
     153             :         const OString& rByteString, const sal_Int32 * pDXAry);
     154             :     void TrueTextOut(const Point & rPoint, const OString& rString);
     155             :     void WMFRecord_LineTo(const Point & rPoint);
     156             :     void WMFRecord_MoveTo(const Point & rPoint);
     157             :     void WMFRecord_Pie(const Rectangle & rRect, const Point & rStartPt, const Point & rEndPt);
     158             :     void WMFRecord_Polygon(const Polygon & rPoly);
     159             :     void WMFRecord_PolyLine(const Polygon & rPoly);
     160             :     void WMFRecord_PolyPolygon(const PolyPolygon & rPolyPoly);
     161             :     void WMFRecord_Rectangle(const Rectangle & rRect);
     162             :     void WMFRecord_RestoreDC();
     163             :     void WMFRecord_RoundRect(const Rectangle & rRect, long nHorzRound, long nVertRound);
     164             :     void WMFRecord_SaveDC();
     165             :     void WMFRecord_SelectObject(sal_uInt16 nObjectHandle);
     166             :     void WMFRecord_SetBkMode(bool bTransparent);
     167             :     void WMFRecord_SetStretchBltMode();
     168             :     void WMFRecord_SetPixel(const Point & rPoint, const Color & rColor);
     169             :     void WMFRecord_SetROP2(RasterOp eROP);
     170             :     void WMFRecord_SetTextAlign(FontAlign eFontAlign, sal_uInt32 eHorTextAlign);
     171             :     void WMFRecord_SetTextColor(const Color & rColor);
     172             :     void WMFRecord_SetWindowExt(const Size & rSize);
     173             :     void WMFRecord_SetWindowOrg(const Point & rPoint);
     174             :     void WMFRecord_StretchDIB(const Point & rPoint, const Size & rSize, const Bitmap & rBitmap, sal_uInt32 nROP = 0UL );
     175             :     void WMFRecord_TextOut(const Point & rPoint, const OUString & rString);
     176             :     void WMFRecord_EndOfFile();
     177             :     void WMFRecord_IntersectClipRect( const Rectangle& rRect);
     178             : 
     179             :     sal_uInt16 AllocHandle();
     180             :     void FreeHandle(sal_uInt16 nObjectHandle);
     181             :     void CreateSelectDeletePen( const Color& rColor, const LineInfo& rLineInfo );
     182             :     void CreateSelectDeleteFont(const Font & rFont);
     183             :     void CreateSelectDeleteBrush(const Color& rColor);
     184             : 
     185             :     void SetLineAndFillAttr();
     186             :     void SetAllAttr();
     187             : 
     188             :     void HandleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon);
     189             :     void WriteRecords(const GDIMetaFile & rMTF);
     190             : 
     191             :     void WriteHeader(const GDIMetaFile & rMTF, bool bPlaceable);
     192             :     void UpdateHeader();
     193             : 
     194             :     void WriteEmbeddedEMF( const GDIMetaFile& rMTF );
     195             :     void WriteEMFRecord( SvMemoryStream& rStream, sal_uInt32 nCurSize,
     196             :                             sal_uInt32 nRemainingSize,
     197             :                             sal_uInt32 nTotalSize,
     198             :                             sal_uInt32 nRecCounts,
     199             :                             sal_uInt16 nCheckSum );
     200             : 
     201             :     sal_uInt16 CalcSaveTargetMapMode(MapMode& rMapMode, const Size& rPrefSize);
     202             : 
     203             : public:
     204             : 
     205           0 :     WMFWriter() {}
     206             : 
     207             :     bool WriteWMF(const GDIMetaFile & rMTF, SvStream & rTargetStream, FilterConfigItem* pFilterConfigItem, bool bPlaceable=true);
     208             : };
     209             : 
     210             : #endif
     211             : 
     212             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10