summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorRelease Engineers <releng@openoffice.org>2009-07-02 09:05:03 +0000
committerRelease Engineers <releng@openoffice.org>2009-07-02 09:05:03 +0000
commit2de6af6d6d7c4f32362bcf2974f072cb86f4ca1e (patch)
treeee9dc6cc1e84fa4bb532a970df4066c638a7644f /xmloff
parent07004f9311f1efa38c978285da05d3ff3d05b163 (diff)
CWS-TOOLING: integrate CWS odfmetadata2
2009-06-22 11:48:36 +0200 mst r273206 : - connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx: + add "include ustrbuf.hxx" to work around warning caused by solaris <sys/kstat.h> declaring a global "long l ;" 2009-06-19 14:25:25 +0200 mst r273159 : - scp2/source/ooo/file_library_ooo.scp: + fix MinGW build 2009-06-08 12:52:33 +0200 mst r272727 : - redland/raptor-1.4.18.patch.mingw, redland/raptor/makefile.mk: + disable parsers that do not build on MinGW (thanks for patch by tono) 2009-05-15 17:31:07 +0200 mst r271957 : fix typos 2009-05-15 17:28:57 +0200 mst r271956 : #i101965# - offapi/com/sun/star/text/TextPortion: + add missing properties: SoftPageBreak, DocumentIndexMark, ReferenceMark, Footnote, TextField + fix read-only status of properties: Bookmark, IsStart, IsCollapsed - offapi/type_reference/{typelibrary_history.txt,types.rdb}: + update reference types.rdb 2009-05-07 14:41:38 +0200 mst r271669 : - sw/inc/{fmtftn.hxx,unocoll.hxx,doc.hxx,editsh.hxx,ftninfo.hxx}, sw/source/core/layout/{flowfrm.cxx,ftnfrm.cxx}, sw/source/core/doc/docftn.cxx, sw/source/core/edit/edattr.cxx, sw/source/core/txtnode/atrftn.cxx, sw/source/core/unocore/unocoll.cxx, sw/source/ui/fldui/fldref.cxx: + fix warning ... the hard way + also fix signature of SwDoc::SetCurFtn 2009-05-05 19:52:55 +0200 mst r271556 : - sw/inc/undobj.hxx: + make some members const 2009-05-05 19:34:40 +0200 mst r271555 : - sw/inc/rolbck.hxx, sw/source/core/undo/rolbck.cxx: + make some members const 2009-05-05 19:13:14 +0200 mst r271553 : - sw/inc/{undobj.hxx,rolbck.hxx}, sw/source/core/undo/{unbkmk.cxx,rolbck.cxx}: + fix rebase merge error + rename SwHstryBookmark to SwHistoryBookmark + clean up SwUndoBookmark 2009-05-05 19:05:53 +0200 mst r271552 : - sw/source/core/unocore/unoportenum.cxx: + fix annoying assertion 2009-05-05 15:34:48 +0200 mst r271522 : CWS-TOOLING: rebase CWS odfmetadata2 to trunk@271427 (milestone: DEV300:m47) 2009-05-04 12:37:01 +0200 mst r271444 : trivial 2009-04-22 13:30:37 +0200 mst r271102 : - sfx2/inc/sfx2/dinfdlg.hxx: + trivial change 2009-04-21 16:46:58 +0200 mst r271043 : - sw/inc/hintids.hxx: + introduce some predicates for the various hints, and use them 2009-04-21 16:19:03 +0200 mst r271041 : - sw/inc/undobj.hxx, sw/source/core/doc/{docfly.cxx,docfmt.cxx,docftn.cxx,doctxm.cxx}, sw/source/core/undo/{unattr.cxx,unins.cxx}: + clean up unattr.cxx: remove/fix casts, prefix members, use auto_ptr, etc. 2009-04-21 15:34:23 +0200 mst r271039 : - sw/inc/{rolbck.hxx,undobj.hxx}, sw/source/core/doc/docfmt.cxx, sw/source/core/txtnode/{thints.cxx,txtedt.cxx}, sw/source/core/undo/{rolbck.cxx,undel.cxx,undobj.cxx,unins.cxx,unmove.cxx, unovwr.cxx,unsect.cxx,unspnd.cxx,untbl.cxx,untblk.cxx,unattr.cxx}: + clean up SwHistory, SwRegHistory and SwHistoryHint etc.: remove/fix casts, prefix members, remove wrong const annotations, use auto_ptr, remove unused members, etc. 2009-04-20 19:17:36 +0200 mst r271013 : - sw/inc/ndhints.hxx, sw/source/core/text/{itrtxt.cxx,txtftn.cxx,itratr.cxx,porfly.cxx, txtfrm.cxx,txtdrop.cxx,frmform.cxx}, sw/source/core/txtnode/{ndtxt.cxx,ndhints.cxx,thints.cxx,txtedt.cxx}, sw/source/core/edit/acorrect.cxx, sw/source/core/doc/{docedt.cxx,docfmt.cxx}, sw/source/filter/html/swhtml.cxx: + clean up SwHintsArray and its subclasses: remove/fix casts, prefix members 2009-04-20 18:42:07 +0200 mst r271007 : - sw/source/core/text/txtio.cxx, sw/source/core/edit/edattr.cxx, sw/source/core/undo/rolbck.cxx: + remove JP_NEWCORE dead code 2009-04-20 18:38:09 +0200 mst r271006 : - sw/source/core/unocore/unochart.cxx: + silence unxlngi warning (debug=t) 2009-04-20 16:36:13 +0200 mst r270991 : - sfx2/inc/sfx2/dinfdlg.hxx, sfx2/source/dialog/dinfdlg.cxx, sfx2/source/doc/objserv.cxx, sw/source/ui/fldui/flddinf.hxx: + trivial cleanups 2009-04-20 15:28:52 +0200 mst r270990 : - sfx2/inc/sfx2/dinfdlg.hxx, sfx2/source/dialog/dinfdlg.cxx, sfx2/source/doc/objserv.cxx: + fix bug: replaying a macro with a DocumentInfoItem removes all user-defined properties 2009-03-10 15:08:20 +0100 mst r269273 : - sfx2/source/doc/Metadatable.cxx: + add missing SolarMutex guards 2009-03-10 14:46:29 +0100 mst r269272 : - unoxml/source/rdf/librdf_repository.cxx: + never free rdf_world because that would call libxm2 xmlCleanupParser (and, to add insult to injury, other libxml2 functions later...) 2009-03-06 19:02:44 +0100 mst r269041 : argh! undo... 2009-03-06 19:00:58 +0100 mst r269040 : fix #i99931# - sw/source/ui/uno/unomod.cxx: + SwXViewSettings::_getSingleValue returns uninitialized memory for the ZoomType property if the value is PAGE_WIDTH_EXACT 2009-03-06 18:59:28 +0100 mst r269039 : - sw/inc/ndtxt.hxx, sw/source/core/txtnode/ndtxt.cxx, sw/source/core/unocore/unoportenum.cxx: + fix some more wntmsci12 warnings... 2009-03-06 18:56:46 +0100 mst r269038 : - sd/source/ui/slidesorter/model/SlsPageEnumerationProvider.cxx: + work around spurious warning on unxsoli4 debug=t 2009-03-05 14:02:01 +0100 mst r268902 : - sw/inc/txatbase.hxx: + back to c-style casts, they also compile on wntmsci12... 2009-03-05 10:23:25 +0100 mst r268882 : - comphelper/inc/comphelper/processfactory.hxx, comphelper/source/processfactory/processfactory.cxx: + revert change of return type of comphelper_getProcessComponentContext to Reference: does not build on wntmsci12 2009-03-04 19:08:09 +0100 mst r268861 : - sw/source/core/txtnode/{atrtox.cxx,ndtxt.cxx}: + fix initialization 2009-03-04 14:37:30 +0100 mst r268831 : - solenv/inc/target.mk: + fix CLASSPATH so complex tests run (fix by sb) 2009-03-04 14:36:30 +0100 mst r268830 : - sw/inc/unoobj.hxx, sw/source/core/unocore/{unoparagraph.cxx,unoobj.cxx,unoobj2.cxx}: + SwXParaFrameEnumeration constructor now takes SwPaM, not SwUnoCrsr + move SwParaSelection into unoparagraph.cxx, as it is only used there + bugfix: replace SwUnoCrsrs on stack with SwCursors 2009-03-04 14:34:46 +0100 mst r268829 : - sw/inc/pam.hxx, sw/source/core/crsr/pam.cxx, sw/source/core/edit/eddel.cxx, sw/source/core/doc/docredln.cxx, sw/source/core/undo/{untbl.cxx,undel.cxx}, sw/source/filter/rtf/swparrtf.cxx: + clean up SwPaM: prefix members + new constructor SwPosition(SwCntntNode&, xub_StrLen) + fix several broken SwPosition and SwPaM constructors + SwPam::DeleteMark now actually resets the unused position to default 2009-03-02 12:07:09 +0100 mst r268646 : - sw/inc/fmtcol.hxx: + fix annoying warning (gcc 4) 2009-03-02 12:06:27 +0100 mst r268645 : - odk/util/check.pl, odk/examples/DevelopersGuide/Text/TextDocuments.java: + rename module from FieldMaster to fieldmaster 2009-02-27 19:49:56 +0100 mst r268614 : - sfx2/inc/sfx2/Metadatable.hxx, sfx2/prj/d.lst, sfx2/source/doc/{Metadatable.cxx,makefile.mk}, sw/inc/{SwMetadatable.hxx,unoobj.hxx,undobj.hxx,ndtxt.hxx}, sw/source/core/doc/{SwMetadatable.cxx,makefile.mk,docnew.cxx}, sw/source/core/undo/{untbl.cxx,unins.cxx}, sw/source/core/unocore/unoparagraph.cxx, sw/source/ui/app/docsh.cxx: + move Metadatable implementation from sw to sfx2 2009-02-27 17:58:55 +0100 mst r268608 : - sw/inc/{SwMetadatable.hxx,undobj.hxx}, sw/source/core/doc/SwMetadatable.cxx, sw/source/core/undo/{untbl.cxx,unins.cxx,undel.cxx}: + CreateUndo now returns an opaque MetadatableUndo object 2009-02-27 13:15:44 +0100 mst r268587 : - sw/inc/ndtxt.hxx, sw/source/core/doc/docfmt.cxx, sw/source/core/text/{itratr.cxx,porlay.cxx}, sw/source/core/txtnode/{txtedt.cxx,ndtxt.cxx,thints.cxx}: + clean up SwTxtNode: fix casts, prefix members + factor out inline function SwTxtNode::TryDeleteSwpHints() 2009-02-27 13:14:30 +0100 mst r268586 : - svx/inc/svx/emphitem.hxx: + fix borken header guard 2009-02-27 13:13:56 +0100 mst r268585 : - sfx2/source/bastyp/progress.cxx: + fix use of compiler specific macro 2009-02-27 11:00:32 +0100 mst r268564 : - sw/inc/{txatbase.hxx,txtatr.hxx,txtinet.hxx,txtfld.hxx,txtftn.hxx, txtflcnt.hxx,txttxmrk.hxx,txtrfmrk.hxx}, sw/source/core/txtnode/{atrtox.cxx,atrref.cxx,atrflyin.cxx,atrftn.cxx, txtatr2.cxx,txatbase.cxx,atrfld.cxx,txtedt.cxx}, sw/source/core/text/atrstck.cxx, sw/source/core/access/acchyperlink.cxx, sw/source/core/doc/visiturl.cxx, sw/source/ui/wrtsh/wrtsh2.cxx: + clean up SwTxtAttr and its subclasses: remove/fix casts, prefix members + SwTxtINetFmt: remove unused member bColor - sw/source/core/text/txtfld.cxx: + move SwTxtFld methods to atrfld.cxx 2009-02-27 10:58:44 +0100 mst r268563 : - sfx2/inc/sfx2/sfxbasemodel.hxx: + don't privately inherit BaseMutex, ScModelObj wants to access it 2009-02-27 10:58:02 +0100 mst r268562 : - xmloff/source/core/{RDFaExportHelper.cxx,RDFaImportHelper.cxx}: + arrrgh!!! someone thought it would be a good idea to have 2 different versions of boost in external! and they're NOT compatible!!! insert an ugly fragile hack that maybe works with both... 2009-02-26 17:42:26 +0100 mst r268544 : - comphelper/inc/comphelper/storagehelper.hxx. sfx2/source/doc/DocumentMetadataAccess.cxx: + someone made IsValidZipEntryFileName a static method and didn't tell me 2009-02-26 15:52:56 +0100 mst r268529 : redland: split up patches 2009-02-26 13:17:56 +0100 mst r268509 : migration of cws odfmetadata2 from CVS (resync to m42): module sw #i95863# - sw/inc/segdefs{,_}.hxx: + remove obsolete files - sw/source/ui/inc/itemdef.hxx: + remove itemdef.hxx - sw/source/ui/app/[apphdl.cxx,docsh.cxx}, sw/source/ui/misc/glshell.cxx, sw/source/ui/shells/*.cxx, sw/source/ui/uiview/*.cxx, sw/source/ui/web/*.cxx: + use sfx2/msg.hxx instead of itemdef.hxx - sw/source/core/edit/eddel.cxx: + @ JP: SwEditShell::Replace: you're right, deleting the text to be replaced first, and then inserting a space, and then replacing that space is unnecessary. whew, i'm so happy that we finally answered that question after 11 years. - sw/inc/edimp.hxx: + remove FOREACHCURSOR_START, FOREACHCURSOR_END - sw/inc/{swcrsr.hxx,unocrsr.hxx,viscrs.hxx}, sw/source/core/crsr/{crsrsh.cxx,swcrsr.cxx,trvlreg.cxx,trvltbl.cxx, unocrsr.cxx,viscrs.cxx}, sw/source/core/doc/{docbm.cxx,doccorr.cxx}, sw/source/core/docnode/{ndtbl.cxx,ndtbl1.cxx}, sw/source/core/edit/editsh.cxx, sw/source/core/frmedt/{fefly1.cxx,fetab.cxx,tblsel.cxx}, sw/source/core/layout/trvlfrm.cxx, sw/source/core/unocore/{unochart.cxx,unoobj2.cxx,unoparagraph.cxx, unoportenum.cxx,unotbl.cxx}, sw/source/core/view/vprint.cxx: + remove the hideous virtual operator SwFooCursor* + make SwCursor::IsReadOnlyAvailable() virtual + make SwUnoCrsr::Clone() virtual + refactor SwCursor methods IsSelOver(), LeftRight(), UpDown(), GotoTable(): replace dynamic_cast<...>(this) with new virtual methods 2009-02-26 13:14:58 +0100 mst r268508 : migration of cws odfmetadata2 from CVS (resync to m42): module sw - sw/source/filter/xml/swxml.cxx: + XMLReader::Read: load RDF metadata of the ODF document - sw/source/filter/xml/wrtxml.cxx: + SwXMLWriter::_Write: write RDF metadata of the ODF document if ODF >= 1.2 #i90620#: import xml:id in text tables (does not actually work yet) - sw/source/filter/xml/xmltbli{.hxx,.cxx}: + SwXMLTableCellAttrTokens,aTableCellAttrTokenMap: add XML_TOK_TABLE_XMLID + SwXMLTableCellContext_Impl::SwXMLTableCellContext_Impl: attribute xml:id + SwXMLTableCellContext_Impl::CreateChildContext: attribute xml:id + SwXMLTableColContext_Impl::SwXMLTableColContext_Impl: attribute xml:id + SwXMLTableContext::SwXMLTableContext: attribute xml:id fix #i98530# - sw/inc/unoport.hxx, sw/source/core/unocore/unoport.cxx: + SwXTextPortion: make constructor params const& - sw/source/core/unocore/unoportenum.cxx: + refactor to remove some code duplication + fix bug: paragraph w/out hints: bookmark before frame gets lost #i97274# handle invalid tables - sw/source/core/layout/tabfrm.cxx, sw/source/filter/xml/xmltbli.cxx: + SwXMLTableContext::MakeTable(): check that the table actually contains cells, and abort (removing the inserted table nodes) if not 2009-02-26 13:11:48 +0100 mst r268507 : migration of cws odfmetadata2 from CVS (resync to m42): module sw refactor SwXTextRange and SwXParagraph - sw/inc/unoobj.hxx, sw/source/core/unocore/unoobj2.cxx: + remove 3 constructors of SwXTextRange + new method SwXTextRange::CreateParentXText + refactor SwXTextRange::CreateTextRangeFromPosition and SwXTextRange::getText - sw/inc/unoobj.hxx, sw/source/core/unocore/unoparagraph.cxx: + SwXParagraph no longer uses a cursor; it registers directly at SwTxtNode + replace SwXParagraph::GetCrsr with SwXParagraph::GetTxtNode - sw/source/core/unocore/unotext.cxx, sw/source/ui/uno/unotxvw.cxx: + adapt to new SwXParagraph #i90620# - sw/inc/SwMetadatable.hxx, sw/source/core/doc/SwMetadatable.cxx: + new files: base classes sw::Metadatable and sw::MetadatableMixin; also, 2 implementations of IXmlIdRegistry: sw::XmlIdRegistryDocument and sw::XmlIdRegistryClipboard + setMetadataReference: handle empty stream name as auto-detect - sw/source/core/doc/makefile.mk: + add SwMetadatable add a XmlIdRegistry to SwDoc - sw/inc/doc.hxx: + SwDoc: add member m_pXmlIdRegistry, method GetXmlIdRegistry() - sw/source/core/doc/docnew.cxx: + initialize XmlIdRegistry in SwDoc::GetXmlIdRegistry, not in constructor, because the constructor is not told whether the SwDoc is a clipboard - sw/inc/docsh.hxx, sw/source/ui/app/docsh.cxx: + SwDocShell: override GetXmlIdRegistry() #i91563#: make the SwTxtNode metadatable - sw/inc/ndtxt.hxx + SwTxtNode inherits sw::Metadatable - sw/inc/unoobj.hxx, sw/source/core/unocore/unoparagraph.cxx: + SwXParagraph inherits sw::MetadatableMixin #i91563#: handle SwTxtNode's metadata for delete - sw/source/core/txtnode/ndtxt.cxx: + SwTxtNode::SplitCntntNode: handle XmlId + SwTxtNode::JoinNext: merge XmlIds - sw/source/core/doc/docedt.cxx: + lcl_GetJoinFlags: document postcondition + SwDoc::Delete: remove XmlId only if SwTxtNode _becomes_ empty #i91563#: handle SwTxtNode's metadata for delete with undo - sw/inc/undobj.hxx + SwUndoDelete: new members m_pMetadataUndoStart, m_pMetadataUndoEnd - sw/source/core/undo/undel.cxx: + SwUndoDelete::SaveCntnt: save XmlIds for start and end SwTxtNode + SwUndoDelete::SaveCntnt: remove XmlId only if SwTxtNode _becomes_ empty + SwUndoDelete::Undo: restore saved XmlIds for start and end SwTxtNode - sw/source/core/docnode/ndcopy.cxx: + SwTxtNode::MakeCopy: register copy at XmlIdRegistry #i91563#: handle SwTxtNode's metadata for find/replace with undo - sw/source/core/undo/unins.cxx: + _UnReplaceData: rename members: add prefix m_ + _UnReplaceData: new members m_pMetadataUndoStart, m_pMetadataUndoEnd + _UnReplaceData::_UnReplaceData: save XmlIds for start and end SwTxtNode + _UnReplaceData::Undo: restore saved XmlIds for start and end SwTxtNode #i91563#: handle SwTxtNode's metadata for table-to-text with undo - sw/source/core/undo/untbl.cxx: + SwTblToTxtSave: rename members: add prefix m_ + SwTblToTxtSave: new members m_pMetadataUndoStart, m_pMetadataUndoEnd + SwTblToTxtSave::SwTblToTxtSave: save XmlIds for start and end SwTxtNode + SwTblToTxtSave::SwTblToTxtSave, SwNodes::UndoTableToText: always store the index of the first SwTxtNode in the cell, instead of the index of the first SwTxtNode in case of the first cell in a row, and the cell start node in other cases + SwNodes::UndoTableToText: restore saved XmlIds for start and end SwTxtNode - sw/source/core/docnode/ndtbl.cxx: + lcl_DelBox: simplify for refactored start index handling in SwTblToTxtSave 2009-02-26 13:02:28 +0100 mst r268505 : migration of cws odfmetadata2 from CVS (resync to m42): module sd - sd/source/ui/table/tableobjectbar.cxx,sd/source/ui/view/*.cxx: + remove invocations of SFX_DECL_TYPE - sd/source/ui/slideshow/SlideShowRestarter.cxx, sd/source/ui/toolpanel/LayoutMenu.cxx, sd/source/ui/unoidl/DrawController.cxx, sd/source/ui/view/{ViewShellBase.cxx,ViewTabBar.cxx,frmview.cxx}: + fix abuses of comphelper_getProcessComponentContext (missing release) 2009-02-26 13:01:24 +0100 mst r268504 : migration of cws odfmetadata2 from CVS (resync to m42): module starmath - starmath/source/document.cxx: + don't touch SfxObjectShell's privates 2009-02-26 13:00:37 +0100 mst r268503 : migration of cws odfmetadata2 from CVS (resync to m42): module sfx2 #i90620# - sfx2/inc/sfx2/XmlIdRegistry.hxx: + new file: interfaces sfx2::IXmlIdRegistry and sfx2::IXmlIdRegistrySupplier and a couple of utility functions - sfx2/inc/sfx2/DocumentMetadataAccess.hxx, sfx2/source/doc/DocumentMetadataAccess.cxx: + new class sfx2::DocumentMetadataAccess, implements XDocumentMetadataAccess + the URI of the DocumentMetadataAccess is now the URI from which the document was loaded; for a new document, use a vnd.sun.star.tdoc URI + add new function sfx2::createBaseURI() + prevent using reserved file names + try not to recurse into embedded subdocuments - sfx2/source/doc/makefile.mk: + add DocumentMetadataAccess - sfx2/util/makefile.mk: + link libsfx2 against libxml2 (needed for xmlValidateNCName) - sfx2/source/doc/makefile.mk: + add LIBXML_CFLAGS to CFLAGS - sfx2/prj/build.lst: + add dependence on libxml2 - sfx2/prj/d.lst: + add XmlIdRegistry.hxx, DocumentMetadataAccess.hxx - sfx2/inc/sfx2/objsh.hxx, sfx2/source/doc/objxtor.cxx: + make SfxObjectShell's members private + new method SfxObjectShell::GetAutoStyleFilterIndex + SfxObjectShell inherits sfx2::IXmlIdRegistrySupplier - sfx2/source/dialog/templdlg.cxx, sfx2/source/doc/sfxbasemodel.cxx: + don't touch SfxObjectShell's privates - sfx2/inc/sfx2/sfxbasemodel.hxx, sfx2/source/doc/sfxbasemodel.cxx: + SfxBaseModel inherits BaseMutex instead of IMPL_SfxBaseModel_MutexContainer + SfxBaseModel implements additional interface XDocumentMetadataAccess + IMPL_SfxBaseModel_DataContainer has new member: a sfx2::DocumentMetadataAccess + implementation of XDocumentMetadataAccess forwards to the sfx2::DocumentMetadataAccess member - sfx2/qa/complex/DocumentMetadataAccessTest.java, sfx2/qa/complex/{tests.sce,makefile.mk}, sfx2/qa/complex/testdocuments/TESTRDFA.odt: + add complex test: DocumentMetadataAccessTest + add RDFa test document #i95863# - sfx2/inc/sfx2/dinfdlg.hxx, sfx2/source/dialog/dinfdlg.cxx: + refactor SfxDocumentItem so it no longer requires a XDocumentInfo + move struct CustomProperty to implementation file + remove class SfxDocumentUserPage + QueryValue,PutValue: remove MID_DOCINFO_FIELD* - sfx2/source/doc/objserv.cxx: + adapt to SfxDocumentItem change - sfx2/inc/sfx2/sfx.hrc, sfx2/sdi/sfxslots.sdi, sfx2/inc/sfx2/msg.hxx: + remove MID_DOCINFO_FIELD* + put all invocations of SFX_DECL_TYPE in msg.hxx, and undef SFX_DECL_TYPE - sfx2/source/doc/objxtor.cxx: + fix abuses of comphelper_getProcessComponentContext (missing release) - sfx2/source/doc/docfile.cxx: + SfxMedium::SfxMedium: don't dereference NULL, throw exception instead - sfx2/source/doc/objstor.cxx: + SfxObjectShell::DoLoad: fix bug: DocumentBaseURI is not initialized 2009-02-26 12:58:07 +0100 mst r268502 : migration of cws odfmetadata2 from CVS (resync to m42): module xmloff #i90620#: implement RDFa import (interface change) - xmloff/inc/xmloff/xmlimp.hxx. xmloff/source/core/xmlimp.cxx: + make SvXMLImport::GetAbsoluteReference() const + add SvXMLImport::GetComponentContext() + SvXMLImport::_InitCtor(): add RDFa namespace + add SvXMLImport::AddRDFa() + SvXMLImport::endDocument() inserts RDFa into document repository - xmloff/inc/xmloff/xmltoken.hxx, xmloff/source/core/xmltoken.cxx: + new tokens for RDFa: XML_ABOUT, XML_DATATYPE - xmloff/inc/RDFaImportHelper.hxx, xmloff/source/core/RDFaImportHelper.cxx: + new class RDFaImportHelper + adapt the code to the bleak reality of broken C++ implementations + handle empty xhtml:about attributes properly, which are actually valid relative URIs + work around broken SvXMLImport::GetAbsoluteReference - xmloff/source/core/makefile.mk: + add RDFaImportHelper.cxx #i90620#: implement RDFa export - xmloff/inc/xmloff/xmlexp.hxx, xmloff/source/core/xmlexp.cxx: + add SvXMLExport::EnsureNamespace(), and a stack of namespace maps + add SvXMLExport::GetComponentContext() + add SvXMLExport::AddAttributesRDFa() - xmloff/inc/RDFaExportHelper.hxx, xmloff/source/core/RDFaExportHelper.cxx: + new class RDFaExportHelper + don't use std::map::data_type, which is actually called std::map::mapped_type by libstdc++ - xmloff/source/core/makefile.mk: + add RDFaExportHelper.cxx #i91563# - xmloff/inc/xmloff/txtimp.hxx, xmloff/source/text/txtimp.cxx: + XMLTextPAttrTokens: add RDFa tokens - xmloff/source/text/txtparai{.hxx,.cxx}: + import RDFa for text:p - xmloff/source/text/txtparae.cxx: + export RDFa for text:p interface change: use XHTML namespace instead of RDFA - xmloff/inc/xmlnmspe.hxx, xmloff/inc/xmloff/xmltoken.hxx, xmloff/source/core/{xmltoken.cxx,xmlimp.cxx,xmlexp.cxx,RDFaExportHelper.cxx}, xmloff/source/text/txtimp.cxx: + use XHTML namespace instead of RDFA #i91565#, #i91566#: (preliminary) import for text:meta, text:meta-field - xmloff/source/text/txtparai.cxx: + new class XMLMetaImportContextBase with subclasses to import text:meta and text:meta-field - xmloff/source/text/XMLTextMarkImportContext.cxx: + change XMLTextMarkImportContext::CreateAndInsertMark to handle marks with no name (text:meta) #i91565#, #i91566#: (preliminary) export for text:meta, text:meta-field - xmloff/inc/txtflde.hxx, xmloff/source/text/txtflde.cxx: + add FIELD_ID_META to FieldIdEnum + new method XMLTextFieldExport::ExportMetaField() + change XMLTextFieldExport::ExportField{,AutoStyle,Helper} to take additional parameter for progress bar - xmloff/inc/xmloff/txtparae.hxx, xmloff/source/text/txtparae.cxx: + make XMLTextParagraphExport::exportTextRangeEnumeration() public + new method XMLTextParagraphExport::exportMeta() #i90620# - xmloff/inc/xmloff/xmlimp.hxx, xmloff/source/core/xmlimp.cxx, xmloff/inc/xmloff/xmlexp.hxx, xmloff/source/core/xmlexp.cxx: + rename SvXML{Im,Ex}port::GetStreamPath() to GetStreamName() + fix xml:id {im,ex}port for embedded documents and non-packages + adapt to API change: XMetadatable #i90620# GRDDL - xmloff/inc/xmlnmspe.hxx, xmloff/inc/xmloff/xmltoken.hxx, xmloff/source/core/{xmltoken.cxx,xmlexp.cxx}: + add GRDDL namespace + add token XML_TRANSFORMATION + add grddl:transformation attribute to root elements for meta.xml, content.xml and styles.xml 2009-02-26 12:54:40 +0100 mst r268501 : migration of cws odfmetadata2 from CVS (resync to m42): module unoxml #i90620# - unoxml/source/rdf/librdf_repository.cxx: + librdf_Repository::importGraph: allocate buffer sized length of stream + switch from one librdf_world per repository to a single static world because redland has global variables with a brain-damaged life-cycle... + exportGraph: use new raptor 1.4.18 feature to disable writing an xml:base attribute in RDF/XML files - unoxml/source/rdf/librdf_repository.cxx: unoxml/qa/complex/RDFRepositoryTest.java: + adapt to predicate is URI change + adapt to RDFa API change + adapt to API change: RDFa has multiple predicates... + adapt to API change: XMetadatable derives from XURI + allow xhtml:datatype without xhtml:content + adapt to API change: attribute MetadataReference is StringPair - unoxml/source/rdf/CURI.cxx: + add some more URI constants 2009-02-26 12:53:32 +0100 mst r268500 : migration of cws odfmetadata2 from CVS (resync to m42): module package - package/inc/ImplValidCharacters.hxx: + remove (moved to comphelper) 2009-02-26 12:52:49 +0100 mst r268499 : migration of cws odfmetadata2 from CVS (resync to m42): module comphelper - comphelper/inc/comphelper/processfactory.hxx, comphelper/source/processfactory/processfactory.cxx: + add getProcessComponentContext() + change return type of comphelper_getProcessComponentContext to Reference - comphelper/inc/comphelper/stl_types.hxx: + add OUStringBufferAppender + add algorithm intersperse - comphelper/source/misc/string.cxx: + rewrite convertCommaSeparated with intersperse and OUStringBufferAppender - comphelper/inc/comphelper/stlunosequence.hxx: + fix bug: begin() on empty sequence != end() 2009-02-26 12:50:47 +0100 mst r268498 : migration of cws odfmetadata2 from CVS (resync to m42): module offapi #i96209# - offapi/com/sun/star/text/fieldmaster/*.idl: + rename module from FieldMaster to fieldmaster - offapi/type_reference/{typelibrary_history.txt,types.rdb}: + update reference types.rdb #i90620# - offapi/com/sun/star/rdf/{XMetadatable.idl,XDocumentMetadataAccess.idl}: + API change: XMetadatable derives from XURI + API change: replace XmlId (string) with MetadataReference (StringPair) - offapi/com/sun/star/rdf/{Statement.idl,XDocumentRepository.idl, XNamedGraph.idl,XRepository.idl}: + the predicate of a statement is a URI, not a Resource - offapi/com/sun/star/rdf/XDocumentMetadataAccess.idl: + rename: s/Package/Document/ + remove uuid + remove everything related to mapping + graph names are now generated from base URI and file names + load methods: improve error handling with XInteractionHandler - offapi/com/sun/star/rdf/XDocumentRepository.idl: + change: RDFa permits using multiple predicates in one attribute + setStatementRDFa: subject is now XResource, object is now XMetadatable - offapi/com/sun/star/rdf/URIs.idl: + add some more URI constants - offapi/com/sun/star/rdf: + fix @since tags and replace <method> with <member> 2009-02-26 12:47:24 +0100 mst r268497 : migration of cws odfmetadata2 from CVS (resync to m42): module redland fix #i93768# - redland/raptor-1.4.17.patch, redland/raptor/makefile.mk: + disable GRDDL parser to prevent call to libxslt xsltSetDefaultSecurityPrefs, which breaks xmlhelp - redland/raptor/makefile.mk, redland/raptor-1.4.17.patch, redland/raptor-1.4.18.patch: + upgrade raptor to 1.4.18 + deactivate serializer for RSS/Atom (does not build) - redland/rasqal/makefile.mk, redland/rasqal-0.9.15.patch, redland/rasqal-0.9.16.patch, + upgrade rasqal to 0.9.16 - redland/redland/makefile.mk, redland/redland-1.0.7.patch, redland/redland-1.0.8.patch: + upgrade redland to 1.0.8 - redland/redlandversion.mk: + the librasqal SONAME has changed
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/inc/RDFaExportHelper.hxx83
-rw-r--r--xmloff/inc/RDFaImportHelper.hxx91
-rw-r--r--xmloff/inc/txtflde.hxx18
-rw-r--r--xmloff/inc/xmlnmspe.hxx5
-rw-r--r--xmloff/inc/xmloff/txtimp.hxx4
-rw-r--r--xmloff/inc/xmloff/txtparae.hxx21
-rw-r--r--xmloff/inc/xmloff/xmlexp.hxx28
-rw-r--r--xmloff/inc/xmloff/xmlimp.hxx20
-rw-r--r--xmloff/inc/xmloff/xmltoken.hxx9
-rw-r--r--xmloff/source/core/RDFaExportHelper.cxx218
-rw-r--r--xmloff/source/core/RDFaImportHelper.cxx458
-rw-r--r--xmloff/source/core/makefile.mk5
-rw-r--r--xmloff/source/core/xmlexp.cxx225
-rw-r--r--xmloff/source/core/xmlimp.cxx79
-rw-r--r--xmloff/source/core/xmltoken.cxx9
-rw-r--r--xmloff/source/text/XMLTextMarkImportContext.cxx60
-rw-r--r--xmloff/source/text/txtflde.cxx76
-rw-r--r--xmloff/source/text/txtimp.cxx6
-rw-r--r--xmloff/source/text/txtparae.cxx64
-rw-r--r--xmloff/source/text/txtparai.cxx372
-rw-r--r--xmloff/source/text/txtparai.hxx7
21 files changed, 1658 insertions, 200 deletions
diff --git a/xmloff/inc/RDFaExportHelper.hxx b/xmloff/inc/RDFaExportHelper.hxx
new file mode 100644
index 0000000000..1578dba90c
--- /dev/null
+++ b/xmloff/inc/RDFaExportHelper.hxx
@@ -0,0 +1,83 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: RDFaExportHelper.hxx,v $
+ * $Revision: 1.1.2.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef RDFAEXPORTHELPER_HXX
+#define RDFAEXPORTHELPER_HXX
+
+#include <com/sun/star/uno/Reference.h>
+
+#include <rtl/ustring.hxx>
+
+#include <map>
+
+
+namespace com { namespace sun { namespace star {
+ namespace rdf { class XBlankNode; }
+ namespace rdf { class XMetadatable; }
+ namespace rdf { class XDocumentRepository; }
+} } }
+
+class SvXMLExport;
+
+namespace xmloff {
+
+class SAL_DLLPRIVATE RDFaExportHelper
+{
+private:
+ SvXMLExport & m_rExport;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XDocumentRepository> m_xRepository;
+
+ ::rtl::OUString m_RDFsLabel;
+
+ typedef ::std::map< ::rtl::OUString, ::rtl::OUString >
+ BlankNodeMap_t;
+
+ BlankNodeMap_t m_BlankNodeMap;
+
+ long m_Counter;
+
+ ::rtl::OUString
+ LookupBlankNode( ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XBlankNode> const & i_xBlankNode);
+
+public:
+ RDFaExportHelper(SvXMLExport & i_rExport);
+
+ void
+ AddRDFa(::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XMetadatable> const & i_xMetadatable);
+};
+
+} // namespace xmloff
+
+#endif // RDFAEXPORTHELPER_HXX
+
diff --git a/xmloff/inc/RDFaImportHelper.hxx b/xmloff/inc/RDFaImportHelper.hxx
new file mode 100644
index 0000000000..431bf18807
--- /dev/null
+++ b/xmloff/inc/RDFaImportHelper.hxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: RDFaImportHelper.hxx,v $
+ * $Revision: 1.1.2.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef RDFAIMPORTHELPER_HXX
+#define RDFAIMPORTHELPER_HXX
+
+#include <com/sun/star/uno/Reference.h>
+
+#include <vector>
+
+
+namespace rtl { class OUString; }
+
+namespace com { namespace sun { namespace star {
+ namespace uno { class XComponentContext; }
+ namespace rdf { class XMetadatable; }
+ namespace rdf { class XRepositorySupplier; }
+} } }
+
+class SvXMLImport;
+
+namespace xmloff {
+
+struct RDFaEntry;
+
+class SAL_DLLPRIVATE RDFaImportHelper
+{
+
+private:
+ const SvXMLImport & m_rImport;
+
+ typedef ::std::vector< RDFaEntry > RDFaEntries_t;
+
+ RDFaEntries_t m_RDFaEntries;
+
+ const SvXMLImport & GetImport() const { return m_rImport; }
+
+
+public:
+ RDFaImportHelper(const SvXMLImport & i_rImport);
+
+ ~RDFaImportHelper();
+
+ /** Add a RDFa statement; parameters are XML attribute values */
+ void AddRDFa(
+ ::com::sun::star::uno::Reference< ::com::sun::star::rdf::XMetadatable>
+ i_xObject,
+ ::rtl::OUString const & i_rAbout,
+ ::rtl::OUString const & i_rProperty,
+ ::rtl::OUString const & i_rContent,
+ ::rtl::OUString const & i_rDatatype);
+
+ /** Insert all added statements into the RDF repository.
+ <p> This is done <em>after</em> the input file has been read,
+ to prevent collision between generated ids and ids in the file.</p>
+ */
+ void InsertRDFa( ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XRepositorySupplier > const & i_xModel);
+};
+
+} // namespace xmloff
+
+#endif // RDFAIMPORTHELPER_HXX
+
diff --git a/xmloff/inc/txtflde.hxx b/xmloff/inc/txtflde.hxx
index a87b01b721..fe988a8773 100644
--- a/xmloff/inc/txtflde.hxx
+++ b/xmloff/inc/txtflde.hxx
@@ -38,9 +38,7 @@
#include <com/sun/star/uno/Reference.h>
#include "xmlnmspe.hxx"
-#ifndef _RTL_USTRING
#include <rtl/ustring.hxx>
-#endif
#include <xmloff/xmltoken.hxx>
#include <map>
@@ -148,6 +146,8 @@ enum FieldIdEnum {
FIELD_ID_COMBINED_CHARACTERS, // combined characters (asian typography)
+ FIELD_ID_META, // text:meta-field (RDF metadata)
+
FIELD_ID_MEASURE, // for measure shapes
FIELD_ID_TABLE_FORMULA, // DEPRECATED: table formulas (Writer 2.0)
@@ -182,14 +182,16 @@ public:
/// Export this field and the surrounding span element with the formatting.
/// To be called for every field in the document body.
void ExportField(const ::com::sun::star::uno::Reference <
- ::com::sun::star::text::XTextField > & rTextField );
+ ::com::sun::star::text::XTextField > & rTextField,
+ sal_Bool bProgress );
/// collect styles (character styles, data styles, ...) for this field
/// (if appropriate).
/// Also collect used field masters (if pUsedMasters is set)
/// to be called for every field during style export.
void ExportFieldAutoStyle(const ::com::sun::star::uno::Reference <
- ::com::sun::star::text::XTextField > & rTextField );
+ ::com::sun::star::text::XTextField > & rTextField,
+ sal_Bool bProgress );
/// export field declarations.
/// to be called once at beginning of document body.
@@ -239,7 +241,8 @@ protected:
::com::sun::star::beans::XPropertySet> & rPropSet,
const ::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet> & rRangePropSet,
- enum FieldIdEnum nToken);
+ enum FieldIdEnum nToken,
+ sal_Bool bProgress );
/// export an empty element
void ExportElement(enum ::xmloff::token::XMLTokenEnum eElement, /// element token
@@ -257,6 +260,11 @@ protected:
::com::sun::star::beans::XPropertySet> & rPropSet,
const ::rtl::OUString& rContent);
+ /// export text:meta-field (RDF metadata)
+ void ExportMetaField( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & i_xMeta,
+ bool i_bAutoStyles, sal_Bool i_bProgress );
+
/// export a boolean attribute
void ProcessBoolean(
enum ::xmloff::token::XMLTokenEnum eXmlName, /// attribute token (namespace text)
diff --git a/xmloff/inc/xmlnmspe.hxx b/xmloff/inc/xmlnmspe.hxx
index a3212f2477..86fc13ba31 100644
--- a/xmloff/inc/xmlnmspe.hxx
+++ b/xmloff/inc/xmlnmspe.hxx
@@ -79,9 +79,10 @@ XML_NAMESPACE( ANIMATION, 31U )
XML_NAMESPACE( XML, 32U )
XML_NAMESPACE( REPORT, 33U )
XML_NAMESPACE( OF, 34U ) // OpenFormula aka ODFF
-XML_NAMESPACE( RDFA, 35U )
+XML_NAMESPACE( XHTML, 35U )
+XML_NAMESPACE( GRDDL, 36U )
-#define _XML_OLD_NAMESPACE_BASE 36U
+#define _XML_OLD_NAMESPACE_BASE 37U
// namespaces used in the technical preview (SO 5.2)
XML_OLD_NAMESPACE( FO, 0U )
diff --git a/xmloff/inc/xmloff/txtimp.hxx b/xmloff/inc/xmloff/txtimp.hxx
index e2544ec345..381973917d 100644
--- a/xmloff/inc/xmloff/txtimp.hxx
+++ b/xmloff/inc/xmloff/txtimp.hxx
@@ -253,6 +253,10 @@ enum XMLTextPElemTokens
enum XMLTextPAttrTokens
{
XML_TOK_TEXT_P_XMLID,
+ XML_TOK_TEXT_P_ABOUT,
+ XML_TOK_TEXT_P_PROPERTY,
+ XML_TOK_TEXT_P_CONTENT,
+ XML_TOK_TEXT_P_DATATYPE,
XML_TOK_TEXT_P_STYLE_NAME,
XML_TOK_TEXT_P_COND_STYLE_NAME,
XML_TOK_TEXT_P_LEVEL,
diff --git a/xmloff/inc/xmloff/txtparae.hxx b/xmloff/inc/xmloff/txtparae.hxx
index 2794f26991..00a014a9f8 100644
--- a/xmloff/inc/xmloff/txtparae.hxx
+++ b/xmloff/inc/xmloff/txtparae.hxx
@@ -38,9 +38,7 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <xmloff/uniref.hxx>
#include <xmloff/xmlexppr.hxx>
-#ifndef _XMLOFF_STYLEEXP_HXX
#include <xmloff/styleexp.hxx>
-#endif
#include <xmloff/xmltoken.hxx>
#include <xmloff/SinglePropertySetInfoCache.hxx>
#include <xmloff/XMLStringVector.hxx>
@@ -264,6 +262,12 @@ public:
const ::com::sun::star::uno::Reference <
::com::sun::star::beans::XPropertySetInfo > & rPropSetInfo );
+ void exportTextRangeEnumeration(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::container::XEnumeration > & rRangeEnum,
+ sal_Bool bAutoStyles, sal_Bool bProgress,
+ sal_Bool bPrvChrIsSpc = sal_True );
+
protected:
sal_Int32 addTextFrameAttributes(
@@ -316,16 +320,11 @@ protected:
const ::com::sun::star::uno::Reference <
::com::sun::star::text::XTextContent > & rTextContent,
sal_Bool bAutoStyles, sal_Bool bProgress );
- void exportTextRangeEnumeration(
- const ::com::sun::star::uno::Reference <
- ::com::sun::star::container::XEnumeration > & rRangeEnum,
- sal_Bool bAutoStyles, sal_Bool bProgress,
- sal_Bool bPrvChrIsSpc = sal_True );
void exportTextField(
const ::com::sun::star::uno::Reference <
::com::sun::star::text::XTextRange > & rTextRange,
- sal_Bool bAutoStyles );
+ sal_Bool bAutoStyles, sal_Bool bProgress );
void exportAnyTextFrame(
const ::com::sun::star::uno::Reference <
@@ -484,6 +483,12 @@ protected:
::com::sun::star::beans::XPropertySet> & rPortionPropSet,
sal_Bool bAutoStyles );
+ /// export a text:meta
+ void exportMeta(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & i_xMeta,
+ sal_Bool i_bAutoStyles, sal_Bool i_isProgress );
+
public:
XMLTextParagraphExport(
diff --git a/xmloff/inc/xmloff/xmlexp.hxx b/xmloff/inc/xmloff/xmlexp.hxx
index 6f660dce62..37d81a72a9 100644
--- a/xmloff/inc/xmloff/xmlexp.hxx
+++ b/xmloff/inc/xmloff/xmlexp.hxx
@@ -92,6 +92,7 @@ class XMLErrors;
namespace rtl { class OUString; }
namespace com { namespace sun { namespace star {
+ namespace uno { class XComponentContext; }
namespace frame { class XModel; }
namespace container { class XIndexContainer; }
} } }
@@ -362,6 +363,22 @@ public:
// XUnoTunnel
virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+ /** ensures that the given namespace is in scope at the next started
+ element.
+
+ <p>If the namespace is not yet declared, the necessary attribute will
+ be added, as well.</p>
+
+ @param i_rNamespace the namespace to be declared
+ @param i_rPreferredPrefix (opt.) preferred prefix for the namespace
+
+ @returns the actual prefix that the namespace is associated with
+ */
+ ::rtl::OUString
+ EnsureNamespace(::rtl::OUString const & i_rNamespace,
+ ::rtl::OUString const & i_rPreferredPrefix
+ = ::rtl::OUString::createFromAscii("gen") );
+
// Check if common attribute list is empty.
#ifdef PRODUCT
void CheckAttrList() {}
@@ -553,6 +570,9 @@ public:
// #110680#
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getServiceFactory();
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ GetComponentContext() const;
+
// --> OD 2006-03-10 #i51726#
SvtModuleOptions::EFactory GetModelType() const
{
@@ -570,13 +590,17 @@ public:
/// returns the currently configured default version for odf export
SvtSaveOptions::ODFDefaultVersion getDefaultVersion() const;
- /// relative path of stream in package, e.g. "someobject/content.xml"
- ::rtl::OUString GetStreamPath() const;
+ /// name of stream in package, e.g., "content.xml"
+ ::rtl::OUString GetStreamName() const;
/// add xml:id attribute (for RDF metadata)
void AddAttributeXmlId(::com::sun::star::uno::Reference<
::com::sun::star::uno::XInterface> const & i_xIfc);
+ /// add RDFa attributes for a metadatable text content
+ void AddAttributesRDFa( ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextContent> const & i_xTextContent);
+
// --> OD 2008-11-26 #158694#
sal_Bool exportTextNumberElement() const;
// <--
diff --git a/xmloff/inc/xmloff/xmlimp.hxx b/xmloff/inc/xmloff/xmlimp.hxx
index 3ca4633a66..5cc2734cf9 100644
--- a/xmloff/inc/xmloff/xmlimp.hxx
+++ b/xmloff/inc/xmloff/xmlimp.hxx
@@ -61,8 +61,10 @@
namespace rtl { class OUString; }
namespace com { namespace sun { namespace star {
+ namespace uno { class XComponentContext; }
namespace frame { class XModel; }
namespace io { class XOutputStream; }
+ namespace rdf { class XMetadatable; }
} } }
namespace comphelper { class UnoInterfaceToUniqueIdentifierMapper; }
@@ -346,7 +348,7 @@ public:
sal_uInt16 getImportFlags() const { return mnImportFlags; }
sal_Bool IsFormsSupported() const { return mbIsFormsSupported; }
- rtl::OUString GetAbsoluteReference(const rtl::OUString& rValue);
+ rtl::OUString GetAbsoluteReference(const rtl::OUString& rValue) const;
sal_Unicode ConvStarBatsCharToStarSymbol( sal_Unicode c );
sal_Unicode ConvStarMathCharToStarSymbol( sal_Unicode c );
@@ -400,6 +402,9 @@ public:
// #110680#
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getServiceFactory();
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ GetComponentContext() const;
+
// --> OD 2004-08-10 #i28749#
sal_Bool IsShapePositionInHoriL2R() const;
// <--
@@ -411,14 +416,23 @@ public:
String GetBaseURL() const;
String GetDocumentBase() const;
- /// relative path of stream in package, e.g. "someobject/content.xml"
- ::rtl::OUString GetStreamPath() const;
+ /// name of stream in package, e.g., "content.xml"
+ ::rtl::OUString GetStreamName() const;
/// set the XmlId attribute of given UNO object (for RDF metadata)
void SetXmlId(::com::sun::star::uno::Reference<
::com::sun::star::uno::XInterface> const & i_xIfc,
::rtl::OUString const & i_rXmlId);
+ /// Add a RDFa statement; parameters are XML attribute values
+ void AddRDFa(
+ ::com::sun::star::uno::Reference< ::com::sun::star::rdf::XMetadatable>
+ i_xObject,
+ ::rtl::OUString const & i_rAbout,
+ ::rtl::OUString const & i_rProperty,
+ ::rtl::OUString const & i_rContent,
+ ::rtl::OUString const & i_rDatatype);
+
// #i31958# XForms helper method
// (to be implemented by applications suporting XForms)
virtual void initXForms();
diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx
index 14ccf7a3a9..2620e3da20 100644
--- a/xmloff/inc/xmloff/xmltoken.hxx
+++ b/xmloff/inc/xmloff/xmltoken.hxx
@@ -138,9 +138,11 @@ namespace xmloff { namespace token {
XML_NP_OF,
XML_N_OF,
- // ODF 1.2 metadata: RDFa
- XML_NP_RDFA,
- XML_N_RDFA,
+ // ODF 1.2 metadata: RDFa and GRDDL
+ XML_NP_XHTML,
+ XML_N_XHTML,
+ XML_NP_GRDDL,
+ XML_N_GRDDL,
// units
XML_UNIT_MM,
@@ -3041,6 +3043,7 @@ namespace xmloff { namespace token {
XML_META_FIELD,
XML_ABOUT,
XML_DATATYPE,
+ XML_TRANSFORMATION,
// ODF 1.2 numbered-paragraph
XML_LIST_ID,
diff --git a/xmloff/source/core/RDFaExportHelper.cxx b/xmloff/source/core/RDFaExportHelper.cxx
new file mode 100644
index 0000000000..6c174e8638
--- /dev/null
+++ b/xmloff/source/core/RDFaExportHelper.cxx
@@ -0,0 +1,218 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: RDFaExportHelper.cxx,v $
+ * $Revision: 1.1.2.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_xmloff.hxx"
+
+#include "RDFaExportHelper.hxx"
+
+#include "xmlnmspe.hxx"
+
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmltoken.hxx>
+
+#include <comphelper/stlunosequence.hxx>
+#include <comphelper/stl_types.hxx>
+
+#include <com/sun/star/rdf/Statement.hpp>
+#include <com/sun/star/rdf/URIs.hpp>
+#include <com/sun/star/rdf/URI.hpp>
+#include <com/sun/star/rdf/XLiteral.hpp>
+#include <com/sun/star/rdf/XRepositorySupplier.hpp>
+#include <com/sun/star/rdf/XDocumentRepository.hpp>
+
+#include <rtl/ustrbuf.hxx>
+
+#include <boost/bind.hpp>
+#include <boost/iterator_adaptors.hpp>
+#ifndef BOOST_ITERATOR_ADAPTOR_DWA053000_HPP_ // from iterator_adaptors.hpp
+// N.B.: the check for the header guard _of a specific version of boost_
+// is here so this may work on different versions of boost,
+// which sadly put the goods in different header files
+#include <boost/iterator/transform_iterator.hpp>
+#endif
+
+#include <functional>
+#include <algorithm>
+
+
+using namespace ::com::sun::star;
+
+namespace xmloff {
+
+static const char s_prefix [] = "_:b";
+
+static ::rtl::OUString
+makeCURIE(SvXMLExport * i_pExport,
+ uno::Reference<rdf::XURI> const & i_xURI)
+{
+ OSL_ENSURE(i_xURI.is(), "makeCURIE: null URI");
+ if (!i_xURI.is()) throw uno::RuntimeException();
+
+ const ::rtl::OUString Namespace( i_xURI->getNamespace() );
+ OSL_ENSURE(Namespace.getLength(), "makeCURIE: no namespace");
+ if (!Namespace.getLength()) throw uno::RuntimeException();
+
+ ::rtl::OUStringBuffer buf;
+ buf.append( i_pExport->EnsureNamespace(Namespace) );
+ buf.append( static_cast<sal_Unicode>(':') );
+ // N.B.: empty LocalName is valid!
+ buf.append( i_xURI->getLocalName() );
+
+ return buf.makeStringAndClear();
+}
+
+////////////////////////////////////////////////////////////////////////////
+
+RDFaExportHelper::RDFaExportHelper(SvXMLExport & i_rExport)
+ : m_rExport(i_rExport), m_xRepository(0), m_Counter(0)
+{
+ const uno::Reference<rdf::XRepositorySupplier> xRS( m_rExport.GetModel(),
+ uno::UNO_QUERY);
+ OSL_ENSURE(xRS.is(), "AddRDFa: model is no rdf::XRepositorySupplier");
+ if (!xRS.is()) throw uno::RuntimeException();
+ m_xRepository.set(xRS->getRDFRepository(), uno::UNO_QUERY_THROW);
+
+ const uno::Reference<rdf::XURI> xLabel(
+ rdf::URI::createKnown(m_rExport.GetComponentContext(),
+ rdf::URIs::RDFS_LABEL));
+ m_RDFsLabel = xLabel->getStringValue();
+}
+
+::rtl::OUString
+RDFaExportHelper::LookupBlankNode(
+ uno::Reference<rdf::XBlankNode> const & i_xBlankNode)
+{
+ OSL_ENSURE(i_xBlankNode.is(), "null BlankNode?");
+ if (!i_xBlankNode.is()) throw uno::RuntimeException();
+ ::rtl::OUString & rEntry(
+ m_BlankNodeMap[ i_xBlankNode->getStringValue() ] );
+ if (!rEntry.getLength())
+ {
+ ::rtl::OUStringBuffer buf;
+ buf.appendAscii(s_prefix);
+ buf.append(++m_Counter);
+ rEntry = buf.makeStringAndClear();
+ }
+ return rEntry;
+}
+
+////////////////////////////////////////////////////////////////////////////
+
+void
+RDFaExportHelper::AddRDFa(
+ uno::Reference<rdf::XMetadatable> const & i_xMetadatable)
+{
+ try
+ {
+ uno::Sequence<rdf::Statement> stmts(
+ m_xRepository->getStatementRDFa(i_xMetadatable) );
+
+ if (0 == stmts.getLength())
+ {
+ return; // no RDFa
+ }
+
+ // all stmts have the same subject, so we only handle first one
+ const uno::Reference<rdf::XURI> xSubjectURI(stmts[0].Subject,
+ uno::UNO_QUERY);
+ const uno::Reference<rdf::XBlankNode> xSubjectBNode(stmts[0].Subject,
+ uno::UNO_QUERY);
+ if (!xSubjectURI.is() && !xSubjectBNode.is())
+ {
+ throw uno::RuntimeException();
+ }
+ static const sal_Unicode s_OpenBracket ('[');
+ static const sal_Unicode s_CloseBracket(']');
+ const ::rtl::OUString about( xSubjectURI.is()
+ ? m_rExport.GetRelativeReference(xSubjectURI->getStringValue())
+ : ::rtl::OUStringBuffer().append(s_OpenBracket).append(
+ LookupBlankNode(xSubjectBNode)).append(s_CloseBracket)
+ .makeStringAndClear()
+ );
+
+ const ::comphelper::StlUnoSequence<rdf::Statement>::iterator iter
+ ( ::std::partition( ::comphelper::stl_begin(stmts),
+ ::comphelper::stl_end(stmts),
+ ::boost::bind(&::rtl::OUString::equals, m_RDFsLabel,
+ ::boost::bind(&rdf::XNode::getStringValue,
+ ::boost::bind(&rdf::Statement::Predicate, _1))) ) );
+
+ if (iter != ::comphelper::stl_end(stmts))
+ {
+ // from iter to end, all stmts should have same object
+ const uno::Reference<rdf::XLiteral> xContent(
+ (*iter).Object, uno::UNO_QUERY_THROW );
+ const uno::Reference<rdf::XURI> xDatatype(xContent->getDatatype());
+ if (xDatatype.is())
+ {
+ const ::rtl::OUString datatype(
+ makeCURIE(&m_rExport, xDatatype) );
+ m_rExport.AddAttribute(XML_NAMESPACE_XHTML,
+ token::XML_DATATYPE, datatype);
+ }
+ if (iter != ::comphelper::stl_begin(stmts)) // there is rdfs:label
+ {
+ m_rExport.AddAttribute(XML_NAMESPACE_XHTML, token::XML_CONTENT,
+ xContent->getValue());
+ }
+ }
+ else
+ {
+ OSL_ENSURE(false,"invalid RDFa: every property is rdfs:label");
+ return;
+ }
+
+ ::rtl::OUStringBuffer property;
+ ::comphelper::intersperse(
+ ::boost::make_transform_iterator(
+ iter, // omit RDFsLabel predicates!
+ ::boost::bind(&makeCURIE, &m_rExport,
+ ::boost::bind(&rdf::Statement::Predicate, _1))),
+ // argh, this must be the same type :(
+ ::boost::make_transform_iterator(
+ ::comphelper::stl_end(stmts),
+ ::boost::bind(&makeCURIE, &m_rExport,
+ ::boost::bind(&rdf::Statement::Predicate, _1))),
+ ::comphelper::OUStringBufferAppender(property),
+ ::rtl::OUString::createFromAscii(" "));
+
+ m_rExport.AddAttribute(XML_NAMESPACE_XHTML, token::XML_PROPERTY,
+ property.makeStringAndClear());
+
+ m_rExport.AddAttribute(XML_NAMESPACE_XHTML, token::XML_ABOUT, about);
+ }
+ catch (uno::Exception &)
+ {
+ OSL_ENSURE(false, "AddRDFa: exception");
+ }
+}
+
+} // namespace xmloff
+
diff --git a/xmloff/source/core/RDFaImportHelper.cxx b/xmloff/source/core/RDFaImportHelper.cxx
new file mode 100644
index 0000000000..2846042177
--- /dev/null
+++ b/xmloff/source/core/RDFaImportHelper.cxx
@@ -0,0 +1,458 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: RDFaImportHelper.cxx,v $
+ * $Revision: 1.1.2.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_xmloff.hxx"
+
+#include "RDFaImportHelper.hxx"
+
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/nmspmap.hxx>
+
+#include <comphelper/sequenceasvector.hxx>
+
+#include <tools/string.hxx> // for GetAbsoluteReference
+
+#include <com/sun/star/rdf/URI.hpp>
+#include <com/sun/star/rdf/XDocumentMetadataAccess.hpp>
+#include <com/sun/star/rdf/XDocumentRepository.hpp>
+
+#include <rtl/ustring.hxx>
+
+#include <boost/bind.hpp>
+#include <boost/iterator_adaptors.hpp>
+#ifndef BOOST_ITERATOR_ADAPTOR_DWA053000_HPP_ // from iterator_adaptors.hpp
+// N.B.: the check for the header guard _of a specific version of boost_
+// is here so this may work on different versions of boost,
+// which sadly put the goods in different header files
+#include <boost/iterator/transform_iterator.hpp>
+#endif
+
+#include <map>
+#include <iterator>
+#include <functional>
+#include <algorithm>
+
+
+using namespace ::com::sun::star;
+
+namespace xmloff {
+
+/** a bit of context for parsing RDFa attributes */
+class SAL_DLLPRIVATE RDFaReader
+{
+ const SvXMLImport & m_rImport;
+
+ const SvXMLImport & GetImport() const { return m_rImport; }
+
+ //FIXME: this is an ugly hack to workaround buggy SvXMLImport::GetAbsolute
+ ::rtl::OUString GetAbsoluteReference(::rtl::OUString const & i_rURI) const
+ {
+ if (!i_rURI.getLength() || i_rURI[0] == '#')
+ {
+ return GetImport().GetBaseURL() + i_rURI;
+ }
+ else
+ {
+ return GetImport().GetAbsoluteReference(i_rURI);
+ }
+ }
+
+public:
+ RDFaReader(SvXMLImport const & i_rImport)
+ : m_rImport(i_rImport)
+ { }
+
+ // returns URI or blank node!
+ ::rtl::OUString ReadCURIE(::rtl::OUString const & i_rCURIE) const;
+
+ std::vector< ::rtl::OUString >
+ ReadCURIEs(::rtl::OUString const & i_rCURIEs) const;
+
+ ::rtl::OUString
+ ReadURIOrSafeCURIE( ::rtl::OUString const & i_rURIOrSafeCURIE) const;
+};
+
+/** helper to insert RDFa statements into the RDF repository */
+class SAL_DLLPRIVATE RDFaInserter
+{
+ const uno::Reference<uno::XComponentContext> m_xContext;
+ uno::Reference< rdf::XDocumentRepository > m_xRepository;
+
+ typedef ::std::map< ::rtl::OUString, uno::Reference< rdf::XBlankNode > >
+ BlankNodeMap_t;
+
+ BlankNodeMap_t m_BlankNodeMap;
+
+public:
+ RDFaInserter(uno::Reference<uno::XComponentContext> const & i_xContext,
+ uno::Reference< rdf::XDocumentRepository > const & i_xRepository)
+ : m_xContext(i_xContext)
+ , m_xRepository(i_xRepository)
+ {}
+
+ uno::Reference< rdf::XBlankNode >
+ LookupBlankNode(::rtl::OUString const & i_rNodeId );
+
+ uno::Reference< rdf::XURI >
+ MakeURI( ::rtl::OUString const & i_rURI) const;
+
+ uno::Reference< rdf::XResource>
+ MakeResource( ::rtl::OUString const & i_rResource);
+
+ void InsertRDFaEntry(struct RDFaEntry const & i_rEntry);
+};
+
+/** store metadatable object and its RDFa attributes */
+struct SAL_DLLPRIVATE RDFaEntry
+{
+ uno::Reference<rdf::XMetadatable> m_xObject;
+ ::rtl::OUString m_About;
+ ::std::vector< ::rtl::OUString > m_Properties;
+ ::rtl::OUString m_Content;
+ ::rtl::OUString m_Datatype;
+
+ RDFaEntry(uno::Reference<rdf::XMetadatable> i_xObject,
+ ::rtl::OUString const & i_rAbout,
+ ::std::vector< ::rtl::OUString > const & i_rProperties,
+ ::rtl::OUString const & i_rContent,
+ ::rtl::OUString const & i_rDatatype)
+ : m_xObject(i_xObject)
+ , m_About(i_rAbout)
+ , m_Properties(i_rProperties)
+ , m_Content(i_rContent)
+ , m_Datatype(i_rDatatype)
+ { }
+};
+
+////////////////////////////////////////////////////////////////////////////
+
+
+static inline bool isWS(const sal_Unicode i_Char)
+{
+ return ('\t' == i_Char) || ('\n' == i_Char) || ('\r' == i_Char)
+ || (' ' == i_Char);
+}
+
+static ::rtl::OUString splitAtWS(::rtl::OUString & io_rString)
+{
+ const sal_Int32 len( io_rString.getLength() );
+ sal_Int32 idxstt(0);
+ while ((idxstt < len) && ( isWS(io_rString[idxstt])))
+ ++idxstt; // skip leading ws
+ sal_Int32 idxend(idxstt);
+ while ((idxend < len) && (!isWS(io_rString[idxend])))
+ ++idxend; // the CURIE
+ const ::rtl::OUString ret(io_rString.copy(idxstt, idxend - idxstt));
+ io_rString = io_rString.copy(idxend); // rest
+ return ret;
+}
+
+::rtl::OUString
+RDFaReader::ReadCURIE(::rtl::OUString const & i_rCURIE) const
+{
+ // the RDFa spec says that a prefix is required (it may be empty: ":foo")
+ const sal_Int32 idx( i_rCURIE.indexOf(':') );
+ if (idx >= 0)
+ {
+ ::rtl::OUString Prefix;
+ ::rtl::OUString LocalName;
+ ::rtl::OUString Namespace;
+ sal_uInt16 nKey( GetImport().GetNamespaceMap()._GetKeyByAttrName(
+ i_rCURIE, &Prefix, &LocalName, &Namespace) );
+ if (Prefix.equalsAscii("_"))
+ {
+ // eeek, it's a bnode!
+ // "_" is not a valid URI scheme => we can identify bnodes
+ return i_rCURIE;
+ }
+ else
+ {
+ OSL_ENSURE(XML_NAMESPACE_NONE != nKey, "no namespace?");
+ if ((XML_NAMESPACE_UNKNOWN != nKey) &&
+ (XML_NAMESPACE_XMLNS != nKey))
+ {
+ // N.B.: empty LocalName is valid!
+ const ::rtl::OUString URI(Namespace + LocalName);
+// return GetImport().GetAbsoluteReference(URI);
+ return GetAbsoluteReference(URI);
+ }
+ else
+ {
+ OSL_TRACE( "ReadCURIE: invalid CURIE: invalid prefix" );
+ return ::rtl::OUString();
+ }
+ }
+ }
+ else
+ {
+ OSL_TRACE( "ReadCURIE: invalid CURIE: no prefix" );
+ return ::rtl::OUString();
+ }
+}
+
+::std::vector< ::rtl::OUString >
+RDFaReader::ReadCURIEs(::rtl::OUString const & i_rCURIEs) const
+{
+ std::vector< ::rtl::OUString > vec;
+ ::rtl::OUString CURIEs(i_rCURIEs);
+ do {
+ ::rtl::OUString curie( splitAtWS(CURIEs) );
+ if (curie.getLength())
+ {
+ const ::rtl::OUString uri(ReadCURIE(curie));
+ if (uri.getLength())
+ {
+ vec.push_back(uri);
+ }
+ }
+ }
+ while (CURIEs.getLength());
+ if (!vec.size())
+ {
+ OSL_TRACE( "ReadCURIEs: invalid CURIEs" );
+ }
+ return vec;
+}
+
+::rtl::OUString
+RDFaReader::ReadURIOrSafeCURIE(::rtl::OUString const & i_rURIOrSafeCURIE) const
+{
+ const sal_Int32 len(i_rURIOrSafeCURIE.getLength());
+ if (len && (i_rURIOrSafeCURIE[0] == '['))
+ {
+ if ((len >= 2) && (i_rURIOrSafeCURIE[len - 1] == ']'))
+ {
+ return ReadCURIE(i_rURIOrSafeCURIE.copy(1, len - 2));
+ }
+ else
+ {
+ OSL_TRACE( "ReadURIOrSafeCURIE: invalid SafeCURIE" );
+ return ::rtl::OUString();
+ }
+ }
+ else
+ {
+ if (i_rURIOrSafeCURIE.matchAsciiL("_:", 2)) // blank node
+ {
+ OSL_TRACE( "ReadURIOrSafeCURIE: invalid URI: scheme is _" );
+ return ::rtl::OUString();
+ }
+ else
+ {
+// return GetImport().GetAbsoluteReference(i_rURIOrSafeCURIE);
+ return GetAbsoluteReference(i_rURIOrSafeCURIE);
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////
+
+uno::Reference< rdf::XBlankNode >
+RDFaInserter::LookupBlankNode(::rtl::OUString const & i_rNodeId )
+{
+ uno::Reference< rdf::XBlankNode > & rEntry( m_BlankNodeMap[ i_rNodeId ] );
+ if (!rEntry.is())
+ {
+ rEntry = m_xRepository->createBlankNode();
+ }
+ return rEntry;
+}
+
+uno::Reference< rdf::XURI >
+RDFaInserter::MakeURI( ::rtl::OUString const & i_rURI) const
+{
+ if (i_rURI.matchAsciiL("_:", 2)) // blank node
+ {
+ OSL_TRACE("MakeURI: cannot create URI for blank node");
+ return 0;
+ }
+ else
+ {
+ try
+ {
+ return rdf::URI::create( m_xContext, i_rURI );
+ }
+ catch (uno::Exception &)
+ {
+ OSL_ENSURE(false, "MakeURI: cannot create URI");
+ return 0;
+ }
+ }
+}
+
+uno::Reference< rdf::XResource>
+RDFaInserter::MakeResource( ::rtl::OUString const & i_rResource)
+{
+ if (i_rResource.matchAsciiL("_:", 2)) // blank node
+ {
+ // we cannot use the blank node label as-is: it must be distinct
+ // from labels in other graphs, so create fresh ones per XML stream
+ // N.B.: content.xml and styles.xml are distinct graphs
+ ::rtl::OUString name( i_rResource.copy(2) );
+ const uno::Reference< rdf::XBlankNode > xBNode( LookupBlankNode(name) );
+ OSL_ENSURE(xBNode.is(), "no blank node?");
+ return uno::Reference<rdf::XResource>( xBNode, uno::UNO_QUERY);
+ }
+ else
+ {
+ return uno::Reference<rdf::XResource>( MakeURI( i_rResource ),
+ uno::UNO_QUERY);
+ }
+}
+
+/** i wrote this because c++ implementations cannot agree on which variant
+ of boost::bind and std::mem_fun_ref applied to Reference::is compiles */
+class ref_is_null :
+ public ::std::unary_function<sal_Bool, const uno::Reference<rdf::XURI> & >
+{
+public:
+ sal_Bool operator() (const uno::Reference<rdf::XURI> & i_rRef)
+ {
+ return !i_rRef.is();
+ }
+};
+
+void RDFaInserter::InsertRDFaEntry(
+ struct RDFaEntry const & i_rEntry)
+{
+ OSL_ENSURE(i_rEntry.m_xObject.is(),
+ "InsertRDFaEntry: invalid arg: null object");
+ if (!i_rEntry.m_xObject.is()) return;
+
+ const uno::Reference< rdf::XResource > xSubject(
+ MakeResource( i_rEntry.m_About ) );
+ if (!xSubject.is())
+ {
+ return; // invalid
+ }
+
+ ::comphelper::SequenceAsVector< uno::Reference< rdf::XURI > > predicates;
+
+ predicates.reserve(i_rEntry.m_Properties.size());
+
+ ::std::remove_copy_if(
+ ::boost::make_transform_iterator(i_rEntry.m_Properties.begin(),
+ ::boost::bind(&RDFaInserter::MakeURI, this, _1)),
+ // argh, this must be the same type :(
+ ::boost::make_transform_iterator(i_rEntry.m_Properties.end(),
+ ::boost::bind(&RDFaInserter::MakeURI, this, _1)),
+ ::std::back_inserter(predicates),
+ ref_is_null() );
+ // compiles only on wntmsci12
+// ::boost::bind( ::std::logical_not<sal_Bool>(), ::boost::bind<sal_Bool>(&uno::Reference<rdf::XURI>::is, _1)));
+ // compiles on unxsoli4, wntsci12, but not unxlngi6
+// ::boost::bind( ::std::logical_not<sal_Bool>(), ::boost::bind<sal_Bool, com::sun::star::uno::Reference<rdf::XURI> >(&uno::Reference<rdf::XURI>::is, _1)));
+ // compiles on unxsoli4, unxlngi6, but not wntsci12
+// ::std::not1( ::std::mem_fun_ref(&uno::Reference<rdf::XURI>::is)) );
+
+ if (!predicates.size())
+ {
+ return; // invalid
+ }
+
+ uno::Reference<rdf::XURI> xDatatype;
+ if (i_rEntry.m_Datatype.getLength())
+ {
+ xDatatype = MakeURI( i_rEntry.m_Datatype );
+ }
+
+ try
+ {
+ // N.B.: this will call xMeta->ensureMetadataReference, which is why
+ // this must be done _after_ importing the whole XML file,
+ // to prevent collision between generated ids and ids in the file
+ m_xRepository->setStatementRDFa(xSubject, predicates.getAsConstList(),
+ i_rEntry.m_xObject, i_rEntry.m_Content, xDatatype);
+ }
+ catch (uno::Exception &)
+ {
+ OSL_ENSURE(false, "InsertRDFaEntry: setStatementRDFa failed?");
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////
+
+RDFaImportHelper::RDFaImportHelper(const SvXMLImport & i_rImport)
+ : m_rImport(i_rImport)
+{
+}
+
+RDFaImportHelper::~RDFaImportHelper()
+{
+}
+
+void
+RDFaImportHelper::AddRDFa(
+ uno::Reference<rdf::XMetadatable> i_xObject,
+ ::rtl::OUString const & i_rAbout,
+ ::rtl::OUString const & i_rProperty,
+ ::rtl::OUString const & i_rContent,
+ ::rtl::OUString const & i_rDatatype)
+{
+ if (!i_rProperty.getLength())
+ {
+ OSL_TRACE("AddRDFa: invalid input: xhtml:property empty");
+ return;
+ }
+ if (!i_xObject.is())
+ {
+ OSL_ENSURE(false, "AddRDFa: invalid arg: null textcontent");
+ return;
+ }
+ // must parse CURIEs here: need namespace declaration context
+ RDFaReader reader(GetImport());
+ const ::rtl::OUString about( reader.ReadURIOrSafeCURIE(i_rAbout) );
+ if (!about.getLength()) return;
+ const ::std::vector< ::rtl::OUString > properties(
+ reader.ReadCURIEs(i_rProperty) );
+ if (!properties.size()) return;
+ const ::rtl::OUString datatype( i_rDatatype.getLength()
+ ? reader.ReadCURIE(i_rDatatype)
+ : ::rtl::OUString() );
+ m_RDFaEntries.push_back(RDFaEntry(i_xObject,
+ about, properties, i_rContent, datatype));
+}
+
+void RDFaImportHelper::InsertRDFa(
+ uno::Reference< rdf::XRepositorySupplier> const & i_xModel)
+{
+ OSL_ENSURE(i_xModel.is(), "InsertRDFa: invalid arg: model null");
+ if (!i_xModel.is()) return;
+ const uno::Reference< rdf::XDocumentRepository > xRepository(
+ i_xModel->getRDFRepository(), uno::UNO_QUERY);
+ OSL_ENSURE(xRepository.is(), "InsertRDFa: no DocumentRepository?");
+ if (!xRepository.is()) return;
+ RDFaInserter inserter(GetImport().GetComponentContext(), xRepository);
+ ::std::for_each(m_RDFaEntries.begin(), m_RDFaEntries.end(),
+ ::boost::bind(&RDFaInserter::InsertRDFaEntry, &inserter, _1));
+}
+
+} // namespace xmloff
+
diff --git a/xmloff/source/core/makefile.mk b/xmloff/source/core/makefile.mk
index c68981c274..b9cb8e9c1b 100644
--- a/xmloff/source/core/makefile.mk
+++ b/xmloff/source/core/makefile.mk
@@ -77,7 +77,10 @@ SLOFILES = \
$(SLO)$/XMLEmbeddedObjectImportContext.obj \
$(SLO)$/XMLBase64Export.obj \
$(SLO)$/XMLBase64ImportContext.obj \
- $(SLO)$/XMLBasicExportFilter.obj
+ $(SLO)$/XMLBasicExportFilter.obj \
+ $(SLO)$/RDFaImportHelper.obj \
+ $(SLO)$/RDFaExportHelper.obj \
+
# --- Targets -------------------------------------------------------
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index 83a9984140..ec4d6acdb9 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -63,9 +63,7 @@
#include <xmloff/SettingsExportHelper.hxx>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/container/XIndexContainer.hpp>
-#ifndef _COM_SUN_STAR_DOCUMENT_XEVENTSSUPPLIER_HPP
#include <com/sun/star/document/XEventsSupplier.hpp>
-#endif
#include <com/sun/star/document/XViewDataSupplier.hpp>
#include <GradientStyle.hxx>
#include <HatchStyle.hxx>
@@ -73,16 +71,10 @@
#include <TransGradientStyle.hxx>
#include <MarkerStyle.hxx>
#include <DashStyle.hxx>
-#ifndef _XMLOFF_XMLFONTAUTOSTYLEPOOL_HXX
-#include <xmloff/XMLFontAutoStylePool>
-#endif
+#include <xmloff/XMLFontAutoStylePool.hxx>
#include "XMLImageMapExport.hxx"
-#ifndef _XMLOFF_XMLBASE64EXPORT_HXX_
#include "XMLBase64Export.hxx"
-#endif
-#ifndef _XMLOFF_XMLERROR_HXX_
#include "xmlerror.hxx"
-#endif
#include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include "XMLFilterServiceNames.h"
@@ -105,6 +97,7 @@
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
#include <com/sun/star/rdf/XMetadatable.hpp>
+#include "RDFaExportHelper.hxx"
using ::rtl::OUString;
@@ -126,6 +119,9 @@ sal_Char __READONLY_DATA sXML_1_2[] = "1.2";
const sal_Char *sOpenOfficeOrgProject ="OpenOffice.org_project";
+const sal_Char s_grddl_xsl[] =
+ "http://docs.oasis-open.org/office/1.2/xslt/odf2rdf.xsl";
+
#define LOGFILE_AUTHOR "mb93740"
#define XML_MODEL_SERVICE_WRITER "com.sun.star.text.TextDocument"
@@ -223,6 +219,19 @@ public:
/// relative path of stream in package, e.g. "someobject/content.xml"
::rtl::OUString mStreamPath;
+ const uno::Reference< uno::XComponentContext > mxComponentContext;
+
+ /// name of stream in package, e.g., "content.xml"
+ ::rtl::OUString mStreamName;
+
+ /// stack of backed up namespace maps
+ /// long: depth at which namespace map has been backed up into the stack
+ ::std::stack< ::std::pair< SvXMLNamespaceMap *, long > > mNamespaceMaps;
+ /// counts depth (number of open elements/start tags)
+ long mDepth;
+
+ ::std::auto_ptr< ::xmloff::RDFaExportHelper> mpRDFaHelper;
+
// --> OD 2008-11-26 #158694#
sal_Bool mbExportTextNumberElement;
// <--
@@ -243,14 +252,20 @@ SvXMLExport_Impl::SvXMLExport_Impl()
// --> PB 2007-07-06 #i146851#
,mbSaveBackwardCompatibleODF( sal_True )
// <--
- ,mStreamPath()
+ ,mxComponentContext( ::comphelper::getProcessComponentContext() )
+ ,mStreamName()
+ ,mNamespaceMaps()
+ ,mDepth(0)
+ ,mpRDFaHelper() // lazy
// --> OD 2008-11-26 #158694#
,mbExportTextNumberElement( sal_False )
// <--
,mbNullDateInitialized( sal_False )
{
+ OSL_ENSURE(mxComponentContext.is(), "SvXMLExport: no ComponentContext");
+ if (!mxComponentContext.is()) throw uno::RuntimeException();
mxUriReferenceFactory = uri::UriReferenceFactory::create(
- comphelper_getProcessComponentContext());
+ mxComponentContext );
}
//==============================================================================
@@ -325,9 +340,17 @@ void SvXMLExport::_InitCtor()
mpNamespaceMap->Add( GetXMLToken(XML_NP_XSI), GetXMLToken(XML_N_XSI), XML_NAMESPACE_XSI );
mpNamespaceMap->Add( GetXMLToken(XML_NP_FIELD), GetXMLToken(XML_N_FIELD), XML_NAMESPACE_FIELD );
}
+ // RDFa: needed for content and header/footer styles
if( (getExportFlags() & (EXPORT_STYLES|EXPORT_AUTOSTYLES|EXPORT_MASTERSTYLES|EXPORT_CONTENT) ) != 0 )
{
- mpNamespaceMap->Add( GetXMLToken(XML_NP_RDFA), GetXMLToken(XML_N_RDFA), XML_NAMESPACE_RDFA );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_XHTML),
+ GetXMLToken(XML_N_XHTML), XML_NAMESPACE_XHTML );
+ }
+ // GRDDL: to convert RDFa and meta.xml to RDF
+ if( (getExportFlags() & (EXPORT_META|EXPORT_STYLES|EXPORT_AUTOSTYLES|EXPORT_MASTERSTYLES|EXPORT_CONTENT) ) != 0 )
+ {
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_GRDDL),
+ GetXMLToken(XML_N_GRDDL), XML_NAMESPACE_GRDDL );
}
mxAttrList = (xml::sax::XAttributeList*)mpAttrList;
@@ -762,9 +785,7 @@ void SAL_CALL SvXMLExport::initialize( const uno::Sequence< uno::Any >& aArgumen
aBaseURL.insertName( sName );
msOrigFileName = aBaseURL.GetMainURL(INetURLObject::DECODE_TO_IURI);
}
- OSL_ENSURE(sName.getLength(), "no StreamName ???");
- mpImpl->mStreamPath = sRelPath.getLength() ? sRelPath +
- ::rtl::OUString::createFromAscii("/") + sName : sName;
+ mpImpl->mStreamName = sName; // Note: may be empty (XSLT)
// --> OD 2006-09-26 #i69627#
const ::rtl::OUString sOutlineStyleAsNormalListStyle(
@@ -914,6 +935,54 @@ uno::Sequence< OUString > SAL_CALL SvXMLExport::getSupportedServiceNames( )
///////////////////////////////////////////////////////////////////////
+::rtl::OUString
+SvXMLExport::EnsureNamespace(::rtl::OUString const & i_rNamespace,
+ ::rtl::OUString const & i_rPreferredPrefix)
+{
+ ::rtl::OUString sPrefix;
+ sal_uInt16 nKey( _GetNamespaceMap().GetKeyByName( i_rNamespace ) );
+ if( XML_NAMESPACE_UNKNOWN == nKey )
+ {
+ // There is no prefix for the namespace, so
+ // we have to generate one and have to add it.
+ sPrefix = i_rPreferredPrefix;
+ nKey = _GetNamespaceMap().GetKeyByPrefix( sPrefix );
+ sal_Int32 n( 0 );
+ ::rtl::OUStringBuffer buf;
+ while( nKey != USHRT_MAX )
+ {
+ buf.append( i_rPreferredPrefix );
+ buf.append( ++n );
+ sPrefix = buf.makeStringAndClear();
+ nKey = _GetNamespaceMap().GetKeyByPrefix( sPrefix );
+ }
+
+ if (mpImpl->mNamespaceMaps.empty()
+ || (mpImpl->mNamespaceMaps.top().second != mpImpl->mDepth))
+ {
+ // top was created for lower depth... need a new namespace map!
+ mpImpl->mNamespaceMaps.push(
+ ::std::make_pair(mpNamespaceMap, mpImpl->mDepth) );
+ mpNamespaceMap = new SvXMLNamespaceMap( *mpNamespaceMap );
+ }
+
+ // add the namespace to the map and as attribute
+ mpNamespaceMap->Add( sPrefix, i_rNamespace );
+ buf.append( GetXMLToken(XML_XMLNS) );
+ buf.append( sal_Unicode(':') );
+ buf.append( sPrefix );
+ AddAttribute( buf.makeStringAndClear(), i_rNamespace );
+ }
+ else
+ {
+ // If there is a prefix for the namespace, reuse that.
+ sPrefix = _GetNamespaceMap().GetPrefixByKey( nKey );
+ }
+ return sPrefix;
+}
+
+///////////////////////////////////////////////////////////////////////
+
void SvXMLExport::AddAttributeASCII( sal_uInt16 nPrefixKey,
const sal_Char *pName,
const sal_Char *pValue )
@@ -921,9 +990,8 @@ void SvXMLExport::AddAttributeASCII( sal_uInt16 nPrefixKey,
OUString sName( OUString::createFromAscii( pName ) );
OUString sValue( OUString::createFromAscii( pValue ) );
- mpAttrList->AddAttribute( mpNamespaceMap->GetQNameByKey( nPrefixKey,
- sName ),
- sValue );
+ mpAttrList->AddAttribute(
+ _GetNamespaceMap().GetQNameByKey( nPrefixKey, sName ), sValue );
}
void SvXMLExport::AddAttribute( sal_uInt16 nPrefixKey, const sal_Char *pName,
@@ -931,16 +999,15 @@ void SvXMLExport::AddAttribute( sal_uInt16 nPrefixKey, const sal_Char *pName,
{
OUString sName( OUString::createFromAscii( pName ) );
- mpAttrList->AddAttribute( mpNamespaceMap->GetQNameByKey( nPrefixKey,
- sName ),
- rValue );
+ mpAttrList->AddAttribute(
+ _GetNamespaceMap().GetQNameByKey( nPrefixKey, sName ), rValue );
}
void SvXMLExport::AddAttribute( sal_uInt16 nPrefixKey, const OUString& rName,
const OUString& rValue )
{
- mpAttrList->AddAttribute( mpNamespaceMap->GetQNameByKey( nPrefixKey, rName ),
- rValue );
+ mpAttrList->AddAttribute(
+ _GetNamespaceMap().GetQNameByKey( nPrefixKey, rName ), rValue );
}
void SvXMLExport::AddAttribute( sal_uInt16 nPrefixKey,
@@ -948,7 +1015,7 @@ void SvXMLExport::AddAttribute( sal_uInt16 nPrefixKey,
const OUString& rValue )
{
mpAttrList->AddAttribute(
- mpNamespaceMap->GetQNameByKey( nPrefixKey, GetXMLToken(eName) ),
+ _GetNamespaceMap().GetQNameByKey( nPrefixKey, GetXMLToken(eName) ),
rValue );
}
@@ -957,7 +1024,7 @@ void SvXMLExport::AddAttribute( sal_uInt16 nPrefixKey,
enum XMLTokenEnum eValue)
{
mpAttrList->AddAttribute(
- mpNamespaceMap->GetQNameByKey( nPrefixKey, GetXMLToken(eName) ),
+ _GetNamespaceMap().GetQNameByKey( nPrefixKey, GetXMLToken(eName) ),
GetXMLToken(eValue) );
}
@@ -1307,6 +1374,13 @@ sal_uInt32 SvXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass )
{
enum XMLTokenEnum eRootService = XML_TOKEN_INVALID;
const sal_Int32 nExportMode = mnExportFlags & (EXPORT_META|EXPORT_STYLES|EXPORT_CONTENT|EXPORT_SETTINGS);
+
+ if ( EXPORT_SETTINGS != nExportMode ) // meta, content, styles
+ {
+ AddAttribute( XML_NAMESPACE_GRDDL, XML_TRANSFORMATION,
+ OUString::createFromAscii(s_grddl_xsl) );
+ }
+
if( EXPORT_META == nExportMode )
{
// export only meta
@@ -2159,7 +2233,8 @@ void SvXMLExport::StartElement(sal_uInt16 nPrefix,
enum ::xmloff::token::XMLTokenEnum eName,
sal_Bool bIgnWSOutside )
{
- StartElement(mpNamespaceMap->GetQNameByKey( nPrefix, GetXMLToken(eName) ), bIgnWSOutside);
+ StartElement(_GetNamespaceMap().GetQNameByKey( nPrefix,
+ GetXMLToken(eName) ), bIgnWSOutside);
}
void SvXMLExport::StartElement(const OUString& rName,
@@ -2188,6 +2263,7 @@ void SvXMLExport::StartElement(const OUString& rName,
}
}
ClearAttrList();
+ ++mpImpl->mDepth; // increment nesting depth counter
}
void SvXMLExport::Characters(const ::rtl::OUString& rChars)
@@ -2218,12 +2294,26 @@ void SvXMLExport::EndElement(sal_uInt16 nPrefix,
enum ::xmloff::token::XMLTokenEnum eName,
sal_Bool bIgnWSInside )
{
- EndElement(mpNamespaceMap->GetQNameByKey( nPrefix, GetXMLToken(eName) ), bIgnWSInside);
+ EndElement(_GetNamespaceMap().GetQNameByKey( nPrefix, GetXMLToken(eName) ),
+ bIgnWSInside);
}
void SvXMLExport::EndElement(const OUString& rName,
sal_Bool bIgnWSInside )
{
+ // decrement nesting depth counter & (maybe) restore namespace map
+ --mpImpl->mDepth;
+ if (!mpImpl->mNamespaceMaps.empty() &&
+ (mpImpl->mNamespaceMaps.top().second == mpImpl->mDepth))
+ {
+ delete mpNamespaceMap;
+ mpNamespaceMap = mpImpl->mNamespaceMaps.top().first;
+ mpImpl->mNamespaceMaps.pop();
+ }
+ OSL_ENSURE(mpImpl->mNamespaceMaps.empty() ||
+ (mpImpl->mNamespaceMaps.top().second < mpImpl->mDepth),
+ "SvXMLExport: NamespaceMaps corrupted");
+
if ((mnErrorFlags & ERROR_DO_NOTHING) != ERROR_DO_NOTHING)
{
try
@@ -2319,6 +2409,12 @@ void SvXMLExport::DisposingModel()
return mxServiceFactory;
}
+uno::Reference< uno::XComponentContext >
+SvXMLExport::GetComponentContext() const
+{
+ return mpImpl->mxComponentContext;
+}
+
::comphelper::UnoInterfaceToUniqueIdentifierMapper& SvXMLExport::getInterfaceToIdentifierMapper()
{
return mpImpl->maInterfaceToIdentifierMapper;
@@ -2346,23 +2442,9 @@ SvtSaveOptions::ODFDefaultVersion SvXMLExport::getDefaultVersion() const
return SvtSaveOptions::ODFVER_012;
}
-::rtl::OUString SvXMLExport::GetStreamPath() const
-{
- return mpImpl->mStreamPath;
-}
-
-//FIXME: where to put this???
-static bool splitXmlId(::rtl::OUString const & i_XmlId,
- ::rtl::OUString & o_StreamName, ::rtl::OUString& o_Idref )
+::rtl::OUString SvXMLExport::GetStreamName() const
{
- const sal_Int32 idx(i_XmlId.indexOf(static_cast<sal_Unicode>('#')));
- if ((idx <= 0) || (idx >= i_XmlId.getLength() - 1)) {
- return false;
- } else {
- o_StreamName = (i_XmlId.copy(0, idx));
- o_Idref = (i_XmlId.copy(idx+1));
- return true;
- }
+ return mpImpl->mStreamName;
}
void
@@ -2380,30 +2462,69 @@ SvXMLExport::AddAttributeXmlId(uno::Reference<uno::XInterface> const & i_xIfc)
// OSL_ENSURE(xMeta.is(), "xml:id: not XMetadatable");
if ( xMeta.is() )
{
- const ::rtl::OUString XmlId( xMeta->getXmlId() );
- if ( !XmlId.equalsAscii("") )
+ const beans::StringPair mdref( xMeta->getMetadataReference() );
+ if ( !mdref.Second.equalsAscii("") )
{
- ::rtl::OUString StreamName;
- ::rtl::OUString Idref;
- if( splitXmlId(XmlId, StreamName, Idref) )
+ const ::rtl::OUString streamName( GetStreamName() );
+ if ( streamName.getLength() )
{
- if ( GetStreamPath().equals(StreamName) )
+ if ( streamName.equals(mdref.First) )
{
- AddAttribute( XML_NAMESPACE_XML, XML_ID, Idref );
+ AddAttribute( XML_NAMESPACE_XML, XML_ID, mdref.Second );
}
else
{
- OSL_ENSURE(false, "xml:id: invalid stream name");
+ OSL_ENSURE(false, "SvXMLExport::AddAttributeXmlId: "
+ "invalid stream name");
}
}
else
{
- OSL_ENSURE(false, "xml:id invalid?");
+ // FIXME: this is ugly
+ // there is no stream name (e.g. XSLT, flat-xml format)!
+ // but how do we ensure uniqueness in this case?
+ // a) just omit styles.xml ids -- they are unlikely anyway...
+ // b) somehow find out whether we are currently exporting styles
+ // or content, and prefix "s" or "c" => unique
+ if ( mdref.First.equalsAscii("content.xml") )
+ {
+ AddAttribute( XML_NAMESPACE_XML, XML_ID, mdref.Second );
+ }
+ else
+ {
+ OSL_TRACE("SvXMLExport::AddAttributeXmlId: "
+ "no stream name given: dropping styles.xml xml:id");
+ }
}
}
}
}
+void
+SvXMLExport::AddAttributesRDFa(
+ uno::Reference<text::XTextContent> const & i_xTextContent)
+{
+ // check version >= 1.2
+ switch (getDefaultVersion()) {
+ case SvtSaveOptions::ODFVER_011: // fall thru
+ case SvtSaveOptions::ODFVER_010: return;
+ default: break;
+ }
+
+ const uno::Reference<rdf::XMetadatable> xMeta(
+ i_xTextContent, uno::UNO_QUERY);
+ if (!xMeta.is() || !xMeta->getMetadataReference().Second.getLength())
+ {
+ return; // no xml:id => no RDFa
+ }
+
+ if (!mpImpl->mpRDFaHelper.get())
+ {
+ mpImpl->mpRDFaHelper.reset( new ::xmloff::RDFaExportHelper(*this) );
+ }
+ mpImpl->mpRDFaHelper->AddRDFa(xMeta);
+}
+
// --> OD 2008-11-26 #158694#
sal_Bool SvXMLExport::exportTextNumberElement() const
{
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index 259d2d1a5b..675c558186 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -64,9 +64,12 @@
#include <tools/string.hxx> // used in StartElement for logging
#include <cppuhelper/implbase1.hxx>
#include <comphelper/extract.hxx>
+#include <comphelper/processfactory.hxx>
#include <vcl/fontcvt.hxx>
#include <com/sun/star/rdf/XMetadatable.hpp>
+#include <com/sun/star/rdf/XRepositorySupplier.hpp>
+#include "RDFaImportHelper.hxx"
#define LOGFILE_AUTHOR "unknown"
@@ -111,6 +114,7 @@ sal_Char __READONLY_DATA sXML_np__xforms[] = "_xforms";
sal_Char __READONLY_DATA sXML_np__xsd[] = "_xsd";
sal_Char __READONLY_DATA sXML_np__xsi[] = "_xsi";
sal_Char __READONLY_DATA sXML_np__field[] = "_field";
+sal_Char __READONLY_DATA sXML_np__xhtml[] = "_xhtml";
sal_Char __READONLY_DATA sXML_np__fo_old[] = "__fo";
sal_Char __READONLY_DATA sXML_np__xlink_old[] = "__xlink";
@@ -169,8 +173,8 @@ public:
INetURLObject aBaseURL;
INetURLObject aDocBase;
- /// relative path of stream in package, e.g. "someobject/content.xml"
- ::rtl::OUString mStreamPath;
+ /// name of stream in package, e.g., "content.xml"
+ ::rtl::OUString mStreamName;
::rtl::OUString aODFVersion;
@@ -183,18 +187,28 @@ public:
sal_Bool mbTextDocInOOoFileFormat;
// <--
+ const uno::Reference< uno::XComponentContext > mxComponentContext;
+
+ std::auto_ptr< xmloff::RDFaImportHelper > mpRDFaHelper;
+
SvXMLImport_Impl() :
hBatsFontConv( 0 ), hMathFontConv( 0 ),
mbOwnGraphicResolver( false ),
mbOwnEmbeddedResolver( false ),
- mStreamPath(),
+ mStreamName(),
// --> OD 2004-08-11 #i28749#
mbShapePositionInHoriL2R( sal_False ),
// <--
// --> OD 2007-12-19 #152540#
- mbTextDocInOOoFileFormat( sal_False )
+ mbTextDocInOOoFileFormat( sal_False ),
// <--
- {}
+ mxComponentContext( ::comphelper::getProcessComponentContext() ),
+ mpRDFaHelper() // lazy
+ {
+ OSL_ENSURE(mxComponentContext.is(), "SvXMLImport: no ComponentContext");
+ if (!mxComponentContext.is()) throw uno::RuntimeException();
+ }
+
~SvXMLImport_Impl()
{
if( hBatsFontConv )
@@ -222,7 +236,6 @@ void SvXMLImport::_InitCtor()
if( mnImportFlags != 0 )
{
// implicit "xml" namespace prefix
- const ::rtl::OUString Xml;
mpNamespaceMap->Add( GetXMLToken(XML_XML), GetXMLToken(XML_N_XML),
XML_NAMESPACE_XML );
mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__office ) ),
@@ -294,6 +307,9 @@ void SvXMLImport::_InitCtor()
mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__field ) ), GetXMLToken(XML_N_FIELD), XML_NAMESPACE_FIELD );
mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__of ) ),
GetXMLToken(XML_N_OF), XML_NAMESPACE_OF );
+ mpNamespaceMap->Add(
+ OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__xhtml ) ),
+ GetXMLToken(XML_N_XHTML), XML_NAMESPACE_XHTML );
}
msPackageProtocol = OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package:" ) );
@@ -527,6 +543,16 @@ void SAL_CALL SvXMLImport::endDocument( void )
// #i9518# All the stuff that accesses the document has to be done here, not in the dtor,
// because the SvXMLImport dtor might not be called until after the document has been closed.
+ if (mpImpl->mpRDFaHelper.get())
+ {
+ const uno::Reference<rdf::XRepositorySupplier> xRS(mxModel,
+ uno::UNO_QUERY);
+ if (xRS.is())
+ {
+ mpImpl->mpRDFaHelper->InsertRDFa( xRS );
+ }
+ }
+
if (mpNumImport)
{
delete mpNumImport;
@@ -935,9 +961,7 @@ void SAL_CALL SvXMLImport::initialize( const uno::Sequence< uno::Any >& aArgumen
mpImpl->aBaseURL.insertName( sRelPath );
mpImpl->aBaseURL.insertName( sName );
}
- OSL_ENSURE(sName.getLength(), "no StreamName ???");
- mpImpl->mStreamPath = sRelPath.getLength() ? sRelPath +
- ::rtl::OUString::createFromAscii("/") + sName : sName;
+ mpImpl->mStreamName = sName; // Note: may be empty (XSLT)
// --> OD 2004-08-10 #i28749# - retrieve property <ShapePositionInHoriL2R>
sPropName = OUString( RTL_CONSTASCII_USTRINGPARAM("ShapePositionInHoriL2R" ) );
if( xPropertySetInfo->hasPropertyByName(sPropName) )
@@ -1562,7 +1586,7 @@ const SvXMLStylesContext *SvXMLImport::GetMasterStyles() const
return (const SvXMLStylesContext *)&mxMasterStyles;
}
-OUString SvXMLImport::GetAbsoluteReference(const OUString& rValue)
+OUString SvXMLImport::GetAbsoluteReference(const OUString& rValue) const
{
if( rValue.getLength() == 0 || rValue[0] == '#' )
return rValue;
@@ -1753,6 +1777,13 @@ void SvXMLImport::DisposingModel()
// #110680#
return mxServiceFactory;
}
+
+uno::Reference< uno::XComponentContext >
+SvXMLImport::GetComponentContext() const
+{
+ return mpImpl->mxComponentContext;
+}
+
String SvXMLImport::GetBaseURL() const
{
return mpImpl->aBaseURL.GetMainURL( INetURLObject::NO_DECODE );
@@ -1763,9 +1794,9 @@ String SvXMLImport::GetDocumentBase() const
return mpImpl->aDocBase.GetMainURL( INetURLObject::NO_DECODE );
}
-::rtl::OUString SvXMLImport::GetStreamPath() const
+::rtl::OUString SvXMLImport::GetStreamName() const
{
- return mpImpl->mStreamPath;
+ return mpImpl->mStreamName;
}
// --> OD 2004-08-10 #i28749#
@@ -1854,13 +1885,12 @@ void SvXMLImport::SetXmlId(uno::Reference<uno::XInterface> const & i_xIfc,
//FIXME: not yet
// OSL_ENSURE(xMeta.is(), "xml:id: not XMetadatable");
if (xMeta.is()) {
- ::rtl::OUStringBuffer XmlId( GetStreamPath() );
- XmlId.appendAscii("#");
- XmlId.append(i_rXmlId);
+ const beans::StringPair mdref( GetStreamName(), i_rXmlId );
try {
- xMeta->setXmlId(XmlId.makeStringAndClear());
+ xMeta->setMetadataReference(mdref);
} catch (lang::IllegalArgumentException &) {
// probably duplicate; ignore
+ OSL_TRACE("SvXMLImport::SetXmlId: cannot set xml:id");
}
}
} catch (uno::Exception &) {
@@ -1868,3 +1898,20 @@ void SvXMLImport::SetXmlId(uno::Reference<uno::XInterface> const & i_xIfc,
}
}
+void
+SvXMLImport::AddRDFa(uno::Reference<rdf::XMetadatable> i_xObject,
+ ::rtl::OUString const & i_rAbout,
+ ::rtl::OUString const & i_rProperty,
+ ::rtl::OUString const & i_rContent,
+ ::rtl::OUString const & i_rDatatype)
+{
+ // N.B.: we only get called if i_xObject had xhtml:about attribute
+ // (an empty attribute value is valid)
+ if (!mpImpl->mpRDFaHelper.get())
+ {
+ mpImpl->mpRDFaHelper.reset( new ::xmloff::RDFaImportHelper(*this) );
+ }
+ mpImpl->mpRDFaHelper->AddRDFa(i_xObject,
+ i_rAbout, i_rProperty, i_rContent, i_rDatatype);
+}
+
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index fdb378fb83..900e730f6f 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -146,9 +146,11 @@ namespace xmloff { namespace token {
TOKEN( "of", XML_NP_OF ),
TOKEN( "urn:oasis:names:tc:opendocument:xmlns:of:1.2", XML_N_OF ),
- // ODF 1.2 metadata: RDFa
- TOKEN( "rdfa", XML_NP_RDFA ),
- TOKEN( "http://docs.oasis-open.org/opendocument/meta/rdfa#", XML_N_RDFA ),
+ // ODF 1.2 metadata: RDFa and GRDDL
+ TOKEN( "xhtml", XML_NP_XHTML ),
+ TOKEN( "http://www.w3.org/1999/xhtml", XML_N_XHTML ),
+ TOKEN( "grddl", XML_NP_GRDDL ),
+ TOKEN( "http://www.w3.org/2003/g/data-view#", XML_N_GRDDL ),
// units
TOKEN( "mm", XML_UNIT_MM ),
@@ -3043,6 +3045,7 @@ namespace xmloff { namespace token {
TOKEN( "meta-field", XML_META_FIELD ),
TOKEN( "about", XML_ABOUT ),
TOKEN( "datatype", XML_DATATYPE ),
+ TOKEN( "transformation", XML_TRANSFORMATION ),
// ODF 1.2 numbered-paragraph
TOKEN( "list-id", XML_LIST_ID ),
diff --git a/xmloff/source/text/XMLTextMarkImportContext.cxx b/xmloff/source/text/XMLTextMarkImportContext.cxx
index f9af71e899..75bc4c8c3c 100644
--- a/xmloff/source/text/XMLTextMarkImportContext.cxx
+++ b/xmloff/source/text/XMLTextMarkImportContext.cxx
@@ -308,39 +308,57 @@ Reference<XInterface> XMLTextMarkImportContext::CreateAndInsertMark(
const OUString& i_rXmlId)
{
// create mark
- Reference<XMultiServiceFactory> xFactory(rImport.GetModel(),UNO_QUERY);
- if( xFactory.is() )
+ const Reference<XMultiServiceFactory> xFactory(rImport.GetModel(),
+ UNO_QUERY);
+ Reference<XInterface> xIfc;
+
+ if (xFactory.is())
{
- Reference<XInterface> xIfc = xFactory->createInstance(sServiceName);
+ xIfc = xFactory->createInstance(sServiceName);
- // set name
- Reference<XNamed> xNamed(xIfc, UNO_QUERY);
+ if (!xIfc.is())
+ {
+ OSL_ENSURE(false, "CreateAndInsertMark: cannot create service?");
+ return 0;
+ }
+
+ // set name (unless there is no name (text:meta))
+ const Reference<XNamed> xNamed(xIfc, UNO_QUERY);
if (xNamed.is())
{
xNamed->setName(sMarkName);
+ }
+ else
+ {
+ if (sMarkName.getLength())
+ {
+ OSL_ENSURE(false, "name given, but XNamed not supported?");
+ return 0;
+ }
+ }
- // xml:id for RDF metadata
- rImport.SetXmlId(xIfc, i_rXmlId);
+ // 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())
+ // cast to XTextContent and attach to document
+ const Reference<XTextContent> xTextContent(xIfc, UNO_QUERY);
+ if (xTextContent.is())
+ {
+ try
{
- try
- {
// if inserting marks, bAbsorb==sal_False will cause
// collapsing of the given XTextRange.
- rImport.GetTextImport()->GetText()->insertTextContent(rRange,
- xTextContent, sal_True);
- }
- catch (com::sun::star::lang::IllegalArgumentException e)
- {
- // ignore
- }
+ rImport.GetTextImport()->GetText()->insertTextContent(rRange,
+ xTextContent, sal_True);
+ }
+ catch (com::sun::star::lang::IllegalArgumentException &)
+ {
+ OSL_ENSURE(false, "CreateAndInsertMark: cannot insert?");
+ return 0;
}
}
- return xIfc;
- } else return NULL;
+ }
+ return xIfc;
}
sal_Bool XMLTextMarkImportContext::FindName(
diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx
index 37f44a5f5e..3cc372f171 100644
--- a/xmloff/source/text/txtflde.cxx
+++ b/xmloff/source/text/txtflde.cxx
@@ -44,9 +44,6 @@
#include <xmloff/xmlnume.hxx>
#include "numehelp.hxx"
-#ifndef _XMLOFF_PROPMAPPINGTYPES_HXX
-#include <xmloff/maptypes.hxx>
-#endif
#include <xmloff/families.hxx>
#include <xmloff/XMLEventExport.hxx>
#include "XMLTextCharStyleNamesElementExport.hxx"
@@ -65,9 +62,7 @@
#include <com/sun/star/text/XDependentTextField.hpp>
#include <com/sun/star/text/XTextFieldsSupplier.hpp>
-#ifndef _COM_SUN_STAR_TEXT_SETVARIABLETYPE_HPP
#include <com/sun/star/text/SetVariableType.hpp>
-#endif
#include <com/sun/star/text/PlaceholderType.hpp>
#include <com/sun/star/text/FilenameDisplayFormat.hpp>
#include <com/sun/star/text/ChapterFormat.hpp>
@@ -78,6 +73,7 @@
#include <com/sun/star/util/NumberFormat.hpp>
#include <com/sun/star/text/BibliographyDataType.hpp>
#include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/rdf/XMetadatable.hpp>
#include <rtl/ustrbuf.hxx>
#include <tools/debug.hxx>
#include <rtl/math.hxx>
@@ -152,6 +148,7 @@ static sal_Char __READONLY_DATA FIELD_SERVICE_BIBLIOGRAPHY[] = "Bibliography";
static sal_Char __READONLY_DATA FIELD_SERVICE_SCRIPT[] = "Script";
static sal_Char __READONLY_DATA FIELD_SERVICE_ANNOTATION[] = "Annotation";
static sal_Char __READONLY_DATA FIELD_SERVICE_COMBINED_CHARACTERS[] = "CombinedCharacters";
+static sal_Char __READONLY_DATA FIELD_SERVICE_META[] = "MetaField";
static sal_Char __READONLY_DATA FIELD_SERVICE_MEASURE[] = "Measure";
static sal_Char __READONLY_DATA FIELD_SERVICE_TABLE_FORMULA[] = "TableFormula";
static sal_Char __READONLY_DATA FIELD_SERVICE_DROP_DOWN[] = "DropDown";
@@ -219,6 +216,7 @@ SvXMLEnumStringMapEntry __READONLY_DATA aFieldServiceNameMapping[] =
ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_ANNOTATION, FIELD_ID_ANNOTATION ),
ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_COMBINED_CHARACTERS, FIELD_ID_COMBINED_CHARACTERS ),
+ ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_META, FIELD_ID_META ),
// non-writer fields
ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_SHEET_NAME, FIELD_ID_SHEET_NAME ),
@@ -604,6 +602,7 @@ enum FieldIdEnum XMLTextFieldExport::MapFieldName(
case FIELD_ID_TEMPLATE_NAME:
case FIELD_ID_CHAPTER:
case FIELD_ID_FILE_NAME:
+ case FIELD_ID_META:
case FIELD_ID_SHEET_NAME:
case FIELD_ID_MEASURE:
case FIELD_ID_URL:
@@ -646,6 +645,9 @@ sal_Bool XMLTextFieldExport::IsStringField(
return !bRet;
}
+ case FIELD_ID_META://FIXME ?????? no idea...
+ return 0 > GetIntProperty(sPropertyNumberFormat, xPropSet);
+
case FIELD_ID_DATABASE_DISPLAY:
// TODO: depends on... ???
// workaround #no-bug#: no data type
@@ -738,7 +740,7 @@ sal_Bool XMLTextFieldExport::IsStringField(
/// export the styles needed by the given field. Called on first pass
/// through document
void XMLTextFieldExport::ExportFieldAutoStyle(
- const Reference<XTextField> & rTextField)
+ const Reference<XTextField> & rTextField, sal_Bool bProgress )
{
// get property set
Reference<XPropertySet> xPropSet(rTextField, UNO_QUERY);
@@ -831,6 +833,10 @@ void XMLTextFieldExport::ExportFieldAutoStyle(
}
break;
+ case FIELD_ID_META:
+ // recurse into content (does not export element, so can be done first)
+ ExportMetaField(xPropSet, true, bProgress);
+ // fall-through: for the meta-field itself!
case FIELD_ID_DOCINFO_PRINT_TIME:
case FIELD_ID_DOCINFO_PRINT_DATE:
case FIELD_ID_DOCINFO_CREATION_DATE:
@@ -948,7 +954,8 @@ void XMLTextFieldExport::ExportFieldAutoStyle(
}
/// export the given field to XML. Called on second pass through document
-void XMLTextFieldExport::ExportField(const Reference<XTextField> & rTextField )
+void XMLTextFieldExport::ExportField(
+ const Reference<XTextField> & rTextField, sal_Bool bProgress )
{
// get property set
Reference<XPropertySet> xPropSet(rTextField, UNO_QUERY);
@@ -1026,7 +1033,8 @@ void XMLTextFieldExport::ExportField(const Reference<XTextField> & rTextField )
sal_False, sal_False);
// finally, export the field itself
- ExportFieldHelper( rTextField, xPropSet, xRangePropSet, nToken );
+ ExportFieldHelper( rTextField, xPropSet, xRangePropSet, nToken,
+ bProgress );
}
}
@@ -1035,7 +1043,8 @@ void XMLTextFieldExport::ExportFieldHelper(
const Reference<XTextField> & rTextField,
const Reference<XPropertySet> & rPropSet,
const Reference<XPropertySet> &,
- enum FieldIdEnum nToken)
+ enum FieldIdEnum nToken,
+ sal_Bool bProgress )
{
// get property set info (because some attributes are not support
// in all implementations)
@@ -1738,11 +1747,17 @@ void XMLTextFieldExport::ExportFieldHelper(
{
// The style with the combined characters attribute has
// already been handled in the ExportField method. So all that
- // is left to do now is to exprot the characters.
+ // is left to do now is to export the characters.
GetExport().Characters(sPresentation);
break;
}
+ case FIELD_ID_META:
+ {
+ ExportMetaField(rPropSet, false, bProgress);
+ break;
+ }
+
case FIELD_ID_MEASURE:
{
ProcessString(XML_KIND, MapMeasureKind(GetInt16Property(sPropertyMeasureKind, rPropSet)));
@@ -2248,6 +2263,47 @@ void XMLTextFieldExport::ExportMacro(
GetExport().Characters(rContent);
}
+// FIXME: this is untested
+void XMLTextFieldExport::ExportMetaField(
+ const Reference<XPropertySet> & i_xMeta,
+ bool i_bAutoStyles, sal_Bool i_bProgress )
+{
+ bool doExport(!i_bAutoStyles); // do not export element if autostyles
+ // check version >= 1.2
+ switch (GetExport().getDefaultVersion()) {
+ case SvtSaveOptions::ODFVER_011: // fall thru
+ case SvtSaveOptions::ODFVER_010: doExport = false; break;
+ default: break;
+ }
+
+ const Reference < XEnumerationAccess > xEA( i_xMeta, UNO_QUERY_THROW );
+ const Reference < XEnumeration > xTextEnum( xEA->createEnumeration() );
+
+ if (doExport)
+ {
+ const Reference<rdf::XMetadatable> xMeta( i_xMeta, UNO_QUERY_THROW );
+
+ // style:data-style-name
+ ProcessValueAndType(sal_False,
+ GetIntProperty(sPropertyNumberFormat, i_xMeta),
+ sEmpty, sEmpty, 0.0, sal_False, sal_False, sal_True,
+ sal_False, sal_False /*, sal_False*/ );
+
+ // text:meta-field without xml:id is invalid
+ xMeta->ensureMetadataReference();
+
+ // xml:id for RDF metadata
+ GetExport().AddAttributeXmlId(xMeta);
+ }
+
+ SvXMLElementExport aElem( GetExport(), doExport,
+ XML_NAMESPACE_TEXT, XML_META_FIELD, sal_False, sal_False );
+
+ // recurse to export content
+ GetExport().GetTextParagraphExport()->
+ exportTextRangeEnumeration( xTextEnum, i_bAutoStyles, i_bProgress );
+}
+
/// export all data-style related attributes
void XMLTextFieldExport::ProcessValueAndType(
sal_Bool bIsString, /// do we process a string or a number?
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index 533e93bb53..3e88509239 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -327,7 +327,11 @@ static __FAR_DATA SvXMLTokenMapEntry aTextPElemTokenMap[] =
static __FAR_DATA SvXMLTokenMapEntry aTextPAttrTokenMap[] =
{
- { XML_NAMESPACE_XML , XML_ID, XML_TOK_TEXT_P_XMLID },
+ { XML_NAMESPACE_XML , XML_ID, XML_TOK_TEXT_P_XMLID },
+ { XML_NAMESPACE_XHTML, XML_ABOUT, XML_TOK_TEXT_P_ABOUT },
+ { XML_NAMESPACE_XHTML, XML_PROPERTY, XML_TOK_TEXT_P_PROPERTY },
+ { XML_NAMESPACE_XHTML, XML_CONTENT, XML_TOK_TEXT_P_CONTENT },
+ { XML_NAMESPACE_XHTML, XML_DATATYPE, XML_TOK_TEXT_P_DATATYPE },
{ XML_NAMESPACE_TEXT, XML_STYLE_NAME, XML_TOK_TEXT_P_STYLE_NAME },
{ XML_NAMESPACE_TEXT, XML_COND_STYLE_NAME,
XML_TOK_TEXT_P_COND_STYLE_NAME },
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index 1d182f8470..e3d71f7c61 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -65,15 +65,11 @@
#include <com/sun/star/container/XNamed.hpp>
#include <com/sun/star/container/XContentEnumerationAccess.hpp>
#include <com/sun/star/text/XTextFrame.hpp>
-#ifndef _COM_SUN_STAR_CONTAINER_XNAMED_HPP_
#include <com/sun/star/container/XNameAccess.hpp>
-#endif
#include <com/sun/star/text/SizeType.hpp>
#include <com/sun/star/text/HoriOrientation.hpp>
#include <com/sun/star/text/VertOrientation.hpp>
-#ifndef _COM_SUN_STAR_TEXT_TEXTCONTENTANCHORTYPE_HPP
#include <com/sun/star/text/TextContentAnchorType.hpp>
-#endif
#include <com/sun/star/text/XTextFramesSupplier.hpp>
#include <com/sun/star/text/XTextGraphicObjectsSupplier.hpp>
#include <com/sun/star/text/XTextEmbeddedObjectsSupplier.hpp>
@@ -111,28 +107,23 @@
#include <xmloff/nmspmap.hxx>
#include <xmloff/xmlexp.hxx>
#include "txtflde.hxx"
-#ifndef _XMLOFF_TXTPRMAP_HXX
#include <xmloff/txtprmap.hxx>
-#endif
#include "XMLImageMapExport.hxx"
#include "XMLTextNumRuleInfo.hxx"
#include "XMLTextListAutoStylePool.hxx"
-#ifndef _XMLOFF_TXTPARAE_HXX
#include <xmloff/txtparae.hxx>
-#endif
#include "XMLSectionExport.hxx"
#include "XMLIndexMarkExport.hxx"
#include <xmloff/XMLEventExport.hxx>
#include "XMLRedlineExport.hxx"
-#ifndef _XMLOFF_MULTIPROPERTYSETHELPER_HXX
#include "MultiPropertySetHelper.hxx"
-#endif
#include <xmloff/formlayerexport.hxx>
#include "XMLTextCharStyleNamesElementExport.hxx"
// --> OD 2008-04-25 #refactorlists#
#include <txtlists.hxx>
// <--
+#include <com/sun/star/rdf/XMetadatable.hpp>
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
@@ -1460,7 +1451,8 @@ bool XMLTextParagraphExport::collectTextAutoStylesOptimized( sal_Bool bIsProgres
{
Any aAny = xTextFieldsEnum->nextElement();
Reference< XTextField > xTextField = *(Reference<XTextField>*)aAny.getValue();
- exportTextField( xTextField->getAnchor(), bAutoStyles );
+ exportTextField( xTextField->getAnchor(), bAutoStyles,
+ bIsProgress );
try
{
Reference < XPropertySet > xSet( xTextField, UNO_QUERY );
@@ -1905,6 +1897,7 @@ void XMLTextParagraphExport::exportParagraph(
{
// xml:id for RDF metadata
GetExport().AddAttributeXmlId(rTextContent);
+ GetExport().AddAttributesRDFa(rTextContent);
OUString sStyle;
if( rPropSetHelper.hasProperty( PARA_STYLE_NAME ) )
@@ -2142,6 +2135,7 @@ void XMLTextParagraphExport::exportTextRangeEnumeration(
sal_Bool bAutoStyles, sal_Bool bIsProgress,
sal_Bool bPrvChrIsSpc )
{
+ static OUString sMeta(RTL_CONSTASCII_USTRINGPARAM("Meta")); // FIXME
sal_Bool bPrevCharIsSpace = bPrvChrIsSpc;
while( rTextEnum->hasMoreElements() )
@@ -2162,7 +2156,7 @@ void XMLTextParagraphExport::exportTextRangeEnumeration(
}
else if( sType.equals(sTextField))
{
- exportTextField( xTxtRange, bAutoStyles );
+ exportTextField( xTxtRange, bAutoStyles, bIsProgress );
bPrevCharIsSpace = sal_False;
}
else if( sType.equals( sFrame ) )
@@ -2217,6 +2211,10 @@ void XMLTextParagraphExport::exportTextRangeEnumeration(
{
exportRuby(xPropSet, bAutoStyles);
}
+ else if (sType.equals(sMeta))
+ {
+ exportMeta(xPropSet, bAutoStyles, bIsProgress);
+ }
else if (sType.equals(sTextFieldStart))
{
Reference<XNamed> xBookmark(xPropSet->getPropertyValue(sBookmark), UNO_QUERY);
@@ -2286,7 +2284,7 @@ void XMLTextParagraphExport::exportTextRangeEnumeration(
Reference<XServiceInfo> xServiceInfo( xTxtRange, UNO_QUERY );
if( xServiceInfo->supportsService( sTextFieldService ) )
{
- exportTextField( xTxtRange, bAutoStyles );
+ exportTextField( xTxtRange, bAutoStyles, bIsProgress );
bPrevCharIsSpace = sal_False;
}
else
@@ -2308,7 +2306,7 @@ void XMLTextParagraphExport::exportTable(
void XMLTextParagraphExport::exportTextField(
const Reference < XTextRange > & rTextRange,
- sal_Bool bAutoStyles )
+ sal_Bool bAutoStyles, sal_Bool bIsProgress )
{
Reference < XPropertySet > xPropSet( rTextRange, UNO_QUERY );
// non-Writer apps need not support Property TextField, so test first
@@ -2320,11 +2318,11 @@ void XMLTextParagraphExport::exportTextField(
{
if( bAutoStyles )
{
- pFieldExport->ExportFieldAutoStyle( xTxtFld );
+ pFieldExport->ExportFieldAutoStyle( xTxtFld, bIsProgress );
}
else
{
- pFieldExport->ExportField( xTxtFld );
+ pFieldExport->ExportField( xTxtFld, bIsProgress );
}
}
else
@@ -3634,7 +3632,41 @@ void XMLTextParagraphExport::exportRuby(
}
}
+// FIXME: this is untested
+void XMLTextParagraphExport::exportMeta(
+ const Reference<XPropertySet> & i_xMeta,
+ sal_Bool i_bAutoStyles, sal_Bool i_isProgress)
+{
+ bool doExport(!i_bAutoStyles); // do not export element if autostyles
+ // check version >= 1.2
+ switch (GetExport().getDefaultVersion()) {
+ case SvtSaveOptions::ODFVER_011: // fall thru
+ case SvtSaveOptions::ODFVER_010: doExport = false; break;
+ default: break;
+ }
+ const Reference < XEnumerationAccess > xEA( i_xMeta, UNO_QUERY_THROW );
+ const Reference < XEnumeration > xTextEnum( xEA->createEnumeration() );
+
+ if (doExport)
+ {
+ const Reference<rdf::XMetadatable> xMeta( i_xMeta, UNO_QUERY_THROW );
+ const Reference<XTextContent> xTextContent( i_xMeta, UNO_QUERY_THROW );
+
+ // text:meta with neither xml:id nor RDFa is invalid
+ xMeta->ensureMetadataReference();
+
+ // xml:id and RDFa for RDF metadata
+ GetExport().AddAttributeXmlId(xMeta);
+ GetExport().AddAttributesRDFa(xTextContent);
+ }
+
+ SvXMLElementExport aElem( GetExport(), doExport,
+ XML_NAMESPACE_TEXT, XML_META, sal_False, sal_False );
+
+ // recurse to export content
+ exportTextRangeEnumeration( xTextEnum, i_bAutoStyles, i_isProgress );
+}
void XMLTextParagraphExport::PreventExportOfControlsInMuteSections(
diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx
index 52e58377b7..3397477d25 100644
--- a/xmloff/source/text/txtparai.cxx
+++ b/xmloff/source/text/txtparai.cxx
@@ -671,34 +671,33 @@ SvXMLImportContext *XMLImpRubyContext_Impl::CreateChildContext(
// ---------------------------------------------------------------------
-/** text:meta and text:meta-field
-//FIXME neither finished nor tested
+/** for text:meta and text:meta-field
+//FIXME not tested
*/
-class XMLMetaImportContext : public SvXMLImportContext
+class XMLMetaImportContextBase : public SvXMLImportContext
{
- XMLHints_Impl& mrHints;
-// XMLStyleHint_Impl *pHint;
+ XMLHints_Impl& m_rHints;
- sal_Bool& mrIgnoreLeadingSpace;
+ sal_Bool& m_rIgnoreLeadingSpace;
/// start position
- Reference<XTextRange> mxStart;
+ Reference<XTextRange> m_xStart;
- OUString mXmlId;
+protected:
+ OUString m_XmlId;
public:
TYPEINFO();
- XMLMetaImportContext(
+ XMLMetaImportContextBase(
SvXMLImport& i_rImport,
sal_uInt16 i_nPrefix,
const OUString& i_rLocalName,
const Reference< xml::sax::XAttributeList > & i_xAttrList,
-// enum XMLTextPElemTokens nTok,
XMLHints_Impl& i_rHints,
sal_Bool & i_rIgnoreLeadingSpace );
- virtual ~XMLMetaImportContext();
+ virtual ~XMLMetaImportContextBase();
virtual void EndElement();
@@ -707,25 +706,30 @@ public:
const Reference< xml::sax::XAttributeList > & i_xAttrList );
virtual void Characters( const OUString& i_rChars );
+
+ virtual void ProcessAttribute(sal_uInt16 const i_nPrefix,
+ OUString const & i_rLocalName, OUString const & i_rValue);
+
+ virtual void InsertMeta(const Reference<XTextRange> & i_xInsertionRange)
+ = 0;
};
-TYPEINIT1( XMLMetaImportContext , SvXMLImportContext );
+TYPEINIT1( XMLMetaImportContextBase, SvXMLImportContext );
-XMLMetaImportContext::XMLMetaImportContext(
+XMLMetaImportContextBase::XMLMetaImportContextBase(
SvXMLImport& i_rImport,
sal_uInt16 i_nPrefix,
const OUString& i_rLocalName,
const Reference< xml::sax::XAttributeList > & i_xAttrList,
XMLHints_Impl& i_rHints,
sal_Bool & i_rIgnoreLeadingSpace )
- : SvXMLImportContext( i_rImport, i_nPrefix, i_rLocalName ),
- mrHints( i_rHints ),
- mrIgnoreLeadingSpace( i_rIgnoreLeadingSpace ),
- mxStart()
+ : SvXMLImportContext( i_rImport, i_nPrefix, i_rLocalName )
+ , m_rHints( i_rHints )
+ , m_rIgnoreLeadingSpace( i_rIgnoreLeadingSpace )
+ , m_xStart()
{
-//FIXME: RDFa (text:meta)
const sal_Int16 nAttrCount(i_xAttrList.is() ? i_xAttrList->getLength() : 0);
- for( sal_Int16 i=0; i < nAttrCount; i++ )
+ for ( sal_Int16 i=0; i < nAttrCount; i++ )
{
const OUString& rAttrName( i_xAttrList->getNameByIndex( i ) );
const OUString& rValue( i_xAttrList->getValueByIndex( i ) );
@@ -734,49 +738,61 @@ XMLMetaImportContext::XMLMetaImportContext(
sal_uInt16 nPrefix =
GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
&sLocalName );
-// FIXME: only meta-field
- if( XML_NAMESPACE_TEXT == nPrefix &&
- IsXMLToken( sLocalName, XML_DATA_STYLE_NAME ) )
- {
-// pHint->SetStyleName( rValue );
- break;
- }
- else if ( (XML_NAMESPACE_XML == nPrefix) &&
- IsXMLToken(sLocalName, XML_ID) )
- {
- mXmlId = rValue;
- }
+ ProcessAttribute(nPrefix, sLocalName, rValue);
}
- //FIXME meta-field xml:id mandatory
- mxStart = GetImport().GetTextImport()->GetCursorAsRange()->getStart();
+ m_xStart = GetImport().GetTextImport()->GetCursorAsRange()->getStart();
}
-XMLMetaImportContext::~XMLMetaImportContext()
+XMLMetaImportContextBase::~XMLMetaImportContextBase()
{
}
-void XMLMetaImportContext::EndElement()
+void XMLMetaImportContextBase::EndElement()
{
- OSL_ENSURE(mxStart.is(), "no mxStart?");
+ OSL_ENSURE(m_xStart.is(), "no mxStart?");
+ if (!m_xStart.is()) return;
- Reference<XTextRange> xEndRange(
+ const Reference<XTextRange> xEndRange(
GetImport().GetTextImport()->GetCursorAsRange()->getStart() );
// create range for insertion
- Reference<XTextCursor> xInsertionCursor(
+ const Reference<XTextCursor> xInsertionCursor(
GetImport().GetTextImport()->GetText()->createTextCursorByRange(
xEndRange) );
- xInsertionCursor->gotoRange(mxStart, sal_True);
+ xInsertionCursor->gotoRange(m_xStart, sal_True);
- Reference<XTextRange> xInsertionRange(xInsertionCursor, UNO_QUERY);
+ const Reference<XTextRange> xInsertionRange(xInsertionCursor, UNO_QUERY);
- OUString sName;
+ InsertMeta(xInsertionRange);
//FIXME
- // insert bookmark
-// XMLTextMarkImportContext::CreateAndInsertMark
+#if 0
+ Reference<XMultiServiceFactory> xFactory(rImport.GetModel(), UNO_QUERY);
+ if ( xFactory.is() )
+ {
+ Reference<XInterface> xIfc = xFactory->createInstance(sServiceName);
+
+ // 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())
+ {
+ try
+ {
+ rImport.GetTextImport()->GetText()->insertTextContent(
+ xInsertionRange, xTextContent, sal_True);
+ }
+ catch (com::sun::star::lang::IllegalArgumentException &)
+ {
+ OSL_ENSURE(false, "XMLMetaImportContext::EndElement: iae");
+ }
+ }
+ }
+#endif
}
-SvXMLImportContext * XMLMetaImportContext::CreateChildContext(
+SvXMLImportContext * XMLMetaImportContextBase::CreateChildContext(
sal_uInt16 i_nPrefix, const OUString& i_rLocalName,
const Reference< xml::sax::XAttributeList > & i_xAttrList )
{
@@ -785,15 +801,236 @@ SvXMLImportContext * XMLMetaImportContext::CreateChildContext(
sal_uInt16 nToken = rTokenMap.Get( i_nPrefix, i_rLocalName );
return XMLImpSpanContext_Impl::CreateChildContext( GetImport(), i_nPrefix,
- i_rLocalName, i_xAttrList, nToken, mrHints, mrIgnoreLeadingSpace );
+ i_rLocalName, i_xAttrList, nToken, m_rHints, m_rIgnoreLeadingSpace );
}
-void XMLMetaImportContext::Characters( const OUString& i_rChars )
+void XMLMetaImportContextBase::Characters( const OUString& i_rChars )
{
- //FIXME do we need to call ConvertStarFonts?
- GetImport().GetTextImport()->InsertString( i_rChars, mrIgnoreLeadingSpace );
+ GetImport().GetTextImport()->InsertString(i_rChars, m_rIgnoreLeadingSpace);
}
+void XMLMetaImportContextBase::ProcessAttribute(sal_uInt16 const i_nPrefix,
+ OUString const & i_rLocalName, OUString const & i_rValue)
+{
+ if ( (XML_NAMESPACE_XML == i_nPrefix) &&
+ IsXMLToken(i_rLocalName, XML_ID) )
+ {
+ m_XmlId = i_rValue;
+ }
+}
+
+
+// ---------------------------------------------------------------------
+
+/** text:meta
+//FIXME not tested
+ */
+class XMLMetaImportContext : public XMLMetaImportContextBase
+{
+ // RDFa
+ bool m_bHaveAbout;
+ ::rtl::OUString m_sAbout;
+ ::rtl::OUString m_sProperty;
+ ::rtl::OUString m_sContent;
+ ::rtl::OUString m_sDatatype;
+
+public:
+ TYPEINFO();
+
+ XMLMetaImportContext(
+ SvXMLImport& i_rImport,
+ sal_uInt16 i_nPrefix,
+ const OUString& i_rLocalName,
+ const Reference< xml::sax::XAttributeList > & i_xAttrList,
+ XMLHints_Impl& i_rHints,
+ sal_Bool & i_rIgnoreLeadingSpace );
+
+ virtual void ProcessAttribute(sal_uInt16 const i_nPrefix,
+ OUString const & i_rLocalName, OUString const & i_rValue);
+
+ virtual void InsertMeta(const Reference<XTextRange> & i_xInsertionRange);
+};
+
+TYPEINIT1( XMLMetaImportContext, XMLMetaImportContextBase );
+
+XMLMetaImportContext::XMLMetaImportContext(
+ SvXMLImport& i_rImport,
+ sal_uInt16 i_nPrefix,
+ const OUString& i_rLocalName,
+ const Reference< xml::sax::XAttributeList > & i_xAttrList,
+ XMLHints_Impl& i_rHints,
+ sal_Bool & i_rIgnoreLeadingSpace )
+ : XMLMetaImportContextBase( i_rImport, i_nPrefix, i_rLocalName,
+ i_xAttrList, i_rHints, i_rIgnoreLeadingSpace )
+ , m_bHaveAbout(false)
+{
+}
+
+void XMLMetaImportContext::ProcessAttribute(sal_uInt16 const i_nPrefix,
+ OUString const & i_rLocalName, OUString const & i_rValue)
+{
+ if ( XML_NAMESPACE_XHTML == i_nPrefix )
+ {
+ // RDFa
+ if ( IsXMLToken( i_rLocalName, XML_ABOUT) )
+ {
+ m_sAbout = i_rValue;
+ m_bHaveAbout = true;
+ }
+ else if ( IsXMLToken( i_rLocalName, XML_PROPERTY) )
+ {
+ m_sProperty = i_rValue;
+ }
+ else if ( IsXMLToken( i_rLocalName, XML_CONTENT) )
+ {
+ m_sContent = i_rValue;
+ }
+ else if ( IsXMLToken( i_rLocalName, XML_DATATYPE) )
+ {
+ m_sDatatype = i_rValue;
+ }
+ }
+ else
+ {
+ XMLMetaImportContextBase::ProcessAttribute(
+ i_nPrefix, i_rLocalName, i_rValue);
+ }
+}
+
+void XMLMetaImportContext::InsertMeta(
+ const Reference<XTextRange> & i_xInsertionRange)
+{
+ OSL_ENSURE(!m_bHaveAbout == !m_sProperty.getLength(),
+ "XMLMetaImportContext::InsertMeta: invalid RDFa?");
+ if (m_XmlId.getLength() || (m_bHaveAbout && m_sProperty.getLength()))
+ {
+ // insert mark
+ const uno::Reference<rdf::XMetadatable> xMeta(
+ XMLTextMarkImportContext::CreateAndInsertMark(
+ GetImport(),
+ OUString::createFromAscii(
+ "com.sun.star.text.InContentMetadata"),
+ OUString(),
+ i_xInsertionRange, m_XmlId),
+ uno::UNO_QUERY);
+ OSL_ENSURE(xMeta.is(), "cannot insert Meta?");
+
+ if (xMeta.is() && m_bHaveAbout)
+ {
+ GetImport().AddRDFa(xMeta,
+ m_sAbout, m_sProperty, m_sContent, m_sDatatype);
+ }
+ }
+ else
+ {
+ OSL_TRACE("invalid <text:meta>: no xml:id, no valid RDFa");
+ }
+}
+
+// ---------------------------------------------------------------------
+
+/** text:meta-field
+//FIXME not tested
+ */
+class XMLMetaFieldImportContext : public XMLMetaImportContextBase
+{
+ OUString m_DataStyleName;
+
+public:
+ TYPEINFO();
+
+ XMLMetaFieldImportContext(
+ SvXMLImport& i_rImport,
+ sal_uInt16 i_nPrefix,
+ const OUString& i_rLocalName,
+ const Reference< xml::sax::XAttributeList > & i_xAttrList,
+ XMLHints_Impl& i_rHints,
+ sal_Bool & i_rIgnoreLeadingSpace );
+
+ virtual void ProcessAttribute(sal_uInt16 const i_nPrefix,
+ OUString const & i_rLocalName, OUString const & i_rValue);
+
+ virtual void InsertMeta(const Reference<XTextRange> & i_xInsertionRange);
+};
+
+TYPEINIT1( XMLMetaFieldImportContext, XMLMetaImportContextBase );
+
+XMLMetaFieldImportContext::XMLMetaFieldImportContext(
+ SvXMLImport& i_rImport,
+ sal_uInt16 i_nPrefix,
+ const OUString& i_rLocalName,
+ const Reference< xml::sax::XAttributeList > & i_xAttrList,
+ XMLHints_Impl& i_rHints,
+ sal_Bool & i_rIgnoreLeadingSpace )
+ : XMLMetaImportContextBase( i_rImport, i_nPrefix, i_rLocalName,
+ i_xAttrList, i_rHints, i_rIgnoreLeadingSpace )
+{
+}
+
+void XMLMetaFieldImportContext::ProcessAttribute(sal_uInt16 const i_nPrefix,
+ OUString const & i_rLocalName, OUString const & i_rValue)
+{
+ if( XML_NAMESPACE_STYLE == i_nPrefix &&
+ IsXMLToken( i_rLocalName, XML_DATA_STYLE_NAME ) )
+ {
+ m_DataStyleName = i_rValue;
+ }
+ else
+ {
+ XMLMetaImportContextBase::ProcessAttribute(
+ i_nPrefix, i_rLocalName, i_rValue);
+ }
+}
+
+void XMLMetaFieldImportContext::InsertMeta(
+ const Reference<XTextRange> & i_xInsertionRange)
+{
+ if (m_XmlId.getLength()) // valid?
+ {
+ // insert mark
+ const Reference<XPropertySet> xPropertySet(
+ XMLTextMarkImportContext::CreateAndInsertMark(
+ GetImport(),
+ OUString::createFromAscii(
+ "com.sun.star.text.textfield.MetadataField"),
+ OUString(),
+ i_xInsertionRange, m_XmlId),
+ UNO_QUERY);
+ OSL_ENSURE(xPropertySet.is(), "cannot insert MetaField?");
+ if (!xPropertySet.is()) return;
+
+ if (m_DataStyleName.getLength())
+ {
+ sal_Bool isDefaultLanguage(sal_True);
+
+ const sal_Int32 nKey( GetImport().GetTextImport()->GetDataStyleKey(
+ m_DataStyleName, & isDefaultLanguage) );
+
+ if (-1 != nKey)
+ {
+ static ::rtl::OUString sPropertyIsFixedLanguage(
+ ::rtl::OUString::createFromAscii("IsFixedLanguage") );
+ Any any;
+ any <<= nKey;
+ xPropertySet->setPropertyValue(
+ OUString::createFromAscii("NumberFormat"), any);
+ if ( xPropertySet->getPropertySetInfo()->
+ hasPropertyByName( sPropertyIsFixedLanguage ) )
+ {
+ any <<= static_cast<bool>(!isDefaultLanguage);
+ xPropertySet->setPropertyValue( sPropertyIsFixedLanguage,
+ any );
+ }
+ }
+ }
+ }
+ else
+ {
+ OSL_TRACE("invalid <text:meta-field>: no xml:id");
+ }
+}
+
+
// ---------------------------------------------------------------------
@@ -1574,13 +1811,17 @@ SvXMLImportContext *XMLImpSpanContext_Impl::CreateChildContext(
sal_False);
break;
- case XML_TOK_TEXT_META:
- case XML_TOK_TEXT_META_FIELD:
// FIXME: should test before enabling...
#if 0
+ case XML_TOK_TEXT_META:
pContext = new XMLMetaImportContext(rImport, nPrefix, rLocalName,
xAttrList, rHints, rIgnoreLeadingSpace );
break;
+
+ case XML_TOK_TEXT_META_FIELD:
+ pContext = new XMLMetaFieldImportContext(rImport, nPrefix, rLocalName,
+ xAttrList, rHints, rIgnoreLeadingSpace );
+ break;
#endif
default:
@@ -1657,6 +1898,7 @@ XMLParaContext::XMLParaContext(
sal_Bool bHead ) :
SvXMLImportContext( rImport, nPrfx, rLName ),
xStart( rImport.GetTextImport()->GetCursorAsRange()->getStart() ),
+ m_bHaveAbout(false),
nOutlineLevel( IsXMLToken( rLName, XML_H ) ? 1 : -1 ),
pHints( 0 ),
// --> OD 2007-07-25 #i73509#
@@ -1686,9 +1928,21 @@ XMLParaContext::XMLParaContext(
&aLocalName );
switch( rTokenMap.Get( nPrefix, aLocalName ) )
{
-//FIXME: RDFa
case XML_TOK_TEXT_P_XMLID:
- sXmlId = rValue;
+ m_sXmlId = rValue;
+ break;
+ case XML_TOK_TEXT_P_ABOUT:
+ m_sAbout = rValue;
+ m_bHaveAbout = true;
+ break;
+ case XML_TOK_TEXT_P_PROPERTY:
+ m_sProperty = rValue;
+ break;
+ case XML_TOK_TEXT_P_CONTENT:
+ m_sContent = rValue;
+ break;
+ case XML_TOK_TEXT_P_DATATYPE:
+ m_sDatatype = rValue;
break;
case XML_TOK_TEXT_P_STYLE_NAME:
sStyleName = rValue;
@@ -1785,7 +2039,8 @@ XMLParaContext::~XMLParaContext()
xAttrCursor->gotoRange( xEnd, sal_True );
// xml:id for RDF metadata
- if (sXmlId.getLength() > 0) {
+ if (m_sXmlId.getLength() || m_bHaveAbout || m_sProperty.getLength())
+ {
try {
const uno::Reference<container::XEnumerationAccess> xEA
(xAttrCursor, uno::UNO_QUERY_THROW);
@@ -1795,12 +2050,17 @@ XMLParaContext::~XMLParaContext()
if (xEnum->hasMoreElements()) {
uno::Reference<rdf::XMetadatable> xMeta;
xEnum->nextElement() >>= xMeta;
-//FIXME not yet
-// OSL_ENSURE(xMeta.is(), "xml:id: not XMetadatable");
- GetImport().SetXmlId(xMeta, sXmlId);
+ OSL_ENSURE(xMeta.is(), "xml:id: not XMetadatable");
+ GetImport().SetXmlId(xMeta, m_sXmlId);
+ if (m_bHaveAbout)
+ {
+ GetImport().AddRDFa(xMeta,
+ m_sAbout, m_sProperty, m_sContent, m_sDatatype);
+ }
OSL_ENSURE(!xEnum->hasMoreElements(), "xml:id: > 1 paragraph?");
}
} catch (uno::Exception &) {
+ OSL_TRACE("XMLParaContext::~XMLParaContext: exception");
}
}
diff --git a/xmloff/source/text/txtparai.hxx b/xmloff/source/text/txtparai.hxx
index c799540588..274c212d7f 100644
--- a/xmloff/source/text/txtparai.hxx
+++ b/xmloff/source/text/txtparai.hxx
@@ -50,7 +50,12 @@ class XMLParaContext : public SvXMLImportContext
::com::sun::star::text::XTextRange > xStart; // xub_StrLen nStart;
::rtl::OUString sStyleName;
::rtl::OUString sId;
- ::rtl::OUString sXmlId;
+ ::rtl::OUString m_sXmlId;
+ ::rtl::OUString m_sAbout;
+ ::rtl::OUString m_sProperty;
+ ::rtl::OUString m_sContent;
+ ::rtl::OUString m_sDatatype;
+ bool m_bHaveAbout;
sal_Int8 nOutlineLevel;
XMLHints_Impl *pHints;
// --> OD 2007-07-25 #i73509#