https://issues.apache.org/ooo/show_bug.cgi?id=123516

            Bug ID: 123516
        Issue Type: DEFECT
           Summary: Undocumented and cumbersome css.ui.dialogs.ColorPicker
           Product: App Dev
           Version: 3.4.0
          Hardware: All
                OS: All
            Status: CONFIRMED
          Severity: normal
          Priority: P3
         Component: api
          Assignee: issues@openoffice.apache.org
          Reporter: arie...@apache.org
                CC: issues@openoffice.apache.org

Since 3.4.0 there is a color picker that can be "used" from the API, but it is
undocumented and cumbersome, as the following OO Basic code shows:

REM  *****  BASIC  *****

Option Explicit

Sub Main
Dim oParent as Object
Dim oDialog as Object

oParent = ThisComponent.getCurrentController().getFrame().getContainerWindow()
oDialog = CreateUnoService("com.sun.star.ui.dialogs.ColorPicker")

'the dialog must be initialized with the Parent window
oDialog.initialize(Array(oParent))

'the dialog implements css.beans.XPropertyAccess
Dim aProps(1) as new com.sun.star.beans.PropertyValue

' the original selected color
aProps(0).Name = "Color"
aProps(0).Value = RGB(255,0,0)

' the "mode" is an implementation detail!
' 2 = show control with previous color
aProps(1).Name = "Mode"
aProps(1).Value = 2

oDialog.setPropertyValues(aProps)

'this is broken
oDialog.setTitle("Color Picker API Demo")

If oDialog.execute() = com.sun.star.ui.dialogs.ExecutableDialogResults.OK Then
    ' retrieving the selected color is cumbersome
    Dim nSelectedColor as Long
    Dim aPropVals()
    aPropVals = oDialog.getPropertyValues()
    Dim n as Long
    For n = 0 To UBound(aPropVals)
        If aPropVals(n).Name = "Color" Then
            nSelectedColor = aPropVals(n).Value
            Exit For
        End If
    Next
    MsgBox "Selected color:  RGB( " & _
        CStr(Red(nSelectedColor)) & ", " & _
        CStr(Green(nSelectedColor)) & ", " & _
        CStr(Blue(nSelectedColor)) & " )"
End If
End Sub

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.
You are watching all bug changes.

Reply via email to