[Libreoffice-commits] core.git: Branch 'feature/lok_dialog' - 2 commits - desktop/qa sw/source
Tomaž Vajngerl
tomaz.vajngerl at collabora.co.uk
Thu Jun 22 14:06:24 UTC 2017
desktop/qa/desktop_lib/test_desktop_lib.cxx | 27 ++++++++++++++++++++++++++-
sw/source/uibase/uno/unotxdoc.cxx | 17 +++++++++++++----
2 files changed, 39 insertions(+), 5 deletions(-)
New commits:
commit 6c14bdf614d3a37695e88d281cc4b933f807a80c
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 675c18a9f211..dc225023c0cd 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -164,6 +164,7 @@
#include <svx/svdview.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/servicehelper.hxx>
+#include <SwSpellDialogChildWindow.hxx>
#include <memory>
using namespace ::com::sun::star;
@@ -3567,12 +3568,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);
- //SwSpellDialogChildWindow::CreateImpl(nullptr, SwSpellDialogChildWindow::GetChildWindowId(),
- // pViewShell->GetBindings(), );
+ Size aSize(nWidth, nHeight);
+
+ vcl::Window* pWindow = pSfxChildWindow->GetWindow();
+
+ 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 8625068f105140bf670b70937c2e2161c7de0dee
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Thu Jun 22 12:18:26 2017 +0200
Test for paintDialog to show if we succeed to paint into a VD
Change-Id: Iccba81ff4326f1fb3d93bdf9393d7d3cc3675f9e
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index c5ee03fb56ca..7172c1984e2a 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -40,6 +40,7 @@
#include <cairo.h>
#include <ostream>
#include <config_features.h>
+#include <png.h>
#include <lib/init.hxx>
@@ -115,6 +116,7 @@ public:
void testCommentsCallbacksWriter();
void testRunMacro();
void testExtractParameter();
+ void testDialogsWriter();
CPPUNIT_TEST_SUITE(DesktopLOKTest);
CPPUNIT_TEST(testGetStyles);
@@ -157,6 +159,7 @@ public:
CPPUNIT_TEST(testCommentsCallbacksWriter);
CPPUNIT_TEST(testRunMacro);
CPPUNIT_TEST(testExtractParameter);
+ CPPUNIT_TEST(testDialogsWriter);
CPPUNIT_TEST_SUITE_END();
uno::Reference<lang::XComponent> mxComponent;
@@ -178,7 +181,6 @@ public:
// for testContextMenu{Calc, Writer}
osl::Condition m_aContextMenuCondition;
boost::property_tree::ptree m_aContextMenuResult;
-
};
LibLODocument_Impl* DesktopLOKTest::loadDoc(const char* pName, LibreOfficeKitDocumentType eType)
@@ -2151,6 +2153,29 @@ void DesktopLOKTest::testExtractParameter()
CPPUNIT_ASSERT_EQUAL(OUString("Something1,Something2=blah,Something3"), aOptions);
}
+void DesktopLOKTest::testDialogsWriter()
+{
+ LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
+ int nCanvasWidth = 100;
+ int nCanvasHeight = 300;
+ 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");
+ }
+
+ CPPUNIT_ASSERT(false);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest);
CPPUNIT_PLUGIN_IMPLEMENT();
More information about the Libreoffice-commits
mailing list