summaryrefslogtreecommitdiff
path: root/oox/source
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2017-12-11 14:38:54 +0100
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2017-12-12 08:46:34 +0100
commitc85d8064cb67552e3ddcc73099769af09d7d0edd (patch)
tree6e745da3721d3a1ba3fb63280335d9b274cc0728 /oox/source
parentac3d194db5bf32de9b92a0accf7492145e5d6cdd (diff)
Move generateGUIDString to comphelper
and remove duplicate method Change-Id: Ic513a780f3b9b526c3abd0f273ad9c230ffbb373 Reviewed-on: https://gerrit.libreoffice.org/46233 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'oox/source')
-rw-r--r--oox/source/export/drawingml.cxx19
-rw-r--r--oox/source/ole/vbaexport.cxx28
2 files changed, 5 insertions, 42 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index eb19a286e587..f500036e1282 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -76,6 +76,7 @@
#include <com/sun/star/style/CaseMap.hpp>
#include <comphelper/storagehelper.hxx>
+#include <comphelper/xmltools.hxx>
#include <o3tl/any.hxx>
#include <tools/stream.hxx>
#include <unotools/fontdefs.hxx>
@@ -1757,22 +1758,6 @@ OUString DrawingML::GetFieldValue( const css::uno::Reference< css::text::XTextRa
return aFieldValue;
}
-OString DrawingML::GetUUID()
-{
- sal_uInt8 aSeq[16];
- rtl_createUuid(aSeq, nullptr, true);
-
- char str[39];
- sprintf(str, "{%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
- aSeq[0], aSeq[1], aSeq[2], aSeq[3],
- aSeq[4], aSeq[5],
- aSeq[6], aSeq[7],
- aSeq[8], aSeq[9],
- aSeq[10], aSeq[11], aSeq[12], aSeq[13], aSeq[14], aSeq[15]);
-
- return OString(str, SAL_N_ELEMENTS(str));
-}
-
void DrawingML::WriteRun( const Reference< XTextRange >& rRun,
bool& rbOverridingCharHeight, sal_Int32& rnCharHeight)
{
@@ -1822,7 +1807,7 @@ void DrawingML::WriteRun( const Reference< XTextRange >& rRun,
{
if( bWriteField )
{
- OString sUUID(GetUUID());
+ OString sUUID(comphelper::xml::generateGUIDString());
mpFS->startElementNS( XML_a, XML_fld,
XML_id, sUUID.getStr(),
XML_type, OUStringToOString( sFieldValue, RTL_TEXTENCODING_UTF8 ).getStr(),
diff --git a/oox/source/ole/vbaexport.cxx b/oox/source/ole/vbaexport.cxx
index cd26bf486615..4aeff993b926 100644
--- a/oox/source/ole/vbaexport.cxx
+++ b/oox/source/ole/vbaexport.cxx
@@ -31,9 +31,8 @@
#include <sot/storage.hxx>
-#include <rtl/uuid.h>
-
#include <comphelper/string.hxx>
+#include <comphelper/xmltools.hxx>
#define USE_UTF8_CODEPAGE 0
#if USE_UTF8_CODEPAGE
@@ -88,28 +87,6 @@ OUString createHexStringFromDigit(sal_uInt8 nDigit)
return aString.toAsciiUpperCase();
}
-OUString createGuidStringFromInt(sal_uInt8 const nGuid[16])
-{
- OUStringBuffer aBuffer;
- aBuffer.append('{');
- for(size_t i = 0; i < 16; ++i)
- {
- aBuffer.append(createHexStringFromDigit(nGuid[i]));
- if(i == 3|| i == 5 || i == 7 || i == 9 )
- aBuffer.append('-');
- }
- aBuffer.append('}');
- OUString aString = aBuffer.makeStringAndClear();
- return aString.toAsciiUpperCase();
-}
-
-OUString generateGUIDString()
-{
- sal_uInt8 nGuid[16];
- rtl_createUuid(nGuid, nullptr, true);
- return createGuidStringFromInt(nGuid);
-}
-
}
VBACompressionChunk::VBACompressionChunk(SvStream& rCompressedStream, const sal_uInt8* pData, std::size_t nChunkSize)
@@ -877,7 +854,8 @@ void exportPROJECTStream(SvStream& rStrm, const css::uno::Reference<css::contain
// section 2.3.1.2 ProjectId
exportString(rStrm, "ID=\"");
- OUString aProjectID = generateGUIDString();
+ OUString aProjectID
+ = OStringToOUString(comphelper::xml::generateGUIDString(), RTL_TEXTENCODING_UTF8);
exportString(rStrm, aProjectID);
exportString(rStrm, "\"\r\n");