method to get string from theme color Type

Tomaž Vajngerl quikee at gmail.com
Wed Feb 15 13:33:28 UTC 2023


Hi Regina,

On Wed, Feb 15, 2023 at 9:43 AM Regina Henschel <rb.henschel at t-online.de>
wrote:

> Hi Thomaž,
>
> for my current work on exporting Fontwork shapes to docx I need for a
> theme color the string used in OOXML markup. Does already a method
> exist, that takes the Type of a theme color and returns that string? I
> could not find one.
>

There is g_aPredefinedClrNames, but that's a bit older code, which relies
on array index to correspond to theme color type value. A map would
probably be better...


>
> With Type I mean the value returned by getType() of XThemeColor or
> CharColorTheme or FillColorTheme.
>

I suggest you always cast the XThemeColor to UnoThemeColor and use wrapped
ThemeColor to get the ThemeColorType enum. There are also the
transformations that you need to take into account anyway, which aren't
covered by the UNO API.

I'm looking for a method like: getMarkupStringForThemeColorType(3) with
> result "tx2".
>

Well if you expect it to return "tx2" then that's a problem as the same
ThemeColorType maps to "dk2" in drawingml, so you need to treat that
specially.

If it doesn't exist, shall I define one local in my FontworkHelpers only
> for me, or do you want to have such method somewhere else?
>
> If latter, please suggest a location and a name.
>

I suggest you define one locally for Fontwork, because of the difference of
what values it should return (tx1, tx2, bg1, bg2 instead of dk1, dk2, lt1,
lt2). We can always refactor afterwards.

Kind regards,
> Regina
>

Regards, Tomaž
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20230215/16002dc1/attachment.htm>


More information about the LibreOffice mailing list