1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _XMLOFF_XMLTEXTNUMRULEINFO_HXX
25 #define _XMLOFF_XMLTEXTNUMRULEINFO_HXX
26 
27 #include <com/sun/star/uno/Reference.hxx>
28 #include <com/sun/star/container/XIndexReplace.hpp>
29 
30 namespace com { namespace sun { namespace star {
31 	namespace text { class XTextContent; }
32 } } }
33 #include <sal/types.h>
34 
35 class XMLTextListAutoStylePool;
36 
37 /** information about list and list style for a certain paragraph
38 
39     OD 2008-04-24 #refactorlists#
40     Complete refactoring of the class and enhancement of the class for lists.
41     These changes are considered by method <XMLTextParagraphExport::exportListChange(..)>
42 */
43 class XMLTextNumRuleInfo
44 {
45     const ::rtl::OUString msNumberingRules;
46     const ::rtl::OUString msNumberingLevel;
47     const ::rtl::OUString msNumberingStartValue;
48     const ::rtl::OUString msParaIsNumberingRestart;
49     const ::rtl::OUString msNumberingIsNumber;
50     const ::rtl::OUString msNumberingIsOutline;
51     const ::rtl::OUString msPropNameListId;
52     const ::rtl::OUString msPropNameStartWith;
53     // --> OD 2008-11-26 #158694#
54     const ::rtl::OUString msContinueingPreviousSubTree;
55     const ::rtl::OUString msListLabelStringProp;
56     // <--
57 
58     // numbering rules instance and its name
59     ::com::sun::star::uno::Reference <
60                         ::com::sun::star::container::XIndexReplace > mxNumRules;
61     ::rtl::OUString     msNumRulesName;
62 
63     // paragraph's list attributes
64     ::rtl::OUString     msListId;
65     sal_Int16           mnListStartValue;
66     sal_Int16           mnListLevel;
67     sal_Bool            mbIsNumbered;
68     sal_Bool            mbIsRestart;
69 
70     // numbering rules' attributes
71     // --> OD 2008-05-07 #refactorlists#
72     sal_Int16           mnListLevelStartValue;
73     // <--
74 
75     // --> OD 2006-09-27 #i69627#
76     sal_Bool mbOutlineStyleAsNormalListStyle;
77     // <--
78 
79     // --> OD 2008-11-26 #158694#
80     sal_Bool mbContinueingPreviousSubTree;
81     ::rtl::OUString msListLabelString;
82     // <--
83 public:
84 
85 	XMLTextNumRuleInfo();
86 
87 	inline XMLTextNumRuleInfo& operator=( const XMLTextNumRuleInfo& rInfo );
88 
89     // --> OD 2008-11-26 #158694#
90     void Set( const ::com::sun::star::uno::Reference <
91                         ::com::sun::star::text::XTextContent > & rTextContnt,
92               const sal_Bool bOutlineStyleAsNormalListStyle,
93               const XMLTextListAutoStylePool& rListAutoPool,
94               const sal_Bool bExportTextNumberElement );
95     // <--
96 	inline void Reset();
97 
GetNumRulesName() const98     inline const ::rtl::OUString& GetNumRulesName() const
99     {
100         return msNumRulesName;
101     }
102     inline const ::com::sun::star::uno::Reference <
GetNumRules() const103 		::com::sun::star::container::XIndexReplace >& GetNumRules() const
104     {
105         return mxNumRules;
106     }
GetListLevelStartValue() const107     inline sal_Int16 GetListLevelStartValue() const
108     {
109         return mnListLevelStartValue;
110     }
111 
GetListId() const112     inline const ::rtl::OUString& GetListId() const
113     {
114         return msListId;
115     }
116 
GetLevel() const117     inline sal_Int16 GetLevel() const
118     {
119         return mnListLevel;
120     }
121 
HasStartValue() const122     inline sal_Bool HasStartValue() const
123     {
124         return mnListStartValue != -1;
125     }
GetStartValue() const126     inline sal_uInt32 GetStartValue() const
127     {
128         return mnListStartValue;
129     }
130 
IsNumbered() const131     inline sal_Bool IsNumbered() const
132     {
133         return mbIsNumbered;
134     }
IsRestart() const135     inline sal_Bool IsRestart() const
136     {
137         return mbIsRestart;
138     }
139 
140     sal_Bool BelongsToSameList( const XMLTextNumRuleInfo& rCmp ) const;
141 
HasSameNumRules(const XMLTextNumRuleInfo & rCmp) const142     inline sal_Bool HasSameNumRules( const XMLTextNumRuleInfo& rCmp ) const
143     {
144         return rCmp.msNumRulesName == msNumRulesName;
145     }
146 
147     // --> OD 2008-11-26 #158694#
IsContinueingPreviousSubTree() const148     inline sal_Bool IsContinueingPreviousSubTree() const
149     {
150         return mbContinueingPreviousSubTree;
151     }
ListLabelString() const152     inline const ::rtl::OUString& ListLabelString() const
153     {
154         return msListLabelString;
155     }
156     // <--
157 };
158 
operator =(const XMLTextNumRuleInfo & rInfo)159 inline XMLTextNumRuleInfo& XMLTextNumRuleInfo::operator=(
160 		const XMLTextNumRuleInfo& rInfo )
161 {
162     msNumRulesName = rInfo.msNumRulesName;
163     mxNumRules = rInfo.mxNumRules;
164     msListId = rInfo.msListId;
165     mnListStartValue = rInfo.mnListStartValue;
166     mnListLevel = rInfo.mnListLevel;
167     mbIsNumbered = rInfo.mbIsNumbered;
168     mbIsRestart = rInfo.mbIsRestart;
169     // --> OD 2006-09-27 #i69627#
170     mbOutlineStyleAsNormalListStyle = rInfo.mbOutlineStyleAsNormalListStyle;
171     // <--
172     // --> OD 2008-11-26 #158694#
173     mbContinueingPreviousSubTree = rInfo.mbContinueingPreviousSubTree;
174     msListLabelString = rInfo.msListLabelString;
175     // <--
176 
177 	return *this;
178 }
179 
Reset()180 inline void XMLTextNumRuleInfo::Reset()
181 {
182     mxNumRules = 0;
183     msNumRulesName = ::rtl::OUString();
184     msListId = ::rtl::OUString();
185     mnListStartValue = -1;
186     mnListLevel = 0;
187     // --> OD 2006-09-27 #i69627#
188     mbIsNumbered = mbIsRestart =
189     mbOutlineStyleAsNormalListStyle = sal_False;
190     // <--
191     // --> OD 2008-11-26 #158694#
192     mbContinueingPreviousSubTree = sal_False;
193     msListLabelString = ::rtl::OUString();
194     // <--
195 }
196 #endif	//  _XMLOFF_XMLTEXTNUMRULEINFO_HXX
197