summaryrefslogtreecommitdiff
path: root/sfx2/qa
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 /sfx2/qa
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 'sfx2/qa')
-rw-r--r--sfx2/qa/complex/DocumentMetadataAccessTest.java1270
-rw-r--r--sfx2/qa/complex/makefile.mk4
-rw-r--r--sfx2/qa/complex/testdocuments/TESTRDFA.odtbin0 -> 7540 bytes
-rw-r--r--sfx2/qa/complex/tests.sce1
4 files changed, 1274 insertions, 1 deletions
diff --git a/sfx2/qa/complex/DocumentMetadataAccessTest.java b/sfx2/qa/complex/DocumentMetadataAccessTest.java
new file mode 100644
index 0000000000..86848ac4bf
--- /dev/null
+++ b/sfx2/qa/complex/DocumentMetadataAccessTest.java
@@ -0,0 +1,1270 @@
+/*************************************************************************
+ * 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: DocumentMetadataAccessTest.java,v $
+ *
+ * $Revision: 1.1.2.9 $
+ *
+ * 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.
+ ************************************************************************/
+
+package complex.framework;
+
+import complexlib.ComplexTestCase;
+import helper.StreamSimulator;
+
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.uno.Any;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XInitialization;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.lang.WrappedTargetRuntimeException;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.StringPair;
+import com.sun.star.container.XEnumerationAccess;
+import com.sun.star.container.XEnumeration;
+import com.sun.star.container.ElementExistException;
+import com.sun.star.container.NoSuchElementException;
+import com.sun.star.io.XInputStream;
+import com.sun.star.io.XOutputStream;
+import com.sun.star.util.XCloseable;
+import com.sun.star.frame.XStorable;
+import com.sun.star.frame.XLoadable;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.text.XTextRange;
+import com.sun.star.text.XText;
+import com.sun.star.rdf.*;
+
+/**
+ * Test case for interface com.sun.star.rdf.XDocumentMetadataAccess
+ * Currently, this service is implemented in
+ * sfx2/source/doc/DocumentMetadataAccess.cxx
+ *
+ * Actually, this is not a service, so we need to create a document and
+ * go from there...
+ *
+ * @author mst
+ */
+public class DocumentMetadataAccessTest extends ComplexTestCase
+{
+ XMultiServiceFactory xMSF;
+ XComponentContext xContext;
+ String tempDir;
+
+ String nsRDF = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+ String nsRDFS = "http://www.w3.org/2000/01/rdf-schema#";
+ String nsPkg="http://docs.oasis-open.org/opendocument/meta/package/common#";
+ String nsODF ="http://docs.oasis-open.org/opendocument/meta/package/odf#";
+
+ XURI foo;
+ XURI bar;
+ XURI baz;
+
+ static XURI rdf_type;
+ static XURI rdfs_label;
+ static XURI pkg_Document;
+ static XURI pkg_hasPart;
+ static XURI pkg_MetadataFile;
+ static XURI odf_ContentFile;
+ static XURI odf_StylesFile;
+ static XURI odf_Element;
+ static XBlankNode blank1;
+ static XBlankNode blank2;
+ static XBlankNode blank3;
+ static XBlankNode blank4;
+ static String manifestPath = "manifest.rdf";
+ static String contentPath = "content.xml";
+ static String stylesPath = "styles.xml";
+ static String fooPath = "foo.rdf";
+ static String fooBarPath = "meta/foo/bar.rdf";
+
+ XRepository xRep;
+ XRepositorySupplier xRS;
+ XDocumentMetadataAccess xDMA;
+
+ public String[] getTestMethodNames ()
+ {
+ return new String[] { "check", "checkRDFa" };
+ }
+
+ public void before()
+ {
+ try {
+
+ xMSF = (XMultiServiceFactory) param.getMSF();
+ assure("could not create MultiServiceFactory.", xMSF != null);
+ XPropertySet xPropertySet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xMSF);
+ Object defaultCtx = xPropertySet.getPropertyValue("DefaultContext");
+ xContext = (XComponentContext)
+ UnoRuntime.queryInterface(XComponentContext.class, defaultCtx);
+ assure("could not get component context.", xContext != null);
+
+ tempDir = util.utils.getOfficeTemp/*Dir*/(xMSF);
+ log.println("tempdir: " + tempDir);
+
+ foo = URI.create(xContext, "uri:foo");
+ assure("foo", null != foo);
+ bar = URI.create(xContext, "uri:bar");
+ assure("bar", null != bar);
+ baz = URI.create(xContext, "uri:baz");
+ assure("baz", null != baz);
+
+ blank1 = BlankNode.create(xContext, "_:1");
+ assure("blank1", null != blank1);
+ blank2 = BlankNode.create(xContext, "_:2");
+ assure("blank2", null != blank2);
+ blank3 = BlankNode.create(xContext, "_:3");
+ assure("blank3", null != blank3);
+ blank4 = BlankNode.create(xContext, "_:4");
+ assure("blank4", null != blank4);
+ rdf_type = URI.createKnown(xContext, URIs.RDF_TYPE);
+ assure("rdf_type", null != rdf_type);
+ rdfs_label = URI.createKnown(xContext, URIs.RDFS_LABEL);
+ assure("rdfs_label", null != rdfs_label);
+ pkg_Document = URI.createKnown(xContext, URIs.PKG_DOCUMENT);
+ assure("pkg_Document", null != pkg_Document);
+ pkg_hasPart = URI.createKnown(xContext, URIs.PKG_HASPART);
+ assure("pkg_hasPart", null != pkg_hasPart);
+ pkg_MetadataFile = URI.createKnown(xContext, URIs.PKG_METADATAFILE);
+ assure("pkg_MetadataFile", null != pkg_MetadataFile);
+ odf_ContentFile = URI.createKnown(xContext, URIs.ODF_CONTENTFILE);
+ assure("odf_ContentFile", null != odf_ContentFile);
+ odf_StylesFile = URI.createKnown(xContext, URIs.ODF_STYLESFILE);
+ assure("odf_StylesFile", null != odf_StylesFile);
+ odf_Element = URI.createKnown(xContext, URIs.ODF_ELEMENT);
+ assure("odf_Element", null != odf_Element);
+
+ } catch (Exception e) {
+ report(e);
+ }
+ }
+
+ public void after()
+ {
+ xRep = null;
+ xRS = null;
+ xDMA = null;
+ }
+
+ public void check()
+ {
+ XComponent xComp = null;
+ XComponent xComp2 = null;
+ try {
+ XEnumeration xStmtsEnum;
+ XNamedGraph xManifest;
+
+ log.println("Creating document with Repository...");
+
+ // we cannot create a XDMA directly, we must create
+ // a document and get it from there :(
+ // create document
+ PropertyValue[] loadProps = new PropertyValue[1];
+ loadProps[0] = new PropertyValue();
+ loadProps[0].Name = "Hidden";
+ loadProps[0].Value = new Boolean(true);
+ xComp = util.DesktopTools.openNewDoc(xMSF, "swriter", loadProps);
+ XTextDocument xText = (XTextDocument) UnoRuntime.queryInterface(
+ XTextDocument.class, xComp);
+
+ XRepositorySupplier xRS = (XRepositorySupplier)
+ UnoRuntime.queryInterface(XRepositorySupplier.class, xComp);
+ assure("xRS null", null != xRS);
+ XDocumentMetadataAccess xDMA = (XDocumentMetadataAccess)
+ UnoRuntime.queryInterface(XDocumentMetadataAccess.class, xRS);
+ assure("xDMA null", null != xDMA);
+ xRep = xRS.getRDFRepository();
+ assure("xRep null", null != xRep);
+
+ log.println("...done");
+
+ log.println("Checking that new repository is initialized...");
+
+ XURI xBaseURI = (XURI) xDMA;
+ String baseURI = xBaseURI.getStringValue();
+ assure("new: baseURI",
+ null != xBaseURI && !xBaseURI.getStringValue().equals(""));
+
+ assure("new: # graphs", 1 == xRep.getGraphNames().length);
+ XURI manifest = URI.createNS(xContext, xBaseURI.getStringValue(),
+ manifestPath);
+ xManifest = xRep.getGraph(manifest);
+ assure("new: manifest graph", null != xManifest);
+
+ Statement[] manifestStmts = getManifestStmts(xBaseURI);
+ xStmtsEnum = xRep.getStatements(null, null, null);
+ assure("new: manifest graph", eq(xStmtsEnum, manifestStmts));
+
+ log.println("...done");
+
+ log.println("Checking some invalid args...");
+
+ String content = "behold, for i am the content.";
+ XTextRange xTR = new TestRange(content);
+ XMetadatable xM = (XMetadatable) xTR;
+
+ try {
+ xDMA.getElementByURI(null);
+ assure("getElementByURI: null allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.getMetadataGraphsWithType(null);
+ assure("getMetadataGraphsWithType: null URI allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.addMetadataFile("", new XURI[0]);
+ assure("addMetadataFile: empty filename allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.addMetadataFile("/foo", new XURI[0]);
+ assure("addMetadataFile: absolute filename allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.addMetadataFile("fo\"o", new XURI[0]);
+ assure("addMetadataFile: invalid filename allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.addMetadataFile("../foo", new XURI[0]);
+ assure("addMetadataFile: filename with .. allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.addMetadataFile("foo/../../bar", new XURI[0]);
+ assure("addMetadataFile: filename with nest .. allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.addMetadataFile("foo/././bar", new XURI[0]);
+ assure("addMetadataFile: filename with nest . allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.addMetadataFile("content.xml", new XURI[0]);
+ assure("addMetadataFile: content.xml allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.addMetadataFile("styles.xml", new XURI[0]);
+ assure("addMetadataFile: styles.xml allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.addMetadataFile("meta.xml", new XURI[0]);
+ assure("addMetadataFile: meta.xml allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.addMetadataFile("settings.xml", new XURI[0]);
+ assure("addMetadataFile: settings.xml allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.importMetadataFile(FileFormat.RDF_XML, null, "foo",
+ foo, new XURI[0]);
+ assure("importMetadataFile: null stream allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ XInputStream xFooIn =
+ new StreamSimulator(tempDir + "empty.rdf", true, param);
+ xDMA.importMetadataFile(FileFormat.RDF_XML, xFooIn, "",
+ foo, new XURI[0]);
+ assure("importMetadataFile: empty filename allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ XInputStream xFooIn =
+ new StreamSimulator(tempDir + "empty.rdf", true, param);
+ xDMA.importMetadataFile(FileFormat.RDF_XML, xFooIn, "meta.xml",
+ foo, new XURI[0]);
+ assure("importMetadataFile: meta.xml filename allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ XInputStream xFooIn =
+ new StreamSimulator(tempDir + "empty.rdf", true, param);
+ xDMA.importMetadataFile(FileFormat.RDF_XML,
+ xFooIn, "foo", null, new XURI[0]);
+ assure("importMetadataFile: null base URI allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ XInputStream xFooIn =
+ new StreamSimulator(tempDir + "empty.rdf", true, param);
+ xDMA.importMetadataFile(FileFormat.RDF_XML,
+ xFooIn, "foo", rdf_type, new XURI[0]);
+ assure("importMetadataFile: non-absolute base URI allowed",
+ false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.removeMetadataFile(null);
+ assure("removeMetadataFile: null URI allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.addContentOrStylesFile("");
+ assure("addContentOrStylesFile: empty filename allowed",
+ false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.addContentOrStylesFile("/content.xml");
+ assure("addContentOrStylesFile: absolute filename allowed",
+ false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.addContentOrStylesFile("foo.rdf");
+ assure("addContentOrStylesFile: invalid filename allowed",
+ false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.removeContentOrStylesFile("");
+ assure("removeContentOrStylesFile: empty filename allowed",
+ false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.loadMetadataFromStorage(null, foo, null);
+ assure("loadMetadataFromStorage: null storage allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.storeMetadataToStorage(null/*, base*/);
+ assure("storeMetadataToStorage: null storage allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.loadMetadataFromMedium(new PropertyValue[0]);
+ assure("loadMetadataFromMedium: empty medium allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ try {
+ xDMA.storeMetadataToMedium(new PropertyValue[0]);
+ assure("storeMetadataToMedium: empty medium allowed", false);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+
+ log.println("...done");
+
+ log.println("Checking file addition/removal...");
+
+ xDMA.removeContentOrStylesFile(contentPath);
+ xStmtsEnum = xManifest.getStatements(null, null, null);
+ assure("removeContentOrStylesFile (content)",
+ eq(xStmtsEnum, new Statement[] {
+ manifestStmts[0], manifestStmts[2], manifestStmts[4]
+ }));
+
+ xDMA.addContentOrStylesFile(contentPath);
+ xStmtsEnum = xManifest.getStatements(null, null, null);
+ assure("addContentOrStylesFile (content)",
+ eq(xStmtsEnum, manifestStmts));
+
+ xDMA.removeContentOrStylesFile(stylesPath);
+ xStmtsEnum = xManifest.getStatements(null, null, null);
+ assure("removeContentOrStylesFile (styles)",
+ eq(xStmtsEnum, new Statement[] {
+ manifestStmts[0], manifestStmts[1], manifestStmts[3]
+ }));
+
+ xDMA.addContentOrStylesFile(stylesPath);
+ xStmtsEnum = xManifest.getStatements(null, null, null);
+ assure("addContentOrStylesFile (styles)",
+ eq(xStmtsEnum, manifestStmts));
+
+ XURI xFoo = URI.createNS(xContext, xBaseURI.getStringValue(),
+ fooPath);
+ Statement xM_BaseHaspartFoo =
+ new Statement(xBaseURI, pkg_hasPart, xFoo, manifest);
+ Statement xM_FooTypeMetadata =
+ new Statement(xFoo, rdf_type, pkg_MetadataFile, manifest);
+ Statement xM_FooTypeBar =
+ new Statement(xFoo, rdf_type, bar, manifest);
+ xDMA.addMetadataFile(fooPath, new XURI[] { bar });
+ xStmtsEnum = xManifest.getStatements(null, null, null);
+ assure("addMetadataFile",
+ eq(xStmtsEnum, merge(manifestStmts, new Statement[] {
+ xM_BaseHaspartFoo, xM_FooTypeMetadata, xM_FooTypeBar
+ })));
+
+ XURI[] graphsBar = xDMA.getMetadataGraphsWithType(bar);
+ assure("getMetadataGraphsWithType",
+ graphsBar.length == 1 && eq(graphsBar[0], xFoo));
+
+
+ xDMA.removeMetadataFile(xFoo);
+ xStmtsEnum = xManifest.getStatements(null, null, null);
+ assure("removeMetadataFile",
+ eq(xStmtsEnum, manifestStmts));
+
+ log.println("...done");
+
+ log.println("Checking mapping...");
+
+ XEnumerationAccess xTextEnum = (XEnumerationAccess)
+ UnoRuntime.queryInterface(XEnumerationAccess.class,
+ xText.getText());
+ Object o = xTextEnum.createEnumeration().nextElement();
+ XMetadatable xMeta1 = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, o);
+
+ XURI uri;
+ XMetadatable xMeta;
+ xMeta = xDMA.getElementByURI(xMeta1);
+ assure("getElementByURI: null", null != xMeta);
+ String XmlId = xMeta.getMetadataReference().Second;
+ String XmlId1 = xMeta1.getMetadataReference().Second;
+ assure("getElementByURI: no xml id", !XmlId.equals(""));
+ assure("getElementByURI: different xml id", XmlId.equals(XmlId1));
+
+ log.println("...done");
+
+ log.println("Checking storing and loading...");
+
+ XURI xFoobar = URI.createNS(xContext, xBaseURI.getStringValue(),
+ fooBarPath);
+ Statement[] metadataStmts = getMetadataFileStmts(xBaseURI,
+ fooBarPath);
+ xDMA.addMetadataFile(fooBarPath, new XURI[0]);
+ xStmtsEnum = xRep.getStatements(null, null, null);
+ assure("addMetadataFile",
+ eq(xStmtsEnum, merge(manifestStmts, metadataStmts )));
+
+ Statement xFoobar_FooBarFoo =
+ new Statement(foo, bar, foo, xFoobar);
+ xRep.getGraph(xFoobar).addStatement(foo, bar, foo);
+ xStmtsEnum = xRep.getStatements(null, null, null);
+ assure("addStatement",
+ eq(xStmtsEnum, merge(manifestStmts, merge(metadataStmts,
+ new Statement[] { xFoobar_FooBarFoo }))));
+
+ PropertyValue noMDNoContentFile = new PropertyValue();
+ noMDNoContentFile.Name = "URL";
+ noMDNoContentFile.Value = util.utils.getFullTestURL("CUSTOM.odt");
+ PropertyValue noMDFile = new PropertyValue();
+ noMDFile.Name = "URL";
+ noMDFile.Value = util.utils.getFullTestURL("TEST.odt");
+ PropertyValue file = new PropertyValue();
+ file.Name = "URL";
+ file.Value = tempDir + "TESTDMA.odt";
+ /*
+ PropertyValue baseURL = new PropertyValue();
+ baseURL.Name = "DocumentBaseURL";
+ baseURL.Value = tempDir + "TMP.odt";
+ */
+ PropertyValue mimetype = new PropertyValue();
+ mimetype.Name = "MediaType";
+ mimetype.Value = "application/vnd.oasis.opendocument.text";
+ PropertyValue[] argsEmptyNoContent = { mimetype, noMDNoContentFile};
+ PropertyValue[] argsEmpty = { mimetype, noMDFile };
+ PropertyValue[] args = { mimetype, file };
+
+ xStmtsEnum = xRep.getStatements(null, null, null);
+ XURI[] graphs = xRep.getGraphNames();
+
+ xDMA.storeMetadataToMedium(args);
+
+ // this should re-init
+ xDMA.loadMetadataFromMedium(argsEmptyNoContent);
+ xRep = xRS.getRDFRepository();
+ assure("xRep null", null != xRep);
+ assure("baseURI still tdoc?",
+ !baseURI.equals(xDMA.getStringValue()));
+ Statement[] manifestStmts2 = getManifestStmts((XURI) xDMA);
+ xStmtsEnum = xRep.getStatements(null, null, null);
+ // there is no content or styles file in here, so we have just
+ // the package stmt
+ assure("loadMetadataFromMedium (no metadata, no content)",
+ eq(xStmtsEnum, new Statement[] { manifestStmts2[0] }));
+
+ // this should re-init
+ xDMA.loadMetadataFromMedium(argsEmpty);
+ xRep = xRS.getRDFRepository();
+ assure("xRep null", null != xRep);
+ assure("baseURI still tdoc?",
+ !baseURI.equals(xDMA.getStringValue()));
+ Statement[] manifestStmts3 = getManifestStmts((XURI) xDMA);
+
+ xStmtsEnum = xRep.getStatements(null, null, null);
+ assure("loadMetadataFromMedium (no metadata)",
+ eq(xStmtsEnum, manifestStmts3));
+
+ xDMA.loadMetadataFromMedium(args);
+ xRep = xRS.getRDFRepository();
+ assure("xRep null", null != xRep);
+ Statement[] manifestStmts4 = getManifestStmts((XURI) xDMA);
+ Statement[] metadataStmts4 = getMetadataFileStmts((XURI) xDMA,
+ fooBarPath);
+
+ xStmtsEnum = xRep.getStatements(null, null, null);
+ assure("some graph(s) not reloaded",
+ graphs.length == xRep.getGraphNames().length);
+
+ XURI xFoobar4 = URI.createNS(xContext, xDMA.getStringValue(),
+ fooBarPath);
+ Statement xFoobar_FooBarFoo4 =
+ new Statement(foo, bar, foo, xFoobar4);
+ assure("loadMetadataFromMedium (re-load)",
+ eq(xStmtsEnum, merge(manifestStmts4, merge(metadataStmts4,
+ new Statement[] { xFoobar_FooBarFoo4 }))));
+
+ log.println("...done");
+
+ log.println("Checking storing and loading via model...");
+
+ String f = tempDir + "TESTPARA.odt";
+
+ XStorable xStor = (XStorable) UnoRuntime.queryInterface(
+ XStorable.class, xRS);
+
+ xStor.storeToURL(f, new PropertyValue[0]);
+
+ xComp2 = util.DesktopTools.loadDoc(xMSF, f, loadProps);
+
+ XDocumentMetadataAccess xDMA2 = (XDocumentMetadataAccess)
+ UnoRuntime.queryInterface(XDocumentMetadataAccess.class,
+ xComp2);
+ assure("xDMA2 null", null != xDMA2);
+
+ XRepositorySupplier xRS2 = (XRepositorySupplier)
+ UnoRuntime.queryInterface(XRepositorySupplier.class, xComp2);
+ assure("xRS2 null", null != xRS2);
+
+ XRepository xRep2 = xRS2.getRDFRepository();
+ assure("xRep2 null", null != xRep2);
+
+ Statement[] manifestStmts5 = getManifestStmts((XURI) xDMA2);
+ Statement[] metadataStmts5 = getMetadataFileStmts((XURI) xDMA2,
+ fooBarPath);
+ XURI xFoobar5 = URI.createNS(xContext, xDMA2.getStringValue(),
+ fooBarPath);
+ Statement xFoobar_FooBarFoo5 =
+ new Statement(foo, bar, foo, xFoobar5);
+ xStmtsEnum = xRep.getStatements(null, null, null);
+ XEnumeration xStmtsEnum2 = xRep2.getStatements(null, null, null);
+ assure("load: repository differs",
+ eq(xStmtsEnum2, merge(manifestStmts5, merge(metadataStmts5,
+ new Statement[] { xFoobar_FooBarFoo5 }))));
+
+ log.println("...done");
+
+ } catch (Exception e) {
+ report(e);
+ } finally {
+ close(xComp);
+ close(xComp2);
+ }
+ }
+
+ public void checkRDFa()
+ {
+ XComponent xComp = null;
+ String file;
+ try {
+ file = util.utils.getFullTestURL("TESTRDFA.odt");
+ xComp = loadRDFa(file);
+ if (xComp != null)
+ {
+ file = tempDir + "TESTRDFA.odt";
+ storeRDFa(xComp, file);
+ close(xComp);
+ xComp = loadRDFa(file);
+ }
+ } finally {
+ close(xComp);
+ }
+ }
+
+ public void storeRDFa(XComponent xComp, String file)
+ {
+ try {
+
+ log.println("Storing test document...");
+
+ XStorable xStor = (XStorable) UnoRuntime.queryInterface(
+ XStorable.class, xComp);
+
+ xStor.storeToURL(file, new PropertyValue[0]);
+
+ log.println("...done");
+
+ } catch (Exception e) {
+ report(e);
+ }
+ }
+
+ public XComponent loadRDFa(String file)
+ {
+ XComponent xComp = null;
+ try {
+
+ log.println("Loading test document...");
+
+ PropertyValue[] loadProps = new PropertyValue[1];
+ loadProps[0] = new PropertyValue();
+ loadProps[0].Name = "Hidden";
+ loadProps[0].Value = new Boolean(true);
+
+
+
+ xComp = util.DesktopTools.loadDoc(xMSF, file, loadProps);
+
+ XRepositorySupplier xRS = (XRepositorySupplier)
+ UnoRuntime.queryInterface(XRepositorySupplier.class, xComp);
+ assure("xRS null", null != xRS);
+
+ XDocumentRepository xRep = (XDocumentRepository)
+ UnoRuntime.queryInterface(XDocumentRepository.class,
+ xRS.getRDFRepository());
+ assure("xRep null", null != xRep);
+
+ XTextDocument xTextDoc = (XTextDocument)
+ UnoRuntime.queryInterface(XTextDocument.class, xComp);
+
+ XText xText = xTextDoc.getText();
+
+ XEnumerationAccess xEA = (XEnumerationAccess)
+ UnoRuntime.queryInterface(XEnumerationAccess.class, xText);
+ XEnumeration xEnum = xEA.createEnumeration();
+
+ log.println("...done");
+
+ log.println("Checking RDFa in loaded test document...");
+
+ XMetadatable xPara;
+ Statement[] stmts;
+
+ Statement x_FooBarLit1 = new Statement(foo, bar, mkLit("1"), null);
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 1",
+ eq(stmts, new Statement[] {
+ x_FooBarLit1
+ }));
+
+ Statement x_FooBarLit2 = new Statement(foo, bar, mkLit("2"), null);
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 2",
+ eq(stmts, new Statement[] {
+ x_FooBarLit2
+ }));
+
+ Statement x_BlankBarLit3 =
+ new Statement(blank1, bar, mkLit("3"), null);
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 3",
+ eq(stmts, new Statement[] {
+ x_BlankBarLit3
+ }));
+ XBlankNode b3 = (XBlankNode) UnoRuntime.queryInterface(
+ XBlankNode.class, stmts[0].Subject);
+
+ Statement x_BlankBarLit4 =
+ new Statement(blank2, bar, mkLit("4"), null);
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 4",
+ eq(stmts, new Statement[] {
+ x_BlankBarLit4
+ }));
+ XBlankNode b4 = (XBlankNode) UnoRuntime.queryInterface(
+ XBlankNode.class, stmts[0].Subject);
+
+ Statement x_BlankBarLit5 =
+ new Statement(blank1, bar, mkLit("5"), null);
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 5",
+ eq(stmts, new Statement[] {
+ x_BlankBarLit5
+ }));
+ XBlankNode b5 = (XBlankNode) UnoRuntime.queryInterface(
+ XBlankNode.class, stmts[0].Subject);
+
+ assure("RDFa: 3 != 4",
+ !b3.getStringValue().equals(b4.getStringValue()));
+ assure("RDFa: 3 == 5",
+ b3.getStringValue().equals(b5.getStringValue()));
+
+ Statement x_FooBarLit6 = new Statement(foo, bar, mkLit("6"), null);
+ Statement x_FooBazLit6 = new Statement(foo, baz, mkLit("6"), null);
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 6",
+ eq(stmts, new Statement[] {
+ x_FooBarLit6, x_FooBazLit6
+ }));
+
+ Statement x_FooBarLit7 = new Statement(foo, bar, mkLit("7"), null);
+ Statement x_FooBazLit7 = new Statement(foo, baz, mkLit("7"), null);
+ Statement x_FooFooLit7 = new Statement(foo, foo, mkLit("7"), null);
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 7",
+ eq(stmts, new Statement[] {
+ x_FooBarLit7, x_FooBazLit7, x_FooFooLit7
+ }));
+
+ XNode lit = mkLit("a fooish bar");
+ XNode lit_type= mkLit("a fooish bar", bar);
+ Statement x_FooBarLit = new Statement(foo, bar, lit, null);
+ Statement x_FooBarLittype = new Statement(foo, bar, lit_type, null);
+
+ Statement x_FooLabelLit8 =
+ new Statement(foo, rdfs_label, mkLit("8"), null);
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 8",
+ eq(stmts, new Statement[] {
+ x_FooBarLit, x_FooLabelLit8
+ }));
+
+ Statement x_FooLabelLit9 =
+ new Statement(foo, rdfs_label, mkLit("9"), null);
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 9",
+ eq(stmts, new Statement[] {
+ x_FooBarLit, x_FooLabelLit9
+ }));
+
+ Statement x_FooLabelLit10 =
+ new Statement(foo, rdfs_label, mkLit("10"), null);
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 10",
+ eq(stmts, new Statement[] {
+ x_FooBarLittype, x_FooLabelLit10
+ }));
+
+ Statement x_FooBarLit11
+ = new Statement(foo, bar, mkLit("11", bar), null);
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 11",
+ eq(stmts, new Statement[] {
+ x_FooBarLit11
+ }));
+
+ XURI xFile = URI.createNS(xContext, file, "/" + contentPath);
+ Statement x_FileBarLit12 =
+ new Statement(xFile, bar, mkLit("12"), null);
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 12",
+ eq(stmts, new Statement[] {
+ x_FileBarLit12
+ }));
+
+ Statement x_FooLabelLit13 =
+ new Statement(foo, rdfs_label, mkLit("13"), null);
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 13",
+ eq(stmts, new Statement[] {
+ x_FooBarLit, x_FooLabelLit13
+ }));
+
+ Statement x_FooLabelLit14 =
+ new Statement(foo, rdfs_label, mkLit("14"), null);
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 14",
+ eq(stmts, new Statement[] {
+ x_FooBarLit, x_FooLabelLit14
+ }));
+
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 15", eq(stmts, new Statement[] { } ));
+
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 16", eq(stmts, new Statement[] { } ));
+
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 17", eq(stmts, new Statement[] { } ));
+
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 18", eq(stmts, new Statement[] { } ));
+
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 19", eq(stmts, new Statement[] { } ));
+
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 20", eq(stmts, new Statement[] { } ));
+
+ xPara = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xEnum.nextElement());
+ stmts = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 21", eq(stmts, new Statement[] { } ));
+
+ log.println("...done");
+
+ } catch (Exception e) {
+ report(e);
+ close(xComp);
+ }
+ return xComp;
+ }
+
+
+// utilities -------------------------------------------------------------
+
+ public void report2(Exception e)
+ {
+ if (e instanceof WrappedTargetException)
+ {
+ log.println("Cause:");
+ Exception cause = (Exception)
+ (((WrappedTargetException)e).TargetException);
+ log.println(cause.toString());
+ report2(cause);
+ } else if (e instanceof WrappedTargetRuntimeException) {
+ log.println("Cause:");
+ Exception cause = (Exception)
+ (((WrappedTargetRuntimeException)e).TargetException);
+ log.println(cause.toString());
+ report2(cause);
+ }
+ }
+
+ public void report(Exception e) {
+ log.println("Exception occurred:");
+ e.printStackTrace((java.io.PrintWriter) log);
+ report2(e);
+ failed();
+ }
+
+ static void close(XComponent i_comp)
+ {
+ try {
+ XCloseable xClos = (XCloseable) UnoRuntime.queryInterface(
+ XCloseable.class, i_comp);
+ if (xClos != null) xClos.close(true);
+ } catch (Exception e) {
+ }
+ }
+
+ XLiteral mkLit(String i_content)
+ {
+ return Literal.create(xContext, i_content);
+ }
+
+ XLiteral mkLit(String i_content, XURI i_uri)
+ {
+ return Literal.createWithType(xContext, i_content, i_uri);
+ }
+
+ static Statement[] merge(Statement[] i_A1, Statement[] i_A2)
+ {
+ // bah, java sucks...
+ Statement[] ret = new Statement[i_A1.length + i_A2.length];
+ for (int i = 0; i < i_A1.length; ++i) {
+ ret[i] = i_A1[i];
+ }
+ for (int i = 0; i < i_A2.length; ++i) {
+ ret[i+i_A1.length] = i_A2[i];
+ }
+ return ret;
+ }
+
+ public static String toS(XNode n) {
+ if (null == n) return "< null >";
+ return n.getStringValue();
+ }
+
+ static boolean isBlank(XNode i_node)
+ {
+ XBlankNode blank = (XBlankNode) UnoRuntime.queryInterface(
+ XBlankNode.class, i_node);
+ return blank != null;
+ }
+
+/*
+ static class Statement implements XStatement
+ {
+ XResource m_Subject;
+ XResource m_Predicate;
+ XNode m_Object;
+ XURI m_Graph;
+
+ Statement(XResource i_Subject, XResource i_Predicate, XNode i_Object,
+ XURI i_Graph)
+ {
+ m_Subject = i_Subject;
+ m_Predicate = i_Predicate;
+ m_Object = i_Object;
+ m_Graph = i_Graph;
+ }
+
+ public XResource getSubject() { return m_Subject; }
+ public XResource getPredicate() { return m_Predicate; }
+ public XNode getObject() { return m_Object; }
+ public XURI getGraph() { return m_Graph; }
+ }
+*/
+
+ static Statement[] toSeq(XEnumeration i_Enum) throws Exception
+ {
+ java.util.Collection c = new java.util.Vector();
+ while (i_Enum.hasMoreElements()) {
+ Statement s = (Statement) i_Enum.nextElement();
+//log.println("toSeq: " + s.getSubject().getStringValue() + " " + s.getPredicate().getStringValue() + " " + s.getObject().getStringValue() + ".");
+ c.add(s);
+ }
+// return (Statement[]) c.toArray();
+ // java sucks
+ Object[] arr = c.toArray();
+ Statement[] ret = new Statement[arr.length];
+ for (int i = 0; i < arr.length; ++i) {
+ ret[i] = (Statement) arr[i];
+ }
+ return ret;
+ }
+
+ static XNode[][] toSeqs(XEnumeration i_Enum) throws Exception
+ {
+ java.util.Collection c = new java.util.Vector();
+ while (i_Enum.hasMoreElements()) {
+ XNode[] s = (XNode[]) i_Enum.nextElement();
+ c.add(s);
+ }
+// return (XNode[][]) c.toArray();
+ Object[] arr = c.toArray();
+ XNode[][] ret = new XNode[arr.length][];
+ for (int i = 0; i < arr.length; ++i) {
+ ret[i] = (XNode[]) arr[i];
+ }
+ return ret;
+ }
+
+ static class BindingComp implements java.util.Comparator
+ {
+ public int compare(Object i_Left, Object i_Right)
+ {
+ XNode[] left = (XNode[]) i_Left;
+ XNode[] right = (XNode[]) i_Right;
+ if (left.length != right.length) throw new RuntimeException();
+ for (int i = 0; i < left.length; ++i) {
+ int eq = (left[i].getStringValue().compareTo(
+ right[i].getStringValue()));
+ if (eq != 0) return eq;
+ }
+ return 0;
+ }
+ }
+
+ static class StmtComp implements java.util.Comparator
+ {
+ public int compare(Object i_Left, Object i_Right)
+ {
+ int eq;
+ Statement left = (Statement) i_Left;
+ Statement right = (Statement) i_Right;
+ if ((eq = cmp(left.Graph, right.Graph )) != 0) return eq;
+ if ((eq = cmp(left.Subject, right.Subject )) != 0) return eq;
+ if ((eq = cmp(left.Predicate, right.Predicate)) != 0) return eq;
+ if ((eq = cmp(left.Object, right.Object )) != 0) return eq;
+ return 0;
+ }
+
+ public int cmp(XNode i_Left, XNode i_Right)
+ {
+ if (isBlank(i_Left)) {
+ return isBlank(i_Right) ? 0 : 1;
+ } else {
+ if (isBlank(i_Right)) {
+ return -1;
+ } else {
+ return toS(i_Left).compareTo(toS(i_Right));
+ }
+ }
+ }
+ }
+
+ static boolean eq(Statement i_Left, Statement i_Right)
+ {
+ XURI lG = i_Left.Graph;
+ XURI rG = i_Right.Graph;
+ if (!eq(lG, rG)) {
+ log.println("Graphs differ: " + toS(lG) + " != " + toS(rG));
+ return false;
+ }
+ if (!eq(i_Left.Subject, i_Right.Subject)) {
+ log.println("Subjects differ: " +
+ i_Left.Subject.getStringValue() + " != " +
+ i_Right.Subject.getStringValue());
+ return false;
+ }
+ if (!eq(i_Left.Predicate, i_Right.Predicate)) {
+ log.println("Predicates differ: " +
+ i_Left.Predicate.getStringValue() + " != " +
+ i_Right.Predicate.getStringValue());
+ return false;
+ }
+ if (!eq(i_Left.Object, i_Right.Object)) {
+ log.println("Objects differ: " +
+ i_Left.Object.getStringValue() + " != " +
+ i_Right.Object.getStringValue());
+ return false;
+ }
+ return true;
+ }
+
+ static boolean eq(Statement[] i_Result, Statement[] i_Expected)
+ {
+ if (i_Result.length != i_Expected.length) {
+ log.println("eq: different lengths: " + i_Result.length + " " +
+ i_Expected.length);
+ return false;
+ }
+ Statement[] expected = (Statement[])
+ java.util.Arrays.asList(i_Expected).toArray();
+ java.util.Arrays.sort(i_Result, new StmtComp());
+ java.util.Arrays.sort(expected, new StmtComp());
+ for (int i = 0; i < expected.length; ++i) {
+ if (!eq(i_Result[i], expected[i])) return false;
+ }
+ return true;
+ }
+
+ static boolean eq(XEnumeration i_Enum, Statement[] i_Expected)
+ throws Exception
+ {
+ Statement[] current = toSeq(i_Enum);
+ return eq(current, i_Expected);
+ }
+
+ static boolean eq(XNode i_Left, XNode i_Right)
+ {
+ if (i_Left == null) {
+ return (i_Right == null);
+ } else {
+ return (i_Right != null) &&
+ (i_Left.getStringValue().equals(i_Right.getStringValue())
+ // FIXME: hack: blank nodes considered equal
+ || (isBlank(i_Left) && isBlank(i_Right)));
+ }
+ }
+
+ static boolean eq(XQuerySelectResult i_Result,
+ String[] i_Vars, XNode[][] i_Bindings) throws Exception
+ {
+ String[] vars = (String[]) i_Result.getBindingNames();
+ XEnumeration iter = (XEnumeration) i_Result;
+ XNode[][] bindings = toSeqs(iter);
+ if (vars.length != i_Vars.length) {
+ log.println("var lengths differ");
+ return false;
+ }
+ if (bindings.length != i_Bindings.length) {
+ log.println("binding lengths differ: " + i_Bindings.length +
+ " vs " + bindings.length );
+ return false;
+ }
+ java.util.Arrays.sort(bindings, new BindingComp());
+ java.util.Arrays.sort(i_Bindings, new BindingComp());
+ for (int i = 0; i < i_Bindings.length; ++i) {
+ if (i_Bindings[i].length != i_Vars.length) {
+ log.println("TEST ERROR!");
+ throw new Exception();
+ }
+ if (bindings[i].length != i_Vars.length) {
+ log.println("binding length and var length differ");
+ return false;
+ }
+ for (int j = 0; j < i_Vars.length; ++j) {
+ if (!eq(bindings[i][j], i_Bindings[i][j])) {
+ log.println("bindings differ: " +
+ toS(bindings[i][j]) + " != " + toS(i_Bindings[i][j]));
+ return false;
+ }
+ }
+ }
+ for (int i = 0; i < i_Vars.length; ++i) {
+ if (!vars[i].equals(i_Vars[i])) {
+ log.println("variable names differ: " +
+ vars[i] + " != " + i_Vars[i]);
+ return false;
+ }
+ }
+ return true;
+ }
+
+ static boolean eq(StringPair i_Left, StringPair i_Right)
+ {
+ return ((i_Left.First).equals(i_Right.First)) &&
+ ((i_Left.Second).equals(i_Right.Second));
+ }
+
+ static String mkNamespace(String i_prefix, String i_namespace)
+ {
+ return "PREFIX " + i_prefix + ": <" + i_namespace + ">\n";
+ }
+
+ static String mkNss()
+ {
+ String namespaces = mkNamespace("rdf",
+ "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
+ namespaces += mkNamespace("pkg",
+ "http://docs.oasis-open.org/opendocument/meta/package/common#");
+ namespaces += mkNamespace("odf",
+ "http://docs.oasis-open.org/opendocument/meta/package/odf#");
+ return namespaces;
+ }
+
+ Statement[] getManifestStmts(XURI xBaseURI) throws Exception
+ {
+ XURI xManifest = URI.createNS(xContext, xBaseURI.getStringValue(),
+ manifestPath);
+ XURI xContent = URI.createNS(xContext, xBaseURI.getStringValue(),
+ contentPath);
+ XURI xStyles = URI.createNS(xContext, xBaseURI.getStringValue(),
+ stylesPath);
+ Statement xM_BaseTypeDoc =
+ new Statement(xBaseURI, rdf_type, pkg_Document, xManifest);
+ Statement xM_BaseHaspartContent =
+ new Statement(xBaseURI, pkg_hasPart, xContent, xManifest);
+ Statement xM_BaseHaspartStyles =
+ new Statement(xBaseURI, pkg_hasPart, xStyles, xManifest);
+ Statement xM_ContentTypeContent =
+ new Statement(xContent, rdf_type, odf_ContentFile, xManifest);
+ Statement xM_StylesTypeStyles =
+ new Statement(xStyles, rdf_type, odf_StylesFile, xManifest);
+ return new Statement[] {
+ xM_BaseTypeDoc, xM_BaseHaspartContent, xM_BaseHaspartStyles,
+ xM_ContentTypeContent, xM_StylesTypeStyles
+ };
+ }
+
+ Statement[] getMetadataFileStmts(XURI xBaseURI, String Path)
+ throws Exception
+ {
+ XURI xManifest = URI.createNS(xContext, xBaseURI.getStringValue(),
+ manifestPath);
+ XURI xGraph = URI.createNS(xContext, xBaseURI.getStringValue(), Path);
+ Statement xM_BaseHaspartGraph =
+ new Statement(xBaseURI, pkg_hasPart, xGraph, xManifest);
+ Statement xM_GraphTypeMetadata =
+ new Statement(xGraph, rdf_type, pkg_MetadataFile, xManifest);
+ return new Statement[] { xM_BaseHaspartGraph, xM_GraphTypeMetadata };
+ }
+
+ class TestRange implements XTextRange, XMetadatable, XServiceInfo
+ {
+ String m_Stream;
+ String m_XmlId;
+ String m_Text;
+ TestRange(String i_Str) { m_Text = i_Str; }
+
+ public String getStringValue() { return ""; }
+ public String getNamespace() { return ""; }
+ public String getLocalName() { return ""; }
+
+ public StringPair getMetadataReference()
+ { return new StringPair(m_Stream, m_XmlId); }
+ public void setMetadataReference(StringPair i_Ref)
+ throws IllegalArgumentException
+ { m_Stream = (String)i_Ref.First; m_XmlId = (String)i_Ref.Second; }
+ public void ensureMetadataReference()
+ { m_Stream = "content.xml"; m_XmlId = "42"; }
+
+ public String getImplementationName() { return null; }
+ public String[] getSupportedServiceNames() { return null; }
+ public boolean supportsService(String i_Svc)
+ { return i_Svc.equals("com.sun.star.text.Paragraph"); }
+
+ public XText getText() { return null; }
+ public XTextRange getStart() { return null; }
+ public XTextRange getEnd() { return null; }
+ public String getString() { return m_Text; }
+ public void setString(String i_Str) { m_Text = i_Str; }
+ }
+}
+
diff --git a/sfx2/qa/complex/makefile.mk b/sfx2/qa/complex/makefile.mk
index 102c641f27..5c0006df9e 100644
--- a/sfx2/qa/complex/makefile.mk
+++ b/sfx2/qa/complex/makefile.mk
@@ -42,7 +42,9 @@ PACKAGE = complex$/framework
JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar
JAVAFILES = CheckGlobalEventBroadcaster_writer1.java \
- DocumentMetaData.java
+ DocumentMetaData.java \
+ DocumentMetadataAccessTest.java
+
JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
SUBDIRS = DocHelper
diff --git a/sfx2/qa/complex/testdocuments/TESTRDFA.odt b/sfx2/qa/complex/testdocuments/TESTRDFA.odt
new file mode 100644
index 0000000000..d59739142d
--- /dev/null
+++ b/sfx2/qa/complex/testdocuments/TESTRDFA.odt
Binary files differ
diff --git a/sfx2/qa/complex/tests.sce b/sfx2/qa/complex/tests.sce
index e95f6db884..c38852927e 100644
--- a/sfx2/qa/complex/tests.sce
+++ b/sfx2/qa/complex/tests.sce
@@ -1,2 +1,3 @@
-o complex.framework.DocumentMetaData
+-o complex.framework.DocumentMetadataAccessTest
#-o complex.framework.CheckGlobalEventBroadcaster_writer1