LibreOffice Module sw (master)
1
sw
source
filter
html
htmlnum.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
#ifndef INCLUDED_SW_SOURCE_FILTER_HTML_HTMLNUM_HXX
20
#define INCLUDED_SW_SOURCE_FILTER_HTML_HTMLNUM_HXX
21
22
#include <
swtypes.hxx
>
23
#include <string.h>
24
25
#define HTML_NUMBER_BULLET_MARGINLEFT (o3tl::toTwips(125, o3tl::Length::mm10))
26
#define HTML_NUMBER_BULLET_INDENT (-o3tl::toTwips(5, o3tl::Length::mm))
27
28
class
SwTextNode
;
29
class
SwNumRule
;
30
31
// TODO: Unicode: Are these characters the correct ones?
32
#define HTML_BULLETCHAR_DISC (0xe008)
33
#define HTML_BULLETCHAR_CIRCLE (0xe009)
34
#define HTML_BULLETCHAR_SQUARE (0xe00b)
35
36
class
SwHTMLNumRuleInfo
37
{
38
sal_uInt16
m_aNumStarts
[
MAXLEVEL
];
39
SwNumRule
*
m_pNumRule
;
// current numbering
40
sal_uInt16
m_nDeep
;
// current numbering depth (1, 2, 3, ...)
41
bool
m_bRestart
;
// Export: restart numbering
42
bool
m_bNumbered
;
// Export: paragraph is numbered
43
44
public
:
45
46
inline
void
Set
(
const
SwHTMLNumRuleInfo
& rInf );
47
void
Set
(
const
SwTextNode
& rTextNd );
48
49
SwHTMLNumRuleInfo
() :
50
m_pNumRule
( nullptr ),
m_nDeep
( 0 ),
51
m_bRestart
( false ),
m_bNumbered
( false )
52
{
53
memset( &
m_aNumStarts
, 0xff,
sizeof
(
m_aNumStarts
) );
54
}
55
56
SwHTMLNumRuleInfo
(
const
SwHTMLNumRuleInfo
& rInf ) :
57
m_pNumRule
( rInf.
m_pNumRule
),
m_nDeep
( rInf.
m_nDeep
),
58
m_bRestart
( rInf.
m_bRestart
),
m_bNumbered
( rInf.
m_bNumbered
)
59
{
60
memcpy( &
m_aNumStarts
, &rInf.
m_aNumStarts
,
sizeof
(
m_aNumStarts
) );
61
}
62
63
explicit
SwHTMLNumRuleInfo
(
const
SwTextNode
& rTextNd ) {
Set
( rTextNd ); }
64
inline
SwHTMLNumRuleInfo
&
operator=
(
const
SwHTMLNumRuleInfo
& rInf );
65
66
inline
void
Clear
();
67
68
void
SetNumRule
(
const
SwNumRule
*pRule ) {
m_pNumRule
=
const_cast<
SwNumRule
*
>
(pRule); }
69
SwNumRule
*
GetNumRule
() {
return
m_pNumRule
; }
70
const
SwNumRule
*
GetNumRule
()
const
{
return
m_pNumRule
; }
71
72
void
SetDepth
( sal_uInt16 nDepth ) {
m_nDeep
= nDepth; }
73
sal_uInt16
GetDepth
()
const
{
return
m_nDeep
; }
74
void
IncDepth
() { ++
m_nDeep
; }
75
void
DecDepth
() {
if
(
m_nDeep
!=0) --
m_nDeep
; }
76
inline
sal_uInt8
GetLevel
()
const
;
77
78
bool
IsRestart
(
const
SwHTMLNumRuleInfo
& rPrev)
const
;
79
80
bool
IsNumbered
()
const
{
return
m_bNumbered
; }
81
82
inline
void
SetNodeStartValue
(
sal_uInt8
nLvl, sal_uInt16 nVal=USHRT_MAX );
83
sal_uInt16
GetNodeStartValue
(
sal_uInt8
nLvl )
const
{
return
m_aNumStarts
[nLvl]; }
84
};
85
86
inline
SwHTMLNumRuleInfo
&
SwHTMLNumRuleInfo::operator=
(
87
const
SwHTMLNumRuleInfo
& rInf )
88
{
89
Set
( rInf );
90
return
*
this
;
91
}
92
93
inline
void
SwHTMLNumRuleInfo::Set
(
const
SwHTMLNumRuleInfo
& rInf )
94
{
95
m_pNumRule
= rInf.
m_pNumRule
;
96
m_nDeep
= rInf.
m_nDeep
;
97
m_bRestart
= rInf.
m_bRestart
;
98
m_bNumbered
= rInf.
m_bNumbered
;
99
memcpy( &
m_aNumStarts
, &rInf.
m_aNumStarts
,
sizeof
(
m_aNumStarts
) );
100
}
101
102
inline
void
SwHTMLNumRuleInfo::Clear
()
103
{
104
m_pNumRule
=
nullptr
;
105
m_nDeep
= 0;
106
m_bRestart
=
m_bNumbered
=
false
;
107
memset( &
m_aNumStarts
, 0xff,
sizeof
(
m_aNumStarts
) );
108
}
109
110
inline
sal_uInt8
SwHTMLNumRuleInfo::GetLevel
()
const
111
{
112
return
113
static_cast<
sal_uInt8
>
(
m_pNumRule
!=
nullptr
&&
m_nDeep
!= 0
114
? (
m_nDeep
<=
MAXLEVEL
?
m_nDeep
-1 :
MAXLEVEL
- 1 )
115
: 0 );
116
}
117
118
inline
void
SwHTMLNumRuleInfo::SetNodeStartValue
(
sal_uInt8
nLvl, sal_uInt16 nVal )
119
{
120
m_aNumStarts
[nLvl] = nVal;
121
}
122
123
#endif
124
125
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwHTMLNumRuleInfo
Definition:
htmlnum.hxx:37
SwHTMLNumRuleInfo::m_nDeep
sal_uInt16 m_nDeep
Definition:
htmlnum.hxx:40
SwHTMLNumRuleInfo::GetNodeStartValue
sal_uInt16 GetNodeStartValue(sal_uInt8 nLvl) const
Definition:
htmlnum.hxx:83
SwHTMLNumRuleInfo::GetLevel
sal_uInt8 GetLevel() const
Definition:
htmlnum.hxx:110
SwHTMLNumRuleInfo::operator=
SwHTMLNumRuleInfo & operator=(const SwHTMLNumRuleInfo &rInf)
Definition:
htmlnum.hxx:86
SwHTMLNumRuleInfo::SwHTMLNumRuleInfo
SwHTMLNumRuleInfo()
Definition:
htmlnum.hxx:49
SwHTMLNumRuleInfo::m_pNumRule
SwNumRule * m_pNumRule
Definition:
htmlnum.hxx:39
SwHTMLNumRuleInfo::SetNumRule
void SetNumRule(const SwNumRule *pRule)
Definition:
htmlnum.hxx:68
SwHTMLNumRuleInfo::IsNumbered
bool IsNumbered() const
Definition:
htmlnum.hxx:80
SwHTMLNumRuleInfo::Set
void Set(const SwHTMLNumRuleInfo &rInf)
Definition:
htmlnum.hxx:93
SwHTMLNumRuleInfo::GetDepth
sal_uInt16 GetDepth() const
Definition:
htmlnum.hxx:73
SwHTMLNumRuleInfo::m_bNumbered
bool m_bNumbered
Definition:
htmlnum.hxx:42
SwHTMLNumRuleInfo::SetNodeStartValue
void SetNodeStartValue(sal_uInt8 nLvl, sal_uInt16 nVal=USHRT_MAX)
Definition:
htmlnum.hxx:118
SwHTMLNumRuleInfo::IsRestart
bool IsRestart(const SwHTMLNumRuleInfo &rPrev) const
Definition:
htmlnum.cxx:48
SwHTMLNumRuleInfo::m_aNumStarts
sal_uInt16 m_aNumStarts[MAXLEVEL]
Definition:
htmlnum.hxx:38
SwHTMLNumRuleInfo::GetNumRule
SwNumRule * GetNumRule()
Definition:
htmlnum.hxx:69
SwHTMLNumRuleInfo::Clear
void Clear()
Definition:
htmlnum.hxx:102
SwHTMLNumRuleInfo::m_bRestart
bool m_bRestart
Definition:
htmlnum.hxx:41
SwHTMLNumRuleInfo::SwHTMLNumRuleInfo
SwHTMLNumRuleInfo(const SwTextNode &rTextNd)
Definition:
htmlnum.hxx:63
SwHTMLNumRuleInfo::DecDepth
void DecDepth()
Definition:
htmlnum.hxx:75
SwHTMLNumRuleInfo::IncDepth
void IncDepth()
Definition:
htmlnum.hxx:74
SwHTMLNumRuleInfo::SetDepth
void SetDepth(sal_uInt16 nDepth)
Definition:
htmlnum.hxx:72
SwHTMLNumRuleInfo::GetNumRule
const SwNumRule * GetNumRule() const
Definition:
htmlnum.hxx:70
SwHTMLNumRuleInfo::SwHTMLNumRuleInfo
SwHTMLNumRuleInfo(const SwHTMLNumRuleInfo &rInf)
Definition:
htmlnum.hxx:56
SwNumRule
Definition:
numrule.hxx:94
SwTextNode
SwTextNode is a paragraph in the document model.
Definition:
ndtxt.hxx:112
swtypes.hxx
MAXLEVEL
constexpr sal_uInt8 MAXLEVEL
Definition:
swtypes.hxx:92
sal_uInt8
unsigned char sal_uInt8
Generated on Sun Jul 30 2023 04:29:14 for LibreOffice Module sw (master) by
1.9.3