List of Listings


Chapter 1: Getting Started

Listing 1: The "Hello World" routines are found in this chapter's source code files as SC01.sxw.

Chapter 2: Language Constructs

Listing 1: OpenOffice.org runs one line of a macro at a time.
Listing 2: Append an underscore to the end of a line to continue on the next line.
Listing 3: Set the variables x, y, and z to zero.
Listing 4: You should add comments to all of the macros that you write.
Listing 5: OOo Basic does not generate a compilation error. Depending on the OOo version, a run-time error may be generated or the error may be ignored.
Listing 6: Use Option Explicit before the first runnable line in a macro.
Listing 7: Declare untyped variables starting with i, j, k, or n to be of type Integer.
Listing 8: ExampleBooleanType is found in the Variables module in this chapter's source code files as SC02.sxw.
Listing 9: ExamplelntegerType is found in the Variables module in this chapter's source code files as SC02.sxw.
Listing 10: ExampleLongType is found in the Variables module in this chapter's source code files as SC02.sxw.
Listing 11: ExampleCurrencyType is found in the Variables module in this chapter's source code files as SC02.sxw.
Listing 12: ExampleSingleType is found in the Variables module in this chapter's source code files as SC02.sxw.
Listing 13: ExampleDoubleType is found in the Variables module in this chapter's source code files as SC02.sxw.
Listing 14: ExampleStringType is found in the Variables module in this chapter's source code files as SC02.sxw.
Listing 15: ExampleDateType is found in the Variables module in this chapter's source code files as SC02.sxw.
Listing 16: You can define your own data types.
Listing 17: ExampleTestVariants is found in the Variables module in this chapter's source code files as SC02.sxw.
Listing 18: ExampleSimpleArray1 is found in the Variables module in this chapter's source code files as SC02.sxw.
Listing 19: ExampleArray is found in the Variables module in this chapter's source code files as SC02.sxw.
Listing 20: Parentheses are not always required but are always allowed.
Listing 21: ExampleDimArray is found in the Variables module in this chapter's source code files as SC02.sxw.
Listing 22: ArrayToString and ExampleReDimPreserve are found in the Variables module in this chapter's source code files as SC02.sxw.
Listing 23: ExampleArrayCopylsRef is found in the Variables module in this chapter's source code files as SC02.sxw.
Listing 24: ExampleSetIntArray is found in the Variables module in this chapter's source code files as SC02.sxw.
Listing 25: ExampleParamTest1 is found in the SubAndFunction module in this chapter's source code files as SC02.sxw.
Listing 26: ExampleParamValAndRef is found in the SubAndFunction module in this chapter's source code files as SC02.sxw.
Listing 27: ExampleArgOptional is found in the SubAndFunction module in this chapter's source code files as SC02.sxw.
Listing 28: DoFactorial is found in the SubAndFunction module in this chapter's source code files as SC02.sxw.
Listing 29: ExampleStatic is found in the Scope module in this chapter's source code files as SC02.sxw.
Listing 30: Strings are automatically converted to numbers when required.
Listing 31: ExampleExponent is found in the Operators module in this chapter's source code files as SC02.sxw.
Listing 32: ExampleMultDiv is found in the Operators module in this chapter's source code files as SC02.sxw.
Listing 33: This is a definition of the MOD operator for integer operands x and y.
Listing 34: ExampleMod is found in the Operators module in this chapter's source code files as SC02.sxw.
Listing 35: ExamplelntDiv is found in the Operators module in this chapter's source code files as SC02.sxw.
Listing 36: LogicalOperandsAreLongs is found in the Operators module in this chapter's source code files as SC02.sxw.
Listing 37: IntToBinaryString is found in the Operators module in this chapter's source code files as SC02.sxw.
Listing 38: ExampleOpAND is found in the Operators module in this chapter's source code files as SC02.sxw.
Listing 39: ExampleOpOR is found in the Operators module in this chapter's source code files as SC02.sxw.
Listing 40: ExampleOpXOR is found in the Operators module in this chapter's source code files as SC02.sxw.
Listing 41: ExampleOpEQV is found in the Operators module in this chapter's source code files as SC02.sxw.
Listing 42: ExampleOpIMP is found in the Operators module in this chapter's source code files as SC02.sxw.
Listing 43: ExampleGoSub is found in the FlowControl module in this chapter's source code files as SC02.sxw.
Listing 44: ExampleGoTo is found in the FlowControl module in this chapter's source code files as SC02.sxw.
Listing 45: ExampleOnGoTo is found in the FlowControl module in this chapter's source code files as SC02.sxw.
Listing 46: Examplelf is found in the FlowControl module in this chapter's source code files as SC02.sxw.
Listing 47: A division-by-zero error occurs even though 1/(i-2) should be returned.
Listing 48: ExampleChoose is found in the FlowControl module in this chapter's source code files as SC02.sxw.
Listing 49: The keyword IS is optional.
Listing 50: "Case IS > 8 AND i < 11" reduces incorrectly.
Listing 51: If x is a String value, this will work for any Boolean expression.
Listing 52: If x is a numerical value, this will work for any Boolean expression.
Listing 53: This code uses XOR and NOT in a Case statement.
Listing 54: ExampleSelectCase is found in the FlowControl module in this chapter's source code files as SC02.sxw.
Listing 55: ExampleDo is found in the FlowControl module in this chapter's source code files as SC02.sxw.
Listing 56: ExampleForNextSort is found in the FlowControl module in this chapter's source code files as SC02.sxw.
Listing 57: The error is cleared by the Resume Next statement.
Listing 58: The error is cleared by the Resume Next statement.
Listing 59: The error handler is cleared with the statement On Error GoTo 0.
Listing 60: ExampleJumpErrorHandler is found in the ErrorHandler module in this chapter's source code files as SC02.sxw.
Listing 61: Skip sections of code when an error occurs.
Listing 62: ExampleResumeHandler is found in the ErrorHandler module in this chapter's source code files as SC02.sxw.
Listing 63: ArrayHasStuff is found in the ErrorHandler module in this chapter's source code files as SC02.sxw.
Listing 64: CopyAFile is found in the ErrorHandler module in this chapter's source code files as SC02.sxw.

Chapter 3: Numerical Routines

Listing 1: Example Trigonmetric is found in the Array module in this chapter's source code files as SC03.sxw.
Listing 2: Rounding errors and finite precision prevent this from stopping.
Listing 3: Avoid rounding errors by using >= (greater than or equal to).
Listing 4: Compare the variable to a range.
Listing 5: Single-precision variables have only seven or eight digits of accuracy.
Listing 6: Single-precision variables have only seven or eight digits of accuracy.
Listing 7: AreSameNumber is found in the Numerical module in this chapter's source code files as SC03.sxw.
Listing 8: CheckSameNumber is found in the Numerical module in this chapter's source code files as SC03.sxw.
Listing 9: LogBase is found in the Numerical module in this chapter's source code files as SC03.sxw.
Listing 10: Clnt and CLng ignore non-numeric values.
Listing 11: CInt interprets the number as a Long, then converts to an Integer.
Listing 12: ExampleCLngWithHex is found in the Numerical module in this chapter's source code files as SC03.sxw.
Listing 13: The Val function is the inverse of the Str function.
Listing 14: ExampleValWithHex is found in the Numerical module in this chapter's source code files as SC03.sxw.
Listing 15: Output from CStr is locale specific; this is English (USA).
Listing 16: Output from Str is not dependent upon locale.
Listing 17: Output from CStr is locale specific; this is German (Germany).
Listing 18: IntToBinaryString is found in the Numerical module in this chapter's source code files as SC03.sxw.
Listing 19: BinaryStringToLong is found in the Numerical module in this chapter's source code files as SC03.sxw.
Listing 20: ExampleWholeNumberConversions is found in the Numerical module in this chapter's source code files as SC03.sxw.
Listing 21: RndRange is found in the Numerical module in this chapter's source code files as SC03.sxw.

Chapter 4: Array Routines

Listing 1: Parentheses are not always required but are always allowed.
Listing 2: The Array function returns a Variant array.
Listing 3: It's cumbersome to extract data from an array contained in another array.
Listing 4: It is easier to use multi-dimensioned arrays than arrays inside of arrays.
Listing 5: DimArray returns a dimensioned Variant array that contains no data.
Listing 6: ExampleReDimPreserve is found in the Array module in this chapter's source code files as SC04.sxw.
Listing 7: SafeUBound is found in the Array module in this chapter's source code files as SC04.sxw.
Listing 8: ArrayInfo is found in the Array module in this chapter's source code files as SC04.sxw.

Chapter 5: Date Routines

Listing 1: IsDate verifies that a string contains a valid date.
Listing 2: ExampleTimeConversions is found in the Date module in this chapter's source code files as SC05.sxw.
Listing 3: CDate returns a date and a time; DateValue removes the time.
Listing 4: DateValue unexpectedly truncates dates before December 29,1899.
Listing 5: Round toward negative infinity and convert it to a Date.
Listing 6: Round toward negative infinity and convert it to a Date.
Listing 7: Print date- related information dependent on current locale.
Listing 8: Convert to and from ISO date format.
Listing 9: WeekDayText is found in the Date module in this chapter's source code files as SC05.sxw.
Listing 10: DateSerial adds 1900 to years earlier than 100.
Listing 11: DateSerial accepts Gregorian dates before 10/15/1582.
Listing 12: ExampleElapsedTime is found in the Date module in this chapter's source code files as SC05.sxw.
Listing 13: GCD_1 is found in the Date module in this chapter's source code files as SC05.sxw.
Listing 14: GCD_2 is found in the Date module in this chapter's source code files as SC05.sxw.
Listing 15: GCD_2 is found in the Date module in this chapter's source code files as SC05.sxw.

Chapter 6: String Routines

Listing 1: StringToASCII is found in the String module in this chapter's source code files as SC06.sxw.
Listing 2: SelectedTextAsASCII is found in the String module in this chapter's source code files as SC06.sxw.
Listing 3: Strings can contain up to 65,535 characters ; this is too large for an integer argument.
Listing 4: ReplacelnString is found in the String module in this chapter's source code files as SC06.sxw.
Listing 5: ExampleLSetAndRSet is found in the String module in this chapter's source code files as SC06.sxw.
Listing 6: ExampleFormat is found in the String module in this chapter's source code files as SC06.sxw.

Chapter 7: File Routines

Listing 1: Use GetPathSeparator() rather than "\" or"/".
Listing 2: ExampleCurDir is found in the File module in this chapter's source code files as SC07.sxw.
Listing 3: In this example, only "/home/andy" existed previously.
Listing 4: FileAttributeString is found in the File module in this chapter's source code files as SC07.sxw.
Listing 5: PrettyFileLen is found in the File module in this chapter's source code files as SCO7.sxw.
Listing 6: GetFilelnfo is found in the File module in this chapter's source code files as SCO7.sxw.
Listing 7: ExampleDir is found in the File module in this chapter's source code files as SC07.sxw.
Listing 8: LargestFigureForChapter is found in the File module in this chapter's source code files as SC07.sxw.
Listing 9: GetOpenFilelnfo is found in the File module in this chapter's source code files as SC07.sxw.
Lising 10: WriteExampleGetOpenFilelnfo is found in the File module in this chapter's source code files as SC07.sxw.
Listing 11: ExampleInput is found in the File module in this chapter's source code files as SC07.sxw.
Lising 12: ExampleReadWriteBinaryFile is found in the File module in this chapter's source code files as SC07.sxw.
Lising 13: ExampleReadWriteRandomFile is found in the File module in this chapter's source code files as SC07.sxw.

Chapter 8: Miscellaneous Routines

Listing 1: DisplayGUIType is found in the Misc module in this chapter's source code files as SC08.sxw.
Listing 2: DisplayPixelSize is found in the Misc module in this chapter's source code files as SC08.sxw.
Listing 3: The IIF function, if you wrote it yourself.
Listing 4: If the denominator is zero, the division does not occur.
Listing 5: ExampleIIF is found in the Misc module in this chapter's source code files as SC08.sxw.
Listing 6: ExampleChoose is found in the Misc module in this chapter's source code files as SC08.sxw.
Listing 7: ExampleWait is found in the Misc module in this chapter's source code files as SC08.sxw.
Listing 8: ExampleCallDLL is found in the Misc module in this chapter's source code files as SC08.sxw.
Listing 9: Use DDE as a Calc function to extract cell A1 from a document.
Listing 10: ExampleDDE is found in the Misc module in this chapter's source code files as SC08.sxw.
Listing 11: ExamplePrint is found in the Misc module in this chapter's source code files as SC08.sxw.
Listing 12: New lines print in their own dialog.
Listing 13: ExampleMsgBoxWithReturn is found in the Misc module in this chapter's source code files as SC08.sxw.
Listing 14: The MsgBox function can accept a type and a dialog title.
Listing 15: ExampleMsgBox is found in the Misc module in this chapter's source code files as SC08.sxw.
Listing 16: ExampleInputBox is found in the Misc module in this chapter's source code files as SC08.sxw.
Listing 17: ExampleInputError is found in the Misc module in this chapter's source code files as SC08.sxw.
Listing 18: Create an object using CreateObject or Dim As New.
Listing 19: Dim a PropertyValue and use CreateObject to create a new one.
Listing 20: ExampleReDimPreserveProp is found in the Misc module in this chapter's source code files as SC08.sxw.
Listing 21: You can add PropertyValue variables to a declared array.
Listing 22: ExampleCopyAsValue is found in the Misc module in this chapter's source code files as SC08.sxw.
Listing 23: Use IsArray to see if a variable is an array.
Listing 24: IsDate verifies that a string contains a valid date.
Listing 25: IsNumeric is very picky about what it accepts.
Listing 26: ExampleTypes is found in the Misc module in this chapter's source code files as SC08.sxw.
Listing 27: ExampleTypes is found in the Misc module in this chapter's source code files as SC08.sxw.

Chapter 9: Universal Network Objects

Listing 1: ManagerCreatesAService is found in the UNO module in this chapter's source code files as SC09.sxw.
Listing 2: ChooseAFileName is found in the UNO module in this chapter's source code files as SC09.sxw.
Listing 3: HowManyServicesSupported is found in the UNO module in this chapter's source code files as SC09.sxw.
Listing 4: Inspect the TextTables object on the current document.
Listing 5: Use HasUnoInterfaces and IsUnoStruct to determine the UNO type.
Listing 6: Verify that the document is a Writer document.
Listing 7: getDocType is found in the UNO module in this chapter's source code files as SC09.sxw.
Listing 8: The "dbg_" properties return useful information.
Listing 9: DisplayDbgInfoStr and ExampleDisplayDbgInfoStr are found in the UNO module in this chapter's source code files as SC09.sxw.
Listing 10: DisplayAllStyles is found in the UNO module in this chapter's source code files as SC09.sxw.
Listing 11: Iterate ThroughAllDocs is found in the UNO module in this chapter's source code files as SC09.sxw.
Listing 12: ExamineDocumentLibraries is found in the UNO module in this chapter's source code files as SC09.sxw.
Listing 13: Use CreateUnoValue to create a reference to an internal UNO value.
Listing 14: TestFindObject is found in the UNO module in this chapter's source code files as SC09.sxw.
Listing 15: first_listen_disposing is found in the UNO module in this chapter's source code files as SC09. sxw.
Listing 16: MyFirstListener is found in the UNO module in this chapter's source code files as SC09.sxw.
Listing 17: InspectListenerMethods is found in the UNO module in this chapter's source code files as SC09.sxw.
Listing 18: sel_change_disposing and sel_change_selectionChanged are found in the UNO module in this chapter's source code files as SC09.sxw.
Listing 19: StartListeningToSelChangeEvents is found in the UNO module in this chapter's source code files as SC09.sxw.
Listing 20: StopListeningToSelChangeEvents is found in the UNO module in this chapter's source code files as SC09.sxw.
Listing 21: DisplayObjectlnformation is found in the UNO module in this chapter's source code files as SC09.sxw.
Listing 22: Dlg_GetObjTypelnfo is found in the UNO module in this chapter's source code files as SC09.sxw.
Listing 23: Dlg_DisplayDbgInfoStr is found in the UNO module in this chapter's source code files as SC09.sxw.

Chapter 10: UNO and the Dispatcher

Listing 1: A struct may contain other structs.
Listing 2: The DispatchHelper service greatly simplifies executing dispatches.
Listing 3: NewUndo is found in the Module1 module in this chapter's source code files as SC10.sxw.
Listing 4: Dispatch to a numeric slot.
Listing 5: Dispatch commands can use arguments.
Listing 6: CreateOutlinelnlmpress is found in the Module1 module in this chapter's source code files as SC10.sxw.

Chapter 11: StarDesktop

Listing 1: Print the title of the current frame.
Listing 2: DisplayFrameTitles is found in the Desktop module in this chapter's source code files as SC11.sxw.
Listing 3: Constant names are not case sensitive.
Listing 4: QueryFrames is in the Desktop module in this chapter's source code files as SC11.sxw.
Listing 5: The safe way to close a document using any version of OOo.
Listing 6: EnumerateComponentNames is found in the Desktop module in this chapter's source code files as SC11.sxw.
Listing 7: ThisComponent references the current OOo document.
Listing 8: DisplayDocModifiedBy is found in the Desktop module in this chapter's source code files as SC11.sxw.
Listing 9: Use one of these two methods to cause oDoc2 to become the focused document.
Listing 10: ShrinkWindowBy75 is found in the Desktop module in this chapter's source code files as SC11.sxw.
Listing 11: LoadMacroDocFromHttp is found in the Desktop module in this chapter's source code files as SC11.sxw.
Listing 12: LoadEmptyDocuments is found in the Desktop module in this chapter's source code files as SC11.sxw.
Listing 13: UseAnExistingFrame is found in the Desktop module in this chapter's source code files as SC11.sxw.
Listing 14: ReuseAFrame is found in the Desktop module in this chapter's source code files as SC11.sxw.
Listing 15: Load a document as a template.
Listing 16: Load a document as a template and enable contained macros.
Listing 17: Specify the filter name while loading a document.
Listing 18: Export the current document, assuming it is a Writer document, as PDF.
Listing 19: The DIF, dBase, and Lotus filters all use the same filter option.
Listing 20: The CSV filter options are complicated.
Listing 21: Delimited-text-format string for the CSV filter.
Listing 22: Fixed-width- columns format string for the CSV filter.

Chapter 12: Generic Document Methods

Listing 1: Two methods to obtain the name of the font style.
Listing 2: getPropertyValues is found in the Generic module in this chapter's source code files as SC12.sxw.
Listing 3: GetUserlnfoFields is found in the Generic module in this chapter's source code files as SC12.sxw.
Listing 4: GetEventListeners is found in the Generic module in this chapter's source code files as SC12.sxw.
Listing 5: GetJumpTargets is found in the Generic module in this chapter's source code files as SC12.sxw.
Listing 6: Use the JumpMark property to jump to a link target.
Listing 7: Use the JumpMark property to jump to a link target.
Listing 8: GetViewData is found in the Generic module in this chapter's source code files as SC12.sxw.
Listing 9: The safe way to close a document.
Listing 10: Export each graphics page to a JPG.
Listing 11: AddProportionalGraphic is found in the Generic module in this chapter's source code files as SC12.sxw.
Listing 12: DrawLinesInDrawDocument is found in the Generic module in this chapter's source code files as SC12.sxw.
Listing 13: DrawLinesInWriteDocument is found in the Generic module in this chapter's source code files as SC12.sxw.
Listing 14: printDocumentArgs is found in the Generic module in this chapter's source code files as SC12.sxw.
Listing 15: Proper method to save a document.
Listing 16: Save a document to a new location.
Listing 17: Save the document with an inappropriate file extension.
Listing 18: Export a document to the specified Microsoft Excel file format.
Listing 19: Export the first draw page to a JPG file.
Listing 20: DisplayAllStyles is found in the Generic module in this chapter's source code files as SC12.SXW.
Listing 21: DisplayAllUsedParagraphStyles is found in the Generic module in this chapter's source code files as SC12.sxw.
Listing 22: StyleProperties is found in the Generic module in this chapter's source code files as SC12.sxw.
Listing 23: PrintPagelnformation is found in the Generic module in this chapter's source code files as SC12.sxw.
Listing 24: Set a simple Writer document to use a French locale.
Listing 25: SpellCheckExample is found in the Generic module in this chapter's source code files as SC12.sxw.
Listing 26: OOoLang() is found in the Generic module in this chapter's source code files as SC12.sxw.
Listing 27: DisplayPrinterProperties is found in the Generic module in this chapter's source code files as SC12.sxw.
Listing 28: Print pages 30 and 31 of the current document.
Listing 29: DisplayPagePrintProperties is found in the Generic module in this chapter's source code files as SC12.sxw.
Listing 30: PrintTwoPerPage is found in the Generic module in this chapter's source code files as SC12.sxw.
Listing 31: Print a spreadsheet at 25 percent; this is very small!
Listing 32: Set and print multiple ranges in a Calc document.
Listing 33: Create an object that supports the DocumentSettings service.
Listing 34: WriteDocumentSettings is found in the Generic module in this chapter's source code files as SC12.sxw.

Chapter 13: Writer Documents

Listing 1: Text documents support the com.sun.star.text.TextDocument service.
Listing 2: Get and set the entire document text with no formatting.
Listing 3: Insert simple text at the start and end of the document.
Listing 4: Insert text content (a text table) at the end of the current document.
Listing 5: Clear the entire document of all text content.
Listing 6: enumerateParagraphs is in the Writer module in this chapter's source code files as SC13.sxw.
Listing 7: This code fails because ParaLineSpacing is a structure.
Listing 8: This works because it makes a copy and then copies it back.
Listing 9: SetPageBreakAtEndFromEnumeration is found in the Writer module in this chapter's source code files as SC13.sxw.
Listing 10: CleanCodeStyles is found in the Writer module in this chapter's source code files as SC13.sxw.
Listing 11: ViewFontRelief is found in the Writer module in this chapter's source code files as SC13.sxw.
Listing 12: EnumerateTextSections is found in the Writer module in this chapter's source code files as SC13.sxw.
Listing 13: ScrollDown One Screen is found in the Writer module in this chapter's source code files as SC13.sxw.
Listing 14: Insert the character with Unicode value 257 at the current cursor.
Listing 15: Example of incorrect use of cursors : This code misses the last paragraph in the document.
Listing 16: The correct way to use cursors.
Listing 17: CollectSimpleStatistics is found in the Writer module in this chapter's source code files as SC13.sxw.
Listing 18: LineBreaksInParagraph is found in the Writer module in this chapter's source code files as SC13.sxw.
Listing 19: Testing view cursor properties.
Listing 20: TextFieldInCurrentParagraph is found in the Writer module in this chapter's source code files as SC13.sxw.
Listing 21: IsAnythingSelected is found in the Writer module in this chapter's source code files as SC13.sxw.
Listing 22: PrintMultipleTextSelection is found in the Writer module in this chapter's source code files as SC13.sxw.
Listing 23: GetLeftMostCursor and GetRightMostCursor are found in the Writer module in this chapter's source code files as SC13.sxw.
Listing 24: CreateSelectedTextlterator is found in the Writer module in this chapter's source code files as SC13.sxw.
Listing 25: PrintUnicodeExamples is found in the Writer module in this chapter's source code files as SC13.sxw.
Listing 26: IsWhiteSpace is found in the Writer module in this chapter's source code files as SC13.sxw.
Listing 27: RankChar is found in the Writer module in this chapter's source code files as SC13.sxw.
Listing 28: RemoveEmptySpace is found in the Writer module in this chapter's source code files as SC13.sxw.
Listing 29: RemoveEmptySpaceWorker is found in the Writer module in this chapter's source code files as SC13.sxw.
Listing 30: Set all occurrences of the word "hello" to bold text.
Listing 31: Iterate through all occurrences of text between two cursors.
Listing 32: Find and replace all occurrences of the word "helloxyzzy".
Listing 33: Reorder_Captions is found in the Writer module in this chapter's source code files as SC13.sxw.
Listing 34: Replace "hello you" with "hello me".
Listing 35: ReplaceFormatting is found in the Writer module in this chapter's source code files as SC13.sxw.
Listing 36: Insert a document at a text cursor.
Listing 37: LookAtAIITables is found in the Writer module in this chapter's source code files as SC13.sxw.
Listing 38: InsertDeleteTable is found in the Writer module in this chapter's source code files as SC13.sxw.
Listing 39: What if the table is not contained in the document's text object?
Listing 40: Two safe methods to delete the table.
Listing 41: A safe way to get a text object.
Listing 42: Join the array of strings to print the cell names in a table.
Listing 43: SimpleTableManipulations is found in the Writer module in this chapter's source code files as SC13.sxw.
Listing 44: Select an entire table using a cursor. This may fail for a complex table.
Listing 45: Place the cursor at the start of the first cell in the table.
Listing 46: Select the entire table in the current view.
Listing 47: CopyNamedTableToEnd is found in the Writer module in this chapter's source code files as SC 13.sxw.
Listing 48: DisplayFields is found in the Writer module in this chapter's source code files as SC13.sxw.
Listing 49: ShowFieldMasters is in the Writer module in this chapter's source code files as SC13.sxw.
Listing 50: InsertFields is in the Writer module in this chapter's source code files as SC13.sxw.
Listing 51: InsertFieldMaster is in the Writer module in this chapter's source code files as SC13.sxw.
Listing 51: AddBookmark is in the Writer module in this chapter's source code files as SC13.sxw.

Chapter 14: Calc Documents

Listing 1: Calc documents support the com.sun.star.sheet.SpreadsheetDocument service.
Listing 2: Obtain a com.sun.star.sheet.Spreadsheets service using a method or a property.
Listing 3: AccessSheets is found in the Calc module in this chapter's source code files as SC14.sxc.
Listing 4: These functions are found in the Calc module in this chapter's source code files as SC14.sxc.
Listing 5: Obtain the cell name using the CellAddressConversion service.
Listing 6: GetCellType is found in the Calc module in this chapter's source code files as SC14.sxc.
Listing 7: SimpleCellInfo and GetSetCells are found in the Calc module in this chapter's source code files as SC14.sxc.
Listing 8: Center "Hello" and rotate it 30 degrees.
Listing 9: To manipulate UserDefinedAttributes, use a copy and then assign it back.
Listing 10: CeIlDimensions is in the Calc module in this chapter's source code files as SC14.sxc.
Listing 11: SetValidationRange is in the Calc module in this chapter's source code files as SC14.sxc.
Listing 12: SetConditionalStyle is in the Calc module in this chapter's source code files as SC14.sxc.
Listing 13: NonEmptyCellsInRange is in the Calc module in this chapter's source code files as SC14.sxc.
Listing 14: QueryRange is in the Calc module in this chapter's source code files as SC14.sxc.
Listing 15: SearchSheet is in the Calc module in this chapter's source code files as SC14.sxc.
Listing 16: MergeExperiment is in the Calc module in this chapter's source code files as SC14.sxc.
Listing 17: TraverseRows is in the Calc module in this chapter's source code files as SC14.sxc.
Listing 18: GetAndSetData is in the Calc module in this chapter's source code files as SC14.sxc.
Listing 19: UseCompute is in the Calc module in this chapter's source code files as SC14.sxc.
Listing 20: Fill values from E11:N20 using fillAuto.
Listing 21: Fill values from E11:N20 using fillSeries().
Listing 22: ArrayFormula is in the Calc module in this chapter's source code files as SC14.sxc.
Listing 23: MultipleOpsColumns is in the Calc module in this chapter's source code files as SC14.sxc.
Listing 24: MultipleOpsBoth is in the Calc module in this chapter's source code files as SC14.sxc.
Listing 25: DisplaySimilarRanges is in the Calc module in this chapter's source code files as SC14.sxc.
Listing 26: SortCo/Zero is in the Calc module in this chapter's source code files as SC14.sxc.
Listing 27: SortColOne is in the Calc module in this chapter's source code files as SC14.sxc.
Listing 28: DisplaySortDescriptor is in the Calc module in this chapter's source code files as SC14.sxc.
Listing 29: LinkASheet is in the Calc module in this chapter's source code files as SC14.sxc.
Listing 30: Link cell A1 to K89 in another document.
Listing 31: Display one level of precedents .
Listing 32: Move the range L4:M5 down.
Listing 33: Copy the range L4:M5 to N8.
Listing 34: CreateDataPilotSource is in the Calc module in this chapter's source code files as SC14.sxc.
Listing 35: CreateDataPilotTable is in the Calc module in this chapter's source code files as SC14.sxc.
Listing 36: Simple cursor movement commands use contiguous blocks.
Listing 37: Some commands work only relative to the range.
Listing 38: GoalSeekExample is in the Calc module in this chapter's source code files as SC14.sxc.
Listing 39: WahooFunc is in the Calc module in this chapter's source code files as SC14.sxc.
Listing 40: Add all elements together.
Listing 41: CalcIsAnythingSelected is in the Calc module in this chapter's source code files as SC14.sxc.
Listing 42: SetRangeText is in the Calc module in this chapter's source code files as SC14.sxc.
Listing 43: SetSelectedCells is in the Calc module in this chapter's source code files as SC14.sxc.
Listing 44: I assign oSelections to a temporary variable before use.
Listing 45: Select B28:D33 and then select cell A1 instead.
Listing 46: Obtain the active cell.
Listing 47: ControlOOo() demonstrates how to control OOo from Excel.

Chapter 15: Draw and Impress Documents

Listing 1: Check for an Impress document before checking for a Draw document.
Listing 2: getPages is found in the Graphic module in this chapter's source code files as SC15.sxi.
Listing 3: createDrawPage is found in the Graphic module in this chapter's source code files as SC15.sxi.
Listing 4: drawFirstGraphic is found in the Graphic module in this chapter's source code files as SC15.sxi.
Listing 5: groupShapes is found in the Graphic module in this chapter's source code files as SC15.sxi.
Listing 6: unGroupShapes is found in the Graphic module in this chapter's source code files as SC15.sxi.
Listing 7: combineShapes is found in the Graphic module in this chapter's source code files as SC15.sxi.
Listing 8: bindShapes is found in the Graphic module in this chapter's source code files as SC15.sxi.
Listing 9: CreatePoint and CreateSize are found in the Graphic module in this chapter's source code files as SC15.sxi.
Listing 10: drawMeasureShape is found in the Graphic module in this chapter's source code files as SC15.sxi.
Listing 11: DrawClosedBezierShape is found in the Graphic module in this chapter's source code files as SC15.sxi.
Listing 12: drawRectangleWithShadow is found in the Graphic module in this chapter's source code files as SC15.sxi.
Listing 13: drawRectangleWithShadow is found in the Graphic module in this chapter's source code files as SC15.sxi.
Listing 14: SimpleLine is found in the Graphic module in this chapter's source code files as SC15.sxi.
Listing 15: Inspect the points used in a LineShape.
Listing 16: SimplePolyLineShape is found in the Graphic module in this chapter's source code files as SC15.sxi.
Listing 17: The PolyPolygon property is an array of arrays of points.
Listing 18: SimplePolyPolygonShape is found in the Graphic module in this chapter's source code files as SC15.sxi.
Listing 19: SimpleRectangleShape is found in the Graphic module in this chapter's source code files as SC15.sxi.
Listing 20: SimpleEllipseShapes is found in the Graphic module in this chapter's source code files as SC15.sxi.
Listing 21: ArcEllipseShapes is found in the Graphic module in this chapter's source code files as SC15.sxi.
Listing 22: DrawControlPoints is found in the Graphic module in this chapter's source code files as SC15.sxi.
Listing 23: DrawOpenBezierCurves is found in the Graphic module in this chapter's source code files as SC15.sxi.
Listing 24: DrawConnectorShape is found in the Graphic module in this chapter's source code files as SC15.sxi.
Listing 25: DrawConnectorShape_Glue is found in the Graphic module in this chapter's source code files as SC15.sxi.
Listing 26: PrintStyles is found in the Graphic module in this chapter's source code files as SC15.sxi.
Listing 27: DrawConnectorShape_Arrows is found in the Graphic module in this chapter's source code files as SC15.sxi.
Listing 28: AddAForm is found in the Graphic module in this chapter's source code files as SC15.sxi.
Listing 29: SimplePresentation is found in the Graphic module in this chapter's source code files as SC15.sxi.
Listing 30: CustomPresentation is found in the Graphic module in this chapter's source code files as SC15.sxi.
Listing 31: SetTransitionEffects is found in the Graphic module in this chapter's source code files as SC15.sxi.

Chapter 16: Library Management

Listing 1: Use GlobalScope to load application-level libraries.
Listing 2: Print Module l in the newly created TestLib library.
Listing 3: Obtain the Basic and the dialog library.
Listing 4: CreateAGlobalLib is in the Library module in this chapter's source code files as SC16.sxw.
Listing 5: AddOneLib is in the Installer module in this chapter's source code files as SC16.sxw.
Listing 6: AppLibToDocLib is in the Installer module in this chapter's source code files as SC16.sxw.

Chapter 17: Dialogs and Controls

Listing 1: The Print statement displays a modal dialog.
Listing 2: RunHelloDlg is in the Hello module in this chapter's source code files as SC17.sxw.
Listing 3: ExitHelloDlg is in the Hello module in this chapter's source code files as SC17.sxw.
Listing 4: What services can the dialog model create?
Listing 5: Get the button or the button's model.
Listing 6: RunOOMEDlg and OOMEDlgButton are in the DlgCode module in this chapter's source code files as SC17.sxw.
Listing 7: OOMEDIgCheckBox is in the DlgCode module in this chapter's source code files as SC17.sxw.
Listing 8: OOMEDlgRadioButton is in the DlgCode module in this chapter's source code files as SC17.sxw.
Listing 9: OOMEDIgColorBox is in the DlgCode module in this chapter's source code files as SC17.sxw.
Listing 10: Initialize a date control to today's date.
Listing 11: Extracting values from a time control.
Listing 12: Set a formatted control to use a date as "DD. MMM YYYY".
Listing 13: Edit mask and literal mask for a social security number.
Listing 14: FileButtonSelected is in the DlgCode module in this chapter's source code files as SC17.sxw.
Listing 15: Global variables for the Close button's initial position and size .
Listing 16: Save the initial button position and set the scroll bar's maximum value.
Listing 17: ScrollButton is in the DlgCode module in this chapter's source code files as SC17.sxw.
Listing 18: Identify and remove white space from a string.
Listing 19: ObjToString is in the Inspector module in this chapter's source code.
Listing 20: ObjInfoString is in the Inspector module in this chapter's source code.
Listing 21: SortMyArray is in the Inspector module in this chapter's source code.
Listing 22: Global variables defined in the Inspector module.
Listing 23: Create the dialog, the controls, and the listeners.
Listing 24: Create a control model and insert it into the dialog's model.
Listing 25: The event handler is very simple; it calls DisplayNewObject().
Listing 26: ProcessStateChange is in the Inspector module of this chapter's source code.
Listing 27: BuildItemArray is in the Inspector module of this chapter's source code.



OpenOffice.org Macros Explained
OpenOffice.org Macros Explained
ISBN: 1930919514
EAN: 2147483647
Year: 2004
Pages: 203

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net