1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #include "SchXMLTextListContext.hxx"
21 #include "SchXMLParagraphContext.hxx"
23 #include <xmloff/xmlnamespace.hxx>
24 #include <xmloff/xmltoken.hxx>
25 #include <xmloff/xmlimp.hxx>
26 #include <xmloff/xmlictxt.hxx>
27 #include <sal/log.hxx>
29 using ::com::sun::star::uno::Sequence
;
30 using ::com::sun::star::uno::Reference
;
31 using namespace com::sun::star
;
32 using namespace ::xmloff::token
;
36 class SchXMLListItemContext
: public SvXMLImportContext
39 SchXMLListItemContext( SvXMLImport
& rImport
, OUString
& rText
);
41 virtual css::uno::Reference
< css::xml::sax::XFastContextHandler
> SAL_CALL
createFastChildContext(
43 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& AttrList
) override
;
51 SchXMLListItemContext::SchXMLListItemContext(
54 : SvXMLImportContext( rImport
)
59 css::uno::Reference
< css::xml::sax::XFastContextHandler
> SchXMLListItemContext::createFastChildContext(
61 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& )
63 SvXMLImportContext
* pContext
= nullptr;
64 if( nElement
== XML_ELEMENT(TEXT
, XML_P
) ||
65 nElement
== XML_ELEMENT(LO_EXT
, XML_P
) )
66 pContext
= new SchXMLParagraphContext( GetImport(), m_rText
);
68 XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement
);
72 SchXMLTextListContext::SchXMLTextListContext(
74 , Sequence
< OUString
>& rTextList
)
75 : SvXMLImportContext( rImport
)
76 , m_rTextList( rTextList
)
80 SchXMLTextListContext::~SchXMLTextListContext()
84 void SchXMLTextListContext::endFastElement(sal_Int32
)
86 sal_Int32 nCount
= m_aTextVector
.size();
87 m_rTextList
.realloc(nCount
);
88 auto pTextList
= m_rTextList
.getArray();
89 for( sal_Int32 nN
=0; nN
<nCount
; nN
++ )
90 pTextList
[nN
]=m_aTextVector
[nN
];
93 css::uno::Reference
< css::xml::sax::XFastContextHandler
> SchXMLTextListContext::createFastChildContext(
95 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& )
97 SvXMLImportContext
* pContext
= nullptr;
98 if( nElement
== XML_ELEMENT(TEXT
, XML_LIST_ITEM
) )
100 m_aTextVector
.emplace_back( );
101 pContext
= new SchXMLListItemContext( GetImport(), m_aTextVector
.back() );
104 XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement
);
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */