Hi,

I've been going through the list of identified unused functions in calc and 
commenting out those that don't seem to be used anywhere.
Attached is the patch (LGPLv3+/MPL) that comments out some 10 functions and a 
text file with those investigated so far, and the results.

I chose to comment out, rather than delete, to allow for some extra testing 
once 
it's committed. Commented functions can be easily identified later on and 
removed.
Please let me know if direct removal would be preferred.

After committing my changes locally I've built module "sc" and done a "make 
dev-install". Everything seems to be working fine, but the test wasn't 
exhaustive.
The changes have been rebased with current master.

There are a few functions that belong to some "addin" mechanism now obsolete. 
I'm not sure if it can be removed completely, but it looks like a good 
candidate 
(details in attached text file).

Thanks & regards,
Alfonso


      
From ad7008e740baf43ebad80a3be2f50b5fe73e584a Mon Sep 17 00:00:00 2001
From: Alfonso Eusebio <alfonso_euse...@yahoo.co.uk>
Date: Sat, 29 Jan 2011 13:42:07 +0000
Subject: [PATCH] Commented out some unused functions in calc

Commented out some unused functions in calc before proceeding to final removal.
---
 sc/inc/compressedarray.hxx                 |    6 ++++--
 sc/source/core/data/attarray.cxx           |    1 -
 sc/source/core/data/compressedarray.cxx    |    8 ++++----
 sc/source/filter/excel/xipivot.cxx         |    9 ++++++---
 sc/source/filter/excel/xistream.cxx        |    9 ++++++---
 sc/source/filter/excel/xltracer.cxx        |    3 ++-
 sc/source/filter/inc/XclImpChangeTrack.hxx |    5 +++--
 sc/source/filter/inc/xipivot.hxx           |    4 ++--
 sc/source/filter/inc/xistream.hxx          |    6 +++---
 sc/source/filter/inc/xltracer.hxx          |    3 ++-
 10 files changed, 32 insertions(+), 22 deletions(-)

diff --git a/sc/inc/compressedarray.hxx b/sc/inc/compressedarray.hxx
index efc5cd7..941ae1a 100644
--- a/sc/inc/compressedarray.hxx
+++ b/sc/inc/compressedarray.hxx
@@ -477,18 +477,20 @@ public:
 
     /** Sum values of a ScSummableCompressedArray for each row where in *this*
         array the condition is met: ((aValue & rBitMask) == rMaskedCompare). */
+/* [AE] seems unused - commenting out for now
     template< typename S >
     SC_DLLPUBLIC unsigned long               SumCoupledArrayForCondition( A nStart, A nEnd,
                                     const D& rBitMask, const D& rMaskedCompare,
-                                    const ScSummableCompressedArray<A,S>& rArray ) const;
+                                    const ScSummableCompressedArray<A,S>& rArray ) const;*/
 
     /** Sum scaled values of a ScSummableCompressedArray for each row where in
         *this* array the condition is met: ((aValue & rBitMask) == rMaskedCompare). */
+/* [AE] seems unused - commenting out for now
     template< typename S >
     SC_DLLPUBLIC unsigned long               SumScaledCoupledArrayForCondition( A nStart, A nEnd,
                                     const D& rBitMask, const D& rMaskedCompare,
                                     const ScSummableCompressedArray<A,S>& rArray,
-                                    double fScale ) const;
+                                    double fScale ) const; */
 };
 
 
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index bd52f4b..bb411ab 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -1183,7 +1183,6 @@ long lcl_LineSize( const SvxBorderLine& rLine )
     return nTotal;
 }
 
-
 BOOL ScAttrArray::HasLines( SCROW nRow1, SCROW nRow2, Rectangle& rSizes,
                                 BOOL bLeft, BOOL bRight ) const
 {
diff --git a/sc/source/core/data/compressedarray.cxx b/sc/source/core/data/compressedarray.cxx
index 1c4d8bd..b935f40 100644
--- a/sc/source/core/data/compressedarray.cxx
+++ b/sc/source/core/data/compressedarray.cxx
@@ -515,7 +515,7 @@ A ScBitMaskCompressedArray<A,D>::GetLastAnyBitAccess( A nStart,
     return nEnd;
 }
 
-
+/* [AE] seems unused - commenting out for now
 template< typename A, typename D >
 template< typename S >
 unsigned long ScBitMaskCompressedArray<A,D>::SumCoupledArrayForCondition(
@@ -549,7 +549,6 @@ unsigned long ScBitMaskCompressedArray<A,D>::SumCoupledArrayForCondition(
     return nSum;
 }
 
-
 template< typename A, typename D >
 template< typename S >
 unsigned long ScBitMaskCompressedArray<A,D>::SumScaledCoupledArrayForCondition(
@@ -582,7 +581,7 @@ unsigned long ScBitMaskCompressedArray<A,D>::SumScaledCoupledArrayForCondition(
             (rArray.GetDataEntry(rArray.GetEntryCount()-1).aValue * fScale) *
             (nEnd - this->nMaxAccess);
     return nSum;
-}
+} */
 
 
 // === ScCompressedArrayIterator =============================================
@@ -694,13 +693,14 @@ template class ScCompressedArray< SCROW, USHORT>;           // heights, base cla
 template class ScSummableCompressedArray< SCROW, USHORT>;   // heights
 template class ScCompressedArray< SCROW, BYTE>;             // flags, base class
 template class ScBitMaskCompressedArray< SCROW, BYTE>;      // flags
+/* [AE] sems unused - commenting out for now
 template unsigned long ScBitMaskCompressedArray< SCROW,
     BYTE>::SumCoupledArrayForCondition( SCROW, SCROW, const BYTE&, const BYTE&,
             const ScSummableCompressedArray< SCROW, USHORT>&) const;
 template unsigned long ScBitMaskCompressedArray< SCROW,
     BYTE>::SumScaledCoupledArrayForCondition( SCROW, SCROW, const BYTE&,
             const BYTE&, const ScSummableCompressedArray< SCROW, USHORT>&,
-            double) const;
+            double) const; */
 template void ScCompressedArrayIterator< SCROW, USHORT>::Follow(
         const ScCompressedArrayIterator< SCROW, BYTE>&);
 template class ScCoupledCompressedArrayIterator< SCROW, BYTE, USHORT>;
diff --git a/sc/source/filter/excel/xipivot.cxx b/sc/source/filter/excel/xipivot.cxx
index a860353..a397eca 100644
--- a/sc/source/filter/excel/xipivot.cxx
+++ b/sc/source/filter/excel/xipivot.cxx
@@ -216,10 +216,11 @@ const XclImpPCField* XclImpPCField::GetGroupBaseField() const
     return IsGroupChildField() ? mrPCache.GetField( maFieldInfo.mnGroupBase ) : 0;
 }
 
+/* [AE] seems unused - commenting out for now
 sal_uInt16 XclImpPCField::GetItemCount() const
 {
     return static_cast< sal_uInt16 >( maItems.size() );
-}
+} */
 
 const XclImpPCItem* XclImpPCField::GetItem( sal_uInt16 nItemIdx ) const
 {
@@ -962,11 +963,12 @@ const String* XclImpPTField::GetItemName( sal_uInt16 nItemIdx ) const
     return pItem ? pItem->GetItemName() : 0;
 }
 
+/* [AE] seems unused - commenting out for now
 const String* XclImpPTField::GetVisItemName( sal_uInt16 nItemIdx ) const
 {
     const XclImpPTItem* pItem = GetItem( nItemIdx );
     return pItem ? pItem->GetVisItemName() : 0;
-}
+} */
 
 // records --------------------------------------------------------------------
 
@@ -1229,12 +1231,13 @@ XclImpPTField* XclImpPivotTable::GetFieldAcc( sal_uInt16 nFieldIdx )
     return (nFieldIdx < maFields.size()) ? maFields[ nFieldIdx ].get() : 0;
 }
 
+/* [AE] seems unused - commenting out for now
 const String& XclImpPivotTable::GetFieldName( sal_uInt16 nFieldIdx ) const
 {
     if( const XclImpPTField* pField = GetField( nFieldIdx ) )
         return pField->GetFieldName();
     return EMPTY_STRING;
-}
+} */
 
 const XclImpPTField* XclImpPivotTable::GetDataField( sal_uInt16 nDataFieldIdx ) const
 {
diff --git a/sc/source/filter/excel/xistream.cxx b/sc/source/filter/excel/xistream.cxx
index c2d71e8..972e1ed 100644
--- a/sc/source/filter/excel/xistream.cxx
+++ b/sc/source/filter/excel/xistream.cxx
@@ -667,12 +667,13 @@ XclImpStream& XclImpStream::operator>>( double& rfValue )
     return *this;
 }
 
+/* [AE] seems unused - commenting out for now
 sal_Int8 XclImpStream::ReadInt8()
 {
     sal_Int8 nValue(0);
     operator>>( nValue );
     return nValue;
-}
+} */
 
 sal_uInt8 XclImpStream::ReaduInt8()
 {
@@ -709,12 +710,13 @@ sal_uInt32 XclImpStream::ReaduInt32()
     return nValue;
 }
 
+/* [AE] seems unused - commenting out for now
 float XclImpStream::ReadFloat()
 {
     float fValue(0.0);
     operator>>( fValue );
     return fValue;
-}
+} */
 
 double XclImpStream::ReadDouble()
 {
@@ -952,10 +954,11 @@ void XclImpStream::IgnoreUniString( sal_uInt16 nChars )
     IgnoreUniString( nChars, ReaduInt8() );
 }
 
+/* [AE] seems unused - commenting out for now
 void XclImpStream::IgnoreUniString()
 {
     IgnoreUniString( ReaduInt16() );
-}
+} */
 
 // ----------------------------------------------------------------------------
 
diff --git a/sc/source/filter/excel/xltracer.cxx b/sc/source/filter/excel/xltracer.cxx
index 784c401..258f48e 100644
--- a/sc/source/filter/excel/xltracer.cxx
+++ b/sc/source/filter/excel/xltracer.cxx
@@ -243,11 +243,12 @@ void XclTracer::TraceChartLegendPosition()
     ProcessTraceOnce(eChartLegendPosition);
 }
 
+/* [AE] seems to be unused - commenting out for now
 void XclTracer::TraceChartEmbeddedObj()
 {
     // drawing objects e.g. text boxes etc not supported inside charts
     ProcessTraceOnce(eChartEmbeddedObj);
-}
+} */
 
 void XclTracer::TraceUnsupportedObjects()
 {
diff --git a/sc/source/filter/inc/XclImpChangeTrack.hxx b/sc/source/filter/inc/XclImpChangeTrack.hxx
index 11f253b..c23f740 100644
--- a/sc/source/filter/inc/XclImpChangeTrack.hxx
+++ b/sc/source/filter/inc/XclImpChangeTrack.hxx
@@ -93,7 +93,7 @@ private:
     void						ReadDateTime( DateTime& rDateTime );
 
     inline void					ReadString( String& rString );
-    inline void					IgnoreString();
+    /*inline void					IgnoreString(); [AE] seems unused - commenting out for now */
 
     sal_Bool					CheckRecord( sal_uInt16 nOpCode );
 
@@ -167,10 +167,11 @@ inline void XclImpChangeTrack::ReadString( String& rString )
     rString = pStrm->ReadUniString();
 }
 
+/* [AE] seems unused - commenting out for now
 inline void XclImpChangeTrack::IgnoreString()
 {
     pStrm->IgnoreUniString();
-}
+}*/
 
 //___________________________________________________________________
 // derived class for special 3D ref handling
diff --git a/sc/source/filter/inc/xipivot.hxx b/sc/source/filter/inc/xipivot.hxx
index e4ad832..cc2a228 100644
--- a/sc/source/filter/inc/xipivot.hxx
+++ b/sc/source/filter/inc/xipivot.hxx
@@ -92,7 +92,7 @@ public:
     const XclImpPCField* GetGroupBaseField() const;
 
     /** Returns the number of items of this field. */
-    sal_uInt16          GetItemCount() const;
+    /* sal_uInt16          GetItemCount() const; [AE] seems unused - commenting out for now */
     /** Returns the item at the specified position or 0 on error. */
     const XclImpPCItem* GetItem( sal_uInt16 nItemIdx ) const;
     /** Returns the item representing a limit value in numeric/date/time grouping fields.
@@ -263,7 +263,7 @@ public:
     /** Returns the internal name of the specified item. */
     const String*       GetItemName( sal_uInt16 nItemIdx ) const;
     /** Returns the displayed name of the specified item. */
-    const String*       GetVisItemName( sal_uInt16 nItemIdx ) const;
+    /* const String*       GetVisItemName( sal_uInt16 nItemIdx ) const; [AE] seems unused - commenting out for now */
 
     /** Returns the flags of the axes this field is part of. */
     inline sal_uInt16   GetAxes() const { return maFieldInfo.mnAxes; }
diff --git a/sc/source/filter/inc/xistream.hxx b/sc/source/filter/inc/xistream.hxx
index 3fc31fa..d2c3cbd 100644
--- a/sc/source/filter/inc/xistream.hxx
+++ b/sc/source/filter/inc/xistream.hxx
@@ -336,13 +336,13 @@ public:
     XclImpStream&       operator>>( float& rfValue );
     XclImpStream&       operator>>( double& rfValue );
 
-    sal_Int8            ReadInt8();
+    /*sal_Int8            ReadInt8(); [AE] seems unused - commenting out for now */
     sal_uInt8           ReaduInt8();
     sal_Int16           ReadInt16();
     sal_uInt16          ReaduInt16();
     sal_Int32           ReadInt32();
     sal_uInt32          ReaduInt32();
-    float               ReadFloat();
+    /*float               ReadFloat(); [AE] seems unused - commenting out for now */
     double              ReadDouble();
 
     /** Reads nBytes bytes to the existing(!) buffer pData.
@@ -417,7 +417,7 @@ public:
     /** Ignores 8 bit flags, ext. header, nChar characters, ext. data. */
     void                IgnoreUniString( sal_uInt16 nChars );
     /** Ignores 16 bit character count, 8 bit flags, ext. header, character array, ext. data. */
-    void                IgnoreUniString();
+    /*void                IgnoreUniString(); [AE] seems unused - commenting out for now */
 
     // *** read/ignore 8-bit-strings, store in String *** ---------------------
 
diff --git a/sc/source/filter/inc/xltracer.hxx b/sc/source/filter/inc/xltracer.hxx
index 27151cf..07bb44c 100644
--- a/sc/source/filter/inc/xltracer.hxx
+++ b/sc/source/filter/inc/xltracer.hxx
@@ -125,7 +125,8 @@ public:
     void                        TraceChartOnlySheet();
     void                        TraceChartDataTable();
     void                        TraceChartLegendPosition();
-    void                        TraceChartEmbeddedObj();
+/* [AE] seems unused - commenting out for now
+    void                        TraceChartEmbeddedObj(); */
     void                        TraceUnsupportedObjects();
     void                        TraceObjectNotPrintable();
     void                        TraceDVType(bool bType);
-- 
1.7.1

*** These are in the deprecated "addin" section of calc - should remove?
GetFunctionCount
GetFunctionData
GetParameterDescription
Rot13

*** These functions seem unused - COMMENTED OUT
unsigned long ScBitMaskCompressedArray<int, unsigned 
char>::SumCoupledArrayForCondition<unsigned short>(int, int, unsigned char 
const&, unsigned char const&, ScSummableCompressedArray<int, unsigned short> 
const&) const
unsigned long ScBitMaskCompressedArray<int, unsigned 
char>::SumScaledCoupledArrayForCondition<unsigned short>(int, int, unsigned 
char const&, unsigned char const&, ScSummableCompressedArray<int, unsigned 
short> const&, double) const
XclTracer::TraceChartEmbeddedObj()
XclImpStream::IgnoreUniString()
XclImpChangeTrack::IgnoreString()
XclImpStream::ReadFloat()
XclImpStream::ReadInt8()
XclImpPCField::GetItemCount() const
XclImpPTField::GetVisItemName(unsigned short) const
XclImpPivotTable::GetFieldName(unsigned short) const


*** seem to be removed already
ScBitMaskCompressedArray<int, unsigned 
char>::CopyFromOred(ScBitMaskCompressedArray<int, unsigned char> const&, int, 
int, unsigned char const&, long)
ScBitMaskCompressedArray<int, unsigned char>::CountForAnyBitCondition(int, int, 
unsigned char const&) const
ScBitMaskCompressedArray<int, unsigned char>::CountForCondition(int, int, 
unsigned char const&, unsigned char const&) const
ScBitMaskCompressedArray<int, unsigned char>::FillArrayForCondition(int, int, 
unsigned char const&, unsigned char const&, int*, unsigned long) const
ScBitMaskCompressedArray<int, unsigned char>::GetBitStateEnd(int, unsigned char 
const&, unsigned char const&) const
ScBitMaskCompressedArray<int, unsigned char>::GetBitStateStart(int, unsigned 
char const&, unsigned char const&) const
ScBitMaskCompressedArray<int, unsigned char>::GetLastForCondition(int, int, 
unsigned char const&, unsigned char const&) const
ScBitMaskCompressedArray<int, unsigned char>::HasCondition(int, int, unsigned 
char const&, unsigned char const&) const
ScChangeTrack::AppendContent(ScAddress const&, String const&, ScBaseCell*)
pt2mm(double)
ooo::vba::excel::isInPrintPreview(SfxViewFrame*)
mm2pt(int)

*** small constructors, not removed
ScCellRangesBase::ScCellRangesBase()
XclTools::GetBuiltInStyleName(String const&)
XclTools::GetSbMacroUrl(String const&, String const&, SfxObjectShell*)
XclTokenArray::XclTokenArray(std::vector<unsigned char, std::allocator<unsigned 
char> >&, bool)
XclObjId::XclObjId()
XclObjId::XclObjId(short, unsigned short)


*** these functions are used somewhere
ooo::vba::excel::GetDocumentFromRange(com::sun::star::uno::Reference<com::sun::star::uno::XInterface>
 const&)
ScAttrArray::HasLines(int, int, Rectangle&, unsigned char, unsigned char) const
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to