1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 #ifndef _DXFREPRD_HXX
25 #define _DXFREPRD_HXX
26
27 #include <dxfblkrd.hxx>
28 #include <dxftblrd.hxx>
29
30
31 //----------------------------------------------------------------------------
32 //--------------------Nebensachen---------------------------------------------
33 //----------------------------------------------------------------------------
34
35 //-------------------Eine 3D-Min/Max-Box--------------------------------------
36
37 class DXFBoundingBox {
38 public:
39 sal_Bool bEmpty;
40 double fMinX;
41 double fMinY;
42 double fMinZ;
43 double fMaxX;
44 double fMaxY;
45 double fMaxZ;
46
DXFBoundingBox()47 DXFBoundingBox() { bEmpty=sal_True; }
48 void Union(const DXFVector & rVector);
49 };
50
51
52 //-------------------Die (konstante) Palette fuer DXF-------------------------
53
54 class DXFPalette {
55
56 public:
57
58 DXFPalette();
59 ~DXFPalette();
60
61 sal_uInt8 GetRed(sal_uInt8 nIndex) const;
62 sal_uInt8 GetGreen(sal_uInt8 nIndex) const;
63 sal_uInt8 GetBlue(sal_uInt8 nIndex) const;
64
65 private:
66 sal_uInt8 * pRed;
67 sal_uInt8 * pGreen;
68 sal_uInt8 * pBlue;
69 void SetColor(sal_uInt8 nIndex, sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue);
70 };
71
72
73 //----------------------------------------------------------------------------
74 //-----------------DXF Datei lesen und repraesentieren------------------------
75 //----------------------------------------------------------------------------
76
77 class DXFRepresentation {
78
79 public:
80
81 DXFPalette aPalette;
82 // Die immer gleiche DXF-Farb-Palette
83
84 DXFBoundingBox aBoundingBox;
85 // Ist gleich den AutoCAD-Variablen EXTMIN, EXTMAX sofern in DXF-Datei
86 // vorhanden, anderenfalls wird die BoundingBox berechnet (in Read()).
87
88 DXFTables aTables;
89 // Die Tabellen der DXF-Datei
90
91 DXFBlocks aBlocks;
92 // Die Bloecke der DXF-Datei
93
94 DXFEntities aEntities;
95 // Die Entities (aus der Entities-Section) der DXF-Datei
96
97 rtl_TextEncoding mEnc; // $DWGCODEPAGE
98
99 double mfGlobalLineTypeScale; // $LTSCALE
100
101 DXFRepresentation();
102 ~DXFRepresentation();
103
104 rtl_TextEncoding getTextEncoding() const;
105 void setTextEncoding(rtl_TextEncoding aEnc);
106
107 double getGlobalLineTypeScale() const;
108 void setGlobalLineTypeScale(double fGlobalLineTypeScale);
109
110 sal_Bool Read( SvStream & rIStream, sal_uInt16 nMinPercent, sal_uInt16 nMaxPercent);
111 // Liesst die komplette DXF-Datei ein.
112
113 private:
114
115 void ReadHeader(DXFGroupReader & rDGR);
116 void CalcBoundingBox(const DXFEntities & rEntities,
117 DXFBoundingBox & rBox);
118 };
119
120 //----------------------------------------------------------------------------
121 //-------------------inlines--------------------------------------------------
122 //----------------------------------------------------------------------------
123
GetRed(sal_uInt8 nIndex) const124 inline sal_uInt8 DXFPalette::GetRed(sal_uInt8 nIndex) const { return pRed[nIndex]; }
GetGreen(sal_uInt8 nIndex) const125 inline sal_uInt8 DXFPalette::GetGreen(sal_uInt8 nIndex) const { return pGreen[nIndex]; }
GetBlue(sal_uInt8 nIndex) const126 inline sal_uInt8 DXFPalette::GetBlue(sal_uInt8 nIndex) const { return pBlue[nIndex]; }
getTextEncoding() const127 inline rtl_TextEncoding DXFRepresentation::getTextEncoding() const { return mEnc; }
setTextEncoding(rtl_TextEncoding aEnc)128 inline void DXFRepresentation::setTextEncoding(rtl_TextEncoding aEnc) { mEnc = aEnc; }
getGlobalLineTypeScale() const129 inline double DXFRepresentation::getGlobalLineTypeScale() const { return mfGlobalLineTypeScale; }
setGlobalLineTypeScale(double fGlobalLineTypeScale)130 inline void DXFRepresentation::setGlobalLineTypeScale(double fGlobalLineTypeScale) { mfGlobalLineTypeScale = fGlobalLineTypeScale; }
131
132 #endif
133
134
135