21 #include <osl/diagnose.h>
23 #include <com/sun/star/beans/XPropertySet.hpp>
24 #include <com/sun/star/beans/XPropertyState.hpp>
25 #include <com/sun/star/beans/PropertyValue.hpp>
26 #include <com/sun/star/container/XIndexReplace.hpp>
27 #include <com/sun/star/style/NumberingType.hpp>
28 #include <com/sun/star/text/XTextContent.hpp>
29 #include <com/sun/star/container/XNamed.hpp>
41 : mbListIdIsDefault(
false)
42 , mnListStartValue( -1 )
44 , mbIsNumbered(
false )
45 , mbIsRestart(
false )
46 , mnListLevelStartValue( -1 )
47 , mbOutlineStyleAsNormalListStyle(
false )
54 const css::uno::Reference < css::text::XTextContent > & xTextContent,
55 const bool bOutlineStyleAsNormalListStyle,
57 const bool bExportTextNumberElement )
64 Reference<XPropertyState> xPropState(xTextContent, UNO_QUERY);
65 Reference< XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
68 if( !xPropSetInfo->hasPropertyByName(
"NumberingLevel" ) )
71 if( xPropSet->getPropertyValue(
"NumberingLevel" ) >>=
mnListLevel )
73 if( xPropSetInfo->hasPropertyByName(
"NumberingRules" ) )
75 xPropSet->getPropertyValue(
"NumberingRules" ) >>=
mxNumRules;
89 "<XMLTextNumRuleInfo::Set(..)> - numbering rules instance does not contain any numbering rule" );
97 "<XMLTextNumRuleInfo::Set(..)> - unexpected numbering level" );
103 bool bSuppressListStyle(
false );
109 if ( xNumRulesProps.is() &&
110 xNumRulesProps->getPropertySetInfo()->
111 hasPropertyByName(
"NumberingIsOutline" ) )
113 bool bIsOutline =
false;
114 xNumRulesProps->getPropertyValue(
"NumberingIsOutline" ) >>= bIsOutline;
115 bSuppressListStyle = bIsOutline;
127 Reference < XNamed > xNamed(
mxNumRules, UNO_QUERY );
129 "<XMLTextNumRuleInfo::Set(..)> - numbering rules instance have to be named. Serious defect." );
136 "<XMLTextNumRuleInfo::Set(..)> - no name found for numbering rules instance. Serious defect." );
138 if( xPropSetInfo->hasPropertyByName(
"ListId" ) )
140 xPropSet->getPropertyValue(
"ListId" ) >>=
msListId;
145 = xPropState->getPropertyState(
"ListId") == PropertyState_DEFAULT_VALUE;
150 if( xPropSetInfo->hasPropertyByName(
"ContinueingPreviousSubTree" ) )
156 if( xPropSetInfo->hasPropertyByName(
"NumberingIsNumber" ) )
158 if( !(xPropSet->getPropertyValue(
"NumberingIsNumber" ) >>=
mbIsNumbered ) )
160 OSL_FAIL(
"numbered paragraph without number info" );
167 if( xPropSetInfo->hasPropertyByName(
"ParaIsNumberingRestart" ) )
169 xPropSet->getPropertyValue(
"ParaIsNumberingRestart" ) >>=
mbIsRestart;
171 if( xPropSetInfo->hasPropertyByName(
"NumberingStartValue" ) )
177 OSL_ENSURE( mnListLevel < mxNumRules->getCount(),
"wrong num rule level" );
184 Sequence<PropertyValue> aProps;
187 auto pProp = std::find_if(std::cbegin(aProps), std::cend(aProps),
188 [](
const PropertyValue& rProp) {
return rProp.Name ==
"StartWith"; });
189 if (pProp != std::cend(aProps))
195 if ( bExportTextNumberElement &&
196 xPropSetInfo->hasPropertyByName(
"ListLabelString" ) )
bool mbOutlineStyleAsNormalListStyle
bool BelongsToSameList(const XMLTextNumRuleInfo &rCmp) const
sal_Int16 mnListLevelStartValue
css::uno::Reference< css::container::XIndexReplace > mxNumRules
bool mbContinueingPreviousSubTree
information about list and list style for a certain paragraph
sal_Int16 mnListStartValue
bool mbListIdIsDefault
msListId won't be referenced by later lists.
void Set(const css::uno::Reference< css::text::XTextContent > &rTextContent, const bool bOutlineStyleAsNormalListStyle, const XMLTextListAutoStylePool &rListAutoPool, const bool bExportTextNumberElement)
#define SAL_WARN_IF(condition, area, stream)
OUString msListLabelString
#define SAL_WARN(area, stream)
SAL_DLLPRIVATE sal_uInt32 Find(const XMLTextListAutoStylePoolEntry_Impl *pEntry) const
bool m_bDetectedRangeSegmentation false