LibreOffice Module vcl (master)  1
TypeSerializer.cxx
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 #include <TypeSerializer.hxx>
21 #include <tools/vcompat.hxx>
22 
24  : GenericTypeSerializer(rStream)
25 {
26 }
27 
29 {
30  VersionCompat aCompat(mrStream, StreamMode::READ);
31 
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;
42 
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);
53 
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);
64 }
65 
67 {
68  VersionCompat aCompat(mrStream, StreamMode::WRITE, 1);
69 
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());
79  mrStream.WriteUInt16(rGradient.GetSteps());
80 }
void SetEndColor(const Color &rColor)
GradientStyle GetStyle() const
Definition: gradient.hxx:74
SvStream & WriteUInt16(sal_uInt16 nUInt16)
const Color & GetStartColor() const
Definition: gradient.hxx:77
SvStream & ReadUInt16(sal_uInt16 &rUInt16)
sal_uInt16 GetOfsY() const
Definition: gradient.hxx:89
sal_uInt16 GetBorder() const
Definition: gradient.hxx:85
void SetBorder(sal_uInt16 nBorder)
void SetEndIntensity(sal_uInt16 nIntens)
void SetSteps(sal_uInt16 nSteps)
void SetOfsY(sal_uInt16 nOfsY)
void SetStartColor(const Color &rColor)
sal_uInt16 GetAngle() const
Definition: gradient.hxx:82
sal_uInt16 GetOfsX() const
Definition: gradient.hxx:87
void writeGradient(const Gradient &rGradient)
long const nBorder
sal_uInt16 GetEndIntensity() const
Definition: gradient.hxx:94
void SetOfsX(sal_uInt16 nOfsX)
sal_uInt16 GetSteps() const
Definition: gradient.hxx:97
void SetAngle(sal_uInt16 nAngle)
TypeSerializer(SvStream &rStream)
void writeColor(const Color &rColor)
void SetStyle(GradientStyle eStyle)
void readGradient(Gradient &rGradient)
sal_uInt16 GetStartIntensity() const
Definition: gradient.hxx:92
void SetStartIntensity(sal_uInt16 nIntens)
const Color & GetEndColor() const
Definition: gradient.hxx:79
void readColor(Color &rColor)