[Libreoffice-commits] core.git: compilerplugins/clang editeng/source include/editeng include/svtools include/svx include/vcl sc/inc sc/source sd/source sfx2/source svtools/source svx/source sw/inc sw/source vcl/inc vcl/source vcl/unx writerfilter/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Oct 15 17:22:44 UTC 2018


 compilerplugins/clang/staticconstfield.cxx       |  144 ++++++++++++++++-------
 compilerplugins/clang/test/staticconstfield.cxx  |   93 ++++++++------
 editeng/source/outliner/outliner.cxx             |   11 -
 editeng/source/outliner/outlvw.cxx               |    4 
 include/editeng/outliner.hxx                     |    2 
 include/svtools/svparser.hxx                     |    2 
 include/svx/ClassificationDialog.hxx             |    1 
 include/svx/colrctrl.hxx                         |    2 
 include/vcl/filter/pdfdocument.hxx               |    4 
 sc/inc/rangenam.hxx                              |    8 -
 sc/source/core/tool/compiler.cxx                 |    2 
 sc/source/core/tool/interpr8.cxx                 |    2 
 sc/source/core/tool/rangenam.cxx                 |   28 ----
 sc/source/filter/inc/sheetdatabuffer.hxx         |    2 
 sc/source/filter/oox/sheetdatabuffer.cxx         |    3 
 sc/source/filter/xml/cachedattraccess.cxx        |    2 
 sc/source/filter/xml/cachedattraccess.hxx        |    2 
 sd/source/ui/animations/CustomAnimationPane.cxx  |    6 
 sd/source/ui/animations/CustomAnimationPane.hxx  |    2 
 sd/source/ui/sidebar/PreviewValueSet.cxx         |    5 
 sd/source/ui/sidebar/PreviewValueSet.hxx         |    1 
 sd/source/ui/slidesorter/view/SlsLayouter.cxx    |   56 ++++----
 sfx2/source/doc/doctemplates.cxx                 |    6 
 svtools/source/svrtf/svparser.cxx                |    2 
 svx/source/dialog/ClassificationDialog.cxx       |    1 
 svx/source/svdraw/svdpdf.cxx                     |    3 
 svx/source/svdraw/svdpdf.hxx                     |    2 
 svx/source/tbxctrls/colrctrl.cxx                 |   27 ++--
 sw/inc/pagepreviewlayout.hxx                     |    4 
 sw/source/core/view/pagepreviewlayout.cxx        |   26 +---
 sw/source/filter/html/htmlcss1.cxx               |   19 ---
 sw/source/filter/html/svxcss1.cxx                |    9 -
 sw/source/filter/html/svxcss1.hxx                |    6 
 vcl/inc/octree.hxx                               |    8 -
 vcl/source/filter/ipdf/pdfdocument.cxx           |    7 -
 vcl/source/gdi/octree.cxx                        |   13 --
 vcl/unx/generic/print/bitmap_gfx.cxx             |   18 +-
 writerfilter/source/dmapper/GraphicImport.cxx    |    5 
 writerfilter/source/dmapper/NumberingManager.cxx |    9 -
 writerfilter/source/dmapper/NumberingManager.hxx |    2 
 writerfilter/source/dmapper/PropertyMap.cxx      |    8 -
 writerfilter/source/dmapper/PropertyMap.hxx      |    2 
 42 files changed, 276 insertions(+), 283 deletions(-)

New commits:
commit eaf0c263eb1a72a58d2a67cc0506ab022d7c4be4
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Oct 12 17:12:22 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Oct 15 19:22:21 2018 +0200

    loplugin:staticconstfield improvements
    
    And fix
      ScXMLCachedRowAttrAccess::Cache
    which was never setting its mnTab field, and hence would never
    be hit.
    
    And fix oox::xls::CellBlockBuffer, which was never setting mnCurrRow.
    
    Change-Id: I2c46aa050b9ebe3c2dc2e52579555f97945dd61c
    Reviewed-on: https://gerrit.libreoffice.org/61772
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/compilerplugins/clang/staticconstfield.cxx b/compilerplugins/clang/staticconstfield.cxx
index cde2f80babc5..b10953a75617 100644
--- a/compilerplugins/clang/staticconstfield.cxx
+++ b/compilerplugins/clang/staticconstfield.cxx
@@ -11,6 +11,9 @@
 #include "check.hxx"
 #include "compat.hxx"
 #include <iostream>
+#include <unordered_map>
+#include <unordered_set>
+#include <vector>
 
 namespace
 {
@@ -22,22 +25,76 @@ public:
     {
     }
 
-    void run() override { TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); }
+    void run() override;
 
     bool TraverseConstructorInitializer(CXXCtorInitializer* init);
+    bool TraverseCXXConstructorDecl(CXXConstructorDecl* decl);
+
+private:
+    struct Data
+    {
+        std::vector<CXXCtorInitializer const*> inits;
+        std::string value;
+    };
+    std::unordered_map<FieldDecl const*, Data> m_potentials;
+    std::unordered_set<FieldDecl const*> m_excluded;
+    CXXConstructorDecl* m_currentConstructor = nullptr;
 };
 
+void StaticConstField::run()
+{
+    std::string fn = handler.getMainFileName();
+    loplugin::normalizeDotDotInFilePath(fn);
+
+    // unusual case where a user constructor sets a field to one value, and a copy constructor sets it to a different value
+    if (fn == SRCDIR "/sw/source/core/attr/hints.cxx")
+        return;
+    if (fn == SRCDIR "/oox/source/core/contexthandler2.cxx")
+        return;
+
+    TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
+
+    for (auto const& pair : m_potentials)
+    {
+        report(DiagnosticsEngine::Error, "field can be static const", pair.first->getLocation())
+            << pair.first->getSourceRange();
+        for (CXXCtorInitializer const* init : pair.second.inits)
+            if (pair.first->getLocation() != init->getSourceLocation())
+                report(DiagnosticsEngine::Note, "init here", init->getSourceLocation())
+                    << init->getSourceRange();
+    }
+}
+
+bool StaticConstField::TraverseCXXConstructorDecl(CXXConstructorDecl* decl)
+{
+    auto prev = m_currentConstructor;
+    m_currentConstructor = decl;
+    bool ret = FilteringPlugin::TraverseCXXConstructorDecl(decl);
+    m_currentConstructor = prev;
+    return ret;
+}
+
 bool StaticConstField::TraverseConstructorInitializer(CXXCtorInitializer* init)
 {
     if (!init->getSourceLocation().isValid() || ignoreLocation(init->getSourceLocation()))
         return true;
     if (!init->getMember())
         return true;
+    if (!init->getInit())
+        return true;
+    if (!m_currentConstructor || m_currentConstructor->isCopyOrMoveConstructor())
+        return true;
+    if (!m_currentConstructor->getParent()->isCompleteDefinition())
+        return true;
+    if (m_excluded.find(init->getMember()) != m_excluded.end())
+        return true;
     auto type = init->getMember()->getType();
     auto tc = loplugin::TypeCheck(type);
-    bool found = false;
     if (!tc.Const())
         return true;
+
+    bool found = false;
+    std::string value;
     if (tc.Const().Class("OUString").Namespace("rtl").GlobalNamespace()
         || tc.Const().Class("OString").Namespace("rtl").GlobalNamespace())
     {
@@ -45,61 +102,66 @@ bool StaticConstField::TraverseConstructorInitializer(CXXCtorInitializer* init)
         {
             if (constructExpr->getNumArgs() >= 1
                 && isa<clang::StringLiteral>(constructExpr->getArg(0)))
+            {
+                value = dyn_cast<clang::StringLiteral>(constructExpr->getArg(0))->getString();
                 found = true;
+            }
         }
     }
-    else if (type->isIntegerType())
-    {
-        if (isa<IntegerLiteral>(init->getInit()->IgnoreParenImpCasts()))
-            found = true;
-        // isIntegerType includes bool
-        else if (isa<CXXBoolLiteralExpr>(init->getInit()->IgnoreParenImpCasts()))
-            found = true;
-    }
+#if CLANG_VERSION >= 50000
     else if (type->isFloatingType())
     {
-        if (isa<FloatingLiteral>(init->getInit()->IgnoreParenImpCasts()))
-            found = true;
-    }
-    else if (type->isEnumeralType())
-    {
-        if (auto declRefExpr = dyn_cast<DeclRefExpr>(init->getInit()->IgnoreParenImpCasts()))
+        APFloat x1(0.0f);
+        if (init->getInit()->EvaluateAsFloat(x1, compiler.getASTContext()))
         {
-            if (isa<EnumConstantDecl>(declRefExpr->getDecl()))
-                found = true;
+            std::string s;
+            llvm::raw_string_ostream os(s);
+            x1.print(os);
+            value = os.str();
+            found = true;
         }
     }
-
-    // If we find more than one non-copy-move constructor, we can't say for sure if a member can be static
-    // because it could be initialised differently in each constructor.
-    if (auto cxxRecordDecl = dyn_cast<CXXRecordDecl>(init->getMember()->getParent()))
+#endif
+    // ignore this, it seems to trigger an infinite recursion
+    else if (isa<UnaryExprOrTypeTraitExpr>(init->getInit()))
+        ;
+    // ignore this, calling EvaluateAsInt on it will crash clang
+    else if (init->getInit()->isValueDependent())
+        ;
+    else
     {
-        int cnt = 0;
-        for (auto it = cxxRecordDecl->ctor_begin(); it != cxxRecordDecl->ctor_end(); ++it)
+        APSInt x1;
+        if (init->getInit()->EvaluateAsInt(x1, compiler.getASTContext()))
         {
-            if (!it->isCopyOrMoveConstructor())
-                cnt++;
+            value = x1.toString(10);
+            found = true;
         }
-        if (cnt > 1)
-            return true;
     }
 
     if (!found)
+    {
+        m_potentials.erase(init->getMember());
+        m_excluded.insert(init->getMember());
         return true;
+    }
 
-    std::string fn = handler.getMainFileName();
-    loplugin::normalizeDotDotInFilePath(fn);
-
-    // unusual case where a user constructor sets a field to one value, and a copy constructor sets it to a different value
-    if (fn == SRCDIR "/sw/source/core/attr/hints.cxx")
-        return true;
-    if (fn == SRCDIR "/oox/source/core/contexthandler2.cxx")
-        return true;
-
-    report(DiagnosticsEngine::Warning, "field can be static const", init->getSourceLocation())
-        << init->getSourceRange();
-    report(DiagnosticsEngine::Note, "field here", init->getMember()->getLocation())
-        << init->getMember()->getSourceRange();
+    auto findIt = m_potentials.find(init->getMember());
+    if (findIt != m_potentials.end())
+    {
+        if (findIt->second.value != value)
+        {
+            m_potentials.erase(findIt);
+            m_excluded.insert(init->getMember());
+        }
+        else
+            findIt->second.inits.push_back(init);
+    }
+    else
+    {
+        Data& data = m_potentials[init->getMember()];
+        data.inits.push_back(init);
+        data.value = value;
+    }
 
     return true;
 }
diff --git a/compilerplugins/clang/test/staticconstfield.cxx b/compilerplugins/clang/test/staticconstfield.cxx
index 03708fcaa9fd..ab0a24fa734a 100644
--- a/compilerplugins/clang/test/staticconstfield.cxx
+++ b/compilerplugins/clang/test/staticconstfield.cxx
@@ -7,15 +7,18 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include <config_clang.h>
 #include <rtl/ustring.hxx>
 #include <rtl/string.hxx>
+#include <vector>
 
 class Class1
 {
-    OUString const m_field1; // expected-note {{field here [loplugin:staticconstfield]}}
+    OUString const
+        m_field1; // expected-error {{field can be static const [loplugin:staticconstfield]}}
     Class1()
         : m_field1("xxxx")
-    // expected-error at -1 {{field can be static const [loplugin:staticconstfield]}}
+    // expected-note at -1 {{init here [loplugin:staticconstfield]}}
     {
         (void)m_field1;
     }
@@ -23,52 +26,58 @@ class Class1
 
 class Class2
 {
-    OString const m_field1; // expected-note {{field here [loplugin:staticconstfield]}}
+    OString const
+        m_field2; // expected-error {{field can be static const [loplugin:staticconstfield]}}
     Class2()
-        : m_field1("xxxx")
-    // expected-error at -1 {{field can be static const [loplugin:staticconstfield]}}
+        : m_field2("yyyy")
+    // expected-note at -1 {{init here [loplugin:staticconstfield]}}
     {
-        (void)m_field1;
+        (void)m_field2;
     }
 };
 
 // no warning expected
 class Class4
 {
-    OUString m_field1;
+    OUString m_field3;
     Class4()
-        : m_field1("xxxx")
+        : m_field3("zzzz")
     {
-        (void)m_field1;
+        (void)m_field3;
     }
 };
 
+#if CLANG_VERSION >= 50000 // Expr::EvaluateAsFloat
 class Class5
 {
     enum class Enum
     {
         ONE
     };
-    float const m_field1; // expected-note {{field here [loplugin:staticconstfield]}}
-    int const m_field2; // expected-note {{field here [loplugin:staticconstfield]}}
-    bool const m_field3; // expected-note {{field here [loplugin:staticconstfield]}}
-    Enum const m_field4; // expected-note {{field here [loplugin:staticconstfield]}}
+    float const
+        m_fielda1; // expected-error {{field can be static const [loplugin:staticconstfield]}}
+    int const m_fielda2; // expected-error {{field can be static const [loplugin:staticconstfield]}}
+    bool const
+        m_fielda3; // expected-error {{field can be static const [loplugin:staticconstfield]}}
+    Enum const
+        m_fielda4; // expected-error {{field can be static const [loplugin:staticconstfield]}}
     Class5()
-        : m_field1(1.0)
-        // expected-error at -1 {{field can be static const [loplugin:staticconstfield]}}
-        , m_field2(1)
-        // expected-error at -1 {{field can be static const [loplugin:staticconstfield]}}
-        , m_field3(true)
-        // expected-error at -1 {{field can be static const [loplugin:staticconstfield]}}
-        , m_field4(Enum::ONE)
-    // expected-error at -1 {{field can be static const [loplugin:staticconstfield]}}
+        : m_fielda1(1.0)
+        // expected-note at -1 {{init here [loplugin:staticconstfield]}}
+        , m_fielda2(1)
+        // expected-note at -1 {{init here [loplugin:staticconstfield]}}
+        , m_fielda3(true)
+        // expected-note at -1 {{init here [loplugin:staticconstfield]}}
+        , m_fielda4(Enum::ONE)
+    // expected-note at -1 {{init here [loplugin:staticconstfield]}}
     {
-        (void)m_field1;
-        (void)m_field2;
-        (void)m_field3;
-        (void)m_field4;
+        (void)m_fielda1;
+        (void)m_fielda2;
+        (void)m_fielda3;
+        (void)m_fielda4;
     }
 };
+#endif
 
 // no warning expected
 class Class6
@@ -77,36 +86,36 @@ class Class6
     {
         ONE
     };
-    float m_field1;
-    int m_field2;
-    bool m_field3;
-    Enum m_field4;
+    float m_fieldb1;
+    int m_fieldb2;
+    bool m_fieldb3;
+    Enum m_fieldb4;
     Class6()
-        : m_field1(1.0)
-        , m_field2(1)
-        , m_field3(true)
-        , m_field4(Enum::ONE)
+        : m_fieldb1(1.0)
+        , m_fieldb2(1)
+        , m_fieldb3(true)
+        , m_fieldb4(Enum::ONE)
     {
-        (void)m_field1;
-        (void)m_field2;
-        (void)m_field3;
-        (void)m_field4;
+        (void)m_fieldb1;
+        (void)m_fieldb2;
+        (void)m_fieldb3;
+        (void)m_fieldb4;
     }
 };
 
 // no warning expected, checking for assigning to const field from multiple constructors
 class Class7
 {
-    bool const m_field1;
+    bool const m_field7;
     Class7()
-        : m_field1(true)
+        : m_field7(true)
     {
-        (void)m_field1;
+        (void)m_field7;
     }
     Class7(bool b)
-        : m_field1(b)
+        : m_field7(b)
     {
-        (void)m_field1;
+        (void)m_field7;
     }
 };
 
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index 42715dad0511..da008ce69989 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -66,8 +66,8 @@ using std::advance;
 
 void Outliner::ImplCheckDepth( sal_Int16& rnDepth ) const
 {
-    if( rnDepth < nMinDepth )
-        rnDepth = nMinDepth;
+    if( rnDepth < gnMinDepth )
+        rnDepth = gnMinDepth;
     else if( rnDepth > nMaxDepth )
         rnDepth = nMaxDepth;
 }
@@ -713,7 +713,7 @@ void Outliner::ImplSetLevelDependentStyleSheet( sal_Int32 nPara )
 void Outliner::ImplInitDepth( sal_Int32 nPara, sal_Int16 nDepth, bool bCreateUndo )
 {
 
-    DBG_ASSERT( ( nDepth >= nMinDepth ) && ( nDepth <= nMaxDepth ), "ImplInitDepth - Depth is invalid!" );
+    DBG_ASSERT( ( nDepth >= gnMinDepth ) && ( nDepth <= nMaxDepth ), "ImplInitDepth - Depth is invalid!" );
 
     Paragraph* pPara = pParaList->GetParagraph( nPara );
         if (!pPara)
@@ -1249,7 +1249,6 @@ Outliner::Outliner(SfxItemPool* pPool, OutlinerMode nMode)
     : mnFirstSelPage(0)
     , nDepthChangedHdlPrevDepth(0)
     , nMaxDepth(9)
-    , nMinDepth(-1)
     , bFirstParaIsEmpty(true)
     , nBlockInsCallback(0)
     , bStrippingPortions(false)
@@ -1885,7 +1884,7 @@ void Outliner::Clear()
         ImplBlockInsertionCallbacks( true );
         pEditEngine->Clear();
         pParaList->Clear();
-        pParaList->Append( std::unique_ptr<Paragraph>(new Paragraph( nMinDepth )));
+        pParaList->Append( std::unique_ptr<Paragraph>(new Paragraph( gnMinDepth )));
         bFirstParaIsEmpty = true;
         ImplBlockInsertionCallbacks( false );
     }
@@ -1893,7 +1892,7 @@ void Outliner::Clear()
     {
             Paragraph* pPara = pParaList->GetParagraph( 0 );
             if(pPara)
-                pPara->SetDepth( nMinDepth );
+                pPara->SetDepth( gnMinDepth );
     }
 }
 
diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx
index f214ca3fe06d..1a211d87b02f 100644
--- a/editeng/source/outliner/outlvw.cxx
+++ b/editeng/source/outliner/outlvw.cxx
@@ -491,8 +491,8 @@ void OutlinerView::Indent( short nDiff )
         if( nOldDepth == -1 )
             continue;
 
-        if ( nNewDepth < pOwner->nMinDepth )
-            nNewDepth = pOwner->nMinDepth;
+        if ( nNewDepth < Outliner::gnMinDepth )
+            nNewDepth = Outliner::gnMinDepth;
         if ( nNewDepth > pOwner->nMaxDepth )
             nNewDepth = pOwner->nMaxDepth;
 
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx
index e0d93e3323e4..7e17dab21ece 100644
--- a/include/editeng/outliner.hxx
+++ b/include/editeng/outliner.hxx
@@ -605,7 +605,7 @@ private:
 
     sal_Int32           nDepthChangedHdlPrevDepth;
     sal_Int16           nMaxDepth;
-    const sal_Int16     nMinDepth;
+    static constexpr sal_Int16 gnMinDepth = -1;
 
     OutlinerMode        nOutlinerMode;
 
diff --git a/include/svtools/svparser.hxx b/include/svtools/svparser.hxx
index 68c6ee772666..b6333434a828 100644
--- a/include/svtools/svparser.hxx
+++ b/include/svtools/svparser.hxx
@@ -147,7 +147,7 @@ public:
 // 'pWhichIds'. It has the length 'nWhichIds'.
 // The WhichMap is not deleted.
 SVT_DLLPUBLIC void BuildWhichTable( std::vector<sal_uInt16> &rWhichMap,
-                               sal_uInt16 *pWhichIds,
+                               sal_uInt16 const *pWhichIds,
                                sal_uInt16 nWhichIds );
 
 /*========================================================================
diff --git a/include/svx/ClassificationDialog.hxx b/include/svx/ClassificationDialog.hxx
index ba2fbec1487d..607f6565bdbc 100644
--- a/include/svx/ClassificationDialog.hxx
+++ b/include/svx/ClassificationDialog.hxx
@@ -60,7 +60,6 @@ private:
     const std::function<void()> m_aParagraphSignHandler;
 
     sal_Int32 m_nCurrentSelectedCategory;
-    sal_Int16 const m_nInsertMarkings;
 
     DECL_LINK(ButtonClicked, Button*, void);
     DECL_LINK(SelectToolboxHdl, ToolBox*, void);
diff --git a/include/svx/colrctrl.hxx b/include/svx/colrctrl.hxx
index 624376a7a46b..dd7a179da93e 100644
--- a/include/svx/colrctrl.hxx
+++ b/include/svx/colrctrl.hxx
@@ -83,8 +83,6 @@ friend class SvxColorChildWindow;
 private:
     XColorListRef       pColorList;
     VclPtr<SvxColorValueSet_docking> aColorSet;
-    sal_uInt16 const    nLeftSlot;
-    sal_uInt16 const    nRightSlot;
     sal_uInt16          nCols;
     sal_uInt16          nLines;
     long                nCount;
diff --git a/include/vcl/filter/pdfdocument.hxx b/include/vcl/filter/pdfdocument.hxx
index 7735a52591bd..c245c815617b 100644
--- a/include/vcl/filter/pdfdocument.hxx
+++ b/include/vcl/filter/pdfdocument.hxx
@@ -196,15 +196,13 @@ class VCL_DLLPUBLIC PDFNameElement : public PDFElement
     OString m_aValue;
     /// Offset after the '/' token.
     sal_uInt64 m_nLocation = 0;
-    /// Length till the next token start.
-    sal_uInt64 const m_nLength = 0;
 
 public:
     PDFNameElement();
     bool Read(SvStream& rStream) override;
     const OString& GetValue() const;
     sal_uInt64 GetLocation() const;
-    sal_uInt64 GetLength() const;
+    static sal_uInt64 GetLength() { return 0; }
 };
 
 /// Dictionary object: a set key-value pairs.
diff --git a/sc/inc/rangenam.hxx b/sc/inc/rangenam.hxx
index 728164a54d6d..32bd0b3a7fe9 100644
--- a/sc/inc/rangenam.hxx
+++ b/sc/inc/rangenam.hxx
@@ -79,11 +79,6 @@ private:
     sal_uInt16      nIndex;
     bool            bModified;          // is set/cleared by UpdateReference
 
-    // max row and column to use for wrapping of references.  If -1 use the
-    // application's default.
-    SCROW const     mnMaxRow;
-    SCCOL const     mnMaxCol;
-
     void CompileRangeData( const OUString& rSymbol, bool bSetError );
     void InitCode();
 public:
@@ -162,9 +157,6 @@ public:
 
     SC_DLLPUBLIC static IsNameValidType     IsNameValid( const OUString& rName, const ScDocument* pDoc );
 
-    SCROW GetMaxRow() const;
-    SCCOL GetMaxCol() const;
-
     void CompileUnresolvedXML( sc::CompileFormulaContext& rCxt );
 
 #if DEBUG_FORMULA_COMPILER
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 04e4c9048d74..0e86fe322e78 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -4766,7 +4766,7 @@ bool ScCompiler::HandleRange()
                     AdjustSheetLocalNameRelReferences( nSheetTab - aPos.Tab());
 
                 SetRelNameReference();
-                MoveRelWrap(pRangeData->GetMaxCol(), pRangeData->GetMaxRow());
+                MoveRelWrap(MAXCOL, MAXROW);
             }
             maArrIterator.Reset();
             if ( bAddPair )
diff --git a/sc/source/core/tool/interpr8.cxx b/sc/source/core/tool/interpr8.cxx
index 2567cdc4415d..647a450afa35 100644
--- a/sc/source/core/tool/interpr8.cxx
+++ b/sc/source/core/tool/interpr8.cxx
@@ -96,7 +96,7 @@ private:
     bool bEDS;                          // true: EDS, false: ETS
 
     // constants used in determining best fit for alpha, beta, gamma
-    const double cfMinABCResolution = 0.001;  // minimum change of alpha, beta, gamma
+    static constexpr double cfMinABCResolution = 0.001;  // minimum change of alpha, beta, gamma
     static const SCSIZE cnScenarios = 1000;   // No. of scenarios to calculate for PI calculations
 
     bool initData();
diff --git a/sc/source/core/tool/rangenam.cxx b/sc/source/core/tool/rangenam.cxx
index c8a4da19cc23..c4ef813cdac3 100644
--- a/sc/source/core/tool/rangenam.cxx
+++ b/sc/source/core/tool/rangenam.cxx
@@ -57,9 +57,7 @@ ScRangeData::ScRangeData( ScDocument* pDok,
                 pDoc        ( pDok ),
                 eTempGrammar( eGrammar ),
                 nIndex      ( 0 ),
-                bModified   ( false ),
-                mnMaxRow    (-1),
-                mnMaxCol    (-1)
+                bModified   ( false )
 {
     if (!rSymbol.isEmpty())
     {
@@ -94,9 +92,7 @@ ScRangeData::ScRangeData( ScDocument* pDok,
                 pDoc        ( pDok ),
                 eTempGrammar( FormulaGrammar::GRAM_UNSPECIFIED ),
                 nIndex      ( 0 ),
-                bModified   ( false ),
-                mnMaxRow    (-1),
-                mnMaxCol    (-1)
+                bModified   ( false )
 {
     pCode->SetFromRangeName(true);
     InitCode();
@@ -113,9 +109,7 @@ ScRangeData::ScRangeData( ScDocument* pDok,
                 pDoc        ( pDok ),
                 eTempGrammar( FormulaGrammar::GRAM_UNSPECIFIED ),
                 nIndex      ( 0 ),
-                bModified   ( false ),
-                mnMaxRow    (-1),
-                mnMaxCol    (-1)
+                bModified   ( false )
 {
     ScSingleRefData aRefData;
     aRefData.InitAddress( rTarget );
@@ -137,9 +131,7 @@ ScRangeData::ScRangeData(const ScRangeData& rScRangeData, ScDocument* pDocument,
     pDoc        (pDocument ? pDocument : rScRangeData.pDoc),
     eTempGrammar(rScRangeData.eTempGrammar),
     nIndex      (rScRangeData.nIndex),
-    bModified   (rScRangeData.bModified),
-    mnMaxRow    (rScRangeData.mnMaxRow),
-    mnMaxCol    (rScRangeData.mnMaxCol)
+    bModified   (rScRangeData.bModified)
 {
     pCode->SetFromRangeName(true);
 }
@@ -270,7 +262,7 @@ void ScRangeData::UpdateSymbol( OUStringBuffer& rBuffer, const ScAddress& rPos )
 {
     std::unique_ptr<ScTokenArray> pTemp( pCode->Clone() );
     ScCompiler aComp( pDoc, rPos, *pTemp.get(), formula::FormulaGrammar::GRAM_DEFAULT);
-    aComp.MoveRelWrap(GetMaxCol(), GetMaxRow());
+    aComp.MoveRelWrap(MAXCOL, MAXROW);
     aComp.CreateStringFromTokenArray( rBuffer );
 }
 
@@ -505,16 +497,6 @@ ScRangeData::IsNameValidType ScRangeData::IsNameValid( const OUString& rName, co
     return NAME_VALID;
 }
 
-SCROW ScRangeData::GetMaxRow() const
-{
-    return mnMaxRow >= 0 ? mnMaxRow : MAXROW;
-}
-
-SCCOL ScRangeData::GetMaxCol() const
-{
-    return mnMaxCol >= 0 ? mnMaxCol : MAXCOL;
-}
-
 FormulaError ScRangeData::GetErrCode() const
 {
     return pCode ? pCode->GetCodeError() : FormulaError::NONE;
diff --git a/sc/source/filter/inc/sheetdatabuffer.hxx b/sc/source/filter/inc/sheetdatabuffer.hxx
index a54b40b89577..1cd4b1db7488 100644
--- a/sc/source/filter/inc/sheetdatabuffer.hxx
+++ b/sc/source/filter/inc/sheetdatabuffer.hxx
@@ -86,7 +86,7 @@ private:
     typedef ::std::map< sal_Int32, ValueRangeVector >   ColSpanVectorMap;
 
     ColSpanVectorMap    maColSpans;             /// Buffered column spans, mapped by row index.
-    sal_Int32 const     mnCurrRow;              /// Current row index used for buffered cell import.
+    sal_Int32           mnCurrRow;              /// Current row index used for buffered cell import.
 };
 
 /** Manages the cell contents and cell formatting of a sheet.
diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx b/sc/source/filter/oox/sheetdatabuffer.cxx
index cdd4d8ce6e07..5546d98d6037 100644
--- a/sc/source/filter/oox/sheetdatabuffer.cxx
+++ b/sc/source/filter/oox/sheetdatabuffer.cxx
@@ -105,7 +105,10 @@ void CellBlockBuffer::setColSpans( sal_Int32 nRow, const ValueRangeSet& rColSpan
     OSL_ENSURE( maColSpans.count( nRow ) == 0, "CellBlockBuffer::setColSpans - multiple column spans for the same row" );
     OSL_ENSURE( (mnCurrRow < nRow) && (maColSpans.empty() || (maColSpans.rbegin()->first < nRow)), "CellBlockBuffer::setColSpans - rows are unsorted" );
     if( (mnCurrRow < nRow) && (maColSpans.count( nRow ) == 0) )
+    {
         maColSpans[ nRow ] = rColSpans.getRanges();
+        mnCurrRow = nRow;
+    }
 }
 
 SheetDataBuffer::SheetDataBuffer( const WorksheetHelper& rHelper ) :
diff --git a/sc/source/filter/xml/cachedattraccess.cxx b/sc/source/filter/xml/cachedattraccess.cxx
index 55bc1675ac3e..b87fc014f3d9 100644
--- a/sc/source/filter/xml/cachedattraccess.cxx
+++ b/sc/source/filter/xml/cachedattraccess.cxx
@@ -28,6 +28,7 @@ bool ScXMLCachedRowAttrAccess::rowHidden(sal_Int32 nTab, sal_Int32 nRow, sal_Int
         SCROW nRow1, nRow2;
         maHidden.mbValue = mpDoc->RowHidden(
             static_cast<SCROW>(nRow), static_cast<SCTAB>(nTab), &nRow1, &nRow2);
+        maHidden.mnTab = nTab;
         maHidden.mnRow1 = static_cast<sal_Int32>(nRow1);
         maHidden.mnRow2 = static_cast<sal_Int32>(nRow2);
     }
@@ -43,6 +44,7 @@ bool ScXMLCachedRowAttrAccess::rowFiltered(sal_Int32 nTab, sal_Int32 nRow, sal_I
         SCROW nRow1, nRow2;
         maFiltered.mbValue = mpDoc->RowFiltered(
             static_cast<SCROW>(nRow), static_cast<SCTAB>(nTab), &nRow1, &nRow2);
+        maFiltered.mnTab = nTab;
         maFiltered.mnRow1 = static_cast<sal_Int32>(nRow1);
         maFiltered.mnRow2 = static_cast<sal_Int32>(nRow2);
     }
diff --git a/sc/source/filter/xml/cachedattraccess.hxx b/sc/source/filter/xml/cachedattraccess.hxx
index 6dbe4e4f1aa5..a3a55fea919a 100644
--- a/sc/source/filter/xml/cachedattraccess.hxx
+++ b/sc/source/filter/xml/cachedattraccess.hxx
@@ -23,7 +23,7 @@ class ScXMLCachedRowAttrAccess
 {
     struct Cache
     {
-        sal_Int32 const   mnTab;
+        sal_Int32   mnTab;
         sal_Int32   mnRow1;
         sal_Int32   mnRow2;
         bool        mbValue;
diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx
index c32b1788c201..7a4013469ae3 100644
--- a/sd/source/ui/animations/CustomAnimationPane.cxx
+++ b/sd/source/ui/animations/CustomAnimationPane.cxx
@@ -130,7 +130,6 @@ CustomAnimationPane::CustomAnimationPane( Window* pParent, ViewShellBase& rBase,
     mrBase( rBase ),
     mpCustomAnimationPresets(nullptr),
     mnPropertyType( nPropertyTypeNone ),
-    mnMotionPathPos( 3 ),
     mnCurvePathPos( LISTBOX_ENTRY_NOTFOUND ),
     mnPolygonPathPos( LISTBOX_ENTRY_NOTFOUND ),
     mnFreeformPathPos( LISTBOX_ENTRY_NOTFOUND ),
@@ -147,7 +146,6 @@ CustomAnimationPane::CustomAnimationPane( Window* pParent, ViewShellBase& rBase,
     mrBase( rBase ),
     mpCustomAnimationPresets(nullptr),
     mnPropertyType( nPropertyTypeNone ),
-    mnMotionPathPos( 3 ),
     mnCurvePathPos( LISTBOX_ENTRY_NOTFOUND ),
     mnPolygonPathPos( LISTBOX_ENTRY_NOTFOUND ),
     mnFreeformPathPos( LISTBOX_ENTRY_NOTFOUND ),
@@ -2010,7 +2008,7 @@ PathKind CustomAnimationPane::getCreatePathKind() const
     PathKind eKind = PathKind::NONE;
 
     if( ( mpLBAnimation->GetSelectedEntryCount() == 1 ) &&
-        ( mpLBCategory->GetSelectedEntryPos() == mnMotionPathPos ) )
+        ( mpLBCategory->GetSelectedEntryPos() == gnMotionPathPos ) )
     {
         const sal_Int32 nPos = mpLBAnimation->GetSelectedEntryPos();
         if( nPos == mnCurvePathPos )
@@ -2237,7 +2235,7 @@ sal_uInt32 CustomAnimationPane::fillAnimationLB( bool bHasText )
     const PresetCategoryList::const_iterator aCategoryEnd( rCategoryList.end() );
     mpLBAnimation->Clear();
 
-    if(nPosition == mnMotionPathPos)
+    if(nPosition == gnMotionPathPos)
     {
         OUString sMotionPathLabel( SdResId( STR_CUSTOMANIMATION_USERPATH ) );
         mpLBAnimation->InsertCategory( sMotionPathLabel );
diff --git a/sd/source/ui/animations/CustomAnimationPane.hxx b/sd/source/ui/animations/CustomAnimationPane.hxx
index 1c8bd070c784..f13b0cb7c0a2 100644
--- a/sd/source/ui/animations/CustomAnimationPane.hxx
+++ b/sd/source/ui/animations/CustomAnimationPane.hxx
@@ -163,7 +163,7 @@ private:
     OUString    maStrProperty;
 
     sal_Int32   mnPropertyType;
-    sal_Int32 const mnMotionPathPos;
+    static sal_Int32 const gnMotionPathPos = 3;
     sal_Int32   mnCurvePathPos;
     sal_Int32   mnPolygonPathPos;
     sal_Int32   mnFreeformPathPos;
diff --git a/sd/source/ui/sidebar/PreviewValueSet.cxx b/sd/source/ui/sidebar/PreviewValueSet.cxx
index 429411e5a754..a68144bc1b51 100644
--- a/sd/source/ui/sidebar/PreviewValueSet.cxx
+++ b/sd/source/ui/sidebar/PreviewValueSet.cxx
@@ -27,8 +27,7 @@ static const int gnBorderHeight(3);
 
 PreviewValueSet::PreviewValueSet (vcl::Window* pParent)
     : ValueSet (pParent, WB_TABSTOP),
-      maPreviewSize(10,10),
-      mnMaxColumnCount(-1)
+      maPreviewSize(10,10)
 {
     SetStyle (
         GetStyle()
@@ -92,8 +91,6 @@ sal_uInt16 PreviewValueSet::CalculateColumnCount (int nWidth) const
         nColumnCount = nWidth / (maPreviewSize.Width() + 2*gnBorderWidth);
         if (nColumnCount < 1)
             nColumnCount = 1;
-        else if (mnMaxColumnCount>0 && nColumnCount>mnMaxColumnCount)
-            nColumnCount = mnMaxColumnCount;
     }
     return static_cast<sal_uInt16>(nColumnCount);
 }
diff --git a/sd/source/ui/sidebar/PreviewValueSet.hxx b/sd/source/ui/sidebar/PreviewValueSet.hxx
index 8cf4c17b9d7f..dcc326e4005a 100644
--- a/sd/source/ui/sidebar/PreviewValueSet.hxx
+++ b/sd/source/ui/sidebar/PreviewValueSet.hxx
@@ -51,7 +51,6 @@ protected:
 private:
     Link<const MouseEvent&,void> maRightMouseClickHandler;
     Size maPreviewSize;
-    const int mnMaxColumnCount;
 
     sal_uInt16 CalculateColumnCount (int nWidth) const;
     sal_uInt16 CalculateRowCount (sal_uInt16 nColumnCount) const;
diff --git a/sd/source/ui/slidesorter/view/SlsLayouter.cxx b/sd/source/ui/slidesorter/view/SlsLayouter.cxx
index f25589dfb917..d2bb1c9ca73d 100644
--- a/sd/source/ui/slidesorter/view/SlsLayouter.cxx
+++ b/sd/source/ui/slidesorter/view/SlsLayouter.cxx
@@ -38,8 +38,8 @@ public:
     sal_Int32 mnRightBorder;
     sal_Int32 mnTopBorder;
     sal_Int32 mnBottomBorder;
-    sal_Int32 const mnVerticalGap;
-    sal_Int32 const mnHorizontalGap;
+    static const sal_Int32 gnVerticalGap = (10 - 2*Theme_FocusIndicatorWidth);
+    static const sal_Int32 gnHorizontalGap = (10 - 2*Theme_FocusIndicatorWidth);
     Size const maMinimalSize;
     Size const maPreferredSize;
     Size const maMaximalSize;
@@ -429,8 +429,6 @@ Layouter::Implementation::Implementation (
       mnRightBorder(5),
       mnTopBorder(5),
       mnBottomBorder(5),
-      mnVerticalGap (10 - 2*Theme_FocusIndicatorWidth),
-      mnHorizontalGap(10 - 2*Theme_FocusIndicatorWidth),
       maMinimalSize(132,98),
       maPreferredSize(200,150),
       maMaximalSize(600,400),
@@ -453,8 +451,6 @@ Layouter::Implementation::Implementation (const Implementation& rImplementation)
       mnRightBorder(rImplementation.mnRightBorder),
       mnTopBorder(rImplementation.mnTopBorder),
       mnBottomBorder(rImplementation.mnBottomBorder),
-      mnVerticalGap(rImplementation.mnVerticalGap),
-      mnHorizontalGap(rImplementation.mnHorizontalGap),
       maMinimalSize(rImplementation.maMinimalSize),
       maPreferredSize(rImplementation.maPreferredSize),
       maMaximalSize(rImplementation.maMaximalSize),
@@ -497,7 +493,7 @@ bool Layouter::Implementation::Rearrange (
     mnBottomBorder = mnRequestedBottomBorder;
     if (mnColumnCount > 1)
     {
-        int nMinimumBorderWidth = mnHorizontalGap/2;
+        int nMinimumBorderWidth = gnHorizontalGap/2;
         if (mnLeftBorder < nMinimumBorderWidth)
             mnLeftBorder = nMinimumBorderWidth;
         if (mnRightBorder < nMinimumBorderWidth)
@@ -505,7 +501,7 @@ bool Layouter::Implementation::Rearrange (
     }
     else
     {
-        int nMinimumBorderHeight = mnVerticalGap/2;
+        int nMinimumBorderHeight = gnVerticalGap/2;
         if (mnTopBorder < nMinimumBorderHeight)
             mnTopBorder = nMinimumBorderHeight;
         if (mnBottomBorder < nMinimumBorderHeight)
@@ -537,7 +533,7 @@ sal_Int32 Layouter::Implementation::GetRowAtPosition (
     if (nY >= 0)
     {
         // Vertical distance from one row to the next.
-        const sal_Int32 nRowOffset (maPageObjectSize.Height() + mnVerticalGap);
+        const sal_Int32 nRowOffset (maPageObjectSize.Height() + gnVerticalGap);
 
         // Calculate row consisting of page objects and gap below.
         nRow = nY / nRowOffset;
@@ -551,7 +547,7 @@ sal_Int32 Layouter::Implementation::GetRowAtPosition (
                 nDistanceIntoGap,
                 eGapMembership,
                 nRow,
-                mnVerticalGap);
+                gnVerticalGap);
             if (!bIncludeBordersAndGaps || nResolvedRow != -1)
                 nRow = nResolvedRow;
         }
@@ -577,7 +573,7 @@ sal_Int32 Layouter::Implementation::GetColumnAtPosition (
     if (nX >= 0)
     {
         // Horizontal distance from one column to the next.
-        const sal_Int32 nColumnOffset (maPageObjectSize.Width() + mnHorizontalGap);
+        const sal_Int32 nColumnOffset (maPageObjectSize.Width() + gnHorizontalGap);
 
         // Calculate row consisting of page objects and gap below.
         nColumn = nX / nColumnOffset;
@@ -595,7 +591,7 @@ sal_Int32 Layouter::Implementation::GetColumnAtPosition (
                 nDistanceIntoGap,
                 eGapMembership,
                 nColumn,
-                mnHorizontalGap);
+                gnHorizontalGap);
             if (!bIncludeBordersAndGaps || nResolvedColumn != -1)
                 nColumn = nResolvedColumn;
         }
@@ -843,12 +839,12 @@ Size Layouter::Implementation::GetTargetSize (
     if (bCalculateWidth)
         aTargetSize.setWidth(
             (rWindowSize.Width() - mnLeftBorder - mnRightBorder
-                - (mnColumnCount-1) * mnHorizontalGap)
+                - (mnColumnCount-1) * gnHorizontalGap)
                     / mnColumnCount);
     else if (bCalculateHeight)
         aTargetSize.setHeight(
             (rWindowSize.Height() - mnTopBorder - mnBottomBorder
-                - (mnRowCount-1) * mnVerticalGap)
+                - (mnRowCount-1) * gnVerticalGap)
                     / mnRowCount);
 
     if (bCalculateWidth)
@@ -912,10 +908,10 @@ sal_Int32 Layouter::Implementation::GetIndex (
     return ::tools::Rectangle(
         Point (mnLeftBorder
             + nColumn * maPageObjectSize.Width()
-            + std::max<sal_Int32>(nColumn,0) * mnHorizontalGap,
+            + std::max<sal_Int32>(nColumn,0) * gnHorizontalGap,
             mnTopBorder
             + nRow * maPageObjectSize.Height()
-            + std::max<sal_Int32>(nRow,0) * mnVerticalGap),
+            + std::max<sal_Int32>(nRow,0) * gnVerticalGap),
         maPageObjectSize);
 }
 
@@ -929,19 +925,19 @@ sal_Int32 Layouter::Implementation::GetIndex (
     if (nColumn == 0)
         aBoundingBox.SetLeft( 0 );
     else
-        aBoundingBox.AdjustLeft( -(mnHorizontalGap/2) );
+        aBoundingBox.AdjustLeft( -(gnHorizontalGap/2) );
     if (nColumn == mnColumnCount-1)
         aBoundingBox.AdjustRight(mnRightBorder );
     else
-        aBoundingBox.AdjustRight(mnHorizontalGap/2 );
+        aBoundingBox.AdjustRight(gnHorizontalGap/2 );
     if (nRow == 0)
         aBoundingBox.SetTop( 0 );
     else
-        aBoundingBox.AdjustTop( -(mnVerticalGap/2) );
+        aBoundingBox.AdjustTop( -(gnVerticalGap/2) );
     if (nRow == mnRowCount-1)
         aBoundingBox.AdjustBottom(mnBottomBorder );
     else
-        aBoundingBox.AdjustBottom(mnVerticalGap/2 );
+        aBoundingBox.AdjustBottom(gnVerticalGap/2 );
     return aBoundingBox;
 }
 
@@ -957,13 +953,13 @@ sal_Int32 Layouter::Implementation::GetIndex (
             + mnRightBorder
             + mnColumnCount * maPageObjectSize.Width();
         if (mnColumnCount > 1)
-            nHorizontalSize +=  (mnColumnCount-1) * mnHorizontalGap;
+            nHorizontalSize +=  (mnColumnCount-1) * gnHorizontalGap;
         nVerticalSize =
             mnTopBorder
             + mnBottomBorder
             + nRowCount * maPageObjectSize.Height();
         if (nRowCount > 1)
-            nVerticalSize += (nRowCount-1) * mnVerticalGap;
+            nVerticalSize += (nRowCount-1) * gnVerticalGap;
     }
 
     return ::tools::Rectangle (
@@ -977,7 +973,7 @@ void Layouter::Implementation::CalculateVerticalLogicalInsertPosition (
     InsertPosition& rPosition) const
 {
     const sal_Int32 nY = rModelPosition.Y() - mnTopBorder + maPageObjectSize.Height()/2;
-    const sal_Int32 nRowHeight (maPageObjectSize.Height() + mnVerticalGap);
+    const sal_Int32 nRowHeight (maPageObjectSize.Height() + gnVerticalGap);
     const sal_Int32 nRow (::std::min(mnPageCount, nY / nRowHeight));
     rPosition.SetLogicalPosition (
         nRow,
@@ -1010,7 +1006,7 @@ void HorizontalImplementation::CalculateRowAndColumnCount (const Size&)
 void HorizontalImplementation::CalculateMaxRowAndColumnCount (const Size& rWindowSize)
 {
     mnMaxColumnCount = (rWindowSize.Width() - mnLeftBorder - mnRightBorder)
-        / (maPageObjectSize.Width()  + mnHorizontalGap);
+        / (maPageObjectSize.Width()  + gnHorizontalGap);
     mnMaxRowCount = 1;
 }
 
@@ -1025,7 +1021,7 @@ void HorizontalImplementation::CalculateLogicalInsertPosition (
     InsertPosition& rPosition) const
 {
     const sal_Int32 nX = rModelPosition.X() - mnLeftBorder + maPageObjectSize.Width()/2;
-    const sal_Int32 nColumnWidth (maPageObjectSize.Width() + mnHorizontalGap);
+    const sal_Int32 nColumnWidth (maPageObjectSize.Width() + gnHorizontalGap);
     const sal_Int32 nColumn (::std::min(mnPageCount, nX / nColumnWidth));
     rPosition.SetLogicalPosition (
         0,
@@ -1059,7 +1055,7 @@ void VerticalImplementation::CalculateRowAndColumnCount (const Size&)
 void VerticalImplementation::CalculateMaxRowAndColumnCount (const Size& rWindowSize)
 {
     mnMaxRowCount = (rWindowSize.Height() - mnTopBorder - mnBottomBorder)
-        / (maPageObjectSize.Height()  + mnVerticalGap);
+        / (maPageObjectSize.Height()  + gnVerticalGap);
     mnMaxColumnCount = 1;
 }
 
@@ -1100,7 +1096,7 @@ void GridImplementation::CalculateRowAndColumnCount (const Size& rWindowSize)
     // Calculate the column count.
     mnColumnCount
         = (rWindowSize.Width() - mnRequestedLeftBorder - mnRequestedRightBorder)
-        / (maPreferredSize.Width()  + mnHorizontalGap);
+        / (maPreferredSize.Width()  + gnHorizontalGap);
     if (mnColumnCount < mnMinimalColumnCount)
         mnColumnCount = mnMinimalColumnCount;
     if (mnColumnCount > mnMaximalColumnCount)
@@ -1111,9 +1107,9 @@ void GridImplementation::CalculateRowAndColumnCount (const Size& rWindowSize)
 void GridImplementation::CalculateMaxRowAndColumnCount (const Size& rWindowSize)
 {
     mnMaxColumnCount = (rWindowSize.Width() - mnLeftBorder - mnRightBorder)
-        / (maPageObjectSize.Width()  + mnHorizontalGap);
+        / (maPageObjectSize.Width()  + gnHorizontalGap);
     mnMaxRowCount = (rWindowSize.Height() - mnTopBorder - mnBottomBorder)
-        / (maPageObjectSize.Height()  + mnVerticalGap);
+        / (maPageObjectSize.Height()  + gnVerticalGap);
 }
 
 Size GridImplementation::CalculateTargetSize (
@@ -1137,7 +1133,7 @@ void GridImplementation::CalculateLogicalInsertPosition (
             mnRowCount-1,
             GetRowAtPosition (rModelPosition.Y(), true, GM_BOTH)));
         const sal_Int32 nX = rModelPosition.X() - mnLeftBorder + maPageObjectSize.Width()/2;
-        const sal_Int32 nColumnWidth (maPageObjectSize.Width() + mnHorizontalGap);
+        const sal_Int32 nColumnWidth (maPageObjectSize.Width() + gnHorizontalGap);
         sal_Int32 nColumn (::std::min(mnColumnCount, nX / nColumnWidth));
         sal_Int32 nIndex (nRow * mnColumnCount + nColumn);
         bool bIsAtRunEnd (nColumn == mnColumnCount);
diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx
index 01f20ba9734b..aac778b6f29e 100644
--- a/sfx2/source/doc/doctemplates.cxx
+++ b/sfx2/source/doc/doctemplates.cxx
@@ -135,7 +135,7 @@ class WaitWindow_Impl : public WorkWindow
 {
     tools::Rectangle     maRect;
     OUString      maText;
-    const DrawTextFlags mnTextStyle = DrawTextFlags::Center | DrawTextFlags::VCenter | DrawTextFlags::WordBreak | DrawTextFlags::MultiLine;
+    static constexpr DrawTextFlags gnTextStyle = DrawTextFlags::Center | DrawTextFlags::VCenter | DrawTextFlags::WordBreak | DrawTextFlags::MultiLine;
 
 public:
     WaitWindow_Impl();
@@ -2283,7 +2283,7 @@ WaitWindow_Impl::WaitWindow_Impl() : WorkWindow(nullptr, WB_BORDER | WB_3DLOOK)
 {
     tools::Rectangle aRect = tools::Rectangle(0, 0, 300, 30000);
     maText = SfxResId(RID_CNT_STR_WAITING);
-    maRect = GetTextRect(aRect, maText, mnTextStyle);
+    maRect = GetTextRect(aRect, maText, gnTextStyle);
     aRect = maRect;
     aRect.AdjustRight(2 * X_OFFSET );
     aRect.AdjustBottom(2 * Y_OFFSET );
@@ -2310,7 +2310,7 @@ void  WaitWindow_Impl::dispose()
 
 void WaitWindow_Impl::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*rRect*/)
 {
-    rRenderContext.DrawText(maRect, maText, mnTextStyle);
+    rRenderContext.DrawText(maRect, maText, gnTextStyle);
 }
 
 void SfxDocTplService_Impl::addHierGroup( GroupList_Impl& rList,
diff --git a/svtools/source/svrtf/svparser.cxx b/svtools/source/svrtf/svparser.cxx
index 32d64bc5b9dc..0b2164ce923d 100644
--- a/svtools/source/svrtf/svparser.cxx
+++ b/svtools/source/svrtf/svparser.cxx
@@ -598,7 +598,7 @@ void SvParser<T>::Continue( T )
 }
 
 void BuildWhichTable( std::vector<sal_uInt16> &rWhichMap,
-                      sal_uInt16 *pWhichIds,
+                      sal_uInt16 const *pWhichIds,
                       sal_uInt16 nWhichIds )
 {
     sal_uInt16 aNewRange[2];
diff --git a/svx/source/dialog/ClassificationDialog.cxx b/svx/source/dialog/ClassificationDialog.cxx
index b9040fbb981b..db5d4f29e22e 100644
--- a/svx/source/dialog/ClassificationDialog.cxx
+++ b/svx/source/dialog/ClassificationDialog.cxx
@@ -167,7 +167,6 @@ ClassificationDialog::ClassificationDialog(vcl::Window* pParent, const bool bPer
     , m_bPerParagraph(bPerParagraph)
     , m_aParagraphSignHandler(rParagraphSignHandler)
     , m_nCurrentSelectedCategory(-1)
-    , m_nInsertMarkings(-1)
 {
     get(m_pOkButton, "ok");
     get(m_pEditWindow, "classificationEditWindow");
diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx
index 4dd99ec9b3e3..5c739744c285 100644
--- a/svx/source/svdraw/svdpdf.cxx
+++ b/svx/source/svdraw/svdpdf.cxx
@@ -125,7 +125,6 @@ ImpSdrPdfImport::ImpSdrPdfImport(SdrModel& rModel, SdrLayerID nLay, const tools:
     , mnLayer(nLay)
     , maOldLineColor()
     , mnLineWidth(0)
-    , maLineCap(css::drawing::LineCap_BUTT)
     , maDash(css::drawing::DashStyle_RECT, 0, 0, 0, 0, 0)
     , mbMov(false)
     , mbSize(false)
@@ -386,7 +385,7 @@ void ImpSdrPdfImport::SetAttributes(SdrObject* pObj, bool bForceTextAttr)
         mpLineAttr->Put(XLineJointItem(css::drawing::LineJoint_NONE));
 
         // Add LineCap support
-        mpLineAttr->Put(XLineCapItem(maLineCap));
+        mpLineAttr->Put(XLineCapItem(gaLineCap));
 
         if (((maDash.GetDots() && maDash.GetDotLen())
              || (maDash.GetDashes() && maDash.GetDashLen()))
diff --git a/svx/source/svdraw/svdpdf.hxx b/svx/source/svdraw/svdpdf.hxx
index 462b8f6451bb..fac2847e953e 100644
--- a/svx/source/svdraw/svdpdf.hxx
+++ b/svx/source/svdraw/svdpdf.hxx
@@ -170,7 +170,7 @@ class ImpSdrPdfImport final
     SdrLayerID const mnLayer;
     Color maOldLineColor;
     sal_Int32 mnLineWidth;
-    css::drawing::LineCap const maLineCap;
+    static constexpr css::drawing::LineCap gaLineCap = css::drawing::LineCap_BUTT;
     XDash const maDash;
 
     bool mbMov;
diff --git a/svx/source/tbxctrls/colrctrl.cxx b/svx/source/tbxctrls/colrctrl.cxx
index 34e403b7cf11..c7bc43f67f23 100644
--- a/svx/source/tbxctrls/colrctrl.cxx
+++ b/svx/source/tbxctrls/colrctrl.cxx
@@ -168,6 +168,9 @@ IMPL_LINK_NOARG(SvxColorValueSet_docking, ExecDragHdl, void*, void)
     DoDrag();
 }
 
+static constexpr sal_uInt16 gnLeftSlot = SID_ATTR_FILL_COLOR;
+static constexpr sal_uInt16 gnRightSlot = SID_ATTR_LINE_COLOR;
+
 SvxColorDockingWindow::SvxColorDockingWindow
 (
     SfxBindings* _pBindings,
@@ -178,8 +181,6 @@ SvxColorDockingWindow::SvxColorDockingWindow
     SfxDockingWindow( _pBindings, pCW, _pParent, WB_MOVEABLE|WB_CLOSEABLE|WB_SIZEABLE|WB_DOCKABLE ),
     pColorList      (),
     aColorSet       ( VclPtr<SvxColorValueSet_docking>::Create(this) ),
-    nLeftSlot       ( SID_ATTR_FILL_COLOR ),
-    nRightSlot      ( SID_ATTR_LINE_COLOR ),
     nCols           ( 20 ),
     nLines          ( 1 ),
     nCount          ( 0 )
@@ -343,12 +344,12 @@ IMPL_LINK_NOARG(SvxColorDockingWindow, SelectHdl, ValueSet*, void)
 
     if (aColorSet->IsLeftButton())
     {
-        if ( nLeftSlot == SID_ATTR_FILL_COLOR )
+        if ( gnLeftSlot == SID_ATTR_FILL_COLOR )
         {
             if ( nPos == 1 )        // invisible
             {
                 XFillStyleItem aXFillStyleItem( drawing::FillStyle_NONE );
-                pDispatcher->ExecuteList(nLeftSlot, SfxCallMode::RECORD,
+                pDispatcher->ExecuteList(gnLeftSlot, SfxCallMode::RECORD,
                         { &aXFillStyleItem });
             }
             else
@@ -373,26 +374,26 @@ IMPL_LINK_NOARG(SvxColorDockingWindow, SelectHdl, ValueSet*, void)
                 {
                     XFillStyleItem aXFillStyleItem( drawing::FillStyle_SOLID );
                     XFillColorItem aXFillColorItem( aStr, aColor );
-                    pDispatcher->ExecuteList(nLeftSlot, SfxCallMode::RECORD,
+                    pDispatcher->ExecuteList(gnLeftSlot, SfxCallMode::RECORD,
                             { &aXFillColorItem, &aXFillStyleItem });
                 }
             }
         }
         else if ( nPos != 1 )       // invisible
         {
-            SvxColorItem aLeftColorItem( aColor, nLeftSlot );
-            pDispatcher->ExecuteList(nLeftSlot, SfxCallMode::RECORD,
+            SvxColorItem aLeftColorItem( aColor, gnLeftSlot );
+            pDispatcher->ExecuteList(gnLeftSlot, SfxCallMode::RECORD,
                     { &aLeftColorItem });
         }
     }
     else
     {
-        if ( nRightSlot == SID_ATTR_LINE_COLOR )
+        if ( gnRightSlot == SID_ATTR_LINE_COLOR )
         {
             if( nPos == 1 )     // invisible
             {
                 XLineStyleItem aXLineStyleItem( drawing::LineStyle_NONE );
-                pDispatcher->ExecuteList(nRightSlot, SfxCallMode::RECORD,
+                pDispatcher->ExecuteList(gnRightSlot, SfxCallMode::RECORD,
                         { &aXLineStyleItem });
             }
             else
@@ -413,7 +414,7 @@ IMPL_LINK_NOARG(SvxColorDockingWindow, SelectHdl, ValueSet*, void)
                             if ( eXLS == drawing::LineStyle_NONE )
                             {
                                 XLineStyleItem aXLineStyleItem( drawing::LineStyle_SOLID );
-                                pDispatcher->ExecuteList(nRightSlot,
+                                pDispatcher->ExecuteList(gnRightSlot,
                                     SfxCallMode::RECORD, { &aXLineStyleItem });
                             }
                         }
@@ -421,14 +422,14 @@ IMPL_LINK_NOARG(SvxColorDockingWindow, SelectHdl, ValueSet*, void)
                 }
 
                 XLineColorItem aXLineColorItem( aStr, aColor );
-                pDispatcher->ExecuteList(nRightSlot, SfxCallMode::RECORD,
+                pDispatcher->ExecuteList(gnRightSlot, SfxCallMode::RECORD,
                         { &aXLineColorItem });
             }
         }
         else if ( nPos != 1 )       // invisible
         {
-            SvxColorItem aRightColorItem( aColor, nRightSlot );
-            pDispatcher->ExecuteList(nRightSlot, SfxCallMode::RECORD,
+            SvxColorItem aRightColorItem( aColor, gnRightSlot );
+            pDispatcher->ExecuteList(gnRightSlot, SfxCallMode::RECORD,
                     { &aRightColorItem });
         }
     }
diff --git a/sw/inc/pagepreviewlayout.hxx b/sw/inc/pagepreviewlayout.hxx
index 69e3de6fea54..538f711dc286 100644
--- a/sw/inc/pagepreviewlayout.hxx
+++ b/sw/inc/pagepreviewlayout.hxx
@@ -42,8 +42,8 @@ private:
     friend class SwViewShell;
 
     /// number of horizontal and vertical twips for spacing between the pages.
-    const SwTwips mnXFree;
-    const SwTwips mnYFree;
+    static constexpr SwTwips gnXFree = 4 * 142;
+    static constexpr SwTwips gnYFree = 4 * 142;
 
     /// view shell the print preview is generated for.
     SwViewShell& mrParentViewShell;
diff --git a/sw/source/core/view/pagepreviewlayout.cxx b/sw/source/core/view/pagepreviewlayout.cxx
index 9d102290b617..605e106105f0 100644
--- a/sw/source/core/view/pagepreviewlayout.cxx
+++ b/sw/source/core/view/pagepreviewlayout.cxx
@@ -45,9 +45,7 @@
 
 SwPagePreviewLayout::SwPagePreviewLayout( SwViewShell& _rParentViewShell,
                                           const SwRootFrame& _rLayoutRootFrame )
-    : mnXFree ( 4*142 ),
-      mnYFree ( 4*142 ),
-      mrParentViewShell( _rParentViewShell ),
+    : mrParentViewShell( _rParentViewShell ),
       mrLayoutRootFrame ( _rLayoutRootFrame )
 {
     Clear_();
@@ -137,12 +135,12 @@ void SwPagePreviewLayout::CalcPreviewLayoutSizes()
         pPage = static_cast<const SwPageFrame*>(pPage->GetNext());
     }
     // calculate and set column width and row height
-    mnColWidth = maMaxPageSize.Width() + mnXFree;
-    mnRowHeight = maMaxPageSize.Height() + mnYFree;
+    mnColWidth = maMaxPageSize.Width() + gnXFree;
+    mnRowHeight = maMaxPageSize.Height() + gnYFree;
 
     // calculate and set preview layout width and height
-    mnPreviewLayoutWidth = mnCols * mnColWidth + mnXFree;
-    mnPreviewLayoutHeight = mnRows * mnRowHeight + mnYFree;
+    mnPreviewLayoutWidth = mnCols * mnColWidth + gnXFree;
+    mnPreviewLayoutHeight = mnRows * mnRowHeight + gnYFree;
 
     // calculate document rectangle in preview layout
     {
@@ -155,7 +153,7 @@ void SwPagePreviewLayout::CalcPreviewLayoutSizes()
         // use method <GetRowOfPage(..)>.
         const sal_uInt16 nDocRows = GetRowOfPage( mnPages );
         aDocSize.setHeight( nDocRows * maMaxPageSize.Height() +
-                            (nDocRows+1) * mnYFree );
+                            (nDocRows+1) * gnYFree );
         maPreviewDocRect.SetPos( Point( 0, 0 ) );
         maPreviewDocRect.SetSize( aDocSize );
     }
@@ -396,9 +394,9 @@ bool SwPagePreviewLayout::Prepare( const sal_uInt16 _nProposedStartPageNum,
         mnPaintStartRow = nRowOfProposed;
         // page offset
         maPaintStartPageOffset.setX(
-                (rProposedStartPos.X() % mnColWidth) - mnXFree );
+                (rProposedStartPos.X() % mnColWidth) - gnXFree );
         maPaintStartPageOffset.setY(
-                (rProposedStartPos.Y() % mnRowHeight) - mnYFree );
+                (rProposedStartPos.Y() % mnRowHeight) - gnYFree );
         // virtual preview document offset.
         maPaintPreviewDocOffset = rProposedStartPos;
     }
@@ -543,13 +541,13 @@ void SwPagePreviewLayout::CalcPreviewPages()
         if ( maPaintStartPageOffset != Point( -1, -1 ) )
             aInitialPaintOffset = Point(0,0) - maPaintStartPageOffset;
         else
-            aInitialPaintOffset = Point( mnXFree, mnYFree );
+            aInitialPaintOffset = Point( gnXFree, gnYFree );
     }
     else {
         if ( maPaintStartPageOffset != Point( -1, -1 ) )
             aInitialPaintOffset = Point(0 + ((SwPagePreviewLayout::mnCols-1)*mnColWidth),0) - maPaintStartPageOffset;
         else
-            aInitialPaintOffset = Point( mnXFree + ((SwPagePreviewLayout::mnCols-1)*mnColWidth), mnYFree );
+            aInitialPaintOffset = Point( gnXFree + ((SwPagePreviewLayout::mnCols-1)*mnColWidth), gnYFree );
     }
     aInitialPaintOffset += maAdditionalPaintOffset;
 
@@ -927,7 +925,7 @@ SwTwips SwPagePreviewLayout::GetWinPagesScrollAmount(
     SwTwips nScrollAmount;
     if ( mbDoesLayoutRowsFitIntoWindow )
     {
-        nScrollAmount = (mnPreviewLayoutHeight - mnYFree) * _nWinPagesToScroll;
+        nScrollAmount = (mnPreviewLayoutHeight - gnYFree) * _nWinPagesToScroll;
     }
     else
         nScrollAmount = _nWinPagesToScroll * maPaintedPreviewDocRect.GetHeight();
@@ -948,7 +946,7 @@ SwTwips SwPagePreviewLayout::GetWinPagesScrollAmount(
         }
         else
         {
-            while ( (maPaintedPreviewDocRect.Top() + nScrollAmount + mnYFree) >= maPreviewDocRect.GetHeight() )
+            while ( (maPaintedPreviewDocRect.Top() + nScrollAmount + gnYFree) >= maPreviewDocRect.GetHeight() )
             {
                 nScrollAmount -= mnRowHeight;
             }
diff --git a/sw/source/filter/html/htmlcss1.cxx b/sw/source/filter/html/htmlcss1.cxx
index 36bbdbafce18..ded8ff86c16b 100644
--- a/sw/source/filter/html/htmlcss1.cxx
+++ b/sw/source/filter/html/htmlcss1.cxx
@@ -72,19 +72,12 @@ using namespace ::com::sun::star;
 static void lcl_swcss1_setEncoding( SwFormat& rFormat, rtl_TextEncoding eEnc );
 
 // Implementation of SwCSS1Parsers (actually swcss1.cxx)
-static struct SwCSS1ItemIds
+static const sal_uInt16 aItemIds[] =
 {
-    sal_uInt16 const nFormatBreak;
-    sal_uInt16 const nFormatPageDesc;
-    sal_uInt16 const nFormatKeep;
-
-    SwCSS1ItemIds() :
-        nFormatBreak( RES_BREAK ),
-        nFormatPageDesc( RES_PAGEDESC ),
-        nFormatKeep( RES_KEEP )
-    {}
-
-} aItemIds;
+    RES_BREAK,
+    RES_PAGEDESC,
+    RES_KEEP,
+};
 
 void SwCSS1Parser::ChgPageDesc( const SwPageDesc *pPageDesc,
                                 const SwPageDesc& rNewPageDesc )
@@ -98,7 +91,7 @@ void SwCSS1Parser::ChgPageDesc( const SwPageDesc *pPageDesc,
 
 SwCSS1Parser::SwCSS1Parser( SwDoc *pD, const sal_uInt32 aFHeights[7], const OUString& rBaseURL, bool bNewDoc ) :
     SvxCSS1Parser( pD->GetAttrPool(), rBaseURL,
-                   reinterpret_cast<sal_uInt16*>(&aItemIds), sizeof(aItemIds) / sizeof(sal_uInt16) ),
+                   aItemIds, SAL_N_ELEMENTS(aItemIds)),
     m_pDoc( pD ),
     m_nDropCapCnt( 0 ),
     m_bIsNewDoc( bNewDoc ),
diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx
index 10799d0c0887..07f1918ff6cd 100644
--- a/sw/source/filter/html/svxcss1.cxx
+++ b/sw/source/filter/html/svxcss1.cxx
@@ -705,12 +705,11 @@ bool SvxCSS1Parser::DeclarationParsed( const OUString& rProperty,
 }
 
 SvxCSS1Parser::SvxCSS1Parser( SfxItemPool& rPool, const OUString& rBaseURL,
-                              sal_uInt16 *pWhichIds, sal_uInt16 nWhichIds ) :
+                              sal_uInt16 const *pWhichIds, sal_uInt16 nWhichIds ) :
     CSS1Parser(),
     sBaseURL( rBaseURL ),
     pItemSet(nullptr),
     pPropInfo( nullptr ),
-    nMinFixLineSpace(  MM50/2 ),
     eDfltEnc( RTL_TEXTENCODING_DONTKNOW ),
     bIgnoreFontFamily( false )
 {
@@ -1595,7 +1594,7 @@ static void ParseCSS1_background_color( const CSS1Expression *pExpr,
 static void ParseCSS1_line_height( const CSS1Expression *pExpr,
                                    SfxItemSet &rItemSet,
                                    SvxCSS1PropertyInfo& /*rPropInfo*/,
-                                   const SvxCSS1Parser& rParser )
+                                   const SvxCSS1Parser& )
 {
     OSL_ENSURE( pExpr, "no expression" );
 
@@ -1635,8 +1634,8 @@ static void ParseCSS1_line_height( const CSS1Expression *pExpr,
 
     if( nHeight )
     {
-        if( nHeight < rParser.GetMinFixLineSpace() )
-            nHeight = rParser.GetMinFixLineSpace();
+        if( nHeight < SvxCSS1Parser::GetMinFixLineSpace() )
+            nHeight = SvxCSS1Parser::GetMinFixLineSpace();
         SvxLineSpacingItem aLSItem( nHeight, aItemIds.nLineSpacing );
         aLSItem.SetLineHeight( nHeight );
         // interpret <line-height> attribute as minimum line height
diff --git a/sw/source/filter/html/svxcss1.hxx b/sw/source/filter/html/svxcss1.hxx
index 97a314ffa341..2c1c70525146 100644
--- a/sw/source/filter/html/svxcss1.hxx
+++ b/sw/source/filter/html/svxcss1.hxx
@@ -199,7 +199,7 @@ class SvxCSS1Parser : public CSS1Parser
     std::unique_ptr<SvxCSS1PropertyInfo> pSheetPropInfo;
     SvxCSS1PropertyInfo *pPropInfo;
 
-    sal_uInt16 const nMinFixLineSpace;    // minimum spacing for fixed line spacing
+    static constexpr sal_uInt16 gnMinFixLineSpace = MM50/2;    // minimum spacing for fixed line spacing
 
     rtl_TextEncoding    eDfltEnc;
 
@@ -241,7 +241,7 @@ public:
 
     SvxCSS1Parser( SfxItemPool& rPool,
                     const OUString& rBaseURL,
-                   sal_uInt16 *pWhichIds, sal_uInt16 nWhichIds );
+                   sal_uInt16 const *pWhichIds, sal_uInt16 nWhichIds );
     virtual ~SvxCSS1Parser() override;
 
     bool IsIgnoreFontFamily() const { return bIgnoreFontFamily; }
@@ -298,7 +298,7 @@ public:
                       SvxCSS1PropertyInfo& rTargetInfo,
                       bool bSmart );
 
-    sal_uInt16 GetMinFixLineSpace() const { return nMinFixLineSpace; }
+    static sal_uInt16 GetMinFixLineSpace() { return gnMinFixLineSpace; }
 
     virtual void SetDfltEncoding( rtl_TextEncoding eEnc );
     rtl_TextEncoding GetDfltEncoding() const { return eDfltEnc; }
diff --git a/vcl/inc/octree.hxx b/vcl/inc/octree.hxx
index ae819d858872..cec8e4171494 100644
--- a/vcl/inc/octree.hxx
+++ b/vcl/inc/octree.hxx
@@ -95,7 +95,7 @@ private:
 
     std::unique_ptr<sal_uInt8[]> pBuffer;
     std::unique_ptr<sal_uInt8[]> pMap;
-    const sal_uLong             nBits;
+    static constexpr sal_uLong gnBits = 8 -OCTREE_BITS;
 
     SAL_DLLPRIVATE void ImplCreateBuffers( const sal_uLong nMax );
 
@@ -109,9 +109,9 @@ public:
 
 inline sal_uInt16 InverseColorMap::GetBestPaletteIndex( const BitmapColor& rColor )
 {
-    return pMap[ ( ( static_cast<sal_uLong>(rColor.GetRed()) >> nBits ) << OCTREE_BITS_1 ) |
-                 ( ( static_cast<sal_uLong>(rColor.GetGreen()) >> nBits ) << OCTREE_BITS ) |
-                 ( static_cast<sal_uLong>(rColor.GetBlue()) >> nBits ) ];
+    return pMap[ ( ( static_cast<sal_uLong>(rColor.GetRed()) >> gnBits ) << OCTREE_BITS_1 ) |
+                 ( ( static_cast<sal_uLong>(rColor.GetGreen()) >> gnBits ) << OCTREE_BITS ) |
+                 ( static_cast<sal_uLong>(rColor.GetBlue()) >> gnBits ) ];
 }
 
 #endif // INCLUDED_VCL_INC_OCTREE_HXX
diff --git a/vcl/source/filter/ipdf/pdfdocument.cxx b/vcl/source/filter/ipdf/pdfdocument.cxx
index 09cafdea9f45..092df7cfbee7 100644
--- a/vcl/source/filter/ipdf/pdfdocument.cxx
+++ b/vcl/source/filter/ipdf/pdfdocument.cxx
@@ -2274,8 +2274,9 @@ size_t PDFDictionaryElement::Parse(const std::vector<std::unique_ptr<PDFElement>
                     if (pThisDictionary)
                     {
                         pThisDictionary->SetKeyOffset(aName, nNameOffset);
-                        pThisDictionary->SetKeyValueLength(
-                            aName, pName->GetLocation() + pName->GetLength() - nNameOffset);
+                        pThisDictionary->SetKeyValueLength(aName, pName->GetLocation()
+                                                                      + PDFNameElement::GetLength()
+                                                                      - nNameOffset);
                     }
                     aName.clear();
                 }
@@ -2927,8 +2928,6 @@ const OString& PDFNameElement::GetValue() const { return m_aValue; }
 
 sal_uInt64 PDFNameElement::GetLocation() const { return m_nLocation; }
 
-sal_uInt64 PDFNameElement::GetLength() const { return m_nLength; }
-
 PDFStreamElement::PDFStreamElement(size_t nLength)
     : m_nLength(nLength)
     , m_nOffset(0)
diff --git a/vcl/source/gdi/octree.cxx b/vcl/source/gdi/octree.cxx
index 21af8416fee9..4635067901f8 100644
--- a/vcl/source/gdi/octree.cxx
+++ b/vcl/source/gdi/octree.cxx
@@ -232,14 +232,13 @@ void Octree::GetPalIndex( OctreeNode* pNode )
     }
 }
 
-InverseColorMap::InverseColorMap( const BitmapPalette& rPal ) :
-            nBits( 8 - OCTREE_BITS )
+InverseColorMap::InverseColorMap( const BitmapPalette& rPal )
 {
     const int     nColorMax = 1 << OCTREE_BITS;
-    const unsigned long xsqr = 1 << ( nBits << 1 );
+    const unsigned long xsqr = 1 << ( gnBits << 1 );
     const unsigned long xsqr2 = xsqr << 1;
     const int     nColors = rPal.GetEntryCount();
-    const long      x = 1 << nBits;
+    const long      x = 1 << gnBits;
     const long      x2 = x >> 1;
     sal_uLong           r, g, b;
     long            rxx, gxx, bxx;
@@ -258,9 +257,9 @@ InverseColorMap::InverseColorMap( const BitmapPalette& rPal ) :
         long bdist = cBlue - x2;
         rdist = rdist*rdist + gdist*gdist + bdist*bdist;
 
-        const long crinc = ( xsqr - ( cRed << nBits ) ) << 1;
-        const long cginc = ( xsqr - ( cGreen << nBits ) ) << 1;
-        const long cbinc = ( xsqr - ( cBlue << nBits ) ) << 1;
+        const long crinc = ( xsqr - ( cRed << gnBits ) ) << 1;
+        const long cginc = ( xsqr - ( cGreen << gnBits ) ) << 1;
+        const long cbinc = ( xsqr - ( cBlue << gnBits ) ) << 1;
 
         sal_uLong* cdp = reinterpret_cast<sal_uLong*>(pBuffer.get());
         sal_uInt8* crgbp = pMap.get();
diff --git a/vcl/unx/generic/print/bitmap_gfx.cxx b/vcl/unx/generic/print/bitmap_gfx.cxx
index 04ce1fd3ba96..613920aaed27 100644
--- a/vcl/unx/generic/print/bitmap_gfx.cxx
+++ b/vcl/unx/generic/print/bitmap_gfx.cxx
@@ -278,8 +278,8 @@ private:
                     mpTable;    // LZW compression data
     LZWCTreeNode*   mpPrefix;   // the compression is as same as the TIFF compression
     static constexpr sal_uInt16 gnDataSize = 8;
-    sal_uInt16 const mnClearCode;
-    sal_uInt16 const mnEOICode;
+    static constexpr sal_uInt16 gnClearCode = 1 << gnDataSize;
+    static constexpr sal_uInt16 gnEOICode = gnClearCode + 1;
     sal_uInt16      mnTableSize;
     sal_uInt16      mnCodeSize;
     sal_uInt32      mnOffset;
@@ -298,9 +298,7 @@ public:
 LZWEncoder::LZWEncoder(osl::File* pOutputFile) :
         Ascii85Encoder (pOutputFile),
         mpPrefix(nullptr),
-        mnClearCode(1 << gnDataSize),
-        mnEOICode(mnClearCode + 1),
-        mnTableSize(mnEOICode + 1),
+        mnTableSize(gnEOICode + 1),
         mnCodeSize(gnDataSize + 1),
         mnOffset(32),       // free bits in dwShift
         mdwShift(0)
@@ -313,7 +311,7 @@ LZWEncoder::LZWEncoder(osl::File* pOutputFile) :
         mpTable[i].mnValue      = static_cast<sal_uInt8>(mpTable[i].mnCode);
     }
 
-    WriteBits( mnClearCode, mnCodeSize );
+    WriteBits( gnClearCode, mnCodeSize );
 }
 
 LZWEncoder::~LZWEncoder()
@@ -321,7 +319,7 @@ LZWEncoder::~LZWEncoder()
     if (mpPrefix)
         WriteBits (mpPrefix->mnCode, mnCodeSize);
 
-    WriteBits (mnEOICode, mnCodeSize);
+    WriteBits (gnEOICode, mnCodeSize);
 }
 
 void
@@ -369,13 +367,13 @@ LZWEncoder::EncodeByte (sal_uInt8 nByte )
 
             if (mnTableSize == 409)
             {
-                WriteBits (mnClearCode, mnCodeSize);
+                WriteBits (gnClearCode, mnCodeSize);
 
-                for (i = 0; i < mnClearCode; i++)
+                for (i = 0; i < gnClearCode; i++)
                     mpTable[i].mpFirstChild = nullptr;
 
                 mnCodeSize = gnDataSize + 1;
-                mnTableSize = mnEOICode + 1;
+                mnTableSize = gnEOICode + 1;
             }
             else
             {
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index d0dbb8fd4463..f2f4761d5cea 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -198,7 +198,6 @@ public:
 
     sal_Int32 nContrast;
     sal_Int32 nBrightness;
-    double const    fGamma;
 
     static constexpr sal_Int32 nFillColor = 0xffffffff;
 
@@ -259,7 +258,6 @@ public:
         ,nShadowTransparence(0)
         ,nContrast(0)
         ,nBrightness(0)
-        ,fGamma( -1.0 )
         ,eColorMode( drawing::ColorMode_STANDARD )
         ,nCurrentBorderLine(BORDER_TOP)
         ,bIsGraphic(false)
@@ -1274,9 +1272,6 @@ uno::Reference<text::XTextContent> GraphicImport::createGraphicObject(uno::Refer
                 xGraphicObjectProperties->setPropertyValue(getPropertyName( PROP_GRAPHIC_COLOR_MODE ),
                     uno::makeAny(m_pImpl->eColorMode));
             }
-            if(m_pImpl->fGamma > 0. )
-                xGraphicObjectProperties->setPropertyValue(getPropertyName( PROP_GAMMA ),
-                    uno::makeAny(m_pImpl->fGamma ));
 
             xGraphicObjectProperties->setPropertyValue(getPropertyName( PROP_BACK_COLOR ),
                 uno::makeAny( GraphicImport_Impl::nFillColor ));
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx
index 9664c784a323..fb02feccd3cd 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -229,13 +229,6 @@ uno::Sequence< beans::PropertyValue > ListLevel::GetCharStyleProperties( )
 
 uno::Sequence<beans::PropertyValue> ListLevel::GetLevelProperties(bool bDefaults)
 {
-    const sal_Int16 aWWToUnoAdjust[] =
-    {
-        text::HoriOrientation::LEFT,
-        text::HoriOrientation::CENTER,
-        text::HoriOrientation::RIGHT,
-    };
-
     std::vector<beans::PropertyValue> aNumberingProperties;
 
     if( m_nIStartAt >= 0)
@@ -253,8 +246,6 @@ uno::Sequence<beans::PropertyValue> ListLevel::GetLevelProperties(bool bDefaults
         aNumberingProperties.push_back(lcl_makePropVal(PROP_NUMBERING_TYPE, nNumberFormat));
     }
 
-    if( m_nJC >= 0 && m_nJC <= sal::static_int_cast<sal_Int32>(SAL_N_ELEMENTS(aWWToUnoAdjust)) )
-        aNumberingProperties.push_back(lcl_makePropVal(PROP_ADJUST, aWWToUnoAdjust[m_nJC]));
 
     if( !isOutlineNumbering())
     {
diff --git a/writerfilter/source/dmapper/NumberingManager.hxx b/writerfilter/source/dmapper/NumberingManager.hxx
index c99379226311..4912414cad88 100644
--- a/writerfilter/source/dmapper/NumberingManager.hxx
+++ b/writerfilter/source/dmapper/NumberingManager.hxx
@@ -44,7 +44,6 @@ class ListLevel : public PropertyMap
 {
     sal_Int32                                     m_nIStartAt;       //LN_CT_Lvl_start
     sal_Int32                                     m_nNFC;            //LN_CT_Lvl_numFmt
-    sal_Int32 const                               m_nJC;             //LN_JC
     sal_Int16                                     m_nXChFollow;      //LN_IXCHFOLLOW
     OUString                               m_sBulletChar;
     css::awt::Size                         m_aGraphicSize;
@@ -61,7 +60,6 @@ public:
     ListLevel() :
         m_nIStartAt(-1)
         ,m_nNFC(-1)
-        ,m_nJC(-1)
         ,m_nXChFollow(SvxNumberFormat::LISTTAB)
         ,m_nTabstop( 0 )
         ,m_outline(false)
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index 4048080e03c5..ada5df34c839 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -385,8 +385,6 @@ SectionPropertyMap::SectionPropertyMap( bool bIsFirstSection )
     , m_nPageNumber( -1 )
     , m_nPageNumberType( -1 )
     , m_nBreakType( -1 )
-    , m_nPaperBin( -1 )
-    , m_nFirstPaperBin( -1 )
     , m_nLeftMargin( 3175 )  // page left margin,  default 0x708 (1800) twip -> 3175 1/100 mm
     , m_nRightMargin( 3175 ) // page right margin,  default 0x708 (1800) twip -> 3175 1/100 mm
     , m_nTopMargin( 2540 )
@@ -1387,9 +1385,6 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
 
         HandleMarginsHeaderFooter(/*bFirstPage=*/false, rDM_Impl );
 
-        const OUString sTrayIndex = getPropertyName( PROP_PRINTER_PAPER_TRAY_INDEX );
-        if ( m_nPaperBin >= 0 )
-            xFollowPageStyle->setPropertyValue( sTrayIndex, uno::makeAny( m_nPaperBin ) );
         if ( rDM_Impl.GetSettingsTable()->GetMirrorMarginSettings() )
         {
             Insert( PROP_PAGE_STYLE_LAYOUT, uno::makeAny( style::PageStyleLayout_MIRRORED ) );
@@ -1504,9 +1499,6 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
             if ( rDM_Impl.IsNewDoc() )
                 ApplyProperties_( xFirstPageStyle );
 
-            sal_Int32 nPaperBin = m_nFirstPaperBin >= 0 ? m_nFirstPaperBin : m_nPaperBin >= 0 ? m_nPaperBin : 0;
-            if ( nPaperBin )
-                xFirstPageStyle->setPropertyValue( sTrayIndex, uno::makeAny( nPaperBin ) );
             if ( xColumns.is() )
                 xFirstPageStyle->setPropertyValue(
                     getPropertyName( PROP_TEXT_COLUMNS ), uno::makeAny( xColumns ) );
diff --git a/writerfilter/source/dmapper/PropertyMap.hxx b/writerfilter/source/dmapper/PropertyMap.hxx
index 32ba4f419ece..c587bdad4242 100644
--- a/writerfilter/source/dmapper/PropertyMap.hxx
+++ b/writerfilter/source/dmapper/PropertyMap.hxx
@@ -228,8 +228,6 @@ private:
     // Page number type is a value from css::style::NumberingType.
     sal_Int16                                       m_nPageNumberType;
     sal_Int32                                       m_nBreakType;
-    sal_Int32 const                                 m_nPaperBin;
-    sal_Int32 const                                 m_nFirstPaperBin;
 
     sal_Int32                                       m_nLeftMargin;
     sal_Int32                                       m_nRightMargin;


More information about the Libreoffice-commits mailing list