LibreOffice Module vcl (master)  1
dxfreprd.hxx
Go to the documentation of this file.
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 #include <array>
26 #include <string_view>
27 
28 //--------------------Other stuff---------------------------------------------
29 
30 
31 //-------------------A 3D-Min/Max-Box-----------------------------------------
32 
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  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 
58  sal_uInt8 GetGreen(sal_uInt8 nIndex) const;
59  sal_uInt8 GetBlue(sal_uInt8 nIndex) const;
60 
61 private:
62  std::array<sal_uInt8, 256> pRed;
63  std::array<sal_uInt8, 256> pGreen;
64  std::array<sal_uInt8, 256> pBlue;
65  void SetColor(sal_uInt8 nIndex, sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue);
66 };
67 
68 
69 //-----------------read and represent DXF file--------------------------------
70 
71 
73 
74 public:
75 
77  // The always equal DXF color palette
78 
80  // is equal to the AutoCAD variables EXTMIN, EXTMAX if those exist
81  // within the DXF file. Otherwise the BoundingBox gets calculated (in Read())
82 
84  // the tables of the DXF file
85 
87  // the blocks of the DXF file
88 
90  // the entities (from the Entities-Section) of the DXF file
91 
92  rtl_TextEncoding mEnc; // $DWGCODEPAGE
93 
94  double mfGlobalLineTypeScale; // $LTSCALE
95 
96  bool mbInCalc; // guard for self-recursive bounding box calc
97 
100 
101  rtl_TextEncoding getTextEncoding() const;
102  void setTextEncoding(rtl_TextEncoding aEnc) { mEnc = aEnc; }
103  OUString ToOUString(std::string_view s) const;
104 
106  void setGlobalLineTypeScale(double fGlobalLineTypeScale) { mfGlobalLineTypeScale = fGlobalLineTypeScale; }
107 
108  bool Read( SvStream & rIStream );
109  // Reads complete DXF file.
110 
111 private:
112  void ReadHeader(DXFGroupReader & rDGR);
113  void CalcBoundingBox(const DXFEntities & rEntities,
114  DXFBoundingBox & rBox);
115 
116  bool isTextEncodingSet() const { return mEnc != RTL_TEXTENCODING_DONTKNOW; }
117 };
118 
119 
120 //-------------------inlines--------------------------------------------------
121 
122 
123 inline sal_uInt8 DXFPalette::GetRed(sal_uInt8 nIndex) const { return pRed[nIndex]; }
124 inline sal_uInt8 DXFPalette::GetGreen(sal_uInt8 nIndex) const { return pGreen[nIndex]; }
125 inline sal_uInt8 DXFPalette::GetBlue(sal_uInt8 nIndex) const { return pBlue[nIndex]; }
126 
127 #endif
128 
129 
130 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::array< sal_uInt8, 256 > pGreen
Definition: dxfreprd.hxx:63
sal_Int32 nIndex
DXFBlocks aBlocks
Definition: dxfreprd.hxx:86
double fMinZ
Definition: dxfreprd.hxx:38
void CalcBoundingBox(const DXFEntities &rEntities, DXFBoundingBox &rBox)
Definition: dxfreprd.cxx:274
sal_uInt8 GetGreen(sal_uInt8 nIndex) const
Definition: dxfreprd.hxx:124
OUString ToOUString(std::string_view s) const
Definition: dxfreprd.cxx:439
sal_uInt8 GetBlue(sal_uInt8 nIndex) const
Definition: dxfreprd.hxx:125
std::array< sal_uInt8, 256 > pBlue
Definition: dxfreprd.hxx:64
sal_uInt8 GetRed(sal_uInt8 nIndex) const
Definition: dxfreprd.hxx:123
double fMinX
Definition: dxfreprd.hxx:36
double fMaxY
Definition: dxfreprd.hxx:40
double fMaxX
Definition: dxfreprd.hxx:39
void setTextEncoding(rtl_TextEncoding aEnc)
Definition: dxfreprd.hxx:102
rtl_TextEncoding getTextEncoding() const
Definition: dxfreprd.cxx:135
DXFPalette aPalette
Definition: dxfreprd.hxx:76
double fMaxZ
Definition: dxfreprd.hxx:41
void Union(const DXFVector &rVector)
Definition: dxfreprd.cxx:29
bool isTextEncodingSet() const
Definition: dxfreprd.hxx:116
DXFTables aTables
Definition: dxfreprd.hxx:83
void setGlobalLineTypeScale(double fGlobalLineTypeScale)
Definition: dxfreprd.hxx:106
double fMinY
Definition: dxfreprd.hxx:37
double getGlobalLineTypeScale() const
Definition: dxfreprd.hxx:105
DXFBoundingBox aBoundingBox
Definition: dxfreprd.hxx:79
double mfGlobalLineTypeScale
Definition: dxfreprd.hxx:94
unsigned char sal_uInt8
DXFEntities aEntities
Definition: dxfreprd.hxx:89
bool Read(SvStream &rIStream)
Definition: dxfreprd.cxx:142
void SetColor(sal_uInt8 nIndex, sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue)
Definition: dxfreprd.cxx:113
rtl_TextEncoding mEnc
Definition: dxfreprd.hxx:92
void ReadHeader(DXFGroupReader &rDGR)
Definition: dxfreprd.cxx:176
std::array< sal_uInt8, 256 > pRed
Definition: dxfreprd.hxx:62