35#include <rtl/ustring.hxx>
37#include <com/sun/star/container/XIndexReplace.hpp>
38#include <com/sun/star/container/XNameContainer.hpp>
39#include <com/sun/star/beans/XPropertySet.hpp>
46using ::com::sun::star::beans::XPropertySet;
47using ::com::sun::star::beans::PropertyValues;
48using ::com::sun::star::uno::Reference;
49using ::com::sun::star::uno::Sequence;
50using ::com::sun::star::uno::Any;
51using ::com::sun::star::xml::sax::XAttributeList;
52using ::com::sun::star::container::XIndexReplace;
56 Reference<XPropertySet> & rPropSet,
59 const char** pLevelStylePropMap,
60 const bool* pAllowedTokenTypes,
63, pOutlineLevelNameMap(pLevelNameMap)
64, eOutlineLevelAttrName(eLevelAttrName)
65, pOutlineLevelStylePropMap(pLevelStylePropMap)
66, pAllowedTokenTypesMap(pAllowedTokenTypes)
69, bOutlineLevelOK(false)
71, rPropertySet(rPropSet)
75 "need both, attribute name and value map, or neither" );
76 SAL_WARN_IF(
nullptr == pOutlineLevelStylePropMap,
"xmloff",
"need property name map" );
77 SAL_WARN_IF(
nullptr == pAllowedTokenTypes,
"xmloff",
"need allowed tokens map" );
80 if (
nullptr == pLevelNameMap)
83 bOutlineLevelOK =
true;
101 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
134 Sequence<PropertyValues> aValueSequence(
nCount);
139 Reference<XIndexReplace> xIndexReplace;
140 aAny >>= xIndexReplace;
148 const char* pStyleProperty =
151 DBG_ASSERT(
nullptr != pStyleProperty,
"need property name");
152 if (
nullptr == pStyleProperty)
155 OUString sDisplayStyleName =
160 const Reference < css::container::XNameContainer > & rStyles =
161 GetImport().GetTextImport()->GetParaStyles();
163 rStyles->hasByName( sDisplayStyleName ) )
166 OUString::createFromAscii(pStyleProperty), css::uno::Any(sDisplayStyleName));
172enum TemplateTokenType
174 XML_TOK_INDEX_TYPE_ENTRY_TEXT = 0,
175 XML_TOK_INDEX_TYPE_TAB_STOP,
176 XML_TOK_INDEX_TYPE_TEXT,
177 XML_TOK_INDEX_TYPE_PAGE_NUMBER,
178 XML_TOK_INDEX_TYPE_CHAPTER,
179 XML_TOK_INDEX_TYPE_LINK_START,
180 XML_TOK_INDEX_TYPE_LINK_END,
181 XML_TOK_INDEX_TYPE_BIBLIOGRAPHY
201 const css::uno::Reference< css::xml::sax::XFastAttributeList >& )
216 case XML_TOK_INDEX_TYPE_ENTRY_TEXT:
221 case XML_TOK_INDEX_TYPE_PAGE_NUMBER:
226 case XML_TOK_INDEX_TYPE_LINK_START:
228 GetImport(),
"TokenHyperlinkStart", *
this);
231 case XML_TOK_INDEX_TYPE_LINK_END:
233 GetImport(),
"TokenHyperlinkEnd", *
this);
236 case XML_TOK_INDEX_TYPE_TEXT:
241 case XML_TOK_INDEX_TYPE_TAB_STOP:
246 case XML_TOK_INDEX_TYPE_BIBLIOGRAPHY:
251 case XML_TOK_INDEX_TYPE_CHAPTER:
290 {
nullptr,
"ParaStyleLevel1",
"ParaStyleLevel2",
"ParaStyleLevel3",
291 "ParaStyleLevel4",
"ParaStyleLevel5",
"ParaStyleLevel6",
292 "ParaStyleLevel7",
"ParaStyleLevel8",
"ParaStyleLevel9",
293 "ParaStyleLevel10",
nullptr };
332 {
nullptr,
"ParaStyleSeparator",
"ParaStyleLevel1",
"ParaStyleLevel2",
333 "ParaStyleLevel3",
nullptr };
380 nullptr,
"ParaStyleLevel1",
"ParaStyleLevel1",
"ParaStyleLevel1",
381 "ParaStyleLevel1",
"ParaStyleLevel1",
"ParaStyleLevel1",
382 "ParaStyleLevel1",
"ParaStyleLevel1",
"ParaStyleLevel1",
383 "ParaStyleLevel1",
"ParaStyleLevel1",
"ParaStyleLevel1",
384 "ParaStyleLevel1",
"ParaStyleLevel1",
"ParaStyleLevel1",
385 "ParaStyleLevel1",
"ParaStyleLevel1",
"ParaStyleLevel1",
386 "ParaStyleLevel1",
"ParaStyleLevel1",
"ParaStyleLevel1",
387 "ParaStyleLevel1",
nullptr };
408 {
nullptr,
"ParaStyleLevel1",
nullptr };
const char * aLevelStylePropNameTOCMap[]
const SvXMLEnumMapEntry< sal_uInt16 > aLevelNameBibliographyMap[]
SvXMLEnumMapEntry< TemplateTokenType > const aTemplateTokenTypeMap[]
const char * aLevelStylePropNameTableMap[]
const bool aAllowedTokenTypesBibliography[]
const bool aAllowedTokenTypesAlpha[]
const char * aLevelStylePropNameBibliographyMap[]
const bool aAllowedTokenTypesTOC[]
const bool aAllowedTokenTypesTable[]
const bool aAllowedTokenTypesUser[]
const SvXMLEnumMapEntry< sal_uInt16 > aLevelNameAlphaMap[]
const SvXMLEnumMapEntry< sal_uInt16 > aSvLevelNameTOCMap[]
const SvXMLEnumMapEntry< sal_uInt16 > * aLevelNameTableMap
const char * aLevelStylePropNameAlphaMap[]
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 bibliography index entry templates.
Import chapter info index entry templates.
Import index entry templates.
Import index entry templates.
Import index entry templates.
::std::vector< css::beans::PropertyValues > aValueVector
virtual ~XMLIndexTemplateContext() override
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 ...
XMLIndexTemplateContext(SvXMLImport &rImport, css::uno::Reference< css::beans::XPropertySet > &rPropSet, const SvXMLEnumMapEntry< EnumT > *aLevelNameMap, enum ::xmloff::token::XMLTokenEnum eLevelAttrName, const char **aLevelStylePropNameMap, const bool *aAllowedTokenTypes, bool bTOC_=false)
enum::xmloff::token::XMLTokenEnum eOutlineLevelAttrName
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
const char ** pOutlineLevelStylePropMap
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
void addTemplateEntry(const css::beans::PropertyValues &aValues)
add template; to be called by child template entry contexts
const SvXMLEnumMapEntry< sal_uInt16 > * pOutlineLevelNameMap
const bool * pAllowedTokenTypesMap
css::uno::Reference< css::beans::XPropertySet > & rPropertySet
#define DBG_ASSERT(sCon, aError)
#define SAL_WARN_IF(condition, area, stream)
std::map< sal_Int32, std::shared_ptr< SetItemPropertyStorage > > PropertyValues
FastAttributeList & castToFastAttributeList(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
Handling of tokens in XML:
XMLTokenEnum
The enumeration of all XML tokens.
@ XML_INDEX_ENTRY_TAB_STOP
@ XML_INDEX_ENTRY_BIBLIOGRAPHY
@ XML_INDEX_ENTRY_LINK_START
@ XML_INDEX_ENTRY_PAGE_NUMBER
@ XML_INDEX_ENTRY_CHAPTER
@ XML_INDEX_ENTRY_LINK_END
#define XML_ELEMENT(prefix, name)
constexpr bool IsTokenInNamespace(sal_Int32 nToken, sal_uInt16 nNamespacePrefix)
constexpr sal_uInt16 XML_NAMESPACE_TEXT
constexpr sal_uInt16 XML_NAMESPACE_LO_EXT