[Libreoffice-commits] .: 4 commits - sfx2/inc sfx2/source
August Sodora
augsod at kemper.freedesktop.org
Wed Jan 11 20:55:00 PST 2012
sfx2/inc/sfx2/filedlghelper.hxx | 11 +------
sfx2/inc/sfx2/macropg.hxx | 6 ---
sfx2/inc/sfx2/viewsh.hxx | 1
sfx2/source/appl/appopen.cxx | 15 ++++-----
sfx2/source/appl/linkmgr2.cxx | 3 -
sfx2/source/dialog/filedlghelper.cxx | 54 +++++++++++------------------------
sfx2/source/dialog/filedlgimpl.hxx | 4 +-
sfx2/source/dialog/templdlg.cxx | 24 +++++++--------
8 files changed, 40 insertions(+), 78 deletions(-)
New commits:
commit 5c445208a184fb88d8de0855be279e98d54dfad1
Author: August Sodora <augsod at gmail.com>
Date: Wed Jan 11 23:54:28 2012 -0500
SvStringsDtor->std::vector
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index 4e60a86..1c51c40 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -1320,7 +1320,7 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags)
SfxStyleSheetBase *pStyle = pStyleSheetPool->First();
SvLBoxEntry* pEntry = aFmtLb.First();
- SvStringsDtor aStrings;
+ std::vector<rtl::OUString> aStrings;
comphelper::string::NaturalStringSorter aSorter(
::comphelper::getProcessComponentContext(),
@@ -1329,21 +1329,19 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags)
while( pStyle )
{
//Bubblesort
- sal_uInt16 nPos;
- for( nPos = aStrings.Count() ; nPos &&
- aSorter.compare(*(aStrings[nPos-1]), pStyle->GetName()) > 0 ; nPos--)
+ size_t nPos;
+ for(nPos = aStrings.size(); nPos && aSorter.compare(aStrings[nPos-1], pStyle->GetName()) > 0; --nPos)
{};
- aStrings.Insert( new String( pStyle->GetName() ), nPos );
+ aStrings.insert(aStrings.begin() + nPos, pStyle->GetName());
pStyle = pStyleSheetPool->Next();
}
-
- sal_uInt16 nCount = aStrings.Count();
- sal_uInt16 nPos = 0;
- while( nPos < nCount && pEntry &&
- *aStrings[ nPos ] == aFmtLb.GetEntryText( pEntry ) )
+ size_t nCount = aStrings.size();
+ size_t nPos = 0;
+ while(nPos < nCount && pEntry &&
+ aStrings[nPos] == rtl::OUString(aFmtLb.GetEntryText(pEntry)))
{
- nPos++;
+ ++nPos;
pEntry = aFmtLb.Next( pEntry );
}
@@ -1353,8 +1351,8 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags)
aFmtLb.SetUpdateMode(sal_False);
aFmtLb.Clear();
- for(nPos = 0 ; nPos < nCount ; ++nPos )
- aFmtLb.InsertEntry( *aStrings.GetObject( nPos ), 0, sal_False, nPos);
+ for(nPos = 0; nPos < nCount; ++nPos)
+ aFmtLb.InsertEntry(aStrings[nPos], 0, sal_False, nPos);
aFmtLb.SetUpdateMode(true);
}
commit 17964c4f5a3aa25099b62db0e7652905cdf051a1
Author: August Sodora <augsod at gmail.com>
Date: Wed Jan 11 23:48:30 2012 -0500
Remove unused locals
diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx
index b7c5f2a..b7a4970 100644
--- a/sfx2/source/appl/linkmgr2.cxx
+++ b/sfx2/source/appl/linkmgr2.cxx
@@ -300,9 +300,6 @@ void LinkManager::UpdateAllLinks(
sal_Bool bUpdateGrfLinks,
Window* pParentWin )
{
- SvStringsDtor aApps, aTopics, aItems;
- String sApp, sTopic, sItem;
-
// First make a copy of the array in order to update links
// links in ... no contact between them!
SvPtrarr aTmpArr( 255, 50 );
commit 5cf36e9739a46ce20c4a3588962a04c6c4d1a72d
Author: August Sodora <augsod at gmail.com>
Date: Wed Jan 11 23:46:52 2012 -0500
Remove unnecessary forward declaration
diff --git a/sfx2/inc/sfx2/viewsh.hxx b/sfx2/inc/sfx2/viewsh.hxx
index 07cbdec..869de36 100644
--- a/sfx2/inc/sfx2/viewsh.hxx
+++ b/sfx2/inc/sfx2/viewsh.hxx
@@ -65,7 +65,6 @@ class SfxFrameSetDescriptor;
class Printer;
class SfxPrinter;
class SfxProgress;
-class SvStringsDtor;
class SfxFrameItem;
class Dialog;
class Menu;
commit 3ea8ee202832294adc09c0b1fd1c26cb87ca7cbf
Author: August Sodora <augsod at gmail.com>
Date: Wed Jan 11 23:44:05 2012 -0500
SvStringsDtor->std::vector
diff --git a/sfx2/inc/sfx2/filedlghelper.hxx b/sfx2/inc/sfx2/filedlghelper.hxx
index 3b3835b..faf2040 100644
--- a/sfx2/inc/sfx2/filedlghelper.hxx
+++ b/sfx2/inc/sfx2/filedlghelper.hxx
@@ -68,11 +68,8 @@ namespace com
}
class SfxItemSet;
-class SvStringsDtor;
class Window;
-//-----------------------------------------------------------------------------
-
// the SFXWB constants are for the nFlags parameter of the constructor
#define SFXWB_INSERT 0x04000000L // turn Open into Insert dialog
#define SFXWB_EXPORT 0x40000000L // turn Save into Export dialog
@@ -85,8 +82,6 @@ class Window;
#define FOLDER_PICKER_SERVICE_NAME "com.sun.star.ui.dialogs.FolderPicker"
#define FILE_OPEN_SERVICE_NAME_OOO "com.sun.star.ui.dialogs.OfficeFilePicker"
-//-----------------------------------------------------------------------------
-
namespace sfx2 {
class FileDialogHelper_Impl;
@@ -245,7 +240,7 @@ public:
DECL_LINK( ExecuteSystemFilePicker, void* );
- ErrCode Execute( SvStringsDtor*& rpURLList,
+ ErrCode Execute( std::vector<rtl::OUString>& rpURLList,
SfxItemSet *& rpSet,
String& rFilter,
const String& rDirPath );
@@ -260,7 +255,7 @@ public:
ErrCode FileOpenDialog_Impl( sal_Int16 nDialogType,
sal_Int64 nFlags,
const String& rFact,
- SvStringsDtor *& rpURLList,
+ std::vector<rtl::OUString>& rpURLList,
String& rFilter,
SfxItemSet *& rpSet,
const String* pPath = NULL,
@@ -272,8 +267,6 @@ ErrCode FileOpenDialog_Impl( sal_Int16 nDialogType,
ErrCode RequestPassword(const SfxFilter* pCurrentFilter, rtl::OUString& aURL, SfxItemSet* pSet);
}
-//-----------------------------------------------------------------------------
-
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/inc/sfx2/macropg.hxx b/sfx2/inc/sfx2/macropg.hxx
index 4620638..c0ffab3 100644
--- a/sfx2/inc/sfx2/macropg.hxx
+++ b/sfx2/inc/sfx2/macropg.hxx
@@ -38,15 +38,11 @@
#include <com/sun/star/frame/XFrame.hpp>
class _SfxMacroTabPage;
-class SvStringsDtor;
class SvTabListBox;
class Edit;
class String;
class SfxObjectShell;
-typedef SvStringsDtor* (*FNGetRangeHdl)( _SfxMacroTabPage*, const String& rLanguage );
-typedef SvStringsDtor* (*FNGetMacrosOfRangeHdl)( _SfxMacroTabPage*, const String& rLanguage, const String& rRange );
-
class SfxConfigGroupListBox_Impl;
class SfxConfigFunctionListBox_Impl;
@@ -91,8 +87,6 @@ public:
virtual void ScriptChanged( const String& rLanguage );
// zum setzen / abfragen der Links
- void SetGetRangeLink( FNGetRangeHdl pFn );
- FNGetRangeHdl GetGetRangeLink() const;
void SetGetMacrosOfRangeLink( FNGetMacrosOfRangeHdl pFn );
FNGetMacrosOfRangeHdl GetGetMacrosOfRangeLink() const;
diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx
index 7bb7a5c..3b45dc6 100644
--- a/sfx2/source/appl/appopen.cxx
+++ b/sfx2/source/appl/appopen.cxx
@@ -715,7 +715,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
if ( !pFileNameItem )
{
// get FileName from dialog
- SvStringsDtor* pURLList = NULL;
+ std::vector<rtl::OUString> pURLList;
String aFilter;
SfxItemSet* pSet = NULL;
String aPath;
@@ -757,7 +757,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
if ( nErr == ERRCODE_ABORT )
{
- delete pURLList;
+ pURLList.clear();
return;
}
@@ -768,7 +768,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
rReq.AppendItem( SfxStringItem( SID_REFERER, String::CreateFromAscii(SFX_REFERER_USER) ) );
delete pSet;
- if ( pURLList->Count() )
+ if(!pURLList.empty())
{
if ( nSID == SID_OPENTEMPLATE )
rReq.AppendItem( SfxBoolItem( SID_TEMPLATE, sal_False ) );
@@ -799,11 +799,10 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
::framework::PreventDuplicateInteraction::InteractionInfo aRule (aInteraction, 1);
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.AppendItem( SfxStringItem( SID_FILE_NAME, aURL ) );
+ rReq.AppendItem( SfxStringItem( SID_FILE_NAME, *i ) );
// Run synchronous, so that not the next document is loaded
// when rescheduling
@@ -832,10 +831,10 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
}
}
- delete pURLList;
+ pURLList.clear();
return;
}
- delete pURLList;
+ pURLList.clear();
}
sal_Bool bHyperlinkUsed = sal_False;
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index bacc37a..f09ad4d 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -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 )
{
lLastURLs.clear();
- sal_uInt16 c = rpURLList->Count();
- sal_uInt16 i = 0;
- for (i=0; i<c; ++i)
- lLastURLs.push_back(*(rpURLList->GetObject(i)));
+ for(std::vector<rtl::OUString>::iterator i = rpURLList.begin(); i != rpURLList.end(); ++i)
+ lLastURLs.push_back(*i);
}
// ------------------------------------------------------------------------
-void FileDialogHelper_Impl::implGetAndCacheFiles(const uno::Reference< XInterface >& xPicker ,
- SvStringsDtor*& rpURLList,
- const SfxFilter* pFilter )
+void FileDialogHelper_Impl::implGetAndCacheFiles(const uno::Reference< XInterface >& xPicker, std::vector<rtl::OUString>& rpURLList, const SfxFilter* pFilter)
{
- rpURLList = NULL;
+ rpURLList.clear();
rtl::OUString sExtension;
if (pFilter)
@@ -1395,14 +1391,10 @@ void FileDialogHelper_Impl::implGetAndCacheFiles(const uno::Reference< XInterfac
uno::Reference< XFilePicker2 > xPickNew(xPicker, UNO_QUERY);
if (xPickNew.is())
{
- rpURLList = new SvStringsDtor;
Sequence< OUString > lFiles = xPickNew->getSelectedFiles();
::sal_Int32 nFiles = lFiles.getLength();
- for (::sal_Int32 i = 0; i < nFiles; i++)
- {
- String* pURL = new String(lFiles[i]);
- rpURLList->Insert( pURL, rpURLList->Count() );
- }
+ for(sal_Int32 i = 0; i < nFiles; ++i)
+ rpURLList.push_back(lFiles[i]);
}
// b) the olde way ... non optional.
@@ -1413,15 +1405,10 @@ void FileDialogHelper_Impl::implGetAndCacheFiles(const uno::Reference< XInterfac
::sal_Int32 nFiles = lFiles.getLength();
if ( nFiles == 1 )
{
- rpURLList = new SvStringsDtor;
- String* pURL = new String(lFiles[0]);
- rpURLList->Insert( pURL, 0 );
+ rpURLList.push_back(lFiles[0]);
}
- else
- if ( nFiles > 1 )
+ else if ( nFiles > 1 )
{
- rpURLList = new SvStringsDtor;
-
INetURLObject aPath( lFiles[0] );
aPath.setFinalSlash();
@@ -1432,8 +1419,7 @@ void FileDialogHelper_Impl::implGetAndCacheFiles(const uno::Reference< XInterfac
else
aPath.setName( lFiles[i] );
- String* pURL = new String(aPath.GetMainURL( INetURLObject::NO_DECODE ) );
- rpURLList->Insert( pURL, rpURLList->Count() );
+ rpURLList.push_back(aPath.GetMainURL(INetURLObject::NO_DECODE));
}
}
}
@@ -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,
String& rFilter )
{
@@ -1489,7 +1475,7 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList,
aSecOpt.IsOptionSet( SvtSecurityOptions::E_DOCWARN_RECOMMENDPASSWORD ) );
}
- rpURLList = NULL;
+ rpURLList.clear();
if ( ! mxFileDlg.is() )
return ERRCODE_ABORT;
@@ -1560,7 +1546,7 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList,
// fill the rpURLList
implGetAndCacheFiles( mxFileDlg, rpURLList, pCurrentFilter );
- if ( rpURLList == NULL || rpURLList->GetObject(0) == NULL )
+ if ( rpURLList.empty() )
return ERRCODE_ABORT;
// check, wether or not we have to display a password box
@@ -1573,7 +1559,7 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList,
if ( ( aValue >>= bPassWord ) && bPassWord )
{
// ask for a password
- rtl::OUString aDocName(*(rpURLList->GetObject(0)));
+ rtl::OUString aDocName(rpURLList[0]);
ErrCode errCode = RequestPassword(pCurrentFilter, aDocName, rpSet);
if (errCode != ERRCODE_NONE)
return errCode;
@@ -2326,7 +2312,7 @@ IMPL_LINK( FileDialogHelper, ExecuteSystemFilePicker, void*, EMPTYARG )
// ------------------------------------------------------------------------
// rDirPath has to be a directory
-ErrCode FileDialogHelper::Execute( SvStringsDtor*& rpURLList,
+ErrCode FileDialogHelper::Execute( std::vector<rtl::OUString>& rpURLList,
SfxItemSet *& rpSet,
String& rFilter,
const String& rDirPath )
@@ -2347,12 +2333,8 @@ ErrCode FileDialogHelper::Execute( SfxItemSet *& rpSet,
String& rFilter )
{
ErrCode nRet;
- SvStringsDtor* pURLList;
-
- nRet = mpImp->execute( pURLList, rpSet, rFilter );
-
- delete pURLList;
-
+ std::vector<rtl::OUString> rURLList;
+ nRet = mpImp->execute(rURLList, rpSet, rFilter);
return nRet;
}
@@ -2638,7 +2620,7 @@ void SAL_CALL FileDialogHelper::DialogClosed( const DialogClosedEvent& _rEvent )
ErrCode FileOpenDialog_Impl( sal_Int16 nDialogType,
sal_Int64 nFlags,
const String& rFact,
- SvStringsDtor *& rpURLList,
+ std::vector<rtl::OUString>& rpURLList,
String& rFilter,
SfxItemSet *& rpSet,
const String* pPath,
diff --git a/sfx2/source/dialog/filedlgimpl.hxx b/sfx2/source/dialog/filedlgimpl.hxx
index 1da12fb..5bfce3c 100644
--- a/sfx2/source/dialog/filedlgimpl.hxx
+++ b/sfx2/source/dialog/filedlgimpl.hxx
@@ -153,7 +153,7 @@ namespace sfx2
void implInitializeFileName( );
void implGetAndCacheFiles( const ::com::sun::star::uno::Reference< XInterface >& xPicker ,
- SvStringsDtor*& rpURLList,
+ std::vector<rtl::OUString>& rpURLList,
const SfxFilter* pFilter );
DECL_LINK( TimeOutHdl_Impl, Timer* );
@@ -193,7 +193,7 @@ namespace sfx2
);
virtual ~FileDialogHelper_Impl();
- ErrCode execute( SvStringsDtor*& rpURLList,
+ ErrCode execute( std::vector<rtl::OUString>& rpURLList,
SfxItemSet *& rpSet,
String& rFilter );
ErrCode execute();
More information about the Libreoffice-commits
mailing list