2010-12-23 16:28:48 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2010-10-23 16:39:57 +01:00
|
|
|
/*
|
2013-04-24 17:14:03 +01:00
|
|
|
* This file is part of the LibreOffice project.
|
2010-10-23 16:39:57 +01:00
|
|
|
*
|
2013-04-24 17:14:03 +01:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
2010-10-23 16:39:57 +01:00
|
|
|
*/
|
2010-10-01 22:04:50 +02:00
|
|
|
#include "caret.hxx"
|
|
|
|
|
2016-05-31 15:01:49 +09:00
|
|
|
#include <o3tl/make_unique.hxx>
|
2010-10-01 22:04:50 +02:00
|
|
|
|
2016-05-31 15:01:49 +09:00
|
|
|
SmCaretPosGraph::SmCaretPosGraph() = default;
|
2010-10-01 22:04:50 +02:00
|
|
|
|
2016-05-31 15:01:49 +09:00
|
|
|
SmCaretPosGraph::~SmCaretPosGraph() = default;
|
2010-10-01 22:04:50 +02:00
|
|
|
|
2016-05-31 15:01:49 +09:00
|
|
|
SmCaretPosGraphEntry* SmCaretPosGraph::Add(SmCaretPos pos,
|
2016-09-09 11:06:42 +02:00
|
|
|
SmCaretPosGraphEntry* left)
|
2016-05-31 15:01:49 +09:00
|
|
|
{
|
2016-12-27 19:14:37 +09:00
|
|
|
assert(pos.nIndex >= 0);
|
2016-09-09 11:06:42 +02:00
|
|
|
auto entry = o3tl::make_unique<SmCaretPosGraphEntry>(pos, left, nullptr);
|
2016-05-31 15:01:49 +09:00
|
|
|
SmCaretPosGraphEntry* e = entry.get();
|
|
|
|
//Set Left and Right to point to the entry itself if they are NULL
|
|
|
|
entry->Left = entry->Left ? entry->Left : e;
|
|
|
|
entry->Right = entry->Right ? entry->Right : e;
|
|
|
|
mvEntries.push_back(std::move(entry));
|
|
|
|
return e;
|
2010-10-01 22:04:50 +02:00
|
|
|
}
|
2010-12-23 16:28:48 +00:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|