Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef INCLUDED_SW_SOURCE_CORE_INC_SWSELECTIONLIST_HXX
20 : #define INCLUDED_SW_SOURCE_CORE_INC_SWSELECTIONLIST_HXX
21 :
22 : #include <list>
23 :
24 : class SwPaM;
25 : class SwFrm;
26 :
27 : /** This class is used as parameter for creation of a block cursor selection
28 :
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.
38 : */
39 :
40 0 : class SwSelectionList
41 : {
42 : std::list< SwPaM* > aList; // container for the selected text portions
43 : const SwFrm* pContext; // the context of these text portions
44 : public:
45 : /** Ctor to create an empty list for a given context
46 :
47 : @param pInitCxt
48 : The frame (normally a SwTextFrm) where the block cursor selection starts,
49 : it will be used to get the allowed context for the text selections.
50 : */
51 : explicit SwSelectionList( const SwFrm* pInitCxt );
52 :
53 : /** Start of the container for the selected text portions
54 : */
55 0 : std::list<SwPaM*>::iterator getStart() { return aList.begin(); }
56 :
57 : /** End of the container for the selected text portions
58 : */
59 0 : std::list<SwPaM*>::iterator getEnd() { return aList.end(); }
60 :
61 : /** Adds a text portion to the selection list
62 :
63 : @param pPam
64 : represents a text portion to select
65 : */
66 0 : void insertPaM( SwPaM* pPam ) { aList.push_front( pPam ); }
67 :
68 : /** Reports if the list does not contain any text portion
69 :
70 : @return true, if list is empty
71 : */
72 0 : bool isEmpty() const { return aList.empty(); }
73 :
74 : /** Checks if the context of the list is equal to the context of the frame
75 :
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.
80 :
81 : @param pCheck
82 : The frame to check
83 :
84 : @return true, if the context of the frame is equal to the one of the list
85 : */
86 : bool checkContext( const SwFrm* pCheck );
87 : };
88 :
89 : #endif // INCLUDED_SW_SOURCE_CORE_INC_SWSELECTIONLIST_HXX
90 :
91 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|