Files
odfstudio/oovbaapi
Justin Luth 432e5e6e33 tdf#151548 vba ContentControls: Add word::XContentControlListEntry
make CppunitTest_sw_macros_test CPPUNIT_TEST_NAME=testVba

This now allows MS Word's modern content control list boxes
(combobox and dropbox) to be controlled by VBA basic.
-allows getting and setting the selected list entry
-allows adding/deleting/renaming/moving list entries

  If .DropdownListEntries.Count <> 3 Then GoTo errorhandler:
  .DropdownListEntries.Item(2).Select
  .DropdownListEntries.Item(2).Delete

  If .DropdownListEntries.Item(2).Text <> "infinity"
  If .DropdownListEntries.Item(2).Value <> "infinity and beyond"

  'With .DropdownListEntries.Add("third", "3rd", 2)
  Dim LE As ContentControlListEntry
  Set LE = .DropdownListEntries.Add("third", "3rd", 2)
  With LE
    If LE.Index <> 2 Then GoTo errorhandler:
    If LE.Value <> "3rd" Then GoTo errorhandler:
    .MoveUp
    .MoveUp
    .MoveUp
    If .Index <> 1 Then GoTo errorhandler:
    .MoveDown
    .MoveDown
    If .Index <> 3 Then GoTo errorhandler:
    End With 'LE
  If .DropdownListEntries.Item(3).Text <> "third" Then GoTo errorhandler:
  End With 'Item 1
runOnceDropDown:

With ActiveDocument.ContentControls.Item(4)
  If .Type <> wdContentControlComboBox Then GoTo errorhandler:
  .DropdownListEntries.Clear
End With

Change-Id: Iffebb2bd69abec1cbcfaed05b58f940664852eae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143082
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-11-25 18:09:32 +01:00
..
…

Visual Basic Interoperability

Visual Basic interoperability module for LibreOffice

See also