jsdialog: enable Accessibility Check dialog
- fix crash due to wrong type for label - deduplicate widgets with the same id in one dialog/builder - refresh on box reordering Change-Id: I6993552342a3f139de40c3f87243bdf4e0617fc5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130797 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Henry Castro <hcastro@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130951 Tested-by: Jenkins Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
This commit is contained in:
@@ -83,6 +83,7 @@ public:
|
||||
|
||||
virtual void LoseFocus() override;
|
||||
virtual void ApplySettings(vcl::RenderContext&) override;
|
||||
virtual void DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) override;
|
||||
};
|
||||
|
||||
class VCL_DLLPUBLIC FixedLine final : public Control
|
||||
|
||||
@@ -224,7 +224,7 @@ class JSInstanceBuilder final : public SalInstanceBuilder, public JSDialogSender
|
||||
|
||||
static std::map<std::string, WidgetMap>& GetLOKWeldWidgetsMap();
|
||||
static void InsertWindowToMap(const std::string& nWindowId);
|
||||
void RememberWidget(const OString& id, weld::Widget* pWidget);
|
||||
void RememberWidget(OString id, weld::Widget* pWidget);
|
||||
static void RememberWidget(const std::string& nWindowId, const OString& id,
|
||||
weld::Widget* pWidget);
|
||||
static weld::Widget* FindWeldWidgetsMap(const std::string& nWindowId, const OString& rWidget);
|
||||
@@ -459,10 +459,10 @@ public:
|
||||
bool bTakeOwnership);
|
||||
};
|
||||
|
||||
class JSLabel final : public JSWidget<SalInstanceLabel, FixedText>
|
||||
class JSLabel final : public JSWidget<SalInstanceLabel, Control>
|
||||
{
|
||||
public:
|
||||
JSLabel(JSDialogSender* pSender, FixedText* pLabel, SalInstanceBuilder* pBuilder,
|
||||
JSLabel(JSDialogSender* pSender, Control* pLabel, SalInstanceBuilder* pBuilder,
|
||||
bool bTakeOwnership);
|
||||
virtual void set_label(const OUString& rText) override;
|
||||
};
|
||||
@@ -705,6 +705,8 @@ class JSBox : public JSWidget<SalInstanceBox, VclBox>
|
||||
{
|
||||
public:
|
||||
JSBox(JSDialogSender* pSender, VclBox* pBox, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
|
||||
|
||||
void reorder_child(weld::Widget* pWidget, int nNewPosition) override;
|
||||
};
|
||||
|
||||
class JSWidgetInstance : public JSWidget<SalInstanceWidget, vcl::Window>
|
||||
|
||||
@@ -54,7 +54,8 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool bMobile)
|
||||
|| rUIFile == u"modules/scalc/ui/textimportcsv.ui"
|
||||
|| rUIFile == u"xmlsec/ui/digitalsignaturesdialog.ui"
|
||||
|| rUIFile == u"xmlsec/ui/viewcertdialog.ui" || rUIFile == u"xmlsec/ui/certgeneral.ui"
|
||||
|| rUIFile == u"xmlsec/ui/certpage.ui")
|
||||
|| rUIFile == u"xmlsec/ui/certpage.ui" || rUIFile == u"svx/ui/accessibilitycheckdialog.ui"
|
||||
|| rUIFile == u"svx/ui/accessibilitycheckentry.ui")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -701,10 +701,31 @@ void JSInstanceBuilder::InsertWindowToMap(const std::string& nWindowId)
|
||||
GetLOKWeldWidgetsMap().insert(std::map<std::string, WidgetMap>::value_type(nWindowId, map));
|
||||
}
|
||||
|
||||
void JSInstanceBuilder::RememberWidget(const OString& id, weld::Widget* pWidget)
|
||||
void JSInstanceBuilder::RememberWidget(OString sId, weld::Widget* pWidget)
|
||||
{
|
||||
RememberWidget(getMapIdFromWindowId(), id, pWidget);
|
||||
m_aRememberedWidgets.push_back(id.getStr());
|
||||
// do not use the same id for two widgets inside one builder
|
||||
// exception is sidebar where we base our full invalidation on that "Panel" id sharing
|
||||
if (m_sTypeOfJSON != "sidebar")
|
||||
{
|
||||
static std::atomic<unsigned long long int> nNotRepeatIndex = 0;
|
||||
auto aWindowIt = GetLOKWeldWidgetsMap().find(getMapIdFromWindowId());
|
||||
if (aWindowIt != GetLOKWeldWidgetsMap().end())
|
||||
{
|
||||
auto aWidgetIt = aWindowIt->second.find(sId);
|
||||
if (aWidgetIt != aWindowIt->second.end())
|
||||
{
|
||||
unsigned long long int nIndex = nNotRepeatIndex++;
|
||||
// found duplicated it -> add some number to the id and apply to the widget
|
||||
sId = sId + OString::number(nIndex);
|
||||
SalInstanceWidget* pSalWidget = dynamic_cast<SalInstanceWidget*>(pWidget);
|
||||
vcl::Window* pVclWidget = pSalWidget->getWidget();
|
||||
pVclWidget->set_id(pVclWidget->get_id() + OUString::number(nIndex));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RememberWidget(getMapIdFromWindowId(), sId, pWidget);
|
||||
m_aRememberedWidgets.push_back(sId.getStr());
|
||||
}
|
||||
|
||||
void JSInstanceBuilder::RememberWidget(const std::string& nWindowId, const OString& id,
|
||||
@@ -822,7 +843,7 @@ std::unique_ptr<weld::Container> JSInstanceBuilder::weld_container(const OString
|
||||
|
||||
std::unique_ptr<weld::Label> JSInstanceBuilder::weld_label(const OString& id)
|
||||
{
|
||||
::FixedText* pLabel = m_xBuilder->get<FixedText>(id);
|
||||
Control* pLabel = m_xBuilder->get<Control>(id);
|
||||
auto pWeldWidget = std::make_unique<JSLabel>(this, pLabel, this, false);
|
||||
|
||||
if (pWeldWidget)
|
||||
@@ -1155,9 +1176,9 @@ JSContainer::JSContainer(JSDialogSender* pSender, vcl::Window* pContainer,
|
||||
{
|
||||
}
|
||||
|
||||
JSLabel::JSLabel(JSDialogSender* pSender, FixedText* pLabel, SalInstanceBuilder* pBuilder,
|
||||
JSLabel::JSLabel(JSDialogSender* pSender, Control* pLabel, SalInstanceBuilder* pBuilder,
|
||||
bool bTakeOwnership)
|
||||
: JSWidget<SalInstanceLabel, FixedText>(pSender, pLabel, pBuilder, bTakeOwnership)
|
||||
: JSWidget<SalInstanceLabel, Control>(pSender, pLabel, pBuilder, bTakeOwnership)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1742,6 +1763,12 @@ JSBox::JSBox(JSDialogSender* pSender, VclBox* pBox, SalInstanceBuilder* pBuilder
|
||||
{
|
||||
}
|
||||
|
||||
void JSBox::reorder_child(weld::Widget* pWidget, int nNewPosition)
|
||||
{
|
||||
SalInstanceBox::reorder_child(pWidget, nNewPosition);
|
||||
sendUpdate();
|
||||
}
|
||||
|
||||
JSImage::JSImage(JSDialogSender* pSender, FixedImage* pImage, SalInstanceBuilder* pBuilder,
|
||||
bool bTakeOwnership)
|
||||
: JSWidget<SalInstanceImage, FixedImage>(pSender, pImage, pBuilder, bTakeOwnership)
|
||||
|
||||
@@ -454,6 +454,13 @@ void SelectableFixedText::LoseFocus()
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
void SelectableFixedText::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter)
|
||||
{
|
||||
Edit::DumpAsPropertyTree(rJsonWriter);
|
||||
rJsonWriter.put("type", "fixedtext");
|
||||
rJsonWriter.put("selectable", "true");
|
||||
}
|
||||
|
||||
void FixedLine::ImplInit( vcl::Window* pParent, WinBits nStyle )
|
||||
{
|
||||
nStyle = ImplInitStyle( nStyle );
|
||||
|
||||
Reference in New Issue
Block a user