You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openoffice.apache.org by bu...@apache.org on 2013/10/22 13:06:02 UTC
[Bug 123516] New: Undocumented and cumbersome
css.ui.dialogs.ColorPicker
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: arielch@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.
[Bug 123516] Undocumented and cumbersome css.ui.dialogs.ColorPicker
Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=123516
--- Comment #2 from Ariel Constenla-Haile <ar...@apache.org> ---
Created attachment 81807
--> https://issues.apache.org/ooo/attachment.cgi?id=81807&action=edit
XColorPicker interface draft
--
You are receiving this mail because:
You are on the CC list for the bug.
You are watching all bug changes.
[Bug 123516] Undocumented and cumbersome css.ui.dialogs.ColorPicker
Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=123516
--- Comment #7 from Ariel Constenla-Haile <ar...@apache.org> ---
Created attachment 82074
--> https://issues.apache.org/ooo/attachment.cgi?id=82074&action=edit
XColorPicker interface, second draft
--
You are receiving this mail because:
You are on the CC list for the bug.
You are watching all bug changes.
[Bug 123516] Undocumented and cumbersome css.ui.dialogs.ColorPicker
Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=123516
oooforum <oo...@free.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |oooforum@free.fr
--- Comment #4 from oooforum <oo...@free.fr> ---
Maybe it would be nice to add this in API documentation:
http://www.openoffice.org/api/docs/common/ref/com/sun/star/ui/dialogs/module-ix.html
--
You are receiving this mail because:
You are on the CC list for the bug.
You are watching all bug changes.
[Bug 123516] Undocumented and cumbersome css.ui.dialogs.ColorPicker
Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=123516
Ariel Constenla-Haile <ar...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|CONFIRMED |ACCEPTED
Latest|--- |4.0.1
Confirmation on| |
Assignee|issues@openoffice.apache.or |arielch@apache.org
|g |
--
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.
[Bug 123516] Undocumented and cumbersome css.ui.dialogs.ColorPicker
Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=123516
--- Comment #3 from Ariel Constenla-Haile <ar...@apache.org> ---
Created attachment 81808
--> https://issues.apache.org/ooo/attachment.cgi?id=81808&action=edit
Sample AOO Basic code
--
You are receiving this mail because:
You are on the CC list for the bug.
You are watching all bug changes.
[Bug 123516] Undocumented and cumbersome css.ui.dialogs.ColorPicker
Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=123516
--- Comment #8 from Ariel Constenla-Haile <ar...@apache.org> ---
The second draft hides the dialog's implementation details by using two
interfaces:
css::ui::dialogs::XControlInformation;
css::ui::dialogs::XControlAccess;
Showing a color picker, displaying the original color, can be done with the
following Basic code:
Sub ColorPicker_PreviousColor
Dim oWin as Object
oWin = ThisComponent.getCurrentController().getFrame().getContainerWindow()
Dim oDlg
oDlg = com.sun.star.ui.dialogs.ColorPicker.create(oWin, RGB(255,0,0))
oDlg.setTitle("Color Picker Demo")
oDlg.setControlProperty("PreviousColor","Visible",True)
Dim nResult%
nResult = oDlg.execute()
If nResult = com.sun.star.ui.dialogs.ExecutableDialogResults.OK Then
Dim nColor as Long
nColor = oDlg.SelectedColor
MsgBox "Selected color: RGB(" & _
CStr(Red(nColor)) & "," & _
CStr(Green(nColor)) & "," & _
CStr(Blue(nColor)) & ")"
End If
End Sub
Instead of using strings ("PreviousColor","Visible"), it would be better to use
constants, like the FilePicker does (XFilePickerControlAccess with
CommonFilePickerElementIds, ExtendedFilePickerElementIds). But for now the
color picker only exposes one control (original color preview) with one
property (visible).
--
You are receiving this mail because:
You are on the CC list for the bug.
You are watching all bug changes.
[Bug 123516] Undocumented and cumbersome css.ui.dialogs.ColorPicker
Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=123516
--- Comment #6 from Ariel Constenla-Haile <ar...@apache.org> ---
Created attachment 82073
--> https://issues.apache.org/ooo/attachment.cgi?id=82073&action=edit
ColorPicker service, second draft
--
You are receiving this mail because:
You are on the CC list for the bug.
You are watching all bug changes.
[Bug 123516] Undocumented and cumbersome css.ui.dialogs.ColorPicker
Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=123516
--- Comment #1 from Ariel Constenla-Haile <ar...@apache.org> ---
Created attachment 81806
--> https://issues.apache.org/ooo/attachment.cgi?id=81806&action=edit
ColorPicker service draft
--
You are receiving this mail because:
You are on the CC list for the bug.
You are watching all bug changes.
[Bug 123516] Undocumented and cumbersome css.ui.dialogs.ColorPicker
Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=123516
--- Comment #5 from Ariel Constenla-Haile <ar...@apache.org> ---
(In reply to oooforum from comment #4)
> Maybe it would be nice to add this in API documentation:
> http://www.openoffice.org/api/docs/common/ref/com/sun/star/ui/dialogs/module-
> ix.html
I've changed a bit the IDL, because it was exposing some internal
implementation details (namely, the preview control displaying the original
color).
--
You are receiving this mail because:
You are on the CC list for the bug.
You are watching all bug changes.