Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / source / core / inc / swselectionlist.hxx
blob9eb3903211b208eb9c1782a196ba8dd5d716a5b8
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
19 #ifndef INCLUDED_SW_SOURCE_CORE_INC_SWSELECTIONLIST_HXX
20 #define INCLUDED_SW_SOURCE_CORE_INC_SWSELECTIONLIST_HXX
22 #include <list>
24 class SwPaM;
25 class SwFrame;
27 /** This class is used as parameter for creation of a block cursor selection
29 This class will be created by a block cursor. Its responsibility is
30 to collect a group of selected text portions which are part of a common
31 context.
32 Definition of context:
33 A page header is a context.
34 A page footer is a context.
35 A footnote is a context.
36 Every fly frame builds a context together with its linked colleagues.
37 The content of the page bodies builds a context.
40 class SwSelectionList
42 std::list<SwPaM*> m_aList; // container for the selected text portions
43 const SwFrame* m_pContext; // the context of these text portions
44 public:
45 /** Ctor to create an empty list for a given context
47 @param pInitCxt
48 The frame (normally a SwTextFrame) where the block cursor selection starts,
49 it will be used to get the allowed context for the text selections.
51 explicit SwSelectionList(const SwFrame* pInitCxt);
53 /** Start of the container for the selected text portions
55 std::list<SwPaM*>::iterator getStart() { return m_aList.begin(); }
57 /** End of the container for the selected text portions
59 std::list<SwPaM*>::iterator getEnd() { return m_aList.end(); }
61 /** Adds a text portion to the selection list
63 @param pPam
64 represents a text portion to select
66 void insertPaM(SwPaM* pPam) { m_aList.push_front(pPam); }
68 /** Reports if the list does not contain any text portion
70 @return true, if list is empty
72 bool isEmpty() const { return m_aList.empty(); }
74 /** Checks if the context of the list is equal to the context of the frame
76 If the list does not have already a context, the context of the frame
77 will define the list's context.
78 If the list has already a context, it will be compared to the context of
79 the given frame.
81 @param pCheck
82 The frame to check
84 @return true, if the context of the frame is equal to the one of the list
86 bool checkContext(const SwFrame* pCheck);
89 #endif // INCLUDED_SW_SOURCE_CORE_INC_SWSELECTIONLIST_HXX
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */