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