[Libreoffice-commits] core.git: Branch 'feature/gsoc17-revamp-customize-dialog' - 1442 commits - accessibility/AllLangMoTarget_acc.mk accessibility/AllLangResTarget_acc.mk accessibility/inc accessibility/Module_accessibility.mk accessibility/source android/Bootstrap android/source avmedia/AllLangMoTarget_avmedia.mk avmedia/AllLangResTarget_avmedia.mk avmedia/inc avmedia/Module_avmedia.mk avmedia/source basctl/AllLangMoTarget_basctl.mk basctl/AllLangResTarget_basctl.mk basctl/inc basctl/Module_basctl.mk basctl/sdi basctl/source basctl/uiconfig basegfx/source basegfx/test basic/AllLangMoTarget_sb.mk basic/AllLangResTarget_sb.mk basic/inc basic/Library_sb.mk basic/Module_basic.mk basic/qa basic/source bin/count-src-resources bin/distro-install-desktop-integration bin/distro-install-sdk bin/find-german-comments bin/findunusedcode bin/find-unused-defines-in-hrc-files.py bin/find-unusedheaders.pl bin/find-unusedheaders.py bin/gbuild-to-ide bin/gbuild-to-ideNS bin/generate-bash-completion bin/generate-b ash-completion.py bin/gen-iwyu-dummy-lib bin/lint-ui.py bin/lo-xlate-lang bin/run bin/update_pch bridges/Library_cpp_uno.mk bridges/source canvas/source chart2/AllLangMoTarget_chart.mk chart2/AllLangResTarget_chartcontroller.mk chart2/CppunitTest_chart2_export.mk chart2/CppunitTest_chart2_import.mk chart2/CppunitTest_chart2_trendcalculators.mk chart2/inc chart2/Library_chartcontroller.mk chart2/Module_chart2.mk chart2/qa chart2/source chart2/uiconfig cli_ure/source codemaker/Module_codemaker.mk codemaker/source comphelper/Library_comphelper.mk comphelper/source compilerplugins/clang config_host.mk.in configmgr/source configure.ac connectivity/AllLangMoTarget_cnr.mk connectivity/AllLangResTarget_cnr.mk connectivity/AllLangResTarget_sdberr.mk connectivity/Configuration_writer.mk connectivity/CppunitTest_connectivity_ado.mk connectivity/CppunitTest_connectivity_commontools.mk connectivity/inc connectivity/Library_ado.mk connectivity/Library_calc.mk connectivity/Library_dbtools.mk conne ctivity/Library_evoab.mk connectivity/Library_file.mk connectivity/Library_firebird_sdbc.mk connectivity/Library_mork.mk connectivity/Library_mysql.mk connectivity/Library_postgresql-sdbc-impl.mk connectivity/Library_postgresql-sdbc.mk connectivity/Library_writer.mk connectivity/Module_connectivity.mk connectivity/qa connectivity/registry connectivity/source cppcanvas/CppunitTest_cppcanvas_emfplus.mk cppcanvas/inc cppcanvas/source cppuhelper/source cppu/qa cppu/source cpputools/source cui/AllLangMoTarget_cui.mk cui/AllLangResTarget_cui.mk cui/inc cui/Library_cui.mk cui/Module_cui.mk cui/source cui/uiconfig dbaccess/AllLangMoTarget_dba.mk dbaccess/AllLangResTarget_dba.mk dbaccess/AllLangResTarget_dbmm.mk dbaccess/AllLangResTarget_dbu.mk dbaccess/AllLangResTarget_sdbt.mk dbaccess/CppunitTest_dbaccess_dialog_save.mk dbaccess/CppunitTest_dbaccess_empty_stdlib_save.mk dbaccess/CppunitTest_dbaccess_hsqldb_test.mk dbaccess/CppunitTest_dbaccess_macros_test.mk dbaccess/CppunitTest_dbaccess_n olib_save.mk dbaccess/CppunitTest_dbaccess_RowSetClones.mk dbaccess/inc dbaccess/Library_dba.mk dbaccess/Library_dbaxml.mk dbaccess/Library_dbmm.mk dbaccess/Library_dbu.mk dbaccess/Library_sdbt.mk dbaccess/Module_dbaccess.mk dbaccess/source dbaccess/uiconfig desktop/AllLangMoTarget_dkt.mk desktop/AllLangResTarget_deploymentgui.mk desktop/AllLangResTarget_deployment.mk desktop/AllLangResTarget_dkt.mk desktop/inc desktop/Library_deploymentmisc.mk desktop/Library_deployment.mk desktop/Library_sofficeapp.mk desktop/Module_desktop.mk desktop/qa desktop/source desktop/uiconfig desktop/unx dictionaries distro-configs/Jenkins distro-configs/LibreOfficeFlatpak.conf download.lst drawinglayer/inc drawinglayer/Library_drawinglayer.mk drawinglayer/qa drawinglayer/source dtrans/source editeng/AllLangMoTarget_editeng.mk editeng/AllLangResTarget_editeng.mk editeng/CppunitTest_editeng_core.mk editeng/inc editeng/Library_editeng.mk editeng/Module_editeng.mk editeng/qa editeng/source editeng/uiconfig embeddedobj/Library_embobj.mk embeddedobj/source embedserv/source emfio/CppunitTest_emfio_emf_test.mk emfio/CppunitTest_emfio_wmf_test.mk emfio/emfio.component emfio/inc emfio/Library_emfio.mk emfio/Makefile emfio/Module_emfio.mk emfio/qa emfio/README emfio/source extensions/AllLangMoTarget_pcr.mk extensions/AllLangResTarget_abp.mk extensions/AllLangResTarget_bib.mk extensions/AllLangResTarget_dbp.mk extensions/AllLangResTarget_pcr.mk extensions/AllLangResTarget_scn.mk extensions/AllLangResTarget_upd.mk extensions/CppunitTest_extensions_test_update.mk extensions/inc extensions/Library_abp.mk extensions/Library_dbp.mk extensions/Library_res.mk extensions/Library_scn.mk extensions/Library_updchk.mk extensions/Module_extensions.mk extensions/qa extensions/source extensions/uiconfig external/boost external/coinmp external/cppunit external/expat external/fontconfig external/graphite external/harfbuzz external/hunspell external/icu external/jpeg-turbo external/lcms2 external/libatomic_ops external/libexttextcat external/libmwaw external/liborcus external/libstaroffice external/libwpd external/libwps external/libxmlsec external/lpsolve external/Module_external.mk external/pdfium external/poppler extras/source filter/AllLangMoTarget_flt.mk filter/AllLangResTarget_eps.mk filter/AllLangResTarget_pdffilter.mk filter/AllLangResTarget_t602filter.mk filter/AllLangResTarget_xsltdlg.mk filter/Configuration_filter.mk filter/CppunitTest_filter_eps_test.mk filter/inc filter/Library_gie.mk filter/Library_graphicfilter.mk filter/Library_t602filter.mk filter/Module_filter.mk filter/qa filter/source filter/uiconfig forms/AllLangMoTarget_frm.mk forms/AllLangResTarget_frm.mk forms/inc forms/Library_frm.mk forms/Module_forms.mk forms/source formula/AllLangMoTarget_for.mk formula/AllLangResTarget_for.mk formula/AllLangResTarget_forui.mk formula/inc formula/Library_for.mk formula/Module_formula.mk formula/source formula/uiconfig fpicker/AllLangMoTarget_fps.mk fpicker/AllLangResTarget_fps _office.mk fpicker/inc fpicker/Library_fps_aqua.mk fpicker/Library_fps.mk fpicker/Module_fpicker.mk fpicker/source fpicker/uiconfig framework/AllLangMoTarget_fwk.mk framework/AllLangResTarget_fwe.mk framework/inc framework/Library_fwe.mk framework/Module_framework.mk framework/qa framework/source framework/uiconfig .gitignore helpcompiler/inc helpcompiler/source helpcontent2 hwpfilter/source i18nlangtag/qa i18nlangtag/source i18npool/inc i18npool/qa i18npool/source i18nutil/source icon-themes/breeze icon-themes/galaxy icon-themes/sifr icon-themes/sifr_dark idlc/inc idlc/source idl/inc idl/source include/android include/basic include/canvas include/codemaker include/com include/comphelper include/connectivity include/cppcanvas include/cppuhelper include/dbaccess include/desktop include/drawinglayer include/editeng include/filter include/formula include/fpicker include/framework include/i18nlangtag include/i18nutil include/LibreOfficeKit include/linguistic include/o3tl include/oox inc lude/osl include/registry include/rsc include/rtl include/sal include/sax include/sfx2 include/sot include/store include/svl include/svtools include/svx include/test include/toolkit include/tools include/uno include/unotools include/vbahelper include/vcl include/xmloff instsetoo_native/CustomTarget_setup.mk instsetoo_native/inc_common ios/experimental io/source javaunohelper/com jurt/com jvmfwk/plugins jvmfwk/source l10ntools/Executable_transex3.mk l10ntools/Executable_uiex.mk l10ntools/inc l10ntools/Module_l10ntools.mk l10ntools/source leak-suppress.txt libreofficekit/Executable_gtktiledviewer.mk libreofficekit/qa libreofficekit/README libreofficekit/source lingucomponent/source linguistic/inc linguistic/source lotuswordpro/source Makefile.fetch Makefile.in mysqlc/source odk/docs odk/examples offapi/com offapi/type_reference offapi/UnoApi_offapi.mk officecfg/Configuration_officecfg.mk officecfg/registry onlineupdate/qa onlineupdate/source oovbaapi/ooo oovbaapi/UnoApi_oovbaapi.mk oo x/inc oox/Library_oox.mk oox/qa oox/source opencl/inc opencl/source package/inc package/Library_xstor.mk package/source postprocess/CustomTarget_registry.mk postprocess/packimages postprocess/Rdb_services.mk pyuno/source qadevOOo/Jar_OOoRunner.mk qadevOOo/objdsc qadevOOo/tests readlicense_oo/license registry/source registry/test reportbuilder/java reportdesign/AllLangMoTarget_rpt.mk reportdesign/AllLangResTarget_rpt.mk reportdesign/AllLangResTarget_rptui.mk reportdesign/inc reportdesign/Library_rpt.mk reportdesign/Module_reportdesign.mk reportdesign/source reportdesign/uiconfig RepositoryExternal.mk Repository.mk RepositoryModule_build.mk RepositoryModule_host.mk rsc/documentation rsc/Executable_rsc.mk rsc/inc rsc/Makefile rsc/Module_rsc.mk rsc/README rsc/source salhelper/Module_salhelper.mk salhelper/source sal/osl sal/qa sal/rtl sal/textenc sax/inc sax/qa sax/source sax/test scaddins/AllLangMoTarget_sca.mk scaddins/AllLangResTarget_analysis.mk scaddins/AllLangResTarget_date.mk sca ddins/AllLangResTarget_pricing.mk scaddins/inc scaddins/Library_analysis.mk scaddins/Library_date.mk scaddins/Library_pricing.mk scaddins/Module_scaddins.mk scaddins/source sc/AllLangMoTarget_sc.mk sc/AllLangResTarget_sc.mk sccomp/AllLangMoTarget_scc.mk sccomp/AllLangResTarget_solver.mk sccomp/inc sccomp/Library_solver.mk sccomp/Module_sccomp.mk sccomp/source sc/CppunitTest_sc_cellcursorobj.mk sc/CppunitTest_sc_cellobj.mk sc/CppunitTest_sc_filters_test.mk sc/CppunitTest_sc_macros_test.mk sc/CppunitTest_sc_screenshots.mk sc/CppunitTest_sc_tiledrendering.mk sc/CppunitTest_sc_ucalc.mk schema/odf1.0 sc/inc sc/Library_sc.mk sc/Library_vbaobj.mk sc/Module_sc.mk scp2/inc scp2/InstallModule_ooo.mk scp2/macros scp2/source
Chris Sherlock
chris.sherlock79 at gmail.com
Sun Jul 23 07:17:42 UTC 2017
Rebased ref, commits from common ancestor:
commit 28b382b7b0a32417e0aedd4ae415a69e479fe60b
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date: Sun Jul 23 12:24:29 2017 +1000
rtl: cleanup equality conditions in uuid.cxx
Change-Id: I8918cd97f9ab89f0a2f7f95cd59b706ca5a55e2b
diff --git a/sal/rtl/uuid.cxx b/sal/rtl/uuid.cxx
index b3197d14a117..9ffbff7ff2cc 100644
--- a/sal/rtl/uuid.cxx
+++ b/sal/rtl/uuid.cxx
@@ -65,45 +65,49 @@ struct UUID
sal_uInt8 node[6];
};
-static void write_v3( sal_uInt8 *pUuid )
+static void write_v3( sal_uInt8 *pUuid )
{
UUID uuid;
// copy to avoid alignment problems
- memcpy( &uuid , pUuid , 16 );
+ memcpy(&uuid, pUuid, 16);
- SWAP_NETWORK_TO_INT32( uuid.time_low );
- SWAP_NETWORK_TO_INT16( uuid.time_mid );
- SWAP_NETWORK_TO_INT16( uuid.time_hi_and_version );
+ SWAP_NETWORK_TO_INT32(uuid.time_low);
+ SWAP_NETWORK_TO_INT16(uuid.time_mid);
+ SWAP_NETWORK_TO_INT16(uuid.time_hi_and_version);
/* put in the variant and version bits */
- uuid.time_hi_and_version &= 0x0FFF;
- uuid.time_hi_and_version |= (3 << 12);
+ uuid.time_hi_and_version &= 0x0FFF;
+ uuid.time_hi_and_version |= (3 << 12);
uuid.clock_seq_hi_and_reserved &= 0x3F;
uuid.clock_seq_hi_and_reserved |= 0x80;
- SWAP_INT32_TO_NETWORK( uuid.time_low );
- SWAP_INT16_TO_NETWORK( uuid.time_mid );
- SWAP_INT16_TO_NETWORK( uuid.time_hi_and_version );
+ SWAP_INT32_TO_NETWORK(uuid.time_low);
+ SWAP_INT16_TO_NETWORK(uuid.time_mid);
+ SWAP_INT16_TO_NETWORK(uuid.time_hi_and_version);
- memcpy( pUuid , &uuid , 16 );
+ memcpy(pUuid, &uuid, 16);
}
-extern "C" void SAL_CALL rtl_createUuid( sal_uInt8 *pTargetUUID ,
- SAL_UNUSED_PARAMETER const sal_uInt8 *,
- SAL_UNUSED_PARAMETER sal_Bool )
+extern "C" void SAL_CALL rtl_createUuid(sal_uInt8 *pTargetUUID ,
+ SAL_UNUSED_PARAMETER const sal_uInt8 *,
+ SAL_UNUSED_PARAMETER sal_Bool)
{
{
osl::MutexGuard g(osl::Mutex::getGlobalMutex());
static rtlRandomPool pool = nullptr;
- if (pool == nullptr) {
+ if (!pool)
+ {
pool = rtl_random_createPool();
- if (pool == nullptr) {
+ if (!pool)
+ {
abort();
// only possible way to signal failure here (rtl_createUuid
// being part of a fixed C API)
}
}
- if (rtl_random_getBytes(pool, pTargetUUID, 16) != rtl_Random_E_None) {
+
+ if (rtl_random_getBytes(pool, pTargetUUID, 16) != rtl_Random_E_None)
+ {
abort();
// only possible way to signal failure here (rtl_createUuid
// being part of a fixed C API)
@@ -116,36 +120,36 @@ extern "C" void SAL_CALL rtl_createUuid( sal_uInt8 *pTargetUUID ,
pTargetUUID[8] |= 0x80;
}
-extern "C" void SAL_CALL rtl_createNamedUuid( sal_uInt8 *pTargetUUID,
- const sal_uInt8 *pNameSpaceUUID,
- const rtl_String *pName )
+extern "C" void SAL_CALL rtl_createNamedUuid(sal_uInt8 *pTargetUUID,
+ const sal_uInt8 *pNameSpaceUUID,
+ const rtl_String *pName )
{
- rtlDigest digest = rtl_digest_createMD5 ();
+ rtlDigest digest = rtl_digest_createMD5();
- rtl_digest_updateMD5( digest, pNameSpaceUUID , 16 );
- rtl_digest_updateMD5( digest, pName->buffer , pName->length );
+ rtl_digest_updateMD5(digest, pNameSpaceUUID, 16);
+ rtl_digest_updateMD5(digest, pName->buffer, pName->length);
- rtl_digest_getMD5( digest, pTargetUUID , 16 );
- rtl_digest_destroyMD5 (digest);
+ rtl_digest_getMD5(digest, pTargetUUID, 16);
+ rtl_digest_destroyMD5(digest);
write_v3(pTargetUUID);
}
-extern "C" sal_Int32 SAL_CALL rtl_compareUuid( const sal_uInt8 *pUUID1 , const sal_uInt8 *pUUID2 )
+extern "C" sal_Int32 SAL_CALL rtl_compareUuid(const sal_uInt8 *pUUID1, const sal_uInt8 *pUUID2)
{
int i;
UUID u1;
UUID u2;
- memcpy( &u1 , pUUID1 , 16 );
- memcpy( &u2 , pUUID2 , 16 );
+ memcpy(&u1, pUUID1, 16 );
+ memcpy(&u2, pUUID2, 16 );
- SWAP_NETWORK_TO_INT32( u1.time_low );
- SWAP_NETWORK_TO_INT16( u1.time_mid );
- SWAP_NETWORK_TO_INT16( u1.time_hi_and_version );
+ SWAP_NETWORK_TO_INT32(u1.time_low);
+ SWAP_NETWORK_TO_INT16(u1.time_mid);
+ SWAP_NETWORK_TO_INT16(u1.time_hi_and_version);
- SWAP_NETWORK_TO_INT32( u2.time_low );
- SWAP_NETWORK_TO_INT16( u2.time_mid );
- SWAP_NETWORK_TO_INT16( u2.time_hi_and_version );
+ SWAP_NETWORK_TO_INT32(u2.time_low);
+ SWAP_NETWORK_TO_INT16(u2.time_mid);
+ SWAP_NETWORK_TO_INT16(u2.time_hi_and_version);
#define CHECK(f1, f2) if (f1 != f2) return f1 < f2 ? -1 : 1;
CHECK(u1.time_low, u2.time_low);
@@ -161,7 +165,6 @@ extern "C" sal_Int32 SAL_CALL rtl_compareUuid( const sal_uInt8 *pUUID1 , const s
return 1;
}
return 0;
-
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 80cdd90793c6b8b027f7f5366b03041b1ae5e0e5
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date: Sun Jul 23 12:20:38 2017 +1000
rtl: cleanup uri.cxx
Change-Id: Ic9ddcaa7c699830216e157bd9dfc09d30b50b3e6
diff --git a/sal/rtl/uri.cxx b/sal/rtl/uri.cxx
index b886e2153795..257a0a27abac 100644
--- a/sal/rtl/uri.cxx
+++ b/sal/rtl/uri.cxx
@@ -67,14 +67,12 @@ enum EscapeType
EscapeOctet
};
-/* Read any of the following:
+/** Read any of the following:
- - sequence of escape sequences representing character from eCharset,
- translated to single UCS4 character; or
-
- - pair of UTF-16 surrogates, translated to single UCS4 character; or
-
- _ single UTF-16 character, extended to UCS4 character.
+ @li sequence of escape sequences representing character from eCharset,
+ translated to single UCS4 character; or
+ @li pair of UTF-16 surrogates, translated to single UCS4 character; or
+ @li single UTF-16 character, extended to UCS4 character.
*/
sal_uInt32 readUcs4(sal_Unicode const ** pBegin, sal_Unicode const * pEnd,
bool bEncoded, rtl_TextEncoding eCharset,
@@ -90,7 +88,9 @@ sal_uInt32 readUcs4(sal_Unicode const ** pBegin, sal_Unicode const * pEnd,
*pBegin += 2;
nChar = static_cast< sal_uInt32 >(nWeight1 << 4 | nWeight2);
if (nChar <= 0x7F)
+ {
*pType = EscapeChar;
+ }
else if (eCharset == RTL_TEXTENCODING_UTF8)
{
if (nChar >= 0xC0 && nChar <= 0xF4)
@@ -116,8 +116,10 @@ sal_uInt32 readUcs4(sal_Unicode const ** pBegin, sal_Unicode const * pEnd,
nShift = 12;
nMin = 0x10000;
}
+
sal_Unicode const * p = *pBegin;
bool bUTF8 = true;
+
for (; nShift >= 0; nShift -= 6)
{
if (pEnd - p < 3 || p[0] != cEscapePrefix
@@ -149,6 +151,7 @@ sal_uInt32 readUcs4(sal_Unicode const ** pBegin, sal_Unicode const * pEnd,
rtl_TextToUnicodeConverter aConverter
= rtl_createTextToUnicodeConverter(eCharset);
sal_Unicode const * p = *pBegin;
+
for (;;)
{
sal_Unicode aDst[2];
@@ -161,17 +164,21 @@ sal_uInt32 readUcs4(sal_Unicode const ** pBegin, sal_Unicode const * pEnd,
| RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR
| RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR),
&nInfo, &nConverted);
+
if (nInfo == 0)
{
assert( nConverted
== sal::static_int_cast< sal_uInt32 >(
aBuf.getLength()));
+
rtl_destroyTextToUnicodeConverter(aConverter);
*pBegin = p;
*pType = EscapeChar;
+
assert( nDstSize == 1
|| (nDstSize == 2 && rtl::isHighSurrogate(aDst[0])
&& rtl::isLowSurrogate(aDst[1])));
+
return nDstSize == 1
? aDst[0] : rtl::combineSurrogates(aDst[0], aDst[1]);
}
@@ -211,10 +218,12 @@ sal_uInt32 readUcs4(sal_Unicode const ** pBegin, sal_Unicode const * pEnd,
void writeUcs4(rtl_uString ** pBuffer, sal_Int32 * pCapacity, sal_uInt32 nUtf32)
{
assert(rtl::isUnicodeCodePoint(nUtf32));
- if (nUtf32 <= 0xFFFF) {
- writeUnicode(
- pBuffer, pCapacity, static_cast< sal_Unicode >(nUtf32));
- } else {
+ if (nUtf32 <= 0xFFFF)
+ {
+ writeUnicode(pBuffer, pCapacity, static_cast< sal_Unicode >(nUtf32));
+ }
+ else
+ {
nUtf32 -= 0x10000;
writeUnicode(
pBuffer, pCapacity,
@@ -243,9 +252,12 @@ bool writeEscapeChar(rtl_uString ** pBuffer, sal_Int32 * pCapacity,
sal_uInt32 nUtf32, rtl_TextEncoding eCharset, bool bStrict)
{
assert(rtl::isUnicodeCodePoint(nUtf32));
- if (eCharset == RTL_TEXTENCODING_UTF8) {
+ if (eCharset == RTL_TEXTENCODING_UTF8)
+ {
if (nUtf32 < 0x80)
+ {
writeEscapeOctet(pBuffer, pCapacity, nUtf32);
+ }
else if (nUtf32 < 0x800)
{
writeEscapeOctet(pBuffer, pCapacity, nUtf32 >> 6 | 0xC0);
@@ -264,7 +276,9 @@ bool writeEscapeChar(rtl_uString ** pBuffer, sal_Int32 * pCapacity,
writeEscapeOctet(pBuffer, pCapacity, (nUtf32 >> 6 & 0x3F) | 0x80);
writeEscapeOctet(pBuffer, pCapacity, (nUtf32 & 0x3F) | 0x80);
}
- } else {
+ }
+ else
+ {
rtl_UnicodeToTextConverter aConverter
= rtl_createUnicodeToTextConverter(eCharset);
sal_Unicode aSrc[2];
@@ -282,6 +296,7 @@ bool writeEscapeChar(rtl_uString ** pBuffer, sal_Int32 * pCapacity,
((nUtf32 - 0x10000) & 0x3FF) | 0xDC00);
nSrcSize = 2;
}
+
sal_Char aDst[32]; // FIXME random value
sal_uInt32 nInfo;
sal_Size nConverted;
@@ -293,16 +308,23 @@ bool writeEscapeChar(rtl_uString ** pBuffer, sal_Int32 * pCapacity,
&nInfo, &nConverted);
assert((nInfo & RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL) == 0);
rtl_destroyUnicodeToTextConverter(aConverter);
- if (nInfo == 0) {
+
+ if (nInfo == 0)
+ {
assert(nConverted == nSrcSize); // bad rtl_convertUnicodeToText
+
for (sal_Size i = 0; i < nDstSize; ++i)
+ {
writeEscapeOctet(pBuffer, pCapacity,
static_cast< unsigned char >(aDst[i]));
// FIXME all octets are escaped, even if there is no need
- } else {
- if (bStrict) {
- return false;
}
+ }
+ else
+ {
+ if (bStrict)
+ return false;
+
writeUcs4(pBuffer, pCapacity, nUtf32);
}
}
@@ -355,6 +377,7 @@ void parseUriRef(rtl_uString const * pUriRef, Components * pComponents)
pPos = p;
break;
}
+
if (!rtl::isAsciiAlphanumeric(*p) && *p != '+' && *p != '-'
&& *p != '.')
{
@@ -368,20 +391,29 @@ void parseUriRef(rtl_uString const * pUriRef, Components * pComponents)
pComponents->aAuthority.pBegin = pPos;
pPos += 2;
while (pPos != pEnd && *pPos != '/' && *pPos != '?' && *pPos != '#')
+ {
++pPos;
+ }
+
pComponents->aAuthority.pEnd = pPos;
}
pComponents->aPath.pBegin = pPos;
while (pPos != pEnd && *pPos != '?' && * pPos != '#')
+ {
++pPos;
+ }
+
pComponents->aPath.pEnd = pPos;
if (pPos != pEnd && *pPos == '?')
{
pComponents->aQuery.pBegin = pPos++;
while (pPos != pEnd && * pPos != '#')
+ {
++pPos;
+ }
+
pComponents->aQuery.pEnd = pPos;
}
@@ -397,13 +429,17 @@ void appendPath(
rtl::OUStringBuffer & buffer, sal_Int32 bufferStart, bool precedingSlash,
sal_Unicode const * pathBegin, sal_Unicode const * pathEnd)
{
- while (precedingSlash || pathBegin != pathEnd) {
+ while (precedingSlash || pathBegin != pathEnd)
+ {
sal_Unicode const * p = pathBegin;
- while (p != pathEnd && *p != '/') {
+ while (p != pathEnd && *p != '/')
+ {
++p;
}
+
std::size_t n = p - pathBegin;
- if (n == 1 && pathBegin[0] == '.') {
+ if (n == 1 && pathBegin[0] == '.')
+ {
// input begins with "." -> remove from input (and done):
// i.e., !precedingSlash -> !precedingSlash
// input begins with "./" -> remove from input:
@@ -413,7 +449,9 @@ void appendPath(
// i.e., precedingSlash -> precedingSlash
// input begins with "/./" -> replace with "/" in input:
// i.e., precedingSlash -> precedingSlash
- } else if (n == 2 && pathBegin[0] == '.' && pathBegin[1] == '.') {
+ }
+ else if (n == 2 && pathBegin[0] == '.' && pathBegin[1] == '.')
+ {
// input begins with ".." -> remove from input (and done):
// i.e., !precedingSlash -> !precedingSlash
// input begins with "../" -> remove from input
@@ -424,7 +462,8 @@ void appendPath(
// input begins with "/../" -> replace with "/" in input, and shrink
// output:
// i.e., precedingSlash -> precedingSlash
- if (precedingSlash) {
+ if (precedingSlash)
+ {
buffer.truncate(
bufferStart
+ std::max<sal_Int32>(
@@ -433,10 +472,12 @@ void appendPath(
buffer.getLength() - bufferStart, '/'),
0));
}
- } else {
- if (precedingSlash) {
+ }
+ else
+ {
+ if (precedingSlash)
buffer.append('/');
- }
+
buffer.append(pathBegin, n);
precedingSlash = p != pathEnd;
}
@@ -578,6 +619,7 @@ sal_Bool const * SAL_CALL rtl_getUriCharClass(rtl_UriCharClass eCharClass)
true, true, true, true, true, true, true, true, // hijklmno
true, true, true, true, true, true, true, true, // pqrstuvw
true, true, true, false, false, false, true, false}}; // xyz{|}~
+
assert(
(eCharClass >= 0
&& (sal::static_int_cast< std::size_t >(eCharClass)
@@ -596,6 +638,7 @@ void SAL_CALL rtl_uriEncode(rtl_uString * pText, sal_Bool const * pCharClass,
sal_Unicode const * pEnd = p + pText->length;
sal_Int32 nCapacity = pText->length;
rtl_uString_new_WithLength(pResult, nCapacity);
+
while (p < pEnd)
{
EscapeType eType;
@@ -605,12 +648,15 @@ void SAL_CALL rtl_uriEncode(rtl_uString * pText, sal_Bool const * pCharClass,
|| eMechanism == rtl_UriEncodeCheckEscapes
|| eMechanism == rtl_UriEncodeStrictKeepEscapes),
eCharset, &eType);
+
switch (eType)
{
case EscapeNo:
if (isValid(pCharClass, nUtf32)) // implies nUtf32 <= 0x7F
+ {
writeUnicode(pResult, &nCapacity,
static_cast< sal_Unicode >(nUtf32));
+ }
else if (!writeEscapeChar(
pResult, &nCapacity, nUtf32, eCharset,
(eMechanism == rtl_UriEncodeStrict
@@ -624,8 +670,10 @@ void SAL_CALL rtl_uriEncode(rtl_uString * pText, sal_Bool const * pCharClass,
case EscapeChar:
if (eMechanism == rtl_UriEncodeCheckEscapes
&& isValid(pCharClass, nUtf32)) // implies nUtf32 <= 0x7F
+ {
writeUnicode(pResult, &nCapacity,
static_cast< sal_Unicode >(nUtf32));
+ }
else if (!writeEscapeChar(
pResult, &nCapacity, nUtf32, eCharset,
(eMechanism == rtl_UriEncodeStrict
@@ -641,7 +689,7 @@ void SAL_CALL rtl_uriEncode(rtl_uString * pText, sal_Bool const * pCharClass,
break;
}
}
- *pResult = rtl_uStringBuffer_makeStringAndClear( pResult, &nCapacity );
+ *pResult = rtl_uStringBuffer_makeStringAndClear(pResult, &nCapacity);
}
void SAL_CALL rtl_uriDecode(rtl_uString * pText,
@@ -664,6 +712,7 @@ void SAL_CALL rtl_uriDecode(rtl_uString * pText,
sal_Unicode const * pEnd = p + pText->length;
sal_Int32 nCapacity = pText->length;
rtl_uString_new_WithLength(pResult, nCapacity);
+
while (p < pEnd)
{
EscapeType eType;
@@ -677,12 +726,14 @@ void SAL_CALL rtl_uriDecode(rtl_uString * pText,
break;
}
SAL_FALLTHROUGH;
+
case EscapeNo:
writeUcs4(pResult, &nCapacity, nUtf32);
break;
case EscapeOctet:
- if (eMechanism == rtl_UriDecodeStrict) {
+ if (eMechanism == rtl_UriDecodeStrict)
+ {
rtl_uString_new(pResult);
return;
}
@@ -690,6 +741,7 @@ void SAL_CALL rtl_uriDecode(rtl_uString * pText,
break;
}
}
+
*pResult = rtl_uStringBuffer_makeStringAndClear( pResult, &nCapacity );
}
break;
@@ -707,19 +759,27 @@ sal_Bool SAL_CALL rtl_uriConvertRelToAbs(rtl_uString * pBaseUriRef,
rtl::OUStringBuffer aBuffer;
Components aRelComponents;
parseUriRef(pRelUriRef, &aRelComponents);
+
if (aRelComponents.aScheme.isPresent())
{
aBuffer.append(aRelComponents.aScheme.pBegin,
aRelComponents.aScheme.getLength());
+
if (aRelComponents.aAuthority.isPresent())
+ {
aBuffer.append(aRelComponents.aAuthority.pBegin,
aRelComponents.aAuthority.getLength());
+ }
+
appendPath(
aBuffer, aBuffer.getLength(), false, aRelComponents.aPath.pBegin,
aRelComponents.aPath.pEnd);
+
if (aRelComponents.aQuery.isPresent())
+ {
aBuffer.append(aRelComponents.aQuery.pBegin,
aRelComponents.aQuery.getLength());
+ }
}
else
{
@@ -735,6 +795,7 @@ sal_Bool SAL_CALL rtl_uriConvertRelToAbs(rtl_uString * pBaseUriRef,
.pData));
return false;
}
+
aBuffer.append(aBaseComponents.aScheme.pBegin,
aBaseComponents.aScheme.getLength());
if (aRelComponents.aAuthority.isPresent())
@@ -744,63 +805,86 @@ sal_Bool SAL_CALL rtl_uriConvertRelToAbs(rtl_uString * pBaseUriRef,
appendPath(
aBuffer, aBuffer.getLength(), false,
aRelComponents.aPath.pBegin, aRelComponents.aPath.pEnd);
+
if (aRelComponents.aQuery.isPresent())
+ {
aBuffer.append(aRelComponents.aQuery.pBegin,
aRelComponents.aQuery.getLength());
+ }
}
else
{
if (aBaseComponents.aAuthority.isPresent())
+ {
aBuffer.append(aBaseComponents.aAuthority.pBegin,
aBaseComponents.aAuthority.getLength());
+ }
+
if (aRelComponents.aPath.pBegin == aRelComponents.aPath.pEnd)
{
aBuffer.append(aBaseComponents.aPath.pBegin,
aBaseComponents.aPath.getLength());
if (aRelComponents.aQuery.isPresent())
+ {
aBuffer.append(aRelComponents.aQuery.pBegin,
aRelComponents.aQuery.getLength());
+ }
else if (aBaseComponents.aQuery.isPresent())
+ {
aBuffer.append(aBaseComponents.aQuery.pBegin,
aBaseComponents.aQuery.getLength());
+ }
}
else
{
if (aRelComponents.aPath.pBegin != aRelComponents.aPath.pEnd
&& *aRelComponents.aPath.pBegin == '/')
+ {
appendPath(
aBuffer, aBuffer.getLength(), false,
aRelComponents.aPath.pBegin, aRelComponents.aPath.pEnd);
+ }
else if (aBaseComponents.aAuthority.isPresent()
&& aBaseComponents.aPath.pBegin
== aBaseComponents.aPath.pEnd)
+ {
appendPath(
aBuffer, aBuffer.getLength(), true,
aRelComponents.aPath.pBegin, aRelComponents.aPath.pEnd);
+ }
else
{
sal_Int32 n = aBuffer.getLength();
sal_Int32 i = rtl_ustr_lastIndexOfChar_WithLength(
aBaseComponents.aPath.pBegin,
aBaseComponents.aPath.getLength(), '/');
- if (i >= 0) {
+
+ if (i >= 0)
+ {
appendPath(
aBuffer, n, false, aBaseComponents.aPath.pBegin,
aBaseComponents.aPath.pBegin + i);
}
+
appendPath(
aBuffer, n, i >= 0, aRelComponents.aPath.pBegin,
aRelComponents.aPath.pEnd);
}
+
if (aRelComponents.aQuery.isPresent())
+ {
aBuffer.append(aRelComponents.aQuery.pBegin,
aRelComponents.aQuery.getLength());
+ }
}
}
}
if (aRelComponents.aFragment.isPresent())
+ {
aBuffer.append(aRelComponents.aFragment.pBegin,
aRelComponents.aFragment.getLength());
+ }
+
rtl_uString_assign(pResult, aBuffer.makeStringAndClear().pData);
return true;
}
commit 6128d6277142c703ec9c938c22f395de6b66f3f7
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date: Sun Jul 23 12:06:10 2017 +1000
rtl: cleanup rtl_process.cxx
Change-Id: I8640da0d5f44d69b9b628ac2076aec50b8e62ceb
diff --git a/sal/rtl/rtl_process.cxx b/sal/rtl/rtl_process.cxx
index a391dc8e7453..4904ff224a7b 100644
--- a/sal/rtl/rtl_process.cxx
+++ b/sal/rtl/rtl_process.cxx
@@ -26,9 +26,11 @@
#include "rtl/uuid.h"
#include "sal/types.h"
-namespace {
+namespace
+{
-class Id {
+class Id
+{
public:
Id() { rtl_createUuid(uuid_, nullptr, false); }
@@ -36,7 +38,7 @@ public:
Id& operator=(const Id&) = delete;
void copy(sal_uInt8 * target) const
- { std::memcpy(target, uuid_, UUID_SIZE); }
+ { std::memcpy(target, uuid_, UUID_SIZE); }
private:
enum { UUID_SIZE = 16 };
@@ -46,9 +48,10 @@ private:
struct theId: public rtl::Static< Id, theId > {};
-}
+} // end namespace
-void rtl_getGlobalProcessId(sal_uInt8 * pTargetUUID) {
+void rtl_getGlobalProcessId(sal_uInt8 * pTargetUUID)
+{
theId::get().copy(pTargetUUID);
}
commit 16204ebb6862e3ada703001c048089ca931060d1
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date: Sun Jul 23 12:04:12 2017 +1000
rtl: remove comments, cleanup equality conditions in random.cxx
Change-Id: I915aafe5a0df39b19e1f5bdc701cb9175dabb5ed
diff --git a/sal/rtl/random.cxx b/sal/rtl/random.cxx
index 360ade3b7873..96978ffdfbc7 100644
--- a/sal/rtl/random.cxx
+++ b/sal/rtl/random.cxx
@@ -25,11 +25,7 @@
#include <rtl/digest.h>
#include <rtl/random.h>
#include "oslrandom.h"
-/*========================================================================
- *
- * rtlRandom internals.
- *
- *======================================================================*/
+
#define RTL_RANDOM_RNG_1(a) ((a) * 16807L)
#define RTL_RANDOM_RNG_2(a) ((a) * 65539L)
@@ -45,8 +41,6 @@
if ((z) < 0) (z) += 30307L; \
}
-/** RandomData_Impl.
- */
struct RandomData_Impl
{
sal_Int16 m_nX;
@@ -54,12 +48,8 @@ struct RandomData_Impl
sal_Int16 m_nZ;
};
-/** data.
- */
static double data (RandomData_Impl *pImpl);
-/** RandomPool_Impl.
- */
#define RTL_RANDOM_DIGEST rtl_Digest_AlgorithmMD5
#define RTL_RANDOM_SIZE_DIGEST RTL_DIGEST_LENGTH_MD5
#define RTL_RANDOM_SIZE_POOL 1023
@@ -74,25 +64,15 @@ struct RandomPool_Impl
sal_uInt32 m_nCount;
};
-/** initPool.
- */
-static bool initPool (
- RandomPool_Impl *pImpl);
+static bool initPool(RandomPool_Impl *pImpl);
-/** seedPool.
- */
-static void seedPool (
+static void seedPool(
RandomPool_Impl *pImpl, const sal_uInt8 *pBuffer, sal_Size nBufLen);
-/** readPool.
- */
-static void readPool (
+static void readPool(
RandomPool_Impl *pImpl, sal_uInt8 *pBuffer, sal_Size nBufLen);
-/*
- * data.
- */
-static double data (RandomData_Impl *pImpl)
+static double data(RandomData_Impl *pImpl)
{
double random;
@@ -105,18 +85,15 @@ static double data (RandomData_Impl *pImpl)
return random;
}
-/*
- * initPool.
- */
-static bool initPool (RandomPool_Impl *pImpl)
+static bool initPool(RandomPool_Impl *pImpl)
{
- pImpl->m_hDigest = rtl_digest_create (RTL_RANDOM_DIGEST);
+ pImpl->m_hDigest = rtl_digest_create(RTL_RANDOM_DIGEST);
if (pImpl->m_hDigest)
{
oslThreadIdentifier tid;
- TimeValue tv;
- RandomData_Impl rd;
- double seed;
+ TimeValue tv;
+ RandomData_Impl rd;
+ double seed;
/* The use of uninitialized stack variables as a way to
* enhance the entropy of the random pool triggers
@@ -131,36 +108,33 @@ static bool initPool (RandomPool_Impl *pImpl)
tid = osl::Thread::getCurrentIdentifier();
tid = RTL_RANDOM_RNG_2(RTL_RANDOM_RNG_1(tid));
- seedPool (pImpl, reinterpret_cast<sal_uInt8*>(&tid), sizeof(tid));
+ seedPool (pImpl, reinterpret_cast< sal_uInt8* >(&tid), sizeof(tid));
osl_getSystemTime (&tv);
tv.Seconds = RTL_RANDOM_RNG_2(tv.Seconds);
tv.Nanosec = RTL_RANDOM_RNG_2(tv.Nanosec);
- seedPool (pImpl, reinterpret_cast<sal_uInt8*>(&tv), sizeof(tv));
+ seedPool (pImpl, reinterpret_cast< sal_uInt8* >(&tv), sizeof(tv));
- rd.m_nX = (sal_Int16)(((tid >> 1) << 1) + 1);
+ rd.m_nX = (sal_Int16)(((tid >> 1) << 1) + 1);
rd.m_nY = (sal_Int16)(((tv.Seconds >> 1) << 1) + 1);
rd.m_nZ = (sal_Int16)(((tv.Nanosec >> 1) << 1) + 1);
- seedPool (pImpl, reinterpret_cast<sal_uInt8*>(&rd), sizeof(rd));
+ seedPool (pImpl, reinterpret_cast< sal_uInt8* >(&rd), sizeof(rd));
while (pImpl->m_nData < RTL_RANDOM_SIZE_POOL)
{
seed = data (&rd);
- seedPool (pImpl, reinterpret_cast<sal_uInt8*>(&seed), sizeof(seed));
+ seedPool (pImpl, reinterpret_cast< sal_uInt8* >(&seed), sizeof(seed));
}
return true;
}
return false;
}
-/*
- * seedPool.
- */
-static void seedPool (
+static void seedPool(
RandomPool_Impl *pImpl, const sal_uInt8 *pBuffer, sal_Size nBufLen)
{
sal_Size i;
- sal_sSize j, k;
+ sal_sSize j, k;
for (i = 0; i < nBufLen; i += RTL_RANDOM_SIZE_DIGEST)
{
@@ -168,27 +142,27 @@ static void seedPool (
if (j > RTL_RANDOM_SIZE_DIGEST)
j = RTL_RANDOM_SIZE_DIGEST;
- rtl_digest_update (
+ rtl_digest_update(
pImpl->m_hDigest, pImpl->m_pDigest, RTL_RANDOM_SIZE_DIGEST);
k = (pImpl->m_nIndex + j) - RTL_RANDOM_SIZE_POOL;
if (k > 0)
{
- rtl_digest_update (
+ rtl_digest_update(
pImpl->m_hDigest, &(pImpl->m_pData[pImpl->m_nIndex]), j - k);
- rtl_digest_update (
+ rtl_digest_update(
pImpl->m_hDigest, &(pImpl->m_pData[0]), k);
}
else
{
- rtl_digest_update (
+ rtl_digest_update(
pImpl->m_hDigest, &(pImpl->m_pData[pImpl->m_nIndex]), j);
}
- rtl_digest_update (pImpl->m_hDigest, pBuffer, j);
+ rtl_digest_update(pImpl->m_hDigest, pBuffer, j);
pBuffer += j;
- rtl_digest_get (
+ rtl_digest_get(
pImpl->m_hDigest, pImpl->m_pDigest, RTL_RANDOM_SIZE_DIGEST);
for (k = 0; k < j; k++)
{
@@ -205,9 +179,6 @@ static void seedPool (
pImpl->m_nData = pImpl->m_nIndex;
}
-/*
- * readPool.
- */
static void readPool (
RandomPool_Impl *pImpl, sal_uInt8 *pBuffer, sal_Size nBufLen)
{
@@ -220,7 +191,7 @@ static void readPool (
j = RTL_RANDOM_SIZE_DIGEST/2;
nBufLen -= j;
- rtl_digest_update (
+ rtl_digest_update(
pImpl->m_hDigest,
&(pImpl->m_pDigest[RTL_RANDOM_SIZE_DIGEST/2]),
RTL_RANDOM_SIZE_DIGEST/2);
@@ -228,121 +199,103 @@ static void readPool (
k = (pImpl->m_nIndex + j) - pImpl->m_nData;
if (k > 0)
{
- rtl_digest_update (
+ rtl_digest_update(
pImpl->m_hDigest, &(pImpl->m_pData[pImpl->m_nIndex]), j - k);
- rtl_digest_update (
+ rtl_digest_update(
pImpl->m_hDigest, &(pImpl->m_pData[0]), k);
}
else
{
- rtl_digest_update (
+ rtl_digest_update(
pImpl->m_hDigest, &(pImpl->m_pData[pImpl->m_nIndex]), j);
}
- rtl_digest_get (
+ rtl_digest_get(
pImpl->m_hDigest, pImpl->m_pDigest, RTL_RANDOM_SIZE_DIGEST);
for (k = 0; k < j; k++)
{
- if (pImpl->m_nIndex >= pImpl->m_nData) pImpl->m_nIndex = 0;
+ if (pImpl->m_nIndex >= pImpl->m_nData)
+ pImpl->m_nIndex = 0;
+
pImpl->m_pData[pImpl->m_nIndex++] ^= pImpl->m_pDigest[k];
*pBuffer++ = pImpl->m_pDigest[k + RTL_RANDOM_SIZE_DIGEST/2];
}
}
pImpl->m_nCount++;
- rtl_digest_update (
+ rtl_digest_update(
pImpl->m_hDigest, &(pImpl->m_nCount), sizeof(pImpl->m_nCount));
- rtl_digest_update (
+ rtl_digest_update(
pImpl->m_hDigest, pImpl->m_pDigest, RTL_RANDOM_SIZE_DIGEST);
- rtl_digest_get (
+ rtl_digest_get(
pImpl->m_hDigest, pImpl->m_pDigest, RTL_RANDOM_SIZE_DIGEST);
}
-/*========================================================================
- *
- * rtlRandom implementation.
- *
- *======================================================================*/
-/*
- * rtl_random_createPool.
- */
rtlRandomPool SAL_CALL rtl_random_createPool() SAL_THROW_EXTERN_C()
{
RandomPool_Impl *pImpl = nullptr;
char sanity[4];
/* try to get system random number, if it fail fall back on own pool */
- pImpl = static_cast<RandomPool_Impl*>(rtl_allocateZeroMemory (sizeof(RandomPool_Impl)));
+ pImpl = static_cast< RandomPool_Impl* >(rtl_allocateZeroMemory(sizeof(RandomPool_Impl)));
if (pImpl)
{
- if(!osl_get_system_random_data(sanity, 4))
+ if (!osl_get_system_random_data(sanity, 4))
{
- if (!initPool (pImpl))
+ if (!initPool(pImpl))
{
- rtl_freeZeroMemory (pImpl, sizeof(RandomPool_Impl));
+ rtl_freeZeroMemory(pImpl, sizeof(RandomPool_Impl));
pImpl = nullptr;
}
}
}
- return static_cast<rtlRandomPool>(pImpl);
+ return static_cast< rtlRandomPool >(pImpl);
}
-/*
- * rtl_random_destroyPool.
- */
-void SAL_CALL rtl_random_destroyPool (rtlRandomPool Pool) SAL_THROW_EXTERN_C()
+void SAL_CALL rtl_random_destroyPool(rtlRandomPool Pool) SAL_THROW_EXTERN_C()
{
- RandomPool_Impl *pImpl = static_cast<RandomPool_Impl *>(Pool);
+ RandomPool_Impl *pImpl = static_cast< RandomPool_Impl* >(Pool);
if (pImpl)
{
- if(pImpl->m_hDigest)
- {
- rtl_digest_destroy (pImpl->m_hDigest);
- }
- rtl_freeZeroMemory (pImpl, sizeof (RandomPool_Impl));
+ if (pImpl->m_hDigest)
+ rtl_digest_destroy(pImpl->m_hDigest);
+
+ rtl_freeZeroMemory (pImpl, sizeof(RandomPool_Impl));
}
}
-/*
- * rtl_random_addBytes.
- */
-rtlRandomError SAL_CALL rtl_random_addBytes (
+rtlRandomError SAL_CALL rtl_random_addBytes(
rtlRandomPool Pool, const void *Buffer, sal_Size Bytes) SAL_THROW_EXTERN_C()
{
- RandomPool_Impl *pImpl = static_cast<RandomPool_Impl *>(Pool);
- const sal_uInt8 *pBuffer = static_cast<const sal_uInt8 *>(Buffer);
+ RandomPool_Impl *pImpl = static_cast< RandomPool_Impl* >(Pool);
+ const sal_uInt8 *pBuffer = static_cast< const sal_uInt8* >(Buffer);
- if ((pImpl == nullptr) || (pBuffer == nullptr))
+ if (!pImpl || !pBuffer)
return rtl_Random_E_Argument;
- if(pImpl->m_hDigest)
- {
+
+ if (pImpl->m_hDigest)
seedPool (pImpl, pBuffer, Bytes);
- }
+
return rtl_Random_E_None;
}
-/*
- * rtl_random_getBytes.
- */
rtlRandomError SAL_CALL rtl_random_getBytes (
rtlRandomPool Pool, void *Buffer, sal_Size Bytes) SAL_THROW_EXTERN_C()
{
- RandomPool_Impl *pImpl = static_cast<RandomPool_Impl *>(Pool);
- sal_uInt8 *pBuffer = static_cast<sal_uInt8 *>(Buffer);
+ RandomPool_Impl *pImpl = static_cast< RandomPool_Impl* >(Pool);
+ sal_uInt8 *pBuffer = static_cast< sal_uInt8* >(Buffer);
- if ((pImpl == nullptr) || (pBuffer == nullptr))
+ if (!pImpl || !pBuffer)
return rtl_Random_E_Argument;
- if(pImpl->m_hDigest || !osl_get_system_random_data(static_cast<char*>(Buffer), Bytes))
+ if (pImpl->m_hDigest || !osl_get_system_random_data(static_cast< char* >(Buffer), Bytes))
{
- if(!pImpl->m_hDigest)
+ if (!pImpl->m_hDigest)
{
if (!initPool (pImpl))
- {
return rtl_Random_E_Unknown;
- }
}
- readPool (pImpl, pBuffer, Bytes);
+ readPool(pImpl, pBuffer, Bytes);
}
return rtl_Random_E_None;
}
commit 9f45e431abf0cc24cb1db86a0dd0979848d8eb8d
Author: Muhammet Kara <muhammet.kara at pardus.org.tr>
Date: Wed Jul 5 10:36:06 2017 +0300
Add new helper class to cui for SvxConfigPage
And kill the temporary namespace killmelater.
This class will contain helper functions/methods
for use of the tab pages of the Customize Dialog.
Change-Id: I63a05c9495a79009ed5b47f7790a46cff9f58c6a
Reviewed-on: https://gerrit.libreoffice.org/39617
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Muhammet Kara <muhammet.kara at pardus.org.tr>
Reviewed-on: https://gerrit.libreoffice.org/40308
diff --git a/cui/Library_cui.mk b/cui/Library_cui.mk
index 8f29a4fa3ce0..4efdb440b242 100644
--- a/cui/Library_cui.mk
+++ b/cui/Library_cui.mk
@@ -88,6 +88,7 @@ $(eval $(call gb_Library_add_exception_objects,cui,\
cui/source/customize/cfgutil \
cui/source/customize/eventdlg \
cui/source/customize/macropg \
+ cui/source/customize/SvxConfigPageHelper \
cui/source/customize/SvxMenuConfigPage \
cui/source/customize/SvxToolbarConfigPage \
cui/source/dialogs/about \
diff --git a/cui/source/customize/SvxConfigPageHelper.cxx b/cui/source/customize/SvxConfigPageHelper.cxx
new file mode 100644
index 000000000000..0e8c9ec5e6e0
--- /dev/null
+++ b/cui/source/customize/SvxConfigPageHelper.cxx
@@ -0,0 +1,476 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "SvxConfigPageHelper.hxx"
+
+static sal_Int16 theImageType =
+ css::ui::ImageType::COLOR_NORMAL |
+ css::ui::ImageType::SIZE_DEFAULT;
+
+void SvxConfigPageHelper::RemoveEntry( SvxEntries* pEntries, SvxConfigEntry* pChildEntry )
+{
+ SvxEntries::iterator iter = pEntries->begin();
+
+ while ( iter != pEntries->end() )
+ {
+ if ( pChildEntry == *iter )
+ {
+ pEntries->erase( iter );
+ break;
+ }
+ ++iter;
+ }
+}
+
+OUString SvxConfigPageHelper::replaceSaveInName( const OUString& rMessage, const OUString& rSaveInName )
+{
+ const OUString placeholder("%SAVE IN SELECTION%" );
+
+ OUString name = rMessage.replaceFirst(placeholder, rSaveInName);
+
+ return name;
+}
+
+OUString SvxConfigPageHelper::stripHotKey( const OUString& str )
+{
+ return str.replaceFirst("~", "");
+}
+
+OUString SvxConfigPageHelper::replaceSixteen( const OUString& str, sal_Int32 nReplacement )
+{
+ return str.replaceAll( OUString::number( 16 ), OUString::number( nReplacement ));
+}
+
+sal_Int16 SvxConfigPageHelper::GetImageType()
+{
+ return theImageType;
+}
+
+void SvxConfigPageHelper::InitImageType()
+{
+ theImageType =
+ css::ui::ImageType::COLOR_NORMAL |
+ css::ui::ImageType::SIZE_DEFAULT;
+
+ if (SvtMiscOptions().GetSymbolsSize() == SFX_SYMBOLS_SIZE_LARGE)
+ {
+ theImageType |= css::ui::ImageType::SIZE_LARGE;
+ }
+ else if (SvtMiscOptions().GetSymbolsSize() == SFX_SYMBOLS_SIZE_32)
+ {
+ theImageType |= css::ui::ImageType::SIZE_32;
+ }
+}
+
+css::uno::Reference< css::graphic::XGraphic > SvxConfigPageHelper::GetGraphic(
+ const css::uno::Reference< css::ui::XImageManager >& xImageManager,
+ const OUString& rCommandURL )
+{
+ css::uno::Reference< css::graphic::XGraphic > result;
+
+ if ( xImageManager.is() )
+ {
+ // TODO handle large graphics
+ css::uno::Sequence< css::uno::Reference< css::graphic::XGraphic > > aGraphicSeq;
+
+ css::uno::Sequence<OUString> aImageCmdSeq { rCommandURL };
+
+ try
+ {
+ aGraphicSeq =
+ xImageManager->getImages( GetImageType(), aImageCmdSeq );
+
+ if ( aGraphicSeq.getLength() > 0 )
+ {
+ result = aGraphicSeq[0];
+ }
+ }
+ catch ( css::uno::Exception& )
+ {
+ // will return empty XGraphic
+ }
+ }
+
+ return result;
+}
+
+OUString
+SvxConfigPageHelper::generateCustomName(
+ const OUString& prefix,
+ SvxEntries* entries,
+ sal_Int32 suffix /*= 1*/ )
+{
+ OUString name;
+ sal_Int32 pos = 0;
+
+ // find and replace the %n placeholder in the prefix string
+ name = prefix.replaceFirst( "%n", OUString::number( suffix ), &pos );
+
+ if ( pos == -1 )
+ {
+ // no placeholder found so just append the suffix
+ name += OUString::number( suffix );
+ }
+
+ if (!entries)
+ return name;
+
+ // now check if there is an already existing entry with this name
+ SvxEntries::const_iterator iter = entries->begin();
+
+ while ( iter != entries->end() )
+ {
+ SvxConfigEntry* pEntry = *iter;
+
+ if ( name.equals( pEntry->GetName() ) )
+ {
+ break;
+ }
+ ++iter;
+ }
+
+ if ( iter != entries->end() )
+ {
+ // name already exists so try the next number up
+ return generateCustomName( prefix, entries, ++suffix );
+ }
+
+ return name;
+}
+
+OUString SvxConfigPageHelper::generateCustomMenuURL(
+ SvxEntries* entries,
+ sal_Int32 suffix /*= 1*/ )
+{
+ OUString url = "vnd.openoffice.org:CustomMenu" + OUString::number( suffix );
+ if (!entries)
+ return url;
+
+ // now check is there is an already existing entry with this url
+ SvxEntries::const_iterator iter = entries->begin();
+
+ while ( iter != entries->end() )
+ {
+ SvxConfigEntry* pEntry = *iter;
+
+ if ( url.equals( pEntry->GetCommand() ) )
+ {
+ break;
+ }
+ ++iter;
+ }
+
+ if ( iter != entries->end() )
+ {
+ // url already exists so try the next number up
+ return generateCustomMenuURL( entries, ++suffix );
+ }
+
+ return url;
+}
+
+sal_uInt32 SvxConfigPageHelper::generateRandomValue()
+{
+ return comphelper::rng::uniform_uint_distribution(0, std::numeric_limits<unsigned int>::max());
+}
+
+OUString SvxConfigPageHelper::generateCustomURL( SvxEntries* entries )
+{
+ OUString url = ITEM_TOOLBAR_URL;
+ url += CUSTOM_TOOLBAR_STR;
+
+ // use a random number to minimize possible clash with existing custom toolbars
+ url += OUString::number( generateRandomValue(), 16 );
+
+ // now check is there is an already existing entry with this url
+ SvxEntries::const_iterator iter = entries->begin();
+
+ while ( iter != entries->end() )
+ {
+ SvxConfigEntry* pEntry = *iter;
+
+ if ( url.equals( pEntry->GetCommand() ) )
+ {
+ break;
+ }
+ ++iter;
+ }
+
+ if ( iter != entries->end() )
+ {
+ // url already exists so try the next number up
+ return generateCustomURL( entries );
+ }
+
+ return url;
+}
+
+OUString SvxConfigPageHelper::GetModuleName( const OUString& aModuleId )
+{
+ if ( aModuleId == "com.sun.star.text.TextDocument" ||
+ aModuleId == "com.sun.star.text.GlobalDocument" )
+ return OUString("Writer");
+ else if ( aModuleId == "com.sun.star.text.WebDocument" )
+ return OUString("Writer/Web");
+ else if ( aModuleId == "com.sun.star.drawing.DrawingDocument" )
+ return OUString("Draw");
+ else if ( aModuleId == "com.sun.star.presentation.PresentationDocument" )
+ return OUString("Impress");
+ else if ( aModuleId == "com.sun.star.sheet.SpreadsheetDocument" )
+ return OUString("Calc");
+ else if ( aModuleId == "com.sun.star.script.BasicIDE" )
+ return OUString("Basic");
+ else if ( aModuleId == "com.sun.star.formula.FormulaProperties" )
+ return OUString("Math");
+ else if ( aModuleId == "com.sun.star.sdb.RelationDesign" )
+ return OUString("Relation Design");
+ else if ( aModuleId == "com.sun.star.sdb.QueryDesign" )
+ return OUString("Query Design");
+ else if ( aModuleId == "com.sun.star.sdb.TableDesign" )
+ return OUString("Table Design");
+ else if ( aModuleId == "com.sun.star.sdb.DataSourceBrowser" )
+ return OUString("Data Source Browser" );
+ else if ( aModuleId == "com.sun.star.sdb.DatabaseDocument" )
+ return OUString("Database" );
+
+ return OUString();
+}
+
+OUString SvxConfigPageHelper::GetUIModuleName(
+ const OUString& aModuleId,
+ const css::uno::Reference< css::frame::XModuleManager2 >& rModuleManager )
+{
+ assert(rModuleManager.is());
+
+ OUString aModuleUIName;
+
+ try
+ {
+ css::uno::Any a = rModuleManager->getByName( aModuleId );
+ css::uno::Sequence< css::beans::PropertyValue > aSeq;
+
+ if ( a >>= aSeq )
+ {
+ for ( sal_Int32 i = 0; i < aSeq.getLength(); ++i )
+ {
+ if ( aSeq[i].Name == "ooSetupFactoryUIName" )
+ {
+ aSeq[i].Value >>= aModuleUIName;
+ break;
+ }
+ }
+ }
+ }
+ catch ( css::uno::RuntimeException& )
+ {
+ throw;
+ }
+ catch ( css::uno::Exception& )
+ {
+ }
+
+ if ( aModuleUIName.isEmpty() )
+ aModuleUIName = GetModuleName( aModuleId );
+
+ return aModuleUIName;
+}
+
+bool SvxConfigPageHelper::GetMenuItemData(
+ const css::uno::Reference< css::container::XIndexAccess >& rItemContainer,
+ sal_Int32 nIndex,
+ OUString& rCommandURL,
+ OUString& rLabel,
+ sal_uInt16& rType,
+ css::uno::Reference< css::container::XIndexAccess >& rSubMenu )
+{
+ try
+ {
+ css::uno::Sequence< css::beans::PropertyValue > aProp;
+ if ( rItemContainer->getByIndex( nIndex ) >>= aProp )
+ {
+ for ( sal_Int32 i = 0; i < aProp.getLength(); ++i )
+ {
+ if ( aProp[i].Name == ITEM_DESCRIPTOR_COMMANDURL )
+ {
+ aProp[i].Value >>= rCommandURL;
+ }
+ else if ( aProp[i].Name == ITEM_DESCRIPTOR_CONTAINER )
+ {
+ aProp[i].Value >>= rSubMenu;
+ }
+ else if ( aProp[i].Name == ITEM_DESCRIPTOR_LABEL )
+ {
+ aProp[i].Value >>= rLabel;
+ }
+ else if ( aProp[i].Name == ITEM_DESCRIPTOR_TYPE )
+ {
+ aProp[i].Value >>= rType;
+ }
+ }
+
+ return true;
+ }
+ }
+ catch ( css::lang::IndexOutOfBoundsException& )
+ {
+ }
+
+ return false;
+}
+
+bool SvxConfigPageHelper::GetToolbarItemData(
+ const css::uno::Reference< css::container::XIndexAccess >& rItemContainer,
+ sal_Int32 nIndex,
+ OUString& rCommandURL,
+ OUString& rLabel,
+ sal_uInt16& rType,
+ bool& rIsVisible,
+ sal_Int32& rStyle )
+{
+ try
+ {
+ css::uno::Sequence< css::beans::PropertyValue > aProp;
+ if ( rItemContainer->getByIndex( nIndex ) >>= aProp )
+ {
+ for ( sal_Int32 i = 0; i < aProp.getLength(); ++i )
+ {
+ if ( aProp[i].Name == ITEM_DESCRIPTOR_COMMANDURL )
+ {
+ aProp[i].Value >>= rCommandURL;
+ }
+ else if ( aProp[i].Name == ITEM_DESCRIPTOR_STYLE )
+ {
+ aProp[i].Value >>= rStyle;
+ }
+ else if ( aProp[i].Name == ITEM_DESCRIPTOR_LABEL )
+ {
+ aProp[i].Value >>= rLabel;
+ }
+ else if ( aProp[i].Name == ITEM_DESCRIPTOR_TYPE )
+ {
+ aProp[i].Value >>= rType;
+ }
+ else if ( aProp[i].Name == ITEM_DESCRIPTOR_ISVISIBLE )
+ {
+ aProp[i].Value >>= rIsVisible;
+ }
+ }
+
+ return true;
+ }
+ }
+ catch ( css::lang::IndexOutOfBoundsException& )
+ {
+ }
+
+ return false;
+}
+
+css::uno::Sequence< css::beans::PropertyValue > SvxConfigPageHelper::ConvertSvxConfigEntry(
+ const SvxConfigEntry* pEntry )
+{
+ css::uno::Sequence< css::beans::PropertyValue > aPropSeq( 3 );
+
+ aPropSeq[0].Name = ITEM_DESCRIPTOR_COMMANDURL;
+ aPropSeq[0].Value <<= pEntry->GetCommand();
+
+ aPropSeq[1].Name = ITEM_DESCRIPTOR_TYPE;
+ aPropSeq[1].Value <<= css::ui::ItemType::DEFAULT;
+
+ // If the name has not been changed, then the label can be stored
+ // as an empty string.
+ // It will be initialised again later using the command to label map.
+ aPropSeq[2].Name = ITEM_DESCRIPTOR_LABEL;
+ if ( !pEntry->HasChangedName() && !pEntry->GetCommand().isEmpty() )
+ {
+ aPropSeq[2].Value <<= OUString();
+ }
+ else
+ {
+ aPropSeq[2].Value <<= pEntry->GetName();
+ }
+
+ return aPropSeq;
+}
+
+css::uno::Sequence< css::beans::PropertyValue > SvxConfigPageHelper::ConvertToolbarEntry(
+ const SvxConfigEntry* pEntry )
+{
+ css::uno::Sequence< css::beans::PropertyValue > aPropSeq( 4 );
+
+ aPropSeq[0].Name = ITEM_DESCRIPTOR_COMMANDURL;
+ aPropSeq[0].Value <<= pEntry->GetCommand();
+
+ aPropSeq[1].Name = ITEM_DESCRIPTOR_TYPE;
+ aPropSeq[1].Value <<= css::ui::ItemType::DEFAULT;
+
+ // If the name has not been changed, then the label can be stored
+ // as an empty string.
+ // It will be initialised again later using the command to label map.
+ aPropSeq[2].Name = ITEM_DESCRIPTOR_LABEL;
+ if ( !pEntry->HasChangedName() && !pEntry->GetCommand().isEmpty() )
+ {
+ aPropSeq[2].Value <<= OUString();
+ }
+ else
+ {
+ aPropSeq[2].Value <<= pEntry->GetName();
+ }
+
+ aPropSeq[3].Name = ITEM_DESCRIPTOR_ISVISIBLE;
+ aPropSeq[3].Value <<= pEntry->IsVisible();
+
+ return aPropSeq;
+}
+
+bool SvxConfigPageHelper::showKeyConfigTabPage(
+ const css::uno::Reference< css::frame::XFrame >& xFrame )
+{
+ if (!xFrame.is())
+ {
+ return false;
+ }
+ OUString sModuleId(
+ css::frame::ModuleManager::create(
+ comphelper::getProcessComponentContext())
+ ->identify(xFrame));
+ return !sModuleId.isEmpty()
+ && sModuleId != "com.sun.star.frame.StartModule";
+}
+
+bool SvxConfigPageHelper::EntrySort( SvxConfigEntry* a, SvxConfigEntry* b )
+{
+ return a->GetName().compareTo( b->GetName() ) < 0;
+}
+
+bool SvxConfigPageHelper::SvxConfigEntryModified( SvxConfigEntry* pEntry )
+{
+ SvxEntries* pEntries = pEntry->GetEntries();
+ if ( !pEntries )
+ return false;
+
+ for ( const auto& entry : *pEntries )
+ {
+ if ( entry->IsModified() || SvxConfigEntryModified( entry ) )
+ return true;
+ }
+ return false;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/customize/SvxMenuConfigPage.cxx b/cui/source/customize/SvxMenuConfigPage.cxx
index 26a16baee01c..ec4b2866fe86 100644
--- a/cui/source/customize/SvxMenuConfigPage.cxx
+++ b/cui/source/customize/SvxMenuConfigPage.cxx
@@ -59,6 +59,7 @@
#include "acccfg.hxx"
#include "cfg.hxx"
#include "SvxMenuConfigPage.hxx"
+#include "SvxConfigPageHelper.hxx"
#include "eventdlg.hxx"
#include <dialmgr.hxx>
@@ -252,7 +253,7 @@ void SvxMenuConfigPage::DeleteSelectedTopLevel()
SvxEntries* pParentEntries =
FindParentForChild( GetSaveInData()->GetEntries(), pMenuData );
- killmelater::RemoveEntry( pParentEntries, pMenuData );
+ SvxConfigPageHelper::RemoveEntry( pParentEntries, pMenuData );
delete pMenuData;
ReloadTopLevelListBox();
@@ -274,7 +275,7 @@ void SvxMenuConfigPage::DeleteSelectedContent()
SvxConfigEntry* pMenu = GetTopLevelSelection();
// remove menu entry from the list for this menu
- killmelater::RemoveEntry( pMenu->GetEntries(), pMenuEntry );
+ SvxConfigPageHelper::RemoveEntry( pMenu->GetEntries(), pMenuEntry );
// remove menu entry from UI
m_pContentsListBox->GetModel()->Remove( pActEntry );
@@ -300,7 +301,7 @@ short SvxMenuConfigPage::QueryReset()
OUString saveInName = m_pSaveInListBox->GetEntry(
m_pSaveInListBox->GetSelectEntryPos() );
- OUString label = killmelater::replaceSaveInName( msg, saveInName );
+ OUString label = SvxConfigPageHelper::replaceSaveInName( msg, saveInName );
ScopedVclPtrInstance<QueryBox> qbox( this, WB_YES_NO, label );
@@ -350,7 +351,7 @@ IMPL_LINK( SvxMenuConfigPage, MenuSelectHdl, MenuButton *, pButton, void )
{
SvxConfigEntry* pMenuData = GetTopLevelSelection();
- OUString aNewName( killmelater::stripHotKey( pMenuData->GetName() ) );
+ OUString aNewName( SvxConfigPageHelper::stripHotKey( pMenuData->GetName() ) );
OUString aDesc = CuiResId( RID_SVXSTR_LABEL_NEW_NAME );
VclPtrInstance< SvxNameDialog > pNameDialog( this, aNewName, aDesc );
@@ -394,7 +395,7 @@ IMPL_LINK( SvxMenuConfigPage, EntrySelectHdl, MenuButton *, pButton, void )
SvxConfigEntry* pEntry =
static_cast<SvxConfigEntry*>(pActEntry->GetUserData());
- OUString aNewName( killmelater::stripHotKey( pEntry->GetName() ) );
+ OUString aNewName( SvxConfigPageHelper::stripHotKey( pEntry->GetName() ) );
OUString aDesc = CuiResId( RID_SVXSTR_LABEL_NEW_NAME );
VclPtrInstance< SvxNameDialog > pNameDialog( this, aNewName, aDesc );
diff --git a/cui/source/customize/SvxToolbarConfigPage.cxx b/cui/source/customize/SvxToolbarConfigPage.cxx
index 272409d2825e..5df50650cd57 100644
--- a/cui/source/customize/SvxToolbarConfigPage.cxx
+++ b/cui/source/customize/SvxToolbarConfigPage.cxx
@@ -59,6 +59,7 @@
#include "acccfg.hxx"
#include "cfg.hxx"
#include "SvxToolbarConfigPage.hxx"
+#include "SvxConfigPageHelper.hxx"
#include "eventdlg.hxx"
#include <dialmgr.hxx>
@@ -281,7 +282,7 @@ void SvxToolbarConfigPage::DeleteSelectedContent()
SvxConfigEntry* pToolbar = GetTopLevelSelection();
// remove entry from the list for this toolbar
- killmelater::RemoveEntry( pToolbar->GetEntries(), pEntry );
+ SvxConfigPageHelper::RemoveEntry( pToolbar->GetEntries(), pEntry );
// remove toolbar entry from UI
m_pContentsListBox->GetModel()->Remove( pActEntry );
@@ -347,7 +348,7 @@ IMPL_LINK( SvxToolbarConfigPage, ToolbarSelectHdl, MenuButton *, pButton, void )
}
else if (sCommand == "modtoolrename")
{
- OUString aNewName( killmelater::stripHotKey( pToolbar->GetName() ) );
+ OUString aNewName( SvxConfigPageHelper::stripHotKey( pToolbar->GetName() ) );
OUString aDesc = CuiResId( RID_SVXSTR_LABEL_NEW_NAME );
VclPtrInstance< SvxNameDialog > pNameDialog( this, aNewName, aDesc );
@@ -386,7 +387,7 @@ IMPL_LINK( SvxToolbarConfigPage, EntrySelectHdl, MenuButton *, pButton, void )
SvxConfigEntry* pEntry =
static_cast<SvxConfigEntry*>(pActEntry->GetUserData());
- OUString aNewName( killmelater::stripHotKey( pEntry->GetName() ) );
+ OUString aNewName( SvxConfigPageHelper::stripHotKey( pEntry->GetName() ) );
OUString aDesc = CuiResId( RID_SVXSTR_LABEL_NEW_NAME );
VclPtrInstance< SvxNameDialog > pNameDialog( this, aNewName, aDesc );
@@ -433,7 +434,7 @@ IMPL_LINK( SvxToolbarConfigPage, EntrySelectHdl, MenuButton *, pButton, void )
{
pEntry->SetName( aSystemName );
m_pContentsListBox->SetEntryText(
- pActEntry, killmelater::stripHotKey( aSystemName ) );
+ pActEntry, SvxConfigPageHelper::stripHotKey( aSystemName ) );
bNeedsApply = true;
}
@@ -442,7 +443,7 @@ IMPL_LINK( SvxToolbarConfigPage, EntrySelectHdl, MenuButton *, pButton, void )
try
{
GetSaveInData()->GetImageManager()->removeImages(
- killmelater::GetImageType(), aURLSeq );
+ SvxConfigPageHelper::GetImageType(), aURLSeq );
// reset backup in entry
pEntry->SetBackupGraphic(
@@ -508,7 +509,7 @@ IMPL_LINK( SvxToolbarConfigPage, EntrySelectHdl, MenuButton *, pButton, void )
if ( !pEntry->GetBackupGraphic().is() )
{
css::uno::Reference< css::graphic::XGraphic > backup;
- backup = killmelater::GetGraphic(
+ backup = SvxConfigPageHelper::GetGraphic(
GetSaveInData()->GetImageManager(), aURLSeq[ 0 ] );
if ( backup.is() )
@@ -521,7 +522,7 @@ IMPL_LINK( SvxToolbarConfigPage, EntrySelectHdl, MenuButton *, pButton, void )
try
{
GetSaveInData()->GetImageManager()->replaceImages(
- killmelater::GetImageType(), aURLSeq, aGraphicSeq );
+ SvxConfigPageHelper::GetImageType(), aURLSeq, aGraphicSeq );
m_pContentsListBox->GetModel()->Remove( pActEntry );
SvTreeListEntry* pNewLBEntry =
@@ -574,7 +575,7 @@ IMPL_LINK( SvxToolbarConfigPage, EntrySelectHdl, MenuButton *, pButton, void )
try
{
GetSaveInData()->GetImageManager()->replaceImages(
- killmelater::GetImageType(), aURLSeq, aGraphicSeq );
+ SvxConfigPageHelper::GetImageType(), aURLSeq, aGraphicSeq );
m_pContentsListBox->GetModel()->Remove( pActEntry );
@@ -704,7 +705,7 @@ short SvxToolbarConfigPage::QueryReset()
OUString saveInName = m_pSaveInListBox->GetEntry(
m_pSaveInListBox->GetSelectEntryPos() );
- OUString label = killmelater::replaceSaveInName( msg, saveInName );
+ OUString label = SvxConfigPageHelper::replaceSaveInName( msg, saveInName );
ScopedVclPtrInstance< QueryBox > qbox( this, WB_YES_NO, label );
@@ -828,10 +829,10 @@ IMPL_LINK_NOARG( SvxToolbarConfigPage, NewToolbarHdl, Button *, void )
OUString prefix = CuiResId( RID_SVXSTR_NEW_TOOLBAR );
OUString aNewName =
- killmelater::generateCustomName( prefix, GetSaveInData()->GetEntries() );
+ SvxConfigPageHelper::generateCustomName( prefix, GetSaveInData()->GetEntries() );
OUString aNewURL =
- killmelater::generateCustomURL( GetSaveInData()->GetEntries() );
+ SvxConfigPageHelper::generateCustomURL( GetSaveInData()->GetEntries() );
VclPtrInstance< SvxNewToolbarDialog > pNameDialog( nullptr, aNewName );
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index 89d6db93a34e..675e6370907a 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -59,6 +59,7 @@
#include "cfg.hxx"
#include "SvxMenuConfigPage.hxx"
#include "SvxToolbarConfigPage.hxx"
+#include "SvxConfigPageHelper.hxx"
#include "eventdlg.hxx"
#include <dialmgr.hxx>
@@ -217,7 +218,7 @@ SvxConfigDialog::SvxConfigDialog(vcl::Window * pParent, const SfxItemSet* pInSet
, m_nToolbarsPageId(0)
, m_nEventsPageId(0)
{
- killmelater::InitImageType();
+ SvxConfigPageHelper::InitImageType();
m_nMenusPageId = AddTabPage("menus", CreateSvxMenuConfigPage, nullptr);
m_nContextMenusPageId = AddTabPage("contextmenus", CreateSvxContextMenuConfigPage, nullptr);
@@ -243,7 +244,7 @@ void SvxConfigDialog::SetFrame(const css::uno::Reference< css::frame::XFrame >&
{
m_xFrame = xFrame;
- if (!killmelater::showKeyConfigTabPage( xFrame ))
+ if (!SvxConfigPageHelper::showKeyConfigTabPage( xFrame ))
RemoveTabPage(m_nKeyboardPageId);
}
@@ -330,7 +331,7 @@ Image SaveInData::GetImage( const OUString& rCommandURL )
Image aImage;
uno::Reference< graphic::XGraphic > xGraphic =
- killmelater::GetGraphic( m_xImgMgr, rCommandURL );
+ SvxConfigPageHelper::GetGraphic( m_xImgMgr, rCommandURL );
if ( xGraphic.is() )
{
@@ -338,7 +339,7 @@ Image SaveInData::GetImage( const OUString& rCommandURL )
}
else if ( xDefaultImgMgr != nullptr && (*xDefaultImgMgr).is() )
{
- xGraphic = killmelater::GetGraphic( (*xDefaultImgMgr), rCommandURL );
+ xGraphic = SvxConfigPageHelper::GetGraphic( (*xDefaultImgMgr), rCommandURL );
if ( xGraphic.is() )
{
@@ -470,7 +471,7 @@ bool SaveInData::LoadSubMenus( const uno::Reference< container::XIndexAccess >&
sal_uInt16 nType( css::ui::ItemType::DEFAULT );
- bool bItem = killmelater::GetMenuItemData( xMenuSettings, nIndex,
+ bool bItem = SvxConfigPageHelper::GetMenuItemData( xMenuSettings, nIndex,
aCommandURL, aLabel, nType, xSubMenu );
if ( bItem )
@@ -548,7 +549,7 @@ bool SaveInData::LoadSubMenus( const uno::Reference< container::XIndexAccess >&
pEntry->SetMain();
}
- subMenuTitle += killmelater::stripHotKey( aLabel );
+ subMenuTitle += SvxConfigPageHelper::stripHotKey( aLabel );
LoadSubMenus( xSubMenu, subMenuTitle, pEntry, bContextMenu );
}
@@ -629,7 +630,7 @@ void MenuSaveInData::Apply(
SvxConfigEntry* pEntryData = *iter;
uno::Sequence< beans::PropertyValue > aPropValueSeq =
- killmelater::ConvertSvxConfigEntry( pEntryData );
+ SvxConfigPageHelper::ConvertSvxConfigEntry( pEntryData );
uno::Reference< container::XIndexContainer > xSubMenuBar(
rFactory->createInstanceWithContext( xContext ),
@@ -662,7 +663,7 @@ void SaveInData::ApplyMenu(
if ( pEntry->IsPopup() )
{
uno::Sequence< beans::PropertyValue > aPropValueSeq =
- killmelater::ConvertSvxConfigEntry( pEntry );
+ SvxConfigPageHelper::ConvertSvxConfigEntry( pEntry );
uno::Reference< container::XIndexContainer > xSubMenuBar(
rFactory->createInstanceWithContext( xContext ),
@@ -687,7 +688,7 @@ void SaveInData::ApplyMenu(
else
{
uno::Sequence< beans::PropertyValue > aPropValueSeq =
- killmelater::ConvertSvxConfigEntry( pEntry );
+ SvxConfigPageHelper::ConvertSvxConfigEntry( pEntry );
rMenuBar->insertByIndex(
rMenuBar->getCount(), uno::Any( aPropValueSeq ));
}
@@ -857,7 +858,7 @@ SvxEntries* ContextMenuSaveInData::GetEntries()
LoadSubMenus( xPopupMenu, aUIMenuName, pEntry, true );
}
}
- std::sort( m_pRootEntry->GetEntries()->begin(), m_pRootEntry->GetEntries()->end(), killmelater::EntrySort );
+ std::sort( m_pRootEntry->GetEntries()->begin(), m_pRootEntry->GetEntries()->end(), SvxConfigPageHelper::EntrySort );
}
return m_pRootEntry->GetEntries();
}
@@ -891,7 +892,7 @@ bool ContextMenuSaveInData::Apply()
SvxEntries* pEntries = GetEntries();
for ( const auto& pEntry : *pEntries )
{
- if ( pEntry->IsModified() || killmelater::SvxConfigEntryModified( pEntry ) )
+ if ( pEntry->IsModified() || SvxConfigPageHelper::SvxConfigEntryModified( pEntry ) )
{
css::uno::Reference< css::container::XIndexContainer > xIndexContainer( GetConfigManager()->createSettings(), css::uno::UNO_QUERY );
css::uno::Reference< css::lang::XSingleComponentFactory > xFactory( xIndexContainer, css::uno::UNO_QUERY );
@@ -1235,7 +1236,7 @@ void SvxConfigPage::Reset( const SfxItemSet* )
// replace %MODULENAME in the label with the correct module name
uno::Reference< css::frame::XModuleManager2 > xModuleManager(
css::frame::ModuleManager::create( xContext ));
- OUString aModuleName = killmelater::GetUIModuleName( aModuleId, xModuleManager );
+ OUString aModuleName = SvxConfigPageHelper::GetUIModuleName( aModuleId, xModuleManager );
OUString title = m_pTopLevel->get_label();
OUString aSearchString("%MODULENAME" );
@@ -1524,13 +1525,13 @@ void SvxConfigPage::ReloadTopLevelListBox( SvxConfigEntry* pToSelect )
for ( ; iter != end; ++iter )
{
SvxConfigEntry* pEntryData = *iter;
- const sal_Int32 nPos = m_pTopLevelListBox->InsertEntry( killmelater::stripHotKey( pEntryData->GetName() ) );
+ const sal_Int32 nPos = m_pTopLevelListBox->InsertEntry( SvxConfigPageHelper::stripHotKey( pEntryData->GetName() ) );
m_pTopLevelListBox->SetEntryData( nPos, pEntryData );
if ( pEntryData == pToSelect )
nSelectionPos = nPos;
- AddSubMenusToUI( killmelater::stripHotKey( pEntryData->GetName() ), pEntryData );
+ AddSubMenusToUI( SvxConfigPageHelper::stripHotKey( pEntryData->GetName() ), pEntryData );
}
}
#ifdef DBG_UTIL
@@ -1561,7 +1562,7 @@ void SvxConfigPage::AddSubMenusToUI(
if ( pEntryData->IsPopup() )
{
- OUString subMenuTitle = rBaseTitle + aMenuSeparatorStr + killmelater::stripHotKey( pEntryData->GetName() );
+ OUString subMenuTitle = rBaseTitle + aMenuSeparatorStr + SvxConfigPageHelper::stripHotKey( pEntryData->GetName() );
const sal_Int32 nPos = m_pTopLevelListBox->InsertEntry( subMenuTitle );
m_pTopLevelListBox->SetEntryData( nPos, pEntryData );
@@ -1724,7 +1725,7 @@ SvTreeListEntry* SvxConfigPage::InsertEntryIntoUI(
}
else
{
- OUString aName = killmelater::stripHotKey( pNewEntryData->GetName() );
+ OUString aName = SvxConfigPageHelper::stripHotKey( pNewEntryData->GetName() );
Image aImage = GetSaveInData()->GetImage(
pNewEntryData->GetCommand());
@@ -1819,7 +1820,7 @@ bool SvxConfigPage::MoveEntryData(
if ( pSourceData != nullptr && pTargetData != nullptr )
{
// remove the source entry from our list
- killmelater::RemoveEntry( pEntries, pSourceData );
+ SvxConfigPageHelper::RemoveEntry( pEntries, pSourceData );
SvxEntries::iterator iter = pEntries->begin();
SvxEntries::const_iterator end = pEntries->end();
@@ -1839,8 +1840,6 @@ bool SvxConfigPage::MoveEntryData(
return false;
}
-// SvxMenuConfigPage was here
-
SvxMainMenuOrganizerDialog::SvxMainMenuOrganizerDialog(
vcl::Window* pParent, SvxEntries* entries,
SvxConfigEntry* selection, bool bCreateMenu )
@@ -1865,7 +1864,7 @@ SvxMainMenuOrganizerDialog::SvxMainMenuOrganizerDialog(
{
SvxConfigEntry* pEntry = *iter;
SvTreeListEntry* pLBEntry =
- m_pMenuListBox->InsertEntry( killmelater::stripHotKey( pEntry->GetName() ) );
+ m_pMenuListBox->InsertEntry( SvxConfigPageHelper::stripHotKey( pEntry->GetName() ) );
pLBEntry->SetUserData( pEntry );
mpEntries->push_back( pEntry );
@@ -1882,8 +1881,8 @@ SvxMainMenuOrganizerDialog::SvxMainMenuOrganizerDialog(
// Generate custom name for new menu
OUString prefix = CuiResId( RID_SVXSTR_NEW_MENU );
- OUString newname = killmelater::generateCustomName( prefix, entries );
- OUString newurl = killmelater::generateCustomMenuURL( mpEntries );
+ OUString newname = SvxConfigPageHelper::generateCustomName( prefix, entries );
+ OUString newurl = SvxConfigPageHelper::generateCustomMenuURL( mpEntries );
SvxConfigEntry* pNewEntryData =
new SvxConfigEntry( newname, newurl, true );
@@ -1892,7 +1891,7 @@ SvxMainMenuOrganizerDialog::SvxMainMenuOrganizerDialog(
pNewEntryData->SetMain();
pNewMenuEntry =
- m_pMenuListBox->InsertEntry( killmelater::stripHotKey( pNewEntryData->GetName() ) );
+ m_pMenuListBox->InsertEntry( SvxConfigPageHelper::stripHotKey( pNewEntryData->GetName() ) );
m_pMenuListBox->Select( pNewMenuEntry );
pNewMenuEntry->SetUserData( pNewEntryData );
@@ -2471,7 +2470,7 @@ SvxEntries* ToolbarSaveInData::GetEntries()
}
}
- std::sort( GetEntries()->begin(), GetEntries()->end(), killmelater::EntrySort );
+ std::sort( GetEntries()->begin(), GetEntries()->end(), SvxConfigPageHelper::EntrySort );
}
return pRootEntry->GetEntries();
@@ -2577,7 +2576,7 @@ void ToolbarSaveInData::ApplyToolbar(
if ( pEntry->IsPopup() )
{
uno::Sequence< beans::PropertyValue > aPropValueSeq =
- killmelater::ConvertToolbarEntry( pEntry );
+ SvxConfigPageHelper::ConvertToolbarEntry( pEntry );
uno::Reference< container::XIndexContainer > xSubMenuBar(
rFactory->createInstanceWithContext( xContext ),
@@ -2600,7 +2599,7 @@ void ToolbarSaveInData::ApplyToolbar(
else
{
uno::Sequence< beans::PropertyValue > aPropValueSeq =
- killmelater::ConvertToolbarEntry( pEntry );
+ SvxConfigPageHelper::ConvertToolbarEntry( pEntry );
rToolbarBar->insertByIndex(
rToolbarBar->getCount(), uno::Any( aPropValueSeq ));
@@ -2708,7 +2707,7 @@ void ToolbarSaveInData::RemoveToolbar( SvxConfigEntry* pToolbar )
{
OUString url = pToolbar->GetCommand();
GetConfigManager()->removeSettings( url );
- killmelater::RemoveEntry( GetEntries(), pToolbar );
+ SvxConfigPageHelper::RemoveEntry( GetEntries(), pToolbar );
delete pToolbar;
PersistChanges( GetConfigManager() );
@@ -2774,7 +2773,7 @@ void ToolbarSaveInData::RestoreToolbar( SvxConfigEntry* pToolbar )
try
{
- GetImageManager()->removeImages( killmelater::GetImageType(), aURLSeq );
+ GetImageManager()->removeImages( SvxConfigPageHelper::GetImageType(), aURLSeq );
}
catch ( uno::Exception& )
{
@@ -2805,7 +2804,7 @@ void ToolbarSaveInData::LoadToolbar(
sal_uInt16 nType( css::ui::ItemType::DEFAULT );
- bool bItem = killmelater::GetToolbarItemData( xToolbarSettings, nIndex, aCommandURL,
+ bool bItem = SvxConfigPageHelper::GetToolbarItemData( xToolbarSettings, nIndex, aCommandURL,
aLabel, nType, bIsVisible, nStyle );
if ( bItem )
@@ -2921,14 +2920,14 @@ SvxIconSelectorDialog::SvxIconSelectorDialog( vcl::Window *pWindow,
pTbSymbol->SetPageScroll( true );
m_nExpectedSize = 16;
- if (killmelater::GetImageType() & css::ui::ImageType::SIZE_LARGE)
+ if (SvxConfigPageHelper::GetImageType() & css::ui::ImageType::SIZE_LARGE)
m_nExpectedSize = 26;
- else if (killmelater::GetImageType() & css::ui::ImageType::SIZE_32)
+ else if (SvxConfigPageHelper::GetImageType() & css::ui::ImageType::SIZE_32)
m_nExpectedSize = 32;
if ( m_nExpectedSize != 16 )
{
- pFtNote->SetText( killmelater::replaceSixteen( pFtNote->GetText(), m_nExpectedSize ) );
+ pFtNote->SetText( SvxConfigPageHelper::replaceSixteen( pFtNote->GetText(), m_nExpectedSize ) );
}
uno::Reference< uno::XComponentContext > xComponentContext =
@@ -2987,7 +2986,7 @@ SvxIconSelectorDialog::SvxIconSelectorDialog( vcl::Window *pWindow,
uno::Sequence< OUString > names;
if ( m_xImportedImageManager.is() )
{
- names = m_xImportedImageManager->getAllImageNames( killmelater::GetImageType() );
+ names = m_xImportedImageManager->getAllImageNames( SvxConfigPageHelper::GetImageType() );
for ( sal_Int32 n = 0; n < names.getLength(); ++n )
aImageInfo1.insert( ImageInfo::value_type( names[n], false ));
}
@@ -2997,7 +2996,7 @@ SvxIconSelectorDialog::SvxIconSelectorDialog( vcl::Window *pWindow,
while ( pConstIter != aImageInfo1.end() )
{
name[ 0 ] = pConstIter->first;
- uno::Sequence< uno::Reference< graphic::XGraphic> > graphics = m_xImportedImageManager->getImages( killmelater::GetImageType(), name );
+ uno::Sequence< uno::Reference< graphic::XGraphic> > graphics = m_xImportedImageManager->getImages( SvxConfigPageHelper::GetImageType(), name );
if ( graphics.getLength() > 0 )
{
Image img = Image( graphics[ 0 ] );
@@ -3017,12 +3016,12 @@ SvxIconSelectorDialog::SvxIconSelectorDialog( vcl::Window *pWindow,
if ( m_xParentImageManager.is() )
{
- names = m_xParentImageManager->getAllImageNames( killmelater::GetImageType() );
+ names = m_xParentImageManager->getAllImageNames( SvxConfigPageHelper::GetImageType() );
for ( sal_Int32 n = 0; n < names.getLength(); ++n )
aImageInfo.insert( ImageInfo::value_type( names[n], false ));
}
- names = m_xImageManager->getAllImageNames( killmelater::GetImageType() );
+ names = m_xImageManager->getAllImageNames( SvxConfigPageHelper::GetImageType() );
for ( sal_Int32 n = 0; n < names.getLength(); ++n )
{
ImageInfo::iterator pIter = aImageInfo.find( names[n] );
@@ -3042,9 +3041,9 @@ SvxIconSelectorDialog::SvxIconSelectorDialog( vcl::Window *pWindow,
try
{
if ( pConstIter->second )
- graphics = m_xImageManager->getImages( killmelater::GetImageType(), name );
+ graphics = m_xImageManager->getImages( SvxConfigPageHelper::GetImageType(), name );
else
- graphics = m_xParentImageManager->getImages( killmelater::GetImageType(), name );
+ graphics = m_xParentImageManager->getImages( SvxConfigPageHelper::GetImageType(), name );
}
catch ( uno::Exception& )
{
@@ -3148,7 +3147,7 @@ IMPL_LINK_NOARG( SvxIconSelectorDialog, SelectHdl, ToolBox *, void )
pTbSymbol->CheckItem( nId );
OUString aSelImageText = pTbSymbol->GetItemText( nId );
- if ( m_xImportedImageManager->hasImage( killmelater::GetImageType(), aSelImageText ) )
+ if ( m_xImportedImageManager->hasImage( SvxConfigPageHelper::GetImageType(), aSelImageText ) )
{
pBtnDelete->Enable();
}
@@ -3200,7 +3199,7 @@ IMPL_LINK_NOARG( SvxIconSelectorDialog, DeleteHdl, Button *, void )
OUString aSelImageText = pTbSymbol->GetItemText( nId );
uno::Sequence< OUString > URLs { aSelImageText };
pTbSymbol->RemoveItem( pTbSymbol->GetItemPos( nId ) );
- m_xImportedImageManager->removeImages( killmelater::GetImageType(), URLs );
+ m_xImportedImageManager->removeImages( SvxConfigPageHelper::GetImageType(), URLs );
uno::Reference< css::ui::XUIConfigurationPersistence >
xConfigPersistence( m_xImportedImageManager, uno::UNO_QUERY );
if ( xConfigPersistence.is() && xConfigPersistence->isModified() )
@@ -3273,7 +3272,7 @@ bool SvxIconSelectorDialog::ReplaceGraphicItem(
URLs[0] = aURL;
aImportGraph[ 0 ] = xGraphic;
- m_xImportedImageManager->replaceImages( killmelater::GetImageType(), URLs, aImportGraph );
+ m_xImportedImageManager->replaceImages( SvxConfigPageHelper::GetImageType(), URLs, aImportGraph );
xConfigPer->store();
bResult = true;
@@ -3303,7 +3302,7 @@ void SvxIconSelectorDialog::ImportGraphics(
if ( rPaths.getLength() == 1 )
{
- if ( m_xImportedImageManager->hasImage( killmelater::GetImageType(), rPaths[0] ) )
+ if ( m_xImportedImageManager->hasImage( SvxConfigPageHelper::GetImageType(), rPaths[0] ) )
{
aIndex = rPaths[0].lastIndexOf( '/' );
aIconName = rPaths[0].copy( aIndex+1 );
@@ -3331,7 +3330,7 @@ void SvxIconSelectorDialog::ImportGraphics(
for ( sal_Int32 i = 1; i < rPaths.getLength(); ++i )
{
OUString aPath = aSourcePath + rPaths[i];
- if ( m_xImportedImageManager->hasImage( killmelater::GetImageType(), aPath ) )
+ if ( m_xImportedImageManager->hasImage( SvxConfigPageHelper::GetImageType(), aPath ) )
{
aIndex = rPaths[i].lastIndexOf( '/' );
aIconName = rPaths[i].copy( aIndex+1 );
@@ -3437,7 +3436,7 @@ bool SvxIconSelectorDialog::ImportGraphic( const OUString& aURL )
uno::Sequence<OUString> aImportURL { aURL };
uno::Sequence< uno::Reference<graphic::XGraphic > > aImportGraph( 1 );
aImportGraph[ 0 ] = xGraphic;
- m_xImportedImageManager->insertImages( killmelater::GetImageType(), aImportURL, aImportGraph );
+ m_xImportedImageManager->insertImages( SvxConfigPageHelper::GetImageType(), aImportURL, aImportGraph );
uno::Reference< css::ui::XUIConfigurationPersistence >
xConfigPersistence( m_xImportedImageManager, uno::UNO_QUERY );
diff --git a/cui/source/inc/SvxConfigPageHelper.hxx b/cui/source/inc/SvxConfigPageHelper.hxx
new file mode 100644
index 000000000000..4b83b1c7dfd6
--- /dev/null
+++ b/cui/source/inc/SvxConfigPageHelper.hxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CUI_SOURCE_INC_SVXCONFIGPAGEHELPER_HXX
+#define INCLUDED_CUI_SOURCE_INC_SVXCONFIGPAGEHELPER_HXX
+
+#include <vector>
+
+#include "cfg.hxx"
+
+class SvxConfigPageHelper
+{
+public:
+ static void RemoveEntry( SvxEntries* pEntries, SvxConfigEntry* pChildEntry );
+
+ static OUString replaceSaveInName( const OUString& rMessage, const OUString& rSaveInName );
+ static OUString stripHotKey( const OUString& str );
+ static OUString replaceSixteen( const OUString& str, sal_Int32 nReplacement );
+
+ static sal_Int16 GetImageType();
+ static void InitImageType();
+ static css::uno::Reference< css::graphic::XGraphic > GetGraphic(
+ const css::uno::Reference< css::ui::XImageManager >& xImageManager,
+ const OUString& rCommandURL );
+
+ static OUString generateCustomName(
+ const OUString& prefix,
+ SvxEntries* entries,
+ sal_Int32 suffix = 1 );
+ static OUString generateCustomMenuURL(
+ SvxEntries* entries,
+ sal_Int32 suffix = 1 );
+ static sal_uInt32 generateRandomValue();
+ static OUString generateCustomURL( SvxEntries* entries );
+
+ static OUString GetModuleName( const OUString& aModuleId );
+ static OUString GetUIModuleName(
+ const OUString& aModuleId,
+ const css::uno::Reference< css::frame::XModuleManager2 >& rModuleManager );
+
+ static bool GetMenuItemData(
+ const css::uno::Reference< css::container::XIndexAccess >& rItemContainer,
+ sal_Int32 nIndex,
+ OUString& rCommandURL,
+ OUString& rLabel,
+ sal_uInt16& rType,
+ css::uno::Reference< css::container::XIndexAccess >& rSubMenu );
+ static bool GetToolbarItemData(
+ const css::uno::Reference< css::container::XIndexAccess >& rItemContainer,
+ sal_Int32 nIndex,
+ OUString& rCommandURL,
+ OUString& rLabel,
+ sal_uInt16& rType,
+ bool& rIsVisible,
+ sal_Int32& rStyle );
+
+ static css::uno::Sequence< css::beans::PropertyValue > ConvertSvxConfigEntry(
+ const SvxConfigEntry* pEntry );
+ static css::uno::Sequence< css::beans::PropertyValue > ConvertToolbarEntry(
+ const SvxConfigEntry* pEntry );
+
+ static bool showKeyConfigTabPage(
+ const css::uno::Reference< css::frame::XFrame >& xFrame );
+
+ static bool EntrySort( SvxConfigEntry* a, SvxConfigEntry* b );
+
+ static bool SvxConfigEntryModified( SvxConfigEntry* pEntry );
+
+};
+
+#endif // INCLUDED_CUI_SOURCE_INC_SVXCONFIGPAGEHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/cfg.hxx b/cui/source/inc/cfg.hxx
index 44e738f8a419..6b8950ee5146 100644
--- a/cui/source/inc/cfg.hxx
+++ b/cui/source/inc/cfg.hxx
@@ -676,508 +676,6 @@ public:
virtual void dispose() override;
};
-namespace killmelater
-{
-//TODO:This is copy/pasted from cfg.cxx
-inline void RemoveEntry( SvxEntries* pEntries, SvxConfigEntry* pChildEntry )
-{
- SvxEntries::iterator iter = pEntries->begin();
-
- while ( iter != pEntries->end() )
- {
- if ( pChildEntry == *iter )
- {
- pEntries->erase( iter );
- break;
- }
- ++iter;
- }
-}
-
-//TODO:This is copy/pasted from cfg.cxx
-inline OUString replaceSaveInName(
- const OUString& rMessage,
- const OUString& rSaveInName )
-{
- OUString name;
- OUString placeholder("%SAVE IN SELECTION%" );
-
- sal_Int32 pos = rMessage.indexOf( placeholder );
-
- if ( pos != -1 )
- {
- name = rMessage.replaceAt(
- pos, placeholder.getLength(), rSaveInName );
- }
-
- return name;
-}
-
-//TODO:This is copy/pasted from cfg.cxx
-inline OUString
-stripHotKey( const OUString& str )
-{
- sal_Int32 index = str.indexOf( '~' );
- if ( index == -1 )
- {
- return str;
- }
- else
- {
- return str.replaceAt( index, 1, OUString() );
- }
-}
-
-inline OUString
-replaceSixteen( const OUString& str, sal_Int32 nReplacement )
-{
- OUString result( str );
- OUString sixteen = OUString::number( 16 );
- OUString expected = OUString::number( nReplacement );
-
- sal_Int32 len = sixteen.getLength();
- sal_Int32 index = result.indexOf( sixteen );
-
- while ( index != -1 )
- {
- result = result.replaceAt( index, len, expected );
- index = result.indexOf( sixteen, index );
- }
-
- return result;
-}
-
-static sal_Int16 theImageType =
- css::ui::ImageType::COLOR_NORMAL |
- css::ui::ImageType::SIZE_DEFAULT;
-
-//TODO:This is copy/pasted from cfg.cxx
-inline sal_Int16 GetImageType()
-{
- return theImageType;
-}
-
-inline void InitImageType()
-{
- theImageType =
- css::ui::ImageType::COLOR_NORMAL |
- css::ui::ImageType::SIZE_DEFAULT;
-
- if (SvtMiscOptions().GetSymbolsSize() == SFX_SYMBOLS_SIZE_LARGE)
- {
- theImageType |= css::ui::ImageType::SIZE_LARGE;
- }
- else if (SvtMiscOptions().GetSymbolsSize() == SFX_SYMBOLS_SIZE_32)
- {
- theImageType |= css::ui::ImageType::SIZE_32;
- }
-}
-
-//TODO:This is copy/pasted from cfg.cxx
-inline css::uno::Reference< css::graphic::XGraphic > GetGraphic(
- const css::uno::Reference< css::ui::XImageManager >& xImageManager,
- const OUString& rCommandURL )
-{
- css::uno::Reference< css::graphic::XGraphic > result;
-
- if ( xImageManager.is() )
- {
- // TODO handle large graphics
- css::uno::Sequence< css::uno::Reference< css::graphic::XGraphic > > aGraphicSeq;
-
- css::uno::Sequence<OUString> aImageCmdSeq { rCommandURL };
-
- try
- {
- aGraphicSeq =
- xImageManager->getImages( killmelater::GetImageType(), aImageCmdSeq );
-
- if ( aGraphicSeq.getLength() > 0 )
- {
- result = aGraphicSeq[0];
- }
- }
- catch ( css::uno::Exception& )
- {
- // will return empty XGraphic
- }
- }
-
- return result;
-}
-
-//TODO:This is copy/pasted from cfg.cxx
-inline OUString
-generateCustomName(
- const OUString& prefix,
- SvxEntries* entries,
- sal_Int32 suffix = 1 )
-{
- // find and replace the %n placeholder in the prefix string
- OUString name;
- OUString placeholder("%n" );
-
- sal_Int32 pos = prefix.indexOf( placeholder );
-
- if ( pos != -1 )
- {
- name = prefix.replaceAt(
- pos, placeholder.getLength(), OUString::number( suffix ) );
- }
- else
- {
- // no placeholder found so just append the suffix
- name = prefix + OUString::number( suffix );
- }
-
- if (!entries)
- return name;
-
- // now check is there is an already existing entry with this name
- SvxEntries::const_iterator iter = entries->begin();
-
- while ( iter != entries->end() )
- {
- SvxConfigEntry* pEntry = *iter;
-
- if ( name.equals( pEntry->GetName() ) )
- {
- break;
- }
- ++iter;
- }
-
- if ( iter != entries->end() )
- {
- // name already exists so try the next number up
- return generateCustomName( prefix, entries, ++suffix );
- }
-
- return name;
-}
-
-inline OUString
-generateCustomMenuURL(
- SvxEntries* entries,
- sal_Int32 suffix = 1 )
-{
- OUString url = "vnd.openoffice.org:CustomMenu" + OUString::number( suffix );
- if (!entries)
- return url;
-
- // now check is there is an already existing entry with this url
- SvxEntries::const_iterator iter = entries->begin();
-
- while ( iter != entries->end() )
- {
- SvxConfigEntry* pEntry = *iter;
-
- if ( url.equals( pEntry->GetCommand() ) )
- {
- break;
- }
- ++iter;
- }
-
- if ( iter != entries->end() )
- {
- // url already exists so try the next number up
- return generateCustomMenuURL( entries, ++suffix );
- }
-
- return url;
-}
-
-inline sal_uInt32 generateRandomValue()
-{
- return comphelper::rng::uniform_uint_distribution(0, std::numeric_limits<unsigned int>::max());
-}
-
-inline OUString
-generateCustomURL(
- SvxEntries* entries )
-{
- OUString url = ITEM_TOOLBAR_URL;
- url += CUSTOM_TOOLBAR_STR;
-
- // use a random number to minimize possible clash with existing custom toolbars
- url += OUString::number( generateRandomValue(), 16 );
-
- // now check is there is an already existing entry with this url
- SvxEntries::const_iterator iter = entries->begin();
-
- while ( iter != entries->end() )
- {
- SvxConfigEntry* pEntry = *iter;
-
- if ( url.equals( pEntry->GetCommand() ) )
- {
- break;
- }
- ++iter;
- }
-
- if ( iter != entries->end() )
- {
- // url already exists so try the next number up
- return generateCustomURL( entries );
- }
-
- return url;
-}
-
-inline OUString GetModuleName( const OUString& aModuleId )
-{
- if ( aModuleId == "com.sun.star.text.TextDocument" ||
- aModuleId == "com.sun.star.text.GlobalDocument" )
- return OUString("Writer");
- else if ( aModuleId == "com.sun.star.text.WebDocument" )
- return OUString("Writer/Web");
- else if ( aModuleId == "com.sun.star.drawing.DrawingDocument" )
- return OUString("Draw");
- else if ( aModuleId == "com.sun.star.presentation.PresentationDocument" )
- return OUString("Impress");
- else if ( aModuleId == "com.sun.star.sheet.SpreadsheetDocument" )
- return OUString("Calc");
- else if ( aModuleId == "com.sun.star.script.BasicIDE" )
- return OUString("Basic");
- else if ( aModuleId == "com.sun.star.formula.FormulaProperties" )
- return OUString("Math");
- else if ( aModuleId == "com.sun.star.sdb.RelationDesign" )
- return OUString("Relation Design");
- else if ( aModuleId == "com.sun.star.sdb.QueryDesign" )
- return OUString("Query Design");
- else if ( aModuleId == "com.sun.star.sdb.TableDesign" )
- return OUString("Table Design");
- else if ( aModuleId == "com.sun.star.sdb.DataSourceBrowser" )
- return OUString("Data Source Browser" );
- else if ( aModuleId == "com.sun.star.sdb.DatabaseDocument" )
- return OUString("Database" );
-
- return OUString();
-}
-
-inline OUString GetUIModuleName( const OUString& aModuleId, const css::uno::Reference< css::frame::XModuleManager2 >& rModuleManager )
-{
- assert(rModuleManager.is());
-
- OUString aModuleUIName;
-
- try
- {
- css::uno::Any a = rModuleManager->getByName( aModuleId );
- css::uno::Sequence< css::beans::PropertyValue > aSeq;
-
- if ( a >>= aSeq )
- {
- for ( sal_Int32 i = 0; i < aSeq.getLength(); ++i )
- {
- if ( aSeq[i].Name == "ooSetupFactoryUIName" )
- {
- aSeq[i].Value >>= aModuleUIName;
- break;
- }
- }
- }
- }
- catch ( css::uno::RuntimeException& )
- {
- throw;
- }
- catch ( css::uno::Exception& )
- {
- }
-
- if ( aModuleUIName.isEmpty() )
- aModuleUIName = GetModuleName( aModuleId );
-
- return aModuleUIName;
-}
-
-inline bool GetMenuItemData(
- const css::uno::Reference< css::container::XIndexAccess >& rItemContainer,
- sal_Int32 nIndex,
- OUString& rCommandURL,
- OUString& rLabel,
- sal_uInt16& rType,
- css::uno::Reference< css::container::XIndexAccess >& rSubMenu )
-{
- try
- {
- css::uno::Sequence< css::beans::PropertyValue > aProp;
- if ( rItemContainer->getByIndex( nIndex ) >>= aProp )
- {
- for ( sal_Int32 i = 0; i < aProp.getLength(); ++i )
- {
- if ( aProp[i].Name == ITEM_DESCRIPTOR_COMMANDURL )
- {
- aProp[i].Value >>= rCommandURL;
- }
- else if ( aProp[i].Name == ITEM_DESCRIPTOR_CONTAINER )
- {
- aProp[i].Value >>= rSubMenu;
- }
- else if ( aProp[i].Name == ITEM_DESCRIPTOR_LABEL )
- {
- aProp[i].Value >>= rLabel;
- }
- else if ( aProp[i].Name == ITEM_DESCRIPTOR_TYPE )
- {
- aProp[i].Value >>= rType;
- }
- }
-
- return true;
- }
- }
- catch ( css::lang::IndexOutOfBoundsException& )
- {
- }
-
- return false;
-}
-
-inline bool GetToolbarItemData(
- const css::uno::Reference< css::container::XIndexAccess >& rItemContainer,
- sal_Int32 nIndex,
- OUString& rCommandURL,
- OUString& rLabel,
- sal_uInt16& rType,
- bool& rIsVisible,
- sal_Int32& rStyle )
-{
- try
- {
- css::uno::Sequence< css::beans::PropertyValue > aProp;
- if ( rItemContainer->getByIndex( nIndex ) >>= aProp )
- {
- for ( sal_Int32 i = 0; i < aProp.getLength(); ++i )
- {
- if ( aProp[i].Name == ITEM_DESCRIPTOR_COMMANDURL )
- {
- aProp[i].Value >>= rCommandURL;
- }
- else if ( aProp[i].Name == ITEM_DESCRIPTOR_STYLE )
- {
- aProp[i].Value >>= rStyle;
- }
- else if ( aProp[i].Name == ITEM_DESCRIPTOR_LABEL )
- {
- aProp[i].Value >>= rLabel;
- }
- else if ( aProp[i].Name == ITEM_DESCRIPTOR_TYPE )
- {
- aProp[i].Value >>= rType;
- }
- else if ( aProp[i].Name == ITEM_DESCRIPTOR_ISVISIBLE )
- {
- aProp[i].Value >>= rIsVisible;
- }
- }
-
- return true;
- }
- }
- catch ( css::lang::IndexOutOfBoundsException& )
- {
- }
-
- return false;
-}
-
-inline css::uno::Sequence< css::beans::PropertyValue >
-ConvertSvxConfigEntry( const SvxConfigEntry* pEntry )
-{
- css::uno::Sequence< css::beans::PropertyValue > aPropSeq( 3 );
-
- aPropSeq[0].Name = ITEM_DESCRIPTOR_COMMANDURL;
- aPropSeq[0].Value <<= pEntry->GetCommand();
-
- aPropSeq[1].Name = ITEM_DESCRIPTOR_TYPE;
- aPropSeq[1].Value <<= css::ui::ItemType::DEFAULT;
-
- // If the name has not been changed, then the label can be stored
- // as an empty string.
- // It will be initialised again later using the command to label map.
- aPropSeq[2].Name = ITEM_DESCRIPTOR_LABEL;
- if ( !pEntry->HasChangedName() && !pEntry->GetCommand().isEmpty() )
- {
- aPropSeq[2].Value <<= OUString();
- }
- else
- {
- aPropSeq[2].Value <<= pEntry->GetName();
- }
-
- return aPropSeq;
-}
-
-inline css::uno::Sequence< css::beans::PropertyValue >
-ConvertToolbarEntry( const SvxConfigEntry* pEntry )
-{
- css::uno::Sequence< css::beans::PropertyValue > aPropSeq( 4 );
-
- aPropSeq[0].Name = ITEM_DESCRIPTOR_COMMANDURL;
- aPropSeq[0].Value <<= pEntry->GetCommand();
-
- aPropSeq[1].Name = ITEM_DESCRIPTOR_TYPE;
- aPropSeq[1].Value <<= css::ui::ItemType::DEFAULT;
-
- // If the name has not been changed, then the label can be stored
- // as an empty string.
- // It will be initialised again later using the command to label map.
- aPropSeq[2].Name = ITEM_DESCRIPTOR_LABEL;
- if ( !pEntry->HasChangedName() && !pEntry->GetCommand().isEmpty() )
- {
- aPropSeq[2].Value <<= OUString();
- }
- else
- {
- aPropSeq[2].Value <<= pEntry->GetName();
- }
-
- aPropSeq[3].Name = ITEM_DESCRIPTOR_ISVISIBLE;
- aPropSeq[3].Value <<= pEntry->IsVisible();
-
- return aPropSeq;
-}
-
-//Was in anonymous namespace in cfg.cxx
-inline bool showKeyConfigTabPage( const css::uno::Reference< css::frame::XFrame >& xFrame )
-{
- if (!xFrame.is())
- {
- return false;
- }
- OUString sModuleId(
- css::frame::ModuleManager::create(
- comphelper::getProcessComponentContext())
- ->identify(xFrame));
- return !sModuleId.isEmpty()
- && sModuleId != "com.sun.star.frame.StartModule";
-}
-
-inline bool EntrySort( SvxConfigEntry* a, SvxConfigEntry* b )
-{
- return a->GetName().compareTo( b->GetName() ) < 0;
-}
-
-inline bool SvxConfigEntryModified( SvxConfigEntry* pEntry )
-{
- SvxEntries* pEntries = pEntry->GetEntries();
- if ( !pEntries )
- return false;
-
- for ( const auto& entry : *pEntries )
- {
- if ( entry->IsModified() || SvxConfigEntryModified( entry ) )
- return true;
- }
- return false;
-}
-
-}
-
#endif // INCLUDED_CUI_SOURCE_INC_CFG_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 5a883e94f372da0cb2340df5af8cf9b8bc54fc74
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date: Fri Jul 21 17:18:09 2017 +1000
osl: Windows pipe converted from OSL_ASSERT to assert/SAL_WARNs
Explanation for each conversion:
- osl_acceptPipe()
- don't worry about an invalid oslPipe sent as function parameter, we
check for the error returned by ConnectNamedPipe(), and without a
valid pipe we just need to return nullptr
- warn if INVALID_HANDLE_VALUE for the file handle, should be handled by
ConnectNamedPipe()
- createPipeImpl() allocates and initializes memory for the
oslPipeImpl structure, if it can't do this then something has been
done wrongly
- osl_receivePipe()
- invalid pipe needs to assert because ResetEvent needs valid
pPipe->m_ReadEvent
- osl_sendPipe()
- invalid pipe needs to assert because ResetEvent needs valid
pPipe->m_ReadEvent
- osl_writePipe()
- really just a thin wrapper around osl_sendPipe()
- osl_readPipe()
- really just a thin wrapper around osl_receivePipe()
Change-Id: I581f8aa996375a8691eafaa384d3f63f0c92b0a2
Reviewed-on: https://gerrit.libreoffice.org/40262
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Chris Sherlock <chris.sherlock79 at gmail.com>
diff --git a/sal/osl/w32/pipe.cxx b/sal/osl/w32/pipe.cxx
index 29bfcb77e756..218719322e27 100644
--- a/sal/osl/w32/pipe.cxx
+++ b/sal/osl/w32/pipe.cxx
@@ -17,8 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <string.h>
-
#include "system.h"
#include <osl/pipe.h>
@@ -28,9 +26,11 @@
#include <osl/conditn.h>
#include <osl/interlck.h>
#include <osl/process.h>
-
#include <rtl/alloc.h>
+#include <cassert>
+#include <string.h>
+
#define PIPESYSTEM "\\\\.\\pipe\\"
#define PIPEPREFIX "OSL_PIPE_"
@@ -288,8 +288,11 @@ oslPipe SAL_CALL osl_acceptPipe(oslPipe pPipe)
rtl_uString* path = nullptr;
rtl_uString* temp = nullptr;
- OSL_ASSERT(pPipe);
- OSL_ASSERT(pPipe->m_File != INVALID_HANDLE_VALUE);
+ SAL_WARN_IF(!pPipe, "sal.osl.pipe", "osl_acceptPipe: invalid pipe");
+ if (!pPipe)
+ return nullptr;
+
+ SAL_WARN_IF(pPipe->m_File == INVALID_HANDLE_VALUE, "sal.osl.pipe", "osl_acceptPipe: invalid handle");
memset(&os, 0, sizeof(OVERLAPPED));
os.hEvent = pPipe->m_AcceptEvent;
@@ -330,7 +333,7 @@ oslPipe SAL_CALL osl_acceptPipe(oslPipe pPipe)
}
pAcceptedPipe = osl_createPipeImpl();
- OSL_ASSERT(pAcceptedPipe);
+ assert(pAcceptedPipe); // should never be the case that an oslPipe cannot be initialized
osl_atomic_increment(&(pAcceptedPipe->m_Reference));
rtl_uString_assign(&pAcceptedPipe->m_Name, pPipe->m_Name);
@@ -361,7 +364,7 @@ sal_Int32 SAL_CALL osl_receivePipe(oslPipe pPipe,
DWORD nBytes;
OVERLAPPED os;
- OSL_ASSERT(pPipe);
+ assert(pPipe);
memset(&os, 0, sizeof(OVERLAPPED));
os.hEvent = pPipe->m_ReadEvent;
@@ -399,7 +402,7 @@ sal_Int32 SAL_CALL osl_sendPipe(oslPipe pPipe,
DWORD nBytes;
OVERLAPPED os;
- OSL_ASSERT(pPipe);
+ assert(pPipe);
memset(&os, 0, sizeof(OVERLAPPED));
os.hEvent = pPipe->m_WriteEvent;
@@ -426,7 +429,7 @@ sal_Int32 SAL_CALL osl_writePipe(oslPipe pPipe, const void *pBuffer , sal_Int32
sal_Int32 BytesSend = 0;
sal_Int32 BytesToSend = n;
- OSL_ASSERT(pPipe);
+ SAL_WARN_IF(!pPipe, "sal.osl.pipe", "osl_writePipe: invalid pipe");
while (BytesToSend > 0)
{
sal_Int32 RetVal;
@@ -451,7 +454,7 @@ sal_Int32 SAL_CALL osl_readPipe(oslPipe pPipe, void *pBuffer, sal_Int32 n)
sal_Int32 BytesRead = 0;
sal_Int32 BytesToRead = n;
- OSL_ASSERT(pPipe);
+ SAL_WARN_IF(!pPipe, "sal.osl.pipe", "osl_readPipe: invalid pipe");
while (BytesToRead > 0)
{
sal_Int32 RetVal;
commit e468d9d2e1ef1eda7449787cbb907e83aec0162a
Author: Heiko Tietze <tietze.heiko at googlemail.com>
Date: Sat Jul 22 19:04:45 2017 +0200
Revert because of wrong banner size
Change-Id: I1f827d373d52e89989e4e7f1e9d4333cba5dbb78
Reviewed-on: https://gerrit.libreoffice.org/40315
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Heiko Tietze <tietze.heiko at googlemail.com>
diff --git a/icon-themes/galaxy/brand/intro.png b/icon-themes/galaxy/brand/intro.png
index ad3984c19da4..13109a7211ce 100644
Binary files a/icon-themes/galaxy/brand/intro.png and b/icon-themes/galaxy/brand/intro.png differ
diff --git a/icon-themes/galaxy/brand_dev/intro.png b/icon-themes/galaxy/brand_dev/intro.png
index 3fe9656f41b1..6122eed5720a 100644
Binary files a/icon-themes/galaxy/brand_dev/intro.png and b/icon-themes/galaxy/brand_dev/intro.png differ
commit f175e360c60f6970e95907a1c46ff786d1f25594
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date: Sun Jul 23 03:45:34 2017 +1000
rtl: cleanup equality conditions in math.cxx
Change-Id: I13d898479d883f7905d834c82dc778a9e4078375
diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index 2db259b86917..338f40d1469f 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -46,23 +46,23 @@ static double const n10s[2][n10Count] = {
};
// return pow(10.0,nExp) optimized for exponents in the interval [-16,16]
-static double getN10Exp( int nExp )
+static double getN10Exp(int nExp)
{
- if ( nExp < 0 )
+ if (nExp < 0)
{
// && -nExp > 0 necessary for std::numeric_limits<int>::min()
// because -nExp = nExp
- if ( -nExp <= n10Count && -nExp > 0 )
+ if (-nExp <= n10Count && -nExp > 0)
return n10s[1][-nExp-1];
- return pow( 10.0, static_cast<double>( nExp ) );
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list