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 : : #ifndef _EDGLBLDC_HXX
29 : : #define _EDGLBLDC_HXX
30 : :
31 : : #include <o3tl/sorted_vector.hxx>
32 : :
33 : : class SwSection;
34 : : class SwTOXBase;
35 : : class SwTOXBaseSection;
36 : :
37 : : enum GlobalDocContentType {
38 : : GLBLDOC_UNKNOWN,
39 : : GLBLDOC_TOXBASE,
40 : : GLBLDOC_SECTION
41 : : };
42 : :
43 : : class SwGlblDocContent
44 : : {
45 : : GlobalDocContentType eType;
46 : : sal_uLong nDocPos;
47 : : union {
48 : : const SwTOXBase* pTOX;
49 : : const SwSection* pSect;
50 : : } PTR;
51 : :
52 : : public:
53 : : SwGlblDocContent( sal_uLong nPos );
54 : : SwGlblDocContent( const SwTOXBaseSection* pTOX );
55 : : SwGlblDocContent( const SwSection* pSect );
56 : :
57 : : // Query contents.
58 : 0 : GlobalDocContentType GetType() const { return eType; }
59 : 0 : const SwSection* GetSection() const
60 [ # # ]: 0 : { return GLBLDOC_SECTION == eType ? PTR.pSect : 0; }
61 : 0 : const SwTOXBase* GetTOX() const
62 [ # # ]: 0 : { return GLBLDOC_TOXBASE == eType ? PTR.pTOX : 0; }
63 : 0 : sal_uLong GetDocPos() const { return nDocPos; }
64 : :
65 : : // For sorting.
66 : 0 : inline int operator==( const SwGlblDocContent& rCmp ) const
67 : 0 : { return GetDocPos() == rCmp.GetDocPos(); }
68 : 0 : inline int operator<( const SwGlblDocContent& rCmp ) const
69 : 0 : { return GetDocPos() < rCmp.GetDocPos(); }
70 : : };
71 : :
72 : :
73 : 0 : class SwGlblDocContents : public o3tl::sorted_vector<SwGlblDocContent*, o3tl::less_ptr_to<SwGlblDocContent> > {
74 : : public:
75 [ # # ]: 0 : ~SwGlblDocContents() { DeleteAndDestroyAll(); }
76 : : };
77 : :
78 : : #endif
79 : :
80 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|