1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
23 #include <dxfblkrd.hxx>
24 #include <dxftblrd.hxx>
27 //----------------------------------------------------------------------------
28 //--------------------Other stuff---------------------------------------------
29 //----------------------------------------------------------------------------
31 //-------------------A 3D-Min/Max-Box-----------------------------------------
33 class DXFBoundingBox
{
43 DXFBoundingBox():bEmpty(sal_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
);
48 //-------------------The (constant) palette for DXF-------------------------
57 sal_uInt8
GetRed(sal_uInt8 nIndex
) const;
58 sal_uInt8
GetGreen(sal_uInt8 nIndex
) const;
59 sal_uInt8
GetBlue(sal_uInt8 nIndex
) const;
65 void SetColor(sal_uInt8 nIndex
, sal_uInt8 nRed
, sal_uInt8 nGreen
, sal_uInt8 nBlue
);
69 //----------------------------------------------------------------------------
70 //-----------------read and represent DXF file--------------------------------
71 //----------------------------------------------------------------------------
73 class DXFRepresentation
{
78 // The always equal DXF color palette
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())
85 // the tables of the DXF file
88 // the blocks of the DXF file
90 DXFEntities aEntities
;
91 // the entities (from the Entities-Section) of the DXF file
93 rtl_TextEncoding mEnc
; // $DWGCODEPAGE
95 double mfGlobalLineTypeScale
; // $LTSCALE
100 rtl_TextEncoding
getTextEncoding() const;
101 void setTextEncoding(rtl_TextEncoding aEnc
);
103 double getGlobalLineTypeScale() const;
104 void setGlobalLineTypeScale(double fGlobalLineTypeScale
);
106 sal_Bool
Read( SvStream
& rIStream
, sal_uInt16 nMinPercent
, sal_uInt16 nMaxPercent
);
107 // Reads complete DXF file.
111 void ReadHeader(DXFGroupReader
& rDGR
);
112 void CalcBoundingBox(const DXFEntities
& rEntities
,
113 DXFBoundingBox
& rBox
);
116 //----------------------------------------------------------------------------
117 //-------------------inlines--------------------------------------------------
118 //----------------------------------------------------------------------------
120 inline sal_uInt8
DXFPalette::GetRed(sal_uInt8 nIndex
) const { return pRed
[nIndex
]; }
121 inline sal_uInt8
DXFPalette::GetGreen(sal_uInt8 nIndex
) const { return pGreen
[nIndex
]; }
122 inline sal_uInt8
DXFPalette::GetBlue(sal_uInt8 nIndex
) const { return pBlue
[nIndex
]; }
123 inline rtl_TextEncoding
DXFRepresentation::getTextEncoding() const { return mEnc
; }
124 inline void DXFRepresentation::setTextEncoding(rtl_TextEncoding aEnc
) { mEnc
= aEnc
; }
125 inline double DXFRepresentation::getGlobalLineTypeScale() const { return mfGlobalLineTypeScale
; }
126 inline void DXFRepresentation::setGlobalLineTypeScale(double fGlobalLineTypeScale
) { mfGlobalLineTypeScale
= fGlobalLineTypeScale
; }
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */