[prev in list] [next in list] [prev in thread] [next in thread] 

List:       calligra-devel
Subject:    Re: suffix and prefix in <number:number-style> and <number:text-style>
From:       Elvis Stansvik <elvstone () gmail ! com>
Date:       2013-08-05 21:54:21
Message-ID: CAHms=eZAyQqw6PrxXUd4fWXSHHpCm73CN5Sv1JNj1yCYftfoDw () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


2013/8/5 Sebastian Sauer <mail@dipe.org>

> On 08/05/2013 07:25 PM, Elvis Stansvik wrote:
> 
> > 2013/8/5 Elvis Stansvik <elvstone@gmail.com>
> > 
> > 2013/8/5 Jos van den Oever <jos.van.den.oever@kogmbh.com>
> > > 
> > > Look what I found in libs/odf/KoOdfNumberStyles.****cpp:
> > > > 
> > > > 
> > > > ===
> > > > //This is an extension of numeric style. For the moment we used
> > > > namespace
> > > > of
> > > > //oasis format for specific calligra extension. Change it for the
> > > > future.
> > > > void addCalligraNumericStyleExtensi****on(KoXmlWriter &elementWriter,
> > > > 
> > > > const QString &_suffix, const QString &_prefix)
> > > > ===
> > > > 
> > > > This function write tags <number:suffix> and <number:prefix> in the
> > > > <number:number-style> elements and the <number:text-style> elements.
> > > > 
> > > > It was introduced in 2005:
> > > > ===
> > > > commit 9964ed1963bbf629d0f6d54d83ab9f****1d423db3fc
> > > > 
> > > > Author: Laurent Montel <montel@kde.org>
> > > > Date:   Sun Feb 27 12:21:40 2005 +0000
> > > > 
> > > > Allow to store prefix/suffix into numeric style
> > > > (koffice extension)
> > > > ===
> > > > 
> > > > This feature is used in Sheets:
> > > > - create empty spreadsheet
> > > > - choose 'Cell Format ..." from the context menu of a cell
> > > > - write 'PREFIX' in the 'Prefix:' field
> > > > - write 'SUFFIX' in the 'Postfix:' field
> > > > - close the dialog
> > > > - The cell now contains this text: "PREFIX 0 SUFFIX"
> > > > - save the file
> > > > 
> > > > Saving gives this ODF fragment:
> > > > <number:number-style style:name="N1">
> > > > <number:text>PREFIX</number:****text>
> > > > <number:number number:min-integer-digits="1"/****>
> > > > <number:text>SUFFIX</number:****text>
> > > > <number:suffix>SUFFIX</number:****suffix>
> > > > <number:prefix>PREFIX</number:****prefix>
> > > > 
> > > > </number:number-style>
> > > > 
> > > > Opening it in LibreOffice shows: "PREFIX0SUFFIX" which is correct
> > > > interpretation of the XML. Looking at the cell format dialog shows this
> > > > formatting string:
> > > > "PREFIX"General"SUFFIX"
> > > > 
> > > > Saving the spreadsheet again, gives this:
> > > > <number:number-style style:name="N120">
> > > > <number:text>PREFIX</number:****text>
> > > > <number:number number:min-integer-digits="1"/****>
> > > > <number:text>SUFFIX</number:****text>
> > > > 
> > > > </number:number-style>
> > > > 
> > > > As expected, the non-standard, prefix and suffix are removed.
> > > > 
> > > > Gnumeric can load the file too but does not show the prefix and suffix.
> > > > 
> > > > Since the prefix and postfix behavior can be obtained with the
> > > > <number:text/> element, I propose that Calligra removes the code for
> > > > writing <text:suffix> and <text:prefix>.
> > > > 
> > > +2
> 
> Sounds right to me (if you mean not remove, but replace it with writing of
> > > <number:text>), if they really are functionally equivalent.
> > > 
> > In Jos example above they are already written. its just that we write
> them two times cause somebody forgot to remove the prefix/suffix
> tag-writing when adding the ODF code :)
> 
> Though thinking a bit more; when loading <number:text/> back in, how do we
> > know that this was specified as a prefix/suffix by the user (and this
> > should be placed in the Prefix:/Suffix fields), and not as a general text
> > component of the format? (just assuming you can do that as well).
> > 
> 
> That prefix/suffix thing is complete our own invention. I think its legacy
> from the old KSpread file format where KSpread didn't use formatting-masks
> like ODF uses and we just forgot to remove that code (and proper adjust the
> UI imho, but that's unrelated to the topic on hand).


Ah. I see. I didn't have a Calligra build at hand to check.

Elvis


> 
> 
> ______________________________**_________________
> calligra-devel mailing list
> calligra-devel@kde.org
> https://mail.kde.org/mailman/**listinfo/calligra-devel<https://mail.kde.org/mailman/listinfo/calligra-devel>
>  


[Attachment #5 (text/html)]

<div dir="ltr">2013/8/5 Sebastian Sauer <span dir="ltr">&lt;<a \
href="mailto:mail@dipe.org" target="_blank">mail@dipe.org</a>&gt;</span><br><div \
class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" \
style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <div \
class="im">On 08/05/2013 07:25 PM, Elvis Stansvik wrote:<br> </div><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"> 2013/8/5 Elvis Stansvik &lt;<a \
href="mailto:elvstone@gmail.com" target="_blank">elvstone@gmail.com</a>&gt;<br> <br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div class="im"> 2013/8/5 Jos van den Oever &lt;<a \
href="mailto:jos.van.den.oever@kogmbh.com" \
target="_blank">jos.van.den.oever@kogmbh.com</a>&gt;<br> <br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"> Look what I found in \
libs/odf/KoOdfNumberStyles.**<u></u>cpp:<div class="im"><br> <br>
===<br>
//This is an extension of numeric style. For the moment we used namespace<br>
of<br>
//oasis format for specific calligra extension. Change it for the future.<br></div>
void addCalligraNumericStyleExtensi<u></u>**on(KoXmlWriter &amp;elementWriter,<div \
class="im"><br> const QString &amp;_suffix, const QString &amp;_prefix)<br>
===<br>
<br>
This function write tags &lt;number:suffix&gt; and &lt;number:prefix&gt; in the<br>
&lt;number:number-style&gt; elements and the &lt;number:text-style&gt; elements.<br>
<br>
It was introduced in 2005:<br>
===<br></div>
commit 9964ed1963bbf629d0f6d54d83ab9f<u></u>**1d423db3fc<div class="im"><br>
Author: Laurent Montel &lt;<a href="mailto:montel@kde.org" \
                target="_blank">montel@kde.org</a>&gt;<br>
Date:   Sun Feb 27 12:21:40 2005 +0000<br>
<br>
     Allow to store prefix/suffix into numeric style<br>
     (koffice extension)<br>
===<br>
<br>
This feature is used in Sheets:<br>
  - create empty spreadsheet<br>
  - choose &#39;Cell Format ...&quot; from the context menu of a cell<br>
  - write &#39;PREFIX&#39; in the &#39;Prefix:&#39; field<br>
  - write &#39;SUFFIX&#39; in the &#39;Postfix:&#39; field<br>
  - close the dialog<br>
  - The cell now contains this text: &quot;PREFIX 0 SUFFIX&quot;<br>
  - save the file<br>
<br>
Saving gives this ODF fragment:<br>
     &lt;number:number-style style:name=&quot;N1&quot;&gt;<br></div>
       &lt;number:text&gt;PREFIX&lt;/number:**<u></u>text&gt;<br>
       &lt;number:number number:min-integer-digits=&quot;1&quot;/<u></u>**&gt;<br>
       &lt;number:text&gt;SUFFIX&lt;/number:**<u></u>text&gt;<br>
       &lt;number:suffix&gt;SUFFIX&lt;/number:<u></u>**suffix&gt;<br>
       &lt;number:prefix&gt;PREFIX&lt;/number:<u></u>**prefix&gt;<div class="im"><br>
     &lt;/number:number-style&gt;<br>
<br>
Opening it in LibreOffice shows: &quot;PREFIX0SUFFIX&quot; which is correct<br>
interpretation of the XML. Looking at the cell format dialog shows this<br>
formatting string:<br>
   &quot;PREFIX&quot;General&quot;SUFFIX&quot;<br>
<br>
Saving the spreadsheet again, gives this:<br>
     &lt;number:number-style style:name=&quot;N120&quot;&gt;<br></div>
       &lt;number:text&gt;PREFIX&lt;/number:**<u></u>text&gt;<br>
       &lt;number:number number:min-integer-digits=&quot;1&quot;/<u></u>**&gt;<br>
       &lt;number:text&gt;SUFFIX&lt;/number:**<u></u>text&gt;<div class="im"><br>
     &lt;/number:number-style&gt;<br>
<br>
As expected, the non-standard, prefix and suffix are removed.<br>
<br>
Gnumeric can load the file too but does not show the prefix and suffix.<br>
<br>
Since the prefix and postfix behavior can be obtained with the<br>
&lt;number:text/&gt; element, I propose that Calligra removes the code for<br>
writing &lt;text:suffix&gt; and &lt;text:prefix&gt;.<br>
</div></blockquote></blockquote></blockquote>
+2<div class="im"><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 \
.8ex;border-left:1px #ccc solid;padding-left:1ex"> Sounds right to me (if you mean \
not remove, but replace it with writing of<br> &lt;number:text&gt;), if they really \
are functionally equivalent.<br> </blockquote></blockquote></div>
In Jos example above they are already written. its just that we write them two times \
cause somebody forgot to remove the prefix/suffix tag-writing when adding the ODF \
code :)<div class="im"><br> <blockquote class="gmail_quote" style="margin:0 0 0 \
.8ex;border-left:1px #ccc solid;padding-left:1ex"> Though thinking a bit more; when \
loading &lt;number:text/&gt; back in, how do we<br> know that this was specified as a \
prefix/suffix by the user (and this<br> should be placed in the Prefix:/Suffix \
fields), and not as a general text<br> component of the format? (just assuming you \
can do that as well).<br> </blockquote>
<br></div>
That prefix/suffix thing is complete our own invention. I think its legacy from the \
old KSpread file format where KSpread didn&#39;t use formatting-masks like ODF uses \
and we just forgot to remove that code (and proper adjust the UI imho, but that&#39;s \
unrelated to the topic on hand).</blockquote> <div><br></div><div>Ah. I see. I \
didn&#39;t have a Calligra build at hand to \
check.</div><div><br></div><div>Elvis</div><div> </div><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"> <div class="HOEnZb"><div class="h5"><br>
<br>
______________________________<u></u>_________________<br>
calligra-devel mailing list<br>
<a href="mailto:calligra-devel@kde.org" \
target="_blank">calligra-devel@kde.org</a><br> <a \
href="https://mail.kde.org/mailman/listinfo/calligra-devel" \
target="_blank">https://mail.kde.org/mailman/<u></u>listinfo/calligra-devel</a><br> \
</div></div></blockquote></div><br></div></div>



_______________________________________________
calligra-devel mailing list
calligra-devel@kde.org
https://mail.kde.org/mailman/listinfo/calligra-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic