xref: /trunk/main/sw/inc/edimp.hxx (revision 1d2dbeb0)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _EDIMP_HXX
25 #define _EDIMP_HXX
26 
27 #include <tools/solar.h>
28 #include <svl/svarray.hxx>
29 
30 class SwPaM;
31 class SwNodeIndex;
32 
33 /*
34  * MACROS um ueber alle Bereiche zu iterieren
35  */
36 #define PCURCRSR (_pStartCrsr)
37 
38 #define FOREACHPAM_START(pCURSH) \
39 	{\
40 		SwPaM *_pStartCrsr = (pCURSH)->GetCrsr(), *__pStartCrsr = _pStartCrsr; \
41 		do {
42 
43 #define FOREACHPAM_END() \
44 		} while( (_pStartCrsr=(SwPaM *)_pStartCrsr->GetNext()) != __pStartCrsr ); \
45 	}
46 
47 
48 
49 struct SwPamRange
50 {
51 	sal_uLong nStart, nEnd;
52 
SwPamRangeSwPamRange53 	SwPamRange() : nStart( 0 ), nEnd( 0 )	{}
SwPamRangeSwPamRange54 	SwPamRange( sal_uLong nS, sal_uLong nE ) : nStart( nS ), nEnd( nE )	{}
55 
operator ==SwPamRange56 	sal_Bool operator==( const SwPamRange& rRg )
57 		{ return nStart == rRg.nStart ? sal_True : sal_False; }
operator <SwPamRange58 	sal_Bool operator<( const SwPamRange& rRg )
59 		{ return nStart < rRg.nStart ? sal_True : sal_False; }
60 };
61 
62 SV_DECL_VARARR_SORT( _SwPamRanges, SwPamRange, 0, 1 )
63 
64 class SwPamRanges : private _SwPamRanges
65 {
66 public:
67 	SwPamRanges( const SwPaM& rRing );
68 
69 	void Insert( const SwNodeIndex& rIdx1, const SwNodeIndex& rIdx2 );
70 	SwPaM& SetPam( sal_uInt16 nArrPos, SwPaM& rPam );
71 
Count() const72 	sal_uInt16 Count() const
73 				{	return _SwPamRanges::Count(); }
operator [](sal_uInt16 nPos) const74 	SwPamRange operator[]( sal_uInt16 nPos ) const
75 				{ return _SwPamRanges::operator[](nPos); }
76 };
77 
78 
79 #endif
80