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>
43 using namespace ::
std;
46 using ::com::sun::star::beans::XPropertySet;
47 using ::com::sun::star::beans::PropertyValues;
48 using ::com::sun::star::uno::Reference;
49 using ::com::sun::star::uno::Sequence;
50 using ::com::sun::star::uno::Any;
51 using ::com::sun::star::xml::sax::XAttributeList;
52 using ::com::sun::star::container::XIndexReplace;
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 =
163 rStyles->hasByName( sDisplayStyleName ) )
166 OUString::createFromAscii(pStyleProperty), css::uno::Any(sDisplayStyleName));
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 >& )
209 aTemplateTokenTypeMap))
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 };
css::uno::Reference< css::beans::XPropertySet > & rPropertySet
void addTemplateEntry(const css::beans::PropertyValues &aValues)
add template; to be called by child template entry contexts
const char * aLevelStylePropNameTableMap[]
Import bibliography index entry templates.
Import index entry templates.
const char * aLevelStylePropNameTOCMap[]
const SvXMLEnumMapEntry< sal_uInt16 > aLevelNameAlphaMap[]
SvXMLImport & GetImport()
const SvXMLEnumMapEntry< sal_uInt16 > aLevelNameBibliographyMap[]
Import index entry templates.
std::map< sal_Int32, std::shared_ptr< SetItemPropertyStorage > > PropertyValues
const bool aAllowedTokenTypesTOC[]
constexpr sal_uInt16 XML_NAMESPACE_LO_EXT
FastAttributeList & castToFastAttributeList(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
rtl::Reference< XMLTextImportHelper > const & GetTextImport()
const bool aAllowedTokenTypesAlpha[]
const char * aLevelStylePropNameAlphaMap[]
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
const bool * pAllowedTokenTypesMap
const bool aAllowedTokenTypesUser[]
const bool aAllowedTokenTypesBibliography[]
#define DBG_ASSERT(sCon, aError)
constexpr sal_uInt16 XML_NAMESPACE_TEXT
const SvXMLEnumMapEntry< sal_uInt16 > * pOutlineLevelNameMap
TemplateTokenType
template token types; used for aTokenTypeMap parameter
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)
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
SvXMLEnumMapEntry< TemplateTokenType > const aTemplateTokenTypeMap[]
static const OUString & getNameFromToken(sal_Int32 nToken)
const char * aLevelStylePropNameBibliographyMap[]
const SvXMLEnumMapEntry< sal_uInt16 > * aLevelNameTableMap
This class deliberately does not support XWeak, to improve performance when loading large documents...
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 ...
constexpr bool IsTokenInNamespace(sal_Int32 nToken, sal_uInt16 nNamespacePrefix)
OUString GetStyleDisplayName(XmlStyleFamily nFamily, const OUString &rName) const
#define SAL_WARN_IF(condition, area, stream)
Handling of tokens in XML:
const char ** pOutlineLevelStylePropMap
#define XML_ELEMENT(prefix, name)
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...
XMLTokenEnum
The enumeration of all XML tokens.
Import chapter info index entry templates.
enum::xmloff::token::XMLTokenEnum eOutlineLevelAttrName
const SvXMLEnumMapEntry< sal_uInt16 > aSvLevelNameTOCMap[]
Import index entry templates.
::std::vector< css::beans::PropertyValues > aValueVector
bool m_bDetectedRangeSegmentation false
const bool aAllowedTokenTypesTable[]