Spotlight | Reviews | Current Issue | Academy | Newsletter | Subscribe | Shop |
Departments

Yatego Shopping
Yatego International
Germany's Shoppingmall No.1! 10000 Shops and over 3,4 Mio. Products. Computer, Software and Technic Guidebooks.

user friendly

Admin Magazine

ADMIN Network & Security

Subscribe now and save!

 ADMIN - Explore the new world of system administration! ADMIN is a smart, technical magazine for IT pros on heterogeneous networks. Each issue delivers technical solutions to the real-world problems you face every day. Learn the latest techniques for better:

  • network security
  • system management
  • troubleshooting
  • performance tuning
  • virtualization
  • cloud computing

 on Windows, Linux, Solaris, and popular varieties of Unix.

http://www.admin-magazine.com/

  linuxpromagazine.com » Issues » 2008 » 94 » Workspace: OpenOffice.org Bookmarks  

Print this page. Recommend
Share

BookmarkDocument Macro

Next comes the BookmarkDocument macro. OpenOffice.org Basic comes with the FilePicker service that can do the heavy lifting for you. This service displays a file picker dialog, which allows the user to select a document. To initiate and execute the service, you need only two lines of code:

FilePicker=createUnoService("com.sun.star.ui.dialogs.FilePicker")
FilePicker.execute

Because the bookmark manager handles only word processing documents, it's a good idea to add a filter to it so the user won't be allowed to choose files in other formats, which is exactly what the With … End With code block does.

After the user has selected a file, the macro extracts the file's name. To do this, the macro uses the DisplayDirectory property to obtain the file's path and the Right and Len string routines to extract the file's name from the path.

Next, the macro establishes a connection to the BookmarkDB database and inserts the obtained file name and path in the appropriate fields in the files table with the INSERT INTO SQL statement.

The OpenDocument macro starts by establishing the connection to the BookmarkDB database and uses an SQL query to obtain all the records (bookmarks) from the files table. Then the macro calls the BookmarkDialog dialog and populates the listbox in it with the file names.

When the user selects a file from the list and presses the Open button, the macro uses the file name as part of the following query to find the appropriate record:

SQLQuery="SELECT ""FilePath"" FROM ""files"" WHERE ""FileName""=" & "'" & CurrentItemName &"'"

Finally, the macro passes the obtained file path to the Shell statement, which opens it with OpenOffice.org Writer.

Final Word

One major advantage of this DIY bookmark manager is that you can tweak it any way you want. For example, you can add an input box to the BookmarkDocument macro that prompts you to enter tags for the selected document. Then you can modify the OpenDocument macro to display only bookmarks matching a specific tag.

With a few simple tweaks, the bookmark manager can be used to launch applications. In other words, with the basic bookmark manager in place, there are virtually no limits to what you can do with it.

Infos

  1. OpenOffice.org Bookmarks Menu extension: http://extensions.services.openoffice.org/project/bookmarksmenu

The Author

Dmitri Popov holds a degree in Russian language and computer linguistics. He has been writing exclusively about Linux and open source software for several years, and his articles have appeared in Danish, British, North American, German, and Russian magazines and websites.

Read full article as PDF » 084-086_workspace.pdf 365.56 kB


Comments


Print this page. Recommend
Share
No More Downloads!

Save the download and take Linux Magazine DVDs instead.

Each DVD contains a full distro like Ubuntu, SUSE, Mandriva, Fedora, or Debian and comes with the corresponding issue of Linux Magazine.

Don't waste time downloading Linux!

more...