1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: htmlnum.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
33 #include <swtypes.hxx>
36 #define HTML_NUMBUL_MARGINLEFT (MM50*2 + MM50/2)
37 #define HTML_NUMBUL_INDENT (-MM50)
42 class SwHTMLNumRuleInfo
44 sal_uInt16 aNumStarts
[MAXLEVEL
];
45 SwNumRule
* pNumRule
; // Aktuelle Numerierung
46 sal_uInt16 nDeep
; // aktuelle Num-Tiefe (1, 2, 3, ...)
47 sal_Bool bRestart
: 1; // Export: Numerierung neu starten
48 sal_Bool bNumbered
: 1; // Export: Absatz ist numeriert
52 inline void Set( const SwHTMLNumRuleInfo
& rInf
);
53 void Set( const SwTxtNode
& rTxtNd
);
56 pNumRule( 0 ), nDeep( 0 ),
57 bRestart( sal_False
), bNumbered( sal_False
)
59 memset( &aNumStarts
, 0xff, sizeof( aNumStarts
) );
62 SwHTMLNumRuleInfo( const SwHTMLNumRuleInfo
& rInf
) :
63 pNumRule( rInf
.pNumRule
), nDeep( rInf
.nDeep
),
64 bRestart( rInf
.bRestart
), bNumbered( rInf
.bNumbered
)
66 memcpy( &aNumStarts
, &rInf
.aNumStarts
, sizeof( aNumStarts
) );
69 SwHTMLNumRuleInfo( const SwTxtNode
& rTxtNd
) { Set( rTxtNd
); }
70 inline SwHTMLNumRuleInfo
& operator=( const SwHTMLNumRuleInfo
& rInf
);
74 void SetNumRule( const SwNumRule
*pRule
) { pNumRule
= (SwNumRule
*)pRule
; }
75 SwNumRule
*GetNumRule() { return pNumRule
; }
76 const SwNumRule
*GetNumRule() const { return pNumRule
; }
78 void SetDepth( sal_uInt16 nDepth
) { nDeep
= nDepth
; }
79 sal_uInt16
GetDepth() const { return nDeep
; }
80 sal_uInt16
IncDepth() { return ++nDeep
; }
81 sal_uInt16
DecDepth() { return nDeep
==0 ? 0 : --nDeep
; }
82 inline sal_uInt8
GetLevel() const;
84 void SetRestart( sal_Bool bSet
) { bRestart
= bSet
; }
85 sal_Bool
IsRestart() const { return bRestart
; }
87 void SetNumbered( sal_Bool bSet
) { bNumbered
= bSet
; }
88 sal_Bool
IsNumbered() const { return bNumbered
; }
90 inline void SetNodeStartValue( sal_uInt8 nLvl
, sal_uInt16 nVal
=USHRT_MAX
);
91 sal_uInt16
GetNodeStartValue( sal_uInt8 nLvl
) const { return aNumStarts
[nLvl
]; }
94 inline SwHTMLNumRuleInfo
& SwHTMLNumRuleInfo::operator=(
95 const SwHTMLNumRuleInfo
& rInf
)
101 inline void SwHTMLNumRuleInfo::Set( const SwHTMLNumRuleInfo
& rInf
)
103 pNumRule
= rInf
.pNumRule
;
105 bRestart
= rInf
.bRestart
;
106 bNumbered
= rInf
.bNumbered
;
107 memcpy( &aNumStarts
, &rInf
.aNumStarts
, sizeof( aNumStarts
) );
110 inline void SwHTMLNumRuleInfo::Clear()
114 bRestart
= bNumbered
= sal_False
;
115 memset( &aNumStarts
, 0xff, sizeof( aNumStarts
) );
118 inline sal_uInt8
SwHTMLNumRuleInfo::GetLevel() const
121 (sal_uInt8
)( pNumRule
!=0 && nDeep
!= 0
122 ? ( nDeep
<=MAXLEVEL
? nDeep
-1 : MAXLEVEL
- 1 )
126 inline void SwHTMLNumRuleInfo::SetNodeStartValue( sal_uInt8 nLvl
, sal_uInt16 nVal
)
128 aNumStarts
[nLvl
] = nVal
;