convert fpicker module from String to OUString

Change-Id: I665facff9f37f089f97e91f71e45578ad03e0653
This commit is contained in:
Noel Grandin
2013-09-20 16:47:36 +02:00
parent 92ee5e9433
commit ab63cac8cf
8 changed files with 214 additions and 217 deletions

View File

@@ -473,7 +473,7 @@ SvtFileDialog* SvtFilePicker::implCreateDialog( Window* _pParent )
// Set StandardDir if present // Set StandardDir if present
if ( !m_aStandardDir.isEmpty()) if ( !m_aStandardDir.isEmpty())
{ {
String sStandardDir = String( m_aStandardDir ); OUString sStandardDir = m_aStandardDir;
dialog->SetStandardDir( sStandardDir ); dialog->SetStandardDir( sStandardDir );
dialog->SetBlackList( m_aBlackList ); dialog->SetBlackList( m_aBlackList );
} }

View File

@@ -83,8 +83,8 @@ namespace svt
//-------------------------------------------------------------------- //--------------------------------------------------------------------
void AsyncPickerAction::execute( void AsyncPickerAction::execute(
const String& _rURL, const OUString& _rURL,
const String& _rFilter, const OUString& _rFilter,
sal_Int32 _nMinTimeout, sal_Int32 _nMinTimeout,
sal_Int32 _nMaxTimeout, sal_Int32 _nMaxTimeout,
const OUStringList& rBlackList ) const OUStringList& rBlackList )

View File

@@ -55,8 +55,8 @@ namespace svt
Action m_eAction; Action m_eAction;
SvtFileView* m_pView; SvtFileView* m_pView;
SvtFileDialog* m_pDialog; SvtFileDialog* m_pDialog;
String m_sURL; OUString m_sURL;
String m_sFileName; OUString m_sFileName;
bool m_bRunning; bool m_bRunning;
public: public:
@@ -75,8 +75,8 @@ namespace svt
<arg>_nMinTimeout</arg> + 30000. <arg>_nMinTimeout</arg> + 30000.
*/ */
void execute( void execute(
const String& _rURL, const OUString& _rURL,
const String& _rFilter, const OUString& _rFilter,
sal_Int32 _nMinTimeout, sal_Int32 _nMinTimeout,
sal_Int32 _nMaxTimeout, sal_Int32 _nMaxTimeout,
const OUStringList& rBlackList = OUStringList() ); const OUStringList& rBlackList = OUStringList() );

View File

@@ -124,7 +124,7 @@ namespace
{ {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
String getMostCurrentFilter( SvtExpFileDlg_Impl* pImpl ) OUString getMostCurrentFilter( SvtExpFileDlg_Impl* pImpl )
{ {
DBG_ASSERT( pImpl, "invalid impl pointer" ); DBG_ASSERT( pImpl, "invalid impl pointer" );
const SvtFileDialogFilter_Impl* pFilter = pImpl->_pUserFilter; const SvtFileDialogFilter_Impl* pFilter = pImpl->_pUserFilter;
@@ -133,7 +133,7 @@ namespace
pFilter = pImpl->GetCurFilter(); pFilter = pImpl->GetCurFilter();
if ( !pFilter ) if ( !pFilter )
return String(); return OUString();
return pFilter->GetType(); return pFilter->GetType();
} }
@@ -142,12 +142,12 @@ namespace
sal_Bool restoreCurrentFilter( SvtExpFileDlg_Impl* _pImpl ) sal_Bool restoreCurrentFilter( SvtExpFileDlg_Impl* _pImpl )
{ {
DBG_ASSERT( _pImpl->GetCurFilter(), "restoreCurrentFilter: no current filter!" ); DBG_ASSERT( _pImpl->GetCurFilter(), "restoreCurrentFilter: no current filter!" );
DBG_ASSERT( _pImpl->GetCurFilterDisplayName().Len(), "restoreCurrentFilter: no current filter (no display name)!" ); DBG_ASSERT( !_pImpl->GetCurFilterDisplayName().isEmpty(), "restoreCurrentFilter: no current filter (no display name)!" );
_pImpl->SelectFilterListEntry( _pImpl->GetCurFilterDisplayName() ); _pImpl->SelectFilterListEntry( _pImpl->GetCurFilterDisplayName() );
#ifdef DBG_UTIL #ifdef DBG_UTIL
String sSelectedDisplayName; OUString sSelectedDisplayName;
DBG_ASSERT( ( _pImpl->GetSelectedFilterEntry( sSelectedDisplayName ) == _pImpl->GetCurFilter() ) DBG_ASSERT( ( _pImpl->GetSelectedFilterEntry( sSelectedDisplayName ) == _pImpl->GetCurFilter() )
&& ( sSelectedDisplayName == _pImpl->GetCurFilterDisplayName() ), && ( sSelectedDisplayName == _pImpl->GetCurFilterDisplayName() ),
"restoreCurrentFilter: inconsistence!" ); "restoreCurrentFilter: inconsistence!" );
@@ -173,20 +173,18 @@ namespace
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void SetFsysExtension_Impl( String& rFile, const String& rExtension ) void SetFsysExtension_Impl( OUString& rFile, const OUString& rExtension )
{ {
const sal_Unicode* p0 = rFile.GetBuffer(); const sal_Unicode* p0 = rFile.getStr();
const sal_Unicode* p1 = p0 + rFile.Len() - 1; const sal_Unicode* p1 = p0 + rFile.getLength() - 1;
while ( p1 >= p0 && *p1 != sal_Unicode( '.' ) ) while ( p1 >= p0 && *p1 != sal_Unicode( '.' ) )
p1--; p1--;
if ( p1 >= p0 ) if ( p1 >= p0 )
// remove old extension // remove old extension
rFile.Erase( rFile = rFile.copy( 0, p1 - p0 + 1 - ( rExtension.getLength() > 0 ? 0 : 1 ) );
sal::static_int_cast< xub_StrLen >( else if ( !rExtension.isEmpty() )
p1 - p0 + 1 - ( rExtension.Len() > 0 ? 0 : 1 ) ) );
else if ( rExtension.Len() )
// no old extension // no old extension
rFile += sal_Unicode( '.' ); rFile += ".";
rFile += rExtension; rFile += rExtension;
} }
@@ -211,24 +209,24 @@ namespace
} }
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
void lcl_autoUpdateFileExtension( SvtFileDialog* _pDialog, const String& _rLastFilterExt ) void lcl_autoUpdateFileExtension( SvtFileDialog* _pDialog, const OUString& _rLastFilterExt )
{ {
// if auto extension is enabled .... // if auto extension is enabled ....
if ( _pDialog->isAutoExtensionEnabled() ) if ( _pDialog->isAutoExtensionEnabled() )
{ {
// automatically switch to the extension of the (maybe just newly selected) extension // automatically switch to the extension of the (maybe just newly selected) extension
String aNewFile = _pDialog->getCurrentFileText( ); OUString aNewFile = _pDialog->getCurrentFileText( );
String aExt = GetFsysExtension_Impl( aNewFile, _rLastFilterExt ); OUString aExt = GetFsysExtension_Impl( aNewFile, _rLastFilterExt );
// but only if there already is an extension // but only if there already is an extension
if ( aExt.Len() ) if ( !aExt.isEmpty() )
{ {
// check if it is a real file extension, and not only the "post-dot" part in // check if it is a real file extension, and not only the "post-dot" part in
// a directory name // a directory name
sal_Bool bRealExtensions = sal_True; sal_Bool bRealExtensions = sal_True;
if ( STRING_NOTFOUND != aExt.Search( '/' ) ) if ( -1 != aExt.indexOf( '/' ) )
bRealExtensions = sal_False; bRealExtensions = sal_False;
else if ( STRING_NOTFOUND != aExt.Search( '\\' ) ) else if ( -1 != aExt.indexOf( '\\' ) )
bRealExtensions = sal_False; bRealExtensions = sal_False;
else else
{ {
@@ -266,9 +264,9 @@ namespace
} }
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
sal_Bool lcl_getHomeDirectory( const String& _rForURL, String& /* [out] */ _rHomeDir ) sal_Bool lcl_getHomeDirectory( const OUString& _rForURL, OUString& /* [out] */ _rHomeDir )
{ {
_rHomeDir.Erase(); _rHomeDir = "";
// now ask the content broker for a provider for this scheme // now ask the content broker for a provider for this scheme
//================================================================= //=================================================================
@@ -298,11 +296,11 @@ namespace
{ {
OSL_FAIL( "lcl_getHomeDirectory: caught an exception!" ); OSL_FAIL( "lcl_getHomeDirectory: caught an exception!" );
} }
return 0 < _rHomeDir.Len(); return !_rHomeDir.isEmpty();
} }
//--------------------------------------------------------------------- //---------------------------------------------------------------------
static String lcl_ensureFinalSlash( const String& _rDir ) static OUString lcl_ensureFinalSlash( const OUString& _rDir )
{ {
INetURLObject aWorkPathObj( _rDir, INET_PROT_FILE ); INetURLObject aWorkPathObj( _rDir, INET_PROT_FILE );
aWorkPathObj.setFinalSlash(); aWorkPathObj.setFinalSlash();
@@ -310,9 +308,9 @@ namespace
} }
//--------------------------------------------------------------------- //---------------------------------------------------------------------
struct RemoveFinalSlash : public ::std::unary_function< String, void > struct RemoveFinalSlash : public ::std::unary_function< OUString, void >
{ {
void operator()( String& _rURL ) void operator()( OUString& _rURL )
{ {
INetURLObject aURL( _rURL ); INetURLObject aURL( _rURL );
#if defined(WNT) #if defined(WNT)
@@ -431,14 +429,14 @@ SvtFileDialog::SvtFileDialog ( Window* _pParent, WinBits nBits )
SvtFileDialog::~SvtFileDialog() SvtFileDialog::~SvtFileDialog()
{ {
if ( _pImp->_aIniKey.Len() ) if ( !_pImp->_aIniKey.isEmpty() )
{ {
// save window state // save window state
SvtViewOptions aDlgOpt( E_DIALOG, _pImp->_aIniKey ); SvtViewOptions aDlgOpt( E_DIALOG, _pImp->_aIniKey );
aDlgOpt.SetWindowState(OStringToOUString(GetWindowState(), osl_getThreadTextEncoding())); aDlgOpt.SetWindowState(OStringToOUString(GetWindowState(), osl_getThreadTextEncoding()));
String sUserData = _pFileView->GetConfigString(); OUString sUserData = _pFileView->GetConfigString();
aDlgOpt.SetUserItem( OUString( "UserData" ), aDlgOpt.SetUserItem( OUString( "UserData" ),
makeAny( OUString( sUserData ) ) ); makeAny( sUserData ) );
} }
_pFileView->SetSelectHdl( Link() ); _pFileView->SetSelectHdl( Link() );
@@ -818,18 +816,18 @@ IMPL_STATIC_LINK_NOINSTANCE( SvtFileDialog, ViewHdl_Impl, ImageButton*, EMPTYARG
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
sal_Bool SvtFileDialog::createNewUserFilter( const String& _rNewFilter, sal_Bool _bAllowUserDefExt ) sal_Bool SvtFileDialog::createNewUserFilter( const OUString& _rNewFilter, sal_Bool _bAllowUserDefExt )
{ {
// delete the old user filter and create a new one // delete the old user filter and create a new one
DELETEZ( _pImp->_pUserFilter ); DELETEZ( _pImp->_pUserFilter );
_pImp->_pUserFilter = new SvtFileDialogFilter_Impl( _rNewFilter, _rNewFilter ); _pImp->_pUserFilter = new SvtFileDialogFilter_Impl( _rNewFilter, _rNewFilter );
// remember the extension // remember the extension
sal_Bool bIsAllFiles = _rNewFilter.EqualsAscii( FILEDIALOG_FILTER_ALL ); sal_Bool bIsAllFiles = _rNewFilter == FILEDIALOG_FILTER_ALL;
if ( bIsAllFiles ) if ( bIsAllFiles )
EraseDefaultExt(); EraseDefaultExt();
else else
SetDefaultExt( _rNewFilter.Copy( 2 ) ); SetDefaultExt( _rNewFilter.copy( 2 ) );
// TODO: this is nonsense. In the whole file there are a lotta places where we assume that a user filter // TODO: this is nonsense. In the whole file there are a lotta places where we assume that a user filter
// is always "*.<something>". But changing this would take some more time than I have now ... // is always "*.<something>". But changing this would take some more time than I have now ...
@@ -867,11 +865,11 @@ sal_Bool SvtFileDialog::createNewUserFilter( const String& _rNewFilter, sal_Bool
#define FLT_ALLFILESFILTER 0x0008 #define FLT_ALLFILESFILTER 0x0008
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
sal_uInt16 SvtFileDialog::adjustFilter( const String& _rFilter ) sal_uInt16 SvtFileDialog::adjustFilter( const OUString& _rFilter )
{ {
sal_uInt16 nReturn = 0; sal_uInt16 nReturn = 0;
const sal_Bool bNonEmpty = ( _rFilter.Len() != 0 ); const sal_Bool bNonEmpty = !_rFilter.isEmpty();
if ( bNonEmpty ) if ( bNonEmpty )
{ {
nReturn |= FLT_NONEMPTY; nReturn |= FLT_NONEMPTY;
@@ -911,7 +909,7 @@ sal_uInt16 SvtFileDialog::adjustFilter( const String& _rFilter )
#ifdef AUTOSELECT_USERFILTER #ifdef AUTOSELECT_USERFILTER
// select the "all files" entry // select the "all files" entry
String sAllFilesFilter( SvtResId( STR_FILTERNAME_ALL ) ); OUString sAllFilesFilter( SvtResId( STR_FILTERNAME_ALL ) );
if ( _pImp->HasFilterListEntry( sAllFilesFilter ) ) if ( _pImp->HasFilterListEntry( sAllFilesFilter ) )
{ {
_pImp->SelectFilterListEntry( sAllFilesFilter ); _pImp->SelectFilterListEntry( sAllFilesFilter );
@@ -956,13 +954,13 @@ IMPL_STATIC_LINK( SvtFileDialog, OpenHdl_Impl, void*, pVoid )
return 0; return 0;
} }
String aFileName; OUString aFileName;
String aOldPath( pThis->_pFileView->GetViewURL() ); OUString aOldPath( pThis->_pFileView->GetViewURL() );
if ( pThis->_pImp->_bDoubleClick || pThis->_pFileView->HasChildPathFocus() ) if ( pThis->_pImp->_bDoubleClick || pThis->_pFileView->HasChildPathFocus() )
// Selection done by doubleclicking in the view, get filename from the view // Selection done by doubleclicking in the view, get filename from the view
aFileName = pThis->_pFileView->GetCurrentURL(); aFileName = pThis->_pFileView->GetCurrentURL();
if ( !aFileName.Len() ) if ( aFileName.isEmpty() )
{ {
// if an entry is selected in the view .... // if an entry is selected in the view ....
if ( pThis->_pFileView->GetSelectionCount() ) if ( pThis->_pFileView->GetSelectionCount() )
@@ -971,7 +969,7 @@ IMPL_STATIC_LINK( SvtFileDialog, OpenHdl_Impl, void*, pVoid )
} }
} }
if ( !aFileName.Len() ) if ( aFileName.isEmpty() )
{ {
if ( pThis->_pImp->_eMode == FILEDLG_MODE_OPEN && pThis->_pImp->_pEdFileName->IsTravelSelect() ) if ( pThis->_pImp->_eMode == FILEDLG_MODE_OPEN && pThis->_pImp->_pEdFileName->IsTravelSelect() )
// OpenHdl called from URLBox; travelling through the list of URLs should not cause an opening // OpenHdl called from URLBox; travelling through the list of URLs should not cause an opening
@@ -980,26 +978,26 @@ IMPL_STATIC_LINK( SvtFileDialog, OpenHdl_Impl, void*, pVoid )
// get the URL from from the edit field ( if not empty ) // get the URL from from the edit field ( if not empty )
if ( !pThis->_pImp->_pEdFileName->GetText().isEmpty() ) if ( !pThis->_pImp->_pEdFileName->GetText().isEmpty() )
{ {
String aText = pThis->_pImp->_pEdFileName->GetText(); OUString aText = pThis->_pImp->_pEdFileName->GetText();
// did we reach the root? // did we reach the root?
if ( !INetURLObject( aOldPath ).getSegmentCount() ) if ( !INetURLObject( aOldPath ).getSegmentCount() )
{ {
if ( ( aText.Len() == 2 && aText.EqualsAscii( ".." ) ) || if ( ( aText.getLength() == 2 && aText == ".." ) ||
( aText.Len() == 3 && ( aText.EqualsAscii( "..\\" ) || aText.EqualsAscii( "../" ) ) ) ) ( aText.getLength() == 3 && ( aText == "..\\" || aText == "../" ) ) )
// don't go higher than the root // don't go higher than the root
return 0; return 0;
} }
#if defined( UNX ) #if defined( UNX )
if ( ( 1 == aText.Len() ) && ( '~' == aText.GetBuffer()[0] ) ) if ( ( 1 == aText.getLength() ) && ( '~' == aText[0] ) )
{ {
// go to the home directory // go to the home directory
if ( lcl_getHomeDirectory( pThis->_pFileView->GetViewURL(), aFileName ) ) if ( lcl_getHomeDirectory( pThis->_pFileView->GetViewURL(), aFileName ) )
// in case we got a home dir, reset the text of the edit // in case we got a home dir, reset the text of the edit
pThis->_pImp->_pEdFileName->SetText( String() ); pThis->_pImp->_pEdFileName->SetText( OUString() );
} }
if ( !aFileName.Len() ) if ( aFileName.isEmpty() )
#endif #endif
{ {
// get url from autocomplete edit // get url from autocomplete edit
@@ -1012,20 +1010,20 @@ IMPL_STATIC_LINK( SvtFileDialog, OpenHdl_Impl, void*, pVoid )
} }
// MBA->PB: ?! // MBA->PB: ?!
if ( !aFileName.Len() && pVoid == pThis->_pImp->_pEdFileName && pThis->_pImp->_pUserFilter ) if ( aFileName.isEmpty() && pVoid == pThis->_pImp->_pEdFileName && pThis->_pImp->_pUserFilter )
{ {
DELETEZ( pThis->_pImp->_pUserFilter ); DELETEZ( pThis->_pImp->_pUserFilter );
return 0; return 0;
} }
sal_uInt16 nLen = aFileName.Len(); sal_Int32 nLen = aFileName.getLength();
if ( !nLen ) if ( !nLen )
{ {
// if the dialog was opened to select a folder, the last selected folder should be selected // if the dialog was opened to select a folder, the last selected folder should be selected
if( pThis->_pImp->_eDlgType == FILEDLG_TYPE_PATHDLG ) if( pThis->_pImp->_eDlgType == FILEDLG_TYPE_PATHDLG )
{ {
aFileName = pThis->_pImp->_pEdCurrentPath->GetText(); aFileName = pThis->_pImp->_pEdCurrentPath->GetText();
nLen = aFileName.Len(); nLen = aFileName.getLength();
} }
else else
// no file selected ! // no file selected !
@@ -1036,7 +1034,7 @@ IMPL_STATIC_LINK( SvtFileDialog, OpenHdl_Impl, void*, pVoid )
pThis->_pImp->_pEdFileName->SetSelection( Selection( 0, nLen ) ); pThis->_pImp->_pEdFileName->SetSelection( Selection( 0, nLen ) );
// if a path with wildcards is given, divide the string into path and wildcards // if a path with wildcards is given, divide the string into path and wildcards
String aFilter; OUString aFilter;
if ( !pThis->IsolateFilterFromPath_Impl( aFileName, aFilter ) ) if ( !pThis->IsolateFilterFromPath_Impl( aFileName, aFilter ) )
return 0; return 0;
@@ -1046,15 +1044,15 @@ IMPL_STATIC_LINK( SvtFileDialog, OpenHdl_Impl, void*, pVoid )
{ {
// cut off all text before wildcard in edit and select wildcard // cut off all text before wildcard in edit and select wildcard
pThis->_pImp->_pEdFileName->SetText( aFilter ); pThis->_pImp->_pEdFileName->SetText( aFilter );
pThis->_pImp->_pEdFileName->SetSelection( Selection( 0, aFilter.Len() ) ); pThis->_pImp->_pEdFileName->SetSelection( Selection( 0, aFilter.getLength() ) );
} }
{ {
INetURLObject aFileObject( aFileName ); INetURLObject aFileObject( aFileName );
if ( ( aFileObject.GetProtocol() == INET_PROT_NOT_VALID ) && aFileName.Len() ) if ( ( aFileObject.GetProtocol() == INET_PROT_NOT_VALID ) && !aFileName.isEmpty() )
{ {
String sCompleted = SvtURLBox::ParseSmart( aFileName, pThis->_pFileView->GetViewURL(), SvtPathOptions().GetWorkPath() ); OUString sCompleted = SvtURLBox::ParseSmart( aFileName, pThis->_pFileView->GetViewURL(), SvtPathOptions().GetWorkPath() );
if ( sCompleted.Len() ) if ( !sCompleted.isEmpty() )
aFileName = sCompleted; aFileName = sCompleted;
} }
} }
@@ -1069,7 +1067,7 @@ IMPL_STATIC_LINK( SvtFileDialog, OpenHdl_Impl, void*, pVoid )
// error messages for the same content a second time .... // error messages for the same content a second time ....
pThis->m_aContent.bindTo( OUString( ) ); pThis->m_aContent.bindTo( OUString( ) );
if ( aFileName.Len() ) if ( !aFileName.isEmpty() )
{ {
// Make sure we have own Interaction Handler in place. We do not need // Make sure we have own Interaction Handler in place. We do not need
// to intercept interactions here, but to record the fact that there // to intercept interactions here, but to record the fact that there
@@ -1112,7 +1110,7 @@ IMPL_STATIC_LINK( SvtFileDialog, OpenHdl_Impl, void*, pVoid )
if ( !bIsFolder // no existent folder if ( !bIsFolder // no existent folder
&& pThis->_pImp->_pCbAutoExtension // auto extension is enabled in general && pThis->_pImp->_pCbAutoExtension // auto extension is enabled in general
&& pThis->_pImp->_pCbAutoExtension->IsChecked() // auto extension is really to be used && pThis->_pImp->_pCbAutoExtension->IsChecked() // auto extension is really to be used
&& pThis->GetDefaultExt().Len() // there is a default extension && !pThis->GetDefaultExt().isEmpty() // there is a default extension
&& !comphelper::string::equals(pThis->GetDefaultExt(), '*') // the default extension is not "all" && !comphelper::string::equals(pThis->GetDefaultExt(), '*') // the default extension is not "all"
&& !( FILEDLG_MODE_SAVE == pThis->_pImp->_eMode // we're saving a file && !( FILEDLG_MODE_SAVE == pThis->_pImp->_eMode // we're saving a file
&& pThis->_pFileView->GetSelectionCount() // there is a selected file in the file view -> it will later on && pThis->_pFileView->GetSelectionCount() // there is a selected file in the file view -> it will later on
@@ -1176,9 +1174,9 @@ IMPL_STATIC_LINK( SvtFileDialog, OpenHdl_Impl, void*, pVoid )
{ {
if ( ::utl::UCBContentHelper::Exists( aFileObj.GetMainURL( INetURLObject::NO_DECODE ) ) ) if ( ::utl::UCBContentHelper::Exists( aFileObj.GetMainURL( INetURLObject::NO_DECODE ) ) )
{ {
String aMsg = SVT_RESSTR( STR_SVT_ALREADYEXISTOVERWRITE ); OUString aMsg = SVT_RESSTR( STR_SVT_ALREADYEXISTOVERWRITE );
aMsg.SearchAndReplace( aMsg = aMsg.replaceFirst(
String( RTL_CONSTASCII_USTRINGPARAM( "$filename$" ) ), "$filename$",
aFileObj.getName(INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET) aFileObj.getName(INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET)
); );
QueryBox aBox( pThis, WB_YES_NO, aMsg ); QueryBox aBox( pThis, WB_YES_NO, aMsg );
@@ -1216,9 +1214,9 @@ IMPL_STATIC_LINK( SvtFileDialog, OpenHdl_Impl, void*, pVoid )
if ( !bExists ) if ( !bExists )
{ {
String sError( SVT_RESSTR( RID_FILEOPEN_NOTEXISTENTFILE ) ); OUString sError( SVT_RESSTR( RID_FILEOPEN_NOTEXISTENTFILE ) );
String sInvalidFile( aFileObj.GetMainURL( INetURLObject::DECODE_TO_IURI ) ); OUString sInvalidFile( aFileObj.GetMainURL( INetURLObject::DECODE_TO_IURI ) );
if ( INET_PROT_FILE == aFileObj.GetProtocol() ) if ( INET_PROT_FILE == aFileObj.GetProtocol() )
{ // if it's a file URL, transform the URL into system notation { // if it's a file URL, transform the URL into system notation
OUString sURL( sInvalidFile ); OUString sURL( sInvalidFile );
@@ -1226,7 +1224,7 @@ IMPL_STATIC_LINK( SvtFileDialog, OpenHdl_Impl, void*, pVoid )
osl_getSystemPathFromFileURL( sURL.pData, &sSystem.pData ); osl_getSystemPathFromFileURL( sURL.pData, &sSystem.pData );
sInvalidFile = sSystem; sInvalidFile = sSystem;
} }
sError.SearchAndReplaceAscii( "$name$", sInvalidFile ); sError = sError.replaceFirst( "$name$", sInvalidFile );
ErrorBox aError( pThis, WB_OK, sError ); ErrorBox aError( pThis, WB_OK, sError );
aError.Execute(); aError.Execute();
@@ -1277,7 +1275,7 @@ IMPL_STATIC_LINK( SvtFileDialog, FilterSelectHdl_Impl, ListBox*, pBox )
return 0; return 0;
} }
String sSelectedFilterDisplayName; OUString sSelectedFilterDisplayName;
SvtFileDialogFilter_Impl* pSelectedFilter = pThis->_pImp->GetSelectedFilterEntry( sSelectedFilterDisplayName ); SvtFileDialogFilter_Impl* pSelectedFilter = pThis->_pImp->GetSelectedFilterEntry( sSelectedFilterDisplayName );
if ( !pSelectedFilter ) if ( !pSelectedFilter )
{ // there is no current selection. This happens if for instance the user selects a group separator using { // there is no current selection. This happens if for instance the user selects a group separator using
@@ -1311,7 +1309,7 @@ IMPL_STATIC_LINK( SvtFileDialog, FilterSelectHdl_Impl, ListBox*, pBox )
) )
{ {
// Store the old filter for the auto extension handling // Store the old filter for the auto extension handling
String sLastFilterExt = pThis->_pImp->GetCurFilter()->GetExtension(); OUString sLastFilterExt = pThis->_pImp->GetCurFilter()->GetExtension();
DELETEZ( pThis->_pImp->_pUserFilter ); DELETEZ( pThis->_pImp->_pUserFilter );
// if applicable remove filter of the user // if applicable remove filter of the user
@@ -1319,9 +1317,9 @@ IMPL_STATIC_LINK( SvtFileDialog, FilterSelectHdl_Impl, ListBox*, pBox )
// if applicable show extension // if applicable show extension
pThis->SetDefaultExt( pSelectedFilter->GetExtension() ); pThis->SetDefaultExt( pSelectedFilter->GetExtension() );
sal_uInt16 nSepPos = pThis->GetDefaultExt().Search( FILEDIALOG_DEF_EXTSEP ); sal_Int32 nSepPos = pThis->GetDefaultExt().indexOf( FILEDIALOG_DEF_EXTSEP );
if ( nSepPos != STRING_NOTFOUND ) if ( nSepPos != -1 )
pThis->EraseDefaultExt( nSepPos ); pThis->EraseDefaultExt( nSepPos );
// update the extension of the current file if necessary // update the extension of the current file if necessary
@@ -1370,7 +1368,7 @@ IMPL_STATIC_LINK( SvtFileDialog, FileNameModifiedHdl_Impl, void*, EMPTYARG )
IMPL_STATIC_LINK ( SvtFileDialog, URLBoxModifiedHdl_Impl, void*, EMPTYARG ) IMPL_STATIC_LINK ( SvtFileDialog, URLBoxModifiedHdl_Impl, void*, EMPTYARG )
{ {
String _aPath = pThis->_pImp->_pEdCurrentPath->GetURL(); OUString _aPath = pThis->_pImp->_pEdCurrentPath->GetURL();
pThis->OpenURL_Impl(_aPath); pThis->OpenURL_Impl(_aPath);
return 0; return 0;
} }
@@ -1427,7 +1425,7 @@ IMPL_LINK_NOARG ( SvtFileDialog, RemovePlacePressed_Hdl )
SvtFileDialogFilter_Impl* SvtFileDialog::FindFilter_Impl SvtFileDialogFilter_Impl* SvtFileDialog::FindFilter_Impl
( (
const String& _rFilter, const OUString& _rFilter,
sal_Bool _bMultiExt,/* TRUE - regard filter with several extensions sal_Bool _bMultiExt,/* TRUE - regard filter with several extensions
FALSE - do not ... FALSE - do not ...
*/ */
@@ -1489,7 +1487,7 @@ SvtFileDialogFilter_Impl* SvtFileDialog::FindFilter_Impl
void SvtFileDialog::ExecuteFilter() void SvtFileDialog::ExecuteFilter()
{ {
_pImp->m_bNeedDelayedFilterExecute = sal_False; _pImp->m_bNeedDelayedFilterExecute = sal_False;
executeAsync( AsyncPickerAction::eExecuteFilter, String(), getMostCurrentFilter( _pImp ) ); executeAsync( AsyncPickerAction::eExecuteFilter, OUString(), getMostCurrentFilter( _pImp ) );
} }
//***************************************************************************** //*****************************************************************************
@@ -1522,7 +1520,7 @@ void SvtFileDialog::OpenMultiSelection_Impl()
//***************************************************************************** //*****************************************************************************
void SvtFileDialog::UpdateControls( const String& rURL ) void SvtFileDialog::UpdateControls( const OUString& rURL )
{ {
_pImp->_pEdFileName->SetBaseURL( rURL ); _pImp->_pEdFileName->SetBaseURL( rURL );
@@ -1540,8 +1538,7 @@ void SvtFileDialog::UpdateControls( const String& rURL )
{ {
// no Fsys path for server file system ( only UCB has mountpoints! ) // no Fsys path for server file system ( only UCB has mountpoints! )
if ( INET_PROT_FILE != aObj.GetProtocol() ) if ( INET_PROT_FILE != aObj.GetProtocol() )
sText = rURL.Copy( static_cast< sal_uInt16 >( sText = rURL.copy( INetURLObject::GetScheme( aObj.GetProtocol() ).getLength() );
INetURLObject::GetScheme( aObj.GetProtocol() ).getLength() ) );
} }
if ( sText.isEmpty() && aObj.getSegmentCount() ) if ( sText.isEmpty() && aObj.getSegmentCount() )
@@ -1557,12 +1554,12 @@ void SvtFileDialog::UpdateControls( const String& rURL )
if ( aObj.hasFinalSlash() ) if ( aObj.hasFinalSlash() )
{ {
aObj.removeFinalSlash(); aObj.removeFinalSlash();
String sURL( aObj.GetMainURL( INetURLObject::NO_DECODE ) ); OUString sURL( aObj.GetMainURL( INetURLObject::NO_DECODE ) );
if ( !::utl::LocalFileHelper::ConvertURLToSystemPath( sURL, sText ) ) if ( !::utl::LocalFileHelper::ConvertURLToSystemPath( sURL, sText ) )
sText = sURL; sText = sURL;
} }
if ( sText.isEmpty() && rURL.Len() ) if ( sText.isEmpty() && !rURL.isEmpty() )
// happens, for instance, for URLs which the INetURLObject does not know to belong to a hierarchical scheme // happens, for instance, for URLs which the INetURLObject does not know to belong to a hierarchical scheme
sText = rURL; sText = rURL;
_pImp->_pEdCurrentPath->SetText( sText ); _pImp->_pEdCurrentPath->SetText( sText );
@@ -1591,9 +1588,9 @@ IMPL_LINK( SvtFileDialog, SelectHdl_Impl, SvTabListBox*, pBox )
{ {
if ( !pUserData->mbIsFolder ) if ( !pUserData->mbIsFolder )
aObj.removeSegment(); aObj.removeSegment();
String aName = aObj.getFSysPath( (INetURLObject::FSysStyle)(INetURLObject::FSYS_DETECT & ~INetURLObject::FSYS_VOS) ); OUString aName = aObj.getFSysPath( (INetURLObject::FSysStyle)(INetURLObject::FSYS_DETECT & ~INetURLObject::FSYS_VOS) );
_pImp->_pEdFileName->SetText( aName ); _pImp->_pEdFileName->SetText( aName );
_pImp->_pEdFileName->SetSelection( Selection( 0, aName.Len() ) ); _pImp->_pEdFileName->SetSelection( Selection( 0, aName.getLength() ) );
_aPath = pUserData->maURL; _aPath = pUserData->maURL;
} }
else if ( !pUserData->mbIsFolder ) else if ( !pUserData->mbIsFolder )
@@ -1609,9 +1606,9 @@ IMPL_LINK( SvtFileDialog, SelectHdl_Impl, SvTabListBox*, pBox )
{ {
if ( !pUserData->mbIsFolder ) if ( !pUserData->mbIsFolder )
{ {
String aName = pBox->GetEntryText( pEntry, 0 ); OUString aName = pBox->GetEntryText( pEntry, 0 );
_pImp->_pEdFileName->SetText( aName ); _pImp->_pEdFileName->SetText( aName );
_pImp->_pEdFileName->SetSelection( Selection( 0, aName.Len() ) ); _pImp->_pEdFileName->SetSelection( Selection( 0, aName.getLength() ) );
_aPath = pUserData->maURL; _aPath = pUserData->maURL;
} }
} }
@@ -1620,7 +1617,7 @@ IMPL_LINK( SvtFileDialog, SelectHdl_Impl, SvTabListBox*, pBox )
if ( _pImp->_bMultiSelection && _pFileView->GetSelectionCount() > 1 ) if ( _pImp->_bMultiSelection && _pFileView->GetSelectionCount() > 1 )
{ {
// clear the file edit for multiselection // clear the file edit for multiselection
_pImp->_pEdFileName->SetText( String() ); _pImp->_pEdFileName->SetText( OUString() );
} }
FileSelect(); FileSelect();
@@ -1652,7 +1649,7 @@ IMPL_LINK_NOARG(SvtFileDialog, EntrySelectHdl_Impl)
IMPL_LINK( SvtFileDialog, OpenDoneHdl_Impl, SvtFileView*, pView ) IMPL_LINK( SvtFileDialog, OpenDoneHdl_Impl, SvtFileView*, pView )
{ {
String sCurrentFolder( pView->GetViewURL() ); OUString sCurrentFolder( pView->GetViewURL() );
// check if we can create new folders // check if we can create new folders
EnableControl( _pImp->_pBtnNewFolder, ContentCanMakeFolder( sCurrentFolder ) ); EnableControl( _pImp->_pBtnNewFolder, ContentCanMakeFolder( sCurrentFolder ) );
@@ -1822,7 +1819,7 @@ void SvtFileDialog::updateListboxLabelSizes()
namespace namespace
{ {
bool implIsInvalid( const String & rURL ) bool implIsInvalid( const OUString & rURL )
{ {
SmartContent aContent( rURL ); SmartContent aContent( rURL );
aContent.enableOwnInteractionHandler( ::svt::OFilePickerInteractionHandler::E_DOESNOTEXIST ); aContent.enableOwnInteractionHandler( ::svt::OFilePickerInteractionHandler::E_DOESNOTEXIST );
@@ -1833,7 +1830,7 @@ bool implIsInvalid( const String & rURL )
} }
//--------------------------------------------------------------------- //---------------------------------------------------------------------
String SvtFileDialog::implGetInitialURL( const String& _rPath, const String& _rFallback ) OUString SvtFileDialog::implGetInitialURL( const OUString& _rPath, const OUString& _rFallback )
{ {
// an URL parser for the fallback // an URL parser for the fallback
INetURLObject aURLParser; INetURLObject aURLParser;
@@ -1952,7 +1949,7 @@ void SvtFileDialog::RemovablePlaceSelected(bool enable)
} }
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
void SvtFileDialog::displayIOException( const String& _rURL, IOErrorCode _eCode ) void SvtFileDialog::displayIOException( const OUString& _rURL, IOErrorCode _eCode )
{ {
try try
{ {
@@ -2086,24 +2083,24 @@ short SvtFileDialog::PrepareExecute()
m_aContent.enableDefaultInteractionHandler(); m_aContent.enableDefaultInteractionHandler();
// possibly just a filename without a path // possibly just a filename without a path
String aFileNameOnly; OUString aFileNameOnly;
if( _aPath.Len() && (_pImp->_eMode == FILEDLG_MODE_SAVE) if( !_aPath.isEmpty() && (_pImp->_eMode == FILEDLG_MODE_SAVE)
&& (_aPath.Search(':') == STRING_NOTFOUND) && (_aPath.indexOf(':') == -1)
&& (_aPath.Search('\\') == STRING_NOTFOUND) && (_aPath.indexOf('\\') == -1)
&& (_aPath.Search('/') == STRING_NOTFOUND)) && (_aPath.indexOf('/') == -1))
{ {
aFileNameOnly = _aPath; aFileNameOnly = _aPath;
_aPath.Erase(); _aPath = "";
} }
// no starting path specified? // no starting path specified?
if ( !_aPath.Len() ) if ( _aPath.isEmpty() )
{ {
// then use the standard directory // then use the standard directory
_aPath = lcl_ensureFinalSlash( _pImp->GetStandardDir() ); _aPath = lcl_ensureFinalSlash( _pImp->GetStandardDir() );
// attach given filename to path // attach given filename to path
if ( aFileNameOnly.Len() ) if ( !aFileNameOnly.isEmpty() )
_aPath += aFileNameOnly; _aPath += aFileNameOnly;
} }
@@ -2146,8 +2143,8 @@ short SvtFileDialog::PrepareExecute()
// adjust view // adjust view
_pImp->SelectFilterListEntry( _pImp->GetCurFilter()->GetName() ); _pImp->SelectFilterListEntry( _pImp->GetCurFilter()->GetName() );
SetDefaultExt( _pImp->GetCurFilter()->GetExtension() ); SetDefaultExt( _pImp->GetCurFilter()->GetExtension() );
sal_uInt16 nSepPos = GetDefaultExt().Search( FILEDIALOG_DEF_EXTSEP ); sal_Int32 nSepPos = GetDefaultExt().indexOf( FILEDIALOG_DEF_EXTSEP );
if ( nSepPos != STRING_NOTFOUND ) if ( nSepPos != -1 )
EraseDefaultExt( nSepPos ); EraseDefaultExt( nSepPos );
} }
else else
@@ -2165,7 +2162,7 @@ short SvtFileDialog::PrepareExecute()
_pImp->_pDefaultFilter = _pImp->GetCurFilter(); _pImp->_pDefaultFilter = _pImp->GetCurFilter();
// if applicable isolate filter // if applicable isolate filter
String aFilter; OUString aFilter;
if ( !IsolateFilterFromPath_Impl( _aPath, aFilter ) ) if ( !IsolateFilterFromPath_Impl( _aPath, aFilter ) )
return 0; return 0;
@@ -2178,10 +2175,10 @@ short SvtFileDialog::PrepareExecute()
// create and show instance for set path // create and show instance for set path
INetURLObject aFolderURL( _aPath ); INetURLObject aFolderURL( _aPath );
String aFileName( aFolderURL.getName( INetURLObject::LAST_SEGMENT, false ) ); OUString aFileName( aFolderURL.getName( INetURLObject::LAST_SEGMENT, false ) );
xub_StrLen nFileNameLen = aFileName.Len(); xub_StrLen nFileNameLen = aFileName.getLength();
bool bFileToSelect = nFileNameLen != 0; bool bFileToSelect = nFileNameLen != 0;
if ( bFileToSelect && aFileName.GetChar( nFileNameLen - 1 ) != INET_PATH_TOKEN ) if ( bFileToSelect && aFileName[ nFileNameLen - 1 ] != INET_PATH_TOKEN )
{ {
_pImp->_pEdFileName->SetText( GET_DECODED_NAME( aFolderURL ) ); _pImp->_pEdFileName->SetText( GET_DECODED_NAME( aFolderURL ) );
aFolderURL.removeSegment(); aFolderURL.removeSegment();
@@ -2214,7 +2211,7 @@ short SvtFileDialog::PrepareExecute()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void SvtFileDialog::executeAsync( ::svt::AsyncPickerAction::Action _eAction, void SvtFileDialog::executeAsync( ::svt::AsyncPickerAction::Action _eAction,
const String& _rURL, const String& _rFilter ) const OUString& _rURL, const OUString& _rFilter )
{ {
DBG_ASSERT( !m_pCurrentAsyncAction.is(), "SvtFileDialog::executeAsync: previous async action not yet finished!" ); DBG_ASSERT( !m_pCurrentAsyncAction.is(), "SvtFileDialog::executeAsync: previous async action not yet finished!" );
@@ -2252,7 +2249,7 @@ void SvtFileDialog::FilterSelect()
//***************************************************************************** //*****************************************************************************
void SvtFileDialog::SetStandardDir( const String& rStdDir ) void SvtFileDialog::SetStandardDir( const OUString& rStdDir )
/* [Description] /* [Description]
@@ -2279,7 +2276,7 @@ const ::com::sun::star::uno::Sequence< OUString >& SvtFileDialog::GetBlackList()
} }
//***************************************************************************** //*****************************************************************************
const String& SvtFileDialog::GetStandardDir() const const OUString& SvtFileDialog::GetStandardDir() const
/* [Description] /* [Description]
@@ -2296,13 +2293,13 @@ void SvtFileDialog::PrevLevel_Impl()
{ {
_pFileView->EndInplaceEditing( false ); _pFileView->EndInplaceEditing( false );
String sDummy; OUString sDummy;
executeAsync( AsyncPickerAction::ePrevLevel, sDummy, sDummy ); executeAsync( AsyncPickerAction::ePrevLevel, sDummy, sDummy );
} }
//***************************************************************************** //*****************************************************************************
void SvtFileDialog::OpenURL_Impl( const String& _rURL ) void SvtFileDialog::OpenURL_Impl( const OUString& _rURL )
{ {
_pFileView->EndInplaceEditing( false ); _pFileView->EndInplaceEditing( false );
@@ -2310,7 +2307,7 @@ void SvtFileDialog::OpenURL_Impl( const String& _rURL )
} }
//***************************************************************************** //*****************************************************************************
SvtFileDialogFilter_Impl* SvtFileDialog::implAddFilter( const String& _rFilter, const String& _rType ) SvtFileDialogFilter_Impl* SvtFileDialog::implAddFilter( const OUString& _rFilter, const OUString& _rType )
{ {
SvtFileDialogFilter_Impl* pNewFilter = new SvtFileDialogFilter_Impl( _rFilter, _rType ); SvtFileDialogFilter_Impl* pNewFilter = new SvtFileDialogFilter_Impl( _rFilter, _rType );
_pImp->_pFilter->push_front( pNewFilter ); _pImp->_pFilter->push_front( pNewFilter );
@@ -2323,18 +2320,18 @@ SvtFileDialogFilter_Impl* SvtFileDialog::implAddFilter( const String& _rFilter,
//***************************************************************************** //*****************************************************************************
void SvtFileDialog::AddFilter( const String& _rFilter, const String& _rType ) void SvtFileDialog::AddFilter( const OUString& _rFilter, const OUString& _rType )
{ {
DBG_ASSERT( !IsInExecute(), "SvtFileDialog::AddFilter: currently executing!" ); DBG_ASSERT( !IsInExecute(), "SvtFileDialog::AddFilter: currently executing!" );
implAddFilter ( _rFilter, _rType ); implAddFilter ( _rFilter, _rType );
} }
//***************************************************************************** //*****************************************************************************
void SvtFileDialog::AddFilterGroup( const String& _rFilter, const Sequence< StringPair >& _rFilters ) void SvtFileDialog::AddFilterGroup( const OUString& _rFilter, const Sequence< StringPair >& _rFilters )
{ {
DBG_ASSERT( !IsInExecute(), "SvtFileDialog::AddFilter: currently executing!" ); DBG_ASSERT( !IsInExecute(), "SvtFileDialog::AddFilter: currently executing!" );
implAddFilter( _rFilter, String() ); implAddFilter( _rFilter, OUString() );
const StringPair* pSubFilters = _rFilters.getConstArray(); const StringPair* pSubFilters = _rFilters.getConstArray();
const StringPair* pSubFiltersEnd = pSubFilters + _rFilters.getLength(); const StringPair* pSubFiltersEnd = pSubFilters + _rFilters.getLength();
for ( ; pSubFilters != pSubFiltersEnd; ++pSubFilters ) for ( ; pSubFilters != pSubFiltersEnd; ++pSubFilters )
@@ -2342,7 +2339,7 @@ void SvtFileDialog::AddFilterGroup( const String& _rFilter, const Sequence< Stri
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void SvtFileDialog::SetCurFilter( const String& rFilter ) void SvtFileDialog::SetCurFilter( const OUString& rFilter )
{ {
DBG_ASSERT( !IsInExecute(), "SvtFileDialog::SetCurFilter: currently executing!" ); DBG_ASSERT( !IsInExecute(), "SvtFileDialog::SetCurFilter: currently executing!" );
@@ -2362,9 +2359,9 @@ void SvtFileDialog::SetCurFilter( const String& rFilter )
//***************************************************************************** //*****************************************************************************
String SvtFileDialog::GetCurFilter() const OUString SvtFileDialog::GetCurFilter() const
{ {
String aFilter; OUString aFilter;
const SvtFileDialogFilter_Impl* pCurrentFilter = _pImp->GetCurFilter(); const SvtFileDialogFilter_Impl* pCurrentFilter = _pImp->GetCurFilter();
if ( pCurrentFilter ) if ( pCurrentFilter )
@@ -2373,7 +2370,7 @@ String SvtFileDialog::GetCurFilter() const
return aFilter; return aFilter;
} }
String SvtFileDialog::getCurFilter( ) const OUString SvtFileDialog::getCurFilter( ) const
{ {
return GetCurFilter(); return GetCurFilter();
} }
@@ -2387,7 +2384,7 @@ sal_uInt16 SvtFileDialog::GetFilterCount() const
//***************************************************************************** //*****************************************************************************
const String& SvtFileDialog::GetFilterName( sal_uInt16 nPos ) const const OUString& SvtFileDialog::GetFilterName( sal_uInt16 nPos ) const
{ {
DBG_ASSERT( nPos < GetFilterCount(), "invalid index" ); DBG_ASSERT( nPos < GetFilterCount(), "invalid index" );
return (*_pImp->_pFilter)[ nPos ].GetName(); return (*_pImp->_pFilter)[ nPos ].GetName();
@@ -2397,7 +2394,7 @@ const String& SvtFileDialog::GetFilterName( sal_uInt16 nPos ) const
void SvtFileDialog::InitSize() void SvtFileDialog::InitSize()
{ {
if ( ! _pImp->_aIniKey.Len() ) if ( _pImp->_aIniKey.isEmpty() )
return; return;
Size aDlgSize = GetResizeOutputSizePixel(); Size aDlgSize = GetResizeOutputSizePixel();
@@ -2421,7 +2418,7 @@ void SvtFileDialog::InitSize()
Any aUserData = aDlgOpt.GetUserItem( OUString( "UserData" )); Any aUserData = aDlgOpt.GetUserItem( OUString( "UserData" ));
OUString sCfgStr; OUString sCfgStr;
if ( aUserData >>= sCfgStr ) if ( aUserData >>= sCfgStr )
_pFileView->SetConfigString( String( sCfgStr ) ); _pFileView->SetConfigString( sCfgStr );
} }
} }
@@ -2501,28 +2498,28 @@ void SvtFileDialog::implArrangeControls()
//***************************************************************************** //*****************************************************************************
sal_Bool SvtFileDialog::IsolateFilterFromPath_Impl( String& rPath, String& rFilter ) sal_Bool SvtFileDialog::IsolateFilterFromPath_Impl( OUString& rPath, OUString& rFilter )
{ {
String aEmpty; OUString aEmpty;
String aReversePath = comphelper::string::reverseString(rPath); OUString aReversePath = comphelper::string::reverseString(rPath);
sal_uInt16 nQuestionMarkPos = rPath.Search( '?' ); sal_Int32 nQuestionMarkPos = rPath.indexOf( '?' );
if ( nQuestionMarkPos != STRING_NOTFOUND ) if ( nQuestionMarkPos != -1 )
{ {
// use question mark as wildcard only for files // use question mark as wildcard only for files
INetProtocol eProt = INetURLObject::CompareProtocolScheme( rPath ); INetProtocol eProt = INetURLObject::CompareProtocolScheme( rPath );
if ( INET_PROT_NOT_VALID != eProt && INET_PROT_FILE != eProt ) if ( INET_PROT_NOT_VALID != eProt && INET_PROT_FILE != eProt )
nQuestionMarkPos = STRING_NOTFOUND; nQuestionMarkPos = -1;
} }
sal_uInt16 nWildCardPos = std::min( rPath.Search( FILEDIALOG_DEF_WILDCARD ), nQuestionMarkPos ); sal_Int32 nWildCardPos = std::min( rPath.indexOf( FILEDIALOG_DEF_WILDCARD ), nQuestionMarkPos );
rFilter = aEmpty; rFilter = aEmpty;
if ( nWildCardPos != STRING_NOTFOUND ) if ( nWildCardPos != -1 )
{ {
sal_uInt16 nPathTokenPos = aReversePath.Search( INET_PATH_TOKEN ); sal_Int32 nPathTokenPos = aReversePath.indexOf( INET_PATH_TOKEN );
if ( nPathTokenPos == STRING_NOTFOUND ) if ( nPathTokenPos == -1 )
{ {
OUString aDelim( OUString aDelim(
#if defined(WNT) #if defined(WNT)
@@ -2532,19 +2529,19 @@ sal_Bool SvtFileDialog::IsolateFilterFromPath_Impl( String& rPath, String& rFilt
#endif #endif
); );
nPathTokenPos = aReversePath.Search( aDelim ); nPathTokenPos = aReversePath.indexOf( aDelim );
#if !defined( UNX ) #if !defined( UNX )
if ( nPathTokenPos == STRING_NOTFOUND ) if ( nPathTokenPos == -1 )
{ {
nPathTokenPos = aReversePath.Search( ':' ); nPathTokenPos = aReversePath.indexOf( ':' );
} }
#endif #endif
} }
// check syntax // check syntax
if ( nPathTokenPos != STRING_NOTFOUND ) if ( nPathTokenPos != -1 )
{ {
if ( nPathTokenPos < (rPath.Len() - nWildCardPos - 1) ) if ( nPathTokenPos < (rPath.getLength() - nWildCardPos - 1) )
{ {
ErrorHandler::HandleError( ERRCODE_SFX_INVALIDSYNTAX ); ErrorHandler::HandleError( ERRCODE_SFX_INVALIDSYNTAX );
return sal_False; return sal_False;
@@ -2552,12 +2549,12 @@ sal_Bool SvtFileDialog::IsolateFilterFromPath_Impl( String& rPath, String& rFilt
// cut off filter // cut off filter
rFilter = aReversePath; rFilter = aReversePath;
rFilter.Erase( nPathTokenPos ); rFilter = rFilter.copy( 0, nPathTokenPos );
rFilter = comphelper::string::reverseString(rFilter); rFilter = comphelper::string::reverseString(rFilter);
// determine folder // determine folder
rPath = aReversePath; rPath = aReversePath;
rPath.Erase( 0, nPathTokenPos ); rPath = rPath.copy( nPathTokenPos );
rPath = comphelper::string::reverseString(rPath); rPath = comphelper::string::reverseString(rPath);
} }
else else
@@ -3055,22 +3052,22 @@ sal_Bool SvtFileDialog::setShowState( sal_Bool /*bShowState*/ )
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
String SvtFileDialog::getCurrentFileText( ) const OUString SvtFileDialog::getCurrentFileText( ) const
{ {
String sReturn; OUString sReturn;
if ( _pImp && _pImp->_pEdFileName ) if ( _pImp && _pImp->_pEdFileName )
sReturn = _pImp->_pEdFileName->GetText(); sReturn = _pImp->_pEdFileName->GetText();
return sReturn; return sReturn;
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
void SvtFileDialog::setCurrentFileText( const String& _rText, bool _bSelectAll ) void SvtFileDialog::setCurrentFileText( const OUString& _rText, bool _bSelectAll )
{ {
if ( _pImp && _pImp->_pEdFileName ) if ( _pImp && _pImp->_pEdFileName )
{ {
_pImp->_pEdFileName->SetText( _rText ); _pImp->_pEdFileName->SetText( _rText );
if ( _bSelectAll ) if ( _bSelectAll )
_pImp->_pEdFileName->SetSelection( Selection( 0, _rText.Len() ) ); _pImp->_pEdFileName->SetSelection( Selection( 0, _rText.getLength() ) );
} }
} }
@@ -3257,7 +3254,7 @@ sal_Bool SvtFileDialog::ContentCanMakeFolder( const OUString& rURL )
return m_aContent.canCreateFolder( ) && m_aContent.isValid(); return m_aContent.canCreateFolder( ) && m_aContent.isValid();
} }
sal_Bool SvtFileDialog::ContentGetTitle( const OUString& rURL, String& rTitle ) sal_Bool SvtFileDialog::ContentGetTitle( const OUString& rURL, OUString& rTitle )
{ {
m_aContent.bindTo( rURL ); m_aContent.bindTo( rURL );
@@ -3271,9 +3268,9 @@ sal_Bool SvtFileDialog::ContentGetTitle( const OUString& rURL, String& rTitle )
return m_aContent.isValid(); return m_aContent.isValid();
} }
void SvtFileDialog::appendDefaultExtension(String& _rFileName, void SvtFileDialog::appendDefaultExtension(OUString& _rFileName,
const String& _rFilterDefaultExtension, const OUString& _rFilterDefaultExtension,
const String& _rFilterExtensions) const OUString& _rFilterExtensions)
{ {
OUString aTemp(_rFileName); OUString aTemp(_rFileName);
aTemp = aTemp.toAsciiLowerCase(); aTemp = aTemp.toAsciiLowerCase();
@@ -3301,7 +3298,7 @@ void SvtFileDialog::appendDefaultExtension(String& _rFileName,
if ( nIndex >= nWildCard ) if ( nIndex >= nWildCard )
{ {
_rFileName += '.'; _rFileName += ".";
_rFileName += _rFilterDefaultExtension; _rFileName += _rFilterDefaultExtension;
} }
} }
@@ -3392,8 +3389,8 @@ IMPL_LINK_NOARG(QueryFolderNameDialog, OKHdl)
IMPL_LINK_NOARG(QueryFolderNameDialog, NameHdl) IMPL_LINK_NOARG(QueryFolderNameDialog, NameHdl)
{ {
// trim the strings // trim the strings
String aName = comphelper::string::strip(aNameEdit.GetText(), ' '); OUString aName = comphelper::string::strip(aNameEdit.GetText(), ' ');
if ( aName.Len() ) if ( !aName.isEmpty() )
{ {
if ( !aOKBtn.IsEnabled() ) if ( !aOKBtn.IsEnabled() )
aOKBtn.Enable( sal_True ); aOKBtn.Enable( sal_True );

View File

@@ -141,7 +141,7 @@ private:
@return @return
the filter which has been found the filter which has been found
*/ */
SvtFileDialogFilter_Impl* FindFilter_Impl( const String& _rFilter, SvtFileDialogFilter_Impl* FindFilter_Impl( const OUString& _rFilter,
sal_Bool _bMultiExt, sal_Bool _bMultiExt,
sal_Bool& _rFilterChanged sal_Bool& _rFilterChanged
); );
@@ -159,7 +159,7 @@ private:
// removes a filter with wildcards from the path and returns it // removes a filter with wildcards from the path and returns it
sal_Bool IsolateFilterFromPath_Impl( String& rPath, String& rFilter ); sal_Bool IsolateFilterFromPath_Impl( OUString& rPath, OUString& rFilter );
void implArrangeControls(); void implArrangeControls();
void implUpdateImages( ); void implUpdateImages( );
@@ -173,8 +173,8 @@ protected:
Link _aFileSelectHdl; Link _aFileSelectHdl;
Link _aFilterSelectHdl; Link _aFilterSelectHdl;
String _aPath; OUString _aPath;
String _aDefExt; OUString _aDefExt;
void ReleaseOwnership( Window* pUserControl ); void ReleaseOwnership( Window* pUserControl );
@@ -211,33 +211,33 @@ public:
void SetBlackList( const ::com::sun::star::uno::Sequence< OUString >& rBlackList ); void SetBlackList( const ::com::sun::star::uno::Sequence< OUString >& rBlackList );
const ::com::sun::star::uno::Sequence< OUString >& GetBlackList() const; const ::com::sun::star::uno::Sequence< OUString >& GetBlackList() const;
void SetStandardDir( const String& rStdDir ); void SetStandardDir( const OUString& rStdDir );
const String& GetStandardDir() const; const OUString& GetStandardDir() const;
std::vector<OUString> GetPathList() const; // for MultiSelection std::vector<OUString> GetPathList() const; // for MultiSelection
void AddFilter( const String& rFilter, void AddFilter( const OUString& rFilter,
const String& rType ); const OUString& rType );
void AddFilterGroup( void AddFilterGroup(
const String& _rFilter, const OUString& _rFilter,
const com::sun::star::uno::Sequence< com::sun::star::beans::StringPair >& rFilters ); const com::sun::star::uno::Sequence< com::sun::star::beans::StringPair >& rFilters );
void SetCurFilter( const String& rFilter ); void SetCurFilter( const OUString& rFilter );
String GetCurFilter() const; OUString GetCurFilter() const;
sal_uInt16 GetFilterCount() const; sal_uInt16 GetFilterCount() const;
const String& GetFilterName( sal_uInt16 nPos ) const; const OUString& GetFilterName( sal_uInt16 nPos ) const;
virtual void Resize(); virtual void Resize();
virtual void DataChanged( const DataChangedEvent& _rDCEvt ); virtual void DataChanged( const DataChangedEvent& _rDCEvt );
void PrevLevel_Impl(); void PrevLevel_Impl();
void OpenURL_Impl( const String& rURL ); void OpenURL_Impl( const OUString& rURL );
inline SvtFileView* GetView() const; inline SvtFileView* GetView() const;
void DisableSaveLastDirectory(); void DisableSaveLastDirectory();
void InitSize(); void InitSize();
void UpdateControls( const String& rURL ); void UpdateControls( const OUString& rURL );
void EnableAutocompletion( sal_Bool _bEnable = sal_True ); void EnableAutocompletion( sal_Bool _bEnable = sal_True );
void SetFileCallback( ::svt::IFilePickerListener *pNotifier ) { _pFileNotifier = pNotifier; } void SetFileCallback( ::svt::IFilePickerListener *pNotifier ) { _pFileNotifier = pNotifier; }
@@ -250,26 +250,26 @@ public:
sal_Bool getShowState(); sal_Bool getShowState();
sal_Bool isAutoExtensionEnabled(); sal_Bool isAutoExtensionEnabled();
String getCurrentFileText( ) const; OUString getCurrentFileText( ) const;
void setCurrentFileText( const String& _rText, bool _bSelectAll = false ); void setCurrentFileText( const OUString& _rText, bool _bSelectAll = false );
void onAsyncOperationStarted(); void onAsyncOperationStarted();
void onAsyncOperationFinished(); void onAsyncOperationFinished();
void RemovablePlaceSelected(bool enable = true); void RemovablePlaceSelected(bool enable = true);
void displayIOException( const String& _rURL, ::com::sun::star::ucb::IOErrorCode _eCode ); void displayIOException( const OUString& _rURL, ::com::sun::star::ucb::IOErrorCode _eCode );
// originally from VclFileDialog // originally from VclFileDialog
virtual sal_Bool AddControl( Window* pControl, sal_Bool bNewLine = sal_False ); virtual sal_Bool AddControl( Window* pControl, sal_Bool bNewLine = sal_False );
// inline // inline
inline void SetPath( const String& rNewURL ); inline void SetPath( const OUString& rNewURL );
inline void SetHasFilename( bool bHasFilename ); inline void SetHasFilename( bool bHasFilename );
inline const String& GetPath() const; inline const OUString& GetPath() const;
inline void SetDefaultExt( const String& rExt ); inline void SetDefaultExt( const OUString& rExt );
inline void EraseDefaultExt( xub_StrLen _nIndex = 0 ); inline void EraseDefaultExt( xub_StrLen _nIndex = 0 );
inline const String& GetDefaultExt() const; inline const OUString& GetDefaultExt() const;
inline void SetOKHdl( const Link& rLink ); inline void SetOKHdl( const Link& rLink );
inline const Link& GetOKHdl() const; inline const Link& GetOKHdl() const;
inline void SetFileSelectHdl( const Link& rLink ); inline void SetFileSelectHdl( const Link& rLink );
@@ -282,7 +282,7 @@ public:
sal_Bool ContentIsFolder( const OUString& rURL ) { return m_aContent.isFolder( rURL ) && m_aContent.isValid(); } sal_Bool ContentIsFolder( const OUString& rURL ) { return m_aContent.isFolder( rURL ) && m_aContent.isValid(); }
sal_Bool ContentHasParentFolder( const OUString& rURL ); sal_Bool ContentHasParentFolder( const OUString& rURL );
sal_Bool ContentCanMakeFolder( const OUString& rURL ); sal_Bool ContentCanMakeFolder( const OUString& rURL );
sal_Bool ContentGetTitle( const OUString& rURL, String& rTitle ); sal_Bool ContentGetTitle( const OUString& rURL, OUString& rTitle );
/** updates the sizes of the listboxes in the bottom area of the dialog, and of their labels, /** updates the sizes of the listboxes in the bottom area of the dialog, and of their labels,
according to the space occupied by the current label texts according to the space occupied by the current label texts
@@ -292,7 +292,7 @@ public:
void updateListboxLabelSizes(); void updateListboxLabelSizes();
private: private:
SvtFileDialogFilter_Impl* implAddFilter( const String& _rFilter, const String& _rType ); SvtFileDialogFilter_Impl* implAddFilter( const OUString& _rFilter, const OUString& _rType );
/** updates _pUserFilter with a new filter /** updates _pUserFilter with a new filter
<p>No checks for necessity are made.</p> <p>No checks for necessity are made.</p>
@@ -308,22 +308,22 @@ private:
</p> </p>
@return <TRUE/> if the new filter is "*.*" @return <TRUE/> if the new filter is "*.*"
*/ */
sal_Bool createNewUserFilter( const String& _rNewFilter, sal_Bool _bAllowUserDefExt ); sal_Bool createNewUserFilter( const OUString& _rNewFilter, sal_Bool _bAllowUserDefExt );
sal_uInt16 adjustFilter( const String& _rFilter ); sal_uInt16 adjustFilter( const OUString& _rFilter );
// IFilePickerController, needed by OControlAccess // IFilePickerController, needed by OControlAccess
virtual Control* getControl( sal_Int16 _nControlId, sal_Bool _bLabelControl = sal_False ) const; virtual Control* getControl( sal_Int16 _nControlId, sal_Bool _bLabelControl = sal_False ) const;
virtual void enableControl( sal_Int16 _nControlId, sal_Bool _bEnable ); virtual void enableControl( sal_Int16 _nControlId, sal_Bool _bEnable );
virtual String getCurFilter( ) const; virtual OUString getCurFilter( ) const;
String implGetInitialURL( const String& _rPath, const String& _rFallback ); OUString implGetInitialURL( const OUString& _rPath, const OUString& _rFallback );
/// executes a certain FileView action asynchronously /// executes a certain FileView action asynchronously
void executeAsync( void executeAsync(
::svt::AsyncPickerAction::Action _eAction, ::svt::AsyncPickerAction::Action _eAction,
const String& _rURL, const OUString& _rURL,
const String& _rFilter const OUString& _rFilter
); );
/** helper function to check and append the default filter extension if /** helper function to check and append the default filter extension if
@@ -339,16 +339,16 @@ private:
*/ */
static void appendDefaultExtension( static void appendDefaultExtension(
String& _rFileName, OUString& _rFileName,
const String& _rFilterDefaultExtension, const OUString& _rFilterDefaultExtension,
const String& _rFilterExtensions); const OUString& _rFilterExtensions);
void initDefaultPlaces( ); void initDefaultPlaces( );
}; };
//*************************************************************************** //***************************************************************************
inline void SvtFileDialog::SetPath( const String& rNewURL ) inline void SvtFileDialog::SetPath( const OUString& rNewURL )
{ {
_aPath = rNewURL; _aPath = rNewURL;
} }
@@ -362,24 +362,24 @@ inline void SvtFileDialog::SetHasFilename( bool bHasFilename )
//*************************************************************************** //***************************************************************************
inline const String& SvtFileDialog::GetPath() const inline const OUString& SvtFileDialog::GetPath() const
{ {
return _aPath; return _aPath;
} }
//*************************************************************************** //***************************************************************************
inline void SvtFileDialog::SetDefaultExt( const String& rExt ) inline void SvtFileDialog::SetDefaultExt( const OUString& rExt )
{ {
_aDefExt = rExt; _aDefExt = rExt;
} }
inline void SvtFileDialog::EraseDefaultExt( xub_StrLen _nIndex ) inline void SvtFileDialog::EraseDefaultExt( xub_StrLen _nIndex )
{ {
_aDefExt.Erase( _nIndex ); _aDefExt = _aDefExt.copy( 0, _nIndex );
} }
inline const String& SvtFileDialog::GetDefaultExt() const inline const OUString& SvtFileDialog::GetDefaultExt() const
{ {
return _aDefExt; return _aDefExt;
} }

View File

@@ -47,18 +47,18 @@ using namespace ::utl;
static const sal_Char* pViewOptDataName = "dialog data"; static const sal_Char* pViewOptDataName = "dialog data";
#define VIEWOPT_DATANAME OUString::createFromAscii( pViewOptDataName ) #define VIEWOPT_DATANAME OUString::createFromAscii( pViewOptDataName )
static inline void SetViewOptUserItem( SvtViewOptions& rOpt, const String& rData ) static inline void SetViewOptUserItem( SvtViewOptions& rOpt, const OUString& rData )
{ {
rOpt.SetUserItem( VIEWOPT_DATANAME, makeAny( OUString( rData ) ) ); rOpt.SetUserItem( VIEWOPT_DATANAME, makeAny( OUString( rData ) ) );
} }
static inline String GetViewOptUserItem( const SvtViewOptions& rOpt ) static inline OUString GetViewOptUserItem( const SvtViewOptions& rOpt )
{ {
Any aAny( rOpt.GetUserItem( VIEWOPT_DATANAME ) ); Any aAny( rOpt.GetUserItem( VIEWOPT_DATANAME ) );
OUString aUserData; OUString aUserData;
aAny >>= aUserData; aAny >>= aUserData;
return String( aUserData ); return aUserData;
} }
//***************************************************************************** //*****************************************************************************
@@ -92,7 +92,7 @@ namespace
//***************************************************************************** //*****************************************************************************
DBG_NAME( SvtFileDialogFilter_Impl ) DBG_NAME( SvtFileDialogFilter_Impl )
SvtFileDialogFilter_Impl::SvtFileDialogFilter_Impl( const String& rName, const String& rType ) SvtFileDialogFilter_Impl::SvtFileDialogFilter_Impl( const OUString& rName, const OUString& rType )
:m_aName( rName ) :m_aName( rName )
,m_aType( rType ) ,m_aType( rType )
{ {
@@ -180,11 +180,11 @@ void SvtUpButton_Impl::FillURLMenu( PopupMenu* _pMenu )
while ( nCount >= 1 ) while ( nCount >= 1 )
{ {
aObject.removeSegment(); aObject.removeSegment();
String aParentURL(aObject.GetMainURL(INetURLObject::NO_DECODE)); OUString aParentURL(aObject.GetMainURL(INetURLObject::NO_DECODE));
String aTitle; OUString aTitle;
// 97148# -------------------------------- // 97148# --------------------------------
if (!GetDialogParent()->ContentGetTitle(aParentURL, aTitle) || aTitle.Len() == 0) if (!GetDialogParent()->ContentGetTitle(aParentURL, aTitle) || aTitle.isEmpty())
aTitle = aObject.getName(); aTitle = aObject.getName();
Image aImage = ( nCount > 1 ) // if nCount == 1 means workplace, which detects the wrong image Image aImage = ( nCount > 1 ) // if nCount == 1 means workplace, which detects the wrong image
@@ -296,18 +296,18 @@ SvtExpFileDlg_Impl::~SvtExpFileDlg_Impl()
//***************************************************************************** //*****************************************************************************
void SvtExpFileDlg_Impl::SetStandardDir( const String& _rDir ) void SvtExpFileDlg_Impl::SetStandardDir( const OUString& _rDir )
{ {
_aStdDir = _rDir; _aStdDir = _rDir;
if ( 0 == _aStdDir.Len() ) if ( _aStdDir.isEmpty() )
_aStdDir.AssignAscii( "file:///" ); _aStdDir = "file:///";
} }
//***************************************************************************** //*****************************************************************************
#if defined DBG_UTIL #if defined DBG_UTIL
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
namespace { namespace {
String lcl_DecoratedFilter( const String& _rOriginalFilter ) OUString lcl_DecoratedFilter( const OUString& _rOriginalFilter )
{ {
OUStringBuffer aDecoratedFilter; OUStringBuffer aDecoratedFilter;
aDecoratedFilter.append('<'); aDecoratedFilter.append('<');
@@ -325,7 +325,7 @@ void SvtExpFileDlg_Impl::ClearFilterList( )
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void SvtExpFileDlg_Impl::SetCurFilter( SvtFileDialogFilter_Impl* pFilter, const String& rDisplayName ) void SvtExpFileDlg_Impl::SetCurFilter( SvtFileDialogFilter_Impl* pFilter, const OUString& rDisplayName )
{ {
DBG_ASSERT( pFilter, "SvtExpFileDlg_Impl::SetCurFilter: invalid filter!" ); DBG_ASSERT( pFilter, "SvtExpFileDlg_Impl::SetCurFilter: invalid filter!" );
DBG_ASSERT( ( rDisplayName == pFilter->GetName() ) DBG_ASSERT( ( rDisplayName == pFilter->GetName() )
@@ -339,7 +339,7 @@ void SvtExpFileDlg_Impl::SetCurFilter( SvtFileDialogFilter_Impl* pFilter, const
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void SvtExpFileDlg_Impl::InsertFilterListEntry( const SvtFileDialogFilter_Impl* _pFilterDesc ) void SvtExpFileDlg_Impl::InsertFilterListEntry( const SvtFileDialogFilter_Impl* _pFilterDesc )
{ {
String sName = _pFilterDesc->GetName(); OUString sName = _pFilterDesc->GetName();
if ( _pFilterDesc->isGroupSeparator() ) if ( _pFilterDesc->isGroupSeparator() )
sName = OUString( "------------------------------------------" ); sName = OUString( "------------------------------------------" );
else else

View File

@@ -49,16 +49,16 @@ class SvtFileDialog;
class SvtFileDialogFilter_Impl class SvtFileDialogFilter_Impl
{ {
private: private:
String m_aName; // name of the entry OUString m_aName; // name of the entry
OUString m_aType; // filter wildcard - if empty, the entry marks a group OUString m_aType; // filter wildcard - if empty, the entry marks a group
public: public:
SvtFileDialogFilter_Impl( const String& rName, const String& rType ); SvtFileDialogFilter_Impl( const OUString& rName, const OUString& rType );
~SvtFileDialogFilter_Impl(); ~SvtFileDialogFilter_Impl();
const String& GetName() const { return m_aName; } const OUString& GetName() const { return m_aName; }
const OUString& GetType() const { return m_aType; } const OUString& GetType() const { return m_aType; }
const String GetExtension() const { return m_aType.copy( 2 ); } const OUString GetExtension() const { return m_aType.copy( 2 ); }
sal_Bool isGroupSeparator() const { return m_aType.isEmpty(); } sal_Bool isGroupSeparator() const { return m_aType.isEmpty(); }
}; };
@@ -127,7 +127,7 @@ private:
ListBox* _pLbFilter; ListBox* _pLbFilter;
const SvtFileDialogFilter_Impl* _pCurFilter; const SvtFileDialogFilter_Impl* _pCurFilter;
String m_sCurrentFilterDisplayName; // may differ from _pCurFilter->GetName in case it is a cached entry OUString m_sCurrentFilterDisplayName; // may differ from _pCurFilter->GetName in case it is a cached entry
::com::sun::star::uno::Sequence< OUString > _aBlackList; ::com::sun::star::uno::Sequence< OUString > _aBlackList;
@@ -166,7 +166,7 @@ public:
SvtFileDlgState _nState; SvtFileDlgState _nState;
WinBits _nStyle; WinBits _nStyle;
String _aStdDir; OUString _aStdDir;
// delay filter when traveling the filterbox // delay filter when traveling the filterbox
Timer _aFilterTimer; Timer _aFilterTimer;
@@ -186,7 +186,7 @@ public:
long _nFixDeltaHeight; long _nFixDeltaHeight;
Size _a6Size; Size _a6Size;
Size _aDlgSize; Size _aDlgSize;
String _aIniKey; OUString _aIniKey;
sal_Bool _bFolderHasOpened; sal_Bool _bFolderHasOpened;
@@ -196,8 +196,8 @@ public:
inline void SetBlackList( const ::com::sun::star::uno::Sequence< OUString >& rBlackList ) { _aBlackList = rBlackList; } inline void SetBlackList( const ::com::sun::star::uno::Sequence< OUString >& rBlackList ) { _aBlackList = rBlackList; }
inline const ::com::sun::star::uno::Sequence< OUString >& GetBlackList() const { return _aBlackList; } inline const ::com::sun::star::uno::Sequence< OUString >& GetBlackList() const { return _aBlackList; }
void SetStandardDir( const String& _rDir ); void SetStandardDir( const OUString& _rDir );
inline const String& GetStandardDir() const { return _aStdDir; } inline const OUString& GetStandardDir() const { return _aStdDir; }
inline void DisableFilterBoxAutoWidth() { _pLbFilter->EnableDDAutoWidth( sal_False ); } inline void DisableFilterBoxAutoWidth() { _pLbFilter->EnableDDAutoWidth( sal_False ); }
// ------------------------------------------ // ------------------------------------------
@@ -210,19 +210,19 @@ public:
// inits the listbox for the filters from the filter list (_pFilter) // inits the listbox for the filters from the filter list (_pFilter)
void ClearFilterList( ); void ClearFilterList( );
void InitFilterList( ); void InitFilterList( );
inline sal_Bool HasFilterListEntry( const String& _rFilterName ); inline sal_Bool HasFilterListEntry( const OUString& _rFilterName );
inline void SelectFilterListEntry( const String& _rFilterName ); inline void SelectFilterListEntry( const OUString& _rFilterName );
inline void SetNoFilterListSelection( ); inline void SetNoFilterListSelection( );
void InsertFilterListEntry( const SvtFileDialogFilter_Impl* _pFilterDesc ); void InsertFilterListEntry( const SvtFileDialogFilter_Impl* _pFilterDesc );
// _pFilterDesc must already have been added to _pFilter // _pFilterDesc must already have been added to _pFilter
inline SvtFileDialogFilter_Impl* GetSelectedFilterEntry( String& /* [out] */ _rDisplayName ) const; inline SvtFileDialogFilter_Impl* GetSelectedFilterEntry( OUString& /* [out] */ _rDisplayName ) const;
inline sal_Bool IsFilterListTravelSelect() const; inline sal_Bool IsFilterListTravelSelect() const;
// ------------------------------------------ // ------------------------------------------
// access to the current filter via methods only - need to care for consistency between _pCurFilter and m_sCurrentFilterDisplayName // access to the current filter via methods only - need to care for consistency between _pCurFilter and m_sCurrentFilterDisplayName
inline const SvtFileDialogFilter_Impl* GetCurFilter( ) const; inline const SvtFileDialogFilter_Impl* GetCurFilter( ) const;
inline const String& GetCurFilterDisplayName() const; inline const OUString& GetCurFilterDisplayName() const;
void SetCurFilter( SvtFileDialogFilter_Impl* _pFilter, const String& _rDisplayName ); void SetCurFilter( SvtFileDialogFilter_Impl* _pFilter, const OUString& _rDisplayName );
inline void SetCurFilter( SvtFileDialogFilter_Impl* _pFilter ); inline void SetCurFilter( SvtFileDialogFilter_Impl* _pFilter );
}; };
@@ -231,12 +231,12 @@ inline void SvtExpFileDlg_Impl::SetFilterListSelectHdl( const Link& _rHandler )
_pLbFilter->SetSelectHdl( _rHandler ); _pLbFilter->SetSelectHdl( _rHandler );
} }
inline sal_Bool SvtExpFileDlg_Impl::HasFilterListEntry( const String& _rFilterName ) inline sal_Bool SvtExpFileDlg_Impl::HasFilterListEntry( const OUString& _rFilterName )
{ {
return ( LISTBOX_ENTRY_NOTFOUND != _pLbFilter->GetEntryPos( _rFilterName ) ); return ( LISTBOX_ENTRY_NOTFOUND != _pLbFilter->GetEntryPos( _rFilterName ) );
} }
inline void SvtExpFileDlg_Impl::SelectFilterListEntry( const String& _rFilterName ) inline void SvtExpFileDlg_Impl::SelectFilterListEntry( const OUString& _rFilterName )
{ {
_pLbFilter->SelectEntry( _rFilterName ); _pLbFilter->SelectEntry( _rFilterName );
} }
@@ -246,7 +246,7 @@ inline void SvtExpFileDlg_Impl::SetNoFilterListSelection( )
_pLbFilter->SetNoSelection( ); _pLbFilter->SetNoSelection( );
} }
inline SvtFileDialogFilter_Impl* SvtExpFileDlg_Impl::GetSelectedFilterEntry( String& _rDisplayName ) const inline SvtFileDialogFilter_Impl* SvtExpFileDlg_Impl::GetSelectedFilterEntry( OUString& _rDisplayName ) const
{ {
_rDisplayName = _pLbFilter->GetSelectEntry(); _rDisplayName = _pLbFilter->GetSelectEntry();
return static_cast< SvtFileDialogFilter_Impl* >( _pLbFilter->GetEntryData ( _pLbFilter->GetSelectEntryPos() ) ); return static_cast< SvtFileDialogFilter_Impl* >( _pLbFilter->GetEntryData ( _pLbFilter->GetSelectEntryPos() ) );
@@ -262,7 +262,7 @@ inline const SvtFileDialogFilter_Impl* SvtExpFileDlg_Impl::GetCurFilter( ) const
return _pCurFilter; return _pCurFilter;
} }
inline const String& SvtExpFileDlg_Impl::GetCurFilterDisplayName() const inline const OUString& SvtExpFileDlg_Impl::GetCurFilterDisplayName() const
{ {
return m_sCurrentFilterDisplayName; return m_sCurrentFilterDisplayName;
} }

View File

@@ -36,7 +36,7 @@ namespace svt
public: public:
virtual Control* getControl( sal_Int16 _nControlId, sal_Bool _bLabelControl = sal_False ) const = 0; virtual Control* getControl( sal_Int16 _nControlId, sal_Bool _bLabelControl = sal_False ) const = 0;
virtual void enableControl( sal_Int16 _nControlId, sal_Bool _bEnable ) = 0; virtual void enableControl( sal_Int16 _nControlId, sal_Bool _bEnable ) = 0;
virtual String getCurFilter( ) const = 0; virtual OUString getCurFilter( ) const = 0;
protected: protected:
~IFilePickerController() {} ~IFilePickerController() {}