related: tdf#162601 UNIQUE function is case-insensitive also for non ASCII
[LibreOffice.git] / filter / source / graphicfilter / icgm / cgm.hxx
blobe2281311e4381d1e6f26b2a4ce23e1483f1c2a0b
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 <com/sun/star/frame/XModel.hpp>
24 #include <cmath>
25 #include <memory>
26 #include <vector>
27 #include "cgmtypes.hxx"
29 class Graphic;
30 class SvStream;
31 class CGMChart;
32 class CGMBitmap;
33 class CGMImpressOutAct;
34 class CGMElements;
35 class GDIMetaFile;
36 class VirtualDevice;
38 class CGM
40 friend class CGMChart;
41 friend class CGMBitmap;
42 friend class CGMElements;
43 friend class CGMImpressOutAct;
45 double mnVDCXadd;
46 double mnVDCYadd;
47 double mnVDCXmul;
48 double mnVDCYmul;
49 double mnVDCdx;
50 double mnVDCdy;
51 double mnXFraction;
52 double mnYFraction;
53 bool mbAngReverse; // AngularDirection
55 bool mbStatus;
56 bool mbMetaFile;
57 bool mbIsFinished;
58 bool mbPicture;
59 bool mbPictureBody;
60 bool mbFigure;
61 bool mbFirstOutPut;
62 bool mbInDefaultReplacement;
63 sal_uInt32 mnAct4PostReset;
64 int mnBitmapInserts;
65 std::unique_ptr<CGMBitmap> mpBitmapInUse;
66 std::unique_ptr<CGMChart> mpChart; // if sal_True->"SHWSLIDEREC"
67 // otherwise "BEGINPIC" commands
68 // controls page inserting
69 std::unique_ptr<CGMElements> pElement;
70 std::unique_ptr<CGMElements> pCopyOfE;
71 std::unique_ptr<CGMImpressOutAct> mpOutAct;
72 ::std::vector< std::unique_ptr<sal_uInt8[]> > maDefRepList;
73 ::std::vector< sal_uInt32 > maDefRepSizeList;
75 sal_uInt8* mpSource; // start of source buffer that is not increased
76 // ( instead use mnParaCount to index )
77 sal_uInt8* mpEndValidSource; // end position in source buffer of last valid data
78 sal_uInt32 mnParaSize; // actual parameter size which has been done so far
79 sal_uInt32 mnActCount; // increased by each action
80 std::unique_ptr<sal_uInt8[]>
81 mpBuf; // source stream operation -> then this is allocated for
82 // the temp input buffer
84 sal_uInt32 mnEscape;
85 sal_uInt32 mnElementClass;
86 sal_uInt32 mnElementID;
87 sal_uInt32 mnElementSize; // full parameter size for the latest action
89 sal_uInt32 ImplGetUI16();
90 static sal_uInt8 ImplGetByte( sal_uInt32 nSource, sal_uInt32 nPrecision );
91 sal_Int32 ImplGetI( sal_uInt32 nPrecision );
92 sal_uInt32 ImplGetUI( sal_uInt32 nPrecision );
93 static void ImplGetSwitch4( const sal_uInt8* pSource, sal_uInt8* pDest );
94 static void ImplGetSwitch8( const sal_uInt8* pSource, sal_uInt8* pDest );
95 double ImplGetFloat( RealPrecision, sal_uInt32 nRealSize );
96 sal_uInt32 ImplGetBitmapColor( bool bDirectColor = false );
97 void ImplSetMapMode();
98 void ImplSetUnderlineMode();
99 void ImplMapDouble( double& );
100 void ImplMapX( double& );
101 void ImplMapY( double& );
102 void ImplMapPoint( FloatPoint& );
103 inline double ImplGetIY();
104 inline double ImplGetFY();
105 inline double ImplGetIX();
106 inline double ImplGetFX();
107 sal_uInt32 ImplGetPointSize();
108 void ImplGetPoint( FloatPoint& rFloatPoint, bool bMap = false );
109 void ImplGetRectangle( FloatRect&, bool bMap = false );
110 void ImplGetRectangleNS( FloatRect& );
111 void ImplGetVector( double* );
112 static double ImplGetOrientation( FloatPoint const & rCenter, FloatPoint const & rPoint );
113 static void ImplSwitchStartEndAngle( double& rStartAngle, double& rEndAngle );
114 bool ImplGetEllipse( FloatPoint& rCenter, FloatPoint& rRadius, double& rOrientation );
116 void ImplDefaultReplacement();
117 void ImplDoClass();
118 void ImplDoClass0();
119 void ImplDoClass1();
120 void ImplDoClass2();
121 void ImplDoClass3();
122 void ImplDoClass4();
123 void ImplDoClass5();
124 void ImplDoClass6();
125 void ImplDoClass7();
126 void ImplDoClass8();
127 void ImplDoClass9();
128 void ImplDoClass15();
130 public:
132 ~CGM();
134 CGM(css::uno::Reference< css::frame::XModel > const & rModel);
135 sal_uInt32 GetBackGroundColor() const;
136 bool IsValid() const { return mbStatus; };
137 bool IsFinished() const { return mbIsFinished; };
138 bool Write( SvStream& rIStm );
142 inline bool useless(double value)
144 if (!std::isfinite(value))
145 return true;
146 int exp;
147 std::frexp(value, &exp);
148 const int maxbits = sizeof(tools::Long) * 8;
149 return exp > maxbits;
152 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */