hallo,
maybe I missed something here but to answer the original question:

oPathSettings = createUnoService("com.sun.star.util.PathSettings")
 sPaletteUrl = oPathSettings.Palette & "/standard.soc"

I replace the standard.soc by my own soc file using the already existing user-standard.soc + the colors wanted for a specifik task.

I can post  the complete code in basic if wanted

hope it helps

Fernand

Hello Aladdin,

On Thursday 02 April 2009, 06:42, Aladdin wrote:
Moreover, insert color palette has been fixed on the API[2].
[2] http://openoffice.org/issues/show_bug.cgi?id=94459

it seems there are still issues:

1. where did you get this service from? at least this is completely new to me [sample code attached], and AFAIK there is no com.sun.star.drawing.ColorTable in the API reference.

2. Could you make your changes in the color palette persist after your object dies?

Try the following:

Sub Main
        Dim oColorTable as Object
        oColorTable = CreateUnoService("com.sun.star.drawing.ColorTable")
        
        Dim sNewName$, bHas as Boolean
        sNewName = "My New Color"
        
        If NOT oColorTable.hasByName(sNewName) Then
                oColorTable.insertByName(sNewName, RGB(0,124,197))
                bHas = oColorTable.hasByName(sNewName)
        End If
End Sub

The first time you run the macro, the condition evaluates to false, so you insert a new color and bHas returns true, saying this went OK. The second time you run the macro, the condition should evaluate to true, as you already inserted a new color with that name; but this is not the case, changes are not made persistent.

This is because the implementation of SvxUnoColorTable
http://svn.services.openoffice.org/opengrok/xref/DEV300_m42/svx/source/unodraw/unoctabl.cxx

misses the point that changes to the XColorTable must be saved for them to really take place... well, at least this is what the color tab page does invoking XColorTable::Save().

http://svn.services.openoffice.org/opengrok/xref/DEV300_m42/svx/source/dialog/tpcolor.cxx#757
http://svn.services.openoffice.org/opengrok/xref/DEV300_m42/svx/source/dialog/tpcolor.cxx#915


Regards
------------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org

Reply via email to