Code refactor: Remove private class XlsxFormatAlignmentData and
XlsxFormatProtectionData
This commit is contained in:
+50
-110
@@ -43,7 +43,6 @@ FormatPrivate::FormatPrivate()
|
|||||||
|
|
||||||
FormatPrivate::FormatPrivate(const FormatPrivate &other)
|
FormatPrivate::FormatPrivate(const FormatPrivate &other)
|
||||||
: QSharedData(other)
|
: QSharedData(other)
|
||||||
, alignmentData(other.alignmentData) ,protectionData(other.protectionData)
|
|
||||||
, dirty(other.dirty), formatKey(other.formatKey)
|
, 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)
|
, 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)
|
, fill_dirty(other.fill_dirty), fill_index_valid(other.fill_index_valid), fill_key(other.fill_key), fill_index(other.fill_index)
|
||||||
@@ -51,6 +50,7 @@ FormatPrivate::FormatPrivate(const FormatPrivate &other)
|
|||||||
, 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)
|
||||||
|
, property(property)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -380,7 +380,7 @@ QByteArray Format::fontKey() const
|
|||||||
*/
|
*/
|
||||||
Format::HorizontalAlignment Format::horizontalAlignment() const
|
Format::HorizontalAlignment Format::horizontalAlignment() const
|
||||||
{
|
{
|
||||||
return d->alignmentData.alignH;
|
return static_cast<Format::HorizontalAlignment>(intProperty(FormatPrivate::P_Alignment_AlignH));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -388,18 +388,17 @@ Format::HorizontalAlignment Format::horizontalAlignment() const
|
|||||||
*/
|
*/
|
||||||
void Format::setHorizontalAlignment(HorizontalAlignment align)
|
void Format::setHorizontalAlignment(HorizontalAlignment align)
|
||||||
{
|
{
|
||||||
if (d->alignmentData.indent &&(align != AlignHGeneral && align != AlignLeft &&
|
if (hasProperty(FormatPrivate::P_Alignment_Indent)
|
||||||
align != AlignRight && align != AlignHDistributed)) {
|
&&(align != AlignHGeneral && align != AlignLeft && align != AlignRight && align != AlignHDistributed)) {
|
||||||
d->alignmentData.indent = 0;
|
clearProperty(FormatPrivate::P_Alignment_Indent);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d->alignmentData.shinkToFit && (align == AlignHFill || align == AlignHJustify
|
if (hasProperty(FormatPrivate::P_Alignment_ShinkToFit)
|
||||||
|| align == AlignHDistributed)) {
|
&& (align == AlignHFill || align == AlignHJustify || align == AlignHDistributed)) {
|
||||||
d->alignmentData.shinkToFit = false;
|
clearProperty(FormatPrivate::P_Alignment_ShinkToFit);
|
||||||
}
|
}
|
||||||
|
|
||||||
d->alignmentData.alignH = align;
|
setProperty(FormatPrivate::P_Alignment_AlignH, align);
|
||||||
d->dirty = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -407,7 +406,7 @@ void Format::setHorizontalAlignment(HorizontalAlignment align)
|
|||||||
*/
|
*/
|
||||||
Format::VerticalAlignment Format::verticalAlignment() const
|
Format::VerticalAlignment Format::verticalAlignment() const
|
||||||
{
|
{
|
||||||
return d->alignmentData.alignV;
|
return static_cast<Format::VerticalAlignment>(intProperty(FormatPrivate::P_Alignment_AlignV));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -415,8 +414,7 @@ Format::VerticalAlignment Format::verticalAlignment() const
|
|||||||
*/
|
*/
|
||||||
void Format::setVerticalAlignment(VerticalAlignment align)
|
void Format::setVerticalAlignment(VerticalAlignment align)
|
||||||
{
|
{
|
||||||
d->alignmentData.alignV = align;
|
setProperty(FormatPrivate::P_Alignment_AlignV, align);
|
||||||
d->dirty = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -424,7 +422,7 @@ void Format::setVerticalAlignment(VerticalAlignment align)
|
|||||||
*/
|
*/
|
||||||
bool Format::textWrap() const
|
bool Format::textWrap() const
|
||||||
{
|
{
|
||||||
return d->alignmentData.wrap;
|
return boolProperty(FormatPrivate::P_Alignment_Wrap);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -432,11 +430,10 @@ bool Format::textWrap() const
|
|||||||
*/
|
*/
|
||||||
void Format::setTextWarp(bool wrap)
|
void Format::setTextWarp(bool wrap)
|
||||||
{
|
{
|
||||||
if (wrap && d->alignmentData.shinkToFit)
|
if (wrap && hasProperty(FormatPrivate::P_Alignment_ShinkToFit))
|
||||||
d->alignmentData.shinkToFit = false;
|
clearProperty(FormatPrivate::P_Alignment_ShinkToFit);
|
||||||
|
|
||||||
d->alignmentData.wrap = wrap;
|
setProperty(FormatPrivate::P_Alignment_Wrap, wrap);
|
||||||
d->dirty = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -444,7 +441,7 @@ void Format::setTextWarp(bool wrap)
|
|||||||
*/
|
*/
|
||||||
int Format::rotation() const
|
int Format::rotation() const
|
||||||
{
|
{
|
||||||
return d->alignmentData.rotation;
|
return intProperty(FormatPrivate::P_Alignment_Rotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -452,8 +449,7 @@ int Format::rotation() const
|
|||||||
*/
|
*/
|
||||||
void Format::setRotation(int rotation)
|
void Format::setRotation(int rotation)
|
||||||
{
|
{
|
||||||
d->alignmentData.rotation = rotation;
|
setProperty(FormatPrivate::P_Alignment_Rotation, rotation);
|
||||||
d->dirty = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -461,7 +457,7 @@ void Format::setRotation(int rotation)
|
|||||||
*/
|
*/
|
||||||
int Format::indent() const
|
int Format::indent() const
|
||||||
{
|
{
|
||||||
return d->alignmentData.indent;
|
return intProperty(FormatPrivate::P_Alignment_Indent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -469,14 +465,15 @@ int Format::indent() const
|
|||||||
*/
|
*/
|
||||||
void Format::setIndent(int indent)
|
void Format::setIndent(int indent)
|
||||||
{
|
{
|
||||||
if (indent && (d->alignmentData.alignH != AlignHGeneral
|
if (indent && hasProperty(FormatPrivate::P_Alignment_AlignH)) {
|
||||||
&& d->alignmentData.alignH != AlignLeft
|
HorizontalAlignment hl = horizontalAlignment();
|
||||||
&& d->alignmentData.alignH != AlignRight
|
|
||||||
&& d->alignmentData.alignH != AlignHJustify)) {
|
if (hl != AlignHGeneral && hl != AlignLeft && hl!= AlignRight && hl!= AlignHJustify) {
|
||||||
d->alignmentData.alignH = AlignLeft;
|
setHorizontalAlignment(AlignLeft);
|
||||||
}
|
}
|
||||||
d->alignmentData.indent = indent;
|
}
|
||||||
d->dirty = true;
|
|
||||||
|
setProperty(FormatPrivate::P_Alignment_Indent, indent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -484,7 +481,7 @@ void Format::setIndent(int indent)
|
|||||||
*/
|
*/
|
||||||
bool Format::shrinkToFit() const
|
bool Format::shrinkToFit() const
|
||||||
{
|
{
|
||||||
return d->alignmentData.shinkToFit;
|
return boolProperty(FormatPrivate::P_Alignment_ShinkToFit);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -492,82 +489,28 @@ bool Format::shrinkToFit() const
|
|||||||
*/
|
*/
|
||||||
void Format::setShrinkToFit(bool shink)
|
void Format::setShrinkToFit(bool shink)
|
||||||
{
|
{
|
||||||
if (shink && d->alignmentData.wrap)
|
if (shink && hasProperty(FormatPrivate::P_Alignment_Wrap))
|
||||||
d->alignmentData.wrap = false;
|
clearProperty(FormatPrivate::P_Alignment_Wrap);
|
||||||
if (shink && (d->alignmentData.alignH == AlignHFill
|
|
||||||
|| d->alignmentData.alignH == AlignHJustify
|
if (shink && hasProperty(FormatPrivate::P_Alignment_AlignH)) {
|
||||||
|| d->alignmentData.alignH == AlignHDistributed)) {
|
HorizontalAlignment hl = horizontalAlignment();
|
||||||
d->alignmentData.alignH = AlignLeft;
|
if (hl == AlignHFill || hl == AlignHJustify || hl == AlignHDistributed)
|
||||||
|
setHorizontalAlignment(AlignLeft);
|
||||||
}
|
}
|
||||||
|
|
||||||
d->alignmentData.shinkToFit = shink;
|
setProperty(FormatPrivate::P_Alignment_ShinkToFit, shink);
|
||||||
d->dirty = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \internal
|
* \internal
|
||||||
*/
|
*/
|
||||||
bool Format::alignmentChanged() const
|
bool Format::hasAlignmentData() const
|
||||||
{
|
{
|
||||||
return d->alignmentData.alignH != AlignHGeneral
|
for (int i=FormatPrivate::P_Alignment_STARTID; i<FormatPrivate::P_Alignment_ENDID; ++i) {
|
||||||
|| d->alignmentData.alignV != AlignBottom
|
if (hasProperty(i))
|
||||||
|| d->alignmentData.indent != 0
|
return true;
|
||||||
|| d->alignmentData.wrap
|
|
||||||
|| d->alignmentData.rotation != 0
|
|
||||||
|| d->alignmentData.shinkToFit;
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
QString Format::horizontalAlignmentString() const
|
|
||||||
{
|
|
||||||
QString alignH;
|
|
||||||
switch (d->alignmentData.alignH) {
|
|
||||||
case Format::AlignLeft:
|
|
||||||
alignH = QStringLiteral("left");
|
|
||||||
break;
|
|
||||||
case Format::AlignHCenter:
|
|
||||||
alignH = QStringLiteral("center");
|
|
||||||
break;
|
|
||||||
case Format::AlignRight:
|
|
||||||
alignH = QStringLiteral("right");
|
|
||||||
break;
|
|
||||||
case Format::AlignHFill:
|
|
||||||
alignH = QStringLiteral("fill");
|
|
||||||
break;
|
|
||||||
case Format::AlignHJustify:
|
|
||||||
alignH = QStringLiteral("justify");
|
|
||||||
break;
|
|
||||||
case Format::AlignHMerge:
|
|
||||||
alignH = QStringLiteral("centerContinuous");
|
|
||||||
break;
|
|
||||||
case Format::AlignHDistributed:
|
|
||||||
alignH = QStringLiteral("distributed");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return alignH;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString Format::verticalAlignmentString() const
|
|
||||||
{
|
|
||||||
QString align;
|
|
||||||
switch (d->alignmentData.alignV) {
|
|
||||||
case AlignTop:
|
|
||||||
align = QStringLiteral("top");
|
|
||||||
break;
|
|
||||||
case AlignVCenter:
|
|
||||||
align = QStringLiteral("center");
|
|
||||||
break;
|
|
||||||
case AlignVJustify:
|
|
||||||
align = QStringLiteral("justify");
|
|
||||||
break;
|
|
||||||
case AlignVDistributed:
|
|
||||||
align = QStringLiteral("distributed");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return align;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -815,24 +758,22 @@ QByteArray Format::fillKey() const
|
|||||||
|
|
||||||
bool Format::hidden() const
|
bool Format::hidden() const
|
||||||
{
|
{
|
||||||
return d->protectionData.hidden;
|
return boolProperty(FormatPrivate::P_Protection_Hidden);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Format::setHidden(bool hidden)
|
void Format::setHidden(bool hidden)
|
||||||
{
|
{
|
||||||
d->protectionData.hidden = hidden;
|
setProperty(FormatPrivate::P_Protection_Hidden, hidden);
|
||||||
d->dirty = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Format::locked() const
|
bool Format::locked() const
|
||||||
{
|
{
|
||||||
return d->protectionData.locked;
|
return boolProperty(FormatPrivate::P_Protection_Locked);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Format::setLocked(bool locked)
|
void Format::setLocked(bool locked)
|
||||||
{
|
{
|
||||||
d->protectionData.locked = locked;
|
setProperty(FormatPrivate::P_Protection_Locked, locked);
|
||||||
d->dirty = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray Format::formatKey() const
|
QByteArray Format::formatKey() const
|
||||||
@@ -840,15 +781,13 @@ QByteArray Format::formatKey() const
|
|||||||
if (d->dirty) {
|
if (d->dirty) {
|
||||||
QByteArray key;
|
QByteArray key;
|
||||||
QDataStream stream(&key, QIODevice::WriteOnly);
|
QDataStream stream(&key, QIODevice::WriteOnly);
|
||||||
stream<<fontKey()<<borderKey()<<fillKey()
|
stream<<fontKey()<<borderKey()<<fillKey()<<numberFormatIndex();
|
||||||
<<numberFormatIndex()
|
for (int i=FormatPrivate::P_OTHER_STARTID; i<FormatPrivate::P_OTHER_ENDID; ++i) {
|
||||||
<<d->alignmentData.alignH<<d->alignmentData.alignV<<d->alignmentData.indent
|
if (d->property.contains(i))
|
||||||
<<d->alignmentData.rotation<<d->alignmentData.shinkToFit<<d->alignmentData.wrap
|
stream<<i<<d->property[i];
|
||||||
<<d->protectionData.hidden<<d->protectionData.locked;
|
}
|
||||||
d->formatKey = key;
|
d->formatKey = key;
|
||||||
d->dirty = false;
|
d->dirty = false;
|
||||||
d->xf_indexValid = false;
|
|
||||||
d->dxf_indexValid = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return d->formatKey;
|
return d->formatKey;
|
||||||
@@ -935,6 +874,7 @@ void Format::setProperty(int propertyId, const QVariant &value)
|
|||||||
|
|
||||||
d->dirty = true;
|
d->dirty = true;
|
||||||
d->xf_indexValid = false;
|
d->xf_indexValid = false;
|
||||||
|
d->dxf_indexValid = false;
|
||||||
|
|
||||||
if (propertyId >= FormatPrivate::P_Font_STARTID && propertyId < FormatPrivate::P_Font_ENDID) {
|
if (propertyId >= FormatPrivate::P_Font_STARTID && propertyId < FormatPrivate::P_Font_ENDID) {
|
||||||
d->font_dirty = true;
|
d->font_dirty = true;
|
||||||
|
|||||||
@@ -239,9 +239,7 @@ private:
|
|||||||
void setFontIndex(int index);
|
void setFontIndex(int index);
|
||||||
QByteArray fontKey() const;
|
QByteArray fontKey() const;
|
||||||
|
|
||||||
bool alignmentChanged() const;
|
bool hasAlignmentData() const;
|
||||||
QString horizontalAlignmentString() const;
|
|
||||||
QString verticalAlignmentString() const;
|
|
||||||
|
|
||||||
bool borderIndexValid() const;
|
bool borderIndexValid() const;
|
||||||
QByteArray borderKey() const;
|
QByteArray borderKey() const;
|
||||||
|
|||||||
+13
-29
@@ -30,30 +30,6 @@
|
|||||||
|
|
||||||
namespace QXlsx {
|
namespace QXlsx {
|
||||||
|
|
||||||
struct XlsxFormatAlignmentData
|
|
||||||
{
|
|
||||||
XlsxFormatAlignmentData() :
|
|
||||||
alignH(Format::AlignHGeneral), alignV(Format::AlignBottom)
|
|
||||||
, wrap(false), rotation(0), indent(0), shinkToFit(false)
|
|
||||||
{}
|
|
||||||
|
|
||||||
Format::HorizontalAlignment alignH;
|
|
||||||
Format::VerticalAlignment alignV;
|
|
||||||
bool wrap;
|
|
||||||
int rotation;
|
|
||||||
int indent;
|
|
||||||
bool shinkToFit;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct XlsxFormatProtectionData {
|
|
||||||
XlsxFormatProtectionData() :
|
|
||||||
locked(false), hidden(false)
|
|
||||||
{}
|
|
||||||
|
|
||||||
bool locked;
|
|
||||||
bool hidden;
|
|
||||||
};
|
|
||||||
|
|
||||||
class FormatPrivate : public QSharedData
|
class FormatPrivate : public QSharedData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -122,20 +98,28 @@ public:
|
|||||||
P_Fill_FgThemeColor,
|
P_Fill_FgThemeColor,
|
||||||
P_Fill_ENDID,
|
P_Fill_ENDID,
|
||||||
|
|
||||||
|
P_OTHER_STARTID,
|
||||||
//alignment
|
//alignment
|
||||||
P_Alignment_,
|
P_Alignment_STARTID,
|
||||||
|
P_Alignment_AlignH = P_Alignment_STARTID,
|
||||||
|
P_Alignment_AlignV,
|
||||||
|
P_Alignment_Wrap,
|
||||||
|
P_Alignment_Rotation,
|
||||||
|
P_Alignment_Indent,
|
||||||
|
P_Alignment_ShinkToFit,
|
||||||
|
P_Alignment_ENDID,
|
||||||
|
|
||||||
//protection
|
//protection
|
||||||
P_Protection_,
|
P_Protection_Locked,
|
||||||
|
P_Protection_Hidden,
|
||||||
|
|
||||||
|
P_OTHER_ENDID
|
||||||
};
|
};
|
||||||
|
|
||||||
FormatPrivate();
|
FormatPrivate();
|
||||||
FormatPrivate(const FormatPrivate &other);
|
FormatPrivate(const FormatPrivate &other);
|
||||||
~FormatPrivate();
|
~FormatPrivate();
|
||||||
|
|
||||||
XlsxFormatAlignmentData alignmentData;
|
|
||||||
XlsxFormatProtectionData protectionData;
|
|
||||||
|
|
||||||
bool dirty; //The key re-generation is need.
|
bool dirty; //The key re-generation is need.
|
||||||
QByteArray formatKey;
|
QByteArray formatKey;
|
||||||
|
|
||||||
|
|||||||
+52
-12
@@ -542,24 +542,64 @@ void Styles::writeCellXfs(XmlStreamWriter &writer)
|
|||||||
writer.writeAttribute(QStringLiteral("applyBorder"), QStringLiteral("1"));
|
writer.writeAttribute(QStringLiteral("applyBorder"), QStringLiteral("1"));
|
||||||
if (format->fillIndex() > 0)
|
if (format->fillIndex() > 0)
|
||||||
writer.writeAttribute(QStringLiteral("applyFill"), QStringLiteral("1"));
|
writer.writeAttribute(QStringLiteral("applyFill"), QStringLiteral("1"));
|
||||||
if (format->alignmentChanged())
|
if (format->hasAlignmentData())
|
||||||
writer.writeAttribute(QStringLiteral("applyAlignment"), QStringLiteral("1"));
|
writer.writeAttribute(QStringLiteral("applyAlignment"), QStringLiteral("1"));
|
||||||
|
|
||||||
if (format->alignmentChanged()) {
|
if (format->hasAlignmentData()) {
|
||||||
writer.writeEmptyElement(QStringLiteral("alignment"));
|
writer.writeEmptyElement(QStringLiteral("alignment"));
|
||||||
QString alignH = format->horizontalAlignmentString();
|
if (format->hasProperty(FormatPrivate::P_Alignment_AlignH)) {
|
||||||
if (!alignH.isEmpty())
|
switch (format->horizontalAlignment()) {
|
||||||
writer.writeAttribute(QStringLiteral("horizontal"), alignH);
|
case Format::AlignLeft:
|
||||||
QString alignV = format->verticalAlignmentString();
|
writer.writeAttribute(QStringLiteral("horizontal"), QStringLiteral("left"));
|
||||||
if (!alignV.isEmpty())
|
break;
|
||||||
writer.writeAttribute(QStringLiteral("vertical"), alignV);
|
case Format::AlignHCenter:
|
||||||
if (format->indent())
|
writer.writeAttribute(QStringLiteral("horizontal"), QStringLiteral("center"));
|
||||||
|
break;
|
||||||
|
case Format::AlignRight:
|
||||||
|
writer.writeAttribute(QStringLiteral("horizontal"), QStringLiteral("right"));
|
||||||
|
break;
|
||||||
|
case Format::AlignHFill:
|
||||||
|
writer.writeAttribute(QStringLiteral("horizontal"), QStringLiteral("fill"));
|
||||||
|
break;
|
||||||
|
case Format::AlignHJustify:
|
||||||
|
writer.writeAttribute(QStringLiteral("horizontal"), QStringLiteral("justify"));
|
||||||
|
break;
|
||||||
|
case Format::AlignHMerge:
|
||||||
|
writer.writeAttribute(QStringLiteral("horizontal"), QStringLiteral("centerContinuous"));
|
||||||
|
break;
|
||||||
|
case Format::AlignHDistributed:
|
||||||
|
writer.writeAttribute(QStringLiteral("horizontal"), QStringLiteral("distributed"));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (format->hasProperty(FormatPrivate::P_Alignment_AlignV)) {
|
||||||
|
switch (format->verticalAlignment()) {
|
||||||
|
case Format::AlignTop:
|
||||||
|
writer.writeAttribute(QStringLiteral("vertical"), QStringLiteral("top"));
|
||||||
|
break;
|
||||||
|
case Format::AlignVCenter:
|
||||||
|
writer.writeAttribute(QStringLiteral("vertical"), QStringLiteral("center"));
|
||||||
|
break;
|
||||||
|
case Format::AlignVJustify:
|
||||||
|
writer.writeAttribute(QStringLiteral("vertical"), QStringLiteral("justify"));
|
||||||
|
break;
|
||||||
|
case Format::AlignVDistributed:
|
||||||
|
writer.writeAttribute(QStringLiteral("vertical"), QStringLiteral("distributed"));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (format->hasProperty(FormatPrivate::P_Alignment_Indent))
|
||||||
writer.writeAttribute(QStringLiteral("indent"), QString::number(format->indent()));
|
writer.writeAttribute(QStringLiteral("indent"), QString::number(format->indent()));
|
||||||
if (format->textWrap())
|
if (format->hasProperty(FormatPrivate::P_Alignment_Wrap) && format->textWrap())
|
||||||
writer.writeAttribute(QStringLiteral("wrapText"), QStringLiteral("1"));
|
writer.writeAttribute(QStringLiteral("wrapText"), QStringLiteral("1"));
|
||||||
if (format->shrinkToFit())
|
if (format->hasProperty(FormatPrivate::P_Alignment_ShinkToFit) && format->shrinkToFit())
|
||||||
writer.writeAttribute(QStringLiteral("shrinkToFit"), QStringLiteral("1"));
|
writer.writeAttribute(QStringLiteral("shrinkToFit"), QStringLiteral("1"));
|
||||||
if (format->rotation())
|
if (format->hasProperty(FormatPrivate::P_Alignment_Rotation))
|
||||||
writer.writeAttribute(QStringLiteral("textRotation"), QString::number(format->rotation()));
|
writer.writeAttribute(QStringLiteral("textRotation"), QString::number(format->rotation()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user