LibreOffice Module slideshow (master) 1
shapeattributelayer.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#ifndef INCLUDED_SLIDESHOW_SOURCE_INC_SHAPEATTRIBUTELAYER_HXX
21#define INCLUDED_SLIDESHOW_SOURCE_INC_SHAPEATTRIBUTELAYER_HXX
22
23#include <com/sun/star/drawing/FillStyle.hpp>
24#include <com/sun/star/drawing/LineStyle.hpp>
25#include <com/sun/star/awt/FontSlant.hpp>
26
30
31#include "rgbcolor.hxx"
32
33#include <memory>
34
35
36namespace slideshow::internal
37 {
38
46 class State final
47 {
48 public:
49
51 typedef ::std::size_t StateId;
52 };
53
55
56 typedef ::std::shared_ptr< ShapeAttributeLayer > ShapeAttributeLayerSharedPtr;
57
70 {
71 public:
85 explicit ShapeAttributeLayer( const ShapeAttributeLayerSharedPtr& rChildLayer );
86
87 // Children management methods
88
89
102 bool revokeChildLayer( const ShapeAttributeLayerSharedPtr& rChildLayer );
103
110
126 void setAdditiveMode( sal_Int16 nMode );
127
128 // Attribute methods
129
130
133 bool isWidthValid() const;
136 double getWidth() const;
142 void setWidth( const double& rNewWidth );
143
146 bool isHeightValid() const;
149 double getHeight() const;
155 void setHeight( const double& rNewHeight );
156
162 void setSize( const ::basegfx::B2DSize& rNewSize );
163
166 bool isPosXValid() const;
174 double getPosX() const;
182 void setPosX( const double& rNewX );
183
186 bool isPosYValid() const;
194 double getPosY() const;
202 void setPosY( const double& rNewY );
203
211 void setPosition( const ::basegfx::B2DPoint& rNewPos );
212
215 bool isRotationAngleValid() const;
220 double getRotationAngle() const;
226 void setRotationAngle( const double& rNewAngle );
227
230 bool isShearXAngleValid() const;
235 double getShearXAngle() const;
241 void setShearXAngle( const double& rNewAngle );
242
245 bool isShearYAngleValid() const;
250 double getShearYAngle() const;
256 void setShearYAngle( const double& rNewAngle );
257
260 bool isAlphaValid() const;
263 double getAlpha() const;
269 void setAlpha( const double& rNewValue );
270
273 bool isClipValid() const;
284 void setClip( const ::basegfx::B2DPolyPolygon& rNewClip );
285
291 bool isDimColorValid() const;
294 RGBColor getDimColor() const;
297 void setDimColor( const RGBColor& nNewColor );
298
301 bool isFillColorValid() const;
307 RGBColor getFillColor() const;
310 void setFillColor( const RGBColor& nNewColor );
311
314 bool isLineColorValid() const;
320 RGBColor getLineColor() const;
323 void setLineColor( const RGBColor& nNewColor );
324
327 bool isFillStyleValid() const;
332 sal_Int16 getFillStyle() const;
335 void setFillStyle( const sal_Int16& rStyle );
336
339 bool isLineStyleValid() const;
344 sal_Int16 getLineStyle() const;
347 void setLineStyle( const sal_Int16& rStyle );
348
351 bool isVisibilityValid() const;
356 bool getVisibility() const;
359 void setVisibility( const bool& bVisible );
360
363 bool isCharColorValid() const;
369 RGBColor getCharColor() const;
372 void setCharColor( const RGBColor& nNewColor );
373
376 bool isCharWeightValid() const;
383 double getCharWeight() const;
389 void setCharWeight( const double& rStyle );
390
393 bool isUnderlineModeValid() const;
400 sal_Int16 getUnderlineMode() const;
403 void setUnderlineMode( const sal_Int16& bUnderline );
404
407 bool isFontFamilyValid() const;
413 OUString getFontFamily() const;
416 void setFontFamily( const OUString& rName );
417
420 bool isCharPostureValid() const;
426 sal_Int16 getCharPosture() const;
432 void setCharPosture( const sal_Int16& rStyle );
433
436 bool isCharScaleValid() const;
443 double getCharScale() const;
449 void setCharScale( const double& rNewScale );
450
451 // State change query methods
452
453
460
461 private:
462 // default copy/assignment operator is okay
463 // ShapeAttributeLayer(const ShapeAttributeLayer&);
464 // ShapeAttributeLayer& operator=( const ShapeAttributeLayer& );
465
466 bool haveChild() const { return static_cast< bool >(mpChild); }
467 void updateStateIds();
468
469 template< typename T > T calcValue( const T& rCurrValue,
470 bool bThisInstanceValid,
471 bool (ShapeAttributeLayer::*pIsValid)() const,
472 T (ShapeAttributeLayer::*pGetValue)() const ) const;
473
475
479
480 OUString maFontFamily;
481
485 double mnAlpha;
488
489 css::drawing::FillStyle meFillStyle;
490 css::drawing::LineStyle meLineStyle;
491 css::awt::FontSlant meCharPosture;
493
498
505
506 sal_Int16 mnAdditiveMode;
507
508 bool mbVisibility : 1;
509
510 bool mbWidthValid : 1;
512 bool mbPosXValid : 1;
513 bool mbPosYValid : 1;
514 bool mbClipValid : 1;
515
517
521
522 bool mbAlphaValid : 1;
523
525
530
537 };
538
539}
540
541#endif // INCLUDED_SLIDESHOW_SOURCE_INC_SHAPEATTRIBUTELAYER_HXX
542
543/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
RGB color space class.
Definition: rgbcolor.hxx:35
Encapsulates all modifiable attributes of a shape.
void setCharPosture(const sal_Int16 &rStyle)
Set the italic style globally for the whole shape.
bool revokeChildLayer(const ShapeAttributeLayerSharedPtr &rChildLayer)
Revoke the given layer.
void setWidth(const double &rNewWidth)
Set the new width of the shape.
OUString getFontFamily() const
Get the current text font family for the whole shape.
double getShearYAngle() const
Query the current shear angle at the y axis of the shape.
void setVisibility(const bool &bVisible)
Set the shape visibility.
void setShearYAngle(const double &rNewAngle)
Set the new shear angle at the y axis of the shape.
RGBColor getFillColor() const
Get the fill color for the whole shape.
RGBColor getDimColor() const
Get the dim color for the whole shape.
bool isUnderlineModeValid() const
Query whether the underline mode attribute is valid.
bool isShearXAngleValid() const
Query whether the shear x angle attribute is valid.
void setFontFamily(const OUString &rName)
Set the text font family name globally for the whole shape.
void setPosX(const double &rNewX)
Set the new x position of the shape.
T calcValue(const T &rCurrValue, bool bThisInstanceValid, bool(ShapeAttributeLayer::*pIsValid)() const, T(ShapeAttributeLayer::*pGetValue)() const) const
Calc attribute value.
void setLineStyle(const sal_Int16 &rStyle)
Set line style for the whole shape.
void setSize(const ::basegfx::B2DSize &rNewSize)
Set the new size of the shape.
bool isShearYAngleValid() const
Query whether the shear y angle attribute is valid.
double getCharWeight() const
Get the current char weight value for the whole shape.
void setCharWeight(const double &rStyle)
Set the char weight globally for the whole shape.
void setAlpha(const double &rNewValue)
Set the new alpha value of the shape.
bool isCharPostureValid() const
Query whether the italic mode attribute is valid.
void setPosition(const ::basegfx::B2DPoint &rNewPos)
Set the new position of the shape.
void setFillStyle(const sal_Int16 &rStyle)
Changes polygon fillings.
bool isFillColorValid() const
Query whether the fill color attribute is valid.
void setUnderlineMode(const sal_Int16 &bUnderline)
Set the underline status globally for the whole shape.
void setHeight(const double &rNewHeight)
Set the new height of the shape.
bool isLineColorValid() const
Query whether the line color attribute is valid.
bool isFontFamilyValid() const
Query whether the font family attribute is valid.
bool isVisibilityValid() const
Query whether the visibility state attribute is valid.
const ShapeAttributeLayerSharedPtr & getChildLayer() const
Query the child layer of this object.
bool isRotationAngleValid() const
Query whether the rotation angle attribute is valid.
RGBColor getCharColor() const
Get the text color for the whole shape.
double getPosY() const
Query the current y position of the shape.
void setRotationAngle(const double &rNewAngle)
Set the new rotation angle of the shape.
bool isCharColorValid() const
Query whether the char color attribute is valid.
sal_Int16 getLineStyle() const
Get the current line mode for line drawing.
void setCharColor(const RGBColor &nNewColor)
Set the text color globally for the whole shape.
bool isCharScaleValid() const
Query whether the char scaling attribute is valid.
bool isPosXValid() const
Query whether the x position attribute is valid.
bool isDimColorValid() const
Query whether the dim color attribute is valid.
double getShearXAngle() const
Query the current shear angle at the x axis of the shape.
void setAdditiveMode(sal_Int16 nMode)
Set the additive mode for possible child attributes.
ShapeAttributeLayer(const ShapeAttributeLayerSharedPtr &rChildLayer)
Create a ShapeAttributeLayer instance, with all attributes set to default.
sal_Int16 getFillStyle() const
Get the current fill mode for polygon fillings.
double getAlpha() const
Query the current alpha value of the shape.
bool isWidthValid() const
Query whether the width attribute is valid.
void setFillColor(const RGBColor &nNewColor)
Set the fill color globally for the whole shape.
void setCharScale(const double &rNewScale)
Set the new char scale globally for the shape.
bool isPosYValid() const
Query whether the y position attribute is valid.
bool isAlphaValid() const
Query whether the alpha attribute is valid.
double getRotationAngle() const
Query the current rotation angle of the shape.
void setDimColor(const RGBColor &nNewColor)
Set the dim color globally for the whole shape.
bool isLineStyleValid() const
Query whether the line mode attribute is valid.
bool isClipValid() const
Query whether the clip attribute is valid.
void setClip(const ::basegfx::B2DPolyPolygon &rNewClip)
Set the new clip polygon of the shape.
double getHeight() const
Query the current height of the shape.
double getWidth() const
Query the current width of the shape.
sal_Int16 getUnderlineMode() const
Get the current text underline status for the whole shape.
bool isFillStyleValid() const
Query whether the fill mode attribute is valid.
sal_Int16 getCharPosture() const
Get the current text italic style for the whole shape.
::basegfx::B2DPolyPolygon getClip() const
Query the current clip polygon of the shape.
bool isCharWeightValid() const
Query whether the char weight attribute is valid.
bool getVisibility() const
Get the current shape visibility.
double getPosX() const
Query the current x position of the shape.
void setShearXAngle(const double &rNewAngle)
Set the new shear angle at the x axis of the shape.
double getCharScale() const
Query the current char scaling attribute globally for the shape.
void setLineColor(const RGBColor &nNewColor)
Set the line color globally for the whole shape.
RGBColor getLineColor() const
Get the line color for the whole shape.
bool isHeightValid() const
Query whether the height attribute is valid.
void setPosY(const double &rNewY)
Set the new y position of the shape.
This interface represents a stateful object.
::std::size_t StateId
Abstract, numerically encoded state ID.
::std::shared_ptr< ShapeAttributeLayer > ShapeAttributeLayerSharedPtr
bool bVisible