From 17e3b1763321f5f338e415bb0d0d86f5e7f7d2c6 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 27 May 2015 20:51:09 +0200 Subject: [PATCH 005/398] loplugin:staticmethods Change-Id: Idb1072ecedd9ab0315d67e296da6d306c098b183 (cherry picked from commit 5af7ca55a3d06ab23df715346c9b24d1333907be) --- libreofficekit/source/gtk/lokdocview.cxx | 39 +++++++++++++++++--------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index 79cc649fa369..24f9d04a9024 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -38,6 +38,26 @@ // We know that VirtualDevices use a DPI of 96. static const int DPI = 96; +namespace { + +/// Sets rWidth and rHeight from a "width, height" string. +void payloadToSize(const char* pPayload, long& rWidth, long& rHeight) +{ + rWidth = rHeight = 0; + gchar** ppCoordinates = g_strsplit(pPayload, ", ", 2); + gchar** ppCoordinate = ppCoordinates; + if (!*ppCoordinate) + return; + rWidth = atoi(*ppCoordinate); + ++ppCoordinate; + if (!*ppCoordinate) + return; + rHeight = atoi(*ppCoordinate); + g_strfreev(ppCoordinates); +} + +} + /// Holds data used by LOKDocView only. struct LOKDocView_Impl { @@ -170,8 +190,6 @@ struct LOKDocView_Impl * the tiles that intersect with pPartial. */ void renderDocument(GdkRectangle* pPartial); - /// Sets rWidth and rHeight from a "width, height" string. - static void payloadToSize(const char* pPayload, long& rWidth, long& rHeight); /// Returns the GdkRectangle of a width,height,x,y string. static GdkRectangle payloadToRectangle(const char* pPayload); /// Returns the GdkRectangles of a w,h,x,y;w2,h2,x2,y2;... string. @@ -846,21 +864,6 @@ void LOKDocView_Impl::renderDocument(GdkRectangle* pPartial) } } -void LOKDocView_Impl::payloadToSize(const char* pPayload, long& rWidth, long& rHeight) -{ - rWidth = rHeight = 0; - gchar** ppCoordinates = g_strsplit(pPayload, ", ", 2); - gchar** ppCoordinate = ppCoordinates; - if (!*ppCoordinate) - return; - rWidth = atoi(*ppCoordinate); - ++ppCoordinate; - if (!*ppCoordinate) - return; - rHeight = atoi(*ppCoordinate); - g_strfreev(ppCoordinates); -} - GdkRectangle LOKDocView_Impl::payloadToRectangle(const char* pPayload) { GdkRectangle aRet; @@ -1033,7 +1036,7 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback) break; case LOK_CALLBACK_DOCUMENT_SIZE_CHANGED: { - LOKDocView_Impl::payloadToSize(pCallback->m_aPayload.c_str(), m_nDocumentWidthTwips, m_nDocumentHeightTwips); + payloadToSize(pCallback->m_aPayload.c_str(), m_nDocumentWidthTwips, m_nDocumentHeightTwips); } break; case LOK_CALLBACK_SET_PART: -- 2.12.0