The "Favorites" extension
Posted: Tue Jun 23, 2020 6:44 am
The Recent Documents menu gives quick access to documents, and it is dynamic. As documents are used they appear at the top. Older documents fall off the bottom. Some people would like a static system which does not reorganize itself. The easiest way is to create a directory with your operating system's file manager and store favorite documents there. Double-clicking them opens them in OpenOffice. One can either put the actual documents in the directory or put links to them. To create links, use the procedures for your operating system.
As a project, I wanted to see if I could build a Favorites system inside OpenOffice. I found this was fairly easy to do, that is, until I wanted to open a password protected document. This gets more complicated because my system must prompt for the password, and that required learning about dialogs, controls, models, focus, context, events, command buttons, etc. This was all new to me, and it took a long time to discover how these objects work, but it was a fun project and I have packaged it as an extension after reading JeJe's tutorial. My extension is only about 70 lines of Basic. The initial version, which couldn't open password-protected documents, was 20 lines of Basic.
The extension allows me to create a Load menu with the Tools → Customize dialog which contains an entry for each favorite. I added it to the File menu. I have one new menu, but you may want to have several. These menus can be nested or not, as you like, since you get to create them yourself. A feature is that each component (Writer, Calc, …) has its own menu tree, thus menu entries built in Writer do not appear when you are using Calc. But creation of the menus for a new component is very easy (just step G) after they have been created for the first component.
This is a summary of using the extension. The steps are discussed in detail below.
• Download, then install the Favorites extension
• Create a new, empty macro module for yourself
• Create (type or copy/paste) a 4-line macro for each of your favorites
• Build the File → Load menu, then add entries to it for your favorites
Lets say we have two favorites, ABC.ods with no password and password-protected DEF.ods. These happen to be spreadsheets but they can also be text documents, presentations, etc. Favorites can also be template documents.
A. Download, then install the Favorites extension:
Tools → Extension Manager → Add → Favorites.oxt → Open → Close
B. Create a new macro module (My Macros → Standard → Load) for yourself:
Tools → Macros → Organize Macros → OpenOffice Basic → Organizer → Modules
With My Macros → Standard selected, click New
Name:Load → OK
C. Remove the default macro template in the new module:
With My Macros → Standard → Load selected, click Edit
Edit → Select All
Edit → Cut
As a project, I wanted to see if I could build a Favorites system inside OpenOffice. I found this was fairly easy to do, that is, until I wanted to open a password protected document. This gets more complicated because my system must prompt for the password, and that required learning about dialogs, controls, models, focus, context, events, command buttons, etc. This was all new to me, and it took a long time to discover how these objects work, but it was a fun project and I have packaged it as an extension after reading JeJe's tutorial. My extension is only about 70 lines of Basic. The initial version, which couldn't open password-protected documents, was 20 lines of Basic.
The extension allows me to create a Load menu with the Tools → Customize dialog which contains an entry for each favorite. I added it to the File menu. I have one new menu, but you may want to have several. These menus can be nested or not, as you like, since you get to create them yourself. A feature is that each component (Writer, Calc, …) has its own menu tree, thus menu entries built in Writer do not appear when you are using Calc. But creation of the menus for a new component is very easy (just step G) after they have been created for the first component.
This is a summary of using the extension. The steps are discussed in detail below.
• Download, then install the Favorites extension
• Create a new, empty macro module for yourself
• Create (type or copy/paste) a 4-line macro for each of your favorites
• Build the File → Load menu, then add entries to it for your favorites
Lets say we have two favorites, ABC.ods with no password and password-protected DEF.ods. These happen to be spreadsheets but they can also be text documents, presentations, etc. Favorites can also be template documents.
A. Download, then install the Favorites extension:
Tools → Extension Manager → Add → Favorites.oxt → Open → Close
B. Create a new macro module (My Macros → Standard → Load) for yourself:
Tools → Macros → Organize Macros → OpenOffice Basic → Organizer → Modules
With My Macros → Standard selected, click New
Name:Load → OK
C. Remove the default macro template in the new module:
With My Macros → Standard → Load selected, click Edit
Edit → Select All
Edit → Cut