tdf#130857 qt weld: Implement QtInstanceWidget::get_text_height
[LibreOffice.git] / vcl / source / filter / idxf / dxfreprd.hxx
blob734193fcec8429e6a560b21a01e5c56b5366d58a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #pragma once
22 #include "dxfblkrd.hxx"
23 #include "dxftblrd.hxx"
24 #include <array>
25 #include <string_view>
27 //--------------------Other stuff---------------------------------------------
30 //-------------------A 3D-Min/Max-Box-----------------------------------------
32 class DXFBoundingBox {
33 public:
34 bool bEmpty;
35 double fMinX;
36 double fMinY;
37 double fMinZ;
38 double fMaxX;
39 double fMaxY;
40 double fMaxZ;
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);
47 //-------------------The (constant) palette for DXF-------------------------
49 class DXFPalette {
51 public:
53 DXFPalette();
55 sal_uInt8 GetRed(sal_uInt8 nIndex) const;
56 sal_uInt8 GetGreen(sal_uInt8 nIndex) const;
57 sal_uInt8 GetBlue(sal_uInt8 nIndex) const;
59 private:
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);
67 //-----------------read and represent DXF file--------------------------------
70 class DXFRepresentation {
72 public:
74 DXFPalette aPalette;
75 // The always equal DXF color palette
77 DXFBoundingBox aBoundingBox;
78 // is equal to the AutoCAD variables EXTMIN, EXTMAX if those exist
79 // within the DXF file. Otherwise the BoundingBox gets calculated (in Read())
81 DXFTables aTables;
82 // the tables of the DXF file
84 DXFBlocks aBlocks;
85 // the blocks of the DXF file
87 DXFEntities aEntities;
88 // the entities (from the Entities-Section) of the DXF file
90 rtl_TextEncoding mEnc; // $DWGCODEPAGE
92 double mfGlobalLineTypeScale; // $LTSCALE
94 bool mbInCalc; // guard for self-recursive bounding box calc
96 DXFRepresentation();
97 ~DXFRepresentation();
99 rtl_TextEncoding getTextEncoding() const;
100 void setTextEncoding(rtl_TextEncoding aEnc) { mEnc = aEnc; }
101 OUString ToOUString(std::string_view s) const;
103 double getGlobalLineTypeScale() const { return mfGlobalLineTypeScale; }
104 void setGlobalLineTypeScale(double fGlobalLineTypeScale) { mfGlobalLineTypeScale = fGlobalLineTypeScale; }
106 bool Read( SvStream & rIStream );
107 // Reads complete DXF file.
109 private:
110 void ReadHeader(DXFGroupReader & rDGR);
111 void CalcBoundingBox(const DXFEntities & rEntities,
112 DXFBoundingBox & rBox);
114 bool isTextEncodingSet() const { return mEnc != RTL_TEXTENCODING_DONTKNOW; }
118 //-------------------inlines--------------------------------------------------
121 inline sal_uInt8 DXFPalette::GetRed(sal_uInt8 nIndex) const { return pRed[nIndex]; }
122 inline sal_uInt8 DXFPalette::GetGreen(sal_uInt8 nIndex) const { return pGreen[nIndex]; }
123 inline sal_uInt8 DXFPalette::GetBlue(sal_uInt8 nIndex) const { return pBlue[nIndex]; }
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */