Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
dev:client_coding:libreoffice_plugin_wire_protocol [2012/07/24 02:20] – [Word Processor Commands] simondev:client_coding:libreoffice_plugin_wire_protocol [2020/10/13 03:57] – Add import/export commands and improve/clarify other commands. adomasven
Line 1: Line 1:
 +<html><p id="zotero-5-update-warning" style="color: red; font-weight: bold">We’re
 +in the process of updating the documentation for
 +<a href="https://www.zotero.org/blog/zotero-5-0">Zotero 5.0</a>. Some documentation
 +may be outdated in the meantime. Thanks for your understanding.</p></html>
 +
 +
 ====== LibreOffice Plugin Wire Protocol ====== ====== LibreOffice Plugin Wire Protocol ======
  
Line 61: Line 67:
 </code> </code>
  
-If the request is successful, the client must send a response with a JSON-encoded payload. This response is often <code>null</code> if the command returns no output, but may also be an array, an integer, a string, or a boolean value depending on the command.+If the request is successful, the client must send a response with a JSON-encoded payload. This response is often null if the command returns no output, but may also be an array, an integer, a string, or a boolean value depending on the command.
  
 If the request is unsuccessful, the client must send a response with the payload: If the request is unsuccessful, the client must send a response with the payload:
Line 157: Line 163:
 ==== Document_getDocumentData ==== ==== Document_getDocumentData ====
  
-Retrieves data string set by [[#setDocumentData]].+Retrieves data string set by [[#setDocumentData]]. NOTE: If the document has been converted to the transfer format and the first line of the document reads "ZOTERO_TRANSFER_DOCUMENT", then this method should return "ZOTERO_TRANSFER_DOCUMENT".
  
 === Parameters === === Parameters ===
Line 165: Line 171:
 === Returns === === Returns ===
  
-(String) The document data string.+(String) The document data string or "ZOTERO_TRANSFER_DOCUMENT"
  
 ==== Document_cursorInField ==== ==== Document_cursorInField ====
Line 226: Line 232:
  
 TODO TODO
 +
 +
 +==== Document_importDocument ====
 +
 +Called to convert Zotero document transfer format links to fields after Document_getDocumentData returns "ZOTERO_TRANSFER_DOCUMENT". Should reverse the export procedure. Note that citation links may contain trailing parameters, e.g. "https://www.zotero.org/google-docs/?q15df3"
 +
 +=== Parameters ===
 +
 +| 0 | documentID | %%Integer|String%% | The documentID, as originally returned by [[#Application_getActiveDocument]]|
 +| 1 | fieldType | %%String%% | Specifies to what field type the import links should be converted. Should always be "ReferenceMark" for the LibreOffice wire protocol. |
 +
 +=== Returns ===
 +
 +`true` if field links and document data were found and imported, `false` otherwise
 +
 +
 +==== Document_exportDocument ====
 +
 +Converts the document to the Zotero transfer document format. The format is:
 +1. Insert 4 paragraphs at the beginning of the document, where first one reads "ZOTERO_TRANSFER_DOCUMENT" and third one has the `transferDocumentInstructions` supplied via a parameter.
 +2. Convert all citations to links that point to "https://www.zotero.org/" and the link text is set to the citation code.
 +3. At the end of the document insert a link that points to "https://www.zotero.org/" with the text set to documentData.
 +
 +=== Parameters ===
 +
 +| 0 | documentID | %%Integer|String%% | The documentID, as originally returned by [[#Application_getActiveDocument]]|
 +| 1 | fieldType | %%String%% | The field type that the document stores Zotero citations in. Either "ReferenceMark" or "Bookmark". |
 +| 2 | transferDocumentInstructions | %%String%% | A text string to be inserted at the start of the document explaining the document format |
 +
 +=== Returns ===
 +
 +null
  
 ==== Document_setBibliographyStyle ==== ==== Document_setBibliographyStyle ====
  
-TODO+Provides parameters for the dedicated bibliography formatting style (usually called "Bibliography"). 
 + 
 +=== Parameters === 
 + 
 +| 0 | documentID | %%Integer|String%% | The documentID, as originally returned by [[#Application_getActiveDocument]]| 
 +| 1 | firstLineIndent | %%Integer%% | First line indent in twips | 
 +| 2 | bodyIndent | %%Integer%% | Bibliography body indent in twips. Applies to first line too. First line indent is calculated by <code>firstLineIndent+bodyIndent</code>
 +| 3 | lineSpacing | %%Integer%% | Line spacing in twips | 
 +| 4 | entrySpacing | %%Integer%% | Bibliography entry spacing in twips | 
 +| 5 | tabStops | %%Array(Integer)%% | Tabulator indents | 
 +| 6 | numTabStops | %%Integer%% | Length of tabStops array | 
 + 
 +== Example Parameters == 
 + 
 +<code> 
 +[1, -720, 720, 240, 0, [], 0] 
 +[1, -720, 720, 240, 0, [1], 720] 
 +</code> 
 + 
 + 
 +=== Returns === 
 + 
 +null
  
 ==== Document_complete ==== ==== Document_complete ====
Line 299: Line 359:
 ==== Field_getText ==== ==== Field_getText ====
  
-Gets the (visible) text of a field.+Gets the (visible) text of a field. Note that any RTF information from setText is not returned, just the visible plaintext.
  
 === Parameters === === Parameters ===
Line 319: Line 379:
 | fieldID | %%Integer|String%% | The fieldID, as originally returned by [[#Document_cursorInField]], [[#Document_insertField]], or [[#Document_getFields]]| | fieldID | %%Integer|String%% | The fieldID, as originally returned by [[#Document_cursorInField]], [[#Document_insertField]], or [[#Document_getFields]]|
 | code | %%String%% | The field code| | code | %%String%% | The field code|
 +
 +=== Returns ===
 +
 +null
 +
 +==== Field_convert ====
 +
 +Converts a field from one type to another.
 +
 +=== Parameters ===
 +
 +| documentID | %%Integer|String%% | The documentID, as originally returned by [[#Application_getActiveDocument]]|
 +| fieldID | %%Integer|String%% | The fieldID, as originally returned by [[#Document_cursorInField]], [[#Document_insertField]], or [[#Document_getFields]]|
 +| fieldType | %%String%% | The type of field used by the document, either ReferenceMark or Bookmark |
 +| noteType | %%Integer%% | The type of note specified by the style:<code>
 +NOTE_IN_TEXT = 0
 +NOTE_FOOTNOTE = 1
 +NOTE_ENDNOTE = 2
 +</code> |
  
 === Returns === === Returns ===
  
 null null
dev/client_coding/libreoffice_plugin_wire_protocol.txt · Last modified: 2022/07/20 09:44 by adomasven