OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki
OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki
OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Overview of Central Interfaces 72<br />
MsgBox "Sheet1 not available"<br />
End If<br />
com. sun. star. container. XNameContainer Interface<br />
The XNameContainer interface takes on the insertion, deletion and modification of<br />
subordinate elements in a basic object. The functions responsible are insertByName,<br />
removeByName and replaceByName.<br />
The following is a practical example of this. It calls a text document, which contains a<br />
StyleFamilies object and uses this to in turn make the paragraph templates<br />
(ParagraphStyles) of the document available.<br />
Dim StyleFamilies As Object<br />
Dim ParagraphStyles As Object<br />
Dim NewStyle As Object<br />
StyleFamilies = Textdoc.StyleFamilies<br />
ParagraphStyles = StyleFamilies.getByName("ParagraphStyles")<br />
ParagraphStyles.insertByName("NewStyle", NewStyle)<br />
ParagraphStyles.replaceByName("ChangingStyle", NewStyle)<br />
ParagraphStyles.removeByName("OldStyle")<br />
The insertByName line inserts the NewStyle style under the name of the same name in the<br />
ParagraphStyles object. The replaceByName line changes the object behind ChangingStyle<br />
into NewStyle. Finally, the removeByName call removes the object behind OldStyle from<br />
ParagraphStyles.<br />
Index- Based Access to Subordinate Objects<br />
The XIndexAccess and XIndexContainer interfaces are used in objects which contain<br />
subordinate objects and which can be addressed using an index.<br />
XIndexAccess provides the methods for accessing individual objects. XIndexContainer<br />
provides methods for inserting and removing elements.<br />
com. sun. star. container. XIndexAccess Interface<br />
XIndexAccess provides the getByIndex and getCount methods for calling the subordinate<br />
objects. getByIndex provides an object with a particular index. getCount returns how many<br />
objects are available.<br />
Dim Sheets As Object<br />
Dim Sheet As Object<br />
Dim I As Integer<br />
Sheets = Spreadsheet.Sheets