diff options
author | Pranav Kant <pranavk@collabora.co.uk> | 2017-01-06 14:26:53 +0530 |
---|---|---|
committer | pranavk <pranavk@collabora.co.uk> | 2017-01-06 09:58:14 +0000 |
commit | 3ab6e2783bf7142729924cb95ca730404d0c54e1 (patch) | |
tree | 784bc57c8abd406ed4d3790335bd6596299020b5 /libreofficekit | |
parent | ac03883cd66a2d58c17c8dac555a053586e46625 (diff) |
gtktiledviewer: Support for posting arguments to uno commands
Change-Id: I5db217b525d0f976ef6a7840e370f8f6a21d60cb
Reviewed-on: https://gerrit.libreoffice.org/32772
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
Diffstat (limited to 'libreofficekit')
-rw-r--r-- | libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx index 27c8e43872dd..2f75a650e7a2 100644 --- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx @@ -121,6 +121,7 @@ public: GtkWidget* m_pFormulabarEntry; GtkWidget* m_pScrolledWindow; std::map<GtkToolItem*, std::string> m_aToolItemCommandNames; + std::map<GtkToolItem*, std::string> m_aToolItemCommandArgs; std::map<std::string, GtkToolItem*> m_aCommandNameToolItems; /// Sensitivity (enabled or disabled) or each tool item, ignoring edit /// state. @@ -209,6 +210,14 @@ static std::string getNextAuthor() return std::string(pPasswd->pw_gecos) + " #" + std::to_string(++nCounter); } +static void lcl_registerToolItem(TiledWindow& rWindow, GtkToolItem* pItem, const std::string& rName, const std::string& rArgs = "") +{ + rWindow.m_aToolItemCommandNames[pItem] = rName; + rWindow.m_aToolItemCommandArgs[pItem] = rArgs; + rWindow.m_aCommandNameToolItems[rName] = pItem; + rWindow.m_aToolItemSensitivities[pItem] = true; +} + TiledRowColumnBar::TiledRowColumnBar(TiledBarType eType) : m_pDrawingArea(gtk_drawing_area_new()), m_nSizePixel(0), @@ -396,13 +405,6 @@ gboolean TiledCornerButton::drawImpl(GtkWidget* /*pWidget*/, cairo_t* pCairo) return FALSE; } -static void lcl_registerToolItem(TiledWindow& rWindow, GtkToolItem* pItem, const std::string& rName) -{ - rWindow.m_aToolItemCommandNames[pItem] = rName; - rWindow.m_aCommandNameToolItems[rName] = pItem; - rWindow.m_aToolItemSensitivities[pItem] = true; -} - const float fZooms[] = { 0.25, 0.5, 0.75, 1.0, 1.5, 2.0, 3.0, 5.0 }; static void iterateUnoParams(GtkWidget* pWidget, gpointer userdata) @@ -1332,12 +1334,13 @@ static void toggleToolItem(GtkWidget* pWidget, gpointer /*pData*/) LOKDocView* pLOKDocView = LOK_DOC_VIEW(rWindow.m_pDocView); GtkToolItem* pItem = GTK_TOOL_ITEM(pWidget); const std::string& rString = rWindow.m_aToolItemCommandNames[pItem]; - g_info("toggleToolItem: lok_doc_view_post_command('%s')", rString.c_str()); + const std::string& rArguments = rWindow.m_aToolItemCommandArgs[pItem]; + g_info("toggleToolItem: lok_doc_view_post_command('%s %s')", rString.c_str(), rArguments.c_str()); // notify about the finished Save gboolean bNotify = (rString == ".uno:Save"); - lok_doc_view_post_command(pLOKDocView, rString.c_str(), /*pArguments=*/nullptr, bNotify); + lok_doc_view_post_command(pLOKDocView, rString.c_str(), rArguments.c_str(), bNotify); } } |