'************************************************************************* ' ' Licensed to the Apache Software Foundation (ASF) under one ' or more contributor license agreements. See the NOTICE file ' distributed with this work for additional information ' regarding copyright ownership. The ASF licenses this file ' to you under the Apache License, Version 2.0 (the ' "License"); you may not use this file except in compliance ' with the License. You may obtain a copy of the License at ' ' http://www.apache.org/licenses/LICENSE-2.0 ' ' Unless required by applicable law or agreed to in writing, ' software distributed under the License is distributed on an ' "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ' KIND, either express or implied. See the License for the ' specific language governing permissions and limitations ' under the License. ' '************************************************************************* ' Be sure that all variables are dimensioned: option explicit '************************************************************************* ' This Interface/Service test depends on the following GLOBAL variables, ' which must be specified in the object creation: ' - Global oText As Object '************************************************************************* Sub RunTest() '************************************************************************* ' INTERFACE: ' com.sun.star.text.XParagraphCursor '************************************************************************* On Error Goto ErrHndl Dim bOK As Boolean Dim i As Integer for i = 0 to 2 oText.insertString(oObj, "" + i +"Start of paragraph.", false) oText.insertString(oObj, Chr(10) + cObjectName + " " + cIfcShortName + Chr(10), false) oText.insertString(oObj, "Paragraph's end." + i, false) oText.insertControlCharacter(oObj, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, false) next i oObj.gotoStart(false) Test.StartMethod("gotoStartOfParagraph()") bOK = true oObj.gotoStartOfParagraph(false) oText.insertString(oObj, "1", false) bOK = bOK AND inStr(1, oText.String, "10Start") <> 0 Test.MethodTested("gotoStartOfParagraph()", bOK) Test.StartMethod("gotoEndOfParagraph()") bOK = true oObj.gotoEndOfParagraph(false) oText.insertString(oObj, "2", false) bOK = bOK AND inStr(1, oText.String, "end.02") <> 0 Test.MethodTested("gotoEndOfParagraph()", bOK) Test.StartMethod("gotoNextParagraph()") bOK = true oObj.gotoNextParagraph(false) oObj.gotoNextParagraph(false) oObj.gotoEndOfParagraph(false) oText.insertString(oObj, "3", false) bOK = bOK AND inStr(1, oText.String, "end.23") <> 0 Test.MethodTested("gotoNextParagraph()", bOK) Test.StartMethod("gotoPreviousParagraph()") bOK = true oObj.gotoPreviousParagraph(false) oObj.gotoEndOfParagraph(false) oText.insertString(oObj, "4", false) bOK = bOK AND inStr(1, oText.String, "end.14") <> 0 Test.MethodTested("gotoPreviousParagraph()", bOK) Test.StartMethod("isStartOfParagraph()") bOK = true oObj.gotoStartOfParagraph(false) bOK = bOK AND oObj.isStartOfParagraph() bOK = bOK AND NOT oObj.isEndOfParagraph() Test.MethodTested("isStartOfParagraph()", bOK) Test.StartMethod("isEndOfParagraph()") bOK = true oObj.gotoEndOfParagraph(false) bOK = bOK AND oObj.isEndOfParagraph() bOK = bOK AND NOT oObj.isStartOfParagraph() Test.MethodTested("isEndOfParagraph()", bOK) Exit Sub ErrHndl: Test.Exception() bOK = false resume next End Sub