File indexing completed on 2024-12-01 13:11:43

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 KOCOLUMNSTYLE_H
0020 #define KOCOLUMNSTYLE_H
0021 
0022 #include "KoStyle.h"
0023 #include "koodf2_export.h"
0024 
0025 /**
0026  * \class KoColumnStyle
0027  * \brief represents a style to be applied to one or more columns.
0028  * 
0029  * As all the styles it can be shared
0030  */
0031 
0032 class KOODF2_EXPORT KoColumnStyle : public KoStyle
0033 {
0034     KoColumnStyle();
0035 public:
0036     KOSTYLE_DECLARE_SHARED_POINTER(KoColumnStyle)
0037 
0038     ~KoColumnStyle() override;
0039 
0040     enum BreakType {
0041         NoBreak,
0042         AutoBreak,
0043         ColumnBreak,
0044         PageBreak
0045     };
0046     void setBreakBefore(BreakType breakBefore);
0047     BreakType breakBefore() const;
0048 
0049     void setBreakAfter(BreakType breakAfter);
0050     BreakType breakAfter() const;
0051 
0052     enum WidthType {
0053         MinimumWidth,
0054         ExactWidth,
0055         OptimalWidth
0056     };
0057     void setWidth(qreal width);
0058     qreal width() const;
0059     void setWidthType(WidthType type);
0060     WidthType widthType() const;
0061 
0062 protected:
0063     void prepareStyle(KoGenStyle& style) const override;
0064     QString defaultPrefix() const override;
0065     KoGenStyle::Type styleType() const override;
0066     KoGenStyle::Type automaticstyleType() const override;
0067     const char* styleFamilyName() const override;
0068 
0069 private:
0070     BreakType m_breakAfter;
0071     BreakType m_breakBefore;
0072     qreal m_width;
0073     WidthType m_widthType;
0074 };
0075 
0076 #endif