22#include <com/sun/star/io/TempFile.hpp>
23#include <com/sun/star/io/TextInputStream.hpp>
24#include <com/sun/star/io/TextOutputStream.hpp>
25#include <com/sun/star/io/XStream.hpp>
26#include <com/sun/star/io/XSeekable.hpp>
27#include <com/sun/star/embed/ElementModes.hpp>
28#include <com/sun/star/lang/NoSupportException.hpp>
29#include <com/sun/star/resource/MissingResourceException.hpp>
31#include <com/sun/star/beans/XPropertySet.hpp>
32#include <com/sun/star/container/ElementExistException.hpp>
33#include <com/sun/star/ucb/SimpleFileAccess.hpp>
35#include <osl/diagnose.h>
38#include <rtl/tencinfo.h>
39#include <rtl/ustrbuf.hxx>
59extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
61 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any>
const&)
69 , m_pCurrentLocaleItem( nullptr )
70 , m_pDefaultLocaleItem( nullptr )
71 , m_bDefaultModified( false )
72 , m_bModified( false )
74 , m_nNextUniqueNumericId( UNIQUE_NUMBER_NEEDS_INITIALISATION )
88 return "com.sun.star.comp.scripting.StringResource";
98 return {
"com.sun.star.resource.StringResource" };
106 if( !aListener.is() )
109 std::unique_lock aGuard(
m_aMutex );
115 if( !aListener.is() )
118 std::unique_lock aGuard(
m_aMutex );
126 (
const OUString& ResourceID,
LocaleItem* pLocaleItem )
129 bool bSuccess =
false;
130 if( pLocaleItem !=
nullptr &&
loadLocale( pLocaleItem ) )
132 IdToStringMap::iterator it = pLocaleItem->
m_aIdToStringMap.find( ResourceID );
135 aRetStr = (*it).second;
141 throw css::resource::MissingResourceException(
"StringResourceImpl: No entry for ResourceID: " + ResourceID );
148 std::unique_lock aGuard(
m_aMutex );
154 std::unique_lock aGuard(
m_aMutex );
161 bool bSuccess =
false;
162 if( pLocaleItem !=
nullptr &&
loadLocale( pLocaleItem ) )
164 IdToStringMap::iterator it = pLocaleItem->
m_aIdToStringMap.find( ResourceID );
173 std::unique_lock aGuard(
m_aMutex );
178 const Locale& locale )
180 std::unique_lock aGuard(
m_aMutex );
188 if( pLocaleItem &&
loadLocale( pLocaleItem ) )
191 sal_Int32 nResourceIDCount = rHashMap.size();
192 aIDSeq.realloc( nResourceIDCount );
193 OUString* pStrings = aIDSeq.getArray();
196 for(
const auto& rEntry : rHashMap )
198 OUString
aStr = rEntry.first;
199 pStrings[iTarget] =
aStr;
207 (
const Locale& locale )
209 std::unique_lock aGuard(
m_aMutex );
216 std::unique_lock aGuard(
m_aMutex );
222 std::unique_lock aGuard(
m_aMutex );
232 std::unique_lock aGuard(
m_aMutex );
242 std::unique_lock aGuard(
m_aMutex );
245 Sequence< Locale > aLocalSeq( nSize );
246 Locale* pLocales = aLocalSeq.getArray();
250 pLocales[iTarget] = pLocaleItem->m_locale;
263 OUString errorMsg = OUString::createFromAscii( pExceptionMsg );
264 throw NoSupportException( errorMsg );
274 bool FindClosestMatch,
bool bUseDefaultIfNoMatch )
277 if( FindClosestMatch )
282 if( pLocaleItem ==
nullptr && bUseDefaultIfNoMatch )
285 if( pLocaleItem !=
nullptr )
297 std::unique_lock aGuard(
m_aMutex );
303 std::unique_lock aGuard(
m_aMutex );
322 const OUString& Str,
LocaleItem* pLocaleItem )
324 if( !(pLocaleItem !=
nullptr &&
loadLocale( pLocaleItem )) )
329 IdToStringMap::iterator it = rHashMap.find( ResourceID );
330 bool bNew = ( it == rHashMap.end() );
337 rHashMap[ ResourceID ] = Str;
344 std::unique_lock aGuard(
m_aMutex );
350 (
const OUString& ResourceID,
const OUString& Str,
const Locale& locale )
352 std::unique_lock aGuard(
m_aMutex );
360 if( pLocaleItem !=
nullptr &&
loadLocale( pLocaleItem ) )
363 IdToStringMap::iterator it = rHashMap.find( ResourceID );
364 if( it == rHashMap.end() )
366 throw css::resource::MissingResourceException(
"StringResourceImpl: No entries for ResourceID: " + ResourceID );
368 rHashMap.erase( it );
376 std::unique_lock aGuard(
m_aMutex );
383 std::unique_lock aGuard(
m_aMutex );
391 std::unique_lock aGuard(
m_aMutex );
396 throw ElementExistException(
"StringResourceImpl: locale already exists" );
412 if( pCopyFromItem ==
nullptr )
414 if( pCopyFromItem !=
nullptr &&
loadLocale( pCopyFromItem ) )
418 for(
const auto& rEntry : rSourceMap )
420 OUString aId = rEntry.first;
421 OUString
aStr = rEntry.second;
422 rTargetMap[ aId ] =
aStr;
427 for(
const auto& rIndex : rSourceIndexMap )
429 OUString aId = rIndex.first;
430 sal_Int32
nIndex = rIndex.second;
431 rTargetIndexMap[ aId ] =
nIndex;
450 std::unique_lock aGuard(
m_aMutex );
459 if( nLocaleCount > 1 )
467 if( pLocaleItem.get() != pRemoveItem )
469 pFallbackItem = pLocaleItem.get();
484 [&pRemoveItem](
const std::unique_ptr<LocaleItem>& rxItem) { return rxItem.get() == pRemoveItem; });
492 if( nLocaleCount == 1 )
512 sal_Int32 nLen = ResourceID.getLength();
514 sal_Int32 nNumber = 0;
515 for( sal_Int32
i = 0 ;
i < nLen ;
i++ )
518 if( c >=
'0' && c <=
'9' )
520 sal_uInt16 nDigitVal = c -
'0';
521 nNumber = 10*nNumber + nDigitVal;
541 throw NoSupportException(
"getUniqueNumericId: Extended sal_Int32 range" );
550 (
const Locale& locale,
bool bException )
559 Locale& cmp_locale = pLocaleItem->m_locale;
560 if( cmp_locale.Language == locale.Language &&
561 cmp_locale.Country == locale.Country &&
562 cmp_locale.Variant == locale.Variant )
564 pRetItem = pLocaleItem.get();
570 if( pRetItem ==
nullptr && bException )
572 throw IllegalArgumentException(
"StringResourceImpl: Invalid locale", Reference< XInterface >(), 0 );
587 aLocales[
i] = (pLocaleItem ? pLocaleItem->m_locale :
Locale());
591 if (iFound != aLocales.end())
606 aEvent.Source = getXWeak();
608 [&
aEvent](
const css::uno::Reference<XModifyListener>& xListener)
610 xListener->modified(
aEvent);
649 return "com.sun.star.comp.scripting.StringResource";
671 ( std::unique_lock<std::mutex>& rGuard,
const Sequence< Any >& aArguments )
676 throw IllegalArgumentException(
"XInitialization::initialize: Expected ReadOnly flag", Reference< XInterface >(), 1 );
679 css::lang::Locale aCurrentLocale;
680 bool bLocaleOk = (
aArguments[2] >>= aCurrentLocale);
683 throw IllegalArgumentException(
"XInitialization::initialize: Expected Locale", Reference< XInterface >(), 2 );
689 throw IllegalArgumentException(
"XInitialization::initialize: Expected NameBase string", Reference< XInterface >(), 3 );
697 throw IllegalArgumentException(
"XInitialization::initialize: Expected Comment string", Reference< XInterface >(), 4 );
702 implSetCurrentLocale( rGuard, aCurrentLocale,
true,
true );
732 const Locale& locale )
771 (
const OUString& ResourceID,
const OUString& Str,
const Locale& locale )
776 (
const Locale& locale )
810 std::unique_lock aGuard(
m_aMutex );
821 const OUString& NameBase,
const OUString& Comment )
823 std::unique_lock aGuard(
m_aMutex );
830 const OUString& aNameBase,
831 const OUString& aComment,
832 const Reference< css::embed::XStorage >& Storage,
840 for(
auto& pLocaleItem : m_aDeletedLocaleItemVector )
848 Storage->removeElement( aStreamName );
856 m_aDeletedLocaleItemVector.clear();
859 for(
auto& pLocaleItem : m_aLocaleItemVector )
861 if( pLocaleItem !=
nullptr && (bStoreAll || pLocaleItem->m_bModified) &&
867 Storage->openStreamElement( aStreamName, ElementModes::READWRITE );
870 OSL_ENSURE( xProps.is(),
"The StorageStream must implement XPropertySet interface!" );
876 aPropName =
"UseCommonStoragePasswordEncryption";
881 if( xOutputStream.is() )
883 xOutputStream->closeOutput();
886 pLocaleItem->m_bModified =
false;
893 for(
auto& pLocaleItem : m_aChangedDefaultLocaleVector )
899 Storage->removeElement( aStreamName );
906 m_aChangedDefaultLocaleVector.clear();
910 if( !(m_pDefaultLocaleItem !=
nullptr && (bStoreAll || m_bDefaultModified)) )
916 Storage->openStreamElement( aStreamName, ElementModes::READWRITE );
920 xOutputStream->closeOutput();
923 m_bDefaultModified =
false;
927 const OUString& NameBase,
const OUString& Comment,
928 const Reference< css::task::XInteractionHandler >& Handler )
930 std::unique_lock aGuard(
m_aMutex );
932 Reference< ucb::XSimpleFileAccess3 > xFileAccess = ucb::SimpleFileAccess::create(
m_xContext);
933 if( xFileAccess.is() && Handler.is() )
934 xFileAccess->setInteractionHandler( Handler );
941 std::u16string_view Location,
942 const OUString& aNameBase,
943 const css::uno::Reference< css::ucb::XSimpleFileAccess3 >& xFileAccess
947 for(
auto& pLocaleItem : m_aDeletedLocaleItemVector )
951 OUString aCompleteFileName =
953 if( xFileAccess->exists( aCompleteFileName ) )
954 xFileAccess->kill( aCompleteFileName );
959 m_aDeletedLocaleItemVector.clear();
964 std::u16string_view Location,
965 const OUString& aNameBase,
966 const css::uno::Reference< css::ucb::XSimpleFileAccess3 >& xFileAccess
970 for(
auto& pLocaleItem : m_aChangedDefaultLocaleVector )
972 OUString aCompleteFileName =
974 if( xFileAccess->exists( aCompleteFileName ) )
975 xFileAccess->kill( aCompleteFileName );
978 m_aChangedDefaultLocaleVector.clear();
983 std::u16string_view Location,
984 const OUString& aNameBase,
985 const OUString& aComment,
986 const Reference< ucb::XSimpleFileAccess3 >& xFileAccess,
993 if( bUsedForStore || bKillAll )
996 for(
auto& pLocaleItem : m_aLocaleItemVector )
998 if( pLocaleItem !=
nullptr && (bStoreAll || bKillAll || pLocaleItem->m_bModified) &&
1001 OUString aCompleteFileName =
1003 if( xFileAccess->exists( aCompleteFileName ) )
1004 xFileAccess->kill( aCompleteFileName );
1010 if( xOutputStream.is() )
1013 xOutputStream->closeOutput();
1016 pLocaleItem->m_bModified =
false;
1022 if( bUsedForStore || bKillAll )
1026 if( !(m_pDefaultLocaleItem !=
nullptr && (bStoreAll || bKillAll || m_bDefaultModified)) )
1029 OUString aCompleteFileName =
1031 if( xFileAccess->exists( aCompleteFileName ) )
1032 xFileAccess->kill( aCompleteFileName );
1038 if( xOutputStream.is() )
1039 xOutputStream->closeOutput();
1042 m_bDefaultModified =
false;
1104 for( sal_Int16
i = 0 ;
i < 4 ;
i++ )
1114 sal_Int32 nLen =
aStr.getLength();
1117 for( sal_Int32
i = 0 ;
i < nLen ;
i++ )
1125 Sequence< ::sal_Int8 > aRetSeq;
1131 sal_Int32 nSize =
static_cast<sal_Int32
>(
m_xTempFile->getPosition());
1134 sal_Int32 nRead =
m_xTempFile->readBytes( aRetSeq, nSize );
1135 OSL_ENSURE( nRead == nSize,
"BinaryOutput::closeAndGetData: nRead != nSize" );
1172 sal_Int32 nLocaleCount = m_aLocaleItemVector.size();
1173 std::vector<Sequence< sal_Int8 >> aLocaleDataSeq(nLocaleCount);
1175 sal_Int32 iLocale = 0;
1176 sal_Int32 iDefault = 0;
1177 for(
auto& pLocaleItem : m_aLocaleItemVector )
1179 if( pLocaleItem !=
nullptr &&
loadLocale( pLocaleItem.get() ) )
1181 if( m_pDefaultLocaleItem == pLocaleItem.get() )
1193 sal_Int16 nLocaleCount16 =
static_cast<sal_Int16
>(nLocaleCount);
1194 sal_Int16 iDefault16 =
static_cast<sal_Int16
>(iDefault);
1200 sal_Int32 nDataPos = 6 + 4 * (nLocaleCount + 1);
1201 for( iLocale = 0; iLocale < nLocaleCount; iLocale++ )
1206 sal_Int32 nSeqLen = rSeq.getLength();
1207 nDataPos += nSeqLen;
1214 if( xOutputStream.is() )
1216 for( iLocale = 0; iLocale < nLocaleCount; iLocale++ )
1219 xOutputStream->writeBytes( rSeq );
1231 if( !xOutputStream.is() )
1255 BinaryInput(
const Sequence< ::sal_Int8 >& aData );
1259 void seek( sal_Int32 nPos );
1260 sal_Int32 getPosition()
const
1263 sal_Int16 readInt16();
1264 sal_Int32 readInt32();
1271BinaryInput::BinaryInput(
const Sequence< ::sal_Int8 >& aData )
1286 xTempOut->writeBytes( aSection );
1287 xTempOut->seek( 0 );
1291 OSL_FAIL(
"BinaryInput::getInputStreamForSection(): Read past end" );
1296void BinaryInput::seek( sal_Int32 nPos )
1301 OSL_FAIL(
"BinaryInput::seek(): Position past end" );
1305sal_Int16 BinaryInput::readInt16()
1314 OSL_FAIL(
"BinaryInput::readInt16(): Read past end" );
1319sal_Int32 BinaryInput::readInt32()
1324 sal_Int32 nFactor = 1;
1325 for( sal_Int16 i = 0;
i < 4;
i++ )
1332 OSL_FAIL(
"BinaryInput::readInt32(): Read past end" );
1339 sal_uInt16 nRet = 0;
1346 OSL_FAIL(
"BinaryInput::readUnicodeChar(): Read past end" );
1352OUString BinaryInput::readString()
1354 OUStringBuffer
aBuf;
1358 c = readUnicodeChar();
1364 OUString aRetStr =
aBuf.makeStringAndClear();
1368void StringResourcePersistenceImpl::importBinary(
const Sequence< ::sal_Int8 >& Data )
1371 sal_Int32 nOldLocaleCount = 0;
1374 Sequence< Locale > aLocaleSeq = getLocales();
1375 nOldLocaleCount = aLocaleSeq.getLength();
1376 if( nOldLocaleCount > 0 )
1378 Locale aLocale = aLocaleSeq[0];
1379 removeLocale( aLocale );
1382 while( nOldLocaleCount > 0 );
1385 BinaryInput aIn(
Data );
1388 sal_Int32 nLocaleCount = aIn.readInt16();
1389 sal_Int32 iDefault = aIn.readInt16();
1391 std::unique_ptr<sal_Int32[]> pPositions(
new sal_Int32[nLocaleCount + 1] );
1392 for( sal_Int32
i = 0;
i < nLocaleCount + 1;
i++ )
1393 pPositions[
i] = aIn.readInt32();
1397 for( sal_Int32
i = 0;
i < nLocaleCount;
i++ )
1399 sal_Int32
nPos = pPositions[
i];
1403 aLocale.Language = aIn.readString();
1404 aLocale.Country = aIn.readString();
1405 aLocale.Variant = aIn.readString();
1407 sal_Int32 nAfterStringPos = aIn.getPosition();
1408 sal_Int32 nSize = pPositions[
i+1] - nAfterStringPos;
1414 pUseAsDefaultItem = pLocaleItem;
1415 m_aLocaleItemVector.emplace_back( pLocaleItem );
1416 implReadPropertiesFile( pLocaleItem, xInput );
1420 if( pUseAsDefaultItem !=
nullptr )
1421 setDefaultLocale( pUseAsDefaultItem->
m_locale );
1430 bool bSuccess =
false;
1432 size_t nNameLen =
aName.size();
1433 size_t nNameBaseLen = aNameBase.size();
1438 aName[nNameBaseLen] ==
'_' )
1446 sal_Int32 iStart = nNameBaseLen + 1;
1447 size_t iNext_ =
aName.find(
'_', iStart );
1448 if( iNext_ != std::u16string_view::npos && iNext_ < nNameLen-1 )
1450 aLocale.Language =
aName.substr( iStart, iNext_ - iStart );
1452 iStart = iNext_ + 1;
1453 iNext_ =
aName.find(
'_', iStart );
1454 if( iNext_ != std::u16string_view::npos && iNext_ < nNameLen-1 )
1456 aLocale.Country =
aName.substr( iStart, iNext_ - iStart );
1457 aLocale.Variant =
aName.substr( iNext_ + 1 );
1460 aLocale.Country =
aName.substr( iStart );
1463 aLocale.Language =
aName.substr( iStart );
1468void StringResourcePersistenceImpl::implLoadAllLocales()
1470 for(
auto& pLocaleItem : m_aLocaleItemVector )
1472 loadLocale( pLocaleItem.get() );
1479 bool bDefaultFound =
false;
1481 for(
const OUString& aCompleteName : aContentSeq )
1484 OUString aExtension;
1485 sal_Int32 iDot = aCompleteName.lastIndexOf(
'.' );
1486 sal_Int32 iSlash = aCompleteName.lastIndexOf(
'/' );
1487 if( iDot != -1 && iDot > iSlash)
1489 sal_Int32 iCopyFrom = (iSlash != -1) ? iSlash + 1 : 0;
1490 aPureName = aCompleteName.copy( iCopyFrom, iDot-iCopyFrom );
1491 aExtension = aCompleteName.copy( iDot + 1 );
1494 if ( aExtension ==
"properties" )
1502 m_aLocaleItemVector.emplace_back( pLocaleItem );
1504 if( m_pCurrentLocaleItem ==
nullptr )
1505 m_pCurrentLocaleItem = pLocaleItem;
1507 if( m_pDefaultLocaleItem ==
nullptr )
1509 m_pDefaultLocaleItem = pLocaleItem;
1510 m_bDefaultModified =
true;
1514 else if( !bDefaultFound && aExtension ==
"default" )
1517 bDefaultFound =
true;
1522 LocaleItem* pLocaleItem = getItemForLocale( aDefaultLocale,
false );
1525 m_pDefaultLocaleItem = pLocaleItem;
1526 m_bDefaultModified =
false;
1532void StringResourcePersistenceImpl::implScanLocales()
1538bool StringResourcePersistenceImpl::loadLocale(
LocaleItem* pLocaleItem )
1540 bool bSuccess =
false;
1542 OSL_ENSURE( pLocaleItem,
"StringResourcePersistenceImpl::loadLocale(): pLocaleItem == NULL" );
1551 bSuccess = implLoadLocale( pLocaleItem );
1571 static const char aUnder[] =
"_";
1573 OSL_ENSURE( pLocaleItem,
1574 "StringResourcePersistenceImpl::implGetNameScemeForLocaleItem(): pLocaleItem == NULL" );
1577 OUString aRetStr = aUnder + aLocale.Language;
1579 OUString aCountry = aLocale.Country;
1580 if( !aCountry.isEmpty() )
1582 aRetStr += aUnder + aCountry;
1585 OUString aVariant = aLocale.Variant;
1586 if( !aVariant.isEmpty() )
1588 aRetStr += aUnder + aVariant;
1593OUString StringResourcePersistenceImpl::implGetFileNameForLocaleItem
1594 (
LocaleItem const * pLocaleItem,
const OUString& aNameBase )
1596 OUString aFileName = aNameBase;
1597 if( aFileName.isEmpty() )
1604OUString StringResourcePersistenceImpl::implGetPathForLocaleItem
1605 (
LocaleItem const * pLocaleItem,
const OUString& aNameBase,
1606 std::u16string_view aLocation,
bool bDefaultFile )
1608 OUString aFileName = implGetFileNameForLocaleItem( pLocaleItem, aNameBase );
1616 return aCompleteFileName;
1623 bool bWhite = ( c == 0x0020 ||
1644 if( c >=
'0' && c <=
'9' )
1645 nDigitVal = c -
'0';
1646 else if( c >=
'a' && c <=
'f' )
1647 nDigitVal = c -
'a' + 10;
1648 else if( c >=
'A' && c <=
'F' )
1649 nDigitVal = c -
'A' + 10;
1682 while(
i < nLen && pBuf[
i] ==
'u' )
1686 sal_Int32 nDigitCount = 0;
1687 sal_uInt16 nDigitVal;
1690 cRet = 16 * cRet + nDigitVal;
1693 if( nDigitCount == 4 )
1711 OUString& aLine,
bool& bEscapePending,
const sal_Unicode*& pBuf,
1712 sal_Int32& nLen, sal_Int32& i )
1714 if( !(
i == nLen && bEscapePending) )
1717 bEscapePending =
false;
1719 if( !xTextInputStream->isEOF() )
1721 aLine = xTextInputStream->readLine();
1722 nLen = aLine.getLength();
1723 pBuf = aLine.getStr();
1730bool StringResourcePersistenceImpl::implReadPropertiesFile
1733 if( !xInputStream.is() || pLocaleItem ==
nullptr )
1736 Reference< io::XTextInputStream2 > xTextInputStream = io::TextInputStream::create(
m_xContext );
1738 xTextInputStream->setInputStream( xInputStream );
1740 OUString aEncodingStr = OUString::createFromAscii
1741 ( rtl_getMimeCharsetFromTextEncoding( RTL_TEXTENCODING_ISO_8859_1 ) );
1742 xTextInputStream->setEncoding( aEncodingStr );
1745 while( !xTextInputStream->isEOF() )
1747 aLine = xTextInputStream->readLine();
1749 sal_Int32 nLen = aLine.getLength();
1753 OUStringBuffer
aBuf;
1763 if( c ==
'#' || c ==
'!' )
1767 OUString aResourceID;
1768 bool bEscapePending =
false;
1769 bool bStrComplete =
false;
1770 while(
i < nLen && !bStrComplete )
1773 if( bEscapePending )
1776 bEscapePending =
false;
1782 bEscapePending =
true;
1787 bStrComplete =
true;
1796 bStrComplete =
true;
1799 aResourceID =
aBuf.makeStringAndClear();
1803 if( aResourceID.isEmpty() )
1810 bEscapePending =
false;
1811 bStrComplete =
false;
1812 while(
i < nLen && !bStrComplete )
1815 if( c == 0x000a || c == 0x000d )
1821 if( bEscapePending )
1824 bEscapePending =
false;
1826 else if( c ==
'\\' )
1827 bEscapePending =
true;
1835 bStrComplete =
true;
1838 aValueStr =
aBuf.makeStringAndClear();
1843 implScanIdForNumber( aResourceID );
1845 rIndexMap[ aResourceID ] = pLocaleItem->
m_nNextIndex++;
1854 sal_Unicode cRet = ( nDigitVal < 10 ) ? (
'0' + nDigitVal) : (
'a' + (nDigitVal-10));
1862 aBuf.append(
'\\' );
1863 aBuf.append(
'\\' );
1865 else if( cu == 0x000a )
1867 aBuf.append(
'\\' );
1870 else if( cu == 0x000d )
1872 aBuf.append(
'\\' );
1875 else if( bKey && cu ==
'=' )
1877 aBuf.append(
'\\' );
1880 else if( bKey && cu ==
':' )
1882 aBuf.append(
'\\' );
1887 else if( cu >= 0x20 && cu <= 0x7e )
1898 aBuf.append(
'\\' );
1901 sal_uInt16 nVal = cu;
1902 for( sal_uInt16
i = 0 ;
i < 4 ;
i++ )
1904 sal_uInt16 nDigit = nVal / 0x1000;
1905 nVal -= nDigit * 0x1000;
1913 Reference< io::XTextOutputStream2 >
const & xTextOutputStream,
bool bKey )
1917 OUStringBuffer
aBuf;
1918 sal_Int32 nLen =
aStr.getLength();
1920 for( sal_Int32
i = 0 ;
i < nLen ;
i++ )
1927 aBuf.append( cLineFeed );
1929 OUString aWriteStr =
aBuf.makeStringAndClear();
1930 xTextOutputStream->writeString( aWriteStr );
1933bool StringResourcePersistenceImpl::implWritePropertiesFile(
LocaleItem const * pLocaleItem,
1936 if( !xOutputStream.is() || pLocaleItem ==
nullptr )
1939 bool bSuccess =
false;
1940 Reference< io::XTextOutputStream2 > xTextOutputStream = io::TextOutputStream::create(
m_xContext);
1942 xTextOutputStream->setOutputStream( xOutputStream );
1944 OUString aEncodingStr = OUString::createFromAscii
1945 ( rtl_getMimeCharsetFromTextEncoding( RTL_TEXTENCODING_ISO_8859_1 ) );
1946 xTextOutputStream->setEncoding( aEncodingStr );
1948 xTextOutputStream->writeString( aComment );
1949 xTextOutputStream->writeString(
"\n" );
1952 if( !rHashMap.empty() )
1958 auto itMinMax = std::minmax_element(rIndexMap.begin(), rIndexMap.end(),
1959 [](
const IdToIndexMap::value_type&
a,
const IdToIndexMap::value_type& b) { return a.second < b.second; });
1960 sal_Int32 nMinIndex = itMinMax.first->second;
1961 sal_Int32 nMaxIndex = itMinMax.second->second;
1962 sal_Int32
nTabSize = nMaxIndex - nMinIndex + 1;
1965 std::unique_ptr<const OUString*[]> pIdPtrs(
new const OUString*[
nTabSize] );
1967 pIdPtrs[
i] =
nullptr;
1968 for(
const auto& rIndex : rIndexMap )
1970 sal_Int32
nIndex = rIndex.second;
1971 pIdPtrs[
nIndex - nMinIndex] = &(rIndex.first);
1977 const OUString* pStr = pIdPtrs[
i];
1978 if( pStr !=
nullptr )
1980 OUString aResourceID = *pStr;
1981 IdToStringMap::const_iterator it = rHashMap.find( aResourceID );
1982 if( it != rHashMap.end() )
1985 xTextOutputStream->writeString(
"=" );
1986 OUString aValStr = (*it).second;
2001extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
2003 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any>
const&)
2009StringResourceWithStorageImpl::StringResourceWithStorageImpl(
const Reference< XComponentContext >& rxContext )
2011 , m_bStorageChanged( false )
2026 return "com.sun.star.comp.scripting.StringResourceWithStorage";
2036 return {
"com.sun.star.resource.StringResourceWithStorage" };
2045 std::unique_lock aGuard(
m_aMutex );
2050 "StringResourceWithStorageImpl::initialize: invalid number of arguments!" );
2059 throw IllegalArgumentException(
"StringResourceWithStorageImpl::initialize: invalid storage", Reference< XInterface >(), 0 );
2062 implInitializeCommonParameters( aGuard,
aArguments );
2092 const Locale& locale )
2101 (
const Locale& locale )
2136 (
const OUString& ResourceID,
const OUString& Str,
const Locale& locale )
2164 std::unique_lock aGuard(
m_aMutex );
2165 implCheckReadOnly(
"StringResourceWithStorageImpl::store(): Read only" );
2169 if( !m_bModified && !bStoreAll )
2172 implStoreAtStorage( m_aNameBase, m_aComment,
m_xStorage,
true, bStoreAll );
2173 m_bModified =
false;
2185 const OUString& NameBase,
const OUString& Comment )
2190 const OUString& NameBase,
const OUString& Comment,
2191 const Reference< css::task::XInteractionHandler >& Handler )
2215 std::unique_lock aGuard(
m_aMutex );
2219 throw IllegalArgumentException(
"StringResourceWithStorageImpl::setStorage: invalid storage", Reference< XInterface >(), 0 );
2222 implLoadAllLocales();
2238 implScanLocaleNames( aContentSeq );
2241 implLoadAllLocales();
2247 bool bSuccess =
false;
2250 OUString aStreamName = implGetFileNameForLocaleItem( pLocaleItem, m_aNameBase ) +
".properties";
2253 m_xStorage->openStreamElement( aStreamName, ElementModes::READ );
2255 if( xElementStream.is() )
2258 if( xInputStream.is() )
2261 xInputStream->closeInput();
2265 catch( uno::Exception& )
2275extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
2277 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any>
const&)
2286 , m_bLocationChanged( false )
2301 return "com.sun.star.comp.scripting.StringResourceWithLocation";
2311 return {
"com.sun.star.resource.StringResourceWithLocation" };
2320 std::unique_lock aGuard(
m_aMutex );
2325 "XInitialization::initialize: invalid number of arguments!" );
2330 if( bOk && nLen == 0 )
2342 throw IllegalArgumentException(
"XInitialization::initialize: invalid URL", Reference< XInterface >(), 0 );
2349 throw IllegalArgumentException(
"StringResourceWithStorageImpl::initialize: invalid type", Reference< XInterface >(), 5 );
2352 implInitializeCommonParameters( aGuard,
aArguments );
2382 const Locale& locale )
2391 (
const Locale& locale )
2426 (
const OUString& ResourceID,
const OUString& Str,
const Locale& locale )
2454 std::unique_lock aGuard(
m_aMutex );
2455 implCheckReadOnly(
"StringResourceWithLocationImpl::store(): Read only" );
2459 if( !m_bModified && !bStoreAll )
2463 implStoreAtLocation(
m_aLocation, m_aNameBase, m_aComment,
2464 xFileAccess,
true, bStoreAll );
2465 m_bModified =
false;
2477 const OUString& NameBase,
const OUString& Comment )
2482 const OUString& NameBase,
const OUString& Comment,
2483 const Reference< css::task::XInteractionHandler >& Handler )
2508 std::unique_lock aGuard(
m_aMutex );
2509 implCheckReadOnly(
"StringResourceWithLocationImpl::setURL(): Read only" );
2511 sal_Int32 nLen =
URL.getLength();
2514 throw IllegalArgumentException(
"StringResourceWithLocationImpl::setURL: invalid URL", Reference< XInterface >(), 0 );
2517 implLoadAllLocales();
2520 implStoreAtLocation(
m_aLocation, m_aNameBase, m_aComment,
2535 if( xFileAccess.is() && xFileAccess->isFolder(
m_aLocation ) )
2538 implScanLocaleNames( aContentSeq );
2545 bool bSuccess =
false;
2548 if( xFileAccess.is() )
2550 OUString aCompleteFileName =
2551 implGetPathForLocaleItem( pLocaleItem, m_aNameBase,
m_aLocation );
2556 xInputStream = xFileAccess->openFileRead( aCompleteFileName );
2560 if( xInputStream.is() )
2563 xInputStream->closeInput();
Reference< XComponentContext > m_xContext
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
bool insertName(std::u16string_view rTheName, bool bAppendFinalSlash=false, sal_Int32 nIndex=LAST_SEGMENT, EncodeMechanism eMechanism=EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
bool setExtension(std::u16string_view rTheExtension, sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
::std::vector< css::lang::Locale >::const_iterator getMatchingFallback(const ::std::vector< css::lang::Locale > &rList, const css::lang::Locale &rReference)
void forEach(std::unique_lock< std::mutex > &rGuard, FuncT const &func) const
sal_Int32 addInterface(std::unique_lock< std::mutex > &rGuard, const css::uno::Reference< ListenerT > &rxIFace)
sal_Int32 removeInterface(std::unique_lock< std::mutex > &rGuard, const css::uno::Reference< ListenerT > &rxIFace)
Reference< io::XOutputStream > m_xOutputStream
Sequence< ::sal_Int8 > closeAndGetData()
rtl::Reference< utl::TempFileFastService > m_xTempFile
void writeInt16(sal_Int16 n)
void writeInt32(sal_Int32 n)
const Reference< io::XOutputStream > & getOutputStream() const
void writeString(const OUString &aStr)
void writeUnicodeChar(sal_Unicode n)
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual void SAL_CALL removeLocale(const css::lang::Locale &locale) override
sal_Int32 m_nNextUniqueNumericId
void implRemoveId(std::unique_lock< std::mutex > &rGuard, const OUString &ResourceID, LocaleItem *pLocaleItem)
virtual bool loadLocale(LocaleItem *pLocaleItem)
StringResourceImpl(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
void implCheckReadOnly(const char *pExceptionMsg)
virtual void SAL_CALL addModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
css::uno::Sequence< OUString > implGetResourceIDs(LocaleItem *pLocaleItem)
virtual void SAL_CALL newLocale(const css::lang::Locale &locale) override
std::vector< std::unique_ptr< LocaleItem > > m_aChangedDefaultLocaleVector
LocaleItem * getClosestMatchItemForLocale(const css::lang::Locale &locale)
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
LocaleItem * m_pCurrentLocaleItem
virtual css::lang::Locale SAL_CALL getCurrentLocale() override
void implScanIdForNumber(const OUString &ResourceID)
void implSetCurrentLocale(std::unique_lock< std::mutex > &rGuard, const css::lang::Locale &locale, bool FindClosestMatch, bool bUseDefaultIfNoMatch)
virtual void SAL_CALL setString(const OUString &ResourceID, const OUString &Str) override
void implModified(std::unique_lock< std::mutex > &)
virtual void implLoadAllLocales()
void implNotifyListeners(std::unique_lock< std::mutex > &)
virtual sal_Bool SAL_CALL hasEntryForId(const OUString &ResourceID) override
LocaleItem * m_pDefaultLocaleItem
bool implHasEntryForId(const OUString &ResourceID, LocaleItem *pLocaleItem)
virtual ::sal_Int32 SAL_CALL getUniqueNumericId() override
std::vector< std::unique_ptr< LocaleItem > > m_aDeletedLocaleItemVector
virtual sal_Bool SAL_CALL isReadOnly() override
void implSetString(std::unique_lock< std::mutex > &rGuard, const OUString &ResourceID, const OUString &Str, LocaleItem *pLocaleItem)
std::vector< std::unique_ptr< LocaleItem > > m_aLocaleItemVector
virtual css::uno::Sequence< css::lang::Locale > SAL_CALL getLocales() override
virtual css::lang::Locale SAL_CALL getDefaultLocale() override
virtual void SAL_CALL removeModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
OUString implResolveString(const OUString &ResourceID, LocaleItem *pLocaleItem)
static const sal_Int32 UNIQUE_NUMBER_NEEDS_INITIALISATION
LocaleItem * getItemForLocale(const css::lang::Locale &locale, bool bException)
virtual void SAL_CALL setDefaultLocale(const css::lang::Locale &locale) override
virtual css::uno::Sequence< OUString > SAL_CALL getResourceIDs() override
virtual ~StringResourceImpl() override
virtual sal_Bool SAL_CALL hasEntryForIdAndLocale(const OUString &ResourceID, const css::lang::Locale &locale) override
::comphelper::OInterfaceContainerHelper4< css::util::XModifyListener > m_aListenerContainer
virtual OUString SAL_CALL resolveString(const OUString &ResourceID) override
virtual void SAL_CALL setStringForLocale(const OUString &ResourceID, const OUString &Str, const css::lang::Locale &locale) override
virtual void SAL_CALL setCurrentLocale(const css::lang::Locale &locale, sal_Bool FindClosestMatch) override
virtual OUString SAL_CALL resolveStringForLocale(const OUString &ResourceID, const css::lang::Locale &locale) override
virtual void SAL_CALL removeId(const OUString &ResourceID) override
virtual css::uno::Sequence< OUString > SAL_CALL getResourceIDsForLocale(const css::lang::Locale &locale) override
virtual OUString SAL_CALL getImplementationName() override
virtual void SAL_CALL removeIdForLocale(const OUString &ResourceID, const css::lang::Locale &locale) override
virtual css::uno::Sequence< OUString > SAL_CALL getResourceIDs() override
virtual css::uno::Sequence< OUString > SAL_CALL getResourceIDsForLocale(const css::lang::Locale &locale) override
void implKillRemovedLocaleFiles(std::u16string_view Location, const OUString &aNameBase, const css::uno::Reference< css::ucb::XSimpleFileAccess3 > &xFileAccess)
void implKillChangedDefaultFiles(std::u16string_view Location, const OUString &aNameBase, const css::uno::Reference< css::ucb::XSimpleFileAccess3 > &xFileAccess)
virtual void SAL_CALL storeToURL(const OUString &URL, const OUString &NameBase, const OUString &Comment, const css::uno::Reference< css::task::XInteractionHandler > &Handler) override
virtual void SAL_CALL store() override
virtual css::uno::Sequence< css::lang::Locale > SAL_CALL getLocales() override
void implStoreAtStorage(const OUString &aNameBase, const OUString &aComment, const css::uno::Reference< css::embed::XStorage > &Storage, bool bUsedForStore, bool bStoreAll)
virtual css::uno::Sequence< ::sal_Int8 > SAL_CALL exportBinary() override
virtual ::sal_Int32 SAL_CALL getUniqueNumericId() override
virtual OUString SAL_CALL resolveStringForLocale(const OUString &ResourceID, const css::lang::Locale &locale) override
virtual void SAL_CALL setDefaultLocale(const css::lang::Locale &locale) override
virtual void SAL_CALL setCurrentLocale(const css::lang::Locale &locale, sal_Bool FindClosestMatch) override
virtual void SAL_CALL storeToStorage(const css::uno::Reference< css::embed::XStorage > &Storage, const OUString &NameBase, const OUString &Comment) override
virtual ~StringResourcePersistenceImpl() override
virtual bool loadLocale(LocaleItem *pLocaleItem) override
virtual css::lang::Locale SAL_CALL getCurrentLocale() override
void implStoreAtLocation(std::u16string_view Location, const OUString &aNameBase, const OUString &aComment, const css::uno::Reference< css::ucb::XSimpleFileAccess3 > &xFileAccess, bool bUsedForStore, bool bStoreAll, bool bKillAll=false)
virtual sal_Bool SAL_CALL isModified() override
static OUString implGetFileNameForLocaleItem(LocaleItem const *pLocaleItem, const OUString &aNameBase)
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
void implInitializeCommonParameters(std::unique_lock< std::mutex > &rGuard, const css::uno::Sequence< css::uno::Any > &aArguments)
virtual void SAL_CALL setString(const OUString &ResourceID, const OUString &Str) override
virtual OUString SAL_CALL getImplementationName() override
virtual sal_Bool SAL_CALL hasEntryForIdAndLocale(const OUString &ResourceID, const css::lang::Locale &locale) override
virtual void SAL_CALL removeIdForLocale(const OUString &ResourceID, const css::lang::Locale &locale) override
virtual void SAL_CALL removeLocale(const css::lang::Locale &locale) override
virtual void SAL_CALL removeId(const OUString &ResourceID) override
virtual OUString SAL_CALL resolveString(const OUString &ResourceID) override
bool implWritePropertiesFile(LocaleItem const *pLocaleItem, const css::uno::Reference< css::io::XOutputStream > &xOutputStream, const OUString &aComment)
void implWriteLocaleBinary(LocaleItem *pLocaleItem, BinaryOutput &rOut)
virtual void SAL_CALL removeModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
virtual css::lang::Locale SAL_CALL getDefaultLocale() override
virtual void SAL_CALL newLocale(const css::lang::Locale &locale) override
virtual void SAL_CALL setComment(const OUString &Comment) override
static OUString implGetPathForLocaleItem(LocaleItem const *pLocaleItem, const OUString &aNameBase, std::u16string_view aLocation, bool bDefaultFile=false)
bool implReadPropertiesFile(LocaleItem *pLocaleItem, const css::uno::Reference< css::io::XInputStream > &xInput)
virtual sal_Bool SAL_CALL isReadOnly() override
virtual void SAL_CALL setStringForLocale(const OUString &ResourceID, const OUString &Str, const css::lang::Locale &locale) override
virtual void SAL_CALL addModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
virtual sal_Bool SAL_CALL hasEntryForId(const OUString &ResourceID) override
virtual void implScanLocales()
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual void SAL_CALL importBinary(const css::uno::Sequence< ::sal_Int8 > &Data) override
StringResourcePersistenceImpl(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
virtual void SAL_CALL setComment(const OUString &Comment) override
css::uno::Reference< css::task::XInteractionHandler > m_xInteractionHandler
virtual sal_Bool SAL_CALL hasEntryForIdAndLocale(const OUString &ResourceID, const css::lang::Locale &locale) override
virtual void SAL_CALL setCurrentLocale(const css::lang::Locale &locale, sal_Bool FindClosestMatch) override
virtual bool implLoadLocale(LocaleItem *pLocaleItem) override
virtual void SAL_CALL setStringForLocale(const OUString &ResourceID, const OUString &Str, const css::lang::Locale &locale) override
virtual void implScanLocales() override
virtual sal_Bool SAL_CALL hasEntryForId(const OUString &ResourceID) override
virtual void SAL_CALL removeModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
virtual void SAL_CALL removeLocale(const css::lang::Locale &locale) override
virtual OUString SAL_CALL getImplementationName() override
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
virtual void SAL_CALL removeId(const OUString &ResourceID) override
virtual void SAL_CALL setString(const OUString &ResourceID, const OUString &Str) override
virtual css::uno::Sequence< css::lang::Locale > SAL_CALL getLocales() override
virtual void SAL_CALL addModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
const css::uno::Reference< css::ucb::XSimpleFileAccess3 > & getFileAccessImpl()
virtual css::uno::Sequence< OUString > SAL_CALL getResourceIDs() override
virtual void SAL_CALL storeToStorage(const css::uno::Reference< css::embed::XStorage > &Storage, const OUString &NameBase, const OUString &Comment) override
virtual css::lang::Locale SAL_CALL getDefaultLocale() override
virtual OUString SAL_CALL resolveStringForLocale(const OUString &ResourceID, const css::lang::Locale &locale) override
virtual css::uno::Sequence< ::sal_Int8 > SAL_CALL exportBinary() override
virtual void SAL_CALL importBinary(const css::uno::Sequence< ::sal_Int8 > &Data) override
css::uno::Reference< css::ucb::XSimpleFileAccess3 > m_xSFI
virtual css::uno::Sequence< OUString > SAL_CALL getResourceIDsForLocale(const css::lang::Locale &locale) override
virtual css::lang::Locale SAL_CALL getCurrentLocale() override
virtual ~StringResourceWithLocationImpl() override
virtual void SAL_CALL storeToURL(const OUString &URL, const OUString &NameBase, const OUString &Comment, const css::uno::Reference< css::task::XInteractionHandler > &Handler) override
virtual void SAL_CALL store() override
virtual ::sal_Int32 SAL_CALL getUniqueNumericId() override
virtual OUString SAL_CALL resolveString(const OUString &ResourceID) override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual void SAL_CALL setURL(const OUString &URL) override
virtual void SAL_CALL newLocale(const css::lang::Locale &locale) override
virtual void SAL_CALL storeAsURL(const OUString &URL) override
virtual sal_Bool SAL_CALL isModified() override
virtual void SAL_CALL removeIdForLocale(const OUString &ResourceID, const css::lang::Locale &locale) override
StringResourceWithLocationImpl(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
virtual sal_Bool SAL_CALL isReadOnly() override
virtual void SAL_CALL setDefaultLocale(const css::lang::Locale &locale) override
virtual void SAL_CALL removeModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
virtual void SAL_CALL setStorage(const css::uno::Reference< css::embed::XStorage > &Storage) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual sal_Bool SAL_CALL hasEntryForId(const OUString &ResourceID) override
virtual void SAL_CALL removeIdForLocale(const OUString &ResourceID, const css::lang::Locale &locale) override
virtual void SAL_CALL setString(const OUString &ResourceID, const OUString &Str) override
virtual bool implLoadLocale(LocaleItem *pLocaleItem) override
virtual css::uno::Sequence< OUString > SAL_CALL getResourceIDs() override
virtual sal_Bool SAL_CALL isModified() override
virtual OUString SAL_CALL resolveStringForLocale(const OUString &ResourceID, const css::lang::Locale &locale) override
virtual void SAL_CALL removeLocale(const css::lang::Locale &locale) override
virtual css::uno::Sequence< ::sal_Int8 > SAL_CALL exportBinary() override
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Sequence< css::lang::Locale > SAL_CALL getLocales() override
virtual void SAL_CALL setDefaultLocale(const css::lang::Locale &locale) override
virtual sal_Bool SAL_CALL hasEntryForIdAndLocale(const OUString &ResourceID, const css::lang::Locale &locale) override
virtual void implScanLocales() override
virtual ~StringResourceWithStorageImpl() override
virtual ::sal_Int32 SAL_CALL getUniqueNumericId() override
virtual void SAL_CALL storeAsStorage(const css::uno::Reference< css::embed::XStorage > &Storage) override
virtual void SAL_CALL setStringForLocale(const OUString &ResourceID, const OUString &Str, const css::lang::Locale &locale) override
virtual css::uno::Sequence< OUString > SAL_CALL getResourceIDsForLocale(const css::lang::Locale &locale) override
virtual void SAL_CALL addModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
virtual OUString SAL_CALL resolveString(const OUString &ResourceID) override
virtual sal_Bool SAL_CALL isReadOnly() override
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
css::uno::Reference< css::embed::XStorage > m_xStorage
virtual void SAL_CALL setCurrentLocale(const css::lang::Locale &locale, sal_Bool FindClosestMatch) override
virtual void SAL_CALL removeId(const OUString &ResourceID) override
virtual void SAL_CALL storeToURL(const OUString &URL, const OUString &NameBase, const OUString &Comment, const css::uno::Reference< css::task::XInteractionHandler > &Handler) override
virtual void SAL_CALL store() override
virtual void SAL_CALL newLocale(const css::lang::Locale &locale) override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual void SAL_CALL storeToStorage(const css::uno::Reference< css::embed::XStorage > &Storage, const OUString &NameBase, const OUString &Comment) override
virtual css::lang::Locale SAL_CALL getCurrentLocale() override
virtual css::lang::Locale SAL_CALL getDefaultLocale() override
virtual void SAL_CALL importBinary(const css::uno::Sequence< ::sal_Int8 > &Data) override
virtual void SAL_CALL setComment(const OUString &Comment) override
Sequence< PropertyValue > aArguments
Sequence< sal_Int8 > aSeq
constexpr OUStringLiteral aData
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
constexpr bool starts_with(std::basic_string_view< charT, traits > sv, std::basic_string_view< charT, traits > x) noexcept
static sal_Unicode getEscapeChar(const sal_Unicode *pBuf, sal_Int32 nLen, sal_Int32 &ri)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * scripting_StringResourcePersistenceImpl_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * scripting_StringResourceWithStorageImpl_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
static bool checkNamingSceme(std::u16string_view aName, std::u16string_view aNameBase, Locale &aLocale)
static OUString implGetNameScemeForLocaleItem(const LocaleItem *pLocaleItem)
static void implWriteCharToBuffer(OUStringBuffer &aBuf, sal_Unicode cu, bool bKey)
::cppu::ImplInheritanceHelper< StringResourceImpl, css::resource::XStringResourcePersistence > StringResourcePersistenceImpl_BASE
static sal_Unicode getHexCharForDigit(sal_uInt16 nDigitVal)
static void skipWhites(const sal_Unicode *pBuf, sal_Int32 nLen, sal_Int32 &ri)
std::unordered_map< OUString, sal_Int32 > IdToIndexMap
::cppu::ImplInheritanceHelper< StringResourcePersistenceImpl, css::lang::XInitialization, css::resource::XStringResourceWithLocation > StringResourceWithLocationImpl_BASE
constexpr OUStringLiteral aNameBaseDefaultStr
static void implWriteStringWithEncoding(const OUString &aStr, Reference< io::XTextOutputStream2 > const &xTextOutputStream, bool bKey)
std::unordered_map< OUString, OUString > IdToStringMap
static bool isWhiteSpace(sal_Unicode c)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * scripting_StringResourceWithLocationImpl_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
static void CheckContinueInNextLine(const Reference< io::XTextInputStream2 > &xTextInputStream, OUString &aLine, bool &bEscapePending, const sal_Unicode *&pBuf, sal_Int32 &nLen, sal_Int32 &i)
::cppu::ImplInheritanceHelper< StringResourcePersistenceImpl, css::lang::XInitialization, css::resource::XStringResourceWithStorage > StringResourceWithStorageImpl_BASE
static bool isHexDigit(sal_Unicode c, sal_uInt16 &nDigitVal)
sal_uInt32 readString(const sal_uInt8 *buffer, sal_Unicode *v, sal_uInt32 maxSize)
Sequence< sal_Int8 > m_aData
IdToIndexMap m_aIdToIndexMap
css::lang::Locale m_locale
IdToStringMap m_aIdToStringMap