summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-05-04 14:53:11 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-05-04 22:12:46 +0200
commit0920b04bca3d58d89b026bcf999ea43d0e855715 (patch)
treee819560b7822cda8cd76a0494a4ec6135f3585a9 /vcl
parent2cab4acbe2aaaee6e5b9afeb68f3e555ecff2ec7 (diff)
weld SwOutlineTabDialog
Change-Id: I55c0e9a62dd9dd970a87ef295bb5fbb82c80d2d8 Reviewed-on: https://gerrit.libreoffice.org/53848 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/app/salvtables.cxx20
-rw-r--r--vcl/source/window/builder.cxx2
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx174
3 files changed, 124 insertions, 72 deletions
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 0ff54771656b..a2dfb0f45e41 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -915,12 +915,30 @@ public:
m_xMenuButton->SetSelectHdl(LINK(this, SalInstanceMenuButton, MenuSelectHdl));
}
- virtual void set_active(const OString& rIdent, bool bActive) override
+ virtual void set_item_active(const OString& rIdent, bool bActive) override
{
PopupMenu* pMenu = m_xMenuButton->GetPopupMenu();
pMenu->CheckItem(pMenu->GetItemId(rIdent), bActive);
}
+ virtual void set_item_label(const OString& rIdent, const OUString& rText) override
+ {
+ PopupMenu* pMenu = m_xMenuButton->GetPopupMenu();
+ pMenu->SetItemText(pMenu->GetItemId(rIdent), rText);
+ }
+
+ virtual void set_item_help_id(const OString& rIdent, const OString& rHelpId) override
+ {
+ PopupMenu* pMenu = m_xMenuButton->GetPopupMenu();
+ pMenu->SetHelpId(pMenu->GetItemId(rIdent), rHelpId);
+ }
+
+ virtual OString get_item_help_id(const OString& rIdent) const override
+ {
+ PopupMenu* pMenu = m_xMenuButton->GetPopupMenu();
+ return pMenu->GetHelpId(pMenu->GetItemId(rIdent));
+ }
+
virtual ~SalInstanceMenuButton() override
{
m_xMenuButton->SetSelectHdl(Link<::MenuButton*, void>());
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 65e31948aa0b..1b6b7726cf38 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -8,6 +8,7 @@
*/
#include <memory>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/packages/zip/ZipFileAccess.hpp>
#include <i18nutil/unicode.hxx>
@@ -1426,6 +1427,7 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
assert(!sMenu.isEmpty());
m_pParserState->m_aButtonMenuMaps.emplace_back(id, sMenu);
xButton->SetImageAlign(ImageAlign::Left); //default to left
+ xButton->SetAccessibleRole(css::accessibility::AccessibleRole::BUTTON_MENU);
setupFromActionName(xButton, rMap, m_xFrame);
xWindow = xButton;
}
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 845e15ad15e4..d881155c7d40 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1449,6 +1449,75 @@ public:
}
};
+namespace
+{
+ OString MapToGtkAccelerator(const OUString &rStr)
+ {
+ return OUStringToOString(rStr.replaceFirst("~", "_"), RTL_TEXTENCODING_UTF8);
+ }
+
+ OUString get_label(GtkLabel* pLabel)
+ {
+ const gchar* pStr = gtk_label_get_label(pLabel);
+ return OUString(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8);
+ }
+
+ void set_label(GtkLabel* pLabel, const OUString& rText)
+ {
+ gtk_label_set_label(pLabel, MapToGtkAccelerator(rText).getStr());
+ }
+
+ OUString get_label(GtkButton* pButton)
+ {
+ const gchar* pStr = gtk_button_get_label(pButton);
+ return OUString(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8);
+ }
+
+ void set_label(GtkButton* pButton, const OUString& rText)
+ {
+ gtk_button_set_label(pButton, MapToGtkAccelerator(rText).getStr());
+ }
+
+ OUString get_title(GtkWindow* pWindow)
+ {
+ const gchar* pStr = gtk_window_get_title(pWindow);
+ return OUString(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8);
+ }
+
+ void set_title(GtkWindow* pWindow, const OUString& rTitle)
+ {
+ gtk_window_set_title(pWindow, OUStringToOString(rTitle, RTL_TEXTENCODING_UTF8).getStr());
+ }
+
+ OUString get_primary_text(GtkMessageDialog* pMessageDialog)
+ {
+ gchar* pText = nullptr;
+ g_object_get(G_OBJECT(pMessageDialog), "text", &pText, nullptr);
+ return OUString(pText, pText ? strlen(pText) : 0, RTL_TEXTENCODING_UTF8);
+ }
+
+ void set_primary_text(GtkMessageDialog* pMessageDialog, const OUString& rText)
+ {
+ g_object_set(G_OBJECT(pMessageDialog), "text",
+ OUStringToOString(rText, RTL_TEXTENCODING_UTF8).getStr(),
+ nullptr);
+ }
+
+ void set_secondary_text(GtkMessageDialog* pMessageDialog, const OUString& rText)
+ {
+ g_object_set(G_OBJECT(pMessageDialog), "secondary-text",
+ OUStringToOString(rText, RTL_TEXTENCODING_UTF8).getStr(),
+ nullptr);
+ }
+
+ OUString get_secondary_text(GtkMessageDialog* pMessageDialog)
+ {
+ gchar* pText = nullptr;
+ g_object_get(G_OBJECT(pMessageDialog), "secondary-text", &pText, nullptr);
+ return OUString(pText, pText ? strlen(pText) : 0, RTL_TEXTENCODING_UTF8);
+ }
+}
+
class MenuHelper
{
protected:
@@ -1519,6 +1588,21 @@ public:
enable_item_notify_events();
}
+ void set_item_label(const OString& rIdent, const OUString& rText)
+ {
+ gtk_menu_item_set_label(m_aMap[rIdent], MapToGtkAccelerator(rText).getStr());
+ }
+
+ void set_item_help_id(const OString& rIdent, const OString& rHelpId)
+ {
+ set_help_id(GTK_WIDGET(m_aMap[rIdent]), rHelpId);
+ }
+
+ OString get_item_help_id(const OString& rIdent) const
+ {
+ return get_help_id(GTK_WIDGET(m_aMap.find(rIdent)->second));
+ }
+
void show_item(const OString& rIdent, bool bShow)
{
GtkWidget* pWidget = GTK_WIDGET(m_aMap[rIdent]);
@@ -1666,75 +1750,6 @@ weld::Container* GtkInstanceWidget::weld_parent() const
return pParent ? new GtkInstanceContainer(GTK_CONTAINER(pParent), false) : nullptr;
}
-namespace
-{
- OString MapToGtkAccelerator(const OUString &rStr)
- {
- return OUStringToOString(rStr.replaceFirst("~", "_"), RTL_TEXTENCODING_UTF8);
- }
-
- OUString get_label(GtkLabel* pLabel)
- {
- const gchar* pStr = gtk_label_get_label(pLabel);
- return OUString(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8);
- }
-
- void set_label(GtkLabel* pLabel, const OUString& rText)
- {
- gtk_label_set_label(pLabel, MapToGtkAccelerator(rText).getStr());
- }
-
- OUString get_label(GtkButton* pButton)
- {
- const gchar* pStr = gtk_button_get_label(pButton);
- return OUString(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8);
- }
-
- void set_label(GtkButton* pButton, const OUString& rText)
- {
- gtk_button_set_label(pButton, MapToGtkAccelerator(rText).getStr());
- }
-
- OUString get_title(GtkWindow* pWindow)
- {
- const gchar* pStr = gtk_window_get_title(pWindow);
- return OUString(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8);
- }
-
- void set_title(GtkWindow* pWindow, const OUString& rTitle)
- {
- gtk_window_set_title(pWindow, OUStringToOString(rTitle, RTL_TEXTENCODING_UTF8).getStr());
- }
-
- OUString get_primary_text(GtkMessageDialog* pMessageDialog)
- {
- gchar* pText = nullptr;
- g_object_get(G_OBJECT(pMessageDialog), "text", &pText, nullptr);
- return OUString(pText, pText ? strlen(pText) : 0, RTL_TEXTENCODING_UTF8);
- }
-
- void set_primary_text(GtkMessageDialog* pMessageDialog, const OUString& rText)
- {
- g_object_set(G_OBJECT(pMessageDialog), "text",
- OUStringToOString(rText, RTL_TEXTENCODING_UTF8).getStr(),
- nullptr);
- }
-
- void set_secondary_text(GtkMessageDialog* pMessageDialog, const OUString& rText)
- {
- g_object_set(G_OBJECT(pMessageDialog), "secondary-text",
- OUStringToOString(rText, RTL_TEXTENCODING_UTF8).getStr(),
- nullptr);
- }
-
- OUString get_secondary_text(GtkMessageDialog* pMessageDialog)
- {
- gchar* pText = nullptr;
- g_object_get(G_OBJECT(pMessageDialog), "secondary-text", &pText, nullptr);
- return OUString(pText, pText ? strlen(pText) : 0, RTL_TEXTENCODING_UTF8);
- }
-}
-
class GtkInstanceWindow : public GtkInstanceContainer, public virtual weld::Window
{
private:
@@ -2578,9 +2593,24 @@ public:
{
}
- virtual void set_active(const OString& rIdent, bool bActive) override
+ virtual void set_item_active(const OString& rIdent, bool bActive) override
{
- set_item_active(rIdent, bActive);
+ MenuHelper::set_item_active(rIdent, bActive);
+ }
+
+ virtual void set_item_label(const OString& rIdent, const OUString& rLabel) override
+ {
+ MenuHelper::set_item_label(rIdent, rLabel);
+ }
+
+ virtual void set_item_help_id(const OString& rIdent, const OString& rHelpId) override
+ {
+ MenuHelper::set_item_help_id(rIdent, rHelpId);
+ }
+
+ virtual OString get_item_help_id(const OString& rIdent) const override
+ {
+ return MenuHelper::get_item_help_id(rIdent);
}
virtual void signal_activate(GtkMenuItem* pItem) override
@@ -3211,7 +3241,9 @@ public:
virtual void set_selection_mode(bool bMultiple) override
{
+ disable_notify_events();
gtk_tree_selection_set_mode(gtk_tree_view_get_selection(m_pTreeView), bMultiple ? GTK_SELECTION_MULTIPLE : GTK_SELECTION_SINGLE);
+ enable_notify_events();
}
virtual int count_selected_rows() const override