Index: scribus/pageitem_textframe.cpp =================================================================== --- scribus/pageitem_textframe.cpp (revision 27701) +++ scribus/pageitem_textframe.cpp (working copy) @@ -1075,7 +1075,47 @@ return style.lineSpacing(); } +/** + * @brief Pre-pass to compute the maximum paragraph effect width. + */ +static double maxParagraphEffectWidth(PageItem* item) +{ + ShapedTextFeed shapedText(&item->itemText, 0, item); + QList glyphClusters; + for (int j = 0; shapedText.haveMoreText(j, glyphClusters); ++j) + ; + + double maxParEffectWidth = 0.0; + int prevA = -1; + + for (int j = 0; j < glyphClusters.count(); ++j) + { + int a = glyphClusters[j].firstChar(); + if (item->itemText.isBlockStart(a) && a != prevA) + { + prevA = a; + const ParagraphStyle& pStyle = item->itemText.paragraphStyle(a); + if (pStyle.hasNum()) + { + double effectWidth = 0.0; + for (int k = j; k < glyphClusters.count(); ++k) + { + const auto& glyph = glyphClusters[k]; + if (glyph.firstChar() != a) + break; + effectWidth += glyph.width(); + } + + double totalWidth = pStyle.parEffectOffset() + effectWidth; + if (totalWidth > maxParEffectWidth) + maxParEffectWidth = totalWidth; + } + } + } + return maxParEffectWidth; +} + // This assumes that layout() ran on the previous page and set the incomplete* vars // It also clears the incomplete* vars, and changes the starting position for this frame // The incomplete* vars are used to ensure that we don't run into an endless loop @@ -1391,8 +1431,8 @@ setMaxY(-1); double maxYAsc = 0.0, maxYDesc = 0.0; int regionMinY = 0, regionMaxY= 0; + double cachedMaxParEffectWidth = -1.0; - double autoLeftIndent = 0.0; for (int i = 0; shapedText.haveMoreText(i, glyphClusters); ++i) { int currentIndex = i - current.lineData.firstCluster; @@ -1425,16 +1465,6 @@ BulNumMode = false; if (itemText.isBlockStart(a)) { - if (currentIndex > 0) - { - int prevA = current.glyphs[currentIndex - 1].firstChar(); - if (a != prevA) - autoLeftIndent = 0.0; - } - else - { - autoLeftIndent = 0.0; - } style = itemText.paragraphStyle(a); if (style.hasBullet() || style.hasNum()) { @@ -1807,7 +1837,7 @@ else { // LTR: Original behavior - current.leftIndent = style.leftMargin() + autoLeftIndent; + current.leftIndent = style.leftMargin(); if (itemText.isBlockStart(a)) { current.leftIndent += style.firstIndent(); @@ -1816,33 +1846,31 @@ if (BulNumMode || DropCmode) { - if (style.parEffectIndent()) + double effectWidth = 0.0; + for (int j = i; shapedText.haveMoreText(j, glyphClusters); ++j) { - double effectWidth = 0.0; - for (int j = i; shapedText.haveMoreText(j, glyphClusters); ++j) - { - const auto & glyph = glyphClusters[j]; - if (glyph.firstChar() != a) - break; - effectWidth += glyph.width(); - } + const auto& glyph = glyphClusters[j]; + if (glyph.firstChar() != a) + break; + effectWidth += glyph.width(); + } + double indentAdjust = 0.0; + if (style.suffixAlignment() == ParagraphStyle::SuffixAlign_Right || + style.suffixAlignment() == ParagraphStyle::SuffixAlign_Center) + { + if (cachedMaxParEffectWidth < 0.0) + cachedMaxParEffectWidth = maxParagraphEffectWidth(this); - if (style.direction() == ParagraphStyle::RTL) - { - current.rightIndent -= style.parEffectOffset() + effectWidth; - if (current.rightIndent < 0.0) - current.rightIndent = 0.0; - } + if (style.suffixAlignment() == ParagraphStyle::SuffixAlign_Right) + indentAdjust = style.parEffectOffset() + (effectWidth - cachedMaxParEffectWidth); else - { - current.leftIndent -= style.parEffectOffset() + effectWidth; - if (current.leftIndent < 0.0) - { - autoLeftIndent = abs(current.leftIndent); - current.leftIndent = 0.0; - } - } + indentAdjust = style.parEffectOffset() + (effectWidth - cachedMaxParEffectWidth) / 2.0; } + + if (style.direction() == ParagraphStyle::RTL) + current.rightIndent -= indentAdjust; + else + current.leftIndent -= indentAdjust; } // RTL drop-cap follow-lines: Constrain the available line width // from the right margin to prevent text overlapping the right-aligned drop cap. Index: scribus/plugins/fileloader/scribus150format/scribus150format.cpp =================================================================== --- scribus/plugins/fileloader/scribus150format/scribus150format.cpp (revision 27701) +++ scribus/plugins/fileloader/scribus150format/scribus150format.cpp (working copy) @@ -3123,10 +3123,6 @@ if (attrs.hasAttribute(ParagraphEffectOffset)) newStyle.setParEffectOffset(attrs.valueAsDouble(ParagraphEffectOffset)); - static const QString ParagraphEffectIndent("ParagraphEffectIndent"); - if (attrs.hasAttribute(ParagraphEffectIndent)) - newStyle.setParEffectIndent(attrs.valueAsDouble(ParagraphEffectIndent)); - static const QString DROP("DROP"); if (attrs.hasAttribute(DROP)) newStyle.setHasDropCap(static_cast(attrs.valueAsInt(DROP))); @@ -5497,8 +5493,6 @@ pstyle.setPeCharStyleName(attrs.valueAsString("ParagraphEffectCharStyle")); if (attrs.hasAttribute("ParagraphEffectOffset")) pstyle.setParEffectOffset(attrs.valueAsDouble("ParagraphEffectOffset")); - if (attrs.hasAttribute("ParagraphEffectIndent")) - pstyle.setParEffectIndent(attrs.valueAsDouble("ParagraphEffectIndent")); if (attrs.hasAttribute("DROP")) pstyle.setHasDropCap(static_cast(attrs.valueAsInt("DROP"))); if (attrs.hasAttribute("DROPLIN")) Index: scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp =================================================================== --- scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp (revision 27701) +++ scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp (working copy) @@ -842,8 +842,6 @@ docu.writeAttribute("ParagraphEffectCharStyle", style.peCharStyleName()); if ( ! style.isInhParEffectOffset()) docu.writeAttribute("ParagraphEffectOffset", style.parEffectOffset()); - if ( ! style.isInhParEffectIndent()) - docu.writeAttribute("ParagraphEffectIndent", static_cast(style.parEffectIndent())); if ( ! style.isInhHasDropCap()) docu.writeAttribute("DROP", static_cast(style.hasDropCap())); if ( ! style.isInhDropCapLines()) Index: scribus/plugins/fileloader/scribus170format/scribus170format.cpp =================================================================== --- scribus/plugins/fileloader/scribus170format/scribus170format.cpp (revision 27701) +++ scribus/plugins/fileloader/scribus170format/scribus170format.cpp (working copy) @@ -3131,10 +3131,6 @@ if (attrs.hasAttribute(ParagraphEffectOffset)) newStyle.setParEffectOffset(attrs.valueAsDouble(ParagraphEffectOffset)); - static const QString ParagraphEffectIndent("ParagraphEffectIndent"); - if (attrs.hasAttribute(ParagraphEffectIndent)) - newStyle.setParEffectIndent(attrs.valueAsDouble(ParagraphEffectIndent)); - static const QString DROP("DROP"); if (attrs.hasAttribute(DROP)) newStyle.setHasDropCap(static_cast(attrs.valueAsInt(DROP))); @@ -5567,8 +5563,6 @@ pstyle.setPeCharStyleName(attrs.valueAsString("ParagraphEffectCharStyle")); if (attrs.hasAttribute("ParagraphEffectOffset")) pstyle.setParEffectOffset(attrs.valueAsDouble("ParagraphEffectOffset")); - if (attrs.hasAttribute("ParagraphEffectIndent")) - pstyle.setParEffectIndent(attrs.valueAsDouble("ParagraphEffectIndent")); if (attrs.hasAttribute("DROP")) pstyle.setHasDropCap(static_cast(attrs.valueAsInt("DROP"))); if (attrs.hasAttribute("DROPLIN")) Index: scribus/plugins/fileloader/scribus170format/scribus170format_save.cpp =================================================================== --- scribus/plugins/fileloader/scribus170format/scribus170format_save.cpp (revision 27701) +++ scribus/plugins/fileloader/scribus170format/scribus170format_save.cpp (working copy) @@ -844,8 +844,6 @@ docu.writeAttribute("ParagraphEffectCharStyle", style.peCharStyleName()); if (!style.isInhParEffectOffset()) docu.writeAttribute("ParagraphEffectOffset", style.parEffectOffset()); - if (!style.isInhParEffectIndent()) - docu.writeAttribute("ParagraphEffectIndent", static_cast(style.parEffectIndent())); if (!style.isInhHasDropCap()) docu.writeAttribute("DROP", static_cast(style.hasDropCap())); if (!style.isInhDropCapLines()) Index: scribus/plugins/fileloader/scribus171format/scribus171format.cpp =================================================================== --- scribus/plugins/fileloader/scribus171format/scribus171format.cpp (revision 27701) +++ scribus/plugins/fileloader/scribus171format/scribus171format.cpp (working copy) @@ -3635,10 +3635,6 @@ if (attrs.hasAttribute(ParagraphEffectOffset)) newStyle.setParEffectOffset(attrs.valueAsDouble(ParagraphEffectOffset)); - static const QString ParagraphEffectIndent("ParagraphEffectIndent"); - if (attrs.hasAttribute(ParagraphEffectIndent)) - newStyle.setParEffectIndent(attrs.valueAsDouble(ParagraphEffectIndent)); - //Remove uppercase in 1.8 format if (attrs.hasAttribute("DROP")) newStyle.setHasDropCap(static_cast(attrs.valueAsInt("DROP"))); @@ -3695,6 +3691,10 @@ if (attrs.hasAttribute(NumerationSuffix)) newStyle.setNumSuffix(attrs.valueAsString(NumerationSuffix)); + static const QString SuffixAlignment("SuffixAlignment"); + if (attrs.hasAttribute(SuffixAlignment)) + newStyle.setSuffixAlignment(static_cast(attrs.valueAsInt(SuffixAlignment))); + static const QString NumerationRestart("NumerationRestart"); if (attrs.hasAttribute(NumerationRestart)) newStyle.setNumRestart(attrs.valueAsInt(NumerationRestart)); @@ -6679,8 +6679,6 @@ pstyle.setPeCharStyleName(attrs.valueAsString("ParagraphEffectCharStyle")); if (attrs.hasAttribute("ParagraphEffectOffset")) pstyle.setParEffectOffset(attrs.valueAsDouble("ParagraphEffectOffset")); - if (attrs.hasAttribute("ParagraphEffectIndent")) - pstyle.setParEffectIndent(attrs.valueAsDouble("ParagraphEffectIndent")); //Remove uppercase in 1.8 if (attrs.hasAttribute("DROP")) pstyle.setHasDropCap(static_cast(attrs.valueAsInt("DROP"))); @@ -6717,6 +6715,8 @@ pstyle.setNumPrefix(attrs.valueAsString("NumerationPrefix")); if (attrs.hasAttribute("NumerationSuffix")) pstyle.setNumSuffix(attrs.valueAsString("NumerationSuffix")); + if (attrs.hasAttribute("SuffixAlignment")) + pstyle.setSuffixAlignment(static_cast(attrs.valueAsInt("SuffixAlignment"))); if (attrs.hasAttribute("NumerationRestart")) { NumerationRange numRange = (NumerationRange) attrs.valueAsInt("NumerationRestart"); Index: scribus/plugins/fileloader/scribus171format/scribus171format_save.cpp =================================================================== --- scribus/plugins/fileloader/scribus171format/scribus171format_save.cpp (revision 27701) +++ scribus/plugins/fileloader/scribus171format/scribus171format_save.cpp (working copy) @@ -846,8 +846,6 @@ docu.writeAttribute("ParagraphEffectCharStyle", style.peCharStyleName()); if (!style.isInhParEffectOffset()) docu.writeAttribute("ParagraphEffectOffset", style.parEffectOffset()); - if (!style.isInhParEffectIndent()) - docu.writeAttribute("ParagraphEffectIndent", static_cast(style.parEffectIndent())); if (!style.isInhHasDropCap()) docu.writeAttribute("HasDropCap", static_cast(style.hasDropCap())); if (!style.isInhDropCapLines()) @@ -868,6 +866,8 @@ docu.writeAttribute("NumerationPrefix", style.numPrefix()); if (!style.isInhNumSuffix()) docu.writeAttribute("NumerationSuffix", style.numSuffix()); + if (!style.isInhSuffixAlignment()) + docu.writeAttribute("SuffixAlignment", style.suffixAlignment()); if (!style.isInhNumStart()) docu.writeAttribute("NumerationStart", style.numStart()); if (!style.isInhNumRestart()) Index: scribus/styles/paragraphstyle.attrdefs.cxx =================================================================== --- scribus/styles/paragraphstyle.attrdefs.cxx (revision 27701) +++ scribus/styles/paragraphstyle.attrdefs.cxx (working copy) @@ -40,7 +40,6 @@ ATTRDEF(bool, hasDropCap, HasDropCap, false) ATTRDEF(int, dropCapLines, DropCapLines, 2) ATTRDEF(double, parEffectOffset, ParEffectOffset, 0.0) -ATTRDEF(bool, parEffectIndent, ParEffectIndent, false) ATTRDEF(QString, peCharStyleName, PeCharStyleName,"") ATTRDEF(bool, hasBullet, HasBullet, false) ATTRDEF(QString, bulletStr, BulletStr, QString(QChar(0x2022))) @@ -54,6 +53,7 @@ ATTRDEF(int, numRestart, NumRestart, 0) ATTRDEF(bool, numOther, NumOther, false) ATTRDEF(bool, numHigher, NumHigher, true) +ATTRDEF(ParagraphStyle::SuffixAlignment, suffixAlignment, SuffixAlignment, ParagraphStyle::SuffixAlign_Left) ATTRDEF(QString, backgroundColor, BackgroundColor, "None") ATTRDEF(double, backgroundShade, BackgroundShade, 100) ATTRDEF(int, hyphenConsecutiveLines, HyphenConsecutiveLines, 2) Index: scribus/styles/paragraphstyle.cpp =================================================================== --- scribus/styles/paragraphstyle.cpp (revision 27701) +++ scribus/styles/paragraphstyle.cpp (working copy) @@ -208,6 +208,14 @@ #undef ATTRDEF } +ParagraphStyle::SuffixAlignment ParagraphStyle::flipSuffixAlignmentForRTL(SuffixAlignment align) const +{ + if (align == ParagraphStyle::SuffixAlign_Left) + return ParagraphStyle::SuffixAlign_Right; + if (align == ParagraphStyle::SuffixAlign_Right) + return ParagraphStyle::SuffixAlign_Left; + return align; +} void ParagraphStyle::getNamedResources(ResourceCollection& lists) const { @@ -261,6 +269,11 @@ return QString::number(static_cast(val)); } +static QString toXMLString(ParagraphStyle::SuffixAlignment val) +{ + return QString::number(static_cast(val)); +} + static QString toXMLString(ParagraphStyle::DirectionType val) { return QString::number(static_cast(val)); @@ -345,6 +358,12 @@ } template<> +ParagraphStyle::SuffixAlignment parse(const Xml_string& str) +{ + return parseEnum(str); +} + +template<> ParagraphStyle::DirectionType parse(const Xml_string& str) { return parseEnum(str); Index: scribus/styles/paragraphstyle.h =================================================================== --- scribus/styles/paragraphstyle.h (revision 27701) +++ scribus/styles/paragraphstyle.h (working copy) @@ -76,6 +76,13 @@ CenterTab = 4 }; + enum SuffixAlignment + { + SuffixAlign_Left = 0, + SuffixAlign_Center = 1, + SuffixAlign_Right = 2 + }; + struct TabRecord { qreal tabPosition {0.0}; @@ -113,6 +120,7 @@ void eraseStyle(const ParagraphStyle& other); void setStyle(const ParagraphStyle& other); void erase() override { eraseStyle(*this); } + ParagraphStyle::SuffixAlignment flipSuffixAlignmentForRTL(ParagraphStyle::SuffixAlignment align) const; StyleContext* charStyleContext() { return & m_cstyleContext; } const StyleContext* charStyleContext() const { return & m_cstyleContext; } Index: scribus/ui/propertywidget_pareffect.cpp =================================================================== --- scribus/ui/propertywidget_pareffect.cpp (revision 27701) +++ scribus/ui/propertywidget_pareffect.cpp (working copy) @@ -45,6 +45,10 @@ peCombo->setCurrentIndex(0); setType(peCombo->currentData().toInt()); + suffixAlignmentCombo->addItem(tr("Left"), ParagraphStyle::SuffixAlign_Left); + suffixAlignmentCombo->addItem(tr("Center"), ParagraphStyle::SuffixAlign_Center); + suffixAlignmentCombo->addItem(tr("Right"), ParagraphStyle::SuffixAlign_Right); + iconSetChange(); connect(ScQApp, SIGNAL(iconSetChanged()), this, SLOT(iconSetChange())); @@ -185,6 +189,9 @@ stackedWidget->setVisible(true); peGroup->setVisible(true); } + bool isNumberedList = (id == 2); + suffixAlignmentLabel->setVisible(isNumberedList); + suffixAlignmentCombo->setVisible(isNumberedList); } void PropertyWidget_ParEffect::fillBulletStrEditCombo() @@ -230,8 +237,8 @@ QSignalBlocker blocker8(numSuffix); QSignalBlocker blocker9(numStart); QSignalBlocker blockerA(peOffset); - QSignalBlocker blockerB(peIndent); QSignalBlocker blockerC(peCharStyleCombo); + QSignalBlocker blockerD(suffixAlignmentCombo); if (newPStyle.hasDropCap()) { @@ -269,9 +276,16 @@ numFormatCombo->setCurrentFormat((NumFormat) newPStyle.numFormat()); peOffset->setValue(newPStyle.parEffectOffset() * m_unitRatio); - peIndent->setChecked(newPStyle.parEffectIndent()); showCharStyle(newPStyle.peCharStyleName()); + ParagraphStyle::SuffixAlignment displayAlign = newPStyle.suffixAlignment(); + if (newPStyle.direction() == ParagraphStyle::RTL) + displayAlign = newPStyle.flipSuffixAlignmentForRTL(displayAlign); + + int idx = suffixAlignmentCombo->findData(static_cast(displayAlign)); + if (idx >= 0) + suffixAlignmentCombo->setCurrentIndex(idx); + if (oldPeComboIndex != peCombo->currentIndex()) emit needsRelayout(); } @@ -288,7 +302,7 @@ connect(numSuffix, SIGNAL(textChanged(QString)), this, SLOT(handleNumSuffix(QString)), Qt::UniqueConnection); connect(numStart, SIGNAL(valueChanged(int)), this, SLOT(handleNumStart(int)), Qt::UniqueConnection); connect(peOffset, SIGNAL(valueChanged(double)), this, SLOT(handlePEOffset(double)), Qt::UniqueConnection); - connect(peIndent, SIGNAL(toggled(bool)), this, SLOT(handlePEIndent(bool)), Qt::UniqueConnection); + connect(suffixAlignmentCombo, SIGNAL(activated(int)), this, SLOT(handleSuffixAlignment(int)), Qt::UniqueConnection); connect(peCharStyleCombo, SIGNAL(newStyle(QString)), this, SLOT(handlePECharStyle(QString)), Qt::UniqueConnection); } @@ -304,7 +318,7 @@ disconnect(numSuffix, SIGNAL(textChanged(QString)), this, SLOT(handleNumSuffix(QString))); disconnect(numStart, SIGNAL(valueChanged(int)), this, SLOT(handleNumStart(int))); disconnect(peOffset, SIGNAL(valueChanged(double)), this, SLOT(handlePEOffset(double))); - disconnect(peIndent, SIGNAL(toggled(bool)), this, SLOT(handlePEIndent(bool))); + disconnect(suffixAlignmentCombo, SIGNAL(activated(int)), this, SLOT(handleSuffixAlignment(int))); disconnect(peCharStyleCombo, SIGNAL(newStyle(QString)), this, SLOT(handlePECharStyle(QString))); } @@ -403,8 +417,6 @@ newStyle.setHasBullet(false); newStyle.setHasNum(false); } - newStyle.setParEffectOffset(peOffset->value() / m_unitRatio); - newStyle.setParEffectIndent(peIndent->isChecked()); setType(peCombo->currentData().toInt()); @@ -537,12 +549,15 @@ handleChanges(m_item, newStyle); } -void PropertyWidget_ParEffect::handlePEIndent(bool indent) +void PropertyWidget_ParEffect::handleSuffixAlignment(int index) { if (!m_doc || !m_item) return; ParagraphStyle newStyle; - newStyle.setParEffectIndent(indent); + auto align = static_cast(suffixAlignmentCombo->itemData(index).toInt()); + if (m_item->currentStyle().direction() == ParagraphStyle::RTL) + align = newStyle.flipSuffixAlignmentForRTL(align); + newStyle.setSuffixAlignment(align); handleChanges(m_item, newStyle); } Index: scribus/ui/propertywidget_pareffect.h =================================================================== --- scribus/ui/propertywidget_pareffect.h (revision 27701) +++ scribus/ui/propertywidget_pareffect.h (working copy) @@ -66,7 +66,7 @@ void handleNumSuffix(const QString&); void handleNumStart(int); void handlePEOffset(double); - void handlePEIndent(bool); + void handleSuffixAlignment(int); void handlePECharStyle(const QString&); private slots: Index: scribus/ui/propertywidget_pareffectbase.ui =================================================================== --- scribus/ui/propertywidget_pareffectbase.ui (revision 27701) +++ scribus/ui/propertywidget_pareffectbase.ui (working copy) @@ -1,568 +1,575 @@ - - - PropertyWidget_ParEffectBase - - - - 0 - 0 - 295 - 274 - - - - - 4 - - - 8 - - - 8 - - - 8 - - - 8 - - - - - - - - 0 - 0 - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - - - - Qt::Orientation::Horizontal - - - - 0 - 20 - - - - - - - - - - 2 - - - - - 0 - - - 4 - - - 0 - - - 4 - - - 4 - - - 8 - - - - - Number of lines used by the drop cap - - - Lines: - - - - - - - Drop Cap Lines - - - 2 - - - - - - - Qt::Orientation::Horizontal - - - - 40 - 20 - - - - - - - - - - 0 - - - 4 - - - 0 - - - 4 - - - 4 - - - 8 - - - - - - 0 - 0 - - - - Enhanced Character Table to choose bullet characters - - - Char Table - - - true - - - - - - - Bullet Char(s): - - - bulletStrEdit - - - - - - - - 0 - 0 - - - - true - - - - - - - Qt::Orientation::Horizontal - - - - 0 - 20 - - - - - - - - - - 0 - - - 4 - - - 0 - - - 4 - - - 4 - - - 8 - - - - - Qt::Orientation::Horizontal - - - - 0 - 20 - - - - - - - - 1 - - - - - - - Set: - - - Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter - - - - - - - Start: - - - Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter - - - - - - - Prefix: - - - Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter - - - numPrefix - - - - - - - Suffix: - - - Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter - - - numSuffix - - - - - - - Qt::Orientation::Horizontal - - - QSizePolicy::Policy::Fixed - - - - 16 - 20 - - - - - - - - Style: - - - Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter - - - numFormatCombo - - - - - - - Level: - - - Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter - - - numLevelSpin - - - - - - - 1 - - - 999 - - - - - - - - - - - - - - 0 - 0 - - - - - - - - -1 - - - - - - - - - - - - 8 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 20 - - - - - - 0 - 0 - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Paragraph Effects characters offset - - - -3000.000000000000000 - - - 3000.000000000000000 - - - - - - - - - - Auto-Indent - - - - - - - Qt::Orientation::Horizontal - - - - 0 - 20 - - - - - - - - - - 4 - - - - - - 0 - 0 - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Choose Character Style or leave blank to use default Paragraph Style - - - - - - - - - - Qt::Orientation::Horizontal - - - - 0 - 20 - - - - - - - - - - - - - - FormWidget - QWidget -
ui/widgets/form_widget.h
- 1 -
- - ScrSpinBox - QDoubleSpinBox -
ui/scrspinbox.h
-
- - CharStyleComboBox - QComboBox -
ui/stylecombos.h
-
- - NumFormatCombo - QComboBox -
ui/numformatcombo.h
-
- - StackedContainer - QStackedWidget -
ui/widgets/stacked_container.h
- 1 -
-
- - peCombo - numComboBox - numFormatCombo - numLevelSpin - numStart - numPrefix - numSuffix - peOffset - peIndent - peCharStyleCombo - dropCapLines - bulletStrEdit - bulletCharTableButton - - - -
+ + + PropertyWidget_ParEffectBase + + + + 0 + 0 + 295 + 274 + + + + + 4 + + + 8 + + + 8 + + + 8 + + + 8 + + + + + + + + 0 + 0 + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + + + + Qt::Orientation::Horizontal + + + + 0 + 20 + + + + + + + + + + 2 + + + + + 0 + + + 4 + + + 0 + + + 4 + + + 4 + + + 8 + + + + + Number of lines used by the drop cap + + + Lines: + + + + + + + Drop Cap Lines + + + 2 + + + + + + + Qt::Orientation::Horizontal + + + + 40 + 20 + + + + + + + + + + 0 + + + 4 + + + 0 + + + 4 + + + 4 + + + 8 + + + + + + 0 + 0 + + + + Enhanced Character Table to choose bullet characters + + + Char Table + + + true + + + + + + + Bullet Char(s): + + + bulletStrEdit + + + + + + + + 0 + 0 + + + + true + + + + + + + Qt::Orientation::Horizontal + + + + 0 + 20 + + + + + + + + + + 0 + + + 4 + + + 0 + + + 4 + + + 4 + + + 8 + + + + + Qt::Orientation::Horizontal + + + + 0 + 20 + + + + + + + + 1 + + + + + + + Set: + + + Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter + + + + + + + Start: + + + Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter + + + + + + + Prefix: + + + Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter + + + numPrefix + + + + + + + Suffix: + + + Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter + + + numSuffix + + + + + + + Qt::Orientation::Horizontal + + + QSizePolicy::Policy::Fixed + + + + 16 + 20 + + + + + + + + Style: + + + Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter + + + numFormatCombo + + + + + + + Level: + + + Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter + + + numLevelSpin + + + + + + + 1 + + + 999 + + + + + + + + + + + + + + 0 + 0 + + + + + + + + -1 + + + + + + + + + + + + 8 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 20 + + + + + + 0 + 0 + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Paragraph Effects characters offset + + + -3000.000000000000000 + + + 3000.000000000000000 + + + + + + + + + + Suffix Align: + + + + + + + Alignment of suffix characters in numbered lists + + + + + + + Qt::Orientation::Horizontal + + + + 0 + 20 + + + + + + + + + + 4 + + + + + + 0 + 0 + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Choose Character Style or leave blank to use default Paragraph Style + + + + + + + + + + Qt::Orientation::Horizontal + + + + 0 + 20 + + + + + + + + + + + + + + FormWidget + QWidget +
ui/widgets/form_widget.h
+ 1 +
+ + ScrSpinBox + QDoubleSpinBox +
ui/scrspinbox.h
+
+ + CharStyleComboBox + QComboBox +
ui/stylecombos.h
+
+ + NumFormatCombo + QComboBox +
ui/numformatcombo.h
+
+ + StackedContainer + QStackedWidget +
ui/widgets/stacked_container.h
+ 1 +
+
+ + peCombo + numComboBox + numFormatCombo + numLevelSpin + numStart + numPrefix + numSuffix +peOffset + suffixAlignmentCombo + peCharStyleCombo + dropCapLines + bulletStrEdit + bulletCharTableButton + + + +
Index: scribus/ui/smpstylewidget.cpp =================================================================== --- scribus/ui/smpstylewidget.cpp (revision 27701) +++ scribus/ui/smpstylewidget.cpp (working copy) @@ -25,7 +25,6 @@ return al == bl; } - SMPStyleWidget::SMPStyleWidget(ScribusDoc* doc, StyleSet *cstyles) : m_Doc(doc), m_cstyles(cstyles) @@ -74,6 +73,7 @@ dropCapLines->setMaximum(99); fillPECombo(); + fillSuffixAlignmentCombo(); connect(peCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(handleParEffectUse(int))); connect(parentParEffectsButton, SIGNAL(clicked()), this, SLOT(slotParentParEffects())); @@ -156,7 +156,7 @@ numRestartCombo->blockSignals(numRestartComboBlocked); fillPECombo(); - + fillSuffixAlignmentCombo(); backgroundColor->colorButton->setPersistentToolTip( tr("Background color of selected text")); backgroundColor->setText(tr("Background")); } @@ -303,8 +303,19 @@ parEffectOffset->setValue(pstyle->parEffectOffset() * unitRatio, pstyle->isInhParEffectOffset()); parEffectOffset->setParentValue(parent->parEffectOffset() * unitRatio); - parEffectIndentBox->setChecked(pstyle->parEffectIndent(),pstyle->isInhParEffectIndent()); - parEffectIndentBox->setParentValue(parent->parEffectIndent()); + + ParagraphStyle::SuffixAlignment displayAlign = pstyle->suffixAlignment(); + if (pstyle->direction() == ParagraphStyle::RTL) + displayAlign = pstyle->flipSuffixAlignmentForRTL(displayAlign); + + ParagraphStyle::SuffixAlignment parentDisplayAlign = parent->suffixAlignment(); + if (parent->direction() == ParagraphStyle::RTL) + parentDisplayAlign = pstyle->flipSuffixAlignmentForRTL(parentDisplayAlign); + + int suffixAlignIndex = suffixAlignmentCombo->findData(static_cast(displayAlign)); + suffixAlignmentCombo->setCurrentItem(suffixAlignIndex, pstyle->isInhSuffixAlignment()); + suffixAlignmentCombo->setParentItem(suffixAlignmentCombo->findData(static_cast(parentDisplayAlign))); + dropCapLines->setValue(pstyle->dropCapLines(), pstyle->isInhDropCapLines()); dropCapLines->setParentValue(parent->dropCapLines()); bulletStrEdit->setEditText(pstyle->bulletStr()); @@ -356,10 +367,13 @@ maxGlyphExtSpin->setValue(pstyle->maxGlyphExtension() * 100.0); maxConsecutiveCountSpinBox->setValue(pstyle->hyphenConsecutiveLines()); parEffectOffset->setValue(pstyle->parEffectOffset() * unitRatio); - parEffectIndentBox->setChecked(pstyle->parEffectIndent()); - parentParEffectsButton->hide(); - disconnect(parentParEffectsButton, SIGNAL(clicked()), this, SLOT(slotParentParEffects())); + ParagraphStyle::SuffixAlignment displayAlign = pstyle->suffixAlignment(); + if (pstyle->direction() == ParagraphStyle::RTL) + displayAlign = pstyle->flipSuffixAlignmentForRTL(displayAlign); + + int suffixAlignIndex = suffixAlignmentCombo->findData(static_cast(displayAlign)); + suffixAlignmentCombo->setCurrentItem((suffixAlignIndex >= 0) ? suffixAlignIndex : 0); dropCapLines->setValue(pstyle->dropCapLines()); bulletStrEdit->setEditText(pstyle->bulletStr()); setWidgetBoldFont(bulletCharLabel, false); @@ -1000,6 +1014,17 @@ peCombo->setCurrentIndex(currIndex); } +void SMPStyleWidget::fillSuffixAlignmentCombo() +{ + QSignalBlocker sb(suffixAlignmentCombo); + int currIndex = suffixAlignmentCombo->currentIndex(); + suffixAlignmentCombo->clear(); + suffixAlignmentCombo->addItem(tr("Left"), ParagraphStyle::SuffixAlign_Left); + suffixAlignmentCombo->addItem(tr("Center"), ParagraphStyle::SuffixAlign_Center); + suffixAlignmentCombo->addItem(tr("Right"), ParagraphStyle::SuffixAlign_Right); + suffixAlignmentCombo->setCurrentIndex(currIndex); +} + void SMPStyleWidget::setParagraphEffect(int index) { QSignalBlocker sigPECombo(peCombo); @@ -1030,6 +1055,9 @@ peGroup->setVisible(false); peCombo->setCurrentIndex(0); } + bool isNumberedList = (id == 3); + suffixAlignmentLabel->setVisible(isNumberedList); + suffixAlignmentCombo->setVisible(isNumberedList); } void SMPStyleWidget::showDropCap(const QList &pstyles, const QList &cstyles, int unitIndex) Index: scribus/ui/smpstylewidget.h =================================================================== --- scribus/ui/smpstylewidget.h (revision 27701) +++ scribus/ui/smpstylewidget.h (working copy) @@ -52,6 +52,7 @@ void fillNumerationsCombo(); void fillNumRestartCombo(); void fillPECombo(); + void fillSuffixAlignmentCombo(); void setParagraphEffect(int); void showColors(const QList &cstyles); void showLineSpacing(const QList &pstyles); Index: scribus/ui/smpstylewidget.ui =================================================================== --- scribus/ui/smpstylewidget.ui (revision 27701) +++ scribus/ui/smpstylewidget.ui (working copy) @@ -29,7 +29,7 @@ - 0 + 1 @@ -181,7 +181,7 @@ - + 0 @@ -280,7 +280,7 @@ 4 - + 0 @@ -326,7 +326,7 @@ - + 0 @@ -379,7 +379,7 @@ - + 0 @@ -389,7 +389,7 @@ - + true @@ -419,7 +419,7 @@ - + 0 @@ -459,7 +459,7 @@ - + 0 @@ -469,7 +469,7 @@ - + true @@ -597,7 +597,7 @@ 16 - + 0 @@ -673,7 +673,7 @@ 16 - + 0 @@ -710,7 +710,7 @@ - + 0 @@ -804,7 +804,7 @@ 16 - + 0 @@ -844,7 +844,7 @@ - + 0 @@ -1021,7 +1021,7 @@ - + 0 @@ -1441,7 +1441,7 @@ - + 0 @@ -1451,10 +1451,7 @@ New Set: - - FormWidget::LabelPosition::Left - - + false @@ -1476,6 +1473,20 @@ + + + + Alignment of suffix characters in numbered lists + + + + + + + Suffix Align: + + + @@ -1506,7 +1517,7 @@ 16 - + 0 @@ -1546,46 +1557,6 @@ - - - - 0 - 0 - - - - - - - true - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Hang Paragraph Effect before paragraph indent - - - Auto-Indent - - - - - - - Qt::Orientation::Horizontal @@ -1606,7 +1577,7 @@ 16 - + 0 @@ -1792,7 +1763,6 @@ parentParEffectsButton dropCapLines parEffectOffset - parEffectIndentBox parEffectCharStyleCombo numPrefix numSuffix Index: scribus/ui/smtextstyles.cpp =================================================================== --- scribus/ui/smtextstyles.cpp (revision 27701) +++ scribus/ui/smtextstyles.cpp (working copy) @@ -37,7 +37,6 @@ #include "units.h" #include "util.h" - SMParagraphStyle::SMParagraphStyle(SMCharacterStyle* cstyleItem): m_cstyleItem(cstyleItem) { @@ -511,7 +510,7 @@ connect(m_pwidget->peCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(slotPargraphEffects(int))); connect(m_pwidget->dropCapLines, SIGNAL(valueChanged(int)), this, SLOT(slotDropCapLines(int))); connect(m_pwidget->parEffectOffset, SIGNAL(valueChanged(double)), this, SLOT(slotParEffectOffset())); - connect(m_pwidget->parEffectIndentBox, SIGNAL(toggled(bool)), this, SLOT(slotParEffectIndent(bool))); + connect(m_pwidget->suffixAlignmentCombo, SIGNAL(activated(int)), this, SLOT(slotSuffixAlignment(int))); connect(m_pwidget->parEffectCharStyleCombo, SIGNAL(activated(int)), this, SLOT(slotParEffectCharStyle(int))); connect(m_pwidget->bulletStrEdit, SIGNAL(editTextChanged(QString)), this, SLOT(slotBulletStr(QString))); connect(m_pwidget->numComboBox, SIGNAL(textActivated(QString)), this, SLOT(slotNumName(QString))); @@ -606,8 +605,7 @@ disconnect(m_pwidget->peCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(slotPargraphEffects(int))); disconnect(m_pwidget->dropCapLines, SIGNAL(valueChanged(int)), this, SLOT(slotDropCapLines(int))); disconnect(m_pwidget->parEffectOffset, SIGNAL(valueChanged(double)), this, SLOT(slotParEffectOffset())); - disconnect(m_pwidget->parEffectIndentBox, SIGNAL(toggled(bool)), this, SLOT(slotParEffectIndent(bool))); - disconnect(m_pwidget->parEffectCharStyleCombo, SIGNAL(activated(int)), this, SLOT(slotParEffectCharStyle(int))); + disconnect(m_pwidget->suffixAlignmentCombo, SIGNAL(activated(int)), this, SLOT(slotSuffixAlignment(int))); disconnect(m_pwidget->bulletStrEdit, SIGNAL(editTextChanged(QString)), this, SLOT(slotBulletStr(QString))); disconnect(m_pwidget->numComboBox, SIGNAL(textActivated(QString)), this, SLOT(slotNumName(QString))); disconnect(m_pwidget->numFormatCombo, SIGNAL(activated(int)), this, SLOT(slotNumFormat(int))); @@ -953,17 +951,25 @@ slotSelectionDirty(); } -void SMParagraphStyle::slotParEffectIndent(bool isOn) +void SMParagraphStyle::slotSuffixAlignment(int index) { - if (m_pwidget->parEffectIndentBox->useParentValue()) + if (m_pwidget->suffixAlignmentCombo->useParentValue()) + { for (int i = 0; i < m_selection.count(); ++i) - m_selection[i]->resetParEffectIndent(); - else + m_selection[i]->resetSuffixAlignment(); + } + else { + auto align = static_cast(m_pwidget->suffixAlignmentCombo->itemData(index).toInt()); for (int i = 0; i < m_selection.count(); ++i) - m_selection[i]->setParEffectIndent(isOn); + { + ParagraphStyle::SuffixAlignment styleAlign = align; + if (m_selection[i]->direction() == ParagraphStyle::RTL) + styleAlign = m_selection[i]->flipSuffixAlignmentForRTL(styleAlign); + m_selection[i]->setSuffixAlignment(styleAlign); + } } - + slotSelectionDirty(); } Index: scribus/ui/smtextstyles.h =================================================================== --- scribus/ui/smtextstyles.h (revision 27701) +++ scribus/ui/smtextstyles.h (working copy) @@ -77,7 +77,7 @@ void slotPargraphEffects(int index); void slotDropCapLines(int lines); void slotParEffectOffset(); - void slotParEffectIndent(bool); + void slotSuffixAlignment(int); void slotParEffectCharStyle(int); void slotBulletStr(const QString &str); void slotNumName(const QString &str);