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#pragma once
21
22#include "dxfblkrd.hxx"
23#include "dxftblrd.hxx"
24#include <array>
25#include <string_view>
26
27//--------------------Other stuff---------------------------------------------
28
29
30//-------------------A 3D-Min/Max-Box-----------------------------------------
31
33public:
34 bool bEmpty;
35 double fMinX;
36 double fMinY;
37 double fMinZ;
38 double fMaxX;
39 double fMaxY;
40 double fMaxZ;
41
42 DXFBoundingBox():bEmpty(true), fMinX(0.0), fMinY(0.0), fMinZ(0.0), fMaxX(0.0), fMaxY(0.0), fMaxZ(0.0) {}
43 void Union(const DXFVector & rVector);
44};
45
46
47//-------------------The (constant) palette for DXF-------------------------
48
50
51public:
52
53 DXFPalette();
54
58
59private:
60 std::array<sal_uInt8, 256> pRed;
61 std::array<sal_uInt8, 256> pGreen;
62 std::array<sal_uInt8, 256> pBlue;
63 void SetColor(sal_uInt8 nIndex, sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue);
64};
65
66
67//-----------------read and represent DXF file--------------------------------
68
69
71
72public:
73
75 // The always equal DXF color palette
76
78 // is equal to the AutoCAD variables EXTMIN, EXTMAX if those exist
79 // within the DXF file. Otherwise the BoundingBox gets calculated (in Read())
80
82 // the tables of the DXF file
83
85 // the blocks of the DXF file
86
88 // the entities (from the Entities-Section) of the DXF file
89
90 rtl_TextEncoding mEnc; // $DWGCODEPAGE
91
92 double mfGlobalLineTypeScale; // $LTSCALE
93
94 bool mbInCalc; // guard for self-recursive bounding box calc
95
98
99 rtl_TextEncoding getTextEncoding() const;
100 void setTextEncoding(rtl_TextEncoding aEnc) { mEnc = aEnc; }
101 OUString ToOUString(std::string_view s) const;
102
104 void setGlobalLineTypeScale(double fGlobalLineTypeScale) { mfGlobalLineTypeScale = fGlobalLineTypeScale; }
105
106 bool Read( SvStream & rIStream );
107 // Reads complete DXF file.
108
109private:
110 void ReadHeader(DXFGroupReader & rDGR);
111 void CalcBoundingBox(const DXFEntities & rEntities,
112 DXFBoundingBox & rBox);
113
114 bool isTextEncodingSet() const { return mEnc != RTL_TEXTENCODING_DONTKNOW; }
115};
116
117
118//-------------------inlines--------------------------------------------------
119
120
121inline sal_uInt8 DXFPalette::GetRed(sal_uInt8 nIndex) const { return pRed[nIndex]; }
122inline sal_uInt8 DXFPalette::GetGreen(sal_uInt8 nIndex) const { return pGreen[nIndex]; }
123inline sal_uInt8 DXFPalette::GetBlue(sal_uInt8 nIndex) const { return pBlue[nIndex]; }
124
125/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
double fMinY
Definition: dxfreprd.hxx:36
double fMinZ
Definition: dxfreprd.hxx:37
double fMaxZ
Definition: dxfreprd.hxx:40
double fMinX
Definition: dxfreprd.hxx:35
double fMaxY
Definition: dxfreprd.hxx:39
double fMaxX
Definition: dxfreprd.hxx:38
void Union(const DXFVector &rVector)
Definition: dxfreprd.cxx:32
sal_uInt8 GetGreen(sal_uInt8 nIndex) const
Definition: dxfreprd.hxx:122
std::array< sal_uInt8, 256 > pGreen
Definition: dxfreprd.hxx:61
sal_uInt8 GetRed(sal_uInt8 nIndex) const
Definition: dxfreprd.hxx:121
std::array< sal_uInt8, 256 > pBlue
Definition: dxfreprd.hxx:62
sal_uInt8 GetBlue(sal_uInt8 nIndex) const
Definition: dxfreprd.hxx:123
std::array< sal_uInt8, 256 > pRed
Definition: dxfreprd.hxx:60
void SetColor(sal_uInt8 nIndex, sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue)
Definition: dxfreprd.cxx:111
OUString ToOUString(std::string_view s) const
Definition: dxfreprd.cxx:437
void setGlobalLineTypeScale(double fGlobalLineTypeScale)
Definition: dxfreprd.hxx:104
double getGlobalLineTypeScale() const
Definition: dxfreprd.hxx:103
void CalcBoundingBox(const DXFEntities &rEntities, DXFBoundingBox &rBox)
Definition: dxfreprd.cxx:272
DXFTables aTables
Definition: dxfreprd.hxx:81
bool Read(SvStream &rIStream)
Definition: dxfreprd.cxx:140
bool isTextEncodingSet() const
Definition: dxfreprd.hxx:114
DXFPalette aPalette
Definition: dxfreprd.hxx:74
DXFBlocks aBlocks
Definition: dxfreprd.hxx:84
double mfGlobalLineTypeScale
Definition: dxfreprd.hxx:92
rtl_TextEncoding mEnc
Definition: dxfreprd.hxx:90
DXFBoundingBox aBoundingBox
Definition: dxfreprd.hxx:77
rtl_TextEncoding getTextEncoding() const
Definition: dxfreprd.cxx:133
void ReadHeader(DXFGroupReader &rDGR)
Definition: dxfreprd.cxx:174
DXFEntities aEntities
Definition: dxfreprd.hxx:87
void setTextEncoding(rtl_TextEncoding aEnc)
Definition: dxfreprd.hxx:100
sal_Int32 nIndex
unsigned char sal_uInt8