Warning, file /office/calligra/libs/flake/KoMarkerData.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /* This file is part of the KDE project
0002    Copyright (C) 2011 Thorsten Zachmann <zachmann@kde.org>
0003 
0004    This library is free software; you can redistribute it and/or
0005    modify it under the terms of the GNU Library General Public
0006    License as published by the Free Software Foundation; either
0007    version 2 of the License, or (at your option) any later version.
0008 
0009    This library is distributed in the hope that it will be useful,
0010    but WITHOUT ANY WARRANTY without even the implied warranty of
0011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012    Library General Public License for more details.
0013 
0014    You should have received a copy of the GNU Library General Public License
0015    along with this library; see the file COPYING.LIB.  If not, write to
0016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017  * Boston, MA 02110-1301, USA.
0018 */
0019 
0020 #ifndef KOMARKERDATA_H
0021 #define KOMARKERDATA_H
0022 
0023 #include <QtGlobal>
0024 
0025 #include "flake_export.h"
0026 
0027 class KoGenStyle;
0028 class KoMarker;
0029 class KoShapeLoadingContext;
0030 class KoShapeSavingContext;
0031 
0032 class FLAKE_EXPORT KoMarkerData
0033 {
0034 public:
0035     /// Property enum
0036     enum MarkerPosition {
0037         MarkerStart, ///< it is the marker where the Path starts
0038         MarkerEnd ///< it is the marker where the Path ends
0039     };
0040 
0041     KoMarkerData(KoMarker *marker, qreal width, MarkerPosition position, bool center);
0042     explicit KoMarkerData(MarkerPosition position);
0043     KoMarkerData(const KoMarkerData &other);
0044     ~KoMarkerData();
0045 
0046     /**
0047      * Get the marker
0048      *
0049      * @return the marker or 0 if no marker is set
0050      */
0051     KoMarker *marker() const;
0052 
0053     /**
0054      * Set the marker
0055      *
0056      * @param marker The marker that is set or 0 to remove the marker
0057      */
0058     void setMarker(KoMarker *marker);
0059 
0060     /**
0061      * Get the with of the marker according to the pen width
0062      */
0063     qreal width(qreal penWidth) const;
0064 
0065     /** 
0066      * Set the width of the marker
0067      *
0068      * This calculates a base width for the marker so the width of the marker changes
0069      * with the width of the line.
0070      *
0071      * @param width The width of the marker
0072      * @param penWidth The width of the used pen
0073      */
0074     void setWidth(qreal width, qreal penWidth);
0075 
0076     /**
0077      * Get the position of the marker
0078      *
0079      * @return Position of the marker
0080      */
0081     MarkerPosition position() const;
0082 
0083     /**
0084      * Set the position of the marker
0085      *
0086      * @param position Position of the marker
0087      */
0088     void setPosition(MarkerPosition position);
0089 
0090     /**
0091      * Get the center property of the marker
0092      *
0093      * If the marker is centered at the start of the stroke the line will get longer.
0094      *
0095      * @return Returns true if the marker is centered at the start of the stroke.
0096      */
0097     bool center() const;
0098 
0099     /**
0100      * Set the center property of the marker
0101      *
0102      * @param center If set to true the marker should be centered at the start of the stroke.
0103      */
0104     void setCenter(bool center);
0105 
0106     /**
0107      * Compare the marker data
0108      */
0109     KoMarkerData &operator=(const KoMarkerData &other);
0110 
0111     /**
0112      * Load the marker data
0113      * 
0114      * @param penWidth the used pen width of the line
0115      * @param context The shape loading context
0116      */
0117     bool loadOdf(qreal penWidth, KoShapeLoadingContext &context);
0118 
0119     /**
0120      * Save the marker data to the style
0121      *
0122      * @param style The style that we add the marker data to
0123      * @param penWidth the used pen width of the line
0124      * @param context The shape saving context
0125      */
0126     void saveStyle(KoGenStyle &style, qreal penWidth, KoShapeSavingContext &context) const;
0127 
0128 private:
0129     // make private to be sure it is not used
0130     KoMarkerData();
0131 
0132     class Private;
0133     Private * const d;
0134 };
0135 
0136 #endif /* KOMARKERDATA_H */