starmath/inc/node.hxx | 10 ++++---- starmath/source/node.cxx | 55 ----------------------------------------------- 2 files changed, 5 insertions(+), 60 deletions(-)
New commits: commit b89feb8018bf3610faf01e73995d576f6566e20b Author: Takeshi Abe <[email protected]> Date: Tue Mar 1 16:26:23 2016 +0900 starmath: Make SmNode abstract and noncopyable ... and remove unused SmStructureNode's copy ctor/assignment operator. This seems desirable according to the old comment in SmNode::Accept(). Change-Id: Ifb51c64ca784f1295374d31cc210cbe3e45aa2f8 Reviewed-on: https://gerrit.libreoffice.org/22801 Tested-by: Jenkins <[email protected]> Reviewed-by: Takeshi Abe <[email protected]> diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx index b4e5b1d..4e38e43 100644 --- a/starmath/inc/node.hxx +++ b/starmath/inc/node.hxx @@ -106,6 +106,9 @@ protected: sal_Int32 mnAccIndex; public: + SmNode(const SmNode&) = delete; + SmNode& operator=(const SmNode&) = delete; + virtual ~SmNode(); virtual bool IsVisible() const; @@ -156,7 +159,7 @@ public: virtual void Arrange(OutputDevice &rDev, const SmFormat &rFormat); virtual void CreateTextFromNode(OUString &rText); - virtual void GetAccessibleText( OUStringBuffer &rText ) const; + virtual void GetAccessibleText( OUStringBuffer &rText ) const = 0; sal_Int32 GetAccessibleIndex() const { return mnAccIndex; } const SmNode * FindNodeWithAccessibleIndex(sal_Int32 nAccIndex) const; @@ -180,7 +183,7 @@ public: /** Accept a visitor * Calls the method for this class on the visitor */ - virtual void Accept(SmVisitor* pVisitor); + virtual void Accept(SmVisitor* pVisitor) = 0; /** True if this node is selected */ bool IsSelected() const {return mbIsSelected;} @@ -288,7 +291,6 @@ protected: {} public: - SmStructureNode( const SmStructureNode &rNode ); virtual ~SmStructureNode(); virtual bool IsVisible() const override; @@ -301,8 +303,6 @@ public: void SetSubNodes(SmNode *pFirst, SmNode *pSecond, SmNode *pThird = nullptr); void SetSubNodes(const SmNodeArray &rNodeArray); - SmStructureNode & operator = ( const SmStructureNode &rNode ); - virtual void GetAccessibleText( OUStringBuffer &rText ) const override; void SetSubNode(size_t nIndex, SmNode* pNode) diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx index 6a9c07d..8dadb75 100644 --- a/starmath/source/node.cxx +++ b/starmath/source/node.cxx @@ -378,11 +378,6 @@ const SmNode * SmNode::FindRectClosestTo(const Point &rPoint) const return pResult; } -void SmNode::GetAccessibleText( OUStringBuffer &/*rText*/ ) const -{ - SAL_WARN("starmath", "SmNode: GetAccessibleText not overridden"); -} - const SmNode * SmNode::FindNodeWithAccessibleIndex(sal_Int32 nAccIdx) const { const SmNode *pResult = nullptr; @@ -420,54 +415,12 @@ long SmNode::GetFormulaBaseline() const } -SmStructureNode::SmStructureNode( const SmStructureNode &rNode ) : - SmNode( rNode.GetType(), rNode.GetToken() ) -{ - size_t i; - for (i = 0; i < aSubNodes.size(); i++) - delete aSubNodes[i]; - aSubNodes.resize(0); - - auto nSize = rNode.aSubNodes.size(); - aSubNodes.resize( nSize ); - for (i = 0; i < nSize; ++i) - { - SmNode *pNode = rNode.aSubNodes[i]; - aSubNodes[i] = pNode ? new SmNode( *pNode ) : nullptr; - } - ClaimPaternity(); -} - - SmStructureNode::~SmStructureNode() { ForEachNonNull(this, boost::checked_deleter<SmNode>()); } -SmStructureNode & SmStructureNode::operator = ( const SmStructureNode &rNode ) -{ - SmNode::operator = ( rNode ); - - size_t i; - for (i = 0; i < aSubNodes.size(); i++) - delete aSubNodes[i]; - aSubNodes.resize(0); - - auto nSize = rNode.aSubNodes.size(); - aSubNodes.resize( nSize ); - for (i = 0; i < nSize; ++i) - { - SmNode *pNode = rNode.aSubNodes[i]; - aSubNodes[i] = pNode ? new SmNode( *pNode ) : nullptr; - } - - ClaimPaternity(); - - return *this; -} - - void SmStructureNode::SetSubNodes(SmNode *pFirst, SmNode *pSecond, SmNode *pThird) { size_t nSize = pThird ? 3 : (pSecond ? 2 : (pFirst ? 1 : 0)); @@ -2929,14 +2882,6 @@ void SmBlankNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat) /**************************************************************************/ //Implementation of all accept methods for SmVisitor -void SmNode::Accept(SmVisitor*){ - //This method is only implemented to avoid making SmNode abstract because an - //obscure copy constructor is used... I can't find it's implementation, and - //don't want to figure out how to fix it... If you want to, just delete this - //method, making SmNode abstract, and see where you can an problem with that. - SAL_WARN("starmath", "SmNode should not be visitable!"); -} - void SmTableNode::Accept(SmVisitor* pVisitor) { pVisitor->Visit(this); } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
