https://bugs.documentfoundation.org/show_bug.cgi?id=157141

            Bug ID: 157141
           Summary: Text portion for content control gives empty string
           Product: LibreOffice
           Version: unspecified
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Writer
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]

Open attachment 189413, and use this code:

sub TestContentControlImportedObjects
  paragraphs = thisComponent.getText().createEnumeration()
  para1 = paragraphs.nextElement()
  runs1 = para1.createEnumeration()
  run1 = runs1.nextElement()
  para2 = paragraphs.nextElement()
  runs2 = para2.createEnumeration()
  run2 = runs2.nextElement()

  MsgBox run1.getString()
  MsgBox run2.getString()
  MsgBox run2.ContentControl.getString()
end sub

The document has two paragraphs, each having a content control with a
placeholder text. Because the first one is a block control (which content
includes the respective paragraph), and the second is an inline control
(contained in the paragraph, and the content includes only a run), these two
are imported differently (as of 2023-09-07): the first one as a field, and the
second one as a content control.

The three MsgBox calls in the end of the code are expected to show the same
"Click or tap here to enter text." string. However, the second call showing
"run2.getString()" produces an empty message.

This happens because lcl_CreateContentControlPortion in
sw/source/core/unocore/unoportenum.cxx is called with pUnoCursor pointing to
the end of the paragraph. Looks like it needs to take into account the values
of rAttr (and respective SwContentControl), and pPortions, which may contain
the range that should become the actual cursor.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to