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>
45using ::com::sun::star::beans::XPropertySet;
46using ::com::sun::star::beans::PropertyValues;
47using ::com::sun::star::uno::Reference;
48using ::com::sun::star::uno::Sequence;
49using ::com::sun::star::uno::Any;
50using ::com::sun::star::container::XIndexReplace;
54 Reference<XPropertySet> & rPropSet,
57 const char** pLevelStylePropMap,
58 const bool* pAllowedTokenTypes,
61, pOutlineLevelNameMap(pLevelNameMap)
62, eOutlineLevelAttrName(eLevelAttrName)
63, pOutlineLevelStylePropMap(pLevelStylePropMap)
64, pAllowedTokenTypesMap(pAllowedTokenTypes)
67, bOutlineLevelOK(false)
69, rPropertySet(rPropSet)
73 "need both, attribute name and value map, or neither" );
74 SAL_WARN_IF(
nullptr == pOutlineLevelStylePropMap,
"xmloff",
"need property name map" );
75 SAL_WARN_IF(
nullptr == pAllowedTokenTypes,
"xmloff",
"need allowed tokens map" );
78 if (
nullptr == pLevelNameMap)
81 bOutlineLevelOK =
true;
99 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
132 Sequence<PropertyValues> aValueSequence(
nCount);
137 Reference<XIndexReplace> xIndexReplace;
138 aAny >>= xIndexReplace;
146 const char* pStyleProperty =
149 DBG_ASSERT(
nullptr != pStyleProperty,
"need property name");
150 if (
nullptr == pStyleProperty)
153 OUString sDisplayStyleName =
158 const Reference < css::container::XNameContainer > & rStyles =
159 GetImport().GetTextImport()->GetParaStyles();
161 rStyles->hasByName( sDisplayStyleName ) )
164 OUString::createFromAscii(pStyleProperty), css::uno::Any(sDisplayStyleName));
170enum TemplateTokenType
172 XML_TOK_INDEX_TYPE_ENTRY_TEXT = 0,
173 XML_TOK_INDEX_TYPE_TAB_STOP,
174 XML_TOK_INDEX_TYPE_TEXT,
175 XML_TOK_INDEX_TYPE_PAGE_NUMBER,
176 XML_TOK_INDEX_TYPE_CHAPTER,
177 XML_TOK_INDEX_TYPE_LINK_START,
178 XML_TOK_INDEX_TYPE_LINK_END,
179 XML_TOK_INDEX_TYPE_BIBLIOGRAPHY
199 const css::uno::Reference< css::xml::sax::XFastAttributeList >& )
214 case XML_TOK_INDEX_TYPE_ENTRY_TEXT:
219 case XML_TOK_INDEX_TYPE_PAGE_NUMBER:
224 case XML_TOK_INDEX_TYPE_LINK_START:
226 GetImport(),
"TokenHyperlinkStart", *
this);
229 case XML_TOK_INDEX_TYPE_LINK_END:
231 GetImport(),
"TokenHyperlinkEnd", *
this);
234 case XML_TOK_INDEX_TYPE_TEXT:
239 case XML_TOK_INDEX_TYPE_TAB_STOP:
244 case XML_TOK_INDEX_TYPE_BIBLIOGRAPHY:
249 case XML_TOK_INDEX_TYPE_CHAPTER:
288 {
nullptr,
"ParaStyleLevel1",
"ParaStyleLevel2",
"ParaStyleLevel3",
289 "ParaStyleLevel4",
"ParaStyleLevel5",
"ParaStyleLevel6",
290 "ParaStyleLevel7",
"ParaStyleLevel8",
"ParaStyleLevel9",
291 "ParaStyleLevel10",
nullptr };
330 {
nullptr,
"ParaStyleSeparator",
"ParaStyleLevel1",
"ParaStyleLevel2",
331 "ParaStyleLevel3",
nullptr };
378 nullptr,
"ParaStyleLevel1",
"ParaStyleLevel1",
"ParaStyleLevel1",
379 "ParaStyleLevel1",
"ParaStyleLevel1",
"ParaStyleLevel1",
380 "ParaStyleLevel1",
"ParaStyleLevel1",
"ParaStyleLevel1",
381 "ParaStyleLevel1",
"ParaStyleLevel1",
"ParaStyleLevel1",
382 "ParaStyleLevel1",
"ParaStyleLevel1",
"ParaStyleLevel1",
383 "ParaStyleLevel1",
"ParaStyleLevel1",
"ParaStyleLevel1",
384 "ParaStyleLevel1",
"ParaStyleLevel1",
"ParaStyleLevel1",
385 "ParaStyleLevel1",
nullptr };
406 {
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