Kaydet (Commit) 3c014945 authored tarafından Miklos Vajna's avatar Miklos Vajna

gtktiledviewer: use SearchItem.SearchStartPoint*

Change-Id: If0219eda3a2ca3b97c37bea70e35d47e49d38e02
(cherry picked from commit 3c9fb589)
üst 6bccdf23
......@@ -74,6 +74,9 @@ void lok_docview_post_command (LOKDocView* pDocView, const char* p
/// Posts a keyboard event to LibreOfficeKit.
void lok_docview_post_key (GtkWidget* pWidget, GdkEventKey* pEvent, gpointer pData);
/// Get the visible area of the document (in twips).
void lok_docview_get_visarea(LOKDocView* pThis, GdkRectangle* pArea);
#ifdef __cplusplus
}
#endif
......
......@@ -158,10 +158,18 @@ static void doSearch(bool bBackwards)
aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchString/value", '/'), pText);
aTree.put(boost::property_tree::ptree::path_type("SearchItem.Backward/type", '/'), "boolean");
aTree.put(boost::property_tree::ptree::path_type("SearchItem.Backward/value", '/'), bBackwards);
LOKDocView* pLOKDocView = LOK_DOCVIEW(pDocView);
GdkRectangle aArea;
lok_docview_get_visarea(pLOKDocView, &aArea);
aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchStartPointX/type", '/'), "long");
aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchStartPointX/value", '/'), aArea.x);
aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchStartPointY/type", '/'), "long");
aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchStartPointY/value", '/'), aArea.y);
std::stringstream aStream;
boost::property_tree::write_json(aStream, aTree);
LOKDocView* pLOKDocView = LOK_DOCVIEW(pDocView);
lok_docview_post_command(pLOKDocView, ".uno:ExecuteSearch", aStream.str().c_str());
}
......
......@@ -1316,4 +1316,12 @@ SAL_DLLPUBLIC_EXPORT void lok_docview_post_key(GtkWidget* /*pWidget*/, GdkEventK
pDocView->m_pImpl->signalKey(pEvent);
}
SAL_DLLPUBLIC_EXPORT void lok_docview_get_visarea(LOKDocView* pThis, GdkRectangle* pArea)
{
GtkAdjustment* pHAdjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(pThis));
pArea->x = pThis->m_pImpl->pixelToTwip(gtk_adjustment_get_value(pHAdjustment));
GtkAdjustment* pVAdjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(pThis));
pArea->y = pThis->m_pImpl->pixelToTwip(gtk_adjustment_get_value(pVAdjustment));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment