Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Office Basic Source Code Management

723 views

Published on

OpenOffice Basic is cool. It can manipulate everything in your document, spreadsheets and slides. It helps you to create complicated reports automatically. But OpenOffice Basic is not cool. It lacks everything a modern hardcore developer needs: Personal favorite text editors, version controls, source repositories, etc. OpenOffice Basic macros are created and edited only with Basic IDE, and stored in some hidden place in your hard disk, not in the source form but in XML. They cannot be managed with modern development tools like svn, git, different text editors, and cloud storage backup.

What if there is a tool that let you work off-line, out of the OpenOffice Basic IDE box, with your favorite text editor, on anywhere on your hard drive? That's why I wrote obasync to do this job: Synchronize your local Basic macro sources with OpenOffice Basic storage. It frees me from Basic IDE and I can apply every source code development tools now.

Talk delivered in FOSDEM’17
ULB Solbosch Campus, Brussels, 4 & 5 February 2017
Track: Developer rooms: Open Document Editors
Room: K.4.401
Date/Time: Saturday 4 February 2017 13:30-13:50
https://fosdem.org/2017/schedule/event/office_source_code_mgmt/
Video: https://www.youtube.com/watch?v=qB1rAAgkYGY

obasync - Office Basic macro source synchronizer
https://pypi.python.org/pypi/obasync
https://github.com/imacat/obasync

Published in: Software
  • Be the first to comment

Office Basic Source Code Management

  1. 1. Office Basic Source Code Management imacat imacat@mail.imacat.idv.tw 2017/2/4, 2017/8/5
  2. 2. “Office Basic Source Code Management” is created by imacat (Yang Shih-Ching), and licensed under a Creative Commons Attribution 3.0 Unported License
  3. 3. imacat / Yang Shih-Ching ● Taiwan OpenOffice/LibreOffice community ● Apache OpenOffice PMC ● Women in FOSS in Taiwan
  4. 4. OpenOffice Basic is cool!
  5. 5. It connects programming with everybody’s daily routines.
  6. 6. I create Basic toolkit applications for all kinds of jobs.
  7. 7. For example,
  8. 8. Accounting Sheet
  9. 9. Meet-up Sign Book
  10. 10. Mosaic Spreadsheet
  11. 11. Geometrical Paintings
  12. 12. Piano
  13. 13. Christmas Tree
  14. 14. Pokémon GO IV Calculator
  15. 15. But still, OpenOffice Basic sucks!
  16. 16. I lost all my Basic macros when I reinstall my system, if I forget to export them.
  17. 17. I cannot synchronizing my Basic macros among my office PC, my home PC, and my laptop unless I keep export and import everything, everyday.
  18. 18. Finally, Basic IDE sucks.
  19. 19. And the macros are exported XML files, which I cannot work with directly.
  20. 20. This means I cannot do complicated things that Basic IDE does not support. Things like…
  21. 21. …regular expression search and replace, /w+@w+(.w+)+/ /w+@w+(.w+)+/ /w+@w+(.w+)+/ /w+@w+(.w+)+/
  22. 22. …looking into all the occurrence of something for code refactoring, grep -r "getNumUsers" *.* grep -r "getNumUsers" *.* grep -r "getNumUsers" *.* grep -r "getNumUsers" *.*
  23. 23. …and many, many more.
  24. 24. So, I wonder: Can I write Basic macros outside of Basic IDE?
  25. 25. What do I need if I want to write Basic macros outside of Basic IDE?
  26. 26. I can keep a source directory. Whenever I update my macro sources, I copy-and-paste them into Basic IDE.
  27. 27. But this doesn’t make things easier.
  28. 28. Or I can create a tool to do this. Whenever I update my macro sources, it copy-and-pastes them into Basic IDE.
  29. 29. To do this, I need to be able to read and update the Basic macros.
  30. 30. This reminds me of something similar I’d done before.
  31. 31. Calc Mosaic http://sf.net/p/calcmosaic
  32. 32. In Calc Mosaic, after all the mosaic sheets are created, Basic macros are inserted to play these sheets.
  33. 33. Document Basic Macro Storage ● The document Basic macro storage is the BasicLibraries attribute of the OfficeDocument object. OfficeDocumentOfficeDocument BasicLibrariesBasicLibraries Basic LibraryBasic Library Basic Module (String)Basic Module (String) doc_libs = doc.getPropertyValue("BasicLibraries")
  34. 34. System and User Basic Macro Storage ● But the system and user Basic macros are stored together at a different location, the ApplicationScriptLibraryContainer service. ApplicationApplication ApplicationScriptLibraryContainerApplicationScriptLibraryContainer Basic LibraryBasic Library Basic Module (String)Basic Module (String) app_libs = service_manager.createInstance( "com.sun.star.script.ApplicationScriptLibraryContainer")
  35. 35. Basic Library Storage ● ApplicationScriptLibraryContainer has the XNameAccess interface. – Use hasByName() to check if a library exist. – Use getByName() to obtain a library. ApplicationApplication Basic LibraryBasic Library Basic Module (String)Basic Module (String) ApplicationScriptLibraryContainerApplicationScriptLibraryContainer
  36. 36. Basic Library ● The Basic library is an XNameContainer. – Use getByName() to obtain a module. – Use replaceByName() to update a module. – Use insertByName() to add a module. – Use removeByName() to delete a module. ApplicationApplication ApplicationScriptLibraryContainerApplicationScriptLibraryContainer Basic Module (String)Basic Module (String) Basic LibraryBasic Library
  37. 37. Basic Module ● The Basic module obtained with the previous getByName() is a String that contains one or more Basic subroutines as Basic macros. ApplicationApplication ApplicationScriptLibraryContainerApplicationScriptLibraryContainer Basic LibraryBasic Library Basic Module (String)Basic Module (String)
  38. 38. The logic is simple.
  39. 39. Synchronize Between Files and Basic Storage
  40. 40. Update Basic Modules (Upload / Check In) ● Add the missing Basic modules. ● Replace the updated Basic modules. ● Delete the obsoleted Basic modules.
  41. 41. Update Source Files (Download / Check Out) ● Add the missing source files. ● Replace the updated source files. ● Delete the obsoleted source files.
  42. 42. (obasync Demonstration)
  43. 43. So, what’s so good to leave Basic IDE?
  44. 44. Developers can store the source files with cloud sync servicescloud sync services, and access their source files EVERYWHERE!
  45. 45. Developers can apply version control systemversion control system to manage their source files. CVSCVS
  46. 46. Developers can host their projectshost their projects on common project hosting services.
  47. 47. Developers can apply build toolsbuild tools to automate extension packaging, unit tests, and releases. makemake
  48. 48. In addition, with the build tools, we can establish project layout rulesproject layout rules and templatestemplates to simplify and automate project management. makemake
  49. 49. Take my Pokémon GO IV Calculator for example.
  50. 50. Pokémon GO IV Calculator ● It is entirely in my folder. – I work seamlessly on my PC and my laptop.
  51. 51. Pokémon GO IV Calculator ● It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard disk dies.
  52. 52. Pokémon GO IV Calculator ● It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard disk dies. ● I use for version control.
  53. 53. Pokémon GO IV Calculator ● It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard disk dies. ● I use for version control. ● I host my project on .
  54. 54. Pokémon GO IV Calculator ● It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard disk dies. ● I use for version control. ● I host my project on . ● I use with a build.xml and a fixed project template to build and release.
  55. 55. Pokémon GO IV Calculator Project Structure rootroot PokemonGoIVPokemonGoIV oxtoxt META-INFMETA-INF PokemonGoIVPokemonGoIV pkg-descpkg-desc Main.vb, …etc. Addons.xcu description.xml build.xml README VERSION Main.vb, …etc.manifest.xml pkg-description.txt Main.xba, …etc.
  56. 56. Try obasync! PyPI: pypi.python.org/pypi/obasync GitHub: github.com/imacat/obasync For an example project using obasync, check the Office Pokémon GO IV Calculator on GitHub: github.com/imacat/pokemongoiv
  57. 57. Thank you. Any questions?

×