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 <ci@libreoffice.org>
Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
This commit is contained in:
Takeshi Abe 2016-06-10 16:31:04 +09:00
parent 3b37ea1648
commit f536a83d51
3 changed files with 15 additions and 12 deletions

View File

@ -24,23 +24,25 @@
#include <svx/dlgctrl.hxx>
#include <vcl/scrbar.hxx>
#include <document.hxx>
#include <node.hxx>
#include "format.hxx"
#include <memory>
class SmDocShell;
class SmNode;
class SmElement
{
SmNodePointer mpNode;
std::unique_ptr<SmNode> mpNode;
OUString maText;
OUString maHelpText;
public:
Point mBoxLocation;
Size mBoxSize;
SmElement(SmNodePointer pNode, const OUString& aText, const OUString& aHelpText);
SmElement(std::unique_ptr<SmNode>&& pNode, const OUString& aText, const OUString& aHelpText);
virtual ~SmElement();
const SmNodePointer& getNode();
const std::unique_ptr<SmNode>& getNode();
const OUString& getText()
{
return maText;

View File

@ -76,7 +76,6 @@ class SmDocShell;
class SmNode;
class SmStructureNode;
typedef std::shared_ptr<SmNode> SmNodePointer;
typedef std::deque<std::unique_ptr<SmNode>> SmNodeStack;
typedef std::vector< SmNode * > SmNodeArray;

View File

@ -23,6 +23,8 @@
#include <smmod.hxx>
#include <view.hxx>
#include <visitors.hxx>
#include "document.hxx"
#include "node.hxx"
#include <o3tl/make_unique.hxx>
#include <svl/stritem.hxx>
@ -31,8 +33,8 @@
#include <vcl/help.hxx>
#include <vcl/settings.hxx>
SmElement::SmElement(SmNodePointer pNode, const OUString& aText, const OUString& aHelpText) :
mpNode(pNode),
SmElement::SmElement(std::unique_ptr<SmNode>&& 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<SmNode>& SmElement::getNode()
{
return mpNode;
}
SmElementSeparator::SmElementSeparator() :
SmElement(SmNodePointer(), OUString(), OUString())
SmElement(std::unique_ptr<SmNode>(), 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<SmNode> 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<SmElement>(pNode, aElementSource, aHelpText));
maElementList.push_back(o3tl::make_unique<SmElement>(std::move(pNode), aElementSource, aHelpText));
}
void SmElementsControl::setElementSetId(sal_uInt16 aSetId)