diff options
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/doc/Metadatable.cxx | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/sfx2/source/doc/Metadatable.cxx b/sfx2/source/doc/Metadatable.cxx index d7528f63de40..ae4a72368658 100644 --- a/sfx2/source/doc/Metadatable.cxx +++ b/sfx2/source/doc/Metadatable.cxx @@ -394,19 +394,34 @@ template< typename T > /*static*/ OUString create_id(const ::boost::unordered_map< OUString, T, OUStringHash > & i_rXmlIdMap) { - static rtlRandomPool s_Pool( rtl_random_createPool() ); + static bool bHack = (getenv("LIBO_ONEWAY_STABLE_ODF_EXPORT") != NULL); const OUString prefix(s_prefix); typename ::boost::unordered_map< OUString, T, OUStringHash > ::const_iterator iter; OUString id; - do + + if (bHack) + { + static sal_Int64 nIdCounter = SAL_CONST_INT64(4000000000); + do + { + id = prefix + OUString::number(nIdCounter++); + iter = i_rXmlIdMap.find(id); + } + while (iter != i_rXmlIdMap.end()); + } + else { - sal_Int32 n; - rtl_random_getBytes(s_Pool, & n, sizeof(n)); - id = prefix + OUString::number(abs(n)); - iter = i_rXmlIdMap.find(id); + static rtlRandomPool s_Pool( rtl_random_createPool() ); + do + { + sal_Int32 n; + rtl_random_getBytes(s_Pool, & n, sizeof(n)); + id = prefix + OUString::number(abs(n)); + iter = i_rXmlIdMap.find(id); + } + while (iter != i_rXmlIdMap.end()); } - while (iter != i_rXmlIdMap.end()); return id; } |