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>
This commit is contained in:
parent
c899d3608d
commit
e3267cadca
2 changed files with 49 additions and 24 deletions
48
editeng/inc/TextPortionList.hxx
Normal file
48
editeng/inc/TextPortionList.hxx
Normal file
|
@ -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: */
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue