Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / source / uibase / inc / swcont.hxx
blobb29489f098c332bf6fbbae3eec5472b4a38f7e89
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 .
20 #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_SWCONT_HXX
21 #define INCLUDED_SW_SOURCE_UIBASE_INC_SWCONT_HXX
23 #include <rtl/ustring.hxx>
24 #include <tools/long.hxx>
25 #include <vcl/naturalsort.hxx>
27 class SwContentType;
29 enum class ContentTypeId
31 OUTLINE = 0,
32 TABLE = 1,
33 FRAME = 2,
34 GRAPHIC = 3,
35 OLE = 4,
36 BOOKMARK = 5,
37 REGION = 6,
38 URLFIELD = 7,
39 REFERENCE = 8,
40 INDEX = 9,
41 POSTIT = 10,
42 DRAWOBJECT = 11,
43 TEXTFIELD = 12,
44 FOOTNOTE = 13,
45 ENDNOTE = 14,
46 LAST = ENDNOTE,
47 UNKNOWN = -1
50 // strings for context menus
51 #define CONTEXT_COUNT 17
52 #define GLOBAL_CONTEXT_COUNT 14
54 // modes for Drag 'n Drop
55 enum class RegionMode
57 NONE = 0,
58 LINK = 1,
59 EMBEDDED = 2
62 //mini rtti
63 class SwTypeNumber
65 sal_uInt8 m_nTypeId;
67 public:
68 SwTypeNumber(sal_uInt8 nId) :m_nTypeId(nId){}
69 virtual ~SwTypeNumber();
71 sal_uInt8 GetTypeId() const { return m_nTypeId;}
74 class SwContent : public SwTypeNumber
76 const SwContentType* m_pParent;
77 OUString m_sContentName;
78 double m_nYPosition;
79 // some subclasses appear to use this for a tools/gen.hxx-style
80 // geometric Y position, while e.g. SwOutlineContent wants to store
81 // the index in its subtree
82 bool m_bInvisible;
83 public:
84 SwContent(const SwContentType* pCnt, OUString aName, double nYPos);
86 virtual bool IsProtect() const;
87 const SwContentType* GetParent() const {return m_pParent;}
88 const OUString& GetName() const {return m_sContentName;}
89 bool operator==(const SwContent& /*rCont*/) const
91 // they're never equal, otherwise they'd fall out of the array
92 return false;
94 bool operator<(const SwContent& rCont) const
96 // at first sort by position and then by name
97 if (m_nYPosition != rCont.m_nYPosition)
98 return m_nYPosition < rCont.m_nYPosition;
99 return vcl::NaturalSortCompare(m_sContentName, rCont.m_sContentName) < 0;
102 bool IsInvisible() const {return m_bInvisible;}
103 void SetInvisible(){ m_bInvisible = true;}
106 #endif
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */