jsdialog: export symbol for buttons

Change-Id: I412961bd59855dcb4204dfb917b30539dac0eac2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132756
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133653
Tested-by: Jenkins
This commit is contained in:
Szymon Kłos 2022-04-09 22:50:51 +02:00
parent 7df8334b00
commit db2e2e555b
2 changed files with 49 additions and 0 deletions

View File

@ -179,6 +179,8 @@ public:
return mbIsAction;
}
void DumpAsPropertyTree(tools::JsonWriter&) override;
protected:
PushButtonDropdownStyle mnDDStyle;
bool mbIsActive;

View File

@ -578,6 +578,46 @@ FactoryFunction Button::GetUITestFactory() const
return ButtonUIObject::create;
}
namespace
{
const char* symbolTypeName(SymbolType eSymbolType)
{
switch (eSymbolType)
{
case SymbolType::DONTKNOW: return "DONTKNOW";
case SymbolType::IMAGE: return "IMAGE";
case SymbolType::ARROW_UP: return "ARROW_UP";
case SymbolType::ARROW_DOWN: return "ARROW_DOWN";
case SymbolType::ARROW_LEFT: return "ARROW_LEFT";
case SymbolType::ARROW_RIGHT: return "ARROW_RIGHT";
case SymbolType::SPIN_UP: return "SPIN_UP";
case SymbolType::SPIN_DOWN: return "SPIN_DOWN";
case SymbolType::SPIN_LEFT: return "SPIN_LEFT";
case SymbolType::SPIN_RIGHT: return "SPIN_RIGHT";
case SymbolType::FIRST: return "FIRST";
case SymbolType::LAST: return "LAST";
case SymbolType::PREV: return "PREV";
case SymbolType::NEXT: return "NEXT";
case SymbolType::PAGEUP: return "PAGEUP";
case SymbolType::PAGEDOWN: return "PAGEDOWN";
case SymbolType::PLAY: return "PLAY";
case SymbolType::STOP: return "STOP";
case SymbolType::CLOSE: return "CLOSE";
case SymbolType::CHECKMARK: return "CHECKMARK";
case SymbolType::RADIOCHECKMARK: return "RADIOCHECKMARK";
case SymbolType::FLOAT: return "FLOAT";
case SymbolType::DOCK: return "DOCK";
case SymbolType::HIDE: return "HIDE";
case SymbolType::HELP: return "HELP";
case SymbolType::PLUS: return "PLUS";
}
return "UNKNOWN";
}
}
void Button::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter)
{
Control::DumpAsPropertyTree(rJsonWriter);
@ -598,6 +638,13 @@ void Button::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter)
rJsonWriter.put("has_default", true);
}
void PushButton::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter)
{
Button::DumpAsPropertyTree(rJsonWriter);
if (GetSymbol() != SymbolType::DONTKNOW)
rJsonWriter.put("symbol", symbolTypeName(GetSymbol()));
}
IMPL_STATIC_LINK( Button, dispatchCommandHandler, Button*, pButton, void )
{
if (pButton == nullptr)