diff --git a/QXlsx/source/xlsxcell.cpp b/QXlsx/source/xlsxcell.cpp index 18ae274..e65be26 100644 --- a/QXlsx/source/xlsxcell.cpp +++ b/QXlsx/source/xlsxcell.cpp @@ -96,7 +96,8 @@ Cell::Cell(const Cell * const cell): */ Cell::~Cell() { - delete d_ptr; + if ( NULL != d_ptr ) + delete d_ptr; } /*! @@ -105,6 +106,7 @@ Cell::~Cell() Cell::CellType Cell::cellType() const { Q_D(const Cell); + return d->cellType; } @@ -114,6 +116,7 @@ Cell::CellType Cell::cellType() const QVariant Cell::value() const { Q_D(const Cell); + return d->value; } @@ -202,6 +205,7 @@ QVariant Cell::readValue() const Format Cell::format() const { Q_D(const Cell); + return d->format; } @@ -211,6 +215,7 @@ Format Cell::format() const bool Cell::hasFormula() const { Q_D(const Cell); + return d->formula.isValid(); } @@ -220,6 +225,7 @@ bool Cell::hasFormula() const CellFormula Cell::formula() const { Q_D(const Cell); + return d->formula; } @@ -236,10 +242,6 @@ bool Cell::isDateTime() const bool isValidFormat = d->format.isValid(); bool isDateTimeFormat = d->format.isDateTimeFormat(); - // NOTICE: google spreadsheet data is not adoptable. - // cell style(10): cellType is SharedStringType. strValue is '1900. 1. 9'. - // cell style(12): cellType is SharedStringType. strValue is '1900. 1. 11 AM 12:00:00'. - if ( cellType == NumberType && dValue >= 0 && isValidFormat && @@ -257,8 +259,10 @@ bool Cell::isDateTime() const QDateTime Cell::dateTime() const { Q_D(const Cell); + if (!isDateTime()) return QDateTime(); + return datetimeFromNumber(d->value.toDouble(), d->parent->workbook()->isDate1904()); } diff --git a/QXlsx/source/xlsxformat.cpp b/QXlsx/source/xlsxformat.cpp index 410bd27..6007985 100644 --- a/QXlsx/source/xlsxformat.cpp +++ b/QXlsx/source/xlsxformat.cpp @@ -28,26 +28,26 @@ QT_BEGIN_NAMESPACE_XLSX FormatPrivate::FormatPrivate() - : dirty(true) - , font_dirty(true), font_index_valid(false), font_index(0) - , fill_dirty(true), fill_index_valid(false), fill_index(0) - , border_dirty(true), border_index_valid(false), border_index(0) - , xf_index(-1), xf_indexValid(false) - , is_dxf_fomat(false), dxf_index(-1), dxf_indexValid(false) - , theme(0) + : dirty(true) + , font_dirty(true), font_index_valid(false), font_index(0) + , fill_dirty(true), fill_index_valid(false), fill_index(0) + , border_dirty(true), border_index_valid(false), border_index(0) + , xf_index(-1), xf_indexValid(false) + , is_dxf_fomat(false), dxf_index(-1), dxf_indexValid(false) + , theme(0) { } FormatPrivate::FormatPrivate(const FormatPrivate &other) - : QSharedData(other) - , dirty(other.dirty), formatKey(other.formatKey) - , font_dirty(other.font_dirty), font_index_valid(other.font_index_valid), font_key(other.font_key), font_index(other.font_index) - , fill_dirty(other.fill_dirty), fill_index_valid(other.fill_index_valid), fill_key(other.fill_key), fill_index(other.fill_index) - , border_dirty(other.border_dirty), border_index_valid(other.border_index_valid), border_key(other.border_key), border_index(other.border_index) - , xf_index(other.xf_index), xf_indexValid(other.xf_indexValid) - , is_dxf_fomat(other.is_dxf_fomat), dxf_index(other.dxf_index), dxf_indexValid(other.dxf_indexValid) - , theme(other.theme) - , properties(other.properties) + : QSharedData(other) + , dirty(other.dirty), formatKey(other.formatKey) + , font_dirty(other.font_dirty), font_index_valid(other.font_index_valid), font_key(other.font_key), font_index(other.font_index) + , fill_dirty(other.fill_dirty), fill_index_valid(other.fill_index_valid), fill_key(other.fill_key), fill_index(other.fill_index) + , border_dirty(other.border_dirty), border_index_valid(other.border_index_valid), border_key(other.border_key), border_index(other.border_index) + , xf_index(other.xf_index), xf_indexValid(other.xf_indexValid) + , is_dxf_fomat(other.is_dxf_fomat), dxf_index(other.dxf_index), dxf_indexValid(other.dxf_indexValid) + , theme(other.theme) + , properties(other.properties) { } @@ -176,14 +176,14 @@ FormatPrivate::~FormatPrivate() */ Format::Format() { - //The d pointer is initialized with a null pointer + //The d pointer is initialized with a null pointer } /*! Creates a new format with the same attributes as the \a other format. */ Format::Format(const Format &other) - :d(other.d) + :d(other.d) { } @@ -194,8 +194,8 @@ Format::Format(const Format &other) */ Format &Format::operator =(const Format &other) { - d = other.d; - return *this; + d = other.d; + return *this; } /*! @@ -210,7 +210,7 @@ Format::~Format() */ int Format::numberFormatIndex() const { - return intProperty(FormatPrivate::P_NumFmt_Id, 0); + return intProperty(FormatPrivate::P_NumFmt_Id, 0); } /*! @@ -220,8 +220,8 @@ int Format::numberFormatIndex() const */ void Format::setNumberFormatIndex(int format) { - setProperty(FormatPrivate::P_NumFmt_Id, format); - clearProperty(FormatPrivate::P_NumFmt_FormatCode); + setProperty(FormatPrivate::P_NumFmt_Id, format); + clearProperty(FormatPrivate::P_NumFmt_FormatCode); } /*! @@ -231,7 +231,7 @@ void Format::setNumberFormatIndex(int format) */ QString Format::numberFormat() const { - return stringProperty(FormatPrivate::P_NumFmt_FormatCode); + return stringProperty(FormatPrivate::P_NumFmt_FormatCode); } /*! @@ -240,10 +240,10 @@ QString Format::numberFormat() const */ void Format::setNumberFormat(const QString &format) { - if (format.isEmpty()) - return; - setProperty(FormatPrivate::P_NumFmt_FormatCode, format); - clearProperty(FormatPrivate::P_NumFmt_Id); //numFmt id must be re-generated. + if (format.isEmpty()) + return; + setProperty(FormatPrivate::P_NumFmt_FormatCode, format); + clearProperty(FormatPrivate::P_NumFmt_Id); //numFmt id must be re-generated. } /*! @@ -253,62 +253,62 @@ bool Format::isDateTimeFormat() const { //NOTICE: - if (hasProperty(FormatPrivate::P_NumFmt_FormatCode)) + if (hasProperty(FormatPrivate::P_NumFmt_FormatCode)) { - //Custom numFmt, so - //Gauss from the number string - return NumFormatParser::isDateTime(numberFormat()); - } + //Custom numFmt, so + //Gauss from the number string + return NumFormatParser::isDateTime(numberFormat()); + } else if (hasProperty(FormatPrivate::P_NumFmt_Id)) { - //Non-custom numFmt - int idx = numberFormatIndex(); + //Non-custom numFmt + int idx = numberFormatIndex(); - //Is built-in date time number id? - if ((idx >= 14 && idx <= 22) || (idx >= 45 && idx <= 47)) - return true; + //Is built-in date time number id? + if ((idx >= 14 && idx <= 22) || (idx >= 45 && idx <= 47)) + return true; - if ((idx >= 27 && idx <= 36) || (idx >= 50 && idx <= 58)) //Used in CHS\CHT\JPN\KOR - return true; - } + if ((idx >= 27 && idx <= 36) || (idx >= 50 && idx <= 58)) //Used in CHS\CHT\JPN\KOR + return true; + } - return false; + return false; } /*! - \internal - Set a custom num \a format with the given \a id. + \internal + Set a custom num \a format with the given \a id. */ void Format::setNumberFormat(int id, const QString &format) { - setProperty(FormatPrivate::P_NumFmt_Id, id); - setProperty(FormatPrivate::P_NumFmt_FormatCode, format); + setProperty(FormatPrivate::P_NumFmt_Id, id); + setProperty(FormatPrivate::P_NumFmt_FormatCode, format); } /*! - \internal - Called by styles to fix the numFmt + \internal + Called by styles to fix the numFmt */ void Format::fixNumberFormat(int id, const QString &format) { - setProperty(FormatPrivate::P_NumFmt_Id, id, 0, false); - setProperty(FormatPrivate::P_NumFmt_FormatCode, format, QString(), false); + setProperty(FormatPrivate::P_NumFmt_Id, id, 0, false); + setProperty(FormatPrivate::P_NumFmt_FormatCode, format, QString(), false); } /*! - \internal - Return true if the format has number format. + \internal + Return true if the format has number format. */ bool Format::hasNumFmtData() const { - if (!d) - return false; + if (!d) + return false; - if (hasProperty(FormatPrivate::P_NumFmt_Id) - || hasProperty(FormatPrivate::P_NumFmt_FormatCode)) { - return true; - } - return false; + if (hasProperty(FormatPrivate::P_NumFmt_Id) + || hasProperty(FormatPrivate::P_NumFmt_FormatCode)) { + return true; + } + return false; } /*! @@ -316,7 +316,7 @@ bool Format::hasNumFmtData() const */ int Format::fontSize() const { - return intProperty(FormatPrivate::P_Font_Size); + return intProperty(FormatPrivate::P_Font_Size); } /*! @@ -324,7 +324,7 @@ int Format::fontSize() const */ void Format::setFontSize(int size) { - setProperty(FormatPrivate::P_Font_Size, size, 0); + setProperty(FormatPrivate::P_Font_Size, size, 0); } /*! @@ -332,7 +332,7 @@ void Format::setFontSize(int size) */ bool Format::fontItalic() const { - return boolProperty(FormatPrivate::P_Font_Italic); + return boolProperty(FormatPrivate::P_Font_Italic); } /*! @@ -340,7 +340,7 @@ bool Format::fontItalic() const */ void Format::setFontItalic(bool italic) { - setProperty(FormatPrivate::P_Font_Italic, italic, false); + setProperty(FormatPrivate::P_Font_Italic, italic, false); } /*! @@ -348,7 +348,7 @@ void Format::setFontItalic(bool italic) */ bool Format::fontStrikeOut() const { - return boolProperty(FormatPrivate::P_Font_StrikeOut); + return boolProperty(FormatPrivate::P_Font_StrikeOut); } /*! @@ -356,7 +356,7 @@ bool Format::fontStrikeOut() const */ void Format::setFontStrikeOut(bool strikeOut) { - setProperty(FormatPrivate::P_Font_StrikeOut, strikeOut, false); + setProperty(FormatPrivate::P_Font_StrikeOut, strikeOut, false); } /*! @@ -364,9 +364,9 @@ void Format::setFontStrikeOut(bool strikeOut) */ QColor Format::fontColor() const { - if (hasProperty(FormatPrivate::P_Font_Color)) - return colorProperty(FormatPrivate::P_Font_Color); - return QColor(); + if (hasProperty(FormatPrivate::P_Font_Color)) + return colorProperty(FormatPrivate::P_Font_Color); + return QColor(); } /*! @@ -374,7 +374,7 @@ QColor Format::fontColor() const */ void Format::setFontColor(const QColor &color) { - setProperty(FormatPrivate::P_Font_Color, XlsxColor(color), XlsxColor()); + setProperty(FormatPrivate::P_Font_Color, XlsxColor(color), XlsxColor()); } /*! @@ -382,7 +382,7 @@ void Format::setFontColor(const QColor &color) */ bool Format::fontBold() const { - return boolProperty(FormatPrivate::P_Font_Bold); + return boolProperty(FormatPrivate::P_Font_Bold); } /*! @@ -390,7 +390,7 @@ bool Format::fontBold() const */ void Format::setFontBold(bool bold) { - setProperty(FormatPrivate::P_Font_Bold, bold, false); + setProperty(FormatPrivate::P_Font_Bold, bold, false); } /*! @@ -398,7 +398,7 @@ void Format::setFontBold(bool bold) */ Format::FontScript Format::fontScript() const { - return static_cast(intProperty(FormatPrivate::P_Font_Script)); + return static_cast(intProperty(FormatPrivate::P_Font_Script)); } /*! @@ -406,7 +406,7 @@ Format::FontScript Format::fontScript() const */ void Format::setFontScript(FontScript script) { - setProperty(FormatPrivate::P_Font_Script, script, FontScriptNormal); + setProperty(FormatPrivate::P_Font_Script, script, FontScriptNormal); } /*! @@ -414,7 +414,7 @@ void Format::setFontScript(FontScript script) */ Format::FontUnderline Format::fontUnderline() const { - return static_cast(intProperty(FormatPrivate::P_Font_Underline)); + return static_cast(intProperty(FormatPrivate::P_Font_Underline)); } /*! @@ -422,7 +422,7 @@ Format::FontUnderline Format::fontUnderline() const */ void Format::setFontUnderline(FontUnderline underline) { - setProperty(FormatPrivate::P_Font_Underline, underline, FontUnderlineNone); + setProperty(FormatPrivate::P_Font_Underline, underline, FontUnderlineNone); } /*! @@ -430,7 +430,7 @@ void Format::setFontUnderline(FontUnderline underline) */ bool Format::fontOutline() const { - return boolProperty(FormatPrivate::P_Font_Outline); + return boolProperty(FormatPrivate::P_Font_Outline); } /*! @@ -438,7 +438,7 @@ bool Format::fontOutline() const */ void Format::setFontOutline(bool outline) { - setProperty(FormatPrivate::P_Font_Outline, outline, false); + setProperty(FormatPrivate::P_Font_Outline, outline, false); } /*! @@ -446,7 +446,7 @@ void Format::setFontOutline(bool outline) */ QString Format::fontName() const { - return stringProperty(FormatPrivate::P_Font_Name, QStringLiteral("Calibri")); + return stringProperty(FormatPrivate::P_Font_Name, QStringLiteral("Calibri")); } /*! @@ -454,7 +454,7 @@ QString Format::fontName() const */ void Format::setFontName(const QString &name) { - setProperty(FormatPrivate::P_Font_Name, name, QStringLiteral("Calibri")); + setProperty(FormatPrivate::P_Font_Name, name, QStringLiteral("Calibri")); } /*! @@ -465,7 +465,7 @@ QFont Format::font() const QFont font; font.setFamily(fontName()); if (fontSize() > 0) - font.setPointSize(fontSize()); + font.setPointSize(fontSize()); font.setBold(fontBold()); font.setItalic(fontItalic()); font.setUnderline(fontUnderline()!=FontUnderlineNone); @@ -478,13 +478,13 @@ QFont Format::font() const */ void Format::setFont(const QFont &font) { - setFontName(font.family()); - if (font.pointSize() > 0) - setFontSize(font.pointSize()); - setFontBold(font.bold()); - setFontItalic(font.italic()); - setFontUnderline(font.underline() ? FontUnderlineSingle : FontUnderlineNone); - setFontStrikeOut(font.strikeOut()); + setFontName(font.family()); + if (font.pointSize() > 0) + setFontSize(font.pointSize()); + setFontBold(font.bold()); + setFontItalic(font.italic()); + setFontUnderline(font.underline() ? FontUnderlineSingle : FontUnderlineNone); + setFontStrikeOut(font.strikeOut()); } /*! @@ -494,9 +494,9 @@ void Format::setFont(const QFont &font) */ bool Format::fontIndexValid() const { - if (!hasFontData()) - return false; - return d->font_index_valid; + if (!hasFontData()) + return false; + return d->font_index_valid; } /*! @@ -504,10 +504,10 @@ bool Format::fontIndexValid() const */ int Format::fontIndex() const { - if (fontIndexValid()) - return d->font_index; + if (fontIndexValid()) + return d->font_index; - return 0; + return 0; } /*! @@ -515,8 +515,8 @@ int Format::fontIndex() const */ void Format::setFontIndex(int index) { - d->font_index = index; - d->font_index_valid = true; + d->font_index = index; + d->font_index_valid = true; } /*! @@ -524,38 +524,38 @@ void Format::setFontIndex(int index) */ QByteArray Format::fontKey() const { - if (isEmpty()) - return QByteArray(); + if (isEmpty()) + return QByteArray(); - if (d->font_dirty) { - QByteArray key; - QDataStream stream(&key, QIODevice::WriteOnly); - for (int i=FormatPrivate::P_Font_STARTID; iproperties.contains(i)) - stream << i << d->properties[i]; - }; + if (d->font_dirty) { + QByteArray key; + QDataStream stream(&key, QIODevice::WriteOnly); + for (int i=FormatPrivate::P_Font_STARTID; iproperties.contains(i)) + stream << i << d->properties[i]; + }; - const_cast(this)->d->font_key = key; - const_cast(this)->d->font_dirty = false; - } + const_cast(this)->d->font_key = key; + const_cast(this)->d->font_dirty = false; + } - return d->font_key; + return d->font_key; } /*! - \internal - Return true if the format has font format, otherwise return false. + \internal + Return true if the format has font format, otherwise return false. */ bool Format::hasFontData() const { - if (!d) - return false; + if (!d) + return false; - for (int i=FormatPrivate::P_Font_STARTID; i(intProperty(FormatPrivate::P_Alignment_AlignH, AlignHGeneral)); + return static_cast(intProperty(FormatPrivate::P_Alignment_AlignH, AlignHGeneral)); } /*! @@ -571,17 +571,17 @@ Format::HorizontalAlignment Format::horizontalAlignment() const */ void Format::setHorizontalAlignment(HorizontalAlignment align) { - if (hasProperty(FormatPrivate::P_Alignment_Indent) - &&(align != AlignHGeneral && align != AlignLeft && align != AlignRight && align != AlignHDistributed)) { - clearProperty(FormatPrivate::P_Alignment_Indent); - } + if (hasProperty(FormatPrivate::P_Alignment_Indent) + &&(align != AlignHGeneral && align != AlignLeft && align != AlignRight && align != AlignHDistributed)) { + clearProperty(FormatPrivate::P_Alignment_Indent); + } - if (hasProperty(FormatPrivate::P_Alignment_ShinkToFit) - && (align == AlignHFill || align == AlignHJustify || align == AlignHDistributed)) { - clearProperty(FormatPrivate::P_Alignment_ShinkToFit); - } + if (hasProperty(FormatPrivate::P_Alignment_ShinkToFit) + && (align == AlignHFill || align == AlignHJustify || align == AlignHDistributed)) { + clearProperty(FormatPrivate::P_Alignment_ShinkToFit); + } - setProperty(FormatPrivate::P_Alignment_AlignH, align, AlignHGeneral); + setProperty(FormatPrivate::P_Alignment_AlignH, align, AlignHGeneral); } /*! @@ -589,7 +589,7 @@ void Format::setHorizontalAlignment(HorizontalAlignment align) */ Format::VerticalAlignment Format::verticalAlignment() const { - return static_cast(intProperty(FormatPrivate::P_Alignment_AlignV, AlignBottom)); + return static_cast(intProperty(FormatPrivate::P_Alignment_AlignV, AlignBottom)); } /*! @@ -597,7 +597,7 @@ Format::VerticalAlignment Format::verticalAlignment() const */ void Format::setVerticalAlignment(VerticalAlignment align) { - setProperty(FormatPrivate::P_Alignment_AlignV, align, AlignBottom); + setProperty(FormatPrivate::P_Alignment_AlignV, align, AlignBottom); } /*! @@ -605,7 +605,7 @@ void Format::setVerticalAlignment(VerticalAlignment align) */ bool Format::textWrap() const { - return boolProperty(FormatPrivate::P_Alignment_Wrap); + return boolProperty(FormatPrivate::P_Alignment_Wrap); } /*! @@ -613,10 +613,10 @@ bool Format::textWrap() const */ void Format::setTextWarp(bool wrap) { - if (wrap && hasProperty(FormatPrivate::P_Alignment_ShinkToFit)) - clearProperty(FormatPrivate::P_Alignment_ShinkToFit); + if (wrap && hasProperty(FormatPrivate::P_Alignment_ShinkToFit)) + clearProperty(FormatPrivate::P_Alignment_ShinkToFit); - setProperty(FormatPrivate::P_Alignment_Wrap, wrap, false); + setProperty(FormatPrivate::P_Alignment_Wrap, wrap, false); } /*! @@ -624,7 +624,7 @@ void Format::setTextWarp(bool wrap) */ int Format::rotation() const { - return intProperty(FormatPrivate::P_Alignment_Rotation); + return intProperty(FormatPrivate::P_Alignment_Rotation); } /*! @@ -632,7 +632,7 @@ int Format::rotation() const */ void Format::setRotation(int rotation) { - setProperty(FormatPrivate::P_Alignment_Rotation, rotation, 0); + setProperty(FormatPrivate::P_Alignment_Rotation, rotation, 0); } /*! @@ -640,7 +640,7 @@ void Format::setRotation(int rotation) */ int Format::indent() const { - return intProperty(FormatPrivate::P_Alignment_Indent); + return intProperty(FormatPrivate::P_Alignment_Indent); } /*! @@ -648,15 +648,15 @@ int Format::indent() const */ void Format::setIndent(int indent) { - if (indent && hasProperty(FormatPrivate::P_Alignment_AlignH)) { - HorizontalAlignment hl = horizontalAlignment(); + if (indent && hasProperty(FormatPrivate::P_Alignment_AlignH)) { + HorizontalAlignment hl = horizontalAlignment(); - if (hl != AlignHGeneral && hl != AlignLeft && hl!= AlignRight && hl!= AlignHJustify) { - setHorizontalAlignment(AlignLeft); - } - } + if (hl != AlignHGeneral && hl != AlignLeft && hl!= AlignRight && hl!= AlignHJustify) { + setHorizontalAlignment(AlignLeft); + } + } - setProperty(FormatPrivate::P_Alignment_Indent, indent, 0); + setProperty(FormatPrivate::P_Alignment_Indent, indent, 0); } /*! @@ -664,7 +664,7 @@ void Format::setIndent(int indent) */ bool Format::shrinkToFit() const { - return boolProperty(FormatPrivate::P_Alignment_ShinkToFit); + return boolProperty(FormatPrivate::P_Alignment_ShinkToFit); } /*! @@ -672,16 +672,16 @@ bool Format::shrinkToFit() const */ void Format::setShrinkToFit(bool shink) { - if (shink && hasProperty(FormatPrivate::P_Alignment_Wrap)) - clearProperty(FormatPrivate::P_Alignment_Wrap); + if (shink && hasProperty(FormatPrivate::P_Alignment_Wrap)) + clearProperty(FormatPrivate::P_Alignment_Wrap); - if (shink && hasProperty(FormatPrivate::P_Alignment_AlignH)) { - HorizontalAlignment hl = horizontalAlignment(); - if (hl == AlignHFill || hl == AlignHJustify || hl == AlignHDistributed) - setHorizontalAlignment(AlignLeft); - } + if (shink && hasProperty(FormatPrivate::P_Alignment_AlignH)) { + HorizontalAlignment hl = horizontalAlignment(); + if (hl == AlignHFill || hl == AlignHJustify || hl == AlignHDistributed) + setHorizontalAlignment(AlignLeft); + } - setProperty(FormatPrivate::P_Alignment_ShinkToFit, shink, false); + setProperty(FormatPrivate::P_Alignment_ShinkToFit, shink, false); } /*! @@ -689,14 +689,14 @@ void Format::setShrinkToFit(bool shink) */ bool Format::hasAlignmentData() const { - if (!d) - return false; + if (!d) + return false; - for (int i=FormatPrivate::P_Alignment_STARTID; i(intProperty(FormatPrivate::P_Border_LeftStyle)); + return static_cast(intProperty(FormatPrivate::P_Border_LeftStyle)); } /*! @@ -734,7 +734,7 @@ Format::BorderStyle Format::leftBorderStyle() const */ void Format::setLeftBorderStyle(BorderStyle style) { - setProperty(FormatPrivate::P_Border_LeftStyle, style, BorderNone); + setProperty(FormatPrivate::P_Border_LeftStyle, style, BorderNone); } /*! @@ -742,181 +742,181 @@ void Format::setLeftBorderStyle(BorderStyle style) */ QColor Format::leftBorderColor() const { - return colorProperty(FormatPrivate::P_Border_LeftColor); + return colorProperty(FormatPrivate::P_Border_LeftColor); } /*! - Sets the left border color to the given \a color + Sets the left border color to the given \a color */ void Format::setLeftBorderColor(const QColor &color) { - setProperty(FormatPrivate::P_Border_LeftColor, XlsxColor(color), XlsxColor()); + setProperty(FormatPrivate::P_Border_LeftColor, XlsxColor(color), XlsxColor()); } /*! - Returns the right border style. + Returns the right border style. */ Format::BorderStyle Format::rightBorderStyle() const { - return static_cast(intProperty(FormatPrivate::P_Border_RightStyle)); + return static_cast(intProperty(FormatPrivate::P_Border_RightStyle)); } /*! - Sets the right border style to the given \a style. + Sets the right border style to the given \a style. */ void Format::setRightBorderStyle(BorderStyle style) { - setProperty(FormatPrivate::P_Border_RightStyle, style, BorderNone); + setProperty(FormatPrivate::P_Border_RightStyle, style, BorderNone); } /*! - Returns the right border color. + Returns the right border color. */ QColor Format::rightBorderColor() const { - return colorProperty(FormatPrivate::P_Border_RightColor); + return colorProperty(FormatPrivate::P_Border_RightColor); } /*! - Sets the right border color to the given \a color + Sets the right border color to the given \a color */ void Format::setRightBorderColor(const QColor &color) { - setProperty(FormatPrivate::P_Border_RightColor, XlsxColor(color), XlsxColor()); + setProperty(FormatPrivate::P_Border_RightColor, XlsxColor(color), XlsxColor()); } /*! - Returns the top border style. + Returns the top border style. */ Format::BorderStyle Format::topBorderStyle() const { - return static_cast(intProperty(FormatPrivate::P_Border_TopStyle)); + return static_cast(intProperty(FormatPrivate::P_Border_TopStyle)); } /*! - Sets the top border style to the given \a style. + Sets the top border style to the given \a style. */ void Format::setTopBorderStyle(BorderStyle style) { - setProperty(FormatPrivate::P_Border_TopStyle, style, BorderNone); + setProperty(FormatPrivate::P_Border_TopStyle, style, BorderNone); } /*! - Returns the top border color. + Returns the top border color. */ QColor Format::topBorderColor() const { - return colorProperty(FormatPrivate::P_Border_TopColor); + return colorProperty(FormatPrivate::P_Border_TopColor); } /*! - Sets the top border color to the given \a color. + Sets the top border color to the given \a color. */ void Format::setTopBorderColor(const QColor &color) { - setProperty(FormatPrivate::P_Border_TopColor, XlsxColor(color), XlsxColor()); + setProperty(FormatPrivate::P_Border_TopColor, XlsxColor(color), XlsxColor()); } /*! - Returns the bottom border style. + Returns the bottom border style. */ Format::BorderStyle Format::bottomBorderStyle() const { - return static_cast(intProperty(FormatPrivate::P_Border_BottomStyle)); + return static_cast(intProperty(FormatPrivate::P_Border_BottomStyle)); } /*! - Sets the bottom border style to the given \a style. + Sets the bottom border style to the given \a style. */ void Format::setBottomBorderStyle(BorderStyle style) { - setProperty(FormatPrivate::P_Border_BottomStyle, style, BorderNone); + setProperty(FormatPrivate::P_Border_BottomStyle, style, BorderNone); } /*! - Returns the bottom border color. + Returns the bottom border color. */ QColor Format::bottomBorderColor() const { - return colorProperty(FormatPrivate::P_Border_BottomColor); + return colorProperty(FormatPrivate::P_Border_BottomColor); } /*! - Sets the bottom border color to the given \a color. + Sets the bottom border color to the given \a color. */ void Format::setBottomBorderColor(const QColor &color) { - setProperty(FormatPrivate::P_Border_BottomColor, XlsxColor(color), XlsxColor()); + setProperty(FormatPrivate::P_Border_BottomColor, XlsxColor(color), XlsxColor()); } /*! - Return the diagonla border style. + Return the diagonla border style. */ Format::BorderStyle Format::diagonalBorderStyle() const { - return static_cast(intProperty(FormatPrivate::P_Border_DiagonalStyle)); + return static_cast(intProperty(FormatPrivate::P_Border_DiagonalStyle)); } /*! - Sets the diagonal border style to the given \a style. + Sets the diagonal border style to the given \a style. */ void Format::setDiagonalBorderStyle(BorderStyle style) { - setProperty(FormatPrivate::P_Border_DiagonalStyle, style, BorderNone); + setProperty(FormatPrivate::P_Border_DiagonalStyle, style, BorderNone); } /*! - Returns the diagonal border type. + Returns the diagonal border type. */ Format::DiagonalBorderType Format::diagonalBorderType() const { - return static_cast(intProperty(FormatPrivate::P_Border_DiagonalType)); + return static_cast(intProperty(FormatPrivate::P_Border_DiagonalType)); } /*! - Sets the diagonal border type to the given \a style + Sets the diagonal border type to the given \a style */ void Format::setDiagonalBorderType(DiagonalBorderType style) { - setProperty(FormatPrivate::P_Border_DiagonalType, style, DiagonalBorderNone); + setProperty(FormatPrivate::P_Border_DiagonalType, style, DiagonalBorderNone); } /*! - Returns the diagonal border color. + Returns the diagonal border color. */ QColor Format::diagonalBorderColor() const { - return colorProperty(FormatPrivate::P_Border_DiagonalColor); + return colorProperty(FormatPrivate::P_Border_DiagonalColor); } /*! - Sets the diagonal border color to the given \a color + Sets the diagonal border color to the given \a color */ void Format::setDiagonalBorderColor(const QColor &color) { - setProperty(FormatPrivate::P_Border_DiagonalColor, XlsxColor(color), XlsxColor()); + setProperty(FormatPrivate::P_Border_DiagonalColor, XlsxColor(color), XlsxColor()); } /*! - \internal - Returns whether this format has been set valid border index. + \internal + Returns whether this format has been set valid border index. */ bool Format::borderIndexValid() const { - if (!hasBorderData()) - return false; - return d->border_index_valid; + if (!hasBorderData()) + return false; + return d->border_index_valid; } /*! - \internal - Returns the border index. + \internal + Returns the border index. */ int Format::borderIndex() const { - if (borderIndexValid()) - return d->border_index; - return 0; + if (borderIndexValid()) + return d->border_index; + return 0; } /*! @@ -924,98 +924,98 @@ int Format::borderIndex() const */ void Format::setBorderIndex(int index) { - d->border_index = index; - d->border_index_valid = true; + d->border_index = index; + d->border_index_valid = true; } /*! \internal */ QByteArray Format::borderKey() const { - if (isEmpty()) - return QByteArray(); + if (isEmpty()) + return QByteArray(); - if (d->border_dirty) { - QByteArray key; - QDataStream stream(&key, QIODevice::WriteOnly); - for (int i=FormatPrivate::P_Border_STARTID; iproperties.contains(i)) - stream << i << d->properties[i]; - }; + if (d->border_dirty) { + QByteArray key; + QDataStream stream(&key, QIODevice::WriteOnly); + for (int i=FormatPrivate::P_Border_STARTID; iproperties.contains(i)) + stream << i << d->properties[i]; + }; - const_cast(this)->d->border_key = key; - const_cast(this)->d->border_dirty = false; - } + const_cast(this)->d->border_key = key; + const_cast(this)->d->border_dirty = false; + } - return d->border_key; + return d->border_key; } /*! - \internal - Return true if the format has border format, otherwise return false. + \internal + Return true if the format has border format, otherwise return false. */ bool Format::hasBorderData() const { - if (!d) - return false; + if (!d) + return false; - for (int i=FormatPrivate::P_Border_STARTID; i(intProperty(FormatPrivate::P_Fill_Pattern, PatternNone)); + return static_cast(intProperty(FormatPrivate::P_Fill_Pattern, PatternNone)); } /*! - Sets the fill pattern to the given \a pattern. + Sets the fill pattern to the given \a pattern. */ void Format::setFillPattern(FillPattern pattern) { - setProperty(FormatPrivate::P_Fill_Pattern, pattern, PatternNone); + setProperty(FormatPrivate::P_Fill_Pattern, pattern, PatternNone); } /*! - Returns the foreground color of the pattern. + Returns the foreground color of the pattern. */ QColor Format::patternForegroundColor() const { - return colorProperty(FormatPrivate::P_Fill_FgColor); + return colorProperty(FormatPrivate::P_Fill_FgColor); } /*! - Sets the foreground color of the pattern with the given \a color. + Sets the foreground color of the pattern with the given \a color. */ void Format::setPatternForegroundColor(const QColor &color) { - if (color.isValid() && !hasProperty(FormatPrivate::P_Fill_Pattern)) - setFillPattern(PatternSolid); - setProperty(FormatPrivate::P_Fill_FgColor, XlsxColor(color), XlsxColor()); + if (color.isValid() && !hasProperty(FormatPrivate::P_Fill_Pattern)) + setFillPattern(PatternSolid); + setProperty(FormatPrivate::P_Fill_FgColor, XlsxColor(color), XlsxColor()); } /*! - Returns the background color of the pattern. + Returns the background color of the pattern. */ QColor Format::patternBackgroundColor() const { - return colorProperty(FormatPrivate::P_Fill_BgColor); + return colorProperty(FormatPrivate::P_Fill_BgColor); } /*! - Sets the background color of the pattern with the given \a color. + Sets the background color of the pattern with the given \a color. */ void Format::setPatternBackgroundColor(const QColor &color) { - if (color.isValid() && !hasProperty(FormatPrivate::P_Fill_Pattern)) - setFillPattern(PatternSolid); - setProperty(FormatPrivate::P_Fill_BgColor, XlsxColor(color), XlsxColor()); + if (color.isValid() && !hasProperty(FormatPrivate::P_Fill_Pattern)) + setFillPattern(PatternSolid); + setProperty(FormatPrivate::P_Fill_BgColor, XlsxColor(color), XlsxColor()); } /*! @@ -1023,9 +1023,9 @@ void Format::setPatternBackgroundColor(const QColor &color) */ bool Format::fillIndexValid() const { - if (!hasFillData()) - return false; - return d->fill_index_valid; + if (!hasFillData()) + return false; + return d->fill_index_valid; } /*! @@ -1033,9 +1033,9 @@ bool Format::fillIndexValid() const */ int Format::fillIndex() const { - if (fillIndexValid()) - return d->fill_index; - return 0; + if (fillIndexValid()) + return d->fill_index; + return 0; } /*! @@ -1043,8 +1043,8 @@ int Format::fillIndex() const */ void Format::setFillIndex(int index) { - d->fill_index = index; - d->fill_index_valid = true; + d->fill_index = index; + d->fill_index_valid = true; } /*! @@ -1052,126 +1052,126 @@ void Format::setFillIndex(int index) */ QByteArray Format::fillKey() const { - if (isEmpty()) - return QByteArray(); + if (isEmpty()) + return QByteArray(); - if (d->fill_dirty) { - QByteArray key; - QDataStream stream(&key, QIODevice::WriteOnly); - for (int i=FormatPrivate::P_Fill_STARTID; iproperties.contains(i)) - stream << i << d->properties[i]; - }; + if (d->fill_dirty) { + QByteArray key; + QDataStream stream(&key, QIODevice::WriteOnly); + for (int i=FormatPrivate::P_Fill_STARTID; iproperties.contains(i)) + stream << i << d->properties[i]; + }; - const_cast(this)->d->fill_key = key; - const_cast(this)->d->fill_dirty = false; - } + const_cast(this)->d->fill_key = key; + const_cast(this)->d->fill_dirty = false; + } - return d->fill_key; + return d->fill_key; } /*! - \internal - Return true if the format has fill format, otherwise return false. + \internal + Return true if the format has fill format, otherwise return false. */ bool Format::hasFillData() const { - if (!d) - return false; + if (!d) + return false; - for (int i=FormatPrivate::P_Fill_STARTID; i