1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dxfreprd.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
34 #include <dxfblkrd.hxx>
35 #include <dxftblrd.hxx>
38 //----------------------------------------------------------------------------
39 //--------------------Nebensachen---------------------------------------------
40 //----------------------------------------------------------------------------
42 //-------------------Eine 3D-Min/Max-Box--------------------------------------
44 class DXFBoundingBox
{
54 DXFBoundingBox() { bEmpty
=TRUE
; }
55 void Union(const DXFVector
& rVector
);
59 //-------------------Die (konstante) Palette fuer DXF-------------------------
68 BYTE
GetRed(BYTE nIndex
) const;
69 BYTE
GetGreen(BYTE nIndex
) const;
70 BYTE
GetBlue(BYTE nIndex
) const;
76 void SetColor(BYTE nIndex
, BYTE nRed
, BYTE nGreen
, BYTE nBlue
);
80 //----------------------------------------------------------------------------
81 //-----------------DXF Datei lesen und repraesentieren------------------------
82 //----------------------------------------------------------------------------
84 class DXFRepresentation
{
89 // Die immer gleiche DXF-Farb-Palette
91 DXFBoundingBox aBoundingBox
;
92 // Ist gleich den AutoCAD-Variablen EXTMIN, EXTMAX sofern in DXF-Datei
93 // vorhanden, anderenfalls wird die BoundingBox berechnet (in Read()).
96 // Die Tabellen der DXF-Datei
99 // Die Bloecke der DXF-Datei
101 DXFEntities aEntities
;
102 // Die Entities (aus der Entities-Section) der DXF-Datei
104 rtl_TextEncoding mEnc
; // $DWGCODEPAGE
106 double mfGlobalLineTypeScale
; // $LTSCALE
109 ~DXFRepresentation();
111 rtl_TextEncoding
getTextEncoding() const;
112 void setTextEncoding(rtl_TextEncoding aEnc
);
114 double getGlobalLineTypeScale() const;
115 void setGlobalLineTypeScale(double fGlobalLineTypeScale
);
117 BOOL
Read( SvStream
& rIStream
, USHORT nMinPercent
, USHORT nMaxPercent
);
118 // Liesst die komplette DXF-Datei ein.
122 void ReadHeader(DXFGroupReader
& rDGR
);
123 void CalcBoundingBox(const DXFEntities
& rEntities
,
124 DXFBoundingBox
& rBox
);
127 //----------------------------------------------------------------------------
128 //-------------------inlines--------------------------------------------------
129 //----------------------------------------------------------------------------
131 inline BYTE
DXFPalette::GetRed(BYTE nIndex
) const { return pRed
[nIndex
]; }
132 inline BYTE
DXFPalette::GetGreen(BYTE nIndex
) const { return pGreen
[nIndex
]; }
133 inline BYTE
DXFPalette::GetBlue(BYTE nIndex
) const { return pBlue
[nIndex
]; }
134 inline rtl_TextEncoding
DXFRepresentation::getTextEncoding() const { return mEnc
; }
135 inline void DXFRepresentation::setTextEncoding(rtl_TextEncoding aEnc
) { mEnc
= aEnc
; }
136 inline double DXFRepresentation::getGlobalLineTypeScale() const { return mfGlobalLineTypeScale
; }
137 inline void DXFRepresentation::setGlobalLineTypeScale(double fGlobalLineTypeScale
) { mfGlobalLineTypeScale
= fGlobalLineTypeScale
; }