update dev300-m58
[ooovba.git] / sw / source / core / inc / swselectionlist.hxx
blob22253bfa71731829f637c6202c12e53a2406e60d
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: swselectionlist.hxx,v $
10 * $Revision: 1.3 $
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
33 #include <list>
35 class SwPaM;
36 class SwFrm;
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
42 context.
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.
51 class SwSelectionList
53 std::list< SwPaM* > aList; // container for the selected text portions
54 const SwFrm* pContext; // the context of these text portions
55 public:
56 /** Ctor to create an empty list for a given context
58 @param pInitCxt
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
74 @param pPam
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
90 the given frame.
92 @param pCheck
93 The frame to check
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