Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _EDIMP_HXX
30 : : #define _EDIMP_HXX
31 : :
32 : : #include <tools/solar.h>
33 : : #include <o3tl/sorted_vector.hxx>
34 : :
35 : : class SwPaM;
36 : : class SwNodeIndex;
37 : :
38 : : // Macros to iterate over all ranges.
39 : : #define PCURCRSR (_pStartCrsr)
40 : :
41 : : #define FOREACHPAM_START(pCURSH) \
42 : : {\
43 : : SwPaM *_pStartCrsr = (pCURSH)->GetCrsr(), *__pStartCrsr = _pStartCrsr; \
44 : : do {
45 : :
46 : : #define FOREACHPAM_END() \
47 : : } while( (_pStartCrsr=(SwPaM *)_pStartCrsr->GetNext()) != __pStartCrsr ); \
48 : : }
49 : :
50 : :
51 : :
52 : : struct SwPamRange
53 : : {
54 : : sal_uLong nStart, nEnd;
55 : :
56 : : SwPamRange() : nStart( 0 ), nEnd( 0 ) {}
57 : 0 : SwPamRange( sal_uLong nS, sal_uLong nE ) : nStart( nS ), nEnd( nE ) {}
58 : :
59 : 0 : bool operator==( const SwPamRange& rRg ) const
60 : 0 : { return nStart == rRg.nStart ? true : false; }
61 : 0 : bool operator<( const SwPamRange& rRg ) const
62 : 0 : { return nStart < rRg.nStart ? true : false; }
63 : : };
64 : :
65 : 0 : class _SwPamRanges : public o3tl::sorted_vector<SwPamRange> {};
66 : :
67 : 0 : class SwPamRanges : private _SwPamRanges
68 : : {
69 : : public:
70 : : SwPamRanges( const SwPaM& rRing );
71 : :
72 : : void Insert( const SwNodeIndex& rIdx1, const SwNodeIndex& rIdx2 );
73 : : SwPaM& SetPam( sal_uInt16 nArrPos, SwPaM& rPam );
74 : :
75 : 0 : sal_uInt16 Count() const
76 : 0 : { return _SwPamRanges::size(); }
77 : 0 : SwPamRange operator[]( sal_uInt16 nPos ) const
78 : 0 : { return _SwPamRanges::operator[](nPos); }
79 : : };
80 : :
81 : :
82 : : #endif
83 : :
84 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|