starmath/inc/node.hxx | 15 ++++----------- starmath/source/node.cxx | 12 ++++++------ 2 files changed, 10 insertions(+), 17 deletions(-)
New commits: commit b871a97d35a4160b7403c07bfac10aaa744fbbfd Author: Takeshi Abe <[email protected]> Date: Tue May 10 11:51:44 2016 +0900 starmath: Drop unused non-const variant of GetLeftMost ... resulting in one less const_cast. Change-Id: I3dad339f25524fc22e7a02b08ee7ec01b341e991 Reviewed-on: https://gerrit.libreoffice.org/24810 Tested-by: Jenkins <[email protected]> Reviewed-by: Takeshi Abe <[email protected]> diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx index 48442a2..c6e5419 100644 --- a/starmath/inc/node.hxx +++ b/starmath/inc/node.hxx @@ -119,11 +119,7 @@ public: return const_cast<SmNode *>(this)->GetSubNode(nIndex); } - virtual SmNode * GetLeftMost(); - const SmNode * GetLeftMost() const - { - return const_cast<SmNode *>(this)->GetLeftMost(); - } + virtual const SmNode * GetLeftMost() const; sal_uInt16 & Flags() { return mnFlags; } sal_uInt16 & Attributes() { return mnAttributes; } @@ -661,8 +657,7 @@ public: { } - using SmNode::GetLeftMost; - virtual SmNode * GetLeftMost() override; + virtual const SmNode * GetLeftMost() const override; virtual void Arrange(OutputDevice &rDev, const SmFormat &rFormat) override; virtual long GetFormulaBaseline() const override; @@ -859,8 +854,7 @@ public: SetNumSubNodes(3); } - using SmNode::GetLeftMost; - virtual SmNode * GetLeftMost() override; + virtual const SmNode * GetLeftMost() const override; virtual void Arrange(OutputDevice &rDev, const SmFormat &rFormat) override; void CreateTextFromNode(OUString &rText) override; @@ -1201,8 +1195,7 @@ public: sal_uInt16 GetNumCols() const {return nNumCols;} void SetRowCol(sal_uInt16 nMatrixRows, sal_uInt16 nMatrixCols); - using SmNode::GetLeftMost; - virtual SmNode * GetLeftMost() override; + virtual const SmNode * GetLeftMost() const override; virtual void Arrange(OutputDevice &rDev, const SmFormat &rFormat) override; void CreateTextFromNode(OUString &rText) override; diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx index 1104196..7f2b04d 100644 --- a/starmath/source/node.cxx +++ b/starmath/source/node.cxx @@ -93,12 +93,12 @@ SmNode * SmNode::GetSubNode(sal_uInt16 /*nIndex*/) } -SmNode * SmNode::GetLeftMost() +const SmNode * SmNode::GetLeftMost() const // returns leftmost node of current subtree. //! (this assumes the one with index 0 is always the leftmost subnode //! for the current node). { - SmNode *pNode = GetNumSubNodes() > 0 ? + const SmNode *pNode = GetNumSubNodes() > 0 ? GetSubNode(0) : nullptr; return pNode ? pNode->GetLeftMost() : this; @@ -569,7 +569,7 @@ void SmTableNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat) } } -SmNode * SmTableNode::GetLeftMost() +const SmNode * SmTableNode::GetLeftMost() const { return this; } @@ -660,7 +660,7 @@ void SmExpressionNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat) SmLineNode::Arrange(rDev, rFormat); // copy alignment of leftmost subnode if any - SmNode *pNode = GetLeftMost(); + const SmNode *pNode = GetLeftMost(); if (pNode) SetRectHorAlign(pNode->GetRectHorAlign(), false); } @@ -965,7 +965,7 @@ void SmBinVerNode::CreateTextFromNode(OUString &rText) } -SmNode * SmBinVerNode::GetLeftMost() +const SmNode * SmBinVerNode::GetLeftMost() const { return this; } @@ -2419,7 +2419,7 @@ void SmMatrixNode::SetRowCol(sal_uInt16 nMatrixRows, sal_uInt16 nMatrixCols) } -SmNode * SmMatrixNode::GetLeftMost() +const SmNode * SmMatrixNode::GetLeftMost() const { return this; } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
