[Libreoffice-commits] .: 2 commits - fpicker/source

August Sodora augsod at kemper.freedesktop.org
Wed Jan 11 18:33:52 PST 2012


 fpicker/source/office/OfficeFilePicker.cxx   |   15 ++----
 fpicker/source/office/OfficeFolderPicker.cxx |   65 +++------------------------
 fpicker/source/office/iodlg.cxx              |   17 ++-----
 fpicker/source/office/iodlg.hxx              |    3 -
 fpicker/source/office/iodlgimp.cxx           |   18 ++-----
 fpicker/source/office/iodlgimp.hxx           |   37 ---------------
 6 files changed, 30 insertions(+), 125 deletions(-)

New commits:
commit 278c91304cbfb66b05cd39c16282bde944758093
Author: August Sodora <augsod at gmail.com>
Date:   Wed Jan 11 21:33:02 2012 -0500

    SvStringsDtor->std::vector

diff --git a/fpicker/source/office/iodlgimp.cxx b/fpicker/source/office/iodlgimp.cxx
index 2fabd62..2c7b4c1 100644
--- a/fpicker/source/office/iodlgimp.cxx
+++ b/fpicker/source/office/iodlgimp.cxx
@@ -189,14 +189,12 @@ void SvtFileDialogURLSelector::Activate()
 //-----------------------------------------------------------------------------
 SvtUpButton_Impl::SvtUpButton_Impl( SvtFileDialog* pParent, const ResId& rResId )
     :SvtFileDialogURLSelector( pParent, rResId, IMG_FILEDLG_BTN_UP )
-    ,_pURLs                  ( NULL )
 {
 }
 
 //-----------------------------------------------------------------------------
 SvtUpButton_Impl::~SvtUpButton_Impl()
 {
-    delete _pURLs;
 }
 
 //-----------------------------------------------------------------------------
@@ -206,8 +204,7 @@ void SvtUpButton_Impl::FillURLMenu( PopupMenu* _pMenu )
 
     sal_uInt16 nItemId = 1;
 
-    delete _pURLs;
-    _pURLs = new SvStringsDtor;
+    _aURLs.clear();
 
     // determine parent levels
     INetURLObject aObject( pBox->GetViewURL() );
@@ -221,20 +218,20 @@ void SvtUpButton_Impl::FillURLMenu( PopupMenu* _pMenu )
     while ( nCount >= 1 )
     {
         aObject.removeSegment();
-        String* pParentURL = new String( aObject.GetMainURL( INetURLObject::NO_DECODE ) );
+        String aParentURL(aObject.GetMainURL(INetURLObject::NO_DECODE));
 
-        if ( GetDialogParent()->isUrlAllowed( *pParentURL ) )
+        if (GetDialogParent()->isUrlAllowed(aParentURL))
         {
             String aTitle;
             // 97148# --------------------------------
-            if ( !GetDialogParent()->ContentGetTitle( *pParentURL, aTitle ) || aTitle.Len() == 0 )
+            if (!GetDialogParent()->ContentGetTitle(aParentURL, aTitle) || aTitle.Len() == 0)
                 aTitle = aObject.getName();
 
             Image aImage = ( nCount > 1 ) // if nCount == 1 means workplace, which detects the wrong image
                 ? SvFileInformationManager::GetImage( aObject ) : aVolumeImage;
 
             _pMenu->InsertItem( nItemId++, aTitle, aImage );
-            _pURLs->Insert( pParentURL, _pURLs->Count() );
+            _aURLs.push_back(aParentURL);
 
             if ( nCount == 1 )
             {
@@ -255,10 +252,9 @@ void SvtUpButton_Impl::Select()
     if ( nId )
     {
         --nId;
-        DBG_ASSERT( nId <= _pURLs->Count(), "SvtUpButton_Impl:falscher Index" );
+        DBG_ASSERT( nId <= _aURLs.size(), "SvtUpButton_Impl:falscher Index" );
 
-        String aURL = *(_pURLs->GetObject( nId ));
-        GetDialogParent()->OpenURL_Impl( aURL );
+        GetDialogParent()->OpenURL_Impl(_aURLs[nId]);
     }
 }
 
diff --git a/fpicker/source/office/iodlgimp.hxx b/fpicker/source/office/iodlgimp.hxx
index 1048bc3..7c1eb85 100644
--- a/fpicker/source/office/iodlgimp.hxx
+++ b/fpicker/source/office/iodlgimp.hxx
@@ -39,14 +39,9 @@
 
 #include <vector>
 
-//*****************************************************************************
-
 class Accelerator;
 class CheckBox;
 class SvtFileDialog;
-class SvStringsDtor;
-
-//*****************************************************************************
 
 #define FILEDIALOG_DEF_EXTSEP       ';'
 #define FILEDIALOG_DEF_WILDCARD     '*'
@@ -79,35 +74,20 @@ public:
     sal_Bool            isGroupSeparator() const    { return 0 == m_aType.Len(); }
 };
 
-//*****************************************************************************
-// SvtFileDialogFilterList_Impl
-//*****************************************************************************
-
 SV_DECL_PTRARR_DEL( SvtFileDialogFilterList_Impl, SvtFileDialogFilter_Impl*, 3, 3 )
 
-//*****************************************************************************
-// SvtFileDlgMode
-//*****************************************************************************
-
 enum SvtFileDlgMode
 {
     FILEDLG_MODE_OPEN = 0,
     FILEDLG_MODE_SAVE = 1
 };
 
-//*****************************************************************************
-// SvtFileDlgType
-//*****************************************************************************
-
 enum SvtFileDlgType
 {
     FILEDLG_TYPE_FILEDLG = 0,
     FILEDLG_TYPE_PATHDLG
 };
 
-//*****************************************************************************
-// SvtFileDialogURLSelector
-//*****************************************************************************
 class SvtFileDialogURLSelector : public MenuButton
 {
 private:
@@ -129,14 +109,10 @@ protected:
     virtual void        Activate();
 };
 
-//*****************************************************************************
-// SvtUpButton_Impl
-//*****************************************************************************
-
 class SvtUpButton_Impl : public SvtFileDialogURLSelector
 {
 private:
-    SvStringsDtor*      _pURLs;
+    std::vector<rtl::OUString> _aURLs;
 
 public:
     SvtUpButton_Impl( SvtFileDialog* pParent, const ResId& rResId );
@@ -148,10 +124,6 @@ protected:
     virtual void        Click();
 };
 
-//*****************************************************************************
-// SvtTravelButton_Impl
-//*****************************************************************************
-
 class SvtTravelButton_Impl : public SvtFileDialogURLSelector
 {
 private:
@@ -169,18 +141,11 @@ protected:
     virtual void        Click();
 };
 
-//*****************************************************************************
-// SvtFileDlgState
-//*****************************************************************************
-
 typedef sal_uInt8 SvtFileDlgState;
 
 #define FILEDLG_STATE_NONE        ((SvtFileDlgState)0x00)
 #define FILEDLG_STATE_REMOTE      ((SvtFileDlgState)0x01)
 
-//*****************************************************************************
-// SvtExpFileDlg_Impl
-//*****************************************************************************
 class SvtURLBox;
 class SvtExpFileDlg_Impl
 {
commit 399e425fc9b9a89045bb1653769f581ed5fa5028
Author: August Sodora <augsod at gmail.com>
Date:   Wed Jan 11 21:27:38 2012 -0500

    SvStringsDtor->std::vector

diff --git a/fpicker/source/office/OfficeFilePicker.cxx b/fpicker/source/office/OfficeFilePicker.cxx
index a6d3da9..c5f1a56 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 cc7a6b3..092723d 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 226eaf0..ac2b0a6 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 b33eeee..3a2a28c 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 );


More information about the Libreoffice-commits mailing list