LibreOffice Module filter (master) 1
cgm.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 <com/sun/star/frame/XModel.hpp>
23
24#include <cmath>
25#include <memory>
26#include <vector>
27#include "cgmtypes.hxx"
28
29class Graphic;
30class SvStream;
31class CGMChart;
32class CGMBitmap;
34class CGMElements;
35class GDIMetaFile;
36class VirtualDevice;
37
38class CGM
39{
40 friend class CGMChart;
41 friend class CGMBitmap;
42 friend class CGMElements;
43 friend class CGMImpressOutAct;
44
45 double mnVDCXadd;
46 double mnVDCYadd;
47 double mnVDCXmul;
48 double mnVDCYmul;
49 double mnVDCdx;
50 double mnVDCdy;
53 bool mbAngReverse; // AngularDirection
54
63 sal_uInt32 mnAct4PostReset;
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;
74
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
83
84 sal_uInt32 mnEscape;
85 sal_uInt32 mnElementClass;
86 sal_uInt32 mnElementID;
87 sal_uInt32 mnElementSize; // full parameter size for the latest action
88
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();
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 );
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 );
115
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();
129
130 public:
131
132 ~CGM();
133
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 );
139
140};
141
142inline bool useless(double value)
143{
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;
150}
151
152/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool useless(double value)
Definition: cgm.hxx:142
RealPrecision
Definition: cgmtypes.hxx:85
Definition: cgm.hxx:39
void ImplDoClass6()
Definition: classx.cxx:40
~CGM()
Definition: cgm.cxx:71
std::unique_ptr< CGMBitmap > mpBitmapInUse
Definition: cgm.hxx:65
void ImplSetMapMode()
Definition: cgm.cxx:372
sal_uInt32 mnActCount
Definition: cgm.hxx:79
int mnBitmapInserts
Definition: cgm.hxx:64
double mnVDCdy
Definition: cgm.hxx:50
void ImplDoClass4()
Definition: class4.cxx:110
static double ImplGetOrientation(FloatPoint const &rCenter, FloatPoint const &rPoint)
Definition: class4.cxx:34
void ImplGetRectangleNS(FloatRect &)
Definition: cgm.cxx:316
std::unique_ptr< CGMChart > mpChart
Definition: cgm.hxx:66
void ImplMapX(double &)
Definition: cgm.cxx:455
static void ImplSwitchStartEndAngle(double &rStartAngle, double &rEndAngle)
Definition: class4.cxx:48
sal_uInt32 mnElementClass
Definition: cgm.hxx:85
std::unique_ptr< CGMImpressOutAct > mpOutAct
Definition: cgm.hxx:71
double mnXFraction
Definition: cgm.hxx:51
void ImplDoClass5()
Definition: class5.cxx:27
void ImplMapPoint(FloatPoint &)
Definition: cgm.cxx:526
double ImplGetFloat(RealPrecision, sal_uInt32 nRealSize)
Definition: cgm.cxx:172
bool IsValid() const
Definition: cgm.hxx:136
bool ImplGetEllipse(FloatPoint &rCenter, FloatPoint &rRadius, double &rOrientation)
Definition: class4.cxx:80
bool IsFinished() const
Definition: cgm.hxx:137
double mnVDCXmul
Definition: cgm.hxx:47
void ImplGetVector(double *)
Definition: class4.cxx:57
double ImplGetIY()
Definition: cgm.cxx:264
double mnVDCYadd
Definition: cgm.hxx:46
static void ImplGetSwitch4(const sal_uInt8 *pSource, sal_uInt8 *pDest)
Definition: cgm.cxx:156
static sal_uInt8 ImplGetByte(sal_uInt32 nSource, sal_uInt32 nPrecision)
Definition: cgm.cxx:91
void ImplDoClass7()
Definition: class7.cxx:29
void ImplDoClass()
Definition: cgm.cxx:565
double mnVDCXadd
Definition: cgm.hxx:45
bool mbStatus
Definition: cgm.hxx:55
bool mbMetaFile
Definition: cgm.hxx:56
bool mbAngReverse
Definition: cgm.hxx:53
sal_Int32 ImplGetI(sal_uInt32 nPrecision)
Definition: cgm.cxx:96
void ImplMapDouble(double &)
Definition: cgm.cxx:420
double mnYFraction
Definition: cgm.hxx:52
CGM(css::uno::Reference< css::frame::XModel > const &rModel)
Definition: cgm.cxx:37
sal_uInt32 mnElementID
Definition: cgm.hxx:86
sal_uInt32 ImplGetBitmapColor(bool bDirectColor=false)
Definition: cgm.cxx:334
sal_uInt32 ImplGetUI16()
Definition: cgm.cxx:82
void ImplDoClass15()
Definition: classx.cxx:237
void ImplDoClass3()
Definition: class3.cxx:26
sal_uInt8 * mpSource
Definition: cgm.hxx:75
void ImplGetPoint(FloatPoint &rFloatPoint, bool bMap=false)
Definition: cgm.cxx:274
bool mbFirstOutPut
Definition: cgm.hxx:61
void ImplDoClass1()
Definition: class1.cxx:30
bool mbFigure
Definition: cgm.hxx:60
void ImplGetRectangle(FloatRect &, bool bMap=false)
Definition: cgm.cxx:290
double ImplGetFY()
Definition: cgm.cxx:269
sal_uInt32 mnEscape
Definition: cgm.hxx:84
bool mbInDefaultReplacement
Definition: cgm.hxx:62
void ImplDoClass0()
Definition: class0.cxx:26
sal_uInt8 * mpEndValidSource
Definition: cgm.hxx:77
double ImplGetFX()
Definition: cgm.cxx:259
void ImplSetUnderlineMode()
Definition: classx.cxx:26
void ImplDefaultReplacement()
Definition: cgm.cxx:590
static void ImplGetSwitch8(const sal_uInt8 *pSource, sal_uInt8 *pDest)
Definition: cgm.cxx:164
::std::vector< std::unique_ptr< sal_uInt8[]> > maDefRepList
Definition: cgm.hxx:72
::std::vector< sal_uInt32 > maDefRepSizeList
Definition: cgm.hxx:73
bool mbPictureBody
Definition: cgm.hxx:59
std::unique_ptr< sal_uInt8[]> mpBuf
Definition: cgm.hxx:81
bool Write(SvStream &rIStm)
Definition: cgm.cxx:648
double ImplGetIX()
Definition: cgm.cxx:254
sal_uInt32 ImplGetUI(sal_uInt32 nPrecision)
Definition: cgm.cxx:128
sal_uInt32 mnElementSize
Definition: cgm.hxx:87
bool mbPicture
Definition: cgm.hxx:58
std::unique_ptr< CGMElements > pCopyOfE
Definition: cgm.hxx:70
void ImplMapY(double &)
Definition: cgm.cxx:490
double mnVDCdx
Definition: cgm.hxx:49
std::unique_ptr< CGMElements > pElement
Definition: cgm.hxx:69
void ImplDoClass9()
Definition: classx.cxx:218
sal_uInt32 ImplGetPointSize()
Definition: cgm.cxx:246
sal_uInt32 mnAct4PostReset
Definition: cgm.hxx:63
void ImplDoClass2()
Definition: class2.cxx:25
double mnVDCYmul
Definition: cgm.hxx:48
void ImplDoClass8()
Definition: classx.cxx:200
sal_uInt32 mnParaSize
Definition: cgm.hxx:78
bool mbIsFinished
Definition: cgm.hxx:57
sal_uInt32 GetBackGroundColor() const
Definition: cgm.cxx:77
Any value
long Long
unsigned char sal_uInt8