diff options
author | Carsten Driesner <cd@openoffice.org> | 2010-06-24 11:35:00 +0200 |
---|---|---|
committer | Carsten Driesner <cd@openoffice.org> | 2010-06-24 11:35:00 +0200 |
commit | 2a40b4b78143f09358c1f319e8608dbd61bbe2d6 (patch) | |
tree | 60668145121dc3e45a60d569f9c2947afda15e30 /xmloff/source/text/XMLIndexTOCContext.cxx | |
parent | 2b1c9f5c63f4d90db0137b1c8c91340bb2559115 (diff) | |
parent | 34dd33af79caf3a13ec3a4e7098616ac0b16cf50 (diff) |
Merge changes
Diffstat (limited to 'xmloff/source/text/XMLIndexTOCContext.cxx')
-rw-r--r-- | xmloff/source/text/XMLIndexTOCContext.cxx | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/xmloff/source/text/XMLIndexTOCContext.cxx b/xmloff/source/text/XMLIndexTOCContext.cxx index daf0703803d7..ad9f7ce10d7a 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; } } |