To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=67883
                 Issue #|67883
                 Summary|createContentEnumeration on bookmark.Anchor creates an
                        | empty enumeration
               Component|api
                 Version|OOo 2.0.3
                Platform|Opteron/x86_64
                     URL|
              OS/Version|Windows 2000
                  Status|UNCONFIRMED
       Status whiteboard|
                Keywords|
              Resolution|
              Issue type|DEFECT
                Priority|P3
            Subcomponent|code
             Assigned to|jsc
             Reported by|clutz





------- Additional comments from [EMAIL PROTECTED] Fri Jul 28 07:20:46 -0700 
2006 -------
I have got a bookmark that encloses a textfield. Trying to access this textfield
using the createContentEnumeration()-method of the bookmark.Anchor does not work
though bookmark.Anchor.getAvailableServiceNames() tells that the required
"com.sun.star.text.TextContent" is available.

regarding the specified behaviour of getAvailableServiceNames(), the
createContentEnumeration-method is not allowed to return an empty
contentEnumeration (see
http://api.openoffice.org/docs/common/ref/com/sun/star/container/XContentEnumerationAccess.html#getAvailableServiceNames
)

The following code demonstrates this behaviour. The sub "prepare" creates a
textfield that is enclosed by the bookmark test. The
getAvailableServiceNames()-method tells that com.sun.star.text.TextContent is
available, but counting the elements of the created contentEnumeration shows
that this enumeration is empty.


Sub contentEnumerationIsEmptyBug
    prepare
    doc = ThisComponent
    
    bookmark = doc.getBookmarks().getByName("test")
        anchor = bookmark.Anchor

        avail = anchor.getAvailableServiceNames()
        print avail(0)
        
    enu = anchor.createContentEnumeration("com.sun.star.text.TextContent")
    
    count = 0
    do while (enu.hasMoreElements())
      count = count + 1
    loop
    
    print count ' this should be at least 1
End Sub

Sub prepare
    doc = ThisComponent

    mytext = doc.Text
        
    field = doc.createInstance("com.sun.star.text.TextField.Input")
    field.Content = "testcontent1"
    mytext.insertTextContent(mytext.Start, field, false)

    cursor = mytext.createTextCursorByRange(field.Anchor)
    bookmark = doc.createInstance("com.sun.star.text.Bookmark")
    bookmark.setName("test")
    cursor.Text.insertTextContent(cursor, bookmark, true)    
End Sub

---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to