LCOV - code coverage report
Current view: top level - filter/source/graphicfilter/idxf - dxfreprd.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 3 8 37.5 %
Date: 2015-06-13 12:38:46 Functions: 3 8 37.5 %
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_FILTER_SOURCE_GRAPHICFILTER_IDXF_DXFREPRD_HXX
      21             : #define INCLUDED_FILTER_SOURCE_GRAPHICFILTER_IDXF_DXFREPRD_HXX
      22             : 
      23             : #include <dxfblkrd.hxx>
      24             : #include <dxftblrd.hxx>
      25             : 
      26             : 
      27             : 
      28             : //--------------------Other stuff---------------------------------------------
      29             : 
      30             : 
      31             : //-------------------A 3D-Min/Max-Box-----------------------------------------
      32             : 
      33             : class DXFBoundingBox {
      34             : public:
      35             :     bool bEmpty;
      36             :     double fMinX;
      37             :     double fMinY;
      38             :     double fMinZ;
      39             :     double fMaxX;
      40             :     double fMaxY;
      41             :     double fMaxZ;
      42             : 
      43           1 :     DXFBoundingBox():bEmpty(true), fMinX(0.0), fMinY(0.0), fMinZ(0.0), fMaxX(0.0), fMaxY(0.0), fMaxZ(0.0) {}
      44             :     void Union(const DXFVector & rVector);
      45             : };
      46             : 
      47             : 
      48             : //-------------------The (constant) palette for DXF-------------------------
      49             : 
      50             : class DXFPalette {
      51             : 
      52             : public:
      53             : 
      54             :     DXFPalette();
      55             :     ~DXFPalette();
      56             : 
      57             :     sal_uInt8 GetRed(sal_uInt8 nIndex) const;
      58             :     sal_uInt8 GetGreen(sal_uInt8 nIndex) const;
      59             :     sal_uInt8 GetBlue(sal_uInt8 nIndex) const;
      60             : 
      61             : private:
      62             :     sal_uInt8 * pRed;
      63             :     sal_uInt8 * pGreen;
      64             :     sal_uInt8 * pBlue;
      65             :     void SetColor(sal_uInt8 nIndex, sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue);
      66             : };
      67             : 
      68             : 
      69             : 
      70             : //-----------------read and represent DXF file--------------------------------
      71             : 
      72             : 
      73             : class DXFRepresentation {
      74             : 
      75             : public:
      76             : 
      77             :     DXFPalette aPalette;
      78             :         // The always equal DXF color palette
      79             : 
      80             :     DXFBoundingBox aBoundingBox;
      81             :         // is equal to the AutoCAD variables EXTMIN, EXTMAX if those exist
      82             :         // within the DXF file. Otherwise the BoundingBox gets calculated (in Read())
      83             : 
      84             :     DXFTables aTables;
      85             :         // the tables of the DXF file
      86             : 
      87             :     DXFBlocks aBlocks;
      88             :         // the blocks of the DXF file
      89             : 
      90             :     DXFEntities aEntities;
      91             :         // the entities (from the Entities-Section) of the DXF file
      92             : 
      93             :     rtl_TextEncoding mEnc;  // $DWGCODEPAGE
      94             : 
      95             :     bool bUseUTF8; // for AC1021 and higher
      96             : 
      97             :     double mfGlobalLineTypeScale; // $LTSCALE
      98             : 
      99             :     DXFRepresentation();
     100             :     ~DXFRepresentation();
     101             : 
     102             :     rtl_TextEncoding getTextEncoding() const;
     103             :     void setTextEncoding(rtl_TextEncoding aEnc);
     104             :     OUString ToOUString(const OString& s, bool bSpecials=false) const;
     105             : 
     106             :     double getGlobalLineTypeScale() const;
     107             :     void setGlobalLineTypeScale(double fGlobalLineTypeScale);
     108             : 
     109             :     bool Read( SvStream & rIStream, sal_uInt16 nMinPercent, sal_uInt16 nMaxPercent);
     110             :         // Reads complete DXF file.
     111             : 
     112             : private:
     113             : 
     114             :     void ReadHeader(DXFGroupReader & rDGR);
     115             :     void CalcBoundingBox(const DXFEntities & rEntities,
     116             :                          DXFBoundingBox & rBox);
     117             : };
     118             : 
     119             : 
     120             : //-------------------inlines--------------------------------------------------
     121             : 
     122             : 
     123           0 : inline sal_uInt8 DXFPalette::GetRed(sal_uInt8 nIndex) const { return pRed[nIndex]; }
     124           0 : inline sal_uInt8 DXFPalette::GetGreen(sal_uInt8 nIndex) const { return pGreen[nIndex]; }
     125           0 : inline sal_uInt8 DXFPalette::GetBlue(sal_uInt8 nIndex) const { return pBlue[nIndex]; }
     126           0 : inline rtl_TextEncoding DXFRepresentation::getTextEncoding() const { return bUseUTF8 ? RTL_TEXTENCODING_UTF8 : mEnc; }
     127           1 : inline void DXFRepresentation::setTextEncoding(rtl_TextEncoding aEnc) { mEnc = aEnc; }
     128           0 : inline double DXFRepresentation::getGlobalLineTypeScale() const { return mfGlobalLineTypeScale; }
     129           1 : inline void DXFRepresentation::setGlobalLineTypeScale(double fGlobalLineTypeScale) { mfGlobalLineTypeScale = fGlobalLineTypeScale; }
     130             : 
     131             : #endif
     132             : 
     133             : 
     134             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11