[Libreoffice-commits] core.git: sc/inc sc/source

Noel Grandin noel.grandin at collabora.co.uk
Tue Oct 31 06:38:14 UTC 2017


 sc/inc/fstalgorithm.hxx              |   10 +++-------
 sc/inc/postit.hxx                    |    4 ++--
 sc/source/core/data/postit.cxx       |   10 +++++-----
 sc/source/core/tool/charthelper.cxx  |   20 ++++----------------
 sc/source/core/tool/compiler.cxx     |   16 ++++++----------
 sc/source/core/tool/refupdat.cxx     |   18 +++++++++---------
 sc/source/filter/excel/tokstack.cxx  |    8 ++++----
 sc/source/filter/excel/xicontent.cxx |    2 +-
 sc/source/filter/excel/xlformula.cxx |    5 ++---
 sc/source/filter/inc/biffhelper.hxx  |    2 +-
 sc/source/filter/inc/xlformula.hxx   |    6 +++---
 sc/source/filter/oox/biffhelper.cxx  |    4 ++--
 sc/source/filter/xml/xmlcelli.cxx    |    2 +-
 sc/source/ui/app/transobj.cxx        |    7 +++----
 sc/source/ui/docshell/docfunc.cxx    |    6 +++---
 sc/source/ui/inc/transobj.hxx        |    3 +--
 sc/source/ui/vba/excelvbahelper.hxx  |    8 ++++----
 sc/source/ui/vba/vbarange.cxx        |    9 ++++-----
 18 files changed, 58 insertions(+), 82 deletions(-)

New commits:
commit f6cfbe8a1f9dc8535a69e2ad0c21e87c2a63a82a
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Oct 30 14:43:24 2017 +0200

    loplugin:constantparam in sc
    
    Change-Id: I2a55811f1741341c30f84ea3d010cc12eb6f2df9
    Reviewed-on: https://gerrit.libreoffice.org/44086
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/inc/fstalgorithm.hxx b/sc/inc/fstalgorithm.hxx
index 73a4c5c3d64a..2a6ec14ddf2a 100644
--- a/sc/inc/fstalgorithm.hxx
+++ b/sc/inc/fstalgorithm.hxx
@@ -48,7 +48,7 @@ template<typename Key, typename Val, typename Span>
 void buildSpanWithValue(
     std::vector<Span>& rSpans,
     typename mdds::flat_segment_tree<Key,Val>::const_iterator it,
-    typename mdds::flat_segment_tree<Key,Val>::const_iterator itEnd, const Key* pStart )
+    typename mdds::flat_segment_tree<Key,Val>::const_iterator itEnd )
 {
     Key nLastPos = it->first;
     Val nLastVal = it->second;
@@ -61,11 +61,7 @@ void buildSpanWithValue(
         {
             Key nIndex1 = nLastPos;
             Key nIndex2 = nThisPos-1;
-
-            if (!pStart || *pStart < nIndex1)
-                rSpans.push_back(Span(nIndex1, nIndex2, nLastVal));
-            else if (*pStart <= nIndex2)
-                rSpans.push_back(Span(*pStart, nIndex2, nLastVal));
+            rSpans.push_back(Span(nIndex1, nIndex2, nLastVal));
         }
 
         nLastPos = nThisPos;
@@ -105,7 +101,7 @@ std::vector<Span> toSpanArrayWithValue( const mdds::flat_segment_tree<Key,Val>&
     std::vector<Span> aSpans;
 
     typename FstType::const_iterator it = rTree.begin(), itEnd = rTree.end();
-    buildSpanWithValue<Key,Val,Span>(aSpans, it, itEnd, nullptr);
+    buildSpanWithValue<Key,Val,Span>(aSpans, it, itEnd);
     return aSpans;
 }
 
diff --git a/sc/inc/postit.hxx b/sc/inc/postit.hxx
index ba7d2705fb04..c13169f1b960 100644
--- a/sc/inc/postit.hxx
+++ b/sc/inc/postit.hxx
@@ -304,7 +304,7 @@ public:
      */
     static ScPostIt*    CreateNoteFromCaption(
                             ScDocument& rDoc, const ScAddress& rPos,
-                            SdrCaptionObj* pCaption, bool bShown );
+                            SdrCaptionObj* pCaption );
 
     /** Creates a cell note based on the passed caption object data.
 
@@ -341,7 +341,7 @@ public:
                             ScDocument& rDoc, const ScAddress& rPos,
                             SfxItemSet* pItemSet, OutlinerParaObject* pOutlinerObj,
                             const tools::Rectangle& rCaptionRect, bool bShown,
-                            bool bAlwaysCreateCaption, sal_uInt32 nPostItId = 0 );
+                            bool bAlwaysCreateCaption );
 
     /** Creates a cell note based on the passed string and inserts it into the
         document.
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index d14cbe077dfb..6395d9df2612 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -1220,9 +1220,9 @@ ScCaptionPtr ScNoteUtil::CreateTempCaption(
 }
 
 ScPostIt* ScNoteUtil::CreateNoteFromCaption(
-        ScDocument& rDoc, const ScAddress& rPos, SdrCaptionObj* pCaption, bool bShown )
+        ScDocument& rDoc, const ScAddress& rPos, SdrCaptionObj* pCaption )
 {
-    ScNoteData aNoteData( bShown );
+    ScNoteData aNoteData( true/*bShown*/ );
     aNoteData.mxCaption.reset( pCaption );
     ScPostIt* pNote = new ScPostIt( rDoc, rPos, aNoteData, false );
     pNote->AutoStamp();
@@ -1230,7 +1230,7 @@ ScPostIt* ScNoteUtil::CreateNoteFromCaption(
     rDoc.SetNote(rPos, pNote);
 
     // ScNoteCaptionCreator c'tor updates the caption object to be part of a note
-    ScNoteCaptionCreator aCreator( rDoc, rPos, aNoteData.mxCaption, bShown );
+    ScNoteCaptionCreator aCreator( rDoc, rPos, aNoteData.mxCaption, true/*bShown*/ );
 
     return pNote;
 }
@@ -1238,7 +1238,7 @@ ScPostIt* ScNoteUtil::CreateNoteFromCaption(
 ScPostIt* ScNoteUtil::CreateNoteFromObjectData(
         ScDocument& rDoc, const ScAddress& rPos, SfxItemSet* pItemSet,
         OutlinerParaObject* pOutlinerObj, const tools::Rectangle& rCaptionRect,
-        bool bShown, bool bAlwaysCreateCaption, sal_uInt32 nPostItId )
+        bool bShown, bool bAlwaysCreateCaption )
 {
     OSL_ENSURE( pItemSet && pOutlinerObj, "ScNoteUtil::CreateNoteFromObjectData - item set and outliner object expected" );
     ScNoteData aNoteData( bShown );
@@ -1260,7 +1260,7 @@ ScPostIt* ScNoteUtil::CreateNoteFromObjectData(
 
     /*  Create the note and insert it into the document. If the note is
         visible, the caption object will be created automatically. */
-    ScPostIt* pNote = new ScPostIt( rDoc, rPos, aNoteData, bAlwaysCreateCaption, nPostItId );
+    ScPostIt* pNote = new ScPostIt( rDoc, rPos, aNoteData, bAlwaysCreateCaption, 0/*nPostItId*/ );
     pNote->AutoStamp();
 
     rDoc.SetNote(rPos, pNote);
diff --git a/sc/source/core/tool/charthelper.cxx b/sc/source/core/tool/charthelper.cxx
index b8a6f0381882..a122be12f155 100644
--- a/sc/source/core/tool/charthelper.cxx
+++ b/sc/source/core/tool/charthelper.cxx
@@ -38,7 +38,7 @@ using ::com::sun::star::uno::Reference;
 namespace
 {
 
-sal_uInt16 lcl_DoUpdateCharts( const ScAddress& rPos, ScDocument* pDoc, bool bAllCharts )
+sal_uInt16 lcl_DoUpdateCharts( ScDocument* pDoc )
 {
     ScDrawLayer* pModel = pDoc->GetDrawLayer();
     if (!pModel)
@@ -59,20 +59,8 @@ sal_uInt16 lcl_DoUpdateCharts( const ScAddress& rPos, ScDocument* pDoc, bool bAl
             if ( pObject->GetObjIdentifier() == OBJ_OLE2 && ScDocument::IsChart( pObject ) )
             {
                 OUString aName = static_cast<SdrOle2Obj*>(pObject)->GetPersistName();
-                bool bHit = true;
-                if ( !bAllCharts )
-                {
-                    ScRangeList aRanges;
-                    bool bColHeaders = false;
-                    bool bRowHeaders = false;
-                    pDoc->GetOldChartParameters( aName, aRanges, bColHeaders, bRowHeaders );
-                    bHit = aRanges.In( rPos );
-                }
-                if ( bHit )
-                {
-                    pDoc->UpdateChart( aName );
-                    ++nFound;
-                }
+                pDoc->UpdateChart( aName );
+                ++nFound;
             }
             pObject = aIter.Next();
         }
@@ -116,7 +104,7 @@ bool lcl_AdjustRanges( ScRangeList& rRanges, SCTAB nSourceTab, SCTAB nDestTab, S
 //static
 sal_uInt16 ScChartHelper::DoUpdateAllCharts( ScDocument* pDoc )
 {
-    return lcl_DoUpdateCharts( ScAddress(), pDoc, true );
+    return lcl_DoUpdateCharts( pDoc );
 }
 
 void ScChartHelper::AdjustRangesOfChartsOnDestinationPage( const ScDocument* pSrcDoc, ScDocument* pDestDoc, const SCTAB nSrcTab, const SCTAB nDestTab )
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 3844e80008e0..a12f0e05c258 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -1131,7 +1131,7 @@ struct ConventionXL
         return lcl_makeExternalNameStr( rFile, rName, '!', false);
     }
 
-    static void makeExternalDocStr( OUStringBuffer& rBuffer, const OUString& rFullName, bool bEncodeUrl )
+    static void makeExternalDocStr( OUStringBuffer& rBuffer, const OUString& rFullName )
     {
         // Format that is easier to deal with inside OOo, because we use file
         // URL, and all characters are allowed.  Check if it makes sense to do
@@ -1142,11 +1142,7 @@ struct ConventionXL
 
         rBuffer.append('[');
         rBuffer.append('\'');
-        OUString aFullName;
-        if (bEncodeUrl)
-            aFullName = rFullName;
-        else
-            aFullName = INetURLObject::decode(rFullName, INetURLObject::DecodeMechanism::Unambiguous);
+        OUString aFullName = INetURLObject::decode(rFullName, INetURLObject::DecodeMechanism::Unambiguous);
 
         const sal_Unicode* pBuf = aFullName.getStr();
         sal_Int32 nLen = aFullName.getLength();
@@ -1360,7 +1356,7 @@ struct ConventionXL_A1 : public Convention_A1, public ConventionXL
         // whole file path with [] because the file name can contain any
         // characters.
 
-        ConventionXL::makeExternalDocStr(rBuffer, rFileName, false);
+        ConventionXL::makeExternalDocStr(rBuffer, rFileName);
         ScRangeStringConverter::AppendTableName(rBuffer, rTabName);
         rBuffer.append('!');
 
@@ -1374,7 +1370,7 @@ struct ConventionXL_A1 : public Convention_A1, public ConventionXL
     {
         ScRange aAbsRef = rRef.toAbs(rPos);
 
-        ConventionXL::makeExternalDocStr(rBuffer, rFileName, false);
+        ConventionXL::makeExternalDocStr(rBuffer, rFileName);
         ConventionXL::makeExternalTabNameRange(rBuffer, rTabName, rTabNames, aAbsRef);
         rBuffer.append('!');
 
@@ -1672,7 +1668,7 @@ struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL
         // characters.
 
         ScAddress aAbsRef = rRef.toAbs(rPos);
-        ConventionXL::makeExternalDocStr(rBuffer, rFileName, false);
+        ConventionXL::makeExternalDocStr(rBuffer, rFileName);
         ScRangeStringConverter::AppendTableName(rBuffer, rTabName);
         rBuffer.append('!');
 
@@ -1687,7 +1683,7 @@ struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL
     {
         ScRange aAbsRef = rRef.toAbs(rPos);
 
-        ConventionXL::makeExternalDocStr(rBuffer, rFileName, false);
+        ConventionXL::makeExternalDocStr(rBuffer, rFileName);
         ConventionXL::makeExternalTabNameRange(rBuffer, rTabName, rTabNames, aAbsRef);
         rBuffer.append('!');
 
diff --git a/sc/source/core/tool/refupdat.cxx b/sc/source/core/tool/refupdat.cxx
index e580593353f8..94a1e091a530 100644
--- a/sc/source/core/tool/refupdat.cxx
+++ b/sc/source/core/tool/refupdat.cxx
@@ -120,10 +120,10 @@ static bool lcl_MoveItCut( R& rRef, S nDelta, U nMask )
     return bCut;
 }
 
-template< typename R, typename S, typename U >
-static void lcl_MoveItWrap( R& rRef, S nDelta, U nMask )
+template< typename R, typename U >
+static void lcl_MoveItWrap( R& rRef, U nMask )
 {
-    rRef = sal::static_int_cast<R>( rRef + nDelta );
+    rRef = sal::static_int_cast<R>( rRef );
     if ( rRef < 0 )
         rRef += nMask+1;
     else if ( rRef > nMask )
@@ -467,38 +467,38 @@ void ScRefUpdate::MoveRelWrap( const ScDocument* pDoc, const ScAddress& rPos,
     if( rRef.Ref1.IsColRel() )
     {
         SCCOL nCol = aAbsRange.aStart.Col();
-        lcl_MoveItWrap(nCol, static_cast<SCCOL>(0), nMaxCol);
+        lcl_MoveItWrap(nCol, nMaxCol);
         aAbsRange.aStart.SetCol(nCol);
     }
     if( rRef.Ref2.IsColRel() )
     {
         SCCOL nCol = aAbsRange.aEnd.Col();
-        lcl_MoveItWrap(nCol, static_cast<SCCOL>(0), nMaxCol);
+        lcl_MoveItWrap(nCol, nMaxCol);
         aAbsRange.aEnd.SetCol(nCol);
     }
     if( rRef.Ref1.IsRowRel() )
     {
         SCROW nRow = aAbsRange.aStart.Row();
-        lcl_MoveItWrap(nRow, static_cast<SCROW>(0), nMaxRow);
+        lcl_MoveItWrap(nRow, nMaxRow);
         aAbsRange.aStart.SetRow(nRow);
     }
     if( rRef.Ref2.IsRowRel() )
     {
         SCROW nRow = aAbsRange.aEnd.Row();
-        lcl_MoveItWrap(nRow, static_cast<SCROW>(0), nMaxRow);
+        lcl_MoveItWrap(nRow, nMaxRow);
         aAbsRange.aEnd.SetRow(nRow);
     }
     SCTAB nMaxTab = pDoc->GetTableCount() - 1;
     if( rRef.Ref1.IsTabRel() )
     {
         SCTAB nTab = aAbsRange.aStart.Tab();
-        lcl_MoveItWrap(nTab, static_cast<SCTAB>(0), nMaxTab);
+        lcl_MoveItWrap(nTab, nMaxTab);
         aAbsRange.aStart.SetTab(nTab);
     }
     if( rRef.Ref2.IsTabRel() )
     {
         SCTAB nTab = aAbsRange.aEnd.Tab();
-        lcl_MoveItWrap(nTab, static_cast<SCTAB>(0), nMaxTab);
+        lcl_MoveItWrap(nTab, nMaxTab);
         aAbsRange.aEnd.SetTab(nTab);
     }
 
diff --git a/sc/source/filter/excel/tokstack.cxx b/sc/source/filter/excel/tokstack.cxx
index 46895256011f..39a33dddd4d5 100644
--- a/sc/source/filter/excel/tokstack.cxx
+++ b/sc/source/filter/excel/tokstack.cxx
@@ -74,17 +74,17 @@ TokenPool::~TokenPool()
 }
 
 /** Returns the new number of elements, or 0 if overflow. */
-static sal_uInt16 lcl_canGrow( sal_uInt16 nOld, sal_uInt16 nByMin = 1 )
+static sal_uInt16 lcl_canGrow( sal_uInt16 nOld )
 {
     if (!nOld)
-        return nByMin ? nByMin : 1;
+        return 1;
     if (nOld == SAL_MAX_UINT16)
         return 0;
     sal_uInt32 nNew = ::std::max( static_cast<sal_uInt32>(nOld) * 2,
-            static_cast<sal_uInt32>(nOld) + nByMin);
+            static_cast<sal_uInt32>(nOld) + 1);
     if (nNew > SAL_MAX_UINT16)
         nNew = SAL_MAX_UINT16;
-    if (nNew - nByMin < nOld)
+    if (nNew - 1 < nOld)
         nNew = 0;
     return static_cast<sal_uInt16>(nNew);
 }
diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx
index cf4163c82cff..ee178c72676b 100644
--- a/sc/source/filter/excel/xicontent.cxx
+++ b/sc/source/filter/excel/xicontent.cxx
@@ -884,7 +884,7 @@ void XclImpValidationManager::ReadDV( XclImpStream& rStrm )
 
     // process string list of a list validity (convert to list of string tokens)
     if( xTokArr1.get() && (eValMode == SC_VALID_LIST) && ::get_flag( nFlags, EXC_DV_STRINGLIST ) )
-        XclTokenArrayHelper::ConvertStringToList(*xTokArr1, rDoc.GetSharedStringPool(), '\n', true);
+        XclTokenArrayHelper::ConvertStringToList(*xTokArr1, rDoc.GetSharedStringPool(), '\n');
 
     maDVItems.push_back(
         o3tl::make_unique<DVItem>(aScRanges, ScValidationData(eValMode, eCondMode, xTokArr1.get(), xTokArr2.get(), &rDoc, rScRange.aStart)));
diff --git a/sc/source/filter/excel/xlformula.cxx b/sc/source/filter/excel/xlformula.cxx
index c8e2b5488491..a4a4e320b4e5 100644
--- a/sc/source/filter/excel/xlformula.cxx
+++ b/sc/source/filter/excel/xlformula.cxx
@@ -897,7 +897,7 @@ bool XclTokenArrayHelper::GetStringList( OUString& rStringList, const ScTokenArr
 }
 
 void XclTokenArrayHelper::ConvertStringToList(
-    ScTokenArray& rScTokArr, svl::SharedStringPool& rSPool, sal_Unicode cStringSep, bool bTrimLeadingSpaces )
+    ScTokenArray& rScTokArr, svl::SharedStringPool& rSPool, sal_Unicode cStringSep )
 {
     OUString aString;
     if( GetString( aString, rScTokArr ) )
@@ -908,8 +908,7 @@ void XclTokenArrayHelper::ConvertStringToList(
         for( sal_Int32 nToken = 0; nToken < nTokenCnt; ++nToken )
         {
             OUString aToken( aString.getToken( 0, cStringSep, nStringIx ) );
-            if( bTrimLeadingSpaces )
-                aToken = comphelper::string::stripStart(aToken, ' ');
+            aToken = comphelper::string::stripStart(aToken, ' '); // trim leading spaces
             if( nToken > 0 )
                 rScTokArr.AddOpCode( ocSep );
             rScTokArr.AddString(rSPool.intern(aToken));
diff --git a/sc/source/filter/inc/biffhelper.hxx b/sc/source/filter/inc/biffhelper.hxx
index a7b393be72a8..aaf03e58d8bd 100644
--- a/sc/source/filter/inc/biffhelper.hxx
+++ b/sc/source/filter/inc/biffhelper.hxx
@@ -603,7 +603,7 @@ public:
     // BIFF12 import ----------------------------------------------------------
 
     /** Reads a BIFF12 string with leading 16-bit or 32-bit length field. */
-    static OUString readString( SequenceInputStream& rStrm, bool b32BitLen = true, bool bAllowNulChars = false );
+    static OUString readString( SequenceInputStream& rStrm, bool b32BitLen = true );
 
 private:
                         BiffHelper() = delete;
diff --git a/sc/source/filter/inc/xlformula.hxx b/sc/source/filter/inc/xlformula.hxx
index 7cb557feea62..e97f6b61fafb 100644
--- a/sc/source/filter/inc/xlformula.hxx
+++ b/sc/source/filter/inc/xlformula.hxx
@@ -518,13 +518,13 @@ public:
     static bool         GetStringList( OUString& rStringList, const ScTokenArray& rScTokArr, sal_Unicode cSep );
 
     /** Tries to convert a formula that consists of a single string token to a list of strings.
+        Removes leading spaces from each token.
         @descr  Example: The formula ="abc\ndef\nghi" will be converted to the formula
         ="abc";"def";"ghi", if the LF character is specified as separator.
         @param rScTokArr  (in/out-parameter) The token array to modify.
-        @param cStringSep  The separator in the source string.
-        @param bTrimLeadingSpaces  true = remove leading spaces from each token. */
+        @param cStringSep  The separator in the source string. */
     static void ConvertStringToList(
-        ScTokenArray& rScTokArr, svl::SharedStringPool& rSPool, sal_Unicode cStringSep, bool bTrimLeadingSpaces );
+        ScTokenArray& rScTokArr, svl::SharedStringPool& rSPool, sal_Unicode cStringSep );
 
     // multiple operations ----------------------------------------------------
 
diff --git a/sc/source/filter/oox/biffhelper.cxx b/sc/source/filter/oox/biffhelper.cxx
index 1af3f7b5b527..d94f4d301954 100644
--- a/sc/source/filter/oox/biffhelper.cxx
+++ b/sc/source/filter/oox/biffhelper.cxx
@@ -90,7 +90,7 @@ union DecodedDouble
 
 // BIFF12 import --------------------------------------------------------------
 
-/*static*/ OUString BiffHelper::readString( SequenceInputStream& rStrm, bool b32BitLen, bool bAllowNulChars )
+/*static*/ OUString BiffHelper::readString( SequenceInputStream& rStrm, bool b32BitLen )
 {
     OUString aString;
     if( !rStrm.isEof() )
@@ -102,7 +102,7 @@ union DecodedDouble
         {
             // SequenceInputStream always supports getRemaining()
             nCharCount = ::std::min( nCharCount, static_cast< sal_Int32 >( rStrm.getRemaining() / 2 ) );
-            aString = rStrm.readUnicodeArray( nCharCount, bAllowNulChars );
+            aString = rStrm.readUnicodeArray( nCharCount, false/*bAllowNulChars*/ );
         }
     }
     return aString;
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 540115a61675..415e261a581b 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -883,7 +883,7 @@ void ScXMLTableRowCellContext::SetAnnotation(const ScAddress& rPos)
             {
                 OSL_ENSURE( !pCaption->GetLogicRect().IsEmpty(), "ScXMLTableRowCellContext::SetAnnotation - invalid caption rectangle" );
                 // create the cell note with the caption object
-                pNote = ScNoteUtil::CreateNoteFromCaption( *pDoc, rPos, pCaption, true );
+                pNote = ScNoteUtil::CreateNoteFromCaption( *pDoc, rPos, pCaption );
                 // forget pointer to object (do not create note again below)
                 pObject = nullptr;
             }
diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index 7ca53f64280f..24c41ed1d538 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -789,12 +789,11 @@ SfxObjectShell* ScTransferObj::SetDrawClipDoc( bool bAnyOle )
 
 void ScTransferObj::StripRefs( ScDocument* pDoc,
                     SCCOL nStartX, SCROW nStartY, SCCOL nEndX, SCROW nEndY,
-                    ScDocument* pDestDoc, SCCOL nSubX, SCROW nSubY )
+                    ScDocument* pDestDoc )
 {
     if (!pDestDoc)
     {
         pDestDoc = pDoc;
-        OSL_ENSURE(nSubX==0&&nSubY==0, "can't move within the document");
     }
 
     //  In a clipboard doc the data don't have to be on the first sheet
@@ -832,8 +831,8 @@ void ScTransferObj::StripRefs( ScDocument* pDoc,
         }
         if (bOut)
         {
-            SCCOL nCol = aIter.GetPos().Col() - nSubX;
-            SCROW nRow = aIter.GetPos().Row() - nSubY;
+            SCCOL nCol = aIter.GetPos().Col();
+            SCROW nRow = aIter.GetPos().Row();
 
             FormulaError nErrCode = pFCell->GetErrCode();
             ScAddress aPos(nCol, nRow, nDestTab);
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 4ffbf7610c50..e7f25c4c8a48 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -3492,7 +3492,7 @@ bool ScDocFunc::SetTabBgColor(
 //! - Optimal height of text cells is different for a printer and a screen
 //! - Optimal width needs a selection in order to take only selected cells into account
 
-static sal_uInt16 lcl_GetOptimalColWidth( ScDocShell& rDocShell, SCCOL nCol, SCTAB nTab, bool bFormula )
+static sal_uInt16 lcl_GetOptimalColWidth( ScDocShell& rDocShell, SCCOL nCol, SCTAB nTab )
 {
     ScSizeDeviceProvider aProv(&rDocShell);
     OutputDevice* pDev = aProv.GetDevice();         // has pixel MapMode
@@ -3502,7 +3502,7 @@ static sal_uInt16 lcl_GetOptimalColWidth( ScDocShell& rDocShell, SCCOL nCol, SCT
     ScDocument& rDoc = rDocShell.GetDocument();
     Fraction aOne(1,1);
     sal_uInt16 nTwips = rDoc.GetOptimalColWidth( nCol, nTab, pDev, nPPTX, nPPTY, aOne, aOne,
-                                                    bFormula );
+                                                false/*bFormula*/ );
 
     return nTwips;
 }
@@ -3627,7 +3627,7 @@ bool ScDocFunc::SetWidthOrHeight(
 
                     if ( eMode==SC_SIZE_OPTIMAL || eMode==SC_SIZE_VISOPT )
                         nThisSize = nSizeTwips +
-                                    lcl_GetOptimalColWidth( rDocShell, nCol, nTab, false/*bFormula*/ );
+                                    lcl_GetOptimalColWidth( rDocShell, nCol, nTab );
                     if ( nThisSize )
                         rDoc.SetColWidth( nCol, nTab, nThisSize );
 
diff --git a/sc/source/ui/inc/transobj.hxx b/sc/source/ui/inc/transobj.hxx
index 312d1beeaf6f..9905e7e67ebc 100644
--- a/sc/source/ui/inc/transobj.hxx
+++ b/sc/source/ui/inc/transobj.hxx
@@ -63,8 +63,7 @@ private:
     void        InitDocShell(bool bLimitToPageSize);
     static void StripRefs( ScDocument* pDoc, SCCOL nStartX, SCROW nStartY,
                             SCCOL nEndX, SCROW nEndY,
-                            ScDocument* pDestDoc,
-                            SCCOL nSubX=0, SCROW nSubY=0 );
+                            ScDocument* pDestDoc );
     static void PaintToDev( OutputDevice* pDev, ScDocument* pDoc, double nPrintFactor,
                             const ScRange& rBlock );
     static void GetAreaSize( const ScDocument* pDoc, SCTAB nTab1, SCTAB nTab2, SCROW& nRow, SCCOL& nCol );
diff --git a/sc/source/ui/vba/excelvbahelper.hxx b/sc/source/ui/vba/excelvbahelper.hxx
index 49e94a1d981a..002f2b6f79a6 100644
--- a/sc/source/ui/vba/excelvbahelper.hxx
+++ b/sc/source/ui/vba/excelvbahelper.hxx
@@ -73,17 +73,17 @@ public:
     static SfxItemSet* GetDataSet( ScCellRangesBase* pRangeObj );
 };
 
-// Extracts a implementation object ( via XUnoTunnel ) from an uno object
-// by default will throw if unsuccessful.
+// Extracts a implementation object ( via XUnoTunnel ) from an uno object.
+// Will throw if unsuccessful.
 /// @throws css::uno::RuntimeException
 template < typename ImplObject >
-    ImplObject* getImplFromDocModuleWrapper( const css::uno::Reference< css::uno::XInterface >& rxWrapperIf, bool bThrow = true )
+    ImplObject* getImplFromDocModuleWrapper( const css::uno::Reference< css::uno::XInterface >& rxWrapperIf )
     {
         ImplObject* pObj = nullptr;
         css::uno::Reference< css::lang::XUnoTunnel >  xTunnel( rxWrapperIf, css::uno::UNO_QUERY );
         if ( xTunnel.is() )
             pObj = reinterpret_cast<ImplObject*>( xTunnel->getSomething(ImplObject::getUnoTunnelId()));
-        if ( bThrow && !pObj )
+        if ( !pObj )
             throw css::uno::RuntimeException("Internal error, can't extract implementation object", rxWrapperIf );
         return pObj;
     }
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index 7afaaa391c40..265293fad7f4 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -1130,14 +1130,13 @@ public:
     }
 
     static uno::Reference< excel::XRange > createRangeFromRange( const uno::Reference< XHelperInterface >& xParent, const uno::Reference<uno::XComponentContext >& xContext,
-        const uno::Reference< table::XCellRange >& xRange, const uno::Reference< sheet::XCellRangeAddressable >& xCellRangeAddressable,
-        sal_Int32 nStartColOffset = 0, sal_Int32 nStartRowOffset = 0, sal_Int32 nEndColOffset = 0 )
+        const uno::Reference< table::XCellRange >& xRange, const uno::Reference< sheet::XCellRangeAddressable >& xCellRangeAddressable )
     {
         return uno::Reference< excel::XRange >( new ScVbaRange( xParent, xContext,
             xRange->getCellRangeByPosition(
-                xCellRangeAddressable->getRangeAddress().StartColumn + nStartColOffset,
-                xCellRangeAddressable->getRangeAddress().StartRow + nStartRowOffset,
-                xCellRangeAddressable->getRangeAddress().EndColumn + nEndColOffset,
+                xCellRangeAddressable->getRangeAddress().StartColumn,
+                xCellRangeAddressable->getRangeAddress().StartRow,
+                xCellRangeAddressable->getRangeAddress().EndColumn,
                 xCellRangeAddressable->getRangeAddress().EndRow ) ) );
     }
 


More information about the Libreoffice-commits mailing list