[Libreoffice-commits] core.git: 5 commits - desktop/source include/LibreOfficeKit include/vcl sc/qa sw/inc sw/source vcl/Library_vcl.mk vcl/source

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Mon Oct 2 05:24:57 UTC 2017


 desktop/source/lib/init.cxx             |   27 +++++++++++++++++++
 include/LibreOfficeKit/LibreOfficeKit.h |    3 ++
 include/vcl/IDialogRenderable.hxx       |   44 ++++++++++++++++++++++++++++++++
 sc/qa/unit/screenshots/screenshots.cxx  |    2 -
 sw/inc/unotxdoc.hxx                     |   11 ++++++++
 sw/source/uibase/uno/unotxdoc.cxx       |   31 ++++++++++++++++++++++
 vcl/Library_vcl.mk                      |    2 +
 vcl/source/app/IDialogRenderable.cxx    |   22 ++++++++++++++++
 vcl/source/app/ITiledRenderable.cxx     |   22 ++++++++++++++++
 vcl/source/gdi/virdev.cxx               |   10 -------
 vcl/source/window/debugevent.cxx        |    3 +-
 11 files changed, 165 insertions(+), 12 deletions(-)

New commits:
commit abc2e3aaa5d7f201671b6fff2bc211bde0bbe22c
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Thu Jun 22 12:20:01 2017 +0200

    Instantiate spell dialog and paint in a paintDialog call
    
    Change-Id: I7bd7f9cb33cd79d1e55ce51fe39917c5741bdf18

diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index dfc75a7f824d..78d3ffe123fc 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -168,6 +168,7 @@
 #include <svx/svdview.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/servicehelper.hxx>
+#include <SwSpellDialogChildWindow.hxx>
 #include <memory>
 
 #define TWIPS_PER_PIXEL 15
@@ -3640,12 +3641,20 @@ vcl::DialogID SwXTextDocument::findDialog()
     return vcl::DialogID(0);
 }
 
-void SwXTextDocument::paintDialog(vcl::DialogID /*rDialogID*/, VirtualDevice& /*rDevice*/, int /*nWidth*/, int /*nHeight*/)
+void SwXTextDocument::paintDialog(vcl::DialogID /*rDialogID*/, VirtualDevice& rDevice, int nWidth, int nHeight)
 {
-    //SwViewShell* pViewShell = pDocShell->GetWrtShell();
+    SfxViewShell* pViewShell = pDocShell->GetView();
+    SfxViewFrame* pViewFrame = pViewShell->GetViewFrame();
+    SfxChildWindow* pSfxChildWindow = SwSpellDialogChildWindow::CreateImpl(&pViewFrame->GetWindow(), SwSpellDialogChildWindow::GetChildWindowId(),
+                                                                           &pViewFrame->GetBindings(), nullptr);
+
+    Size aSize(nWidth, nHeight);
+
+    vcl::Window* pWindow = pSfxChildWindow->GetWindow();
 
-    //SwSpellDialogChildWindow::CreateImpl(nullptr, SwSpellDialogChildWindow::GetChildWindowId(),
-    //                                     pViewShell->GetBindings(), );
+    pWindow->SetSizePixel(aSize);
+    pWindow->Show();
+    pWindow->Paint(rDevice, tools::Rectangle(Point(), aSize));
 }
 
 void SwXTextDocument::postDialogMouseEvent(vcl::DialogID /*rDialogID*/, int /*nType*/, int /*nCharCode*/, int /*nKeyCode*/)
commit e81338c4e66a3f1193ed338ebab8c436a830db6b
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Fri May 26 22:55:31 2017 +0200

    Add IDialogRenderable interface for rendering of dialogs
    
    Change-Id: I1d85729a1ac1a99d33ea2bde1b50ccf4c05ca9a9

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 4566a01dac37..476b283c9104 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -84,6 +84,7 @@
 #include <vcl/sysdata.hxx>
 #include <vcl/virdev.hxx>
 #include <vcl/ITiledRenderable.hxx>
+#include <vcl/IDialogRenderable.hxx>
 #include <unicode/uchar.h>
 #include <unotools/configmgr.hxx>
 #include <unotools/syslocaleoptions.hxx>
@@ -590,6 +591,8 @@ static unsigned char* doc_renderFont(LibreOfficeKitDocument* pThis,
                           int* pFontHeight);
 static char* doc_getPartHash(LibreOfficeKitDocument* pThis, int nPart);
 
+static void doc_paintDialog(LibreOfficeKitDocument* pThis, unsigned char* pBuffer, int nWidth, int nHeight);
+
 LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XComponent> &xComponent)
     : mxComponent(xComponent)
 {
@@ -636,6 +639,8 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone
         m_pDocumentClass->renderFont = doc_renderFont;
         m_pDocumentClass->getPartHash = doc_getPartHash;
 
+        m_pDocumentClass->paintDialog = doc_paintDialog;
+
         gDocumentClass = m_pDocumentClass;
     }
     pClass = m_pDocumentClass.get();
@@ -1153,6 +1158,12 @@ ITiledRenderable* getTiledRenderable(LibreOfficeKitDocument* pThis)
     return dynamic_cast<ITiledRenderable*>(pDocument->mxComponent.get());
 }
 
+IDialogRenderable* getDialogRenderable(LibreOfficeKitDocument* pThis)
+{
+    LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
+    return dynamic_cast<IDialogRenderable*>(pDocument->mxComponent.get());
+}
+
 } // anonymous namespace
 
 // Wonder global state ...
@@ -3001,6 +3012,22 @@ unsigned char* doc_renderFont(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pTh
     return nullptr;
 }
 
+static void doc_paintDialog(LibreOfficeKitDocument* pThis, unsigned char* pBuffer, int nWidth, int nHeight)
+{
+    SolarMutexGuard aGuard;
+
+    IDialogRenderable* pDialogRenderable = getDialogRenderable(pThis);
+
+    ScopedVclPtrInstance<VirtualDevice> pDevice(nullptr, Size(1, 1), DeviceFormat::DEFAULT);
+    pDevice->SetBackground(Wallpaper(Color(COL_TRANSPARENT)));
+
+    pDevice->SetOutputSizePixelScaleOffsetAndBuffer(Size(nWidth, nHeight), Fraction(1.0), Point(), pBuffer);
+
+    vcl::DialogID aDialogID(pDialogRenderable->findDialog());
+
+    pDialogRenderable->paintDialog(aDialogID, *pDevice.get(), nWidth, nHeight);
+}
+
 static char* lo_getError (LibreOfficeKit *pThis)
 {
     SolarMutexGuard aGuard;
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index 0633f46f97e2..2f0702c67ca8 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -266,6 +266,9 @@ struct _LibreOfficeKitDocumentClass
                        int* pArray,
                        size_t nSize);
 
+    /// WIP
+    void (*paintDialog) (LibreOfficeKitDocument* pThis, unsigned char* pBuffer, int nWidth, int nHeight);
+
 #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
 };
 
diff --git a/include/vcl/IDialogRenderable.hxx b/include/vcl/IDialogRenderable.hxx
new file mode 100644
index 000000000000..18694092c2fa
--- /dev/null
+++ b/include/vcl/IDialogRenderable.hxx
@@ -0,0 +1,44 @@
+/* -*- 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_IDIALOGRENDERABLE_HXX
+#define INCLUDED_VCL_IDIALOGRENDERABLE_HXX
+
+#include <tools/gen.hxx>
+#include <vcl/pointr.hxx>
+#include <vcl/virdev.hxx>
+
+namespace vcl
+{
+
+typedef sal_Int32 DialogID;
+
+class VCL_DLLPUBLIC IDialogRenderable
+{
+public:
+    virtual ~IDialogRenderable();
+
+    virtual DialogID findDialog() = 0;
+
+    virtual void paintDialog(DialogID rDialogID, VirtualDevice &rDevice,
+                             int nOutputWidth, int nOutputHeight) = 0;
+
+    virtual void postDialogMouseEvent(DialogID rDialogID, int nType,
+                                      int nCharCode, int nKeyCode) = 0;
+
+    virtual void postDialogKeyEvent(DialogID rDialogID, int nType, int nX, int nY,
+                                    int nCount, int nButtons, int nModifier) = 0;
+};
+
+} // namespace vcl
+
+#endif // INCLUDED_VCL_IDIALOGRENDERABLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index 797aec9512fa..0d782213ce61 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -70,6 +70,7 @@
 #include <cppuhelper/implbase.hxx>
 #include <vcl/event.hxx>
 #include <vcl/ITiledRenderable.hxx>
+#include <vcl/IDialogRenderable.hxx>
 #include <com/sun/star/tiledrendering/XTiledRenderable.hpp>
 
 #include <unobaseclass.hxx>
@@ -131,6 +132,7 @@ class SW_DLLPUBLIC SwXTextDocument : public SwXTextDocumentBaseClass,
     public SvxFmMSFactory,
     public SfxBaseModel,
     public vcl::ITiledRenderable,
+    public vcl::IDialogRenderable,
     public css::tiledrendering::XTiledRenderable
 {
 private:
@@ -428,6 +430,15 @@ public:
     OUString getRulerState() override;
     /// @see vcl::ITiledRenderable::getPostIts().
     OUString getPostIts() override;
+
+    vcl::DialogID findDialog() override;
+    void paintDialog(vcl::DialogID rDialogID, VirtualDevice &rDevice, int nWidth, int nHeight) override;
+    void postDialogMouseEvent(vcl::DialogID rDialogID, int nType,
+                             int nCharCode, int nKeyCode) override;
+
+    void postDialogKeyEvent(vcl::DialogID rDialogID, int nType, int nX, int nY,
+                            int nCount, int nButtons, int nModifier) override;
+
     // css::tiledrendering::XTiledRenderable
     virtual void SAL_CALL paintTile( const ::css::uno::Any& Parent, ::sal_Int32 nOutputWidth, ::sal_Int32 nOutputHeight, ::sal_Int32 nTilePosX, ::sal_Int32 nTilePosY, ::sal_Int32 nTileWidth, ::sal_Int32 nTileHeight ) override;
 
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index c1e25aadb2a7..dfc75a7f824d 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3635,6 +3635,28 @@ void SAL_CALL SwXTextDocument::paintTile( const ::css::uno::Any& Parent, ::sal_I
     #endif
 }
 
+vcl::DialogID SwXTextDocument::findDialog()
+{
+    return vcl::DialogID(0);
+}
+
+void SwXTextDocument::paintDialog(vcl::DialogID /*rDialogID*/, VirtualDevice& /*rDevice*/, int /*nWidth*/, int /*nHeight*/)
+{
+    //SwViewShell* pViewShell = pDocShell->GetWrtShell();
+
+    //SwSpellDialogChildWindow::CreateImpl(nullptr, SwSpellDialogChildWindow::GetChildWindowId(),
+    //                                     pViewShell->GetBindings(), );
+}
+
+void SwXTextDocument::postDialogMouseEvent(vcl::DialogID /*rDialogID*/, int /*nType*/, int /*nCharCode*/, int /*nKeyCode*/)
+{
+}
+
+void SwXTextDocument::postDialogKeyEvent(vcl::DialogID /*rDialogID*/, int /*nType*/, int /*nX*/, int /*nY*/,
+                                         int /*nCount*/, int /*nButtons*/, int /*nModifier*/)
+{
+}
+
 void * SAL_CALL SwXTextDocument::operator new( size_t t) throw()
 {
     return SwXTextDocumentBaseClass::operator new(t);
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 4c636accce92..bc48ea8b0338 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -330,6 +330,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
     vcl/source/app/IconThemeScanner \
     vcl/source/app/IconThemeSelector \
     vcl/source/app/ITiledRenderable \
+    vcl/source/app/IDialogRenderable \
     vcl/source/app/sound \
     vcl/source/app/stdtext \
     vcl/source/app/svapp \
diff --git a/vcl/source/app/IDialogRenderable.cxx b/vcl/source/app/IDialogRenderable.cxx
new file mode 100644
index 000000000000..58ec05265101
--- /dev/null
+++ b/vcl/source/app/IDialogRenderable.cxx
@@ -0,0 +1,22 @@
+/* -*- 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/.
+ *
+ */
+
+#include <vcl/IDialogRenderable.hxx>
+
+namespace vcl
+{
+
+IDialogRenderable::~IDialogRenderable()
+{
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit d663eabbebad69dd64e5d9b05c60375304b28573
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Fri May 26 22:37:06 2017 +0200

    move ITileRenderable implementation to own file
    
    Change-Id: Ib05ecf5f92e0ae4adf99c4dd10d60e730a95cf45

diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 5d62542e8b13..4c636accce92 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -329,6 +329,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
     vcl/source/app/IconThemeInfo \
     vcl/source/app/IconThemeScanner \
     vcl/source/app/IconThemeSelector \
+    vcl/source/app/ITiledRenderable \
     vcl/source/app/sound \
     vcl/source/app/stdtext \
     vcl/source/app/svapp \
diff --git a/vcl/source/app/ITiledRenderable.cxx b/vcl/source/app/ITiledRenderable.cxx
new file mode 100644
index 000000000000..3eb5dcd2da6e
--- /dev/null
+++ b/vcl/source/app/ITiledRenderable.cxx
@@ -0,0 +1,22 @@
+/* -*- 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/.
+ *
+ */
+
+#include <vcl/ITiledRenderable.hxx>
+
+namespace vcl
+{
+
+ITiledRenderable::~ITiledRenderable()
+{
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx
index 52bb9f566873..974533d9ea13 100644
--- a/vcl/source/gdi/virdev.cxx
+++ b/vcl/source/gdi/virdev.cxx
@@ -23,18 +23,8 @@
 #include "outdev.h"
 #include "PhysicalFontCollection.hxx"
 #include "svdata.hxx"
-
 #include <vcl/ITiledRenderable.hxx>
 
-namespace vcl
-{
-
-ITiledRenderable::~ITiledRenderable()
-{
-}
-
-}
-
 using namespace ::com::sun::star::uno;
 
 bool VirtualDevice::AcquireGraphics() const
commit 901ee5207599d683b0f82c954f905c04fd8b676f
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Wed Jul 26 23:28:09 2017 +0530

    Give name to debug event injector
    
    Change-Id: I3468776797426b04c1cb3206dbb194837a652e16

diff --git a/vcl/source/window/debugevent.cxx b/vcl/source/window/debugevent.cxx
index 80438d07f481..da2b68917f5c 100644
--- a/vcl/source/window/debugevent.cxx
+++ b/vcl/source/window/debugevent.cxx
@@ -22,7 +22,8 @@
 #if OSL_DEBUG_LEVEL > 0
 
 DebugEventInjector::DebugEventInjector( sal_uInt32 nMaxEvents) :
-    mnEventsLeft( nMaxEvents )
+      Timer("debug event injector")
+    , mnEventsLeft( nMaxEvents )
 {
     SetTimeout( 1000 /* ms */ );
     Start();
commit 6ed7a1da3cdc0434c39c3d87822c6fa04aec222c
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Wed Jun 28 18:51:51 2017 +0530

    Typo
    
    Change-Id: I2ecf3050aa68a0f2986c43b651d71b662a77e55a

diff --git a/sc/qa/unit/screenshots/screenshots.cxx b/sc/qa/unit/screenshots/screenshots.cxx
index adcfe9e93dbe..2c32d2c75874 100644
--- a/sc/qa/unit/screenshots/screenshots.cxx
+++ b/sc/qa/unit/screenshots/screenshots.cxx
@@ -123,7 +123,7 @@ void ScScreenshotTest::initialize()
 
 void ScScreenshotTest::registerKnownDialogsByID(mapType& rKnownDialogs)
 {
-    // fill map of unknown dialogs
+    // fill map of known dialogs
     rKnownDialogs["modules/scalc/ui/insertsheet.ui"] = 0;
     rKnownDialogs["modules/scalc/ui/deletecells.ui"] = 1;
     rKnownDialogs["modules/scalc/ui/pastespecial.ui"] = 2;


More information about the Libreoffice-commits mailing list