Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

41
LINES

< > BotCompany Repo | #1009179 // Parse LibreOffice Draw content.xml for diagrams Spike 1 [WORKS]

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (2614L/19K/62K).

!7

/* style def
<style:style style:name="gr3" style:family="graphic" style:parent-style-name="standard">
  <style:graphic-properties draw:marker-start="Arrow" draw:marker-start-width="0.3cm" draw:marker-end="Arrow" draw:marker-end-width="0.3cm" draw:textarea-vertical-align="middle"/>
</style:style>
*/

// text shape
// <draw:custom-shape draw:style-name="gr1" draw:text-style-name="P2" draw:layer="layout" svg:width="2.794cm" svg:height="2.032cm" svg:x="8.843cm" svg:y="20.685cm"  

p {
  S xml = loadSnippet(#1009178);
  L<S> tok = htmlTok(xml);
  
  // load styles
  for (L<S> tag : findContainerTag(tok, "style:style")) {
    S style = xml_getArg(tag, "style:name");
    S props = findTag(tag, "style:graphic-properties");
    S start = xml_getArg(props, "draw:marker-start");
    S end = xml_getArg(props, "draw:marker-end");
    print("Style " + style + " arrow? " + start + " - " + end);
  }
  
  for (L<S> tag : findContainerTag(tok, "draw:custom-shape")) {
    S style = xml_getArg(tag, "draw:style-name");
    DoubleRect rect = libreOffice_rect(tag);
    print("\nCustom shape, style=" + style + ", rect: " + rect);
    print("  " + join(tag));
    pnl(libreOffice_textP(tag));
  }
  
  for (L<S> tag : findContainerTag(tok, "draw:line")) {
    S style = xml_getArg(tag, "draw:style-name");
    DoublePt pt1 = libreOffice_pt1(tag);
    DoublePt pt2 = libreOffice_pt2(tag);
    print("\nLine, style=" + style + ", pt1: " + pt1 + ", pt2: " + pt2);
    print("  " + join(tag));
    pnl(libreOffice_textP(tag));
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1009179
Snippet name: Parse LibreOffice Draw content.xml for diagrams Spike 1 [WORKS]
Eternal ID of this version: #1009179/11
Text MD5: f0cc9432c411ad58305bdb6198bcbca5
Transpilation MD5: 7ed708a04a74d1d2aeb313b6164fb231
Author: stefan
Category: javax / a.i.
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-07-24 23:56:52
Source code size: 1565 bytes / 41 lines
Pitched / IR pitched: No / No
Views / Downloads: 367 / 494
Version history: 10 change(s)
Referenced in: [show references]