1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef _XMLOFF_XMLTEXTNUMRULEINFO_HXX
29*cdf0e10cSrcweir #define _XMLOFF_XMLTEXTNUMRULEINFO_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <com/sun/star/uno/Reference.hxx>
32*cdf0e10cSrcweir #include <com/sun/star/container/XIndexReplace.hpp>
33*cdf0e10cSrcweir 
34*cdf0e10cSrcweir namespace com { namespace sun { namespace star {
35*cdf0e10cSrcweir 	namespace text { class XTextContent; }
36*cdf0e10cSrcweir } } }
37*cdf0e10cSrcweir #include <sal/types.h>
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir class XMLTextListAutoStylePool;
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir /** information about list and list style for a certain paragraph
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir     OD 2008-04-24 #refactorlists#
44*cdf0e10cSrcweir     Complete refactoring of the class and enhancement of the class for lists.
45*cdf0e10cSrcweir     These changes are considered by method <XMLTextParagraphExport::exportListChange(..)>
46*cdf0e10cSrcweir */
47*cdf0e10cSrcweir class XMLTextNumRuleInfo
48*cdf0e10cSrcweir {
49*cdf0e10cSrcweir     const ::rtl::OUString msNumberingRules;
50*cdf0e10cSrcweir     const ::rtl::OUString msNumberingLevel;
51*cdf0e10cSrcweir     const ::rtl::OUString msNumberingStartValue;
52*cdf0e10cSrcweir     const ::rtl::OUString msParaIsNumberingRestart;
53*cdf0e10cSrcweir     const ::rtl::OUString msNumberingIsNumber;
54*cdf0e10cSrcweir     const ::rtl::OUString msNumberingIsOutline;
55*cdf0e10cSrcweir     const ::rtl::OUString msPropNameListId;
56*cdf0e10cSrcweir     const ::rtl::OUString msPropNameStartWith;
57*cdf0e10cSrcweir     // --> OD 2008-11-26 #158694#
58*cdf0e10cSrcweir     const ::rtl::OUString msContinueingPreviousSubTree;
59*cdf0e10cSrcweir     const ::rtl::OUString msListLabelStringProp;
60*cdf0e10cSrcweir     // <--
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir     // numbering rules instance and its name
63*cdf0e10cSrcweir     ::com::sun::star::uno::Reference <
64*cdf0e10cSrcweir                         ::com::sun::star::container::XIndexReplace > mxNumRules;
65*cdf0e10cSrcweir     ::rtl::OUString     msNumRulesName;
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir     // paragraph's list attributes
68*cdf0e10cSrcweir     ::rtl::OUString     msListId;
69*cdf0e10cSrcweir     sal_Int16           mnListStartValue;
70*cdf0e10cSrcweir     sal_Int16           mnListLevel;
71*cdf0e10cSrcweir     sal_Bool            mbIsNumbered;
72*cdf0e10cSrcweir     sal_Bool            mbIsRestart;
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir     // numbering rules' attributes
75*cdf0e10cSrcweir     // --> OD 2008-05-07 #refactorlists#
76*cdf0e10cSrcweir     sal_Int16           mnListLevelStartValue;
77*cdf0e10cSrcweir     // <--
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir     // --> OD 2006-09-27 #i69627#
80*cdf0e10cSrcweir     sal_Bool mbOutlineStyleAsNormalListStyle;
81*cdf0e10cSrcweir     // <--
82*cdf0e10cSrcweir 
83*cdf0e10cSrcweir     // --> OD 2008-11-26 #158694#
84*cdf0e10cSrcweir     sal_Bool mbContinueingPreviousSubTree;
85*cdf0e10cSrcweir     ::rtl::OUString msListLabelString;
86*cdf0e10cSrcweir     // <--
87*cdf0e10cSrcweir public:
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir 	XMLTextNumRuleInfo();
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir 	inline XMLTextNumRuleInfo& operator=( const XMLTextNumRuleInfo& rInfo );
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir     // --> OD 2008-11-26 #158694#
94*cdf0e10cSrcweir     void Set( const ::com::sun::star::uno::Reference <
95*cdf0e10cSrcweir                         ::com::sun::star::text::XTextContent > & rTextContnt,
96*cdf0e10cSrcweir               const sal_Bool bOutlineStyleAsNormalListStyle,
97*cdf0e10cSrcweir               const XMLTextListAutoStylePool& rListAutoPool,
98*cdf0e10cSrcweir               const sal_Bool bExportTextNumberElement );
99*cdf0e10cSrcweir     // <--
100*cdf0e10cSrcweir 	inline void Reset();
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir     inline const ::rtl::OUString& GetNumRulesName() const
103*cdf0e10cSrcweir     {
104*cdf0e10cSrcweir         return msNumRulesName;
105*cdf0e10cSrcweir     }
106*cdf0e10cSrcweir     inline const ::com::sun::star::uno::Reference <
107*cdf0e10cSrcweir 		::com::sun::star::container::XIndexReplace >& GetNumRules() const
108*cdf0e10cSrcweir     {
109*cdf0e10cSrcweir         return mxNumRules;
110*cdf0e10cSrcweir     }
111*cdf0e10cSrcweir     inline sal_Int16 GetListLevelStartValue() const
112*cdf0e10cSrcweir     {
113*cdf0e10cSrcweir         return mnListLevelStartValue;
114*cdf0e10cSrcweir     }
115*cdf0e10cSrcweir 
116*cdf0e10cSrcweir     inline const ::rtl::OUString& GetListId() const
117*cdf0e10cSrcweir     {
118*cdf0e10cSrcweir         return msListId;
119*cdf0e10cSrcweir     }
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir     inline sal_Int16 GetLevel() const
122*cdf0e10cSrcweir     {
123*cdf0e10cSrcweir         return mnListLevel;
124*cdf0e10cSrcweir     }
125*cdf0e10cSrcweir 
126*cdf0e10cSrcweir     inline sal_Bool HasStartValue() const
127*cdf0e10cSrcweir     {
128*cdf0e10cSrcweir         return mnListStartValue != -1;
129*cdf0e10cSrcweir     }
130*cdf0e10cSrcweir     inline sal_uInt32 GetStartValue() const
131*cdf0e10cSrcweir     {
132*cdf0e10cSrcweir         return mnListStartValue;
133*cdf0e10cSrcweir     }
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir     inline sal_Bool IsNumbered() const
136*cdf0e10cSrcweir     {
137*cdf0e10cSrcweir         return mbIsNumbered;
138*cdf0e10cSrcweir     }
139*cdf0e10cSrcweir     inline sal_Bool IsRestart() const
140*cdf0e10cSrcweir     {
141*cdf0e10cSrcweir         return mbIsRestart;
142*cdf0e10cSrcweir     }
143*cdf0e10cSrcweir 
144*cdf0e10cSrcweir     sal_Bool BelongsToSameList( const XMLTextNumRuleInfo& rCmp ) const;
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir     inline sal_Bool HasSameNumRules( const XMLTextNumRuleInfo& rCmp ) const
147*cdf0e10cSrcweir     {
148*cdf0e10cSrcweir         return rCmp.msNumRulesName == msNumRulesName;
149*cdf0e10cSrcweir     }
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir     // --> OD 2008-11-26 #158694#
152*cdf0e10cSrcweir     inline sal_Bool IsContinueingPreviousSubTree() const
153*cdf0e10cSrcweir     {
154*cdf0e10cSrcweir         return mbContinueingPreviousSubTree;
155*cdf0e10cSrcweir     }
156*cdf0e10cSrcweir     inline const ::rtl::OUString& ListLabelString() const
157*cdf0e10cSrcweir     {
158*cdf0e10cSrcweir         return msListLabelString;
159*cdf0e10cSrcweir     }
160*cdf0e10cSrcweir     // <--
161*cdf0e10cSrcweir };
162*cdf0e10cSrcweir 
163*cdf0e10cSrcweir inline XMLTextNumRuleInfo& XMLTextNumRuleInfo::operator=(
164*cdf0e10cSrcweir 		const XMLTextNumRuleInfo& rInfo )
165*cdf0e10cSrcweir {
166*cdf0e10cSrcweir     msNumRulesName = rInfo.msNumRulesName;
167*cdf0e10cSrcweir     mxNumRules = rInfo.mxNumRules;
168*cdf0e10cSrcweir     msListId = rInfo.msListId;
169*cdf0e10cSrcweir     mnListStartValue = rInfo.mnListStartValue;
170*cdf0e10cSrcweir     mnListLevel = rInfo.mnListLevel;
171*cdf0e10cSrcweir     mbIsNumbered = rInfo.mbIsNumbered;
172*cdf0e10cSrcweir     mbIsRestart = rInfo.mbIsRestart;
173*cdf0e10cSrcweir     // --> OD 2006-09-27 #i69627#
174*cdf0e10cSrcweir     mbOutlineStyleAsNormalListStyle = rInfo.mbOutlineStyleAsNormalListStyle;
175*cdf0e10cSrcweir     // <--
176*cdf0e10cSrcweir     // --> OD 2008-11-26 #158694#
177*cdf0e10cSrcweir     mbContinueingPreviousSubTree = rInfo.mbContinueingPreviousSubTree;
178*cdf0e10cSrcweir     msListLabelString = rInfo.msListLabelString;
179*cdf0e10cSrcweir     // <--
180*cdf0e10cSrcweir 
181*cdf0e10cSrcweir 	return *this;
182*cdf0e10cSrcweir }
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir inline void XMLTextNumRuleInfo::Reset()
185*cdf0e10cSrcweir {
186*cdf0e10cSrcweir     mxNumRules = 0;
187*cdf0e10cSrcweir     msNumRulesName = ::rtl::OUString();
188*cdf0e10cSrcweir     msListId = ::rtl::OUString();
189*cdf0e10cSrcweir     mnListStartValue = -1;
190*cdf0e10cSrcweir     mnListLevel = 0;
191*cdf0e10cSrcweir     // --> OD 2006-09-27 #i69627#
192*cdf0e10cSrcweir     mbIsNumbered = mbIsRestart =
193*cdf0e10cSrcweir     mbOutlineStyleAsNormalListStyle = sal_False;
194*cdf0e10cSrcweir     // <--
195*cdf0e10cSrcweir     // --> OD 2008-11-26 #158694#
196*cdf0e10cSrcweir     mbContinueingPreviousSubTree = sal_False;
197*cdf0e10cSrcweir     msListLabelString = ::rtl::OUString();
198*cdf0e10cSrcweir     // <--
199*cdf0e10cSrcweir }
200*cdf0e10cSrcweir #endif	//  _XMLOFF_XMLTEXTNUMRULEINFO_HXX
201