Avoid potential negative array index access to cached text.
[LibreOffice.git] / xmloff / source / text / XMLTextNumRuleInfo.hxx
blob7cbc3cf8d4fbe05c16fc30f543e977a774736d88
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #pragma once
22 #include <com/sun/star/uno/Reference.hxx>
23 #include <com/sun/star/container/XIndexReplace.hpp>
24 #include <sal/types.h>
26 namespace com::sun::star {
27 namespace text { class XTextContent; }
30 class XMLTextListAutoStylePool;
32 /** information about list and list style for a certain paragraph
34 OD 2008-04-24 #refactorlists#
35 Complete refactoring of the class and enhancement of the class for lists.
36 These changes are considered by method <XMLTextParagraphExport::exportListChange(..)>
38 class XMLTextNumRuleInfo
40 // numbering rules instance and its name
41 css::uno::Reference < css::container::XIndexReplace > mxNumRules;
42 OUString msNumRulesName;
44 // paragraph's list attributes
45 OUString msListId;
46 /// msListId won't be referenced by later lists.
47 bool mbListIdIsDefault;
48 sal_Int16 mnListStartValue;
49 sal_Int16 mnListLevel;
50 bool mbIsNumbered;
51 bool mbIsRestart;
53 // numbering rules' attributes
54 sal_Int16 mnListLevelStartValue;
56 // Written OpenDocument file format doesn't fit to the created text document (#i69627#)
57 bool mbOutlineStyleAsNormalListStyle;
59 bool mbContinueingPreviousSubTree;
60 OUString msListLabelString;
62 public:
64 XMLTextNumRuleInfo();
66 inline XMLTextNumRuleInfo& operator=( const XMLTextNumRuleInfo& rInfo );
68 void Set( const css::uno::Reference < css::text::XTextContent > & rTextContent,
69 bool bOutlineStyleAsNormalListStyle,
70 const XMLTextListAutoStylePool& rListAutoPool,
71 bool bExportTextNumberElement,
72 bool bListIdIsDefault );
73 inline void Reset();
75 const OUString& GetNumRulesName() const
77 return msNumRulesName;
79 sal_Int16 GetListLevelStartValue() const
81 return mnListLevelStartValue;
84 const OUString& GetListId() const
86 return msListId;
89 bool IsListIdDefault() const { return mbListIdIsDefault; }
91 sal_Int16 GetLevel() const
93 return mnListLevel;
96 bool HasStartValue() const
98 return mnListStartValue != -1;
100 sal_uInt32 GetStartValue() const
102 return mnListStartValue;
105 bool IsNumbered() const
107 return mbIsNumbered;
109 bool IsRestart() const
111 return mbIsRestart;
114 bool BelongsToSameList( const XMLTextNumRuleInfo& rCmp ) const;
116 bool IsContinueingPreviousSubTree() const
118 return mbContinueingPreviousSubTree;
120 const OUString& ListLabelString() const
122 return msListLabelString;
126 inline XMLTextNumRuleInfo& XMLTextNumRuleInfo::operator=(
127 const XMLTextNumRuleInfo& rInfo )
129 msNumRulesName = rInfo.msNumRulesName;
130 mxNumRules = rInfo.mxNumRules;
131 msListId = rInfo.msListId;
132 mnListStartValue = rInfo.mnListStartValue;
133 mnListLevel = rInfo.mnListLevel;
134 mbIsNumbered = rInfo.mbIsNumbered;
135 mbIsRestart = rInfo.mbIsRestart;
136 // Written OpenDocument file format doesn't fit to the created text document (#i69627#)
137 mbOutlineStyleAsNormalListStyle = rInfo.mbOutlineStyleAsNormalListStyle;
138 mbContinueingPreviousSubTree = rInfo.mbContinueingPreviousSubTree;
139 msListLabelString = rInfo.msListLabelString;
141 return *this;
144 inline void XMLTextNumRuleInfo::Reset()
146 mxNumRules = nullptr;
147 msNumRulesName.clear();
148 msListId.clear();
149 mnListStartValue = -1;
150 mnListLevel = 0;
151 // Written OpenDocument file format doesn't fit to the created text document (#i69627#)
152 mbIsNumbered = mbIsRestart =
153 mbOutlineStyleAsNormalListStyle = false;
154 mbContinueingPreviousSubTree = false;
155 msListLabelString.clear();
158 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */