Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / vcl / source / gdi / TypeSerializer.cxx
bloba54f3558c7ef00fd5334baf7ae18f53665292df2
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 #include <TypeSerializer.hxx>
21 #include <tools/vcompat.hxx>
23 TypeSerializer::TypeSerializer(SvStream& rStream)
24 : GenericTypeSerializer(rStream)
28 void TypeSerializer::readGradient(Gradient& rGradient)
30 VersionCompat aCompat(mrStream, StreamMode::READ);
32 sal_uInt16 nStyle;
33 Color aStartColor;
34 Color aEndColor;
35 sal_uInt16 nAngle;
36 sal_uInt16 nBorder;
37 sal_uInt16 nOffsetX;
38 sal_uInt16 nOffsetY;
39 sal_uInt16 nIntensityStart;
40 sal_uInt16 nIntensityEnd;
41 sal_uInt16 nStepCount;
43 mrStream.ReadUInt16(nStyle);
44 readColor(aStartColor);
45 readColor(aEndColor);
46 mrStream.ReadUInt16(nAngle);
47 mrStream.ReadUInt16(nBorder);
48 mrStream.ReadUInt16(nOffsetX);
49 mrStream.ReadUInt16(nOffsetY);
50 mrStream.ReadUInt16(nIntensityStart);
51 mrStream.ReadUInt16(nIntensityEnd);
52 mrStream.ReadUInt16(nStepCount);
54 rGradient.SetStyle(static_cast<GradientStyle>(nStyle));
55 rGradient.SetStartColor(aStartColor);
56 rGradient.SetEndColor(aEndColor);
57 rGradient.SetAngle(nAngle);
58 rGradient.SetBorder(nBorder);
59 rGradient.SetOfsX(nOffsetX);
60 rGradient.SetOfsY(nOffsetY);
61 rGradient.SetStartIntensity(nIntensityStart);
62 rGradient.SetEndIntensity(nIntensityEnd);
63 rGradient.SetSteps(nStepCount);
66 void TypeSerializer::writeGradient(const Gradient& rGradient)
68 VersionCompat aCompat(mrStream, StreamMode::WRITE, 1);
70 mrStream.WriteUInt16(static_cast<sal_uInt16>(rGradient.GetStyle()));
71 writeColor(rGradient.GetStartColor());
72 writeColor(rGradient.GetEndColor());
73 mrStream.WriteUInt16(rGradient.GetAngle());
74 mrStream.WriteUInt16(rGradient.GetBorder());
75 mrStream.WriteUInt16(rGradient.GetOfsX());
76 mrStream.WriteUInt16(rGradient.GetOfsY());
77 mrStream.WriteUInt16(rGradient.GetStartIntensity());
78 mrStream.WriteUInt16(rGradient.GetEndIntensity());
79 mrStream.WriteUInt16(rGradient.GetSteps());