[Libreoffice-commits] core.git: Branch 'feature/lok_dialog' - 4 commits - desktop/qa include/sfx2 sc/qa sfx2/source sw/source

Pranav Kant pranavk at collabora.co.uk
Fri Jun 30 08:54:07 UTC 2017


 desktop/qa/desktop_lib/test_desktop_lib.cxx |   15 ++++-----------
 include/sfx2/module.hxx                     |    1 +
 sc/qa/unit/screenshots/screenshots.cxx      |    2 +-
 sfx2/source/appl/module.cxx                 |   15 +++++++++++++++
 sw/source/uibase/uno/unotxdoc.cxx           |   16 +++++++++-------
 5 files changed, 30 insertions(+), 19 deletions(-)

New commits:
commit a15784895e4933cfab06fb7fefdf8c7bd47f55a1
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Fri Jun 30 14:22:40 2017 +0530

    Use the child window factory to create dialog via uno command
    
    Change-Id: I76c78c5699dae9d23ff6868fe388570b9717c5b9

diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index fcc5621354c5..8d5c72016cb7 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -61,6 +61,8 @@
 #include <unoredlines.hxx>
 #include <unosrch.hxx>
 #include <sfx2/dispatch.hxx>
+#include <sfx2/msg.hxx>
+#include <sfx2/msgpool.hxx>
 #include <sfx2/request.hxx>
 #include <sfx2/objsh.hxx>
 #include <unoprnms.hxx>
@@ -3571,16 +3573,16 @@ void SwXTextDocument::paintDialog(vcl::DialogID /*rDialogID*/, VirtualDevice& rD
 {
     SfxViewShell* pViewShell = pDocShell->GetView();
     SfxViewFrame* pViewFrame = pViewShell->GetViewFrame();
-    SfxChildWindow* pSfxChildWindow = SwSpellDialogChildWindow::CreateImpl(&pViewFrame->GetWindow(), SwSpellDialogChildWindow::GetChildWindowId(),
-                                                                           &pViewFrame->GetBindings(), nullptr);
 
-    Size aSize(nWidth, nHeight);
+    SwModule* pMod = SW_MOD();
+    SfxSlotPool* pSlotPool = pMod->GetSlotPool();
+    const SfxSlot* pSlot = pSlotPool->GetUnoSlot(".uno:SpellDialog");
 
-    vcl::Window* pWindow = pSfxChildWindow->GetWindow();
+    SfxChildWinFactory* pFactory = pMod->GetChildWinFactory(pSlot->GetSlotId());
+    SfxChildWindow* pSfxChildWindow = pFactory->pCtor(&pViewFrame->GetWindow(), pFactory->nId, &pViewFrame->GetBindings(), &pFactory->aInfo);
 
-    pWindow->SetSizePixel(aSize);
-    pWindow->Show();
-    pWindow->Paint(rDevice, tools::Rectangle(Point(), aSize));
+    vcl::Window* pWindow = pSfxChildWindow->GetWindow();
+    pWindow->PaintToDevice(&rDevice, Point(0, 0), Size(1, 1) /* Ignored */);
 }
 
 void SwXTextDocument::postDialogMouseEvent(vcl::DialogID /*rDialogID*/, int /*nType*/, int /*nCharCode*/, int /*nKeyCode*/)
commit 04a30aa545038193c9c061db2442aa2292a3470b
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Fri Jun 30 14:21:15 2017 +0530

    sfx2: Get child window by Id
    
    Change-Id: I54afc548bb18a86aa4ed4ffec2c44d071b5ac3b3

diff --git a/include/sfx2/module.hxx b/include/sfx2/module.hxx
index 014196c50578..51303f3bdcfb 100644
--- a/include/sfx2/module.hxx
+++ b/include/sfx2/module.hxx
@@ -78,6 +78,7 @@ public:
     void                        RegisterToolBoxControl(const SfxTbxCtrlFactory&);
     void                        RegisterChildWindow(SfxChildWinFactory*);
     void                        RegisterStatusBarControl(const SfxStbCtrlFactory&);
+    SfxChildWinFactory*         GetChildWinFactory(const sal_uInt16 nId) const;
 
     virtual VclPtr<SfxTabPage>  CreateTabPage( sal_uInt16 nId,
                                                vcl::Window* pParent,
diff --git a/sfx2/source/appl/module.cxx b/sfx2/source/appl/module.cxx
index f26660abd87e..098c314e50bf 100644
--- a/sfx2/source/appl/module.cxx
+++ b/sfx2/source/appl/module.cxx
@@ -193,6 +193,21 @@ SfxChildWinFactArr_Impl* SfxModule::GetChildWinFactories_Impl() const
     return pImpl->pFactArr;
 }
 
+SfxChildWinFactory* SfxModule::GetChildWinFactory(const sal_uInt16 nId) const
+{
+    DBG_ASSERT( pImpl, "No real Module!" );
+
+    for (size_t nFactory = 0; nFactory < pImpl->pFactArr->size(); ++nFactory)
+    {
+        if (nId == (*pImpl->pFactArr)[nFactory].nId)
+        {
+            return &(*pImpl->pFactArr)[nFactory];
+        }
+    }
+
+    return nullptr;
+}
+
 VclPtr<SfxTabPage> SfxModule::CreateTabPage( sal_uInt16, vcl::Window*, const SfxItemSet& )
 {
     return VclPtr<SfxTabPage>();
commit be1ce6fc4fec61d4a81d271a5896f12ea4377187
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Fri Jun 30 14:20:19 2017 +0530

    Write the dialog rendering to file
    
    Change-Id: I7b10f9ee6e1f914e85ded8756b80c17a505ee0fc

diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index d705e6c8ed97..dbc2e029889e 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -2156,22 +2156,15 @@ void DesktopLOKTest::testExtractParameter()
 void DesktopLOKTest::testDialogsWriter()
 {
     LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
-    int nCanvasWidth = 100;
-    int nCanvasHeight = 300;
+    int nCanvasWidth = 800;
+    int nCanvasHeight = 600;
     sal_Int32 nStride = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, nCanvasWidth);
     std::vector<unsigned char> aBuffer(nStride * nCanvasHeight);
 
     pDocument->pClass->paintDialog(pDocument, aBuffer.data(), nCanvasWidth, nCanvasHeight);
 
-    for (long y = 0; y < nCanvasHeight; ++y)
-    {
-        unsigned char* c = &aBuffer.data()[y * nStride];
-        for (long x = 0; x < nStride; ++x)
-        {
-            printf ("%02x ", c[x]);
-        }
-        printf ("\n");
-    }
+    cairo_surface_t* pSurface = cairo_image_surface_create_for_data(aBuffer.data(), CAIRO_FORMAT_ARGB32, nCanvasWidth, nCanvasHeight, nStride);
+    cairo_surface_write_to_png(pSurface, "/tmp/dialog.png");
 
     CPPUNIT_ASSERT(false);
 }
commit 3ca2fea69a056646ae42e78b31966acc9eae29f1
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 9e6b65ec4a5f..30d461919be7 100644
--- a/sc/qa/unit/screenshots/screenshots.cxx
+++ b/sc/qa/unit/screenshots/screenshots.cxx
@@ -122,7 +122,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