[Libreoffice-commits] .: 5 commits - sc/source

2012-03-24 Thread Markus Mohrhard
 sc/source/ui/unoobj/chart2uno.cxx |  111 +-
 1 file changed, 62 insertions(+), 49 deletions(-)

New commits:
commit 8269e88b9b9ba508f53489269031e5d41074fc60
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Sun Mar 25 04:38:20 2012 +0200

Revert simplify code - remove unnecessary and complicated allocation

This reverts commit 3ffdb45ae047f12480e73fdd4b28fe35f1e8d48c.

diff --git a/sc/source/ui/unoobj/chart2uno.cxx 
b/sc/source/ui/unoobj/chart2uno.cxx
index 1c637fb..5ff808b 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -717,6 +717,7 @@ void Chart2Positioner::createPositionMap()
 bool bNoGlue = (meGlue == GLUETYPE_NONE);
 SAL_WNODEPRECATED_DECLARATIONS_PUSH
 auto_ptrTable pCols(new Table);
+auto_ptrFormulaToken pNewAddress;
 auto_ptrTable pNewRowTable(new Table);
 SAL_WNODEPRECATED_DECLARATIONS_POP
 Table* pCol = NULL;
@@ -783,18 +784,19 @@ void Chart2Positioner::createPositionMap()
 aCellData.nRow = nRow;
 aCellData.nTab = nTab;
 
-if (pCol-Get(nInsRow) == NULL)
-{
-if (bExternal)
-pCol-Insert(nInsRow, new 
ScExternalSingleRefToken(nFileId, aTabName, aCellData));
-else
-pCol-Insert(nInsRow, new 
ScSingleRefToken(aCellData));
-}
+if (bExternal)
+pNewAddress.reset(new 
ScExternalSingleRefToken(nFileId, aTabName, aCellData));
+else
+pNewAddress.reset(new ScSingleRefToken(aCellData));
+
+if (pCol-Insert(nInsRow, pNewAddress.get()))
+pNewAddress.release(); // To prevent the instance from 
being destroyed.
 }
 }
 }
 nNoGlueRow += nRow2 - nRow1 + 1;
 }
+pNewAddress.reset(NULL);
 pNewRowTable.reset(NULL);
 
 bool bFillRowHeader = mbRowHeaders;
commit 3079cebfe62a482cb82a67a77e436b85f6249b9c
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Sun Mar 25 04:38:02 2012 +0200

Revert restructure insert code as a precursor to further simplification

This reverts commit 4aa72e0dee42c80667083c0b86a3d0ec5381c1ae.

diff --git a/sc/source/ui/unoobj/chart2uno.cxx 
b/sc/source/ui/unoobj/chart2uno.cxx
index e2f7059..1c637fb 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -761,13 +761,13 @@ void Chart2Positioner::createPositionMap()
 }
 else
 {
-pCol = static_castTable*(pCols-Get(nInsCol));
-if (!pCol)
+if (pCols-Insert(nInsCol, pNewRowTable.get()))
 {
-pCol = pNewRowTable.get();
-pCols-Insert(nInsCol, pNewRowTable.release());
+pCol = pNewRowTable.release();
 pNewRowTable.reset(new Table);
 }
+else
+pCol = static_castTable*(pCols-Get(nInsCol));
 }
 
 sal_uInt32 nInsRow = static_castsal_uInt32(bNoGlue ? 
nNoGlueRow : nRow1);
@@ -786,7 +786,7 @@ void Chart2Positioner::createPositionMap()
 if (pCol-Get(nInsRow) == NULL)
 {
 if (bExternal)
-pCol-Insert(nInsRow, new 
ScExternalSingleRefToken(nFileId, aTabName, aCellData))
+pCol-Insert(nInsRow, new 
ScExternalSingleRefToken(nFileId, aTabName, aCellData));
 else
 pCol-Insert(nInsRow, new 
ScSingleRefToken(aCellData));
 }
commit d1fcea677a0d814ca92a00717a4ff7090291f6cd
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Sun Mar 25 04:37:41 2012 +0200

Revert if/else branches contain same code

This reverts commit 13bf19769e6e0522d920594225b9baa2c1b7dd63.

diff --git a/sc/source/ui/unoobj/chart2uno.cxx 
b/sc/source/ui/unoobj/chart2uno.cxx
index 1a04ce4..e2f7059 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -749,12 +749,25 @@ void Chart2Positioner::createPositionMap()
 
 for (SCCOL nCol = nCol1; nCol = nCol2; ++nCol, ++nInsCol)
 {
-pCol = static_castTable*(pCols-Get(nInsCol));
-if (!pCol)
+if (bNoGlue || meGlue == GLUETYPE_ROWS)
 {
-pCol = pNewRowTable.get();
-pCols-Insert(nInsCol, pNewRowTable.release());
-pNewRowTable.reset(new Table);
+pCol = static_castTable*(pCols-Get(nInsCol));
+if (!pCol)
+{
+pCol = 

[Libreoffice-commits] .: 5 commits - sc/source sfx2/inc sfx2/source sot/inc svtools/inc svtools/source sw/source tools/inc unusedcode.easy

2012-03-23 Thread Caolán McNamara
 sc/source/ui/app/inputhdl.cxx  |1 
 sc/source/ui/view/output.cxx   |4 --
 sc/source/ui/view/output2.cxx  |3 -
 sfx2/inc/sfx2/docfile.hxx  |3 -
 sfx2/source/doc/docfile.cxx|   11 +-
 sot/inc/sot/object.hxx |4 --
 svtools/inc/svtools/accessibilityoptions.hxx   |5 +--
 svtools/source/config/accessibilityoptions.cxx |9 +
 sw/source/ui/table/tautofmt.cxx|3 -
 tools/inc/tools/ref.hxx|   41 +
 unusedcode.easy|1 
 11 files changed, 10 insertions(+), 75 deletions(-)

New commits:
commit a09d551182d61d67313a7d97a25ab251c88f92e9
Author: Caolán McNamara caol...@redhat.com
Date:   Fri Mar 23 13:23:32 2012 +

we dont' need any SvCompatWeakBase use in SfxMedium AKAICS

diff --git a/sfx2/inc/sfx2/docfile.hxx b/sfx2/inc/sfx2/docfile.hxx
index 55cd3a2..53846f3 100644
--- a/sfx2/inc/sfx2/docfile.hxx
+++ b/sfx2/inc/sfx2/docfile.hxx
@@ -110,8 +110,6 @@ class SFX2_DLLPUBLIC SfxMedium : public SvRefBase
 
 public:
 
-SvCompatWeakHdl*GetHdl();
-
 SfxMedium();
 SfxMedium( const String rName,
StreamMode nOpenMode,
@@ -299,7 +297,6 @@ public:
 };
 
 SV_DECL_IMPL_REF( SfxMedium )
-SV_DECL_COMPAT_WEAK( SfxMedium )
 
 typedef ::std::vector SfxMedium*  SfxMediumList;
 
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index c7e60da..ba7ffb8 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -253,7 +253,7 @@ void SAL_CALL SfxMediumHandler_Impl::handle( const 
com::sun::star::uno::Referenc
 }
 
 //
-class SfxMedium_Impl : public SvCompatWeakBase
+class SfxMedium_Impl
 {
 public:
 ::ucbhelper::Content aContent;
@@ -323,8 +323,7 @@ public:
 
 //--
 SfxMedium_Impl::SfxMedium_Impl( SfxMedium* pAntiImplP )
- :  SvCompatWeakBase( pAntiImplP ),
-bUpdatePickList(sal_True),
+ :  bUpdatePickList(sal_True),
 bIsTemp( sal_False ),
 bForceSynchron( sal_False ),
 bDownloadDone( sal_True ),
@@ -3039,12 +3038,6 @@ SvKeyValueIterator* SfxMedium::GetHeaderAttributes_Impl()
 
 return pImp-xAttributes;
 }
-//
-
-SvCompatWeakHdl* SfxMedium::GetHdl()
-{
-return pImp-GetHdl();
-}
 
 ::com::sun::star::uno::Reference ::com::sun::star::io::XInputStream   
SfxMedium::GetInputStream()
 {
diff --git a/unusedcode.easy b/unusedcode.easy
index 08c0f96..b8d6b87 100755
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -125,7 +125,6 @@ SfxFoundCacheArr_Impl::Insert(SfxFoundCache_Impl const*, 
unsigned short)
 SfxFoundCacheArr_Impl::Insert(SfxFoundCache_Impl const**, unsigned short)
 SfxFoundCacheArr_Impl::Remove(SfxFoundCache_Impl const*, unsigned short)
 SfxFoundCacheArr_Impl::Remove(unsigned short, unsigned short)
-SfxMedium::GetHdl()
 SfxModuleArr_Impl::DeleteAndDestroy(unsigned short, unsigned short)
 SfxNavigatorWrapper::GetChildWindowId()
 SfxPartChildWnd_Impl::GetChildWindowId()
commit 4a893297a8f755851477f07145f726aa3e6f9c9e
Author: Caolán McNamara caol...@redhat.com
Date:   Fri Mar 23 12:45:46 2012 +

weird use of volatile

diff --git a/svtools/inc/svtools/accessibilityoptions.hxx 
b/svtools/inc/svtools/accessibilityoptions.hxx
index 7783eb7..766af7c 100644
--- a/svtools/inc/svtools/accessibilityoptions.hxx
+++ b/svtools/inc/svtools/accessibilityoptions.hxx
@@ -40,8 +40,8 @@ class SVT_DLLPUBLIC SvtAccessibilityOptions:
 public utl::detail::Options, private SfxListener
 {
 private:
-static SvtAccessibilityOptions_Impl* volatile sm_pSingleImplConfig;
-static sal_Int32 volatile sm_nAccessibilityRefCount;
+static SvtAccessibilityOptions_Impl* sm_pSingleImplConfig;
+static sal_Int32 sm_nAccessibilityRefCount;
 
 public:
 SvtAccessibilityOptions();
diff --git a/svtools/source/config/accessibilityoptions.cxx 
b/svtools/source/config/accessibilityoptions.cxx
index 44ab3e4..44a9646 100644
--- a/svtools/source/config/accessibilityoptions.cxx
+++ b/svtools/source/config/accessibilityoptions.cxx
@@ -94,8 +94,8 @@ public:
 
 // initialization of static members --
 
-SvtAccessibilityOptions_Impl* volatile  
SvtAccessibilityOptions::sm_pSingleImplConfig =NULL;
-sal_Int32 volatile  
SvtAccessibilityOptions::sm_nAccessibilityRefCount(0);
+SvtAccessibilityOptions_Impl* SvtAccessibilityOptions::sm_pSingleImplConfig 
=NULL;
+sal_Int32 
SvtAccessibilityOptions::sm_nAccessibilityRefCount(0);
 
 namespace
 {
commit 8b3bfa53c9ed62ea4d744ae0d874241b8fb27a81
Author: Caolán McNamara caol...@redhat.com
Date:   Fri Mar 23 12:39:16 2012 

[Libreoffice-commits] .: 5 commits - sc/source

2011-11-14 Thread Kohei Yoshida
 sc/source/core/data/dptablecache.cxx |   38 +++
 sc/source/core/data/dptabres.cxx |4 +++
 2 files changed, 12 insertions(+), 30 deletions(-)

New commits:
commit 1d4971d77afa492bfdbfd18113eff4f77b3100e3
Author: Kohei Yoshida kohei.yosh...@suse.com
Date:   Tue Nov 15 00:19:54 2011 -0500

Beware that the sequence can be empty.

And when it's empty, it causes an invalid array access later on.

diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx
index 84ce258..c1a1824 100644
--- a/sc/source/core/data/dptabres.cxx
+++ b/sc/source/core/data/dptabres.cxx
@@ -1369,6 +1369,10 @@ void ScDPResultMember::FillMemberResults( 
uno::Sequencesheet::MemberResult* pS
 //  IsVisible() test is in ScDPResultDimension::FillMemberResults
 //  (not on data layout dimension)
 
+if (!pSequences-getLength())
+// empty sequence.  Bail out.
+return;
+
 long nSize = GetSize(nMeasure);
 sheet::MemberResult* pArray = pSequences-getArray();
 OSL_ENSURE( rPos+nSize = pSequences-getLength(), bumm );
commit 690e14ad035e642f4382d20b8b7b792762338126
Author: Kohei Yoshida kohei.yosh...@suse.com
Date:   Mon Nov 14 23:21:02 2011 -0500

Unused local var.

diff --git a/sc/source/core/data/dptablecache.cxx 
b/sc/source/core/data/dptablecache.cxx
index ecfab69..5bbef8f 100644
--- a/sc/source/core/data/dptablecache.cxx
+++ b/sc/source/core/data/dptablecache.cxx
@@ -607,7 +607,6 @@ bool ScDPCache::ValidQuery( SCROW nRow, const ScQueryParam 
rParam) const
 const ScDPItemData* pCellData = GetItemDataById( nSourceField, nId );
 
 bool bOk = false;
-bool bTestEqual = false;
 
 if (rEntry.GetQueryItem().meType == ScQueryEntry::ByEmpty)
 {
@@ -670,8 +669,6 @@ bool ScDPCache::ValidQuery( SCROW nRow, const ScQueryParam 
rParam) const
 bMatch = false;// RegExp must match entire cell string
 if (bRealRegExp)
 bOk = ((rEntry.eOp == SC_NOT_EQUAL) ? !bMatch : bMatch);
-else
-bTestEqual = bMatch;
 }
 if (!bRealRegExp)
 {
commit 10afa30240edec37a052ee87ff5b5e36c615abcd
Author: Kohei Yoshida kohei.yosh...@suse.com
Date:   Mon Nov 14 23:19:21 2011 -0500

Used std::vector instead of C-style array.

diff --git a/sc/source/core/data/dptablecache.cxx 
b/sc/source/core/data/dptablecache.cxx
index cbf9065..ecfab69 100644
--- a/sc/source/core/data/dptablecache.cxx
+++ b/sc/source/core/data/dptablecache.cxx
@@ -582,12 +582,8 @@ bool ScDPCache::ValidQuery( SCROW nRow, const ScQueryParam 
rParam) const
 return true;
 bool bMatchWholeCell = mpDoc-GetDocOptions().IsMatchWholeCell();
 
-//---
-
-const SCSIZE nFixedBools = 32;
-bool aBool[nFixedBools];
 SCSIZE nEntryCount = rParam.GetEntryCount();
-bool* pPasst = ( nEntryCount = nFixedBools ? aBool[0] : new 
bool[nEntryCount] );
+std::vectorbool aPassed(nEntryCount, false);
 
 long nPos = -1;
 CollatorWrapper* pCollator = (rParam.bCaseSens ? 
ScGlobal::GetCaseCollator() :
@@ -753,31 +749,26 @@ bool ScDPCache::ValidQuery( SCROW nRow, const 
ScQueryParam rParam) const
 if (nPos == -1)
 {
 nPos++;
-pPasst[nPos] = bOk;
+aPassed[nPos] = bOk;
 }
 else
 {
 if (rEntry.eConnect == SC_AND)
 {
-pPasst[nPos] = pPasst[nPos]  bOk;
+aPassed[nPos] = aPassed[nPos]  bOk;
 }
 else
 {
 nPos++;
-pPasst[nPos] = bOk;
+aPassed[nPos] = bOk;
 }
 }
 }
 
 for (long j=1; j = nPos; j++)
-{
-pPasst[0] = pPasst[0] || pPasst[j];
-}
-
-bool bRet = pPasst[0];
-if (pPasst != aBool[0])
-delete [] pPasst;
+aPassed[0] = aPassed[0] || aPassed[j];
 
+bool bRet = aPassed[0];
 return bRet;
 }
 
commit 011878812eac685b76a925fa9ffb17a152c27e6a
Author: Kohei Yoshida kohei.yosh...@suse.com
Date:   Mon Nov 14 23:13:26 2011 -0500

This can be for loop instead.

diff --git a/sc/source/core/data/dptablecache.cxx 
b/sc/source/core/data/dptablecache.cxx
index 2810b51..cbf9065 100644
--- a/sc/source/core/data/dptablecache.cxx
+++ b/sc/source/core/data/dptablecache.cxx
@@ -589,14 +589,13 @@ bool ScDPCache::ValidQuery( SCROW nRow, const 
ScQueryParam rParam) const
 SCSIZE nEntryCount = rParam.GetEntryCount();
 bool* pPasst = ( nEntryCount = nFixedBools ? aBool[0] : new 
bool[nEntryCount] );
 
-longnPos = -1;
-SCSIZE  i= 0;
+long nPos = -1;
 CollatorWrapper* pCollator = (rParam.bCaseSens ? 
ScGlobal::GetCaseCollator() :
   ScGlobal::GetCollator() );
 ::utl::TransliterationWrapper* pTransliteration = (rParam.bCaseSens ?