include/tools/json_writer.hxx | 1 + svx/source/tbxctrls/PaletteManager.cxx | 3 +-- svx/source/theme/ThemeColorPaletteManager.cxx | 4 +++- tools/source/misc/json_writer.cxx | 10 ++++++++++ 4 files changed, 15 insertions(+), 3 deletions(-)
New commits: commit 17dc98b0f0d96362db03e48c0589013c349da156 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Mon Mar 11 13:27:23 2024 +0000 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Mon Mar 11 18:47:41 2024 +0100 Document Colors do not show any color in the Palette same is true for "Theme Colors", a problem since: commit 4ccc2f0e3f45c9d78f74b1848851bedf71f7382d Date: Fri Mar 1 22:11:14 2024 +0200 cool#8327 use tools::JsonWriter for theme colors Change-Id: Ibaab5df197bd8005037e066181e8a50bdda5ceda Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164658 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164669 Tested-by: Jenkins diff --git a/include/tools/json_writer.hxx b/include/tools/json_writer.hxx index eca19a6e736a..92d219457789 100644 --- a/include/tools/json_writer.hxx +++ b/include/tools/json_writer.hxx @@ -46,6 +46,7 @@ public: [[nodiscard]] ScopedJsonWriterNode<'}'> startNode(std::string_view nodeName); [[nodiscard]] ScopedJsonWriterNode<']'> startArray(std::string_view nodeName); + [[nodiscard]] ScopedJsonWriterNode<']'> startAnonArray(); [[nodiscard]] ScopedJsonWriterNode<'}'> startStruct(); void put(std::u16string_view pPropName, std::u16string_view rPropValue); diff --git a/svx/source/tbxctrls/PaletteManager.cxx b/svx/source/tbxctrls/PaletteManager.cxx index fda9803c9d03..d1dafc182bb9 100644 --- a/svx/source/tbxctrls/PaletteManager.cxx +++ b/svx/source/tbxctrls/PaletteManager.cxx @@ -480,8 +480,7 @@ void PaletteManager::generateJSON(tools::JsonWriter& aTree, const std::set<Color auto aColorIt = rColors.begin(); while (aColorIt != rColors.end()) { - auto aColorRowTree = aTree.startStruct(); - auto aColorRowTree2 = aTree.startArray(""); + auto aColorRowTree = aTree.startAnonArray(); for (sal_uInt32 nColumn = 0; nColumn < nColumnCount; nColumn++) { diff --git a/svx/source/theme/ThemeColorPaletteManager.cxx b/svx/source/theme/ThemeColorPaletteManager.cxx index ae2fe2f0bdfd..deca9a3c54be 100644 --- a/svx/source/theme/ThemeColorPaletteManager.cxx +++ b/svx/source/theme/ThemeColorPaletteManager.cxx @@ -134,9 +134,11 @@ void ThemeColorPaletteManager::generateJSON(tools::JsonWriter& aTree) for (size_t nEffect = 0; nEffect < 6; ++nEffect) { - auto aColorRowTree = aTree.startStruct(); + auto aColorRowTree = aTree.startAnonArray(); for (size_t nIndex = 0; nIndex < 12; ++nIndex) { + auto aColorTree = aTree.startStruct(); + auto const& rColorData = aThemePaletteCollection.maColors[nIndex]; auto const& rEffectData = rColorData.maEffects[nEffect]; diff --git a/tools/source/misc/json_writer.cxx b/tools/source/misc/json_writer.cxx index b9f62d2b4b60..4c674557b033 100644 --- a/tools/source/misc/json_writer.cxx +++ b/tools/source/misc/json_writer.cxx @@ -74,6 +74,16 @@ JsonWriter::ScopedJsonWriterNode<']'> JsonWriter::startArray(std::string_view pN return { *this }; } +JsonWriter::ScopedJsonWriterNode<']'> JsonWriter::startAnonArray() +{ + putRaw("[ "); + + mStartNodeCount++; + mbFirstFieldInNode = true; + + return { *this }; +} + JsonWriter::ScopedJsonWriterNode<'}'> JsonWriter::startStruct() { putRaw("{ ");