[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.1' - 4 commits - include/sfx2 libreofficekit/qa sfx2/source sw/inc sw/qa sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Fri Jul 29 08:29:01 UTC 2016
include/sfx2/viewsh.hxx | 1
libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 17 ++++++++-
sfx2/source/view/viewsh.cxx | 8 ++++
sw/inc/view.hxx | 2 +
sw/qa/extras/tiledrendering/tiledrendering.cxx | 36 ++++++++++++++++++++
sw/source/core/text/xmldump.cxx | 12 +++++-
sw/source/uibase/shells/basesh.cxx | 20 ++++++-----
sw/source/uibase/uiview/viewprt.cxx | 10 +++++
8 files changed, 94 insertions(+), 12 deletions(-)
New commits:
commit 5f86e619ce2e6a02e5ea23ef778f7062d30f2931
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Jul 28 20:58:12 2016 +0200
sw layout xml dump: mention SfxViewShell addresses
Change-Id: I2e5c8102684494fd3d7c1c70971a09d0c940a124
Reviewed-on: https://gerrit.libreoffice.org/27637
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
Tested-by: Jenkins <ci at libreoffice.org>
(cherry picked from commit 73c8bc849c0024d5d81ab0370cffa6aa24b56d22)
diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index afee970..d0bbbf0 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -333,6 +333,7 @@ public:
bool isTiledSearching() const;
/// See lok::Document::getPart().
virtual int getPart() const;
+ virtual void dumpAsXml(struct _xmlTextWriter* pWriter) const;
};
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 92d3f1a..8210d88 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -85,6 +85,7 @@
#include <shellimpl.hxx>
#include <vector>
+#include <libxml/xmlwriter.h>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -1648,6 +1649,13 @@ int SfxViewShell::getPart() const
return 0;
}
+void SfxViewShell::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+ xmlTextWriterStartElement(pWriter, BAD_CAST("sfxViewShell"));
+ xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
+ xmlTextWriterEndElement(pWriter);
+}
+
bool SfxViewShell::KeyInput( const KeyEvent &rKeyEvent )
/* [Description]
diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx
index f422ced..ff40f2c 100644
--- a/sw/inc/view.hxx
+++ b/sw/inc/view.hxx
@@ -651,6 +651,8 @@ public:
static SvxSearchItem* GetSearchItem() { return m_pSrchItem; }
/// See SfxViewShell::getPart().
int getPart() const override;
+ /// See SfxViewShell::dumpAsXml().
+ void dumpAsXml(struct _xmlTextWriter* pWriter) const override;
};
inline long SwView::GetXScroll() const
diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx
index f3b7a8e..a300087 100644
--- a/sw/source/core/text/xmldump.cxx
+++ b/sw/source/core/text/xmldump.cxx
@@ -22,6 +22,7 @@
#include <anchoredobject.hxx>
#include <libxml/xmlwriter.h>
#include <SwPortionHandler.hxx>
+#include <view.hxx>
#include <svx/svdobj.hxx>
class XmlPortionDumper:public SwPortionHandler
@@ -297,9 +298,14 @@ void SwFrame::dumpAsXml( xmlTextWriterPtr writer ) const
if (IsRootFrame())
{
const SwRootFrame* pRootFrame = static_cast<const SwRootFrame*>(this);
- xmlTextWriterStartElement(writer, BAD_CAST("shells"));
- for (SwViewShell& rViewShell : pRootFrame->GetCurrShell()->GetRingContainer())
- rViewShell.dumpAsXml(writer);
+ xmlTextWriterStartElement(writer, BAD_CAST("sfxViewShells"));
+ SwView* pView = static_cast<SwView*>(SfxViewShell::GetFirst(true, checkSfxViewShell<SwView>));
+ while (pView)
+ {
+ if (pView->GetObjectShell() == pRootFrame->GetCurrShell()->GetSfxViewShell()->GetObjectShell())
+ pView->dumpAsXml(writer);
+ pView = static_cast<SwView*>(SfxViewShell::GetNext(*pView, true, checkSfxViewShell<SwView>));
+ }
xmlTextWriterEndElement(writer);
}
diff --git a/sw/source/uibase/uiview/viewprt.cxx b/sw/source/uibase/uiview/viewprt.cxx
index 8d12214..ddcefec 100644
--- a/sw/source/uibase/uiview/viewprt.cxx
+++ b/sw/source/uibase/uiview/viewprt.cxx
@@ -19,6 +19,7 @@
#include <com/sun/star/text/NotePrintMode.hpp>
#include <cstdarg>
+#include <libxml/xmlwriter.h>
#include <cmdid.h>
#include <sfx2/request.hxx>
#include <sfx2/progress.hxx>
@@ -258,6 +259,15 @@ int SwView::getPart() const
return nPage - 1;
}
+void SwView::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+ xmlTextWriterStartElement(pWriter, BAD_CAST("swView"));
+ SfxViewShell::dumpAsXml(pWriter);
+ if (m_pWrtShell)
+ m_pWrtShell->dumpAsXml(pWriter);
+ xmlTextWriterEndElement(pWriter);
+}
+
// Create page printer/additions for SwView and SwPagePreview
VclPtr<SfxTabPage> CreatePrintOptionsPage( vcl::Window *pParent,
commit d50ef086b87dbfb28db1fc9f9e76fa33eadfaf35
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Jul 28 12:47:29 2016 +0200
tdf#101168 sw: fix missing repaint on undo with multiple windows
Need to lock / unlock all view shells, not just the current one.
Change-Id: I754214a202c6bbb74daac6f933481cb3fe7b9dbb
Reviewed-on: https://gerrit.libreoffice.org/27620
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
Tested-by: Jenkins <ci at libreoffice.org>
(cherry picked from commit 1e21c32a2f81b4ae5302fc8d537e4f200a1a3e76)
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 5a379bd3..6d65a8e 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -59,6 +59,7 @@ public:
void testViewCursorCleanup();
void testViewLock();
void testTextEditViewInvalidations();
+ void testUndoInvalidations();
CPPUNIT_TEST_SUITE(SwTiledRenderingTest);
CPPUNIT_TEST(testRegisterCallback);
@@ -83,6 +84,7 @@ public:
CPPUNIT_TEST(testViewCursorCleanup);
CPPUNIT_TEST(testViewLock);
CPPUNIT_TEST(testTextEditViewInvalidations);
+ CPPUNIT_TEST(testUndoInvalidations);
CPPUNIT_TEST_SUITE_END();
private:
@@ -855,6 +857,40 @@ void SwTiledRenderingTest::testTextEditViewInvalidations()
comphelper::LibreOfficeKit::setActive(false);
}
+void SwTiledRenderingTest::testUndoInvalidations()
+{
+ // Load a document and create two views.
+ comphelper::LibreOfficeKit::setActive();
+ SwXTextDocument* pXTextDocument = createDoc("dummy.fodt");
+ ViewCallback aView1;
+ SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView1);
+ SfxLokHelper::createView();
+ pXTextDocument->initializeForTiledRendering(uno::Sequence<beans::PropertyValue>());
+ ViewCallback aView2;
+ SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView2);
+
+ // Insert a character the end of the document.
+ SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell();
+ pWrtShell->EndDoc();
+ pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 'c', 0);
+ pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 'c', 0);
+ SwShellCursor* pShellCursor = pWrtShell->getShellCursor(false);
+ CPPUNIT_ASSERT_EQUAL(OUString("Aaa bbb.c"), pShellCursor->GetPoint()->nNode.GetNode().GetTextNode()->GetText());
+
+ // Undo and assert that both views are invalidated.
+ aView1.m_bTilesInvalidated = false;
+ aView2.m_bTilesInvalidated = false;
+ comphelper::dispatchCommand(".uno:Undo", {});
+ Scheduler::ProcessEventsToIdle();
+ CPPUNIT_ASSERT(aView1.m_bTilesInvalidated);
+ // Undo was dispatched on the first view, this second view was not invalidated.
+ CPPUNIT_ASSERT(aView2.m_bTilesInvalidated);
+
+ mxComponent->dispose();
+ mxComponent.clear();
+ comphelper::LibreOfficeKit::setActive(false);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SwTiledRenderingTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx
index bc17219..0b8fb13 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -488,15 +488,19 @@ void SwBaseShell::ExecUndo(SfxRequest &rReq)
switch( nId )
{
case SID_UNDO:
- rWrtShell.LockPaint();
+ for (SwViewShell& rShell : rWrtShell.GetRingContainer())
+ rShell.LockPaint();
rWrtShell.Do( SwWrtShell::UNDO, nCnt );
- rWrtShell.UnlockPaint();
+ for (SwViewShell& rShell : rWrtShell.GetRingContainer())
+ rShell.UnlockPaint();
break;
case SID_REDO:
- rWrtShell.LockPaint();
+ for (SwViewShell& rShell : rWrtShell.GetRingContainer())
+ rShell.LockPaint();
rWrtShell.Do( SwWrtShell::REDO, nCnt );
- rWrtShell.UnlockPaint();
+ for (SwViewShell& rShell : rWrtShell.GetRingContainer())
+ rShell.UnlockPaint();
break;
case SID_REPEAT:
commit 0ab64f84571fa3c1aa31e886ef4792e3584a852f
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Jul 28 10:34:38 2016 +0200
sw: rename generic rSh in SwBaseShell::ExecUndo()
So that it's a bit more obvious it's not a base shell nor a view shell.
Change-Id: I723a6394c59f4013576e3c4e2ff3016369d2227c
Reviewed-on: https://gerrit.libreoffice.org/27616
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
Tested-by: Jenkins <ci at libreoffice.org>
(cherry picked from commit 9e903fc1d477e2f65653b36364de0c46a5151955)
diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx
index 4ffe117..bc17219 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -474,7 +474,7 @@ void SwBaseShell::StateClpbrd(SfxItemSet &rSet)
void SwBaseShell::ExecUndo(SfxRequest &rReq)
{
- SwWrtShell &rSh = GetShell();
+ SwWrtShell &rWrtShell = GetShell();
sal_uInt16 nId = rReq.GetSlot(), nCnt = 1;
const SfxItemSet* pArgs = rReq.GetArgs();
@@ -488,19 +488,19 @@ void SwBaseShell::ExecUndo(SfxRequest &rReq)
switch( nId )
{
case SID_UNDO:
- rSh.LockPaint();
- rSh.Do( SwWrtShell::UNDO, nCnt );
- rSh.UnlockPaint();
+ rWrtShell.LockPaint();
+ rWrtShell.Do( SwWrtShell::UNDO, nCnt );
+ rWrtShell.UnlockPaint();
break;
case SID_REDO:
- rSh.LockPaint();
- rSh.Do( SwWrtShell::REDO, nCnt );
- rSh.UnlockPaint();
+ rWrtShell.LockPaint();
+ rWrtShell.Do( SwWrtShell::REDO, nCnt );
+ rWrtShell.UnlockPaint();
break;
case SID_REPEAT:
- rSh.Do( SwWrtShell::REPEAT );
+ rWrtShell.Do( SwWrtShell::REPEAT );
break;
default:
OSL_FAIL("wrong Dispatcher");
commit d42992ac86e1feb5412ab7c496a8f717d5dd8225
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Jul 28 09:52:25 2016 +0200
gtktiledviewer: quit after the last view is destroyed
To allow debugging crash-on-exit problems.
Change-Id: Ie54a8391e721c3ba8034b4618dd30733bac97a27
Reviewed-on: https://gerrit.libreoffice.org/27605
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
Tested-by: Jenkins <ci at libreoffice.org>
(cherry picked from commit 538ea31c992acb9d47ffd783543e50e149272aac)
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 5aeea19..034e15f 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -1210,13 +1210,28 @@ static void openDocumentCallback (GObject* source_object, GAsyncResult* res, gpo
gtk_widget_hide(rWindow.m_pProgressBar);
}
+/**
+ * Wrapper around gtk_widget_destroy() that quits when the last tiled window is
+ * destroyed.
+ */
+static void destroyWindow(GtkWidget* pWidget)
+{
+ gtk_widget_destroy(pWidget);
+ auto it = g_aWindows.find(pWidget);
+ if (it != g_aWindows.end())
+ g_aWindows.erase(it);
+
+ if (g_aWindows.empty())
+ gtk_main_quit();
+}
+
/// Creates the GtkWindow that has main widget as children and registers it in the window map.
static GtkWidget* createWindow(TiledWindow& rWindow)
{
GtkWidget *pWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(pWindow), "LibreOfficeKit GTK Tiled Viewer");
gtk_window_set_default_size(GTK_WINDOW(pWindow), 1024, 768);
- g_signal_connect(pWindow, "destroy", G_CALLBACK(gtk_widget_destroy), pWindow);
+ g_signal_connect(pWindow, "destroy", G_CALLBACK(destroyWindow), pWindow);
rWindow.m_pVBox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add(GTK_CONTAINER(pWindow), rWindow.m_pVBox);
More information about the Libreoffice-commits
mailing list