diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2022-08-21 17:36:33 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2022-08-22 12:48:32 +0200 |
commit | 62d5622540c7251bb870a837b5ca6a836fac6f01 (patch) | |
tree | f54751dcc96705d10358f3391255744620ee5c3c /vcl | |
parent | 68c13732a3518442f4cbd64330e692a66dad8515 (diff) |
DumpAsPropertyTree: use more efficient overloads of JsonWriter::put
Change-Id: I6fe3ff8138ed27a04a3a224c67492338cf23992c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138640
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit a909ed32274e202e9f7dc8ac0c1985e258cff1cc)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138538
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/control/button.cxx | 6 | ||||
-rw-r--r-- | vcl/source/control/fixed.cxx | 6 | ||||
-rw-r--r-- | vcl/source/control/tabctrl.cxx | 2 | ||||
-rw-r--r-- | vcl/source/treelist/iconview.cxx | 11 | ||||
-rw-r--r-- | vcl/source/treelist/svtabbx.cxx | 10 | ||||
-rw-r--r-- | vcl/source/window/dialog.cxx | 2 | ||||
-rw-r--r-- | vcl/source/window/layout.cxx | 4 | ||||
-rw-r--r-- | vcl/source/window/toolbox2.cxx | 4 | ||||
-rw-r--r-- | vcl/source/window/window.cxx | 2 |
9 files changed, 23 insertions, 24 deletions
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index ddec46b6c27b..0cdb95af54b1 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -581,7 +581,7 @@ FactoryFunction Button::GetUITestFactory() const namespace { -const char* symbolTypeName(SymbolType eSymbolType) +std::string_view symbolTypeName(SymbolType eSymbolType) { switch (eSymbolType) { @@ -3024,9 +3024,9 @@ void RadioButton::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) if(GraphicConverter::Export(aOStm, maImage.GetBitmapEx(), ConvertDataFormat::PNG) == ERRCODE_NONE) { css::uno::Sequence<sal_Int8> aSeq( static_cast<sal_Int8 const *>(aOStm.GetData()), aOStm.Tell()); - OUStringBuffer aBuffer("data:image/png;base64,"); + OStringBuffer aBuffer("data:image/png;base64,"); ::comphelper::Base64::encode(aBuffer, aSeq); - rJsonWriter.put("image", aBuffer.makeStringAndClear()); + rJsonWriter.put("image", aBuffer); } } } diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx index 647a1e96c506..b5afbad983a1 100644 --- a/vcl/source/control/fixed.cxx +++ b/vcl/source/control/fixed.cxx @@ -458,7 +458,7 @@ void SelectableFixedText::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) { Edit::DumpAsPropertyTree(rJsonWriter); rJsonWriter.put("type", "fixedtext"); - rJsonWriter.put("selectable", "true"); + rJsonWriter.put("selectable", true); } void FixedLine::ImplInit( vcl::Window* pParent, WinBits nStyle ) @@ -984,9 +984,9 @@ void FixedImage::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) if(GraphicConverter::Export(aOStm, maImage.GetBitmapEx(), ConvertDataFormat::PNG) == ERRCODE_NONE) { css::uno::Sequence<sal_Int8> aSeq( static_cast<sal_Int8 const *>(aOStm.GetData()), aOStm.Tell()); - OUStringBuffer aBuffer("data:image/png;base64,"); + OStringBuffer aBuffer("data:image/png;base64,"); ::comphelper::Base64::encode(aBuffer, aSeq); - rJsonWriter.put("image", aBuffer.makeStringAndClear()); + rJsonWriter.put("image", aBuffer); } } } diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index 8b94d4954b52..9fe8d3c50215 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -2194,7 +2194,7 @@ void TabControl::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) pChild->DumpAsPropertyTree(rJsonWriter); if (!pChild->IsVisible()) - rJsonWriter.put("hidden", "true"); + rJsonWriter.put("hidden", true); } } } diff --git a/vcl/source/treelist/iconview.cxx b/vcl/source/treelist/iconview.cxx index b198355a5afb..b134991784b2 100644 --- a/vcl/source/treelist/iconview.cxx +++ b/vcl/source/treelist/iconview.cxx @@ -258,7 +258,7 @@ OUString IconView::GetEntryAccessibleDescription(SvTreeListEntry* pEntry) const FactoryFunction IconView::GetUITestFactory() const { return IconViewUIObject::create; } -static OUString extractPngString(const SvLBoxContextBmp* pBmpItem) +static OString extractPngString(const SvLBoxContextBmp* pBmpItem) { BitmapEx aImage = pBmpItem->GetBitmap1().GetBitmapEx(); SvMemoryStream aOStm(65535, 65535); @@ -266,7 +266,7 @@ static OUString extractPngString(const SvLBoxContextBmp* pBmpItem) { css::uno::Sequence<sal_Int8> aSeq(static_cast<sal_Int8 const*>(aOStm.GetData()), aOStm.Tell()); - OUStringBuffer aBuffer("data:image/png;base64,"); + OStringBuffer aBuffer("data:image/png;base64,"); ::comphelper::Base64::encode(aBuffer, aSeq); return aBuffer.makeStringAndClear(); } @@ -298,13 +298,12 @@ static void lcl_DumpEntryAndSiblings(tools::JsonWriter& rJsonWriter, SvTreeListE rJsonWriter.put("tooltip", tooltip); if (pTabListBox->IsSelected(pEntry)) - rJsonWriter.put("selected", "true"); + rJsonWriter.put("selected", true); if (pEntry->GetFlags() & SvTLEntryFlags::IS_SEPARATOR) - rJsonWriter.put("separator", "true"); + rJsonWriter.put("separator", true); - rJsonWriter.put("row", - OString::number(pTabListBox->GetModel()->GetAbsPos(pEntry)).getStr()); + rJsonWriter.put("row", pTabListBox->GetModel()->GetAbsPos(pEntry)); pEntry = pEntry->NextSibling(); } diff --git a/vcl/source/treelist/svtabbx.cxx b/vcl/source/treelist/svtabbx.cxx index b116c95d2e37..1b4721af0bda 100644 --- a/vcl/source/treelist/svtabbx.cxx +++ b/vcl/source/treelist/svtabbx.cxx @@ -82,7 +82,7 @@ static void lcl_DumpEntryAndSiblings(tools::JsonWriter& rJsonWriter, if (const SvLBoxItem* pChild = rChild->GetFirstItem(SvLBoxItemType::String)) { if (static_cast<const SvLBoxString*>(pChild)->GetText() == "<dummy>") - rJsonWriter.put("ondemand", "true"); + rJsonWriter.put("ondemand", true); } } @@ -90,15 +90,15 @@ static void lcl_DumpEntryAndSiblings(tools::JsonWriter& rJsonWriter, { SvButtonState eCheckState = pTabListBox->GetCheckButtonState(pEntry); if (eCheckState == SvButtonState::Unchecked) - rJsonWriter.put("state", "false"); + rJsonWriter.put("state", false); else if (eCheckState == SvButtonState::Checked) - rJsonWriter.put("state", "true"); + rJsonWriter.put("state", true); } if (pTabListBox->IsSelected(pEntry)) - rJsonWriter.put("selected", "true"); + rJsonWriter.put("selected", true); - rJsonWriter.put("row", OString::number(pTabListBox->GetModel()->GetAbsPos(pEntry)).getStr()); + rJsonWriter.put("row", pTabListBox->GetModel()->GetAbsPos(pEntry)); SvTreeListEntry* pChild = pTabListBox->FirstChild(pEntry); if (pChild) diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index 96cd04008148..8b9e11cc35d0 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -1685,7 +1685,7 @@ void Dialog::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) if (vcl::Window* pActionArea = get_action_area()) { if (!pActionArea->IsVisible()) - rJsonWriter.put("collapsed", "true"); + rJsonWriter.put("collapsed", true); } OUString sDialogId = OStringToOUString(GetHelpId(), RTL_TEXTENCODING_ASCII_US); diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index 6b11d72eae17..f4479cc7c6ca 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -2994,9 +2994,9 @@ void VclDrawingArea::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) if(GraphicConverter::Export(aOStm, aImage, ConvertDataFormat::PNG) == ERRCODE_NONE) { css::uno::Sequence<sal_Int8> aSeq( static_cast<sal_Int8 const *>(aOStm.GetData()), aOStm.Tell()); - OUStringBuffer aBuffer("data:image/png;base64,"); + OStringBuffer aBuffer("data:image/png;base64,"); ::comphelper::Base64::encode(aBuffer, aSeq); - rJsonWriter.put("image", aBuffer.makeStringAndClear()); + rJsonWriter.put("image", aBuffer); } rJsonWriter.put("text", GetQuickHelpText()); } diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index 5a1112da5c6a..296053783d9f 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -1769,9 +1769,9 @@ void ToolBox::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) if(GraphicConverter::Export(aOStm, aImage.GetBitmapEx(), ConvertDataFormat::PNG) == ERRCODE_NONE) { css::uno::Sequence<sal_Int8> aSeq( static_cast<sal_Int8 const *>(aOStm.GetData()), aOStm.Tell()); - OUStringBuffer aBuffer("data:image/png;base64,"); + OStringBuffer aBuffer("data:image/png;base64,"); ::comphelper::Base64::encode(aBuffer, aSeq); - rJsonWriter.put("image", aBuffer.makeStringAndClear()); + rJsonWriter.put("image", aBuffer); } } } diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 180aa4a78dd2..01462993fc8f 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -3274,7 +3274,7 @@ VclPtr<vcl::Window> Window::GetParentWithLOKNotifier() namespace { -const char* windowTypeName(WindowType nWindowType) +std::string_view windowTypeName(WindowType nWindowType) { switch (nWindowType) { |