clang:optin.performance.Padding in svx,editeng

Excessive padding in 'struct svx::SpellPortion' (18 padding bytes, where
2 is optimal).
Excessive padding in 'class SvxNumRule' (11 padding bytes, where 3 is
optimal).
Excessive padding in 'struct SpellInfo' (10 padding bytes, where 2 is
optimal).
Excessive padding in 'struct ImpEditEngine::LineAreaInfo' (14 padding
bytes, where 6 is optimal).
Excessive padding in 'class ImpChainLinkProperties' (5 padding bytes,
where 1 is optimal).
Excessive padding in 'class TextChainFlow' (20 padding bytes, where 4 is
optimal).
Excessive padding in 'class SdrObjList' (13 padding bytes, where 5 is
optimal).
Excessive padding in 'class SdrLayer' (12 padding bytes, where 4 is
optimal).

Change-Id: I17b1c40bfe553c7635dc6177845dc92956cd0fae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121942
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index b894bd2..a8f0774 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -155,14 +155,14 @@ typedef std::vector<EditSelection>  SpellContentSelections;

struct SpellInfo
{
    EditPaM         aCurSentenceStart;
    svx::SpellPortions    aLastSpellPortions;
    SpellContentSelections  aLastSpellContentSelections;
    EESpellState    eState;
    EPaM            aSpellStart;
    EPaM            aSpellTo;
    EditPaM         aCurSentenceStart;
    bool        bSpellToEnd;
    bool        bMultipleDoc;
    svx::SpellPortions    aLastSpellPortions;
    SpellContentSelections  aLastSpellContentSelections;
    SpellInfo() : eState(EESpellState::Ok), bSpellToEnd(true), bMultipleDoc(false)
        { }
};
@@ -1139,14 +1139,14 @@ public:
    };
    struct LineAreaInfo
    {
        sal_Int16 nColumn; // Column number; when overflowing, equal to total number of columns
        ParaPortion& rPortion; // Current ParaPortion
        sal_Int32 nPortion;
        EditLine* pLine; // Current line, or nullptr for paragraph start
        sal_Int32 nLine;
        tools::Long nHeightNeededToNotWrap;
        tools::Rectangle aArea; // The area for the line (or for rPortion's first line offset)
                                // Bottom coordinate *does not* belong to the area
        tools::Long nHeightNeededToNotWrap;
        sal_Int32 nPortion;
        sal_Int32 nLine;
        sal_Int16 nColumn; // Column number; when overflowing, equal to total number of columns
    };
    using IterateLinesAreasFunc = std::function<CallbackResult(const LineAreaInfo&)>;
    enum IterFlag // bitmask
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 8173558..6d27b50 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -3124,13 +3124,13 @@ void ImpEditEngine::IterateLineAreas(const IterateLinesAreasFunc& f, IterFlag eO
                return;

            LineAreaInfo aInfo{
                nColumn, // nColumn
                rPortion, // rPortion
                n, // nPortion
                nullptr, // pLine
                0, // nLine
                0, // nHeightNeededToNotWrap
                { aLineStart, Size{ nColumnWidth, rPortion.GetFirstLineOffset() } }, // aArea
                0 // nHeightNeededToNotWrap
                n, // nPortion
                0, // nLine
                nColumn // nColumn
            };
            auto eResult = f(aInfo);
            if (eResult == CallbackResult::Stop)
diff --git a/editeng/source/uno/unoedprx.cxx b/editeng/source/uno/unoedprx.cxx
index 8cf7d8e..161633a 100644
--- a/editeng/source/uno/unoedprx.cxx
+++ b/editeng/source/uno/unoedprx.cxx
@@ -52,9 +52,9 @@ public:
        mnEEIndex(0),
        mnFieldOffset(0),
        mnFieldLen(0),
        mbInField(false),
        mnBulletOffset(0),
        mnBulletLen(0),
        mbInField(false),
        mbInBullet(false) {};

    // Get/Set current paragraph
@@ -111,9 +111,9 @@ private:
    sal_Int32 mnEEIndex;
    sal_Int32 mnFieldOffset;
    sal_Int32 mnFieldLen;
    bool  mbInField;
    sal_Int32 mnBulletOffset;
    sal_Int32 mnBulletLen;
    bool  mbInField;
    bool  mbInBullet;
};

diff --git a/include/editeng/SpellPortions.hxx b/include/editeng/SpellPortions.hxx
index 0681b5d..75f6254 100644
--- a/include/editeng/SpellPortions.hxx
+++ b/include/editeng/SpellPortions.hxx
@@ -41,6 +41,22 @@ struct SpellPortion
    /** contains the text of the portion.
     */
    OUString   sText;
    /** for wrong words this reference is filled with the error information otherwise
        it's an empty reference
     */
    css::uno::Reference< css::linguistic2::XSpellAlternatives> xAlternatives;
    /** provides access to the grammar checker interface
     */
    css::uno::Reference< css::linguistic2::XProofreader > xGrammarChecker;
    /** contains the proposed dialog title if the proof reading component provides one.
     */
    OUString   sDialogTitle;
    /** contains the grammar error information
    */
    css::linguistic2::SingleProofreadingError aGrammarError;
    /** contains the language applied to the text. It has to match the script type.
     */
    LanguageType    eLanguage;
    /** Marks the portion as field, footnote symbol or any other special content that
     should be protected against unintentional deletion.
     */
@@ -50,33 +66,17 @@ struct SpellPortion
        for them.
     */
    bool bIsHidden;
    /** contains the language applied to the text. It has to match the script type.
     */
    LanguageType    eLanguage;
    /** for wrong words this reference is filled with the error information otherwise
        it's an empty reference
     */
    css::uno::Reference< css::linguistic2::XSpellAlternatives> xAlternatives;
    /** determines whether the error type is a grammar error
    */
    bool bIsGrammarError;
    /** contains the grammar error information
    */
    css::linguistic2::SingleProofreadingError aGrammarError;
    /** provides access to the grammar checker interface
     */
    css::uno::Reference< css::linguistic2::XProofreader > xGrammarChecker;
    /** marks portion as to-be-ignored. This is a return parameter.
     */
    /** contains the proposed dialog title if the proof reading component provides one.
     */
    OUString   sDialogTitle;

    bool bIgnoreThisError;

    SpellPortion() :
        eLanguage(LANGUAGE_DONTKNOW),
        bIsField(false),
        bIsHidden(false),
        eLanguage(LANGUAGE_DONTKNOW),
        bIsGrammarError(false),
        bIgnoreThisError(false)
        {
diff --git a/include/editeng/numitem.hxx b/include/editeng/numitem.hxx
index 5f444e2..baa6ad3 100644
--- a/include/editeng/numitem.hxx
+++ b/include/editeng/numitem.hxx
@@ -226,7 +226,7 @@ public:
};

//Feature-Flags (only sal_uInt16!)
enum class SvxNumRuleFlags
enum class SvxNumRuleFlags : sal_uInt16
{
    NONE                = 0x0000,
    CONTINUOUS          = 0x0001, // consecutive numbers possible?
@@ -242,7 +242,7 @@ namespace o3tl
    template<> struct typed_flags<SvxNumRuleFlags> : is_typed_flags<SvxNumRuleFlags, 0x039d> {};
}

enum class SvxNumRuleType
enum class SvxNumRuleType : sal_uInt8
{
    NUMBERING,
    OUTLINE_NUMBERING,
@@ -251,12 +251,11 @@ enum class SvxNumRuleType

class EDITENG_DLLPUBLIC SvxNumRule final
{
    std::unique_ptr<SvxNumberFormat> aFmts[SVX_MAX_NUM];
    sal_uInt16          nLevelCount;            // Number of supported levels
    SvxNumRuleFlags     nFeatureFlags;          // What is supported?
    SvxNumRuleType      eNumberingType;         // Type of numbering
    bool                bContinuousNumbering;   // sequential numbering

    std::unique_ptr<SvxNumberFormat> aFmts[SVX_MAX_NUM];
    bool                aFmtsSet[SVX_MAX_NUM]; // Flags indicating valid levels

    static sal_Int32    nRefCount;
diff --git a/include/svx/svdlayer.hxx b/include/svx/svdlayer.hxx
index 2e35c83..40cac55 100644
--- a/include/svx/svdlayer.hxx
+++ b/include/svx/svdlayer.hxx
@@ -62,10 +62,10 @@ class SVXCORE_DLLPUBLIC SdrLayer
    OUString maName;
    OUString maTitle;
    OUString maDescription;
    SdrModel*  pModel; // For broadcasting
    bool mbVisibleODF; // corresponds to ODF draw:display
    bool mbPrintableODF; // corresponds to ODF draw:display
    bool mbLockedODF; // corresponds to ODF draw:protected
    SdrModel*  pModel; // For broadcasting
    SdrLayerID nID;

    SdrLayer(SdrLayerID nNewID, const OUString& rNewName);
diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx
index d16a9dc..e19b177 100644
--- a/include/svx/svdpage.hxx
+++ b/include/svx/svdpage.hxx
@@ -64,13 +64,6 @@ private:
    SdrObjList(const SdrObjList& rSrcList) = delete;
    SdrObjList &operator=(const SdrObjList& rSrcList) = delete;

    std::vector<SdrObject*> maList;

    tools::Rectangle    maSdrObjListOutRect;
    tools::Rectangle    maSdrObjListSnapRect;
    bool                mbObjOrdNumsDirty;
    bool                mbRectsDirty;

protected:
    void RecalcRects();

@@ -229,10 +222,14 @@ public:
    virtual void dumpAsXml(xmlTextWriterPtr pWriter) const;

private:
    tools::Rectangle    maSdrObjListOutRect;
    tools::Rectangle    maSdrObjListSnapRect;
    std::vector<SdrObject*> maList;
    /// This list, if it exists, defines the navigation order. If it does
    /// not exist then maList defines the navigation order.
    std::optional<std::vector<tools::WeakReference<SdrObject>>> mxNavigationOrder;

    bool                mbObjOrdNumsDirty;
    bool                mbRectsDirty;
    /// This flag is <TRUE/> when the mpNavigation list has been changed but
    /// the indices of the referenced SdrObjects still have their old values.
    bool mbIsNavigationOrderDirty;
diff --git a/svx/inc/textchain.hxx b/svx/inc/textchain.hxx
index a74b6c9..0607052 100644
--- a/svx/inc/textchain.hxx
+++ b/svx/inc/textchain.hxx
@@ -33,7 +33,7 @@ class OUString;

typedef OUString ChainLinkId;

enum class CursorChainingEvent
enum class CursorChainingEvent : sal_uInt8
{
    TO_NEXT_LINK,
    TO_PREV_LINK,
@@ -58,10 +58,10 @@ protected:

private:
    // NOTE: Remember to set default value in constructor when adding field
    bool aNilChainingEvent;
    CursorChainingEvent aCursorEvent;
    ESelection aPreChainingSel;
    ESelection aPostChainingSel;
    CursorChainingEvent aCursorEvent;
    bool aNilChainingEvent;
    bool aIsPartOfLastParaInNextLink;
    bool aSwitchingToNextBox;
};
diff --git a/svx/inc/textchaincursor.hxx b/svx/inc/textchaincursor.hxx
index 8dfb657..84171ab 100644
--- a/svx/inc/textchaincursor.hxx
+++ b/svx/inc/textchaincursor.hxx
@@ -23,7 +23,7 @@ class SdrObjEditView;
class SdrTextObj;
class KeyEvent;
class SdrOutliner;
enum class CursorChainingEvent;
enum class CursorChainingEvent : sal_uInt8;
struct ESelection;


diff --git a/svx/inc/textchainflow.hxx b/svx/inc/textchainflow.hxx
index a46c47a..d423939 100644
--- a/svx/inc/textchainflow.hxx
+++ b/svx/inc/textchainflow.hxx
@@ -51,14 +51,6 @@ public:
    SdrTextObj* GetLinkTarget() const;

protected:
    // Cursor related
    bool mbPossiblyCursorOut;
    ESelection maOverflowPosSel;
    ESelection maPostChainingSel;

    std::unique_ptr<OFlowChainedText> mpOverflChText;
    std::unique_ptr<UFlowChainedText> mpUnderflChText;

    void impCheckForFlowEvents(SdrOutliner*, SdrOutliner*);

    TextChain* GetTextChain() const;
@@ -69,15 +61,21 @@ protected:
    virtual void impSetFlowOutlinerParams(SdrOutliner*, SdrOutliner*);

private:
    bool mbOFisUFinduced;

    void impUpdateCursorInfo();

protected:
    std::unique_ptr<OFlowChainedText> mpOverflChText;
    std::unique_ptr<UFlowChainedText> mpUnderflChText;
    // Cursor related
    ESelection maOverflowPosSel;
    ESelection maPostChainingSel;
    bool mbPossiblyCursorOut;

private:
    SdrTextObj* mpTargetLink;
    SdrTextObj* mpNextLink;

    TextChain* mpTextChain;

    bool mbOFisUFinduced;
    bool bUnderflow;
    bool bOverflow;
};