diff --git a/sources/autoNum/assignvariables.cpp b/sources/autoNum/assignvariables.cpp index ecdd53907..2aff912fe 100644 --- a/sources/autoNum/assignvariables.cpp +++ b/sources/autoNum/assignvariables.cpp @@ -39,6 +39,7 @@ namespace autonum sequentialNumbers::sequentialNumbers(const sequentialNumbers &other) { unit = other.unit; + wrap = other.wrap; unit_folio = other.unit_folio; ten = other.ten; ten_folio = other.ten_folio; @@ -57,6 +58,7 @@ namespace autonum return (*this); unit = other.unit; + wrap = other.wrap; unit_folio = other.unit_folio; ten = other.ten; ten_folio = other.ten_folio; @@ -70,6 +72,7 @@ namespace autonum bool sequentialNumbers::operator==(const sequentialNumbers &other) const { if (unit == other.unit && \ + wrap == other.wrap && \ unit_folio == other.unit_folio && \ ten == other.ten && \ ten_folio == other.ten_folio && \ @@ -107,6 +110,11 @@ namespace autonum document, "unit", unit.join(";"))); + if (!wrap.isEmpty()) + element.appendChild(QETXML::textToDomElement( + document, + "wrap", + wrap.join(";"))); if (!unit_folio.isEmpty()) element.appendChild(QETXML::textToDomElement( document, @@ -156,6 +164,11 @@ namespace autonum from = element.firstChildElement("unit"); unit = from.text().split(";"); + //Absent from files written before cyclic parts could be + //rendered; an empty list is the correct reading of that. + from = element.firstChildElement("wrap"); + wrap = from.text().split(";"); + from = element.firstChildElement("unitFolio"); unit_folio = from.text().split(";"); @@ -179,6 +192,7 @@ namespace autonum void sequentialNumbers::clear() { unit.clear(); + wrap.clear(); unit_folio.clear(); ten.clear(); ten_folio.clear(); @@ -434,7 +448,8 @@ namespace autonum qMax( qMax(m_seq_struct.hundred.size(), m_seq_struct.ten.size()), - m_seq_struct.alpha.size()) + qMax(m_seq_struct.alpha.size(), + m_seq_struct.wrap.size())) ); for (int i=1; i<=max ; i++) @@ -442,6 +457,9 @@ namespace autonum if (m_assigned_label.contains("%sequ_" + QString::number(i)) && m_seq_struct.unit.size() >= i) { m_assigned_label.replace("%sequ_" + QString::number(i),m_seq_struct.unit.at(i-1)); } + if (m_assigned_label.contains("%seqw_" + QString::number(i)) && m_seq_struct.wrap.size() >= i) { + m_assigned_label.replace("%seqw_" + QString::number(i),m_seq_struct.wrap.at(i-1)); + } if (m_assigned_label.contains("%seqt_" + QString::number(i)) && m_seq_struct.ten.size() >= i) { m_assigned_label.replace("%seqt_" + QString::number(i),m_seq_struct.ten.at(i-1)); } @@ -553,6 +571,10 @@ namespace autonum { autonum::setSequentialToList(seqStruct.unit, context,"unit"); } + if (label.contains("%seqw_")) + { + autonum::setSequentialToList(seqStruct.wrap, context,"wrap"); + } if (label.contains("%sequf_")) { autonum::setSequentialToList(seqStruct.unit_folio, context,"unitfolio"); @@ -594,6 +616,7 @@ namespace autonum QString value; QString formula; int count_unit = 0; + int count_wrap = 0; int count_unitf = 0; int count_ten = 0; int count_tenf = 0; @@ -636,6 +659,10 @@ namespace autonum count_unit++; formula.append("%sequ_" + QString::number(count_unit)); } + else if (type == "wrap") { + count_wrap++; + formula.append("%seqw_" + QString::number(count_wrap)); + } else if (type == "unitfolio") { count_unitf++; formula.append("%sequf_" + QString::number(count_unitf)); diff --git a/sources/autoNum/assignvariables.h b/sources/autoNum/assignvariables.h index 15678d019..5fffdf43f 100644 --- a/sources/autoNum/assignvariables.h +++ b/sources/autoNum/assignvariables.h @@ -47,6 +47,8 @@ namespace autonum void clear(); QStringList unit; + /// Values of the cyclic (modulo) parts, referenced by %seqw_N. + QStringList wrap; QStringList unit_folio; QStringList ten; QStringList ten_folio;