Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


Hi Johann,

On 24/07/12 10:32, Noel Power wrote:
Hi Johann,

firstly apologies for the late replying, I have only just got back from vacation and am catching up with email.
On 06/07/12 18:10, Kohei Yoshida wrote:
Hi Johann,

I hope you don't mind me forwarding this nice work of yours to our main development mailing list, to let other interested developers know of your work. Let me also CC Noel since he's done a very similar work for 3.6. There may be some overlap between his work and yours...
//
Hopefuily I didn't blind you with too many details with the last email. Put more simply what I would really love is if you could look to see if we need to amend the width calculation that is located here
http://opengrok.libreoffice.org/xref/core/sc/source/ui/view/output2.cxx#554
and see if we need to include the work you already did. it would be brilliant to get your input on that and even some patch/code from you to improve it. Also if you wish you could help with is the patch for enabling persisting to odf needs updating to use "<number:fill-character>" instead of "number:repeated", of course any other general testing. bug reporting & patches in this area wildly appreciated also. Are you interested or have any time for any of that?

Noel
From 8a2f12168cb450de589853285871874231ec130f Mon Sep 17 00:00:00 2001
From: Noel Power <noel.power@novell.com>
Date: Tue, 17 Apr 2012 20:37:02 +0100
Subject: [PATCH 2/3] support new xml number:repeated elem for number-style namespace

this is used to define the char to be repeated in a number format

e.g  repeat ' ' 0 or more times to fill available space

      <number:number-style style:name="N130P0" style:volatile="true">
        <number:text> $</number:text>
-->     <number:repeated> </number:repeated>
---
 xmloff/inc/xmloff/xmlnumfe.hxx   |    1 +
 xmloff/source/style/xmlnumfe.cxx |   12 ++++++++++++
 xmloff/source/style/xmlnumfi.cxx |   10 ++++++++++
 3 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/xmloff/inc/xmloff/xmlnumfe.hxx b/xmloff/inc/xmloff/xmlnumfe.hxx
index b1f00e7..9998cad 100644
--- a/xmloff/inc/xmloff/xmlnumfe.hxx
+++ b/xmloff/inc/xmloff/xmlnumfe.hxx
@@ -95,6 +95,7 @@ private:
     SAL_DLLPRIVATE void WriteMapElement_Impl( sal_Int32 nOp, double fLimit,
                                     sal_Int32 nKey, sal_Int32 nPart );
 
+    SAL_DLLPRIVATE void  WriteRepeatedElement_Impl( sal_Unicode ch );
     SAL_DLLPRIVATE sal_Bool WriteTextWithCurrency_Impl( const ::rtl::OUString& rString,
                             const ::com::sun::star::lang::Locale& rLocale );
     SAL_DLLPRIVATE void ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt32 nKey,
diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx
index 714dcda..71aa5ef 100644
--- a/xmloff/source/style/xmlnumfe.cxx
+++ b/xmloff/source/style/xmlnumfe.cxx
@@ -537,6 +537,14 @@ void SvXMLNumFmtExport::WriteMinutesElement_Impl( sal_Bool bLong )
                               sal_True, sal_False );
 }
 
+void SvXMLNumFmtExport::WriteRepeatedElement_Impl( sal_Unicode nChar )
+{
+    FinishTextElement_Impl();
+    SvXMLElementExport aElem( rExport, XML_NAMESPACE_NUMBER, XML_REPEATED,
+                                  sal_True, sal_False );
+    rExport.Characters( OUString::valueOf( nChar ) );
+}
+
 void SvXMLNumFmtExport::WriteSecondsElement_Impl( sal_Bool bLong, sal_uInt16 nDecimals )
 {
     FinishTextElement_Impl();
@@ -1567,6 +1575,10 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, 
sal_uInt
                     WriteAMPMElement_Impl();        // short/long?
                     bAnyContent = sal_True;
                     break;
+                case NF_SYMBOLTYPE_STAR :
+                    if ( pElemStr && pElemStr->Len() > 1 )
+                        WriteRepeatedElement_Impl( pElemStr->GetChar( 1 ) );
+                    break;
             }
             nPrevType = nElemType;
             ++nPos;
diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
index bd953a3..ecd33b9 100644
--- a/xmloff/source/style/xmlnumfi.cxx
+++ b/xmloff/source/style/xmlnumfi.cxx
@@ -246,6 +246,7 @@ public:
 enum SvXMLStyleTokens
 {
     XML_TOK_STYLE_TEXT,
+    XML_TOK_STYLE_REPEATED,
     XML_TOK_STYLE_NUMBER,
     XML_TOK_STYLE_SCIENTIFIC_NUMBER,
     XML_TOK_STYLE_FRACTION,
@@ -521,6 +522,7 @@ const SvXMLTokenMap& SvXMLNumImpData::GetStyleElemTokenMap()
         {
             //  elements in a style
             { XML_NAMESPACE_NUMBER, XML_TEXT,               XML_TOK_STYLE_TEXT              },
+            { XML_NAMESPACE_NUMBER, XML_REPEATED,           XML_TOK_STYLE_REPEATED   },
             { XML_NAMESPACE_NUMBER, XML_NUMBER,             XML_TOK_STYLE_NUMBER            },
             { XML_NAMESPACE_NUMBER, XML_SCIENTIFIC_NUMBER,  XML_TOK_STYLE_SCIENTIFIC_NUMBER },
             { XML_NAMESPACE_NUMBER, XML_FRACTION,           XML_TOK_STYLE_FRACTION          },
@@ -1104,6 +1106,13 @@ void SvXMLNumFmtElementContext::EndElement()
         case XML_TOK_STYLE_TEXT_CONTENT:
             rParent.AddToCode( OUString::valueOf((sal_Unicode)'@') );
             break;
+        case XML_TOK_STYLE_REPEATED:
+            if ( aContent.getLength() )
+            {
+                rParent.AddToCode( OUString::valueOf((sal_Unicode)'*') );
+                rParent.AddToCode( OUString::valueOf( aContent[0] ) );
+            }
+            break;
         case XML_TOK_STYLE_BOOLEAN:
             // ignored - only default boolean format is supported
             break;
@@ -1436,6 +1445,7 @@ SvXMLImportContext* SvXMLNumFormatContext::CreateChildContext(
     switch (nToken)
     {
         case XML_TOK_STYLE_TEXT:
+        case XML_TOK_STYLE_REPEATED:
         case XML_TOK_STYLE_NUMBER:
         case XML_TOK_STYLE_SCIENTIFIC_NUMBER:
         case XML_TOK_STYLE_FRACTION:
-- 
1.7.3.4


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.