21.08.2013 Views

OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki

OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki

OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The StarDesktop 76<br />

The name of the StarDesktop object dates back to StarOffice 5, in which all document<br />

windows were embedded in one common application called StarDesktop. In the present<br />

version of <strong>OpenOffice</strong>.<strong>org</strong>, a visible StarDesktop is no longer used. The name StarDesktop<br />

was, however, retained for the frame object of <strong>OpenOffice</strong>.<strong>org</strong> because it clearly indicates<br />

that this is a basic object for the entire application.<br />

The StarDesktop object replaces the Application object of StarOffice 5 which previously<br />

applied as a root object. However, unlike the old Application object, StarDesktop is<br />

primarily responsible for opening new documents. The functions resident in the old<br />

Application object for controlling the on-screen depiction of <strong>OpenOffice</strong>.<strong>org</strong> (for example,<br />

FullScreen, FunctionBarVisible, Height, Width, Top, Visible) are no longer used.<br />

Whereas the active document in Word is accessed through Application.ActiveDocument and in Excel<br />

through Application.ActiveWorkbook, in <strong>OpenOffice</strong>.<strong>org</strong>, the StarDesktop is responsible for this task.<br />

The active document object is accessed in <strong>OpenOffice</strong>.<strong>org</strong> through the StarDesktop.CurrentComponent<br />

property, or through ThisComponent.<br />

ThisComponent<br />

The global name ThisComponent generally returns the same object as<br />

StarDesktop.CurrentComponent, with one significant advantage. If you are running from<br />

within the Basic IDE, debugging or exploring, then StarDesktop returns the Basic IDE<br />

itself. This is probably not what you want. ThisComponent returns the last previously active<br />

document.<br />

Basic Information about Documents in <strong>OpenOffice</strong>. <strong>org</strong><br />

When working with <strong>OpenOffice</strong>.<strong>org</strong> documents, it is useful to deal with some of the basic<br />

issues of document administration in <strong>OpenOffice</strong>.<strong>org</strong>. This includes the way in which file<br />

names are structured for <strong>OpenOffice</strong>.<strong>org</strong> documents, as well as the format in which files are<br />

saved.<br />

File Names in URL Notation<br />

Since <strong>OpenOffice</strong>.<strong>org</strong> is a platform-independent application, it uses URL notation (which is<br />

independent of any operating system), as defined in the Internet Standard RFC 1738 for file<br />

names. Standard file names using this system begin with the prefix file:/// followed by the<br />

local path. If the file name contains sub-directories, then these are separated by a single<br />

forward slash, not with a backslash usually used under Windows. The following path<br />

references the test.odt file in the doc directory on the C: drive.<br />

file:///C:/doc/test.odt<br />

To convert local file names into an URL, <strong>OpenOffice</strong>.<strong>org</strong> provides the ConvertToUrl<br />

function. To convert a URL into a local file name, <strong>OpenOffice</strong>.<strong>org</strong> provides the<br />

ConvertFromUrl function:<br />

MsgBox ConvertToUrl("C:\doc\test.odt")<br />

' supplies file:///C:/doc/test.odt<br />

MsgBox ConvertFromUrl("file:///C:/doc/test.odt")

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!