From f536a83d51443d19dba58157cea28fb67a090e02 Mon Sep 17 00:00:00 2001 From: Takeshi Abe Date: Fri, 10 Jun 2016 16:31:04 +0900 Subject: starmath: SmElement owns SmNode SmNodePointer is no longer used, so drop it. Change-Id: I5194cc7e1d9e551f4131cbcac0d84351bb2f2eab Reviewed-on: https://gerrit.libreoffice.org/26146 Tested-by: Jenkins Reviewed-by: Takeshi Abe --- starmath/inc/ElementsDockingWindow.hxx | 12 +++++++----- starmath/inc/node.hxx | 1 - starmath/source/ElementsDockingWindow.cxx | 14 ++++++++------ 3 files changed, 15 insertions(+), 12 deletions(-) (limited to 'starmath') diff --git a/starmath/inc/ElementsDockingWindow.hxx b/starmath/inc/ElementsDockingWindow.hxx index fd61025b3dc7..5c0f22895d7a 100644 --- a/starmath/inc/ElementsDockingWindow.hxx +++ b/starmath/inc/ElementsDockingWindow.hxx @@ -24,23 +24,25 @@ #include #include -#include -#include +#include "format.hxx" #include +class SmDocShell; +class SmNode; + class SmElement { - SmNodePointer mpNode; + std::unique_ptr mpNode; OUString maText; OUString maHelpText; public: Point mBoxLocation; Size mBoxSize; - SmElement(SmNodePointer pNode, const OUString& aText, const OUString& aHelpText); + SmElement(std::unique_ptr&& pNode, const OUString& aText, const OUString& aHelpText); virtual ~SmElement(); - const SmNodePointer& getNode(); + const std::unique_ptr& getNode(); const OUString& getText() { return maText; diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx index af03a7be183f..bde97d5cc44c 100644 --- a/starmath/inc/node.hxx +++ b/starmath/inc/node.hxx @@ -76,7 +76,6 @@ class SmDocShell; class SmNode; class SmStructureNode; -typedef std::shared_ptr SmNodePointer; typedef std::deque> SmNodeStack; typedef std::vector< SmNode * > SmNodeArray; diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx index 0f660a414065..82c1ca64616f 100644 --- a/starmath/source/ElementsDockingWindow.cxx +++ b/starmath/source/ElementsDockingWindow.cxx @@ -23,6 +23,8 @@ #include #include #include +#include "document.hxx" +#include "node.hxx" #include #include @@ -31,8 +33,8 @@ #include #include -SmElement::SmElement(SmNodePointer pNode, const OUString& aText, const OUString& aHelpText) : - mpNode(pNode), +SmElement::SmElement(std::unique_ptr&& pNode, const OUString& aText, const OUString& aHelpText) : + mpNode(std::move(pNode)), maText(aText), maHelpText(aHelpText) {} @@ -40,13 +42,13 @@ SmElement::SmElement(SmNodePointer pNode, const OUString& aText, const OUString& SmElement::~SmElement() {} -const SmNodePointer& SmElement::getNode() +const std::unique_ptr& SmElement::getNode() { return mpNode; } SmElementSeparator::SmElementSeparator() : - SmElement(SmNodePointer(), OUString(), OUString()) + SmElement(std::unique_ptr(), OUString(), OUString()) {} const sal_uInt16 SmElementsControl::aUnaryBinaryOperatorsList[][2] = @@ -505,7 +507,7 @@ void SmElementsControl::addSeparator() void SmElementsControl::addElement(const OUString& aElementVisual, const OUString& aElementSource, const OUString& aHelpText) { - SmNodePointer pNode(SmParser().ParseExpression(aElementVisual)); + std::unique_ptr pNode(SmParser().ParseExpression(aElementVisual)); pNode->Prepare(maFormat, *mpDocShell); pNode->SetSize(Fraction(10,8)); @@ -520,7 +522,7 @@ void SmElementsControl::addElement(const OUString& aElementVisual, const OUStrin maMaxElementDimensions.Height() = aSizePixel.Height(); } - maElementList.push_back(o3tl::make_unique(pNode, aElementSource, aHelpText)); + maElementList.push_back(o3tl::make_unique(std::move(pNode), aElementSource, aHelpText)); } void SmElementsControl::setElementSetId(sal_uInt16 aSetId) -- cgit