2 * Copyright 2013, Stephan Aßmus <superstippi@gmx.de>.
3 * All rights reserved. Distributed under the terms of the MIT License.
6 #include "ParagraphStyle.h"
9 ParagraphStyle::ParagraphStyle()
11 fStyleData(new ParagraphStyleData(), true)
16 ParagraphStyle::ParagraphStyle(const ParagraphStyle
& other
)
18 fStyleData(other
.fStyleData
)
24 ParagraphStyle::operator=(const ParagraphStyle
& other
)
29 fStyleData
= other
.fStyleData
;
35 ParagraphStyle::operator==(const ParagraphStyle
& other
) const
40 if (fStyleData
== other
.fStyleData
)
43 if (fStyleData
.Get() != NULL
&& other
.fStyleData
.Get() != NULL
)
44 return *fStyleData
.Get() == *other
.fStyleData
.Get();
51 ParagraphStyle::operator!=(const ParagraphStyle
& other
) const
53 return !(*this == other
);
58 ParagraphStyle::SetAlignment(::Alignment alignment
)
60 ParagraphStyleDataRef data
= fStyleData
->SetAlignment(alignment
);
61 if (data
== fStyleData
)
62 return data
->Alignment() == alignment
;
70 ParagraphStyle::Alignment() const
72 return fStyleData
->Alignment();
77 ParagraphStyle::SetJustify(bool justify
)
79 ParagraphStyleDataRef data
= fStyleData
->SetJustify(justify
);
80 if (data
== fStyleData
)
81 return data
->Justify() == justify
;
89 ParagraphStyle::Justify() const
91 return fStyleData
->Justify();
96 ParagraphStyle::SetFirstLineInset(float inset
)
98 ParagraphStyleDataRef data
= fStyleData
->SetFirstLineInset(inset
);
99 if (data
== fStyleData
)
100 return data
->FirstLineInset() == inset
;
108 ParagraphStyle::FirstLineInset() const
110 return fStyleData
->FirstLineInset();
115 ParagraphStyle::SetLineInset(float inset
)
117 ParagraphStyleDataRef data
= fStyleData
->SetLineInset(inset
);
118 if (data
== fStyleData
)
119 return data
->LineInset() == inset
;
127 ParagraphStyle::LineInset() const
129 return fStyleData
->LineInset();
134 ParagraphStyle::SetLineSpacing(float spacing
)
136 ParagraphStyleDataRef data
= fStyleData
->SetLineSpacing(spacing
);
137 if (data
== fStyleData
)
138 return data
->LineSpacing() == spacing
;
146 ParagraphStyle::LineSpacing() const
148 return fStyleData
->LineSpacing();
153 ParagraphStyle::SetSpacingTop(float spacing
)
155 ParagraphStyleDataRef data
= fStyleData
->SetSpacingTop(spacing
);
156 if (data
== fStyleData
)
157 return data
->SpacingTop() == spacing
;
165 ParagraphStyle::SpacingTop() const
167 return fStyleData
->SpacingTop();
172 ParagraphStyle::SetSpacingBottom(float spacing
)
174 ParagraphStyleDataRef data
= fStyleData
->SetSpacingBottom(spacing
);
175 if (data
== fStyleData
)
176 return data
->SpacingBottom() == spacing
;
184 ParagraphStyle::SpacingBottom() const
186 return fStyleData
->SpacingBottom();
191 ParagraphStyle::SetBullet(const ::Bullet
& bullet
)
193 ParagraphStyleDataRef data
= fStyleData
->SetBullet(bullet
);
194 if (data
== fStyleData
)
195 return data
->Bullet() == bullet
;
203 ParagraphStyle::Bullet() const
205 return fStyleData
->Bullet();