diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2023-12-29 16:47:30 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2024-01-01 03:06:57 +0100 |
commit | e3267cadcaa8cfc64705e24bd484815469b8814f (patch) | |
tree | dce2b57a5ee8b68d848b07cc29ca7747bdb05516 /editeng | |
parent | c899d3608d30f3ab4c2bc193c1fcd765221614a4 (diff) |
editeng: move TextPortionList into its own header file
Change-Id: I366706138f88c7865a7f1315af64bb4ab5b07ce3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161473
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/inc/TextPortionList.hxx | 48 | ||||
-rw-r--r-- | editeng/inc/editdoc.hxx | 25 |
2 files changed, 49 insertions, 24 deletions
diff --git a/editeng/inc/TextPortionList.hxx b/editeng/inc/TextPortionList.hxx new file mode 100644 index 000000000000..3e2272f4de9c --- /dev/null +++ b/editeng/inc/TextPortionList.hxx @@ -0,0 +1,48 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * 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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include "TextPortion.hxx" +#include <vector> + +class TextPortionList +{ + typedef std::vector<std::unique_ptr<TextPortion>> PortionsType; + PortionsType maPortions; + +public: + TextPortionList(); + ~TextPortionList(); + + void Reset(); + sal_Int32 FindPortion(sal_Int32 nCharPos, sal_Int32& rPortionStart, + bool bPreferStartingPortion = false) const; + sal_Int32 GetStartPos(sal_Int32 nPortion); + void DeleteFromPortion(sal_Int32 nDelFrom); + sal_Int32 Count() const; + const TextPortion& operator[](sal_Int32 nPos) const; + TextPortion& operator[](sal_Int32 nPos); + + void Append(TextPortion* p); + void Insert(sal_Int32 nPos, TextPortion* p); + void Remove(sal_Int32 nPos); + sal_Int32 GetPos(const TextPortion* p) const; +}; +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editdoc.hxx b/editeng/inc/editdoc.hxx index ee4f4433c307..f81eac050b76 100644 --- a/editeng/inc/editdoc.hxx +++ b/editeng/inc/editdoc.hxx @@ -31,6 +31,7 @@ #include <tools/lineend.hxx> #include <o3tl/typed_flags_set.hxx> #include "TextPortion.hxx" +#include "TextPortionList.hxx" #include "ItemList.hxx" #include "ContentNode.hxx" #include "EditLineList.hxx" @@ -113,30 +114,6 @@ enum class DeleteMode { Simple, RestOfWord, RestOfContent }; -class TextPortionList -{ - typedef std::vector<std::unique_ptr<TextPortion> > PortionsType; - PortionsType maPortions; - -public: - TextPortionList(); - ~TextPortionList(); - - void Reset(); - sal_Int32 FindPortion( - sal_Int32 nCharPos, sal_Int32& rPortionStart, bool bPreferStartingPortion = false) const; - sal_Int32 GetStartPos(sal_Int32 nPortion); - void DeleteFromPortion(sal_Int32 nDelFrom); - sal_Int32 Count() const; - const TextPortion& operator[](sal_Int32 nPos) const; - TextPortion& operator[](sal_Int32 nPos); - - void Append(TextPortion* p); - void Insert(sal_Int32 nPos, TextPortion* p); - void Remove(sal_Int32 nPos); - sal_Int32 GetPos(const TextPortion* p) const; -}; - class ParaPortion { friend class ImpEditEngine; // to adjust the height |