Branch libreoffice-5-0-4
[LibreOffice.git] / sw / inc / edglbldc.hxx
blob42b3f0b1bf37f1ba508eda956463aaeb2a90b71d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_SW_INC_EDGLBLDC_HXX
20 #define INCLUDED_SW_INC_EDGLBLDC_HXX
22 #include <o3tl/sorted_vector.hxx>
24 class SwSection;
25 class SwTOXBase;
26 class SwTOXBaseSection;
28 enum GlobalDocContentType {
29 GLBLDOC_UNKNOWN,
30 GLBLDOC_TOXBASE,
31 GLBLDOC_SECTION
34 class SwGlblDocContent
36 GlobalDocContentType eType;
37 sal_uLong nDocPos;
38 union {
39 const SwTOXBase* pTOX;
40 const SwSection* pSect;
41 } PTR;
43 public:
44 SwGlblDocContent( sal_uLong nPos );
45 SwGlblDocContent( const SwTOXBaseSection* pTOX );
46 SwGlblDocContent( const SwSection* pSect );
48 /// Query contents.
49 GlobalDocContentType GetType() const { return eType; }
50 const SwSection* GetSection() const
51 { return GLBLDOC_SECTION == eType ? PTR.pSect : 0; }
52 const SwTOXBase* GetTOX() const
53 { return GLBLDOC_TOXBASE == eType ? PTR.pTOX : 0; }
54 sal_uLong GetDocPos() const { return nDocPos; }
56 /// For sorting.
57 inline bool operator==( const SwGlblDocContent& rCmp ) const
58 { return GetDocPos() == rCmp.GetDocPos(); }
59 inline bool operator<( const SwGlblDocContent& rCmp ) const
60 { return GetDocPos() < rCmp.GetDocPos(); }
63 class SwGlblDocContents : public o3tl::sorted_vector<SwGlblDocContent*, o3tl::less_ptr_to<SwGlblDocContent> > {
64 public:
65 ~SwGlblDocContents() { DeleteAndDestroyAll(); }
68 #endif
70 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */