20#include <com/sun/star/container/XIndexReplace.hpp>
21#include <com/sun/star/style/XStyle.hpp>
22#include <com/sun/star/beans/XPropertySet.hpp>
46 const Reference< xml::sax::XFastAttributeList > & xAttrList,
47 const bool bRestartNumberingAtSubList )
49, mrTxtImport( rTxtImp )
51, mbRestartNumbering( false )
52, mbSetDefaults( false )
54 static constexpr OUStringLiteral s_PropNameDefaultListId =
u"DefaultListId";
65 OUString sParentListStyleName;
74 bRestartNumberingAtSubList;
80 bool bIsContinueNumberingAttributePresent(
false );
83 switch( aIter.getToken() )
95 bIsContinueNumberingAttributePresent =
true;
126 OUString sListStyleDefaultListId;
128 uno::Reference< beans::XPropertySet > xNumRuleProps(
mxNumRules, UNO_QUERY );
129 if ( xNumRuleProps.is() )
131 uno::Reference< beans::XPropertySetInfo > xNumRulePropSetInfo(
132 xNumRuleProps->getPropertySetInfo());
133 if (xNumRulePropSetInfo.is() &&
134 xNumRulePropSetInfo->hasPropertyByName(
135 s_PropNameDefaultListId))
137 xNumRuleProps->getPropertyValue(s_PropNameDefaultListId)
138 >>= sListStyleDefaultListId;
139 SAL_WARN_IF( sListStyleDefaultListId.isEmpty(),
"xmloff",
140 "no default list id found at numbering rules instance. Serious defect." );
147 sal_Int32 nBuild( 0 );
148 const bool bBuildIdFound =
GetImport().getBuildIds( nUPD, nBuild );
149 if ( rImport.IsTextDocInOOoFileFormat() ||
150 ( bBuildIdFound && nUPD == 680 ) )
156 if ( !sListStyleDefaultListId.isEmpty() )
159 if ( !bIsContinueNumberingAttributePresent &&
185 bool bContinueNumbering = bIsContinueNumberingAttributePresent && !
mbRestartNumbering;
205 while ( !sTmpStr.isEmpty() )
220 sListStyleDefaultListId );
223 catch (uno::Exception&)
255 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
259 bool bHeader =
false;
267 xAttrList, bHeader );
This class deliberately does not support XWeak, to improve performance when loading large documents.
SvXMLImport & GetImport()
XMLTextListsHelper & GetTextListHelper()
const css::uno::Reference< css::container::XIndexReplace > & GetNumRules() const
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
virtual ~XMLTextListBlockContext() override
rtl::Reference< XMLTextListBlockContext > mxParentListBlock
css::uno::Reference< css::container::XIndexReplace > mxNumRules
sal_Int16 GetLevel() const
const OUString & GetContinueListId() const
bool IsRestartNumbering() const
OUString msContinueListId
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
const OUString & GetListId() const
XMLTextListBlockContext(SvXMLImport &rImport, XMLTextImportHelper &rTxtImp, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, const bool bRestartNumberingAtSubList=false)
XMLTextImportHelper & mrTxtImport
void PopListContext()
pop the list context stack
const OUString & GetLastProcessedListId() const
void SetListItem(XMLTextListItemContext *pListItem)
set list item on top of the list context stack
void KeepListAsProcessed(const OUString &sListId, const OUString &sListStyleName, const OUString &sContinueListId, const OUString &sListStyleDefaultListId=OUString())
void PushListContext(XMLTextListBlockContext *i_pListBlock)
list stack for importing:
OUString GenerateNewListId() const
static css::uno::Reference< css::container::XIndexReplace > MakeNumRule(SvXMLImport &i_rImport, const css::uno::Reference< css::container::XIndexReplace > &i_xNumRule, std::u16string_view i_ParentStyleName, const OUString &i_StyleName, sal_Int16 &io_rLevel, bool *o_pRestartNumbering=nullptr, bool *io_pSetDefaults=nullptr)
Creates a NumRule from given style-name.
void ListContextTop(XMLTextListBlockContext *&o_pListBlockContext, XMLTextListItemContext *&o_pListItemContext, XMLNumberedParaContext *&o_pNumberedParagraphContext)
peek at the top of the list context stack
bool IsListProcessed(const OUString &sListId) const
OUString GetContinueListIdOfProcessedList(const OUString &sListId) const
const OUString & GetListStyleOfLastProcessedList() const
OUString GetLastIdOfStyleName(const OUString &sListStyleName) const
Looks up the last list id of a given list style, by name.
#define SAL_WARN_IF(condition, area, stream)
FastAttributeList & castToFastAttributeList(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
Handling of tokens in XML:
bool IsXMLToken(std::u16string_view rString, enum XMLTokenEnum eToken)
compare eToken to the string
#define XMLOFF_WARN_UNKNOWN_ELEMENT(area, token)
#define XMLOFF_WARN_UNKNOWN(area, rIter)
#define XML_ELEMENT(prefix, name)