[Libreoffice-commits] core.git: desktop/Library_sofficeapp.mk desktop/source include/vcl vcl/headless vcl/inc

Tor Lillqvist tml at collabora.com
Fri Mar 20 03:53:42 PDT 2015


 desktop/Library_sofficeapp.mk |    1 -
 desktop/source/lib/init.cxx   |   25 ++++++-------------------
 include/vcl/svpforlokit.hxx   |   27 +++++++++++++++++++++++++++
 vcl/headless/svpframe.cxx     |   14 +++++++++++++-
 vcl/headless/svpvd.cxx        |   17 +++++++++++++++++
 vcl/inc/headless/svpframe.hxx |    4 ++--
 6 files changed, 65 insertions(+), 23 deletions(-)

New commits:
commit a84456142ae1f578b3d02550df6a1d749c372028
Author: Tor Lillqvist <tml at collabora.com>
Date:   Fri Mar 20 12:36:09 2015 +0200

    Don't include vcl's private include files in desktop
    
    Introduce a handful of small public wrapper functions.
    
    Change-Id: I80e1e35d09675112d67b831f3efda483e709b540

diff --git a/desktop/Library_sofficeapp.mk b/desktop/Library_sofficeapp.mk
index 985e55e..91c7a51 100644
--- a/desktop/Library_sofficeapp.mk
+++ b/desktop/Library_sofficeapp.mk
@@ -14,7 +14,6 @@ $(eval $(call gb_Library_set_include,sofficeapp,\
     -I$(SRCDIR)/desktop/inc \
     -I$(SRCDIR)/desktop/source/inc \
     -I$(SRCDIR)/desktop/source/deployment/inc \
-    -I$(SRCDIR)/vcl/inc \
 ))
 
 $(eval $(call gb_Library_add_libs,sofficeapp,\
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index df4593f..c29223b 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -40,6 +40,7 @@
 #include <com/sun/star/ucb/XUniversalContentBroker.hpp>
 
 #include <vcl/svapp.hxx>
+#include <vcl/svpforlokit.hxx>
 #include <tools/resmgr.hxx>
 #include <tools/fract.hxx>
 #include <vcl/graphicfilter.hxx>
@@ -52,15 +53,6 @@
 
 #include <app.hxx>
 
-#if defined(UNX) && !defined(MACOSX) && !defined(ENABLE_HEADLESS)
-// Let's grab the SvpSalInstance and SvpSalVirtualDevice
-#include <headless/svpinst.hxx>
-#include <headless/svpframe.hxx>
-#include <headless/svpvd.hxx>
-
-#include <basebmp/bitmapdevice.hxx>
-#endif
-
 #include "../app/cmdlineargs.hxx"
 // We also need to hackily be able to start the main libreoffice thread:
 #include "../app/sofficemain.h"
@@ -613,9 +605,7 @@ void doc_paintTile (LibreOfficeKitDocument* pThis,
 #if defined(UNX) && !defined(MACOSX) && !defined(ENABLE_HEADLESS)
 
 #ifndef IOS
-    ImplSVData* pSVData = ImplGetSVData();
-    SvpSalInstance* pSalInstance = static_cast< SvpSalInstance* >(pSVData->mpDefInst);
-    pSalInstance->setBitCountFormatMapping( 32, ::basebmp::FORMAT_THIRTYTWO_BIT_TC_MASK_RGBA );
+    InitSvpForLibreOfficeKit();
 
     VirtualDevice aDevice(0, Size(1, 1), (sal_uInt16)32);
     boost::shared_array< sal_uInt8 > aBuffer( pBuffer, NoDelete< sal_uInt8 >() );
@@ -626,10 +616,7 @@ void doc_paintTile (LibreOfficeKitDocument* pThis,
     pDoc->paintTile(aDevice, nCanvasWidth, nCanvasHeight,
                     nTilePosX, nTilePosY, nTileWidth, nTileHeight);
 
-    SvpSalVirtualDevice* pSalDev = static_cast< SvpSalVirtualDevice* >(aDevice.getSalVirtualDevice());
-    basebmp::BitmapDeviceSharedPtr pBmpDev = pSalDev->getBitmapDevice();
-
-    *pRowStride = pBmpDev->getScanlineStride();
+    *pRowStride = GetRowStrideForLibreOfficeKit(aDevice.getSalVirtualDevice());
 #else
     SystemGraphicsData aData;
     aData.rCGContext = reinterpret_cast<CGContextRef>(pBuffer);
@@ -710,16 +697,16 @@ static void doc_registerCallback(LibreOfficeKitDocument* pThis,
 static void doc_postKeyEvent(LibreOfficeKitDocument* /*pThis*/, int nType, int nCharCode, int nKeyCode)
 {
 #if defined(UNX) && !defined(MACOSX) && !defined(ENABLE_HEADLESS)
-    if (SalFrame *pFocus = SvpSalFrame::GetFocusFrame())
+    if (SalFrame *pFocus = GetSvpFocusFrameForLibreOfficeKit())
     {
         KeyEvent aEvent(nCharCode, nKeyCode, 0);
         switch (nType)
         {
         case LOK_KEYEVENT_KEYINPUT:
-            Application::PostKeyEvent(VCLEVENT_WINDOW_KEYINPUT, pFocus->GetWindow(), &aEvent);
+            Application::PostKeyEvent(VCLEVENT_WINDOW_KEYINPUT, GetSalFrameWindowForLibreOfficeKit(pFocus), &aEvent);
             break;
         case LOK_KEYEVENT_KEYUP:
-            Application::PostKeyEvent(VCLEVENT_WINDOW_KEYUP, pFocus->GetWindow(), &aEvent);
+            Application::PostKeyEvent(VCLEVENT_WINDOW_KEYUP, GetSalFrameWindowForLibreOfficeKit(pFocus), &aEvent);
             break;
         }
     }
diff --git a/include/vcl/svpforlokit.hxx b/include/vcl/svpforlokit.hxx
new file mode 100644
index 0000000..51299ee
--- /dev/null
+++ b/include/vcl/svpforlokit.hxx
@@ -0,0 +1,27 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_VCL_SVPFORLOKIT_HXX
+#define INCLUDED_VCL_SVPFORLOKIT_HXX
+
+#include <vcl/virdev.hxx>
+#include <vcl/dllapi.h>
+
+// These functions are for use by LibreOfficeKit only, I think
+
+class SalFrame;
+
+VCL_DLLPUBLIC void InitSvpForLibreOfficeKit();
+VCL_DLLPUBLIC int GetRowStrideForLibreOfficeKit(SalVirtualDevice* pVD);
+VCL_DLLPUBLIC SalFrame* GetSvpFocusFrameForLibreOfficeKit();
+VCL_DLLPUBLIC vcl::Window* GetSalFrameWindowForLibreOfficeKit(SalFrame *pSF);
+
+#endif // INCLUDED_VCL_SVPFORLOKIT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/headless/svpframe.cxx b/vcl/headless/svpframe.cxx
index 8e56c82..e1218d7 100644
--- a/vcl/headless/svpframe.cxx
+++ b/vcl/headless/svpframe.cxx
@@ -18,7 +18,9 @@
  */
 
 #include <string.h>
-#include "vcl/syswin.hxx"
+#include <vcl/svpforlokit.hxx>
+#include <vcl/syswin.hxx>
+
 #include "headless/svpframe.hxx"
 #include "headless/svpinst.hxx"
 #include "headless/svpgdi.hxx"
@@ -493,4 +495,14 @@ void SvpSalFrame::EndSetClipRegion()
 {
 }
 
+SalFrame* GetSvpFocusFrameForLibreOfficeKit()
+{
+    return SvpSalFrame::GetFocusFrame();
+}
+
+vcl::Window* GetSalFrameWindowForLibreOfficeKit(SalFrame *pSF)
+{
+    return pSF->GetWindow();
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/headless/svpvd.cxx b/vcl/headless/svpvd.cxx
index 84701eb..0daf4cd 100644
--- a/vcl/headless/svpvd.cxx
+++ b/vcl/headless/svpvd.cxx
@@ -19,6 +19,8 @@
 
 #ifndef IOS
 
+#include <vcl/svpforlokit.hxx>
+
 #include "headless/svpbmp.hxx"
 #include "headless/svpinst.hxx"
 #include "headless/svpvd.hxx"
@@ -95,6 +97,21 @@ bool SvpSalVirtualDevice::SetSizeUsingBuffer( long nNewDX, long nNewDY,
     return true;
 }
 
+void InitSvpForLibreOfficeKit()
+{
+    ImplSVData* pSVData = ImplGetSVData();
+    SvpSalInstance* pSalInstance = static_cast< SvpSalInstance* >(pSVData->mpDefInst);
+    pSalInstance->setBitCountFormatMapping( 32, ::basebmp::FORMAT_THIRTYTWO_BIT_TC_MASK_RGBA );
+}
+
+int GetRowStrideForLibreOfficeKit(SalVirtualDevice* pVD)
+{
+    SvpSalVirtualDevice* pSalDev = static_cast< SvpSalVirtualDevice* >(pVD);
+    basebmp::BitmapDeviceSharedPtr pBmpDev = pSalDev->getBitmapDevice();
+
+    return pBmpDev->getScanlineStride();
+}
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/headless/svpframe.hxx b/vcl/inc/headless/svpframe.hxx
index 7bbf73a..b07c216 100644
--- a/vcl/inc/headless/svpframe.hxx
+++ b/vcl/inc/headless/svpframe.hxx
@@ -58,7 +58,7 @@ class VCL_DLLPUBLIC SvpSalFrame : public SalFrame
 
     std::list< SvpSalGraphics* >        m_aGraphics;
 
-    SAL_DLLPUBLIC_EXPORT static SvpSalFrame*       s_pFocusFrame;
+    static SvpSalFrame*       s_pFocusFrame;
 public:
     SvpSalFrame( SvpSalInstance* pInstance,
                  SalFrame* pParent,
@@ -136,7 +136,7 @@ public:
     virtual void                SetApplicationID(const OUString &rApplicationID) SAL_OVERRIDE { (void) rApplicationID; }
     bool                        IsVisible() { return m_bVisible; }
 
-    SAL_DLLPUBLIC_EXPORT static SvpSalFrame*         GetFocusFrame() { return s_pFocusFrame; }
+    static SvpSalFrame*         GetFocusFrame() { return s_pFocusFrame; }
 
 };
 


More information about the Libreoffice-commits mailing list