File indexing completed on 2024-05-12 16:29:16

0001 /*
0002  *  Copyright (c) 2010 Carlos Licea <carlos@kdab.com>
0003  *
0004  *  This library is free software; you can redistribute it and/or modify
0005  *  it under the terms of the GNU Lesser General Public License as published
0006  *  by the Free Software Foundation; either version 2.1 of the License, or
0007  *  (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
0012  *  GNU Lesser General Public License for more details.
0013  *
0014  *  You should have received a copy of the GNU Lesser General Public License
0015  *  along with this program; if not, write to the Free Software
0016  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0017  */
0018 
0019 #ifndef KOCELLSTYLE_H
0020 #define KOCELLSTYLE_H
0021 
0022 #include <KoBorder.h>
0023 
0024 #include "koodf2_export.h"
0025 #include "KoStyle.h"
0026 
0027 
0028 /**
0029  * \class KoCellStyle
0030  * \brief represents a style of a cell to be applied to one or more cells.
0031  *
0032  * As all the styles it can be shared
0033  */
0034 class KOODF2_EXPORT KoCellStyle : public KoStyle
0035 {
0036     KoCellStyle();
0037 
0038 public:
0039     KOSTYLE_DECLARE_SHARED_POINTER(KoCellStyle)
0040 
0041     ~KoCellStyle() override;
0042 
0043     KoBorder* borders();
0044 
0045     void setBackgroundColor(const QColor& color);
0046     QColor backgroundColor() const;
0047 
0048     void setBackgroundOpacity(qreal opacity);
0049     qreal backgroundOpacity() const;
0050 
0051     qreal leftPadding() const;
0052     void setLeftPadding(qreal padding);
0053 
0054     qreal topPadding() const;
0055     void setTopPadding(qreal padding);
0056 
0057     qreal rightPadding() const;
0058     void setRightPadding(qreal padding);
0059 
0060     qreal bottomPadding() const;
0061     void setBottomPadding(qreal padding);
0062 
0063     QString verticalAlign() const;
0064     void setVerticalAlign(const QString& align);
0065 
0066     bool glyphOrientation() const;
0067     void setGlyphOrientation(bool orientation);
0068 
0069     void setTextStyle(const KoGenStyle& style);
0070     void setParagraphStyle(const KoGenStyle& style);
0071     KoGenStyle styleProperties() const;
0072 
0073 protected:
0074     void prepareStyle( KoGenStyle& style ) const override;
0075     QString defaultPrefix() const override;
0076     KoGenStyle::Type styleType() const override;
0077     KoGenStyle::Type automaticstyleType() const override;
0078     const char* styleFamilyName() const override;
0079 
0080 private:
0081     KoBorder* m_borders;
0082     QColor m_backgroundColor;
0083     qreal m_backgroundOpacity;
0084 
0085     qreal m_leftPadding;
0086     qreal m_topPadding;
0087     qreal m_rightPadding;
0088     qreal m_bottomPadding;
0089 
0090     QString m_verticalAlign;
0091     bool m_glyphOrientation;
0092 
0093     KoGenStyle m_styleProperties;
0094 };
0095 
0096 #endif