merge the formfield patch from ooo-build
[ooovba.git] / sw / source / filter / html / htmlnum.hxx
blob823f08b63ebb1f9c6c6ad64266721f668d96afe0
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: htmlnum.hxx,v $
10 * $Revision: 1.4 $
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 ************************************************************************/
30 #ifndef _HTMLNUM_HXX
31 #define _HTMLNUM_HXX
33 #include <swtypes.hxx>
34 #include <string.h>
36 #define HTML_NUMBUL_MARGINLEFT (MM50*2 + MM50/2)
37 #define HTML_NUMBUL_INDENT (-MM50)
39 class SwTxtNode;
40 class SwNumRule;
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
50 public:
52 inline void Set( const SwHTMLNumRuleInfo& rInf );
53 void Set( const SwTxtNode& rTxtNd );
55 SwHTMLNumRuleInfo() :
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 );
72 inline void Clear();
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 )
97 Set( rInf );
98 return *this;
101 inline void SwHTMLNumRuleInfo::Set( const SwHTMLNumRuleInfo& rInf )
103 pNumRule = rInf.pNumRule;
104 nDeep = rInf.nDeep;
105 bRestart = rInf.bRestart;
106 bNumbered = rInf.bNumbered;
107 memcpy( &aNumStarts, &rInf.aNumStarts, sizeof( aNumStarts ) );
110 inline void SwHTMLNumRuleInfo::Clear()
112 pNumRule = 0;
113 nDeep = 0;
114 bRestart = bNumbered = sal_False;
115 memset( &aNumStarts, 0xff, sizeof( aNumStarts ) );
118 inline sal_uInt8 SwHTMLNumRuleInfo::GetLevel() const
120 return
121 (sal_uInt8)( pNumRule!=0 && nDeep != 0
122 ? ( nDeep<=MAXLEVEL ? nDeep-1 : MAXLEVEL - 1 )
123 : 0 );
126 inline void SwHTMLNumRuleInfo::SetNodeStartValue( sal_uInt8 nLvl, sal_uInt16 nVal )
128 aNumStarts[nLvl] = nVal;
132 #endif