Kaydet (Commit) 3ea8ee20 authored tarafından August Sodora's avatar August Sodora

SvStringsDtor->std::vector

üst 59cc5f6e
...@@ -68,11 +68,8 @@ namespace com ...@@ -68,11 +68,8 @@ namespace com
} }
class SfxItemSet; class SfxItemSet;
class SvStringsDtor;
class Window; class Window;
//-----------------------------------------------------------------------------
// the SFXWB constants are for the nFlags parameter of the constructor // the SFXWB constants are for the nFlags parameter of the constructor
#define SFXWB_INSERT 0x04000000L // turn Open into Insert dialog #define SFXWB_INSERT 0x04000000L // turn Open into Insert dialog
#define SFXWB_EXPORT 0x40000000L // turn Save into Export dialog #define SFXWB_EXPORT 0x40000000L // turn Save into Export dialog
...@@ -85,8 +82,6 @@ class Window; ...@@ -85,8 +82,6 @@ class Window;
#define FOLDER_PICKER_SERVICE_NAME "com.sun.star.ui.dialogs.FolderPicker" #define FOLDER_PICKER_SERVICE_NAME "com.sun.star.ui.dialogs.FolderPicker"
#define FILE_OPEN_SERVICE_NAME_OOO "com.sun.star.ui.dialogs.OfficeFilePicker" #define FILE_OPEN_SERVICE_NAME_OOO "com.sun.star.ui.dialogs.OfficeFilePicker"
//-----------------------------------------------------------------------------
namespace sfx2 { namespace sfx2 {
class FileDialogHelper_Impl; class FileDialogHelper_Impl;
...@@ -245,7 +240,7 @@ public: ...@@ -245,7 +240,7 @@ public:
DECL_LINK( ExecuteSystemFilePicker, void* ); DECL_LINK( ExecuteSystemFilePicker, void* );
ErrCode Execute( SvStringsDtor*& rpURLList, ErrCode Execute( std::vector<rtl::OUString>& rpURLList,
SfxItemSet *& rpSet, SfxItemSet *& rpSet,
String& rFilter, String& rFilter,
const String& rDirPath ); const String& rDirPath );
...@@ -260,7 +255,7 @@ public: ...@@ -260,7 +255,7 @@ public:
ErrCode FileOpenDialog_Impl( sal_Int16 nDialogType, ErrCode FileOpenDialog_Impl( sal_Int16 nDialogType,
sal_Int64 nFlags, sal_Int64 nFlags,
const String& rFact, const String& rFact,
SvStringsDtor *& rpURLList, std::vector<rtl::OUString>& rpURLList,
String& rFilter, String& rFilter,
SfxItemSet *& rpSet, SfxItemSet *& rpSet,
const String* pPath = NULL, const String* pPath = NULL,
...@@ -272,8 +267,6 @@ ErrCode FileOpenDialog_Impl( sal_Int16 nDialogType, ...@@ -272,8 +267,6 @@ ErrCode FileOpenDialog_Impl( sal_Int16 nDialogType,
ErrCode RequestPassword(const SfxFilter* pCurrentFilter, rtl::OUString& aURL, SfxItemSet* pSet); ErrCode RequestPassword(const SfxFilter* pCurrentFilter, rtl::OUString& aURL, SfxItemSet* pSet);
} }
//-----------------------------------------------------------------------------
#endif #endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -38,15 +38,11 @@ ...@@ -38,15 +38,11 @@
#include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XFrame.hpp>
class _SfxMacroTabPage; class _SfxMacroTabPage;
class SvStringsDtor;
class SvTabListBox; class SvTabListBox;
class Edit; class Edit;
class String; class String;
class SfxObjectShell; class SfxObjectShell;
typedef SvStringsDtor* (*FNGetRangeHdl)( _SfxMacroTabPage*, const String& rLanguage );
typedef SvStringsDtor* (*FNGetMacrosOfRangeHdl)( _SfxMacroTabPage*, const String& rLanguage, const String& rRange );
class SfxConfigGroupListBox_Impl; class SfxConfigGroupListBox_Impl;
class SfxConfigFunctionListBox_Impl; class SfxConfigFunctionListBox_Impl;
...@@ -91,8 +87,6 @@ public: ...@@ -91,8 +87,6 @@ public:
virtual void ScriptChanged( const String& rLanguage ); virtual void ScriptChanged( const String& rLanguage );
// zum setzen / abfragen der Links // zum setzen / abfragen der Links
void SetGetRangeLink( FNGetRangeHdl pFn );
FNGetRangeHdl GetGetRangeLink() const;
void SetGetMacrosOfRangeLink( FNGetMacrosOfRangeHdl pFn ); void SetGetMacrosOfRangeLink( FNGetMacrosOfRangeHdl pFn );
FNGetMacrosOfRangeHdl GetGetMacrosOfRangeLink() const; FNGetMacrosOfRangeHdl GetGetMacrosOfRangeLink() const;
......
...@@ -715,7 +715,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) ...@@ -715,7 +715,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
if ( !pFileNameItem ) if ( !pFileNameItem )
{ {
// get FileName from dialog // get FileName from dialog
SvStringsDtor* pURLList = NULL; std::vector<rtl::OUString> pURLList;
String aFilter; String aFilter;
SfxItemSet* pSet = NULL; SfxItemSet* pSet = NULL;
String aPath; String aPath;
...@@ -757,7 +757,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) ...@@ -757,7 +757,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
if ( nErr == ERRCODE_ABORT ) if ( nErr == ERRCODE_ABORT )
{ {
delete pURLList; pURLList.clear();
return; return;
} }
...@@ -768,7 +768,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) ...@@ -768,7 +768,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
rReq.AppendItem( SfxStringItem( SID_REFERER, String::CreateFromAscii(SFX_REFERER_USER) ) ); rReq.AppendItem( SfxStringItem( SID_REFERER, String::CreateFromAscii(SFX_REFERER_USER) ) );
delete pSet; delete pSet;
if ( pURLList->Count() ) if(!pURLList.empty())
{ {
if ( nSID == SID_OPENTEMPLATE ) if ( nSID == SID_OPENTEMPLATE )
rReq.AppendItem( SfxBoolItem( SID_TEMPLATE, sal_False ) ); rReq.AppendItem( SfxBoolItem( SID_TEMPLATE, sal_False ) );
...@@ -799,11 +799,10 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) ...@@ -799,11 +799,10 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
::framework::PreventDuplicateInteraction::InteractionInfo aRule (aInteraction, 1); ::framework::PreventDuplicateInteraction::InteractionInfo aRule (aInteraction, 1);
pHandler->addInteractionRule(aRule); pHandler->addInteractionRule(aRule);
for ( sal_uInt16 i = 0; i < pURLList->Count(); ++i ) for(std::vector<rtl::OUString>::const_iterator i = pURLList.begin(); i != pURLList.end(); ++i)
{ {
String aURL = *(pURLList->GetObject(i));
rReq.RemoveItem( SID_FILE_NAME ); rReq.RemoveItem( SID_FILE_NAME );
rReq.AppendItem( SfxStringItem( SID_FILE_NAME, aURL ) ); rReq.AppendItem( SfxStringItem( SID_FILE_NAME, *i ) );
// Run synchronous, so that not the next document is loaded // Run synchronous, so that not the next document is loaded
// when rescheduling // when rescheduling
...@@ -832,10 +831,10 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) ...@@ -832,10 +831,10 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
} }
} }
delete pURLList; pURLList.clear();
return; return;
} }
delete pURLList; pURLList.clear();
} }
sal_Bool bHyperlinkUsed = sal_False; sal_Bool bHyperlinkUsed = sal_False;
......
...@@ -1366,22 +1366,18 @@ void FileDialogHelper_Impl::implStartExecute() ...@@ -1366,22 +1366,18 @@ void FileDialogHelper_Impl::implStartExecute()
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
void lcl_saveLastURLs(SvStringsDtor*& rpURLList , void lcl_saveLastURLs(std::vector<rtl::OUString>& rpURLList,
::comphelper::SequenceAsVector< ::rtl::OUString >& lLastURLs ) ::comphelper::SequenceAsVector< ::rtl::OUString >& lLastURLs )
{ {
lLastURLs.clear(); lLastURLs.clear();
sal_uInt16 c = rpURLList->Count(); for(std::vector<rtl::OUString>::iterator i = rpURLList.begin(); i != rpURLList.end(); ++i)
sal_uInt16 i = 0; lLastURLs.push_back(*i);
for (i=0; i<c; ++i)
lLastURLs.push_back(*(rpURLList->GetObject(i)));
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
void FileDialogHelper_Impl::implGetAndCacheFiles(const uno::Reference< XInterface >& xPicker , void FileDialogHelper_Impl::implGetAndCacheFiles(const uno::Reference< XInterface >& xPicker, std::vector<rtl::OUString>& rpURLList, const SfxFilter* pFilter)
SvStringsDtor*& rpURLList,
const SfxFilter* pFilter )
{ {
rpURLList = NULL; rpURLList.clear();
rtl::OUString sExtension; rtl::OUString sExtension;
if (pFilter) if (pFilter)
...@@ -1395,14 +1391,10 @@ void FileDialogHelper_Impl::implGetAndCacheFiles(const uno::Reference< XInterfac ...@@ -1395,14 +1391,10 @@ void FileDialogHelper_Impl::implGetAndCacheFiles(const uno::Reference< XInterfac
uno::Reference< XFilePicker2 > xPickNew(xPicker, UNO_QUERY); uno::Reference< XFilePicker2 > xPickNew(xPicker, UNO_QUERY);
if (xPickNew.is()) if (xPickNew.is())
{ {
rpURLList = new SvStringsDtor;
Sequence< OUString > lFiles = xPickNew->getSelectedFiles(); Sequence< OUString > lFiles = xPickNew->getSelectedFiles();
::sal_Int32 nFiles = lFiles.getLength(); ::sal_Int32 nFiles = lFiles.getLength();
for (::sal_Int32 i = 0; i < nFiles; i++) for(sal_Int32 i = 0; i < nFiles; ++i)
{ rpURLList.push_back(lFiles[i]);
String* pURL = new String(lFiles[i]);
rpURLList->Insert( pURL, rpURLList->Count() );
}
} }
// b) the olde way ... non optional. // b) the olde way ... non optional.
...@@ -1413,15 +1405,10 @@ void FileDialogHelper_Impl::implGetAndCacheFiles(const uno::Reference< XInterfac ...@@ -1413,15 +1405,10 @@ void FileDialogHelper_Impl::implGetAndCacheFiles(const uno::Reference< XInterfac
::sal_Int32 nFiles = lFiles.getLength(); ::sal_Int32 nFiles = lFiles.getLength();
if ( nFiles == 1 ) if ( nFiles == 1 )
{ {
rpURLList = new SvStringsDtor; rpURLList.push_back(lFiles[0]);
String* pURL = new String(lFiles[0]);
rpURLList->Insert( pURL, 0 );
} }
else else if ( nFiles > 1 )
if ( nFiles > 1 )
{ {
rpURLList = new SvStringsDtor;
INetURLObject aPath( lFiles[0] ); INetURLObject aPath( lFiles[0] );
aPath.setFinalSlash(); aPath.setFinalSlash();
...@@ -1432,8 +1419,7 @@ void FileDialogHelper_Impl::implGetAndCacheFiles(const uno::Reference< XInterfac ...@@ -1432,8 +1419,7 @@ void FileDialogHelper_Impl::implGetAndCacheFiles(const uno::Reference< XInterfac
else else
aPath.setName( lFiles[i] ); aPath.setName( lFiles[i] );
String* pURL = new String(aPath.GetMainURL( INetURLObject::NO_DECODE ) ); rpURLList.push_back(aPath.GetMainURL(INetURLObject::NO_DECODE));
rpURLList->Insert( pURL, rpURLList->Count() );
} }
} }
} }
...@@ -1442,7 +1428,7 @@ void FileDialogHelper_Impl::implGetAndCacheFiles(const uno::Reference< XInterfac ...@@ -1442,7 +1428,7 @@ void FileDialogHelper_Impl::implGetAndCacheFiles(const uno::Reference< XInterfac
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, ErrCode FileDialogHelper_Impl::execute( std::vector<rtl::OUString>& rpURLList,
SfxItemSet *& rpSet, SfxItemSet *& rpSet,
String& rFilter ) String& rFilter )
{ {
...@@ -1489,7 +1475,7 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, ...@@ -1489,7 +1475,7 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList,
aSecOpt.IsOptionSet( SvtSecurityOptions::E_DOCWARN_RECOMMENDPASSWORD ) ); aSecOpt.IsOptionSet( SvtSecurityOptions::E_DOCWARN_RECOMMENDPASSWORD ) );
} }
rpURLList = NULL; rpURLList.clear();
if ( ! mxFileDlg.is() ) if ( ! mxFileDlg.is() )
return ERRCODE_ABORT; return ERRCODE_ABORT;
...@@ -1560,7 +1546,7 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, ...@@ -1560,7 +1546,7 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList,
// fill the rpURLList // fill the rpURLList
implGetAndCacheFiles( mxFileDlg, rpURLList, pCurrentFilter ); implGetAndCacheFiles( mxFileDlg, rpURLList, pCurrentFilter );
if ( rpURLList == NULL || rpURLList->GetObject(0) == NULL ) if ( rpURLList.empty() )
return ERRCODE_ABORT; return ERRCODE_ABORT;
// check, wether or not we have to display a password box // check, wether or not we have to display a password box
...@@ -1573,7 +1559,7 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, ...@@ -1573,7 +1559,7 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList,
if ( ( aValue >>= bPassWord ) && bPassWord ) if ( ( aValue >>= bPassWord ) && bPassWord )
{ {
// ask for a password // ask for a password
rtl::OUString aDocName(*(rpURLList->GetObject(0))); rtl::OUString aDocName(rpURLList[0]);
ErrCode errCode = RequestPassword(pCurrentFilter, aDocName, rpSet); ErrCode errCode = RequestPassword(pCurrentFilter, aDocName, rpSet);
if (errCode != ERRCODE_NONE) if (errCode != ERRCODE_NONE)
return errCode; return errCode;
...@@ -2326,7 +2312,7 @@ IMPL_LINK( FileDialogHelper, ExecuteSystemFilePicker, void*, EMPTYARG ) ...@@ -2326,7 +2312,7 @@ IMPL_LINK( FileDialogHelper, ExecuteSystemFilePicker, void*, EMPTYARG )
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// rDirPath has to be a directory // rDirPath has to be a directory
ErrCode FileDialogHelper::Execute( SvStringsDtor*& rpURLList, ErrCode FileDialogHelper::Execute( std::vector<rtl::OUString>& rpURLList,
SfxItemSet *& rpSet, SfxItemSet *& rpSet,
String& rFilter, String& rFilter,
const String& rDirPath ) const String& rDirPath )
...@@ -2347,12 +2333,8 @@ ErrCode FileDialogHelper::Execute( SfxItemSet *& rpSet, ...@@ -2347,12 +2333,8 @@ ErrCode FileDialogHelper::Execute( SfxItemSet *& rpSet,
String& rFilter ) String& rFilter )
{ {
ErrCode nRet; ErrCode nRet;
SvStringsDtor* pURLList; std::vector<rtl::OUString> rURLList;
nRet = mpImp->execute(rURLList, rpSet, rFilter);
nRet = mpImp->execute( pURLList, rpSet, rFilter );
delete pURLList;
return nRet; return nRet;
} }
...@@ -2638,7 +2620,7 @@ void SAL_CALL FileDialogHelper::DialogClosed( const DialogClosedEvent& _rEvent ) ...@@ -2638,7 +2620,7 @@ void SAL_CALL FileDialogHelper::DialogClosed( const DialogClosedEvent& _rEvent )
ErrCode FileOpenDialog_Impl( sal_Int16 nDialogType, ErrCode FileOpenDialog_Impl( sal_Int16 nDialogType,
sal_Int64 nFlags, sal_Int64 nFlags,
const String& rFact, const String& rFact,
SvStringsDtor *& rpURLList, std::vector<rtl::OUString>& rpURLList,
String& rFilter, String& rFilter,
SfxItemSet *& rpSet, SfxItemSet *& rpSet,
const String* pPath, const String* pPath,
......
...@@ -153,7 +153,7 @@ namespace sfx2 ...@@ -153,7 +153,7 @@ namespace sfx2
void implInitializeFileName( ); void implInitializeFileName( );
void implGetAndCacheFiles( const ::com::sun::star::uno::Reference< XInterface >& xPicker , void implGetAndCacheFiles( const ::com::sun::star::uno::Reference< XInterface >& xPicker ,
SvStringsDtor*& rpURLList, std::vector<rtl::OUString>& rpURLList,
const SfxFilter* pFilter ); const SfxFilter* pFilter );
DECL_LINK( TimeOutHdl_Impl, Timer* ); DECL_LINK( TimeOutHdl_Impl, Timer* );
...@@ -193,7 +193,7 @@ namespace sfx2 ...@@ -193,7 +193,7 @@ namespace sfx2
); );
virtual ~FileDialogHelper_Impl(); virtual ~FileDialogHelper_Impl();
ErrCode execute( SvStringsDtor*& rpURLList, ErrCode execute( std::vector<rtl::OUString>& rpURLList,
SfxItemSet *& rpSet, SfxItemSet *& rpSet,
String& rFilter ); String& rFilter );
ErrCode execute(); ErrCode execute();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment