editeng/inc/ParagraphPortion.hxx | 26 +++++++------- editeng/inc/ParagraphPortionList.hxx | 5 +- editeng/inc/editdoc.hxx | 60 ++++++++++++++++++++++---------- editeng/source/editeng/editdoc.cxx | 64 +++++++++-------------------------- 4 files changed, 75 insertions(+), 80 deletions(-)
New commits: commit 252c0316c3be09079e08afc9fa512ca5a60ea957 Author: Tomaž Vajngerl <[email protected]> AuthorDate: Fri Dec 29 21:55:54 2023 +0900 Commit: Tomaž Vajngerl <[email protected]> CommitDate: Mon Jan 1 09:21:06 2024 +0100 editeng: prefix members of EditDoc Change-Id: I403db061b6e3e184e97c5ec3ce5746d2fdff0749 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161478 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <[email protected]> diff --git a/editeng/inc/editdoc.hxx b/editeng/inc/editdoc.hxx index 738c0b2d5772..7fc29556957c 100644 --- a/editeng/inc/editdoc.hxx +++ b/editeng/inc/editdoc.hxx @@ -104,20 +104,20 @@ public: class EditDoc { private: - mutable sal_Int32 nLastCache; - std::vector<std::unique_ptr<ContentNode> > maContents; + mutable sal_Int32 mnLastCache; + std::vector<std::unique_ptr<ContentNode>> maContents; - rtl::Reference<SfxItemPool> pItemPool; - Link<LinkParamNone*,void> aModifyHdl; + rtl::Reference<SfxItemPool> mpItemPool; + Link<LinkParamNone*,void> maModifyHdl; SvxFont maDefFont; //faster than ever from the pool!! - sal_uInt16 nDefTab; - bool bIsVertical:1; + sal_uInt16 mnDefTab; + bool mbIsVertical:1; TextRotation mnRotation; - bool bIsFixedCellHeight:1; + bool mbIsFixedCellHeight:1; - bool bModified:1; - bool bDisableAttributeExpanding:1; + bool mbModified:1; + bool mbDisableAttributeExpanding:1; public: EditDoc( SfxItemPool* pItemPool ); @@ -126,28 +126,44 @@ public: void dumpAsXml(xmlTextWriterPtr pWriter) const; void ClearSpellErrors(); - bool IsModified() const { return bModified; } + bool IsModified() const { return mbModified; } void SetModified( bool b ); - void DisableAttributeExpanding() { bDisableAttributeExpanding = true; } + void DisableAttributeExpanding() { mbDisableAttributeExpanding = true; } - void SetModifyHdl( const Link<LinkParamNone*,void>& rLink ) { aModifyHdl = rLink; } + void SetModifyHdl(const Link<LinkParamNone*,void>& rLink) + { + maModifyHdl = rLink; + } void CreateDefFont( bool bUseStyles ); const SvxFont& GetDefFont() const { return maDefFont; } - void SetDefTab( sal_uInt16 nTab ) { nDefTab = nTab ? nTab : DEFTAB; } - sal_uInt16 GetDefTab() const { return nDefTab; } + void SetDefTab(sal_uInt16 nTab) + { + mnDefTab = nTab ? nTab : DEFTAB; + } - void SetVertical( bool bVertical ) { bIsVertical = bVertical; } + sal_uInt16 GetDefTab() const + { + return mnDefTab; + } + + void SetVertical( bool bVertical ) { mbIsVertical = bVertical; } bool IsEffectivelyVertical() const; bool IsTopToBottom() const; bool GetVertical() const; void SetRotation( TextRotation nRotation ) { mnRotation = nRotation; } TextRotation GetRotation() const { return mnRotation; } - void SetFixedCellHeight( bool bUseFixedCellHeight ) { bIsFixedCellHeight = bUseFixedCellHeight; } - bool IsFixedCellHeight() const { return bIsFixedCellHeight; } + void SetFixedCellHeight( bool bUseFixedCellHeight ) + { + mbIsFixedCellHeight = bUseFixedCellHeight; + } + bool IsFixedCellHeight() const + { + return mbIsFixedCellHeight; + } EditPaM Clear(); EditPaM RemoveText(); @@ -166,8 +182,14 @@ public: EditPaM GetStartPaM() const; EditPaM GetEndPaM() const; - SfxItemPool& GetItemPool() { return *pItemPool; } - const SfxItemPool& GetItemPool() const { return *pItemPool; } + SfxItemPool& GetItemPool() + { + return *mpItemPool; + } + const SfxItemPool& GetItemPool() const + { + return *mpItemPool; + } void InsertAttrib( const SfxPoolItem& rItem, ContentNode* pNode, sal_Int32 nStart, sal_Int32 nEnd ); void InsertAttrib( ContentNode* pNode, sal_Int32 nStart, sal_Int32 nEnd, const SfxPoolItem& rPoolItem ); diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index fdfd74edb09a..0afcc9cdd81c 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -790,14 +790,14 @@ void EditSelection::Adjust( const EditDoc& rNodes ) } EditDoc::EditDoc( SfxItemPool* pPool ) : - nLastCache(0), - pItemPool(pPool ? pPool : new EditEngineItemPool()), - nDefTab(DEFTAB), - bIsVertical(false), + mnLastCache(0), + mpItemPool(pPool ? pPool : new EditEngineItemPool()), + mnDefTab(DEFTAB), + mbIsVertical(false), mnRotation(TextRotation::NONE), - bIsFixedCellHeight(false), - bModified(false), - bDisableAttributeExpanding(false) + mbIsFixedCellHeight(false), + mbModified(false), + mbDisableAttributeExpanding(false) { // Don't create an empty node, Clear() will be called in EditEngine-CTOR }; @@ -903,24 +903,24 @@ void EditDoc::CreateDefFont( bool bUseStyles ) bool EditDoc::IsEffectivelyVertical() const { - return (bIsVertical && mnRotation == TextRotation::NONE) || - (!bIsVertical && mnRotation != TextRotation::NONE); + return (mbIsVertical && mnRotation == TextRotation::NONE) || + (!mbIsVertical && mnRotation != TextRotation::NONE); } bool EditDoc::IsTopToBottom() const { - return (bIsVertical && mnRotation == TextRotation::NONE) || - (!bIsVertical && mnRotation == TextRotation::TOPTOBOTTOM); + return (mbIsVertical && mnRotation == TextRotation::NONE) || + (!mbIsVertical && mnRotation == TextRotation::TOPTOBOTTOM); } bool EditDoc::GetVertical() const { - return bIsVertical; + return mbIsVertical; } -sal_Int32 EditDoc::GetPos(const ContentNode* p) const +sal_Int32 EditDoc::GetPos(const ContentNode* pContentNode) const { - return FastGetPos(maContents, p, nLastCache); + return FastGetPos(maContents, pContentNode, mnLastCache); } const ContentNode* EditDoc::GetObject(sal_Int32 nPos) const @@ -1085,11 +1085,9 @@ void EditDoc::ClearSpellErrors() void EditDoc::SetModified( bool b ) { - bModified = b; - if ( bModified ) - { - aModifyHdl.Call( nullptr ); - } + mbModified = b; + if (mbModified) + maModifyHdl.Call(nullptr); } EditPaM EditDoc::RemoveText() @@ -1235,7 +1233,7 @@ void EditDoc::InsertAttribInSelection( ContentNode* pNode, sal_Int32 nStart, sal // tdf#132288 By default inserting an attribute beside another that is of // the same type expands the original instead of inserting another. But the // spell check dialog doesn't want that behaviour - if (bDisableAttributeExpanding) + if (mbDisableAttributeExpanding) { pStartingAttrib = nullptr; pEndingAttrib = nullptr; commit ee2164d484541e0b45a40aad619d0db31afde634 Author: Tomaž Vajngerl <[email protected]> AuthorDate: Fri Dec 29 21:05:01 2023 +0900 Commit: Tomaž Vajngerl <[email protected]> CommitDate: Mon Jan 1 09:20:57 2024 +0100 editeng: simplify constr. and destr. of ParaPortion{List} Change-Id: I8f7e242b66463baa9adcc0dee8eb8f4206630c7a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161477 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <[email protected]> diff --git a/editeng/inc/ParagraphPortion.hxx b/editeng/inc/ParagraphPortion.hxx index 93eb8356f611..e788bb7c9112 100644 --- a/editeng/inc/ParagraphPortion.hxx +++ b/editeng/inc/ParagraphPortion.hxx @@ -60,27 +60,29 @@ class ParaPortion private: EditLineList aLineList; TextPortionList aTextPortionList; - ContentNode* pNode; - tools::Long nHeight; + ContentNode* pNode = nullptr; + tools::Long nHeight = 0; ScriptTypePosInfos aScriptInfos; WritingDirectionInfos aWritingDirectionInfos; - sal_Int32 nInvalidPosStart; - sal_Int32 nFirstLineOffset; // For Writer-LineSpacing-Interpretation - sal_Int32 nBulletX; - sal_Int32 nInvalidDiff; + sal_Int32 nInvalidPosStart = 0; + sal_Int32 nFirstLineOffset = 0; // For Writer-LineSpacing-Interpretation + sal_Int32 nBulletX = 0; + sal_Int32 nInvalidDiff = 0; - bool bInvalid : 1; - bool bSimple : 1; // only linear Tap - bool bVisible : 1; // Belongs to the node! - bool bForceRepaint : 1; + bool bInvalid : 1 = true; + bool bSimple : 1 = false; // only linear Tap + bool bVisible : 1 = true; // Belongs to the node! + bool bForceRepaint : 1 = false; ParaPortion(const ParaPortion&) = delete; public: - ParaPortion(ContentNode* pNode); - ~ParaPortion(); + ParaPortion(ContentNode* pN) + : pNode(pN) + { + } sal_Int32 GetLineNumber(sal_Int32 nIndex) const; diff --git a/editeng/inc/ParagraphPortionList.hxx b/editeng/inc/ParagraphPortionList.hxx index 8964c9767ba7..23654adc5e43 100644 --- a/editeng/inc/ParagraphPortionList.hxx +++ b/editeng/inc/ParagraphPortionList.hxx @@ -27,12 +27,11 @@ class EditDoc; class ParaPortionList { - mutable sal_Int32 nLastCache; + mutable sal_Int32 nLastCache = 0; std::vector<std::unique_ptr<ParaPortion>> maPortions; public: - ParaPortionList(); - ~ParaPortionList(); + ParaPortionList() = default; void Reset(); tools::Long GetYOffset(const ParaPortion* pPPortion) const; diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index 6091c78ede4c..fdfd74edb09a 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -367,24 +367,6 @@ EditCharAttrib* MakeCharAttrib( SfxItemPool& rPool, const SfxPoolItem& rAttr, sa return nullptr; } -ParaPortion::ParaPortion( ContentNode* pN ) : - pNode(pN), - nHeight(0), - nInvalidPosStart(0), - nFirstLineOffset(0), - nBulletX(0), - nInvalidDiff(0), - bInvalid(true), - bSimple(false), - bVisible(true), - bForceRepaint(false) -{ -} - -ParaPortion::~ParaPortion() -{ -} - void ParaPortion::MarkInvalid( sal_Int32 nStart, sal_Int32 nDiff ) { if ( !bInvalid ) @@ -539,14 +521,6 @@ sal_Int32 FastGetPos(const Array& rArray, const Val* p, sal_Int32& rLastPos) } -ParaPortionList::ParaPortionList() : nLastCache( 0 ) -{ -} - -ParaPortionList::~ParaPortionList() -{ -} - sal_Int32 ParaPortionList::GetPos(const ParaPortion* p) const { return FastGetPos(maPortions, p, nLastCache);
