1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: swselectionlist.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _SWSELECTIONLIST_HXX
31 #define _SWSELECTIONLIST_HXX
38 /** This class is used as parameter for creation of a block cursor selection
40 This class will be created by a block cursor. Its responsibility is
41 to collect a group of selected text portions which are part of a common
43 Definition of context:
44 A page header is a context.
45 A page footer is a context.
46 A footnote is a context.
47 Every fly frame builds a context together with its linked colleagues.
48 The content of the page bodies builds a context.
53 std::list
< SwPaM
* > aList
; // container for the selected text portions
54 const SwFrm
* pContext
; // the context of these text portions
56 /** Ctor to create an empty list for a given context
59 The frame (normally a SwTxtFrm) where the block cursor selection starts,
60 it will be used to get the allowed context for the text selections.
62 explicit SwSelectionList( const SwFrm
* pInitCxt
);
64 /** Start of the container for the selected text portions
66 std::list
<SwPaM
*>::iterator
getStart() { return aList
.begin(); }
68 /** End of the container for the selected text portions
70 std::list
<SwPaM
*>::iterator
getEnd() { return aList
.end(); }
72 /** Adds a text portion to the selection list
75 represents a text portion to select
77 void insertPaM( SwPaM
* pPam
) { aList
.push_front( pPam
); }
79 /** Reports if the list does not contain any text portion
81 @return true, if list is empty
83 bool isEmpty() const { return aList
.empty(); }
85 /** Checks if the context of the list is equal to the context of the frame
87 If the list does not have already a context, the context of the frame
88 will define the list's context.
89 If the list has already a context, it will be compared to the context of
95 @return true, if the context of the frame is equal to the one of the list
97 bool checkContext( const SwFrm
* pCheck
);
100 #endif //_SWSELECTIONLIST_HXX