diff options
author | August Sodora <augsod@gmail.com> | 2012-01-11 21:27:38 -0500 |
---|---|---|
committer | August Sodora <augsod@gmail.com> | 2012-01-11 21:33:43 -0500 |
commit | 399e425fc9b9a89045bb1653769f581ed5fa5028 (patch) | |
tree | c7d3863139ae3129ebd366faa9cfe4d1d2d39e81 /fpicker/source/office | |
parent | 6a14a58299996b9c041d9e3e0878c4a0ecfb46ce (diff) |
SvStringsDtor->std::vector
Diffstat (limited to 'fpicker/source/office')
-rw-r--r-- | fpicker/source/office/OfficeFilePicker.cxx | 15 | ||||
-rw-r--r-- | fpicker/source/office/OfficeFolderPicker.cxx | 65 | ||||
-rw-r--r-- | fpicker/source/office/iodlg.cxx | 17 | ||||
-rw-r--r-- | fpicker/source/office/iodlg.hxx | 3 |
4 files changed, 22 insertions, 78 deletions
diff --git a/fpicker/source/office/OfficeFilePicker.cxx b/fpicker/source/office/OfficeFilePicker.cxx index a6d3da965294..c5f1a56dbfe2 100644 --- a/fpicker/source/office/OfficeFilePicker.cxx +++ b/fpicker/source/office/OfficeFilePicker.cxx @@ -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 // files first and then the list of the selected entries - SvStringsDtor* pPathList = getDialog()->GetPathList(); - sal_uInt16 i, nCount = pPathList->Count(); - sal_uInt16 nTotal = nCount > 1 ? nCount+1: nCount; + std::vector<rtl::OUString> aPathList(getDialog()->GetPathList()); + size_t nCount = aPathList.size(); + size_t nTotal = nCount > 1 ? nCount+1: nCount; Sequence< rtl::OUString > aPath( nTotal ); if ( nCount == 1 ) - aPath[0] = rtl::OUString( *pPathList->GetObject( 0 ) ); + aPath[0] = rtl::OUString(aPathList[0]); else if ( nCount > 1 ) { - INetURLObject aObj( *pPathList->GetObject( 0 ) ); + INetURLObject aObj(aPathList[0]); aObj.removeSegment(); 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(); } } - delete pPathList; return aPath; } diff --git a/fpicker/source/office/OfficeFolderPicker.cxx b/fpicker/source/office/OfficeFolderPicker.cxx index cc7a6b36b7b3..092723d51971 100644 --- a/fpicker/source/office/OfficeFolderPicker.cxx +++ b/fpicker/source/office/OfficeFolderPicker.cxx @@ -40,65 +40,39 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <unotools/pathoptions.hxx> -// using ---------------------------------------------------------------- - using namespace ::com::sun::star::container; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; -//------------------------------------------------------------------------------------ -// class SvtFolderPicker -//------------------------------------------------------------------------------------ - -//------------------------------------------------------------------------------------ SvtFolderPicker::SvtFolderPicker( const Reference < XMultiServiceFactory >& _rxFactory ) :OCommonPicker( _rxFactory ) { } -//------------------------------------------------------------------------------------ SvtFolderPicker::~SvtFolderPicker() { } -//------------------------------------------------------------------------------------ -// disambiguate XInterface -//------------------------------------------------------------------------------------ IMPLEMENT_FORWARD_XINTERFACE2( SvtFolderPicker, OCommonPicker, SvtFolderPicker_Base ) -//------------------------------------------------------------------------------------ -// disambiguate XTypeProvider -//------------------------------------------------------------------------------------ IMPLEMENT_FORWARD_XTYPEPROVIDER2( SvtFolderPicker, OCommonPicker, SvtFolderPicker_Base ) -//------------------------------------------------------------------------------------ -// XExecutableDialog functions -//------------------------------------------------------------------------------------ - -//------------------------------------------------------------------------------------ void SAL_CALL SvtFolderPicker::setTitle( const ::rtl::OUString& _rTitle ) throw (RuntimeException) { OCommonPicker::setTitle( _rTitle ); } -//------------------------------------------------------------------------------------ sal_Int16 SAL_CALL SvtFolderPicker::execute( ) throw (RuntimeException) { return OCommonPicker::execute(); } -//------------------------------------------------------------------------------------ -// XAsynchronousExecutableDialog functions -//------------------------------------------------------------------------------------ - -//------------------------------------------------------------------------------------ void SAL_CALL SvtFolderPicker::setDialogTitle( const ::rtl::OUString& _rTitle) throw (RuntimeException) { setTitle( _rTitle ); } -//------------------------------------------------------------------------------------ void SAL_CALL SvtFolderPicker::startExecuteModal( const Reference< ::com::sun::star::ui::dialogs::XDialogClosedListener >& xListener ) throw (RuntimeException) { m_xListener = xListener; @@ -108,13 +82,11 @@ void SAL_CALL SvtFolderPicker::startExecuteModal( const Reference< ::com::sun::s getDialog()->StartExecuteModal( LINK( this, SvtFolderPicker, DialogClosedHdl ) ); } -//------------------------------------------------------------------------------------ SvtFileDialog* SvtFolderPicker::implCreateDialog( Window* _pParent ) { return new SvtFileDialog( _pParent, SFXWB_PATHDIALOG ); } -//------------------------------------------------------------------------------------ sal_Int16 SvtFolderPicker::implExecutePicker( ) { prepareExecute(); @@ -126,7 +98,6 @@ sal_Int16 SvtFolderPicker::implExecutePicker( ) return nRet; } -//------------------------------------------------------------------------------------ void SvtFolderPicker::prepareExecute() { // set the default directory @@ -140,7 +111,6 @@ void SvtFolderPicker::prepareExecute() } } -//----------------------------------------------------------------------------- IMPL_LINK( SvtFolderPicker, DialogClosedHdl, Dialog*, pDlg ) { if ( m_xListener.is() ) @@ -153,63 +123,44 @@ IMPL_LINK( SvtFolderPicker, DialogClosedHdl, Dialog*, pDlg ) return 0; } -//------------------------------------------------------------------------------------ -// XFolderPicker functions -//------------------------------------------------------------------------------------ - void SAL_CALL SvtFolderPicker::setDisplayDirectory( const ::rtl::OUString& aDirectory ) throw( IllegalArgumentException, RuntimeException ) { m_aDisplayDirectory = aDirectory; } -//------------------------------------------------------------------------------------ ::rtl::OUString SAL_CALL SvtFolderPicker::getDisplayDirectory() throw( RuntimeException ) { - ::rtl::OUString aResult; - if ( ! getDialog() ) return m_aDisplayDirectory; - SvStringsDtor* pPathList = getDialog()->GetPathList(); - - if ( pPathList->Count() ) - aResult = ::rtl::OUString( *pPathList->GetObject( 0 ) ); + std::vector<rtl::OUString> aPathList(getDialog()->GetPathList()); - delete pPathList; + if(!aPathList.empty()) + return aPathList[0]; - return aResult; + return rtl::OUString(); } -//------------------------------------------------------------------------------------ ::rtl::OUString SAL_CALL SvtFolderPicker::getDirectory() throw( RuntimeException ) { - ::rtl::OUString aResult; - if ( ! getDialog() ) return m_aDisplayDirectory; - SvStringsDtor* pPathList = getDialog()->GetPathList(); + std::vector<rtl::OUString> aPathList(getDialog()->GetPathList()); - if ( pPathList->Count() ) - aResult = ::rtl::OUString( *pPathList->GetObject( 0 ) ); + if(!aPathList.empty()) + return aPathList[0]; - delete pPathList; - - return aResult; + return rtl::OUString(); } -//------------------------------------------------------------------------------------ void SAL_CALL SvtFolderPicker::setDescription( const ::rtl::OUString& aDescription ) throw( RuntimeException ) { m_aDescription = aDescription; } -//------------------------------------------------------------------------------------ -// XServiceInfo -//------------------------------------------------------------------------------------ - /* XServiceInfo */ ::rtl::OUString SAL_CALL SvtFolderPicker::getImplementationName() throw( RuntimeException ) { diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index 226eaf06aaf9..ac2b0a62e877 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -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(); SvLBoxEntry* pEntry = nCount ? _pFileView->FirstSelected() : NULL; if ( ! pEntry ) { - String* pURL; - if ( _pImp->_pEdFileName->GetText().Len() && _bIsInExecute ) - pURL = new String( _pImp->_pEdFileName->GetURL() ); + aList.push_back(_pImp->_pEdFileName->GetURL()); else - pURL = new String( _aPath ); - - pList->Insert( pURL, pList->Count() ); + aList.push_back(_aPath); } else { while ( pEntry ) { - String* pURL = new String( _pFileView->GetURL( pEntry ) ); - pList->Insert( pURL, pList->Count() ); + aList.push_back(_pFileView->GetURL(pEntry)); pEntry = _pFileView->NextSelected( pEntry ); } } - return pList; + return aList; } //***************************************************************************** diff --git a/fpicker/source/office/iodlg.hxx b/fpicker/source/office/iodlg.hxx index b33eeeede9b4..3a2a28cfae90 100644 --- a/fpicker/source/office/iodlg.hxx +++ b/fpicker/source/office/iodlg.hxx @@ -54,7 +54,6 @@ //***************************************************************************** class SvTabListBox; -class SvStringsDtor; class SvtFileView; struct ControlChain_Impl; class SvtFileDialogFilter_Impl; @@ -214,7 +213,7 @@ public: const ::com::sun::star::uno::Sequence< ::rtl::OUString >& GetBlackList() const; void SetStandardDir( const String& rStdDir ); const String& GetStandardDir() const; - SvStringsDtor* GetPathList() const; // for MultiSelection + std::vector<rtl::OUString> GetPathList() const; // for MultiSelection void AddFilter( const String& rFilter, const String& rType ); |