summaryrefslogtreecommitdiff
path: root/xmloff/source/text/XMLIndexTOCContext.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'xmloff/source/text/XMLIndexTOCContext.cxx')
-rw-r--r--xmloff/source/text/XMLIndexTOCContext.cxx38
1 files changed, 16 insertions, 22 deletions
diff --git a/xmloff/source/text/XMLIndexTOCContext.cxx b/xmloff/source/text/XMLIndexTOCContext.cxx
index 140a069ebf..092af4fba7 100644
--- a/xmloff/source/text/XMLIndexTOCContext.cxx
+++ b/xmloff/source/text/XMLIndexTOCContext.cxx
@@ -50,14 +50,11 @@
#include <xmloff/txtimp.hxx>
#include <xmloff/nmspmap.hxx>
#include "xmlnmspe.hxx"
-#include "xmlkywd.hxx"
#include <xmloff/xmltoken.hxx>
#include <xmloff/prstylei.hxx>
#include "xmlerror.hxx"
#include <xmloff/xmluconv.hxx>
-#include <tools/debug.hxx>
#include <rtl/ustring.hxx>
-#include <tools/debug.hxx>
using namespace ::com::sun::star::uno;
@@ -85,15 +82,15 @@ static const sal_Char* aIndexServiceMap[] =
"com.sun.star.text.IllustrationsIndex"
};
-static const sal_Char* aIndexSourceElementMap[] =
+static const XMLTokenEnum aIndexSourceElementMap[] =
{
- sXML_table_of_content_source,
- sXML_alphabetical_index_source,
- sXML_table_index_source,
- sXML_object_index_source,
- sXML_bibliography_source,
- sXML_user_index_source,
- sXML_illustration_index_source
+ XML_TABLE_OF_CONTENT_SOURCE,
+ XML_ALPHABETICAL_INDEX_SOURCE,
+ XML_TABLE_INDEX_SOURCE,
+ XML_OBJECT_INDEX_SOURCE,
+ XML_BIBLIOGRAPHY_SOURCE,
+ XML_USER_INDEX_SOURCE,
+ XML_ILLUSTRATION_INDEX_SOURCE
};
SvXMLEnumMapEntry __READONLY_DATA aIndexTypeMap[] =
@@ -117,7 +114,6 @@ XMLIndexTOCContext::XMLIndexTOCContext(
, sTitle(RTL_CONSTASCII_USTRINGPARAM("Title"))
, sIsProtected(RTL_CONSTASCII_USTRINGPARAM("IsProtected"))
, sName(RTL_CONSTASCII_USTRINGPARAM("Name"))
-, pSourceElementName(NULL)
, bValid(sal_False)
{
if (XML_NAMESPACE_TEXT == nPrfx)
@@ -126,13 +122,12 @@ XMLIndexTOCContext::XMLIndexTOCContext(
if (SvXMLUnitConverter::convertEnum(nTmp, rLocalName, aIndexTypeMap))
{
// check for array index:
- DBG_ASSERT(nTmp < (sizeof(aIndexServiceMap)/sizeof(sal_Char*)), "index out of range");
- DBG_ASSERT(sizeof(aIndexServiceMap) ==
+ OSL_ENSURE(nTmp < (sizeof(aIndexServiceMap)/sizeof(sal_Char*)), "index out of range");
+ OSL_ENSURE(sizeof(aIndexServiceMap) ==
sizeof(aIndexSourceElementMap),
"service and source element maps must be same size");
- eIndexType = (enum IndexTypeEnum)nTmp;
- pSourceElementName = aIndexSourceElementMap[eIndexType];
+ eIndexType = static_cast<IndexTypeEnum>(nTmp);
bValid = sal_True;
}
}
@@ -201,10 +196,6 @@ void XMLIndexTOCContext::StartElement(
OUString::createFromAscii(aIndexServiceMap[eIndexType]));
if( xIfc.is() )
{
-
- // xml:id for RDF metadata
- GetImport().SetXmlId(xIfc, sXmlId);
-
// get Property set
Reference<XPropertySet> xPropSet(xIfc, UNO_QUERY);
xTOCPropertySet = xPropSet;
@@ -246,6 +237,9 @@ void XMLIndexTOCContext::StartElement(
return;
}
+ // xml:id for RDF metadata
+ GetImport().SetXmlId(xIfc, sXmlId);
+
// b) insert marker and move cursor
rImport->InsertString(sMarker);
rImport->GetCursor()->goLeft(2, sal_False);
@@ -326,7 +320,7 @@ SvXMLImportContext* XMLIndexTOCContext::CreateChildContext(
xBodyContextRef = pContext;
}
}
- else if (0 == rLocalName.compareToAscii(pSourceElementName))
+ else if (IsXMLToken(rLocalName, aIndexSourceElementMap[eIndexType]))
{
// instantiate source context for the appropriate index type
switch (eIndexType)
@@ -367,7 +361,7 @@ SvXMLImportContext* XMLIndexTOCContext::CreateChildContext(
break;
default:
- DBG_ERROR("index type not implemented");
+ OSL_ENSURE(false, "index type not implemented");
break;
}
}