Bug 34829

Summary: Enummeration for German Law Documents
Product: [Unmaintained] kword Reporter: Unknown <null>
Component: generalAssignee: Thomas Zander <zander>
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Guido Bockamp 2001-11-12 19:18:40 UTC
(*** This bug was imported into bugs.kde.org ***)

Package:           kword
Version:           all (using KDE 2.2.0 )
Severity:          wishlist
Installed from:    SuSE RPMs
Compiler:          Not Specified
OS:                Linux
OS/Compiler notes: Not Specified

There is a convention for law documents in Germany (esp. for an abstract or a thesis) in terms of enummeration. Our enummeration goes
A. I. 1. a. aa. 

aa. is followed by bb. (cc. etc). 

There is a way to automatically do this in MS-Word and StarOffice by simply telling the program to 'start at aa' but KWord produces a 'aa ab ac'-sequence.

A lot of law students and professionals would appreciate KWord to have this feature.



(Submitted via bugs.kde.org)
Comment 1 Nicolas Goutte 2003-09-06 15:46:27 UTC
Just a note: one of the two over-run methods of OOWriter allows this: a, b ... 
z, aa, bb, cc ... zz. 
Comment 2 Stephan Kulow 2004-05-20 21:18:04 UTC
Replaced guido.bockamp@ngi.de with null@kde.org due to bounces by reporter
Comment 3 Thomas Zander 2007-07-28 13:33:40 UTC
SVN commit 693561 by zander:

Add feature to allow a list be "..., x, y, z, aa, bb, cc, ..."
BUG: 34829


 M  +20 -8     ListItemsHelper.cpp  
 M  +1 -1      ListItemsHelper.h  
 M  +6 -3      dialogs/ListsSpinBox.cpp  
 M  +5 -0      dialogs/ListsSpinBox.h  
 M  +2 -1      tests/TestLists.cpp  


--- trunk/koffice/shapes/text/ListItemsHelper.cpp #693560:693561
@@ -45,15 +45,25 @@
                                 RNTens[ ( n / 10 ) % 10 ] + RNUnits[ ( n ) % 10 ] );
 }
 
-QString Lists::intToAlpha( int n, Capitalisation caps ) {
+QString Lists::intToAlpha( int n, Capitalisation caps, bool letterSynchronization) {
     const char offset = caps == Uppercase?'A':'a';
     QString answer;
-    char bottomDigit;
-    while ( n > 26 ) {
-        bottomDigit = (n-1) % 26;
-        n = (n-1) / 26;
-        answer.prepend( QChar( offset + bottomDigit  ) );
+    if(letterSynchronization) {
+        int digits = 1;
+        for(; n > 26; n-=26)
+            digits +=1;
+        for(int i=0; i < digits; i++)
+            answer.prepend( QChar( offset + n -1  ) );
+        return answer;
     }
+    else {
+        char bottomDigit;
+        while ( n > 26 ) {
+            bottomDigit = (n-1) % 26;
+            n = (n-1) / 26;
+            answer.prepend( QChar( offset + bottomDigit  ) );
+        }
+    }
     answer.prepend( QChar( offset + n -1 ) );
     return answer;
 }
@@ -292,10 +302,12 @@
                 partialCounterText = QString::number(index);
                 break;
             case KoListStyle::AlphaLowerItem:
-                partialCounterText = intToAlpha(index, Lowercase);
+                partialCounterText = intToAlpha(index, Lowercase,
+                        m_textList->format().boolProperty(KoListStyle::LetterSynchronization));
                 break;
             case KoListStyle::UpperAlphaItem:
-                partialCounterText = intToAlpha(index, Uppercase);
+                partialCounterText = intToAlpha(index, Uppercase,
+                        m_textList->format().boolProperty(KoListStyle::LetterSynchronization));
                 break;
             case KoListStyle::RomanLowerItem:
                 partialCounterText = intToRoman(index);
--- trunk/koffice/shapes/text/ListItemsHelper.h #693560:693561
@@ -39,7 +39,7 @@
     };
 
     QString intToRoman( int n );
-    QString intToAlpha( int n, Capitalisation caps );
+    QString intToAlpha( int n, Capitalisation caps, bool letterSynchronization );
     QString intToScript(int n, KoListStyle::Style type);
     QString intToScriptList(int n, KoListStyle::Style type);
 
--- trunk/koffice/shapes/text/dialogs/ListsSpinBox.cpp #693560:693561
@@ -23,7 +23,8 @@
 
 ListsSpinBox::ListsSpinBox( QWidget *parent)
     : QSpinBox(parent),
-    m_type(KoListStyle::DecimalItem)
+    m_type(KoListStyle::DecimalItem),
+    m_letterSynchronization(false)
 {
 }
 
@@ -41,9 +42,9 @@
         case KoListStyle::DecimalItem:
             return QString::number(value);
         case KoListStyle::AlphaLowerItem:
-            return Lists::intToAlpha(value, Lists::Lowercase);
+            return Lists::intToAlpha(value, Lists::Lowercase, m_letterSynchronization);
         case KoListStyle::UpperAlphaItem:
-            return Lists::intToAlpha(value, Lists::Uppercase);
+            return Lists::intToAlpha(value, Lists::Uppercase, m_letterSynchronization);
         case KoListStyle::RomanLowerItem:
             return Lists::intToRoman(value);
         case KoListStyle::UpperRomanItem:
@@ -67,3 +68,5 @@
             return "X";
     }
 }
+
+#include <ListsSpinBox.moc>
--- trunk/koffice/shapes/text/dialogs/ListsSpinBox.h #693560:693561
@@ -26,16 +26,21 @@
 
 class ListsSpinBox : public QSpinBox
 {
+    Q_OBJECT
 public:
     ListsSpinBox( QWidget *parent = 0 );
 
     void setCounterType(KoListStyle::Style type);
 
+public slots:
+    void setLetterSynchronization(bool on) { m_letterSynchronization = on; }
+
 private:
     virtual int valueFromText(const QString &text) const;
     virtual QString textFromValue(int value) const;
 
     KoListStyle::Style m_type;
+    bool m_letterSynchronization;
 };
 
 #endif
--- trunk/koffice/shapes/text/tests/TestLists.cpp #693560:693561
@@ -463,7 +463,7 @@
     styleManager->add(&h1);
     KoListStyle listStyle;
     KoListLevelProperties llp = listStyle.level(1);
-    llp.setStyle(KoListStyle::DecimalItem);
+    llp.setStyle(KoListStyle::AlphaLowerItem);
     llp.setLetterSynchronization(true);
     llp.setStartValue(25);
     listStyle.setLevel(llp);
@@ -483,6 +483,7 @@
     while(block.isValid()) {
         KoTextBlockData *data = dynamic_cast<KoTextBlockData*> (block.userData());
         QVERIFY(data);
+        // qDebug() << "-> " << data->counterText() << endl;
         QCOMPARE(data->counterText(), QString(values[i++]));
 
         block = block.next();