[Libreoffice-commits] .: sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Aug 28 10:50:04 PDT 2012


 sc/source/filter/excel/xecontent.cxx |   27 +++++++++++++++++++++++++--
 sc/source/filter/inc/xecontent.hxx   |    1 +
 2 files changed, 26 insertions(+), 2 deletions(-)

New commits:
commit efc7e271384b161dcfbea0f97a3e3efc41823f16
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Aug 28 19:47:53 2012 +0200

    hopefully a working version for databar ext guid creation
    
    Change-Id: Ide7261955168dc13b47b29705e22eb2c3154d24e

diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx
index ffdaa3f..905073e 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -54,6 +54,7 @@
 #include "xehelper.hxx"
 #include "xestyle.hxx"
 #include "xename.hxx"
+#include <rtl/uuid.h>
 
 using namespace ::oox;
 
@@ -1080,6 +1081,25 @@ void XclExpColorScale::SaveXml( XclExpXmlStream& rStrm )
     // OOXTODO: XML_extLst
 }
 
+namespace {
+
+rtl::OString createGuidStringFromInt(sal_uInt8 nGuid[16])
+{
+    rtl::OStringBuffer aBuffer;
+    aBuffer.append('{');
+    for(size_t i = 0; i < 16; ++i)
+    {
+        aBuffer.append(static_cast<sal_Int32>(nGuid[i]), 16);
+        if(i == 3|| i == 5 || i == 7 || i == 9 )
+            aBuffer.append('-');
+    }
+    aBuffer.append('}');
+    rtl::OString aString = aBuffer.makeStringAndClear();
+    return aString.toAsciiUpperCase();
+}
+
+}
+
 XclExpDataBar::XclExpDataBar( const XclExpRoot& rRoot, const ScDataBarFormat& rFormat, sal_Int32 nPriority, XclExtLstRef xExtLst ):
     XclExpRecord(),
     XclExpRoot( rRoot ),
@@ -1101,7 +1121,10 @@ XclExpDataBar::XclExpDataBar( const XclExpRoot& rRoot, const ScDataBarFormat& rF
             xExtLst->AddRecord( XclExpExtRef(new XclExpExtCondFormat( *xExtLst.get() )) );
             pParent = xExtLst->GetItem( XclExpExtDataBarType );
         }
-        static_cast<XclExpExtCondFormat*>(xExtLst->GetItem( XclExpExtDataBarType ).get())->AddRecord( XclExpExtConditionalFormattingRef(new XclExpExtConditionalFormatting( *pParent, rFormat, aAddr, rtl::OString("{64A12B6B-50E9-436E-8939-DBE15E5BE1DC}") )) );
+        sal_uInt8 nGuid[16];
+        rtl_createUuid(nGuid, NULL, true);
+        maGuid = createGuidStringFromInt(nGuid);
+        static_cast<XclExpExtCondFormat*>(xExtLst->GetItem( XclExpExtDataBarType ).get())->AddRecord( XclExpExtConditionalFormattingRef(new XclExpExtConditionalFormatting( *pParent, rFormat, aAddr, maGuid) ));
     }
 }
 
@@ -1130,7 +1153,7 @@ void XclExpDataBar::SaveXml( XclExpXmlStream& rStrm )
                                 FSEND );
 
     rWorksheet->startElementNS( XML_x14, XML_id, FSEND );
-    rWorksheet->write( "{64A12B6B-50E9-436E-8939-DBE15E5BE1DC}" );
+    rWorksheet->write( maGuid.getStr() );
     rWorksheet->endElementNS( XML_x14, XML_id );
 
     rWorksheet->endElement( XML_ext );
diff --git a/sc/source/filter/inc/xecontent.hxx b/sc/source/filter/inc/xecontent.hxx
index c6388de..668641b 100644
--- a/sc/source/filter/inc/xecontent.hxx
+++ b/sc/source/filter/inc/xecontent.hxx
@@ -274,6 +274,7 @@ private:
 
     const ScDataBarFormat& mrFormat;
     sal_Int32 mnPriority;
+    rtl::OString maGuid;
 };
 
 // ----------------------------------------------------------------------------


More information about the Libreoffice-commits mailing list