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

Noel Grandin noel.grandin at collabora.co.uk
Mon Jan 1 18:05:43 UTC 2018


 sc/inc/addincol.hxx                       |    2 +-
 sc/inc/conditio.hxx                       |    2 +-
 sc/inc/document.hxx                       |    4 ++--
 sc/inc/formulacell.hxx                    |    2 +-
 sc/source/core/data/documen8.cxx          |    2 +-
 sc/source/core/data/formulacell.cxx       |    5 +++--
 sc/source/core/data/postit.cxx            |    2 +-
 sc/source/core/tool/addincol.cxx          |    2 +-
 sc/source/filter/excel/xicontent.cxx      |    2 +-
 sc/source/filter/excel/xltoolbar.hxx      |    2 +-
 sc/source/filter/inc/workbookhelper.hxx   |    2 +-
 sc/source/filter/inc/worksheethelper.hxx  |    2 +-
 sc/source/filter/inc/xicontent.hxx        |    2 +-
 sc/source/filter/inc/xistream.hxx         |    2 +-
 sc/source/filter/oox/workbookfragment.cxx |    2 +-
 sc/source/filter/oox/workbookhelper.cxx   |    2 +-
 sc/source/filter/oox/worksheethelper.cxx  |    2 +-
 sc/source/ui/inc/cellsh.hxx               |    2 +-
 sc/source/ui/unoobj/chart2uno.cxx         |    2 +-
 sc/source/ui/view/cellsh4.cxx             |    2 +-
 20 files changed, 23 insertions(+), 22 deletions(-)

New commits:
commit 4b27e96cb05ba9fa4d89d8727466db3eb7ef15a6
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Sun Dec 31 21:34:58 2017 +0200

    loplugin:passstuffbyref improved return in sc
    
    Change-Id: I487cfe96e9fe65f9be39b2488880410bc7b4baea
    Reviewed-on: https://gerrit.libreoffice.org/47228
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/inc/addincol.hxx b/sc/inc/addincol.hxx
index be47d59bddcd..6b2f1b29f535 100644
--- a/sc/inc/addincol.hxx
+++ b/sc/inc/addincol.hxx
@@ -153,7 +153,7 @@ public:
                 ~ScUnoAddInCollection();
 
                         /// User entered name. rUpperName MUST already be upper case!
-    OUString     FindFunction( const OUString& rUpperName, bool bLocalFirst );
+    const OUString &    FindFunction( const OUString& rUpperName, bool bLocalFirst );
 
                         /** Only if bComplete is set, the function reference and argument types
                             are initialized (component may have to be loaded).
diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx
index 327b8367dce9..a27eeafc9ab8 100644
--- a/sc/inc/conditio.hxx
+++ b/sc/inc/conditio.hxx
@@ -361,7 +361,7 @@ public:
     void SetOperation(ScConditionMode eMode);
     bool            IsIgnoreBlank() const       { return ( nOptions & SC_COND_NOBLANKS ) == 0; }
     void            SetIgnoreBlank(bool bSet);
-    OUString        GetSrcString() const         { return aSrcString; }
+    const OUString& GetSrcString() const         { return aSrcString; }
     const ScAddress& GetSrcPos() const           { return aSrcPos; }
 
     ScAddress       GetValidSrcPos() const;     // adjusted to allow textual representation of expressions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 4d908c9e20cb..834783c0bff3 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1995,7 +1995,7 @@ public:
 
     void            SetRangeOverflowType(ErrCode nType)  { nRangeOverflowType = nType; }
     bool            HasRangeOverflow() const             { return nRangeOverflowType != ERRCODE_NONE; }
-    SC_DLLPUBLIC ErrCode GetRangeOverflowType() const    { return nRangeOverflowType; }
+    SC_DLLPUBLIC const ErrCode& GetRangeOverflowType() const    { return nRangeOverflowType; }
 
     // for broadcasting/listening
     void            SetInsertingFromOtherDoc( bool bVal ) { bInsertingFromOtherDoc = bVal; }
@@ -2055,7 +2055,7 @@ public:
     void SC_DLLPUBLIC SetFormulaResults( const ScAddress& rTopPos, const double* pResults, size_t nLen );
     void SC_DLLPUBLIC SetFormulaResults( const ScAddress& rTopPos, const formula::FormulaConstTokenRef* pResults, size_t nLen );
 
-    ScDocumentThreadSpecific CalculateInColumnInThread( ScInterpreterContext& rContext, const ScAddress& rTopPos, size_t nLen, unsigned nThisThread, unsigned nThreadsTotal);
+    const ScDocumentThreadSpecific& CalculateInColumnInThread( ScInterpreterContext& rContext, const ScAddress& rTopPos, size_t nLen, unsigned nThisThread, unsigned nThreadsTotal);
     void HandleStuffAfterParallelCalculation( const ScAddress& rTopPos, size_t nLen );
 
     /**
diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
index 1eaf33649d77..52d5d9cfc7a6 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -376,7 +376,7 @@ public:
     void SetHybridFormula(
         const OUString& r, const formula::FormulaGrammar::Grammar eGrammar );
 
-    OUString GetHybridFormula() const;
+    const OUString& GetHybridFormula() const;
 
     void SetResultMatrix( SCCOL nCols, SCROW nRows, const ScConstMatrixRef& pMat, const formula::FormulaToken* pUL );
 
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index 24dda526ec6d..62fbf6843442 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -426,7 +426,7 @@ void ScDocument::SetFormulaResults(
     pTab->SetFormulaResults(rTopPos.Col(), rTopPos.Row(), pResults, nLen);
 }
 
-ScDocumentThreadSpecific ScDocument::CalculateInColumnInThread( ScInterpreterContext& rContext, const ScAddress& rTopPos, size_t nLen, unsigned nThisThread, unsigned nThreadsTotal)
+const ScDocumentThreadSpecific& ScDocument::CalculateInColumnInThread( ScInterpreterContext& rContext, const ScAddress& rTopPos, size_t nLen, unsigned nThisThread, unsigned nThreadsTotal)
 {
     ScTable* pTab = FetchTable(rTopPos.Tab());
     if (!pTab)
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index a43a737d2edd..d46bf53cb8c3 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -2512,7 +2512,7 @@ void ScFormulaCell::SetHybridFormula( const OUString& r,
     aResult.SetHybridFormula( r); eTempGrammar = eGrammar;
 }
 
-OUString ScFormulaCell::GetHybridFormula() const
+const OUString& ScFormulaCell::GetHybridFormula() const
 {
     return aResult.GetHybridFormula();
 }
@@ -4406,7 +4406,8 @@ bool ScFormulaCell::InterpretFormulaGroup()
             {
                 ScInterpreterContext aContext(*mpDocument, mpFormatter);
 
-                mpDocument->CalculateInColumnInThread(aContext, mrTopPos, mnLength, mnThisThread, mnThreadsTotal).MergeBackIntoNonThreadedData(mpDocument->maNonThreaded);
+                auto aNonThreadedData = mpDocument->CalculateInColumnInThread(aContext, mrTopPos, mnLength, mnThisThread, mnThreadsTotal);
+                aNonThreadedData.MergeBackIntoNonThreadedData(mpDocument->maNonThreaded);
             }
 
         };
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index e35c7708c71a..aa342cac0fe9 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -167,7 +167,7 @@ public:
     /** Returns the drawing layer page of the sheet contained in maPos. */
     SdrPage*            GetDrawPage();
     /** Returns the caption drawing object. */
-    ScCaptionPtr GetCaption() { return mxCaption; }
+    ScCaptionPtr &      GetCaption() { return mxCaption; }
 
     /** Moves the caption inside the passed rectangle. Uses page area if 0 is passed. */
     void                FitCaptionToRect( const tools::Rectangle* pVisRect = nullptr );
diff --git a/sc/source/core/tool/addincol.cxx b/sc/source/core/tool/addincol.cxx
index 49aed16a7a95..1517ae59e6fb 100644
--- a/sc/source/core/tool/addincol.cxx
+++ b/sc/source/core/tool/addincol.cxx
@@ -1118,7 +1118,7 @@ void ScUnoAddInCollection::UpdateFromAddIn( const uno::Reference<uno::XInterface
     }
 }
 
-OUString ScUnoAddInCollection::FindFunction( const OUString& rUpperName, bool bLocalFirst )
+const OUString & ScUnoAddInCollection::FindFunction( const OUString& rUpperName, bool bLocalFirst )
 {
     if (!bInitialized)
         Initialize();
diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx
index 4db48555220a..b0d5b7284feb 100644
--- a/sc/source/filter/excel/xicontent.cxx
+++ b/sc/source/filter/excel/xicontent.cxx
@@ -1227,7 +1227,7 @@ XclImpDecrypterRef lclReadFilepass8( XclImpStream& rStrm )
 
 } // namespace
 
-ErrCode XclImpDecryptHelper::ReadFilepass( XclImpStream& rStrm )
+const ErrCode& XclImpDecryptHelper::ReadFilepass( XclImpStream& rStrm )
 {
     XclImpDecrypterRef xDecr;
     rStrm.DisableDecryption();
diff --git a/sc/source/filter/excel/xltoolbar.hxx b/sc/source/filter/excel/xltoolbar.hxx
index cf548127d464..36e106696264 100644
--- a/sc/source/filter/excel/xltoolbar.hxx
+++ b/sc/source/filter/excel/xltoolbar.hxx
@@ -62,7 +62,7 @@ public:
     bool IsMenuToolbar();
     bool ImportCustomToolBar( ScCTBWrapper&, CustomToolBarImportHelper& );
     bool ImportMenuTB( ScCTBWrapper&, const css::uno::Reference< css::container::XIndexContainer >&, CustomToolBarImportHelper& );
-    OUString GetName() { return tb.getName().getString(); }
+    const OUString& GetName() { return tb.getName().getString(); }
 
 };
 
diff --git a/sc/source/filter/inc/workbookhelper.hxx b/sc/source/filter/inc/workbookhelper.hxx
index 6f2eabfdab3f..afd36fadd83b 100644
--- a/sc/source/filter/inc/workbookhelper.hxx
+++ b/sc/source/filter/inc/workbookhelper.hxx
@@ -134,7 +134,7 @@ public:
 
     ScEditEngineDefaulter& getEditEngine() const;
     /** Returns a reference to the source/target spreadsheet document model. */
-    css::uno::Reference< css::sheet::XSpreadsheetDocument >
+    const css::uno::Reference< css::sheet::XSpreadsheetDocument >&
                         getDocument() const;
 
     /** Returns a reference to the specified spreadsheet in the document model. */
diff --git a/sc/source/filter/inc/worksheethelper.hxx b/sc/source/filter/inc/worksheethelper.hxx
index 3929b180de57..bd859ea67051 100644
--- a/sc/source/filter/inc/worksheethelper.hxx
+++ b/sc/source/filter/inc/worksheethelper.hxx
@@ -204,7 +204,7 @@ public:
     /** Returns the absolute cell position in 1/100 mm. */
     css::awt::Point getCellPosition( sal_Int32 nCol, sal_Int32 nRow ) const;
     /** Returns the size of the entire drawing page in 1/100 mm. */
-    css::awt::Size getDrawPageSize() const;
+    const css::awt::Size& getDrawPageSize() const;
 
     /** Returns the buffer for cell contents and cell formatting. */
     SheetDataBuffer&    getSheetData() const;
diff --git a/sc/source/filter/inc/xicontent.hxx b/sc/source/filter/inc/xicontent.hxx
index 77a1068035ad..cb6b80850cdb 100644
--- a/sc/source/filter/inc/xicontent.hxx
+++ b/sc/source/filter/inc/xicontent.hxx
@@ -268,7 +268,7 @@ public:
 
     /** Reads the FILEPASS record, queries a password and sets decryption algorithm.
         @return  Error code that may cause an error message after import. */
-    static ErrCode      ReadFilepass( XclImpStream& rStrm );
+    static const ErrCode&      ReadFilepass( XclImpStream& rStrm );
 };
 
 // Document protection ========================================================
diff --git a/sc/source/filter/inc/xistream.hxx b/sc/source/filter/inc/xistream.hxx
index 9f20f3984b32..47e78e7ad4cb 100644
--- a/sc/source/filter/inc/xistream.hxx
+++ b/sc/source/filter/inc/xistream.hxx
@@ -47,7 +47,7 @@ public:
     virtual             ~XclImpDecrypter() override;
 
     /** Returns the current error code of the decrypter. */
-    ErrCode      GetError() const { return mnError; }
+    const ErrCode&      GetError() const { return mnError; }
     /** Returns true, if the decoder has been initialized correctly. */
     bool         IsValid() const { return mnError == ERRCODE_NONE; }
 
diff --git a/sc/source/filter/oox/workbookfragment.cxx b/sc/source/filter/oox/workbookfragment.cxx
index 9cf8d6423edd..d80b594c730e 100644
--- a/sc/source/filter/oox/workbookfragment.cxx
+++ b/sc/source/filter/oox/workbookfragment.cxx
@@ -294,7 +294,7 @@ public:
     {
         aSegments.clear();
     }
-    ISegmentProgressBarRef wrapProgress( const ISegmentProgressBarRef &xProgress )
+    const ISegmentProgressBarRef& wrapProgress( const ISegmentProgressBarRef &xProgress )
     {
         aSegments.push_back( ISegmentProgressBarRef( new ProgressWrapper( xProgress ) ) );
         return aSegments.back();
diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx
index b3480d51f6bf..b37638da99cb 100644
--- a/sc/source/filter/oox/workbookhelper.cxx
+++ b/sc/source/filter/oox/workbookhelper.cxx
@@ -744,7 +744,7 @@ ScEditEngineDefaulter& WorkbookHelper::getEditEngine() const
     return mrBookGlob.getEditEngine();
 }
 
-Reference< XSpreadsheetDocument > WorkbookHelper::getDocument() const
+const Reference< XSpreadsheetDocument > & WorkbookHelper::getDocument() const
 {
     return mrBookGlob.getDocument();
 }
diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx
index 2ef765d932b5..8b61352f5c82 100644
--- a/sc/source/filter/oox/worksheethelper.cxx
+++ b/sc/source/filter/oox/worksheethelper.cxx
@@ -1389,7 +1389,7 @@ awt::Point WorksheetHelper::getCellPosition( sal_Int32 nCol, sal_Int32 nRow ) co
     return mrSheetGlob.getCellPosition( nCol, nRow );
 }
 
-awt::Size WorksheetHelper::getDrawPageSize() const
+const awt::Size& WorksheetHelper::getDrawPageSize() const
 {
     return mrSheetGlob.getDrawPageSize();
 }
diff --git a/sc/source/ui/inc/cellsh.hxx b/sc/source/ui/inc/cellsh.hxx
index 30e89c4612e0..04ab41c9aa2f 100644
--- a/sc/source/ui/inc/cellsh.hxx
+++ b/sc/source/ui/inc/cellsh.hxx
@@ -107,7 +107,7 @@ public:
     void        ExecutePageSel( SfxRequest& rReq );
     void        ExecuteMove( SfxRequest& rReq );
 
-    VclPtr<vcl::Window> GetFrameWin();
+    const VclPtr<vcl::Window>& GetFrameWin();
 
     static void GetStateCursor( SfxItemSet& rSet );
 };
diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index 020326a268f7..d5dce02cd4f7 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -3090,7 +3090,7 @@ public:
         }
     }
 
-    Sequence<OUString> getLabels() const { return *mpLabels; }
+    const Sequence<OUString>& getLabels() const { return *mpLabels; }
 
 private:
     shared_ptr< Sequence<OUString> >    mpLabels;
diff --git a/sc/source/ui/view/cellsh4.cxx b/sc/source/ui/view/cellsh4.cxx
index 3037ceb0c425..b13197d3f0f3 100644
--- a/sc/source/ui/view/cellsh4.cxx
+++ b/sc/source/ui/view/cellsh4.cxx
@@ -31,7 +31,7 @@
 
 #include <vcl/svapp.hxx>
 
-VclPtr<vcl::Window> ScCellShell::GetFrameWin()
+const VclPtr<vcl::Window>& ScCellShell::GetFrameWin()
 {
     return pFrameWin;
 }


More information about the Libreoffice-commits mailing list