xmloff/source/style/xmlnumfe.cxx |   31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

New commits:
commit 33a8c4bd0e8533ab42894280e7e04c13a47aefa9
Author:     Eike Rathke <er...@redhat.com>
AuthorDate: Wed Jun 8 17:49:15 2022 +0200
Commit:     Eike Rathke <er...@redhat.com>
CommitDate: Wed Jun 8 20:49:53 2022 +0200

    Related: tdf#149484 Write proper <number:boolean-style> with <number:text>
    
    Change-Id: I46b7987dde25840ae0b6e5871b14e3806c6e4ac8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135508
    Reviewed-by: Eike Rathke <er...@redhat.com>
    Tested-by: Jenkins

diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx
index 52b286dd50a9..82ed552dcbca 100644
--- a/xmloff/source/style/xmlnumfe.cxx
+++ b/xmloff/source/style/xmlnumfe.cxx
@@ -1254,6 +1254,37 @@ void SvXMLNumFmtExport::ExportPart_Impl( const 
SvNumberformat& rFormat, sal_uInt
         WriteBooleanElement_Impl();
         bAnyContent = true;
     }
+    else if (eType == XML_BOOLEAN_STYLE)
+    {
+        // <number:boolean-style> may contain only <number:boolean> and
+        // <number:text> elements.
+        sal_uInt16 nPos = 0;
+        bool bEnd = false;
+        while (!bEnd)
+        {
+            const short nElemType = rFormat.GetNumForType( nPart, nPos );
+            switch (nElemType)
+            {
+                case 0:
+                    bEnd = true;                // end of format reached
+                    if (bHasText && sTextContent.isEmpty())
+                        bHasText = false;       // don't write trailing empty 
text
+                break;
+                case NF_SYMBOLTYPE_STRING:
+                    {
+                        const OUString* pElemStr = rFormat.GetNumForString( 
nPart, nPos );
+                        if (pElemStr)
+                            AddToTextElement_Impl( *pElemStr );
+                    }
+                break;
+                case NF_KEY_BOOLEAN:
+                    WriteBooleanElement_Impl();
+                    bAnyContent = true;
+                break;
+            }
+            ++nPos;
+        }
+    }
     else
     {
         //  first loop to collect attributes

Reply via email to