Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/4255
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/55/4255/1
String=>OUString svtools/fileview and dep
Change-Id: If813b3099df9e98c07f40aecdd23fe547cbd0f44
---
M include/svtools/fileview.hxx
M svtools/source/contnr/fileview.cxx
M svtools/source/contnr/templwin.cxx
M svtools/source/contnr/templwin.hxx
4 files changed, 91 insertions(+), 92 deletions(-)
diff --git a/include/svtools/fileview.hxx b/include/svtools/fileview.hxx
index 917cfab..468f377 100644
--- a/include/svtools/fileview.hxx
+++ b/include/svtools/fileview.hxx
@@ -83,15 +83,15 @@
SvtFileView( Window* pParent, const ResId& rResId, sal_uInt8 nFlags );
~SvtFileView();
- const String& GetViewURL() const;
- String GetURL( SvTreeListEntry* pEntry ) const;
- String GetCurrentURL() const;
+ const OUString& GetViewURL() const;
+ OUString GetURL( SvTreeListEntry* pEntry ) const;
+ OUString GetCurrentURL() const;
- sal_Bool GetParentURL( String& _rParentURL ) const;
- void CreatedFolder( const String& rUrl, const String& rNewFolder );
+ sal_Bool GetParentURL( OUString& _rParentURL ) const;
+ void CreatedFolder( const OUString& rUrl, const OUString& rNewFolder );
void SetHelpId( const OString& rHelpId );
- const OString& GetHelpId( ) const;
+ const OString& GetHelpId( ) const;
void SetSizePixel( const Size& rNewSize );
virtual void SetPosSizePixel( const Point& rNewPos, const Size& rNewSize );
void SetSortColumn( sal_Bool bValue ) { bSortColumn = bValue; }
@@ -108,15 +108,15 @@
action asynchronously.
*/
FileViewResult Initialize(
- const String& rFolderURL,
- const String& rFilter,
+ const OUString& rFolderURL,
+ const OUString& rFilter,
const FileViewAsyncAction* pAsyncDescriptor,
const ::com::sun::star::uno::Sequence< OUString >& rBlackList
);
FileViewResult Initialize(
- const String& rFolderURL,
- const String& rFilter,
+ const OUString& rFolderURL,
+ const OUString& rFilter,
const FileViewAsyncAction* pAsyncDescriptor );
/** initialze the view with a sequence of contents, which have already been obtained elsewhere
@@ -128,7 +128,7 @@
/** initializes the view with the content of a folder given by an UCB content
*/
sal_Bool Initialize( const ::com::sun::star::uno::Reference<
::com::sun::star::ucb::XContent>& _xContent,
- const String& rFilter );
+ const OUString& rFilter );
/** reads the current content of the current folder again, and applies the given filter to it
@@ -145,7 +145,7 @@
action asynchronously.
*/
FileViewResult ExecuteFilter(
- const String& rFilter,
+ const OUString& rFilter,
const FileViewAsyncAction* pAsyncDescriptor
);
@@ -188,8 +188,8 @@
// EnableContextMenu( sal_True )/EnableDelete(sal_True) disable
name replacing!
// save and load column size and sort order
- String GetConfigString() const;
- void SetConfigString( const String& rCfgStr );
+ OUString GetConfigString() const;
+ void SetConfigString( const OUString& rCfgStr );
void EndInplaceEditing( bool _bCancel );
@@ -242,7 +242,7 @@
public:
QueryDeleteDlg_Impl( Window* pParent,
- const String& rName );
+ const OUString& rName );
void EnableAllButton() { _aAllButton.Enable( sal_True ); }
QueryDeleteResult_Impl GetResult() const { return _eResult; }
diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx
index f8104b6..0a136cd 100644
--- a/svtools/source/contnr/fileview.cxx
+++ b/svtools/source/contnr/fileview.cxx
@@ -173,9 +173,9 @@
SvtFileView_Impl* mpParent;
Timer maResetQuickSearch;
OUString maQuickSearchText;
- String msAccessibleDescText;
- String msFolder;
- String msFile;
+ OUString msAccessibleDescText;
+ OUString msFolder;
+ OUString msFile;
sal_uInt32 mnSearchIndex;
sal_Bool mbResizeDisabled : 1;
sal_Bool mbAutoResize : 1;
@@ -320,7 +320,7 @@
HashedEntry maHashedURL; // for future purposes when dealing with a set of
cached
// NameTranslationLists
private:
- const String maTransFileName;
+ const OUString maTransFileName;
void Init(); // reads the translation file and fills the
(internal) list
public:
@@ -338,11 +338,11 @@
inline void Update(); // clears list and init
- inline const String& GetTransTableFileName() const;
+ inline const OUString& GetTransTableFileName() const;
// returns the name for the file, which contains the
translation strings
};
-inline const String& NameTranslationList::GetTransTableFileName() const
+inline const OUString& NameTranslationList::GetTransTableFileName() const
{
return maTransFileName;
}
@@ -361,7 +361,7 @@
if( aTestContent.isDocument() )
{
// ... also tests the existence of maTransFile by throwing an Exception
- String aFsysName( maTransFile.getFSysPath( INetURLObject::FSYS_DETECT ) );
+ OUString aFsysName( maTransFile.getFSysPath( INetURLObject::FSYS_DETECT ) );
Config aConfig( aFsysName );
aConfig.SetGroup( OString(RTL_CONSTASCII_STRINGPARAM("TRANSLATIONNAMES")) );
@@ -429,7 +429,7 @@
virtual sal_Bool GetTranslation( const OUString& rOriginalName, OUString&
rTranslatedName ) const;
void SetActualFolder( const INetURLObject& rActualFolder );
- const String* GetTransTableFileName() const;
+ const OUString* GetTransTableFileName() const;
// returns the name for the file, which contains the
translation strings
};
@@ -470,9 +470,9 @@
IntlWrapper aIntlWrapper;
- String maViewURL;
- String maAllFilter;
- String maCurrentFilter;
+ OUString maViewURL;
+ OUString maAllFilter;
+ OUString maCurrentFilter;
Image maFolderImage;
Link maOpenDoneLink;
Reference< XCommandEnvironment > mxCmdEnv;
@@ -485,7 +485,7 @@
void Clear();
FileViewResult GetFolderContent_Impl(
- const String& rFolder,
+ const OUString& rFolder,
const FileViewAsyncAction* pAsyncDescriptor,
const ::com::sun::star::uno::Sequence< OUString >& rBlackList =
::com::sun::star::uno::Sequence< OUString >() );
@@ -506,10 +506,10 @@
void EntryRemoved( const OUString& rURL );
void EntryRenamed( OUString& rURL,
const OUString& rName );
- String FolderInserted( const OUString& rURL,
+ OUString FolderInserted( const OUString& rURL,
const OUString& rTitle );
- sal_uLong GetEntryPos( const OUString& rURL );
+ sal_uLong GetEntryPos( const OUString& rURL );
inline void EnableContextMenu( sal_Bool bEnable );
inline void EnableDelete( sal_Bool bEnable );
@@ -838,11 +838,8 @@
Reference< XPropertySetInfo > aProps = aCnt.getProperties();
if ( aProps.is() )
{
- Property aProp
- = aProps->getPropertyByName(
- OUString( "Title" ) );
- bEnableRename
- = !( aProp.Attributes & PropertyAttribute::READONLY );
+ Property aProp = aProps->getPropertyByName( OUString( "Title" ) );
+ bEnableRename = !( aProp.Attributes & PropertyAttribute::READONLY );
}
else
bEnableRename = false;
@@ -902,7 +899,7 @@
{
svtools::QueryDeleteResult_Impl eResult = svtools::QUERYDELETE_YES;
SvTreeListEntry* pEntry = FirstSelected();
- String aURL;
+ OUString aURL;
OString sDialogPosition;
while ( pEntry && ( eResult != svtools::QUERYDELETE_CANCEL ) )
@@ -913,7 +910,7 @@
if ( pCurEntry->GetUserData() )
aURL = ( (SvtContentEntry*)pCurEntry->GetUserData() )->maURL;
- if ( !aURL.Len() )
+ if ( aURL.isEmpty() )
continue;
bool canDelete = true;
@@ -922,11 +919,13 @@
::ucbhelper::Content aCnt( aURL, mxCmdEnv, comphelper::getProcessComponentContext() );
Reference< XCommandInfo > aCommands = aCnt.getCommands();
if ( aCommands.is() )
- canDelete
- = aCommands->hasCommandByName(
- OUString( "delete" ) );
+ {
+ canDelete = aCommands->hasCommandByName( OUString( "delete" ) );
+ }
else
+ {
canDelete = false;
+ }
}
catch( Exception const & )
{
@@ -1092,12 +1091,12 @@
SvtContentEntry* pData = (SvtContentEntry*)pEntry->GetUserData();
if ( pData )
{
- const String sVar1( RTL_CONSTASCII_USTRINGPARAM( "%1" ) );
- const String sVar2( RTL_CONSTASCII_USTRINGPARAM( "%2" ) );
- String aText( msAccessibleDescText );
- aText.SearchAndReplace( sVar1, pData->mbIsFolder ? msFolder : msFile );
- aText.SearchAndReplace( sVar2, pData->maURL );
- sRet += OUString( aText );
+ const OUString sVar1( "%1" );
+ const OUString sVar2( "%2" );
+ OUString aText( msAccessibleDescText );
+ aText = aText.replaceAll( sVar1, pData->mbIsFolder ? msFolder : msFile );
+ aText = aText.replaceAll( sVar2, pData->maURL );
+ sRet += aText;
}
}
}
@@ -1191,9 +1190,9 @@
// -----------------------------------------------------------------------
-String SvtFileView::GetURL( SvTreeListEntry* pEntry ) const
+OUString SvtFileView::GetURL( SvTreeListEntry* pEntry ) const
{
- String aURL;
+ OUString aURL;
if ( pEntry && pEntry->GetUserData() )
aURL = ( (SvtContentEntry*)pEntry->GetUserData() )->maURL;
return aURL;
@@ -1201,9 +1200,9 @@
// -----------------------------------------------------------------------
-String SvtFileView::GetCurrentURL() const
+OUString SvtFileView::GetCurrentURL() const
{
- String aURL;
+ OUString aURL;
SvTreeListEntry* pEntry = mpImp->mpView->FirstSelected();
if ( pEntry && pEntry->GetUserData() )
aURL = ( (SvtContentEntry*)pEntry->GetUserData() )->maURL;
@@ -1211,9 +1210,9 @@
}
// -----------------------------------------------------------------------------
-void SvtFileView::CreatedFolder( const String& rUrl, const String& rNewFolder )
+void SvtFileView::CreatedFolder( const OUString& rUrl, const OUString& rNewFolder )
{
- String sEntry = mpImp->FolderInserted( rUrl, rNewFolder );
+ OUString sEntry = mpImp->FolderInserted( rUrl, rNewFolder );
SvTreeListEntry* pEntry = mpImp->mpView->InsertEntry( sEntry, mpImp->maFolderImage,
mpImp->maFolderImage );
SvtContentEntry* pUserData = new SvtContentEntry( rUrl, sal_True );
pEntry->SetUserData( pUserData );
@@ -1226,7 +1225,7 @@
{
FileViewResult eResult = eFailure;
- String sParentURL;
+ OUString sParentURL;
if ( GetParentURL( sParentURL ) )
eResult = Initialize( sParentURL, mpImp->maCurrentFilter, pAsyncDescriptor, mpBlackList );
@@ -1235,7 +1234,7 @@
// -----------------------------------------------------------------------
-sal_Bool SvtFileView::GetParentURL( String& rParentURL ) const
+sal_Bool SvtFileView::GetParentURL( OUString& rParentURL ) const
{
sal_Bool bRet = sal_False;
try
@@ -1248,8 +1247,8 @@
Reference< XContent > xParent( xChild->getParent(), UNO_QUERY );
if ( xParent.is() )
{
- rParentURL = String( xParent->getIdentifier()->getContentIdentifier() );
- bRet = ( rParentURL.Len() > 0 && rParentURL != mpImp->maViewURL );
+ rParentURL = xParent->getIdentifier()->getContentIdentifier();
+ bRet = !rParentURL.isEmpty() && rParentURL != mpImp->maViewURL;
}
}
}
@@ -1292,7 +1291,7 @@
}
// -----------------------------------------------------------------------------
-sal_Bool SvtFileView::Initialize( const ::com::sun::star::uno::Reference<
::com::sun::star::ucb::XContent>& _xContent, const String& rFilter )
+sal_Bool SvtFileView::Initialize( const ::com::sun::star::uno::Reference<
::com::sun::star::ucb::XContent>& _xContent, const OUString& rFilter )
{
WaitObject aWaitCursor( this );
@@ -1315,15 +1314,15 @@
// -----------------------------------------------------------------------
FileViewResult SvtFileView::Initialize(
- const String& rURL,
- const String& rFilter,
+ const OUString& rURL,
+ const OUString& rFilter,
const FileViewAsyncAction* pAsyncDescriptor,
const ::com::sun::star::uno::Sequence< OUString >& rBlackList )
{
WaitObject aWaitCursor( this );
mpBlackList = rBlackList;
- String sPushURL( mpImp->maViewURL );
+ OUString sPushURL( mpImp->maViewURL );
mpImp->maViewURL = rURL;
FileViewResult eResult = ExecuteFilter( rFilter, pAsyncDescriptor );
@@ -1346,8 +1345,8 @@
// -----------------------------------------------------------------------
FileViewResult SvtFileView::Initialize(
- const String& rURL,
- const String& rFilter,
+ const OUString& rURL,
+ const OUString& rFilter,
const FileViewAsyncAction* pAsyncDescriptor )
{
return Initialize( rURL, rFilter, pAsyncDescriptor, ::com::sun::star::uno::Sequence< OUString
());
@@ -1360,7 +1359,7 @@
{
WaitObject aWaitCursor( this );
- mpImp->maViewURL = String();
+ mpImp->maViewURL = OUString();
mpImp->maCurrentFilter = mpImp->maAllFilter;
mpImp->Clear();
@@ -1377,10 +1376,9 @@
// -----------------------------------------------------------------------
-FileViewResult SvtFileView::ExecuteFilter( const String& rFilter, const FileViewAsyncAction*
pAsyncDescriptor )
+FileViewResult SvtFileView::ExecuteFilter( const OUString& rFilter, const FileViewAsyncAction*
pAsyncDescriptor )
{
- mpImp->maCurrentFilter = rFilter;
- mpImp->maCurrentFilter.ToLowerAscii();
+ mpImp->maCurrentFilter = rFilter.toAsciiLowerCase();
mpImp->Clear();
FileViewResult eResult = mpImp->GetFolderContent_Impl( mpImp->maViewURL, pAsyncDescriptor,
mpBlackList );
@@ -1461,7 +1459,7 @@
}
// -----------------------------------------------------------------------
-const String& SvtFileView::GetViewURL() const
+const OUString& SvtFileView::GetViewURL() const
{
return mpImp->maViewURL;
}
@@ -1560,28 +1558,28 @@
}
// -----------------------------------------------------------------------
-String SvtFileView::GetConfigString() const
+OUString SvtFileView::GetConfigString() const
{
- String sRet;
+ OUString sRet;
HeaderBar* pBar = mpImp->mpView->GetHeaderBar();
DBG_ASSERT( pBar, "invalid headerbar" );
// sort order
sRet += OUString::number( mpImp->mnSortColumn );
- sRet += ';';
+ sRet += ";";
HeaderBarItemBits nBits = pBar->GetItemBits( mpImp->mnSortColumn );
sal_Bool bUp = ( ( nBits & HIB_UPARROW ) == HIB_UPARROW );
- sRet += bUp ? '1' : '0';
- sRet += ';';
+ sRet += bUp ? "1" : "0";
+ sRet += ";";
sal_uInt16 nCount = pBar->GetItemCount();
for ( sal_uInt16 i = 0; i < nCount; ++i )
{
sal_uInt16 nId = pBar->GetItemId(i);
sRet += OUString::number( nId );
- sRet += ';';
+ sRet += ";";
sRet += OUString::number( pBar->GetItemSize( nId ) );
- sRet += ';';
+ sRet += ";";
}
sRet = comphelper::string::stripEnd(sRet, ';');
@@ -1589,14 +1587,14 @@
}
// -----------------------------------------------------------------------
-void SvtFileView::SetConfigString( const String& rCfgStr )
+void SvtFileView::SetConfigString( const OUString& rCfgStr )
{
HeaderBar* pBar = mpImp->mpView->GetHeaderBar();
DBG_ASSERT( pBar, "invalid headerbar" );
sal_Int32 nIdx = 0;
- mpImp->mnSortColumn = (sal_uInt16)rCfgStr.GetToken( 0, ';', nIdx ).ToInt32();
- sal_Bool bUp = (sal_Bool)(sal_uInt16)rCfgStr.GetToken( 0, ';', nIdx ).ToInt32();
+ mpImp->mnSortColumn = (sal_uInt16)rCfgStr.getToken( 0, ';', nIdx ).toInt32();
+ sal_Bool bUp = (sal_Bool)(sal_uInt16)rCfgStr.getToken( 0, ';', nIdx ).toInt32();
HeaderBarItemBits nBits = pBar->GetItemBits( mpImp->mnSortColumn );
if ( bUp )
@@ -1613,8 +1611,8 @@
while ( nIdx != -1 )
{
- sal_uInt16 nItemId = (sal_uInt16)rCfgStr.GetToken( 0, ';', nIdx ).ToInt32();
- pBar->SetItemSize( nItemId, rCfgStr.GetToken( 0, ';', nIdx ).ToInt32() );
+ sal_uInt16 nItemId = (sal_uInt16)rCfgStr.getToken( 0, ';', nIdx ).toInt32();
+ pBar->SetItemSize( nItemId, rCfgStr.getToken( 0, ';', nIdx ).toInt32() );
}
HeaderSelect_Impl( pBar );
@@ -1677,7 +1675,7 @@
return bRet;
}
-const String* NameTranslator_Impl::GetTransTableFileName() const
+const OUString* NameTranslator_Impl::GetTransTableFileName() const
{
return mpActFolder? &mpActFolder->GetTransTableFileName() : NULL;
}
@@ -1738,7 +1736,7 @@
// -----------------------------------------------------------------------
FileViewResult SvtFileView_Impl::GetFolderContent_Impl(
- const String& rFolder,
+ const OUString& rFolder,
const FileViewAsyncAction* pAsyncDescriptor,
const ::com::sun::star::uno::Sequence< OUString >& rBlackList )
{
@@ -1861,17 +1859,18 @@
{
sal_Bool bHideTransFile = mbReplaceNames && mpNameTrans;
- String sHideEntry;
+ OUString sHideEntry;
if( bHideTransFile )
{
- const String* pTransTableFileName = mpNameTrans->GetTransTableFileName();
+ const OUString* pTransTableFileName = mpNameTrans->GetTransTableFileName();
if( pTransTableFileName )
{
- sHideEntry = *pTransTableFileName;
- sHideEntry.ToUpperAscii();
+ sHideEntry = (*pTransTableFileName).toAsciiUpperCase();
}
else
+ {
bHideTransFile = sal_False;
+ }
}
if ( !bHideTransFile &&
@@ -1899,7 +1898,7 @@
// do the filtering
::std::vector< SortingData_Impl* >::iterator aContentLoop = maContent.begin();
- String sCompareString;
+ OUString sCompareString;
do
{
if ( (*aContentLoop)->mbIsFolder )
@@ -2259,7 +2258,7 @@
// reset the quick search index
mpView->ResetQuickSearch_Impl( NULL );
- String aEntryURL;
+ OUString aEntryURL;
SvTreeListEntry* pEntry = mpView->GetCurEntry();
if ( pEntry && pEntry->GetUserData() )
aEntryURL = ( (SvtContentEntry*)pEntry->GetUserData() )->maURL;
@@ -2436,7 +2435,7 @@
}
// -----------------------------------------------------------------------
-String SvtFileView_Impl::FolderInserted( const OUString& rURL, const OUString& rTitle )
+OUString SvtFileView_Impl::FolderInserted( const OUString& rURL, const OUString& rTitle )
{
::osl::MutexGuard aGuard( maMutex );
@@ -2475,7 +2474,7 @@
pData->maDisplayText = aValue;
maContent.push_back( pData );
- return String( aValue );
+ return aValue;
}
// -----------------------------------------------------------------------
@@ -2547,7 +2546,7 @@
QueryDeleteDlg_Impl::QueryDeleteDlg_Impl
(
Window* pParent,
- const String& rName // entry name
+ const OUString& rName // entry name
) :
ModalDialog( pParent, SvtResId( DLG_SVT_QUERYDELETE ) ),
diff --git a/svtools/source/contnr/templwin.cxx b/svtools/source/contnr/templwin.cxx
index ec99e64..2c50d88 100644
--- a/svtools/source/contnr/templwin.cxx
+++ b/svtools/source/contnr/templwin.cxx
@@ -544,7 +544,7 @@
aNewFolderLink.Call( this );
}
-sal_Bool SvtFileViewWindow_Impl::HasPreviousLevel( String& rURL ) const
+sal_Bool SvtFileViewWindow_Impl::HasPreviousLevel( OUString& rURL ) const
{
INetURLObject aViewObj( aFileView.GetViewURL() );
INetURLObject aRootObj( aCurrentRootURL );
@@ -1025,7 +1025,7 @@
case TI_DOCTEMPLATE_PREV :
{
- String aURL;
+ OUString aURL;
if ( pFileWin->HasPreviousLevel( aURL ) )
pFileWin->OpenFolder( aURL );
break;
diff --git a/svtools/source/contnr/templwin.hxx b/svtools/source/contnr/templwin.hxx
index 19cdfc1..abcd6f5 100644
--- a/svtools/source/contnr/templwin.hxx
+++ b/svtools/source/contnr/templwin.hxx
@@ -146,7 +146,7 @@
String GetSelectedFile() const;
void OpenFolder( const String& rURL );
- sal_Bool HasPreviousLevel( String& rURL ) const;
+ sal_Bool HasPreviousLevel( OUString& rURL ) const;
String GetFolderTitle() const;
void SetFocus();
};
--
To view, visit https://gerrit.libreoffice.org/4255
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If813b3099df9e98c07f40aecdd23fe547cbd0f44
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Norbert Thiebaud <nthiebaud@gmail.com>
Context
- [PATCH] String=>OUString svtools/fileview and dep · 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.