xref: /aoo4110/main/sw/inc/edglbldc.hxx (revision b1cdbd2c)
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 #ifndef _EDGLBLDC_HXX
24 #define _EDGLBLDC_HXX
25 
26 #include <svl/svarray.hxx>
27 
28 class SwSection;
29 class SwTOXBase;
30 class SwTOXBaseSection;
31 
32 enum GlobalDocContentType {
33 	GLBLDOC_UNKNOWN,
34 	GLBLDOC_TOXBASE,
35 	GLBLDOC_SECTION
36 };
37 
38 class SwGlblDocContent
39 {
40 	GlobalDocContentType eType;
41 	sal_uLong nDocPos;
42 	union {
43 		const SwTOXBase* pTOX;
44 		const SwSection* pSect;
45 	} PTR;
46 
47 public:
48 	SwGlblDocContent( sal_uLong nPos );
49 	SwGlblDocContent( const SwTOXBaseSection* pTOX );
50 	SwGlblDocContent( const SwSection* pSect );
51 
52 	// Inhalte abfragen
GetType() const53 	GlobalDocContentType GetType() const { return eType; }
GetSection() const54 	const SwSection* GetSection() const
55 							{ return GLBLDOC_SECTION == eType ? PTR.pSect : 0; }
GetTOX() const56 	const SwTOXBase* GetTOX() const
57 							{ return GLBLDOC_TOXBASE == eType ? PTR.pTOX : 0; }
GetDocPos() const58 	sal_uLong GetDocPos() const { return nDocPos; }
59 
60 	// fuers Sortieren
operator ==(const SwGlblDocContent & rCmp) const61     inline int operator==( const SwGlblDocContent& rCmp ) const
62 		{	return GetDocPos() == rCmp.GetDocPos(); }
operator <(const SwGlblDocContent & rCmp) const63     inline int operator<( const SwGlblDocContent& rCmp ) const
64 		{	return GetDocPos() < rCmp.GetDocPos(); }
65 };
66 
67 
68 typedef SwGlblDocContent* SwGlblDocContentPtr;
69 SV_DECL_PTRARR_SORT_DEL( SwGlblDocContents, SwGlblDocContentPtr, 10, 10 )
70 
71 
72 
73 #endif
74