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
This commit is contained in:
parent
ed40eba10e
commit
4afc9f7fa4
3 changed files with 848 additions and 169 deletions
|
@ -37,10 +37,14 @@ import com.sun.star.uno.XComponentContext;
|
|||
import com.sun.star.uno.Any;
|
||||
import com.sun.star.lang.XMultiServiceFactory;
|
||||
import com.sun.star.lang.XInitialization;
|
||||
import com.sun.star.lang.XEventListener;
|
||||
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.Pair;
|
||||
import com.sun.star.beans.StringPair;
|
||||
import com.sun.star.container.XEnumeration;
|
||||
import com.sun.star.container.ElementExistException;
|
||||
import com.sun.star.container.NoSuchElementException;
|
||||
|
@ -421,7 +425,7 @@ public class RDFRepositoryTest extends ComplexTestCase
|
|||
+ " pkg:idref ?idref . "
|
||||
+ " FILTER (?type = odf:ContentFile || ?type = odf:StylesFile)"
|
||||
+ " }";
|
||||
log.println(query);
|
||||
//log.println(query);
|
||||
result = xRep.querySelect(mkNss() + query);
|
||||
assure("query: example-element-2\n" + query,
|
||||
eq(result, new String[] { "path", "idref" },
|
||||
|
@ -456,13 +460,21 @@ log.println(query);
|
|||
|
||||
String content = "behold, for i am the content.";
|
||||
XTextRange xTR = new TestRange(content);
|
||||
XMetadatable xM = (XMetadatable) xTR;
|
||||
|
||||
Statement[] result = xRep.getStatementRDFa((XMetadatable)xTR);
|
||||
assure("RDFa: get: not empty (initial)",
|
||||
0 == result.length);
|
||||
|
||||
try {
|
||||
xRep.setStatementRDFa(foo, bar, null, "", null);
|
||||
xRep.setStatementRDFa(foo, new XURI[] {}, xM, "", null);
|
||||
assure("RDFa: set: no predicate", false);
|
||||
} catch (IllegalArgumentException e) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
try {
|
||||
xRep.setStatementRDFa(foo, new XURI[] {bar}, null, "", null);
|
||||
assure("RDFa: set: null", false);
|
||||
} catch (IllegalArgumentException e) {
|
||||
// ignore
|
||||
|
@ -470,7 +482,7 @@ log.println(query);
|
|||
|
||||
XLiteral trlit = Literal.create(xContext, content);
|
||||
Statement x_FooBarTRLit = new Statement(foo, bar, trlit, null);
|
||||
xRep.setStatementRDFa(foo, bar, xTR, "", null);
|
||||
xRep.setStatementRDFa(foo, new XURI[] { bar }, xM, "", null);
|
||||
|
||||
result = xRep.getStatementRDFa((XMetadatable)xTR);
|
||||
assure("RDFa: get: without content",
|
||||
|
@ -487,12 +499,12 @@ log.println(query);
|
|||
|
||||
Statement x_FooBarLittype = new Statement(foo, bar, littype, null);
|
||||
Statement x_FooLabelLit = new Statement(foo, rdfslabel, lit, null);
|
||||
xRep.setStatementRDFa(foo, bar, xTR, "42", uint);
|
||||
xRep.setStatementRDFa(foo, new XURI[] { bar }, xM, "42", uint);
|
||||
|
||||
result = xRep.getStatementRDFa((XMetadatable)xTR);
|
||||
assure("RDFa: get: with content",
|
||||
2 == result.length && eq((Statement)result[0], x_FooBarLittype)
|
||||
&& eq((Statement)result[1], x_FooLabelLit));
|
||||
2 == result.length && eq((Statement)result[0], x_FooLabelLit)
|
||||
&& eq((Statement)result[1], x_FooBarLittype));
|
||||
|
||||
//FIXME: do this?
|
||||
xTR.setString(content);
|
||||
|
@ -504,19 +516,23 @@ log.println(query);
|
|||
eq((Statement)result.Second, xFooLabelTRLit));
|
||||
*/
|
||||
|
||||
xRep.removeStatementRDFa(xTR);
|
||||
xRep.removeStatementRDFa((XMetadatable)xTR);
|
||||
|
||||
result = xRep.getStatementRDFa((XMetadatable)xTR);
|
||||
assure("RDFa: get: not empty (removed)",
|
||||
0 == result.length);
|
||||
|
||||
xRep.setStatementRDFa(foo, bar, xTR, "", null);
|
||||
xRep.setStatementRDFa(foo, new XURI[] { foo, bar, baz }, xM,
|
||||
"", null);
|
||||
|
||||
Statement x_FooFooTRLit = new Statement(foo, foo, trlit, null);
|
||||
Statement x_FooBazTRLit = new Statement(foo, baz, trlit, null);
|
||||
result = xRep.getStatementRDFa((XMetadatable) xTR);
|
||||
assure("RDFa: get: without content (reinsert)",
|
||||
1 == result.length && eq((Statement)result[0], x_FooBarTRLit));
|
||||
assure("RDFa: get: without content (multiple predicates, reinsert)",
|
||||
eq(result, new Statement[] {
|
||||
x_FooFooTRLit, x_FooBarTRLit, x_FooBazTRLit }));
|
||||
|
||||
xRep.removeStatementRDFa(xTR);
|
||||
xRep.removeStatementRDFa((XMetadatable)xTR);
|
||||
|
||||
result = xRep.getStatementRDFa((XMetadatable) xTR);
|
||||
assure("RDFa: get: not empty (re-removed)",
|
||||
|
@ -531,9 +547,28 @@ log.println(query);
|
|||
|
||||
// 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();
|
||||
}
|
||||
|
||||
|
@ -680,19 +715,28 @@ log.println(query);
|
|||
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);
|
||||
if (current.length != i_Expected.length) {
|
||||
return false;
|
||||
}
|
||||
java.util.Arrays.sort(current, new StmtComp());
|
||||
java.util.Arrays.sort(i_Expected, new StmtComp());
|
||||
for (int i = 0; i < i_Expected.length; ++i) {
|
||||
if (!eq(i_Expected[i], current[i])) return false;
|
||||
}
|
||||
return true;
|
||||
return eq(current, i_Expected);
|
||||
}
|
||||
|
||||
static boolean eq(XNode i_Left, XNode i_Right)
|
||||
|
@ -767,24 +811,35 @@ log.println(query);
|
|||
return namespaces;
|
||||
}
|
||||
|
||||
class TestRange implements XTextRange, XMetadatable
|
||||
class TestRange implements XTextRange, XMetadatable, XServiceInfo
|
||||
{
|
||||
String m_Stream;
|
||||
String m_XmlId;
|
||||
String m_Text;
|
||||
String m_ID;
|
||||
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; }
|
||||
|
||||
public String getStringValue() { return m_ID; }
|
||||
|
||||
public String getXmlId() { return m_ID; }
|
||||
public void setXmlId(String i_ID) throws IllegalArgumentException
|
||||
{ m_ID = i_ID; }
|
||||
public void ensureXmlId() { m_ID = "content.xml#42"; }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -113,9 +113,9 @@ const char s_nsRDF [] = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
|
|||
const char s_nsRDFs [] = "http://www.w3.org/2000/01/rdf-schema#";
|
||||
const char s_nsOWL [] = "http://www.w3.org/2002/07/owl#";
|
||||
const char s_nsPkg [] =
|
||||
"http://docs.oasis-open.org/opendocument/meta/package/common#";
|
||||
"http://docs.oasis-open.org/ns/office/1.2/meta/pkg#";
|
||||
const char s_nsODF [] =
|
||||
"http://docs.oasis-open.org/opendocument/meta/package/odf#";
|
||||
"http://docs.oasis-open.org/ns/office/1.2/meta/odf#";
|
||||
|
||||
void SAL_CALL CURI::initFromConstant(const sal_Int16 i_Constant)
|
||||
{
|
||||
|
@ -133,6 +133,216 @@ void SAL_CALL CURI::initFromConstant(const sal_Int16 i_Constant)
|
|||
ln = "string";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_NORMALIZEDSTRING:
|
||||
ns = s_nsXSD;
|
||||
ln = "normalizedString";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_BOOLEAN:
|
||||
ns = s_nsXSD;
|
||||
ln = "boolean";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_DECIMAL:
|
||||
ns = s_nsXSD;
|
||||
ln = "decimal";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_FLOAT:
|
||||
ns = s_nsXSD;
|
||||
ln = "float";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_DOUBLE:
|
||||
ns = s_nsXSD;
|
||||
ln = "double";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_INTEGER:
|
||||
ns = s_nsXSD;
|
||||
ln = "integer";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_NONNEGATIVEINTEGER:
|
||||
ns = s_nsXSD;
|
||||
ln = "nonNegativeInteger";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_POSITIVEINTEGER:
|
||||
ns = s_nsXSD;
|
||||
ln = "positiveInteger";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_NONPOSITIVEINTEGER:
|
||||
ns = s_nsXSD;
|
||||
ln = "nonPositiveInteger";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_NEGATIVEINTEGER:
|
||||
ns = s_nsXSD;
|
||||
ln = "negativeInteger";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_LONG:
|
||||
ns = s_nsXSD;
|
||||
ln = "long";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_INT:
|
||||
ns = s_nsXSD;
|
||||
ln = "int";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_SHORT:
|
||||
ns = s_nsXSD;
|
||||
ln = "short";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_BYTE:
|
||||
ns = s_nsXSD;
|
||||
ln = "byte";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_UNSIGNEDLONG:
|
||||
ns = s_nsXSD;
|
||||
ln = "unsignedLong";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_UNSIGNEDINT:
|
||||
ns = s_nsXSD;
|
||||
ln = "unsignedInt";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_UNSIGNEDSHORT:
|
||||
ns = s_nsXSD;
|
||||
ln = "unsignedShort";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_UNSIGNEDBYTE:
|
||||
ns = s_nsXSD;
|
||||
ln = "unsignedByte";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_HEXBINARY:
|
||||
ns = s_nsXSD;
|
||||
ln = "hexBinary";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_BASE64BINARY:
|
||||
ns = s_nsXSD;
|
||||
ln = "base64Binary";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_DATETIME:
|
||||
ns = s_nsXSD;
|
||||
ln = "dateTime";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_TIME:
|
||||
ns = s_nsXSD;
|
||||
ln = "time";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_DATE:
|
||||
ns = s_nsXSD;
|
||||
ln = "date";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_GYEARMONTH:
|
||||
ns = s_nsXSD;
|
||||
ln = "gYearMonth";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_GYEAR:
|
||||
ns = s_nsXSD;
|
||||
ln = "gYear";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_GMONTHDAY:
|
||||
ns = s_nsXSD;
|
||||
ln = "gMonthDay";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_GDAY:
|
||||
ns = s_nsXSD;
|
||||
ln = "gDay";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_GMONTH:
|
||||
ns = s_nsXSD;
|
||||
ln = "gMonth";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_ANYURI:
|
||||
ns = s_nsXSD;
|
||||
ln = "anyURI";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_TOKEN:
|
||||
ns = s_nsXSD;
|
||||
ln = "token";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_LANGUAGE:
|
||||
ns = s_nsXSD;
|
||||
ln = "language";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_NMTOKEN:
|
||||
ns = s_nsXSD;
|
||||
ln = "NMTOKEN";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_NAME:
|
||||
ns = s_nsXSD;
|
||||
ln = "Name";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_DURATION:
|
||||
ns = s_nsXSD;
|
||||
ln = "duration";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_QNAME:
|
||||
ns = s_nsXSD;
|
||||
ln = "QName";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_NOTATION:
|
||||
ns = s_nsXSD;
|
||||
ln = "NOTATION";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_NMTOKENS:
|
||||
ns = s_nsXSD;
|
||||
ln = "NMTOKENS";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_ID:
|
||||
ns = s_nsXSD;
|
||||
ln = "ID";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_IDREF:
|
||||
ns = s_nsXSD;
|
||||
ln = "IDREF";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_IDREFS:
|
||||
ns = s_nsXSD;
|
||||
ln = "IDREFS";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_ENTITY:
|
||||
ns = s_nsXSD;
|
||||
ln = "ENTITY";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::XSD_ENTITIES:
|
||||
ns = s_nsXSD;
|
||||
ln = "ENTITIES";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::RDF_TYPE:
|
||||
ns = s_nsRDF;
|
||||
ln = "type";
|
||||
|
@ -163,6 +373,56 @@ void SAL_CALL CURI::initFromConstant(const sal_Int16 i_Constant)
|
|||
ln = "Statement";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::RDF_VALUE:
|
||||
ns = s_nsRDF;
|
||||
ln = "value";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::RDF_FIRST:
|
||||
ns = s_nsRDF;
|
||||
ln = "first";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::RDF_REST:
|
||||
ns = s_nsRDF;
|
||||
ln = "rest";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::RDF_NIL:
|
||||
ns = s_nsRDF;
|
||||
ln = "nil";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::RDF_XMLLITERAL:
|
||||
ns = s_nsRDF;
|
||||
ln = "XMLLiteral";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::RDF_ALT:
|
||||
ns = s_nsRDF;
|
||||
ln = "Alt";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::RDF_BAG:
|
||||
ns = s_nsRDF;
|
||||
ln = "Bag";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::RDF_LIST:
|
||||
ns = s_nsRDF;
|
||||
ln = "List";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::RDF_SEQ:
|
||||
ns = s_nsRDF;
|
||||
ln = "Seq";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::RDF_1:
|
||||
ns = s_nsRDF;
|
||||
ln = "_1";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::RDFS_COMMENT:
|
||||
ns = s_nsRDFs;
|
||||
ln = "comment";
|
||||
|
@ -213,11 +473,198 @@ void SAL_CALL CURI::initFromConstant(const sal_Int16 i_Constant)
|
|||
ln = "FunctionalProperty";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::OWL_THING:
|
||||
ns = s_nsOWL;
|
||||
ln = "Thing";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::OWL_NOTHING:
|
||||
ns = s_nsOWL;
|
||||
ln = "Nothing";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::OWL_INDIVIDUAL:
|
||||
ns = s_nsOWL;
|
||||
ln = "Individual";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::OWL_EQUIVALENTCLASS:
|
||||
ns = s_nsOWL;
|
||||
ln = "equivalentClass";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::OWL_EQUIVALENTPROPERTY:
|
||||
ns = s_nsOWL;
|
||||
ln = "equivalentProperty";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::OWL_SAMEAS:
|
||||
ns = s_nsOWL;
|
||||
ln = "sameAs";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::OWL_DIFFERENTFROM:
|
||||
ns = s_nsOWL;
|
||||
ln = "differentFrom";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::OWL_ALLDIFFERENT:
|
||||
ns = s_nsOWL;
|
||||
ln = "AllDifferent";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::OWL_DISTINCTMEMBERS:
|
||||
ns = s_nsOWL;
|
||||
ln = "distinctMembers";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::OWL_INVERSEOF:
|
||||
ns = s_nsOWL;
|
||||
ln = "inverseOf";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::OWL_TRANSITIVEPROPERTY:
|
||||
ns = s_nsOWL;
|
||||
ln = "TransitiveProperty";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::OWL_SYMMETRICPROPERTY:
|
||||
ns = s_nsOWL;
|
||||
ln = "SymmetricProperty";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::OWL_INVERSEFUNCTIONALPROPERTY:
|
||||
ns = s_nsOWL;
|
||||
ln = "InverseFunctionalProperty";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::OWL_RESTRICTION:
|
||||
ns = s_nsOWL;
|
||||
ln = "Restriction";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::OWL_ONPROPERTY:
|
||||
ns = s_nsOWL;
|
||||
ln = "onProperty";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::OWL_ALLVALUESFROM:
|
||||
ns = s_nsOWL;
|
||||
ln = "allValuesFrom";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::OWL_SOMEVALUESFROM:
|
||||
ns = s_nsOWL;
|
||||
ln = "someValuesFrom";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::OWL_MINCARDINALITY:
|
||||
ns = s_nsOWL;
|
||||
ln = "minCardinality";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::OWL_MAXCARDINALITY:
|
||||
ns = s_nsOWL;
|
||||
ln = "maxCardinality";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::OWL_CARDINALITY:
|
||||
ns = s_nsOWL;
|
||||
ln = "cardinality";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::OWL_ONTOLOGY:
|
||||
ns = s_nsOWL;
|
||||
ln = "Ontology";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::OWL_IMPORTS:
|
||||
ns = s_nsOWL;
|
||||
ln = "imports";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::OWL_VERSIONINFO:
|
||||
ns = s_nsOWL;
|
||||
ln = "versionInfo";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::OWL_PRIORVERSION:
|
||||
ns = s_nsOWL;
|
||||
ln = "priorVersion";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::OWL_BACKWARDCOMPATIBLEWITH:
|
||||
ns = s_nsOWL;
|
||||
ln = "backwardCompatibleWith";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::OWL_INCOMPATIBLEWITH:
|
||||
ns = s_nsOWL;
|
||||
ln = "incompatibleWith";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::OWL_DEPRECATEDCLASS:
|
||||
ns = s_nsOWL;
|
||||
ln = "DeprecatedClass";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::OWL_DEPRECATEDPROPERTY:
|
||||
ns = s_nsOWL;
|
||||
ln = "DeprecatedProperty";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::OWL_ANNOTATIONPROPERTY:
|
||||
ns = s_nsOWL;
|
||||
ln = "AnnotationProperty";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::OWL_ONTOLOGYPROPERTY:
|
||||
ns = s_nsOWL;
|
||||
ln = "OntologyProperty";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::OWL_ONEOF:
|
||||
ns = s_nsOWL;
|
||||
ln = "oneOf";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::OWL_DATARANGE:
|
||||
ns = s_nsOWL;
|
||||
ln = "dataRange";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::OWL_DISJOINTWITH:
|
||||
ns = s_nsOWL;
|
||||
ln = "disjointWith";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::OWL_UNIONOF:
|
||||
ns = s_nsOWL;
|
||||
ln = "unionOf";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::OWL_COMPLEMENTOF:
|
||||
ns = s_nsOWL;
|
||||
ln = "complementOf";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::OWL_INTERSECTIONOF:
|
||||
ns = s_nsOWL;
|
||||
ln = "intersectionOf";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::OWL_HASVALUE:
|
||||
ns = s_nsOWL;
|
||||
ln = "hasValue";
|
||||
break;
|
||||
|
||||
|
||||
case css::rdf::URIs::PKG_HASPART:
|
||||
ns = s_nsPkg;
|
||||
ln = "hasPart";
|
||||
break;
|
||||
|
||||
/* REMOVED
|
||||
case css::rdf::URIs::PKG_IDREF:
|
||||
ns = s_nsPkg;
|
||||
ln = "idref";
|
||||
|
@ -227,6 +674,7 @@ void SAL_CALL CURI::initFromConstant(const sal_Int16 i_Constant)
|
|||
ns = s_nsPkg;
|
||||
ln = "path";
|
||||
break;
|
||||
*/
|
||||
|
||||
case css::rdf::URIs::PKG_MIMETYPE:
|
||||
ns = s_nsPkg;
|
||||
|
@ -248,6 +696,16 @@ void SAL_CALL CURI::initFromConstant(const sal_Int16 i_Constant)
|
|||
ln = "File";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::PKG_METADATAFILE:
|
||||
ns = s_nsPkg;
|
||||
ln = "MetadataFile";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::PKG_DOCUMENT:
|
||||
ns = s_nsPkg;
|
||||
ln = "Document";
|
||||
break;
|
||||
|
||||
case css::rdf::URIs::ODF_PREFIX:
|
||||
ns = s_nsODF;
|
||||
ln = "prefix";
|
||||
|
@ -273,10 +731,12 @@ void SAL_CALL CURI::initFromConstant(const sal_Int16 i_Constant)
|
|||
ln = "StylesFile";
|
||||
break;
|
||||
|
||||
/* REMOVED
|
||||
case css::rdf::URIs::ODF_METADATAFILE:
|
||||
ns = s_nsODF;
|
||||
ln = "MetadataFile";
|
||||
break;
|
||||
*/
|
||||
|
||||
default:
|
||||
throw css::lang::IllegalArgumentException(
|
||||
|
|
|
@ -30,12 +30,17 @@
|
|||
|
||||
#include "librdf_repository.hxx"
|
||||
|
||||
#include <comphelper/stlunosequence.hxx>
|
||||
#include <comphelper/sequenceasvector.hxx>
|
||||
#include <comphelper/makesequence.hxx>
|
||||
|
||||
#include <com/sun/star/lang/XServiceInfo.hpp>
|
||||
#include <com/sun/star/lang/XInitialization.hpp>
|
||||
#include "com/sun/star/rdf/XDocumentRepository.hpp"
|
||||
|
||||
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
|
||||
#include <com/sun/star/lang/IllegalArgumentException.hpp>
|
||||
#include <com/sun/star/io/XSeekableInputStream.hpp>
|
||||
#include <com/sun/star/text/XTextRange.hpp>
|
||||
#include "com/sun/star/rdf/XDocumentRepository.hpp"
|
||||
#include <com/sun/star/rdf/XLiteral.hpp>
|
||||
#include <com/sun/star/rdf/FileFormat.hpp>
|
||||
#include <com/sun/star/rdf/URIs.hpp>
|
||||
|
@ -43,15 +48,14 @@
|
|||
#include <com/sun/star/rdf/URI.hpp>
|
||||
#include <com/sun/star/rdf/Literal.hpp>
|
||||
|
||||
#include <rtl/ref.hxx>
|
||||
#include <rtl/ustring.hxx>
|
||||
#include <cppuhelper/implbase1.hxx>
|
||||
#include <cppuhelper/implbase3.hxx>
|
||||
#include <cppuhelper/basemutex.hxx>
|
||||
#include <comphelper/sequenceasvector.hxx>
|
||||
#include <comphelper/makesequence.hxx>
|
||||
#include <rtl/ref.hxx>
|
||||
#include <rtl/ustring.hxx>
|
||||
|
||||
#include <librdf.h>
|
||||
|
||||
#include <boost/utility.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/shared_array.hpp>
|
||||
|
@ -60,6 +64,7 @@
|
|||
#include <map>
|
||||
#include <functional>
|
||||
#include <algorithm>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
||||
|
@ -92,7 +97,7 @@ typedef std::map< ::rtl::OUString, ::rtl::Reference<librdf_NamedGraph> >
|
|||
const char s_sparql [] = "sparql";
|
||||
const char s_nsRDFs [] = "http://www.w3.org/2000/01/rdf-schema#";
|
||||
const char s_label [] = "label";
|
||||
const char s_nsOOo [] = "ooo:internal:implementation-detail:"; // FIXME!!!
|
||||
const char s_nsOOo [] = "http://openoffice.org/2004/office/rdfa/";
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -195,7 +200,9 @@ public:
|
|||
librdf_TypeConverter(
|
||||
uno::Reference< uno::XComponentContext > const & i_xContext,
|
||||
librdf_Repository &i_rRep)
|
||||
: m_xContext(i_xContext), m_rRep(i_rRep) { };
|
||||
: m_xContext(i_xContext)
|
||||
, m_rRep(i_rRep)
|
||||
{ };
|
||||
|
||||
librdf_world *createWorld() const;
|
||||
librdf_storage *createStorage(librdf_world *i_pWorld) const;
|
||||
|
@ -209,7 +216,7 @@ public:
|
|||
const uno::Reference< rdf::XNode > & i_xNode) const;
|
||||
librdf_statement* mkStatement( librdf_world* i_pWorld,
|
||||
const uno::Reference< rdf::XResource > & i_xSubject,
|
||||
const uno::Reference< rdf::XResource > & i_xPredicate,
|
||||
const uno::Reference< rdf::XURI > & i_xPredicate,
|
||||
const uno::Reference< rdf::XNode > & i_xObject) const;
|
||||
uno::Reference<rdf::XURI> convertToXURI(librdf_uri* i_pURI) const;
|
||||
uno::Reference<rdf::XURI> convertToXURI(librdf_node* i_pURI) const;
|
||||
|
@ -222,7 +229,7 @@ public:
|
|||
rdf::Statement
|
||||
convertToStatement(librdf_statement* i_pStmt, librdf_node* i_pContext)
|
||||
const;
|
||||
uno::Reference<rdf::XResource> getRDFsLabel() const;
|
||||
uno::Reference<rdf::XURI> getRDFsLabel() const;
|
||||
|
||||
private:
|
||||
uno::Reference< uno::XComponentContext > m_xContext;
|
||||
|
@ -236,7 +243,7 @@ private:
|
|||
*/
|
||||
class librdf_Repository:
|
||||
private boost::noncopyable,
|
||||
private ::cppu::BaseMutex,
|
||||
// private ::cppu::BaseMutex,
|
||||
public ::cppu::WeakImplHelper3<
|
||||
lang::XServiceInfo,
|
||||
rdf::XDocumentRepository,
|
||||
|
@ -246,7 +253,7 @@ public:
|
|||
|
||||
explicit librdf_Repository(
|
||||
uno::Reference< uno::XComponentContext > const & i_xContext);
|
||||
virtual ~librdf_Repository() {}
|
||||
virtual ~librdf_Repository();
|
||||
|
||||
// ::com::sun::star::lang::XServiceInfo:
|
||||
virtual ::rtl::OUString SAL_CALL getImplementationName()
|
||||
|
@ -292,7 +299,7 @@ public:
|
|||
container::NoSuchElementException, rdf::RepositoryException);
|
||||
virtual uno::Reference< container::XEnumeration > SAL_CALL getStatements(
|
||||
const uno::Reference< rdf::XResource > & i_xSubject,
|
||||
const uno::Reference< rdf::XResource > & i_xPredicate,
|
||||
const uno::Reference< rdf::XURI > & i_xPredicate,
|
||||
const uno::Reference< rdf::XNode > & i_xObject)
|
||||
throw (uno::RuntimeException,
|
||||
rdf::RepositoryException);
|
||||
|
@ -310,15 +317,15 @@ public:
|
|||
|
||||
// ::com::sun::star::rdf::XDocumentRepository:
|
||||
virtual void SAL_CALL setStatementRDFa(
|
||||
const uno::Reference< rdf::XURI > & i_xSubject,
|
||||
const uno::Reference< rdf::XURI > & i_xPredicate,
|
||||
const uno::Reference< text::XTextRange > & i_xObject,
|
||||
const uno::Reference< rdf::XResource > & i_xSubject,
|
||||
const uno::Sequence< uno::Reference< rdf::XURI > > & i_rPredicates,
|
||||
const uno::Reference< rdf::XMetadatable > & i_xObject,
|
||||
const ::rtl::OUString & i_rRDFaContent,
|
||||
const uno::Reference< rdf::XURI > & i_xRDFaDatatype)
|
||||
throw (uno::RuntimeException, lang::IllegalArgumentException,
|
||||
rdf::RepositoryException);
|
||||
virtual void SAL_CALL removeStatementRDFa(
|
||||
const uno::Reference< text::XTextRange > & i_xObject)
|
||||
const uno::Reference< rdf::XMetadatable > & i_xElement)
|
||||
throw (uno::RuntimeException, lang::IllegalArgumentException,
|
||||
rdf::RepositoryException);
|
||||
virtual uno::Sequence<rdf::Statement> SAL_CALL getStatementRDFa(
|
||||
|
@ -328,7 +335,7 @@ public:
|
|||
virtual uno::Reference< container::XEnumeration > SAL_CALL
|
||||
getStatementsRDFa(
|
||||
const uno::Reference< rdf::XResource > & i_xSubject,
|
||||
const uno::Reference< rdf::XResource > & i_xPredicate,
|
||||
const uno::Reference< rdf::XURI > & i_xPredicate,
|
||||
const uno::Reference< rdf::XNode > & i_xObject)
|
||||
throw (uno::RuntimeException,
|
||||
rdf::RepositoryException);
|
||||
|
@ -344,7 +351,7 @@ public:
|
|||
bool i_Internal = false );
|
||||
void SAL_CALL addStatementGraph(
|
||||
const uno::Reference< rdf::XResource > & i_xSubject,
|
||||
const uno::Reference< rdf::XResource > & i_xPredicate,
|
||||
const uno::Reference< rdf::XURI > & i_xPredicate,
|
||||
const uno::Reference< rdf::XNode > & i_xObject,
|
||||
const uno::Reference< rdf::XURI > & i_xName,
|
||||
bool i_Internal = false );
|
||||
|
@ -352,14 +359,14 @@ public:
|
|||
// container::NoSuchElementException, rdf::RepositoryException);
|
||||
void SAL_CALL removeStatementsGraph(
|
||||
const uno::Reference< rdf::XResource > & i_xSubject,
|
||||
const uno::Reference< rdf::XResource > & i_xPredicate,
|
||||
const uno::Reference< rdf::XURI > & i_xPredicate,
|
||||
const uno::Reference< rdf::XNode > & i_xObject,
|
||||
const uno::Reference< rdf::XURI > & i_xName );
|
||||
// throw (uno::RuntimeException, lang::IllegalArgumentException,
|
||||
// container::NoSuchElementException, rdf::RepositoryException);
|
||||
uno::Reference< container::XEnumeration > SAL_CALL getStatementsGraph(
|
||||
const uno::Reference< rdf::XResource > & i_xSubject,
|
||||
const uno::Reference< rdf::XResource > & i_xPredicate,
|
||||
const uno::Reference< rdf::XURI > & i_xPredicate,
|
||||
const uno::Reference< rdf::XNode > & i_xObject,
|
||||
const uno::Reference< rdf::XURI > & i_xName,
|
||||
bool i_Internal = false );
|
||||
|
@ -372,9 +379,24 @@ private:
|
|||
|
||||
uno::Reference< uno::XComponentContext > m_xContext;
|
||||
|
||||
/// librdf global data
|
||||
/** N.B.: The redland documentation gives the impression that you can have
|
||||
as many librdf_worlds as you like. This is true in the same sense
|
||||
that you can physically be in as many places as you like.
|
||||
Well, you can, just not at the same time.
|
||||
The ugly truth is that destroying a librdf_world kills a bunch
|
||||
of static variables; other librdf_worlds become very unhappy
|
||||
when they access these.
|
||||
And of course this is not documented anywhere that I could find.
|
||||
So we allocate a single world, and refcount that.
|
||||
*/
|
||||
static boost::shared_ptr<librdf_world> m_pWorld;
|
||||
/// refcount
|
||||
static sal_uInt32 m_NumInstances;
|
||||
/// mutex for m_pWorld - redland is not as threadsafe as is often claimed
|
||||
static osl::Mutex m_aMutex;
|
||||
|
||||
// NB: sequence of the shared pointers is important!
|
||||
/// librdf global data -- FIXME: static???
|
||||
boost::shared_ptr<librdf_world> m_pWorld;
|
||||
/// librdf repository storage
|
||||
boost::shared_ptr<librdf_storage> m_pStorage;
|
||||
/// librdf repository model
|
||||
|
@ -405,9 +427,12 @@ public:
|
|||
boost::shared_ptr<librdf_stream> const& i_pStream,
|
||||
boost::shared_ptr<librdf_query> const& i_pQuery =
|
||||
boost::shared_ptr<librdf_query>() )
|
||||
: m_xRep(i_pRepository), m_rMutex(i_rMutex), m_pQuery(i_pQuery),
|
||||
m_pStream(i_pStream)
|
||||
{};
|
||||
: m_xRep(i_pRepository)
|
||||
, m_rMutex(i_rMutex)
|
||||
, m_pQuery(i_pQuery)
|
||||
, m_pStream(i_pStream)
|
||||
{ };
|
||||
|
||||
virtual ~librdf_GraphResult() {}
|
||||
|
||||
// ::com::sun::star::container::XEnumeration:
|
||||
|
@ -437,7 +462,7 @@ private:
|
|||
librdf_GraphResult::hasMoreElements() throw (uno::RuntimeException)
|
||||
{
|
||||
::osl::MutexGuard g(m_rMutex);
|
||||
return !librdf_stream_end(m_pStream.get());
|
||||
return m_pStream.get() && !librdf_stream_end(m_pStream.get());
|
||||
}
|
||||
|
||||
::com::sun::star::uno::Any SAL_CALL
|
||||
|
@ -446,7 +471,7 @@ throw (uno::RuntimeException, container::NoSuchElementException,
|
|||
lang::WrappedTargetException)
|
||||
{
|
||||
::osl::MutexGuard g(m_rMutex);
|
||||
if (!librdf_stream_end(m_pStream.get())) {
|
||||
if (!m_pStream.get() || !librdf_stream_end(m_pStream.get())) {
|
||||
librdf_node *pCtxt( static_cast<librdf_node *>
|
||||
(librdf_stream_get_context(m_pStream.get())) );
|
||||
librdf_statement *pStmt( librdf_stream_get_object(m_pStream.get()) );
|
||||
|
@ -490,9 +515,13 @@ public:
|
|||
boost::shared_ptr<librdf_query> const& i_pQuery,
|
||||
boost::shared_ptr<librdf_query_results> const& i_pQueryResult,
|
||||
uno::Sequence< ::rtl::OUString > const& i_rBindingNames )
|
||||
: m_xRep(i_pRepository), m_rMutex(i_rMutex), m_pQuery(i_pQuery),
|
||||
m_pQueryResult(i_pQueryResult), m_BindingNames(i_rBindingNames)
|
||||
{};
|
||||
: m_xRep(i_pRepository)
|
||||
, m_rMutex(i_rMutex)
|
||||
, m_pQuery(i_pQuery)
|
||||
, m_pQueryResult(i_pQueryResult)
|
||||
, m_BindingNames(i_rBindingNames)
|
||||
{ };
|
||||
|
||||
virtual ~librdf_QuerySelectResult() {}
|
||||
|
||||
// ::com::sun::star::container::XEnumeration:
|
||||
|
@ -601,7 +630,11 @@ class librdf_NamedGraph:
|
|||
public:
|
||||
librdf_NamedGraph(librdf_Repository * i_pRep,
|
||||
uno::Reference<rdf::XURI> const & i_xName)
|
||||
: m_wRep(i_pRep), m_pRep(i_pRep), m_xName(i_xName) {};
|
||||
: m_wRep(i_pRep)
|
||||
, m_pRep(i_pRep)
|
||||
, m_xName(i_xName)
|
||||
{ };
|
||||
|
||||
virtual ~librdf_NamedGraph() {}
|
||||
|
||||
// ::com::sun::star::rdf::XNode:
|
||||
|
@ -622,19 +655,19 @@ public:
|
|||
container::NoSuchElementException, rdf::RepositoryException);
|
||||
virtual void SAL_CALL addStatement(
|
||||
const uno::Reference< rdf::XResource > & i_xSubject,
|
||||
const uno::Reference< rdf::XResource > & i_xPredicate,
|
||||
const uno::Reference< rdf::XURI > & i_xPredicate,
|
||||
const uno::Reference< rdf::XNode > & i_xObject)
|
||||
throw (uno::RuntimeException, lang::IllegalArgumentException,
|
||||
container::NoSuchElementException, rdf::RepositoryException);
|
||||
virtual void SAL_CALL removeStatements(
|
||||
const uno::Reference< rdf::XResource > & i_xSubject,
|
||||
const uno::Reference< rdf::XResource > & i_xPredicate,
|
||||
const uno::Reference< rdf::XURI > & i_xPredicate,
|
||||
const uno::Reference< rdf::XNode > & i_xObject)
|
||||
throw (uno::RuntimeException,
|
||||
container::NoSuchElementException, rdf::RepositoryException);
|
||||
virtual uno::Reference< container::XEnumeration > SAL_CALL getStatements(
|
||||
const uno::Reference< rdf::XResource > & i_xSubject,
|
||||
const uno::Reference< rdf::XResource > & i_xPredicate,
|
||||
const uno::Reference< rdf::XURI > & i_xPredicate,
|
||||
const uno::Reference< rdf::XNode > & i_xObject)
|
||||
throw (uno::RuntimeException,
|
||||
container::NoSuchElementException, rdf::RepositoryException);
|
||||
|
@ -693,7 +726,7 @@ throw (uno::RuntimeException,
|
|||
|
||||
void SAL_CALL librdf_NamedGraph::addStatement(
|
||||
const uno::Reference< rdf::XResource > & i_xSubject,
|
||||
const uno::Reference< rdf::XResource > & i_xPredicate,
|
||||
const uno::Reference< rdf::XURI > & i_xPredicate,
|
||||
const uno::Reference< rdf::XNode > & i_xObject)
|
||||
throw (uno::RuntimeException, lang::IllegalArgumentException,
|
||||
container::NoSuchElementException, rdf::RepositoryException)
|
||||
|
@ -708,7 +741,7 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
|
|||
|
||||
void SAL_CALL librdf_NamedGraph::removeStatements(
|
||||
const uno::Reference< rdf::XResource > & i_xSubject,
|
||||
const uno::Reference< rdf::XResource > & i_xPredicate,
|
||||
const uno::Reference< rdf::XURI > & i_xPredicate,
|
||||
const uno::Reference< rdf::XNode > & i_xObject)
|
||||
throw (uno::RuntimeException,
|
||||
container::NoSuchElementException, rdf::RepositoryException)
|
||||
|
@ -724,7 +757,7 @@ throw (uno::RuntimeException,
|
|||
uno::Reference< container::XEnumeration > SAL_CALL
|
||||
librdf_NamedGraph::getStatements(
|
||||
const uno::Reference< rdf::XResource > & i_xSubject,
|
||||
const uno::Reference< rdf::XResource > & i_xPredicate,
|
||||
const uno::Reference< rdf::XURI > & i_xPredicate,
|
||||
const uno::Reference< rdf::XNode > & i_xObject)
|
||||
throw (uno::RuntimeException,
|
||||
container::NoSuchElementException, rdf::RepositoryException)
|
||||
|
@ -741,15 +774,42 @@ throw (uno::RuntimeException,
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
boost::shared_ptr<librdf_world> librdf_Repository::m_pWorld;
|
||||
sal_uInt32 librdf_Repository::m_NumInstances = 0;
|
||||
osl::Mutex librdf_Repository::m_aMutex;
|
||||
|
||||
librdf_Repository::librdf_Repository(
|
||||
uno::Reference< uno::XComponentContext > const & i_xContext) :
|
||||
BaseMutex(), m_xContext(i_xContext),
|
||||
m_pWorld (static_cast<librdf_world *>(0), librdf_free_world ),
|
||||
m_pStorage(static_cast<librdf_storage*>(0), librdf_free_storage),
|
||||
m_pModel (static_cast<librdf_model *>(0), librdf_free_model ),
|
||||
m_NamedGraphs(), m_TypeConverter(i_xContext, *this)
|
||||
uno::Reference< uno::XComponentContext > const & i_xContext)
|
||||
: /*BaseMutex(),*/ m_xContext(i_xContext)
|
||||
// m_pWorld (static_cast<librdf_world *>(0), librdf_free_world ),
|
||||
, m_pStorage(static_cast<librdf_storage*>(0), librdf_free_storage)
|
||||
, m_pModel (static_cast<librdf_model *>(0), librdf_free_model )
|
||||
, m_NamedGraphs()
|
||||
, m_TypeConverter(i_xContext, *this)
|
||||
{
|
||||
OSL_ENSURE(i_xContext.is(), "librdf_Repository: null context");
|
||||
|
||||
::osl::MutexGuard g(m_aMutex);
|
||||
if (!m_NumInstances++) {
|
||||
m_pWorld.reset(m_TypeConverter.createWorld(), librdf_free_world);
|
||||
}
|
||||
}
|
||||
|
||||
librdf_Repository::~librdf_Repository()
|
||||
{
|
||||
// must destroy these before world!
|
||||
m_pModel.reset();
|
||||
m_pStorage.reset();
|
||||
|
||||
// FIXME: so it turns out that calling librdf_free_world will
|
||||
// (via raptor_sax2_finish) call xmlCleanupParser, which will
|
||||
// free libxml2's globals! ARRRGH!!! => never call librdf_free_world
|
||||
#if 0
|
||||
::osl::MutexGuard g(m_aMutex);
|
||||
if (!--m_NumInstances) {
|
||||
m_pWorld.reset();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// com.sun.star.uno.XServiceInfo:
|
||||
|
@ -901,11 +961,12 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
|
|||
"librdf_new_parser failed"), *this);
|
||||
}
|
||||
|
||||
//FIXME
|
||||
// use XSeekableStream or something
|
||||
uno::Sequence<sal_Int8> buf;
|
||||
uno::Reference<io::XSeekable> xSeekable(i_xInStream, uno::UNO_QUERY);
|
||||
// UGLY: if only that redland junk could read streams...
|
||||
const sal_Int64 sz( xSeekable.is() ? xSeekable->getLength() : 1 << 20 );
|
||||
// exceptions are propagated
|
||||
i_xInStream->readBytes(buf, 1<<20);
|
||||
i_xInStream->readBytes(buf, sz);
|
||||
const boost::shared_ptr<librdf_stream> pStream(
|
||||
librdf_parser_parse_counted_string_as_stream(pParser.get(),
|
||||
reinterpret_cast<const unsigned char*>(buf.getConstArray()),
|
||||
|
@ -1015,6 +1076,46 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
|
|||
"librdf_Repository::exportGraph: "
|
||||
"librdf_new_serializer failed"), *this);
|
||||
}
|
||||
|
||||
const boost::shared_ptr<librdf_uri> pRelativeURI(
|
||||
librdf_new_uri(m_pWorld.get(), reinterpret_cast<const unsigned char*>
|
||||
("http://feature.librdf.org/raptor-relativeURIs")),
|
||||
librdf_free_uri);
|
||||
const boost::shared_ptr<librdf_uri> pWriteBaseURI(
|
||||
librdf_new_uri(m_pWorld.get(), reinterpret_cast<const unsigned char*>
|
||||
("http://feature.librdf.org/raptor-writeBaseURI")),
|
||||
librdf_free_uri);
|
||||
const boost::shared_ptr<librdf_node> p0(
|
||||
librdf_new_node_from_literal(m_pWorld.get(),
|
||||
reinterpret_cast<const unsigned char*> ("0"), NULL, 0),
|
||||
librdf_free_node);
|
||||
const boost::shared_ptr<librdf_node> p1(
|
||||
librdf_new_node_from_literal(m_pWorld.get(),
|
||||
reinterpret_cast<const unsigned char*> ("1"), NULL, 0),
|
||||
librdf_free_node);
|
||||
if (!pWriteBaseURI || !pRelativeURI || !p0 || !p1) {
|
||||
throw uno::RuntimeException(::rtl::OUString::createFromAscii(
|
||||
"librdf_Repository::exportGraph: "
|
||||
"librdf_new_uri or librdf_new_node_from_literal failed"), *this);
|
||||
}
|
||||
|
||||
// make URIs relative to base URI
|
||||
if (librdf_serializer_set_feature(pSerializer.get(),
|
||||
pRelativeURI.get(), p1.get()))
|
||||
{
|
||||
throw uno::RuntimeException(::rtl::OUString::createFromAscii(
|
||||
"librdf_Repository::exportGraph: "
|
||||
"librdf_serializer_set_feature relativeURIs failed"), *this);
|
||||
}
|
||||
// but do not write the base URI to the file!
|
||||
if (librdf_serializer_set_feature(pSerializer.get(),
|
||||
pWriteBaseURI.get(), p0.get()))
|
||||
{
|
||||
throw uno::RuntimeException(::rtl::OUString::createFromAscii(
|
||||
"librdf_Repository::exportGraph: "
|
||||
"librdf_serializer_set_feature writeBaseURI failed"), *this);
|
||||
}
|
||||
|
||||
size_t length;
|
||||
const boost::shared_ptr<unsigned char> pBuf(
|
||||
librdf_serializer_serialize_stream_to_counted_string(
|
||||
|
@ -1108,13 +1209,28 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
|
|||
m_NamedGraphs.erase(iter);
|
||||
}
|
||||
|
||||
static bool isMetadatableWithoutMetadata(
|
||||
uno::Reference<uno::XInterface> const & i_xNode)
|
||||
{
|
||||
const uno::Reference<rdf::XMetadatable> xMeta( i_xNode, uno::UNO_QUERY );
|
||||
return (xMeta.is() && !xMeta->getMetadataReference().Second.getLength());
|
||||
}
|
||||
|
||||
uno::Reference< container::XEnumeration > SAL_CALL
|
||||
librdf_Repository::getStatements(
|
||||
const uno::Reference< rdf::XResource > & i_xSubject,
|
||||
const uno::Reference< rdf::XResource > & i_xPredicate,
|
||||
const uno::Reference< rdf::XURI > & i_xPredicate,
|
||||
const uno::Reference< rdf::XNode > & i_xObject)
|
||||
throw (uno::RuntimeException, rdf::RepositoryException)
|
||||
{
|
||||
if (isMetadatableWithoutMetadata(i_xSubject) ||
|
||||
isMetadatableWithoutMetadata(i_xPredicate) ||
|
||||
isMetadatableWithoutMetadata(i_xObject))
|
||||
{
|
||||
return new librdf_GraphResult(this, m_aMutex,
|
||||
::boost::shared_ptr<librdf_stream>());
|
||||
}
|
||||
|
||||
::osl::MutexGuard g(m_aMutex);
|
||||
const boost::shared_ptr<librdf_statement> pStatement(
|
||||
m_TypeConverter.mkStatement(m_pWorld.get(),
|
||||
|
@ -1252,43 +1368,81 @@ throw (uno::RuntimeException, rdf::QueryException, rdf::RepositoryException)
|
|||
|
||||
// ::com::sun::star::rdf::XDocumentRepository:
|
||||
void SAL_CALL librdf_Repository::setStatementRDFa(
|
||||
const uno::Reference< rdf::XURI > & i_xSubject,
|
||||
const uno::Reference< rdf::XURI > & i_xPredicate,
|
||||
const uno::Reference< text::XTextRange > & i_xObject,
|
||||
const uno::Reference< rdf::XResource > & i_xSubject,
|
||||
const uno::Sequence< uno::Reference< rdf::XURI > > & i_rPredicates,
|
||||
const uno::Reference< rdf::XMetadatable > & i_xObject,
|
||||
const ::rtl::OUString & i_rRDFaContent,
|
||||
const uno::Reference< rdf::XURI > & i_xRDFaDatatype)
|
||||
throw (uno::RuntimeException, lang::IllegalArgumentException,
|
||||
rdf::RepositoryException)
|
||||
{
|
||||
static const ::rtl::OUString s_cell(
|
||||
::rtl::OUString::createFromAscii("com.sun.star.table.Cell"));
|
||||
static const ::rtl::OUString s_cellprops( // for writer
|
||||
::rtl::OUString::createFromAscii("com.sun.star.text.CellProperties"));
|
||||
static const ::rtl::OUString s_paragraph(
|
||||
::rtl::OUString::createFromAscii("com.sun.star.text.Paragraph"));
|
||||
static const ::rtl::OUString s_bookmark(
|
||||
::rtl::OUString::createFromAscii("com.sun.star.text.Bookmark"));
|
||||
static const ::rtl::OUString s_meta( ::rtl::OUString::createFromAscii(
|
||||
"com.sun.star.text.InContentMetadata"));
|
||||
|
||||
if (!i_xSubject.is()) {
|
||||
throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
|
||||
"librdf_Repository::setStatementRDFa: Subject is null"), *this, 0);
|
||||
}
|
||||
if (!i_xPredicate.is()) {
|
||||
if (!i_rPredicates.getLength()) {
|
||||
throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
|
||||
"librdf_Repository::setStatementRDFa: Predicate is null"),
|
||||
"librdf_Repository::setStatementRDFa: no Predicates"),
|
||||
*this, 1);
|
||||
}
|
||||
for (sal_Int32 i = 0; i < i_rPredicates.getLength(); ++i) {
|
||||
if (!i_rPredicates[i].is()) {
|
||||
throw lang::IllegalArgumentException(
|
||||
::rtl::OUString::createFromAscii(
|
||||
"librdf_Repository::setStatementRDFa: Predicate is null"),
|
||||
*this, 1);
|
||||
}
|
||||
}
|
||||
if (!i_xObject.is()) {
|
||||
throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
|
||||
"librdf_Repository::setStatementRDFa: Object is null"), *this, 2);
|
||||
}
|
||||
uno::Reference<rdf::XResource> xSubject(i_xSubject, uno::UNO_QUERY_THROW);
|
||||
uno::Reference<rdf::XResource> xPredicate(i_xPredicate,
|
||||
const uno::Reference<lang::XServiceInfo> xService(i_xObject,
|
||||
uno::UNO_QUERY_THROW);
|
||||
uno::Reference<rdf::XMetadatable> xMeta(i_xObject, uno::UNO_QUERY);
|
||||
if (!xMeta.is()) {
|
||||
uno::Reference<text::XTextRange> xTextRange;
|
||||
if (xService->supportsService(s_cell) ||
|
||||
xService->supportsService(s_cellprops) ||
|
||||
xService->supportsService(s_paragraph))
|
||||
{
|
||||
xTextRange.set(i_xObject, uno::UNO_QUERY_THROW);
|
||||
}
|
||||
else if (xService->supportsService(s_bookmark) ||
|
||||
xService->supportsService(s_meta))
|
||||
{
|
||||
const uno::Reference<text::XTextContent> xTextContent(i_xObject,
|
||||
uno::UNO_QUERY_THROW);
|
||||
xTextRange = xTextContent->getAnchor();
|
||||
}
|
||||
if (!xTextRange.is()) {
|
||||
throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
|
||||
"librdf_Repository::setStatementRDFa: Object is not XMetadatable"),
|
||||
*this, 2);
|
||||
"librdf_Repository::setStatementRDFa: "
|
||||
"Object does not support RDFa"), *this, 2);
|
||||
}
|
||||
// ensure that the metadatable has an XML ID
|
||||
xMeta->ensureXmlId();
|
||||
OSL_ENSURE(!xMeta->getXmlId().equalsAscii(""), "ensureXmlId didnt");
|
||||
i_xObject->ensureMetadataReference();
|
||||
const beans::StringPair mdref( i_xObject->getMetadataReference() );
|
||||
if (mdref.First.equalsAscii("") || mdref.Second.equalsAscii("")) {
|
||||
throw uno::RuntimeException( ::rtl::OUString::createFromAscii(
|
||||
"librdf_Repository::setStatementRDFa: "
|
||||
"ensureMetadataReference did not"), *this);
|
||||
}
|
||||
uno::Reference<rdf::XURI> xXmlId;
|
||||
try {
|
||||
xXmlId.set( rdf::URI::create(m_xContext,
|
||||
::rtl::OUString::createFromAscii(s_nsOOo) + xMeta->getXmlId()),
|
||||
::rtl::OUString::createFromAscii(s_nsOOo)
|
||||
+ mdref.First + ::rtl::OUString::createFromAscii("#")
|
||||
+ mdref.Second),
|
||||
uno::UNO_QUERY_THROW);
|
||||
} catch (lang::IllegalArgumentException & iae) {
|
||||
throw lang::WrappedTargetRuntimeException(
|
||||
|
@ -1297,12 +1451,17 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
|
|||
"cannot create URI for XML ID"), *this, uno::makeAny(iae));
|
||||
}
|
||||
|
||||
// TODO transaction would be nice here...
|
||||
::osl::MutexGuard g(m_aMutex);
|
||||
uno::Reference<rdf::XNode> xText;
|
||||
try {
|
||||
xText.set( rdf::Literal::create(m_xContext, i_xObject->getString()),
|
||||
uno::UNO_QUERY_THROW);
|
||||
if (i_xRDFaDatatype.is() && (i_rRDFaContent.equalsAscii(""))) {
|
||||
xText.set( rdf::Literal::createWithType(m_xContext,
|
||||
xTextRange->getString(), i_xRDFaDatatype),
|
||||
uno::UNO_QUERY_THROW);
|
||||
} else {
|
||||
xText.set( rdf::Literal::create(m_xContext,
|
||||
xTextRange->getString()), uno::UNO_QUERY_THROW);
|
||||
}
|
||||
} catch (lang::IllegalArgumentException & iae) {
|
||||
throw lang::WrappedTargetRuntimeException(
|
||||
::rtl::OUString::createFromAscii(
|
||||
|
@ -1311,9 +1470,12 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
|
|||
}
|
||||
if (i_rRDFaContent.equalsAscii("")) {
|
||||
removeStatementRDFa(i_xObject);
|
||||
addStatementGraph(xSubject, xPredicate, xText, xXmlId, true);
|
||||
::std::for_each(::comphelper::stl_begin(i_rPredicates),
|
||||
::comphelper::stl_end(i_rPredicates),
|
||||
::boost::bind( &librdf_Repository::addStatementGraph,
|
||||
this, i_xSubject, _1, xText, xXmlId, true));
|
||||
} else {
|
||||
uno::Reference<rdf::XResource> xLabel( m_TypeConverter.getRDFsLabel() );
|
||||
uno::Reference<rdf::XURI> xLabel( m_TypeConverter.getRDFsLabel() );
|
||||
uno::Reference<rdf::XNode> xContent;
|
||||
try {
|
||||
if (!i_xRDFaDatatype.is()) {
|
||||
|
@ -1330,36 +1492,35 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
|
|||
"cannot create literal"), *this, uno::makeAny(iae));
|
||||
}
|
||||
removeStatementRDFa(i_xObject);
|
||||
addStatementGraph(xSubject, xPredicate, xContent, xXmlId, true);
|
||||
addStatementGraph(xSubject, xLabel, xText, xXmlId, true);
|
||||
::std::for_each(::comphelper::stl_begin(i_rPredicates),
|
||||
::comphelper::stl_end(i_rPredicates),
|
||||
::boost::bind( &librdf_Repository::addStatementGraph,
|
||||
this, i_xSubject, _1, xContent, xXmlId, true));
|
||||
addStatementGraph(i_xSubject, xLabel, xText, xXmlId, true);
|
||||
}
|
||||
}
|
||||
|
||||
void SAL_CALL librdf_Repository::removeStatementRDFa(
|
||||
const uno::Reference< text::XTextRange > & i_xObject)
|
||||
const uno::Reference< rdf::XMetadatable > & i_xElement)
|
||||
throw (uno::RuntimeException, lang::IllegalArgumentException,
|
||||
rdf::RepositoryException)
|
||||
{
|
||||
if (!i_xObject.is()) {
|
||||
if (!i_xElement.is()) {
|
||||
throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
|
||||
"librdf_Repository::removeStatementRDFa: Object is null"),
|
||||
"librdf_Repository::removeStatementRDFa: Element is null"),
|
||||
*this, 0);
|
||||
}
|
||||
|
||||
uno::Reference<rdf::XMetadatable> xMeta(i_xObject, uno::UNO_QUERY);
|
||||
if (!xMeta.is()) {
|
||||
throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
|
||||
"librdf_Repository::removeStatementRDFa: "
|
||||
"Object is not XMetadatable"), *this, 0);
|
||||
}
|
||||
const ::rtl::OUString XmlId(xMeta->getXmlId());
|
||||
if (XmlId.equalsAscii("")) {
|
||||
const beans::StringPair mdref( i_xElement->getMetadataReference() );
|
||||
if (mdref.First.equalsAscii("") || mdref.Second.equalsAscii("")) {
|
||||
return; // nothing to do...
|
||||
}
|
||||
uno::Reference<rdf::XURI> xXmlId;
|
||||
try {
|
||||
xXmlId.set( rdf::URI::create(m_xContext,
|
||||
::rtl::OUString::createFromAscii(s_nsOOo) + XmlId),
|
||||
::rtl::OUString::createFromAscii(s_nsOOo)
|
||||
+ mdref.First + ::rtl::OUString::createFromAscii("#")
|
||||
+ mdref.Second),
|
||||
uno::UNO_QUERY_THROW);
|
||||
} catch (lang::IllegalArgumentException & iae) {
|
||||
throw lang::WrappedTargetRuntimeException(
|
||||
|
@ -1381,14 +1542,16 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
|
|||
throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
|
||||
"librdf_Repository::getStatementRDFa: Element is null"), *this, 0);
|
||||
}
|
||||
const ::rtl::OUString XmlId(i_xElement->getXmlId());
|
||||
if (XmlId.equalsAscii("")) {
|
||||
const beans::StringPair mdref( i_xElement->getMetadataReference() );
|
||||
if (mdref.First.equalsAscii("") || mdref.Second.equalsAscii("")) {
|
||||
return uno::Sequence<rdf::Statement>();
|
||||
}
|
||||
uno::Reference<rdf::XURI> xXmlId;
|
||||
try {
|
||||
xXmlId.set( rdf::URI::create(m_xContext,
|
||||
::rtl::OUString::createFromAscii(s_nsOOo) + XmlId),
|
||||
::rtl::OUString::createFromAscii(s_nsOOo)
|
||||
+ mdref.First + ::rtl::OUString::createFromAscii("#")
|
||||
+ mdref.Second),
|
||||
uno::UNO_QUERY_THROW);
|
||||
} catch (lang::IllegalArgumentException & iae) {
|
||||
throw lang::WrappedTargetRuntimeException(
|
||||
|
@ -1396,51 +1559,28 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
|
|||
"librdf_Repository::getStatementRDFa: "
|
||||
"cannot create URI for XML ID"), *this, uno::makeAny(iae));
|
||||
}
|
||||
rdf::Statement First;
|
||||
rdf::Statement Second;
|
||||
int count(0);
|
||||
|
||||
::osl::MutexGuard g(m_aMutex);
|
||||
uno::Reference<container::XEnumeration> xIter(
|
||||
::comphelper::SequenceAsVector< rdf::Statement > ret;
|
||||
const uno::Reference<container::XEnumeration> xIter(
|
||||
getStatementsGraph(0, 0, 0, xXmlId, true) );
|
||||
OSL_ENSURE(xIter.is(), "getStatementRDFa: no result?");
|
||||
if (xIter->hasMoreElements()) {
|
||||
if (!(xIter->nextElement() >>= First)) {
|
||||
OSL_ENSURE(false, "getStatementRDFa: result 1 wrong type");
|
||||
return uno::Sequence<rdf::Statement>();
|
||||
}
|
||||
++count;
|
||||
}
|
||||
if (xIter->hasMoreElements()) {
|
||||
if (!(xIter->nextElement() >>= Second)) {
|
||||
OSL_ENSURE(false, "getStatementRDFa: result 2 wrong type");
|
||||
return uno::Sequence<rdf::Statement>();
|
||||
}
|
||||
++count;
|
||||
}
|
||||
OSL_ENSURE(!xIter->hasMoreElements(), "getStatementRDFa: > 2 results?");
|
||||
switch (count) {
|
||||
case 0:
|
||||
return uno::Sequence<rdf::Statement>();
|
||||
case 1:
|
||||
return ::comphelper::makeSequence(First);
|
||||
case 2:
|
||||
{
|
||||
uno::Reference<rdf::XResource> xLabel(
|
||||
m_TypeConverter.getRDFsLabel() );
|
||||
OSL_ENSURE(Second.Predicate.is(),
|
||||
"getStatementRDFa: no predicate?");
|
||||
if (Second.Predicate->getStringValue() !=
|
||||
xLabel->getStringValue()) {
|
||||
// sequence is not guaranteed, so we might need to swap
|
||||
return ::comphelper::makeSequence(Second, First);
|
||||
} else {
|
||||
return ::comphelper::makeSequence(First, Second);
|
||||
}
|
||||
if (!xIter.is()) throw uno::RuntimeException();
|
||||
const uno::Reference<rdf::XURI> xLabel( m_TypeConverter.getRDFsLabel() );
|
||||
while (xIter->hasMoreElements()) {
|
||||
rdf::Statement stmt;
|
||||
if (!(xIter->nextElement() >>= stmt)) {
|
||||
OSL_ENSURE(false, "getStatementRDFa: result of wrong type?");
|
||||
} else {
|
||||
OSL_ENSURE(stmt.Predicate.is(), "getStatementRDFa: no predicate?");
|
||||
if (stmt.Predicate->getStringValue() != xLabel->getStringValue()) {
|
||||
ret.push_back(stmt);
|
||||
} else { // the RDFs:label comes first
|
||||
ret.insert(ret.begin(), stmt);
|
||||
}
|
||||
default:
|
||||
OSL_ENSURE(false, "getStatementsRDFa: invalid count");
|
||||
throw uno::RuntimeException();
|
||||
}
|
||||
}
|
||||
return ret.getAsConstList();
|
||||
}
|
||||
|
||||
extern "C"
|
||||
|
@ -1462,10 +1602,18 @@ librdf_statement *rdfa_context_stream_map_handler(
|
|||
uno::Reference< container::XEnumeration > SAL_CALL
|
||||
librdf_Repository::getStatementsRDFa(
|
||||
const uno::Reference< rdf::XResource > & i_xSubject,
|
||||
const uno::Reference< rdf::XResource > & i_xPredicate,
|
||||
const uno::Reference< rdf::XURI > & i_xPredicate,
|
||||
const uno::Reference< rdf::XNode > & i_xObject)
|
||||
throw (uno::RuntimeException, rdf::RepositoryException)
|
||||
{
|
||||
if (isMetadatableWithoutMetadata(i_xSubject) ||
|
||||
isMetadatableWithoutMetadata(i_xPredicate) ||
|
||||
isMetadatableWithoutMetadata(i_xObject))
|
||||
{
|
||||
return new librdf_GraphResult(this, m_aMutex,
|
||||
::boost::shared_ptr<librdf_stream>());
|
||||
}
|
||||
|
||||
::osl::MutexGuard g(m_aMutex);
|
||||
const boost::shared_ptr<librdf_statement> pStatement(
|
||||
m_TypeConverter.mkStatement(m_pWorld.get(),
|
||||
|
@ -1492,9 +1640,6 @@ throw (uno::RuntimeException, rdf::RepositoryException)
|
|||
return new librdf_GraphResult(this, m_aMutex, pStream);
|
||||
}
|
||||
|
||||
//FIXME ... argh!
|
||||
void BUG(librdf_world*) {}
|
||||
|
||||
// ::com::sun::star::lang::XInitialization:
|
||||
void SAL_CALL librdf_Repository::initialize(
|
||||
const uno::Sequence< ::com::sun::star::uno::Any > & i_rArguments)
|
||||
|
@ -1505,7 +1650,6 @@ throw (uno::RuntimeException, uno::Exception)
|
|||
::osl::MutexGuard g(m_aMutex);
|
||||
|
||||
// m_pWorld.reset(m_TypeConverter.createWorld(), librdf_free_world);
|
||||
m_pWorld.reset(m_TypeConverter.createWorld(), BUG);
|
||||
m_pStorage.reset(m_TypeConverter.createStorage(m_pWorld.get()),
|
||||
librdf_free_storage);
|
||||
m_pModel.reset(m_TypeConverter.createModel(
|
||||
|
@ -1553,7 +1697,7 @@ const NamedGraphMap_t::iterator SAL_CALL librdf_Repository::clearGraph(
|
|||
|
||||
void SAL_CALL librdf_Repository::addStatementGraph(
|
||||
const uno::Reference< rdf::XResource > & i_xSubject,
|
||||
const uno::Reference< rdf::XResource > & i_xPredicate,
|
||||
const uno::Reference< rdf::XURI > & i_xPredicate,
|
||||
const uno::Reference< rdf::XNode > & i_xObject,
|
||||
const uno::Reference< rdf::XURI > & i_xGraphName,
|
||||
bool i_Internal)
|
||||
|
@ -1608,12 +1752,19 @@ void SAL_CALL librdf_Repository::addStatementGraph(
|
|||
|
||||
void SAL_CALL librdf_Repository::removeStatementsGraph(
|
||||
const uno::Reference< rdf::XResource > & i_xSubject,
|
||||
const uno::Reference< rdf::XResource > & i_xPredicate,
|
||||
const uno::Reference< rdf::XURI > & i_xPredicate,
|
||||
const uno::Reference< rdf::XNode > & i_xObject,
|
||||
const uno::Reference< rdf::XURI > & i_xGraphName)
|
||||
//throw (uno::RuntimeException, lang::IllegalArgumentException,
|
||||
// container::NoSuchElementException, rdf::RepositoryException)
|
||||
{
|
||||
if (isMetadatableWithoutMetadata(i_xSubject) ||
|
||||
isMetadatableWithoutMetadata(i_xPredicate) ||
|
||||
isMetadatableWithoutMetadata(i_xObject))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
::osl::MutexGuard g(m_aMutex);
|
||||
const ::rtl::OUString contextU( i_xGraphName->getStringValue() );
|
||||
if (m_NamedGraphs.find(contextU) == m_NamedGraphs.end()) {
|
||||
|
@ -1671,13 +1822,24 @@ void SAL_CALL librdf_Repository::removeStatementsGraph(
|
|||
uno::Reference< container::XEnumeration > SAL_CALL
|
||||
librdf_Repository::getStatementsGraph(
|
||||
const uno::Reference< rdf::XResource > & i_xSubject,
|
||||
const uno::Reference< rdf::XResource > & i_xPredicate,
|
||||
const uno::Reference< rdf::XURI > & i_xPredicate,
|
||||
const uno::Reference< rdf::XNode > & i_xObject,
|
||||
const uno::Reference< rdf::XURI > & i_xGraphName,
|
||||
bool i_Internal)
|
||||
//throw (uno::RuntimeException, lang::IllegalArgumentException,
|
||||
// container::NoSuchElementException, rdf::RepositoryException)
|
||||
{
|
||||
// N.B.: if any of subject, predicate, object is an XMetadatable, and
|
||||
// has no metadata reference, then there cannot be any node in the graph
|
||||
// representing it; in order to prevent side effect
|
||||
// (ensureMetadataReference), check for this condition and return
|
||||
if (isMetadatableWithoutMetadata(i_xSubject) ||
|
||||
isMetadatableWithoutMetadata(i_xPredicate) ||
|
||||
isMetadatableWithoutMetadata(i_xObject))
|
||||
{
|
||||
return new librdf_GraphResult(this, m_aMutex,
|
||||
::boost::shared_ptr<librdf_stream>());
|
||||
}
|
||||
|
||||
::osl::MutexGuard g(m_aMutex);
|
||||
const ::rtl::OUString contextU( i_xGraphName->getStringValue() );
|
||||
|
@ -1879,14 +2041,16 @@ librdf_node* librdf_TypeConverter::mkNode( librdf_world* i_pWorld,
|
|||
|
||||
librdf_statement* librdf_TypeConverter::mkStatement( librdf_world* i_pWorld,
|
||||
const uno::Reference< rdf::XResource > & i_xSubject,
|
||||
const uno::Reference< rdf::XResource > & i_xPredicate,
|
||||
const uno::Reference< rdf::XURI > & i_xPredicate,
|
||||
const uno::Reference< rdf::XNode > & i_xObject) const
|
||||
{
|
||||
librdf_node* pSubject( mkResource(i_pWorld, i_xSubject) );
|
||||
librdf_node* pPredicate(0);
|
||||
librdf_node* pObject(0);
|
||||
try {
|
||||
pPredicate = mkResource(i_pWorld, i_xPredicate);
|
||||
const uno::Reference<rdf::XResource> xPredicate(i_xPredicate,
|
||||
uno::UNO_QUERY);
|
||||
pPredicate = mkResource(i_pWorld, xPredicate);
|
||||
try {
|
||||
pObject = mkNode(i_pWorld, i_xObject);
|
||||
} catch (...) {
|
||||
|
@ -2044,14 +2208,14 @@ librdf_TypeConverter::convertToStatement(librdf_statement* i_pStmt,
|
|||
}
|
||||
return rdf::Statement(
|
||||
convertToXResource(librdf_statement_get_subject(i_pStmt)),
|
||||
convertToXResource(librdf_statement_get_predicate(i_pStmt)),
|
||||
convertToXURI(librdf_statement_get_predicate(i_pStmt)),
|
||||
convertToXNode(librdf_statement_get_object(i_pStmt)),
|
||||
convertToXURI(i_pContext));
|
||||
}
|
||||
|
||||
uno::Reference<rdf::XResource> librdf_TypeConverter::getRDFsLabel() const
|
||||
uno::Reference<rdf::XURI> librdf_TypeConverter::getRDFsLabel() const
|
||||
{
|
||||
static uno::Reference< rdf::XResource > xLabel;
|
||||
static uno::Reference< rdf::XURI> xLabel;
|
||||
|
||||
if (!xLabel.is()) {
|
||||
try {
|
||||
|
|
Loading…
Reference in a new issue