21#include <com/sun/star/frame/XModel.hpp>
22#include <com/sun/star/lang/XMultiServiceFactory.hpp>
23#include <com/sun/star/lang/IllegalArgumentException.hpp>
24#include <com/sun/star/uno/XInterface.hpp>
25#include <com/sun/star/text/XTextContent.hpp>
26#include <com/sun/star/beans/XPropertySet.hpp>
47#include <rtl/ustring.hxx>
48#include <osl/diagnose.h>
55using ::com::sun::star::beans::XPropertySet;
56using ::com::sun::star::uno::Reference;
57using ::com::sun::star::xml::sax::XAttributeList;
58using ::com::sun::star::lang::XMultiServiceFactory;
59using ::com::sun::star::lang::IllegalArgumentException;
64 "com.sun.star.text.ContentIndex",
65 "com.sun.star.text.DocumentIndex",
66 "com.sun.star.text.TableIndex",
67 "com.sun.star.text.ObjectIndex",
68 "com.sun.star.text.Bibliography",
69 "com.sun.star.text.UserIndex",
70 "com.sun.star.text.IllustrationsIndex"
111 "service and source element maps must be same size");
123 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
131 bool bProtected =
false;
137 switch(aIter.getToken())
141 pStyle =
GetImport().GetTextImport()->FindSectionStyle(
156 sIndexName = aIter.toString();
161 sXmlId = aIter.toString();
174 Reference<XInterface> xIfc =
180 Reference<XPropertySet> xPropSet(xIfc, UNO_QUERY);
192 OUString
const sMarker(
" ");
194 OUString
const sMarker(
"Y");
200 Reference<XTextContent> xTextContent(xIfc, UNO_QUERY);
203 GetImport().GetTextImport()->InsertTextContent(
206 catch(
const IllegalArgumentException& e)
209 Sequence<OUString>
aSeq { SvXMLImport::getNameFromToken(nElement) };
212 aSeq, e.Message,
nullptr );
223 rImport->InsertString(sMarker);
224 rImport->GetCursor()->goLeft(2,
false);
231 GetImport().GetTextImport()->RedlineAdjustStartNodeCursor();
233 if (pStyle !=
nullptr)
240 if (!sIndexName.isEmpty())
258 rHelper->GetCursor()->goRight(1,
false);
261 rHelper->GetCursor()->goLeft(1,
true);
262 rHelper->GetText()->insertString(rHelper->GetCursorAsRange(),
267 rHelper->GetCursor()->goRight(1,
true);
268 rHelper->GetText()->insertString(rHelper->GetCursorAsRange(),
272 GetImport().GetTextImport()->RedlineAdjustStartNodeCursor();
277 const css::uno::Reference< css::xml::sax::XFastAttributeList >& )
288 xContext = xNewBodyContext;
335 OSL_FAIL(
"index type not implemented");
SvXMLEnumMapEntry< IndexTypeEnum > const aIndexTypeMap[]
static const char * aIndexServiceMap[]
const XMLTokenEnum aIndexSourceElementMap[]
@ TEXT_INDEX_ALPHABETICAL
@ TEXT_INDEX_BIBLIOGRAPHY
@ TEXT_INDEX_ILLUSTRATION
This class deliberately does not support XWeak, to improve performance when loading large documents.
SvXMLImport & GetImport()
static bool convertEnum(EnumT &rEnum, std::u16string_view rValue, const SvXMLEnumMapEntry< EnumT > *pMap)
convert string to enum using given enum map, if the enum is not found in the map, this method will re...
Import alphabetical (keyword) index source element.
Import bibliography source element.
Import illustration index source element;.
Import object index source element.
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
enum IndexTypeEnum eIndexType
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 ...
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 ~XMLIndexTOCContext() override
css::uno::Reference< css::beans::XPropertySet > xTOCPropertySet
XPropertySet of the index.
rtl::Reference< XMLIndexBodyContext > xBodyContextRef
XMLIndexTOCContext(SvXMLImport &rImport, sal_Int32 nElement)
Import table of context source element.
Import table index source element.
Import user defined index source element.
virtual void FillPropertySet(const css::uno::Reference< css::beans::XPropertySet > &rPropSet)
static bool convertBool(bool &rBool, std::u16string_view rString)
Reference< XSingleServiceFactory > xFactory
Sequence< sal_Int8 > aSeq
#define SAL_N_ELEMENTS(arr)
FastAttributeList & castToFastAttributeList(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
Handling of tokens in XML:
XMLTokenEnum
The enumeration of all XML tokens.
@ XML_ILLUSTRATION_INDEX_SOURCE
@ XML_BIBLIOGRAPHY_SOURCE
@ XML_OBJECT_INDEX_SOURCE
@ XML_TABLE_OF_CONTENT_SOURCE
@ XML_ALPHABETICAL_INDEX_SOURCE
#define XMLERROR_NO_INDEX_ALLOWED_HERE
#define XMLERROR_FLAG_ERROR
#define XMLOFF_WARN_UNKNOWN(area, rIter)
#define XML_ELEMENT(prefix, name)
constexpr bool IsTokenInNamespace(sal_Int32 nToken, sal_uInt16 nNamespacePrefix)
constexpr sal_uInt16 XML_NAMESPACE_TEXT