summaryrefslogtreecommitdiff
path: root/libreofficekit
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-12-21 20:21:08 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-12-22 07:43:22 +0100
commit968b64d054eb164cee9fb92b6bf7dd93f478bf24 (patch)
tree80d92181e4796cf77b37b1faa03a3ccf106aef22 /libreofficekit
parent1d21a51d814b39711cb1cc7f925b0c620b42eaa7 (diff)
loplugin:flatten in l10ntools..lotuswordpro
Change-Id: Ie6de142db1987094fdf538148ac5ee33379a3e4b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127275 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'libreofficekit')
-rw-r--r--libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx60
-rw-r--r--libreofficekit/source/gtk/lokdocview.cxx36
2 files changed, 47 insertions, 49 deletions
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
index 90b96e57488a..a2cbd8021dea 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
@@ -409,36 +409,36 @@ gboolean LOKDocViewSigHandlers::configureEvent(GtkWidget* pWidget, GdkEventConfi
}
LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(LOK_DOC_VIEW(window->lokdocview));
- if (pDocument && pDocument->pClass->getDocumentType(pDocument) == LOK_DOCTYPE_SPREADSHEET)
- {
- GtkAdjustment* pVAdjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(window->scrolledwindow));
- int rowSizePixel = GTV_CALC_HEADER_BAR(window->rowbar)->m_nSizePixel = gtk_adjustment_get_page_size(pVAdjustment);
- int rowPosPixel = GTV_CALC_HEADER_BAR(window->rowbar)->m_nPositionPixel = gtk_adjustment_get_value(pVAdjustment);
- GtkAdjustment* pHAdjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(window->scrolledwindow));
- int colSizePixel = GTV_CALC_HEADER_BAR(window->columnbar)->m_nSizePixel = gtk_adjustment_get_page_size(pHAdjustment);
- int colPosPixel = GTV_CALC_HEADER_BAR(window->columnbar)->m_nPositionPixel = gtk_adjustment_get_value(pHAdjustment);
-
- std::stringstream aCommand;
- aCommand << ".uno:ViewRowColumnHeaders";
- aCommand << "?x=" << int(lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(window->lokdocview), colPosPixel));
- aCommand << "&width=" << int(lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(window->lokdocview), colSizePixel));
- aCommand << "&y=" << int(lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(window->lokdocview), rowPosPixel));
- aCommand << "&height=" << int(lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(window->lokdocview), rowSizePixel));
- std::stringstream ss;
- ss << "lok::Document::getCommandValues(" << aCommand.str() << ")";
- g_info("%s", ss.str().c_str());
- char* pValues = pDocument->pClass->getCommandValues(pDocument, aCommand.str().c_str());
- g_info("lok::Document::getCommandValues() returned '%s'", pValues);
- std::stringstream aStream(pValues);
- free(pValues);
- assert(!aStream.str().empty());
- boost::property_tree::ptree aTree;
- boost::property_tree::read_json(aStream, aTree);
-
- gtv_calc_header_bar_configure(GTV_CALC_HEADER_BAR(window->rowbar), &aTree.get_child("rows"));
- gtv_calc_header_bar_configure(GTV_CALC_HEADER_BAR(window->columnbar), &aTree.get_child("columns"));
- gtv_calc_header_bar_configure(GTV_CALC_HEADER_BAR(window->cornerarea), nullptr);
- }
+ if (!pDocument || pDocument->pClass->getDocumentType(pDocument) != LOK_DOCTYPE_SPREADSHEET)
+ return true;
+
+ GtkAdjustment* pVAdjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(window->scrolledwindow));
+ int rowSizePixel = GTV_CALC_HEADER_BAR(window->rowbar)->m_nSizePixel = gtk_adjustment_get_page_size(pVAdjustment);
+ int rowPosPixel = GTV_CALC_HEADER_BAR(window->rowbar)->m_nPositionPixel = gtk_adjustment_get_value(pVAdjustment);
+ GtkAdjustment* pHAdjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(window->scrolledwindow));
+ int colSizePixel = GTV_CALC_HEADER_BAR(window->columnbar)->m_nSizePixel = gtk_adjustment_get_page_size(pHAdjustment);
+ int colPosPixel = GTV_CALC_HEADER_BAR(window->columnbar)->m_nPositionPixel = gtk_adjustment_get_value(pHAdjustment);
+
+ std::stringstream aCommand;
+ aCommand << ".uno:ViewRowColumnHeaders";
+ aCommand << "?x=" << int(lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(window->lokdocview), colPosPixel));
+ aCommand << "&width=" << int(lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(window->lokdocview), colSizePixel));
+ aCommand << "&y=" << int(lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(window->lokdocview), rowPosPixel));
+ aCommand << "&height=" << int(lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(window->lokdocview), rowSizePixel));
+ std::stringstream ss;
+ ss << "lok::Document::getCommandValues(" << aCommand.str() << ")";
+ g_info("%s", ss.str().c_str());
+ char* pValues = pDocument->pClass->getCommandValues(pDocument, aCommand.str().c_str());
+ g_info("lok::Document::getCommandValues() returned '%s'", pValues);
+ std::stringstream aStream(pValues);
+ free(pValues);
+ assert(!aStream.str().empty());
+ boost::property_tree::ptree aTree;
+ boost::property_tree::read_json(aStream, aTree);
+
+ gtv_calc_header_bar_configure(GTV_CALC_HEADER_BAR(window->rowbar), &aTree.get_child("rows"));
+ gtv_calc_header_bar_configure(GTV_CALC_HEADER_BAR(window->columnbar), &aTree.get_child("columns"));
+ gtv_calc_header_bar_configure(GTV_CALC_HEADER_BAR(window->cornerarea), nullptr);
return true;
}
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 2d7852f3781e..45c9cacedff6 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -555,30 +555,28 @@ handleGraphicSelectionOnButtonRelease(LOKDocView* pDocView, GdkEventButton* pEve
}
}
- if (priv->m_bInDragGraphicSelection)
- {
- g_info("LOKDocView_Impl::signalButton: end of drag graphic selection");
- priv->m_bInDragGraphicSelection = false;
+ if (!priv->m_bInDragGraphicSelection)
+ return false;
- GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr);
- LOEvent* pLOEvent = new LOEvent(LOK_SET_GRAPHIC_SELECTION);
- pLOEvent->m_nSetGraphicSelectionType = LOK_SETGRAPHICSELECTION_END;
- pLOEvent->m_nSetGraphicSelectionX = pixelToTwip(pEvent->x, priv->m_fZoom);
- pLOEvent->m_nSetGraphicSelectionY = pixelToTwip(pEvent->y, priv->m_fZoom);
- g_task_set_task_data(task, pLOEvent, LOEvent::destroy);
+ g_info("LOKDocView_Impl::signalButton: end of drag graphic selection");
+ priv->m_bInDragGraphicSelection = false;
- g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error);
- if (error != nullptr)
- {
- g_warning("Unable to call LOK_SET_GRAPHIC_SELECTION: %s", error->message);
- g_clear_error(&error);
- }
- g_object_unref(task);
+ GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr);
+ LOEvent* pLOEvent = new LOEvent(LOK_SET_GRAPHIC_SELECTION);
+ pLOEvent->m_nSetGraphicSelectionType = LOK_SETGRAPHICSELECTION_END;
+ pLOEvent->m_nSetGraphicSelectionX = pixelToTwip(pEvent->x, priv->m_fZoom);
+ pLOEvent->m_nSetGraphicSelectionY = pixelToTwip(pEvent->y, priv->m_fZoom);
+ g_task_set_task_data(task, pLOEvent, LOEvent::destroy);
- return true;
+ g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error);
+ if (error != nullptr)
+ {
+ g_warning("Unable to call LOK_SET_GRAPHIC_SELECTION: %s", error->message);
+ g_clear_error(&error);
}
+ g_object_unref(task);
- return false;
+ return true;
}
static void