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::lang::XMultiServiceFactory;
58using ::com::sun::star::lang::IllegalArgumentException;
63 "com.sun.star.text.ContentIndex",
64 "com.sun.star.text.DocumentIndex",
65 "com.sun.star.text.TableIndex",
66 "com.sun.star.text.ObjectIndex",
67 "com.sun.star.text.Bibliography",
68 "com.sun.star.text.UserIndex",
69 "com.sun.star.text.IllustrationsIndex"
110 "service and source element maps must be same size");
122 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
130 bool bProtected =
false;
136 switch(aIter.getToken())
140 pStyle =
GetImport().GetTextImport()->FindSectionStyle(
155 sIndexName = aIter.toString();
160 sXmlId = aIter.toString();
173 Reference<XInterface> xIfc =
179 Reference<XPropertySet> xPropSet(xIfc, UNO_QUERY);
191 static constexpr OUStringLiteral sMarker(
u" ");
193 static constexpr OUStringLiteral sMarker(
u"Y");
199 Reference<XTextContent> xTextContent(xIfc, UNO_QUERY);
202 GetImport().GetTextImport()->InsertTextContent(
205 catch(
const IllegalArgumentException& e)
208 Sequence<OUString>
aSeq { SvXMLImport::getNameFromToken(nElement) };
211 aSeq, e.Message,
nullptr );
222 rImport->InsertString(sMarker);
223 rImport->GetCursor()->goLeft(2,
false);
230 GetImport().GetTextImport()->RedlineAdjustStartNodeCursor();
232 if (pStyle !=
nullptr)
239 if (!sIndexName.isEmpty())
257 rHelper->GetCursor()->goRight(1,
false);
260 rHelper->GetCursor()->goLeft(1,
true);
261 rHelper->GetText()->insertString(rHelper->GetCursorAsRange(),
266 rHelper->GetCursor()->goRight(1,
true);
267 rHelper->GetText()->insertString(rHelper->GetCursorAsRange(),
271 GetImport().GetTextImport()->RedlineAdjustStartNodeCursor();
276 const css::uno::Reference< css::xml::sax::XFastAttributeList >& )
287 xContext = xNewBodyContext;
334 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