LibreOffice Module sw (master)  1
swcont.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_SWCONT_HXX
21 #define INCLUDED_SW_SOURCE_UIBASE_INC_SWCONT_HXX
22 
23 #include <rtl/ustring.hxx>
24 #include <vcl/lstbox.hxx>
25 
26 class SwContentType;
27 
28 enum class ContentTypeId
29 {
30  OUTLINE = 0,
31  TABLE = 1,
32  FRAME = 2,
33  GRAPHIC = 3,
34  OLE = 4,
35  BOOKMARK = 5,
36  REGION = 6,
37  URLFIELD = 7,
38  REFERENCE = 8,
39  INDEX = 9,
40  POSTIT = 10,
41  DRAWOBJECT = 11,
42  LAST = DRAWOBJECT,
43  UNKNOWN = -1
44 };
45 
46 // strings for context menus
47 #define CONTEXT_COUNT 13
48 #define GLOBAL_CONTEXT_COUNT 14
49 
50 // modes for Drag 'n Drop
51 enum class RegionMode
52 {
53  NONE = 0,
54  LINK = 1,
55  EMBEDDED = 2
56 };
57 
58 //mini rtti
60 {
62 
63  public:
64  SwTypeNumber(sal_uInt8 nId) :nTypeId(nId){}
65  virtual ~SwTypeNumber();
66 
67  sal_uInt8 GetTypeId() const { return nTypeId;}
68 };
69 
70 class SwContent : public SwTypeNumber
71 {
73  OUString const sContentName;
74  long const nYPosition;
75  // some subclasses appear to use this for a tools/gen.hxx-style
76  // geometric Y position, while e.g. SwOutlineContent wants to store
77  // the index in its subtree
78  bool bInvisible;
79 public:
80  SwContent(const SwContentType* pCnt, const OUString& rName, long nYPos );
81 
82  virtual bool IsProtect() const;
83  const SwContentType* GetParent() const {return pParent;}
84  const OUString& GetName() const {return sContentName;}
85  bool operator==(const SwContent& /*rCont*/) const
86  {
87  // they're never equal, otherwise they'd fall out of the array
88  return false;
89  }
90  bool operator<(const SwContent& rCont) const
91  {
92  // at first sort by position and then by name
93  if (nYPosition != rCont.nYPosition)
94  return nYPosition < rCont.nYPosition;
95  return ListBox::NaturalSortCompare(sContentName, rCont.sContentName) < 0;
96  }
97 
98  bool IsInvisible() const {return bInvisible;}
99  void SetInvisible(){ bInvisible = true;}
100 };
101 
102 #endif
103 
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ContentTypeId
Definition: swcont.hxx:28
bool bInvisible
Definition: swcont.hxx:78
OUString const sContentName
Definition: swcont.hxx:73
SwTypeNumber(sal_uInt8 nId)
Definition: swcont.hxx:64
bool operator==(const SwContent &) const
Definition: swcont.hxx:85
bool operator<(const SwContent &rCont) const
Definition: swcont.hxx:90
SwContent(const SwContentType *pCnt, const OUString &rName, long nYPos)
Definition: content.cxx:176
virtual ~SwTypeNumber()
Definition: content.cxx:186
const SwContentType * GetParent() const
Definition: swcont.hxx:83
const SwContentType * pParent
Definition: swcont.hxx:72
RegionMode
Definition: swcont.hxx:51
Content type, knows it's contents and the WrtShell.
Definition: content.hxx:139
virtual bool IsProtect() const
Definition: content.cxx:190
sal_uInt8 GetTypeId() const
Definition: swcont.hxx:67
sal_uInt8 const nTypeId
Definition: swcont.hxx:61
const OUString & GetName() const
Definition: swcont.hxx:84
unsigned char sal_uInt8
long const nYPosition
Definition: swcont.hxx:74
static sal_Int32 NaturalSortCompare(const OUString &rA, const OUString &rB)
void SetInvisible()
Definition: swcont.hxx:99
bool IsInvisible() const
Definition: swcont.hxx:98