mohalfaki / bungeni-portal

Automatically exported from code.google.com/p/bungeni-portal
0 stars 0 forks source link

Automatic numbering & renumbering #223

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
To Do:

Develop a prototype numbering, renumbering scheme.
The openoffice outline numbering scheme is not usable as its not flexible
enough.  We need to be able to define:
- multiple numbering schemes for a document
- assign the numbering scheme to a particular section type hierarchy
- be able to renumber across the section type hierarchy

Methodology:

http://code.google.com/p/bungeni-portal/issues/detail?id=220#c16

Original issue reported on code.google.com by ashok.ha...@gmail.com on 12 Mar 2008 at 7:56

GoogleCodeExporter commented 9 years ago
Multiple numbering schemes for document:

we need the following numbering schemes usable within the same document:
- numeric (1, 2, 3, 4,,,,)
- point numeric (1.1, 1.2, 1.3, 1.4....)
- sub point numeric (1.1.1, 1.1.2......) (upto 4 sub-points for now)
- alphabetical (a, b, c, d, e, f....) (upto 26)
- roman (i, ii, iii, iv ) 

Number can be prefixed, before or after text.

Original comment by listmans...@gmail.com on 12 Mar 2008 at 8:42

GoogleCodeExporter commented 9 years ago
This software has a decimal to roman numeral implementation

http://www.jonelo.de/java/nc/index.html#Download

Also see recipe 5.11 of the java cookbook.

To Do:

Implement a base decimal based numeric scheme
Create derived schemes extended from the base decimal numeric scheme.

Original comment by ashok.ha...@gmail.com on 12 Mar 2008 at 8:50

GoogleCodeExporter commented 9 years ago
Also take a look at openoffice implementation of outline number schemes, since 
it
includes so many different numbering schemes, we can possibly implement their 
base
numbering scheme within the client (the outline base numbering is not directly 
usable
since its tied to paragraph properties and the document level outline
implementation...but looking at the openoffice source should give some ideas..)

http://api.openoffice.org/docs/common/ref/com/sun/star/style/NumberingType.html

Original comment by ashok.ha...@gmail.com on 12 Mar 2008 at 8:53

GoogleCodeExporter commented 9 years ago
Also see:
http://www.faqs.org/docs/javap/c9/ex-9-3-answer.html

Original comment by ashok.ha...@gmail.com on 12 Mar 2008 at 8:58

GoogleCodeExporter commented 9 years ago
Following up on comment (2) :
Start with this :
To Do:

Implement a base decimal based numeric scheme
with the following methods :
 - getNext() to get the next number in the schem
 - getPrevious() to get the previous number in the scheme
 - setRange and getRange() to to set the starting and ending points of the sequence

Original comment by ashok.ha...@gmail.com on 12 Mar 2008 at 9:04

GoogleCodeExporter commented 9 years ago
Flavio:

Bills. Please find attached:

    * a PDF file so that you can see how the BILL looks when printed
    * a DOC file to see how that layout is actually achieved making use of tables
    * a ODT file were we have removed all the tables and just used headings. I have
name then from 01_ ... to 05 so that you can easily spot then and the name of 
the
style also show an example of the numbering.

The ODT file could also be use to test a bill using sections etc. Needless to 
say
that the side notes (in red in the file) and more in general the whole thing 
then
need to be transformed with an XST (whatever) in something that look like the 
PDF but
better since the PDF is really a messy formatting!

Please note that:

    * side notes are used to generate the table of content. But please also note that
there could be side notes that should NOT be used to generate the TOC, because 
they
are actually side-notes made to highlight some specific content. I will try to 
get an
example of that.
    * if you see the beginning of the document, the first Section in Part one, you
will see 1. (1) that means, Section 1, Subsection 1. In the ODT we have put the 
two
in two different headings and lines. I do not know if there are other options 
... but
anyhow, in the "transformation" for presentation the two "lines" have to be 
then put
back into one.

ASHOK:

The documents have examples of the numbering schemes and formats required.

Start with the simple decimal numbering scheme, and then we build the others as
extensions on that.

Original comment by ashok.ha...@gmail.com on 12 Mar 2008 at 9:22

Attachments:

GoogleCodeExporter commented 9 years ago
i take it the prototype implementation will be in OOoBasic? Should we use the
previous document as the test case?

Original comment by crazylun...@gmail.com on 12 Mar 2008 at 9:29

GoogleCodeExporter commented 9 years ago
No, you can implement the prototype as a java class.

I also found this:
Saxon is an XSLT processor, but it has number format class that seems to do 
multiple
formats. Might make sense using something standard like this. (We will be using 
saxon
anyway in the future as part of the transformation functionality)

http://www.stylusstudio.com/api/saxon8/net/sf/saxon/number/Numberer_en.htm

Original comment by ashok.ha...@gmail.com on 12 Mar 2008 at 9:56

GoogleCodeExporter commented 9 years ago
I've implemented the initial prototype using Java. The code sets a range
e.g.startRange=2 EndRange=12, the range then populates an ArrayList The list is 
then
iterated, using the next() method in the iterator we are able to display the 
items.
Is this a correct implementation so far?

Original comment by crazylun...@gmail.com on 12 Mar 2008 at 2:33

GoogleCodeExporter commented 9 years ago
I've integrated the Saxon library for testing purposes, it allows as to convert 
the
numbers from base decimal to roman numerals with ease. I'd like to test the
conversion to Alphabet also.

Original comment by crazylun...@gmail.com on 13 Mar 2008 at 9:48

GoogleCodeExporter commented 9 years ago
The toAlphaSequence method within saxon takes as an argument a long number  and 
a
sequence of alphabets like "ABC", you can generate alphabet with some ease.

Original comment by crazylun...@gmail.com on 14 Mar 2008 at 9:06

GoogleCodeExporter commented 9 years ago
I have written some code to perform the point numbering that I am trying to 
integrate
into the structure you developed. What is the depth of the scheme? this is how 
far
can the point numbering scheme go down? currently I have based it on the last 
depth
being 1.1.1

Original comment by crazylun...@gmail.com on 19 Mar 2008 at 9:17

GoogleCodeExporter commented 9 years ago
I have moved the numberingscheme project form under /svn/trunk/Numbering to ==>
svn\BunbeniOOo\NumberingScheme\trunk\Numbering. 

For comment 12, i have added a schemePointNumbering class that handles 
numbering of
any depth, and is simpler.

It needs a bit of work in terms of: 
- handling 2 digit point numbers....
(i.e. 9.11, 9.12...and so on... it handles only 9.1.1 and 9.1.2).

Original comment by ashok.ha...@gmail.com on 19 Mar 2008 at 12:01

GoogleCodeExporter commented 9 years ago
This has some pointers regarding the numberingScheme in Comment#13

http://www.ibm.com/developerworks/java/library/j-mer08133/

particularly, this part:

Learning to iterate through the characters in DecimalFormat

While NumberFormat is abstract and you work with instances of it through various
methods like getIntegerInstance(), the DecimalFormat class offers a concrete 
version
of that class. You can explicitly specify the character pattern for how you want
positive, negative, fractional, and exponential numbers to appear. If you don't 
like
the predefined formats for the different locales, you can create your own. 
(Under the
covers, DecimalFormat is probably what NumberFormat is using.) The basic
DecimalFormat functionality hasn't changed with the 1.4. release of the J2SE
platform. What has changed is the addition of the formatToCharacterIterator(),
getCurrency(), and setCurrency() methods.

We'll take a quick look at the new formatToCharacterIterator method and its
associated NumberFormat.Field class. J2SE 1.4 introduces the concept of a
CharacterIterator, which allows you to traverse bi-directionally through text. 
With
formatToCharacterIterator, you get its subinterface AttributedCharacterIterator,
which allows you to find out information about that text. In the case of
DecimalFormat, those attributes are keys from NumberFormat.Field. By using
AttributedCharacterIterator, you literally can build up your own string output 
from
the generated results. Listing 3 uses a percent instance to show you a simple
demonstration:

Listing 3. Working with formatToCharacterIterator()

import java.text.*;
import java.util.*;

public class DecimalSample {
  public static void main(String args[]) {
    double amount = 50.25;
    NumberFormat usFormat = NumberFormat.getPercentInstance(Locale.US);
    if (usFormat instanceof DecimalFormat) {
      DecimalFormat decFormat = (DecimalFormat)usFormat;
      AttributedCharacterIterator iter =
        decFormat.formatToCharacterIterator(new Double(amount));
        for (char c = iter.first();
            c != CharacterIterator.DONE;
            c = iter.next()) {
          // Get map for current character
          Map map = iter.getAttributes();
          // Display its attributes
          System.out.println("Char: " + c + " / " + map);
     }
    }
  }
}

Original comment by ashok.ha...@gmail.com on 19 Mar 2008 at 12:18

GoogleCodeExporter commented 9 years ago
Information on number formatting:

http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/OfficeDev/Number
_Formats

http://codesnippets.services.openoffice.org/Office/Office.NumberFormats.snip

Original comment by crazylun...@gmail.com on 28 Mar 2008 at 9:32

GoogleCodeExporter commented 9 years ago
I have implemented the following with respect to the numbering:

-Inserted a numbering scheme to a particular section.
-Identified the heading within the section.

Next steps:

-Insert reference to that heading.
-Insert a number based on the numbering scheme beside (before or after) the 
heading.

The pending tasks had earlier on been implemented in OOBasic so what needs to 
be done
is translation into Java. The tasks above will be completed in one day. 

Original comment by crazylun...@gmail.com on 28 Mar 2008 at 7:48

GoogleCodeExporter commented 9 years ago
Task-Insert reference to that heading- Completed

Next Task:

-Insert a number based on the numbering scheme beside (before or after) the 
heading.
-Create reference text

Original comment by crazylun...@gmail.com on 31 Mar 2008 at 10:03

GoogleCodeExporter commented 9 years ago
-Insert a number based on the numbering scheme beside (before or after) the 
heading.-
Completed

The next scenario is to work with a multiple hierarchy document, apply a 
numbering
scheme to the various section types in the document.

The references can be done at the end when the numbering is complete.

Original comment by crazylun...@gmail.com on 31 Mar 2008 at 5:36

GoogleCodeExporter commented 9 years ago

Original comment by ashok.ha...@gmail.com on 8 May 2008 at 7:45