diff options
-rw-r--r-- | include/tools/string.hxx | 2 | ||||
-rw-r--r-- | sw/source/ui/dbui/dbinsdlg.cxx | 60 | ||||
-rw-r--r-- | tools/source/string/strascii.cxx | 57 |
3 files changed, 19 insertions, 100 deletions
diff --git a/include/tools/string.hxx b/include/tools/string.hxx index 33f65223b2d9..e1854803bc5c 100644 --- a/include/tools/string.hxx +++ b/include/tools/string.hxx @@ -221,8 +221,6 @@ public: UniString& Insert( sal_Unicode c, xub_StrLen nIndex = STRING_LEN ); UniString& InsertAscii( const sal_Char* pAsciiStr, xub_StrLen nIndex = STRING_LEN ); UniString& Replace( xub_StrLen nIndex, xub_StrLen nLen, const UniString& rStr ); - UniString& ReplaceAscii( xub_StrLen nIndex, xub_StrLen nLen, - const sal_Char* pAsciiStr, xub_StrLen nStrLen = STRING_LEN ); UniString& Erase( xub_StrLen nIndex = 0, xub_StrLen nCount = STRING_LEN ); UniString Copy( xub_StrLen nIndex = 0, xub_StrLen nCount = STRING_LEN ) const; diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index d43b1328331a..3ba2fbdfb750 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -1468,56 +1468,34 @@ void SwInsertDBColAutoPilot::SetTabSet() _DB_ColumnConfigData::~_DB_ColumnConfigData() {} -static Sequence<OUString> lcl_createSourceNames(const String& rNodeName) +static Sequence<OUString> lcl_createSourceNames(const OUString& rNodeName) { Sequence<OUString> aSourceNames(11); OUString* pNames = aSourceNames.getArray(); - - String sTmp( rNodeName ); - const xub_StrLen nPos = sTmp.Len(); - pNames[0] = sTmp.ReplaceAscii( nPos, STRING_MAXLEN, - RTL_CONSTASCII_STRINGPARAM( "/DataSource" )); - pNames[1] = sTmp.ReplaceAscii( nPos, STRING_MAXLEN, - RTL_CONSTASCII_STRINGPARAM( "/Command" )); - pNames[2] = sTmp.ReplaceAscii( nPos, STRING_MAXLEN, - RTL_CONSTASCII_STRINGPARAM( "/CommandType" )); - pNames[3] = sTmp.ReplaceAscii( nPos, STRING_MAXLEN, - RTL_CONSTASCII_STRINGPARAM( "/ColumnsToText" )); - pNames[4] = sTmp.ReplaceAscii( nPos, STRING_MAXLEN, - RTL_CONSTASCII_STRINGPARAM( "/ColumnsToTable" )); - pNames[5] = sTmp.ReplaceAscii( nPos, STRING_MAXLEN, - RTL_CONSTASCII_STRINGPARAM( "/ParaStyle" )); - pNames[6] = sTmp.ReplaceAscii( nPos, STRING_MAXLEN, - RTL_CONSTASCII_STRINGPARAM( "/TableAutoFormat" )); - pNames[7] = sTmp.ReplaceAscii( nPos, STRING_MAXLEN, - RTL_CONSTASCII_STRINGPARAM( "/IsTable" )); - pNames[8] = sTmp.ReplaceAscii( nPos, STRING_MAXLEN, - RTL_CONSTASCII_STRINGPARAM( "/IsField" )); - pNames[9] = sTmp.ReplaceAscii( nPos, STRING_MAXLEN, - RTL_CONSTASCII_STRINGPARAM( "/IsHeadlineOn" )); - pNames[10] = sTmp.ReplaceAscii( nPos, STRING_MAXLEN, - RTL_CONSTASCII_STRINGPARAM( "/IsEmptyHeadline" )); + pNames[0] = rNodeName + "/DataSource"; + pNames[1] = rNodeName + "/Command"; + pNames[2] = rNodeName + "/CommandType"; + pNames[3] = rNodeName + "/ColumnsToText"; + pNames[4] = rNodeName + "/ColumnsToTable"; + pNames[5] = rNodeName + "/ParaStyle"; + pNames[6] = rNodeName + "/TableAutoFormat"; + pNames[7] = rNodeName + "/IsTable"; + pNames[8] = rNodeName + "/IsField"; + pNames[9] = rNodeName + "/IsHeadlineOn"; + pNames[10] = rNodeName + "/IsEmptyHeadline"; return aSourceNames; } -static Sequence<OUString> lcl_CreateSubNames( const String& rSubNodeName ) +static Sequence<OUString> lcl_CreateSubNames(const OUString& rSubNodeName) { Sequence<OUString> aSubSourceNames(6); OUString* pNames = aSubSourceNames.getArray(); - String sTmp( rSubNodeName ); - const xub_StrLen nPos = sTmp.Len(); - pNames[0] = sTmp.ReplaceAscii( nPos, STRING_MAXLEN, - RTL_CONSTASCII_STRINGPARAM( "/ColumnName" )); - pNames[1] = sTmp.ReplaceAscii( nPos, STRING_MAXLEN, - RTL_CONSTASCII_STRINGPARAM( "/ColumnIndex" )); - pNames[2] = sTmp.ReplaceAscii( nPos, STRING_MAXLEN, - RTL_CONSTASCII_STRINGPARAM( "/IsNumberFormat" )); - pNames[3] = sTmp.ReplaceAscii( nPos, STRING_MAXLEN, - RTL_CONSTASCII_STRINGPARAM( "/IsNumberFormatFromDataBase" )); - pNames[4] = sTmp.ReplaceAscii( nPos, STRING_MAXLEN, - RTL_CONSTASCII_STRINGPARAM( "/NumberFormat" )); - pNames[5] = sTmp.ReplaceAscii( nPos, STRING_MAXLEN, - RTL_CONSTASCII_STRINGPARAM( "/NumberFormatLocale" )); + pNames[0] = rSubNodeName + "/ColumnName"; + pNames[1] = rSubNodeName + "/ColumnIndex"; + pNames[2] = rSubNodeName + "/IsNumberFormat"; + pNames[3] = rSubNodeName + "/IsNumberFormatFromDataBase"; + pNames[4] = rSubNodeName + "/NumberFormat"; + pNames[5] = rSubNodeName + "/NumberFormatLocale"; return aSubSourceNames; } diff --git a/tools/source/string/strascii.cxx b/tools/source/string/strascii.cxx index fe435427d8fc..7cae272cf7a6 100644 --- a/tools/source/string/strascii.cxx +++ b/tools/source/string/strascii.cxx @@ -329,63 +329,6 @@ UniString& UniString::InsertAscii( const char* pAsciiStr, xub_StrLen nIndex ) return *this; } -UniString& UniString::ReplaceAscii( xub_StrLen nIndex, xub_StrLen nCount, - const sal_Char* pAsciiStr, xub_StrLen nStrLen ) -{ - DBG_CHKTHIS( UniString, DbgCheckUniString ); - DBG_ASSERT( pAsciiStr, "UniString::ReplaceAscii() - pAsciiStr is NULL" ); - - // Use append if index >= length - if ( nIndex >= mpData->mnLen ) - { - AppendAscii( pAsciiStr, nStrLen ); - return *this; - } - - // Use assign if index = 0 and count >= length - if ( (nIndex == 0) && (nCount >= mpData->mnLen) ) - { - AssignAscii( pAsciiStr, nStrLen ); - return *this; - } - - // Use erase if length is equal - if ( nStrLen == STRING_LEN ) - nStrLen = ImplStringLen( pAsciiStr ); - if ( !nStrLen ) - return Erase( nIndex, nCount ); - - // nCount must not exceed string length - if ( nCount > mpData->mnLen - nIndex ) - nCount = static_cast< xub_StrLen >(mpData->mnLen-nIndex); - - // Use assign if length matches - if ( nCount == nStrLen ) - { - ImplCopyData(); - ImplCopyAsciiStr( mpData->maStr+nIndex, pAsciiStr, nStrLen ); - return *this; - } - - // detect overflow - sal_Int32 n = ImplGetCopyLen( mpData->mnLen-nCount, nStrLen ); - - // allocate new string - STRINGDATA* pNewData = ImplAllocData( mpData->mnLen-nCount+n ); - - // copy string data - memcpy( pNewData->maStr, mpData->maStr, nIndex*sizeof( STRCODE ) ); - ImplCopyAsciiStr( pNewData->maStr+nIndex, pAsciiStr, n ); - memcpy( pNewData->maStr+nIndex+n, mpData->maStr+nIndex+nCount, - (mpData->mnLen-nIndex-nCount+1)*sizeof( STRCODE ) ); - - // release old string - STRING_RELEASE((STRING_TYPE *)mpData); - mpData = pNewData; - - return *this; -} - StringCompare UniString::CompareToAscii( const sal_Char* pAsciiStr, xub_StrLen nLen ) const { |