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
// 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;
}
......
......@@ -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 )
{
......
......@@ -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;
}
//*****************************************************************************
......
......@@ -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 );
......
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