Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/4262
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/62/4262/1
String=>OUString svtools trasnfer*
Change-Id: Iefa6688b91a05e248a6073c4f7216111fa4f7410
---
M cui/source/dialogs/hltpbase.cxx
M framework/source/classes/droptargetlistener.cxx
M include/svtools/transfer.hxx
M sc/source/ui/view/viewfun5.cxx
M sd/source/ui/dlg/sdtreelb.cxx
M sd/source/ui/view/sdview3.cxx
M svtools/source/misc/stringtransfer.cxx
M svtools/source/misc/transfer.cxx
M svtools/source/misc/transfer2.cxx
M svx/source/fmcomp/dbaexchange.cxx
M svx/source/gallery2/galtheme.cxx
M sw/source/ui/dochdl/swdtflvr.cxx
M sw/source/ui/inc/swdtflvr.hxx
M sw/source/ui/utlui/content.cxx
M sw/source/ui/utlui/navipi.cxx
15 files changed, 66 insertions(+), 93 deletions(-)
diff --git a/cui/source/dialogs/hltpbase.cxx b/cui/source/dialogs/hltpbase.cxx
index 273d89e..9688a18 100644
--- a/cui/source/dialogs/hltpbase.cxx
+++ b/cui/source/dialogs/hltpbase.cxx
@@ -88,7 +88,7 @@
sal_Int8 SvxHyperURLBox::ExecuteDrop( const ExecuteDropEvent& rEvt )
{
TransferableDataHelper aDataHelper( rEvt.maDropEvent.Transferable );
- String aString;
+ OUString aString;
sal_Int8 nRet = DND_ACTION_NONE;
if( aDataHelper.GetString( FORMAT_STRING, aString ) )
diff --git a/framework/source/classes/droptargetlistener.cxx
b/framework/source/classes/droptargetlistener.cxx
index 1b00c54..37c076b 100644
--- a/framework/source/classes/droptargetlistener.cxx
+++ b/framework/source/classes/droptargetlistener.cxx
@@ -92,7 +92,7 @@
}
// then, if necessary, the file format
- String aFilePath;
+ OUString aFilePath;
if ( !bFormatFound && aHelper.GetString( SOT_FORMAT_FILE, aFilePath ) )
implts_OpenFile( aFilePath );
}
diff --git a/include/svtools/transfer.hxx b/include/svtools/transfer.hxx
index 5d63d16..2f177f9 100644
--- a/include/svtools/transfer.hxx
+++ b/include/svtools/transfer.hxx
@@ -315,9 +315,6 @@
::com::sun::star::uno::Any GetAny( SotFormatStringId nFormat ) const;
::com::sun::star::uno::Any GetAny( const ::com::sun::star::datatransfer::DataFlavor& rFlavor
) const;
- sal_Bool GetString( SotFormatStringId nFormat, String& rStr );
- sal_Bool GetString( const ::com::sun::star::datatransfer::DataFlavor&
rFlavor, String& rStr );
-
sal_Bool GetString( SotFormatStringId nFormat, OUString& rStr );
sal_Bool GetString( const ::com::sun::star::datatransfer::DataFlavor&
rFlavor, OUString& rStr );
@@ -500,8 +497,8 @@
void CopyINetImage( const INetImage& rINtImg );
void CopyImageMap( const ImageMap& rImgMap );
void CopyGraphic( const Graphic& rGrf );
- void CopyString( const String& rStr );
- void CopyString( sal_uInt16 nFmt, const String& rStr );
+ void CopyString( const OUString& rStr );
+ void CopyString( sal_uInt16 nFmt, const OUString& rStr );
void CopyAny( sal_uInt16 nFmt, const ::com::sun::star::uno::Any& rAny );
void CopyByteString( sal_uLong nFormatId, const OString& rStr );
diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx
index 1611c7f..907e25a 100644
--- a/sc/source/ui/view/viewfun5.cxx
+++ b/sc/source/ui/view/viewfun5.cxx
@@ -583,7 +583,7 @@
}
else if ( nFormatId == SOT_FORMAT_FILE )
{
- String aFile;
+ OUString aFile;
if ( aDataHelper.GetString( nFormatId, aFile ) )
bRet = PasteFile( aPos, aFile, bLink );
}
@@ -638,21 +638,21 @@
sal_uInt16 nRows = 1;
if ( aDataHelper.HasFormat( SOT_FORMAT_STRING ) )
{
- String aDataStr;
+ OUString aDataStr;
if ( aDataHelper.GetString( SOT_FORMAT_STRING, aDataStr ) )
{
// get size from string the same way as in ScDdeLink::DataChanged
aDataStr = convertLineEnd(aDataStr, LINEEND_LF);
- xub_StrLen nLen = aDataStr.Len();
- if (nLen && aDataStr.GetChar(nLen-1) == '\n')
- aDataStr.Erase(nLen-1);
+ sal_Int32 nLen = aDataStr.getLength();
+ if (nLen && aDataStr[nLen-1] == '\n')
+ aDataStr = aDataStr.copy(0, nLen-1);
- if (aDataStr.Len())
+ if (!aDataStr.isEmpty())
{
nRows = comphelper::string::getTokenCount(aDataStr, '\n');
- String aLine = aDataStr.GetToken( 0, '\n' );
- if (aLine.Len())
+ OUString aLine = aDataStr.getToken( 0, '\n' );
+ if (!aLine.isEmpty())
nCols = comphelper::string::getTokenCount(aLine, '\t');
}
}
diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx
index f769db3..dee0c3b 100644
--- a/sd/source/ui/dlg/sdtreelb.cxx
+++ b/sd/source/ui/dlg/sdtreelb.cxx
@@ -1072,7 +1072,7 @@
if( pNavWin && ( pNavWin == mpParent ) )
{
TransferableDataHelper aDataHelper( rEvt.maDropEvent.Transferable );
- String aFile;
+ OUString aFile;
if( aDataHelper.GetString( FORMAT_FILE, aFile ) &&
( (SdNavigatorWin*) mpParent)->InsertFile( aFile ) )
diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
index 94b2abb..edabb95 100644
--- a/sd/source/ui/view/sdview3.cxx
+++ b/sd/source/ui/view/sdview3.cxx
@@ -1394,7 +1394,7 @@
}
else if( CHECK_FORMAT_TRANS( FORMAT_FILE ) )
{
- String aDropFile;
+ OUString aDropFile;
if( aDataHelper.GetString( FORMAT_FILE, aDropFile ) )
{
diff --git a/svtools/source/misc/stringtransfer.cxx b/svtools/source/misc/stringtransfer.cxx
index eba7a56..579a999 100644
--- a/svtools/source/misc/stringtransfer.cxx
+++ b/svtools/source/misc/stringtransfer.cxx
@@ -78,7 +78,7 @@
{
if (SOT_FORMAT_STRING == aSearch->mnSotId)
{
- String sContent;
+ OUString sContent;
sal_Bool bSuccess = aClipboardData.GetString( SOT_FORMAT_STRING, sContent );
_rContent = sContent;
return bSuccess;
diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx
index c1806c4..c2e0201 100644
--- a/svtools/source/misc/transfer.cxx
+++ b/svtools/source/misc/transfer.cxx
@@ -1595,30 +1595,6 @@
// -----------------------------------------------------------------------------
-sal_Bool TransferableDataHelper::GetString( SotFormatStringId nFormat, String& rStr )
-{
- OUString aOUString;
- sal_Bool bRet = GetString( nFormat, aOUString );
-
- rStr = aOUString;
-
- return bRet;
-}
-
-// -----------------------------------------------------------------------------
-
-sal_Bool TransferableDataHelper::GetString( const DataFlavor& rFlavor, String& rStr )
-{
- OUString aOUString;
- sal_Bool bRet = GetString( rFlavor, aOUString );
-
- rStr = aOUString;
-
- return bRet;
-}
-
-// -----------------------------------------------------------------------------
-
sal_Bool TransferableDataHelper::GetString( SotFormatStringId nFormat, OUString& rStr )
{
DataFlavor aFlavor;
@@ -1875,7 +1851,7 @@
case( SOT_FORMATSTR_ID_SOLK ):
case( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR ):
{
- String aString;
+ OUString aString;
if( GetString( rFlavor, aString ) )
{
if( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR == nFormat )
@@ -1885,32 +1861,32 @@
}
else
{
- String aURL, aDesc;
- sal_uInt16 nStart = aString.Search( '@' ), nLen = (sal_uInt16)
aString.ToInt32();
+ OUString aURL, aDesc;
+ sal_Int32 nStart = aString.indexOf( '@' ), nLen = aString.toInt32();
- if( !nLen && aString.GetChar( 0 ) != '0' )
+ if( !nLen && aString[ 0 ] != '0' )
{
DBG_WARNING( "SOLK: 1. len=0" );
}
- if( nStart == STRING_NOTFOUND || nLen > aString.Len() - nStart - 3 )
+ if( nStart < 0 || nLen > aString.getLength() - nStart - 3 )
{
DBG_WARNING( "SOLK: 1. illegal start or wrong len" );
}
- aURL = aString.Copy( nStart + 1, nLen );
+ aURL = aString.copy( nStart + 1, nLen );
- aString.Erase( 0, nStart + 1 + nLen );
- nStart = aString.Search( '@' );
- nLen = (sal_uInt16) aString.ToInt32();
+ aString = aString.copy( nStart + 1 + nLen );
+ nStart = aString.indexOf( '@' );
+ nLen = aString.toInt32();
- if( !nLen && aString.GetChar( 0 ) != '0' )
+ if( !nLen && aString[ 0 ] != '0' )
{
DBG_WARNING( "SOLK: 2. len=0" );
}
- if( nStart == STRING_NOTFOUND || nLen > aString.Len() - nStart - 1 )
+ if( nStart < 0 || nLen > aString.getLength() - nStart - 1 )
{
DBG_WARNING( "SOLK: 2. illegal start or wrong len" );
}
- aDesc = aString.Copy( nStart+1, nLen );
+ aDesc = aString.copy( nStart+1, nLen );
rBmk = INetBookmark( aURL, aDesc );
bRet = sal_True;
diff --git a/svtools/source/misc/transfer2.cxx b/svtools/source/misc/transfer2.cxx
index 5fc1d14..c1b8334 100644
--- a/svtools/source/misc/transfer2.cxx
+++ b/svtools/source/misc/transfer2.cxx
@@ -547,9 +547,9 @@
// -----------------------------------------------------------------------------
-void TransferDataContainer::CopyString( sal_uInt16 nFmt, const String& rStr )
+void TransferDataContainer::CopyString( sal_uInt16 nFmt, const OUString& rStr )
{
- if( rStr.Len() )
+ if( !rStr.isEmpty() )
{
TDataCntnrEntry_Impl aEntry;
aEntry.nId = nFmt;
@@ -562,7 +562,7 @@
// -----------------------------------------------------------------------------
-void TransferDataContainer::CopyString( const String& rStr )
+void TransferDataContainer::CopyString( const OUString& rStr )
{
CopyString( SOT_FORMAT_STRING, rStr );
}
diff --git a/svx/source/fmcomp/dbaexchange.cxx b/svx/source/fmcomp/dbaexchange.cxx
index b5e9b8e..a0ac6c3 100644
--- a/svx/source/fmcomp/dbaexchange.cxx
+++ b/svx/source/fmcomp/dbaexchange.cxx
@@ -346,14 +346,14 @@
if (!nRecognizedFormat)
return sal_False;
- String sFieldDescription;
+ OUString sFieldDescription;
const_cast<TransferableDataHelper&>(_rData).GetString(nRecognizedFormat,
sFieldDescription);
const sal_Unicode cSeparator = sal_Unicode(11);
- _rDatasource = sFieldDescription.GetToken(0, cSeparator);
- _rCommand = sFieldDescription.GetToken(1, cSeparator);
- _nCommandType = sFieldDescription.GetToken(2, cSeparator).ToInt32();
- _rFieldName = sFieldDescription.GetToken(3, cSeparator);
+ _rDatasource = sFieldDescription.getToken(0, cSeparator);
+ _rCommand = sFieldDescription.getToken(1, cSeparator);
+ _nCommandType = sFieldDescription.getToken(2, cSeparator).toInt32();
+ _rFieldName = sFieldDescription.getToken(3, cSeparator);
return sal_True;
}
diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx
index 54c7067..a29502c 100644
--- a/svx/source/gallery2/galtheme.cxx
+++ b/svx/source/gallery2/galtheme.cxx
@@ -1223,11 +1223,11 @@
aDataHelper.GetFileList( SOT_FORMAT_FILE_LIST, aFileList );
else
{
- String aFile;
+ OUString aFile;
aDataHelper.GetString( FORMAT_FILE, aFile );
- if( aFile.Len() )
+ if( !aFile.isEmpty() )
aFileList.AppendFile( aFile );
}
diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx
index a58a1e4..a6a583e 100644
--- a/sw/source/ui/dochdl/swdtflvr.cxx
+++ b/sw/source/ui/dochdl/swdtflvr.cxx
@@ -1388,13 +1388,13 @@
case EXCHG_OUT_ACTION_INSERT_HYPERLINK:
{
- String sURL, sDesc;
+ OUString sURL, sDesc;
if( SOT_FORMAT_FILE == nFormat )
{
- if( rData.GetString( nFormat, sURL ) && sURL.Len() )
+ if( rData.GetString( nFormat, sURL ) && !sURL.isEmpty() )
{
SwTransferable::_CheckForURLOrLNKFile( rData, sURL, &sDesc );
- if( !sDesc.Len() )
+ if( sDesc.isEmpty() )
sDesc = sURL;
nRet = 1;
}
@@ -1882,7 +1882,7 @@
{
if( !aINetImg.GetImageURL().isEmpty() && bInsertGRF )
{
- String sURL( aINetImg.GetImageURL() );
+ OUString sURL( aINetImg.GetImageURL() );
SwTransferable::_CheckForURLOrLNKFile( rData, sURL );
//!!! check at FileSystem - only then it make sense to test graphics !!!
@@ -2077,7 +2077,7 @@
SwDDEFieldType* pDDETyp = (SwDDEFieldType*)pTyp;
- String aExpand;
+ OUString aExpand;
if( rData.GetString( FORMAT_STRING, aExpand ))
{
do { // middle checked loop
@@ -2085,7 +2085,7 @@
// When data comes from a spreadsheet, we add a DDE-table
if( ( rData.HasFormat( SOT_FORMATSTR_ID_SYLK ) ||
rData.HasFormat( SOT_FORMATSTR_ID_SYLK_BIGCAPS ) ) &&
- aExpand.Len() &&
+ !aExpand.isEmpty() &&
( 1 < comphelper::string::getTokenCount(aExpand, '\n') ||
comphelper::string::getTokenCount(aExpand, '\t') ) )
{
@@ -2198,10 +2198,10 @@
case SOT_FORMAT_FILE:
{
- String sTxt;
+ OUString sTxt;
if( 0 != ( nRet = rData.GetString( nFmt, sTxt ) ) )
{
- String sDesc;
+ OUString sDesc;
SwTransferable::_CheckForURLOrLNKFile( rData, sTxt, &sDesc );
aBkmk = INetBookmark(
@@ -2358,10 +2358,10 @@
SwWrtShell& rSh, sal_uLong nFmt )
{
int nRet = 0;
- String sFile;
- if( rData.GetString( nFmt, sFile ) && sFile.Len() )
+ OUString sFile;
+ if( rData.GetString( nFmt, sFile ) && !sFile.isEmpty() )
{
- String sDesc;
+ OUString sDesc;
SwTransferable::_CheckForURLOrLNKFile( rData, sFile, &sDesc );
// first, make the URL absolute
@@ -2390,7 +2390,7 @@
default:
{
rSh.InsertURL( SwFmtINetFmt( sFile, aEmptyStr ),
- sDesc.Len() ? sDesc : sFile );
+ !sDesc.isEmpty() ? sDesc : sFile );
}
}
nRet = sal_True;
@@ -2409,8 +2409,8 @@
nRet |= SWTRANSFER_GRAPHIC_INSERTED;
if( !nRet )
{
- String sFile, sDesc;
- if( rData.GetString( nFmt, sFile ) && sFile.Len() )
+ OUString sFile, sDesc;
+ if( rData.GetString( nFmt, sFile ) && !sFile.isEmpty() )
{
INetURLObject aMediaURL;
@@ -2477,7 +2477,7 @@
default:
{
rSh.InsertURL( SwFmtINetFmt( sFile, aEmptyStr ),
- sDesc.Len() ? sDesc : sFile );
+ !sDesc.isEmpty() ? sDesc : sFile );
}
}
nRet = sal_True;
@@ -2493,8 +2493,8 @@
const Point* pDragPt, sal_Bool bMsg )
{
int nRet = 0;
- String sTxt;
- if( rData.GetString( nFmt, sTxt ) && sTxt.Len() )
+ OUString sTxt;
+ if( rData.GetString( nFmt, sTxt ) && !sTxt.isEmpty() )
{
sal_uInt16 nWh = SOT_FORMATSTR_ID_SBA_CTRLDATAEXCHANGE == nFmt
? 0
@@ -2631,7 +2631,7 @@
}
sal_Bool SwTransferable::_CheckForURLOrLNKFile( TransferableDataHelper& rData,
- String& rFileName, String* pTitle )
+ OUString& rFileName, OUString* pTitle )
{
sal_Bool bIsURLFile = sal_False;
INetBookmark aBkmk;
@@ -2644,10 +2644,10 @@
}
else
{
- xub_StrLen nLen = rFileName.Len();
- if( 4 < nLen && '.' == rFileName.GetChar( nLen - 4 ))
+ sal_Int32 nLen = rFileName.getLength();
+ if( 4 < nLen && '.' == rFileName[ nLen - 4 ])
{
- String sExt( rFileName.Copy( nLen - 3 ));
+ String sExt( rFileName.copy( nLen - 3 ));
if( sExt.EqualsIgnoreCaseAscii( "url" ))
{
OSL_ENSURE( !&rFileName, "how do we read today .URL - Files?" );
diff --git a/sw/source/ui/inc/swdtflvr.hxx b/sw/source/ui/inc/swdtflvr.hxx
index e790297..b72bd4a 100644
--- a/sw/source/ui/inc/swdtflvr.hxx
+++ b/sw/source/ui/inc/swdtflvr.hxx
@@ -85,7 +85,7 @@
static SwTransferable* GetSwTransferable( const TransferableDataHelper& rData );
static void SetSelInShell( SwWrtShell& , sal_Bool , const Point* );
static sal_Bool _CheckForURLOrLNKFile( TransferableDataHelper& rData,
- String& rFileName, String* pTitle = 0 );
+ OUString& rFileName, OUString* pTitle = 0 );
static int _TestAllowedFormat( const TransferableDataHelper& rData,
sal_uLong nFormat, sal_uInt16 nDestination );
diff --git a/sw/source/ui/utlui/content.cxx b/sw/source/ui/utlui/content.cxx
index 67a0c09..550df4d 100644
--- a/sw/source/ui/utlui/content.cxx
+++ b/sw/source/ui/utlui/content.cxx
@@ -3048,15 +3048,15 @@
sal_Bool NaviContentBookmark::Paste( TransferableDataHelper& rData )
{
- String sStr;
+ OUString sStr;
sal_Bool bRet = rData.GetString( SOT_FORMATSTR_ID_SONLK, sStr );
if( bRet )
{
sal_Int32 nPos = 0;
- aUrl = sStr.GetToken(0, NAVI_BOOKMARK_DELIM, nPos );
- aDescr = sStr.GetToken(0, NAVI_BOOKMARK_DELIM, nPos );
- nDefDrag= (sal_uInt16)sStr.GetToken(0, NAVI_BOOKMARK_DELIM, nPos ).ToInt32();
- nDocSh = sStr.GetToken(0, NAVI_BOOKMARK_DELIM, nPos ).ToInt32();
+ aUrl = sStr.getToken(0, NAVI_BOOKMARK_DELIM, nPos );
+ aDescr = sStr.getToken(0, NAVI_BOOKMARK_DELIM, nPos );
+ nDefDrag= (sal_uInt16)sStr.getToken(0, NAVI_BOOKMARK_DELIM, nPos ).toInt32();
+ nDocSh = sStr.getToken(0, NAVI_BOOKMARK_DELIM, nPos ).toInt32();
}
return bRet;
}
diff --git a/sw/source/ui/utlui/navipi.cxx b/sw/source/ui/utlui/navipi.cxx
index 5c6bea7..a681f8c 100644
--- a/sw/source/ui/utlui/navipi.cxx
+++ b/sw/source/ui/utlui/navipi.cxx
@@ -1141,7 +1141,7 @@
String SwNavigationPI::CreateDropFileName( TransferableDataHelper& rData )
{
- String sFileName;
+ OUString sFileName;
sal_uLong nFmt;
if( rData.HasFormat( nFmt = FORMAT_FILE_LIST ))
{
@@ -1163,7 +1163,7 @@
rData.GetINetBookmark( nFmt, aBkmk );
sFileName = aBkmk.GetURL();
}
- if( sFileName.Len() )
+ if( !sFileName.isEmpty() )
{
sFileName = INetURLObject( sFileName ).GetMainURL( INetURLObject::NO_DECODE );
}
--
To view, visit https://gerrit.libreoffice.org/4262
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iefa6688b91a05e248a6073c4f7216111fa4f7410
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Norbert Thiebaud <nthiebaud@gmail.com>
Context
- [PATCH] String=>OUString svtools trasnfer* · Norbert Thiebaud (via Code Review)
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.