1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 #include "ParagraphPortion.hxx"
30 mutable sal_Int32 nLastCache
= 0;
31 typedef std::vector
<std::unique_ptr
<ParaPortion
>> ParaPortionContainerType
;
32 ParaPortionContainerType maPortions
;
35 ParaPortionList() = default;
38 tools::Long
GetYOffset(const ParaPortion
* pPPortion
) const;
39 sal_Int32
FindParagraph(tools::Long nYOffset
) const;
41 const ParaPortion
* SafeGetObject(sal_Int32 nPos
) const;
42 ParaPortion
* SafeGetObject(sal_Int32 nPos
);
44 sal_Int32
GetPos(const ParaPortion
* p
) const;
45 ParaPortion
* operator[](sal_Int32 nPos
);
46 const ParaPortion
* operator[](sal_Int32 nPos
) const;
48 std::unique_ptr
<ParaPortion
> Release(sal_Int32 nPos
);
49 void Remove(sal_Int32 nPos
);
50 void Insert(sal_Int32 nPos
, std::unique_ptr
<ParaPortion
> p
);
51 void Append(std::unique_ptr
<ParaPortion
> p
);
52 sal_Int32
Count() const;
54 ParaPortionContainerType::iterator
begin() { return maPortions
.begin(); }
55 ParaPortionContainerType::iterator
end() { return maPortions
.end(); }
56 ParaPortionContainerType::const_iterator
cbegin() const { return maPortions
.cbegin(); }
57 ParaPortionContainerType::const_iterator
cend() const { return maPortions
.cend(); }
59 void MarkAllSelectionsInvalid(sal_Int32 nStart
)
61 for (auto& pParaPortion
: maPortions
)
62 pParaPortion
->MarkSelectionInvalid(nStart
);
65 #if OSL_DEBUG_LEVEL > 0 && !defined NDEBUG
67 static void DbgCheck(ParaPortionList
const&, EditDoc
const& rDoc
);
71 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */