Kaydet (Commit) 399e425f authored tarafından August Sodora's avatar August Sodora

SvStringsDtor->std::vector

üst 6a14a582
...@@ -616,28 +616,27 @@ Sequence< rtl::OUString > SAL_CALL SvtFilePicker::getFiles() throw( RuntimeExcep ...@@ -616,28 +616,27 @@ Sequence< rtl::OUString > SAL_CALL SvtFilePicker::getFiles() throw( RuntimeExcep
// if there is more than one path we have to return the path to the // if there is more than one path we have to return the path to the
// files first and then the list of the selected entries // files first and then the list of the selected entries
SvStringsDtor* pPathList = getDialog()->GetPathList(); std::vector<rtl::OUString> aPathList(getDialog()->GetPathList());
sal_uInt16 i, nCount = pPathList->Count(); size_t nCount = aPathList.size();
sal_uInt16 nTotal = nCount > 1 ? nCount+1: nCount; size_t nTotal = nCount > 1 ? nCount+1: nCount;
Sequence< rtl::OUString > aPath( nTotal ); Sequence< rtl::OUString > aPath( nTotal );
if ( nCount == 1 ) if ( nCount == 1 )
aPath[0] = rtl::OUString( *pPathList->GetObject( 0 ) ); aPath[0] = rtl::OUString(aPathList[0]);
else if ( nCount > 1 ) else if ( nCount > 1 )
{ {
INetURLObject aObj( *pPathList->GetObject( 0 ) ); INetURLObject aObj(aPathList[0]);
aObj.removeSegment(); aObj.removeSegment();
aPath[0] = aObj.GetMainURL( INetURLObject::NO_DECODE ); aPath[0] = aObj.GetMainURL( INetURLObject::NO_DECODE );
for ( i = 0; i < nCount; /* i++ is done below */ ) for(size_t i = 0; i < aPathList.size(); ++i)
{ {
aObj.SetURL( *pPathList->GetObject(i++) ); aObj.SetURL(aPathList[i]);
aPath[i] = aObj.getName(); aPath[i] = aObj.getName();
} }
} }
delete pPathList;
return aPath; return aPath;
} }
......
...@@ -40,65 +40,39 @@ ...@@ -40,65 +40,39 @@
#include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertySet.hpp>
#include <unotools/pathoptions.hxx> #include <unotools/pathoptions.hxx>
// using ----------------------------------------------------------------
using namespace ::com::sun::star::container; using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang; using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::uno; using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans; using namespace ::com::sun::star::beans;
//------------------------------------------------------------------------------------
// class SvtFolderPicker
//------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------
SvtFolderPicker::SvtFolderPicker( const Reference < XMultiServiceFactory >& _rxFactory ) SvtFolderPicker::SvtFolderPicker( const Reference < XMultiServiceFactory >& _rxFactory )
:OCommonPicker( _rxFactory ) :OCommonPicker( _rxFactory )
{ {
} }
//------------------------------------------------------------------------------------
SvtFolderPicker::~SvtFolderPicker() SvtFolderPicker::~SvtFolderPicker()
{ {
} }
//------------------------------------------------------------------------------------
// disambiguate XInterface
//------------------------------------------------------------------------------------
IMPLEMENT_FORWARD_XINTERFACE2( SvtFolderPicker, OCommonPicker, SvtFolderPicker_Base ) IMPLEMENT_FORWARD_XINTERFACE2( SvtFolderPicker, OCommonPicker, SvtFolderPicker_Base )
//------------------------------------------------------------------------------------
// disambiguate XTypeProvider
//------------------------------------------------------------------------------------
IMPLEMENT_FORWARD_XTYPEPROVIDER2( SvtFolderPicker, OCommonPicker, SvtFolderPicker_Base ) IMPLEMENT_FORWARD_XTYPEPROVIDER2( SvtFolderPicker, OCommonPicker, SvtFolderPicker_Base )
//------------------------------------------------------------------------------------
// XExecutableDialog functions
//------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------
void SAL_CALL SvtFolderPicker::setTitle( const ::rtl::OUString& _rTitle ) throw (RuntimeException) void SAL_CALL SvtFolderPicker::setTitle( const ::rtl::OUString& _rTitle ) throw (RuntimeException)
{ {
OCommonPicker::setTitle( _rTitle ); OCommonPicker::setTitle( _rTitle );
} }
//------------------------------------------------------------------------------------
sal_Int16 SAL_CALL SvtFolderPicker::execute( ) throw (RuntimeException) sal_Int16 SAL_CALL SvtFolderPicker::execute( ) throw (RuntimeException)
{ {
return OCommonPicker::execute(); return OCommonPicker::execute();
} }
//------------------------------------------------------------------------------------
// XAsynchronousExecutableDialog functions
//------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------
void SAL_CALL SvtFolderPicker::setDialogTitle( const ::rtl::OUString& _rTitle) throw (RuntimeException) void SAL_CALL SvtFolderPicker::setDialogTitle( const ::rtl::OUString& _rTitle) throw (RuntimeException)
{ {
setTitle( _rTitle ); setTitle( _rTitle );
} }
//------------------------------------------------------------------------------------
void SAL_CALL SvtFolderPicker::startExecuteModal( const Reference< ::com::sun::star::ui::dialogs::XDialogClosedListener >& xListener ) throw (RuntimeException) void SAL_CALL SvtFolderPicker::startExecuteModal( const Reference< ::com::sun::star::ui::dialogs::XDialogClosedListener >& xListener ) throw (RuntimeException)
{ {
m_xListener = xListener; m_xListener = xListener;
...@@ -108,13 +82,11 @@ void SAL_CALL SvtFolderPicker::startExecuteModal( const Reference< ::com::sun::s ...@@ -108,13 +82,11 @@ void SAL_CALL SvtFolderPicker::startExecuteModal( const Reference< ::com::sun::s
getDialog()->StartExecuteModal( LINK( this, SvtFolderPicker, DialogClosedHdl ) ); getDialog()->StartExecuteModal( LINK( this, SvtFolderPicker, DialogClosedHdl ) );
} }
//------------------------------------------------------------------------------------
SvtFileDialog* SvtFolderPicker::implCreateDialog( Window* _pParent ) SvtFileDialog* SvtFolderPicker::implCreateDialog( Window* _pParent )
{ {
return new SvtFileDialog( _pParent, SFXWB_PATHDIALOG ); return new SvtFileDialog( _pParent, SFXWB_PATHDIALOG );
} }
//------------------------------------------------------------------------------------
sal_Int16 SvtFolderPicker::implExecutePicker( ) sal_Int16 SvtFolderPicker::implExecutePicker( )
{ {
prepareExecute(); prepareExecute();
...@@ -126,7 +98,6 @@ sal_Int16 SvtFolderPicker::implExecutePicker( ) ...@@ -126,7 +98,6 @@ sal_Int16 SvtFolderPicker::implExecutePicker( )
return nRet; return nRet;
} }
//------------------------------------------------------------------------------------
void SvtFolderPicker::prepareExecute() void SvtFolderPicker::prepareExecute()
{ {
// set the default directory // set the default directory
...@@ -140,7 +111,6 @@ void SvtFolderPicker::prepareExecute() ...@@ -140,7 +111,6 @@ void SvtFolderPicker::prepareExecute()
} }
} }
//-----------------------------------------------------------------------------
IMPL_LINK( SvtFolderPicker, DialogClosedHdl, Dialog*, pDlg ) IMPL_LINK( SvtFolderPicker, DialogClosedHdl, Dialog*, pDlg )
{ {
if ( m_xListener.is() ) if ( m_xListener.is() )
...@@ -153,63 +123,44 @@ IMPL_LINK( SvtFolderPicker, DialogClosedHdl, Dialog*, pDlg ) ...@@ -153,63 +123,44 @@ IMPL_LINK( SvtFolderPicker, DialogClosedHdl, Dialog*, pDlg )
return 0; return 0;
} }
//------------------------------------------------------------------------------------
// XFolderPicker functions
//------------------------------------------------------------------------------------
void SAL_CALL SvtFolderPicker::setDisplayDirectory( const ::rtl::OUString& aDirectory ) void SAL_CALL SvtFolderPicker::setDisplayDirectory( const ::rtl::OUString& aDirectory )
throw( IllegalArgumentException, RuntimeException ) throw( IllegalArgumentException, RuntimeException )
{ {
m_aDisplayDirectory = aDirectory; m_aDisplayDirectory = aDirectory;
} }
//------------------------------------------------------------------------------------
::rtl::OUString SAL_CALL SvtFolderPicker::getDisplayDirectory() throw( RuntimeException ) ::rtl::OUString SAL_CALL SvtFolderPicker::getDisplayDirectory() throw( RuntimeException )
{ {
::rtl::OUString aResult;
if ( ! getDialog() ) if ( ! getDialog() )
return m_aDisplayDirectory; return m_aDisplayDirectory;
SvStringsDtor* pPathList = getDialog()->GetPathList(); std::vector<rtl::OUString> aPathList(getDialog()->GetPathList());
if ( pPathList->Count() )
aResult = ::rtl::OUString( *pPathList->GetObject( 0 ) );
delete pPathList; if(!aPathList.empty())
return aPathList[0];
return aResult; return rtl::OUString();
} }
//------------------------------------------------------------------------------------
::rtl::OUString SAL_CALL SvtFolderPicker::getDirectory() throw( RuntimeException ) ::rtl::OUString SAL_CALL SvtFolderPicker::getDirectory() throw( RuntimeException )
{ {
::rtl::OUString aResult;
if ( ! getDialog() ) if ( ! getDialog() )
return m_aDisplayDirectory; return m_aDisplayDirectory;
SvStringsDtor* pPathList = getDialog()->GetPathList(); std::vector<rtl::OUString> aPathList(getDialog()->GetPathList());
if ( pPathList->Count() ) if(!aPathList.empty())
aResult = ::rtl::OUString( *pPathList->GetObject( 0 ) ); return aPathList[0];
delete pPathList; return rtl::OUString();
return aResult;
} }
//------------------------------------------------------------------------------------
void SAL_CALL SvtFolderPicker::setDescription( const ::rtl::OUString& aDescription ) void SAL_CALL SvtFolderPicker::setDescription( const ::rtl::OUString& aDescription )
throw( RuntimeException ) throw( RuntimeException )
{ {
m_aDescription = aDescription; m_aDescription = aDescription;
} }
//------------------------------------------------------------------------------------
// XServiceInfo
//------------------------------------------------------------------------------------
/* XServiceInfo */ /* XServiceInfo */
::rtl::OUString SAL_CALL SvtFolderPicker::getImplementationName() throw( RuntimeException ) ::rtl::OUString SAL_CALL SvtFolderPicker::getImplementationName() throw( RuntimeException )
{ {
......
...@@ -2452,34 +2452,29 @@ void SvtFileDialog::InitSize() ...@@ -2452,34 +2452,29 @@ void SvtFileDialog::InitSize()
//***************************************************************************** //*****************************************************************************
SvStringsDtor* SvtFileDialog::GetPathList() const std::vector<rtl::OUString> SvtFileDialog::GetPathList() const
{ {
SvStringsDtor* pList = new SvStringsDtor; std::vector<rtl::OUString> aList;
sal_uLong nCount = _pFileView->GetSelectionCount(); sal_uLong nCount = _pFileView->GetSelectionCount();
SvLBoxEntry* pEntry = nCount ? _pFileView->FirstSelected() : NULL; SvLBoxEntry* pEntry = nCount ? _pFileView->FirstSelected() : NULL;
if ( ! pEntry ) if ( ! pEntry )
{ {
String* pURL;
if ( _pImp->_pEdFileName->GetText().Len() && _bIsInExecute ) if ( _pImp->_pEdFileName->GetText().Len() && _bIsInExecute )
pURL = new String( _pImp->_pEdFileName->GetURL() ); aList.push_back(_pImp->_pEdFileName->GetURL());
else else
pURL = new String( _aPath ); aList.push_back(_aPath);
pList->Insert( pURL, pList->Count() );
} }
else else
{ {
while ( pEntry ) while ( pEntry )
{ {
String* pURL = new String( _pFileView->GetURL( pEntry ) ); aList.push_back(_pFileView->GetURL(pEntry));
pList->Insert( pURL, pList->Count() );
pEntry = _pFileView->NextSelected( pEntry ); pEntry = _pFileView->NextSelected( pEntry );
} }
} }
return pList; return aList;
} }
//***************************************************************************** //*****************************************************************************
......
...@@ -54,7 +54,6 @@ ...@@ -54,7 +54,6 @@
//***************************************************************************** //*****************************************************************************
class SvTabListBox; class SvTabListBox;
class SvStringsDtor;
class SvtFileView; class SvtFileView;
struct ControlChain_Impl; struct ControlChain_Impl;
class SvtFileDialogFilter_Impl; class SvtFileDialogFilter_Impl;
...@@ -214,7 +213,7 @@ public: ...@@ -214,7 +213,7 @@ public:
const ::com::sun::star::uno::Sequence< ::rtl::OUString >& GetBlackList() const; const ::com::sun::star::uno::Sequence< ::rtl::OUString >& GetBlackList() const;
void SetStandardDir( const String& rStdDir ); void SetStandardDir( const String& rStdDir );
const String& GetStandardDir() const; const String& GetStandardDir() const;
SvStringsDtor* GetPathList() const; // for MultiSelection std::vector<rtl::OUString> GetPathList() const; // for MultiSelection
void AddFilter( const String& rFilter, void AddFilter( const String& rFilter,
const String& rType ); const String& rType );
......
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