|
@ -33,6 +33,7 @@ QT_BEGIN_NAMESPACE_XLSX |
|
|
FormatPrivate::FormatPrivate() |
|
|
FormatPrivate::FormatPrivate() |
|
|
: dirty(true) |
|
|
: dirty(true) |
|
|
, font_dirty(true), font_index_valid(false), font_index(-1) |
|
|
, font_dirty(true), font_index_valid(false), font_index(-1) |
|
|
|
|
|
, border_dirty(true), border_index_valid(false), border_index(-1) |
|
|
, xf_index(-1), xf_indexValid(false) |
|
|
, xf_index(-1), xf_indexValid(false) |
|
|
, is_dxf_fomat(false), dxf_index(-1), dxf_indexValid(false) |
|
|
, is_dxf_fomat(false), dxf_index(-1), dxf_indexValid(false) |
|
|
, theme(0) |
|
|
, theme(0) |
|
@ -42,9 +43,9 @@ FormatPrivate::FormatPrivate() |
|
|
FormatPrivate::FormatPrivate(const FormatPrivate &other) |
|
|
FormatPrivate::FormatPrivate(const FormatPrivate &other) |
|
|
: QSharedData(other) |
|
|
: QSharedData(other) |
|
|
, alignmentData(other.alignmentData) |
|
|
, alignmentData(other.alignmentData) |
|
|
, borderData(other.borderData), fillData(other.fillData), protectionData(other.protectionData) |
|
|
|
|
|
, dirty(other.dirty), formatKey(other.formatKey) |
|
|
, dirty(other.dirty), formatKey(other.formatKey) |
|
|
, font_dirty(other.dirty), font_index_valid(other.font_index_valid), font_key(other.font_key), font_index(other.font_index) |
|
|
, font_dirty(other.font_dirty), font_index_valid(other.font_index_valid), font_key(other.font_key), font_index(other.font_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) |
|
|
, 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) |
|
|
, is_dxf_fomat(other.is_dxf_fomat), dxf_index(other.dxf_index), dxf_indexValid(other.dxf_indexValid) |
|
|
, theme(other.theme) |
|
|
, theme(other.theme) |
|
@ -594,7 +595,7 @@ void Format::setBorderColor(const QColor &color) |
|
|
*/ |
|
|
*/ |
|
|
Format::BorderStyle Format::leftBorderStyle() const |
|
|
Format::BorderStyle Format::leftBorderStyle() const |
|
|
{ |
|
|
{ |
|
|
return d->borderData.left; |
|
|
return static_cast<BorderStyle>(intProperty(FormatPrivate::P_Border_LeftStyle)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/*!
|
|
|
/*!
|
|
@ -602,8 +603,7 @@ Format::BorderStyle Format::leftBorderStyle() const |
|
|
*/ |
|
|
*/ |
|
|
void Format::setLeftBorderStyle(BorderStyle style) |
|
|
void Format::setLeftBorderStyle(BorderStyle style) |
|
|
{ |
|
|
{ |
|
|
d->borderData.left = style; |
|
|
setProperty(FormatPrivate::P_Border_LeftStyle, style); |
|
|
d->borderData._dirty = true; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/*!
|
|
|
/*!
|
|
@ -611,137 +611,136 @@ void Format::setLeftBorderStyle(BorderStyle style) |
|
|
*/ |
|
|
*/ |
|
|
QColor Format::leftBorderColor() const |
|
|
QColor Format::leftBorderColor() const |
|
|
{ |
|
|
{ |
|
|
return d->borderData.leftColor; |
|
|
return colorProperty(FormatPrivate::P_Border_LeftColor); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void Format::setLeftBorderColor(const QColor &color) |
|
|
void Format::setLeftBorderColor(const QColor &color) |
|
|
{ |
|
|
{ |
|
|
d->borderData.leftColor = color; |
|
|
setProperty(FormatPrivate::P_Border_LeftColor, color); |
|
|
d->borderData._dirty = true; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Format::BorderStyle Format::rightBorderStyle() const |
|
|
Format::BorderStyle Format::rightBorderStyle() const |
|
|
{ |
|
|
{ |
|
|
return d->borderData.right; |
|
|
return static_cast<BorderStyle>(intProperty(FormatPrivate::P_Border_RightStyle)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void Format::setRightBorderStyle(BorderStyle style) |
|
|
void Format::setRightBorderStyle(BorderStyle style) |
|
|
{ |
|
|
{ |
|
|
d->borderData.right = style; |
|
|
setProperty(FormatPrivate::P_Border_RightStyle, style); |
|
|
d->borderData._dirty = true; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
QColor Format::rightBorderColor() const |
|
|
QColor Format::rightBorderColor() const |
|
|
{ |
|
|
{ |
|
|
return d->borderData.rightColor; |
|
|
return colorProperty(FormatPrivate::P_Border_RightColor); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void Format::setRightBorderColor(const QColor &color) |
|
|
void Format::setRightBorderColor(const QColor &color) |
|
|
{ |
|
|
{ |
|
|
d->borderData.rightColor = color; |
|
|
setProperty(FormatPrivate::P_Border_RightColor, color); |
|
|
d->borderData._dirty = true; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Format::BorderStyle Format::topBorderStyle() const |
|
|
Format::BorderStyle Format::topBorderStyle() const |
|
|
{ |
|
|
{ |
|
|
return d->borderData.top; |
|
|
return static_cast<BorderStyle>(intProperty(FormatPrivate::P_Border_TopStyle)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void Format::setTopBorderStyle(BorderStyle style) |
|
|
void Format::setTopBorderStyle(BorderStyle style) |
|
|
{ |
|
|
{ |
|
|
d->borderData.top = style; |
|
|
setProperty(FormatPrivate::P_Border_TopStyle, style); |
|
|
d->borderData._dirty = true; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
QColor Format::topBorderColor() const |
|
|
QColor Format::topBorderColor() const |
|
|
{ |
|
|
{ |
|
|
return d->borderData.topColor; |
|
|
return colorProperty(FormatPrivate::P_Border_TopColor); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void Format::setTopBorderColor(const QColor &color) |
|
|
void Format::setTopBorderColor(const QColor &color) |
|
|
{ |
|
|
{ |
|
|
d->borderData.topColor = color; |
|
|
setProperty(FormatPrivate::P_Border_TopColor, color); |
|
|
d->borderData._dirty = true; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Format::BorderStyle Format::bottomBorderStyle() const |
|
|
Format::BorderStyle Format::bottomBorderStyle() const |
|
|
{ |
|
|
{ |
|
|
return d->borderData.bottom; |
|
|
return static_cast<BorderStyle>(intProperty(FormatPrivate::P_Border_BottomStyle)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void Format::setBottomBorderStyle(BorderStyle style) |
|
|
void Format::setBottomBorderStyle(BorderStyle style) |
|
|
{ |
|
|
{ |
|
|
d->borderData.bottom = style; |
|
|
setProperty(FormatPrivate::P_Border_BottomStyle, style); |
|
|
d->borderData._dirty = true; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
QColor Format::bottomBorderColor() const |
|
|
QColor Format::bottomBorderColor() const |
|
|
{ |
|
|
{ |
|
|
return d->borderData.bottomColor; |
|
|
return colorProperty(FormatPrivate::P_Border_BottomColor); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void Format::setBottomBorderColor(const QColor &color) |
|
|
void Format::setBottomBorderColor(const QColor &color) |
|
|
{ |
|
|
{ |
|
|
d->borderData.bottomColor = color; |
|
|
setProperty(FormatPrivate::P_Border_BottomColor, color); |
|
|
d->borderData._dirty = true; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Format::BorderStyle Format::diagonalBorderStyle() const |
|
|
Format::BorderStyle Format::diagonalBorderStyle() const |
|
|
{ |
|
|
{ |
|
|
return d->borderData.diagonal; |
|
|
return static_cast<BorderStyle>(intProperty(FormatPrivate::P_Border_DiagonalStyle)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void Format::setDiagonalBorderStyle(BorderStyle style) |
|
|
void Format::setDiagonalBorderStyle(BorderStyle style) |
|
|
{ |
|
|
{ |
|
|
d->borderData.diagonal = style; |
|
|
setProperty(FormatPrivate::P_Border_DiagonalStyle, style); |
|
|
d->borderData._dirty = true; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Format::DiagonalBorderType Format::diagonalBorderType() const |
|
|
Format::DiagonalBorderType Format::diagonalBorderType() const |
|
|
{ |
|
|
{ |
|
|
return d->borderData.diagonalType; |
|
|
return static_cast<DiagonalBorderType>(intProperty(FormatPrivate::P_Border_DiagonalType)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void Format::setDiagonalBorderType(DiagonalBorderType style) |
|
|
void Format::setDiagonalBorderType(DiagonalBorderType style) |
|
|
{ |
|
|
{ |
|
|
d->borderData.diagonalType = style; |
|
|
setProperty(FormatPrivate::P_Border_DiagonalType, style); |
|
|
d->borderData._dirty = true; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
QColor Format::diagonalBorderColor() const |
|
|
QColor Format::diagonalBorderColor() const |
|
|
{ |
|
|
{ |
|
|
return d->borderData.diagonalColor; |
|
|
return colorProperty(FormatPrivate::P_Border_DiagonalColor); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void Format::setDiagonalBorderColor(const QColor &color) |
|
|
void Format::setDiagonalBorderColor(const QColor &color) |
|
|
{ |
|
|
{ |
|
|
d->borderData.diagonalColor = color; |
|
|
setProperty(FormatPrivate::P_Border_DiagonalColor, color); |
|
|
d->borderData._dirty = true; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
bool Format::borderIndexValid() const |
|
|
bool Format::borderIndexValid() const |
|
|
{ |
|
|
{ |
|
|
return d->borderData.indexValid(); |
|
|
return d->border_index_valid; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
int Format::borderIndex() const |
|
|
int Format::borderIndex() const |
|
|
{ |
|
|
{ |
|
|
return d->borderData.index(); |
|
|
return d->border_index; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void Format::setBorderIndex(int index) |
|
|
void Format::setBorderIndex(int index) |
|
|
{ |
|
|
{ |
|
|
d->borderData.setIndex(index); |
|
|
d->border_index = index; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/* Internal
|
|
|
/* Internal
|
|
|
*/ |
|
|
*/ |
|
|
QByteArray Format::borderKey() const |
|
|
QByteArray Format::borderKey() const |
|
|
{ |
|
|
{ |
|
|
if (d->borderData._dirty) |
|
|
if (d->border_dirty) { |
|
|
d->dirty = true; //Make sure formatKey() will be re-generated.
|
|
|
QByteArray key; |
|
|
|
|
|
QDataStream stream(&key, QIODevice::WriteOnly); |
|
|
|
|
|
for (int i=FormatPrivate::P_Border_STARTID; i<FormatPrivate::P_Border_ENDID; ++i) { |
|
|
|
|
|
if (d->property.contains(i)) |
|
|
|
|
|
stream << i << d->property[i]; |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const_cast<Format*>(this)->d->border_key = key; |
|
|
|
|
|
const_cast<Format*>(this)->d->border_dirty = false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return d->borderData.key(); |
|
|
return d->border_key; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Format::FillPattern Format::fillPattern() const |
|
|
Format::FillPattern Format::fillPattern() const |
|
@ -830,7 +829,7 @@ void Format::setLocked(bool locked) |
|
|
|
|
|
|
|
|
QByteArray Format::formatKey() const |
|
|
QByteArray Format::formatKey() const |
|
|
{ |
|
|
{ |
|
|
if (d->dirty || d->borderData._dirty || d->fillData._dirty) { |
|
|
if (d->dirty || d->fillData._dirty) { |
|
|
QByteArray key; |
|
|
QByteArray key; |
|
|
QDataStream stream(&key, QIODevice::WriteOnly); |
|
|
QDataStream stream(&key, QIODevice::WriteOnly); |
|
|
stream<<fontKey()<<borderKey()<<fillKey() |
|
|
stream<<fontKey()<<borderKey()<<fillKey() |
|
@ -933,6 +932,11 @@ void Format::setProperty(int propertyId, const QVariant &value) |
|
|
d->font_dirty = true; |
|
|
d->font_dirty = true; |
|
|
d->font_index_valid = false; |
|
|
d->font_index_valid = false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (propertyId >= FormatPrivate::P_Border_STARTID && propertyId < FormatPrivate::P_Border_ENDID) { |
|
|
|
|
|
d->border_dirty = true; |
|
|
|
|
|
d->border_index_valid = false; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/*!
|
|
|
/*!
|
|
|