summaryrefslogtreecommitdiff
path: root/xmloff/source/text/XMLTextMarkImportContext.cxx
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2008-07-01 15:07:08 +0000
committerVladimir Glazounov <vg@openoffice.org>2008-07-01 15:07:08 +0000
commit5ad9de13a0218c0e40c93881ed59451452767751 (patch)
tree3f365613f145dfabf3062df291899a91999e3346 /xmloff/source/text/XMLTextMarkImportContext.cxx
parent95177195995c9004d9f17fcde1e4f9873dc4457f (diff)
INTEGRATION: CWS odfmetadata (1.13.50); FILE MERGED
2008/06/19 17:06:57 mst 1.13.50.1: #i90620#: import xml:id in text elements - xmloff/source/text/XMLIndexTOCContext.cxx: + XMLIndexTOCContext::StartElement(): attribute xml:id - xmloff/source/text/XMLSectionImportContext{.hxx,.cxx}: + XMLSectionToken: new token: XML_TOK_SECTION_XMLID + XMLSectionImportContext::ProcessAttributes(): attribute xml:id - xmloff/source/text/XMLTextListBlockContext{.hxx,.cxx}: + XMLTextListBlockContext::XMLTextListBlockContext(): attribute xml:id - xmloff/source/text/XMLTextListItemContext.cxx: + XMLTextListItemContext::XMLTextListItemContext(): attribute xml:id - xmloff/source/text/XMLTextMarkImportContext{.hxx,.cxx}: + refactor methods to pass XmlId around + XMLTextMarkImportContext::FindName(): attribute xml:id - xmloff/source/text/txtparai{.hxx,.cxx}: + new class XMLMetaImportContext + XMLImpSpanContext_Impl::CreateChildContext(): handle TEXT_META and (provisionally) TEXT_META_FIELD + XMLParaContext::XMLParaContext(): attribute xml:id
Diffstat (limited to 'xmloff/source/text/XMLTextMarkImportContext.cxx')
-rw-r--r--xmloff/source/text/XMLTextMarkImportContext.cxx35
1 files changed, 25 insertions, 10 deletions
diff --git a/xmloff/source/text/XMLTextMarkImportContext.cxx b/xmloff/source/text/XMLTextMarkImportContext.cxx
index 00e8debe6fd3..47abd32d4b6f 100644
--- a/xmloff/source/text/XMLTextMarkImportContext.cxx
+++ b/xmloff/source/text/XMLTextMarkImportContext.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: XMLTextMarkImportContext.cxx,v $
- * $Revision: 1.13 $
+ * $Revision: 1.14 $
*
* This file is part of OpenOffice.org.
*
@@ -98,8 +98,9 @@ void XMLTextMarkImportContext::StartElement(
OUString sName;
+ OUString sXmlId;
- if (FindName(GetImport(), xAttrList, sName))
+ if (FindName(GetImport(), xAttrList, sName, sXmlId))
{
sal_uInt16 nTmp;
if (SvXMLUnitConverter::convertEnum(nTmp, GetLocalName(),
@@ -112,7 +113,8 @@ void XMLTextMarkImportContext::StartElement(
CreateAndInsertMark(GetImport(),
sAPI_reference_mark,
sName,
- rHelper.GetCursorAsRange()->getStart());
+ rHelper.GetCursorAsRange()->getStart(),
+ ::rtl::OUString());
break;
case TypeBookmark:
@@ -120,21 +122,22 @@ void XMLTextMarkImportContext::StartElement(
CreateAndInsertMark(GetImport(),
sAPI_bookmark,
sName,
- rHelper.GetCursorAsRange()->getStart());
+ rHelper.GetCursorAsRange()->getStart(),
+ sXmlId);
break;
case TypeBookmarkStart:
// save XTextRange for later construction of bookmark
rHelper.InsertBookmarkStartRange(
- sName, rHelper.GetCursorAsRange()->getStart());
+ sName, rHelper.GetCursorAsRange()->getStart(), sXmlId);
break;
case TypeBookmarkEnd:
{
// get old range, and construct
Reference<XTextRange> xStartRange;
- if (rHelper.FindAndRemoveBookmarkStartRange(xStartRange,
- sName))
+ if (rHelper.FindAndRemoveBookmarkStartRange(sName,
+ xStartRange, sXmlId))
{
Reference<XTextRange> xEndRange(
rHelper.GetCursorAsRange()->getStart());
@@ -161,7 +164,8 @@ void XMLTextMarkImportContext::StartElement(
CreateAndInsertMark(GetImport(),
sAPI_bookmark,
sName,
- xInsertionRange);
+ xInsertionRange,
+ sXmlId);
}
// else: beginning/end in different XText -> ignore!
}
@@ -187,7 +191,8 @@ void XMLTextMarkImportContext::CreateAndInsertMark(
SvXMLImport& rImport,
const OUString& sServiceName,
const OUString& sMarkName,
- const Reference<XTextRange> & rRange)
+ const Reference<XTextRange> & rRange,
+ const OUString& i_rXmlId)
{
// create mark
Reference<XMultiServiceFactory> xFactory(rImport.GetModel(),UNO_QUERY);
@@ -201,6 +206,9 @@ void XMLTextMarkImportContext::CreateAndInsertMark(
{
xNamed->setName(sMarkName);
+ // xml:id for RDF metadata
+ rImport.SetXmlId(xIfc, i_rXmlId);
+
// cast to XTextContent and attach to document
Reference<XTextContent> xTextContent(xIfc, UNO_QUERY);
if (xTextContent.is())
@@ -224,7 +232,8 @@ void XMLTextMarkImportContext::CreateAndInsertMark(
sal_Bool XMLTextMarkImportContext::FindName(
SvXMLImport& rImport,
const Reference<XAttributeList> & xAttrList,
- OUString& sName)
+ OUString& sName,
+ OUString& o_rXmlId)
{
sal_Bool bNameOK = sal_False;
@@ -243,6 +252,12 @@ sal_Bool XMLTextMarkImportContext::FindName(
sName = xAttrList->getValueByIndex(nAttr);
bNameOK = sal_True;
}
+ else if ( (XML_NAMESPACE_XML == nPrefix) &&
+ IsXMLToken(sLocalName, XML_ID) )
+ {
+ o_rXmlId = xAttrList->getValueByIndex(nAttr);
+ }
+//FIXME: RDFa (text:bookmark-start)
}
return bNameOK;