r22971 by jghali -

scribus-commit scribus-commit at lists.scribus.net
Mon Apr 29 17:23:08 UTC 2019


Author: jghali
Date: Mon Apr 29 17:23:08 2019
New Revision: 22971

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22971
Log:
#15664: Support Hebrew numbering system

Added:
    trunk/Scribus/scribus/ui/numformatcombo.cpp
    trunk/Scribus/scribus/ui/numformatcombo.h
    trunk/Scribus/scribus/ui/smnumformatcombo.cpp
    trunk/Scribus/scribus/ui/smnumformatcombo.h
Modified:
    trunk/Scribus/Scribus.pro
    trunk/Scribus/scribus/CMakeLists.txt
    trunk/Scribus/scribus/numeration.cpp
    trunk/Scribus/scribus/numeration.h
    trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
    trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
    trunk/Scribus/scribus/ui/notesstyleseditor.cpp
    trunk/Scribus/scribus/ui/notesstyleseditor.ui
    trunk/Scribus/scribus/ui/prefs_documentsections.cpp
    trunk/Scribus/scribus/ui/propertywidget_pareffect.cpp
    trunk/Scribus/scribus/ui/propertywidget_pareffect.h
    trunk/Scribus/scribus/ui/propertywidget_pareffectbase.ui
    trunk/Scribus/scribus/ui/smpstylewidget.cpp
    trunk/Scribus/scribus/ui/smpstylewidget.h
    trunk/Scribus/scribus/ui/smpstylewidget.ui
    trunk/Scribus/scribus/ui/smtextstyles.cpp
    trunk/Scribus/scribus/ui/smtextstyles.h
    trunk/Scribus/scribus/util.cpp
    trunk/Scribus/scribus/util.h
    trunk/Scribus/win32/msvc2013/scribus-main/Scribus.vcxproj
    trunk/Scribus/win32/msvc2013/scribus-main/Scribus.vcxproj.filters
    trunk/Scribus/win32/msvc2015/scribus-main/Scribus.vcxproj
    trunk/Scribus/win32/msvc2015/scribus-main/Scribus.vcxproj.filters

Modified: trunk/Scribus/Scribus.pro
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22971&path=/trunk/Scribus/Scribus.pro
==============================================================================
--- trunk/Scribus/Scribus.pro	(original)
+++ trunk/Scribus/Scribus.pro	Mon Apr 29 17:23:08 2019
@@ -494,6 +494,7 @@
            scribus/ui/nftwidget.h \
            scribus/ui/nodeeditpalette.h \
            scribus/ui/notesstyleseditor.h \
+           scribus/ui/numformatcombo.h \
            scribus/ui/oneclick.h \
            scribus/ui/openpalette.h \
            scribus/ui/openpaletteview.h \
@@ -616,6 +617,7 @@
            scribus/ui/smlineedit.h \
            scribus/ui/smlinestyle.h \
            scribus/ui/smlinestylewidget.h \
+           scribus/ui/smnumformatcombo.h \
            scribus/ui/smpstylewidget.h \
            scribus/ui/smradiobutton.h \
            scribus/ui/smreplacedia.h \
@@ -1175,6 +1177,7 @@
          scribus/plugins/scripter/python/sceditor/mainwindow.ui \
          scribus/plugins/tools/2geomtools/meshdistortion/meshdistortiondialog.ui \
          scribus/plugins/tools/2geomtools/pathalongpath/pathdialogbase.ui
+
 SOURCES += scribus/actionmanager.cpp \
            scribus/appmodehelper.cpp \
            scribus/canvas.cpp \
@@ -1610,6 +1613,7 @@
            scribus/ui/nftwidget.cpp \
            scribus/ui/nodeeditpalette.cpp \
            scribus/ui/notesstyleseditor.cpp \
+           scribus/ui/numformatcombo.cpp \
            scribus/ui/oneclick.cpp \
            scribus/ui/openpalette.cpp \
            scribus/ui/openpaletteview.cpp \
@@ -1731,6 +1735,7 @@
            scribus/ui/smlineedit.cpp \
            scribus/ui/smlinestyle.cpp \
            scribus/ui/smlinestylewidget.cpp \
+           scribus/ui/smnumformatcombo.cpp \
            scribus/ui/smpstylewidget.cpp \
            scribus/ui/smradiobutton.cpp \
            scribus/ui/smreplacedia.cpp \

Modified: trunk/Scribus/scribus/CMakeLists.txt
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22971&path=/trunk/Scribus/scribus/CMakeLists.txt
==============================================================================
--- trunk/Scribus/scribus/CMakeLists.txt	(original)
+++ trunk/Scribus/scribus/CMakeLists.txt	Mon Apr 29 17:23:08 2019
@@ -404,6 +404,7 @@
 	ui/nftwidget.h
 	ui/nodeeditpalette.h
 	ui/notesstyleseditor.h
+	ui/numformatcombo.h
 	ui/oneclick.h
 	ui/outlinepalette.h
 	ui/pageitemattributes.h
@@ -515,6 +516,7 @@
 	ui/smfontcomboh.h
 	ui/smlinestyle.h
 	ui/smlinestylewidget.h
+	ui/smnumformatcombo.h
 	ui/smpstylewidget.h
 	ui/smradiobutton.h
 	ui/smreplacedia.h
@@ -901,6 +903,7 @@
 	ui/nftwidget.cpp
 	ui/nodeeditpalette.cpp
 	ui/notesstyleseditor.cpp
+	ui/numformatcombo.cpp
 	ui/oneclick.cpp
 	ui/outlinepalette.cpp
 	ui/pageitemattributes.cpp
@@ -1012,6 +1015,7 @@
 	ui/smfontcomboh.cpp
 	ui/smlinestyle.cpp
 	ui/smlinestylewidget.cpp
+	ui/smnumformatcombo.cpp
 	ui/smpstylewidget.cpp
 	ui/smradiobutton.cpp
 	ui/smreplacedia.cpp

Modified: trunk/Scribus/scribus/numeration.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22971&path=/trunk/Scribus/scribus/numeration.cpp
==============================================================================
--- trunk/Scribus/scribus/numeration.cpp	(original)
+++ trunk/Scribus/scribus/numeration.cpp	Mon Apr 29 17:23:08 2019
@@ -1,5 +1,89 @@
+#include <array>
+
 #include "numeration.h"
 #include "util.h"
+
+static const std::array<NumFormatPair, 12> numFormatStringPairs = { {
+	{ Type_1_2_3, QString("Type_1_2_3") },
+	{ Type_1_2_3_ar, QString("Type_1_2_3_ar") },
+	{ Type_i_ii_iii, QString("Type_i_ii_iii") },
+	{ Type_I_II_III, QString("Type_I_II_III") },
+	{ Type_a_b_c, QString("Type_a_b_c") },
+	{ Type_A_B_C, QString("Type_A_B_C") },
+	{ Type_Alphabet_ar, QString("Type_Alphabet_ar") },
+	{ Type_Abjad_ar, QString("Type_Abjad_ar") },
+	{ Type_Hebrew, QString("Type_Hebrew") },
+	{ Type_asterix, QString("Type_asterix") },
+	{ Type_CJK, QString("Type_CJK") },
+	{ Type_None, QString("Type_None") },
+}};
+
+static const std::array<NumFormatPair, 12> numFormatUserStringPairs = { {
+	{ Type_1_2_3, QString::fromLatin1("1, 2, 3, ...") },
+	{ Type_1_2_3_ar, QString::fromUtf8("\xE2\x80\xADÙ¡, Ù¢, Ù£, ...\xE2\x80\xAC") },
+	{ Type_i_ii_iii, QString::fromLatin1("i, ii, iii, ...") },
+	{ Type_I_II_III, QString::fromLatin1("I, II, III, ...") },
+	{ Type_a_b_c, QString::fromLatin1("a, b, c, ...") },
+	{ Type_A_B_C, QString::fromLatin1("A, B, C, ...") },
+	{ Type_Alphabet_ar, QString::fromUtf8("\xE2\x80\xADأ, ب, ت, ...\xE2\x80\xAC") },
+	{ Type_Abjad_ar, QString::fromUtf8("\xE2\x80\xADأ, ب, ج, ...\xE2\x80\xAC") },
+	{ Type_Hebrew, QString::fromUtf8("\xE2\x80\xADא, ב, ג, ...\xE2\x80\xAC") },
+	{ Type_asterix, QString::fromLatin1("*") },
+	{ Type_CJK, QString::fromLatin1("CJK") },
+	{ Type_None, QString::fromLatin1("None") }
+}};
+
+QString fromNumToString(NumFormat format)
+{
+	size_t size = numFormatStringPairs.size();
+	for (size_t i = 0; i < size; ++i)
+	{
+		const NumFormatPair& fmtPair = numFormatStringPairs[i];
+		if (fmtPair.format == format)
+			return fmtPair.str;
+	}
+
+	return numFormatStringPairs[0].str; // Type_1_2_3
+}
+
+QString fromNumToUserString(NumFormat format)
+{
+	size_t size = numFormatUserStringPairs.size();
+	for (size_t i = 0; i < size; ++i)
+	{
+		const NumFormatPair& fmtPair = numFormatUserStringPairs[i];
+		if (fmtPair.format == format)
+			return fmtPair.str;
+	}
+
+	return numFormatUserStringPairs[0].str; // Type_1_2_3
+}
+
+NumFormat fromStringToNum(const QString& str)
+{
+	size_t size = numFormatStringPairs.size();
+	for (size_t i = 0; i < size; ++i)
+	{
+		const NumFormatPair& fmtPair = numFormatStringPairs[i];
+		if (fmtPair.str == str)
+			return fmtPair.format;
+	}
+
+	return numFormatStringPairs[0].format; // Type_1_2_3
+}
+
+NumFormat fromUserStringToNum(const QString& str)
+{
+	size_t size = numFormatUserStringPairs.size();
+	for (size_t i = 0; i < size; ++i)
+	{
+		const NumFormatPair& fmtPair = numFormatUserStringPairs[i];
+		if (fmtPair.str == str)
+			return fmtPair.format;
+	}
+
+	return numFormatUserStringPairs[0].format; // Type_1_2_3
+}
 
 QString getStringFromNum(NumFormat format, int num, QChar leadingChar, int charsLen)
 {
@@ -20,17 +104,17 @@
 QStringList getFormatList()
 {
 	QStringList list;
-	list << QString::fromLatin1("1, 2, 3, ...")
-	     // U+202D...U+202C to force the string to be displayed LTR
-	     << QString::fromUtf8("\xE2\x80\xADÙ¡, Ù¢, Ù£, ...\xE2\x80\xAC")
-	     << QString::fromLatin1("i, ii, iii, ...")
-	     << QString::fromLatin1("I, II, III, ...")
-	     << QString::fromLatin1("a, b, c, ...")
-	     << QString::fromLatin1("A, B, C, ...")
-	     << QString::fromUtf8("\xE2\x80\xADأ, ب, ت, ...\xE2\x80\xAC")
-	     << QString::fromUtf8("\xE2\x80\xADأ, ب, ج, ...\xE2\x80\xAC")
-	     << QString::fromLatin1("*")
-	     << QString::fromLatin1("CJK");
+	list << fromNumToUserString(Type_1_2_3)
+	     << fromNumToUserString(Type_1_2_3_ar)
+	     << fromNumToUserString(Type_i_ii_iii)
+	     << fromNumToUserString(Type_I_II_III)
+	     << fromNumToUserString(Type_a_b_c)
+	     << fromNumToUserString(Type_A_B_C)
+	     << fromNumToUserString(Type_Alphabet_ar)
+	     << fromNumToUserString(Type_Abjad_ar)
+	     << fromNumToUserString(Type_Hebrew)
+	     << fromNumToUserString(Type_asterix)
+	     << fromNumToUserString(Type_CJK);
 	return list;
 }
 

Modified: trunk/Scribus/scribus/numeration.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22971&path=/trunk/Scribus/scribus/numeration.h
==============================================================================
--- trunk/Scribus/scribus/numeration.h	(original)
+++ trunk/Scribus/scribus/numeration.h	Mon Apr 29 17:23:08 2019
@@ -5,7 +5,7 @@
 #include <QStringList>
 #include <QMap>
 
-typedef enum 
+enum NumFormat
 {
 	Type_1_2_3,
 	Type_1_2_3_ar,
@@ -17,17 +17,19 @@
 	Type_Abjad_ar,
 	Type_asterix,
 	Type_CJK,
+	Type_Hebrew,
 	Type_None=99
-} NumFormat;
+};
 
-typedef enum {
+enum NumerationRange
+{
 	NSRdocument,
 	NSRsection,
 	NSRstory,
 	NSRpage,
 	NSRframe
 //	NSRblock //used for contignous numeration eg. paragraphs - paragraph without numbering reset counter
-} NumerationRange;
+};
 
 class Numeration
 {
@@ -47,15 +49,31 @@
 	int start;
 };
 
+struct NumFormatPair
+{
+	NumFormat format;
+	QString   str;
+};
+
 //struct used by ScribusDoc for storing numerations used in document
-typedef struct {
+struct NumStruct
+{
 	QString m_name;
 	QList<Numeration> m_nums;
 	QList<int> m_counters;
 	int m_lastlevel;
-} NumStruct;
+};
 
 //util functions for use without Numeration class
+
+//convert passed num to a string useable when saving file
+QString fromNumToString(NumFormat format);
+//convert passed num to a string useable in a combobox
+QString fromNumToUserString(NumFormat format);
+//convert string to its NumFormat representation
+NumFormat fromStringToNum(const QString& str);
+//convert user string to its NumFormat representation
+NumFormat fromUserStringToNum(const QString& str);
 //convert passed num to string using numeration style
 QString getStringFromNum(NumFormat format, int num, QChar leadingChar='0', int charsLen=0);
 //convert passed num to string with custom chars

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22971&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp	(original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp	Mon Apr 29 17:23:08 2019
@@ -3408,6 +3408,8 @@
 				NS.setType(Type_Alphabet_ar);
 			else if (type == "Type_Abjad_ar")
 				NS.setType(Type_Abjad_ar);
+			else if (type == "Type_Hebrew")
+				NS.setType(Type_Hebrew);
 			else if (type == "Type_asterix")
 				NS.setType(Type_asterix);
 			else if (type == "Type_CJK")
@@ -3576,6 +3578,8 @@
 				newSection.type=Type_Alphabet_ar;
 			if (type == "Type_Abjad_ar")
 				newSection.type=Type_Abjad_ar;
+			if (type == "Type_Hebrew")
+				newSection.type=Type_Hebrew;
 			if (type == "Type_CJK")
 				newSection.type=Type_CJK;
 			if (type == "Type_None")

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22971&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp	(original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp	Mon Apr 29 17:23:08 2019
@@ -1273,6 +1273,9 @@
 			case Type_Abjad_ar:
 				docu.writeAttribute("Type", "Type_Abjad_ar");
 				break;
+			case Type_Hebrew:
+				docu.writeAttribute("Type", "Type_Hebrew");
+				break;
 			case Type_asterix:
 				docu.writeAttribute("Type", "Type_asterix");
 				break;
@@ -1364,6 +1367,9 @@
 				break;
 			case Type_Abjad_ar:
 				docu.writeAttribute("Type", "Type_Abjad_ar");
+				break;
+			case Type_Hebrew:
+				docu.writeAttribute("Type", "Type_Hebrew");
 				break;
 			case Type_asterix:
 				docu.writeAttribute("Type", "Type_asterix");

Modified: trunk/Scribus/scribus/ui/notesstyleseditor.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22971&path=/trunk/Scribus/scribus/ui/notesstyleseditor.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/notesstyleseditor.cpp	(original)
+++ trunk/Scribus/scribus/ui/notesstyleseditor.cpp	Mon Apr 29 17:23:08 2019
@@ -24,13 +24,6 @@
 	addNewNsMode = false;
 	setDoc(nullptr);
 	NSlistBox->setInsertPolicy(QComboBox::InsertAlphabetically);
-
-	NumberingBox->addItem("1 2 3");
-	NumberingBox->addItem("i ii iii");
-	NumberingBox->addItem("I II III");
-	NumberingBox->addItem("a b c");
-	NumberingBox->addItem("A B C");
-	NumberingBox->addItem("*");
 
 	RangeBox->addItem(tr("Document"));
 	RangeBox->addItem(tr("Section"));
@@ -207,7 +200,7 @@
 	else
 		EndRadio->setEnabled(true);
 	EndRadio->setChecked(NS->isEndNotes());
-	NumberingBox->setCurrentIndex((int) NS->getType());
+	NumberingBox->setCurrentFormat(NS->getType());
 	RangeBox->setCurrentIndex((int) NS->range());
 	StartSpinBox->setValue(NS->start());
 	PrefixEdit->setText(NS->prefix());
@@ -500,10 +493,12 @@
 	setBlockSignals(wasSignalsBlocked);
 }
 
-void NotesStylesEditor::on_NumberingBox_currentIndexChanged(int index)
-{
-	NotesStyle ns = changesMap.value(NSlistBox->currentText());
-	ns.setType((NumFormat) index);
+void NotesStylesEditor::on_NumberingBox_currentIndexChanged(int /*index*/)
+{
+	NotesStyle ns = changesMap.value(NSlistBox->currentText());
+
+	NumFormat formatType = NumberingBox->currentFormat();
+	ns.setType(formatType);
 
 	changesMap.insert(NSlistBox->currentText(), ns);
 	ApplyButton->setEnabled(true);

Modified: trunk/Scribus/scribus/ui/notesstyleseditor.ui
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22971&path=/trunk/Scribus/scribus/ui/notesstyleseditor.ui
==============================================================================
--- trunk/Scribus/scribus/ui/notesstyleseditor.ui	(original)
+++ trunk/Scribus/scribus/ui/notesstyleseditor.ui	Mon Apr 29 17:23:08 2019
@@ -95,7 +95,7 @@
         </widget>
        </item>
        <item row="2" column="1">
-        <widget class="QComboBox" name="NumberingBox">
+        <widget class="NumFormatCombo" name="NumberingBox">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
            <horstretch>0</horstretch>
@@ -338,6 +338,11 @@
    <header>ui/spalette.h</header>
   </customwidget>
   <customwidget>
+   <class>NumFormatCombo</class>
+   <extends>QComboBox</extends>
+   <header>ui/numformatcombo.h</header>
+  </customwidget>
+  <customwidget>
    <class>ParaStyleComboBox</class>
    <extends>QComboBox</extends>
    <header>ui/spalette.h</header>

Modified: trunk/Scribus/scribus/ui/prefs_documentsections.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22971&path=/trunk/Scribus/scribus/ui/prefs_documentsections.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_documentsections.cpp	(original)
+++ trunk/Scribus/scribus/ui/prefs_documentsections.cpp	Mon Apr 29 17:23:08 2019
@@ -13,6 +13,7 @@
 #include "commonstrings.h"
 #include "prefsstructs.h"
 #include "scribusdoc.h"
+#include "ui/numformatcombo.h"
 #include "ui/scmessagebox.h"
 
 Prefs_DocumentSections::Prefs_DocumentSections(QWidget* parent, ScribusDoc* doc)
@@ -76,13 +77,10 @@
 		QTableWidgetItem *item4 = new QTableWidgetItem(QString::number(it->toindex + 1));
 		sectionsTable->setItem(row, i++, item4);
 		//Style
-		QComboBox *item5 = new QComboBox();
+		NumFormatCombo *item5 = new NumFormatCombo(nullptr, true);
 		item5->addItems(m_styles);
 		sectionsTable->setCellWidget(row, i++, item5);
-		if (it->type==Type_None)
-			item5->setCurrentIndex(m_styles.count() - 1);
-		else
-			item5->setCurrentIndex(it->type);
+		item5->setCurrentFormat(it->type);
 		//Start Page Number
 		QTableWidgetItem *item6 = new QTableWidgetItem(QString::number(it->sectionstartindex));
 		sectionsTable->setItem(row, i++, item6);
@@ -146,16 +144,9 @@
 			break;
 		case 5:
 			{
-				QComboBox* qcti = dynamic_cast<QComboBox*>(sectionsTable->cellWidget(row,col));
+				NumFormatCombo* qcti = dynamic_cast<NumFormatCombo*>(sectionsTable->cellWidget(row,col));
 				if (qcti != nullptr)
-				{
-					int index = qcti->currentIndex();
-					if (index < m_styles.count() - 1)
-						m_localSections[row].type = (NumFormat) index;
-					else
-						if (index == m_styles.count() - 1)
-							m_localSections[row].type = Type_None;
-				}
+					m_localSections[row].type = qcti->currentFormat();
 			}
 			break;
 		case 6:

Modified: trunk/Scribus/scribus/ui/propertywidget_pareffect.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22971&path=/trunk/Scribus/scribus/ui/propertywidget_pareffect.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertywidget_pareffect.cpp	(original)
+++ trunk/Scribus/scribus/ui/propertywidget_pareffect.cpp	Mon Apr 29 17:23:08 2019
@@ -34,7 +34,6 @@
 	if (m_doc)
 		peCharStyleCombo->updateFormatList();
 	fillBulletStrEditCombo();
-	fillNumFormatCombo();
 	enableParEffect(false);
 	bulletCharTableButton->setIcon(IconManager::instance()->loadIcon("22/insert-table.png"));
 	numStart->setMinimum(1);
@@ -209,12 +208,6 @@
 	bulletStrEdit->setMinimumWidth(50);
 	if (bulletStrEdit->currentText().isEmpty())
 		bulletStrEdit->setEditText(QChar(0x2022));
-}
-
-void PropertyWidget_ParEffect::fillNumFormatCombo()
-{
-	numFormatCombo->clear();
-	numFormatCombo->addItems(getFormatList());
 }
 
 void PropertyWidget_ParEffect::fillPECombo()
@@ -289,8 +282,7 @@
 	numSuffix->setText(newPStyle.numSuffix());
 	numStart->setValue(newPStyle.numStart());
 
-	nFormat = newPStyle.numFormat();
-	numFormatCombo->setCurrentIndex(nFormat);
+	numFormatCombo->setCurrentFormat((NumFormat) newPStyle.numFormat());
 	peOffset->setValue(newPStyle.parEffectOffset() * m_unitRatio);
 	peIndent->setChecked(newPStyle.parEffectIndent());
 	showCharStyle(newPStyle.peCharStyleName());
@@ -408,7 +400,7 @@
 		newStyle.setHasBullet(false);
 		newStyle.setHasNum(true);
 		newStyle.setNumName(numComboBox->currentText());
-		newStyle.setNumFormat(numFormatCombo->currentIndex());
+		newStyle.setNumFormat(numFormatCombo->currentFormat());
 		newStyle.setNumLevel(numLevelSpin->value() -1);
 		newStyle.setNumStart(numStart->value());
 		newStyle.setNumPrefix(numPrefix->text());
@@ -472,7 +464,7 @@
 		numLevelSpin->setValue(level +1);
 		newStyle.setNumLevel(level);
 		Numeration num = numS->m_nums[level];
-		numFormatCombo->setCurrentIndex((int) num.numFormat);
+		numFormatCombo->setCurrentFormat(num.numFormat);
 		numStart->setValue(num.start);
 		numPrefix->setText(num.prefix);
 		numSuffix->setText(num.suffix);
@@ -480,17 +472,19 @@
 	newStyle.setNumPrefix(numPrefix->text());
 	newStyle.setNumSuffix(numSuffix->text());
 	newStyle.setNumName(numName);
-	newStyle.setNumFormat((NumFormat) numFormatCombo->currentIndex());
+	newStyle.setNumFormat(numFormatCombo->currentFormat());
 	handleChanges(m_item, newStyle);
 	connectSignals();
 }
 
-void PropertyWidget_ParEffect::handleNumFormat(int style)
-{
-	if (!m_doc || !m_item)
-		return;
-	ParagraphStyle newStyle;
-	newStyle.setNumFormat(style);
+void PropertyWidget_ParEffect::handleNumFormat(int /*style*/)
+{
+	if (!m_doc || !m_item)
+		return;
+	NumFormat format = numFormatCombo->currentFormat();
+
+	ParagraphStyle newStyle;
+	newStyle.setNumFormat(format);
 	handleChanges(m_item, newStyle);
 }
 
@@ -506,7 +500,7 @@
 		{
 			numS->m_counters.append(0);
 			Numeration num;
-			num.numFormat = (NumFormat) numFormatCombo->currentIndex();
+			num.numFormat = numFormatCombo->currentFormat();
 			num.prefix = numPrefix->text();
 			num.suffix = numSuffix->text();
 			num.start = numStart->value();

Modified: trunk/Scribus/scribus/ui/propertywidget_pareffect.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22971&path=/trunk/Scribus/scribus/ui/propertywidget_pareffect.h
==============================================================================
--- trunk/Scribus/scribus/ui/propertywidget_pareffect.h	(original)
+++ trunk/Scribus/scribus/ui/propertywidget_pareffect.h	Mon Apr 29 17:23:08 2019
@@ -80,8 +80,6 @@
 	void enableParEffect(bool);
 	void fillBulletStrEditCombo();
 
-	void fillNumFormatCombo();
-
 	void fillPECombo();
 
 signals:

Modified: trunk/Scribus/scribus/ui/propertywidget_pareffectbase.ui
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22971&path=/trunk/Scribus/scribus/ui/propertywidget_pareffectbase.ui
==============================================================================
--- trunk/Scribus/scribus/ui/propertywidget_pareffectbase.ui	(original)
+++ trunk/Scribus/scribus/ui/propertywidget_pareffectbase.ui	Mon Apr 29 17:23:08 2019
@@ -210,7 +210,7 @@
          </widget>
         </item>
         <item>
-         <widget class="QComboBox" name="numFormatCombo">
+         <widget class="NumFormatCombo" name="numFormatCombo">
           <property name="sizePolicy">
            <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
             <horstretch>0</horstretch>
@@ -350,6 +350,11 @@
    <extends>QComboBox</extends>
    <header>ui/spalette.h</header>
   </customwidget>
+  <customwidget>
+   <class>NumFormatCombo</class>
+   <extends>QComboBox</extends>
+   <header>ui/numformatcombo.h</header>
+  </customwidget>
  </customwidgets>
  <resources/>
  <connections/>

Modified: trunk/Scribus/scribus/ui/smpstylewidget.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22971&path=/trunk/Scribus/scribus/ui/smpstylewidget.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/smpstylewidget.cpp	(original)
+++ trunk/Scribus/scribus/ui/smpstylewidget.cpp	Mon Apr 29 17:23:08 2019
@@ -67,7 +67,6 @@
 
 	fillBulletStrEditCombo();
 	bulletCharTableButton->setIcon(IconManager::instance()->loadPixmap("22/insert-table.png"));
-	fillNumFormatCombo();
 	numStartSpin->setMinimum(1);
 	numStartSpin->setMaximum(9999);
 	numLevelSpin->setMinimum(1);
@@ -187,12 +186,6 @@
 	bulletStrEdit->setMinimumWidth(50);
 	if (bulletStrEdit->currentText().isEmpty())
 		bulletStrEdit->setEditText(QChar(0x2022));
-}
-
-void SMPStyleWidget::fillNumFormatCombo()
-{
-	numFormatCombo->clear();
-	numFormatCombo->addItems(getFormatList());
 }
 
 void SMPStyleWidget::fillNumerationsCombo()
@@ -257,7 +250,6 @@
 	maxConsecutiveCountSpinBox->clear();
 	
 	//fillBulletStrEditCombo();
-	//fillNumFormatCombo();
 	//fillNumerationsCombo();
 	//fillNumRestartCombo();
 
@@ -367,8 +359,8 @@
 			numComboBox->setParentItem(numComboBox->findText(parent->numName()));
 		else
 			numComboBox->setParentItem(0);
-		numFormatCombo->setCurrentItem(pstyle->numFormat());
-		numFormatCombo->setParentItem(parent->numFormat());
+		numFormatCombo->setCurrentFormat((NumFormat) pstyle->numFormat());
+		numFormatCombo->setParentFormat((NumFormat) parent->numFormat());
 		numLevelSpin->setValue(pstyle->numLevel() +1, pstyle->isInhNumLevel());
 		NumStruct * numS = m_Doc->numerations.value(pstyle->numName());
 		if (numS)
@@ -425,7 +417,7 @@
 			numName = "default";
 		numComboBox->setCurrentItem(numComboBox->findText(numName));
 		numNewLineEdit->clear();
-		numFormatCombo->setCurrentIndex(pstyle->numFormat());
+		numFormatCombo->setCurrentFormat((NumFormat) pstyle->numFormat());
 		numLevelSpin->setValue(pstyle->numLevel()+1);
 		NumStruct * numS = m_Doc->numerations.value(pstyle->numName());
 		if (numS)

Modified: trunk/Scribus/scribus/ui/smpstylewidget.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22971&path=/trunk/Scribus/scribus/ui/smpstylewidget.h
==============================================================================
--- trunk/Scribus/scribus/ui/smpstylewidget.h	(original)
+++ trunk/Scribus/scribus/ui/smpstylewidget.h	Mon Apr 29 17:23:08 2019
@@ -47,7 +47,6 @@
 
 	void fillColorCombo(ColorList &colors);
 	void fillBulletStrEditCombo();
-	void fillNumFormatCombo();
 	void fillNumerationsCombo();
 	void fillNumRestartCombo();
 	void checkParEffectState();

Modified: trunk/Scribus/scribus/ui/smpstylewidget.ui
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22971&path=/trunk/Scribus/scribus/ui/smpstylewidget.ui
==============================================================================
--- trunk/Scribus/scribus/ui/smpstylewidget.ui	(original)
+++ trunk/Scribus/scribus/ui/smpstylewidget.ui	Mon Apr 29 17:23:08 2019
@@ -945,7 +945,7 @@
              </widget>
             </item>
             <item>
-             <widget class="SMScComboBox" name="numFormatCombo">
+             <widget class="SMNumFormatCombo" name="numFormatCombo">
               <property name="sizePolicy">
                <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
                 <horstretch>0</horstretch>
@@ -1389,6 +1389,11 @@
    <header location="global">ui/smdirectionselect.h</header>
    <container>1</container>
   </customwidget>
+  <customwidget>
+   <class>SMNumFormatCombo</class>
+   <extends>QComboBox</extends>
+   <header>ui/smnumformatcombo.h</header>
+  </customwidget>
  </customwidgets>
  <tabstops>
   <tabstop>tabWidget</tabstop>

Modified: trunk/Scribus/scribus/ui/smtextstyles.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22971&path=/trunk/Scribus/scribus/ui/smtextstyles.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/smtextstyles.cpp	(original)
+++ trunk/Scribus/scribus/ui/smtextstyles.cpp	Mon Apr 29 17:23:08 2019
@@ -1173,14 +1173,17 @@
 	}
 }
 
-void SMParagraphStyle::slotNumFormat(int numFormat)
-{
-	if (m_pwidget->numFormatCombo->useParentValue())
+void SMParagraphStyle::slotNumFormat(int)
+{
+	if (m_pwidget->numFormatCombo->useParentFormat())
 		for (int i = 0; i < m_selection.count(); ++i)
 			m_selection[i]->resetNumFormat();
 	else
+	{
+		NumFormat numFormat = m_pwidget->numFormatCombo->currentFormat();
 		for (int i = 0; i < m_selection.count(); ++i)
 			m_selection[i]->setNumFormat(numFormat);
+	}
 
 	if (!m_selectionIsDirty)
 	{

Modified: trunk/Scribus/scribus/ui/smtextstyles.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22971&path=/trunk/Scribus/scribus/ui/smtextstyles.h
==============================================================================
--- trunk/Scribus/scribus/ui/smtextstyles.h	(original)
+++ trunk/Scribus/scribus/ui/smtextstyles.h	Mon Apr 29 17:23:08 2019
@@ -85,7 +85,7 @@
 	void slotNumName(const QString &str);
 	void slotNumNew();
 	void slotSelectionDirty();
-	void slotNumFormat(int numFormat);
+	void slotNumFormat(int);
 	void slotNumLevel(int level);
 	void slotNumPrefix(const QString &str);
 	void slotNumSuffix(const QString &str);

Modified: trunk/Scribus/scribus/util.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22971&path=/trunk/Scribus/scribus/util.cpp
==============================================================================
--- trunk/Scribus/scribus/util.cpp	(original)
+++ trunk/Scribus/scribus/util.cpp	Mon Apr 29 17:23:08 2019
@@ -553,6 +553,9 @@
 		case Type_Abjad_ar:
 			retVal = numberToLetterSequence(abjad, position);
 			break;
+		case Type_Hebrew:
+			retVal = numberToHebrew(position);
+			break;
 		case Type_I_II_III:
 			retVal = numberToRoman(position);
 			break;
@@ -1173,6 +1176,45 @@
 	name = newName;
 }
 
+const QString numberToHebrew(uint i)
+{
+	const QString hebrew("אבגדהוזחטיכלמנסעפצקרשת");
+	QString result;
+
+	if (i > 999)
+	{
+		result.append(numberToHebrew(i / 1000));
+		result.append(QChar(0x05F3));
+		i %= 1000;
+	}
+
+	int hundreds = i / 100;
+	int tens = (i - hundreds * 100) / 10;
+	int ones = i % 10;
+
+	while (hundreds > 4)
+	{
+		result.append(hebrew.at(21));
+		hundreds -= 4;
+	}
+
+	if (hundreds)
+		result.append(hebrew.at(hundreds + 17));
+
+	if (tens == 1 && ones == 5)
+		result.append("טו");
+	else if (tens == 1 && ones == 6)
+		result.append("טז");
+	else
+	{
+		if (tens)
+			result.append(hebrew.at(tens + 8));
+		if (ones)
+			result.append(hebrew.at(ones - 1));
+	}
+
+	return result;
+}
 
 const QString numberToCJK(uint i)
 {

Modified: trunk/Scribus/scribus/util.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22971&path=/trunk/Scribus/scribus/util.h
==============================================================================
--- trunk/Scribus/scribus/util.h	(original)
+++ trunk/Scribus/scribus/util.h	Mon Apr 29 17:23:08 2019
@@ -128,6 +128,7 @@
 //asterix is QString used in numeration when number is presented as few chars, like *, **, *** etc
 //default is '*' but can be used any string
 const QString SCRIBUS_API getStringFromSequence(NumFormat type, uint position, const QString& asterix="*");
+const QString SCRIBUS_API numberToHebrew(uint i);
 const QString SCRIBUS_API numberToRoman(uint i);
 const QString SCRIBUS_API numberToCJK(uint i);
 QChar SCRIBUS_API cjkDigit(uint i);

Modified: trunk/Scribus/win32/msvc2013/scribus-main/Scribus.vcxproj
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22971&path=/trunk/Scribus/win32/msvc2013/scribus-main/Scribus.vcxproj
==============================================================================
--- trunk/Scribus/win32/msvc2013/scribus-main/Scribus.vcxproj	(original)
+++ trunk/Scribus/win32/msvc2013/scribus-main/Scribus.vcxproj	Mon Apr 29 17:23:08 2019
@@ -604,6 +604,7 @@
     <moc Include="..\..\..\scribus\ui\pdfversioncombo.h" />
     <moc Include="..\..\..\scribus\ui\pdfversionmodel.h" />
     <moc Include="..\..\..\scribus\ui\cxfimportdialog.h" />
+    <moc Include="..\..\..\scribus\ui\numformatcombo.h" />
     <ClInclude Include="..\..\..\scribus\ui\propertywidgetbase.h" />
     <moc Include="..\..\..\scribus\pslib.h" />
     <moc Include="..\..\..\scribus\ui\query.h" />
@@ -624,6 +625,7 @@
     <moc Include="..\..\..\scribus\ui\smlineedit.h" />
     <moc Include="..\..\..\scribus\ui\smdirectionselect.h" />
     <moc Include="..\..\..\scribus\ui\textpalette.h" />
+    <moc Include="..\..\..\scribus\ui\smnumformatcombo.h" />
     <ClInclude Include="..\..\..\scribus\undotransaction.h" />
     <ClInclude Include="..\..\..\scribus\util_debug.h" />
     <ClInclude Include="..\..\..\scribus\util_os.h" />
@@ -1168,6 +1170,7 @@
     <ClCompile Include="..\..\..\scribus\ui\notesstyleseditor.cpp" />
     <ClCompile Include="..\..\..\scribus\numeration.cpp" />
     <ClCompile Include="..\..\..\scribus\observable.cpp" />
+    <ClCompile Include="..\..\..\scribus\ui\numformatcombo.cpp" />
     <ClCompile Include="..\..\..\scribus\ui\oneclick.cpp" />
     <ClCompile Include="..\..\..\scribus\ui\outlinepalette.cpp" />
     <ClCompile Include="..\..\..\scribus\pageitem.cpp" />
@@ -1374,6 +1377,7 @@
     <ClCompile Include="..\..\..\scribus\ui\smdirectionselect.cpp" />
     <ClCompile Include="..\..\..\scribus\ui\smfontfeatures.cpp" />
     <ClCompile Include="..\..\..\scribus\ui\smlineedit.cpp" />
+    <ClCompile Include="..\..\..\scribus\ui\smnumformatcombo.cpp" />
     <ClCompile Include="..\..\..\scribus\ui\textpalette.cpp" />
     <ClCompile Include="..\..\..\scribus\ui\viewtoolbar.cpp" />
     <ClCompile Include="..\..\..\scribus\undotransaction.cpp" />

Modified: trunk/Scribus/win32/msvc2013/scribus-main/Scribus.vcxproj.filters
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22971&path=/trunk/Scribus/win32/msvc2013/scribus-main/Scribus.vcxproj.filters
==============================================================================
--- trunk/Scribus/win32/msvc2013/scribus-main/Scribus.vcxproj.filters	(original)
+++ trunk/Scribus/win32/msvc2013/scribus-main/Scribus.vcxproj.filters	Mon Apr 29 17:23:08 2019
@@ -797,6 +797,12 @@
     <ClInclude Include="..\..\..\scribus\sccolorstructs.h">
       <Filter>Header Files</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\..\scribus\ui\numformatcombo.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\scribus\ui\smnumformatcombo.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\..\..\scribus\desaxe\digester.cpp">
@@ -2474,6 +2480,12 @@
       <Filter>Source Files</Filter>
     </ClCompile>
     <ClCompile Include="..\..\..\scribus\sccolorstructs.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\scribus\ui\numformatcombo.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\scribus\ui\smnumformatcombo.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
   </ItemGroup>

Modified: trunk/Scribus/win32/msvc2015/scribus-main/Scribus.vcxproj
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22971&path=/trunk/Scribus/win32/msvc2015/scribus-main/Scribus.vcxproj
==============================================================================
--- trunk/Scribus/win32/msvc2015/scribus-main/Scribus.vcxproj	(original)
+++ trunk/Scribus/win32/msvc2015/scribus-main/Scribus.vcxproj	Mon Apr 29 17:23:08 2019
@@ -604,6 +604,7 @@
     <moc Include="..\..\..\scribus\ui\pdfversioncombo.h" />
     <moc Include="..\..\..\scribus\ui\pdfversionmodel.h" />
     <moc Include="..\..\..\scribus\ui\cxfimportdialog.h" />
+    <moc Include="..\..\..\scribus\ui\numformatcombo.h" />
     <ClInclude Include="..\..\..\scribus\ui\propertywidgetbase.h" />
     <moc Include="..\..\..\scribus\pslib.h" />
     <moc Include="..\..\..\scribus\ui\query.h" />
@@ -624,6 +625,7 @@
     <moc Include="..\..\..\scribus\ui\smlineedit.h" />
     <moc Include="..\..\..\scribus\ui\smdirectionselect.h" />
     <moc Include="..\..\..\scribus\ui\textpalette.h" />
+    <moc Include="..\..\..\scribus\ui\smnumformatcombo.h" />
     <ClInclude Include="..\..\..\scribus\undotransaction.h" />
     <ClInclude Include="..\..\..\scribus\util_debug.h" />
     <ClInclude Include="..\..\..\scribus\util_os.h" />
@@ -1168,6 +1170,7 @@
     <ClCompile Include="..\..\..\scribus\ui\notesstyleseditor.cpp" />
     <ClCompile Include="..\..\..\scribus\numeration.cpp" />
     <ClCompile Include="..\..\..\scribus\observable.cpp" />
+    <ClCompile Include="..\..\..\scribus\ui\numformatcombo.cpp" />
     <ClCompile Include="..\..\..\scribus\ui\oneclick.cpp" />
     <ClCompile Include="..\..\..\scribus\ui\outlinepalette.cpp" />
     <ClCompile Include="..\..\..\scribus\pageitem.cpp" />
@@ -1374,6 +1377,7 @@
     <ClCompile Include="..\..\..\scribus\ui\smdirectionselect.cpp" />
     <ClCompile Include="..\..\..\scribus\ui\smfontfeatures.cpp" />
     <ClCompile Include="..\..\..\scribus\ui\smlineedit.cpp" />
+    <ClCompile Include="..\..\..\scribus\ui\smnumformatcombo.cpp" />
     <ClCompile Include="..\..\..\scribus\ui\textpalette.cpp" />
     <ClCompile Include="..\..\..\scribus\ui\viewtoolbar.cpp" />
     <ClCompile Include="..\..\..\scribus\undotransaction.cpp" />

Modified: trunk/Scribus/win32/msvc2015/scribus-main/Scribus.vcxproj.filters
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22971&path=/trunk/Scribus/win32/msvc2015/scribus-main/Scribus.vcxproj.filters
==============================================================================
--- trunk/Scribus/win32/msvc2015/scribus-main/Scribus.vcxproj.filters	(original)
+++ trunk/Scribus/win32/msvc2015/scribus-main/Scribus.vcxproj.filters	Mon Apr 29 17:23:08 2019
@@ -797,6 +797,12 @@
     <ClInclude Include="..\..\..\scribus\sccolorstructs.h">
       <Filter>Header Files</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\..\scribus\ui\numformatcombo.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\..\scribus\ui\smnumformatcombo.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\..\..\scribus\desaxe\digester.cpp">
@@ -2474,6 +2480,12 @@
       <Filter>Source Files</Filter>
     </ClCompile>
     <ClCompile Include="..\..\..\scribus\sccolorstructs.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\scribus\ui\numformatcombo.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\scribus\ui\smnumformatcombo.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
   </ItemGroup>




More information about the scribus-commit mailing list