[Libreoffice-commits] .: sc/source svl/inc svl/source sw/source

2012-02-07 Thread Kohei Yoshida
 sc/source/ui/app/scmod.cxx  |   38 +-
 sc/source/ui/docshell/docsh4.cxx|   16 +--
 sc/source/ui/drawfunc/fuins2.cxx|4 +-
 sc/source/ui/optdlg/tpcompatibility.cxx |2 -
 sc/source/ui/pagedlg/scuitphfedit.cxx   |2 -
 sc/source/ui/view/cellsh1.cxx   |   40 ++--
 sc/source/ui/view/cellsh4.cxx   |8 ++---
 sc/source/ui/view/tabvwsh3.cxx  |4 +-
 sc/source/ui/view/tabvwshf.cxx  |   24 
 svl/inc/svl/itemset.hxx |2 -
 svl/source/items/itemset.cxx|8 ++---
 sw/source/filter/ww8/rtfattributeoutput.cxx |6 ++--
 12 files changed, 77 insertions(+), 77 deletions(-)

New commits:
commit 8e6e880949b3f603c3d26ab5467cb417b92ae2be
Author: Kohei Yoshida 
Date:   Tue Feb 7 11:18:31 2012 -0500

Have SfxItemSet::HasItem take an optional pointer-to-pointer.

To make it clear that the second argument is optional.

diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 7072387..2b84ace 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -994,26 +994,26 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
 
 //  Linguistik nicht mehr
 
-if (rOptSet.HasItem(SID_ATTR_METRIC, pItem))
+if (rOptSet.HasItem(SID_ATTR_METRIC, &pItem))
 {
 PutItem( *pItem );
 pAppCfg->SetAppMetric( (FieldUnit)((const 
SfxUInt16Item*)pItem)->GetValue() );
 bSaveAppOptions = sal_True;
 }
 
-if (rOptSet.HasItem(SCITEM_USERLIST, pItem))
+if (rOptSet.HasItem(SCITEM_USERLIST, &pItem))
 {
 ScGlobal::SetUserList( ((const ScUserListItem*)pItem)->GetUserList() );
 bSaveAppOptions = sal_True;
 }
 
-if (rOptSet.HasItem(SID_SC_OPT_SYNCZOOM, pItem))
+if (rOptSet.HasItem(SID_SC_OPT_SYNCZOOM, &pItem))
 {
 pAppCfg->SetSynchronizeZoom( static_cast(pItem)->GetValue() );
 bSaveAppOptions = sal_True;
 }
 
-if (rOptSet.HasItem(SID_SC_OPT_KEY_BINDING_COMPAT, pItem))
+if (rOptSet.HasItem(SID_SC_OPT_KEY_BINDING_COMPAT, &pItem))
 {
 sal_uInt16 nVal = static_cast(pItem)->GetValue();
 ScOptionsUtil::KeyBindingType eOld = pAppCfg->GetKeyBindingType();
@@ -1030,7 +1030,7 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
 // ViewOptions
 //
 
-if (rOptSet.HasItem(SID_SCVIEWOPTIONS, pItem))
+if (rOptSet.HasItem(SID_SCVIEWOPTIONS, &pItem))
 {
 const ScViewOptions& rNewOpt = ((const 
ScTpViewItem*)pItem)->GetViewOptions();
 
@@ -1062,7 +1062,7 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
 // da GridOptions Member der ViewOptions ist!
 //
 
-if ( rOptSet.HasItem(SID_ATTR_GRID_OPTIONS,pItem) )
+if ( rOptSet.HasItem(SID_ATTR_GRID_OPTIONS,&pItem) )
 {
 ScGridOptions aNewGridOpt( (const SvxOptionsGrid&)((const 
SvxGridItem&)*pItem) );
 
@@ -1096,7 +1096,7 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
 // DocOptions
 //
 
-if ( rOptSet.HasItem(SID_SCDOCOPTIONS,pItem) )
+if ( rOptSet.HasItem(SID_SCDOCOPTIONS,&pItem) )
 {
 const ScDocOptions& rNewOpt = ((const 
ScTpCalcItem*)pItem)->GetDocOptions();
 
@@ -1124,7 +1124,7 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
 }
 
 // nach den eigentlichen DocOptions auch noch die TabDistance setzen
-if ( rOptSet.HasItem(SID_ATTR_DEFTABSTOP,pItem) )
+if ( rOptSet.HasItem(SID_ATTR_DEFTABSTOP,&pItem) )
 {
 sal_uInt16 nTabDist = ((SfxUInt16Item*)pItem)->GetValue();
 ScDocOptions aOpt(GetDocOptions());
@@ -1144,7 +1144,7 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
 
 //  AutoSpell nach den Doc-Options (weil Member)
 
-if ( rOptSet.HasItem(SID_AUTOSPELL_CHECK,pItem) )  // an 
Doc-Options
+if ( rOptSet.HasItem(SID_AUTOSPELL_CHECK,&pItem) )  // an 
Doc-Options
 {
 sal_Bool bDoAutoSpell = ((const SfxBoolItem*)pItem)->GetValue();
 
@@ -1190,43 +1190,43 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet 
)
 // InputOptions
 //
 
-if ( rOptSet.HasItem(SID_SC_INPUT_SELECTIONPOS,pItem) )
+if ( rOptSet.HasItem(SID_SC_INPUT_SELECTIONPOS,&pItem) )
 {
 pInputCfg->SetMoveDir( ((const SfxUInt16Item*)pItem)->GetValue() );
 bSaveInputOptions = sal_True;
 }
-if ( rOptSet.HasItem(SID_SC_INPUT_SELECTION,pItem) )
+if ( rOptSet.HasItem(SID_SC_INPUT_SELECTION,&pItem) )
 {
 pInputCfg->SetMoveSelection( ((const SfxBoolItem*)pItem)->GetValue() );
 bSaveInputOptions = sal_True;
 }
-if ( rOptSet.HasItem(SID_SC_INPUT_EDITMODE,pItem) )
+if ( rOptSet.HasItem(SID_SC_INPUT_ED

[Libreoffice-commits] .: sc/source svl/inc svl/source

2012-02-06 Thread Kohei Yoshida
 sc/source/ui/app/scmod.cxx|   42 +++---
 sc/source/ui/docshell/docsh4.cxx  |   19 ++-
 sc/source/ui/drawfunc/fuins2.cxx  |9 +--
 sc/source/ui/pagedlg/scuitphfedit.cxx |   13 ++
 sc/source/ui/view/cellsh1.cxx |   42 --
 sc/source/ui/view/cellsh2.cxx |5 
 sc/source/ui/view/cellsh4.cxx |   14 +++
 sc/source/ui/view/tabvwsh3.cxx|6 +---
 sc/source/ui/view/tabvwshd.cxx|5 
 sc/source/ui/view/tabvwshf.cxx|   29 +--
 svl/inc/svl/itemset.hxx   |2 +
 svl/source/items/itemset.cxx  |5 
 12 files changed, 77 insertions(+), 114 deletions(-)

New commits:
commit e64c291c5fd1d3ff625dc118ad7e0460df03eb78
Author: Kohei Yoshida 
Date:   Mon Feb 6 14:29:55 2012 -0500

I think it's time we had a real method for this...

This helps eliminate dozens of IS_AVAILABLE macros scattered across
Calc code.  I'm sure we have other similar macros like this
elsewhere.

diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index a011370..7072387 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -958,8 +958,6 @@ sal_uInt16 ScModule::GetOptDigitLanguage()
 //  und SID_AUTOSPELL_CHECK
 //
 
-#define IS_AVAILABLE(w,item) 
(SFX_ITEM_SET==rOptSet.GetItemState((w),sal_True,&item))
-
 void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
 {
 sal_uInt16 nOldSpellLang, nOldCjkLang, nOldCtlLang;
@@ -996,26 +994,26 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
 
 //  Linguistik nicht mehr
 
-if ( IS_AVAILABLE(SID_ATTR_METRIC,pItem) )
+if (rOptSet.HasItem(SID_ATTR_METRIC, pItem))
 {
 PutItem( *pItem );
 pAppCfg->SetAppMetric( (FieldUnit)((const 
SfxUInt16Item*)pItem)->GetValue() );
 bSaveAppOptions = sal_True;
 }
 
-if ( IS_AVAILABLE(SCITEM_USERLIST,pItem) )
+if (rOptSet.HasItem(SCITEM_USERLIST, pItem))
 {
 ScGlobal::SetUserList( ((const ScUserListItem*)pItem)->GetUserList() );
 bSaveAppOptions = sal_True;
 }
 
-if ( IS_AVAILABLE(SID_SC_OPT_SYNCZOOM,pItem) )
+if (rOptSet.HasItem(SID_SC_OPT_SYNCZOOM, pItem))
 {
 pAppCfg->SetSynchronizeZoom( static_cast(pItem)->GetValue() );
 bSaveAppOptions = sal_True;
 }
 
-if ( IS_AVAILABLE(SID_SC_OPT_KEY_BINDING_COMPAT,pItem) )
+if (rOptSet.HasItem(SID_SC_OPT_KEY_BINDING_COMPAT, pItem))
 {
 sal_uInt16 nVal = static_cast(pItem)->GetValue();
 ScOptionsUtil::KeyBindingType eOld = pAppCfg->GetKeyBindingType();
@@ -1032,7 +1030,7 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
 // ViewOptions
 //
 
-if ( IS_AVAILABLE(SID_SCVIEWOPTIONS,pItem) )
+if (rOptSet.HasItem(SID_SCVIEWOPTIONS, pItem))
 {
 const ScViewOptions& rNewOpt = ((const 
ScTpViewItem*)pItem)->GetViewOptions();
 
@@ -1064,7 +1062,7 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
 // da GridOptions Member der ViewOptions ist!
 //
 
-if ( IS_AVAILABLE(SID_ATTR_GRID_OPTIONS,pItem) )
+if ( rOptSet.HasItem(SID_ATTR_GRID_OPTIONS,pItem) )
 {
 ScGridOptions aNewGridOpt( (const SvxOptionsGrid&)((const 
SvxGridItem&)*pItem) );
 
@@ -1098,7 +1096,7 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
 // DocOptions
 //
 
-if ( IS_AVAILABLE(SID_SCDOCOPTIONS,pItem) )
+if ( rOptSet.HasItem(SID_SCDOCOPTIONS,pItem) )
 {
 const ScDocOptions& rNewOpt = ((const 
ScTpCalcItem*)pItem)->GetDocOptions();
 
@@ -1126,7 +1124,7 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
 }
 
 // nach den eigentlichen DocOptions auch noch die TabDistance setzen
-if ( IS_AVAILABLE(SID_ATTR_DEFTABSTOP,pItem) )
+if ( rOptSet.HasItem(SID_ATTR_DEFTABSTOP,pItem) )
 {
 sal_uInt16 nTabDist = ((SfxUInt16Item*)pItem)->GetValue();
 ScDocOptions aOpt(GetDocOptions());
@@ -1146,7 +1144,7 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
 
 //  AutoSpell nach den Doc-Options (weil Member)
 
-if ( IS_AVAILABLE(SID_AUTOSPELL_CHECK,pItem) )  // an 
Doc-Options
+if ( rOptSet.HasItem(SID_AUTOSPELL_CHECK,pItem) )  // an 
Doc-Options
 {
 sal_Bool bDoAutoSpell = ((const SfxBoolItem*)pItem)->GetValue();
 
@@ -1192,43 +1190,43 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet 
)
 // InputOptions
 //
 
-if ( IS_AVAILABLE(SID_SC_INPUT_SELECTIONPOS,pItem) )
+if ( rOptSet.HasItem(SID_SC_INPUT_SELECTIONPOS,pItem) )
 {
 pInputCfg->SetMoveDir( ((const SfxUInt16Item*)pItem)->GetValue() );
 bSaveInputOptions = sal_True;
 

[Libreoffice-commits] .: sc/source svl/inc svl/source sw/source unusedcode.easy

2011-11-09 Thread Caolán McNamara
 sc/source/filter/html/htmlexp.cxx  |   35 +++---
 sc/source/filter/inc/htmlexp.hxx   |5 +---
 svl/inc/svl/svstdarr.hxx   |5 
 svl/source/memtools/svarray.cxx|1 
 sw/source/filter/writer/writer.cxx |   38 ++---
 unusedcode.easy|5 
 6 files changed, 29 insertions(+), 60 deletions(-)

New commits:
commit ff9fab243bb8f746077dbbc2d7d3a76616647839
Author: Daisuke Nishino 
Date:   Wed Nov 9 22:16:38 2011 +0900

Removed SvStringsSortDtor

diff --git a/sc/source/filter/html/htmlexp.cxx 
b/sc/source/filter/html/htmlexp.cxx
index 8510edf..25f967b 100644
--- a/sc/source/filter/html/htmlexp.cxx
+++ b/sc/source/filter/html/htmlexp.cxx
@@ -243,8 +243,6 @@ ScHTMLExport::ScHTMLExport( SvStream& rStrmP, const String& 
rBaseURL, ScDocument
 aBaseURL( rBaseURL ),
 aStreamPath( rStreamPathP ),
 pAppWin( Application::GetDefaultDevice() ),
-pSrcArr( NULL ),
-pDestArr( NULL ),
 nUsedTables( 0 ),
 nIndent( 0 ),
 bAll( bAllP ),
@@ -294,8 +292,6 @@ ScHTMLExport::ScHTMLExport( SvStream& rStrmP, const String& 
rBaseURL, ScDocument
 ScHTMLExport::~ScHTMLExport()
 {
 aGraphList.clear();
-delete pSrcArr;
-delete pDestArr;
 }
 
 
@@ -1313,31 +1309,30 @@ sal_Bool ScHTMLExport::CopyLocalFileToINet( String& 
rFileNm,
INET_PROT_FTP <= aTargetUrl.GetProtocol() &&
INET_PROT_NEWS >= aTargetUrl.GetProtocol()) ) )
 {
-if( pSrcArr )
+if( pFileNameMap )
 {
 // wurde die Datei schon verschoben
-sal_uInt16 nPos;
-if( pSrcArr->Seek_Entry( &rFileNm, &nPos ))
+std::map::iterator it = pFileNameMap->find( 
rFileNm );
+if( it != pFileNameMap->end() )
 {
-rFileNm = *(*pDestArr)[ nPos ];
+rFileNm = it->second;
 return sal_True;
 }
 }
 else
 {
-pSrcArr = new SvStringsSortDtor( 4, 4 );
-pDestArr = new SvStringsSortDtor( 4, 4 );
+pFileNameMap.reset( new std::map() );
 }
 
-String* pSrc = new String( rFileNm );
 SvFileStream aTmp( aFileUrl.PathToFileName(), STREAM_READ );
 
-String* pDest = new String( aTargetUrl.GetPartBeforeLastName() );
-*pDest += String(aFileUrl.GetName());
+String aSrc = rFileNm;
+String aDest = aTargetUrl.GetPartBeforeLastName();
+aDest += String(aFileUrl.GetName());
 
 if( bFileToFile )
 {
-INetURLObject aCpyURL( *pDest );
+INetURLObject aCpyURL( aDest );
 SvFileStream aCpy( aCpyURL.PathToFileName(), STREAM_WRITE );
 aCpy << aTmp;
 
@@ -1346,7 +1341,7 @@ sal_Bool ScHTMLExport::CopyLocalFileToINet( String& 
rFileNm,
 }
 else
 {
-SfxMedium aMedium( *pDest, STREAM_WRITE | STREAM_SHARE_DENYNONE,
+SfxMedium aMedium( aDest, STREAM_WRITE | STREAM_SHARE_DENYNONE,
 false );
 
 {
@@ -1363,14 +1358,8 @@ sal_Bool ScHTMLExport::CopyLocalFileToINet( String& 
rFileNm,
 
 if( bRet )
 {
-pSrcArr->Insert( pSrc );
-pDestArr->Insert( pDest );
-rFileNm = *pDest;
-}
-else
-{
-delete pSrc;
-delete pDest;
+pFileNameMap->insert( std::make_pair( aSrc, aDest ) );
+rFileNm = aDest;
 }
 }
 
diff --git a/sc/source/filter/inc/htmlexp.hxx b/sc/source/filter/inc/htmlexp.hxx
index 286997e..ecf90b4 100644
--- a/sc/source/filter/inc/htmlexp.hxx
+++ b/sc/source/filter/inc/htmlexp.hxx
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "expbase.hxx"
 
@@ -45,7 +46,6 @@ class Graphic;
 class SdrObject;
 class OutputDevice;
 class ScDrawLayer;
-class SvStringsSortDtor;
 class ScEditCell;
 
 namespace editeng { class SvxBorderLine; }
@@ -109,8 +109,7 @@ class ScHTMLExport : public ScExportBase
 String  aStreamPath;
 String  aCId;   // Content-Id fuer Mail-Export
 OutputDevice*   pAppWin;// fuer Pixelei
-SvStringsSortDtor*  pSrcArr;// fuer CopyLocalFileToINet
-SvStringsSortDtor*  pDestArr;
+boost::scoped_ptr< std::map >  pFileNameMap;// 
fuer CopyLocalFileToINet
 String  aNonConvertibleChars;   // collect nonconvertible 
characters
 rtl_TextEncodingeDestEnc;
 SCTAB   nUsedTables;
diff --git a/svl/inc/svl/svstdarr.hxx b/svl/inc/svl/svstdarr.hxx
index 3d3cc80..79c95c1 100644
--- a/svl/inc/svl/svstdarr.hxx
+++ b/svl/inc/svl/svstdarr.hxx
@@ -57,11 +57,6 @@ SV_DECL_PTRARR_DEL_VISIBILITY( SvStringsDtor, StringPtr, 1, 
1, SVL_DLLPUBLIC )
 #define _SVSTDARR_STRINGSDTOR_DECL
 #endif
 
-#ifndef _SVSTDARR_STRINGSSORTDTOR_DECL
-SV_DECL_PTRARR_SORT_DEL_VISIBILITY( SvSt