LCOV - code coverage report
Current view: top level - svtools/source/filter/wmf - wmfwr.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 3 3 100.0 %
Date: 2012-08-25 Functions: 4 4 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 22 44 50.0 %

           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                 :            : #ifndef _WMFWR_HXX
      30                 :            : #define _WMFWR_HXX
      31                 :            : 
      32                 :            : #include <vcl/metaact.hxx>
      33                 :            : #include <vcl/graph.hxx>
      34                 :            : #include <vcl/gdimtf.hxx>
      35                 :            : #include <vcl/virdev.hxx>
      36                 :            : #include <svtools/fltcall.hxx>
      37                 :            : 
      38                 :            : // -----------------------------------------------------------------------------
      39                 :            : 
      40                 :            : #define MAXOBJECTHANDLES 16
      41                 :            : 
      42                 :            : // -----------------------------------------------------------------------------
      43                 :            : 
      44 [ +  - ][ +  - ]:       2274 : struct WMFWriterAttrStackMember
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      45                 :            : {
      46                 :            :     struct WMFWriterAttrStackMember * pSucc;
      47                 :            :     Color aLineColor;
      48                 :            :     Color aFillColor;
      49                 :            :     Color aTextColor;
      50                 :            :     LineInfo aLineInfo;
      51                 :            :     TextAlign eTextAlign;
      52                 :            :     RasterOp eRasterOp;
      53                 :            :     Font aFont;
      54                 :            :     MapMode aMapMode;
      55                 :            :     Region aClipRegion;
      56                 :            :     sal_uInt16 nFlags;
      57                 :            : };
      58                 :            : 
      59                 :            : // -------------
      60                 :            : // - WMFWriter -
      61                 :            : // -------------
      62                 :            : 
      63                 :            : class StarSymbolToMSMultiFont;
      64                 :            : class LineInfo;
      65                 :            : namespace basegfx { class B2DPolygon; }
      66                 :            : 
      67 [ +  - ][ +  - ]:         87 : class WMFWriter
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      68                 :            : {
      69                 :            : private:
      70                 :            : 
      71                 :            :     sal_Bool            bStatus;
      72                 :            : 
      73                 :            :     sal_uLong                   nLastPercent; // Mit welcher Zahl pCallback zuletzt aufgerufen wurde.
      74                 :            :     FilterConfigItem*       pFilterConfigItem;
      75                 :            : 
      76                 :            :     com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator;
      77                 :            : 
      78                 :            :     SvStream*               pWMF;
      79                 :            :     VirtualDevice*          pVirDev;
      80                 :            :     StarSymbolToMSMultiFont *pConvert;
      81                 :            :     MapMode                 aTargetMapMode;
      82                 :            :     Size                    aTargetSize;
      83                 :            :     sal_uInt16                  nTargetDivisor;
      84                 :            : 
      85                 :            :     sal_uLong nMetafileHeaderPos;
      86                 :            :     sal_uInt32 nMaxRecordSize; // in Worten
      87                 :            :     sal_uLong nActRecordPos;
      88                 :            : 
      89                 :            :     // Aktuelle Attribute im Quell-Metafile:
      90                 :            :     Color     aSrcLineColor;
      91                 :            :     Color     aSrcFillColor;
      92                 :            :     Color     aSrcTextColor;
      93                 :            :     LineInfo  aSrcLineInfo;
      94                 :            :     RasterOp  eSrcRasterOp;
      95                 :            :     FontAlign eSrcTextAlign;
      96                 :            :     Font      aSrcFont;
      97                 :            :     MapMode   aSrcMapMode;
      98                 :            :     sal_Bool      bSrcIsClipping;
      99                 :            :     Region    aSrcClipRegion;
     100                 :            :     WMFWriterAttrStackMember * pAttrStack;
     101                 :            : 
     102                 :            :     sal_uInt32    eSrcHorTextAlign;
     103                 :            : 
     104                 :            :     // Aktuelle Attribute im Ziel-Metafile:
     105                 :            :     Color     aDstLineColor;
     106                 :            :     Color     aDstFillColor;
     107                 :            :     Color     aDstTextColor;
     108                 :            :     LineInfo  aDstLineInfo;
     109                 :            :     RasterOp  eDstROP2;
     110                 :            :     FontAlign eDstTextAlign;
     111                 :            :     Font      aDstFont;
     112                 :            : 
     113                 :            :     sal_uInt32    eDstHorTextAlign;
     114                 :            : 
     115                 :            :     sal_Bool      bDstIsClipping; // ???: derzeit unberuecksichtigt
     116                 :            :     Region    aDstClipRegion; // ???: derzeit unberuecksichtigt
     117                 :            :     sal_Bool bHandleAllocated[MAXOBJECTHANDLES];             // Welche Handles vergeben sind
     118                 :            :     sal_uInt16 nDstPenHandle,nDstFontHandle,nDstBrushHandle; // Welche Handles die jeweiligen
     119                 :            :                                                          // Selected-Objects besitzen
     120                 :            :                                                          // 0xffff = keines:
     121                 :            : 
     122                 :            :     // Damit nicht bei jeder Operation alle Attribute verglichen werden muessen:
     123                 :            : 
     124                 :            :     sal_uLong nNumberOfActions; // Anzahl der Actions im GDIMetafile
     125                 :            :     sal_uLong nNumberOfBitmaps; // Anzahl der Bitmaps
     126                 :            :     sal_uLong nWrittenActions;  // Anzahl der bereits verarbeiteten Actions beim Schreiben der Orders
     127                 :            :     sal_uLong nWrittenBitmaps;  // Anzahl der bereits geschriebenen Bitmaps
     128                 :            :     sal_uLong nActBitmapPercent; // Wieviel Prozent die naechste Bitmap schon geschrieben ist.
     129                 :            : 
     130                 :            :     sal_Bool bEmbedEMF; // optionally embedd EMF data into WMF
     131                 :            : 
     132                 :            :     void MayCallback();
     133                 :            :         // Berechnet anhand der obigen 5 Parameter eine Prozentzahl
     134                 :            :         // und macht dann ggf. einen Callback. Setzt bStatus auf FALSE wenn User abbrechen
     135                 :            :         // moechte.
     136                 :            : 
     137                 :            :     void CountActionsAndBitmaps(const GDIMetaFile & rMTF);
     138                 :            :         // Zaehlt die Bitmaps und Actions (nNumberOfActions und nNumberOfBitmaps muessen
     139                 :            :         // zu Anfang auf 0 gesetzt werden, weil diese Methode rekursiv ist)
     140                 :            : 
     141                 :            :     void WritePointXY(const Point & rPoint);
     142                 :            :     void WritePointYX(const Point & rPoint);
     143                 :            :     sal_Int32 ScaleWidth( sal_Int32 nDX );
     144                 :            :     void WriteSize(const Size & rSize);
     145                 :            :     void WriteHeightWidth(const Size & rSize);
     146                 :            :     void WriteRectangle(const Rectangle & rRect);
     147                 :            :     void WriteColor(const Color & rColor);
     148                 :            : 
     149                 :            :     void WriteRecordHeader(sal_uInt32 nSizeWords, sal_uInt16 nType);
     150                 :            :         // nSizeWords ist die Groesse des gesammten Records in Anzahl Worte.
     151                 :            :         // Wenn nSizeWords unbekannt ist, dann 0 einsetzen (siehe UpdateRecordHeader()).
     152                 :            : 
     153                 :            :     void UpdateRecordHeader();
     154                 :            :         // berichtig die Groesse des Records nach dem Schreiben der Parameter, wenn
     155                 :            :         // nSizeWords bei Aufruf von WriteRecordHeader(..) unbekannt war.
     156                 :            :         // fuegt ggf. noch ein BYTE 0 ein damit Anzahl Bytes immer gerade.
     157                 :            : 
     158                 :            :     void WMFRecord_Arc(const Rectangle & rRect, const Point & rStartPt, const Point & rEndPt);
     159                 :            :     void WMFRecord_Chord(const Rectangle & rRect, const Point & rStartPt, const Point & rEndPt);
     160                 :            :     void WMFRecord_CreateBrushIndirect(const Color& rColor);
     161                 :            :     void WMFRecord_CreateFontIndirect(const Font & rFont);
     162                 :            :     void WMFRecord_CreatePenIndirect(const Color& rColor, const LineInfo& rLineInfo );
     163                 :            :     void WMFRecord_DeleteObject(sal_uInt16 nObjectHandle);
     164                 :            :     void WMFRecord_Ellipse(const Rectangle & rRect);
     165                 :            :     void WMFRecord_Escape( sal_uInt32 nEsc, sal_uInt32 nLen, const sal_Int8* pData );
     166                 :            :     sal_Bool WMFRecord_Escape_Unicode( const Point& rPoint, const String& rStr, const sal_Int32 * pDXAry );
     167                 :            :     void WMFRecord_ExtTextOut(const Point & rPoint, const String & rString, const sal_Int32 * pDXAry);
     168                 :            : 
     169                 :            :     void TrueExtTextOut(const Point & rPoint, const String & rString,
     170                 :            :         const rtl::OString& rByteString, const sal_Int32 * pDXAry);
     171                 :            :     void TrueTextOut(const Point & rPoint, const rtl::OString& rString);
     172                 :            :     void WMFRecord_LineTo(const Point & rPoint);
     173                 :            :     void WMFRecord_MoveTo(const Point & rPoint);
     174                 :            :     void WMFRecord_Pie(const Rectangle & rRect, const Point & rStartPt, const Point & rEndPt);
     175                 :            :     void WMFRecord_Polygon(const Polygon & rPoly);
     176                 :            :     void WMFRecord_PolyLine(const Polygon & rPoly);
     177                 :            :     void WMFRecord_PolyPolygon(const PolyPolygon & rPolyPoly);
     178                 :            :     void WMFRecord_Rectangle(const Rectangle & rRect);
     179                 :            :     void WMFRecord_RestoreDC();
     180                 :            :     void WMFRecord_RoundRect(const Rectangle & rRect, long nHorzRound, long nVertRound);
     181                 :            :     void WMFRecord_SaveDC();
     182                 :            :     void WMFRecord_SelectObject(sal_uInt16 nObjectHandle);
     183                 :            :     void WMFRecord_SetBkMode(sal_Bool bTransparent);
     184                 :            :     void WMFRecord_SetStretchBltMode();
     185                 :            :     void WMFRecord_SetPixel(const Point & rPoint, const Color & rColor);
     186                 :            :     void WMFRecord_SetROP2(RasterOp eROP);
     187                 :            :     void WMFRecord_SetTextAlign(FontAlign eFontAlign, sal_uInt32 eHorTextAlign);
     188                 :            :     void WMFRecord_SetTextColor(const Color & rColor);
     189                 :            :     void WMFRecord_SetWindowExt(const Size & rSize);
     190                 :            :     void WMFRecord_SetWindowOrg(const Point & rPoint);
     191                 :            :     void WMFRecord_StretchDIB(const Point & rPoint, const Size & rSize, const Bitmap & rBitmap, sal_uInt32 nROP = 0UL );
     192                 :            :     void WMFRecord_TextOut(const Point & rPoint, const String & rString);
     193                 :            :     void WMFRecord_EndOfFile();
     194                 :            :     void WMFRecord_IntersectClipRect( const Rectangle& rRect);
     195                 :            : 
     196                 :            :     sal_uInt16 AllocHandle();
     197                 :            :     void FreeHandle(sal_uInt16 nObjectHandle);
     198                 :            :     void CreateSelectDeletePen( const Color& rColor, const LineInfo& rLineInfo );
     199                 :            :     void CreateSelectDeleteFont(const Font & rFont);
     200                 :            :     void CreateSelectDeleteBrush(const Color& rColor);
     201                 :            : 
     202                 :            :     void SetLineAndFillAttr();
     203                 :            :     void SetAllAttr();
     204                 :            : 
     205                 :            :     void HandleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon);
     206                 :            :     void WriteRecords(const GDIMetaFile & rMTF);
     207                 :            : 
     208                 :            :     void WriteHeader(const GDIMetaFile & rMTF, sal_Bool bPlaceable);
     209                 :            :     void UpdateHeader();
     210                 :            : 
     211                 :            :     void WriteEmbeddedEMF( const GDIMetaFile& rMTF );
     212                 :            :     void WriteEMFRecord( SvMemoryStream& rStream, sal_uInt32 nCurSize,
     213                 :            :                             sal_uInt32 nRemainingSize,
     214                 :            :                             sal_uInt32 nTotalSize,
     215                 :            :                             sal_uInt32 nRecCounts,
     216                 :            :                             sal_uInt16 nCheckSum );
     217                 :            : 
     218                 :            :     sal_uInt16 CalcSaveTargetMapMode(MapMode& rMapMode, const Size& rPrefSize);
     219                 :            : 
     220                 :            : public:
     221                 :            : 
     222 [ +  - ][ +  - ]:         87 :     WMFWriter() {}
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     223                 :            : 
     224                 :            :     sal_Bool WriteWMF(const GDIMetaFile & rMTF, SvStream & rTargetStream, FilterConfigItem* pFilterConfigItem, sal_Bool bPlaceable=sal_True);
     225                 :            : };
     226                 :            : 
     227                 :            : #endif
     228                 :            : 
     229                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10