From 135360a2bc2540e803fdf8b79d0b2ff7c2d5069d Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Aug 01 2017 03:22:30 +0000 Subject: import libreoffice-5.0.6.2-14.el7 --- diff --git a/SOURCES/0001-Move-SolarMutex-down-from-tools-to-comphelper-to-mak.patch b/SOURCES/0001-Move-SolarMutex-down-from-tools-to-comphelper-to-mak.patch new file mode 100644 index 0000000..aab31ae --- /dev/null +++ b/SOURCES/0001-Move-SolarMutex-down-from-tools-to-comphelper-to-mak.patch @@ -0,0 +1,266 @@ +From f76b3dd039818cc2b297fa2a11b60d9e055e6d8c Mon Sep 17 00:00:00 2001 +From: Michael Meeks +Date: Fri, 9 Oct 2015 11:27:26 +0100 +Subject: [PATCH] Move SolarMutex down from tools to comphelper/ to make life + easier. + +Change-Id: I7dd21f30daa27e5de2848eb16aee9a610dd629d5 +Reviewed-on: https://gerrit.libreoffice.org/19271 +Tested-by: Jenkins +Reviewed-by: Michael Meeks +--- + comphelper/source/misc/solarmutex.cxx | 25 ++++++++++++++++++++++--- + include/comphelper/solarmutex.hxx | 17 +++++++++++++++-- + include/tools/solarmutex.hxx | 2 +- + tools/source/misc/solarmutex.cxx | 9 ++------- + unotools/source/config/configitem.cxx | 8 +++++--- + vcl/generic/app/geninst.cxx | 7 +++---- + vcl/osx/salinst.cxx | 6 +++--- + vcl/win/source/app/salinst.cxx | 6 ++---- + 8 files changed, 53 insertions(+), 27 deletions(-) + +diff --git a/comphelper/source/misc/solarmutex.cxx b/comphelper/source/misc/solarmutex.cxx +index 0eecac8..1d23754 100644 +--- a/comphelper/source/misc/solarmutex.cxx ++++ b/comphelper/source/misc/solarmutex.cxx +@@ -18,11 +18,30 @@ + */ + + #include +- ++#include + #include + +-comphelper::SolarMutex::SolarMutex() {} ++namespace comphelper { ++ ++SolarMutex::SolarMutex() {} ++ ++SolarMutex::~SolarMutex() {} ++ ++namespace { ++ static SolarMutex* pSolarMutex = 0; ++} ++ ++void SolarMutex::setSolarMutex( SolarMutex *pMutex ) ++{ ++ assert((pMutex && !pSolarMutex) || !pMutex); ++ pSolarMutex = pMutex; ++} ++ ++SolarMutex *SolarMutex::get() ++{ ++ return pSolarMutex; ++} + +-comphelper::SolarMutex::~SolarMutex() {} ++} // namespace comphelper + + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +diff --git a/include/comphelper/solarmutex.hxx b/include/comphelper/solarmutex.hxx +index 3b66a00..c50eba2 100644 +--- a/include/comphelper/solarmutex.hxx ++++ b/include/comphelper/solarmutex.hxx +@@ -26,8 +26,15 @@ + + namespace comphelper { + +-/** SolarMutex interface, needed for Application::GetSolarMutex(). +-*/ ++/** ++ * Abstract SolarMutex interface, needed for VCL's ++ * Application::GetSolarMutex(). ++ * ++ * The SolarMutex is the one big recursive code lock used ++ * to protect the vast majority of the LibreOffice code-base, ++ * in particular anything that is graphical and the cores of ++ * the applications. ++ */ + class COMPHELPER_DLLPUBLIC SolarMutex { + public: + virtual void acquire() = 0; +@@ -36,6 +43,12 @@ public: + + virtual bool tryToAcquire() = 0; + ++ /// Help components to get the SolarMutex easily. ++ static SolarMutex *get(); ++ ++ /// semi-private: allow VCL to push its one-big-lock down here. ++ static void setSolarMutex( SolarMutex *pMutex ); ++ + protected: + SolarMutex(); + +diff --git a/include/tools/solarmutex.hxx b/include/tools/solarmutex.hxx +index 85e465d..60af81c 100644 +--- a/include/tools/solarmutex.hxx ++++ b/include/tools/solarmutex.hxx +@@ -24,10 +24,10 @@ + + namespace tools + { ++ /// Deprecated in favour of comphelper::SolarMutex + class TOOLS_DLLPUBLIC SolarMutex + { + public: +- static void SetSolarMutex( comphelper::SolarMutex* pMutex ); + static bool Acquire(); + static void Release(); + }; +diff --git a/tools/source/misc/solarmutex.cxx b/tools/source/misc/solarmutex.cxx +index f718999..6602939 100644 +--- a/tools/source/misc/solarmutex.cxx ++++ b/tools/source/misc/solarmutex.cxx +@@ -21,15 +21,9 @@ + + namespace tools + { +- static comphelper::SolarMutex* pSolarMutex = 0; +- +- void SolarMutex::SetSolarMutex( comphelper::SolarMutex* pMutex ) +- { +- pSolarMutex = pMutex; +- } +- + bool SolarMutex::Acquire() + { ++ comphelper::SolarMutex *pSolarMutex = comphelper::SolarMutex::get(); + if ( pSolarMutex ) + pSolarMutex->acquire(); + else +@@ -39,6 +33,7 @@ namespace tools + + void SolarMutex::Release() + { ++ comphelper::SolarMutex *pSolarMutex = comphelper::SolarMutex::get(); + if ( pSolarMutex ) + pSolarMutex->release(); + } +diff --git a/unotools/source/config/configitem.cxx b/unotools/source/config/configitem.cxx +index fd1c423..7d03ab8 100644 +--- a/unotools/source/config/configitem.cxx ++++ b/unotools/source/config/configitem.cxx +@@ -40,7 +40,8 @@ + #include + #include + #include +-#include ++#include ++#include + #include + + using namespace utl; +@@ -155,11 +156,12 @@ void ConfigChangeListener_Impl::changesOccurred( const ChangesEvent& rEvent ) th + } + if( nNotify ) + { +- if ( ::tools::SolarMutex::Acquire() ) ++ ::comphelper::SolarMutex *pMutex = ::comphelper::SolarMutex::get(); ++ if ( pMutex ) + { ++ rtl::Reference< comphelper::SolarMutex > aGuard( pMutex ); + aChangedNames.realloc(nNotify); + pParent->CallNotify(aChangedNames); +- ::tools::SolarMutex::Release(); + } + } + } +diff --git a/vcl/generic/app/geninst.cxx b/vcl/generic/app/geninst.cxx +index ef7bec0..d53ed30 100644 +--- a/vcl/generic/app/geninst.cxx ++++ b/vcl/generic/app/geninst.cxx +@@ -21,7 +21,7 @@ + #include + + #include +-#include ++#include + #include + + #include "generic/geninst.h" +@@ -32,12 +32,12 @@ SalYieldMutex::SalYieldMutex() + { + mnCount = 0; + mnThreadId = 0; +- ::tools::SolarMutex::SetSolarMutex( this ); ++ ::comphelper::SolarMutex::setSolarMutex( this ); + } + + SalYieldMutex::~SalYieldMutex() + { +- ::tools::SolarMutex::SetSolarMutex( NULL ); ++ ::comphelper::SolarMutex::setSolarMutex( NULL ); + } + + void SalYieldMutex::acquire() +@@ -125,7 +125,6 @@ bool SalGenericInstance::CheckYieldMutex() + + SalGenericInstance::~SalGenericInstance() + { +- ::tools::SolarMutex::SetSolarMutex( 0 ); + delete mpSalYieldMutex; + } + +diff --git a/vcl/osx/salinst.cxx b/vcl/osx/salinst.cxx +index bc9b205..137c72f 100644 +--- a/vcl/osx/salinst.cxx ++++ b/vcl/osx/salinst.cxx +@@ -21,7 +21,7 @@ + + #include + +-#include ++#include + + #include "comphelper/lok.hxx" + +@@ -350,7 +350,7 @@ AquaSalInstance::AquaSalInstance() + { + mpSalYieldMutex = new SalYieldMutex; + mpSalYieldMutex->acquire(); +- ::tools::SolarMutex::SetSolarMutex( mpSalYieldMutex ); ++ ::comphelper::SolarMutex::setSolarMutex( mpSalYieldMutex ); + maMainThread = osl::Thread::getCurrentIdentifier(); + mbWaitingYield = false; + maUserEventListMutex = osl_createMutex(); +@@ -360,7 +360,7 @@ AquaSalInstance::AquaSalInstance() + + AquaSalInstance::~AquaSalInstance() + { +- ::tools::SolarMutex::SetSolarMutex( 0 ); ++ ::comphelper::SolarMutex::setSolarMutex( 0 ); + mpSalYieldMutex->release(); + delete mpSalYieldMutex; + osl_destroyMutex( maUserEventListMutex ); +diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx +index 27af73f..4f3a289 100644 +--- a/vcl/win/source/app/salinst.cxx ++++ b/vcl/win/source/app/salinst.cxx +@@ -24,8 +24,6 @@ + #include + #include + +-#include +- + #include + #include + #include +@@ -580,12 +578,12 @@ WinSalInstance::WinSalInstance() + mpSalWaitMutex = new osl::Mutex; + mnYieldWaitCount = 0; + mpSalYieldMutex->acquire(); +- ::tools::SolarMutex::SetSolarMutex( mpSalYieldMutex ); ++ ::comphelper::SolarMutex::setSolarMutex( mpSalYieldMutex ); + } + + WinSalInstance::~WinSalInstance() + { +- ::tools::SolarMutex::SetSolarMutex( 0 ); ++ ::comphelper::SolarMutex::setSolarMutex( 0 ); + mpSalYieldMutex->release(); + delete mpSalYieldMutex; + delete mpSalWaitMutex; +-- +2.9.3 + diff --git a/SOURCES/0001-Resolves-rhbz-1401082-gnome-hangs-opening-a-certain-.patch b/SOURCES/0001-Resolves-rhbz-1401082-gnome-hangs-opening-a-certain-.patch new file mode 100644 index 0000000..3bbb518 --- /dev/null +++ b/SOURCES/0001-Resolves-rhbz-1401082-gnome-hangs-opening-a-certain-.patch @@ -0,0 +1,143 @@ +From 9f5e3b61e7b3a7dd3cca369d153b3993b10496ed Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= +Date: Tue, 6 Dec 2016 15:17:38 +0000 +Subject: [PATCH] Resolves: rhbz#1401082 gnome hangs opening a certain .docx +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +this seems to be a problem since.... + +commit 199eb08be994ef968eb38f4966bc27ef1756d382 +Author: Miklos Vajna +Date: Thu Jun 5 16:25:01 2014 +0200 + + SwAnchoredDrawObject::GetObjBoundRect: avoid SwDoc::SetModified() + + This is a const method, but it does a const_cast to still resize an + object... if that's so, then we should ensure that the "is modified" + flag of SwDoc is untouched. + + CppunitTest_sw_ooxmlimport's testChartSize is a reproducer for this, + when shape text is imported as textbox. + +(note under gtk3 and wayland this isn't as noticable, there use +export GDK_BACKEND=x11 to reproduce the freeze effect where even +the mouse cursor doesn't move during part of the load) + +Change-Id: Ic0bd98b032dfe1255d79d8070d50f65fcfa676dd +Reviewed-on: https://gerrit.libreoffice.org/31687 +Tested-by: Jenkins +Reviewed-by: Miklos Vajna +(cherry picked from commit d393039655edf9bb884fc2956674badde59d2326) +Reviewed-on: https://gerrit.libreoffice.org/31948 +Reviewed-by: Caolán McNamara +Tested-by: Caolán McNamara +--- + sw/inc/IDocumentState.hxx | 3 +++ + sw/source/core/doc/DocumentStateManager.cxx | 13 +++++++++++++ + sw/source/core/inc/DocumentStateManager.hxx | 5 ++++- + sw/source/core/layout/anchoreddrawobject.cxx | 7 ++++--- + 4 files changed, 24 insertions(+), 4 deletions(-) + +diff --git a/sw/inc/IDocumentState.hxx b/sw/inc/IDocumentState.hxx +index a6fc748..41fa8e4 100644 +--- a/sw/inc/IDocumentState.hxx ++++ b/sw/inc/IDocumentState.hxx +@@ -58,6 +58,9 @@ public: + + virtual void SetLoaded(bool b = true) = 0; + ++ virtual bool IsEnableSetModified() const = 0; ++ virtual void SetEnableSetModified(bool bEnableSetModified) = 0; ++ + protected: + virtual ~IDocumentState() {}; + }; +diff --git a/sw/source/core/doc/DocumentStateManager.cxx b/sw/source/core/doc/DocumentStateManager.cxx +index ede8ef9..cf755e1 100644 +--- a/sw/source/core/doc/DocumentStateManager.cxx ++++ b/sw/source/core/doc/DocumentStateManager.cxx +@@ -29,6 +29,7 @@ namespace sw + + DocumentStateManager::DocumentStateManager( SwDoc& i_rSwdoc ) : + m_rDoc( i_rSwdoc ), ++ mbEnableSetModified(true), + mbModified(false), + mbLoaded(false), + mbUpdateExpField(false), +@@ -40,6 +41,8 @@ DocumentStateManager::DocumentStateManager( SwDoc& i_rSwdoc ) : + + void DocumentStateManager::SetModified() + { ++ if (!IsEnableSetModified()) ++ return; + m_rDoc.GetDocumentLayoutManager().ClearSwLayouterEntries(); + // give the old and new modified state to the link + // Bit 0: -> old state +@@ -80,6 +83,16 @@ bool DocumentStateManager::IsModified() const + return mbModified; + } + ++bool DocumentStateManager::IsEnableSetModified() const ++{ ++ return mbEnableSetModified; ++} ++ ++void DocumentStateManager::SetEnableSetModified(bool bEnableSetModified) ++{ ++ mbEnableSetModified = bEnableSetModified; ++} ++ + bool DocumentStateManager::IsInCallModified() const + { + return mbInCallModified; +diff --git a/sw/source/core/inc/DocumentStateManager.hxx b/sw/source/core/inc/DocumentStateManager.hxx +index 1d67a36..f3ca7d9 100644 +--- a/sw/source/core/inc/DocumentStateManager.hxx ++++ b/sw/source/core/inc/DocumentStateManager.hxx +@@ -38,6 +38,8 @@ public: + void SetModified() SAL_OVERRIDE; + void ResetModified() SAL_OVERRIDE; + bool IsModified() const SAL_OVERRIDE; ++ bool IsEnableSetModified() const SAL_OVERRIDE; ++ void SetEnableSetModified(bool bEnableSetModified) SAL_OVERRIDE; + bool IsInCallModified() const SAL_OVERRIDE; + bool IsLoaded() const SAL_OVERRIDE; + bool IsUpdateExpField() const SAL_OVERRIDE; +@@ -51,9 +53,10 @@ public: + private: + SwDoc& m_rDoc; + ++ bool mbEnableSetModified; //< FALSE: changing document modification status (temporarily) locked + bool mbModified ; //< TRUE: document has changed. + bool mbLoaded ; //< TRUE: Doc loaded. +- bool mbUpdateExpField ; //< TRUE: Update expression fields. ++ bool mbUpdateExpField; //< TRUE: Update expression fields. + bool mbNewDoc ; //< TRUE: new Doc. + bool mbPageNums ; //< TRUE: There are virtual page numbers. + bool mbInCallModified; //< TRUE: in Set/Reset-Modified link. +diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx +index 7051a2a..644d7e6 100644 +--- a/sw/source/core/layout/anchoreddrawobject.cxx ++++ b/sw/source/core/layout/anchoreddrawobject.cxx +@@ -659,12 +659,13 @@ const SwRect SwAnchoredDrawObject::GetObjBoundRect() const + if ( nTargetWidth != aCurrObjRect.GetWidth( ) || nTargetHeight != aCurrObjRect.GetHeight( ) ) + { + SwDoc* pDoc = const_cast(GetPageFrm()->GetFormat()->GetDoc()); +- bool bModified = pDoc->getIDocumentState().IsModified(); ++ ++ bool bEnableSetModified = pDoc->getIDocumentState().IsEnableSetModified(); ++ pDoc->getIDocumentState().SetEnableSetModified(false); + const_cast< SdrObject* >( GetDrawObj() )->Resize( aCurrObjRect.TopLeft(), + Fraction( nTargetWidth, aCurrObjRect.GetWidth() ), + Fraction( nTargetHeight, aCurrObjRect.GetHeight() ), false ); +- if (!bModified) +- pDoc->getIDocumentState().ResetModified(); ++ pDoc->getIDocumentState().SetEnableSetModified(bEnableSetModified); + } + } + return GetDrawObj()->GetCurrentBoundRect(); +-- +2.9.3 + diff --git a/SOURCES/0001-Resolves-rhbz-1454693-segv-on-interrupting-tiled-ren.patch b/SOURCES/0001-Resolves-rhbz-1454693-segv-on-interrupting-tiled-ren.patch new file mode 100644 index 0000000..d843b90 --- /dev/null +++ b/SOURCES/0001-Resolves-rhbz-1454693-segv-on-interrupting-tiled-ren.patch @@ -0,0 +1,50 @@ +From 23ee72212d5df5fd11a36b6b1b45b02ef23dcaf1 Mon Sep 17 00:00:00 2001 +From: rpmbuild +Date: Fri, 16 Jun 2017 15:53:41 +0100 +Subject: [PATCH] Resolves: rhbz#1454693 segv on interrupting tiled rendering + +--- + libreofficekit/source/gtk/lokdocview.cxx | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index b6f34ac..584ab57 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -942,6 +942,14 @@ callback (gpointer pData) + LOKDocView* pDocView = LOK_DOC_VIEW (pCallback->m_pDocView); + LOKDocViewPrivate& priv = getPrivate(pDocView); + ++ //callback registered before the widget was destroyed. ++ //Use existance of lokThreadPool as flag it was torn down ++ if (!priv->lokThreadPool) ++ { ++ delete pCallback; ++ return G_SOURCE_REMOVE; ++ } ++ + switch (pCallback->m_nType) + { + case LOK_CALLBACK_INVALIDATE_TILES: +@@ -2061,11 +2069,18 @@ static void lok_doc_view_destroy (GtkWidget* widget) + LOKDocView* pDocView = LOK_DOC_VIEW (widget); + LOKDocViewPrivate& priv = getPrivate(pDocView); + ++ if (priv->lokThreadPool) ++ { ++ g_thread_pool_free(priv->lokThreadPool, true, true); ++ priv->lokThreadPool = nullptr; ++ } ++ + if (priv->m_pDocument) + { + priv->m_pDocument->pClass->destroy (priv->m_pDocument); + priv->m_pDocument = nullptr; + } ++ + if (priv->m_pOffice) + { + priv->m_pOffice->pClass->destroy (priv->m_pOffice); +-- +1.8.3.1 + diff --git a/SOURCES/0001-Resolves-tdf-101213-drop-use-of-CAIRO_OPERATOR_DIFFE.patch b/SOURCES/0001-Resolves-tdf-101213-drop-use-of-CAIRO_OPERATOR_DIFFE.patch new file mode 100644 index 0000000..007fd85 --- /dev/null +++ b/SOURCES/0001-Resolves-tdf-101213-drop-use-of-CAIRO_OPERATOR_DIFFE.patch @@ -0,0 +1,69 @@ +From d89abe0806947149eafbd9d7ce4b3095ec38b236 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= +Date: Thu, 4 Aug 2016 17:23:30 +0100 +Subject: [PATCH] Resolves: tdf#101213 drop use of CAIRO_OPERATOR_DIFFERENCE + +for tdf#99446 and rhbz#1283420 there is a hackaround which ended up in 5.1.5, +which is not in 5.1.4, for corrupt glyphs under X. I can still reproduce the +problem if I drop the CAIRO_OPERATOR_DIFFERENCE usage here with master and +gtk2. + +This alternative hackaround to force a read of the underlying surface works +just as well (help->license information is the reproducer) but reportedly +solves the performance regression. + +(cherry picked from commit 705d7597480b2307d7e4929ce9386d80ce2a0f16) + +Change-Id: Ie3c5b07409537a1734226b4ce034620351297e25 +Reviewed-on: https://gerrit.libreoffice.org/27984 +Tested-by: Jenkins +Reviewed-by: Miklos Vajna +--- + vcl/unx/generic/gdi/x11cairotextrender.cxx | 23 +++++++++-------------- + 1 file changed, 9 insertions(+), 14 deletions(-) + +diff --git a/vcl/unx/generic/gdi/x11cairotextrender.cxx b/vcl/unx/generic/gdi/x11cairotextrender.cxx +index 17cb462..c2242b5 100644 +--- a/vcl/unx/generic/gdi/x11cairotextrender.cxx ++++ b/vcl/unx/generic/gdi/x11cairotextrender.cxx +@@ -42,10 +42,6 @@ struct _XRegion + BOX extents; + }; + +-#if CAIRO_VERSION < CAIRO_VERSION_ENCODE(1, 10, 0) +-# define CAIRO_OPERATOR_DIFFERENCE (static_cast(23)) +-#endif +- + X11CairoTextRender::X11CairoTextRender(X11SalGraphics& rParent) + : mrParent(rParent) + { +@@ -83,17 +79,16 @@ cairo_t* X11CairoTextRender::getCairoContext() + cairo_t *cr = cairo_create(surface); + cairo_surface_destroy(surface); + +- //rhbz#1283420 bodge to draw and undraw something which has the side effect +- //of making the mysterious xrender related problem go away +- if (cairo_version() >= CAIRO_VERSION_ENCODE(1, 10, 0)) ++ //rhbz#1283420 bodge to force a read from the underlying surface which has ++ //the side effect of making the mysterious xrender related problem go away + { +- cairo_save(cr); +- cairo_set_source_rgb(cr, 1.0, 1.0, 1.0); +- cairo_set_operator(cr, CAIRO_OPERATOR_DIFFERENCE); +- cairo_rectangle(cr, 0, 0, 1, 1); +- cairo_fill_preserve(cr); +- cairo_fill(cr); +- cairo_restore(cr); ++ cairo_surface_t *target = cairo_get_target(cr); ++ cairo_surface_t *throw_away = cairo_surface_create_similar(target, cairo_surface_get_content(target), 1, 1); ++ cairo_t *force_read_cr = cairo_create(throw_away); ++ cairo_set_source_surface(force_read_cr, target, 0, 0); ++ cairo_paint(force_read_cr); ++ cairo_destroy(force_read_cr); ++ cairo_surface_destroy(throw_away); + } + + return cr; +-- +2.9.3 + diff --git a/SOURCES/0001-Resolves_rhbz-1437537-fix-csv-a11y.patch b/SOURCES/0001-Resolves_rhbz-1437537-fix-csv-a11y.patch new file mode 100644 index 0000000..e18c10f --- /dev/null +++ b/SOURCES/0001-Resolves_rhbz-1437537-fix-csv-a11y.patch @@ -0,0 +1,130 @@ +From dade1c7a39363610e5f04bf8cd99c9aaf3a33aab Mon Sep 17 00:00:00 2001 +From: rpmbuild +Date: Fri, 31 Mar 2017 17:10:46 +0100 +Subject: [PATCH] Resolves: rhbz#1437537 fix csv a11y + +--- + .../ui/Accessibility/AccessibleCsvControl.cxx | 33 +++++++++++++++++++--- + sc/source/ui/inc/AccessibleCsvControl.hxx | 9 ++++++ + 3 files changed, 49 insertions(+), 18 deletions(-) + mode change 100644 => 100755 config.sub + +diff --git a/sc/source/ui/Accessibility/AccessibleCsvControl.cxx b/sc/source/ui/Accessibility/AccessibleCsvControl.cxx +index bb924f2..4bc75f3 100644 +--- a/sc/source/ui/Accessibility/AccessibleCsvControl.cxx ++++ b/sc/source/ui/Accessibility/AccessibleCsvControl.cxx +@@ -865,6 +865,15 @@ ScAccessibleCsvGrid::~ScAccessibleCsvGrid() + implDispose(); + } + ++void ScAccessibleCsvGrid::disposing() ++{ ++ SolarMutexGuard aGuard; ++ for (XAccessibleSet::iterator aI = maAccessibleChildren.begin(); aI != maAccessibleChildren.end(); ++aI) ++ aI->second->dispose(); ++ maAccessibleChildren.clear(); ++ ScAccessibleCsvControl::disposing(); ++} ++ + // XAccessibleComponent ------------------------------------------------------- + + Reference< XAccessible > SAL_CALL ScAccessibleCsvGrid::getAccessibleAtPoint( const AwtPoint& rPoint ) +@@ -882,7 +891,7 @@ Reference< XAccessible > SAL_CALL ScAccessibleCsvGrid::getAccessibleAtPoint( con + lcl_GetApiColumn( rGrid.GetColumnFromX( rPoint.X ) ) : 0; + sal_Int32 nRow = (rPoint.Y >= rGrid.GetHdrHeight()) ? + (rGrid.GetLineFromY( rPoint.Y ) - rGrid.GetFirstVisLine() + 1) : 0; +- xRet = implCreateCellObj( nRow, nColumn ); ++ xRet = getAccessibleCell(nRow, nColumn); + } + return xRet; + } +@@ -912,13 +921,30 @@ sal_Int32 SAL_CALL ScAccessibleCsvGrid::getAccessibleChildCount() throw( Runtime + return implGetCellCount(); + } + ++Reference ScAccessibleCsvGrid::getAccessibleCell(sal_Int32 nRow, sal_Int32 nColumn) ++{ ++ sal_Int32 nIndex = implGetIndex(nRow, nColumn); ++ ++ XAccessibleSet::iterator aI = maAccessibleChildren.lower_bound(nIndex); ++ if (aI != maAccessibleChildren.end() && !(maAccessibleChildren.key_comp()(nIndex, aI->first))) ++ { ++ // key already exists ++ return Reference(aI->second.get()); ++ } ++ // key does not exist ++ rtl::Reference xNew = implCreateCellObj(nRow, nColumn); ++ maAccessibleChildren.insert(aI, XAccessibleSet::value_type(nIndex, xNew)); ++ return Reference(xNew.get()); ++} ++ + Reference< XAccessible > SAL_CALL ScAccessibleCsvGrid::getAccessibleChild( sal_Int32 nIndex ) + throw( IndexOutOfBoundsException, RuntimeException, std::exception ) + { + SolarMutexGuard aGuard; + ensureAlive(); + ensureValidIndex( nIndex ); +- return implCreateCellObj( implGetRow( nIndex ), implGetColumn( nIndex ) ); ++ ++ return getAccessibleCell(implGetRow(nIndex), implGetColumn(nIndex)); + } + + Reference< XAccessibleRelationSet > SAL_CALL ScAccessibleCsvGrid::getAccessibleRelationSet() +@@ -1066,7 +1092,7 @@ Reference< XAccessible > SAL_CALL ScAccessibleCsvGrid::getAccessibleCellAt( sal_ + SolarMutexGuard aGuard; + ensureAlive(); + ensureValidPosition( nRow, nColumn ); +- return implCreateCellObj( nRow, nColumn ); ++ return getAccessibleCell(nRow, nColumn); + } + + Reference< XAccessible > SAL_CALL ScAccessibleCsvGrid::getAccessibleCaption() +@@ -1235,7 +1261,6 @@ Sequence< sal_Int8 > SAL_CALL ScAccessibleCsvGrid::getImplementationId() throw( + void ScAccessibleCsvGrid::SendFocusEvent( bool bFocused ) + { + ScAccessibleCsvControl::SendFocusEvent( bFocused ); +- + AccessibleEventObject aEvent; + aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED; + aEvent.Source = Reference< XAccessible >( this ); +diff --git a/sc/source/ui/inc/AccessibleCsvControl.hxx b/sc/source/ui/inc/AccessibleCsvControl.hxx +index a181c24..870cb3c 100644 +--- a/sc/source/ui/inc/AccessibleCsvControl.hxx ++++ b/sc/source/ui/inc/AccessibleCsvControl.hxx +@@ -31,6 +31,7 @@ + #include + #include + #include "AccessibleContextBase.hxx" ++#include + + class ScCsvControl; + namespace utl { class AccessibleStateSetHelper; } +@@ -304,10 +305,16 @@ class ScAccessibleCsvGrid : public ScAccessibleCsvControl, public ScAccessibleCs + protected: + typedef ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleTable > XAccessibleTableRef; ++ typedef std::map< sal_Int32, rtl::Reference > XAccessibleSet; ++ ++private: ++ XAccessibleSet maAccessibleChildren; + + public: + explicit ScAccessibleCsvGrid( ScCsvGrid& rGrid ); + virtual ~ScAccessibleCsvGrid(); ++ using ScAccessibleContextBase::disposing; ++ virtual void SAL_CALL disposing() override; + + // XAccessibleComponent --------------------------------------------------- + +@@ -531,6 +538,8 @@ private: + OUString implGetCellText( sal_Int32 nRow, sal_Int32 nColumn ) const; + /** Creates a new accessible object of the specified cell. Indexes must be valid. */ + ScAccessibleCsvControl* implCreateCellObj( sal_Int32 nRow, sal_Int32 nColumn ) const; ++ ++ css::uno::Reference getAccessibleCell(sal_Int32 nRow, sal_Int32 nColumn); + }; + + /** Accessible class representing a cell of the CSV grid control. */ +-- +1.8.3.1 + diff --git a/SOURCES/0001-gtktiledviewer-allow-testing-of-destroyView.patch b/SOURCES/0001-gtktiledviewer-allow-testing-of-destroyView.patch new file mode 100644 index 0000000..3dfe99f --- /dev/null +++ b/SOURCES/0001-gtktiledviewer-allow-testing-of-destroyView.patch @@ -0,0 +1,59 @@ +From 905beaa8e862323199263feaeb6262f43fbfc0bc Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 15 Jul 2016 15:37:51 +0200 +Subject: [PATCH] gtktiledviewer: allow testing of destroyView() + +By calling it when we're not the last window. + +Change-Id: I6fd4763243fc088ccfe015b6c03b6b3f25146fac +--- + libreofficekit/source/gtk/lokdocview.cxx | 15 +++++++++++++-- + 1 file changed, 13 insertions(+), 2 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 92cf6b3..b6f34ac 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -127,6 +127,9 @@ struct LOKDocViewPrivateImpl + /// View ID, returned by createView() or 0 by default. + int m_nViewId; + ++ /// Event source ID for handleTimeout() of this widget. ++ guint m_nTimeoutId; ++ + LOKDocViewPrivateImpl() + : m_aLOPath(nullptr), + m_pUserProfileURL(nullptr), +@@ -165,11 +168,19 @@ struct LOKDocViewPrivateImpl + m_aHandleEndRect({0, 0, 0, 0}), + m_bInDragEndHandle(false), + m_pGraphicHandle(nullptr), +- m_nViewId(0) ++ m_nViewId(0), ++ m_nTimeoutId(0) + { + memset(&m_aGraphicHandleRects, 0, sizeof(m_aGraphicHandleRects)); + memset(&m_bInDragGraphicHandles, 0, sizeof(m_bInDragGraphicHandles)); + } ++ ++ ~LOKDocViewPrivateImpl() ++ { ++ if (m_nTimeoutId) ++ g_source_remove(m_nTimeoutId); ++ } ++ + }; + + /// Wrapper around LOKDocViewPrivateImpl, managed by malloc/memset/free. +@@ -768,7 +779,7 @@ static gboolean postDocumentLoad(gpointer pData) + priv->m_pDocument->pClass->initializeForRendering(priv->m_pDocument, priv->m_aRenderingArguments.c_str()); + priv->m_pDocument->pClass->registerCallback(priv->m_pDocument, callbackWorker, pLOKDocView); + priv->m_pDocument->pClass->getDocumentSize(priv->m_pDocument, &priv->m_nDocumentWidthTwips, &priv->m_nDocumentHeightTwips); +- g_timeout_add(600, handleTimeout, pLOKDocView); ++ priv->m_nTimeoutId = g_timeout_add(600, handleTimeout, pLOKDocView); + + float zoom = priv->m_fZoom; + long nDocumentWidthTwips = priv->m_nDocumentWidthTwips; +-- +1.8.3.1 + diff --git a/SOURCES/0001-improve-perf.-of-VCL-event-dispatch.patch b/SOURCES/0001-improve-perf.-of-VCL-event-dispatch.patch index a2eca14..2583609 100644 --- a/SOURCES/0001-improve-perf.-of-VCL-event-dispatch.patch +++ b/SOURCES/0001-improve-perf.-of-VCL-event-dispatch.patch @@ -1,4 +1,4 @@ -From aae5b1632264a6a97c2bd37da2e5899779e1b108 Mon Sep 17 00:00:00 2001 +From 12776a97a32449f5c0fc6de735c29fc30c0d7d14 Mon Sep 17 00:00:00 2001 From: David Tardon Date: Tue, 10 May 2016 09:00:20 +0200 Subject: [PATCH] improve perf. of VCL event dispatch @@ -6,9 +6,9 @@ Subject: [PATCH] improve perf. of VCL event dispatch Change-Id: I5052f0c3e2c8739b336da52ef9590e5008255247 --- vcl/inc/window.h | 4 +++- - vcl/source/window/event.cxx | 36 +++++++++++++++++++++++++++++++++--- + vcl/source/window/event.cxx | 39 ++++++++++++++++++++++++++++++++++++--- vcl/source/window/window.cxx | 1 + - 3 files changed, 37 insertions(+), 4 deletions(-) + 3 files changed, 40 insertions(+), 4 deletions(-) diff --git a/vcl/inc/window.h b/vcl/inc/window.h index 67d5f94..60f7e82 100644 @@ -26,7 +26,7 @@ index 67d5f94..60f7e82 100644 // The canvas interface for this VCL window. Is persistent after the first GetCanvas() call diff --git a/vcl/source/window/event.cxx b/vcl/source/window/event.cxx -index 35c3e38..59fcb61 100644 +index 35c3e38..cbd5b23 100644 --- a/vcl/source/window/event.cxx +++ b/vcl/source/window/event.cxx @@ -18,6 +18,7 @@ @@ -46,7 +46,7 @@ index 35c3e38..59fcb61 100644 #include #include #include -@@ -212,7 +215,29 @@ void Window::CallEventListeners( sal_uLong nEvent, void* pData ) +@@ -212,7 +215,32 @@ void Window::CallEventListeners( sal_uLong nEvent, void* pData ) if ( aDelData.IsDead() ) return; @@ -59,11 +59,14 @@ index 35c3e38..59fcb61 100644 + mpWindowImpl->mnEventListenersIteratingCount++; + auto& rWindowImpl = *mpWindowImpl; + comphelper::ScopeGuard aGuard( -+ [&rWindowImpl]() ++ [&rWindowImpl, &aDelData]() + { -+ rWindowImpl.mnEventListenersIteratingCount--; -+ if (rWindowImpl.mnEventListenersIteratingCount == 0) -+ rWindowImpl.maEventListenersDeleted.clear(); ++ if (!aDelData.IsDead()) ++ { ++ rWindowImpl.mnEventListenersIteratingCount--; ++ if (rWindowImpl.mnEventListenersIteratingCount == 0) ++ rWindowImpl.maEventListenersDeleted.clear(); ++ } + } + ); + for ( Link<>& rLink : aCopy ) @@ -77,7 +80,7 @@ index 35c3e38..59fcb61 100644 if ( aDelData.IsDead() ) return; -@@ -245,13 +270,18 @@ void Window::FireVclEvent( VclSimpleEvent* pEvent ) +@@ -245,13 +273,18 @@ void Window::FireVclEvent( VclSimpleEvent* pEvent ) void Window::AddEventListener( const Link<>& rEventListener ) { @@ -111,5 +114,5 @@ index e8d2b96..cbfc4cd 100644 mpCursor = NULL; // cursor mpControlFont = NULL; // font properties -- -2.7.4 +2.7.3 diff --git a/SOURCES/0001-move-things-around-a-little-to-make-backporting-easi.patch b/SOURCES/0001-move-things-around-a-little-to-make-backporting-easi.patch index 19e83e1..e10fae2 100644 --- a/SOURCES/0001-move-things-around-a-little-to-make-backporting-easi.patch +++ b/SOURCES/0001-move-things-around-a-little-to-make-backporting-easi.patch @@ -10499,7 +10499,7 @@ new file mode 100644 index 0000000..dcfebbf --- /dev/null +++ b/vcl/unx/gtk3/gtk3gtkframe.cxx -@@ -0,0 +1,3803 @@ +@@ -0,0 +1,3805 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. @@ -12973,8 +12973,10 @@ index 0000000..dcfebbf + nState |= KeyIndicatorState::CAPSLOCK; + if (gdk_keymap_get_num_lock_state(pKeyMap)) + nState |= KeyIndicatorState::NUMLOCK; ++#if GTK_CHECK_VERSION(3,18,0) + if (gdk_keymap_get_scroll_lock_state(pKeyMap)) + nState |= KeyIndicatorState::SCROLLLOCK; ++#endif + return nState; +} + diff --git a/SOURCES/0001-ofz-372-check-if-ImplSplit-succeeded.patch b/SOURCES/0001-ofz-372-check-if-ImplSplit-succeeded.patch new file mode 100644 index 0000000..cab175c --- /dev/null +++ b/SOURCES/0001-ofz-372-check-if-ImplSplit-succeeded.patch @@ -0,0 +1,81 @@ +From f24a98badcc637ed32ce2f31e623f651c69057e3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= +Date: Mon, 2 Jan 2017 11:53:31 +0000 +Subject: [PATCH] ofz#372 check if ImplSplit succeeded + +Change-Id: I1e34295fe3ee5f77e787f583616d52fa92a0eca4 +--- + tools/inc/poly.h | 2 +- + tools/source/generic/poly.cxx | 23 +++++++++++++++-------- + 2 files changed, 16 insertions(+), 9 deletions(-) + +diff --git a/tools/inc/poly.h b/tools/inc/poly.h +index d677bcd8b0ac..c614401f122c 100644 +--- a/tools/inc/poly.h ++++ b/tools/inc/poly.h +@@ -42,7 +42,7 @@ public: + + void ImplSetSize( sal_uInt16 nSize, bool bResize = true ); + void ImplCreateFlagArray(); +- void ImplSplit( sal_uInt16 nPos, sal_uInt16 nSpace, ImplPolygon* pInitPoly = NULL ); ++ bool ImplSplit( sal_uInt16 nPos, sal_uInt16 nSpace, ImplPolygon* pInitPoly = NULL ); + }; + + #define MAX_POLYGONS ((sal_uInt16)0x3FF0) +diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx +index 457a05b4d112..2c89775e79d0 100644 +--- a/tools/source/generic/poly.cxx ++++ b/tools/source/generic/poly.cxx +@@ -208,13 +208,16 @@ void ImplPolygon::ImplSetSize( sal_uInt16 nNewSize, bool bResize ) + mnPoints = nNewSize; + } + +-void ImplPolygon::ImplSplit( sal_uInt16 nPos, sal_uInt16 nSpace, ImplPolygon* pInitPoly ) ++bool ImplPolygon::ImplSplit( sal_uInt16 nPos, sal_uInt16 nSpace, ImplPolygon* pInitPoly ) + { + const sal_uIntPtr nSpaceSize = nSpace * sizeof( Point ); + + //Can't fit this in :-(, throw ? + if (mnPoints + nSpace > USHRT_MAX) +- return; ++ { ++ SAL_WARN("tools", "Polygon needs " << mnPoints + nSpace << " points, but only " << USHRT_MAX << " possible"); ++ return false; ++ } + + const sal_uInt16 nNewSize = mnPoints + nSpace; + +@@ -269,6 +272,8 @@ void ImplPolygon::ImplSplit( sal_uInt16 nPos, sal_uInt16 nSpace, ImplPolygon* pI + mpPointAry = pNewAry; + mnPoints = nNewSize; + } ++ ++ return true; + } + + void ImplPolygon::ImplCreateFlagArray() +@@ -1444,13 +1449,15 @@ void Polygon::Insert( sal_uInt16 nPos, const Point& rPt, PolyFlags eFlags ) + if( nPos >= mpImplPolygon->mnPoints ) + nPos = mpImplPolygon->mnPoints; + +- mpImplPolygon->ImplSplit( nPos, 1 ); +- mpImplPolygon->mpPointAry[ nPos ] = rPt; +- +- if( POLY_NORMAL != eFlags ) ++ if (mpImplPolygon->ImplSplit(nPos, 1)) + { +- mpImplPolygon->ImplCreateFlagArray(); +- mpImplPolygon->mpFlagAry[ nPos ] = (sal_uInt8) eFlags; ++ mpImplPolygon->mpPointAry[ nPos ] = rPt; ++ ++ if( POLY_NORMAL != eFlags ) ++ { ++ mpImplPolygon->ImplCreateFlagArray(); ++ mpImplPolygon->mpFlagAry[ nPos ] = (sal_uInt8) eFlags; ++ } + } + } + +-- +2.12.2 + diff --git a/SOURCES/0001-sysui-g-ir-scanner-is-not-available-in-when-introspe.patch b/SOURCES/0001-sysui-g-ir-scanner-is-not-available-in-when-introspe.patch new file mode 100644 index 0000000..e2d07ef --- /dev/null +++ b/SOURCES/0001-sysui-g-ir-scanner-is-not-available-in-when-introspe.patch @@ -0,0 +1,79 @@ +From 7901933672c1d2dcd0148f0c8e9c8ee625d009b8 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Mon, 14 Sep 2015 14:12:29 +0200 +Subject: [PATCH 1/2] sysui: g-ir-scanner is not available in when + introspection is disabled + +Should fix the RHEL6 build. + +Change-Id: I3d6e6a2b43c2d6a43ea0686600cf2f893c518cc8 +Reviewed-on: https://gerrit.libreoffice.org/18566 +Tested-by: Jenkins +Reviewed-by: Miklos Vajna +(cherry picked from commit d8026ad65c8d50868f0f2fc0d2bd95820cddea83) +--- + config_host.mk.in | 1 + + sysui/CustomTarget_share.mk | 1 + + sysui/desktop/share/create_tree.sh | 24 +++++++++++++----------- + 3 files changed, 15 insertions(+), 11 deletions(-) + +diff --git a/config_host.mk.in b/config_host.mk.in +index 4ce14b085201..263f5323b7e5 100644 +--- a/config_host.mk.in ++++ b/config_host.mk.in +@@ -281,6 +281,7 @@ export ICU_RECLASSIFIED_CLOSE_PARENTHESIS=@ICU_RECLASSIFIED_CLOSE_PARENTHESIS@ + export ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=@ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER@ + export ICU_RECLASSIFIED_HEBREW_LETTER=@ICU_RECLASSIFIED_HEBREW_LETTER@ + export ICU_RECLASSIFIED_PREPEND_SET_EMPTY=@ICU_RECLASSIFIED_PREPEND_SET_EMPTY@ ++export INTROSPECTION_SCANNER=@INTROSPECTION_SCANNER@ + export ILIB=@ILIB@ + export INSTALLDIR=@INSTALLDIR@ + export INSTALLDIRNAME=@INSTALLDIRNAME@ +diff --git a/sysui/CustomTarget_share.mk b/sysui/CustomTarget_share.mk +index 84907d1003c4..79bafd7f66ad 100644 +--- a/sysui/CustomTarget_share.mk ++++ b/sysui/CustomTarget_share.mk +@@ -184,6 +184,7 @@ $(share_WORKDIR)/%/create_tree.sh: $(share_SRCDIR)/share/create_tree.sh $(share_ + echo "ICON_SOURCE_DIR=$(SRCDIR)/sysui/desktop/icons" >> $@ + echo "APPDATA_SOURCE_DIR=$(SRCDIR)/sysui/desktop/appstream-appdata" >> $@ + echo "PRODUCTVERSION=$(PRODUCTVERSION)" >> $@ ++ echo "INTROSPECTION_SCANNER=$(INTROSPECTION_SCANNER)" >> $@ + cat $< >> $@ + chmod 774 $@ + +diff --git a/sysui/desktop/share/create_tree.sh b/sysui/desktop/share/create_tree.sh +index 45b7c6cb09db..c73b89af3ab5 100755 +--- a/sysui/desktop/share/create_tree.sh ++++ b/sysui/desktop/share/create_tree.sh +@@ -88,15 +88,17 @@ for i in base calc draw impress writer; do + done + + # Generate gobject-introspection files +-mkdir -p "${DESTDIR}/${PREFIXDIR}/share/gir-1.0" +-g-ir-scanner "${SRCDIR}/include/LibreOfficeKit/LibreOfficeKitGtk.h" "${SRCDIR}/libreofficekit/source/gtk/lokdocview.cxx" \ +- `${PKG_CONFIG} --cflags gobject-introspection-1.0 gtk+-3.0` -I"${SRCDIR}/include/" \ +- --include=GLib-2.0 --include=GObject-2.0 --include=Gio-2.0 \ +- --library=libreofficekitgtk --library-path="${DESTDIR}/${INSTALLDIR}/program" \ +- --include=Gdk-3.0 --include=GdkPixbuf-2.0 --include=Gtk-3.0 \ +- --namespace=LOKDocView --nsversion=0.1 --identifier-prefix=LOKDoc --symbol-prefix=lok_doc \ +- --output="${DESTDIR}/${PREFIXDIR}/share/gir-1.0/LOKDocView-0.1.gir" --warn-all --no-libtool ++if [ -n "$INTROSPECTION_SCANNER" ]; then ++ mkdir -p "${DESTDIR}/${PREFIXDIR}/share/gir-1.0" ++ g-ir-scanner "${SRCDIR}/include/LibreOfficeKit/LibreOfficeKitGtk.h" "${SRCDIR}/libreofficekit/source/gtk/lokdocview.cxx" \ ++ `${PKG_CONFIG} --cflags gobject-introspection-1.0 gtk+-3.0` -I"${SRCDIR}/include/" \ ++ --include=GLib-2.0 --include=GObject-2.0 --include=Gio-2.0 \ ++ --library=libreofficekitgtk --library-path="${DESTDIR}/${INSTALLDIR}/program" \ ++ --include=Gdk-3.0 --include=GdkPixbuf-2.0 --include=Gtk-3.0 \ ++ --namespace=LOKDocView --nsversion=0.1 --identifier-prefix=LOKDoc --symbol-prefix=lok_doc \ ++ --output="${DESTDIR}/${PREFIXDIR}/share/gir-1.0/LOKDocView-0.1.gir" --warn-all --no-libtool + +-mkdir -p "${DESTDIR}/${LIBDIR}/girepository-1.0" +-g-ir-compiler "${DESTDIR}/${PREFIXDIR}/share/gir-1.0/LOKDocView-0.1.gir" \ +- --output="${DESTDIR}/${LIBDIR}/girepository-1.0/LOKDocView-0.1.typelib" ++ mkdir -p "${DESTDIR}/${LIBDIR}/girepository-1.0" ++ g-ir-compiler "${DESTDIR}/${PREFIXDIR}/share/gir-1.0/LOKDocView-0.1.gir" \ ++ --output="${DESTDIR}/${LIBDIR}/girepository-1.0/LOKDocView-0.1.typelib" ++fi +-- +2.12.0 + diff --git a/SOURCES/0001-vcl-assign-nullptr-after-deleting.patch b/SOURCES/0001-vcl-assign-nullptr-after-deleting.patch new file mode 100644 index 0000000..6e7cf14 --- /dev/null +++ b/SOURCES/0001-vcl-assign-nullptr-after-deleting.patch @@ -0,0 +1,74 @@ +From 2bd35de5cf811af8f8019549fcdb5ccf2af7af93 Mon Sep 17 00:00:00 2001 +From: Henry Castro +Date: Mon, 7 Sep 2015 17:43:04 -0400 +Subject: [PATCH 1/6] vcl: assign nullptr after deleting + +In the preinit stage, the VCL initialization is done by the parent process +and when the lo_startmain thread de-initialize the VCL, some services are +disposed early, and it causes segmentation violation. + +So it is ensured that pointers to service objetcs is set nullptr after +deleting. + +Change-Id: I65ecfc2d2694a981ec2986988efabdfd28d0cce4 +(cherry picked from commit 4886676a5b50caf0946b91491055cbdc2696f1ca) +--- + vcl/source/app/svdata.cxx | 4 ++-- + vcl/source/app/svmain.cxx | 10 +++++++--- + 2 files changed, 9 insertions(+), 5 deletions(-) + +diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx +index 71d7628..0bbba59 100644 +--- a/vcl/source/app/svdata.cxx ++++ b/vcl/source/app/svdata.cxx +@@ -102,10 +102,10 @@ void ImplDeInitSVData() + + // delete global instance data + if( pSVData->mpSettingsConfigItem ) +- delete pSVData->mpSettingsConfigItem; ++ delete pSVData->mpSettingsConfigItem, pSVData->mpSettingsConfigItem = nullptr; + + if( pSVData->mpDockingManager ) +- delete pSVData->mpDockingManager; ++ delete pSVData->mpDockingManager, pSVData->mpDockingManager = nullptr; + + if( pSVData->maCtrlData.mpFieldUnitStrings ) + delete pSVData->maCtrlData.mpFieldUnitStrings, pSVData->maCtrlData.mpFieldUnitStrings = NULL; +diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx +index 23757e8..3202019 100644 +--- a/vcl/source/app/svmain.cxx ++++ b/vcl/source/app/svmain.cxx +@@ -380,7 +380,7 @@ void DeInitVCL() + delete pSVData->mpSettingsConfigItem, pSVData->mpSettingsConfigItem = NULL; + + if ( pSVData->maAppData.mpIdleMgr ) +- delete pSVData->maAppData.mpIdleMgr; ++ delete pSVData->maAppData.mpIdleMgr, pSVData->maAppData.mpIdleMgr = nullptr; + Scheduler::ImplDeInitScheduler(); + + if ( pSVData->maWinData.mpMsgBoxImgList ) +@@ -539,7 +539,11 @@ void DeInitVCL() + pSVData->mpSalTimer = NULL; + + // Deinit Sal +- DestroySalInstance( pSVData->mpDefInst ); ++ if (pSVData->mpDefInst) ++ { ++ DestroySalInstance( pSVData->mpDefInst ); ++ pSVData->mpDefInst = nullptr; ++ } + + if( pOwnSvApp ) + { +@@ -566,7 +570,7 @@ struct WorkerThreadData + static HANDLE hThreadID = 0; + static unsigned __stdcall _threadmain( void *pArgs ) + { +- OleInitialize( NULL ); ++ OleInitialize( nullptr ); + ((WorkerThreadData*)pArgs)->pWorker( ((WorkerThreadData*)pArgs)->pThreadData ); + delete (WorkerThreadData*)pArgs; + OleUninitialize(); +-- +2.9.3 + diff --git a/SOURCES/0002-LOK-remove-unused-LOK_PARTMODE_EMBEDDEDOBJ.patch b/SOURCES/0002-LOK-remove-unused-LOK_PARTMODE_EMBEDDEDOBJ.patch new file mode 100644 index 0000000..2dca803 --- /dev/null +++ b/SOURCES/0002-LOK-remove-unused-LOK_PARTMODE_EMBEDDEDOBJ.patch @@ -0,0 +1,90 @@ +From f8c6d3406005aa7a6e408ca25f61a0db35acd6be Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 22 May 2015 12:14:36 +0100 +Subject: [PATCH 002/398] LOK: remove unused LOK_PARTMODE_EMBEDDEDOBJ + +Change-Id: I8cbb5b7a134fb84bd2c363b06f06f7f40964521f +(cherry picked from commit 39321c5ffa9b4196308575be6dd19f2b2924214f) +--- + include/LibreOfficeKit/LibreOfficeKitEnums.h | 7 ++----- + libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 9 +-------- + sd/source/ui/unoidl/unomodel.cxx | 15 +-------------- + 3 files changed, 4 insertions(+), 27 deletions(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h +index 5293aa9be4c0..66237e4512cf 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h ++++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h +@@ -28,11 +28,8 @@ LibreOfficeKitDocumentType; + + typedef enum + { +- LOK_PARTMODE_DEFAULT, +- LOK_PARTMODE_SLIDE, +- LOK_PARTMODE_NOTES, +- LOK_PARTMODE_SLIDENOTES, +- LOK_PARTMODE_EMBEDDEDOBJ ++ LOK_PARTMODE_SLIDES, ++ LOK_PARTMODE_NOTES + } + LibreOfficeKitPartMode; + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 83ec9d23c113..d20f43d90627 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -312,11 +312,8 @@ static void changePart( GtkWidget* pSelector, gpointer /* pItem */ ) + + static void populatePartModeSelector( GtkComboBoxText* pSelector ) + { +- gtk_combo_box_text_append_text( pSelector, "Default" ); +- gtk_combo_box_text_append_text( pSelector, "Slide" ); ++ gtk_combo_box_text_append_text( pSelector, "Standard" ); + gtk_combo_box_text_append_text( pSelector, "Notes" ); +- gtk_combo_box_text_append_text( pSelector, "Combined (SlideNotes)" ); +- gtk_combo_box_text_append_text( pSelector, "Embedded Objects" ); + gtk_combo_box_set_active( GTK_COMBO_BOX(pSelector), 0 ); + } + +@@ -331,10 +328,6 @@ static void changePartMode( GtkWidget* pSelector, gpointer /* pItem */ ) + { + lok_docview_set_partmode( LOK_DOCVIEW(pDocView), ePartMode ); + } +- +- // The number of items could change e.g. if we change from slide +- // to embeddede obj mode -- hence we should update the part list. +- populatePartSelector(); + } + #endif + +diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx +index 7a9bf2af2671..4148035c899a 100644 +--- a/sd/source/ui/unoidl/unomodel.cxx ++++ b/sd/source/ui/unoidl/unomodel.cxx +@@ -2346,22 +2346,9 @@ void SdXImpressDocument::setPartMode( int nPartMode ) + PageKind aPageKind( PK_STANDARD ); + switch ( nPartMode ) + { +- case LOK_PARTMODE_EMBEDDEDOBJ: +- // This will probably be handled higher up, i.e. +- // we probably shouldn't be handling this here. +- // (However we don't offer embedded object-only +- // rendering anywhere yet, so this may be a +- // completely incorrect comment.) +- assert( false ); +- // And let's fall through in a normal build. +- case LOK_PARTMODE_DEFAULT: +- case LOK_PARTMODE_SLIDE: +- break; +- case LOK_PARTMODE_SLIDENOTES: +- aPageKind = PK_NOTES; ++ case LOK_PARTMODE_SLIDES: + break; + case LOK_PARTMODE_NOTES: +- // TODO: this shows combined slides + notes + aPageKind = PK_NOTES; + break; + } +-- +2.12.0 + diff --git a/SOURCES/0002-sysui-introspection-wants-INSTDIR-not-DESTDIR-INSTAL.patch b/SOURCES/0002-sysui-introspection-wants-INSTDIR-not-DESTDIR-INSTAL.patch new file mode 100644 index 0000000..7237d2f --- /dev/null +++ b/SOURCES/0002-sysui-introspection-wants-INSTDIR-not-DESTDIR-INSTAL.patch @@ -0,0 +1,50 @@ +From 132994c95901d1b5876c6eb468aae294ff00655b Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 18 Sep 2015 09:10:30 +0200 +Subject: [PATCH 2/2] sysui: introspection wants ${INSTDIR}, not + ${DESTDIR}/${INSTALLDIR} + +The later can be empty for the generic rpm case. + +Change-Id: I69c62dcd2a16004c7927c9cf67837463e6411a8d +Reviewed-on: https://gerrit.libreoffice.org/18675 +Tested-by: Jenkins +Reviewed-by: Miklos Vajna +(cherry picked from commit c722e9e728ec6c9df0285f5dd2041aa58f66f686) +--- + configure.ac | 5 ++++- + sysui/desktop/share/create_tree.sh | 2 +- + 2 files changed, 5 insertions(+), 2 deletions(-) + +diff --git a/configure.ac b/configure.ac +index f3fe04da124b..c5183b7cc448 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -9917,7 +9917,10 @@ if test "x$enable_gtk3" = "xyes"; then + PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= 3.8 gtk+-unix-print-3.0 gmodule-no-export-2.0 glib-2.0 >= 2.38 cairo, ENABLE_GTK3="TRUE", ENABLE_GTK3="") + if test "x$ENABLE_GTK3" = "xTRUE"; then + R="gtk3" +- GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION) ++ dnl Avoid installed by unpackaged files for now. ++ if test -z "$PKGFORMAT"; then ++ GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION) ++ fi + else + AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found]) + fi +diff --git a/sysui/desktop/share/create_tree.sh b/sysui/desktop/share/create_tree.sh +index c73b89af3ab5..86d2837fed0f 100755 +--- a/sysui/desktop/share/create_tree.sh ++++ b/sysui/desktop/share/create_tree.sh +@@ -93,7 +93,7 @@ if [ -n "$INTROSPECTION_SCANNER" ]; then + g-ir-scanner "${SRCDIR}/include/LibreOfficeKit/LibreOfficeKitGtk.h" "${SRCDIR}/libreofficekit/source/gtk/lokdocview.cxx" \ + `${PKG_CONFIG} --cflags gobject-introspection-1.0 gtk+-3.0` -I"${SRCDIR}/include/" \ + --include=GLib-2.0 --include=GObject-2.0 --include=Gio-2.0 \ +- --library=libreofficekitgtk --library-path="${DESTDIR}/${INSTALLDIR}/program" \ ++ --library=libreofficekitgtk --library-path="${INSTDIR}/program" \ + --include=Gdk-3.0 --include=GdkPixbuf-2.0 --include=Gtk-3.0 \ + --namespace=LOKDocView --nsversion=0.1 --identifier-prefix=LOKDoc --symbol-prefix=lok_doc \ + --output="${DESTDIR}/${PREFIXDIR}/share/gir-1.0/LOKDocView-0.1.gir" --warn-all --no-libtool +-- +2.12.0 + diff --git a/SOURCES/0002-vcl-add-isInitVCL-to-not-initialize-twice.patch b/SOURCES/0002-vcl-add-isInitVCL-to-not-initialize-twice.patch new file mode 100644 index 0000000..52c453c --- /dev/null +++ b/SOURCES/0002-vcl-add-isInitVCL-to-not-initialize-twice.patch @@ -0,0 +1,57 @@ +From ae536d948c00a5561f7d08f2f7459516d8bf9807 Mon Sep 17 00:00:00 2001 +From: Henry Castro +Date: Mon, 7 Sep 2015 17:33:09 -0400 +Subject: [PATCH 2/6] vcl: add isInitVCL, to not initialize twice + +In the preinit stage, the VCL is initialized in the parent process +and when the lo_startmain thread is started, the thread initialize +VCL again. + +It is not necessary to initialize twice. + +Change-Id: I819cf0125afe7760c3f4d91c420d36a3a383902c +(cherry picked from commit bc8dfe47596f28ff43ec01af4487a2abe349caee) +--- + vcl/source/app/svmain.cxx | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx +index 3202019..f6d4e25 100644 +--- a/vcl/source/app/svmain.cxx ++++ b/vcl/source/app/svmain.cxx +@@ -91,6 +91,8 @@ + + using namespace ::com::sun::star; + ++static bool isInitVCL(); ++ + oslSignalAction SAL_CALL VCLExceptionSignal_impl( void* /*pData*/, oslSignalInfo* pInfo) + { + static bool bIn = false; +@@ -160,7 +162,7 @@ int ImplSVMain() + + int nReturn = EXIT_FAILURE; + +- bool bInit = InitVCL(); ++ bool bInit = (!isInitVCL() ? InitVCL() : true); + + if( bInit ) + { +@@ -243,6 +245,14 @@ uno::Any SAL_CALL DesktopEnvironmentContext::getValueByName( const OUString& Nam + return retVal; + } + ++static bool isInitVCL() ++{ ++ ImplSVData* pSVData = ImplGetSVData(); ++ return pExceptionHandler != NULL && ++ pSVData->mpApp != NULL && ++ pSVData->mpDefInst != NULL; ++} ++ + bool InitVCL() + { + if( pExceptionHandler != NULL ) +-- +2.9.3 + diff --git a/SOURCES/0003-Look-for-libsofficeapp.dylib-in-the-right-place-on-O.patch b/SOURCES/0003-Look-for-libsofficeapp.dylib-in-the-right-place-on-O.patch new file mode 100644 index 0000000..1f890d1 --- /dev/null +++ b/SOURCES/0003-Look-for-libsofficeapp.dylib-in-the-right-place-on-O.patch @@ -0,0 +1,28 @@ +From 9eb31913cc9f35fb792bf8c8051f44ba11e16a5c Mon Sep 17 00:00:00 2001 +From: Tor Lillqvist +Date: Sat, 23 May 2015 10:09:18 +0100 +Subject: [PATCH 003/398] Look for libsofficeapp.dylib in the right place on OS + X + +Change-Id: Icef6b70081b15d4b8d99eb4ba7103f059e8d00e4 +(cherry picked from commit a1aa2cdaa7c467376c1f7824e2b6a83cb252a39a) +--- + desktop/source/lib/init.cxx | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index b2076c622bf1..88cbcbd8d285 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -899,6 +899,8 @@ static bool initialize_uno(const OUString& aAppProgramURL) + #ifdef IOS + // For iOS we already hardocde the inifile as "rc" in the .app directory. + (void) aAppProgramURL; ++#elif defined MACOSX ++ rtl::Bootstrap::setIniFilename(aAppProgramURL + "/../Resources/" SAL_CONFIGFILE("soffice")); + #else + rtl::Bootstrap::setIniFilename(aAppProgramURL + "/" SAL_CONFIGFILE("soffice")); + #endif +-- +2.12.0 + diff --git a/SOURCES/0003-gnome-documents-rework-SfxPickList-as-pimpl.patch b/SOURCES/0003-gnome-documents-rework-SfxPickList-as-pimpl.patch new file mode 100644 index 0000000..d1b363e --- /dev/null +++ b/SOURCES/0003-gnome-documents-rework-SfxPickList-as-pimpl.patch @@ -0,0 +1,284 @@ +From f0efe28ec775c3205d3591750cd5159119128d20 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= +Date: Mon, 8 May 2017 15:27:49 +0100 +Subject: [PATCH 3/6] gnome-documents: rework SfxPickList as pimpl +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +and call impl dtor with SolarMutex held + +Reviewed-on: https://gerrit.libreoffice.org/37395 +Reviewed-by: Caolán McNamara +Tested-by: Caolán McNamara +(cherry picked from commit 53082fcd1b1cccf7ef0c3cb1bef8e747c4e88a61) + +Change-Id: I06931ca9ab4384a5e3c255847cf3533ed03b77dc +--- + sfx2/source/appl/sfxpicklist.cxx | 101 ++++++++++++++++++++++++++++++--------- + sfx2/source/inc/sfxpicklist.hxx | 53 +++++--------------- + sfx2/source/menu/virtmenu.cxx | 2 +- + 3 files changed, 92 insertions(+), 64 deletions(-) + +diff --git a/sfx2/source/appl/sfxpicklist.cxx b/sfx2/source/appl/sfxpicklist.cxx +index 24754ca..478c537 100644 +--- a/sfx2/source/appl/sfxpicklist.cxx ++++ b/sfx2/source/appl/sfxpicklist.cxx +@@ -78,7 +78,54 @@ class StringLength : public ::cppu::WeakImplHelper1< XStringWidth > + } + }; + +-void SfxPickList::CreatePicklistMenuTitle( Menu* pMenu, sal_uInt16 nItemId, const OUString& aURLString, sal_uInt32 nNo ) ++namespace ++{ ++ class thePickListMutex ++ : public rtl::Static {}; ++} ++ ++class SfxPickListImpl : public SfxListener ++{ ++ struct PickListEntry ++ { ++ PickListEntry( const OUString& _aName, const OUString& _aFilter, const OUString& _aTitle ) : ++ aName( _aName ), aFilter( _aFilter ), aTitle( _aTitle ) {} ++ ++ OUString aName; ++ OUString aFilter; ++ OUString aTitle; ++ OUString aOptions; ++ }; ++ ++ std::vector< PickListEntry* > m_aPicklistVector; ++ sal_uInt32 m_nAllowedMenuSize; ++ css::uno::Reference< css::util::XStringWidth > m_xStringLength; ++ ++ void CreatePicklistMenuTitle( Menu* pMenu, sal_uInt16 nItemId, const OUString& aURL, sal_uInt32 nNo ); ++ PickListEntry* GetPickListEntry( sal_uInt32 nIndex ); ++ void CreatePickListEntries(); ++ void RemovePickListEntries(); ++ /** ++ * Adds the given document to the pick list (recent documents) if it satisfies ++ certain requirements, e.g. being writable. Check implementation for requirement ++ details. ++ */ ++ static void AddDocumentToPickList( SfxObjectShell* pDocShell ); ++ ++public: ++ void CreateMenuEntries( Menu* pMenu ); ++ void ExecuteMenuEntry( sal_uInt16 nId ); ++ void ExecuteEntry( sal_uInt32 nIndex ); ++ ++ SfxPickListImpl(sal_uInt32 nMenuSize); ++ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; ++ ~SfxPickListImpl() ++ { ++ RemovePickListEntries(); ++ } ++}; ++ ++void SfxPickListImpl::CreatePicklistMenuTitle( Menu* pMenu, sal_uInt16 nItemId, const OUString& aURLString, sal_uInt32 nNo ) + { + OUStringBuffer aPickEntry; + +@@ -136,13 +183,7 @@ void SfxPickList::CreatePicklistMenuTitle( Menu* pMenu, sal_uInt16 nItemId, cons + pMenu->SetAccessibleName( nItemId, aAccessibleName ); + } + +-namespace +-{ +- class thePickListMutex +- : public rtl::Static {}; +-} +- +-void SfxPickList::RemovePickListEntries() ++void SfxPickListImpl::RemovePickListEntries() + { + ::osl::MutexGuard aGuard( thePickListMutex::get() ); + for ( sal_uInt32 i = 0; i < m_aPicklistVector.size(); i++ ) +@@ -150,7 +191,7 @@ void SfxPickList::RemovePickListEntries() + m_aPicklistVector.clear(); + } + +-SfxPickList::PickListEntry* SfxPickList::GetPickListEntry( sal_uInt32 nIndex ) ++SfxPickListImpl::PickListEntry* SfxPickListImpl::GetPickListEntry( sal_uInt32 nIndex ) + { + OSL_ASSERT( m_aPicklistVector.size() > nIndex ); + +@@ -160,7 +201,7 @@ SfxPickList::PickListEntry* SfxPickList::GetPickListEntry( sal_uInt32 nIndex ) + return 0; + } + +-void SfxPickList::AddDocumentToPickList( SfxObjectShell* pDocSh ) ++void SfxPickListImpl::AddDocumentToPickList( SfxObjectShell* pDocSh ) + { + if (comphelper::LibreOfficeKit::isActive()) + return; +@@ -242,13 +283,34 @@ void SfxPickList::AddDocumentToPickList( SfxObjectShell* pDocSh ) + (pFilter) ? pFilter->GetServiceName() : OUString() ); + } + ++SfxPickList::SfxPickList(sal_uInt32 nAllowedMenuSize) ++ : mxImpl(new SfxPickListImpl(nAllowedMenuSize)) ++{ ++} ++ ++SfxPickList::~SfxPickList() ++{ ++ std::unique_ptr xGuard(comphelper::SolarMutex::get() ? new SolarMutexGuard : nullptr); ++ mxImpl.reset(); ++} ++ + SfxPickList& SfxPickList::Get() + { + static SfxPickList aUniqueInstance(SvtHistoryOptions().GetSize(ePICKLIST)); + return aUniqueInstance; + } + +-SfxPickList::SfxPickList( sal_uInt32 nAllowedMenuSize ) : ++void SfxPickList::CreateMenuEntries(Menu* pMenu) ++{ ++ mxImpl->CreateMenuEntries(pMenu); ++} ++ ++void SfxPickList::ExecuteMenuEntry(sal_uInt16 nId) ++{ ++ mxImpl->ExecuteMenuEntry(nId); ++} ++ ++SfxPickListImpl::SfxPickListImpl( sal_uInt32 nAllowedMenuSize ) : + m_nAllowedMenuSize( nAllowedMenuSize ) + { + m_xStringLength = new StringLength; +@@ -256,12 +318,7 @@ SfxPickList::SfxPickList( sal_uInt32 nAllowedMenuSize ) : + StartListening( *SfxGetpApp() ); + } + +-SfxPickList::~SfxPickList() +-{ +- RemovePickListEntries(); +-} +- +-void SfxPickList::CreatePickListEntries() ++void SfxPickListImpl::CreatePickListEntries() + { + RemovePickListEntries(); + +@@ -305,7 +362,7 @@ void SfxPickList::CreatePickListEntries() + } + } + +-void SfxPickList::CreateMenuEntries( Menu* pMenu ) ++void SfxPickListImpl::CreateMenuEntries( Menu* pMenu ) + { + ::osl::MutexGuard aGuard( thePickListMutex::get() ); + +@@ -340,11 +397,11 @@ void SfxPickList::CreateMenuEntries( Menu* pMenu ) + bPickListMenuInitializing = false; + } + +-void SfxPickList::ExecuteEntry( sal_uInt32 nIndex ) ++void SfxPickListImpl::ExecuteEntry( sal_uInt32 nIndex ) + { + ::osl::ClearableMutexGuard aGuard( thePickListMutex::get() ); + +- PickListEntry *pPick = SfxPickList::Get().GetPickListEntry( nIndex ); ++ PickListEntry *pPick = GetPickListEntry(nIndex); + + if ( pPick ) + { +@@ -369,12 +426,12 @@ void SfxPickList::ExecuteEntry( sal_uInt32 nIndex ) + } + } + +-void SfxPickList::ExecuteMenuEntry( sal_uInt16 nId ) ++void SfxPickListImpl::ExecuteMenuEntry( sal_uInt16 nId ) + { + ExecuteEntry( (sal_uInt32)( nId - START_ITEMID_PICKLIST ) ); + } + +-void SfxPickList::Notify( SfxBroadcaster&, const SfxHint& rHint ) ++void SfxPickListImpl::Notify( SfxBroadcaster&, const SfxHint& rHint ) + { + const SfxStringHint* pStringHint = dynamic_cast(&rHint); + if ( pStringHint ) +diff --git a/sfx2/source/inc/sfxpicklist.hxx b/sfx2/source/inc/sfxpicklist.hxx +index 502492c..56da5d4 100644 +--- a/sfx2/source/inc/sfxpicklist.hxx ++++ b/sfx2/source/inc/sfxpicklist.hxx +@@ -29,48 +29,19 @@ + + #define PICKLIST_MAXSIZE 100 + +-class SfxPickList : public SfxListener +-{ +- struct PickListEntry +- { +- PickListEntry( const OUString& _aName, const OUString& _aFilter, const OUString& _aTitle ) : +- aName( _aName ), aFilter( _aFilter ), aTitle( _aTitle ) {} +- +- OUString aName; +- OUString aFilter; +- OUString aTitle; +- OUString aOptions; +- }; +- +- std::vector< PickListEntry* > m_aPicklistVector; +- sal_uInt32 m_nAllowedMenuSize; +- ::com::sun::star::uno::Reference< ::com::sun::star::util::XStringWidth > m_xStringLength; +- +- SfxPickList( sal_uInt32 nMenuSize ); +- virtual ~SfxPickList(); ++class SfxPickListImpl; + +- void CreatePicklistMenuTitle( Menu* pMenu, sal_uInt16 nItemId, const OUString& aURL, sal_uInt32 nNo ); +- PickListEntry* GetPickListEntry( sal_uInt32 nIndex ); +- void CreatePickListEntries(); +- void RemovePickListEntries(); +- /** +- * Adds the given document to the pick list (recent documents) if it satisfies +- certain requirements, e.g. being writable. Check implementation for requirement +- details. +- */ +- static void AddDocumentToPickList( SfxObjectShell* pDocShell ); +- +- public: +- static SfxPickList& Get(); +- static void ensure() { Get(); } +- +- sal_uInt32 GetAllowedMenuSize() { return m_nAllowedMenuSize; } +- sal_uInt32 GetNumOfEntries() const { return m_aPicklistVector.size(); } +- void CreateMenuEntries( Menu* pMenu ); +- static void ExecuteMenuEntry( sal_uInt16 nId ); +- static void ExecuteEntry( sal_uInt32 nIndex ); +- +- virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE; ++class SfxPickList ++{ ++private: ++ std::unique_ptr mxImpl; ++public: ++ SfxPickList(sal_uInt32 nAllowedMenuSize); ++ static SfxPickList& Get(); ++ void CreateMenuEntries(Menu* pMenu); ++ void ExecuteMenuEntry(sal_uInt16 nId); ++ static void ensure() { Get(); } ++ ~SfxPickList(); + }; + + #endif // INCLUDED_SFX2_SOURCE_INC_SFXPICKLIST_HXX +diff --git a/sfx2/source/menu/virtmenu.cxx b/sfx2/source/menu/virtmenu.cxx +index e14bb24..eab7bb7 100644 +--- a/sfx2/source/menu/virtmenu.cxx ++++ b/sfx2/source/menu/virtmenu.cxx +@@ -964,7 +964,7 @@ IMPL_LINK( SfxVirtualMenu, Select, Menu *, pMenu ) + } + else if ( nSlotId >= START_ITEMID_PICKLIST && nSlotId <= END_ITEMID_PICKLIST ) + { +- SfxPickList::ExecuteMenuEntry( nSlotId ); ++ SfxPickList::Get().ExecuteMenuEntry(nSlotId); + return sal_IntPtr(true); + } + +-- +2.9.3 + diff --git a/SOURCES/0004-Don-t-do-any-magic-LO-OS-X-application-stuff-in-a-LO.patch b/SOURCES/0004-Don-t-do-any-magic-LO-OS-X-application-stuff-in-a-LO.patch new file mode 100644 index 0000000..e694c41 --- /dev/null +++ b/SOURCES/0004-Don-t-do-any-magic-LO-OS-X-application-stuff-in-a-LO.patch @@ -0,0 +1,38 @@ +From afd423f49c86a0360510433302b545cfc97f3cbc Mon Sep 17 00:00:00 2001 +From: Tor Lillqvist +Date: Sat, 23 May 2015 10:56:30 +0100 +Subject: [PATCH 004/398] Don't do any magic LO OS X application stuff in a + LOKit client + +Change-Id: If6b6c3e48c7d0681958ff0e2afe0b0be5f6ee1ab +(cherry picked from commit 20c9ceb708e4720205a303bf2d41274b1311e36b) +--- + vcl/osx/salinst.cxx | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/vcl/osx/salinst.cxx b/vcl/osx/salinst.cxx +index 58a52d58accf..f57f8f4b45c5 100644 +--- a/vcl/osx/salinst.cxx ++++ b/vcl/osx/salinst.cxx +@@ -23,6 +23,8 @@ + + #include + ++#include "comphelper/lok.hxx" ++ + #include "osl/process.h" + + #include "rtl/ustrbuf.hxx" +@@ -182,6 +184,9 @@ static void initNSApp() + + bool ImplSVMainHook( int * pnInit ) + { ++ if (comphelper::LibreOfficeKit::isActive()) ++ return false; ++ + unlink([[NSString stringWithFormat:@"%@/Library/Saved Application State/%s.savedState/restorecount.plist", NSHomeDirectory(), MACOSX_BUNDLE_IDENTIFIER] UTF8String]); + unlink([[NSString stringWithFormat:@"%@/Library/Saved Application State/%s.savedState/restorecount.txt", NSHomeDirectory(), MACOSX_BUNDLE_IDENTIFIER] UTF8String]); + +-- +2.12.0 + diff --git a/SOURCES/0004-rhbz-1444437-gnome-documents-finalize-may-not-occur-.patch b/SOURCES/0004-rhbz-1444437-gnome-documents-finalize-may-not-occur-.patch new file mode 100644 index 0000000..853f098 --- /dev/null +++ b/SOURCES/0004-rhbz-1444437-gnome-documents-finalize-may-not-occur-.patch @@ -0,0 +1,68 @@ +From 4910cb9a1be7040142cedc0ccfb1bec2d74b3dca Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= +Date: Fri, 5 May 2017 14:34:51 +0100 +Subject: [PATCH 4/6] rhbz#1444437 gnome-documents finalize may not occur + immediately +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +when LOK Widget is destroyed, it may instead happen during GC of javascript, +like in the in gnome-documents case, but "destroy" will be called promptly. So +close documents and office in destroy, not finalize + +Reviewed-on: https://gerrit.libreoffice.org/37398 +Reviewed-by: Caolán McNamara +Tested-by: Caolán McNamara +(cherry picked from commit c45660df336a640f0f9d4290b881548d25c9db9d) + +Change-Id: I1dd7b828839894cb2d87f5c087194fe458ca22f0 +--- + libreofficekit/source/gtk/lokdocview.cxx | 17 +++++++++++++++-- + 1 file changed, 15 insertions(+), 2 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 13ae6ea..7d1ec01 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -2042,15 +2042,27 @@ static gboolean lok_doc_view_draw (GtkWidget* pWidget, cairo_t* pCairo) + return FALSE; + } + +-static void lok_doc_view_finalize (GObject* object) ++//rhbz#1444437 finalize may not occur immediately when this widget is destroyed ++//it may happen during GC of javascript, e.g. in gnome-documents but "destroy" ++//will be called promptly, so close documents in destroy, not finalize ++static void lok_doc_view_destroy (GtkWidget* widget) + { +- LOKDocView* pDocView = LOK_DOC_VIEW (object); ++ LOKDocView* pDocView = LOK_DOC_VIEW (widget); + LOKDocViewPrivate& priv = getPrivate(pDocView); + + if (priv->m_pDocument) + priv->m_pDocument->pClass->destroy (priv->m_pDocument); + if (priv->m_pOffice) + priv->m_pOffice->pClass->destroy (priv->m_pOffice); ++ ++ GTK_WIDGET_CLASS (lok_doc_view_parent_class)->destroy (widget); ++} ++ ++static void lok_doc_view_finalize (GObject* object) ++{ ++ LOKDocView* pDocView = LOK_DOC_VIEW (object); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); ++ + delete priv.m_pImpl; + priv.m_pImpl = nullptr; + +@@ -2099,6 +2111,7 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + pWidgetClass->key_press_event = signalKey; + pWidgetClass->key_release_event = signalKey; + pWidgetClass->motion_notify_event = lok_doc_view_signal_motion; ++ pWidgetClass->destroy = lok_doc_view_destroy; + + /** + * LOKDocView:lopath: +-- +2.9.3 + diff --git a/SOURCES/0005-gnome-documents-hold-solarmutex-on-dtor-patch-as-wel.patch b/SOURCES/0005-gnome-documents-hold-solarmutex-on-dtor-patch-as-wel.patch new file mode 100644 index 0000000..adae3f4 --- /dev/null +++ b/SOURCES/0005-gnome-documents-hold-solarmutex-on-dtor-patch-as-wel.patch @@ -0,0 +1,38 @@ +From eb64ed49b102cf90bba65c23c81c852a32754671 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= +Date: Mon, 8 May 2017 15:51:46 +0100 +Subject: [PATCH 5/6] gnome-documents: hold solarmutex on dtor patch as well +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Change-Id: I75fe71612116d435606c37185bf55b450425fc25 +Reviewed-on: https://gerrit.libreoffice.org/37396 +Tested-by: Jenkins +Reviewed-by: Caolán McNamara +Tested-by: Caolán McNamara +(cherry picked from commit 899ffa4c4c66702e2a65f4065cbb7970d0e9c0e2) +--- + include/comphelper/unique_disposing_ptr.hxx | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/include/comphelper/unique_disposing_ptr.hxx b/include/comphelper/unique_disposing_ptr.hxx +index 1848639..7c0f600 100644 +--- a/include/comphelper/unique_disposing_ptr.hxx ++++ b/include/comphelper/unique_disposing_ptr.hxx +@@ -151,6 +151,12 @@ public: + SolarMutexGuard aGuard; + unique_disposing_ptr::reset(p); + } ++ ++ virtual ~unique_disposing_solar_mutex_reset_ptr() override ++ { ++ if (unique_disposing_ptr::get() && comphelper::SolarMutex::get()) ++ reset(); ++ } + }; + + } +-- +2.9.3 + diff --git a/SOURCES/0005-loplugin-staticmethods.patch b/SOURCES/0005-loplugin-staticmethods.patch new file mode 100644 index 0000000..e88835b --- /dev/null +++ b/SOURCES/0005-loplugin-staticmethods.patch @@ -0,0 +1,85 @@ +From 17e3b1763321f5f338e415bb0d0d86f5e7f7d2c6 Mon Sep 17 00:00:00 2001 +From: Stephan Bergmann +Date: Wed, 27 May 2015 20:51:09 +0200 +Subject: [PATCH 005/398] loplugin:staticmethods + +Change-Id: Idb1072ecedd9ab0315d67e296da6d306c098b183 +(cherry picked from commit 5af7ca55a3d06ab23df715346c9b24d1333907be) +--- + libreofficekit/source/gtk/lokdocview.cxx | 39 +++++++++++++++++--------------- + 1 file changed, 21 insertions(+), 18 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 79cc649fa369..24f9d04a9024 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -38,6 +38,26 @@ + // We know that VirtualDevices use a DPI of 96. + static const int DPI = 96; + ++namespace { ++ ++/// Sets rWidth and rHeight from a "width, height" string. ++void payloadToSize(const char* pPayload, long& rWidth, long& rHeight) ++{ ++ rWidth = rHeight = 0; ++ gchar** ppCoordinates = g_strsplit(pPayload, ", ", 2); ++ gchar** ppCoordinate = ppCoordinates; ++ if (!*ppCoordinate) ++ return; ++ rWidth = atoi(*ppCoordinate); ++ ++ppCoordinate; ++ if (!*ppCoordinate) ++ return; ++ rHeight = atoi(*ppCoordinate); ++ g_strfreev(ppCoordinates); ++} ++ ++} ++ + /// Holds data used by LOKDocView only. + struct LOKDocView_Impl + { +@@ -170,8 +190,6 @@ struct LOKDocView_Impl + * the tiles that intersect with pPartial. + */ + void renderDocument(GdkRectangle* pPartial); +- /// Sets rWidth and rHeight from a "width, height" string. +- static void payloadToSize(const char* pPayload, long& rWidth, long& rHeight); + /// Returns the GdkRectangle of a width,height,x,y string. + static GdkRectangle payloadToRectangle(const char* pPayload); + /// Returns the GdkRectangles of a w,h,x,y;w2,h2,x2,y2;... string. +@@ -846,21 +864,6 @@ void LOKDocView_Impl::renderDocument(GdkRectangle* pPartial) + } + } + +-void LOKDocView_Impl::payloadToSize(const char* pPayload, long& rWidth, long& rHeight) +-{ +- rWidth = rHeight = 0; +- gchar** ppCoordinates = g_strsplit(pPayload, ", ", 2); +- gchar** ppCoordinate = ppCoordinates; +- if (!*ppCoordinate) +- return; +- rWidth = atoi(*ppCoordinate); +- ++ppCoordinate; +- if (!*ppCoordinate) +- return; +- rHeight = atoi(*ppCoordinate); +- g_strfreev(ppCoordinates); +-} +- + GdkRectangle LOKDocView_Impl::payloadToRectangle(const char* pPayload) + { + GdkRectangle aRet; +@@ -1033,7 +1036,7 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback) + break; + case LOK_CALLBACK_DOCUMENT_SIZE_CHANGED: + { +- LOKDocView_Impl::payloadToSize(pCallback->m_aPayload.c_str(), m_nDocumentWidthTwips, m_nDocumentHeightTwips); ++ payloadToSize(pCallback->m_aPayload.c_str(), m_nDocumentWidthTwips, m_nDocumentHeightTwips); + } + break; + case LOK_CALLBACK_SET_PART: +-- +2.12.0 + diff --git a/SOURCES/0006-Resolves-rhbz-144437-make-gnome-documents-not-crash-.patch b/SOURCES/0006-Resolves-rhbz-144437-make-gnome-documents-not-crash-.patch new file mode 100644 index 0000000..2e6dc90 --- /dev/null +++ b/SOURCES/0006-Resolves-rhbz-144437-make-gnome-documents-not-crash-.patch @@ -0,0 +1,206 @@ +From baa91265d38ac44294b93f8ce47162454fbeb6d4 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= +Date: Mon, 8 May 2017 15:26:22 +0100 +Subject: [PATCH] Resolves: rhbz#144437 make gnome-documents not crash the + whole time + +accept that once initted that LibreOffice cannot be deinitted and reinited +(without lots of work), but allow the main loop to quit and restart so LOKs +thread can run and exit successfully, new LOK connections will restart the main +loop. + +The buckets of global state continues to be valid the whole time this way + +Change-Id: Ide54c0df2ce4065f7c192ae8c2cedfaaa2b58d72 +--- + desktop/source/app/app.cxx | 2 +- + desktop/source/app/officeipcthread.cxx | 11 ++++++++--- + desktop/source/app/officeipcthread.hxx | 2 +- + desktop/source/lib/init.cxx | 6 ++++++ + framework/source/services/desktop.cxx | 10 ++++++++-- + libreofficekit/source/gtk/lokdocview.cxx | 6 ++++++ + vcl/source/app/svapp.cxx | 1 + + vcl/source/app/svmain.cxx | 8 ++++++++ + 8 files changed, 39 insertions(+), 7 deletions(-) + +diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx +index 5042752..372f605 100644 +--- a/desktop/source/app/app.cxx ++++ b/desktop/source/app/app.cxx +@@ -1890,7 +1890,7 @@ IMPL_LINK_NOARG(Desktop, OpenClients_Impl) + try { + OpenClients(); + +- OfficeIPCThread::SetReady(); ++ OfficeIPCThread::SetReady(true); + + CloseSplashScreen(); + CheckFirstRun( ); +diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx +index cb6ad0b..e65e935 100644 +--- a/desktop/source/app/officeipcthread.cxx ++++ b/desktop/source/app/officeipcthread.cxx +@@ -646,13 +646,15 @@ void OfficeIPCThread::DisableOfficeIPCThread(bool join) + // release mutex to avoid deadlocks + aMutex.clear(); + +- OfficeIPCThread::SetReady(pOfficeIPCThread); ++ OfficeIPCThread::SetReady(true, pOfficeIPCThread); + + // exit gracefully and join + if (join) + { + pOfficeIPCThread->join(); + } ++ ++ OfficeIPCThread::SetReady(false, pOfficeIPCThread); + } + } + +@@ -675,14 +677,17 @@ OfficeIPCThread::~OfficeIPCThread() + pGlobalOfficeIPCThread.clear(); + } + +-void OfficeIPCThread::SetReady( ++void OfficeIPCThread::SetReady(bool bIsReady, + rtl::Reference< OfficeIPCThread > const & pThread) + { + rtl::Reference< OfficeIPCThread > const & t( + pThread.is() ? pThread : pGlobalOfficeIPCThread); + if (t.is()) + { +- t->cReady.set(); ++ if (bIsReady) ++ t->cReady.set(); ++ else ++ t->cReady.reset(); + } + } + +diff --git a/desktop/source/app/officeipcthread.hxx b/desktop/source/app/officeipcthread.hxx +index e81f57a..f23eff2 100644 +--- a/desktop/source/app/officeipcthread.hxx ++++ b/desktop/source/app/officeipcthread.hxx +@@ -115,7 +115,7 @@ class OfficeIPCThread : public salhelper::Thread + static Status EnableOfficeIPCThread(); + static void DisableOfficeIPCThread(bool join = true); + // start dispatching events... +- static void SetReady( ++ static void SetReady(bool bIsReady, + rtl::Reference< OfficeIPCThread > const & pThread = + rtl::Reference< OfficeIPCThread >()); + static void WaitForReady( +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 184d777..2619539 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -1697,7 +1697,12 @@ static void lo_startmain(void*) + { + osl_setThreadName("lo_startmain"); + ++ if (comphelper::SolarMutex::get()) ++ Application::GetSolarMutex().tryToAcquire(); ++ + soffice_main(); ++ ++ Application::ReleaseSolarMutex(); + } + + static bool bInitialized = false; +@@ -1799,6 +1804,7 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char + SAL_INFO("lok", "Enabling OfficeIPCThread"); + OfficeIPCThread::EnableOfficeIPCThread(); + SAL_INFO("lok", "Starting soffice_main"); ++ OfficeIPCThread::SetReady(false); + pLib->maThread = osl_createThread(lo_startmain, NULL); + SAL_INFO("lok", "Waiting for OfficeIPCThread"); + OfficeIPCThread::WaitForReady(); +diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx +index 24b9761..c7dbaca 100644 +--- a/framework/source/services/desktop.cxx ++++ b/framework/source/services/desktop.cxx +@@ -59,6 +59,7 @@ + #include + + #include ++#include + #include + #include + +@@ -231,8 +232,13 @@ sal_Bool SAL_CALL Desktop::terminate() + + // try to close all open frames. + // Allow using of any UI ... because Desktop.terminate() was designed as UI functionality in the past. +- bool bAllowUI = true; +- bool bFramesClosed = impl_closeFrames(bAllowUI); ++ bool bRestartableMainLoop = comphelper::LibreOfficeKit::isActive(); ++ bool bFramesClosed = impl_closeFrames(!bRestartableMainLoop); ++ if (bRestartableMainLoop) ++ { ++ Application::Quit(); ++ return true; ++ } + if ( ! bFramesClosed ) + { + impl_sendCancelTerminationEvent(lCalledTerminationListener); +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 7d1ec01..92cf6b3 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -2051,9 +2051,15 @@ static void lok_doc_view_destroy (GtkWidget* widget) + LOKDocViewPrivate& priv = getPrivate(pDocView); + + if (priv->m_pDocument) ++ { + priv->m_pDocument->pClass->destroy (priv->m_pDocument); ++ priv->m_pDocument = nullptr; ++ } + if (priv->m_pOffice) ++ { + priv->m_pOffice->pClass->destroy (priv->m_pOffice); ++ priv->m_pOffice = nullptr; ++ } + + GTK_WIDGET_CLASS (lok_doc_view_parent_class)->destroy (widget); + } +diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx +index 302c4a7..2104243 100644 +--- a/vcl/source/app/svapp.cxx ++++ b/vcl/source/app/svapp.cxx +@@ -331,6 +331,7 @@ void Application::Execute() + { + ImplSVData* pSVData = ImplGetSVData(); + pSVData->maAppData.mbInAppExecute = true; ++ pSVData->maAppData.mbAppQuit = false; + + while ( !pSVData->maAppData.mbAppQuit ) + Application::Yield(); +diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx +index f6d4e25..16977d3 100644 +--- a/vcl/source/app/svmain.cxx ++++ b/vcl/source/app/svmain.cxx +@@ -28,6 +28,7 @@ + #include "tools/resmgr.hxx" + + #include "comphelper/processfactory.hxx" ++#include "comphelper/lok.hxx" + + #include "unotools/syslocaleoptions.hxx" + #include "vcl/svapp.hxx" +@@ -343,6 +344,13 @@ VCLUnoWrapperDeleter::disposing(lang::EventObject const& /* rSource */) + + void DeInitVCL() + { ++ //rhbz#1444437, when using LibreOffice like a library you can't realistically ++ //tear everything down and recreate them on the next call, there's too many ++ //(c++) singletons that point to stuff that gets deleted during shutdown ++ //which won't be recreated on restart. ++ if (comphelper::LibreOfficeKit::isActive()) ++ return; ++ + ImplSVData* pSVData = ImplGetSVData(); + pSVData->mbDeInit = true; + +-- +1.8.3.1 + diff --git a/SOURCES/0006-loplugin-cstylecast-deal-with-those-that-are-technic.patch b/SOURCES/0006-loplugin-cstylecast-deal-with-those-that-are-technic.patch new file mode 100644 index 0000000..db93032 --- /dev/null +++ b/SOURCES/0006-loplugin-cstylecast-deal-with-those-that-are-technic.patch @@ -0,0 +1,40 @@ +From e9e2deeffc6fba956f829e1f2676d48c3e870bcc Mon Sep 17 00:00:00 2001 +From: Stephan Bergmann +Date: Tue, 2 Jun 2015 11:26:10 +0200 +Subject: [PATCH 006/398] loplugin:cstylecast: deal with those that are + (technically) const_cast + +Change-Id: Id57c9599a454e1156a6a248ebb143a88f6d78425 +(cherry picked from commit a9ae0c394b7b763e2c0090defc6d21cc76b1ab87) +--- + desktop/source/lib/init.cxx | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 88cbcbd8d285..39a1fbffc533 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -440,16 +440,16 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha + switch (doc_getDocumentType(pThis)) + { + case LOK_DOCTYPE_SPREADSHEET: +- pMap = (const ExtensionMap*) aCalcExtensionMap; ++ pMap = aCalcExtensionMap; + break; + case LOK_DOCTYPE_PRESENTATION: +- pMap = (const ExtensionMap*) aImpressExtensionMap; ++ pMap = aImpressExtensionMap; + break; + case LOK_DOCTYPE_DRAWING: +- pMap = (const ExtensionMap*) aDrawExtensionMap; ++ pMap = aDrawExtensionMap; + break; + case LOK_DOCTYPE_TEXT: +- pMap = (const ExtensionMap*) aWriterExtensionMap; ++ pMap = aWriterExtensionMap; + break; + case LOK_DOCTYPE_OTHER: + default: +-- +2.12.0 + diff --git a/SOURCES/0007-fsanitize-float-divide-by-zero.patch b/SOURCES/0007-fsanitize-float-divide-by-zero.patch new file mode 100644 index 0000000..022367d --- /dev/null +++ b/SOURCES/0007-fsanitize-float-divide-by-zero.patch @@ -0,0 +1,65 @@ +From 17c7e35232d04b5b32c29b995459e83a4b3a2319 Mon Sep 17 00:00:00 2001 +From: Stephan Bergmann +Date: Wed, 3 Jun 2015 08:11:06 +0200 +Subject: [PATCH 007/398] -fsanitize=float-divide-by-zero + +...happens at least during CppunitTest_sd_tiledrendering that +aCurrTextSize.Height() is zero: + + SdrTextObj::ImpAutoFitText(SdrOutliner&, Size const&, bool) svx/source/svdraw/svdotext.cxx:1312:49 + SdrTextObj::ImpAutoFitText(SdrOutliner&) const svx/source/svdraw/svdotext.cxx:1290:5 + SdrTextObj::BegTextEdit(SdrOutliner&) svx/source/svdraw/svdotxed.cxx:103:9 + SdrObjEditView::SdrBeginTextEdit(SdrObject*, SdrPageView*, vcl::Window*, bool, SdrOutliner*, OutlinerView*, bool, bool, bool) svx/source/svdraw/svdedxv.cxx:635:12 + sd::View::SdrBeginTextEdit(SdrObject*, SdrPageView*, vcl::Window*, bool, SdrOutliner*, OutlinerView*, bool, bool, bool) sd/source/ui/view/sdview.cxx:704:20 + sd::Outliner::EnterEditMode(bool) sd/source/ui/view/Outliner.cxx:1299:9 + sd::Outliner::PrepareSearchAndReplace() sd/source/ui/view/Outliner.cxx:1181:9 + sd::Outliner::ProvideNextTextObject() sd/source/ui/view/Outliner.cxx:973:29 + sd::Outliner::SearchAndReplaceOnce() sd/source/ui/view/Outliner.cxx:674:17 + sd::Outliner::StartSearchAndReplace(SvxSearchItem const*) sd/source/ui/view/Outliner.cxx:496:28 + sd::FuSearch::SearchAndReplace(SvxSearchItem const*) sd/source/ui/func/fusearch.cxx:132:33 + sd::DrawDocShell::Execute(SfxRequest&) sd/source/ui/docshell/docshel3.cxx:222:21 + SfxStubDrawDocShellExecute(SfxShell*, SfxRequest&) workdir/SdiTarget/sd/sdi/sdslots.hxx:17034:1 + SfxShell::CallExec(void (*)(SfxShell*, SfxRequest&), SfxRequest&) include/sfx2/shell.hxx:210:35 + SfxDispatcher::Call_Impl(SfxShell&, SfxSlot const&, SfxRequest&, bool) sfx2/source/control/dispatch.cxx:257:13 + SfxDispatcher::_Execute(SfxShell&, SfxSlot const&, SfxRequest&, SfxCallMode) sfx2/source/control/dispatch.cxx:847:9 + SfxDispatcher::Execute(unsigned short, SfxCallMode, SfxItemSet*, SfxItemSet*, unsigned short) sfx2/source/control/dispatch.cxx:916:9 + SfxDispatchController_Impl::dispatch(com::sun::star::util::URL const&, com::sun::star::uno::Sequence const&, com::sun::star::uno::Reference const&) sfx2/source/control/unoctitm.cxx:823:37 + SfxOfficeDispatch::dispatch(com::sun::star::util::URL const&, com::sun::star::uno::Sequence const&) sfx2/source/control/unoctitm.cxx:359:9 + non-virtual thunk to SfxOfficeDispatch::dispatch(com::sun::star::util::URL const&, com::sun::star::uno::Sequence const&) sfx2/source/control/unoctitm.cxx:343:34 + comphelper::dispatchCommand(rtl::OUString const&, com::sun::star::uno::Sequence const&) comphelper/source/misc/dispatchcommand.cxx:57:5 + lcl_search(rtl::OUString const&) sd/qa/unit/tiledrendering/tiledrendering.cxx:338:5 + SdTiledRenderingTest::testSearch() sd/qa/unit/tiledrendering/tiledrendering.cxx:361:5 + ... + +Change-Id: I38ab71c5f4024b2d7270a4f6c2aeb4ef502d08f5 +(cherry picked from commit bf93b3d1a4b624c3b58e6429899c47fa7cad6ede) +--- + svx/source/svdraw/svdotext.cxx | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx +index 47696fd28204..104f48bee47d 100644 +--- a/svx/source/svdraw/svdotext.cxx ++++ b/svx/source/svdraw/svdotext.cxx +@@ -1307,9 +1307,16 @@ void SdrTextObj::ImpAutoFitText( SdrOutliner& rOutliner, const Size& rTextSize, + const Size aCurrTextSize = rOutliner.CalcTextSizeNTP(); + double fFactor(1.0); + if( bIsVerticalWriting ) +- fFactor = double(rTextSize.Width())/aCurrTextSize.Width(); +- else ++ { ++ if (aCurrTextSize.Width() != 0) ++ { ++ fFactor = double(rTextSize.Width())/aCurrTextSize.Width(); ++ } ++ } ++ else if (aCurrTextSize.Height() != 0) ++ { + fFactor = double(rTextSize.Height())/aCurrTextSize.Height(); ++ } + // fFactor scales in both x and y directions + // - this is fine for bulleted words + // - but it scales too much for a long paragraph +-- +2.12.0 + diff --git a/SOURCES/0008-LOK-fix-the-rectangle-format-mentioned-in-documentat.patch b/SOURCES/0008-LOK-fix-the-rectangle-format-mentioned-in-documentat.patch new file mode 100644 index 0000000..a6c3f33 --- /dev/null +++ b/SOURCES/0008-LOK-fix-the-rectangle-format-mentioned-in-documentat.patch @@ -0,0 +1,28 @@ +From 59ba6f6da9314d57d7c91a20c9ca6e7fc061780b Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Fri, 5 Jun 2015 16:36:14 +0530 +Subject: [PATCH 008/398] LOK: fix the rectangle format mentioned in + documentation/comment + +Change-Id: I41bf3a21b5da9fc8155bbe6eb0f86078f90f6647 +(cherry picked from commit 107d31165479d602fbc644aaf41d213e58e00389) +--- + include/LibreOfficeKit/LibreOfficeKitEnums.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h +index 66237e4512cf..bdcc2f0c256f 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h ++++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h +@@ -39,7 +39,7 @@ typedef enum + * Any tiles which are over the rectangle described in the payload are no + * longer valid. + * +- * Rectangle format: "width, height, x, y", where all numbers are document ++ * Rectangle format: "x, y, width, height", where all numbers are document + * coordinates, in twips. When all tiles are supposed to be dropped, the + * format is the "EMPTY" string. + */ +-- +2.12.0 + diff --git a/SOURCES/0009-loplugin-cstylecast-deal-with-remaining-pointer-cast.patch b/SOURCES/0009-loplugin-cstylecast-deal-with-remaining-pointer-cast.patch new file mode 100644 index 0000000..b167588 --- /dev/null +++ b/SOURCES/0009-loplugin-cstylecast-deal-with-remaining-pointer-cast.patch @@ -0,0 +1,28 @@ +From 9eb895e01e53a2f240067b8a85b4b51dcd48d529 Mon Sep 17 00:00:00 2001 +From: Stephan Bergmann +Date: Mon, 8 Jun 2015 16:26:12 +0200 +Subject: [PATCH 009/398] loplugin:cstylecast: deal with remaining pointer + casts + +Change-Id: I6fcd79094bb09f9068a4182eaace794b19633f4c +(cherry picked from commit b2f490e8627fd31d8f5e48708a898c9f997a4676) +--- + libreofficekit/source/gtk/lokdocview.cxx | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 24f9d04a9024..d18c3c27a70e 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -1196,7 +1196,7 @@ SAL_DLLPUBLIC_EXPORT guint lok_docview_get_type() + lok_docview_init, + NULL, + NULL, +- (GtkClassInitFunc) NULL ++ nullptr + }; + + lok_docview_type = gtk_type_unique( gtk_scrolled_window_get_type(), &lok_docview_info ); +-- +2.12.0 + diff --git a/SOURCES/0010-lokdocview-add-width-and-height-to-the-visible-recta.patch b/SOURCES/0010-lokdocview-add-width-and-height-to-the-visible-recta.patch new file mode 100644 index 0000000..10ba9b5 --- /dev/null +++ b/SOURCES/0010-lokdocview-add-width-and-height-to-the-visible-recta.patch @@ -0,0 +1,30 @@ +From 61e6551def6ed87458164aebba5f4401575d9372 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Tue, 2 Jun 2015 18:26:12 +0530 +Subject: [PATCH 010/398] lokdocview: add width and height to the visible + rectangle + +Change-Id: I64212113750893f33f8a859ba52ecd8815a820f4 +(cherry picked from commit d2ea6d817d116f4fe4a31e76fe64d88c8121b1c2) +--- + libreofficekit/source/gtk/lokdocview.cxx | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index d18c3c27a70e..8fa351add6a9 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -1323,8 +1323,10 @@ SAL_DLLPUBLIC_EXPORT void lok_docview_get_visarea(LOKDocView* pThis, GdkRectangl + { + GtkAdjustment* pHAdjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(pThis)); + pArea->x = pThis->m_pImpl->pixelToTwip(gtk_adjustment_get_value(pHAdjustment)); ++ pArea->width = pThis->m_pImpl->pixelToTwip(gtk_adjustment_get_page_size(pHAdjustment)); + GtkAdjustment* pVAdjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(pThis)); + pArea->y = pThis->m_pImpl->pixelToTwip(gtk_adjustment_get_value(pVAdjustment)); ++ pArea->height = pThis->m_pImpl->pixelToTwip(gtk_adjustment_get_page_size(pVAdjustment)); + } + + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +-- +2.12.0 + diff --git a/SOURCES/0011-lokdocview-use-GtkDrawingArea-for-drawing-tiles.patch b/SOURCES/0011-lokdocview-use-GtkDrawingArea-for-drawing-tiles.patch new file mode 100644 index 0000000..559f1c1 --- /dev/null +++ b/SOURCES/0011-lokdocview-use-GtkDrawingArea-for-drawing-tiles.patch @@ -0,0 +1,165 @@ +From 0750e69cc4483cbcf22789d25d4518396e13fc13 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Wed, 3 Jun 2015 20:52:49 +0530 +Subject: [PATCH 011/398] lokdocview: use GtkDrawingArea for drawing tiles + +Change-Id: I1a3d8a9229f416418f0f3e9c720b78af09b35978 +(cherry picked from commit a13d4671bf1f557b3104e745277554ed11b3e6da) +--- + libreofficekit/source/gtk/lokdocview.cxx | 77 +++++++++++++------------------- + 1 file changed, 30 insertions(+), 47 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 8fa351add6a9..c487ac8dd906 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -65,6 +65,9 @@ struct LOKDocView_Impl + GtkWidget* m_pEventBox; + GtkWidget* m_pTable; + GtkWidget** m_pCanvas; ++ GtkWidget *darea; ++ ++ TileBuffer *mTileBuffer; + + float m_fZoom; + +@@ -140,6 +143,8 @@ struct LOKDocView_Impl + ~LOKDocView_Impl(); + /// Connected to the destroy signal of LOKDocView, deletes its LOKDocView_Impl. + static void destroy(LOKDocView* pDocView, gpointer pData); ++ /// Connected to the expose-event of the GtkDrawingArea ++ static void on_exposed(GtkWidget *widget, GdkEvent *event, gpointer user_data); + /// Converts from screen pixels to document coordinates. + float pixelToTwip(float fInput); + /// Converts from document coordinates to screen pixels. +@@ -258,6 +263,7 @@ LOKDocView_Impl::CallbackData::CallbackData(int nType, const std::string& rPaylo + LOKDocView_Impl::LOKDocView_Impl(LOKDocView* pDocView) + : m_pDocView(pDocView), + m_pEventBox(gtk_event_box_new()), ++ darea(gtk_drawing_area_new()), + m_pTable(0), + m_pCanvas(0), + m_fZoom(1), +@@ -307,6 +313,12 @@ void LOKDocView_Impl::destroy(LOKDocView* pDocView, gpointer /*pData*/) + delete pDocView->m_pImpl; + } + ++void LOKDocView_Impl::on_exposed(GtkWidget *widget, GdkEvent *event, gpointer userdata) ++{ ++ LOKDocView *pDocView = LOK_DOCVIEW (userdata); ++ pDocView->m_pImpl->renderDocument(0); ++} ++ + float LOKDocView_Impl::pixelToTwip(float fInput) + { + return (fInput / DPI / m_fZoom) * 1440.0f; +@@ -771,40 +783,17 @@ void LOKDocView_Impl::renderDocument(GdkRectangle* pPartial) + { + const int nTileSizePixels = 256; + ++ GdkRectangle visibleArea; ++ lok_docview_get_visarea (m_pDocView, &visibleArea); ++ + long nDocumentWidthPixels = twipToPixel(m_nDocumentWidthTwips); + long nDocumentHeightPixels = twipToPixel(m_nDocumentHeightTwips); + // Total number of rows / columns in this document. + guint nRows = ceil((double)nDocumentHeightPixels / nTileSizePixels); + guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); + +- // Set up our table and the tile pointers. +- if (!m_pTable) +- pPartial = 0; +- if (pPartial) +- { +- // Same as nRows / nColumns, but from the previous renderDocument() call. +- guint nOldRows, nOldColumns; +- +-#if GTK_CHECK_VERSION(2,22,0) +- gtk_table_get_size(GTK_TABLE(m_pTable), &nOldRows, &nOldColumns); +- if (nOldRows != nRows || nOldColumns != nColumns) +- // Can't do partial rendering, document size changed. +- pPartial = 0; +-#else +- pPartial = 0; +-#endif +- } +- if (!pPartial) +- { +- if (m_pTable) +- gtk_container_remove(GTK_CONTAINER(m_pEventBox), m_pTable); +- m_pTable = gtk_table_new(nRows, nColumns, FALSE); +- gtk_container_add(GTK_CONTAINER(m_pEventBox), m_pTable); +- gtk_widget_show(m_pTable); +- if (m_pCanvas) +- g_free(m_pCanvas); +- m_pCanvas = static_cast(g_malloc0(sizeof(GtkWidget*) * nRows * nColumns)); +- } ++ gtk_widget_set_size_request(darea, nDocumentWidthPixels, nDocumentHeightPixels); ++ cairo_t *pcairo = gdk_cairo_create(darea->window); + + // Render the tiles. + for (guint nRow = 0; nRow < nRows; ++nRow) +@@ -830,7 +819,10 @@ void LOKDocView_Impl::renderDocument(GdkRectangle* pPartial) + aTileRectangleTwips.width = pixelToTwip(aTileRectanglePixels.width); + aTileRectangleTwips.height = pixelToTwip(aTileRectanglePixels.height); + if (pPartial && !gdk_rectangle_intersect(pPartial, &aTileRectangleTwips, 0)) +- bPaint = false; ++ bPaint = false; ++ ++ if (!gdk_rectangle_intersect(&visibleArea, &aTileRectangleTwips, 0)) ++ bPaint = false; + + if (bPaint) + { +@@ -849,21 +841,16 @@ void LOKDocView_Impl::renderDocument(GdkRectangle* pPartial) + // Size of the tile, depends on the zoom factor and the tile position only. + aTileRectangleTwips.width, aTileRectangleTwips.height); + +- if (m_pCanvas[nTile]) +- gtk_widget_destroy(GTK_WIDGET(m_pCanvas[nTile])); +- m_pCanvas[nTile] = gtk_image_new(); +- gtk_image_set_from_pixbuf(GTK_IMAGE(m_pCanvas[nTile]), pPixBuf); +- g_object_unref(G_OBJECT(pPixBuf)); +- gtk_widget_show(m_pCanvas[nTile]); +- gtk_table_attach(GTK_TABLE(m_pTable), +- m_pCanvas[nTile], +- nColumn, nColumn + 1, nRow, nRow + 1, +- GTK_SHRINK, GTK_SHRINK, 0, 0); ++ gdk_cairo_set_source_pixbuf (pcairo, pPixBuf, twipToPixel(aTileRectangleTwips.x), twipToPixel(aTileRectangleTwips.y)); ++ cairo_paint(pcairo); + } + } + } ++ ++ cairo_destroy(pcairo); + } + ++ + GdkRectangle LOKDocView_Impl::payloadToRectangle(const char* pPayload) + { + GdkRectangle aRet; +@@ -1167,17 +1154,13 @@ static void lok_docview_init( GTypeInstance* pInstance, gpointer ) + + pDocView->m_pImpl = new LOKDocView_Impl(pDocView); + gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW(pDocView), +- pDocView->m_pImpl->m_pEventBox ); +- +- gtk_widget_set_events(pDocView->m_pImpl->m_pEventBox, GDK_BUTTON_PRESS_MASK); // So that drag doesn't try to move the whole window. +- gtk_signal_connect(GTK_OBJECT(pDocView->m_pImpl->m_pEventBox), "button-press-event", GTK_SIGNAL_FUNC(LOKDocView_Impl::signalButton), pDocView); +- gtk_signal_connect(GTK_OBJECT(pDocView->m_pImpl->m_pEventBox), "button-release-event", GTK_SIGNAL_FUNC(LOKDocView_Impl::signalButton), pDocView); +- gtk_signal_connect(GTK_OBJECT(pDocView->m_pImpl->m_pEventBox), "motion-notify-event", GTK_SIGNAL_FUNC(LOKDocView_Impl::signalMotion), pDocView); ++ pDocView->m_pImpl->darea ); + +- gtk_widget_show( pDocView->m_pImpl->m_pEventBox ); ++ g_signal_connect(GTK_OBJECT(pDocView->m_pImpl->darea), ++ "expose-event", ++ GTK_SIGNAL_FUNC(LOKDocView_Impl::on_exposed), pDocView); + + gtk_signal_connect(GTK_OBJECT(pDocView), "destroy", GTK_SIGNAL_FUNC(LOKDocView_Impl::destroy), 0); +- g_signal_connect_after(pDocView->m_pImpl->m_pEventBox, "expose-event", G_CALLBACK(LOKDocView_Impl::renderOverlay), pDocView); + } + + SAL_DLLPUBLIC_EXPORT guint lok_docview_get_type() +-- +2.12.0 + diff --git a/SOURCES/0012-Add-tile-buffering-support.patch b/SOURCES/0012-Add-tile-buffering-support.patch new file mode 100644 index 0000000..57023ed --- /dev/null +++ b/SOURCES/0012-Add-tile-buffering-support.patch @@ -0,0 +1,407 @@ +From 2b35ac76de22c9aa23c2245e49fc9e0c823b739c Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Thu, 4 Jun 2015 00:06:46 +0530 +Subject: [PATCH 012/398] Add tile buffering support + +The TileBuffer class now manages all the tiles. The tile rendering calls +to LO core is also managed by this class. + +Change-Id: Ic667a93dcf1c097e0601c0496e8a083c4742e8cb +(cherry picked from commit 42dc4f3ed8b7b41597dd9851c31dee4d0e352f46) +--- + libreofficekit/Library_libreofficekitgtk.mk | 1 + + libreofficekit/source/gtk/lokdocview.cxx | 76 ++++++++++++------------ + libreofficekit/source/gtk/tilebuffer.cxx | 90 +++++++++++++++++++++++++++++ + libreofficekit/source/gtk/tilebuffer.hxx | 78 +++++++++++++++++++++++++ + 4 files changed, 209 insertions(+), 36 deletions(-) + create mode 100644 libreofficekit/source/gtk/tilebuffer.cxx + create mode 100644 libreofficekit/source/gtk/tilebuffer.hxx + +diff --git a/libreofficekit/Library_libreofficekitgtk.mk b/libreofficekit/Library_libreofficekitgtk.mk +index ff800d0f1d96..92409537f4e8 100644 +--- a/libreofficekit/Library_libreofficekitgtk.mk ++++ b/libreofficekit/Library_libreofficekitgtk.mk +@@ -17,6 +17,7 @@ $(eval $(call gb_Library_use_externals,libreofficekitgtk,\ + + $(eval $(call gb_Library_add_exception_objects,libreofficekitgtk,\ + libreofficekit/source/gtk/lokdocview \ ++ libreofficekit/source/gtk/tilebuffer \ + )) + + ifeq ($(OS),LINUX) +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index c487ac8dd906..413054cf873c 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -22,6 +22,8 @@ + #include + #include + ++#include "tilebuffer.hxx" ++ + #if !GLIB_CHECK_VERSION(2,32,0) + #define G_SOURCE_REMOVE FALSE + #define G_SOURCE_CONTINUE TRUE +@@ -37,6 +39,8 @@ + + // We know that VirtualDevices use a DPI of 96. + static const int DPI = 96; ++// Lets use a square of side 256 pixels. ++static const int nTileSizePixels = 256; + + namespace { + +@@ -62,12 +66,8 @@ void payloadToSize(const char* pPayload, long& rWidth, long& rHeight) + struct LOKDocView_Impl + { + LOKDocView* m_pDocView; +- GtkWidget* m_pEventBox; +- GtkWidget* m_pTable; +- GtkWidget** m_pCanvas; +- GtkWidget *darea; +- +- TileBuffer *mTileBuffer; ++ GtkWidget *m_pDrawingArea; ++ TileBuffer *m_pTileBuffer; + + float m_fZoom; + +@@ -262,10 +262,7 @@ LOKDocView_Impl::CallbackData::CallbackData(int nType, const std::string& rPaylo + + LOKDocView_Impl::LOKDocView_Impl(LOKDocView* pDocView) + : m_pDocView(pDocView), +- m_pEventBox(gtk_event_box_new()), +- darea(gtk_drawing_area_new()), +- m_pTable(0), +- m_pCanvas(0), ++ m_pDrawingArea(gtk_drawing_area_new()), + m_fZoom(1), + m_pOffice(0), + m_pDocument(0), +@@ -313,7 +310,7 @@ void LOKDocView_Impl::destroy(LOKDocView* pDocView, gpointer /*pData*/) + delete pDocView->m_pImpl; + } + +-void LOKDocView_Impl::on_exposed(GtkWidget *widget, GdkEvent *event, gpointer userdata) ++void LOKDocView_Impl::on_exposed(GtkWidget* /*widget*/, GdkEvent* /*event*/, gpointer userdata) + { + LOKDocView *pDocView = LOK_DOCVIEW (userdata); + pDocView->m_pImpl->renderDocument(0); +@@ -773,7 +770,7 @@ gboolean LOKDocView_Impl::handleTimeoutImpl() + m_bCursorOverlayVisible = false; + else + m_bCursorOverlayVisible = true; +- gtk_widget_queue_draw(GTK_WIDGET(m_pEventBox)); ++ gtk_widget_queue_draw(GTK_WIDGET(m_pDrawingArea)); + } + + return G_SOURCE_CONTINUE; +@@ -781,8 +778,6 @@ gboolean LOKDocView_Impl::handleTimeoutImpl() + + void LOKDocView_Impl::renderDocument(GdkRectangle* pPartial) + { +- const int nTileSizePixels = 256; +- + GdkRectangle visibleArea; + lok_docview_get_visarea (m_pDocView, &visibleArea); + +@@ -792,8 +787,8 @@ void LOKDocView_Impl::renderDocument(GdkRectangle* pPartial) + guint nRows = ceil((double)nDocumentHeightPixels / nTileSizePixels); + guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); + +- gtk_widget_set_size_request(darea, nDocumentWidthPixels, nDocumentHeightPixels); +- cairo_t *pcairo = gdk_cairo_create(darea->window); ++ gtk_widget_set_size_request(m_pDrawingArea, nDocumentWidthPixels, nDocumentHeightPixels); ++ cairo_t *pcairo = gdk_cairo_create(m_pDrawingArea->window); + + // Render the tiles. + for (guint nRow = 0; nRow < nRows; ++nRow) +@@ -826,20 +821,10 @@ void LOKDocView_Impl::renderDocument(GdkRectangle* pPartial) + + if (bPaint) + { +- // Index of the current tile. +- guint nTile = nRow * nColumns + nColumn; +- +- GdkPixbuf* pPixBuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, aTileRectanglePixels.width, aTileRectanglePixels.height); +- unsigned char* pBuffer = gdk_pixbuf_get_pixels(pPixBuf); +- g_info("renderDocument: paintTile(%d, %d)", nRow, nColumn); +- m_pDocument->pClass->paintTile(m_pDocument, +- // Buffer and its size, depends on the position only. +- pBuffer, +- aTileRectanglePixels.width, aTileRectanglePixels.height, +- // Position of the tile. +- aTileRectangleTwips.x, aTileRectangleTwips.y, +- // Size of the tile, depends on the zoom factor and the tile position only. +- aTileRectangleTwips.width, aTileRectangleTwips.height); ++ g_info("gettile: (%d %d)", nRow, nColumn); ++ ++ Tile& currentTile = m_pTileBuffer->tile_buffer_get_tile(nRow, nColumn); ++ GdkPixbuf* pPixBuf = currentTile.tile_get_buffer(); + + gdk_cairo_set_source_pixbuf (pcairo, pPixBuf, twipToPixel(aTileRectangleTwips.x), twipToPixel(aTileRectangleTwips.y)); + cairo_paint(pcairo); +@@ -959,7 +944,7 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback) + { + m_aVisibleCursor = LOKDocView_Impl::payloadToRectangle(pCallback->m_aPayload.c_str()); + m_bCursorOverlayVisible = true; +- gtk_widget_queue_draw(GTK_WIDGET(m_pEventBox)); ++ gtk_widget_queue_draw(GTK_WIDGET(m_pDrawingArea)); + } + break; + case LOK_CALLBACK_TEXT_SELECTION: +@@ -976,7 +961,7 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback) + } + else + memset(&m_aHandleMiddleRect, 0, sizeof(m_aHandleMiddleRect)); +- gtk_widget_queue_draw(GTK_WIDGET(m_pEventBox)); ++ gtk_widget_queue_draw(GTK_WIDGET(m_pDrawingArea)); + } + break; + case LOK_CALLBACK_TEXT_SELECTION_START: +@@ -1000,7 +985,7 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback) + m_aGraphicSelection = LOKDocView_Impl::payloadToRectangle(pCallback->m_aPayload.c_str()); + else + memset(&m_aGraphicSelection, 0, sizeof(m_aGraphicSelection)); +- gtk_widget_queue_draw(GTK_WIDGET(m_pEventBox)); ++ gtk_widget_queue_draw(GTK_WIDGET(m_pDrawingArea)); + } + break; + case LOK_CALLBACK_HYPERLINK_CLICKED: +@@ -1154,9 +1139,9 @@ static void lok_docview_init( GTypeInstance* pInstance, gpointer ) + + pDocView->m_pImpl = new LOKDocView_Impl(pDocView); + gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW(pDocView), +- pDocView->m_pImpl->darea ); ++ pDocView->m_pImpl->m_pDrawingArea ); + +- g_signal_connect(GTK_OBJECT(pDocView->m_pImpl->darea), ++ g_signal_connect(GTK_OBJECT(pDocView->m_pImpl->m_pDrawingArea), + "expose-event", + GTK_SIGNAL_FUNC(LOKDocView_Impl::on_exposed), pDocView); + +@@ -1218,6 +1203,18 @@ SAL_DLLPUBLIC_EXPORT gboolean lok_docview_open_document( LOKDocView* pDocView, c + pDocView->m_pImpl->m_pDocument->pClass->registerCallback(pDocView->m_pImpl->m_pDocument, &LOKDocView_Impl::callbackWorker, pDocView); + pDocView->m_pImpl->m_pDocument->pClass->getDocumentSize(pDocView->m_pImpl->m_pDocument, &pDocView->m_pImpl->m_nDocumentWidthTwips, &pDocView->m_pImpl->m_nDocumentHeightTwips); + g_timeout_add(600, &LOKDocView_Impl::handleTimeout, pDocView); ++ ++ long nDocumentWidthTwips = pDocView->m_pImpl->m_nDocumentWidthTwips; ++ long nDocumentHeightTwips = pDocView->m_pImpl->m_nDocumentHeightTwips; ++ long nDocumentWidthPixels = pDocView->m_pImpl->twipToPixel(nDocumentWidthTwips); ++ long nDocumentHeightPixels = pDocView->m_pImpl->twipToPixel(nDocumentHeightTwips); ++ // Total number of rows / columns in this document. ++ guint nRows = ceil((double)nDocumentHeightPixels / nTileSizePixels); ++ guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); ++ pDocView->m_pImpl->m_pTileBuffer = new TileBuffer(pDocView->m_pImpl->m_pDocument, ++ nTileSizePixels, ++ nRows, ++ nColumns); + pDocView->m_pImpl->renderDocument(0); + } + +@@ -1232,6 +1229,13 @@ SAL_DLLPUBLIC_EXPORT LibreOfficeKitDocument* lok_docview_get_document(LOKDocView + SAL_DLLPUBLIC_EXPORT void lok_docview_set_zoom ( LOKDocView* pDocView, float fZoom ) + { + pDocView->m_pImpl->m_fZoom = fZoom; ++ long nDocumentWidthPixels = pDocView->m_pImpl->twipToPixel(pDocView->m_pImpl->m_nDocumentWidthTwips); ++ long nDocumentHeightPixels = pDocView->m_pImpl->twipToPixel(pDocView->m_pImpl->m_nDocumentHeightTwips); ++ // Total number of rows / columns in this document. ++ guint nRows = ceil((double)nDocumentHeightPixels / nTileSizePixels); ++ guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); ++ ++ pDocView->m_pImpl->m_pTileBuffer->tile_buffer_set_zoom(fZoom, nRows, nColumns); + + if ( pDocView->m_pImpl->m_pDocument ) + pDocView->m_pImpl->renderDocument(0); +@@ -1283,7 +1287,7 @@ SAL_DLLPUBLIC_EXPORT void lok_docview_set_edit( LOKDocView* pDocView, + } + pDocView->m_pImpl->m_bEdit = bEdit; + g_signal_emit(pDocView, docview_signals[EDIT_CHANGED], 0, bWasEdit); +- gtk_widget_queue_draw(GTK_WIDGET(pDocView->m_pImpl->m_pEventBox)); ++ gtk_widget_queue_draw(GTK_WIDGET(pDocView->m_pImpl->m_pDrawingArea)); + } + + SAL_DLLPUBLIC_EXPORT gboolean lok_docview_get_edit(LOKDocView* pDocView) +diff --git a/libreofficekit/source/gtk/tilebuffer.cxx b/libreofficekit/source/gtk/tilebuffer.cxx +new file mode 100644 +index 000000000000..ca66ae904f71 +--- /dev/null ++++ b/libreofficekit/source/gtk/tilebuffer.cxx +@@ -0,0 +1,90 @@ ++/* -*- 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 "tilebuffer.hxx" ++ ++static const int DPI = 96; ++ ++static float pixelToTwip(float fInput, float zoom) ++{ ++ return (fInput / DPI / zoom) * 1440.0f; ++} ++ ++static float twipToPixel(float fInput, float zoom) ++{ ++ return fInput / 1440.0f * DPI * zoom; ++} ++ ++GdkPixbuf* Tile::tile_get_buffer() ++{ ++ return m_pBuffer; ++} ++ ++void Tile::tile_release() ++{ ++ gdk_pixbuf_unref(m_pBuffer); ++ m_pBuffer = NULL; ++} ++ ++void TileBuffer::tile_buffer_set_zoom(float newZoomFactor, int rows, int columns) ++{ ++ m_fZoomFactor = newZoomFactor; ++ ++ tile_buffer_reset_all_tiles(); ++ ++ // set new buffer width and height ++ m_nWidth = columns; ++ m_nHeight = rows; ++ m_aTiles.resize(m_nWidth * m_nHeight); ++} ++ ++void TileBuffer::tile_buffer_reset_all_tiles() ++{ ++ for (size_t i = 0; i < m_aTiles.size(); i++) ++ { ++ m_aTiles[i].tile_release(); ++ } ++ m_aTiles.clear(); ++} ++ ++Tile& TileBuffer::tile_buffer_get_tile(int x, int y) ++{ ++ int index = x * m_nWidth + y; ++ if(!m_aTiles[index].valid) ++ { ++ GdkPixbuf* pPixBuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, m_nTileSize, m_nTileSize); ++ if (!pPixBuf){ ++ g_info ("error allocating memory to pixbuf"); ++ } ++ unsigned char* pBuffer = gdk_pixbuf_get_pixels(pPixBuf); ++ GdkRectangle aTileRectangle; ++ aTileRectangle.x = pixelToTwip(m_nTileSize, m_fZoomFactor) * y; ++ aTileRectangle.y = pixelToTwip(m_nTileSize, m_fZoomFactor) * x; ++ ++ g_info ("rendering (%d %d)", x, y); ++ m_pLOKDocument->pClass->paintTile(m_pLOKDocument, ++ // Buffer and its size, depends on the position only. ++ pBuffer, ++ m_nTileSize, m_nTileSize, ++ // Position of the tile. ++ aTileRectangle.x, aTileRectangle.y, ++ // Size of the tile, depends on the zoom factor and the tile position only. ++ pixelToTwip(m_nTileSize, m_fZoomFactor), pixelToTwip(m_nTileSize, m_fZoomFactor)); ++ ++ m_aTiles[index].tile_set_pixbuf(pPixBuf); ++ m_aTiles[index].valid = 1; ++ } ++ ++ return m_aTiles[index]; ++} ++ ++void Tile::tile_set_pixbuf(GdkPixbuf *buffer) ++{ ++ m_pBuffer = buffer; ++} +diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx +new file mode 100644 +index 000000000000..a5ed0dc8ec61 +--- /dev/null ++++ b/libreofficekit/source/gtk/tilebuffer.hxx +@@ -0,0 +1,78 @@ ++/* -*- 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_TILEBUFFER_HXX ++#define INCLUDED_TILEBUFFER_HXX ++ ++#include ++#include ++#include ++ ++#define LOK_USE_UNSTABLE_API ++#include ++#include ++#include ++ ++/* ++ This class represents a single tile in the tile buffer. ++ TODO: Extend it to support features like double buffering ++*/ ++class Tile ++{ ++public: ++ Tile() : valid(0) {} ++ ~Tile() { ++ tile_release(); ++ } ++ ++ GdkPixbuf* tile_get_buffer(); ++ void tile_release(); ++ void tile_set_pixbuf(GdkPixbuf*); ++ bool valid; ++private: ++ GdkPixbuf *m_pBuffer; ++}; ++ ++/* ++ TileBuffer is the buffer caching all the recently rendered tiles. ++ The buffer is set to invalid when zoom factor changes. ++*/ ++class TileBuffer ++{ ++public: ++ TileBuffer(LibreOfficeKitDocument *document, ++ int tileSize, ++ int rows, ++ int columns) ++ : m_pLOKDocument(document) ++ , m_nTileSize(tileSize) ++ , m_fZoomFactor(1) ++ , m_nWidth(columns) ++ , m_nHeight(rows) ++ { ++ m_aTiles.resize(rows * columns); ++ } ++ ++ ~TileBuffer() {} ++ ++ void tile_buffer_set_zoom(float zoomFactor, int rows, int columns); ++ Tile& tile_buffer_get_tile(int x, int y); ++ void tile_buffer_update(); ++ void tile_buffer_reset_all_tiles(); ++private: ++ LibreOfficeKitDocument *m_pLOKDocument; ++ int m_nTileSize; ++ float m_fZoomFactor; ++ std::vector m_aTiles; ++ //TODO: Also set width and height when document size changes ++ int m_nWidth; ++ int m_nHeight; ++}; ++ ++#endif // INCLUDED_TILEBUFFER_HXX +-- +2.12.0 + diff --git a/SOURCES/0013-lokdocview-Use-maps-instead-of-vector.patch b/SOURCES/0013-lokdocview-Use-maps-instead-of-vector.patch new file mode 100644 index 0000000..ee34179 --- /dev/null +++ b/SOURCES/0013-lokdocview-Use-maps-instead-of-vector.patch @@ -0,0 +1,102 @@ +From a8675df04f316dce72483c62f578467dfb446493 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Thu, 4 Jun 2015 01:44:47 +0530 +Subject: [PATCH 013/398] lokdocview: Use maps instead of vector + +Using vector each tile needs to be allocated memory irrespective of +whether tile is required or not. This approach fails when we zoom in to +a very high level to have thousands of tiles due to lot of memory +required. Using maps instead of vector takes care of this, and only +allocates Tiles when required. + +Change-Id: I523f815618451a7f014e28258e0de7b1c0693370 +(cherry picked from commit cc78267f274a42d268b1d56d0a83888dc69a4c91) +--- + libreofficekit/source/gtk/tilebuffer.cxx | 17 +++++++++-------- + libreofficekit/source/gtk/tilebuffer.hxx | 8 +++----- + 2 files changed, 12 insertions(+), 13 deletions(-) + +diff --git a/libreofficekit/source/gtk/tilebuffer.cxx b/libreofficekit/source/gtk/tilebuffer.cxx +index ca66ae904f71..e1b5b3294cc5 100644 +--- a/libreofficekit/source/gtk/tilebuffer.cxx ++++ b/libreofficekit/source/gtk/tilebuffer.cxx +@@ -41,22 +41,22 @@ void TileBuffer::tile_buffer_set_zoom(float newZoomFactor, int rows, int columns + // set new buffer width and height + m_nWidth = columns; + m_nHeight = rows; +- m_aTiles.resize(m_nWidth * m_nHeight); + } + + void TileBuffer::tile_buffer_reset_all_tiles() + { +- for (size_t i = 0; i < m_aTiles.size(); i++) ++ std::map::iterator it = m_mTiles.begin(); ++ for (; it != m_mTiles.end(); it++) + { +- m_aTiles[i].tile_release(); ++ it->second.tile_release(); + } +- m_aTiles.clear(); ++ m_mTiles.clear(); + } + + Tile& TileBuffer::tile_buffer_get_tile(int x, int y) + { + int index = x * m_nWidth + y; +- if(!m_aTiles[index].valid) ++ if(m_mTiles.find(index) == m_mTiles.end()) + { + GdkPixbuf* pPixBuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, m_nTileSize, m_nTileSize); + if (!pPixBuf){ +@@ -77,11 +77,12 @@ Tile& TileBuffer::tile_buffer_get_tile(int x, int y) + // Size of the tile, depends on the zoom factor and the tile position only. + pixelToTwip(m_nTileSize, m_fZoomFactor), pixelToTwip(m_nTileSize, m_fZoomFactor)); + +- m_aTiles[index].tile_set_pixbuf(pPixBuf); +- m_aTiles[index].valid = 1; ++ //create a mapping for it ++ m_mTiles[index].tile_set_pixbuf(pPixBuf); ++ m_mTiles[index].valid = 1; + } + +- return m_aTiles[index]; ++ return m_mTiles[index]; + } + + void Tile::tile_set_pixbuf(GdkPixbuf *buffer) +diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx +index a5ed0dc8ec61..0bc2d38dd641 100644 +--- a/libreofficekit/source/gtk/tilebuffer.hxx ++++ b/libreofficekit/source/gtk/tilebuffer.hxx +@@ -12,7 +12,7 @@ + + #include + #include +-#include ++#include + + #define LOK_USE_UNSTABLE_API + #include +@@ -55,9 +55,7 @@ public: + , m_fZoomFactor(1) + , m_nWidth(columns) + , m_nHeight(rows) +- { +- m_aTiles.resize(rows * columns); +- } ++ { } + + ~TileBuffer() {} + +@@ -69,7 +67,7 @@ private: + LibreOfficeKitDocument *m_pLOKDocument; + int m_nTileSize; + float m_fZoomFactor; +- std::vector m_aTiles; ++ std::map m_mTiles; + //TODO: Also set width and height when document size changes + int m_nWidth; + int m_nHeight; +-- +2.12.0 + diff --git a/SOURCES/0014-lokdocview-Add-support-for-editing-documents.patch b/SOURCES/0014-lokdocview-Add-support-for-editing-documents.patch new file mode 100644 index 0000000..aa6a372 --- /dev/null +++ b/SOURCES/0014-lokdocview-Add-support-for-editing-documents.patch @@ -0,0 +1,327 @@ +From 34a8ad7556a7a69f70a87d4d4e3dab328cff33de Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Thu, 4 Jun 2015 03:32:18 +0530 +Subject: [PATCH 014/398] lokdocview: Add support for editing documents + +Change-Id: I8637d99e6fa59129af207e667bcdf03dc212efeb +(cherry picked from commit 82a208a08fdfa8b6dab4f1577931f5e4f037276c) +--- + libreofficekit/source/gtk/lokdocview.cxx | 50 ++++++++++++++-- + libreofficekit/source/gtk/tilebuffer.cxx | 99 ++++++++++++++++++-------------- + libreofficekit/source/gtk/tilebuffer.hxx | 68 +++++++++++----------- + 3 files changed, 136 insertions(+), 81 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 413054cf873c..3b894f765faa 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -821,7 +821,7 @@ void LOKDocView_Impl::renderDocument(GdkRectangle* pPartial) + + if (bPaint) + { +- g_info("gettile: (%d %d)", nRow, nColumn); ++ // g_info("gettile: (%d %d)", nRow, nColumn); + + Tile& currentTile = m_pTileBuffer->tile_buffer_get_tile(nRow, nColumn); + GdkPixbuf* pPixBuf = currentTile.tile_get_buffer(); +@@ -934,17 +934,50 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback) + if (pCallback->m_aPayload != "EMPTY") + { + GdkRectangle aRectangle = LOKDocView_Impl::payloadToRectangle(pCallback->m_aPayload.c_str()); +- renderDocument(&aRectangle); ++ GdkRectangle aRectanglePixels; ++ aRectanglePixels.x = twipToPixel(aRectangle.x); ++ aRectanglePixels.y = twipToPixel(aRectangle.y); ++ aRectanglePixels.width = twipToPixel(aRectangle.width); ++ aRectanglePixels.height = twipToPixel(aRectangle.height); ++ int rowStart = aRectanglePixels.y / nTileSizePixels; ++ int colStart = aRectanglePixels.x / nTileSizePixels; ++ int rowEnd = (aRectanglePixels.y + aRectanglePixels.height + nTileSizePixels) / nTileSizePixels; ++ int colEnd = (aRectanglePixels.x + aRectanglePixels.width + nTileSizePixels) / nTileSizePixels; ++ int i,j; ++ for (i = rowStart; i < rowEnd; i++) { ++ for (j = colStart; j < colEnd; j++) { ++ m_pTileBuffer->tile_buffer_set_invalid(i, j); ++ } ++ } ++ renderDocument(0); + } + else ++ { ++ m_pTileBuffer->tile_buffer_reset_all_tiles(); + renderDocument(0); ++ } + } + break; + case LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR: + { + m_aVisibleCursor = LOKDocView_Impl::payloadToRectangle(pCallback->m_aPayload.c_str()); + m_bCursorOverlayVisible = true; +- gtk_widget_queue_draw(GTK_WIDGET(m_pDrawingArea)); ++ GdkRectangle aRectanglePixels; ++ aRectanglePixels.x = twipToPixel(m_aVisibleCursor.x); ++ aRectanglePixels.y = twipToPixel(m_aVisibleCursor.y); ++ aRectanglePixels.width = twipToPixel(m_aVisibleCursor.width); ++ aRectanglePixels.height = twipToPixel(m_aVisibleCursor.height); ++ int rowStart = aRectanglePixels.y / nTileSizePixels; ++ int colStart = aRectanglePixels.x / nTileSizePixels; ++ int rowEnd = (aRectanglePixels.y + aRectanglePixels.height + nTileSizePixels) / nTileSizePixels; ++ int colEnd = (aRectanglePixels.x + aRectanglePixels.width + nTileSizePixels) / nTileSizePixels; ++ int i,j; ++ for (i = rowStart; i < rowEnd; i++) { ++ for (j = colStart; j < colEnd; j++) { ++ m_pTileBuffer->tile_buffer_set_invalid(i, j); ++ } ++ } ++ renderDocument(0); + } + break; + case LOK_CALLBACK_TEXT_SELECTION: +@@ -961,7 +994,6 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback) + } + else + memset(&m_aHandleMiddleRect, 0, sizeof(m_aHandleMiddleRect)); +- gtk_widget_queue_draw(GTK_WIDGET(m_pDrawingArea)); + } + break; + case LOK_CALLBACK_TEXT_SELECTION_START: +@@ -1144,6 +1176,16 @@ static void lok_docview_init( GTypeInstance* pInstance, gpointer ) + g_signal_connect(GTK_OBJECT(pDocView->m_pImpl->m_pDrawingArea), + "expose-event", + GTK_SIGNAL_FUNC(LOKDocView_Impl::on_exposed), pDocView); ++ g_signal_connect(GTK_OBJECT(pDocView->m_pImpl->m_pDrawingArea), ++ "expose-event", ++ GTK_SIGNAL_FUNC(LOKDocView_Impl::renderOverlay), pDocView); ++ gtk_widget_add_events(pDocView->m_pImpl->m_pDrawingArea, ++ GDK_BUTTON_PRESS_MASK ++ | GDK_BUTTON_RELEASE_MASK ++ | GDK_BUTTON_MOTION_MASK); ++ g_signal_connect(G_OBJECT(pDocView->m_pImpl->m_pDrawingArea), "button-press-event", G_CALLBACK(LOKDocView_Impl::signalButton), pDocView); ++ g_signal_connect(G_OBJECT(pDocView->m_pImpl->m_pDrawingArea), "button-release-event", G_CALLBACK(LOKDocView_Impl::signalButton), pDocView); ++ g_signal_connect(G_OBJECT(pDocView->m_pImpl->m_pDrawingArea), "motion-notify-event", G_CALLBACK(LOKDocView_Impl::signalMotion), pDocView); + + gtk_signal_connect(GTK_OBJECT(pDocView), "destroy", GTK_SIGNAL_FUNC(LOKDocView_Impl::destroy), 0); + } +diff --git a/libreofficekit/source/gtk/tilebuffer.cxx b/libreofficekit/source/gtk/tilebuffer.cxx +index e1b5b3294cc5..e13f5b034c1d 100644 +--- a/libreofficekit/source/gtk/tilebuffer.cxx ++++ b/libreofficekit/source/gtk/tilebuffer.cxx +@@ -23,69 +23,82 @@ static float twipToPixel(float fInput, float zoom) + + GdkPixbuf* Tile::tile_get_buffer() + { +- return m_pBuffer; ++ return m_pBuffer; + } + + void Tile::tile_release() + { +- gdk_pixbuf_unref(m_pBuffer); +- m_pBuffer = NULL; ++ g_object_unref (m_pBuffer); ++ m_pBuffer = NULL; + } + + void TileBuffer::tile_buffer_set_zoom(float newZoomFactor, int rows, int columns) + { +- m_fZoomFactor = newZoomFactor; ++ m_fZoomFactor = newZoomFactor; + +- tile_buffer_reset_all_tiles(); ++ tile_buffer_reset_all_tiles(); + +- // set new buffer width and height +- m_nWidth = columns; +- m_nHeight = rows; ++ // set new buffer width and height ++ m_nWidth = columns; ++ m_nHeight = rows; + } + + void TileBuffer::tile_buffer_reset_all_tiles() + { +- std::map::iterator it = m_mTiles.begin(); +- for (; it != m_mTiles.end(); it++) +- { +- it->second.tile_release(); +- } +- m_mTiles.clear(); ++ std::map::iterator it = m_mTiles.begin(); ++ for (; it != m_mTiles.end(); it++) ++ { ++ it->second.tile_release(); ++ } ++ m_mTiles.clear(); ++} ++ ++void TileBuffer::tile_buffer_set_invalid(int x, int y) ++{ ++ int index = x * m_nWidth + y; ++ g_info("setting invalid : %d %d",x, y); ++ if (m_mTiles.find(index) != m_mTiles.end()) ++ { ++ m_mTiles[index].valid = 0; ++ m_mTiles[index].tile_release(); ++ m_mTiles.erase(index); ++ } + } + + Tile& TileBuffer::tile_buffer_get_tile(int x, int y) + { +- int index = x * m_nWidth + y; +- if(m_mTiles.find(index) == m_mTiles.end()) +- { +- GdkPixbuf* pPixBuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, m_nTileSize, m_nTileSize); +- if (!pPixBuf){ +- g_info ("error allocating memory to pixbuf"); +- } +- unsigned char* pBuffer = gdk_pixbuf_get_pixels(pPixBuf); +- GdkRectangle aTileRectangle; +- aTileRectangle.x = pixelToTwip(m_nTileSize, m_fZoomFactor) * y; +- aTileRectangle.y = pixelToTwip(m_nTileSize, m_fZoomFactor) * x; +- +- g_info ("rendering (%d %d)", x, y); +- m_pLOKDocument->pClass->paintTile(m_pLOKDocument, +- // Buffer and its size, depends on the position only. +- pBuffer, +- m_nTileSize, m_nTileSize, +- // Position of the tile. +- aTileRectangle.x, aTileRectangle.y, +- // Size of the tile, depends on the zoom factor and the tile position only. +- pixelToTwip(m_nTileSize, m_fZoomFactor), pixelToTwip(m_nTileSize, m_fZoomFactor)); +- +- //create a mapping for it +- m_mTiles[index].tile_set_pixbuf(pPixBuf); +- m_mTiles[index].valid = 1; +- } +- +- return m_mTiles[index]; ++ int index = x * m_nWidth + y; ++ if(m_mTiles.find(index) == m_mTiles.end() || !m_mTiles[index].valid) ++ { ++ ++ GdkPixbuf* pPixBuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, m_nTileSize, m_nTileSize); ++ if (!pPixBuf){ ++ g_info ("error allocating memory to pixbuf"); ++ } ++ unsigned char* pBuffer = gdk_pixbuf_get_pixels(pPixBuf); ++ GdkRectangle aTileRectangle; ++ aTileRectangle.x = pixelToTwip(m_nTileSize, m_fZoomFactor) * y; ++ aTileRectangle.y = pixelToTwip(m_nTileSize, m_fZoomFactor) * x; ++ ++ g_info ("rendering (%d %d)", x, y); ++ m_pLOKDocument->pClass->paintTile(m_pLOKDocument, ++ // Buffer and its size, depends on the position only. ++ pBuffer, ++ m_nTileSize, m_nTileSize, ++ // Position of the tile. ++ aTileRectangle.x, aTileRectangle.y, ++ // Size of the tile, depends on the zoom factor and the tile position only. ++ pixelToTwip(m_nTileSize, m_fZoomFactor), pixelToTwip(m_nTileSize, m_fZoomFactor)); ++ ++ //create a mapping for it ++ m_mTiles[index].tile_set_pixbuf(pPixBuf); ++ m_mTiles[index].valid = 1; ++ } ++ ++ return m_mTiles[index]; + } + + void Tile::tile_set_pixbuf(GdkPixbuf *buffer) + { +- m_pBuffer = buffer; ++ m_pBuffer = buffer; + } +diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx +index 0bc2d38dd641..088df93ca6b6 100644 +--- a/libreofficekit/source/gtk/tilebuffer.hxx ++++ b/libreofficekit/source/gtk/tilebuffer.hxx +@@ -25,18 +25,17 @@ + */ + class Tile + { +-public: +- Tile() : valid(0) {} +- ~Tile() { +- tile_release(); +- } ++ public: ++ Tile() : valid(0) {} ++ ~Tile() { ++ } + +- GdkPixbuf* tile_get_buffer(); +- void tile_release(); +- void tile_set_pixbuf(GdkPixbuf*); +- bool valid; +-private: +- GdkPixbuf *m_pBuffer; ++ GdkPixbuf* tile_get_buffer(); ++ void tile_release(); ++ void tile_set_pixbuf(GdkPixbuf*); ++ bool valid; ++ private: ++ GdkPixbuf *m_pBuffer; + }; + + /* +@@ -45,32 +44,33 @@ private: + */ + class TileBuffer + { +-public: +- TileBuffer(LibreOfficeKitDocument *document, +- int tileSize, +- int rows, +- int columns) +- : m_pLOKDocument(document) +- , m_nTileSize(tileSize) +- , m_fZoomFactor(1) +- , m_nWidth(columns) +- , m_nHeight(rows) ++ public: ++ TileBuffer(LibreOfficeKitDocument *document, ++ int tileSize, ++ int rows, ++ int columns) ++ : m_pLOKDocument(document) ++ , m_nTileSize(tileSize) ++ , m_fZoomFactor(1) ++ , m_nWidth(columns) ++ , m_nHeight(rows) + { } + +- ~TileBuffer() {} ++ ~TileBuffer() {} + +- void tile_buffer_set_zoom(float zoomFactor, int rows, int columns); +- Tile& tile_buffer_get_tile(int x, int y); +- void tile_buffer_update(); +- void tile_buffer_reset_all_tiles(); +-private: +- LibreOfficeKitDocument *m_pLOKDocument; +- int m_nTileSize; +- float m_fZoomFactor; +- std::map m_mTiles; +- //TODO: Also set width and height when document size changes +- int m_nWidth; +- int m_nHeight; ++ void tile_buffer_set_zoom(float zoomFactor, int rows, int columns); ++ Tile& tile_buffer_get_tile(int x, int y); ++ void tile_buffer_update(); ++ void tile_buffer_reset_all_tiles(); ++ void tile_buffer_set_invalid(int x, int y); ++ private: ++ LibreOfficeKitDocument *m_pLOKDocument; ++ int m_nTileSize; ++ float m_fZoomFactor; ++ std::map m_mTiles; ++ //TODO: Also set width and height when document size changes ++ int m_nWidth; ++ int m_nHeight; + }; + + #endif // INCLUDED_TILEBUFFER_HXX +-- +2.12.0 + diff --git a/SOURCES/0015-lokdocview-move-commonly-used-functions-and-variable.patch b/SOURCES/0015-lokdocview-move-commonly-used-functions-and-variable.patch new file mode 100644 index 0000000..f0214b4 --- /dev/null +++ b/SOURCES/0015-lokdocview-move-commonly-used-functions-and-variable.patch @@ -0,0 +1,381 @@ +From b4886f6f3f809212c97fb93cb7e7e7375b5f188a Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Thu, 4 Jun 2015 13:56:46 +0530 +Subject: [PATCH 015/398] lokdocview: move commonly used functions and + variables to common header + +twipToPixel and pixelToTwip are also being used by the new TileBuffer +clsas. Lets move these utility functions to a common header, +tilebuffer.hxx + +The variables for DPI and tileSize are also moved to tilebuffer.hxx + +Change-Id: I9d0bec7f2aefe412df232040a7a9abc6db3e4ccb +(cherry picked from commit a5d3efa4a02bed357d43960913a7c946c8b12aff) +--- + libreofficekit/source/gtk/lokdocview.cxx | 125 +++++++++++++------------------ + libreofficekit/source/gtk/tilebuffer.cxx | 6 +- + libreofficekit/source/gtk/tilebuffer.hxx | 9 +++ + 3 files changed, 65 insertions(+), 75 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 3b894f765faa..bfb414f0909c 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -37,11 +37,6 @@ + // Number of handles around a graphic selection. + #define GRAPHIC_HANDLE_COUNT 8 + +-// We know that VirtualDevices use a DPI of 96. +-static const int DPI = 96; +-// Lets use a square of side 256 pixels. +-static const int nTileSizePixels = 256; +- + namespace { + + /// Sets rWidth and rHeight from a "width, height" string. +@@ -145,10 +140,6 @@ struct LOKDocView_Impl + static void destroy(LOKDocView* pDocView, gpointer pData); + /// Connected to the expose-event of the GtkDrawingArea + static void on_exposed(GtkWidget *widget, GdkEvent *event, gpointer user_data); +- /// Converts from screen pixels to document coordinates. +- float pixelToTwip(float fInput); +- /// Converts from document coordinates to screen pixels. +- float twipToPixel(float fInput); + /// Receives a key press or release event. + void signalKey(GdkEventKey* pEvent); + /** +@@ -316,16 +307,6 @@ void LOKDocView_Impl::on_exposed(GtkWidget* /*widget*/, GdkEvent* /*event*/, gpo + pDocView->m_pImpl->renderDocument(0); + } + +-float LOKDocView_Impl::pixelToTwip(float fInput) +-{ +- return (fInput / DPI / m_fZoom) * 1440.0f; +-} +- +-float LOKDocView_Impl::twipToPixel(float fInput) +-{ +- return fInput / 1440.0f * DPI * m_fZoom; +-} +- + void LOKDocView_Impl::signalKey(GdkEventKey* pEvent) + { + int nCharCode = 0; +@@ -390,7 +371,7 @@ gboolean LOKDocView_Impl::signalButton(GtkWidget* /*pEventBox*/, GdkEventButton* + /// Receives a button press event. + gboolean LOKDocView_Impl::signalButtonImpl(GdkEventButton* pEvent) + { +- g_info("LOKDocView_Impl::signalButton: %d, %d (in twips: %d, %d)", (int)pEvent->x, (int)pEvent->y, (int)pixelToTwip(pEvent->x), (int)pixelToTwip(pEvent->y)); ++ g_info("LOKDocView_Impl::signalButton: %d, %d (in twips: %d, %d)", (int)pEvent->x, (int)pEvent->y, (int)pixelToTwip(pEvent->x, m_fZoom), (int)pixelToTwip(pEvent->y, m_fZoom)); + + if (pEvent->type == GDK_BUTTON_RELEASE) + { +@@ -419,7 +400,7 @@ gboolean LOKDocView_Impl::signalButtonImpl(GdkEventButton* pEvent) + { + g_info("LOKDocView_Impl::signalButton: end of drag graphic handle #%d", i); + m_bInDragGraphicHandles[i] = false; +- m_pDocument->pClass->setGraphicSelection(m_pDocument, LOK_SETGRAPHICSELECTION_END, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y)); ++ m_pDocument->pClass->setGraphicSelection(m_pDocument, LOK_SETGRAPHICSELECTION_END, pixelToTwip(pEvent->x, m_fZoom), pixelToTwip(pEvent->y, m_fZoom)); + return FALSE; + } + } +@@ -428,7 +409,7 @@ gboolean LOKDocView_Impl::signalButtonImpl(GdkEventButton* pEvent) + { + g_info("LOKDocView_Impl::signalButton: end of drag graphic selection"); + m_bInDragGraphicSelection = false; +- m_pDocument->pClass->setGraphicSelection(m_pDocument, LOK_SETGRAPHICSELECTION_END, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y)); ++ m_pDocument->pClass->setGraphicSelection(m_pDocument, LOK_SETGRAPHICSELECTION_END, pixelToTwip(pEvent->x, m_fZoom), pixelToTwip(pEvent->y, m_fZoom)); + return FALSE; + } + } +@@ -469,8 +450,8 @@ gboolean LOKDocView_Impl::signalButtonImpl(GdkEventButton* pEvent) + m_bInDragGraphicHandles[i] = true; + m_pDocument->pClass->setGraphicSelection(m_pDocument, + LOK_SETGRAPHICSELECTION_START, +- pixelToTwip(m_aGraphicHandleRects[i].x + m_aGraphicHandleRects[i].width / 2), +- pixelToTwip(m_aGraphicHandleRects[i].y + m_aGraphicHandleRects[i].height / 2)); ++ pixelToTwip(m_aGraphicHandleRects[i].x + m_aGraphicHandleRects[i].width / 2, m_fZoom), ++ pixelToTwip(m_aGraphicHandleRects[i].y + m_aGraphicHandleRects[i].height / 2, m_fZoom)); + return FALSE; + } + } +@@ -488,7 +469,7 @@ gboolean LOKDocView_Impl::signalButtonImpl(GdkEventButton* pEvent) + if ((pEvent->time - m_nLastButtonPressTime) < 250) + nCount++; + m_nLastButtonPressTime = pEvent->time; +- m_pDocument->pClass->postMouseEvent(m_pDocument, LOK_MOUSEEVENT_MOUSEBUTTONDOWN, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y), nCount); ++ m_pDocument->pClass->postMouseEvent(m_pDocument, LOK_MOUSEEVENT_MOUSEBUTTONDOWN, pixelToTwip(pEvent->x, m_fZoom), pixelToTwip(pEvent->y, m_fZoom), nCount); + break; + } + case GDK_BUTTON_RELEASE: +@@ -497,7 +478,7 @@ gboolean LOKDocView_Impl::signalButtonImpl(GdkEventButton* pEvent) + if ((pEvent->time - m_nLastButtonReleaseTime) < 250) + nCount++; + m_nLastButtonReleaseTime = pEvent->time; +- m_pDocument->pClass->postMouseEvent(m_pDocument, LOK_MOUSEEVENT_MOUSEBUTTONUP, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y), nCount); ++ m_pDocument->pClass->postMouseEvent(m_pDocument, LOK_MOUSEEVENT_MOUSEBUTTONUP, pixelToTwip(pEvent->x, m_fZoom), pixelToTwip(pEvent->y, m_fZoom), nCount); + break; + } + default: +@@ -534,21 +515,21 @@ gboolean LOKDocView_Impl::signalMotionImpl(GdkEventButton* pEvent) + { + g_info("lcl_signalMotion: dragging the middle handle"); + LOKDocView_Impl::getDragPoint(&m_aHandleMiddleRect, pEvent, &aPoint); +- m_pDocument->pClass->setTextSelection(m_pDocument, LOK_SETTEXTSELECTION_RESET, pixelToTwip(aPoint.x), pixelToTwip(aPoint.y)); ++ m_pDocument->pClass->setTextSelection(m_pDocument, LOK_SETTEXTSELECTION_RESET, pixelToTwip(aPoint.x, m_fZoom), pixelToTwip(aPoint.y, m_fZoom)); + return FALSE; + } + if (m_bInDragStartHandle) + { + g_info("lcl_signalMotion: dragging the start handle"); + LOKDocView_Impl::getDragPoint(&m_aHandleStartRect, pEvent, &aPoint); +- m_pDocument->pClass->setTextSelection(m_pDocument, LOK_SETTEXTSELECTION_START, pixelToTwip(aPoint.x), pixelToTwip(aPoint.y)); ++ m_pDocument->pClass->setTextSelection(m_pDocument, LOK_SETTEXTSELECTION_START, pixelToTwip(aPoint.x, m_fZoom), pixelToTwip(aPoint.y, m_fZoom)); + return FALSE; + } + if (m_bInDragEndHandle) + { + g_info("lcl_signalMotion: dragging the end handle"); + LOKDocView_Impl::getDragPoint(&m_aHandleEndRect, pEvent, &aPoint); +- m_pDocument->pClass->setTextSelection(m_pDocument, LOK_SETTEXTSELECTION_END, pixelToTwip(aPoint.x), pixelToTwip(aPoint.y)); ++ m_pDocument->pClass->setTextSelection(m_pDocument, LOK_SETTEXTSELECTION_END, pixelToTwip(aPoint.x, m_fZoom), pixelToTwip(aPoint.y, m_fZoom)); + return FALSE; + } + for (int i = 0; i < GRAPHIC_HANDLE_COUNT; ++i) +@@ -566,20 +547,20 @@ gboolean LOKDocView_Impl::signalMotionImpl(GdkEventButton* pEvent) + } + + GdkRectangle aMotionInTwipsInTwips; +- aMotionInTwipsInTwips.x = pixelToTwip(pEvent->x); +- aMotionInTwipsInTwips.y = pixelToTwip(pEvent->y); ++ aMotionInTwipsInTwips.x = pixelToTwip(pEvent->x, m_fZoom); ++ aMotionInTwipsInTwips.y = pixelToTwip(pEvent->y, m_fZoom); + aMotionInTwipsInTwips.width = 1; + aMotionInTwipsInTwips.height = 1; + if (gdk_rectangle_intersect(&aMotionInTwipsInTwips, &m_aGraphicSelection, 0)) + { + g_info("lcl_signalMotion: start of drag graphic selection"); + m_bInDragGraphicSelection = true; +- m_pDocument->pClass->setGraphicSelection(m_pDocument, LOK_SETGRAPHICSELECTION_START, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y)); ++ m_pDocument->pClass->setGraphicSelection(m_pDocument, LOK_SETGRAPHICSELECTION_START, pixelToTwip(pEvent->x, m_fZoom), pixelToTwip(pEvent->y, m_fZoom)); + return FALSE; + } + + // Otherwise a mouse move, as on the desktop. +- m_pDocument->pClass->postMouseEvent(m_pDocument, LOK_MOUSEEVENT_MOUSEMOVE, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y), 1); ++ m_pDocument->pClass->postMouseEvent(m_pDocument, LOK_MOUSEEVENT_MOUSEMOVE, pixelToTwip(pEvent->x, m_fZoom), pixelToTwip(pEvent->y, m_fZoom), 1); + + return FALSE; + } +@@ -602,10 +583,10 @@ gboolean LOKDocView_Impl::renderOverlayImpl(GtkWidget* pWidget) + + cairo_set_source_rgb(pCairo, 0, 0, 0); + cairo_rectangle(pCairo, +- twipToPixel(m_aVisibleCursor.x), +- twipToPixel(m_aVisibleCursor.y), +- twipToPixel(m_aVisibleCursor.width), +- twipToPixel(m_aVisibleCursor.height)); ++ twipToPixel(m_aVisibleCursor.x, m_fZoom), ++ twipToPixel(m_aVisibleCursor.y, m_fZoom), ++ twipToPixel(m_aVisibleCursor.width, m_fZoom), ++ twipToPixel(m_aVisibleCursor.height, m_fZoom)); + cairo_fill(pCairo); + } + +@@ -624,10 +605,10 @@ gboolean LOKDocView_Impl::renderOverlayImpl(GtkWidget* pWidget) + // Blue with 75% transparency. + cairo_set_source_rgba(pCairo, ((double)0x43)/255, ((double)0xac)/255, ((double)0xe8)/255, 0.25); + cairo_rectangle(pCairo, +- twipToPixel(rRectangle.x), +- twipToPixel(rRectangle.y), +- twipToPixel(rRectangle.width), +- twipToPixel(rRectangle.height)); ++ twipToPixel(rRectangle.x, m_fZoom), ++ twipToPixel(rRectangle.y, m_fZoom), ++ twipToPixel(rRectangle.width, m_fZoom), ++ twipToPixel(rRectangle.height, m_fZoom)); + cairo_fill(pCairo); + } + +@@ -674,10 +655,10 @@ void LOKDocView_Impl::renderHandle(cairo_t* pCairo, const GdkRectangle& rCursor, + nHandleWidth = cairo_image_surface_get_width(pHandle); + nHandleHeight = cairo_image_surface_get_height(pHandle); + // We want to scale down the handle, so that its height is the same as the cursor caret. +- fHandleScale = twipToPixel(rCursor.height) / nHandleHeight; ++ fHandleScale = twipToPixel(rCursor.height, m_fZoom) / nHandleHeight; + // We want the top center of the handle bitmap to be at the bottom center of the cursor rectangle. +- aCursorBottom.x = twipToPixel(rCursor.x) + twipToPixel(rCursor.width) / 2 - (nHandleWidth * fHandleScale) / 2; +- aCursorBottom.y = twipToPixel(rCursor.y) + twipToPixel(rCursor.height); ++ aCursorBottom.x = twipToPixel(rCursor.x, m_fZoom) + twipToPixel(rCursor.width, m_fZoom) / 2 - (nHandleWidth * fHandleScale) / 2; ++ aCursorBottom.y = twipToPixel(rCursor.y, m_fZoom) + twipToPixel(rCursor.height, m_fZoom); + cairo_save(pCairo); + cairo_translate(pCairo, aCursorBottom.x, aCursorBottom.y); + cairo_scale(pCairo, fHandleScale, fHandleScale); +@@ -700,10 +681,10 @@ void LOKDocView_Impl::renderGraphicHandle(cairo_t* pCairo, const GdkRectangle& r + nHandleWidth = cairo_image_surface_get_width(pHandle); + nHandleHeight = cairo_image_surface_get_height(pHandle); + +- aSelection.x = twipToPixel(rSelection.x); +- aSelection.y = twipToPixel(rSelection.y); +- aSelection.width = twipToPixel(rSelection.width); +- aSelection.height = twipToPixel(rSelection.height); ++ aSelection.x = twipToPixel(rSelection.x, m_fZoom); ++ aSelection.y = twipToPixel(rSelection.y, m_fZoom); ++ aSelection.width = twipToPixel(rSelection.width, m_fZoom); ++ aSelection.height = twipToPixel(rSelection.height, m_fZoom); + + for (int i = 0; i < GRAPHIC_HANDLE_COUNT; ++i) + { +@@ -781,8 +762,8 @@ void LOKDocView_Impl::renderDocument(GdkRectangle* pPartial) + GdkRectangle visibleArea; + lok_docview_get_visarea (m_pDocView, &visibleArea); + +- long nDocumentWidthPixels = twipToPixel(m_nDocumentWidthTwips); +- long nDocumentHeightPixels = twipToPixel(m_nDocumentHeightTwips); ++ long nDocumentWidthPixels = twipToPixel(m_nDocumentWidthTwips, m_fZoom); ++ long nDocumentHeightPixels = twipToPixel(m_nDocumentHeightTwips, m_fZoom); + // Total number of rows / columns in this document. + guint nRows = ceil((double)nDocumentHeightPixels / nTileSizePixels); + guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); +@@ -809,10 +790,10 @@ void LOKDocView_Impl::renderDocument(GdkRectangle* pPartial) + aTileRectanglePixels.height = nTileSizePixels; + + // Determine size and position of the tile in document coordinates, so we can decide if we can skip painting for partial rendering. +- aTileRectangleTwips.x = pixelToTwip(nTileSizePixels) * nColumn; +- aTileRectangleTwips.y = pixelToTwip(nTileSizePixels) * nRow; +- aTileRectangleTwips.width = pixelToTwip(aTileRectanglePixels.width); +- aTileRectangleTwips.height = pixelToTwip(aTileRectanglePixels.height); ++ aTileRectangleTwips.x = pixelToTwip(nTileSizePixels, m_fZoom) * nColumn; ++ aTileRectangleTwips.y = pixelToTwip(nTileSizePixels, m_fZoom) * nRow; ++ aTileRectangleTwips.width = pixelToTwip(aTileRectanglePixels.width, m_fZoom); ++ aTileRectangleTwips.height = pixelToTwip(aTileRectanglePixels.height, m_fZoom); + if (pPartial && !gdk_rectangle_intersect(pPartial, &aTileRectangleTwips, 0)) + bPaint = false; + +@@ -826,7 +807,7 @@ void LOKDocView_Impl::renderDocument(GdkRectangle* pPartial) + Tile& currentTile = m_pTileBuffer->tile_buffer_get_tile(nRow, nColumn); + GdkPixbuf* pPixBuf = currentTile.tile_get_buffer(); + +- gdk_cairo_set_source_pixbuf (pcairo, pPixBuf, twipToPixel(aTileRectangleTwips.x), twipToPixel(aTileRectangleTwips.y)); ++ gdk_cairo_set_source_pixbuf (pcairo, pPixBuf, twipToPixel(aTileRectangleTwips.x, m_fZoom), twipToPixel(aTileRectangleTwips.y, m_fZoom)); + cairo_paint(pcairo); + } + } +@@ -935,10 +916,10 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback) + { + GdkRectangle aRectangle = LOKDocView_Impl::payloadToRectangle(pCallback->m_aPayload.c_str()); + GdkRectangle aRectanglePixels; +- aRectanglePixels.x = twipToPixel(aRectangle.x); +- aRectanglePixels.y = twipToPixel(aRectangle.y); +- aRectanglePixels.width = twipToPixel(aRectangle.width); +- aRectanglePixels.height = twipToPixel(aRectangle.height); ++ aRectanglePixels.x = twipToPixel(aRectangle.x, m_fZoom); ++ aRectanglePixels.y = twipToPixel(aRectangle.y, m_fZoom); ++ aRectanglePixels.width = twipToPixel(aRectangle.width, m_fZoom); ++ aRectanglePixels.height = twipToPixel(aRectangle.height, m_fZoom); + int rowStart = aRectanglePixels.y / nTileSizePixels; + int colStart = aRectanglePixels.x / nTileSizePixels; + int rowEnd = (aRectanglePixels.y + aRectanglePixels.height + nTileSizePixels) / nTileSizePixels; +@@ -963,10 +944,10 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback) + m_aVisibleCursor = LOKDocView_Impl::payloadToRectangle(pCallback->m_aPayload.c_str()); + m_bCursorOverlayVisible = true; + GdkRectangle aRectanglePixels; +- aRectanglePixels.x = twipToPixel(m_aVisibleCursor.x); +- aRectanglePixels.y = twipToPixel(m_aVisibleCursor.y); +- aRectanglePixels.width = twipToPixel(m_aVisibleCursor.width); +- aRectanglePixels.height = twipToPixel(m_aVisibleCursor.height); ++ aRectanglePixels.x = twipToPixel(m_aVisibleCursor.x, m_fZoom); ++ aRectanglePixels.y = twipToPixel(m_aVisibleCursor.y, m_fZoom); ++ aRectanglePixels.width = twipToPixel(m_aVisibleCursor.width, m_fZoom); ++ aRectanglePixels.height = twipToPixel(m_aVisibleCursor.height, m_fZoom); + int rowStart = aRectanglePixels.y / nTileSizePixels; + int colStart = aRectanglePixels.x / nTileSizePixels; + int rowEnd = (aRectanglePixels.y + aRectanglePixels.height + nTileSizePixels) / nTileSizePixels; +@@ -1246,10 +1227,11 @@ SAL_DLLPUBLIC_EXPORT gboolean lok_docview_open_document( LOKDocView* pDocView, c + pDocView->m_pImpl->m_pDocument->pClass->getDocumentSize(pDocView->m_pImpl->m_pDocument, &pDocView->m_pImpl->m_nDocumentWidthTwips, &pDocView->m_pImpl->m_nDocumentHeightTwips); + g_timeout_add(600, &LOKDocView_Impl::handleTimeout, pDocView); + ++ float zoom = pDocView->m_pImpl->m_fZoom; + long nDocumentWidthTwips = pDocView->m_pImpl->m_nDocumentWidthTwips; + long nDocumentHeightTwips = pDocView->m_pImpl->m_nDocumentHeightTwips; +- long nDocumentWidthPixels = pDocView->m_pImpl->twipToPixel(nDocumentWidthTwips); +- long nDocumentHeightPixels = pDocView->m_pImpl->twipToPixel(nDocumentHeightTwips); ++ long nDocumentWidthPixels = twipToPixel(nDocumentWidthTwips, zoom); ++ long nDocumentHeightPixels = twipToPixel(nDocumentHeightTwips, zoom); + // Total number of rows / columns in this document. + guint nRows = ceil((double)nDocumentHeightPixels / nTileSizePixels); + guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); +@@ -1271,8 +1253,8 @@ SAL_DLLPUBLIC_EXPORT LibreOfficeKitDocument* lok_docview_get_document(LOKDocView + SAL_DLLPUBLIC_EXPORT void lok_docview_set_zoom ( LOKDocView* pDocView, float fZoom ) + { + pDocView->m_pImpl->m_fZoom = fZoom; +- long nDocumentWidthPixels = pDocView->m_pImpl->twipToPixel(pDocView->m_pImpl->m_nDocumentWidthTwips); +- long nDocumentHeightPixels = pDocView->m_pImpl->twipToPixel(pDocView->m_pImpl->m_nDocumentHeightTwips); ++ long nDocumentWidthPixels = twipToPixel(pDocView->m_pImpl->m_nDocumentWidthTwips, fZoom); ++ long nDocumentHeightPixels = twipToPixel(pDocView->m_pImpl->m_nDocumentHeightTwips, fZoom); + // Total number of rows / columns in this document. + guint nRows = ceil((double)nDocumentHeightPixels / nTileSizePixels); + guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); +@@ -1350,12 +1332,13 @@ SAL_DLLPUBLIC_EXPORT void lok_docview_post_key(GtkWidget* /*pWidget*/, GdkEventK + + SAL_DLLPUBLIC_EXPORT void lok_docview_get_visarea(LOKDocView* pThis, GdkRectangle* pArea) + { ++ float zoom = pThis->m_pImpl->m_fZoom; + GtkAdjustment* pHAdjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(pThis)); +- pArea->x = pThis->m_pImpl->pixelToTwip(gtk_adjustment_get_value(pHAdjustment)); +- pArea->width = pThis->m_pImpl->pixelToTwip(gtk_adjustment_get_page_size(pHAdjustment)); ++ pArea->x = pixelToTwip(gtk_adjustment_get_value(pHAdjustment),zoom); ++ pArea->width = pixelToTwip(gtk_adjustment_get_page_size(pHAdjustment), zoom); + GtkAdjustment* pVAdjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(pThis)); +- pArea->y = pThis->m_pImpl->pixelToTwip(gtk_adjustment_get_value(pVAdjustment)); +- pArea->height = pThis->m_pImpl->pixelToTwip(gtk_adjustment_get_page_size(pVAdjustment)); ++ pArea->y = pixelToTwip(gtk_adjustment_get_value(pVAdjustment), zoom); ++ pArea->height = pixelToTwip(gtk_adjustment_get_page_size(pVAdjustment), zoom); + } + + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +diff --git a/libreofficekit/source/gtk/tilebuffer.cxx b/libreofficekit/source/gtk/tilebuffer.cxx +index e13f5b034c1d..3e5e01f8d686 100644 +--- a/libreofficekit/source/gtk/tilebuffer.cxx ++++ b/libreofficekit/source/gtk/tilebuffer.cxx +@@ -9,14 +9,12 @@ + + #include "tilebuffer.hxx" + +-static const int DPI = 96; +- +-static float pixelToTwip(float fInput, float zoom) ++float pixelToTwip(float fInput, float zoom) + { + return (fInput / DPI / zoom) * 1440.0f; + } + +-static float twipToPixel(float fInput, float zoom) ++float twipToPixel(float fInput, float zoom) + { + return fInput / 1440.0f * DPI * zoom; + } +diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx +index 088df93ca6b6..15b276f238aa 100644 +--- a/libreofficekit/source/gtk/tilebuffer.hxx ++++ b/libreofficekit/source/gtk/tilebuffer.hxx +@@ -19,6 +19,15 @@ + #include + #include + ++// We know that VirtualDevices use a DPI of 96. ++const int DPI = 96; ++// Lets use a square of side 256 pixels for each tile. ++const int nTileSizePixels = 256; ++ ++float pixelToTwip(float fInput, float zoom); ++ ++float twipToPixel(float fInput, float zoom); ++ + /* + This class represents a single tile in the tile buffer. + TODO: Extend it to support features like double buffering +-- +2.12.0 + diff --git a/SOURCES/0016-lokdocview-wrap-a-functionality-inside-a-member-func.patch b/SOURCES/0016-lokdocview-wrap-a-functionality-inside-a-member-func.patch new file mode 100644 index 0000000..1d3202b --- /dev/null +++ b/SOURCES/0016-lokdocview-wrap-a-functionality-inside-a-member-func.patch @@ -0,0 +1,104 @@ +From d7f30799b250c8ffd3d25307e9efb5e7f13ce8b0 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Thu, 4 Jun 2015 14:15:58 +0530 +Subject: [PATCH 016/398] lokdocview: wrap a functionality inside a member + function + +Lets use a member function to set invalid tiles that come under the +given GdkRectangle. + +Change-Id: I440336ddf3c5fd9094f35bb89479aa76a42477fa +(cherry picked from commit ad0a404ef3097d92cf9a0e861e076a72074a5258) +--- + libreofficekit/source/gtk/lokdocview.cxx | 54 ++++++++++++++------------------ + 1 file changed, 24 insertions(+), 30 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index bfb414f0909c..cfa71a357f22 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -212,6 +212,8 @@ struct LOKDocView_Impl + void searchNotFound(const std::string& rPayload); + /// LOK decided to change parts, need to update UI. + void setPart(const std::string& rPayload); ++ /// Sets the tiles enclosed by rRectangle as invalid in m_pTileBuffer ++ void setTilesInvalid(const GdkRectangle& rRectangle); + }; + + namespace { +@@ -646,6 +648,26 @@ bool LOKDocView_Impl::isEmptyRectangle(const GdkRectangle& rRectangle) + return rRectangle.x == 0 && rRectangle.y == 0 && rRectangle.width == 0 && rRectangle.height == 0; + } + ++void LOKDocView_Impl::setTilesInvalid(const GdkRectangle& rRectangle) ++{ ++ GdkRectangle aRectanglePixels; ++ GdkPoint aStart, aEnd; ++ ++ aRectanglePixels.x = twipToPixel(rRectangle.x, m_fZoom); ++ aRectanglePixels.y = twipToPixel(rRectangle.y, m_fZoom); ++ aRectanglePixels.width = twipToPixel(rRectangle.width, m_fZoom); ++ aRectanglePixels.height = twipToPixel(rRectangle.height, m_fZoom); ++ ++ aStart.x = aRectanglePixels.y / nTileSizePixels; ++ aStart.y = aRectanglePixels.x / nTileSizePixels; ++ aEnd.x = (aRectanglePixels.y + aRectanglePixels.height + nTileSizePixels) / nTileSizePixels; ++ aEnd.y = (aRectanglePixels.x + aRectanglePixels.width + nTileSizePixels) / nTileSizePixels; ++ ++ for (int i = aStart.x; i < aEnd.x; i++) ++ for (int j = aStart.y; j < aEnd.y; j++) ++ m_pTileBuffer->tile_buffer_set_invalid(i, j); ++} ++ + void LOKDocView_Impl::renderHandle(cairo_t* pCairo, const GdkRectangle& rCursor, cairo_surface_t* pHandle, GdkRectangle& rRectangle) + { + GdkPoint aCursorBottom; +@@ -915,21 +937,7 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback) + if (pCallback->m_aPayload != "EMPTY") + { + GdkRectangle aRectangle = LOKDocView_Impl::payloadToRectangle(pCallback->m_aPayload.c_str()); +- GdkRectangle aRectanglePixels; +- aRectanglePixels.x = twipToPixel(aRectangle.x, m_fZoom); +- aRectanglePixels.y = twipToPixel(aRectangle.y, m_fZoom); +- aRectanglePixels.width = twipToPixel(aRectangle.width, m_fZoom); +- aRectanglePixels.height = twipToPixel(aRectangle.height, m_fZoom); +- int rowStart = aRectanglePixels.y / nTileSizePixels; +- int colStart = aRectanglePixels.x / nTileSizePixels; +- int rowEnd = (aRectanglePixels.y + aRectanglePixels.height + nTileSizePixels) / nTileSizePixels; +- int colEnd = (aRectanglePixels.x + aRectanglePixels.width + nTileSizePixels) / nTileSizePixels; +- int i,j; +- for (i = rowStart; i < rowEnd; i++) { +- for (j = colStart; j < colEnd; j++) { +- m_pTileBuffer->tile_buffer_set_invalid(i, j); +- } +- } ++ setTilesInvalid(aRectangle); + renderDocument(0); + } + else +@@ -943,21 +951,7 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback) + { + m_aVisibleCursor = LOKDocView_Impl::payloadToRectangle(pCallback->m_aPayload.c_str()); + m_bCursorOverlayVisible = true; +- GdkRectangle aRectanglePixels; +- aRectanglePixels.x = twipToPixel(m_aVisibleCursor.x, m_fZoom); +- aRectanglePixels.y = twipToPixel(m_aVisibleCursor.y, m_fZoom); +- aRectanglePixels.width = twipToPixel(m_aVisibleCursor.width, m_fZoom); +- aRectanglePixels.height = twipToPixel(m_aVisibleCursor.height, m_fZoom); +- int rowStart = aRectanglePixels.y / nTileSizePixels; +- int colStart = aRectanglePixels.x / nTileSizePixels; +- int rowEnd = (aRectanglePixels.y + aRectanglePixels.height + nTileSizePixels) / nTileSizePixels; +- int colEnd = (aRectanglePixels.x + aRectanglePixels.width + nTileSizePixels) / nTileSizePixels; +- int i,j; +- for (i = rowStart; i < rowEnd; i++) { +- for (j = colStart; j < colEnd; j++) { +- m_pTileBuffer->tile_buffer_set_invalid(i, j); +- } +- } ++ setTilesInvalid(m_aVisibleCursor); + renderDocument(0); + } + break; +-- +2.12.0 + diff --git a/SOURCES/0017-lokdocview-tilebuffer-clean-up.patch b/SOURCES/0017-lokdocview-tilebuffer-clean-up.patch new file mode 100644 index 0000000..1c5a535 --- /dev/null +++ b/SOURCES/0017-lokdocview-tilebuffer-clean-up.patch @@ -0,0 +1,460 @@ +From 0ad2976627386e126ae310d85aa6d771b3df1353 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Thu, 4 Jun 2015 22:09:57 +0530 +Subject: [PATCH 017/398] lokdocview, tilebuffer: clean up + +Improve documentation, style fixes + +Change-Id: I5000e32e90cd8e3b75e8df2907673efc303a55fd +(cherry picked from commit c074cfa4d48736d1703949ccfe1a6c534a2742ae) +--- + libreofficekit/source/gtk/lokdocview.cxx | 59 ++++++++++------- + libreofficekit/source/gtk/tilebuffer.cxx | 104 +++++++++++++++++------------- + libreofficekit/source/gtk/tilebuffer.hxx | 107 +++++++++++++++++++++++++------ + 3 files changed, 182 insertions(+), 88 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index cfa71a357f22..2181dc9a21b1 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -1,4 +1,4 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ ++/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + /* + * This file is part of the LibreOffice project. + * +@@ -177,12 +177,12 @@ struct LOKDocView_Impl + /// Implementation of the timeout handler, invoked by handleTimeout(). + gboolean handleTimeoutImpl(); + /** +- * Renders the document to a number of tiles. ++ * Renders the document to a number of visible tiles. + * + * This method is invoked only manually, not when some Gtk signal is + * emitted. + * +- * @param pPartial if 0, then the full document is rendered, otherwise only ++ * @param pPartial if 0, then the full visible document is rendered, otherwise only + * the tiles that intersect with pPartial. + */ + void renderDocument(GdkRectangle* pPartial); +@@ -665,7 +665,7 @@ void LOKDocView_Impl::setTilesInvalid(const GdkRectangle& rRectangle) + + for (int i = aStart.x; i < aEnd.x; i++) + for (int j = aStart.y; j < aEnd.y; j++) +- m_pTileBuffer->tile_buffer_set_invalid(i, j); ++ m_pTileBuffer->setInvalid(i, j); + } + + void LOKDocView_Impl::renderHandle(cairo_t* pCairo, const GdkRectangle& rCursor, cairo_surface_t* pHandle, GdkRectangle& rRectangle) +@@ -801,7 +801,8 @@ void LOKDocView_Impl::renderDocument(GdkRectangle* pPartial) + GdkRectangle aTileRectangleTwips, aTileRectanglePixels; + bool bPaint = true; + +- // Determine size of the tile: the rightmost/bottommost tiles may be smaller and we need the size to decide if we need to repaint. ++ // Determine size of the tile: the rightmost/bottommost tiles may ++ // be smaller, and we need the size to decide if we need to repaint. + if (nColumn == nColumns - 1) + aTileRectanglePixels.width = nDocumentWidthPixels - nColumn * nTileSizePixels; + else +@@ -811,7 +812,8 @@ void LOKDocView_Impl::renderDocument(GdkRectangle* pPartial) + else + aTileRectanglePixels.height = nTileSizePixels; + +- // Determine size and position of the tile in document coordinates, so we can decide if we can skip painting for partial rendering. ++ // Determine size and position of the tile in document coordinates, ++ // so we can decide if we can skip painting for partial rendering. + aTileRectangleTwips.x = pixelToTwip(nTileSizePixels, m_fZoom) * nColumn; + aTileRectangleTwips.y = pixelToTwip(nTileSizePixels, m_fZoom) * nRow; + aTileRectangleTwips.width = pixelToTwip(aTileRectanglePixels.width, m_fZoom); +@@ -824,12 +826,14 @@ void LOKDocView_Impl::renderDocument(GdkRectangle* pPartial) + + if (bPaint) + { +- // g_info("gettile: (%d %d)", nRow, nColumn); ++ g_info("tile_buffer_get_tile (%d, %d)", nRow, nColumn); + +- Tile& currentTile = m_pTileBuffer->tile_buffer_get_tile(nRow, nColumn); +- GdkPixbuf* pPixBuf = currentTile.tile_get_buffer(); ++ Tile& currentTile = m_pTileBuffer->getTile(nRow, nColumn); ++ GdkPixbuf* pPixBuf = currentTile.getBuffer(); + +- gdk_cairo_set_source_pixbuf (pcairo, pPixBuf, twipToPixel(aTileRectangleTwips.x, m_fZoom), twipToPixel(aTileRectangleTwips.y, m_fZoom)); ++ gdk_cairo_set_source_pixbuf (pcairo, pPixBuf, ++ twipToPixel(aTileRectangleTwips.x, m_fZoom), ++ twipToPixel(aTileRectangleTwips.y, m_fZoom)); + cairo_paint(pcairo); + } + } +@@ -942,7 +946,7 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback) + } + else + { +- m_pTileBuffer->tile_buffer_reset_all_tiles(); ++ m_pTileBuffer->resetAllTiles(); + renderDocument(0); + } + } +@@ -1148,21 +1152,28 @@ static void lok_docview_init( GTypeInstance* pInstance, gpointer ) + gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW(pDocView), + pDocView->m_pImpl->m_pDrawingArea ); + +- g_signal_connect(GTK_OBJECT(pDocView->m_pImpl->m_pDrawingArea), ++ g_signal_connect(G_OBJECT(pDocView->m_pImpl->m_pDrawingArea), + "expose-event", +- GTK_SIGNAL_FUNC(LOKDocView_Impl::on_exposed), pDocView); +- g_signal_connect(GTK_OBJECT(pDocView->m_pImpl->m_pDrawingArea), ++ G_CALLBACK(LOKDocView_Impl::on_exposed), pDocView); ++ g_signal_connect(G_OBJECT(pDocView->m_pImpl->m_pDrawingArea), + "expose-event", +- GTK_SIGNAL_FUNC(LOKDocView_Impl::renderOverlay), pDocView); ++ G_CALLBACK(LOKDocView_Impl::renderOverlay), pDocView); + gtk_widget_add_events(pDocView->m_pImpl->m_pDrawingArea, +- GDK_BUTTON_PRESS_MASK +- | GDK_BUTTON_RELEASE_MASK +- | GDK_BUTTON_MOTION_MASK); +- g_signal_connect(G_OBJECT(pDocView->m_pImpl->m_pDrawingArea), "button-press-event", G_CALLBACK(LOKDocView_Impl::signalButton), pDocView); +- g_signal_connect(G_OBJECT(pDocView->m_pImpl->m_pDrawingArea), "button-release-event", G_CALLBACK(LOKDocView_Impl::signalButton), pDocView); +- g_signal_connect(G_OBJECT(pDocView->m_pImpl->m_pDrawingArea), "motion-notify-event", G_CALLBACK(LOKDocView_Impl::signalMotion), pDocView); +- +- gtk_signal_connect(GTK_OBJECT(pDocView), "destroy", GTK_SIGNAL_FUNC(LOKDocView_Impl::destroy), 0); ++ GDK_BUTTON_PRESS_MASK ++ |GDK_BUTTON_RELEASE_MASK ++ |GDK_BUTTON_MOTION_MASK); ++ ++ g_signal_connect(G_OBJECT(pDocView->m_pImpl->m_pDrawingArea), ++ "button-press-event", ++ G_CALLBACK(LOKDocView_Impl::signalButton), pDocView); ++ g_signal_connect(G_OBJECT(pDocView->m_pImpl->m_pDrawingArea), ++ "button-release-event", ++ G_CALLBACK(LOKDocView_Impl::signalButton), pDocView); ++ g_signal_connect(G_OBJECT(pDocView->m_pImpl->m_pDrawingArea), ++ "motion-notify-event", ++ G_CALLBACK(LOKDocView_Impl::signalMotion), pDocView); ++ ++ g_signal_connect(G_OBJECT(pDocView), "destroy", G_CALLBACK(LOKDocView_Impl::destroy), 0); + } + + SAL_DLLPUBLIC_EXPORT guint lok_docview_get_type() +@@ -1253,7 +1264,7 @@ SAL_DLLPUBLIC_EXPORT void lok_docview_set_zoom ( LOKDocView* pDocView, float fZo + guint nRows = ceil((double)nDocumentHeightPixels / nTileSizePixels); + guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); + +- pDocView->m_pImpl->m_pTileBuffer->tile_buffer_set_zoom(fZoom, nRows, nColumns); ++ pDocView->m_pImpl->m_pTileBuffer->setZoom(fZoom, nRows, nColumns); + + if ( pDocView->m_pImpl->m_pDocument ) + pDocView->m_pImpl->renderDocument(0); +diff --git a/libreofficekit/source/gtk/tilebuffer.cxx b/libreofficekit/source/gtk/tilebuffer.cxx +index 3e5e01f8d686..338038078ab3 100644 +--- a/libreofficekit/source/gtk/tilebuffer.cxx ++++ b/libreofficekit/source/gtk/tilebuffer.cxx +@@ -1,4 +1,4 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ ++/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + /* + * This file is part of the LibreOffice project. + * +@@ -9,6 +9,10 @@ + + #include "tilebuffer.hxx" + ++/* ------------------ ++ Utility functions ++ ------------------ ++*/ + float pixelToTwip(float fInput, float zoom) + { + return (fInput / DPI / zoom) * 1440.0f; +@@ -19,84 +23,96 @@ float twipToPixel(float fInput, float zoom) + return fInput / 1440.0f * DPI * zoom; + } + +-GdkPixbuf* Tile::tile_get_buffer() ++/* ---------------------------- ++ Tile class member functions ++ ---------------------------- ++*/ ++GdkPixbuf* Tile::getBuffer() + { + return m_pBuffer; + } + +-void Tile::tile_release() ++void Tile::release() + { + g_object_unref (m_pBuffer); + m_pBuffer = NULL; + } + +-void TileBuffer::tile_buffer_set_zoom(float newZoomFactor, int rows, int columns) ++void Tile::setPixbuf(GdkPixbuf *buffer) ++{ ++ m_pBuffer = buffer; ++} ++ ++/* ---------------------------------- ++ TileBuffer class member functions ++ ---------------------------------- ++*/ ++void TileBuffer::setZoom(float newZoomFactor, int rows, int columns) + { + m_fZoomFactor = newZoomFactor; + +- tile_buffer_reset_all_tiles(); ++ resetAllTiles(); + + // set new buffer width and height + m_nWidth = columns; + m_nHeight = rows; + } + +-void TileBuffer::tile_buffer_reset_all_tiles() ++void TileBuffer::resetAllTiles() + { + std::map::iterator it = m_mTiles.begin(); + for (; it != m_mTiles.end(); it++) +- { +- it->second.tile_release(); +- } ++ { ++ it->second.release(); ++ } + m_mTiles.clear(); + } + +-void TileBuffer::tile_buffer_set_invalid(int x, int y) ++void TileBuffer::setInvalid(int x, int y) + { + int index = x * m_nWidth + y; +- g_info("setting invalid : %d %d",x, y); ++ g_info("Setting tile invalid (%d, %d)", x, y); + if (m_mTiles.find(index) != m_mTiles.end()) +- { +- m_mTiles[index].valid = 0; +- m_mTiles[index].tile_release(); +- m_mTiles.erase(index); +- } ++ { ++ m_mTiles[index].valid = 0; ++ m_mTiles[index].release(); ++ m_mTiles.erase(index); ++ } + } + +-Tile& TileBuffer::tile_buffer_get_tile(int x, int y) ++Tile& TileBuffer::getTile(int x, int y) + { + int index = x * m_nWidth + y; + if(m_mTiles.find(index) == m_mTiles.end() || !m_mTiles[index].valid) +- { ++ { + +- GdkPixbuf* pPixBuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, m_nTileSize, m_nTileSize); +- if (!pPixBuf){ +- g_info ("error allocating memory to pixbuf"); +- } +- unsigned char* pBuffer = gdk_pixbuf_get_pixels(pPixBuf); +- GdkRectangle aTileRectangle; +- aTileRectangle.x = pixelToTwip(m_nTileSize, m_fZoomFactor) * y; +- aTileRectangle.y = pixelToTwip(m_nTileSize, m_fZoomFactor) * x; +- +- g_info ("rendering (%d %d)", x, y); +- m_pLOKDocument->pClass->paintTile(m_pLOKDocument, +- // Buffer and its size, depends on the position only. +- pBuffer, +- m_nTileSize, m_nTileSize, +- // Position of the tile. +- aTileRectangle.x, aTileRectangle.y, +- // Size of the tile, depends on the zoom factor and the tile position only. +- pixelToTwip(m_nTileSize, m_fZoomFactor), pixelToTwip(m_nTileSize, m_fZoomFactor)); +- +- //create a mapping for it +- m_mTiles[index].tile_set_pixbuf(pPixBuf); +- m_mTiles[index].valid = 1; ++ GdkPixbuf* pPixBuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, m_nTileSize, m_nTileSize); ++ if (!pPixBuf) ++ { ++ g_info ("Error allocating memory to pixbuf"); ++ return m_mTiles[index]; + } + ++ unsigned char* pBuffer = gdk_pixbuf_get_pixels(pPixBuf); ++ GdkRectangle aTileRectangle; ++ aTileRectangle.x = pixelToTwip(m_nTileSize, m_fZoomFactor) * y; ++ aTileRectangle.y = pixelToTwip(m_nTileSize, m_fZoomFactor) * x; ++ ++ g_info ("Rendering (%d, %d)", x, y); ++ m_pLOKDocument->pClass->paintTile(m_pLOKDocument, ++ pBuffer, ++ m_nTileSize, m_nTileSize, ++ aTileRectangle.x, aTileRectangle.y, ++ pixelToTwip(m_nTileSize, m_fZoomFactor), ++ pixelToTwip(m_nTileSize, m_fZoomFactor)); ++ ++ //create a mapping for it ++ m_mTiles[index].setPixbuf(pPixBuf); ++ m_mTiles[index].valid = 1; ++ } ++ + return m_mTiles[index]; + } + +-void Tile::tile_set_pixbuf(GdkPixbuf *buffer) +-{ +- m_pBuffer = buffer; +-} ++ ++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx +index 15b276f238aa..7e2132f4d512 100644 +--- a/libreofficekit/source/gtk/tilebuffer.hxx ++++ b/libreofficekit/source/gtk/tilebuffer.hxx +@@ -1,4 +1,4 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ ++/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + /* + * This file is part of the LibreOffice project. + * +@@ -24,32 +24,60 @@ const int DPI = 96; + // Lets use a square of side 256 pixels for each tile. + const int nTileSizePixels = 256; + ++/** ++ Converts the pixel value to zoom independent twip value. ++ ++ @param fInput value to convert ++ @param zoom the current zoom level ++ ++ @return the pixels value corresponding to given twip value ++*/ + float pixelToTwip(float fInput, float zoom); + ++/** ++ Converts the zoom independent twip value pixel value. ++ ++ @param fInput value to convert ++ @param zoom the current zoom level ++ ++ @return the twip value corresponding to given pixel value ++*/ + float twipToPixel(float fInput, float zoom); + +-/* +- This class represents a single tile in the tile buffer. +- TODO: Extend it to support features like double buffering ++/** ++ This class represents a single tile in the tile buffer. ++ It encloses a reference to GdkPixBuf containing the pixel data of the tile. + */ + class Tile + { + public: +- Tile() : valid(0) {} +- ~Tile() { +- } ++ Tile() : valid(0) {} ++ ~Tile() { } + +- GdkPixbuf* tile_get_buffer(); +- void tile_release(); +- void tile_set_pixbuf(GdkPixbuf*); ++ /** ++ Tells if this tile is valid or not. Initialised to 0 (invalid) during ++ object creation. ++ */ + bool valid; +- private: ++ ++ /// Function to get the pointer to enclosing GdkPixbuf ++ GdkPixbuf* getBuffer(); ++ /// Destroys the enclosing GdkPixbuf object pointed to by m_pBuffer ++ void release(); ++ /// Used to set the pixel buffer of this object ++ void setPixbuf(GdkPixbuf*); ++ ++private: ++ /// Pixel buffer data for this tile + GdkPixbuf *m_pBuffer; + }; + +-/* +- TileBuffer is the buffer caching all the recently rendered tiles. +- The buffer is set to invalid when zoom factor changes. ++/** ++ This class represents the tile buffer which is responsible for managing, ++ reusing and caching all the already rendered tiles. If the given tile is not ++ present in the buffer, call to LOK Document's (m_pLOKDocument) paintTile ++ method is made which fetches the rendered tile from LO core and store it in ++ buffer for future reuse. + */ + class TileBuffer + { +@@ -67,19 +95,58 @@ class TileBuffer + + ~TileBuffer() {} + +- void tile_buffer_set_zoom(float zoomFactor, int rows, int columns); +- Tile& tile_buffer_get_tile(int x, int y); +- void tile_buffer_update(); +- void tile_buffer_reset_all_tiles(); +- void tile_buffer_set_invalid(int x, int y); ++ /** ++ Sets the zoom factor (m_fZoomFactor) for this tile buffer. Setting the ++ zoom factor invalidates whole of the tile buffer, destroys all tiles ++ contained within it, and sets new width, height values for tile ++ buffer. The width, height value of tile buffer is the width and height of ++ the table containing all possible tiles (rendered and non-rendered) that ++ this buffer can have. ++ ++ @param zoomFactor the new zoom factor value to set ++ */ ++ void setZoom(float zoomFactor, int rows, int columns); ++ /** ++ Gets the underlying Tile object for given position. The position (0, 0) ++ points to the left top most tile of the buffer. ++ ++ If the tile is not cached by the tile buffer, it makes a paintTile call ++ to LO core asking to render the given tile. It then stores the tile for ++ future reuse. ++ ++ @param x the tile along the x-axis of the buffer ++ @param y the tile along the y-axis of the buffer ++ ++ @return the tile at the mentioned position (x, y) ++ */ ++ Tile& getTile(int x, int y); ++ /// Destroys all the tiles in the tile buffer; also frees the memory allocated ++ /// for all the Tile objects. ++ void resetAllTiles(); ++ /** ++ Marks the tile as invalid. The tile (0, 0) is the left topmost tile in ++ the tile buffer. ++ ++ @param x the position of tile along x-axis ++ @param y the position of tile along y-axis ++ */ ++ void setInvalid(int x, int y); ++ + private: ++ /// Contains the reference to the LOK Document that this tile buffer is for. + LibreOfficeKitDocument *m_pLOKDocument; ++ /// The side of each squared tile in pixels. + int m_nTileSize; ++ /// The zoom factor that the tile buffer is currently rendered to. + float m_fZoomFactor; ++ /// Stores all the tiles cached by this tile buffer. + std::map m_mTiles; +- //TODO: Also set width and height when document size changes ++ /// Width of the current tile buffer (number of columns) + int m_nWidth; ++ /// Height of the current tile buffer (numbero of rows) + int m_nHeight; + }; + + #endif // INCLUDED_TILEBUFFER_HXX ++ ++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +-- +2.12.0 + diff --git a/SOURCES/0018-lokdocview-fixed-rectangle-format-in-documentation-c.patch b/SOURCES/0018-lokdocview-fixed-rectangle-format-in-documentation-c.patch new file mode 100644 index 0000000..7419bbd --- /dev/null +++ b/SOURCES/0018-lokdocview-fixed-rectangle-format-in-documentation-c.patch @@ -0,0 +1,31 @@ +From 85532b0dc16409922bcb6b1f7193e59e8d5add56 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Fri, 5 Jun 2015 17:05:28 +0530 +Subject: [PATCH 018/398] lokdocview: fixed rectangle format in + documentation/comments + +Change-Id: Iaf4a5fba5c4c34d03b91ca9ca4dd4eff1dbf39f6 +(cherry picked from commit f4278176b031f0588269599ba8b59aa6ebbb9464) +--- + libreofficekit/source/gtk/lokdocview.cxx | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 2181dc9a21b1..48b3ed6e2080 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -186,9 +186,9 @@ struct LOKDocView_Impl + * the tiles that intersect with pPartial. + */ + void renderDocument(GdkRectangle* pPartial); +- /// Returns the GdkRectangle of a width,height,x,y string. ++ /// Returns the GdkRectangle of a x,y,width,height string. + static GdkRectangle payloadToRectangle(const char* pPayload); +- /// Returns the GdkRectangles of a w,h,x,y;w2,h2,x2,y2;... string. ++ /// Returns the GdkRectangles of a x1,y1,w1,h1;x2,y2,w2,h2;... string. + static std::vector payloadToRectangles(const char* pPayload); + /// Returns the string representation of a LibreOfficeKitCallbackType enumeration element. + static const char* callbackTypeToString(int nType); +-- +2.12.0 + diff --git a/SOURCES/0019-lokdocview-check-payload-for-inconsistencies-before-.patch b/SOURCES/0019-lokdocview-check-payload-for-inconsistencies-before-.patch new file mode 100644 index 0000000..aeb3080 --- /dev/null +++ b/SOURCES/0019-lokdocview-check-payload-for-inconsistencies-before-.patch @@ -0,0 +1,65 @@ +From b049bfd09192d01aa5dcbc48975cf9eb3e1997b9 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Fri, 5 Jun 2015 17:06:54 +0530 +Subject: [PATCH 019/398] lokdocview: check payload for inconsistencies before + using it + +Lets follow the old advice: "Be liberal in what you accept, be strict in +what you produce". + +This is after noticing negative values for x, y in +the payload in some situation, such as, hitting a backspace key when the +cursor is at the start of a line + +Change-Id: I11939b981f75969b88214baee66b4c69c5e41906 +(cherry picked from commit 35e03615066a6525e0259ff1823a0da0c2d4820a) +--- + libreofficekit/source/gtk/lokdocview.cxx | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 48b3ed6e2080..d9e8c14aa9d5 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -187,9 +187,9 @@ struct LOKDocView_Impl + */ + void renderDocument(GdkRectangle* pPartial); + /// Returns the GdkRectangle of a x,y,width,height string. +- static GdkRectangle payloadToRectangle(const char* pPayload); ++ GdkRectangle payloadToRectangle(const char* pPayload); + /// Returns the GdkRectangles of a x1,y1,w1,h1;x2,y2,w2,h2;... string. +- static std::vector payloadToRectangles(const char* pPayload); ++ std::vector payloadToRectangles(const char* pPayload); + /// Returns the string representation of a LibreOfficeKitCallbackType enumeration element. + static const char* callbackTypeToString(int nType); + /// Invoked on the main thread if callbackWorker() requests so. +@@ -853,18 +853,26 @@ GdkRectangle LOKDocView_Impl::payloadToRectangle(const char* pPayload) + if (!*ppCoordinate) + return aRet; + aRet.x = atoi(*ppCoordinate); ++ if (aRet.x < 0) ++ aRet.x = 0; + ++ppCoordinate; + if (!*ppCoordinate) + return aRet; + aRet.y = atoi(*ppCoordinate); ++ if (aRet.y < 0) ++ aRet.y = 0; + ++ppCoordinate; + if (!*ppCoordinate) + return aRet; + aRet.width = atoi(*ppCoordinate); ++ if (aRet.x + aRet.width > m_nDocumentWidthTwips) ++ aRet.width = m_nDocumentWidthTwips - aRet.x; + ++ppCoordinate; + if (!*ppCoordinate) + return aRet; + aRet.height = atoi(*ppCoordinate); ++ if (aRet.y + aRet.height > m_nDocumentHeightTwips) ++ aRet.height = m_nDocumentHeightTwips - aRet.y; + g_strfreev(ppCoordinates); + return aRet; + } +-- +2.12.0 + diff --git a/SOURCES/0020-lokdocview-move-GtkDrawingArea-size-request-out-of-r.patch b/SOURCES/0020-lokdocview-move-GtkDrawingArea-size-request-out-of-r.patch new file mode 100644 index 0000000..2acdd7d --- /dev/null +++ b/SOURCES/0020-lokdocview-move-GtkDrawingArea-size-request-out-of-r.patch @@ -0,0 +1,69 @@ +From 71ce3c4cc6e973d252f6db0a22c01670d9fc571f Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Fri, 5 Jun 2015 20:38:55 +0530 +Subject: [PATCH 020/398] lokdocview: move GtkDrawingArea size request out of + renderDocument() + +... and place it at places only where the widget can change its size. + +Change-Id: I4a4b28b35eba06a6faab434677d4d70d2a33339a +(cherry picked from commit 1483643ba5930474b9eab73b723a775dd3c8c850) +--- + libreofficekit/source/gtk/lokdocview.cxx | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index d9e8c14aa9d5..42dd14cb34ed 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -790,7 +790,6 @@ void LOKDocView_Impl::renderDocument(GdkRectangle* pPartial) + guint nRows = ceil((double)nDocumentHeightPixels / nTileSizePixels); + guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); + +- gtk_widget_set_size_request(m_pDrawingArea, nDocumentWidthPixels, nDocumentHeightPixels); + cairo_t *pcairo = gdk_cairo_create(m_pDrawingArea->window); + + // Render the tiles. +@@ -826,7 +825,7 @@ void LOKDocView_Impl::renderDocument(GdkRectangle* pPartial) + + if (bPaint) + { +- g_info("tile_buffer_get_tile (%d, %d)", nRow, nColumn); ++ //g_info("tile_buffer_get_tile (%d, %d)", nRow, nColumn); + + Tile& currentTile = m_pTileBuffer->getTile(nRow, nColumn); + GdkPixbuf* pPixBuf = currentTile.getBuffer(); +@@ -1028,6 +1027,10 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback) + case LOK_CALLBACK_DOCUMENT_SIZE_CHANGED: + { + payloadToSize(pCallback->m_aPayload.c_str(), m_nDocumentWidthTwips, m_nDocumentHeightTwips); ++ gtk_widget_set_size_request(m_pDrawingArea, ++ twipToPixel(m_nDocumentWidthTwips, m_fZoom), ++ twipToPixel(m_nDocumentHeightTwips, m_fZoom)); ++ m_pTileBuffer->resetAllTiles(); + } + break; + case LOK_CALLBACK_SET_PART: +@@ -1252,6 +1255,9 @@ SAL_DLLPUBLIC_EXPORT gboolean lok_docview_open_document( LOKDocView* pDocView, c + nTileSizePixels, + nRows, + nColumns); ++ gtk_widget_set_size_request(pDocView->m_pImpl->m_pDrawingArea, ++ nDocumentWidthPixels, ++ nDocumentHeightPixels); + pDocView->m_pImpl->renderDocument(0); + } + +@@ -1273,6 +1279,9 @@ SAL_DLLPUBLIC_EXPORT void lok_docview_set_zoom ( LOKDocView* pDocView, float fZo + guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); + + pDocView->m_pImpl->m_pTileBuffer->setZoom(fZoom, nRows, nColumns); ++ gtk_widget_set_size_request(pDocView->m_pImpl->m_pDrawingArea, ++ nDocumentWidthPixels, ++ nDocumentHeightPixels); + + if ( pDocView->m_pImpl->m_pDocument ) + pDocView->m_pImpl->renderDocument(0); +-- +2.12.0 + diff --git a/SOURCES/0021-lokdocview-fix-render-calls-after-LOK-callbacks.patch b/SOURCES/0021-lokdocview-fix-render-calls-after-LOK-callbacks.patch new file mode 100644 index 0000000..9140e58 --- /dev/null +++ b/SOURCES/0021-lokdocview-fix-render-calls-after-LOK-callbacks.patch @@ -0,0 +1,51 @@ +From 0dec0cdd711d87ec1741b4b66e8060d2f13a4496 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Sat, 6 Jun 2015 00:36:54 +0530 +Subject: [PATCH 021/398] lokdocview: fix render calls after LOK callbacks + +Change-Id: Ib33f0e1dcf257350be1e2cf6c49cd92494472a55 +(cherry picked from commit 085f31a435eed43e3b7927e10309ddd00fb5b9a5) +--- + libreofficekit/source/gtk/lokdocview.cxx | 10 +++------- + 1 file changed, 3 insertions(+), 7 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 42dd14cb34ed..6c3176783953 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -949,21 +949,18 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback) + { + GdkRectangle aRectangle = LOKDocView_Impl::payloadToRectangle(pCallback->m_aPayload.c_str()); + setTilesInvalid(aRectangle); +- renderDocument(0); + } + else +- { + m_pTileBuffer->resetAllTiles(); +- renderDocument(0); +- } ++ ++ gtk_widget_queue_draw(m_pDrawingArea); + } + break; + case LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR: + { + m_aVisibleCursor = LOKDocView_Impl::payloadToRectangle(pCallback->m_aPayload.c_str()); + m_bCursorOverlayVisible = true; +- setTilesInvalid(m_aVisibleCursor); +- renderDocument(0); ++ gtk_widget_queue_draw(m_pDrawingArea); + } + break; + case LOK_CALLBACK_TEXT_SELECTION: +@@ -1030,7 +1027,6 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback) + gtk_widget_set_size_request(m_pDrawingArea, + twipToPixel(m_nDocumentWidthTwips, m_fZoom), + twipToPixel(m_nDocumentHeightTwips, m_fZoom)); +- m_pTileBuffer->resetAllTiles(); + } + break; + case LOK_CALLBACK_SET_PART: +-- +2.12.0 + diff --git a/SOURCES/0022-lokdocview-Let-G_BEGIN-END_DECLS-handle-the-compiler.patch b/SOURCES/0022-lokdocview-Let-G_BEGIN-END_DECLS-handle-the-compiler.patch new file mode 100644 index 0000000..b513c24 --- /dev/null +++ b/SOURCES/0022-lokdocview-Let-G_BEGIN-END_DECLS-handle-the-compiler.patch @@ -0,0 +1,43 @@ +From 0cb9d5c152804c2cdcd173acb99d7870912d6f26 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Sat, 6 Jun 2015 02:07:31 +0530 +Subject: [PATCH 022/398] lokdocview: Let G_BEGIN/END_DECLS handle the compiler + check + +Change-Id: I8c60c9ba13516fc2b3a926c19b41ee19805d74a5 +(cherry picked from commit 1493e66bfbceb2e57d069c0a0dbcfa64f7043da9) +--- + include/LibreOfficeKit/LibreOfficeKitGtk.h | 10 +++------- + 1 file changed, 3 insertions(+), 7 deletions(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h +index b3e50d31b01d..9668904b0230 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h ++++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h +@@ -16,10 +16,7 @@ + #define LOK_USE_UNSTABLE_API + #include + +-#ifdef __cplusplus +-extern "C" +-{ +-#endif ++G_BEGIN_DECLS + + #define LOK_DOCVIEW(obj) GTK_CHECK_CAST (obj, lok_docview_get_type(), LOKDocView) + #define LOK_DOCVIEW_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, lok_docview_get_type(), LOKDocViewClass) +@@ -77,9 +74,8 @@ void lok_docview_post_key (GtkWidget* pWidget, GdkEventKey* pEvent + + /// Get the visible area of the document (in twips). + void lok_docview_get_visarea(LOKDocView* pThis, GdkRectangle* pArea); +-#ifdef __cplusplus +-} +-#endif ++ ++G_END_DECLS + + #endif // INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKITGTK_H + +-- +2.12.0 + diff --git a/SOURCES/0023-lokdocview-Lets-follow-the-GObject-naming-convention.patch b/SOURCES/0023-lokdocview-Lets-follow-the-GObject-naming-convention.patch new file mode 100644 index 0000000..ee51df8 --- /dev/null +++ b/SOURCES/0023-lokdocview-Lets-follow-the-GObject-naming-convention.patch @@ -0,0 +1,537 @@ +From 414256913a71a94430f53f34093c75740754e037 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Sat, 6 Jun 2015 02:32:54 +0530 +Subject: [PATCH 023/398] lokdocview: Lets follow the GObject naming convention + +If we are mentioning this type as DocView, we should break it at each +capital letter. + +Change-Id: I76c7eea455281e541b2196a03778018aa127cebe +(cherry picked from commit c8caa803b43d7091318f1129b7b4cc7ee417c336) +--- + include/LibreOfficeKit/LibreOfficeKitGtk.h | 38 +++++----- + .../qa/gtktiledviewer/gtktiledviewer.cxx | 52 +++++++------- + libreofficekit/source/gtk/lokdocview.cxx | 84 +++++++++++----------- + 3 files changed, 87 insertions(+), 87 deletions(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h +index 9668904b0230..069c565435bb 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h ++++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h +@@ -18,9 +18,9 @@ + + G_BEGIN_DECLS + +-#define LOK_DOCVIEW(obj) GTK_CHECK_CAST (obj, lok_docview_get_type(), LOKDocView) +-#define LOK_DOCVIEW_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, lok_docview_get_type(), LOKDocViewClass) +-#define IS_LOK_DOCVIEW(obj) GTK_CHECK_TYPE (obj, lok_docview_get_type()) ++#define LOK_DOC_VIEW(obj) GTK_CHECK_CAST (obj, lok_doc_view_get_type(), LOKDocView) ++#define LOK_DOC_VIEW_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, lok_doc_view_get_type(), LOKDocViewClass) ++#define IS_LOK_DOC_VIEW(obj) GTK_CHECK_TYPE (obj, lok_doc_view_get_type()) + + typedef struct _LOKDocView LOKDocView; + typedef struct _LOKDocViewClass LOKDocViewClass; +@@ -40,40 +40,40 @@ struct _LOKDocViewClass + void (* part_changed) (LOKDocView* pView, int new_part); + }; + +-guint lok_docview_get_type (void); +-GtkWidget* lok_docview_new ( LibreOfficeKit* pOffice ); +-gboolean lok_docview_open_document (LOKDocView* pDocView, ++guint lok_doc_view_get_type (void); ++GtkWidget* lok_doc_view_new ( LibreOfficeKit* pOffice ); ++gboolean lok_doc_view_open_document (LOKDocView* pDocView, + char* pPath); + + /// Gets the document the viewer displays. +-LibreOfficeKitDocument* lok_docview_get_document(LOKDocView* pDocView); ++LibreOfficeKitDocument* lok_doc_view_get_document(LOKDocView* pDocView); + +-void lok_docview_set_zoom (LOKDocView* pDocView, ++void lok_doc_view_set_zoom (LOKDocView* pDocView, + float fZoom); +-float lok_docview_get_zoom (LOKDocView* pDocView); ++float lok_doc_view_get_zoom (LOKDocView* pDocView); + +-int lok_docview_get_parts (LOKDocView* pDocView); +-int lok_docview_get_part (LOKDocView* pDocView); +-void lok_docview_set_part (LOKDocView* pDocView, ++int lok_doc_view_get_parts (LOKDocView* pDocView); ++int lok_doc_view_get_part (LOKDocView* pDocView); ++void lok_doc_view_set_part (LOKDocView* pDocView, + int nPart); +-char* lok_docview_get_part_name (LOKDocView* pDocView, ++char* lok_doc_view_get_part_name (LOKDocView* pDocView, + int nPart); +-void lok_docview_set_partmode (LOKDocView* pDocView, ++void lok_doc_view_set_partmode (LOKDocView* pDocView, + int nPartMode); + /// Sets if the viewer is actually an editor or not. +-void lok_docview_set_edit (LOKDocView* pDocView, ++void lok_doc_view_set_edit (LOKDocView* pDocView, + gboolean bEdit); + /// Gets if the viewer is actually an editor or not. +-gboolean lok_docview_get_edit (LOKDocView* pDocView); ++gboolean lok_doc_view_get_edit (LOKDocView* pDocView); + + /// Posts the .uno: command to the LibreOfficeKit. +-void lok_docview_post_command (LOKDocView* pDocView, const char* pCommand, const char* pArguments); ++void lok_doc_view_post_command (LOKDocView* pDocView, const char* pCommand, const char* pArguments); + + /// Posts a keyboard event to LibreOfficeKit. +-void lok_docview_post_key (GtkWidget* pWidget, GdkEventKey* pEvent, gpointer pData); ++void lok_doc_view_post_key (GtkWidget* pWidget, GdkEventKey* pEvent, gpointer pData); + + /// Get the visible area of the document (in twips). +-void lok_docview_get_visarea(LOKDocView* pThis, GdkRectangle* pArea); ++void lok_doc_view_get_visarea(LOKDocView* pThis, GdkRectangle* pArea); + + G_END_DECLS + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index d20f43d90627..38b29ee40a3b 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -71,7 +71,7 @@ static void changeZoom( GtkWidget* pButton, gpointer /* pItem */ ) + + if ( pDocView ) + { +- fCurrentZoom = lok_docview_get_zoom( LOK_DOCVIEW(pDocView) ); ++ fCurrentZoom = lok_doc_view_get_zoom( LOK_DOC_VIEW(pDocView) ); + } + + if ( strcmp(sName, "gtk-zoom-in") == 0) +@@ -104,7 +104,7 @@ static void changeZoom( GtkWidget* pButton, gpointer /* pItem */ ) + { + if ( pDocView ) + { +- lok_docview_set_zoom( LOK_DOCVIEW(pDocView), fZoom ); ++ lok_doc_view_set_zoom( LOK_DOC_VIEW(pDocView), fZoom ); + } + } + } +@@ -112,10 +112,10 @@ static void changeZoom( GtkWidget* pButton, gpointer /* pItem */ ) + /// User clicked on the button -> inform LOKDocView. + static void toggleEditing(GtkWidget* /*pButton*/, gpointer /*pItem*/) + { +- LOKDocView* pLOKDocView = LOK_DOCVIEW(pDocView); ++ LOKDocView* pLOKDocView = LOK_DOC_VIEW(pDocView); + bool bActive = gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(pEnableEditing)); +- if (bool(lok_docview_get_edit(pLOKDocView)) != bActive) +- lok_docview_set_edit(pLOKDocView, bActive); ++ if (bool(lok_doc_view_get_edit(pLOKDocView)) != bActive) ++ lok_doc_view_set_edit(pLOKDocView, bActive); + } + + /// Toggle the visibility of the findbar. +@@ -137,11 +137,11 @@ static void toggleFindbar(GtkWidget* /*pButton*/, gpointer /*pItem*/) + /// Handles the key-press-event of the window. + static gboolean signalKey(GtkWidget* pWidget, GdkEventKey* pEvent, gpointer pData) + { +- LOKDocView* pLOKDocView = LOK_DOCVIEW(pDocView); ++ LOKDocView* pLOKDocView = LOK_DOC_VIEW(pDocView); + #if GTK_CHECK_VERSION(2,18,0) // we need gtk_widget_get_visible() +- if (!gtk_widget_get_visible(pFindbar) && bool(lok_docview_get_edit(pLOKDocView))) ++ if (!gtk_widget_get_visible(pFindbar) && bool(lok_doc_view_get_edit(pLOKDocView))) + { +- lok_docview_post_key(pWidget, pEvent, pData); ++ lok_doc_view_post_key(pWidget, pEvent, pData); + return TRUE; + } + #endif +@@ -159,9 +159,9 @@ static void doSearch(bool bBackwards) + aTree.put(boost::property_tree::ptree::path_type("SearchItem.Backward/type", '/'), "boolean"); + aTree.put(boost::property_tree::ptree::path_type("SearchItem.Backward/value", '/'), bBackwards); + +- LOKDocView* pLOKDocView = LOK_DOCVIEW(pDocView); ++ LOKDocView* pLOKDocView = LOK_DOC_VIEW(pDocView); + GdkRectangle aArea; +- lok_docview_get_visarea(pLOKDocView, &aArea); ++ lok_doc_view_get_visarea(pLOKDocView, &aArea); + aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchStartPointX/type", '/'), "long"); + aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchStartPointX/value", '/'), aArea.x); + aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchStartPointY/type", '/'), "long"); +@@ -170,7 +170,7 @@ static void doSearch(bool bBackwards) + std::stringstream aStream; + boost::property_tree::write_json(aStream, aTree); + +- lok_docview_post_command(pLOKDocView, ".uno:ExecuteSearch", aStream.str().c_str()); ++ lok_doc_view_post_command(pLOKDocView, ".uno:ExecuteSearch", aStream.str().c_str()); + } + + /// Click handler for the search next button. +@@ -210,8 +210,8 @@ static gboolean signalFindbar(GtkWidget* /*pWidget*/, GdkEventKey* pEvent, gpoin + /// LOKDocView changed edit state -> inform the tool button. + static void signalEdit(LOKDocView* pLOKDocView, gboolean bWasEdit, gpointer /*pData*/) + { +- gboolean bEdit = lok_docview_get_edit(pLOKDocView); +- g_info("signalEdit: %d -> %d", bWasEdit, lok_docview_get_edit(pLOKDocView)); ++ gboolean bEdit = lok_doc_view_get_edit(pLOKDocView); ++ g_info("signalEdit: %d -> %d", bWasEdit, lok_doc_view_get_edit(pLOKDocView)); + if (gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(pEnableEditing)) != bEdit) + gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(pEnableEditing), bEdit); + } +@@ -233,7 +233,7 @@ static void signalCommand(LOKDocView* /*pLOKDocView*/, char* pPayload, gpointer + gboolean bEdit = aValue == "true"; + if (gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(pItem)) != bEdit) + { +- // Avoid invoking lok_docview_post_command(). ++ // Avoid invoking lok_doc_view_post_command(). + g_bToolItemBroadcast = false; + gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(pItem), bEdit); + g_bToolItemBroadcast = true; +@@ -262,11 +262,11 @@ static void toggleToolItem(GtkWidget* pWidget, gpointer /*pData*/) + { + if (g_bToolItemBroadcast) + { +- LOKDocView* pLOKDocView = LOK_DOCVIEW(pDocView); ++ LOKDocView* pLOKDocView = LOK_DOC_VIEW(pDocView); + GtkToolItem* pItem = GTK_TOOL_ITEM(pWidget); + const std::string& rString = g_aToolItemCommandNames[pItem]; +- g_info("toggleToolItem: lok_docview_post_command('%s')", rString.c_str()); +- lok_docview_post_command(pLOKDocView, rString.c_str(), 0); ++ g_info("toggleToolItem: lok_doc_view_post_command('%s')", rString.c_str()); ++ lok_doc_view_post_command(pLOKDocView, rString.c_str(), 0); + } + } + +@@ -286,10 +286,10 @@ static void populatePartSelector() + const int nMaxLength = 50; + char sText[nMaxLength]; + +- int nParts = lok_docview_get_parts( LOK_DOCVIEW(pDocView) ); ++ int nParts = lok_doc_view_get_parts( LOK_DOC_VIEW(pDocView) ); + for ( int i = 0; i < nParts; i++ ) + { +- char* pName = lok_docview_get_part_name( LOK_DOCVIEW(pDocView), i ); ++ char* pName = lok_doc_view_get_part_name( LOK_DOC_VIEW(pDocView), i ); + assert( pName ); + snprintf( sText, nMaxLength, "%i (%s)", i+1, pName ); + free( pName ); +@@ -297,7 +297,7 @@ static void populatePartSelector() + gtk_combo_box_text_append_text( pPartSelector, sText ); + } + gtk_combo_box_set_active( GTK_COMBO_BOX(pPartSelector), +- lok_docview_get_part( LOK_DOCVIEW(pDocView) ) ); ++ lok_doc_view_get_part( LOK_DOC_VIEW(pDocView) ) ); + } + + static void changePart( GtkWidget* pSelector, gpointer /* pItem */ ) +@@ -306,7 +306,7 @@ static void changePart( GtkWidget* pSelector, gpointer /* pItem */ ) + + if (g_bPartSelectorBroadcast && pDocView) + { +- lok_docview_set_part( LOK_DOCVIEW(pDocView), nPart ); ++ lok_doc_view_set_part( LOK_DOC_VIEW(pDocView), nPart ); + } + } + +@@ -326,7 +326,7 @@ static void changePartMode( GtkWidget* pSelector, gpointer /* pItem */ ) + + if ( pDocView ) + { +- lok_docview_set_partmode( LOK_DOCVIEW(pDocView), ePartMode ); ++ lok_doc_view_set_partmode( LOK_DOC_VIEW(pDocView), ePartMode ); + } + } + #endif +@@ -451,7 +451,7 @@ int main( int argc, char* argv[] ) + gtk_box_pack_end(GTK_BOX(pVBox), pFindbar, FALSE, FALSE, 0); + + // Docview +- pDocView = lok_docview_new( pOffice ); ++ pDocView = lok_doc_view_new( pOffice ); + g_signal_connect(pDocView, "edit-changed", G_CALLBACK(signalEdit), NULL); + g_signal_connect(pDocView, "command-changed", G_CALLBACK(signalCommand), NULL); + g_signal_connect(pDocView, "search-not-found", G_CALLBACK(signalSearch), NULL); +@@ -467,10 +467,10 @@ int main( int argc, char* argv[] ) + // Hide the findbar by default. + gtk_widget_hide(pFindbar); + +- int bOpened = lok_docview_open_document( LOK_DOCVIEW(pDocView), argv[2] ); ++ int bOpened = lok_doc_view_open_document( LOK_DOC_VIEW(pDocView), argv[2] ); + if (!bOpened) +- g_error("main: lok_docview_open_document() failed with '%s'", pOffice->pClass->getError(pOffice)); +- assert(lok_docview_get_document(LOK_DOCVIEW(pDocView))); ++ g_error("main: lok_doc_view_open_document() failed with '%s'", pOffice->pClass->getError(pOffice)); ++ assert(lok_doc_view_get_document(LOK_DOC_VIEW(pDocView))); + + // GtkComboBox requires gtk 2.24 or later + #if ( GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 24 ) || GTK_MAJOR_VERSION > 2 +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 6c3176783953..b1e31887599d 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -123,7 +123,7 @@ struct LOKDocView_Impl + bool m_bInDragGraphicHandles[8]; + ///@} + +- /// Callback data, allocated in lok_docview_callback_worker(), released in lok_docview_callback(). ++ /// Callback data, allocated in lok_doc_view_callback_worker(), released in lok_doc_view_callback(). + struct CallbackData + { + int m_nType; +@@ -305,7 +305,7 @@ void LOKDocView_Impl::destroy(LOKDocView* pDocView, gpointer /*pData*/) + + void LOKDocView_Impl::on_exposed(GtkWidget* /*widget*/, GdkEvent* /*event*/, gpointer userdata) + { +- LOKDocView *pDocView = LOK_DOCVIEW (userdata); ++ LOKDocView *pDocView = LOK_DOC_VIEW (userdata); + pDocView->m_pImpl->renderDocument(0); + } + +@@ -461,7 +461,7 @@ gboolean LOKDocView_Impl::signalButtonImpl(GdkEventButton* pEvent) + } + + if (!m_bEdit) +- lok_docview_set_edit(m_pDocView, TRUE); ++ lok_doc_view_set_edit(m_pDocView, TRUE); + + switch (pEvent->type) + { +@@ -782,7 +782,7 @@ gboolean LOKDocView_Impl::handleTimeoutImpl() + void LOKDocView_Impl::renderDocument(GdkRectangle* pPartial) + { + GdkRectangle visibleArea; +- lok_docview_get_visarea (m_pDocView, &visibleArea); ++ lok_doc_view_get_visarea (m_pDocView, &visibleArea); + + long nDocumentWidthPixels = twipToPixel(m_nDocumentWidthTwips, m_fZoom); + long nDocumentHeightPixels = twipToPixel(m_nDocumentHeightTwips, m_fZoom); +@@ -1058,7 +1058,7 @@ void LOKDocView_Impl::globalCallbackWorker(int nType, const char* pPayload, void + void LOKDocView_Impl::callbackWorkerImpl(int nType, const char* pPayload) + { + LOKDocView_Impl::CallbackData* pCallback = new LOKDocView_Impl::CallbackData(nType, pPayload ? pPayload : "(nil)", m_pDocView); +- g_info("lok_docview_callback_worker: %s, '%s'", LOKDocView_Impl::callbackTypeToString(nType), pPayload); ++ g_info("lok_doc_view_callback_worker: %s, '%s'", LOKDocView_Impl::callbackTypeToString(nType), pPayload); + #if GTK_CHECK_VERSION(2,12,0) + gdk_threads_add_idle(LOKDocView_Impl::callback, pCallback); + #endif +@@ -1082,30 +1082,30 @@ enum + LAST_SIGNAL + }; + +-static guint docview_signals[LAST_SIGNAL] = { 0 }; ++static guint doc_view_signals[LAST_SIGNAL] = { 0 }; + + void LOKDocView_Impl::commandChanged(const std::string& rString) + { +- g_signal_emit(m_pDocView, docview_signals[COMMAND_CHANGED], 0, rString.c_str()); ++ g_signal_emit(m_pDocView, doc_view_signals[COMMAND_CHANGED], 0, rString.c_str()); + } + + void LOKDocView_Impl::searchNotFound(const std::string& rString) + { +- g_signal_emit(m_pDocView, docview_signals[SEARCH_NOT_FOUND], 0, rString.c_str()); ++ g_signal_emit(m_pDocView, doc_view_signals[SEARCH_NOT_FOUND], 0, rString.c_str()); + } + + void LOKDocView_Impl::setPart(const std::string& rString) + { +- g_signal_emit(m_pDocView, docview_signals[PART_CHANGED], 0, std::stoi(rString)); ++ g_signal_emit(m_pDocView, doc_view_signals[PART_CHANGED], 0, std::stoi(rString)); + renderDocument(0); + } + +-static void lok_docview_class_init( gpointer ptr ) ++static void lok_doc_view_class_init( gpointer ptr ) + { + LOKDocViewClass* pClass = static_cast(ptr); + GObjectClass *gobject_class = G_OBJECT_CLASS(pClass); + pClass->edit_changed = NULL; +- docview_signals[EDIT_CHANGED] = ++ doc_view_signals[EDIT_CHANGED] = + g_signal_new("edit-changed", + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_FIRST, +@@ -1115,7 +1115,7 @@ static void lok_docview_class_init( gpointer ptr ) + G_TYPE_NONE, 1, + G_TYPE_BOOLEAN); + pClass->command_changed = NULL; +- docview_signals[COMMAND_CHANGED] = ++ doc_view_signals[COMMAND_CHANGED] = + g_signal_new("command-changed", + G_TYPE_FROM_CLASS(gobject_class), + G_SIGNAL_RUN_FIRST, +@@ -1125,7 +1125,7 @@ static void lok_docview_class_init( gpointer ptr ) + G_TYPE_NONE, 1, + G_TYPE_STRING); + pClass->search_not_found = 0; +- docview_signals[SEARCH_NOT_FOUND] = ++ doc_view_signals[SEARCH_NOT_FOUND] = + g_signal_new("search-not-found", + G_TYPE_FROM_CLASS(gobject_class), + G_SIGNAL_RUN_FIRST, +@@ -1135,7 +1135,7 @@ static void lok_docview_class_init( gpointer ptr ) + G_TYPE_NONE, 1, + G_TYPE_STRING); + pClass->part_changed = 0; +- docview_signals[PART_CHANGED] = ++ doc_view_signals[PART_CHANGED] = + g_signal_new("part-changed", + G_TYPE_FROM_CLASS(gobject_class), + G_SIGNAL_RUN_FIRST, +@@ -1146,7 +1146,7 @@ static void lok_docview_class_init( gpointer ptr ) + G_TYPE_INT); + } + +-static void lok_docview_init( GTypeInstance* pInstance, gpointer ) ++static void lok_doc_view_init( GTypeInstance* pInstance, gpointer ) + { + LOKDocView* pDocView = reinterpret_cast(pInstance); + // Gtk ScrolledWindow is apparently not fully initialised yet, we specifically +@@ -1183,38 +1183,38 @@ static void lok_docview_init( GTypeInstance* pInstance, gpointer ) + g_signal_connect(G_OBJECT(pDocView), "destroy", G_CALLBACK(LOKDocView_Impl::destroy), 0); + } + +-SAL_DLLPUBLIC_EXPORT guint lok_docview_get_type() ++SAL_DLLPUBLIC_EXPORT guint lok_doc_view_get_type() + { +- static guint lok_docview_type = 0; ++ static guint lok_doc_view_type = 0; + +- if (!lok_docview_type) ++ if (!lok_doc_view_type) + { + char pName[] = "LokDocView"; +- GtkTypeInfo lok_docview_info = ++ GtkTypeInfo lok_doc_view_info = + { + pName, + sizeof( LOKDocView ), + sizeof( LOKDocViewClass ), +- lok_docview_class_init, +- lok_docview_init, ++ lok_doc_view_class_init, ++ lok_doc_view_init, + NULL, + NULL, + nullptr + }; + +- lok_docview_type = gtk_type_unique( gtk_scrolled_window_get_type(), &lok_docview_info ); ++ lok_doc_view_type = gtk_type_unique( gtk_scrolled_window_get_type(), &lok_doc_view_info ); + } +- return lok_docview_type; ++ return lok_doc_view_type; + } + +-SAL_DLLPUBLIC_EXPORT GtkWidget* lok_docview_new( LibreOfficeKit* pOffice ) ++SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new( LibreOfficeKit* pOffice ) + { +- LOKDocView* pDocView = LOK_DOCVIEW(gtk_type_new(lok_docview_get_type())); ++ LOKDocView* pDocView = LOK_DOC_VIEW(gtk_type_new(lok_doc_view_get_type())); + pDocView->m_pImpl->m_pOffice = pOffice; + return GTK_WIDGET( pDocView ); + } + +-SAL_DLLPUBLIC_EXPORT gboolean lok_docview_open_document( LOKDocView* pDocView, char* pPath ) ++SAL_DLLPUBLIC_EXPORT gboolean lok_doc_view_open_document( LOKDocView* pDocView, char* pPath ) + { + if ( pDocView->m_pImpl->m_pDocument ) + { +@@ -1260,12 +1260,12 @@ SAL_DLLPUBLIC_EXPORT gboolean lok_docview_open_document( LOKDocView* pDocView, c + return TRUE; + } + +-SAL_DLLPUBLIC_EXPORT LibreOfficeKitDocument* lok_docview_get_document(LOKDocView* pDocView) ++SAL_DLLPUBLIC_EXPORT LibreOfficeKitDocument* lok_doc_view_get_document(LOKDocView* pDocView) + { + return pDocView->m_pImpl->m_pDocument; + } + +-SAL_DLLPUBLIC_EXPORT void lok_docview_set_zoom ( LOKDocView* pDocView, float fZoom ) ++SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_zoom ( LOKDocView* pDocView, float fZoom ) + { + pDocView->m_pImpl->m_fZoom = fZoom; + long nDocumentWidthPixels = twipToPixel(pDocView->m_pImpl->m_nDocumentWidthTwips, fZoom); +@@ -1283,72 +1283,72 @@ SAL_DLLPUBLIC_EXPORT void lok_docview_set_zoom ( LOKDocView* pDocView, float fZo + pDocView->m_pImpl->renderDocument(0); + } + +-SAL_DLLPUBLIC_EXPORT float lok_docview_get_zoom ( LOKDocView* pDocView ) ++SAL_DLLPUBLIC_EXPORT float lok_doc_view_get_zoom ( LOKDocView* pDocView ) + { + return pDocView->m_pImpl->m_fZoom; + } + +-SAL_DLLPUBLIC_EXPORT int lok_docview_get_parts( LOKDocView* pDocView ) ++SAL_DLLPUBLIC_EXPORT int lok_doc_view_get_parts( LOKDocView* pDocView ) + { + return pDocView->m_pImpl->m_pDocument->pClass->getParts( pDocView->m_pImpl->m_pDocument ); + } + +-SAL_DLLPUBLIC_EXPORT int lok_docview_get_part( LOKDocView* pDocView ) ++SAL_DLLPUBLIC_EXPORT int lok_doc_view_get_part( LOKDocView* pDocView ) + { + return pDocView->m_pImpl->m_pDocument->pClass->getPart( pDocView->m_pImpl->m_pDocument ); + } + +-SAL_DLLPUBLIC_EXPORT void lok_docview_set_part( LOKDocView* pDocView, int nPart) ++SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_part( LOKDocView* pDocView, int nPart) + { + pDocView->m_pImpl->m_pDocument->pClass->setPart( pDocView->m_pImpl->m_pDocument, nPart ); + } + +-SAL_DLLPUBLIC_EXPORT char* lok_docview_get_part_name( LOKDocView* pDocView, int nPart ) ++SAL_DLLPUBLIC_EXPORT char* lok_doc_view_get_part_name( LOKDocView* pDocView, int nPart ) + { + return pDocView->m_pImpl->m_pDocument->pClass->getPartName( pDocView->m_pImpl->m_pDocument, nPart ); + } + +-SAL_DLLPUBLIC_EXPORT void lok_docview_set_partmode( LOKDocView* pDocView, ++SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_partmode( LOKDocView* pDocView, + int nPartMode ) + { + pDocView->m_pImpl->m_pDocument->pClass->setPartMode( pDocView->m_pImpl->m_pDocument, nPartMode ); + pDocView->m_pImpl->renderDocument(0); + } + +-SAL_DLLPUBLIC_EXPORT void lok_docview_set_edit( LOKDocView* pDocView, ++SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_edit( LOKDocView* pDocView, + gboolean bEdit ) + { + gboolean bWasEdit = pDocView->m_pImpl->m_bEdit; + + if (!pDocView->m_pImpl->m_bEdit && bEdit) +- g_info("lok_docview_set_edit: entering edit mode"); ++ g_info("lok_doc_view_set_edit: entering edit mode"); + else if (pDocView->m_pImpl->m_bEdit && !bEdit) + { +- g_info("lok_docview_set_edit: leaving edit mode"); ++ g_info("lok_doc_view_set_edit: leaving edit mode"); + pDocView->m_pImpl->m_pDocument->pClass->resetSelection(pDocView->m_pImpl->m_pDocument); + } + pDocView->m_pImpl->m_bEdit = bEdit; +- g_signal_emit(pDocView, docview_signals[EDIT_CHANGED], 0, bWasEdit); ++ g_signal_emit(pDocView, doc_view_signals[EDIT_CHANGED], 0, bWasEdit); + gtk_widget_queue_draw(GTK_WIDGET(pDocView->m_pImpl->m_pDrawingArea)); + } + +-SAL_DLLPUBLIC_EXPORT gboolean lok_docview_get_edit(LOKDocView* pDocView) ++SAL_DLLPUBLIC_EXPORT gboolean lok_doc_view_get_edit(LOKDocView* pDocView) + { + return pDocView->m_pImpl->m_bEdit; + } + +-SAL_DLLPUBLIC_EXPORT void lok_docview_post_command(LOKDocView* pDocView, const char* pCommand, const char* pArguments) ++SAL_DLLPUBLIC_EXPORT void lok_doc_view_post_command(LOKDocView* pDocView, const char* pCommand, const char* pArguments) + { + pDocView->m_pImpl->m_pDocument->pClass->postUnoCommand(pDocView->m_pImpl->m_pDocument, pCommand, pArguments); + } + +-SAL_DLLPUBLIC_EXPORT void lok_docview_post_key(GtkWidget* /*pWidget*/, GdkEventKey* pEvent, gpointer pData) ++SAL_DLLPUBLIC_EXPORT void lok_doc_view_post_key(GtkWidget* /*pWidget*/, GdkEventKey* pEvent, gpointer pData) + { + LOKDocView* pDocView = static_cast(pData); + pDocView->m_pImpl->signalKey(pEvent); + } + +-SAL_DLLPUBLIC_EXPORT void lok_docview_get_visarea(LOKDocView* pThis, GdkRectangle* pArea) ++SAL_DLLPUBLIC_EXPORT void lok_doc_view_get_visarea(LOKDocView* pThis, GdkRectangle* pArea) + { + float zoom = pThis->m_pImpl->m_fZoom; + GtkAdjustment* pHAdjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(pThis)); +-- +2.12.0 + diff --git a/SOURCES/0024-lokdocview-Modernise-LOKDocView-as-GObject.patch b/SOURCES/0024-lokdocview-Modernise-LOKDocView-as-GObject.patch new file mode 100644 index 0000000..8b38cd8 --- /dev/null +++ b/SOURCES/0024-lokdocview-Modernise-LOKDocView-as-GObject.patch @@ -0,0 +1,252 @@ +From 9d8fd399aa92d5bcfc11399f296ed2ffdd741286 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Sat, 6 Jun 2015 03:10:31 +0530 +Subject: [PATCH 024/398] lokdocview: Modernise LOKDocView as GObject + +Change-Id: I3bbd07ce8163890f9b88567966622dd4fbe9d94d +(cherry picked from commit c5f1f7ad2710914fdd6645dd8ce958c70d1d8381) +--- + include/LibreOfficeKit/LibreOfficeKitGtk.h | 63 ++++++++++--------- + libreofficekit/source/gtk/lokdocview.cxx | 97 +++++++++++++----------------- + 2 files changed, 77 insertions(+), 83 deletions(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h +index 069c565435bb..747e45e531f9 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h ++++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h +@@ -18,9 +18,13 @@ + + G_BEGIN_DECLS + +-#define LOK_DOC_VIEW(obj) GTK_CHECK_CAST (obj, lok_doc_view_get_type(), LOKDocView) +-#define LOK_DOC_VIEW_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, lok_doc_view_get_type(), LOKDocViewClass) +-#define IS_LOK_DOC_VIEW(obj) GTK_CHECK_TYPE (obj, lok_doc_view_get_type()) ++#define LOK_TYPE_DOC_VIEW (lok_doc_view_get_type()) ++#define LOK_DOC_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LOK_TYPE_DOC_VIEW, LOKDocView)) ++#define LOK_IS_DOC_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LOK_TYPE_DOC_VIEW)) ++#define LOK_DOC_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LOK_TYPE_DOC_VIEW, LOKDocViewClass)) ++#define LOK_IS_DOC_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), LOK_TYPE_DOC_VIEW)) ++#define LOK_DOC_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), LOK_TYPE_DOC_VIEW, LOKDocViewClass)) ++ + + typedef struct _LOKDocView LOKDocView; + typedef struct _LOKDocViewClass LOKDocViewClass; +@@ -40,40 +44,45 @@ struct _LOKDocViewClass + void (* part_changed) (LOKDocView* pView, int new_part); + }; + +-guint lok_doc_view_get_type (void); +-GtkWidget* lok_doc_view_new ( LibreOfficeKit* pOffice ); +-gboolean lok_doc_view_open_document (LOKDocView* pDocView, +- char* pPath); ++GType lok_doc_view_get_type (void); ++GtkWidget* lok_doc_view_new (LibreOfficeKit* pOffice ); ++gboolean lok_doc_view_open_document (LOKDocView* pDocView, ++ char* pPath); + + /// Gets the document the viewer displays. +-LibreOfficeKitDocument* lok_doc_view_get_document(LOKDocView* pDocView); +- +-void lok_doc_view_set_zoom (LOKDocView* pDocView, +- float fZoom); +-float lok_doc_view_get_zoom (LOKDocView* pDocView); +- +-int lok_doc_view_get_parts (LOKDocView* pDocView); +-int lok_doc_view_get_part (LOKDocView* pDocView); +-void lok_doc_view_set_part (LOKDocView* pDocView, +- int nPart); +-char* lok_doc_view_get_part_name (LOKDocView* pDocView, +- int nPart); +-void lok_doc_view_set_partmode (LOKDocView* pDocView, +- int nPartMode); ++LibreOfficeKitDocument* lok_doc_view_get_document (LOKDocView* pDocView); ++ ++void lok_doc_view_set_zoom (LOKDocView* pDocView, ++ float fZoom); ++float lok_doc_view_get_zoom (LOKDocView* pDocView); ++ ++int lok_doc_view_get_parts (LOKDocView* pDocView); ++int lok_doc_view_get_part (LOKDocView* pDocView); ++void lok_doc_view_set_part (LOKDocView* pDocView, ++ int nPart); ++char* lok_doc_view_get_part_name (LOKDocView* pDocView, ++ int nPart); ++void lok_doc_view_set_partmode (LOKDocView* pDocView, ++ int nPartMode); + /// Sets if the viewer is actually an editor or not. +-void lok_doc_view_set_edit (LOKDocView* pDocView, +- gboolean bEdit); ++void lok_doc_view_set_edit (LOKDocView* pDocView, ++ gboolean bEdit); + /// Gets if the viewer is actually an editor or not. +-gboolean lok_doc_view_get_edit (LOKDocView* pDocView); ++gboolean lok_doc_view_get_edit (LOKDocView* pDocView); + + /// Posts the .uno: command to the LibreOfficeKit. +-void lok_doc_view_post_command (LOKDocView* pDocView, const char* pCommand, const char* pArguments); ++void lok_doc_view_post_command (LOKDocView* pDocView, ++ const char* pCommand, ++ const char* pArguments); + + /// Posts a keyboard event to LibreOfficeKit. +-void lok_doc_view_post_key (GtkWidget* pWidget, GdkEventKey* pEvent, gpointer pData); ++void lok_doc_view_post_key (GtkWidget* pWidget, ++ GdkEventKey* pEvent, ++ gpointer pData); + + /// Get the visible area of the document (in twips). +-void lok_doc_view_get_visarea(LOKDocView* pThis, GdkRectangle* pArea); ++void lok_doc_view_get_visarea (LOKDocView* pThis, ++ GdkRectangle* pArea); + + G_END_DECLS + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index b1e31887599d..9b09ef6452bb 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -37,26 +37,6 @@ + // Number of handles around a graphic selection. + #define GRAPHIC_HANDLE_COUNT 8 + +-namespace { +- +-/// Sets rWidth and rHeight from a "width, height" string. +-void payloadToSize(const char* pPayload, long& rWidth, long& rHeight) +-{ +- rWidth = rHeight = 0; +- gchar** ppCoordinates = g_strsplit(pPayload, ", ", 2); +- gchar** ppCoordinate = ppCoordinates; +- if (!*ppCoordinate) +- return; +- rWidth = atoi(*ppCoordinate); +- ++ppCoordinate; +- if (!*ppCoordinate) +- return; +- rHeight = atoi(*ppCoordinate); +- g_strfreev(ppCoordinates); +-} +- +-} +- + /// Holds data used by LOKDocView only. + struct LOKDocView_Impl + { +@@ -216,6 +196,44 @@ struct LOKDocView_Impl + void setTilesInvalid(const GdkRectangle& rRectangle); + }; + ++enum ++{ ++ EDIT_CHANGED, ++ COMMAND_CHANGED, ++ SEARCH_NOT_FOUND, ++ PART_CHANGED, ++ LAST_SIGNAL ++}; ++ ++ ++static guint doc_view_signals[LAST_SIGNAL] = { 0 }; ++ ++ ++G_DEFINE_TYPE(LOKDocView, lok_doc_view, GTK_TYPE_SCROLLED_WINDOW) ++ ++ ++namespace { ++ ++/// Sets rWidth and rHeight from a "width, height" string. ++void payloadToSize(const char* pPayload, long& rWidth, long& rHeight) ++{ ++ rWidth = rHeight = 0; ++ gchar** ppCoordinates = g_strsplit(pPayload, ", ", 2); ++ gchar** ppCoordinate = ppCoordinates; ++ if (!*ppCoordinate) ++ return; ++ rWidth = atoi(*ppCoordinate); ++ ++ppCoordinate; ++ if (!*ppCoordinate) ++ return; ++ rHeight = atoi(*ppCoordinate); ++ g_strfreev(ppCoordinates); ++} ++ ++} ++ ++ ++ + namespace { + + /// Implementation of the global callback handler, invoked by globalCallback(); +@@ -1073,16 +1091,7 @@ void LOKDocView_Impl::globalCallbackWorkerImpl(int nType, const char* pPayload) + #endif + } + +-enum +-{ +- EDIT_CHANGED, +- COMMAND_CHANGED, +- SEARCH_NOT_FOUND, +- PART_CHANGED, +- LAST_SIGNAL +-}; + +-static guint doc_view_signals[LAST_SIGNAL] = { 0 }; + + void LOKDocView_Impl::commandChanged(const std::string& rString) + { +@@ -1100,9 +1109,8 @@ void LOKDocView_Impl::setPart(const std::string& rString) + renderDocument(0); + } + +-static void lok_doc_view_class_init( gpointer ptr ) ++static void lok_doc_view_class_init (LOKDocViewClass* pClass) + { +- LOKDocViewClass* pClass = static_cast(ptr); + GObjectClass *gobject_class = G_OBJECT_CLASS(pClass); + pClass->edit_changed = NULL; + doc_view_signals[EDIT_CHANGED] = +@@ -1146,9 +1154,8 @@ static void lok_doc_view_class_init( gpointer ptr ) + G_TYPE_INT); + } + +-static void lok_doc_view_init( GTypeInstance* pInstance, gpointer ) ++static void lok_doc_view_init (LOKDocView* pDocView) + { +- LOKDocView* pDocView = reinterpret_cast(pInstance); + // Gtk ScrolledWindow is apparently not fully initialised yet, we specifically + // have to set the [hv]adjustment to prevent GTK assertions from firing, see + // https://bugzilla.gnome.org/show_bug.cgi?id=438114 for more info. +@@ -1183,29 +1190,7 @@ static void lok_doc_view_init( GTypeInstance* pInstance, gpointer ) + g_signal_connect(G_OBJECT(pDocView), "destroy", G_CALLBACK(LOKDocView_Impl::destroy), 0); + } + +-SAL_DLLPUBLIC_EXPORT guint lok_doc_view_get_type() +-{ +- static guint lok_doc_view_type = 0; +- +- if (!lok_doc_view_type) +- { +- char pName[] = "LokDocView"; +- GtkTypeInfo lok_doc_view_info = +- { +- pName, +- sizeof( LOKDocView ), +- sizeof( LOKDocViewClass ), +- lok_doc_view_class_init, +- lok_doc_view_init, +- NULL, +- NULL, +- nullptr +- }; +- +- lok_doc_view_type = gtk_type_unique( gtk_scrolled_window_get_type(), &lok_doc_view_info ); +- } +- return lok_doc_view_type; +-} ++SAL_DLLPUBLIC_EXPORT GType lok_doc_view_get_type(); + + SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new( LibreOfficeKit* pOffice ) + { +-- +2.12.0 + diff --git a/SOURCES/0025-lokdocview-mark-_get_type-with-const-function-attrib.patch b/SOURCES/0025-lokdocview-mark-_get_type-with-const-function-attrib.patch new file mode 100644 index 0000000..54d6de1 --- /dev/null +++ b/SOURCES/0025-lokdocview-mark-_get_type-with-const-function-attrib.patch @@ -0,0 +1,31 @@ +From e00227ccfd0028fdc00683166217541df4685f94 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Sun, 7 Jun 2015 22:28:01 +0530 +Subject: [PATCH 025/398] lokdocview: mark *_get_type() with const function + attribute + +Use G_GNUC_CONST that adds const function attribute to +lok_doc_view_get_type() for better performance. + +Change-Id: Id79f0395a98c4f98b46303e9b5ee1e103fbe331f +(cherry picked from commit 0e947f33130c55881035e39dcb1c5e64c33297e9) +--- + include/LibreOfficeKit/LibreOfficeKitGtk.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h +index 747e45e531f9..e84feee9bd57 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h ++++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h +@@ -44,7 +44,7 @@ struct _LOKDocViewClass + void (* part_changed) (LOKDocView* pView, int new_part); + }; + +-GType lok_doc_view_get_type (void); ++GType lok_doc_view_get_type (void) G_GNUC_CONST; + GtkWidget* lok_doc_view_new (LibreOfficeKit* pOffice ); + gboolean lok_doc_view_open_document (LOKDocView* pDocView, + char* pPath); +-- +2.12.0 + diff --git a/SOURCES/0026-libreofficekit-fix-RHEL5-build-of-tilebuffer.patch b/SOURCES/0026-libreofficekit-fix-RHEL5-build-of-tilebuffer.patch new file mode 100644 index 0000000..047b01e --- /dev/null +++ b/SOURCES/0026-libreofficekit-fix-RHEL5-build-of-tilebuffer.patch @@ -0,0 +1,50 @@ +From 0fb343d2b27c75fa77b5a740c7e7cf53c2ecbe1e Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Mon, 8 Jun 2015 08:02:37 +0200 +Subject: [PATCH 026/398] libreofficekit: fix RHEL5 build of tilebuffer + +Change-Id: I27da86c774f0450c844e742563c4a8de3f23ad34 +(cherry picked from commit a0ce0dd519ec298bf7df0111dca1e1c6fdc3a1ee) +--- + libreofficekit/source/gtk/lokdocview.cxx | 2 ++ + libreofficekit/source/gtk/tilebuffer.cxx | 4 ++++ + 2 files changed, 6 insertions(+) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 9b09ef6452bb..a5cf7aaac741 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -1335,6 +1335,7 @@ SAL_DLLPUBLIC_EXPORT void lok_doc_view_post_key(GtkWidget* /*pWidget*/, GdkEvent + + SAL_DLLPUBLIC_EXPORT void lok_doc_view_get_visarea(LOKDocView* pThis, GdkRectangle* pArea) + { ++#if GTK_CHECK_VERSION(2,14,0) // we need gtk_adjustment_get_page_size() + float zoom = pThis->m_pImpl->m_fZoom; + GtkAdjustment* pHAdjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(pThis)); + pArea->x = pixelToTwip(gtk_adjustment_get_value(pHAdjustment),zoom); +@@ -1342,6 +1343,7 @@ SAL_DLLPUBLIC_EXPORT void lok_doc_view_get_visarea(LOKDocView* pThis, GdkRectang + GtkAdjustment* pVAdjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(pThis)); + pArea->y = pixelToTwip(gtk_adjustment_get_value(pVAdjustment), zoom); + pArea->height = pixelToTwip(gtk_adjustment_get_page_size(pVAdjustment), zoom); ++#endif + } + + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +diff --git a/libreofficekit/source/gtk/tilebuffer.cxx b/libreofficekit/source/gtk/tilebuffer.cxx +index 338038078ab3..0c798232326b 100644 +--- a/libreofficekit/source/gtk/tilebuffer.cxx ++++ b/libreofficekit/source/gtk/tilebuffer.cxx +@@ -9,6 +9,10 @@ + + #include "tilebuffer.hxx" + ++#if !GLIB_CHECK_VERSION(2,40,0) ++#define g_info(...) g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, __VA_ARGS__) ++#endif ++ + /* ------------------ + Utility functions + ------------------ +-- +2.12.0 + diff --git a/SOURCES/0027-lokdocview-Make-tilebuffer-an-instance.patch b/SOURCES/0027-lokdocview-Make-tilebuffer-an-instance.patch new file mode 100644 index 0000000..e087866 --- /dev/null +++ b/SOURCES/0027-lokdocview-Make-tilebuffer-an-instance.patch @@ -0,0 +1,155 @@ +From bcb1637523f79f0b26bb28d4304969eb95a09944 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Mon, 8 Jun 2015 14:17:17 +0530 +Subject: [PATCH 027/398] lokdocview: Make tilebuffer an instance + +Change-Id: I06dae2e7a5067160326f4c65f5975c4e5afb05ce +(cherry picked from commit 03655e67cbb26a6a7b8da4b5e5a18eae4742b412) +--- + libreofficekit/source/gtk/lokdocview.cxx | 81 +++++++++++++++++--------------- + 1 file changed, 42 insertions(+), 39 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index a5cf7aaac741..2997feddf1d4 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -42,7 +42,7 @@ struct LOKDocView_Impl + { + LOKDocView* m_pDocView; + GtkWidget *m_pDrawingArea; +- TileBuffer *m_pTileBuffer; ++ TileBuffer m_aTileBuffer; + + float m_fZoom; + +@@ -192,7 +192,7 @@ struct LOKDocView_Impl + void searchNotFound(const std::string& rPayload); + /// LOK decided to change parts, need to update UI. + void setPart(const std::string& rPayload); +- /// Sets the tiles enclosed by rRectangle as invalid in m_pTileBuffer ++ /// Sets the tiles enclosed by rRectangle as invalid in m_aTileBuffer + void setTilesInvalid(const GdkRectangle& rRectangle); + }; + +@@ -273,35 +273,36 @@ LOKDocView_Impl::CallbackData::CallbackData(int nType, const std::string& rPaylo + + LOKDocView_Impl::LOKDocView_Impl(LOKDocView* pDocView) + : m_pDocView(pDocView), +- m_pDrawingArea(gtk_drawing_area_new()), +- m_fZoom(1), +- m_pOffice(0), +- m_pDocument(0), +- m_nDocumentWidthTwips(0), +- m_nDocumentHeightTwips(0), +- m_bEdit(false), +- m_aVisibleCursor({0, 0, 0, 0}), +- m_bCursorOverlayVisible(false), +- m_bCursorVisible(true), +- m_nLastButtonPressTime(0), +- m_nLastButtonReleaseTime(0), +- m_aTextSelectionStart({0, 0, 0, 0}), +- m_aTextSelectionEnd({0, 0, 0, 0}), +- m_aGraphicSelection({0, 0, 0, 0}), +- m_bInDragGraphicSelection(false), +- +- // Start/middle/end handle. +- m_pHandleStart(0), +- m_aHandleStartRect({0, 0, 0, 0}), +- m_bInDragStartHandle(false), +- m_pHandleMiddle(0), +- m_aHandleMiddleRect({0, 0, 0, 0}), +- m_bInDragMiddleHandle(false), +- m_pHandleEnd(0), +- m_aHandleEndRect({0, 0, 0, 0}), +- m_bInDragEndHandle(false), +- +- m_pGraphicHandle(0) ++ m_pDrawingArea(gtk_drawing_area_new()), ++ m_aTileBuffer(TileBuffer(0,0,0,0)), ++ m_fZoom(1), ++ m_pOffice(0), ++ m_pDocument(0), ++ m_nDocumentWidthTwips(0), ++ m_nDocumentHeightTwips(0), ++ m_bEdit(false), ++ m_aVisibleCursor({0, 0, 0, 0}), ++ m_bCursorOverlayVisible(false), ++ m_bCursorVisible(true), ++ m_nLastButtonPressTime(0), ++ m_nLastButtonReleaseTime(0), ++ m_aTextSelectionStart({0, 0, 0, 0}), ++ m_aTextSelectionEnd({0, 0, 0, 0}), ++ m_aGraphicSelection({0, 0, 0, 0}), ++ m_bInDragGraphicSelection(false), ++ ++ // Start/middle/end handle. ++ m_pHandleStart(0), ++ m_aHandleStartRect({0, 0, 0, 0}), ++ m_bInDragStartHandle(false), ++ m_pHandleMiddle(0), ++ m_aHandleMiddleRect({0, 0, 0, 0}), ++ m_bInDragMiddleHandle(false), ++ m_pHandleEnd(0), ++ m_aHandleEndRect({0, 0, 0, 0}), ++ m_bInDragEndHandle(false), ++ ++ m_pGraphicHandle(0) + { + memset(&m_aGraphicHandleRects, 0, sizeof(m_aGraphicHandleRects)); + memset(&m_bInDragGraphicHandles, 0, sizeof(m_bInDragGraphicHandles)); +@@ -683,7 +684,7 @@ void LOKDocView_Impl::setTilesInvalid(const GdkRectangle& rRectangle) + + for (int i = aStart.x; i < aEnd.x; i++) + for (int j = aStart.y; j < aEnd.y; j++) +- m_pTileBuffer->setInvalid(i, j); ++ m_aTileBuffer.setInvalid(i, j); + } + + void LOKDocView_Impl::renderHandle(cairo_t* pCairo, const GdkRectangle& rCursor, cairo_surface_t* pHandle, GdkRectangle& rRectangle) +@@ -845,7 +846,7 @@ void LOKDocView_Impl::renderDocument(GdkRectangle* pPartial) + { + //g_info("tile_buffer_get_tile (%d, %d)", nRow, nColumn); + +- Tile& currentTile = m_pTileBuffer->getTile(nRow, nColumn); ++ Tile& currentTile = m_aTileBuffer.getTile(nRow, nColumn); + GdkPixbuf* pPixBuf = currentTile.getBuffer(); + + gdk_cairo_set_source_pixbuf (pcairo, pPixBuf, +@@ -969,7 +970,7 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback) + setTilesInvalid(aRectangle); + } + else +- m_pTileBuffer->resetAllTiles(); ++ m_aTileBuffer.resetAllTiles(); + + gtk_widget_queue_draw(m_pDrawingArea); + } +@@ -1232,10 +1233,12 @@ SAL_DLLPUBLIC_EXPORT gboolean lok_doc_view_open_document( LOKDocView* pDocView, + // Total number of rows / columns in this document. + guint nRows = ceil((double)nDocumentHeightPixels / nTileSizePixels); + guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); +- pDocView->m_pImpl->m_pTileBuffer = new TileBuffer(pDocView->m_pImpl->m_pDocument, +- nTileSizePixels, +- nRows, +- nColumns); ++ ++ ++ pDocView->m_pImpl->m_aTileBuffer = TileBuffer(pDocView->m_pImpl->m_pDocument, ++ nTileSizePixels, ++ nRows, ++ nColumns); + gtk_widget_set_size_request(pDocView->m_pImpl->m_pDrawingArea, + nDocumentWidthPixels, + nDocumentHeightPixels); +@@ -1259,7 +1262,7 @@ SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_zoom ( LOKDocView* pDocView, float fZ + guint nRows = ceil((double)nDocumentHeightPixels / nTileSizePixels); + guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); + +- pDocView->m_pImpl->m_pTileBuffer->setZoom(fZoom, nRows, nColumns); ++ pDocView->m_pImpl->m_aTileBuffer.setZoom(fZoom, nRows, nColumns); + gtk_widget_set_size_request(pDocView->m_pImpl->m_pDrawingArea, + nDocumentWidthPixels, + nDocumentHeightPixels); +-- +2.12.0 + diff --git a/SOURCES/0028-tilebuffer-ZoomFactor-as-member-variable-is-superflu.patch b/SOURCES/0028-tilebuffer-ZoomFactor-as-member-variable-is-superflu.patch new file mode 100644 index 0000000..1d81bcd --- /dev/null +++ b/SOURCES/0028-tilebuffer-ZoomFactor-as-member-variable-is-superflu.patch @@ -0,0 +1,133 @@ +From ecbfe4c719be7ed5919a7e6f66388bdb51948cbb Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Mon, 8 Jun 2015 15:08:44 +0530 +Subject: [PATCH 028/398] tilebuffer: ZoomFactor as member variable is + superfluous + +Change-Id: I9f533f577f959c9a715e5214be99ca59cb0d206c +(cherry picked from commit 16222190ec4cf6b83e7771a8d714a7dbb968c42b) +--- + libreofficekit/source/gtk/lokdocview.cxx | 7 +++++-- + libreofficekit/source/gtk/tilebuffer.cxx | 21 +++++---------------- + libreofficekit/source/gtk/tilebuffer.hxx | 14 -------------- + 3 files changed, 10 insertions(+), 32 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 2997feddf1d4..d790b2b43c08 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -846,7 +846,7 @@ void LOKDocView_Impl::renderDocument(GdkRectangle* pPartial) + { + //g_info("tile_buffer_get_tile (%d, %d)", nRow, nColumn); + +- Tile& currentTile = m_aTileBuffer.getTile(nRow, nColumn); ++ Tile& currentTile = m_aTileBuffer.getTile(nRow, nColumn, m_fZoom); + GdkPixbuf* pPixBuf = currentTile.getBuffer(); + + gdk_cairo_set_source_pixbuf (pcairo, pPixBuf, +@@ -1262,7 +1262,10 @@ SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_zoom ( LOKDocView* pDocView, float fZ + guint nRows = ceil((double)nDocumentHeightPixels / nTileSizePixels); + guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); + +- pDocView->m_pImpl->m_aTileBuffer.setZoom(fZoom, nRows, nColumns); ++ pDocView->m_pImpl->m_aTileBuffer = TileBuffer(pDocView->m_pImpl->m_pDocument, ++ nTileSizePixels, ++ nRows, ++ nColumns); + gtk_widget_set_size_request(pDocView->m_pImpl->m_pDrawingArea, + nDocumentWidthPixels, + nDocumentHeightPixels); +diff --git a/libreofficekit/source/gtk/tilebuffer.cxx b/libreofficekit/source/gtk/tilebuffer.cxx +index 0c798232326b..774806bc414d 100644 +--- a/libreofficekit/source/gtk/tilebuffer.cxx ++++ b/libreofficekit/source/gtk/tilebuffer.cxx +@@ -51,17 +51,6 @@ void Tile::setPixbuf(GdkPixbuf *buffer) + TileBuffer class member functions + ---------------------------------- + */ +-void TileBuffer::setZoom(float newZoomFactor, int rows, int columns) +-{ +- m_fZoomFactor = newZoomFactor; +- +- resetAllTiles(); +- +- // set new buffer width and height +- m_nWidth = columns; +- m_nHeight = rows; +-} +- + void TileBuffer::resetAllTiles() + { + std::map::iterator it = m_mTiles.begin(); +@@ -84,7 +73,7 @@ void TileBuffer::setInvalid(int x, int y) + } + } + +-Tile& TileBuffer::getTile(int x, int y) ++Tile& TileBuffer::getTile(int x, int y, float aZoom) + { + int index = x * m_nWidth + y; + if(m_mTiles.find(index) == m_mTiles.end() || !m_mTiles[index].valid) +@@ -99,16 +88,16 @@ Tile& TileBuffer::getTile(int x, int y) + + unsigned char* pBuffer = gdk_pixbuf_get_pixels(pPixBuf); + GdkRectangle aTileRectangle; +- aTileRectangle.x = pixelToTwip(m_nTileSize, m_fZoomFactor) * y; +- aTileRectangle.y = pixelToTwip(m_nTileSize, m_fZoomFactor) * x; ++ aTileRectangle.x = pixelToTwip(m_nTileSize, aZoom) * y; ++ aTileRectangle.y = pixelToTwip(m_nTileSize, aZoom) * x; + + g_info ("Rendering (%d, %d)", x, y); + m_pLOKDocument->pClass->paintTile(m_pLOKDocument, + pBuffer, + m_nTileSize, m_nTileSize, + aTileRectangle.x, aTileRectangle.y, +- pixelToTwip(m_nTileSize, m_fZoomFactor), +- pixelToTwip(m_nTileSize, m_fZoomFactor)); ++ pixelToTwip(m_nTileSize, aZoom), ++ pixelToTwip(m_nTileSize, aZoom)); + + //create a mapping for it + m_mTiles[index].setPixbuf(pPixBuf); +diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx +index 7e2132f4d512..59660042f544 100644 +--- a/libreofficekit/source/gtk/tilebuffer.hxx ++++ b/libreofficekit/source/gtk/tilebuffer.hxx +@@ -88,7 +88,6 @@ class TileBuffer + int columns) + : m_pLOKDocument(document) + , m_nTileSize(tileSize) +- , m_fZoomFactor(1) + , m_nWidth(columns) + , m_nHeight(rows) + { } +@@ -96,17 +95,6 @@ class TileBuffer + ~TileBuffer() {} + + /** +- Sets the zoom factor (m_fZoomFactor) for this tile buffer. Setting the +- zoom factor invalidates whole of the tile buffer, destroys all tiles +- contained within it, and sets new width, height values for tile +- buffer. The width, height value of tile buffer is the width and height of +- the table containing all possible tiles (rendered and non-rendered) that +- this buffer can have. +- +- @param zoomFactor the new zoom factor value to set +- */ +- void setZoom(float zoomFactor, int rows, int columns); +- /** + Gets the underlying Tile object for given position. The position (0, 0) + points to the left top most tile of the buffer. + +@@ -137,8 +125,6 @@ class TileBuffer + LibreOfficeKitDocument *m_pLOKDocument; + /// The side of each squared tile in pixels. + int m_nTileSize; +- /// The zoom factor that the tile buffer is currently rendered to. +- float m_fZoomFactor; + /// Stores all the tiles cached by this tile buffer. + std::map m_mTiles; + /// Width of the current tile buffer (number of columns) +-- +2.12.0 + diff --git a/SOURCES/0029-tilebuffer-tileSize-as-member-variable-is-superfluou.patch b/SOURCES/0029-tilebuffer-tileSize-as-member-variable-is-superfluou.patch new file mode 100644 index 0000000..792d4bb --- /dev/null +++ b/SOURCES/0029-tilebuffer-tileSize-as-member-variable-is-superfluou.patch @@ -0,0 +1,119 @@ +From f72510427d6076b304ed14879b00eb253367e161 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Mon, 8 Jun 2015 15:24:12 +0530 +Subject: [PATCH 029/398] tilebuffer: tileSize as member variable is + superfluous + +Change-Id: I1eae8c96c12ba4d272341f45fee6c1fd66ab9e28 +(cherry picked from commit 2afe94dbfc85cbcde1399267379a466d527998a4) +--- + libreofficekit/source/gtk/lokdocview.cxx | 4 +--- + libreofficekit/source/gtk/tilebuffer.cxx | 12 ++++++------ + libreofficekit/source/gtk/tilebuffer.hxx | 7 ++----- + 3 files changed, 9 insertions(+), 14 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index d790b2b43c08..0124704d6784 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -274,7 +274,7 @@ LOKDocView_Impl::CallbackData::CallbackData(int nType, const std::string& rPaylo + LOKDocView_Impl::LOKDocView_Impl(LOKDocView* pDocView) + : m_pDocView(pDocView), + m_pDrawingArea(gtk_drawing_area_new()), +- m_aTileBuffer(TileBuffer(0,0,0,0)), ++ m_aTileBuffer(TileBuffer(0,0,0)), + m_fZoom(1), + m_pOffice(0), + m_pDocument(0), +@@ -1236,7 +1236,6 @@ SAL_DLLPUBLIC_EXPORT gboolean lok_doc_view_open_document( LOKDocView* pDocView, + + + pDocView->m_pImpl->m_aTileBuffer = TileBuffer(pDocView->m_pImpl->m_pDocument, +- nTileSizePixels, + nRows, + nColumns); + gtk_widget_set_size_request(pDocView->m_pImpl->m_pDrawingArea, +@@ -1263,7 +1262,6 @@ SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_zoom ( LOKDocView* pDocView, float fZ + guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); + + pDocView->m_pImpl->m_aTileBuffer = TileBuffer(pDocView->m_pImpl->m_pDocument, +- nTileSizePixels, + nRows, + nColumns); + gtk_widget_set_size_request(pDocView->m_pImpl->m_pDrawingArea, +diff --git a/libreofficekit/source/gtk/tilebuffer.cxx b/libreofficekit/source/gtk/tilebuffer.cxx +index 774806bc414d..1d6a8b66ec80 100644 +--- a/libreofficekit/source/gtk/tilebuffer.cxx ++++ b/libreofficekit/source/gtk/tilebuffer.cxx +@@ -79,7 +79,7 @@ Tile& TileBuffer::getTile(int x, int y, float aZoom) + if(m_mTiles.find(index) == m_mTiles.end() || !m_mTiles[index].valid) + { + +- GdkPixbuf* pPixBuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, m_nTileSize, m_nTileSize); ++ GdkPixbuf* pPixBuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, nTileSizePixels, nTileSizePixels); + if (!pPixBuf) + { + g_info ("Error allocating memory to pixbuf"); +@@ -88,16 +88,16 @@ Tile& TileBuffer::getTile(int x, int y, float aZoom) + + unsigned char* pBuffer = gdk_pixbuf_get_pixels(pPixBuf); + GdkRectangle aTileRectangle; +- aTileRectangle.x = pixelToTwip(m_nTileSize, aZoom) * y; +- aTileRectangle.y = pixelToTwip(m_nTileSize, aZoom) * x; ++ aTileRectangle.x = pixelToTwip(nTileSizePixels, aZoom) * y; ++ aTileRectangle.y = pixelToTwip(nTileSizePixels, aZoom) * x; + + g_info ("Rendering (%d, %d)", x, y); + m_pLOKDocument->pClass->paintTile(m_pLOKDocument, + pBuffer, +- m_nTileSize, m_nTileSize, ++ nTileSizePixels, nTileSizePixels, + aTileRectangle.x, aTileRectangle.y, +- pixelToTwip(m_nTileSize, aZoom), +- pixelToTwip(m_nTileSize, aZoom)); ++ pixelToTwip(nTileSizePixels, aZoom), ++ pixelToTwip(nTileSizePixels, aZoom)); + + //create a mapping for it + m_mTiles[index].setPixbuf(pPixBuf); +diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx +index 59660042f544..ea8e52452c8d 100644 +--- a/libreofficekit/source/gtk/tilebuffer.hxx ++++ b/libreofficekit/source/gtk/tilebuffer.hxx +@@ -83,11 +83,9 @@ class TileBuffer + { + public: + TileBuffer(LibreOfficeKitDocument *document, +- int tileSize, + int rows, + int columns) + : m_pLOKDocument(document) +- , m_nTileSize(tileSize) + , m_nWidth(columns) + , m_nHeight(rows) + { } +@@ -104,10 +102,11 @@ class TileBuffer + + @param x the tile along the x-axis of the buffer + @param y the tile along the y-axis of the buffer ++ @param aZoom This function needs the zoom factor to draw the tile using paintTile() + + @return the tile at the mentioned position (x, y) + */ +- Tile& getTile(int x, int y); ++ Tile& getTile(int x, int y, float aZoom); + /// Destroys all the tiles in the tile buffer; also frees the memory allocated + /// for all the Tile objects. + void resetAllTiles(); +@@ -123,8 +122,6 @@ class TileBuffer + private: + /// Contains the reference to the LOK Document that this tile buffer is for. + LibreOfficeKitDocument *m_pLOKDocument; +- /// The side of each squared tile in pixels. +- int m_nTileSize; + /// Stores all the tiles cached by this tile buffer. + std::map m_mTiles; + /// Width of the current tile buffer (number of columns) +-- +2.12.0 + diff --git a/SOURCES/0030-Werror-Wunused-private-field.patch b/SOURCES/0030-Werror-Wunused-private-field.patch new file mode 100644 index 0000000..932fa71 --- /dev/null +++ b/SOURCES/0030-Werror-Wunused-private-field.patch @@ -0,0 +1,82 @@ +From 1241127d63bb91f6c901d32525bce8de0da7108a Mon Sep 17 00:00:00 2001 +From: Stephan Bergmann +Date: Tue, 9 Jun 2015 11:42:41 +0200 +Subject: [PATCH 030/398] -Werror,-Wunused-private-field + +Change-Id: I76cf487c66e048b5e9d0877a1b690cd066b73528 +(cherry picked from commit 3a1a5b9744eb73f82c28ecfaa39b54587ef8206b) +--- + libreofficekit/source/gtk/lokdocview.cxx | 10 +++------- + libreofficekit/source/gtk/tilebuffer.hxx | 4 ---- + 2 files changed, 3 insertions(+), 11 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 0124704d6784..90f033c80fe2 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -274,7 +274,7 @@ LOKDocView_Impl::CallbackData::CallbackData(int nType, const std::string& rPaylo + LOKDocView_Impl::LOKDocView_Impl(LOKDocView* pDocView) + : m_pDocView(pDocView), + m_pDrawingArea(gtk_drawing_area_new()), +- m_aTileBuffer(TileBuffer(0,0,0)), ++ m_aTileBuffer(TileBuffer(0,0)), + m_fZoom(1), + m_pOffice(0), + m_pDocument(0), +@@ -1230,13 +1230,11 @@ SAL_DLLPUBLIC_EXPORT gboolean lok_doc_view_open_document( LOKDocView* pDocView, + long nDocumentHeightTwips = pDocView->m_pImpl->m_nDocumentHeightTwips; + long nDocumentWidthPixels = twipToPixel(nDocumentWidthTwips, zoom); + long nDocumentHeightPixels = twipToPixel(nDocumentHeightTwips, zoom); +- // Total number of rows / columns in this document. +- guint nRows = ceil((double)nDocumentHeightPixels / nTileSizePixels); ++ // Total number of columns in this document. + guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); + + + pDocView->m_pImpl->m_aTileBuffer = TileBuffer(pDocView->m_pImpl->m_pDocument, +- nRows, + nColumns); + gtk_widget_set_size_request(pDocView->m_pImpl->m_pDrawingArea, + nDocumentWidthPixels, +@@ -1257,12 +1255,10 @@ SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_zoom ( LOKDocView* pDocView, float fZ + pDocView->m_pImpl->m_fZoom = fZoom; + long nDocumentWidthPixels = twipToPixel(pDocView->m_pImpl->m_nDocumentWidthTwips, fZoom); + long nDocumentHeightPixels = twipToPixel(pDocView->m_pImpl->m_nDocumentHeightTwips, fZoom); +- // Total number of rows / columns in this document. +- guint nRows = ceil((double)nDocumentHeightPixels / nTileSizePixels); ++ // Total number of columns in this document. + guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); + + pDocView->m_pImpl->m_aTileBuffer = TileBuffer(pDocView->m_pImpl->m_pDocument, +- nRows, + nColumns); + gtk_widget_set_size_request(pDocView->m_pImpl->m_pDrawingArea, + nDocumentWidthPixels, +diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx +index ea8e52452c8d..b9bf71b950d5 100644 +--- a/libreofficekit/source/gtk/tilebuffer.hxx ++++ b/libreofficekit/source/gtk/tilebuffer.hxx +@@ -83,11 +83,9 @@ class TileBuffer + { + public: + TileBuffer(LibreOfficeKitDocument *document, +- int rows, + int columns) + : m_pLOKDocument(document) + , m_nWidth(columns) +- , m_nHeight(rows) + { } + + ~TileBuffer() {} +@@ -126,8 +124,6 @@ class TileBuffer + std::map m_mTiles; + /// Width of the current tile buffer (number of columns) + int m_nWidth; +- /// Height of the current tile buffer (numbero of rows) +- int m_nHeight; + }; + + #endif // INCLUDED_TILEBUFFER_HXX +-- +2.12.0 + diff --git a/SOURCES/0031-loplugin-literaltoboolconversion.patch b/SOURCES/0031-loplugin-literaltoboolconversion.patch new file mode 100644 index 0000000..97f941b --- /dev/null +++ b/SOURCES/0031-loplugin-literaltoboolconversion.patch @@ -0,0 +1,50 @@ +From d7998a755c226340bfa287bfb5544a61d030f877 Mon Sep 17 00:00:00 2001 +From: Stephan Bergmann +Date: Tue, 9 Jun 2015 11:48:12 +0200 +Subject: [PATCH 031/398] loplugin:literaltoboolconversion + +Change-Id: I85fa46de5b864369158d047fd3f7c683f10c822f +(cherry picked from commit 9aa9baa78852dda5c348eb0abdbef98db3e910ed) +--- + libreofficekit/source/gtk/tilebuffer.cxx | 4 ++-- + libreofficekit/source/gtk/tilebuffer.hxx | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/libreofficekit/source/gtk/tilebuffer.cxx b/libreofficekit/source/gtk/tilebuffer.cxx +index 1d6a8b66ec80..2c0ee90e08d4 100644 +--- a/libreofficekit/source/gtk/tilebuffer.cxx ++++ b/libreofficekit/source/gtk/tilebuffer.cxx +@@ -67,7 +67,7 @@ void TileBuffer::setInvalid(int x, int y) + g_info("Setting tile invalid (%d, %d)", x, y); + if (m_mTiles.find(index) != m_mTiles.end()) + { +- m_mTiles[index].valid = 0; ++ m_mTiles[index].valid = false; + m_mTiles[index].release(); + m_mTiles.erase(index); + } +@@ -101,7 +101,7 @@ Tile& TileBuffer::getTile(int x, int y, float aZoom) + + //create a mapping for it + m_mTiles[index].setPixbuf(pPixBuf); +- m_mTiles[index].valid = 1; ++ m_mTiles[index].valid = true; + } + + return m_mTiles[index]; +diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx +index b9bf71b950d5..42c6d35b112b 100644 +--- a/libreofficekit/source/gtk/tilebuffer.hxx ++++ b/libreofficekit/source/gtk/tilebuffer.hxx +@@ -51,7 +51,7 @@ float twipToPixel(float fInput, float zoom); + class Tile + { + public: +- Tile() : valid(0) {} ++ Tile() : valid(false) {} + ~Tile() { } + + /** +-- +2.12.0 + diff --git a/SOURCES/0032-loplugin-unreffun.patch b/SOURCES/0032-loplugin-unreffun.patch new file mode 100644 index 0000000..4ef23d2 --- /dev/null +++ b/SOURCES/0032-loplugin-unreffun.patch @@ -0,0 +1,35 @@ +From c1bffef623d683b311ddbbd78be0fc296d5d2739 Mon Sep 17 00:00:00 2001 +From: Stephan Bergmann +Date: Tue, 9 Jun 2015 11:57:56 +0200 +Subject: [PATCH 032/398] loplugin:unreffun + +Change-Id: I2011b491012dfd623ece9fd24a265107ac690cba +(cherry picked from commit 3f0e8bdabed165e09825bc78c55afb968a6d702a) +--- + libreofficekit/source/gtk/lokdocview.cxx | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 90f033c80fe2..137a09b164ce 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -208,9 +208,14 @@ enum + + static guint doc_view_signals[LAST_SIGNAL] = { 0 }; + +- ++#ifdef __GNUC__ ++#pragma GCC diagnostic push ++#pragma GCC diagnostic ignored "-Wunused-function" ++#endif + G_DEFINE_TYPE(LOKDocView, lok_doc_view, GTK_TYPE_SCROLLED_WINDOW) +- ++#ifdef __GNUC__ ++#pragma GCC diagnostic pop ++#endif + + namespace { + +-- +2.12.0 + diff --git a/SOURCES/0033-Werror-Wignored-attributes-attribute-declaration-mus.patch b/SOURCES/0033-Werror-Wignored-attributes-attribute-declaration-mus.patch new file mode 100644 index 0000000..02f5504 --- /dev/null +++ b/SOURCES/0033-Werror-Wignored-attributes-attribute-declaration-mus.patch @@ -0,0 +1,36 @@ +From f06969288e43555c5df8da68110c2e2b14b2bfae Mon Sep 17 00:00:00 2001 +From: Stephan Bergmann +Date: Tue, 9 Jun 2015 11:58:24 +0200 +Subject: [PATCH 033/398] -Werror,-Wignored-attributes ("attribute declaration + must precede definition") + +Change-Id: Iee0e9ef3a623706c33f84c34c1fbbf5b173f7f5d +(cherry picked from commit e52bae937032dd5eac14da1d54b045ad9d787b1f) +--- + libreofficekit/source/gtk/lokdocview.cxx | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 137a09b164ce..138c7f82a38f 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -208,6 +208,7 @@ enum + + static guint doc_view_signals[LAST_SIGNAL] = { 0 }; + ++SAL_DLLPUBLIC_EXPORT GType lok_doc_view_get_type(); + #ifdef __GNUC__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wunused-function" +@@ -1196,8 +1197,6 @@ static void lok_doc_view_init (LOKDocView* pDocView) + g_signal_connect(G_OBJECT(pDocView), "destroy", G_CALLBACK(LOKDocView_Impl::destroy), 0); + } + +-SAL_DLLPUBLIC_EXPORT GType lok_doc_view_get_type(); +- + SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new( LibreOfficeKit* pOffice ) + { + LOKDocView* pDocView = LOK_DOC_VIEW(gtk_type_new(lok_doc_view_get_type())); +-- +2.12.0 + diff --git a/SOURCES/0034-loplugin-unreffun-workaround-for-visibility-adding-r.patch b/SOURCES/0034-loplugin-unreffun-workaround-for-visibility-adding-r.patch new file mode 100644 index 0000000..499fc9c --- /dev/null +++ b/SOURCES/0034-loplugin-unreffun-workaround-for-visibility-adding-r.patch @@ -0,0 +1,37 @@ +From daf4c39780b48ee2d9ade4afccd41e3d7efcbeb4 Mon Sep 17 00:00:00 2001 +From: Stephan Bergmann +Date: Tue, 9 Jun 2015 12:44:12 +0200 +Subject: [PATCH 034/398] loplugin:unreffun: workaround for visibility-adding + redecls + +Change-Id: Ic18b44942f4fe02083c0e8167e8c8d4205e66abf +(cherry picked from commit 623359af236ab8497d4fac34e112a8b9b7b291f2) +--- + compilerplugins/clang/unreffun.cxx | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/compilerplugins/clang/unreffun.cxx b/compilerplugins/clang/unreffun.cxx +index 3b9c616414b3..5295ca4376b0 100644 +--- a/compilerplugins/clang/unreffun.cxx ++++ b/compilerplugins/clang/unreffun.cxx +@@ -87,6 +87,17 @@ bool UnrefFun::VisitFunctionDecl(FunctionDecl const * decl) { + { + Decl const * prev = getPreviousNonFriendDecl(decl); + if (prev != nullptr/* && prev != decl->getPrimaryTemplate()*/) { ++ // Workaround for redeclarations that introduce visiblity attributes ++ // (as is done with ++ // ++ // SAL_DLLPUBLIC_EXPORT GType lok_doc_view_get_type(); ++ // ++ // in libreofficekit/source/gtk/lokdocview.cxx): ++ if (decl->getAttr() != nullptr ++ && prev->getAttr() == nullptr) ++ { ++ return true; ++ } + report( + DiagnosticsEngine::Warning, + "redundant function%0 redeclaration", decl->getLocation()) +-- +2.12.0 + diff --git a/SOURCES/0035-sw-LOK_CALLBACK_CURSOR_VISIBLE-callback.patch b/SOURCES/0035-sw-LOK_CALLBACK_CURSOR_VISIBLE-callback.patch new file mode 100644 index 0000000..1c0bc4a --- /dev/null +++ b/SOURCES/0035-sw-LOK_CALLBACK_CURSOR_VISIBLE-callback.patch @@ -0,0 +1,39 @@ +From 2ef24d89daeea0b549132b6c31606bcda9571d13 Mon Sep 17 00:00:00 2001 +From: Henry Castro +Date: Tue, 9 Jun 2015 22:19:40 -0400 +Subject: [PATCH 035/398] sw: LOK_CALLBACK_CURSOR_VISIBLE callback. + +Change-Id: Ibf62a9d46df7d56dda737b4671d79b59bd01d35a +(cherry picked from commit 698b344fdf42cc9738d5e91cd27876ce1ff39daf) +--- + sw/source/core/crsr/viscrs.cxx | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx +index 3e92ce5ef4e5..9077a6533625 100644 +--- a/sw/source/core/crsr/viscrs.cxx ++++ b/sw/source/core/crsr/viscrs.cxx +@@ -90,7 +90,10 @@ void SwVisCrsr::Show() + + // display at all? + if( m_pCrsrShell->VisArea().IsOver( m_pCrsrShell->m_aCharRect ) || m_pCrsrShell->isTiledRendering() ) ++ { ++ m_pCrsrShell->libreOfficeKitCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(true).getStr()); + _SetPosAndShow(); ++ } + } + } + +@@ -102,6 +105,9 @@ void SwVisCrsr::Hide() + + if( m_aTextCrsr.IsVisible() ) // Shouldn't the flags be in effect? + m_aTextCrsr.Hide(); ++ ++ if( m_pCrsrShell->isTiledRendering() ) ++ m_pCrsrShell->libreOfficeKitCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(false).getStr()); + } + } + +-- +2.12.0 + diff --git a/SOURCES/0036-sw-tiled-rendering-set-minimal-window-size.patch b/SOURCES/0036-sw-tiled-rendering-set-minimal-window-size.patch new file mode 100644 index 0000000..7acc611 --- /dev/null +++ b/SOURCES/0036-sw-tiled-rendering-set-minimal-window-size.patch @@ -0,0 +1,37 @@ +From 8bc21ff727beb36e68076995cc642ac98296b689 Mon Sep 17 00:00:00 2001 +From: Henry Castro +Date: Tue, 9 Jun 2015 23:19:40 -0400 +Subject: [PATCH 036/398] sw: tiled rendering, set minimal window size. + +Set minimal window size (1,1), so it can trigger +LOK_CALLBACK_INVALIDATE_TILES + +Change-Id: If6ef9aeec94b396febd41375b3ce96b1aa1d6115 +(cherry picked from commit 2281a4922f2209511f79b961ca2140c112bc41eb) +--- + sw/source/uibase/uno/unotxdoc.cxx | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx +index c19976c05289..450650d26c13 100644 +--- a/sw/source/uibase/uno/unotxdoc.cxx ++++ b/sw/source/uibase/uno/unotxdoc.cxx +@@ -3164,6 +3164,15 @@ void SwXTextDocument::initializeForTiledRendering() + SwViewShell* pViewShell = pDoc->getIDocumentLayoutAccess().GetCurrentViewShell(); + pViewShell->setTiledRendering(true); + ++ if ( pViewShell->GetWin() ) ++ { ++ // Check initial window size and set minimal size (1,1) ++ Size aSize( pViewShell->GetWin()->GetOutputSizePixel() ); ++ if ( aSize.Width() == 0 || aSize.Height() == 0 ) ++ pViewShell->GetWin()->SetOutputSizePixel(Size( std::max( aSize.Width() , long(1)), ++ std::max( aSize.Height(), long(1)) )); ++ } ++ + bool bBookMode = false; + sal_Int16 nColumns = 1; + +-- +2.12.0 + diff --git a/SOURCES/0037-Revert-sw-LOK_CALLBACK_CURSOR_VISIBLE-callback.patch b/SOURCES/0037-Revert-sw-LOK_CALLBACK_CURSOR_VISIBLE-callback.patch new file mode 100644 index 0000000..373177a --- /dev/null +++ b/SOURCES/0037-Revert-sw-LOK_CALLBACK_CURSOR_VISIBLE-callback.patch @@ -0,0 +1,41 @@ +From d21589ed079bae79f24bbaf9dce8a691cdedb47e Mon Sep 17 00:00:00 2001 +From: Henry Castro +Date: Wed, 10 Jun 2015 14:16:09 -0400 +Subject: [PATCH 037/398] Revert sw: LOK_CALLBACK_CURSOR_VISIBLE callback. + +Already fixed by Miklos Vajna. + +Change-Id: I848f2296c5f5a4d250308ed3a851c46524181340 +(cherry picked from commit 533a5fdad3854b89a252216bb78a38ba3222964b) +--- + sw/source/core/crsr/viscrs.cxx | 6 ------ + 1 file changed, 6 deletions(-) + +diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx +index 9077a6533625..3e92ce5ef4e5 100644 +--- a/sw/source/core/crsr/viscrs.cxx ++++ b/sw/source/core/crsr/viscrs.cxx +@@ -90,10 +90,7 @@ void SwVisCrsr::Show() + + // display at all? + if( m_pCrsrShell->VisArea().IsOver( m_pCrsrShell->m_aCharRect ) || m_pCrsrShell->isTiledRendering() ) +- { +- m_pCrsrShell->libreOfficeKitCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(true).getStr()); + _SetPosAndShow(); +- } + } + } + +@@ -105,9 +102,6 @@ void SwVisCrsr::Hide() + + if( m_aTextCrsr.IsVisible() ) // Shouldn't the flags be in effect? + m_aTextCrsr.Hide(); +- +- if( m_pCrsrShell->isTiledRendering() ) +- m_pCrsrShell->libreOfficeKitCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(false).getStr()); + } + } + +-- +2.12.0 + diff --git a/SOURCES/0038-CID-1306215-Uninitialized-members.patch b/SOURCES/0038-CID-1306215-Uninitialized-members.patch new file mode 100644 index 0000000..ed2da13 --- /dev/null +++ b/SOURCES/0038-CID-1306215-Uninitialized-members.patch @@ -0,0 +1,27 @@ +From 07cdc487ae95079d11ce314d1416a028f585e5c5 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 12 Jun 2015 11:23:37 +0200 +Subject: [PATCH 038/398] CID#1306215 Uninitialized members + +Change-Id: Ib1ff285d1f8180ecb0be8448ac4c2d1878dff274 +(cherry picked from commit 90f9e09a176d9c9df3d79a057a27c34d441608df) +--- + libreofficekit/source/gtk/tilebuffer.hxx | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx +index 42c6d35b112b..6e6c0beb48f3 100644 +--- a/libreofficekit/source/gtk/tilebuffer.hxx ++++ b/libreofficekit/source/gtk/tilebuffer.hxx +@@ -51,7 +51,7 @@ float twipToPixel(float fInput, float zoom); + class Tile + { + public: +- Tile() : valid(false) {} ++ Tile() : valid(false), m_pBuffer(0) {} + ~Tile() { } + + /** +-- +2.12.0 + diff --git a/SOURCES/0039-lokdocview-Change-parent-class-to-GtkDrawingArea.patch b/SOURCES/0039-lokdocview-Change-parent-class-to-GtkDrawingArea.patch new file mode 100644 index 0000000..174a343 --- /dev/null +++ b/SOURCES/0039-lokdocview-Change-parent-class-to-GtkDrawingArea.patch @@ -0,0 +1,487 @@ +From bedd656e03b025673473d43d556e11fead29f186 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Tue, 9 Jun 2015 16:27:37 +0530 +Subject: [PATCH 039/398] lokdocview: Change parent class to GtkDrawingArea + +It is not the job of the widget to provide the scroll bars. + +Change-Id: Iafc5724ed5b21717d711bb8f7e1a076dd1288b76 +(cherry picked from commit 8d0b34c3a6292ce9c5a081ef95890ae0c5e07ac7) +--- + include/LibreOfficeKit/LibreOfficeKitGtk.h | 22 ++- + .../qa/gtktiledviewer/gtktiledviewer.cxx | 27 ++- + libreofficekit/source/gtk/lokdocview.cxx | 207 +++++++++------------ + 3 files changed, 127 insertions(+), 129 deletions(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h +index e84feee9bd57..24c577e6e003 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h ++++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h +@@ -31,21 +31,23 @@ typedef struct _LOKDocViewClass LOKDocViewClass; + + struct _LOKDocView + { +- GtkScrolledWindow aScrollWindow; ++ GtkDrawingArea aDrawingArea; + struct LOKDocView_Impl* m_pImpl; + }; + + struct _LOKDocViewClass + { +- GtkScrolledWindowClass parent_class; +- void (* edit_changed) (LOKDocView* pView, gboolean was_edit); +- void (* command_changed) (LOKDocView* pView, char* new_state); +- void (* search_not_found) (LOKDocView* pView, char* new_state); +- void (* part_changed) (LOKDocView* pView, int new_part); ++ GtkDrawingAreaClass parent_class; ++ void (* edit_changed) (LOKDocView* pView, gboolean was_edit); ++ void (* command_changed) (LOKDocView* pView, char* new_state); ++ void (* search_not_found) (LOKDocView* pView, char* new_state); ++ void (* part_changed) (LOKDocView* pView, int new_part); + }; + + GType lok_doc_view_get_type (void) G_GNUC_CONST; ++ + GtkWidget* lok_doc_view_new (LibreOfficeKit* pOffice ); ++ + gboolean lok_doc_view_open_document (LOKDocView* pDocView, + char* pPath); + +@@ -80,9 +82,11 @@ void lok_doc_view_post_key (GtkWidget* p + GdkEventKey* pEvent, + gpointer pData); + +-/// Get the visible area of the document (in twips). +-void lok_doc_view_get_visarea (LOKDocView* pThis, +- GdkRectangle* pArea); ++float lok_doc_view_pixel_to_twip (LOKDocView* pDocView, ++ float fInput); ++ ++float lok_doc_view_twip_to_pixel (LOKDocView* pDocView, ++ float fInput); + + G_END_DECLS + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 38b29ee40a3b..c8b47f7c7142 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -38,6 +38,7 @@ static GtkToolItem* pBold; + static GtkToolItem* pItalic; + static GtkToolItem* pUnderline; + static GtkToolItem* pStrikethrough; ++static GtkWidget* pScrolledWindow; + std::map g_aToolItemCommandNames; + std::map g_aCommandNameToolItems; + bool g_bToolItemBroadcast = true; +@@ -134,6 +135,23 @@ static void toggleFindbar(GtkWidget* /*pButton*/, gpointer /*pItem*/) + #endif + } + ++/// Get the visible area of the scrolled window ++static void getVisibleAreaTwips(GdkRectangle* pArea) ++{ ++ GtkAdjustment* pHAdjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(pScrolledWindow)); ++ GtkAdjustment* pVAdjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(pScrolledWindow)); ++ ++ pArea->x = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView), ++ gtk_adjustment_get_value(pHAdjustment)); ++ pArea->y = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView), ++ gtk_adjustment_get_value(pVAdjustment)); ++ pArea->width = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView), ++ gtk_adjustment_get_page_size(pHAdjustment)); ++ pArea->height = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView), ++ gtk_adjustment_get_page_size(pVAdjustment)); ++} ++ ++ + /// Handles the key-press-event of the window. + static gboolean signalKey(GtkWidget* pWidget, GdkEventKey* pEvent, gpointer pData) + { +@@ -161,7 +179,7 @@ static void doSearch(bool bBackwards) + + LOKDocView* pLOKDocView = LOK_DOC_VIEW(pDocView); + GdkRectangle aArea; +- lok_doc_view_get_visarea(pLOKDocView, &aArea); ++ getVisibleAreaTwips(&aArea); + aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchStartPointX/type", '/'), "long"); + aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchStartPointX/value", '/'), aArea.x); + aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchStartPointY/type", '/'), "long"); +@@ -461,7 +479,12 @@ int main( int argc, char* argv[] ) + g_signal_connect(pWindow, "key-press-event", G_CALLBACK(signalKey), pDocView); + g_signal_connect(pWindow, "key-release-event", G_CALLBACK(signalKey), pDocView); + +- gtk_container_add( GTK_CONTAINER(pVBox), pDocView ); ++ // Scrolled window for DocView ++ pScrolledWindow = gtk_scrolled_window_new(0, 0); ++ gtk_container_add(GTK_CONTAINER(pVBox), pScrolledWindow); ++ ++ // DocView doesn't have scrolling capability, so need a viewport ++ gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(pScrolledWindow), pDocView); + + gtk_widget_show_all( pWindow ); + // Hide the findbar by default. +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 138c7f82a38f..02b8710e167b 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -41,7 +41,6 @@ + struct LOKDocView_Impl + { + LOKDocView* m_pDocView; +- GtkWidget *m_pDrawingArea; + TileBuffer m_aTileBuffer; + + float m_fZoom; +@@ -119,7 +118,7 @@ struct LOKDocView_Impl + /// Connected to the destroy signal of LOKDocView, deletes its LOKDocView_Impl. + static void destroy(LOKDocView* pDocView, gpointer pData); + /// Connected to the expose-event of the GtkDrawingArea +- static void on_exposed(GtkWidget *widget, GdkEvent *event, gpointer user_data); ++ static void onExposed(GtkWidget *widget, GdkEventExpose *event, gpointer user_data); + /// Receives a key press or release event. + void signalKey(GdkEventKey* pEvent); + /** +@@ -156,16 +155,8 @@ struct LOKDocView_Impl + static gboolean handleTimeout(gpointer pData); + /// Implementation of the timeout handler, invoked by handleTimeout(). + gboolean handleTimeoutImpl(); +- /** +- * Renders the document to a number of visible tiles. +- * +- * This method is invoked only manually, not when some Gtk signal is +- * emitted. +- * +- * @param pPartial if 0, then the full visible document is rendered, otherwise only +- * the tiles that intersect with pPartial. +- */ +- void renderDocument(GdkRectangle* pPartial); ++ /// Implementation of expose event handler, invoked by onExposed(). ++ void onExposedImpl(GdkEventExpose* event); + /// Returns the GdkRectangle of a x,y,width,height string. + GdkRectangle payloadToRectangle(const char* pPayload); + /// Returns the GdkRectangles of a x1,y1,w1,h1;x2,y2,w2,h2;... string. +@@ -213,7 +204,7 @@ SAL_DLLPUBLIC_EXPORT GType lok_doc_view_get_type(); + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wunused-function" + #endif +-G_DEFINE_TYPE(LOKDocView, lok_doc_view, GTK_TYPE_SCROLLED_WINDOW) ++G_DEFINE_TYPE(LOKDocView, lok_doc_view, GTK_TYPE_DRAWING_AREA) + #ifdef __GNUC__ + #pragma GCC diagnostic pop + #endif +@@ -279,7 +270,6 @@ LOKDocView_Impl::CallbackData::CallbackData(int nType, const std::string& rPaylo + + LOKDocView_Impl::LOKDocView_Impl(LOKDocView* pDocView) + : m_pDocView(pDocView), +- m_pDrawingArea(gtk_drawing_area_new()), + m_aTileBuffer(TileBuffer(0,0)), + m_fZoom(1), + m_pOffice(0), +@@ -328,10 +318,70 @@ void LOKDocView_Impl::destroy(LOKDocView* pDocView, gpointer /*pData*/) + delete pDocView->m_pImpl; + } + +-void LOKDocView_Impl::on_exposed(GtkWidget* /*widget*/, GdkEvent* /*event*/, gpointer userdata) ++void LOKDocView_Impl::onExposed(GtkWidget* /*widget*/, GdkEventExpose* event, gpointer userdata) + { + LOKDocView *pDocView = LOK_DOC_VIEW (userdata); +- pDocView->m_pImpl->renderDocument(0); ++ pDocView->m_pImpl->onExposedImpl(event); ++} ++ ++void LOKDocView_Impl::onExposedImpl(GdkEventExpose* event) ++{ ++ long nDocumentWidthPixels = twipToPixel(m_nDocumentWidthTwips, m_fZoom); ++ long nDocumentHeightPixels = twipToPixel(m_nDocumentHeightTwips, m_fZoom); ++ // Total number of rows / columns in this document. ++ guint nRows = ceil((double)nDocumentHeightPixels / nTileSizePixels); ++ guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); ++ GdkRectangle aVisibleArea = event->area; ++ cairo_t *pcairo = gdk_cairo_create(GTK_WIDGET(m_pDocView)->window); ++ ++ aVisibleArea.x = pixelToTwip (aVisibleArea.x, m_fZoom); ++ aVisibleArea.y = pixelToTwip (aVisibleArea.y, m_fZoom); ++ aVisibleArea.width = pixelToTwip (aVisibleArea.width, m_fZoom); ++ aVisibleArea.height = pixelToTwip (aVisibleArea.height, m_fZoom); ++ ++ // Render the tiles. ++ for (guint nRow = 0; nRow < nRows; ++nRow) ++ { ++ for (guint nColumn = 0; nColumn < nColumns; ++nColumn) ++ { ++ GdkRectangle aTileRectangleTwips, aTileRectanglePixels; ++ bool bPaint = true; ++ ++ // Determine size of the tile: the rightmost/bottommost tiles may ++ // be smaller, and we need the size to decide if we need to repaint. ++ if (nColumn == nColumns - 1) ++ aTileRectanglePixels.width = nDocumentWidthPixels - nColumn * nTileSizePixels; ++ else ++ aTileRectanglePixels.width = nTileSizePixels; ++ if (nRow == nRows - 1) ++ aTileRectanglePixels.height = nDocumentHeightPixels - nRow * nTileSizePixels; ++ else ++ aTileRectanglePixels.height = nTileSizePixels; ++ ++ // Determine size and position of the tile in document coordinates, ++ // so we can decide if we can skip painting for partial rendering. ++ aTileRectangleTwips.x = pixelToTwip(nTileSizePixels, m_fZoom) * nColumn; ++ aTileRectangleTwips.y = pixelToTwip(nTileSizePixels, m_fZoom) * nRow; ++ aTileRectangleTwips.width = pixelToTwip(aTileRectanglePixels.width, m_fZoom); ++ aTileRectangleTwips.height = pixelToTwip(aTileRectanglePixels.height, m_fZoom); ++ ++ if (!gdk_rectangle_intersect(&aVisibleArea, &aTileRectangleTwips, 0)) ++ bPaint = false; ++ ++ if (bPaint) ++ { ++ Tile& currentTile = m_aTileBuffer.getTile(nRow, nColumn, m_fZoom); ++ GdkPixbuf* pPixBuf = currentTile.getBuffer(); ++ ++ gdk_cairo_set_source_pixbuf (pcairo, pPixBuf, ++ twipToPixel(aTileRectangleTwips.x, m_fZoom), ++ twipToPixel(aTileRectangleTwips.y, m_fZoom)); ++ cairo_paint(pcairo); ++ } ++ } ++ } ++ ++ cairo_destroy(pcairo); + } + + void LOKDocView_Impl::signalKey(GdkEventKey* pEvent) +@@ -798,75 +848,12 @@ gboolean LOKDocView_Impl::handleTimeoutImpl() + m_bCursorOverlayVisible = false; + else + m_bCursorOverlayVisible = true; +- gtk_widget_queue_draw(GTK_WIDGET(m_pDrawingArea)); ++ gtk_widget_queue_draw(GTK_WIDGET(m_pDocView)); + } + + return G_SOURCE_CONTINUE; + } + +-void LOKDocView_Impl::renderDocument(GdkRectangle* pPartial) +-{ +- GdkRectangle visibleArea; +- lok_doc_view_get_visarea (m_pDocView, &visibleArea); +- +- long nDocumentWidthPixels = twipToPixel(m_nDocumentWidthTwips, m_fZoom); +- long nDocumentHeightPixels = twipToPixel(m_nDocumentHeightTwips, m_fZoom); +- // Total number of rows / columns in this document. +- guint nRows = ceil((double)nDocumentHeightPixels / nTileSizePixels); +- guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); +- +- cairo_t *pcairo = gdk_cairo_create(m_pDrawingArea->window); +- +- // Render the tiles. +- for (guint nRow = 0; nRow < nRows; ++nRow) +- { +- for (guint nColumn = 0; nColumn < nColumns; ++nColumn) +- { +- GdkRectangle aTileRectangleTwips, aTileRectanglePixels; +- bool bPaint = true; +- +- // Determine size of the tile: the rightmost/bottommost tiles may +- // be smaller, and we need the size to decide if we need to repaint. +- if (nColumn == nColumns - 1) +- aTileRectanglePixels.width = nDocumentWidthPixels - nColumn * nTileSizePixels; +- else +- aTileRectanglePixels.width = nTileSizePixels; +- if (nRow == nRows - 1) +- aTileRectanglePixels.height = nDocumentHeightPixels - nRow * nTileSizePixels; +- else +- aTileRectanglePixels.height = nTileSizePixels; +- +- // Determine size and position of the tile in document coordinates, +- // so we can decide if we can skip painting for partial rendering. +- aTileRectangleTwips.x = pixelToTwip(nTileSizePixels, m_fZoom) * nColumn; +- aTileRectangleTwips.y = pixelToTwip(nTileSizePixels, m_fZoom) * nRow; +- aTileRectangleTwips.width = pixelToTwip(aTileRectanglePixels.width, m_fZoom); +- aTileRectangleTwips.height = pixelToTwip(aTileRectanglePixels.height, m_fZoom); +- if (pPartial && !gdk_rectangle_intersect(pPartial, &aTileRectangleTwips, 0)) +- bPaint = false; +- +- if (!gdk_rectangle_intersect(&visibleArea, &aTileRectangleTwips, 0)) +- bPaint = false; +- +- if (bPaint) +- { +- //g_info("tile_buffer_get_tile (%d, %d)", nRow, nColumn); +- +- Tile& currentTile = m_aTileBuffer.getTile(nRow, nColumn, m_fZoom); +- GdkPixbuf* pPixBuf = currentTile.getBuffer(); +- +- gdk_cairo_set_source_pixbuf (pcairo, pPixBuf, +- twipToPixel(aTileRectangleTwips.x, m_fZoom), +- twipToPixel(aTileRectangleTwips.y, m_fZoom)); +- cairo_paint(pcairo); +- } +- } +- } +- +- cairo_destroy(pcairo); +-} +- +- + GdkRectangle LOKDocView_Impl::payloadToRectangle(const char* pPayload) + { + GdkRectangle aRet; +@@ -978,14 +965,14 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback) + else + m_aTileBuffer.resetAllTiles(); + +- gtk_widget_queue_draw(m_pDrawingArea); ++ gtk_widget_queue_draw(GTK_WIDGET(m_pDocView)); + } + break; + case LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR: + { + m_aVisibleCursor = LOKDocView_Impl::payloadToRectangle(pCallback->m_aPayload.c_str()); + m_bCursorOverlayVisible = true; +- gtk_widget_queue_draw(m_pDrawingArea); ++ gtk_widget_queue_draw(GTK_WIDGET(m_pDocView)); + } + break; + case LOK_CALLBACK_TEXT_SELECTION: +@@ -1025,7 +1012,7 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback) + m_aGraphicSelection = LOKDocView_Impl::payloadToRectangle(pCallback->m_aPayload.c_str()); + else + memset(&m_aGraphicSelection, 0, sizeof(m_aGraphicSelection)); +- gtk_widget_queue_draw(GTK_WIDGET(m_pDrawingArea)); ++ gtk_widget_queue_draw(GTK_WIDGET(m_pDocView)); + } + break; + case LOK_CALLBACK_HYPERLINK_CLICKED: +@@ -1049,7 +1036,7 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback) + case LOK_CALLBACK_DOCUMENT_SIZE_CHANGED: + { + payloadToSize(pCallback->m_aPayload.c_str(), m_nDocumentWidthTwips, m_nDocumentHeightTwips); +- gtk_widget_set_size_request(m_pDrawingArea, ++ gtk_widget_set_size_request(GTK_WIDGET(m_pDocView), + twipToPixel(m_nDocumentWidthTwips, m_fZoom), + twipToPixel(m_nDocumentHeightTwips, m_fZoom)); + } +@@ -1113,7 +1100,6 @@ void LOKDocView_Impl::searchNotFound(const std::string& rString) + void LOKDocView_Impl::setPart(const std::string& rString) + { + g_signal_emit(m_pDocView, doc_view_signals[PART_CHANGED], 0, std::stoi(rString)); +- renderDocument(0); + } + + static void lok_doc_view_class_init (LOKDocViewClass* pClass) +@@ -1163,34 +1149,26 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + + static void lok_doc_view_init (LOKDocView* pDocView) + { +- // Gtk ScrolledWindow is apparently not fully initialised yet, we specifically +- // have to set the [hv]adjustment to prevent GTK assertions from firing, see +- // https://bugzilla.gnome.org/show_bug.cgi?id=438114 for more info. +- gtk_scrolled_window_set_hadjustment( GTK_SCROLLED_WINDOW( pDocView ), NULL ); +- gtk_scrolled_window_set_vadjustment( GTK_SCROLLED_WINDOW( pDocView ), NULL ); +- + pDocView->m_pImpl = new LOKDocView_Impl(pDocView); +- gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW(pDocView), +- pDocView->m_pImpl->m_pDrawingArea ); + +- g_signal_connect(G_OBJECT(pDocView->m_pImpl->m_pDrawingArea), ++ g_signal_connect(G_OBJECT(pDocView), + "expose-event", +- G_CALLBACK(LOKDocView_Impl::on_exposed), pDocView); +- g_signal_connect(G_OBJECT(pDocView->m_pImpl->m_pDrawingArea), ++ G_CALLBACK(LOKDocView_Impl::onExposed), pDocView); ++ g_signal_connect(G_OBJECT(pDocView), + "expose-event", + G_CALLBACK(LOKDocView_Impl::renderOverlay), pDocView); +- gtk_widget_add_events(pDocView->m_pImpl->m_pDrawingArea, ++ gtk_widget_add_events(GTK_WIDGET(pDocView), + GDK_BUTTON_PRESS_MASK + |GDK_BUTTON_RELEASE_MASK + |GDK_BUTTON_MOTION_MASK); + +- g_signal_connect(G_OBJECT(pDocView->m_pImpl->m_pDrawingArea), ++ g_signal_connect(G_OBJECT(pDocView), + "button-press-event", + G_CALLBACK(LOKDocView_Impl::signalButton), pDocView); +- g_signal_connect(G_OBJECT(pDocView->m_pImpl->m_pDrawingArea), ++ g_signal_connect(G_OBJECT(pDocView), + "button-release-event", + G_CALLBACK(LOKDocView_Impl::signalButton), pDocView); +- g_signal_connect(G_OBJECT(pDocView->m_pImpl->m_pDrawingArea), ++ g_signal_connect(G_OBJECT(pDocView), + "motion-notify-event", + G_CALLBACK(LOKDocView_Impl::signalMotion), pDocView); + +@@ -1240,10 +1218,9 @@ SAL_DLLPUBLIC_EXPORT gboolean lok_doc_view_open_document( LOKDocView* pDocView, + + pDocView->m_pImpl->m_aTileBuffer = TileBuffer(pDocView->m_pImpl->m_pDocument, + nColumns); +- gtk_widget_set_size_request(pDocView->m_pImpl->m_pDrawingArea, ++ gtk_widget_set_size_request(GTK_WIDGET(pDocView), + nDocumentWidthPixels, + nDocumentHeightPixels); +- pDocView->m_pImpl->renderDocument(0); + } + + return TRUE; +@@ -1264,12 +1241,9 @@ SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_zoom ( LOKDocView* pDocView, float fZ + + pDocView->m_pImpl->m_aTileBuffer = TileBuffer(pDocView->m_pImpl->m_pDocument, + nColumns); +- gtk_widget_set_size_request(pDocView->m_pImpl->m_pDrawingArea, ++ gtk_widget_set_size_request(GTK_WIDGET(pDocView), + nDocumentWidthPixels, + nDocumentHeightPixels); +- +- if ( pDocView->m_pImpl->m_pDocument ) +- pDocView->m_pImpl->renderDocument(0); + } + + SAL_DLLPUBLIC_EXPORT float lok_doc_view_get_zoom ( LOKDocView* pDocView ) +@@ -1301,7 +1275,6 @@ SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_partmode( LOKDocView* pDocView, + int nPartMode ) + { + pDocView->m_pImpl->m_pDocument->pClass->setPartMode( pDocView->m_pImpl->m_pDocument, nPartMode ); +- pDocView->m_pImpl->renderDocument(0); + } + + SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_edit( LOKDocView* pDocView, +@@ -1318,7 +1291,7 @@ SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_edit( LOKDocView* pDocView, + } + pDocView->m_pImpl->m_bEdit = bEdit; + g_signal_emit(pDocView, doc_view_signals[EDIT_CHANGED], 0, bWasEdit); +- gtk_widget_queue_draw(GTK_WIDGET(pDocView->m_pImpl->m_pDrawingArea)); ++ gtk_widget_queue_draw(GTK_WIDGET(pDocView)); + } + + SAL_DLLPUBLIC_EXPORT gboolean lok_doc_view_get_edit(LOKDocView* pDocView) +@@ -1337,17 +1310,15 @@ SAL_DLLPUBLIC_EXPORT void lok_doc_view_post_key(GtkWidget* /*pWidget*/, GdkEvent + pDocView->m_pImpl->signalKey(pEvent); + } + +-SAL_DLLPUBLIC_EXPORT void lok_doc_view_get_visarea(LOKDocView* pThis, GdkRectangle* pArea) ++SAL_DLLPUBLIC_EXPORT float lok_doc_view_pixel_to_twip(LOKDocView* pDocView, float fInput) + { +-#if GTK_CHECK_VERSION(2,14,0) // we need gtk_adjustment_get_page_size() +- float zoom = pThis->m_pImpl->m_fZoom; +- GtkAdjustment* pHAdjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(pThis)); +- pArea->x = pixelToTwip(gtk_adjustment_get_value(pHAdjustment),zoom); +- pArea->width = pixelToTwip(gtk_adjustment_get_page_size(pHAdjustment), zoom); +- GtkAdjustment* pVAdjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(pThis)); +- pArea->y = pixelToTwip(gtk_adjustment_get_value(pVAdjustment), zoom); +- pArea->height = pixelToTwip(gtk_adjustment_get_page_size(pVAdjustment), zoom); +-#endif ++ return pixelToTwip(fInput, pDocView->m_pImpl->m_fZoom); + } + ++SAL_DLLPUBLIC_EXPORT float lok_doc_view_twip_to_pixel(LOKDocView* pDocView, float fInput) ++{ ++ return twipToPixel(fInput, pDocView->m_pImpl->m_fZoom); ++} ++ ++ + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +-- +2.12.0 + diff --git a/SOURCES/0040-lokdocview-Make-this-GObject-class-introspectable.patch b/SOURCES/0040-lokdocview-Make-this-GObject-class-introspectable.patch new file mode 100644 index 0000000..75fba91 --- /dev/null +++ b/SOURCES/0040-lokdocview-Make-this-GObject-class-introspectable.patch @@ -0,0 +1,160 @@ +From 2f3948b6155b0d3f40269bbacd267c2d01868c41 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Tue, 9 Jun 2015 18:08:59 +0530 +Subject: [PATCH 040/398] lokdocview: Make this GObject class introspectable + +... so that this widget can be used from other languages. + +Change-Id: Icd7d6df6aa587ffdb018af0b911300dc81ec6560 +(cherry picked from commit 97c9a87ac88b18e7bbb72ad218e5ed5cf4f4b2ed) +--- + libreofficekit/source/gtk/lokdocview.cxx | 67 +++++++++++++++++++++++++++++++- + 1 file changed, 65 insertions(+), 2 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 02b8710e167b..c035d0dcad55 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -121,7 +121,7 @@ struct LOKDocView_Impl + static void onExposed(GtkWidget *widget, GdkEventExpose *event, gpointer user_data); + /// Receives a key press or release event. + void signalKey(GdkEventKey* pEvent); +- /** ++ /* + * The user drags the handle, which is below the cursor, but wants to move the + * cursor accordingly. + * +@@ -144,7 +144,7 @@ struct LOKDocView_Impl + gboolean renderOverlayImpl(GtkWidget* pEventBox); + /// Is rRectangle empty? + static bool isEmptyRectangle(const GdkRectangle& rRectangle); +- /** ++ /* + * Renders pHandle below an rCursor rectangle on pCairo. + * @param rRectangle output parameter, the rectangle that contains the rendered handle. + */ +@@ -1175,6 +1175,12 @@ static void lok_doc_view_init (LOKDocView* pDocView) + g_signal_connect(G_OBJECT(pDocView), "destroy", G_CALLBACK(LOKDocView_Impl::destroy), 0); + } + ++/** ++ * lok_doc_view_new: ++ * @pOffice: The LibreOfficeKit context. ++ * ++ * Returns: The #LOKDocView widget instance. ++ */ + SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new( LibreOfficeKit* pOffice ) + { + LOKDocView* pDocView = LOK_DOC_VIEW(gtk_type_new(lok_doc_view_get_type())); +@@ -1182,6 +1188,13 @@ SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new( LibreOfficeKit* pOffice ) + return GTK_WIDGET( pDocView ); + } + ++/** ++ * lok_doc_view_open_document: ++ * @pDocView: The #LOKDocView instance ++ * @pPath: The path of the document that #LOKDocView widget should try to open ++ * ++ * Returns: %TRUE if the document is loaded succesfully, %FALSE otherwise ++ */ + SAL_DLLPUBLIC_EXPORT gboolean lok_doc_view_open_document( LOKDocView* pDocView, char* pPath ) + { + if ( pDocView->m_pImpl->m_pDocument ) +@@ -1226,11 +1239,24 @@ SAL_DLLPUBLIC_EXPORT gboolean lok_doc_view_open_document( LOKDocView* pDocView, + return TRUE; + } + ++/** ++ * lok_doc_view_get_document: ++ * @pDocView: The #LOKDocView instance ++ * ++ * Returns: The #LibreOfficeKitDocument instance the widget is currently showing ++ */ + SAL_DLLPUBLIC_EXPORT LibreOfficeKitDocument* lok_doc_view_get_document(LOKDocView* pDocView) + { + return pDocView->m_pImpl->m_pDocument; + } + ++/** ++ * lok_doc_view_set_zoom: ++ * @pDocView: The #LOKDocView instance ++ * @fZoom: The new zoom level that pDocView must set it into. ++ * ++ * Sets the new zoom level for the widget. ++ */ + SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_zoom ( LOKDocView* pDocView, float fZoom ) + { + pDocView->m_pImpl->m_fZoom = fZoom; +@@ -1246,6 +1272,12 @@ SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_zoom ( LOKDocView* pDocView, float fZ + nDocumentHeightPixels); + } + ++/** ++ * lok_doc_view_get_zoom: ++ * @pDocView: The #LOKDocView instance ++ * ++ * Returns: The current zoom factor value in float for pDocView ++ */ + SAL_DLLPUBLIC_EXPORT float lok_doc_view_get_zoom ( LOKDocView* pDocView ) + { + return pDocView->m_pImpl->m_fZoom; +@@ -1277,6 +1309,13 @@ SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_partmode( LOKDocView* pDocView, + pDocView->m_pImpl->m_pDocument->pClass->setPartMode( pDocView->m_pImpl->m_pDocument, nPartMode ); + } + ++/** ++ * lok_doc_view_set_edit: ++ * @pDocView: The #LOKDocView instance ++ * @bEdit: %TRUE if the pDocView should go in edit mode, %FALSE otherwise ++ * ++ * Sets the edit-mode for pDocView ++ */ + SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_edit( LOKDocView* pDocView, + gboolean bEdit ) + { +@@ -1294,6 +1333,12 @@ SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_edit( LOKDocView* pDocView, + gtk_widget_queue_draw(GTK_WIDGET(pDocView)); + } + ++/** ++ * lok_doc_view_get_edit: ++ * @pDocView: The #LOKDocView instance ++ * ++ * Returns: %TRUE if the given pDocView is in edit mode. ++ */ + SAL_DLLPUBLIC_EXPORT gboolean lok_doc_view_get_edit(LOKDocView* pDocView) + { + return pDocView->m_pImpl->m_bEdit; +@@ -1310,11 +1355,29 @@ SAL_DLLPUBLIC_EXPORT void lok_doc_view_post_key(GtkWidget* /*pWidget*/, GdkEvent + pDocView->m_pImpl->signalKey(pEvent); + } + ++/** ++ * lok_doc_view_pixel_to_twip: ++ * @pDocView: The #LOKDocView instance ++ * @fInput: The value in pixels to convert to twips ++ * ++ * Converts the value in pixels to twips according to zoom level. ++ * ++ * Returns: The corresponding value in twips ++ */ + SAL_DLLPUBLIC_EXPORT float lok_doc_view_pixel_to_twip(LOKDocView* pDocView, float fInput) + { + return pixelToTwip(fInput, pDocView->m_pImpl->m_fZoom); + } + ++/** ++ * lok_doc_view_twip_to_pixel: ++ * @pDocView: The #LOKDocView instance ++ * @fInput: The value in twips to convert to pixels ++ * ++ * Converts the value in twips to pixels according to zoom level. ++ * ++ * Returns: The corresponding value in pixels ++ */ + SAL_DLLPUBLIC_EXPORT float lok_doc_view_twip_to_pixel(LOKDocView* pDocView, float fInput) + { + return twipToPixel(fInput, pDocView->m_pImpl->m_fZoom); +-- +2.12.0 + diff --git a/SOURCES/0041-lokdocview-Create-LOK-context-inside-of-lok_doc_view.patch b/SOURCES/0041-lokdocview-Create-LOK-context-inside-of-lok_doc_view.patch new file mode 100644 index 0000000..1f3b762 --- /dev/null +++ b/SOURCES/0041-lokdocview-Create-LOK-context-inside-of-lok_doc_view.patch @@ -0,0 +1,135 @@ +From cb4dc8447179758aa6e8330fdff7c67b72c9b2da Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Wed, 10 Jun 2015 16:10:19 +0530 +Subject: [PATCH 041/398] lokdocview: Create LOK context inside of + lok_doc_view_new + +Change-Id: I675192d6bd6d10e6c7974a5de6f488f9a087ac32 +(cherry picked from commit 7a9dc7fd35168e1f44fb0aa23c984f90163db621) +--- + include/LibreOfficeKit/LibreOfficeKitGtk.h | 2 +- + libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 15 ++++----------- + libreofficekit/source/gtk/lokdocview.cxx | 14 ++++++++++---- + 3 files changed, 15 insertions(+), 16 deletions(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h +index 24c577e6e003..bdd2e9ab90e3 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h ++++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h +@@ -46,7 +46,7 @@ struct _LOKDocViewClass + + GType lok_doc_view_get_type (void) G_GNUC_CONST; + +-GtkWidget* lok_doc_view_new (LibreOfficeKit* pOffice ); ++GtkWidget* lok_doc_view_new (const char* pPath); + + gboolean lok_doc_view_open_document (LOKDocView* pDocView, + char* pPath); +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index c8b47f7c7142..4f74583f52b3 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -19,7 +19,6 @@ + #include + + #include +-#include + #include + + #ifndef g_info +@@ -53,8 +52,6 @@ GtkWidget* pFindbar; + GtkWidget* pFindbarEntry; + GtkWidget* pFindbarLabel; + +-static LibreOfficeKit* pOffice; +- + static void lcl_registerToolItem(GtkToolItem* pItem, const std::string& rName) + { + g_aToolItemCommandNames[pItem] = rName; +@@ -361,10 +358,6 @@ int main( int argc, char* argv[] ) + return 1; + } + +- pOffice = lok_init( argv[1] ); +- if ( pOffice == NULL ) +- return 1; +- + gtk_init( &argc, &argv ); + + GtkWidget *pWindow = gtk_window_new( GTK_WINDOW_TOPLEVEL ); +@@ -469,7 +462,9 @@ int main( int argc, char* argv[] ) + gtk_box_pack_end(GTK_BOX(pVBox), pFindbar, FALSE, FALSE, 0); + + // Docview +- pDocView = lok_doc_view_new( pOffice ); ++ pDocView = lok_doc_view_new(argv[1]); ++ if (pDocView == NULL) ++ g_error ("Error while creating LOKDocView widget"); + g_signal_connect(pDocView, "edit-changed", G_CALLBACK(signalEdit), NULL); + g_signal_connect(pDocView, "command-changed", G_CALLBACK(signalCommand), NULL); + g_signal_connect(pDocView, "search-not-found", G_CALLBACK(signalSearch), NULL); +@@ -492,7 +487,7 @@ int main( int argc, char* argv[] ) + + int bOpened = lok_doc_view_open_document( LOK_DOC_VIEW(pDocView), argv[2] ); + if (!bOpened) +- g_error("main: lok_doc_view_open_document() failed with '%s'", pOffice->pClass->getError(pOffice)); ++ g_error("main: lok_doc_view_open_document() failed"); + assert(lok_doc_view_get_document(LOK_DOC_VIEW(pDocView))); + + // GtkComboBox requires gtk 2.24 or later +@@ -507,8 +502,6 @@ int main( int argc, char* argv[] ) + + gtk_main(); + +- pOffice->pClass->destroy( pOffice ); +- + return 0; + } + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index c035d0dcad55..d45ab2db4be5 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -18,6 +18,7 @@ + #include + #define LOK_USE_UNSTABLE_API + #include ++#include + #include + #include + #include +@@ -308,7 +309,10 @@ LOKDocView_Impl::~LOKDocView_Impl() + { + if (m_pDocument) + m_pDocument->pClass->destroy(m_pDocument); ++ if (m_pOffice) ++ m_pOffice->pClass->destroy(m_pOffice); + m_pDocument = 0; ++ m_pOffice = 0; + } + + void LOKDocView_Impl::destroy(LOKDocView* pDocView, gpointer /*pData*/) +@@ -1177,14 +1181,16 @@ static void lok_doc_view_init (LOKDocView* pDocView) + + /** + * lok_doc_view_new: +- * @pOffice: The LibreOfficeKit context. ++ * @pPath: LibreOffice install path. + * + * Returns: The #LOKDocView widget instance. + */ +-SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new( LibreOfficeKit* pOffice ) ++SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new(const char* pPath) + { +- LOKDocView* pDocView = LOK_DOC_VIEW(gtk_type_new(lok_doc_view_get_type())); +- pDocView->m_pImpl->m_pOffice = pOffice; ++ LOKDocView* pDocView = LOK_DOC_VIEW(g_object_new(LOK_TYPE_DOC_VIEW, NULL)); ++ pDocView->m_pImpl->m_pOffice = lok_init (pPath); ++ if (pDocView->m_pImpl->m_pOffice == NULL) ++ return NULL; + return GTK_WIDGET( pDocView ); + } + +-- +2.12.0 + diff --git a/SOURCES/0042-Fix-RHEL5-build.patch b/SOURCES/0042-Fix-RHEL5-build.patch new file mode 100644 index 0000000..bf7f25c --- /dev/null +++ b/SOURCES/0042-Fix-RHEL5-build.patch @@ -0,0 +1,34 @@ +From fb4b7c191098c0fca7255860e5835798b9fed4c3 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 12 Jun 2015 15:45:16 +0200 +Subject: [PATCH 042/398] Fix RHEL5 build + +Change-Id: I9a71ee85d2d28aed5bd3f4d1f6e91261a9228d04 +(cherry picked from commit e6c37fdee5ddd35460aacca401bf581d021384d9) +--- + libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 4f74583f52b3..2ce541d1ba84 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -135,6 +135,7 @@ static void toggleFindbar(GtkWidget* /*pButton*/, gpointer /*pItem*/) + /// Get the visible area of the scrolled window + static void getVisibleAreaTwips(GdkRectangle* pArea) + { ++#if GTK_CHECK_VERSION(2,14,0) // we need gtk_adjustment_get_page_size() + GtkAdjustment* pHAdjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(pScrolledWindow)); + GtkAdjustment* pVAdjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(pScrolledWindow)); + +@@ -146,6 +147,7 @@ static void getVisibleAreaTwips(GdkRectangle* pArea) + gtk_adjustment_get_page_size(pHAdjustment)); + pArea->height = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView), + gtk_adjustment_get_page_size(pVAdjustment)); ++#endif + } + + +-- +2.12.0 + diff --git a/SOURCES/0043-cppcheck-postfixOperator.patch b/SOURCES/0043-cppcheck-postfixOperator.patch new file mode 100644 index 0000000..79ecc27 --- /dev/null +++ b/SOURCES/0043-cppcheck-postfixOperator.patch @@ -0,0 +1,27 @@ +From c454caba0eae7818a243f1aebca85d665cf981c9 Mon Sep 17 00:00:00 2001 +From: Julien Nabet +Date: Sun, 14 Jun 2015 09:09:52 +0200 +Subject: [PATCH 043/398] cppcheck: postfixOperator + +Change-Id: Ia17bdf6e8f871d64add358822ea383236ecd6405 +(cherry picked from commit 01a189abcd9a4ca472a74b3b2c000c9338fc2c91) +--- + libreofficekit/source/gtk/tilebuffer.cxx | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libreofficekit/source/gtk/tilebuffer.cxx b/libreofficekit/source/gtk/tilebuffer.cxx +index 2c0ee90e08d4..3f22f983d2ab 100644 +--- a/libreofficekit/source/gtk/tilebuffer.cxx ++++ b/libreofficekit/source/gtk/tilebuffer.cxx +@@ -54,7 +54,7 @@ void Tile::setPixbuf(GdkPixbuf *buffer) + void TileBuffer::resetAllTiles() + { + std::map::iterator it = m_mTiles.begin(); +- for (; it != m_mTiles.end(); it++) ++ for (; it != m_mTiles.end(); ++it) + { + it->second.release(); + } +-- +2.12.0 + diff --git a/SOURCES/0044-Typo.patch b/SOURCES/0044-Typo.patch new file mode 100644 index 0000000..9caa463 --- /dev/null +++ b/SOURCES/0044-Typo.patch @@ -0,0 +1,27 @@ +From 134a73259bc4d4f7e61921001ec5549f071e6050 Mon Sep 17 00:00:00 2001 +From: Tor Lillqvist +Date: Mon, 15 Jun 2015 12:37:27 +0300 +Subject: [PATCH 044/398] Typo + +Change-Id: Ibecfa73dd1b865edba77caf51f5003d1b18692be +(cherry picked from commit a0e10b1e0863b1967ede25053f8e3f1dacf0fbdf) +--- + include/LibreOfficeKit/LibreOfficeKitEnums.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h +index bdcc2f0c256f..7038e5fc8cc2 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h ++++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h +@@ -119,7 +119,7 @@ typedef enum + * document, the status indicator callbacks will arrive to the callback + * registered for the LibreOfficeKit (singleton) object, not a + * LibreOfficeKitDocument one, because we are in the very progress of +- * loading a docuemnt and then constructing a LibreOfficeKitDocument ++ * loading a document and then constructing a LibreOfficeKitDocument + * object. + */ + LOK_CALLBACK_STATUS_INDICATOR_START, +-- +2.12.0 + diff --git a/SOURCES/0045-lokdocview-gtktiledviewer-Port-to-gtk3.patch b/SOURCES/0045-lokdocview-gtktiledviewer-Port-to-gtk3.patch new file mode 100644 index 0000000..e94a996 --- /dev/null +++ b/SOURCES/0045-lokdocview-gtktiledviewer-Port-to-gtk3.patch @@ -0,0 +1,184 @@ +From 29a8e23e7d96689c46299af1ab56c4c3d50d8fb0 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Wed, 10 Jun 2015 16:18:06 +0530 +Subject: [PATCH 045/398] lokdocview, gtktiledviewer: Port to gtk3 + +Change-Id: I57f2d7b9383790e5c34fc517a905dd537519598f +(cherry picked from commit 9b3679301fe4ec4c972b68ef2cbbdd23cbc79053) +--- + libreofficekit/Executable_gtktiledviewer.mk | 9 +++++++- + libreofficekit/Library_libreofficekitgtk.mk | 12 +++++++---- + libreofficekit/Module_libreofficekit.mk | 4 ++-- + .../qa/gtktiledviewer/gtktiledviewer.cxx | 6 ++---- + libreofficekit/source/gtk/lokdocview.cxx | 24 ++++++++++------------ + 5 files changed, 31 insertions(+), 24 deletions(-) + +diff --git a/libreofficekit/Executable_gtktiledviewer.mk b/libreofficekit/Executable_gtktiledviewer.mk +index 8a5206854cca..31028a67fafb 100644 +--- a/libreofficekit/Executable_gtktiledviewer.mk ++++ b/libreofficekit/Executable_gtktiledviewer.mk +@@ -16,7 +16,14 @@ $(eval $(call gb_Executable_set_include,gtktiledviewer,\ + + $(eval $(call gb_Executable_use_externals,gtktiledviewer,\ + boost_headers \ +- gtk \ ++)) ++ ++$(eval $(call gb_Executable_add_cxxflags,gtktiledviewer,\ ++ $$(GTK3_CFLAGS) \ ++)) ++ ++$(eval $(call gb_Executable_add_libs,gtktiledviewer,\ ++ $(GTK3_LIBS) \ + )) + + $(eval $(call gb_Executable_use_libraries,gtktiledviewer,\ +diff --git a/libreofficekit/Library_libreofficekitgtk.mk b/libreofficekit/Library_libreofficekitgtk.mk +index 92409537f4e8..71a77e9e36a3 100644 +--- a/libreofficekit/Library_libreofficekitgtk.mk ++++ b/libreofficekit/Library_libreofficekitgtk.mk +@@ -11,15 +11,19 @@ $(eval $(call gb_Library_Library,libreofficekitgtk)) + + $(eval $(call gb_Library_use_sdk_api,libreofficekitgtk)) + +-$(eval $(call gb_Library_use_externals,libreofficekitgtk,\ +- gtk \ +-)) +- + $(eval $(call gb_Library_add_exception_objects,libreofficekitgtk,\ + libreofficekit/source/gtk/lokdocview \ + libreofficekit/source/gtk/tilebuffer \ + )) + ++$(eval $(call gb_Library_add_cxxflags,libreofficekitgtk,\ ++ $$(GTK3_CFLAGS) \ ++)) ++ ++$(eval $(call gb_Library_add_libs,libreofficekitgtk,\ ++ $(GTK3_LIBS) \ ++)) ++ + ifeq ($(OS),LINUX) + $(eval $(call gb_Library_add_libs,libreofficekitgtk,\ + -ldl \ +diff --git a/libreofficekit/Module_libreofficekit.mk b/libreofficekit/Module_libreofficekit.mk +index 000c2fe7457b..217ecb22ff33 100644 +--- a/libreofficekit/Module_libreofficekit.mk ++++ b/libreofficekit/Module_libreofficekit.mk +@@ -15,7 +15,7 @@ $(eval $(call gb_Module_add_subsequentcheck_targets,libreofficekit,\ + CppunitTest_libreofficekit_tiledrendering \ + )) + +-ifneq ($(ENABLE_GTK),) ++ifneq ($(ENABLE_GTK3),) + $(eval $(call gb_Module_add_targets,libreofficekit,\ + Library_libreofficekitgtk \ + Executable_gtktiledviewer \ +@@ -24,7 +24,7 @@ $(eval $(call gb_Module_add_targets,libreofficekit,\ + $(eval $(call gb_Module_add_targets,libreofficekit,\ + Executable_tilebench \ + )) +-endif # ($(ENABLE_GTK),) ++endif # ($(ENABLE_GTK3),) + + endif # ($(OS),LINUX) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 2ce541d1ba84..1f77f1be6c4d 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -14,9 +14,7 @@ + #include + + #include +-#include + #include +-#include + + #include + #include +@@ -208,13 +206,13 @@ static gboolean signalFindbar(GtkWidget* /*pWidget*/, GdkEventKey* pEvent, gpoin + gtk_label_set_text(GTK_LABEL(pFindbarLabel), ""); + switch(pEvent->keyval) + { +- case GDK_Return: ++ case GDK_KEY_Return: + { + // Search forward. + doSearch(/*bBackwards=*/false); + return TRUE; + } +- case GDK_Escape: ++ case GDK_KEY_Escape: + { + // Hide the findbar. + gtk_widget_hide(pFindbar); +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index d45ab2db4be5..cd05d0ebbdb9 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -13,8 +13,6 @@ + #include + #include + +-#include +- + #include + #define LOK_USE_UNSTABLE_API + #include +@@ -336,7 +334,7 @@ void LOKDocView_Impl::onExposedImpl(GdkEventExpose* event) + guint nRows = ceil((double)nDocumentHeightPixels / nTileSizePixels); + guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); + GdkRectangle aVisibleArea = event->area; +- cairo_t *pcairo = gdk_cairo_create(GTK_WIDGET(m_pDocView)->window); ++ cairo_t *pcairo = gdk_cairo_create(gtk_widget_get_window(GTK_WIDGET(m_pDocView))); + + aVisibleArea.x = pixelToTwip (aVisibleArea.x, m_fZoom); + aVisibleArea.y = pixelToTwip (aVisibleArea.y, m_fZoom); +@@ -401,33 +399,33 @@ void LOKDocView_Impl::signalKey(GdkEventKey* pEvent) + + switch (pEvent->keyval) + { +- case GDK_BackSpace: ++ case GDK_KEY_BackSpace: + nKeyCode = com::sun::star::awt::Key::BACKSPACE; + break; +- case GDK_Return: ++ case GDK_KEY_Return: + nKeyCode = com::sun::star::awt::Key::RETURN; + break; +- case GDK_Escape: ++ case GDK_KEY_Escape: + nKeyCode = com::sun::star::awt::Key::ESCAPE; + break; +- case GDK_Tab: ++ case GDK_KEY_Tab: + nKeyCode = com::sun::star::awt::Key::TAB; + break; +- case GDK_Down: ++ case GDK_KEY_Down: + nKeyCode = com::sun::star::awt::Key::DOWN; + break; +- case GDK_Up: ++ case GDK_KEY_Up: + nKeyCode = com::sun::star::awt::Key::UP; + break; +- case GDK_Left: ++ case GDK_KEY_Left: + nKeyCode = com::sun::star::awt::Key::LEFT; + break; +- case GDK_Right: ++ case GDK_KEY_Right: + nKeyCode = com::sun::star::awt::Key::RIGHT; + break; + default: +- if (pEvent->keyval >= GDK_F1 && pEvent->keyval <= GDK_F26) +- nKeyCode = com::sun::star::awt::Key::F1 + (pEvent->keyval - GDK_F1); ++ if (pEvent->keyval >= GDK_KEY_F1 && pEvent->keyval <= GDK_KEY_F26) ++ nKeyCode = com::sun::star::awt::Key::F1 + (pEvent->keyval - GDK_KEY_F1); + else + nCharCode = gdk_keyval_to_unicode(pEvent->keyval); + } +-- +2.12.0 + diff --git a/SOURCES/0046-lokdocview-Port-to-gtk3-expose-event-draw.patch b/SOURCES/0046-lokdocview-Port-to-gtk3-expose-event-draw.patch new file mode 100644 index 0000000..c16e344 --- /dev/null +++ b/SOURCES/0046-lokdocview-Port-to-gtk3-expose-event-draw.patch @@ -0,0 +1,157 @@ +From ad5cffbdf99d9a0605ee2e0c1356099478a2a808 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Wed, 10 Jun 2015 16:28:45 +0530 +Subject: [PATCH 046/398] lokdocview: Port to gtk3; 'expose-event' -> 'draw' + +Change-Id: I8d2541f5cbd2b908c2b0dc52cccf9b936bbc307a +(cherry picked from commit 256a9cef8bdd89b90f0c371df8f849c567f84213) +--- + .../qa/gtktiledviewer/gtktiledviewer.cxx | 2 + + libreofficekit/source/gtk/lokdocview.cxx | 47 ++++++++++------------ + 2 files changed, 24 insertions(+), 25 deletions(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 1f77f1be6c4d..dc5783b807ad 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -476,6 +476,8 @@ int main( int argc, char* argv[] ) + + // Scrolled window for DocView + pScrolledWindow = gtk_scrolled_window_new(0, 0); ++ gtk_widget_set_hexpand (pScrolledWindow, TRUE); ++ gtk_widget_set_vexpand (pScrolledWindow, TRUE); + gtk_container_add(GTK_CONTAINER(pVBox), pScrolledWindow); + + // DocView doesn't have scrolling capability, so need a viewport +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index cd05d0ebbdb9..d79390e6e5ef 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -116,8 +116,10 @@ struct LOKDocView_Impl + ~LOKDocView_Impl(); + /// Connected to the destroy signal of LOKDocView, deletes its LOKDocView_Impl. + static void destroy(LOKDocView* pDocView, gpointer pData); +- /// Connected to the expose-event of the GtkDrawingArea +- static void onExposed(GtkWidget *widget, GdkEventExpose *event, gpointer user_data); ++ /// Connected to the draw of the GtkDrawingArea ++ static gboolean renderDocument(GtkWidget *widget, cairo_t *cr, gpointer user_data); ++ /// Implementation of draw event handler, invoked by renderDocument(). ++ gboolean renderDocumentImpl(cairo_t* cr); + /// Receives a key press or release event. + void signalKey(GdkEventKey* pEvent); + /* +@@ -138,9 +140,9 @@ struct LOKDocView_Impl + /// Implementation of motion event handler, invoked by signalMotion(). + gboolean signalMotionImpl(GdkEventButton* pEvent); + /// Receives an expose event. +- static gboolean renderOverlay(GtkWidget* pWidget, GdkEventExpose* pEvent, LOKDocView* pDocView); ++ static gboolean renderOverlay(GtkWidget* pWidget, cairo_t* cr, gpointer userdata); + /// Implementation of expose event handler (renders cursor and selection overlay), invoked by renderOverlay(). +- gboolean renderOverlayImpl(GtkWidget* pEventBox); ++ gboolean renderOverlayImpl(cairo_t *cr); + /// Is rRectangle empty? + static bool isEmptyRectangle(const GdkRectangle& rRectangle); + /* +@@ -154,8 +156,6 @@ struct LOKDocView_Impl + static gboolean handleTimeout(gpointer pData); + /// Implementation of the timeout handler, invoked by handleTimeout(). + gboolean handleTimeoutImpl(); +- /// Implementation of expose event handler, invoked by onExposed(). +- void onExposedImpl(GdkEventExpose* event); + /// Returns the GdkRectangle of a x,y,width,height string. + GdkRectangle payloadToRectangle(const char* pPayload); + /// Returns the GdkRectangles of a x1,y1,w1,h1;x2,y2,w2,h2;... string. +@@ -320,21 +320,22 @@ void LOKDocView_Impl::destroy(LOKDocView* pDocView, gpointer /*pData*/) + delete pDocView->m_pImpl; + } + +-void LOKDocView_Impl::onExposed(GtkWidget* /*widget*/, GdkEventExpose* event, gpointer userdata) ++gboolean LOKDocView_Impl::renderDocument(GtkWidget* /*widget*/, cairo_t *cr, gpointer userdata) + { + LOKDocView *pDocView = LOK_DOC_VIEW (userdata); +- pDocView->m_pImpl->onExposedImpl(event); ++ return pDocView->m_pImpl->renderDocumentImpl(cr); + } + +-void LOKDocView_Impl::onExposedImpl(GdkEventExpose* event) ++gboolean LOKDocView_Impl::renderDocumentImpl(cairo_t *pCairo) + { + long nDocumentWidthPixels = twipToPixel(m_nDocumentWidthTwips, m_fZoom); + long nDocumentHeightPixels = twipToPixel(m_nDocumentHeightTwips, m_fZoom); + // Total number of rows / columns in this document. + guint nRows = ceil((double)nDocumentHeightPixels / nTileSizePixels); + guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); +- GdkRectangle aVisibleArea = event->area; +- cairo_t *pcairo = gdk_cairo_create(gtk_widget_get_window(GTK_WIDGET(m_pDocView))); ++ GdkRectangle aVisibleArea; ++ ++ gdk_cairo_get_clip_rectangle (pCairo, &aVisibleArea); + + aVisibleArea.x = pixelToTwip (aVisibleArea.x, m_fZoom); + aVisibleArea.y = pixelToTwip (aVisibleArea.y, m_fZoom); +@@ -374,16 +375,14 @@ void LOKDocView_Impl::onExposedImpl(GdkEventExpose* event) + { + Tile& currentTile = m_aTileBuffer.getTile(nRow, nColumn, m_fZoom); + GdkPixbuf* pPixBuf = currentTile.getBuffer(); +- +- gdk_cairo_set_source_pixbuf (pcairo, pPixBuf, ++ gdk_cairo_set_source_pixbuf (pCairo, pPixBuf, + twipToPixel(aTileRectangleTwips.x, m_fZoom), + twipToPixel(aTileRectangleTwips.y, m_fZoom)); +- cairo_paint(pcairo); ++ cairo_paint(pCairo); + } + } + } +- +- cairo_destroy(pcairo); ++ return FALSE; + } + + void LOKDocView_Impl::signalKey(GdkEventKey* pEvent) +@@ -644,16 +643,15 @@ gboolean LOKDocView_Impl::signalMotionImpl(GdkEventButton* pEvent) + return FALSE; + } + +-gboolean LOKDocView_Impl::renderOverlay(GtkWidget* pEventBox, GdkEventExpose* /*pEvent*/, LOKDocView* pDocView) ++gboolean LOKDocView_Impl::renderOverlay(GtkWidget* /*widget*/, cairo_t *cr, gpointer userdata) + { +- return pDocView->m_pImpl->renderOverlayImpl(pEventBox); ++ LOKDocView *pDocView = LOK_DOC_VIEW (userdata); ++ return pDocView->m_pImpl->renderOverlayImpl(cr); + } + +-gboolean LOKDocView_Impl::renderOverlayImpl(GtkWidget* pWidget) ++gboolean LOKDocView_Impl::renderOverlayImpl(cairo_t *pCairo) + { + #if GTK_CHECK_VERSION(2,14,0) // we need gtk_widget_get_window() +- cairo_t* pCairo = gdk_cairo_create(gtk_widget_get_window(pWidget)); +- + if (m_bEdit && m_bCursorVisible && m_bCursorOverlayVisible && !isEmptyRectangle(m_aVisibleCursor)) + { + if (m_aVisibleCursor.width < 30) +@@ -715,7 +713,6 @@ gboolean LOKDocView_Impl::renderOverlayImpl(GtkWidget* pWidget) + renderGraphicHandle(pCairo, m_aGraphicSelection, m_pGraphicHandle); + } + +- cairo_destroy(pCairo); + #endif + return FALSE; + } +@@ -1154,10 +1151,10 @@ static void lok_doc_view_init (LOKDocView* pDocView) + pDocView->m_pImpl = new LOKDocView_Impl(pDocView); + + g_signal_connect(G_OBJECT(pDocView), +- "expose-event", +- G_CALLBACK(LOKDocView_Impl::onExposed), pDocView); ++ "draw", ++ G_CALLBACK(LOKDocView_Impl::renderDocument), pDocView); + g_signal_connect(G_OBJECT(pDocView), +- "expose-event", ++ "draw", + G_CALLBACK(LOKDocView_Impl::renderOverlay), pDocView); + gtk_widget_add_events(GTK_WIDGET(pDocView), + GDK_BUTTON_PRESS_MASK +-- +2.12.0 + diff --git a/SOURCES/0047-lokdocview-gtktiledviewer-Remove-gtk-version-checks.patch b/SOURCES/0047-lokdocview-gtktiledviewer-Remove-gtk-version-checks.patch new file mode 100644 index 0000000..c56138b --- /dev/null +++ b/SOURCES/0047-lokdocview-gtktiledviewer-Remove-gtk-version-checks.patch @@ -0,0 +1,179 @@ +From 0ceaaec7edbf24d65819afc976f6654dd08e8f12 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Wed, 10 Jun 2015 16:57:19 +0530 +Subject: [PATCH 047/398] lokdocview, gtktiledviewer: Remove gtk version checks + +We already have the global ENABLE_GTK3 guard for RHEL5 baseline. + +Change-Id: Id814a4063861a1e750952b44686ed24864c0394f +(cherry picked from commit 0bb2ae2d00a280cef4cc0c148c7c3c0050709219) +--- + libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 19 ------------------- + libreofficekit/source/gtk/lokdocview.cxx | 10 ---------- + 2 files changed, 29 deletions(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index dc5783b807ad..22d8775981d0 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -40,12 +40,9 @@ std::map g_aToolItemCommandNames; + std::map g_aCommandNameToolItems; + bool g_bToolItemBroadcast = true; + static GtkWidget* pVBox; +-// GtkComboBox requires gtk 2.24 or later +-#if ( GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 24 ) || GTK_MAJOR_VERSION > 2 + static GtkComboBoxText* pPartSelector; + /// Should the part selector avoid calling lok::Document::setPart()? + static bool g_bPartSelectorBroadcast = true; +-#endif + GtkWidget* pFindbar; + GtkWidget* pFindbarEntry; + GtkWidget* pFindbarLabel; +@@ -117,7 +114,6 @@ static void toggleEditing(GtkWidget* /*pButton*/, gpointer /*pItem*/) + /// Toggle the visibility of the findbar. + static void toggleFindbar(GtkWidget* /*pButton*/, gpointer /*pItem*/) + { +-#if GTK_CHECK_VERSION(2,18,0) // we need gtk_widget_get_visible() + if (gtk_widget_get_visible(pFindbar)) + { + gtk_widget_hide(pFindbar); +@@ -127,7 +123,6 @@ static void toggleFindbar(GtkWidget* /*pButton*/, gpointer /*pItem*/) + gtk_widget_show_all(pFindbar); + gtk_widget_grab_focus(pFindbarEntry); + } +-#endif + } + + /// Get the visible area of the scrolled window +@@ -153,13 +148,11 @@ static void getVisibleAreaTwips(GdkRectangle* pArea) + static gboolean signalKey(GtkWidget* pWidget, GdkEventKey* pEvent, gpointer pData) + { + LOKDocView* pLOKDocView = LOK_DOC_VIEW(pDocView); +-#if GTK_CHECK_VERSION(2,18,0) // we need gtk_widget_get_visible() + if (!gtk_widget_get_visible(pFindbar) && bool(lok_doc_view_get_edit(pLOKDocView))) + { + lok_doc_view_post_key(pWidget, pEvent, pData); + return TRUE; + } +-#endif + return FALSE; + } + +@@ -265,11 +258,9 @@ static void signalSearch(LOKDocView* /*pLOKDocView*/, char* /*pPayload*/, gpoint + + static void signalPart(LOKDocView* /*pLOKDocView*/, int nPart, gpointer /*pData*/) + { +-#if GTK_CHECK_VERSION(2,24,0) + g_bPartSelectorBroadcast = false; + gtk_combo_box_set_active(GTK_COMBO_BOX(pPartSelector), nPart); + g_bPartSelectorBroadcast = true; +-#endif + } + + /// User clicked on a cmmand button -> inform LOKDocView. +@@ -285,8 +276,6 @@ static void toggleToolItem(GtkWidget* pWidget, gpointer /*pData*/) + } + } + +-// GtkComboBox requires gtk 2.24 or later +-#if ( GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 24 ) || GTK_MAJOR_VERSION > 2 + static void populatePartSelector() + { + gtk_list_store_clear( GTK_LIST_STORE( +@@ -344,7 +333,6 @@ static void changePartMode( GtkWidget* pSelector, gpointer /* pItem */ ) + lok_doc_view_set_partmode( LOK_DOC_VIEW(pDocView), ePartMode ); + } + } +-#endif + + int main( int argc, char* argv[] ) + { +@@ -387,8 +375,6 @@ int main( int argc, char* argv[] ) + GtkToolItem* pSeparator1 = gtk_separator_tool_item_new(); + gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pSeparator1, -1); + +-// GtkComboBox requires gtk 2.24 or later +-#if ( GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 24 ) || GTK_MAJOR_VERSION > 2 + GtkToolItem* pPartSelectorToolItem = gtk_tool_item_new(); + GtkWidget* pComboBox = gtk_combo_box_text_new(); + gtk_container_add( GTK_CONTAINER(pPartSelectorToolItem), pComboBox ); +@@ -403,7 +389,6 @@ int main( int argc, char* argv[] ) + GtkWidget* pPartModeComboBox = gtk_combo_box_text_new(); + gtk_container_add( GTK_CONTAINER(pPartModeSelectorToolItem), pPartModeComboBox ); + gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pPartModeSelectorToolItem, -1 ); +-#endif + + gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), gtk_separator_tool_item_new(), -1); + pEnableEditing = gtk_toggle_tool_button_new_from_stock(GTK_STOCK_EDIT); +@@ -492,15 +477,11 @@ int main( int argc, char* argv[] ) + g_error("main: lok_doc_view_open_document() failed"); + assert(lok_doc_view_get_document(LOK_DOC_VIEW(pDocView))); + +- // GtkComboBox requires gtk 2.24 or later +-#if ( GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 24 ) || GTK_MAJOR_VERSION > 2 + populatePartSelector(); + populatePartModeSelector( GTK_COMBO_BOX_TEXT(pPartModeComboBox) ); + // Connect these signals after populating the selectors, to avoid re-rendering on setting the default part/partmode. + g_signal_connect(G_OBJECT(pPartModeComboBox), "changed", G_CALLBACK(changePartMode), 0); +- + g_signal_connect(G_OBJECT(pPartSelector), "changed", G_CALLBACK(changePart), 0); +-#endif + + gtk_main(); + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index d79390e6e5ef..b00556620288 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -651,7 +651,6 @@ gboolean LOKDocView_Impl::renderOverlay(GtkWidget* /*widget*/, cairo_t *cr, gpoi + + gboolean LOKDocView_Impl::renderOverlayImpl(cairo_t *pCairo) + { +-#if GTK_CHECK_VERSION(2,14,0) // we need gtk_widget_get_window() + if (m_bEdit && m_bCursorVisible && m_bCursorOverlayVisible && !isEmptyRectangle(m_aVisibleCursor)) + { + if (m_aVisibleCursor.width < 30) +@@ -713,7 +712,6 @@ gboolean LOKDocView_Impl::renderOverlayImpl(cairo_t *pCairo) + renderGraphicHandle(pCairo, m_aGraphicSelection, m_pGraphicHandle); + } + +-#endif + return FALSE; + } + +@@ -1017,9 +1015,7 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback) + case LOK_CALLBACK_HYPERLINK_CLICKED: + { + GError* pError = NULL; +-#if GTK_CHECK_VERSION(2,14,0) + gtk_show_uri(NULL, pCallback->m_aPayload.c_str(), GDK_CURRENT_TIME, &pError); +-#endif + } + break; + case LOK_CALLBACK_STATE_CHANGED: +@@ -1070,22 +1066,16 @@ void LOKDocView_Impl::callbackWorkerImpl(int nType, const char* pPayload) + { + LOKDocView_Impl::CallbackData* pCallback = new LOKDocView_Impl::CallbackData(nType, pPayload ? pPayload : "(nil)", m_pDocView); + g_info("lok_doc_view_callback_worker: %s, '%s'", LOKDocView_Impl::callbackTypeToString(nType), pPayload); +-#if GTK_CHECK_VERSION(2,12,0) + gdk_threads_add_idle(LOKDocView_Impl::callback, pCallback); +-#endif + } + + void LOKDocView_Impl::globalCallbackWorkerImpl(int nType, const char* pPayload) + { + LOKDocView_Impl::CallbackData* pCallback = new LOKDocView_Impl::CallbackData(nType, pPayload ? pPayload : "(nil)", m_pDocView); + g_info("LOKDocView_Impl::globalCallbackWorkerImpl: %s, '%s'", LOKDocView_Impl::callbackTypeToString(nType), pPayload); +-#if GTK_CHECK_VERSION(2,12,0) + gdk_threads_add_idle(LOKDocView_Impl::globalCallback, pCallback); +-#endif + } + +- +- + void LOKDocView_Impl::commandChanged(const std::string& rString) + { + g_signal_emit(m_pDocView, doc_view_signals[COMMAND_CHANGED], 0, rString.c_str()); +-- +2.12.0 + diff --git a/SOURCES/0048-gtktiledviewer-Replace-deprecated-Gtk-functions.patch b/SOURCES/0048-gtktiledviewer-Replace-deprecated-Gtk-functions.patch new file mode 100644 index 0000000..003c3df --- /dev/null +++ b/SOURCES/0048-gtktiledviewer-Replace-deprecated-Gtk-functions.patch @@ -0,0 +1,161 @@ +From f652ef0d80d59c3b7223cc0679403f3e42dda044 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Wed, 10 Jun 2015 20:59:18 +0530 +Subject: [PATCH 048/398] gtktiledviewer: Replace deprecated Gtk functions + +Change-Id: I354aa987f8e732945fb552d855a3416c782bb508 +(cherry picked from commit 101b616c7a2ee90b6d09eedd7a7543a63f237c97) +--- + .../qa/gtktiledviewer/gtktiledviewer.cxx | 55 ++++++++++++++-------- + 1 file changed, 36 insertions(+), 19 deletions(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 22d8775981d0..580d5f66f683 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -57,7 +57,7 @@ const float fZooms[] = { 0.25, 0.5, 0.75, 1.0, 1.5, 2.0, 3.0, 5.0 }; + + static void changeZoom( GtkWidget* pButton, gpointer /* pItem */ ) + { +- const char *sName = gtk_tool_button_get_stock_id( GTK_TOOL_BUTTON(pButton) ); ++ const char *sName = gtk_tool_button_get_icon_name( GTK_TOOL_BUTTON(pButton) ); + + float fZoom = 0; + float fCurrentZoom = 0; +@@ -67,7 +67,7 @@ static void changeZoom( GtkWidget* pButton, gpointer /* pItem */ ) + fCurrentZoom = lok_doc_view_get_zoom( LOK_DOC_VIEW(pDocView) ); + } + +- if ( strcmp(sName, "gtk-zoom-in") == 0) ++ if ( strcmp(sName, "zoom-in-symbolic") == 0) + { + for ( unsigned int i = 0; i < sizeof( fZooms ) / sizeof( fZooms[0] ); i++ ) + { +@@ -78,11 +78,11 @@ static void changeZoom( GtkWidget* pButton, gpointer /* pItem */ ) + } + } + } +- else if ( strcmp(sName, "gtk-zoom-100") == 0) ++ else if ( strcmp(sName, "zoom-original-symbolic") == 0) + { + fZoom = 1; + } +- else if ( strcmp(sName, "gtk-zoom-out") == 0) ++ else if ( strcmp(sName, "zoom-out-symbolic") == 0) + { + for ( unsigned int i = 0; i < sizeof( fZooms ) / sizeof( fZooms[0] ); i++ ) + { +@@ -353,22 +353,25 @@ int main( int argc, char* argv[] ) + gtk_window_set_default_size(GTK_WINDOW(pWindow), 1024, 768); + g_signal_connect( pWindow, "destroy", G_CALLBACK(gtk_main_quit), NULL ); + +- pVBox = gtk_vbox_new( FALSE, 0 ); ++ pVBox = gtk_box_new( GTK_ORIENTATION_VERTICAL, 0 ); + gtk_container_add( GTK_CONTAINER(pWindow), pVBox ); + + // Toolbar + GtkWidget* pToolbar = gtk_toolbar_new(); + gtk_toolbar_set_style( GTK_TOOLBAR(pToolbar), GTK_TOOLBAR_ICONS ); + +- GtkToolItem* pZoomIn = gtk_tool_button_new_from_stock( GTK_STOCK_ZOOM_IN ); ++ GtkToolItem* pZoomIn = gtk_tool_button_new( NULL, NULL ); ++ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pZoomIn), "zoom-in-symbolic"); + gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pZoomIn, 0); + g_signal_connect( G_OBJECT(pZoomIn), "clicked", G_CALLBACK(changeZoom), NULL ); + +- GtkToolItem* pZoom1 = gtk_tool_button_new_from_stock( GTK_STOCK_ZOOM_100 ); ++ GtkToolItem* pZoom1 = gtk_tool_button_new( NULL, NULL ); ++ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pZoom1), "zoom-original-symbolic"); + gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pZoom1, -1); + g_signal_connect( G_OBJECT(pZoom1), "clicked", G_CALLBACK(changeZoom), NULL ); + +- GtkToolItem* pZoomOut = gtk_tool_button_new_from_stock( GTK_STOCK_ZOOM_OUT ); ++ GtkToolItem* pZoomOut = gtk_tool_button_new( NULL, NULL ); ++ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pZoomOut), "zoom-out-symbolic"); + gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pZoomOut, -1); + g_signal_connect( G_OBJECT(pZoomOut), "clicked", G_CALLBACK(changeZoom), NULL ); + +@@ -391,27 +394,38 @@ int main( int argc, char* argv[] ) + gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pPartModeSelectorToolItem, -1 ); + + gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), gtk_separator_tool_item_new(), -1); +- pEnableEditing = gtk_toggle_tool_button_new_from_stock(GTK_STOCK_EDIT); ++ pEnableEditing = gtk_toggle_tool_button_new(); ++ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pEnableEditing), "insert-text-symbolic"); + gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pEnableEditing, -1); + g_signal_connect(G_OBJECT(pEnableEditing), "toggled", G_CALLBACK(toggleEditing), NULL); +- GtkToolItem* pFindButton = gtk_tool_button_new_from_stock(GTK_STOCK_FIND); ++ ++ GtkToolItem* pFindButton = gtk_tool_button_new( NULL, NULL); ++ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pFindButton), "edit-find-symbolic"); + gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pFindButton, -1); + g_signal_connect(G_OBJECT(pFindButton), "clicked", G_CALLBACK(toggleFindbar), NULL); + + gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), gtk_separator_tool_item_new(), -1); +- pBold = gtk_toggle_tool_button_new_from_stock(GTK_STOCK_BOLD); ++ ++ pBold = gtk_toggle_tool_button_new(); ++ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pBold), "format-text-bold-symbolic"); + gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pBold, -1); + g_signal_connect(G_OBJECT(pBold), "toggled", G_CALLBACK(toggleToolItem), NULL); + lcl_registerToolItem(pBold, ".uno:Bold"); +- pItalic = gtk_toggle_tool_button_new_from_stock(GTK_STOCK_ITALIC); ++ ++ pItalic = gtk_toggle_tool_button_new(); ++ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pItalic), "format-text-italic-symbolic"); + gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pItalic, -1); + g_signal_connect(G_OBJECT(pItalic), "toggled", G_CALLBACK(toggleToolItem), NULL); + lcl_registerToolItem(pItalic, ".uno:Italic"); +- pUnderline = gtk_toggle_tool_button_new_from_stock(GTK_STOCK_UNDERLINE); ++ ++ pUnderline = gtk_toggle_tool_button_new(); ++ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pUnderline), "format-text-underline-symbolic"); + gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pUnderline, -1); + g_signal_connect(G_OBJECT(pUnderline), "toggled", G_CALLBACK(toggleToolItem), NULL); + lcl_registerToolItem(pUnderline, ".uno:Underline"); +- pStrikethrough = gtk_toggle_tool_button_new_from_stock(GTK_STOCK_STRIKETHROUGH); ++ ++ pStrikethrough = gtk_toggle_tool_button_new (); ++ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pStrikethrough), "format-text-strikethrough-symbolic"); + gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pStrikethrough, -1); + g_signal_connect(G_OBJECT(pStrikethrough), "toggled", G_CALLBACK(toggleToolItem), NULL); + lcl_registerToolItem(pStrikethrough, ".uno:Strikeout"); +@@ -422,7 +436,8 @@ int main( int argc, char* argv[] ) + pFindbar = gtk_toolbar_new(); + gtk_toolbar_set_style(GTK_TOOLBAR(pFindbar), GTK_TOOLBAR_ICONS); + +- GtkToolItem* pFindbarClose = gtk_tool_button_new_from_stock(GTK_STOCK_CLOSE); ++ GtkToolItem* pFindbarClose = gtk_tool_button_new( NULL, NULL); ++ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pFindbarClose), "window-close-symbolic"); + gtk_toolbar_insert(GTK_TOOLBAR(pFindbar), pFindbarClose, -1); + g_signal_connect(G_OBJECT(pFindbarClose), "clicked", G_CALLBACK(toggleFindbar), NULL); + +@@ -432,10 +447,13 @@ int main( int argc, char* argv[] ) + g_signal_connect(pFindbarEntry, "key-press-event", G_CALLBACK(signalFindbar), 0); + gtk_toolbar_insert(GTK_TOOLBAR(pFindbar), pEntryContainer, -1); + +- GtkToolItem* pFindbarNext = gtk_tool_button_new_from_stock(GTK_STOCK_GO_DOWN); ++ GtkToolItem* pFindbarNext = gtk_tool_button_new( NULL, NULL); ++ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pFindbarNext), "go-down-symbolic"); + gtk_toolbar_insert(GTK_TOOLBAR(pFindbar), pFindbarNext, -1); + g_signal_connect(G_OBJECT(pFindbarNext), "clicked", G_CALLBACK(signalSearchNext), NULL); +- GtkToolItem* pFindbarPrev = gtk_tool_button_new_from_stock(GTK_STOCK_GO_UP); ++ ++ GtkToolItem* pFindbarPrev = gtk_tool_button_new( NULL, NULL); ++ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pFindbarPrev), "go-up-symbolic"); + gtk_toolbar_insert(GTK_TOOLBAR(pFindbar), pFindbarPrev, -1); + g_signal_connect(G_OBJECT(pFindbarPrev), "clicked", G_CALLBACK(signalSearchPrev), NULL); + +@@ -465,8 +483,7 @@ int main( int argc, char* argv[] ) + gtk_widget_set_vexpand (pScrolledWindow, TRUE); + gtk_container_add(GTK_CONTAINER(pVBox), pScrolledWindow); + +- // DocView doesn't have scrolling capability, so need a viewport +- gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(pScrolledWindow), pDocView); ++ gtk_container_add(GTK_CONTAINER(pScrolledWindow), pDocView); + + gtk_widget_show_all( pWindow ); + // Hide the findbar by default. +-- +2.12.0 + diff --git a/SOURCES/0049-Repository.mk-libreofficekitgtk-is-conditional-on-EN.patch b/SOURCES/0049-Repository.mk-libreofficekitgtk-is-conditional-on-EN.patch new file mode 100644 index 0000000..1cd3258 --- /dev/null +++ b/SOURCES/0049-Repository.mk-libreofficekitgtk-is-conditional-on-EN.patch @@ -0,0 +1,28 @@ +From 89f0ed26b0afeff20d8d40138a2254b399e54a9c Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 16 Jun 2015 09:10:02 +0200 +Subject: [PATCH 049/398] Repository.mk: libreofficekitgtk is conditional on + ENABLE_GTK3 + +Change-Id: I97f859e33a510f626787cce335f652dc03546ab6 +(cherry picked from commit 7ffd7c4fd7bdc63098ec6ac746b9885f92964465) +--- + Repository.mk | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Repository.mk b/Repository.mk +index f7c89c0057a0..a84dc9a12211 100644 +--- a/Repository.mk ++++ b/Repository.mk +@@ -582,7 +582,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,PLAINLIBS_OOO,ooo, \ + i18nlangtag \ + i18nutil \ + index_data \ +- $(if $(and $(ENABLE_GTK), $(filter LINUX,$(OS))), libreofficekitgtk) \ ++ $(if $(and $(ENABLE_GTK3), $(filter LINUX,$(OS))), libreofficekitgtk) \ + localedata_en \ + localedata_es \ + localedata_euro \ +-- +2.12.0 + diff --git a/SOURCES/0050-lokdocview-Restructure-this-GObject-class.patch b/SOURCES/0050-lokdocview-Restructure-this-GObject-class.patch new file mode 100644 index 0000000..e3344be --- /dev/null +++ b/SOURCES/0050-lokdocview-Restructure-this-GObject-class.patch @@ -0,0 +1,2380 @@ +From 90cd5fdf14031c259ddc4f9ecf9ada7c37fcf421 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Thu, 11 Jun 2015 22:00:11 +0530 +Subject: [PATCH 050/398] lokdocview: Restructure this GObject class + +This is a big messy commit restructuring the whole class to follow most +common practices followed by standard GObject classes, so that it can +keep gobject-introspection happy; hence, allowing this widget to be used +from other languages. + +(cherry picked from commit 3061e486f9f9313c15cba6782edfaee96fe4f83d) + +Change-Id: I10c34dad402d1ec586958b2db21ff44412c36cea +--- + include/LibreOfficeKit/LibreOfficeKitGtk.h | 17 +- + .../qa/gtktiledviewer/gtktiledviewer.cxx | 4 +- + libreofficekit/source/gtk/lokdocview.cxx | 1856 +++++++++++--------- + 3 files changed, 1041 insertions(+), 836 deletions(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h +index bdd2e9ab90e3..7048dbefc0a1 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h ++++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h +@@ -25,23 +25,19 @@ G_BEGIN_DECLS + #define LOK_IS_DOC_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), LOK_TYPE_DOC_VIEW)) + #define LOK_DOC_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), LOK_TYPE_DOC_VIEW, LOKDocViewClass)) + +- +-typedef struct _LOKDocView LOKDocView; +-typedef struct _LOKDocViewClass LOKDocViewClass; ++typedef struct _LOKDocView LOKDocView; ++typedef struct _LOKDocViewClass LOKDocViewClass; ++typedef struct _LOKDocViewPrivate LOKDocViewPrivate; + + struct _LOKDocView + { + GtkDrawingArea aDrawingArea; +- struct LOKDocView_Impl* m_pImpl; ++ LOKDocViewPrivate* priv; + }; + + struct _LOKDocViewClass + { + GtkDrawingAreaClass parent_class; +- void (* edit_changed) (LOKDocView* pView, gboolean was_edit); +- void (* command_changed) (LOKDocView* pView, char* new_state); +- void (* search_not_found) (LOKDocView* pView, char* new_state); +- void (* part_changed) (LOKDocView* pView, int new_part); + }; + + GType lok_doc_view_get_type (void) G_GNUC_CONST; +@@ -78,9 +74,8 @@ void lok_doc_view_post_command (LOKDocView* + const char* pArguments); + + /// Posts a keyboard event to LibreOfficeKit. +-void lok_doc_view_post_key (GtkWidget* pWidget, +- GdkEventKey* pEvent, +- gpointer pData); ++void lok_doc_view_post_key (LOKDocView* pDocView, ++ GdkEvent* pEvent); + + float lok_doc_view_pixel_to_twip (LOKDocView* pDocView, + float fInput); +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 580d5f66f683..8b006797c226 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -145,12 +145,12 @@ static void getVisibleAreaTwips(GdkRectangle* pArea) + + + /// Handles the key-press-event of the window. +-static gboolean signalKey(GtkWidget* pWidget, GdkEventKey* pEvent, gpointer pData) ++static gboolean signalKey(GtkWidget* /*pWidget*/, GdkEvent* pEvent, gpointer/* pData*/) + { + LOKDocView* pLOKDocView = LOK_DOC_VIEW(pDocView); + if (!gtk_widget_get_visible(pFindbar) && bool(lok_doc_view_get_edit(pLOKDocView))) + { +- lok_doc_view_post_key(pWidget, pEvent, pData); ++ lok_doc_view_post_key(pLOKDocView, pEvent); + return TRUE; + } + return FALSE; +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index b00556620288..7031be9b6536 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -36,26 +36,30 @@ + // Number of handles around a graphic selection. + #define GRAPHIC_HANDLE_COUNT 8 + +-/// Holds data used by LOKDocView only. +-struct LOKDocView_Impl ++struct _LOKDocViewPrivate + { +- LOKDocView* m_pDocView; +- TileBuffer m_aTileBuffer; +- +- float m_fZoom; +- ++ gchar* m_aLOPath; ++ gchar* m_aDocPath; ++ guint m_nLoadProgress; ++ gboolean m_bIsLoading; ++ gboolean m_bCanZoomIn; ++ gboolean m_bCanZoomOut; + LibreOfficeKit* m_pOffice; + LibreOfficeKitDocument* m_pDocument; +- long m_nDocumentWidthTwips; +- long m_nDocumentHeightTwips; ++ ++ TileBuffer m_aTileBuffer; ++ ++ gfloat m_fZoom; ++ glong m_nDocumentWidthTwips; ++ glong m_nDocumentHeightTwips; + /// View or edit mode. +- bool m_bEdit; ++ gboolean m_bEdit; + /// Position and size of the visible cursor. + GdkRectangle m_aVisibleCursor; + /// Cursor overlay is visible or hidden (for blinking). +- bool m_bCursorOverlayVisible; ++ gboolean m_bCursorOverlayVisible; + /// Cursor is visible or hidden (e.g. for graphic selection). +- bool m_bCursorVisible; ++ gboolean m_bCursorVisible; + /// Time of the last button press. + guint32 m_nLastButtonPressTime; + /// Time of the last button release. +@@ -67,7 +71,7 @@ struct LOKDocView_Impl + /// Position and size of the selection end. + GdkRectangle m_aTextSelectionEnd; + GdkRectangle m_aGraphicSelection; +- bool m_bInDragGraphicSelection; ++ gboolean m_bInDragGraphicSelection; + + /// @name Start/middle/end handle. + ///@{ +@@ -76,19 +80,19 @@ struct LOKDocView_Impl + /// Rectangle of the text selection start handle, to know if the user clicked on it or not + GdkRectangle m_aHandleStartRect; + /// If we are in the middle of a drag of the text selection end handle. +- bool m_bInDragStartHandle; ++ gboolean m_bInDragStartHandle; + /// Bitmap of the text selection middle handle. + cairo_surface_t* m_pHandleMiddle; + /// Rectangle of the text selection middle handle, to know if the user clicked on it or not + GdkRectangle m_aHandleMiddleRect; + /// If we are in the middle of a drag of the text selection middle handle. +- bool m_bInDragMiddleHandle; ++ gboolean m_bInDragMiddleHandle; + /// Bitmap of the text selection end handle. + cairo_surface_t* m_pHandleEnd; + /// Rectangle of the text selection end handle, to know if the user clicked on it or not + GdkRectangle m_aHandleEndRect; + /// If we are in the middle of a drag of the text selection end handle. +- bool m_bInDragEndHandle; ++ gboolean m_bInDragEndHandle; + ///@} + + /// @name Graphic handles. +@@ -98,103 +102,38 @@ struct LOKDocView_Impl + /// Rectangle of a graphic selection handle, to know if the user clicked on it or not. + GdkRectangle m_aGraphicHandleRects[8]; + /// If we are in the middle of a drag of a graphic selection handle. +- bool m_bInDragGraphicHandles[8]; ++ gboolean m_bInDragGraphicHandles[8]; + ///@} +- +- /// Callback data, allocated in lok_doc_view_callback_worker(), released in lok_doc_view_callback(). +- struct CallbackData +- { +- int m_nType; +- std::string m_aPayload; +- LOKDocView* m_pDocView; +- +- CallbackData(int nType, const std::string& rPayload, LOKDocView* pDocView); +- }; +- +- +- LOKDocView_Impl(LOKDocView* pDocView); +- ~LOKDocView_Impl(); +- /// Connected to the destroy signal of LOKDocView, deletes its LOKDocView_Impl. +- static void destroy(LOKDocView* pDocView, gpointer pData); +- /// Connected to the draw of the GtkDrawingArea +- static gboolean renderDocument(GtkWidget *widget, cairo_t *cr, gpointer user_data); +- /// Implementation of draw event handler, invoked by renderDocument(). +- gboolean renderDocumentImpl(cairo_t* cr); +- /// Receives a key press or release event. +- void signalKey(GdkEventKey* pEvent); +- /* +- * The user drags the handle, which is below the cursor, but wants to move the +- * cursor accordingly. +- * +- * @param pHandle the rectangle of the handle +- * @param pEvent the motion event +- * @param pPoint the computed point (output parameter) +- */ +- static void getDragPoint(GdkRectangle* pHandle, GdkEventButton* pEvent, GdkPoint* pPoint); +- /// Receives a button press event. +- static gboolean signalButton(GtkWidget* pEventBox, GdkEventButton* pEvent, LOKDocView* pDocView); +- /// Implementation of button press event handler, invoked by signalButton(). +- gboolean signalButtonImpl(GdkEventButton* pEvent); +- /// Receives a motion event. +- static gboolean signalMotion(GtkWidget* pEventBox, GdkEventButton* pEvent, LOKDocView* pDocView); +- /// Implementation of motion event handler, invoked by signalMotion(). +- gboolean signalMotionImpl(GdkEventButton* pEvent); +- /// Receives an expose event. +- static gboolean renderOverlay(GtkWidget* pWidget, cairo_t* cr, gpointer userdata); +- /// Implementation of expose event handler (renders cursor and selection overlay), invoked by renderOverlay(). +- gboolean renderOverlayImpl(cairo_t *cr); +- /// Is rRectangle empty? +- static bool isEmptyRectangle(const GdkRectangle& rRectangle); +- /* +- * Renders pHandle below an rCursor rectangle on pCairo. +- * @param rRectangle output parameter, the rectangle that contains the rendered handle. +- */ +- void renderHandle(cairo_t* pCairo, const GdkRectangle& rCursor, cairo_surface_t* pHandle, GdkRectangle& rRectangle); +- /// Renders pHandle around an rSelection rectangle on pCairo. +- void renderGraphicHandle(cairo_t* pCairo, const GdkRectangle& rSelection, cairo_surface_t* pHandle); +- /// Takes care of the blinking cursor. +- static gboolean handleTimeout(gpointer pData); +- /// Implementation of the timeout handler, invoked by handleTimeout(). +- gboolean handleTimeoutImpl(); +- /// Returns the GdkRectangle of a x,y,width,height string. +- GdkRectangle payloadToRectangle(const char* pPayload); +- /// Returns the GdkRectangles of a x1,y1,w1,h1;x2,y2,w2,h2;... string. +- std::vector payloadToRectangles(const char* pPayload); +- /// Returns the string representation of a LibreOfficeKitCallbackType enumeration element. +- static const char* callbackTypeToString(int nType); +- /// Invoked on the main thread if callbackWorker() requests so. +- static gboolean callback(gpointer pData); +- /// Invoked on the main thread if globalCallbackWorker() requests so. +- static gboolean globalCallback(gpointer pData); +- /// Implementation of the callback handler, invoked by callback(); +- gboolean callbackImpl(CallbackData* pCallbackData); +- /// Our LOK callback, runs on the LO thread. +- static void callbackWorker(int nType, const char* pPayload, void* pData); +- /// Implementation of the callback worder handler, invoked by callbackWorker(). +- void callbackWorkerImpl(int nType, const char* pPayload); +- /// Our global LOK callback, runs on the LO thread. +- static void globalCallbackWorker(int nType, const char* pPayload, void* pData); +- /// Implementation of the global callback worder handler, invoked by globalCallbackWorker(). +- void globalCallbackWorkerImpl(int nType, const char* pPayload); +- /// Command state (various buttons like bold are toggled or not) is changed. +- void commandChanged(const std::string& rPayload); +- /// Search did not find any matches. +- void searchNotFound(const std::string& rPayload); +- /// LOK decided to change parts, need to update UI. +- void setPart(const std::string& rPayload); +- /// Sets the tiles enclosed by rRectangle as invalid in m_aTileBuffer +- void setTilesInvalid(const GdkRectangle& rRectangle); + }; + + enum + { ++ LOAD_CHANGED, ++ LOAD_FAILED, + EDIT_CHANGED, + COMMAND_CHANGED, + SEARCH_NOT_FOUND, + PART_CHANGED, ++ HYPERLINK_CLICKED, ++ + LAST_SIGNAL + }; + ++enum ++{ ++ PROP_0, ++ ++ PROP_LO_PATH, ++ PROP_DOC_PATH, ++ PROP_EDITABLE, ++ PROP_LOAD_PROGRESS, ++ PROP_ZOOM, ++ PROP_IS_LOADING, ++ PROP_DOC_WIDTH, ++ PROP_DOC_HEIGHT, ++ PROP_CAN_ZOOM_IN, ++ PROP_CAN_ZOOM_OUT ++}; + + static guint doc_view_signals[LAST_SIGNAL] = { 0 }; + +@@ -203,15 +142,26 @@ SAL_DLLPUBLIC_EXPORT GType lok_doc_view_get_type(); + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wunused-function" + #endif +-G_DEFINE_TYPE(LOKDocView, lok_doc_view, GTK_TYPE_DRAWING_AREA) ++G_DEFINE_TYPE_WITH_PRIVATE (LOKDocView, lok_doc_view, GTK_TYPE_DRAWING_AREA) + #ifdef __GNUC__ + #pragma GCC diagnostic pop + #endif + +-namespace { + +-/// Sets rWidth and rHeight from a "width, height" string. +-void payloadToSize(const char* pPayload, long& rWidth, long& rHeight) ++struct CallbackData ++{ ++ int m_nType; ++ std::string m_aPayload; ++ LOKDocView* m_pDocView; ++ ++ CallbackData(int nType, const std::string& rPayload, LOKDocView* pDocView) ++ : m_nType(nType), ++ m_aPayload(rPayload), ++ m_pDocView(pDocView) {} ++}; ++ ++static void ++payloadToSize(const char* pPayload, long& rWidth, long& rHeight) + { + rWidth = rHeight = 0; + gchar** ppCoordinates = g_strsplit(pPayload, ", ", 2); +@@ -226,177 +176,70 @@ void payloadToSize(const char* pPayload, long& rWidth, long& rHeight) + g_strfreev(ppCoordinates); + } + +-} +- +- +- +-namespace { +- +-/// Implementation of the global callback handler, invoked by globalCallback(); +-gboolean globalCallbackImpl(LOKDocView_Impl::CallbackData* pCallback) ++/// Returns the string representation of a LibreOfficeKitCallbackType enumeration element. ++static const char* ++callbackTypeToString (int nType) + { +- switch (pCallback->m_nType) ++ switch (nType) + { ++ case LOK_CALLBACK_INVALIDATE_TILES: ++ return "LOK_CALLBACK_INVALIDATE_TILES"; ++ case LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR: ++ return "LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR"; ++ case LOK_CALLBACK_TEXT_SELECTION: ++ return "LOK_CALLBACK_TEXT_SELECTION"; ++ case LOK_CALLBACK_TEXT_SELECTION_START: ++ return "LOK_CALLBACK_TEXT_SELECTION_START"; ++ case LOK_CALLBACK_TEXT_SELECTION_END: ++ return "LOK_CALLBACK_TEXT_SELECTION_END"; ++ case LOK_CALLBACK_CURSOR_VISIBLE: ++ return "LOK_CALLBACK_CURSOR_VISIBLE"; ++ case LOK_CALLBACK_GRAPHIC_SELECTION: ++ return "LOK_CALLBACK_GRAPHIC_SELECTION"; ++ case LOK_CALLBACK_HYPERLINK_CLICKED: ++ return "LOK_CALLBACK_HYPERLINK_CLICKED"; ++ case LOK_CALLBACK_STATE_CHANGED: ++ return "LOK_CALLBACK_STATE_CHANGED"; + case LOK_CALLBACK_STATUS_INDICATOR_START: +- { +- } +- break; ++ return "LOK_CALLBACK_STATUS_INDICATOR_START"; + case LOK_CALLBACK_STATUS_INDICATOR_SET_VALUE: +- { +- } +- break; ++ return "LOK_CALLBACK_STATUS_INDICATOR_SET_VALUE"; + case LOK_CALLBACK_STATUS_INDICATOR_FINISH: +- { +- } +- break; +- default: +- g_assert(false); +- break; ++ return "LOK_CALLBACK_STATUS_INDICATOR_FINISH"; ++ case LOK_CALLBACK_SEARCH_NOT_FOUND: ++ return "LOK_CALLBACK_SEARCH_NOT_FOUND"; ++ case LOK_CALLBACK_DOCUMENT_SIZE_CHANGED: ++ return "LOK_CALLBACK_DOCUMENT_SIZE_CHANGED"; ++ case LOK_CALLBACK_SET_PART: ++ return "LOK_CALLBACK_SET_PART"; + } +- delete pCallback; +- +- return G_SOURCE_REMOVE; +-} +- +-} +- +-LOKDocView_Impl::CallbackData::CallbackData(int nType, const std::string& rPayload, LOKDocView* pDocView) +- : m_nType(nType), +- m_aPayload(rPayload), +- m_pDocView(pDocView) +-{ +-} +- +-LOKDocView_Impl::LOKDocView_Impl(LOKDocView* pDocView) +- : m_pDocView(pDocView), +- m_aTileBuffer(TileBuffer(0,0)), +- m_fZoom(1), +- m_pOffice(0), +- m_pDocument(0), +- m_nDocumentWidthTwips(0), +- m_nDocumentHeightTwips(0), +- m_bEdit(false), +- m_aVisibleCursor({0, 0, 0, 0}), +- m_bCursorOverlayVisible(false), +- m_bCursorVisible(true), +- m_nLastButtonPressTime(0), +- m_nLastButtonReleaseTime(0), +- m_aTextSelectionStart({0, 0, 0, 0}), +- m_aTextSelectionEnd({0, 0, 0, 0}), +- m_aGraphicSelection({0, 0, 0, 0}), +- m_bInDragGraphicSelection(false), +- +- // Start/middle/end handle. +- m_pHandleStart(0), +- m_aHandleStartRect({0, 0, 0, 0}), +- m_bInDragStartHandle(false), +- m_pHandleMiddle(0), +- m_aHandleMiddleRect({0, 0, 0, 0}), +- m_bInDragMiddleHandle(false), +- m_pHandleEnd(0), +- m_aHandleEndRect({0, 0, 0, 0}), +- m_bInDragEndHandle(false), +- +- m_pGraphicHandle(0) +-{ +- memset(&m_aGraphicHandleRects, 0, sizeof(m_aGraphicHandleRects)); +- memset(&m_bInDragGraphicHandles, 0, sizeof(m_bInDragGraphicHandles)); +-} +- +-LOKDocView_Impl::~LOKDocView_Impl() +-{ +- if (m_pDocument) +- m_pDocument->pClass->destroy(m_pDocument); +- if (m_pOffice) +- m_pOffice->pClass->destroy(m_pOffice); +- m_pDocument = 0; +- m_pOffice = 0; +-} +- +-void LOKDocView_Impl::destroy(LOKDocView* pDocView, gpointer /*pData*/) +-{ +- // We specifically need to destroy the document when closing in order to ensure +- // that lock files etc. are cleaned up. +- delete pDocView->m_pImpl; +-} +- +-gboolean LOKDocView_Impl::renderDocument(GtkWidget* /*widget*/, cairo_t *cr, gpointer userdata) +-{ +- LOKDocView *pDocView = LOK_DOC_VIEW (userdata); +- return pDocView->m_pImpl->renderDocumentImpl(cr); ++ return 0; + } + +-gboolean LOKDocView_Impl::renderDocumentImpl(cairo_t *pCairo) ++static bool ++isEmptyRectangle(const GdkRectangle& rRectangle) + { +- long nDocumentWidthPixels = twipToPixel(m_nDocumentWidthTwips, m_fZoom); +- long nDocumentHeightPixels = twipToPixel(m_nDocumentHeightTwips, m_fZoom); +- // Total number of rows / columns in this document. +- guint nRows = ceil((double)nDocumentHeightPixels / nTileSizePixels); +- guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); +- GdkRectangle aVisibleArea; +- +- gdk_cairo_get_clip_rectangle (pCairo, &aVisibleArea); +- +- aVisibleArea.x = pixelToTwip (aVisibleArea.x, m_fZoom); +- aVisibleArea.y = pixelToTwip (aVisibleArea.y, m_fZoom); +- aVisibleArea.width = pixelToTwip (aVisibleArea.width, m_fZoom); +- aVisibleArea.height = pixelToTwip (aVisibleArea.height, m_fZoom); +- +- // Render the tiles. +- for (guint nRow = 0; nRow < nRows; ++nRow) +- { +- for (guint nColumn = 0; nColumn < nColumns; ++nColumn) +- { +- GdkRectangle aTileRectangleTwips, aTileRectanglePixels; +- bool bPaint = true; +- +- // Determine size of the tile: the rightmost/bottommost tiles may +- // be smaller, and we need the size to decide if we need to repaint. +- if (nColumn == nColumns - 1) +- aTileRectanglePixels.width = nDocumentWidthPixels - nColumn * nTileSizePixels; +- else +- aTileRectanglePixels.width = nTileSizePixels; +- if (nRow == nRows - 1) +- aTileRectanglePixels.height = nDocumentHeightPixels - nRow * nTileSizePixels; +- else +- aTileRectanglePixels.height = nTileSizePixels; +- +- // Determine size and position of the tile in document coordinates, +- // so we can decide if we can skip painting for partial rendering. +- aTileRectangleTwips.x = pixelToTwip(nTileSizePixels, m_fZoom) * nColumn; +- aTileRectangleTwips.y = pixelToTwip(nTileSizePixels, m_fZoom) * nRow; +- aTileRectangleTwips.width = pixelToTwip(aTileRectanglePixels.width, m_fZoom); +- aTileRectangleTwips.height = pixelToTwip(aTileRectanglePixels.height, m_fZoom); +- +- if (!gdk_rectangle_intersect(&aVisibleArea, &aTileRectangleTwips, 0)) +- bPaint = false; +- +- if (bPaint) +- { +- Tile& currentTile = m_aTileBuffer.getTile(nRow, nColumn, m_fZoom); +- GdkPixbuf* pPixBuf = currentTile.getBuffer(); +- gdk_cairo_set_source_pixbuf (pCairo, pPixBuf, +- twipToPixel(aTileRectangleTwips.x, m_fZoom), +- twipToPixel(aTileRectangleTwips.y, m_fZoom)); +- cairo_paint(pCairo); +- } +- } +- } +- return FALSE; ++ return rRectangle.x == 0 && rRectangle.y == 0 && rRectangle.width == 0 && rRectangle.height == 0; + } + +-void LOKDocView_Impl::signalKey(GdkEventKey* pEvent) ++static void ++signalKey (LOKDocView* pDocView, const GdkEvent* pEvent) + { ++ LOKDocViewPrivate* priv = pDocView->priv; + int nCharCode = 0; + int nKeyCode = 0; ++ guint keyval; ++ GdkModifierType state; ++ gdk_event_get_keyval (pEvent, &keyval); ++ gdk_event_get_state (pEvent, &state); + +- if (!m_bEdit) ++ if (!priv->m_bEdit) + { + g_info("signalKey: not in edit mode, ignore"); + return; + } + +- switch (pEvent->keyval) ++ switch (keyval) + { + case GDK_KEY_BackSpace: + nKeyCode = com::sun::star::awt::Key::BACKSPACE; +@@ -423,325 +266,300 @@ void LOKDocView_Impl::signalKey(GdkEventKey* pEvent) + nKeyCode = com::sun::star::awt::Key::RIGHT; + break; + default: +- if (pEvent->keyval >= GDK_KEY_F1 && pEvent->keyval <= GDK_KEY_F26) +- nKeyCode = com::sun::star::awt::Key::F1 + (pEvent->keyval - GDK_KEY_F1); ++ if (keyval >= GDK_KEY_F1 && keyval <= GDK_KEY_F26) ++ nKeyCode = com::sun::star::awt::Key::F1 + (keyval - GDK_KEY_F1); + else +- nCharCode = gdk_keyval_to_unicode(pEvent->keyval); ++ nCharCode = gdk_keyval_to_unicode(keyval); + } + + // rsc is not public API, but should be good enough for debugging purposes. + // If this is needed for real, then probably a new param of type + // css::awt::KeyModifier is needed in postKeyEvent(). +- if (pEvent->state & GDK_SHIFT_MASK) ++ if (state & GDK_SHIFT_MASK) + nKeyCode |= KEY_SHIFT; + + if (pEvent->type == GDK_KEY_RELEASE) +- m_pDocument->pClass->postKeyEvent(m_pDocument, LOK_KEYEVENT_KEYUP, nCharCode, nKeyCode); ++ priv->m_pDocument->pClass->postKeyEvent(priv->m_pDocument, LOK_KEYEVENT_KEYUP, nCharCode, nKeyCode); + else +- m_pDocument->pClass->postKeyEvent(m_pDocument, LOK_KEYEVENT_KEYINPUT, nCharCode, nKeyCode); +-} +- +-gboolean LOKDocView_Impl::signalButton(GtkWidget* /*pEventBox*/, GdkEventButton* pEvent, LOKDocView* pDocView) +-{ +- return pDocView->m_pImpl->signalButtonImpl(pEvent); ++ priv->m_pDocument->pClass->postKeyEvent(priv->m_pDocument, LOK_KEYEVENT_KEYINPUT, nCharCode, nKeyCode); + } + +-/// Receives a button press event. +-gboolean LOKDocView_Impl::signalButtonImpl(GdkEventButton* pEvent) ++static gboolean ++handleTimeout (gpointer pData) + { +- g_info("LOKDocView_Impl::signalButton: %d, %d (in twips: %d, %d)", (int)pEvent->x, (int)pEvent->y, (int)pixelToTwip(pEvent->x, m_fZoom), (int)pixelToTwip(pEvent->y, m_fZoom)); ++ LOKDocView* pDocView = LOK_DOC_VIEW (pData); ++ LOKDocViewPrivate* priv = pDocView->priv; + +- if (pEvent->type == GDK_BUTTON_RELEASE) ++ if (priv->m_bEdit) + { +- if (m_bInDragStartHandle) +- { +- g_info("LOKDocView_Impl::signalButton: end of drag start handle"); +- m_bInDragStartHandle = false; +- return FALSE; +- } +- else if (m_bInDragMiddleHandle) +- { +- g_info("LOKDocView_Impl::signalButton: end of drag middle handle"); +- m_bInDragMiddleHandle = false; +- return FALSE; +- } +- else if (m_bInDragEndHandle) +- { +- g_info("LOKDocView_Impl::signalButton: end of drag end handle"); +- m_bInDragEndHandle = false; +- return FALSE; +- } ++ if (priv->m_bCursorOverlayVisible) ++ priv->m_bCursorOverlayVisible = false; ++ else ++ priv->m_bCursorOverlayVisible = true; ++ gtk_widget_queue_draw(GTK_WIDGET(pDocView)); ++ } + +- for (int i = 0; i < GRAPHIC_HANDLE_COUNT; ++i) +- { +- if (m_bInDragGraphicHandles[i]) +- { +- g_info("LOKDocView_Impl::signalButton: end of drag graphic handle #%d", i); +- m_bInDragGraphicHandles[i] = false; +- m_pDocument->pClass->setGraphicSelection(m_pDocument, LOK_SETGRAPHICSELECTION_END, pixelToTwip(pEvent->x, m_fZoom), pixelToTwip(pEvent->y, m_fZoom)); +- return FALSE; +- } +- } ++ return G_SOURCE_CONTINUE; ++} + +- if (m_bInDragGraphicSelection) +- { +- g_info("LOKDocView_Impl::signalButton: end of drag graphic selection"); +- m_bInDragGraphicSelection = false; +- m_pDocument->pClass->setGraphicSelection(m_pDocument, LOK_SETGRAPHICSELECTION_END, pixelToTwip(pEvent->x, m_fZoom), pixelToTwip(pEvent->y, m_fZoom)); +- return FALSE; +- } +- } ++static void ++commandChanged(LOKDocView* pDocView, const std::string& rString) ++{ ++ g_signal_emit(pDocView, doc_view_signals[COMMAND_CHANGED], 0, rString.c_str()); ++} + +- if (m_bEdit) +- { +- GdkRectangle aClick; +- aClick.x = pEvent->x; +- aClick.y = pEvent->y; +- aClick.width = 1; +- aClick.height = 1; +- if (pEvent->type == GDK_BUTTON_PRESS) +- { +- if (gdk_rectangle_intersect(&aClick, &m_aHandleStartRect, NULL)) +- { +- g_info("LOKDocView_Impl::signalButton: start of drag start handle"); +- m_bInDragStartHandle = true; +- return FALSE; +- } +- else if (gdk_rectangle_intersect(&aClick, &m_aHandleMiddleRect, NULL)) +- { +- g_info("LOKDocView_Impl::signalButton: start of drag middle handle"); +- m_bInDragMiddleHandle = true; +- return FALSE; +- } +- else if (gdk_rectangle_intersect(&aClick, &m_aHandleEndRect, NULL)) +- { +- g_info("LOKDocView_Impl::signalButton: start of drag end handle"); +- m_bInDragEndHandle = true; +- return FALSE; +- } ++static void ++searchNotFound(LOKDocView* pDocView, const std::string& rString) ++{ ++ g_signal_emit(pDocView, doc_view_signals[SEARCH_NOT_FOUND], 0, rString.c_str()); ++} + +- for (int i = 0; i < GRAPHIC_HANDLE_COUNT; ++i) +- { +- if (gdk_rectangle_intersect(&aClick, &m_aGraphicHandleRects[i], NULL)) +- { +- g_info("LOKDocView_Impl::signalButton: start of drag graphic handle #%d", i); +- m_bInDragGraphicHandles[i] = true; +- m_pDocument->pClass->setGraphicSelection(m_pDocument, +- LOK_SETGRAPHICSELECTION_START, +- pixelToTwip(m_aGraphicHandleRects[i].x + m_aGraphicHandleRects[i].width / 2, m_fZoom), +- pixelToTwip(m_aGraphicHandleRects[i].y + m_aGraphicHandleRects[i].height / 2, m_fZoom)); +- return FALSE; +- } +- } +- } +- } ++static void ++setPart(LOKDocView* pDocView, const std::string& rString) ++{ ++ g_signal_emit(pDocView, doc_view_signals[PART_CHANGED], 0, std::stoi(rString)); ++} + +- if (!m_bEdit) +- lok_doc_view_set_edit(m_pDocView, TRUE); ++/// Implementation of the global callback handler, invoked by globalCallback(); ++static gboolean ++globalCallback (gpointer pData) ++{ ++ CallbackData* pCallback = static_cast(pData); + +- switch (pEvent->type) ++ switch (pCallback->m_nType) + { +- case GDK_BUTTON_PRESS: ++ case LOK_CALLBACK_STATUS_INDICATOR_START: + { +- int nCount = 1; +- if ((pEvent->time - m_nLastButtonPressTime) < 250) +- nCount++; +- m_nLastButtonPressTime = pEvent->time; +- m_pDocument->pClass->postMouseEvent(m_pDocument, LOK_MOUSEEVENT_MOUSEBUTTONDOWN, pixelToTwip(pEvent->x, m_fZoom), pixelToTwip(pEvent->y, m_fZoom), nCount); +- break; + } +- case GDK_BUTTON_RELEASE: ++ break; ++ case LOK_CALLBACK_STATUS_INDICATOR_SET_VALUE: + { +- int nCount = 1; +- if ((pEvent->time - m_nLastButtonReleaseTime) < 250) +- nCount++; +- m_nLastButtonReleaseTime = pEvent->time; +- m_pDocument->pClass->postMouseEvent(m_pDocument, LOK_MOUSEEVENT_MOUSEBUTTONUP, pixelToTwip(pEvent->x, m_fZoom), pixelToTwip(pEvent->y, m_fZoom), nCount); +- break; + } ++ break; ++ case LOK_CALLBACK_STATUS_INDICATOR_FINISH: ++ { ++ } ++ break; + default: ++ g_assert(false); + break; + } +- return FALSE; ++ delete pCallback; ++ ++ return G_SOURCE_REMOVE; + } + +-void LOKDocView_Impl::getDragPoint(GdkRectangle* pHandle, GdkEventButton* pEvent, GdkPoint* pPoint) ++static void ++globalCallbackWorker(int nType, const char* pPayload, void* pData) + { +- GdkPoint aCursor, aHandle; ++ LOKDocView* pDocView = LOK_DOC_VIEW (pData); + +- // Center of the cursor rectangle: we know that it's above the handle. +- aCursor.x = pHandle->x + pHandle->width / 2; +- aCursor.y = pHandle->y - pHandle->height / 2; +- // Center of the handle rectangle. +- aHandle.x = pHandle->x + pHandle->width / 2; +- aHandle.y = pHandle->y + pHandle->height / 2; +- // Our target is the original cursor position + the dragged offset. +- pPoint->x = aCursor.x + (pEvent->x - aHandle.x); +- pPoint->y = aCursor.y + (pEvent->y - aHandle.y); ++ CallbackData* pCallback = new CallbackData(nType, pPayload ? pPayload : "(nil)", pDocView); ++ g_info("LOKDocView_Impl::globalCallbackWorkerImpl: %s, '%s'", callbackTypeToString(nType), pPayload); ++ gdk_threads_add_idle(globalCallback, pCallback); + } + +-gboolean LOKDocView_Impl::signalMotion(GtkWidget* /*pEventBox*/, GdkEventButton* pEvent, LOKDocView* pDocView) ++static GdkRectangle ++payloadToRectangle (LOKDocView* pDocView, const char* pPayload) + { +- return pDocView->m_pImpl->signalMotionImpl(pEvent); +-} ++ LOKDocViewPrivate* priv = pDocView->priv; ++ GdkRectangle aRet; ++ gchar** ppCoordinates = g_strsplit(pPayload, ", ", 4); ++ gchar** ppCoordinate = ppCoordinates; + +-gboolean LOKDocView_Impl::signalMotionImpl(GdkEventButton* pEvent) +-{ +- GdkPoint aPoint; ++ aRet.width = aRet.height = aRet.x = aRet.y = 0; + +- if (m_bInDragMiddleHandle) +- { +- g_info("lcl_signalMotion: dragging the middle handle"); +- LOKDocView_Impl::getDragPoint(&m_aHandleMiddleRect, pEvent, &aPoint); +- m_pDocument->pClass->setTextSelection(m_pDocument, LOK_SETTEXTSELECTION_RESET, pixelToTwip(aPoint.x, m_fZoom), pixelToTwip(aPoint.y, m_fZoom)); +- return FALSE; +- } +- if (m_bInDragStartHandle) +- { +- g_info("lcl_signalMotion: dragging the start handle"); +- LOKDocView_Impl::getDragPoint(&m_aHandleStartRect, pEvent, &aPoint); +- m_pDocument->pClass->setTextSelection(m_pDocument, LOK_SETTEXTSELECTION_START, pixelToTwip(aPoint.x, m_fZoom), pixelToTwip(aPoint.y, m_fZoom)); +- return FALSE; +- } +- if (m_bInDragEndHandle) +- { +- g_info("lcl_signalMotion: dragging the end handle"); +- LOKDocView_Impl::getDragPoint(&m_aHandleEndRect, pEvent, &aPoint); +- m_pDocument->pClass->setTextSelection(m_pDocument, LOK_SETTEXTSELECTION_END, pixelToTwip(aPoint.x, m_fZoom), pixelToTwip(aPoint.y, m_fZoom)); +- return FALSE; +- } +- for (int i = 0; i < GRAPHIC_HANDLE_COUNT; ++i) +- { +- if (m_bInDragGraphicHandles[i]) +- { +- g_info("lcl_signalMotion: dragging the graphic handle #%d", i); +- return FALSE; +- } +- } +- if (m_bInDragGraphicSelection) +- { +- g_info("lcl_signalMotion: dragging the graphic selection"); +- return FALSE; +- } ++ if (!*ppCoordinate) ++ return aRet; ++ aRet.x = atoi(*ppCoordinate); ++ if (aRet.x < 0) ++ aRet.x = 0; ++ ++ppCoordinate; ++ if (!*ppCoordinate) ++ return aRet; ++ aRet.y = atoi(*ppCoordinate); ++ if (aRet.y < 0) ++ aRet.y = 0; ++ ++ppCoordinate; ++ if (!*ppCoordinate) ++ return aRet; ++ aRet.width = atoi(*ppCoordinate); ++ if (aRet.x + aRet.width > priv->m_nDocumentWidthTwips) ++ aRet.width = priv->m_nDocumentWidthTwips - aRet.x; ++ ++ppCoordinate; ++ if (!*ppCoordinate) ++ return aRet; ++ aRet.height = atoi(*ppCoordinate); ++ if (aRet.y + aRet.height > priv->m_nDocumentHeightTwips) ++ aRet.height = priv->m_nDocumentHeightTwips - aRet.y; ++ g_strfreev(ppCoordinates); + +- GdkRectangle aMotionInTwipsInTwips; +- aMotionInTwipsInTwips.x = pixelToTwip(pEvent->x, m_fZoom); +- aMotionInTwipsInTwips.y = pixelToTwip(pEvent->y, m_fZoom); +- aMotionInTwipsInTwips.width = 1; +- aMotionInTwipsInTwips.height = 1; +- if (gdk_rectangle_intersect(&aMotionInTwipsInTwips, &m_aGraphicSelection, 0)) +- { +- g_info("lcl_signalMotion: start of drag graphic selection"); +- m_bInDragGraphicSelection = true; +- m_pDocument->pClass->setGraphicSelection(m_pDocument, LOK_SETGRAPHICSELECTION_START, pixelToTwip(pEvent->x, m_fZoom), pixelToTwip(pEvent->y, m_fZoom)); +- return FALSE; +- } ++ return aRet; ++} + +- // Otherwise a mouse move, as on the desktop. +- m_pDocument->pClass->postMouseEvent(m_pDocument, LOK_MOUSEEVENT_MOUSEMOVE, pixelToTwip(pEvent->x, m_fZoom), pixelToTwip(pEvent->y, m_fZoom), 1); ++static const std::vector ++payloadToRectangles(LOKDocView* pDocView, const char* pPayload) ++{ ++ std::vector aRet; + +- return FALSE; ++ gchar** ppRectangles = g_strsplit(pPayload, "; ", 0); ++ for (gchar** ppRectangle = ppRectangles; *ppRectangle; ++ppRectangle) ++ aRet.push_back(payloadToRectangle(pDocView, *ppRectangle)); ++ g_strfreev(ppRectangles); ++ ++ return aRet; + } + +-gboolean LOKDocView_Impl::renderOverlay(GtkWidget* /*widget*/, cairo_t *cr, gpointer userdata) ++ ++static void ++setTilesInvalid (LOKDocView* pDocView, const GdkRectangle& rRectangle) + { +- LOKDocView *pDocView = LOK_DOC_VIEW (userdata); +- return pDocView->m_pImpl->renderOverlayImpl(cr); ++ LOKDocViewPrivate* priv = pDocView->priv; ++ GdkRectangle aRectanglePixels; ++ GdkPoint aStart, aEnd; ++ ++ aRectanglePixels.x = twipToPixel(rRectangle.x, priv->m_fZoom); ++ aRectanglePixels.y = twipToPixel(rRectangle.y, priv->m_fZoom); ++ aRectanglePixels.width = twipToPixel(rRectangle.width, priv->m_fZoom); ++ aRectanglePixels.height = twipToPixel(rRectangle.height, priv->m_fZoom); ++ ++ aStart.x = aRectanglePixels.y / nTileSizePixels; ++ aStart.y = aRectanglePixels.x / nTileSizePixels; ++ aEnd.x = (aRectanglePixels.y + aRectanglePixels.height + nTileSizePixels) / nTileSizePixels; ++ aEnd.y = (aRectanglePixels.x + aRectanglePixels.width + nTileSizePixels) / nTileSizePixels; ++ ++ for (int i = aStart.x; i < aEnd.x; i++) ++ for (int j = aStart.y; j < aEnd.y; j++) ++ priv->m_aTileBuffer.setInvalid(i, j); + } + +-gboolean LOKDocView_Impl::renderOverlayImpl(cairo_t *pCairo) ++static gboolean ++callback (gpointer pData) + { +- if (m_bEdit && m_bCursorVisible && m_bCursorOverlayVisible && !isEmptyRectangle(m_aVisibleCursor)) +- { +- if (m_aVisibleCursor.width < 30) +- // Set a minimal width if it would be 0. +- m_aVisibleCursor.width = 30; ++ CallbackData* pCallback = static_cast(pData); ++ LOKDocView* pDocView = LOK_DOC_VIEW (pCallback->m_pDocView); ++ LOKDocViewPrivate* priv = pDocView->priv; + +- cairo_set_source_rgb(pCairo, 0, 0, 0); +- cairo_rectangle(pCairo, +- twipToPixel(m_aVisibleCursor.x, m_fZoom), +- twipToPixel(m_aVisibleCursor.y, m_fZoom), +- twipToPixel(m_aVisibleCursor.width, m_fZoom), +- twipToPixel(m_aVisibleCursor.height, m_fZoom)); +- cairo_fill(pCairo); +- } +- +- if (m_bEdit && m_bCursorVisible && !isEmptyRectangle(m_aVisibleCursor) && m_aTextSelectionRectangles.empty()) ++ switch (pCallback->m_nType) + { +- // Have a cursor, but no selection: we need the middle handle. +- if (!m_pHandleMiddle) +- m_pHandleMiddle = cairo_image_surface_create_from_png(CURSOR_HANDLE_DIR "handle_middle.png"); +- renderHandle(pCairo, m_aVisibleCursor, m_pHandleMiddle, m_aHandleMiddleRect); +- } +- +- if (!m_aTextSelectionRectangles.empty()) ++ case LOK_CALLBACK_INVALIDATE_TILES: + { +- for (GdkRectangle& rRectangle : m_aTextSelectionRectangles) ++ if (pCallback->m_aPayload != "EMPTY") + { +- // Blue with 75% transparency. +- cairo_set_source_rgba(pCairo, ((double)0x43)/255, ((double)0xac)/255, ((double)0xe8)/255, 0.25); +- cairo_rectangle(pCairo, +- twipToPixel(rRectangle.x, m_fZoom), +- twipToPixel(rRectangle.y, m_fZoom), +- twipToPixel(rRectangle.width, m_fZoom), +- twipToPixel(rRectangle.height, m_fZoom)); +- cairo_fill(pCairo); ++ GdkRectangle aRectangle = payloadToRectangle(pDocView, pCallback->m_aPayload.c_str()); ++ setTilesInvalid(pDocView, aRectangle); + } ++ else ++ priv->m_aTileBuffer.resetAllTiles(); + +- // Handles +- if (!isEmptyRectangle(m_aTextSelectionStart)) +- { +- // Have a start position: we need a start handle. +- if (!m_pHandleStart) +- m_pHandleStart = cairo_image_surface_create_from_png(CURSOR_HANDLE_DIR "handle_start.png"); +- renderHandle(pCairo, m_aTextSelectionStart, m_pHandleStart, m_aHandleStartRect); +- } +- if (!isEmptyRectangle(m_aTextSelectionEnd)) ++ gtk_widget_queue_draw(GTK_WIDGET(pDocView)); ++ } ++ break; ++ case LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR: ++ { ++ priv->m_aVisibleCursor = payloadToRectangle(pDocView, pCallback->m_aPayload.c_str()); ++ priv->m_bCursorOverlayVisible = true; ++ gtk_widget_queue_draw(GTK_WIDGET(pDocView)); ++ } ++ break; ++ case LOK_CALLBACK_TEXT_SELECTION: ++ { ++ priv->m_aTextSelectionRectangles = payloadToRectangles(pDocView, pCallback->m_aPayload.c_str()); ++ // In case the selection is empty, then we get no LOK_CALLBACK_TEXT_SELECTION_START/END events. ++ if (priv->m_aTextSelectionRectangles.empty()) + { +- // Have a start position: we need an end handle. +- if (!m_pHandleEnd) +- m_pHandleEnd = cairo_image_surface_create_from_png(CURSOR_HANDLE_DIR "handle_end.png"); +- renderHandle(pCairo, m_aTextSelectionEnd, m_pHandleEnd, m_aHandleEndRect); ++ memset(&priv->m_aTextSelectionStart, 0, sizeof(priv->m_aTextSelectionStart)); ++ memset(&priv->m_aHandleStartRect, 0, sizeof(priv->m_aHandleStartRect)); ++ memset(&priv->m_aTextSelectionEnd, 0, sizeof(priv->m_aTextSelectionEnd)); ++ memset(&priv->m_aHandleEndRect, 0, sizeof(priv->m_aHandleEndRect)); + } ++ else ++ memset(&priv->m_aHandleMiddleRect, 0, sizeof(priv->m_aHandleMiddleRect)); + } +- +- if (!isEmptyRectangle(m_aGraphicSelection)) ++ break; ++ case LOK_CALLBACK_TEXT_SELECTION_START: + { +- if (!m_pGraphicHandle) +- m_pGraphicHandle = cairo_image_surface_create_from_png(CURSOR_HANDLE_DIR "handle_graphic.png"); +- renderGraphicHandle(pCairo, m_aGraphicSelection, m_pGraphicHandle); ++ priv->m_aTextSelectionStart = payloadToRectangle(pDocView, pCallback->m_aPayload.c_str()); + } ++ break; ++ case LOK_CALLBACK_TEXT_SELECTION_END: ++ { ++ priv->m_aTextSelectionEnd = payloadToRectangle(pDocView, pCallback->m_aPayload.c_str()); ++ } ++ break; ++ case LOK_CALLBACK_CURSOR_VISIBLE: ++ { ++ priv->m_bCursorVisible = pCallback->m_aPayload == "true"; ++ } ++ break; ++ case LOK_CALLBACK_GRAPHIC_SELECTION: ++ { ++ if (pCallback->m_aPayload != "EMPTY") ++ priv->m_aGraphicSelection = payloadToRectangle(pDocView, pCallback->m_aPayload.c_str()); ++ else ++ memset(&priv->m_aGraphicSelection, 0, sizeof(priv->m_aGraphicSelection)); ++ gtk_widget_queue_draw(GTK_WIDGET(pDocView)); ++ } ++ break; ++ case LOK_CALLBACK_HYPERLINK_CLICKED: ++ { ++ GError* pError = NULL; ++ gtk_show_uri(NULL, pCallback->m_aPayload.c_str(), GDK_CURRENT_TIME, &pError); ++ } ++ break; ++ case LOK_CALLBACK_STATE_CHANGED: ++ { ++ commandChanged(pDocView, pCallback->m_aPayload); ++ } ++ break; ++ case LOK_CALLBACK_SEARCH_NOT_FOUND: ++ { ++ searchNotFound(pDocView, pCallback->m_aPayload); ++ } ++ break; ++ case LOK_CALLBACK_DOCUMENT_SIZE_CHANGED: ++ { ++ g_info ("%d %d", priv->m_nDocumentWidthTwips, priv->m_nDocumentHeightTwips); ++ g_info ("startin"); ++ payloadToSize(pCallback->m_aPayload.c_str(), priv->m_nDocumentWidthTwips, priv->m_nDocumentHeightTwips); ++ g_info ("%d %d", priv->m_nDocumentWidthTwips, priv->m_nDocumentHeightTwips); ++ gtk_widget_set_size_request(GTK_WIDGET(pDocView), ++ twipToPixel(priv->m_nDocumentWidthTwips, priv->m_fZoom), ++ twipToPixel(priv->m_nDocumentHeightTwips, priv->m_fZoom)); ++ } ++ break; ++ case LOK_CALLBACK_SET_PART: ++ { ++ setPart(pDocView, pCallback->m_aPayload); ++ } ++ break; ++ default: ++ g_assert(false); ++ break; ++ } ++ delete pCallback; + +- return FALSE; +-} +- +-bool LOKDocView_Impl::isEmptyRectangle(const GdkRectangle& rRectangle) +-{ +- return rRectangle.x == 0 && rRectangle.y == 0 && rRectangle.width == 0 && rRectangle.height == 0; ++ return G_SOURCE_REMOVE; + } + +-void LOKDocView_Impl::setTilesInvalid(const GdkRectangle& rRectangle) ++static void ++callbackWorker (int nType, const char* pPayload, void* pData) + { +- GdkRectangle aRectanglePixels; +- GdkPoint aStart, aEnd; +- +- aRectanglePixels.x = twipToPixel(rRectangle.x, m_fZoom); +- aRectanglePixels.y = twipToPixel(rRectangle.y, m_fZoom); +- aRectanglePixels.width = twipToPixel(rRectangle.width, m_fZoom); +- aRectanglePixels.height = twipToPixel(rRectangle.height, m_fZoom); +- +- aStart.x = aRectanglePixels.y / nTileSizePixels; +- aStart.y = aRectanglePixels.x / nTileSizePixels; +- aEnd.x = (aRectanglePixels.y + aRectanglePixels.height + nTileSizePixels) / nTileSizePixels; +- aEnd.y = (aRectanglePixels.x + aRectanglePixels.width + nTileSizePixels) / nTileSizePixels; ++ LOKDocView* pDocView = LOK_DOC_VIEW (pData); + +- for (int i = aStart.x; i < aEnd.x; i++) +- for (int j = aStart.y; j < aEnd.y; j++) +- m_aTileBuffer.setInvalid(i, j); ++ CallbackData* pCallback = new CallbackData(nType, pPayload ? pPayload : "(nil)", pDocView); ++ g_info("lok_doc_view_callbackWorker: %s, '%s'", callbackTypeToString(nType), pPayload); ++ gdk_threads_add_idle(callback, pCallback); + } + +-void LOKDocView_Impl::renderHandle(cairo_t* pCairo, const GdkRectangle& rCursor, cairo_surface_t* pHandle, GdkRectangle& rRectangle) ++static void ++renderHandle(LOKDocView* pDocView, ++ cairo_t* pCairo, ++ const GdkRectangle& rCursor, ++ cairo_surface_t* pHandle, ++ GdkRectangle& rRectangle) + { ++ LOKDocViewPrivate* priv = pDocView->priv; + GdkPoint aCursorBottom; + int nHandleWidth, nHandleHeight; + double fHandleScale; +@@ -749,16 +567,17 @@ void LOKDocView_Impl::renderHandle(cairo_t* pCairo, const GdkRectangle& rCursor, + nHandleWidth = cairo_image_surface_get_width(pHandle); + nHandleHeight = cairo_image_surface_get_height(pHandle); + // We want to scale down the handle, so that its height is the same as the cursor caret. +- fHandleScale = twipToPixel(rCursor.height, m_fZoom) / nHandleHeight; ++ fHandleScale = twipToPixel(rCursor.height, priv->m_fZoom) / nHandleHeight; + // We want the top center of the handle bitmap to be at the bottom center of the cursor rectangle. +- aCursorBottom.x = twipToPixel(rCursor.x, m_fZoom) + twipToPixel(rCursor.width, m_fZoom) / 2 - (nHandleWidth * fHandleScale) / 2; +- aCursorBottom.y = twipToPixel(rCursor.y, m_fZoom) + twipToPixel(rCursor.height, m_fZoom); +- cairo_save(pCairo); ++ aCursorBottom.x = twipToPixel(rCursor.x, priv->m_fZoom) + twipToPixel(rCursor.width, priv->m_fZoom) / 2 - (nHandleWidth * fHandleScale) / 2; ++ aCursorBottom.y = twipToPixel(rCursor.y, priv->m_fZoom) + twipToPixel(rCursor.height, priv->m_fZoom); ++ ++ cairo_save (pCairo); + cairo_translate(pCairo, aCursorBottom.x, aCursorBottom.y); + cairo_scale(pCairo, fHandleScale, fHandleScale); + cairo_set_source_surface(pCairo, pHandle, 0, 0); + cairo_paint(pCairo); +- cairo_restore(pCairo); ++ cairo_restore (pCairo); + + rRectangle.x = aCursorBottom.x; + rRectangle.y = aCursorBottom.y; +@@ -767,23 +586,27 @@ void LOKDocView_Impl::renderHandle(cairo_t* pCairo, const GdkRectangle& rCursor, + } + + /// Renders pHandle around an rSelection rectangle on pCairo. +-void LOKDocView_Impl::renderGraphicHandle(cairo_t* pCairo, const GdkRectangle& rSelection, cairo_surface_t* pHandle) ++static void ++renderGraphicHandle(LOKDocView* pDocView, ++ cairo_t* pCairo, ++ const GdkRectangle& rSelection, ++ cairo_surface_t* pHandle) + { ++ LOKDocViewPrivate* priv = pDocView->priv; + int nHandleWidth, nHandleHeight; + GdkRectangle aSelection; + + nHandleWidth = cairo_image_surface_get_width(pHandle); + nHandleHeight = cairo_image_surface_get_height(pHandle); + +- aSelection.x = twipToPixel(rSelection.x, m_fZoom); +- aSelection.y = twipToPixel(rSelection.y, m_fZoom); +- aSelection.width = twipToPixel(rSelection.width, m_fZoom); +- aSelection.height = twipToPixel(rSelection.height, m_fZoom); ++ aSelection.x = twipToPixel(rSelection.x, priv->m_fZoom); ++ aSelection.y = twipToPixel(rSelection.y, priv->m_fZoom); ++ aSelection.width = twipToPixel(rSelection.width, priv->m_fZoom); ++ aSelection.height = twipToPixel(rSelection.height, priv->m_fZoom); + + for (int i = 0; i < GRAPHIC_HANDLE_COUNT; ++i) + { + int x = aSelection.x, y = aSelection.y; +- cairo_save(pCairo); + + switch (i) + { +@@ -819,364 +642,722 @@ void LOKDocView_Impl::renderGraphicHandle(cairo_t* pCairo, const GdkRectangle& r + x -= nHandleWidth / 2; + y -= nHandleHeight / 2; + +- m_aGraphicHandleRects[i].x = x; +- m_aGraphicHandleRects[i].y = y; +- m_aGraphicHandleRects[i].width = nHandleWidth; +- m_aGraphicHandleRects[i].height = nHandleHeight; ++ priv->m_aGraphicHandleRects[i].x = x; ++ priv->m_aGraphicHandleRects[i].y = y; ++ priv->m_aGraphicHandleRects[i].width = nHandleWidth; ++ priv->m_aGraphicHandleRects[i].height = nHandleHeight; + ++ cairo_save (pCairo); + cairo_translate(pCairo, x, y); + cairo_set_source_surface(pCairo, pHandle, 0, 0); + cairo_paint(pCairo); +- cairo_restore(pCairo); ++ cairo_restore (pCairo); + } + } + +-gboolean LOKDocView_Impl::handleTimeout(gpointer pData) +-{ +- LOKDocView* pDocView = static_cast(pData); +- return pDocView->m_pImpl->handleTimeoutImpl(); +-} + +-gboolean LOKDocView_Impl::handleTimeoutImpl() ++static gboolean ++renderDocument(LOKDocView* pDocView, cairo_t* pCairo) + { +- if (m_bEdit) ++ LOKDocViewPrivate *priv = pDocView->priv; ++ GdkRectangle aVisibleArea; ++ long nDocumentWidthPixels = twipToPixel(priv->m_nDocumentWidthTwips, priv->m_fZoom); ++ long nDocumentHeightPixels = twipToPixel(priv->m_nDocumentHeightTwips, priv->m_fZoom); ++ // Total number of rows / columns in this document. ++ guint nRows = ceil((double)nDocumentHeightPixels / nTileSizePixels); ++ guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); ++ ++ gdk_cairo_get_clip_rectangle (pCairo, &aVisibleArea); ++ aVisibleArea.x = pixelToTwip (aVisibleArea.x, priv->m_fZoom); ++ aVisibleArea.y = pixelToTwip (aVisibleArea.y, priv->m_fZoom); ++ aVisibleArea.width = pixelToTwip (aVisibleArea.width, priv->m_fZoom); ++ aVisibleArea.height = pixelToTwip (aVisibleArea.height, priv->m_fZoom); ++ ++ // Render the tiles. ++ for (guint nRow = 0; nRow < nRows; ++nRow) + { +- if (m_bCursorOverlayVisible) +- m_bCursorOverlayVisible = false; +- else +- m_bCursorOverlayVisible = true; +- gtk_widget_queue_draw(GTK_WIDGET(m_pDocView)); +- } ++ for (guint nColumn = 0; nColumn < nColumns; ++nColumn) ++ { ++ GdkRectangle aTileRectangleTwips, aTileRectanglePixels; ++ bool bPaint = true; + +- return G_SOURCE_CONTINUE; +-} ++ // Determine size of the tile: the rightmost/bottommost tiles may ++ // be smaller, and we need the size to decide if we need to repaint. ++ if (nColumn == nColumns - 1) ++ aTileRectanglePixels.width = nDocumentWidthPixels - nColumn * nTileSizePixels; ++ else ++ aTileRectanglePixels.width = nTileSizePixels; ++ if (nRow == nRows - 1) ++ aTileRectanglePixels.height = nDocumentHeightPixels - nRow * nTileSizePixels; ++ else ++ aTileRectanglePixels.height = nTileSizePixels; + +-GdkRectangle LOKDocView_Impl::payloadToRectangle(const char* pPayload) +-{ +- GdkRectangle aRet; ++ // Determine size and position of the tile in document coordinates, ++ // so we can decide if we can skip painting for partial rendering. ++ aTileRectangleTwips.x = pixelToTwip(nTileSizePixels, priv->m_fZoom) * nColumn; ++ aTileRectangleTwips.y = pixelToTwip(nTileSizePixels, priv->m_fZoom) * nRow; ++ aTileRectangleTwips.width = pixelToTwip(aTileRectanglePixels.width, priv->m_fZoom); ++ aTileRectangleTwips.height = pixelToTwip(aTileRectanglePixels.height, priv->m_fZoom); + +- aRet.width = aRet.height = aRet.x = aRet.y = 0; +- gchar** ppCoordinates = g_strsplit(pPayload, ", ", 4); +- gchar** ppCoordinate = ppCoordinates; +- if (!*ppCoordinate) +- return aRet; +- aRet.x = atoi(*ppCoordinate); +- if (aRet.x < 0) +- aRet.x = 0; +- ++ppCoordinate; +- if (!*ppCoordinate) +- return aRet; +- aRet.y = atoi(*ppCoordinate); +- if (aRet.y < 0) +- aRet.y = 0; +- ++ppCoordinate; +- if (!*ppCoordinate) +- return aRet; +- aRet.width = atoi(*ppCoordinate); +- if (aRet.x + aRet.width > m_nDocumentWidthTwips) +- aRet.width = m_nDocumentWidthTwips - aRet.x; +- ++ppCoordinate; +- if (!*ppCoordinate) +- return aRet; +- aRet.height = atoi(*ppCoordinate); +- if (aRet.y + aRet.height > m_nDocumentHeightTwips) +- aRet.height = m_nDocumentHeightTwips - aRet.y; +- g_strfreev(ppCoordinates); +- return aRet; ++ if (!gdk_rectangle_intersect(&aVisibleArea, &aTileRectangleTwips, 0)) ++ bPaint = false; ++ ++ if (bPaint) ++ { ++ Tile& currentTile = priv->m_aTileBuffer.getTile(nRow, nColumn, priv->m_fZoom); ++ GdkPixbuf* pPixBuf = currentTile.getBuffer(); ++ gdk_cairo_set_source_pixbuf (pCairo, pPixBuf, ++ twipToPixel(aTileRectangleTwips.x, priv->m_fZoom), ++ twipToPixel(aTileRectangleTwips.y, priv->m_fZoom)); ++ cairo_paint(pCairo); ++ } ++ } ++ } ++ ++ return FALSE; + } + +-std::vector LOKDocView_Impl::payloadToRectangles(const char* pPayload) ++static gboolean ++renderOverlay(LOKDocView* pDocView, cairo_t* pCairo) + { +- std::vector aRet; ++ LOKDocViewPrivate *priv = pDocView->priv; + +- gchar** ppRectangles = g_strsplit(pPayload, "; ", 0); +- for (gchar** ppRectangle = ppRectangles; *ppRectangle; ++ppRectangle) +- aRet.push_back(payloadToRectangle(*ppRectangle)); +- g_strfreev(ppRectangles); ++ if (priv->m_bEdit && priv->m_bCursorVisible && priv->m_bCursorOverlayVisible && !isEmptyRectangle(priv->m_aVisibleCursor)) ++ { ++ if (priv->m_aVisibleCursor.width < 30) ++ // Set a minimal width if it would be 0. ++ priv->m_aVisibleCursor.width = 30; + +- return aRet; +-} ++ cairo_set_source_rgb(pCairo, 0, 0, 0); ++ cairo_rectangle(pCairo, ++ twipToPixel(priv->m_aVisibleCursor.x, priv->m_fZoom), ++ twipToPixel(priv->m_aVisibleCursor.y, priv->m_fZoom), ++ twipToPixel(priv->m_aVisibleCursor.width, priv->m_fZoom), ++ twipToPixel(priv->m_aVisibleCursor.height, priv->m_fZoom)); ++ cairo_fill(pCairo); ++ } + +-/// Returns the string representation of a LibreOfficeKitCallbackType enumeration element. +-const char* LOKDocView_Impl::callbackTypeToString(int nType) +-{ +- switch (nType) ++ if (priv->m_bEdit && priv->m_bCursorVisible && !isEmptyRectangle(priv->m_aVisibleCursor) && priv->m_aTextSelectionRectangles.empty()) + { +- case LOK_CALLBACK_INVALIDATE_TILES: +- return "LOK_CALLBACK_INVALIDATE_TILES"; +- case LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR: +- return "LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR"; +- case LOK_CALLBACK_TEXT_SELECTION: +- return "LOK_CALLBACK_TEXT_SELECTION"; +- case LOK_CALLBACK_TEXT_SELECTION_START: +- return "LOK_CALLBACK_TEXT_SELECTION_START"; +- case LOK_CALLBACK_TEXT_SELECTION_END: +- return "LOK_CALLBACK_TEXT_SELECTION_END"; +- case LOK_CALLBACK_CURSOR_VISIBLE: +- return "LOK_CALLBACK_CURSOR_VISIBLE"; +- case LOK_CALLBACK_GRAPHIC_SELECTION: +- return "LOK_CALLBACK_GRAPHIC_SELECTION"; +- case LOK_CALLBACK_HYPERLINK_CLICKED: +- return "LOK_CALLBACK_HYPERLINK_CLICKED"; +- case LOK_CALLBACK_STATE_CHANGED: +- return "LOK_CALLBACK_STATE_CHANGED"; +- case LOK_CALLBACK_STATUS_INDICATOR_START: +- return "LOK_CALLBACK_STATUS_INDICATOR_START"; +- case LOK_CALLBACK_STATUS_INDICATOR_SET_VALUE: +- return "LOK_CALLBACK_STATUS_INDICATOR_SET_VALUE"; +- case LOK_CALLBACK_STATUS_INDICATOR_FINISH: +- return "LOK_CALLBACK_STATUS_INDICATOR_FINISH"; +- case LOK_CALLBACK_SEARCH_NOT_FOUND: +- return "LOK_CALLBACK_SEARCH_NOT_FOUND"; +- case LOK_CALLBACK_DOCUMENT_SIZE_CHANGED: +- return "LOK_CALLBACK_DOCUMENT_SIZE_CHANGED"; +- case LOK_CALLBACK_SET_PART: +- return "LOK_CALLBACK_SET_PART"; ++ // Have a cursor, but no selection: we need the middle handle. ++ gchar* handleMiddlePath = g_strconcat (priv->m_aLOPath, "/../..", CURSOR_HANDLE_DIR, "handle_middle.png", NULL); ++ if (!priv->m_pHandleMiddle) ++ priv->m_pHandleMiddle = cairo_image_surface_create_from_png(handleMiddlePath); ++ g_free (handleMiddlePath); ++ renderHandle(pDocView, pCairo, priv->m_aVisibleCursor, priv->m_pHandleMiddle, priv->m_aHandleMiddleRect); ++ } ++ ++ if (!priv->m_aTextSelectionRectangles.empty()) ++ { ++ for (GdkRectangle& rRectangle : priv->m_aTextSelectionRectangles) ++ { ++ // Blue with 75% transparency. ++ cairo_set_source_rgba(pCairo, ((double)0x43)/255, ((double)0xac)/255, ((double)0xe8)/255, 0.25); ++ cairo_rectangle(pCairo, ++ twipToPixel(rRectangle.x, priv->m_fZoom), ++ twipToPixel(rRectangle.y, priv->m_fZoom), ++ twipToPixel(rRectangle.width, priv->m_fZoom), ++ twipToPixel(rRectangle.height, priv->m_fZoom)); ++ cairo_fill(pCairo); ++ } ++ ++ // Handles ++ if (!isEmptyRectangle(priv->m_aTextSelectionStart)) ++ { ++ // Have a start position: we need a start handle. ++ gchar* handleStartPath = g_strconcat (priv->m_aLOPath, "/../..", CURSOR_HANDLE_DIR, "handle_start.png", NULL); ++ if (!priv->m_pHandleStart) ++ priv->m_pHandleStart = cairo_image_surface_create_from_png(handleStartPath); ++ renderHandle(pDocView, pCairo, priv->m_aTextSelectionStart, priv->m_pHandleStart, priv->m_aHandleStartRect); ++ g_free (handleStartPath); ++ } ++ if (!isEmptyRectangle(priv->m_aTextSelectionEnd)) ++ { ++ // Have a start position: we need an end handle. ++ gchar* handleEndPath = g_strconcat (priv->m_aLOPath, "/../..", CURSOR_HANDLE_DIR, "handle_end.png", NULL); ++ if (!priv->m_pHandleEnd) ++ priv->m_pHandleEnd = cairo_image_surface_create_from_png(handleEndPath); ++ renderHandle(pDocView, pCairo, priv->m_aTextSelectionEnd, priv->m_pHandleEnd, priv->m_aHandleEndRect); ++ g_free (handleEndPath); ++ } + } +- return 0; +-} + +-gboolean LOKDocView_Impl::callback(gpointer pData) +-{ +- LOKDocView_Impl::CallbackData* pCallback = static_cast(pData); +- return pCallback->m_pDocView->m_pImpl->callbackImpl(pCallback); +-} ++ if (!isEmptyRectangle(priv->m_aGraphicSelection)) ++ { ++ gchar* handleGraphicPath = g_strconcat (priv->m_aLOPath, "/../..", CURSOR_HANDLE_DIR, "handle_graphic.png", NULL); ++ if (!priv->m_pGraphicHandle) ++ priv->m_pGraphicHandle = cairo_image_surface_create_from_png(handleGraphicPath); ++ renderGraphicHandle(pDocView, pCairo, priv->m_aGraphicSelection, priv->m_pGraphicHandle); ++ g_free (handleGraphicPath); ++ } + +-gboolean LOKDocView_Impl::globalCallback(gpointer pData) +-{ +- LOKDocView_Impl::CallbackData* pCallback = static_cast(pData); +- return globalCallbackImpl(pCallback); ++ return FALSE; + } + +-gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback) ++static gboolean ++lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + { +- switch (pCallback->m_nType) +- { +- case LOK_CALLBACK_INVALIDATE_TILES: ++ LOKDocView* pDocView = LOK_DOC_VIEW (pWidget); ++ LOKDocViewPrivate *priv = pDocView->priv; ++ ++ g_info("LOKDocView_Impl::signalButton: %d, %d (in twips: %d, %d)", ++ (int)pEvent->x, (int)pEvent->y, ++ (int)pixelToTwip(pEvent->x, priv->m_fZoom), ++ (int)pixelToTwip(pEvent->y, priv->m_fZoom)); ++ ++ if (pEvent->type == GDK_BUTTON_RELEASE) + { +- if (pCallback->m_aPayload != "EMPTY") ++ if (priv->m_bInDragStartHandle) + { +- GdkRectangle aRectangle = LOKDocView_Impl::payloadToRectangle(pCallback->m_aPayload.c_str()); +- setTilesInvalid(aRectangle); ++ g_info("LOKDocView_Impl::signalButton: end of drag start handle"); ++ priv->m_bInDragStartHandle = false; ++ return FALSE; ++ } ++ else if (priv->m_bInDragMiddleHandle) ++ { ++ g_info("LOKDocView_Impl::signalButton: end of drag middle handle"); ++ priv->m_bInDragMiddleHandle = false; ++ return FALSE; ++ } ++ else if (priv->m_bInDragEndHandle) ++ { ++ g_info("LOKDocView_Impl::signalButton: end of drag end handle"); ++ priv->m_bInDragEndHandle = false; ++ return FALSE; + } +- else +- m_aTileBuffer.resetAllTiles(); + +- gtk_widget_queue_draw(GTK_WIDGET(m_pDocView)); +- } +- break; +- case LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR: +- { +- m_aVisibleCursor = LOKDocView_Impl::payloadToRectangle(pCallback->m_aPayload.c_str()); +- m_bCursorOverlayVisible = true; +- gtk_widget_queue_draw(GTK_WIDGET(m_pDocView)); +- } +- break; +- case LOK_CALLBACK_TEXT_SELECTION: +- { +- m_aTextSelectionRectangles = LOKDocView_Impl::payloadToRectangles(pCallback->m_aPayload.c_str()); ++ for (int i = 0; i < GRAPHIC_HANDLE_COUNT; ++i) ++ { ++ if (priv->m_bInDragGraphicHandles[i]) ++ { ++ g_info("LOKDocView_Impl::signalButton: end of drag graphic handle #%d", i); ++ priv->m_bInDragGraphicHandles[i] = false; ++ priv->m_pDocument->pClass->setGraphicSelection(priv->m_pDocument, LOK_SETGRAPHICSELECTION_END, pixelToTwip(pEvent->x, priv->m_fZoom), pixelToTwip(pEvent->y, priv->m_fZoom)); ++ return FALSE; ++ } ++ } + +- // In case the selection is empty, then we get no LOK_CALLBACK_TEXT_SELECTION_START/END events. +- if (m_aTextSelectionRectangles.empty()) ++ if (priv->m_bInDragGraphicSelection) + { +- memset(&m_aTextSelectionStart, 0, sizeof(m_aTextSelectionStart)); +- memset(&m_aHandleStartRect, 0, sizeof(m_aHandleStartRect)); +- memset(&m_aTextSelectionEnd, 0, sizeof(m_aTextSelectionEnd)); +- memset(&m_aHandleEndRect, 0, sizeof(m_aHandleEndRect)); ++ g_info("LOKDocView_Impl::signalButton: end of drag graphic selection"); ++ priv->m_bInDragGraphicSelection = false; ++ priv->m_pDocument->pClass->setGraphicSelection(priv->m_pDocument, LOK_SETGRAPHICSELECTION_END, pixelToTwip(pEvent->x, priv->m_fZoom), pixelToTwip(pEvent->y, priv->m_fZoom)); ++ return FALSE; + } +- else +- memset(&m_aHandleMiddleRect, 0, sizeof(m_aHandleMiddleRect)); + } +- break; +- case LOK_CALLBACK_TEXT_SELECTION_START: ++ ++ if (priv->m_bEdit) + { +- m_aTextSelectionStart = LOKDocView_Impl::payloadToRectangle(pCallback->m_aPayload.c_str()); ++ GdkRectangle aClick; ++ aClick.x = pEvent->x; ++ aClick.y = pEvent->y; ++ aClick.width = 1; ++ aClick.height = 1; ++ if (pEvent->type == GDK_BUTTON_PRESS) ++ { ++ if (gdk_rectangle_intersect(&aClick, &priv->m_aHandleStartRect, NULL)) ++ { ++ g_info("LOKDocView_Impl::signalButton: start of drag start handle"); ++ priv->m_bInDragStartHandle = true; ++ return FALSE; ++ } ++ else if (gdk_rectangle_intersect(&aClick, &priv->m_aHandleMiddleRect, NULL)) ++ { ++ g_info("LOKDocView_Impl::signalButton: start of drag middle handle"); ++ priv->m_bInDragMiddleHandle = true; ++ return FALSE; ++ } ++ else if (gdk_rectangle_intersect(&aClick, &priv->m_aHandleEndRect, NULL)) ++ { ++ g_info("LOKDocView_Impl::signalButton: start of drag end handle"); ++ priv->m_bInDragEndHandle = true; ++ return FALSE; ++ } ++ ++ for (int i = 0; i < GRAPHIC_HANDLE_COUNT; ++i) ++ { ++ if (gdk_rectangle_intersect(&aClick, &priv->m_aGraphicHandleRects[i], NULL)) ++ { ++ g_info("LOKDocView_Impl::signalButton: start of drag graphic handle #%d", i); ++ priv->m_bInDragGraphicHandles[i] = true; ++ priv->m_pDocument->pClass->setGraphicSelection(priv->m_pDocument, ++ LOK_SETGRAPHICSELECTION_START, ++ pixelToTwip(priv->m_aGraphicHandleRects[i].x + priv->m_aGraphicHandleRects[i].width / 2, priv->m_fZoom), ++ pixelToTwip(priv->m_aGraphicHandleRects[i].y + priv->m_aGraphicHandleRects[i].height / 2, priv->m_fZoom)); ++ return FALSE; ++ } ++ } ++ } + } +- break; +- case LOK_CALLBACK_TEXT_SELECTION_END: ++ ++ if (!priv->m_bEdit) ++ lok_doc_view_set_edit(pDocView, TRUE); ++ ++ switch (pEvent->type) + { +- m_aTextSelectionEnd = LOKDocView_Impl::payloadToRectangle(pCallback->m_aPayload.c_str()); +- } +- break; +- case LOK_CALLBACK_CURSOR_VISIBLE: ++ case GDK_BUTTON_PRESS: + { +- m_bCursorVisible = pCallback->m_aPayload == "true"; ++ int nCount = 1; ++ if ((pEvent->time - priv->m_nLastButtonPressTime) < 250) ++ nCount++; ++ priv->m_nLastButtonPressTime = pEvent->time; ++ priv->m_pDocument->pClass->postMouseEvent(priv->m_pDocument, LOK_MOUSEEVENT_MOUSEBUTTONDOWN, pixelToTwip(pEvent->x, priv->m_fZoom), pixelToTwip(pEvent->y, priv->m_fZoom), nCount); ++ break; + } +- break; +- case LOK_CALLBACK_GRAPHIC_SELECTION: ++ case GDK_BUTTON_RELEASE: + { +- if (pCallback->m_aPayload != "EMPTY") +- m_aGraphicSelection = LOKDocView_Impl::payloadToRectangle(pCallback->m_aPayload.c_str()); +- else +- memset(&m_aGraphicSelection, 0, sizeof(m_aGraphicSelection)); +- gtk_widget_queue_draw(GTK_WIDGET(m_pDocView)); ++ int nCount = 1; ++ if ((pEvent->time - priv->m_nLastButtonReleaseTime) < 250) ++ nCount++; ++ priv->m_nLastButtonReleaseTime = pEvent->time; ++ priv->m_pDocument->pClass->postMouseEvent(priv->m_pDocument, LOK_MOUSEEVENT_MOUSEBUTTONUP, pixelToTwip(pEvent->x, priv->m_fZoom), pixelToTwip(pEvent->y, priv->m_fZoom), nCount); ++ break; + } +- break; +- case LOK_CALLBACK_HYPERLINK_CLICKED: ++ default: ++ break; ++ } ++ return FALSE; ++} ++ ++static void ++getDragPoint(GdkRectangle* pHandle, ++ GdkEventMotion* pEvent, ++ GdkPoint* pPoint) ++{ ++ GdkPoint aCursor, aHandle; ++ ++ // Center of the cursor rectangle: we know that it's above the handle. ++ aCursor.x = pHandle->x + pHandle->width / 2; ++ aCursor.y = pHandle->y - pHandle->height / 2; ++ // Center of the handle rectangle. ++ aHandle.x = pHandle->x + pHandle->width / 2; ++ aHandle.y = pHandle->y + pHandle->height / 2; ++ // Our target is the original cursor position + the dragged offset. ++ pPoint->x = aCursor.x + (pEvent->x - aHandle.x); ++ pPoint->y = aCursor.y + (pEvent->y - aHandle.y); ++} ++ ++static gboolean ++lok_doc_view_signal_motion (GtkWidget* pWidget, GdkEventMotion* pEvent) ++{ ++ LOKDocView* pDocView = LOK_DOC_VIEW (pWidget); ++ LOKDocViewPrivate *priv = pDocView->priv; ++ GdkPoint aPoint; ++ ++ if (priv->m_bInDragMiddleHandle) + { +- GError* pError = NULL; +- gtk_show_uri(NULL, pCallback->m_aPayload.c_str(), GDK_CURRENT_TIME, &pError); ++ g_info("lcl_signalMotion: dragging the middle handle"); ++ getDragPoint(&priv->m_aHandleMiddleRect, pEvent, &aPoint); ++ priv->m_pDocument->pClass->setTextSelection(priv->m_pDocument, LOK_SETTEXTSELECTION_RESET, pixelToTwip(aPoint.x, priv->m_fZoom), pixelToTwip(aPoint.y, priv->m_fZoom)); ++ return FALSE; + } +- break; +- case LOK_CALLBACK_STATE_CHANGED: ++ if (priv->m_bInDragStartHandle) + { +- commandChanged(pCallback->m_aPayload); ++ g_info("lcl_signalMotion: dragging the start handle"); ++ getDragPoint(&priv->m_aHandleStartRect, pEvent, &aPoint); ++ priv->m_pDocument->pClass->setTextSelection(priv->m_pDocument, LOK_SETTEXTSELECTION_START, pixelToTwip(aPoint.x, priv->m_fZoom), pixelToTwip(aPoint.y, priv->m_fZoom)); ++ return FALSE; + } +- break; +- case LOK_CALLBACK_SEARCH_NOT_FOUND: ++ if (priv->m_bInDragEndHandle) + { +- searchNotFound(pCallback->m_aPayload); ++ g_info("lcl_signalMotion: dragging the end handle"); ++ getDragPoint(&priv->m_aHandleEndRect, pEvent, &aPoint); ++ priv->m_pDocument->pClass->setTextSelection(priv->m_pDocument, LOK_SETTEXTSELECTION_END, pixelToTwip(aPoint.x, priv->m_fZoom), pixelToTwip(aPoint.y, priv->m_fZoom)); ++ return FALSE; + } +- break; +- case LOK_CALLBACK_DOCUMENT_SIZE_CHANGED: ++ for (int i = 0; i < GRAPHIC_HANDLE_COUNT; ++i) + { +- payloadToSize(pCallback->m_aPayload.c_str(), m_nDocumentWidthTwips, m_nDocumentHeightTwips); +- gtk_widget_set_size_request(GTK_WIDGET(m_pDocView), +- twipToPixel(m_nDocumentWidthTwips, m_fZoom), +- twipToPixel(m_nDocumentHeightTwips, m_fZoom)); ++ if (priv->m_bInDragGraphicHandles[i]) ++ { ++ g_info("lcl_signalMotion: dragging the graphic handle #%d", i); ++ return FALSE; ++ } + } +- break; +- case LOK_CALLBACK_SET_PART: ++ if (priv->m_bInDragGraphicSelection) + { +- setPart(pCallback->m_aPayload); ++ g_info("lcl_signalMotion: dragging the graphic selection"); ++ return FALSE; + } +- break; +- default: +- g_assert(false); +- break; ++ ++ GdkRectangle aMotionInTwipsInTwips; ++ aMotionInTwipsInTwips.x = pixelToTwip(pEvent->x, priv->m_fZoom); ++ aMotionInTwipsInTwips.y = pixelToTwip(pEvent->y, priv->m_fZoom); ++ aMotionInTwipsInTwips.width = 1; ++ aMotionInTwipsInTwips.height = 1; ++ if (gdk_rectangle_intersect(&aMotionInTwipsInTwips, &priv->m_aGraphicSelection, 0)) ++ { ++ g_info("lcl_signalMotion: start of drag graphic selection"); ++ priv->m_bInDragGraphicSelection = true; ++ priv->m_pDocument->pClass->setGraphicSelection(priv->m_pDocument, LOK_SETGRAPHICSELECTION_START, pixelToTwip(pEvent->x, priv->m_fZoom), pixelToTwip(pEvent->y, priv->m_fZoom)); ++ return FALSE; + } +- delete pCallback; + +- return G_SOURCE_REMOVE; +-} ++ // Otherwise a mouse move, as on the desktop. ++ priv->m_pDocument->pClass->postMouseEvent(priv->m_pDocument, LOK_MOUSEEVENT_MOUSEMOVE, pixelToTwip(pEvent->x, priv->m_fZoom), pixelToTwip(pEvent->y, priv->m_fZoom), 1); + +-void LOKDocView_Impl::callbackWorker(int nType, const char* pPayload, void* pData) +-{ +- LOKDocView* pDocView = static_cast(pData); +- pDocView->m_pImpl->callbackWorkerImpl(nType, pPayload); ++ return FALSE; + } + +-void LOKDocView_Impl::globalCallbackWorker(int nType, const char* pPayload, void* pData) ++static void lok_doc_view_init (LOKDocView* pDocView) + { +- LOKDocView* pDocView = static_cast(pData); +- pDocView->m_pImpl->globalCallbackWorkerImpl(nType, pPayload); ++ pDocView->priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ pDocView->priv->m_bCursorVisible = true; ++ ++ gtk_widget_add_events(GTK_WIDGET(pDocView), ++ GDK_BUTTON_PRESS_MASK ++ |GDK_BUTTON_RELEASE_MASK ++ |GDK_BUTTON_MOTION_MASK ++ |GDK_KEY_PRESS_MASK ++ |GDK_KEY_RELEASE_MASK); + } + +-void LOKDocView_Impl::callbackWorkerImpl(int nType, const char* pPayload) ++static void lok_doc_view_set_property (GObject* object, guint propId, const GValue *value, GParamSpec *pspec) + { +- LOKDocView_Impl::CallbackData* pCallback = new LOKDocView_Impl::CallbackData(nType, pPayload ? pPayload : "(nil)", m_pDocView); +- g_info("lok_doc_view_callback_worker: %s, '%s'", LOKDocView_Impl::callbackTypeToString(nType), pPayload); +- gdk_threads_add_idle(LOKDocView_Impl::callback, pCallback); ++ LOKDocView* pDocView = LOK_DOC_VIEW (object); ++ LOKDocViewPrivate* priv = pDocView->priv; ++ ++ switch (propId) ++ { ++ case PROP_LO_PATH: ++ priv->m_aLOPath = g_value_dup_string (value); ++ break; ++ case PROP_DOC_PATH: ++ priv->m_aDocPath = g_value_dup_string (value); ++ break; ++ case PROP_EDITABLE: ++ lok_doc_view_set_edit (pDocView, g_value_get_boolean (value)); ++ break; ++ case PROP_ZOOM: ++ lok_doc_view_set_zoom (pDocView, g_value_get_float (value)); ++ break; ++ case PROP_DOC_WIDTH: ++ priv->m_nDocumentWidthTwips = g_value_get_long (value); ++ break; ++ case PROP_DOC_HEIGHT: ++ priv->m_nDocumentHeightTwips = g_value_get_long (value); ++ break; ++ default: ++ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, propId, pspec); ++ } + } + +-void LOKDocView_Impl::globalCallbackWorkerImpl(int nType, const char* pPayload) ++static void lok_doc_view_get_property (GObject* object, guint propId, GValue *value, GParamSpec *pspec) + { +- LOKDocView_Impl::CallbackData* pCallback = new LOKDocView_Impl::CallbackData(nType, pPayload ? pPayload : "(nil)", m_pDocView); +- g_info("LOKDocView_Impl::globalCallbackWorkerImpl: %s, '%s'", LOKDocView_Impl::callbackTypeToString(nType), pPayload); +- gdk_threads_add_idle(LOKDocView_Impl::globalCallback, pCallback); ++ LOKDocView* pDocView = LOK_DOC_VIEW (object); ++ LOKDocViewPrivate* priv = pDocView->priv; ++ ++ switch (propId) ++ { ++ case PROP_LO_PATH: ++ g_value_set_string (value, priv->m_aLOPath); ++ break; ++ case PROP_DOC_PATH: ++ g_value_set_string (value, priv->m_aDocPath); ++ break; ++ case PROP_EDITABLE: ++ g_value_set_boolean (value, priv->m_bEdit); ++ break; ++ case PROP_LOAD_PROGRESS: ++ g_value_set_uint (value, priv->m_nLoadProgress); ++ break; ++ case PROP_ZOOM: ++ g_value_set_float (value, priv->m_fZoom); ++ break; ++ case PROP_IS_LOADING: ++ g_value_set_boolean (value, priv->m_bIsLoading); ++ break; ++ case PROP_DOC_WIDTH: ++ g_value_set_long (value, priv->m_nDocumentWidthTwips); ++ break; ++ case PROP_DOC_HEIGHT: ++ g_value_set_long (value, priv->m_nDocumentHeightTwips); ++ break; ++ case PROP_CAN_ZOOM_IN: ++ g_value_set_boolean (value, priv->m_bCanZoomIn); ++ break; ++ case PROP_CAN_ZOOM_OUT: ++ g_value_set_boolean (value, priv->m_bCanZoomOut); ++ break; ++ default: ++ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, propId, pspec); ++ } + } + +-void LOKDocView_Impl::commandChanged(const std::string& rString) ++static gboolean lok_doc_view_draw (GtkWidget* pWidget, cairo_t* pCairo) + { +- g_signal_emit(m_pDocView, doc_view_signals[COMMAND_CHANGED], 0, rString.c_str()); ++ LOKDocView *pDocView = LOK_DOC_VIEW (pWidget); ++ ++ renderDocument (pDocView, pCairo); ++ renderOverlay (pDocView, pCairo); ++ ++ return FALSE; + } + +-void LOKDocView_Impl::searchNotFound(const std::string& rString) ++static void lok_doc_view_finalize (GObject* object) + { +- g_signal_emit(m_pDocView, doc_view_signals[SEARCH_NOT_FOUND], 0, rString.c_str()); ++ LOKDocView* pDocView = LOK_DOC_VIEW (object); ++ LOKDocViewPrivate* priv = pDocView->priv; ++ ++ if (priv->m_pDocument) ++ priv->m_pDocument->pClass->destroy (priv->m_pDocument); ++ if (priv->m_pOffice) ++ priv->m_pOffice->pClass->destroy (priv->m_pOffice); ++ ++ G_OBJECT_CLASS (lok_doc_view_parent_class)->finalize (object); + } + +-void LOKDocView_Impl::setPart(const std::string& rString) ++static void lok_doc_view_constructed (GObject* object) + { +- g_signal_emit(m_pDocView, doc_view_signals[PART_CHANGED], 0, std::stoi(rString)); ++ LOKDocView* pDocView = LOK_DOC_VIEW (object); ++ LOKDocViewPrivate* priv = pDocView->priv; ++ ++ G_OBJECT_CLASS (lok_doc_view_parent_class)->constructed (object); ++ ++ pDocView->priv->m_pOffice = lok_init (priv->m_aLOPath); + } + + static void lok_doc_view_class_init (LOKDocViewClass* pClass) + { +- GObjectClass *gobject_class = G_OBJECT_CLASS(pClass); +- pClass->edit_changed = NULL; ++ GObjectClass *pGObjectClass = G_OBJECT_CLASS(pClass); ++ GtkWidgetClass *pWidgetClass = GTK_WIDGET_CLASS(pClass); ++ ++ pGObjectClass->get_property = lok_doc_view_get_property; ++ pGObjectClass->set_property = lok_doc_view_set_property; ++ pGObjectClass->finalize = lok_doc_view_finalize; ++ pGObjectClass->constructed = lok_doc_view_constructed; ++ ++ pWidgetClass->draw = lok_doc_view_draw; ++ pWidgetClass->button_press_event = lok_doc_view_signal_button; ++ pWidgetClass->button_release_event = lok_doc_view_signal_button; ++ pWidgetClass->motion_notify_event = lok_doc_view_signal_motion; ++ ++ /** ++ * LOKDocView:lopath: ++ * ++ * The absolute path of the LibreOffice install. ++ */ ++ g_object_class_install_property (pGObjectClass, ++ PROP_LO_PATH, ++ g_param_spec_string("lopath", ++ "LO Path", ++ "LibreOffice Install Path", ++ 0, ++ static_cast(G_PARAM_READWRITE ++ | G_PARAM_CONSTRUCT_ONLY))); ++ ++ /** ++ * LOKDocView:docpath: ++ * ++ * The path of the document that is currently being viewed. ++ */ ++ g_object_class_install_property (pGObjectClass, ++ PROP_DOC_PATH, ++ g_param_spec_string("docpath", ++ "Document Path", ++ "The URI of the document to open", ++ 0, ++ G_PARAM_READWRITE)); ++ ++ /** ++ * LOKDocView:editable: ++ * ++ * Whether the document loaded inside of #LOKDocView is editable or not. ++ */ ++ g_object_class_install_property (pGObjectClass, ++ PROP_EDITABLE, ++ g_param_spec_boolean("editable", ++ "Editable", ++ "Whether the content is in edit mode or not", ++ FALSE, ++ G_PARAM_READWRITE)); ++ ++ /** ++ * LOKDocView:load-progress: ++ * ++ * The percent completion of the current loading operation of the ++ * document. This can be used for progress bars. Note that this is not a ++ * very accurate progress indicator, and its value might reset it couple of ++ * times to 0 and start again. You should not rely on its numbers. ++ */ ++ g_object_class_install_property (pGObjectClass, ++ PROP_LOAD_PROGRESS, ++ g_param_spec_int("load-progress", ++ "Estimated Load Progress", ++ "Whether the content is in edit mode or not", ++ 0, 100, 0, ++ G_PARAM_READABLE)); ++ ++ /** ++ * LOKDocView:zoom-level: ++ * ++ * The current zoom level of the document loaded inside #LOKDocView. The ++ * default value is 1.0. ++ */ ++ g_object_class_install_property (pGObjectClass, ++ PROP_ZOOM, ++ g_param_spec_float("zoom-level", ++ "Zoom Level", ++ "The current zoom level of the content", ++ 0, 5.0, 1.0, ++ static_cast(G_PARAM_READWRITE | ++ G_PARAM_CONSTRUCT))); ++ ++ /** ++ * LOKDocView:is-loading: ++ * ++ * Whether the requested document is being loaded or not. %TRUE if it is ++ * being loaded, otherwise %FALSE. ++ */ ++ g_object_class_install_property (pGObjectClass, ++ PROP_IS_LOADING, ++ g_param_spec_boolean("is-loading", ++ "Is Loading", ++ "Whether the view is loading a document", ++ FALSE, ++ G_PARAM_READABLE)); ++ ++ /** ++ * LOKDocView:doc-width: ++ * ++ * The width of the currently loaded document in #LOKDocView in twips. ++ */ ++ g_object_class_install_property (pGObjectClass, ++ PROP_DOC_WIDTH, ++ g_param_spec_long("doc-width", ++ "Document Width", ++ "Width of the document in twips", ++ 0, G_MAXLONG, 0, ++ G_PARAM_READWRITE)); ++ ++ /** ++ * LOKDocView:doc-height: ++ * ++ * The height of the currently loaded document in #LOKDocView in twips. ++ */ ++ g_object_class_install_property (pGObjectClass, ++ PROP_DOC_HEIGHT, ++ g_param_spec_long("doc-height", ++ "Document Height", ++ "Height of the document in twips", ++ 0, G_MAXLONG, 0, ++ G_PARAM_READWRITE)); ++ ++ /** ++ * LOKDocView:can-zoom-in: ++ * ++ * It tells whether the view can further be zoomed in or not. ++ */ ++ g_object_class_install_property (pGObjectClass, ++ PROP_CAN_ZOOM_IN, ++ g_param_spec_boolean("can-zoom-in", ++ "Can Zoom In", ++ "Whether the view can be zoomed in further", ++ TRUE, ++ static_cast(G_PARAM_READABLE ++ | G_PARAM_STATIC_STRINGS))); ++ ++ /** ++ * LOKDocView:can-zoom-out: ++ * ++ * It tells whether the view can further be zoomed out or not. ++ */ ++ g_object_class_install_property (pGObjectClass, ++ PROP_CAN_ZOOM_OUT, ++ g_param_spec_boolean("can-zoom-out", ++ "Can Zoom Out", ++ "Whether the view can be zoomed out further", ++ TRUE, ++ static_cast(G_PARAM_READABLE ++ | G_PARAM_STATIC_STRINGS))); ++ ++ /** ++ * LOKDocView::edit-changed: ++ * @pDocView: the #LOKDocView on which the signal is emitted ++ * @bEdit: the new edit value of the view ++ */ + doc_view_signals[EDIT_CHANGED] = + g_signal_new("edit-changed", +- G_TYPE_FROM_CLASS (gobject_class), ++ G_TYPE_FROM_CLASS (pGObjectClass), + G_SIGNAL_RUN_FIRST, +- G_STRUCT_OFFSET (LOKDocViewClass, edit_changed), ++ 0, + NULL, NULL, + g_cclosure_marshal_VOID__BOOLEAN, + G_TYPE_NONE, 1, + G_TYPE_BOOLEAN); +- pClass->command_changed = NULL; ++ ++ /** ++ * LOKDocView::command-changed: ++ * @pDocView: the #LOKDocView on which the signal is emitted ++ * @aCommand: the command that was changed ++ */ + doc_view_signals[COMMAND_CHANGED] = + g_signal_new("command-changed", +- G_TYPE_FROM_CLASS(gobject_class), ++ G_TYPE_FROM_CLASS(pGObjectClass), + G_SIGNAL_RUN_FIRST, +- G_STRUCT_OFFSET(LOKDocViewClass, command_changed), ++ 0, + NULL, NULL, + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, 1, + G_TYPE_STRING); +- pClass->search_not_found = 0; ++ ++ /** ++ * LOKDocView::search-not-found: ++ * @pDocView: the #LOKDocView on which the signal is emitted ++ * @aCommand: the string for which the search was not found. ++ */ + doc_view_signals[SEARCH_NOT_FOUND] = + g_signal_new("search-not-found", +- G_TYPE_FROM_CLASS(gobject_class), ++ G_TYPE_FROM_CLASS(pGObjectClass), + G_SIGNAL_RUN_FIRST, +- G_STRUCT_OFFSET(LOKDocViewClass, search_not_found), ++ 0, + NULL, NULL, + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, 1, + G_TYPE_STRING); +- pClass->part_changed = 0; ++ ++ /** ++ * LOKDocView::part-changed: ++ * @pDocView: the #LOKDocView on which the signal is emitted ++ * @aCommand: the part number which the view changed to ++ */ + doc_view_signals[PART_CHANGED] = + g_signal_new("part-changed", +- G_TYPE_FROM_CLASS(gobject_class), ++ G_TYPE_FROM_CLASS(pGObjectClass), + G_SIGNAL_RUN_FIRST, +- G_STRUCT_OFFSET(LOKDocViewClass, part_changed), ++ 0, + NULL, NULL, + g_cclosure_marshal_VOID__INT, + G_TYPE_NONE, 1, + G_TYPE_INT); +-} + +-static void lok_doc_view_init (LOKDocView* pDocView) +-{ +- pDocView->m_pImpl = new LOKDocView_Impl(pDocView); +- +- g_signal_connect(G_OBJECT(pDocView), +- "draw", +- G_CALLBACK(LOKDocView_Impl::renderDocument), pDocView); +- g_signal_connect(G_OBJECT(pDocView), +- "draw", +- G_CALLBACK(LOKDocView_Impl::renderOverlay), pDocView); +- gtk_widget_add_events(GTK_WIDGET(pDocView), +- GDK_BUTTON_PRESS_MASK +- |GDK_BUTTON_RELEASE_MASK +- |GDK_BUTTON_MOTION_MASK); +- +- g_signal_connect(G_OBJECT(pDocView), +- "button-press-event", +- G_CALLBACK(LOKDocView_Impl::signalButton), pDocView); +- g_signal_connect(G_OBJECT(pDocView), +- "button-release-event", +- G_CALLBACK(LOKDocView_Impl::signalButton), pDocView); +- g_signal_connect(G_OBJECT(pDocView), +- "motion-notify-event", +- G_CALLBACK(LOKDocView_Impl::signalMotion), pDocView); +- +- g_signal_connect(G_OBJECT(pDocView), "destroy", G_CALLBACK(LOKDocView_Impl::destroy), 0); ++ /** ++ * LOKDocView::hyperlinked-clicked: ++ * @pDocView: the #LOKDocView on which the signal is emitted ++ * @aHyperlink: the URI which the application should handle ++ */ ++ doc_view_signals[PART_CHANGED] = ++ g_signal_new("hyperlinked-clicked", ++ G_TYPE_FROM_CLASS(pGObjectClass), ++ G_SIGNAL_RUN_FIRST, ++ 0, ++ NULL, NULL, ++ g_cclosure_marshal_VOID__STRING, ++ G_TYPE_NONE, 1, ++ G_TYPE_STRING); + } + ++ ++ + /** + * lok_doc_view_new: + * @pPath: LibreOffice install path. + * + * Returns: The #LOKDocView widget instance. + */ +-SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new(const char* pPath) ++SAL_DLLPUBLIC_EXPORT GtkWidget* ++lok_doc_view_new (const char* pPath) + { +- LOKDocView* pDocView = LOK_DOC_VIEW(g_object_new(LOK_TYPE_DOC_VIEW, NULL)); +- pDocView->m_pImpl->m_pOffice = lok_init (pPath); +- if (pDocView->m_pImpl->m_pOffice == NULL) +- return NULL; +- return GTK_WIDGET( pDocView ); ++ return GTK_WIDGET (g_object_new(LOK_TYPE_DOC_VIEW, "lopath", pPath, NULL)); + } + + /** +@@ -1186,47 +1367,47 @@ SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new(const char* pPath) + * + * Returns: %TRUE if the document is loaded succesfully, %FALSE otherwise + */ +-SAL_DLLPUBLIC_EXPORT gboolean lok_doc_view_open_document( LOKDocView* pDocView, char* pPath ) ++SAL_DLLPUBLIC_EXPORT gboolean ++lok_doc_view_open_document (LOKDocView* pDocView, char* pPath) + { +- if ( pDocView->m_pImpl->m_pDocument ) ++ if ( pDocView->priv->m_pDocument ) + { +- pDocView->m_pImpl->m_pDocument->pClass->destroy( pDocView->m_pImpl->m_pDocument ); +- pDocView->m_pImpl->m_pDocument = 0; ++ pDocView->priv->m_pDocument->pClass->destroy( pDocView->priv->m_pDocument ); ++ pDocView->priv->m_pDocument = 0; + } + +- pDocView->m_pImpl->m_pOffice->pClass->registerCallback(pDocView->m_pImpl->m_pOffice, &LOKDocView_Impl::globalCallbackWorker, pDocView); +- pDocView->m_pImpl->m_pDocument = pDocView->m_pImpl->m_pOffice->pClass->documentLoad( pDocView->m_pImpl->m_pOffice, ++ pDocView->priv->m_pOffice->pClass->registerCallback(pDocView->priv->m_pOffice, globalCallbackWorker, pDocView); ++ pDocView->priv->m_pDocument = pDocView->priv->m_pOffice->pClass->documentLoad( pDocView->priv->m_pOffice, + pPath ); +- if ( !pDocView->m_pImpl->m_pDocument ) ++ if ( !pDocView->priv->m_pDocument ) + { + // FIXME: should have a GError parameter and populate it. +- char *pError = pDocView->m_pImpl->m_pOffice->pClass->getError( pDocView->m_pImpl->m_pOffice ); ++ char *pError = pDocView->priv->m_pOffice->pClass->getError( pDocView->priv->m_pOffice ); + fprintf( stderr, "Error opening document '%s'\n", pError ); + return FALSE; + } + else + { +- pDocView->m_pImpl->m_pDocument->pClass->initializeForRendering(pDocView->m_pImpl->m_pDocument); +- pDocView->m_pImpl->m_pDocument->pClass->registerCallback(pDocView->m_pImpl->m_pDocument, &LOKDocView_Impl::callbackWorker, pDocView); +- pDocView->m_pImpl->m_pDocument->pClass->getDocumentSize(pDocView->m_pImpl->m_pDocument, &pDocView->m_pImpl->m_nDocumentWidthTwips, &pDocView->m_pImpl->m_nDocumentHeightTwips); +- g_timeout_add(600, &LOKDocView_Impl::handleTimeout, pDocView); +- +- float zoom = pDocView->m_pImpl->m_fZoom; +- long nDocumentWidthTwips = pDocView->m_pImpl->m_nDocumentWidthTwips; +- long nDocumentHeightTwips = pDocView->m_pImpl->m_nDocumentHeightTwips; ++ pDocView->priv->m_pDocument->pClass->initializeForRendering(pDocView->priv->m_pDocument); ++ pDocView->priv->m_pDocument->pClass->registerCallback(pDocView->priv->m_pDocument, callbackWorker, pDocView); ++ pDocView->priv->m_pDocument->pClass->getDocumentSize(pDocView->priv->m_pDocument, &pDocView->priv->m_nDocumentWidthTwips, &pDocView->priv->m_nDocumentHeightTwips); ++ g_timeout_add(600, handleTimeout, pDocView); ++ ++ float zoom = pDocView->priv->m_fZoom; ++ long nDocumentWidthTwips = pDocView->priv->m_nDocumentWidthTwips; ++ long nDocumentHeightTwips = pDocView->priv->m_nDocumentHeightTwips; + long nDocumentWidthPixels = twipToPixel(nDocumentWidthTwips, zoom); + long nDocumentHeightPixels = twipToPixel(nDocumentHeightTwips, zoom); + // Total number of columns in this document. + guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); + + +- pDocView->m_pImpl->m_aTileBuffer = TileBuffer(pDocView->m_pImpl->m_pDocument, +- nColumns); ++ pDocView->priv->m_aTileBuffer = TileBuffer(pDocView->priv->m_pDocument, ++ nColumns); + gtk_widget_set_size_request(GTK_WIDGET(pDocView), + nDocumentWidthPixels, + nDocumentHeightPixels); + } +- + return TRUE; + } + +@@ -1236,9 +1417,10 @@ SAL_DLLPUBLIC_EXPORT gboolean lok_doc_view_open_document( LOKDocView* pDocView, + * + * Returns: The #LibreOfficeKitDocument instance the widget is currently showing + */ +-SAL_DLLPUBLIC_EXPORT LibreOfficeKitDocument* lok_doc_view_get_document(LOKDocView* pDocView) ++SAL_DLLPUBLIC_EXPORT LibreOfficeKitDocument* ++lok_doc_view_get_document (LOKDocView* pDocView) + { +- return pDocView->m_pImpl->m_pDocument; ++ return pDocView->priv->m_pDocument; + } + + /** +@@ -1248,16 +1430,17 @@ SAL_DLLPUBLIC_EXPORT LibreOfficeKitDocument* lok_doc_view_get_document(LOKDocVie + * + * Sets the new zoom level for the widget. + */ +-SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_zoom ( LOKDocView* pDocView, float fZoom ) ++SAL_DLLPUBLIC_EXPORT void ++lok_doc_view_set_zoom (LOKDocView* pDocView, float fZoom) + { +- pDocView->m_pImpl->m_fZoom = fZoom; +- long nDocumentWidthPixels = twipToPixel(pDocView->m_pImpl->m_nDocumentWidthTwips, fZoom); +- long nDocumentHeightPixels = twipToPixel(pDocView->m_pImpl->m_nDocumentHeightTwips, fZoom); ++ pDocView->priv->m_fZoom = fZoom; ++ long nDocumentWidthPixels = twipToPixel(pDocView->priv->m_nDocumentWidthTwips, fZoom); ++ long nDocumentHeightPixels = twipToPixel(pDocView->priv->m_nDocumentHeightTwips, fZoom); + // Total number of columns in this document. + guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); + +- pDocView->m_pImpl->m_aTileBuffer = TileBuffer(pDocView->m_pImpl->m_pDocument, +- nColumns); ++ pDocView->priv->m_aTileBuffer = TileBuffer(pDocView->priv->m_pDocument, ++ nColumns); + gtk_widget_set_size_request(GTK_WIDGET(pDocView), + nDocumentWidthPixels, + nDocumentHeightPixels); +@@ -1269,35 +1452,41 @@ SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_zoom ( LOKDocView* pDocView, float fZ + * + * Returns: The current zoom factor value in float for pDocView + */ +-SAL_DLLPUBLIC_EXPORT float lok_doc_view_get_zoom ( LOKDocView* pDocView ) ++SAL_DLLPUBLIC_EXPORT float ++lok_doc_view_get_zoom (LOKDocView* pDocView) + { +- return pDocView->m_pImpl->m_fZoom; ++ return pDocView->priv->m_fZoom; + } + +-SAL_DLLPUBLIC_EXPORT int lok_doc_view_get_parts( LOKDocView* pDocView ) ++SAL_DLLPUBLIC_EXPORT int ++lok_doc_view_get_parts (LOKDocView* pDocView) + { +- return pDocView->m_pImpl->m_pDocument->pClass->getParts( pDocView->m_pImpl->m_pDocument ); ++ return pDocView->priv->m_pDocument->pClass->getParts( pDocView->priv->m_pDocument ); + } + +-SAL_DLLPUBLIC_EXPORT int lok_doc_view_get_part( LOKDocView* pDocView ) ++SAL_DLLPUBLIC_EXPORT int ++lok_doc_view_get_part (LOKDocView* pDocView) + { +- return pDocView->m_pImpl->m_pDocument->pClass->getPart( pDocView->m_pImpl->m_pDocument ); ++ return pDocView->priv->m_pDocument->pClass->getPart( pDocView->priv->m_pDocument ); + } + +-SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_part( LOKDocView* pDocView, int nPart) ++SAL_DLLPUBLIC_EXPORT void ++lok_doc_view_set_part (LOKDocView* pDocView, int nPart) + { +- pDocView->m_pImpl->m_pDocument->pClass->setPart( pDocView->m_pImpl->m_pDocument, nPart ); ++ pDocView->priv->m_pDocument->pClass->setPart( pDocView->priv->m_pDocument, nPart ); + } + +-SAL_DLLPUBLIC_EXPORT char* lok_doc_view_get_part_name( LOKDocView* pDocView, int nPart ) ++SAL_DLLPUBLIC_EXPORT char* ++lok_doc_view_get_part_name (LOKDocView* pDocView, int nPart) + { +- return pDocView->m_pImpl->m_pDocument->pClass->getPartName( pDocView->m_pImpl->m_pDocument, nPart ); ++ return pDocView->priv->m_pDocument->pClass->getPartName( pDocView->priv->m_pDocument, nPart ); + } + +-SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_partmode( LOKDocView* pDocView, +- int nPartMode ) ++SAL_DLLPUBLIC_EXPORT void ++lok_doc_view_set_partmode(LOKDocView* pDocView, ++ int nPartMode) + { +- pDocView->m_pImpl->m_pDocument->pClass->setPartMode( pDocView->m_pImpl->m_pDocument, nPartMode ); ++ pDocView->priv->m_pDocument->pClass->setPartMode( pDocView->priv->m_pDocument, nPartMode ); + } + + /** +@@ -1307,19 +1496,20 @@ SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_partmode( LOKDocView* pDocView, + * + * Sets the edit-mode for pDocView + */ +-SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_edit( LOKDocView* pDocView, +- gboolean bEdit ) ++SAL_DLLPUBLIC_EXPORT void ++lok_doc_view_set_edit(LOKDocView* pDocView, ++ gboolean bEdit) + { +- gboolean bWasEdit = pDocView->m_pImpl->m_bEdit; ++ gboolean bWasEdit = pDocView->priv->m_bEdit; + +- if (!pDocView->m_pImpl->m_bEdit && bEdit) ++ if (!pDocView->priv->m_bEdit && bEdit) + g_info("lok_doc_view_set_edit: entering edit mode"); +- else if (pDocView->m_pImpl->m_bEdit && !bEdit) ++ else if (pDocView->priv->m_bEdit && !bEdit) + { + g_info("lok_doc_view_set_edit: leaving edit mode"); +- pDocView->m_pImpl->m_pDocument->pClass->resetSelection(pDocView->m_pImpl->m_pDocument); ++ pDocView->priv->m_pDocument->pClass->resetSelection(pDocView->priv->m_pDocument); + } +- pDocView->m_pImpl->m_bEdit = bEdit; ++ pDocView->priv->m_bEdit = bEdit; + g_signal_emit(pDocView, doc_view_signals[EDIT_CHANGED], 0, bWasEdit); + gtk_widget_queue_draw(GTK_WIDGET(pDocView)); + } +@@ -1330,20 +1520,39 @@ SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_edit( LOKDocView* pDocView, + * + * Returns: %TRUE if the given pDocView is in edit mode. + */ +-SAL_DLLPUBLIC_EXPORT gboolean lok_doc_view_get_edit(LOKDocView* pDocView) ++SAL_DLLPUBLIC_EXPORT gboolean ++lok_doc_view_get_edit (LOKDocView* pDocView) + { +- return pDocView->m_pImpl->m_bEdit; ++ return pDocView->priv->m_bEdit; + } + +-SAL_DLLPUBLIC_EXPORT void lok_doc_view_post_command(LOKDocView* pDocView, const char* pCommand, const char* pArguments) ++/** ++ * lok_doc_view_post_command: ++ * @pDocView: the #LOKDocView instance ++ * @pCommand: the command to issue to LO core ++ * @pArguments: the arguments to the given command ++ * ++ * This methods forwards your command to LO core. ++*/ ++SAL_DLLPUBLIC_EXPORT void ++lok_doc_view_post_command (LOKDocView* pDocView, ++ const char* pCommand, ++ const char* pArguments) + { +- pDocView->m_pImpl->m_pDocument->pClass->postUnoCommand(pDocView->m_pImpl->m_pDocument, pCommand, pArguments); ++ pDocView->priv->m_pDocument->pClass->postUnoCommand(pDocView->priv->m_pDocument, pCommand, pArguments); + } + +-SAL_DLLPUBLIC_EXPORT void lok_doc_view_post_key(GtkWidget* /*pWidget*/, GdkEventKey* pEvent, gpointer pData) ++/** ++ * lok_doc_view_post_key: ++ * @pDocView: the #LOKDocView instance ++ * @pEvent: the #GdkEventKey containing information about the event ++ * ++ * This methods forwards your key events to the LO core. ++*/ ++SAL_DLLPUBLIC_EXPORT void ++lok_doc_view_post_key (LOKDocView* pDocView, GdkEvent* pEvent) + { +- LOKDocView* pDocView = static_cast(pData); +- pDocView->m_pImpl->signalKey(pEvent); ++ signalKey(pDocView, pEvent); + } + + /** +@@ -1355,9 +1564,10 @@ SAL_DLLPUBLIC_EXPORT void lok_doc_view_post_key(GtkWidget* /*pWidget*/, GdkEvent + * + * Returns: The corresponding value in twips + */ +-SAL_DLLPUBLIC_EXPORT float lok_doc_view_pixel_to_twip(LOKDocView* pDocView, float fInput) ++SAL_DLLPUBLIC_EXPORT float ++lok_doc_view_pixel_to_twip (LOKDocView* pDocView, float fInput) + { +- return pixelToTwip(fInput, pDocView->m_pImpl->m_fZoom); ++ return pixelToTwip(fInput, pDocView->priv->m_fZoom); + } + + /** +@@ -1369,10 +1579,10 @@ SAL_DLLPUBLIC_EXPORT float lok_doc_view_pixel_to_twip(LOKDocView* pDocView, floa + * + * Returns: The corresponding value in pixels + */ +-SAL_DLLPUBLIC_EXPORT float lok_doc_view_twip_to_pixel(LOKDocView* pDocView, float fInput) ++SAL_DLLPUBLIC_EXPORT float ++lok_doc_view_twip_to_pixel (LOKDocView* pDocView, float fInput) + { +- return twipToPixel(fInput, pDocView->m_pImpl->m_fZoom); ++ return twipToPixel(fInput, pDocView->priv->m_fZoom); + } + +- + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +-- +2.12.0 + diff --git a/SOURCES/0051-Superfluous-block-lets-merge-into-one.patch b/SOURCES/0051-Superfluous-block-lets-merge-into-one.patch new file mode 100644 index 0000000..919c815 --- /dev/null +++ b/SOURCES/0051-Superfluous-block-lets-merge-into-one.patch @@ -0,0 +1,28 @@ +From 823b947a6c3b526f4a8a4773371ab22c140c366c Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Fri, 12 Jun 2015 19:48:37 +0530 +Subject: [PATCH 051/398] Superfluous block; lets merge into one + +Change-Id: I2f49394c53deece8e86a7f290250c4f52918c5d8 +(cherry picked from commit 23ca7d8a81df74d7195d2d8916f77c6305fc8a94) +--- + libreofficekit/Module_libreofficekit.mk | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/libreofficekit/Module_libreofficekit.mk b/libreofficekit/Module_libreofficekit.mk +index 217ecb22ff33..0b2fd4ae103d 100644 +--- a/libreofficekit/Module_libreofficekit.mk ++++ b/libreofficekit/Module_libreofficekit.mk +@@ -19,9 +19,6 @@ ifneq ($(ENABLE_GTK3),) + $(eval $(call gb_Module_add_targets,libreofficekit,\ + Library_libreofficekitgtk \ + Executable_gtktiledviewer \ +-)) +- +-$(eval $(call gb_Module_add_targets,libreofficekit,\ + Executable_tilebench \ + )) + endif # ($(ENABLE_GTK3),) +-- +2.12.0 + diff --git a/SOURCES/0052-lokdocview-couple-for-missing-static_cast-GParamFlag.patch b/SOURCES/0052-lokdocview-couple-for-missing-static_cast-GParamFlag.patch new file mode 100644 index 0000000..637d839 --- /dev/null +++ b/SOURCES/0052-lokdocview-couple-for-missing-static_cast-GParamFlag.patch @@ -0,0 +1,75 @@ +From c59de3973a3910b949528806dab6756f7ed92199 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 16 Jun 2015 11:34:36 +0200 +Subject: [PATCH 052/398] lokdocview: couple for missing + static_cast() + +Change-Id: I038c05c0d081f52e4ac90688f73397565413632d +(cherry picked from commit 9dcd2d119ab67bde9de588c42db3805525d5f06a) +--- + libreofficekit/source/gtk/lokdocview.cxx | 13 +++++-------- + 1 file changed, 5 insertions(+), 8 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 7031be9b6536..20b1aa6b837e 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -519,10 +519,7 @@ callback (gpointer pData) + break; + case LOK_CALLBACK_DOCUMENT_SIZE_CHANGED: + { +- g_info ("%d %d", priv->m_nDocumentWidthTwips, priv->m_nDocumentHeightTwips); +- g_info ("startin"); + payloadToSize(pCallback->m_aPayload.c_str(), priv->m_nDocumentWidthTwips, priv->m_nDocumentHeightTwips); +- g_info ("%d %d", priv->m_nDocumentWidthTwips, priv->m_nDocumentHeightTwips); + gtk_widget_set_size_request(GTK_WIDGET(pDocView), + twipToPixel(priv->m_nDocumentWidthTwips, priv->m_fZoom), + twipToPixel(priv->m_nDocumentHeightTwips, priv->m_fZoom)); +@@ -1156,7 +1153,7 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + "Document Path", + "The URI of the document to open", + 0, +- G_PARAM_READWRITE)); ++ static_cast(G_PARAM_READWRITE))); + + /** + * LOKDocView:editable: +@@ -1169,7 +1166,7 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + "Editable", + "Whether the content is in edit mode or not", + FALSE, +- G_PARAM_READWRITE)); ++ static_cast(G_PARAM_READWRITE))); + + /** + * LOKDocView:load-progress: +@@ -1214,7 +1211,7 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + "Is Loading", + "Whether the view is loading a document", + FALSE, +- G_PARAM_READABLE)); ++ static_cast(G_PARAM_READABLE))); + + /** + * LOKDocView:doc-width: +@@ -1227,7 +1224,7 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + "Document Width", + "Width of the document in twips", + 0, G_MAXLONG, 0, +- G_PARAM_READWRITE)); ++ static_cast(G_PARAM_READWRITE))); + + /** + * LOKDocView:doc-height: +@@ -1240,7 +1237,7 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + "Document Height", + "Height of the document in twips", + 0, G_MAXLONG, 0, +- G_PARAM_READWRITE)); ++ static_cast(G_PARAM_READWRITE))); + + /** + * LOKDocView:can-zoom-in: +-- +2.12.0 + diff --git a/SOURCES/0053-gtktiledviewer-add-copy-button.patch b/SOURCES/0053-gtktiledviewer-add-copy-button.patch new file mode 100644 index 0000000..a7b4469 --- /dev/null +++ b/SOURCES/0053-gtktiledviewer-add-copy-button.patch @@ -0,0 +1,53 @@ +From 82c4891ec0e285b1cdf767dea54b877a16177374 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Thu, 18 Jun 2015 09:18:18 +0200 +Subject: [PATCH 053/398] gtktiledviewer: add copy button + +Change-Id: I56ed5047da118eac01d7dea150597133215278e2 +(cherry picked from commit 437210d58f32177ef1829d704f7f4d2f1bbfbfdd) +--- + libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 21 +++++++++++++++++++++ + 1 file changed, 21 insertions(+) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 8b006797c226..9496ba5ea180 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -125,6 +125,19 @@ static void toggleFindbar(GtkWidget* /*pButton*/, gpointer /*pItem*/) + } + } + ++/// Handler for the copy button: write clipboard. ++static void doCopy(GtkWidget* /*pButton*/, gpointer /*pItem*/) ++{ ++ LOKDocView* pLOKDocView = LOK_DOC_VIEW(pDocView); ++ LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(pLOKDocView); ++ char* pSelection = pDocument->pClass->getTextSelection(pDocument, "text/plain;charset=utf-8"); ++ ++ GtkClipboard* pClipboard = gtk_clipboard_get_for_display(gtk_widget_get_display(pDocView), GDK_SELECTION_CLIPBOARD); ++ gtk_clipboard_set_text(pClipboard, pSelection, -1); ++ ++ free(pSelection); ++} ++ + /// Get the visible area of the scrolled window + static void getVisibleAreaTwips(GdkRectangle* pArea) + { +@@ -394,6 +407,14 @@ int main( int argc, char* argv[] ) + gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pPartModeSelectorToolItem, -1 ); + + gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), gtk_separator_tool_item_new(), -1); ++ ++ // Cut, copy & paste. ++ GtkToolItem* pCopyButton = gtk_tool_button_new( NULL, NULL); ++ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(pCopyButton), "edit-copy-symbolic"); ++ gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pCopyButton, -1); ++ g_signal_connect(G_OBJECT(pCopyButton), "clicked", G_CALLBACK(doCopy), NULL); ++ gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), gtk_separator_tool_item_new(), -1); ++ + pEnableEditing = gtk_toggle_tool_button_new(); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pEnableEditing), "insert-text-symbolic"); + gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pEnableEditing, -1); +-- +2.12.0 + diff --git a/SOURCES/0054-gtktiledviewer-do-HTML-copying-if-possible.patch b/SOURCES/0054-gtktiledviewer-do-HTML-copying-if-possible.patch new file mode 100644 index 0000000..e33fc03 --- /dev/null +++ b/SOURCES/0054-gtktiledviewer-do-HTML-copying-if-possible.patch @@ -0,0 +1,71 @@ +From 25bb8e0fa54097cc0197e5883b0b95b648d75452 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Mon, 22 Jun 2015 09:06:31 +0200 +Subject: [PATCH 054/398] gtktiledviewer: do HTML copying if possible + +(cherry picked from commit f403cecdaedf263f11081c91bed62640362a3a3e) + +Change-Id: I24e7b18442cb08814a73dd33b368b368039a11e4 +--- + .../qa/gtktiledviewer/gtktiledviewer.cxx | 38 ++++++++++++++++++++-- + 1 file changed, 36 insertions(+), 2 deletions(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 9496ba5ea180..57556616d803 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -125,15 +125,49 @@ static void toggleFindbar(GtkWidget* /*pButton*/, gpointer /*pItem*/) + } + } + ++/// Our GtkClipboardGetFunc implementation for HTML. ++static void htmlGetFunc(GtkClipboard* /*pClipboard*/, GtkSelectionData* pSelectionData, guint /*info*/, gpointer pUserData) ++{ ++ GdkAtom aAtom(gdk_atom_intern("text/html", false)); ++ const gchar* pSelection = static_cast(pUserData); ++ gtk_selection_data_set(pSelectionData, aAtom, 8, reinterpret_cast(pSelection), strlen(pSelection)); ++} ++ ++/// Our GtkClipboardClearFunc implementation for HTML. ++static void htmlClearFunc(GtkClipboard* /*pClipboard*/, gpointer pData) ++{ ++ g_free(pData); ++} ++ ++/// Same as gtk_clipboard_set_text(), but sets HTML. ++static void clipboardSetHtml(GtkClipboard* pClipboard, const char* pSelection) ++{ ++ GtkTargetList* pList = gtk_target_list_new(0, 0); ++ GdkAtom aAtom(gdk_atom_intern("text/html", false)); ++ gtk_target_list_add(pList, aAtom, 0, 0); ++ gint nTargets = 0; ++ GtkTargetEntry* pTargets = gtk_target_table_new_from_list(pList, &nTargets); ++ ++ gtk_clipboard_set_with_data(pClipboard, pTargets, nTargets, htmlGetFunc, htmlClearFunc, g_strdup(pSelection)); ++ ++ gtk_target_table_free(pTargets, nTargets); ++ gtk_target_list_unref(pList); ++} ++ + /// Handler for the copy button: write clipboard. + static void doCopy(GtkWidget* /*pButton*/, gpointer /*pItem*/) + { + LOKDocView* pLOKDocView = LOK_DOC_VIEW(pDocView); + LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(pLOKDocView); +- char* pSelection = pDocument->pClass->getTextSelection(pDocument, "text/plain;charset=utf-8"); ++ char* pUsedFormat = 0; ++ char* pSelection = pDocument->pClass->getTextSelection(pDocument, "text/html", &pUsedFormat); + + GtkClipboard* pClipboard = gtk_clipboard_get_for_display(gtk_widget_get_display(pDocView), GDK_SELECTION_CLIPBOARD); +- gtk_clipboard_set_text(pClipboard, pSelection, -1); ++ std::string aUsedFormat(pUsedFormat); ++ if (aUsedFormat == "text/plain;charset=utf-8") ++ gtk_clipboard_set_text(pClipboard, pSelection, -1); ++ else ++ clipboardSetHtml(pClipboard, pSelection); + + free(pSelection); + } +-- +2.12.0 + diff --git a/SOURCES/0055-lokdocview-Use-GInitable.patch b/SOURCES/0055-lokdocview-Use-GInitable.patch new file mode 100644 index 0000000..4643bb3 --- /dev/null +++ b/SOURCES/0055-lokdocview-Use-GInitable.patch @@ -0,0 +1,166 @@ +From 9a1d485f937bf92ae860078b94a5372b3a4ce718 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Thu, 18 Jun 2015 21:52:22 +0530 +Subject: [PATCH 055/398] lokdocview: Use GInitable + +The construction of LokDocView widget can fail because it +involves initializing the lok context via lok_init. + +Having lok_init calls in constructed virtual method is a bad idea +since it assumes that construction will never fail. So, implement +GInitable for this class, and move the object initialization from +constructed to initable. + +Change-Id: Idf18a054cf8ef2e946392458ec52cb0107bd7454 +(cherry picked from commit a2aaf911e2e7b63af920186acb2a5e03bc58bd54) +--- + include/LibreOfficeKit/LibreOfficeKitGtk.h | 6 ++- + .../qa/gtktiledviewer/gtktiledviewer.cxx | 2 +- + libreofficekit/source/gtk/lokdocview.cxx | 49 +++++++++++++++------- + 3 files changed, 39 insertions(+), 18 deletions(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h +index 7048dbefc0a1..3eaf28352a11 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h ++++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h +@@ -42,10 +42,12 @@ struct _LOKDocViewClass + + GType lok_doc_view_get_type (void) G_GNUC_CONST; + +-GtkWidget* lok_doc_view_new (const char* pPath); ++GtkWidget* lok_doc_view_new (const gchar* pPath, ++ GCancellable *cancellable, ++ GError **error); + + gboolean lok_doc_view_open_document (LOKDocView* pDocView, +- char* pPath); ++ const gchar* pPath); + + /// Gets the document the viewer displays. + LibreOfficeKitDocument* lok_doc_view_get_document (LOKDocView* pDocView); +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 57556616d803..fedd6c9fdf13 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -520,7 +520,7 @@ int main( int argc, char* argv[] ) + gtk_box_pack_end(GTK_BOX(pVBox), pFindbar, FALSE, FALSE, 0); + + // Docview +- pDocView = lok_doc_view_new(argv[1]); ++ pDocView = lok_doc_view_new (argv[1], NULL, NULL); + if (pDocView == NULL) + g_error ("Error while creating LOKDocView widget"); + g_signal_connect(pDocView, "edit-changed", G_CALLBACK(signalEdit), NULL); +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 20b1aa6b837e..144f17efba94 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -137,12 +137,16 @@ enum + + static guint doc_view_signals[LAST_SIGNAL] = { 0 }; + ++static void lok_doc_view_initable_iface_init (GInitableIface *iface); ++ + SAL_DLLPUBLIC_EXPORT GType lok_doc_view_get_type(); + #ifdef __GNUC__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wunused-function" + #endif +-G_DEFINE_TYPE_WITH_PRIVATE (LOKDocView, lok_doc_view, GTK_TYPE_DRAWING_AREA) ++G_DEFINE_TYPE_WITH_CODE (LOKDocView, lok_doc_view, GTK_TYPE_DRAWING_AREA, ++ G_ADD_PRIVATE (LOKDocView) ++ G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, lok_doc_view_initable_iface_init)); + #ifdef __GNUC__ + #pragma GCC diagnostic pop + #endif +@@ -1103,14 +1107,30 @@ static void lok_doc_view_finalize (GObject* object) + G_OBJECT_CLASS (lok_doc_view_parent_class)->finalize (object); + } + +-static void lok_doc_view_constructed (GObject* object) ++static gboolean lok_doc_view_initable_init (GInitable *initable, GCancellable* /*cancellable*/, GError **error) + { +- LOKDocView* pDocView = LOK_DOC_VIEW (object); +- LOKDocViewPrivate* priv = pDocView->priv; ++ LOKDocView *pDocView = LOK_DOC_VIEW (initable); ++ ++ if (pDocView->priv->m_pOffice != NULL) ++ return TRUE; ++ ++ pDocView->priv->m_pOffice = lok_init (pDocView->priv->m_aLOPath); ++ ++ if (pDocView->priv->m_pOffice == NULL) ++ { ++ g_set_error (error, ++ g_quark_from_static_string ("LOK initialization error"), 0, ++ "Failed to get LibreOfficeKit context. Make sure path (%s) is correct", ++ pDocView->priv->m_aLOPath); ++ return FALSE; ++ } + +- G_OBJECT_CLASS (lok_doc_view_parent_class)->constructed (object); ++ return TRUE; ++} + +- pDocView->priv->m_pOffice = lok_init (priv->m_aLOPath); ++static void lok_doc_view_initable_iface_init (GInitableIface *iface) ++{ ++ iface->init = lok_doc_view_initable_init; + } + + static void lok_doc_view_class_init (LOKDocViewClass* pClass) +@@ -1121,7 +1141,6 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + pGObjectClass->get_property = lok_doc_view_get_property; + pGObjectClass->set_property = lok_doc_view_set_property; + pGObjectClass->finalize = lok_doc_view_finalize; +- pGObjectClass->constructed = lok_doc_view_constructed; + + pWidgetClass->draw = lok_doc_view_draw; + pWidgetClass->button_press_event = lok_doc_view_signal_button; +@@ -1343,18 +1362,19 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + G_TYPE_STRING); + } + +- +- + /** + * lok_doc_view_new: + * @pPath: LibreOffice install path. ++ * @cancellable: The cancellable object that you can use to cancel this ++ * operation. ++ * @error: The error that will be set if the object fails to initialize. + * +- * Returns: The #LOKDocView widget instance. ++ * Returns: (transfer none): The #LOKDocView widget instance. + */ + SAL_DLLPUBLIC_EXPORT GtkWidget* +-lok_doc_view_new (const char* pPath) ++lok_doc_view_new (const gchar* pPath, GCancellable *cancellable, GError **error) + { +- return GTK_WIDGET (g_object_new(LOK_TYPE_DOC_VIEW, "lopath", pPath, NULL)); ++ return GTK_WIDGET (g_initable_new (LOK_TYPE_DOC_VIEW, cancellable, error, "lopath", pPath, NULL)); + } + + /** +@@ -1365,7 +1385,7 @@ lok_doc_view_new (const char* pPath) + * Returns: %TRUE if the document is loaded succesfully, %FALSE otherwise + */ + SAL_DLLPUBLIC_EXPORT gboolean +-lok_doc_view_open_document (LOKDocView* pDocView, char* pPath) ++lok_doc_view_open_document (LOKDocView* pDocView, const gchar* pPath) + { + if ( pDocView->priv->m_pDocument ) + { +@@ -1374,8 +1394,7 @@ lok_doc_view_open_document (LOKDocView* pDocView, char* pPath) + } + + pDocView->priv->m_pOffice->pClass->registerCallback(pDocView->priv->m_pOffice, globalCallbackWorker, pDocView); +- pDocView->priv->m_pDocument = pDocView->priv->m_pOffice->pClass->documentLoad( pDocView->priv->m_pOffice, +- pPath ); ++ pDocView->priv->m_pDocument = pDocView->priv->m_pOffice->pClass->documentLoad( pDocView->priv->m_pOffice, pPath ); + if ( !pDocView->priv->m_pDocument ) + { + // FIXME: should have a GError parameter and populate it. +-- +2.12.0 + diff --git a/SOURCES/0056-lokdocview-Use-get_instance_private-to-get-private-s.patch b/SOURCES/0056-lokdocview-Use-get_instance_private-to-get-private-s.patch new file mode 100644 index 0000000..30870cd --- /dev/null +++ b/SOURCES/0056-lokdocview-Use-get_instance_private-to-get-private-s.patch @@ -0,0 +1,400 @@ +From c4715537a91d397e73721b2c63ac4c51e21415a4 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Fri, 19 Jun 2015 01:06:50 +0530 +Subject: [PATCH 056/398] lokdocview: Use *get_instance_private () to get + private structure + +Let lok_doc_view_get_instance_private () do the pointer +arithmatic. Additionally, we are saving sizeof (void*) already in +the _LOKDocView struct with this approach. + +Change-Id: I6d991d5834ef15dad24acb14a1d4bbf7d03df762 +(cherry picked from commit cf14391bc25e977bf70870004d8df79926a99e0c) +--- + include/LibreOfficeKit/LibreOfficeKitGtk.h | 1 - + libreofficekit/source/gtk/lokdocview.cxx | 129 ++++++++++++++++------------- + 2 files changed, 73 insertions(+), 57 deletions(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h +index 3eaf28352a11..3a1628b60e86 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h ++++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h +@@ -32,7 +32,6 @@ typedef struct _LOKDocViewPrivate LOKDocViewPrivate; + struct _LOKDocView + { + GtkDrawingArea aDrawingArea; +- LOKDocViewPrivate* priv; + }; + + struct _LOKDocViewClass +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 144f17efba94..916c9f7cf60c 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -229,7 +229,7 @@ isEmptyRectangle(const GdkRectangle& rRectangle) + static void + signalKey (LOKDocView* pDocView, const GdkEvent* pEvent) + { +- LOKDocViewPrivate* priv = pDocView->priv; ++ LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private (pDocView)); + int nCharCode = 0; + int nKeyCode = 0; + guint keyval; +@@ -292,7 +292,7 @@ static gboolean + handleTimeout (gpointer pData) + { + LOKDocView* pDocView = LOK_DOC_VIEW (pData); +- LOKDocViewPrivate* priv = pDocView->priv; ++ LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private (pDocView)); + + if (priv->m_bEdit) + { +@@ -366,7 +366,7 @@ globalCallbackWorker(int nType, const char* pPayload, void* pData) + static GdkRectangle + payloadToRectangle (LOKDocView* pDocView, const char* pPayload) + { +- LOKDocViewPrivate* priv = pDocView->priv; ++ LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private (pDocView)); + GdkRectangle aRet; + gchar** ppCoordinates = g_strsplit(pPayload, ", ", 4); + gchar** ppCoordinate = ppCoordinates; +@@ -418,7 +418,7 @@ payloadToRectangles(LOKDocView* pDocView, const char* pPayload) + static void + setTilesInvalid (LOKDocView* pDocView, const GdkRectangle& rRectangle) + { +- LOKDocViewPrivate* priv = pDocView->priv; ++ LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private (pDocView)); + GdkRectangle aRectanglePixels; + GdkPoint aStart, aEnd; + +@@ -442,7 +442,7 @@ callback (gpointer pData) + { + CallbackData* pCallback = static_cast(pData); + LOKDocView* pDocView = LOK_DOC_VIEW (pCallback->m_pDocView); +- LOKDocViewPrivate* priv = pDocView->priv; ++ LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private (pDocView)); + + switch (pCallback->m_nType) + { +@@ -560,7 +560,7 @@ renderHandle(LOKDocView* pDocView, + cairo_surface_t* pHandle, + GdkRectangle& rRectangle) + { +- LOKDocViewPrivate* priv = pDocView->priv; ++ LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private (pDocView)); + GdkPoint aCursorBottom; + int nHandleWidth, nHandleHeight; + double fHandleScale; +@@ -593,7 +593,7 @@ renderGraphicHandle(LOKDocView* pDocView, + const GdkRectangle& rSelection, + cairo_surface_t* pHandle) + { +- LOKDocViewPrivate* priv = pDocView->priv; ++ LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private (pDocView)); + int nHandleWidth, nHandleHeight; + GdkRectangle aSelection; + +@@ -660,7 +660,7 @@ renderGraphicHandle(LOKDocView* pDocView, + static gboolean + renderDocument(LOKDocView* pDocView, cairo_t* pCairo) + { +- LOKDocViewPrivate *priv = pDocView->priv; ++ LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); + GdkRectangle aVisibleArea; + long nDocumentWidthPixels = twipToPixel(priv->m_nDocumentWidthTwips, priv->m_fZoom); + long nDocumentHeightPixels = twipToPixel(priv->m_nDocumentHeightTwips, priv->m_fZoom); +@@ -721,7 +721,7 @@ renderDocument(LOKDocView* pDocView, cairo_t* pCairo) + static gboolean + renderOverlay(LOKDocView* pDocView, cairo_t* pCairo) + { +- LOKDocViewPrivate *priv = pDocView->priv; ++ LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); + + if (priv->m_bEdit && priv->m_bCursorVisible && priv->m_bCursorOverlayVisible && !isEmptyRectangle(priv->m_aVisibleCursor)) + { +@@ -799,7 +799,7 @@ static gboolean + lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + { + LOKDocView* pDocView = LOK_DOC_VIEW (pWidget); +- LOKDocViewPrivate *priv = pDocView->priv; ++ LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); + + g_info("LOKDocView_Impl::signalButton: %d, %d (in twips: %d, %d)", + (int)pEvent->x, (int)pEvent->y, +@@ -942,7 +942,7 @@ static gboolean + lok_doc_view_signal_motion (GtkWidget* pWidget, GdkEventMotion* pEvent) + { + LOKDocView* pDocView = LOK_DOC_VIEW (pWidget); +- LOKDocViewPrivate *priv = pDocView->priv; ++ LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); + GdkPoint aPoint; + + if (priv->m_bInDragMiddleHandle) +@@ -1001,8 +1001,8 @@ lok_doc_view_signal_motion (GtkWidget* pWidget, GdkEventMotion* pEvent) + + static void lok_doc_view_init (LOKDocView* pDocView) + { +- pDocView->priv = static_cast(lok_doc_view_get_instance_private (pDocView)); +- pDocView->priv->m_bCursorVisible = true; ++ LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ priv->m_bCursorVisible = true; + + gtk_widget_add_events(GTK_WIDGET(pDocView), + GDK_BUTTON_PRESS_MASK +@@ -1015,7 +1015,7 @@ static void lok_doc_view_init (LOKDocView* pDocView) + static void lok_doc_view_set_property (GObject* object, guint propId, const GValue *value, GParamSpec *pspec) + { + LOKDocView* pDocView = LOK_DOC_VIEW (object); +- LOKDocViewPrivate* priv = pDocView->priv; ++ LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private (pDocView)); + + switch (propId) + { +@@ -1045,7 +1045,7 @@ static void lok_doc_view_set_property (GObject* object, guint propId, const GVal + static void lok_doc_view_get_property (GObject* object, guint propId, GValue *value, GParamSpec *pspec) + { + LOKDocView* pDocView = LOK_DOC_VIEW (object); +- LOKDocViewPrivate* priv = pDocView->priv; ++ LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private (pDocView)); + + switch (propId) + { +@@ -1097,7 +1097,7 @@ static gboolean lok_doc_view_draw (GtkWidget* pWidget, cairo_t* pCairo) + static void lok_doc_view_finalize (GObject* object) + { + LOKDocView* pDocView = LOK_DOC_VIEW (object); +- LOKDocViewPrivate* priv = pDocView->priv; ++ LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private (pDocView)); + + if (priv->m_pDocument) + priv->m_pDocument->pClass->destroy (priv->m_pDocument); +@@ -1110,18 +1110,19 @@ static void lok_doc_view_finalize (GObject* object) + static gboolean lok_doc_view_initable_init (GInitable *initable, GCancellable* /*cancellable*/, GError **error) + { + LOKDocView *pDocView = LOK_DOC_VIEW (initable); ++ LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private (pDocView)); + +- if (pDocView->priv->m_pOffice != NULL) ++ if (priv->m_pOffice != NULL) + return TRUE; + +- pDocView->priv->m_pOffice = lok_init (pDocView->priv->m_aLOPath); ++ priv->m_pOffice = lok_init (priv->m_aLOPath); + +- if (pDocView->priv->m_pOffice == NULL) ++ if (priv->m_pOffice == NULL) + { + g_set_error (error, + g_quark_from_static_string ("LOK initialization error"), 0, + "Failed to get LibreOfficeKit context. Make sure path (%s) is correct", +- pDocView->priv->m_aLOPath); ++ priv->m_aLOPath); + return FALSE; + } + +@@ -1387,39 +1388,41 @@ lok_doc_view_new (const gchar* pPath, GCancellable *cancellable, GError **error) + SAL_DLLPUBLIC_EXPORT gboolean + lok_doc_view_open_document (LOKDocView* pDocView, const gchar* pPath) + { +- if ( pDocView->priv->m_pDocument ) ++ LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ ++ if ( priv->m_pDocument ) + { +- pDocView->priv->m_pDocument->pClass->destroy( pDocView->priv->m_pDocument ); +- pDocView->priv->m_pDocument = 0; ++ priv->m_pDocument->pClass->destroy( priv->m_pDocument ); ++ priv->m_pDocument = 0; + } + +- pDocView->priv->m_pOffice->pClass->registerCallback(pDocView->priv->m_pOffice, globalCallbackWorker, pDocView); +- pDocView->priv->m_pDocument = pDocView->priv->m_pOffice->pClass->documentLoad( pDocView->priv->m_pOffice, pPath ); +- if ( !pDocView->priv->m_pDocument ) ++ priv->m_pOffice->pClass->registerCallback(priv->m_pOffice, globalCallbackWorker, pDocView); ++ priv->m_pDocument = priv->m_pOffice->pClass->documentLoad( priv->m_pOffice, pPath ); ++ if ( !priv->m_pDocument ) + { + // FIXME: should have a GError parameter and populate it. +- char *pError = pDocView->priv->m_pOffice->pClass->getError( pDocView->priv->m_pOffice ); ++ char *pError = priv->m_pOffice->pClass->getError( priv->m_pOffice ); + fprintf( stderr, "Error opening document '%s'\n", pError ); + return FALSE; + } + else + { +- pDocView->priv->m_pDocument->pClass->initializeForRendering(pDocView->priv->m_pDocument); +- pDocView->priv->m_pDocument->pClass->registerCallback(pDocView->priv->m_pDocument, callbackWorker, pDocView); +- pDocView->priv->m_pDocument->pClass->getDocumentSize(pDocView->priv->m_pDocument, &pDocView->priv->m_nDocumentWidthTwips, &pDocView->priv->m_nDocumentHeightTwips); ++ priv->m_pDocument->pClass->initializeForRendering(priv->m_pDocument); ++ priv->m_pDocument->pClass->registerCallback(priv->m_pDocument, callbackWorker, pDocView); ++ priv->m_pDocument->pClass->getDocumentSize(priv->m_pDocument, &priv->m_nDocumentWidthTwips, &priv->m_nDocumentHeightTwips); + g_timeout_add(600, handleTimeout, pDocView); + +- float zoom = pDocView->priv->m_fZoom; +- long nDocumentWidthTwips = pDocView->priv->m_nDocumentWidthTwips; +- long nDocumentHeightTwips = pDocView->priv->m_nDocumentHeightTwips; ++ float zoom = priv->m_fZoom; ++ long nDocumentWidthTwips = priv->m_nDocumentWidthTwips; ++ long nDocumentHeightTwips = priv->m_nDocumentHeightTwips; + long nDocumentWidthPixels = twipToPixel(nDocumentWidthTwips, zoom); + long nDocumentHeightPixels = twipToPixel(nDocumentHeightTwips, zoom); + // Total number of columns in this document. + guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); + + +- pDocView->priv->m_aTileBuffer = TileBuffer(pDocView->priv->m_pDocument, +- nColumns); ++ priv->m_aTileBuffer = TileBuffer(priv->m_pDocument, ++ nColumns); + gtk_widget_set_size_request(GTK_WIDGET(pDocView), + nDocumentWidthPixels, + nDocumentHeightPixels); +@@ -1436,7 +1439,8 @@ lok_doc_view_open_document (LOKDocView* pDocView, const gchar* pPath) + SAL_DLLPUBLIC_EXPORT LibreOfficeKitDocument* + lok_doc_view_get_document (LOKDocView* pDocView) + { +- return pDocView->priv->m_pDocument; ++ LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ return priv->m_pDocument; + } + + /** +@@ -1449,14 +1453,16 @@ lok_doc_view_get_document (LOKDocView* pDocView) + SAL_DLLPUBLIC_EXPORT void + lok_doc_view_set_zoom (LOKDocView* pDocView, float fZoom) + { +- pDocView->priv->m_fZoom = fZoom; +- long nDocumentWidthPixels = twipToPixel(pDocView->priv->m_nDocumentWidthTwips, fZoom); +- long nDocumentHeightPixels = twipToPixel(pDocView->priv->m_nDocumentHeightTwips, fZoom); ++ LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ ++ priv->m_fZoom = fZoom; ++ long nDocumentWidthPixels = twipToPixel(priv->m_nDocumentWidthTwips, fZoom); ++ long nDocumentHeightPixels = twipToPixel(priv->m_nDocumentHeightTwips, fZoom); + // Total number of columns in this document. + guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); + +- pDocView->priv->m_aTileBuffer = TileBuffer(pDocView->priv->m_pDocument, +- nColumns); ++ priv->m_aTileBuffer = TileBuffer(priv->m_pDocument, ++ nColumns); + gtk_widget_set_size_request(GTK_WIDGET(pDocView), + nDocumentWidthPixels, + nDocumentHeightPixels); +@@ -1471,38 +1477,44 @@ lok_doc_view_set_zoom (LOKDocView* pDocView, float fZoom) + SAL_DLLPUBLIC_EXPORT float + lok_doc_view_get_zoom (LOKDocView* pDocView) + { +- return pDocView->priv->m_fZoom; ++ LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ return priv->m_fZoom; + } + + SAL_DLLPUBLIC_EXPORT int + lok_doc_view_get_parts (LOKDocView* pDocView) + { +- return pDocView->priv->m_pDocument->pClass->getParts( pDocView->priv->m_pDocument ); ++ LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ return priv->m_pDocument->pClass->getParts( priv->m_pDocument ); + } + + SAL_DLLPUBLIC_EXPORT int + lok_doc_view_get_part (LOKDocView* pDocView) + { +- return pDocView->priv->m_pDocument->pClass->getPart( pDocView->priv->m_pDocument ); ++ LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ return priv->m_pDocument->pClass->getPart( priv->m_pDocument ); + } + + SAL_DLLPUBLIC_EXPORT void + lok_doc_view_set_part (LOKDocView* pDocView, int nPart) + { +- pDocView->priv->m_pDocument->pClass->setPart( pDocView->priv->m_pDocument, nPart ); ++ LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ priv->m_pDocument->pClass->setPart( priv->m_pDocument, nPart ); + } + + SAL_DLLPUBLIC_EXPORT char* + lok_doc_view_get_part_name (LOKDocView* pDocView, int nPart) + { +- return pDocView->priv->m_pDocument->pClass->getPartName( pDocView->priv->m_pDocument, nPart ); ++ LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ return priv->m_pDocument->pClass->getPartName( priv->m_pDocument, nPart ); + } + + SAL_DLLPUBLIC_EXPORT void + lok_doc_view_set_partmode(LOKDocView* pDocView, + int nPartMode) + { +- pDocView->priv->m_pDocument->pClass->setPartMode( pDocView->priv->m_pDocument, nPartMode ); ++ LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ priv->m_pDocument->pClass->setPartMode( priv->m_pDocument, nPartMode ); + } + + /** +@@ -1516,16 +1528,17 @@ SAL_DLLPUBLIC_EXPORT void + lok_doc_view_set_edit(LOKDocView* pDocView, + gboolean bEdit) + { +- gboolean bWasEdit = pDocView->priv->m_bEdit; ++ LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ gboolean bWasEdit = priv->m_bEdit; + +- if (!pDocView->priv->m_bEdit && bEdit) ++ if (!priv->m_bEdit && bEdit) + g_info("lok_doc_view_set_edit: entering edit mode"); +- else if (pDocView->priv->m_bEdit && !bEdit) ++ else if (priv->m_bEdit && !bEdit) + { + g_info("lok_doc_view_set_edit: leaving edit mode"); +- pDocView->priv->m_pDocument->pClass->resetSelection(pDocView->priv->m_pDocument); ++ priv->m_pDocument->pClass->resetSelection(priv->m_pDocument); + } +- pDocView->priv->m_bEdit = bEdit; ++ priv->m_bEdit = bEdit; + g_signal_emit(pDocView, doc_view_signals[EDIT_CHANGED], 0, bWasEdit); + gtk_widget_queue_draw(GTK_WIDGET(pDocView)); + } +@@ -1539,7 +1552,8 @@ lok_doc_view_set_edit(LOKDocView* pDocView, + SAL_DLLPUBLIC_EXPORT gboolean + lok_doc_view_get_edit (LOKDocView* pDocView) + { +- return pDocView->priv->m_bEdit; ++ LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ return priv->m_bEdit; + } + + /** +@@ -1555,7 +1569,8 @@ lok_doc_view_post_command (LOKDocView* pDocView, + const char* pCommand, + const char* pArguments) + { +- pDocView->priv->m_pDocument->pClass->postUnoCommand(pDocView->priv->m_pDocument, pCommand, pArguments); ++ LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ priv->m_pDocument->pClass->postUnoCommand(priv->m_pDocument, pCommand, pArguments); + } + + /** +@@ -1583,7 +1598,8 @@ lok_doc_view_post_key (LOKDocView* pDocView, GdkEvent* pEvent) + SAL_DLLPUBLIC_EXPORT float + lok_doc_view_pixel_to_twip (LOKDocView* pDocView, float fInput) + { +- return pixelToTwip(fInput, pDocView->priv->m_fZoom); ++ LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ return pixelToTwip(fInput, priv->m_fZoom); + } + + /** +@@ -1598,7 +1614,8 @@ lok_doc_view_pixel_to_twip (LOKDocView* pDocView, float fInput) + SAL_DLLPUBLIC_EXPORT float + lok_doc_view_twip_to_pixel (LOKDocView* pDocView, float fInput) + { +- return twipToPixel(fInput, pDocView->priv->m_fZoom); ++ LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ return twipToPixel(fInput, priv->m_fZoom); + } + + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +-- +2.12.0 + diff --git a/SOURCES/0057-lokdocview-fixed-a-signal-name.patch b/SOURCES/0057-lokdocview-fixed-a-signal-name.patch new file mode 100644 index 0000000..94d15f1 --- /dev/null +++ b/SOURCES/0057-lokdocview-fixed-a-signal-name.patch @@ -0,0 +1,27 @@ +From fb96b28af8e78142da959781d17acb508e151ef2 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Mon, 22 Jun 2015 15:27:24 +0530 +Subject: [PATCH 057/398] lokdocview: fixed a signal name + +Change-Id: I645516d43562dfa03c27e2bea366e9a161829bfe +(cherry picked from commit e608a754b0ab14d3c5ec21237d163218d0be3e09) +--- + libreofficekit/source/gtk/lokdocview.cxx | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 916c9f7cf60c..0641197d9781 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -1352,7 +1352,7 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + * @pDocView: the #LOKDocView on which the signal is emitted + * @aHyperlink: the URI which the application should handle + */ +- doc_view_signals[PART_CHANGED] = ++ doc_view_signals[HYPERLINK_CLICKED] = + g_signal_new("hyperlinked-clicked", + G_TYPE_FROM_CLASS(pGObjectClass), + G_SIGNAL_RUN_FIRST, +-- +2.12.0 + diff --git a/SOURCES/0058-cppcheck-noExplicitConstructor.patch b/SOURCES/0058-cppcheck-noExplicitConstructor.patch new file mode 100644 index 0000000..d1dcda7 --- /dev/null +++ b/SOURCES/0058-cppcheck-noExplicitConstructor.patch @@ -0,0 +1,28 @@ +From 933887a5b1c5d9c07d76ab8af16bac317b02d579 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= +Date: Wed, 24 Jun 2015 17:35:37 +0100 +Subject: [PATCH 058/398] cppcheck: noExplicitConstructor + +(cherry picked from commit df5ec49bcaa57aa0a137db45d7c0766733f7e508) + +Change-Id: I80cd2975f17bb7fa57fa669873ef1dd8f3595a11 +--- + desktop/source/lib/init.cxx | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 39a1fbffc533..aa8e27c7f48f 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -239,7 +239,7 @@ struct LibLODocument_Impl : public _LibreOfficeKitDocument + uno::Reference mxComponent; + shared_ptr< LibreOfficeKitDocumentClass > m_pDocumentClass; + +- LibLODocument_Impl(const uno::Reference &xComponent) : ++ explicit LibLODocument_Impl(const uno::Reference &xComponent) : + mxComponent( xComponent ) + { + if (!(m_pDocumentClass = gDocumentClass.lock())) +-- +2.12.0 + diff --git a/SOURCES/0059-lokdocview-Don-t-handle-hyperlink-clicks.patch b/SOURCES/0059-lokdocview-Don-t-handle-hyperlink-clicks.patch new file mode 100644 index 0000000..2c22885 --- /dev/null +++ b/SOURCES/0059-lokdocview-Don-t-handle-hyperlink-clicks.patch @@ -0,0 +1,87 @@ +From c2db3c262f702e62c2f247e62b1b313ecc6e28c5 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Tue, 23 Jun 2015 01:52:44 +0530 +Subject: [PATCH 059/398] lokdocview: Don't handle hyperlink clicks + +Instead emit the signal 'hyperlink-clicked', and let the +application decide how it wants to handle the hyperlink clicks. + +(cherry picked from commit 9d2fa921470152647cc3b54355f70a1365f752ff) + +Change-Id: Ief72bbd16727e140cacf28b852ad43952c02f7ae +--- + libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 14 +++++++++++++- + libreofficekit/source/gtk/lokdocview.cxx | 11 ++++++++--- + 2 files changed, 21 insertions(+), 4 deletions(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index fedd6c9fdf13..61f016dffab8 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -310,7 +310,18 @@ static void signalPart(LOKDocView* /*pLOKDocView*/, int nPart, gpointer /*pData* + g_bPartSelectorBroadcast = true; + } + +-/// User clicked on a cmmand button -> inform LOKDocView. ++/// User clicked on a command button -> inform LOKDocView. ++static void signalHyperlink(LOKDocView* /*pLOKDocView*/, char* pPayload, gpointer /*pData*/) ++{ ++ GError* pError = NULL; ++ gtk_show_uri(NULL, pPayload, GDK_CURRENT_TIME, &pError); ++ if (pError != NULL) ++ { ++ g_warning("Unable to show URI %s : %s", pPayload, pError->message); ++ g_error_free(pError); ++ } ++} ++ + static void toggleToolItem(GtkWidget* pWidget, gpointer /*pData*/) + { + if (g_bToolItemBroadcast) +@@ -527,6 +538,7 @@ int main( int argc, char* argv[] ) + g_signal_connect(pDocView, "command-changed", G_CALLBACK(signalCommand), NULL); + g_signal_connect(pDocView, "search-not-found", G_CALLBACK(signalSearch), NULL); + g_signal_connect(pDocView, "part-changed", G_CALLBACK(signalPart), NULL); ++ g_signal_connect(pDocView, "hyperlink-clicked", G_CALLBACK(signalHyperlink), NULL); + + // Input handling. + g_signal_connect(pWindow, "key-press-event", G_CALLBACK(signalKey), pDocView); +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 0641197d9781..19da4b2da691 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -324,6 +324,12 @@ setPart(LOKDocView* pDocView, const std::string& rString) + g_signal_emit(pDocView, doc_view_signals[PART_CHANGED], 0, std::stoi(rString)); + } + ++static void ++hyperlinkClicked(LOKDocView* pDocView, const std::string& rString) ++{ ++ g_signal_emit(pDocView, doc_view_signals[HYPERLINK_CLICKED], 0, rString.c_str()); ++} ++ + /// Implementation of the global callback handler, invoked by globalCallback(); + static gboolean + globalCallback (gpointer pData) +@@ -507,8 +513,7 @@ callback (gpointer pData) + break; + case LOK_CALLBACK_HYPERLINK_CLICKED: + { +- GError* pError = NULL; +- gtk_show_uri(NULL, pCallback->m_aPayload.c_str(), GDK_CURRENT_TIME, &pError); ++ hyperlinkClicked(pDocView, pCallback->m_aPayload); + } + break; + case LOK_CALLBACK_STATE_CHANGED: +@@ -1353,7 +1358,7 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + * @aHyperlink: the URI which the application should handle + */ + doc_view_signals[HYPERLINK_CLICKED] = +- g_signal_new("hyperlinked-clicked", ++ g_signal_new("hyperlink-clicked", + G_TYPE_FROM_CLASS(pGObjectClass), + G_SIGNAL_RUN_FIRST, + 0, +-- +2.12.0 + diff --git a/SOURCES/0060-lokdocview-Remove-superfluous-_post_key.patch b/SOURCES/0060-lokdocview-Remove-superfluous-_post_key.patch new file mode 100644 index 0000000..5588b8f --- /dev/null +++ b/SOURCES/0060-lokdocview-Remove-superfluous-_post_key.patch @@ -0,0 +1,181 @@ +From 061935437f10f6e35d0b0561a5465f4872a8c909 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Tue, 23 Jun 2015 02:58:38 +0530 +Subject: [PATCH 060/398] lokdocview: Remove superfluous *_post_key() + +Instead directly let LOKDocView handle the input. + +Change-Id: I260a460df23c3e2e5c78d8b363bb864ae5c63dab +(cherry picked from commit da49b8339828c0ee27d999ac4201e0eb12a1a47f) +--- + include/LibreOfficeKit/LibreOfficeKitGtk.h | 4 --- + .../qa/gtktiledviewer/gtktiledviewer.cxx | 22 +++--------- + libreofficekit/source/gtk/lokdocview.cxx | 40 ++++++++-------------- + 3 files changed, 20 insertions(+), 46 deletions(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h +index 3a1628b60e86..962f9d9265bb 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h ++++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h +@@ -74,10 +74,6 @@ void lok_doc_view_post_command (LOKDocView* + const char* pCommand, + const char* pArguments); + +-/// Posts a keyboard event to LibreOfficeKit. +-void lok_doc_view_post_key (LOKDocView* pDocView, +- GdkEvent* pEvent); +- + float lok_doc_view_pixel_to_twip (LOKDocView* pDocView, + float fInput); + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 61f016dffab8..7510ca53a928 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -190,19 +190,6 @@ static void getVisibleAreaTwips(GdkRectangle* pArea) + #endif + } + +- +-/// Handles the key-press-event of the window. +-static gboolean signalKey(GtkWidget* /*pWidget*/, GdkEvent* pEvent, gpointer/* pData*/) +-{ +- LOKDocView* pLOKDocView = LOK_DOC_VIEW(pDocView); +- if (!gtk_widget_get_visible(pFindbar) && bool(lok_doc_view_get_edit(pLOKDocView))) +- { +- lok_doc_view_post_key(pLOKDocView, pEvent); +- return TRUE; +- } +- return FALSE; +-} +- + /// Searches for the next or previous text of pFindbarEntry. + static void doSearch(bool bBackwards) + { +@@ -540,10 +527,6 @@ int main( int argc, char* argv[] ) + g_signal_connect(pDocView, "part-changed", G_CALLBACK(signalPart), NULL); + g_signal_connect(pDocView, "hyperlink-clicked", G_CALLBACK(signalHyperlink), NULL); + +- // Input handling. +- g_signal_connect(pWindow, "key-press-event", G_CALLBACK(signalKey), pDocView); +- g_signal_connect(pWindow, "key-release-event", G_CALLBACK(signalKey), pDocView); +- + // Scrolled window for DocView + pScrolledWindow = gtk_scrolled_window_new(0, 0); + gtk_widget_set_hexpand (pScrolledWindow, TRUE); +@@ -567,6 +550,11 @@ int main( int argc, char* argv[] ) + g_signal_connect(G_OBJECT(pPartModeComboBox), "changed", G_CALLBACK(changePartMode), 0); + g_signal_connect(G_OBJECT(pPartSelector), "changed", G_CALLBACK(changePart), 0); + ++ // Make only LOKDocView widget as focussable ++ GList *focusChain = NULL; ++ focusChain = g_list_append( focusChain, pDocView ); ++ gtk_container_set_focus_chain ( GTK_CONTAINER (pVBox), focusChain ); ++ + gtk_main(); + + return 0; +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 19da4b2da691..368a8d536887 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -226,24 +226,21 @@ isEmptyRectangle(const GdkRectangle& rRectangle) + return rRectangle.x == 0 && rRectangle.y == 0 && rRectangle.width == 0 && rRectangle.height == 0; + } + +-static void +-signalKey (LOKDocView* pDocView, const GdkEvent* pEvent) ++static gboolean ++signalKey (GtkWidget* pWidget, GdkEventKey* pEvent) + { ++ LOKDocView* pDocView = LOK_DOC_VIEW(pWidget); + LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private (pDocView)); + int nCharCode = 0; + int nKeyCode = 0; +- guint keyval; +- GdkModifierType state; +- gdk_event_get_keyval (pEvent, &keyval); +- gdk_event_get_state (pEvent, &state); + + if (!priv->m_bEdit) + { + g_info("signalKey: not in edit mode, ignore"); +- return; ++ return FALSE; + } + +- switch (keyval) ++ switch (pEvent->keyval) + { + case GDK_KEY_BackSpace: + nKeyCode = com::sun::star::awt::Key::BACKSPACE; +@@ -270,22 +267,24 @@ signalKey (LOKDocView* pDocView, const GdkEvent* pEvent) + nKeyCode = com::sun::star::awt::Key::RIGHT; + break; + default: +- if (keyval >= GDK_KEY_F1 && keyval <= GDK_KEY_F26) +- nKeyCode = com::sun::star::awt::Key::F1 + (keyval - GDK_KEY_F1); ++ if (pEvent->keyval >= GDK_KEY_F1 && pEvent->keyval <= GDK_KEY_F26) ++ nKeyCode = com::sun::star::awt::Key::F1 + (pEvent->keyval - GDK_KEY_F1); + else +- nCharCode = gdk_keyval_to_unicode(keyval); ++ nCharCode = gdk_keyval_to_unicode(pEvent->keyval); + } + + // rsc is not public API, but should be good enough for debugging purposes. + // If this is needed for real, then probably a new param of type + // css::awt::KeyModifier is needed in postKeyEvent(). +- if (state & GDK_SHIFT_MASK) ++ if (pEvent->state & GDK_SHIFT_MASK) + nKeyCode |= KEY_SHIFT; + + if (pEvent->type == GDK_KEY_RELEASE) + priv->m_pDocument->pClass->postKeyEvent(priv->m_pDocument, LOK_KEYEVENT_KEYUP, nCharCode, nKeyCode); + else + priv->m_pDocument->pClass->postKeyEvent(priv->m_pDocument, LOK_KEYEVENT_KEYINPUT, nCharCode, nKeyCode); ++ ++ return FALSE; + } + + static gboolean +@@ -1151,6 +1150,8 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + pWidgetClass->draw = lok_doc_view_draw; + pWidgetClass->button_press_event = lok_doc_view_signal_button; + pWidgetClass->button_release_event = lok_doc_view_signal_button; ++ pWidgetClass->key_press_event = signalKey; ++ pWidgetClass->key_release_event = signalKey; + pWidgetClass->motion_notify_event = lok_doc_view_signal_motion; + + /** +@@ -1431,6 +1432,8 @@ lok_doc_view_open_document (LOKDocView* pDocView, const gchar* pPath) + gtk_widget_set_size_request(GTK_WIDGET(pDocView), + nDocumentWidthPixels, + nDocumentHeightPixels); ++ gtk_widget_set_can_focus(GTK_WIDGET(pDocView), TRUE); ++ gtk_widget_grab_focus(GTK_WIDGET(pDocView)); + } + return TRUE; + } +@@ -1579,19 +1582,6 @@ lok_doc_view_post_command (LOKDocView* pDocView, + } + + /** +- * lok_doc_view_post_key: +- * @pDocView: the #LOKDocView instance +- * @pEvent: the #GdkEventKey containing information about the event +- * +- * This methods forwards your key events to the LO core. +-*/ +-SAL_DLLPUBLIC_EXPORT void +-lok_doc_view_post_key (LOKDocView* pDocView, GdkEvent* pEvent) +-{ +- signalKey(pDocView, pEvent); +-} +- +-/** + * lok_doc_view_pixel_to_twip: + * @pDocView: The #LOKDocView instance + * @fInput: The value in pixels to convert to twips +-- +2.12.0 + diff --git a/SOURCES/0061-tilebuffer-Add-timer-to-measure-paintTile-call.patch b/SOURCES/0061-tilebuffer-Add-timer-to-measure-paintTile-call.patch new file mode 100644 index 0000000..f870060 --- /dev/null +++ b/SOURCES/0061-tilebuffer-Add-timer-to-measure-paintTile-call.patch @@ -0,0 +1,37 @@ +From 46584ff3db62f69d7f93a2ddb90f444419f49e3e Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Tue, 23 Jun 2015 14:37:09 +0530 +Subject: [PATCH 061/398] tilebuffer: Add timer to measure paintTile() call + +Change-Id: I2645863c7445e17d77e2c4e2dc24e22f8685034e +(cherry picked from commit 580c70883ca8c9bc73ea42cb05983b9df57f55ff) +--- + libreofficekit/source/gtk/tilebuffer.cxx | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/libreofficekit/source/gtk/tilebuffer.cxx b/libreofficekit/source/gtk/tilebuffer.cxx +index 3f22f983d2ab..60aa16f6c50a 100644 +--- a/libreofficekit/source/gtk/tilebuffer.cxx ++++ b/libreofficekit/source/gtk/tilebuffer.cxx +@@ -91,7 +91,7 @@ Tile& TileBuffer::getTile(int x, int y, float aZoom) + aTileRectangle.x = pixelToTwip(nTileSizePixels, aZoom) * y; + aTileRectangle.y = pixelToTwip(nTileSizePixels, aZoom) * x; + +- g_info ("Rendering (%d, %d)", x, y); ++ g_test_timer_start(); + m_pLOKDocument->pClass->paintTile(m_pLOKDocument, + pBuffer, + nTileSizePixels, nTileSizePixels, +@@ -99,6 +99,9 @@ Tile& TileBuffer::getTile(int x, int y, float aZoom) + pixelToTwip(nTileSizePixels, aZoom), + pixelToTwip(nTileSizePixels, aZoom)); + ++ double elapsedTime = g_test_timer_elapsed(); ++ g_info ("Rendered (%d, %d) in %f seconds", x, y, elapsedTime); ++ + //create a mapping for it + m_mTiles[index].setPixbuf(pPixBuf); + m_mTiles[index].valid = true; +-- +2.12.0 + diff --git a/SOURCES/0062-lokdocview-Handle-DELETE-key.patch b/SOURCES/0062-lokdocview-Handle-DELETE-key.patch new file mode 100644 index 0000000..2262654 --- /dev/null +++ b/SOURCES/0062-lokdocview-Handle-DELETE-key.patch @@ -0,0 +1,28 @@ +From 133c38f06f1e1b60a553e5c48a9834d0a52450ee Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Wed, 24 Jun 2015 02:02:39 +0530 +Subject: [PATCH 062/398] lokdocview: Handle DELETE key + +Change-Id: I58d0c36decf81c812c108458b449402416ebcc2d +(cherry picked from commit e2c73bf76a35ee8ce18e4499587de849c92eef1c) +--- + libreofficekit/source/gtk/lokdocview.cxx | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 368a8d536887..2c7bb7be4867 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -245,6 +245,9 @@ signalKey (GtkWidget* pWidget, GdkEventKey* pEvent) + case GDK_KEY_BackSpace: + nKeyCode = com::sun::star::awt::Key::BACKSPACE; + break; ++ case GDK_KEY_Delete: ++ nKeyCode = com::sun::star::awt::Key::DELETE; ++ break; + case GDK_KEY_Return: + nKeyCode = com::sun::star::awt::Key::RETURN; + break; +-- +2.12.0 + diff --git a/SOURCES/0063-gtktiledviewer-Don-t-continue-on-widget-init-failure.patch b/SOURCES/0063-gtktiledviewer-Don-t-continue-on-widget-init-failure.patch new file mode 100644 index 0000000..759e09a --- /dev/null +++ b/SOURCES/0063-gtktiledviewer-Don-t-continue-on-widget-init-failure.patch @@ -0,0 +1,29 @@ +From 2b0fe3b8c3f7d6de3fe2ca63f0d595d5891d36a4 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Mon, 29 Jun 2015 13:34:24 +0530 +Subject: [PATCH 063/398] gtktiledviewer: Don't continue on widget init failure + +Change-Id: I5916357903fad5878d29bc31f21af45816a45ec5 +(cherry picked from commit a482d3289fa7e3789a306970ea76d074527c3579) +--- + libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 7510ca53a928..131fb5bb2d33 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -519,8 +519,8 @@ int main( int argc, char* argv[] ) + + // Docview + pDocView = lok_doc_view_new (argv[1], NULL, NULL); +- if (pDocView == NULL) +- g_error ("Error while creating LOKDocView widget"); ++ g_assert_nonnull(pDocView); ++ + g_signal_connect(pDocView, "edit-changed", G_CALLBACK(signalEdit), NULL); + g_signal_connect(pDocView, "command-changed", G_CALLBACK(signalCommand), NULL); + g_signal_connect(pDocView, "search-not-found", G_CALLBACK(signalSearch), NULL); +-- +2.12.0 + diff --git a/SOURCES/0064-g_assert_nonnull-was-not-declared.patch b/SOURCES/0064-g_assert_nonnull-was-not-declared.patch new file mode 100644 index 0000000..99746ab --- /dev/null +++ b/SOURCES/0064-g_assert_nonnull-was-not-declared.patch @@ -0,0 +1,28 @@ +From 6069cb43c79b715f557e6c64cc0091633292d382 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= +Date: Mon, 29 Jun 2015 13:31:56 +0100 +Subject: [PATCH 064/398] g_assert_nonnull was not declared + +Change-Id: Ie98c37d4bdaa365ac27e8620fb5bbecbb0faccdf +(cherry picked from commit 48abc97220bd95841225cf4e18cd067ef470929a) +--- + libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 131fb5bb2d33..d40cceb291ed 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -519,7 +519,9 @@ int main( int argc, char* argv[] ) + + // Docview + pDocView = lok_doc_view_new (argv[1], NULL, NULL); ++#if GLIB_CHECK_VERSION(2,40,0) + g_assert_nonnull(pDocView); ++#endif + + g_signal_connect(pDocView, "edit-changed", G_CALLBACK(signalEdit), NULL); + g_signal_connect(pDocView, "command-changed", G_CALLBACK(signalCommand), NULL); +-- +2.12.0 + diff --git a/SOURCES/0065-LOK-Don-t-try-to-absolutize-URL-s.patch b/SOURCES/0065-LOK-Don-t-try-to-absolutize-URL-s.patch new file mode 100644 index 0000000..99e1e86 --- /dev/null +++ b/SOURCES/0065-LOK-Don-t-try-to-absolutize-URL-s.patch @@ -0,0 +1,80 @@ +From 68f3bc4d183e56e09975c3e41aceaeba95ddac46 Mon Sep 17 00:00:00 2001 +From: Jan Holesovsky +Date: Fri, 3 Jul 2015 18:14:31 +0200 +Subject: [PATCH 065/398] LOK: Don't try to absolutize URL's. + +Based on a patch by Henry Castro. + +(cherry picked from commit e83cb37cf7546e8bc46d0d49b487dcd352b67093) + +Change-Id: Ia7aca20feb8f6095adf7dfe510ed78b1e9882740 +--- + desktop/source/lib/init.cxx | 34 +++++++++------------------------- + 1 file changed, 9 insertions(+), 25 deletions(-) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index aa8e27c7f48f..c08f1eec85de 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -166,23 +166,19 @@ static OUString getUString(const char* pString) + static OUString getAbsoluteURL(const char* pURL) + { + OUString aURL(getUString(pURL)); +- if (aURL.isEmpty()) ++ ++ // return unchanged if it likely is an URL already ++ if (aURL.indexOf("://") > 0) + return aURL; + +- // convert relative paths to absolute ones +- OUString aWorkingDir; +- osl_getProcessWorkingDir(&aWorkingDir.pData); +- if (!aWorkingDir.endsWith("/")) +- aWorkingDir += "/"; ++ OUString sAbsoluteDocUrl, sWorkingDir, sDocPathUrl; + +- try { +- return rtl::Uri::convertRelToAbs(aWorkingDir, aURL); +- } +- catch (const rtl::MalformedUriException &) +- { +- } ++ // convert relative paths to absolute ones ++ osl_getProcessWorkingDir(&sWorkingDir.pData); ++ osl::FileBase::getFileURLFromSystemPath( aURL, sDocPathUrl ); ++ osl::FileBase::getAbsoluteFileURL(sWorkingDir, sDocPathUrl, sAbsoluteDocUrl); + +- return OUString(); ++ return sAbsoluteDocUrl; + } + + extern "C" +@@ -354,12 +350,6 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions(LibreOfficeKit* pThis, + SolarMutexGuard aGuard; + + OUString aURL(getAbsoluteURL(pURL)); +- if (aURL.isEmpty()) +- { +- pLib->maLastExceptionMsg = "Filename to load was not provided."; +- SAL_INFO("lok", "URL for load is empty"); +- return NULL; +- } + + pLib->maLastExceptionMsg.clear(); + +@@ -426,12 +416,6 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha + + OUString sFormat = getUString(pFormat); + OUString aURL(getAbsoluteURL(sUrl)); +- if (aURL.isEmpty()) +- { +- gImpl->maLastExceptionMsg = "Filename to save to was not provided."; +- SAL_INFO("lok", "URL for save is empty"); +- return false; +- } + + try + { +-- +2.12.0 + diff --git a/SOURCES/0066-LOK-Cleanup-absolutizing-of-URLs.patch b/SOURCES/0066-LOK-Cleanup-absolutizing-of-URLs.patch new file mode 100644 index 0000000..067894b --- /dev/null +++ b/SOURCES/0066-LOK-Cleanup-absolutizing-of-URLs.patch @@ -0,0 +1,77 @@ +From 203eaebd472da9d8c83493331af698b2f9811b55 Mon Sep 17 00:00:00 2001 +From: Jan Holesovsky +Date: Mon, 6 Jul 2015 15:16:56 +0200 +Subject: [PATCH 066/398] LOK: Cleanup absolutizing of URLs. + +Thanks to Stephan Bergmann. + +Change-Id: I22aa3bb827db28bce3eabebb9b8c514663fad860 +(cherry picked from commit b183507ee293d8bcafa9c1c5b2844b7a83fea17b) +--- + desktop/source/lib/init.cxx | 32 +++++++++++++++++++++++--------- + 1 file changed, 23 insertions(+), 9 deletions(-) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index c08f1eec85de..63fe90b585b2 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -166,19 +166,21 @@ static OUString getUString(const char* pString) + static OUString getAbsoluteURL(const char* pURL) + { + OUString aURL(getUString(pURL)); +- +- // return unchanged if it likely is an URL already +- if (aURL.indexOf("://") > 0) ++ if (aURL.isEmpty()) + return aURL; + +- OUString sAbsoluteDocUrl, sWorkingDir, sDocPathUrl; +- + // convert relative paths to absolute ones +- osl_getProcessWorkingDir(&sWorkingDir.pData); +- osl::FileBase::getFileURLFromSystemPath( aURL, sDocPathUrl ); +- osl::FileBase::getAbsoluteFileURL(sWorkingDir, sDocPathUrl, sAbsoluteDocUrl); ++ OUString aWorkingDir; ++ osl_getProcessWorkingDir(&aWorkingDir.pData); ++ ++ try { ++ return rtl::Uri::convertRelToAbs(aWorkingDir + "/", aURL); ++ } ++ catch (const rtl::MalformedUriException &) ++ { ++ } + +- return sAbsoluteDocUrl; ++ return OUString(); + } + + extern "C" +@@ -350,6 +352,12 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions(LibreOfficeKit* pThis, + SolarMutexGuard aGuard; + + OUString aURL(getAbsoluteURL(pURL)); ++ if (aURL.isEmpty()) ++ { ++ pLib->maLastExceptionMsg = "Filename to load was not provided."; ++ SAL_INFO("lok", "URL for load is empty"); ++ return NULL; ++ } + + pLib->maLastExceptionMsg.clear(); + +@@ -416,6 +424,12 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha + + OUString sFormat = getUString(pFormat); + OUString aURL(getAbsoluteURL(sUrl)); ++ if (aURL.isEmpty()) ++ { ++ gImpl->maLastExceptionMsg = "Filename to save to was not provided."; ++ SAL_INFO("lok", "URL for save is empty"); ++ return false; ++ } + + try + { +-- +2.12.0 + diff --git a/SOURCES/0067-LOK-Corner-case-with-working-dir-as.patch b/SOURCES/0067-LOK-Corner-case-with-working-dir-as.patch new file mode 100644 index 0000000..97d903a --- /dev/null +++ b/SOURCES/0067-LOK-Corner-case-with-working-dir-as.patch @@ -0,0 +1,31 @@ +From 423505af348586c46792d2d89c05b8cb9e021928 Mon Sep 17 00:00:00 2001 +From: Jan Holesovsky +Date: Tue, 7 Jul 2015 08:40:28 +0200 +Subject: [PATCH 067/398] LOK: Corner case with working dir as '/'. + +Change-Id: I3965966f0d3fe65389e8834d67452ac56f9df2d6 +(cherry picked from commit c4e74d50901eeaf979be4707815c1d3490b543ea) +--- + desktop/source/lib/init.cxx | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 63fe90b585b2..aa8e27c7f48f 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -172,9 +172,11 @@ static OUString getAbsoluteURL(const char* pURL) + // convert relative paths to absolute ones + OUString aWorkingDir; + osl_getProcessWorkingDir(&aWorkingDir.pData); ++ if (!aWorkingDir.endsWith("/")) ++ aWorkingDir += "/"; + + try { +- return rtl::Uri::convertRelToAbs(aWorkingDir + "/", aURL); ++ return rtl::Uri::convertRelToAbs(aWorkingDir, aURL); + } + catch (const rtl::MalformedUriException &) + { +-- +2.12.0 + diff --git a/SOURCES/0068-lokdocview-Grab-focus-on-mouse-button-press-event.patch b/SOURCES/0068-lokdocview-Grab-focus-on-mouse-button-press-event.patch new file mode 100644 index 0000000..88a315f --- /dev/null +++ b/SOURCES/0068-lokdocview-Grab-focus-on-mouse-button-press-event.patch @@ -0,0 +1,26 @@ +From 9a0f632a8a5d76f8f685068738344cc1d7932805 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Thu, 2 Jul 2015 23:47:33 +0530 +Subject: [PATCH 068/398] lokdocview: Grab focus on mouse 'button-press-event' + +Change-Id: I65187bbd2cc32d9278d8b3890a82b5555390858a +(cherry picked from commit a625cd702700ae1773966a3133d27027d1c4d083) +--- + libreofficekit/source/gtk/lokdocview.cxx | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 2c7bb7be4867..5de795a1a961 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -812,6 +812,7 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + (int)pEvent->x, (int)pEvent->y, + (int)pixelToTwip(pEvent->x, priv->m_fZoom), + (int)pixelToTwip(pEvent->y, priv->m_fZoom)); ++ gtk_widget_grab_focus(GTK_WIDGET(pDocView)); + + if (pEvent->type == GDK_BUTTON_RELEASE) + { +-- +2.12.0 + diff --git a/SOURCES/0069-vcl-ITiledRenderable-getTextSelection-can-be-pure-vi.patch b/SOURCES/0069-vcl-ITiledRenderable-getTextSelection-can-be-pure-vi.patch new file mode 100644 index 0000000..bc0b01e --- /dev/null +++ b/SOURCES/0069-vcl-ITiledRenderable-getTextSelection-can-be-pure-vi.patch @@ -0,0 +1,31 @@ +From 30f6cbde85e6d5a0d522a6da19bea4f96396aeba Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 10 Jul 2015 09:11:20 +0200 +Subject: [PATCH 069/398] vcl::ITiledRenderable: getTextSelection() can be pure + virtual now + +Change-Id: Ifb33ee9a70afeccc01f45996b2953fcd5f3700cc +Reviewed-on: https://gerrit.libreoffice.org/16906 +Reviewed-by: Miklos Vajna +Tested-by: Jenkins +(cherry picked from commit 459bcc222f2aee52477cef8f94eb2789ff4ecd9a) +--- + include/vcl/ITiledRenderable.hxx | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx +index d212519bc9be..8824361f9f70 100644 +--- a/include/vcl/ITiledRenderable.hxx ++++ b/include/vcl/ITiledRenderable.hxx +@@ -126,7 +126,7 @@ public: + * + * @see lok::Document::getTextSelection(). + */ +- virtual OString getTextSelection(const char* /*pMimeType*/, OString& /*rUsedMimeType*/) { return OString(); } ++ virtual OString getTextSelection(const char* pMimeType, OString& rUsedMimeType) = 0; + + /** + * Adjusts the graphic selection. +-- +2.12.0 + diff --git a/SOURCES/0070-With-enable-gtk3-we-need-GLib-2.38.patch b/SOURCES/0070-With-enable-gtk3-we-need-GLib-2.38.patch new file mode 100644 index 0000000..940e5fe --- /dev/null +++ b/SOURCES/0070-With-enable-gtk3-we-need-GLib-2.38.patch @@ -0,0 +1,36 @@ +From 1e080d37ad18059cbd2ca7d39ceafece5b826623 Mon Sep 17 00:00:00 2001 +From: Tor Lillqvist +Date: Tue, 14 Jul 2015 11:01:48 +0300 +Subject: [PATCH 070/398] With --enable-gtk3 we need GLib >= 2.38 + +The G_ADD_PRIVATE used in libreofficekit/source/gtk/lokdocview.cxx is from +2.38. + +(cherry picked from commit f3df77accae2941ba9c6a5e48b84d661f7a87863) + +Change-Id: I2058932f8252d2715f970f020160f4f960987125 +--- + configure.ac | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/configure.ac b/configure.ac +index d1d82ea28cad..4e27231f6a5f 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -9900,11 +9900,11 @@ if test "x$enable_gtk3" = "xyes"; then + AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo]) + fi + : ${with_system_cairo:=yes} +- PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= 3.8 gtk+-unix-print-3.0 gmodule-no-export-2.0 cairo, ENABLE_GTK3="TRUE", ENABLE_GTK3="") ++ PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= 3.8 gtk+-unix-print-3.0 gmodule-no-export-2.0 glib-2.0 >= 2.38 cairo, ENABLE_GTK3="TRUE", ENABLE_GTK3="") + if test "x$ENABLE_GTK3" = "xTRUE"; then + R="gtk3" + else +- AC_MSG_ERROR([gtk3 libraries of the correct versions, not found]) ++ AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found]) + fi + GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g") + fi +-- +2.12.0 + diff --git a/SOURCES/0071-gtktiledviewer-method-for-resetting-all-tiles.patch b/SOURCES/0071-gtktiledviewer-method-for-resetting-all-tiles.patch new file mode 100644 index 0000000..c04e266 --- /dev/null +++ b/SOURCES/0071-gtktiledviewer-method-for-resetting-all-tiles.patch @@ -0,0 +1,69 @@ +From 143ffe8df3ee844c4022a8b4d6e3053a8d558f11 Mon Sep 17 00:00:00 2001 +From: Mihai Varga +Date: Tue, 21 Jul 2015 18:49:21 +0300 +Subject: [PATCH 071/398] gtktiledviewer: method for resetting all tiles + +[ Miklos Vajna: The point of the change is that without this, part switching in +Calc does not work, as Calc does not invalidate everything after a part switch +(unlike Impress), and we suppose the right fix for this is to let the clients +throw away the tiles, rather than letting Calc send out invalidations, too. ] + +Change-Id: Id368b955c54efb87ecf3d59278ddb5cdbb2e7856 +Reviewed-on: https://gerrit.libreoffice.org/17267 +Reviewed-by: Miklos Vajna +Tested-by: Miklos Vajna +(cherry picked from commit ed9d6ef1e647b574f58ba870d71a4291d958c0ad) +--- + include/LibreOfficeKit/LibreOfficeKitGtk.h | 3 +++ + libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 1 + + libreofficekit/source/gtk/lokdocview.cxx | 8 ++++++++ + 3 files changed, 12 insertions(+) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h +index 962f9d9265bb..b98a85646e0e 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h ++++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h +@@ -63,6 +63,9 @@ char* lok_doc_view_get_part_name (LOKDocView* + int nPart); + void lok_doc_view_set_partmode (LOKDocView* pDocView, + int nPartMode); ++ ++void lok_doc_view_reset_view (LOKDocView* pDocView); ++ + /// Sets if the viewer is actually an editor or not. + void lok_doc_view_set_edit (LOKDocView* pDocView, + gboolean bEdit); +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index d40cceb291ed..8c43e9d68092 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -356,6 +356,7 @@ static void changePart( GtkWidget* pSelector, gpointer /* pItem */ ) + if (g_bPartSelectorBroadcast && pDocView) + { + lok_doc_view_set_part( LOK_DOC_VIEW(pDocView), nPart ); ++ lok_doc_view_reset_view( LOK_DOC_VIEW(pDocView) ); + } + } + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 5de795a1a961..27d597ae57e3 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -1529,6 +1529,14 @@ lok_doc_view_set_partmode(LOKDocView* pDocView, + priv->m_pDocument->pClass->setPartMode( priv->m_pDocument, nPartMode ); + } + ++SAL_DLLPUBLIC_EXPORT void ++lok_doc_view_reset_view(LOKDocView* pDocView) ++{ ++ LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ priv->m_aTileBuffer.resetAllTiles(); ++ gtk_widget_queue_draw(GTK_WIDGET(pDocView)); ++} ++ + /** + * lok_doc_view_set_edit: + * @pDocView: The #LOKDocView instance +-- +2.12.0 + diff --git a/SOURCES/0072-lokdocview-Call-open_document-in-another-thread.patch b/SOURCES/0072-lokdocview-Call-open_document-in-another-thread.patch new file mode 100644 index 0000000..c477d61 --- /dev/null +++ b/SOURCES/0072-lokdocview-Call-open_document-in-another-thread.patch @@ -0,0 +1,244 @@ +From ccd9b4a66c6cc65892321dafcb8a633514a717e5 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Mon, 6 Jul 2015 22:01:30 +0530 +Subject: [PATCH 072/398] lokdocview: Call open_document in another thread + +This is to keep the widget responsive during document load. + +Change-Id: I81acaffc75ca7deddd6cc2de6abae22d009d40cd +(cherry picked from commit 645f00543405450cd3a3862482dc4e1cda65d098) +--- + include/LibreOfficeKit/LibreOfficeKitGtk.h | 11 +++- + .../qa/gtktiledviewer/gtktiledviewer.cxx | 42 +++++++++------ + libreofficekit/source/gtk/lokdocview.cxx | 59 +++++++++++++++++++--- + 3 files changed, 86 insertions(+), 26 deletions(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h +index b98a85646e0e..3f56f08b2dce 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h ++++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h +@@ -45,8 +45,15 @@ GtkWidget* lok_doc_view_new (const gchar* + GCancellable *cancellable, + GError **error); + +-gboolean lok_doc_view_open_document (LOKDocView* pDocView, +- const gchar* pPath); ++void lok_doc_view_open_document (LOKDocView* pDocView, ++ const gchar* pPath, ++ GCancellable* cancellable, ++ GAsyncReadyCallback callback, ++ gpointer userdata); ++ ++gboolean lok_doc_view_open_document_finish (LOKDocView* pDocView, ++ GAsyncResult* res, ++ GError** error); + + /// Gets the document the viewer displays. + LibreOfficeKitDocument* lok_doc_view_get_document (LOKDocView* pDocView); +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 8c43e9d68092..c9fd3f2e5ca4 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -41,6 +41,7 @@ std::map g_aCommandNameToolItems; + bool g_bToolItemBroadcast = true; + static GtkWidget* pVBox; + static GtkComboBoxText* pPartSelector; ++static GtkWidget* pPartModeComboBox; + /// Should the part selector avoid calling lok::Document::setPart()? + static bool g_bPartSelectorBroadcast = true; + GtkWidget* pFindbar; +@@ -290,6 +291,7 @@ static void signalSearch(LOKDocView* /*pLOKDocView*/, char* /*pPayload*/, gpoint + gtk_label_set_text(GTK_LABEL(pFindbarLabel), "Search key not found"); + } + ++ + static void signalPart(LOKDocView* /*pLOKDocView*/, int nPart, gpointer /*pData*/) + { + g_bPartSelectorBroadcast = false; +@@ -380,6 +382,28 @@ static void changePartMode( GtkWidget* pSelector, gpointer /* pItem */ ) + } + } + ++static void openDocumentCallback (GObject* source_object, GAsyncResult* res, gpointer /*userdata*/) ++{ ++ LOKDocView* pDocView1 = LOK_DOC_VIEW (source_object); ++ GError* error = NULL; ++ GList *focusChain = NULL; ++ ++ if (!lok_doc_view_open_document_finish(pDocView1, res, &error)) ++ { ++ g_warning ("Error occurred while opening the document : %s", error->message); ++ g_error_free (error); ++ } ++ ++ populatePartSelector(); ++ populatePartModeSelector( GTK_COMBO_BOX_TEXT(pPartModeComboBox) ); ++ // Connect these signals after populating the selectors, to avoid re-rendering on setting the default part/partmode. ++ g_signal_connect(G_OBJECT(pPartModeComboBox), "changed", G_CALLBACK(changePartMode), 0); ++ g_signal_connect(G_OBJECT(pPartSelector), "changed", G_CALLBACK(changePart), 0); ++ ++ focusChain = g_list_append( focusChain, pDocView1 ); ++ gtk_container_set_focus_chain ( GTK_CONTAINER (pVBox), focusChain ); ++} ++ + int main( int argc, char* argv[] ) + { + if( argc < 3 || +@@ -435,7 +459,7 @@ int main( int argc, char* argv[] ) + gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pSeparator2, -1); + + GtkToolItem* pPartModeSelectorToolItem = gtk_tool_item_new(); +- GtkWidget* pPartModeComboBox = gtk_combo_box_text_new(); ++ pPartModeComboBox = gtk_combo_box_text_new(); + gtk_container_add( GTK_CONTAINER(pPartModeSelectorToolItem), pPartModeComboBox ); + gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pPartModeSelectorToolItem, -1 ); + +@@ -542,21 +566,7 @@ int main( int argc, char* argv[] ) + // Hide the findbar by default. + gtk_widget_hide(pFindbar); + +- int bOpened = lok_doc_view_open_document( LOK_DOC_VIEW(pDocView), argv[2] ); +- if (!bOpened) +- g_error("main: lok_doc_view_open_document() failed"); +- assert(lok_doc_view_get_document(LOK_DOC_VIEW(pDocView))); +- +- populatePartSelector(); +- populatePartModeSelector( GTK_COMBO_BOX_TEXT(pPartModeComboBox) ); +- // Connect these signals after populating the selectors, to avoid re-rendering on setting the default part/partmode. +- g_signal_connect(G_OBJECT(pPartModeComboBox), "changed", G_CALLBACK(changePartMode), 0); +- g_signal_connect(G_OBJECT(pPartSelector), "changed", G_CALLBACK(changePart), 0); +- +- // Make only LOKDocView widget as focussable +- GList *focusChain = NULL; +- focusChain = g_list_append( focusChain, pDocView ); +- gtk_container_set_focus_chain ( GTK_CONTAINER (pVBox), focusChain ); ++ lok_doc_view_open_document( LOK_DOC_VIEW(pDocView), argv[2], NULL, openDocumentCallback, pDocView ); + + gtk_main(); + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 27d597ae57e3..40c0860973ad 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -108,8 +108,6 @@ struct _LOKDocViewPrivate + + enum + { +- LOAD_CHANGED, +- LOAD_FAILED, + EDIT_CHANGED, + COMMAND_CHANGED, + SEARCH_NOT_FOUND, +@@ -337,19 +335,23 @@ static gboolean + globalCallback (gpointer pData) + { + CallbackData* pCallback = static_cast(pData); ++ LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private (pCallback->m_pDocView)); + + switch (pCallback->m_nType) + { + case LOK_CALLBACK_STATUS_INDICATOR_START: + { ++ priv->m_nLoadProgress = 0; + } + break; + case LOK_CALLBACK_STATUS_INDICATOR_SET_VALUE: + { ++ priv->m_nLoadProgress = std::stoi(pCallback->m_aPayload); + } + break; + case LOK_CALLBACK_STATUS_INDICATOR_FINISH: + { ++ priv->m_nLoadProgress = 100; + } + break; + default: +@@ -1389,15 +1391,30 @@ lok_doc_view_new (const gchar* pPath, GCancellable *cancellable, GError **error) + } + + /** +- * lok_doc_view_open_document: ++ * lok_doc_view_open_document_finish: + * @pDocView: The #LOKDocView instance +- * @pPath: The path of the document that #LOKDocView widget should try to open ++ * @res: ++ * @error: + * + * Returns: %TRUE if the document is loaded succesfully, %FALSE otherwise + */ + SAL_DLLPUBLIC_EXPORT gboolean +-lok_doc_view_open_document (LOKDocView* pDocView, const gchar* pPath) ++lok_doc_view_open_document_finish (LOKDocView* pDocView, GAsyncResult* res, GError** error) ++{ ++ GTask* task = G_TASK(res); ++ ++ g_return_val_if_fail(g_task_is_valid(res, pDocView), NULL); ++ //FIXME: make source_tag workx ++ //g_return_val_if_fail(g_task_get_source_tag(task) == lok_doc_view_open_document, NULL); ++ g_return_val_if_fail(error == NULL || *error == NULL, NULL); ++ ++ return g_task_propagate_boolean(task, error); ++} ++ ++static void ++lok_doc_view_open_document_func (GTask* task, gpointer source_object, gpointer task_data, GCancellable* cancellable) + { ++ LOKDocView* pDocView = LOK_DOC_VIEW(source_object); + LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); + + if ( priv->m_pDocument ) +@@ -1407,13 +1424,13 @@ lok_doc_view_open_document (LOKDocView* pDocView, const gchar* pPath) + } + + priv->m_pOffice->pClass->registerCallback(priv->m_pOffice, globalCallbackWorker, pDocView); +- priv->m_pDocument = priv->m_pOffice->pClass->documentLoad( priv->m_pOffice, pPath ); ++ priv->m_pDocument = priv->m_pOffice->pClass->documentLoad( priv->m_pOffice, priv->m_aDocPath ); + if ( !priv->m_pDocument ) + { + // FIXME: should have a GError parameter and populate it. + char *pError = priv->m_pOffice->pClass->getError( priv->m_pOffice ); + fprintf( stderr, "Error opening document '%s'\n", pError ); +- return FALSE; ++ g_task_return_new_error(task, 0, 0, pError); + } + else + { +@@ -1438,8 +1455,34 @@ lok_doc_view_open_document (LOKDocView* pDocView, const gchar* pPath) + nDocumentHeightPixels); + gtk_widget_set_can_focus(GTK_WIDGET(pDocView), TRUE); + gtk_widget_grab_focus(GTK_WIDGET(pDocView)); ++ g_task_return_boolean (task, true); + } +- return TRUE; ++} ++ ++/** ++ * lok_doc_view_open_document: ++ * @pDocView: The #LOKDocView instance ++ * @pPath: The path of the document that #LOKDocView widget should try to open ++ * ++ * Returns: %TRUE if the document is loaded succesfully, %FALSE otherwise ++ */ ++SAL_DLLPUBLIC_EXPORT void ++lok_doc_view_open_document (LOKDocView* pDocView, ++ const gchar* pPath, ++ GCancellable* cancellable, ++ GAsyncReadyCallback callback, ++ gpointer userdata) ++{ ++ GTask *task; ++ LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ priv->m_aDocPath = g_strdup(pPath); ++ ++ task = g_task_new(pDocView, cancellable, callback, userdata); ++ // FIXME: Use source_tag to check the task. ++ //g_task_set_source_tag(task, lok_doc_view_open_document); ++ ++ g_task_run_in_thread(task, lok_doc_view_open_document_func); ++ g_object_unref(task); + } + + /** +-- +2.12.0 + diff --git a/SOURCES/0073-lokdocview-Emit-load-changed-signal-showing-load-pro.patch b/SOURCES/0073-lokdocview-Emit-load-changed-signal-showing-load-pro.patch new file mode 100644 index 0000000..f33be0d --- /dev/null +++ b/SOURCES/0073-lokdocview-Emit-load-changed-signal-showing-load-pro.patch @@ -0,0 +1,185 @@ +From 2ce0084db53e9e029ed6a276823ece21297a3050 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Tue, 7 Jul 2015 21:16:45 +0530 +Subject: [PATCH 073/398] lokdocview: Emit load-changed signal showing load + progress + +Change-Id: I69b4c05d12c0c0b2ca6b7d1ad76ed74cc1f4346a +(cherry picked from commit da129b682f81a8fdbc6be95142456f204b2b7951) +--- + .../qa/gtktiledviewer/gtktiledviewer.cxx | 17 ++++++++ + libreofficekit/source/gtk/lokdocview.cxx | 45 +++++++++++++++------- + 2 files changed, 49 insertions(+), 13 deletions(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index c9fd3f2e5ca4..5ff357d4a089 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -30,6 +30,7 @@ static int help() + } + + static GtkWidget* pDocView; ++static GtkWidget* pStatusBar; + static GtkToolItem* pEnableEditing; + static GtkToolItem* pBold; + static GtkToolItem* pItalic; +@@ -285,6 +286,12 @@ static void signalCommand(LOKDocView* /*pLOKDocView*/, char* pPayload, gpointer + } + } + ++static void loadChanged(LOKDocView* /*pLOKDocView*/, gdouble fValue, gpointer pData) ++{ ++ GtkWidget* pProgressBar = GTK_WIDGET (pData); ++ gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(pProgressBar), fValue); ++} ++ + /// LOKDocView found no search matches -> set the search label accordingly. + static void signalSearch(LOKDocView* /*pLOKDocView*/, char* /*pPayload*/, gpointer /*pData*/) + { +@@ -402,6 +409,8 @@ static void openDocumentCallback (GObject* source_object, GAsyncResult* res, gpo + + focusChain = g_list_append( focusChain, pDocView1 ); + gtk_container_set_focus_chain ( GTK_CONTAINER (pVBox), focusChain ); ++ ++ gtk_widget_hide (pStatusBar); + } + + int main( int argc, char* argv[] ) +@@ -554,6 +563,7 @@ int main( int argc, char* argv[] ) + g_signal_connect(pDocView, "part-changed", G_CALLBACK(signalPart), NULL); + g_signal_connect(pDocView, "hyperlink-clicked", G_CALLBACK(signalHyperlink), NULL); + ++ + // Scrolled window for DocView + pScrolledWindow = gtk_scrolled_window_new(0, 0); + gtk_widget_set_hexpand (pScrolledWindow, TRUE); +@@ -562,6 +572,13 @@ int main( int argc, char* argv[] ) + + gtk_container_add(GTK_CONTAINER(pScrolledWindow), pDocView); + ++ GtkWidget* pProgressBar = gtk_progress_bar_new (); ++ g_signal_connect(pDocView, "load-changed", G_CALLBACK(loadChanged), pProgressBar); ++ ++ pStatusBar = gtk_statusbar_new (); ++ gtk_container_add (GTK_CONTAINER(pVBox), pStatusBar); ++ gtk_container_add (GTK_CONTAINER(pStatusBar), pProgressBar); ++ + gtk_widget_show_all( pWindow ); + // Hide the findbar by default. + gtk_widget_hide(pFindbar); +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 40c0860973ad..bc9b27ac6302 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -40,7 +40,7 @@ struct _LOKDocViewPrivate + { + gchar* m_aLOPath; + gchar* m_aDocPath; +- guint m_nLoadProgress; ++ gdouble m_nLoadProgress; + gboolean m_bIsLoading; + gboolean m_bCanZoomIn; + gboolean m_bCanZoomOut; +@@ -108,6 +108,7 @@ struct _LOKDocViewPrivate + + enum + { ++ LOAD_CHANGED, + EDIT_CHANGED, + COMMAND_CHANGED, + SEARCH_NOT_FOUND, +@@ -341,17 +342,20 @@ globalCallback (gpointer pData) + { + case LOK_CALLBACK_STATUS_INDICATOR_START: + { +- priv->m_nLoadProgress = 0; ++ priv->m_nLoadProgress = 0.0; ++ g_signal_emit (pCallback->m_pDocView, doc_view_signals[LOAD_CHANGED], 0, 0.0); + } + break; + case LOK_CALLBACK_STATUS_INDICATOR_SET_VALUE: + { +- priv->m_nLoadProgress = std::stoi(pCallback->m_aPayload); ++ priv->m_nLoadProgress = static_cast(std::stoi(pCallback->m_aPayload)/100.0); ++ g_signal_emit (pCallback->m_pDocView, doc_view_signals[LOAD_CHANGED], 0, priv->m_nLoadProgress); + } + break; + case LOK_CALLBACK_STATUS_INDICATOR_FINISH: + { +- priv->m_nLoadProgress = 100; ++ priv->m_nLoadProgress = 1.0; ++ g_signal_emit (pCallback->m_pDocView, doc_view_signals[LOAD_CHANGED], 0, 1.0); + } + break; + default: +@@ -1069,7 +1073,7 @@ static void lok_doc_view_get_property (GObject* object, guint propId, GValue *va + g_value_set_boolean (value, priv->m_bEdit); + break; + case PROP_LOAD_PROGRESS: +- g_value_set_uint (value, priv->m_nLoadProgress); ++ g_value_set_double (value, priv->m_nLoadProgress); + break; + case PROP_ZOOM: + g_value_set_float (value, priv->m_fZoom); +@@ -1210,11 +1214,11 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + */ + g_object_class_install_property (pGObjectClass, + PROP_LOAD_PROGRESS, +- g_param_spec_int("load-progress", +- "Estimated Load Progress", +- "Whether the content is in edit mode or not", +- 0, 100, 0, +- G_PARAM_READABLE)); ++ g_param_spec_double("load-progress", ++ "Estimated Load Progress", ++ "Shows the progress of the document load operation", ++ 0.0, 1.0, 0.0, ++ G_PARAM_READABLE)); + + /** + * LOKDocView:zoom-level: +@@ -1300,6 +1304,21 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + | G_PARAM_STATIC_STRINGS))); + + /** ++ * LOKDocView::load-changed: ++ * @pDocView: the #LOKDocView on which the signal is emitted ++ * @fLoadProgress: the new progress value ++ */ ++ doc_view_signals[LOAD_CHANGED] = ++ g_signal_new("load-changed", ++ G_TYPE_FROM_CLASS (pGObjectClass), ++ G_SIGNAL_RUN_FIRST, ++ 0, ++ NULL, NULL, ++ g_cclosure_marshal_VOID__DOUBLE, ++ G_TYPE_NONE, 1, ++ G_TYPE_DOUBLE); ++ ++ /** + * LOKDocView::edit-changed: + * @pDocView: the #LOKDocView on which the signal is emitted + * @bEdit: the new edit value of the view +@@ -1403,16 +1422,16 @@ lok_doc_view_open_document_finish (LOKDocView* pDocView, GAsyncResult* res, GErr + { + GTask* task = G_TASK(res); + +- g_return_val_if_fail(g_task_is_valid(res, pDocView), NULL); ++ g_return_val_if_fail(g_task_is_valid(res, pDocView), false); + //FIXME: make source_tag workx + //g_return_val_if_fail(g_task_get_source_tag(task) == lok_doc_view_open_document, NULL); +- g_return_val_if_fail(error == NULL || *error == NULL, NULL); ++ g_return_val_if_fail(error == NULL || *error == NULL, false); + + return g_task_propagate_boolean(task, error); + } + + static void +-lok_doc_view_open_document_func (GTask* task, gpointer source_object, gpointer task_data, GCancellable* cancellable) ++lok_doc_view_open_document_func (GTask* task, gpointer source_object, gpointer /*task_data*/, GCancellable* /*cancellable*/) + { + LOKDocView* pDocView = LOK_DOC_VIEW(source_object); + LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); +-- +2.12.0 + diff --git a/SOURCES/0074-gtktiledviewer-Fill-whole-statusbar-with-progressbar.patch b/SOURCES/0074-gtktiledviewer-Fill-whole-statusbar-with-progressbar.patch new file mode 100644 index 0000000..c0342e1 --- /dev/null +++ b/SOURCES/0074-gtktiledviewer-Fill-whole-statusbar-with-progressbar.patch @@ -0,0 +1,44 @@ +From a7d821e0029c0c2c8d23adb6f95c18a3264d53c9 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Sat, 11 Jul 2015 21:29:53 +0530 +Subject: [PATCH 074/398] gtktiledviewer: Fill whole statusbar with progressbar + +We don't have anything yet to put in statusbar. Let progressbar +fill the whole width of statusbar for now. + +Change-Id: I4cd8745e997a0d2b917bc5baf358b097174d0df9 +(cherry picked from commit cb94e003c066033db96da62596022385794f281c) +--- + libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 5ff357d4a089..a3999c09b29a 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -369,6 +369,11 @@ static void changePart( GtkWidget* pSelector, gpointer /* pItem */ ) + } + } + ++static void removeChildrenFromStatusbar(GtkWidget* children, gpointer) ++{ ++ gtk_container_remove(GTK_CONTAINER(pStatusBar), children); ++} ++ + static void populatePartModeSelector( GtkComboBoxText* pSelector ) + { + gtk_combo_box_text_append_text( pSelector, "Standard" ); +@@ -576,8 +581,10 @@ int main( int argc, char* argv[] ) + g_signal_connect(pDocView, "load-changed", G_CALLBACK(loadChanged), pProgressBar); + + pStatusBar = gtk_statusbar_new (); ++ gtk_container_forall(GTK_CONTAINER(pStatusBar), removeChildrenFromStatusbar, NULL); + gtk_container_add (GTK_CONTAINER(pVBox), pStatusBar); + gtk_container_add (GTK_CONTAINER(pStatusBar), pProgressBar); ++ gtk_widget_set_hexpand(pProgressBar, true); + + gtk_widget_show_all( pWindow ); + // Hide the findbar by default. +-- +2.12.0 + diff --git a/SOURCES/0075-lokdocview-Use-a-thread-pool-for-most-LOK-calls.patch b/SOURCES/0075-lokdocview-Use-a-thread-pool-for-most-LOK-calls.patch new file mode 100644 index 0000000..9d30001 --- /dev/null +++ b/SOURCES/0075-lokdocview-Use-a-thread-pool-for-most-LOK-calls.patch @@ -0,0 +1,472 @@ +From ebaad17eeafbfa87a4feacde6514a77b37872178 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Sun, 12 Jul 2015 23:22:51 +0530 +Subject: [PATCH 075/398] lokdocview: Use a thread pool for most LOK calls + +This is a thread pool with just single thread because LOK is +single threaded; using multiple threads in this case would be +useless. + +Primary reason we are using a thread pool here is to avoid the +overhead in spawning a new thread for each LOK call. + +Change-Id: Ibbfdb7cb0a8ef9f07bcc659e65ce8997716aa245 +(cherry picked from commit a433ea9f46cc1cc0de7282f3d360d70ad215aaa8) +--- + include/LibreOfficeKit/LibreOfficeKitGtk.h | 4 +- + libreofficekit/source/gtk/lokdocview.cxx | 327 ++++++++++++++++++++++------- + 2 files changed, 253 insertions(+), 78 deletions(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h +index 3f56f08b2dce..02789ad3f585 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h ++++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h +@@ -81,8 +81,8 @@ gboolean lok_doc_view_get_edit (LOKDocView* + + /// Posts the .uno: command to the LibreOfficeKit. + void lok_doc_view_post_command (LOKDocView* pDocView, +- const char* pCommand, +- const char* pArguments); ++ const gchar* pCommand, ++ const gchar* pArguments); + + float lok_doc_view_pixel_to_twip (LOKDocView* pDocView, + float fInput); +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index bc9b27ac6302..46b031950e8a 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -134,6 +134,16 @@ enum + PROP_CAN_ZOOM_OUT + }; + ++enum ++{ ++ LOK_LOAD_DOC, ++ LOK_POST_COMMAND, ++ LOK_SET_EDIT, ++ LOK_SET_PARTMODE, ++ LOK_SET_PART, ++ LOK_POST_KEY ++}; ++ + static guint doc_view_signals[LAST_SIGNAL] = { 0 }; + + static void lok_doc_view_initable_iface_init (GInitableIface *iface); +@@ -150,6 +160,7 @@ G_DEFINE_TYPE_WITH_CODE (LOKDocView, lok_doc_view, GTK_TYPE_DRAWING_AREA, + #pragma GCC diagnostic pop + #endif + ++static GThreadPool* lokThreadPool; + + struct CallbackData + { +@@ -163,6 +174,40 @@ struct CallbackData + m_pDocView(pDocView) {} + }; + ++struct LOEvent ++{ ++ int m_nType; ++ const gchar* m_pCommand; ++ const gchar* m_pArguments; ++ gchar* m_pPath; ++ gboolean m_bEdit; ++ int m_nPartMode; ++ int m_nPart; ++ int m_nKeyEvent; ++ int m_nCharCode; ++ int m_nKeyCode; ++ ++ LOEvent(int type) ++ : m_nType(type) {} ++ ++ LOEvent(int type, const gchar* pCommand, const gchar* pArguments) ++ : m_nType(type), ++ m_pCommand(pCommand), ++ m_pArguments(pArguments) {} ++ ++ LOEvent(int type, const gchar* pPath) ++ : m_nType(type) ++ { ++ m_pPath = g_strdup(pPath); ++ } ++ ++ LOEvent(int type, int nKeyEvent, int nCharCode, int nKeyCode) ++ : m_nType(type), ++ m_nKeyEvent(nKeyEvent), ++ m_nCharCode(nCharCode), ++ m_nKeyCode(nKeyCode) {} ++}; ++ + static void + payloadToSize(const char* pPayload, long& rWidth, long& rHeight) + { +@@ -225,6 +270,20 @@ isEmptyRectangle(const GdkRectangle& rRectangle) + return rRectangle.x == 0 && rRectangle.y == 0 && rRectangle.width == 0 && rRectangle.height == 0; + } + ++static void ++postKeyEventInThread(gpointer data) ++{ ++ GTask* task = G_TASK(data); ++ LOKDocView* pDocView = LOK_DOC_VIEW(g_task_get_source_object(task)); ++ LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOEvent* pLOEvent = static_cast(g_task_get_task_data(task)); ++ ++ priv->m_pDocument->pClass->postKeyEvent(priv->m_pDocument, ++ pLOEvent->m_nKeyEvent, ++ pLOEvent->m_nCharCode, ++ pLOEvent->m_nKeyCode); ++} ++ + static gboolean + signalKey (GtkWidget* pWidget, GdkEventKey* pEvent) + { +@@ -281,10 +340,23 @@ signalKey (GtkWidget* pWidget, GdkEventKey* pEvent) + if (pEvent->state & GDK_SHIFT_MASK) + nKeyCode |= KEY_SHIFT; + ++ + if (pEvent->type == GDK_KEY_RELEASE) +- priv->m_pDocument->pClass->postKeyEvent(priv->m_pDocument, LOK_KEYEVENT_KEYUP, nCharCode, nKeyCode); ++ { ++ GTask* task = g_task_new(pDocView, NULL, NULL, NULL); ++ LOEvent* pLOEvent = new LOEvent(LOK_POST_KEY, LOK_KEYEVENT_KEYUP, nCharCode, nKeyCode); ++ g_task_set_task_data(task, pLOEvent, g_free); ++ g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); ++ g_object_unref(task); ++ } + else +- priv->m_pDocument->pClass->postKeyEvent(priv->m_pDocument, LOK_KEYEVENT_KEYINPUT, nCharCode, nKeyCode); ++ { ++ GTask* task = g_task_new(pDocView, NULL, NULL, NULL); ++ LOEvent* pLOEvent = new LOEvent(LOK_POST_KEY, LOK_KEYEVENT_KEYINPUT, nCharCode, nKeyCode); ++ g_task_set_task_data(task, pLOEvent, g_free); ++ g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); ++ g_object_unref(task); ++ } + + return FALSE; + } +@@ -1013,6 +1085,143 @@ lok_doc_view_signal_motion (GtkWidget* pWidget, GdkEventMotion* pEvent) + return FALSE; + } + ++static void ++lok_doc_view_open_document_in_thread (gpointer data) ++{ ++ GTask* task = G_TASK(data); ++ LOKDocView* pDocView = LOK_DOC_VIEW(g_task_get_source_object(task)); ++ LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ ++ if ( priv->m_pDocument ) ++ { ++ priv->m_pDocument->pClass->destroy( priv->m_pDocument ); ++ priv->m_pDocument = 0; ++ } ++ ++ priv->m_pOffice->pClass->registerCallback(priv->m_pOffice, globalCallbackWorker, pDocView); ++ priv->m_pDocument = priv->m_pOffice->pClass->documentLoad( priv->m_pOffice, priv->m_aDocPath ); ++ if ( !priv->m_pDocument ) ++ { ++ // FIXME: should have a GError parameter and populate it. ++ char *pError = priv->m_pOffice->pClass->getError( priv->m_pOffice ); ++ fprintf( stderr, "Error opening document '%s'\n", pError ); ++ g_task_return_new_error(task, 0, 0, pError); ++ } ++ else ++ { ++ priv->m_pDocument->pClass->initializeForRendering(priv->m_pDocument); ++ priv->m_pDocument->pClass->registerCallback(priv->m_pDocument, callbackWorker, pDocView); ++ priv->m_pDocument->pClass->getDocumentSize(priv->m_pDocument, &priv->m_nDocumentWidthTwips, &priv->m_nDocumentHeightTwips); ++ g_timeout_add(600, handleTimeout, pDocView); ++ ++ float zoom = priv->m_fZoom; ++ long nDocumentWidthTwips = priv->m_nDocumentWidthTwips; ++ long nDocumentHeightTwips = priv->m_nDocumentHeightTwips; ++ long nDocumentWidthPixels = twipToPixel(nDocumentWidthTwips, zoom); ++ long nDocumentHeightPixels = twipToPixel(nDocumentHeightTwips, zoom); ++ // Total number of columns in this document. ++ guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); ++ ++ ++ priv->m_aTileBuffer = TileBuffer(priv->m_pDocument, ++ nColumns); ++ gtk_widget_set_size_request(GTK_WIDGET(pDocView), ++ nDocumentWidthPixels, ++ nDocumentHeightPixels); ++ gtk_widget_set_can_focus(GTK_WIDGET(pDocView), TRUE); ++ gtk_widget_grab_focus(GTK_WIDGET(pDocView)); ++ g_task_return_boolean (task, true); ++ } ++} ++ ++static void ++lok_doc_view_set_part_in_thread(gpointer data) ++{ ++ GTask* task = G_TASK(data); ++ LOKDocView* pDocView = LOK_DOC_VIEW(g_task_get_source_object(task)); ++ LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOEvent* pLOEvent = static_cast(g_task_get_task_data(task)); ++ int nPart = pLOEvent->m_nPart; ++ ++ priv->m_pDocument->pClass->setPart( priv->m_pDocument, nPart ); ++} ++ ++static void ++lok_doc_view_set_partmode_in_thread(gpointer data) ++{ ++ GTask* task = G_TASK(data); ++ LOKDocView* pDocView = LOK_DOC_VIEW(g_task_get_source_object(task)); ++ LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOEvent* pLOEvent = static_cast(g_task_get_task_data(task)); ++ int nPartMode = pLOEvent->m_nPartMode; ++ ++ priv->m_pDocument->pClass->setPartMode( priv->m_pDocument, nPartMode ); ++} ++ ++static void ++lok_doc_view_set_edit_in_thread(gpointer data) ++{ ++ GTask* task = G_TASK(data); ++ LOKDocView* pDocView = LOK_DOC_VIEW(g_task_get_source_object(task)); ++ LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOEvent* pLOEvent = static_cast(g_task_get_task_data(task)); ++ gboolean bWasEdit = priv->m_bEdit; ++ gboolean bEdit = pLOEvent->m_bEdit; ++ ++ if (!priv->m_bEdit && bEdit) ++ g_info("lok_doc_view_set_edit: entering edit mode"); ++ else if (priv->m_bEdit && !bEdit) ++ { ++ g_info("lok_doc_view_set_edit: leaving edit mode"); ++ priv->m_pDocument->pClass->resetSelection(priv->m_pDocument); ++ } ++ priv->m_bEdit = bEdit; ++ g_signal_emit(pDocView, doc_view_signals[EDIT_CHANGED], 0, bWasEdit); ++ gtk_widget_queue_draw(GTK_WIDGET(pDocView)); ++} ++ ++static void ++lok_doc_view_post_command_in_thread (gpointer data) ++{ ++ GTask* task = G_TASK(data); ++ LOKDocView* pDocView = LOK_DOC_VIEW(g_task_get_source_object(task)); ++ LOEvent* pLOEvent = static_cast(g_task_get_task_data(task)); ++ LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ ++ priv->m_pDocument->pClass->postUnoCommand(priv->m_pDocument, pLOEvent->m_pCommand, pLOEvent->m_pArguments); ++} ++ ++static void ++lokThreadFunc(gpointer data, gpointer /*user_data*/) ++{ ++ GTask* task = G_TASK(data); ++ LOEvent* pLOEvent = static_cast(g_task_get_task_data(task)); ++ ++ switch (pLOEvent->m_nType) ++ { ++ case LOK_LOAD_DOC: ++ lok_doc_view_open_document_in_thread (task); ++ break; ++ case LOK_POST_COMMAND: ++ lok_doc_view_post_command_in_thread (task); ++ break; ++ case LOK_SET_EDIT: ++ lok_doc_view_set_edit_in_thread(task); ++ break; ++ case LOK_SET_PART: ++ lok_doc_view_set_part_in_thread(task); ++ break; ++ case LOK_SET_PARTMODE: ++ lok_doc_view_set_partmode_in_thread(task); ++ break; ++ case LOK_POST_KEY: ++ postKeyEventInThread(task); ++ break; ++ } ++ ++ g_object_unref(task); ++} ++ + static void lok_doc_view_init (LOKDocView* pDocView) + { + LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); +@@ -1392,6 +1601,12 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, 1, + G_TYPE_STRING); ++ ++ lokThreadPool = g_thread_pool_new(lokThreadFunc, ++ NULL, ++ 1, ++ FALSE, ++ NULL); + } + + /** +@@ -1423,60 +1638,13 @@ lok_doc_view_open_document_finish (LOKDocView* pDocView, GAsyncResult* res, GErr + GTask* task = G_TASK(res); + + g_return_val_if_fail(g_task_is_valid(res, pDocView), false); +- //FIXME: make source_tag workx ++ //FIXME: make source_tag work + //g_return_val_if_fail(g_task_get_source_tag(task) == lok_doc_view_open_document, NULL); + g_return_val_if_fail(error == NULL || *error == NULL, false); + + return g_task_propagate_boolean(task, error); + } + +-static void +-lok_doc_view_open_document_func (GTask* task, gpointer source_object, gpointer /*task_data*/, GCancellable* /*cancellable*/) +-{ +- LOKDocView* pDocView = LOK_DOC_VIEW(source_object); +- LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); +- +- if ( priv->m_pDocument ) +- { +- priv->m_pDocument->pClass->destroy( priv->m_pDocument ); +- priv->m_pDocument = 0; +- } +- +- priv->m_pOffice->pClass->registerCallback(priv->m_pOffice, globalCallbackWorker, pDocView); +- priv->m_pDocument = priv->m_pOffice->pClass->documentLoad( priv->m_pOffice, priv->m_aDocPath ); +- if ( !priv->m_pDocument ) +- { +- // FIXME: should have a GError parameter and populate it. +- char *pError = priv->m_pOffice->pClass->getError( priv->m_pOffice ); +- fprintf( stderr, "Error opening document '%s'\n", pError ); +- g_task_return_new_error(task, 0, 0, pError); +- } +- else +- { +- priv->m_pDocument->pClass->initializeForRendering(priv->m_pDocument); +- priv->m_pDocument->pClass->registerCallback(priv->m_pDocument, callbackWorker, pDocView); +- priv->m_pDocument->pClass->getDocumentSize(priv->m_pDocument, &priv->m_nDocumentWidthTwips, &priv->m_nDocumentHeightTwips); +- g_timeout_add(600, handleTimeout, pDocView); +- +- float zoom = priv->m_fZoom; +- long nDocumentWidthTwips = priv->m_nDocumentWidthTwips; +- long nDocumentHeightTwips = priv->m_nDocumentHeightTwips; +- long nDocumentWidthPixels = twipToPixel(nDocumentWidthTwips, zoom); +- long nDocumentHeightPixels = twipToPixel(nDocumentHeightTwips, zoom); +- // Total number of columns in this document. +- guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); +- +- +- priv->m_aTileBuffer = TileBuffer(priv->m_pDocument, +- nColumns); +- gtk_widget_set_size_request(GTK_WIDGET(pDocView), +- nDocumentWidthPixels, +- nDocumentHeightPixels); +- gtk_widget_set_can_focus(GTK_WIDGET(pDocView), TRUE); +- gtk_widget_grab_focus(GTK_WIDGET(pDocView)); +- g_task_return_boolean (task, true); +- } +-} + + /** + * lok_doc_view_open_document: +@@ -1492,15 +1660,13 @@ lok_doc_view_open_document (LOKDocView* pDocView, + GAsyncReadyCallback callback, + gpointer userdata) + { +- GTask *task; ++ GTask* task = g_task_new(pDocView, cancellable, callback, userdata); ++ LOEvent* pLOEvent = new LOEvent(LOK_LOAD_DOC, pPath); + LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); + priv->m_aDocPath = g_strdup(pPath); ++ g_task_set_task_data(task, pLOEvent, g_free); + +- task = g_task_new(pDocView, cancellable, callback, userdata); +- // FIXME: Use source_tag to check the task. +- //g_task_set_source_tag(task, lok_doc_view_open_document); +- +- g_task_run_in_thread(task, lok_doc_view_open_document_func); ++ g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); + g_object_unref(task); + } + +@@ -1572,8 +1738,13 @@ lok_doc_view_get_part (LOKDocView* pDocView) + SAL_DLLPUBLIC_EXPORT void + lok_doc_view_set_part (LOKDocView* pDocView, int nPart) + { +- LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); +- priv->m_pDocument->pClass->setPart( priv->m_pDocument, nPart ); ++ GTask* task = g_task_new(pDocView, NULL, NULL, NULL); ++ LOEvent* pLOEvent = new LOEvent(LOK_SET_PART); ++ pLOEvent->m_nPart = nPart; ++ g_task_set_task_data(task, pLOEvent, g_free); ++ ++ g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); ++ g_object_unref(task); + } + + SAL_DLLPUBLIC_EXPORT char* +@@ -1587,8 +1758,13 @@ SAL_DLLPUBLIC_EXPORT void + lok_doc_view_set_partmode(LOKDocView* pDocView, + int nPartMode) + { +- LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); +- priv->m_pDocument->pClass->setPartMode( priv->m_pDocument, nPartMode ); ++ GTask* task = g_task_new(pDocView, NULL, NULL, NULL); ++ LOEvent* pLOEvent = new LOEvent(LOK_SET_PARTMODE); ++ pLOEvent->m_nPartMode = nPartMode; ++ g_task_set_task_data(task, pLOEvent, g_free); ++ ++ g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); ++ g_object_unref(task); + } + + SAL_DLLPUBLIC_EXPORT void +@@ -1610,19 +1786,13 @@ SAL_DLLPUBLIC_EXPORT void + lok_doc_view_set_edit(LOKDocView* pDocView, + gboolean bEdit) + { +- LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); +- gboolean bWasEdit = priv->m_bEdit; ++ GTask* task = g_task_new(pDocView, NULL, NULL, NULL); ++ LOEvent* pLOEvent = new LOEvent(LOK_SET_EDIT); ++ pLOEvent->m_bEdit = bEdit; ++ g_task_set_task_data(task, pLOEvent, g_free); + +- if (!priv->m_bEdit && bEdit) +- g_info("lok_doc_view_set_edit: entering edit mode"); +- else if (priv->m_bEdit && !bEdit) +- { +- g_info("lok_doc_view_set_edit: leaving edit mode"); +- priv->m_pDocument->pClass->resetSelection(priv->m_pDocument); +- } +- priv->m_bEdit = bEdit; +- g_signal_emit(pDocView, doc_view_signals[EDIT_CHANGED], 0, bWasEdit); +- gtk_widget_queue_draw(GTK_WIDGET(pDocView)); ++ g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); ++ g_object_unref(task); + } + + /** +@@ -1648,11 +1818,16 @@ lok_doc_view_get_edit (LOKDocView* pDocView) + */ + SAL_DLLPUBLIC_EXPORT void + lok_doc_view_post_command (LOKDocView* pDocView, +- const char* pCommand, +- const char* pArguments) ++ const gchar* pCommand, ++ const gchar* pArguments) + { +- LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); +- priv->m_pDocument->pClass->postUnoCommand(priv->m_pDocument, pCommand, pArguments); ++ ++ GTask* task = g_task_new(pDocView, NULL, NULL, NULL); ++ LOEvent* pLOEvent = new LOEvent(LOK_POST_COMMAND, pCommand, pArguments); ++ g_task_set_task_data(task, pLOEvent, g_free); ++ ++ g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); ++ g_object_unref(task); + } + + /** +-- +2.12.0 + diff --git a/SOURCES/0076-lokdocview-Make-paintTile-async.patch b/SOURCES/0076-lokdocview-Make-paintTile-async.patch new file mode 100644 index 0000000..0af3db4 --- /dev/null +++ b/SOURCES/0076-lokdocview-Make-paintTile-async.patch @@ -0,0 +1,239 @@ +From d52f669ccaad0522c52716779acddd2715be440e Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Sun, 19 Jul 2015 01:03:56 +0530 +Subject: [PATCH 076/398] lokdocview: Make paintTile() async + +Change-Id: I57db9e3adf26996e6e1e105b8b95f53e88e7760f +(cherry picked from commit 4edbf5a01fb8d93f3e6f2b9f7100a0c3d2eafa6e) +--- + libreofficekit/source/gtk/lokdocview.cxx | 12 ++++- + libreofficekit/source/gtk/tilebuffer.cxx | 91 ++++++++++++++++++++------------ + libreofficekit/source/gtk/tilebuffer.hxx | 28 ++++++++-- + 3 files changed, 91 insertions(+), 40 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 46b031950e8a..0740e04dd6c8 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -520,7 +520,7 @@ setTilesInvalid (LOKDocView* pDocView, const GdkRectangle& rRectangle) + + for (int i = aStart.x; i < aEnd.x; i++) + for (int j = aStart.y; j < aEnd.y; j++) +- priv->m_aTileBuffer.setInvalid(i, j); ++ priv->m_aTileBuffer.setInvalid(i, j, priv->m_fZoom); + } + + static gboolean +@@ -741,6 +741,12 @@ renderGraphicHandle(LOKDocView* pDocView, + } + } + ++static void ++renderDocumentCallback(GObject* source_object, GAsyncResult*, gpointer) ++{ ++ LOKDocView* pDocView = LOK_DOC_VIEW(source_object); ++ gtk_widget_queue_draw(GTK_WIDGET(pDocView)); ++} + + static gboolean + renderDocument(LOKDocView* pDocView, cairo_t* pCairo) +@@ -790,7 +796,9 @@ renderDocument(LOKDocView* pDocView, cairo_t* pCairo) + + if (bPaint) + { +- Tile& currentTile = priv->m_aTileBuffer.getTile(nRow, nColumn, priv->m_fZoom); ++ GTask* task = g_task_new(pDocView, NULL, renderDocumentCallback, NULL); ++ Tile& currentTile = priv->m_aTileBuffer.getTile(nRow, nColumn, priv->m_fZoom, task); ++ + GdkPixbuf* pPixBuf = currentTile.getBuffer(); + gdk_cairo_set_source_pixbuf (pCairo, pPixBuf, + twipToPixel(aTileRectangleTwips.x, priv->m_fZoom), +diff --git a/libreofficekit/source/gtk/tilebuffer.cxx b/libreofficekit/source/gtk/tilebuffer.cxx +index 60aa16f6c50a..d488f8b0516c 100644 +--- a/libreofficekit/source/gtk/tilebuffer.cxx ++++ b/libreofficekit/source/gtk/tilebuffer.cxx +@@ -27,6 +27,42 @@ float twipToPixel(float fInput, float zoom) + return fInput / 1440.0f * DPI * zoom; + } + ++static void getTileFunc(GTask*, gpointer, gpointer task_data, GCancellable*) ++{ ++ GdkPixbuf* pPixBuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, nTileSizePixels, nTileSizePixels); ++ GetTileCallbackData* pCallback = static_cast(task_data); ++ TileBuffer* buffer = pCallback->m_pBuffer; ++ int index = pCallback->m_nX * buffer->m_nWidth + pCallback->m_nY; ++ if (!pPixBuf) ++ { ++ g_info ("Error allocating memory to pixbuf"); ++ return; ++ } ++ ++ unsigned char* pBuffer = gdk_pixbuf_get_pixels(pPixBuf); ++ GdkRectangle aTileRectangle; ++ aTileRectangle.x = pixelToTwip(nTileSizePixels, pCallback->m_fZoom) * pCallback->m_nY; ++ aTileRectangle.y = pixelToTwip(nTileSizePixels, pCallback->m_fZoom) * pCallback->m_nX; ++ ++ g_test_timer_start(); ++ buffer->m_pLOKDocument->pClass->paintTile(buffer->m_pLOKDocument, ++ pBuffer, ++ nTileSizePixels, nTileSizePixels, ++ aTileRectangle.x, aTileRectangle.y, ++ pixelToTwip(nTileSizePixels, pCallback->m_fZoom), ++ pixelToTwip(nTileSizePixels, pCallback->m_fZoom)); ++ ++ double elapsedTime = g_test_timer_elapsed(); ++ g_info ("Rendered (%d, %d) in %f seconds", ++ pCallback->m_nX, ++ pCallback->m_nY, ++ elapsedTime); ++ ++ //create a mapping for it ++ buffer->m_mTiles[index].setPixbuf(pPixBuf); ++ buffer->m_mTiles[index].valid = true; ++} ++ + /* ---------------------------- + Tile class member functions + ---------------------------- +@@ -56,55 +92,42 @@ void TileBuffer::resetAllTiles() + std::map::iterator it = m_mTiles.begin(); + for (; it != m_mTiles.end(); ++it) + { +- it->second.release(); ++ it->second.valid = false; + } +- m_mTiles.clear(); + } + +-void TileBuffer::setInvalid(int x, int y) ++void TileBuffer::setInvalid(int x, int y, float fZoom) + { + int index = x * m_nWidth + y; + g_info("Setting tile invalid (%d, %d)", x, y); + if (m_mTiles.find(index) != m_mTiles.end()) + { + m_mTiles[index].valid = false; +- m_mTiles[index].release(); +- m_mTiles.erase(index); ++ GTask* task = g_task_new(this, NULL, NULL, NULL); ++ GetTileCallbackData* pCallback = new GetTileCallbackData(x, y, fZoom, this); ++ g_task_set_task_data(task, pCallback, g_free); ++ g_task_run_in_thread(task, getTileFunc); + } + } + +-Tile& TileBuffer::getTile(int x, int y, float aZoom) ++Tile& TileBuffer::getTile(int x, int y, float aZoom, GTask* task) + { + int index = x * m_nWidth + y; +- if(m_mTiles.find(index) == m_mTiles.end() || !m_mTiles[index].valid) +- { + +- GdkPixbuf* pPixBuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, nTileSizePixels, nTileSizePixels); +- if (!pPixBuf) +- { +- g_info ("Error allocating memory to pixbuf"); +- return m_mTiles[index]; +- } +- +- unsigned char* pBuffer = gdk_pixbuf_get_pixels(pPixBuf); +- GdkRectangle aTileRectangle; +- aTileRectangle.x = pixelToTwip(nTileSizePixels, aZoom) * y; +- aTileRectangle.y = pixelToTwip(nTileSizePixels, aZoom) * x; +- +- g_test_timer_start(); +- m_pLOKDocument->pClass->paintTile(m_pLOKDocument, +- pBuffer, +- nTileSizePixels, nTileSizePixels, +- aTileRectangle.x, aTileRectangle.y, +- pixelToTwip(nTileSizePixels, aZoom), +- pixelToTwip(nTileSizePixels, aZoom)); +- +- double elapsedTime = g_test_timer_elapsed(); +- g_info ("Rendered (%d, %d) in %f seconds", x, y, elapsedTime); +- +- //create a mapping for it +- m_mTiles[index].setPixbuf(pPixBuf); +- m_mTiles[index].valid = true; ++ if (m_mTiles.find(index) != m_mTiles.end() && !m_mTiles[index].valid) ++ { ++ GetTileCallbackData* pCallback = new GetTileCallbackData(x, y, aZoom, this); ++ g_task_set_task_data(task, pCallback, g_free); ++ g_task_run_in_thread(task, getTileFunc); ++ return m_mTiles[index]; ++ } ++ else if(m_mTiles.find(index) == m_mTiles.end()) ++ { ++ GetTileCallbackData* pCallback = new GetTileCallbackData(x, y, aZoom, this); ++ g_task_set_task_data(task, pCallback, g_free); ++ g_info ("running in thread new tile"); ++ g_task_run_in_thread(task, getTileFunc); ++ return m_DummyTile; + } + + return m_mTiles[index]; +diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx +index 6e6c0beb48f3..50de72d9d3b9 100644 +--- a/libreofficekit/source/gtk/tilebuffer.hxx ++++ b/libreofficekit/source/gtk/tilebuffer.hxx +@@ -86,7 +86,10 @@ class TileBuffer + int columns) + : m_pLOKDocument(document) + , m_nWidth(columns) +- { } ++ { ++ GdkPixbuf* pPixBuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, nTileSizePixels, nTileSizePixels); ++ m_DummyTile.setPixbuf(pPixBuf); ++ } + + ~TileBuffer() {} + +@@ -104,7 +107,7 @@ class TileBuffer + + @return the tile at the mentioned position (x, y) + */ +- Tile& getTile(int x, int y, float aZoom); ++ Tile& getTile(int x, int y, float aZoom, GTask*); + /// Destroys all the tiles in the tile buffer; also frees the memory allocated + /// for all the Tile objects. + void resetAllTiles(); +@@ -115,17 +118,34 @@ class TileBuffer + @param x the position of tile along x-axis + @param y the position of tile along y-axis + */ +- void setInvalid(int x, int y); ++ void setInvalid(int x, int y, float zoom); ++ + +- private: + /// Contains the reference to the LOK Document that this tile buffer is for. + LibreOfficeKitDocument *m_pLOKDocument; + /// Stores all the tiles cached by this tile buffer. + std::map m_mTiles; + /// Width of the current tile buffer (number of columns) + int m_nWidth; ++ /// Dummy tile ++ Tile m_DummyTile; + }; + ++struct GetTileCallbackData ++{ ++ int m_nX; ++ int m_nY; ++ float m_fZoom; ++ TileBuffer* m_pBuffer; ++ ++ GetTileCallbackData(int x, int y, float zoom, TileBuffer* buffer) ++ : m_nX(x), ++ m_nY(y), ++ m_fZoom(zoom), ++ m_pBuffer(buffer) { } ++}; ++ ++ + #endif // INCLUDED_TILEBUFFER_HXX + + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +-- +2.12.0 + diff --git a/SOURCES/0077-lokdocview-tilebuffer-Add-DOxygen-comments.patch b/SOURCES/0077-lokdocview-tilebuffer-Add-DOxygen-comments.patch new file mode 100644 index 0000000..81794bc --- /dev/null +++ b/SOURCES/0077-lokdocview-tilebuffer-Add-DOxygen-comments.patch @@ -0,0 +1,77 @@ +From 490b3e99671ae4fee3b4e4bb2cc9b40e66f26e3c Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Wed, 22 Jul 2015 20:25:36 +0530 +Subject: [PATCH 077/398] lokdocview, tilebuffer: Add DOxygen comments + +Change-Id: I27377f0a758729a7877cfc6a56ea1b4bb3d1c3c9 +(cherry picked from commit e032b64451347f5079c2a5bfbfda8d843db91e2d) +--- + libreofficekit/source/gtk/lokdocview.cxx | 12 ++++++++++++ + libreofficekit/source/gtk/tilebuffer.hxx | 5 +++++ + 2 files changed, 17 insertions(+) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 0740e04dd6c8..ddb3c386b0ca 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -36,6 +36,7 @@ + // Number of handles around a graphic selection. + #define GRAPHIC_HANDLE_COUNT 8 + ++/// Private struct used by this GObject type + struct _LOKDocViewPrivate + { + gchar* m_aLOPath; +@@ -162,6 +163,7 @@ G_DEFINE_TYPE_WITH_CODE (LOKDocView, lok_doc_view, GTK_TYPE_DRAWING_AREA, + + static GThreadPool* lokThreadPool; + ++/// Helper struct used to pass the data from soffice thread -> main thread. + struct CallbackData + { + int m_nType; +@@ -174,8 +176,16 @@ struct CallbackData + m_pDocView(pDocView) {} + }; + ++/** ++ A struct that we use to store the data about the LOK call. ++ ++ Object of this type is passed with all the LOK calls, ++ so that they can be idenitified. Additionally, it also contains ++ the data that LOK call needs. ++*/ + struct LOEvent + { ++ /// To identify the type of LOK call + int m_nType; + const gchar* m_pCommand; + const gchar* m_pArguments; +@@ -187,6 +197,8 @@ struct LOEvent + int m_nCharCode; + int m_nKeyCode; + ++ ++ /// Constructor to easily instantiate an object for LOK call of `type' type. + LOEvent(int type) + : m_nType(type) {} + +diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx +index 50de72d9d3b9..40fb2abbae6d 100644 +--- a/libreofficekit/source/gtk/tilebuffer.hxx ++++ b/libreofficekit/source/gtk/tilebuffer.hxx +@@ -131,6 +131,11 @@ class TileBuffer + Tile m_DummyTile; + }; + ++/** ++ Helper struct used to pass the data from main thread to spawned threads. ++ Spawned threads are responsible for calling paintTile, and store the result ++ in tile buffer. ++*/ + struct GetTileCallbackData + { + int m_nX; +-- +2.12.0 + diff --git a/SOURCES/0078-Use-thread-pool-for-LOK-call-paintTile.patch b/SOURCES/0078-Use-thread-pool-for-LOK-call-paintTile.patch new file mode 100644 index 0000000..c315bbf --- /dev/null +++ b/SOURCES/0078-Use-thread-pool-for-LOK-call-paintTile.patch @@ -0,0 +1,413 @@ +From aec82a6e59d9d1aef25507d07ded71570527fd19 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Fri, 24 Jul 2015 01:10:42 +0530 +Subject: [PATCH 078/398] Use thread pool for LOK call: paintTile() + +Change-Id: I45e94248013277affa11e91439fbc16995b8ed8e +(cherry picked from commit a7f12df929226ba43356d3d092851b07c84ae1c4) +--- + libreofficekit/source/gtk/lokdocview.cxx | 122 ++++++++++++++----------------- + libreofficekit/source/gtk/tilebuffer.cxx | 61 ++++------------ + libreofficekit/source/gtk/tilebuffer.hxx | 69 +++++++++++++---- + 3 files changed, 125 insertions(+), 127 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index ddb3c386b0ca..f32c3e10546e 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -135,16 +135,6 @@ enum + PROP_CAN_ZOOM_OUT + }; + +-enum +-{ +- LOK_LOAD_DOC, +- LOK_POST_COMMAND, +- LOK_SET_EDIT, +- LOK_SET_PARTMODE, +- LOK_SET_PART, +- LOK_POST_KEY +-}; +- + static guint doc_view_signals[LAST_SIGNAL] = { 0 }; + + static void lok_doc_view_initable_iface_init (GInitableIface *iface); +@@ -161,7 +151,7 @@ G_DEFINE_TYPE_WITH_CODE (LOKDocView, lok_doc_view, GTK_TYPE_DRAWING_AREA, + #pragma GCC diagnostic pop + #endif + +-static GThreadPool* lokThreadPool; ++GThreadPool* lokThreadPool; + + /// Helper struct used to pass the data from soffice thread -> main thread. + struct CallbackData +@@ -176,50 +166,6 @@ struct CallbackData + m_pDocView(pDocView) {} + }; + +-/** +- A struct that we use to store the data about the LOK call. +- +- Object of this type is passed with all the LOK calls, +- so that they can be idenitified. Additionally, it also contains +- the data that LOK call needs. +-*/ +-struct LOEvent +-{ +- /// To identify the type of LOK call +- int m_nType; +- const gchar* m_pCommand; +- const gchar* m_pArguments; +- gchar* m_pPath; +- gboolean m_bEdit; +- int m_nPartMode; +- int m_nPart; +- int m_nKeyEvent; +- int m_nCharCode; +- int m_nKeyCode; +- +- +- /// Constructor to easily instantiate an object for LOK call of `type' type. +- LOEvent(int type) +- : m_nType(type) {} +- +- LOEvent(int type, const gchar* pCommand, const gchar* pArguments) +- : m_nType(type), +- m_pCommand(pCommand), +- m_pArguments(pArguments) {} +- +- LOEvent(int type, const gchar* pPath) +- : m_nType(type) +- { +- m_pPath = g_strdup(pPath); +- } +- +- LOEvent(int type, int nKeyEvent, int nCharCode, int nKeyCode) +- : m_nType(type), +- m_nKeyEvent(nKeyEvent), +- m_nCharCode(nCharCode), +- m_nKeyCode(nKeyCode) {} +-}; +- + static void + payloadToSize(const char* pPayload, long& rWidth, long& rHeight) + { +@@ -529,10 +475,12 @@ setTilesInvalid (LOKDocView* pDocView, const GdkRectangle& rRectangle) + aStart.y = aRectanglePixels.x / nTileSizePixels; + aEnd.x = (aRectanglePixels.y + aRectanglePixels.height + nTileSizePixels) / nTileSizePixels; + aEnd.y = (aRectanglePixels.x + aRectanglePixels.width + nTileSizePixels) / nTileSizePixels; +- ++ GTask* task = g_task_new(pDocView, NULL, NULL, NULL); + for (int i = aStart.x; i < aEnd.x; i++) + for (int j = aStart.y; j < aEnd.y; j++) +- priv->m_aTileBuffer.setInvalid(i, j, priv->m_fZoom); ++ priv->m_aTileBuffer.setInvalid(i, j, priv->m_fZoom, task); ++ ++ g_object_unref(task); + } + + static gboolean +@@ -753,13 +701,6 @@ renderGraphicHandle(LOKDocView* pDocView, + } + } + +-static void +-renderDocumentCallback(GObject* source_object, GAsyncResult*, gpointer) +-{ +- LOKDocView* pDocView = LOK_DOC_VIEW(source_object); +- gtk_widget_queue_draw(GTK_WIDGET(pDocView)); +-} +- + static gboolean + renderDocument(LOKDocView* pDocView, cairo_t* pCairo) + { +@@ -808,14 +749,14 @@ renderDocument(LOKDocView* pDocView, cairo_t* pCairo) + + if (bPaint) + { +- GTask* task = g_task_new(pDocView, NULL, renderDocumentCallback, NULL); ++ GTask* task = g_task_new(pDocView, NULL, NULL, NULL); + Tile& currentTile = priv->m_aTileBuffer.getTile(nRow, nColumn, priv->m_fZoom, task); +- + GdkPixbuf* pPixBuf = currentTile.getBuffer(); + gdk_cairo_set_source_pixbuf (pCairo, pPixBuf, + twipToPixel(aTileRectangleTwips.x, priv->m_fZoom), + twipToPixel(aTileRectangleTwips.y, priv->m_fZoom)); + cairo_paint(pCairo); ++ g_object_unref(task); + } + } + } +@@ -1212,6 +1153,52 @@ lok_doc_view_post_command_in_thread (gpointer data) + } + + static void ++paintTileInThread (gpointer data) ++{ ++ GTask* task = G_TASK(data); ++ LOKDocView* pDocView = LOK_DOC_VIEW(g_task_get_source_object(task)); ++ LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOEvent* pLOEvent = static_cast(g_task_get_task_data(task)); ++ TileBuffer& buffer = priv->m_aTileBuffer; ++ int index = pLOEvent->m_nX * buffer.m_nWidth + pLOEvent->m_nY; ++ if (buffer.m_mTiles.find(index) != buffer.m_mTiles.end() && ++ buffer.m_mTiles[index].valid) ++ return; ++ ++ GdkPixbuf* pPixBuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, nTileSizePixels, nTileSizePixels); ++ if (!pPixBuf) ++ { ++ g_info ("Error allocating memory to pixbuf"); ++ return; ++ } ++ ++ unsigned char* pBuffer = gdk_pixbuf_get_pixels(pPixBuf); ++ GdkRectangle aTileRectangle; ++ aTileRectangle.x = pixelToTwip(nTileSizePixels, pLOEvent->m_fZoom) * pLOEvent->m_nY; ++ aTileRectangle.y = pixelToTwip(nTileSizePixels, pLOEvent->m_fZoom) * pLOEvent->m_nX; ++ ++ g_test_timer_start(); ++ priv->m_pDocument->pClass->paintTile(priv->m_pDocument, ++ pBuffer, ++ nTileSizePixels, nTileSizePixels, ++ aTileRectangle.x, aTileRectangle.y, ++ pixelToTwip(nTileSizePixels, pLOEvent->m_fZoom), ++ pixelToTwip(nTileSizePixels, pLOEvent->m_fZoom)); ++ ++ double elapsedTime = g_test_timer_elapsed(); ++ g_info ("Rendered (%d, %d) in %f seconds", ++ pLOEvent->m_nX, ++ pLOEvent->m_nY, ++ elapsedTime); ++ ++ //create a mapping for it ++ buffer.m_mTiles[index].setPixbuf(pPixBuf); ++ buffer.m_mTiles[index].valid = true; ++ gtk_widget_queue_draw(GTK_WIDGET(pDocView)); ++} ++ ++ ++static void + lokThreadFunc(gpointer data, gpointer /*user_data*/) + { + GTask* task = G_TASK(data); +@@ -1237,6 +1224,9 @@ lokThreadFunc(gpointer data, gpointer /*user_data*/) + case LOK_POST_KEY: + postKeyEventInThread(task); + break; ++ case LOK_PAINT_TILE: ++ paintTileInThread(task); ++ break; + } + + g_object_unref(task); +diff --git a/libreofficekit/source/gtk/tilebuffer.cxx b/libreofficekit/source/gtk/tilebuffer.cxx +index d488f8b0516c..a8594fc916f0 100644 +--- a/libreofficekit/source/gtk/tilebuffer.cxx ++++ b/libreofficekit/source/gtk/tilebuffer.cxx +@@ -13,6 +13,8 @@ + #define g_info(...) g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, __VA_ARGS__) + #endif + ++extern GThreadPool* lokThreadPool; ++ + /* ------------------ + Utility functions + ------------------ +@@ -27,42 +29,6 @@ float twipToPixel(float fInput, float zoom) + return fInput / 1440.0f * DPI * zoom; + } + +-static void getTileFunc(GTask*, gpointer, gpointer task_data, GCancellable*) +-{ +- GdkPixbuf* pPixBuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, nTileSizePixels, nTileSizePixels); +- GetTileCallbackData* pCallback = static_cast(task_data); +- TileBuffer* buffer = pCallback->m_pBuffer; +- int index = pCallback->m_nX * buffer->m_nWidth + pCallback->m_nY; +- if (!pPixBuf) +- { +- g_info ("Error allocating memory to pixbuf"); +- return; +- } +- +- unsigned char* pBuffer = gdk_pixbuf_get_pixels(pPixBuf); +- GdkRectangle aTileRectangle; +- aTileRectangle.x = pixelToTwip(nTileSizePixels, pCallback->m_fZoom) * pCallback->m_nY; +- aTileRectangle.y = pixelToTwip(nTileSizePixels, pCallback->m_fZoom) * pCallback->m_nX; +- +- g_test_timer_start(); +- buffer->m_pLOKDocument->pClass->paintTile(buffer->m_pLOKDocument, +- pBuffer, +- nTileSizePixels, nTileSizePixels, +- aTileRectangle.x, aTileRectangle.y, +- pixelToTwip(nTileSizePixels, pCallback->m_fZoom), +- pixelToTwip(nTileSizePixels, pCallback->m_fZoom)); +- +- double elapsedTime = g_test_timer_elapsed(); +- g_info ("Rendered (%d, %d) in %f seconds", +- pCallback->m_nX, +- pCallback->m_nY, +- elapsedTime); +- +- //create a mapping for it +- buffer->m_mTiles[index].setPixbuf(pPixBuf); +- buffer->m_mTiles[index].valid = true; +-} +- + /* ---------------------------- + Tile class member functions + ---------------------------- +@@ -96,17 +62,17 @@ void TileBuffer::resetAllTiles() + } + } + +-void TileBuffer::setInvalid(int x, int y, float fZoom) ++void TileBuffer::setInvalid(int x, int y, float fZoom, GTask* task) + { + int index = x * m_nWidth + y; + g_info("Setting tile invalid (%d, %d)", x, y); + if (m_mTiles.find(index) != m_mTiles.end()) + { + m_mTiles[index].valid = false; +- GTask* task = g_task_new(this, NULL, NULL, NULL); +- GetTileCallbackData* pCallback = new GetTileCallbackData(x, y, fZoom, this); +- g_task_set_task_data(task, pCallback, g_free); +- g_task_run_in_thread(task, getTileFunc); ++ ++ LOEvent* pLOEvent = new LOEvent(LOK_PAINT_TILE, x, y, fZoom); ++ g_task_set_task_data(task, pLOEvent, g_free); ++ g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); + } + } + +@@ -116,17 +82,16 @@ Tile& TileBuffer::getTile(int x, int y, float aZoom, GTask* task) + + if (m_mTiles.find(index) != m_mTiles.end() && !m_mTiles[index].valid) + { +- GetTileCallbackData* pCallback = new GetTileCallbackData(x, y, aZoom, this); +- g_task_set_task_data(task, pCallback, g_free); +- g_task_run_in_thread(task, getTileFunc); ++ LOEvent* pLOEvent = new LOEvent(LOK_PAINT_TILE, x, y, aZoom); ++ g_task_set_task_data(task, pLOEvent, g_free); ++ g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); + return m_mTiles[index]; + } + else if(m_mTiles.find(index) == m_mTiles.end()) + { +- GetTileCallbackData* pCallback = new GetTileCallbackData(x, y, aZoom, this); +- g_task_set_task_data(task, pCallback, g_free); +- g_info ("running in thread new tile"); +- g_task_run_in_thread(task, getTileFunc); ++ LOEvent* pLOEvent = new LOEvent(LOK_PAINT_TILE, x, y, aZoom); ++ g_task_set_task_data(task, pLOEvent, g_free); ++ g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); + return m_DummyTile; + } + +diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx +index 40fb2abbae6d..f23b02330616 100644 +--- a/libreofficekit/source/gtk/tilebuffer.hxx ++++ b/libreofficekit/source/gtk/tilebuffer.hxx +@@ -107,7 +107,7 @@ class TileBuffer + + @return the tile at the mentioned position (x, y) + */ +- Tile& getTile(int x, int y, float aZoom, GTask*); ++ Tile& getTile(int x, int y, float aZoom, GTask* task); + /// Destroys all the tiles in the tile buffer; also frees the memory allocated + /// for all the Tile objects. + void resetAllTiles(); +@@ -118,8 +118,7 @@ class TileBuffer + @param x the position of tile along x-axis + @param y the position of tile along y-axis + */ +- void setInvalid(int x, int y, float zoom); +- ++ void setInvalid(int x, int y, float zoom, GTask* task); + + /// Contains the reference to the LOK Document that this tile buffer is for. + LibreOfficeKitDocument *m_pLOKDocument; +@@ -131,26 +130,70 @@ class TileBuffer + Tile m_DummyTile; + }; + ++enum ++{ ++ LOK_LOAD_DOC, ++ LOK_POST_COMMAND, ++ LOK_SET_EDIT, ++ LOK_SET_PARTMODE, ++ LOK_SET_PART, ++ LOK_POST_KEY, ++ LOK_PAINT_TILE ++}; ++ + /** +- Helper struct used to pass the data from main thread to spawned threads. +- Spawned threads are responsible for calling paintTile, and store the result +- in tile buffer. ++ A struct that we use to store the data about the LOK call. ++ ++ Object of this type is passed with all the LOK calls, ++ so that they can be idenitified. Additionally, it also contains ++ the data that LOK call needs. + */ +-struct GetTileCallbackData ++struct LOEvent + { ++ /// To identify the type of LOK call ++ int m_nType; ++ const gchar* m_pCommand; ++ const gchar* m_pArguments; ++ gchar* m_pPath; ++ gboolean m_bEdit; ++ int m_nPartMode; ++ int m_nPart; ++ int m_nKeyEvent; ++ int m_nCharCode; ++ int m_nKeyCode; ++ + int m_nX; + int m_nY; + float m_fZoom; +- TileBuffer* m_pBuffer; + +- GetTileCallbackData(int x, int y, float zoom, TileBuffer* buffer) +- : m_nX(x), ++ /// Constructor to easily instantiate an object for LOK call of `type' type. ++ LOEvent(int type) ++ : m_nType(type) {} ++ ++ LOEvent(int type, const gchar* pCommand, const gchar* pArguments) ++ : m_nType(type), ++ m_pCommand(pCommand), ++ m_pArguments(pArguments) {} ++ ++ LOEvent(int type, const gchar* pPath) ++ : m_nType(type) ++ { ++ m_pPath = g_strdup(pPath); ++ } ++ ++ LOEvent(int type, int nKeyEvent, int nCharCode, int nKeyCode) ++ : m_nType(type), ++ m_nKeyEvent(nKeyEvent), ++ m_nCharCode(nCharCode), ++ m_nKeyCode(nKeyCode) {} ++ ++ LOEvent(int type, int x, int y, float zoom) ++ : m_nType(type), ++ m_nX(x), + m_nY(y), +- m_fZoom(zoom), +- m_pBuffer(buffer) { } ++ m_fZoom(zoom) {} + }; + +- + #endif // INCLUDED_TILEBUFFER_HXX + + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +-- +2.12.0 + diff --git a/SOURCES/0079-lokdocview-Cannot-use-same-GTask-object-for-all-call.patch b/SOURCES/0079-lokdocview-Cannot-use-same-GTask-object-for-all-call.patch new file mode 100644 index 0000000..585ea4c --- /dev/null +++ b/SOURCES/0079-lokdocview-Cannot-use-same-GTask-object-for-all-call.patch @@ -0,0 +1,38 @@ +From 82d1cdb5446334ddcd25cb61558d9974bd4c8e6f Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Sat, 25 Jul 2015 21:21:34 +0530 +Subject: [PATCH 079/398] lokdocview: Cannot use same GTask object for all + calls. + +Change-Id: I875d49a9e4360659087ae70456edefb15bc57b20 +(cherry picked from commit 57ec1780d654e335e09a6c64c4d48234f0556635) +--- + libreofficekit/source/gtk/lokdocview.cxx | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index f32c3e10546e..bebd5fdb5546 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -475,12 +475,15 @@ setTilesInvalid (LOKDocView* pDocView, const GdkRectangle& rRectangle) + aStart.y = aRectanglePixels.x / nTileSizePixels; + aEnd.x = (aRectanglePixels.y + aRectanglePixels.height + nTileSizePixels) / nTileSizePixels; + aEnd.y = (aRectanglePixels.x + aRectanglePixels.width + nTileSizePixels) / nTileSizePixels; +- GTask* task = g_task_new(pDocView, NULL, NULL, NULL); + for (int i = aStart.x; i < aEnd.x; i++) ++ { + for (int j = aStart.y; j < aEnd.y; j++) ++ { ++ GTask* task = g_task_new(pDocView, NULL, NULL, NULL); + priv->m_aTileBuffer.setInvalid(i, j, priv->m_fZoom, task); +- +- g_object_unref(task); ++ g_object_unref(task); ++ } ++ } + } + + static gboolean +-- +2.12.0 + diff --git a/SOURCES/0080-lokdocview-Follow-the-camelCase-naming-convention.patch b/SOURCES/0080-lokdocview-Follow-the-camelCase-naming-convention.patch new file mode 100644 index 0000000..afd6618 --- /dev/null +++ b/SOURCES/0080-lokdocview-Follow-the-camelCase-naming-convention.patch @@ -0,0 +1,88 @@ +From cd86f9867b9e4ad7b4a7cb73784b114de2551086 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Sun, 26 Jul 2015 17:22:13 +0530 +Subject: [PATCH 080/398] lokdocview: Follow the camelCase naming convention + +Change-Id: I05582d33ee3535d4b677fa8138c9d573585a4252 +(cherry picked from commit ee0f4f75d2d95aaed8995337947c4cc665722aaf) +--- + libreofficekit/source/gtk/lokdocview.cxx | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index bebd5fdb5546..e44f9b96886a 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -1050,7 +1050,7 @@ lok_doc_view_signal_motion (GtkWidget* pWidget, GdkEventMotion* pEvent) + } + + static void +-lok_doc_view_open_document_in_thread (gpointer data) ++openDocumentInThread (gpointer data) + { + GTask* task = G_TASK(data); + LOKDocView* pDocView = LOK_DOC_VIEW(g_task_get_source_object(task)); +@@ -1099,7 +1099,7 @@ lok_doc_view_open_document_in_thread (gpointer data) + } + + static void +-lok_doc_view_set_part_in_thread(gpointer data) ++setPartInThread(gpointer data) + { + GTask* task = G_TASK(data); + LOKDocView* pDocView = LOK_DOC_VIEW(g_task_get_source_object(task)); +@@ -1111,7 +1111,7 @@ lok_doc_view_set_part_in_thread(gpointer data) + } + + static void +-lok_doc_view_set_partmode_in_thread(gpointer data) ++setPartmodeInThread(gpointer data) + { + GTask* task = G_TASK(data); + LOKDocView* pDocView = LOK_DOC_VIEW(g_task_get_source_object(task)); +@@ -1123,7 +1123,7 @@ lok_doc_view_set_partmode_in_thread(gpointer data) + } + + static void +-lok_doc_view_set_edit_in_thread(gpointer data) ++setEditInThread(gpointer data) + { + GTask* task = G_TASK(data); + LOKDocView* pDocView = LOK_DOC_VIEW(g_task_get_source_object(task)); +@@ -1145,7 +1145,7 @@ lok_doc_view_set_edit_in_thread(gpointer data) + } + + static void +-lok_doc_view_post_command_in_thread (gpointer data) ++postCommandInThread (gpointer data) + { + GTask* task = G_TASK(data); + LOKDocView* pDocView = LOK_DOC_VIEW(g_task_get_source_object(task)); +@@ -1210,19 +1210,19 @@ lokThreadFunc(gpointer data, gpointer /*user_data*/) + switch (pLOEvent->m_nType) + { + case LOK_LOAD_DOC: +- lok_doc_view_open_document_in_thread (task); ++ openDocumentInThread(task); + break; + case LOK_POST_COMMAND: +- lok_doc_view_post_command_in_thread (task); ++ postCommandInThread(task); + break; + case LOK_SET_EDIT: +- lok_doc_view_set_edit_in_thread(task); ++ setEditInThread(task); + break; + case LOK_SET_PART: +- lok_doc_view_set_part_in_thread(task); ++ setPartInThread(task); + break; + case LOK_SET_PARTMODE: +- lok_doc_view_set_partmode_in_thread(task); ++ setPartmodeInThread(task); + break; + case LOK_POST_KEY: + postKeyEventInThread(task); +-- +2.12.0 + diff --git a/SOURCES/0081-lokdocview-Use-only-one-ctor-for-instantiating-LOEve.patch b/SOURCES/0081-lokdocview-Use-only-one-ctor-for-instantiating-LOEve.patch new file mode 100644 index 0000000..97ce1b2 --- /dev/null +++ b/SOURCES/0081-lokdocview-Use-only-one-ctor-for-instantiating-LOEve.patch @@ -0,0 +1,247 @@ +From a9ed2a81b472091a2f255cf1ffba6f48001f46d6 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Sun, 26 Jul 2015 18:24:02 +0530 +Subject: [PATCH 081/398] lokdocview: Use only one ctor for instantiating + LOEvent + +... and set each member variable manually. + +Additionally, improves documentation of the struct LOEvent. + +Change-Id: I2e8e1dc70298dc85943769e2f01c6127eedb8207 +(cherry picked from commit 4fb3d2e6be39fb3a7323b11a02adf853ed37a3ca) +--- + libreofficekit/source/gtk/lokdocview.cxx | 41 +++++++++++++++--------- + libreofficekit/source/gtk/tilebuffer.cxx | 17 +++++++--- + libreofficekit/source/gtk/tilebuffer.hxx | 54 +++++++++++++++----------------- + 3 files changed, 65 insertions(+), 47 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index e44f9b96886a..6bee2f513ae9 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -39,8 +39,8 @@ + /// Private struct used by this GObject type + struct _LOKDocViewPrivate + { +- gchar* m_aLOPath; +- gchar* m_aDocPath; ++ const gchar* m_aLOPath; ++ const gchar* m_aDocPath; + gdouble m_nLoadProgress; + gboolean m_bIsLoading; + gboolean m_bCanZoomIn; +@@ -302,7 +302,10 @@ signalKey (GtkWidget* pWidget, GdkEventKey* pEvent) + if (pEvent->type == GDK_KEY_RELEASE) + { + GTask* task = g_task_new(pDocView, NULL, NULL, NULL); +- LOEvent* pLOEvent = new LOEvent(LOK_POST_KEY, LOK_KEYEVENT_KEYUP, nCharCode, nKeyCode); ++ LOEvent* pLOEvent = new LOEvent(LOK_POST_KEY); ++ pLOEvent->m_nKeyEvent = LOK_KEYEVENT_KEYUP; ++ pLOEvent->m_nCharCode = nCharCode; ++ pLOEvent->m_nKeyCode = nKeyCode; + g_task_set_task_data(task, pLOEvent, g_free); + g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); + g_object_unref(task); +@@ -310,7 +313,10 @@ signalKey (GtkWidget* pWidget, GdkEventKey* pEvent) + else + { + GTask* task = g_task_new(pDocView, NULL, NULL, NULL); +- LOEvent* pLOEvent = new LOEvent(LOK_POST_KEY, LOK_KEYEVENT_KEYINPUT, nCharCode, nKeyCode); ++ LOEvent* pLOEvent = new LOEvent(LOK_POST_KEY); ++ pLOEvent->m_nKeyEvent = LOK_KEYEVENT_KEYINPUT; ++ pLOEvent->m_nCharCode = nCharCode; ++ pLOEvent->m_nKeyCode = nKeyCode; + g_task_set_task_data(task, pLOEvent, g_free); + g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); + g_object_unref(task); +@@ -1163,7 +1169,7 @@ paintTileInThread (gpointer data) + LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); + LOEvent* pLOEvent = static_cast(g_task_get_task_data(task)); + TileBuffer& buffer = priv->m_aTileBuffer; +- int index = pLOEvent->m_nX * buffer.m_nWidth + pLOEvent->m_nY; ++ int index = pLOEvent->m_nPaintTileX * buffer.m_nWidth + pLOEvent->m_nPaintTileY; + if (buffer.m_mTiles.find(index) != buffer.m_mTiles.end() && + buffer.m_mTiles[index].valid) + return; +@@ -1177,21 +1183,21 @@ paintTileInThread (gpointer data) + + unsigned char* pBuffer = gdk_pixbuf_get_pixels(pPixBuf); + GdkRectangle aTileRectangle; +- aTileRectangle.x = pixelToTwip(nTileSizePixels, pLOEvent->m_fZoom) * pLOEvent->m_nY; +- aTileRectangle.y = pixelToTwip(nTileSizePixels, pLOEvent->m_fZoom) * pLOEvent->m_nX; ++ aTileRectangle.x = pixelToTwip(nTileSizePixels, pLOEvent->m_fPaintTileZoom) * pLOEvent->m_nPaintTileY; ++ aTileRectangle.y = pixelToTwip(nTileSizePixels, pLOEvent->m_fPaintTileZoom) * pLOEvent->m_nPaintTileX; + + g_test_timer_start(); + priv->m_pDocument->pClass->paintTile(priv->m_pDocument, + pBuffer, + nTileSizePixels, nTileSizePixels, + aTileRectangle.x, aTileRectangle.y, +- pixelToTwip(nTileSizePixels, pLOEvent->m_fZoom), +- pixelToTwip(nTileSizePixels, pLOEvent->m_fZoom)); ++ pixelToTwip(nTileSizePixels, pLOEvent->m_fPaintTileZoom), ++ pixelToTwip(nTileSizePixels, pLOEvent->m_fPaintTileZoom)); + + double elapsedTime = g_test_timer_elapsed(); + g_info ("Rendered (%d, %d) in %f seconds", +- pLOEvent->m_nX, +- pLOEvent->m_nY, ++ pLOEvent->m_nPaintTileX, ++ pLOEvent->m_nPaintTileY, + elapsedTime); + + //create a mapping for it +@@ -1674,9 +1680,12 @@ lok_doc_view_open_document (LOKDocView* pDocView, + gpointer userdata) + { + GTask* task = g_task_new(pDocView, cancellable, callback, userdata); +- LOEvent* pLOEvent = new LOEvent(LOK_LOAD_DOC, pPath); + LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); +- priv->m_aDocPath = g_strdup(pPath); ++ ++ LOEvent* pLOEvent = new LOEvent(LOK_LOAD_DOC); ++ pLOEvent->m_pPath = pPath; ++ ++ priv->m_aDocPath = pPath; + g_task_set_task_data(task, pLOEvent, g_free); + + g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); +@@ -1836,9 +1845,11 @@ lok_doc_view_post_command (LOKDocView* pDocView, + { + + GTask* task = g_task_new(pDocView, NULL, NULL, NULL); +- LOEvent* pLOEvent = new LOEvent(LOK_POST_COMMAND, pCommand, pArguments); +- g_task_set_task_data(task, pLOEvent, g_free); ++ LOEvent* pLOEvent = new LOEvent(LOK_POST_COMMAND); ++ pLOEvent->m_pCommand = pCommand; ++ pLOEvent->m_pArguments = pArguments; + ++ g_task_set_task_data(task, pLOEvent, g_free); + g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); + g_object_unref(task); + } +diff --git a/libreofficekit/source/gtk/tilebuffer.cxx b/libreofficekit/source/gtk/tilebuffer.cxx +index a8594fc916f0..21ea58b0faff 100644 +--- a/libreofficekit/source/gtk/tilebuffer.cxx ++++ b/libreofficekit/source/gtk/tilebuffer.cxx +@@ -70,26 +70,35 @@ void TileBuffer::setInvalid(int x, int y, float fZoom, GTask* task) + { + m_mTiles[index].valid = false; + +- LOEvent* pLOEvent = new LOEvent(LOK_PAINT_TILE, x, y, fZoom); ++ LOEvent* pLOEvent = new LOEvent(LOK_PAINT_TILE); ++ pLOEvent->m_nPaintTileX = x; ++ pLOEvent->m_nPaintTileY = y; ++ pLOEvent->m_fPaintTileZoom = fZoom; + g_task_set_task_data(task, pLOEvent, g_free); + g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); + } + } + +-Tile& TileBuffer::getTile(int x, int y, float aZoom, GTask* task) ++Tile& TileBuffer::getTile(int x, int y, float fZoom, GTask* task) + { + int index = x * m_nWidth + y; + + if (m_mTiles.find(index) != m_mTiles.end() && !m_mTiles[index].valid) + { +- LOEvent* pLOEvent = new LOEvent(LOK_PAINT_TILE, x, y, aZoom); ++ LOEvent* pLOEvent = new LOEvent(LOK_PAINT_TILE); ++ pLOEvent->m_nPaintTileX = x; ++ pLOEvent->m_nPaintTileY = y; ++ pLOEvent->m_fPaintTileZoom = fZoom; + g_task_set_task_data(task, pLOEvent, g_free); + g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); + return m_mTiles[index]; + } + else if(m_mTiles.find(index) == m_mTiles.end()) + { +- LOEvent* pLOEvent = new LOEvent(LOK_PAINT_TILE, x, y, aZoom); ++ LOEvent* pLOEvent = new LOEvent(LOK_PAINT_TILE); ++ pLOEvent->m_nPaintTileX = x; ++ pLOEvent->m_nPaintTileY = y; ++ pLOEvent->m_fPaintTileZoom = fZoom; + g_task_set_task_data(task, pLOEvent, g_free); + g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); + return m_DummyTile; +diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx +index f23b02330616..6e57d2fe8bd5 100644 +--- a/libreofficekit/source/gtk/tilebuffer.hxx ++++ b/libreofficekit/source/gtk/tilebuffer.hxx +@@ -152,46 +152,44 @@ struct LOEvent + { + /// To identify the type of LOK call + int m_nType; ++ ++ /// @name post_command parameters ++ ///@{ + const gchar* m_pCommand; + const gchar* m_pArguments; +- gchar* m_pPath; ++ ///@} ++ ++ /// @name open_document parameter ++ ///@{ ++ const gchar* m_pPath; ++ ///@} ++ ++ /// set_edit parameter + gboolean m_bEdit; ++ ++ /// set_partmode parameter + int m_nPartMode; ++ ++ /// set_part parameter + int m_nPart; ++ ++ /// @name postKeyEvent parameters ++ ///@{ + int m_nKeyEvent; + int m_nCharCode; + int m_nKeyCode; ++ ///@} + +- int m_nX; +- int m_nY; +- float m_fZoom; ++ /// @name paintTile parameters ++ ///@{ ++ int m_nPaintTileX; ++ int m_nPaintTileY; ++ float m_fPaintTileZoom; ++ ///@} + +- /// Constructor to easily instantiate an object for LOK call of `type' type. ++ /// Constructor to instantiate an object of type `type`. + LOEvent(int type) + : m_nType(type) {} +- +- LOEvent(int type, const gchar* pCommand, const gchar* pArguments) +- : m_nType(type), +- m_pCommand(pCommand), +- m_pArguments(pArguments) {} +- +- LOEvent(int type, const gchar* pPath) +- : m_nType(type) +- { +- m_pPath = g_strdup(pPath); +- } +- +- LOEvent(int type, int nKeyEvent, int nCharCode, int nKeyCode) +- : m_nType(type), +- m_nKeyEvent(nKeyEvent), +- m_nCharCode(nCharCode), +- m_nKeyCode(nKeyCode) {} +- +- LOEvent(int type, int x, int y, float zoom) +- : m_nType(type), +- m_nX(x), +- m_nY(y), +- m_fZoom(zoom) {} + }; + + #endif // INCLUDED_TILEBUFFER_HXX +-- +2.12.0 + diff --git a/SOURCES/0082-lokdocview-Move-postMouseEvent-in-separate-LOK-threa.patch b/SOURCES/0082-lokdocview-Move-postMouseEvent-in-separate-LOK-threa.patch new file mode 100644 index 0000000..c815da5 --- /dev/null +++ b/SOURCES/0082-lokdocview-Move-postMouseEvent-in-separate-LOK-threa.patch @@ -0,0 +1,134 @@ +From 9ca320506308555b6b7fc7bbb3f82d76cdbf9a82 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Sun, 26 Jul 2015 22:23:46 +0530 +Subject: [PATCH 082/398] lokdocview: Move postMouseEvent in separate LOK + thread + +Change-Id: I9d1a08db2a91a596d3039a2388c22e6ea76dc2b1 +(cherry picked from commit de9224bf9686550e63876eb5ac1241b27c01bc25) +--- + libreofficekit/source/gtk/lokdocview.cxx | 52 ++++++++++++++++++++++++++++++-- + libreofficekit/source/gtk/tilebuffer.hxx | 11 ++++++- + 2 files changed, 59 insertions(+), 4 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 6bee2f513ae9..d23ac1af2fc1 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -958,7 +958,16 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + if ((pEvent->time - priv->m_nLastButtonPressTime) < 250) + nCount++; + priv->m_nLastButtonPressTime = pEvent->time; +- priv->m_pDocument->pClass->postMouseEvent(priv->m_pDocument, LOK_MOUSEEVENT_MOUSEBUTTONDOWN, pixelToTwip(pEvent->x, priv->m_fZoom), pixelToTwip(pEvent->y, priv->m_fZoom), nCount); ++ GTask* task = g_task_new(pDocView, NULL, NULL, NULL); ++ LOEvent* pLOEvent = new LOEvent(LOK_POST_MOUSE_EVENT); ++ pLOEvent->m_nPostMouseEventType = LOK_MOUSEEVENT_MOUSEBUTTONDOWN; ++ pLOEvent->m_nPostMouseEventX = pixelToTwip(pEvent->x, priv->m_fZoom); ++ pLOEvent->m_nPostMouseEventY = pixelToTwip(pEvent->y, priv->m_fZoom); ++ pLOEvent->m_nPostMouseEventCount = nCount; ++ g_task_set_task_data(task, pLOEvent, g_free); ++ ++ g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); ++ g_object_unref(task); + break; + } + case GDK_BUTTON_RELEASE: +@@ -967,7 +976,16 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + if ((pEvent->time - priv->m_nLastButtonReleaseTime) < 250) + nCount++; + priv->m_nLastButtonReleaseTime = pEvent->time; +- priv->m_pDocument->pClass->postMouseEvent(priv->m_pDocument, LOK_MOUSEEVENT_MOUSEBUTTONUP, pixelToTwip(pEvent->x, priv->m_fZoom), pixelToTwip(pEvent->y, priv->m_fZoom), nCount); ++ GTask* task = g_task_new(pDocView, NULL, NULL, NULL); ++ LOEvent* pLOEvent = new LOEvent(LOK_POST_MOUSE_EVENT); ++ pLOEvent->m_nPostMouseEventType = LOK_MOUSEEVENT_MOUSEBUTTONUP; ++ pLOEvent->m_nPostMouseEventX = pixelToTwip(pEvent->x, priv->m_fZoom); ++ pLOEvent->m_nPostMouseEventY = pixelToTwip(pEvent->y, priv->m_fZoom); ++ pLOEvent->m_nPostMouseEventCount = nCount; ++ g_task_set_task_data(task, pLOEvent, g_free); ++ ++ g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); ++ g_object_unref(task); + break; + } + default: +@@ -1050,12 +1068,37 @@ lok_doc_view_signal_motion (GtkWidget* pWidget, GdkEventMotion* pEvent) + } + + // Otherwise a mouse move, as on the desktop. +- priv->m_pDocument->pClass->postMouseEvent(priv->m_pDocument, LOK_MOUSEEVENT_MOUSEMOVE, pixelToTwip(pEvent->x, priv->m_fZoom), pixelToTwip(pEvent->y, priv->m_fZoom), 1); ++ ++ GTask* task = g_task_new(pDocView, NULL, NULL, NULL); ++ LOEvent* pLOEvent = new LOEvent(LOK_POST_MOUSE_EVENT); ++ pLOEvent->m_nPostMouseEventType = LOK_MOUSEEVENT_MOUSEMOVE; ++ pLOEvent->m_nPostMouseEventX = pixelToTwip(pEvent->x, priv->m_fZoom); ++ pLOEvent->m_nPostMouseEventY = pixelToTwip(pEvent->y, priv->m_fZoom); ++ pLOEvent->m_nPostMouseEventCount = 1; ++ g_task_set_task_data(task, pLOEvent, g_free); ++ ++ g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); ++ g_object_unref(task); + + return FALSE; + } + + static void ++postMouseEventInThread(gpointer data) ++{ ++ GTask* task = G_TASK(data); ++ LOKDocView* pDocView = LOK_DOC_VIEW(g_task_get_source_object(task)); ++ LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOEvent* pLOEvent = static_cast(g_task_get_task_data(task)); ++ ++ priv->m_pDocument->pClass->postMouseEvent(priv->m_pDocument, ++ pLOEvent->m_nPostMouseEventType, ++ pLOEvent->m_nPostMouseEventX, ++ pLOEvent->m_nPostMouseEventY, ++ pLOEvent->m_nPostMouseEventCount); ++} ++ ++static void + openDocumentInThread (gpointer data) + { + GTask* task = G_TASK(data); +@@ -1236,6 +1279,9 @@ lokThreadFunc(gpointer data, gpointer /*user_data*/) + case LOK_PAINT_TILE: + paintTileInThread(task); + break; ++ case LOK_POST_MOUSE_EVENT: ++ postMouseEventInThread(task); ++ break; + } + + g_object_unref(task); +diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx +index 6e57d2fe8bd5..aa496aaf3e8f 100644 +--- a/libreofficekit/source/gtk/tilebuffer.hxx ++++ b/libreofficekit/source/gtk/tilebuffer.hxx +@@ -138,7 +138,8 @@ enum + LOK_SET_PARTMODE, + LOK_SET_PART, + LOK_POST_KEY, +- LOK_PAINT_TILE ++ LOK_PAINT_TILE, ++ LOK_POST_MOUSE_EVENT + }; + + /** +@@ -187,6 +188,14 @@ struct LOEvent + float m_fPaintTileZoom; + ///@} + ++ /// @name postMouseEvent parameters ++ ///@{ ++ int m_nPostMouseEventType; ++ int m_nPostMouseEventX; ++ int m_nPostMouseEventY; ++ int m_nPostMouseEventCount; ++ ///@} ++ + /// Constructor to instantiate an object of type `type`. + LOEvent(int type) + : m_nType(type) {} +-- +2.12.0 + diff --git a/SOURCES/0083-lokdocview-setGraphicSelection-in-another-thread.patch b/SOURCES/0083-lokdocview-setGraphicSelection-in-another-thread.patch new file mode 100644 index 0000000..bcc92c7 --- /dev/null +++ b/SOURCES/0083-lokdocview-setGraphicSelection-in-another-thread.patch @@ -0,0 +1,157 @@ +From 3bb042ae678b26e234d19913846d695e8bfd8927 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Sun, 26 Jul 2015 22:39:43 +0530 +Subject: [PATCH 083/398] lokdocview: setGraphicSelection in another thread + +Change-Id: Ib7a6bf63ee6f300c6c5d50d02a3465d0a075a5be +(cherry picked from commit 7c45a57081a921b8f56812dd37c2fcd4b86d2a1a) +--- + libreofficekit/source/gtk/lokdocview.cxx | 68 ++++++++++++++++++++++++++++---- + libreofficekit/source/gtk/tilebuffer.hxx | 10 ++++- + 2 files changed, 70 insertions(+), 8 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index d23ac1af2fc1..edd2179495f0 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -889,7 +889,17 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + { + g_info("LOKDocView_Impl::signalButton: end of drag graphic handle #%d", i); + priv->m_bInDragGraphicHandles[i] = false; +- priv->m_pDocument->pClass->setGraphicSelection(priv->m_pDocument, LOK_SETGRAPHICSELECTION_END, pixelToTwip(pEvent->x, priv->m_fZoom), pixelToTwip(pEvent->y, priv->m_fZoom)); ++ ++ GTask* task = g_task_new(pDocView, NULL, NULL, NULL); ++ LOEvent* pLOEvent = new LOEvent(LOK_SET_GRAPHIC_SELECTION); ++ pLOEvent->m_nSetGraphicSelectionType = LOK_SETGRAPHICSELECTION_END; ++ pLOEvent->m_nSetGraphicSelectionX = pixelToTwip(pEvent->x, priv->m_fZoom); ++ pLOEvent->m_nSetGraphicSelectionY = pixelToTwip(pEvent->y, priv->m_fZoom); ++ g_task_set_task_data(task, pLOEvent, g_free); ++ ++ g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); ++ g_object_unref(task); ++ + return FALSE; + } + } +@@ -898,7 +908,17 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + { + g_info("LOKDocView_Impl::signalButton: end of drag graphic selection"); + priv->m_bInDragGraphicSelection = false; +- priv->m_pDocument->pClass->setGraphicSelection(priv->m_pDocument, LOK_SETGRAPHICSELECTION_END, pixelToTwip(pEvent->x, priv->m_fZoom), pixelToTwip(pEvent->y, priv->m_fZoom)); ++ ++ GTask* task = g_task_new(pDocView, NULL, NULL, NULL); ++ LOEvent* pLOEvent = new LOEvent(LOK_SET_GRAPHIC_SELECTION); ++ pLOEvent->m_nSetGraphicSelectionType = LOK_SETGRAPHICSELECTION_END; ++ pLOEvent->m_nSetGraphicSelectionX = pixelToTwip(pEvent->x, priv->m_fZoom); ++ pLOEvent->m_nSetGraphicSelectionY = pixelToTwip(pEvent->y, priv->m_fZoom); ++ g_task_set_task_data(task, pLOEvent, g_free); ++ ++ g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); ++ g_object_unref(task); ++ + return FALSE; + } + } +@@ -937,10 +957,17 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + { + g_info("LOKDocView_Impl::signalButton: start of drag graphic handle #%d", i); + priv->m_bInDragGraphicHandles[i] = true; +- priv->m_pDocument->pClass->setGraphicSelection(priv->m_pDocument, +- LOK_SETGRAPHICSELECTION_START, +- pixelToTwip(priv->m_aGraphicHandleRects[i].x + priv->m_aGraphicHandleRects[i].width / 2, priv->m_fZoom), +- pixelToTwip(priv->m_aGraphicHandleRects[i].y + priv->m_aGraphicHandleRects[i].height / 2, priv->m_fZoom)); ++ ++ GTask* task = g_task_new(pDocView, NULL, NULL, NULL); ++ LOEvent* pLOEvent = new LOEvent(LOK_SET_GRAPHIC_SELECTION); ++ pLOEvent->m_nSetGraphicSelectionType = LOK_SETGRAPHICSELECTION_START; ++ pLOEvent->m_nSetGraphicSelectionX = pixelToTwip(priv->m_aGraphicHandleRects[i].x + priv->m_aGraphicHandleRects[i].width / 2, priv->m_fZoom); ++ pLOEvent->m_nSetGraphicSelectionY = pixelToTwip(priv->m_aGraphicHandleRects[i].y + priv->m_aGraphicHandleRects[i].height / 2, priv->m_fZoom); ++ g_task_set_task_data(task, pLOEvent, g_free); ++ ++ g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); ++ g_object_unref(task); ++ + return FALSE; + } + } +@@ -1063,7 +1090,17 @@ lok_doc_view_signal_motion (GtkWidget* pWidget, GdkEventMotion* pEvent) + { + g_info("lcl_signalMotion: start of drag graphic selection"); + priv->m_bInDragGraphicSelection = true; +- priv->m_pDocument->pClass->setGraphicSelection(priv->m_pDocument, LOK_SETGRAPHICSELECTION_START, pixelToTwip(pEvent->x, priv->m_fZoom), pixelToTwip(pEvent->y, priv->m_fZoom)); ++ ++ GTask* task = g_task_new(pDocView, NULL, NULL, NULL); ++ LOEvent* pLOEvent = new LOEvent(LOK_SET_GRAPHIC_SELECTION); ++ pLOEvent->m_nSetGraphicSelectionType = LOK_SETGRAPHICSELECTION_START; ++ pLOEvent->m_nSetGraphicSelectionX = pixelToTwip(pEvent->x, priv->m_fZoom); ++ pLOEvent->m_nSetGraphicSelectionY = pixelToTwip(pEvent->y, priv->m_fZoom); ++ g_task_set_task_data(task, pLOEvent, g_free); ++ ++ g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); ++ g_object_unref(task); ++ + return FALSE; + } + +@@ -1084,6 +1121,20 @@ lok_doc_view_signal_motion (GtkWidget* pWidget, GdkEventMotion* pEvent) + } + + static void ++setGraphicSelectionInThread(gpointer data) ++{ ++ GTask* task = G_TASK(data); ++ LOKDocView* pDocView = LOK_DOC_VIEW(g_task_get_source_object(task)); ++ LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOEvent* pLOEvent = static_cast(g_task_get_task_data(task)); ++ ++ priv->m_pDocument->pClass->setGraphicSelection(priv->m_pDocument, ++ pLOEvent->m_nSetGraphicSelectionType, ++ pLOEvent->m_nSetGraphicSelectionX, ++ pLOEvent->m_nSetGraphicSelectionY); ++} ++ ++static void + postMouseEventInThread(gpointer data) + { + GTask* task = G_TASK(data); +@@ -1282,6 +1333,9 @@ lokThreadFunc(gpointer data, gpointer /*user_data*/) + case LOK_POST_MOUSE_EVENT: + postMouseEventInThread(task); + break; ++ case LOK_SET_GRAPHIC_SELECTION: ++ setGraphicSelectionInThread(task); ++ break; + } + + g_object_unref(task); +diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx +index aa496aaf3e8f..d2451b6c2290 100644 +--- a/libreofficekit/source/gtk/tilebuffer.hxx ++++ b/libreofficekit/source/gtk/tilebuffer.hxx +@@ -139,7 +139,8 @@ enum + LOK_SET_PART, + LOK_POST_KEY, + LOK_PAINT_TILE, +- LOK_POST_MOUSE_EVENT ++ LOK_POST_MOUSE_EVENT, ++ LOK_SET_GRAPHIC_SELECTION + }; + + /** +@@ -196,6 +197,13 @@ struct LOEvent + int m_nPostMouseEventCount; + ///@} + ++ /// @name setGraphicSelection parameters ++ ///@{ ++ int m_nSetGraphicSelectionType; ++ int m_nSetGraphicSelectionX; ++ int m_nSetGraphicSelectionY; ++ ///@} ++ + /// Constructor to instantiate an object of type `type`. + LOEvent(int type) + : m_nType(type) {} +-- +2.12.0 + diff --git a/SOURCES/0084-lokdocview-post_command-arguments-are-not-supposed-t.patch b/SOURCES/0084-lokdocview-post_command-arguments-are-not-supposed-t.patch new file mode 100644 index 0000000..0782d8e --- /dev/null +++ b/SOURCES/0084-lokdocview-post_command-arguments-are-not-supposed-t.patch @@ -0,0 +1,42 @@ +From 05fb507c0d86ad94da29826a3e61934cef476b92 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Mon, 27 Jul 2015 22:13:39 +0530 +Subject: [PATCH 084/398] lokdocview: post_command arguments are not supposed + to be const + +Change-Id: Ibc22d03d9eee9fd151ecf5773e36c2519141a5eb +(cherry picked from commit 2d2b392dcda5bdfab61a358dc1dd725d65fba07f) +--- + libreofficekit/source/gtk/lokdocview.cxx | 2 +- + libreofficekit/source/gtk/tilebuffer.hxx | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index edd2179495f0..b72a664c9320 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -1947,7 +1947,7 @@ lok_doc_view_post_command (LOKDocView* pDocView, + GTask* task = g_task_new(pDocView, NULL, NULL, NULL); + LOEvent* pLOEvent = new LOEvent(LOK_POST_COMMAND); + pLOEvent->m_pCommand = pCommand; +- pLOEvent->m_pArguments = pArguments; ++ pLOEvent->m_pArguments = g_strdup(pArguments); + + g_task_set_task_data(task, pLOEvent, g_free); + g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); +diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx +index d2451b6c2290..dabf72f9ea67 100644 +--- a/libreofficekit/source/gtk/tilebuffer.hxx ++++ b/libreofficekit/source/gtk/tilebuffer.hxx +@@ -158,7 +158,7 @@ struct LOEvent + /// @name post_command parameters + ///@{ + const gchar* m_pCommand; +- const gchar* m_pArguments; ++ gchar* m_pArguments; + ///@} + + /// @name open_document parameter +-- +2.12.0 + diff --git a/SOURCES/0085-libreofficekit-Werror-Wformat-security.patch b/SOURCES/0085-libreofficekit-Werror-Wformat-security.patch new file mode 100644 index 0000000..ac28720 --- /dev/null +++ b/SOURCES/0085-libreofficekit-Werror-Wformat-security.patch @@ -0,0 +1,27 @@ +From 435dcf370f19ea9b514c480a7c5a87b8cbc7b2d2 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 28 Jul 2015 16:35:02 +0200 +Subject: [PATCH 085/398] libreofficekit: -Werror,-Wformat-security + +Change-Id: I177ea091fb1061d9fa71f7fb1a84629128afd6a0 +(cherry picked from commit b120adb290cee480516b14683f314318573c9d7e) +--- + libreofficekit/source/gtk/lokdocview.cxx | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index b72a664c9320..cb77aa4097d0 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -1169,7 +1169,7 @@ openDocumentInThread (gpointer data) + // FIXME: should have a GError parameter and populate it. + char *pError = priv->m_pOffice->pClass->getError( priv->m_pOffice ); + fprintf( stderr, "Error opening document '%s'\n", pError ); +- g_task_return_new_error(task, 0, 0, pError); ++ g_task_return_new_error(task, 0, 0, "%s", pError); + } + else + { +-- +2.12.0 + diff --git a/SOURCES/0086-LOK-Implement-parts-for-Writer-too.patch b/SOURCES/0086-LOK-Implement-parts-for-Writer-too.patch new file mode 100644 index 0000000..ba321c1 --- /dev/null +++ b/SOURCES/0086-LOK-Implement-parts-for-Writer-too.patch @@ -0,0 +1,213 @@ +From fd9d67a7ad8b68399b5866406bd934829297a8d3 Mon Sep 17 00:00:00 2001 +From: Jan Holesovsky +Date: Sat, 1 Aug 2015 02:13:47 +0200 +Subject: [PATCH 086/398] LOK: Implement parts for Writer too. + +In Writer, the meaning of 'parts' is a bit different than in Calc or Impress. +In Writer, the parts mean pages, and the document does not give a completely +different view, the cursor just jumps to the given page. + +It is up to the client to follow the cursor appropriately to have the desired +effect. + +Change-Id: I56b3264e0340cd639bdabfa92b74b52bd1f391a5 +(cherry picked from commit 512b782cf466a19ed77d818fa660e1a0dc74fc35) +--- + .../qa/gtktiledviewer/gtktiledviewer.cxx | 8 ++++ + libreofficekit/source/gtk/lokdocview.cxx | 18 +++++++++ + sw/inc/unotxdoc.hxx | 8 ++++ + sw/inc/viscrs.hxx | 3 ++ + sw/source/core/crsr/viscrs.cxx | 12 ++++++ + sw/source/uibase/uno/unotxdoc.cxx | 44 ++++++++++++++++++++++ + 6 files changed, 93 insertions(+) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index a3999c09b29a..3399087cb6db 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -358,6 +358,13 @@ static void populatePartSelector() + lok_doc_view_get_part( LOK_DOC_VIEW(pDocView) ) ); + } + ++static void signalSize(LOKDocView* /*pLOKDocView*/, gpointer /*pData*/) ++{ ++ g_bPartSelectorBroadcast = false; ++ populatePartSelector(); ++ g_bPartSelectorBroadcast = true; ++} ++ + static void changePart( GtkWidget* pSelector, gpointer /* pItem */ ) + { + int nPart = gtk_combo_box_get_active( GTK_COMBO_BOX(pSelector) ); +@@ -566,6 +573,7 @@ int main( int argc, char* argv[] ) + g_signal_connect(pDocView, "command-changed", G_CALLBACK(signalCommand), NULL); + g_signal_connect(pDocView, "search-not-found", G_CALLBACK(signalSearch), NULL); + g_signal_connect(pDocView, "part-changed", G_CALLBACK(signalPart), NULL); ++ g_signal_connect(pDocView, "size-changed", G_CALLBACK(signalSize), NULL); + g_signal_connect(pDocView, "hyperlink-clicked", G_CALLBACK(signalHyperlink), NULL); + + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index cb77aa4097d0..bdae55fc54e0 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -114,6 +114,7 @@ enum + COMMAND_CHANGED, + SEARCH_NOT_FOUND, + PART_CHANGED, ++ SIZE_CHANGED, + HYPERLINK_CLICKED, + + LAST_SIGNAL +@@ -581,6 +582,8 @@ callback (gpointer pData) + gtk_widget_set_size_request(GTK_WIDGET(pDocView), + twipToPixel(priv->m_nDocumentWidthTwips, priv->m_fZoom), + twipToPixel(priv->m_nDocumentHeightTwips, priv->m_fZoom)); ++ ++ g_signal_emit(pDocView, doc_view_signals[SIZE_CHANGED], 0, NULL); + } + break; + case LOK_CALLBACK_SET_PART: +@@ -1707,6 +1710,21 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + G_TYPE_INT); + + /** ++ * LOKDocView::size-changed: ++ * @pDocView: the #LOKDocView on which the signal is emitted ++ * @aCommand: NULL, we just notify that want to notify the UI elements that are interested. ++ */ ++ doc_view_signals[SIZE_CHANGED] = ++ g_signal_new("size-changed", ++ G_TYPE_FROM_CLASS(pGObjectClass), ++ G_SIGNAL_RUN_FIRST, ++ 0, ++ NULL, NULL, ++ g_cclosure_marshal_VOID__VOID, ++ G_TYPE_NONE, 1, ++ G_TYPE_INT); ++ ++ /** + * LOKDocView::hyperlinked-clicked: + * @pDocView: the #LOKDocView on which the signal is emitted + * @aHyperlink: the URI which the application should handle +diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx +index c90a852ac8ee..9f0b03b3af38 100644 +--- a/sw/inc/unotxdoc.hxx ++++ b/sw/inc/unotxdoc.hxx +@@ -407,6 +407,14 @@ public: + long nTileHeight ) SAL_OVERRIDE; + /// @see vcl::ITiledRenderable::getDocumentSize(). + virtual Size getDocumentSize() SAL_OVERRIDE; ++ /// @see vcl::ITiledRenderable::setPart(). ++ virtual void setPart(int nPart) SAL_OVERRIDE; ++ /// @see vcl::ITiledRenderable::getParts(). ++ virtual int getParts() SAL_OVERRIDE; ++ /// @see vcl::ITiledRenderable::getPart(). ++ virtual int getPart() SAL_OVERRIDE; ++ /// @see vcl::ITiledRenderable::getPartName(). ++ virtual OUString getPartName(int nPart) SAL_OVERRIDE; + /// @see vcl::ITiledRenderable::initializeForTiledRendering(). + virtual void initializeForTiledRendering() SAL_OVERRIDE; + /// @see vcl::ITiledRenderable::registerCallback(). +diff --git a/sw/inc/viscrs.hxx b/sw/inc/viscrs.hxx +index 159fb2ffbc41..525b551b9867 100644 +--- a/sw/inc/viscrs.hxx ++++ b/sw/inc/viscrs.hxx +@@ -43,6 +43,9 @@ class SwVisCrsr + vcl::Cursor m_aTextCrsr; + const SwCrsrShell* m_pCrsrShell; + ++ /// For LibreOfficeKit only - remember what page we were at the last time. ++ sal_uInt16 m_nPageLastTime; ++ + void _SetPosAndShow(); + + public: +diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx +index 3e92ce5ef4e5..e0d32cc86e11 100644 +--- a/sw/source/core/crsr/viscrs.cxx ++++ b/sw/source/core/crsr/viscrs.cxx +@@ -67,6 +67,7 @@ MapMode* SwSelPaintRects::s_pMapMode = 0; + // Starting from here: classes / methods for the non-text-cursor + SwVisCrsr::SwVisCrsr( const SwCrsrShell * pCShell ) + : m_pCrsrShell( pCShell ) ++ , m_nPageLastTime(0) + { + pCShell->GetWin()->SetCursor( &m_aTextCrsr ); + m_bIsVisible = m_aTextCrsr.IsVisible(); +@@ -179,6 +180,17 @@ void SwVisCrsr::_SetPosAndShow() + + if (m_pCrsrShell->isTiledRendering()) + { ++ // notify about page number change (if that happened) ++ sal_uInt16 nPage, nVirtPage; ++ const_cast(m_pCrsrShell)->GetPageNum(nPage, nVirtPage); ++ if (nPage != m_nPageLastTime) ++ { ++ m_nPageLastTime = nPage; ++ OString aPayload = OString::number(nPage - 1); ++ m_pCrsrShell->libreOfficeKitCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); ++ } ++ ++ // notify about the cursor position & size + Rectangle aSVRect(aRect.Pos().getX(), aRect.Pos().getY(), aRect.Pos().getX() + aRect.SSize().Width(), aRect.Pos().getY() + aRect.SSize().Height()); + OString sRect = aSVRect.toString(); + m_pCrsrShell->libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, sRect.getStr()); +diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx +index 450650d26c13..0dbde54f9144 100644 +--- a/sw/source/uibase/uno/unotxdoc.cxx ++++ b/sw/source/uibase/uno/unotxdoc.cxx +@@ -3154,6 +3154,50 @@ Size SwXTextDocument::getDocumentSize() + aDocSize.Height() + 2L * DOCUMENTBORDER); + } + ++void SwXTextDocument::setPart(int nPart) ++{ ++ SolarMutexGuard aGuard; ++ ++ SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); ++ if (!pWrtShell) ++ return; ++ ++ pWrtShell->GotoPage(nPart + 1, true); ++} ++ ++int SwXTextDocument::getParts() ++{ ++ SolarMutexGuard aGuard; ++ ++ SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); ++ if (!pWrtShell) ++ return 0; ++ ++ return pWrtShell->GetPageCnt(); ++} ++ ++int SwXTextDocument::getPart() ++{ ++ SolarMutexGuard aGuard; ++ ++ SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); ++ if (!pWrtShell) ++ return 0; ++ ++ sal_uInt16 nPage, nLogPage; ++ OUString sDisplay; ++ pWrtShell->GetPageNumber(-1, pWrtShell->IsCrsrVisible(), nPage, nLogPage, sDisplay); ++ ++ return nPage - 1; ++} ++ ++OUString SwXTextDocument::getPartName(int nPart) ++{ ++ SolarMutexGuard aGuard; ++ ++ return OUString(SW_RES(STR_PAGE)) + OUString::number(nPart + 1); ++} ++ + void SwXTextDocument::initializeForTiledRendering() + { + SolarMutexGuard aGuard; +-- +2.12.0 + diff --git a/SOURCES/0087-Removed-some-whole-page-invalidations-in-impress.patch b/SOURCES/0087-Removed-some-whole-page-invalidations-in-impress.patch new file mode 100644 index 0000000..66a0f6c --- /dev/null +++ b/SOURCES/0087-Removed-some-whole-page-invalidations-in-impress.patch @@ -0,0 +1,60 @@ +From 41fe248a52c4685a4f59dd18bb9885f3576fd0ed Mon Sep 17 00:00:00 2001 +From: Mihai Varga +Date: Fri, 31 Jul 2015 18:24:33 +0300 +Subject: [PATCH 087/398] Removed some whole page invalidations in impress + +1. For tiled rendering, don't invalidate the whole page when hiding it +2. Don't invalidate when showing a page because we've just hidden the +previous one +3. No need for invalidation when setting visible layers + +Change-Id: I858401b22c95093c58ec00896fe92b766fddb6de +Reviewed-on: https://gerrit.libreoffice.org/17452 +Tested-by: Jenkins +Reviewed-by: Jan Holesovsky +(cherry picked from commit a381d16d23d0efb678e9e410db3ad23313693640) +--- + include/svx/svdpagv.hxx | 2 +- + svx/source/svdraw/svdpagv.cxx | 6 ++++-- + 2 files changed, 5 insertions(+), 3 deletions(-) + +diff --git a/include/svx/svdpagv.hxx b/include/svx/svdpagv.hxx +index 8bf305f6be60..f28e3e7cb79d 100644 +--- a/include/svx/svdpagv.hxx ++++ b/include/svx/svdpagv.hxx +@@ -216,7 +216,7 @@ public: + void PagePosToLogic(Point& rPnt) const { rPnt+=aPgOrg; } + void PagePosToLogic(Rectangle& rRect) const { rRect.Move(aPgOrg.X(),aPgOrg.Y()); } + +- void SetVisibleLayers(const SetOfByte& rSet) { aLayerVisi=rSet; InvalidateAllWin(); } ++ void SetVisibleLayers(const SetOfByte& rSet) { aLayerVisi=rSet; } + const SetOfByte& GetVisibleLayers() const { return aLayerVisi; } + void SetPrintableLayers(const SetOfByte& rSet) { aLayerPrn=rSet; } + const SetOfByte& GetPrintableLayers() const { return aLayerPrn; } +diff --git a/svx/source/svdraw/svdpagv.cxx b/svx/source/svdraw/svdpagv.cxx +index e8caa445fe9c..9c74d433e1c9 100644 +--- a/svx/source/svdraw/svdpagv.cxx ++++ b/svx/source/svdraw/svdpagv.cxx +@@ -229,7 +229,6 @@ void SdrPageView::Show() + if(!IsVisible()) + { + mbVisible = true; +- InvalidateAllWin(); + + for(sal_uInt32 a(0L); a < GetView().PaintWindowCount(); a++) + { +@@ -242,7 +241,10 @@ void SdrPageView::Hide() + { + if(IsVisible()) + { +- InvalidateAllWin(); ++ if (!GetView().GetModel()->isTiledRendering()) ++ { ++ InvalidateAllWin(); ++ } + mbVisible = false; + ClearPageWindows(); + } +-- +2.12.0 + diff --git a/SOURCES/0088-coverity-1315075-Uninitialized-pointer-field.patch b/SOURCES/0088-coverity-1315075-Uninitialized-pointer-field.patch new file mode 100644 index 0000000..6cc2494 --- /dev/null +++ b/SOURCES/0088-coverity-1315075-Uninitialized-pointer-field.patch @@ -0,0 +1,48 @@ +From fba4131c0f03038ec07aec11d7fe2ffea4c14a94 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= +Date: Mon, 3 Aug 2015 20:15:18 +0100 +Subject: [PATCH 088/398] coverity#1315075 Uninitialized pointer field + +Change-Id: I4e933b458ca26b2a92d4953ca6cd6220dd730cf9 +(cherry picked from commit 1bc0cd0ee0251d42a6cbe75e5d86de4366f59029) +--- + libreofficekit/source/gtk/tilebuffer.hxx | 23 ++++++++++++++++++++++- + 1 file changed, 22 insertions(+), 1 deletion(-) + +diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx +index dabf72f9ea67..b00724367b8d 100644 +--- a/libreofficekit/source/gtk/tilebuffer.hxx ++++ b/libreofficekit/source/gtk/tilebuffer.hxx +@@ -206,7 +206,28 @@ struct LOEvent + + /// Constructor to instantiate an object of type `type`. + LOEvent(int type) +- : m_nType(type) {} ++ : m_nType(type) ++ , m_pCommand(0) ++ , m_pArguments(0) ++ , m_pPath(0) ++ , m_bEdit(false) ++ , m_nPartMode(0) ++ , m_nPart(0) ++ , m_nKeyEvent(0) ++ , m_nCharCode(0) ++ , m_nKeyCode(0) ++ , m_nPaintTileX(0) ++ , m_nPaintTileY(0) ++ , m_fPaintTileZoom(0) ++ , m_nPostMouseEventType(0) ++ , m_nPostMouseEventX(0) ++ , m_nPostMouseEventY(0) ++ , m_nPostMouseEventCount(0) ++ , m_nSetGraphicSelectionType(0) ++ , m_nSetGraphicSelectionX(0) ++ , m_nSetGraphicSelectionY(0) ++ { ++ } + }; + + #endif // INCLUDED_TILEBUFFER_HXX +-- +2.12.0 + diff --git a/SOURCES/0089-lokdocview-Don-t-use-extern-variable-lokThreadPool.patch b/SOURCES/0089-lokdocview-Don-t-use-extern-variable-lokThreadPool.patch new file mode 100644 index 0000000..46fbfc5 --- /dev/null +++ b/SOURCES/0089-lokdocview-Don-t-use-extern-variable-lokThreadPool.patch @@ -0,0 +1,304 @@ +From ade489c20e735224810e79ede6ef37bbbe8d56c0 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Wed, 29 Jul 2015 21:41:56 +0530 +Subject: [PATCH 089/398] lokdocview: Don't use extern variable: lokThreadPool + +Change-Id: Ia208e3309bb64baf71ceb97cdf1b3b57b6120353 +(cherry picked from commit 4df957f7255cf2ddce47a088dd30f945db6975be) +--- + libreofficekit/source/gtk/lokdocview.cxx | 53 +++++++++++++++++--------------- + libreofficekit/source/gtk/tilebuffer.cxx | 8 ++--- + libreofficekit/source/gtk/tilebuffer.hxx | 15 +++++++-- + 3 files changed, 44 insertions(+), 32 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index bdae55fc54e0..364590167f56 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -49,6 +49,7 @@ struct _LOKDocViewPrivate + LibreOfficeKitDocument* m_pDocument; + + TileBuffer m_aTileBuffer; ++ GThreadPool* lokThreadPool; + + gfloat m_fZoom; + glong m_nDocumentWidthTwips; +@@ -152,8 +153,6 @@ G_DEFINE_TYPE_WITH_CODE (LOKDocView, lok_doc_view, GTK_TYPE_DRAWING_AREA, + #pragma GCC diagnostic pop + #endif + +-GThreadPool* lokThreadPool; +- + /// Helper struct used to pass the data from soffice thread -> main thread. + struct CallbackData + { +@@ -308,7 +307,7 @@ signalKey (GtkWidget* pWidget, GdkEventKey* pEvent) + pLOEvent->m_nCharCode = nCharCode; + pLOEvent->m_nKeyCode = nKeyCode; + g_task_set_task_data(task, pLOEvent, g_free); +- g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); ++ g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); + g_object_unref(task); + } + else +@@ -319,7 +318,7 @@ signalKey (GtkWidget* pWidget, GdkEventKey* pEvent) + pLOEvent->m_nCharCode = nCharCode; + pLOEvent->m_nKeyCode = nKeyCode; + g_task_set_task_data(task, pLOEvent, g_free); +- g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); ++ g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); + g_object_unref(task); + } + +@@ -487,7 +486,7 @@ setTilesInvalid (LOKDocView* pDocView, const GdkRectangle& rRectangle) + for (int j = aStart.y; j < aEnd.y; j++) + { + GTask* task = g_task_new(pDocView, NULL, NULL, NULL); +- priv->m_aTileBuffer.setInvalid(i, j, priv->m_fZoom, task); ++ priv->m_aTileBuffer.setInvalid(i, j, priv->m_fZoom, task, priv->lokThreadPool); + g_object_unref(task); + } + } +@@ -762,7 +761,7 @@ renderDocument(LOKDocView* pDocView, cairo_t* pCairo) + if (bPaint) + { + GTask* task = g_task_new(pDocView, NULL, NULL, NULL); +- Tile& currentTile = priv->m_aTileBuffer.getTile(nRow, nColumn, priv->m_fZoom, task); ++ Tile& currentTile = priv->m_aTileBuffer.getTile(nRow, nColumn, priv->m_fZoom, task, priv->lokThreadPool); + GdkPixbuf* pPixBuf = currentTile.getBuffer(); + gdk_cairo_set_source_pixbuf (pCairo, pPixBuf, + twipToPixel(aTileRectangleTwips.x, priv->m_fZoom), +@@ -900,7 +899,7 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + pLOEvent->m_nSetGraphicSelectionY = pixelToTwip(pEvent->y, priv->m_fZoom); + g_task_set_task_data(task, pLOEvent, g_free); + +- g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); ++ g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); + g_object_unref(task); + + return FALSE; +@@ -919,7 +918,7 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + pLOEvent->m_nSetGraphicSelectionY = pixelToTwip(pEvent->y, priv->m_fZoom); + g_task_set_task_data(task, pLOEvent, g_free); + +- g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); ++ g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); + g_object_unref(task); + + return FALSE; +@@ -968,7 +967,7 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + pLOEvent->m_nSetGraphicSelectionY = pixelToTwip(priv->m_aGraphicHandleRects[i].y + priv->m_aGraphicHandleRects[i].height / 2, priv->m_fZoom); + g_task_set_task_data(task, pLOEvent, g_free); + +- g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); ++ g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); + g_object_unref(task); + + return FALSE; +@@ -996,7 +995,7 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + pLOEvent->m_nPostMouseEventCount = nCount; + g_task_set_task_data(task, pLOEvent, g_free); + +- g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); ++ g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); + g_object_unref(task); + break; + } +@@ -1014,7 +1013,7 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + pLOEvent->m_nPostMouseEventCount = nCount; + g_task_set_task_data(task, pLOEvent, g_free); + +- g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); ++ g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); + g_object_unref(task); + break; + } +@@ -1101,7 +1100,7 @@ lok_doc_view_signal_motion (GtkWidget* pWidget, GdkEventMotion* pEvent) + pLOEvent->m_nSetGraphicSelectionY = pixelToTwip(pEvent->y, priv->m_fZoom); + g_task_set_task_data(task, pLOEvent, g_free); + +- g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); ++ g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); + g_object_unref(task); + + return FALSE; +@@ -1117,7 +1116,7 @@ lok_doc_view_signal_motion (GtkWidget* pWidget, GdkEventMotion* pEvent) + pLOEvent->m_nPostMouseEventCount = 1; + g_task_set_task_data(task, pLOEvent, g_free); + +- g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); ++ g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); + g_object_unref(task); + + return FALSE; +@@ -1355,6 +1354,12 @@ static void lok_doc_view_init (LOKDocView* pDocView) + |GDK_BUTTON_MOTION_MASK + |GDK_KEY_PRESS_MASK + |GDK_KEY_RELEASE_MASK); ++ ++ priv->lokThreadPool = g_thread_pool_new(lokThreadFunc, ++ NULL, ++ 1, ++ FALSE, ++ NULL); + } + + static void lok_doc_view_set_property (GObject* object, guint propId, const GValue *value, GParamSpec *pspec) +@@ -1738,12 +1743,6 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, 1, + G_TYPE_STRING); +- +- lokThreadPool = g_thread_pool_new(lokThreadFunc, +- NULL, +- 1, +- FALSE, +- NULL); + } + + /** +@@ -1806,7 +1805,7 @@ lok_doc_view_open_document (LOKDocView* pDocView, + priv->m_aDocPath = pPath; + g_task_set_task_data(task, pLOEvent, g_free); + +- g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); ++ g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); + g_object_unref(task); + } + +@@ -1878,12 +1877,14 @@ lok_doc_view_get_part (LOKDocView* pDocView) + SAL_DLLPUBLIC_EXPORT void + lok_doc_view_set_part (LOKDocView* pDocView, int nPart) + { ++ LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private (pDocView)); + GTask* task = g_task_new(pDocView, NULL, NULL, NULL); + LOEvent* pLOEvent = new LOEvent(LOK_SET_PART); ++ + pLOEvent->m_nPart = nPart; + g_task_set_task_data(task, pLOEvent, g_free); + +- g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); ++ g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); + g_object_unref(task); + } + +@@ -1898,12 +1899,13 @@ SAL_DLLPUBLIC_EXPORT void + lok_doc_view_set_partmode(LOKDocView* pDocView, + int nPartMode) + { ++ LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private (pDocView)); + GTask* task = g_task_new(pDocView, NULL, NULL, NULL); + LOEvent* pLOEvent = new LOEvent(LOK_SET_PARTMODE); + pLOEvent->m_nPartMode = nPartMode; + g_task_set_task_data(task, pLOEvent, g_free); + +- g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); ++ g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); + g_object_unref(task); + } + +@@ -1926,12 +1928,13 @@ SAL_DLLPUBLIC_EXPORT void + lok_doc_view_set_edit(LOKDocView* pDocView, + gboolean bEdit) + { ++ LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private (pDocView)); + GTask* task = g_task_new(pDocView, NULL, NULL, NULL); + LOEvent* pLOEvent = new LOEvent(LOK_SET_EDIT); + pLOEvent->m_bEdit = bEdit; + g_task_set_task_data(task, pLOEvent, g_free); + +- g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); ++ g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); + g_object_unref(task); + } + +@@ -1961,14 +1964,14 @@ lok_doc_view_post_command (LOKDocView* pDocView, + const gchar* pCommand, + const gchar* pArguments) + { +- ++ LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private (pDocView)); + GTask* task = g_task_new(pDocView, NULL, NULL, NULL); + LOEvent* pLOEvent = new LOEvent(LOK_POST_COMMAND); + pLOEvent->m_pCommand = pCommand; + pLOEvent->m_pArguments = g_strdup(pArguments); + + g_task_set_task_data(task, pLOEvent, g_free); +- g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); ++ g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); + g_object_unref(task); + } + +diff --git a/libreofficekit/source/gtk/tilebuffer.cxx b/libreofficekit/source/gtk/tilebuffer.cxx +index 21ea58b0faff..85f6eb0422c2 100644 +--- a/libreofficekit/source/gtk/tilebuffer.cxx ++++ b/libreofficekit/source/gtk/tilebuffer.cxx +@@ -13,8 +13,6 @@ + #define g_info(...) g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, __VA_ARGS__) + #endif + +-extern GThreadPool* lokThreadPool; +- + /* ------------------ + Utility functions + ------------------ +@@ -62,7 +60,8 @@ void TileBuffer::resetAllTiles() + } + } + +-void TileBuffer::setInvalid(int x, int y, float fZoom, GTask* task) ++void TileBuffer::setInvalid(int x, int y, float fZoom, GTask* task, ++ GThreadPool* lokThreadPool) + { + int index = x * m_nWidth + y; + g_info("Setting tile invalid (%d, %d)", x, y); +@@ -79,7 +78,8 @@ void TileBuffer::setInvalid(int x, int y, float fZoom, GTask* task) + } + } + +-Tile& TileBuffer::getTile(int x, int y, float fZoom, GTask* task) ++Tile& TileBuffer::getTile(int x, int y, float fZoom, GTask* task, ++ GThreadPool* lokThreadPool) + { + int index = x * m_nWidth + y; + +diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx +index b00724367b8d..d4e7120e6587 100644 +--- a/libreofficekit/source/gtk/tilebuffer.hxx ++++ b/libreofficekit/source/gtk/tilebuffer.hxx +@@ -103,11 +103,15 @@ class TileBuffer + + @param x the tile along the x-axis of the buffer + @param y the tile along the y-axis of the buffer +- @param aZoom This function needs the zoom factor to draw the tile using paintTile() ++ @param aZoom current zoom factor of the document ++ @param task GTask object containing the necessary data ++ @param pool GThreadPool managed by the widget instance used for all the ++ LOK calls made by widget. It is needed here because getTile invokes one ++ of the LOK call : paintTile. + + @return the tile at the mentioned position (x, y) + */ +- Tile& getTile(int x, int y, float aZoom, GTask* task); ++ Tile& getTile(int x, int y, float aZoom, GTask* task, GThreadPool* pool); + /// Destroys all the tiles in the tile buffer; also frees the memory allocated + /// for all the Tile objects. + void resetAllTiles(); +@@ -117,8 +121,13 @@ class TileBuffer + + @param x the position of tile along x-axis + @param y the position of tile along y-axis ++ @param zoom zoom factor of the document ++ @param task GTask object containing the necessary data ++ @param pool GThreadPool managed by the widget instance used for all the ++ LOK calls made by widget. It is needed here because setInvalid() invokes one ++ of the LOK call : paintTile. + */ +- void setInvalid(int x, int y, float zoom, GTask* task); ++ void setInvalid(int x, int y, float zoom, GTask* task, GThreadPool*); + + /// Contains the reference to the LOK Document that this tile buffer is for. + LibreOfficeKitDocument *m_pLOKDocument; +-- +2.12.0 + diff --git a/SOURCES/0090-LOKit-set-thread-name-lo_startmain.patch b/SOURCES/0090-LOKit-set-thread-name-lo_startmain.patch new file mode 100644 index 0000000..98bd50e --- /dev/null +++ b/SOURCES/0090-LOKit-set-thread-name-lo_startmain.patch @@ -0,0 +1,29 @@ +From 9d18b66a61ab8adb0ed6614a4538afa20b9e732e Mon Sep 17 00:00:00 2001 +From: Henry Castro +Date: Thu, 6 Aug 2015 11:40:28 -0400 +Subject: [PATCH 090/398] LOKit: set thread name lo_startmain + +It is necessary the thread name for debugging LOKit threads. + +Change-Id: I713595eb1319234ff90a6eddebcac5ebad912b04 +(cherry picked from commit 21531da576eca7ef9cb2ee78d1643b25d5f86ae3) +--- + desktop/source/lib/init.cxx | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index aa8e27c7f48f..abd8ca0b640b 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -942,6 +942,8 @@ static bool initialize_uno(const OUString& aAppProgramURL) + + static void lo_startmain(void*) + { ++ osl_setThreadName("lo_startmain"); ++ + soffice_main(); + } + +-- +2.12.0 + diff --git a/SOURCES/0091-tdf-93154-Save-button-often-does-not-save.patch b/SOURCES/0091-tdf-93154-Save-button-often-does-not-save.patch new file mode 100644 index 0000000..5e170cd --- /dev/null +++ b/SOURCES/0091-tdf-93154-Save-button-often-does-not-save.patch @@ -0,0 +1,90 @@ +From 72189a2e2d875772e83eb7c110540f224262eec9 Mon Sep 17 00:00:00 2001 +From: Mihai Varga +Date: Wed, 12 Aug 2015 10:32:07 +0300 +Subject: [PATCH 091/398] tdf#93154: Save button often does not save + +The problem is that in tiled rendering LO doesn't always consider the +document to be modified. Some operations such as Bold, Italic, etc do +not mark the document as being modified, but we need to be able to save +the changes. This solved the issue by always allowing to save. + +Change-Id: Iaf8120abadc768a07b24f42c287c50080b4e4d89 +Reviewed-on: https://gerrit.libreoffice.org/17665 +Reviewed-by: Jan Holesovsky +Tested-by: Jan Holesovsky +(cherry picked from commit e5ba9090f4809906ffa1c1dea352161cb988b97f) +--- + sc/source/ui/unoobj/docuno.cxx | 4 ++++ + sd/source/ui/unoidl/unomodel.cxx | 4 ++++ + sw/source/uibase/uno/unotxdoc.cxx | 4 ++++ + 3 files changed, 12 insertions(+) + +diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx +index e1235b90cb7a..84b2857b6542 100644 +--- a/sc/source/ui/unoobj/docuno.cxx ++++ b/sc/source/ui/unoobj/docuno.cxx +@@ -44,6 +44,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -839,6 +840,9 @@ void ScModelObj::initializeForTiledRendering() + aInputOptions.SetTextWysiwyg(true); + SC_MOD()->SetInputOptions(aInputOptions); + pDocShell->CalcOutputFactor(); ++ // tdf#93154: in tiled rendering LO doesn't always detect changes ++ SvtMiscOptions aMiscOpt; ++ aMiscOpt.SetSaveAlwaysAllowed(true); + } + + uno::Any SAL_CALL ScModelObj::queryInterface( const uno::Type& rType ) +diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx +index 4148035c899a..0e88a099e081 100644 +--- a/sd/source/ui/unoidl/unomodel.cxx ++++ b/sd/source/ui/unoidl/unomodel.cxx +@@ -60,6 +60,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -2388,6 +2389,9 @@ void SdXImpressDocument::initializeForTiledRendering() + pWindow->EnableMapMode(false); + } + } ++ // tdf#93154: in tiled rendering LO doesn't always detect changes ++ SvtMiscOptions aMiscOpt; ++ aMiscOpt.SetSaveAlwaysAllowed(true); + } + + void SdXImpressDocument::registerCallback(LibreOfficeKitCallback pCallback, void* pData) +diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx +index 0dbde54f9144..d6315d2964ae 100644 +--- a/sw/source/uibase/uno/unotxdoc.cxx ++++ b/sw/source/uibase/uno/unotxdoc.cxx +@@ -136,6 +136,7 @@ + #include + + #include ++#include + #include + #include + #include +@@ -3235,6 +3236,9 @@ void SwXTextDocument::initializeForTiledRendering() + // directly in twips. + SwEditWin& rEditWin = pDocShell->GetView()->GetEditWin(); + rEditWin.EnableMapMode(false); ++ // tdf#93154: in tiled rendering LO doesn't always detect changes ++ SvtMiscOptions aMiscOpt; ++ aMiscOpt.SetSaveAlwaysAllowed(true); + } + + void SwXTextDocument::registerCallback(LibreOfficeKitCallback pCallback, void* pData) +-- +2.12.0 + diff --git a/SOURCES/0092-sc-LOK_CALLBACK_DOCUMENT_SIZE_CHANGED-callback.patch b/SOURCES/0092-sc-LOK_CALLBACK_DOCUMENT_SIZE_CHANGED-callback.patch new file mode 100644 index 0000000..3e57f0f --- /dev/null +++ b/SOURCES/0092-sc-LOK_CALLBACK_DOCUMENT_SIZE_CHANGED-callback.patch @@ -0,0 +1,54 @@ +From d5adff883259a0f4128e6c88fe96a33aabd579c9 Mon Sep 17 00:00:00 2001 +From: Henry Castro +Date: Thu, 13 Aug 2015 14:00:47 -0400 +Subject: [PATCH 092/398] sc: LOK_CALLBACK_DOCUMENT_SIZE_CHANGED callback + +Handle the LOK_CALLBACK_DOCUMENT_SIZE_CHANGED callback. + +Change-Id: I855b1e23cfc6ec66e2a0eec603e38e9dd1e28cc5 +(cherry picked from commit 8f6c7f3ca1baa6c29161cbbe41494c03b0a9d000) +--- + sc/source/ui/view/tabview5.cxx | 19 +++++++++++++++++++ + 1 file changed, 19 insertions(+) + +diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx +index 768c4b39d5a6..5644feaf7a2e 100644 +--- a/sc/source/ui/view/tabview5.cxx ++++ b/sc/source/ui/view/tabview5.cxx +@@ -51,7 +51,10 @@ + #include + #include + ++#include + #include ++#include ++ + + using namespace com::sun::star; + +@@ -298,6 +301,22 @@ void ScTabView::TabChanged( bool bSameTabButMoved ) + pImp->SheetChanged( bSameTabButMoved ); + } + } ++ ++ if (comphelper::LibreOfficeKit::isActive()) ++ { ++ ScDocShell* pDocSh; ++ ScModelObj* pModelObj; ++ ++ if ( ( pDocSh = GetViewData().GetDocShell() ) && ++ ( pModelObj = ScModelObj::getImplementation( pDocSh->GetModel() )) ) ++ { ++ Size aDocSize = pModelObj->getDocumentSize(); ++ std::stringstream ss; ++ ss << aDocSize.Width() << ", " << aDocSize.Height(); ++ OString sRect = ss.str().c_str(); ++ pDocSh->libreOfficeKitCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, sRect.getStr()); ++ } ++ } + } + + void ScTabView::UpdateLayerLocks() +-- +2.12.0 + diff --git a/SOURCES/0093-sc-fix-LOKit-invalidate-setPart.patch b/SOURCES/0093-sc-fix-LOKit-invalidate-setPart.patch new file mode 100644 index 0000000..0b154fe --- /dev/null +++ b/SOURCES/0093-sc-fix-LOKit-invalidate-setPart.patch @@ -0,0 +1,44 @@ +From b797ad256580c32b36f6bdce797ef67edf394dcf Mon Sep 17 00:00:00 2001 +From: Henry Castro +Date: Thu, 13 Aug 2015 16:08:46 -0400 +Subject: [PATCH 093/398] sc: fix LOKit invalidate setPart + +The bindings invalidate correct tiles. + +Change-Id: Id28a7a78157030243ef1ad798daba9583746f0d3 +(cherry picked from commit 6609b05765e674f2f4694854097a5318b617fd54) +--- + sc/source/ui/unoobj/docuno.cxx | 17 ++++++++++++++++- + 1 file changed, 16 insertions(+), 1 deletion(-) + +diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx +index 84b2857b6542..1a59f887b7d7 100644 +--- a/sc/source/ui/unoobj/docuno.cxx ++++ b/sc/source/ui/unoobj/docuno.cxx +@@ -496,7 +496,22 @@ void ScModelObj::paintTile( VirtualDevice& rDevice, + void ScModelObj::setPart( int nPart ) + { + ScViewData* pViewData = ScDocShell::GetViewData(); +- pViewData->SetTabNo( nPart ); ++ SfxUInt16Item aItem( SID_CURRENTTAB, nPart + 1 ); ++ SfxDispatcher& rDisp = pViewData->GetDispatcher(); ++ ++ rDisp.Execute( SID_CURRENTTAB, SfxCallMode::SLOT | SfxCallMode::RECORD, &aItem, nullptr ); ++ ++ SfxBindings& rBind = pViewData->GetBindings(); ++ rBind.Invalidate( FID_FILL_TAB ); ++ rBind.Invalidate( FID_TAB_DESELECTALL ); ++ rBind.Invalidate( FID_INS_TABLE ); ++ rBind.Invalidate( FID_TAB_APPEND ); ++ rBind.Invalidate( FID_TAB_MOVE ); ++ rBind.Invalidate( FID_TAB_RENAME ); ++ rBind.Invalidate( FID_DELETE_TABLE ); ++ rBind.Invalidate( FID_TABLE_SHOW ); ++ rBind.Invalidate( FID_TABLE_HIDE ); ++ rBind.Invalidate( FID_TAB_SET_TAB_BG_COLOR ); + } + + int ScModelObj::getParts() +-- +2.12.0 + diff --git a/SOURCES/0094-gtktiledviewer-Jump-to-cursor-position-when-it-chang.patch b/SOURCES/0094-gtktiledviewer-Jump-to-cursor-position-when-it-chang.patch new file mode 100644 index 0000000..7c63b9f --- /dev/null +++ b/SOURCES/0094-gtktiledviewer-Jump-to-cursor-position-when-it-chang.patch @@ -0,0 +1,183 @@ +From 35bc0137636c6d1c537188b909d173e523786ff9 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Sat, 15 Aug 2015 18:48:11 +0530 +Subject: [PATCH 094/398] gtktiledviewer: Jump to cursor position when it + changes + +Change-Id: If50ac0bd21e59b0e0639aa353513451e88ae2a9f +(cherry picked from commit a9b266aeea80423210618fe4c015e4791ceb1bc2) +--- + .../qa/gtktiledviewer/gtktiledviewer.cxx | 85 +++++++++++++++++----- + libreofficekit/source/gtk/lokdocview.cxx | 25 +++++++ + 2 files changed, 93 insertions(+), 17 deletions(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 3399087cb6db..57d0c113d6ac 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -57,6 +57,25 @@ static void lcl_registerToolItem(GtkToolItem* pItem, const std::string& rName) + + const float fZooms[] = { 0.25, 0.5, 0.75, 1.0, 1.5, 2.0, 3.0, 5.0 }; + ++ ++/// Get the visible area of the scrolled window ++static void getVisibleAreaTwips(GdkRectangle* pArea) ++{ ++#if GTK_CHECK_VERSION(2,14,0) // we need gtk_adjustment_get_page_size() ++ GtkAdjustment* pHAdjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(pScrolledWindow)); ++ GtkAdjustment* pVAdjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(pScrolledWindow)); ++ ++ pArea->x = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView), ++ gtk_adjustment_get_value(pHAdjustment)); ++ pArea->y = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView), ++ gtk_adjustment_get_value(pVAdjustment)); ++ pArea->width = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView), ++ gtk_adjustment_get_page_size(pHAdjustment)); ++ pArea->height = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView), ++ gtk_adjustment_get_page_size(pVAdjustment)); ++#endif ++} ++ + static void changeZoom( GtkWidget* pButton, gpointer /* pItem */ ) + { + const char *sName = gtk_tool_button_get_icon_name( GTK_TOOL_BUTTON(pButton) ); +@@ -174,23 +193,6 @@ static void doCopy(GtkWidget* /*pButton*/, gpointer /*pItem*/) + free(pSelection); + } + +-/// Get the visible area of the scrolled window +-static void getVisibleAreaTwips(GdkRectangle* pArea) +-{ +-#if GTK_CHECK_VERSION(2,14,0) // we need gtk_adjustment_get_page_size() +- GtkAdjustment* pHAdjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(pScrolledWindow)); +- GtkAdjustment* pVAdjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(pScrolledWindow)); +- +- pArea->x = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView), +- gtk_adjustment_get_value(pHAdjustment)); +- pArea->y = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView), +- gtk_adjustment_get_value(pVAdjustment)); +- pArea->width = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView), +- gtk_adjustment_get_page_size(pHAdjustment)); +- pArea->height = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView), +- gtk_adjustment_get_page_size(pVAdjustment)); +-#endif +-} + + /// Searches for the next or previous text of pFindbarEntry. + static void doSearch(bool bBackwards) +@@ -318,6 +320,54 @@ static void signalHyperlink(LOKDocView* /*pLOKDocView*/, char* pPayload, gpointe + } + } + ++/// Cursor position changed ++static void cursorChanged(LOKDocView* /*pDocView*/, gint nX, gint nY, ++ gint /*nWidth*/, gint /*nHeight*/, gpointer /*pData*/) ++{ ++ GtkAdjustment* vadj = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(pScrolledWindow)); ++ GtkAdjustment* hadj = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(pScrolledWindow)); ++ GdkRectangle visArea; ++ gdouble upper; ++ gint x = -1, y = -1; ++ ++ getVisibleAreaTwips(&visArea); ++ ++ // check vertically ++ if (nY < visArea.y) ++ { ++ y = nY - visArea.height/2; ++ if (y < 0) ++ y = gtk_adjustment_get_lower(vadj); ++ } ++ else if (nY > visArea.y + visArea.height) ++ { ++ y = nY - visArea.height/2; ++ upper = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView), gtk_adjustment_get_upper(vadj)); ++ if (y > upper) ++ y = upper; ++ ++ } ++ ++ if (nX < visArea.x) ++ { ++ x = nX - visArea.width/2; ++ if (x < 0) ++ x = gtk_adjustment_get_lower(hadj); ++ } ++ else if (nX > visArea.x + visArea.width) ++ { ++ x = nX - visArea.width/2; ++ upper = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView), gtk_adjustment_get_upper(hadj)); ++ if (x > upper) ++ x = upper; ++ } ++ ++ if (y!=-1) ++ gtk_adjustment_set_value(vadj, lok_doc_view_twip_to_pixel(LOK_DOC_VIEW(pDocView), y)); ++ if (x!=-1) ++ gtk_adjustment_set_value(hadj, lok_doc_view_twip_to_pixel(LOK_DOC_VIEW(pDocView), x)); ++} ++ + static void toggleToolItem(GtkWidget* pWidget, gpointer /*pData*/) + { + if (g_bToolItemBroadcast) +@@ -575,6 +625,7 @@ int main( int argc, char* argv[] ) + g_signal_connect(pDocView, "part-changed", G_CALLBACK(signalPart), NULL); + g_signal_connect(pDocView, "size-changed", G_CALLBACK(signalSize), NULL); + g_signal_connect(pDocView, "hyperlink-clicked", G_CALLBACK(signalHyperlink), NULL); ++ g_signal_connect(pDocView, "cursor-changed", G_CALLBACK(cursorChanged), NULL); + + + // Scrolled window for DocView +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 364590167f56..859e96b29e20 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -117,6 +117,7 @@ enum + PART_CHANGED, + SIZE_CHANGED, + HYPERLINK_CLICKED, ++ CURSOR_CHANGED, + + LAST_SIGNAL + }; +@@ -518,6 +519,11 @@ callback (gpointer pData) + { + priv->m_aVisibleCursor = payloadToRectangle(pDocView, pCallback->m_aPayload.c_str()); + priv->m_bCursorOverlayVisible = true; ++ g_signal_emit(pDocView, doc_view_signals[CURSOR_CHANGED], 0, ++ priv->m_aVisibleCursor.x, ++ priv->m_aVisibleCursor.y, ++ priv->m_aVisibleCursor.width, ++ priv->m_aVisibleCursor.height); + gtk_widget_queue_draw(GTK_WIDGET(pDocView)); + } + break; +@@ -1743,6 +1749,25 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, 1, + G_TYPE_STRING); ++ ++ /** ++ * LOKDocView::cursor-changed: ++ * @pDocView: the #LOKDocView on which the signal is emitted ++ * @nX: The new cursor position (X coordinate) in pixels ++ * @nY: The new cursor position (Y coordinate) in pixels ++ * @nWidth: The width of new cursor ++ * @nHeight: The height of new cursor ++ */ ++ doc_view_signals[CURSOR_CHANGED] = ++ g_signal_new("cursor-changed", ++ G_TYPE_FROM_CLASS(pGObjectClass), ++ G_SIGNAL_RUN_FIRST, ++ 0, ++ NULL, NULL, ++ g_cclosure_marshal_generic, ++ G_TYPE_NONE, 4, ++ G_TYPE_INT, G_TYPE_INT, ++ G_TYPE_INT, G_TYPE_INT); + } + + /** +-- +2.12.0 + diff --git a/SOURCES/0095-lok-Document-getStyles-method.patch b/SOURCES/0095-lok-Document-getStyles-method.patch new file mode 100644 index 0000000..b3b3115 --- /dev/null +++ b/SOURCES/0095-lok-Document-getStyles-method.patch @@ -0,0 +1,192 @@ +From 642f6386a1a73c13ed3997f54a737385e8894992 Mon Sep 17 00:00:00 2001 +From: Mihai Varga +Date: Mon, 17 Aug 2015 18:49:40 +0300 +Subject: [PATCH 095/398] lok::Document getStyles method + +This method returns a JSON mapping of style families to a list of styles +from the corresponding family. +Will be used to know and apply styles in tiledrendering. + +Change-Id: I0aa395c40b9573920ade44255f97c077475ae5f1 +(cherry picked from commit c5a516bd1bf0216ee39f31322369f6bffdf464eb) +--- + desktop/source/lib/init.cxx | 34 ++++++++++++++++++++++++++++++ + include/LibreOfficeKit/LibreOfficeKit.h | 3 +++ + include/LibreOfficeKit/LibreOfficeKit.hxx | 8 +++++++ + libreofficekit/qa/unit/tiledrendering.cxx | 35 +++++++++++++++++++++++++++++++ + 4 files changed, 80 insertions(+) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index abd8ca0b640b..51302d1f8466 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -35,11 +35,13 @@ + #include + + #include ++#include + #include + #include + #include + #include + #include ++#include + #include + #include + +@@ -233,6 +235,7 @@ static void doc_setGraphicSelection (LibreOfficeKitDocument* pThis, + int nX, + int nY); + static void doc_resetSelection (LibreOfficeKitDocument* pThis); ++static char* doc_getStyles(LibreOfficeKitDocument* pThis); + + struct LibLODocument_Impl : public _LibreOfficeKitDocument + { +@@ -267,6 +270,7 @@ struct LibLODocument_Impl : public _LibreOfficeKitDocument + m_pDocumentClass->getTextSelection = doc_getTextSelection; + m_pDocumentClass->setGraphicSelection = doc_setGraphicSelection; + m_pDocumentClass->resetSelection = doc_resetSelection; ++ m_pDocumentClass->getStyles = doc_getStyles; + + gDocumentClass = m_pDocumentClass; + } +@@ -864,6 +868,36 @@ static void doc_resetSelection(LibreOfficeKitDocument* pThis) + pDoc->resetSelection(); + } + ++static char* doc_getStyles(LibreOfficeKitDocument* pThis) ++{ ++ LibLODocument_Impl* pDocument = static_cast(pThis); ++ ++ boost::property_tree::ptree aTree; ++ uno::Reference xStyleFamiliesSupplier(pDocument->mxComponent, uno::UNO_QUERY); ++ uno::Reference xStyleFamilies(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY); ++ uno::Sequence aStyleFamilies = xStyleFamilies->getElementNames(); ++ ++ for (sal_Int32 nStyleFam = 0; nStyleFam < aStyleFamilies.getLength(); ++nStyleFam) ++ { ++ boost::property_tree::ptree aChildren; ++ OUString sStyleFam = aStyleFamilies[nStyleFam]; ++ uno::Reference xStyleFamily(xStyleFamilies->getByName(sStyleFam), uno::UNO_QUERY); ++ uno::Sequence aStyles = xStyleFamily->getElementNames(); ++ for (sal_Int32 nInd = 0; nInd < aStyles.getLength(); ++nInd) ++ { ++ boost::property_tree::ptree aChild; ++ aChild.put("", aStyles[nInd]); ++ aChildren.push_back(std::make_pair("", aChild)); ++ } ++ aTree.add_child(sStyleFam.toUtf8().getStr(), aChildren); ++ } ++ std::stringstream aStream; ++ boost::property_tree::write_json(aStream, aTree); ++ char* pJson = static_cast(malloc(aStream.str().size() + 1)); ++ strcpy(pJson, aStream.str().c_str()); ++ pJson[aStream.str().size()] = '\0'; ++ return pJson; ++} + static char* lo_getError (LibreOfficeKit *pThis) + { + LibLibreOffice_Impl* pLib = static_cast(pThis); +diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h +index e3b485052444..af7155c4db67 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.h ++++ b/include/LibreOfficeKit/LibreOfficeKit.h +@@ -159,6 +159,9 @@ struct _LibreOfficeKitDocumentClass + + /// @see lok::Document::resetSelection + void (*resetSelection) (LibreOfficeKitDocument* pThis); ++ ++ /// @see lok::Document:getStyles ++ char* (*getStyles) (LibreOfficeKitDocument* pThis); + #endif // LOK_USE_UNSTABLE_API + }; + +diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx +index 816ade5649b2..c526bda95593 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.hxx ++++ b/include/LibreOfficeKit/LibreOfficeKit.hxx +@@ -246,6 +246,14 @@ public: + { + mpDoc->pClass->resetSelection(mpDoc); + } ++ ++ /** ++ * Returns a json map, {"familyName1" : ["list of style names in the family1"], etc.} ++ */ ++ inline char* getStyles() ++ { ++ return mpDoc->pClass->getStyles(mpDoc); ++ } + #endif // LOK_USE_UNSTABLE_API + }; + +diff --git a/libreofficekit/qa/unit/tiledrendering.cxx b/libreofficekit/qa/unit/tiledrendering.cxx +index fb2f7416ba34..a0f4bcb5b8eb 100644 +--- a/libreofficekit/qa/unit/tiledrendering.cxx ++++ b/libreofficekit/qa/unit/tiledrendering.cxx +@@ -9,6 +9,7 @@ + + #include + #include ++#include + #include + #include + #include +@@ -67,6 +68,7 @@ public: + void testDocumentTypes( Office* pOffice ); + void testImpressSlideNames( Office* pOffice ); + void testCalcSheetNames( Office* pOffice ); ++ void testGetStyles( Office* pOffice ); + #if 0 + void testOverlay( Office* pOffice ); + #endif +@@ -93,6 +95,7 @@ void TiledRenderingTest::runAllTests() + testDocumentTypes( pOffice.get() ); + testImpressSlideNames( pOffice.get() ); + testCalcSheetNames( pOffice.get() ); ++ testGetStyles( pOffice.get() ); + #if 0 + testOverlay( pOffice.get() ); + #endif +@@ -181,6 +184,38 @@ void TiledRenderingTest::testCalcSheetNames( Office* pOffice ) + CPPUNIT_ASSERT( strcmp( pDocument->getPartName( 2 ), "Sheet3" ) == 0 ); + } + ++void TiledRenderingTest::testGetStyles( Office* pOffice ) ++{ ++ const string sDocPath = m_sSrcRoot + "/libreofficekit/qa/data/blank_text.odt"; ++ const string sLockFile = m_sSrcRoot +"/libreofficekit/qa/data/.~lock.blank_text.odt#"; ++ ++ // FIXME: LOK will fail when trying to open a locked file ++ remove( sLockFile.c_str() ); ++ ++ scoped_ptr< Document> pDocument( pOffice->documentLoad( sDocPath.c_str() ) ); ++ ++ boost::property_tree::ptree aTree; ++ char* pJSON = pDocument->getStyles(); ++ std::stringstream aStream(pJSON); ++ boost::property_tree::read_json(aStream, aTree); ++ CPPUNIT_ASSERT( aTree.size() > 0 ); ++ ++ for (const std::pair& rPair : aTree) ++ { ++ CPPUNIT_ASSERT( rPair.second.size() > 0); ++ if (rPair.first != "CharacterStyles" && ++ rPair.first != "ParagraphStyles" && ++ rPair.first != "FrameStyles" && ++ rPair.first != "PageStyles" && ++ rPair.first != "NumberingStyles" && ++ rPair.first != "CellStyles" && ++ rPair.first != "ShapeStyles") ++ { ++ CPPUNIT_FAIL("Unknown style family: " + rPair.first); ++ } ++ } ++} ++ + #if 0 + static void dumpRGBABitmap( const OUString& rPath, const unsigned char* pBuffer, + const int nWidth, const int nHeight ) +-- +2.12.0 + diff --git a/SOURCES/0096-lok-namespace-and-re-work-various-types-helper-funct.patch b/SOURCES/0096-lok-namespace-and-re-work-various-types-helper-funct.patch new file mode 100644 index 0000000..6105dd7 --- /dev/null +++ b/SOURCES/0096-lok-namespace-and-re-work-various-types-helper-funct.patch @@ -0,0 +1,179 @@ +From c8a7b2b66db5025526a0dba1b0d33dcf1b93f985 Mon Sep 17 00:00:00 2001 +From: Michael Meeks +Date: Tue, 18 Aug 2015 12:09:08 +0100 +Subject: [PATCH 096/398] lok: namespace and re-work various types & helper + functions. + +Change-Id: I36e2a01822883251f9556fcde0e0a9830356ac98 +Reviewed-on: https://gerrit.libreoffice.org/17833 +Tested-by: Jenkins +Reviewed-by: Michael Meeks +Tested-by: Michael Meeks +(cherry picked from commit a5d5ce5dfa0f0cdd048192d60c70da575a6f1735) +--- + include/LibreOfficeKit/LibreOfficeKitInit.h | 60 ++++++++++++++++++----------- + 1 file changed, 37 insertions(+), 23 deletions(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitInit.h b/include/LibreOfficeKit/LibreOfficeKitInit.h +index f1966c764605..c2f342661e31 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitInit.h ++++ b/include/LibreOfficeKit/LibreOfficeKitInit.h +@@ -40,7 +40,7 @@ extern "C" + #endif + #define SEPARATOR '/' + +- void *_dlopen(const char *pFN) ++ void *lok_loadlib(const char *pFN) + { + return dlopen(pFN, RTLD_LAZY + #if defined __clang__ && defined __linux__ \ +@@ -52,17 +52,17 @@ extern "C" + ); + } + +- char *_dlerror(void) ++ char *lok_dlerror(void) + { + return dlerror(); + } + +- void *_dlsym(void *Hnd, const char *pName) ++ void *lok_dlsym(void *Hnd, const char *pName) + { + return dlsym(Hnd, pName); + } + +- int _dlclose(void *Hnd) ++ int lok_dlclose(void *Hnd) + { + return dlclose(Hnd); + } +@@ -80,24 +80,24 @@ extern "C" + #define SEPARATOR '\\' + #define UNOPATH "\\..\\URE\\bin" + +- void *_dlopen(const char *pFN) ++ void *lok_loadlib(const char *pFN) + { + return (void *) LoadLibrary(pFN); + } + +- char *_dlerror(void) ++ char *lok_dlerror(void) + { + LPSTR buf = NULL; + FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), 0, reinterpret_cast(&buf), 0, NULL); + return buf; + } + +- void *_dlsym(void *Hnd, const char *pName) ++ void *lok_dlsym(void *Hnd, const char *pName) + { + return GetProcAddress((HINSTANCE) Hnd, pName); + } + +- int _dlclose(void *Hnd) ++ int lok_dlclose(void *Hnd) + { + return FreeLibrary((HINSTANCE) Hnd); + } +@@ -139,16 +139,12 @@ extern "C" + } + #endif + +-typedef LibreOfficeKit *(HookFunction)( const char *install_path); +- +-typedef LibreOfficeKit *(HookFunction2)( const char *install_path, const char *user_profile_path ); +- +-static LibreOfficeKit *lok_init_2( const char *install_path, const char *user_profile_path ) ++static void *lok_dlopen( const char *install_path, char ** _imp_lib ) + { + char *imp_lib; + void *dlhandle; +- HookFunction *pSym; +- HookFunction2 *pSym2; ++ ++ *_imp_lib = NULL; + + #if !(defined(__APPLE__) && defined(__arm__)) + size_t partial_length; +@@ -172,7 +168,7 @@ static LibreOfficeKit *lok_init_2( const char *install_path, const char *user_p + imp_lib[partial_length++] = SEPARATOR; + strcpy(imp_lib + partial_length, TARGET_LIB); + +- dlhandle = _dlopen(imp_lib); ++ dlhandle = lok_loadlib(imp_lib); + if (!dlhandle) + { + // If TARGET_LIB exists, and likely is a real library (not a +@@ -183,18 +179,18 @@ static LibreOfficeKit *lok_init_2( const char *install_path, const char *user_p + if (stat(imp_lib, &st) == 0 && st.st_size > 100) + { + fprintf(stderr, "failed to open library '%s': %s\n", +- imp_lib, _dlerror()); ++ imp_lib, lok_dlerror()); + free(imp_lib); + return NULL; + } + + strcpy(imp_lib + partial_length, TARGET_MERGED_LIB); + +- dlhandle = _dlopen(imp_lib); ++ dlhandle = lok_loadlib(imp_lib); + if (!dlhandle) + { + fprintf(stderr, "failed to open library '%s': %s\n", +- imp_lib, _dlerror()); ++ imp_lib, lok_dlerror()); + free(imp_lib); + return NULL; + } +@@ -203,23 +199,41 @@ static LibreOfficeKit *lok_init_2( const char *install_path, const char *user_p + imp_lib = strdup("the app executable"); + dlhandle = RTLD_MAIN_ONLY; + #endif ++ *_imp_lib = imp_lib; ++ return dlhandle; ++} ++ ++typedef LibreOfficeKit *(LokHookFunction)( const char *install_path); ++ ++typedef LibreOfficeKit *(LokHookFunction2)( const char *install_path, const char *user_profile_path ); ++ ++typedef int (LokHookPreInit) ( const char *install_path, const char *user_profile_path ); ++ ++static LibreOfficeKit *lok_init_2( const char *install_path, const char *user_profile_path ) ++{ ++ char *imp_lib; ++ void *dlhandle; ++ LokHookFunction *pSym; ++ LokHookFunction2 *pSym2; ++ ++ dlhandle = lok_dlopen(install_path, &imp_lib); + +- pSym2 = (HookFunction2 *) _dlsym( dlhandle, "libreofficekit_hook_2" ); ++ pSym2 = (LokHookFunction2 *) lok_dlsym(dlhandle, "libreofficekit_hook_2"); + if (!pSym2) + { + if (user_profile_path != NULL) + { + fprintf( stderr, "the LibreOffice version in '%s' does not support passing a user profile to the hook function\n", + imp_lib ); +- _dlclose( dlhandle ); ++ lok_dlclose( dlhandle ); + free( imp_lib ); + return NULL; + } +- pSym = (HookFunction *) _dlsym( dlhandle, "libreofficekit_hook" ); ++ pSym = (LokHookFunction *) lok_dlsym( dlhandle, "libreofficekit_hook" ); + if (!pSym) + { + fprintf( stderr, "failed to find hook in library '%s'\n", imp_lib ); +- _dlclose( dlhandle ); ++ lok_dlclose( dlhandle ); + free( imp_lib ); + return NULL; + } +-- +2.12.0 + diff --git a/SOURCES/0097-Fix-incomplete-g-i-annotations.patch b/SOURCES/0097-Fix-incomplete-g-i-annotations.patch new file mode 100644 index 0000000..941b77e --- /dev/null +++ b/SOURCES/0097-Fix-incomplete-g-i-annotations.patch @@ -0,0 +1,30 @@ +From 00299a202f0a83fb9ed9d0d381cf5213c8fee42d Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Sun, 16 Aug 2015 15:17:15 +0530 +Subject: [PATCH 097/398] Fix incomplete g-i annotations + +Change-Id: I2665a12251921523045f4071df88ca69ecd5a5c0 +(cherry picked from commit 520053459aa6a34b6d9ad52d97704399e5138d3d) +--- + libreofficekit/source/gtk/lokdocview.cxx | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 859e96b29e20..83bb8b5e0aa5 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -1810,7 +1810,10 @@ lok_doc_view_open_document_finish (LOKDocView* pDocView, GAsyncResult* res, GErr + /** + * lok_doc_view_open_document: + * @pDocView: The #LOKDocView instance +- * @pPath: The path of the document that #LOKDocView widget should try to open ++ * @pPath: (transfer full): The path of the document that #LOKDocView widget should try to open ++ * @cancellable: ++ * @callback: ++ * @userdata: + * + * Returns: %TRUE if the document is loaded succesfully, %FALSE otherwise + */ +-- +2.12.0 + diff --git a/SOURCES/0098-log-resource-usage-of-unit-tests-on-UNX-platforms.patch b/SOURCES/0098-log-resource-usage-of-unit-tests-on-UNX-platforms.patch new file mode 100644 index 0000000..ffa4413 --- /dev/null +++ b/SOURCES/0098-log-resource-usage-of-unit-tests-on-UNX-platforms.patch @@ -0,0 +1,118 @@ +From a105e5ba1e92f91b34e7f25cc4b307900248881a Mon Sep 17 00:00:00 2001 +From: Markus Mohrhard +Date: Mon, 31 Aug 2015 01:36:02 +0200 +Subject: [PATCH 098/398] log resource usage of unit tests on UNX platforms + +Change-Id: I3788eae60f73bc42488bf2e4961922962f7e505b +Reviewed-on: https://gerrit.libreoffice.org/18155 +Reviewed-by: Markus Mohrhard +Tested-by: Markus Mohrhard +(cherry picked from commit 87514b0907dfbb479e2646b5ff951c68babf3417) +--- + sal/cppunittester/cppunittester.cxx | 50 +++++++++++++++++++++++++++++++++++++ + solenv/gbuild/CppunitTest.mk | 2 +- + 2 files changed, 51 insertions(+), 1 deletion(-) + +diff --git a/sal/cppunittester/cppunittester.cxx b/sal/cppunittester/cppunittester.cxx +index b637fb62cb2d..ef9212d6a2fa 100644 +--- a/sal/cppunittester/cppunittester.cxx ++++ b/sal/cppunittester/cppunittester.cxx +@@ -21,6 +21,11 @@ + #include + #endif + ++#ifdef UNX ++#include ++#include ++#endif ++ + #include + #include + #include +@@ -292,11 +297,48 @@ public: + } + }; + ++#ifdef UNX ++ ++double get_time(timeval* time) ++{ ++ double nTime = (double)time->tv_sec; ++ nTime += ((double)time->tv_usec)/1000000.0; ++ return nTime; ++} ++ ++OString generateTestName(const OUString& rPath) ++{ ++ sal_Int32 nPathSep = rPath.lastIndexOf("/"); ++ OUString aTestName = rPath.copy(nPathSep+1); ++ return OUStringToOString(aTestName, RTL_TEXTENCODING_UTF8); ++} ++ ++void reportResourceUsage(const OUString& rPath) ++{ ++ OUString aFullPath = rPath + OUString(".resource.log"); ++ rusage resource_usage; ++ getrusage(RUSAGE_SELF, &resource_usage); ++ ++ OString aPath = OUStringToOString(aFullPath, RTL_TEXTENCODING_UTF8); ++ std::ofstream resource_file(aPath.getStr()); ++ resource_file << "Name = " << generateTestName(rPath) << std::endl; ++ double nUserSpace = get_time(&resource_usage.ru_utime); ++ double nKernelSpace = get_time(&resource_usage.ru_stime); ++ resource_file << "UserSpace = " << nUserSpace << std::endl; ++ resource_file << "KernelSpace = " << nKernelSpace << std::endl; ++} ++#else ++void reportResourceUsage(const OUString& /*rPath*/) ++{ ++} ++#endif ++ + } + + SAL_IMPLEMENT_MAIN() + { + bool ok = false; ++ OUString path; + try + { + #ifdef WNT +@@ -322,6 +364,12 @@ SAL_IMPLEMENT_MAIN() + while (index < rtl_getAppCommandArgCount()) + { + rtl::OUString arg = getArgument(index); ++ if (arg == "--target") ++ { ++ path = getArgument(++index); ++ ++index; ++ continue; ++ } + if ( arg != "--protector" ) + { + if (testlib.empty()) +@@ -383,6 +431,8 @@ SAL_IMPLEMENT_MAIN() + SAL_WARN("vcl.app", "Fatal exception: " << e.what()); + } + ++ reportResourceUsage(path); ++ + return ok ? EXIT_SUCCESS : EXIT_FAILURE; + } + +diff --git a/solenv/gbuild/CppunitTest.mk b/solenv/gbuild/CppunitTest.mk +index 021ecc8c37aa..944a87ab612d 100644 +--- a/solenv/gbuild/CppunitTest.mk ++++ b/solenv/gbuild/CppunitTest.mk +@@ -101,7 +101,7 @@ $(call gb_CppunitTest_get_target,%) :| $(gb_CppunitTest_RUNTIMEDEPS) + PYTHONDONTWRITEBYTECODE=1) \ + $(ICECREAM_RUN) $(gb_CppunitTest_GDBTRACE) $(gb_CppunitTest_VALGRINDTOOL) $(gb_CppunitTest_CPPTESTCOMMAND) \ + $(call gb_LinkTarget_get_target,$(call gb_CppunitTest_get_linktarget,$*)) \ +- $(call gb_CppunitTest__make_args) \ ++ $(call gb_CppunitTest__make_args) --target $@ \ + $(if $(gb_CppunitTest__interactive),, \ + > $@.log 2>&1 \ + || ($(if $(value gb_CppunitTest_postprocess), \ +-- +2.12.0 + diff --git a/SOURCES/0099-sal-don-t-use-target-as-parameter-to-cppunittester.patch b/SOURCES/0099-sal-don-t-use-target-as-parameter-to-cppunittester.patch new file mode 100644 index 0000000..377a803 --- /dev/null +++ b/SOURCES/0099-sal-don-t-use-target-as-parameter-to-cppunittester.patch @@ -0,0 +1,72 @@ +From 929bef368a34b4df91ff6595de9cb3304ef02c99 Mon Sep 17 00:00:00 2001 +From: Michael Stahl +Date: Mon, 31 Aug 2015 23:09:16 +0200 +Subject: [PATCH 099/398] sal: don't use --target as parameter to cppunittester + +CppunitTest_libreofficekit_tiledrendering hangs because the soffice_main +exits due to the unrecognized command line arg --target. + +Use a -env:VARIABLE argument instead, which is filtered out by +rtl_getAppCommandArg() so does not reach the soffice_main code. + +(regression from 87514b0907dfbb479e2646b5ff951c68babf3417) + +Change-Id: I2c801305398dccfb447e4e5c44726f42bf2a72ef +(cherry picked from commit d0ebb6e438dc8f7dcb5467ae6f72068cf40dcb7a) +--- + sal/cppunittester/cppunittester.cxx | 12 ++++++++---- + solenv/gbuild/CppunitTest.mk | 2 +- + 2 files changed, 9 insertions(+), 5 deletions(-) + +diff --git a/sal/cppunittester/cppunittester.cxx b/sal/cppunittester/cppunittester.cxx +index ef9212d6a2fa..f2f36af51134 100644 +--- a/sal/cppunittester/cppunittester.cxx ++++ b/sal/cppunittester/cppunittester.cxx +@@ -361,15 +361,19 @@ SAL_IMPLEMENT_MAIN() + std::string args; + std::string testlib; + sal_uInt32 index = 0; +- while (index < rtl_getAppCommandArgCount()) ++ while (index < osl_getCommandArgCount()) + { + rtl::OUString arg = getArgument(index); +- if (arg == "--target") ++ if (arg.startsWith("-env:CPPUNITTESTTARGET=", &path)) + { +- path = getArgument(++index); + ++index; + continue; + } ++ if (arg.startsWith("-env:")) ++ { ++ ++index; ++ continue; // ignore it here - will be read later ++ } + if ( arg != "--protector" ) + { + if (testlib.empty()) +@@ -385,7 +389,7 @@ SAL_IMPLEMENT_MAIN() + ++index; + continue; + } +- if (rtl_getAppCommandArgCount() - index < 3) { ++ if (osl_getCommandArgCount() - index < 3) { + usageFailure(); + } + rtl::OUString lib(getArgument(index + 1)); +diff --git a/solenv/gbuild/CppunitTest.mk b/solenv/gbuild/CppunitTest.mk +index 944a87ab612d..bbd7370b655d 100644 +--- a/solenv/gbuild/CppunitTest.mk ++++ b/solenv/gbuild/CppunitTest.mk +@@ -101,7 +101,7 @@ $(call gb_CppunitTest_get_target,%) :| $(gb_CppunitTest_RUNTIMEDEPS) + PYTHONDONTWRITEBYTECODE=1) \ + $(ICECREAM_RUN) $(gb_CppunitTest_GDBTRACE) $(gb_CppunitTest_VALGRINDTOOL) $(gb_CppunitTest_CPPTESTCOMMAND) \ + $(call gb_LinkTarget_get_target,$(call gb_CppunitTest_get_linktarget,$*)) \ +- $(call gb_CppunitTest__make_args) --target $@ \ ++ $(call gb_CppunitTest__make_args) "-env:CPPUNITTESTTARGET=$@" \ + $(if $(gb_CppunitTest__interactive),, \ + > $@.log 2>&1 \ + || ($(if $(value gb_CppunitTest_postprocess), \ +-- +2.12.0 + diff --git a/SOURCES/0100-LOK-added-a-general-getCommandValues-method.patch b/SOURCES/0100-LOK-added-a-general-getCommandValues-method.patch new file mode 100644 index 0000000..66fce55 --- /dev/null +++ b/SOURCES/0100-LOK-added-a-general-getCommandValues-method.patch @@ -0,0 +1,153 @@ +From e25532e14fae9a909d62c354ed93c581522f4683 Mon Sep 17 00:00:00 2001 +From: Mihai Varga +Date: Fri, 4 Sep 2015 10:27:58 +0300 +Subject: [PATCH 100/398] LOK: added a general getCommandValues method + +This method returns a JSON mapping of the posible values for the given +command (e.g. .uno:StyleApply, etc). + +returns: +{commandName: "cmdName", commandValues: {json_of_cmd_values}} + +Change-Id: Ic8f970d077af6be9bc226f72f725b6cdf2d4c160 +(cherry picked from commit 9640dcea46dd3201aa4c27f6a3918f7419288a2a) +--- + desktop/source/lib/init.cxx | 24 ++++++++++++++++++++---- + include/LibreOfficeKit/LibreOfficeKit.h | 2 +- + include/LibreOfficeKit/LibreOfficeKit.hxx | 9 ++++++--- + libreofficekit/qa/unit/tiledrendering.cxx | 8 ++++++-- + 4 files changed, 33 insertions(+), 10 deletions(-) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 51302d1f8466..44a9e197d77a 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -235,7 +235,7 @@ static void doc_setGraphicSelection (LibreOfficeKitDocument* pThis, + int nX, + int nY); + static void doc_resetSelection (LibreOfficeKitDocument* pThis); +-static char* doc_getStyles(LibreOfficeKitDocument* pThis); ++static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCommand); + + struct LibLODocument_Impl : public _LibreOfficeKitDocument + { +@@ -270,7 +270,7 @@ struct LibLODocument_Impl : public _LibreOfficeKitDocument + m_pDocumentClass->getTextSelection = doc_getTextSelection; + m_pDocumentClass->setGraphicSelection = doc_setGraphicSelection; + m_pDocumentClass->resetSelection = doc_resetSelection; +- m_pDocumentClass->getStyles = doc_getStyles; ++ m_pDocumentClass->getCommandValues = doc_getCommandValues; + + gDocumentClass = m_pDocumentClass; + } +@@ -868,15 +868,17 @@ static void doc_resetSelection(LibreOfficeKitDocument* pThis) + pDoc->resetSelection(); + } + +-static char* doc_getStyles(LibreOfficeKitDocument* pThis) ++static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand) + { + LibLODocument_Impl* pDocument = static_cast(pThis); + + boost::property_tree::ptree aTree; ++ aTree.put("commandName", pCommand); + uno::Reference xStyleFamiliesSupplier(pDocument->mxComponent, uno::UNO_QUERY); + uno::Reference xStyleFamilies(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY); + uno::Sequence aStyleFamilies = xStyleFamilies->getElementNames(); + ++ boost::property_tree::ptree aValues; + for (sal_Int32 nStyleFam = 0; nStyleFam < aStyleFamilies.getLength(); ++nStyleFam) + { + boost::property_tree::ptree aChildren; +@@ -889,8 +891,9 @@ static char* doc_getStyles(LibreOfficeKitDocument* pThis) + aChild.put("", aStyles[nInd]); + aChildren.push_back(std::make_pair("", aChild)); + } +- aTree.add_child(sStyleFam.toUtf8().getStr(), aChildren); ++ aValues.add_child(sStyleFam.toUtf8().getStr(), aChildren); + } ++ aTree.add_child("commandValues", aValues); + std::stringstream aStream; + boost::property_tree::write_json(aStream, aTree); + char* pJson = static_cast(malloc(aStream.str().size() + 1)); +@@ -898,6 +901,19 @@ static char* doc_getStyles(LibreOfficeKitDocument* pThis) + pJson[aStream.str().size()] = '\0'; + return pJson; + } ++ ++static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCommand) ++{ ++ if (!strcmp(pCommand, ".uno:StyleApply")) ++ { ++ return getStyles(pThis, pCommand); ++ } ++ else { ++ gImpl->maLastExceptionMsg = "Unknown command, no values returned"; ++ return NULL; ++ } ++} ++ + static char* lo_getError (LibreOfficeKit *pThis) + { + LibLibreOffice_Impl* pLib = static_cast(pThis); +diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h +index af7155c4db67..8060f0e6ec7c 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.h ++++ b/include/LibreOfficeKit/LibreOfficeKit.h +@@ -161,7 +161,7 @@ struct _LibreOfficeKitDocumentClass + void (*resetSelection) (LibreOfficeKitDocument* pThis); + + /// @see lok::Document:getStyles +- char* (*getStyles) (LibreOfficeKitDocument* pThis); ++ char* (*getCommandValues) (LibreOfficeKitDocument* pThis, const char* pCommand); + #endif // LOK_USE_UNSTABLE_API + }; + +diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx +index c526bda95593..44599948e659 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.hxx ++++ b/include/LibreOfficeKit/LibreOfficeKit.hxx +@@ -248,11 +248,14 @@ public: + } + + /** +- * Returns a json map, {"familyName1" : ["list of style names in the family1"], etc.} ++ * Returns a json mapping of the possible values for the given command ++ * e.g. {commandName: ".uno:StyleApply", commandValues: {"familyName1" : ["list of style names in the family1"], etc.}} ++ * @param pCommand a uno command for which the possible values are requested ++ * @return {commandName: unoCmd, commandValues: {possible_values}} + */ +- inline char* getStyles() ++ inline char* getCommandValues(const char* pCommand) + { +- return mpDoc->pClass->getStyles(mpDoc); ++ return mpDoc->pClass->getCommandValues(mpDoc, pCommand); + } + #endif // LOK_USE_UNSTABLE_API + }; +diff --git a/libreofficekit/qa/unit/tiledrendering.cxx b/libreofficekit/qa/unit/tiledrendering.cxx +index a0f4bcb5b8eb..f4a721b3e164 100644 +--- a/libreofficekit/qa/unit/tiledrendering.cxx ++++ b/libreofficekit/qa/unit/tiledrendering.cxx +@@ -195,12 +195,16 @@ void TiledRenderingTest::testGetStyles( Office* pOffice ) + scoped_ptr< Document> pDocument( pOffice->documentLoad( sDocPath.c_str() ) ); + + boost::property_tree::ptree aTree; +- char* pJSON = pDocument->getStyles(); ++ char* pJSON = pDocument->getCommandValues(".uno:StyleApply"); + std::stringstream aStream(pJSON); + boost::property_tree::read_json(aStream, aTree); + CPPUNIT_ASSERT( aTree.size() > 0 ); ++ CPPUNIT_ASSERT( aTree.get_value("commandName") == ".uno:StyleApply" ); + +- for (const std::pair& rPair : aTree) ++ ++ boost::property_tree::ptree aValues = aTree.get_child("commandValues"); ++ CPPUNIT_ASSERT( aValues.size() > 0 ); ++ for (const std::pair& rPair : aValues) + { + CPPUNIT_ASSERT( rPair.second.size() > 0); + if (rPair.first != "CharacterStyles" && +-- +2.12.0 + diff --git a/SOURCES/0101-LOK-allow-float-numbers-in-json-property-value-conve.patch b/SOURCES/0101-LOK-allow-float-numbers-in-json-property-value-conve.patch new file mode 100644 index 0000000..f2bbef0 --- /dev/null +++ b/SOURCES/0101-LOK-allow-float-numbers-in-json-property-value-conve.patch @@ -0,0 +1,28 @@ +From fd8569e37467bf1d1bdc7fb3a680b1ef793cd598 Mon Sep 17 00:00:00 2001 +From: Mihai Varga +Date: Fri, 4 Sep 2015 11:55:47 +0300 +Subject: [PATCH 101/398] LOK: allow float numbers in json -> property value + conversion + +Change-Id: I866a44fcb71044d27a9bf06e2f55ca2e4135c23b +(cherry picked from commit d3c93279667badf0c0feb927e9c46af97a538d84) +--- + desktop/source/lib/init.cxx | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 44a9e197d77a..f15417c92d0b 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -772,6 +772,8 @@ static void jsonToPropertyValues(const char* pJSON, uno::Sequence +Date: Fri, 4 Sep 2015 15:45:51 +0300 +Subject: [PATCH 102/398] Revert "LOK: added a general getCommandValues method" + +This reverts commit 9640dcea46dd3201aa4c27f6a3918f7419288a2a. + +(cherry picked from commit 262e7be01461887202f629d1ccc57751b1a085c5) +--- + desktop/source/lib/init.cxx | 24 ++++-------------------- + include/LibreOfficeKit/LibreOfficeKit.h | 2 +- + include/LibreOfficeKit/LibreOfficeKit.hxx | 9 +++------ + libreofficekit/qa/unit/tiledrendering.cxx | 8 ++------ + 4 files changed, 10 insertions(+), 33 deletions(-) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index f15417c92d0b..c7f3aabb58b7 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -235,7 +235,7 @@ static void doc_setGraphicSelection (LibreOfficeKitDocument* pThis, + int nX, + int nY); + static void doc_resetSelection (LibreOfficeKitDocument* pThis); +-static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCommand); ++static char* doc_getStyles(LibreOfficeKitDocument* pThis); + + struct LibLODocument_Impl : public _LibreOfficeKitDocument + { +@@ -270,7 +270,7 @@ struct LibLODocument_Impl : public _LibreOfficeKitDocument + m_pDocumentClass->getTextSelection = doc_getTextSelection; + m_pDocumentClass->setGraphicSelection = doc_setGraphicSelection; + m_pDocumentClass->resetSelection = doc_resetSelection; +- m_pDocumentClass->getCommandValues = doc_getCommandValues; ++ m_pDocumentClass->getStyles = doc_getStyles; + + gDocumentClass = m_pDocumentClass; + } +@@ -870,17 +870,15 @@ static void doc_resetSelection(LibreOfficeKitDocument* pThis) + pDoc->resetSelection(); + } + +-static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand) ++static char* doc_getStyles(LibreOfficeKitDocument* pThis) + { + LibLODocument_Impl* pDocument = static_cast(pThis); + + boost::property_tree::ptree aTree; +- aTree.put("commandName", pCommand); + uno::Reference xStyleFamiliesSupplier(pDocument->mxComponent, uno::UNO_QUERY); + uno::Reference xStyleFamilies(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY); + uno::Sequence aStyleFamilies = xStyleFamilies->getElementNames(); + +- boost::property_tree::ptree aValues; + for (sal_Int32 nStyleFam = 0; nStyleFam < aStyleFamilies.getLength(); ++nStyleFam) + { + boost::property_tree::ptree aChildren; +@@ -893,9 +891,8 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand) + aChild.put("", aStyles[nInd]); + aChildren.push_back(std::make_pair("", aChild)); + } +- aValues.add_child(sStyleFam.toUtf8().getStr(), aChildren); ++ aTree.add_child(sStyleFam.toUtf8().getStr(), aChildren); + } +- aTree.add_child("commandValues", aValues); + std::stringstream aStream; + boost::property_tree::write_json(aStream, aTree); + char* pJson = static_cast(malloc(aStream.str().size() + 1)); +@@ -903,19 +900,6 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand) + pJson[aStream.str().size()] = '\0'; + return pJson; + } +- +-static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCommand) +-{ +- if (!strcmp(pCommand, ".uno:StyleApply")) +- { +- return getStyles(pThis, pCommand); +- } +- else { +- gImpl->maLastExceptionMsg = "Unknown command, no values returned"; +- return NULL; +- } +-} +- + static char* lo_getError (LibreOfficeKit *pThis) + { + LibLibreOffice_Impl* pLib = static_cast(pThis); +diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h +index 8060f0e6ec7c..af7155c4db67 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.h ++++ b/include/LibreOfficeKit/LibreOfficeKit.h +@@ -161,7 +161,7 @@ struct _LibreOfficeKitDocumentClass + void (*resetSelection) (LibreOfficeKitDocument* pThis); + + /// @see lok::Document:getStyles +- char* (*getCommandValues) (LibreOfficeKitDocument* pThis, const char* pCommand); ++ char* (*getStyles) (LibreOfficeKitDocument* pThis); + #endif // LOK_USE_UNSTABLE_API + }; + +diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx +index 44599948e659..c526bda95593 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.hxx ++++ b/include/LibreOfficeKit/LibreOfficeKit.hxx +@@ -248,14 +248,11 @@ public: + } + + /** +- * Returns a json mapping of the possible values for the given command +- * e.g. {commandName: ".uno:StyleApply", commandValues: {"familyName1" : ["list of style names in the family1"], etc.}} +- * @param pCommand a uno command for which the possible values are requested +- * @return {commandName: unoCmd, commandValues: {possible_values}} ++ * Returns a json map, {"familyName1" : ["list of style names in the family1"], etc.} + */ +- inline char* getCommandValues(const char* pCommand) ++ inline char* getStyles() + { +- return mpDoc->pClass->getCommandValues(mpDoc, pCommand); ++ return mpDoc->pClass->getStyles(mpDoc); + } + #endif // LOK_USE_UNSTABLE_API + }; +diff --git a/libreofficekit/qa/unit/tiledrendering.cxx b/libreofficekit/qa/unit/tiledrendering.cxx +index f4a721b3e164..a0f4bcb5b8eb 100644 +--- a/libreofficekit/qa/unit/tiledrendering.cxx ++++ b/libreofficekit/qa/unit/tiledrendering.cxx +@@ -195,16 +195,12 @@ void TiledRenderingTest::testGetStyles( Office* pOffice ) + scoped_ptr< Document> pDocument( pOffice->documentLoad( sDocPath.c_str() ) ); + + boost::property_tree::ptree aTree; +- char* pJSON = pDocument->getCommandValues(".uno:StyleApply"); ++ char* pJSON = pDocument->getStyles(); + std::stringstream aStream(pJSON); + boost::property_tree::read_json(aStream, aTree); + CPPUNIT_ASSERT( aTree.size() > 0 ); +- CPPUNIT_ASSERT( aTree.get_value("commandName") == ".uno:StyleApply" ); + +- +- boost::property_tree::ptree aValues = aTree.get_child("commandValues"); +- CPPUNIT_ASSERT( aValues.size() > 0 ); +- for (const std::pair& rPair : aValues) ++ for (const std::pair& rPair : aTree) + { + CPPUNIT_ASSERT( rPair.second.size() > 0); + if (rPair.first != "CharacterStyles" && +-- +2.12.0 + diff --git a/SOURCES/0103-LOK-moved-the-decalaration-of-LibLODocument_Impl-to-.patch b/SOURCES/0103-LOK-moved-the-decalaration-of-LibLODocument_Impl-to-.patch new file mode 100644 index 0000000..65f9563 --- /dev/null +++ b/SOURCES/0103-LOK-moved-the-decalaration-of-LibLODocument_Impl-to-.patch @@ -0,0 +1,571 @@ +From 578ff092c9726fb2fd18b1a21a5846855a641508 Mon Sep 17 00:00:00 2001 +From: Mihai Varga +Date: Wed, 9 Sep 2015 15:08:26 +0300 +Subject: [PATCH 103/398] LOK: moved the decalaration of LibLODocument_Impl to + make it visible + +We needed a better way to test LOK methods that are not app specific, +but are defined in /desktop/source/lib/init.cxx. So the decalaration +needs to be visible. + +I also moved the `getStyles` test in the new test file + +Change-Id: I98d97dc17a66e72732ca7bd848c131610790f48e +(cherry picked from commit 2290efa4a22d42cd9099b63b9138e4ff994c07f9) +--- + desktop/CppunitTest_desktop_lib.mk | 68 ++++++++++++++++ + desktop/Module_desktop.mk | 4 + + desktop/inc/lib/init.hxx | 27 +++++++ + desktop/qa/data/blank_text.odt | Bin 0 -> 8295 bytes + desktop/qa/desktop_lib/test_desktop_lib.cxx | 116 ++++++++++++++++++++++++++++ + desktop/source/lib/init.cxx | 79 +++++++++---------- + libreofficekit/qa/unit/tiledrendering.cxx | 34 -------- + 7 files changed, 252 insertions(+), 76 deletions(-) + create mode 100644 desktop/CppunitTest_desktop_lib.mk + create mode 100644 desktop/inc/lib/init.hxx + create mode 100644 desktop/qa/data/blank_text.odt + create mode 100644 desktop/qa/desktop_lib/test_desktop_lib.cxx + +diff --git a/desktop/CppunitTest_desktop_lib.mk b/desktop/CppunitTest_desktop_lib.mk +new file mode 100644 +index 000000000000..be394600ddf0 +--- /dev/null ++++ b/desktop/CppunitTest_desktop_lib.mk +@@ -0,0 +1,68 @@ ++# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- ++#************************************************************************* ++# ++# 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/. ++# ++#************************************************************************* ++ ++$(eval $(call gb_CppunitTest_CppunitTest,desktop_lib)) ++ ++$(eval $(call gb_CppunitTest_add_exception_objects,desktop_lib, \ ++ desktop/qa/desktop_lib/test_desktop_lib \ ++)) ++ ++$(eval $(call gb_CppunitTest_use_libraries,desktop_lib, \ ++ comphelper \ ++ cppu \ ++ cppuhelper \ ++ sal \ ++ sfx \ ++ sofficeapp \ ++ subsequenttest \ ++ sw \ ++ test \ ++ unotest \ ++ vcl \ ++ $(gb_UWINAPI) \ ++)) ++ ++$(eval $(call gb_CppunitTest_use_external,desktop_lib,boost_headers)) ++ ++$(eval $(call gb_CppunitTest_use_api,desktop_lib,\ ++ offapi \ ++ udkapi \ ++)) ++ ++$(eval $(call gb_CppunitTest_use_ure,desktop_lib)) ++ ++$(eval $(call gb_CppunitTest_use_vcl,desktop_lib)) ++ ++$(eval $(call gb_CppunitTest_use_components,desktop_lib,\ ++ comphelper/util/comphelp \ ++ configmgr/source/configmgr \ ++ filter/source/config/cache/filterconfig1 \ ++ filter/source/storagefilterdetect/storagefd \ ++ framework/util/fwk \ ++ i18npool/util/i18npool \ ++ package/source/xstor/xstor \ ++ package/util/package2 \ ++ sax/source/expatwrap/expwrap \ ++ sfx2/util/sfx \ ++ svl/source/fsstor/fsstorage \ ++ svtools/util/svt \ ++ sw/util/sw \ ++ sw/util/swd \ ++ toolkit/util/tk \ ++ ucb/source/core/ucb1 \ ++ ucb/source/ucp/file/ucpfile1 \ ++ unoxml/source/service/unoxml \ ++ xmloff/util/xo \ ++)) ++ ++$(eval $(call gb_CppunitTest_use_configuration,desktop_lib)) ++ ++# vim: set noet sw=4 ts=4: +diff --git a/desktop/Module_desktop.mk b/desktop/Module_desktop.mk +index ab04152731ce..c725a268721e 100644 +--- a/desktop/Module_desktop.mk ++++ b/desktop/Module_desktop.mk +@@ -130,4 +130,8 @@ $(eval $(call gb_Module_add_check_targets,desktop, \ + CppunitTest_desktop_version \ + )) + ++$(eval $(call gb_Module_add_check_targets,desktop, \ ++ CppunitTest_desktop_lib \ ++)) ++ + # vim: set ts=4 sw=4 et: +diff --git a/desktop/inc/lib/init.hxx b/desktop/inc/lib/init.hxx +new file mode 100644 +index 000000000000..b17f82566daf +--- /dev/null ++++ b/desktop/inc/lib/init.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/. ++ */ ++#include ++#include ++#include ++#include ++#include "../../source/inc/desktopdllapi.h" ++ ++using namespace css; ++using namespace boost; ++ ++namespace desktop { ++ struct DESKTOP_DLLPUBLIC LibLODocument_Impl : public _LibreOfficeKitDocument ++ { ++ uno::Reference mxComponent; ++ shared_ptr< LibreOfficeKitDocumentClass > m_pDocumentClass; ++ ++ explicit LibLODocument_Impl(const uno::Reference &xComponent); ++ ~LibLODocument_Impl(); ++ }; ++} +diff --git a/desktop/qa/data/blank_text.odt b/desktop/qa/data/blank_text.odt +new file mode 100644 +index 0000000000000000000000000000000000000000..00b92d785acd15b68c927aa3b2f1a5d3f1614425 +GIT binary patch +literal 8295 +zcmeHMbzD^4)*hNsQc^-jKmmy%1rd-Ak(8lp=$L__8>A5dW28Gpx)G!i6qJrZIz_ru +zg>QK8^~KkV_s{RIyXJS8eTMTqXV-f6UVEu3Vqud50QdkvlH{qhVLLAY3jhE(yU;%Y +z;MQ<+XAguq6oG(Qn?jwf?d`y>c4l1mP$z3AE_;NzoteF<3*6k!nakPS-C6Y?WGF;v +z{|F`kaCT9n$uz87;3jrZYnT(*`Dc*}VQ2YRRauVk63r#_BZLa_((35%b^rhafRDxj +zEbpaI0RWh(3epl9?n!I?r9c2TK~o9Q(doi2P%2%X%6)Tn-M_nzXj(9a(Spt7e}Deh +z2mk-`fGSrD_oOVdwFf<80SYq8(nXTS0sry_e0==BTu4maO|d^VuRm+wd?}~?N)wPBml%=s{hI+|cA8&#A{z`RT+}Bz +zKq}i;*M!}EKwC7=acz=dHcTOdH8x-8`_7Ws5zSQhy$6sOhZglb`FK8SvW%?YDbkW` +zg_Q{%eVh1Our~@fy5ki%6(G&?{?Q>{2U8)%)Nje^m#)#3agL2Pn1#X}w#rUB(6_JK +zAx34b0S~1-bB!4cK@C%~NkSkK8gsPST2?~w51viIv5~l1 +zFLm9?Z-fEA5b;^L^GV~ux;fVKd!SMZWuIan9Jmrz9m;5QSq$A}x}8sidL}Sj@6;MN +zHbXyfg1(+5n!a5R>(JW8Pds@)*UCfXJbAzo3a<&bGTd#jh$K3?|5`SWX%J_5AqqFJ +zC-;P?cSy!PyT)Aj5%LKl0LNOSXxm8{Yn%jw5lS1IqcnS0E{>=Le`t(wq*r;Mk%58I +ztjp0Gdk57FjBPjZ*o|-#;D65Z4i +zOHwm8XuI>CI^-jbl*2j{BoC_&Y1#r?8a$qJ(}6;*JE_&@N9OnP;-%tm-O$IhKu!9? +z^tihwC@E87syKplz=M8q<2^-9lKJUQH;L#oYx;Hg?%$~K#}1HGlc6aY+mTot^Zlal +zz?zV(D`HLlF0NEGmRRN9voXbS_aKatdu;BM5wk}#gsKO`feFC`lb8x2Kt)!jmQSx- +z!1ghj$74$=ZEmZ?ClJ}o99`T|X-*7?J5+CVz5}T`y)TRJNzzrqgkfbSS405yZ5rco +z)COV){;lHM&`3)0kHS4-IQt}NkSO!ZY6!)&AND0*#5SftMC;>$c5ra%Mh>Y9MUyXmEG2KN;|uq@5*-{A69NoHU%xy&T|htGf?j+97vNZ8(c#YZw#(V)k03Zi~v0AyqvoXG#MNbj +z?PCfDc5M0E&cV1W!@};xo${lFt9c5Qu1-!5UF=bcQZG%#?r1=&jtg%|kF%CBm?b)N +za&`AiLCR0rS@M+{c)Da3eBq&cTO0OTm&)$F8W)Gboyt66)vj9CqxZCkb|QyveQWr3 +zlxSZerrHz|r!j2*i8oykb0N#o&sT4P!r{#bQA8wh4OoPCpgsT$w&${W4?HFC=ACF< +z8=a!kifzjx&Jo&>lIFqfVndSk>e0xCVa64V(?(13(8E8g3ZXVBm_8uIEF>8?PWUZ4 +z*kVaJK%)Y~Cjh4@Rh!%e=uLY$J-s1W2U{5JN2)f1cv`OwTa;E?+ZXfBwjqz1Hv`_x +zY2Wo7OcZ-yES0H=jJGkKA}7R6xx2d>12j*fsEHK@T}zbI;xjjMTVvu9Zie&6jNLJa +z*~OhLsK}bERD2SQJ9JWy>b|_*P>2Tt@sm`Ni?WvNi4so*C{C_W7_J$KS8i?EB#6pW +z@M$ETW)Wfm*N(ZQdW9 +zg9X92EG)uQtVJ-XHWqB@%hY16_+BR>mLyK(Mm_npZ9Mxjn75!puUcX^8LTZ0OqKT1 +zM#eF;k2+Hp!s2!!)Q%<($3s)12i{{YE-W5{EF}4LGQ83xZ}Gn5LZKRXx81r~eF-uc +z1BfuV785~1dwxeY#|d&i@8GIgnWVr110%|U`#p{lUrAfsR1Y1X!cC0#4*SSOfc$$V +z;UmPk;vpJJ*FDuLG%DZqmr^qDz$jQq_S~)17i3zo#M0BntG3}uE^?>KMHQPH5;}M~ +zgDl{5az*0VF){_a^g5J(1WiCke9qz5k=qH6xhbM(kIJA7VY{Dqfe~t&VE@E6TchKK +ztkKP_{uJd#gjA(Q&I5jqisP2+yw*ZHkiZlH?OOmF{L4F%tDvoR9A^d?N1b}>SPm{| +zO0JC*9H!4k&&-i!O5kAiF&Rgj7_@G7;BbOpGSL`2A6FEn4o}E +zd7|h{Ru5~R8q;QV_Du*33kfe~GAst85gSp&_yA9MTJ)N;sG{_7yt$Iz +zF+n-u6%wj+<=W7Mv6eNt`0`XKRUyd;(?F-4+*?qtA?8m@6az0F=IEhJ&cjM(WR^bAhEo=;r1Mm{~J}a7AsT-L_M$q(K +z_Z&QECC4$Z2MeUau=by{Z-*%q>RhSzYQdu}*Kl82&sZHTyL-)claJP+*@ny>-+{3X +zdtJ*ShcM5&YV)n`UVg}e)qU?lIEw&d`6uQhs$`tvlZpLR_oe~*bo0ej?5L3(mWoie +zD||JA!$ZkNL699^cDGZ8vz6h;Ql9BF4mx&02QhzM8UBiH%$=cUt3o7F;%Oo`N$|!G +zim?4lRlpm@7+$YEbzjF84(ge$VvGkwMgWhF1emj6w?k7nCcWnlEI77f6{kEbxibgz +zHWk8rh{;isc{!VY4L-!`r`g|MuGGfR<@S0nOMFhl`zV6SllA1JI58t1g1uyd6ofw4 +zRo(;G*rt0W6v=8W^egPW+SIef3-1-_neoQ2v?l2&BPbjqr1;)Vh+NXVkHDtqAYx*? +zEDjR4y4+VB@sGxM2D+jWIvSI6=0a2o$*k?MFNjE;F`fS`jv732r +zWH)AD^74o#gw}YN)ZaFQw}qK#lSk;8V1RXyb%d1ngK`dKvKN^w^eDac9syk~+QRwC +zJUvYp5`-w5-l5$x?nNxs<~Y>(^dJ!v8g +zEu>sxvOx%n8_yoyMYu8paS2@L{czMCn?`e|3{{Js?sWCNb(88jdAkt|D@dpQK@jT|H;|i%_@ewz1_MaW&P-%aGNUXm!{f +zN+vxng>F+nQO=Gsiuc{_t|1uetI(Gnq>EAfXb7UcBqB4$;#4d +zPLC^(z8R;je|fd9B}5tZX&v_XspD6(Hm}=M@X+Fd_=(Rva-r!+3b66AvdTzrhn&QZ +zpd-?cmzWh4pD^7xYORmGuLBF1MhHa^m-EcM1?d-~{Bwpc$q5*#Ip)>OvNnAXlJA!vl(h-*L|vrBM!k;aGrsbP7y|h{V2jqV3qMkz^uMF9dysmtS7gvj}vrM +zyl2Uu7A4tBJ=jRlp8nihNxpGagOsJsn2)gfZYqyve%{SE?4f047Nm!<@7?jx{8c<< +z<}XBE&e5Wh{CT97I#gCoRJctubM==Ve(Z|wtA9a-@g8TcOq2PlVHzOWI@$2`Co4Zs +zwmkEREunQY92X0WEE??EMwY|PY&Xq2#dnP-93OE>Jyq&^V3%Agd_4&}{FO2-LgAst +zQ4!ZSAiEPcW>xqlac>T8mhhn5l&U+(Y1ymhsn^R!+3A3mOPuc>xX%38LW%czL)O#N +zAnHj5cFXmZdb%yfcNJBGeo)J4)cKg+R}&TCZH#t2m^?UC+4Z_}{K%2ilZjO%2F$eU +zyx|jh>1KmN+^0u^!pPU|Kj^!gAIK9rfF#|U_gtn(b6?S9_u<9G>=sQ}(4_$^uXgqb +zU1DU)HS~J-m?)El74J52{~Ftfh?Ky43h+V^@|loVjB?U*ZLr`mhFYympH!n=Y#lhq +zv^N$o^u~ItfRjgARUyB<=YEm%go8#F^EQY5-WXU&gN6&pAKoc;{f<{t3FIMeeRFL2 +z(FA5!{qsDL#2{7OhcN>#S0o}>U`_xvG4`zPv81DAHvyR}Rtr3a3JUGx_g?nAM6D3{ +zZRO*o7hKTBgLKiB23A$jPKX-iTvFS~9lfb9vqH(Sc~k +zt52Z93k~Bb!Bicl1-I2*_z{Jr_jT!^dI9(*!Kz!RV%M&s-G-7Ja%$rb(N24_kP&&q +zS-$M!`z%4xIhVJAUuPLD;UwHSchYMe`Sr_Xg +zeUCre*12n53mJ?UU7H*_#1YJT#n@J}pQfTlhjpS$WkAf@AzygX#0~Bgd67+;yA0F@ +zx(423=)t0G^nH*9nzwo0;ogwKmB1mY5{=mlQ{O#xKXH3sPHQ(ZT;xjNm~{Qcx8*lh +zSPq`e8ZQ~)r6No^4+J;J)xsyZd8x?s+97tiZvwlp0>UyRb8~&yTf{6whiAF_JNxk> +zE*q86$GjFk%IENgLER+C#uz}aOx~FmS8Ho8sxf2d;vEf|p|a~3c*2wG)+z9?_OfH9 +z3hx)Gqs$NSvHTve_`!6%m(^EF%VMq*3E+X)ca{CzUfIe^jqtJ!Ik@wt6j&r!bl)Ql +z68Ub#I67%&EBN)=b(AP(2A=bkr;xOi?F_Om&Dh4qSbM56599}xBAKCOii1VL0ZmCG +zMfg%AsSi%+K!TjDUba%#!7h^`Uo|QuA#*A`r|#C>gm=Eo>2F_PS9J$uAd#|6vEP%J +zf2@9AQL5i_6z1P^Mm;krQ_LO>zG*}lx)>nJk+2dg-Z<`n|EBnmZ^ks_@WL!y?-qZMH6%mSA>Y +z9`fQg`K@aM;S+!?+@{{zKz2SO(PR*7kHB``1I>qHy>FRshS{w&#|qn*)&nK%pyJB9;+yI)rynfiJ0;?O48_UP1!!AJKXqVbSm*>CY**<-zW?A!A(r5zYK +zy#f)hYQ)#196{{^w5{%wfm?O7b4RwuB5!#js6?s3wLFG(xa~W%t%pT;b8qb;HVm=m +z+9IKKtIh78Be%8%xEs(9YKc-8qaUotZU2bom#mOd&sOL=CXV<3aVZWOj)iBQ;k +z`w<8=&-eH|#iW~usOqax8?m_|`dV$J_m +zH|Joz$(t;FihkIwd(50lB>E*T?!sue>~`3SiX235(OW$uTfpc=?t9QPpq!s#3F_Ki +zgrKm$SC8`H#uJWR;W%BCeu5*Y^tj&;PE$GS?vHu-wjWd{Gt0etRkxxl`UaRvBSuT(~OR@$g4)E*lzEw8>SL(*_= +zNgRak*`H#b?K`f{j5Uj+_lj}g|F-WqJ7$1G?W`@#ot(KG%`Cc*U3P)oBtaV@!RFl~ +z;$R#cN7l|7o75(O5N#arcEXj(hA5<_T2|h2>fl_FEZZ2g?80xkYO=?KM@OpI84~EXYyz`WZ`Hcl-MV8G6U-?{0P88wV0BN}5mBjQY#tJF +zkSA!bh{6Y6i)8c&{A_=NqgpT01|yNA^bY6>=Lv}y*{)G^xR)O68NAq +z$T^U%R#~x)FJ?#WPILO&?0e(-fxrwA<4yLco{`Bgf}91z>H3m&{lF>jXe-ZkQ%{$H +zwyi0qm&QrF>nh7{?|Pgro^bV?UY#wjaFvFMcV}82KU=KWW`M{QpLJiwfmJ^adfOKG +z_qOe4rUBh!e;Wh3BxP@BVQuN+_*ag>i5F}QhgzCDfhDb-;ZTGVdJp((n&NLHxiBQuMW?rC$&ufy3pF)0hnb^mZ|?{;b#Zk3 +z_sK36db5gm7HR;_av5j#=Z2i6NPefafZ0Qx&3{(rqQ1MR`A*JIXO~|ZaS`sKx1Dv{ +zdDAaKUGz4DJ;DWnP64_6m(ITEZD)}4w_ViH6zCpNlF^XhR8W=$|LtGsfUWXnvt28Q +zAY{WQJZy!0#4|y)|JtoJU@e~UJB8;>(#CoFYjSy&9sK4t73&tJJEy7Ks&JKVN;&*K +z_kz!t{VZ_O_9L5%EH=JXZ%4xg^E=u2Ii+8q(ms6Sp6pM^e$=0Dl_9+Vy5HY_@F)`1 +zf$`$|Bp9q*4Z|$4NQCelSGG&WAB66VOx(2nXxNu-VWMoN@7hZZ>8}Y*c->Gf%ial} +z4I^v>?69%02$7O0QtyY(i>Y3v#W9eYG!<+$PFfZx*puNJWg_%GqO%ObbL4qRwImDb +zY>gtOaur|Rs&KB_BrY(r72#i_*J5!K<=h|ffGNec$S@WK_tS9958|ai#BU@%us3uQ +z3ynjFPj?_hA=IDPx8{gPy#G=y`bRrDbZEB|!#e?7E4%YmGm9$FxN$%y<8{57UO6Weophx^YH-rteG29AF@;@{9o +zG!Z(x`PT`+@2Fp8|179Hw{oIiL(JcCzv|sT>&cGJV*Wja(M!ZnTnM@tv)UY^_31w8*$&wnxf9QiZkPYFEJ&vUza^*@{U +z2Q~d~eRifW=Z3g|^ju5-+{iP1JGYz*Sbo*kKlA*vHj@|doNMi$S^ilYa`f%*^WazQ +z{WH%$YxCd&o^vh!7t7CK`&CHJ)cD*2&@2~fv#KHv+9d%1QuGIb)}I;Lv%CKTSWiMf + +literal 0 +HcmV?d00001 + +diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx +new file mode 100644 +index 000000000000..c88a53f41edb +--- /dev/null ++++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx +@@ -0,0 +1,116 @@ ++/* -*- 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 ++#include ++#include ++ ++#include ++#include ++#include ++#include ++ ++#include "../../inc/lib/init.hxx" ++ ++using namespace com::sun::star; ++using namespace desktop; ++ ++class DesktopLOKTest : public UnoApiTest ++{ ++public: ++ DesktopLOKTest() : UnoApiTest("/desktop/qa/data/") ++ { ++ } ++ ++ virtual ~DesktopLOKTest() ++ { ++ } ++ ++ virtual void setUp() SAL_OVERRIDE ++ { ++ UnoApiTest::setUp(); ++ mxDesktop.set(frame::Desktop::create(comphelper::getComponentContext(getMultiServiceFactory()))); ++ }; ++ ++ virtual void tearDown() SAL_OVERRIDE ++ { ++ closeDoc(); ++ UnoApiTest::tearDown(); ++ }; ++ ++ LibLODocument_Impl* loadDoc(const char* pName); ++ void closeDoc(); ++ ++ void runAllTests(); ++ void testGetStyles(); ++ ++ CPPUNIT_TEST_SUITE(DesktopLOKTest); ++ CPPUNIT_TEST(runAllTests); ++ CPPUNIT_TEST_SUITE_END(); ++ ++ uno::Reference mxComponent; ++}; ++ ++LibLODocument_Impl* DesktopLOKTest::loadDoc(const char* pName) ++{ ++ OUString aFileURL; ++ createFileURL(OUString::createFromAscii(pName), aFileURL); ++ mxComponent = loadFromDesktop(aFileURL, "com.sun.star.text.TextDocument"); ++ if (!mxComponent.is()) ++ { ++ CPPUNIT_ASSERT(false); ++ } ++ return new LibLODocument_Impl(mxComponent); ++} ++ ++void DesktopLOKTest::closeDoc() ++{ ++ if (mxComponent.is()) ++ { ++ closeDocument(mxComponent); ++ mxComponent.clear(); ++ } ++} ++ ++void DesktopLOKTest::runAllTests() ++{ ++ testGetStyles(); ++} ++ ++void DesktopLOKTest::testGetStyles() ++{ ++ LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); ++ boost::property_tree::ptree aTree; ++ char* pJSON = pDocument->m_pDocumentClass->getStyles(pDocument); ++ std::stringstream aStream(pJSON); ++ boost::property_tree::read_json(aStream, aTree); ++ CPPUNIT_ASSERT( aTree.size() > 0 ); ++ ++ for (const std::pair& rPair : aTree) ++ { ++ CPPUNIT_ASSERT( rPair.second.size() > 0); ++ if (rPair.first != "CharacterStyles" && ++ rPair.first != "ParagraphStyles" && ++ rPair.first != "FrameStyles" && ++ rPair.first != "PageStyles" && ++ rPair.first != "NumberingStyles" && ++ rPair.first != "CellStyles" && ++ rPair.first != "ShapeStyles") ++ { ++ CPPUNIT_FAIL("Unknown style family: " + rPair.first); ++ } ++ } ++ closeDoc(); ++} ++ ++CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); ++ ++CPPUNIT_PLUGIN_IMPLEMENT(); ++ ++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index c7f3aabb58b7..a20decd3afbe 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -64,6 +64,7 @@ + // We also need to hackily be able to start the main libreoffice thread: + #include "../app/sofficemain.h" + #include "../app/officeipcthread.hxx" ++#include "../../inc/lib/init.hxx" + + using namespace css; + using namespace vcl; +@@ -72,7 +73,6 @@ using namespace utl; + + using namespace boost; + +-struct LibLODocument_Impl; + struct LibLibreOffice_Impl; + + static LibLibreOffice_Impl *gImpl = NULL; +@@ -237,51 +237,46 @@ static void doc_setGraphicSelection (LibreOfficeKitDocument* pThis, + static void doc_resetSelection (LibreOfficeKitDocument* pThis); + static char* doc_getStyles(LibreOfficeKitDocument* pThis); + +-struct LibLODocument_Impl : public _LibreOfficeKitDocument +-{ +- uno::Reference mxComponent; +- shared_ptr< LibreOfficeKitDocumentClass > m_pDocumentClass; + +- explicit LibLODocument_Impl(const uno::Reference &xComponent) : +- mxComponent( xComponent ) ++LibLODocument_Impl::LibLODocument_Impl(const uno::Reference &xComponent) : ++ mxComponent( xComponent ) ++{ ++ if (!(m_pDocumentClass = gDocumentClass.lock())) + { +- if (!(m_pDocumentClass = gDocumentClass.lock())) +- { +- m_pDocumentClass.reset(new LibreOfficeKitDocumentClass); +- +- m_pDocumentClass->nSize = sizeof(LibreOfficeKitDocument); +- +- m_pDocumentClass->destroy = doc_destroy; +- m_pDocumentClass->saveAs = doc_saveAs; +- m_pDocumentClass->getDocumentType = doc_getDocumentType; +- m_pDocumentClass->getParts = doc_getParts; +- m_pDocumentClass->getPart = doc_getPart; +- m_pDocumentClass->setPart = doc_setPart; +- m_pDocumentClass->getPartName = doc_getPartName; +- m_pDocumentClass->setPartMode = doc_setPartMode; +- m_pDocumentClass->paintTile = doc_paintTile; +- m_pDocumentClass->getDocumentSize = doc_getDocumentSize; +- m_pDocumentClass->initializeForRendering = doc_initializeForRendering; +- m_pDocumentClass->registerCallback = doc_registerCallback; +- m_pDocumentClass->postKeyEvent = doc_postKeyEvent; +- m_pDocumentClass->postMouseEvent = doc_postMouseEvent; +- m_pDocumentClass->postUnoCommand = doc_postUnoCommand; +- m_pDocumentClass->setTextSelection = doc_setTextSelection; +- m_pDocumentClass->getTextSelection = doc_getTextSelection; +- m_pDocumentClass->setGraphicSelection = doc_setGraphicSelection; +- m_pDocumentClass->resetSelection = doc_resetSelection; +- m_pDocumentClass->getStyles = doc_getStyles; +- +- gDocumentClass = m_pDocumentClass; +- } +- pClass = m_pDocumentClass.get(); ++ m_pDocumentClass.reset(new LibreOfficeKitDocumentClass); ++ ++ m_pDocumentClass->nSize = sizeof(LibreOfficeKitDocument); ++ ++ m_pDocumentClass->destroy = doc_destroy; ++ m_pDocumentClass->saveAs = doc_saveAs; ++ m_pDocumentClass->getDocumentType = doc_getDocumentType; ++ m_pDocumentClass->getParts = doc_getParts; ++ m_pDocumentClass->getPart = doc_getPart; ++ m_pDocumentClass->setPart = doc_setPart; ++ m_pDocumentClass->getPartName = doc_getPartName; ++ m_pDocumentClass->setPartMode = doc_setPartMode; ++ m_pDocumentClass->paintTile = doc_paintTile; ++ m_pDocumentClass->getDocumentSize = doc_getDocumentSize; ++ m_pDocumentClass->initializeForRendering = doc_initializeForRendering; ++ m_pDocumentClass->registerCallback = doc_registerCallback; ++ m_pDocumentClass->postKeyEvent = doc_postKeyEvent; ++ m_pDocumentClass->postMouseEvent = doc_postMouseEvent; ++ m_pDocumentClass->postUnoCommand = doc_postUnoCommand; ++ m_pDocumentClass->setTextSelection = doc_setTextSelection; ++ m_pDocumentClass->getTextSelection = doc_getTextSelection; ++ m_pDocumentClass->setGraphicSelection = doc_setGraphicSelection; ++ m_pDocumentClass->resetSelection = doc_resetSelection; ++ m_pDocumentClass->getStyles = doc_getStyles; ++ ++ gDocumentClass = m_pDocumentClass; + } ++ pClass = m_pDocumentClass.get(); ++} + +- ~LibLODocument_Impl() +- { +- mxComponent->dispose(); +- } +-}; ++LibLODocument_Impl::~LibLODocument_Impl() ++{ ++ mxComponent->dispose(); ++} + + static void doc_destroy(LibreOfficeKitDocument *pThis) + { +diff --git a/libreofficekit/qa/unit/tiledrendering.cxx b/libreofficekit/qa/unit/tiledrendering.cxx +index a0f4bcb5b8eb..aa68c724f0f3 100644 +--- a/libreofficekit/qa/unit/tiledrendering.cxx ++++ b/libreofficekit/qa/unit/tiledrendering.cxx +@@ -68,7 +68,6 @@ public: + void testDocumentTypes( Office* pOffice ); + void testImpressSlideNames( Office* pOffice ); + void testCalcSheetNames( Office* pOffice ); +- void testGetStyles( Office* pOffice ); + #if 0 + void testOverlay( Office* pOffice ); + #endif +@@ -95,7 +94,6 @@ void TiledRenderingTest::runAllTests() + testDocumentTypes( pOffice.get() ); + testImpressSlideNames( pOffice.get() ); + testCalcSheetNames( pOffice.get() ); +- testGetStyles( pOffice.get() ); + #if 0 + testOverlay( pOffice.get() ); + #endif +@@ -184,38 +182,6 @@ void TiledRenderingTest::testCalcSheetNames( Office* pOffice ) + CPPUNIT_ASSERT( strcmp( pDocument->getPartName( 2 ), "Sheet3" ) == 0 ); + } + +-void TiledRenderingTest::testGetStyles( Office* pOffice ) +-{ +- const string sDocPath = m_sSrcRoot + "/libreofficekit/qa/data/blank_text.odt"; +- const string sLockFile = m_sSrcRoot +"/libreofficekit/qa/data/.~lock.blank_text.odt#"; +- +- // FIXME: LOK will fail when trying to open a locked file +- remove( sLockFile.c_str() ); +- +- scoped_ptr< Document> pDocument( pOffice->documentLoad( sDocPath.c_str() ) ); +- +- boost::property_tree::ptree aTree; +- char* pJSON = pDocument->getStyles(); +- std::stringstream aStream(pJSON); +- boost::property_tree::read_json(aStream, aTree); +- CPPUNIT_ASSERT( aTree.size() > 0 ); +- +- for (const std::pair& rPair : aTree) +- { +- CPPUNIT_ASSERT( rPair.second.size() > 0); +- if (rPair.first != "CharacterStyles" && +- rPair.first != "ParagraphStyles" && +- rPair.first != "FrameStyles" && +- rPair.first != "PageStyles" && +- rPair.first != "NumberingStyles" && +- rPair.first != "CellStyles" && +- rPair.first != "ShapeStyles") +- { +- CPPUNIT_FAIL("Unknown style family: " + rPair.first); +- } +- } +-} +- + #if 0 + static void dumpRGBABitmap( const OUString& rPath, const unsigned char* pBuffer, + const int nWidth, const int nHeight ) +-- +2.12.0 + diff --git a/SOURCES/0104-desktop-enable-CppunitTest_desktop_lib-only-on-Linux.patch b/SOURCES/0104-desktop-enable-CppunitTest_desktop_lib-only-on-Linux.patch new file mode 100644 index 0000000..ec544ef --- /dev/null +++ b/SOURCES/0104-desktop-enable-CppunitTest_desktop_lib-only-on-Linux.patch @@ -0,0 +1,41 @@ +From a72e78faa93c71cce4f479a99f4b6b9961a3968d Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Thu, 10 Sep 2015 09:38:02 +0200 +Subject: [PATCH 104/398] desktop: enable CppunitTest_desktop_lib only on Linux + +Since the test would fail to link on Windows, due to + +ifeq ($(GUIBASE),unx) +$(eval $(call gb_Library_add_exception_objects,sofficeapp,\ + desktop/source/lib/init \ +)) +endif + +in Library_sofficeapp.mk. Given that +CppunitTest_libreofficekit_tiledrendering is marked as Linux-only as +well, be consistent and have this test as Linux-only, too. + +Change-Id: I6c8884398eba5dcf8a74c9cdc96c869b6108fb7e +(cherry picked from commit ac882c305da2c5d9c30756da8ac2976f9047622d) +--- + desktop/Module_desktop.mk | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/desktop/Module_desktop.mk b/desktop/Module_desktop.mk +index c725a268721e..d74d40629a28 100644 +--- a/desktop/Module_desktop.mk ++++ b/desktop/Module_desktop.mk +@@ -130,8 +130,10 @@ $(eval $(call gb_Module_add_check_targets,desktop, \ + CppunitTest_desktop_version \ + )) + ++ifeq ($(OS),LINUX) + $(eval $(call gb_Module_add_check_targets,desktop, \ + CppunitTest_desktop_lib \ + )) ++endif + + # vim: set ts=4 sw=4 et: +-- +2.12.0 + diff --git a/SOURCES/0105-LOK-added-a-general-getCommandValues-method.patch b/SOURCES/0105-LOK-added-a-general-getCommandValues-method.patch new file mode 100644 index 0000000..35e199c --- /dev/null +++ b/SOURCES/0105-LOK-added-a-general-getCommandValues-method.patch @@ -0,0 +1,153 @@ +From ba461282993202188ef16adb99220cf403356c57 Mon Sep 17 00:00:00 2001 +From: Mihai Varga +Date: Thu, 10 Sep 2015 09:21:45 +0300 +Subject: [PATCH 105/398] LOK: added a general getCommandValues method + +This method returns a JSON mapping of the posible values for the given +command (e.g. .uno:StyleApply, etc). + +returns: +{commandName: "cmdName", commandValues: {json_of_cmd_values}} +I've fixed the unit test this time + +Change-Id: I30b0fba8ba1db33dd79f4b46026d293b9ea72402 +(cherry picked from commit 39975c477a38be613e9e162acb6de241999f0ae1) +--- + desktop/qa/desktop_lib/test_desktop_lib.cxx | 7 +++++-- + desktop/source/lib/init.cxx | 24 ++++++++++++++++++++---- + include/LibreOfficeKit/LibreOfficeKit.h | 2 +- + include/LibreOfficeKit/LibreOfficeKit.hxx | 9 ++++++--- + 4 files changed, 32 insertions(+), 10 deletions(-) + +diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx +index c88a53f41edb..842d209f8fb3 100644 +--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx ++++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx +@@ -87,12 +87,15 @@ void DesktopLOKTest::testGetStyles() + { + LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); + boost::property_tree::ptree aTree; +- char* pJSON = pDocument->m_pDocumentClass->getStyles(pDocument); ++ char* pJSON = pDocument->m_pDocumentClass->getCommandValues(pDocument, ".uno:StyleApply"); + std::stringstream aStream(pJSON); + boost::property_tree::read_json(aStream, aTree); + CPPUNIT_ASSERT( aTree.size() > 0 ); ++ CPPUNIT_ASSERT( aTree.get_child("commandName").get_value() == ".uno:StyleApply" ); + +- for (const std::pair& rPair : aTree) ++ boost::property_tree::ptree aValues = aTree.get_child("commandValues"); ++ CPPUNIT_ASSERT( aValues.size() > 0 ); ++ for (const std::pair& rPair : aValues) + { + CPPUNIT_ASSERT( rPair.second.size() > 0); + if (rPair.first != "CharacterStyles" && +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index a20decd3afbe..7a020d142ddc 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -235,7 +235,7 @@ static void doc_setGraphicSelection (LibreOfficeKitDocument* pThis, + int nX, + int nY); + static void doc_resetSelection (LibreOfficeKitDocument* pThis); +-static char* doc_getStyles(LibreOfficeKitDocument* pThis); ++static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCommand); + + + LibLODocument_Impl::LibLODocument_Impl(const uno::Reference &xComponent) : +@@ -266,7 +266,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference getTextSelection = doc_getTextSelection; + m_pDocumentClass->setGraphicSelection = doc_setGraphicSelection; + m_pDocumentClass->resetSelection = doc_resetSelection; +- m_pDocumentClass->getStyles = doc_getStyles; ++ m_pDocumentClass->getCommandValues = doc_getCommandValues; + + gDocumentClass = m_pDocumentClass; + } +@@ -865,15 +865,17 @@ static void doc_resetSelection(LibreOfficeKitDocument* pThis) + pDoc->resetSelection(); + } + +-static char* doc_getStyles(LibreOfficeKitDocument* pThis) ++static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand) + { + LibLODocument_Impl* pDocument = static_cast(pThis); + + boost::property_tree::ptree aTree; ++ aTree.put("commandName", pCommand); + uno::Reference xStyleFamiliesSupplier(pDocument->mxComponent, uno::UNO_QUERY); + uno::Reference xStyleFamilies(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY); + uno::Sequence aStyleFamilies = xStyleFamilies->getElementNames(); + ++ boost::property_tree::ptree aValues; + for (sal_Int32 nStyleFam = 0; nStyleFam < aStyleFamilies.getLength(); ++nStyleFam) + { + boost::property_tree::ptree aChildren; +@@ -886,8 +888,9 @@ static char* doc_getStyles(LibreOfficeKitDocument* pThis) + aChild.put("", aStyles[nInd]); + aChildren.push_back(std::make_pair("", aChild)); + } +- aTree.add_child(sStyleFam.toUtf8().getStr(), aChildren); ++ aValues.add_child(sStyleFam.toUtf8().getStr(), aChildren); + } ++ aTree.add_child("commandValues", aValues); + std::stringstream aStream; + boost::property_tree::write_json(aStream, aTree); + char* pJson = static_cast(malloc(aStream.str().size() + 1)); +@@ -895,6 +898,19 @@ static char* doc_getStyles(LibreOfficeKitDocument* pThis) + pJson[aStream.str().size()] = '\0'; + return pJson; + } ++ ++static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCommand) ++{ ++ if (!strcmp(pCommand, ".uno:StyleApply")) ++ { ++ return getStyles(pThis, pCommand); ++ } ++ else { ++ gImpl->maLastExceptionMsg = "Unknown command, no values returned"; ++ return NULL; ++ } ++} ++ + static char* lo_getError (LibreOfficeKit *pThis) + { + LibLibreOffice_Impl* pLib = static_cast(pThis); +diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h +index af7155c4db67..8060f0e6ec7c 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.h ++++ b/include/LibreOfficeKit/LibreOfficeKit.h +@@ -161,7 +161,7 @@ struct _LibreOfficeKitDocumentClass + void (*resetSelection) (LibreOfficeKitDocument* pThis); + + /// @see lok::Document:getStyles +- char* (*getStyles) (LibreOfficeKitDocument* pThis); ++ char* (*getCommandValues) (LibreOfficeKitDocument* pThis, const char* pCommand); + #endif // LOK_USE_UNSTABLE_API + }; + +diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx +index c526bda95593..44599948e659 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.hxx ++++ b/include/LibreOfficeKit/LibreOfficeKit.hxx +@@ -248,11 +248,14 @@ public: + } + + /** +- * Returns a json map, {"familyName1" : ["list of style names in the family1"], etc.} ++ * Returns a json mapping of the possible values for the given command ++ * e.g. {commandName: ".uno:StyleApply", commandValues: {"familyName1" : ["list of style names in the family1"], etc.}} ++ * @param pCommand a uno command for which the possible values are requested ++ * @return {commandName: unoCmd, commandValues: {possible_values}} + */ +- inline char* getStyles() ++ inline char* getCommandValues(const char* pCommand) + { +- return mpDoc->pClass->getStyles(mpDoc); ++ return mpDoc->pClass->getCommandValues(mpDoc, pCommand); + } + #endif // LOK_USE_UNSTABLE_API + }; +-- +2.12.0 + diff --git a/SOURCES/0106-LOK-getFonts-method.patch b/SOURCES/0106-LOK-getFonts-method.patch new file mode 100644 index 0000000..2a4c462 --- /dev/null +++ b/SOURCES/0106-LOK-getFonts-method.patch @@ -0,0 +1,142 @@ +From 1c485d2af28ed27f8cdb174d82f4a6199a23e72e Mon Sep 17 00:00:00 2001 +From: Mihai Varga +Date: Thu, 10 Sep 2015 11:31:48 +0300 +Subject: [PATCH 106/398] LOK: getFonts method + +Returns a json mapping of the available fonts to their possible font +sizes + +Change-Id: I80c0bdd79e3ef2d814f64b8d38143d6c2b9ca720 +(cherry picked from commit 1806882317af1162edce5c2389c9c5eeb18455ac) +--- + desktop/qa/desktop_lib/test_desktop_lib.cxx | 22 +++++++++++++ + desktop/source/lib/init.cxx | 48 ++++++++++++++++++++++++++++- + 2 files changed, 69 insertions(+), 1 deletion(-) + +diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx +index 842d209f8fb3..a08961403aac 100644 +--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx ++++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx +@@ -49,6 +49,7 @@ public: + + void runAllTests(); + void testGetStyles(); ++ void testGetFonts(); + + CPPUNIT_TEST_SUITE(DesktopLOKTest); + CPPUNIT_TEST(runAllTests); +@@ -81,6 +82,7 @@ void DesktopLOKTest::closeDoc() + void DesktopLOKTest::runAllTests() + { + testGetStyles(); ++ testGetFonts(); + } + + void DesktopLOKTest::testGetStyles() +@@ -112,6 +114,26 @@ void DesktopLOKTest::testGetStyles() + closeDoc(); + } + ++void DesktopLOKTest::testGetFonts() ++{ ++ LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); ++ boost::property_tree::ptree aTree; ++ char* pJSON = pDocument->m_pDocumentClass->getCommandValues(pDocument, ".uno:CharFontName"); ++ std::stringstream aStream(pJSON); ++ boost::property_tree::read_json(aStream, aTree); ++ CPPUNIT_ASSERT( aTree.size() > 0 ); ++ CPPUNIT_ASSERT( aTree.get_child("commandName").get_value() == ".uno:CharFontName" ); ++ ++ boost::property_tree::ptree aValues = aTree.get_child("commandValues"); ++ CPPUNIT_ASSERT( aValues.size() > 0 ); ++ for (const std::pair& rPair : aValues) ++ { ++ // check that we have font sizes available for each font ++ CPPUNIT_ASSERT( rPair.second.size() > 0); ++ } ++ closeDoc(); ++} ++ + CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); + + CPPUNIT_PLUGIN_IMPLEMENT(); +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 7a020d142ddc..be1a01867cf5 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -45,10 +45,15 @@ + #include + #include + ++#include ++#include ++#include ++#include + #include + #include + #include + #include ++#include + #include + #include + #include +@@ -864,6 +869,43 @@ static void doc_resetSelection(LibreOfficeKitDocument* pThis) + + pDoc->resetSelection(); + } ++static char* getFonts (const char* pCommand) ++{ ++ SfxObjectShell* pDocSh = SfxObjectShell::Current(); ++ const SvxFontListItem* pFonts = static_cast( ++ pDocSh->GetItem(SID_ATTR_CHAR_FONTLIST)); ++ const FontList* pList = pFonts ? pFonts->GetFontList() : 0; ++ ++ boost::property_tree::ptree aTree; ++ aTree.put("commandName", pCommand); ++ boost::property_tree::ptree aValues; ++ if ( pList ) ++ { ++ sal_uInt16 nFontCount = pList->GetFontNameCount(); ++ for (sal_uInt16 i = 0; i < nFontCount; ++i) ++ { ++ boost::property_tree::ptree aChildren; ++ const vcl::FontInfo& rInfo = pList->GetFontName(i); ++ const sal_IntPtr* pAry = pList->GetSizeAry(rInfo); ++ sal_uInt16 nSizeCount = 0; ++ while (pAry[nSizeCount]) ++ { ++ boost::property_tree::ptree aChild; ++ aChild.put("", (float)pAry[nSizeCount] / 10); ++ aChildren.push_back(std::make_pair("", aChild)); ++ nSizeCount++; ++ } ++ aValues.add_child(rInfo.GetName().toUtf8().getStr(), aChildren); ++ } ++ } ++ aTree.add_child("commandValues", aValues); ++ std::stringstream aStream; ++ boost::property_tree::write_json(aStream, aTree); ++ char* pJson = static_cast(malloc(aStream.str().size() + 1)); ++ strcpy(pJson, aStream.str().c_str()); ++ pJson[aStream.str().size()] = '\0'; ++ return pJson; ++} + + static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand) + { +@@ -901,7 +943,11 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand) + + static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCommand) + { +- if (!strcmp(pCommand, ".uno:StyleApply")) ++ if (!strcmp(pCommand, ".uno:CharFontName")) ++ { ++ return getFonts(pCommand); ++ } ++ else if (!strcmp(pCommand, ".uno:StyleApply")) + { + return getStyles(pThis, pCommand); + } +-- +2.12.0 + diff --git a/SOURCES/0107-lokdocview-GTK-calls-should-be-made-from-the-main-th.patch b/SOURCES/0107-lokdocview-GTK-calls-should-be-made-from-the-main-th.patch new file mode 100644 index 0000000..31d41b3 --- /dev/null +++ b/SOURCES/0107-lokdocview-GTK-calls-should-be-made-from-the-main-th.patch @@ -0,0 +1,54 @@ +From e53d6dd2ee9dd5bf8aed0f84cc9ef198b7ccd606 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 11 Sep 2015 11:27:08 +0200 +Subject: [PATCH 107/398] lokdocview: GTK+ calls should be made from the main + thread + +Change-Id: Ia76ef111170700ef507550222ca917986d4fe00e +(cherry picked from commit 88b6dd3ea77ca9f6d5fac2965cea6ff0634e6ba5) +--- + libreofficekit/source/gtk/lokdocview.cxx | 14 ++++++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 83bb8b5e0aa5..27d2e1df983a 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -368,6 +368,16 @@ hyperlinkClicked(LOKDocView* pDocView, const std::string& rString) + g_signal_emit(pDocView, doc_view_signals[HYPERLINK_CLICKED], 0, rString.c_str()); + } + ++/// Trigger a redraw, invoked on the main thread by other functions running in a thread. ++static gboolean queueDraw(gpointer pData) ++{ ++ GtkWidget* pWidget = static_cast(pData); ++ ++ gtk_widget_queue_draw(pWidget); ++ ++ return G_SOURCE_REMOVE; ++} ++ + /// Implementation of the global callback handler, invoked by globalCallback(); + static gboolean + globalCallback (gpointer pData) +@@ -1249,7 +1259,7 @@ setEditInThread(gpointer data) + } + priv->m_bEdit = bEdit; + g_signal_emit(pDocView, doc_view_signals[EDIT_CHANGED], 0, bWasEdit); +- gtk_widget_queue_draw(GTK_WIDGET(pDocView)); ++ gdk_threads_add_idle(queueDraw, GTK_WIDGET(pDocView)); + } + + static void +@@ -1305,7 +1315,7 @@ paintTileInThread (gpointer data) + //create a mapping for it + buffer.m_mTiles[index].setPixbuf(pPixBuf); + buffer.m_mTiles[index].valid = true; +- gtk_widget_queue_draw(GTK_WIDGET(pDocView)); ++ gdk_threads_add_idle(queueDraw, GTK_WIDGET(pDocView)); + } + + +-- +2.12.0 + diff --git a/SOURCES/0108-LOK-don-t-use-unstable-API-unconditionally-when-incl.patch b/SOURCES/0108-LOK-don-t-use-unstable-API-unconditionally-when-incl.patch new file mode 100644 index 0000000..941a183 --- /dev/null +++ b/SOURCES/0108-LOK-don-t-use-unstable-API-unconditionally-when-incl.patch @@ -0,0 +1,40 @@ +From 6e8ac71304481d1e844dab199d2e5477ca9eeb7f Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 11 Sep 2015 14:47:17 +0200 +Subject: [PATCH 108/398] LOK: don't use unstable API unconditionally when + including the GTK header + +Change-Id: I679ddfdadbf4746d3fba64d3d5157ec070b4f6dd +(cherry picked from commit 88c51cd55d1a9b29e62269c53b3923770253ab07) +--- + include/LibreOfficeKit/LibreOfficeKitGtk.h | 1 - + libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 1 + + 2 files changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h +index 02789ad3f585..01009fb9eb40 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h ++++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h +@@ -13,7 +13,6 @@ + #include + #include + +-#define LOK_USE_UNSTABLE_API + #include + + G_BEGIN_DECLS +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 57d0c113d6ac..ab33fc703731 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -16,6 +16,7 @@ + #include + #include + ++#define LOK_USE_UNSTABLE_API + #include + #include + +-- +2.12.0 + diff --git a/SOURCES/0109-LOK-Implement-an-own-trivial-InteractionHandler.patch b/SOURCES/0109-LOK-Implement-an-own-trivial-InteractionHandler.patch new file mode 100644 index 0000000..39c2dba --- /dev/null +++ b/SOURCES/0109-LOK-Implement-an-own-trivial-InteractionHandler.patch @@ -0,0 +1,248 @@ +From fd6adbabe3debe2e41f3f39816a1e92e9c1850e1 Mon Sep 17 00:00:00 2001 +From: Jan Holesovsky +Date: Fri, 11 Sep 2015 18:46:53 +0200 +Subject: [PATCH 109/398] LOK: Implement an own trivial InteractionHandler. + +So far it just selects 'Approve' for any interaction that is done through +that, later we want to route the information via callbacks to the caller. + +Change-Id: I7ae3e2dcc04877b8b0197b0396299126e1217a2a +(cherry picked from commit f1f179ba0ff3d293e81c7b95554f8e6b140340d7) +--- + desktop/Library_sofficeapp.mk | 2 + + desktop/source/lib/init.cxx | 19 ++++++- + desktop/source/lib/lokinteractionhandler.cxx | 83 ++++++++++++++++++++++++++++ + desktop/source/lib/lokinteractionhandler.hxx | 70 +++++++++++++++++++++++ + 4 files changed, 173 insertions(+), 1 deletion(-) + create mode 100644 desktop/source/lib/lokinteractionhandler.cxx + create mode 100644 desktop/source/lib/lokinteractionhandler.hxx + +diff --git a/desktop/Library_sofficeapp.mk b/desktop/Library_sofficeapp.mk +index 467fecc8ffc2..ccad5a7ea5ca 100644 +--- a/desktop/Library_sofficeapp.mk ++++ b/desktop/Library_sofficeapp.mk +@@ -123,6 +123,7 @@ endif + ifneq ($(filter $(OS),ANDROID IOS),) + $(eval $(call gb_Library_add_exception_objects,sofficeapp,\ + desktop/source/lib/init \ ++ desktop/source/lib/lokinteractionhandler \ + $(if $(filter $(OS),ANDROID), \ + desktop/source/lib/lokandroid) \ + )) +@@ -130,6 +131,7 @@ else + ifeq ($(GUIBASE),unx) + $(eval $(call gb_Library_add_exception_objects,sofficeapp,\ + desktop/source/lib/init \ ++ desktop/source/lib/lokinteractionhandler \ + )) + endif + endif +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index be1a01867cf5..fb8ec3ea361a 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -71,6 +71,8 @@ + #include "../app/officeipcthread.hxx" + #include "../../inc/lib/init.hxx" + ++#include "lokinteractionhandler.hxx" ++ + using namespace css; + using namespace vcl; + using namespace desktop; +@@ -385,11 +387,26 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions(LibreOfficeKit* pThis, + + try + { +- uno::Sequence aFilterOptions(1); ++ uno::Sequence aFilterOptions(2); + aFilterOptions[0] = css::beans::PropertyValue( OUString("FilterOptions"), + 0, + uno::makeAny(OUString::createFromAscii(pOptions)), + beans::PropertyState_DIRECT_VALUE); ++ ++ uno::Reference xInteraction(new LOKInteractionHandler(::comphelper::getProcessComponentContext())); ++ aFilterOptions[1].Name = "InteractionHandler"; ++ aFilterOptions[1].Value <<= xInteraction; ++ ++ /* TODO ++ sal_Int16 nMacroExecMode = document::MacroExecMode::USE_CONFIG; ++ aFilterOptions[2].Name = "MacroExecutionMode"; ++ aFilterOptions[2].Value <<= nMacroExecMode; ++ ++ sal_Int16 nUpdateDoc = document::UpdateDocMode::ACCORDING_TO_CONFIG; ++ aFilterOptions[3].Name = "UpdateDocMode"; ++ aFilterOptions[3].Value <<= nUpdateDoc; ++ */ ++ + uno::Reference xComponent; + xComponent = xComponentLoader->loadComponentFromURL( + aURL, OUString("_blank"), 0, +diff --git a/desktop/source/lib/lokinteractionhandler.cxx b/desktop/source/lib/lokinteractionhandler.cxx +new file mode 100644 +index 000000000000..1d20b0219e28 +--- /dev/null ++++ b/desktop/source/lib/lokinteractionhandler.cxx +@@ -0,0 +1,83 @@ ++/* -*- 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/. ++ * ++ * This file incorporates work covered by the following license notice: ++ * ++ * Licensed to the Apache Software Foundation (ASF) under one or more ++ * contributor license agreements. See the NOTICE file distributed ++ * with this work for additional information regarding copyright ++ * ownership. The ASF licenses this file to you under the Apache ++ * License, Version 2.0 (the "License"); you may not use this file ++ * except in compliance with the License. You may obtain a copy of ++ * the License at http://www.apache.org/licenses/LICENSE-2.0 . ++ */ ++ ++#include "lokinteractionhandler.hxx" ++ ++#include ++ ++#include ++ ++using namespace com::sun::star; ++ ++LOKInteractionHandler::LOKInteractionHandler(uno::Reference const & /*rxContext*/) ++{ ++} ++ ++LOKInteractionHandler::~LOKInteractionHandler() ++{ ++} ++ ++OUString SAL_CALL LOKInteractionHandler::getImplementationName() throw (uno::RuntimeException, std::exception) ++{ ++ return OUString("com.sun.star.comp.uui.LOKInteractionHandler"); ++} ++ ++sal_Bool SAL_CALL LOKInteractionHandler::supportsService(OUString const & rServiceName) throw (uno::RuntimeException, std::exception) ++{ ++ return cppu::supportsService(this, rServiceName); ++} ++ ++uno::Sequence< OUString > SAL_CALL LOKInteractionHandler::getSupportedServiceNames() throw (uno::RuntimeException, std::exception) ++{ ++ uno::Sequence< OUString > aNames(3); ++ aNames[0] = "com.sun.star.task.InteractionHandler"; ++ // added to indicate support for configuration.backend.MergeRecoveryRequest ++ aNames[1] = "com.sun.star.configuration.backend.InteractionHandler"; ++ aNames[2] = "com.sun.star.uui.InteractionHandler"; ++ // for backwards compatibility ++ return aNames; ++} ++ ++void SAL_CALL LOKInteractionHandler::initialize(uno::Sequence const & /*rArguments*/) throw (uno::Exception, std::exception) ++{ ++} ++ ++void SAL_CALL LOKInteractionHandler::handle(uno::Reference const & rRequest) throw (uno::RuntimeException, std::exception) ++{ ++ // just do the same thing in both cases ++ handleInteractionRequest(rRequest); ++} ++ ++sal_Bool SAL_CALL LOKInteractionHandler::handleInteractionRequest(const uno::Reference& rRequest) throw ( uno::RuntimeException, std::exception ) ++{ ++ uno::Sequence> const &rContinuations = rRequest->getContinuations(); ++ ++ // TODO: add LOK api that allows handling this for real, for the moment we ++ // just set the interaction as 'Approved' ++ for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i) ++ { ++ uno::Reference xApprove(rContinuations[i], uno::UNO_QUERY); ++ if (xApprove.is()) ++ xApprove->select(); ++ } ++ ++ return sal_True; ++} ++ ++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +diff --git a/desktop/source/lib/lokinteractionhandler.hxx b/desktop/source/lib/lokinteractionhandler.hxx +new file mode 100644 +index 000000000000..6d4aa8231daf +--- /dev/null ++++ b/desktop/source/lib/lokinteractionhandler.hxx +@@ -0,0 +1,70 @@ ++/* -*- 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/. ++ * ++ * This file incorporates work covered by the following license notice: ++ * ++ * Licensed to the Apache Software Foundation (ASF) under one or more ++ * contributor license agreements. See the NOTICE file distributed ++ * with this work for additional information regarding copyright ++ * ownership. The ASF licenses this file to you under the Apache ++ * License, Version 2.0 (the "License"); you may not use this file ++ * except in compliance with the License. You may obtain a copy of ++ * the License at http://www.apache.org/licenses/LICENSE-2.0 . ++ */ ++ ++#ifndef INCLUDED_DESKTOP_SOURCE_LIB_LOKINTERACTIONHANDLER_HXX ++#define INCLUDED_DESKTOP_SOURCE_LIB_LOKINTERACTIONHANDLER_HXX ++ ++#include ++ ++#include ++#include ++#include ++ ++/** InteractionHandler is an interface that provides the user with various dialogs / error messages. ++ ++We need an own implementation for the LibreOfficeKit so that we can route the ++information easily via callbacks. ++ ++TODO: the callbacks are not implemented yet, we just approve any interaction ++that we get. ++*/ ++class LOKInteractionHandler: public cppu::WeakImplHelper ++{ ++ LOKInteractionHandler(const LOKInteractionHandler&) SAL_DELETED_FUNCTION; ++ LOKInteractionHandler& operator=(const LOKInteractionHandler&) SAL_DELETED_FUNCTION; ++ ++public: ++ explicit LOKInteractionHandler(com::sun::star::uno::Reference const & rxContext); ++ ++ virtual ~LOKInteractionHandler(); ++ ++ virtual OUString SAL_CALL getImplementationName() ++ throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; ++ ++ virtual sal_Bool SAL_CALL supportsService(OUString const & rServiceName) ++ throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; ++ ++ virtual com::sun::star::uno::Sequence SAL_CALL getSupportedServiceNames() ++ throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; ++ ++ virtual void SAL_CALL initialize(com::sun::star::uno::Sequence const & rArguments) ++ throw (com::sun::star::uno::Exception, std::exception) SAL_OVERRIDE; ++ ++ virtual void SAL_CALL handle(com::sun::star::uno::Reference const & rRequest) ++ throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; ++ ++ virtual sal_Bool SAL_CALL handleInteractionRequest(const ::com::sun::star::uno::Reference<::com::sun::star::task::XInteractionRequest>& _Request) ++ throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; ++}; ++ ++#endif ++ ++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +-- +2.12.0 + diff --git a/SOURCES/0110-create_tree.sh-Generate-g-i-files.patch b/SOURCES/0110-create_tree.sh-Generate-g-i-files.patch new file mode 100644 index 0000000..5030829 --- /dev/null +++ b/SOURCES/0110-create_tree.sh-Generate-g-i-files.patch @@ -0,0 +1,165 @@ +From 839e15f8019b8eb4b4986367aef5c77c58ed3412 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Sat, 15 Aug 2015 18:48:53 +0530 +Subject: [PATCH 110/398] create_tree.sh: Generate g-i files + +Change-Id: I1749b5b02018cfe6f85a13aed8de4b31a09788e3 +Reviewed-on: https://gerrit.libreoffice.org/18494 +Reviewed-by: Miklos Vajna +Tested-by: Miklos Vajna +(cherry picked from commit 8f2aace934eb2a91a273b6104de6383108b5c82a) +--- + configure.ac | 6 +++ + m4/introspection.m4 | 94 ++++++++++++++++++++++++++++++++++++++ + sysui/desktop/share/create_tree.sh | 13 ++++++ + 3 files changed, 113 insertions(+) + create mode 100644 m4/introspection.m4 + +diff --git a/configure.ac b/configure.ac +index 4e27231f6a5f..b1ec23a5afa3 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -181,6 +181,11 @@ SRC_ROOT=`pwd` + cd $BUILDDIR + x_Cygwin=[\#] + ++dnl ====================================== ++dnl Required GObject introspection version ++dnl ====================================== ++INTROSPECTION_REQUIRED_VERSION=1.32.0 ++ + dnl =================================================================== + dnl Search all the common names for GNU Make + dnl =================================================================== +@@ -9903,6 +9908,7 @@ if test "x$enable_gtk3" = "xyes"; then + PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= 3.8 gtk+-unix-print-3.0 gmodule-no-export-2.0 glib-2.0 >= 2.38 cairo, ENABLE_GTK3="TRUE", ENABLE_GTK3="") + if test "x$ENABLE_GTK3" = "xTRUE"; then + R="gtk3" ++ GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION) + else + AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found]) + fi +diff --git a/m4/introspection.m4 b/m4/introspection.m4 +new file mode 100644 +index 000000000000..532bad82addf +--- /dev/null ++++ b/m4/introspection.m4 +@@ -0,0 +1,94 @@ ++dnl -*- mode: autoconf -*- ++dnl Copyright 2009 Johan Dahlin ++dnl ++dnl This file is free software; the author(s) gives unlimited ++dnl permission to copy and/or distribute it, with or without ++dnl modifications, as long as this notice is preserved. ++dnl ++ ++# serial 1 ++ ++m4_define([_GOBJECT_INTROSPECTION_CHECK_INTERNAL], ++[ ++ AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first ++ AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first ++ AC_BEFORE([LT_INIT],[$0])dnl setup libtool first ++ ++ dnl enable/disable introspection ++ m4_if([$2], [require], ++ [dnl ++ enable_introspection=yes ++ ],[dnl ++ AC_ARG_ENABLE(introspection, ++ AS_HELP_STRING([--enable-introspection[=@<:@no/auto/yes@:>@]], ++ [Enable introspection for this build]),, ++ [enable_introspection=auto]) ++ ])dnl ++ ++ AC_MSG_CHECKING([for gobject-introspection]) ++ ++ dnl presence/version checking ++ AS_CASE([$enable_introspection], ++ [no], [dnl ++ found_introspection="no (disabled, use --enable-introspection to enable)" ++ ],dnl ++ [yes],[dnl ++ PKG_CHECK_EXISTS([gobject-introspection-1.0],, ++ AC_MSG_ERROR([gobject-introspection-1.0 is not installed])) ++ PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], ++ found_introspection=yes, ++ AC_MSG_ERROR([You need to have gobject-introspection >= $1 installed to build AC_PACKAGE_NAME])) ++ ],dnl ++ [auto],[dnl ++ PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], found_introspection=yes, found_introspection=no) ++ dnl Canonicalize enable_introspection ++ enable_introspection=$found_introspection ++ ],dnl ++ [dnl ++ AC_MSG_ERROR([invalid argument passed to --enable-introspection, should be one of @<:@no/auto/yes@:>@]) ++ ])dnl ++ ++ AC_MSG_RESULT([$found_introspection]) ++ ++ INTROSPECTION_SCANNER= ++ INTROSPECTION_COMPILER= ++ INTROSPECTION_GENERATE= ++ INTROSPECTION_GIRDIR= ++ INTROSPECTION_TYPELIBDIR= ++ if test "x$found_introspection" = "xyes"; then ++ INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0` ++ INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0` ++ INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0` ++ INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0` ++ INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)" ++ INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0` ++ INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0` ++ INTROSPECTION_MAKEFILE=`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection ++ fi ++ AC_SUBST(INTROSPECTION_SCANNER) ++ AC_SUBST(INTROSPECTION_COMPILER) ++ AC_SUBST(INTROSPECTION_GENERATE) ++ AC_SUBST(INTROSPECTION_GIRDIR) ++ AC_SUBST(INTROSPECTION_TYPELIBDIR) ++ AC_SUBST(INTROSPECTION_CFLAGS) ++ AC_SUBST(INTROSPECTION_LIBS) ++ AC_SUBST(INTROSPECTION_MAKEFILE) ++]) ++ ++ ++dnl Usage: ++dnl GOBJECT_INTROSPECTION_CHECK([minimum-g-i-version]) ++ ++AC_DEFUN([GOBJECT_INTROSPECTION_CHECK], ++[ ++ _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1]) ++]) ++ ++dnl Usage: ++dnl GOBJECT_INTROSPECTION_REQUIRE([minimum-g-i-version]) ++ ++ ++AC_DEFUN([GOBJECT_INTROSPECTION_REQUIRE], ++[ ++ _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1], [require]) ++]) +diff --git a/sysui/desktop/share/create_tree.sh b/sysui/desktop/share/create_tree.sh +index c6be0bb2a688..45b7c6cb09db 100755 +--- a/sysui/desktop/share/create_tree.sh ++++ b/sysui/desktop/share/create_tree.sh +@@ -87,3 +87,16 @@ for i in base calc draw impress writer; do + cp "${APPDATA_SOURCE_DIR}/libreoffice-${i}.appdata.xml" "${DESTDIR}/${PREFIXDIR}/share/appdata/${PREFIX}-${i}.appdata.xml" + done + ++# Generate gobject-introspection files ++mkdir -p "${DESTDIR}/${PREFIXDIR}/share/gir-1.0" ++g-ir-scanner "${SRCDIR}/include/LibreOfficeKit/LibreOfficeKitGtk.h" "${SRCDIR}/libreofficekit/source/gtk/lokdocview.cxx" \ ++ `${PKG_CONFIG} --cflags gobject-introspection-1.0 gtk+-3.0` -I"${SRCDIR}/include/" \ ++ --include=GLib-2.0 --include=GObject-2.0 --include=Gio-2.0 \ ++ --library=libreofficekitgtk --library-path="${DESTDIR}/${INSTALLDIR}/program" \ ++ --include=Gdk-3.0 --include=GdkPixbuf-2.0 --include=Gtk-3.0 \ ++ --namespace=LOKDocView --nsversion=0.1 --identifier-prefix=LOKDoc --symbol-prefix=lok_doc \ ++ --output="${DESTDIR}/${PREFIXDIR}/share/gir-1.0/LOKDocView-0.1.gir" --warn-all --no-libtool ++ ++mkdir -p "${DESTDIR}/${LIBDIR}/girepository-1.0" ++g-ir-compiler "${DESTDIR}/${PREFIXDIR}/share/gir-1.0/LOKDocView-0.1.gir" \ ++ --output="${DESTDIR}/${LIBDIR}/girepository-1.0/LOKDocView-0.1.typelib" +-- +2.12.0 + diff --git a/SOURCES/0111-get-feedback-for-style-font-font-size-in-tiledrender.patch b/SOURCES/0111-get-feedback-for-style-font-font-size-in-tiledrender.patch new file mode 100644 index 0000000..4d303f2 --- /dev/null +++ b/SOURCES/0111-get-feedback-for-style-font-font-size-in-tiledrender.patch @@ -0,0 +1,96 @@ +From 11a1920fb4fca1624efb2210cbb1f51fb74f6264 Mon Sep 17 00:00:00 2001 +From: Mihai Varga +Date: Mon, 14 Sep 2015 20:06:07 +0300 +Subject: [PATCH 111/398] get feedback for style / font / font size in + tiledrendering + +Change-Id: I92fd5022a4a5736a6323732141e9ea7bafec2a44 +(cherry picked from commit 6023b797c4570b69d0511b0a45bcf67932f32ba6) +--- + sfx2/source/control/unoctitm.cxx | 45 +++++++++++++++++++++++++++++++++------- + 1 file changed, 38 insertions(+), 7 deletions(-) + +diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx +index bba52c6f9722..bb5d6720029f 100644 +--- a/sfx2/source/control/unoctitm.cxx ++++ b/sfx2/source/control/unoctitm.cxx +@@ -28,6 +28,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -37,8 +38,10 @@ + #include + #include + #include ++#include + #include + #include ++#include + #include + #include + #include +@@ -1059,22 +1062,50 @@ void SfxDispatchController_Impl::InterceptLOKStateChangeEvent(const SfxObjectShe + if (!objSh || !objSh->isTiledRendering()) + return; + ++ OUStringBuffer aBuffer; ++ aBuffer.append(aEvent.FeatureURL.Complete); ++ aBuffer.append("="); ++ + if (aEvent.FeatureURL.Path == "Bold" || + aEvent.FeatureURL.Path == "Italic" || + aEvent.FeatureURL.Path == "Underline" || +- aEvent.FeatureURL.Path == "Strikeout") ++ aEvent.FeatureURL.Path == "Strikeout" || ++ aEvent.FeatureURL.Path == "DefaultBullet" || ++ aEvent.FeatureURL.Path == "DefaultNumbering" || ++ aEvent.FeatureURL.Path == "LeftPara" || ++ aEvent.FeatureURL.Path == "CenterPara" || ++ aEvent.FeatureURL.Path == "RightPara" || ++ aEvent.FeatureURL.Path == "JustifyPara") + { +- +- OUStringBuffer aBuffer; +- aBuffer.append(aEvent.FeatureURL.Complete); +- aBuffer.append("="); + bool bTemp = false; + aEvent.State >>= bTemp; + aBuffer.append(bTemp); + +- OUString payload = aBuffer.makeStringAndClear(); +- objSh->libreOfficeKitCallback(LOK_CALLBACK_STATE_CHANGED, payload.toUtf8().getStr()); + } ++ else if (aEvent.FeatureURL.Path == "CharFontName") ++ { ++ ::com::sun::star::awt::FontDescriptor aFontDesc; ++ aEvent.State >>= aFontDesc; ++ aBuffer.append(aFontDesc.Name); ++ } ++ else if (aEvent.FeatureURL.Path == "FontHeight") ++ { ++ ::com::sun::star::frame::status::FontHeight aFontHeight; ++ aEvent.State >>= aFontHeight; ++ aBuffer.append(aFontHeight.Height); ++ } ++ else if (aEvent.FeatureURL.Path == "StyleApply") ++ { ++ ::com::sun::star::frame::status::Template aTemplate; ++ aEvent.State >>= aTemplate; ++ aBuffer.append(aTemplate.StyleName); ++ } ++ else ++ { ++ return; ++ } ++ OUString payload = aBuffer.makeStringAndClear(); ++ objSh->libreOfficeKitCallback(LOK_CALLBACK_STATE_CHANGED, payload.toUtf8().getStr()); + } + + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +-- +2.12.0 + diff --git a/SOURCES/0112-lok-initialize-UNO-url-command-dispatch.patch b/SOURCES/0112-lok-initialize-UNO-url-command-dispatch.patch new file mode 100644 index 0000000..a5643c5 --- /dev/null +++ b/SOURCES/0112-lok-initialize-UNO-url-command-dispatch.patch @@ -0,0 +1,108 @@ +From bb949259f1ca2a384b68616b8c2ae953ea7eba17 Mon Sep 17 00:00:00 2001 +From: Henry Castro +Date: Mon, 14 Sep 2015 20:14:34 -0400 +Subject: [PATCH 112/398] lok: initialize UNO url command dispatch + +In the tiled rendering case, the desktop is headless, so the toolbar +is not created. The toolbar usually initializes all UNO url commands +for each tool item attached. + +This causes that SfxControllerItem that monitor a state, it is not +intercepted by InterceptLOKStateChangeEvent so no callback status changes. + +Change-Id: I5937cda66ef24d31dd92a1edd8c1440081c4b1a4 +(cherry picked from commit d3a2c0f60365d6092e5061b1d061d6e3e53eb9cf) +--- + desktop/source/lib/init.cxx | 58 +++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 58 insertions(+) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index fb8ec3ea361a..f17493761529 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -44,10 +44,15 @@ + #include + #include + #include ++#include + + #include + #include + #include ++#include ++#include ++#include ++#include + #include + #include + #include +@@ -526,6 +531,58 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha + return false; + } + ++static void doc_iniUnoCommands () ++{ ++ OUString sUnoCommands[] = ++ { ++ OUString(".uno:Bold"), ++ OUString(".uno:Italic"), ++ OUString(".uno:Underline"), ++ OUString(".uno:Strikeout"), ++ OUString(".uno:LeftPara"), ++ OUString(".uno:CenterPara"), ++ OUString(".uno:RightPara"), ++ OUString(".uno:JustifyPara"), ++ OUString(".uno:IncrementIndent"), ++ OUString(".uno:DecrementIndent") ++ }; ++ ++ util::URL aCommandURL; ++ const SfxSlot* pSlot = NULL; ++ SfxViewShell* pViewShell = SfxViewShell::Current(); ++ SfxViewFrame* pViewFrame = (pViewShell ? pViewShell->GetViewFrame() : NULL); ++ ++ // check if Frame-Controller were created. ++ if (!pViewShell && !pViewFrame) ++ { ++ SAL_WARN("lok", "iniUnoCommands: No Frame-Controller created."); ++ return; ++ } ++ ++ SfxSlotPool& rSlotPool = SfxSlotPool::GetSlotPool( pViewFrame ); ++ uno::Reference xParser = ++ util::URLTransformer::create(xContext); ++ ++ for ( ++ sal_uInt32 nIterator = 0; ++ nIterator < SAL_N_ELEMENTS(sUnoCommands); ++ nIterator++ ++ ) ++ { ++ aCommandURL.Complete = sUnoCommands[nIterator]; ++ xParser->parseStrict(aCommandURL); ++ pSlot = rSlotPool.GetUnoSlot(aCommandURL.Path); ++ ++ // Initialize slot to dispatch Uno Command. ++ uno::Reference xDispatch = ++ pViewFrame->GetBindings().GetDispatch( pSlot, aCommandURL, false ); ++ if (!xDispatch.is()) ++ { ++ SAL_WARN("lok", "iniUnoCommands: No XDispatch interface : " + aCommandURL.Complete); ++ } ++ } ++} ++ + static int doc_getDocumentType (LibreOfficeKitDocument* pThis) + { + LibLODocument_Impl* pDocument = static_cast(pThis); +@@ -739,6 +796,7 @@ static void doc_initializeForRendering(LibreOfficeKitDocument* pThis) + ITiledRenderable* pDoc = getTiledRenderable(pThis); + if (pDoc) + { ++ doc_iniUnoCommands(); + pDoc->initializeForTiledRendering(); + } + } +-- +2.12.0 + diff --git a/SOURCES/0113-LOK-Sync-the-list-of-commands-we-initialize-with-tho.patch b/SOURCES/0113-LOK-Sync-the-list-of-commands-we-initialize-with-tho.patch new file mode 100644 index 0000000..bc169c6 --- /dev/null +++ b/SOURCES/0113-LOK-Sync-the-list-of-commands-we-initialize-with-tho.patch @@ -0,0 +1,40 @@ +From 6dae4fa9f39f043b2b541d3f10e2be81347acb76 Mon Sep 17 00:00:00 2001 +From: Jan Holesovsky +Date: Tue, 15 Sep 2015 12:00:25 +0200 +Subject: [PATCH 113/398] LOK: Sync the list of commands we initialize with + those we handle. + +A better solution is needed, outlined in tdf#94233. + +Change-Id: Ie2a58c9c5f5c46566da105ef84d736d7290f4634 +(cherry picked from commit 93cdcfac48a3b8cbbd9700ee79f650c6f17d16a4) +--- + desktop/source/lib/init.cxx | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index f17493761529..e56284cdb7cb 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -539,12 +539,17 @@ static void doc_iniUnoCommands () + OUString(".uno:Italic"), + OUString(".uno:Underline"), + OUString(".uno:Strikeout"), ++ OUString(".uno:DefaultBullet"), ++ OUString(".uno:DefaultNumbering"), + OUString(".uno:LeftPara"), + OUString(".uno:CenterPara"), + OUString(".uno:RightPara"), + OUString(".uno:JustifyPara"), + OUString(".uno:IncrementIndent"), +- OUString(".uno:DecrementIndent") ++ OUString(".uno:DecrementIndent"), ++ OUString(".uno:CharFontName"), ++ OUString(".uno:FontHeight"), ++ OUString(".uno:StyleApply") + }; + + util::URL aCommandURL; +-- +2.12.0 + diff --git a/SOURCES/0114-LOK-Avoid-crash-when-the-command-is-not-available-in.patch b/SOURCES/0114-LOK-Avoid-crash-when-the-command-is-not-available-in.patch new file mode 100644 index 0000000..2b858e7 --- /dev/null +++ b/SOURCES/0114-LOK-Avoid-crash-when-the-command-is-not-available-in.patch @@ -0,0 +1,65 @@ +From a673fc9e4b1d04c26a486caa8babf7bd003d5b38 Mon Sep 17 00:00:00 2001 +From: Jan Holesovsky +Date: Tue, 15 Sep 2015 17:04:58 +0200 +Subject: [PATCH 114/398] LOK: Avoid crash when the command is not available in + the given component. + +In that case we get a NULL pSlot. + +Change-Id: I38783ed198b1ab9860398f59ef872a295cbae6f8 +(cherry picked from commit a191076e3b4063a074ebf1a4ef4cded25cebdb8c) +--- + desktop/source/lib/init.cxx | 23 +++++++++-------------- + 1 file changed, 9 insertions(+), 14 deletions(-) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index e56284cdb7cb..87471454b5d2 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -555,7 +555,7 @@ static void doc_iniUnoCommands () + util::URL aCommandURL; + const SfxSlot* pSlot = NULL; + SfxViewShell* pViewShell = SfxViewShell::Current(); +- SfxViewFrame* pViewFrame = (pViewShell ? pViewShell->GetViewFrame() : NULL); ++ SfxViewFrame* pViewFrame = pViewShell? pViewShell->GetViewFrame(): NULL; + + // check if Frame-Controller were created. + if (!pViewShell && !pViewFrame) +@@ -564,26 +564,21 @@ static void doc_iniUnoCommands () + return; + } + +- SfxSlotPool& rSlotPool = SfxSlotPool::GetSlotPool( pViewFrame ); +- uno::Reference xParser = +- util::URLTransformer::create(xContext); ++ SfxSlotPool& rSlotPool = SfxSlotPool::GetSlotPool(pViewFrame); ++ uno::Reference xParser(util::URLTransformer::create(xContext)); + +- for ( +- sal_uInt32 nIterator = 0; +- nIterator < SAL_N_ELEMENTS(sUnoCommands); +- nIterator++ +- ) ++ for (sal_uInt32 nIterator = 0; nIterator < SAL_N_ELEMENTS(sUnoCommands); nIterator++) + { + aCommandURL.Complete = sUnoCommands[nIterator]; + xParser->parseStrict(aCommandURL); + pSlot = rSlotPool.GetUnoSlot(aCommandURL.Path); + +- // Initialize slot to dispatch Uno Command. +- uno::Reference xDispatch = +- pViewFrame->GetBindings().GetDispatch( pSlot, aCommandURL, false ); +- if (!xDispatch.is()) ++ // when null, this command is not supported by the given component ++ // (like eg. Calc does not have ".uno:DefaultBullet" etc.) ++ if (pSlot) + { +- SAL_WARN("lok", "iniUnoCommands: No XDispatch interface : " + aCommandURL.Complete); ++ // Initialize slot to dispatch .uno: Command. ++ pViewFrame->GetBindings().GetDispatch(pSlot, aCommandURL, false); + } + } + } +-- +2.12.0 + diff --git a/SOURCES/0115-tdf-94237-tiled-rendering-Use-the-entire-document-as.patch b/SOURCES/0115-tdf-94237-tiled-rendering-Use-the-entire-document-as.patch new file mode 100644 index 0000000..8fc7fe0 --- /dev/null +++ b/SOURCES/0115-tdf-94237-tiled-rendering-Use-the-entire-document-as.patch @@ -0,0 +1,65 @@ +From 70b567511fb61ff12e9b2b68913a81a4a25ebd59 Mon Sep 17 00:00:00 2001 +From: Jan Holesovsky +Date: Tue, 15 Sep 2015 20:22:08 +0200 +Subject: [PATCH 115/398] tdf#94237 tiled rendering: Use the entire document as + the visual area. + +Many places were already adapted for the tiled rendering, and the conditions +checking for the VisArea() were changed so that the checks are ignored when +tiled rendering is active. + +Unfortunately there are still some places left, and they are causing that +various areas are invalidated only partially. Let's sort it out for good, and +report the entire document as the VisArea() when the tiled rendering is +active, and if there are performance problems, let's profile that & act +accordingly. + +Change-Id: I53f18915ed0aec898704dd1350a9534cfc3f001b +(cherry picked from commit 12e3b51abe883202af09769873f87b27d7de118b) +--- + sw/inc/viewsh.hxx | 3 ++- + sw/source/core/view/viewsh.cxx | 7 +++++++ + 2 files changed, 9 insertions(+), 1 deletion(-) + +diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx +index 763af506b210..1ba064f0c16c 100644 +--- a/sw/inc/viewsh.hxx ++++ b/sw/inc/viewsh.hxx +@@ -31,6 +31,7 @@ + #include + #include + #include ++ + #define LOK_USE_UNSTABLE_API + #include + +@@ -269,7 +270,7 @@ public: + bool SmoothScroll( long lXDiff, long lYDiff, const Rectangle* );//Browser + void EnableSmooth( bool b ) { mbEnableSmooth = b; } + +- const SwRect& VisArea() const { return maVisArea; } ++ const SwRect& VisArea() const; + + // If necessary scroll until passed Rect is situated in visible sector. + void MakeVisible( const SwRect & ); +diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx +index 3d565aea254c..92480b242089 100644 +--- a/sw/source/core/view/viewsh.cxx ++++ b/sw/source/core/view/viewsh.cxx +@@ -569,6 +569,13 @@ void SwViewShell::InvalidateWindows( const SwRect &rRect ) + } + } + ++const SwRect& SwViewShell::VisArea() const ++{ ++ // when using the tiled rendering, consider the entire document as our ++ // visible area ++ return isTiledRendering()? GetLayout()->Frm(): maVisArea; ++} ++ + void SwViewShell::MakeVisible( const SwRect &rRect ) + { + if ( !VisArea().IsInside( rRect ) || IsScrollMDI( this, rRect ) || GetCareWin(*this) ) +-- +2.12.0 + diff --git a/SOURCES/0116-sysui-depend-on-libreofficekitgtk-for-introspection.patch b/SOURCES/0116-sysui-depend-on-libreofficekitgtk-for-introspection.patch new file mode 100644 index 0000000..7e258a4 --- /dev/null +++ b/SOURCES/0116-sysui-depend-on-libreofficekitgtk-for-introspection.patch @@ -0,0 +1,30 @@ +From d876fa68f90b10608e77f34a71d37e772df8184b Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Thu, 17 Sep 2015 20:13:38 +0200 +Subject: [PATCH 116/398] sysui: depend on libreofficekitgtk for introspection + +Change-Id: I028d4e6d3c5fd57ae412fcfca5184722e4283524 +Reviewed-on: https://gerrit.libreoffice.org/18671 +Tested-by: Jenkins +Reviewed-by: Miklos Vajna +(cherry picked from commit 9b3495b4af679bd868e03e707100948bc4ba6019) +--- + sysui/CustomTarget_share.mk | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sysui/CustomTarget_share.mk b/sysui/CustomTarget_share.mk +index e4dde6fbaaaf..84907d1003c4 100644 +--- a/sysui/CustomTarget_share.mk ++++ b/sysui/CustomTarget_share.mk +@@ -175,7 +175,7 @@ $(share_WORKDIR)/%/openoffice.sh: $(share_SRCDIR)/share/openoffice.sh + + $(share_WORKDIR)/%/create_tree.sh: $(share_SRCDIR)/share/create_tree.sh $(share_WORKDIR)/%/mimelnklist \ + $(share_WORKDIR)/%/openoffice.org.xml $(share_WORKDIR)/%/openoffice.applications $(share_WORKDIR)/%/openoffice.mime \ +- $(share_WORKDIR)/%/openoffice.keys $(share_WORKDIR)/%/launcherlist ++ $(share_WORKDIR)/%/openoffice.keys $(share_WORKDIR)/%/launcherlist $(if $(INTROSPECTION_SCANNER),$(call gb_Library_get_target,libreofficekitgtk)) + mkdir -p $(dir $@) + $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),CAT,1) + echo "#!/bin/sh" > $@ +-- +2.12.0 + diff --git a/SOURCES/0117-vcl-ITiledRenderable-add-getCurrentViewShell-and-imp.patch b/SOURCES/0117-vcl-ITiledRenderable-add-getCurrentViewShell-and-imp.patch new file mode 100644 index 0000000..015f8dd --- /dev/null +++ b/SOURCES/0117-vcl-ITiledRenderable-add-getCurrentViewShell-and-imp.patch @@ -0,0 +1,76 @@ +From 7f7c2c952d264e515923a533d2e36dd4a42bcd92 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Mon, 14 Sep 2015 12:50:48 +0200 +Subject: [PATCH 117/398] vcl::ITiledRenderable: add getCurrentViewShell() and + implement it for Writer + +Change-Id: Ic936746f3d473e15f5a1589cba35173778b442c6 +(cherry picked from commit 7b0de91faaaf9a051e082ec7ea5024474f4a1299) +--- + include/vcl/ITiledRenderable.hxx | 10 ++++++++++ + sw/inc/unotxdoc.hxx | 2 ++ + sw/source/uibase/uno/unotxdoc.cxx | 5 +++++ + 3 files changed, 17 insertions(+) + +diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx +index 8824361f9f70..a31d808437af 100644 +--- a/include/vcl/ITiledRenderable.hxx ++++ b/include/vcl/ITiledRenderable.hxx +@@ -16,6 +16,8 @@ + #include + #include + ++class SfxViewShell; ++ + namespace vcl + { + +@@ -139,8 +141,16 @@ public: + * @see lok::Document::resetSelection(). + */ + virtual void resetSelection() = 0; ++ ++ /// Get the currently active view shell of the document. ++ virtual SfxViewShell* getCurrentViewShell() ++ { ++ return 0; ++ } + }; + + } // namespace vcl + + #endif // INCLUDED_VCL_ITILEDRENDERABLE_HXX ++ ++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx +index 9f0b03b3af38..71dbb4f2fd5a 100644 +--- a/sw/inc/unotxdoc.hxx ++++ b/sw/inc/unotxdoc.hxx +@@ -431,6 +431,8 @@ public: + virtual void setGraphicSelection(int nType, int nX, int nY) SAL_OVERRIDE; + /// @see vcl::ITiledRenderable::resetSelection(). + virtual void resetSelection() SAL_OVERRIDE; ++ /// @see vcl::ITiledRenderable::getCurrentViewShell(). ++ virtual SfxViewShell* getCurrentViewShell() SAL_OVERRIDE; + + // ::com::sun::star::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 ) throw (::css::uno::RuntimeException, ::std::exception) SAL_OVERRIDE; +diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx +index d6315d2964ae..8dce9b5589d6 100644 +--- a/sw/source/uibase/uno/unotxdoc.cxx ++++ b/sw/source/uibase/uno/unotxdoc.cxx +@@ -3410,6 +3410,11 @@ void SwXTextDocument::resetSelection() + pWrtShell->ResetSelect(0, false); + } + ++SfxViewShell* SwXTextDocument::getCurrentViewShell() ++{ ++ return pDocShell->GetView(); ++} ++ + void SAL_CALL SwXTextDocument::paintTile( const ::css::uno::Any& Parent, ::sal_Int32 nOutputWidth, ::sal_Int32 nOutputHeight, ::sal_Int32 nTilePosX, ::sal_Int32 nTilePosY, ::sal_Int32 nTileWidth, ::sal_Int32 nTileHeight ) throw (::css::uno::RuntimeException, ::std::exception) + { + SystemGraphicsData aData; +-- +2.12.0 + diff --git a/SOURCES/0118-sfx2-add-SfxLokHelper.patch b/SOURCES/0118-sfx2-add-SfxLokHelper.patch new file mode 100644 index 0000000..0604baf --- /dev/null +++ b/SOURCES/0118-sfx2-add-SfxLokHelper.patch @@ -0,0 +1,95 @@ +From 5bb7ebf9192f57c0de9eb58652dca638b34d2fe3 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Mon, 14 Sep 2015 14:36:38 +0200 +Subject: [PATCH 118/398] sfx2: add SfxLokHelper + +This is meant to be a class that is visible outside sfx2 (so e.g. +desktop can use it later), but has access to various sfx2 internals. + +Change-Id: I83204963492b11c1c4a621e86528a64fba27acf3 +(cherry picked from commit 58b5c13b00cd4d881e1d6313316cc621198a4b04) +--- + include/sfx2/lokhelper.hxx | 21 +++++++++++++++++++++ + sfx2/Library_sfx.mk | 1 + + sfx2/source/view/lokhelper.cxx | 29 +++++++++++++++++++++++++++++ + 3 files changed, 51 insertions(+) + create mode 100644 include/sfx2/lokhelper.hxx + create mode 100644 sfx2/source/view/lokhelper.cxx + +diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx +new file mode 100644 +index 000000000000..d439bcedce19 +--- /dev/null ++++ b/include/sfx2/lokhelper.hxx +@@ -0,0 +1,21 @@ ++/* -*- 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 ++ ++class SfxViewShell; ++ ++class SFX2_DLLPUBLIC SfxLokHelper ++{ ++public: ++ /// Create a new view shell for pViewShell's object shell. ++ static int createView(SfxViewShell* pViewShell); ++}; ++ ++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk +index 0a1100e1f51a..40dedd502ba0 100644 +--- a/sfx2/Library_sfx.mk ++++ b/sfx2/Library_sfx.mk +@@ -290,6 +290,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\ + sfx2/source/view/frame2 \ + sfx2/source/view/frmload \ + sfx2/source/view/ipclient \ ++ sfx2/source/view/lokhelper \ + sfx2/source/view/printer \ + sfx2/source/view/sfxbasecontroller \ + sfx2/source/view/userinputinterception \ +diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx +new file mode 100644 +index 000000000000..4f500e0388ef +--- /dev/null ++++ b/sfx2/source/view/lokhelper.cxx +@@ -0,0 +1,29 @@ ++/* -*- 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 ++#include ++#include ++#include ++#include ++ ++#include ++ ++int SfxLokHelper::createView(SfxViewShell* pViewShell) ++{ ++ SfxViewFrame* pViewFrame = pViewShell->GetViewFrame(); ++ SfxRequest aRequest(pViewFrame, SID_NEWWINDOW); ++ pViewFrame->ExecView_Impl(aRequest); ++ ++ // The SfxViewShell ctor always puts the view shell to the end of the vector. ++ SfxViewShellArr_Impl& rViewArr = SfxGetpApp()->GetViewShells_Impl(); ++ return rViewArr.size() - 1; ++} ++ ++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +-- +2.12.0 + diff --git a/SOURCES/0119-lok-Document-add-createView.patch b/SOURCES/0119-lok-Document-add-createView.patch new file mode 100644 index 0000000..e0d8b59 --- /dev/null +++ b/SOURCES/0119-lok-Document-add-createView.patch @@ -0,0 +1,135 @@ +From 4692ad2debc22ba83d79b6c13e22e694f33b5a03 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Mon, 14 Sep 2015 14:36:56 +0200 +Subject: [PATCH 119/398] lok::Document: add createView() + +Change-Id: Ic871ec41992b611b10958799b2dc12375a91efe4 +(cherry picked from commit 655c7877a0650b7bfd04a3294cdf92bc7ab94055) +--- + desktop/source/lib/init.cxx | 19 +++++++++++++++++++ + include/LibreOfficeKit/LibreOfficeKit.h | 3 +++ + include/LibreOfficeKit/LibreOfficeKit.hxx | 10 ++++++++++ + libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 14 ++++++++++++++ + 4 files changed, 46 insertions(+) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 87471454b5d2..ea5de4df1a5c 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -53,6 +53,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -249,6 +250,7 @@ static void doc_setGraphicSelection (LibreOfficeKitDocument* pThis, + static void doc_resetSelection (LibreOfficeKitDocument* pThis); + static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCommand); + ++static int doc_createView(LibreOfficeKitDocument* pThis); + + LibLODocument_Impl::LibLODocument_Impl(const uno::Reference &xComponent) : + mxComponent( xComponent ) +@@ -280,6 +282,8 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference resetSelection = doc_resetSelection; + m_pDocumentClass->getCommandValues = doc_getCommandValues; + ++ m_pDocumentClass->createView = doc_createView; ++ + gDocumentClass = m_pDocumentClass; + } + pClass = m_pDocumentClass.get(); +@@ -1032,6 +1036,21 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo + } + } + ++static int doc_createView(LibreOfficeKitDocument* pThis) ++{ ++ SolarMutexGuard aGuard; ++ ++ ITiledRenderable* pDoc = getTiledRenderable(pThis); ++ if (!pDoc) ++ { ++ gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering"; ++ return -1; ++ } ++ ++ SfxViewShell* pViewShell = pDoc->getCurrentViewShell(); ++ return SfxLokHelper::createView(pViewShell); ++} ++ + static char* lo_getError (LibreOfficeKit *pThis) + { + LibLibreOffice_Impl* pLib = static_cast(pThis); +diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h +index 8060f0e6ec7c..eae35374e032 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.h ++++ b/include/LibreOfficeKit/LibreOfficeKit.h +@@ -162,6 +162,9 @@ struct _LibreOfficeKitDocumentClass + + /// @see lok::Document:getStyles + char* (*getCommandValues) (LibreOfficeKitDocument* pThis, const char* pCommand); ++ ++ /// @see lok::Document::createView(). ++ int (*createView) (LibreOfficeKitDocument* pThis); + #endif // LOK_USE_UNSTABLE_API + }; + +diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx +index 44599948e659..1a8b002ecba6 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.hxx ++++ b/include/LibreOfficeKit/LibreOfficeKit.hxx +@@ -257,6 +257,16 @@ public: + { + return mpDoc->pClass->getCommandValues(mpDoc, pCommand); + } ++ ++ /** ++ * Create a new view for an existing document. ++ * By default a loaded document has 1 view. ++ * @return the ID of the new view. ++ */ ++ int createView() ++ { ++ return mpDoc->pClass->createView(mpDoc); ++ } + #endif // LOK_USE_UNSTABLE_API + }; + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index ab33fc703731..60c5281974f4 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -147,6 +147,14 @@ static void toggleFindbar(GtkWidget* /*pButton*/, gpointer /*pItem*/) + } + } + ++/// Calls lok::Document::createView(). ++static void createView(GtkWidget* /*pButton*/, gpointer /*pItem*/) ++{ ++ LOKDocView* pLOKDocView = LOK_DOC_VIEW(pDocView); ++ LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(pLOKDocView); ++ pDocument->pClass->createView(pDocument); ++} ++ + /// Our GtkClipboardGetFunc implementation for HTML. + static void htmlGetFunc(GtkClipboard* /*pClipboard*/, GtkSelectionData* pSelectionData, guint /*info*/, gpointer pUserData) + { +@@ -554,6 +562,12 @@ int main( int argc, char* argv[] ) + gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pFindButton, -1); + g_signal_connect(G_OBJECT(pFindButton), "clicked", G_CALLBACK(toggleFindbar), NULL); + ++ GtkToolItem* pNewViewButton = gtk_tool_button_new( NULL, NULL); ++ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pNewViewButton), "view-continuous-symbolic"); ++ gtk_tool_item_set_tooltip_text(pNewViewButton, "New View"); ++ gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pNewViewButton, -1); ++ g_signal_connect(G_OBJECT(pNewViewButton), "clicked", G_CALLBACK(createView), NULL); ++ + gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), gtk_separator_tool_item_new(), -1); + + pBold = gtk_toggle_tool_button_new(); +-- +2.12.0 + diff --git a/SOURCES/0120-gtktiledviewer-add-button-tooltips.patch b/SOURCES/0120-gtktiledviewer-add-button-tooltips.patch new file mode 100644 index 0000000..12942ff --- /dev/null +++ b/SOURCES/0120-gtktiledviewer-add-button-tooltips.patch @@ -0,0 +1,88 @@ +From 34b72ed4941d44455c324e03ed19469ab21c01c8 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Mon, 14 Sep 2015 15:10:22 +0200 +Subject: [PATCH 120/398] gtktiledviewer: add button tooltips + +Change-Id: Ifad67adf80761118bbbfb110cbadd493214fee93 +(cherry picked from commit 179a0d0ea0ec4251152fe4c5e0fb3fd53f6f7967) +--- + libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 60c5281974f4..dd369f5e7fb1 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -512,16 +512,19 @@ int main( int argc, char* argv[] ) + + GtkToolItem* pZoomIn = gtk_tool_button_new( NULL, NULL ); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pZoomIn), "zoom-in-symbolic"); ++ gtk_tool_item_set_tooltip_text(pZoomIn, "Zoom In"); + gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pZoomIn, 0); + g_signal_connect( G_OBJECT(pZoomIn), "clicked", G_CALLBACK(changeZoom), NULL ); + + GtkToolItem* pZoom1 = gtk_tool_button_new( NULL, NULL ); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pZoom1), "zoom-original-symbolic"); ++ gtk_tool_item_set_tooltip_text(pZoom1, "Normal Size"); + gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pZoom1, -1); + g_signal_connect( G_OBJECT(pZoom1), "clicked", G_CALLBACK(changeZoom), NULL ); + + GtkToolItem* pZoomOut = gtk_tool_button_new( NULL, NULL ); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pZoomOut), "zoom-out-symbolic"); ++ gtk_tool_item_set_tooltip_text(pZoomOut, "Zoom Out"); + gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pZoomOut, -1); + g_signal_connect( G_OBJECT(pZoomOut), "clicked", G_CALLBACK(changeZoom), NULL ); + +@@ -548,17 +551,20 @@ int main( int argc, char* argv[] ) + // Cut, copy & paste. + GtkToolItem* pCopyButton = gtk_tool_button_new( NULL, NULL); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(pCopyButton), "edit-copy-symbolic"); ++ gtk_tool_item_set_tooltip_text(pCopyButton, "Copy"); + gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pCopyButton, -1); + g_signal_connect(G_OBJECT(pCopyButton), "clicked", G_CALLBACK(doCopy), NULL); + gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), gtk_separator_tool_item_new(), -1); + + pEnableEditing = gtk_toggle_tool_button_new(); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pEnableEditing), "insert-text-symbolic"); ++ gtk_tool_item_set_tooltip_text(pEnableEditing, "Edit"); + gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pEnableEditing, -1); + g_signal_connect(G_OBJECT(pEnableEditing), "toggled", G_CALLBACK(toggleEditing), NULL); + + GtkToolItem* pFindButton = gtk_tool_button_new( NULL, NULL); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pFindButton), "edit-find-symbolic"); ++ gtk_tool_item_set_tooltip_text(pFindButton, "Find"); + gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pFindButton, -1); + g_signal_connect(G_OBJECT(pFindButton), "clicked", G_CALLBACK(toggleFindbar), NULL); + +@@ -572,24 +578,28 @@ int main( int argc, char* argv[] ) + + pBold = gtk_toggle_tool_button_new(); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pBold), "format-text-bold-symbolic"); ++ gtk_tool_item_set_tooltip_text(pBold, "Bold"); + gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pBold, -1); + g_signal_connect(G_OBJECT(pBold), "toggled", G_CALLBACK(toggleToolItem), NULL); + lcl_registerToolItem(pBold, ".uno:Bold"); + + pItalic = gtk_toggle_tool_button_new(); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pItalic), "format-text-italic-symbolic"); ++ gtk_tool_item_set_tooltip_text(pItalic, "Italic"); + gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pItalic, -1); + g_signal_connect(G_OBJECT(pItalic), "toggled", G_CALLBACK(toggleToolItem), NULL); + lcl_registerToolItem(pItalic, ".uno:Italic"); + + pUnderline = gtk_toggle_tool_button_new(); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pUnderline), "format-text-underline-symbolic"); ++ gtk_tool_item_set_tooltip_text(pUnderline, "Underline"); + gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pUnderline, -1); + g_signal_connect(G_OBJECT(pUnderline), "toggled", G_CALLBACK(toggleToolItem), NULL); + lcl_registerToolItem(pUnderline, ".uno:Underline"); + + pStrikethrough = gtk_toggle_tool_button_new (); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pStrikethrough), "format-text-strikethrough-symbolic"); ++ gtk_tool_item_set_tooltip_text(pStrikethrough, "Strikethrough"); + gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pStrikethrough, -1); + g_signal_connect(G_OBJECT(pStrikethrough), "toggled", G_CALLBACK(toggleToolItem), NULL); + lcl_registerToolItem(pStrikethrough, ".uno:Strikeout"); +-- +2.12.0 + diff --git a/SOURCES/0121-lok-Office-add-getViews.patch b/SOURCES/0121-lok-Office-add-getViews.patch new file mode 100644 index 0000000..c2f6d8a --- /dev/null +++ b/SOURCES/0121-lok-Office-add-getViews.patch @@ -0,0 +1,160 @@ +From f0e5649a3d463f89903ad337a5f33f3a33e27478 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Mon, 14 Sep 2015 15:43:17 +0200 +Subject: [PATCH 121/398] lok::Office: add getViews() + +Change-Id: Iabfb0f2a19106dc4a6bdae45f9e85d76c68a973e +(cherry picked from commit 2e523afe61f76d9b065a771e558683afb701b93b) +--- + desktop/qa/desktop_lib/test_desktop_lib.cxx | 13 +++++++++++++ + desktop/source/lib/init.cxx | 7 +++++++ + include/LibreOfficeKit/LibreOfficeKit.h | 3 +++ + include/LibreOfficeKit/LibreOfficeKit.hxx | 10 ++++++++++ + include/sfx2/lokhelper.hxx | 3 +++ + sfx2/source/view/lokhelper.cxx | 6 ++++++ + 6 files changed, 42 insertions(+) + +diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx +index a08961403aac..d5616d566f6a 100644 +--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx ++++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx +@@ -14,6 +14,7 @@ + #include + #include + #include ++#include + #include + + #include "../../inc/lib/init.hxx" +@@ -50,6 +51,7 @@ public: + void runAllTests(); + void testGetStyles(); + void testGetFonts(); ++ void testCreateView(); + + CPPUNIT_TEST_SUITE(DesktopLOKTest); + CPPUNIT_TEST(runAllTests); +@@ -83,6 +85,7 @@ void DesktopLOKTest::runAllTests() + { + testGetStyles(); + testGetFonts(); ++ testCreateView(); + } + + void DesktopLOKTest::testGetStyles() +@@ -134,6 +137,16 @@ void DesktopLOKTest::testGetFonts() + closeDoc(); + } + ++void DesktopLOKTest::testCreateView() ++{ ++ LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); ++ CPPUNIT_ASSERT_EQUAL(1, SfxLokHelper::getViews()); ++ ++ pDocument->m_pDocumentClass->createView(pDocument); ++ CPPUNIT_ASSERT_EQUAL(2, SfxLokHelper::getViews()); ++ closeDoc(); ++} ++ + CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); + + CPPUNIT_PLUGIN_IMPLEMENT(); +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index ea5de4df1a5c..3554d46573bf 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -310,6 +310,7 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions (LibreOfficeKit* pThi + static void lo_registerCallback (LibreOfficeKit* pThis, + LibreOfficeKitCallback pCallback, + void* pData); ++static int lo_getViews(LibreOfficeKit* pThis); + + struct LibLibreOffice_Impl : public _LibreOfficeKit + { +@@ -333,6 +334,7 @@ struct LibLibreOffice_Impl : public _LibreOfficeKit + m_pOfficeClass->getError = lo_getError; + m_pOfficeClass->documentLoadWithOptions = lo_documentLoadWithOptions; + m_pOfficeClass->registerCallback = lo_registerCallback; ++ m_pOfficeClass->getViews = lo_getViews; + + gOfficeClass = m_pOfficeClass; + } +@@ -450,6 +452,11 @@ static void lo_registerCallback (LibreOfficeKit* pThis, + pLib->mpCallbackData = pData; + } + ++static int lo_getViews(LibreOfficeKit* /*pThis*/) ++{ ++ return SfxLokHelper::getViews(); ++} ++ + static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const char* pFormat, const char* pFilterOptions) + { + LibLODocument_Impl* pDocument = static_cast(pThis); +diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h +index eae35374e032..b59d3f8c9f5d 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.h ++++ b/include/LibreOfficeKit/LibreOfficeKit.h +@@ -54,6 +54,9 @@ struct _LibreOfficeKitClass + void (*registerCallback) (LibreOfficeKit* pThis, + LibreOfficeKitCallback pCallback, + void* pData); ++ ++ /// @see lok::Office::getViews(). ++ int (*getViews) (LibreOfficeKit* pThis); + #endif + }; + +diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx +index 1a8b002ecba6..32f190227719 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.hxx ++++ b/include/LibreOfficeKit/LibreOfficeKit.hxx +@@ -313,6 +313,16 @@ public: + { + return mpThis->pClass->getError(mpThis); + } ++ ++#ifdef LOK_USE_UNSTABLE_API ++ /** ++ * Get number of total views. ++ */ ++ inline int getViews() ++ { ++ return mpThis->pClass->getViews(mpThis); ++ } ++#endif + }; + + /// Factory method to create a lok::Office instance. +diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx +index d439bcedce19..bc3f43010c41 100644 +--- a/include/sfx2/lokhelper.hxx ++++ b/include/sfx2/lokhelper.hxx +@@ -16,6 +16,9 @@ class SFX2_DLLPUBLIC SfxLokHelper + public: + /// Create a new view shell for pViewShell's object shell. + static int createView(SfxViewShell* pViewShell); ++ ++ /// Total number of view shells. ++ static int getViews(); + }; + + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx +index 4f500e0388ef..1bb43d0ea02f 100644 +--- a/sfx2/source/view/lokhelper.cxx ++++ b/sfx2/source/view/lokhelper.cxx +@@ -26,4 +26,10 @@ int SfxLokHelper::createView(SfxViewShell* pViewShell) + return rViewArr.size() - 1; + } + ++int SfxLokHelper::getViews() ++{ ++ SfxViewShellArr_Impl& rViewArr = SfxGetpApp()->GetViewShells_Impl(); ++ return rViewArr.size(); ++} ++ + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +-- +2.12.0 + diff --git a/SOURCES/0122-CppunitTest_desktop_lib-fix-reported-name-of-failed-.patch b/SOURCES/0122-CppunitTest_desktop_lib-fix-reported-name-of-failed-.patch new file mode 100644 index 0000000..f64dadd --- /dev/null +++ b/SOURCES/0122-CppunitTest_desktop_lib-fix-reported-name-of-failed-.patch @@ -0,0 +1,50 @@ +From 5f48949ddd73d547607e0e2b502146775efae75f Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Mon, 14 Sep 2015 15:56:34 +0200 +Subject: [PATCH 122/398] CppunitTest_desktop_lib: fix reported name of failed + test + +Change-Id: Iaa9effdcf6d6c6b2292e3fc7b666afdb3678694d +(cherry picked from commit 4f62c14748c0e62ad0212e831d606ac32e694eca) +--- + desktop/qa/desktop_lib/test_desktop_lib.cxx | 12 +++--------- + 1 file changed, 3 insertions(+), 9 deletions(-) + +diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx +index d5616d566f6a..8642f4491f9f 100644 +--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx ++++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx +@@ -48,13 +48,14 @@ public: + LibLODocument_Impl* loadDoc(const char* pName); + void closeDoc(); + +- void runAllTests(); + void testGetStyles(); + void testGetFonts(); + void testCreateView(); + + CPPUNIT_TEST_SUITE(DesktopLOKTest); +- CPPUNIT_TEST(runAllTests); ++ CPPUNIT_TEST(testGetStyles); ++ CPPUNIT_TEST(testGetFonts); ++ CPPUNIT_TEST(testCreateView); + CPPUNIT_TEST_SUITE_END(); + + uno::Reference mxComponent; +@@ -81,13 +82,6 @@ void DesktopLOKTest::closeDoc() + } + } + +-void DesktopLOKTest::runAllTests() +-{ +- testGetStyles(); +- testGetFonts(); +- testCreateView(); +-} +- + void DesktopLOKTest::testGetStyles() + { + LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); +-- +2.12.0 + diff --git a/SOURCES/0123-lok-Document-add-destroyView.patch b/SOURCES/0123-lok-Document-add-destroyView.patch new file mode 100644 index 0000000..0bdad34 --- /dev/null +++ b/SOURCES/0123-lok-Document-add-destroyView.patch @@ -0,0 +1,139 @@ +From 7da9e9d07f129c274f1d29db92be237a3e6f2e7f Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 15 Sep 2015 09:31:49 +0200 +Subject: [PATCH 123/398] lok::Document: add destroyView() + +Change-Id: Id9e92593217541b4123e95279019cec3c958056c +(cherry picked from commit 10a0cad9d6990abac507899a34fbcdeb466187f7) +--- + desktop/qa/desktop_lib/test_desktop_lib.cxx | 5 ++++- + desktop/source/lib/init.cxx | 9 +++++++++ + include/LibreOfficeKit/LibreOfficeKit.h | 2 ++ + include/LibreOfficeKit/LibreOfficeKit.hxx | 9 +++++++++ + include/sfx2/lokhelper.hxx | 2 ++ + sfx2/source/view/lokhelper.cxx | 12 ++++++++++++ + 6 files changed, 38 insertions(+), 1 deletion(-) + +diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx +index 8642f4491f9f..6baaa32239c9 100644 +--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx ++++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx +@@ -136,8 +136,11 @@ void DesktopLOKTest::testCreateView() + LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); + CPPUNIT_ASSERT_EQUAL(1, SfxLokHelper::getViews()); + +- pDocument->m_pDocumentClass->createView(pDocument); ++ int nId = pDocument->m_pDocumentClass->createView(pDocument); + CPPUNIT_ASSERT_EQUAL(2, SfxLokHelper::getViews()); ++ ++ pDocument->m_pDocumentClass->destroyView(pDocument, nId); ++ CPPUNIT_ASSERT_EQUAL(1, SfxLokHelper::getViews()); + closeDoc(); + } + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 3554d46573bf..3b1286e5944d 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -251,6 +251,7 @@ static void doc_resetSelection (LibreOfficeKitDocument* pThis); + static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCommand); + + static int doc_createView(LibreOfficeKitDocument* pThis); ++static void doc_destroyView(LibreOfficeKitDocument* pThis, int nId); + + LibLODocument_Impl::LibLODocument_Impl(const uno::Reference &xComponent) : + mxComponent( xComponent ) +@@ -283,6 +284,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference getCommandValues = doc_getCommandValues; + + m_pDocumentClass->createView = doc_createView; ++ m_pDocumentClass->destroyView = doc_destroyView; + + gDocumentClass = m_pDocumentClass; + } +@@ -1058,6 +1060,13 @@ static int doc_createView(LibreOfficeKitDocument* pThis) + return SfxLokHelper::createView(pViewShell); + } + ++static void doc_destroyView(LibreOfficeKitDocument* /*pThis*/, int nId) ++{ ++ SolarMutexGuard aGuard; ++ ++ SfxLokHelper::destroyView(nId); ++} ++ + static char* lo_getError (LibreOfficeKit *pThis) + { + LibLibreOffice_Impl* pLib = static_cast(pThis); +diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h +index b59d3f8c9f5d..7f41d13ff393 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.h ++++ b/include/LibreOfficeKit/LibreOfficeKit.h +@@ -168,6 +168,8 @@ struct _LibreOfficeKitDocumentClass + + /// @see lok::Document::createView(). + int (*createView) (LibreOfficeKitDocument* pThis); ++ /// @see lok::Document::destroyView(). ++ void (*destroyView) (LibreOfficeKitDocument* pThis, int nId); + #endif // LOK_USE_UNSTABLE_API + }; + +diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx +index 32f190227719..3e1a0ac20b07 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.hxx ++++ b/include/LibreOfficeKit/LibreOfficeKit.hxx +@@ -267,6 +267,15 @@ public: + { + return mpDoc->pClass->createView(mpDoc); + } ++ ++ /** ++ * Destroy a view of an existring document. ++ * @param nId a view ID, returned by createView(). ++ */ ++ void destroyView(int nId) ++ { ++ mpDoc->pClass->destroyView(mpDoc, nId); ++ } + #endif // LOK_USE_UNSTABLE_API + }; + +diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx +index bc3f43010c41..9430cd5665d8 100644 +--- a/include/sfx2/lokhelper.hxx ++++ b/include/sfx2/lokhelper.hxx +@@ -16,6 +16,8 @@ class SFX2_DLLPUBLIC SfxLokHelper + public: + /// Create a new view shell for pViewShell's object shell. + static int createView(SfxViewShell* pViewShell); ++ /// Destroy a view shell from the global shell list. ++ static void destroyView(size_t nId); + + /// Total number of view shells. + static int getViews(); +diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx +index 1bb43d0ea02f..557478a78ae6 100644 +--- a/sfx2/source/view/lokhelper.cxx ++++ b/sfx2/source/view/lokhelper.cxx +@@ -26,6 +26,18 @@ int SfxLokHelper::createView(SfxViewShell* pViewShell) + return rViewArr.size() - 1; + } + ++void SfxLokHelper::destroyView(size_t nId) ++{ ++ SfxViewShellArr_Impl& rViewArr = SfxGetpApp()->GetViewShells_Impl(); ++ if (nId > rViewArr.size() - 1) ++ return; ++ ++ SfxViewShell* pViewShell = rViewArr[nId]; ++ SfxViewFrame* pViewFrame = pViewShell->GetViewFrame(); ++ SfxRequest aRequest(pViewFrame, SID_CLOSEWIN); ++ pViewFrame->Exec_Impl(aRequest); ++} ++ + int SfxLokHelper::getViews() + { + SfxViewShellArr_Impl& rViewArr = SfxGetpApp()->GetViewShells_Impl(); +-- +2.12.0 + diff --git a/SOURCES/0124-sfx2-add-missing-header-guard.patch b/SOURCES/0124-sfx2-add-missing-header-guard.patch new file mode 100644 index 0000000..828d655 --- /dev/null +++ b/SOURCES/0124-sfx2-add-missing-header-guard.patch @@ -0,0 +1,35 @@ +From a4680c754fd012d803f2c86144593275d3640f9a Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 15 Sep 2015 10:31:20 +0200 +Subject: [PATCH 124/398] sfx2: add missing header guard + +Change-Id: Ide261670be475f5d54d9d12c701ad82470396aeb +(cherry picked from commit d990a8762e5e67747e169103bc8b9a40605afa81) +--- + include/sfx2/lokhelper.hxx | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx +index 9430cd5665d8..b57cb7d75b23 100644 +--- a/include/sfx2/lokhelper.hxx ++++ b/include/sfx2/lokhelper.hxx +@@ -7,6 +7,9 @@ + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + ++#ifndef INCLUDED_SFX2_LOKHELPER_HXX ++#define INCLUDED_SFX2_LOKHELPER_HXX ++ + #include + + class SfxViewShell; +@@ -23,4 +26,6 @@ public: + static int getViews(); + }; + ++#endif ++ + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +-- +2.12.0 + diff --git a/SOURCES/0125-gtktiledviewer-these-globals-can-be-static.patch b/SOURCES/0125-gtktiledviewer-these-globals-can-be-static.patch new file mode 100644 index 0000000..01fe697 --- /dev/null +++ b/SOURCES/0125-gtktiledviewer-these-globals-can-be-static.patch @@ -0,0 +1,42 @@ +From 08fa99f5d2eba0159b34d401b179f294ac483125 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 15 Sep 2015 10:59:58 +0200 +Subject: [PATCH 125/398] gtktiledviewer: these globals can be static + +Change-Id: Ife0a4bb1102f6135e297dc69ba5b52b89a5dd9dd +(cherry picked from commit 20df29e660139fc27d50fe006202f7ea78a3903a) +--- + libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index dd369f5e7fb1..2bafd24f8b08 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -38,17 +38,17 @@ static GtkToolItem* pItalic; + static GtkToolItem* pUnderline; + static GtkToolItem* pStrikethrough; + static GtkWidget* pScrolledWindow; +-std::map g_aToolItemCommandNames; +-std::map g_aCommandNameToolItems; +-bool g_bToolItemBroadcast = true; ++static std::map g_aToolItemCommandNames; ++static std::map g_aCommandNameToolItems; ++static bool g_bToolItemBroadcast = true; + static GtkWidget* pVBox; + static GtkComboBoxText* pPartSelector; + static GtkWidget* pPartModeComboBox; + /// Should the part selector avoid calling lok::Document::setPart()? + static bool g_bPartSelectorBroadcast = true; +-GtkWidget* pFindbar; +-GtkWidget* pFindbarEntry; +-GtkWidget* pFindbarLabel; ++static GtkWidget* pFindbar; ++static GtkWidget* pFindbarEntry; ++static GtkWidget* pFindbarLabel; + + static void lcl_registerToolItem(GtkToolItem* pItem, const std::string& rName) + { +-- +2.12.0 + diff --git a/SOURCES/0126-gtktiledviewer-allow-multiple-DocView-instances.patch b/SOURCES/0126-gtktiledviewer-allow-multiple-DocView-instances.patch new file mode 100644 index 0000000..b0c9429 --- /dev/null +++ b/SOURCES/0126-gtktiledviewer-allow-multiple-DocView-instances.patch @@ -0,0 +1,321 @@ +From f5e3ccb7b5ccdc9b1064938cc4ce65b677255e3e Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 15 Sep 2015 11:55:09 +0200 +Subject: [PATCH 126/398] gtktiledviewer: allow multiple DocView instances + +Change-Id: I4e8a08d71a94445e8fd30563867a2741cad862e5 +(cherry picked from commit f6ef6af23db8b718ef75f66680f696396fa74eaf) +--- + .../qa/gtktiledviewer/gtktiledviewer.cxx | 109 +++++++++++++-------- + 1 file changed, 70 insertions(+), 39 deletions(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 2bafd24f8b08..096458a93dce 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -30,7 +30,6 @@ static int help() + return 1; + } + +-static GtkWidget* pDocView; + static GtkWidget* pStatusBar; + static GtkToolItem* pEnableEditing; + static GtkToolItem* pBold; +@@ -50,6 +49,24 @@ static GtkWidget* pFindbar; + static GtkWidget* pFindbarEntry; + static GtkWidget* pFindbarLabel; + ++class TiledWindow ++{ ++public: ++ GtkWidget* m_pDocView; ++ ++ TiledWindow() ++ : m_pDocView(0) ++ { ++ } ++}; ++ ++static std::map g_aWindows; ++ ++static TiledWindow& lcl_getTiledWindow(GtkWidget* pWidget) ++{ ++ return g_aWindows[gtk_widget_get_toplevel(pWidget)]; ++} ++ + static void lcl_registerToolItem(GtkToolItem* pItem, const std::string& rName) + { + g_aToolItemCommandNames[pItem] = rName; +@@ -60,7 +77,7 @@ const float fZooms[] = { 0.25, 0.5, 0.75, 1.0, 1.5, 2.0, 3.0, 5.0 }; + + + /// Get the visible area of the scrolled window +-static void getVisibleAreaTwips(GdkRectangle* pArea) ++static void getVisibleAreaTwips(GtkWidget* pDocView, GdkRectangle* pArea) + { + #if GTK_CHECK_VERSION(2,14,0) // we need gtk_adjustment_get_page_size() + GtkAdjustment* pHAdjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(pScrolledWindow)); +@@ -79,6 +96,9 @@ static void getVisibleAreaTwips(GdkRectangle* pArea) + + static void changeZoom( GtkWidget* pButton, gpointer /* pItem */ ) + { ++ TiledWindow& rWindow = lcl_getTiledWindow(pButton); ++ GtkWidget* pDocView = rWindow.m_pDocView; ++ + const char *sName = gtk_tool_button_get_icon_name( GTK_TOOL_BUTTON(pButton) ); + + float fZoom = 0; +@@ -125,9 +145,11 @@ static void changeZoom( GtkWidget* pButton, gpointer /* pItem */ ) + } + + /// User clicked on the button -> inform LOKDocView. +-static void toggleEditing(GtkWidget* /*pButton*/, gpointer /*pItem*/) ++static void toggleEditing(GtkWidget* pButton, gpointer /*pItem*/) + { +- LOKDocView* pLOKDocView = LOK_DOC_VIEW(pDocView); ++ TiledWindow& rWindow = lcl_getTiledWindow(pButton); ++ ++ LOKDocView* pLOKDocView = LOK_DOC_VIEW(rWindow.m_pDocView); + bool bActive = gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(pEnableEditing)); + if (bool(lok_doc_view_get_edit(pLOKDocView)) != bActive) + lok_doc_view_set_edit(pLOKDocView, bActive); +@@ -148,9 +170,10 @@ static void toggleFindbar(GtkWidget* /*pButton*/, gpointer /*pItem*/) + } + + /// Calls lok::Document::createView(). +-static void createView(GtkWidget* /*pButton*/, gpointer /*pItem*/) ++static void createView(GtkWidget* pButton, gpointer /*pItem*/) + { +- LOKDocView* pLOKDocView = LOK_DOC_VIEW(pDocView); ++ TiledWindow& rWindow = lcl_getTiledWindow(pButton); ++ LOKDocView* pLOKDocView = LOK_DOC_VIEW(rWindow.m_pDocView); + LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(pLOKDocView); + pDocument->pClass->createView(pDocument); + } +@@ -185,14 +208,15 @@ static void clipboardSetHtml(GtkClipboard* pClipboard, const char* pSelection) + } + + /// Handler for the copy button: write clipboard. +-static void doCopy(GtkWidget* /*pButton*/, gpointer /*pItem*/) ++static void doCopy(GtkWidget* pButton, gpointer /*pItem*/) + { +- LOKDocView* pLOKDocView = LOK_DOC_VIEW(pDocView); ++ TiledWindow& rWindow = lcl_getTiledWindow(pButton); ++ LOKDocView* pLOKDocView = LOK_DOC_VIEW(rWindow.m_pDocView); + LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(pLOKDocView); + char* pUsedFormat = 0; + char* pSelection = pDocument->pClass->getTextSelection(pDocument, "text/html", &pUsedFormat); + +- GtkClipboard* pClipboard = gtk_clipboard_get_for_display(gtk_widget_get_display(pDocView), GDK_SELECTION_CLIPBOARD); ++ GtkClipboard* pClipboard = gtk_clipboard_get_for_display(gtk_widget_get_display(rWindow.m_pDocView), GDK_SELECTION_CLIPBOARD); + std::string aUsedFormat(pUsedFormat); + if (aUsedFormat == "text/plain;charset=utf-8") + gtk_clipboard_set_text(pClipboard, pSelection, -1); +@@ -204,7 +228,7 @@ static void doCopy(GtkWidget* /*pButton*/, gpointer /*pItem*/) + + + /// Searches for the next or previous text of pFindbarEntry. +-static void doSearch(bool bBackwards) ++static void doSearch(GtkWidget* pButton, bool bBackwards) + { + GtkEntry* pEntry = GTK_ENTRY(pFindbarEntry); + const char* pText = gtk_entry_get_text(pEntry); +@@ -214,9 +238,10 @@ static void doSearch(bool bBackwards) + aTree.put(boost::property_tree::ptree::path_type("SearchItem.Backward/type", '/'), "boolean"); + aTree.put(boost::property_tree::ptree::path_type("SearchItem.Backward/value", '/'), bBackwards); + +- LOKDocView* pLOKDocView = LOK_DOC_VIEW(pDocView); ++ TiledWindow& rWindow = lcl_getTiledWindow(pButton); ++ LOKDocView* pLOKDocView = LOK_DOC_VIEW(rWindow.m_pDocView); + GdkRectangle aArea; +- getVisibleAreaTwips(&aArea); ++ getVisibleAreaTwips(rWindow.m_pDocView, &aArea); + aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchStartPointX/type", '/'), "long"); + aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchStartPointX/value", '/'), aArea.x); + aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchStartPointY/type", '/'), "long"); +@@ -229,19 +254,19 @@ static void doSearch(bool bBackwards) + } + + /// Click handler for the search next button. +-static void signalSearchNext(GtkWidget* /*pButton*/, gpointer /*pItem*/) ++static void signalSearchNext(GtkWidget* pButton, gpointer /*pItem*/) + { +- doSearch(/*bBackwards=*/false); ++ doSearch(pButton, /*bBackwards=*/false); + } + + /// Click handler for the search previous button. +-static void signalSearchPrev(GtkWidget* /*pButton*/, gpointer /*pItem*/) ++static void signalSearchPrev(GtkWidget* pButton, gpointer /*pItem*/) + { +- doSearch(/*bBackwards=*/true); ++ doSearch(pButton, /*bBackwards=*/true); + } + + /// Handles the key-press-event of the search entry widget. +-static gboolean signalFindbar(GtkWidget* /*pWidget*/, GdkEventKey* pEvent, gpointer /*pData*/) ++static gboolean signalFindbar(GtkWidget* pWidget, GdkEventKey* pEvent, gpointer /*pData*/) + { + gtk_label_set_text(GTK_LABEL(pFindbarLabel), ""); + switch(pEvent->keyval) +@@ -249,7 +274,7 @@ static gboolean signalFindbar(GtkWidget* /*pWidget*/, GdkEventKey* pEvent, gpoin + case GDK_KEY_Return: + { + // Search forward. +- doSearch(/*bBackwards=*/false); ++ doSearch(pWidget, /*bBackwards=*/false); + return TRUE; + } + case GDK_KEY_Escape: +@@ -330,7 +355,7 @@ static void signalHyperlink(LOKDocView* /*pLOKDocView*/, char* pPayload, gpointe + } + + /// Cursor position changed +-static void cursorChanged(LOKDocView* /*pDocView*/, gint nX, gint nY, ++static void cursorChanged(LOKDocView* pDocView, gint nX, gint nY, + gint /*nWidth*/, gint /*nHeight*/, gpointer /*pData*/) + { + GtkAdjustment* vadj = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(pScrolledWindow)); +@@ -339,7 +364,7 @@ static void cursorChanged(LOKDocView* /*pDocView*/, gint nX, gint nY, + gdouble upper; + gint x = -1, y = -1; + +- getVisibleAreaTwips(&visArea); ++ getVisibleAreaTwips(GTK_WIDGET(pDocView), &visArea); + + // check vertically + if (nY < visArea.y) +@@ -381,7 +406,8 @@ static void toggleToolItem(GtkWidget* pWidget, gpointer /*pData*/) + { + if (g_bToolItemBroadcast) + { +- LOKDocView* pLOKDocView = LOK_DOC_VIEW(pDocView); ++ TiledWindow& rWindow = lcl_getTiledWindow(pWidget); ++ LOKDocView* pLOKDocView = LOK_DOC_VIEW(rWindow.m_pDocView); + GtkToolItem* pItem = GTK_TOOL_ITEM(pWidget); + const std::string& rString = g_aToolItemCommandNames[pItem]; + g_info("toggleToolItem: lok_doc_view_post_command('%s')", rString.c_str()); +@@ -389,13 +415,13 @@ static void toggleToolItem(GtkWidget* pWidget, gpointer /*pData*/) + } + } + +-static void populatePartSelector() ++static void populatePartSelector(LOKDocView* pLOKDocView) + { + gtk_list_store_clear( GTK_LIST_STORE( + gtk_combo_box_get_model( + GTK_COMBO_BOX(pPartSelector) )) ); + +- if ( !pDocView ) ++ if (!pLOKDocView) + { + return; + } +@@ -403,35 +429,35 @@ static void populatePartSelector() + const int nMaxLength = 50; + char sText[nMaxLength]; + +- int nParts = lok_doc_view_get_parts( LOK_DOC_VIEW(pDocView) ); ++ int nParts = lok_doc_view_get_parts(pLOKDocView); + for ( int i = 0; i < nParts; i++ ) + { +- char* pName = lok_doc_view_get_part_name( LOK_DOC_VIEW(pDocView), i ); ++ char* pName = lok_doc_view_get_part_name(pLOKDocView, i); + assert( pName ); + snprintf( sText, nMaxLength, "%i (%s)", i+1, pName ); + free( pName ); + + gtk_combo_box_text_append_text( pPartSelector, sText ); + } +- gtk_combo_box_set_active( GTK_COMBO_BOX(pPartSelector), +- lok_doc_view_get_part( LOK_DOC_VIEW(pDocView) ) ); ++ gtk_combo_box_set_active(GTK_COMBO_BOX(pPartSelector), lok_doc_view_get_part(pLOKDocView)); + } + +-static void signalSize(LOKDocView* /*pLOKDocView*/, gpointer /*pData*/) ++static void signalSize(LOKDocView* pLOKDocView, gpointer /*pData*/) + { + g_bPartSelectorBroadcast = false; +- populatePartSelector(); ++ populatePartSelector(pLOKDocView); + g_bPartSelectorBroadcast = true; + } + + static void changePart( GtkWidget* pSelector, gpointer /* pItem */ ) + { + int nPart = gtk_combo_box_get_active( GTK_COMBO_BOX(pSelector) ); ++ TiledWindow& rWindow = lcl_getTiledWindow(pSelector); + +- if (g_bPartSelectorBroadcast && pDocView) ++ if (g_bPartSelectorBroadcast && rWindow.m_pDocView) + { +- lok_doc_view_set_part( LOK_DOC_VIEW(pDocView), nPart ); +- lok_doc_view_reset_view( LOK_DOC_VIEW(pDocView) ); ++ lok_doc_view_set_part( LOK_DOC_VIEW(rWindow.m_pDocView), nPart ); ++ lok_doc_view_reset_view( LOK_DOC_VIEW(rWindow.m_pDocView) ); + } + } + +@@ -453,32 +479,33 @@ static void changePartMode( GtkWidget* pSelector, gpointer /* pItem */ ) + // I.e. the ordering above should match the enum member ordering. + LibreOfficeKitPartMode ePartMode = + LibreOfficeKitPartMode( gtk_combo_box_get_active( GTK_COMBO_BOX(pSelector) ) ); ++ TiledWindow& rWindow = lcl_getTiledWindow(pSelector); + +- if ( pDocView ) ++ if ( rWindow.m_pDocView ) + { +- lok_doc_view_set_partmode( LOK_DOC_VIEW(pDocView), ePartMode ); ++ lok_doc_view_set_partmode( LOK_DOC_VIEW(rWindow.m_pDocView), ePartMode ); + } + } + + static void openDocumentCallback (GObject* source_object, GAsyncResult* res, gpointer /*userdata*/) + { +- LOKDocView* pDocView1 = LOK_DOC_VIEW (source_object); ++ LOKDocView* pDocView = LOK_DOC_VIEW (source_object); + GError* error = NULL; + GList *focusChain = NULL; + +- if (!lok_doc_view_open_document_finish(pDocView1, res, &error)) ++ if (!lok_doc_view_open_document_finish(pDocView, res, &error)) + { + g_warning ("Error occurred while opening the document : %s", error->message); + g_error_free (error); + } + +- populatePartSelector(); ++ populatePartSelector(pDocView); + populatePartModeSelector( GTK_COMBO_BOX_TEXT(pPartModeComboBox) ); + // Connect these signals after populating the selectors, to avoid re-rendering on setting the default part/partmode. + g_signal_connect(G_OBJECT(pPartModeComboBox), "changed", G_CALLBACK(changePartMode), 0); + g_signal_connect(G_OBJECT(pPartSelector), "changed", G_CALLBACK(changePart), 0); + +- focusChain = g_list_append( focusChain, pDocView1 ); ++ focusChain = g_list_append( focusChain, pDocView ); + gtk_container_set_focus_chain ( GTK_CONTAINER (pVBox), focusChain ); + + gtk_widget_hide (pStatusBar); +@@ -639,7 +666,7 @@ int main( int argc, char* argv[] ) + gtk_box_pack_end(GTK_BOX(pVBox), pFindbar, FALSE, FALSE, 0); + + // Docview +- pDocView = lok_doc_view_new (argv[1], NULL, NULL); ++ GtkWidget* pDocView = lok_doc_view_new (argv[1], NULL, NULL); + #if GLIB_CHECK_VERSION(2,40,0) + g_assert_nonnull(pDocView); + #endif +@@ -674,6 +701,10 @@ int main( int argc, char* argv[] ) + // Hide the findbar by default. + gtk_widget_hide(pFindbar); + ++ TiledWindow aWindow; ++ aWindow.m_pDocView = pDocView; ++ g_aWindows[pWindow] = aWindow; ++ + lok_doc_view_open_document( LOK_DOC_VIEW(pDocView), argv[2], NULL, openDocumentCallback, pDocView ); + + gtk_main(); +-- +2.12.0 + diff --git a/SOURCES/0127-gtktiledviewer-allow-multiple-status-bars.patch b/SOURCES/0127-gtktiledviewer-allow-multiple-status-bars.patch new file mode 100644 index 0000000..6d6ba0a --- /dev/null +++ b/SOURCES/0127-gtktiledviewer-allow-multiple-status-bars.patch @@ -0,0 +1,92 @@ +From dbf2d5061ddcf8528b1e6e9944ea159fe5ea6afd Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 15 Sep 2015 12:10:03 +0200 +Subject: [PATCH 127/398] gtktiledviewer: allow multiple status bars + +Change-Id: I84c4102937deee662814c41607ee8de380a067f2 +(cherry picked from commit 36fa8d443a9ad87ee7077be7263870fab9dd6261) +--- + libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 18 ++++++++++++------ + 1 file changed, 12 insertions(+), 6 deletions(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 096458a93dce..2559d124c72a 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -30,7 +30,6 @@ static int help() + return 1; + } + +-static GtkWidget* pStatusBar; + static GtkToolItem* pEnableEditing; + static GtkToolItem* pBold; + static GtkToolItem* pItalic; +@@ -49,13 +48,16 @@ static GtkWidget* pFindbar; + static GtkWidget* pFindbarEntry; + static GtkWidget* pFindbarLabel; + ++/// Represents all the state that is specific to one GtkWindow of this app. + class TiledWindow + { + public: + GtkWidget* m_pDocView; ++ GtkWidget* m_pStatusBar; + + TiledWindow() +- : m_pDocView(0) ++ : m_pDocView(0), ++ m_pStatusBar(0) + { + } + }; +@@ -461,8 +463,10 @@ static void changePart( GtkWidget* pSelector, gpointer /* pItem */ ) + } + } + +-static void removeChildrenFromStatusbar(GtkWidget* children, gpointer) ++static void removeChildrenFromStatusbar(GtkWidget* children, gpointer pData) + { ++ GtkWidget* pStatusBar = static_cast(pData); ++ + gtk_container_remove(GTK_CONTAINER(pStatusBar), children); + } + +@@ -490,6 +494,7 @@ static void changePartMode( GtkWidget* pSelector, gpointer /* pItem */ ) + static void openDocumentCallback (GObject* source_object, GAsyncResult* res, gpointer /*userdata*/) + { + LOKDocView* pDocView = LOK_DOC_VIEW (source_object); ++ TiledWindow& rWindow = lcl_getTiledWindow(GTK_WIDGET(pDocView)); + GError* error = NULL; + GList *focusChain = NULL; + +@@ -508,7 +513,7 @@ static void openDocumentCallback (GObject* source_object, GAsyncResult* res, gpo + focusChain = g_list_append( focusChain, pDocView ); + gtk_container_set_focus_chain ( GTK_CONTAINER (pVBox), focusChain ); + +- gtk_widget_hide (pStatusBar); ++ gtk_widget_hide(rWindow.m_pStatusBar); + } + + int main( int argc, char* argv[] ) +@@ -691,8 +696,8 @@ int main( int argc, char* argv[] ) + GtkWidget* pProgressBar = gtk_progress_bar_new (); + g_signal_connect(pDocView, "load-changed", G_CALLBACK(loadChanged), pProgressBar); + +- pStatusBar = gtk_statusbar_new (); +- gtk_container_forall(GTK_CONTAINER(pStatusBar), removeChildrenFromStatusbar, NULL); ++ GtkWidget* pStatusBar = gtk_statusbar_new (); ++ gtk_container_forall(GTK_CONTAINER(pStatusBar), removeChildrenFromStatusbar, pStatusBar); + gtk_container_add (GTK_CONTAINER(pVBox), pStatusBar); + gtk_container_add (GTK_CONTAINER(pStatusBar), pProgressBar); + gtk_widget_set_hexpand(pProgressBar, true); +@@ -703,6 +708,7 @@ int main( int argc, char* argv[] ) + + TiledWindow aWindow; + aWindow.m_pDocView = pDocView; ++ aWindow.m_pStatusBar = pStatusBar; + g_aWindows[pWindow] = aWindow; + + lok_doc_view_open_document( LOK_DOC_VIEW(pDocView), argv[2], NULL, openDocumentCallback, pDocView ); +-- +2.12.0 + diff --git a/SOURCES/0128-gtktiledviwer-allow-GtkToolItems-in-multiple-windows.patch b/SOURCES/0128-gtktiledviwer-allow-GtkToolItems-in-multiple-windows.patch new file mode 100644 index 0000000..114c33d --- /dev/null +++ b/SOURCES/0128-gtktiledviwer-allow-GtkToolItems-in-multiple-windows.patch @@ -0,0 +1,181 @@ +From cc49e8fbf166ddea4944d1a5330f9d8442bee2e1 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 15 Sep 2015 12:21:10 +0200 +Subject: [PATCH 128/398] gtktiledviwer: allow GtkToolItems in multiple windows + +Change-Id: I6c19a9bdd34163d12047929170e5cfa7bb9a5820 +(cherry picked from commit 91d67ec9a5cc2064b90a888ed962d215bee5dc2d) +--- + .../qa/gtktiledviewer/gtktiledviewer.cxx | 88 ++++++++++++---------- + 1 file changed, 48 insertions(+), 40 deletions(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 2559d124c72a..09f16da396af 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -30,11 +30,6 @@ static int help() + return 1; + } + +-static GtkToolItem* pEnableEditing; +-static GtkToolItem* pBold; +-static GtkToolItem* pItalic; +-static GtkToolItem* pUnderline; +-static GtkToolItem* pStrikethrough; + static GtkWidget* pScrolledWindow; + static std::map g_aToolItemCommandNames; + static std::map g_aCommandNameToolItems; +@@ -54,10 +49,20 @@ class TiledWindow + public: + GtkWidget* m_pDocView; + GtkWidget* m_pStatusBar; ++ GtkToolItem* m_pEnableEditing; ++ GtkToolItem* m_pBold; ++ GtkToolItem* m_pItalic; ++ GtkToolItem* m_pUnderline; ++ GtkToolItem* m_pStrikethrough; + + TiledWindow() + : m_pDocView(0), +- m_pStatusBar(0) ++ m_pStatusBar(0), ++ m_pEnableEditing(0), ++ m_pBold(0), ++ m_pItalic(0), ++ m_pUnderline(0), ++ m_pStrikethrough(0) + { + } + }; +@@ -152,7 +157,7 @@ static void toggleEditing(GtkWidget* pButton, gpointer /*pItem*/) + TiledWindow& rWindow = lcl_getTiledWindow(pButton); + + LOKDocView* pLOKDocView = LOK_DOC_VIEW(rWindow.m_pDocView); +- bool bActive = gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(pEnableEditing)); ++ bool bActive = gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(rWindow.m_pEnableEditing)); + if (bool(lok_doc_view_get_edit(pLOKDocView)) != bActive) + lok_doc_view_set_edit(pLOKDocView, bActive); + } +@@ -292,10 +297,12 @@ static gboolean signalFindbar(GtkWidget* pWidget, GdkEventKey* pEvent, gpointer + /// LOKDocView changed edit state -> inform the tool button. + static void signalEdit(LOKDocView* pLOKDocView, gboolean bWasEdit, gpointer /*pData*/) + { ++ TiledWindow& rWindow = lcl_getTiledWindow(GTK_WIDGET(pLOKDocView)); ++ + gboolean bEdit = lok_doc_view_get_edit(pLOKDocView); + g_info("signalEdit: %d -> %d", bWasEdit, lok_doc_view_get_edit(pLOKDocView)); +- if (gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(pEnableEditing)) != bEdit) +- gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(pEnableEditing), bEdit); ++ if (gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(rWindow.m_pEnableEditing)) != bEdit) ++ gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(rWindow.m_pEnableEditing), bEdit); + } + + /// LOKDocView changed command state -> inform the tool button. +@@ -531,6 +538,7 @@ int main( int argc, char* argv[] ) + gtk_init( &argc, &argv ); + + GtkWidget *pWindow = gtk_window_new( GTK_WINDOW_TOPLEVEL ); ++ TiledWindow aWindow; + 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_main_quit), NULL ); +@@ -588,7 +596,8 @@ int main( int argc, char* argv[] ) + g_signal_connect(G_OBJECT(pCopyButton), "clicked", G_CALLBACK(doCopy), NULL); + gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), gtk_separator_tool_item_new(), -1); + +- pEnableEditing = gtk_toggle_tool_button_new(); ++ GtkToolItem* pEnableEditing = gtk_toggle_tool_button_new(); ++ aWindow.m_pEnableEditing = pEnableEditing; + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pEnableEditing), "insert-text-symbolic"); + gtk_tool_item_set_tooltip_text(pEnableEditing, "Edit"); + gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pEnableEditing, -1); +@@ -608,33 +617,33 @@ int main( int argc, char* argv[] ) + + gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), gtk_separator_tool_item_new(), -1); + +- pBold = gtk_toggle_tool_button_new(); +- gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pBold), "format-text-bold-symbolic"); +- gtk_tool_item_set_tooltip_text(pBold, "Bold"); +- gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pBold, -1); +- g_signal_connect(G_OBJECT(pBold), "toggled", G_CALLBACK(toggleToolItem), NULL); +- lcl_registerToolItem(pBold, ".uno:Bold"); +- +- pItalic = gtk_toggle_tool_button_new(); +- gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pItalic), "format-text-italic-symbolic"); +- gtk_tool_item_set_tooltip_text(pItalic, "Italic"); +- gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pItalic, -1); +- g_signal_connect(G_OBJECT(pItalic), "toggled", G_CALLBACK(toggleToolItem), NULL); +- lcl_registerToolItem(pItalic, ".uno:Italic"); +- +- pUnderline = gtk_toggle_tool_button_new(); +- gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pUnderline), "format-text-underline-symbolic"); +- gtk_tool_item_set_tooltip_text(pUnderline, "Underline"); +- gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pUnderline, -1); +- g_signal_connect(G_OBJECT(pUnderline), "toggled", G_CALLBACK(toggleToolItem), NULL); +- lcl_registerToolItem(pUnderline, ".uno:Underline"); +- +- pStrikethrough = gtk_toggle_tool_button_new (); +- gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pStrikethrough), "format-text-strikethrough-symbolic"); +- gtk_tool_item_set_tooltip_text(pStrikethrough, "Strikethrough"); +- gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pStrikethrough, -1); +- g_signal_connect(G_OBJECT(pStrikethrough), "toggled", G_CALLBACK(toggleToolItem), NULL); +- lcl_registerToolItem(pStrikethrough, ".uno:Strikeout"); ++ aWindow.m_pBold = gtk_toggle_tool_button_new(); ++ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (aWindow.m_pBold), "format-text-bold-symbolic"); ++ gtk_tool_item_set_tooltip_text(aWindow.m_pBold, "Bold"); ++ gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), aWindow.m_pBold, -1); ++ g_signal_connect(G_OBJECT(aWindow.m_pBold), "toggled", G_CALLBACK(toggleToolItem), NULL); ++ lcl_registerToolItem(aWindow.m_pBold, ".uno:Bold"); ++ ++ aWindow.m_pItalic = gtk_toggle_tool_button_new(); ++ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (aWindow.m_pItalic), "format-text-italic-symbolic"); ++ gtk_tool_item_set_tooltip_text(aWindow.m_pItalic, "Italic"); ++ gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), aWindow.m_pItalic, -1); ++ g_signal_connect(G_OBJECT(aWindow.m_pItalic), "toggled", G_CALLBACK(toggleToolItem), NULL); ++ lcl_registerToolItem(aWindow.m_pItalic, ".uno:Italic"); ++ ++ aWindow.m_pUnderline = gtk_toggle_tool_button_new(); ++ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (aWindow.m_pUnderline), "format-text-underline-symbolic"); ++ gtk_tool_item_set_tooltip_text(aWindow.m_pUnderline, "Underline"); ++ gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), aWindow.m_pUnderline, -1); ++ g_signal_connect(G_OBJECT(aWindow.m_pUnderline), "toggled", G_CALLBACK(toggleToolItem), NULL); ++ lcl_registerToolItem(aWindow.m_pUnderline, ".uno:Underline"); ++ ++ aWindow.m_pStrikethrough = gtk_toggle_tool_button_new (); ++ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(aWindow.m_pStrikethrough), "format-text-strikethrough-symbolic"); ++ gtk_tool_item_set_tooltip_text(aWindow.m_pStrikethrough, "Strikethrough"); ++ gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), aWindow.m_pStrikethrough, -1); ++ g_signal_connect(G_OBJECT(aWindow.m_pStrikethrough), "toggled", G_CALLBACK(toggleToolItem), NULL); ++ lcl_registerToolItem(aWindow.m_pStrikethrough, ".uno:Strikeout"); + + gtk_box_pack_start( GTK_BOX(pVBox), pToolbar, FALSE, FALSE, 0 ); // Adds to top. + +@@ -672,6 +681,7 @@ int main( int argc, char* argv[] ) + + // Docview + GtkWidget* pDocView = lok_doc_view_new (argv[1], NULL, NULL); ++ aWindow.m_pDocView = pDocView; + #if GLIB_CHECK_VERSION(2,40,0) + g_assert_nonnull(pDocView); + #endif +@@ -697,6 +707,7 @@ int main( int argc, char* argv[] ) + g_signal_connect(pDocView, "load-changed", G_CALLBACK(loadChanged), pProgressBar); + + GtkWidget* pStatusBar = gtk_statusbar_new (); ++ aWindow.m_pStatusBar = pStatusBar; + gtk_container_forall(GTK_CONTAINER(pStatusBar), removeChildrenFromStatusbar, pStatusBar); + gtk_container_add (GTK_CONTAINER(pVBox), pStatusBar); + gtk_container_add (GTK_CONTAINER(pStatusBar), pProgressBar); +@@ -706,9 +717,6 @@ int main( int argc, char* argv[] ) + // Hide the findbar by default. + gtk_widget_hide(pFindbar); + +- TiledWindow aWindow; +- aWindow.m_pDocView = pDocView; +- aWindow.m_pStatusBar = pStatusBar; + g_aWindows[pWindow] = aWindow; + + lok_doc_view_open_document( LOK_DOC_VIEW(pDocView), argv[2], NULL, openDocumentCallback, pDocView ); +-- +2.12.0 + diff --git a/SOURCES/0129-gtktiledviwer-tool-item-registration-is-per-window.patch b/SOURCES/0129-gtktiledviwer-tool-item-registration-is-per-window.patch new file mode 100644 index 0000000..b9aa574 --- /dev/null +++ b/SOURCES/0129-gtktiledviwer-tool-item-registration-is-per-window.patch @@ -0,0 +1,198 @@ +From 44a5de2fbdee39d81bb0fdbd74ba6179b40d77d9 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 15 Sep 2015 12:36:49 +0200 +Subject: [PATCH 129/398] gtktiledviwer: tool item registration is per-window + +Change-Id: I11a6cda7b9b8949c48c201c4bd467b49f2f43ca5 +(cherry picked from commit bec8a1b74f91ffc579567f44a65b903bc854ec4f) +--- + .../qa/gtktiledviewer/gtktiledviewer.cxx | 71 +++++++++++++--------- + 1 file changed, 41 insertions(+), 30 deletions(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 09f16da396af..ef3aee008cae 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -30,10 +30,6 @@ static int help() + return 1; + } + +-static GtkWidget* pScrolledWindow; +-static std::map g_aToolItemCommandNames; +-static std::map g_aCommandNameToolItems; +-static bool g_bToolItemBroadcast = true; + static GtkWidget* pVBox; + static GtkComboBoxText* pPartSelector; + static GtkWidget* pPartModeComboBox; +@@ -54,6 +50,10 @@ public: + GtkToolItem* m_pItalic; + GtkToolItem* m_pUnderline; + GtkToolItem* m_pStrikethrough; ++ GtkWidget* m_pScrolledWindow; ++ std::map m_aToolItemCommandNames; ++ std::map m_aCommandNameToolItems; ++ bool m_bToolItemBroadcast; + + TiledWindow() + : m_pDocView(0), +@@ -62,7 +62,9 @@ public: + m_pBold(0), + m_pItalic(0), + m_pUnderline(0), +- m_pStrikethrough(0) ++ m_pStrikethrough(0), ++ m_pScrolledWindow(0), ++ m_bToolItemBroadcast(true) + { + } + }; +@@ -71,13 +73,15 @@ static std::map g_aWindows; + + static TiledWindow& lcl_getTiledWindow(GtkWidget* pWidget) + { +- return g_aWindows[gtk_widget_get_toplevel(pWidget)]; ++ GtkWidget* pToplevel = gtk_widget_get_toplevel(pWidget); ++ assert(g_aWindows.find(pToplevel) != g_aWindows.end()); ++ return g_aWindows[pToplevel]; + } + +-static void lcl_registerToolItem(GtkToolItem* pItem, const std::string& rName) ++static void lcl_registerToolItem(TiledWindow& rWindow, GtkToolItem* pItem, const std::string& rName) + { +- g_aToolItemCommandNames[pItem] = rName; +- g_aCommandNameToolItems[rName] = pItem; ++ rWindow.m_aToolItemCommandNames[pItem] = rName; ++ rWindow.m_aCommandNameToolItems[rName] = pItem; + } + + const float fZooms[] = { 0.25, 0.5, 0.75, 1.0, 1.5, 2.0, 3.0, 5.0 }; +@@ -87,8 +91,10 @@ const float fZooms[] = { 0.25, 0.5, 0.75, 1.0, 1.5, 2.0, 3.0, 5.0 }; + static void getVisibleAreaTwips(GtkWidget* pDocView, GdkRectangle* pArea) + { + #if GTK_CHECK_VERSION(2,14,0) // we need gtk_adjustment_get_page_size() +- GtkAdjustment* pHAdjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(pScrolledWindow)); +- GtkAdjustment* pVAdjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(pScrolledWindow)); ++ TiledWindow& rWindow = lcl_getTiledWindow(pDocView); ++ ++ GtkAdjustment* pHAdjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(rWindow.m_pScrolledWindow)); ++ GtkAdjustment* pVAdjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(rWindow.m_pScrolledWindow)); + + pArea->x = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView), + gtk_adjustment_get_value(pHAdjustment)); +@@ -306,8 +312,10 @@ static void signalEdit(LOKDocView* pLOKDocView, gboolean bWasEdit, gpointer /*pD + } + + /// LOKDocView changed command state -> inform the tool button. +-static void signalCommand(LOKDocView* /*pLOKDocView*/, char* pPayload, gpointer /*pData*/) ++static void signalCommand(LOKDocView* pLOKDocView, char* pPayload, gpointer /*pData*/) + { ++ TiledWindow& rWindow = lcl_getTiledWindow(GTK_WIDGET(pLOKDocView)); ++ + std::string aPayload(pPayload); + size_t nPosition = aPayload.find("="); + if (nPosition != std::string::npos) +@@ -316,16 +324,16 @@ static void signalCommand(LOKDocView* /*pLOKDocView*/, char* pPayload, gpointer + std::string aValue = aPayload.substr(nPosition + 1); + g_info("signalCommand: '%s' is '%s'", aKey.c_str(), aValue.c_str()); + +- if (g_aCommandNameToolItems.find(aKey) != g_aCommandNameToolItems.end()) ++ if (rWindow.m_aCommandNameToolItems.find(aKey) != rWindow.m_aCommandNameToolItems.end()) + { +- GtkToolItem* pItem = g_aCommandNameToolItems[aKey]; ++ GtkToolItem* pItem = rWindow.m_aCommandNameToolItems[aKey]; + gboolean bEdit = aValue == "true"; + if (gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(pItem)) != bEdit) + { + // Avoid invoking lok_doc_view_post_command(). +- g_bToolItemBroadcast = false; ++ rWindow.m_bToolItemBroadcast = false; + gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(pItem), bEdit); +- g_bToolItemBroadcast = true; ++ rWindow.m_bToolItemBroadcast = true; + } + } + } +@@ -367,8 +375,10 @@ static void signalHyperlink(LOKDocView* /*pLOKDocView*/, char* pPayload, gpointe + static void cursorChanged(LOKDocView* pDocView, gint nX, gint nY, + gint /*nWidth*/, gint /*nHeight*/, gpointer /*pData*/) + { +- GtkAdjustment* vadj = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(pScrolledWindow)); +- GtkAdjustment* hadj = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(pScrolledWindow)); ++ TiledWindow& rWindow = lcl_getTiledWindow(GTK_WIDGET(pDocView)); ++ ++ GtkAdjustment* vadj = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(rWindow.m_pScrolledWindow)); ++ GtkAdjustment* hadj = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(rWindow.m_pScrolledWindow)); + GdkRectangle visArea; + gdouble upper; + gint x = -1, y = -1; +@@ -413,12 +423,13 @@ static void cursorChanged(LOKDocView* pDocView, gint nX, gint nY, + + static void toggleToolItem(GtkWidget* pWidget, gpointer /*pData*/) + { +- if (g_bToolItemBroadcast) ++ TiledWindow& rWindow = lcl_getTiledWindow(pWidget); ++ ++ if (rWindow.m_bToolItemBroadcast) + { +- TiledWindow& rWindow = lcl_getTiledWindow(pWidget); + LOKDocView* pLOKDocView = LOK_DOC_VIEW(rWindow.m_pDocView); + GtkToolItem* pItem = GTK_TOOL_ITEM(pWidget); +- const std::string& rString = g_aToolItemCommandNames[pItem]; ++ const std::string& rString = rWindow.m_aToolItemCommandNames[pItem]; + g_info("toggleToolItem: lok_doc_view_post_command('%s')", rString.c_str()); + lok_doc_view_post_command(pLOKDocView, rString.c_str(), 0); + } +@@ -622,28 +633,28 @@ int main( int argc, char* argv[] ) + gtk_tool_item_set_tooltip_text(aWindow.m_pBold, "Bold"); + gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), aWindow.m_pBold, -1); + g_signal_connect(G_OBJECT(aWindow.m_pBold), "toggled", G_CALLBACK(toggleToolItem), NULL); +- lcl_registerToolItem(aWindow.m_pBold, ".uno:Bold"); ++ lcl_registerToolItem(aWindow, aWindow.m_pBold, ".uno:Bold"); + + aWindow.m_pItalic = gtk_toggle_tool_button_new(); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (aWindow.m_pItalic), "format-text-italic-symbolic"); + gtk_tool_item_set_tooltip_text(aWindow.m_pItalic, "Italic"); + gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), aWindow.m_pItalic, -1); + g_signal_connect(G_OBJECT(aWindow.m_pItalic), "toggled", G_CALLBACK(toggleToolItem), NULL); +- lcl_registerToolItem(aWindow.m_pItalic, ".uno:Italic"); ++ lcl_registerToolItem(aWindow, aWindow.m_pItalic, ".uno:Italic"); + + aWindow.m_pUnderline = gtk_toggle_tool_button_new(); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (aWindow.m_pUnderline), "format-text-underline-symbolic"); + gtk_tool_item_set_tooltip_text(aWindow.m_pUnderline, "Underline"); + gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), aWindow.m_pUnderline, -1); + g_signal_connect(G_OBJECT(aWindow.m_pUnderline), "toggled", G_CALLBACK(toggleToolItem), NULL); +- lcl_registerToolItem(aWindow.m_pUnderline, ".uno:Underline"); ++ lcl_registerToolItem(aWindow, aWindow.m_pUnderline, ".uno:Underline"); + + aWindow.m_pStrikethrough = gtk_toggle_tool_button_new (); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(aWindow.m_pStrikethrough), "format-text-strikethrough-symbolic"); + gtk_tool_item_set_tooltip_text(aWindow.m_pStrikethrough, "Strikethrough"); + gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), aWindow.m_pStrikethrough, -1); + g_signal_connect(G_OBJECT(aWindow.m_pStrikethrough), "toggled", G_CALLBACK(toggleToolItem), NULL); +- lcl_registerToolItem(aWindow.m_pStrikethrough, ".uno:Strikeout"); ++ lcl_registerToolItem(aWindow, aWindow.m_pStrikethrough, ".uno:Strikeout"); + + gtk_box_pack_start( GTK_BOX(pVBox), pToolbar, FALSE, FALSE, 0 ); // Adds to top. + +@@ -696,12 +707,12 @@ int main( int argc, char* argv[] ) + + + // Scrolled window for DocView +- pScrolledWindow = gtk_scrolled_window_new(0, 0); +- gtk_widget_set_hexpand (pScrolledWindow, TRUE); +- gtk_widget_set_vexpand (pScrolledWindow, TRUE); +- gtk_container_add(GTK_CONTAINER(pVBox), pScrolledWindow); ++ aWindow.m_pScrolledWindow = gtk_scrolled_window_new(0, 0); ++ gtk_widget_set_hexpand (aWindow.m_pScrolledWindow, TRUE); ++ gtk_widget_set_vexpand (aWindow.m_pScrolledWindow, TRUE); ++ gtk_container_add(GTK_CONTAINER(pVBox), aWindow.m_pScrolledWindow); + +- gtk_container_add(GTK_CONTAINER(pScrolledWindow), pDocView); ++ gtk_container_add(GTK_CONTAINER(aWindow.m_pScrolledWindow), pDocView); + + GtkWidget* pProgressBar = gtk_progress_bar_new (); + g_signal_connect(pDocView, "load-changed", G_CALLBACK(loadChanged), pProgressBar); +-- +2.12.0 + diff --git a/SOURCES/0130-gtktiledviewer-allow-part-selector-in-multiple-windo.patch b/SOURCES/0130-gtktiledviewer-allow-part-selector-in-multiple-windo.patch new file mode 100644 index 0000000..96025d6 --- /dev/null +++ b/SOURCES/0130-gtktiledviewer-allow-part-selector-in-multiple-windo.patch @@ -0,0 +1,199 @@ +From 81d430bc619caa24366cc35de67d34c5017acfcb Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 15 Sep 2015 12:45:58 +0200 +Subject: [PATCH 130/398] gtktiledviewer: allow part selector in multiple + windows + +Change-Id: Ib31fca3d8b4119704fb1a5c3cee885e7c239c247 +(cherry picked from commit d8bf31e129c4e791bfb02c8d0ccbaedb53d9b300) +--- + .../qa/gtktiledviewer/gtktiledviewer.cxx | 65 ++++++++++++---------- + 1 file changed, 36 insertions(+), 29 deletions(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index ef3aee008cae..3e72c13470a8 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -30,11 +30,6 @@ static int help() + return 1; + } + +-static GtkWidget* pVBox; +-static GtkComboBoxText* pPartSelector; +-static GtkWidget* pPartModeComboBox; +-/// Should the part selector avoid calling lok::Document::setPart()? +-static bool g_bPartSelectorBroadcast = true; + static GtkWidget* pFindbar; + static GtkWidget* pFindbarEntry; + static GtkWidget* pFindbarLabel; +@@ -54,6 +49,11 @@ public: + std::map m_aToolItemCommandNames; + std::map m_aCommandNameToolItems; + bool m_bToolItemBroadcast; ++ GtkWidget* m_pVBox; ++ GtkComboBoxText* m_pPartSelector; ++ GtkWidget* m_pPartModeComboBox; ++ /// Should the part selector avoid calling lok::Document::setPart()? ++ bool m_bPartSelectorBroadcast; + + TiledWindow() + : m_pDocView(0), +@@ -64,7 +64,11 @@ public: + m_pUnderline(0), + m_pStrikethrough(0), + m_pScrolledWindow(0), +- m_bToolItemBroadcast(true) ++ m_bToolItemBroadcast(true), ++ m_pVBox(0), ++ m_pPartSelector(0), ++ m_pPartModeComboBox(0), ++ m_bPartSelectorBroadcast(true) + { + } + }; +@@ -352,11 +356,12 @@ static void signalSearch(LOKDocView* /*pLOKDocView*/, char* /*pPayload*/, gpoint + } + + +-static void signalPart(LOKDocView* /*pLOKDocView*/, int nPart, gpointer /*pData*/) ++static void signalPart(LOKDocView* pLOKDocView, int nPart, gpointer /*pData*/) + { +- g_bPartSelectorBroadcast = false; +- gtk_combo_box_set_active(GTK_COMBO_BOX(pPartSelector), nPart); +- g_bPartSelectorBroadcast = true; ++ TiledWindow& rWindow = lcl_getTiledWindow(GTK_WIDGET(pLOKDocView)); ++ rWindow.m_bPartSelectorBroadcast = false; ++ gtk_combo_box_set_active(GTK_COMBO_BOX(rWindow.m_pPartSelector), nPart); ++ rWindow.m_bPartSelectorBroadcast = true; + } + + /// User clicked on a command button -> inform LOKDocView. +@@ -437,9 +442,10 @@ static void toggleToolItem(GtkWidget* pWidget, gpointer /*pData*/) + + static void populatePartSelector(LOKDocView* pLOKDocView) + { ++ TiledWindow& rWindow = lcl_getTiledWindow(GTK_WIDGET(pLOKDocView)); + gtk_list_store_clear( GTK_LIST_STORE( + gtk_combo_box_get_model( +- GTK_COMBO_BOX(pPartSelector) )) ); ++ GTK_COMBO_BOX(rWindow.m_pPartSelector) )) ); + + if (!pLOKDocView) + { +@@ -457,16 +463,17 @@ static void populatePartSelector(LOKDocView* pLOKDocView) + snprintf( sText, nMaxLength, "%i (%s)", i+1, pName ); + free( pName ); + +- gtk_combo_box_text_append_text( pPartSelector, sText ); ++ gtk_combo_box_text_append_text( rWindow.m_pPartSelector, sText ); + } +- gtk_combo_box_set_active(GTK_COMBO_BOX(pPartSelector), lok_doc_view_get_part(pLOKDocView)); ++ gtk_combo_box_set_active(GTK_COMBO_BOX(rWindow.m_pPartSelector), lok_doc_view_get_part(pLOKDocView)); + } + + static void signalSize(LOKDocView* pLOKDocView, gpointer /*pData*/) + { +- g_bPartSelectorBroadcast = false; ++ TiledWindow& rWindow = lcl_getTiledWindow(GTK_WIDGET(pLOKDocView)); ++ rWindow.m_bPartSelectorBroadcast = false; + populatePartSelector(pLOKDocView); +- g_bPartSelectorBroadcast = true; ++ rWindow.m_bPartSelectorBroadcast = true; + } + + static void changePart( GtkWidget* pSelector, gpointer /* pItem */ ) +@@ -474,7 +481,7 @@ static void changePart( GtkWidget* pSelector, gpointer /* pItem */ ) + int nPart = gtk_combo_box_get_active( GTK_COMBO_BOX(pSelector) ); + TiledWindow& rWindow = lcl_getTiledWindow(pSelector); + +- if (g_bPartSelectorBroadcast && rWindow.m_pDocView) ++ if (rWindow.m_bPartSelectorBroadcast && rWindow.m_pDocView) + { + lok_doc_view_set_part( LOK_DOC_VIEW(rWindow.m_pDocView), nPart ); + lok_doc_view_reset_view( LOK_DOC_VIEW(rWindow.m_pDocView) ); +@@ -523,13 +530,13 @@ static void openDocumentCallback (GObject* source_object, GAsyncResult* res, gpo + } + + populatePartSelector(pDocView); +- populatePartModeSelector( GTK_COMBO_BOX_TEXT(pPartModeComboBox) ); ++ populatePartModeSelector( GTK_COMBO_BOX_TEXT(rWindow.m_pPartModeComboBox) ); + // Connect these signals after populating the selectors, to avoid re-rendering on setting the default part/partmode. +- g_signal_connect(G_OBJECT(pPartModeComboBox), "changed", G_CALLBACK(changePartMode), 0); +- g_signal_connect(G_OBJECT(pPartSelector), "changed", G_CALLBACK(changePart), 0); ++ g_signal_connect(G_OBJECT(rWindow.m_pPartModeComboBox), "changed", G_CALLBACK(changePartMode), 0); ++ g_signal_connect(G_OBJECT(rWindow.m_pPartSelector), "changed", G_CALLBACK(changePart), 0); + + focusChain = g_list_append( focusChain, pDocView ); +- gtk_container_set_focus_chain ( GTK_CONTAINER (pVBox), focusChain ); ++ gtk_container_set_focus_chain ( GTK_CONTAINER (rWindow.m_pVBox), focusChain ); + + gtk_widget_hide(rWindow.m_pStatusBar); + } +@@ -554,8 +561,8 @@ int main( int argc, char* argv[] ) + gtk_window_set_default_size(GTK_WINDOW(pWindow), 1024, 768); + g_signal_connect( pWindow, "destroy", G_CALLBACK(gtk_main_quit), NULL ); + +- pVBox = gtk_box_new( GTK_ORIENTATION_VERTICAL, 0 ); +- gtk_container_add( GTK_CONTAINER(pWindow), pVBox ); ++ aWindow.m_pVBox = gtk_box_new( GTK_ORIENTATION_VERTICAL, 0 ); ++ gtk_container_add( GTK_CONTAINER(pWindow), aWindow.m_pVBox ); + + // Toolbar + GtkWidget* pToolbar = gtk_toolbar_new(); +@@ -587,14 +594,14 @@ int main( int argc, char* argv[] ) + gtk_container_add( GTK_CONTAINER(pPartSelectorToolItem), pComboBox ); + gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pPartSelectorToolItem, -1 ); + +- pPartSelector = GTK_COMBO_BOX_TEXT(pComboBox); ++ aWindow.m_pPartSelector = GTK_COMBO_BOX_TEXT(pComboBox); + + GtkToolItem* pSeparator2 = gtk_separator_tool_item_new(); + gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pSeparator2, -1); + + GtkToolItem* pPartModeSelectorToolItem = gtk_tool_item_new(); +- pPartModeComboBox = gtk_combo_box_text_new(); +- gtk_container_add( GTK_CONTAINER(pPartModeSelectorToolItem), pPartModeComboBox ); ++ aWindow.m_pPartModeComboBox = gtk_combo_box_text_new(); ++ gtk_container_add(GTK_CONTAINER(pPartModeSelectorToolItem), aWindow.m_pPartModeComboBox); + gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pPartModeSelectorToolItem, -1 ); + + gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), gtk_separator_tool_item_new(), -1); +@@ -656,7 +663,7 @@ int main( int argc, char* argv[] ) + g_signal_connect(G_OBJECT(aWindow.m_pStrikethrough), "toggled", G_CALLBACK(toggleToolItem), NULL); + lcl_registerToolItem(aWindow, aWindow.m_pStrikethrough, ".uno:Strikeout"); + +- gtk_box_pack_start( GTK_BOX(pVBox), pToolbar, FALSE, FALSE, 0 ); // Adds to top. ++ gtk_box_pack_start( GTK_BOX(aWindow.m_pVBox), pToolbar, FALSE, FALSE, 0 ); // Adds to top. + + // Findbar + pFindbar = gtk_toolbar_new(); +@@ -688,7 +695,7 @@ int main( int argc, char* argv[] ) + gtk_container_add(GTK_CONTAINER(pFindbarLabelContainer), pFindbarLabel); + gtk_toolbar_insert(GTK_TOOLBAR(pFindbar), pFindbarLabelContainer, -1); + +- gtk_box_pack_end(GTK_BOX(pVBox), pFindbar, FALSE, FALSE, 0); ++ gtk_box_pack_end(GTK_BOX(aWindow.m_pVBox), pFindbar, FALSE, FALSE, 0); + + // Docview + GtkWidget* pDocView = lok_doc_view_new (argv[1], NULL, NULL); +@@ -710,7 +717,7 @@ int main( int argc, char* argv[] ) + aWindow.m_pScrolledWindow = gtk_scrolled_window_new(0, 0); + gtk_widget_set_hexpand (aWindow.m_pScrolledWindow, TRUE); + gtk_widget_set_vexpand (aWindow.m_pScrolledWindow, TRUE); +- gtk_container_add(GTK_CONTAINER(pVBox), aWindow.m_pScrolledWindow); ++ gtk_container_add(GTK_CONTAINER(aWindow.m_pVBox), aWindow.m_pScrolledWindow); + + gtk_container_add(GTK_CONTAINER(aWindow.m_pScrolledWindow), pDocView); + +@@ -720,7 +727,7 @@ int main( int argc, char* argv[] ) + GtkWidget* pStatusBar = gtk_statusbar_new (); + aWindow.m_pStatusBar = pStatusBar; + gtk_container_forall(GTK_CONTAINER(pStatusBar), removeChildrenFromStatusbar, pStatusBar); +- gtk_container_add (GTK_CONTAINER(pVBox), pStatusBar); ++ gtk_container_add (GTK_CONTAINER(aWindow.m_pVBox), pStatusBar); + gtk_container_add (GTK_CONTAINER(pStatusBar), pProgressBar); + gtk_widget_set_hexpand(pProgressBar, true); + +-- +2.12.0 + diff --git a/SOURCES/0131-gtktiledviewer-allow-findbar-in-multiple-windows.patch b/SOURCES/0131-gtktiledviewer-allow-findbar-in-multiple-windows.patch new file mode 100644 index 0000000..7d7ad6b --- /dev/null +++ b/SOURCES/0131-gtktiledviewer-allow-findbar-in-multiple-windows.patch @@ -0,0 +1,190 @@ +From 1ce8cd9be395ac818a151a7618121e9b203bc159 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 15 Sep 2015 12:53:24 +0200 +Subject: [PATCH 131/398] gtktiledviewer: allow findbar in multiple windows + +With this, all previously global data is now stored per-window in the +g_aWindows map. + +Change-Id: I45b4449ee7d516106ea0b039d1af97db49edf759 +(cherry picked from commit d51e3f7877afe62b68071a694438d2d6722bb406) +--- + .../qa/gtktiledviewer/gtktiledviewer.cxx | 67 ++++++++++++---------- + 1 file changed, 36 insertions(+), 31 deletions(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 3e72c13470a8..efbb90800301 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -30,10 +30,6 @@ static int help() + return 1; + } + +-static GtkWidget* pFindbar; +-static GtkWidget* pFindbarEntry; +-static GtkWidget* pFindbarLabel; +- + /// Represents all the state that is specific to one GtkWindow of this app. + class TiledWindow + { +@@ -54,6 +50,9 @@ public: + GtkWidget* m_pPartModeComboBox; + /// Should the part selector avoid calling lok::Document::setPart()? + bool m_bPartSelectorBroadcast; ++ GtkWidget* m_pFindbar; ++ GtkWidget* m_pFindbarEntry; ++ GtkWidget* m_pFindbarLabel; + + TiledWindow() + : m_pDocView(0), +@@ -68,7 +67,10 @@ public: + m_pVBox(0), + m_pPartSelector(0), + m_pPartModeComboBox(0), +- m_bPartSelectorBroadcast(true) ++ m_bPartSelectorBroadcast(true), ++ m_pFindbar(0), ++ m_pFindbarEntry(0), ++ m_pFindbarLabel(0) + { + } + }; +@@ -173,16 +175,17 @@ static void toggleEditing(GtkWidget* pButton, gpointer /*pItem*/) + } + + /// Toggle the visibility of the findbar. +-static void toggleFindbar(GtkWidget* /*pButton*/, gpointer /*pItem*/) ++static void toggleFindbar(GtkWidget* pButton, gpointer /*pItem*/) + { +- if (gtk_widget_get_visible(pFindbar)) ++ TiledWindow& rWindow = lcl_getTiledWindow(pButton); ++ if (gtk_widget_get_visible(rWindow.m_pFindbar)) + { +- gtk_widget_hide(pFindbar); ++ gtk_widget_hide(rWindow.m_pFindbar); + } + else + { +- gtk_widget_show_all(pFindbar); +- gtk_widget_grab_focus(pFindbarEntry); ++ gtk_widget_show_all(rWindow.m_pFindbar); ++ gtk_widget_grab_focus(rWindow.m_pFindbarEntry); + } + } + +@@ -244,10 +247,11 @@ static void doCopy(GtkWidget* pButton, gpointer /*pItem*/) + } + + +-/// Searches for the next or previous text of pFindbarEntry. ++/// Searches for the next or previous text of TiledWindow::m_pFindbarEntry. + static void doSearch(GtkWidget* pButton, bool bBackwards) + { +- GtkEntry* pEntry = GTK_ENTRY(pFindbarEntry); ++ TiledWindow& rWindow = lcl_getTiledWindow(pButton); ++ GtkEntry* pEntry = GTK_ENTRY(rWindow.m_pFindbarEntry); + const char* pText = gtk_entry_get_text(pEntry); + boost::property_tree::ptree aTree; + aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchString/type", '/'), "string"); +@@ -255,7 +259,6 @@ static void doSearch(GtkWidget* pButton, bool bBackwards) + aTree.put(boost::property_tree::ptree::path_type("SearchItem.Backward/type", '/'), "boolean"); + aTree.put(boost::property_tree::ptree::path_type("SearchItem.Backward/value", '/'), bBackwards); + +- TiledWindow& rWindow = lcl_getTiledWindow(pButton); + LOKDocView* pLOKDocView = LOK_DOC_VIEW(rWindow.m_pDocView); + GdkRectangle aArea; + getVisibleAreaTwips(rWindow.m_pDocView, &aArea); +@@ -285,7 +288,8 @@ static void signalSearchPrev(GtkWidget* pButton, gpointer /*pItem*/) + /// Handles the key-press-event of the search entry widget. + static gboolean signalFindbar(GtkWidget* pWidget, GdkEventKey* pEvent, gpointer /*pData*/) + { +- gtk_label_set_text(GTK_LABEL(pFindbarLabel), ""); ++ TiledWindow& rWindow = lcl_getTiledWindow(pWidget); ++ gtk_label_set_text(GTK_LABEL(rWindow.m_pFindbarLabel), ""); + switch(pEvent->keyval) + { + case GDK_KEY_Return: +@@ -297,7 +301,7 @@ static gboolean signalFindbar(GtkWidget* pWidget, GdkEventKey* pEvent, gpointer + case GDK_KEY_Escape: + { + // Hide the findbar. +- gtk_widget_hide(pFindbar); ++ gtk_widget_hide(rWindow.m_pFindbar); + return TRUE; + } + } +@@ -350,9 +354,10 @@ static void loadChanged(LOKDocView* /*pLOKDocView*/, gdouble fValue, gpointer pD + } + + /// LOKDocView found no search matches -> set the search label accordingly. +-static void signalSearch(LOKDocView* /*pLOKDocView*/, char* /*pPayload*/, gpointer /*pData*/) ++static void signalSearch(LOKDocView* pLOKDocView, char* /*pPayload*/, gpointer /*pData*/) + { +- gtk_label_set_text(GTK_LABEL(pFindbarLabel), "Search key not found"); ++ TiledWindow& rWindow = lcl_getTiledWindow(GTK_WIDGET(pLOKDocView)); ++ gtk_label_set_text(GTK_LABEL(rWindow.m_pFindbarLabel), "Search key not found"); + } + + +@@ -666,36 +671,36 @@ int main( int argc, char* argv[] ) + gtk_box_pack_start( GTK_BOX(aWindow.m_pVBox), pToolbar, FALSE, FALSE, 0 ); // Adds to top. + + // Findbar +- pFindbar = gtk_toolbar_new(); +- gtk_toolbar_set_style(GTK_TOOLBAR(pFindbar), GTK_TOOLBAR_ICONS); ++ aWindow.m_pFindbar = gtk_toolbar_new(); ++ gtk_toolbar_set_style(GTK_TOOLBAR(aWindow.m_pFindbar), GTK_TOOLBAR_ICONS); + + GtkToolItem* pFindbarClose = gtk_tool_button_new( NULL, NULL); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pFindbarClose), "window-close-symbolic"); +- gtk_toolbar_insert(GTK_TOOLBAR(pFindbar), pFindbarClose, -1); ++ gtk_toolbar_insert(GTK_TOOLBAR(aWindow.m_pFindbar), pFindbarClose, -1); + g_signal_connect(G_OBJECT(pFindbarClose), "clicked", G_CALLBACK(toggleFindbar), NULL); + + GtkToolItem* pEntryContainer = gtk_tool_item_new(); +- pFindbarEntry = gtk_entry_new(); +- gtk_container_add(GTK_CONTAINER(pEntryContainer), pFindbarEntry); +- g_signal_connect(pFindbarEntry, "key-press-event", G_CALLBACK(signalFindbar), 0); +- gtk_toolbar_insert(GTK_TOOLBAR(pFindbar), pEntryContainer, -1); ++ aWindow.m_pFindbarEntry = gtk_entry_new(); ++ gtk_container_add(GTK_CONTAINER(pEntryContainer), aWindow.m_pFindbarEntry); ++ g_signal_connect(aWindow.m_pFindbarEntry, "key-press-event", G_CALLBACK(signalFindbar), 0); ++ gtk_toolbar_insert(GTK_TOOLBAR(aWindow.m_pFindbar), pEntryContainer, -1); + + GtkToolItem* pFindbarNext = gtk_tool_button_new( NULL, NULL); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pFindbarNext), "go-down-symbolic"); +- gtk_toolbar_insert(GTK_TOOLBAR(pFindbar), pFindbarNext, -1); ++ gtk_toolbar_insert(GTK_TOOLBAR(aWindow.m_pFindbar), pFindbarNext, -1); + g_signal_connect(G_OBJECT(pFindbarNext), "clicked", G_CALLBACK(signalSearchNext), NULL); + + GtkToolItem* pFindbarPrev = gtk_tool_button_new( NULL, NULL); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pFindbarPrev), "go-up-symbolic"); +- gtk_toolbar_insert(GTK_TOOLBAR(pFindbar), pFindbarPrev, -1); ++ gtk_toolbar_insert(GTK_TOOLBAR(aWindow.m_pFindbar), pFindbarPrev, -1); + g_signal_connect(G_OBJECT(pFindbarPrev), "clicked", G_CALLBACK(signalSearchPrev), NULL); + + GtkToolItem* pFindbarLabelContainer = gtk_tool_item_new(); +- pFindbarLabel = gtk_label_new(""); +- gtk_container_add(GTK_CONTAINER(pFindbarLabelContainer), pFindbarLabel); +- gtk_toolbar_insert(GTK_TOOLBAR(pFindbar), pFindbarLabelContainer, -1); ++ aWindow.m_pFindbarLabel = gtk_label_new(""); ++ gtk_container_add(GTK_CONTAINER(pFindbarLabelContainer), aWindow.m_pFindbarLabel); ++ gtk_toolbar_insert(GTK_TOOLBAR(aWindow.m_pFindbar), pFindbarLabelContainer, -1); + +- gtk_box_pack_end(GTK_BOX(aWindow.m_pVBox), pFindbar, FALSE, FALSE, 0); ++ gtk_box_pack_end(GTK_BOX(aWindow.m_pVBox), aWindow.m_pFindbar, FALSE, FALSE, 0); + + // Docview + GtkWidget* pDocView = lok_doc_view_new (argv[1], NULL, NULL); +@@ -733,7 +738,7 @@ int main( int argc, char* argv[] ) + + gtk_widget_show_all( pWindow ); + // Hide the findbar by default. +- gtk_widget_hide(pFindbar); ++ gtk_widget_hide(aWindow.m_pFindbar); + + g_aWindows[pWindow] = aWindow; + +-- +2.12.0 + diff --git a/SOURCES/0132-lokdocview-allow-not-calling-documentLoad.patch b/SOURCES/0132-lokdocview-allow-not-calling-documentLoad.patch new file mode 100644 index 0000000..6ea7a51 --- /dev/null +++ b/SOURCES/0132-lokdocview-allow-not-calling-documentLoad.patch @@ -0,0 +1,129 @@ +From c00540a0f89da14380cfb4e194206ecfb5ca0e7f Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 15 Sep 2015 14:23:53 +0200 +Subject: [PATCH 132/398] lokdocview: allow not calling documentLoad() + +Change-Id: I2ff57c4be11cd3908bc951ebf572a2c02e2c4585 +(cherry picked from commit 4fd59356cb09e89324e8cd8ec84eef22a4c2031b) +--- + include/LibreOfficeKit/LibreOfficeKitGtk.h | 2 ++ + libreofficekit/source/gtk/lokdocview.cxx | 48 ++++++++++++++++++++++++++++++ + 2 files changed, 50 insertions(+) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h +index 01009fb9eb40..f17925b4c53a 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h ++++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h +@@ -44,6 +44,8 @@ GtkWidget* lok_doc_view_new (const gchar* + GCancellable *cancellable, + GError **error); + ++GtkWidget* lok_doc_view_new_from_widget (LOKDocView* pDocView); ++ + void lok_doc_view_open_document (LOKDocView* pDocView, + const gchar* pPath, + GCancellable* cancellable, +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 27d2e1df983a..3cce40a94217 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -127,7 +127,9 @@ enum + PROP_0, + + PROP_LO_PATH, ++ PROP_LO_POINTER, + PROP_DOC_PATH, ++ PROP_DOC_POINTER, + PROP_EDITABLE, + PROP_LOAD_PROGRESS, + PROP_ZOOM, +@@ -1388,9 +1390,15 @@ static void lok_doc_view_set_property (GObject* object, guint propId, const GVal + case PROP_LO_PATH: + priv->m_aLOPath = g_value_dup_string (value); + break; ++ case PROP_LO_POINTER: ++ priv->m_pOffice = static_cast(g_value_get_pointer(value)); ++ break; + case PROP_DOC_PATH: + priv->m_aDocPath = g_value_dup_string (value); + break; ++ case PROP_DOC_POINTER: ++ priv->m_pDocument = static_cast(g_value_get_pointer(value)); ++ break; + case PROP_EDITABLE: + lok_doc_view_set_edit (pDocView, g_value_get_boolean (value)); + break; +@@ -1418,9 +1426,15 @@ static void lok_doc_view_get_property (GObject* object, guint propId, GValue *va + case PROP_LO_PATH: + g_value_set_string (value, priv->m_aLOPath); + break; ++ case PROP_LO_POINTER: ++ g_value_set_pointer(value, priv->m_pOffice); ++ break; + case PROP_DOC_PATH: + g_value_set_string (value, priv->m_aDocPath); + break; ++ case PROP_DOC_POINTER: ++ g_value_set_pointer(value, priv->m_pDocument); ++ break; + case PROP_EDITABLE: + g_value_set_boolean (value, priv->m_bEdit); + break; +@@ -1531,6 +1545,20 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + | G_PARAM_CONSTRUCT_ONLY))); + + /** ++ * LOKDocView:lopointer: ++ * ++ * A LibreOfficeKit* in case lok_init() is already called ++ * previously. ++ */ ++ g_object_class_install_property (pGObjectClass, ++ PROP_LO_POINTER, ++ g_param_spec_pointer("lopointer", ++ "LO Pointer", ++ "A LibreOfficeKit* from lok_init()", ++ static_cast(G_PARAM_READWRITE ++ | G_PARAM_CONSTRUCT_ONLY))); ++ ++ /** + * LOKDocView:docpath: + * + * The path of the document that is currently being viewed. +@@ -1544,6 +1572,19 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + static_cast(G_PARAM_READWRITE))); + + /** ++ * LOKDocView:docpointer: ++ * ++ * A LibreOfficeKitDocument* in case documentLoad() is already called ++ * previously. ++ */ ++ g_object_class_install_property (pGObjectClass, ++ PROP_DOC_POINTER, ++ g_param_spec_pointer("docpointer", ++ "Document Pointer", ++ "A LibreOfficeKitDocument* from documentLoad()", ++ static_cast(G_PARAM_READWRITE))); ++ ++ /** + * LOKDocView:editable: + * + * Whether the document loaded inside of #LOKDocView is editable or not. +@@ -1795,6 +1836,13 @@ lok_doc_view_new (const gchar* pPath, GCancellable *cancellable, GError **error) + return GTK_WIDGET (g_initable_new (LOK_TYPE_DOC_VIEW, cancellable, error, "lopath", pPath, NULL)); + } + ++SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new_from_widget(LOKDocView* pLOKDocView) ++{ ++ LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private(pLOKDocView)); ++ return GTK_WIDGET(g_initable_new(LOK_TYPE_DOC_VIEW, /*cancellable=*/0, /*error=*/0, ++ "lopath", priv->m_aLOPath, "lopointer", priv->m_pOffice, "docpointer", priv->m_pDocument, NULL)); ++} ++ + /** + * lok_doc_view_open_document_finish: + * @pDocView: The #LOKDocView instance +-- +2.12.0 + diff --git a/SOURCES/0133-gtktiledviewer-factor-out-createWindow-from-main.patch b/SOURCES/0133-gtktiledviewer-factor-out-createWindow-from-main.patch new file mode 100644 index 0000000..f1c042a --- /dev/null +++ b/SOURCES/0133-gtktiledviewer-factor-out-createWindow-from-main.patch @@ -0,0 +1,324 @@ +From c918ee9ef3a098d22162010e8a142dbecf289e72 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 15 Sep 2015 14:51:06 +0200 +Subject: [PATCH 133/398] gtktiledviewer: factor out createWindow() from main() + +Change-Id: Ib7ccd2192247805205b65e5e8da67bcc826f4d31 +(cherry picked from commit 2b69ce33edaed9eaa018821180a00d563ad1ba18) +--- + .../qa/gtktiledviewer/gtktiledviewer.cxx | 228 +++++++++++---------- + 1 file changed, 116 insertions(+), 112 deletions(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index efbb90800301..b43f785a300a 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -546,70 +546,58 @@ static void openDocumentCallback (GObject* source_object, GAsyncResult* res, gpo + gtk_widget_hide(rWindow.m_pStatusBar); + } + +-int main( int argc, char* argv[] ) ++/// Creates the GtkWindow that has main widget as children and registers it in the window map. ++static GtkWidget* createWindow(TiledWindow& rWindow) + { +- if( argc < 3 || +- ( argc > 1 && ( !strcmp( argv[1], "--help" ) || !strcmp( argv[1], "-h" ) ) ) ) +- return help(); +- +- if ( argv[1][0] != '/' ) +- { +- fprintf(stderr, "Absolute path required to libreoffice install\n"); +- return 1; +- } +- +- gtk_init( &argc, &argv ); +- +- GtkWidget *pWindow = gtk_window_new( GTK_WINDOW_TOPLEVEL ); +- TiledWindow aWindow; +- gtk_window_set_title( GTK_WINDOW(pWindow), "LibreOfficeKit GTK Tiled Viewer" ); ++ 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_main_quit), NULL ); ++ g_signal_connect(pWindow, "destroy", G_CALLBACK(gtk_main_quit), 0); + +- aWindow.m_pVBox = gtk_box_new( GTK_ORIENTATION_VERTICAL, 0 ); +- gtk_container_add( GTK_CONTAINER(pWindow), aWindow.m_pVBox ); ++ rWindow.m_pVBox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); ++ gtk_container_add(GTK_CONTAINER(pWindow), rWindow.m_pVBox); + + // Toolbar + GtkWidget* pToolbar = gtk_toolbar_new(); +- gtk_toolbar_set_style( GTK_TOOLBAR(pToolbar), GTK_TOOLBAR_ICONS ); ++ gtk_toolbar_set_style(GTK_TOOLBAR(pToolbar), GTK_TOOLBAR_ICONS); + +- GtkToolItem* pZoomIn = gtk_tool_button_new( NULL, NULL ); ++ GtkToolItem* pZoomIn = gtk_tool_button_new(NULL, NULL); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pZoomIn), "zoom-in-symbolic"); + gtk_tool_item_set_tooltip_text(pZoomIn, "Zoom In"); +- gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pZoomIn, 0); +- g_signal_connect( G_OBJECT(pZoomIn), "clicked", G_CALLBACK(changeZoom), NULL ); ++ gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pZoomIn, 0); ++ g_signal_connect(G_OBJECT(pZoomIn), "clicked", G_CALLBACK(changeZoom), NULL); + +- GtkToolItem* pZoom1 = gtk_tool_button_new( NULL, NULL ); +- gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pZoom1), "zoom-original-symbolic"); ++ GtkToolItem* pZoom1 = gtk_tool_button_new(NULL, NULL); ++ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(pZoom1), "zoom-original-symbolic"); + gtk_tool_item_set_tooltip_text(pZoom1, "Normal Size"); +- gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pZoom1, -1); +- g_signal_connect( G_OBJECT(pZoom1), "clicked", G_CALLBACK(changeZoom), NULL ); ++ gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pZoom1, -1); ++ g_signal_connect(G_OBJECT(pZoom1), "clicked", G_CALLBACK(changeZoom), NULL); + +- GtkToolItem* pZoomOut = gtk_tool_button_new( NULL, NULL ); ++ GtkToolItem* pZoomOut = gtk_tool_button_new(NULL, NULL); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pZoomOut), "zoom-out-symbolic"); + gtk_tool_item_set_tooltip_text(pZoomOut, "Zoom Out"); +- gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pZoomOut, -1); +- g_signal_connect( G_OBJECT(pZoomOut), "clicked", G_CALLBACK(changeZoom), NULL ); ++ gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pZoomOut, -1); ++ g_signal_connect(G_OBJECT(pZoomOut), "clicked", G_CALLBACK(changeZoom), NULL); + + GtkToolItem* pSeparator1 = gtk_separator_tool_item_new(); +- gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pSeparator1, -1); ++ gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pSeparator1, -1); + + GtkToolItem* pPartSelectorToolItem = gtk_tool_item_new(); + GtkWidget* pComboBox = gtk_combo_box_text_new(); +- gtk_container_add( GTK_CONTAINER(pPartSelectorToolItem), pComboBox ); +- gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pPartSelectorToolItem, -1 ); ++ gtk_container_add(GTK_CONTAINER(pPartSelectorToolItem), pComboBox); ++ gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pPartSelectorToolItem, -1); + +- aWindow.m_pPartSelector = GTK_COMBO_BOX_TEXT(pComboBox); ++ rWindow.m_pPartSelector = GTK_COMBO_BOX_TEXT(pComboBox); + + GtkToolItem* pSeparator2 = gtk_separator_tool_item_new(); +- gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pSeparator2, -1); ++ gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pSeparator2, -1); + + GtkToolItem* pPartModeSelectorToolItem = gtk_tool_item_new(); +- aWindow.m_pPartModeComboBox = gtk_combo_box_text_new(); +- gtk_container_add(GTK_CONTAINER(pPartModeSelectorToolItem), aWindow.m_pPartModeComboBox); +- gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pPartModeSelectorToolItem, -1 ); ++ rWindow.m_pPartModeComboBox = gtk_combo_box_text_new(); ++ gtk_container_add(GTK_CONTAINER(pPartModeSelectorToolItem), rWindow.m_pPartModeComboBox); ++ gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pPartModeSelectorToolItem, -1); + +- gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), gtk_separator_tool_item_new(), -1); ++ gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), gtk_separator_tool_item_new(), -1); + + // Cut, copy & paste. + GtkToolItem* pCopyButton = gtk_tool_button_new( NULL, NULL); +@@ -620,7 +608,7 @@ int main( int argc, char* argv[] ) + gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), gtk_separator_tool_item_new(), -1); + + GtkToolItem* pEnableEditing = gtk_toggle_tool_button_new(); +- aWindow.m_pEnableEditing = pEnableEditing; ++ rWindow.m_pEnableEditing = pEnableEditing; + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pEnableEditing), "insert-text-symbolic"); + gtk_tool_item_set_tooltip_text(pEnableEditing, "Edit"); + gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pEnableEditing, -1); +@@ -638,77 +626,115 @@ int main( int argc, char* argv[] ) + gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pNewViewButton, -1); + g_signal_connect(G_OBJECT(pNewViewButton), "clicked", G_CALLBACK(createView), NULL); + +- gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), gtk_separator_tool_item_new(), -1); +- +- aWindow.m_pBold = gtk_toggle_tool_button_new(); +- gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (aWindow.m_pBold), "format-text-bold-symbolic"); +- gtk_tool_item_set_tooltip_text(aWindow.m_pBold, "Bold"); +- gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), aWindow.m_pBold, -1); +- g_signal_connect(G_OBJECT(aWindow.m_pBold), "toggled", G_CALLBACK(toggleToolItem), NULL); +- lcl_registerToolItem(aWindow, aWindow.m_pBold, ".uno:Bold"); +- +- aWindow.m_pItalic = gtk_toggle_tool_button_new(); +- gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (aWindow.m_pItalic), "format-text-italic-symbolic"); +- gtk_tool_item_set_tooltip_text(aWindow.m_pItalic, "Italic"); +- gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), aWindow.m_pItalic, -1); +- g_signal_connect(G_OBJECT(aWindow.m_pItalic), "toggled", G_CALLBACK(toggleToolItem), NULL); +- lcl_registerToolItem(aWindow, aWindow.m_pItalic, ".uno:Italic"); +- +- aWindow.m_pUnderline = gtk_toggle_tool_button_new(); +- gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (aWindow.m_pUnderline), "format-text-underline-symbolic"); +- gtk_tool_item_set_tooltip_text(aWindow.m_pUnderline, "Underline"); +- gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), aWindow.m_pUnderline, -1); +- g_signal_connect(G_OBJECT(aWindow.m_pUnderline), "toggled", G_CALLBACK(toggleToolItem), NULL); +- lcl_registerToolItem(aWindow, aWindow.m_pUnderline, ".uno:Underline"); +- +- aWindow.m_pStrikethrough = gtk_toggle_tool_button_new (); +- gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(aWindow.m_pStrikethrough), "format-text-strikethrough-symbolic"); +- gtk_tool_item_set_tooltip_text(aWindow.m_pStrikethrough, "Strikethrough"); +- gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), aWindow.m_pStrikethrough, -1); +- g_signal_connect(G_OBJECT(aWindow.m_pStrikethrough), "toggled", G_CALLBACK(toggleToolItem), NULL); +- lcl_registerToolItem(aWindow, aWindow.m_pStrikethrough, ".uno:Strikeout"); +- +- gtk_box_pack_start( GTK_BOX(aWindow.m_pVBox), pToolbar, FALSE, FALSE, 0 ); // Adds to top. ++ gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), gtk_separator_tool_item_new(), -1); ++ ++ rWindow.m_pBold = gtk_toggle_tool_button_new(); ++ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(rWindow.m_pBold), "format-text-bold-symbolic"); ++ gtk_tool_item_set_tooltip_text(rWindow.m_pBold, "Bold"); ++ gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), rWindow.m_pBold, -1); ++ g_signal_connect(G_OBJECT(rWindow.m_pBold), "toggled", G_CALLBACK(toggleToolItem), NULL); ++ lcl_registerToolItem(rWindow, rWindow.m_pBold, ".uno:Bold"); ++ ++ rWindow.m_pItalic = gtk_toggle_tool_button_new(); ++ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (rWindow.m_pItalic), "format-text-italic-symbolic"); ++ gtk_tool_item_set_tooltip_text(rWindow.m_pItalic, "Italic"); ++ gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), rWindow.m_pItalic, -1); ++ g_signal_connect(G_OBJECT(rWindow.m_pItalic), "toggled", G_CALLBACK(toggleToolItem), NULL); ++ lcl_registerToolItem(rWindow, rWindow.m_pItalic, ".uno:Italic"); ++ ++ rWindow.m_pUnderline = gtk_toggle_tool_button_new(); ++ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (rWindow.m_pUnderline), "format-text-underline-symbolic"); ++ gtk_tool_item_set_tooltip_text(rWindow.m_pUnderline, "Underline"); ++ gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), rWindow.m_pUnderline, -1); ++ g_signal_connect(G_OBJECT(rWindow.m_pUnderline), "toggled", G_CALLBACK(toggleToolItem), NULL); ++ lcl_registerToolItem(rWindow, rWindow.m_pUnderline, ".uno:Underline"); ++ ++ rWindow.m_pStrikethrough = gtk_toggle_tool_button_new (); ++ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(rWindow.m_pStrikethrough), "format-text-strikethrough-symbolic"); ++ gtk_tool_item_set_tooltip_text(rWindow.m_pStrikethrough, "Strikethrough"); ++ gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), rWindow.m_pStrikethrough, -1); ++ g_signal_connect(G_OBJECT(rWindow.m_pStrikethrough), "toggled", G_CALLBACK(toggleToolItem), NULL); ++ lcl_registerToolItem(rWindow, rWindow.m_pStrikethrough, ".uno:Strikeout"); ++ ++ gtk_box_pack_start(GTK_BOX(rWindow.m_pVBox), pToolbar, FALSE, FALSE, 0 ); // Adds to top. + + // Findbar +- aWindow.m_pFindbar = gtk_toolbar_new(); +- gtk_toolbar_set_style(GTK_TOOLBAR(aWindow.m_pFindbar), GTK_TOOLBAR_ICONS); ++ rWindow.m_pFindbar = gtk_toolbar_new(); ++ gtk_toolbar_set_style(GTK_TOOLBAR(rWindow.m_pFindbar), GTK_TOOLBAR_ICONS); + + GtkToolItem* pFindbarClose = gtk_tool_button_new( NULL, NULL); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pFindbarClose), "window-close-symbolic"); +- gtk_toolbar_insert(GTK_TOOLBAR(aWindow.m_pFindbar), pFindbarClose, -1); ++ gtk_toolbar_insert(GTK_TOOLBAR(rWindow.m_pFindbar), pFindbarClose, -1); + g_signal_connect(G_OBJECT(pFindbarClose), "clicked", G_CALLBACK(toggleFindbar), NULL); + + GtkToolItem* pEntryContainer = gtk_tool_item_new(); +- aWindow.m_pFindbarEntry = gtk_entry_new(); +- gtk_container_add(GTK_CONTAINER(pEntryContainer), aWindow.m_pFindbarEntry); +- g_signal_connect(aWindow.m_pFindbarEntry, "key-press-event", G_CALLBACK(signalFindbar), 0); +- gtk_toolbar_insert(GTK_TOOLBAR(aWindow.m_pFindbar), pEntryContainer, -1); ++ rWindow.m_pFindbarEntry = gtk_entry_new(); ++ gtk_container_add(GTK_CONTAINER(pEntryContainer), rWindow.m_pFindbarEntry); ++ g_signal_connect(rWindow.m_pFindbarEntry, "key-press-event", G_CALLBACK(signalFindbar), 0); ++ gtk_toolbar_insert(GTK_TOOLBAR(rWindow.m_pFindbar), pEntryContainer, -1); + + GtkToolItem* pFindbarNext = gtk_tool_button_new( NULL, NULL); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pFindbarNext), "go-down-symbolic"); +- gtk_toolbar_insert(GTK_TOOLBAR(aWindow.m_pFindbar), pFindbarNext, -1); ++ gtk_toolbar_insert(GTK_TOOLBAR(rWindow.m_pFindbar), pFindbarNext, -1); + g_signal_connect(G_OBJECT(pFindbarNext), "clicked", G_CALLBACK(signalSearchNext), NULL); + + GtkToolItem* pFindbarPrev = gtk_tool_button_new( NULL, NULL); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pFindbarPrev), "go-up-symbolic"); +- gtk_toolbar_insert(GTK_TOOLBAR(aWindow.m_pFindbar), pFindbarPrev, -1); ++ gtk_toolbar_insert(GTK_TOOLBAR(rWindow.m_pFindbar), pFindbarPrev, -1); + g_signal_connect(G_OBJECT(pFindbarPrev), "clicked", G_CALLBACK(signalSearchPrev), NULL); + + GtkToolItem* pFindbarLabelContainer = gtk_tool_item_new(); +- aWindow.m_pFindbarLabel = gtk_label_new(""); +- gtk_container_add(GTK_CONTAINER(pFindbarLabelContainer), aWindow.m_pFindbarLabel); +- gtk_toolbar_insert(GTK_TOOLBAR(aWindow.m_pFindbar), pFindbarLabelContainer, -1); ++ rWindow.m_pFindbarLabel = gtk_label_new(""); ++ gtk_container_add(GTK_CONTAINER(pFindbarLabelContainer), rWindow.m_pFindbarLabel); ++ gtk_toolbar_insert(GTK_TOOLBAR(rWindow.m_pFindbar), pFindbarLabelContainer, -1); ++ ++ gtk_box_pack_end(GTK_BOX(rWindow.m_pVBox), rWindow.m_pFindbar, FALSE, FALSE, 0); ++ ++ // Scrolled window for DocView ++ rWindow.m_pScrolledWindow = gtk_scrolled_window_new(0, 0); ++ gtk_widget_set_hexpand(rWindow.m_pScrolledWindow, TRUE); ++ gtk_widget_set_vexpand(rWindow.m_pScrolledWindow, TRUE); ++ gtk_container_add(GTK_CONTAINER(rWindow.m_pVBox), rWindow.m_pScrolledWindow); + +- gtk_box_pack_end(GTK_BOX(aWindow.m_pVBox), aWindow.m_pFindbar, FALSE, FALSE, 0); ++ gtk_container_add(GTK_CONTAINER(rWindow.m_pScrolledWindow), rWindow.m_pDocView); ++ ++ GtkWidget* pProgressBar = gtk_progress_bar_new (); ++ g_signal_connect(rWindow.m_pDocView, "load-changed", G_CALLBACK(loadChanged), pProgressBar); ++ ++ GtkWidget* pStatusBar = gtk_statusbar_new(); ++ rWindow.m_pStatusBar = pStatusBar; ++ gtk_container_forall(GTK_CONTAINER(pStatusBar), removeChildrenFromStatusbar, pStatusBar); ++ gtk_container_add (GTK_CONTAINER(rWindow.m_pVBox), pStatusBar); ++ gtk_container_add (GTK_CONTAINER(pStatusBar), pProgressBar); ++ gtk_widget_set_hexpand(pProgressBar, true); ++ ++ gtk_widget_show_all(pWindow); ++ // Hide the findbar by default. ++ gtk_widget_hide(rWindow.m_pFindbar); ++ ++ g_aWindows[pWindow] = rWindow; ++ return pWindow; ++} ++ ++int main( int argc, char* argv[] ) ++{ ++ if( argc < 3 || ++ ( argc > 1 && ( !strcmp( argv[1], "--help" ) || !strcmp( argv[1], "-h" ) ) ) ) ++ return help(); ++ ++ if ( argv[1][0] != '/' ) ++ { ++ fprintf(stderr, "Absolute path required to libreoffice install\n"); ++ return 1; ++ } ++ ++ gtk_init( &argc, &argv ); + + // Docview + GtkWidget* pDocView = lok_doc_view_new (argv[1], NULL, NULL); +- aWindow.m_pDocView = pDocView; + #if GLIB_CHECK_VERSION(2,40,0) + g_assert_nonnull(pDocView); + #endif +- + g_signal_connect(pDocView, "edit-changed", G_CALLBACK(signalEdit), NULL); + g_signal_connect(pDocView, "command-changed", G_CALLBACK(signalCommand), NULL); + g_signal_connect(pDocView, "search-not-found", G_CALLBACK(signalSearch), NULL); +@@ -717,32 +743,10 @@ int main( int argc, char* argv[] ) + g_signal_connect(pDocView, "hyperlink-clicked", G_CALLBACK(signalHyperlink), NULL); + g_signal_connect(pDocView, "cursor-changed", G_CALLBACK(cursorChanged), NULL); + +- +- // Scrolled window for DocView +- aWindow.m_pScrolledWindow = gtk_scrolled_window_new(0, 0); +- gtk_widget_set_hexpand (aWindow.m_pScrolledWindow, TRUE); +- gtk_widget_set_vexpand (aWindow.m_pScrolledWindow, TRUE); +- gtk_container_add(GTK_CONTAINER(aWindow.m_pVBox), aWindow.m_pScrolledWindow); +- +- gtk_container_add(GTK_CONTAINER(aWindow.m_pScrolledWindow), pDocView); +- +- GtkWidget* pProgressBar = gtk_progress_bar_new (); +- g_signal_connect(pDocView, "load-changed", G_CALLBACK(loadChanged), pProgressBar); +- +- GtkWidget* pStatusBar = gtk_statusbar_new (); +- aWindow.m_pStatusBar = pStatusBar; +- gtk_container_forall(GTK_CONTAINER(pStatusBar), removeChildrenFromStatusbar, pStatusBar); +- gtk_container_add (GTK_CONTAINER(aWindow.m_pVBox), pStatusBar); +- gtk_container_add (GTK_CONTAINER(pStatusBar), pProgressBar); +- gtk_widget_set_hexpand(pProgressBar, true); +- +- gtk_widget_show_all( pWindow ); +- // Hide the findbar by default. +- gtk_widget_hide(aWindow.m_pFindbar); +- +- g_aWindows[pWindow] = aWindow; +- +- lok_doc_view_open_document( LOK_DOC_VIEW(pDocView), argv[2], NULL, openDocumentCallback, pDocView ); ++ TiledWindow aWindow; ++ aWindow.m_pDocView = pDocView; ++ createWindow(aWindow); ++ lok_doc_view_open_document(LOK_DOC_VIEW(pDocView), argv[2], NULL, openDocumentCallback, pDocView); + + gtk_main(); + +-- +2.12.0 + diff --git a/SOURCES/0134-gtktiledviewer-factor-out-setupDocView-from-main.patch b/SOURCES/0134-gtktiledviewer-factor-out-setupDocView-from-main.patch new file mode 100644 index 0000000..efdc36c --- /dev/null +++ b/SOURCES/0134-gtktiledviewer-factor-out-setupDocView-from-main.patch @@ -0,0 +1,62 @@ +From 2252f488aec993855c44d884747394ff15810fac Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 15 Sep 2015 15:05:51 +0200 +Subject: [PATCH 134/398] gtktiledviewer: factor out setupDocView() from main() + +Change-Id: Iac803f03267859c11f0f9090346b09b90c115b76 +(cherry picked from commit 8d8a8e1a2ea26df6d676495af7f017baa071153d) +--- + .../qa/gtktiledviewer/gtktiledviewer.cxx | 30 ++++++++++++---------- + 1 file changed, 17 insertions(+), 13 deletions(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index b43f785a300a..53bc5ea39615 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -716,6 +716,21 @@ static GtkWidget* createWindow(TiledWindow& rWindow) + return pWindow; + } + ++/// Common setup for DocView (regardless if it's just a new view or a document to be loaded). ++static void setupDocView(GtkWidget* pDocView) ++{ ++#if GLIB_CHECK_VERSION(2,40,0) ++ g_assert_nonnull(pDocView); ++#endif ++ g_signal_connect(pDocView, "edit-changed", G_CALLBACK(signalEdit), NULL); ++ g_signal_connect(pDocView, "command-changed", G_CALLBACK(signalCommand), NULL); ++ g_signal_connect(pDocView, "search-not-found", G_CALLBACK(signalSearch), NULL); ++ g_signal_connect(pDocView, "part-changed", G_CALLBACK(signalPart), NULL); ++ g_signal_connect(pDocView, "size-changed", G_CALLBACK(signalSize), NULL); ++ g_signal_connect(pDocView, "hyperlink-clicked", G_CALLBACK(signalHyperlink), NULL); ++ g_signal_connect(pDocView, "cursor-changed", G_CALLBACK(cursorChanged), NULL); ++} ++ + int main( int argc, char* argv[] ) + { + if( argc < 3 || +@@ -730,19 +745,8 @@ int main( int argc, char* argv[] ) + + gtk_init( &argc, &argv ); + +- // Docview +- GtkWidget* pDocView = lok_doc_view_new (argv[1], NULL, NULL); +-#if GLIB_CHECK_VERSION(2,40,0) +- g_assert_nonnull(pDocView); +-#endif +- g_signal_connect(pDocView, "edit-changed", G_CALLBACK(signalEdit), NULL); +- g_signal_connect(pDocView, "command-changed", G_CALLBACK(signalCommand), NULL); +- g_signal_connect(pDocView, "search-not-found", G_CALLBACK(signalSearch), NULL); +- g_signal_connect(pDocView, "part-changed", G_CALLBACK(signalPart), NULL); +- g_signal_connect(pDocView, "size-changed", G_CALLBACK(signalSize), NULL); +- g_signal_connect(pDocView, "hyperlink-clicked", G_CALLBACK(signalHyperlink), NULL); +- g_signal_connect(pDocView, "cursor-changed", G_CALLBACK(cursorChanged), NULL); +- ++ GtkWidget* pDocView = lok_doc_view_new(argv[1], NULL, NULL); ++ setupDocView(pDocView); + TiledWindow aWindow; + aWindow.m_pDocView = pDocView; + createWindow(aWindow); +-- +2.12.0 + diff --git a/SOURCES/0135-gtktiledviewer-set-up-a-new-GtkWindow-for-a-new-view.patch b/SOURCES/0135-gtktiledviewer-set-up-a-new-GtkWindow-for-a-new-view.patch new file mode 100644 index 0000000..2e3f193 --- /dev/null +++ b/SOURCES/0135-gtktiledviewer-set-up-a-new-GtkWindow-for-a-new-view.patch @@ -0,0 +1,43 @@ +From aa50f4ae737bd4428c8a104447dd0b3519a733a9 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 15 Sep 2015 15:22:53 +0200 +Subject: [PATCH 135/398] gtktiledviewer: set up a new GtkWindow for a new view + +Change-Id: I9dcb5871c231a49bcd65a1187df6c3c81f92bd55 +(cherry picked from commit c1d72145314be0e53d5f93e3b639715c9fbba8b0) +--- + libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 53bc5ea39615..e32397b133c9 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -77,6 +77,9 @@ public: + + static std::map g_aWindows; + ++static void setupDocView(GtkWidget* pDocView); ++static GtkWidget* createWindow(TiledWindow& rWindow); ++ + static TiledWindow& lcl_getTiledWindow(GtkWidget* pWidget) + { + GtkWidget* pToplevel = gtk_widget_get_toplevel(pWidget); +@@ -193,9 +196,11 @@ static void toggleFindbar(GtkWidget* pButton, gpointer /*pItem*/) + static void createView(GtkWidget* pButton, gpointer /*pItem*/) + { + TiledWindow& rWindow = lcl_getTiledWindow(pButton); +- LOKDocView* pLOKDocView = LOK_DOC_VIEW(rWindow.m_pDocView); +- LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(pLOKDocView); +- pDocument->pClass->createView(pDocument); ++ GtkWidget* pDocView = lok_doc_view_new_from_widget(LOK_DOC_VIEW(rWindow.m_pDocView)); ++ setupDocView(pDocView); ++ TiledWindow aWindow; ++ aWindow.m_pDocView = pDocView; ++ createWindow(aWindow); + } + + /// Our GtkClipboardGetFunc implementation for HTML. +-- +2.12.0 + diff --git a/SOURCES/0136-lokdocview-avoid-GTK-calls-in-openDocumentInThread.patch b/SOURCES/0136-lokdocview-avoid-GTK-calls-in-openDocumentInThread.patch new file mode 100644 index 0000000..e8fe0fc --- /dev/null +++ b/SOURCES/0136-lokdocview-avoid-GTK-calls-in-openDocumentInThread.patch @@ -0,0 +1,106 @@ +From 9ba754a4df93b5d92eb871c9e37e9430da563cdc Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 15 Sep 2015 15:36:51 +0200 +Subject: [PATCH 136/398] lokdocview: avoid GTK+ calls in + openDocumentInThread() + +GTK+ calls should be made from the main thread. + +Change-Id: Idcfa46d427d6e35fc544246a691bafc72f75a74c +(cherry picked from commit e6e5c248e52524ddaddc6d1a2627f10f169d0167) +--- + libreofficekit/source/gtk/lokdocview.cxx | 57 +++++++++++++++++++------------- + 1 file changed, 34 insertions(+), 23 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 3cce40a94217..0b0b5e9d9659 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -143,6 +143,7 @@ enum + static guint doc_view_signals[LAST_SIGNAL] = { 0 }; + + static void lok_doc_view_initable_iface_init (GInitableIface *iface); ++static void callbackWorker (int nType, const char* pPayload, void* pData); + + SAL_DLLPUBLIC_EXPORT GType lok_doc_view_get_type(); + #ifdef __GNUC__ +@@ -380,6 +381,37 @@ static gboolean queueDraw(gpointer pData) + return G_SOURCE_REMOVE; + } + ++/// Set up LOKDocView after the document is loaded, invoked on the main thread by openDocumentInThread() running in a thread. ++static gboolean postDocumentLoad(gpointer pData) ++{ ++ LOKDocView* pLOKDocView = static_cast(pData); ++ LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private(pLOKDocView)); ++ ++ priv->m_pDocument->pClass->initializeForRendering(priv->m_pDocument); ++ priv->m_pDocument->pClass->registerCallback(priv->m_pDocument, callbackWorker, pLOKDocView); ++ priv->m_pDocument->pClass->getDocumentSize(priv->m_pDocument, &priv->m_nDocumentWidthTwips, &priv->m_nDocumentHeightTwips); ++ g_timeout_add(600, handleTimeout, pLOKDocView); ++ ++ float zoom = priv->m_fZoom; ++ long nDocumentWidthTwips = priv->m_nDocumentWidthTwips; ++ long nDocumentHeightTwips = priv->m_nDocumentHeightTwips; ++ long nDocumentWidthPixels = twipToPixel(nDocumentWidthTwips, zoom); ++ long nDocumentHeightPixels = twipToPixel(nDocumentHeightTwips, zoom); ++ // Total number of columns in this document. ++ guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); ++ ++ ++ priv->m_aTileBuffer = TileBuffer(priv->m_pDocument, ++ nColumns); ++ gtk_widget_set_size_request(GTK_WIDGET(pLOKDocView), ++ nDocumentWidthPixels, ++ nDocumentHeightPixels); ++ gtk_widget_set_can_focus(GTK_WIDGET(pLOKDocView), TRUE); ++ gtk_widget_grab_focus(GTK_WIDGET(pLOKDocView)); ++ ++ return G_SOURCE_REMOVE; ++} ++ + /// Implementation of the global callback handler, invoked by globalCallback(); + static gboolean + globalCallback (gpointer pData) +@@ -617,8 +649,7 @@ callback (gpointer pData) + return G_SOURCE_REMOVE; + } + +-static void +-callbackWorker (int nType, const char* pPayload, void* pData) ++static void callbackWorker (int nType, const char* pPayload, void* pData) + { + LOKDocView* pDocView = LOK_DOC_VIEW (pData); + +@@ -1193,27 +1224,7 @@ openDocumentInThread (gpointer data) + } + else + { +- priv->m_pDocument->pClass->initializeForRendering(priv->m_pDocument); +- priv->m_pDocument->pClass->registerCallback(priv->m_pDocument, callbackWorker, pDocView); +- priv->m_pDocument->pClass->getDocumentSize(priv->m_pDocument, &priv->m_nDocumentWidthTwips, &priv->m_nDocumentHeightTwips); +- g_timeout_add(600, handleTimeout, pDocView); +- +- float zoom = priv->m_fZoom; +- long nDocumentWidthTwips = priv->m_nDocumentWidthTwips; +- long nDocumentHeightTwips = priv->m_nDocumentHeightTwips; +- long nDocumentWidthPixels = twipToPixel(nDocumentWidthTwips, zoom); +- long nDocumentHeightPixels = twipToPixel(nDocumentHeightTwips, zoom); +- // Total number of columns in this document. +- guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); +- +- +- priv->m_aTileBuffer = TileBuffer(priv->m_pDocument, +- nColumns); +- gtk_widget_set_size_request(GTK_WIDGET(pDocView), +- nDocumentWidthPixels, +- nDocumentHeightPixels); +- gtk_widget_set_can_focus(GTK_WIDGET(pDocView), TRUE); +- gtk_widget_grab_focus(GTK_WIDGET(pDocView)); ++ gdk_threads_add_idle(postDocumentLoad, pDocView); + g_task_return_boolean (task, true); + } + } +-- +2.12.0 + diff --git a/SOURCES/0137-lokdocview-set-up-the-widget-in-all-windows.patch b/SOURCES/0137-lokdocview-set-up-the-widget-in-all-windows.patch new file mode 100644 index 0000000..a837f8c --- /dev/null +++ b/SOURCES/0137-lokdocview-set-up-the-widget-in-all-windows.patch @@ -0,0 +1,39 @@ +From d439c2271500a145d4c6e37e3a8d504cc2027b5f Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 15 Sep 2015 15:41:46 +0200 +Subject: [PATCH 137/398] lokdocview: set up the widget in all windows + +With this finally the number of GTK+ windows always match the number +returned by SfxLokHelper::getViews(). + +Change-Id: Ia45bef7dea86b80cfac00e2ad7c1a16d7f5b507b +(cherry picked from commit b3498e9fcdc895853564d13173075bebc7407ef2) +--- + libreofficekit/source/gtk/lokdocview.cxx | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 0b0b5e9d9659..92095f2d9707 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -1850,8 +1850,15 @@ lok_doc_view_new (const gchar* pPath, GCancellable *cancellable, GError **error) + SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new_from_widget(LOKDocView* pLOKDocView) + { + LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private(pLOKDocView)); +- return GTK_WIDGET(g_initable_new(LOK_TYPE_DOC_VIEW, /*cancellable=*/0, /*error=*/0, +- "lopath", priv->m_aLOPath, "lopointer", priv->m_pOffice, "docpointer", priv->m_pDocument, NULL)); ++ GtkWidget* pDocView = GTK_WIDGET(g_initable_new(LOK_TYPE_DOC_VIEW, /*cancellable=*/0, /*error=*/0, ++ "lopath", priv->m_aLOPath, "lopointer", priv->m_pOffice, "docpointer", priv->m_pDocument, NULL)); ++ ++ // No documentLoad(), just a createView(). ++ LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(LOK_DOC_VIEW(pDocView)); ++ pDocument->pClass->createView(pDocument); ++ ++ postDocumentLoad(pDocView); ++ return pDocView; + } + + /** +-- +2.12.0 + diff --git a/SOURCES/0138-gtktiledviewer-add-setupWidgetAndCreateWindow-to-avo.patch b/SOURCES/0138-gtktiledviewer-add-setupWidgetAndCreateWindow-to-avo.patch new file mode 100644 index 0000000..f573ed5 --- /dev/null +++ b/SOURCES/0138-gtktiledviewer-add-setupWidgetAndCreateWindow-to-avo.patch @@ -0,0 +1,80 @@ +From b4dda1d4bda439d063493d2c6726071f54fc4c55 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Wed, 16 Sep 2015 09:22:17 +0200 +Subject: [PATCH 138/398] gtktiledviewer: add setupWidgetAndCreateWindow() to + avoid copy&paste + +Change-Id: Ibbbaaa1c148cfd4578ad37e0f99b62ab885a1a83 +(cherry picked from commit 855e1bac1d5155352706c7d849942f5dc453c67d) +--- + .../qa/gtktiledviewer/gtktiledviewer.cxx | 33 +++++++++++++++------- + 1 file changed, 23 insertions(+), 10 deletions(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index e32397b133c9..5a18aee50bf3 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -79,6 +79,7 @@ static std::map g_aWindows; + + static void setupDocView(GtkWidget* pDocView); + static GtkWidget* createWindow(TiledWindow& rWindow); ++static void openDocumentCallback (GObject* source_object, GAsyncResult* res, gpointer userdata); + + static TiledWindow& lcl_getTiledWindow(GtkWidget* pWidget) + { +@@ -192,17 +193,34 @@ static void toggleFindbar(GtkWidget* pButton, gpointer /*pItem*/) + } + } + +-/// Calls lok::Document::createView(). +-static void createView(GtkWidget* pButton, gpointer /*pItem*/) ++/// Common initialization, regardless if it's just a new view or a full init. ++static void setupWidgetAndCreateWindow(GtkWidget* pDocView) + { +- TiledWindow& rWindow = lcl_getTiledWindow(pButton); +- GtkWidget* pDocView = lok_doc_view_new_from_widget(LOK_DOC_VIEW(rWindow.m_pDocView)); + setupDocView(pDocView); + TiledWindow aWindow; + aWindow.m_pDocView = pDocView; + createWindow(aWindow); + } + ++/// Creates a new view, i.e. no LOK init or document load. ++static void createView(GtkWidget* pButton, gpointer /*pItem*/) ++{ ++ TiledWindow& rWindow = lcl_getTiledWindow(pButton); ++ GtkWidget* pDocView = lok_doc_view_new_from_widget(LOK_DOC_VIEW(rWindow.m_pDocView)); ++ ++ setupWidgetAndCreateWindow(pDocView); ++} ++ ++/// Creates a new model, i.e. LOK init and document load, one view implicitly. ++static void createModelAndView(const char* pLOPath, const char* pDocPath) ++{ ++ GtkWidget* pDocView = lok_doc_view_new(pLOPath, 0, 0); ++ ++ setupWidgetAndCreateWindow(pDocView); ++ ++ lok_doc_view_open_document(LOK_DOC_VIEW(pDocView), pDocPath, 0, openDocumentCallback, pDocView); ++} ++ + /// Our GtkClipboardGetFunc implementation for HTML. + static void htmlGetFunc(GtkClipboard* /*pClipboard*/, GtkSelectionData* pSelectionData, guint /*info*/, gpointer pUserData) + { +@@ -750,12 +768,7 @@ int main( int argc, char* argv[] ) + + gtk_init( &argc, &argv ); + +- GtkWidget* pDocView = lok_doc_view_new(argv[1], NULL, NULL); +- setupDocView(pDocView); +- TiledWindow aWindow; +- aWindow.m_pDocView = pDocView; +- createWindow(aWindow); +- lok_doc_view_open_document(LOK_DOC_VIEW(pDocView), argv[2], NULL, openDocumentCallback, pDocView); ++ createModelAndView(argv[1], argv[2]); + + gtk_main(); + +-- +2.12.0 + diff --git a/SOURCES/0139-lok-Document-add-get-setView.patch b/SOURCES/0139-lok-Document-add-get-setView.patch new file mode 100644 index 0000000..0e3c9a9 --- /dev/null +++ b/SOURCES/0139-lok-Document-add-get-setView.patch @@ -0,0 +1,181 @@ +From 27ebd2b9c14a691889e6c7332024feab7c723d49 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Wed, 16 Sep 2015 09:30:41 +0200 +Subject: [PATCH 139/398] lok::Document: add get/setView() + +Change-Id: Ic3bce8f01d7e048e853c063c4bce1255845c60d0 +(cherry picked from commit 46588c42a546d4517b773853856b9c8f8c2e5ece) +--- + desktop/qa/desktop_lib/test_desktop_lib.cxx | 6 ++++++ + desktop/source/lib/init.cxx | 18 ++++++++++++++++++ + include/LibreOfficeKit/LibreOfficeKit.h | 4 ++++ + include/LibreOfficeKit/LibreOfficeKit.hxx | 20 +++++++++++++++++++- + include/sfx2/lokhelper.hxx | 4 ++++ + sfx2/source/view/lokhelper.cxx | 24 ++++++++++++++++++++++++ + 6 files changed, 75 insertions(+), 1 deletion(-) + +diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx +index 6baaa32239c9..7ad81278d64a 100644 +--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx ++++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx +@@ -139,6 +139,12 @@ void DesktopLOKTest::testCreateView() + int nId = pDocument->m_pDocumentClass->createView(pDocument); + CPPUNIT_ASSERT_EQUAL(2, SfxLokHelper::getViews()); + ++ // Make sure the created view is the active one, then switch to the old ++ // one. ++ CPPUNIT_ASSERT_EQUAL(1, pDocument->m_pDocumentClass->getView(pDocument)); ++ pDocument->m_pDocumentClass->setView(pDocument, 0); ++ CPPUNIT_ASSERT_EQUAL(0, pDocument->m_pDocumentClass->getView(pDocument)); ++ + pDocument->m_pDocumentClass->destroyView(pDocument, nId); + CPPUNIT_ASSERT_EQUAL(1, SfxLokHelper::getViews()); + closeDoc(); +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 3b1286e5944d..d76de5e5bb3c 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -252,6 +252,8 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo + + static int doc_createView(LibreOfficeKitDocument* pThis); + static void doc_destroyView(LibreOfficeKitDocument* pThis, int nId); ++static void doc_setView(LibreOfficeKitDocument* pThis, int nId); ++static int doc_getView(LibreOfficeKitDocument* pThis); + + LibLODocument_Impl::LibLODocument_Impl(const uno::Reference &xComponent) : + mxComponent( xComponent ) +@@ -285,6 +287,8 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference createView = doc_createView; + m_pDocumentClass->destroyView = doc_destroyView; ++ m_pDocumentClass->setView = doc_setView; ++ m_pDocumentClass->getView = doc_getView; + + gDocumentClass = m_pDocumentClass; + } +@@ -1067,6 +1071,20 @@ static void doc_destroyView(LibreOfficeKitDocument* /*pThis*/, int nId) + SfxLokHelper::destroyView(nId); + } + ++static void doc_setView(LibreOfficeKitDocument* /*pThis*/, int nId) ++{ ++ SolarMutexGuard aGuard; ++ ++ SfxLokHelper::setView(nId); ++} ++ ++static int doc_getView(LibreOfficeKitDocument* /*pThis*/) ++{ ++ SolarMutexGuard aGuard; ++ ++ return SfxLokHelper::getView(); ++} ++ + static char* lo_getError (LibreOfficeKit *pThis) + { + LibLibreOffice_Impl* pLib = static_cast(pThis); +diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h +index 7f41d13ff393..18f4b3edc624 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.h ++++ b/include/LibreOfficeKit/LibreOfficeKit.h +@@ -170,6 +170,10 @@ struct _LibreOfficeKitDocumentClass + int (*createView) (LibreOfficeKitDocument* pThis); + /// @see lok::Document::destroyView(). + void (*destroyView) (LibreOfficeKitDocument* pThis, int nId); ++ /// @see lok::Document::setView(). ++ void (*setView) (LibreOfficeKitDocument* pThis, int nId); ++ /// @see lok::Document::getView(). ++ int (*getView) (LibreOfficeKitDocument* pThis); + #endif // LOK_USE_UNSTABLE_API + }; + +diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx +index 3e1a0ac20b07..f5821b71191a 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.hxx ++++ b/include/LibreOfficeKit/LibreOfficeKit.hxx +@@ -269,13 +269,31 @@ public: + } + + /** +- * Destroy a view of an existring document. ++ * Destroy a view of an existing document. + * @param nId a view ID, returned by createView(). + */ + void destroyView(int nId) + { + mpDoc->pClass->destroyView(mpDoc, nId); + } ++ ++ /** ++ * Set an existing view of an existing document as current. ++ * @param nId a view ID, returned by createView(). ++ */ ++ void setView(int nId) ++ { ++ mpDoc->pClass->setView(mpDoc, nId); ++ } ++ ++ /** ++ * Get the current view. ++ * @return a view ID, previously returned by createView(). ++ */ ++ int getView() ++ { ++ return mpDoc->pClass->getView(mpDoc); ++ } + #endif // LOK_USE_UNSTABLE_API + }; + +diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx +index b57cb7d75b23..a05cd5d4b210 100644 +--- a/include/sfx2/lokhelper.hxx ++++ b/include/sfx2/lokhelper.hxx +@@ -21,6 +21,10 @@ public: + static int createView(SfxViewShell* pViewShell); + /// Destroy a view shell from the global shell list. + static void destroyView(size_t nId); ++ /// Set a view shell as current one. ++ static void setView(size_t nId); ++ /// Get the currently active view. ++ static size_t getView(); + + /// Total number of view shells. + static int getViews(); +diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx +index 557478a78ae6..0aea6db9c24e 100644 +--- a/sfx2/source/view/lokhelper.cxx ++++ b/sfx2/source/view/lokhelper.cxx +@@ -38,6 +38,30 @@ void SfxLokHelper::destroyView(size_t nId) + pViewFrame->Exec_Impl(aRequest); + } + ++void SfxLokHelper::setView(size_t nId) ++{ ++ SfxViewShellArr_Impl& rViewArr = SfxGetpApp()->GetViewShells_Impl(); ++ if (nId > rViewArr.size() - 1) ++ return; ++ ++ SfxViewShell* pViewShell = rViewArr[nId]; ++ if (SfxViewFrame* pViewFrame = pViewShell->GetViewFrame()) ++ pViewFrame->GetWindow().GrabFocus(); ++} ++ ++size_t SfxLokHelper::getView() ++{ ++ SfxViewShellArr_Impl& rViewArr = SfxGetpApp()->GetViewShells_Impl(); ++ SfxViewFrame* pViewFrame = SfxViewFrame::Current(); ++ for (size_t i = 0; i < rViewArr.size(); ++i) ++ { ++ if (rViewArr[i]->GetViewFrame() == pViewFrame) ++ return i; ++ } ++ assert(false); ++ return 0; ++} ++ + int SfxLokHelper::getViews() + { + SfxViewShellArr_Impl& rViewArr = SfxGetpApp()->GetViewShells_Impl(); +-- +2.12.0 + diff --git a/SOURCES/0140-Use-SfxViewFrame-Current.patch b/SOURCES/0140-Use-SfxViewFrame-Current.patch new file mode 100644 index 0000000..7a22647 --- /dev/null +++ b/SOURCES/0140-Use-SfxViewFrame-Current.patch @@ -0,0 +1,134 @@ +From b2d1dd0d6c4368909b90733aed41d5dc26113c00 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Wed, 16 Sep 2015 10:32:34 +0200 +Subject: [PATCH 140/398] Use SfxViewFrame::Current() + +Allows getting rid of vcl::ITiledRenderable::getCurrentViewShell(), +which would do the same, just not implemented outside Writer. + +Change-Id: Id26ceca560fb9002dc2d5c740c411b9c4a149523 +(cherry picked from commit 8cb6094447041b7fbe29bd5584b5daf9babb5cad) +--- + desktop/source/lib/init.cxx | 12 ++---------- + include/sfx2/lokhelper.hxx | 4 ++-- + include/vcl/ITiledRenderable.hxx | 8 -------- + sfx2/source/view/lokhelper.cxx | 4 ++-- + sw/inc/unotxdoc.hxx | 2 -- + sw/source/uibase/uno/unotxdoc.cxx | 5 ----- + 6 files changed, 6 insertions(+), 29 deletions(-) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index d76de5e5bb3c..fa99038860cd 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -1049,19 +1049,11 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo + } + } + +-static int doc_createView(LibreOfficeKitDocument* pThis) ++static int doc_createView(LibreOfficeKitDocument* /*pThis*/) + { + SolarMutexGuard aGuard; + +- ITiledRenderable* pDoc = getTiledRenderable(pThis); +- if (!pDoc) +- { +- gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering"; +- return -1; +- } +- +- SfxViewShell* pViewShell = pDoc->getCurrentViewShell(); +- return SfxLokHelper::createView(pViewShell); ++ return SfxLokHelper::createView(); + } + + static void doc_destroyView(LibreOfficeKitDocument* /*pThis*/, int nId) +diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx +index a05cd5d4b210..50516227e992 100644 +--- a/include/sfx2/lokhelper.hxx ++++ b/include/sfx2/lokhelper.hxx +@@ -17,8 +17,8 @@ class SfxViewShell; + class SFX2_DLLPUBLIC SfxLokHelper + { + public: +- /// Create a new view shell for pViewShell's object shell. +- static int createView(SfxViewShell* pViewShell); ++ /// Create a new view shell from the current view frame. ++ static int createView(); + /// Destroy a view shell from the global shell list. + static void destroyView(size_t nId); + /// Set a view shell as current one. +diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx +index a31d808437af..6639745e4a2f 100644 +--- a/include/vcl/ITiledRenderable.hxx ++++ b/include/vcl/ITiledRenderable.hxx +@@ -16,8 +16,6 @@ + #include + #include + +-class SfxViewShell; +- + namespace vcl + { + +@@ -141,12 +139,6 @@ public: + * @see lok::Document::resetSelection(). + */ + virtual void resetSelection() = 0; +- +- /// Get the currently active view shell of the document. +- virtual SfxViewShell* getCurrentViewShell() +- { +- return 0; +- } + }; + + } // namespace vcl +diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx +index 0aea6db9c24e..f53d2b35b1bd 100644 +--- a/sfx2/source/view/lokhelper.cxx ++++ b/sfx2/source/view/lokhelper.cxx +@@ -15,9 +15,9 @@ + + #include + +-int SfxLokHelper::createView(SfxViewShell* pViewShell) ++int SfxLokHelper::createView() + { +- SfxViewFrame* pViewFrame = pViewShell->GetViewFrame(); ++ SfxViewFrame* pViewFrame = SfxViewFrame::Current(); + SfxRequest aRequest(pViewFrame, SID_NEWWINDOW); + pViewFrame->ExecView_Impl(aRequest); + +diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx +index 71dbb4f2fd5a..9f0b03b3af38 100644 +--- a/sw/inc/unotxdoc.hxx ++++ b/sw/inc/unotxdoc.hxx +@@ -431,8 +431,6 @@ public: + virtual void setGraphicSelection(int nType, int nX, int nY) SAL_OVERRIDE; + /// @see vcl::ITiledRenderable::resetSelection(). + virtual void resetSelection() SAL_OVERRIDE; +- /// @see vcl::ITiledRenderable::getCurrentViewShell(). +- virtual SfxViewShell* getCurrentViewShell() SAL_OVERRIDE; + + // ::com::sun::star::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 ) throw (::css::uno::RuntimeException, ::std::exception) SAL_OVERRIDE; +diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx +index 8dce9b5589d6..d6315d2964ae 100644 +--- a/sw/source/uibase/uno/unotxdoc.cxx ++++ b/sw/source/uibase/uno/unotxdoc.cxx +@@ -3410,11 +3410,6 @@ void SwXTextDocument::resetSelection() + pWrtShell->ResetSelect(0, false); + } + +-SfxViewShell* SwXTextDocument::getCurrentViewShell() +-{ +- return pDocShell->GetView(); +-} +- + void SAL_CALL SwXTextDocument::paintTile( const ::css::uno::Any& Parent, ::sal_Int32 nOutputWidth, ::sal_Int32 nOutputHeight, ::sal_Int32 nTilePosX, ::sal_Int32 nTilePosY, ::sal_Int32 nTileWidth, ::sal_Int32 nTileHeight ) throw (::css::uno::RuntimeException, ::std::exception) + { + SystemGraphicsData aData; +-- +2.12.0 + diff --git a/SOURCES/0141-gtktiledviewer-use-setView-before-postKeyEvent.patch b/SOURCES/0141-gtktiledviewer-use-setView-before-postKeyEvent.patch new file mode 100644 index 0000000..3991633 --- /dev/null +++ b/SOURCES/0141-gtktiledviewer-use-setView-before-postKeyEvent.patch @@ -0,0 +1,84 @@ +From 3206f71ad36da6453801b4e3105f9968944f1aec Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Wed, 16 Sep 2015 12:30:25 +0200 +Subject: [PATCH 141/398] gtktiledviewer: use setView() before postKeyEvent() + +Also in SfxLokHelper::setView() set the current view shell directly, +GetFocus() in VCL may be a NOP for hidden windows. + +With this, the Writer layout dump shows that two Gtk windows can have +different cursor positions correctly. + +Change-Id: I81890c1d8ad7972f1194db3d5f2e9d8a39fc2f87 +(cherry picked from commit f2e55ea10676d14c6564696a0648c0edbe4bd36d) +--- + libreofficekit/source/gtk/lokdocview.cxx | 21 +++++++++++++-------- + sfx2/source/view/lokhelper.cxx | 2 +- + 2 files changed, 14 insertions(+), 9 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 92095f2d9707..e84939e0da46 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -106,6 +106,9 @@ struct _LOKDocViewPrivate + /// If we are in the middle of a drag of a graphic selection handle. + gboolean m_bInDragGraphicHandles[8]; + ///@} ++ ++ /// View ID, returned by createView() or 0 by default. ++ int m_nViewId; + }; + + enum +@@ -240,6 +243,7 @@ postKeyEventInThread(gpointer data) + LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); + LOEvent* pLOEvent = static_cast(g_task_get_task_data(task)); + ++ priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId); + priv->m_pDocument->pClass->postKeyEvent(priv->m_pDocument, + pLOEvent->m_nKeyEvent, + pLOEvent->m_nCharCode, +@@ -1847,18 +1851,19 @@ lok_doc_view_new (const gchar* pPath, GCancellable *cancellable, GError **error) + return GTK_WIDGET (g_initable_new (LOK_TYPE_DOC_VIEW, cancellable, error, "lopath", pPath, NULL)); + } + +-SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new_from_widget(LOKDocView* pLOKDocView) ++SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new_from_widget(LOKDocView* pOldLOKDocView) + { +- LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private(pLOKDocView)); +- GtkWidget* pDocView = GTK_WIDGET(g_initable_new(LOK_TYPE_DOC_VIEW, /*cancellable=*/0, /*error=*/0, +- "lopath", priv->m_aLOPath, "lopointer", priv->m_pOffice, "docpointer", priv->m_pDocument, NULL)); ++ LOKDocViewPrivate* pOldPriv = static_cast(lok_doc_view_get_instance_private(pOldLOKDocView)); ++ GtkWidget* pNewDocView = GTK_WIDGET(g_initable_new(LOK_TYPE_DOC_VIEW, /*cancellable=*/0, /*error=*/0, ++ "lopath", pOldPriv->m_aLOPath, "lopointer", pOldPriv->m_pOffice, "docpointer", pOldPriv->m_pDocument, NULL)); + + // No documentLoad(), just a createView(). +- LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(LOK_DOC_VIEW(pDocView)); +- pDocument->pClass->createView(pDocument); ++ LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(LOK_DOC_VIEW(pNewDocView)); ++ LOKDocViewPrivate* pNewPriv = static_cast(lok_doc_view_get_instance_private(LOK_DOC_VIEW(pNewDocView))); ++ pNewPriv->m_nViewId = pDocument->pClass->createView(pDocument); + +- postDocumentLoad(pDocView); +- return pDocView; ++ postDocumentLoad(pNewDocView); ++ return pNewDocView; + } + + /** +diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx +index f53d2b35b1bd..0beb06ddd956 100644 +--- a/sfx2/source/view/lokhelper.cxx ++++ b/sfx2/source/view/lokhelper.cxx +@@ -46,7 +46,7 @@ void SfxLokHelper::setView(size_t nId) + + SfxViewShell* pViewShell = rViewArr[nId]; + if (SfxViewFrame* pViewFrame = pViewShell->GetViewFrame()) +- pViewFrame->GetWindow().GrabFocus(); ++ pViewFrame->MakeActive_Impl(false); + } + + size_t SfxLokHelper::getView() +-- +2.12.0 + diff --git a/SOURCES/0142-LOK-make-getViews-be-a-member-function-of-Document.patch b/SOURCES/0142-LOK-make-getViews-be-a-member-function-of-Document.patch new file mode 100644 index 0000000..1720b80 --- /dev/null +++ b/SOURCES/0142-LOK-make-getViews-be-a-member-function-of-Document.patch @@ -0,0 +1,215 @@ +From da8b89db49d0dfcef0ae0052bb8ab9d77a509dfb Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Wed, 16 Sep 2015 14:14:04 +0200 +Subject: [PATCH 142/398] LOK: make getViews() be a member function of Document + +Just to be consistent, as all other view-related member functions are +there, too. + +No real impact, as only the unit test uses this so far, and it always +works with a single document. + +Change-Id: I46f1ed8265ab95017986ab45c1b510e961192241 +(cherry picked from commit a04b31c9facb08a8e38b79480b9a73bd2693cb9e) +--- + desktop/qa/desktop_lib/test_desktop_lib.cxx | 6 +++--- + desktop/source/lib/init.cxx | 17 +++++++++-------- + include/LibreOfficeKit/LibreOfficeKit.h | 5 ++--- + include/LibreOfficeKit/LibreOfficeKit.hxx | 18 ++++++++---------- + include/sfx2/lokhelper.hxx | 5 ++--- + sfx2/source/view/lokhelper.cxx | 13 +++++++++++-- + 6 files changed, 35 insertions(+), 29 deletions(-) + +diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx +index 7ad81278d64a..0cd88cefffa0 100644 +--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx ++++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx +@@ -134,10 +134,10 @@ void DesktopLOKTest::testGetFonts() + void DesktopLOKTest::testCreateView() + { + LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); +- CPPUNIT_ASSERT_EQUAL(1, SfxLokHelper::getViews()); ++ CPPUNIT_ASSERT_EQUAL(1, pDocument->m_pDocumentClass->getViews(pDocument)); + + int nId = pDocument->m_pDocumentClass->createView(pDocument); +- CPPUNIT_ASSERT_EQUAL(2, SfxLokHelper::getViews()); ++ CPPUNIT_ASSERT_EQUAL(2, pDocument->m_pDocumentClass->getViews(pDocument)); + + // Make sure the created view is the active one, then switch to the old + // one. +@@ -146,7 +146,7 @@ void DesktopLOKTest::testCreateView() + CPPUNIT_ASSERT_EQUAL(0, pDocument->m_pDocumentClass->getView(pDocument)); + + pDocument->m_pDocumentClass->destroyView(pDocument, nId); +- CPPUNIT_ASSERT_EQUAL(1, SfxLokHelper::getViews()); ++ CPPUNIT_ASSERT_EQUAL(1, pDocument->m_pDocumentClass->getViews(pDocument)); + closeDoc(); + } + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index fa99038860cd..617c94638cde 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -254,6 +254,7 @@ static int doc_createView(LibreOfficeKitDocument* pThis); + static void doc_destroyView(LibreOfficeKitDocument* pThis, int nId); + static void doc_setView(LibreOfficeKitDocument* pThis, int nId); + static int doc_getView(LibreOfficeKitDocument* pThis); ++static int doc_getViews(LibreOfficeKitDocument* pThis); + + LibLODocument_Impl::LibLODocument_Impl(const uno::Reference &xComponent) : + mxComponent( xComponent ) +@@ -289,6 +290,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference destroyView = doc_destroyView; + m_pDocumentClass->setView = doc_setView; + m_pDocumentClass->getView = doc_getView; ++ m_pDocumentClass->getViews = doc_getViews; + + gDocumentClass = m_pDocumentClass; + } +@@ -316,8 +318,6 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions (LibreOfficeKit* pThi + static void lo_registerCallback (LibreOfficeKit* pThis, + LibreOfficeKitCallback pCallback, + void* pData); +-static int lo_getViews(LibreOfficeKit* pThis); +- + struct LibLibreOffice_Impl : public _LibreOfficeKit + { + OUString maLastExceptionMsg; +@@ -340,7 +340,6 @@ struct LibLibreOffice_Impl : public _LibreOfficeKit + m_pOfficeClass->getError = lo_getError; + m_pOfficeClass->documentLoadWithOptions = lo_documentLoadWithOptions; + m_pOfficeClass->registerCallback = lo_registerCallback; +- m_pOfficeClass->getViews = lo_getViews; + + gOfficeClass = m_pOfficeClass; + } +@@ -458,11 +457,6 @@ static void lo_registerCallback (LibreOfficeKit* pThis, + pLib->mpCallbackData = pData; + } + +-static int lo_getViews(LibreOfficeKit* /*pThis*/) +-{ +- return SfxLokHelper::getViews(); +-} +- + static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const char* pFormat, const char* pFilterOptions) + { + LibLODocument_Impl* pDocument = static_cast(pThis); +@@ -1077,6 +1071,13 @@ static int doc_getView(LibreOfficeKitDocument* /*pThis*/) + return SfxLokHelper::getView(); + } + ++static int doc_getViews(LibreOfficeKitDocument* /*pThis*/) ++{ ++ SolarMutexGuard aGuard; ++ ++ return SfxLokHelper::getViews(); ++} ++ + static char* lo_getError (LibreOfficeKit *pThis) + { + LibLibreOffice_Impl* pLib = static_cast(pThis); +diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h +index 18f4b3edc624..fc025aed5b15 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.h ++++ b/include/LibreOfficeKit/LibreOfficeKit.h +@@ -54,9 +54,6 @@ struct _LibreOfficeKitClass + void (*registerCallback) (LibreOfficeKit* pThis, + LibreOfficeKitCallback pCallback, + void* pData); +- +- /// @see lok::Office::getViews(). +- int (*getViews) (LibreOfficeKit* pThis); + #endif + }; + +@@ -174,6 +171,8 @@ struct _LibreOfficeKitDocumentClass + void (*setView) (LibreOfficeKitDocument* pThis, int nId); + /// @see lok::Document::getView(). + int (*getView) (LibreOfficeKitDocument* pThis); ++ /// @see lok::Document::getViews(). ++ int (*getViews) (LibreOfficeKitDocument* pThis); + #endif // LOK_USE_UNSTABLE_API + }; + +diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx +index f5821b71191a..45ace9dfff04 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.hxx ++++ b/include/LibreOfficeKit/LibreOfficeKit.hxx +@@ -294,6 +294,14 @@ public: + { + return mpDoc->pClass->getView(mpDoc); + } ++ ++ /** ++ * Get number of views of this document. ++ */ ++ inline int getViews() ++ { ++ return mpDoc->pClass->getViews(mpDoc); ++ } + #endif // LOK_USE_UNSTABLE_API + }; + +@@ -340,16 +348,6 @@ public: + { + return mpThis->pClass->getError(mpThis); + } +- +-#ifdef LOK_USE_UNSTABLE_API +- /** +- * Get number of total views. +- */ +- inline int getViews() +- { +- return mpThis->pClass->getViews(mpThis); +- } +-#endif + }; + + /// Factory method to create a lok::Office instance. +diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx +index 50516227e992..99f2076eeea1 100644 +--- a/include/sfx2/lokhelper.hxx ++++ b/include/sfx2/lokhelper.hxx +@@ -25,9 +25,8 @@ public: + static void setView(size_t nId); + /// Get the currently active view. + static size_t getView(); +- +- /// Total number of view shells. +- static int getViews(); ++ /// Get the number of views of the current object shell. ++ static size_t getViews(); + }; + + #endif +diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx +index 0beb06ddd956..646715ef226f 100644 +--- a/sfx2/source/view/lokhelper.cxx ++++ b/sfx2/source/view/lokhelper.cxx +@@ -62,10 +62,19 @@ size_t SfxLokHelper::getView() + return 0; + } + +-int SfxLokHelper::getViews() ++size_t SfxLokHelper::getViews() + { ++ size_t nRet = 0; ++ ++ SfxObjectShell* pObjectShell = SfxViewFrame::Current()->GetObjectShell(); + SfxViewShellArr_Impl& rViewArr = SfxGetpApp()->GetViewShells_Impl(); +- return rViewArr.size(); ++ for (size_t i = 0; i < rViewArr.size(); ++i) ++ { ++ if (rViewArr[i]->GetObjectShell() == pObjectShell) ++ ++nRet; ++ } ++ ++ return nRet; + } + + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +-- +2.12.0 + diff --git a/SOURCES/0143-LOK-allow-postMouseEvent-in-multiple-views.patch b/SOURCES/0143-LOK-allow-postMouseEvent-in-multiple-views.patch new file mode 100644 index 0000000..887bb31 --- /dev/null +++ b/SOURCES/0143-LOK-allow-postMouseEvent-in-multiple-views.patch @@ -0,0 +1,26 @@ +From 265831262dd2ea9b99f2723619f691005da16939 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Wed, 16 Sep 2015 14:28:00 +0200 +Subject: [PATCH 143/398] LOK: allow postMouseEvent() in multiple views + +Change-Id: Iafb08cb44a96dbc03d12367d21b4120063bd0222 +(cherry picked from commit c9ebc92a1ebd48ad96ee5ca527c250489cb4ec27) +--- + libreofficekit/source/gtk/lokdocview.cxx | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index e84939e0da46..366f39efd3ac 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -1197,6 +1197,7 @@ postMouseEventInThread(gpointer data) + LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); + LOEvent* pLOEvent = static_cast(g_task_get_task_data(task)); + ++ priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId); + priv->m_pDocument->pClass->postMouseEvent(priv->m_pDocument, + pLOEvent->m_nPostMouseEventType, + pLOEvent->m_nPostMouseEventX, +-- +2.12.0 + diff --git a/SOURCES/0144-Add-missing-lok-Document-setPartMode-wrapper.patch b/SOURCES/0144-Add-missing-lok-Document-setPartMode-wrapper.patch new file mode 100644 index 0000000..dff1004 --- /dev/null +++ b/SOURCES/0144-Add-missing-lok-Document-setPartMode-wrapper.patch @@ -0,0 +1,55 @@ +From 343e89c588aea46d122299b660ebcb8ec7213468 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Wed, 16 Sep 2015 14:31:49 +0200 +Subject: [PATCH 144/398] Add missing lok::Document::setPartMode() wrapper + +Change-Id: I5dd5f0cfb8b34621b18a35be682249e042d9b173 +(cherry picked from commit 42844c2a8b614efa3bb7cd4f2525ce05a8647d20) +--- + include/LibreOfficeKit/LibreOfficeKit.h | 6 ++---- + include/LibreOfficeKit/LibreOfficeKit.hxx | 5 +++++ + 2 files changed, 7 insertions(+), 4 deletions(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h +index fc025aed5b15..97ae1363a136 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.h ++++ b/include/LibreOfficeKit/LibreOfficeKit.h +@@ -93,10 +93,7 @@ struct _LibreOfficeKitDocumentClass + char* (*getPartName) (LibreOfficeKitDocument* pThis, + int nPart); + +- /** Sets mode of the current part. +- * +- * @param nMode - element from the LibreOfficeKitPartMode enum. +- */ ++ /// @see lok::Document::setPartMode(). + void (*setPartMode) (LibreOfficeKitDocument* pThis, + int nMode); + +@@ -118,6 +115,7 @@ struct _LibreOfficeKitDocumentClass + /// @see lok::Document::initializeForRendering(). + void (*initializeForRendering) (LibreOfficeKitDocument* pThis); + ++ /// @see lok::Document::registerCallback(). + void (*registerCallback) (LibreOfficeKitDocument* pThis, + LibreOfficeKitCallback pCallback, + void* pData); +diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx +index 45ace9dfff04..7f96e194e56c 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.hxx ++++ b/include/LibreOfficeKit/LibreOfficeKit.hxx +@@ -94,6 +94,11 @@ public: + return mpDoc->pClass->getPartName(mpDoc, nPart); + } + ++ inline void setPartMode(int nMode) ++ { ++ mpDoc->pClass->setPartMode(mpDoc, nMode); ++ } ++ + /** + * Renders a subset of the document to a pre-allocated buffer. + * +-- +2.12.0 + diff --git a/SOURCES/0145-lokdocview-set-view-before-calling-lok-Document-memb.patch b/SOURCES/0145-lokdocview-set-view-before-calling-lok-Document-memb.patch new file mode 100644 index 0000000..76cc9e7 --- /dev/null +++ b/SOURCES/0145-lokdocview-set-view-before-calling-lok-Document-memb.patch @@ -0,0 +1,124 @@ +From 4cd8df4c0d923f5497ce8b860ed0eac64406cf9a Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Wed, 16 Sep 2015 14:46:39 +0200 +Subject: [PATCH 145/398] lokdocview: set view before calling lok::Document + member functions + +getTextSelection() is still to be done, but has to be moved to the +widget first. + +Change-Id: I780a31f1dbce38b2b7398bfdacbbc1c40881229d +(cherry picked from commit d3446bc860e2e41adbee5ad6c49f12991dd9087b) +--- + include/LibreOfficeKit/LibreOfficeKit.h | 2 +- + libreofficekit/source/gtk/lokdocview.cxx | 11 +++++++++++ + 2 files changed, 12 insertions(+), 1 deletion(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h +index 97ae1363a136..4c3e1fa851d4 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.h ++++ b/include/LibreOfficeKit/LibreOfficeKit.h +@@ -158,7 +158,7 @@ struct _LibreOfficeKitDocumentClass + /// @see lok::Document::resetSelection + void (*resetSelection) (LibreOfficeKitDocument* pThis); + +- /// @see lok::Document:getStyles ++ /// @see lok::Document::getCommandValues(). + char* (*getCommandValues) (LibreOfficeKitDocument* pThis, const char* pCommand); + + /// @see lok::Document::createView(). +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 366f39efd3ac..f8202c339587 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -391,6 +391,7 @@ static gboolean postDocumentLoad(gpointer pData) + LOKDocView* pLOKDocView = static_cast(pData); + LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private(pLOKDocView)); + ++ priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId); + priv->m_pDocument->pClass->initializeForRendering(priv->m_pDocument); + priv->m_pDocument->pClass->registerCallback(priv->m_pDocument, callbackWorker, pLOKDocView); + priv->m_pDocument->pClass->getDocumentSize(priv->m_pDocument, &priv->m_nDocumentWidthTwips, &priv->m_nDocumentHeightTwips); +@@ -1101,6 +1102,7 @@ lok_doc_view_signal_motion (GtkWidget* pWidget, GdkEventMotion* pEvent) + LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); + GdkPoint aPoint; + ++ priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId); + if (priv->m_bInDragMiddleHandle) + { + g_info("lcl_signalMotion: dragging the middle handle"); +@@ -1183,6 +1185,7 @@ setGraphicSelectionInThread(gpointer data) + LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); + LOEvent* pLOEvent = static_cast(g_task_get_task_data(task)); + ++ priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId); + priv->m_pDocument->pClass->setGraphicSelection(priv->m_pDocument, + pLOEvent->m_nSetGraphicSelectionType, + pLOEvent->m_nSetGraphicSelectionX, +@@ -1243,6 +1246,7 @@ setPartInThread(gpointer data) + LOEvent* pLOEvent = static_cast(g_task_get_task_data(task)); + int nPart = pLOEvent->m_nPart; + ++ priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId); + priv->m_pDocument->pClass->setPart( priv->m_pDocument, nPart ); + } + +@@ -1255,6 +1259,7 @@ setPartmodeInThread(gpointer data) + LOEvent* pLOEvent = static_cast(g_task_get_task_data(task)); + int nPartMode = pLOEvent->m_nPartMode; + ++ priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId); + priv->m_pDocument->pClass->setPartMode( priv->m_pDocument, nPartMode ); + } + +@@ -1273,6 +1278,7 @@ setEditInThread(gpointer data) + else if (priv->m_bEdit && !bEdit) + { + g_info("lok_doc_view_set_edit: leaving edit mode"); ++ priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId); + priv->m_pDocument->pClass->resetSelection(priv->m_pDocument); + } + priv->m_bEdit = bEdit; +@@ -1288,6 +1294,7 @@ postCommandInThread (gpointer data) + LOEvent* pLOEvent = static_cast(g_task_get_task_data(task)); + LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); + ++ priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId); + priv->m_pDocument->pClass->postUnoCommand(priv->m_pDocument, pLOEvent->m_pCommand, pLOEvent->m_pArguments); + } + +@@ -1316,6 +1323,7 @@ paintTileInThread (gpointer data) + aTileRectangle.x = pixelToTwip(nTileSizePixels, pLOEvent->m_fPaintTileZoom) * pLOEvent->m_nPaintTileY; + aTileRectangle.y = pixelToTwip(nTileSizePixels, pLOEvent->m_fPaintTileZoom) * pLOEvent->m_nPaintTileX; + ++ priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId); + g_test_timer_start(); + priv->m_pDocument->pClass->paintTile(priv->m_pDocument, + pBuffer, +@@ -1974,6 +1982,7 @@ SAL_DLLPUBLIC_EXPORT int + lok_doc_view_get_parts (LOKDocView* pDocView) + { + LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId); + return priv->m_pDocument->pClass->getParts( priv->m_pDocument ); + } + +@@ -1981,6 +1990,7 @@ SAL_DLLPUBLIC_EXPORT int + lok_doc_view_get_part (LOKDocView* pDocView) + { + LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId); + return priv->m_pDocument->pClass->getPart( priv->m_pDocument ); + } + +@@ -2002,6 +2012,7 @@ SAL_DLLPUBLIC_EXPORT char* + lok_doc_view_get_part_name (LOKDocView* pDocView, int nPart) + { + LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId); + return priv->m_pDocument->pClass->getPartName( priv->m_pDocument, nPart ); + } + +-- +2.12.0 + diff --git a/SOURCES/0146-SfxLokHelper-setView-check-if-view-is-already-curren.patch b/SOURCES/0146-SfxLokHelper-setView-check-if-view-is-already-curren.patch new file mode 100644 index 0000000..672ffb8 --- /dev/null +++ b/SOURCES/0146-SfxLokHelper-setView-check-if-view-is-already-curren.patch @@ -0,0 +1,29 @@ +From 5edb280c093842d9d131f9cb7b404403d605a4dc Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Thu, 17 Sep 2015 09:30:09 +0200 +Subject: [PATCH 146/398] SfxLokHelper::setView: check if view is already + current + +Change-Id: I9cf3a4887774657e0e205114688b088fc11c6822 +(cherry picked from commit 714257af17f74f8bcb5acceaebb0d0f4b3be3231) +--- + sfx2/source/view/lokhelper.cxx | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx +index 646715ef226f..f3731e799ec3 100644 +--- a/sfx2/source/view/lokhelper.cxx ++++ b/sfx2/source/view/lokhelper.cxx +@@ -45,6 +45,9 @@ void SfxLokHelper::setView(size_t nId) + return; + + SfxViewShell* pViewShell = rViewArr[nId]; ++ if (pViewShell->GetViewFrame() == SfxViewFrame::Current()) ++ return; ++ + if (SfxViewFrame* pViewFrame = pViewShell->GetViewFrame()) + pViewFrame->MakeActive_Impl(false); + } +-- +2.12.0 + diff --git a/SOURCES/0147-sfx2-add-SfxViewShell-libreOfficeKitViewCallback.patch b/SOURCES/0147-sfx2-add-SfxViewShell-libreOfficeKitViewCallback.patch new file mode 100644 index 0000000..ee59169 --- /dev/null +++ b/SOURCES/0147-sfx2-add-SfxViewShell-libreOfficeKitViewCallback.patch @@ -0,0 +1,101 @@ +From 62d05c21fdfe3e75e52fc275df6ef0ea95cb93d1 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Thu, 17 Sep 2015 10:58:56 +0200 +Subject: [PATCH 147/398] sfx2: add SfxViewShell::libreOfficeKitViewCallback() + +This is similar to the existing LOK callback, the difference is that the +existing one assumes there is only one SfxViewShell instance at the same +time. + +This newer callback is precisely per-view, so model notifications can +invoke all view callbacks, while view notifications can invoke only the +callback of the relevant view. + +This is just the framework, all actual client code has to be still +ported over (and then the existing callback can be removed). + +(cherry picked from commit c74ccac7cd94eba052d21cf74e03e214d58942e4) + +Change-Id: I3d8f27740c69fcf6ffbbdce12db2ea088321493d +--- + include/sfx2/viewsh.hxx | 7 +++++++ + sfx2/source/view/viewimp.hxx | 5 ++++- + sfx2/source/view/viewsh.cxx | 14 ++++++++++++++ + 3 files changed, 25 insertions(+), 1 deletion(-) + +diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx +index c6e7f4a2ca12..69bd32c5ee25 100644 +--- a/include/sfx2/viewsh.hxx ++++ b/include/sfx2/viewsh.hxx +@@ -39,6 +39,8 @@ + #include + #include + #include ++#define LOK_USE_UNSTABLE_API ++#include + + class SfxBaseController; + class Size; +@@ -317,6 +319,11 @@ public: + SAL_DLLPRIVATE void TakeOwnership_Impl(); + SAL_DLLPRIVATE void TakeFrameOwnership_Impl(); + SAL_DLLPRIVATE bool ExecKey_Impl(const KeyEvent& aKey); ++ ++ /// The actual implementation of the lok::Document::registerViewCallback() API. ++ void registerLibreOfficeKitViewCallback(LibreOfficeKitCallback pCallback, void* pLibreOfficeKitData); ++ /// Invokes the registered callback, if there are any. ++ void libreOfficeKitViewCallback(int nType, const char* pPayload) const; + }; + + +diff --git a/sfx2/source/view/viewimp.hxx b/sfx2/source/view/viewimp.hxx +index 43b25d045eca..9f3ee1e3872b 100644 +--- a/sfx2/source/view/viewimp.hxx ++++ b/sfx2/source/view/viewimp.hxx +@@ -65,7 +65,10 @@ struct SfxViewShell_Impl + + mutable SfxInPlaceClientList* mpIPClientList; + +- SfxViewShell_Impl(SfxViewShellFlags const nFlags); ++ LibreOfficeKitCallback m_pLibreOfficeKitViewCallback; ++ void* m_pLibreOfficeKitViewData; ++ ++ explicit SfxViewShell_Impl(SfxViewShellFlags const nFlags); + ~SfxViewShell_Impl(); + + SfxInPlaceClientList* GetIPClientList_Impl( bool bCreate = true ) const; +diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx +index 939c590ffa82..8e7e68598dda 100644 +--- a/sfx2/source/view/viewsh.cxx ++++ b/sfx2/source/view/viewsh.cxx +@@ -310,6 +310,8 @@ SfxViewShell_Impl::SfxViewShell_Impl(SfxViewShellFlags const nFlags) + , m_nFamily(0xFFFF) // undefined, default set by TemplateDialog + , m_pController(0) + , mpIPClientList(NULL) ++, m_pLibreOfficeKitViewCallback(0) ++, m_pLibreOfficeKitViewData(0) + {} + + SfxViewShell_Impl::~SfxViewShell_Impl() +@@ -1633,6 +1635,18 @@ bool SfxViewShell::ExecKey_Impl(const KeyEvent& aKey) + return pImp->m_xAccExec->execute(aKey.GetKeyCode()); + } + ++void SfxViewShell::registerLibreOfficeKitViewCallback(LibreOfficeKitCallback pCallback, void* pData) ++{ ++ pImp->m_pLibreOfficeKitViewCallback = pCallback; ++ pImp->m_pLibreOfficeKitViewData = pData; ++} ++ ++void SfxViewShell::libreOfficeKitViewCallback(int nType, const char* pPayload) const ++{ ++ if (pImp->m_pLibreOfficeKitViewCallback) ++ pImp->m_pLibreOfficeKitViewCallback(nType, pPayload, pImp->m_pLibreOfficeKitViewData); ++} ++ + bool SfxViewShell::KeyInput( const KeyEvent &rKeyEvent ) + + /* [Description] +-- +2.12.0 + diff --git a/SOURCES/0148-comphelper-add-LibreOfficeKit-set-isViewCallback.patch b/SOURCES/0148-comphelper-add-LibreOfficeKit-set-isViewCallback.patch new file mode 100644 index 0000000..f42e87a --- /dev/null +++ b/SOURCES/0148-comphelper-add-LibreOfficeKit-set-isViewCallback.patch @@ -0,0 +1,77 @@ +From a5cddfd6432264a781e5418f970da6553db6a57d Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Thu, 17 Sep 2015 10:59:13 +0200 +Subject: [PATCH 148/398] comphelper: add LibreOfficeKit::set/isViewCallback() + +Change-Id: Iad0b2ee419327daf478f3ddda2378effe0184067 +(cherry picked from commit 1704221067e2bc6ba26eaa83573d29964b413a34) +--- + comphelper/source/misc/lok.cxx | 12 ++++++++++++ + desktop/source/lib/init.cxx | 4 ++++ + include/comphelper/lok.hxx | 5 +++++ + 3 files changed, 21 insertions(+) + +diff --git a/comphelper/source/misc/lok.cxx b/comphelper/source/misc/lok.cxx +index a6abd2a65486..279ec65c600c 100644 +--- a/comphelper/source/misc/lok.cxx ++++ b/comphelper/source/misc/lok.cxx +@@ -17,6 +17,8 @@ namespace LibreOfficeKit + + static bool g_bActive(false); + ++static bool g_bViewCallback(false); ++ + void setActive(bool bActive) + { + g_bActive = bActive; +@@ -27,6 +29,16 @@ bool isActive() + return g_bActive; + } + ++void setViewCallback(bool bViewCallback) ++{ ++ g_bViewCallback = bViewCallback; ++} ++ ++bool isViewCallback() ++{ ++ return g_bViewCallback; ++} ++ + static void (*pStatusIndicatorCallback)(void *data, statusIndicatorCallbackType type, int percent)(nullptr); + static void *pStatusIndicatorCallbackData(nullptr); + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 617c94638cde..52a78e228a32 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -1192,6 +1192,10 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char + return 1; + + comphelper::LibreOfficeKit::setActive(); ++ ++ static bool bViewCallback = getenv("LOK_VIEW_CALLBACK"); ++ comphelper::LibreOfficeKit::setViewCallback(bViewCallback); ++ + comphelper::LibreOfficeKit::setStatusIndicatorCallback(lo_status_indicator_callback, pLib); + + if (pUserProfilePath) +diff --git a/include/comphelper/lok.hxx b/include/comphelper/lok.hxx +index 79fa115e6585..2cc38c60e455 100644 +--- a/include/comphelper/lok.hxx ++++ b/include/comphelper/lok.hxx +@@ -36,6 +36,11 @@ COMPHELPER_DLLPUBLIC void setStatusIndicatorCallback(void (*callback)(void *data + // Check whether the code is running as invoked through LibreOfficeKit. + COMPHELPER_DLLPUBLIC bool isActive(); + ++/// Check whether clients register a callback for each view. ++COMPHELPER_DLLPUBLIC bool isViewCallback(); ++/// Set whether clients register a callback for each view. ++COMPHELPER_DLLPUBLIC void setViewCallback(bool bViewCallback); ++ + // Status indicator handling. Even if in theory there could be several status indicators active at + // the same time, in practice there is only one at a time, so we don't handle any identification of + // status indicator in this API. +-- +2.12.0 + diff --git a/SOURCES/0149-sw-implement-per-view-LOK_CALLBACK_INVALIDATE_TILES.patch b/SOURCES/0149-sw-implement-per-view-LOK_CALLBACK_INVALIDATE_TILES.patch new file mode 100644 index 0000000..74d42c8 --- /dev/null +++ b/SOURCES/0149-sw-implement-per-view-LOK_CALLBACK_INVALIDATE_TILES.patch @@ -0,0 +1,42 @@ +From 3b8231a0656c7bddb2159bf494dd25074c0755b2 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Thu, 17 Sep 2015 11:44:53 +0200 +Subject: [PATCH 149/398] sw: implement per-view LOK_CALLBACK_INVALIDATE_TILES + +Change-Id: Id839dc076824e69fe07386c83bf21fc4c7ce2b8e +(cherry picked from commit b0f04d1ba273cc94989a5079f957117433076a9b) +--- + sw/source/uibase/docvw/edtwin.cxx | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx +index a76f68755b30..f392010fb6b1 100644 +--- a/sw/source/uibase/docvw/edtwin.cxx ++++ b/sw/source/uibase/docvw/edtwin.cxx +@@ -69,6 +69,7 @@ + #include + + #include ++#include + + #include + #include +@@ -6217,8 +6218,13 @@ void SwEditWin::LogicInvalidate(const Rectangle* pRectangle) + else + sRectangle = pRectangle->toString(); + +- if ( m_rView.GetWrtShellPtr() ) +- m_rView.GetWrtShell().libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); ++ if (comphelper::LibreOfficeKit::isViewCallback()) ++ m_rView.libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); ++ else ++ { ++ if (m_rView.GetWrtShellPtr()) ++ m_rView.GetWrtShell().libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); ++ } + } + + void SwEditWin::LogicMouseButtonDown(const MouseEvent& rMouseEvent) +-- +2.12.0 + diff --git a/SOURCES/0150-lok-Document-register-callback-in-the-view-if-reques.patch b/SOURCES/0150-lok-Document-register-callback-in-the-view-if-reques.patch new file mode 100644 index 0000000..9c1e0b4 --- /dev/null +++ b/SOURCES/0150-lok-Document-register-callback-in-the-view-if-reques.patch @@ -0,0 +1,59 @@ +From 2dd20703103d2510fa47958743ced3ae203f613d Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Thu, 17 Sep 2015 15:39:19 +0200 +Subject: [PATCH 150/398] lok::Document: register callback in the view, if + requested + +With this, a postKeyEvent() in one view properly results in one +LOK_CALLBACK_INVALIDATE_TILES per view, at least in Writer. + +Change-Id: Ia0a9a00ea5a98c38f3d399208b9ef028f3036f79 +(cherry picked from commit b8a54763f4f66538f13b6c0e13045e5cb3167ca4) +--- + desktop/source/lib/init.cxx | 20 +++++++++++++++----- + 1 file changed, 15 insertions(+), 5 deletions(-) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 52a78e228a32..64a6c00ffba6 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -54,6 +54,8 @@ + #include + #include + #include ++#include ++#include + #include + #include + #include +@@ -816,14 +818,22 @@ static void doc_registerCallback(LibreOfficeKitDocument* pThis, + LibreOfficeKitCallback pCallback, + void* pData) + { +- ITiledRenderable* pDoc = getTiledRenderable(pThis); +- if (!pDoc) ++ if (comphelper::LibreOfficeKit::isViewCallback()) + { +- gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering"; +- return; ++ if (SfxViewShell* pViewShell = SfxViewFrame::Current()->GetViewShell()) ++ pViewShell->registerLibreOfficeKitViewCallback(pCallback, pData); + } ++ else ++ { ++ ITiledRenderable* pDoc = getTiledRenderable(pThis); ++ if (!pDoc) ++ { ++ gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering"; ++ return; ++ } + +- pDoc->registerCallback(pCallback, pData); ++ pDoc->registerCallback(pCallback, pData); ++ } + } + + static void doc_postKeyEvent(LibreOfficeKitDocument* pThis, int nType, int nCharCode, int nKeyCode) +-- +2.12.0 + diff --git a/SOURCES/0151-sw-implement-per-view-LOK_CALLBACK_INVALIDATE_VISIBL.patch b/SOURCES/0151-sw-implement-per-view-LOK_CALLBACK_INVALIDATE_VISIBL.patch new file mode 100644 index 0000000..2a0be60 --- /dev/null +++ b/SOURCES/0151-sw-implement-per-view-LOK_CALLBACK_INVALIDATE_VISIBL.patch @@ -0,0 +1,62 @@ +From eaa1e3dcd0d84b8c60f5175b8e3ab5582e4658e7 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Thu, 17 Sep 2015 17:19:49 +0200 +Subject: [PATCH 151/398] sw: implement per-view + LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR + +Change-Id: Ib4c1caede94d3eac372a3605c430bbbd353755f3 +(cherry picked from commit 5c2811d682c6e623f3b2613df3119987c0c79c12) +--- + sw/inc/viewsh.hxx | 2 +- + sw/source/core/crsr/viscrs.cxx | 8 ++++++-- + 2 files changed, 7 insertions(+), 3 deletions(-) + +diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx +index 1ba064f0c16c..fcccb91654fb 100644 +--- a/sw/inc/viewsh.hxx ++++ b/sw/inc/viewsh.hxx +@@ -449,7 +449,7 @@ public: + { return mpCareWindow ? mpCareWindow.get() : CareChildWin(rVSh); } + static vcl::Window* CareChildWin(SwViewShell& rVSh); + +- inline SfxViewShell *GetSfxViewShell() { return mpSfxViewShell; } ++ inline SfxViewShell *GetSfxViewShell() const { return mpSfxViewShell; } + inline void SetSfxViewShell(SfxViewShell *pNew) { mpSfxViewShell = pNew; } + + // Selection of Draw Engine has been changed. +diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx +index e0d32cc86e11..13cfcd89b22b 100644 +--- a/sw/source/core/crsr/viscrs.cxx ++++ b/sw/source/core/crsr/viscrs.cxx +@@ -54,6 +54,7 @@ + #include + + #include ++#include + #include + + // Here static members are defined. They will get changed on alteration of the +@@ -178,7 +179,7 @@ void SwVisCrsr::_SetPosAndShow() + + m_aTextCrsr.SetPos( aRect.Pos() ); + +- if (m_pCrsrShell->isTiledRendering()) ++ if (comphelper::LibreOfficeKit::isActive()) + { + // notify about page number change (if that happened) + sal_uInt16 nPage, nVirtPage; +@@ -193,7 +194,10 @@ void SwVisCrsr::_SetPosAndShow() + // notify about the cursor position & size + Rectangle aSVRect(aRect.Pos().getX(), aRect.Pos().getY(), aRect.Pos().getX() + aRect.SSize().Width(), aRect.Pos().getY() + aRect.SSize().Height()); + OString sRect = aSVRect.toString(); +- m_pCrsrShell->libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, sRect.getStr()); ++ if (comphelper::LibreOfficeKit::isViewCallback()) ++ m_pCrsrShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, sRect.getStr()); ++ else ++ m_pCrsrShell->libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, sRect.getStr()); + } + + if ( !m_pCrsrShell->IsCrsrReadonly() || m_pCrsrShell->GetViewOptions()->IsSelectionInReadonly() ) +-- +2.12.0 + diff --git a/SOURCES/0152-gtktiledviewer-don-t-crash-on-opening-non-existing-f.patch b/SOURCES/0152-gtktiledviewer-don-t-crash-on-opening-non-existing-f.patch new file mode 100644 index 0000000..944d497 --- /dev/null +++ b/SOURCES/0152-gtktiledviewer-don-t-crash-on-opening-non-existing-f.patch @@ -0,0 +1,57 @@ +From f752c0f12b0e903eb958e48ec1b88e4bc70778f9 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 18 Sep 2015 10:58:24 +0200 +Subject: [PATCH 152/398] gtktiledviewer: don't crash on opening non-existing + files + +Change-Id: Ic48adaf038e8fbcc86a94b5e351d2f963fcfcd16 +(cherry picked from commit 43b2103f932c92374e2ba2ab0ec1006582a0f646) +--- + libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 16 ++++++++++++++-- + libreofficekit/source/gtk/lokdocview.cxx | 2 -- + 2 files changed, 14 insertions(+), 4 deletions(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 5a18aee50bf3..8e64972be17d 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -553,8 +553,20 @@ static void openDocumentCallback (GObject* source_object, GAsyncResult* res, gpo + + if (!lok_doc_view_open_document_finish(pDocView, res, &error)) + { +- g_warning ("Error occurred while opening the document : %s", error->message); +- g_error_free (error); ++ GtkDialogFlags eFlags = GTK_DIALOG_DESTROY_WITH_PARENT; ++ GtkWidget* pDialog = gtk_message_dialog_new(GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(pDocView))), ++ eFlags, ++ GTK_MESSAGE_ERROR, ++ GTK_BUTTONS_CLOSE, ++ "Error occurred while opening the document: '%s'", ++ error->message); ++ gtk_dialog_run(GTK_DIALOG(pDialog)); ++ gtk_widget_destroy(pDialog); ++ ++ g_error_free(error); ++ gtk_widget_destroy(GTK_WIDGET(pDocView)); ++ gtk_main_quit(); ++ return; + } + + populatePartSelector(pDocView); +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index f8202c339587..60304b4ff59c 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -1225,9 +1225,7 @@ openDocumentInThread (gpointer data) + priv->m_pDocument = priv->m_pOffice->pClass->documentLoad( priv->m_pOffice, priv->m_aDocPath ); + if ( !priv->m_pDocument ) + { +- // FIXME: should have a GError parameter and populate it. + char *pError = priv->m_pOffice->pClass->getError( priv->m_pOffice ); +- fprintf( stderr, "Error opening document '%s'\n", pError ); + g_task_return_new_error(task, 0, 0, "%s", pError); + } + else +-- +2.12.0 + diff --git a/SOURCES/0153-gtktiledviewer-fix-leftover-import-progressbar-in-cr.patch b/SOURCES/0153-gtktiledviewer-fix-leftover-import-progressbar-in-cr.patch new file mode 100644 index 0000000..2daa26a --- /dev/null +++ b/SOURCES/0153-gtktiledviewer-fix-leftover-import-progressbar-in-cr.patch @@ -0,0 +1,46 @@ +From c97dc2f0e98daf6d732aadb983e36cd1d2637ffd Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 18 Sep 2015 11:14:58 +0200 +Subject: [PATCH 153/398] gtktiledviewer: fix leftover import progressbar in + createView() + +Change-Id: Ia71e80c521cdc6a8e4df52e51e063a44a0dd53df +(cherry picked from commit af29b2b57cc07490cc36ff02d5ff3f3844e7c102) +--- + libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 8e64972be17d..46264eb0126b 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -194,12 +194,13 @@ static void toggleFindbar(GtkWidget* pButton, gpointer /*pItem*/) + } + + /// Common initialization, regardless if it's just a new view or a full init. +-static void setupWidgetAndCreateWindow(GtkWidget* pDocView) ++static TiledWindow& setupWidgetAndCreateWindow(GtkWidget* pDocView) + { + setupDocView(pDocView); + TiledWindow aWindow; + aWindow.m_pDocView = pDocView; +- createWindow(aWindow); ++ GtkWidget* pWindow = createWindow(aWindow); ++ return lcl_getTiledWindow(pWindow); + } + + /// Creates a new view, i.e. no LOK init or document load. +@@ -208,7 +209,9 @@ static void createView(GtkWidget* pButton, gpointer /*pItem*/) + TiledWindow& rWindow = lcl_getTiledWindow(pButton); + GtkWidget* pDocView = lok_doc_view_new_from_widget(LOK_DOC_VIEW(rWindow.m_pDocView)); + +- setupWidgetAndCreateWindow(pDocView); ++ TiledWindow& rNewWindow = setupWidgetAndCreateWindow(pDocView); ++ // Hide status bar that contains the unused progress bar. ++ gtk_widget_hide(rNewWindow.m_pStatusBar); + } + + /// Creates a new model, i.e. LOK init and document load, one view implicitly. +-- +2.12.0 + diff --git a/SOURCES/0154-sw-implement-per-view-LOK_CALLBACK_TEXT_SELECTION.patch b/SOURCES/0154-sw-implement-per-view-LOK_CALLBACK_TEXT_SELECTION.patch new file mode 100644 index 0000000..c5b3546 --- /dev/null +++ b/SOURCES/0154-sw-implement-per-view-LOK_CALLBACK_TEXT_SELECTION.patch @@ -0,0 +1,135 @@ +From 4cb2a43c66b393ffd28d91e5fb27d782eaf7acb0 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 18 Sep 2015 14:29:18 +0200 +Subject: [PATCH 154/398] sw: implement per-view LOK_CALLBACK_TEXT_SELECTION + +Also: + +- let the unit test set the global LOK flag, as sw code now depends on + that +- in framework, don't return early after emitting the LOK status + indicator callback, otherwise CppunitTest_sw_tiledrendering shows how + sw LOK callbacks are missing + +Change-Id: I0c4ac12f2ef5118d29afd131676bcb27d5db7746 +(cherry picked from commit 1a83f30ebe2c56b00804ce774537b34f1049be84) +--- + framework/source/helper/statusindicator.cxx | 2 -- + sw/qa/extras/tiledrendering/tiledrendering.cxx | 4 ++++ + sw/source/core/crsr/viscrs.cxx | 26 ++++++++++++++++++++------ + 3 files changed, 24 insertions(+), 8 deletions(-) + +diff --git a/framework/source/helper/statusindicator.cxx b/framework/source/helper/statusindicator.cxx +index 5c9dafc5ba81..ce8310a07cf5 100644 +--- a/framework/source/helper/statusindicator.cxx ++++ b/framework/source/helper/statusindicator.cxx +@@ -43,7 +43,6 @@ void SAL_CALL StatusIndicator::start(const OUString& sText , + m_nLastCallbackPercent = -1; + + comphelper::LibreOfficeKit::statusIndicatorStart(); +- return; + } + + css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory); +@@ -60,7 +59,6 @@ void SAL_CALL StatusIndicator::end() + if (comphelper::LibreOfficeKit::isActive()) + { + comphelper::LibreOfficeKit::statusIndicatorFinish(); +- return; + } + + css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory); +diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx +index 07dd7e34b29c..e7ab14942f79 100644 +--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx ++++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx +@@ -383,6 +383,8 @@ void SwTiledRenderingTest::testSearchViewArea() + void SwTiledRenderingTest::testSearchTextFrame() + { + #if !defined(WNT) && !defined(MACOSX) ++ comphelper::LibreOfficeKit::setActive(); ++ + SwXTextDocument* pXTextDocument = createDoc("search.odt"); + pXTextDocument->registerCallback(&SwTiledRenderingTest::callback, this); + uno::Sequence aPropertyValues(comphelper::InitPropertySequence( +@@ -393,6 +395,8 @@ void SwTiledRenderingTest::testSearchTextFrame() + comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues); + // This was empty: nothing was highlighted after searching for 'TextFrame'. + CPPUNIT_ASSERT(!m_aTextSelection.isEmpty()); ++ ++ comphelper::LibreOfficeKit::setActive(false); + #endif + } + +diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx +index 13cfcd89b22b..808756159545 100644 +--- a/sw/source/core/crsr/viscrs.cxx ++++ b/sw/source/core/crsr/viscrs.cxx +@@ -361,7 +361,7 @@ void SwSelPaintRects::Show(std::vector* pSelectionRectangles) + // talks about "the" cursor at the moment. As long as that's true, + // don't say anything about the Writer cursor till a draw object is + // being edited. +- if (GetShell()->isTiledRendering() && !pView->GetTextEditObject()) ++ if (comphelper::LibreOfficeKit::isActive() && !pView->GetTextEditObject()) + { + if (!empty()) + { +@@ -377,12 +377,18 @@ void SwSelPaintRects::Show(std::vector* pSelectionRectangles) + if (aStartRect.HasArea()) + { + OString sRect = aStartRect.SVRect().toString(); +- GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_START, sRect.getStr()); ++ if (comphelper::LibreOfficeKit::isViewCallback()) ++ GetShell()->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_START, sRect.getStr()); ++ else ++ GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_START, sRect.getStr()); + } + if (aEndRect.HasArea()) + { + OString sRect = aEndRect.SVRect().toString(); +- GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_END, sRect.getStr()); ++ if (comphelper::LibreOfficeKit::isViewCallback()) ++ GetShell()->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_END, sRect.getStr()); ++ else ++ GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_END, sRect.getStr()); + } + } + +@@ -396,7 +402,12 @@ void SwSelPaintRects::Show(std::vector* pSelectionRectangles) + } + OString sRect = ss.str().c_str(); + if (!pSelectionRectangles) +- GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr()); ++ { ++ if (comphelper::LibreOfficeKit::isViewCallback()) ++ GetShell()->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr()); ++ else ++ GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr()); ++ } + else + pSelectionRectangles->push_back(sRect); + } +@@ -593,7 +604,7 @@ void SwShellCrsr::Show() + pShCrsr->SwSelPaintRects::Show(&aSelectionRectangles); + } + +- if (GetShell()->isTiledRendering()) ++ if (comphelper::LibreOfficeKit::isActive()) + { + std::stringstream ss; + bool bFirst = true; +@@ -609,7 +620,10 @@ void SwShellCrsr::Show() + ss << rSelectionRectangle.getStr(); + } + OString sRect = ss.str().c_str(); +- GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr()); ++ if (comphelper::LibreOfficeKit::isViewCallback()) ++ GetShell()->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr()); ++ else ++ GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr()); + } + } + +-- +2.12.0 + diff --git a/SOURCES/0155-sw-implement-per-view-LOK_CALLBACK_CURSOR_VISIBLE.patch b/SOURCES/0155-sw-implement-per-view-LOK_CALLBACK_CURSOR_VISIBLE.patch new file mode 100644 index 0000000..b7dd6c5 --- /dev/null +++ b/SOURCES/0155-sw-implement-per-view-LOK_CALLBACK_CURSOR_VISIBLE.patch @@ -0,0 +1,66 @@ +From ea203d6dcaad5ea5e1aea716041072f9030e6467 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 18 Sep 2015 14:32:53 +0200 +Subject: [PATCH 155/398] sw: implement per-view LOK_CALLBACK_CURSOR_VISIBLE + +Change-Id: I4e00679547997cfb3dafe603b908f055011a3b30 +(cherry picked from commit 32f419fee5f9df4facb7a9b3ec910471d2a20247) +--- + sw/source/core/crsr/crsrsh.cxx | 20 ++++++++++++++++---- + 1 file changed, 16 insertions(+), 4 deletions(-) + +diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx +index 3a0c6667b2e2..cbb89aca8868 100644 +--- a/sw/source/core/crsr/crsrsh.cxx ++++ b/sw/source/core/crsr/crsrsh.cxx +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -63,6 +64,7 @@ + #include + #include + #include ++#include + + using namespace com::sun::star; + using namespace util; +@@ -2118,8 +2120,13 @@ void SwCrsrShell::ShowCrsr() + m_bSVCrsrVis = true; + m_pCurCrsr->SetShowTextInputFieldOverlay( true ); + +- if (isTiledRendering()) +- libreOfficeKitCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(true).getStr()); ++ if (comphelper::LibreOfficeKit::isActive()) ++ { ++ if (comphelper::LibreOfficeKit::isViewCallback()) ++ GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(true).getStr()); ++ else ++ libreOfficeKitCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(true).getStr()); ++ } + + UpdateCrsr(); + } +@@ -2135,8 +2142,13 @@ void SwCrsrShell::HideCrsr() + m_pCurCrsr->SetShowTextInputFieldOverlay( false ); + m_pVisCrsr->Hide(); + +- if (isTiledRendering()) +- libreOfficeKitCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(false).getStr()); ++ if (comphelper::LibreOfficeKit::isActive()) ++ { ++ if (comphelper::LibreOfficeKit::isViewCallback()) ++ GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(false).getStr()); ++ else ++ libreOfficeKitCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(false).getStr()); ++ } + } + } + +-- +2.12.0 + diff --git a/SOURCES/0156-CppCheck-reduce-variables-scope.patch b/SOURCES/0156-CppCheck-reduce-variables-scope.patch new file mode 100644 index 0000000..d0bfe7f --- /dev/null +++ b/SOURCES/0156-CppCheck-reduce-variables-scope.patch @@ -0,0 +1,43 @@ +From 01673b7cf6bb0abbd35ff79b50dc15b14bacad70 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C3=ABl=20Lef=C3=A8vre?= +Date: Mon, 21 Sep 2015 15:11:57 +0200 +Subject: [PATCH 156/398] CppCheck : reduce variables scope +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Reviewed-on: https://gerrit.libreoffice.org/18753 +Tested-by: Jenkins +Reviewed-by: Caolán McNamara +Tested-by: Caolán McNamara +(cherry picked from commit 92c8d74c543aa94cd512369072975dca7006d5b3) + +Change-Id: Ief402017b693a4337f330fb07bb7a6dc6e749f72 +--- + desktop/source/lib/init.cxx | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 64a6c00ffba6..1b06c4220564 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -566,7 +566,6 @@ static void doc_iniUnoCommands () + }; + + util::URL aCommandURL; +- const SfxSlot* pSlot = NULL; + SfxViewShell* pViewShell = SfxViewShell::Current(); + SfxViewFrame* pViewFrame = pViewShell? pViewShell->GetViewFrame(): NULL; + +@@ -582,6 +581,8 @@ static void doc_iniUnoCommands () + + for (sal_uInt32 nIterator = 0; nIterator < SAL_N_ELEMENTS(sUnoCommands); nIterator++) + { ++ const SfxSlot* pSlot = NULL; ++ + aCommandURL.Complete = sUnoCommands[nIterator]; + xParser->parseStrict(aCommandURL); + pSlot = rSlotPool.GetUnoSlot(aCommandURL.Path); +-- +2.12.0 + diff --git a/SOURCES/0157-lok-add-Office-getFilterTypes.patch b/SOURCES/0157-lok-add-Office-getFilterTypes.patch new file mode 100644 index 0000000..c94cca8 --- /dev/null +++ b/SOURCES/0157-lok-add-Office-getFilterTypes.patch @@ -0,0 +1,126 @@ +From e94667a1d9fbeea7655a4c5a6424534f43c02112 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 25 Sep 2015 01:02:23 +0200 +Subject: [PATCH 157/398] lok: add Office::getFilterTypes() + +Change-Id: I3b1f4e11f2495e5ccb41f85802f243c0190695ee +(cherry picked from commit 9b9f2ad9c819421c9f24bcbca98ee147f70d85b2) +--- + desktop/source/lib/init.cxx | 39 +++++++++++++++++++++++++++++++ + include/LibreOfficeKit/LibreOfficeKit.h | 3 +++ + include/LibreOfficeKit/LibreOfficeKit.hxx | 21 +++++++++++++++++ + 3 files changed, 63 insertions(+) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 1b06c4220564..57697fabce4c 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -320,6 +320,8 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions (LibreOfficeKit* pThi + static void lo_registerCallback (LibreOfficeKit* pThis, + LibreOfficeKitCallback pCallback, + void* pData); ++static char* lo_getFilterTypes(LibreOfficeKit* pThis); ++ + struct LibLibreOffice_Impl : public _LibreOfficeKit + { + OUString maLastExceptionMsg; +@@ -342,6 +344,7 @@ struct LibLibreOffice_Impl : public _LibreOfficeKit + m_pOfficeClass->getError = lo_getError; + m_pOfficeClass->documentLoadWithOptions = lo_documentLoadWithOptions; + m_pOfficeClass->registerCallback = lo_registerCallback; ++ m_pOfficeClass->getFilterTypes = lo_getFilterTypes; + + gOfficeClass = m_pOfficeClass; + } +@@ -1098,6 +1101,42 @@ static char* lo_getError (LibreOfficeKit *pThis) + return pMemory; + } + ++static char* lo_getFilterTypes(LibreOfficeKit* pThis) ++{ ++ LibLibreOffice_Impl* pImpl = static_cast(pThis); ++ ++ if (!xSFactory.is()) ++ xSFactory = comphelper::getProcessServiceFactory(); ++ ++ if (!xSFactory.is()) ++ { ++ pImpl->maLastExceptionMsg = "Service factory is not available"; ++ return 0; ++ } ++ ++ uno::Reference xTypeDetection(xSFactory->createInstance("com.sun.star.document.TypeDetection"), uno::UNO_QUERY); ++ uno::Sequence aTypes = xTypeDetection->getElementNames(); ++ boost::property_tree::ptree aTree; ++ for (const OUString& rType : aTypes) ++ { ++ uno::Sequence aValues; ++ if (xTypeDetection->getByName(rType) >>= aValues) ++ { ++ auto it = std::find_if(aValues.begin(), aValues.end(), [](const beans::PropertyValue& rValue) { return rValue.Name == "MediaType"; }); ++ OUString aValue; ++ if (it != aValues.end() && (it->Value >>= aValue) && !aValue.isEmpty()) ++ { ++ boost::property_tree::ptree aChild; ++ aChild.put("MediaType", aValue.toUtf8()); ++ aTree.add_child(rType.toUtf8().getStr(), aChild); ++ } ++ } ++ } ++ std::stringstream aStream; ++ boost::property_tree::write_json(aStream, aTree); ++ return strdup(aStream.str().c_str()); ++} ++ + static void force_c_locale() + { + // force locale (and resource files loaded) to en-US +diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h +index 4c3e1fa851d4..d5094bdb1b76 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.h ++++ b/include/LibreOfficeKit/LibreOfficeKit.h +@@ -54,6 +54,9 @@ struct _LibreOfficeKitClass + void (*registerCallback) (LibreOfficeKit* pThis, + LibreOfficeKitCallback pCallback, + void* pData); ++ ++ /// @see lok::Office::getFilterTypes(). ++ char* (*getFilterTypes) (LibreOfficeKit* pThis); + #endif + }; + +diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx +index 7f96e194e56c..207a9ce6e883 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.hxx ++++ b/include/LibreOfficeKit/LibreOfficeKit.hxx +@@ -353,6 +353,27 @@ public: + { + return mpThis->pClass->getError(mpThis); + } ++ ++#ifdef LOK_USE_UNSTABLE_API ++ /** ++ * Returns details of filter types. ++ * ++ * Example returned string: ++ * ++ * { ++ * "writer8": { ++ * "MediaType": "application/vnd.oasis.opendocument.text" ++ * }, ++ * "calc8": { ++ * "MediaType": "application/vnd.oasis.opendocument.spreadsheet" ++ * } ++ * } ++ */ ++ inline char* getFilterTypes() ++ { ++ return mpThis->pClass->getFilterTypes(mpThis); ++ } ++#endif // LOK_USE_UNSTABLE_API + }; + + /// Factory method to create a lok::Office instance. +-- +2.12.0 + diff --git a/SOURCES/0158-desktop-make-LibLibreOffice_Impl-visible-to-testcase.patch b/SOURCES/0158-desktop-make-LibLibreOffice_Impl-visible-to-testcase.patch new file mode 100644 index 0000000..7a66429 --- /dev/null +++ b/SOURCES/0158-desktop-make-LibLibreOffice_Impl-visible-to-testcase.patch @@ -0,0 +1,116 @@ +From 9b45ae57735ee9f7a64ceb7cac8b23e322a63bfc Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 25 Sep 2015 01:06:31 +0200 +Subject: [PATCH 158/398] desktop: make LibLibreOffice_Impl visible to + testcases + +(cherry picked from commit 14a9a7d52074104afa24278a7a350f05d6df572a) + +Change-Id: I345a6cab57cc594614e348700bb3c1c9a0673989 +--- + desktop/inc/lib/init.hxx | 12 +++++++++++ + desktop/source/lib/init.cxx | 51 +++++++++++++++++---------------------------- + 2 files changed, 31 insertions(+), 32 deletions(-) + +diff --git a/desktop/inc/lib/init.hxx b/desktop/inc/lib/init.hxx +index b17f82566daf..81e7eb61664e 100644 +--- a/desktop/inc/lib/init.hxx ++++ b/desktop/inc/lib/init.hxx +@@ -11,6 +11,7 @@ + #include + #include + #include "../../source/inc/desktopdllapi.h" ++#include + + using namespace css; + using namespace boost; +@@ -24,4 +25,15 @@ namespace desktop { + explicit LibLODocument_Impl(const uno::Reference &xComponent); + ~LibLODocument_Impl(); + }; ++ ++ struct DESKTOP_DLLPUBLIC LibLibreOffice_Impl : public _LibreOfficeKit ++ { ++ OUString maLastExceptionMsg; ++ std::shared_ptr< LibreOfficeKitClass > m_pOfficeClass; ++ oslThread maThread; ++ LibreOfficeKitCallback mpCallback; ++ void *mpCallbackData; ++ ++ LibLibreOffice_Impl(); ++ }; + } +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 57697fabce4c..8e4c0f3ab4e5 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -86,10 +86,6 @@ using namespace vcl; + using namespace desktop; + using namespace utl; + +-using namespace boost; +- +-struct LibLibreOffice_Impl; +- + static LibLibreOffice_Impl *gImpl = NULL; + static weak_ptr< LibreOfficeKitClass > gOfficeClass; + static weak_ptr< LibreOfficeKitDocumentClass > gDocumentClass; +@@ -322,36 +318,27 @@ static void lo_registerCallback (LibreOfficeKit* pThis, + void* pData); + static char* lo_getFilterTypes(LibreOfficeKit* pThis); + +-struct LibLibreOffice_Impl : public _LibreOfficeKit ++LibLibreOffice_Impl::LibLibreOffice_Impl() ++ : maThread(0) ++ , mpCallback(nullptr) ++ , mpCallbackData(nullptr) + { +- OUString maLastExceptionMsg; +- shared_ptr< LibreOfficeKitClass > m_pOfficeClass; +- oslThread maThread; +- LibreOfficeKitCallback mpCallback; +- void *mpCallbackData; +- +- LibLibreOffice_Impl() +- : maThread(0) +- , mpCallback(nullptr) +- , mpCallbackData(nullptr) +- { +- if(!(m_pOfficeClass = gOfficeClass.lock())) { +- m_pOfficeClass.reset(new LibreOfficeKitClass); +- m_pOfficeClass->nSize = sizeof(LibreOfficeKitClass); +- +- m_pOfficeClass->destroy = lo_destroy; +- m_pOfficeClass->documentLoad = lo_documentLoad; +- m_pOfficeClass->getError = lo_getError; +- m_pOfficeClass->documentLoadWithOptions = lo_documentLoadWithOptions; +- m_pOfficeClass->registerCallback = lo_registerCallback; +- m_pOfficeClass->getFilterTypes = lo_getFilterTypes; +- +- gOfficeClass = m_pOfficeClass; +- } +- +- pClass = m_pOfficeClass.get(); ++ if(!(m_pOfficeClass = gOfficeClass.lock())) { ++ m_pOfficeClass.reset(new LibreOfficeKitClass); ++ m_pOfficeClass->nSize = sizeof(LibreOfficeKitClass); ++ ++ m_pOfficeClass->destroy = lo_destroy; ++ m_pOfficeClass->documentLoad = lo_documentLoad; ++ m_pOfficeClass->getError = lo_getError; ++ m_pOfficeClass->documentLoadWithOptions = lo_documentLoadWithOptions; ++ m_pOfficeClass->registerCallback = lo_registerCallback; ++ m_pOfficeClass->getFilterTypes = lo_getFilterTypes; ++ ++ gOfficeClass = m_pOfficeClass; + } +-}; ++ ++ pClass = m_pOfficeClass.get(); ++} + + namespace + { +-- +2.12.0 + diff --git a/SOURCES/0159-fix-build.patch b/SOURCES/0159-fix-build.patch new file mode 100644 index 0000000..88a3e04 --- /dev/null +++ b/SOURCES/0159-fix-build.patch @@ -0,0 +1,57 @@ +From 22f4b009e889ba9d08244ff3c7b57c2faade3903 Mon Sep 17 00:00:00 2001 +From: David Tardon +Date: Sun, 19 Mar 2017 21:16:15 +0100 +Subject: [PATCH 159/398] fix build + +Change-Id: Id1067aef106764484584a30fb55efebb7868f24a +--- + desktop/inc/lib/init.hxx | 3 +-- + desktop/source/lib/init.cxx | 6 ++---- + 2 files changed, 3 insertions(+), 6 deletions(-) + +diff --git a/desktop/inc/lib/init.hxx b/desktop/inc/lib/init.hxx +index 81e7eb61664e..d3a42fb10bde 100644 +--- a/desktop/inc/lib/init.hxx ++++ b/desktop/inc/lib/init.hxx +@@ -14,13 +14,12 @@ + #include + + using namespace css; +-using namespace boost; + + namespace desktop { + struct DESKTOP_DLLPUBLIC LibLODocument_Impl : public _LibreOfficeKitDocument + { + uno::Reference mxComponent; +- shared_ptr< LibreOfficeKitDocumentClass > m_pDocumentClass; ++ std::shared_ptr< LibreOfficeKitDocumentClass > m_pDocumentClass; + + explicit LibLODocument_Impl(const uno::Reference &xComponent); + ~LibLODocument_Impl(); +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 8e4c0f3ab4e5..5d716abdf8c4 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -13,8 +13,6 @@ + #include + #include + +-#include +-#include + #include + + #define LOK_USE_UNSTABLE_API +@@ -87,8 +85,8 @@ using namespace desktop; + using namespace utl; + + static LibLibreOffice_Impl *gImpl = NULL; +-static weak_ptr< LibreOfficeKitClass > gOfficeClass; +-static weak_ptr< LibreOfficeKitDocumentClass > gDocumentClass; ++static std::weak_ptr< LibreOfficeKitClass > gOfficeClass; ++static std::weak_ptr< LibreOfficeKitDocumentClass > gDocumentClass; + + typedef struct + { +-- +2.12.0 + diff --git a/SOURCES/0160-Add-lok-Office-getFilterTypes-testcase.patch b/SOURCES/0160-Add-lok-Office-getFilterTypes-testcase.patch new file mode 100644 index 0000000..6a10cc8 --- /dev/null +++ b/SOURCES/0160-Add-lok-Office-getFilterTypes-testcase.patch @@ -0,0 +1,53 @@ +From 2779f57b90defc7f9fe381a221ad285381a65964 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 25 Sep 2015 09:06:28 +0200 +Subject: [PATCH 160/398] Add lok::Office::getFilterTypes() testcase + +Change-Id: I9fa710288729b904f2f1c5b3c575212ef21c8a79 +(cherry picked from commit edb9ef41f29bf3477b8985ee409ce2d22214e63f) +--- + desktop/qa/desktop_lib/test_desktop_lib.cxx | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx +index 0cd88cefffa0..d7b93472c1b5 100644 +--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx ++++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx +@@ -51,11 +51,13 @@ public: + void testGetStyles(); + void testGetFonts(); + void testCreateView(); ++ void testGetFilterTypes(); + + CPPUNIT_TEST_SUITE(DesktopLOKTest); + CPPUNIT_TEST(testGetStyles); + CPPUNIT_TEST(testGetFonts); + CPPUNIT_TEST(testCreateView); ++ CPPUNIT_TEST(testGetFilterTypes); + CPPUNIT_TEST_SUITE_END(); + + uno::Reference mxComponent; +@@ -150,6 +152,20 @@ void DesktopLOKTest::testCreateView() + closeDoc(); + } + ++void DesktopLOKTest::testGetFilterTypes() ++{ ++ LibLibreOffice_Impl aOffice; ++ char* pJSON = aOffice.m_pOfficeClass->getFilterTypes(&aOffice); ++ ++ std::stringstream aStream(pJSON); ++ boost::property_tree::ptree aTree; ++ boost::property_tree::read_json(aStream, aTree); ++ ++ CPPUNIT_ASSERT(aTree.size() > 0); ++ CPPUNIT_ASSERT_EQUAL(std::string("application/vnd.oasis.opendocument.text"), aTree.get_child("writer8").get_child("MediaType").get_value()); ++ free(pJSON); ++} ++ + CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); + + CPPUNIT_PLUGIN_IMPLEMENT(); +-- +2.12.0 + diff --git a/SOURCES/0161-Move-all-introspection-comments-to-header-file.patch b/SOURCES/0161-Move-all-introspection-comments-to-header-file.patch new file mode 100644 index 0000000..7b7180a --- /dev/null +++ b/SOURCES/0161-Move-all-introspection-comments-to-header-file.patch @@ -0,0 +1,377 @@ +From 0942d9f6f6057e83fb542a008dfc80c6e1dcc98e Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Thu, 24 Sep 2015 14:41:26 +0200 +Subject: [PATCH 161/398] Move all introspection comments to header file + +... wherever possible. There are few things we can't move to +header file, for example, the comments corresponding to GObject +properties, and signals. + +Change-Id: If74d61b17ccee11f8a056f3a93040d2cff2dd98d +Reviewed-on: https://gerrit.libreoffice.org/18863 +Reviewed-by: Miklos Vajna +Tested-by: Miklos Vajna +(cherry picked from commit 392437393d97a157e8291d20f1d6b6ac357ff0db) +--- + include/LibreOfficeKit/LibreOfficeKitGtk.h | 132 ++++++++++++++++++++++++++++- + libreofficekit/source/gtk/lokdocview.cxx | 87 +------------------ + 2 files changed, 129 insertions(+), 90 deletions(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h +index f17925b4c53a..81f42105d374 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h ++++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h +@@ -40,54 +40,178 @@ struct _LOKDocViewClass + + GType lok_doc_view_get_type (void) G_GNUC_CONST; + ++/** ++ * lok_doc_view_new: ++ * @pPath: LibreOffice install path. ++ * @cancellable: The cancellable object that you can use to cancel this ++ * operation. ++ * @error: The error that will be set if the object fails to initialize. ++ * ++ * Returns: (transfer none): The #LOKDocView widget instance. ++ */ + GtkWidget* lok_doc_view_new (const gchar* pPath, + GCancellable *cancellable, + GError **error); + ++/** ++ * lok_doc_view_new_from_widget: ++ * @pDocView: The #LOKDocView instance ++ * ++ * Returns: (transfer none): The #LOKDocView widget instance. ++ */ + GtkWidget* lok_doc_view_new_from_widget (LOKDocView* pDocView); + ++/** ++ * lok_doc_view_open_document: ++ * @pDocView: The #LOKDocView instance ++ * @pPath: (transfer full): The path of the document that #LOKDocView widget should try to open ++ * @cancellable: ++ * @callback: ++ * @userdata: ++ * ++ * Returns: %TRUE if the document is loaded succesfully, %FALSE otherwise ++ */ + void lok_doc_view_open_document (LOKDocView* pDocView, + const gchar* pPath, + GCancellable* cancellable, + GAsyncReadyCallback callback, + gpointer userdata); + ++/** ++ * lok_doc_view_open_document_finish: ++ * @pDocView: The #LOKDocView instance ++ * @res: ++ * @error: ++ * ++ * Returns: %TRUE if the document is loaded succesfully, %FALSE otherwise ++ */ + gboolean lok_doc_view_open_document_finish (LOKDocView* pDocView, + GAsyncResult* res, + GError** error); + +-/// Gets the document the viewer displays. ++/** ++ * lok_doc_view_get_document: ++ * @pDocView: The #LOKDocView instance ++ * ++ * Gets the document the viewer displays. ++ * ++ * Returns: The #LibreOfficeKitDocument instance the widget is currently showing ++ */ + LibreOfficeKitDocument* lok_doc_view_get_document (LOKDocView* pDocView); + ++/** ++ * lok_doc_view_set_zoom: ++ * @pDocView: The #LOKDocView instance ++ * @fZoom: The new zoom level that pDocView must set it into. ++ * ++ * Sets the new zoom level for the widget. ++ */ + void lok_doc_view_set_zoom (LOKDocView* pDocView, + float fZoom); ++ ++/** ++ * lok_doc_view_get_zoom: ++ * @pDocView: The #LOKDocView instance ++ * ++ * Returns: The current zoom factor value in float for pDocView ++ */ + float lok_doc_view_get_zoom (LOKDocView* pDocView); + ++/** ++ * lok_doc_view_get_parts: ++ * @pDocView: The #LOKDocView instance ++ */ + int lok_doc_view_get_parts (LOKDocView* pDocView); ++ ++/** ++ * lok_doc_view_get_part: ++ * @pDocView: The #LOKDocView instance ++ */ + int lok_doc_view_get_part (LOKDocView* pDocView); ++ ++/** ++ * lok_doc_view_set_part: ++ * @pDocView: The #LOKDocView instance ++ * @nPart: ++ */ + void lok_doc_view_set_part (LOKDocView* pDocView, + int nPart); ++ ++/** ++ * lok_doc_view_get_part_name: ++ * @pDocView: The #LOKDocView instance ++ * @nPart: ++ */ + char* lok_doc_view_get_part_name (LOKDocView* pDocView, + int nPart); ++ ++/** ++ * lok_doc_view_set_partmode: ++ * @pDocView: The #LOKDocView instance ++ * @nPartMode: ++ */ + void lok_doc_view_set_partmode (LOKDocView* pDocView, + int nPartMode); + ++/** ++ * lok_doc_view_reset_view: ++ * @pDocView: The #LOKDocView instance ++ */ + void lok_doc_view_reset_view (LOKDocView* pDocView); + +-/// Sets if the viewer is actually an editor or not. ++/** ++ * lok_doc_view_set_edit: ++ * @pDocView: The #LOKDocView instance ++ * @bEdit: %TRUE if the pDocView should go in edit mode, %FALSE otherwise ++ * ++ * Sets if the viewer is actually an editor or not. ++ */ + void lok_doc_view_set_edit (LOKDocView* pDocView, + gboolean bEdit); +-/// Gets if the viewer is actually an editor or not. ++ ++/** ++ * lok_doc_view_get_edit: ++ * @pDocView: The #LOKDocView instance ++ * ++ * Gets if the viewer is actually an editor or not. ++ * ++ * Returns: %TRUE if the given pDocView is in edit mode. ++ */ + gboolean lok_doc_view_get_edit (LOKDocView* pDocView); + +-/// Posts the .uno: command to the LibreOfficeKit. ++/** ++ * lok_doc_view_post_command: ++ * @pDocView: the #LOKDocView instance ++ * @pCommand: the command to issue to LO core ++ * @pArguments: the arguments to the given command ++ * ++ * Posts the .uno: command to the LibreOfficeKit. ++ */ + void lok_doc_view_post_command (LOKDocView* pDocView, + const gchar* pCommand, + const gchar* pArguments); + ++/** ++ * lok_doc_view_pixel_to_twip: ++ * @pDocView: The #LOKDocView instance ++ * @fInput: The value in pixels to convert to twips ++ * ++ * Converts the value in pixels to twips according to zoom level. ++ * ++ * Returns: The corresponding value in twips ++ */ + float lok_doc_view_pixel_to_twip (LOKDocView* pDocView, + float fInput); + ++/** ++ * lok_doc_view_twip_to_pixel: ++ * @pDocView: The #LOKDocView instance ++ * @fInput: The value in twips to convert to pixels ++ * ++ * Converts the value in twips to pixels according to zoom level. ++ * ++ * Returns: The corresponding value in pixels ++ */ + float lok_doc_view_twip_to_pixel (LOKDocView* pDocView, + float fInput); + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 60304b4ff59c..7c52ce2e2efb 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -1843,15 +1843,6 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + G_TYPE_INT, G_TYPE_INT); + } + +-/** +- * lok_doc_view_new: +- * @pPath: LibreOffice install path. +- * @cancellable: The cancellable object that you can use to cancel this +- * operation. +- * @error: The error that will be set if the object fails to initialize. +- * +- * Returns: (transfer none): The #LOKDocView widget instance. +- */ + SAL_DLLPUBLIC_EXPORT GtkWidget* + lok_doc_view_new (const gchar* pPath, GCancellable *cancellable, GError **error) + { +@@ -1873,14 +1864,6 @@ SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new_from_widget(LOKDocView* pOldLOK + return pNewDocView; + } + +-/** +- * lok_doc_view_open_document_finish: +- * @pDocView: The #LOKDocView instance +- * @res: +- * @error: +- * +- * Returns: %TRUE if the document is loaded succesfully, %FALSE otherwise +- */ + SAL_DLLPUBLIC_EXPORT gboolean + lok_doc_view_open_document_finish (LOKDocView* pDocView, GAsyncResult* res, GError** error) + { +@@ -1894,17 +1877,6 @@ lok_doc_view_open_document_finish (LOKDocView* pDocView, GAsyncResult* res, GErr + return g_task_propagate_boolean(task, error); + } + +- +-/** +- * lok_doc_view_open_document: +- * @pDocView: The #LOKDocView instance +- * @pPath: (transfer full): The path of the document that #LOKDocView widget should try to open +- * @cancellable: +- * @callback: +- * @userdata: +- * +- * Returns: %TRUE if the document is loaded succesfully, %FALSE otherwise +- */ + SAL_DLLPUBLIC_EXPORT void + lok_doc_view_open_document (LOKDocView* pDocView, + const gchar* pPath, +@@ -1925,12 +1897,6 @@ lok_doc_view_open_document (LOKDocView* pDocView, + g_object_unref(task); + } + +-/** +- * lok_doc_view_get_document: +- * @pDocView: The #LOKDocView instance +- * +- * Returns: The #LibreOfficeKitDocument instance the widget is currently showing +- */ + SAL_DLLPUBLIC_EXPORT LibreOfficeKitDocument* + lok_doc_view_get_document (LOKDocView* pDocView) + { +@@ -1938,13 +1904,6 @@ lok_doc_view_get_document (LOKDocView* pDocView) + return priv->m_pDocument; + } + +-/** +- * lok_doc_view_set_zoom: +- * @pDocView: The #LOKDocView instance +- * @fZoom: The new zoom level that pDocView must set it into. +- * +- * Sets the new zoom level for the widget. +- */ + SAL_DLLPUBLIC_EXPORT void + lok_doc_view_set_zoom (LOKDocView* pDocView, float fZoom) + { +@@ -1963,12 +1922,6 @@ lok_doc_view_set_zoom (LOKDocView* pDocView, float fZoom) + nDocumentHeightPixels); + } + +-/** +- * lok_doc_view_get_zoom: +- * @pDocView: The #LOKDocView instance +- * +- * Returns: The current zoom factor value in float for pDocView +- */ + SAL_DLLPUBLIC_EXPORT float + lok_doc_view_get_zoom (LOKDocView* pDocView) + { +@@ -2036,13 +1989,6 @@ lok_doc_view_reset_view(LOKDocView* pDocView) + gtk_widget_queue_draw(GTK_WIDGET(pDocView)); + } + +-/** +- * lok_doc_view_set_edit: +- * @pDocView: The #LOKDocView instance +- * @bEdit: %TRUE if the pDocView should go in edit mode, %FALSE otherwise +- * +- * Sets the edit-mode for pDocView +- */ + SAL_DLLPUBLIC_EXPORT void + lok_doc_view_set_edit(LOKDocView* pDocView, + gboolean bEdit) +@@ -2057,12 +2003,6 @@ lok_doc_view_set_edit(LOKDocView* pDocView, + g_object_unref(task); + } + +-/** +- * lok_doc_view_get_edit: +- * @pDocView: The #LOKDocView instance +- * +- * Returns: %TRUE if the given pDocView is in edit mode. +- */ + SAL_DLLPUBLIC_EXPORT gboolean + lok_doc_view_get_edit (LOKDocView* pDocView) + { +@@ -2070,14 +2010,7 @@ lok_doc_view_get_edit (LOKDocView* pDocView) + return priv->m_bEdit; + } + +-/** +- * lok_doc_view_post_command: +- * @pDocView: the #LOKDocView instance +- * @pCommand: the command to issue to LO core +- * @pArguments: the arguments to the given command +- * +- * This methods forwards your command to LO core. +-*/ ++ + SAL_DLLPUBLIC_EXPORT void + lok_doc_view_post_command (LOKDocView* pDocView, + const gchar* pCommand, +@@ -2094,15 +2027,6 @@ lok_doc_view_post_command (LOKDocView* pDocView, + g_object_unref(task); + } + +-/** +- * lok_doc_view_pixel_to_twip: +- * @pDocView: The #LOKDocView instance +- * @fInput: The value in pixels to convert to twips +- * +- * Converts the value in pixels to twips according to zoom level. +- * +- * Returns: The corresponding value in twips +- */ + SAL_DLLPUBLIC_EXPORT float + lok_doc_view_pixel_to_twip (LOKDocView* pDocView, float fInput) + { +@@ -2110,15 +2034,6 @@ lok_doc_view_pixel_to_twip (LOKDocView* pDocView, float fInput) + return pixelToTwip(fInput, priv->m_fZoom); + } + +-/** +- * lok_doc_view_twip_to_pixel: +- * @pDocView: The #LOKDocView instance +- * @fInput: The value in twips to convert to pixels +- * +- * Converts the value in twips to pixels according to zoom level. +- * +- * Returns: The corresponding value in pixels +- */ + SAL_DLLPUBLIC_EXPORT float + lok_doc_view_twip_to_pixel (LOKDocView* pDocView, float fInput) + { +-- +2.12.0 + diff --git a/SOURCES/0162-sd-tiled-rendering-avoid-passing-explicit-0-vcl-Wind.patch b/SOURCES/0162-sd-tiled-rendering-avoid-passing-explicit-0-vcl-Wind.patch new file mode 100644 index 0000000..98b7cab --- /dev/null +++ b/SOURCES/0162-sd-tiled-rendering-avoid-passing-explicit-0-vcl-Wind.patch @@ -0,0 +1,71 @@ +From 5432f81622409e99a465adddbabaa21e0acaa2ed Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Mon, 28 Sep 2015 09:05:18 +0200 +Subject: [PATCH 162/398] sd tiled rendering: avoid passing explicit 0 + vcl::Window + +Seen as dereferenced in svx for Impress table handling, and doing some +logic <-> pixel conversion -- and mpActiveWindow not being 0 in that +case. + +Change-Id: I7f7c41a7d366704f6f8b9a7971f763c6661c8799 +(cherry picked from commit 6a9f985ea698355f38c1681c1eb276f8b9dd859c) +--- + sd/source/ui/view/viewshel.cxx | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx +index 51a049e4d66d..241950ce043c 100644 +--- a/sd/source/ui/view/viewshel.cxx ++++ b/sd/source/ui/view/viewshel.cxx +@@ -521,7 +521,7 @@ void ViewShell::LogicMouseButtonDown(const MouseEvent& rMouseEvent) + Point aPoint = mpActiveWindow->GetPointerPosPixel(); + mpActiveWindow->SetLastMousePos(rMouseEvent.GetPosPixel()); + +- MouseButtonDown(rMouseEvent, 0); ++ MouseButtonDown(rMouseEvent, mpActiveWindow); + + mpActiveWindow->SetPointerPosPixel(aPoint); + } +@@ -534,7 +534,7 @@ void ViewShell::LogicMouseButtonUp(const MouseEvent& rMouseEvent) + Point aPoint = mpActiveWindow->GetPointerPosPixel(); + mpActiveWindow->SetLastMousePos(rMouseEvent.GetPosPixel()); + +- MouseButtonUp(rMouseEvent, 0); ++ MouseButtonUp(rMouseEvent, mpActiveWindow); + + mpActiveWindow->SetPointerPosPixel(aPoint); + } +@@ -547,7 +547,7 @@ void ViewShell::LogicMouseMove(const MouseEvent& rMouseEvent) + Point aPoint = mpActiveWindow->GetPointerPosPixel(); + mpActiveWindow->SetLastMousePos(rMouseEvent.GetPosPixel()); + +- MouseMove(rMouseEvent, 0); ++ MouseMove(rMouseEvent, mpActiveWindow); + + mpActiveWindow->SetPointerPosPixel(aPoint); + } +@@ -631,16 +631,16 @@ void ViewShell::SetGraphicMm100Position(bool bStart, const Point& rPosition) + if (bStart) + { + MouseEvent aClickEvent(rPosition, 1, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT); +- MouseButtonDown(aClickEvent, 0); ++ MouseButtonDown(aClickEvent, mpActiveWindow); + MouseEvent aMoveEvent(Point(rPosition.getX(), rPosition.getY()), 0, MouseEventModifiers::SIMPLEMOVE, MOUSE_LEFT); +- MouseMove(aMoveEvent, 0); ++ MouseMove(aMoveEvent, mpActiveWindow); + } + else + { + MouseEvent aMoveEvent(Point(rPosition.getX(), rPosition.getY()), 0, MouseEventModifiers::SIMPLEMOVE, MOUSE_LEFT); +- MouseMove(aMoveEvent, 0); ++ MouseMove(aMoveEvent, mpActiveWindow); + MouseEvent aClickEvent(rPosition, 1, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT); +- MouseButtonUp(aClickEvent, 0); ++ MouseButtonUp(aClickEvent, mpActiveWindow); + } + } + +-- +2.12.0 + diff --git a/SOURCES/0163-libreofficekit-fix-mismatched-free-delete.patch b/SOURCES/0163-libreofficekit-fix-mismatched-free-delete.patch new file mode 100644 index 0000000..573b049 --- /dev/null +++ b/SOURCES/0163-libreofficekit-fix-mismatched-free-delete.patch @@ -0,0 +1,202 @@ +From 6ac4def0a86d75c2ffc49ef8319515ba4bff26cc Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Mon, 28 Sep 2015 09:06:10 +0200 +Subject: [PATCH 163/398] libreofficekit: fix mismatched free() / delete + +Change-Id: I60eb53d4bf9943fd52e0a9d8e3574a7d1cc027e0 +(cherry picked from commit 0067b4df75cdbeb325024cd2b66e3d64fe8b3fcd) +--- + libreofficekit/source/gtk/lokdocview.cxx | 28 ++++++++++++++-------------- + libreofficekit/source/gtk/tilebuffer.cxx | 11 ++++++++--- + libreofficekit/source/gtk/tilebuffer.hxx | 3 +++ + 3 files changed, 25 insertions(+), 17 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 7c52ce2e2efb..6679cee56cd3 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -314,7 +314,7 @@ signalKey (GtkWidget* pWidget, GdkEventKey* pEvent) + pLOEvent->m_nKeyEvent = LOK_KEYEVENT_KEYUP; + pLOEvent->m_nCharCode = nCharCode; + pLOEvent->m_nKeyCode = nKeyCode; +- g_task_set_task_data(task, pLOEvent, g_free); ++ g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); + g_object_unref(task); + } +@@ -325,7 +325,7 @@ signalKey (GtkWidget* pWidget, GdkEventKey* pEvent) + pLOEvent->m_nKeyEvent = LOK_KEYEVENT_KEYINPUT; + pLOEvent->m_nCharCode = nCharCode; + pLOEvent->m_nKeyCode = nKeyCode; +- g_task_set_task_data(task, pLOEvent, g_free); ++ g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); + g_object_unref(task); + } +@@ -951,7 +951,7 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + pLOEvent->m_nSetGraphicSelectionType = LOK_SETGRAPHICSELECTION_END; + pLOEvent->m_nSetGraphicSelectionX = pixelToTwip(pEvent->x, priv->m_fZoom); + pLOEvent->m_nSetGraphicSelectionY = pixelToTwip(pEvent->y, priv->m_fZoom); +- g_task_set_task_data(task, pLOEvent, g_free); ++ g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + + g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); + g_object_unref(task); +@@ -970,7 +970,7 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + pLOEvent->m_nSetGraphicSelectionType = LOK_SETGRAPHICSELECTION_END; + pLOEvent->m_nSetGraphicSelectionX = pixelToTwip(pEvent->x, priv->m_fZoom); + pLOEvent->m_nSetGraphicSelectionY = pixelToTwip(pEvent->y, priv->m_fZoom); +- g_task_set_task_data(task, pLOEvent, g_free); ++ g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + + g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); + g_object_unref(task); +@@ -1019,7 +1019,7 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + pLOEvent->m_nSetGraphicSelectionType = LOK_SETGRAPHICSELECTION_START; + pLOEvent->m_nSetGraphicSelectionX = pixelToTwip(priv->m_aGraphicHandleRects[i].x + priv->m_aGraphicHandleRects[i].width / 2, priv->m_fZoom); + pLOEvent->m_nSetGraphicSelectionY = pixelToTwip(priv->m_aGraphicHandleRects[i].y + priv->m_aGraphicHandleRects[i].height / 2, priv->m_fZoom); +- g_task_set_task_data(task, pLOEvent, g_free); ++ g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + + g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); + g_object_unref(task); +@@ -1047,7 +1047,7 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + pLOEvent->m_nPostMouseEventX = pixelToTwip(pEvent->x, priv->m_fZoom); + pLOEvent->m_nPostMouseEventY = pixelToTwip(pEvent->y, priv->m_fZoom); + pLOEvent->m_nPostMouseEventCount = nCount; +- g_task_set_task_data(task, pLOEvent, g_free); ++ g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + + g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); + g_object_unref(task); +@@ -1065,7 +1065,7 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + pLOEvent->m_nPostMouseEventX = pixelToTwip(pEvent->x, priv->m_fZoom); + pLOEvent->m_nPostMouseEventY = pixelToTwip(pEvent->y, priv->m_fZoom); + pLOEvent->m_nPostMouseEventCount = nCount; +- g_task_set_task_data(task, pLOEvent, g_free); ++ g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + + g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); + g_object_unref(task); +@@ -1153,7 +1153,7 @@ lok_doc_view_signal_motion (GtkWidget* pWidget, GdkEventMotion* pEvent) + pLOEvent->m_nSetGraphicSelectionType = LOK_SETGRAPHICSELECTION_START; + pLOEvent->m_nSetGraphicSelectionX = pixelToTwip(pEvent->x, priv->m_fZoom); + pLOEvent->m_nSetGraphicSelectionY = pixelToTwip(pEvent->y, priv->m_fZoom); +- g_task_set_task_data(task, pLOEvent, g_free); ++ g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + + g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); + g_object_unref(task); +@@ -1169,7 +1169,7 @@ lok_doc_view_signal_motion (GtkWidget* pWidget, GdkEventMotion* pEvent) + pLOEvent->m_nPostMouseEventX = pixelToTwip(pEvent->x, priv->m_fZoom); + pLOEvent->m_nPostMouseEventY = pixelToTwip(pEvent->y, priv->m_fZoom); + pLOEvent->m_nPostMouseEventCount = 1; +- g_task_set_task_data(task, pLOEvent, g_free); ++ g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + + g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); + g_object_unref(task); +@@ -1891,7 +1891,7 @@ lok_doc_view_open_document (LOKDocView* pDocView, + pLOEvent->m_pPath = pPath; + + priv->m_aDocPath = pPath; +- g_task_set_task_data(task, pLOEvent, g_free); ++ g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + + g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); + g_object_unref(task); +@@ -1953,7 +1953,7 @@ lok_doc_view_set_part (LOKDocView* pDocView, int nPart) + LOEvent* pLOEvent = new LOEvent(LOK_SET_PART); + + pLOEvent->m_nPart = nPart; +- g_task_set_task_data(task, pLOEvent, g_free); ++ g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + + g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); + g_object_unref(task); +@@ -1975,7 +1975,7 @@ lok_doc_view_set_partmode(LOKDocView* pDocView, + GTask* task = g_task_new(pDocView, NULL, NULL, NULL); + LOEvent* pLOEvent = new LOEvent(LOK_SET_PARTMODE); + pLOEvent->m_nPartMode = nPartMode; +- g_task_set_task_data(task, pLOEvent, g_free); ++ g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + + g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); + g_object_unref(task); +@@ -1997,7 +1997,7 @@ lok_doc_view_set_edit(LOKDocView* pDocView, + GTask* task = g_task_new(pDocView, NULL, NULL, NULL); + LOEvent* pLOEvent = new LOEvent(LOK_SET_EDIT); + pLOEvent->m_bEdit = bEdit; +- g_task_set_task_data(task, pLOEvent, g_free); ++ g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + + g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); + g_object_unref(task); +@@ -2022,7 +2022,7 @@ lok_doc_view_post_command (LOKDocView* pDocView, + pLOEvent->m_pCommand = pCommand; + pLOEvent->m_pArguments = g_strdup(pArguments); + +- g_task_set_task_data(task, pLOEvent, g_free); ++ g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); + g_object_unref(task); + } +diff --git a/libreofficekit/source/gtk/tilebuffer.cxx b/libreofficekit/source/gtk/tilebuffer.cxx +index 85f6eb0422c2..687ef44d6468 100644 +--- a/libreofficekit/source/gtk/tilebuffer.cxx ++++ b/libreofficekit/source/gtk/tilebuffer.cxx +@@ -73,7 +73,7 @@ void TileBuffer::setInvalid(int x, int y, float fZoom, GTask* task, + pLOEvent->m_nPaintTileX = x; + pLOEvent->m_nPaintTileY = y; + pLOEvent->m_fPaintTileZoom = fZoom; +- g_task_set_task_data(task, pLOEvent, g_free); ++ g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); + } + } +@@ -89,7 +89,7 @@ Tile& TileBuffer::getTile(int x, int y, float fZoom, GTask* task, + pLOEvent->m_nPaintTileX = x; + pLOEvent->m_nPaintTileY = y; + pLOEvent->m_fPaintTileZoom = fZoom; +- g_task_set_task_data(task, pLOEvent, g_free); ++ g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); + return m_mTiles[index]; + } +@@ -99,7 +99,7 @@ Tile& TileBuffer::getTile(int x, int y, float fZoom, GTask* task, + pLOEvent->m_nPaintTileX = x; + pLOEvent->m_nPaintTileY = y; + pLOEvent->m_fPaintTileZoom = fZoom; +- g_task_set_task_data(task, pLOEvent, g_free); ++ g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); + return m_DummyTile; + } +@@ -107,5 +107,10 @@ Tile& TileBuffer::getTile(int x, int y, float fZoom, GTask* task, + return m_mTiles[index]; + } + ++void LOEvent::destroy(void* pMemory) ++{ ++ LOEvent* pLOEvent = static_cast(pMemory); ++ delete pLOEvent; ++} + + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx +index d4e7120e6587..fdcdd15eddd7 100644 +--- a/libreofficekit/source/gtk/tilebuffer.hxx ++++ b/libreofficekit/source/gtk/tilebuffer.hxx +@@ -237,6 +237,9 @@ struct LOEvent + , m_nSetGraphicSelectionY(0) + { + } ++ ++ /// Wrapper around delete to help GLib. ++ static void destroy(void* pMemory); + }; + + #endif // INCLUDED_TILEBUFFER_HXX +-- +2.12.0 + diff --git a/SOURCES/0164-lok-add-Document-getPartPageRectangles.patch b/SOURCES/0164-lok-add-Document-getPartPageRectangles.patch new file mode 100644 index 0000000..8ead7f6 --- /dev/null +++ b/SOURCES/0164-lok-add-Document-getPartPageRectangles.patch @@ -0,0 +1,248 @@ +From ed4ab7cba0e5f7eaf18b4f10b731d52ae3b8f049 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 29 Sep 2015 10:47:31 +0200 +Subject: [PATCH 164/398] lok: add Document::getPartPageRectangles() + +(cherry picked from commit d355207b45755cfe1eef0147bc25ead931741684) + +Change-Id: I20acd44f7a81471982ba96ad3894a9124e035c5f +--- + desktop/qa/desktop_lib/test_desktop_lib.cxx | 25 +++++++++++++++++++++++++ + desktop/source/lib/init.cxx | 19 +++++++++++++++++++ + include/LibreOfficeKit/LibreOfficeKit.h | 3 +++ + include/LibreOfficeKit/LibreOfficeKit.hxx | 14 ++++++++++++++ + include/vcl/ITiledRenderable.hxx | 8 ++++++++ + sw/inc/crsrsh.hxx | 3 +++ + sw/inc/unotxdoc.hxx | 2 ++ + sw/source/core/crsr/crsrsh.cxx | 14 ++++++++++++++ + sw/source/uibase/uno/unotxdoc.cxx | 11 +++++++++++ + 9 files changed, 99 insertions(+) + +diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx +index d7b93472c1b5..a7696d824bee 100644 +--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx ++++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx +@@ -52,12 +52,14 @@ public: + void testGetFonts(); + void testCreateView(); + void testGetFilterTypes(); ++ void testGetPartPageRectangles(); + + CPPUNIT_TEST_SUITE(DesktopLOKTest); + CPPUNIT_TEST(testGetStyles); + CPPUNIT_TEST(testGetFonts); + CPPUNIT_TEST(testCreateView); + CPPUNIT_TEST(testGetFilterTypes); ++ CPPUNIT_TEST(testGetPartPageRectangles); + CPPUNIT_TEST_SUITE_END(); + + uno::Reference mxComponent; +@@ -152,6 +154,29 @@ void DesktopLOKTest::testCreateView() + closeDoc(); + } + ++void DesktopLOKTest::testGetPartPageRectangles() ++{ ++ // Test that we get as many page rectangles as expected: blank document is ++ // one page. ++ LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); ++ char* pRectangles = pDocument->pClass->getPartPageRectangles(pDocument); ++ OUString sRectangles = OUString::fromUtf8(pRectangles); ++ ++ std::vector aRectangles; ++ sal_Int32 nIndex = 0; ++ do ++ { ++ OUString aRectangle = sRectangles.getToken(0, ';', nIndex); ++ if (!aRectangle.isEmpty()) ++ aRectangles.push_back(aRectangle); ++ } ++ while (nIndex >= 0); ++ CPPUNIT_ASSERT_EQUAL(static_cast(1), aRectangles.size()); ++ ++ free(pRectangles); ++ closeDoc(); ++} ++ + void DesktopLOKTest::testGetFilterTypes() + { + LibLibreOffice_Impl aOffice; +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 5d716abdf8c4..4432ec8ea889 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -203,6 +203,7 @@ static void doc_destroy(LibreOfficeKitDocument* pThis); + static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* pUrl, const char* pFormat, const char* pFilterOptions); + static int doc_getDocumentType(LibreOfficeKitDocument* pThis); + static int doc_getParts(LibreOfficeKitDocument* pThis); ++static char* doc_getPartPageRectangles(LibreOfficeKitDocument* pThis); + static int doc_getPart(LibreOfficeKitDocument* pThis); + static void doc_setPart(LibreOfficeKitDocument* pThis, int nPart); + static char* doc_getPartName(LibreOfficeKitDocument* pThis, int nPart); +@@ -265,6 +266,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference saveAs = doc_saveAs; + m_pDocumentClass->getDocumentType = doc_getDocumentType; + m_pDocumentClass->getParts = doc_getParts; ++ m_pDocumentClass->getPartPageRectangles = doc_getPartPageRectangles; + m_pDocumentClass->getPart = doc_getPart; + m_pDocumentClass->setPart = doc_setPart; + m_pDocumentClass->getPartName = doc_getPartName; +@@ -658,6 +660,23 @@ static void doc_setPart(LibreOfficeKitDocument* pThis, int nPart) + pDoc->setPart( nPart ); + } + ++static char* doc_getPartPageRectangles(LibreOfficeKitDocument* pThis) ++{ ++ ITiledRenderable* pDoc = getTiledRenderable(pThis); ++ if (!pDoc) ++ { ++ gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering"; ++ return 0; ++ } ++ ++ OUString sRectangles = pDoc->getPartPageRectangles(); ++ OString aString = OUStringToOString(sRectangles, RTL_TEXTENCODING_UTF8); ++ char* pMemory = static_cast(malloc(aString.getLength() + 1)); ++ strcpy(pMemory, aString.getStr()); ++ return pMemory; ++ ++} ++ + static char* doc_getPartName(LibreOfficeKitDocument* pThis, int nPart) + { + ITiledRenderable* pDoc = getTiledRenderable(pThis); +diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h +index d5094bdb1b76..d83dd49f32b5 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.h ++++ b/include/LibreOfficeKit/LibreOfficeKit.h +@@ -85,6 +85,9 @@ struct _LibreOfficeKitDocumentClass + /// @see lok::Document::getParts(). + int (*getParts) (LibreOfficeKitDocument* pThis); + ++ /// @see lok::Document::getPartPageRectangles(). ++ char* (*getPartPageRectangles) (LibreOfficeKitDocument* pThis); ++ + /// @see lok::Document::getPart(). + int (*getPart) (LibreOfficeKitDocument* pThis); + +diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx +index 207a9ce6e883..cd12ad64f245 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.hxx ++++ b/include/LibreOfficeKit/LibreOfficeKit.hxx +@@ -76,6 +76,20 @@ public: + return mpDoc->pClass->getParts(mpDoc); + } + ++ /** ++ * Get the logical rectangle of each part in the document. ++ * ++ * A part refers to an individual page in Writer and has no relevant for ++ * Calc or Impress. ++ * ++ * @return a rectangle list, using the same format as ++ * LOK_CALLBACK_TEXT_SELECTION. ++ */ ++ inline char* getPartPageRectangles() ++ { ++ return mpDoc->pClass->getPartPageRectangles(mpDoc); ++ } ++ + /// Get the current part of the document. + inline int getPart() + { +diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx +index 6639745e4a2f..fd336f603296 100644 +--- a/include/vcl/ITiledRenderable.hxx ++++ b/include/vcl/ITiledRenderable.hxx +@@ -139,6 +139,14 @@ public: + * @see lok::Document::resetSelection(). + */ + virtual void resetSelection() = 0; ++ ++ /** ++ * @see lok::Document::getPartPageRectangles(). ++ */ ++ virtual OUString getPartPageRectangles() ++ { ++ return OUString(); ++ } + }; + + } // namespace vcl +diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx +index 073a8dfb1d8d..ee849074cd7d 100644 +--- a/sw/inc/crsrsh.hxx ++++ b/sw/inc/crsrsh.hxx +@@ -852,6 +852,9 @@ public: + @return the textual description of the current selection + */ + OUString GetCrsrDescr() const; ++ ++ /// Implementation of lok::Document::getPartPageRectangles() for Writer. ++ OUString getPageRectangles(); + }; + + // Cursor Inlines: +diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx +index 9f0b03b3af38..311147eeaaea 100644 +--- a/sw/inc/unotxdoc.hxx ++++ b/sw/inc/unotxdoc.hxx +@@ -431,6 +431,8 @@ public: + virtual void setGraphicSelection(int nType, int nX, int nY) SAL_OVERRIDE; + /// @see vcl::ITiledRenderable::resetSelection(). + virtual void resetSelection() SAL_OVERRIDE; ++ /// @see vcl::ITiledRenderable::getPartPageRectangles(). ++ virtual OUString getPartPageRectangles() SAL_OVERRIDE; + + // ::com::sun::star::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 ) throw (::css::uno::RuntimeException, ::std::exception) SAL_OVERRIDE; +diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx +index cbb89aca8868..ffff6a6b2a93 100644 +--- a/sw/source/core/crsr/crsrsh.cxx ++++ b/sw/source/core/crsr/crsrsh.cxx +@@ -1201,6 +1201,20 @@ sal_uInt16 SwCrsrShell::GetPageCnt() + return GetLayout()->GetPageNum(); + } + ++OUString SwCrsrShell::getPageRectangles() ++{ ++ CurrShell aCurr(this); ++ SwRootFrm* pLayout = GetLayout(); ++ std::stringstream ss; ++ for (const SwFrm* pFrm = pLayout->GetLower(); pFrm; pFrm = pFrm->GetNext()) ++ { ++ if (pFrm != pLayout->GetLower()) ++ ss << "; "; ++ ss << pFrm->Frm().Left() << ", " << pFrm->Frm().Top() << ", " << pFrm->Frm().Width() << ", " << pFrm->Frm().Height(); ++ } ++ return OUString::fromUtf8(ss.str().c_str()); ++} ++ + /// go to the next SSelection + bool SwCrsrShell::GoNextCrsr() + { +diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx +index d6315d2964ae..26ab19f170b9 100644 +--- a/sw/source/uibase/uno/unotxdoc.cxx ++++ b/sw/source/uibase/uno/unotxdoc.cxx +@@ -3177,6 +3177,17 @@ int SwXTextDocument::getParts() + return pWrtShell->GetPageCnt(); + } + ++OUString SwXTextDocument::getPartPageRectangles() ++{ ++ SolarMutexGuard aGuard; ++ ++ SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); ++ if (!pWrtShell) ++ return OUString(); ++ ++ return pWrtShell->getPageRectangles(); ++} ++ + int SwXTextDocument::getPart() + { + SolarMutexGuard aGuard; +-- +2.12.0 + diff --git a/SOURCES/0165-coverity-1325053-Dereference-after-null-check.patch b/SOURCES/0165-coverity-1325053-Dereference-after-null-check.patch new file mode 100644 index 0000000..e872274 --- /dev/null +++ b/SOURCES/0165-coverity-1325053-Dereference-after-null-check.patch @@ -0,0 +1,37 @@ +From e8191e29362314214d09dd774ab6993d076d852d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= +Date: Tue, 29 Sep 2015 09:41:01 +0100 +Subject: [PATCH 165/398] coverity#1325053 Dereference after null check + +pre-change !pSh logic inverted at + +commit 1b15f4863e6d4b0a280ccd61713cbb1209ffe33e +Author: Miklos Vajna +Date: Fri Feb 6 12:12:02 2015 +0100 + + LOK: add LOK_CALLBACK_TEXT_SELECTION and implement it in sw + + Change-Id: I31662cb06add0d1a1c517b5f5416703aeaae1e77 + +Change-Id: If42741c4efce943aaff5081a1a75108470b2a488 +(cherry picked from commit 4a031d7c971558f89693925bb504c1157ab6bd04) +--- + sw/source/core/layout/trvlfrm.cxx | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx +index 65aa24f69e72..aec74f35feb3 100644 +--- a/sw/source/core/layout/trvlfrm.cxx ++++ b/sw/source/core/layout/trvlfrm.cxx +@@ -2019,7 +2019,7 @@ void SwRootFrm::CalcFrmRects(SwShellCrsr &rCrsr) + + SwViewShell *pSh = GetCurrShell(); + +- bool bIgnoreVisArea = false; ++ bool bIgnoreVisArea = true; + if (pSh) + bIgnoreVisArea = pSh->GetViewOptions()->IsPDFExport() || pSh->isTiledRendering(); + +-- +2.12.0 + diff --git a/SOURCES/0166-lokdocview-Reset-view-completely.patch b/SOURCES/0166-lokdocview-Reset-view-completely.patch new file mode 100644 index 0000000..76067c6 --- /dev/null +++ b/SOURCES/0166-lokdocview-Reset-view-completely.patch @@ -0,0 +1,74 @@ +From 54cbf52419e6318c2cdf19232f79a515ffb6e7f6 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Thu, 24 Sep 2015 18:47:01 +0200 +Subject: [PATCH 166/398] lokdocview: Reset view completely + +Resetting tiles only is not enough. We need to empty stale +selection rectangles, handle bars, cursor positions etc., so that +they do not interfere with next view to be opened using same +widget instance. + +We are not destroying the document here, so the widget would +still point to the same document unless it is made to point to +another document by subsequent lok_doc_view_open_document calls. + +Change-Id: I3c7cc789c8c7393b3793b4edf6aa96d54bc0b1a3 +Reviewed-on: https://gerrit.libreoffice.org/18866 +Reviewed-by: Miklos Vajna +Tested-by: Miklos Vajna +(cherry picked from commit c3ce35f0a12af2887b10987f76675174563487d7) +--- + libreofficekit/source/gtk/lokdocview.cxx | 37 ++++++++++++++++++++++++++++++++ + 1 file changed, 37 insertions(+) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 6679cee56cd3..99476764e69d 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -1986,6 +1986,43 @@ lok_doc_view_reset_view(LOKDocView* pDocView) + { + LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); + priv->m_aTileBuffer.resetAllTiles(); ++ priv->m_nLoadProgress = 0.0; ++ ++ memset(&priv->m_aVisibleCursor, 0, sizeof(priv->m_aVisibleCursor)); ++ priv->m_bCursorOverlayVisible = false; ++ priv->m_bCursorVisible = false; ++ ++ priv->m_nLastButtonPressTime = 0; ++ priv->m_nLastButtonReleaseTime = 0; ++ priv->m_aTextSelectionRectangles.clear(); ++ ++ memset(&priv->m_aTextSelectionStart, 0, sizeof(priv->m_aTextSelectionStart)); ++ memset(&priv->m_aTextSelectionEnd, 0, sizeof(priv->m_aTextSelectionEnd)); ++ memset(&priv->m_aGraphicSelection, 0, sizeof(priv->m_aGraphicSelection)); ++ priv->m_bInDragGraphicSelection = false; ++ ++ cairo_surface_destroy(priv->m_pHandleStart); ++ priv->m_pHandleStart = 0; ++ memset(&priv->m_aHandleStartRect, 0, sizeof(priv->m_aHandleStartRect)); ++ priv->m_bInDragStartHandle = false; ++ ++ cairo_surface_destroy(priv->m_pHandleMiddle); ++ priv->m_pHandleMiddle = 0; ++ memset(&priv->m_aHandleMiddleRect, 0, sizeof(priv->m_aHandleMiddleRect)); ++ priv->m_bInDragMiddleHandle = false; ++ ++ cairo_surface_destroy(priv->m_pHandleEnd); ++ priv->m_pHandleEnd = 0; ++ memset(&priv->m_aHandleEndRect, 0, sizeof(priv->m_aHandleEndRect)); ++ priv->m_bInDragEndHandle = false; ++ ++ cairo_surface_destroy(priv->m_pGraphicHandle); ++ priv->m_pGraphicHandle = 0; ++ memset(&priv->m_aGraphicHandleRects, 0, sizeof(priv->m_aGraphicHandleRects)); ++ memset(&priv->m_bInDragGraphicHandles, 0, sizeof(priv->m_bInDragGraphicHandles)); ++ ++ priv->m_nViewId = 0; ++ + gtk_widget_queue_draw(GTK_WIDGET(pDocView)); + } + +-- +2.12.0 + diff --git a/SOURCES/0167-Impress-set-current-page-Id-before-showing-the-new-p.patch b/SOURCES/0167-Impress-set-current-page-Id-before-showing-the-new-p.patch new file mode 100644 index 0000000..3de3ba1 --- /dev/null +++ b/SOURCES/0167-Impress-set-current-page-Id-before-showing-the-new-p.patch @@ -0,0 +1,61 @@ +From f7c573ccf8878bcd12babfe64ceca60252c967e6 Mon Sep 17 00:00:00 2001 +From: Mihai Varga +Date: Fri, 7 Aug 2015 09:03:26 +0300 +Subject: [PATCH 167/398] Impress: set current page Id before showing the new + page + +For tiled rendering this has the effect of not invalidating the +previous slide when switching slides. After switching slides, an +invalidation occurs caused by showing the new slide, and calling +'GetPart' before 'SwitchPage' finishes returned the old part number. + +Change-Id: I1cafd0e51cd39be3a80d0559ae3051238b8df744 +Reviewed-on: https://gerrit.libreoffice.org/17562 +Tested-by: Jenkins +Reviewed-by: Samuel Mehrbrodt +Tested-by: Samuel Mehrbrodt +(cherry picked from commit 45576ea3b3c19d8fe545e984bf23708df90b1990) +--- + sd/source/ui/view/drviews1.cxx | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx +index ec192473ec6e..3b749419e860 100644 +--- a/sd/source/ui/view/drviews1.cxx ++++ b/sd/source/ui/view/drviews1.cxx +@@ -964,6 +964,7 @@ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage) + } + + mpDrawView->HideSdrPage(); ++ maTabControl->SetCurPageId(nSelectedPage+1); + mpDrawView->ShowSdrPage(mpActualPage); + GetViewShellBase().GetDrawController().FireSwitchCurrentPage(mpActualPage); + +@@ -989,7 +990,6 @@ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage) + } + } + +- maTabControl->SetCurPageId(nSelectedPage+1); + OUString aPageName = mpActualPage->GetName(); + + if (maTabControl->GetPageText(nSelectedPage+1) != aPageName) +@@ -1025,6 +1025,7 @@ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage) + } + + mpDrawView->HideSdrPage(); ++ maTabControl->SetCurPageId(nSelectedPage+1); + + SdPage* pMaster = GetDoc()->GetMasterSdPage(nSelectedPage, mePageKind); + +@@ -1063,8 +1064,6 @@ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage) + if (nPos != -1) + aLayoutName = aLayoutName.copy(0, nPos); + +- maTabControl->SetCurPageId(nSelectedPage+1); +- + if (maTabControl->GetPageText(nSelectedPage+1) != aLayoutName) + { + maTabControl->SetPageText(nSelectedPage+1, aLayoutName); +-- +2.12.0 + diff --git a/SOURCES/0168-desktop-vcl-support-transparency-in-VirtualDevices-w.patch b/SOURCES/0168-desktop-vcl-support-transparency-in-VirtualDevices-w.patch new file mode 100644 index 0000000..7131561 --- /dev/null +++ b/SOURCES/0168-desktop-vcl-support-transparency-in-VirtualDevices-w.patch @@ -0,0 +1,131 @@ +From 4678c8d368c3accd85c57745cf58218f5ea1b907 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Thu, 1 Oct 2015 14:17:21 +0200 +Subject: [PATCH 168/398] desktop, vcl: support transparency in VirtualDevices + with user-provided memory + +Change-Id: I65c31995c02a644aa436aecd065255fab38045e4 +(cherry picked from commit 1d3b613318654ceb2d34996ef8ca653cfe32a8ea) +--- + desktop/source/lib/init.cxx | 24 +++++++++++++++++++++++- + include/vcl/virdev.hxx | 2 ++ + vcl/source/gdi/virdev.cxx | 12 ++++++++---- + 3 files changed, 33 insertions(+), 5 deletions(-) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 4432ec8ea889..1f87146bacf8 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -754,10 +754,21 @@ void doc_paintTile (LibreOfficeKitDocument* pThis, + InitSvpForLibreOfficeKit(); + + ScopedVclPtrInstance< VirtualDevice > pDevice(nullptr, Size(1, 1), (sal_uInt16)32) ; ++ ++ // Set background to transparent by default. ++ memset(pBuffer, 0, nCanvasWidth * nCanvasHeight * 4); ++ pDevice->SetBackground(Wallpaper(Color(COL_TRANSPARENT))); ++ + boost::shared_array< sal_uInt8 > aBuffer( pBuffer, NoDelete< sal_uInt8 >() ); ++ ++ // Allocate a separate buffer for the alpha device. ++ std::vector aAlpha(nCanvasWidth * nCanvasHeight); ++ memset(aAlpha.data(), 0, nCanvasWidth * nCanvasHeight); ++ boost::shared_array aAlphaBuffer(aAlpha.data(), NoDelete()); ++ + pDevice->SetOutputSizePixelScaleOffsetAndBuffer( + Size(nCanvasWidth, nCanvasHeight), Fraction(1.0), Point(), +- aBuffer, true ); ++ aBuffer, aAlphaBuffer, true ); + + pDoc->paintTile(*pDevice.get(), nCanvasWidth, nCanvasHeight, + nTilePosX, nTilePosY, nTileWidth, nTileHeight); +@@ -771,6 +782,17 @@ void doc_paintTile (LibreOfficeKitDocument* pThis, + nTilePosX, nTilePosY, nTileWidth, nTileHeight); + #endif + ++ // Overwrite pBuffer's alpha channel with the separate alpha buffer. ++ for (int nRow = 0; nRow < nCanvasHeight; ++nRow) ++ { ++ for (int nCol = 0; nCol < nCanvasWidth; ++nCol) ++ { ++ const int nOffset = (nCanvasHeight * nRow) + nCol; ++ // VCL's transparent is 0, RGBA's transparent is 0xff. ++ pBuffer[nOffset * 4 +3] = 0xff - aAlpha[nOffset]; ++ } ++ } ++ + static bool bDebug = getenv("LOK_DEBUG") != 0; + if (bDebug) + { +diff --git a/include/vcl/virdev.hxx b/include/vcl/virdev.hxx +index 3720a19c98f3..85e0afd78131 100644 +--- a/include/vcl/virdev.hxx ++++ b/include/vcl/virdev.hxx +@@ -48,6 +48,7 @@ private: + const bool bTopDown ); + SAL_DLLPRIVATE bool ImplSetOutputSizePixel( const Size& rNewSize, bool bErase, + const basebmp::RawMemorySharedArray &pBuffer, ++ const basebmp::RawMemorySharedArray &pAlphaBuffer, + const bool bTopDown ); + + VirtualDevice (const VirtualDevice &) SAL_DELETED_FUNCTION; +@@ -127,6 +128,7 @@ public: + const Fraction& rScale, + const Point& rNewOffset, + const basebmp::RawMemorySharedArray &pBuffer, ++ const basebmp::RawMemorySharedArray &pAlphaBuffer, + const bool bTopDown = false ); + bool SetOutputSize( const Size& rNewSize, bool bErase = true ) + { return SetOutputSizePixel( LogicToPixel( rNewSize ), bErase ); } +diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx +index b24378de4b25..ee44d30267e8 100644 +--- a/vcl/source/gdi/virdev.cxx ++++ b/vcl/source/gdi/virdev.cxx +@@ -393,6 +393,7 @@ void VirtualDevice::ImplFillOpaqueRectangle( const Rectangle& rRect ) + + bool VirtualDevice::ImplSetOutputSizePixel( const Size& rNewSize, bool bErase, + const basebmp::RawMemorySharedArray &pBuffer, ++ const basebmp::RawMemorySharedArray &pAlphaBuffer, + const bool bTopDown ) + { + if( InnerImplSetOutputSizePixel(rNewSize, bErase, pBuffer, bTopDown) ) +@@ -409,7 +410,7 @@ bool VirtualDevice::ImplSetOutputSizePixel( const Size& rNewSize, bool bErase, + { + mpAlphaVDev = VclPtr::Create( *this, mnAlphaDepth ); + mpAlphaVDev->InnerImplSetOutputSizePixel(rNewSize, bErase, +- basebmp::RawMemorySharedArray(), ++ pAlphaBuffer, + bTopDown ); + } + +@@ -443,13 +444,16 @@ void VirtualDevice::EnableRTL( bool bEnable ) + + bool VirtualDevice::SetOutputSizePixel( const Size& rNewSize, bool bErase ) + { +- return ImplSetOutputSizePixel( rNewSize, bErase, basebmp::RawMemorySharedArray(), false ); ++ return ImplSetOutputSizePixel( rNewSize, bErase, basebmp::RawMemorySharedArray(), basebmp::RawMemorySharedArray(), false ); + } + + bool VirtualDevice::SetOutputSizePixelScaleOffsetAndBuffer( + const Size& rNewSize, const Fraction& rScale, const Point& rNewOffset, +- const basebmp::RawMemorySharedArray &pBuffer, const bool bTopDown ) ++ const basebmp::RawMemorySharedArray &pBuffer, const basebmp::RawMemorySharedArray &pAlphaBuffer, const bool bTopDown ) + { ++ if (pAlphaBuffer) ++ mnAlphaDepth = 8; ++ + if (pBuffer) { + MapMode mm = GetMapMode(); + mm.SetOrigin( rNewOffset ); +@@ -457,7 +461,7 @@ bool VirtualDevice::SetOutputSizePixelScaleOffsetAndBuffer( + mm.SetScaleY( rScale ); + SetMapMode( mm ); + } +- return ImplSetOutputSizePixel( rNewSize, true, pBuffer, bTopDown ); ++ return ImplSetOutputSizePixel( rNewSize, true, pBuffer, pAlphaBuffer, bTopDown ); + } + + void VirtualDevice::SetReferenceDevice( RefDevMode i_eRefDevMode ) +-- +2.12.0 + diff --git a/SOURCES/0169-sw-tiled-rendering-default-to-transparent-background.patch b/SOURCES/0169-sw-tiled-rendering-default-to-transparent-background.patch new file mode 100644 index 0000000..1f5d6f8 --- /dev/null +++ b/SOURCES/0169-sw-tiled-rendering-default-to-transparent-background.patch @@ -0,0 +1,36 @@ +From 6b9ab42904f9e37935834528bf360a2a6e3da70b Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Thu, 1 Oct 2015 16:43:00 +0200 +Subject: [PATCH 169/398] sw tiled rendering: default to transparent background + outside page frames + +Change-Id: Ie018a878eb7d7ef14a80a6b86020c114ff14da88 +(cherry picked from commit 4fe010cce872ef035fec376298e416f9799c4a21) +--- + sw/source/uibase/config/viewopt.cxx | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/sw/source/uibase/config/viewopt.cxx b/sw/source/uibase/config/viewopt.cxx +index 190a6e3b5d72..7597589f0657 100644 +--- a/sw/source/uibase/config/viewopt.cxx ++++ b/sw/source/uibase/config/viewopt.cxx +@@ -38,6 +38,7 @@ + #include + + #include ++#include + + #ifdef DBG_UTIL + bool SwViewOption::s_bTest9 = false; //DrawingLayerNotLoading +@@ -206,6 +207,8 @@ SwViewOption::SwViewOption() : + m_bTest1 = m_bTest2 = m_bTest3 = m_bTest4 = + m_bTest5 = m_bTest6 = m_bTest7 = m_bTest8 = m_bTest10 = false; + #endif ++ if (comphelper::LibreOfficeKit::isActive()) ++ aAppBackgroundColor = COL_TRANSPARENT; + } + + SwViewOption::SwViewOption(const SwViewOption& rVOpt) +-- +2.12.0 + diff --git a/SOURCES/0170-vcl-tiled-rendering-avoid-Pixel-represents-color-val.patch b/SOURCES/0170-vcl-tiled-rendering-avoid-Pixel-represents-color-val.patch new file mode 100644 index 0000000..f3ba88e --- /dev/null +++ b/SOURCES/0170-vcl-tiled-rendering-avoid-Pixel-represents-color-val.patch @@ -0,0 +1,41 @@ +From 95c0e2be5e09f8e658295ea12f814706664c431f Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 2 Oct 2015 10:31:35 +0200 +Subject: [PATCH 170/398] vcl tiled rendering: avoid 'Pixel represents color + values!' warnings + +Which happens e.g. during rendering tiles: +OutputDevice::BlendBitmapWithAlpha() produces an RGB alpha +(255,255,255), then tries to set a pixel in the 8bit alpha channel using +it, so when BitmapReadAccess::SetPixelFor_8BIT_PAL() tries to get the +color index, we try to get it from a color that is not indexed. + +Let's assume that when the color is not indexed, it's always gray, so it +doesn't matter what color we pick for the alpha mask needs. + +Change-Id: I325c1d70514fd176fdc9cc39683b444447adf07f +(cherry picked from commit 4caaa09d4da0f7bd5aa0fae3233d66bd977f185e) +--- + vcl/source/gdi/bmpacc2.cxx | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/vcl/source/gdi/bmpacc2.cxx b/vcl/source/gdi/bmpacc2.cxx +index d664c4b769fd..286ea8fca26a 100644 +--- a/vcl/source/gdi/bmpacc2.cxx ++++ b/vcl/source/gdi/bmpacc2.cxx +@@ -79,7 +79,11 @@ BitmapColor BitmapReadAccess::GetPixelFor_8BIT_PAL(ConstScanline pScanline, long + + void BitmapReadAccess::SetPixelFor_8BIT_PAL(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&) + { +- pScanline[ nX ] = rBitmapColor.GetIndex(); ++ if (rBitmapColor.IsIndex()) ++ pScanline[ nX ] = rBitmapColor.GetIndex(); ++ else ++ // Let's hope that the RGB color values equal, so it doesn't matter what do we pick ++ pScanline[ nX ] = rBitmapColor.GetBlueOrIndex(); + } + + BitmapColor BitmapReadAccess::GetPixelFor_8BIT_TC_MASK(ConstScanline pScanline, long nX, const ColorMask& rMask) +-- +2.12.0 + diff --git a/SOURCES/0171-desktop-handle-sal_uInt16-in-jsonToPropertyValues.patch b/SOURCES/0171-desktop-handle-sal_uInt16-in-jsonToPropertyValues.patch new file mode 100644 index 0000000..5ed99c9 --- /dev/null +++ b/SOURCES/0171-desktop-handle-sal_uInt16-in-jsonToPropertyValues.patch @@ -0,0 +1,27 @@ +From ea4aefaba7c4a6ad4e33b2a85f1802243696d293 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Mon, 5 Oct 2015 11:29:02 +0200 +Subject: [PATCH 171/398] desktop: handle sal_uInt16 in jsonToPropertyValues() + +Change-Id: Ic0059404b7ccbc922703705e7818404d4904f324 +(cherry picked from commit 44838c669b6bd02e14c394aebd9d19bcbf5ff409) +--- + desktop/source/lib/init.cxx | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 1f87146bacf8..a1356aa02ca1 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -902,6 +902,8 @@ static void jsonToPropertyValues(const char* pJSON, uno::Sequence(OString(rValue.c_str()).toUInt32()); + else + SAL_WARN("desktop.lib", "jsonToPropertyValues: unhandled type '"< +Date: Mon, 5 Oct 2015 11:29:28 +0200 +Subject: [PATCH 172/398] LOK: add CALLBACK_SEARCH_RESULT_COUNT and implement + in sw + +Change-Id: I616b3f6d2881aaa479f6498d3121540980256c15 +(cherry picked from commit 6c040ad18bd7b5a2d1d11130f4dbfd1c9d90055d) +--- + include/LibreOfficeKit/LibreOfficeKitEnums.h | 4 +++- + sw/source/uibase/uiview/viewsrch.cxx | 8 +++++++- + 2 files changed, 10 insertions(+), 2 deletions(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h +index 7038e5fc8cc2..dc3e0f94f3dc 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h ++++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h +@@ -155,7 +155,9 @@ typedef enum + * + * Payload is a single 0-based integer. + */ +- LOK_CALLBACK_SET_PART ++ LOK_CALLBACK_SET_PART, ++ /// Number of search results, in case something is found. ++ LOK_CALLBACK_SEARCH_RESULT_COUNT + } + LibreOfficeKitCallbackType; + +diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx +index 28fc2c920ac3..11764126e165 100644 +--- a/sw/source/uibase/uiview/viewsrch.cxx ++++ b/sw/source/uibase/uiview/viewsrch.cxx +@@ -209,7 +209,8 @@ void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage) + break; + case SvxSearchCmd::FIND_ALL: + { +- bool bRet = SearchAll(); ++ sal_uInt16 nFound = 0; ++ bool bRet = SearchAll(&nFound); + if( !bRet ) + { + #if HAVE_FEATURE_DESKTOP +@@ -222,6 +223,11 @@ void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage) + #endif + m_bFound = false; + } ++ else ++ { ++ OString aPayload = OString::number(nFound); ++ m_pWrtShell->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_RESULT_COUNT, aPayload.getStr()); ++ } + rReq.SetReturnValue(SfxBoolItem(nSlot, bRet)); + #if HAVE_FEATURE_DESKTOP + { +-- +2.12.0 + diff --git a/SOURCES/0173-lokdocview-handle-LOK_CALLBACK_SEARCH_RESULT_COUNT.patch b/SOURCES/0173-lokdocview-handle-LOK_CALLBACK_SEARCH_RESULT_COUNT.patch new file mode 100644 index 0000000..934713c --- /dev/null +++ b/SOURCES/0173-lokdocview-handle-LOK_CALLBACK_SEARCH_RESULT_COUNT.patch @@ -0,0 +1,109 @@ +From 31ae1232bbde5ca3d74481dad1c9d70bab999c73 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Mon, 5 Oct 2015 11:30:15 +0200 +Subject: [PATCH 173/398] lokdocview: handle LOK_CALLBACK_SEARCH_RESULT_COUNT + +Change-Id: I0d1b641654e0de65169e19bb5843ea11b43a90a3 +(cherry picked from commit 22d342a82f225381057b5b8b941be8583de87a63) +--- + .../qa/gtktiledviewer/gtktiledviewer.cxx | 9 +++++++ + libreofficekit/source/gtk/lokdocview.cxx | 28 ++++++++++++++++++++++ + 2 files changed, 37 insertions(+) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 46264eb0126b..852bee584dfb 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -386,6 +386,14 @@ static void signalSearch(LOKDocView* pLOKDocView, char* /*pPayload*/, gpointer / + gtk_label_set_text(GTK_LABEL(rWindow.m_pFindbarLabel), "Search key not found"); + } + ++/// LOKDocView found some search matches -> set the search label accordingly. ++static void signalSearchResultCount(LOKDocView* pLOKDocView, char* pPayload, gpointer /*pData*/) ++{ ++ TiledWindow& rWindow = lcl_getTiledWindow(GTK_WIDGET(pLOKDocView)); ++ std::stringstream ss; ++ ss << pPayload << " match(es)"; ++ gtk_label_set_text(GTK_LABEL(rWindow.m_pFindbarLabel), ss.str().c_str()); ++} + + static void signalPart(LOKDocView* pLOKDocView, int nPart, gpointer /*pData*/) + { +@@ -763,6 +771,7 @@ static void setupDocView(GtkWidget* pDocView) + g_signal_connect(pDocView, "edit-changed", G_CALLBACK(signalEdit), NULL); + g_signal_connect(pDocView, "command-changed", G_CALLBACK(signalCommand), NULL); + g_signal_connect(pDocView, "search-not-found", G_CALLBACK(signalSearch), NULL); ++ g_signal_connect(pDocView, "search-result-count", G_CALLBACK(signalSearchResultCount), NULL); + g_signal_connect(pDocView, "part-changed", G_CALLBACK(signalPart), NULL); + g_signal_connect(pDocView, "size-changed", G_CALLBACK(signalSize), NULL); + g_signal_connect(pDocView, "hyperlink-clicked", G_CALLBACK(signalHyperlink), NULL); +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 99476764e69d..3aa4cabeb76c 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -121,6 +121,7 @@ enum + SIZE_CHANGED, + HYPERLINK_CLICKED, + CURSOR_CHANGED, ++ SEARCH_RESULT_COUNT, + + LAST_SIGNAL + }; +@@ -221,6 +222,8 @@ callbackTypeToString (int nType) + return "LOK_CALLBACK_STATUS_INDICATOR_FINISH"; + case LOK_CALLBACK_SEARCH_NOT_FOUND: + return "LOK_CALLBACK_SEARCH_NOT_FOUND"; ++ case LOK_CALLBACK_SEARCH_RESULT_COUNT: ++ return "LOK_CALLBACK_SEARCH_RESULT_COUNT"; + case LOK_CALLBACK_DOCUMENT_SIZE_CHANGED: + return "LOK_CALLBACK_DOCUMENT_SIZE_CHANGED"; + case LOK_CALLBACK_SET_PART: +@@ -363,6 +366,11 @@ searchNotFound(LOKDocView* pDocView, const std::string& rString) + g_signal_emit(pDocView, doc_view_signals[SEARCH_NOT_FOUND], 0, rString.c_str()); + } + ++static void searchResultCount(LOKDocView* pDocView, const std::string& rString) ++{ ++ g_signal_emit(pDocView, doc_view_signals[SEARCH_RESULT_COUNT], 0, rString.c_str()); ++} ++ + static void + setPart(LOKDocView* pDocView, const std::string& rString) + { +@@ -645,6 +653,11 @@ callback (gpointer pData) + setPart(pDocView, pCallback->m_aPayload); + } + break; ++ case LOK_CALLBACK_SEARCH_RESULT_COUNT: ++ { ++ searchResultCount(pDocView, pCallback->m_aPayload); ++ } ++ break; + default: + g_assert(false); + break; +@@ -1841,6 +1854,21 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + G_TYPE_NONE, 4, + G_TYPE_INT, G_TYPE_INT, + G_TYPE_INT, G_TYPE_INT); ++ /** ++ * LOKDocView::search-result-count: ++ * @pDocView: the #LOKDocView on which the signal is emitted ++ * @aCommand: number of matches. ++ */ ++ doc_view_signals[SEARCH_RESULT_COUNT] = ++ g_signal_new("search-result_count", ++ G_TYPE_FROM_CLASS(pGObjectClass), ++ G_SIGNAL_RUN_FIRST, ++ 0, ++ NULL, NULL, ++ g_cclosure_marshal_VOID__STRING, ++ G_TYPE_NONE, 1, ++ G_TYPE_STRING); ++ + } + + SAL_DLLPUBLIC_EXPORT GtkWidget* +-- +2.12.0 + diff --git a/SOURCES/0174-gtktiledviewer-make-it-possible-to-trigger-SearchIte.patch b/SOURCES/0174-gtktiledviewer-make-it-possible-to-trigger-SearchIte.patch new file mode 100644 index 0000000..e9da37d --- /dev/null +++ b/SOURCES/0174-gtktiledviewer-make-it-possible-to-trigger-SearchIte.patch @@ -0,0 +1,76 @@ +From 34aa1adc51adf0da82774b0da1194870a0d90241 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Mon, 5 Oct 2015 11:39:11 +0200 +Subject: [PATCH 174/398] gtktiledviewer: make it possible to trigger + SearchItem.Command + +Change-Id: I210da07802bae1f2f2948976bc0faf90e93152b4 +(cherry picked from commit aa3f607f80a2269ca2e1f8a5805d2e0b4cd36d7e) +--- + .../qa/gtktiledviewer/gtktiledviewer.cxx | 22 +++++++++++++++++++++- + 1 file changed, 21 insertions(+), 1 deletion(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 852bee584dfb..ed97a6743b38 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -53,6 +53,7 @@ public: + GtkWidget* m_pFindbar; + GtkWidget* m_pFindbarEntry; + GtkWidget* m_pFindbarLabel; ++ bool m_bFindAll; + + TiledWindow() + : m_pDocView(0), +@@ -70,7 +71,8 @@ public: + m_bPartSelectorBroadcast(true), + m_pFindbar(0), + m_pFindbarEntry(0), +- m_pFindbarLabel(0) ++ m_pFindbarLabel(0), ++ m_bFindAll(false) + { + } + }; +@@ -178,6 +180,13 @@ static void toggleEditing(GtkWidget* pButton, gpointer /*pItem*/) + lok_doc_view_set_edit(pLOKDocView, bActive); + } + ++/// Toggles if search should find all results or only the first one. ++static void toggleFindAll(GtkWidget* pButton, gpointer /*pItem*/) ++{ ++ TiledWindow& rWindow = lcl_getTiledWindow(pButton); ++ rWindow.m_bFindAll = !rWindow.m_bFindAll; ++} ++ + /// Toggle the visibility of the findbar. + static void toggleFindbar(GtkWidget* pButton, gpointer /*pItem*/) + { +@@ -284,6 +293,12 @@ static void doSearch(GtkWidget* pButton, bool bBackwards) + aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchString/value", '/'), pText); + aTree.put(boost::property_tree::ptree::path_type("SearchItem.Backward/type", '/'), "boolean"); + aTree.put(boost::property_tree::ptree::path_type("SearchItem.Backward/value", '/'), bBackwards); ++ if (rWindow.m_bFindAll) ++ { ++ aTree.put(boost::property_tree::ptree::path_type("SearchItem.Command/type", '/'), "unsigned short"); ++ // SvxSearchCmd::FIND_ALL ++ aTree.put(boost::property_tree::ptree::path_type("SearchItem.Command/value", '/'), "1"); ++ } + + LOKDocView* pLOKDocView = LOK_DOC_VIEW(rWindow.m_pDocView); + GdkRectangle aArea; +@@ -729,6 +744,11 @@ static GtkWidget* createWindow(TiledWindow& rWindow) + gtk_toolbar_insert(GTK_TOOLBAR(rWindow.m_pFindbar), pFindbarPrev, -1); + g_signal_connect(G_OBJECT(pFindbarPrev), "clicked", G_CALLBACK(signalSearchPrev), NULL); + ++ GtkToolItem* pFindAll = gtk_toggle_tool_button_new(); ++ gtk_tool_button_set_label(GTK_TOOL_BUTTON(pFindAll), "Highlight All"); ++ gtk_toolbar_insert(GTK_TOOLBAR(rWindow.m_pFindbar), pFindAll, -1); ++ g_signal_connect(G_OBJECT(pFindAll), "toggled", G_CALLBACK(toggleFindAll), NULL); ++ + GtkToolItem* pFindbarLabelContainer = gtk_tool_item_new(); + rWindow.m_pFindbarLabel = gtk_label_new(""); + gtk_container_add(GTK_CONTAINER(pFindbarLabelContainer), rWindow.m_pFindbarLabel); +-- +2.12.0 + diff --git a/SOURCES/0175-LOK-added-the-button-type-and-key-modifier-to-postMo.patch b/SOURCES/0175-LOK-added-the-button-type-and-key-modifier-to-postMo.patch new file mode 100644 index 0000000..12b8aec --- /dev/null +++ b/SOURCES/0175-LOK-added-the-button-type-and-key-modifier-to-postMo.patch @@ -0,0 +1,397 @@ +From 44f959673e66d68d9933074157a310f2908964fe Mon Sep 17 00:00:00 2001 +From: Mihai Varga +Date: Sun, 4 Oct 2015 19:40:13 +0300 +Subject: [PATCH 175/398] LOK: added the button type and key modifier to + postMouseEvent() + +To get a better functionality we need to know the button type (left, +right, middle). We also need the key modifier (ctrl, alt, shift) for +actions such as ctrl+click (to open a link) or shift+click to select + +Change-Id: Iaccb93b276f8a6870dd41cc5132dbb85d2bbf71b +(cherry picked from commit c90c08a65c480a1012182979d5e9218f17a2ba2e) +--- + desktop/source/lib/init.cxx | 8 ++-- + include/LibreOfficeKit/LibreOfficeKit.h | 4 +- + include/LibreOfficeKit/LibreOfficeKit.hxx | 4 +- + include/vcl/ITiledRenderable.hxx | 2 +- + libreofficekit/Library_libreofficekitgtk.mk | 4 ++ + libreofficekit/source/gtk/lokdocview.cxx | 57 ++++++++++++++++++++++++++++- + libreofficekit/source/gtk/tilebuffer.hxx | 4 ++ + sc/inc/docuno.hxx | 3 +- + sc/source/ui/unoobj/docuno.cxx | 5 ++- + sd/source/ui/inc/unomodel.hxx | 3 +- + sd/source/ui/unoidl/unomodel.cxx | 5 ++- + sw/inc/unotxdoc.hxx | 3 +- + sw/source/uibase/uno/unotxdoc.cxx | 4 +- + 13 files changed, 88 insertions(+), 18 deletions(-) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index a1356aa02ca1..29e8e0d12faa 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -229,7 +229,9 @@ static void doc_postMouseEvent (LibreOfficeKitDocument* pThis, + int nType, + int nX, + int nY, +- int nCount); ++ int nCount, ++ int nButtons, ++ int nModifier); + static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, + const char* pCommand, + const char* pArguments); +@@ -924,7 +926,7 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* /*pThis*/, const char* pC + } + } + +-static void doc_postMouseEvent(LibreOfficeKitDocument* pThis, int nType, int nX, int nY, int nCount) ++static void doc_postMouseEvent(LibreOfficeKitDocument* pThis, int nType, int nX, int nY, int nCount, int nButtons, int nModifier) + { + ITiledRenderable* pDoc = getTiledRenderable(pThis); + if (!pDoc) +@@ -933,7 +935,7 @@ static void doc_postMouseEvent(LibreOfficeKitDocument* pThis, int nType, int nX, + return; + } + +- pDoc->postMouseEvent(nType, nX, nY, nCount); ++ pDoc->postMouseEvent(nType, nX, nY, nCount, nButtons, nModifier); + } + + static void doc_setTextSelection(LibreOfficeKitDocument* pThis, int nType, int nX, int nY) +diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h +index d83dd49f32b5..83dcc9803d8a 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.h ++++ b/include/LibreOfficeKit/LibreOfficeKit.h +@@ -137,7 +137,9 @@ struct _LibreOfficeKitDocumentClass + int nType, + int nX, + int nY, +- int nCount); ++ int nCount, ++ int nButtons, ++ int nModifier); + + /// @see lok::Document::postUnoCommand + void (*postUnoCommand) (LibreOfficeKitDocument* pThis, +diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx +index cd12ad64f245..e9167c510110 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.hxx ++++ b/include/LibreOfficeKit/LibreOfficeKit.hxx +@@ -192,9 +192,9 @@ public: + * @param nY vertical position in document coordinates + * @param nCount number of clicks: 1 for single click, 2 for double click + */ +- inline void postMouseEvent(int nType, int nX, int nY, int nCount) ++ inline void postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier) + { +- mpDoc->pClass->postMouseEvent(mpDoc, nType, nX, nY, nCount); ++ mpDoc->pClass->postMouseEvent(mpDoc, nType, nX, nY, nCount, nButtons, nModifier); + } + + /** +diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx +index fd336f603296..c294d20dc9cf 100644 +--- a/include/vcl/ITiledRenderable.hxx ++++ b/include/vcl/ITiledRenderable.hxx +@@ -112,7 +112,7 @@ public: + * + * @see lok::Document::postMouseEvent(). + */ +- virtual void postMouseEvent(int nType, int nX, int nY, int nCount) = 0; ++ virtual void postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier) = 0; + + /** + * Sets the start or end of a text selection. +diff --git a/libreofficekit/Library_libreofficekitgtk.mk b/libreofficekit/Library_libreofficekitgtk.mk +index 71a77e9e36a3..7d25abf944b1 100644 +--- a/libreofficekit/Library_libreofficekitgtk.mk ++++ b/libreofficekit/Library_libreofficekitgtk.mk +@@ -16,6 +16,10 @@ $(eval $(call gb_Library_add_exception_objects,libreofficekitgtk,\ + libreofficekit/source/gtk/tilebuffer \ + )) + ++$(eval $(call gb_Library_use_externals,libreofficekitgtk,\ ++ boost_headers \ ++)) ++ + $(eval $(call gb_Library_add_cxxflags,libreofficekitgtk,\ + $$(GTK3_CFLAGS) \ + )) +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 3aa4cabeb76c..0bd735088586 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + + #include "tilebuffer.hxx" + +@@ -66,6 +67,10 @@ struct _LOKDocViewPrivate + guint32 m_nLastButtonPressTime; + /// Time of the last button release. + guint32 m_nLastButtonReleaseTime; ++ /// Last pressed button (left, right, middle) ++ guint32 m_nLastButtonPressed; ++ /// Key modifier (ctrl, atl, shift) ++ guint32 m_nKeyModifier; + /// Rectangles of the current text selection. + std::vector m_aTextSelectionRectangles; + /// Position and size of the selection start (as if there would be a cursor caret there). +@@ -267,6 +272,7 @@ signalKey (GtkWidget* pWidget, GdkEventKey* pEvent) + return FALSE; + } + ++ priv->m_nKeyModifier = 0; + switch (pEvent->keyval) + { + case GDK_KEY_BackSpace: +@@ -296,6 +302,21 @@ signalKey (GtkWidget* pWidget, GdkEventKey* pEvent) + case GDK_KEY_Right: + nKeyCode = com::sun::star::awt::Key::RIGHT; + break; ++ case GDK_KEY_Shift_L: ++ case GDK_KEY_Shift_R: ++ if (pEvent->type == GDK_KEY_PRESS) ++ priv->m_nKeyModifier |= KEY_SHIFT; ++ break; ++ case GDK_KEY_Control_L: ++ case GDK_KEY_Control_R: ++ if (pEvent->type == GDK_KEY_PRESS) ++ priv->m_nKeyModifier |= KEY_MOD1; ++ break; ++ case GDK_KEY_Alt_L: ++ case GDK_KEY_Alt_R: ++ if (pEvent->type == GDK_KEY_PRESS) ++ priv->m_nKeyModifier |= KEY_MOD2; ++ break; + default: + if (pEvent->keyval >= GDK_KEY_F1 && pEvent->keyval <= GDK_KEY_F26) + nKeyCode = com::sun::star::awt::Key::F1 + (pEvent->keyval - GDK_KEY_F1); +@@ -309,7 +330,6 @@ signalKey (GtkWidget* pWidget, GdkEventKey* pEvent) + if (pEvent->state & GDK_SHIFT_MASK) + nKeyCode |= KEY_SHIFT; + +- + if (pEvent->type == GDK_KEY_RELEASE) + { + GTask* task = g_task_new(pDocView, NULL, NULL, NULL); +@@ -1060,6 +1080,20 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + pLOEvent->m_nPostMouseEventX = pixelToTwip(pEvent->x, priv->m_fZoom); + pLOEvent->m_nPostMouseEventY = pixelToTwip(pEvent->y, priv->m_fZoom); + pLOEvent->m_nPostMouseEventCount = nCount; ++ switch (pEvent->button) ++ { ++ case 1: ++ pLOEvent->m_nPostMouseEventButton = MOUSE_LEFT; ++ break; ++ case 2: ++ pLOEvent->m_nPostMouseEventButton = MOUSE_MIDDLE; ++ break; ++ case 3: ++ pLOEvent->m_nPostMouseEventButton = MOUSE_RIGHT; ++ break; ++ } ++ pLOEvent->m_nPostMouseEventModifier = priv->m_nKeyModifier; ++ priv->m_nLastButtonPressed = pLOEvent->m_nPostMouseEventButton; + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + + g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); +@@ -1078,6 +1112,20 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + pLOEvent->m_nPostMouseEventX = pixelToTwip(pEvent->x, priv->m_fZoom); + pLOEvent->m_nPostMouseEventY = pixelToTwip(pEvent->y, priv->m_fZoom); + pLOEvent->m_nPostMouseEventCount = nCount; ++ switch (pEvent->button) ++ { ++ case 1: ++ pLOEvent->m_nPostMouseEventButton = MOUSE_LEFT; ++ break; ++ case 2: ++ pLOEvent->m_nPostMouseEventButton = MOUSE_MIDDLE; ++ break; ++ case 3: ++ pLOEvent->m_nPostMouseEventButton = MOUSE_RIGHT; ++ break; ++ } ++ pLOEvent->m_nPostMouseEventModifier = priv->m_nKeyModifier; ++ priv->m_nLastButtonPressed = pLOEvent->m_nPostMouseEventButton; + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + + g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); +@@ -1182,6 +1230,9 @@ lok_doc_view_signal_motion (GtkWidget* pWidget, GdkEventMotion* pEvent) + pLOEvent->m_nPostMouseEventX = pixelToTwip(pEvent->x, priv->m_fZoom); + pLOEvent->m_nPostMouseEventY = pixelToTwip(pEvent->y, priv->m_fZoom); + pLOEvent->m_nPostMouseEventCount = 1; ++ pLOEvent->m_nPostMouseEventButton = priv->m_nLastButtonPressed; ++ pLOEvent->m_nPostMouseEventModifier = priv->m_nKeyModifier; ++ + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + + g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); +@@ -1218,7 +1269,9 @@ postMouseEventInThread(gpointer data) + pLOEvent->m_nPostMouseEventType, + pLOEvent->m_nPostMouseEventX, + pLOEvent->m_nPostMouseEventY, +- pLOEvent->m_nPostMouseEventCount); ++ pLOEvent->m_nPostMouseEventCount, ++ pLOEvent->m_nPostMouseEventButton, ++ pLOEvent->m_nPostMouseEventModifier); + } + + static void +diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx +index fdcdd15eddd7..34b9001e8bc5 100644 +--- a/libreofficekit/source/gtk/tilebuffer.hxx ++++ b/libreofficekit/source/gtk/tilebuffer.hxx +@@ -204,6 +204,8 @@ struct LOEvent + int m_nPostMouseEventX; + int m_nPostMouseEventY; + int m_nPostMouseEventCount; ++ int m_nPostMouseEventButton; ++ int m_nPostMouseEventModifier; + ///@} + + /// @name setGraphicSelection parameters +@@ -232,6 +234,8 @@ struct LOEvent + , m_nPostMouseEventX(0) + , m_nPostMouseEventY(0) + , m_nPostMouseEventCount(0) ++ , m_nPostMouseEventButton(0) ++ , m_nPostMouseEventModifier(0) + , m_nSetGraphicSelectionType(0) + , m_nSetGraphicSelectionX(0) + , m_nSetGraphicSelectionY(0) +diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx +index cd6888598f69..cc132278bdf8 100644 +--- a/sc/inc/docuno.hxx ++++ b/sc/inc/docuno.hxx +@@ -54,6 +54,7 @@ + #include + #include + #include ++#include + #include + #include "drwlayer.hxx" + +@@ -401,7 +402,7 @@ public: + virtual void postKeyEvent(int nType, int nCharCode, int nKeyCode) SAL_OVERRIDE; + + /// @see vcl::ITiledRenderable::postMouseEvent(). +- virtual void postMouseEvent(int nType, int nX, int nY, int nCount) SAL_OVERRIDE; ++ virtual void postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons = MOUSE_LEFT, int nModifier = 0) SAL_OVERRIDE; + + /// @see vcl::ITiledRenderable::setTextSelection(). + virtual void setTextSelection(int nType, int nX, int nY) SAL_OVERRIDE; +diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx +index 1a59f887b7d7..958495f7ea7b 100644 +--- a/sc/source/ui/unoobj/docuno.cxx ++++ b/sc/source/ui/unoobj/docuno.cxx +@@ -591,7 +591,7 @@ void ScModelObj::postKeyEvent(int nType, int nCharCode, int nKeyCode) + } + } + +-void ScModelObj::postMouseEvent(int nType, int nX, int nY, int nCount) ++void ScModelObj::postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier) + { + SolarMutexGuard aGuard; + +@@ -607,7 +607,8 @@ void ScModelObj::postMouseEvent(int nType, int nX, int nY, int nCount) + pViewData->SetZoom(Fraction(1, 1), Fraction(1, 1), true); + + // Calc operates in pixels... +- MouseEvent aEvent(Point(nX * pViewData->GetPPTX(), nY * pViewData->GetPPTY()), nCount, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT); ++ MouseEvent aEvent(Point(nX * pViewData->GetPPTX(), nY * pViewData->GetPPTY()), nCount, ++ MouseEventModifiers::SIMPLECLICK, nButtons, nModifier); + + switch (nType) + { +diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx +index 009fb672cf27..4d7314875f0b 100644 +--- a/sd/source/ui/inc/unomodel.hxx ++++ b/sd/source/ui/inc/unomodel.hxx +@@ -45,6 +45,7 @@ + #include + #include + ++#include + #include + + #include +@@ -248,7 +249,7 @@ public: + /// @see vcl::ITiledRenderable::postKeyEvent(). + virtual void postKeyEvent(int nType, int nCharCode, int nKeyCode) SAL_OVERRIDE; + /// @see vcl::ITiledRenderable::postMouseEvent(). +- virtual void postMouseEvent(int nType, int nX, int nY, int nCount) SAL_OVERRIDE; ++ virtual void postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons = MOUSE_LEFT, int nModifier = 0) SAL_OVERRIDE; + /// @see vcl::ITiledRenderable::setTextSelection(). + virtual void setTextSelection(int nType, int nX, int nY) SAL_OVERRIDE; + /// @see vcl::ITiledRenderable::getTextSelection(). +diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx +index 0e88a099e081..6ae01a28efac 100644 +--- a/sd/source/ui/unoidl/unomodel.cxx ++++ b/sd/source/ui/unoidl/unomodel.cxx +@@ -2428,7 +2428,7 @@ void SdXImpressDocument::postKeyEvent(int nType, int nCharCode, int nKeyCode) + } + } + +-void SdXImpressDocument::postMouseEvent(int nType, int nX, int nY, int nCount) ++void SdXImpressDocument::postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier) + { + SolarMutexGuard aGuard; + +@@ -2436,7 +2436,8 @@ void SdXImpressDocument::postMouseEvent(int nType, int nX, int nY, int nCount) + if (!pViewShell) + return; + +- MouseEvent aEvent(Point(convertTwipToMm100(nX), convertTwipToMm100(nY)), nCount, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT); ++ MouseEvent aEvent(Point(convertTwipToMm100(nX), convertTwipToMm100(nY)), nCount, ++ MouseEventModifiers::SIMPLECLICK, nButtons, nModifier); + + switch (nType) + { +diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx +index 311147eeaaea..346cab63ca02 100644 +--- a/sw/inc/unotxdoc.hxx ++++ b/sw/inc/unotxdoc.hxx +@@ -66,6 +66,7 @@ + #include + #include + #include ++#include + #include + #include + +@@ -422,7 +423,7 @@ public: + /// @see vcl::ITiledRenderable::postKeyEvent(). + virtual void postKeyEvent(int nType, int nCharCode, int nKeyCode) SAL_OVERRIDE; + /// @see vcl::ITiledRenderable::postMouseEvent(). +- virtual void postMouseEvent(int nType, int nX, int nY, int nCount) SAL_OVERRIDE; ++ virtual void postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons = MOUSE_LEFT, int nModifier = 0) SAL_OVERRIDE; + /// @see vcl::ITiledRenderable::setTextSelection(). + virtual void setTextSelection(int nType, int nX, int nY) SAL_OVERRIDE; + /// @see vcl::ITiledRenderable::getTextSelection(). +diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx +index 26ab19f170b9..fc1c6f411b74 100644 +--- a/sw/source/uibase/uno/unotxdoc.cxx ++++ b/sw/source/uibase/uno/unotxdoc.cxx +@@ -3282,12 +3282,12 @@ void SwXTextDocument::postKeyEvent(int nType, int nCharCode, int nKeyCode) + } + } + +-void SwXTextDocument::postMouseEvent(int nType, int nX, int nY, int nCount) ++void SwXTextDocument::postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier) + { + SolarMutexGuard aGuard; + + SwEditWin& rEditWin = pDocShell->GetView()->GetEditWin(); +- MouseEvent aEvent(Point(nX, nY), nCount, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT); ++ MouseEvent aEvent(Point(nX, nY), nCount, MouseEventModifiers::SIMPLECLICK, nButtons, nModifier); + + switch (nType) + { +-- +2.12.0 + diff --git a/SOURCES/0176-CppunitTest_sw_tiledrendering-testcase-for-LOK_CALLB.patch b/SOURCES/0176-CppunitTest_sw_tiledrendering-testcase-for-LOK_CALLB.patch new file mode 100644 index 0000000..985caf6 --- /dev/null +++ b/SOURCES/0176-CppunitTest_sw_tiledrendering-testcase-for-LOK_CALLB.patch @@ -0,0 +1,96 @@ +From 1d76b4e38c93388488dbd7f32912f6f40e081721 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Mon, 5 Oct 2015 15:34:28 +0200 +Subject: [PATCH 176/398] CppunitTest_sw_tiledrendering: testcase for + LOK_CALLBACK_SEARCH_RESULT_COUNT + +Change-Id: I9f517bc2f3dfca9a2dc17a229f54c47b7790a355 +(cherry picked from commit b4e75e8f52c17d02a65022303fb6a0e4f1d97592) +--- + sw/qa/extras/tiledrendering/tiledrendering.cxx | 32 +++++++++++++++++++++++++- + 1 file changed, 31 insertions(+), 1 deletion(-) + +diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx +index e7ab14942f79..c836f4bc5eab 100644 +--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx ++++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx +@@ -18,6 +18,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -42,6 +43,7 @@ public: + void testSearchTextFrame(); + void testSearchTextFrameWrapAround(); + void testDocumentSizeChanged(); ++ void testSearchAll(); + + CPPUNIT_TEST_SUITE(SwTiledRenderingTest); + CPPUNIT_TEST(testRegisterCallback); +@@ -56,6 +58,7 @@ public: + CPPUNIT_TEST(testSearchTextFrame); + CPPUNIT_TEST(testSearchTextFrameWrapAround); + CPPUNIT_TEST(testDocumentSizeChanged); ++ CPPUNIT_TEST(testSearchAll); + CPPUNIT_TEST_SUITE_END(); + + private: +@@ -66,10 +69,12 @@ private: + Size m_aDocumentSize; + OString m_aTextSelection; + bool m_bFound; ++ sal_Int32 m_nSearchResultCount; + }; + + SwTiledRenderingTest::SwTiledRenderingTest() +- : m_bFound(true) ++ : m_bFound(true), ++ m_nSearchResultCount(0) + { + } + +@@ -125,6 +130,11 @@ void SwTiledRenderingTest::callbackImpl(int nType, const char* pPayload) + m_bFound = false; + } + break; ++ case LOK_CALLBACK_SEARCH_RESULT_COUNT: ++ { ++ m_nSearchResultCount = OString(pPayload).toInt32(); ++ } ++ break; + } + } + +@@ -438,6 +448,26 @@ void SwTiledRenderingTest::testDocumentSizeChanged() + #endif + } + ++void SwTiledRenderingTest::testSearchAll() ++{ ++#if !defined(WNT) && !defined(MACOSX) ++ comphelper::LibreOfficeKit::setActive(); ++ ++ SwXTextDocument* pXTextDocument = createDoc("search.odt"); ++ pXTextDocument->registerCallback(&SwTiledRenderingTest::callback, this); ++ uno::Sequence aPropertyValues(comphelper::InitPropertySequence( ++ { ++ {"SearchItem.SearchString", uno::makeAny(OUString("shape"))}, ++ {"SearchItem.Backward", uno::makeAny(false)}, ++ {"SearchItem.Command", uno::makeAny(static_cast(SvxSearchCmd::FIND_ALL))}, ++ })); ++ comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues); ++ // This was 0; should be 2 results in the body text. ++ CPPUNIT_ASSERT_EQUAL(static_cast(2), m_nSearchResultCount); ++ ++ comphelper::LibreOfficeKit::setActive(false); ++#endif ++} + CPPUNIT_TEST_SUITE_REGISTRATION(SwTiledRenderingTest); + + CPPUNIT_PLUGIN_IMPLEMENT(); +-- +2.12.0 + diff --git a/SOURCES/0177-LOK-add-the-search-phrase-to-the-search-result-count.patch b/SOURCES/0177-LOK-add-the-search-phrase-to-the-search-result-count.patch new file mode 100644 index 0000000..1c010fe --- /dev/null +++ b/SOURCES/0177-LOK-add-the-search-phrase-to-the-search-result-count.patch @@ -0,0 +1,94 @@ +From ec61694abf3a2fb70ce295ba87e18e196b6bbc3a Mon Sep 17 00:00:00 2001 +From: Mihai Varga +Date: Mon, 5 Oct 2015 17:07:06 +0300 +Subject: [PATCH 177/398] LOK: add the search phrase to the search result count + callback + +We need this to notify the user for which search phrase no results were +found + +Change-Id: I8cc7ab235b9129dfdcb022145456180ff7e4ca92 +(cherry picked from commit c30defcf8e34daec6ea0455d772fe296cc26ecc9) +--- + include/LibreOfficeKit/LibreOfficeKitEnums.h | 6 +++++- + libreofficekit/source/gtk/lokdocview.cxx | 10 ++++++++++ + sw/qa/extras/tiledrendering/tiledrendering.cxx | 4 +++- + sw/source/uibase/uiview/viewsrch.cxx | 2 +- + 4 files changed, 19 insertions(+), 3 deletions(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h +index dc3e0f94f3dc..97c089ffef50 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h ++++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h +@@ -156,7 +156,11 @@ typedef enum + * Payload is a single 0-based integer. + */ + LOK_CALLBACK_SET_PART, +- /// Number of search results, in case something is found. ++ ++ /** ++ * Number of search results followed by the original searched phrase. ++ * count;phrase ++ */ + LOK_CALLBACK_SEARCH_RESULT_COUNT + } + LibreOfficeKitCallbackType; +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 0bd735088586..fa0386ba77f8 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -658,6 +658,16 @@ callback (gpointer pData) + searchNotFound(pDocView, pCallback->m_aPayload); + } + break; ++ case LOK_CALLBACK_SEARCH_RESULT_COUNT: ++ { ++ size_t nPos = pCallback->m_aPayload.find_first_of(";"); ++ int nSearchResultCount = std::stoi(pCallback->m_aPayload.substr(0, nPos)); ++ if (nSearchResultCount == 0) ++ { ++ searchNotFound(pDocView, pCallback->m_aPayload.substr(nPos + 1)); ++ } ++ } ++ break; + case LOK_CALLBACK_DOCUMENT_SIZE_CHANGED: + { + payloadToSize(pCallback->m_aPayload.c_str(), priv->m_nDocumentWidthTwips, priv->m_nDocumentHeightTwips); +diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx +index c836f4bc5eab..bcc328e366a3 100644 +--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx ++++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + + static const char* DATA_DIRECTORY = "/sw/qa/extras/tiledrendering/data/"; + +@@ -132,7 +133,8 @@ void SwTiledRenderingTest::callbackImpl(int nType, const char* pPayload) + break; + case LOK_CALLBACK_SEARCH_RESULT_COUNT: + { +- m_nSearchResultCount = OString(pPayload).toInt32(); ++ std::string aStrPayload(pPayload); ++ m_nSearchResultCount = std::stoi(aStrPayload.substr(0, aStrPayload.find_first_of(";"))); + } + break; + } +diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx +index 11764126e165..3ccc852065fb 100644 +--- a/sw/source/uibase/uiview/viewsrch.cxx ++++ b/sw/source/uibase/uiview/viewsrch.cxx +@@ -225,7 +225,7 @@ void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage) + } + else + { +- OString aPayload = OString::number(nFound); ++ OString aPayload = OString::number(nFound) + ";" + m_pSrchItem->GetSearchString().toUtf8(); + m_pWrtShell->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_RESULT_COUNT, aPayload.getStr()); + } + rReq.SetReturnValue(SfxBoolItem(nSlot, bRet)); +-- +2.12.0 + diff --git a/SOURCES/0178-LOK-fixed-duplicated-switch-case-values.patch b/SOURCES/0178-LOK-fixed-duplicated-switch-case-values.patch new file mode 100644 index 0000000..91aef91 --- /dev/null +++ b/SOURCES/0178-LOK-fixed-duplicated-switch-case-values.patch @@ -0,0 +1,42 @@ +From f14e917df2cd85f90337a2fe7cae085390e4aa34 Mon Sep 17 00:00:00 2001 +From: Mihai Varga +Date: Mon, 5 Oct 2015 18:07:28 +0300 +Subject: [PATCH 178/398] LOK: fixed duplicated switch case values + +(cherry picked from commit a6ef5718475ba35b52d9de474741b640316502eb) +--- + libreofficekit/source/gtk/lokdocview.cxx | 11 +---------- + 1 file changed, 1 insertion(+), 10 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index fa0386ba77f8..5d810d801106 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -661,11 +661,7 @@ callback (gpointer pData) + case LOK_CALLBACK_SEARCH_RESULT_COUNT: + { + size_t nPos = pCallback->m_aPayload.find_first_of(";"); +- int nSearchResultCount = std::stoi(pCallback->m_aPayload.substr(0, nPos)); +- if (nSearchResultCount == 0) +- { +- searchNotFound(pDocView, pCallback->m_aPayload.substr(nPos + 1)); +- } ++ searchResultCount(pDocView, pCallback->m_aPayload.substr(0, nPos)); + } + break; + case LOK_CALLBACK_DOCUMENT_SIZE_CHANGED: +@@ -683,11 +679,6 @@ callback (gpointer pData) + setPart(pDocView, pCallback->m_aPayload); + } + break; +- case LOK_CALLBACK_SEARCH_RESULT_COUNT: +- { +- searchResultCount(pDocView, pCallback->m_aPayload); +- } +- break; + default: + g_assert(false); + break; +-- +2.12.0 + diff --git a/SOURCES/0179-LOK-add-CALLBACK_SEARCH_RESULT_SELECTION-and-impleme.patch b/SOURCES/0179-LOK-add-CALLBACK_SEARCH_RESULT_SELECTION-and-impleme.patch new file mode 100644 index 0000000..d3d372c --- /dev/null +++ b/SOURCES/0179-LOK-add-CALLBACK_SEARCH_RESULT_SELECTION-and-impleme.patch @@ -0,0 +1,141 @@ +From 4a8fa9d37030d92b523707602e938e6604412727 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 6 Oct 2015 09:21:38 +0200 +Subject: [PATCH 179/398] LOK: add CALLBACK_SEARCH_RESULT_SELECTION and + implement it in sw + +(cherry picked from commit 94752d5970be7ce22e053f9cd83bd59711446a0a) + +Change-Id: I4c2a5418101976e1cb38c0fa71dbd66fc883f905 +--- + include/LibreOfficeKit/LibreOfficeKitEnums.h | 21 +++++++++- + sw/source/uibase/uiview/viewsrch.cxx | 57 +++++++++++++++++++++++++++- + 2 files changed, 76 insertions(+), 2 deletions(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h +index 97c089ffef50..b87f69a39989 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h ++++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h +@@ -161,7 +161,26 @@ typedef enum + * Number of search results followed by the original searched phrase. + * count;phrase + */ +- LOK_CALLBACK_SEARCH_RESULT_COUNT ++ LOK_CALLBACK_SEARCH_RESULT_COUNT, ++ ++ /** ++ * Selection rectangles of the search result when find all is performed. ++ * ++ * Payload format example, in case of two matches: ++ * ++ * { ++ * "searchString": "...", ++ * "searchResultSelection": [ ++ * "...", ++ * "..." ++ * ] ++ * } ++ * ++ * - searchString is the search query ++ * - searchResultSelection is an array of rectangle list, in ++ * LOK_CALLBACK_TEXT_SELECTION format. ++ */ ++ LOK_CALLBACK_SEARCH_RESULT_SELECTION + } + LibreOfficeKitCallbackType; + +diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx +index 3ccc852065fb..570fadeb561a 100644 +--- a/sw/source/uibase/uiview/viewsrch.cxx ++++ b/sw/source/uibase/uiview/viewsrch.cxx +@@ -22,6 +22,7 @@ + #include + + #include ++#include + + #include + +@@ -58,6 +59,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -85,6 +87,21 @@ static vcl::Window* GetParentWindow( SvxSearchDialog* pSrchDlg ) + return pSrchDlg && pSrchDlg->IsVisible() ? pSrchDlg : 0; + } + ++/// Adds rMatches using rKey as a key to the rTree tree. ++static void lcl_addContainerToJson(boost::property_tree::ptree& rTree, const OString& rKey, const std::vector& rMatches) ++{ ++ boost::property_tree::ptree aChildren; ++ ++ for (const OString& rMatch : rMatches) ++ { ++ boost::property_tree::ptree aChild; ++ aChild.put("", rMatch.getStr()); ++ aChildren.push_back(std::make_pair("", aChild)); ++ } ++ ++ rTree.add_child(rKey.getStr(), aChildren); ++} ++ + void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage) + { + const SfxItemSet* pArgs = rReq.GetArgs(); +@@ -223,10 +240,48 @@ void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage) + #endif + m_bFound = false; + } +- else ++ else if (comphelper::LibreOfficeKit::isActive()) + { + OString aPayload = OString::number(nFound) + ";" + m_pSrchItem->GetSearchString().toUtf8(); + m_pWrtShell->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_RESULT_COUNT, aPayload.getStr()); ++ ++ // Emit a callback also about the selection rectangles, grouped by matches. ++ if (SwPaM* pPaM = m_pWrtShell->GetCrsr()) ++ { ++ std::vector aMatches; ++ for (SwPaM& rPaM : pPaM->GetRingContainer()) ++ { ++ if (SwShellCrsr* pShellCrsr = dynamic_cast(&rPaM)) ++ { ++ std::vector aSelectionRectangles; ++ pShellCrsr->SwSelPaintRects::Show(&aSelectionRectangles); ++ std::stringstream ss; ++ bool bFirst = true; ++ for (size_t i = 0; i < aSelectionRectangles.size(); ++i) ++ { ++ const OString& rSelectionRectangle = aSelectionRectangles[i]; ++ if (rSelectionRectangle.isEmpty()) ++ continue; ++ if (bFirst) ++ bFirst = false; ++ else ++ ss << "; "; ++ ss << rSelectionRectangle.getStr(); ++ } ++ OString sRect = ss.str().c_str(); ++ aMatches.push_back(sRect); ++ } ++ } ++ boost::property_tree::ptree aTree; ++ aTree.put("searchString", m_pSrchItem->GetSearchString().toUtf8().getStr()); ++ lcl_addContainerToJson(aTree, "searchResultSelection", aMatches); ++ ++ std::stringstream aStream; ++ boost::property_tree::write_json(aStream, aTree); ++ aPayload = aStream.str().c_str(); ++ ++ m_pWrtShell->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr()); ++ } + } + rReq.SetReturnValue(SfxBoolItem(nSlot, bRet)); + #if HAVE_FEATURE_DESKTOP +-- +2.12.0 + diff --git a/SOURCES/0180-gtktiledviewer-recognize-LOK_CALLBACK_SEARCH_RESULT_.patch b/SOURCES/0180-gtktiledviewer-recognize-LOK_CALLBACK_SEARCH_RESULT_.patch new file mode 100644 index 0000000..c9e0f0c --- /dev/null +++ b/SOURCES/0180-gtktiledviewer-recognize-LOK_CALLBACK_SEARCH_RESULT_.patch @@ -0,0 +1,39 @@ +From 5e4796f308ea349d644458caadead085d2546443 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 6 Oct 2015 09:21:54 +0200 +Subject: [PATCH 180/398] gtktiledviewer: recognize + LOK_CALLBACK_SEARCH_RESULT_SELECTION + +Change-Id: Ib932ee36e41afcb53d15a6362b998cc673d474f2 +(cherry picked from commit 2b6060d6c58b95153c907585d89cad815bc9b1ae) +--- + libreofficekit/source/gtk/lokdocview.cxx | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 5d810d801106..220e488a53a4 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -233,6 +233,8 @@ callbackTypeToString (int nType) + return "LOK_CALLBACK_DOCUMENT_SIZE_CHANGED"; + case LOK_CALLBACK_SET_PART: + return "LOK_CALLBACK_SET_PART"; ++ case LOK_CALLBACK_SEARCH_RESULT_SELECTION: ++ return "LOK_CALLBACK_SEARCH_RESULT_SELECTION"; + } + return 0; + } +@@ -679,6 +681,10 @@ callback (gpointer pData) + setPart(pDocView, pCallback->m_aPayload); + } + break; ++ case LOK_CALLBACK_SEARCH_RESULT_SELECTION: ++ { ++ } ++ break; + default: + g_assert(false); + break; +-- +2.12.0 + diff --git a/SOURCES/0181-CppunitTest_sw_tiledrendering-CALLBACK_SEARCH_RESULT.patch b/SOURCES/0181-CppunitTest_sw_tiledrendering-CALLBACK_SEARCH_RESULT.patch new file mode 100644 index 0000000..df1aa7b --- /dev/null +++ b/SOURCES/0181-CppunitTest_sw_tiledrendering-CALLBACK_SEARCH_RESULT.patch @@ -0,0 +1,71 @@ +From 28fbfa4f660be2c4698cdaae963e4e21d172e56d Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 6 Oct 2015 10:18:18 +0200 +Subject: [PATCH 181/398] CppunitTest_sw_tiledrendering: + CALLBACK_SEARCH_RESULT_SELECTION testcase + +Change-Id: I66a8d73581641c71f2dce2d1992070f3ccce08c2 +(cherry picked from commit a7b86140d74039995bd4d312790244c1e2d4b501) +--- + sw/qa/extras/tiledrendering/tiledrendering.cxx | 17 ++++++++++++++++- + 1 file changed, 16 insertions(+), 1 deletion(-) + +diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx +index bcc328e366a3..2fd27dd4f8ff 100644 +--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx ++++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx +@@ -7,6 +7,9 @@ + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + ++#include ++#include ++ + #include + #include + #include +@@ -23,7 +26,6 @@ + #include + #include + #include +-#include + + static const char* DATA_DIRECTORY = "/sw/qa/extras/tiledrendering/data/"; + +@@ -71,6 +73,7 @@ private: + OString m_aTextSelection; + bool m_bFound; + sal_Int32 m_nSearchResultCount; ++ std::vector m_aSearchResultSelection; + }; + + SwTiledRenderingTest::SwTiledRenderingTest() +@@ -137,6 +140,16 @@ void SwTiledRenderingTest::callbackImpl(int nType, const char* pPayload) + m_nSearchResultCount = std::stoi(aStrPayload.substr(0, aStrPayload.find_first_of(";"))); + } + break; ++ case LOK_CALLBACK_SEARCH_RESULT_SELECTION: ++ { ++ m_aSearchResultSelection.clear(); ++ boost::property_tree::ptree aTree; ++ std::stringstream aStream(pPayload); ++ boost::property_tree::read_json(aStream, aTree); ++ for (boost::property_tree::ptree::value_type& rValue : aTree.get_child("searchResultSelection")) ++ m_aSearchResultSelection.push_back(rValue.second.data().c_str()); ++ } ++ break; + } + } + +@@ -466,6 +479,8 @@ void SwTiledRenderingTest::testSearchAll() + comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues); + // This was 0; should be 2 results in the body text. + CPPUNIT_ASSERT_EQUAL(static_cast(2), m_nSearchResultCount); ++ // Make sure that we get exactly as many rectangle lists as matches. ++ CPPUNIT_ASSERT_EQUAL(static_cast(2), m_aSearchResultSelection.size()); + + comphelper::LibreOfficeKit::setActive(false); + #endif +-- +2.12.0 + diff --git a/SOURCES/0182-lokdocview-log-paintTile-arguments.patch b/SOURCES/0182-lokdocview-log-paintTile-arguments.patch new file mode 100644 index 0000000..a7e03c4 --- /dev/null +++ b/SOURCES/0182-lokdocview-log-paintTile-arguments.patch @@ -0,0 +1,72 @@ +From 74d4aa83ab2a936b4210dc249531240087e2fc84 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 6 Oct 2015 10:47:03 +0200 +Subject: [PATCH 182/398] lokdocview: log paintTile() arguments + +Change-Id: I8015c8030c1c7f53ae1de053fe268a33464834ad +(cherry picked from commit 23ac7f2fb57c338fa608cbc28ac39d140026e3c3) +--- + libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 1 - + libreofficekit/source/gtk/lokdocview.cxx | 14 +++++++------- + libreofficekit/source/gtk/tilebuffer.cxx | 1 - + 3 files changed, 7 insertions(+), 9 deletions(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index ed97a6743b38..3d0b0deba323 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -371,7 +371,6 @@ static void signalCommand(LOKDocView* pLOKDocView, char* pPayload, gpointer /*pD + { + std::string aKey = aPayload.substr(0, nPosition); + std::string aValue = aPayload.substr(nPosition + 1); +- g_info("signalCommand: '%s' is '%s'", aKey.c_str(), aValue.c_str()); + + if (rWindow.m_aCommandNameToolItems.find(aKey) != rWindow.m_aCommandNameToolItems.end()) + { +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 220e488a53a4..4026d958b8ed 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -1395,7 +1395,13 @@ paintTileInThread (gpointer data) + aTileRectangle.y = pixelToTwip(nTileSizePixels, pLOEvent->m_fPaintTileZoom) * pLOEvent->m_nPaintTileX; + + priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId); +- g_test_timer_start(); ++ std::stringstream ss; ++ ss << "lok::Document::paintTile(" << static_cast(pBuffer) << ", " ++ << nTileSizePixels << ", " << nTileSizePixels << ", " ++ << aTileRectangle.x << ", " << aTileRectangle.y << ", " ++ << pixelToTwip(nTileSizePixels, pLOEvent->m_fPaintTileZoom) << ", " ++ << pixelToTwip(nTileSizePixels, pLOEvent->m_fPaintTileZoom) << ")"; ++ g_info(ss.str().c_str()); + priv->m_pDocument->pClass->paintTile(priv->m_pDocument, + pBuffer, + nTileSizePixels, nTileSizePixels, +@@ -1403,12 +1409,6 @@ paintTileInThread (gpointer data) + pixelToTwip(nTileSizePixels, pLOEvent->m_fPaintTileZoom), + pixelToTwip(nTileSizePixels, pLOEvent->m_fPaintTileZoom)); + +- double elapsedTime = g_test_timer_elapsed(); +- g_info ("Rendered (%d, %d) in %f seconds", +- pLOEvent->m_nPaintTileX, +- pLOEvent->m_nPaintTileY, +- elapsedTime); +- + //create a mapping for it + buffer.m_mTiles[index].setPixbuf(pPixBuf); + buffer.m_mTiles[index].valid = true; +diff --git a/libreofficekit/source/gtk/tilebuffer.cxx b/libreofficekit/source/gtk/tilebuffer.cxx +index 687ef44d6468..0e81bc33f262 100644 +--- a/libreofficekit/source/gtk/tilebuffer.cxx ++++ b/libreofficekit/source/gtk/tilebuffer.cxx +@@ -64,7 +64,6 @@ void TileBuffer::setInvalid(int x, int y, float fZoom, GTask* task, + GThreadPool* lokThreadPool) + { + int index = x * m_nWidth + y; +- g_info("Setting tile invalid (%d, %d)", x, y); + if (m_mTiles.find(index) != m_mTiles.end()) + { + m_mTiles[index].valid = false; +-- +2.12.0 + diff --git a/SOURCES/0183-sw-outline-SwViewOption-SetOnlineSpell.patch b/SOURCES/0183-sw-outline-SwViewOption-SetOnlineSpell.patch new file mode 100644 index 0000000..1e6d441 --- /dev/null +++ b/SOURCES/0183-sw-outline-SwViewOption-SetOnlineSpell.patch @@ -0,0 +1,45 @@ +From 447fa6b3fb93262d548441d4778fc5d429b5aef3 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 6 Oct 2015 11:13:54 +0200 +Subject: [PATCH 183/398] sw: outline SwViewOption::SetOnlineSpell() + +Change-Id: Ic81b039e9a1b592ca52ab684ddb45ee44c7714df +(cherry picked from commit 0cf63ba224cb01377e3e6da68b0e72a3ed7e30af) +--- + sw/inc/viewopt.hxx | 3 +-- + sw/source/uibase/config/viewopt.cxx | 5 +++++ + 2 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx +index 64c1e269f2f6..dee2189a6795 100644 +--- a/sw/inc/viewopt.hxx ++++ b/sw/inc/viewopt.hxx +@@ -300,8 +300,7 @@ public: + + inline bool IsOnlineSpell() const + { return !bReadonly && (nCoreOptions & VIEWOPT_1_ONLINESPELL) != 0; } +- inline void SetOnlineSpell( bool b ) +- { b ? (nCoreOptions |= VIEWOPT_1_ONLINESPELL ) : ( nCoreOptions &= ~VIEWOPT_1_ONLINESPELL); } ++ void SetOnlineSpell( bool b ); + + inline bool IsViewMetaChars() const + { return !bReadonly && (nCoreOptions & VIEWOPT_1_VIEWMETACHARS) != 0; } +diff --git a/sw/source/uibase/config/viewopt.cxx b/sw/source/uibase/config/viewopt.cxx +index 7597589f0657..c5080e84abd4 100644 +--- a/sw/source/uibase/config/viewopt.cxx ++++ b/sw/source/uibase/config/viewopt.cxx +@@ -312,6 +312,11 @@ bool SwViewOption::IsAutoCompleteWords() + return rFlags.bAutoCmpltCollectWords; + } + ++void SwViewOption::SetOnlineSpell(bool b) ++{ ++ b ? (nCoreOptions |= VIEWOPT_1_ONLINESPELL ) : ( nCoreOptions &= ~VIEWOPT_1_ONLINESPELL); ++} ++ + AuthorCharAttr::AuthorCharAttr() : + nItemId (SID_ATTR_CHAR_UNDERLINE), + nAttr (UNDERLINE_SINGLE), +-- +2.12.0 + diff --git a/SOURCES/0184-Disable-spellcheck-when-LOK-is-active.patch b/SOURCES/0184-Disable-spellcheck-when-LOK-is-active.patch new file mode 100644 index 0000000..7a5d09f --- /dev/null +++ b/SOURCES/0184-Disable-spellcheck-when-LOK-is-active.patch @@ -0,0 +1,57 @@ +From 702edb07b785e27cfaf45f4feee9e07d7b9402e7 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 6 Oct 2015 12:05:14 +0200 +Subject: [PATCH 184/398] Disable spellcheck when LOK is active + +It's not useful when viewing, and for editing probably a dedicated +overlay would be better (like the one we have for cursor/selections +already). + +Disable for sw/sd explicitly, sc had it disabled implicitly already. + +Change-Id: I7134f5d1a1546787c22019e6b1abdc0dd887f888 +(cherry picked from commit c92ebc850345924619a12327f36cc6ac9c0b09d1) +--- + sd/source/core/drawdoc.cxx | 4 +++- + sw/source/uibase/config/viewopt.cxx | 3 +++ + 2 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx +index fcf678ec669f..f820fabaab81 100644 +--- a/sd/source/core/drawdoc.cxx ++++ b/sd/source/core/drawdoc.cxx +@@ -97,6 +97,7 @@ + + #include + #include ++#include + + using namespace ::sd; + using namespace ::com::sun::star; +@@ -229,7 +230,8 @@ SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh) + SetLanguage( MsLangId::resolveSystemLanguageByScriptType(aOptions.nDefaultLanguage_CTL, + ::com::sun::star::i18n::ScriptType::COMPLEX), EE_CHAR_LANGUAGE_CTL ); + +- mbOnlineSpell = aOptions.bIsSpellAuto; ++ if (!comphelper::LibreOfficeKit::isActive()) ++ mbOnlineSpell = aOptions.bIsSpellAuto; + } + + LanguageType eRealLanguage = MsLangId::getRealLanguage( meLanguage ); +diff --git a/sw/source/uibase/config/viewopt.cxx b/sw/source/uibase/config/viewopt.cxx +index c5080e84abd4..77c716af839d 100644 +--- a/sw/source/uibase/config/viewopt.cxx ++++ b/sw/source/uibase/config/viewopt.cxx +@@ -314,6 +314,9 @@ bool SwViewOption::IsAutoCompleteWords() + + void SwViewOption::SetOnlineSpell(bool b) + { ++ if (comphelper::LibreOfficeKit::isActive()) ++ return; ++ + b ? (nCoreOptions |= VIEWOPT_1_ONLINESPELL ) : ( nCoreOptions &= ~VIEWOPT_1_ONLINESPELL); + } + +-- +2.12.0 + diff --git a/SOURCES/0185-sw-extract-lcl_emitSearchResultCallbacks-from-SwView.patch b/SOURCES/0185-sw-extract-lcl_emitSearchResultCallbacks-from-SwView.patch new file mode 100644 index 0000000..6515e33 --- /dev/null +++ b/SOURCES/0185-sw-extract-lcl_emitSearchResultCallbacks-from-SwView.patch @@ -0,0 +1,121 @@ +From 5a52abcc97428423885cb144e5380e825e082abb Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 6 Oct 2015 12:29:33 +0200 +Subject: [PATCH 185/398] sw: extract lcl_emitSearchResultCallbacks() from + SwView::ExecSearch() + +Change-Id: I9c6b7540bcae85d6529e5cc195a7e86f58ee5713 +(cherry picked from commit ca8016c3a317a7ba1f03e117d575fb78a572b4b3) +--- + sw/source/uibase/uiview/viewsrch.cxx | 88 +++++++++++++++++++----------------- + 1 file changed, 46 insertions(+), 42 deletions(-) + +diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx +index 570fadeb561a..a22cbdb6528f 100644 +--- a/sw/source/uibase/uiview/viewsrch.cxx ++++ b/sw/source/uibase/uiview/viewsrch.cxx +@@ -102,6 +102,51 @@ static void lcl_addContainerToJson(boost::property_tree::ptree& rTree, const OSt + rTree.add_child(rKey.getStr(), aChildren); + } + ++/// Emits LOK callbacks (count, selection) for search results. ++static void lcl_emitSearchResultCallbacks(sal_uInt16 nFound, SvxSearchItem* pSearchItem, SwWrtShell* pWrtShell) ++{ ++ OString aPayload = OString::number(nFound) + ";" + pSearchItem->GetSearchString().toUtf8(); ++ pWrtShell->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_RESULT_COUNT, aPayload.getStr()); ++ ++ // Emit a callback also about the selection rectangles, grouped by matches. ++ if (SwPaM* pPaM = pWrtShell->GetCrsr()) ++ { ++ std::vector aMatches; ++ for (SwPaM& rPaM : pPaM->GetRingContainer()) ++ { ++ if (SwShellCrsr* pShellCrsr = dynamic_cast(&rPaM)) ++ { ++ std::vector aSelectionRectangles; ++ pShellCrsr->SwSelPaintRects::Show(&aSelectionRectangles); ++ std::stringstream ss; ++ bool bFirst = true; ++ for (size_t i = 0; i < aSelectionRectangles.size(); ++i) ++ { ++ const OString& rSelectionRectangle = aSelectionRectangles[i]; ++ if (rSelectionRectangle.isEmpty()) ++ continue; ++ if (bFirst) ++ bFirst = false; ++ else ++ ss << "; "; ++ ss << rSelectionRectangle.getStr(); ++ } ++ OString sRect = ss.str().c_str(); ++ aMatches.push_back(sRect); ++ } ++ } ++ boost::property_tree::ptree aTree; ++ aTree.put("searchString", pSearchItem->GetSearchString().toUtf8().getStr()); ++ lcl_addContainerToJson(aTree, "searchResultSelection", aMatches); ++ ++ std::stringstream aStream; ++ boost::property_tree::write_json(aStream, aTree); ++ aPayload = aStream.str().c_str(); ++ ++ pWrtShell->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr()); ++ } ++} ++ + void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage) + { + const SfxItemSet* pArgs = rReq.GetArgs(); +@@ -241,48 +286,7 @@ void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage) + m_bFound = false; + } + else if (comphelper::LibreOfficeKit::isActive()) +- { +- OString aPayload = OString::number(nFound) + ";" + m_pSrchItem->GetSearchString().toUtf8(); +- m_pWrtShell->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_RESULT_COUNT, aPayload.getStr()); +- +- // Emit a callback also about the selection rectangles, grouped by matches. +- if (SwPaM* pPaM = m_pWrtShell->GetCrsr()) +- { +- std::vector aMatches; +- for (SwPaM& rPaM : pPaM->GetRingContainer()) +- { +- if (SwShellCrsr* pShellCrsr = dynamic_cast(&rPaM)) +- { +- std::vector aSelectionRectangles; +- pShellCrsr->SwSelPaintRects::Show(&aSelectionRectangles); +- std::stringstream ss; +- bool bFirst = true; +- for (size_t i = 0; i < aSelectionRectangles.size(); ++i) +- { +- const OString& rSelectionRectangle = aSelectionRectangles[i]; +- if (rSelectionRectangle.isEmpty()) +- continue; +- if (bFirst) +- bFirst = false; +- else +- ss << "; "; +- ss << rSelectionRectangle.getStr(); +- } +- OString sRect = ss.str().c_str(); +- aMatches.push_back(sRect); +- } +- } +- boost::property_tree::ptree aTree; +- aTree.put("searchString", m_pSrchItem->GetSearchString().toUtf8().getStr()); +- lcl_addContainerToJson(aTree, "searchResultSelection", aMatches); +- +- std::stringstream aStream; +- boost::property_tree::write_json(aStream, aTree); +- aPayload = aStream.str().c_str(); +- +- m_pWrtShell->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr()); +- } +- } ++ lcl_emitSearchResultCallbacks(nFound, m_pSrchItem, m_pWrtShell); + rReq.SetReturnValue(SfxBoolItem(nSlot, bRet)); + #if HAVE_FEATURE_DESKTOP + { +-- +2.12.0 + diff --git a/SOURCES/0186-sw-tiled-rendering-emit-LOK_CALLBACK_SEARCH_RESULT-f.patch b/SOURCES/0186-sw-tiled-rendering-emit-LOK_CALLBACK_SEARCH_RESULT-f.patch new file mode 100644 index 0000000..1feb496 --- /dev/null +++ b/SOURCES/0186-sw-tiled-rendering-emit-LOK_CALLBACK_SEARCH_RESULT-f.patch @@ -0,0 +1,67 @@ +From 418c00d936bad7f4ecc59fc5246a51218026e983 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 6 Oct 2015 14:17:43 +0200 +Subject: [PATCH 186/398] sw tiled rendering: emit LOK_CALLBACK_SEARCH_RESULT* + for normal search + +We used to emit these for find-all only, for no good reason. + +Change-Id: Id07dc7649f9a8528b9d4ec16d5f7c651fd607111 +(cherry picked from commit 58c38e7ea5debc5440f1d81acf38d8d6ad0883d8) +--- + sw/qa/extras/tiledrendering/tiledrendering.cxx | 7 +++++++ + sw/source/uibase/uiview/viewsrch.cxx | 4 ++++ + 2 files changed, 11 insertions(+) + +diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx +index 2fd27dd4f8ff..1eb57dea109e 100644 +--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx ++++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx +@@ -342,7 +342,10 @@ void lcl_search(bool bBackward) + void SwTiledRenderingTest::testSearch() + { + #if !defined(WNT) && !defined(MACOSX) ++ comphelper::LibreOfficeKit::setActive(); ++ + SwXTextDocument* pXTextDocument = createDoc("search.odt"); ++ pXTextDocument->registerCallback(&SwTiledRenderingTest::callback, this); + SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell(); + size_t nNode = pWrtShell->getShellCrsr(false)->Start()->nNode.GetNode().GetIndex(); + +@@ -351,6 +354,8 @@ void SwTiledRenderingTest::testSearch() + CPPUNIT_ASSERT(!pWrtShell->GetDrawView()->GetTextEditObject()); + size_t nActual = pWrtShell->getShellCrsr(false)->Start()->nNode.GetNode().GetIndex(); + CPPUNIT_ASSERT_EQUAL(nNode + 1, nActual); ++ /// Make sure we get search result selection for normal find as well, not only find all. ++ CPPUNIT_ASSERT(!m_aSearchResultSelection.empty()); + + // Next hit, in the shape. + lcl_search(false); +@@ -375,6 +380,8 @@ void SwTiledRenderingTest::testSearch() + CPPUNIT_ASSERT(!pWrtShell->GetDrawView()->GetTextEditObject()); + nActual = pWrtShell->getShellCrsr(false)->Start()->nNode.GetNode().GetIndex(); + CPPUNIT_ASSERT_EQUAL(nNode + 1, nActual); ++ ++ comphelper::LibreOfficeKit::setActive(false); + #endif + } + +diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx +index a22cbdb6528f..c8d3e7a571ea 100644 +--- a/sw/source/uibase/uiview/viewsrch.cxx ++++ b/sw/source/uibase/uiview/viewsrch.cxx +@@ -253,7 +253,11 @@ void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage) + { + bool bRet = SearchAndWrap(bApi); + if( bRet ) ++ { + Scroll(m_pWrtShell->GetCharRect().SVRect()); ++ if (comphelper::LibreOfficeKit::isActive()) ++ lcl_emitSearchResultCallbacks(1, m_pSrchItem, m_pWrtShell); ++ } + rReq.SetReturnValue(SfxBoolItem(nSlot, bRet)); + #if HAVE_FEATURE_DESKTOP + { +-- +2.12.0 + diff --git a/SOURCES/0187-libreofficekit-Werror-unused-macros.patch b/SOURCES/0187-libreofficekit-Werror-unused-macros.patch new file mode 100644 index 0000000..e6a32b1 --- /dev/null +++ b/SOURCES/0187-libreofficekit-Werror-unused-macros.patch @@ -0,0 +1,28 @@ +From 388c0b9a3d553a36557a116376fd27e1805160c1 Mon Sep 17 00:00:00 2001 +From: Michael Stahl +Date: Tue, 6 Oct 2015 14:23:38 +0200 +Subject: [PATCH 187/398] libreofficekit: -Werror=unused-macros + +Change-Id: I154bd2c101819669d43ab475144ae400454df4d0 +(cherry picked from commit 0ca6d934b318bda1c91e4166acc2f2216a0d2b2a) +--- + libreofficekit/source/gtk/tilebuffer.cxx | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/libreofficekit/source/gtk/tilebuffer.cxx b/libreofficekit/source/gtk/tilebuffer.cxx +index 0e81bc33f262..992f06cd5e00 100644 +--- a/libreofficekit/source/gtk/tilebuffer.cxx ++++ b/libreofficekit/source/gtk/tilebuffer.cxx +@@ -9,9 +9,6 @@ + + #include "tilebuffer.hxx" + +-#if !GLIB_CHECK_VERSION(2,40,0) +-#define g_info(...) g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, __VA_ARGS__) +-#endif + + /* ------------------ + Utility functions +-- +2.12.0 + diff --git a/SOURCES/0188-lokdocview-invalidate-after-selection-change.patch b/SOURCES/0188-lokdocview-invalidate-after-selection-change.patch new file mode 100644 index 0000000..69eaf79 --- /dev/null +++ b/SOURCES/0188-lokdocview-invalidate-after-selection-change.patch @@ -0,0 +1,29 @@ +From 8a809d3725511d14e9c8f65e5b1382169e8ed653 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Wed, 7 Oct 2015 16:01:43 +0200 +Subject: [PATCH 188/398] lokdocview: invalidate after selection change + +Without this e.g. Calc search does not show the selection rectangle +correctly. + +Change-Id: I5bc20a93ee861d3353bc2e1c1ed7ea8d0e6c8ed4 +(cherry picked from commit c5ceddf3445f7d56ea4f044366e4a797703bdd0c) +--- + libreofficekit/source/gtk/lokdocview.cxx | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 4026d958b8ed..a40496eb7357 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -619,6 +619,7 @@ callback (gpointer pData) + } + else + memset(&priv->m_aHandleMiddleRect, 0, sizeof(priv->m_aHandleMiddleRect)); ++ gtk_widget_queue_draw(GTK_WIDGET(pDocView)); + } + break; + case LOK_CALLBACK_TEXT_SELECTION_START: +-- +2.12.0 + diff --git a/SOURCES/0189-sc-tiled-rendering-fix-showing-all-search-results.patch b/SOURCES/0189-sc-tiled-rendering-fix-showing-all-search-results.patch new file mode 100644 index 0000000..dd369c8 --- /dev/null +++ b/SOURCES/0189-sc-tiled-rendering-fix-showing-all-search-results.patch @@ -0,0 +1,36 @@ +From c8beb0f19a10c8dc2d73c8d7440cf48c51552191 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Wed, 7 Oct 2015 17:19:26 +0200 +Subject: [PATCH 189/398] sc tiled rendering: fix showing all search results + +Calc can have multiple cells selected, but there is only one cell which +has the black border around the cell. Code in +ScViewFunc::SearchAndReplace() assumed that the two are always the same, +and that's how find-all always highlighted the first match only. + +Fix this by avoiding emitting LOK_CALLBACK_TEXT_SELECTION two times, at +least in the find-all case. + +Change-Id: Ifce789c7f5f11e94fb2445846279823096ecb2dd +(cherry picked from commit a31f95b180728c1c671930913b4b4ad96ebcda5f) +--- + sc/source/ui/view/viewfun2.cxx | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx +index 47b0ace1ccef..295d3dbcbf44 100644 +--- a/sc/source/ui/view/viewfun2.cxx ++++ b/sc/source/ui/view/viewfun2.cxx +@@ -1837,7 +1837,8 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem, + AlignToCursor( nCol, nRow, SC_FOLLOW_JUMP ); + SetCursor( nCol, nRow, true ); + +- if (rDoc.GetDrawLayer()->isTiledRendering()) ++ // Don't move cell selection handles for find-all: selection of all but the first result would be lost. ++ if (rDoc.GetDrawLayer()->isTiledRendering() && nCommand == SvxSearchCmd::FIND) + { + Point aCurPos = GetViewData().GetScrPos(nCol, nRow, GetViewData().GetActivePart()); + +-- +2.12.0 + diff --git a/SOURCES/0190-Make-this-compile-for-iOS-again.patch b/SOURCES/0190-Make-this-compile-for-iOS-again.patch new file mode 100644 index 0000000..8db5b8f --- /dev/null +++ b/SOURCES/0190-Make-this-compile-for-iOS-again.patch @@ -0,0 +1,51 @@ +From 2c2bc72ba3c8f2ac31e4d02a095342a3dca9d349 Mon Sep 17 00:00:00 2001 +From: Tor Lillqvist +Date: Wed, 7 Oct 2015 21:25:50 +0300 +Subject: [PATCH 190/398] Make this compile for iOS again + +Change-Id: I36f88d7e1114096d1e7a7a1d29077c387c21a10a +(cherry picked from commit 3c9da1fbfae9c00a5eb9ddcb106a01b075703fcd) +--- + desktop/source/lib/init.cxx | 19 ++++++++++--------- + 1 file changed, 10 insertions(+), 9 deletions(-) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 29e8e0d12faa..836fc00e1042 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -774,15 +774,6 @@ void doc_paintTile (LibreOfficeKitDocument* pThis, + + pDoc->paintTile(*pDevice.get(), nCanvasWidth, nCanvasHeight, + nTilePosX, nTilePosY, nTileWidth, nTileHeight); +-#else +- SystemGraphicsData aData; +- aData.rCGContext = reinterpret_cast(pBuffer); +- // the Size argument is irrelevant, I hope +- ScopedVclPtrInstance pDevice(&aData, Size(1, 1), (sal_uInt16)0); +- +- pDoc->paintTile(*pDevice.get(), nCanvasWidth, nCanvasHeight, +- nTilePosX, nTilePosY, nTileWidth, nTileHeight); +-#endif + + // Overwrite pBuffer's alpha channel with the separate alpha buffer. + for (int nRow = 0; nRow < nCanvasHeight; ++nRow) +@@ -795,6 +786,16 @@ void doc_paintTile (LibreOfficeKitDocument* pThis, + } + } + ++#else ++ SystemGraphicsData aData; ++ aData.rCGContext = reinterpret_cast(pBuffer); ++ // the Size argument is irrelevant, I hope ++ ScopedVclPtrInstance pDevice(&aData, Size(1, 1), (sal_uInt16)0); ++ ++ pDoc->paintTile(*pDevice.get(), nCanvasWidth, nCanvasHeight, ++ nTilePosX, nTilePosY, nTileWidth, nTileHeight); ++#endif ++ + static bool bDebug = getenv("LOK_DEBUG") != 0; + if (bDebug) + { +-- +2.12.0 + diff --git a/SOURCES/0191-comphelper-add-string-join.patch b/SOURCES/0191-comphelper-add-string-join.patch new file mode 100644 index 0000000..8386e56 --- /dev/null +++ b/SOURCES/0191-comphelper-add-string-join.patch @@ -0,0 +1,62 @@ +From b038b07bec23311c246fb71aac1d38431bc50fc4 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Thu, 8 Oct 2015 08:33:09 +0200 +Subject: [PATCH 191/398] comphelper: add string::join() + +If there is a need for it, this could be extended later to work with uno +sequences and/or OUStrings as well. + +Change-Id: Id0af8b1755c8e4b668720563d10a052337e1b2c9 +(cherry picked from commit fce720b3e4691eb3b7deef1d005d76b23123a5cb) +--- + comphelper/source/misc/string.cxx | 11 +++++++++++ + include/comphelper/string.hxx | 4 ++++ + 2 files changed, 15 insertions(+) + +diff --git a/comphelper/source/misc/string.cxx b/comphelper/source/misc/string.cxx +index 98391741a13d..c6fa2fdde270 100644 +--- a/comphelper/source/misc/string.cxx ++++ b/comphelper/source/misc/string.cxx +@@ -269,6 +269,17 @@ uno::Sequence< OUString > + return kws; + } + ++OString join(const OString& rSeparator, const std::vector& rSequence) ++{ ++ OStringBuffer aBuffer; ++ for (size_t i = 0; i < rSequence.size(); ++i) ++ { ++ if (i != 0) ++ aBuffer.append(rSeparator); ++ aBuffer.append(rSequence[i]); ++ } ++ return aBuffer.makeStringAndClear(); ++} + + sal_Int32 compareNatural( const OUString & rLHS, const OUString & rRHS, + const uno::Reference< i18n::XCollator > &rCollator, +diff --git a/include/comphelper/string.hxx b/include/comphelper/string.hxx +index b9680372c21b..8d2552266cf2 100644 +--- a/include/comphelper/string.hxx ++++ b/include/comphelper/string.hxx +@@ -23,6 +23,7 @@ + #include + + #include ++#include + #include + #include + #include +@@ -310,6 +311,9 @@ COMPHELPER_DLLPUBLIC sal_Int32 indexOfAny(OUString const& rIn, + COMPHELPER_DLLPUBLIC OUString convertCommaSeparated( + ::com::sun::star::uno::Sequence< OUString > const & i_rSeq); + ++/// Return a string which is the concatenation of the strings in the sequence. ++COMPHELPER_DLLPUBLIC OString join(const OString& rSeparator, const std::vector& rSequence); ++ + /** Convert a decimal string to a number. + + The string must be base-10, no sign but can contain any +-- +2.12.0 + diff --git a/SOURCES/0192-sc-tiled-rendering-no-need-to-show-this-dialog.patch b/SOURCES/0192-sc-tiled-rendering-no-need-to-show-this-dialog.patch new file mode 100644 index 0000000..75cc8c5 --- /dev/null +++ b/SOURCES/0192-sc-tiled-rendering-no-need-to-show-this-dialog.patch @@ -0,0 +1,37 @@ +From 13b160581f9f3ebdb1c21722e4e6f9783e0e0775 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Thu, 8 Oct 2015 10:07:46 +0200 +Subject: [PATCH 192/398] sc tiled rendering: no need to show this dialog + +And it just causes problems during unit testing. + +Change-Id: Ie8524b726ae2709bab707df9b2984f07357e3059 +(cherry picked from commit dd7d97589bcbed22cf2dd12b574fc28baedf24af) +--- + sc/source/ui/view/viewfun2.cxx | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx +index 295d3dbcbf44..555492f17538 100644 +--- a/sc/source/ui/view/viewfun2.cxx ++++ b/sc/source/ui/view/viewfun2.cxx +@@ -86,6 +86,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -1737,7 +1738,7 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem, + if (nCommand == SvxSearchCmd::FIND_ALL || nCommand == SvxSearchCmd::REPLACE_ALL) + { + SfxViewFrame* pViewFrm = SfxViewFrame::Current(); +- if (pViewFrm) ++ if (pViewFrm && !comphelper::LibreOfficeKit::isActive()) + { + pViewFrm->ShowChildWindow(sc::SearchResultsDlgWrapper::GetChildWindowId(), true); + SfxChildWindow* pWnd = pViewFrm->GetChildWindow(sc::SearchResultsDlgWrapper::GetChildWindowId()); +-- +2.12.0 + diff --git a/SOURCES/0193-lok-Document-initializeForRendering-handle-lack-of-l.patch b/SOURCES/0193-lok-Document-initializeForRendering-handle-lack-of-l.patch new file mode 100644 index 0000000..326e034 --- /dev/null +++ b/SOURCES/0193-lok-Document-initializeForRendering-handle-lack-of-l.patch @@ -0,0 +1,37 @@ +From ad9dac7f0a8c7f2e9225a519334a274c215ad351 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Thu, 8 Oct 2015 10:27:53 +0200 +Subject: [PATCH 193/398] lok::Document::initializeForRendering(): handle lack + of lok_init() + +Normally lok_init() sets the component context, but not e.g. during unit +testing. + +Change-Id: If3760f31af2e4b870f65e5aa7557607e8b6a1114 +(cherry picked from commit de1f156c6a35757d74b0e337b02743f1962ff0ae) +--- + desktop/source/lib/init.cxx | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 836fc00e1042..b69e58a4af1f 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -568,6 +568,14 @@ static void doc_iniUnoCommands () + return; + } + ++ if (!xContext.is()) ++ xContext = comphelper::getProcessComponentContext(); ++ if (!xContext.is()) ++ { ++ SAL_WARN("lok", "iniUnoCommands: Component context is not available"); ++ return; ++ } ++ + SfxSlotPool& rSlotPool = SfxSlotPool::GetSlotPool(pViewFrame); + uno::Reference xParser(util::URLTransformer::create(xContext)); + +-- +2.12.0 + diff --git a/SOURCES/0194-CppunitTest_desktop_lib-add-Calc-find-all-testcase.patch b/SOURCES/0194-CppunitTest_desktop_lib-add-Calc-find-all-testcase.patch new file mode 100644 index 0000000..26488b4 --- /dev/null +++ b/SOURCES/0194-CppunitTest_desktop_lib-add-Calc-find-all-testcase.patch @@ -0,0 +1,296 @@ +From a54392a6c40037d9903c7d35dc62f9de6fefffaf Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Thu, 8 Oct 2015 10:56:49 +0200 +Subject: [PATCH 194/398] CppunitTest_desktop_lib: add Calc find-all testcase + +Fails without commit a31f95b180728c1c671930913b4b4ad96ebcda5f (sc tiled +rendering: fix showing all search results, 2015-10-07). + +Change-Id: Ibc01d468168367f789b3f5046808104fa3f5ef18 +(cherry picked from commit 97c414758d3d8aa3cc2233d52612cf0a33c24c34) +--- + desktop/CppunitTest_desktop_lib.mk | 3 ++ + desktop/qa/data/search.ods | Bin 0 -> 7636 bytes + desktop/qa/desktop_lib/test_desktop_lib.cxx | 76 ++++++++++++++++++++++++++-- + 3 files changed, 76 insertions(+), 3 deletions(-) + create mode 100644 desktop/qa/data/search.ods + +diff --git a/desktop/CppunitTest_desktop_lib.mk b/desktop/CppunitTest_desktop_lib.mk +index be394600ddf0..0c963f9088c2 100644 +--- a/desktop/CppunitTest_desktop_lib.mk ++++ b/desktop/CppunitTest_desktop_lib.mk +@@ -56,11 +56,14 @@ $(eval $(call gb_CppunitTest_use_components,desktop_lib,\ + svtools/util/svt \ + sw/util/sw \ + sw/util/swd \ ++ sc/util/sc \ ++ sc/util/scd \ + toolkit/util/tk \ + ucb/source/core/ucb1 \ + ucb/source/ucp/file/ucpfile1 \ + unoxml/source/service/unoxml \ + xmloff/util/xo \ ++ i18npool/source/search/i18nsearch \ + )) + + $(eval $(call gb_CppunitTest_use_configuration,desktop_lib)) +diff --git a/desktop/qa/data/search.ods b/desktop/qa/data/search.ods +new file mode 100644 +index 0000000000000000000000000000000000000000..ea1d73153828a6a80329cfc617e4276fd2b51ab2 +GIT binary patch +literal 7636 +zcmdT}XIPWV){Qhlsvdgpy(mq33sR+rUIPROhJYkN5Rejz6p;=hy;ms$A|QxVLApqj +zE+8PFAiaIz+-o`K>Ur+{`RzP!OS0BGd(X_8nLWCi*f`_>06qY~43i8O1ONc% +z2j(k)3)BUI^m2oM-P~YMJ1`RJ3K#N#+Y7pa5m1Dns~ZGv?`nr~fxwZ12sd{K*dE~o +zfgpAN!dd>lIDY>E0C0X#V>m%hC>L8e7z#rOA-~-Uy1^a8bhTB9FVSAY{DoLuO<5mv +zeSta7@Ub!HxJO(N%mt)-6LdpNOiV^b1_%UdXlQ^yAaiqbJ3G5uw{9U22ybt1G#VWq +z9-fepkdl&;lao_YQc_!6+t}FH+S=OP-90okG&wmrKR>^|zP`1!b$WVw{))3R6HTQP +z0N{ePy0Rk3b7Fmz0FG85!%?7Xb#LRZNIg1xxI{C^EhfZWVu&E`kF~Zr +znwo#A)_UDx7gFkL?M!FTtom-R|7w&mt-G461UqW;)(2uLv64YeFddA`)-Q +zHsn0F6JOpKIvziY?uFJKZ%d|#0N0YM_6a7ToorweS|bkcoZg3NcOTA^<6Sv>#1 +zmWjcaPow$Vc|swta4SV(Ds8je5+0T(M3lvqD;a>C8zeq4HhVOPk@+n~`@^XpN35?8 +z)D*L785!Z@3F#S-lzBHe1WE{BdrOVOw#w6>So!4xGpkY&1$?_1?SsF6K~Pz|%fOy+ +znG9L!d9n!mN}{Z}oVo10a=2=;pGw$B&nj*K^qwInB5BTXdSFjANxyKFsD3v+$>ORy +zAdhlL@g%x{3JR1U_%L&_IZ`dp_6wf7O +z7c!Yk4pfLwv5}LB^qE~+gT;u_zdo!q=eu$o6nTa3Xne@-T6iUai7lRSb9ze4+47h? +zJt6U12+#Ig$E&5dvHP`vWG=D|Y7snp(X9->)Pc@fdHooQuh53ivLDE56t6+N2a-d) +z)dZ&F?St>ez4Gp5=4E)9x7MVIq(w4UKpbPkV${@g-`e|6FUtF{G)PLkuj6d@!QVr` +zc~w}u@7Sw!f{l{4#@MsmIk#3KE#EByu^KOrT%dBxFoaUy4_FjwKhbfZM0RmJzY^hF +zv%jePd@@wtcJjdtOz6^~tYAbU#x%Xr};P}jC`^0=JZ`k9R);}c3 +zJ2T*I*M0C_Q60zFksQ3oDh<^m&S`C*8=7sqo71yd8>$GrSaH+i3>&vrFfaK^<7v%)h17 +zz@a(b_F?Cs=CrxE%`}MwTC~`Z5`UW^$rAM#qE2Gub|oYDjG6eR7iEH4;)vHS3dH_4 +zTDChPh;izRJL7IrMx94rJ=90x1CO@E>*azx9TWUhz8A*%Bl$~&6M(U;r>{SoZ)xfu +z9$if5oc+919EEQ~mxp&Tt$F(fmuK?GbJ?2e{!^O5xR(9#93vp{o4%l9@G5BdE-iu8 +zlLoUM>Yhz5L?#sYEb^;I$yFxjHM}C%mtX5`-qb?|27^YdN>pac_^IsTK1NM-@NE}J +zUDcc+Oq|?;^&UYJSJSVpC3s^WG}J9^KZ-gsXuT%=ux_q6YH=ccWtD_E&at6PBUSPF +zD1Kn5^n<->rw47Ll_P^tzqbNvOzFM5xlT9HRrI8hwO{Pt5V=~>Z^D$fU8v4PRf01E +z*05h3)Wx2H$B2Ak)7O)B8uSzyh&T_GT($6Wmh9#D3VmNlHjSnn+P}AWmS5&>?U!P# +zV_&vB*P9IVxQL^cQA0dV4ba@GRkVDl$Ox||WzysH&^een73kwSd1!TntE+htzdjtD +zx`YD&gfRgCzt=}Xj6T}A!jb30FGe0mOlDjc#EI_BSc5%ZPLqqRyEwgI4<&95xxnLA +zx9k6cS9l$t%RGd=^R=J6#_46r2Z(8sIqIFt0k +zOWo7F1cPA@M>Ha3Uym;_(wmt}Og!%(k*^sZJ-u+0BY}*?5xH;C)Ol<5wM$%`3^vQC3mek{h5#t +zDXuiSJ*h=GzN2a@m1dm;yrt!rOUs+L9-Rz3{oFoW&s4YW!cw3bI=nkzQLtjjJ>-=s +zp;8g{T2W#9#Hn`rNhsH<;+)J2XhmZViAXg&WhItCYPh;< +zVx&wE1^-C1+xQeTAapR3iuq`R$!evTE>8_yL0$3DFahV?f;W(=(`&;bt3KJ~DT?sWQ_nDCo})!Hm`;ncDP@#=lr~ +zng>vY=(v7;rSVCWzD>58Y^yrT&n7`w-g?#yO#i?_TIO|DoAPYk)dyD{f(nBcC3Hz| +z5?cFy6|b?DQ(>wd)U;eOg5}8HOZ(tKkP6(e=O?#rg_|Q{s)X3rBM&%Jt(c9;d=C+^ +zx}^J@FspH^=eLhTdNTJXJ|c_fr6o%Q@Tvm;*mQKlJ)^(9=q!n|W^zanCLLB9A-o{~ +zWGSk6s%Uk>`C!zrYkv;S86TL3mu2r%WNUfn{ +zRMt(f$GjyQm9ls;KZx6`RVS_hg4}3fCnzg>0+w^_d9u9`j4POtsow6+T-NRyU1>HE +zk#xzb@Psq^l7YI%>OOM%eMg|T91kcwJ(tsCFOfHmKT^BWU}Z(d^maLR~x&8E|;G +zUNy`a;}#tolq}a^C%EBXE`hvp=Q7<1@%77bVr1UMWYE$M{x&_oJnO+Mwt^z@NBVpd +zC(YSO(?ZH>pPKFJ?GF83ea%=FjsNOH-x@zliMC#R9}5orBDIPwwMs7a1-pI8^;}(i +z_zHMAFzPZ#_D||^J`qPCy*4# +z+9oEc#gatGa6d_qp_sA+p=0 +zYEO>ouoewmryGE{I6UzjguMi^rN>-__Vb1p9r1k2^UUVZL{t^G)EFz-l&Z-%Vy?v} +z3Ct^Zs(7YM2tAu_pxb=HE36K0l=ov;e21&ea)<27vh}Nt{BZR^#;X&Tw+$tx<|4tH +zt!sKpl%Ea98dd2Mb1n$N=QWKQf=mQrE`jT9q!b_5!g=^^w9 +zk28ZJ+bynqRO%(qR3zj>2jPcZ8i}?#w&>1L1f}e@i}uD;YmUcevzF-MJ*^wSzDCaZ +zI$$bPy19hae;Ys{kaWx6&~{ng<hV(*7ayCg +zT+>gm4pYO`$%JXcRx_8@n>9)Dl+#j1JZSM_el50r{aYha6dnw92|EjW&Q^A5^a+BJ +z;X%o_+9?Mw$@}iI$CVoie$q7^nix~$uq7N{2+so=q`cLxYk7Y{7d^tS??ZAz0!->f1Qt&Prl +zy-e$P%Dq-iTvC2@N=DiN=C{&(Rev+@l%`W6D?nT65gC0PMSu;3ahkHmu92h#?lt|6 +zAXL?sB3mH+mOCe0V(fz^)l)F^jQP5wB>l+Z>|Rq`}@p(dS3yX{`rITAY*)ySIrXXG;W!70PxIH;UZt&jkqyS*5BH +z4mXD^#5)Vl_;XfIVAD_fyh^9y^mILy_0s8mFM^rTWNmM2Qg0y@_xe~*@-A>_ydm8C +zczp2YQr3QsvqN~>yU$N0^k@2{h;gblXf|*)Tno<7YKN{9YjcGpswIZ9F>G_7`*y~~ +z7ZdUgeCG2akyiQWY2`J@II655a_=L9XNNd^ +z=Z>?`4m#UKYH8=qlTqq5y^3Np6?t`*Pvc)$hNs`Ty6c#DOg}A^JrF?!@hD|LVVgxQ +z>a5T|Y|}G#hz8Ay#BxOnpGt}9dsY_&YWD_U`OXEjg*)`4P05voj#1>nhg{*#l$YvG +zUq1~B@Ff@6dB`S9F6VM@hCjctg5d4m@Q&>uPD-U8&+e-^7-^`yyyY43`H)onVaC85 +z4*>9E_@^Q1&y*Ad2|l0gK8Wj$nq(#q-t)cGv;MAQtV2C|VH{+sHKNh0Hg$spKx#wz#@Dyi*t`GG;{kg7|i7&;=)W(A!>dpK;%?cXI|iS)!rn +z4+_C^Qph5 +zRt#e_>P!bO-g(f-0)hsr2gPxlu3ydaQZl$=r=JV8nzfx+ZptA~m2++G3l{S3!LriC53& +zxaC`E4sI{B`Q1#jqB;G_kGeB;Wg`d6DAtR44g!xw4fd`%h!N-+ +zW;ZZl%iawdVLGq>3J*(?ZcKvk6(-sD`vuQ=LdXRShdMwINI`ddhu*keIQlAC(56f< +zq;E_?2p89#yZgCw#!Imf6I`LKlq=IsQE^6kxy7p)Zx^1Zh|EM)KVApZcSTecwtz(K +zcsRP%oN8A1q#6XD=S@mYjMefnr7(PPM(1Vl*585iN?Iod3tT6H^*_z#_DtE9(P?CD +z8IicHM$}Oqg-^ivKnc3@!G~6|Z=S%xSP!|D8SS;lEE_Q;Rg_tE30$lHBD9t{CP3i< +z!OiX8=oy~`r@I?= +zcTvObUuM|iZBm6dbXFUrz0Q_T1^drv=F6)+lwk^eIgW?X%hg*?_a}?f`W}x&N8VMFW8RcE56i0#h2T8z4mib!`=)@BIs-v1Onhcq=nm<1!!rlZ33^BBk5zg>Qw_ +zhlAASYGjWuYxokiU2>$&rc=Y-Y{4 +z(p1Q(C3DT+B!hBfEEGvXrzgDX)D@%hhrg&f!yh(uE(HFie)BteEA*B$CgD5T^&e4v +zK-t~pxxkI^J(O_ct)TiF?&=qv(u%y)2Jquz@4WkrZ{Q7E9IR;E<>7%`6<7zD6iOP^ +zHe8V#l+X#+(R@_V3~t9AMyISk1>q-mjz`n?Z{vxy28@8xZ@}2Ls?SunuaGh_x?Tr7 +z?u@&)Y!7dch7a7on^N|LvJ&C@TJ@3{ubqG=b!&2hfaIAh`V2aCz*{(LuSm(YF4oH4 +zq~F{WxI=Ybrv|)587!E-cLTGc($&0xMGpA=e#)N}|NZoBcjfP>zwelQ2LM2r+u!Y< +zd}H}m!$0Sc&V}=b1!9`u&w2H~BY$2Wp68f;SoX!gWSssE{CN~VUq1e1m=gS0O#U7B +zv-4h0f6sI-sz2<>FPQ#AVt-F|u4+GQ +z?H6P}OYXmTzP06Z+&A4k7u_GmM)jYe{*46xQ!Dsu;qLx|^k)J7Z=J0A1<%id{8uM` +i7Ls#G{$Z;ao?i;It|l&K(hLAx#(dl``lC&A{`7zUFl)>J + +literal 0 +HcmV?d00001 + +diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx +index a7696d824bee..3e00e597c314 100644 +--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx ++++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx +@@ -16,6 +16,11 @@ + #include + #include + #include ++#include ++#include ++#include ++#include ++#include + + #include "../../inc/lib/init.hxx" + +@@ -45,14 +50,17 @@ public: + UnoApiTest::tearDown(); + }; + +- LibLODocument_Impl* loadDoc(const char* pName); ++ LibLODocument_Impl* loadDoc(const char* pName, LibreOfficeKitDocumentType eType = LOK_DOCTYPE_TEXT); + void closeDoc(); ++ static void callback(int nType, const char* pPayload, void* pData); ++ void callbackImpl(int nType, const char* pPayload); + + void testGetStyles(); + void testGetFonts(); + void testCreateView(); + void testGetFilterTypes(); + void testGetPartPageRectangles(); ++ void testSearchCalc(); + + CPPUNIT_TEST_SUITE(DesktopLOKTest); + CPPUNIT_TEST(testGetStyles); +@@ -60,16 +68,31 @@ public: + CPPUNIT_TEST(testCreateView); + CPPUNIT_TEST(testGetFilterTypes); + CPPUNIT_TEST(testGetPartPageRectangles); ++ CPPUNIT_TEST(testSearchCalc); + CPPUNIT_TEST_SUITE_END(); + + uno::Reference mxComponent; ++ OString m_aTextSelection; + }; + +-LibLODocument_Impl* DesktopLOKTest::loadDoc(const char* pName) ++LibLODocument_Impl* DesktopLOKTest::loadDoc(const char* pName, LibreOfficeKitDocumentType eType) + { + OUString aFileURL; + createFileURL(OUString::createFromAscii(pName), aFileURL); +- mxComponent = loadFromDesktop(aFileURL, "com.sun.star.text.TextDocument"); ++ OUString aService; ++ switch (eType) ++ { ++ case LOK_DOCTYPE_TEXT: ++ aService = "com.sun.star.text.TextDocument"; ++ break; ++ case LOK_DOCTYPE_SPREADSHEET: ++ aService = "com.sun.star.sheet.SpreadsheetDocument"; ++ break; ++ default: ++ CPPUNIT_ASSERT(false); ++ break; ++ } ++ mxComponent = loadFromDesktop(aFileURL, aService); + if (!mxComponent.is()) + { + CPPUNIT_ASSERT(false); +@@ -86,6 +109,23 @@ void DesktopLOKTest::closeDoc() + } + } + ++void DesktopLOKTest::callback(int nType, const char* pPayload, void* pData) ++{ ++ static_cast(pData)->callbackImpl(nType, pPayload); ++} ++ ++void DesktopLOKTest::callbackImpl(int nType, const char* pPayload) ++{ ++ switch (nType) ++ { ++ case LOK_CALLBACK_TEXT_SELECTION: ++ { ++ m_aTextSelection = pPayload; ++ } ++ break; ++ } ++} ++ + void DesktopLOKTest::testGetStyles() + { + LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); +@@ -191,6 +231,36 @@ void DesktopLOKTest::testGetFilterTypes() + free(pJSON); + } + ++void DesktopLOKTest::testSearchCalc() ++{ ++ LibLibreOffice_Impl aOffice; ++ comphelper::LibreOfficeKit::setActive(); ++ LibLODocument_Impl* pDocument = loadDoc("search.ods"); ++ pDocument->pClass->initializeForRendering(pDocument); ++ pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this); ++ ++ uno::Sequence aPropertyValues(comphelper::InitPropertySequence( ++ { ++ {"SearchItem.SearchString", uno::makeAny(OUString("foo"))}, ++ {"SearchItem.Backward", uno::makeAny(false)}, ++ {"SearchItem.Command", uno::makeAny(static_cast(SvxSearchCmd::FIND_ALL))}, ++ })); ++ comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues); ++ ++ std::vector aSelections; ++ sal_Int32 nIndex = 0; ++ do ++ { ++ OString aToken = m_aTextSelection.getToken(0, ';', nIndex); ++ aSelections.push_back(aToken); ++ } while (nIndex >= 0); ++ // This was 1, find-all only found one match. ++ CPPUNIT_ASSERT_EQUAL(static_cast(2), aSelections.size()); ++ ++ closeDoc(); ++ comphelper::LibreOfficeKit::setActive(false); ++} ++ + CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); + + CPPUNIT_PLUGIN_IMPLEMENT(); +-- +2.12.0 + diff --git a/SOURCES/0195-editeng-sw-sc-use-comphelper-string-join.patch b/SOURCES/0195-editeng-sw-sc-use-comphelper-string-join.patch new file mode 100644 index 0000000..634f42e --- /dev/null +++ b/SOURCES/0195-editeng-sw-sc-use-comphelper-string-join.patch @@ -0,0 +1,63 @@ +From eacd7a0d10a02292f723031080884a8914fc496f Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Thu, 8 Oct 2015 08:37:12 +0200 +Subject: [PATCH 195/398] editeng, sw, sc: use comphelper::string::join() + +(cherry picked from commit 1cb13d87b5d887718f6d81a842444b7251dc64cf) + +Change-Id: I9b0a32271a965bc4089720ccb61b26b67ceab7b2 +--- + sc/source/ui/view/gridwin.cxx | 13 ++++--------- + 1 file changed, 4 insertions(+), 9 deletions(-) + +diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx +index cfc0b5e27dd1..1320e27cb104 100644 +--- a/sc/source/ui/view/gridwin.cxx ++++ b/sc/source/ui/view/gridwin.cxx +@@ -134,6 +134,7 @@ + #include + #include + #include ++#include + + #define LOK_USE_UNSTABLE_API + #include +@@ -5899,9 +5900,8 @@ static void updateLibreOfficeKitSelection(ScViewData* pViewData, ScDrawLayer* pD + double nPPTY = pViewData->GetPPTY(); + + Rectangle aBoundingBox; +- std::stringstream ss; ++ std::vector aRectangles; + +- bool bIsFirst = true; + for (auto aRectangle : rRectangles) + { + aRectangle.Right() += 1; +@@ -5909,14 +5909,9 @@ static void updateLibreOfficeKitSelection(ScViewData* pViewData, ScDrawLayer* pD + + aBoundingBox.Union(aRectangle); + +- if (bIsFirst) +- bIsFirst = false; +- else +- ss << "; "; +- + Rectangle aRect(aRectangle.Left() / nPPTX, aRectangle.Top() / nPPTY, + aRectangle.Right() / nPPTX, aRectangle.Bottom() / nPPTY); +- ss << aRect.toString().getStr(); ++ aRectangles.push_back(aRect.toString()); + } + + // selection start handle +@@ -5930,7 +5925,7 @@ static void updateLibreOfficeKitSelection(ScViewData* pViewData, ScDrawLayer* pD + pDrawLayer->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_END, aEnd.toString().getStr()); + + // the selection itself +- pDrawLayer->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, ss.str().c_str()); ++ pDrawLayer->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, comphelper::string::join("; ", aRectangles).getStr()); + } + + void ScGridWindow::UpdateCursorOverlay() +-- +2.12.0 + diff --git a/SOURCES/0196-sc-tiled-rendering-implement-LOK_CALLBACK_SEARCH_RES.patch b/SOURCES/0196-sc-tiled-rendering-implement-LOK_CALLBACK_SEARCH_RES.patch new file mode 100644 index 0000000..b2085c4 --- /dev/null +++ b/SOURCES/0196-sc-tiled-rendering-implement-LOK_CALLBACK_SEARCH_RES.patch @@ -0,0 +1,178 @@ +From 88384ac6a550a05ab944fd4b56f0222ab57c4498 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Thu, 8 Oct 2015 11:49:13 +0200 +Subject: [PATCH 196/398] sc tiled rendering: implement + LOK_CALLBACK_SEARCH_RESULT_SELECTION + +Change-Id: Iaca2c1807a6e92cf7a87b0843000d65aea45fe7b +(cherry picked from commit a42f582e0e8ee4118415632795184620c6b8058c) +--- + desktop/qa/desktop_lib/test_desktop_lib.cxx | 13 +++++++++++++ + sc/source/ui/inc/gridwin.hxx | 2 ++ + sc/source/ui/view/gridwin.cxx | 23 +++++++++++++++++++--- + sc/source/ui/view/viewfun2.cxx | 30 ++++++++++++++++++++++++++--- + 4 files changed, 62 insertions(+), 6 deletions(-) + +diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx +index 3e00e597c314..e77bc8984bbf 100644 +--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx ++++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx +@@ -73,6 +73,7 @@ public: + + uno::Reference mxComponent; + OString m_aTextSelection; ++ std::vector m_aSearchResultSelection; + }; + + LibLODocument_Impl* DesktopLOKTest::loadDoc(const char* pName, LibreOfficeKitDocumentType eType) +@@ -123,6 +124,16 @@ void DesktopLOKTest::callbackImpl(int nType, const char* pPayload) + m_aTextSelection = pPayload; + } + break; ++ case LOK_CALLBACK_SEARCH_RESULT_SELECTION: ++ { ++ m_aSearchResultSelection.clear(); ++ boost::property_tree::ptree aTree; ++ std::stringstream aStream(pPayload); ++ boost::property_tree::read_json(aStream, aTree); ++ for (boost::property_tree::ptree::value_type& rValue : aTree.get_child("searchResultSelection")) ++ m_aSearchResultSelection.push_back(rValue.second.data().c_str()); ++ } ++ break; + } + } + +@@ -256,6 +267,8 @@ void DesktopLOKTest::testSearchCalc() + } while (nIndex >= 0); + // This was 1, find-all only found one match. + CPPUNIT_ASSERT_EQUAL(static_cast(2), aSelections.size()); ++ // Make sure that we get exactly as many rectangle lists as matches. ++ CPPUNIT_ASSERT_EQUAL(static_cast(2), m_aSearchResultSelection.size()); + + closeDoc(); + comphelper::LibreOfficeKit::setActive(false); +diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx +index e4bb56aac1f0..b8425a8e34c3 100644 +--- a/sc/source/ui/inc/gridwin.hxx ++++ b/sc/source/ui/inc/gridwin.hxx +@@ -337,6 +337,8 @@ public: + /// @see vcl::ITiledRenderable::setTextSelection() for the values of nType. + /// Coordinates are in pixels. + void SetCellSelectionPixel(int nType, int nPixelX, int nPixelY); ++ /// Get the cell selection, coordinates are in logic units. ++ void GetCellSelection(std::vector& rLogicRects); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE; + +diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx +index 1320e27cb104..f24b42f3b27e 100644 +--- a/sc/source/ui/view/gridwin.cxx ++++ b/sc/source/ui/view/gridwin.cxx +@@ -5890,8 +5890,12 @@ void ScGridWindow::UpdateCopySourceOverlay() + SetMapMode( aOldMode ); + } + +-/// Turn the selection ranges rRectangles into the LibreOfficeKit selection, and call the callback. +-static void updateLibreOfficeKitSelection(ScViewData* pViewData, ScDrawLayer* pDrawLayer, const std::vector& rRectangles) ++/** ++ * Turn the selection ranges rRectangles into the LibreOfficeKit selection, and call the callback. ++ * ++ * @param pLogicRects - if not 0, then don't invoke the callback, just collect the rectangles in the pointed vector. ++ */ ++static void updateLibreOfficeKitSelection(ScViewData* pViewData, ScDrawLayer* pDrawLayer, const std::vector& rRectangles, std::vector* pLogicRects = 0) + { + if (!pDrawLayer->isTiledRendering()) + return; +@@ -5911,9 +5915,15 @@ static void updateLibreOfficeKitSelection(ScViewData* pViewData, ScDrawLayer* pD + + Rectangle aRect(aRectangle.Left() / nPPTX, aRectangle.Top() / nPPTY, + aRectangle.Right() / nPPTX, aRectangle.Bottom() / nPPTY); +- aRectangles.push_back(aRect.toString()); ++ if (pLogicRects) ++ pLogicRects->push_back(aRect); ++ else ++ aRectangles.push_back(aRect.toString()); + } + ++ if (pLogicRects) ++ return; ++ + // selection start handle + Rectangle aStart(aBoundingBox.Left() / nPPTX, aBoundingBox.Top() / nPPTY, + aBoundingBox.Left() / nPPTX, (aBoundingBox.Top() / nPPTY) + 256); +@@ -6097,6 +6107,13 @@ void ScGridWindow::UpdateCursorOverlay() + SetMapMode( aOldMode ); + } + ++void ScGridWindow::GetCellSelection(std::vector& rLogicRects) ++{ ++ std::vector aPixelRects; ++ GetSelectionRects(aPixelRects); ++ updateLibreOfficeKitSelection(pViewData, pViewData->GetDocument()->GetDrawLayer(), aPixelRects, &rLogicRects); ++} ++ + void ScGridWindow::DeleteSelectionOverlay() + { + mpOOSelection.reset(); +diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx +index 555492f17538..2be84a4c8e39 100644 +--- a/sc/source/ui/view/viewfun2.cxx ++++ b/sc/source/ui/view/viewfun2.cxx +@@ -91,6 +91,7 @@ + #include + #include + #include ++#include + + using namespace com::sun::star; + using ::editeng::SvxBorderLine; +@@ -1838,20 +1839,43 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem, + AlignToCursor( nCol, nRow, SC_FOLLOW_JUMP ); + SetCursor( nCol, nRow, true ); + +- // Don't move cell selection handles for find-all: selection of all but the first result would be lost. +- if (rDoc.GetDrawLayer()->isTiledRendering() && nCommand == SvxSearchCmd::FIND) ++ if (rDoc.GetDrawLayer()->isTiledRendering()) + { + Point aCurPos = GetViewData().GetScrPos(nCol, nRow, GetViewData().GetActivePart()); + + // just update the cell selection + ScGridWindow* pGridWindow = GetViewData().GetActiveWin(); +- if (pGridWindow) ++ // Don't move cell selection handles for find-all: selection of all but the first result would be lost. ++ if (pGridWindow && nCommand == SvxSearchCmd::FIND) + { + // move the cell selection handles + pGridWindow->SetCellSelectionPixel(LOK_SETTEXTSELECTION_RESET, aCurPos.X(), aCurPos.Y()); + pGridWindow->SetCellSelectionPixel(LOK_SETTEXTSELECTION_START, aCurPos.X(), aCurPos.Y()); + pGridWindow->SetCellSelectionPixel(LOK_SETTEXTSELECTION_END, aCurPos.X(), aCurPos.Y()); + } ++ ++ if (pGridWindow) ++ { ++ std::vector aLogicRects; ++ pGridWindow->GetCellSelection(aLogicRects); ++ ++ boost::property_tree::ptree aTree; ++ aTree.put("searchString", pSearchItem->GetSearchString().toUtf8().getStr()); ++ ++ boost::property_tree::ptree aSelections; ++ for (const Rectangle& rLogicRect : aLogicRects) ++ { ++ boost::property_tree::ptree aSelection; ++ aSelection.put("", rLogicRect.toString().getStr()); ++ aSelections.push_back(std::make_pair("", aSelection)); ++ } ++ aTree.add_child("searchResultSelection", aSelections); ++ ++ std::stringstream aStream; ++ boost::property_tree::write_json(aStream, aTree); ++ OString aPayload = aStream.str().c_str(); ++ rDoc.GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr()); ++ } + } + + if ( nCommand == SvxSearchCmd::REPLACE +-- +2.12.0 + diff --git a/SOURCES/0197-LOK-CALLBACK_SEARCH_RESULT_COUNT-is-redundant.patch b/SOURCES/0197-LOK-CALLBACK_SEARCH_RESULT_COUNT-is-redundant.patch new file mode 100644 index 0000000..892e52a --- /dev/null +++ b/SOURCES/0197-LOK-CALLBACK_SEARCH_RESULT_COUNT-is-redundant.patch @@ -0,0 +1,182 @@ +From 764878984eaaf6099dc2eb7dced5f6faa775bb8a Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 9 Oct 2015 08:08:48 +0200 +Subject: [PATCH 197/398] LOK: CALLBACK_SEARCH_RESULT_COUNT is redundant + +1) The size of the searchResultSelection array in +LOK_CALLBACK_SEARCH_RESULT_SELECTION provides the same information. + +2) None of the clients except lokdocview used it. + +3) Only sw provided this callback, not sc/sd. + +Change-Id: I9da639b6693f24634f298f9bc4773f705e944359 +(cherry picked from commit f0e3fe840b6f103c589f044bbde18b2faa345279) +--- + include/LibreOfficeKit/LibreOfficeKitEnums.h | 6 ------ + libreofficekit/source/gtk/lokdocview.cxx | 14 ++++++-------- + sw/qa/extras/tiledrendering/tiledrendering.cxx | 12 +----------- + sw/source/uibase/uiview/viewsrch.cxx | 14 +++++--------- + 4 files changed, 12 insertions(+), 34 deletions(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h +index b87f69a39989..0da87699b1b5 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h ++++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h +@@ -158,12 +158,6 @@ typedef enum + LOK_CALLBACK_SET_PART, + + /** +- * Number of search results followed by the original searched phrase. +- * count;phrase +- */ +- LOK_CALLBACK_SEARCH_RESULT_COUNT, +- +- /** + * Selection rectangles of the search result when find all is performed. + * + * Payload format example, in case of two matches: +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index a40496eb7357..3f1d5815d05d 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -12,6 +12,7 @@ + #include + #include + #include ++#include + + #include + #define LOK_USE_UNSTABLE_API +@@ -227,8 +228,6 @@ callbackTypeToString (int nType) + return "LOK_CALLBACK_STATUS_INDICATOR_FINISH"; + case LOK_CALLBACK_SEARCH_NOT_FOUND: + return "LOK_CALLBACK_SEARCH_NOT_FOUND"; +- case LOK_CALLBACK_SEARCH_RESULT_COUNT: +- return "LOK_CALLBACK_SEARCH_RESULT_COUNT"; + case LOK_CALLBACK_DOCUMENT_SIZE_CHANGED: + return "LOK_CALLBACK_DOCUMENT_SIZE_CHANGED"; + case LOK_CALLBACK_SET_PART: +@@ -661,12 +660,6 @@ callback (gpointer pData) + searchNotFound(pDocView, pCallback->m_aPayload); + } + break; +- case LOK_CALLBACK_SEARCH_RESULT_COUNT: +- { +- size_t nPos = pCallback->m_aPayload.find_first_of(";"); +- searchResultCount(pDocView, pCallback->m_aPayload.substr(0, nPos)); +- } +- break; + case LOK_CALLBACK_DOCUMENT_SIZE_CHANGED: + { + payloadToSize(pCallback->m_aPayload.c_str(), priv->m_nDocumentWidthTwips, priv->m_nDocumentHeightTwips); +@@ -684,6 +677,11 @@ callback (gpointer pData) + break; + case LOK_CALLBACK_SEARCH_RESULT_SELECTION: + { ++ boost::property_tree::ptree aTree; ++ std::stringstream aStream(pCallback->m_aPayload); ++ boost::property_tree::read_json(aStream, aTree); ++ int nCount = aTree.get_child("searchResultSelection").size(); ++ searchResultCount(pDocView, std::to_string(nCount)); + } + break; + default: +diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx +index 1eb57dea109e..eb59b62b9208 100644 +--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx ++++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx +@@ -72,13 +72,11 @@ private: + Size m_aDocumentSize; + OString m_aTextSelection; + bool m_bFound; +- sal_Int32 m_nSearchResultCount; + std::vector m_aSearchResultSelection; + }; + + SwTiledRenderingTest::SwTiledRenderingTest() +- : m_bFound(true), +- m_nSearchResultCount(0) ++ : m_bFound(true) + { + } + +@@ -134,12 +132,6 @@ void SwTiledRenderingTest::callbackImpl(int nType, const char* pPayload) + m_bFound = false; + } + break; +- case LOK_CALLBACK_SEARCH_RESULT_COUNT: +- { +- std::string aStrPayload(pPayload); +- m_nSearchResultCount = std::stoi(aStrPayload.substr(0, aStrPayload.find_first_of(";"))); +- } +- break; + case LOK_CALLBACK_SEARCH_RESULT_SELECTION: + { + m_aSearchResultSelection.clear(); +@@ -485,8 +477,6 @@ void SwTiledRenderingTest::testSearchAll() + })); + comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues); + // This was 0; should be 2 results in the body text. +- CPPUNIT_ASSERT_EQUAL(static_cast(2), m_nSearchResultCount); +- // Make sure that we get exactly as many rectangle lists as matches. + CPPUNIT_ASSERT_EQUAL(static_cast(2), m_aSearchResultSelection.size()); + + comphelper::LibreOfficeKit::setActive(false); +diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx +index c8d3e7a571ea..7f1addcc3f6b 100644 +--- a/sw/source/uibase/uiview/viewsrch.cxx ++++ b/sw/source/uibase/uiview/viewsrch.cxx +@@ -103,11 +103,8 @@ static void lcl_addContainerToJson(boost::property_tree::ptree& rTree, const OSt + } + + /// Emits LOK callbacks (count, selection) for search results. +-static void lcl_emitSearchResultCallbacks(sal_uInt16 nFound, SvxSearchItem* pSearchItem, SwWrtShell* pWrtShell) ++static void lcl_emitSearchResultCallbacks(SvxSearchItem* pSearchItem, SwWrtShell* pWrtShell) + { +- OString aPayload = OString::number(nFound) + ";" + pSearchItem->GetSearchString().toUtf8(); +- pWrtShell->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_RESULT_COUNT, aPayload.getStr()); +- + // Emit a callback also about the selection rectangles, grouped by matches. + if (SwPaM* pPaM = pWrtShell->GetCrsr()) + { +@@ -141,7 +138,7 @@ static void lcl_emitSearchResultCallbacks(sal_uInt16 nFound, SvxSearchItem* pSea + + std::stringstream aStream; + boost::property_tree::write_json(aStream, aTree); +- aPayload = aStream.str().c_str(); ++ OString aPayload = aStream.str().c_str(); + + pWrtShell->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr()); + } +@@ -256,7 +253,7 @@ void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage) + { + Scroll(m_pWrtShell->GetCharRect().SVRect()); + if (comphelper::LibreOfficeKit::isActive()) +- lcl_emitSearchResultCallbacks(1, m_pSrchItem, m_pWrtShell); ++ lcl_emitSearchResultCallbacks(m_pSrchItem, m_pWrtShell); + } + rReq.SetReturnValue(SfxBoolItem(nSlot, bRet)); + #if HAVE_FEATURE_DESKTOP +@@ -275,8 +272,7 @@ void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage) + break; + case SvxSearchCmd::FIND_ALL: + { +- sal_uInt16 nFound = 0; +- bool bRet = SearchAll(&nFound); ++ bool bRet = SearchAll(); + if( !bRet ) + { + #if HAVE_FEATURE_DESKTOP +@@ -290,7 +286,7 @@ void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage) + m_bFound = false; + } + else if (comphelper::LibreOfficeKit::isActive()) +- lcl_emitSearchResultCallbacks(nFound, m_pSrchItem, m_pWrtShell); ++ lcl_emitSearchResultCallbacks(m_pSrchItem, m_pWrtShell); + rReq.SetReturnValue(SfxBoolItem(nSlot, bRet)); + #if HAVE_FEATURE_DESKTOP + { +-- +2.12.0 + diff --git a/SOURCES/0198-lokdocview-log-postUnoCommand-arguments.patch b/SOURCES/0198-lokdocview-log-postUnoCommand-arguments.patch new file mode 100644 index 0000000..0f5c6be --- /dev/null +++ b/SOURCES/0198-lokdocview-log-postUnoCommand-arguments.patch @@ -0,0 +1,37 @@ +From c63b17a5bc9f15f1b04c01733e439486efe85003 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 9 Oct 2015 08:27:48 +0200 +Subject: [PATCH 198/398] lokdocview: log postUnoCommand() arguments + +Change-Id: I0febc2b89d95bde59ad9d3a90d404b3932cc3624 +(cherry picked from commit 2e1503dbd01aa62ae4ad0af4f481797521c1c8d5) +--- + libreofficekit/source/gtk/lokdocview.cxx | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 3f1d5815d05d..4af48bbea5a5 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -698,7 +698,7 @@ static void callbackWorker (int nType, const char* pPayload, void* pData) + LOKDocView* pDocView = LOK_DOC_VIEW (pData); + + CallbackData* pCallback = new CallbackData(nType, pPayload ? pPayload : "(nil)", pDocView); +- g_info("lok_doc_view_callbackWorker: %s, '%s'", callbackTypeToString(nType), pPayload); ++ g_info("callbackWorker: %s, '%s'", callbackTypeToString(nType), pPayload); + gdk_threads_add_idle(callback, pCallback); + } + +@@ -1365,6 +1365,9 @@ postCommandInThread (gpointer data) + LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); + + priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId); ++ std::stringstream ss; ++ ss << "lok::Document::postUnoCommand(" << pLOEvent->m_pCommand << ", " << pLOEvent->m_pArguments << ")"; ++ g_info(ss.str().c_str()); + priv->m_pDocument->pClass->postUnoCommand(priv->m_pDocument, pLOEvent->m_pCommand, pLOEvent->m_pArguments); + } + +-- +2.12.0 + diff --git a/SOURCES/0199-gtktiledviewer-drop-tiles-on-set-part-event.patch b/SOURCES/0199-gtktiledviewer-drop-tiles-on-set-part-event.patch new file mode 100644 index 0000000..72b2047 --- /dev/null +++ b/SOURCES/0199-gtktiledviewer-drop-tiles-on-set-part-event.patch @@ -0,0 +1,41 @@ +From 668c19de934fbdb0c5e4ae3fecf133a3bd90ef34 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Mon, 12 Oct 2015 12:41:49 +0200 +Subject: [PATCH 199/398] gtktiledviewer: drop tiles on set-part event + +When changePart() is called, we have two type of actions: + +- the ones we want to execute only in case the part was changed by the + user (and not programatically -- e.g. because the request came from + the widget) +- the ones we want to execute all the time + +Resetting the view (so the tile buffer drops all the tiles) is something +we want to do all the time, that's one of the needed things when the +set-part event is emitted. + +Change-Id: Ic6bfbe460dc5a3fd8834f3b1ef93436fc9d3ad84 +(cherry picked from commit 27fa10fa53c7ff28c2636b6b49118c87c822f2fd) +--- + libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 3d0b0deba323..3b5d456586e6 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -535,10 +535,8 @@ static void changePart( GtkWidget* pSelector, gpointer /* pItem */ ) + TiledWindow& rWindow = lcl_getTiledWindow(pSelector); + + if (rWindow.m_bPartSelectorBroadcast && rWindow.m_pDocView) +- { + lok_doc_view_set_part( LOK_DOC_VIEW(rWindow.m_pDocView), nPart ); +- lok_doc_view_reset_view( LOK_DOC_VIEW(rWindow.m_pDocView) ); +- } ++ lok_doc_view_reset_view(LOK_DOC_VIEW(rWindow.m_pDocView)); + } + + static void removeChildrenFromStatusbar(GtkWidget* children, gpointer pData) +-- +2.12.0 + diff --git a/SOURCES/0200-sd-tiled-rendering-make-invalidation-in-DrawViewShel.patch b/SOURCES/0200-sd-tiled-rendering-make-invalidation-in-DrawViewShel.patch new file mode 100644 index 0000000..769505f --- /dev/null +++ b/SOURCES/0200-sd-tiled-rendering-make-invalidation-in-DrawViewShel.patch @@ -0,0 +1,66 @@ +From 3579df2e34825da4939c5b10d17c79872badc549 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Mon, 12 Oct 2015 14:25:18 +0200 +Subject: [PATCH 200/398] sd tiled rendering: make invalidation in + DrawViewShell::SwitchPage() optional + +In case of tiled rendering clients already get LOK_CALLBACK_SET_PART +when switching slides, so it's pointless to additionally invalidate +windows for help lines. + +Change-Id: Ibc15c9862ae85bd72328161fa5f7e72d82fd2a97 +(cherry picked from commit ca3436723455a0d0f3ced6f33b646b7c79ab05a1) +--- + include/svx/svdpagv.hxx | 2 +- + sd/source/ui/view/drviews1.cxx | 3 ++- + svx/source/svdraw/svdpagv.cxx | 5 +++-- + 3 files changed, 6 insertions(+), 4 deletions(-) + +diff --git a/include/svx/svdpagv.hxx b/include/svx/svdpagv.hxx +index f28e3e7cb79d..3b890c13cd70 100644 +--- a/include/svx/svdpagv.hxx ++++ b/include/svx/svdpagv.hxx +@@ -224,7 +224,7 @@ public: + const SetOfByte& GetLockedLayers() const { return aLayerLock; } + + const SdrHelpLineList& GetHelpLines() const { return aHelpLines; } +- void SetHelpLines(const SdrHelpLineList& rHLL); ++ void SetHelpLines(const SdrHelpLineList& rHLL, bool bInvalidate = true); + //void SetHelpLinePos(sal_uInt16 nNum, const Point& rNewPos); + void SetHelpLine(sal_uInt16 nNum, const SdrHelpLine& rNewHelpLine); + void DeleteHelpLine(sal_uInt16 nNum); +diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx +index 3b749419e860..c92cfde79262 100644 +--- a/sd/source/ui/view/drviews1.cxx ++++ b/sd/source/ui/view/drviews1.cxx +@@ -986,7 +986,8 @@ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage) + } + else + { +- pNewPageView->SetHelpLines( mpFrameView->GetStandardHelpLines() ); ++ bool bInvalidate = !comphelper::LibreOfficeKit::isActive(); ++ pNewPageView->SetHelpLines( mpFrameView->GetStandardHelpLines(), bInvalidate ); + } + } + +diff --git a/svx/source/svdraw/svdpagv.cxx b/svx/source/svdraw/svdpagv.cxx +index 9c74d433e1c9..47fa8f52b471 100644 +--- a/svx/source/svdraw/svdpagv.cxx ++++ b/svx/source/svdraw/svdpagv.cxx +@@ -741,10 +741,11 @@ void SdrPageView::ImpInvalidateHelpLineArea(sal_uInt16 nNum) const + } + } + +-void SdrPageView::SetHelpLines(const SdrHelpLineList& rHLL) ++void SdrPageView::SetHelpLines(const SdrHelpLineList& rHLL, bool bInvalidate) + { + aHelpLines=rHLL; +- InvalidateAllWin(); ++ if (bInvalidate) ++ InvalidateAllWin(); + } + + void SdrPageView::SetHelpLine(sal_uInt16 nNum, const SdrHelpLine& rNewHelpLine) +-- +2.12.0 + diff --git a/SOURCES/0201-tdf-95002-sd-tiled-rendering-fix-handling-of-images-.patch b/SOURCES/0201-tdf-95002-sd-tiled-rendering-fix-handling-of-images-.patch new file mode 100644 index 0000000..fc787fd --- /dev/null +++ b/SOURCES/0201-tdf-95002-sd-tiled-rendering-fix-handling-of-images-.patch @@ -0,0 +1,97 @@ +From 07a7cf95d91cbd776490543762902136280994fe Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 13 Oct 2015 10:46:59 +0200 +Subject: [PATCH 201/398] tdf#95002 sd tiled rendering: fix handling of images + on page switch + +It turns out a full invalidation is still needed to trigger the loading +of graphics on the new page, so instead of not invalidating just don't +emit the notification about it during page switch. + +(cherry picked from commit 1631fa9a722553da1ebe0650a65e859862c4405d) + +Change-Id: Ic99a3d4e268b3db61cf09c78ed0f310c9d365867 +--- + include/svx/svdpagv.hxx | 2 +- + sd/source/ui/inc/DrawViewShell.hxx | 2 ++ + sd/source/ui/view/drviews1.cxx | 3 +-- + sd/source/ui/view/sdwindow.cxx | 4 ++++ + svx/source/svdraw/svdpagv.cxx | 5 ++--- + 5 files changed, 10 insertions(+), 6 deletions(-) + +diff --git a/include/svx/svdpagv.hxx b/include/svx/svdpagv.hxx +index 3b890c13cd70..f28e3e7cb79d 100644 +--- a/include/svx/svdpagv.hxx ++++ b/include/svx/svdpagv.hxx +@@ -224,7 +224,7 @@ public: + const SetOfByte& GetLockedLayers() const { return aLayerLock; } + + const SdrHelpLineList& GetHelpLines() const { return aHelpLines; } +- void SetHelpLines(const SdrHelpLineList& rHLL, bool bInvalidate = true); ++ void SetHelpLines(const SdrHelpLineList& rHLL); + //void SetHelpLinePos(sal_uInt16 nNum, const Point& rNewPos); + void SetHelpLine(sal_uInt16 nNum, const SdrHelpLine& rNewHelpLine); + void DeleteHelpLine(sal_uInt16 nNum); +diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx +index 405e7af90876..cba478b8af7e 100644 +--- a/sd/source/ui/inc/DrawViewShell.hxx ++++ b/sd/source/ui/inc/DrawViewShell.hxx +@@ -376,6 +376,8 @@ public: + + OUString GetSidebarContextName() const; + ++ bool IsInSwitchPage() { return mbIsInSwitchPage; } ++ + //move this method to ViewShell. + //void NotifyAccUpdate(); + protected: +diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx +index c92cfde79262..3b749419e860 100644 +--- a/sd/source/ui/view/drviews1.cxx ++++ b/sd/source/ui/view/drviews1.cxx +@@ -986,8 +986,7 @@ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage) + } + else + { +- bool bInvalidate = !comphelper::LibreOfficeKit::isActive(); +- pNewPageView->SetHelpLines( mpFrameView->GetStandardHelpLines(), bInvalidate ); ++ pNewPageView->SetHelpLines( mpFrameView->GetStandardHelpLines() ); + } + } + +diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx +index c9c4bfe15b61..7149cf99b694 100644 +--- a/sd/source/ui/view/sdwindow.cxx ++++ b/sd/source/ui/view/sdwindow.cxx +@@ -1006,6 +1006,10 @@ Selection Window::GetSurroundingTextSelection() const + + void Window::LogicInvalidate(const Rectangle* pRectangle) + { ++ DrawViewShell* pDrawViewShell = dynamic_cast(mpViewShell); ++ if (pDrawViewShell && pDrawViewShell->IsInSwitchPage()) ++ return; ++ + OString sRectangle; + if (!pRectangle) + sRectangle = "EMPTY"; +diff --git a/svx/source/svdraw/svdpagv.cxx b/svx/source/svdraw/svdpagv.cxx +index 47fa8f52b471..9c74d433e1c9 100644 +--- a/svx/source/svdraw/svdpagv.cxx ++++ b/svx/source/svdraw/svdpagv.cxx +@@ -741,11 +741,10 @@ void SdrPageView::ImpInvalidateHelpLineArea(sal_uInt16 nNum) const + } + } + +-void SdrPageView::SetHelpLines(const SdrHelpLineList& rHLL, bool bInvalidate) ++void SdrPageView::SetHelpLines(const SdrHelpLineList& rHLL) + { + aHelpLines=rHLL; +- if (bInvalidate) +- InvalidateAllWin(); ++ InvalidateAllWin(); + } + + void SdrPageView::SetHelpLine(sal_uInt16 nNum, const SdrHelpLine& rNewHelpLine) +-- +2.12.0 + diff --git a/SOURCES/0202-disable-test-that-causes-inf.-loop.patch b/SOURCES/0202-disable-test-that-causes-inf.-loop.patch new file mode 100644 index 0000000..924bfdd --- /dev/null +++ b/SOURCES/0202-disable-test-that-causes-inf.-loop.patch @@ -0,0 +1,25 @@ +From ad972ff3800abe1e6336d545d0ba33593bd67f84 Mon Sep 17 00:00:00 2001 +From: David Tardon +Date: Mon, 20 Mar 2017 13:31:57 +0100 +Subject: [PATCH 202/398] disable test that causes inf. loop + +Change-Id: I24b58fb9fa6653a178bbee5fa9826fe3b03204c1 +--- + sw/qa/extras/tiledrendering/tiledrendering.cxx | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx +index eb59b62b9208..5e2b30ab7fde 100644 +--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx ++++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx +@@ -61,7 +61,6 @@ public: + CPPUNIT_TEST(testSearchTextFrame); + CPPUNIT_TEST(testSearchTextFrameWrapAround); + CPPUNIT_TEST(testDocumentSizeChanged); +- CPPUNIT_TEST(testSearchAll); + CPPUNIT_TEST_SUITE_END(); + + private: +-- +2.12.0 + diff --git a/SOURCES/0203-sd-tiled-rendering-implement-LOK_CALLBACK_SEARCH_RES.patch b/SOURCES/0203-sd-tiled-rendering-implement-LOK_CALLBACK_SEARCH_RES.patch new file mode 100644 index 0000000..3c67a89 --- /dev/null +++ b/SOURCES/0203-sd-tiled-rendering-implement-LOK_CALLBACK_SEARCH_RES.patch @@ -0,0 +1,73 @@ +From 32147fe3622284f6da6a2b3e577698a2a188a4b4 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 13 Oct 2015 15:55:55 +0200 +Subject: [PATCH 203/398] sd tiled rendering: implement + LOK_CALLBACK_SEARCH_RESULT_SELECTION + +Given that sd doesn't support find-all yet, this works for normal find +only at the moment (so it may report multiple rectangles, but always a +single match). + +Change-Id: I47bd0d0161b9d1dc843bb503f5521f311fc158c4 +(cherry picked from commit 395cfab05752b87ae419304789d894c0fe9a98c2) +--- + sd/source/ui/view/Outliner.cxx | 25 ++++++++++++++++++++++++- + 1 file changed, 24 insertions(+), 1 deletion(-) + +diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx +index 8d88518c931f..41bf43d253f4 100644 +--- a/sd/source/ui/view/Outliner.cxx ++++ b/sd/source/ui/view/Outliner.cxx +@@ -18,6 +18,7 @@ + */ + + #include "Outliner.hxx" ++#include + #include + #include + +@@ -71,6 +72,7 @@ + #include + #include + #include ++#include + + using namespace ::com::sun::star; + using namespace ::com::sun::star::uno; +@@ -720,11 +722,32 @@ bool Outliner::SearchAndReplaceOnce() + + mpDrawDocument->GetDocSh()->SetWaitCursor( false ); + +- // notify LibreOfficeKit about changed page + if (pViewShell && pViewShell->GetDoc()->isTiledRendering() && mbStringFound) + { ++ // notify LibreOfficeKit about changed page + OString aPayload = OString::number(maCurrentPosition.mnPageIndex); + pViewShell->GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); ++ ++ // also about search result selections ++ std::vector aLogicRects; ++ pOutlinerView->GetSelectionRectangles(aLogicRects); ++ ++ boost::property_tree::ptree aTree; ++ aTree.put("searchString", mpSearchItem->GetSearchString().toUtf8().getStr()); ++ ++ std::vector aLogicRectStrings; ++ std::transform(aLogicRects.begin(), aLogicRects.end(), std::back_inserter(aLogicRectStrings), [](const Rectangle& rRectangle) { return rRectangle.toString(); }); ++ OString sRectangles = comphelper::string::join("; ", aLogicRectStrings); ++ boost::property_tree::ptree aChildren; ++ boost::property_tree::ptree aChild; ++ aChild.put("", sRectangles.getStr()); ++ aChildren.push_back(std::make_pair("", aChild)); ++ aTree.add_child("searchResultSelection", aChildren); ++ ++ std::stringstream aStream; ++ boost::property_tree::write_json(aStream, aTree); ++ aPayload = aStream.str().c_str(); ++ pViewShell->GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr()); + } + + return mbEndOfSearch; +-- +2.12.0 + diff --git a/SOURCES/0204-CppunitTest_sd_tiledrendering-CALLBACK_SEARCH_RESULT.patch b/SOURCES/0204-CppunitTest_sd_tiledrendering-CALLBACK_SEARCH_RESULT.patch new file mode 100644 index 0000000..cc2ae26 --- /dev/null +++ b/SOURCES/0204-CppunitTest_sd_tiledrendering-CALLBACK_SEARCH_RESULT.patch @@ -0,0 +1,74 @@ +From 01f73ec6b52c617a4d64b89de93aed3a6896fcf6 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 13 Oct 2015 16:38:37 +0200 +Subject: [PATCH 204/398] CppunitTest_sd_tiledrendering: + CALLBACK_SEARCH_RESULT_SELECTION testcase + +Change-Id: I8a2fcaad5806ef204cdac0f6eaac615d50d6d9e8 +(cherry picked from commit 28a5d4b5d3641837f3be8bc39ead111f9bba7015) +--- + sd/qa/unit/tiledrendering/tiledrendering.cxx | 20 +++++++++++++++++--- + 1 file changed, 17 insertions(+), 3 deletions(-) + +diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx +index 8ed091998ef1..f35449b12b2c 100644 +--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx ++++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx +@@ -7,6 +7,10 @@ + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + ++#include ++#include ++#include ++#include + #define LOK_USE_UNSTABLE_API + #include + #include +@@ -19,9 +23,6 @@ + #include + #include + #include +-#include +-#include +-#include + + #include + #include +@@ -78,6 +79,7 @@ private: + std::vector m_aSelection; + bool m_bFound; + sal_Int32 m_nPart; ++ std::vector m_aSearchResultSelection; + #endif + }; + +@@ -182,6 +184,16 @@ void SdTiledRenderingTest::callbackImpl(int nType, const char* pPayload) + m_nPart = aPayload.toInt32(); + } + break; ++ case LOK_CALLBACK_SEARCH_RESULT_SELECTION: ++ { ++ m_aSearchResultSelection.clear(); ++ boost::property_tree::ptree aTree; ++ std::stringstream aStream(pPayload); ++ boost::property_tree::read_json(aStream, aTree); ++ for (boost::property_tree::ptree::value_type& rValue : aTree.get_child("searchResultSelection")) ++ m_aSearchResultSelection.push_back(rValue.second.data().c_str()); ++ } ++ break; + } + } + +@@ -387,6 +399,8 @@ void SdTiledRenderingTest::testSearch() + lcl_search("bbb"); + CPPUNIT_ASSERT_EQUAL(static_cast(1), m_nPart); + CPPUNIT_ASSERT_EQUAL(true, m_bFound); ++ // This was 0; should be 1 match for "find". ++ CPPUNIT_ASSERT_EQUAL(static_cast(1), m_aSearchResultSelection.size()); + + // This should trigger the not-found callback. + Application::EnableHeadlessMode(false); +-- +2.12.0 + diff --git a/SOURCES/0205-Bump-gtk-version-to-2.18.patch b/SOURCES/0205-Bump-gtk-version-to-2.18.patch new file mode 100644 index 0000000..224dab5 --- /dev/null +++ b/SOURCES/0205-Bump-gtk-version-to-2.18.patch @@ -0,0 +1,292 @@ +From 98252b0c534e71b65f720af9d97a6a358268076d Mon Sep 17 00:00:00 2001 +From: Riccardo Magliocchetti +Date: Mon, 12 Oct 2015 22:13:37 +0200 +Subject: [PATCH 205/398] Bump gtk+ version to 2.18 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +2.18 is the version available in RHEL 6 released in 2010. + +Change-Id: I4cd4fc89f6b51e6f58ca72b8182f80316b1f4f88 +Reviewed-on: https://gerrit.libreoffice.org/19330 +Reviewed-by: Caolán McNamara +Tested-by: Caolán McNamara +(cherry picked from commit 068c04fb06806a9345c0059545d19a416d7e60b7) +--- + configure.ac | 4 +-- + .../qa/gtktiledviewer/gtktiledviewer.cxx | 2 -- + sfx2/source/appl/shutdowniconunx.cxx | 6 ++--- + vcl/unx/gtk/app/gtkdata.cxx | 5 ++-- + vcl/unx/gtk/app/gtkinst.cxx | 4 +-- + vcl/unx/gtk/app/gtksys.cxx | 4 --- + vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx | 31 +++++++++------------- + vcl/unx/gtk/gdi/salprn-gtk.cxx | 14 ---------- + vcl/unx/gtk/inc/gtkprintwrapper.hxx | 6 ----- + 9 files changed, 20 insertions(+), 56 deletions(-) + +diff --git a/configure.ac b/configure.ac +index b1ec23a5afa3..12983e074c7d 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -10126,7 +10126,7 @@ ENABLE_SYSTRAY_GTK="" + if test "$test_gtk" = "yes"; then + + if test "$ENABLE_GTK" = "TRUE"; then +- PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.10.0 gdk-pixbuf-2.0 >= 2.2 ,,AC_MSG_ERROR([requirements to build the gtk-plugin not met. Use --disable-gtk or install the missing packages])) ++ PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.18.0 gdk-pixbuf-2.0 >= 2.2 ,,AC_MSG_ERROR([requirements to build the gtk-plugin not met. Use --disable-gtk or install the missing packages])) + GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g") + PKG_CHECK_MODULES(GTHREAD, gthread-2.0,,AC_MSG_ERROR([requirements to build the gtk-plugin not met. Use --disable-gtk or install the missing packages])) + BUILD_TYPE="$BUILD_TYPE GTK" +@@ -10185,7 +10185,7 @@ if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_telepathy" = "yes"; + ENABLE_TELEPATHY="TRUE" + AC_DEFINE(ENABLE_TELEPATHY) + AC_MSG_RESULT([yes]) +- PKG_CHECK_MODULES( TELEPATHY, telepathy-glib >= 0.18.0 glib-2.0 gobject-2.0 gthread-2.0 gio-2.0 gtk+-2.0 >= 2.10 ) ++ PKG_CHECK_MODULES( TELEPATHY, telepathy-glib >= 0.18.0 glib-2.0 gobject-2.0 gthread-2.0 gio-2.0 gtk+-2.0 >= 2.18.0 ) + TELEPATHY_CFLAGS=$(printf '%s' "$TELEPATHY_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g") + else + AC_MSG_RESULT([no]) +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 3b5d456586e6..e7e276dfce17 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -102,7 +102,6 @@ const float fZooms[] = { 0.25, 0.5, 0.75, 1.0, 1.5, 2.0, 3.0, 5.0 }; + /// Get the visible area of the scrolled window + static void getVisibleAreaTwips(GtkWidget* pDocView, GdkRectangle* pArea) + { +-#if GTK_CHECK_VERSION(2,14,0) // we need gtk_adjustment_get_page_size() + TiledWindow& rWindow = lcl_getTiledWindow(pDocView); + + GtkAdjustment* pHAdjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(rWindow.m_pScrolledWindow)); +@@ -116,7 +115,6 @@ static void getVisibleAreaTwips(GtkWidget* pDocView, GdkRectangle* pArea) + gtk_adjustment_get_page_size(pHAdjustment)); + pArea->height = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView), + gtk_adjustment_get_page_size(pVAdjustment)); +-#endif + } + + static void changeZoom( GtkWidget* pButton, gpointer /* pItem */ ) +diff --git a/sfx2/source/appl/shutdowniconunx.cxx b/sfx2/source/appl/shutdowniconunx.cxx +index 90349f7261b0..2de5654fe28a 100644 +--- a/sfx2/source/appl/shutdowniconunx.cxx ++++ b/sfx2/source/appl/shutdowniconunx.cxx +@@ -370,10 +370,8 @@ void plugin_init_sys_tray() + { + ::SolarMutexGuard aGuard; + +- if( /* need gtk_status to resolve */ +- (gtk_check_version( 2, 10, 0 ) != NULL) || +- /* we need the vcl plugin and mainloop initialized */ +- !g_type_from_name( "GdkDisplay" ) ) ++ /* we need the vcl plugin and mainloop initialized */ ++ if (!g_type_from_name( "GdkDisplay" )) + return; + + OString aLabel; +diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx +index 445ae0a61772..ec2886fa4172 100644 +--- a/vcl/unx/gtk/app/gtkdata.cxx ++++ b/vcl/unx/gtk/app/gtkdata.cxx +@@ -750,9 +750,8 @@ void GtkData::Init() + pDisplay->monitorsChanged( pScreen ); + g_signal_connect( G_OBJECT(pScreen), "size-changed", + G_CALLBACK(signalScreenSizeChanged), pDisplay ); +- if( ! gtk_check_version( 2, 14, 0 ) ) // monitors-changed came in with 2.14, avoid an assertion +- g_signal_connect( G_OBJECT(pScreen), "monitors-changed", +- G_CALLBACK(signalMonitorsChanged), GetGtkDisplay() ); ++ g_signal_connect( G_OBJECT(pScreen), "monitors-changed", ++ G_CALLBACK(signalMonitorsChanged), GetGtkDisplay() ); + } + } + } +diff --git a/vcl/unx/gtk/app/gtkinst.cxx b/vcl/unx/gtk/app/gtkinst.cxx +index 601fd2152d1d..636049702280 100644 +--- a/vcl/unx/gtk/app/gtkinst.cxx ++++ b/vcl/unx/gtk/app/gtkinst.cxx +@@ -89,14 +89,12 @@ extern "C" + } + + const gchar* pVersion = gtk_check_version( 3, 2, 0 ); +-#else +- const gchar* pVersion = gtk_check_version( 2, 2, 0 ); +-#endif + if( pVersion ) + { + SAL_WARN("vcl.gtk", "gtk version conflict: " << pVersion); + return NULL; + } ++#endif + + GtkYieldMutex *pYieldMutex; + +diff --git a/vcl/unx/gtk/app/gtksys.cxx b/vcl/unx/gtk/app/gtksys.cxx +index 7d687b23943f..42d848ceb686 100644 +--- a/vcl/unx/gtk/app/gtksys.cxx ++++ b/vcl/unx/gtk/app/gtksys.cxx +@@ -195,7 +195,6 @@ bool GtkSalSystem::IsUnifiedDisplay() + } + + namespace { +-#if GTK_CHECK_VERSION(2,14,0) + static int _fallback_get_primary_monitor (GdkScreen *pScreen) + { + // Use monitor name as primacy heuristic +@@ -210,7 +209,6 @@ static int _fallback_get_primary_monitor (GdkScreen *pScreen) + } + return 0; + } +-#endif + + static int _get_primary_monitor (GdkScreen *pScreen) + { +@@ -224,10 +222,8 @@ static int _get_primary_monitor (GdkScreen *pScreen) + get_fn = reinterpret_cast(osl_getAsciiFunctionSymbol(NULL, + "gdk_screen_get_primary_monitor")); + } +-#if GTK_CHECK_VERSION(2,14,0) + if (!get_fn) + get_fn = _fallback_get_primary_monitor; +-#endif + if (get_fn) + return get_fn (pScreen); + else +diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx +index 122059656f89..6512803bfaa0 100644 +--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx ++++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx +@@ -3163,7 +3163,6 @@ bool GtkSalGraphics::NWPaintGTKToolbar( + { + const double shim = 0.2; + +-#if GTK_CHECK_VERSION(2,10,0) + gint separator_height, separator_width, wide_separators = 0; + + gtk_widget_style_get (gWidgetData[m_nXScreen].gSeparator, +@@ -3188,7 +3187,6 @@ bool GtkSalGraphics::NWPaintGTKToolbar( + w * (1 - 2*shim), separator_width); + } + else +-#endif + { + if (nPart == PART_SEPARATOR_VERT) + gtk_paint_vline (gWidgetData[m_nXScreen].gSeparator->style, gdkDrawable, +@@ -4017,23 +4015,20 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) + aStyleSet.SetHighlightColor( aHighlightColor ); + aStyleSet.SetHighlightTextColor( aHighlightTextColor ); + +- if( ! gtk_check_version( 2, 10, 0 ) ) // link colors came in with 2.10, avoid an assertion ++ // hyperlink colors ++ GdkColor *link_color = NULL; ++ gtk_widget_style_get (m_pWindow, "link-color", &link_color, NULL); ++ if (link_color) + { +- // hyperlink colors +- GdkColor *link_color = NULL; +- gtk_widget_style_get (m_pWindow, "link-color", &link_color, NULL); +- if (link_color) +- { +- aStyleSet.SetLinkColor(getColor(*link_color)); +- gdk_color_free (link_color); +- link_color = NULL; +- } +- gtk_widget_style_get (m_pWindow, "visited-link-color", &link_color, NULL); +- if (link_color) +- { +- aStyleSet.SetVisitedLinkColor(getColor(*link_color)); +- gdk_color_free (link_color); +- } ++ aStyleSet.SetLinkColor(getColor(*link_color)); ++ gdk_color_free (link_color); ++ link_color = NULL; ++ } ++ gtk_widget_style_get (m_pWindow, "visited-link-color", &link_color, NULL); ++ if (link_color) ++ { ++ aStyleSet.SetVisitedLinkColor(getColor(*link_color)); ++ gdk_color_free (link_color); + } + + // Tab colors +diff --git a/vcl/unx/gtk/gdi/salprn-gtk.cxx b/vcl/unx/gtk/gdi/salprn-gtk.cxx +index 650276c3a1f4..1ae010e886c9 100644 +--- a/vcl/unx/gtk/gdi/salprn-gtk.cxx ++++ b/vcl/unx/gtk/gdi/salprn-gtk.cxx +@@ -318,15 +318,9 @@ lcl_setHelpText( + const uno::Sequence& i_rHelpTexts, + const sal_Int32 i_nIndex) + { +-#if GTK_CHECK_VERSION(2,12,0) + if (i_nIndex >= 0 && i_nIndex < i_rHelpTexts.getLength()) + gtk_widget_set_tooltip_text(io_pWidget, + OUStringToOString(i_rHelpTexts.getConstArray()[i_nIndex], RTL_TEXTENCODING_UTF8).getStr()); +-#else +- (void)io_pWidget; +- (void)i_rHelpTexts; +- (void)i_nIndex; +-#endif + } + + static GtkWidget* +@@ -429,12 +423,8 @@ GtkPrintDialog::impl_initDialog() + | GTK_PRINT_CAPABILITY_COLLATE + | GTK_PRINT_CAPABILITY_REVERSE + | GTK_PRINT_CAPABILITY_GENERATE_PS +-#if GTK_CHECK_VERSION(2,12,0) + | GTK_PRINT_CAPABILITY_NUMBER_UP +-#endif +-#if GTK_CHECK_VERSION(2,14,0) + | GTK_PRINT_CAPABILITY_NUMBER_UP_LAYOUT +-#endif + )); + } + +@@ -787,11 +777,9 @@ GtkPrintDialog::impl_initPrintContent(uno::Sequence const& i_rDisabled + ePrintPages = GTK_PRINT_PAGES_RANGES; + break; + case 2: +-#if GTK_CHECK_VERSION(2,14,0) + if (m_xWrapper->supportsPrintSelection()) + ePrintPages = GTK_PRINT_PAGES_SELECTION; + else +-#endif + SAL_INFO("vcl.gtk", "the application wants to print a selection, but the present gtk version does not support it"); + break; + default: +@@ -999,7 +987,6 @@ void GtkPrintDialog::ExportAsPDF(const OUString &rFileURL, GtkPrintSettings *pSe + } + catch (...) {} + } +-#if GTK_CHECK_VERSION(2,17,5) + if (gtk_print_unix_dialog_get_has_selection(GTK_PRINT_UNIX_DIALOG(m_pDialog))) + { + uno::Any aSelection; +@@ -1022,7 +1009,6 @@ void GtkPrintDialog::ExportAsPDF(const OUString &rFileURL, GtkPrintSettings *pSe + aFilterData[aFilterData.getLength()-1].Value <<= aSelection; + } + } +-#endif + uno::Sequence aArgs(2); + aArgs[0].Name = "FilterData"; + aArgs[0].Value <<= aFilterData; +diff --git a/vcl/unx/gtk/inc/gtkprintwrapper.hxx b/vcl/unx/gtk/inc/gtkprintwrapper.hxx +index 009903254606..99d435cd7f8e 100644 +--- a/vcl/unx/gtk/inc/gtkprintwrapper.hxx ++++ b/vcl/unx/gtk/inc/gtkprintwrapper.hxx +@@ -13,13 +13,7 @@ + #include + + #if defined ENABLE_GTK_PRINT || GTK_CHECK_VERSION(3,0,0) +-#if GTK_CHECK_VERSION(2,14,0) + #include +-#else +-#include +-#include +-#include +-#endif + + #include + #include +-- +2.12.0 + diff --git a/SOURCES/0206-sd-tiled-rendering-initial-search-all.patch b/SOURCES/0206-sd-tiled-rendering-initial-search-all.patch new file mode 100644 index 0000000..c5ffd77 --- /dev/null +++ b/SOURCES/0206-sd-tiled-rendering-initial-search-all.patch @@ -0,0 +1,148 @@ +From fea53bcac5aaf5e18baf90c8bd6f0fb4142e2f63 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Wed, 14 Oct 2015 11:38:47 +0200 +Subject: [PATCH 206/398] sd tiled rendering: initial search all + +Change-Id: Icee3a07103fad1bf70637fbf23299f50b7ad838d +(cherry picked from commit 32d573cdd13126c13e46b4e3684446e888e8b8e6) +--- + sd/inc/Outliner.hxx | 5 ++- + sd/source/ui/view/Outliner.cxx | 71 +++++++++++++++++++++++++++++------------- + 2 files changed, 54 insertions(+), 22 deletions(-) + +diff --git a/sd/inc/Outliner.hxx b/sd/inc/Outliner.hxx +index 26ad3495357a..f01e244de308 100644 +--- a/sd/inc/Outliner.hxx ++++ b/sd/inc/Outliner.hxx +@@ -357,11 +357,14 @@ private: + bool SearchAndReplaceAll(); + + /** Do search and replace for next match. ++ @param pSelections ++ When tiled rendering and not 0, then don't emit LOK events, instead ++ assume the caller will do so. + @return + The return value specifies whether the search ended () or + another call to this method is required (). + */ +- bool SearchAndReplaceOnce(); ++ bool SearchAndReplaceOnce(std::vector* pSelections = 0); + + /** Detect changes of the document or view and react accordingly. Such + changes may occur because different calls to +diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx +index 41bf43d253f4..e02e879494b8 100644 +--- a/sd/source/ui/view/Outliner.cxx ++++ b/sd/source/ui/view/Outliner.cxx +@@ -490,7 +490,7 @@ bool Outliner::StartSearchAndReplace (const SvxSearchItem* pSearchItem) + Initialize ( ! mpSearchItem->GetBackward()); + + const SvxSearchCmd nCommand (mpSearchItem->GetCommand()); +- if (nCommand == SvxSearchCmd::REPLACE_ALL) ++ if (nCommand == SvxSearchCmd::FIND_ALL || nCommand == SvxSearchCmd::REPLACE_ALL) + bEndOfSearch = SearchAndReplaceAll (); + else + { +@@ -621,11 +621,32 @@ bool Outliner::SearchAndReplaceAll() + + // Search/replace until the end of the document is reached. + bool bFoundMatch; ++ std::vector aSelections; + do + { +- bFoundMatch = ! SearchAndReplaceOnce(); ++ bFoundMatch = ! SearchAndReplaceOnce(&aSelections); + } + while (bFoundMatch); ++ ++ if (mpSearchItem->GetCommand() == SvxSearchCmd::FIND_ALL && pViewShell->GetDoc()->isTiledRendering() && !aSelections.empty()) ++ { ++ boost::property_tree::ptree aTree; ++ aTree.put("searchString", mpSearchItem->GetSearchString().toUtf8().getStr()); ++ ++ boost::property_tree::ptree aChildren; ++ for (const OString& rSelection : aSelections) ++ { ++ boost::property_tree::ptree aChild; ++ aChild.put("", rSelection.getStr()); ++ aChildren.push_back(std::make_pair("", aChild)); ++ } ++ aTree.add_child("searchResultSelection", aChildren); ++ ++ std::stringstream aStream; ++ boost::property_tree::write_json(aStream, aTree); ++ OString aPayload = aStream.str().c_str(); ++ pViewShell->GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr()); ++ } + } + + RestoreStartPosition (); +@@ -634,7 +655,7 @@ bool Outliner::SearchAndReplaceAll() + return true; + } + +-bool Outliner::SearchAndReplaceOnce() ++bool Outliner::SearchAndReplaceOnce(std::vector* pSelections) + { + DetectChange (); + +@@ -724,30 +745,38 @@ bool Outliner::SearchAndReplaceOnce() + + if (pViewShell && pViewShell->GetDoc()->isTiledRendering() && mbStringFound) + { +- // notify LibreOfficeKit about changed page +- OString aPayload = OString::number(maCurrentPosition.mnPageIndex); +- pViewShell->GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); +- +- // also about search result selections + std::vector aLogicRects; + pOutlinerView->GetSelectionRectangles(aLogicRects); + +- boost::property_tree::ptree aTree; +- aTree.put("searchString", mpSearchItem->GetSearchString().toUtf8().getStr()); +- + std::vector aLogicRectStrings; + std::transform(aLogicRects.begin(), aLogicRects.end(), std::back_inserter(aLogicRectStrings), [](const Rectangle& rRectangle) { return rRectangle.toString(); }); + OString sRectangles = comphelper::string::join("; ", aLogicRectStrings); +- boost::property_tree::ptree aChildren; +- boost::property_tree::ptree aChild; +- aChild.put("", sRectangles.getStr()); +- aChildren.push_back(std::make_pair("", aChild)); +- aTree.add_child("searchResultSelection", aChildren); +- +- std::stringstream aStream; +- boost::property_tree::write_json(aStream, aTree); +- aPayload = aStream.str().c_str(); +- pViewShell->GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr()); ++ ++ if (!pSelections) ++ { ++ // notify LibreOfficeKit about changed page ++ OString aPayload = OString::number(maCurrentPosition.mnPageIndex); ++ pViewShell->GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); ++ ++ // also about search result selections ++ boost::property_tree::ptree aTree; ++ aTree.put("searchString", mpSearchItem->GetSearchString().toUtf8().getStr()); ++ ++ boost::property_tree::ptree aChildren; ++ boost::property_tree::ptree aChild; ++ aChild.put("", sRectangles.getStr()); ++ aChildren.push_back(std::make_pair("", aChild)); ++ aTree.add_child("searchResultSelection", aChildren); ++ ++ std::stringstream aStream; ++ boost::property_tree::write_json(aStream, aTree); ++ aPayload = aStream.str().c_str(); ++ pViewShell->GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr()); ++ } ++ else ++ { ++ pSelections->push_back(sRectangles); ++ } + } + + return mbEndOfSearch; +-- +2.12.0 + diff --git a/SOURCES/0207-sd-tiled-rendering-search-rectangle-is-part-specific.patch b/SOURCES/0207-sd-tiled-rendering-search-rectangle-is-part-specific.patch new file mode 100644 index 0000000..6082346 --- /dev/null +++ b/SOURCES/0207-sd-tiled-rendering-search-rectangle-is-part-specific.patch @@ -0,0 +1,106 @@ +From 303f6bd02ad4cbaec4caf67682da5aed87b2ccaa Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Wed, 14 Oct 2015 12:32:12 +0200 +Subject: [PATCH 207/398] sd tiled rendering: search rectangle is part-specific + +Change-Id: I88865db539779bc401550d7b4a3729b89d7e18b1 +(cherry picked from commit dd1fc2242a64a0b9ae8031a5edc7ecfcde4ec3df) +--- + sd/inc/Outliner.hxx | 16 +++++++++++++++- + sd/source/ui/view/Outliner.cxx | 16 +++++++++++----- + 2 files changed, 26 insertions(+), 6 deletions(-) + +diff --git a/sd/inc/Outliner.hxx b/sd/inc/Outliner.hxx +index f01e244de308..9f1f6aae3e8a 100644 +--- a/sd/inc/Outliner.hxx ++++ b/sd/inc/Outliner.hxx +@@ -41,6 +41,20 @@ class View; + class ViewShell; + class Window; + ++/// Describes a single search hit: a set of rectangles on a given page. ++struct SearchSelection ++{ ++ /// 0-based index of the page that has the selection. ++ int m_nPage; ++ /** ++ * List of selection rectangles in twips -- multiple rectangles only in ++ * case the selection spans over more layout lines. ++ */ ++ OString m_aRectangles; ++ ++ SearchSelection(int nPage, const OString& rRectangles); ++}; ++ + /** The main purpose of this class is searching and replacing as well as + spelling of impress documents. The main part of both tasks lies in + iterating over the pages and view modes of a document and apply the +@@ -364,7 +378,7 @@ private: + The return value specifies whether the search ended () or + another call to this method is required (). + */ +- bool SearchAndReplaceOnce(std::vector* pSelections = 0); ++ bool SearchAndReplaceOnce(std::vector* pSelections = 0); + + /** Detect changes of the document or view and react accordingly. Such + changes may occur because different calls to +diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx +index e02e879494b8..22db187ab7c8 100644 +--- a/sd/source/ui/view/Outliner.cxx ++++ b/sd/source/ui/view/Outliner.cxx +@@ -83,6 +83,12 @@ class SfxStyleSheetPool; + + namespace sd { + ++SearchSelection::SearchSelection(int nPage, const OString& rRectangles) ++ : m_nPage(nPage), ++ m_aRectangles(rRectangles) ++{ ++} ++ + class Outliner::Implementation + { + public: +@@ -621,7 +627,7 @@ bool Outliner::SearchAndReplaceAll() + + // Search/replace until the end of the document is reached. + bool bFoundMatch; +- std::vector aSelections; ++ std::vector aSelections; + do + { + bFoundMatch = ! SearchAndReplaceOnce(&aSelections); +@@ -634,10 +640,10 @@ bool Outliner::SearchAndReplaceAll() + aTree.put("searchString", mpSearchItem->GetSearchString().toUtf8().getStr()); + + boost::property_tree::ptree aChildren; +- for (const OString& rSelection : aSelections) ++ for (const SearchSelection& rSelection : aSelections) + { + boost::property_tree::ptree aChild; +- aChild.put("", rSelection.getStr()); ++ aChild.put("", rSelection.m_aRectangles.getStr()); + aChildren.push_back(std::make_pair("", aChild)); + } + aTree.add_child("searchResultSelection", aChildren); +@@ -655,7 +661,7 @@ bool Outliner::SearchAndReplaceAll() + return true; + } + +-bool Outliner::SearchAndReplaceOnce(std::vector* pSelections) ++bool Outliner::SearchAndReplaceOnce(std::vector* pSelections) + { + DetectChange (); + +@@ -775,7 +781,7 @@ bool Outliner::SearchAndReplaceOnce(std::vector* pSelections) + } + else + { +- pSelections->push_back(sRectangles); ++ pSelections->push_back(SearchSelection(maCurrentPosition.mnPageIndex, sRectangles)); + } + } + +-- +2.12.0 + diff --git a/SOURCES/0208-LOK-include-part-numbers-in-CALLBACK_SEARCH_RESULT_S.patch b/SOURCES/0208-LOK-include-part-numbers-in-CALLBACK_SEARCH_RESULT_S.patch new file mode 100644 index 0000000..c5f7559 --- /dev/null +++ b/SOURCES/0208-LOK-include-part-numbers-in-CALLBACK_SEARCH_RESULT_S.patch @@ -0,0 +1,208 @@ +From 5cfe5701f287fcceee39cd2eb8ed403cda6eeea4 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Wed, 14 Oct 2015 15:39:07 +0200 +Subject: [PATCH 208/398] LOK: include part numbers in + CALLBACK_SEARCH_RESULT_SELECTION payload + +Without that, the result in Calc/Impress is ambiguous. + +Change-Id: I8dfd8dafc996102ed583688fddd721c7600dc48c +(cherry picked from commit ad280b67f8fda8f832a6a83bc5665df448c6ad00) +--- + desktop/qa/desktop_lib/test_desktop_lib.cxx | 8 +++++++- + include/LibreOfficeKit/LibreOfficeKitEnums.h | 14 ++++++++++---- + sc/source/ui/view/viewfun2.cxx | 3 ++- + sd/qa/unit/tiledrendering/tiledrendering.cxx | 9 ++++++++- + sd/source/ui/view/Outliner.cxx | 6 ++++-- + sw/qa/extras/tiledrendering/tiledrendering.cxx | 8 +++++++- + sw/source/uibase/uiview/viewsrch.cxx | 3 ++- + 7 files changed, 40 insertions(+), 11 deletions(-) + +diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx +index e77bc8984bbf..30d8ae7adaf0 100644 +--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx ++++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx +@@ -74,6 +74,7 @@ public: + uno::Reference mxComponent; + OString m_aTextSelection; + std::vector m_aSearchResultSelection; ++ std::vector m_aSearchResultPart; + }; + + LibLODocument_Impl* DesktopLOKTest::loadDoc(const char* pName, LibreOfficeKitDocumentType eType) +@@ -131,7 +132,10 @@ void DesktopLOKTest::callbackImpl(int nType, const char* pPayload) + std::stringstream aStream(pPayload); + boost::property_tree::read_json(aStream, aTree); + for (boost::property_tree::ptree::value_type& rValue : aTree.get_child("searchResultSelection")) +- m_aSearchResultSelection.push_back(rValue.second.data().c_str()); ++ { ++ m_aSearchResultSelection.push_back(rValue.second.get("rectangles").c_str()); ++ m_aSearchResultPart.push_back(std::atoi(rValue.second.get("part").c_str())); ++ } + } + break; + } +@@ -269,6 +273,8 @@ void DesktopLOKTest::testSearchCalc() + CPPUNIT_ASSERT_EQUAL(static_cast(2), aSelections.size()); + // Make sure that we get exactly as many rectangle lists as matches. + CPPUNIT_ASSERT_EQUAL(static_cast(2), m_aSearchResultSelection.size()); ++ // Result is on the first sheet. ++ CPPUNIT_ASSERT_EQUAL(0, m_aSearchResultPart[0]); + + closeDoc(); + comphelper::LibreOfficeKit::setActive(false); +diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h +index 0da87699b1b5..459da5d196f4 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h ++++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h +@@ -165,14 +165,20 @@ typedef enum + * { + * "searchString": "...", + * "searchResultSelection": [ +- * "...", +- * "..." ++ * { ++ * "part": "...", ++ * "rectangles": "..." ++ * }, ++ * { ++ * "part": "...", ++ * "rectangles": "..." ++ * } + * ] + * } + * + * - searchString is the search query +- * - searchResultSelection is an array of rectangle list, in +- * LOK_CALLBACK_TEXT_SELECTION format. ++ * - searchResultSelection is an array of part-number and rectangle list ++ * pairs, in LOK_CALLBACK_SET_PART / LOK_CALLBACK_TEXT_SELECTION format. + */ + LOK_CALLBACK_SEARCH_RESULT_SELECTION + } +diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx +index 2be84a4c8e39..95fd13a1bf93 100644 +--- a/sc/source/ui/view/viewfun2.cxx ++++ b/sc/source/ui/view/viewfun2.cxx +@@ -1866,7 +1866,8 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem, + for (const Rectangle& rLogicRect : aLogicRects) + { + boost::property_tree::ptree aSelection; +- aSelection.put("", rLogicRect.toString().getStr()); ++ aSelection.put("part", OString::number(nTab).getStr()); ++ aSelection.put("rectangles", rLogicRect.toString().getStr()); + aSelections.push_back(std::make_pair("", aSelection)); + } + aTree.add_child("searchResultSelection", aSelections); +diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx +index f35449b12b2c..62ad1cdcad7e 100644 +--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx ++++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx +@@ -80,6 +80,7 @@ private: + bool m_bFound; + sal_Int32 m_nPart; + std::vector m_aSearchResultSelection; ++ std::vector m_aSearchResultPart; + #endif + }; + +@@ -187,11 +188,15 @@ void SdTiledRenderingTest::callbackImpl(int nType, const char* pPayload) + case LOK_CALLBACK_SEARCH_RESULT_SELECTION: + { + m_aSearchResultSelection.clear(); ++ m_aSearchResultPart.clear(); + boost::property_tree::ptree aTree; + std::stringstream aStream(pPayload); + boost::property_tree::read_json(aStream, aTree); + for (boost::property_tree::ptree::value_type& rValue : aTree.get_child("searchResultSelection")) +- m_aSearchResultSelection.push_back(rValue.second.data().c_str()); ++ { ++ m_aSearchResultSelection.push_back(rValue.second.get("rectangles").c_str()); ++ m_aSearchResultPart.push_back(std::atoi(rValue.second.get("part").c_str())); ++ } + } + break; + } +@@ -401,6 +406,8 @@ void SdTiledRenderingTest::testSearch() + CPPUNIT_ASSERT_EQUAL(true, m_bFound); + // This was 0; should be 1 match for "find". + CPPUNIT_ASSERT_EQUAL(static_cast(1), m_aSearchResultSelection.size()); ++ // Result is on the second slide. ++ CPPUNIT_ASSERT_EQUAL(1, m_aSearchResultPart[0]); + + // This should trigger the not-found callback. + Application::EnableHeadlessMode(false); +diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx +index 22db187ab7c8..51635d5cba14 100644 +--- a/sd/source/ui/view/Outliner.cxx ++++ b/sd/source/ui/view/Outliner.cxx +@@ -643,7 +643,8 @@ bool Outliner::SearchAndReplaceAll() + for (const SearchSelection& rSelection : aSelections) + { + boost::property_tree::ptree aChild; +- aChild.put("", rSelection.m_aRectangles.getStr()); ++ aChild.put("part", OString::number(rSelection.m_nPage).getStr()); ++ aChild.put("rectangles", rSelection.m_aRectangles.getStr()); + aChildren.push_back(std::make_pair("", aChild)); + } + aTree.add_child("searchResultSelection", aChildren); +@@ -770,7 +771,8 @@ bool Outliner::SearchAndReplaceOnce(std::vector* pSelections) + + boost::property_tree::ptree aChildren; + boost::property_tree::ptree aChild; +- aChild.put("", sRectangles.getStr()); ++ aChild.put("part", OString::number(maCurrentPosition.mnPageIndex).getStr()); ++ aChild.put("rectangles", sRectangles.getStr()); + aChildren.push_back(std::make_pair("", aChild)); + aTree.add_child("searchResultSelection", aChildren); + +diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx +index 5e2b30ab7fde..4598c50e5842 100644 +--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx ++++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx +@@ -72,6 +72,7 @@ private: + OString m_aTextSelection; + bool m_bFound; + std::vector m_aSearchResultSelection; ++ std::vector m_aSearchResultPart; + }; + + SwTiledRenderingTest::SwTiledRenderingTest() +@@ -138,7 +139,10 @@ void SwTiledRenderingTest::callbackImpl(int nType, const char* pPayload) + std::stringstream aStream(pPayload); + boost::property_tree::read_json(aStream, aTree); + for (boost::property_tree::ptree::value_type& rValue : aTree.get_child("searchResultSelection")) +- m_aSearchResultSelection.push_back(rValue.second.data().c_str()); ++ { ++ m_aSearchResultSelection.push_back(rValue.second.get("rectangles").c_str()); ++ m_aSearchResultPart.push_back(std::atoi(rValue.second.get("part").c_str())); ++ } + } + break; + } +@@ -477,6 +481,8 @@ void SwTiledRenderingTest::testSearchAll() + comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues); + // This was 0; should be 2 results in the body text. + CPPUNIT_ASSERT_EQUAL(static_cast(2), m_aSearchResultSelection.size()); ++ // Writer documents are always a single part. ++ CPPUNIT_ASSERT_EQUAL(0, m_aSearchResultPart[0]); + + comphelper::LibreOfficeKit::setActive(false); + #endif +diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx +index 7f1addcc3f6b..53485eb9361b 100644 +--- a/sw/source/uibase/uiview/viewsrch.cxx ++++ b/sw/source/uibase/uiview/viewsrch.cxx +@@ -95,7 +95,8 @@ static void lcl_addContainerToJson(boost::property_tree::ptree& rTree, const OSt + for (const OString& rMatch : rMatches) + { + boost::property_tree::ptree aChild; +- aChild.put("", rMatch.getStr()); ++ aChild.put("part", "0"); ++ aChild.put("rectangles", rMatch.getStr()); + aChildren.push_back(std::make_pair("", aChild)); + } + +-- +2.12.0 + diff --git a/SOURCES/0209-lok-Document-paintTile-fix-non-rectangular-tiles-wrt.patch b/SOURCES/0209-lok-Document-paintTile-fix-non-rectangular-tiles-wrt.patch new file mode 100644 index 0000000..66ba62d --- /dev/null +++ b/SOURCES/0209-lok-Document-paintTile-fix-non-rectangular-tiles-wrt.patch @@ -0,0 +1,78 @@ +From e14efbfe1829ea54b5b794903282d3bf834e7e83 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Thu, 15 Oct 2015 09:41:52 +0200 +Subject: [PATCH 209/398] lok::Document::paintTile: fix non-rectangular tiles + wrt. transparency + +When copying the alpha channel, the offset was incorrect when canvas +width/height did not equal. + +Change-Id: If0ab3ec7a4ad4dd958419b566fd473732965cfda +(cherry picked from commit d30f5bc3e65463f28c3087acad6f88e12d60e53b) +--- + desktop/qa/desktop_lib/test_desktop_lib.cxx | 21 +++++++++++++++++++++ + desktop/source/lib/init.cxx | 2 +- + 2 files changed, 22 insertions(+), 1 deletion(-) + +diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx +index 30d8ae7adaf0..c3cc748a5d61 100644 +--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx ++++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx +@@ -61,6 +61,7 @@ public: + void testGetFilterTypes(); + void testGetPartPageRectangles(); + void testSearchCalc(); ++ void testPaintTile(); + + CPPUNIT_TEST_SUITE(DesktopLOKTest); + CPPUNIT_TEST(testGetStyles); +@@ -69,6 +70,7 @@ public: + CPPUNIT_TEST(testGetFilterTypes); + CPPUNIT_TEST(testGetPartPageRectangles); + CPPUNIT_TEST(testSearchCalc); ++ CPPUNIT_TEST(testPaintTile); + CPPUNIT_TEST_SUITE_END(); + + uno::Reference mxComponent; +@@ -280,6 +282,25 @@ void DesktopLOKTest::testSearchCalc() + comphelper::LibreOfficeKit::setActive(false); + } + ++void DesktopLOKTest::testPaintTile() ++{ ++ LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); ++ int nCanvasWidth = 100; ++ int nCanvasHeight = 300; ++ std::vector aBuffer(nCanvasWidth * nCanvasHeight * 4); ++ int nTilePosX = 0; ++ int nTilePosY = 0; ++ int nTileWidth = 1000; ++ int nTileHeight = 3000; ++ ++ // This used to crash: painTile() implementation did not handle ++ // nCanvasWidth != nCanvasHeight correctly, as usually both are just always ++ // 256. ++ pDocument->pClass->paintTile(pDocument, aBuffer.data(), nCanvasWidth, nCanvasHeight, nTilePosX, nTilePosY, nTileWidth, nTileHeight); ++ ++ closeDoc(); ++} ++ + CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); + + CPPUNIT_PLUGIN_IMPLEMENT(); +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index b69e58a4af1f..053ab440bf55 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -788,7 +788,7 @@ void doc_paintTile (LibreOfficeKitDocument* pThis, + { + for (int nCol = 0; nCol < nCanvasWidth; ++nCol) + { +- const int nOffset = (nCanvasHeight * nRow) + nCol; ++ const int nOffset = (nCanvasWidth * nRow) + nCol; + // VCL's transparent is 0, RGBA's transparent is 0xff. + pBuffer[nOffset * 4 +3] = 0xff - aAlpha[nOffset]; + } +-- +2.12.0 + diff --git a/SOURCES/0210-sd-tiled-rendering-let-find-all-at-least-select-the-.patch b/SOURCES/0210-sd-tiled-rendering-let-find-all-at-least-select-the-.patch new file mode 100644 index 0000000..a278b3a --- /dev/null +++ b/SOURCES/0210-sd-tiled-rendering-let-find-all-at-least-select-the-.patch @@ -0,0 +1,311 @@ +From a264af1921169c7e1174a8c0d0e3dfb069ac3132 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Thu, 15 Oct 2015 15:20:23 +0200 +Subject: [PATCH 210/398] sd tiled rendering: let find-all at least select the + first match physically + +The LOK API can describe a multi-selection, so find-all can signal all +matches, editeng can have a single selection only. Instead of having no +selections after a find-all, select the first match, so e.g. copy works. + +Change-Id: I0eab2565916f0c3cce5d77279c0d927ad4b7054c +(cherry picked from commit cd4976988cf3acb4f1a23f1df7fcc2bfec0f3da0) +--- + sd/qa/unit/tiledrendering/data/search-all.odp | Bin 0 -> 10744 bytes + sd/qa/unit/tiledrendering/tiledrendering.cxx | 19 +++++++++++++++++-- + sd/source/ui/view/Outliner.cxx | 13 ++++++++++++- + 3 files changed, 29 insertions(+), 3 deletions(-) + create mode 100644 sd/qa/unit/tiledrendering/data/search-all.odp + +diff --git a/sd/qa/unit/tiledrendering/data/search-all.odp b/sd/qa/unit/tiledrendering/data/search-all.odp +new file mode 100644 +index 0000000000000000000000000000000000000000..cb3cb31cf5c7d5d4025a0025871ad1314c598cdf +GIT binary patch +literal 10744 +zcmb7K1wb50mmb`PKyY^n?j%469%OLW1a}`G1P`vk-91>a;O@bl;2PY+AVCkZx0mex +z*}c0r(^b`7^}g=1ue<6!c@PXN765<<0C-u*iF42te_#Os01wCgC4iNgm65|+TO&PN +zTT3$oJqI%zYZfPKLuMO2uo;-y#@5K%(8j>g%E;P*+1B0&d>{WPBmWmrx10Kza99A~ +z;lR5GRW^0B(zn(#vjnp^{F!97wKfTomla1vCP2O~f+{H?st5o;-6sL9h%oozJco?( +zePk>ztt{QTP5+QGpA1OmCey}iHB +z-QAsBnZpbK0P|H+R7lx*c7J{*E{hk>Ur!7UW80=Dz0=aMZv*% +zbk5i8TS871$5sgU2>&6iceQ@|I8Zw~nvf(pgtDpX)Y$UGd6@C)O1>NpO7^M+d|m6y +zaCiyj4`_NM{#UXDa%QDb4u^hGq@O&Kx2X+vU5rZz?(Ot?zHascaw878li+fYtNy>rCf! +zMTo@BLK=PdIcx&jL3_aTLJUZd(4-qGVSJJY1I1fB_|zz;tQO_w8cZNs?(s`EEfu^sEAn-(S|T~6PkAq?n+Q>q +zIiJ>HRTXjEpaV$#AKLj|ybd3Fgb+@b9tZ$HpdNZ80Xh1f4B#by><;%q=YdCx;JNikW`kHWg%e~=g=BH|Bb{1xB_ +zGa5PQF*{pXhAGR0C$pkAovV>mtFdlSLWPvY7v`5}7HAaId@h%nYS5*equOpMWs8WS +zDWs51duy}tb|dlI_j&HcNV>t?=?m6Sw{Rp1I^2M;yZRe~ueadSf*8j^BoXDPW}|jk +zCXVS!<;>B9*^4F&3H?DXj9McCd~d^^PH7gF+ZVN!*X7pq^SHWqlF|LOBTZH +zGXO3B`z)-`P5ctA#pknjt?;7Nsrz*{AB}_IY)F|nbZwMLv2q8Sa@7Zs%9MKG5yXdN +zyS>PIecdkRxp>p3)}XS(l+hsDo5}h4h@QEE +zs&BWL`3#-LLiGzi2m^VSAR6oA6kE=xw28ZYE$<>fA6J3I9W;3m0%D`oJNm=>0hR>| +z0Q~bHxgY8Pu#tm=FUg_txeskX|c>7d&tUPJ^gDI*~W?ohmz*CcjI +zgl8k#T>&RsZIg1f$dpg7yiEN0q1cv!+y~2Qj1fJZCB}#2-^w-a3O#6Cf@FgLJV4N2Ec|l#PuVim6xwwh5ET4lDnl!_sxeu>+ +zUe{FUNL%k~fu$_4hdmElxE8t(>QB8g*K)(h!Ec1bWO1<&)EI`7Go?~8J?IyAP +z$R#5sE2|;;coirZ0fJfb#zl53GSIs4_TX9EMW&qHc)z?jj{a((YPbe|<@tL7nl0(X +zlvWsKWWQB2c<-x>s|*s`I1fa8uuucT87#cNH?q=h9wy&H=w^d&vqB8GB2vv5|HB7UJD>H=I=wpNLrpRIeFW)B_b%W8C +zC54631R)iQ9&Cxw%2J0oqSHBso*GX*;-x-~o|5+*uRvfXtM=-uwEoABnOu;9PDumX +znxuOloguo?p{dP5&%L5e^@l(a4BYbPcKJwj>0L1m<~rd8f6s<@>;f{pSbS|SfK%G?IGm)@tOYu15{k$&2y4X+N7$}2o!V^tOxhvo3Mio(RKQ;R1W0j?69hD+O^^3(sVhrrW#7G( +zx$yD1dqinbmAmBWq%9Ysa*t{pMG#<7`Lu>y?C!H5+<`%2qQ;( +z739s(@NTFlkwoG!Qt^>1SFaO=85PCnA+@z1)+T&u?8k+0#A{sAFo3Makhd7i*sXhoBIbpLRjvg +z#~5xXkXA$i~{$kXFz!rmqsucv66(Zf-(hP_mFeZ=0q5j964iUezI(Y2`~GlJ!&# +zt(+FSKb#|IJK}~Lj+&RBdkLZmvOs@UBv0o@QPDpjmT1p#K8%bR3YB2mRPDT*&kl12 +ze2x41tTvwbU43Z7*({PA8nPs+OC0Jo8-xx+sTj>4-B({+*+WZ?@<6hdaLLWC#{FsG +z>C*?Yjjw6*=YRtMbg2K0Y#+Wu4Q#9(9u^`$xOUKbjT^oBoDRq|n@k0&_#zNiIh|#y +zK!(D|t&yRonPuoir$AOPeE@ld^Asnyp;MOnH*gyQ8@N6#9-WZ3snpoq2~JiNQOK;Cq+jC)s< +z3O~21DK?$AS!x|Yv@CN+LMk$%;j=Qv*92qxNj>8WW$P2FepXSf8m6RiE1DkcPYvB^*<7pIDIFQ;0l)9}dJMc0aJ4 +z)a`YSutvUMigCR&gB2N4q*pjZygeq}==7%M@R{n`hY0D(;*qIc&Q0Yz>urMdSCtyMMvjy< +z;27PaI8KCpqOnICQMzpAI!s@lTu0f)Drb%%W@#bzqI`gJXRW@42~bS&6Bqr8wZD=z +zoKyci{hjIl4#+9=!xoJ2R8KXPSyT4vM8+1;>)X?d!m1fvtR~$V&-M#nQaDh%LNmFZ +z!JAX7ByHJNFIY7Z-)I4rX?B6du}=l}RIj#Qb6W=LO}7h0rf-v%Jm$I4ua=gCmnG|k +zhoGcvUsxr)%34*B(EgD1WQxVS02=uts`7#<9SmAa&}sPOUAm +z1X>8eR8(4+NiBhhZF-BO +zKaHB9sYf(WrnEcaP}({wvqtScPtwEq%i8A46UenWP{x{5j^*R$5vvU|8#k`tyt`6S +zD`~YiRyF5P*-7e^rb})KI(;{(&7(y$wT*LXO{i`iRa)T*sUaTcBiVEqBN}Q8l{1qL +z^(H6Tq9QDV$QnpZo=0ijs<~nVdc{oE)*q8KQGKbEYhHa+ZpKqt{FeW|M&2rgWRE-F +z#Ww$dIr`F~^!al%C8vu@oSRLkDkVg*dK`?tdk57m}k9C +z{D8}r|H7l>SjNP4_A;pQh{k>DDU(xA0oMCr|Iv;UPykttfh$O}rYT>)zb4f7(|Vr7 +z7kml`UJ@`6mcefSG_`jC=+~O)3QyP?TWUj%z`s*Ne#j|ydDBO{v$%|XaBBQs +z;6%2z#`4A@q}6x3ofRqYL#J%P>t>sTkO-nQ +z<8&z0M=|wUAgw19%tmUy+J3u+nx>0Kz9#^5R3Utnaj1*?y(nNMe%MpZxFdb>Zk_lQ +zb0o|rvr{$UR*w|cAwM3fgn>ZPNngMUH)In}^hwf{E==~@y#YIb`=}|i((p{SGtzFc +z8Tch*&HEMb{3o{D!78|r4LRdZdyA*A4S8X7Ol`{6&7CrY0^(^Eoxwg&p#n#taED30 +zwY&g+u_GD~&t9<3Kaj=_D2lY6I}4o51M<=7l%ev!T<4|S61pri%_+K+7_rs`CVdk( +zGm5+3H-_ry9`VA%ddY>TCn^zGtIU$@NLACj{bjtc+=;)0Ue{@g%(B=d^jRr=-ki3I +zw3>AT)N#GOn@P5~V(;zw1^IZ9?Knguh8rOkGb^J!Aw|FU<)RBB0 +z{dR<;LvxZoA!4m4ID(l*fnD&4Ff>*shb$cr@zI9jZpxQniu;#V^KeVJX{xY^=;}%I +zrUVLQ&CG-XG_83GB4)8@y2su*#J~a`lag0EDA8Ps%{5b7J8@9g>ON%Ny6(V!{ +zph+1Gy?i@J)9zqgTxBC6=7j6})tia^NHLKMY=4-uL(#T&^uuSK6R+>Q(@Fhj1qtzH +zTPK`(?4F17(w$(X;(SEi*P^LLiPznw26?ubQ>@X$wh{1%2qj;uLa!$2;!#$pWZa0` +z1-1yYzi~+@e$>KI(u=1qGV~SW?JG?VuDx85J#f$_-&m|SO!Fg1xv-~+G#nZ1o?e}J +zIsMKIR#})G7NDL_h`BQb%ejr0I6`-q?>G*hZ#OvLZE-Z?O$7X!=JKyxo)fxnGq( +zdViWjq&M_gSxs#xNh8A#&`K~U?8C&!(Qx-|j&$ij)>qwt@~nbmP=s|?U5=<@dej@? +z`CWNSjl3Uyc@xM%nL&&Kz3A?3^9@$v+=|ION<1jItqfRGYbs$DOfOXBS4mJf=9Q38(M^8ozkTVC +zN2eL7a0e#rGOaVI#|6Z9Q)B5f#9%MrDH-Pk!@W1C-(x8{S!OqeCQ|h^t%@_h02IIL +zucrCzSg;E6Lq4v492&d%oZx$(yIF38d*0|>AWoUBZ$MU~68{K!;s9j>PBhcez)&BRX3hN1k^#ZwhS{X`_b9xe32Akf=u_ITX{1dMU)tJ$@vzbw2*C(m2&Fd^h*`O +z(pfL)x7;)P#UEPTa3d|rqlC+SKF5F4k!ogK$e`+CWGwS!$+H3U(f1BD9jy>nnqy3j9RzDChYX?)MB?J4?p{y5P0C!s~&QTapl7{BfwzD +zw_kZ7Z#MC=Q%DNB3vL^83=^h1>#d5q;)DsJYUkT$G4|9P!#UjH?_lLng3+9|o$}2~(>i8t{+Das3iS{abpRmp6pY1 +zte*s)TtRF|$M43Qx0Za1iX&!|Bih6imftl|yy3`j2f97aC_%`fyQ!Jqf@2Ed3yikQ +zc(LwiTi1GUo0Kxeavasw>nlxFlA9$2q4tj5d>kMB(fsWo+U_^0&2v91Q{51-tB~lLxzRTqeVUmMz7WpYw#C~I=x{!+d#1x= +zHq)zZ4U7Zzl<&_G_|Uu@O1HflCL%V$FLP8Y2PH#&*-pkLu4_b8bCBvhZyPinU4Fa +zM5p^3Q9GBr_LB>=(KPSA+KCa>p*3i8@97h`Pp|9i;XZOAbt-^fE%DVs?s2ax1D)cl +zNKRyj4Oa~v)k#KFM~pEbV1pPc<>&TdU~)y3D+xP8;{p>mDUBz|RW%bm-S3n;i>=W) +zv?x>^U(7?73rkdU+v)%}(}JgK2|J790#&G68=*UC7Rb0g_yT1bge<=~p(i`~Ohfj` +zjNkZ7@1c_6SmEXdb)=H|r%F2rq*Ze$uITe-xro*cKRh7^5Z|h +z7^LdS-&e$=(K5qPa_bV~3VKmHboxa4i20TN&T#YC!DVIX?Ou_r%RrF>#H{ +zCm>Rz?QF)U!SX+1_n6%93W!47+{+K)6%Ob|bV#WXg(#GllEoGMyq8aU`$Z*-g}VA*c=j@3Aw|+8)0mt0rLM1qt}I8SOXq1{!GuerSnNHnB=|~y!9|VM!A0g_ +z32JlI95gcyEetbRWuN9>z>;B7x|XFu*HP+O3wnZOW6qFdp3s|HvU!{ly$!1QIM7Ls +zZn$1Z_yvBIK$-|z$T?~IKFLY*^7L$CY!Nc7X#vL68{FtNPAE(btBdGU?wN&P8RimI +z7p|lxR=#|`MI%&AUY6~H#!4fw?T!XPX?agU-?{UV2ofGXTjra`JYL2-T(+J`A +z=h^X5jBM}2Bg({sN(X2OBNT;kI}PLCP3Pv8d^~W`_WRP%Sq>>wy4;+WVOMSnvd)*4 +z=Gr$K3L=ibbU9}siLU?lJS6!h!~heEE6a%Y?J-4@)+lCwg_geEL5OQjh?r~Bv-8+S +zkb#{Q=u(}N>hUoFNr*}BmpoO`M|}*H;pLxP;*X9E6vnBI`K7a6RXQe2r8O6@T=64A +zkah6VY1pK;8fu>C9J`O;5{#&YDjcJZL~~{=FhSz6$}ZYBuw$2JStqHX`8{fzmz+Hq+fPbkFr!>bvd<6AK=c_1jzr0Z}b~p +zTb_sP-w(9cmY}+`*j{zXE_hM4D+n2j(Xkuap4sDlwyQyr8@I$Eu*(yX_0zGMJA#ow +zktHd`fMs<3Qh$o?QREfVIascAb(BgH +z-^S7oPm~wD-s?3)(+w~6zgQV(0lKan2TZewWL;5Lw<`9H!G>znAojDHcI5MvqtF!< +zn#obUH*jUXLv#VW5kx +zDzQGEExx%TZM+b_9VS&h4u|Fq${CIuqKx&5`u~iEfr|mXN5>*cTXX*GF&;0fooLO +z-CQl$s({-QH&=SkHw1(@RB6R$XWe-XtTg=;$5kXMRHKqAv%Me#4~O<<%Fvd=I-0w7 +zaAL;64fs@xSdKO<(n5eOv>_Q!wzGH=c2wdEP-aro%PE9I^u65K+mqQaz3=snuHvQ1 +zh5U)wN3>Ty1$)~vj&VyYJ1_UI-O4Hi`rdqNI>&L7Q!yxvuiZJGh`<(~?5Qq(nrEuo +z{kFYJ%(n7MK%1SJSj060Pwo*-xk%h_ls%~8*5`T6G!_WP9b1+7Ci$4BTJ+EQyY60 +z14n!N|K6^Jxi_OBJQ!60&=0}A{MCWvk86K~1ozS3VI6F2EN%6yjVxLIe|q41Zxu(d +zzMlQR=n?(qezx{DCimVh|BL2>tIO}6^xyAC`Wr1XD?Jk2ML1%GEe$G)$ijF_?zlcelR7Ark#Gh-w0 +zk4^g$B_Zn$GW5nxY@9bD$x43uo9G2B5~PC1vqIi*Z5Y%oEY&g7DzSwM?)ve>#{N3f +z`z%AMCV{=qmeUNLde|9fsco5hq&?@CVf%A~Lv)<{R8ch<^qZ^;$?Y^IpruAbfpOEK`iK7S&Z(pB)zy!JWl=H1B{r-OQWdy#U^u1y +zbi-7Ybyq`)(}5?sawHTv6|#6VX~*`@jn0Gmrm41YzIk=Puyhwdb*g(xbwSa+O8V{< +zyDY5FC?J;P^+Ec1iEJ_d*!1Ki>iA^)r4t&7E63MoG6Gh9V+4#b6XKcR(3aQho|>L+ +z6?AK+?@T&Qqx7(rf=KT^-9SIg3ga4%HjH~?^Xk15lspIu8Vm5x-dgu9`-}YPyY+Xi +zzq@1oR8hH4{*!aopD2HJ>90ocA5-^#UF9yWeu}{TX5!x`_CGM& +zpP+yG*Zl+m03IgmPl@{t=&!u?*Pj2W_jjD3-{AbpbN`IskJ<4x+RUY)P0}cS7-~YJpT~> + #include + #include ++#include + + #include + #include +@@ -51,6 +52,7 @@ public: + void testSetGraphicSelection(); + void testResetSelection(); + void testSearch(); ++ void testSearchAll(); + #endif + + CPPUNIT_TEST_SUITE(SdTiledRenderingTest); +@@ -63,6 +65,7 @@ public: + CPPUNIT_TEST(testSetGraphicSelection); + CPPUNIT_TEST(testResetSelection); + CPPUNIT_TEST(testSearch); ++ CPPUNIT_TEST(testSearchAll); + #endif + CPPUNIT_TEST_SUITE_END(); + +@@ -371,12 +374,13 @@ void SdTiledRenderingTest::testResetSelection() + CPPUNIT_ASSERT(!pView->GetTextEditObject()); + } + +-static void lcl_search(const OUString& rKey) ++static void lcl_search(const OUString& rKey, bool bFindAll = false) + { + uno::Sequence aPropertyValues(comphelper::InitPropertySequence( + { + {"SearchItem.SearchString", uno::makeAny(rKey)}, +- {"SearchItem.Backward", uno::makeAny(false)} ++ {"SearchItem.Backward", uno::makeAny(false)}, ++ {"SearchItem.Command", uno::makeAny(static_cast(bFindAll ? SvxSearchCmd::FIND_ALL : SvxSearchCmd::FIND))}, + })); + comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues); + } +@@ -415,6 +419,17 @@ void SdTiledRenderingTest::testSearch() + CPPUNIT_ASSERT_EQUAL(false, m_bFound); + } + ++void SdTiledRenderingTest::testSearchAll() ++{ ++ SdXImpressDocument* pXImpressDocument = createDoc("search-all.odp"); ++ ++ lcl_search("match", /*bFindAll=*/true); ++ ++ OString aUsedFormat; ++ // This was empty: find-all did not highlight the first match. ++ CPPUNIT_ASSERT_EQUAL(OString("match"), pXImpressDocument->getTextSelection("text/plain;charset=utf-8", aUsedFormat)); ++} ++ + #endif + + CPPUNIT_TEST_SUITE_REGISTRATION(SdTiledRenderingTest); +diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx +index 51635d5cba14..c9ab51dcc7f7 100644 +--- a/sd/source/ui/view/Outliner.cxx ++++ b/sd/source/ui/view/Outliner.cxx +@@ -594,6 +594,7 @@ void Outliner::Initialize (bool bDirectionIsForward) + + bool Outliner::SearchAndReplaceAll() + { ++ bool bRet = true; + // Save the current position to be restored after having replaced all + // matches. + RememberStartPosition (); +@@ -631,6 +632,16 @@ bool Outliner::SearchAndReplaceAll() + do + { + bFoundMatch = ! SearchAndReplaceOnce(&aSelections); ++ if (mpSearchItem->GetCommand() == SvxSearchCmd::FIND_ALL && pViewShell->GetDoc()->isTiledRendering() && bFoundMatch && aSelections.size() == 1) ++ { ++ // Without this, RememberStartPosition() will think it already has a remembered position. ++ mnStartPageIndex = (sal_uInt16)-1; ++ ++ RememberStartPosition(); ++ ++ // So when RestoreStartPosition() restores the first match, then spellchecker doesn't kill the selection. ++ bRet = false; ++ } + } + while (bFoundMatch); + +@@ -659,7 +670,7 @@ bool Outliner::SearchAndReplaceAll() + RestoreStartPosition (); + mnStartPageIndex = (sal_uInt16)-1; + +- return true; ++ return bRet; + } + + bool Outliner::SearchAndReplaceOnce(std::vector* pSelections) +-- +2.12.0 + diff --git a/SOURCES/0211-sd-tiled-rendering-implement-CALLBACK_SET_PART-for-f.patch b/SOURCES/0211-sd-tiled-rendering-implement-CALLBACK_SET_PART-for-f.patch new file mode 100644 index 0000000..3060ec2 --- /dev/null +++ b/SOURCES/0211-sd-tiled-rendering-implement-CALLBACK_SET_PART-for-f.patch @@ -0,0 +1,411 @@ +From d9016396c76490706b92ad8f30080ae1995a00da Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Thu, 15 Oct 2015 16:56:14 +0200 +Subject: [PATCH 211/398] sd tiled rendering: implement CALLBACK_SET_PART for + find-all + +Change-Id: I607b3719e0f508f9ae24db7482323847aa8e2491 +(cherry picked from commit 6a35a75a6bb2753f40edf59f360130e452b3c7f0) +--- + sd/qa/unit/tiledrendering/data/search-all.odp | Bin 10744 -> 10938 bytes + sd/qa/unit/tiledrendering/tiledrendering.cxx | 7 +++++++ + sd/source/ui/view/Outliner.cxx | 8 ++++++++ + 3 files changed, 15 insertions(+) + +diff --git a/sd/qa/unit/tiledrendering/data/search-all.odp b/sd/qa/unit/tiledrendering/data/search-all.odp +index cb3cb31cf5c7d5d4025a0025871ad1314c598cdf..0fd069ce6c0b4201c37a6678b6b1cd9875872c8f 100644 +GIT binary patch +delta 9300 +zcmZ8H1ymi$vKM!UAi>?;U4y%OaCZ+f1PQJew*%!n3y;?ID~|RBqb%4l$10zH4P07EiEnW?d?50JOTm&LPJAiVq#KK +zQnItN3kwU&%ggKQ>pMC+`uh6D#>Qr6XP1|kH#awrj*iaH&mSKjK_Jl6)06m|GXn?& +zD<&^3q2>GiaB1JWoDmo9ZJayRDK?v}7Ovj$QyKzylzg`L)dFE$ZtN-r;|Tgk9BPgN +zF%wGgPgs25K172DApS&;fwVptgKo$b%j=kK=6P2|BQow#-n+R?1w9_ctoNo!#V;*( +zKdnAIOEW1KK5Ik4+D(yn6M`9`B)%!+GHHF<3E}lp6vo>8O6(s)>*b+^GnZq(WgCT& +z8O+-n_W6p=A~t@DRX?GuCbQ5l>J`9BL3qoGkqH78sB4Ko$IYmD_RkkS7Tnp9XKf9` +zf`$Sy>BY9Fcd9+{92$-N+MJiUl_HW%ctP0Oay=9gJ?mU5b|n@76MJ;=;^d9C$QO!R +zI)7yl-i*zr=eT@gsbVU#R!!FiocdtRDu +zK;Kf2O9#-E07X@abNSaF4@$G`m4`yOS5m~bZJ}Ke62_}eQc|_m;haG +z`-7Iv8qQlwlvWKVP~i*|`T1%tgtn5^!Em`e^FHqqBvo>AIm3Ta8g(wcAzc5x6HT0e +zM8;iz|K?qOt`#edHmbQ+T++{<*2Y=t@yetsC_L<3XZa$Ttgj~z&|Rwr9objh9Trc< +zuumR{*9&Y9iI6(s@(kaIqFSq`8UZ%%tBU(xLnxM>gy$tj>GIg$%;5etf}q#KTIy +z?i)}V$y8{aW$9jJXP{Kd?At*w_0V7y_3PIkqs>%C@?^;(|&JfgUvS)X;m<~1c7lbw|gd!e7nAt;nS>}Zlg7Q*e42`UK0le*Ig+i`np +zi}%xeC){}J?sZBFLSQ+HkXmPh=6~KVe*wA)Gxjs_mLc|er-CwI691;jq2xf$p>ofn +zU;z*k2n0M65O(a~WpeD`7e!Ey;EVWKDv$Y$yHF{hUbq+ddn!dU>Swx#_%CfeWGX07 +zkJF3h|3XhX1#>tDY$E7I4+NTjHV9&WX8(B+xo}rWEvGk9~+S(yd +zKcl_Swl0J3Dq&KF-V_aHM!0zclKb)(M`%_1KksR?6f-v$QWu*cKg( +zQ?UD|e2><((*U09w)PRs+O9zVG9Exw0Q +zQ$#={--D+-eO|N$&&&Dm(+d$1@%i)uD2bU+qLe4S$3Q9cmO}m`=lh(bclSc&s +zI;i2cKYIkwrpo0m@l`{XV|3NAf3`nxX);!{9|eet<$la9$Y@J7sN5QK(Up>d(vZT! +zLlKR4^_ZZoj0lh{87g3wb(xSIXtd=rYpv1qZ8Q?~Nq;hpOM|i+a?h-#!3b4zAgw>X +zjCLg=MzI(?s(4qrS9AH@z~5c(HLZphkj3P$mnm^3xRkS5jjfGI@LE8g^mQDXtmeEa +z{rJNCM$y;1pb1^Zuka19iC7;d_8DF^!pSf3h=Mg@l?|7y$b{n)ZlEs-K%jp%YMChJ0x4z8_(mN$~axr&{HP5)Z2Us#S +zkerZIW*23?IMazD?Oj>ckr|#?NW+H-eMK_Eu3Ptk`*SEV0n8p&CJ +zF^t=V$pJBXC2Rh8sEH1zAsqVztLhaVq{lr1y1@J1o}xr2`ZlS9YQ=`!&{5?T98oog +z(Zf(2`D}idZAD~%s}=XB9C`wBLttQeegQ*kYzpEB8I@^uY|k>TqKu~(ND$TEscDW= +zr8dfIZbYng%{rPE(?t_vfjK0{yQ%)XTX==~m;h-J`_ML&HnRp84M43~AP^oYj5{AB +zV8N(cws2J4)}!|?zjyy2`GaIEh6}dXnCKc_m}HUj`qI)7#dL~o(0}!95zyS)|M^Nd +zMAvJ7wo`&XW+MSfkgKocByvoW0?48$6di_&l+7t23$bFg_5PC6qqh4=a-eB8liGbWEvVxL5C-s##@ +zMTFT%iGKc0`klI>cIU^j*DAmkDXC6AgytGsU+tNOda<0fvD{q~@A9RhkZvP(VQR%4 +zTyt2t%_%J%Y9em_fM9;oqgfY9)n_u=|Fx;7YeBw*A}|=%D?rumh8){%F-Xy)6z_xM +zDYe83rp%v&E2pw^N!dZ%JkmRVBC_MP{VbzE*UeZ&SE;^+fa{xzha(`cC_GRu(l|5h +zQZvdzh)1v;OL{xFAoRUmWR~}uoZ<-2WNiJ>itfQuR4avhTKlUX8YoI~11V`-TD$u4 +zklPq1R=n8WV{;S8$)o67{4W`|q9=_kR>#PfUK1n`Et(N1sAisl;ge&DKq7-;HEFfF +zS$HM21bV+^cF0P@a0P(n+zPk`>Db(Fh${q?^}2WKYPRFZ?;-d_ggip3L1s61r$PlC +z_ar0Zykpm>APi@v +zQLMu&dIsuy?OG%XPjzhMoimeQa&%>DtndI3mPb*egu79n6i~ESdB`O}n93e>^7qV|ibe!Mz8qxi +zi4W?SxOlndiq|}pv1NycBQt5SW)kO~f|gy%`8c_v`UmeSQ+e2P(mff%nK{SCr8C`` +z5+;#xVkth`w(B?f?w4>%{ed=3H@);-C;3np+1_*%R)P>-1mD>J10V;IM0r(Uyul1R +z5Z4MaRHZtSZxQ+t;C2g#`yZ?LB-Ib+6BJ5|B|Qga@^H!r7jKKfvBHI$Dium +zqk;5e+B|2SmEAIWOMi~AeWrdqnhm^dJ{xq?2#a{aK4(N_y +z$~#|GG<&TDmt)!am3gXI*rGy58woeUxO^WY!lL<_cPhK^1dR^c1BR4193c{(XMjUUev!9Y!S}SA|^52OmFSzn#b2kLXnpJ>tMJ +zsz*UF=A3!VAaZdt{apyn*xjODzMDLjQu(-cwx=uM;DNL_dH;K>rM^VxH9z5{OG6bB +zjaP3D@eGleFwLnkzVvU%>V93?8;ww`Tp6MF3fQkIbBGqEU3o_yayuBW7JP__ptZ94 +z>Pk}t5T@@+T~pl8>#-`?B@zCFTL)`IiH94%bvAPgWuDl2~UdumD|bBpp(RsTI#D%Q(#Z43hf|2$M+RB +zosD`r0<|=ouV;iGUM{KY_{sXLOD?i@u7(;@ +z-)qmK?8$kD$l9b+ztl=UX_+v(R$D$R)EnLo!9%`=fLmb<4_S1`h(^1`4tAO)?6<%Q +zoH2XTEewJNad?EZC9a56{$vqjUV?aow{{W<1!G%q;zccsyvE^Yeja+k!E`{Ni_vKw +zAP8sEyXRV1`>s;#K=O|b +zaej^hyOu_PQgLf)xR%x)TcTLfx<}>(zGhv6>5ob!S=+l_0f~&qdFpYGq>Bv-S$DT +zGN{^(v6N8-c;k+8pTD2wYmydAYP~n;;H?@)h`R3gs55UUV8SPu4-vJqaIhSa0+JA! +z+)}mD=6(NkZf#~j=uXx@_J$6BtL*4gOWTMJ+qbawtNz> +zY;|&eb_@r1n?g`=`o^}x+4+GvYFst9>LlCnl-HJ>i!Vnst*LGSZ}FJH@?n4t1Dy_Y +zK$Y0I_wOSe-SaYCHv7A}sP``P?Z8FkQo+tPp-2`v1qWMpKz*Pc&&`(X`wwYkf;k#H +ztDRT;4GJuj=oZRu9v-Xy4&==Fq@PRKSwYs4l+>4kKJ`#?dofO3%|9AFlQ{nQUAJ~1IxIcWOi;F +ziO|w;HW;yIvrP0*Y_Xs8^68LGUj!2ohIjE=oz +z3;igftqcu;-L)nrWb@%;`MV)8YHW7FtzYA*4mQU#I}%IoXi;2qfE4GDxaE^86$5o49-^B>Fgeg5HcoOt(@K +zUI)1<&8g}VD~rQ-2J<}!72@CYCJEfswUwG%%QC8r77#|ttOINc5j2J$&rTQ?%7K$vnQ2SX_AO$$bnM`q4`Pj_W-G9sSkzs-lU*oNdgLg5ypsW;9uLleT2nZp +z{8`yB$@i*Sn_R7dzj@NKrsnC95Y;Sp7@Xv_sgQ#z!#31mrHE+=$z!%u($CE;SuIkp +zO*+RuK|(wUTb*eb%!Y`ut|Vf0{Ulw_`fJ! +z?1R(u-<>h7$r^2m6>pK8P@5|5PEBl~C7_9P#IwC~!~W@#IG#&NTi#Em`)$cCOrikA}ip&Jg*07J7G +zS;1ge!O-b*S=cy%r^SQh=!i^I<|oxMWibBsb8%12!WeLXbM`h-$#!_=5nB}O#XQC=`Pc1SYQlof{itmCu?-y-}U1|2d +zR8Une(Rz~uxK$ZNV^Uh=!hjv)(My(Pe~UrP*-V2)_@~-b;gHdi5IQ8pYzwx*Orj@S +z^;Fp()9QzA0rjB*?)^oxdxR(6R`0d~l?914Y^t#}gsEZGPUn2zr9Z$3nU@@1nimn> +zB?nXoid-@C=Q3;RISgwE75R;BHM>Nf?hMa8M0V5&&>uk~R$H64Q)b`%P-RF)|n3V=VY_30yN+lebF>HkCw9P$j5ip6Ca`TW!xkJI35)`kzAK1hRW +z&Xj_;N}y?76e6I4-F8sTc(zVy2JMJ1ZQGixa1E*m9&4f<_A33Qh=KRZ$s&V(QieM^ +zoGmpRki5)%^F(9N(}zVG9i!r<7-7koa9|*;QZc@ehX96RE1DcBa~cNzP=+5#9!EUg +z9d~nugNc$n4@SfP(h5FleZV^Gv{g?UzO^F<^Aa}<*G+0wQvgpwcZSE(hz6PTPX*dOhD +zu2(*P%=7w?=v5f>{RlIE`Fyr*o=|#YVe>QOm*)^~*|P5;Dt%(th_j76+*W&}CrXki +zu2AGJ%`Qa-(J@~7U5i(*^dwA77aGWxG(QlVzlTw2!`FO8Tks7kK45*bk{S!qJct~3 +z9RTr48tfrg +zTb~TGlrj1OUrT+Og=#oZD8flw(5fsrU(osO@vY?LB=V990<)+VVI!7XVzjuM{B6p4 +zPjKyL6Z|yXO@R;|H&S$n(eOAI3yV20lM9Q21bKkUOe^P$!?lRO%#*^xM*2?Kw^Vb_TXn +zT#JJak-kKhp3763BFL#&Qxb^@$L-vCh7NINLb$CTKE_^%p&nw4iar3ryMUeH`BPZ= +zJw+oQMQF^gDHyismGR&v4#bn-dD6tPbC=c`B$gPV$WXUWqMKf>0z*e*Gyc0_=xj)vN@`4ZJRt|6#&zRd&8KK^zj8I%NP-9HxzPS9kid~Q9kNJQ_@K+ +z<*AgKN#}~gTK>V1)6#?SS!)lbUnoh%{bmhh=o`O1+?ot#{(xKi2$)~RTP!c|z$?e* +zT-A{m`sF +zO@V{8kzq0Egs~d6GCC(|qb;4SCKi7EuHhUk#JL+gO}T)Q;n7T@7eQlxfOiOy`%& +z|Ju`wXj7yKv?5f%m!rvDu`RRo87Z25tqgm>n)$6uKHzz9uF=8m+d{Tt*?#qyw$DeU +zEcoOh9=G432kvV%F?Q!>>Gk2p{ELB$5cJ4qY;OjVE4)6|3mYvw^#oqg1;M`UVu|k> +z3f06~70lyOPW4jgDS(FhS7%Hv14?Vsgp5X%+R?sW`*#tP)?T3*OW3t-XFp#>rb^Zc +z!7OaL9_2^IwM&fKN9h?uk28ro&Y+oZG>0xWydI!+L8#T|i&XxBZtl$&`E?Cse)`TN +zlYixgLoe;=RN6t%?=m96Xdx6$wVl)ZZeRWOudC{}Qh7H(3h92iHg8oLp2a3#M{eix +z>@F4xR}B92T2;xKh4`FeYXX<4JPRKKFKkR7mKMqd?%pZCPZJ%Tk=4JYS0uA))d>3w +z?-nu#ra%(vjQAvWu1r3;iIBEIcH4)gr +zOf{$9dN_Z&B>S&z)$fH8T%E`tebGcXSt@E|$L-bV*B4S&Fm!{jYkA;~?fhi9EVP`2 +zangIcrj)0@aeg`Wgr4T{63&Z^_@(S5qlw1V*>J&6>d6_nJ0G682p>{m>=>1C6KRHXFl@O5x`%ts=u +zQV-`r>usn5fjz}Bom?A&-*0QIZozAX65Tlm^abJ-S>+s0_n*+1Y`v{q=eJ#&gbyqq +zki^y=gkMcER=lQqj>X7j0 +z<-XmEsGH8SRBDu1un2WU`P;)uNVR|tb{jcGJKq3nsFN4X_kPZ{mCcM)-QgMFa&<~- +zE_=s&Yd~u@?^VuXP$`>F^`M)7ay7ZAayQTt*W%hgwAJ-%%PcLm1JI2B^vcrV= +z`~H{OYQenMF^YyW+jSICa=%NnYreUdg$xve6u@xyp(4vZp!gylg|NTCfK|A?xSYUpO_kaKr5s?e7E*@ +zDT4#P$4onRFR5tmp~8r+Yt}*uaItF|c)Ku1{_Q`c?#D+j{jl5fYSD*szuSeQFHO^I +zO?O|syBCk}mlq<`{=yID?WT@bF^BtaKASo!9vgh4jf236M&exV%0H&$3i+;wix#kK +zb>Aexniij}092!DUajYcL-5?cT-(yVQSeJIE=wc@?SpA|Im)J+h>1_QFSLG2;%oZv +z{W(dIME3UH=`vQSKNujqRrJQ5OwQFP*3Y$UyxfKoUnAeHK}Hb(PwAiujV0ifY~ZAl +z#M{U>Xz)_%8)sNlWo{qpEoeDdn-pzl3i4jmUnpIIfXi$1NSCW1>qW&?7mM!5$RpiF +zXvM%WY#C%iCg#@#Xdkx*SRwOe#Ue=rbJV0uKj1ukgfWNi>&Mu!X-BWKHnu(MkY*Y3 +zdu+XlQA~!KpI*yCy>{cPxJ;yss8scZ%tOE+1EA! +zxVk|IH!zp+*&=Vk1de6WOr)~ykLU#I-tL?iUya6=%eKK-`8G*Fz&6eC&Bx=k5&!p< +z(ypNM!ZN&gy{n=a;qNjOD_OM2M+S2{bLB*VdIX2iMV!0ysbXJ;775DRjEO97;bqMd +zwQs&qDCcI*wqdCVeD*)3GWK?fd-!b9dlj7n=m8gcrBRIgn(aD{ij6mSn%d?z)m1qr +zu6ZLXQOnd#_8C?v%@z7A$ZeH-j)XI-Ip5ZNym{$J5dRdR4Rd+%k{rV<=?u-vTVyOx +zs&1fsRYibavCp$F`tqUJo&_`L0!Lfob1-P(HOBuvX`X%{n?U; +zGzJKy()mwP{`c=8e`e8S6q}0wWiW(F=mm9C +zal-%8pQF_NTS5uWp+f~vQ6m1s-cw@!N2%U|S{v#`+(yIw-~Xb3?`Q(oh;3(SHf3=$bU5!BbFC7##5Xi#C +z+0)9|^QHIv|0n;q$6ksR{|DhXf0r(-JpO&(zx??hRWJ(!CKMD{l!5N$4#Nc3h!+6#y|(}O#3p^{{UOc?Faw> + +delta 9125 +zcmZvC1yEc|u=e7%1cJM}I{|`2ki}gS+}%R3CAbDz+?`;-f;&NiySuxEMS}k1-goQ2 +z_tl%4Iy2M#O`mhRr+R9pyIJ#A9jF3=gU0~?kO2UH+c=;)y1%WmjL&29LJT|r5EEx7 +z3x2Lge(xVS__MAX#OEG#U%yu3m}LQ+yv3JMBpYHE6VdS+&3wzjseuCCtR-hqLE +zk&%%Q2qY~nEiW&xw6wIQrlz^Mxx2f2XlQ79dU|$IZd*=DT*GtmWO*SePmmzQSQ>#EYxk4F(|yMfX^+d-*;A2yO>ai_vWN%*M$ZSX +zeQ}SP3wtC8Cjt(*^SLqj1P|u$P!F1>j8rvSpP5*lx(qi}Un^9=P0dxeLTKc07lSCP +z@fE|EEaYB^NZGnF-t8rhdk>jLD8BqnTa~&0|cQ`d5dO8yCKiuISpbw*R +zx!SgJlIFkJC=6IRTfxMvMA^SSErR&yqj0=m?iu)ohdZtHTl4UW7(lRW<;XlYa+3*^ +zTb6&F&Z$(vx;0%rJ+)&kg7%`F|CY`%nE9Rb`^!_cR^09D^|{Tu#g&QB8;0BM2@4WYnJNS2d4R@iI&YRbqpD>aKB{mS>4HFhnH4D=;qDTL$2qI +zn(c@!pe1}<9{})NK(d4N7XkQ3!;Qb#-)QLv1|HSNHLD36NCMG@OC}h?(*29iE-9lRpBYU^oYvjw~PB!%?Np{|ETuh +z8BI#xRnMh)8%=n&#^{ha`I}P4h*!o5D_Kl^H}EMKr`@6RD+wSmV#_|5lxa5RFx*L+ +zgYQLDY~?_?ER9p0ol4z_%oHld!peffP;h>|BZ>;`(VCH(WN{Hwnr~SWEp{=)etP+S +zsDpV>fbGPZ;L+uL?=nK(K|NEdP|lS&s=dzmISb`yEwPwh6Ti1e$>nDFE{!wwCi_6W +zA!%{GEwQy`^IZeHr+F&UB$;8alh2q^mFke+8#tP)NxExiHwR++@MT|wA>V`YA#gmW +z4j@9vU#qpq-us{xjB##?QdQhNPxTgVIu5va1*6(Tm!psrvOd_qaM;t>_Mu+B?~xbA +znBJGVYn^DYg%2imiek8YUx1Jn?TW*;+D4ZZM9(*M=cBJl@Nq+>>3v5WkHVGU9c>#i +zng$Pl6HZ+j_ai2NJminsUkcd&?2lE55sa9C000!`k5y7oApigYqTFAAzaQiwDX3HM +zvVgzLnt~Jy09e7kK>xNY;MNFWnw-64@uXouZr~T4QYpEs>wCG)vb)3>?W=ikbPWEe +zJ9pRT*HN{m5LDj?^Dn`Ww+LjkouQ7;FmF^y^8wA2{ePHp(n?a_B#Z+7_A~ytQeEdf!TJWO;NASu}cjTS(RK`T%lK@Thj2eT5-0;h+ +zJe;UK!V3M>w~Nl5h*I^LCrysuEFusb$yvFL95u*s3P;)sbw*IC)cX;UWJZ;gpAylZ +zz~H4#m!$zjw5?u0-WEF@8O`QGr!MsV>$C`CYR#)?FpruyZDTsAz^Pdoq83frCb9)g +z6l{vUamXgG{3XZdiRPb>f|Nr8Zh84}VVf^`3K_)1NtZE!>V +zuLrM6{p^e%T(O)Wt-G;n1;)(*&pE~C;IOv0io%{M#7b}RlkY#ii@K6yAMT6cCRYf8 +z!&VUZ%%USR}Yx?;_KcFl)&|5V15JLrogxo6snd$6h&E&xY&;kEh +z5nqug!1}I4{5XDRmFLF=+yij$&nrSW%{cg~>3fP0ixt;;PGK}`-92b3I3KTs_3)BA +zCC=XqX5LYHcod%9(~xEo8~FI3^mK7EjHvQuE*j4W01k4;b_x#OzG_Ky-7`HZMk9%7 +zLP95RV*pq)5k=)v-uV}SR&-h&1moh-&C-rSz-BP}As0jh0R~F8r%FlY4)IUvM$@ajIrvJ}E&J>8m-joI*A%AKl}oSgPMl&NW!uq8fL+6030vOEM>JRaI4jilleq7tt9U{*pcJ5N6AjinyQ1UQhj& +z7itcH#(f)~E!-BoXb*#;L)rl=c-(yK6P^_tljPbFiimC#QiP$dte%~;+~YEw;FyLA +z84QJ`$-+;Ci`I2%?!4&+<|L{vWWs#KRSjRpcrr2#;*ohj>Yc8N?v2>#-EC8#-&cM; +z$i0DoiYaUq4Qc*SPkAQFv;{b;3WVjS-Q~XymGx)hUe?imOzl4R%E`#fYk^#B0>xrM +zaBBhhs6J(;`nLgo0;@-;)Qh`c!0W41nD2+{#u^Ye-hL6K+gC`<=!9cK4c@dy47ks^ +z&mnV4@nj_hDQtuKvh2~!WLSI+G`1Fm#lp)7|~g0jF~^Z&1))n`&>z&1o}q6 +zwYdbW4^*(8FMZmF(&V>2z_m+yvq9O+zqJJINv@U%3Vm19F`ejGQ(dV{0gG!=_2bG$ +z)mFMCkz6e?_cwrzN!JE-`zyY1zX!Rp+IQF2WevT4&FX~`enlSE)uu4;>KfUb5kq?k +zcIiERW(X99X!uFEus2Y)*Z7`wq|k#P;&(oxdoPe#Wc7oKBpRunx~I>+y|quPw=!?j +z@AX4Q_4N>iSfAV9x4%~I!@xnlvSEgqLD!Pe`F1u8Eviv2Vl!Qxd{Xv8j>cYrsVCd9623e&fWqldbgijc;saeL@HG +ze13+Ie2IKK9Bk?gCiPGU!j*F@XRt{`Z8V=zK(ow%HwreJeIyHaH@FV^adhk`3QQuK +zI)+ky?#(;kK_&N?}8C+)J#JFuPC4J^v>>GH|#IgRL#STu&Y*pOD7N4|13H`e7b%f!H8Fkm+y +z=SWvU)zE^eP9}$;1Wm`rlFGDVrFhvXPv;G(l(>qPTLkOITo{VOYy-WrK352WJLn+x +zkq?1ZP?&EGst2;gd{d^v7)(_&G%TI!!hAD^iX8=$V%1jfseM$;1$PbnfdApTF`4vp +zb5zUqB8oBwsvNpk68Zxtlo3n493uoX$V5iNPhXk(RIZVD&BwXHm%sFi|BrJ`Zs-c( +zMgRZ|X#xNBt@!Aq;1#_Qhb=zL_8UeZ>tZ?$sAf(yx^_O#N|geQg-*MnZX{0IErg={{Rd4Ed$t1a3A=m>2mZ612u;#hlKrDqxYA#M>AuySx +zUzfFxX9CowEkL!M^$Ks!NL_C;lZ2_fidFYJS$i#F`s8bwrQB{*w1TuvPGY83?CCFr +zRav{T@n7(S%z+Y#?5AITv-E +zsG#I+?`5z$qMlASZj}+&h))&1e@{8Vm8MN~K*)u#Dm@W%~T9%GUky +z!gDie4bjURuYE_##G&&??K$Q|m2pO4u`FE19&C5t7?^20U9unyQy8{gUy0x7^%dLW +zeQ0REQ=qyV0FvCrHxMMX@R=|UOK={|{{%%ZA+9Sor%Fa9w9IJV+~?3GgPV;QsrN@D +z;CPdt#NJH)UOgqPA{Qkl52B(%??jm?&Q+a_vf5s)H*?@)#3uN;MEwy&MPxP`Pz$>{ +zubD!Z2^RZGhKjG8wn$V<6)7*80KaMYML<`fKR2cpT7wEn4;s-0;{bJbiA`k>q5|qlHgtt7-?)NU(cC{eRO53U3B&Ozf?B;g-UzNu|?& +zHwKrEk{(Pdw0eAOID4bD^)*&urhI(%h-XjZ+2Md_=Y6eip}9MCgKL6OSrQM@3CZNE +z-FPET8$;GPhKG2kM2*}@01=9oad2y&@;+}< +zRo38Z9>XlVO$jXOH*}2^D@Hhsj_|9PnVGdqQpftnVgL0+M6-2$XV#Nq?q{qMQ8F+R +z@}}$&fGF{%9>gQKsM8UxLd7(-)H`0Q00`a<*8*0c$ybvkLTpH)Y6r($2DL`c2k-XI +zI*4|oq=A}sQB>i1yu)^K1$V2}>eAMXrDB<19cHp*!f&@k47v5DG?9U};&3%}yfvG- +z!yI*uf)&iRT#xTBT}CI-JkLLL1%iKSHtCx-o^7TDEtxVj5=lB`cgTg%X`5O3L4b;t +zeX(Z>4)M7S+AlmgKa07oy?2+;2OFTG1CKKMx1ZzoyVj0Ayb(pul~VQ!+8^y3Zea4$ +zbZV{Ed{PVtA2Zu0%IF$fm$ci^eSXyG$E0LN`rVA@Gh&VFYOmBT%(yjMf-m!>B-uw$ +zby3>D=UIJPh0?>u<*W`4-_rHagJ?Ax-hb0*C(vB|Rs5wv#Xf`Vn6KE&srZx)a%Wrl +z_AQ3RVN0E>Y#io#QR$EAdz-z=g>R@+4`e@I@h3{UoJ%6@kPQ>rK>d{|<^94K>GV$XQ6iU%x>J8FsXe%}uYKU_BzEdPSM@R)FNCSq! +zvpeBA?#Y-%WeyAjgF92b5s5n!D;;T(gby1i&v>No9tTMeSJ!b*uPnZZUMe*<*ge`t +zb_N}EbD)HM?NKWE&@SFO*>+kDwhhWF-U5Fvq|u%HGy_VNPZ)``_|1xC`F63sHfc%T +z&S6Y6Vfh*D&yMji%;p3E5desz`d>Rn95w}bi4Uv&tWt$Baas1F5D7O%eZb*FtMsj| +zwq3S5CW>4bV}P_;ew^|>#&uQbBlsSKhYhliid$u^ZJvNVe;{ASkoHJnpbXild +zXximq=msBjk3fnc?cNA3|I_iXGr)JkicNiNA>R|_sNCB19ZSQP4cF!GoP{HG2$8$W +z7CkPu{O~PB(TuEJ8V>C}io~KaSv5Tof&4IG6EOH=WWPE@fOF0y!!r3R4#lSmxS?fn +z4olZzGetllM#Cy};deWN)cfLhRaOPyvOC#v2P0tGFBxm|q=yp=m>+%P{scJhc#(~z +zWWyRY*wfu<8U_yLrb??lge#bgJZ35E$}OYbR5BGU8E7hKJG8)DG@JNX=F6xJJl)(< +zPL(-LL3I=OkP@-;a;j4@^c-S1m2?Zy8>_iJ&=qUnJv2zQmC>#RGlb+yoleJtg*si; +zdM=89JQBq*$icALUk8g_9AoEnY$Wt^X*y-1bBn(tXreRTCSrY&p#(Y+6#KKJ3mN{x +zp>`)c^4!vF0qQZ!YUds$#bbF4zjh|?@l2$L|G0+kS}Wd0HIEe0X>e3c7bSb$R)_9p +zFJ-NENn0AHh_k_zIhf>m)Z#+|e&c^G;7^&S*=ahm+eEfK@#`GLknS>jTGByHY#cj_ +z3b*7taa5vW0Yx?e@~d67ql~!-s+Vo5eXJwKDpSHzYV#7ZCyNGSdi#F(4y0i5Kyfh1)hitTrfa@*4x2Er}qak|F%K`!Q>PmZw<_S|raJxZHo +zX5Pmx3Ev3ygnJ;7_BRP_?4!q|Dk9F`EstYMj`qwCN;W#(TSFoj1&Y`|YDS3wpDsYO +zuAxEbDUsKzKz>W{2KQLBFHu(STwiC2bm4{svUg~4(IB&Rk62dGF{yNe^qfzpWHfhE +z5-xdv-+!DwiIbMR#SMW2U!O^Jbz`2r0Z)H;4#*}CSrj8CSnQnk6mWhUBglA(lZp2Y +z{Y0Ox9xd7Eh!zCyvZ2~yg6|>{kQ7gU(1P7eGa{g_(ad?2aSrQ{;QHv5QvRxgyJCPq +zM{;x<>(hHZZrJ)z0O0J!#7&}s>=r2+y4{IPM9Of}OXcmby>+8GDXEF{j> +zlY!&eB}f`;bR=|5_Dl1)%B>P7wQ +zsKmXuM85}pt-*z{zC{zyVR%(eL7{oA>cZocsl(JQcrn<_krjJgo}J9r0=jkRzm?w? +zjvMa(I0rvJek^rTqmLi0<|E!_Cew*cb1SEp@>fkbLxapj^v>?gj3lk%^f +zKKOBVl<^YPfj^Uf8Opb_tmM%2vanQzw6=Y-UaM6LAu;(3r{smBjz^a_E%J)LbI2=P +za$V*@>}Nk%#4hMNl%X}6G4fzksnn#r{|M7j+m=?KE0J84CgP?GMp0TS0D%x=W@jg_ +z52>_pEPft|9Xo!<8JD;xphus}jxy%@XG++q$AC`c6V`no=YlA+nb1k?t%~*ZyB=|Q +z*j|JK>`836zPwMGI%?CF$XY$0-Xyrta*q}8#e9YbE2E2x971B`@q6SB7W<29>k}yo +zaAr6PXmG^}u4Ys;VmS;0(~Zy@C-KUeg2)1fun>Bc&F^&I#l8t17MJ~8MGeEzdW$W1 +z@v7IXbVGG-@=XeIR{+Ndqblk|jH{%1smQmmB++(z}0JI5F3^ERgfsetjZVR;{cHBu-H;+!M0HE4ZIyAUv`Ttyg(>#1_J7x$vw=A>89L3rU$>yk;LbCk!wM=`xYZxeWT0+cjz +z1LJDD3&;MV#D2Y{V>D)uv4Yl=m>xXJ6wa5MLeS*OmPd@7XYYyP&FauDv|y6Fla^3l +z_EROUPpi>wbG$($0`mB2ij!;c*1v;RKmu*u$1s=&_tpu1`v&K|Olipdr7jvD!H379id-${2K|ZufZ^gd9 +zihE9cqU)8xl16heU@(SqsMhdF542Yg`*W+yJzr(3PXhWIK957S)a9b@;4>C%!85tP +zG$z&E_ATNY1!r?l)#N_thD_qB$dvsTUzqMES|nE|yYYv2 +zM=mof^boqw+s@J?O&Bc(e8(n4zVkaK#`v#1$URD6H!Fe+QTu(Hsz6tSnsU?m(PMR^ +z=S_04^|6!8NVp*8T9u{a1h_)5ltwLaPgGJ^>K?Vl45gM{D%kf~qo>>flUtuk%Uxs{ +zwpv2Ap3lh;xR(_%-$>k3o)o4@+t~`+L$^Y~=O+}V*dlKC%L6mrJ#Zd+LSgYSaQ+yb +z0?!`5F#Ja*d0^pha^>%Z5Oc6y?2%X1hPC#f16Wx8uR0i=VSP0R&WFzZsmrV3T43S9 +zG6CI=1@4L`uLN(9NaN@ggTgu6dy~Vl_Q}(`+RCTnGSPc4Uds=ajN_9sx_1m9a`S_H +z7XAp8zgpjf!k8MUYSPlXuQ4@lnC6TqnNZbuw0CmlHA8}T3qnf^Uoi~^eN@#|WmZKhjZT8tmO6n=J~E^oaN +zYm2DTXvfx?QtiyX)SsNvgi4<)AAPATym +z;wF&-39Pth+QCbghwk0g_4MQ_bWG3I729|OyxV7yQkogv6g#NVzX-)KD +zefM^sPQ0G7DnAf|gHH6o7Xymc@r8=1=kOZ|G$v-TDyWEUs!DLIYA2V(I}0GC-Cu9O +z#=%)sI&#GW1OIyOi)4atak^i|8+chIQ5N+sc>r_?V5G&=_MW*}rd-fP3~*%5j<`q; +zUdeH~k^NQYS!BUT<6^uaCZ_l5mz?is$z-yMEFW5~jk0qWCFXV)Iwps@qPYk2oBZT> +z7S1m*u~jnRmBaMJv1$_dJ!Z+D=L-ufzMXm*1kbhfR6|SE@Al>uxis3s9g39{cu%ZH +z!%36xyl&XZAkDwtMy5YTnquSd=9vqA0$)(I=}%w})##fzpGJB&L`r+Ny}3zj1(`bA +zgYI;AXkK3skwsb#%oS-#y&7b$jj8_bm3)3-syan$A*_(^t@&fxNnGUj?|VHu=1=jL8bVe6Y9CEnKG@wv +zp1iEK4|brY>%;*axn4vm&U+{YyZMC=#f>vD&=-NB>9!x}pcj7>PpP>%bmEQ`wU+5=y&?veN~ +ztRmfX&$bm7AOBYIK4U^WmyoOqB9An3Mx{)8CLuQ^2ty%@XiYOmzX3Pl_9qqQ|v(Rjf>EEcFDYZ+WJnl!AW>4iec=8XozBz|lv~2>s>f@Ef~4t4PXn3{+#u0BI#!LVjnT+r=ABUT +zwb72SFX02@7b+YFMS_q=Ywd-c9eN&swN~Ggc*~@~;tiUaiU%u-hzJ-TXU&|b93Xs+ +zBhw3RK0tnbQf2z+I9pN9sFrjBrJnK`_zBrLpyG_4zegmu)EDLJPnV0)#=o0ey=5xX +zONCQ$&*|?2OO6i|-ILbX58s_U_*B)14u1UAc7x}mtZ7=B+<15~9g8b7(_dfCUu31# +z_o=&AUE1er1~0FnsaoK5X+v9A3Eaprzo6m9jH9PK-`n2bEGr0d_n9miKA60Cy)Q@C +zbSP`~{^K*upK~?hj0!m^1_1D(>3^N8-_vNqzJxzdXs93;zIm81p`t^ +z{pJq{otg@gPL1`adq6Gp&oo&Y%ztp`)I9&-lo?R}683j^wU(Av6Xp-ghmPmJ*&L8I +zIsueF`5k`+;vmm-xco#fH^%nnZpLh$_I4^D7+4$t4&ZMw$}<1HQGN+2|Eq{XK=j1m +zKa&1^hw$HAh4Pmvrj8D7<_>QEm+*fp3H4v10f0j+0KnDllbyNi|26Lq6!tGXB#99d +zR+I|jK*RXzpHKfE9j-Bwz$Q^a9vK<_=;6<3^kqat2K@U6{|8mZKmvr{Q1p)e<1n42LKOh$Zu-u{|fl?!dhyG5hKk%#`+`jh#EplP4Zvl +iA37xsM3{jJ@qc3Dj!Y!5+BA@8CVIs3mz#V5;Qs;B%h=BV + +diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx +index 85e14f7496d0..e83873e06d5b 100644 +--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx ++++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx +@@ -422,12 +422,19 @@ void SdTiledRenderingTest::testSearch() + void SdTiledRenderingTest::testSearchAll() + { + SdXImpressDocument* pXImpressDocument = createDoc("search-all.odp"); ++ pXImpressDocument->registerCallback(&SdTiledRenderingTest::callback, this); + + lcl_search("match", /*bFindAll=*/true); + + OString aUsedFormat; + // This was empty: find-all did not highlight the first match. + CPPUNIT_ASSERT_EQUAL(OString("match"), pXImpressDocument->getTextSelection("text/plain;charset=utf-8", aUsedFormat)); ++ ++ // We're on the first slide, search for something on the second slide and make sure we get a SET_PART. ++ m_nPart = 0; ++ lcl_search("second", /*bFindAll=*/true); ++ // This was 0: no SET_PART was emitted. ++ CPPUNIT_ASSERT_EQUAL(static_cast(1), m_nPart); + } + + #endif +diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx +index c9ab51dcc7f7..ff537b4da547 100644 +--- a/sd/source/ui/view/Outliner.cxx ++++ b/sd/source/ui/view/Outliner.cxx +@@ -668,6 +668,14 @@ bool Outliner::SearchAndReplaceAll() + } + + RestoreStartPosition (); ++ ++ if (mpSearchItem->GetCommand() == SvxSearchCmd::FIND_ALL && pViewShell->GetDoc()->isTiledRendering() && !bRet) ++ { ++ // Find-all, tiled rendering and we have at least one match. ++ OString aPayload = OString::number(mnStartPageIndex); ++ pViewShell->GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); ++ } ++ + mnStartPageIndex = (sal_uInt16)-1; + + return bRet; +-- +2.12.0 + diff --git a/SOURCES/0212-vcl-aAlphaBitmap.ImplGetImpBitmap-seen-as-0.patch b/SOURCES/0212-vcl-aAlphaBitmap.ImplGetImpBitmap-seen-as-0.patch new file mode 100644 index 0000000..4b0f639 --- /dev/null +++ b/SOURCES/0212-vcl-aAlphaBitmap.ImplGetImpBitmap-seen-as-0.patch @@ -0,0 +1,57 @@ +From 812ccd30a4d088f81c1aef29296aa702a0ba03b3 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Thu, 15 Oct 2015 17:18:28 +0200 +Subject: [PATCH 212/398] vcl: aAlphaBitmap.ImplGetImpBitmap() seen as 0 + +Change-Id: I3f34f0315045d33ff6e498e24c0dacb0aabb0ff9 +(cherry picked from commit 293dd731e9815c06ba8eca1fb83d86276103c820) +--- + desktop/qa/desktop_lib/test_desktop_lib.cxx | 8 ++++++++ + vcl/source/outdev/bitmap.cxx | 11 +++++++---- + 2 files changed, 15 insertions(+), 4 deletions(-) + +diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx +index c3cc748a5d61..df8723b8cedd 100644 +--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx ++++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx +@@ -298,6 +298,14 @@ void DesktopLOKTest::testPaintTile() + // 256. + pDocument->pClass->paintTile(pDocument, aBuffer.data(), nCanvasWidth, nCanvasHeight, nTilePosX, nTilePosY, nTileWidth, nTileHeight); + ++ // This crashed in OutputDevice::DrawDeviceAlphaBitmap(). ++ nCanvasWidth = 200; ++ nCanvasHeight = 200; ++ nTileWidth = 4000; ++ nTileHeight = 4000; ++ aBuffer.resize(nCanvasWidth * nCanvasHeight * 4); ++ pDocument->pClass->paintTile(pDocument, aBuffer.data(), nCanvasWidth, nCanvasHeight, nTilePosX, nTilePosY, nTileWidth, nTileHeight); ++ + closeDoc(); + } + +diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx +index 3f415d458878..e845562b27aa 100644 +--- a/vcl/source/outdev/bitmap.cxx ++++ b/vcl/source/outdev/bitmap.cxx +@@ -670,11 +670,14 @@ void OutputDevice::DrawDeviceAlphaBitmap( const Bitmap& rBmp, const AlphaMask& r + if (mpAlphaVDev) + { + Bitmap aAlphaBitmap( mpAlphaVDev->GetBitmap( aRelPt, aOutSz ) ); +- SalBitmap* pSalAlphaBmp2 = aAlphaBitmap.ImplGetImpBitmap()->ImplGetSalBitmap(); +- if (mpGraphics->BlendAlphaBitmap(aTR, *pSalSrcBmp, *pSalAlphaBmp, *pSalAlphaBmp2, this)) ++ if (aAlphaBitmap.ImplGetImpBitmap()) + { +- mpAlphaVDev->BlendBitmap(aTR, rAlpha); +- return; ++ SalBitmap* pSalAlphaBmp2 = aAlphaBitmap.ImplGetImpBitmap()->ImplGetSalBitmap(); ++ if (mpGraphics->BlendAlphaBitmap(aTR, *pSalSrcBmp, *pSalAlphaBmp, *pSalAlphaBmp2, this)) ++ { ++ mpAlphaVDev->BlendBitmap(aTR, rAlpha); ++ return; ++ } + } + } + else +-- +2.12.0 + diff --git a/SOURCES/0213-editeng-tiled-rendering-avoid-selections-callbacks-i.patch b/SOURCES/0213-editeng-tiled-rendering-avoid-selections-callbacks-i.patch new file mode 100644 index 0000000..bad7807 --- /dev/null +++ b/SOURCES/0213-editeng-tiled-rendering-avoid-selections-callbacks-i.patch @@ -0,0 +1,35 @@ +From bbafd80e0bbcaf3e61962d062070f6ec8c1c8b88 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 16 Oct 2015 09:45:52 +0200 +Subject: [PATCH 213/398] editeng tiled rendering: avoid selections callbacks + in Paint() + +Given that we emit selection callbacks on each logical operations (set +selection, deselect all, etc) already, it's not necessary to emit +callbacks in DrawSelection() when it's called from Paint(). + +Change-Id: I6781c71ee2f292de2a1c7d129fc49b514aca2be1 +(cherry picked from commit 11754fd7923c727e921bb6cbaf88d2765082667c) +--- + editeng/source/editeng/impedit3.cxx | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx +index 5df7e5e0ad32..3e4bceee6da9 100644 +--- a/editeng/source/editeng/impedit3.cxx ++++ b/editeng/source/editeng/impedit3.cxx +@@ -3848,7 +3848,10 @@ void ImpEditEngine::Paint( ImpEditView* pView, const Rectangle& rRect, OutputDev + else + pTarget->SetClipRegion(); + +- pView->DrawSelection(pView->GetEditSelection(), 0, pTarget); ++ // In case of tiled rendering pass a region to DrawSelection(), so that ++ // selection callbacks are not emitted during every repaint. ++ vcl::Region aRegion; ++ pView->DrawSelection(pView->GetEditSelection(), pView->isTiledRendering() ? &aRegion : 0, pTarget); + } + } + +-- +2.12.0 + diff --git a/SOURCES/0214-sd-tiled-rendering-emit-CALLBACK_TEXT_SELECTION-on-m.patch b/SOURCES/0214-sd-tiled-rendering-emit-CALLBACK_TEXT_SELECTION-on-m.patch new file mode 100644 index 0000000..2f9dc40 --- /dev/null +++ b/SOURCES/0214-sd-tiled-rendering-emit-CALLBACK_TEXT_SELECTION-on-m.patch @@ -0,0 +1,300 @@ +From e172ed06a5d5cc472d5045d17c741e8aca23e4c8 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 16 Oct 2015 11:24:11 +0200 +Subject: [PATCH 214/398] sd tiled rendering: emit CALLBACK_TEXT_SELECTION on + multiple search results + +(cherry picked from commit 186f32f63434e16ff5776251657f902d5808ed3d) + +Change-Id: Ib6be973bf7c911907c793571b84021dc317dcc80 +--- + sd/qa/unit/tiledrendering/data/search-all.odp | Bin 10938 -> 10974 bytes + sd/qa/unit/tiledrendering/tiledrendering.cxx | 14 ++++++++++++++ + sd/source/ui/view/Outliner.cxx | 17 +++++++++++++++-- + 3 files changed, 29 insertions(+), 2 deletions(-) + +diff --git a/sd/qa/unit/tiledrendering/data/search-all.odp b/sd/qa/unit/tiledrendering/data/search-all.odp +index 0fd069ce6c0b4201c37a6678b6b1cd9875872c8f..46ddaf412bfa3248fd5a9459b0038dc72d9798a7 100644 +GIT binary patch +delta 5192 +zcmZWN2UJr_uz}D8L5TF4gpMFJ6hSl~B?8hxK$?h#E`%cGQWWVW0g2L}ff3KbO*Nl9}iQ^O4ToFjHZEWOL5)%{}MY?)4^Dr!5DRo*}7GY@U +z(Bo#TsxC3y8p?W8;AH<92~Lt60&KQcSIw;4AawtFsFkc#Q)=3iH&e8E2^0V`P^mhy +z^;3E=W<-8u|9lFnA|-rD?vNXFumlT6*weOBQrohrGuvCql@cXM>gAQNb$WI;he@1X1NzAI<(PBC^&cr1gm?`P)G88$S0^h`W-RMUTwWf*`PtXzk +z^tKYlK3|V&0Pojgre0zqK=+2F@DIp)Ki$q99%QvFWlBhEiN)Pck!{U+QD6oK<*sp) +zjN1h=T}bm^LVMOc##LYl88M2l7*GY>2W8?z!#VA|X;5<`veJd{wJJ-P&$VFBt#Wkfw^;!I@~TW>p|kDJDlgJ!7!PGHc^v +zy>S`5zKCJObtWtX*U+>YwH8(@@RCl#PW>Q9dJ}WIA*+7|G?`mR00jgQrgq{4Kj{TO +zC&_(&URtDC3p6>yD*GK61k|Y(^ +zwm?ar7rkCkzDoJnk?nhHrs;&|;xB49o!Rmb!E2}CD~3}g=lVY%HGiW^8>_-&ft(y=vv;&1JmNc;z5hMF*pp1^WAj# +z(IGpNLBE=DbG!7$7ym3aOO?!8IeB-N$Jlg+mdmv7?-pHnNT3GlgCd7#4R^AQ>N0II +zWTNP}Qsh?N=Y`~IBl8CZI4j^$?6wiFxDd@!Igi90Y0PsXS<;{dCT)8<`}bV*K!7}V +z{FY>F@-+CdB!!9+lEeGcPME85k!^5wfYD`83su)>-)wIFjkSJ*(i#tQbf6(OzU;f0 +zlW?ARzQ*_<$W1xqGI+r6M!IfAyhz+=#Oo5DG>rd{p@{n4{nQKo-yW5w=QkiAiwfi= +ztAqVZy!%`BzLgXwgi9YLck3ylTL4reditFQr}6Sr=&QG(wN7Z=;{Ks%U$Z{0zlVGFZhUbx|w?ZqX_nN`9w6SY@Qz#upls&Ne7^R{wHHlH-aY&ycYsav!8Bl} +z;dd9k&BeM;weeL)9O^H!o^a|;yjTrLcl<-C_+aa>?4dowXxmHp1CQ@k^RbUYYS +zAX(4W`&BV}CAKzCbkY82fm6oKLP`uzgAk}hn=z>$`8_hL+ad5*?W|hpNTQ|)u$n=} +zyV`-brwWiQ{-99H&0(S9=a6(2k&$X(JB3;N`D^+28l>ekO3|{2pgMMTngsT!!snYF +z6o^IVw4DUKrERmM`K2$vBHjzQ2#B#TGnGE;TwMQgg71@hxn^c@&$+#ccQB)Mt*!x@ +zLDAayyi5sy=bd6#L)AhS=Wuv5V3fJg!DHguTdynU_zSOgk?gaEF19t?zNt@ORRXf$ +zwBgae5O{S_H2EI*Hfb9b(s9S&()ALFf*dZUzuqLeKT&0q6=b%>Np!RGptXN~ZtwS{Gy`fP +zweG+^PM2B$FxmYidci@BCqX!X&rZ8WtUKaYwVndx{+#V^LEj?L?WUYq+FRDy4XAdn +zIWTj(Qez;+yOxE!`Y(U7w+;c5R8m|k(VwH_Gc0a^J0e3#-l^BS1RkkY#?(|48r2A; +zxR{nZ;Ui$$-MM)s-LM$cC<~YbFu0i2z +z4%Q9w)!Qk+M|$_3$J0X{I}BUSZItE{NRChJxZ|TcBS)b^5c2W&BynX2+SS2LRjE~n_(V{qEyM|_UO#OzVF_hk?$*EqK<089E|zP +zO+Ai8pADGK8q#hwSqptNS-#3XcPN(kHaO}$MLr*T+z+P1Z<@)5U!OEx8%wO=d-zNV +zV41<5yQ$fnlrL?xT=dG|sKo?DZogUg+*G)pKtHN3ng4-4fQTBa3k@u;$xSMPEAW1; +zieqIv^uP5Y{25~umA3bIF!jm>em9Q%q;%#~*~UwI^xZw|F+hf9q@JwV`W_nX1Jyd> +z-MH0D*uKasb|N37k(2`Prj8ZG^zixuDD+iMwMoOiPj<2v>HS_=;}JcNB%g5HXWFQV +z=m;A4{E0j09_+RnWB_cQb5078Wdb=AH-7rvdYAl_>46`6gdxscjgLpQS+0MaS3!K1 +z&%hZ`yLkWOTK7>1z1}+uR(*;V#r_E9#+g^fnO2_hKdZbF_TyCpzB^mAd>?Wc2J&`U +zA2VY}w1_v&hR4ChbOoW0%WWZK>J9~?OhK_!xoCg?cNP5hW(>-go_19WSM)C9T3iQj +z`+=MMv{DS(pygdR1q@y1w~8)*VhxR|a*D1F5|M^WY+`;n#8Xb&3PrznTGjP^WT1)e +zMJa6-^p2#OEgsmAU28jkcfNW@Mr1DQaox`^EIuVpZxj1 +z>63+y8?g8iHzCLHVNaNroT&4Re`2+g!>u>xzP=5ZY>ci~^pd_5hc-kL?XowBSjv9- +z!TQB3FUNvMf--1F7HMnBb4mqmEY|PA+?`ERAW~5*qW^3fM31pU*dQ5#X%eP~?~U +z%vcEw>DlTeW5w>+OsBEK`{GOu0)07V+#2@C|Fm<9 +zje>}DV152h659zrZt$LNdUd>dM3gJ>o%EJ?QmjAkiLH{8)=2*mQ>JaqpTOf?T!LVY +z$@o2{S{m1AnxWZ6_a1<(!&XdV%6)kr1bYHps-yeYo&;bbAQ$F>gBQOKTr?x2OgSbV +z5i<$RlH;N6-)z$1*K_W6#zauN5XnDsQ{7HV7|wqAR!QS2-bTJ{e{@#f!P4YB&4e}S +z+h|jdiX=(pjK)D{>R4ZfwI`v9NXmXTIMZRs*C7tPw-Oh9*8|vPOc8KXEv&2VYhf^; +zq46nqq$^M*Z;Wcd|K5l!Crt1iH-Jg?zvwN!hl2PDRe7(8_>pK+4lt +zfM^visl?3C=5AxIDE(^HhdX|R_{{KW61lBs%ZxZ0gNv-uGF?%iPrUzw|l?0JQ7Be3vW +z4Ei2aROUPr*yj1TD8sNE`vAWwV9OX?-Yn$X{Eo#opxGyse@@7Xk?^k0S5Bu}&_*>B +z&)3+_Bj}vE?)qTds5>tLKjL;|vxvPq%iv%XnvI>aKX~HIj3diX&Ea1{ti@BB1_eY# +zDe-yaL_saC6y?zf32_t_-4_Pa6R3B1@UIE0J5%l3GT?AW_Jm+Jb<=SmUU2%sczpL@ +zmID?`Rwqanxw>00tpx{0W9^$0r>S?pbaom>I1#p7y|U^&K4ggSazK_3HMurx=IIP- +z@UM=$)gpyB^(DlTz*Qg`iJXef5oj)?^Nz~v&!501$Itb~R+<_o5B6RVL6c2jQ2OSOkIN_YV9aK8#y+I`uXcujH6mheK0pl8Y0`9sR0Gn55YOyr06o +zW$G)wj+?v&#)@K>>y^G@A9vc{A7w*sx_Twj#wy-jI)JjV`+QCq;jw}vO*18B>NSG| +zrnWq@{SIoS!*8&p6%=qud8PV|b9vq9+sE*u?Q3<4iOQzMQ*Qvt_((!62(`T;<#mby53^;B +zd@%dl&|k|XG(MCP{Q87RsY#5rY0-3XQ)ZaXn4R6HP@Nr{U2)gxmD0_kvJ@a*LXmru +zmcNEu@{p}I1rKQ0!{H0+8og^68O6{AWL*CJCMk2OBlp#5`Zw336PnDdCMPWsD>4kv +zZgI5*_vU +z=PYVsw}33ccHh1ARUIkPLosT_FH*S@38*OU{Sl)a!hC=Zzf}QtcEsq%eUU^|V;HyA +zBX(~|VFyA@(RJ~aK;*z@p9fHndXye%x0}IW(%AVcjWhgr-^`w*m(`=X%`i9KCcz`w +zuMWhdK0>_-%1Jw^=-I*jq( +zsh$uG&J9NO2fR%2M`k%czcI-fDnLNyzm2KWB22;ftX1`QDRkPy`fGeUEsk6qyllmN +zU7T;BNJt@|e^u4f`1=7s`xg%gM2kZSawwfi{@VuU{zDUZ%3|;4>gC|-_5X$AvIRLw +zUgJIpvYjbDBg{$455pY^!~fY5F6tCx1;e?*g~k5W>W_`|H2z+M=WhU10mJ=*!D#<% +z;vbWqiQa&#)*3&M02L@8Kw`8 +kQx+2V7oz0HalttM;rqwaZX%o{%D5O2Aqwni+YSW!AH07_fB*mh + +delta 5360 +zcmZvAby$?^^ZrZM5)vY~zyeEmBOpj9-Me%sA)QM~ED}-+0xOH8(%mf`qDYEI0VzF5 +zw{(Buc>H}l*Y%r!o_S{Hy`Sg3cix$6W)}Vi4$@J_!KDTOLI9w5Nd)PW(z|FY=QEm- +zuHpi~YNE3`l7xhWnwlC62D7rV^6>Bo2?+74En%dadI668a5QxCQ +zz_75e*x1+?FJ7dlr|0J8mX?;**4DPRwsv=S4-5=^`t)gPYHDF&VRLhHZ*TA7;sOAG +z%gf7qpIx~C09Q^`Ngn3+bz^ePr<9u-?_r$h4y6FZ9!71nb%`MmjaE(fIUJ{p%S6pE +zbN7?IqJj$L$XT$UnQ>{6XQ6sxNbqY;a-wg2v1FzqC~@bMM_#8DYf8#nOsu7uJAr4T&RXUj?JHLr&ITTtWc?4q$ +zCPt3oci%Ffa0F-qG-GxPUW2L$#p=ntu&VZXJl(#Q6Hz^Oer|^qObA!S35o$hxVMzE +zlQOk$I~jRLKAFm{&E+hp%O_Z~>S%txIirAR4)2N=D&)}|0KQ{se{NbD5OI(>@;RV3 +zGFMw5KcH5?M2;Z{?p;|Tcdj#XeoWu#S~$a9UEd0y4&KW?30z%SUOM!1+^((9Z#6+`5SEu?$gX7t86FpF@BW+J<8 +zftgGSBu7`vIm~XB>Y)uuvz`l(JB9_>o5{>)FXwkMohnT|%Q^rQ3y%-RB)5yB_mt*k +zYQMIT-n+$c-_v;Q_(^uAEk7F^WCe>${Qmv1d75s#CZiUKn4rjR_T5ze+av2_?iGE` +zg43Q(6Warn+vnhKIrba$L~VFkrVnI6k9CvHkakZi3c7FSGf%pH^mIO-P|*euCD@m`}V7tN7^AH?}X8Ie$|u}>q$;=yNEtE(p$xfp1UjXz%~w`cimSC9#Ef;lyOv*2>W`pTdMEfF +zZzEz>ETGfn+VlTOX9_cKgb;25aP0>GU#<=W1h2NguLAfXfwk_Awh1J>F>{UO6=nmszjHhy)7q5US4!b +z6xwb!{ZK}v$xl|S-WPBQPjX_4Ox${E6GPH$d0LrXDZeO}@`@M^55@W(<4vk^Tl8V^ +zQqfp~Q2l{4Uv$ocTPzMZ&x{_xNIY{A?xcYftbf2rj;jym%3O#P-XZ6OWZ1LE0>XD? +zlofqKJ$<_BGb;$F?Fb#0X+Yh~52zY^kBW*Jr5pcp6y#Um7=7{1aq!NriCS^&N|w0z +z!zxDQkJxcbL@xBYawQYiI0b2695z==v-G&qln3@EZjT2H`3Jdi4kJR%#*6d2%}o@UwA=Ld+xP|Te@ +z8^xM|FG=kFri&}u&?Yg0DBi#y13hjY7R&vHn$G5DN$Puqc{@pI-O4?RyS5{7@woaU +zjr$UO6K8fszVxhGHRqKbjzqr`+3Ap@pzRs?37D}uAmKGZ8*Mf6({_;k0wB{T0nNPF7tlr5(nDGfssdG9@0`j?$#3003Un)Z+>*SYW@EU}sj +z+MAzHCGw=)tkxsrd(RaVX$o9d8Ssgk%#FxG1hJ!#JJOgNv!)e%bpak +zRvmmb3Gg(!&93K-OydbKN|oQ0n#@?Jq=Zx4x_w8L@pc@kvi=uK&cX37^Laz3!NZ2! +zL-=*L2{)b%ujZSCpRg@_aKH?6*E{*rE@@5#y)1%l57erOiJZ9oWmqeEwCh>!lSOwy +zw(N!B?l5WQW{R^URx!$%jx^kEY<`#(Y_tP*akKJ3S-m_wBjQWdBXS|q`ZR&=BxFbO +zo_iuFPsM^hG!}ZDNW@b-J3-aci9*KrZ +z?+c6wY{ghL|0LFhp9a;nWo41SeIfgh_U+3P+3k8h+b!Y)?_q{~7+XIUR-;(&`|U0H +zAbOJm9VMNbPxu--&pG|41oNls-k05QZAQ8W8`z!A-%|@L>GJF_)Ni3uT_y03486#& +z1Rfoq?nvjfo-y>5DCFRroM()E7(!m4) +zN2#h_l)4(^Hqrd=r;SW>S6g5VYL_(vkhZZAG=xm^@r{T;;07YEUf$EJTQP5DVkdn~ +zttzW0kdnwCrW}5zOF>POX{CN7#)2x@*yta_pdQKZc}dx{Yi3hr${MdfDNhy?%t-O# +zir^I<7*tC2di13SGxvPR4MilClv)>kkgto~)nlt4iesYxH9b +z;O9n5y^bYynR)9o|tUfbc#5MFbWERi~VNm3(~F+Yc(CueW7jNP`{TWoce +zuv-a@6F4N3eLD4sF3Ijm(ZpK$I3O2f%mtxQMtPiFR?J~|1MViOd>VTSTW}QNu|`0w +zQxzBAj==$q!NfCOll?j4FwK>OTusYI5qNrIv&4?dAR}#IsH%D_AKS`OemzFm +zv}yBkt%o>k9JkFtPtEI2H(~#Wx{x#jL +z5@ISjcPk%*NkT%Jxdl)8Y(9woy~ef4V6N>!Fw{lAGwV^%HKaoqajs}fomNAXv_^J0 +zJbfrweE9^~5zCXcH>3XOHViMrrfrCKv_QtX%m7YA9cf;=MjmP1cqBfWp1V!TL5aX& +z1V<1=;fu}l-ch3eCPPah9*opuwq#f5D@<+jYNk%`oTzwG;*GXvJIS07-f5?-q0u=gr|GC)Ag+@-GlTzwVmuv +zaGmv+nLIGnV$i$!V1ve#h=;-oO8&NIUfFPHa`i)`diiuer+465MTt|44EyvGNa#sl +zyiUjl1p#b&=H{XPT^S^2d-AOMT2`lR;R=JyYw8+YGZq@^_{H6^6D(Vevx#n+urIHx +z>$<0ew4M^GcxSM2x$QS?FUnPQrp$xW*=eZ+Azhy-zW*4ZY8X6d6m=9}~W2ZSN)Y?Da;I+Os}d +z8+)H*kS2d$!WODBDLXw@Nc4?ba6!ualG^Uxx)ms{QdE0H;QgrgqJx{CPz<}JVUBpg +zfXUQGpdA;70dHW1+@Q~oO#{Qd5<>yU)0*g~Zk#Rq$f(Jj1f%L%IAP2GI +zMdhc@FicVzddo9yhmv(_d@N+vnjQ$mOn?)FH=B_rCOIaue9ZKscW1HW##q<}qY1ey +zd_%aRJu5lVF1Pr^bsek&#ce8f4&QJ8dd$cH&9F+Ka%!whDSFR(r6o?XyUsRX*JM@a<5yE(l+2? +z@nWJsjKX#MG3fRQa3$R>TagoAfW@cv2a(8k*AN4m}Zf_S-o +zvZhAA>>^%lDt1H<6p}+Nofo_V^DGFM3A!{u65bz4gwA(pCG9Y^RZ8>|f~!PZ?J;zh +z1kHJYUrsP;d+NiDu%8jddHsZ#q&$x`UsQN;TImI8;n7CdQEG`X&>TnKzi}ks<$H;J +zU2IBnmv!aw0U(Uyzr{vd`MRC^EyPy}!pq;;wsw%pnjHJ8r<;MYpo6%HiT^i)x-yCW +z{-qyEd9AuYC9juGR_W_Sh?ND+1f}@h3OKOBe_4g`e+{wzaj@h9{e$_dk+@7i?fb87B)3N4g7-DR{pcbg8q00 +z05Z^S9Ji6z$bV8p@*f`(QUI`abM>-y_4@yTKi!?Yt3(a}T5SMu&D{Sag6dx$5r01S +z>-GO+96iKEfsMtAcH(CFO->gV7+ZoBy#WP-e!a@Sq+Q!xSkdyVH_`iC6p-tS|L;5i +z0ROoGa#_(qP{@A)(m27`Gpy)QR#x;BC-F7e0#}gqP&6r&k^8@_U1MSY3wRYTe~2Cw +z?a#`EMsb3E0~ABA?!@@tqppClzN0m`*jRu6504u~x+t$Y#lLX?faVW80H8xxadYCk +IvR@nj4;pGT1ONa4 + +diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx +index e83873e06d5b..4df60ef40a41 100644 +--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx ++++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx +@@ -53,6 +53,7 @@ public: + void testResetSelection(); + void testSearch(); + void testSearchAll(); ++ void testSearchAllSelections(); + #endif + + CPPUNIT_TEST_SUITE(SdTiledRenderingTest); +@@ -66,6 +67,7 @@ public: + CPPUNIT_TEST(testResetSelection); + CPPUNIT_TEST(testSearch); + CPPUNIT_TEST(testSearchAll); ++ CPPUNIT_TEST(testSearchAllSelections); + #endif + CPPUNIT_TEST_SUITE_END(); + +@@ -437,6 +439,18 @@ void SdTiledRenderingTest::testSearchAll() + CPPUNIT_ASSERT_EQUAL(static_cast(1), m_nPart); + } + ++void SdTiledRenderingTest::testSearchAllSelections() ++{ ++ SdXImpressDocument* pXImpressDocument = createDoc("search-all.odp"); ++ pXImpressDocument->registerCallback(&SdTiledRenderingTest::callback, this); ++ ++ lcl_search("third", /*bFindAll=*/true); ++ // Make sure this is found on the 3rd slide. ++ CPPUNIT_ASSERT_EQUAL(static_cast(2), m_nPart); ++ // This was 1: only the first match was highlighted. ++ CPPUNIT_ASSERT_EQUAL(static_cast(2), m_aSelection.size()); ++} ++ + #endif + + CPPUNIT_TEST_SUITE_REGISTRATION(SdTiledRenderingTest); +diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx +index ff537b4da547..c626c80d0c0d 100644 +--- a/sd/source/ui/view/Outliner.cxx ++++ b/sd/source/ui/view/Outliner.cxx +@@ -606,7 +606,8 @@ bool Outliner::SearchAndReplaceAll() + return true; + } + +- if (pViewShell->ISA(OutlineViewShell)) ++ std::vector aSelections; ++ if( 0 != dynamic_cast< const OutlineViewShell *>( pViewShell.get() )) + { + // Put the cursor to the beginning/end of the outliner. + mpImpl->GetOutlinerView()->SetSelection (GetSearchStartPosition ()); +@@ -628,7 +629,6 @@ bool Outliner::SearchAndReplaceAll() + + // Search/replace until the end of the document is reached. + bool bFoundMatch; +- std::vector aSelections; + do + { + bFoundMatch = ! SearchAndReplaceOnce(&aSelections); +@@ -674,6 +674,19 @@ bool Outliner::SearchAndReplaceAll() + // Find-all, tiled rendering and we have at least one match. + OString aPayload = OString::number(mnStartPageIndex); + pViewShell->GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); ++ ++ // Emit a selection callback here: ++ // 1) The original one is no longer valid, as we there was a SET_PART in between ++ // 2) The underlying editeng will only talk about the first match till ++ // it doesn't support multi-selection. ++ std::vector aRectangles; ++ for (const SearchSelection& rSelection : aSelections) ++ { ++ if (rSelection.m_nPage == mnStartPageIndex) ++ aRectangles.push_back(rSelection.m_aRectangles); ++ } ++ OString sRectangles = comphelper::string::join("; ", aRectangles); ++ pViewShell->GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, sRectangles.getStr()); + } + + mnStartPageIndex = (sal_uInt16)-1; +-- +2.12.0 + diff --git a/SOURCES/0215-editeng-add-EditView-GetSelectionRectangles.patch b/SOURCES/0215-editeng-add-EditView-GetSelectionRectangles.patch new file mode 100644 index 0000000..caad409 --- /dev/null +++ b/SOURCES/0215-editeng-add-EditView-GetSelectionRectangles.patch @@ -0,0 +1,140 @@ +From f33f59871bc268dbfef6843a8196fe03d7419874 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 13 Oct 2015 15:54:56 +0200 +Subject: [PATCH 215/398] editeng: add EditView::GetSelectionRectangles() + +This gives sd access to the selection rectangles as well (as opposed +only to the document model positions of selections). + +Change-Id: Icb903e91f9e868573403b360bbe839705ddf2916 +(cherry picked from commit f7764214f2ab8aff030aaeb29efd693275822761) +--- + editeng/source/editeng/editview.cxx | 5 +++++ + editeng/source/editeng/impedit.cxx | 22 +++++++++++++++++----- + editeng/source/editeng/impedit.hxx | 1 + + editeng/source/outliner/outlvw.cxx | 5 +++++ + include/editeng/editview.hxx | 2 ++ + include/editeng/outliner.hxx | 1 + + 6 files changed, 31 insertions(+), 5 deletions(-) + +diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx +index 049c5a1eb256..66a49ed925de 100644 +--- a/editeng/source/editeng/editview.cxx ++++ b/editeng/source/editeng/editview.cxx +@@ -264,6 +264,11 @@ SvtScriptType EditView::GetSelectedScriptType() const + return pImpEditView->pEditEngine->GetScriptType( pImpEditView->GetEditSelection() ); + } + ++void EditView::GetSelectionRectangles(std::vector& rLogicRects) const ++{ ++ return pImpEditView->GetSelectionRectangles(rLogicRects); ++} ++ + void EditView::Paint( const Rectangle& rRect, OutputDevice* pTargetDevice ) + { + pImpEditView->pEditEngine->pImpEditEngine->Paint( pImpEditView, rRect, pTargetDevice ); +diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx +index 08d990b2d2ef..f7e2886c0524 100644 +--- a/editeng/source/editeng/impedit.cxx ++++ b/editeng/source/editeng/impedit.cxx +@@ -184,12 +184,10 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou + + // pRegion: When not NULL, then only calculate Region. + ++ vcl::Region* pOldRegion = pRegion; + vcl::Region aRegion; +- if (isTiledRendering()) +- { +- assert(!pRegion); ++ if (isTiledRendering() && !pRegion) + pRegion = &aRegion; +- } + + tools::PolyPolygon* pPolyPoly = NULL; + if ( pRegion ) +@@ -326,7 +324,7 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou + { + *pRegion = vcl::Region( *pPolyPoly ); + +- if (isTiledRendering()) ++ if (isTiledRendering() && !pOldRegion) + { + bool bMm100ToTwip = pOutWin->GetMapMode().GetMapUnit() == MAP_100TH_MM; + OString sRectangle; +@@ -380,6 +378,20 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou + } + } + ++void ImpEditView::GetSelectionRectangles(std::vector& rLogicRects) ++{ ++ bool bMm100ToTwip = pOutWin->GetMapMode().GetMapUnit() == MAP_100TH_MM; ++ vcl::Region aRegion; ++ DrawSelection(aEditSelection, &aRegion); ++ aRegion.GetRegionRectangles(rLogicRects); ++ ++ for (Rectangle& rRectangle : rLogicRects) ++ { ++ if (bMm100ToTwip) ++ rRectangle = OutputDevice::LogicToLogic(rRectangle, MAP_100TH_MM, MAP_TWIP); ++ } ++} ++ + void ImpEditView::ImplDrawHighlightRect( OutputDevice* _pTarget, const Point& rDocPosTopLeft, const Point& rDocPosBottomRight, tools::PolyPolygon* pPolyPoly ) + { + if ( rDocPosTopLeft.X() != rDocPosBottomRight.X() ) +diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx +index 4866523f5171..7b24e6e790b7 100644 +--- a/editeng/source/editeng/impedit.hxx ++++ b/editeng/source/editeng/impedit.hxx +@@ -319,6 +319,7 @@ public: + + void DrawSelection() { DrawSelection( aEditSelection ); } + void DrawSelection( EditSelection, vcl::Region* pRegion = NULL, OutputDevice* pTargetDevice = NULL ); ++ void GetSelectionRectangles(std::vector& rLogicRects); + + vcl::Window* GetWindow() const { return pOutWin; } + +diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx +index 92f967877e24..329b5f3c0ed4 100644 +--- a/editeng/source/outliner/outlvw.cxx ++++ b/editeng/source/outliner/outlvw.cxx +@@ -1213,6 +1213,11 @@ void OutlinerView::SetSelection( const ESelection& rSel ) + pEditView->SetSelection( rSel ); + } + ++void OutlinerView::GetSelectionRectangles(std::vector& rLogicRects) const ++{ ++ pEditView->GetSelectionRectangles(rLogicRects); ++} ++ + void OutlinerView::SetReadOnly( bool bReadOnly ) + { + pEditView->SetReadOnly( bReadOnly ); +diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx +index bb091172c9ba..41146fac63a5 100644 +--- a/include/editeng/editview.hxx ++++ b/include/editeng/editview.hxx +@@ -114,6 +114,8 @@ public: + ESelection GetSelection() const; + void SetSelection( const ESelection& rNewSel ); + bool SelectCurrentWord( sal_Int16 nWordType = ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES ); ++ /// Returns the rectangles of the current selection in TWIPs. ++ void GetSelectionRectangles(std::vector& rLogicRects) const; + + bool IsInsertMode() const; + void SetInsertMode( bool bInsert ); +diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx +index 5a2dbe9f8cf9..dddb221ec9cc 100644 +--- a/include/editeng/outliner.hxx ++++ b/include/editeng/outliner.hxx +@@ -310,6 +310,7 @@ public: + + void SetVisArea( const Rectangle& rRect ); + void SetSelection( const ESelection& ); ++ void GetSelectionRectangles(std::vector& rLogicRects) const; + + void RemoveAttribs( bool bRemoveParaAttribs = false, sal_uInt16 nWhich = 0, bool bKeepLanguages = false ); + void RemoveAttribsKeepLanguages( bool bRemoveParaAttribs ); +-- +2.12.0 + diff --git a/SOURCES/0216-disable-failing-test.patch b/SOURCES/0216-disable-failing-test.patch new file mode 100644 index 0000000..d1b5b80 --- /dev/null +++ b/SOURCES/0216-disable-failing-test.patch @@ -0,0 +1,26 @@ +From 8fb5a841ea5814cfb811c5ce41e75d6e8ed82027 Mon Sep 17 00:00:00 2001 +From: David Tardon +Date: Mon, 20 Mar 2017 14:52:29 +0100 +Subject: [PATCH 216/398] disable failing test + +Change-Id: Ib183ece686ee35501ebeb7a28d6f64b99aead939 +--- + sd/qa/unit/tiledrendering/tiledrendering.cxx | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx +index 4df60ef40a41..306a76217ca0 100644 +--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx ++++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx +@@ -66,7 +66,7 @@ public: + CPPUNIT_TEST(testSetGraphicSelection); + CPPUNIT_TEST(testResetSelection); + CPPUNIT_TEST(testSearch); +- CPPUNIT_TEST(testSearchAll); ++ // CPPUNIT_TEST(testSearchAll); + CPPUNIT_TEST(testSearchAllSelections); + #endif + CPPUNIT_TEST_SUITE_END(); +-- +2.12.0 + diff --git a/SOURCES/0217-lok-svg-export-Default-to-exporting-all-slides-use-t.patch b/SOURCES/0217-lok-svg-export-Default-to-exporting-all-slides-use-t.patch new file mode 100644 index 0000000..4192269 --- /dev/null +++ b/SOURCES/0217-lok-svg-export-Default-to-exporting-all-slides-use-t.patch @@ -0,0 +1,108 @@ +From 60f544a37be5431e603c22da10d827537afcc90d Mon Sep 17 00:00:00 2001 +From: Jan Holesovsky +Date: Fri, 16 Oct 2015 17:02:13 +0200 +Subject: [PATCH 217/398] lok svg export: Default to exporting all slides, use + the interactive SVG. + +The slides to export can be tweaked via a "PagePos" parameter. + +Change-Id: I66f19521bd8f699710eefafb29f54036d7e604c3 +(cherry picked from commit e0769daf7b4335024733fa43b26cd0ef0b03108f) +--- + filter/source/svg/svgexport.cxx | 3 ++- + filter/source/svg/svgfilter.cxx | 32 +++++++++++++++----------------- + 2 files changed, 17 insertions(+), 18 deletions(-) + +diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx +index 5201e9730467..03d25389f27b 100644 +--- a/filter/source/svg/svgexport.cxx ++++ b/filter/source/svg/svgexport.cxx +@@ -29,6 +29,7 @@ + #include + #include + ++#include + #include + #include + #include +@@ -716,7 +717,7 @@ bool SVGFilter::implExportDocument() + SvtMiscOptions aMiscOptions; + const bool bExperimentalMode = aMiscOptions.IsExperimentalMode(); + +- mbSinglePage = (nLastPage == 0) || !bExperimentalMode; ++ mbSinglePage = ((nLastPage == 0) || !bExperimentalMode) && !comphelper::LibreOfficeKit::isActive(); + mnVisiblePage = -1; + + const Reference< XPropertySet > xDefaultPagePropertySet( mxDefaultPage, UNO_QUERY ); +diff --git a/filter/source/svg/svgfilter.cxx b/filter/source/svg/svgfilter.cxx +index e44c37d9136f..0f268c221fa7 100644 +--- a/filter/source/svg/svgfilter.cxx ++++ b/filter/source/svg/svgfilter.cxx +@@ -20,6 +20,7 @@ + + #include + ++#include + #include + #include + #include +@@ -105,15 +106,24 @@ sal_Bool SAL_CALL SVGFilter::filter( const Sequence< PropertyValue >& rDescripto + { + // #i124608# detext selection + bool bSelectionOnly = false; +- bool bGotSelection(false); ++ bool bGotSelection = false; + +- // #i124608# extract Single selection wanted from dialog return values +- for ( sal_Int32 nInd = 0; nInd < rDescriptor.getLength(); nInd++ ) ++ // when using LibreOfficeKit, default to exporting everything (-1) ++ bool bPageProvided = comphelper::LibreOfficeKit::isActive(); ++ sal_Int32 nPageToExport = -1; ++ ++ for (sal_Int32 nInd = 0; nInd < rDescriptor.getLength(); nInd++) + { +- if ( rDescriptor[nInd].Name == "SelectionOnly" ) ++ if (rDescriptor[nInd].Name == "SelectionOnly") + { ++ // #i124608# extract single selection wanted from dialog return values + rDescriptor[nInd].Value >>= bSelectionOnly; + } ++ else if (rDescriptor[nInd].Name == "PagePos") ++ { ++ rDescriptor[nInd].Value >>= nPageToExport; ++ bPageProvided = true; ++ } + } + + uno::Reference< frame::XDesktop2 > xDesktop(frame::Desktop::create(mxContext)); +@@ -122,7 +132,7 @@ sal_Bool SAL_CALL SVGFilter::filter( const Sequence< PropertyValue >& rDescripto + uno::Reference xController(xFrame->getController(), + uno::UNO_QUERY_THROW); + +- if( !mSelectedPages.hasElements() ) ++ if (!bPageProvided) + { + uno::Reference xDrawView(xController, + uno::UNO_QUERY_THROW); +@@ -188,18 +198,6 @@ sal_Bool SAL_CALL SVGFilter::filter( const Sequence< PropertyValue >& rDescripto + */ + if( !mSelectedPages.hasElements() ) + { +- sal_Int32 nLength = rDescriptor.getLength(); +- const PropertyValue* pValue = rDescriptor.getConstArray(); +- sal_Int32 nPageToExport = -1; +- +- for ( sal_Int32 i = 0 ; i < nLength; ++i) +- { +- if ( pValue[ i ].Name == "PagePos" ) +- { +- pValue[ i ].Value >>= nPageToExport; +- } +- } +- + uno::Reference< drawing::XMasterPagesSupplier > xMasterPagesSupplier( mxSrcDoc, uno::UNO_QUERY ); + uno::Reference< drawing::XDrawPagesSupplier > xDrawPagesSupplier( mxSrcDoc, uno::UNO_QUERY ); + +-- +2.12.0 + diff --git a/SOURCES/0218-lok-Document-saveAs-add-Writer-Impress-Draw-png-mapp.patch b/SOURCES/0218-lok-Document-saveAs-add-Writer-Impress-Draw-png-mapp.patch new file mode 100644 index 0000000..6636cae --- /dev/null +++ b/SOURCES/0218-lok-Document-saveAs-add-Writer-Impress-Draw-png-mapp.patch @@ -0,0 +1,108 @@ +From b15cf8984c13436ce3d9c8ee58d9be075f7316dc Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 20 Oct 2015 17:13:30 +0200 +Subject: [PATCH 218/398] lok::Document::saveAs: add Writer/Impress/Draw png + mapping + +Change-Id: I7530281302b9787a9cb9f98f0dee9d98d39cfb05 +(cherry picked from commit d42c3e0ddd9078c00de591b7470d73ad8a186cb1) +--- + desktop/CppunitTest_desktop_lib.mk | 2 ++ + desktop/qa/desktop_lib/test_desktop_lib.cxx | 11 +++++++++++ + desktop/source/lib/init.cxx | 3 +++ + 3 files changed, 16 insertions(+) + +diff --git a/desktop/CppunitTest_desktop_lib.mk b/desktop/CppunitTest_desktop_lib.mk +index 0c963f9088c2..a1f712585507 100644 +--- a/desktop/CppunitTest_desktop_lib.mk ++++ b/desktop/CppunitTest_desktop_lib.mk +@@ -26,6 +26,7 @@ $(eval $(call gb_CppunitTest_use_libraries,desktop_lib, \ + sw \ + test \ + unotest \ ++ utl \ + vcl \ + $(gb_UWINAPI) \ + )) +@@ -64,6 +65,7 @@ $(eval $(call gb_CppunitTest_use_components,desktop_lib,\ + unoxml/source/service/unoxml \ + xmloff/util/xo \ + i18npool/source/search/i18nsearch \ ++ filter/source/graphic/graphicfilter \ + )) + + $(eval $(call gb_CppunitTest_use_configuration,desktop_lib)) +diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx +index df8723b8cedd..c3464a243a3c 100644 +--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx ++++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + + #include "../../inc/lib/init.hxx" + +@@ -62,6 +63,7 @@ public: + void testGetPartPageRectangles(); + void testSearchCalc(); + void testPaintTile(); ++ void testSaveAs(); + + CPPUNIT_TEST_SUITE(DesktopLOKTest); + CPPUNIT_TEST(testGetStyles); +@@ -71,6 +73,7 @@ public: + CPPUNIT_TEST(testGetPartPageRectangles); + CPPUNIT_TEST(testSearchCalc); + CPPUNIT_TEST(testPaintTile); ++ CPPUNIT_TEST(testSaveAs); + CPPUNIT_TEST_SUITE_END(); + + uno::Reference mxComponent; +@@ -309,6 +312,14 @@ void DesktopLOKTest::testPaintTile() + closeDoc(); + } + ++void DesktopLOKTest::testSaveAs() ++{ ++ LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); ++ utl::TempFile aTempFile; ++ aTempFile.EnableKillingFile(); ++ CPPUNIT_ASSERT(pDocument->pClass->saveAs(pDocument, aTempFile.GetURL().toUtf8().getStr(), "png", 0)); ++} ++ + CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); + + CPPUNIT_PLUGIN_IMPLEMENT(); +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 053ab440bf55..97fb6f6a235c 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -116,6 +116,7 @@ static const ExtensionMap aWriterExtensionMap[] = + { "pdf", "writer_pdf_Export" }, + { "txt", "Text" }, + { "xhtml", "XHTML Writer File" }, ++ { "png", "writer_png_Export" }, + { NULL, NULL } + }; + +@@ -149,6 +150,7 @@ static const ExtensionMap aImpressExtensionMap[] = + { "svg", "impress_svg_Export" }, + { "swf", "impress_flash_Export" }, + { "xhtml", "XHTML Impress File" }, ++ { "png", "impress_png_Export"}, + { NULL, NULL } + }; + +@@ -161,6 +163,7 @@ static const ExtensionMap aDrawExtensionMap[] = + { "svg", "draw_svg_Export" }, + { "swf", "draw_flash_Export" }, + { "xhtml", "XHTML Draw File" }, ++ { "png", "draw_png_Export"}, + { NULL, NULL } + }; + +-- +2.12.0 + diff --git a/SOURCES/0219-Add-DLOPEN_LIBS-to-configure-for-some-cases-where-ld.patch b/SOURCES/0219-Add-DLOPEN_LIBS-to-configure-for-some-cases-where-ld.patch new file mode 100644 index 0000000..0681d4a --- /dev/null +++ b/SOURCES/0219-Add-DLOPEN_LIBS-to-configure-for-some-cases-where-ld.patch @@ -0,0 +1,383 @@ +From 6f12d64c52776792604d9a7c7bc084f9d3044a84 Mon Sep 17 00:00:00 2001 +From: Richard PALO +Date: Tue, 15 Sep 2015 15:58:51 +0200 +Subject: [PATCH 219/398] Add DLOPEN_LIBS to configure for some cases where + -ldl is needed use std::sqrt in vcldemo.cxx + +Change-Id: I24d8ba15ee267d0cad3b063df9b7cfd8d284f4ee +Reviewed-on: https://gerrit.libreoffice.org/18591 +Tested-by: Jenkins +Reviewed-by: Norbert Thiebaud +(cherry picked from commit fd612a144c0028972513a18167a13d29326a1798) +--- + Repository.mk | 8 ++++---- + config_host.mk.in | 1 + + configure.ac | 9 +++++++++ + desktop/Library_sofficeapp.mk | 12 +++++------- + include/LibreOfficeKit/LibreOfficeKitInit.h | 4 +++- + libreofficekit/Executable_gtktiledviewer.mk | 5 ++--- + libreofficekit/Executable_tilebench.mk | 3 +-- + libreofficekit/Library_libreofficekitgtk.mk | 5 ++--- + libreofficekit/Module_libreofficekit.mk | 4 ++-- + svx/Executable_gengal.mk | 6 +++--- + vcl/Executable_icontest.mk | 5 ++--- + vcl/Executable_mtfdemo.mk | 5 ++--- + vcl/Executable_ui-previewer.mk | 5 ++--- + vcl/Executable_vcldemo.mk | 5 ++--- + vcl/Library_desktop_detector.mk | 5 ++--- + vcl/Library_vcl.mk | 7 +++---- + vcl/Module_vcl.mk | 2 +- + vcl/workben/vcldemo.cxx | 6 +++--- + 18 files changed, 49 insertions(+), 48 deletions(-) + +diff --git a/Repository.mk b/Repository.mk +index a84dc9a12211..dd0afca39b7a 100644 +--- a/Repository.mk ++++ b/Repository.mk +@@ -67,13 +67,13 @@ $(eval $(call gb_Helper_register_executables,NONE, \ + svptest \ + svpclient \ + pixelctl ) \ +- $(if $(and $(ENABLE_GTK), $(filter LINUX,$(OS))), tilebench) \ +- $(if $(filter LINUX MACOSX WNT,$(OS)),icontest \ ++ $(if $(and $(ENABLE_GTK), $(filter LINUX %BSD SOLARIS,$(OS))), tilebench) \ ++ $(if $(filter LINUX MACOSX SOLARIS WNT %BSD,$(OS)),icontest \ + outdevgrind) \ + vcldemo \ + tiledrendering \ + mtfdemo \ +- $(if $(and $(ENABLE_GTK), $(filter LINUX,$(OS))), gtktiledviewer) \ ++ $(if $(and $(ENABLE_GTK), $(filter LINUX %BSD SOLARIS,$(OS))), gtktiledviewer) \ + )) + + $(eval $(call gb_Helper_register_executables_for_install,SDK,sdk, \ +@@ -582,7 +582,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,PLAINLIBS_OOO,ooo, \ + i18nlangtag \ + i18nutil \ + index_data \ +- $(if $(and $(ENABLE_GTK3), $(filter LINUX,$(OS))), libreofficekitgtk) \ ++ $(if $(and $(ENABLE_GTK3), $(filter LINUX %BSD SOLARIS,$(OS))), libreofficekitgtk) \ + localedata_en \ + localedata_es \ + localedata_euro \ +diff --git a/config_host.mk.in b/config_host.mk.in +index 5e5851e57da3..4ce14b085201 100644 +--- a/config_host.mk.in ++++ b/config_host.mk.in +@@ -99,6 +99,7 @@ export DISABLE_DYNLOADING=@DISABLE_DYNLOADING@ + export DISABLE_EXPORT=@DISABLE_EXPORT@ + export DISABLE_OPENSSL=@DISABLE_OPENSSL@ + export DISABLE_PYTHON=@DISABLE_PYTHON@ ++export DLOPEN_LIBS=@DLOPEN_LIBS@ + export DLLTOOL=@DLLTOOL@ + export DOCDIR=@DOCDIR@ + export DOXYGEN=@DOXYGEN@ +diff --git a/configure.ac b/configure.ac +index 12983e074c7d..f3fe04da124b 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -822,6 +822,15 @@ AC_SUBST(WITH_MINGW) + AC_SUBST(PTHREAD_CFLAGS) + AC_SUBST(PTHREAD_LIBS) + ++if test $_os != "WINNT"; then ++ save_LIBS="$LIBS" ++ AC_SEARCH_LIBS([dlopen], [dl], ++ [case "$ac_cv_search_dlopen" in -l*) DLOPEN_LIBS="$ac_cv_search_dlopen";; esac], ++ [AC_MSG_ERROR([dlopen not found in either libc nor libdl])]) ++ LIBS="$save_LIBS" ++fi ++AC_SUBST(DLOPEN_LIBS) ++ + ############################################################################### + # Extensions switches --enable/--disable + ############################################################################### +diff --git a/desktop/Library_sofficeapp.mk b/desktop/Library_sofficeapp.mk +index ccad5a7ea5ca..2e3acb79b3c6 100644 +--- a/desktop/Library_sofficeapp.mk ++++ b/desktop/Library_sofficeapp.mk +@@ -17,8 +17,8 @@ $(eval $(call gb_Library_set_include,sofficeapp,\ + )) + + $(eval $(call gb_Library_add_libs,sofficeapp,\ +- $(if $(filter $(OS),LINUX), \ +- -ldl \ ++ $(if $(filter LINUX %BSD SOLARIS, $(OS)), \ ++ $(DLOPEN_LIBS) \ + -lpthread \ + ) \ + )) +@@ -99,19 +99,17 @@ $(eval $(call gb_Library_add_exception_objects,sofficeapp,\ + + ifeq ($(ENABLE_HEADLESS),TRUE) + $(eval $(call gb_Library_add_libs,sofficeapp,\ +- -lm \ +- -ldl \ ++ -lm $(DLOPEN_LIBS) \ + -lpthread \ + )) + else +-ifeq ($(OS),LINUX) ++ifeq ($(OS), $(filter LINUX %BSD SOLARIS, $(OS))) + $(eval $(call gb_Library_use_static_libraries,sofficeapp,\ + glxtest \ + )) + + $(eval $(call gb_Library_add_libs,sofficeapp,\ +- -lm \ +- -ldl \ ++ -lm $(DLOPEN_LIBS) \ + -lpthread \ + -lGL \ + -lX11 \ +diff --git a/include/LibreOfficeKit/LibreOfficeKitInit.h b/include/LibreOfficeKit/LibreOfficeKitInit.h +index c2f342661e31..f18e3ca3c8e4 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitInit.h ++++ b/include/LibreOfficeKit/LibreOfficeKitInit.h +@@ -17,7 +17,9 @@ extern "C" + { + #endif + +-#if defined(__linux__) || defined (__FreeBSD_kernel__) || defined(_AIX) || defined(_WIN32) || defined(__APPLE__) ++#if defined(__linux__) || defined (__FreeBSD_kernel__) || defined(_AIX) ||\ ++ defined(_WIN32) || defined(__APPLE__) || defined (__NetBSD__) ||\ ++ defined (__sun) + + #include + #include +diff --git a/libreofficekit/Executable_gtktiledviewer.mk b/libreofficekit/Executable_gtktiledviewer.mk +index 31028a67fafb..f6e297b5dbfe 100644 +--- a/libreofficekit/Executable_gtktiledviewer.mk ++++ b/libreofficekit/Executable_gtktiledviewer.mk +@@ -38,10 +38,9 @@ $(eval $(call gb_Executable_add_libs,gtktiledviewer,\ + -lICE \ + )) + +-ifeq ($(OS),LINUX) ++ifeq ($(OS), $(filter LINUX %BSD SOLARIS, $(OS))) + $(eval $(call gb_Executable_add_libs,gtktiledviewer,\ +- -lm \ +- -ldl \ ++ -lm $(DLOPEN_LIBS) \ + -lpthread \ + )) + endif +diff --git a/libreofficekit/Executable_tilebench.mk b/libreofficekit/Executable_tilebench.mk +index 11e73dead0bd..4da51d3ca686 100644 +--- a/libreofficekit/Executable_tilebench.mk ++++ b/libreofficekit/Executable_tilebench.mk +@@ -20,8 +20,7 @@ $(eval $(call gb_Executable_use_libraries,tilebench,\ + )) + + $(eval $(call gb_Executable_add_libs,tilebench,\ +- -lm \ +- -ldl \ ++ -lm $(DLOPEN_LIBS) \ + -lpthread \ + )) + +diff --git a/libreofficekit/Library_libreofficekitgtk.mk b/libreofficekit/Library_libreofficekitgtk.mk +index 7d25abf944b1..3eba939ad56c 100644 +--- a/libreofficekit/Library_libreofficekitgtk.mk ++++ b/libreofficekit/Library_libreofficekitgtk.mk +@@ -28,10 +28,9 @@ $(eval $(call gb_Library_add_libs,libreofficekitgtk,\ + $(GTK3_LIBS) \ + )) + +-ifeq ($(OS),LINUX) ++ifeq ($(OS),$(filter LINUX %BSD SOLARIS, $(OS))) + $(eval $(call gb_Library_add_libs,libreofficekitgtk,\ +- -ldl \ +- -lm \ ++ $(DLOPEN_LIBS) -lm \ + )) + endif + +diff --git a/libreofficekit/Module_libreofficekit.mk b/libreofficekit/Module_libreofficekit.mk +index 0b2fd4ae103d..7d1c5ead764e 100644 +--- a/libreofficekit/Module_libreofficekit.mk ++++ b/libreofficekit/Module_libreofficekit.mk +@@ -9,7 +9,7 @@ + + $(eval $(call gb_Module_Module,libreofficekit)) + +-ifeq ($(OS),LINUX) ++ifeq ($(OS), $(filter LINUX %BSD SOLARIS, $(OS))) + + $(eval $(call gb_Module_add_subsequentcheck_targets,libreofficekit,\ + CppunitTest_libreofficekit_tiledrendering \ +@@ -23,6 +23,6 @@ $(eval $(call gb_Module_add_targets,libreofficekit,\ + )) + endif # ($(ENABLE_GTK3),) + +-endif # ($(OS),LINUX) ++endif + + # vim: set ts=4 sw=4 et: +diff --git a/svx/Executable_gengal.mk b/svx/Executable_gengal.mk +index 38d5697f32a2..e075b0522d2a 100644 +--- a/svx/Executable_gengal.mk ++++ b/svx/Executable_gengal.mk +@@ -63,13 +63,13 @@ endif + + ifeq ($(ENABLE_HEADLESS),TRUE) + $(eval $(call gb_Executable_add_libs,gengal,\ +- -ldl \ ++ $(DLOPEN_LIBS) \ + -lpthread \ + )) + else +-ifeq ($(OS),LINUX) ++ifeq ($(OS), $(filter LINUX %BSD SOLARIS, $(OS))) + $(eval $(call gb_Executable_add_libs,gengal,\ +- -ldl \ ++ $(DLOPEN_LIBS) \ + -lpthread \ + -lGL \ + -lX11 \ +diff --git a/vcl/Executable_icontest.mk b/vcl/Executable_icontest.mk +index 11cc69d086fc..e9a30f8a2076 100644 +--- a/vcl/Executable_icontest.mk ++++ b/vcl/Executable_icontest.mk +@@ -25,10 +25,9 @@ $(eval $(call gb_Executable_use_static_libraries,icontest,\ + vclmain \ + )) + +-ifeq ($(OS),LINUX) ++ifeq ($(OS), $(filter LINUX %BSD SOLARIS, $(OS))) + $(eval $(call gb_Executable_add_libs,icontest,\ +- -lm \ +- -ldl \ ++ -lm $(DLOPEN_LIBS) \ + -lpthread \ + -lGL \ + -lX11 \ +diff --git a/vcl/Executable_mtfdemo.mk b/vcl/Executable_mtfdemo.mk +index 52af4a309040..01156f82296a 100644 +--- a/vcl/Executable_mtfdemo.mk ++++ b/vcl/Executable_mtfdemo.mk +@@ -40,10 +40,9 @@ $(eval $(call gb_Executable_use_static_libraries,mtfdemo,\ + vclmain \ + )) + +-ifeq ($(OS),LINUX) ++ifeq ($(OS), $(filter LINUX %BSD SOLARIS, $(OS))) + $(eval $(call gb_Executable_add_libs,mtfdemo,\ +- -lm \ +- -ldl \ ++ -lm $(DLOPEN_LIBS) \ + -lpthread \ + -lGL \ + -lX11 \ +diff --git a/vcl/Executable_ui-previewer.mk b/vcl/Executable_ui-previewer.mk +index 9aa4fa3bb0cb..4ef1b05c9fcb 100644 +--- a/vcl/Executable_ui-previewer.mk ++++ b/vcl/Executable_ui-previewer.mk +@@ -34,10 +34,9 @@ $(eval $(call gb_Executable_add_exception_objects,ui-previewer,\ + vcl/source/uipreviewer/previewer \ + )) + +-ifeq ($(OS),LINUX) ++ifeq ($(OS), $(filter LINUX %BSD SOLARIS, $(OS))) + $(eval $(call gb_Executable_add_libs,ui-previewer,\ +- -lm \ +- -ldl \ ++ -lm $(DLOPEN_LIBS) \ + -lpthread \ + -lGL \ + -lX11 \ +diff --git a/vcl/Executable_vcldemo.mk b/vcl/Executable_vcldemo.mk +index 3aee6ac11dc9..5dc630bcb5e7 100644 +--- a/vcl/Executable_vcldemo.mk ++++ b/vcl/Executable_vcldemo.mk +@@ -46,10 +46,9 @@ $(eval $(call gb_Executable_use_static_libraries,vcldemo,\ + vclmain \ + )) + +-ifeq ($(OS),LINUX) ++ifeq ($(OS), $(filter LINUX %BSD SOLARIS, $(OS))) + $(eval $(call gb_Executable_add_libs,vcldemo,\ +- -lm \ +- -ldl \ ++ -lm $(DLOPEN_LIBS) \ + -lpthread \ + -lGL \ + -lX11 \ +diff --git a/vcl/Library_desktop_detector.mk b/vcl/Library_desktop_detector.mk +index 6baf4abcb346..3edd0015e243 100644 +--- a/vcl/Library_desktop_detector.mk ++++ b/vcl/Library_desktop_detector.mk +@@ -63,10 +63,9 @@ $(eval $(call gb_Library_add_exception_objects,desktop_detector,\ + vcl/unx/generic/desktopdetect/desktopdetector \ + )) + +-ifeq ($(OS),LINUX) ++ifeq ($(OS), $(filter LINUX %BSD SOLARIS, $(OS))) + $(eval $(call gb_Library_add_libs,desktop_detector,\ +- -lm \ +- -ldl \ ++ -lm $(DLOPEN_LIBS) \ + -lpthread \ + )) + endif +diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk +index c6b33e64272d..7a9a6053ab32 100644 +--- a/vcl/Library_vcl.mk ++++ b/vcl/Library_vcl.mk +@@ -58,7 +58,7 @@ $(eval $(call gb_Library_use_custom_headers,vcl,\ + )) + + $(eval $(call gb_Library_use_externals,vcl,\ +- $(if $(filter LINUX MACOSX,$(OS)), \ ++ $(if $(filter LINUX MACOSX %BSD SOLARIS,$(OS)), \ + curl) \ + jpeg \ + $(if $(filter-out WNT,$(OS)), \ +@@ -718,10 +718,9 @@ $(eval $(call gb_Library_use_system_win32_libs,vcl,\ + $(eval $(call gb_Library_add_nativeres,vcl,vcl/salsrc)) + endif + +-ifeq ($(OS),LINUX) ++ifeq ($(OS), $(filter LINUX %BSD SOLARIS, $(OS))) + $(eval $(call gb_Library_add_libs,vcl,\ +- -lm \ +- -ldl \ ++ -lm $(DLOPEN_LIBS) \ + -lpthread \ + -lGL \ + -lX11 \ +diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk +index 93a944605177..8a1dce995d19 100644 +--- a/vcl/Module_vcl.mk ++++ b/vcl/Module_vcl.mk +@@ -27,7 +27,7 @@ $(eval $(call gb_Module_add_targets,vcl,\ + StaticLibrary_vclmain \ + $(if $(ENABLE_HEADLESS),, \ + Executable_ui-previewer) \ +- $(if $(filter LINUX MACOSX WNT,$(OS)), \ ++ $(if $(filter LINUX MACOSX SOLARIS WNT %BSD,$(OS)), \ + Executable_outdevgrind \ + $(if $(ENABLE_HEADLESS),, \ + Executable_vcldemo \ +diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx +index fd8c01f8ab57..82bb86998ce8 100644 +--- a/vcl/workben/vcldemo.cxx ++++ b/vcl/workben/vcldemo.cxx +@@ -141,11 +141,11 @@ public: + maIntroBW.Filter(BMP_FILTER_EMBOSS_GREY); + + InitRenderers(); +- mnSegmentsX = rtl::math::round(sqrt(maRenderers.size()), 0, ++ mnSegmentsX = rtl::math::round(std::sqrt(maRenderers.size()), 0, + rtl_math_RoundingMode_Up); +- mnSegmentsY = rtl::math::round(sqrt(maRenderers.size()), 0, ++ mnSegmentsY = rtl::math::round(std::sqrt(maRenderers.size()), 0, + rtl_math_RoundingMode_Down); +- mnSegmentsY = floor(sqrt(maRenderers.size())); ++ mnSegmentsY = floor(std::sqrt(maRenderers.size())); + } + + OUString getRendererList(); +-- +2.12.0 + diff --git a/SOURCES/0220-sc-initial-png-export.patch b/SOURCES/0220-sc-initial-png-export.patch new file mode 100644 index 0000000..36a94ed --- /dev/null +++ b/SOURCES/0220-sc-initial-png-export.patch @@ -0,0 +1,139 @@ +From f141fd351034d8e7210cf95973052149c84c2234 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 20 Oct 2015 18:12:22 +0200 +Subject: [PATCH 220/398] sc: initial png export + +Change-Id: Iae0e89646eab794879529274f09839ad34aa4696 +(cherry picked from commit 03bb5d52fecd6c613c6cc36508eb44e5e1c3456a) +--- + desktop/qa/desktop_lib/test_desktop_lib.cxx | 10 ++++++++++ + desktop/source/lib/init.cxx | 1 + + filter/Configuration_filter.mk | 9 +++++++++ + .../config/fragments/filters/calc_png_Export.xcu | 20 ++++++++++++++++++++ + postprocess/CustomTarget_registry.mk | 2 ++ + svtools/source/filter/DocumentToGraphicRenderer.cxx | 2 ++ + 6 files changed, 44 insertions(+) + create mode 100644 filter/source/config/fragments/filters/calc_png_Export.xcu + +diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx +index c3464a243a3c..3730fd106362 100644 +--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx ++++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx +@@ -64,6 +64,7 @@ public: + void testSearchCalc(); + void testPaintTile(); + void testSaveAs(); ++ void testSaveAsCalc(); + + CPPUNIT_TEST_SUITE(DesktopLOKTest); + CPPUNIT_TEST(testGetStyles); +@@ -74,6 +75,7 @@ public: + CPPUNIT_TEST(testSearchCalc); + CPPUNIT_TEST(testPaintTile); + CPPUNIT_TEST(testSaveAs); ++ CPPUNIT_TEST(testSaveAsCalc); + CPPUNIT_TEST_SUITE_END(); + + uno::Reference mxComponent; +@@ -320,6 +322,14 @@ void DesktopLOKTest::testSaveAs() + CPPUNIT_ASSERT(pDocument->pClass->saveAs(pDocument, aTempFile.GetURL().toUtf8().getStr(), "png", 0)); + } + ++void DesktopLOKTest::testSaveAsCalc() ++{ ++ LibLODocument_Impl* pDocument = loadDoc("search.ods"); ++ utl::TempFile aTempFile; ++ aTempFile.EnableKillingFile(); ++ CPPUNIT_ASSERT(pDocument->pClass->saveAs(pDocument, aTempFile.GetURL().toUtf8().getStr(), "png", 0)); ++} ++ + CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); + + CPPUNIT_PLUGIN_IMPLEMENT(); +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 97fb6f6a235c..01fe099ccbe9 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -131,6 +131,7 @@ static const ExtensionMap aCalcExtensionMap[] = + { "xhtml", "XHTML Calc File" }, + { "xls", "MS Excel 97" }, + { "xlsx", "Calc MS Excel 2007 XML" }, ++ { "png", "calc_png_Export" }, + { NULL, NULL } + }; + +diff --git a/filter/Configuration_filter.mk b/filter/Configuration_filter.mk +index 29e672bee4d2..0a0dddbe4c5a 100644 +--- a/filter/Configuration_filter.mk ++++ b/filter/Configuration_filter.mk +@@ -837,6 +837,15 @@ $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_writergraphics + writer_png_Export \ + )) + ++# fcfg_calcgraphics ++$(eval $(call filter_Configuration_add_types,fcfg_langpack,fcfg_calcgraphics_types.xcu,filter/source/config/fragments/types,\ ++ png_Portable_Network_Graphic \ ++)) ++ ++$(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_calcgraphics_filters.xcu,filter/source/config/fragments/filters,\ ++ calc_png_Export \ ++)) ++ + # fcfg_internalgraphics + $(eval $(call filter_Configuration_add_types,fcfg_langpack,fcfg_internalgraphics_types.xcu,filter/source/config/fragments/types,\ + bmp_MS_Windows \ +diff --git a/filter/source/config/fragments/filters/calc_png_Export.xcu b/filter/source/config/fragments/filters/calc_png_Export.xcu +new file mode 100644 +index 000000000000..999bef299a75 +--- /dev/null ++++ b/filter/source/config/fragments/filters/calc_png_Export.xcu +@@ -0,0 +1,20 @@ ++ ++ ++ EXPORT ALIEN 3RDPARTYFILTER ++ com.sun.star.comp.GraphicExportDialog ++ com.sun.star.comp.GraphicExportFilter ++ ++ ++ PNG - Portable Network Graphic ++ ++ 0 ++ png_Portable_Network_Graphic ++ ++ com.sun.star.sheet.SpreadsheetDocument ++ +diff --git a/postprocess/CustomTarget_registry.mk b/postprocess/CustomTarget_registry.mk +index 2502011863f8..0a46d6650052 100644 +--- a/postprocess/CustomTarget_registry.mk ++++ b/postprocess/CustomTarget_registry.mk +@@ -87,6 +87,8 @@ postprocess_FILES_graphicfilter := \ + $(call gb_XcuFilterTypesTarget_get_target,fcfg_drawgraphics_types.xcu) \ + $(call gb_XcuFilterFiltersTarget_get_target,fcfg_impressgraphics_filters.xcu) \ + $(call gb_XcuFilterTypesTarget_get_target,fcfg_impressgraphics_types.xcu) \ ++ $(call gb_XcuFilterFiltersTarget_get_target,fcfg_calcgraphics_filters.xcu) \ ++ $(call gb_XcuFilterTypesTarget_get_target,fcfg_calcgraphics_types.xcu) \ + $(call gb_XcuFilterFiltersTarget_get_target,fcfg_writergraphics_filters.xcu) \ + $(call gb_XcuFilterTypesTarget_get_target,fcfg_writergraphics_types.xcu) + +diff --git a/svtools/source/filter/DocumentToGraphicRenderer.cxx b/svtools/source/filter/DocumentToGraphicRenderer.cxx +index e33a94ec416e..e78b0f1ad8ab 100644 +--- a/svtools/source/filter/DocumentToGraphicRenderer.cxx ++++ b/svtools/source/filter/DocumentToGraphicRenderer.cxx +@@ -148,6 +148,8 @@ Graphic DocumentToGraphicRenderer::renderToGraphic( + sal_Int32 DocumentToGraphicRenderer::getCurrentPageWriter() + { + Reference xTextViewCursorSupplier(mxModel->getCurrentController(), UNO_QUERY); ++ if (!xTextViewCursorSupplier.is()) ++ return 1; + Reference xCursor(xTextViewCursorSupplier->getViewCursor(), UNO_QUERY); + return xCursor->getPage(); + } +-- +2.12.0 + diff --git a/SOURCES/0221-lokdocview-Use-G_PARAM_STATIC_STRINGS.patch b/SOURCES/0221-lokdocview-Use-G_PARAM_STATIC_STRINGS.patch new file mode 100644 index 0000000..653e5ef --- /dev/null +++ b/SOURCES/0221-lokdocview-Use-G_PARAM_STATIC_STRINGS.patch @@ -0,0 +1,136 @@ +From 8d464eb04df9fe579f8ee24a476c18af8afe3fcb Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Mon, 19 Oct 2015 22:36:12 +0530 +Subject: [PATCH 221/398] lokdocview: Use G_PARAM_STATIC_STRINGS + +... as `name`, `nick`, and `blurb` are guaranteed to remain valid +and unmodified for the lifetime of the parameters. + +Change-Id: Ic6463b470546669d5a815842daedb170df85d161 +Reviewed-on: https://gerrit.libreoffice.org/19472 +Reviewed-by: Miklos Vajna +Tested-by: Miklos Vajna +(cherry picked from commit d2d5a00e0e3972c0021e2e664301a32da6e54c1a) +--- + libreofficekit/source/gtk/lokdocview.cxx | 42 ++++++++++++++++++++------------ + 1 file changed, 26 insertions(+), 16 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 4af48bbea5a5..dc1ae5544558 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -1638,8 +1638,9 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + "LO Path", + "LibreOffice Install Path", + 0, +- static_cast(G_PARAM_READWRITE +- | G_PARAM_CONSTRUCT_ONLY))); ++ static_cast(G_PARAM_READWRITE | ++ G_PARAM_CONSTRUCT_ONLY | ++ G_PARAM_STATIC_STRINGS))); + + /** + * LOKDocView:lopointer: +@@ -1650,10 +1651,11 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + g_object_class_install_property (pGObjectClass, + PROP_LO_POINTER, + g_param_spec_pointer("lopointer", +- "LO Pointer", +- "A LibreOfficeKit* from lok_init()", +- static_cast(G_PARAM_READWRITE +- | G_PARAM_CONSTRUCT_ONLY))); ++ "LO Pointer", ++ "A LibreOfficeKit* from lok_init()", ++ static_cast(G_PARAM_READWRITE | ++ G_PARAM_CONSTRUCT_ONLY | ++ G_PARAM_STATIC_STRINGS))); + + /** + * LOKDocView:docpath: +@@ -1666,7 +1668,8 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + "Document Path", + "The URI of the document to open", + 0, +- static_cast(G_PARAM_READWRITE))); ++ static_cast(G_PARAM_READWRITE | ++ G_PARAM_STATIC_STRINGS))); + + /** + * LOKDocView:docpointer: +@@ -1677,9 +1680,10 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + g_object_class_install_property (pGObjectClass, + PROP_DOC_POINTER, + g_param_spec_pointer("docpointer", +- "Document Pointer", +- "A LibreOfficeKitDocument* from documentLoad()", +- static_cast(G_PARAM_READWRITE))); ++ "Document Pointer", ++ "A LibreOfficeKitDocument* from documentLoad()", ++ static_cast(G_PARAM_READWRITE | ++ G_PARAM_STATIC_STRINGS))); + + /** + * LOKDocView:editable: +@@ -1692,7 +1696,8 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + "Editable", + "Whether the content is in edit mode or not", + FALSE, +- static_cast(G_PARAM_READWRITE))); ++ static_cast(G_PARAM_READWRITE | ++ G_PARAM_STATIC_STRINGS))); + + /** + * LOKDocView:load-progress: +@@ -1708,7 +1713,8 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + "Estimated Load Progress", + "Shows the progress of the document load operation", + 0.0, 1.0, 0.0, +- G_PARAM_READABLE)); ++ static_cast(G_PARAM_READABLE | ++ G_PARAM_STATIC_STRINGS))); + + /** + * LOKDocView:zoom-level: +@@ -1723,7 +1729,8 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + "The current zoom level of the content", + 0, 5.0, 1.0, + static_cast(G_PARAM_READWRITE | +- G_PARAM_CONSTRUCT))); ++ G_PARAM_CONSTRUCT | ++ G_PARAM_STATIC_STRINGS))); + + /** + * LOKDocView:is-loading: +@@ -1737,7 +1744,8 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + "Is Loading", + "Whether the view is loading a document", + FALSE, +- static_cast(G_PARAM_READABLE))); ++ static_cast(G_PARAM_READABLE | ++ G_PARAM_STATIC_STRINGS))); + + /** + * LOKDocView:doc-width: +@@ -1750,7 +1758,8 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + "Document Width", + "Width of the document in twips", + 0, G_MAXLONG, 0, +- static_cast(G_PARAM_READWRITE))); ++ static_cast(G_PARAM_READWRITE | ++ G_PARAM_STATIC_STRINGS))); + + /** + * LOKDocView:doc-height: +@@ -1763,7 +1772,8 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + "Document Height", + "Height of the document in twips", + 0, G_MAXLONG, 0, +- static_cast(G_PARAM_READWRITE))); ++ static_cast(G_PARAM_READWRITE | ++ G_PARAM_STATIC_STRINGS))); + + /** + * LOKDocView:can-zoom-in: +-- +2.12.0 + diff --git a/SOURCES/0222-lok-Avoid-adding-to-recent-documents-completely.patch b/SOURCES/0222-lok-Avoid-adding-to-recent-documents-completely.patch new file mode 100644 index 0000000..3b2ea55 --- /dev/null +++ b/SOURCES/0222-lok-Avoid-adding-to-recent-documents-completely.patch @@ -0,0 +1,59 @@ +From 03ea9bee49bbd6961677ab020695f8d2f7af9d4e Mon Sep 17 00:00:00 2001 +From: Jan Holesovsky +Date: Wed, 21 Oct 2015 09:21:34 +0200 +Subject: [PATCH 222/398] lok: Avoid adding to recent documents completely. + +(cherry picked from commit dcdba6ed8984fd135a346a921b3a7888ecef9cb0) + +Change-Id: I292281e300e8976bf5ae286262a6a3e20de41858 +--- + sfx2/source/appl/sfxpicklist.cxx | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +diff --git a/sfx2/source/appl/sfxpicklist.cxx b/sfx2/source/appl/sfxpicklist.cxx +index 0f3196df45cc..24754ca01b74 100644 +--- a/sfx2/source/appl/sfxpicklist.cxx ++++ b/sfx2/source/appl/sfxpicklist.cxx +@@ -19,6 +19,7 @@ + + #include + ++#include + #include + #include + #include +@@ -161,6 +162,9 @@ SfxPickList::PickListEntry* SfxPickList::GetPickListEntry( sal_uInt32 nIndex ) + + void SfxPickList::AddDocumentToPickList( SfxObjectShell* pDocSh ) + { ++ if (comphelper::LibreOfficeKit::isActive()) ++ return; ++ + SfxMedium *pMed = pDocSh->GetMedium(); + if( !pMed ) + return; +@@ -193,10 +197,9 @@ void SfxPickList::AddDocumentToPickList( SfxObjectShell* pDocSh ) + if ( pFilter ) + aFilter = pFilter->GetFilterName(); + +- // generate a thumbnail + boost::optional aThumbnail; +- // don't generate thumbnail when in headless mode, or on non-desktop (?) +-#if HAVE_FEATURE_DESKTOP ++ ++ // generate the thumbnail + if (!pDocSh->IsModified() && !Application::IsHeadlessModeEnabled()) + { + // not modified => the document matches what is in the shell +@@ -224,7 +227,7 @@ void SfxPickList::AddDocumentToPickList( SfxObjectShell* pDocSh ) + } + } + } +-#endif ++ + // add to svtool history options + SvtHistoryOptions().AppendItem( ePICKLIST, + aURL.GetURLNoPass( INetURLObject::NO_DECODE ), +-- +2.12.0 + diff --git a/SOURCES/0223-lokdocview-Emit-a-warning-after-error.patch b/SOURCES/0223-lokdocview-Emit-a-warning-after-error.patch new file mode 100644 index 0000000..8c1af5b --- /dev/null +++ b/SOURCES/0223-lokdocview-Emit-a-warning-after-error.patch @@ -0,0 +1,330 @@ +From d70bb33567306d21142c13e0de8a1db91a5df5d2 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Tue, 20 Oct 2015 01:02:56 +0530 +Subject: [PATCH 223/398] lokdocview: Emit a warning after error + +Change-Id: Id8e20e6561239096438d420c65d0da6dcc7f5e2e +Reviewed-on: https://gerrit.libreoffice.org/19474 +Tested-by: Jenkins +Reviewed-by: Miklos Vajna +(cherry picked from commit 54409159b8a12ca3d387e2ff2a2e1ff9dad1a2a3) +--- + libreofficekit/source/gtk/lokdocview.cxx | 106 +++++++++++++++++++++++++++---- + libreofficekit/source/gtk/tilebuffer.cxx | 23 ++++++- + 2 files changed, 112 insertions(+), 17 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index dc1ae5544558..bbb87115fa4f 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -266,6 +266,7 @@ signalKey (GtkWidget* pWidget, GdkEventKey* pEvent) + LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private (pDocView)); + int nCharCode = 0; + int nKeyCode = 0; ++ GError* error = NULL; + + if (!priv->m_bEdit) + { +@@ -339,7 +340,12 @@ signalKey (GtkWidget* pWidget, GdkEventKey* pEvent) + pLOEvent->m_nCharCode = nCharCode; + pLOEvent->m_nKeyCode = nKeyCode; + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); +- g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); ++ g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); ++ if (error != NULL) ++ { ++ g_warning("Unable to call LOK_POST_KEY: %s", error->message); ++ g_clear_error(&error); ++ } + g_object_unref(task); + } + else +@@ -350,7 +356,12 @@ signalKey (GtkWidget* pWidget, GdkEventKey* pEvent) + pLOEvent->m_nCharCode = nCharCode; + pLOEvent->m_nKeyCode = nKeyCode; + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); +- g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); ++ g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); ++ if (error != NULL) ++ { ++ g_warning("Unable to call LOK_POST_KEY: %s", error->message); ++ g_clear_error(&error); ++ } + g_object_unref(task); + } + +@@ -950,6 +961,7 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + { + LOKDocView* pDocView = LOK_DOC_VIEW (pWidget); + LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ GError* error = NULL; + + g_info("LOKDocView_Impl::signalButton: %d, %d (in twips: %d, %d)", + (int)pEvent->x, (int)pEvent->y, +@@ -992,7 +1004,12 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + pLOEvent->m_nSetGraphicSelectionY = pixelToTwip(pEvent->y, priv->m_fZoom); + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + +- g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); ++ g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); ++ if (error != NULL) ++ { ++ g_warning("Unable to call LOK_SET_GRAPHIC_SELECTION: %s", error->message); ++ g_clear_error(&error); ++ } + g_object_unref(task); + + return FALSE; +@@ -1011,7 +1028,12 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + pLOEvent->m_nSetGraphicSelectionY = pixelToTwip(pEvent->y, priv->m_fZoom); + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + +- g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); ++ g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); ++ if (error != NULL) ++ { ++ g_warning("Unable to call LOK_SET_GRAPHIC_SELECTION: %s", error->message); ++ g_clear_error(&error); ++ } + g_object_unref(task); + + return FALSE; +@@ -1060,7 +1082,12 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + pLOEvent->m_nSetGraphicSelectionY = pixelToTwip(priv->m_aGraphicHandleRects[i].y + priv->m_aGraphicHandleRects[i].height / 2, priv->m_fZoom); + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + +- g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); ++ g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); ++ if (error != NULL) ++ { ++ g_warning("Unable to call LOK_SET_GRAPHIC_SELECTION: %s", error->message); ++ g_clear_error(&error); ++ } + g_object_unref(task); + + return FALSE; +@@ -1102,7 +1129,12 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + priv->m_nLastButtonPressed = pLOEvent->m_nPostMouseEventButton; + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + +- g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); ++ g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); ++ if (error != NULL) ++ { ++ g_warning("Unable to call LOK_POST_MOUSE_EVENT: %s", error->message); ++ g_clear_error(&error); ++ } + g_object_unref(task); + break; + } +@@ -1134,7 +1166,12 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + priv->m_nLastButtonPressed = pLOEvent->m_nPostMouseEventButton; + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + +- g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); ++ g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); ++ if (error != NULL) ++ { ++ g_warning("Unable to call LOK_POST_MOUSE_EVENT: %s", error->message); ++ g_clear_error(&error); ++ } + g_object_unref(task); + break; + } +@@ -1168,6 +1205,7 @@ lok_doc_view_signal_motion (GtkWidget* pWidget, GdkEventMotion* pEvent) + LOKDocView* pDocView = LOK_DOC_VIEW (pWidget); + LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); + GdkPoint aPoint; ++ GError* error = NULL; + + priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId); + if (priv->m_bInDragMiddleHandle) +@@ -1222,7 +1260,12 @@ lok_doc_view_signal_motion (GtkWidget* pWidget, GdkEventMotion* pEvent) + pLOEvent->m_nSetGraphicSelectionY = pixelToTwip(pEvent->y, priv->m_fZoom); + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + +- g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); ++ g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); ++ if (error != NULL) ++ { ++ g_warning("Unable to call LOK_SET_GRAPHIC_SELECTION: %s", error->message); ++ g_clear_error(&error); ++ } + g_object_unref(task); + + return FALSE; +@@ -1241,7 +1284,12 @@ lok_doc_view_signal_motion (GtkWidget* pWidget, GdkEventMotion* pEvent) + + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + +- g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); ++ g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); ++ if (error != NULL) ++ { ++ g_warning("Unable to call LOK_MOUSEEVENT_MOUSEMOVE: %s", error->message); ++ g_clear_error(&error); ++ } + g_object_unref(task); + + return FALSE; +@@ -1986,6 +2034,7 @@ lok_doc_view_open_document (LOKDocView* pDocView, + { + GTask* task = g_task_new(pDocView, cancellable, callback, userdata); + LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ GError* error = NULL; + + LOEvent* pLOEvent = new LOEvent(LOK_LOAD_DOC); + pLOEvent->m_pPath = pPath; +@@ -1993,7 +2042,12 @@ lok_doc_view_open_document (LOKDocView* pDocView, + priv->m_aDocPath = pPath; + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + +- g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); ++ g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); ++ if (error != NULL) ++ { ++ g_warning("Unable to call LOK_LOAD_DOC: %s", error->message); ++ g_clear_error(&error); ++ } + g_object_unref(task); + } + +@@ -2051,11 +2105,17 @@ lok_doc_view_set_part (LOKDocView* pDocView, int nPart) + LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private (pDocView)); + GTask* task = g_task_new(pDocView, NULL, NULL, NULL); + LOEvent* pLOEvent = new LOEvent(LOK_SET_PART); ++ GError* error = NULL; + + pLOEvent->m_nPart = nPart; + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + +- g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); ++ g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); ++ if (error != NULL) ++ { ++ g_warning("Unable to call LOK_SET_PART: %s", error->message); ++ g_clear_error(&error); ++ } + g_object_unref(task); + } + +@@ -2074,10 +2134,16 @@ lok_doc_view_set_partmode(LOKDocView* pDocView, + LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private (pDocView)); + GTask* task = g_task_new(pDocView, NULL, NULL, NULL); + LOEvent* pLOEvent = new LOEvent(LOK_SET_PARTMODE); ++ GError* error = NULL; + pLOEvent->m_nPartMode = nPartMode; + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + +- g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); ++ g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); ++ if (error != NULL) ++ { ++ g_warning("Unable to call LOK_SET_PARTMODE: %s", error->message); ++ g_clear_error(&error); ++ } + g_object_unref(task); + } + +@@ -2133,10 +2199,16 @@ lok_doc_view_set_edit(LOKDocView* pDocView, + LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private (pDocView)); + GTask* task = g_task_new(pDocView, NULL, NULL, NULL); + LOEvent* pLOEvent = new LOEvent(LOK_SET_EDIT); ++ GError* error = NULL; + pLOEvent->m_bEdit = bEdit; + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + +- g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); ++ g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); ++ if (error != NULL) ++ { ++ g_warning("Unable to call LOK_SET_EDIT: %s", error->message); ++ g_clear_error(&error); ++ } + g_object_unref(task); + } + +@@ -2156,11 +2228,17 @@ lok_doc_view_post_command (LOKDocView* pDocView, + LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private (pDocView)); + GTask* task = g_task_new(pDocView, NULL, NULL, NULL); + LOEvent* pLOEvent = new LOEvent(LOK_POST_COMMAND); ++ GError* error = NULL; + pLOEvent->m_pCommand = pCommand; + pLOEvent->m_pArguments = g_strdup(pArguments); + + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); +- g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); ++ g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); ++ if (error != NULL) ++ { ++ g_warning("Unable to call LOK_POST_COMMAND: %s", error->message); ++ g_clear_error(&error); ++ } + g_object_unref(task); + } + +diff --git a/libreofficekit/source/gtk/tilebuffer.cxx b/libreofficekit/source/gtk/tilebuffer.cxx +index 992f06cd5e00..2f4e6cf123c1 100644 +--- a/libreofficekit/source/gtk/tilebuffer.cxx ++++ b/libreofficekit/source/gtk/tilebuffer.cxx +@@ -61,6 +61,7 @@ void TileBuffer::setInvalid(int x, int y, float fZoom, GTask* task, + GThreadPool* lokThreadPool) + { + int index = x * m_nWidth + y; ++ GError* error = NULL; + if (m_mTiles.find(index) != m_mTiles.end()) + { + m_mTiles[index].valid = false; +@@ -70,7 +71,12 @@ void TileBuffer::setInvalid(int x, int y, float fZoom, GTask* task, + pLOEvent->m_nPaintTileY = y; + pLOEvent->m_fPaintTileZoom = fZoom; + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); +- g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); ++ g_thread_pool_push(lokThreadPool, g_object_ref(task), &error); ++ if (error != NULL) ++ { ++ g_warning("Unable to call LOK_PAINT_TILE: %s", error->message); ++ g_clear_error(&error); ++ } + } + } + +@@ -78,6 +84,7 @@ Tile& TileBuffer::getTile(int x, int y, float fZoom, GTask* task, + GThreadPool* lokThreadPool) + { + int index = x * m_nWidth + y; ++ GError* error = NULL; + + if (m_mTiles.find(index) != m_mTiles.end() && !m_mTiles[index].valid) + { +@@ -86,7 +93,12 @@ Tile& TileBuffer::getTile(int x, int y, float fZoom, GTask* task, + pLOEvent->m_nPaintTileY = y; + pLOEvent->m_fPaintTileZoom = fZoom; + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); +- g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); ++ g_thread_pool_push(lokThreadPool, g_object_ref(task), &error); ++ if (error != NULL) ++ { ++ g_warning("Unable to call LOK_PAINT_TILE: %s", error->message); ++ g_clear_error(&error); ++ } + return m_mTiles[index]; + } + else if(m_mTiles.find(index) == m_mTiles.end()) +@@ -96,7 +108,12 @@ Tile& TileBuffer::getTile(int x, int y, float fZoom, GTask* task, + pLOEvent->m_nPaintTileY = y; + pLOEvent->m_fPaintTileZoom = fZoom; + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); +- g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL); ++ g_thread_pool_push(lokThreadPool, g_object_ref(task), &error); ++ if (error != NULL) ++ { ++ g_warning("Unable to call LOK_PAINT_TILE: %s", error->message); ++ g_clear_error(&error); ++ } + return m_DummyTile; + } + +-- +2.12.0 + diff --git a/SOURCES/0224-vcl-add-ITiledRenderable-getWindow-and-implement-in-.patch b/SOURCES/0224-vcl-add-ITiledRenderable-getWindow-and-implement-in-.patch new file mode 100644 index 0000000..8c49039 --- /dev/null +++ b/SOURCES/0224-vcl-add-ITiledRenderable-getWindow-and-implement-in-.patch @@ -0,0 +1,68 @@ +From 48e3532611ca0d7de71f9796bf3e8bf3263929dd Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Thu, 22 Oct 2015 10:15:34 +0200 +Subject: [PATCH 224/398] vcl: add ITiledRenderable::getWindow() and implement + in sw + +(cherry picked from commit 981a974824642a81f86c526dea682cd27cd437db) + +Change-Id: I9d0fad3904e74b44b0b126974ace4025f7a4fc5b +--- + include/vcl/ITiledRenderable.hxx | 6 ++++++ + sw/inc/unotxdoc.hxx | 4 +++- + sw/source/uibase/uno/unotxdoc.cxx | 7 +++++++ + 3 files changed, 16 insertions(+), 1 deletion(-) + +diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx +index c294d20dc9cf..bb891ab97f7b 100644 +--- a/include/vcl/ITiledRenderable.hxx ++++ b/include/vcl/ITiledRenderable.hxx +@@ -147,6 +147,12 @@ public: + { + return OUString(); + } ++ ++ /// Returns the current vcl::Window of the component. ++ virtual vcl::Window* getWindow() ++ { ++ return 0; ++ } + }; + + } // namespace vcl +diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx +index 346cab63ca02..d0eada25b6ef 100644 +--- a/sw/inc/unotxdoc.hxx ++++ b/sw/inc/unotxdoc.hxx +@@ -433,7 +433,9 @@ public: + /// @see vcl::ITiledRenderable::resetSelection(). + virtual void resetSelection() SAL_OVERRIDE; + /// @see vcl::ITiledRenderable::getPartPageRectangles(). +- virtual OUString getPartPageRectangles() SAL_OVERRIDE; ++ virtual OUString getPartPageRectangles() override; ++ /// @see vcl::ITiledRenderable::getWindow(). ++ virtual vcl::Window* getWindow() override; + + // ::com::sun::star::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 ) throw (::css::uno::RuntimeException, ::std::exception) SAL_OVERRIDE; +diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx +index fc1c6f411b74..658057d7a977 100644 +--- a/sw/source/uibase/uno/unotxdoc.cxx ++++ b/sw/source/uibase/uno/unotxdoc.cxx +@@ -3188,6 +3188,13 @@ OUString SwXTextDocument::getPartPageRectangles() + return pWrtShell->getPageRectangles(); + } + ++vcl::Window* SwXTextDocument::getWindow() ++{ ++ SolarMutexGuard aGuard; ++ ++ return &pDocShell->GetView()->GetEditWin(); ++} ++ + int SwXTextDocument::getPart() + { + SolarMutexGuard aGuard; +-- +2.12.0 + diff --git a/SOURCES/0225-LOK-add-Document-paste.patch b/SOURCES/0225-LOK-add-Document-paste.patch new file mode 100644 index 0000000..fd28b91 --- /dev/null +++ b/SOURCES/0225-LOK-add-Document-paste.patch @@ -0,0 +1,311 @@ +From 89ad7ba2b6f480c20d332bc3c171045afe21e23b Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Thu, 22 Oct 2015 11:26:13 +0200 +Subject: [PATCH 225/398] LOK: add Document::paste() + +Change-Id: I34998229e7f5cac4c62c859861783be3c161f9bf +(cherry picked from commit 6552767aa5ed61215eb64dac0cc026a5f7a9aad1) +--- + desktop/Library_sofficeapp.mk | 2 + + desktop/source/lib/init.cxx | 38 ++++++++++++++ + desktop/source/lib/lokclipboard.cxx | 83 +++++++++++++++++++++++++++++++ + desktop/source/lib/lokclipboard.hxx | 58 +++++++++++++++++++++ + include/LibreOfficeKit/LibreOfficeKit.h | 6 +++ + include/LibreOfficeKit/LibreOfficeKit.hxx | 12 +++++ + 6 files changed, 199 insertions(+) + create mode 100644 desktop/source/lib/lokclipboard.cxx + create mode 100644 desktop/source/lib/lokclipboard.hxx + +diff --git a/desktop/Library_sofficeapp.mk b/desktop/Library_sofficeapp.mk +index 2e3acb79b3c6..fb73cfa78f4b 100644 +--- a/desktop/Library_sofficeapp.mk ++++ b/desktop/Library_sofficeapp.mk +@@ -122,6 +122,7 @@ ifneq ($(filter $(OS),ANDROID IOS),) + $(eval $(call gb_Library_add_exception_objects,sofficeapp,\ + desktop/source/lib/init \ + desktop/source/lib/lokinteractionhandler \ ++ desktop/source/lib/lokclipboard \ + $(if $(filter $(OS),ANDROID), \ + desktop/source/lib/lokandroid) \ + )) +@@ -130,6 +131,7 @@ ifeq ($(GUIBASE),unx) + $(eval $(call gb_Library_add_exception_objects,sofficeapp,\ + desktop/source/lib/init \ + desktop/source/lib/lokinteractionhandler \ ++ desktop/source/lib/lokclipboard \ + )) + endif + endif +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 01fe099ccbe9..0459176c24a0 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -43,6 +43,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -78,6 +79,7 @@ + #include "../../inc/lib/init.hxx" + + #include "lokinteractionhandler.hxx" ++#include + + using namespace css; + using namespace vcl; +@@ -246,6 +248,10 @@ static void doc_setTextSelection (LibreOfficeKitDocument* pThis, + static char* doc_getTextSelection(LibreOfficeKitDocument* pThis, + const char* pMimeType, + char** pUsedMimeType); ++static bool doc_paste(LibreOfficeKitDocument* pThis, ++ const char* pMimeType, ++ const char* pData, ++ size_t nSize); + static void doc_setGraphicSelection (LibreOfficeKitDocument* pThis, + int nType, + int nX, +@@ -286,6 +292,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference postUnoCommand = doc_postUnoCommand; + m_pDocumentClass->setTextSelection = doc_setTextSelection; + m_pDocumentClass->getTextSelection = doc_getTextSelection; ++ m_pDocumentClass->paste = doc_paste; + m_pDocumentClass->setGraphicSelection = doc_setGraphicSelection; + m_pDocumentClass->resetSelection = doc_resetSelection; + m_pDocumentClass->getCommandValues = doc_getCommandValues; +@@ -989,6 +996,37 @@ static char* doc_getTextSelection(LibreOfficeKitDocument* pThis, const char* pMi + return pMemory; + } + ++static bool doc_paste(LibreOfficeKitDocument* pThis, const char* pMimeType, const char* pData, size_t nSize) ++{ ++ ITiledRenderable* pDoc = getTiledRenderable(pThis); ++ if (!pDoc) ++ { ++ gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering"; ++ return false; ++ } ++ ++ uno::Reference xTransferable(new LOKTransferable(pMimeType, pData, nSize)); ++ uno::Reference xClipboard(new LOKClipboard()); ++ xClipboard->setContents(xTransferable, uno::Reference()); ++ vcl::Window* pWindow = pDoc->getWindow(); ++ if (!pWindow) ++ { ++ gImpl->maLastExceptionMsg = "Document did not provide a window"; ++ return false; ++ } ++ ++ pWindow->SetClipboard(xClipboard); ++ OUString aCommand(".uno:Paste"); ++ uno::Sequence aPropertyValues; ++ if (!comphelper::dispatchCommand(aCommand, aPropertyValues)) ++ { ++ gImpl->maLastExceptionMsg = "Failed to dispatch the .uno: command"; ++ return false; ++ } ++ ++ return true; ++} ++ + static void doc_setGraphicSelection(LibreOfficeKitDocument* pThis, int nType, int nX, int nY) + { + ITiledRenderable* pDoc = getTiledRenderable(pThis); +diff --git a/desktop/source/lib/lokclipboard.cxx b/desktop/source/lib/lokclipboard.cxx +new file mode 100644 +index 000000000000..a81902b15b6b +--- /dev/null ++++ b/desktop/source/lib/lokclipboard.cxx +@@ -0,0 +1,83 @@ ++/* -*- 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 ++#include ++ ++using namespace com::sun::star; ++ ++uno::Reference SAL_CALL LOKClipboard::getContents() ++throw (uno::RuntimeException, std::exception) ++{ ++ return m_xTransferable; ++} ++ ++void SAL_CALL LOKClipboard::setContents(const uno::Reference& xTransferable, ++ const uno::Reference& /*xClipboardOwner*/) ++throw (uno::RuntimeException, std::exception) ++{ ++ m_xTransferable = xTransferable; ++} ++ ++OUString SAL_CALL LOKClipboard::getName() throw (uno::RuntimeException, std::exception) ++{ ++ return OUString(); ++} ++ ++LOKTransferable::LOKTransferable(const char* pMimeType, const char* pData, size_t nSize) ++ : m_aMimeType(pMimeType), ++ m_aText(pData, nSize) ++{ ++} ++ ++uno::Any SAL_CALL LOKTransferable::getTransferData(const datatransfer::DataFlavor& rFlavor) ++throw(datatransfer::UnsupportedFlavorException, io::IOException, uno::RuntimeException, std::exception) ++{ ++ uno::Any aRet; ++ if (m_aMimeType == "text/plain;charset=utf-8" && rFlavor.MimeType == "text/plain;charset=utf-16") ++ aRet <<= OStringToOUString(m_aText, RTL_TEXTENCODING_UTF8); ++ return aRet; ++} ++ ++std::vector LOKTransferable::getTransferDataFlavorsAsVector() ++{ ++ std::vector aRet; ++ datatransfer::DataFlavor aFlavor; ++ aFlavor.MimeType = OUString::fromUtf8(m_aMimeType.getStr()); ++ aFlavor.DataType = cppu::UnoType< uno::Sequence >::get(); ++ ++ sal_Int32 nIndex(0); ++ if (m_aMimeType.getToken(0, ';', nIndex) == "text/plain") ++ { ++ if (m_aMimeType.getToken(0, ';', nIndex) != "charset=utf-16") ++ aFlavor.MimeType = "text/plain;charset=utf-16"; ++ aFlavor.DataType = cppu::UnoType::get(); ++ } ++ aRet.push_back(aFlavor); ++ ++ return aRet; ++} ++ ++uno::Sequence SAL_CALL LOKTransferable::getTransferDataFlavors() ++throw(uno::RuntimeException, std::exception) ++{ ++ return comphelper::containerToSequence(getTransferDataFlavorsAsVector()); ++} ++ ++sal_Bool SAL_CALL LOKTransferable::isDataFlavorSupported(const datatransfer::DataFlavor& rFlavor) ++throw(uno::RuntimeException, std::exception) ++{ ++ const std::vector aFlavors = getTransferDataFlavorsAsVector(); ++ return std::find_if(aFlavors.begin(), aFlavors.end(), [&rFlavor](const datatransfer::DataFlavor& i) ++ { ++ return i.MimeType == rFlavor.MimeType && i.DataType == rFlavor.DataType; ++ }) != aFlavors.end(); ++} ++ ++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +diff --git a/desktop/source/lib/lokclipboard.hxx b/desktop/source/lib/lokclipboard.hxx +new file mode 100644 +index 000000000000..b982e1c734ee +--- /dev/null ++++ b/desktop/source/lib/lokclipboard.hxx +@@ -0,0 +1,58 @@ ++/* -*- 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_DESKTOP_SOURCE_LIB_LOKCLIPBOARD_HXX ++#define INCLUDED_DESKTOP_SOURCE_LIB_LOKCLIPBOARD_HXX ++ ++#include ++ ++#include ++#include ++ ++/// A clipboard implementation for LibreOfficeKit. ++class LOKClipboard : public cppu::WeakImplHelper ++{ ++ css::uno::Reference m_xTransferable; ++ ++public: ++ virtual css::uno::Reference SAL_CALL getContents() ++ throw(css::uno::RuntimeException, std::exception) override; ++ ++ virtual void SAL_CALL setContents(const css::uno::Reference& xTransferable, ++ const css::uno::Reference& xClipboardOwner) ++ throw(css::uno::RuntimeException, std::exception) override; ++ ++ virtual OUString SAL_CALL getName() throw(css::uno::RuntimeException, std::exception) override; ++}; ++ ++/// Represents the contents of LOKClipboard. ++class LOKTransferable : public cppu::WeakImplHelper ++{ ++ OString m_aMimeType; ++ OString m_aText; ++ ++ /// Provides a list of flavors, used by getTransferDataFlavors() and isDataFlavorSupported(). ++ std::vector getTransferDataFlavorsAsVector(); ++ ++public: ++ LOKTransferable(const char* pMimeType, const char* pData, size_t nSize); ++ ++ virtual css::uno::Any SAL_CALL getTransferData(const css::datatransfer::DataFlavor& rFlavor) ++ throw(css::datatransfer::UnsupportedFlavorException, css::io::IOException, css::uno::RuntimeException, std::exception) override; ++ ++ virtual css::uno::Sequence SAL_CALL getTransferDataFlavors() ++ throw(css::uno::RuntimeException, std::exception) override; ++ ++ virtual sal_Bool SAL_CALL isDataFlavorSupported(const css::datatransfer::DataFlavor& rFlavor) ++ throw(css::uno::RuntimeException, std::exception) override; ++}; ++ ++#endif ++ ++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h +index 83dcc9803d8a..d83717b4a809 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.h ++++ b/include/LibreOfficeKit/LibreOfficeKit.h +@@ -157,6 +157,12 @@ struct _LibreOfficeKitDocumentClass + const char* pMimeType, + char** pUsedMimeType); + ++ /// @see lok::Document::paste(). ++ bool (*paste) (LibreOfficeKitDocument* pThis, ++ const char* pMimeType, ++ const char* pData, ++ size_t nSize); ++ + /// @see lok::Document::setGraphicSelection + void (*setGraphicSelection) (LibreOfficeKitDocument* pThis, + int nType, +diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx +index e9167c510110..db7807d999ea 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.hxx ++++ b/include/LibreOfficeKit/LibreOfficeKit.hxx +@@ -247,6 +247,18 @@ public: + } + + /** ++ * Pastes content at the current cursor position. ++ * ++ * @param pMimeType format of pData, for example text/plain;charset=utf-8. ++ * @param pData the actual data to be pasted. ++ * @return if the supplied data was pasted successfully. ++ */ ++ inline bool paste(const char* pMimeType, const char* pData, size_t nSize) ++ { ++ return mpDoc->pClass->paste(mpDoc, pMimeType, pData, nSize); ++ } ++ ++ /** + * Adjusts the graphic selection. + * + * @param nType @see LibreOfficeKitSetGraphicSelectionType +-- +2.12.0 + diff --git a/SOURCES/0226-gtktiledviewer-initial-paste-support.patch b/SOURCES/0226-gtktiledviewer-initial-paste-support.patch new file mode 100644 index 0000000..268b157 --- /dev/null +++ b/SOURCES/0226-gtktiledviewer-initial-paste-support.patch @@ -0,0 +1,57 @@ +From 0fdc6de8c969eb185d1057fdb64a3be88b3dd770 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Thu, 22 Oct 2015 13:32:31 +0200 +Subject: [PATCH 226/398] gtktiledviewer: initial paste support + +Change-Id: I50b4dfa456d3518f5ef7faf5f634642973441a3e +(cherry picked from commit 173fc95b3551c1e69c49626211be8422cb29fb3e) +--- + libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index e7e276dfce17..b0ea03ee6796 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -12,6 +12,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -279,6 +280,17 @@ static void doCopy(GtkWidget* pButton, gpointer /*pItem*/) + free(pSelection); + } + ++static void doPaste(GtkWidget* pButton, gpointer /*pItem*/) ++{ ++ TiledWindow& rWindow = lcl_getTiledWindow(pButton); ++ LOKDocView* pLOKDocView = LOK_DOC_VIEW(rWindow.m_pDocView); ++ LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(pLOKDocView); ++ ++ GtkClipboard* pClipboard = gtk_clipboard_get_for_display(gtk_widget_get_display(rWindow.m_pDocView), GDK_SELECTION_CLIPBOARD); ++ gchar* pText = gtk_clipboard_wait_for_text(pClipboard); ++ if (pText) ++ pDocument->pClass->paste(pDocument, "text/plain;charset=utf-8", pText, strlen(pText)); ++} + + /// Searches for the next or previous text of TiledWindow::m_pFindbarEntry. + static void doSearch(GtkWidget* pButton, bool bBackwards) +@@ -661,6 +673,12 @@ static GtkWidget* createWindow(TiledWindow& rWindow) + gtk_tool_item_set_tooltip_text(pCopyButton, "Copy"); + gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pCopyButton, -1); + g_signal_connect(G_OBJECT(pCopyButton), "clicked", G_CALLBACK(doCopy), NULL); ++ ++ GtkToolItem* pPasteButton = gtk_tool_button_new( NULL, NULL); ++ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(pPasteButton), "edit-paste-symbolic"); ++ gtk_tool_item_set_tooltip_text(pPasteButton, "Paste"); ++ gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pPasteButton, -1); ++ g_signal_connect(G_OBJECT(pPasteButton), "clicked", G_CALLBACK(doPaste), NULL); + gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), gtk_separator_tool_item_new(), -1); + + GtkToolItem* pEnableEditing = gtk_toggle_tool_button_new(); +-- +2.12.0 + diff --git a/SOURCES/0227-desktop-add-lok-Document-paste-testcase.patch b/SOURCES/0227-desktop-add-lok-Document-paste-testcase.patch new file mode 100644 index 0000000..30d144f --- /dev/null +++ b/SOURCES/0227-desktop-add-lok-Document-paste-testcase.patch @@ -0,0 +1,121 @@ +From fcf74dd4cd42152234f405f645eecf58c74120e5 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Thu, 22 Oct 2015 15:51:41 +0200 +Subject: [PATCH 227/398] desktop: add lok::Document::paste() testcase + +Also, closeDoc() is called by tearDown(), so no need to call it manually +at the end of tests. + +Change-Id: Ib8f61a09fa3fc0885d7ea90ce96210bff4cc9f98 +(cherry picked from commit d491ae5692f0b1fb4653510e694bbf5227375858) +--- + desktop/CppunitTest_desktop_lib.mk | 1 + + desktop/qa/desktop_lib/test_desktop_lib.cxx | 24 +++++++++++++++++------- + 2 files changed, 18 insertions(+), 7 deletions(-) + +diff --git a/desktop/CppunitTest_desktop_lib.mk b/desktop/CppunitTest_desktop_lib.mk +index a1f712585507..ca9d8db32c9f 100644 +--- a/desktop/CppunitTest_desktop_lib.mk ++++ b/desktop/CppunitTest_desktop_lib.mk +@@ -45,6 +45,7 @@ $(eval $(call gb_CppunitTest_use_vcl,desktop_lib)) + $(eval $(call gb_CppunitTest_use_components,desktop_lib,\ + comphelper/util/comphelp \ + configmgr/source/configmgr \ ++ dtrans/util/mcnttype \ + filter/source/config/cache/filterconfig1 \ + filter/source/storagefilterdetect/storagefd \ + framework/util/fwk \ +diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx +index 3730fd106362..9f0124993ee3 100644 +--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx ++++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx +@@ -65,6 +65,7 @@ public: + void testPaintTile(); + void testSaveAs(); + void testSaveAsCalc(); ++ void testPasteWriter(); + + CPPUNIT_TEST_SUITE(DesktopLOKTest); + CPPUNIT_TEST(testGetStyles); +@@ -76,6 +77,7 @@ public: + CPPUNIT_TEST(testPaintTile); + CPPUNIT_TEST(testSaveAs); + CPPUNIT_TEST(testSaveAsCalc); ++ CPPUNIT_TEST(testPasteWriter); + CPPUNIT_TEST_SUITE_END(); + + uno::Reference mxComponent; +@@ -174,7 +176,6 @@ void DesktopLOKTest::testGetStyles() + CPPUNIT_FAIL("Unknown style family: " + rPair.first); + } + } +- closeDoc(); + } + + void DesktopLOKTest::testGetFonts() +@@ -194,7 +195,6 @@ void DesktopLOKTest::testGetFonts() + // check that we have font sizes available for each font + CPPUNIT_ASSERT( rPair.second.size() > 0); + } +- closeDoc(); + } + + void DesktopLOKTest::testCreateView() +@@ -213,7 +213,6 @@ void DesktopLOKTest::testCreateView() + + pDocument->m_pDocumentClass->destroyView(pDocument, nId); + CPPUNIT_ASSERT_EQUAL(1, pDocument->m_pDocumentClass->getViews(pDocument)); +- closeDoc(); + } + + void DesktopLOKTest::testGetPartPageRectangles() +@@ -236,7 +235,6 @@ void DesktopLOKTest::testGetPartPageRectangles() + CPPUNIT_ASSERT_EQUAL(static_cast(1), aRectangles.size()); + + free(pRectangles); +- closeDoc(); + } + + void DesktopLOKTest::testGetFilterTypes() +@@ -283,7 +281,6 @@ void DesktopLOKTest::testSearchCalc() + // Result is on the first sheet. + CPPUNIT_ASSERT_EQUAL(0, m_aSearchResultPart[0]); + +- closeDoc(); + comphelper::LibreOfficeKit::setActive(false); + } + +@@ -310,8 +307,6 @@ void DesktopLOKTest::testPaintTile() + nTileHeight = 4000; + aBuffer.resize(nCanvasWidth * nCanvasHeight * 4); + pDocument->pClass->paintTile(pDocument, aBuffer.data(), nCanvasWidth, nCanvasHeight, nTilePosX, nTilePosY, nTileWidth, nTileHeight); +- +- closeDoc(); + } + + void DesktopLOKTest::testSaveAs() +@@ -330,6 +325,21 @@ void DesktopLOKTest::testSaveAsCalc() + CPPUNIT_ASSERT(pDocument->pClass->saveAs(pDocument, aTempFile.GetURL().toUtf8().getStr(), "png", 0)); + } + ++void DesktopLOKTest::testPasteWriter() ++{ ++ comphelper::LibreOfficeKit::setActive(true); ++ LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); ++ OString aText("hello"); ++ ++ pDocument->pClass->paste(pDocument, "text/plain;charset=utf-8", aText.getStr(), aText.getLength()); ++ ++ pDocument->pClass->postUnoCommand(pDocument, ".uno:SelectAll", 0); ++ char* pText = pDocument->pClass->getTextSelection(pDocument, "text/plain;charset=utf-8", 0); ++ CPPUNIT_ASSERT_EQUAL(OString("hello"), OString(pText)); ++ free(pText); ++ comphelper::LibreOfficeKit::setActive(false); ++} ++ + CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); + + CPPUNIT_PLUGIN_IMPLEMENT(); +-- +2.12.0 + diff --git a/SOURCES/0228-loplugin-defaultparams.patch b/SOURCES/0228-loplugin-defaultparams.patch new file mode 100644 index 0000000..f547dc2 --- /dev/null +++ b/SOURCES/0228-loplugin-defaultparams.patch @@ -0,0 +1,27 @@ +From e46f191d3091b1fda977fb723aeec4b54f832412 Mon Sep 17 00:00:00 2001 +From: Stephan Bergmann +Date: Thu, 22 Oct 2015 21:41:02 +0200 +Subject: [PATCH 228/398] loplugin:defaultparams + +Change-Id: I12e314ef09ac4b3517135933169de50e8a525dfc +(cherry picked from commit ee5d1b07af43de4778a6289307a6364a1693f25a) +--- + desktop/qa/desktop_lib/test_desktop_lib.cxx | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx +index 9f0124993ee3..5816c032a7a5 100644 +--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx ++++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx +@@ -327,7 +327,7 @@ void DesktopLOKTest::testSaveAsCalc() + + void DesktopLOKTest::testPasteWriter() + { +- comphelper::LibreOfficeKit::setActive(true); ++ comphelper::LibreOfficeKit::setActive(); + LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); + OString aText("hello"); + +-- +2.12.0 + diff --git a/SOURCES/0229-vcl-ITiledRenderable-getWindow-can-be-pure-virtual-n.patch b/SOURCES/0229-vcl-ITiledRenderable-getWindow-can-be-pure-virtual-n.patch new file mode 100644 index 0000000..39094b8 --- /dev/null +++ b/SOURCES/0229-vcl-ITiledRenderable-getWindow-can-be-pure-virtual-n.patch @@ -0,0 +1,31 @@ +From bfba36e614c7df26b2c8047b18332181387d69c8 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Mon, 26 Oct 2015 10:26:37 +0100 +Subject: [PATCH 229/398] vcl: ITiledRenderable::getWindow() can be + pure-virtual now + +Change-Id: I393ec4427674cd5d77d0e9a069ffe159d14e38b1 +(cherry picked from commit e531f846d798e1b9097fcb2a5f4e58d5e3d423de) +--- + include/vcl/ITiledRenderable.hxx | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx +index bb891ab97f7b..5b3d4681088a 100644 +--- a/include/vcl/ITiledRenderable.hxx ++++ b/include/vcl/ITiledRenderable.hxx +@@ -149,10 +149,7 @@ public: + } + + /// Returns the current vcl::Window of the component. +- virtual vcl::Window* getWindow() +- { +- return 0; +- } ++ virtual vcl::Window* getWindow() = 0; + }; + + } // namespace vcl +-- +2.12.0 + diff --git a/SOURCES/0230-lok-Document-paste-check-if-the-given-mime-type-is-s.patch b/SOURCES/0230-lok-Document-paste-check-if-the-given-mime-type-is-s.patch new file mode 100644 index 0000000..d40529f --- /dev/null +++ b/SOURCES/0230-lok-Document-paste-check-if-the-given-mime-type-is-s.patch @@ -0,0 +1,108 @@ +From 18c49bbbce655d805447b95fc92733551eb6af51 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Mon, 26 Oct 2015 11:28:55 +0100 +Subject: [PATCH 230/398] lok::Document::paste: check if the given mime type is + supported + +Change-Id: Ib59ea43700815c53cdd4be819e2e9cf35c6f89e9 +(cherry picked from commit 7efbbe98d7fe951909234dcacd37f67975f00da2) +--- + desktop/qa/desktop_lib/test_desktop_lib.cxx | 5 ++++- + desktop/source/lib/init.cxx | 7 +++++++ + include/vcl/ITiledRenderable.hxx | 5 +++++ + sw/inc/unotxdoc.hxx | 2 ++ + sw/source/uibase/uno/unotxdoc.cxx | 10 ++++++++++ + 5 files changed, 28 insertions(+), 1 deletion(-) + +diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx +index 5816c032a7a5..12831318dde3 100644 +--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx ++++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx +@@ -331,12 +331,15 @@ void DesktopLOKTest::testPasteWriter() + LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); + OString aText("hello"); + +- pDocument->pClass->paste(pDocument, "text/plain;charset=utf-8", aText.getStr(), aText.getLength()); ++ CPPUNIT_ASSERT(pDocument->pClass->paste(pDocument, "text/plain;charset=utf-8", aText.getStr(), aText.getLength())); + + pDocument->pClass->postUnoCommand(pDocument, ".uno:SelectAll", 0); + char* pText = pDocument->pClass->getTextSelection(pDocument, "text/plain;charset=utf-8", 0); + CPPUNIT_ASSERT_EQUAL(OString("hello"), OString(pText)); + free(pText); ++ ++ CPPUNIT_ASSERT(!pDocument->pClass->paste(pDocument, "textt/plain;charset=utf-8", aText.getStr(), aText.getLength())); ++ + comphelper::LibreOfficeKit::setActive(false); + } + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 0459176c24a0..75df1528fd51 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -1016,6 +1016,13 @@ static bool doc_paste(LibreOfficeKitDocument* pThis, const char* pMimeType, cons + } + + pWindow->SetClipboard(xClipboard); ++ if (!pDoc->isMimeTypeSupported()) ++ { ++ if (gImpl) ++ gImpl->maLastExceptionMsg = "Document doesn't support this mime type"; ++ return false; ++ } ++ + OUString aCommand(".uno:Paste"); + uno::Sequence aPropertyValues; + if (!comphelper::dispatchCommand(aCommand, aPropertyValues)) +diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx +index 5b3d4681088a..3301b7754f15 100644 +--- a/include/vcl/ITiledRenderable.hxx ++++ b/include/vcl/ITiledRenderable.hxx +@@ -150,6 +150,11 @@ public: + + /// Returns the current vcl::Window of the component. + virtual vcl::Window* getWindow() = 0; ++ ++ virtual bool isMimeTypeSupported() ++ { ++ return false; ++ } + }; + + } // namespace vcl +diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx +index d0eada25b6ef..180ceb891b89 100644 +--- a/sw/inc/unotxdoc.hxx ++++ b/sw/inc/unotxdoc.hxx +@@ -436,6 +436,8 @@ public: + virtual OUString getPartPageRectangles() override; + /// @see vcl::ITiledRenderable::getWindow(). + virtual vcl::Window* getWindow() override; ++ /// @see vcl::ITiledRenderable::isMimeTypeSupported(). ++ virtual bool isMimeTypeSupported() override; + + // ::com::sun::star::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 ) throw (::css::uno::RuntimeException, ::std::exception) SAL_OVERRIDE; +diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx +index 658057d7a977..618e6b373162 100644 +--- a/sw/source/uibase/uno/unotxdoc.cxx ++++ b/sw/source/uibase/uno/unotxdoc.cxx +@@ -3195,6 +3195,16 @@ vcl::Window* SwXTextDocument::getWindow() + return &pDocShell->GetView()->GetEditWin(); + } + ++bool SwXTextDocument::isMimeTypeSupported() ++{ ++ SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); ++ if (!pWrtShell) ++ return false; ++ ++ TransferableDataHelper aDataHelper(TransferableDataHelper::CreateFromSystemClipboard(&pWrtShell->GetView().GetEditWin())); ++ return aDataHelper.GetXTransferable().is() && SwTransferable::IsPaste(*pWrtShell, aDataHelper); ++} ++ + int SwXTextDocument::getPart() + { + SolarMutexGuard aGuard; +-- +2.12.0 + diff --git a/SOURCES/0231-sc-implement-vcl-ITiledRenderable-isMimeTypeSupporte.patch b/SOURCES/0231-sc-implement-vcl-ITiledRenderable-isMimeTypeSupporte.patch new file mode 100644 index 0000000..1fe5a79 --- /dev/null +++ b/SOURCES/0231-sc-implement-vcl-ITiledRenderable-isMimeTypeSupporte.patch @@ -0,0 +1,103 @@ +From ce5f6c1ac1880ff18eb3b663a2862f742a6ddad4 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Mon, 26 Oct 2015 13:42:02 +0100 +Subject: [PATCH 231/398] sc: implement + vcl::ITiledRenderable::isMimeTypeSupported() + +(cherry picked from commit 5b4c29b1b15dcebfe4e76aaa8bdb2dd45e2b67f3) + +Change-Id: I0b9de068ddf0f4ff92d8fbf003b7529516f1f80a +--- + include/vcl/ITiledRenderable.hxx | 6 ++---- + sc/inc/docuno.hxx | 8 +++++++- + sc/source/ui/unoobj/docuno.cxx | 24 ++++++++++++++++++++++++ + sw/source/uibase/uno/unotxdoc.cxx | 2 ++ + 4 files changed, 35 insertions(+), 5 deletions(-) + +diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx +index 3301b7754f15..4fa23386bfbc 100644 +--- a/include/vcl/ITiledRenderable.hxx ++++ b/include/vcl/ITiledRenderable.hxx +@@ -151,10 +151,8 @@ public: + /// Returns the current vcl::Window of the component. + virtual vcl::Window* getWindow() = 0; + +- virtual bool isMimeTypeSupported() +- { +- return false; +- } ++ /// If the current contents of the clipboard is something we can paste. ++ virtual bool isMimeTypeSupported() = 0; + }; + + } // namespace vcl +diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx +index cc132278bdf8..1e3aae1d302b 100644 +--- a/sc/inc/docuno.hxx ++++ b/sc/inc/docuno.hxx +@@ -414,7 +414,13 @@ public: + virtual void setGraphicSelection(int nType, int nX, int nY) SAL_OVERRIDE; + + /// @see lok::Document::resetSelection(). +- virtual void resetSelection() SAL_OVERRIDE; ++ virtual void resetSelection() override; ++ ++ /// @see vcl::ITiledRenderable::getWindow(). ++ virtual vcl::Window* getWindow() override; ++ ++ /// @see vcl::ITiledRenderable::isMimeTypeSupported(). ++ virtual bool isMimeTypeSupported() override; + }; + + class ScDrawPagesObj : public cppu::WeakImplHelper2< +diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx +index 958495f7ea7b..af6bd11ba742 100644 +--- a/sc/source/ui/unoobj/docuno.cxx ++++ b/sc/source/ui/unoobj/docuno.cxx +@@ -846,6 +846,30 @@ void ScModelObj::resetSelection() + pDocShell->GetDocument().GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, ""); + } + ++vcl::Window* ScModelObj::getWindow() ++{ ++ SolarMutexGuard aGuard; ++ ++ ScViewData* pViewData = ScDocShell::GetViewData(); ++ if (!pViewData) ++ return 0; ++ ++ return pViewData->GetActiveWin(); ++} ++ ++bool ScModelObj::isMimeTypeSupported() ++{ ++ SolarMutexGuard aGuard; ++ ++ ScViewData* pViewData = ScDocShell::GetViewData(); ++ if (!pViewData) ++ return 0; ++ ++ ++ TransferableDataHelper aDataHelper(TransferableDataHelper::CreateFromSystemClipboard(pViewData->GetActiveWin())); ++ return EditEngine::HasValidData(aDataHelper.GetTransferable()); ++} ++ + void ScModelObj::initializeForTiledRendering() + { + SolarMutexGuard aGuard; +diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx +index 618e6b373162..68ec3df2a9c0 100644 +--- a/sw/source/uibase/uno/unotxdoc.cxx ++++ b/sw/source/uibase/uno/unotxdoc.cxx +@@ -3197,6 +3197,8 @@ vcl::Window* SwXTextDocument::getWindow() + + bool SwXTextDocument::isMimeTypeSupported() + { ++ SolarMutexGuard aGuard; ++ + SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); + if (!pWrtShell) + return false; +-- +2.12.0 + diff --git a/SOURCES/0232-vcl-add-Window-SetClipboard.patch b/SOURCES/0232-vcl-add-Window-SetClipboard.patch new file mode 100644 index 0000000..db1e6f6 --- /dev/null +++ b/SOURCES/0232-vcl-add-Window-SetClipboard.patch @@ -0,0 +1,45 @@ +From 2ff05dd30cb865b4a44d988370eb554acdca522a Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Thu, 22 Oct 2015 09:41:29 +0200 +Subject: [PATCH 232/398] vcl: add Window::SetClipboard() + +Change-Id: I385f64b7d5015c9a34f34a436b0ee2ce6b3a83d3 +(cherry picked from commit 98cdb563c1c63e93b4722721354d86848d2cd2c2) +--- + include/vcl/window.hxx | 2 ++ + vcl/source/window/window.cxx | 6 ++++++ + 2 files changed, 8 insertions(+) + +diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx +index ae2894001974..eb8cf4bc1df1 100644 +--- a/include/vcl/window.hxx ++++ b/include/vcl/window.hxx +@@ -1298,6 +1298,8 @@ public: + + // Clipboard/Selection interfaces + ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > GetClipboard(); ++ /// Sets a custom clipboard for the window's frame, instead of creating it on-demand using css::datatransfer::clipboard::SystemClipboard. ++ void SetClipboard(css::uno::Reference xClipboard); + ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > GetPrimarySelection(); + + /* +diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx +index e8d2b9615d92..0a01a14f4530 100644 +--- a/vcl/source/window/window.cxx ++++ b/vcl/source/window/window.cxx +@@ -3355,6 +3355,12 @@ void Window::ImplCallActivateListeners( vcl::Window *pOld ) + } + } + ++void Window::SetClipboard(Reference xClipboard) ++{ ++ if (mpWindowImpl->mpFrameData) ++ mpWindowImpl->mpFrameData->mxClipboard = xClipboard; ++} ++ + Reference< XClipboard > Window::GetClipboard() + { + +-- +2.12.0 + diff --git a/SOURCES/0233-lok-clipboard-support-rich-text-paste.patch b/SOURCES/0233-lok-clipboard-support-rich-text-paste.patch new file mode 100644 index 0000000..d8d53b0 --- /dev/null +++ b/SOURCES/0233-lok-clipboard-support-rich-text-paste.patch @@ -0,0 +1,73 @@ +From cb62457c638e4bd4d951bcf664040326c840824c Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Mon, 26 Oct 2015 14:20:26 +0100 +Subject: [PATCH 233/398] lok clipboard: support rich text paste + +Change-Id: Ida5028969782be792b32b952d3adba0c30dd8bae +(cherry picked from commit faa316e670414363dcfb6db6001fdb209f4a48c1) +--- + desktop/qa/desktop_lib/test_desktop_lib.cxx | 3 +++ + desktop/source/lib/lokclipboard.cxx | 11 ++++++++--- + desktop/source/lib/lokclipboard.hxx | 2 +- + 3 files changed, 12 insertions(+), 4 deletions(-) + +diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx +index 12831318dde3..d4135b66d1d8 100644 +--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx ++++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx +@@ -338,7 +338,10 @@ void DesktopLOKTest::testPasteWriter() + CPPUNIT_ASSERT_EQUAL(OString("hello"), OString(pText)); + free(pText); + ++ // textt/plain should be rejected. + CPPUNIT_ASSERT(!pDocument->pClass->paste(pDocument, "textt/plain;charset=utf-8", aText.getStr(), aText.getLength())); ++ // Writer is expected to support text/html. ++ CPPUNIT_ASSERT(pDocument->pClass->paste(pDocument, "text/html", aText.getStr(), aText.getLength())); + + comphelper::LibreOfficeKit::setActive(false); + } +diff --git a/desktop/source/lib/lokclipboard.cxx b/desktop/source/lib/lokclipboard.cxx +index a81902b15b6b..50d570577e27 100644 +--- a/desktop/source/lib/lokclipboard.cxx ++++ b/desktop/source/lib/lokclipboard.cxx +@@ -32,7 +32,7 @@ OUString SAL_CALL LOKClipboard::getName() throw (uno::RuntimeException, std::exc + + LOKTransferable::LOKTransferable(const char* pMimeType, const char* pData, size_t nSize) + : m_aMimeType(pMimeType), +- m_aText(pData, nSize) ++ m_aSequence(reinterpret_cast(pData), nSize) + { + } + +@@ -40,8 +40,13 @@ uno::Any SAL_CALL LOKTransferable::getTransferData(const datatransfer::DataFlavo + throw(datatransfer::UnsupportedFlavorException, io::IOException, uno::RuntimeException, std::exception) + { + uno::Any aRet; +- if (m_aMimeType == "text/plain;charset=utf-8" && rFlavor.MimeType == "text/plain;charset=utf-16") +- aRet <<= OStringToOUString(m_aText, RTL_TEXTENCODING_UTF8); ++ if (rFlavor.DataType == cppu::UnoType::get()) ++ { ++ sal_Char* pText = reinterpret_cast(m_aSequence.getArray()); ++ aRet <<= OUString(pText, rtl_str_getLength(pText), RTL_TEXTENCODING_UTF8); ++ } ++ else ++ aRet <<= m_aSequence; + return aRet; + } + +diff --git a/desktop/source/lib/lokclipboard.hxx b/desktop/source/lib/lokclipboard.hxx +index b982e1c734ee..a0ab6451e0c0 100644 +--- a/desktop/source/lib/lokclipboard.hxx ++++ b/desktop/source/lib/lokclipboard.hxx +@@ -35,7 +35,7 @@ public: + class LOKTransferable : public cppu::WeakImplHelper + { + OString m_aMimeType; +- OString m_aText; ++ css::uno::Sequence m_aSequence; + + /// Provides a list of flavors, used by getTransferDataFlavors() and isDataFlavorSupported(). + std::vector getTransferDataFlavorsAsVector(); +-- +2.12.0 + diff --git a/SOURCES/0234-gtktiledviwer-try-to-paste-as-html-then-as-plain-tex.patch b/SOURCES/0234-gtktiledviwer-try-to-paste-as-html-then-as-plain-tex.patch new file mode 100644 index 0000000..6585d65 --- /dev/null +++ b/SOURCES/0234-gtktiledviwer-try-to-paste-as-html-then-as-plain-tex.patch @@ -0,0 +1,75 @@ +From cd8468af6c005d3ba1f11eff0fdc04344a282c31 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Mon, 26 Oct 2015 14:25:26 +0100 +Subject: [PATCH 234/398] gtktiledviwer: try to paste as html, then as plain + text + +Change-Id: I8e1c93fd36fb903c0625b29f9f73825438c9e113 +(cherry picked from commit 080bd44f0b0300075ff18d377f31deebbc4009ed) +--- + desktop/source/lib/lokclipboard.cxx | 2 +- + .../qa/gtktiledviewer/gtktiledviewer.cxx | 28 ++++++++++++++++++++++ + 2 files changed, 29 insertions(+), 1 deletion(-) + +diff --git a/desktop/source/lib/lokclipboard.cxx b/desktop/source/lib/lokclipboard.cxx +index 50d570577e27..376bcd72d238 100644 +--- a/desktop/source/lib/lokclipboard.cxx ++++ b/desktop/source/lib/lokclipboard.cxx +@@ -43,7 +43,7 @@ throw(datatransfer::UnsupportedFlavorException, io::IOException, uno::RuntimeExc + if (rFlavor.DataType == cppu::UnoType::get()) + { + sal_Char* pText = reinterpret_cast(m_aSequence.getArray()); +- aRet <<= OUString(pText, rtl_str_getLength(pText), RTL_TEXTENCODING_UTF8); ++ aRet <<= OUString(pText, m_aSequence.getLength(), RTL_TEXTENCODING_UTF8); + } + else + aRet <<= m_aSequence; +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index b0ea03ee6796..72afd52131ad 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -15,6 +15,7 @@ + #include + + #include ++#include + #include + + #define LOK_USE_UNSTABLE_API +@@ -287,6 +288,33 @@ static void doPaste(GtkWidget* pButton, gpointer /*pItem*/) + LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(pLOKDocView); + + GtkClipboard* pClipboard = gtk_clipboard_get_for_display(gtk_widget_get_display(rWindow.m_pDocView), GDK_SELECTION_CLIPBOARD); ++ ++ GdkAtom* pTargets; ++ gint nTargets; ++ boost::optional oTarget; ++ if (gtk_clipboard_wait_for_targets(pClipboard, &pTargets, &nTargets)) ++ { ++ for (gint i = 0; i < nTargets; ++i) ++ { ++ gchar* pName = gdk_atom_name(pTargets[i]); ++ if (std::string(pName) == "text/html") ++ oTarget = pTargets[i]; ++ g_free(pName); ++ } ++ g_free(pTargets); ++ } ++ ++ if (oTarget) ++ { ++ GtkSelectionData* pSelectionData = gtk_clipboard_wait_for_contents(pClipboard, *oTarget); ++ gint nLength; ++ const guchar* pData = gtk_selection_data_get_data_with_length(pSelectionData, &nLength); ++ bool bSuccess = pDocument->pClass->paste(pDocument, "text/html", reinterpret_cast(pData), nLength); ++ gtk_selection_data_free(pSelectionData); ++ if (bSuccess) ++ return; ++ } ++ + gchar* pText = gtk_clipboard_wait_for_text(pClipboard); + if (pText) + pDocument->pClass->paste(pDocument, "text/plain;charset=utf-8", pText, strlen(pText)); +-- +2.12.0 + diff --git a/SOURCES/0235-sw-tiled-rendering-don-t-offer-HTML-paste-for-shape-.patch b/SOURCES/0235-sw-tiled-rendering-don-t-offer-HTML-paste-for-shape-.patch new file mode 100644 index 0000000..52d75c3 --- /dev/null +++ b/SOURCES/0235-sw-tiled-rendering-don-t-offer-HTML-paste-for-shape-.patch @@ -0,0 +1,33 @@ +From a4c1fef85d4d97c934eb3927b3aef56a397bb80c Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Mon, 26 Oct 2015 15:39:28 +0100 +Subject: [PATCH 235/398] sw tiled rendering: don't offer HTML paste for shape + text + +Change-Id: Icd6df15347c48a5e42860092f4ee664e3a3d5699 +(cherry picked from commit c791bef561dcf38a4b47dd06534914f7c28ae67e) +--- + sw/source/uibase/uno/unotxdoc.cxx | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx +index 68ec3df2a9c0..b50096bbbaa8 100644 +--- a/sw/source/uibase/uno/unotxdoc.cxx ++++ b/sw/source/uibase/uno/unotxdoc.cxx +@@ -3204,6 +3204,13 @@ bool SwXTextDocument::isMimeTypeSupported() + return false; + + TransferableDataHelper aDataHelper(TransferableDataHelper::CreateFromSystemClipboard(&pWrtShell->GetView().GetEditWin())); ++ if (SdrView* pSdrView = pWrtShell->GetDrawView()) ++ { ++ if (pSdrView->GetTextEditObject()) ++ // Editing shape text ++ return EditEngine::HasValidData(aDataHelper.GetTransferable()); ++ } ++ + return aDataHelper.GetXTransferable().is() && SwTransferable::IsPaste(*pWrtShell, aDataHelper); + } + +-- +2.12.0 + diff --git a/SOURCES/0236-fix-includes-that-are-not-stand-alone.patch b/SOURCES/0236-fix-includes-that-are-not-stand-alone.patch new file mode 100644 index 0000000..5a24faa --- /dev/null +++ b/SOURCES/0236-fix-includes-that-are-not-stand-alone.patch @@ -0,0 +1,478 @@ +From d3d251ac5a08c88a9de24dbf198f921037057e38 Mon Sep 17 00:00:00 2001 +From: Norbert Thiebaud +Date: Fri, 16 Oct 2015 17:15:50 -0500 +Subject: [PATCH 236/398] fix includes that are not stand-alone + +includes should be able to be included on their own +fix some of the ones that do not respect +that rule. + +Change-Id: Id161224a1978461d3cea43252f232f18888a4f61 +Reviewed-on: https://gerrit.libreoffice.org/19612 +Tested-by: Jenkins +Reviewed-by: Norbert Thiebaud +(cherry picked from commit fd9d9976bf346929d872db0e5d8abc4180c9996c) +--- + include/LibreOfficeKit/LibreOfficeKit.hxx | 1 + + include/basebmp/basebmpdllapi.h | 2 ++ + include/basegfx/raster/bzpixelraster.hxx | 1 + + include/basic/sbxcore.hxx | 8 ++++---- + include/canvas/base/canvascustomspritehelper.hxx | 9 +++++---- + include/canvas/base/disambiguationhelper.hxx | 1 + + include/canvas/rendering/icachedprimitive.hxx | 1 + + include/connectivity/SQLStatementHelper.hxx | 1 + + include/connectivity/StdTypeDefs.hxx | 9 ++++----- + include/drawinglayer/processor2d/canvasprocessor.hxx | 14 +++++++------- + include/editeng/eedata.hxx | 2 ++ + include/filter/msfilter/msocximex.hxx | 1 + + include/filter/msfilter/svdfppt.hxx | 1 + + include/filter/msfilter/svxmsbas.hxx | 10 ++++++---- + include/formula/IControlReferenceHandler.hxx | 1 + + include/jvmaccess/unovirtualmachine.hxx | 3 +-- + include/oox/export/utils.hxx | 2 ++ + include/svx/globl3d.hxx | 2 ++ + include/tools/appendunixshellword.hxx | 2 +- + include/tools/getprocessworkingdir.hxx | 2 +- + include/tools/mapunit.hxx | 2 ++ + include/unotest/gettestargument.hxx | 3 +-- + include/unotest/toabsolutefileurl.hxx | 2 +- + include/vcl/fontcapabilities.hxx | 2 ++ + include/vcl/salgtype.hxx | 2 ++ + include/xmloff/DashStyle.hxx | 3 +-- + include/xmloff/styleexp.hxx | 1 + + include/xmloff/xmlcnimp.hxx | 5 +++-- + 28 files changed, 58 insertions(+), 35 deletions(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx +index db7807d999ea..0e83a63c3fe5 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.hxx ++++ b/include/LibreOfficeKit/LibreOfficeKit.hxx +@@ -11,6 +11,7 @@ + #define INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKIT_HXX + + #include "LibreOfficeKit.h" ++#include "LibreOfficeKitInit.h" + + /* + * The reasons this C++ code is not as pretty as it could be are: +diff --git a/include/basebmp/basebmpdllapi.h b/include/basebmp/basebmpdllapi.h +index c44eee01ce7b..88241af7a812 100644 +--- a/include/basebmp/basebmpdllapi.h ++++ b/include/basebmp/basebmpdllapi.h +@@ -20,6 +20,8 @@ + #ifndef INCLUDED_BASEBMP_BASEBMPDLLAPI_H + #define INCLUDED_BASEBMP_BASEBMPDLLAPI_H + ++#include ++ + #if defined BASEBMP_DLLIMPLEMENTATION + #define BASEBMP_DLLPUBLIC SAL_DLLPUBLIC_EXPORT + #else +diff --git a/include/basegfx/raster/bzpixelraster.hxx b/include/basegfx/raster/bzpixelraster.hxx +index cddca2186578..f11dcf26a9f9 100644 +--- a/include/basegfx/raster/bzpixelraster.hxx ++++ b/include/basegfx/raster/bzpixelraster.hxx +@@ -22,6 +22,7 @@ + + #include + #include ++#include + + namespace basegfx + { +diff --git a/include/basic/sbxcore.hxx b/include/basic/sbxcore.hxx +index 98f984196dd6..38bb80aeb817 100644 +--- a/include/basic/sbxcore.hxx ++++ b/include/basic/sbxcore.hxx +@@ -20,11 +20,11 @@ + #ifndef INCLUDED_BASIC_SBXCORE_HXX + #define INCLUDED_BASIC_SBXCORE_HXX + +-#include +-#include +- +-#include + #include ++#include ++#include ++#include ++#include + + class SvStream; + +diff --git a/include/canvas/base/canvascustomspritehelper.hxx b/include/canvas/base/canvascustomspritehelper.hxx +index b77144d8a50c..e90aca153f9d 100644 +--- a/include/canvas/base/canvascustomspritehelper.hxx ++++ b/include/canvas/base/canvascustomspritehelper.hxx +@@ -20,14 +20,15 @@ + #ifndef INCLUDED_CANVAS_BASE_CANVASCUSTOMSPRITEHELPER_HXX + #define INCLUDED_CANVAS_BASE_CANVASCUSTOMSPRITEHELPER_HXX + +-#include +-#include ++#include + #include +-#include ++#include + #include +-#include ++#include + #include + #include ++#include ++#include + + namespace canvas + { +diff --git a/include/canvas/base/disambiguationhelper.hxx b/include/canvas/base/disambiguationhelper.hxx +index 9b07498cb754..358e82b7a7d2 100644 +--- a/include/canvas/base/disambiguationhelper.hxx ++++ b/include/canvas/base/disambiguationhelper.hxx +@@ -20,6 +20,7 @@ + #ifndef INCLUDED_CANVAS_BASE_DISAMBIGUATIONHELPER_HXX + #define INCLUDED_CANVAS_BASE_DISAMBIGUATIONHELPER_HXX + ++#include + #include + + +diff --git a/include/canvas/rendering/icachedprimitive.hxx b/include/canvas/rendering/icachedprimitive.hxx +index 8df4cc94a136..969e8c088138 100644 +--- a/include/canvas/rendering/icachedprimitive.hxx ++++ b/include/canvas/rendering/icachedprimitive.hxx +@@ -20,6 +20,7 @@ + #ifndef INCLUDED_CANVAS_RENDERING_ICACHEDPRIMITIVE_HXX + #define INCLUDED_CANVAS_RENDERING_ICACHEDPRIMITIVE_HXX + ++#include + #include + + #include +diff --git a/include/connectivity/SQLStatementHelper.hxx b/include/connectivity/SQLStatementHelper.hxx +index 7472719328b1..36f6befac73a 100644 +--- a/include/connectivity/SQLStatementHelper.hxx ++++ b/include/connectivity/SQLStatementHelper.hxx +@@ -22,6 +22,7 @@ + + #include + #include ++#include + + namespace dbtools + { +diff --git a/include/connectivity/StdTypeDefs.hxx b/include/connectivity/StdTypeDefs.hxx +index 9c68fc34c834..78720651e723 100644 +--- a/include/connectivity/StdTypeDefs.hxx ++++ b/include/connectivity/StdTypeDefs.hxx +@@ -19,18 +19,17 @@ + #ifndef INCLUDED_CONNECTIVITY_STDTYPEDEFS_HXX + #define INCLUDED_CONNECTIVITY_STDTYPEDEFS_HXX + +-#include +- + #include + #include +-#include ++ ++#include + + + namespace connectivity + { + typedef ::std::vector< OUString> TStringVector; +- typedef ::std::vector< sal_Int32> TIntVector; +- typedef ::std::map TInt2IntMap; ++ typedef ::std::vector< sal_Int32> TIntVector; ++ typedef ::std::map TInt2IntMap; + typedef ::std::map< OUString,sal_Int32> TString2IntMap; + typedef ::std::map< sal_Int32,OUString> TInt2StringMap; + } +diff --git a/include/drawinglayer/processor2d/canvasprocessor.hxx b/include/drawinglayer/processor2d/canvasprocessor.hxx +index 5385582330f5..9ed260033e5d 100644 +--- a/include/drawinglayer/processor2d/canvasprocessor.hxx ++++ b/include/drawinglayer/processor2d/canvasprocessor.hxx +@@ -20,17 +20,17 @@ + #ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_CANVASPROCESSOR_HXX + #define INCLUDED_DRAWINGLAYER_PROCESSOR2D_CANVASPROCESSOR_HXX + +-#include +- +-#include +-#include + #include +-#include +-#include ++#include ++#include + #include ++#include ++#include ++#include + #include +-#include ++#include + #include ++#include + + namespace basegfx { + class BColor; +diff --git a/include/editeng/eedata.hxx b/include/editeng/eedata.hxx +index cd1db6e0775c..321cf04e43e7 100644 +--- a/include/editeng/eedata.hxx ++++ b/include/editeng/eedata.hxx +@@ -25,6 +25,8 @@ + // later. + #include + ++#include ++ + namespace EEngineData + { + // spell checking wrong vector containing the redlining data +diff --git a/include/filter/msfilter/msocximex.hxx b/include/filter/msfilter/msocximex.hxx +index f0dd8510ae1d..5b53bb5d7d56 100644 +--- a/include/filter/msfilter/msocximex.hxx ++++ b/include/filter/msfilter/msocximex.hxx +@@ -19,6 +19,7 @@ + #ifndef INCLUDED_FILTER_MSFILTER_MSOCXIMEX_HXX + #define INCLUDED_FILTER_MSFILTER_MSOCXIMEX_HXX + ++#include + #include + + namespace com{namespace sun{namespace star{ +diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx +index 2292064c756c..f6db48abc3fe 100644 +--- a/include/filter/msfilter/svdfppt.hxx ++++ b/include/filter/msfilter/svdfppt.hxx +@@ -20,6 +20,7 @@ + #ifndef INCLUDED_FILTER_MSFILTER_SVDFPPT_HXX + #define INCLUDED_FILTER_MSFILTER_SVDFPPT_HXX + ++#include + #include + #include + #include +diff --git a/include/filter/msfilter/svxmsbas.hxx b/include/filter/msfilter/svxmsbas.hxx +index 312e18c87b11..5b549d29ac20 100644 +--- a/include/filter/msfilter/svxmsbas.hxx ++++ b/include/filter/msfilter/svxmsbas.hxx +@@ -20,14 +20,16 @@ + #ifndef INCLUDED_FILTER_MSFILTER_SVXMSBAS_HXX + #define INCLUDED_FILTER_MSFILTER_SVXMSBAS_HXX + +-#include +-#include +- + #include + #include + ++#include ++#include ++#include ++#include ++#include ++ + class SfxObjectShell; +-class SotStorage; + + /* Construct with the root storage of the MS document, with bImportCode + * set the visual basic code will be imported into the stardocument when Import +diff --git a/include/formula/IControlReferenceHandler.hxx b/include/formula/IControlReferenceHandler.hxx +index 11cf043255eb..5d74fb1d6845 100644 +--- a/include/formula/IControlReferenceHandler.hxx ++++ b/include/formula/IControlReferenceHandler.hxx +@@ -20,6 +20,7 @@ + #define INCLUDED_FORMULA_ICONTROLREFERENCEHANDLER_HXX + + #include ++#include + + namespace formula + { +diff --git a/include/jvmaccess/unovirtualmachine.hxx b/include/jvmaccess/unovirtualmachine.hxx +index 5b0e785dec23..6d021257fd5c 100644 +--- a/include/jvmaccess/unovirtualmachine.hxx ++++ b/include/jvmaccess/unovirtualmachine.hxx +@@ -21,14 +21,13 @@ + #define INCLUDED_JVMACCESS_UNOVIRTUALMACHINE_HXX + + #include ++#include + #include + #include + #include + + namespace jvmaccess { + +-class VirtualMachine; +- + /** An encapsulating wrapper around a Java virtual machine and an appropriate + UNO class loader. + */ +diff --git a/include/oox/export/utils.hxx b/include/oox/export/utils.hxx +index 417e552fff30..66854f61998f 100644 +--- a/include/oox/export/utils.hxx ++++ b/include/oox/export/utils.hxx +@@ -20,6 +20,8 @@ + #ifndef INCLUDED_OOX_EXPORT_UTILS_HXX + #define INCLUDED_OOX_EXPORT_UTILS_HXX + ++#include ++ + #define I32S(x) OString::number( (sal_Int32) x ).getStr() + #define I64S(x) OString::number( (sal_Int64) x ).getStr() + #define IS(x) OString::number( x ).getStr() +diff --git a/include/svx/globl3d.hxx b/include/svx/globl3d.hxx +index 233a64196742..88fec321b895 100644 +--- a/include/svx/globl3d.hxx ++++ b/include/svx/globl3d.hxx +@@ -20,6 +20,8 @@ + #ifndef INCLUDED_SVX_GLOBL3D_HXX + #define INCLUDED_SVX_GLOBL3D_HXX + ++#include ++ + const sal_uInt32 E3dInventor = sal_uInt32('E')*0x00000001+ + sal_uInt32('3')*0x00000100+ + sal_uInt32('D')*0x00010000+ +diff --git a/include/tools/appendunixshellword.hxx b/include/tools/appendunixshellword.hxx +index 4585bf36cf8f..dbe66c628851 100644 +--- a/include/tools/appendunixshellword.hxx ++++ b/include/tools/appendunixshellword.hxx +@@ -20,7 +20,7 @@ + #ifndef INCLUDED_TOOLS_APPENDUNIXSHELLWORD_HXX + #define INCLUDED_TOOLS_APPENDUNIXSHELLWORD_HXX + +-#include ++#include + + #if defined UNX + #include +diff --git a/include/tools/getprocessworkingdir.hxx b/include/tools/getprocessworkingdir.hxx +index 985a683a872c..b0dbe709dcdb 100644 +--- a/include/tools/getprocessworkingdir.hxx ++++ b/include/tools/getprocessworkingdir.hxx +@@ -20,7 +20,7 @@ + #ifndef INCLUDED_TOOLS_GETPROCESSWORKINGDIR_HXX + #define INCLUDED_TOOLS_GETPROCESSWORKINGDIR_HXX + +-#include ++#include + #include + + +diff --git a/include/tools/mapunit.hxx b/include/tools/mapunit.hxx +index a68b6b45b251..660db9183e6f 100644 +--- a/include/tools/mapunit.hxx ++++ b/include/tools/mapunit.hxx +@@ -20,6 +20,8 @@ + #ifndef INCLUDED_TOOLS_MAPUNIT_HXX + #define INCLUDED_TOOLS_MAPUNIT_HXX + ++#include ++ + enum MapUnit { MAP_100TH_MM, MAP_10TH_MM, MAP_MM, MAP_CM, + MAP_1000TH_INCH, MAP_100TH_INCH, MAP_10TH_INCH, MAP_INCH, + MAP_POINT, MAP_TWIP, MAP_PIXEL, MAP_SYSFONT, MAP_APPFONT, +diff --git a/include/unotest/gettestargument.hxx b/include/unotest/gettestargument.hxx +index e2160ba51938..734b77e57b8a 100644 +--- a/include/unotest/gettestargument.hxx ++++ b/include/unotest/gettestargument.hxx +@@ -20,8 +20,7 @@ + #ifndef INCLUDED_UNOTEST_GETTESTARGUMENT_HXX + #define INCLUDED_UNOTEST_GETTESTARGUMENT_HXX + +-#include +- ++#include + #include + + +diff --git a/include/unotest/toabsolutefileurl.hxx b/include/unotest/toabsolutefileurl.hxx +index 975e7f411002..5bdb7b05ef04 100644 +--- a/include/unotest/toabsolutefileurl.hxx ++++ b/include/unotest/toabsolutefileurl.hxx +@@ -20,7 +20,7 @@ + #ifndef INCLUDED_UNOTEST_TOABSOLUTEFILEURL_HXX + #define INCLUDED_UNOTEST_TOABSOLUTEFILEURL_HXX + +-#include ++#include + + #include + +diff --git a/include/vcl/fontcapabilities.hxx b/include/vcl/fontcapabilities.hxx +index 069afff14113..57342603fa8e 100644 +--- a/include/vcl/fontcapabilities.hxx ++++ b/include/vcl/fontcapabilities.hxx +@@ -13,6 +13,8 @@ + #include + #include + ++#include ++ + //See OS/2 table, i.e. http://www.microsoft.com/typography/otspec/os2.htm#ur + namespace vcl + { +diff --git a/include/vcl/salgtype.hxx b/include/vcl/salgtype.hxx +index de8a5555fee4..8a340099a11d 100644 +--- a/include/vcl/salgtype.hxx ++++ b/include/vcl/salgtype.hxx +@@ -20,6 +20,8 @@ + #ifndef INCLUDED_VCL_SALGTYPE_HXX + #define INCLUDED_VCL_SALGTYPE_HXX + ++#include ++ + typedef sal_uInt32 SalColor; + #define MAKE_SALCOLOR( r, g, b ) ((SalColor)(((sal_uInt32)((sal_uInt8)(b))))|(((sal_uInt32)((sal_uInt8)(g)))<<8)|(((sal_uInt32)((sal_uInt8)(r)))<<16)) + #define SALCOLOR_RED( n ) ((sal_uInt8)((n)>>16)) +diff --git a/include/xmloff/DashStyle.hxx b/include/xmloff/DashStyle.hxx +index eafe70e16399..8f57f2e9c3ad 100644 +--- a/include/xmloff/DashStyle.hxx ++++ b/include/xmloff/DashStyle.hxx +@@ -20,9 +20,8 @@ + #ifndef INCLUDED_XMLOFF_DASHSTYLE_HXX + #define INCLUDED_XMLOFF_DASHSTYLE_HXX + +-#include ++#include + #include +-#include + + class SvXMLImport; + class SvXMLExport; +diff --git a/include/xmloff/styleexp.hxx b/include/xmloff/styleexp.hxx +index 7d9d6eedb61f..ff427342028d 100644 +--- a/include/xmloff/styleexp.hxx ++++ b/include/xmloff/styleexp.hxx +@@ -21,6 +21,7 @@ + + #include + #include ++#include + #include + #include + +diff --git a/include/xmloff/xmlcnimp.hxx b/include/xmloff/xmlcnimp.hxx +index aefee1c7ecd4..338a48f753ac 100644 +--- a/include/xmloff/xmlcnimp.hxx ++++ b/include/xmloff/xmlcnimp.hxx +@@ -20,10 +20,11 @@ + #ifndef INCLUDED_XMLOFF_XMLCNIMP_HXX + #define INCLUDED_XMLOFF_XMLCNIMP_HXX + +-#include +-#include + #include + ++#include ++#include ++ + class SvXMLAttrCollection; + + class XMLOFF_DLLPUBLIC SvXMLAttrContainerData +-- +2.12.0 + diff --git a/SOURCES/0237-sd-implement-vcl-ITiledRenderable-getWindow.patch b/SOURCES/0237-sd-implement-vcl-ITiledRenderable-getWindow.patch new file mode 100644 index 0000000..240ffdc --- /dev/null +++ b/SOURCES/0237-sd-implement-vcl-ITiledRenderable-getWindow.patch @@ -0,0 +1,53 @@ +From 675db4db926a09024df57ae8f9be457662393757 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Thu, 22 Oct 2015 14:15:14 +0200 +Subject: [PATCH 237/398] sd: implement vcl::ITiledRenderable::getWindow() + +(cherry picked from commit 8522948ba2f30fb703d4725086d30d9aa2a0cf4c) + +Change-Id: I8bc7316d9304d9e764ee846fe3af34599bf6fc35 +--- + sd/source/ui/inc/unomodel.hxx | 4 +++- + sd/source/ui/unoidl/unomodel.cxx | 11 +++++++++++ + 2 files changed, 14 insertions(+), 1 deletion(-) + +diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx +index 4d7314875f0b..a24f774e2fc9 100644 +--- a/sd/source/ui/inc/unomodel.hxx ++++ b/sd/source/ui/inc/unomodel.hxx +@@ -257,7 +257,9 @@ public: + /// @see vcl::ITiledRenderable::setGraphicSelection(). + virtual void setGraphicSelection(int nType, int nX, int nY) SAL_OVERRIDE; + /// @see lok::Document::resetSelection(). +- virtual void resetSelection() SAL_OVERRIDE; ++ virtual void resetSelection() override; ++ /// @see vcl::ITiledRenderable::getWindow(). ++ virtual vcl::Window* getWindow() override; + + // XComponent + +diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx +index 6ae01a28efac..1628a18df296 100644 +--- a/sd/source/ui/unoidl/unomodel.cxx ++++ b/sd/source/ui/unoidl/unomodel.cxx +@@ -2539,6 +2539,17 @@ void SdXImpressDocument::resetSelection() + pSdrView->UnmarkAll(); + } + ++vcl::Window* SdXImpressDocument::getWindow() ++{ ++ SolarMutexGuard aGuard; ++ ++ DrawViewShell* pViewShell = GetViewShell(); ++ if (!pViewShell) ++ return 0; ++ ++ return pViewShell->GetActiveWindow(); ++} ++ + uno::Reference< i18n::XForbiddenCharacters > SdXImpressDocument::getForbiddenCharsTable() + { + uno::Reference< i18n::XForbiddenCharacters > xForb(mxForbidenCharacters); +-- +2.12.0 + diff --git a/SOURCES/0238-sd-implement-vcl-ITiledRenderable-isMimeTypeSupporte.patch b/SOURCES/0238-sd-implement-vcl-ITiledRenderable-isMimeTypeSupporte.patch new file mode 100644 index 0000000..c84b7bf --- /dev/null +++ b/SOURCES/0238-sd-implement-vcl-ITiledRenderable-isMimeTypeSupporte.patch @@ -0,0 +1,51 @@ +From e428238e9c2017375e5f5e1a492385abac5937c1 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Mon, 26 Oct 2015 11:41:54 +0100 +Subject: [PATCH 238/398] sd: implement + vcl::ITiledRenderable::isMimeTypeSupported() + +Change-Id: I528ac9f9f687d2940c6477b1d33264f1e523051f +(cherry picked from commit b08546eb23aa8dfc2f139731f800031f147e32d7) +--- + sd/source/ui/inc/unomodel.hxx | 2 ++ + sd/source/ui/unoidl/unomodel.cxx | 11 +++++++++++ + 2 files changed, 13 insertions(+) + +diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx +index a24f774e2fc9..741cfd356e39 100644 +--- a/sd/source/ui/inc/unomodel.hxx ++++ b/sd/source/ui/inc/unomodel.hxx +@@ -260,6 +260,8 @@ public: + virtual void resetSelection() override; + /// @see vcl::ITiledRenderable::getWindow(). + virtual vcl::Window* getWindow() override; ++ /// @see vcl::ITiledRenderable::isMimeTypeSupported(). ++ virtual bool isMimeTypeSupported() override; + + // XComponent + +diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx +index 1628a18df296..31954b68f114 100644 +--- a/sd/source/ui/unoidl/unomodel.cxx ++++ b/sd/source/ui/unoidl/unomodel.cxx +@@ -2550,6 +2550,17 @@ vcl::Window* SdXImpressDocument::getWindow() + return pViewShell->GetActiveWindow(); + } + ++bool SdXImpressDocument::isMimeTypeSupported() ++{ ++ SolarMutexGuard aGuard; ++ DrawViewShell* pViewShell = GetViewShell(); ++ if (!pViewShell) ++ return false; ++ ++ TransferableDataHelper aDataHelper(TransferableDataHelper::CreateFromSystemClipboard(pViewShell->GetActiveWindow())); ++ return EditEngine::HasValidData(aDataHelper.GetTransferable()); ++} ++ + uno::Reference< i18n::XForbiddenCharacters > SdXImpressDocument::getForbiddenCharsTable() + { + uno::Reference< i18n::XForbiddenCharacters > xForb(mxForbidenCharacters); +-- +2.12.0 + diff --git a/SOURCES/0239-vcl-getWindow-setClipboard-in-ITiledRenderable.patch b/SOURCES/0239-vcl-getWindow-setClipboard-in-ITiledRenderable.patch new file mode 100644 index 0000000..32a0ae3 --- /dev/null +++ b/SOURCES/0239-vcl-getWindow-setClipboard-in-ITiledRenderable.patch @@ -0,0 +1,169 @@ +From 857dfce43c26d197beaa330cd4f005ce2cfb5360 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Wed, 28 Oct 2015 09:44:37 +0100 +Subject: [PATCH 239/398] vcl: getWindow() -> setClipboard() in + ITiledRenderable + +It's cleaner to let the apps do this themselves than exposing their +underlying vcl::Window. + +Change-Id: Iff2442dd325fa65a0cf3ad4aa7f918542dab1e4c +(cherry picked from commit bfd79be417358822023691cf7b7b2946906100ca) +--- + desktop/source/lib/init.cxx | 9 +-------- + include/vcl/ITiledRenderable.hxx | 4 ++-- + sc/inc/docuno.hxx | 4 ++-- + sc/source/ui/unoobj/docuno.cxx | 6 +++--- + sd/source/ui/inc/unomodel.hxx | 4 ++-- + sd/source/ui/unoidl/unomodel.cxx | 6 +++--- + sw/inc/unotxdoc.hxx | 4 ++-- + sw/source/uibase/uno/unotxdoc.cxx | 4 ++-- + 8 files changed, 17 insertions(+), 24 deletions(-) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 75df1528fd51..80c3d0389504 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -1008,14 +1008,7 @@ static bool doc_paste(LibreOfficeKitDocument* pThis, const char* pMimeType, cons + uno::Reference xTransferable(new LOKTransferable(pMimeType, pData, nSize)); + uno::Reference xClipboard(new LOKClipboard()); + xClipboard->setContents(xTransferable, uno::Reference()); +- vcl::Window* pWindow = pDoc->getWindow(); +- if (!pWindow) +- { +- gImpl->maLastExceptionMsg = "Document did not provide a window"; +- return false; +- } +- +- pWindow->SetClipboard(xClipboard); ++ pDoc->setClipboard(xClipboard); + if (!pDoc->isMimeTypeSupported()) + { + if (gImpl) +diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx +index 4fa23386bfbc..8ae719edf752 100644 +--- a/include/vcl/ITiledRenderable.hxx ++++ b/include/vcl/ITiledRenderable.hxx +@@ -148,8 +148,8 @@ public: + return OUString(); + } + +- /// Returns the current vcl::Window of the component. +- virtual vcl::Window* getWindow() = 0; ++ /// Sets the clipboard of the component. ++ virtual void setClipboard(const css::uno::Reference& xClipboard) = 0; + + /// If the current contents of the clipboard is something we can paste. + virtual bool isMimeTypeSupported() = 0; +diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx +index 1e3aae1d302b..a8595b00c36e 100644 +--- a/sc/inc/docuno.hxx ++++ b/sc/inc/docuno.hxx +@@ -416,8 +416,8 @@ public: + /// @see lok::Document::resetSelection(). + virtual void resetSelection() override; + +- /// @see vcl::ITiledRenderable::getWindow(). +- virtual vcl::Window* getWindow() override; ++ /// @see vcl::ITiledRenderable::setClipboard(). ++ virtual void setClipboard(const css::uno::Reference& xClipboard) override; + + /// @see vcl::ITiledRenderable::isMimeTypeSupported(). + virtual bool isMimeTypeSupported() override; +diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx +index af6bd11ba742..d58d6a900856 100644 +--- a/sc/source/ui/unoobj/docuno.cxx ++++ b/sc/source/ui/unoobj/docuno.cxx +@@ -846,15 +846,15 @@ void ScModelObj::resetSelection() + pDocShell->GetDocument().GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, ""); + } + +-vcl::Window* ScModelObj::getWindow() ++void ScModelObj::setClipboard(const uno::Reference& xClipboard) + { + SolarMutexGuard aGuard; + + ScViewData* pViewData = ScDocShell::GetViewData(); + if (!pViewData) +- return 0; ++ return; + +- return pViewData->GetActiveWin(); ++ pViewData->GetActiveWin()->SetClipboard(xClipboard); + } + + bool ScModelObj::isMimeTypeSupported() +diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx +index 741cfd356e39..8178aab1f1fa 100644 +--- a/sd/source/ui/inc/unomodel.hxx ++++ b/sd/source/ui/inc/unomodel.hxx +@@ -258,8 +258,8 @@ public: + virtual void setGraphicSelection(int nType, int nX, int nY) SAL_OVERRIDE; + /// @see lok::Document::resetSelection(). + virtual void resetSelection() override; +- /// @see vcl::ITiledRenderable::getWindow(). +- virtual vcl::Window* getWindow() override; ++ /// @see vcl::ITiledRenderable::setClipboard(). ++ virtual void setClipboard(const css::uno::Reference& xClipboard) override; + /// @see vcl::ITiledRenderable::isMimeTypeSupported(). + virtual bool isMimeTypeSupported() override; + +diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx +index 31954b68f114..d2c6b5e37603 100644 +--- a/sd/source/ui/unoidl/unomodel.cxx ++++ b/sd/source/ui/unoidl/unomodel.cxx +@@ -2539,15 +2539,15 @@ void SdXImpressDocument::resetSelection() + pSdrView->UnmarkAll(); + } + +-vcl::Window* SdXImpressDocument::getWindow() ++void SdXImpressDocument::setClipboard(const uno::Reference& xClipboard) + { + SolarMutexGuard aGuard; + + DrawViewShell* pViewShell = GetViewShell(); + if (!pViewShell) +- return 0; ++ return; + +- return pViewShell->GetActiveWindow(); ++ pViewShell->GetActiveWindow()->SetClipboard(xClipboard); + } + + bool SdXImpressDocument::isMimeTypeSupported() +diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx +index 180ceb891b89..85605d56c60f 100644 +--- a/sw/inc/unotxdoc.hxx ++++ b/sw/inc/unotxdoc.hxx +@@ -434,8 +434,8 @@ public: + virtual void resetSelection() SAL_OVERRIDE; + /// @see vcl::ITiledRenderable::getPartPageRectangles(). + virtual OUString getPartPageRectangles() override; +- /// @see vcl::ITiledRenderable::getWindow(). +- virtual vcl::Window* getWindow() override; ++ /// @see vcl::ITiledRenderable::setClipboard(). ++ virtual void setClipboard(const css::uno::Reference& xClipboard) override; + /// @see vcl::ITiledRenderable::isMimeTypeSupported(). + virtual bool isMimeTypeSupported() override; + +diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx +index b50096bbbaa8..4de023d1275c 100644 +--- a/sw/source/uibase/uno/unotxdoc.cxx ++++ b/sw/source/uibase/uno/unotxdoc.cxx +@@ -3188,11 +3188,11 @@ OUString SwXTextDocument::getPartPageRectangles() + return pWrtShell->getPageRectangles(); + } + +-vcl::Window* SwXTextDocument::getWindow() ++void SwXTextDocument::setClipboard(const uno::Reference& xClipboard) + { + SolarMutexGuard aGuard; + +- return &pDocShell->GetView()->GetEditWin(); ++ pDocShell->GetView()->GetEditWin().SetClipboard(xClipboard); + } + + bool SwXTextDocument::isMimeTypeSupported() +-- +2.12.0 + diff --git a/SOURCES/0240-LOK-font-back-color-feedback.patch b/SOURCES/0240-LOK-font-back-color-feedback.patch new file mode 100644 index 0000000..e8de82c --- /dev/null +++ b/SOURCES/0240-LOK-font-back-color-feedback.patch @@ -0,0 +1,50 @@ +From c99c25c3d09c53667b3a9e90573ae25cd4f0d74b Mon Sep 17 00:00:00 2001 +From: Mihai Varga +Date: Thu, 29 Oct 2015 16:28:37 +0200 +Subject: [PATCH 240/398] LOK: font/back color feedback + +This is used to know the current font/back color + +Change-Id: Ic524fcb5c26e1c15ec9c50b2879465152ac8ee34 +(cherry picked from commit 8e3685228d833233fc9a912a5e97df0e14597928) +--- + desktop/source/lib/init.cxx | 4 +++- + sfx2/source/control/unoctitm.cxx | 7 +++++++ + 2 files changed, 10 insertions(+), 1 deletion(-) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 80c3d0389504..9dacde8b0287 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -565,7 +565,9 @@ static void doc_iniUnoCommands () + OUString(".uno:DecrementIndent"), + OUString(".uno:CharFontName"), + OUString(".uno:FontHeight"), +- OUString(".uno:StyleApply") ++ OUString(".uno:StyleApply"), ++ OUString(".uno:FontColor"), ++ OUString(".uno:BackColor") + }; + + util::URL aCommandURL; +diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx +index bb5d6720029f..843e93d4feae 100644 +--- a/sfx2/source/control/unoctitm.cxx ++++ b/sfx2/source/control/unoctitm.cxx +@@ -1100,6 +1100,13 @@ void SfxDispatchController_Impl::InterceptLOKStateChangeEvent(const SfxObjectShe + aEvent.State >>= aTemplate; + aBuffer.append(aTemplate.StyleName); + } ++ else if (aEvent.FeatureURL.Path == "FontColor" || ++ aEvent.FeatureURL.Path == "BackColor") ++ { ++ long nColor; ++ aEvent.State >>= nColor; ++ aBuffer.append(nColor); ++ } + else + { + return; +-- +2.12.0 + diff --git a/SOURCES/0241-LOK-font-back-color-callback-use-sal_Int32-instead-o.patch b/SOURCES/0241-LOK-font-back-color-callback-use-sal_Int32-instead-o.patch new file mode 100644 index 0000000..e7dcb57 --- /dev/null +++ b/SOURCES/0241-LOK-font-back-color-callback-use-sal_Int32-instead-o.patch @@ -0,0 +1,28 @@ +From 4874f8d8125de27fbc98f9f39025e66509be90c2 Mon Sep 17 00:00:00 2001 +From: Mihai Varga +Date: Thu, 29 Oct 2015 16:52:42 +0200 +Subject: [PATCH 241/398] LOK: font/back color callback - use sal_Int32 instead + of long + +Change-Id: I2e2ebc5a12794e9641a6195f07fa4b2d1a7369a9 +(cherry picked from commit ee73a6c5573391f5f8e2f100f8392c34d6c61344) +--- + sfx2/source/control/unoctitm.cxx | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx +index 843e93d4feae..42d128a20298 100644 +--- a/sfx2/source/control/unoctitm.cxx ++++ b/sfx2/source/control/unoctitm.cxx +@@ -1103,7 +1103,7 @@ void SfxDispatchController_Impl::InterceptLOKStateChangeEvent(const SfxObjectShe + else if (aEvent.FeatureURL.Path == "FontColor" || + aEvent.FeatureURL.Path == "BackColor") + { +- long nColor; ++ sal_Int32 nColor = -1; + aEvent.State >>= nColor; + aBuffer.append(nColor); + } +-- +2.12.0 + diff --git a/SOURCES/0242-lokdocview-ensure-private-structure-is-allocated-wit.patch b/SOURCES/0242-lokdocview-ensure-private-structure-is-allocated-wit.patch new file mode 100644 index 0000000..33fa427 --- /dev/null +++ b/SOURCES/0242-lokdocview-ensure-private-structure-is-allocated-wit.patch @@ -0,0 +1,519 @@ +From 1c92d1b2e1ac5b48a3c010c8fcaffc88f80e13da Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 30 Oct 2015 08:31:43 +0100 +Subject: [PATCH 242/398] lokdocview: ensure private structure is allocated + with operator new + +It's undesirable to malloc a struct that has a TileBuffer member, while +TileBuffer doesn't have a default ctor. + +Change-Id: I72dfacc0088f238ee101d84838bd7eea51ced82a +(cherry picked from commit bd0ec1e68dcbc344cbaa50e35608bab95925fcaf) +--- + libreofficekit/source/gtk/lokdocview.cxx | 152 +++++++++++++++++++++---------- + libreofficekit/source/gtk/tilebuffer.hxx | 4 +- + 2 files changed, 108 insertions(+), 48 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index bbb87115fa4f..29b028c7b5d0 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -39,7 +39,7 @@ + #define GRAPHIC_HANDLE_COUNT 8 + + /// Private struct used by this GObject type +-struct _LOKDocViewPrivate ++struct LOKDocViewPrivateImpl + { + const gchar* m_aLOPath; + const gchar* m_aDocPath; +@@ -115,6 +115,58 @@ struct _LOKDocViewPrivate + + /// View ID, returned by createView() or 0 by default. + int m_nViewId; ++ ++ LOKDocViewPrivateImpl() ++ : m_aLOPath(0), ++ m_aDocPath(0), ++ m_nLoadProgress(0), ++ m_bIsLoading(false), ++ m_bCanZoomIn(false), ++ m_bCanZoomOut(false), ++ m_pOffice(0), ++ m_pDocument(0), ++ lokThreadPool(0), ++ m_fZoom(0), ++ m_nDocumentWidthTwips(0), ++ m_nDocumentHeightTwips(0), ++ m_bEdit(FALSE), ++ m_aVisibleCursor({0, 0, 0, 0}), ++ m_bCursorOverlayVisible(false), ++ m_bCursorVisible(true), ++ m_nLastButtonPressTime(0), ++ m_nLastButtonReleaseTime(0), ++ m_nLastButtonPressed(0), ++ m_nKeyModifier(0), ++ m_aTextSelectionStart({0, 0, 0, 0}), ++ m_aTextSelectionEnd({0, 0, 0, 0}), ++ m_aGraphicSelection({0, 0, 0, 0}), ++ m_bInDragGraphicSelection(false), ++ m_pHandleStart(0), ++ m_aHandleStartRect({0, 0, 0, 0}), ++ m_bInDragStartHandle(0), ++ m_pHandleMiddle(0), ++ m_aHandleMiddleRect({0, 0, 0, 0}), ++ m_bInDragMiddleHandle(false), ++ m_pHandleEnd(0), ++ m_aHandleEndRect({0, 0, 0, 0}), ++ m_bInDragEndHandle(false), ++ m_pGraphicHandle(0), ++ m_nViewId(0) ++ { ++ memset(&m_aGraphicHandleRects, 0, sizeof(m_aGraphicHandleRects)); ++ memset(&m_bInDragGraphicHandles, 0, sizeof(m_bInDragGraphicHandles)); ++ } ++}; ++ ++/// Wrapper around LOKDocViewPrivateImpl, managed by malloc/memset/free. ++struct _LOKDocViewPrivate ++{ ++ LOKDocViewPrivateImpl* m_pImpl; ++ ++ LOKDocViewPrivateImpl* operator->() ++ { ++ return m_pImpl; ++ } + }; + + enum +@@ -167,6 +219,12 @@ G_DEFINE_TYPE_WITH_CODE (LOKDocView, lok_doc_view, GTK_TYPE_DRAWING_AREA, + #pragma GCC diagnostic pop + #endif + ++static LOKDocViewPrivate& getPrivate(LOKDocView* pDocView) ++{ ++ LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private(pDocView)); ++ return *priv; ++} ++ + /// Helper struct used to pass the data from soffice thread -> main thread. + struct CallbackData + { +@@ -249,7 +307,7 @@ postKeyEventInThread(gpointer data) + { + GTask* task = G_TASK(data); + LOKDocView* pDocView = LOK_DOC_VIEW(g_task_get_source_object(task)); +- LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + LOEvent* pLOEvent = static_cast(g_task_get_task_data(task)); + + priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId); +@@ -263,7 +321,7 @@ static gboolean + signalKey (GtkWidget* pWidget, GdkEventKey* pEvent) + { + LOKDocView* pDocView = LOK_DOC_VIEW(pWidget); +- LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + int nCharCode = 0; + int nKeyCode = 0; + GError* error = NULL; +@@ -372,7 +430,7 @@ static gboolean + handleTimeout (gpointer pData) + { + LOKDocView* pDocView = LOK_DOC_VIEW (pData); +- LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + + if (priv->m_bEdit) + { +@@ -429,7 +487,7 @@ static gboolean queueDraw(gpointer pData) + static gboolean postDocumentLoad(gpointer pData) + { + LOKDocView* pLOKDocView = static_cast(pData); +- LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private(pLOKDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pLOKDocView); + + priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId); + priv->m_pDocument->pClass->initializeForRendering(priv->m_pDocument); +@@ -462,7 +520,7 @@ static gboolean + globalCallback (gpointer pData) + { + CallbackData* pCallback = static_cast(pData); +- LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private (pCallback->m_pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pCallback->m_pDocView); + + switch (pCallback->m_nType) + { +@@ -506,7 +564,7 @@ globalCallbackWorker(int nType, const char* pPayload, void* pData) + static GdkRectangle + payloadToRectangle (LOKDocView* pDocView, const char* pPayload) + { +- LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + GdkRectangle aRet; + gchar** ppCoordinates = g_strsplit(pPayload, ", ", 4); + gchar** ppCoordinate = ppCoordinates; +@@ -558,7 +616,7 @@ payloadToRectangles(LOKDocView* pDocView, const char* pPayload) + static void + setTilesInvalid (LOKDocView* pDocView, const GdkRectangle& rRectangle) + { +- LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + GdkRectangle aRectanglePixels; + GdkPoint aStart, aEnd; + +@@ -587,7 +645,7 @@ callback (gpointer pData) + { + CallbackData* pCallback = static_cast(pData); + LOKDocView* pDocView = LOK_DOC_VIEW (pCallback->m_pDocView); +- LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + + switch (pCallback->m_nType) + { +@@ -720,7 +778,7 @@ renderHandle(LOKDocView* pDocView, + cairo_surface_t* pHandle, + GdkRectangle& rRectangle) + { +- LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + GdkPoint aCursorBottom; + int nHandleWidth, nHandleHeight; + double fHandleScale; +@@ -753,7 +811,7 @@ renderGraphicHandle(LOKDocView* pDocView, + const GdkRectangle& rSelection, + cairo_surface_t* pHandle) + { +- LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + int nHandleWidth, nHandleHeight; + GdkRectangle aSelection; + +@@ -819,7 +877,7 @@ renderGraphicHandle(LOKDocView* pDocView, + static gboolean + renderDocument(LOKDocView* pDocView, cairo_t* pCairo) + { +- LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + GdkRectangle aVisibleArea; + long nDocumentWidthPixels = twipToPixel(priv->m_nDocumentWidthTwips, priv->m_fZoom); + long nDocumentHeightPixels = twipToPixel(priv->m_nDocumentHeightTwips, priv->m_fZoom); +@@ -882,7 +940,7 @@ renderDocument(LOKDocView* pDocView, cairo_t* pCairo) + static gboolean + renderOverlay(LOKDocView* pDocView, cairo_t* pCairo) + { +- LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + + if (priv->m_bEdit && priv->m_bCursorVisible && priv->m_bCursorOverlayVisible && !isEmptyRectangle(priv->m_aVisibleCursor)) + { +@@ -960,7 +1018,7 @@ static gboolean + lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + { + LOKDocView* pDocView = LOK_DOC_VIEW (pWidget); +- LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + GError* error = NULL; + + g_info("LOKDocView_Impl::signalButton: %d, %d (in twips: %d, %d)", +@@ -1203,7 +1261,7 @@ static gboolean + lok_doc_view_signal_motion (GtkWidget* pWidget, GdkEventMotion* pEvent) + { + LOKDocView* pDocView = LOK_DOC_VIEW (pWidget); +- LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + GdkPoint aPoint; + GError* error = NULL; + +@@ -1300,7 +1358,7 @@ setGraphicSelectionInThread(gpointer data) + { + GTask* task = G_TASK(data); + LOKDocView* pDocView = LOK_DOC_VIEW(g_task_get_source_object(task)); +- LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + LOEvent* pLOEvent = static_cast(g_task_get_task_data(task)); + + priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId); +@@ -1315,7 +1373,7 @@ postMouseEventInThread(gpointer data) + { + GTask* task = G_TASK(data); + LOKDocView* pDocView = LOK_DOC_VIEW(g_task_get_source_object(task)); +- LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + LOEvent* pLOEvent = static_cast(g_task_get_task_data(task)); + + priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId); +@@ -1333,7 +1391,7 @@ openDocumentInThread (gpointer data) + { + GTask* task = G_TASK(data); + LOKDocView* pDocView = LOK_DOC_VIEW(g_task_get_source_object(task)); +- LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + + if ( priv->m_pDocument ) + { +@@ -1360,7 +1418,7 @@ setPartInThread(gpointer data) + { + GTask* task = G_TASK(data); + LOKDocView* pDocView = LOK_DOC_VIEW(g_task_get_source_object(task)); +- LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + LOEvent* pLOEvent = static_cast(g_task_get_task_data(task)); + int nPart = pLOEvent->m_nPart; + +@@ -1373,7 +1431,7 @@ setPartmodeInThread(gpointer data) + { + GTask* task = G_TASK(data); + LOKDocView* pDocView = LOK_DOC_VIEW(g_task_get_source_object(task)); +- LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + LOEvent* pLOEvent = static_cast(g_task_get_task_data(task)); + int nPartMode = pLOEvent->m_nPartMode; + +@@ -1386,7 +1444,7 @@ setEditInThread(gpointer data) + { + GTask* task = G_TASK(data); + LOKDocView* pDocView = LOK_DOC_VIEW(g_task_get_source_object(task)); +- LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + LOEvent* pLOEvent = static_cast(g_task_get_task_data(task)); + gboolean bWasEdit = priv->m_bEdit; + gboolean bEdit = pLOEvent->m_bEdit; +@@ -1410,7 +1468,7 @@ postCommandInThread (gpointer data) + GTask* task = G_TASK(data); + LOKDocView* pDocView = LOK_DOC_VIEW(g_task_get_source_object(task)); + LOEvent* pLOEvent = static_cast(g_task_get_task_data(task)); +- LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + + priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId); + std::stringstream ss; +@@ -1424,7 +1482,7 @@ paintTileInThread (gpointer data) + { + GTask* task = G_TASK(data); + LOKDocView* pDocView = LOK_DOC_VIEW(g_task_get_source_object(task)); +- LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + LOEvent* pLOEvent = static_cast(g_task_get_task_data(task)); + TileBuffer& buffer = priv->m_aTileBuffer; + int index = pLOEvent->m_nPaintTileX * buffer.m_nWidth + pLOEvent->m_nPaintTileY; +@@ -1508,8 +1566,8 @@ lokThreadFunc(gpointer data, gpointer /*user_data*/) + + static void lok_doc_view_init (LOKDocView* pDocView) + { +- LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); +- priv->m_bCursorVisible = true; ++ LOKDocViewPrivate& priv = getPrivate(pDocView); ++ priv.m_pImpl = new LOKDocViewPrivateImpl(); + + gtk_widget_add_events(GTK_WIDGET(pDocView), + GDK_BUTTON_PRESS_MASK +@@ -1528,7 +1586,7 @@ static void lok_doc_view_init (LOKDocView* pDocView) + static void lok_doc_view_set_property (GObject* object, guint propId, const GValue *value, GParamSpec *pspec) + { + LOKDocView* pDocView = LOK_DOC_VIEW (object); +- LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + + switch (propId) + { +@@ -1564,7 +1622,7 @@ static void lok_doc_view_set_property (GObject* object, guint propId, const GVal + static void lok_doc_view_get_property (GObject* object, guint propId, GValue *value, GParamSpec *pspec) + { + LOKDocView* pDocView = LOK_DOC_VIEW (object); +- LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + + switch (propId) + { +@@ -1622,12 +1680,14 @@ static gboolean lok_doc_view_draw (GtkWidget* pWidget, cairo_t* pCairo) + static void lok_doc_view_finalize (GObject* object) + { + LOKDocView* pDocView = LOK_DOC_VIEW (object); +- LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + + if (priv->m_pDocument) + priv->m_pDocument->pClass->destroy (priv->m_pDocument); + if (priv->m_pOffice) + priv->m_pOffice->pClass->destroy (priv->m_pOffice); ++ delete priv.m_pImpl; ++ priv.m_pImpl = 0; + + G_OBJECT_CLASS (lok_doc_view_parent_class)->finalize (object); + } +@@ -1635,7 +1695,7 @@ static void lok_doc_view_finalize (GObject* object) + static gboolean lok_doc_view_initable_init (GInitable *initable, GCancellable* /*cancellable*/, GError **error) + { + LOKDocView *pDocView = LOK_DOC_VIEW (initable); +- LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + + if (priv->m_pOffice != NULL) + return TRUE; +@@ -1999,13 +2059,13 @@ lok_doc_view_new (const gchar* pPath, GCancellable *cancellable, GError **error) + + SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new_from_widget(LOKDocView* pOldLOKDocView) + { +- LOKDocViewPrivate* pOldPriv = static_cast(lok_doc_view_get_instance_private(pOldLOKDocView)); ++ LOKDocViewPrivate& pOldPriv = getPrivate(pOldLOKDocView); + GtkWidget* pNewDocView = GTK_WIDGET(g_initable_new(LOK_TYPE_DOC_VIEW, /*cancellable=*/0, /*error=*/0, + "lopath", pOldPriv->m_aLOPath, "lopointer", pOldPriv->m_pOffice, "docpointer", pOldPriv->m_pDocument, NULL)); + + // No documentLoad(), just a createView(). + LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(LOK_DOC_VIEW(pNewDocView)); +- LOKDocViewPrivate* pNewPriv = static_cast(lok_doc_view_get_instance_private(LOK_DOC_VIEW(pNewDocView))); ++ LOKDocViewPrivate& pNewPriv = getPrivate(LOK_DOC_VIEW(pNewDocView)); + pNewPriv->m_nViewId = pDocument->pClass->createView(pDocument); + + postDocumentLoad(pNewDocView); +@@ -2033,7 +2093,7 @@ lok_doc_view_open_document (LOKDocView* pDocView, + gpointer userdata) + { + GTask* task = g_task_new(pDocView, cancellable, callback, userdata); +- LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + GError* error = NULL; + + LOEvent* pLOEvent = new LOEvent(LOK_LOAD_DOC); +@@ -2054,14 +2114,14 @@ lok_doc_view_open_document (LOKDocView* pDocView, + SAL_DLLPUBLIC_EXPORT LibreOfficeKitDocument* + lok_doc_view_get_document (LOKDocView* pDocView) + { +- LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + return priv->m_pDocument; + } + + SAL_DLLPUBLIC_EXPORT void + lok_doc_view_set_zoom (LOKDocView* pDocView, float fZoom) + { +- LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + + priv->m_fZoom = fZoom; + long nDocumentWidthPixels = twipToPixel(priv->m_nDocumentWidthTwips, fZoom); +@@ -2079,14 +2139,14 @@ lok_doc_view_set_zoom (LOKDocView* pDocView, float fZoom) + SAL_DLLPUBLIC_EXPORT float + lok_doc_view_get_zoom (LOKDocView* pDocView) + { +- LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + return priv->m_fZoom; + } + + SAL_DLLPUBLIC_EXPORT int + lok_doc_view_get_parts (LOKDocView* pDocView) + { +- LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId); + return priv->m_pDocument->pClass->getParts( priv->m_pDocument ); + } +@@ -2094,7 +2154,7 @@ lok_doc_view_get_parts (LOKDocView* pDocView) + SAL_DLLPUBLIC_EXPORT int + lok_doc_view_get_part (LOKDocView* pDocView) + { +- LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId); + return priv->m_pDocument->pClass->getPart( priv->m_pDocument ); + } +@@ -2102,7 +2162,7 @@ lok_doc_view_get_part (LOKDocView* pDocView) + SAL_DLLPUBLIC_EXPORT void + lok_doc_view_set_part (LOKDocView* pDocView, int nPart) + { +- LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + GTask* task = g_task_new(pDocView, NULL, NULL, NULL); + LOEvent* pLOEvent = new LOEvent(LOK_SET_PART); + GError* error = NULL; +@@ -2122,7 +2182,7 @@ lok_doc_view_set_part (LOKDocView* pDocView, int nPart) + SAL_DLLPUBLIC_EXPORT char* + lok_doc_view_get_part_name (LOKDocView* pDocView, int nPart) + { +- LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId); + return priv->m_pDocument->pClass->getPartName( priv->m_pDocument, nPart ); + } +@@ -2131,7 +2191,7 @@ SAL_DLLPUBLIC_EXPORT void + lok_doc_view_set_partmode(LOKDocView* pDocView, + int nPartMode) + { +- LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + GTask* task = g_task_new(pDocView, NULL, NULL, NULL); + LOEvent* pLOEvent = new LOEvent(LOK_SET_PARTMODE); + GError* error = NULL; +@@ -2150,7 +2210,7 @@ lok_doc_view_set_partmode(LOKDocView* pDocView, + SAL_DLLPUBLIC_EXPORT void + lok_doc_view_reset_view(LOKDocView* pDocView) + { +- LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + priv->m_aTileBuffer.resetAllTiles(); + priv->m_nLoadProgress = 0.0; + +@@ -2196,7 +2256,7 @@ SAL_DLLPUBLIC_EXPORT void + lok_doc_view_set_edit(LOKDocView* pDocView, + gboolean bEdit) + { +- LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + GTask* task = g_task_new(pDocView, NULL, NULL, NULL); + LOEvent* pLOEvent = new LOEvent(LOK_SET_EDIT); + GError* error = NULL; +@@ -2215,7 +2275,7 @@ lok_doc_view_set_edit(LOKDocView* pDocView, + SAL_DLLPUBLIC_EXPORT gboolean + lok_doc_view_get_edit (LOKDocView* pDocView) + { +- LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + return priv->m_bEdit; + } + +@@ -2225,7 +2285,7 @@ lok_doc_view_post_command (LOKDocView* pDocView, + const gchar* pCommand, + const gchar* pArguments) + { +- LOKDocViewPrivate* priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + GTask* task = g_task_new(pDocView, NULL, NULL, NULL); + LOEvent* pLOEvent = new LOEvent(LOK_POST_COMMAND); + GError* error = NULL; +@@ -2245,14 +2305,14 @@ lok_doc_view_post_command (LOKDocView* pDocView, + SAL_DLLPUBLIC_EXPORT float + lok_doc_view_pixel_to_twip (LOKDocView* pDocView, float fInput) + { +- LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + return pixelToTwip(fInput, priv->m_fZoom); + } + + SAL_DLLPUBLIC_EXPORT float + lok_doc_view_twip_to_pixel (LOKDocView* pDocView, float fInput) + { +- LOKDocViewPrivate *priv = static_cast(lok_doc_view_get_instance_private (pDocView)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + return twipToPixel(fInput, priv->m_fZoom); + } + +diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx +index 34b9001e8bc5..9361a622fb7c 100644 +--- a/libreofficekit/source/gtk/tilebuffer.hxx ++++ b/libreofficekit/source/gtk/tilebuffer.hxx +@@ -82,8 +82,8 @@ private: + class TileBuffer + { + public: +- TileBuffer(LibreOfficeKitDocument *document, +- int columns) ++ TileBuffer(LibreOfficeKitDocument *document = 0, ++ int columns = 0) + : m_pLOKDocument(document) + , m_nWidth(columns) + { +-- +2.12.0 + diff --git a/SOURCES/0243-LOK-initial-Document-getCommandValues-for-RowColumnH.patch b/SOURCES/0243-LOK-initial-Document-getCommandValues-for-RowColumnH.patch new file mode 100644 index 0000000..b2d341d --- /dev/null +++ b/SOURCES/0243-LOK-initial-Document-getCommandValues-for-RowColumnH.patch @@ -0,0 +1,166 @@ +From 406b705cba1093c06770a2f09da6dd95a0c2bf3c Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 30 Oct 2015 11:18:19 +0100 +Subject: [PATCH 243/398] LOK: initial Document::getCommandValues() for + RowColumnHeaders + +Only the row info and for the entire tiled rendering area as a start. + +Change-Id: Idbccd805b355e8d151ab7025ac1cf0c686cb237b +(cherry picked from commit a7ce5f83343f8f6ba8a59b05820b3a2066c0ce9a) +--- + desktop/source/lib/init.cxx | 18 +++++++++++++++++- + include/vcl/ITiledRenderable.hxx | 8 ++++++++ + sc/inc/docuno.hxx | 3 +++ + sc/source/ui/inc/tabview.hxx | 2 ++ + sc/source/ui/unoobj/docuno.cxx | 13 +++++++++++++ + sc/source/ui/view/tabview.cxx | 29 +++++++++++++++++++++++++++++ + 6 files changed, 72 insertions(+), 1 deletion(-) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 9dacde8b0287..6785ae2328d4 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -1134,7 +1134,23 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo + { + return getStyles(pThis, pCommand); + } +- else { ++ else if (OString(pCommand) == ".uno:ViewRowColumnHeaders") ++ { ++ ITiledRenderable* pDoc = getTiledRenderable(pThis); ++ if (!pDoc) ++ { ++ gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering"; ++ return 0; ++ } ++ ++ OUString aHeaders = pDoc->getRowColumnHeaders(); ++ OString aString = OUStringToOString(aHeaders, RTL_TEXTENCODING_UTF8); ++ char* pMemory = static_cast(malloc(aString.getLength() + 1)); ++ strcpy(pMemory, aString.getStr()); ++ return pMemory; ++ } ++ else ++ { + gImpl->maLastExceptionMsg = "Unknown command, no values returned"; + return NULL; + } +diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx +index 8ae719edf752..48a13ffc1275 100644 +--- a/include/vcl/ITiledRenderable.hxx ++++ b/include/vcl/ITiledRenderable.hxx +@@ -148,6 +148,14 @@ public: + return OUString(); + } + ++ /** ++ * Get position and content of row/column headers of Calc documents. ++ */ ++ virtual OUString getRowColumnHeaders() ++ { ++ return OUString(); ++ } ++ + /// Sets the clipboard of the component. + virtual void setClipboard(const css::uno::Reference& xClipboard) = 0; + +diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx +index a8595b00c36e..b4711c54c883 100644 +--- a/sc/inc/docuno.hxx ++++ b/sc/inc/docuno.hxx +@@ -421,6 +421,9 @@ public: + + /// @see vcl::ITiledRenderable::isMimeTypeSupported(). + virtual bool isMimeTypeSupported() override; ++ ++ /// @see vcl::ITiledRenderable::getRowColumnHeaders(). ++ virtual OUString getRowColumnHeaders() override; + }; + + class ScDrawPagesObj : public cppu::WeakImplHelper2< +diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx +index d7e2a2dbf12e..5b0852041108 100644 +--- a/sc/source/ui/inc/tabview.hxx ++++ b/sc/source/ui/inc/tabview.hxx +@@ -520,6 +520,8 @@ public: + void EnableAutoSpell( bool bEnable ); + void ResetAutoSpell(); + void SetAutoSpellData( SCCOL nPosX, SCROW nPosY, const std::vector* pRanges ); ++ /// @see ScModelObj::getRowColumnHeaders(). ++ OUString getRowColumnHeaders(); + }; + + #endif +diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx +index d58d6a900856..f9a9e03f2839 100644 +--- a/sc/source/ui/unoobj/docuno.cxx ++++ b/sc/source/ui/unoobj/docuno.cxx +@@ -870,6 +870,19 @@ bool ScModelObj::isMimeTypeSupported() + return EditEngine::HasValidData(aDataHelper.GetTransferable()); + } + ++OUString ScModelObj::getRowColumnHeaders() ++{ ++ ScViewData* pViewData = ScDocShell::GetViewData(); ++ if (!pViewData) ++ return OUString(); ++ ++ ScTabView* pTabView = pViewData->GetView(); ++ if (!pTabView) ++ return OUString(); ++ ++ return pTabView->getRowColumnHeaders(); ++} ++ + void ScModelObj::initializeForTiledRendering() + { + SolarMutexGuard aGuard; +diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx +index b5d308be1aab..f177bbe704f1 100644 +--- a/sc/source/ui/view/tabview.cxx ++++ b/sc/source/ui/view/tabview.cxx +@@ -50,6 +50,7 @@ + + #include + #include ++#include + + #include + +@@ -2302,4 +2303,32 @@ void ScTabView::SetAutoSpellData( SCCOL nPosX, SCROW nPosY, const std::vectorGetTiledRenderingArea(aViewData.GetTabNo(), nEndCol, nEndRow); ++ ++ boost::property_tree::ptree aRows; ++ for (SCROW nRow = 0; nRow < nEndRow; ++nRow) ++ { ++ boost::property_tree::ptree aRow; ++ sal_uInt16 nSize = pRowBar[SC_SPLIT_BOTTOM]->GetEntrySize(nRow); ++ aRow.put("size", OString::number(nSize).getStr()); ++ OUString aText = pRowBar[SC_SPLIT_BOTTOM]->GetEntryText(nRow); ++ aRow.put("text", aText.toUtf8().getStr()); ++ aRows.push_back(std::make_pair("", aRow)); ++ } ++ ++ boost::property_tree::ptree aTree; ++ aTree.add_child("rows", aRows); ++ std::stringstream aStream; ++ boost::property_tree::write_json(aStream, aTree); ++ return OUString::fromUtf8(aStream.str().c_str()); ++} ++ + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +-- +2.12.0 + diff --git a/SOURCES/0244-gtktiledviewer-initial-row-headers-for-spreadsheet-d.patch b/SOURCES/0244-gtktiledviewer-initial-row-headers-for-spreadsheet-d.patch new file mode 100644 index 0000000..0489bd4 --- /dev/null +++ b/SOURCES/0244-gtktiledviewer-initial-row-headers-for-spreadsheet-d.patch @@ -0,0 +1,186 @@ +From 53bcb37a3c055ba6103a64ca1a29f284b2535b79 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 30 Oct 2015 12:34:38 +0100 +Subject: [PATCH 244/398] gtktiledviewer: initial row headers for spreadsheet + documents + +Change-Id: Iec9080d7017ddcf2b605243bc820f9664110c2e8 +(cherry picked from commit ecef9cb66c5f6009c7b062b489f93de85b70beeb) +--- + .../qa/gtktiledviewer/gtktiledviewer.cxx | 128 ++++++++++++++++++++- + 1 file changed, 127 insertions(+), 1 deletion(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 72afd52131ad..cdde08db602d 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -32,6 +32,37 @@ static int help() + return 1; + } + ++/// Represents the row header widget for spreadsheets. ++class TiledRowBar ++{ ++public: ++ /// Stores size and content of a single row header. ++ struct Header ++ { ++ int m_nSize; ++ std::string m_aText; ++ Header(int nSize, const std::string& rText) ++ : m_nSize(nSize), ++ m_aText(rText) ++ { ++ } ++ }; ++ ++ static const int HEADER_WIDTH = 50; ++ ++ GtkWidget* m_pDrawingArea; ++ std::vector
m_aHeaders; ++ int m_nHeightPixel = 0; ++ ++ TiledRowBar(GtkWidget* pDocView); ++ static gboolean draw(GtkWidget* pWidget, cairo_t* pCairo, gpointer pData); ++ gboolean drawImpl(GtkWidget* pWidget, cairo_t* pCairo); ++ static gboolean docConfigureEvent(GtkWidget* pWidget, GdkEventConfigure* pEvent, gpointer pData); ++ gboolean docConfigureEventImpl(GtkWidget* pWidget, GdkEventConfigure* pEvent); ++ /// Draws rText at the center of rRectangle on pCairo. ++ void drawText(cairo_t* pCairo, const GdkRectangle& rRectangle, const std::string& rText); ++}; ++ + /// Represents all the state that is specific to one GtkWindow of this app. + class TiledWindow + { +@@ -56,6 +87,7 @@ public: + GtkWidget* m_pFindbarEntry; + GtkWidget* m_pFindbarLabel; + bool m_bFindAll; ++ std::shared_ptr m_pRowBar; + + TiledWindow() + : m_pDocView(0), +@@ -92,6 +124,92 @@ static TiledWindow& lcl_getTiledWindow(GtkWidget* pWidget) + return g_aWindows[pToplevel]; + } + ++TiledRowBar::TiledRowBar(GtkWidget* pDocView) ++ : m_pDrawingArea(gtk_drawing_area_new()), ++ m_nHeightPixel(0) ++{ ++ gtk_widget_set_size_request(m_pDrawingArea, HEADER_WIDTH, -1); ++ g_signal_connect(m_pDrawingArea, "draw", G_CALLBACK(TiledRowBar::draw), this); ++ g_signal_connect(pDocView, "configure-event", G_CALLBACK(TiledRowBar::docConfigureEvent), this); ++} ++ ++gboolean TiledRowBar::draw(GtkWidget* pWidget, cairo_t* pCairo, gpointer pData) ++{ ++ return static_cast(pData)->drawImpl(pWidget, pCairo); ++} ++ ++void TiledRowBar::drawText(cairo_t* pCairo, const GdkRectangle& rRectangle, const std::string& rText) ++{ ++ cairo_text_extents_t extents; ++ cairo_text_extents(pCairo, rText.c_str(), &extents); ++ // Cairo reference point for text is the bottom left corner. ++ cairo_move_to(pCairo, rRectangle.x + rRectangle.width / 2 - extents.width / 2, rRectangle.y + rRectangle.height / 2 + extents.height / 2); ++ cairo_show_text(pCairo, rText.c_str()); ++} ++ ++gboolean TiledRowBar::drawImpl(GtkWidget* /*pWidget*/, cairo_t* pCairo) ++{ ++ cairo_set_source_rgb(pCairo, 0, 0, 0); ++ ++ int nTotal = 0; ++ for (const Header& rHeader : m_aHeaders) ++ { ++ GdkRectangle aRectangle; ++ aRectangle.x = 0; ++ aRectangle.y = nTotal - 1; ++ aRectangle.width = HEADER_WIDTH - 1; ++ aRectangle.height = rHeader.m_nSize; ++ // Bottom line. ++ cairo_rectangle(pCairo, aRectangle.x, aRectangle.y + aRectangle.height, aRectangle.width, 1); ++ cairo_fill(pCairo); ++ // Left line. ++ cairo_rectangle(pCairo, aRectangle.width, aRectangle.y, 1, aRectangle.height); ++ cairo_fill(pCairo); ++ drawText(pCairo, aRectangle, rHeader.m_aText); ++ nTotal += rHeader.m_nSize; ++ if (nTotal > m_nHeightPixel) ++ break; ++ } ++ ++ return FALSE; ++} ++ ++gboolean TiledRowBar::docConfigureEvent(GtkWidget* pWidget, GdkEventConfigure* pEvent, gpointer pData) ++{ ++ return static_cast(pData)->docConfigureEventImpl(pWidget, pEvent); ++} ++ ++gboolean TiledRowBar::docConfigureEventImpl(GtkWidget* pDocView, GdkEventConfigure* /*pEvent*/) ++{ ++ if (g_aWindows.find(gtk_widget_get_toplevel(pDocView)) == g_aWindows.end()) ++ return TRUE; ++ ++ TiledWindow& rWindow = lcl_getTiledWindow(pDocView); ++ GtkAdjustment* pVAdjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(rWindow.m_pScrolledWindow)); ++ m_nHeightPixel = gtk_adjustment_get_page_size(pVAdjustment); ++ ++ LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(LOK_DOC_VIEW(pDocView)); ++ if (pDocument && pDocument->pClass->getDocumentType(pDocument) == LOK_DOCTYPE_SPREADSHEET) ++ { ++ m_aHeaders.clear(); ++ char* pValues = pDocument->pClass->getCommandValues(pDocument, ".uno:ViewRowColumnHeaders"); ++ std::stringstream aStream(pValues); ++ free(pValues); ++ assert(!aStream.str().empty()); ++ boost::property_tree::ptree aTree; ++ boost::property_tree::read_json(aStream, aTree); ++ for (boost::property_tree::ptree::value_type& rValue : aTree.get_child("rows")) ++ { ++ Header aHeader(std::atoi(rValue.second.get("size").c_str()), rValue.second.get("text")); ++ m_aHeaders.push_back(aHeader); ++ } ++ gtk_widget_show(m_pDrawingArea); ++ gtk_widget_queue_draw(m_pDrawingArea); ++ } ++ ++ return TRUE; ++} ++ + static void lcl_registerToolItem(TiledWindow& rWindow, GtkToolItem* pItem, const std::string& rName) + { + rWindow.m_aToolItemCommandNames[pItem] = rName; +@@ -797,11 +915,17 @@ static GtkWidget* createWindow(TiledWindow& rWindow) + + gtk_box_pack_end(GTK_BOX(rWindow.m_pVBox), rWindow.m_pFindbar, FALSE, FALSE, 0); + ++ // Horizontal box for the row bar + doc view. ++ GtkWidget* pHBox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); ++ gtk_container_add(GTK_CONTAINER(rWindow.m_pVBox), pHBox); ++ rWindow.m_pRowBar.reset(new TiledRowBar(rWindow.m_pDocView)); ++ gtk_box_pack_start(GTK_BOX(pHBox), rWindow.m_pRowBar->m_pDrawingArea, FALSE, FALSE, 0); ++ + // Scrolled window for DocView + rWindow.m_pScrolledWindow = gtk_scrolled_window_new(0, 0); + gtk_widget_set_hexpand(rWindow.m_pScrolledWindow, TRUE); + gtk_widget_set_vexpand(rWindow.m_pScrolledWindow, TRUE); +- gtk_container_add(GTK_CONTAINER(rWindow.m_pVBox), rWindow.m_pScrolledWindow); ++ gtk_container_add(GTK_CONTAINER(pHBox), rWindow.m_pScrolledWindow); + + gtk_container_add(GTK_CONTAINER(rWindow.m_pScrolledWindow), rWindow.m_pDocView); + +@@ -818,6 +942,8 @@ static GtkWidget* createWindow(TiledWindow& rWindow) + gtk_widget_show_all(pWindow); + // Hide the findbar by default. + gtk_widget_hide(rWindow.m_pFindbar); ++ // Same for the row bar. ++ gtk_widget_hide(rWindow.m_pRowBar->m_pDrawingArea); + + g_aWindows[pWindow] = rWindow; + return pWindow; +-- +2.12.0 + diff --git a/SOURCES/0245-loplugin-staticmethods.patch b/SOURCES/0245-loplugin-staticmethods.patch new file mode 100644 index 0000000..b0edf75 --- /dev/null +++ b/SOURCES/0245-loplugin-staticmethods.patch @@ -0,0 +1,27 @@ +From 3c7e2e232a55843b76f10c74bc419d1a12c452f5 Mon Sep 17 00:00:00 2001 +From: Noel Grandin +Date: Fri, 30 Oct 2015 14:24:26 +0200 +Subject: [PATCH 245/398] loplugin:staticmethods + +Change-Id: I4cdf2fa91dde1968cfb984faf0bdd3aad42eefd2 +(cherry picked from commit bee72ee6199950f9489ac4ed313db63586f2b742) +--- + libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index cdde08db602d..9ee6ce8a39fb 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -60,7 +60,7 @@ public: + static gboolean docConfigureEvent(GtkWidget* pWidget, GdkEventConfigure* pEvent, gpointer pData); + gboolean docConfigureEventImpl(GtkWidget* pWidget, GdkEventConfigure* pEvent); + /// Draws rText at the center of rRectangle on pCairo. +- void drawText(cairo_t* pCairo, const GdkRectangle& rRectangle, const std::string& rText); ++ static void drawText(cairo_t* pCairo, const GdkRectangle& rRectangle, const std::string& rText); + }; + + /// Represents all the state that is specific to one GtkWindow of this app. +-- +2.12.0 + diff --git a/SOURCES/0246-gtktiledviewer-initial-column-headers-for-spreadshee.patch b/SOURCES/0246-gtktiledviewer-initial-column-headers-for-spreadshee.patch new file mode 100644 index 0000000..c632af6 --- /dev/null +++ b/SOURCES/0246-gtktiledviewer-initial-column-headers-for-spreadshee.patch @@ -0,0 +1,253 @@ +From 7d7a5c94be66cbe7dc571a8bfb56f6e30b869303 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 30 Oct 2015 14:57:16 +0100 +Subject: [PATCH 246/398] gtktiledviewer: initial column headers for + spreadsheet documents + +Change-Id: I10e88b4ff4ab0cfb29e97fa608d8acd69ce0f062 +(cherry picked from commit 18bf71a2002b979dbf80d85c8863af39783bf87d) +--- + .../qa/gtktiledviewer/gtktiledviewer.cxx | 131 +++++++++++++-------- + 1 file changed, 83 insertions(+), 48 deletions(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 9ee6ce8a39fb..08058e8699c9 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -32,8 +32,8 @@ static int help() + return 1; + } + +-/// Represents the row header widget for spreadsheets. +-class TiledRowBar ++/// Represents the row or column header widget for spreadsheets. ++class TiledRowColumnBar + { + public: + /// Stores size and content of a single row header. +@@ -48,17 +48,21 @@ public: + } + }; + +- static const int HEADER_WIDTH = 50; ++ enum TiledBarType { ROW, COLUMN }; ++ ++ static const int ROW_HEADER_WIDTH = 50; ++ static const int COLUMN_HEADER_HEIGHT = 20; + + GtkWidget* m_pDrawingArea; + std::vector
m_aHeaders; +- int m_nHeightPixel = 0; ++ /// Height for row bar, width for column bar. ++ int m_nSizePixel; ++ TiledBarType m_eType; + +- TiledRowBar(GtkWidget* pDocView); ++ TiledRowColumnBar(TiledBarType eType); + static gboolean draw(GtkWidget* pWidget, cairo_t* pCairo, gpointer pData); + gboolean drawImpl(GtkWidget* pWidget, cairo_t* pCairo); + static gboolean docConfigureEvent(GtkWidget* pWidget, GdkEventConfigure* pEvent, gpointer pData); +- gboolean docConfigureEventImpl(GtkWidget* pWidget, GdkEventConfigure* pEvent); + /// Draws rText at the center of rRectangle on pCairo. + static void drawText(cairo_t* pCairo, const GdkRectangle& rRectangle, const std::string& rText); + }; +@@ -87,7 +91,8 @@ public: + GtkWidget* m_pFindbarEntry; + GtkWidget* m_pFindbarLabel; + bool m_bFindAll; +- std::shared_ptr m_pRowBar; ++ std::shared_ptr m_pRowBar; ++ std::shared_ptr m_pColumnBar; + + TiledWindow() + : m_pDocView(0), +@@ -124,21 +129,24 @@ static TiledWindow& lcl_getTiledWindow(GtkWidget* pWidget) + return g_aWindows[pToplevel]; + } + +-TiledRowBar::TiledRowBar(GtkWidget* pDocView) ++TiledRowColumnBar::TiledRowColumnBar(TiledBarType eType) + : m_pDrawingArea(gtk_drawing_area_new()), +- m_nHeightPixel(0) ++ m_nSizePixel(0), ++ m_eType(eType) + { +- gtk_widget_set_size_request(m_pDrawingArea, HEADER_WIDTH, -1); +- g_signal_connect(m_pDrawingArea, "draw", G_CALLBACK(TiledRowBar::draw), this); +- g_signal_connect(pDocView, "configure-event", G_CALLBACK(TiledRowBar::docConfigureEvent), this); ++ if (m_eType == ROW) ++ gtk_widget_set_size_request(m_pDrawingArea, ROW_HEADER_WIDTH, -1); ++ else ++ gtk_widget_set_size_request(m_pDrawingArea, -1, COLUMN_HEADER_HEIGHT); ++ g_signal_connect(m_pDrawingArea, "draw", G_CALLBACK(TiledRowColumnBar::draw), this); + } + +-gboolean TiledRowBar::draw(GtkWidget* pWidget, cairo_t* pCairo, gpointer pData) ++gboolean TiledRowColumnBar::draw(GtkWidget* pWidget, cairo_t* pCairo, gpointer pData) + { +- return static_cast(pData)->drawImpl(pWidget, pCairo); ++ return static_cast(pData)->drawImpl(pWidget, pCairo); + } + +-void TiledRowBar::drawText(cairo_t* pCairo, const GdkRectangle& rRectangle, const std::string& rText) ++void TiledRowColumnBar::drawText(cairo_t* pCairo, const GdkRectangle& rRectangle, const std::string& rText) + { + cairo_text_extents_t extents; + cairo_text_extents(pCairo, rText.c_str(), &extents); +@@ -147,7 +155,7 @@ void TiledRowBar::drawText(cairo_t* pCairo, const GdkRectangle& rRectangle, cons + cairo_show_text(pCairo, rText.c_str()); + } + +-gboolean TiledRowBar::drawImpl(GtkWidget* /*pWidget*/, cairo_t* pCairo) ++gboolean TiledRowColumnBar::drawImpl(GtkWidget* /*pWidget*/, cairo_t* pCairo) + { + cairo_set_source_rgb(pCairo, 0, 0, 0); + +@@ -155,56 +163,76 @@ gboolean TiledRowBar::drawImpl(GtkWidget* /*pWidget*/, cairo_t* pCairo) + for (const Header& rHeader : m_aHeaders) + { + GdkRectangle aRectangle; +- aRectangle.x = 0; +- aRectangle.y = nTotal - 1; +- aRectangle.width = HEADER_WIDTH - 1; +- aRectangle.height = rHeader.m_nSize; +- // Bottom line. +- cairo_rectangle(pCairo, aRectangle.x, aRectangle.y + aRectangle.height, aRectangle.width, 1); +- cairo_fill(pCairo); +- // Left line. +- cairo_rectangle(pCairo, aRectangle.width, aRectangle.y, 1, aRectangle.height); +- cairo_fill(pCairo); ++ if (m_eType == ROW) ++ { ++ aRectangle.x = 0; ++ aRectangle.y = nTotal - 1; ++ aRectangle.width = ROW_HEADER_WIDTH - 1; ++ aRectangle.height = rHeader.m_nSize; ++ // Bottom line. ++ cairo_rectangle(pCairo, aRectangle.x, aRectangle.y + aRectangle.height, aRectangle.width, 1); ++ cairo_fill(pCairo); ++ // Right line. ++ cairo_rectangle(pCairo, aRectangle.width, aRectangle.y, 1, aRectangle.height); ++ cairo_fill(pCairo); ++ } ++ else ++ { ++ aRectangle.x = nTotal -1; ++ aRectangle.y = 0; ++ aRectangle.width = rHeader.m_nSize; ++ aRectangle.height = COLUMN_HEADER_HEIGHT - 1; ++ // Right line. ++ cairo_rectangle(pCairo, aRectangle.x + aRectangle.width , aRectangle.y, 1, aRectangle.height); ++ cairo_fill(pCairo); ++ // Bottom line. ++ cairo_rectangle(pCairo, aRectangle.x, aRectangle.height, aRectangle.width, 1); ++ cairo_fill(pCairo); ++ } + drawText(pCairo, aRectangle, rHeader.m_aText); + nTotal += rHeader.m_nSize; +- if (nTotal > m_nHeightPixel) ++ if (nTotal > m_nSizePixel) + break; + } + + return FALSE; + } + +-gboolean TiledRowBar::docConfigureEvent(GtkWidget* pWidget, GdkEventConfigure* pEvent, gpointer pData) +-{ +- return static_cast(pData)->docConfigureEventImpl(pWidget, pEvent); +-} +- +-gboolean TiledRowBar::docConfigureEventImpl(GtkWidget* pDocView, GdkEventConfigure* /*pEvent*/) ++gboolean TiledRowColumnBar::docConfigureEvent(GtkWidget* pDocView, GdkEventConfigure* /*pEvent*/, gpointer /*pData*/) + { +- if (g_aWindows.find(gtk_widget_get_toplevel(pDocView)) == g_aWindows.end()) +- return TRUE; +- + TiledWindow& rWindow = lcl_getTiledWindow(pDocView); + GtkAdjustment* pVAdjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(rWindow.m_pScrolledWindow)); +- m_nHeightPixel = gtk_adjustment_get_page_size(pVAdjustment); ++ rWindow.m_pRowBar->m_nSizePixel = gtk_adjustment_get_page_size(pVAdjustment); ++ GtkAdjustment* pHAdjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(rWindow.m_pScrolledWindow)); ++ rWindow.m_pColumnBar->m_nSizePixel = gtk_adjustment_get_page_size(pHAdjustment); + + LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(LOK_DOC_VIEW(pDocView)); + if (pDocument && pDocument->pClass->getDocumentType(pDocument) == LOK_DOCTYPE_SPREADSHEET) + { +- m_aHeaders.clear(); + char* pValues = pDocument->pClass->getCommandValues(pDocument, ".uno:ViewRowColumnHeaders"); + std::stringstream aStream(pValues); + free(pValues); + assert(!aStream.str().empty()); + boost::property_tree::ptree aTree; + boost::property_tree::read_json(aStream, aTree); ++ ++ rWindow.m_pRowBar->m_aHeaders.clear(); + for (boost::property_tree::ptree::value_type& rValue : aTree.get_child("rows")) + { + Header aHeader(std::atoi(rValue.second.get("size").c_str()), rValue.second.get("text")); +- m_aHeaders.push_back(aHeader); ++ rWindow.m_pRowBar->m_aHeaders.push_back(aHeader); ++ } ++ gtk_widget_show(rWindow.m_pRowBar->m_pDrawingArea); ++ gtk_widget_queue_draw(rWindow.m_pRowBar->m_pDrawingArea); ++ ++ rWindow.m_pColumnBar->m_aHeaders.clear(); ++ for (boost::property_tree::ptree::value_type& rValue : aTree.get_child("columns")) ++ { ++ Header aHeader(std::atoi(rValue.second.get("size").c_str()), rValue.second.get("text")); ++ rWindow.m_pColumnBar->m_aHeaders.push_back(aHeader); + } +- gtk_widget_show(m_pDrawingArea); +- gtk_widget_queue_draw(m_pDrawingArea); ++ gtk_widget_show(rWindow.m_pColumnBar->m_pDrawingArea); ++ gtk_widget_queue_draw(rWindow.m_pColumnBar->m_pDrawingArea); + } + + return TRUE; +@@ -915,17 +943,22 @@ static GtkWidget* createWindow(TiledWindow& rWindow) + + gtk_box_pack_end(GTK_BOX(rWindow.m_pVBox), rWindow.m_pFindbar, FALSE, FALSE, 0); + +- // Horizontal box for the row bar + doc view. +- GtkWidget* pHBox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); +- gtk_container_add(GTK_CONTAINER(rWindow.m_pVBox), pHBox); +- rWindow.m_pRowBar.reset(new TiledRowBar(rWindow.m_pDocView)); +- gtk_box_pack_start(GTK_BOX(pHBox), rWindow.m_pRowBar->m_pDrawingArea, FALSE, FALSE, 0); ++ // Grid for the row/column bar + doc view. ++ GtkWidget* pGrid = gtk_grid_new(); ++ gtk_container_add(GTK_CONTAINER(rWindow.m_pVBox), pGrid); ++ rWindow.m_pRowBar.reset(new TiledRowColumnBar(TiledRowColumnBar::ROW)); ++ // "A2" cell of the grid. ++ gtk_grid_attach(GTK_GRID(pGrid), rWindow.m_pRowBar->m_pDrawingArea, 0, 1, 1, 1); ++ rWindow.m_pColumnBar.reset(new TiledRowColumnBar(TiledRowColumnBar::COLUMN)); ++ // "B1" cell of the grid. ++ gtk_grid_attach(GTK_GRID(pGrid), rWindow.m_pColumnBar->m_pDrawingArea, 1, 0, 1, 1); + + // Scrolled window for DocView + rWindow.m_pScrolledWindow = gtk_scrolled_window_new(0, 0); + gtk_widget_set_hexpand(rWindow.m_pScrolledWindow, TRUE); + gtk_widget_set_vexpand(rWindow.m_pScrolledWindow, TRUE); +- gtk_container_add(GTK_CONTAINER(pHBox), rWindow.m_pScrolledWindow); ++ // "B2" cell of the grid ++ gtk_grid_attach(GTK_GRID(pGrid), rWindow.m_pScrolledWindow, 1, 1, 1, 1); + + gtk_container_add(GTK_CONTAINER(rWindow.m_pScrolledWindow), rWindow.m_pDocView); + +@@ -942,10 +975,12 @@ static GtkWidget* createWindow(TiledWindow& rWindow) + gtk_widget_show_all(pWindow); + // Hide the findbar by default. + gtk_widget_hide(rWindow.m_pFindbar); +- // Same for the row bar. ++ // Same for the row/column bar. + gtk_widget_hide(rWindow.m_pRowBar->m_pDrawingArea); ++ gtk_widget_hide(rWindow.m_pColumnBar->m_pDrawingArea); + + g_aWindows[pWindow] = rWindow; ++ g_signal_connect(rWindow.m_pDocView, "configure-event", G_CALLBACK(TiledRowColumnBar::docConfigureEvent), 0); + return pWindow; + } + +-- +2.12.0 + diff --git a/SOURCES/0247-gtktiledviewer-add-missing-spreadsheet-corner-button.patch b/SOURCES/0247-gtktiledviewer-add-missing-spreadsheet-corner-button.patch new file mode 100644 index 0000000..2f1a539 --- /dev/null +++ b/SOURCES/0247-gtktiledviewer-add-missing-spreadsheet-corner-button.patch @@ -0,0 +1,129 @@ +From d2cc43af0d971232e843b20a7f2370baf5aecd17 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 30 Oct 2015 16:20:58 +0100 +Subject: [PATCH 247/398] gtktiledviewer: add missing spreadsheet corner button + +Change-Id: I3a7af693ccdce2012ddbaa6a3ac8321f29b6356c +(cherry picked from commit f5ab3e84dfd58722dc74c7369c1ad67237ca462e) +--- + .../qa/gtktiledviewer/gtktiledviewer.cxx | 52 +++++++++++++++++++++- + 1 file changed, 51 insertions(+), 1 deletion(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 08058e8699c9..eec80ba0b727 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -67,6 +67,16 @@ public: + static void drawText(cairo_t* pCairo, const GdkRectangle& rRectangle, const std::string& rText); + }; + ++/// Represents the button at the top left corner for spreadsheets. ++class TiledCornerButton ++{ ++public: ++ GtkWidget* m_pDrawingArea; ++ TiledCornerButton(); ++ static gboolean draw(GtkWidget* pWidget, cairo_t* pCairo, gpointer pData); ++ gboolean drawImpl(GtkWidget* pWidget, cairo_t* pCairo); ++}; ++ + /// Represents all the state that is specific to one GtkWindow of this app. + class TiledWindow + { +@@ -93,6 +103,7 @@ public: + bool m_bFindAll; + std::shared_ptr m_pRowBar; + std::shared_ptr m_pColumnBar; ++ std::shared_ptr m_pCornerButton; + + TiledWindow() + : m_pDocView(0), +@@ -169,6 +180,9 @@ gboolean TiledRowColumnBar::drawImpl(GtkWidget* /*pWidget*/, cairo_t* pCairo) + aRectangle.y = nTotal - 1; + aRectangle.width = ROW_HEADER_WIDTH - 1; + aRectangle.height = rHeader.m_nSize; ++ // Left line. ++ cairo_rectangle(pCairo, aRectangle.x, aRectangle.y, 1, aRectangle.height); ++ cairo_fill(pCairo); + // Bottom line. + cairo_rectangle(pCairo, aRectangle.x, aRectangle.y + aRectangle.height, aRectangle.width, 1); + cairo_fill(pCairo); +@@ -178,10 +192,13 @@ gboolean TiledRowColumnBar::drawImpl(GtkWidget* /*pWidget*/, cairo_t* pCairo) + } + else + { +- aRectangle.x = nTotal -1; ++ aRectangle.x = nTotal - 1; + aRectangle.y = 0; + aRectangle.width = rHeader.m_nSize; + aRectangle.height = COLUMN_HEADER_HEIGHT - 1; ++ // Top line. ++ cairo_rectangle(pCairo, aRectangle.x, aRectangle.y, aRectangle.width, 1); ++ cairo_fill(pCairo); + // Right line. + cairo_rectangle(pCairo, aRectangle.x + aRectangle.width , aRectangle.y, 1, aRectangle.height); + cairo_fill(pCairo); +@@ -216,6 +233,8 @@ gboolean TiledRowColumnBar::docConfigureEvent(GtkWidget* pDocView, GdkEventConfi + boost::property_tree::ptree aTree; + boost::property_tree::read_json(aStream, aTree); + ++ gtk_widget_show(rWindow.m_pCornerButton->m_pDrawingArea); ++ + rWindow.m_pRowBar->m_aHeaders.clear(); + for (boost::property_tree::ptree::value_type& rValue : aTree.get_child("rows")) + { +@@ -238,6 +257,33 @@ gboolean TiledRowColumnBar::docConfigureEvent(GtkWidget* pDocView, GdkEventConfi + return TRUE; + } + ++TiledCornerButton::TiledCornerButton() ++ : m_pDrawingArea(gtk_drawing_area_new()) ++{ ++ gtk_widget_set_size_request(m_pDrawingArea, TiledRowColumnBar::ROW_HEADER_WIDTH, TiledRowColumnBar::COLUMN_HEADER_HEIGHT); ++ g_signal_connect(m_pDrawingArea, "draw", G_CALLBACK(TiledCornerButton::draw), this); ++} ++ ++gboolean TiledCornerButton::draw(GtkWidget* pWidget, cairo_t* pCairo, gpointer pData) ++{ ++ return static_cast(pData)->drawImpl(pWidget, pCairo); ++} ++ ++gboolean TiledCornerButton::drawImpl(GtkWidget* /*pWidget*/, cairo_t* pCairo) ++{ ++ cairo_set_source_rgb(pCairo, 0, 0, 0); ++ ++ GdkRectangle aRectangle; ++ aRectangle.x = 0; ++ aRectangle.y = 0; ++ aRectangle.width = TiledRowColumnBar::ROW_HEADER_WIDTH; ++ aRectangle.height = TiledRowColumnBar::COLUMN_HEADER_HEIGHT; ++ cairo_rectangle(pCairo, aRectangle.x, aRectangle.y, aRectangle.width, aRectangle.height); ++ cairo_stroke(pCairo); ++ ++ return FALSE; ++} ++ + static void lcl_registerToolItem(TiledWindow& rWindow, GtkToolItem* pItem, const std::string& rName) + { + rWindow.m_aToolItemCommandNames[pItem] = rName; +@@ -946,6 +992,9 @@ static GtkWidget* createWindow(TiledWindow& rWindow) + // Grid for the row/column bar + doc view. + GtkWidget* pGrid = gtk_grid_new(); + gtk_container_add(GTK_CONTAINER(rWindow.m_pVBox), pGrid); ++ rWindow.m_pCornerButton.reset(new TiledCornerButton()); ++ // "A1" cell of the grid. ++ gtk_grid_attach(GTK_GRID(pGrid), rWindow.m_pCornerButton->m_pDrawingArea, 0, 0, 1, 1); + rWindow.m_pRowBar.reset(new TiledRowColumnBar(TiledRowColumnBar::ROW)); + // "A2" cell of the grid. + gtk_grid_attach(GTK_GRID(pGrid), rWindow.m_pRowBar->m_pDrawingArea, 0, 1, 1, 1); +@@ -976,6 +1025,7 @@ static GtkWidget* createWindow(TiledWindow& rWindow) + // Hide the findbar by default. + gtk_widget_hide(rWindow.m_pFindbar); + // Same for the row/column bar. ++ gtk_widget_hide(rWindow.m_pCornerButton->m_pDrawingArea); + gtk_widget_hide(rWindow.m_pRowBar->m_pDrawingArea); + gtk_widget_hide(rWindow.m_pColumnBar->m_pDrawingArea); + +-- +2.12.0 + diff --git a/SOURCES/0248-loplugin-staticmethods.patch b/SOURCES/0248-loplugin-staticmethods.patch new file mode 100644 index 0000000..5733711 --- /dev/null +++ b/SOURCES/0248-loplugin-staticmethods.patch @@ -0,0 +1,39 @@ +From 0fb26aeb7fb8385ee19b1d79aeaa9dd51ed18071 Mon Sep 17 00:00:00 2001 +From: Stephan Bergmann +Date: Fri, 30 Oct 2015 16:54:39 +0100 +Subject: [PATCH 248/398] loplugin:staticmethods + +Change-Id: I9ac908d0981734e4b2930a79f160ec0462127483 +(cherry picked from commit 86585175a607982f0549ddad19851f1ebf52148c) +--- + libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index eec80ba0b727..1049c288a14b 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -74,7 +74,7 @@ public: + GtkWidget* m_pDrawingArea; + TiledCornerButton(); + static gboolean draw(GtkWidget* pWidget, cairo_t* pCairo, gpointer pData); +- gboolean drawImpl(GtkWidget* pWidget, cairo_t* pCairo); ++ static gboolean drawImpl(GtkWidget* pWidget, cairo_t* pCairo); + }; + + /// Represents all the state that is specific to one GtkWindow of this app. +@@ -264,9 +264,9 @@ TiledCornerButton::TiledCornerButton() + g_signal_connect(m_pDrawingArea, "draw", G_CALLBACK(TiledCornerButton::draw), this); + } + +-gboolean TiledCornerButton::draw(GtkWidget* pWidget, cairo_t* pCairo, gpointer pData) ++gboolean TiledCornerButton::draw(GtkWidget* pWidget, cairo_t* pCairo, gpointer) + { +- return static_cast(pData)->drawImpl(pWidget, pCairo); ++ return drawImpl(pWidget, pCairo); + } + + gboolean TiledCornerButton::drawImpl(GtkWidget* /*pWidget*/, cairo_t* pCairo) +-- +2.12.0 + diff --git a/SOURCES/0249-sc-lok-Always-provide-a-reasonable-document-size.patch b/SOURCES/0249-sc-lok-Always-provide-a-reasonable-document-size.patch new file mode 100644 index 0000000..30c8f9b --- /dev/null +++ b/SOURCES/0249-sc-lok-Always-provide-a-reasonable-document-size.patch @@ -0,0 +1,44 @@ +From abae8af12a4ecb926261a4cee6f92561478ac606 Mon Sep 17 00:00:00 2001 +From: Jan Holesovsky +Date: Sat, 31 Oct 2015 00:24:17 +0100 +Subject: [PATCH 249/398] sc lok: Always provide a reasonable document size. + +With an empty document, GetPrintArea() returned false, causing nothing visible +on the screen. + +Also increase the values when I'm touching this. + +Change-Id: Iee7544a428d5d4d5d5931230a51e605302557f41 +(cherry picked from commit 5409dc0847a4ec17f5791f577249d47913f12b48) +--- + sc/source/core/data/documen2.cxx | 11 +++++------ + 1 file changed, 5 insertions(+), 6 deletions(-) + +diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx +index 8d3e4e3d3b8f..2a305c032f2b 100644 +--- a/sc/source/core/data/documen2.cxx ++++ b/sc/source/core/data/documen2.cxx +@@ -708,15 +708,14 @@ bool ScDocument::GetDataStart( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow ) + + bool ScDocument::GetTiledRenderingArea(SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow) const + { +- if (!GetPrintArea(nTab, rEndCol, rEndRow, false)) +- return false; ++ bool bHasPrintArea = GetPrintArea(nTab, rEndCol, rEndRow, false); + + // we need some reasonable minimal document size +- if (rEndCol < 12) +- rEndCol = 12; ++ if (!bHasPrintArea || rEndCol < 20) ++ rEndCol = 20; + +- if (rEndRow < 36) +- rEndRow = 36; ++ if (!bHasPrintArea || rEndRow < 50) ++ rEndRow = 50; + + return true; + } +-- +2.12.0 + diff --git a/SOURCES/0250-lokdocview-Fix-memory-leaks.patch b/SOURCES/0250-lokdocview-Fix-memory-leaks.patch new file mode 100644 index 0000000..c85116c --- /dev/null +++ b/SOURCES/0250-lokdocview-Fix-memory-leaks.patch @@ -0,0 +1,165 @@ +From 565d5396ec1285508ca20544ab01569819b4b540 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Sun, 25 Oct 2015 19:22:46 +0530 +Subject: [PATCH 250/398] lokdocview: Fix memory leaks + +Change-Id: I5107e4fa1828145a709e1edffe02831f4faae3c8 +Reviewed-on: https://gerrit.libreoffice.org/19676 +Tested-by: Jenkins +Reviewed-by: Miklos Vajna +(cherry picked from commit cfbc36e2eade42e471056d3c32fc962cd3149c17) +--- + libreofficekit/source/gtk/lokdocview.cxx | 33 ++++++++++++++++---------------- + libreofficekit/source/gtk/tilebuffer.cxx | 5 +++++ + libreofficekit/source/gtk/tilebuffer.hxx | 8 ++++++-- + 3 files changed, 28 insertions(+), 18 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 29b028c7b5d0..2ec27305af4e 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -50,7 +50,7 @@ struct LOKDocViewPrivateImpl + LibreOfficeKit* m_pOffice; + LibreOfficeKitDocument* m_pDocument; + +- TileBuffer m_aTileBuffer; ++ std::unique_ptr m_pTileBuffer; + GThreadPool* lokThreadPool; + + gfloat m_fZoom; +@@ -503,9 +503,8 @@ static gboolean postDocumentLoad(gpointer pData) + // Total number of columns in this document. + guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); + +- +- priv->m_aTileBuffer = TileBuffer(priv->m_pDocument, +- nColumns); ++ priv->m_pTileBuffer = std::unique_ptr(new TileBuffer(priv->m_pDocument, ++ nColumns)); + gtk_widget_set_size_request(GTK_WIDGET(pLOKDocView), + nDocumentWidthPixels, + nDocumentHeightPixels); +@@ -634,7 +633,7 @@ setTilesInvalid (LOKDocView* pDocView, const GdkRectangle& rRectangle) + for (int j = aStart.y; j < aEnd.y; j++) + { + GTask* task = g_task_new(pDocView, NULL, NULL, NULL); +- priv->m_aTileBuffer.setInvalid(i, j, priv->m_fZoom, task, priv->lokThreadPool); ++ priv->m_pTileBuffer->setInvalid(i, j, priv->m_fZoom, task, priv->lokThreadPool); + g_object_unref(task); + } + } +@@ -657,7 +656,7 @@ callback (gpointer pData) + setTilesInvalid(pDocView, aRectangle); + } + else +- priv->m_aTileBuffer.resetAllTiles(); ++ priv->m_pTileBuffer->resetAllTiles(); + + gtk_widget_queue_draw(GTK_WIDGET(pDocView)); + } +@@ -923,7 +922,7 @@ renderDocument(LOKDocView* pDocView, cairo_t* pCairo) + if (bPaint) + { + GTask* task = g_task_new(pDocView, NULL, NULL, NULL); +- Tile& currentTile = priv->m_aTileBuffer.getTile(nRow, nColumn, priv->m_fZoom, task, priv->lokThreadPool); ++ Tile& currentTile = priv->m_pTileBuffer->getTile(nRow, nColumn, priv->m_fZoom, task, priv->lokThreadPool); + GdkPixbuf* pPixBuf = currentTile.getBuffer(); + gdk_cairo_set_source_pixbuf (pCairo, pPixBuf, + twipToPixel(aTileRectangleTwips.x, priv->m_fZoom), +@@ -1484,10 +1483,10 @@ paintTileInThread (gpointer data) + LOKDocView* pDocView = LOK_DOC_VIEW(g_task_get_source_object(task)); + LOKDocViewPrivate& priv = getPrivate(pDocView); + LOEvent* pLOEvent = static_cast(g_task_get_task_data(task)); +- TileBuffer& buffer = priv->m_aTileBuffer; +- int index = pLOEvent->m_nPaintTileX * buffer.m_nWidth + pLOEvent->m_nPaintTileY; +- if (buffer.m_mTiles.find(index) != buffer.m_mTiles.end() && +- buffer.m_mTiles[index].valid) ++ std::unique_ptr& buffer = priv->m_pTileBuffer; ++ int index = pLOEvent->m_nPaintTileX * buffer->m_nWidth + pLOEvent->m_nPaintTileY; ++ if (buffer->m_mTiles.find(index) != buffer->m_mTiles.end() && ++ buffer->m_mTiles[index].valid) + return; + + GdkPixbuf* pPixBuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, nTileSizePixels, nTileSizePixels); +@@ -1518,9 +1517,11 @@ paintTileInThread (gpointer data) + pixelToTwip(nTileSizePixels, pLOEvent->m_fPaintTileZoom)); + + //create a mapping for it +- buffer.m_mTiles[index].setPixbuf(pPixBuf); +- buffer.m_mTiles[index].valid = true; ++ buffer->m_mTiles[index].setPixbuf(pPixBuf); ++ buffer->m_mTiles[index].valid = true; + gdk_threads_add_idle(queueDraw, GTK_WIDGET(pDocView)); ++ ++ g_object_unref(pPixBuf); + } + + +@@ -2129,8 +2130,8 @@ lok_doc_view_set_zoom (LOKDocView* pDocView, float fZoom) + // Total number of columns in this document. + guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); + +- priv->m_aTileBuffer = TileBuffer(priv->m_pDocument, +- nColumns); ++ priv->m_pTileBuffer = std::unique_ptr(new TileBuffer(priv->m_pDocument, ++ nColumns)); + gtk_widget_set_size_request(GTK_WIDGET(pDocView), + nDocumentWidthPixels, + nDocumentHeightPixels); +@@ -2211,7 +2212,7 @@ SAL_DLLPUBLIC_EXPORT void + lok_doc_view_reset_view(LOKDocView* pDocView) + { + LOKDocViewPrivate& priv = getPrivate(pDocView); +- priv->m_aTileBuffer.resetAllTiles(); ++ priv->m_pTileBuffer->resetAllTiles(); + priv->m_nLoadProgress = 0.0; + + memset(&priv->m_aVisibleCursor, 0, sizeof(priv->m_aVisibleCursor)); +diff --git a/libreofficekit/source/gtk/tilebuffer.cxx b/libreofficekit/source/gtk/tilebuffer.cxx +index 2f4e6cf123c1..811fcc61ef46 100644 +--- a/libreofficekit/source/gtk/tilebuffer.cxx ++++ b/libreofficekit/source/gtk/tilebuffer.cxx +@@ -41,6 +41,11 @@ void Tile::release() + + void Tile::setPixbuf(GdkPixbuf *buffer) + { ++ if (m_pBuffer == buffer) ++ return; ++ g_clear_object(&m_pBuffer); ++ if (buffer != NULL) ++ g_object_ref(buffer); + m_pBuffer = buffer; + } + +diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx +index 9361a622fb7c..bef1444f9c9c 100644 +--- a/libreofficekit/source/gtk/tilebuffer.hxx ++++ b/libreofficekit/source/gtk/tilebuffer.hxx +@@ -52,7 +52,10 @@ class Tile + { + public: + Tile() : valid(false), m_pBuffer(0) {} +- ~Tile() { } ++ ~Tile() ++ { ++ g_clear_object(&m_pBuffer); ++ } + + /** + Tells if this tile is valid or not. Initialised to 0 (invalid) during +@@ -85,10 +88,11 @@ class TileBuffer + TileBuffer(LibreOfficeKitDocument *document = 0, + int columns = 0) + : m_pLOKDocument(document) +- , m_nWidth(columns) ++ , m_nWidth(columns) + { + GdkPixbuf* pPixBuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, nTileSizePixels, nTileSizePixels); + m_DummyTile.setPixbuf(pPixBuf); ++ g_object_unref(pPixBuf); + } + + ~TileBuffer() {} +-- +2.12.0 + diff --git a/SOURCES/0251-android-don-t-use-alpha-VDev-when-painting-tiles-on-.patch b/SOURCES/0251-android-don-t-use-alpha-VDev-when-painting-tiles-on-.patch new file mode 100644 index 0000000..ed10264 --- /dev/null +++ b/SOURCES/0251-android-don-t-use-alpha-VDev-when-painting-tiles-on-.patch @@ -0,0 +1,69 @@ +From 8e257245396ec0f9edde494904a1c7d9835535bd Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Toma=C5=BE=20Vajngerl?= +Date: Sat, 31 Oct 2015 13:59:46 +0100 +Subject: [PATCH 251/398] android: don't use alpha VDev when painting tiles on + Android + +Improves tile rendering speed. + +Change-Id: I6a4b87fbc1d9ed284f5c4a781d769eeacd9bc2ca +(cherry picked from commit e0d68da3ff3ae81e35f4e7393fb998a41886831d) +--- + desktop/source/lib/init.cxx | 34 ++++++++++++++++++++++++---------- + 1 file changed, 24 insertions(+), 10 deletions(-) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 6785ae2328d4..98747ea62e3a 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -773,7 +773,30 @@ void doc_paintTile (LibreOfficeKitDocument* pThis, + + #if defined(UNX) && !defined(MACOSX) && !defined(ENABLE_HEADLESS) + +-#ifndef IOS ++#if defined(IOS) ++ SystemGraphicsData aData; ++ aData.rCGContext = reinterpret_cast(pBuffer); ++ // the Size argument is irrelevant, I hope ++ ScopedVclPtrInstance pDevice(&aData, Size(1, 1), (sal_uInt16)0); ++ ++ pDoc->paintTile(*pDevice.get(), nCanvasWidth, nCanvasHeight, ++ nTilePosX, nTilePosY, nTileWidth, nTileHeight); ++#elif defined(ANDROID) ++ InitSvpForLibreOfficeKit(); ++ ++ ScopedVclPtrInstance< VirtualDevice > pDevice(nullptr, Size(1, 1), (sal_uInt16)32) ; ++ ++ boost::shared_array aBuffer(pBuffer, NoDelete< sal_uInt8 >()); ++ ++ boost::shared_array aAlphaBuffer; ++ ++ pDevice->SetOutputSizePixelScaleOffsetAndBuffer( ++ Size(nCanvasWidth, nCanvasHeight), Fraction(1.0), Point(), ++ aBuffer, aAlphaBuffer, true); ++ ++ pDoc->paintTile(*pDevice.get(), nCanvasWidth, nCanvasHeight, ++ nTilePosX, nTilePosY, nTileWidth, nTileHeight); ++#else + InitSvpForLibreOfficeKit(); + + ScopedVclPtrInstance< VirtualDevice > pDevice(nullptr, Size(1, 1), (sal_uInt16)32) ; +@@ -806,15 +829,6 @@ void doc_paintTile (LibreOfficeKitDocument* pThis, + pBuffer[nOffset * 4 +3] = 0xff - aAlpha[nOffset]; + } + } +- +-#else +- SystemGraphicsData aData; +- aData.rCGContext = reinterpret_cast(pBuffer); +- // the Size argument is irrelevant, I hope +- ScopedVclPtrInstance pDevice(&aData, Size(1, 1), (sal_uInt16)0); +- +- pDoc->paintTile(*pDevice.get(), nCanvasWidth, nCanvasHeight, +- nTilePosX, nTilePosY, nTileWidth, nTileHeight); + #endif + + static bool bDebug = getenv("LOK_DEBUG") != 0; +-- +2.12.0 + diff --git a/SOURCES/0252-add-LOKit-interface-missing-description.patch b/SOURCES/0252-add-LOKit-interface-missing-description.patch new file mode 100644 index 0000000..719d904 --- /dev/null +++ b/SOURCES/0252-add-LOKit-interface-missing-description.patch @@ -0,0 +1,37 @@ +From 21af7ed50479037d9574d5a8061b4ca98065c702 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Toma=C5=BE=20Vajngerl?= +Date: Sun, 1 Nov 2015 22:37:12 +0100 +Subject: [PATCH 252/398] add LOKit interface missing description + +Change-Id: Ia9e33704cfffd2094606e6fd166796bd8cd5d4fe +(cherry picked from commit 3d34594138c42ec4b253a25c403ef9346265a28f) +--- + include/LibreOfficeKit/LibreOfficeKit.hxx | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx +index 0e83a63c3fe5..6673cd731eb7 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.hxx ++++ b/include/LibreOfficeKit/LibreOfficeKit.hxx +@@ -129,8 +129,7 @@ public: + * @param nTileWidth logical width of the rendered rectangle, in TWIPs. + * @param nTileHeight logical height of the rendered rectangle, in TWIPs. + */ +- inline void paintTile( +- unsigned char* pBuffer, ++ inline void paintTile(unsigned char* pBuffer, + const int nCanvasWidth, + const int nCanvasHeight, + const int nTilePosX, +@@ -192,6 +191,8 @@ public: + * @param nX horizontal position in document coordinates + * @param nY vertical position in document coordinates + * @param nCount number of clicks: 1 for single click, 2 for double click ++ * @param nButtons: which mouse buttons: 1 for left, 2 for middle, 4 right ++ * @param nModifier: which keyboard modifier: (see include/rsc/rsc-vcl-shared-types.hxx for possible values) + */ + inline void postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier) + { +-- +2.12.0 + diff --git a/SOURCES/0253-gtktiledviewer-add-a-few-more-trivial-buttons-and-br.patch b/SOURCES/0253-gtktiledviewer-add-a-few-more-trivial-buttons-and-br.patch new file mode 100644 index 0000000..d2ed897 --- /dev/null +++ b/SOURCES/0253-gtktiledviewer-add-a-few-more-trivial-buttons-and-br.patch @@ -0,0 +1,266 @@ +From 9c22806888e899bd9ab7166bad8e0d78a35c1de4 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Mon, 2 Nov 2015 09:13:28 +0100 +Subject: [PATCH 253/398] gtktiledviewer: add a few more trivial buttons and + break the toolbar into two + +Change-Id: Iea8f32fb8c388b49dad8119f816502f593ebadeb +(cherry picked from commit 96f2e0730bbfd1cdc0bae131cd35b63f97f5268a) +--- + .../qa/gtktiledviewer/gtktiledviewer.cxx | 168 +++++++++++++++------ + 1 file changed, 120 insertions(+), 48 deletions(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 1049c288a14b..822a6cb3c4bd 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -88,6 +88,12 @@ public: + GtkToolItem* m_pItalic; + GtkToolItem* m_pUnderline; + GtkToolItem* m_pStrikethrough; ++ GtkToolItem* m_pSuperscript; ++ GtkToolItem* m_pSubscript; ++ GtkToolItem* m_pLeftpara; ++ GtkToolItem* m_pCenterpara; ++ GtkToolItem* m_pRightpara; ++ GtkToolItem* m_pJustifypara; + GtkWidget* m_pScrolledWindow; + std::map m_aToolItemCommandNames; + std::map m_aCommandNameToolItems; +@@ -113,6 +119,12 @@ public: + m_pItalic(0), + m_pUnderline(0), + m_pStrikethrough(0), ++ m_pSuperscript(0), ++ m_pSubscript(0), ++ m_pLeftpara(0), ++ m_pCenterpara(0), ++ m_pRightpara(0), ++ m_pJustifypara(0), + m_pScrolledWindow(0), + m_bToolItemBroadcast(true), + m_pVBox(0), +@@ -845,112 +857,172 @@ static GtkWidget* createWindow(TiledWindow& rWindow) + rWindow.m_pVBox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); + gtk_container_add(GTK_CONTAINER(pWindow), rWindow.m_pVBox); + +- // Toolbar +- GtkWidget* pToolbar = gtk_toolbar_new(); +- gtk_toolbar_set_style(GTK_TOOLBAR(pToolbar), GTK_TOOLBAR_ICONS); ++ // Upper toolbar. ++ GtkWidget* pUpperToolbar = gtk_toolbar_new(); ++ gtk_toolbar_set_style(GTK_TOOLBAR(pUpperToolbar), GTK_TOOLBAR_ICONS); + ++ // Save. ++ GtkToolItem* pSave = gtk_tool_button_new(NULL, NULL); ++ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(pSave), "document-save-symbolic"); ++ gtk_tool_item_set_tooltip_text(pSave, "Save"); ++ gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), pSave, -1); ++ gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), gtk_separator_tool_item_new(), -1); ++ g_signal_connect(G_OBJECT(pSave), "clicked", G_CALLBACK(toggleToolItem), NULL); ++ lcl_registerToolItem(rWindow, pSave, ".uno:Save"); ++ ++ // Copy and paste. ++ GtkToolItem* pCopyButton = gtk_tool_button_new( NULL, NULL); ++ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(pCopyButton), "edit-copy-symbolic"); ++ gtk_tool_item_set_tooltip_text(pCopyButton, "Copy"); ++ gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), pCopyButton, -1); ++ g_signal_connect(G_OBJECT(pCopyButton), "clicked", G_CALLBACK(doCopy), NULL); ++ GtkToolItem* pPasteButton = gtk_tool_button_new( NULL, NULL); ++ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(pPasteButton), "edit-paste-symbolic"); ++ gtk_tool_item_set_tooltip_text(pPasteButton, "Paste"); ++ gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), pPasteButton, -1); ++ g_signal_connect(G_OBJECT(pPasteButton), "clicked", G_CALLBACK(doPaste), NULL); ++ gtk_toolbar_insert( GTK_TOOLBAR(pUpperToolbar), gtk_separator_tool_item_new(), -1); ++ ++ // Undo and redo. ++ GtkToolItem* pUndo = gtk_tool_button_new(NULL, NULL); ++ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(pUndo), "edit-undo-symbolic"); ++ gtk_tool_item_set_tooltip_text(pUndo, "Undo"); ++ gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), pUndo, -1); ++ g_signal_connect(G_OBJECT(pUndo), "clicked", G_CALLBACK(toggleToolItem), NULL); ++ lcl_registerToolItem(rWindow, pUndo, ".uno:Undo"); ++ GtkToolItem* pRedo = gtk_tool_button_new(NULL, NULL); ++ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(pRedo), "edit-redo-symbolic"); ++ gtk_tool_item_set_tooltip_text(pRedo, "Redo"); ++ gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), pRedo, -1); ++ g_signal_connect(G_OBJECT(pRedo), "clicked", G_CALLBACK(toggleToolItem), NULL); ++ lcl_registerToolItem(rWindow, pRedo, ".uno:Redo"); ++ gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), gtk_separator_tool_item_new(), -1); ++ ++ // Find. ++ GtkToolItem* pFindButton = gtk_tool_button_new( NULL, NULL); ++ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pFindButton), "edit-find-symbolic"); ++ gtk_tool_item_set_tooltip_text(pFindButton, "Find"); ++ gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), pFindButton, -1); ++ g_signal_connect(G_OBJECT(pFindButton), "clicked", G_CALLBACK(toggleFindbar), NULL); ++ gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), gtk_separator_tool_item_new(), -1); ++ ++ // Misc upper toolbar. + GtkToolItem* pZoomIn = gtk_tool_button_new(NULL, NULL); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pZoomIn), "zoom-in-symbolic"); + gtk_tool_item_set_tooltip_text(pZoomIn, "Zoom In"); +- gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pZoomIn, 0); ++ gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), pZoomIn, -1); + g_signal_connect(G_OBJECT(pZoomIn), "clicked", G_CALLBACK(changeZoom), NULL); + + GtkToolItem* pZoom1 = gtk_tool_button_new(NULL, NULL); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(pZoom1), "zoom-original-symbolic"); + gtk_tool_item_set_tooltip_text(pZoom1, "Normal Size"); +- gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pZoom1, -1); ++ gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), pZoom1, -1); + g_signal_connect(G_OBJECT(pZoom1), "clicked", G_CALLBACK(changeZoom), NULL); + + GtkToolItem* pZoomOut = gtk_tool_button_new(NULL, NULL); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pZoomOut), "zoom-out-symbolic"); + gtk_tool_item_set_tooltip_text(pZoomOut, "Zoom Out"); +- gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pZoomOut, -1); ++ gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), pZoomOut, -1); + g_signal_connect(G_OBJECT(pZoomOut), "clicked", G_CALLBACK(changeZoom), NULL); + +- GtkToolItem* pSeparator1 = gtk_separator_tool_item_new(); +- gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pSeparator1, -1); +- + GtkToolItem* pPartSelectorToolItem = gtk_tool_item_new(); + GtkWidget* pComboBox = gtk_combo_box_text_new(); + gtk_container_add(GTK_CONTAINER(pPartSelectorToolItem), pComboBox); +- gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pPartSelectorToolItem, -1); ++ gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), pPartSelectorToolItem, -1); + + rWindow.m_pPartSelector = GTK_COMBO_BOX_TEXT(pComboBox); + +- GtkToolItem* pSeparator2 = gtk_separator_tool_item_new(); +- gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pSeparator2, -1); +- + GtkToolItem* pPartModeSelectorToolItem = gtk_tool_item_new(); + rWindow.m_pPartModeComboBox = gtk_combo_box_text_new(); + gtk_container_add(GTK_CONTAINER(pPartModeSelectorToolItem), rWindow.m_pPartModeComboBox); +- gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pPartModeSelectorToolItem, -1); +- +- gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), gtk_separator_tool_item_new(), -1); +- +- // Cut, copy & paste. +- GtkToolItem* pCopyButton = gtk_tool_button_new( NULL, NULL); +- gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(pCopyButton), "edit-copy-symbolic"); +- gtk_tool_item_set_tooltip_text(pCopyButton, "Copy"); +- gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pCopyButton, -1); +- g_signal_connect(G_OBJECT(pCopyButton), "clicked", G_CALLBACK(doCopy), NULL); +- +- GtkToolItem* pPasteButton = gtk_tool_button_new( NULL, NULL); +- gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(pPasteButton), "edit-paste-symbolic"); +- gtk_tool_item_set_tooltip_text(pPasteButton, "Paste"); +- gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pPasteButton, -1); +- g_signal_connect(G_OBJECT(pPasteButton), "clicked", G_CALLBACK(doPaste), NULL); +- gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), gtk_separator_tool_item_new(), -1); ++ gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), pPartModeSelectorToolItem, -1); + + GtkToolItem* pEnableEditing = gtk_toggle_tool_button_new(); + rWindow.m_pEnableEditing = pEnableEditing; + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pEnableEditing), "insert-text-symbolic"); + gtk_tool_item_set_tooltip_text(pEnableEditing, "Edit"); +- gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pEnableEditing, -1); ++ gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), pEnableEditing, -1); + g_signal_connect(G_OBJECT(pEnableEditing), "toggled", G_CALLBACK(toggleEditing), NULL); + +- GtkToolItem* pFindButton = gtk_tool_button_new( NULL, NULL); +- gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pFindButton), "edit-find-symbolic"); +- gtk_tool_item_set_tooltip_text(pFindButton, "Find"); +- gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pFindButton, -1); +- g_signal_connect(G_OBJECT(pFindButton), "clicked", G_CALLBACK(toggleFindbar), NULL); +- + GtkToolItem* pNewViewButton = gtk_tool_button_new( NULL, NULL); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pNewViewButton), "view-continuous-symbolic"); + gtk_tool_item_set_tooltip_text(pNewViewButton, "New View"); +- gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pNewViewButton, -1); ++ gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), pNewViewButton, -1); + g_signal_connect(G_OBJECT(pNewViewButton), "clicked", G_CALLBACK(createView), NULL); ++ gtk_box_pack_start(GTK_BOX(rWindow.m_pVBox), pUpperToolbar, FALSE, FALSE, 0 ); // Adds to top. + +- gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), gtk_separator_tool_item_new(), -1); ++ // Lower toolbar. ++ GtkWidget* pLowerToolbar = gtk_toolbar_new(); ++ gtk_toolbar_set_style(GTK_TOOLBAR(pLowerToolbar), GTK_TOOLBAR_ICONS); + ++ // Bold, italic, underline and strikethrough. + rWindow.m_pBold = gtk_toggle_tool_button_new(); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(rWindow.m_pBold), "format-text-bold-symbolic"); + gtk_tool_item_set_tooltip_text(rWindow.m_pBold, "Bold"); +- gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), rWindow.m_pBold, -1); ++ gtk_toolbar_insert(GTK_TOOLBAR(pLowerToolbar), rWindow.m_pBold, -1); + g_signal_connect(G_OBJECT(rWindow.m_pBold), "toggled", G_CALLBACK(toggleToolItem), NULL); + lcl_registerToolItem(rWindow, rWindow.m_pBold, ".uno:Bold"); +- + rWindow.m_pItalic = gtk_toggle_tool_button_new(); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (rWindow.m_pItalic), "format-text-italic-symbolic"); + gtk_tool_item_set_tooltip_text(rWindow.m_pItalic, "Italic"); +- gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), rWindow.m_pItalic, -1); ++ gtk_toolbar_insert(GTK_TOOLBAR(pLowerToolbar), rWindow.m_pItalic, -1); + g_signal_connect(G_OBJECT(rWindow.m_pItalic), "toggled", G_CALLBACK(toggleToolItem), NULL); + lcl_registerToolItem(rWindow, rWindow.m_pItalic, ".uno:Italic"); +- + rWindow.m_pUnderline = gtk_toggle_tool_button_new(); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (rWindow.m_pUnderline), "format-text-underline-symbolic"); + gtk_tool_item_set_tooltip_text(rWindow.m_pUnderline, "Underline"); +- gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), rWindow.m_pUnderline, -1); ++ gtk_toolbar_insert(GTK_TOOLBAR(pLowerToolbar), rWindow.m_pUnderline, -1); + g_signal_connect(G_OBJECT(rWindow.m_pUnderline), "toggled", G_CALLBACK(toggleToolItem), NULL); + lcl_registerToolItem(rWindow, rWindow.m_pUnderline, ".uno:Underline"); +- + rWindow.m_pStrikethrough = gtk_toggle_tool_button_new (); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(rWindow.m_pStrikethrough), "format-text-strikethrough-symbolic"); + gtk_tool_item_set_tooltip_text(rWindow.m_pStrikethrough, "Strikethrough"); +- gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), rWindow.m_pStrikethrough, -1); ++ gtk_toolbar_insert(GTK_TOOLBAR(pLowerToolbar), rWindow.m_pStrikethrough, -1); + g_signal_connect(G_OBJECT(rWindow.m_pStrikethrough), "toggled", G_CALLBACK(toggleToolItem), NULL); + lcl_registerToolItem(rWindow, rWindow.m_pStrikethrough, ".uno:Strikeout"); +- +- gtk_box_pack_start(GTK_BOX(rWindow.m_pVBox), pToolbar, FALSE, FALSE, 0 ); // Adds to top. ++ gtk_toolbar_insert(GTK_TOOLBAR(pLowerToolbar), gtk_separator_tool_item_new(), -1); ++ ++ // Superscript and subscript. ++ rWindow.m_pSuperscript = gtk_toggle_tool_button_new(); ++ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(rWindow.m_pSuperscript), "go-up-symbolic"); ++ gtk_tool_item_set_tooltip_text(rWindow.m_pSuperscript, "Superscript"); ++ gtk_toolbar_insert(GTK_TOOLBAR(pLowerToolbar), rWindow.m_pSuperscript, -1); ++ g_signal_connect(G_OBJECT(rWindow.m_pSuperscript), "toggled", G_CALLBACK(toggleToolItem), NULL); ++ lcl_registerToolItem(rWindow, rWindow.m_pSuperscript, ".uno:SuperScript"); ++ rWindow.m_pSubscript = gtk_toggle_tool_button_new(); ++ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(rWindow.m_pSubscript), "go-down-symbolic"); ++ gtk_tool_item_set_tooltip_text(rWindow.m_pSubscript, "Subscript"); ++ gtk_toolbar_insert(GTK_TOOLBAR(pLowerToolbar), rWindow.m_pSubscript, -1); ++ g_signal_connect(G_OBJECT(rWindow.m_pSubscript), "toggled", G_CALLBACK(toggleToolItem), NULL); ++ lcl_registerToolItem(rWindow, rWindow.m_pSubscript, ".uno:SubScript"); ++ gtk_toolbar_insert(GTK_TOOLBAR(pLowerToolbar), gtk_separator_tool_item_new(), -1); ++ ++ // Align left, center horizontally, align right and justified. ++ rWindow.m_pLeftpara = gtk_toggle_tool_button_new(); ++ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(rWindow.m_pLeftpara), "format-justify-left-symbolic"); ++ gtk_tool_item_set_tooltip_text(rWindow.m_pLeftpara, "Align Left"); ++ gtk_toolbar_insert(GTK_TOOLBAR(pLowerToolbar), rWindow.m_pLeftpara, -1); ++ g_signal_connect(G_OBJECT(rWindow.m_pLeftpara), "toggled", G_CALLBACK(toggleToolItem), NULL); ++ lcl_registerToolItem(rWindow, rWindow.m_pLeftpara, ".uno:LeftPara"); ++ rWindow.m_pCenterpara = gtk_toggle_tool_button_new(); ++ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(rWindow.m_pCenterpara), "format-justify-center-symbolic"); ++ gtk_tool_item_set_tooltip_text(rWindow.m_pCenterpara, "Center Horizontally"); ++ gtk_toolbar_insert(GTK_TOOLBAR(pLowerToolbar), rWindow.m_pCenterpara, -1); ++ g_signal_connect(G_OBJECT(rWindow.m_pCenterpara), "toggled", G_CALLBACK(toggleToolItem), NULL); ++ lcl_registerToolItem(rWindow, rWindow.m_pCenterpara, ".uno:CenterPara"); ++ rWindow.m_pRightpara = gtk_toggle_tool_button_new(); ++ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(rWindow.m_pRightpara), "format-justify-right-symbolic"); ++ gtk_tool_item_set_tooltip_text(rWindow.m_pRightpara, "Align Right"); ++ gtk_toolbar_insert(GTK_TOOLBAR(pLowerToolbar), rWindow.m_pRightpara, -1); ++ g_signal_connect(G_OBJECT(rWindow.m_pRightpara), "toggled", G_CALLBACK(toggleToolItem), NULL); ++ lcl_registerToolItem(rWindow, rWindow.m_pRightpara, ".uno:RightPara"); ++ rWindow.m_pJustifypara = gtk_toggle_tool_button_new(); ++ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(rWindow.m_pJustifypara), "format-justify-fill-symbolic"); ++ gtk_tool_item_set_tooltip_text(rWindow.m_pJustifypara, "Justified"); ++ gtk_toolbar_insert(GTK_TOOLBAR(pLowerToolbar), rWindow.m_pJustifypara, -1); ++ g_signal_connect(G_OBJECT(rWindow.m_pJustifypara), "toggled", G_CALLBACK(toggleToolItem), NULL); ++ lcl_registerToolItem(rWindow, rWindow.m_pJustifypara, ".uno:JustifyPara"); ++ gtk_box_pack_start(GTK_BOX(rWindow.m_pVBox), pLowerToolbar, FALSE, FALSE, 0 ); // Adds to top. + + // Findbar + rWindow.m_pFindbar = gtk_toolbar_new(); +-- +2.12.0 + diff --git a/SOURCES/0254-ScTabView-getRowColumnHeaders-include-info-about-col.patch b/SOURCES/0254-ScTabView-getRowColumnHeaders-include-info-about-col.patch new file mode 100644 index 0000000..b03d96f --- /dev/null +++ b/SOURCES/0254-ScTabView-getRowColumnHeaders-include-info-about-col.patch @@ -0,0 +1,40 @@ +From 48b6afeef26d498f4338170e53306257ef9914d4 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 30 Oct 2015 13:57:28 +0100 +Subject: [PATCH 254/398] ScTabView::getRowColumnHeaders: include info about + columns, too + +Change-Id: Id7db9fa9b451dcf2423142b38c2c12b369e16fae +(cherry picked from commit ac47e5758e56ac30d98c1d6386dfad24ac59b1f6) +--- + sc/source/ui/view/tabview.cxx | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx +index f177bbe704f1..4dccc9b4032a 100644 +--- a/sc/source/ui/view/tabview.cxx ++++ b/sc/source/ui/view/tabview.cxx +@@ -2324,8 +2324,20 @@ OUString ScTabView::getRowColumnHeaders() + aRows.push_back(std::make_pair("", aRow)); + } + ++ boost::property_tree::ptree aCols; ++ for (SCCOL nCol = 0; nCol < nEndCol; ++nCol) ++ { ++ boost::property_tree::ptree aCol; ++ sal_uInt16 nSize = pColBar[SC_SPLIT_LEFT]->GetEntrySize(nCol); ++ aCol.put("size", OString::number(nSize).getStr()); ++ OUString aText = pColBar[SC_SPLIT_LEFT]->GetEntryText(nCol); ++ aCol.put("text", aText.toUtf8().getStr()); ++ aCols.push_back(std::make_pair("", aCol)); ++ } ++ + boost::property_tree::ptree aTree; + aTree.add_child("rows", aRows); ++ aTree.add_child("columns", aCols); + std::stringstream aStream; + boost::property_tree::write_json(aStream, aTree); + return OUString::fromUtf8(aStream.str().c_str()); +-- +2.12.0 + diff --git a/SOURCES/0255-ScTabView-getRowColumnHeaders-emit-info-about-last-f.patch b/SOURCES/0255-ScTabView-getRowColumnHeaders-emit-info-about-last-f.patch new file mode 100644 index 0000000..78132eb --- /dev/null +++ b/SOURCES/0255-ScTabView-getRowColumnHeaders-emit-info-about-last-f.patch @@ -0,0 +1,37 @@ +From d9521709e35a62c5e56d099d49bad5316bc394c4 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 30 Oct 2015 16:00:03 +0100 +Subject: [PATCH 255/398] ScTabView::getRowColumnHeaders: emit info about last + formatted row/col + +Change-Id: I6b4f6eacde84433fa3865e62c692a3f97895b887 +(cherry picked from commit 3bdce53c557a1279e7e40d215e34405626bbc628) +--- + sc/source/ui/view/tabview.cxx | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx +index 4dccc9b4032a..a3718f62cd7e 100644 +--- a/sc/source/ui/view/tabview.cxx ++++ b/sc/source/ui/view/tabview.cxx +@@ -2314,7 +2314,7 @@ OUString ScTabView::getRowColumnHeaders() + pDoc->GetTiledRenderingArea(aViewData.GetTabNo(), nEndCol, nEndRow); + + boost::property_tree::ptree aRows; +- for (SCROW nRow = 0; nRow < nEndRow; ++nRow) ++ for (SCROW nRow = 0; nRow <= nEndRow; ++nRow) + { + boost::property_tree::ptree aRow; + sal_uInt16 nSize = pRowBar[SC_SPLIT_BOTTOM]->GetEntrySize(nRow); +@@ -2325,7 +2325,7 @@ OUString ScTabView::getRowColumnHeaders() + } + + boost::property_tree::ptree aCols; +- for (SCCOL nCol = 0; nCol < nEndCol; ++nCol) ++ for (SCCOL nCol = 0; nCol <= nEndCol; ++nCol) + { + boost::property_tree::ptree aCol; + sal_uInt16 nSize = pColBar[SC_SPLIT_LEFT]->GetEntrySize(nCol); +-- +2.12.0 + diff --git a/SOURCES/0256-sc-lok-emit-RowColumnHeader-info-in-twips.patch b/SOURCES/0256-sc-lok-emit-RowColumnHeader-info-in-twips.patch new file mode 100644 index 0000000..4e82cb9 --- /dev/null +++ b/SOURCES/0256-sc-lok-emit-RowColumnHeader-info-in-twips.patch @@ -0,0 +1,99 @@ +From 2cd289ebee6e572804338d87e26d935443c4817b Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Mon, 2 Nov 2015 10:56:43 +0100 +Subject: [PATCH 256/398] sc lok: emit RowColumnHeader info in twips + +As that's the unit we use everywhere else in the LOK API. Also, make the +ScGlobal::nScreenPPTX/Y calculation more precise, otherwise rounding +errors occur during the pixel -> twip conversion. + +Example with the old precision: col height is 103 px, nScreenPPTY is +0.067, twips is 1537.3134328358208, convering it back is 102.487562189 +px. + +Example with the new precision: col height is 103 px, nScreenPPTY is +0.0667, twips is 1544.2278860569716, convering it back is 102.948525737 +px. + +Change-Id: I19f5285508ef0c751614d07969b3a7a037e7d1ec +(cherry picked from commit 708d1c5ab242b545ced598879233fc662d7e6cc0) +--- + libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 6 ++++-- + sc/source/core/data/global.cxx | 6 +++--- + sc/source/ui/view/tabview.cxx | 7 +++++-- + 3 files changed, 12 insertions(+), 7 deletions(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 822a6cb3c4bd..4e9b9b80ea03 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -250,7 +250,8 @@ gboolean TiledRowColumnBar::docConfigureEvent(GtkWidget* pDocView, GdkEventConfi + rWindow.m_pRowBar->m_aHeaders.clear(); + for (boost::property_tree::ptree::value_type& rValue : aTree.get_child("rows")) + { +- Header aHeader(std::atoi(rValue.second.get("size").c_str()), rValue.second.get("text")); ++ int nSize = std::round(lok_doc_view_twip_to_pixel(LOK_DOC_VIEW(pDocView), std::atof(rValue.second.get("size").c_str()))); ++ Header aHeader(nSize, rValue.second.get("text")); + rWindow.m_pRowBar->m_aHeaders.push_back(aHeader); + } + gtk_widget_show(rWindow.m_pRowBar->m_pDrawingArea); +@@ -259,7 +260,8 @@ gboolean TiledRowColumnBar::docConfigureEvent(GtkWidget* pDocView, GdkEventConfi + rWindow.m_pColumnBar->m_aHeaders.clear(); + for (boost::property_tree::ptree::value_type& rValue : aTree.get_child("columns")) + { +- Header aHeader(std::atoi(rValue.second.get("size").c_str()), rValue.second.get("text")); ++ int nSize = std::round(lok_doc_view_twip_to_pixel(LOK_DOC_VIEW(pDocView), std::atof(rValue.second.get("size").c_str()))); ++ Header aHeader(nSize, rValue.second.get("text")); + rWindow.m_pColumnBar->m_aHeaders.push_back(aHeader); + } + gtk_widget_show(rWindow.m_pColumnBar->m_pDrawingArea); +diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx +index 12b7cbbe6b56..8303770a7850 100644 +--- a/sc/source/core/data/global.cxx ++++ b/sc/source/core/data/global.cxx +@@ -544,9 +544,9 @@ void ScGlobal::UpdatePPT( OutputDevice* pDev ) + + if ( !pDev ) + pDev = Application::GetDefaultDevice(); +- Point aPix1000 = pDev->LogicToPixel( Point(1000,1000), MAP_TWIP ); +- nScreenPPTX = aPix1000.X() / 1000.0; +- nScreenPPTY = aPix1000.Y() / 1000.0; ++ Point aPix1000 = pDev->LogicToPixel( Point(10000,10000), MAP_TWIP ); ++ nScreenPPTX = aPix1000.X() / 10000.0; ++ nScreenPPTY = aPix1000.Y() / 10000.0; + nPPTZoom = nCurrentZoom; + } + } +diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx +index a3718f62cd7e..f2f6179eaaf9 100644 +--- a/sc/source/ui/view/tabview.cxx ++++ b/sc/source/ui/view/tabview.cxx +@@ -2313,12 +2313,15 @@ OUString ScTabView::getRowColumnHeaders() + SCROW nEndRow = 0; + pDoc->GetTiledRenderingArea(aViewData.GetTabNo(), nEndCol, nEndRow); + ++ double nPPTX = aViewData.GetPPTX(); ++ double nPPTY = aViewData.GetPPTY(); ++ + boost::property_tree::ptree aRows; + for (SCROW nRow = 0; nRow <= nEndRow; ++nRow) + { + boost::property_tree::ptree aRow; + sal_uInt16 nSize = pRowBar[SC_SPLIT_BOTTOM]->GetEntrySize(nRow); +- aRow.put("size", OString::number(nSize).getStr()); ++ aRow.put("size", OString::number(nSize / nPPTY).getStr()); + OUString aText = pRowBar[SC_SPLIT_BOTTOM]->GetEntryText(nRow); + aRow.put("text", aText.toUtf8().getStr()); + aRows.push_back(std::make_pair("", aRow)); +@@ -2329,7 +2332,7 @@ OUString ScTabView::getRowColumnHeaders() + { + boost::property_tree::ptree aCol; + sal_uInt16 nSize = pColBar[SC_SPLIT_LEFT]->GetEntrySize(nCol); +- aCol.put("size", OString::number(nSize).getStr()); ++ aCol.put("size", OString::number(nSize / nPPTX).getStr()); + OUString aText = pColBar[SC_SPLIT_LEFT]->GetEntryText(nCol); + aCol.put("text", aText.toUtf8().getStr()); + aCols.push_back(std::make_pair("", aCol)); +-- +2.12.0 + diff --git a/SOURCES/0257-gtktiledviewer-show-zoom-in-the-status-bar.patch b/SOURCES/0257-gtktiledviewer-show-zoom-in-the-status-bar.patch new file mode 100644 index 0000000..b6927e4 --- /dev/null +++ b/SOURCES/0257-gtktiledviewer-show-zoom-in-the-status-bar.patch @@ -0,0 +1,106 @@ +From 64db75597615c8f528e91203e7a50768a891aab0 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Mon, 2 Nov 2015 14:59:07 +0100 +Subject: [PATCH 257/398] gtktiledviewer: show zoom in the status bar + +Change-Id: I4ab00a269b0a8435a278f93e1d92d102a80c8506 +(cherry picked from commit 901fa421e1d446408116d1fe2eb6f070b5946dc9) +--- + .../qa/gtktiledviewer/gtktiledviewer.cxx | 34 +++++++++++++++++----- + 1 file changed, 27 insertions(+), 7 deletions(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 4e9b9b80ea03..c6821065d147 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -83,6 +83,9 @@ class TiledWindow + public: + GtkWidget* m_pDocView; + GtkWidget* m_pStatusBar; ++ GtkWidget* m_pProgressBar; ++ GtkWidget* m_pStatusbarLabel; ++ GtkWidget* m_pZoomLabel; + GtkToolItem* m_pEnableEditing; + GtkToolItem* m_pBold; + GtkToolItem* m_pItalic; +@@ -114,6 +117,9 @@ public: + TiledWindow() + : m_pDocView(0), + m_pStatusBar(0), ++ m_pProgressBar(0), ++ m_pStatusbarLabel(0), ++ m_pZoomLabel(0), + m_pEnableEditing(0), + m_pBold(0), + m_pItalic(0), +@@ -373,6 +379,8 @@ static void changeZoom( GtkWidget* pButton, gpointer /* pItem */ ) + lok_doc_view_set_zoom( LOK_DOC_VIEW(pDocView), fZoom ); + } + } ++ std::string aZoom = std::to_string(int(fZoom * 100)) + std::string("%"); ++ gtk_label_set_text(GTK_LABEL(rWindow.m_pZoomLabel), aZoom.c_str()); + } + + /// User clicked on the button -> inform LOKDocView. +@@ -425,8 +433,9 @@ static void createView(GtkWidget* pButton, gpointer /*pItem*/) + GtkWidget* pDocView = lok_doc_view_new_from_widget(LOK_DOC_VIEW(rWindow.m_pDocView)); + + TiledWindow& rNewWindow = setupWidgetAndCreateWindow(pDocView); +- // Hide status bar that contains the unused progress bar. +- gtk_widget_hide(rNewWindow.m_pStatusBar); ++ // Hide the unused progress bar. ++ gtk_widget_show_all(rNewWindow.m_pStatusBar); ++ gtk_widget_hide(rNewWindow.m_pProgressBar); + } + + /// Creates a new model, i.e. LOK init and document load, one view implicitly. +@@ -845,7 +854,8 @@ static void openDocumentCallback (GObject* source_object, GAsyncResult* res, gpo + focusChain = g_list_append( focusChain, pDocView ); + gtk_container_set_focus_chain ( GTK_CONTAINER (rWindow.m_pVBox), focusChain ); + +- gtk_widget_hide(rWindow.m_pStatusBar); ++ gtk_widget_show_all(rWindow.m_pStatusBar); ++ gtk_widget_hide(rWindow.m_pProgressBar); + } + + /// Creates the GtkWindow that has main widget as children and registers it in the window map. +@@ -1085,15 +1095,22 @@ static GtkWidget* createWindow(TiledWindow& rWindow) + + gtk_container_add(GTK_CONTAINER(rWindow.m_pScrolledWindow), rWindow.m_pDocView); + +- GtkWidget* pProgressBar = gtk_progress_bar_new (); +- g_signal_connect(rWindow.m_pDocView, "load-changed", G_CALLBACK(loadChanged), pProgressBar); ++ rWindow.m_pProgressBar = gtk_progress_bar_new (); ++ g_signal_connect(rWindow.m_pDocView, "load-changed", G_CALLBACK(loadChanged), rWindow.m_pProgressBar); + + GtkWidget* pStatusBar = gtk_statusbar_new(); + rWindow.m_pStatusBar = pStatusBar; + gtk_container_forall(GTK_CONTAINER(pStatusBar), removeChildrenFromStatusbar, pStatusBar); + gtk_container_add (GTK_CONTAINER(rWindow.m_pVBox), pStatusBar); +- gtk_container_add (GTK_CONTAINER(pStatusBar), pProgressBar); +- gtk_widget_set_hexpand(pProgressBar, true); ++ gtk_container_add (GTK_CONTAINER(pStatusBar), rWindow.m_pProgressBar); ++ gtk_widget_set_hexpand(rWindow.m_pProgressBar, true); ++ ++ rWindow.m_pStatusbarLabel = gtk_label_new(""); ++ gtk_widget_set_hexpand(rWindow.m_pStatusbarLabel, TRUE); ++ gtk_container_add(GTK_CONTAINER(pStatusBar), rWindow.m_pStatusbarLabel); ++ ++ rWindow.m_pZoomLabel = gtk_label_new("100%"); ++ gtk_container_add(GTK_CONTAINER(pStatusBar), rWindow.m_pZoomLabel); + + gtk_widget_show_all(pWindow); + // Hide the findbar by default. +@@ -1102,6 +1119,9 @@ static GtkWidget* createWindow(TiledWindow& rWindow) + gtk_widget_hide(rWindow.m_pCornerButton->m_pDrawingArea); + gtk_widget_hide(rWindow.m_pRowBar->m_pDrawingArea); + gtk_widget_hide(rWindow.m_pColumnBar->m_pDrawingArea); ++ // Hide the non-progressbar children of the status bar by default. ++ gtk_widget_hide(rWindow.m_pStatusbarLabel); ++ gtk_widget_hide(rWindow.m_pZoomLabel); + + g_aWindows[pWindow] = rWindow; + g_signal_connect(rWindow.m_pDocView, "configure-event", G_CALLBACK(TiledRowColumnBar::docConfigureEvent), 0); +-- +2.12.0 + diff --git a/SOURCES/0258-sc-lok-fix-rounding-errors-with-non-100-zoom.patch b/SOURCES/0258-sc-lok-fix-rounding-errors-with-non-100-zoom.patch new file mode 100644 index 0000000..f261bf1 --- /dev/null +++ b/SOURCES/0258-sc-lok-fix-rounding-errors-with-non-100-zoom.patch @@ -0,0 +1,82 @@ +From 9d9749fb86461eefdb2bab01de003409b236dde0 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Mon, 2 Nov 2015 15:18:09 +0100 +Subject: [PATCH 258/398] sc lok: fix rounding errors with non-100% zoom + +There were two problems here: + +1) ScTabView::getRowColumnHeaders() did not expose twip values directly, +but used ScRow/ColBar::GetEntrySize(), which does a twip -> pixel +conversion, and then converted it back to twip. Avoid this unnecessary +roundtrip. + +2) ScViewData::ToPixel() trunaces the resulting float to an integer, so +if the result is e.g. 67.7 pixels, then Calc handled that as 67, but +gtktiledviewer rounded that up to 68, resulting in non-matching headers +for the rendered tiles. + +Change-Id: Ie6ed1ea923a423d1526eeb235b7b87106fd2f20b +(cherry picked from commit 861b28b88909ec39fc83fccc0ab23d288128aa0e) +--- + libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 4 ++-- + sc/source/ui/view/tabview.cxx | 11 ++++------- + 2 files changed, 6 insertions(+), 9 deletions(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index c6821065d147..7e6379124678 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -256,7 +256,7 @@ gboolean TiledRowColumnBar::docConfigureEvent(GtkWidget* pDocView, GdkEventConfi + rWindow.m_pRowBar->m_aHeaders.clear(); + for (boost::property_tree::ptree::value_type& rValue : aTree.get_child("rows")) + { +- int nSize = std::round(lok_doc_view_twip_to_pixel(LOK_DOC_VIEW(pDocView), std::atof(rValue.second.get("size").c_str()))); ++ int nSize = lok_doc_view_twip_to_pixel(LOK_DOC_VIEW(pDocView), std::atof(rValue.second.get("size").c_str())); + Header aHeader(nSize, rValue.second.get("text")); + rWindow.m_pRowBar->m_aHeaders.push_back(aHeader); + } +@@ -266,7 +266,7 @@ gboolean TiledRowColumnBar::docConfigureEvent(GtkWidget* pDocView, GdkEventConfi + rWindow.m_pColumnBar->m_aHeaders.clear(); + for (boost::property_tree::ptree::value_type& rValue : aTree.get_child("columns")) + { +- int nSize = std::round(lok_doc_view_twip_to_pixel(LOK_DOC_VIEW(pDocView), std::atof(rValue.second.get("size").c_str()))); ++ int nSize = lok_doc_view_twip_to_pixel(LOK_DOC_VIEW(pDocView), std::atof(rValue.second.get("size").c_str())); + Header aHeader(nSize, rValue.second.get("text")); + rWindow.m_pColumnBar->m_aHeaders.push_back(aHeader); + } +diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx +index f2f6179eaaf9..2d886bca6003 100644 +--- a/sc/source/ui/view/tabview.cxx ++++ b/sc/source/ui/view/tabview.cxx +@@ -2313,15 +2313,12 @@ OUString ScTabView::getRowColumnHeaders() + SCROW nEndRow = 0; + pDoc->GetTiledRenderingArea(aViewData.GetTabNo(), nEndCol, nEndRow); + +- double nPPTX = aViewData.GetPPTX(); +- double nPPTY = aViewData.GetPPTY(); +- + boost::property_tree::ptree aRows; + for (SCROW nRow = 0; nRow <= nEndRow; ++nRow) + { + boost::property_tree::ptree aRow; +- sal_uInt16 nSize = pRowBar[SC_SPLIT_BOTTOM]->GetEntrySize(nRow); +- aRow.put("size", OString::number(nSize / nPPTY).getStr()); ++ sal_uInt16 nSize = pDoc->GetOriginalHeight(nRow, aViewData.GetTabNo()); ++ aRow.put("size", OString::number(nSize).getStr()); + OUString aText = pRowBar[SC_SPLIT_BOTTOM]->GetEntryText(nRow); + aRow.put("text", aText.toUtf8().getStr()); + aRows.push_back(std::make_pair("", aRow)); +@@ -2331,8 +2328,8 @@ OUString ScTabView::getRowColumnHeaders() + for (SCCOL nCol = 0; nCol <= nEndCol; ++nCol) + { + boost::property_tree::ptree aCol; +- sal_uInt16 nSize = pColBar[SC_SPLIT_LEFT]->GetEntrySize(nCol); +- aCol.put("size", OString::number(nSize / nPPTX).getStr()); ++ sal_uInt16 nSize = pDoc->GetColWidth(nCol, aViewData.GetTabNo()); ++ aCol.put("size", OString::number(nSize).getStr()); + OUString aText = pColBar[SC_SPLIT_LEFT]->GetEntryText(nCol); + aCol.put("text", aText.toUtf8().getStr()); + aCols.push_back(std::make_pair("", aCol)); +-- +2.12.0 + diff --git a/SOURCES/0259-LOK-make-use-of-MOUSEMOVE-in-calc.patch b/SOURCES/0259-LOK-make-use-of-MOUSEMOVE-in-calc.patch new file mode 100644 index 0000000..870cc46 --- /dev/null +++ b/SOURCES/0259-LOK-make-use-of-MOUSEMOVE-in-calc.patch @@ -0,0 +1,28 @@ +From 2f89f229707b1de749c0c61b112339b3020a305c Mon Sep 17 00:00:00 2001 +From: Mihai Varga +Date: Mon, 2 Nov 2015 16:52:48 +0200 +Subject: [PATCH 259/398] LOK: make use of MOUSEMOVE in calc + +Change-Id: Ideb7bdabd86e95cf10c7f19f0900110b816970c2 +(cherry picked from commit bcd8da6849780b9680963ef3313d14209a46e5fa) +--- + sc/source/ui/unoobj/docuno.cxx | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx +index f9a9e03f2839..267798d4e949 100644 +--- a/sc/source/ui/unoobj/docuno.cxx ++++ b/sc/source/ui/unoobj/docuno.cxx +@@ -624,6 +624,9 @@ void ScModelObj::postMouseEvent(int nType, int nX, int nY, int nCount, int nButt + pGridWindow->EndTracking(TrackingEventFlags::DontCallHdl); + + break; ++ case LOK_MOUSEEVENT_MOUSEMOVE: ++ pGridWindow->MouseMove(aEvent); ++ break; + default: + assert(false); + break; +-- +2.12.0 + diff --git a/SOURCES/0260-gtktiledviewer-adjust-spreadsheet-row-column-headers.patch b/SOURCES/0260-gtktiledviewer-adjust-spreadsheet-row-column-headers.patch new file mode 100644 index 0000000..ffc19f5 --- /dev/null +++ b/SOURCES/0260-gtktiledviewer-adjust-spreadsheet-row-column-headers.patch @@ -0,0 +1,118 @@ +From 380e289f5d0a7af5df0d0ed7b4a8d940e01a35b1 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Mon, 2 Nov 2015 17:03:08 +0100 +Subject: [PATCH 260/398] gtktiledviewer: adjust spreadsheet row/column headers + on scrolling + +Change-Id: I7ed9e19df071b6baf1e941faee24c332c7b5e804 +(cherry picked from commit 7c4733661b0a80098e84413fbc91b84b4c14cfc1) +--- + .../qa/gtktiledviewer/gtktiledviewer.cxx | 43 ++++++++++++++++++++-- + 1 file changed, 39 insertions(+), 4 deletions(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 7e6379124678..795fb4ed7ff7 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -57,12 +57,16 @@ public: + std::vector
m_aHeaders; + /// Height for row bar, width for column bar. + int m_nSizePixel; ++ /// Left/top position for the column/row bar -- initially 0, then may grow due to scrolling. ++ int m_nPositionPixel; + TiledBarType m_eType; + + TiledRowColumnBar(TiledBarType eType); + static gboolean draw(GtkWidget* pWidget, cairo_t* pCairo, gpointer pData); + gboolean drawImpl(GtkWidget* pWidget, cairo_t* pCairo); + static gboolean docConfigureEvent(GtkWidget* pWidget, GdkEventConfigure* pEvent, gpointer pData); ++ /// Adjustments of the doc widget changed -- horizontal or vertical scroll. ++ static void docAdjustmentChanged(GtkAdjustment* pAdjustment, gpointer pData); + /// Draws rText at the center of rRectangle on pCairo. + static void drawText(cairo_t* pCairo, const GdkRectangle& rRectangle, const std::string& rText); + }; +@@ -233,17 +237,26 @@ gboolean TiledRowColumnBar::drawImpl(GtkWidget* /*pWidget*/, cairo_t* pCairo) + return FALSE; + } + ++void TiledRowColumnBar::docAdjustmentChanged(GtkAdjustment* /*pAdjustment*/, gpointer pData) ++{ ++ GtkWidget* pDocView = static_cast(pData); ++ docConfigureEvent(pDocView, 0, 0); ++} ++ + gboolean TiledRowColumnBar::docConfigureEvent(GtkWidget* pDocView, GdkEventConfigure* /*pEvent*/, gpointer /*pData*/) + { + TiledWindow& rWindow = lcl_getTiledWindow(pDocView); + GtkAdjustment* pVAdjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(rWindow.m_pScrolledWindow)); + rWindow.m_pRowBar->m_nSizePixel = gtk_adjustment_get_page_size(pVAdjustment); ++ rWindow.m_pRowBar->m_nPositionPixel = gtk_adjustment_get_value(pVAdjustment); + GtkAdjustment* pHAdjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(rWindow.m_pScrolledWindow)); + rWindow.m_pColumnBar->m_nSizePixel = gtk_adjustment_get_page_size(pHAdjustment); ++ rWindow.m_pColumnBar->m_nPositionPixel = gtk_adjustment_get_value(pHAdjustment); + + LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(LOK_DOC_VIEW(pDocView)); + if (pDocument && pDocument->pClass->getDocumentType(pDocument) == LOK_DOCTYPE_SPREADSHEET) + { ++ g_info("lok::Document::getCommandValues(.uno:ViewRowColumnHeaders)"); + char* pValues = pDocument->pClass->getCommandValues(pDocument, ".uno:ViewRowColumnHeaders"); + std::stringstream aStream(pValues); + free(pValues); +@@ -254,21 +267,39 @@ gboolean TiledRowColumnBar::docConfigureEvent(GtkWidget* pDocView, GdkEventConfi + gtk_widget_show(rWindow.m_pCornerButton->m_pDrawingArea); + + rWindow.m_pRowBar->m_aHeaders.clear(); ++ int nTotal = 0; + for (boost::property_tree::ptree::value_type& rValue : aTree.get_child("rows")) + { + int nSize = lok_doc_view_twip_to_pixel(LOK_DOC_VIEW(pDocView), std::atof(rValue.second.get("size").c_str())); +- Header aHeader(nSize, rValue.second.get("text")); +- rWindow.m_pRowBar->m_aHeaders.push_back(aHeader); ++ int nScrolledSize = nSize; ++ if (nTotal + nSize >= rWindow.m_pRowBar->m_nPositionPixel) ++ { ++ if (nTotal < rWindow.m_pRowBar->m_nPositionPixel) ++ // First visible row: reduce height because the row is only partially visible. ++ nScrolledSize = nTotal + nSize - rWindow.m_pRowBar->m_nPositionPixel; ++ Header aHeader(nScrolledSize, rValue.second.get("text")); ++ rWindow.m_pRowBar->m_aHeaders.push_back(aHeader); ++ } ++ nTotal += nSize; + } + gtk_widget_show(rWindow.m_pRowBar->m_pDrawingArea); + gtk_widget_queue_draw(rWindow.m_pRowBar->m_pDrawingArea); + + rWindow.m_pColumnBar->m_aHeaders.clear(); ++ nTotal = 0; + for (boost::property_tree::ptree::value_type& rValue : aTree.get_child("columns")) + { + int nSize = lok_doc_view_twip_to_pixel(LOK_DOC_VIEW(pDocView), std::atof(rValue.second.get("size").c_str())); +- Header aHeader(nSize, rValue.second.get("text")); +- rWindow.m_pColumnBar->m_aHeaders.push_back(aHeader); ++ int nScrolledSize = nSize; ++ if (nTotal + nSize >= rWindow.m_pColumnBar->m_nPositionPixel) ++ { ++ if (nTotal < rWindow.m_pColumnBar->m_nPositionPixel) ++ // First visible column: reduce width because the column is only partially visible. ++ nScrolledSize = nTotal + nSize - rWindow.m_pColumnBar->m_nPositionPixel; ++ Header aHeader(nScrolledSize, rValue.second.get("text")); ++ rWindow.m_pColumnBar->m_aHeaders.push_back(aHeader); ++ } ++ nTotal += nSize; + } + gtk_widget_show(rWindow.m_pColumnBar->m_pDrawingArea); + gtk_widget_queue_draw(rWindow.m_pColumnBar->m_pDrawingArea); +@@ -1094,6 +1125,10 @@ static GtkWidget* createWindow(TiledWindow& rWindow) + gtk_grid_attach(GTK_GRID(pGrid), rWindow.m_pScrolledWindow, 1, 1, 1, 1); + + gtk_container_add(GTK_CONTAINER(rWindow.m_pScrolledWindow), rWindow.m_pDocView); ++ GtkAdjustment* pHAdjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(rWindow.m_pScrolledWindow)); ++ g_signal_connect(pHAdjustment, "value-changed", G_CALLBACK(TiledRowColumnBar::docAdjustmentChanged), rWindow.m_pDocView); ++ GtkAdjustment* pVAdjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(rWindow.m_pScrolledWindow)); ++ g_signal_connect(pVAdjustment, "value-changed", G_CALLBACK(TiledRowColumnBar::docAdjustmentChanged), rWindow.m_pDocView); + + rWindow.m_pProgressBar = gtk_progress_bar_new (); + g_signal_connect(rWindow.m_pDocView, "load-changed", G_CALLBACK(loadChanged), rWindow.m_pProgressBar); +-- +2.12.0 + diff --git a/SOURCES/0261-lokdocview-Separate-painting-and-saving-of-tiles.patch b/SOURCES/0261-lokdocview-Separate-painting-and-saving-of-tiles.patch new file mode 100644 index 0000000..dd27ea8 --- /dev/null +++ b/SOURCES/0261-lokdocview-Separate-painting-and-saving-of-tiles.patch @@ -0,0 +1,132 @@ +From a47531dc2f5b90eedb4afb4dd2b3b52fb5a59365 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Sun, 1 Nov 2015 13:22:25 +0530 +Subject: [PATCH 261/398] lokdocview: Separate "painting" and "saving" of tiles + +Lets separate the task of painting the tile, and saving the tile +in tile buffer using GAsyncReadyCallback. This will provide us +with better control over tiles -- cancelling the painting operation, +and filtering tiles that should not be saved in the tile buffer. + +Change-Id: I6aae928d8cc0c906034570ed0e9a054763d493a3 +Reviewed-on: https://gerrit.libreoffice.org/19725 +Reviewed-by: Miklos Vajna +Tested-by: Miklos Vajna +(cherry picked from commit de0c7e1783edc6a36037f2657f823dc9812c0804) +--- + libreofficekit/source/gtk/lokdocview.cxx | 56 ++++++++++++++++++++++++++++---- + libreofficekit/source/gtk/tilebuffer.cxx | 10 ------ + 2 files changed, 49 insertions(+), 17 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 2ec27305af4e..867c0d165448 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -873,6 +873,47 @@ renderGraphicHandle(LOKDocView* pDocView, + } + } + ++/// Finishes the paint tile operation and returns the result, if any ++static gpointer ++paintTileFinish(LOKDocView* pDocView, GAsyncResult* res, GError **error) ++{ ++ GTask* task = G_TASK(res); ++ ++ g_return_val_if_fail(LOK_IS_DOC_VIEW(pDocView), NULL); ++ g_return_val_if_fail(g_task_is_valid(res, pDocView), NULL); ++ g_return_val_if_fail(error == NULL || *error == NULL, NULL); ++ ++ return g_task_propagate_pointer(task, error); ++} ++ ++/// Callback called in the main UI thread when paintTileInThread in LOK thread has finished ++static void ++paintTileCallback(GObject* sourceObject, GAsyncResult* res, gpointer userData) ++{ ++ LOKDocView* pDocView = LOK_DOC_VIEW(sourceObject); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); ++ LOEvent* pLOEvent = static_cast(userData); ++ std::unique_ptr& buffer = priv->m_pTileBuffer; ++ int index = pLOEvent->m_nPaintTileX * buffer->m_nWidth + pLOEvent->m_nPaintTileY; ++ GError* error; ++ ++ error = NULL; ++ GdkPixbuf* pPixBuf = static_cast(paintTileFinish(pDocView, res, &error)); ++ if (error != NULL) ++ { ++ g_warning("Unable to get painted GdkPixbuf: %s", error->message); ++ g_error_free(error); ++ return; ++ } ++ ++ buffer->m_mTiles[index].setPixbuf(pPixBuf); ++ buffer->m_mTiles[index].valid = true; ++ gdk_threads_add_idle(queueDraw, GTK_WIDGET(pDocView)); ++ ++ g_object_unref(pPixBuf); ++} ++ ++ + static gboolean + renderDocument(LOKDocView* pDocView, cairo_t* pCairo) + { +@@ -921,7 +962,13 @@ renderDocument(LOKDocView* pDocView, cairo_t* pCairo) + + if (bPaint) + { +- GTask* task = g_task_new(pDocView, NULL, NULL, NULL); ++ LOEvent* pLOEvent = new LOEvent(LOK_PAINT_TILE); ++ pLOEvent->m_nPaintTileX = nRow; ++ pLOEvent->m_nPaintTileY = nColumn; ++ pLOEvent->m_fPaintTileZoom = priv->m_fZoom; ++ GTask* task = g_task_new(pDocView, NULL, paintTileCallback, pLOEvent); ++ g_task_set_task_data(task, pLOEvent, LOEvent::destroy); ++ + Tile& currentTile = priv->m_pTileBuffer->getTile(nRow, nColumn, priv->m_fZoom, task, priv->lokThreadPool); + GdkPixbuf* pPixBuf = currentTile.getBuffer(); + gdk_cairo_set_source_pixbuf (pCairo, pPixBuf, +@@ -1516,12 +1563,7 @@ paintTileInThread (gpointer data) + pixelToTwip(nTileSizePixels, pLOEvent->m_fPaintTileZoom), + pixelToTwip(nTileSizePixels, pLOEvent->m_fPaintTileZoom)); + +- //create a mapping for it +- buffer->m_mTiles[index].setPixbuf(pPixBuf); +- buffer->m_mTiles[index].valid = true; +- gdk_threads_add_idle(queueDraw, GTK_WIDGET(pDocView)); +- +- g_object_unref(pPixBuf); ++ g_task_return_pointer(task, pPixBuf, g_object_unref); + } + + +diff --git a/libreofficekit/source/gtk/tilebuffer.cxx b/libreofficekit/source/gtk/tilebuffer.cxx +index 811fcc61ef46..6c9847674e53 100644 +--- a/libreofficekit/source/gtk/tilebuffer.cxx ++++ b/libreofficekit/source/gtk/tilebuffer.cxx +@@ -93,11 +93,6 @@ Tile& TileBuffer::getTile(int x, int y, float fZoom, GTask* task, + + if (m_mTiles.find(index) != m_mTiles.end() && !m_mTiles[index].valid) + { +- LOEvent* pLOEvent = new LOEvent(LOK_PAINT_TILE); +- pLOEvent->m_nPaintTileX = x; +- pLOEvent->m_nPaintTileY = y; +- pLOEvent->m_fPaintTileZoom = fZoom; +- g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + g_thread_pool_push(lokThreadPool, g_object_ref(task), &error); + if (error != NULL) + { +@@ -108,11 +103,6 @@ Tile& TileBuffer::getTile(int x, int y, float fZoom, GTask* task, + } + else if(m_mTiles.find(index) == m_mTiles.end()) + { +- LOEvent* pLOEvent = new LOEvent(LOK_PAINT_TILE); +- pLOEvent->m_nPaintTileX = x; +- pLOEvent->m_nPaintTileY = y; +- pLOEvent->m_fPaintTileZoom = fZoom; +- g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + g_thread_pool_push(lokThreadPool, g_object_ref(task), &error); + if (error != NULL) + { +-- +2.12.0 + diff --git a/SOURCES/0262-libreofficekit-Werror-unused-parameter.patch b/SOURCES/0262-libreofficekit-Werror-unused-parameter.patch new file mode 100644 index 0000000..1f7cb9d --- /dev/null +++ b/SOURCES/0262-libreofficekit-Werror-unused-parameter.patch @@ -0,0 +1,63 @@ +From a56ef7d60e8ee96204700a0b6c1474ed2d1560ad Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 3 Nov 2015 11:19:03 +0100 +Subject: [PATCH 262/398] libreofficekit: -Werror=unused-parameter + +Change-Id: I89c4d9752ef650d516bed8fcdc5873de8ae87e18 +(cherry picked from commit 602c1b4e2922c6a0ce425f398983ef64e595b606) +--- + libreofficekit/source/gtk/lokdocview.cxx | 2 +- + libreofficekit/source/gtk/tilebuffer.cxx | 2 +- + libreofficekit/source/gtk/tilebuffer.hxx | 3 +-- + 3 files changed, 3 insertions(+), 4 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 867c0d165448..d570bbd1393b 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -969,7 +969,7 @@ renderDocument(LOKDocView* pDocView, cairo_t* pCairo) + GTask* task = g_task_new(pDocView, NULL, paintTileCallback, pLOEvent); + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + +- Tile& currentTile = priv->m_pTileBuffer->getTile(nRow, nColumn, priv->m_fZoom, task, priv->lokThreadPool); ++ Tile& currentTile = priv->m_pTileBuffer->getTile(nRow, nColumn, task, priv->lokThreadPool); + GdkPixbuf* pPixBuf = currentTile.getBuffer(); + gdk_cairo_set_source_pixbuf (pCairo, pPixBuf, + twipToPixel(aTileRectangleTwips.x, priv->m_fZoom), +diff --git a/libreofficekit/source/gtk/tilebuffer.cxx b/libreofficekit/source/gtk/tilebuffer.cxx +index 6c9847674e53..1158209b2273 100644 +--- a/libreofficekit/source/gtk/tilebuffer.cxx ++++ b/libreofficekit/source/gtk/tilebuffer.cxx +@@ -85,7 +85,7 @@ void TileBuffer::setInvalid(int x, int y, float fZoom, GTask* task, + } + } + +-Tile& TileBuffer::getTile(int x, int y, float fZoom, GTask* task, ++Tile& TileBuffer::getTile(int x, int y, GTask* task, + GThreadPool* lokThreadPool) + { + int index = x * m_nWidth + y; +diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx +index bef1444f9c9c..5e1ea1a27049 100644 +--- a/libreofficekit/source/gtk/tilebuffer.hxx ++++ b/libreofficekit/source/gtk/tilebuffer.hxx +@@ -107,7 +107,6 @@ class TileBuffer + + @param x the tile along the x-axis of the buffer + @param y the tile along the y-axis of the buffer +- @param aZoom current zoom factor of the document + @param task GTask object containing the necessary data + @param pool GThreadPool managed by the widget instance used for all the + LOK calls made by widget. It is needed here because getTile invokes one +@@ -115,7 +114,7 @@ class TileBuffer + + @return the tile at the mentioned position (x, y) + */ +- Tile& getTile(int x, int y, float aZoom, GTask* task, GThreadPool* pool); ++ Tile& getTile(int x, int y, GTask* task, GThreadPool* pool); + /// Destroys all the tiles in the tile buffer; also frees the memory allocated + /// for all the Tile objects. + void resetAllTiles(); +-- +2.12.0 + diff --git a/SOURCES/0263-lok-Fix-typo-search-result_count-search-result-count.patch b/SOURCES/0263-lok-Fix-typo-search-result_count-search-result-count.patch new file mode 100644 index 0000000..4acbfdf --- /dev/null +++ b/SOURCES/0263-lok-Fix-typo-search-result_count-search-result-count.patch @@ -0,0 +1,28 @@ +From df79516e23a605a493d9e90de9ab7a6ccefefec4 Mon Sep 17 00:00:00 2001 +From: Jan Holesovsky +Date: Tue, 3 Nov 2015 12:58:48 +0100 +Subject: [PATCH 263/398] lok: Fix typo search-result_count -> + search-result-count. + +Change-Id: Iccd5b39f6bdf1c7a43131fc50186ea5a2838d77e +(cherry picked from commit c0f37892a24b202c0a28836ed1046c90c7631e03) +--- + libreofficekit/source/gtk/lokdocview.cxx | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index d570bbd1393b..49d5ecc54f65 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -2083,7 +2083,7 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + * @aCommand: number of matches. + */ + doc_view_signals[SEARCH_RESULT_COUNT] = +- g_signal_new("search-result_count", ++ g_signal_new("search-result-count", + G_TYPE_FROM_CLASS(pGObjectClass), + G_SIGNAL_RUN_FIRST, + 0, +-- +2.12.0 + diff --git a/SOURCES/0264-lok-Introduce-LOK_CALLBACK_UNO_COMMAND_RESULT-callba.patch b/SOURCES/0264-lok-Introduce-LOK_CALLBACK_UNO_COMMAND_RESULT-callba.patch new file mode 100644 index 0000000..5207104 --- /dev/null +++ b/SOURCES/0264-lok-Introduce-LOK_CALLBACK_UNO_COMMAND_RESULT-callba.patch @@ -0,0 +1,466 @@ +From 1c5b0b2f4a2e883f5da3a4afb3cadaf695d58fac Mon Sep 17 00:00:00 2001 +From: Jan Holesovsky +Date: Tue, 3 Nov 2015 13:20:06 +0100 +Subject: [PATCH 264/398] lok: Introduce LOK_CALLBACK_UNO_COMMAND_RESULT + callback. + +Posting of the .uno:Something commands is asynchronous. To be able to find +out when eg. .uno:Save finished, this commit introduces a callback that fires +when that happens. + +To be able to receive such a notification, the appropriate postUnoCommand() +must be called with 'true' as the parameter for bNotifyWhenFinished (defaults +to 'false'). + +Change-Id: I254939ebc8ea5f309ae39686dcaaeddd5148b0c9 +(cherry picked from commit 8c987fababbddb6e4f81b0cd717b59b9a9ff9be0) +--- + comphelper/source/misc/dispatchcommand.cxx | 9 ++- + desktop/inc/lib/init.hxx | 2 + + desktop/source/lib/init.cxx | 74 ++++++++++++++++++++-- + include/LibreOfficeKit/LibreOfficeKit.h | 8 ++- + include/LibreOfficeKit/LibreOfficeKit.hxx | 4 +- + include/LibreOfficeKit/LibreOfficeKitEnums.h | 17 ++++- + include/LibreOfficeKit/LibreOfficeKitGtk.h | 4 +- + include/comphelper/dispatchcommand.hxx | 5 +- + .../qa/gtktiledviewer/gtktiledviewer.cxx | 15 ++++- + libreofficekit/source/gtk/lokdocview.cxx | 34 +++++++++- + libreofficekit/source/gtk/tilebuffer.hxx | 2 + + 11 files changed, 157 insertions(+), 17 deletions(-) + +diff --git a/comphelper/source/misc/dispatchcommand.cxx b/comphelper/source/misc/dispatchcommand.cxx +index 5de05542dbb4..a5a6dde0885d 100644 +--- a/comphelper/source/misc/dispatchcommand.cxx ++++ b/comphelper/source/misc/dispatchcommand.cxx +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + #include + #include + +@@ -30,7 +31,7 @@ using namespace css; + + namespace comphelper { + +-bool dispatchCommand(const OUString& rCommand, const css::uno::Sequence& rArguments) ++bool dispatchCommand(const OUString& rCommand, const css::uno::Sequence& rArguments, uno::Reference aListener) + { + // Target where we will execute the .uno: command + uno::Reference xContext = ::comphelper::getProcessComponentContext(); +@@ -54,7 +55,11 @@ bool dispatchCommand(const OUString& rCommand, const css::uno::Sequencedispatch(aCommandURL, rArguments); ++ uno::Reference xNotifyingDisp(xDisp, uno::UNO_QUERY); ++ if (xNotifyingDisp.is()) ++ xNotifyingDisp->dispatchWithNotification(aCommandURL, rArguments, aListener); ++ else ++ xNotifyingDisp->dispatch(aCommandURL, rArguments); + + return true; + } +diff --git a/desktop/inc/lib/init.hxx b/desktop/inc/lib/init.hxx +index d3a42fb10bde..4f878d26c007 100644 +--- a/desktop/inc/lib/init.hxx ++++ b/desktop/inc/lib/init.hxx +@@ -20,6 +20,8 @@ namespace desktop { + { + uno::Reference mxComponent; + std::shared_ptr< LibreOfficeKitDocumentClass > m_pDocumentClass; ++ LibreOfficeKitCallback mpCallback; ++ void *mpCallbackData; + + explicit LibLODocument_Impl(const uno::Reference &xComponent); + ~LibLODocument_Impl(); +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 98747ea62e3a..9ba26c414d8c 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -35,6 +35,8 @@ + #include + #include + #include ++#include ++#include + #include + #include + #include +@@ -240,7 +242,8 @@ static void doc_postMouseEvent (LibreOfficeKitDocument* pThis, + int nModifier); + static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, + const char* pCommand, +- const char* pArguments); ++ const char* pArguments, ++ bool bNotifyWhenFinished); + static void doc_setTextSelection (LibreOfficeKitDocument* pThis, + int nType, + int nX, +@@ -883,9 +886,14 @@ static void doc_initializeForRendering(LibreOfficeKitDocument* pThis) + } + + static void doc_registerCallback(LibreOfficeKitDocument* pThis, +- LibreOfficeKitCallback pCallback, +- void* pData) ++ LibreOfficeKitCallback pCallback, ++ void* pData) + { ++ LibLODocument_Impl* pDocument = static_cast(pThis); ++ ++ pDocument->mpCallback = pCallback; ++ pDocument->mpCallbackData = pData; ++ + if (comphelper::LibreOfficeKit::isViewCallback()) + { + if (SfxViewShell* pViewShell = SfxViewFrame::Current()->GetViewShell()) +@@ -950,13 +958,69 @@ static void jsonToPropertyValues(const char* pJSON, uno::Sequence ++{ ++ OString maCommand; ///< Command for which this is the result. ++ LibreOfficeKitCallback mpCallback; ///< Callback to call. ++ void* mpCallbackData; ///< The callback's data. ++ ++public: ++ DispatchResultListener(const char* pCommand, LibreOfficeKitCallback pCallback, void* pCallbackData) ++ : maCommand(pCommand) ++ , mpCallback(pCallback) ++ , mpCallbackData(pCallbackData) ++ { ++ assert(mpCallback); ++ } ++ ++ virtual void SAL_CALL dispatchFinished(const css::frame::DispatchResultEvent& rEvent) throw(css::uno::RuntimeException, std::exception) override ++ { ++ boost::property_tree::ptree aTree; ++ aTree.put("commandName", maCommand.getStr()); ++ ++ if (rEvent.State != frame::DispatchResultState::DONTKNOW) ++ { ++ bool bSuccess = (rEvent.State == frame::DispatchResultState::SUCCESS); ++ aTree.put("success", bSuccess); ++ } ++ ++ // TODO UNO Any rEvent.Result -> JSON ++ // aTree.put("result": "..."); ++ ++ std::stringstream aStream; ++ boost::property_tree::write_json(aStream, aTree); ++ mpCallback(LOK_CALLBACK_UNO_COMMAND_RESULT, strdup(aStream.str().c_str()), mpCallbackData); ++ } ++ ++ virtual void SAL_CALL disposing(const css::lang::EventObject&) throw (css::uno::RuntimeException, std::exception) override {} ++}; ++ ++static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pCommand, const char* pArguments, bool bNotifyWhenFinished) + { + OUString aCommand(pCommand, strlen(pCommand), RTL_TEXTENCODING_UTF8); + + uno::Sequence aPropertyValues; + jsonToPropertyValues(pArguments, aPropertyValues); +- if (!comphelper::dispatchCommand(aCommand, aPropertyValues)) ++ bool bResult = false; ++ ++ LibLODocument_Impl* pDocument = static_cast(pThis); ++ ++ if (bNotifyWhenFinished && pDocument->mpCallback) ++ { ++ bResult = comphelper::dispatchCommand(aCommand, aPropertyValues, ++ new DispatchResultListener(pCommand, pDocument->mpCallback, pDocument->mpCallbackData)); ++ } ++ else ++ bResult = comphelper::dispatchCommand(aCommand, aPropertyValues); ++ ++ if (!bResult) + { + gImpl->maLastExceptionMsg = "Failed to dispatch the .uno: command"; + } +diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h +index d83717b4a809..c887f5f64b8a 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.h ++++ b/include/LibreOfficeKit/LibreOfficeKit.h +@@ -12,6 +12,11 @@ + + #include + ++#ifdef LOK_USE_UNSTABLE_API ++// the unstable API needs C99's bool ++#include ++#endif ++ + #include + + #ifdef __cplusplus +@@ -144,7 +149,8 @@ struct _LibreOfficeKitDocumentClass + /// @see lok::Document::postUnoCommand + void (*postUnoCommand) (LibreOfficeKitDocument* pThis, + const char* pCommand, +- const char* pArguments); ++ const char* pArguments, ++ bool bNotifyWhenFinished); + + /// @see lok::Document::setTextSelection + void (*setTextSelection) (LibreOfficeKitDocument* pThis, +diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx +index 6673cd731eb7..c51339fa3ba8 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.hxx ++++ b/include/LibreOfficeKit/LibreOfficeKit.hxx +@@ -220,9 +220,9 @@ public: + * @param pCommand uno command to be posted to the document, like ".uno:Bold" + * @param pArguments arguments of the uno command. + */ +- inline void postUnoCommand(const char* pCommand, const char* pArguments = 0) ++ inline void postUnoCommand(const char* pCommand, const char* pArguments = 0, bool bNotifyWhenFinished = false) + { +- mpDoc->pClass->postUnoCommand(mpDoc, pCommand, pArguments); ++ mpDoc->pClass->postUnoCommand(mpDoc, pCommand, pArguments, bNotifyWhenFinished); + } + + /** +diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h +index 459da5d196f4..86d9e6bfd873 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h ++++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h +@@ -180,7 +180,22 @@ typedef enum + * - searchResultSelection is an array of part-number and rectangle list + * pairs, in LOK_CALLBACK_SET_PART / LOK_CALLBACK_TEXT_SELECTION format. + */ +- LOK_CALLBACK_SEARCH_RESULT_SELECTION ++ LOK_CALLBACK_SEARCH_RESULT_SELECTION, ++ ++ /** ++ * Result of the UNO command execution when bNotifyWhenFinished was set ++ * to 'true' during the postUnoCommand() call. ++ * ++ * The result returns a success / failure state, and potentially ++ * additional data: ++ * ++ * { ++ * "commandName": "...", // the command for which this is the result ++ * "success": true/false, // when the result is "don't know", this is missing ++ * // TODO "result": "..." // UNO Any converted to JSON (not implemented yet) ++ * } ++ */ ++ LOK_CALLBACK_UNO_COMMAND_RESULT + } + LibreOfficeKitCallbackType; + +diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h +index 81f42105d374..32cb66963220 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h ++++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h +@@ -184,12 +184,14 @@ gboolean lok_doc_view_get_edit (LOKDocView* + * @pDocView: the #LOKDocView instance + * @pCommand: the command to issue to LO core + * @pArguments: the arguments to the given command ++ * @bNotifyWhenFinished: normally false, but it may be useful for eg. .uno:Save + * + * Posts the .uno: command to the LibreOfficeKit. + */ + void lok_doc_view_post_command (LOKDocView* pDocView, + const gchar* pCommand, +- const gchar* pArguments); ++ const gchar* pArguments, ++ gboolean bNotifyWhenFinished); + + /** + * lok_doc_view_pixel_to_twip: +diff --git a/include/comphelper/dispatchcommand.hxx b/include/comphelper/dispatchcommand.hxx +index 58aa0b940f4e..7b76bd5a0310 100644 +--- a/include/comphelper/dispatchcommand.hxx ++++ b/include/comphelper/dispatchcommand.hxx +@@ -14,6 +14,7 @@ + #include + #include + #include ++#include + + namespace comphelper + { +@@ -24,7 +25,9 @@ namespace comphelper + + @return true on success. + */ +-COMPHELPER_DLLPUBLIC bool dispatchCommand(const OUString& rCommand, const css::uno::Sequence& rArguments); ++COMPHELPER_DLLPUBLIC bool dispatchCommand(const OUString& rCommand, ++ const css::uno::Sequence& rArguments, ++ css::uno::Reference aListener = css::uno::Reference()); + + } + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 795fb4ed7ff7..96a69fcf64f8 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -595,7 +595,7 @@ static void doSearch(GtkWidget* pButton, bool bBackwards) + std::stringstream aStream; + boost::property_tree::write_json(aStream, aTree); + +- lok_doc_view_post_command(pLOKDocView, ".uno:ExecuteSearch", aStream.str().c_str()); ++ lok_doc_view_post_command(pLOKDocView, ".uno:ExecuteSearch", aStream.str().c_str(), false); + } + + /// Click handler for the search next button. +@@ -671,6 +671,12 @@ static void signalCommand(LOKDocView* pLOKDocView, char* pPayload, gpointer /*pD + } + } + ++/// LOKDocView command finished -> just write it to the console, not that useful for the viewer. ++static void signalCommandResult(LOKDocView* /*pLOKDocView*/, char* pPayload, gpointer /*pData*/) ++{ ++ fprintf(stderr, "Command finished: %s\n", pPayload); ++} ++ + static void loadChanged(LOKDocView* /*pLOKDocView*/, gdouble fValue, gpointer pData) + { + GtkWidget* pProgressBar = GTK_WIDGET (pData); +@@ -773,7 +779,11 @@ static void toggleToolItem(GtkWidget* pWidget, gpointer /*pData*/) + GtkToolItem* pItem = GTK_TOOL_ITEM(pWidget); + const std::string& rString = rWindow.m_aToolItemCommandNames[pItem]; + g_info("toggleToolItem: lok_doc_view_post_command('%s')", rString.c_str()); +- lok_doc_view_post_command(pLOKDocView, rString.c_str(), 0); ++ ++ // notify about the finished Save ++ gboolean bNotify = (rString == ".uno:Save"); ++ ++ lok_doc_view_post_command(pLOKDocView, rString.c_str(), 0, bNotify); + } + } + +@@ -1171,6 +1181,7 @@ static void setupDocView(GtkWidget* pDocView) + #endif + g_signal_connect(pDocView, "edit-changed", G_CALLBACK(signalEdit), NULL); + g_signal_connect(pDocView, "command-changed", G_CALLBACK(signalCommand), NULL); ++ g_signal_connect(pDocView, "command-result", G_CALLBACK(signalCommandResult), NULL); + g_signal_connect(pDocView, "search-not-found", G_CALLBACK(signalSearch), NULL); + g_signal_connect(pDocView, "search-result-count", G_CALLBACK(signalSearchResultCount), NULL); + g_signal_connect(pDocView, "part-changed", G_CALLBACK(signalPart), NULL); +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 49d5ecc54f65..bcb1d136b749 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -180,6 +180,7 @@ enum + HYPERLINK_CLICKED, + CURSOR_CHANGED, + SEARCH_RESULT_COUNT, ++ COMMAND_RESULT, + + LAST_SIGNAL + }; +@@ -461,6 +462,11 @@ static void searchResultCount(LOKDocView* pDocView, const std::string& rString) + g_signal_emit(pDocView, doc_view_signals[SEARCH_RESULT_COUNT], 0, rString.c_str()); + } + ++static void commandResult(LOKDocView* pDocView, const std::string& rString) ++{ ++ g_signal_emit(pDocView, doc_view_signals[COMMAND_RESULT], 0, rString.c_str()); ++} ++ + static void + setPart(LOKDocView* pDocView, const std::string& rString) + { +@@ -752,6 +758,11 @@ callback (gpointer pData) + searchResultCount(pDocView, std::to_string(nCount)); + } + break; ++ case LOK_CALLBACK_UNO_COMMAND_RESULT: ++ { ++ commandResult(pDocView, pCallback->m_aPayload); ++ } ++ break; + default: + g_assert(false); + break; +@@ -1520,7 +1531,7 @@ postCommandInThread (gpointer data) + std::stringstream ss; + ss << "lok::Document::postUnoCommand(" << pLOEvent->m_pCommand << ", " << pLOEvent->m_pArguments << ")"; + g_info(ss.str().c_str()); +- priv->m_pDocument->pClass->postUnoCommand(priv->m_pDocument, pLOEvent->m_pCommand, pLOEvent->m_pArguments); ++ priv->m_pDocument->pClass->postUnoCommand(priv->m_pDocument, pLOEvent->m_pCommand, pLOEvent->m_pArguments, pLOEvent->m_bNotifyWhenFinished); + } + + static void +@@ -2077,6 +2088,7 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + G_TYPE_NONE, 4, + G_TYPE_INT, G_TYPE_INT, + G_TYPE_INT, G_TYPE_INT); ++ + /** + * LOKDocView::search-result-count: + * @pDocView: the #LOKDocView on which the signal is emitted +@@ -2092,6 +2104,22 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + G_TYPE_NONE, 1, + G_TYPE_STRING); + ++ /** ++ * LOKDocView::command-result: ++ * @pDocView: the #LOKDocView on which the signal is emitted ++ * @aCommand: JSON containing the info about the command that finished, ++ * and its success status. ++ */ ++ doc_view_signals[COMMAND_RESULT] = ++ g_signal_new("command-result", ++ G_TYPE_FROM_CLASS(pGObjectClass), ++ G_SIGNAL_RUN_FIRST, ++ 0, ++ NULL, NULL, ++ g_cclosure_marshal_VOID__STRING, ++ G_TYPE_NONE, 1, ++ G_TYPE_STRING); ++ + } + + SAL_DLLPUBLIC_EXPORT GtkWidget* +@@ -2326,7 +2354,8 @@ lok_doc_view_get_edit (LOKDocView* pDocView) + SAL_DLLPUBLIC_EXPORT void + lok_doc_view_post_command (LOKDocView* pDocView, + const gchar* pCommand, +- const gchar* pArguments) ++ const gchar* pArguments, ++ gboolean bNotifyWhenFinished) + { + LOKDocViewPrivate& priv = getPrivate(pDocView); + GTask* task = g_task_new(pDocView, NULL, NULL, NULL); +@@ -2334,6 +2363,7 @@ lok_doc_view_post_command (LOKDocView* pDocView, + GError* error = NULL; + pLOEvent->m_pCommand = pCommand; + pLOEvent->m_pArguments = g_strdup(pArguments); ++ pLOEvent->m_bNotifyWhenFinished = bNotifyWhenFinished; + + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); +diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx +index 5e1ea1a27049..8a8569eeb306 100644 +--- a/libreofficekit/source/gtk/tilebuffer.hxx ++++ b/libreofficekit/source/gtk/tilebuffer.hxx +@@ -171,6 +171,7 @@ struct LOEvent + ///@{ + const gchar* m_pCommand; + gchar* m_pArguments; ++ gboolean m_bNotifyWhenFinished; + ///@} + + /// @name open_document parameter +@@ -223,6 +224,7 @@ struct LOEvent + : m_nType(type) + , m_pCommand(0) + , m_pArguments(0) ++ , m_bNotifyWhenFinished(false) + , m_pPath(0) + , m_bEdit(false) + , m_nPartMode(0) +-- +2.12.0 + diff --git a/SOURCES/0265-build-fix.patch b/SOURCES/0265-build-fix.patch new file mode 100644 index 0000000..fe6fa5b --- /dev/null +++ b/SOURCES/0265-build-fix.patch @@ -0,0 +1,27 @@ +From adee960bb03e45e26fffae2ccc36dad3eaa4d72b Mon Sep 17 00:00:00 2001 +From: Stephan Bergmann +Date: Tue, 3 Nov 2015 14:20:01 +0100 +Subject: [PATCH 265/398] build fix? + +Change-Id: Icb48acfdba90b95ae55d2f4b9f05871dc3a8732b +(cherry picked from commit dc586816a94f8deba2b6f8868f3aeb3ba0f6be51) +--- + desktop/qa/desktop_lib/test_desktop_lib.cxx | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx +index d4135b66d1d8..c14261e82db6 100644 +--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx ++++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx +@@ -333,7 +333,7 @@ void DesktopLOKTest::testPasteWriter() + + CPPUNIT_ASSERT(pDocument->pClass->paste(pDocument, "text/plain;charset=utf-8", aText.getStr(), aText.getLength())); + +- pDocument->pClass->postUnoCommand(pDocument, ".uno:SelectAll", 0); ++ pDocument->pClass->postUnoCommand(pDocument, ".uno:SelectAll", 0, false); + char* pText = pDocument->pClass->getTextSelection(pDocument, "text/plain;charset=utf-8", 0); + CPPUNIT_ASSERT_EQUAL(OString("hello"), OString(pText)); + free(pText); +-- +2.12.0 + diff --git a/SOURCES/0266-sc-lok-allow-requesting-row-headers-only-for-a-logic.patch b/SOURCES/0266-sc-lok-allow-requesting-row-headers-only-for-a-logic.patch new file mode 100644 index 0000000..439ef52 --- /dev/null +++ b/SOURCES/0266-sc-lok-allow-requesting-row-headers-only-for-a-logic.patch @@ -0,0 +1,249 @@ +From b9bafd8ec0d8725350c4f00bcb9e60d2b06b976c Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 3 Nov 2015 15:05:37 +0100 +Subject: [PATCH 266/398] sc lok: allow requesting row headers only for a logic + area + +So that for large documents it's not needed to query all of them on +load, but (similar to tiled rendering itself) it's possible to query the +data that affects the visible area. + +One catch is that the row sizes are relative, so there is a placeholder +row in case the visible area is not the top left corner, and +constructing its size needs special care. Normally the handed out twip +values have to be floored after twip->px conversion, but this one is +already rounded (as the total is a sum of px values, again becase of the +previous floor rule), so need to play the +0.5 trick to allow clients +always just flooring the logic conversion result they get. + +Change-Id: I64a155582acdee7b2acc741d77a2c462409b91a8 +(cherry picked from commit 75303695eb4bfe6c8fdea2cad0d3ed3f912f95c9) +--- + desktop/source/lib/init.cxx | 45 +++++++++++++++++++++- + include/vcl/ITiledRenderable.hxx | 5 ++- + .../qa/gtktiledviewer/gtktiledviewer.cxx | 12 +++++- + sc/inc/docuno.hxx | 2 +- + sc/source/ui/inc/tabview.hxx | 2 +- + sc/source/ui/unoobj/docuno.cxx | 4 +- + sc/source/ui/view/tabview.cxx | 36 ++++++++++++++--- + 7 files changed, 92 insertions(+), 14 deletions(-) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 9ba26c414d8c..b9aeedd5e21c 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -1204,6 +1204,9 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand) + + static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCommand) + { ++ OString aCommand(pCommand); ++ static const OString aViewRowColumnHeaders(".uno:ViewRowColumnHeaders"); ++ + if (!strcmp(pCommand, ".uno:CharFontName")) + { + return getFonts(pCommand); +@@ -1212,7 +1215,7 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo + { + return getStyles(pThis, pCommand); + } +- else if (OString(pCommand) == ".uno:ViewRowColumnHeaders") ++ else if (aCommand.startsWith(aViewRowColumnHeaders)) + { + ITiledRenderable* pDoc = getTiledRenderable(pThis); + if (!pDoc) +@@ -1221,7 +1224,45 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo + return 0; + } + +- OUString aHeaders = pDoc->getRowColumnHeaders(); ++ Rectangle aRectangle; ++ if (aCommand.getLength() > aViewRowColumnHeaders.getLength()) ++ { ++ // Command has parameters. ++ int nX = 0; ++ int nY = 0; ++ int nWidth = 0; ++ int nHeight = 0; ++ OString aArguments = aCommand.copy(aViewRowColumnHeaders.getLength() + 1); ++ sal_Int32 nParamIndex = 0; ++ do ++ { ++ OString aParamToken = aArguments.getToken(0, '&', nParamIndex); ++ sal_Int32 nIndex = 0; ++ OString aKey; ++ OString aValue; ++ do ++ { ++ OString aToken = aParamToken.getToken(0, '=', nIndex); ++ if (!aKey.getLength()) ++ aKey = aToken; ++ else ++ aValue = aToken; ++ } ++ while (nIndex >= 0); ++ if (aKey == "x") ++ nX = aValue.toInt32(); ++ else if (aKey == "y") ++ nY = aValue.toInt32(); ++ else if (aKey == "width") ++ nWidth = aValue.toInt32(); ++ else if (aKey == "height") ++ nHeight = aValue.toInt32(); ++ } ++ while (nParamIndex >= 0); ++ aRectangle = Rectangle(nX, nY, nX + nWidth, nY + nHeight); ++ } ++ ++ OUString aHeaders = pDoc->getRowColumnHeaders(aRectangle); + OString aString = OUStringToOString(aHeaders, RTL_TEXTENCODING_UTF8); + char* pMemory = static_cast(malloc(aString.getLength() + 1)); + strcpy(pMemory, aString.getStr()); +diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx +index 48a13ffc1275..efa9bc272b40 100644 +--- a/include/vcl/ITiledRenderable.hxx ++++ b/include/vcl/ITiledRenderable.hxx +@@ -150,8 +150,11 @@ public: + + /** + * Get position and content of row/column headers of Calc documents. ++ * ++ * @param rRectangle - if not empty, then limit the output only to the area of this rectangle ++ * @return a JSON describing position/content of rows/columns + */ +- virtual OUString getRowColumnHeaders() ++ virtual OUString getRowColumnHeaders(const Rectangle& /*rRectangle*/) + { + return OUString(); + } +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 96a69fcf64f8..953eeb0f1db2 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -256,8 +256,16 @@ gboolean TiledRowColumnBar::docConfigureEvent(GtkWidget* pDocView, GdkEventConfi + LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(LOK_DOC_VIEW(pDocView)); + if (pDocument && pDocument->pClass->getDocumentType(pDocument) == LOK_DOCTYPE_SPREADSHEET) + { +- g_info("lok::Document::getCommandValues(.uno:ViewRowColumnHeaders)"); +- char* pValues = pDocument->pClass->getCommandValues(pDocument, ".uno:ViewRowColumnHeaders"); ++ std::stringstream aCommand; ++ aCommand << ".uno:ViewRowColumnHeaders"; ++ aCommand << "?x=" << int(lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView), rWindow.m_pColumnBar->m_nPositionPixel)); ++ aCommand << "&width=" << int(lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView), rWindow.m_pColumnBar->m_nSizePixel)); ++ aCommand << "&y=" << int(lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView), rWindow.m_pRowBar->m_nPositionPixel)); ++ aCommand << "&height=" << int(lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView), rWindow.m_pRowBar->m_nSizePixel)); ++ std::stringstream ss; ++ ss << "lok::Document::getCommandValues(" << aCommand.str() << ")"; ++ g_info(ss.str().c_str()); ++ char* pValues = pDocument->pClass->getCommandValues(pDocument, aCommand.str().c_str()); + std::stringstream aStream(pValues); + free(pValues); + assert(!aStream.str().empty()); +diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx +index b4711c54c883..828fc1af7ea0 100644 +--- a/sc/inc/docuno.hxx ++++ b/sc/inc/docuno.hxx +@@ -423,7 +423,7 @@ public: + virtual bool isMimeTypeSupported() override; + + /// @see vcl::ITiledRenderable::getRowColumnHeaders(). +- virtual OUString getRowColumnHeaders() override; ++ virtual OUString getRowColumnHeaders(const Rectangle& rRectangle) override; + }; + + class ScDrawPagesObj : public cppu::WeakImplHelper2< +diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx +index 5b0852041108..548742c6c22b 100644 +--- a/sc/source/ui/inc/tabview.hxx ++++ b/sc/source/ui/inc/tabview.hxx +@@ -521,7 +521,7 @@ public: + void ResetAutoSpell(); + void SetAutoSpellData( SCCOL nPosX, SCROW nPosY, const std::vector* pRanges ); + /// @see ScModelObj::getRowColumnHeaders(). +- OUString getRowColumnHeaders(); ++ OUString getRowColumnHeaders(const Rectangle& rRectangle); + }; + + #endif +diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx +index 267798d4e949..1316fd73d328 100644 +--- a/sc/source/ui/unoobj/docuno.cxx ++++ b/sc/source/ui/unoobj/docuno.cxx +@@ -873,7 +873,7 @@ bool ScModelObj::isMimeTypeSupported() + return EditEngine::HasValidData(aDataHelper.GetTransferable()); + } + +-OUString ScModelObj::getRowColumnHeaders() ++OUString ScModelObj::getRowColumnHeaders(const Rectangle& rRectangle) + { + ScViewData* pViewData = ScDocShell::GetViewData(); + if (!pViewData) +@@ -883,7 +883,7 @@ OUString ScModelObj::getRowColumnHeaders() + if (!pTabView) + return OUString(); + +- return pTabView->getRowColumnHeaders(); ++ return pTabView->getRowColumnHeaders(rRectangle); + } + + void ScModelObj::initializeForTiledRendering() +diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx +index 2d886bca6003..1cb869cbd432 100644 +--- a/sc/source/ui/view/tabview.cxx ++++ b/sc/source/ui/view/tabview.cxx +@@ -2303,7 +2303,7 @@ void ScTabView::SetAutoSpellData( SCCOL nPosX, SCROW nPosY, const std::vectorGetTiledRenderingArea(aViewData.GetTabNo(), nEndCol, nEndRow); + + boost::property_tree::ptree aRows; ++ long nTotal = 0; ++ long nTotalPixels = 0; + for (SCROW nRow = 0; nRow <= nEndRow; ++nRow) + { +- boost::property_tree::ptree aRow; + sal_uInt16 nSize = pDoc->GetOriginalHeight(nRow, aViewData.GetTabNo()); +- aRow.put("size", OString::number(nSize).getStr()); + OUString aText = pRowBar[SC_SPLIT_BOTTOM]->GetEntryText(nRow); +- aRow.put("text", aText.toUtf8().getStr()); +- aRows.push_back(std::make_pair("", aRow)); ++ ++ bool bSkip = false; ++ if (!rRectangle.IsEmpty()) ++ { ++ long nTop = std::max(rRectangle.Top(), nTotal); ++ long nBottom = std::min(rRectangle.Bottom(), nTotal + nSize); ++ if (nBottom < nTop) ++ // They do not intersect. ++ bSkip = true; ++ } ++ if (!bSkip) ++ { ++ if (aRows.empty()) ++ { ++ // The sizes are relative sizes, so include the total skipped size before the real items. ++ boost::property_tree::ptree aRow; ++ // Client is required to floor(), rather than round() the sizes in general, so add 0.5 here to have rounding. ++ aRow.put("size", OString::number(long((nTotalPixels + 0.5) / aViewData.GetPPTY())).getStr()); ++ aRow.put("text", ""); ++ aRows.push_back(std::make_pair("", aRow)); ++ } ++ boost::property_tree::ptree aRow; ++ aRow.put("size", OString::number(nSize).getStr()); ++ aRow.put("text", aText.toUtf8().getStr()); ++ aRows.push_back(std::make_pair("", aRow)); ++ } ++ nTotal += nSize; ++ nTotalPixels += long(nSize * aViewData.GetPPTY()); + } + + boost::property_tree::ptree aCols; +-- +2.12.0 + diff --git a/SOURCES/0267-sc-lok-allow-requesting-column-headers-only-for-a-lo.patch b/SOURCES/0267-sc-lok-allow-requesting-column-headers-only-for-a-lo.patch new file mode 100644 index 0000000..de08deb --- /dev/null +++ b/SOURCES/0267-sc-lok-allow-requesting-column-headers-only-for-a-lo.patch @@ -0,0 +1,62 @@ +From fb9903c682fdabcc425caea737d81eda1a33f902 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 3 Nov 2015 15:37:31 +0100 +Subject: [PATCH 267/398] sc lok: allow requesting column headers only for a + logic area + +Change-Id: Iacd8f11917e929c6a1579c6a1553eb7840df5fba +(cherry picked from commit 0fe622f66ee04f25b05c2069f573010e6f517915) +--- + sc/source/ui/view/tabview.cxx | 32 ++++++++++++++++++++++++++++---- + 1 file changed, 28 insertions(+), 4 deletions(-) + +diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx +index 1cb869cbd432..ab77b47bed0c 100644 +--- a/sc/source/ui/view/tabview.cxx ++++ b/sc/source/ui/view/tabview.cxx +@@ -2351,14 +2351,38 @@ OUString ScTabView::getRowColumnHeaders(const Rectangle& rRectangle) + } + + boost::property_tree::ptree aCols; ++ nTotal = 0; ++ nTotalPixels = 0; + for (SCCOL nCol = 0; nCol <= nEndCol; ++nCol) + { +- boost::property_tree::ptree aCol; + sal_uInt16 nSize = pDoc->GetColWidth(nCol, aViewData.GetTabNo()); +- aCol.put("size", OString::number(nSize).getStr()); + OUString aText = pColBar[SC_SPLIT_LEFT]->GetEntryText(nCol); +- aCol.put("text", aText.toUtf8().getStr()); +- aCols.push_back(std::make_pair("", aCol)); ++ ++ bool bSkip = false; ++ if (!rRectangle.IsEmpty()) ++ { ++ long nLeft = std::max(rRectangle.Left(), nTotal); ++ long nRight = std::min(rRectangle.Right(), nTotal + nSize); ++ if (nRight < nLeft) ++ // They do not intersect. ++ bSkip = true; ++ } ++ if (!bSkip) ++ { ++ if (aCols.empty()) ++ { ++ boost::property_tree::ptree aCol; ++ aCol.put("size", OString::number(long((nTotalPixels + 0.5) / aViewData.GetPPTX())).getStr()); ++ aCol.put("text", ""); ++ aCols.push_back(std::make_pair("", aCol)); ++ } ++ boost::property_tree::ptree aCol; ++ aCol.put("size", OString::number(nSize).getStr()); ++ aCol.put("text", aText.toUtf8().getStr()); ++ aCols.push_back(std::make_pair("", aCol)); ++ } ++ nTotal += nSize; ++ nTotalPixels += long(nSize * aViewData.GetPPTX()); + } + + boost::property_tree::ptree aTree; +-- +2.12.0 + diff --git a/SOURCES/0268-Werror-Wformat-security.patch b/SOURCES/0268-Werror-Wformat-security.patch new file mode 100644 index 0000000..c3b4bc1 --- /dev/null +++ b/SOURCES/0268-Werror-Wformat-security.patch @@ -0,0 +1,27 @@ +From 9e14d0d17a06e002b0729c710f6abe6b1d7ef220 Mon Sep 17 00:00:00 2001 +From: Stephan Bergmann +Date: Tue, 3 Nov 2015 16:06:26 +0100 +Subject: [PATCH 268/398] -Werror,-Wformat-security + +Change-Id: I34976a4900a73505a91d3e58736675ab39ad174c +(cherry picked from commit 1347b90c9e5f54fd0b7e7147519f34d3c1b282d5) +--- + libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 953eeb0f1db2..ae9f2600440c 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -264,7 +264,7 @@ gboolean TiledRowColumnBar::docConfigureEvent(GtkWidget* pDocView, GdkEventConfi + aCommand << "&height=" << int(lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView), rWindow.m_pRowBar->m_nSizePixel)); + std::stringstream ss; + ss << "lok::Document::getCommandValues(" << aCommand.str() << ")"; +- g_info(ss.str().c_str()); ++ g_info("%s", ss.str().c_str()); + char* pValues = pDocument->pClass->getCommandValues(pDocument, aCommand.str().c_str()); + std::stringstream aStream(pValues); + free(pValues); +-- +2.12.0 + diff --git a/SOURCES/0269-sc-lok-avoid-placeholder-row-when-providing-all-head.patch b/SOURCES/0269-sc-lok-avoid-placeholder-row-when-providing-all-head.patch new file mode 100644 index 0000000..50dbd07 --- /dev/null +++ b/SOURCES/0269-sc-lok-avoid-placeholder-row-when-providing-all-head.patch @@ -0,0 +1,103 @@ +From 177773ea3cb22e81fa30dd9ffc89aa7e8a8fa4f1 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 3 Nov 2015 16:26:46 +0100 +Subject: [PATCH 269/398] sc lok: avoid placeholder row when providing all + headers + +In case the logic visible area is known, info is provided only about the +visible headers. Given that only relative sizes (no absolute positions) +are provided, a placeholder row/col is added to the result that contains +the total size of the skipped items. + +These placeholder items are not needed when providing all headers, so +don't emit them. + +Change-Id: I48ccb73554313f4d2bb420e4402995719b0f9f7d +(cherry picked from commit 788cec0a60dcfce6d86c820e9d0f7a1eb634f7bf) +--- + desktop/qa/desktop_lib/test_desktop_lib.cxx | 32 +++++++++++++++++++++++++++++ + sc/source/ui/view/tabview.cxx | 4 ++-- + 2 files changed, 34 insertions(+), 2 deletions(-) + +diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx +index c14261e82db6..29b0aedd4dfa 100644 +--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx ++++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx +@@ -66,6 +66,7 @@ public: + void testSaveAs(); + void testSaveAsCalc(); + void testPasteWriter(); ++ void testRowColumnHeaders(); + + CPPUNIT_TEST_SUITE(DesktopLOKTest); + CPPUNIT_TEST(testGetStyles); +@@ -78,6 +79,7 @@ public: + CPPUNIT_TEST(testSaveAs); + CPPUNIT_TEST(testSaveAsCalc); + CPPUNIT_TEST(testPasteWriter); ++ CPPUNIT_TEST(testRowColumnHeaders); + CPPUNIT_TEST_SUITE_END(); + + uno::Reference mxComponent; +@@ -346,6 +348,36 @@ void DesktopLOKTest::testPasteWriter() + comphelper::LibreOfficeKit::setActive(false); + } + ++void DesktopLOKTest::testRowColumnHeaders() ++{ ++ LibLODocument_Impl* pDocument = loadDoc("search.ods"); ++ boost::property_tree::ptree aTree; ++ char* pJSON = pDocument->m_pDocumentClass->getCommandValues(pDocument, ".uno:ViewRowColumnHeaders"); ++ std::stringstream aStream(pJSON); ++ free(pJSON); ++ CPPUNIT_ASSERT(!aStream.str().empty()); ++ ++ boost::property_tree::read_json(aStream, aTree); ++ for (boost::property_tree::ptree::value_type& rValue : aTree.get_child("rows")) ++ { ++ sal_Int32 nSize = OString(rValue.second.get("size").c_str()).toInt32(); ++ CPPUNIT_ASSERT(nSize > 0); ++ OString aText(rValue.second.get("text").c_str()); ++ // This failed, as the first item did not contain the text of the first row. ++ CPPUNIT_ASSERT_EQUAL(OString("1"), aText); ++ break; ++ } ++ ++ for (boost::property_tree::ptree::value_type& rValue : aTree.get_child("columns")) ++ { ++ sal_Int32 nSize = OString(rValue.second.get("size").c_str()).toInt32(); ++ CPPUNIT_ASSERT(nSize > 0); ++ OString aText(rValue.second.get("text").c_str()); ++ CPPUNIT_ASSERT_EQUAL(OString("A"), aText); ++ break; ++ } ++} ++ + CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); + + CPPUNIT_PLUGIN_IMPLEMENT(); +diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx +index ab77b47bed0c..8edec1b22f3a 100644 +--- a/sc/source/ui/view/tabview.cxx ++++ b/sc/source/ui/view/tabview.cxx +@@ -2332,7 +2332,7 @@ OUString ScTabView::getRowColumnHeaders(const Rectangle& rRectangle) + } + if (!bSkip) + { +- if (aRows.empty()) ++ if (aRows.empty() && nTotal > 0) + { + // The sizes are relative sizes, so include the total skipped size before the real items. + boost::property_tree::ptree aRow; +@@ -2369,7 +2369,7 @@ OUString ScTabView::getRowColumnHeaders(const Rectangle& rRectangle) + } + if (!bSkip) + { +- if (aCols.empty()) ++ if (aCols.empty() && nTotal > 0) + { + boost::property_tree::ptree aCol; + aCol.put("size", OString::number(long((nTotalPixels + 0.5) / aViewData.GetPPTX())).getStr()); +-- +2.12.0 + diff --git a/SOURCES/0270-lok-Unit-test-for-LOK_CALLBACK_UNO_COMMAND_RESULT.patch b/SOURCES/0270-lok-Unit-test-for-LOK_CALLBACK_UNO_COMMAND_RESULT.patch new file mode 100644 index 0000000..129fe84 --- /dev/null +++ b/SOURCES/0270-lok-Unit-test-for-LOK_CALLBACK_UNO_COMMAND_RESULT.patch @@ -0,0 +1,95 @@ +From 8e7c77d0706c4a2870de61948364667b575ff027 Mon Sep 17 00:00:00 2001 +From: Jan Holesovsky +Date: Tue, 3 Nov 2015 16:43:03 +0100 +Subject: [PATCH 270/398] lok: Unit test for LOK_CALLBACK_UNO_COMMAND_RESULT. + +Change-Id: I917d47478504dc6fafd3fc675fe8458690c7cc2a +(cherry picked from commit a4988d227c3933721098b2a61a087ec18eaa6c8e) +--- + desktop/qa/desktop_lib/test_desktop_lib.cxx | 36 +++++++++++++++++++++++++++++ + 1 file changed, 36 insertions(+) + +diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx +index 29b0aedd4dfa..15fe123fdc37 100644 +--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx ++++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -67,6 +68,7 @@ public: + void testSaveAsCalc(); + void testPasteWriter(); + void testRowColumnHeaders(); ++ void testCommandResult(); + + CPPUNIT_TEST_SUITE(DesktopLOKTest); + CPPUNIT_TEST(testGetStyles); +@@ -80,12 +82,17 @@ public: + CPPUNIT_TEST(testSaveAsCalc); + CPPUNIT_TEST(testPasteWriter); + CPPUNIT_TEST(testRowColumnHeaders); ++ CPPUNIT_TEST(testCommandResult); + CPPUNIT_TEST_SUITE_END(); + + uno::Reference mxComponent; + OString m_aTextSelection; + std::vector m_aSearchResultSelection; + std::vector m_aSearchResultPart; ++ ++ // for testCommandResult ++ osl::Condition m_aCommandResultCondition; ++ OString m_aCommandResult; + }; + + LibLODocument_Impl* DesktopLOKTest::loadDoc(const char* pName, LibreOfficeKitDocumentType eType) +@@ -149,6 +156,12 @@ void DesktopLOKTest::callbackImpl(int nType, const char* pPayload) + } + } + break; ++ case LOK_CALLBACK_UNO_COMMAND_RESULT: ++ { ++ m_aCommandResult = pPayload; ++ m_aCommandResultCondition.set(); ++ } ++ break; + } + } + +@@ -378,6 +391,29 @@ void DesktopLOKTest::testRowColumnHeaders() + } + } + ++void DesktopLOKTest::testCommandResult() ++{ ++ LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); ++ pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this); ++ ++ // the postUnoCommand() is supposed to be async, let's test it safely ++ // [no idea if it is async in reality - most probably we are operating ++ // under some solar mutex or something anyway ;-) - but...] ++ m_aCommandResultCondition.reset(); ++ ++ pDocument->pClass->postUnoCommand(pDocument, ".uno:Bold", 0, true); ++ ++ TimeValue aTimeValue = { 2 , 0 }; // 2 seconds max ++ m_aCommandResultCondition.wait(aTimeValue); ++ ++ boost::property_tree::ptree aTree; ++ std::stringstream aStream(m_aCommandResult.getStr()); ++ boost::property_tree::read_json(aStream, aTree); ++ ++ CPPUNIT_ASSERT_EQUAL(aTree.get_child("commandName").get_value(), std::string(".uno:Bold")); ++ CPPUNIT_ASSERT_EQUAL(aTree.get_child("success").get_value(), true); ++} ++ + CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); + + CPPUNIT_PLUGIN_IMPLEMENT(); +-- +2.12.0 + diff --git a/SOURCES/0271-lok-Fix-crash-due-to-non-initialized-callback.patch b/SOURCES/0271-lok-Fix-crash-due-to-non-initialized-callback.patch new file mode 100644 index 0000000..62fe436 --- /dev/null +++ b/SOURCES/0271-lok-Fix-crash-due-to-non-initialized-callback.patch @@ -0,0 +1,67 @@ +From d048d2bb9464d5bb86b37e7da436be6ffe13ab29 Mon Sep 17 00:00:00 2001 +From: Jan Holesovsky +Date: Tue, 3 Nov 2015 16:52:46 +0100 +Subject: [PATCH 271/398] lok: Fix crash due to non-initialized callback. + +Yay for unit tests! :-) + +Change-Id: I06b3f929b53d5c03f5722acfdaf0eaf841325e34 +(cherry picked from commit b846b03c709130564527da8d264660a131361221) +--- + desktop/qa/desktop_lib/test_desktop_lib.cxx | 15 ++++++++++++--- + desktop/source/lib/init.cxx | 6 ++++-- + 2 files changed, 16 insertions(+), 5 deletions(-) + +diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx +index 15fe123fdc37..4c23ecb50b73 100644 +--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx ++++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx +@@ -394,16 +394,25 @@ void DesktopLOKTest::testRowColumnHeaders() + void DesktopLOKTest::testCommandResult() + { + LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); +- pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this); + + // the postUnoCommand() is supposed to be async, let's test it safely + // [no idea if it is async in reality - most probably we are operating + // under some solar mutex or something anyway ;-) - but...] +- m_aCommandResultCondition.reset(); ++ TimeValue aTimeValue = { 2 , 0 }; // 2 seconds max + ++ // nothing is triggered when we have no callback yet, we just time out on ++ // the condition var. ++ m_aCommandResultCondition.reset(); + pDocument->pClass->postUnoCommand(pDocument, ".uno:Bold", 0, true); ++ m_aCommandResultCondition.wait(aTimeValue); + +- TimeValue aTimeValue = { 2 , 0 }; // 2 seconds max ++ CPPUNIT_ASSERT(m_aCommandResult.isEmpty()); ++ ++ // but we get some real values when the callback is set up ++ pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this); ++ ++ m_aCommandResultCondition.reset(); ++ pDocument->pClass->postUnoCommand(pDocument, ".uno:Bold", 0, true); + m_aCommandResultCondition.wait(aTimeValue); + + boost::property_tree::ptree aTree; +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index b9aeedd5e21c..bf244cd7aefa 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -268,8 +268,10 @@ static void doc_setView(LibreOfficeKitDocument* pThis, int nId); + static int doc_getView(LibreOfficeKitDocument* pThis); + static int doc_getViews(LibreOfficeKitDocument* pThis); + +-LibLODocument_Impl::LibLODocument_Impl(const uno::Reference &xComponent) : +- mxComponent( xComponent ) ++LibLODocument_Impl::LibLODocument_Impl(const uno::Reference &xComponent) ++ : mxComponent(xComponent) ++ , mpCallback(nullptr) ++ , mpCallbackData(nullptr) + { + if (!(m_pDocumentClass = gDocumentClass.lock())) + { +-- +2.12.0 + diff --git a/SOURCES/0272-Werror-Wformat-security.patch b/SOURCES/0272-Werror-Wformat-security.patch new file mode 100644 index 0000000..4d37a05 --- /dev/null +++ b/SOURCES/0272-Werror-Wformat-security.patch @@ -0,0 +1,36 @@ +From c2a9d38653fb3732dd8dbece557443423ba4b956 Mon Sep 17 00:00:00 2001 +From: Stephan Bergmann +Date: Tue, 3 Nov 2015 22:20:45 +0100 +Subject: [PATCH 272/398] -Werror,-Wformat-security + +Change-Id: I23f4b906456fdba84f2772a4ed15ac6c141a094d +(cherry picked from commit 02b39996fa8447305900adad509250646c0a3b80) +--- + libreofficekit/source/gtk/lokdocview.cxx | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index bcb1d136b749..9cf78a3f5429 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -1530,7 +1530,7 @@ postCommandInThread (gpointer data) + priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId); + std::stringstream ss; + ss << "lok::Document::postUnoCommand(" << pLOEvent->m_pCommand << ", " << pLOEvent->m_pArguments << ")"; +- g_info(ss.str().c_str()); ++ g_info("%s", ss.str().c_str()); + priv->m_pDocument->pClass->postUnoCommand(priv->m_pDocument, pLOEvent->m_pCommand, pLOEvent->m_pArguments, pLOEvent->m_bNotifyWhenFinished); + } + +@@ -1566,7 +1566,7 @@ paintTileInThread (gpointer data) + << aTileRectangle.x << ", " << aTileRectangle.y << ", " + << pixelToTwip(nTileSizePixels, pLOEvent->m_fPaintTileZoom) << ", " + << pixelToTwip(nTileSizePixels, pLOEvent->m_fPaintTileZoom) << ")"; +- g_info(ss.str().c_str()); ++ g_info("%s", ss.str().c_str()); + priv->m_pDocument->pClass->paintTile(priv->m_pDocument, + pBuffer, + nTileSizePixels, nTileSizePixels, +-- +2.12.0 + diff --git a/SOURCES/0273-sc-lok-return-absolute-positions-for-row-column-head.patch b/SOURCES/0273-sc-lok-return-absolute-positions-for-row-column-head.patch new file mode 100644 index 0000000..596bac0 --- /dev/null +++ b/SOURCES/0273-sc-lok-return-absolute-positions-for-row-column-head.patch @@ -0,0 +1,181 @@ +From b3c590099965fbe3adb89a1b40e8d346f82d3d76 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Wed, 4 Nov 2015 10:32:23 +0100 +Subject: [PATCH 273/398] sc lok: return absolute positions for row/column + headers + +This simplifies both LOK API implementation and client code, and also +clients are no longer required to floor() the twip -> pixel conversion +result. + +Change-Id: I63dbc05f53e8f7582b964c43d5da3aad51ede10d +(cherry picked from commit 84dedf4ff8e7267efa95674e6545c80c9b995cb2) +--- + .../qa/gtktiledviewer/gtktiledviewer.cxx | 36 ++++++++-------------- + sc/source/ui/view/tabview.cxx | 26 ++++------------ + 2 files changed, 19 insertions(+), 43 deletions(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index ae9f2600440c..6ebd5bcc6ef5 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -192,16 +192,16 @@ gboolean TiledRowColumnBar::drawImpl(GtkWidget* /*pWidget*/, cairo_t* pCairo) + { + cairo_set_source_rgb(pCairo, 0, 0, 0); + +- int nTotal = 0; ++ int nPrevious = 0; + for (const Header& rHeader : m_aHeaders) + { + GdkRectangle aRectangle; + if (m_eType == ROW) + { + aRectangle.x = 0; +- aRectangle.y = nTotal - 1; ++ aRectangle.y = nPrevious - 1; + aRectangle.width = ROW_HEADER_WIDTH - 1; +- aRectangle.height = rHeader.m_nSize; ++ aRectangle.height = rHeader.m_nSize - nPrevious; + // Left line. + cairo_rectangle(pCairo, aRectangle.x, aRectangle.y, 1, aRectangle.height); + cairo_fill(pCairo); +@@ -214,9 +214,9 @@ gboolean TiledRowColumnBar::drawImpl(GtkWidget* /*pWidget*/, cairo_t* pCairo) + } + else + { +- aRectangle.x = nTotal - 1; ++ aRectangle.x = nPrevious - 1; + aRectangle.y = 0; +- aRectangle.width = rHeader.m_nSize; ++ aRectangle.width = rHeader.m_nSize - nPrevious; + aRectangle.height = COLUMN_HEADER_HEIGHT - 1; + // Top line. + cairo_rectangle(pCairo, aRectangle.x, aRectangle.y, aRectangle.width, 1); +@@ -229,8 +229,8 @@ gboolean TiledRowColumnBar::drawImpl(GtkWidget* /*pWidget*/, cairo_t* pCairo) + cairo_fill(pCairo); + } + drawText(pCairo, aRectangle, rHeader.m_aText); +- nTotal += rHeader.m_nSize; +- if (nTotal > m_nSizePixel) ++ nPrevious = rHeader.m_nSize; ++ if (rHeader.m_nSize > m_nSizePixel) + break; + } + +@@ -275,39 +275,29 @@ gboolean TiledRowColumnBar::docConfigureEvent(GtkWidget* pDocView, GdkEventConfi + gtk_widget_show(rWindow.m_pCornerButton->m_pDrawingArea); + + rWindow.m_pRowBar->m_aHeaders.clear(); +- int nTotal = 0; + for (boost::property_tree::ptree::value_type& rValue : aTree.get_child("rows")) + { +- int nSize = lok_doc_view_twip_to_pixel(LOK_DOC_VIEW(pDocView), std::atof(rValue.second.get("size").c_str())); +- int nScrolledSize = nSize; +- if (nTotal + nSize >= rWindow.m_pRowBar->m_nPositionPixel) ++ int nSize = std::round(lok_doc_view_twip_to_pixel(LOK_DOC_VIEW(pDocView), std::atof(rValue.second.get("size").c_str()))); ++ if (nSize >= rWindow.m_pRowBar->m_nPositionPixel) + { +- if (nTotal < rWindow.m_pRowBar->m_nPositionPixel) +- // First visible row: reduce height because the row is only partially visible. +- nScrolledSize = nTotal + nSize - rWindow.m_pRowBar->m_nPositionPixel; ++ int nScrolledSize = nSize - rWindow.m_pRowBar->m_nPositionPixel; + Header aHeader(nScrolledSize, rValue.second.get("text")); + rWindow.m_pRowBar->m_aHeaders.push_back(aHeader); + } +- nTotal += nSize; + } + gtk_widget_show(rWindow.m_pRowBar->m_pDrawingArea); + gtk_widget_queue_draw(rWindow.m_pRowBar->m_pDrawingArea); + + rWindow.m_pColumnBar->m_aHeaders.clear(); +- nTotal = 0; + for (boost::property_tree::ptree::value_type& rValue : aTree.get_child("columns")) + { +- int nSize = lok_doc_view_twip_to_pixel(LOK_DOC_VIEW(pDocView), std::atof(rValue.second.get("size").c_str())); +- int nScrolledSize = nSize; +- if (nTotal + nSize >= rWindow.m_pColumnBar->m_nPositionPixel) ++ int nSize = std::round(lok_doc_view_twip_to_pixel(LOK_DOC_VIEW(pDocView), std::atof(rValue.second.get("size").c_str()))); ++ if (nSize >= rWindow.m_pColumnBar->m_nPositionPixel) + { +- if (nTotal < rWindow.m_pColumnBar->m_nPositionPixel) +- // First visible column: reduce width because the column is only partially visible. +- nScrolledSize = nTotal + nSize - rWindow.m_pColumnBar->m_nPositionPixel; ++ int nScrolledSize = nSize - rWindow.m_pColumnBar->m_nPositionPixel; + Header aHeader(nScrolledSize, rValue.second.get("text")); + rWindow.m_pColumnBar->m_aHeaders.push_back(aHeader); + } +- nTotal += nSize; + } + gtk_widget_show(rWindow.m_pColumnBar->m_pDrawingArea); + gtk_widget_queue_draw(rWindow.m_pColumnBar->m_pDrawingArea); +diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx +index 8edec1b22f3a..d8fcd4ff4a73 100644 +--- a/sc/source/ui/view/tabview.cxx ++++ b/sc/source/ui/view/tabview.cxx +@@ -2319,6 +2319,7 @@ OUString ScTabView::getRowColumnHeaders(const Rectangle& rRectangle) + for (SCROW nRow = 0; nRow <= nEndRow; ++nRow) + { + sal_uInt16 nSize = pDoc->GetOriginalHeight(nRow, aViewData.GetTabNo()); ++ long nSizePixels = ScViewData::ToPixel(nSize, aViewData.GetPPTY()); + OUString aText = pRowBar[SC_SPLIT_BOTTOM]->GetEntryText(nRow); + + bool bSkip = false; +@@ -2332,22 +2333,13 @@ OUString ScTabView::getRowColumnHeaders(const Rectangle& rRectangle) + } + if (!bSkip) + { +- if (aRows.empty() && nTotal > 0) +- { +- // The sizes are relative sizes, so include the total skipped size before the real items. +- boost::property_tree::ptree aRow; +- // Client is required to floor(), rather than round() the sizes in general, so add 0.5 here to have rounding. +- aRow.put("size", OString::number(long((nTotalPixels + 0.5) / aViewData.GetPPTY())).getStr()); +- aRow.put("text", ""); +- aRows.push_back(std::make_pair("", aRow)); +- } + boost::property_tree::ptree aRow; +- aRow.put("size", OString::number(nSize).getStr()); ++ aRow.put("size", OString::number((nTotalPixels + nSizePixels) / aViewData.GetPPTY()).getStr()); + aRow.put("text", aText.toUtf8().getStr()); + aRows.push_back(std::make_pair("", aRow)); + } + nTotal += nSize; +- nTotalPixels += long(nSize * aViewData.GetPPTY()); ++ nTotalPixels += nSizePixels; + } + + boost::property_tree::ptree aCols; +@@ -2356,6 +2348,7 @@ OUString ScTabView::getRowColumnHeaders(const Rectangle& rRectangle) + for (SCCOL nCol = 0; nCol <= nEndCol; ++nCol) + { + sal_uInt16 nSize = pDoc->GetColWidth(nCol, aViewData.GetTabNo()); ++ long nSizePixels = ScViewData::ToPixel(nSize, aViewData.GetPPTX()); + OUString aText = pColBar[SC_SPLIT_LEFT]->GetEntryText(nCol); + + bool bSkip = false; +@@ -2369,20 +2362,13 @@ OUString ScTabView::getRowColumnHeaders(const Rectangle& rRectangle) + } + if (!bSkip) + { +- if (aCols.empty() && nTotal > 0) +- { +- boost::property_tree::ptree aCol; +- aCol.put("size", OString::number(long((nTotalPixels + 0.5) / aViewData.GetPPTX())).getStr()); +- aCol.put("text", ""); +- aCols.push_back(std::make_pair("", aCol)); +- } + boost::property_tree::ptree aCol; +- aCol.put("size", OString::number(nSize).getStr()); ++ aCol.put("size", OString::number((nTotalPixels + nSizePixels) / aViewData.GetPPTX()).getStr()); + aCol.put("text", aText.toUtf8().getStr()); + aCols.push_back(std::make_pair("", aCol)); + } + nTotal += nSize; +- nTotalPixels += long(nSize * aViewData.GetPPTX()); ++ nTotalPixels += nSizePixels; + } + + boost::property_tree::ptree aTree; +-- +2.12.0 + diff --git a/SOURCES/0274-CppunitTest_desktop_lib-test-absolute-positions-for-.patch b/SOURCES/0274-CppunitTest_desktop_lib-test-absolute-positions-for-.patch new file mode 100644 index 0000000..0323a3b --- /dev/null +++ b/SOURCES/0274-CppunitTest_desktop_lib-test-absolute-positions-for-.patch @@ -0,0 +1,99 @@ +From 8cef5dbaf83e049e929d6319acb785bdaac447a5 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Wed, 4 Nov 2015 10:59:08 +0100 +Subject: [PATCH 274/398] CppunitTest_desktop_lib: test absolute positions for + row/column headers + +Change-Id: If2526647221fef2c6b18b21b589192239d8a89ad +(cherry picked from commit 2bed1867531fc91d1bd20da226d3fa012356125d) +--- + desktop/qa/desktop_lib/test_desktop_lib.cxx | 54 ++++++++++++++++++++++++++--- + 1 file changed, 49 insertions(+), 5 deletions(-) + +diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx +index 4c23ecb50b73..8c622a577231 100644 +--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx ++++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx +@@ -363,6 +363,35 @@ void DesktopLOKTest::testPasteWriter() + + void DesktopLOKTest::testRowColumnHeaders() + { ++ /* ++ * Payload example: ++ * ++ * { ++ * "rows": [ ++ * { ++ * "size": "254.987250637468", ++ * "text": "1" ++ * }, ++ * { ++ * "size": "509.974501274936", ++ * "text": "2" ++ * } ++ * ], ++ * "columns": [ ++ * { ++ * "size": "1274.93625318734", ++ * "text": "A" ++ * }, ++ * { ++ * "size": "2549.87250637468", ++ * "text": "B" ++ * } ++ * ] ++ * } ++ * ++ * "size" defines the bottom/right boundary of a row/column in twips (size between 0 and boundary) ++ * "text" has the header label in UTF-8 ++ */ + LibLODocument_Impl* pDocument = loadDoc("search.ods"); + boost::property_tree::ptree aTree; + char* pJSON = pDocument->m_pDocumentClass->getCommandValues(pDocument, ".uno:ViewRowColumnHeaders"); +@@ -371,23 +400,38 @@ void DesktopLOKTest::testRowColumnHeaders() + CPPUNIT_ASSERT(!aStream.str().empty()); + + boost::property_tree::read_json(aStream, aTree); ++ sal_Int32 nPrevious = 0; + for (boost::property_tree::ptree::value_type& rValue : aTree.get_child("rows")) + { + sal_Int32 nSize = OString(rValue.second.get("size").c_str()).toInt32(); + CPPUNIT_ASSERT(nSize > 0); + OString aText(rValue.second.get("text").c_str()); +- // This failed, as the first item did not contain the text of the first row. +- CPPUNIT_ASSERT_EQUAL(OString("1"), aText); +- break; ++ if (!nPrevious) ++ // This failed, as the first item did not contain the text of the first row. ++ CPPUNIT_ASSERT_EQUAL(OString("1"), aText); ++ else ++ { ++ // Make sure that size is absolute: the first two items have the same relative size. ++ CPPUNIT_ASSERT(nPrevious < nSize); ++ break; ++ } ++ nPrevious = nSize; + } + ++ nPrevious = 0; + for (boost::property_tree::ptree::value_type& rValue : aTree.get_child("columns")) + { + sal_Int32 nSize = OString(rValue.second.get("size").c_str()).toInt32(); + CPPUNIT_ASSERT(nSize > 0); + OString aText(rValue.second.get("text").c_str()); +- CPPUNIT_ASSERT_EQUAL(OString("A"), aText); +- break; ++ if (!nPrevious) ++ CPPUNIT_ASSERT_EQUAL(OString("A"), aText); ++ else ++ { ++ CPPUNIT_ASSERT(nPrevious < nSize); ++ break; ++ } ++ nPrevious = nSize; + } + } + +-- +2.12.0 + diff --git a/SOURCES/0275-lokdocview-Don-t-render-tiles-while-tile-buffer-has-.patch b/SOURCES/0275-lokdocview-Don-t-render-tiles-while-tile-buffer-has-.patch new file mode 100644 index 0000000..24b30ac --- /dev/null +++ b/SOURCES/0275-lokdocview-Don-t-render-tiles-while-tile-buffer-has-.patch @@ -0,0 +1,176 @@ +From 26a44f8b7e9ce4e5e9a097f5fedc04d4717fd51d Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Sun, 1 Nov 2015 17:11:09 +0530 +Subject: [PATCH 275/398] lokdocview: Don't render tiles while tile buffer has + changed + +This is common when widget gets a zoom request, resulting in a +new tile buffer, and the tiles from the old tile buffer are still +waiting to be processed in the LOK thread, for old tile buffer. If +we allow these useless operations to execute successfully, they +would end up writing in new tile buffer giving false results. + +Lets tag every paint tile operations with their respective tile +buffer during `task` creation, and then check whether the tile +buffer has changed or not before writing to the tile buffer. + +Change-Id: If784341a67ad430bc3415b765137badaad6b97f6 +Reviewed-on: https://gerrit.libreoffice.org/19726 +Reviewed-by: Miklos Vajna +Tested-by: Miklos Vajna +(cherry picked from commit 93f98e98e42d75914a3e1d8f85bd3c6328d2e111) +--- + libreofficekit/source/gtk/lokdocview.cxx | 38 ++++++++++++++++++++++++++++++-- + libreofficekit/source/gtk/tilebuffer.cxx | 6 +++++ + libreofficekit/source/gtk/tilebuffer.hxx | 15 +++++++++++++ + 3 files changed, 57 insertions(+), 2 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 9cf78a3f5429..575116f4d028 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -912,7 +912,12 @@ paintTileCallback(GObject* sourceObject, GAsyncResult* res, gpointer userData) + GdkPixbuf* pPixBuf = static_cast(paintTileFinish(pDocView, res, &error)); + if (error != NULL) + { +- g_warning("Unable to get painted GdkPixbuf: %s", error->message); ++ if (error->domain == LOK_TILEBUFFER_ERROR && ++ error->code == LOK_TILEBUFFER_CHANGED) ++ g_info("Skipping paint tile request because corresponding" ++ "tile buffer has been destroyed"); ++ else ++ g_warning("Unable to get painted GdkPixbuf: %s", error->message); + g_error_free(error); + return; + } +@@ -977,6 +982,7 @@ renderDocument(LOKDocView* pDocView, cairo_t* pCairo) + pLOEvent->m_nPaintTileX = nRow; + pLOEvent->m_nPaintTileY = nColumn; + pLOEvent->m_fPaintTileZoom = priv->m_fZoom; ++ pLOEvent->m_pTileBuffer = &*priv->m_pTileBuffer; + GTask* task = g_task_new(pDocView, NULL, paintTileCallback, pLOEvent); + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + +@@ -1541,6 +1547,17 @@ paintTileInThread (gpointer data) + LOKDocView* pDocView = LOK_DOC_VIEW(g_task_get_source_object(task)); + LOKDocViewPrivate& priv = getPrivate(pDocView); + LOEvent* pLOEvent = static_cast(g_task_get_task_data(task)); ++ ++ // check if "source" tile buffer is different from "current" tile buffer ++ if (pLOEvent->m_pTileBuffer != &*priv->m_pTileBuffer) ++ { ++ pLOEvent->m_pTileBuffer = nullptr; ++ g_task_return_new_error(task, ++ LOK_TILEBUFFER_ERROR, ++ LOK_TILEBUFFER_CHANGED, ++ "TileBuffer has changed"); ++ return; ++ } + std::unique_ptr& buffer = priv->m_pTileBuffer; + int index = pLOEvent->m_nPaintTileX * buffer->m_nWidth + pLOEvent->m_nPaintTileY; + if (buffer->m_mTiles.find(index) != buffer->m_mTiles.end() && +@@ -1550,7 +1567,10 @@ paintTileInThread (gpointer data) + GdkPixbuf* pPixBuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, nTileSizePixels, nTileSizePixels); + if (!pPixBuf) + { +- g_info ("Error allocating memory to pixbuf"); ++ g_task_return_new_error(task, ++ LOK_TILEBUFFER_ERROR, ++ LOK_TILEBUFFER_MEMORY, ++ "Error allocating memory to GdkPixbuf"); + return; + } + +@@ -1574,6 +1594,20 @@ paintTileInThread (gpointer data) + pixelToTwip(nTileSizePixels, pLOEvent->m_fPaintTileZoom), + pixelToTwip(nTileSizePixels, pLOEvent->m_fPaintTileZoom)); + ++ // Its likely that while the tilebuffer has changed, one of the paint tile ++ // requests has passed the previous check at start of this function, and has ++ // rendered the tile already. We want to stop such rendered tiles from being ++ // stored in new tile buffer. ++ if (pLOEvent->m_pTileBuffer != &*priv->m_pTileBuffer) ++ { ++ pLOEvent->m_pTileBuffer = nullptr; ++ g_task_return_new_error(task, ++ LOK_TILEBUFFER_ERROR, ++ LOK_TILEBUFFER_CHANGED, ++ "TileBuffer has changed"); ++ return; ++ } ++ + g_task_return_pointer(task, pPixBuf, g_object_unref); + } + +diff --git a/libreofficekit/source/gtk/tilebuffer.cxx b/libreofficekit/source/gtk/tilebuffer.cxx +index 1158209b2273..32a9534e884c 100644 +--- a/libreofficekit/source/gtk/tilebuffer.cxx ++++ b/libreofficekit/source/gtk/tilebuffer.cxx +@@ -121,4 +121,10 @@ void LOEvent::destroy(void* pMemory) + delete pLOEvent; + } + ++GQuark ++LOKTileBufferErrorQuark(void) ++{ ++ return g_quark_from_static_string("lok-tilebuffer-error"); ++} ++ + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx +index 8a8569eeb306..9407257e5fec 100644 +--- a/libreofficekit/source/gtk/tilebuffer.hxx ++++ b/libreofficekit/source/gtk/tilebuffer.hxx +@@ -19,6 +19,8 @@ + #include + #include + ++#define LOK_TILEBUFFER_ERROR (LOKTileBufferErrorQuark()) ++ + // We know that VirtualDevices use a DPI of 96. + const int DPI = 96; + // Lets use a square of side 256 pixels for each tile. +@@ -45,6 +47,11 @@ float pixelToTwip(float fInput, float zoom); + float twipToPixel(float fInput, float zoom); + + /** ++ Gets GQuark identifying this tile buffer errors ++*/ ++GQuark LOKTileBufferErrorQuark(void); ++ ++/** + This class represents a single tile in the tile buffer. + It encloses a reference to GdkPixBuf containing the pixel data of the tile. + */ +@@ -155,6 +162,12 @@ enum + LOK_SET_GRAPHIC_SELECTION + }; + ++enum ++{ ++ LOK_TILEBUFFER_CHANGED, ++ LOK_TILEBUFFER_MEMORY ++}; ++ + /** + A struct that we use to store the data about the LOK call. + +@@ -200,6 +213,7 @@ struct LOEvent + int m_nPaintTileX; + int m_nPaintTileY; + float m_fPaintTileZoom; ++ TileBuffer* m_pTileBuffer; + ///@} + + /// @name postMouseEvent parameters +@@ -235,6 +249,7 @@ struct LOEvent + , m_nPaintTileX(0) + , m_nPaintTileY(0) + , m_fPaintTileZoom(0) ++ , m_pTileBuffer(nullptr) + , m_nPostMouseEventType(0) + , m_nPostMouseEventX(0) + , m_nPostMouseEventY(0) +-- +2.12.0 + diff --git a/SOURCES/0276-sc-lok-Cell-Cursor-callback.patch b/SOURCES/0276-sc-lok-Cell-Cursor-callback.patch new file mode 100644 index 0000000..1902dc7 --- /dev/null +++ b/SOURCES/0276-sc-lok-Cell-Cursor-callback.patch @@ -0,0 +1,177 @@ +From 8289d40ed650611d5c5dbfe84810ac48af3665dc Mon Sep 17 00:00:00 2001 +From: Andrzej Hunt +Date: Mon, 2 Nov 2015 11:43:05 +0100 +Subject: [PATCH 276/398] sc lok: Cell Cursor callback + +This only works correctly for the default zoom level - since +the updateLibreOfficeKitCellCursor call happens during the +internal / hidden rendering, it uses the internal zoom values, +which can differ from the tiled-rendering zoom values. + +Conflicts: + include/LibreOfficeKit/LibreOfficeKitEnums.h + +(cherry picked from commit 799406068d34bb69a077fcc0548bfed002f05641) + +Change-Id: Ie4f344fe771078fca10ad9d6f7a93e88fb93880a +--- + include/LibreOfficeKit/LibreOfficeKitEnums.h | 9 +++++++- + libreofficekit/source/gtk/lokdocview.cxx | 30 ++++++++++++++++++++++++++ + sc/source/ui/view/gridwin.cxx | 32 ++++++++++++++++++++++++---- + 3 files changed, 66 insertions(+), 5 deletions(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h +index 86d9e6bfd873..bf6267585a0a 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h ++++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h +@@ -195,7 +195,14 @@ typedef enum + * // TODO "result": "..." // UNO Any converted to JSON (not implemented yet) + * } + */ +- LOK_CALLBACK_UNO_COMMAND_RESULT ++ LOK_CALLBACK_UNO_COMMAND_RESULT, ++ ++ /** ++ * The size and/or the position of the cell cursor changed. ++ * ++ * Rectangle format is the same as LOK_CALLBACK_INVALIDATE_TILES. ++ */ ++ LOK_CALLBACK_CELL_CURSOR + } + LibreOfficeKitCallbackType; + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 575116f4d028..73b01797dbf9 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -79,6 +79,7 @@ struct LOKDocViewPrivateImpl + /// Position and size of the selection end. + GdkRectangle m_aTextSelectionEnd; + GdkRectangle m_aGraphicSelection; ++ GdkRectangle m_aCellCursor; + gboolean m_bInDragGraphicSelection; + + /// @name Start/middle/end handle. +@@ -140,6 +141,7 @@ struct LOKDocViewPrivateImpl + m_aTextSelectionStart({0, 0, 0, 0}), + m_aTextSelectionEnd({0, 0, 0, 0}), + m_aGraphicSelection({0, 0, 0, 0}), ++ m_aCellCursor({0, 0, 0, 0}), + m_bInDragGraphicSelection(false), + m_pHandleStart(0), + m_aHandleStartRect({0, 0, 0, 0}), +@@ -275,6 +277,8 @@ callbackTypeToString (int nType) + return "LOK_CALLBACK_CURSOR_VISIBLE"; + case LOK_CALLBACK_GRAPHIC_SELECTION: + return "LOK_CALLBACK_GRAPHIC_SELECTION"; ++ case LOK_CALLBACK_CELL_CURSOR: ++ return "LOK_CALLBACK_CELL_CURSOR"; + case LOK_CALLBACK_HYPERLINK_CLICKED: + return "LOK_CALLBACK_HYPERLINK_CLICKED"; + case LOK_CALLBACK_STATE_CHANGED: +@@ -719,6 +723,15 @@ callback (gpointer pData) + gtk_widget_queue_draw(GTK_WIDGET(pDocView)); + } + break; ++ case LOK_CALLBACK_CELL_CURSOR: ++ { ++ if (pCallback->m_aPayload != "EMPTY") ++ priv->m_aCellCursor = payloadToRectangle(pDocView, pCallback->m_aPayload.c_str()); ++ else ++ memset(&priv->m_aCellCursor, 0, sizeof(priv->m_aCellCursor)); ++ gtk_widget_queue_draw(GTK_WIDGET(pDocView)); ++ } ++ break; + case LOK_CALLBACK_HYPERLINK_CLICKED: + { + hyperlinkClicked(pDocView, pCallback->m_aPayload); +@@ -1074,6 +1087,22 @@ renderOverlay(LOKDocView* pDocView, cairo_t* pCairo) + g_free (handleGraphicPath); + } + ++ if (!isEmptyRectangle(priv->m_aCellCursor)) ++ { ++ cairo_set_source_rgb(pCairo, 0, 0, 0); ++ cairo_rectangle(pCairo, ++ twipToPixel(priv->m_aCellCursor.x, priv->m_fZoom), ++ twipToPixel(priv->m_aCellCursor.y, priv->m_fZoom), ++ twipToPixel(priv->m_aCellCursor.width, priv->m_fZoom), ++ twipToPixel(priv->m_aCellCursor.height, priv->m_fZoom)); ++ // priv->m_aCellCursor.x - 1, ++ // priv->m_aCellCursor.y - 1, ++ // priv->m_aCellCursor.width + 2, ++ // priv->m_aCellCursor.height + 2); ++ cairo_set_line_width(pCairo, 2.0); ++ cairo_stroke(pCairo); ++ } ++ + return FALSE; + } + +@@ -2331,6 +2360,7 @@ lok_doc_view_reset_view(LOKDocView* pDocView) + memset(&priv->m_aTextSelectionEnd, 0, sizeof(priv->m_aTextSelectionEnd)); + memset(&priv->m_aGraphicSelection, 0, sizeof(priv->m_aGraphicSelection)); + priv->m_bInDragGraphicSelection = false; ++ memset(&priv->m_aCellCursor, 0, sizeof(priv->m_aCellCursor)); + + cairo_surface_destroy(priv->m_pHandleStart); + priv->m_pHandleStart = 0; +diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx +index f24b42f3b27e..7ab88c6c0eb1 100644 +--- a/sc/source/ui/view/gridwin.cxx ++++ b/sc/source/ui/view/gridwin.cxx +@@ -5782,13 +5782,38 @@ bool ScGridWindow::InsideVisibleRange( SCCOL nPosX, SCROW nPosY ) + return maVisibleRange.isInside(nPosX, nPosY); + } + +-// #114409# ++static void updateLibreOfficeKitCellCursor(ScViewData* pViewData, ScSplitPos eWhich) { ++ ScDocument* pDoc = pViewData->GetDocument(); ++ ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer(); ++ ++ if (!pDrawLayer->isTiledRendering()) ++ return; ++ ++ SCCOL nX = pViewData->GetCurX(); ++ SCROW nY = pViewData->GetCurY(); ++ Point aScrPos = pViewData->GetScrPos( nX, nY, eWhich, true ); ++ ++ long nSizeXPix; ++ long nSizeYPix; ++ pViewData->GetMergeSizePixel( nX, nY, nSizeXPix, nSizeYPix ); ++ ++ double fPPTX = pViewData->GetPPTX(); ++ double fPPTY = pViewData->GetPPTY(); ++ Rectangle aRect(Point(aScrPos.getX() / fPPTX, aScrPos.getY() / fPPTY), ++ Size(nSizeXPix / fPPTX, nSizeYPix / fPPTY)); ++ ++ pDrawLayer->libreOfficeKitCallback(LOK_CALLBACK_CELL_CURSOR, aRect.toString().getStr()); ++ ++} ++ + void ScGridWindow::CursorChanged() + { + // here the created OverlayObjects may be transformed in later versions. For + // now, just re-create them + + UpdateCursorOverlay(); ++ ++ updateLibreOfficeKitCellCursor(pViewData, eWhich); + } + + // #114409# +@@ -5942,9 +5967,8 @@ void ScGridWindow::UpdateCursorOverlay() + { + ScDocument* pDoc = pViewData->GetDocument(); + +- // never show the cell cursor when the tiled rendering is going on; either +- // we want to show the editeng selection, or the cell selection, but not +- // the cell cursor by itself ++ // The cursor is rendered client-side in tiled rendering - ++ // see updateLibreOfficeKitCellCursor. + if (pDoc->GetDrawLayer()->isTiledRendering()) + return; + +-- +2.12.0 + diff --git a/SOURCES/0277-sc-lok-Cache-viewdata-zoom-and-reuse-for-cursor-call.patch b/SOURCES/0277-sc-lok-Cache-viewdata-zoom-and-reuse-for-cursor-call.patch new file mode 100644 index 0000000..6c2fb1a --- /dev/null +++ b/SOURCES/0277-sc-lok-Cache-viewdata-zoom-and-reuse-for-cursor-call.patch @@ -0,0 +1,124 @@ +From a8b236d905a757af8028cc8ed14bbc7144e41072 Mon Sep 17 00:00:00 2001 +From: Andrzej Hunt +Date: Mon, 2 Nov 2015 13:24:12 +0100 +Subject: [PATCH 277/398] sc lok: Cache viewdata zoom and reuse for cursor + callback + +As of a1605d6860e3c4510177c42ab6d2fda569506f57 we reset the zoom +level to the default when processing LOK mouse events. The exact +cell cursor position is dependent on the zoom level (due to the +rounding in the cell position summing calculations), hence we need +to make sure we have the correct zoom level for those calculations +(or else the rounding errors will result in incorrect cell cursor +positions). Caching the zoom level and reusing it only here seems +to be the most efficient way of solving this for now. + +(An alternative would be to only send the cell ID in the callback, + and have the frontend then request the pixel positions together + with the current frontend zoom level - however especially for + LOOL minimising the number of trips is probably wise.) + +(cherry picked from commit fab3c48a0cd5a0517025993502a04358308fe5ef) + +Change-Id: Iae3aabfd7ea9bec7057be7b63670885766870c4f +--- + sc/source/ui/inc/gridwin.hxx | 10 ++++++++++ + sc/source/ui/view/gridwin.cxx | 12 +++++++++--- + sc/source/ui/view/gridwin4.cxx | 6 +++--- + 3 files changed, 22 insertions(+), 6 deletions(-) + +diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx +index b8425a8e34c3..747ce88c2038 100644 +--- a/sc/source/ui/inc/gridwin.hxx ++++ b/sc/source/ui/inc/gridwin.hxx +@@ -200,6 +200,15 @@ class ScGridWindow : public vcl::Window, public DropTargetHelper, public DragSou + bool bAutoMarkVisible:1; + bool bListValButton:1; + ++ // We cache the tiled rendering zoom level in order to be able to ++ // calculate the correct cell cursor position (which is dependent ++ // on the zoom level). The caching is necessary since ++ // ScModelObj::postMouseEvent resets the zoom level to the default, ++ // which means we have the default zoom level set during the ++ // cell cursor position calculations in updateLibreOfficeKitCellCursor(). ++ Fraction mTiledZoomX; ++ Fraction mTiledZoomY; ++ + DECL_LINK( PopupModeEndHdl, void* ); + DECL_LINK( PopupSpellingHdl, SpellCallbackInfo* ); + +@@ -292,6 +301,7 @@ class ScGridWindow : public vcl::Window, public DropTargetHelper, public DragSou + + void GetSelectionRects( ::std::vector< Rectangle >& rPixelRects ); + ++ void updateLibreOfficeKitCellCursor(); + protected: + virtual void PrePaint(vcl::RenderContext& rRenderContext) SAL_OVERRIDE; + virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE; +diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx +index 7ab88c6c0eb1..dd958e519249 100644 +--- a/sc/source/ui/view/gridwin.cxx ++++ b/sc/source/ui/view/gridwin.cxx +@@ -5782,7 +5782,7 @@ bool ScGridWindow::InsideVisibleRange( SCCOL nPosX, SCROW nPosY ) + return maVisibleRange.isInside(nPosX, nPosY); + } + +-static void updateLibreOfficeKitCellCursor(ScViewData* pViewData, ScSplitPos eWhich) { ++void ScGridWindow::updateLibreOfficeKitCellCursor() { + ScDocument* pDoc = pViewData->GetDocument(); + ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer(); + +@@ -5791,8 +5791,12 @@ static void updateLibreOfficeKitCellCursor(ScViewData* pViewData, ScSplitPos eWh + + SCCOL nX = pViewData->GetCurX(); + SCROW nY = pViewData->GetCurY(); +- Point aScrPos = pViewData->GetScrPos( nX, nY, eWhich, true ); + ++ Fraction defaultZoomX = pViewData->GetZoomX(); ++ Fraction defaultZoomY = pViewData->GetZoomX(); ++ pViewData->SetZoom(mTiledZoomX, mTiledZoomY, true); ++ ++ Point aScrPos = pViewData->GetScrPos( nX, nY, eWhich, true ); + long nSizeXPix; + long nSizeYPix; + pViewData->GetMergeSizePixel( nX, nY, nSizeXPix, nSizeYPix ); +@@ -5802,6 +5806,8 @@ static void updateLibreOfficeKitCellCursor(ScViewData* pViewData, ScSplitPos eWh + Rectangle aRect(Point(aScrPos.getX() / fPPTX, aScrPos.getY() / fPPTY), + Size(nSizeXPix / fPPTX, nSizeYPix / fPPTY)); + ++ pViewData->SetZoom(defaultZoomX, defaultZoomY, true); ++ + pDrawLayer->libreOfficeKitCallback(LOK_CALLBACK_CELL_CURSOR, aRect.toString().getStr()); + + } +@@ -5813,7 +5819,7 @@ void ScGridWindow::CursorChanged() + + UpdateCursorOverlay(); + +- updateLibreOfficeKitCellCursor(pViewData, eWhich); ++ updateLibreOfficeKitCellCursor(); + } + + // #114409# +diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx +index ceaf3d8d7c3a..cfdde43e1a04 100644 +--- a/sc/source/ui/view/gridwin4.cxx ++++ b/sc/source/ui/view/gridwin4.cxx +@@ -955,11 +955,11 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice, + // Similarly to Writer, we should set the mapmode once on the rDevice, and + // not care about any zoom settings. + +- Fraction aFracX(long(nOutputWidth * TWIPS_PER_PIXEL), nTileWidth); +- Fraction aFracY(long(nOutputHeight * TWIPS_PER_PIXEL), nTileHeight); ++ mTiledZoomX = Fraction(long(nOutputWidth * TWIPS_PER_PIXEL), nTileWidth); ++ mTiledZoomY = Fraction(long(nOutputHeight * TWIPS_PER_PIXEL), nTileHeight); + + // page break zoom, and aLogicMode in ScViewData +- pViewData->SetZoom(aFracX, aFracY, true); ++ pViewData->SetZoom(mTiledZoomX, mTiledZoomY, true); + + double fTilePosXPixel = static_cast(nTilePosX) * nOutputWidth / nTileWidth; + double fTilePosYPixel = static_cast(nTilePosY) * nOutputHeight / nTileHeight; +-- +2.12.0 + diff --git a/SOURCES/0278-sc-lok-make-cell-cursor-behaviour-consistent-with-de.patch b/SOURCES/0278-sc-lok-make-cell-cursor-behaviour-consistent-with-de.patch new file mode 100644 index 0000000..02ee28c --- /dev/null +++ b/SOURCES/0278-sc-lok-make-cell-cursor-behaviour-consistent-with-de.patch @@ -0,0 +1,150 @@ +From 21fcedc3a2989b6b979296164f014b59ae74d450 Mon Sep 17 00:00:00 2001 +From: Andrzej Hunt +Date: Tue, 3 Nov 2015 10:14:02 +0100 +Subject: [PATCH 278/398] sc lok: make cell cursor behaviour consistent with + desktop + +I.e. single click selects cell, typing activates the EditView +(and hides the cell cursor). (Previously: single click activates +the edit view, text cursor is shown, and no clean way of hiding +the cell cursor again.) + +(cherry picked from commit f859dac52e40759fb8202d891df4e1442bc35803) + +Change-Id: I184630277e8935e9f8a97a856191497ec5d62111 +--- + sc/source/ui/view/gridwin.cxx | 75 +++++++++++++++++++++++-------------------- + 1 file changed, 40 insertions(+), 35 deletions(-) + +diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx +index dd958e519249..daca987b14b2 100644 +--- a/sc/source/ui/view/gridwin.cxx ++++ b/sc/source/ui/view/gridwin.cxx +@@ -2412,7 +2412,9 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) + bEditAllowed = false; + } + +- if ( bEditAllowed ) ++ // We don't want to activate the edit view for a single click in tiled rendering ++ // (but we should probably keep the same behaviour for double clicks). ++ if ( bEditAllowed && (!bIsTiledRendering || bDouble) ) + { + // don't forward the event to an empty cell, causes deselection in + // case we used the double-click to select the empty cell +@@ -5809,7 +5811,6 @@ void ScGridWindow::updateLibreOfficeKitCellCursor() { + pViewData->SetZoom(defaultZoomX, defaultZoomY, true); + + pDrawLayer->libreOfficeKitCallback(LOK_CALLBACK_CELL_CURSOR, aRect.toString().getStr()); +- + } + + void ScGridWindow::CursorChanged() +@@ -5818,8 +5819,6 @@ void ScGridWindow::CursorChanged() + // now, just re-create them + + UpdateCursorOverlay(); +- +- updateLibreOfficeKitCellCursor(); + } + + // #114409# +@@ -5856,6 +5855,9 @@ void ScGridWindow::UpdateAllOverlays() + + void ScGridWindow::DeleteCursorOverlay() + { ++ ScDocument* pDoc = pViewData->GetDocument(); ++ ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer(); ++ pDrawLayer->libreOfficeKitCallback(LOK_CALLBACK_CELL_CURSOR, "EMPTY"); + mpOOCursors.reset(); + } + +@@ -5973,11 +5975,6 @@ void ScGridWindow::UpdateCursorOverlay() + { + ScDocument* pDoc = pViewData->GetDocument(); + +- // The cursor is rendered client-side in tiled rendering - +- // see updateLibreOfficeKitCellCursor. +- if (pDoc->GetDrawLayer()->isTiledRendering()) +- return; +- + MapMode aDrawMode = GetDrawMapMode(); + MapMode aOldMode = GetMapMode(); + if ( aOldMode != aDrawMode ) +@@ -6096,40 +6093,48 @@ void ScGridWindow::UpdateCursorOverlay() + } + } + ++ ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer(); ++ + if ( !aPixelRects.empty() ) + { +- // #i70788# get the OverlayManager safely +- rtl::Reference xOverlayManager = getOverlayManager(); +- +- if (xOverlayManager.is()) ++ if (pDrawLayer->isTiledRendering()) { ++ updateLibreOfficeKitCellCursor(); ++ } ++ else + { +- Color aCursorColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor ); +- if (pViewData->GetActivePart() != eWhich) +- // non-active pane uses a different color. +- aCursorColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::CALCPAGEBREAKAUTOMATIC).nColor; +- std::vector< basegfx::B2DRange > aRanges; +- const basegfx::B2DHomMatrix aTransform(GetInverseViewTransformation()); ++ // #i70788# get the OverlayManager safely ++ rtl::Reference xOverlayManager = getOverlayManager(); + +- for(sal_uInt32 a(0); a < aPixelRects.size(); a++) ++ if (xOverlayManager.is()) + { +- const Rectangle aRA(aPixelRects[a]); +- basegfx::B2DRange aRB(aRA.Left(), aRA.Top(), aRA.Right() + 1, aRA.Bottom() + 1); +- aRB.transform(aTransform); +- aRanges.push_back(aRB); +- } ++ Color aCursorColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor ); ++ if (pViewData->GetActivePart() != eWhich) ++ // non-active pane uses a different color. ++ aCursorColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::CALCPAGEBREAKAUTOMATIC).nColor; ++ std::vector< basegfx::B2DRange > aRanges; ++ const basegfx::B2DHomMatrix aTransform(GetInverseViewTransformation()); ++ ++ for(size_t a(0); a < aPixelRects.size(); a++) ++ { ++ const Rectangle aRA(aPixelRects[a]); ++ basegfx::B2DRange aRB(aRA.Left(), aRA.Top(), aRA.Right() + 1, aRA.Bottom() + 1); ++ aRB.transform(aTransform); ++ aRanges.push_back(aRB); ++ } + +- sdr::overlay::OverlayObject* pOverlay = new sdr::overlay::OverlaySelection( +- sdr::overlay::OVERLAY_SOLID, +- aCursorColor, +- aRanges, +- false); ++ sdr::overlay::OverlayObject* pOverlay = new sdr::overlay::OverlaySelection( ++ sdr::overlay::OVERLAY_SOLID, ++ aCursorColor, ++ aRanges, ++ false); + +- xOverlayManager->add(*pOverlay); +- mpOOCursors.reset(new sdr::overlay::OverlayObjectList); +- mpOOCursors->append(*pOverlay); ++ xOverlayManager->add(*pOverlay); ++ mpOOCursors.reset(new sdr::overlay::OverlayObjectList); ++ mpOOCursors->append(*pOverlay); + +- // notify the LibreOfficeKit too +- updateLibreOfficeKitSelection(pViewData, pDoc->GetDrawLayer(), aPixelRects); ++ // notify the LibreOfficeKit too ++ updateLibreOfficeKitSelection(pViewData, pDoc->GetDrawLayer(), aPixelRects); ++ } + } + } + +-- +2.12.0 + diff --git a/SOURCES/0279-sc-lok-tdf-94605-introduce-uno-CellCursor.patch b/SOURCES/0279-sc-lok-tdf-94605-introduce-uno-CellCursor.patch new file mode 100644 index 0000000..1ceca1a --- /dev/null +++ b/SOURCES/0279-sc-lok-tdf-94605-introduce-uno-CellCursor.patch @@ -0,0 +1,259 @@ +From 07f52f4e37afec5952dc42a9cafbcaac9c2152ae Mon Sep 17 00:00:00 2001 +From: Andrzej Hunt +Date: Wed, 4 Nov 2015 17:24:15 +0100 +Subject: [PATCH 279/398] sc lok: tdf#94605 introduce uno:CellCursor + +This allows the client to rerequest the current cursor position, +which is necessary e.g. on zoom-level changes. + +Conflicts: + desktop/source/lib/init.cxx + sc/inc/docuno.hxx + +Change-Id: I10d81e220a56a36e2ec0c59005cd1d4f134857d5 +(cherry picked from commit 2bcaffd12263e8f3c2a2fbf8ccc4b9bba2642146) +--- + desktop/source/lib/init.cxx | 43 ++++++++++++++++++++++++++++++++++++++++ + include/vcl/ITiledRenderable.hxx | 12 +++++++++++ + sc/inc/docuno.hxx | 6 ++++++ + sc/source/ui/inc/gridwin.hxx | 9 +++++++++ + sc/source/ui/unoobj/docuno.cxx | 17 ++++++++++++++++ + sc/source/ui/view/gridwin.cxx | 36 ++++++++++++++++++++++++++++----- + 6 files changed, 118 insertions(+), 5 deletions(-) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index bf244cd7aefa..3ca554d7e6f9 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -31,6 +31,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -1208,6 +1209,7 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo + { + OString aCommand(pCommand); + static const OString aViewRowColumnHeaders(".uno:ViewRowColumnHeaders"); ++ static const OString aCellCursor(".uno:CellCursor"); + + if (!strcmp(pCommand, ".uno:CharFontName")) + { +@@ -1266,6 +1268,47 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo + + OUString aHeaders = pDoc->getRowColumnHeaders(aRectangle); + OString aString = OUStringToOString(aHeaders, RTL_TEXTENCODING_UTF8); ++ ++ char* pMemory = static_cast(malloc(aString.getLength() + 1)); ++ strcpy(pMemory, aString.getStr()); ++ return pMemory; ++ } ++ else if (aCommand.startsWith(aCellCursor) ++ { ++ ITiledRenderable* pDoc = getTiledRenderable(pThis); ++ if (!pDoc) ++ { ++ gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering"; ++ return 0; ++ } ++ ++ OString aString; ++ OString aParams = aCommand.copy(OString(".uno:CellCursor:").getLength()); ++ ++ sal_Int32 nIndex = 0; ++ OString aOutputWidth = aParams.getToken(0, ',', nIndex); ++ OString aOutputHeight = aParams.getToken(0, ',', nIndex); ++ OString aTileWidth = aParams.getToken(0, ',', nIndex); ++ OString aTileHeight = aParams.getToken(0, ',', nIndex); ++ ++ int nOutputWidth, nOutputHeight; ++ long nTileWidth, nTileHeight; ++ if (!(comphelper::string::getTokenCount(aParams, ',') == 4 ++ && !aOutputWidth.isEmpty() ++ && (nOutputWidth = aOutputWidth.toInt32()) != 0 ++ && !aOutputHeight.isEmpty() ++ && (nOutputHeight = aOutputHeight.toInt32()) != 0 ++ && !aTileWidth.isEmpty() ++ && (nTileWidth = aTileWidth.toInt64()) != 0 ++ && !aTileHeight.isEmpty() ++ && (nTileHeight = aTileHeight.toInt64()) != 0)) ++ { ++ gImpl->maLastExceptionMsg = "Can't parse arguments for .uno:CellCursor, no cursor returned"; ++ return NULL; ++ } ++ ++ OString aString = pDoc->getCellCursor(nOutputWidth, nOutputHeight, nTileWidth, nTileHeight); ++ + char* pMemory = static_cast(malloc(aString.getLength() + 1)); + strcpy(pMemory, aString.getStr()); + return pMemory; +diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx +index efa9bc272b40..963f1fc7054a 100644 +--- a/include/vcl/ITiledRenderable.hxx ++++ b/include/vcl/ITiledRenderable.hxx +@@ -159,6 +159,18 @@ public: + return OUString(); + } + ++ /** ++ * Get position and size of cell cursor in Calc. ++ * (This could maybe also be used for tables in Writer/Impress in future?) ++ */ ++ virtual OString getCellCursor(int /*nOutputWidth*/, ++ int /*nOutputHeight*/, ++ long /*nTileWidth*/, ++ long /*nTileHeight*/) ++ { ++ return OString(); ++ } ++ + /// Sets the clipboard of the component. + virtual void setClipboard(const css::uno::Reference& xClipboard) = 0; + +diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx +index 828fc1af7ea0..70f61ca03548 100644 +--- a/sc/inc/docuno.hxx ++++ b/sc/inc/docuno.hxx +@@ -424,6 +424,12 @@ public: + + /// @see vcl::ITiledRenderable::getRowColumnHeaders(). + virtual OUString getRowColumnHeaders(const Rectangle& rRectangle) override; ++ ++ /// @see vcl::ITiledRenderable::getCellCursor(). ++ virtual OString getCellCursor( int nOutputWidth, ++ int nOutputHeight, ++ long nTileWidth, ++ long nTileHeight ) override; + }; + + class ScDrawPagesObj : public cppu::WeakImplHelper2< +diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx +index 747ce88c2038..8081f107409c 100644 +--- a/sc/source/ui/inc/gridwin.hxx ++++ b/sc/source/ui/inc/gridwin.hxx +@@ -301,6 +301,7 @@ class ScGridWindow : public vcl::Window, public DropTargetHelper, public DragSou + + void GetSelectionRects( ::std::vector< Rectangle >& rPixelRects ); + ++ + void updateLibreOfficeKitCellCursor(); + protected: + virtual void PrePaint(vcl::RenderContext& rRenderContext) SAL_OVERRIDE; +@@ -445,6 +446,14 @@ public: + void UpdateShrinkOverlay(); + void UpdateAllOverlays(); + ++ /// @see ScModelObj::getCellCursor(). ++ OString getCellCursor(const Fraction& rZoomX, ++ const Fraction& rZoomY); ++ OString getCellCursor(int nOutputWidth, ++ int nOutputHeight, ++ long nTileWidth, ++ long nTileHeight); ++ + protected: + // #114409# + void ImpCreateOverlayObjects(); +diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx +index 1316fd73d328..66794f3c6f27 100644 +--- a/sc/source/ui/unoobj/docuno.cxx ++++ b/sc/source/ui/unoobj/docuno.cxx +@@ -886,6 +886,23 @@ OUString ScModelObj::getRowColumnHeaders(const Rectangle& rRectangle) + return pTabView->getRowColumnHeaders(rRectangle); + } + ++OString ScModelObj::getCellCursor( int nOutputWidth, int nOutputHeight, ++ long nTileWidth, long nTileHeight ) ++{ ++ SolarMutexGuard aGuard; ++ ++ ScViewData* pViewData = ScDocShell::GetViewData(); ++ ++ if (!pViewData) ++ return OString(); ++ ++ ScGridWindow* pGridWindow = pViewData->GetActiveWin(); ++ if (!pGridWindow) ++ return OString(); ++ ++ return "{ \"commandName\": \".uno:CellCursor\", \"commandValues\": \"" + pGridWindow->getCellCursor( nOutputWidth, nOutputHeight, nTileWidth, nTileHeight ) + "\" }"; ++} ++ + void ScModelObj::initializeForTiledRendering() + { + SolarMutexGuard aGuard; +diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx +index daca987b14b2..efa8d332ad2a 100644 +--- a/sc/source/ui/view/gridwin.cxx ++++ b/sc/source/ui/view/gridwin.cxx +@@ -5784,19 +5784,36 @@ bool ScGridWindow::InsideVisibleRange( SCCOL nPosX, SCROW nPosY ) + return maVisibleRange.isInside(nPosX, nPosY); + } + +-void ScGridWindow::updateLibreOfficeKitCellCursor() { ++// Use the same zoom calculations as in paintTile - this ++// means the client can ensure they can get the correct ++// cursor corresponding to their current tile sizings. ++OString ScGridWindow::getCellCursor( int nOutputWidth, int nOutputHeight, ++ long nTileWidth, long nTileHeight ) ++{ ++ Fraction zoomX = Fraction(long(nOutputWidth * TWIPS_PER_PIXEL), nTileWidth); ++ Fraction zoomY = Fraction(long(nOutputHeight * TWIPS_PER_PIXEL), nTileHeight); ++ return getCellCursor(zoomX, zoomY); ++} ++ ++OString ScGridWindow::getCellCursor(const Fraction& rZoomX, const Fraction& rZoomY) { + ScDocument* pDoc = pViewData->GetDocument(); + ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer(); + +- if (!pDrawLayer->isTiledRendering()) +- return; ++ // GridWindows stores a shown cell cursor in mpOOCursors, hence ++ // we can use that to determine whether we would want to be showing ++ // one (client-side) for tiled rendering too. ++ if (!pDrawLayer->isTiledRendering() || !mpOOCursors.get()) ++ { ++ return OString("EMPTY"); ++ } + + SCCOL nX = pViewData->GetCurX(); + SCROW nY = pViewData->GetCurY(); + + Fraction defaultZoomX = pViewData->GetZoomX(); + Fraction defaultZoomY = pViewData->GetZoomX(); +- pViewData->SetZoom(mTiledZoomX, mTiledZoomY, true); ++ ++ pViewData->SetZoom(rZoomX, rZoomY, true); + + Point aScrPos = pViewData->GetScrPos( nX, nY, eWhich, true ); + long nSizeXPix; +@@ -5810,7 +5827,15 @@ void ScGridWindow::updateLibreOfficeKitCellCursor() { + + pViewData->SetZoom(defaultZoomX, defaultZoomY, true); + +- pDrawLayer->libreOfficeKitCallback(LOK_CALLBACK_CELL_CURSOR, aRect.toString().getStr()); ++ return aRect.toString(); ++} ++ ++void ScGridWindow::updateLibreOfficeKitCellCursor() ++{ ++ ScDocument* pDoc = pViewData->GetDocument(); ++ ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer(); ++ OString aCursor = getCellCursor(mTiledZoomX, mTiledZoomY); ++ pDrawLayer->libreOfficeKitCallback(LOK_CALLBACK_CELL_CURSOR, aCursor.getStr()); + } + + void ScGridWindow::CursorChanged() +@@ -6098,6 +6123,7 @@ void ScGridWindow::UpdateCursorOverlay() + if ( !aPixelRects.empty() ) + { + if (pDrawLayer->isTiledRendering()) { ++ mpOOCursors.reset(new sdr::overlay::OverlayObjectList); + updateLibreOfficeKitCellCursor(); + } + else +-- +2.12.0 + diff --git a/SOURCES/0280-sc-lok-update-parameter-syntax-for-.uno-CellCursor.patch b/SOURCES/0280-sc-lok-update-parameter-syntax-for-.uno-CellCursor.patch new file mode 100644 index 0000000..7b462af --- /dev/null +++ b/SOURCES/0280-sc-lok-update-parameter-syntax-for-.uno-CellCursor.patch @@ -0,0 +1,93 @@ +From 01e6ce0c2286016e7a8459d1f0d865b49765f585 Mon Sep 17 00:00:00 2001 +From: Andrzej Hunt +Date: Thu, 5 Nov 2015 10:31:06 +0100 +Subject: [PATCH 280/398] sc lok: update parameter syntax for .uno:CellCursor + +This follows the syntax for .uno:ViewRowColumnHeaders +(which was implemented somewhat concurrentl with CellCursor) + +Change-Id: I8ef03a969abc1716a0e95d95fb7043d75910c828 +(cherry picked from commit e7e0d46dba7b1016968a133330bca23a4bf668ec) +--- + desktop/source/lib/init.cxx | 57 +++++++++++++++++++++++++++------------------ + 1 file changed, 34 insertions(+), 23 deletions(-) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 3ca554d7e6f9..2e6e7e73df1a 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -1273,7 +1273,7 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo + strcpy(pMemory, aString.getStr()); + return pMemory; + } +- else if (aCommand.startsWith(aCellCursor) ++ else if (aCommand.startsWith(aCellCursor)) + { + ITiledRenderable* pDoc = getTiledRenderable(pThis); + if (!pDoc) +@@ -1282,29 +1282,40 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo + return 0; + } + +- OString aString; +- OString aParams = aCommand.copy(OString(".uno:CellCursor:").getLength()); +- +- sal_Int32 nIndex = 0; +- OString aOutputWidth = aParams.getToken(0, ',', nIndex); +- OString aOutputHeight = aParams.getToken(0, ',', nIndex); +- OString aTileWidth = aParams.getToken(0, ',', nIndex); +- OString aTileHeight = aParams.getToken(0, ',', nIndex); +- +- int nOutputWidth, nOutputHeight; +- long nTileWidth, nTileHeight; +- if (!(comphelper::string::getTokenCount(aParams, ',') == 4 +- && !aOutputWidth.isEmpty() +- && (nOutputWidth = aOutputWidth.toInt32()) != 0 +- && !aOutputHeight.isEmpty() +- && (nOutputHeight = aOutputHeight.toInt32()) != 0 +- && !aTileWidth.isEmpty() +- && (nTileWidth = aTileWidth.toInt64()) != 0 +- && !aTileHeight.isEmpty() +- && (nTileHeight = aTileHeight.toInt64()) != 0)) ++ // Command has parameters. ++ int nOutputWidth = 0; ++ int nOutputHeight = 0; ++ long nTileWidth = 0; ++ long nTileHeight = 0; ++ if (aCommand.getLength() > aCellCursor.getLength()) + { +- gImpl->maLastExceptionMsg = "Can't parse arguments for .uno:CellCursor, no cursor returned"; +- return NULL; ++ OString aArguments = aCommand.copy(aCellCursor.getLength() + 1); ++ sal_Int32 nParamIndex = 0; ++ do ++ { ++ OString aParamToken = aArguments.getToken(0, '&', nParamIndex); ++ sal_Int32 nIndex = 0; ++ OString aKey; ++ OString aValue; ++ do ++ { ++ OString aToken = aParamToken.getToken(0, '=', nIndex); ++ if (!aKey.getLength()) ++ aKey = aToken; ++ else ++ aValue = aToken; ++ } ++ while (nIndex >= 0); ++ if (aKey == "outputWidth") ++ nOutputWidth = aValue.toInt32(); ++ else if (aKey == "outputHeight") ++ nOutputHeight = aValue.toInt32(); ++ else if (aKey == "tileWidth") ++ nTileWidth = aValue.toInt64(); ++ else if (aKey == "tileHeight") ++ nTileHeight = aValue.toInt64(); ++ } ++ while (nParamIndex >= 0); + } + + OString aString = pDoc->getCellCursor(nOutputWidth, nOutputHeight, nTileWidth, nTileHeight); +-- +2.12.0 + diff --git a/SOURCES/0281-sw-tiled-rendering-initial-annotation-support.patch b/SOURCES/0281-sw-tiled-rendering-initial-annotation-support.patch new file mode 100644 index 0000000..b7525fe --- /dev/null +++ b/SOURCES/0281-sw-tiled-rendering-initial-annotation-support.patch @@ -0,0 +1,197 @@ +From 610c160a9762e222182af0de12972fa0924954fd Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Thu, 5 Nov 2015 15:58:55 +0100 +Subject: [PATCH 281/398] sw tiled rendering: initial annotation support + +(cherry picked from commit d54aaea33bf2dab86c0ead4bd142c593d017f930) + +Change-Id: I4fcb05f8a58965341cf44a1b7e2367b5cbff981d +--- + sw/inc/PostItMgr.hxx | 3 ++- + sw/inc/SidebarWin.hxx | 3 ++- + sw/source/core/view/viewsh.cxx | 3 +++ + sw/source/uibase/docvw/PostItMgr.cxx | 15 +++++++++++++++ + sw/source/uibase/docvw/SidebarTxtControl.cxx | 20 +++++++++++++++++--- + sw/source/uibase/docvw/SidebarTxtControl.hxx | 3 ++- + sw/source/uibase/docvw/SidebarWin.cxx | 22 +++++++++++++++++++++- + 7 files changed, 62 insertions(+), 7 deletions(-) + +diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx +index 8d1ddd0d65f8..f306f57ba86c 100644 +--- a/sw/inc/PostItMgr.hxx ++++ b/sw/inc/PostItMgr.hxx +@@ -287,7 +287,8 @@ class SwPostItMgr: public SfxListener + void GetAllSidebarWinForFrm( const SwFrm& rFrm, + std::vector< vcl::Window* >* pChildren ); + +- void DrawNotesForPage(OutputDevice *pOutDev, sal_uInt32 nPage); ++ void DrawNotesForPage(OutputDevice *pOutDev, sal_uInt32 nPage); ++ void PaintTile(OutputDevice& rRenderContext, const Rectangle& rRect); + }; + + #endif +diff --git a/sw/inc/SidebarWin.hxx b/sw/inc/SidebarWin.hxx +index 9514ac0eca90..d21d50d5d7d5 100644 +--- a/sw/inc/SidebarWin.hxx ++++ b/sw/inc/SidebarWin.hxx +@@ -177,7 +177,8 @@ class SwSidebarWin : public vcl::Window + void ChangeSidebarItem( SwSidebarItem& rSidebarItem ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE; + +- virtual void Draw(OutputDevice* pDev, const Point&, const Size&, sal_uLong) SAL_OVERRIDE; ++ virtual void Draw(OutputDevice* pDev, const Point&, const Size&, sal_uLong) override; ++ void PaintTile(vcl::RenderContext& rRenderContext, const Rectangle& rRect); + + protected: + virtual void DataChanged( const DataChangedEvent& aEvent) SAL_OVERRIDE; +diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx +index 92480b242089..fad9dc3552db 100644 +--- a/sw/source/core/view/viewsh.cxx ++++ b/sw/source/core/view/viewsh.cxx +@@ -1895,6 +1895,9 @@ void SwViewShell::PaintTile(VirtualDevice &rDevice, int contextWidth, int contex + // draw - works in logic coordinates + Paint(rDevice, aOutRect); + ++ if (SwPostItMgr* pPostItMgr = GetPostItMgr()) ++ pPostItMgr->PaintTile(rDevice, aOutRect); ++ + // SwViewShell's output device tear down + mpOut = pSaveOut; + mbInLibreOfficeKitCallback = false; +diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx +index 98a98964dbd9..b6bc52c253d0 100644 +--- a/sw/source/uibase/docvw/PostItMgr.cxx ++++ b/sw/source/uibase/docvw/PostItMgr.cxx +@@ -847,6 +847,21 @@ void SwPostItMgr::DrawNotesForPage(OutputDevice *pOutDev, sal_uInt32 nPage) + } + } + ++void SwPostItMgr::PaintTile(OutputDevice& rRenderContext, const Rectangle& /*rRect*/) ++{ ++ for (SwSidebarItem* pItem : mvPostItFields) ++ { ++ SwSidebarWin* pPostIt = pItem->pPostIt; ++ if (!pPostIt) ++ continue; ++ ++ Point aPoint(mpEditWin->PixelToLogic(pPostIt->GetPosPixel())); ++ Size aSize(pPostIt->PixelToLogic(pPostIt->GetSizePixel())); ++ Rectangle aRectangle(aPoint, aSize); ++ pPostIt->PaintTile(rRenderContext, aRectangle); ++ } ++} ++ + void SwPostItMgr::Scroll(const long lScroll,const unsigned long aPage) + { + OSL_ENSURE((lScroll % GetScrollSize() )==0,"SwPostItMgr::Scroll: scrolling by wrong value"); +diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx +index e9e1e34afdfe..06dcfea58ff6 100644 +--- a/sw/source/uibase/docvw/SidebarTxtControl.cxx ++++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx +@@ -53,6 +53,8 @@ + #include + #include + #include ++#include ++#include + + namespace sw { namespace sidebarwindows { + +@@ -151,25 +153,37 @@ void SidebarTextControl::Draw(OutputDevice* pDev, const Point& rPt, const Size& + } + } + ++void SidebarTextControl::PaintTile(vcl::RenderContext& rRenderContext, const Rectangle& rRect) ++{ ++ Paint(rRenderContext, rRect); ++} ++ + void SidebarTextControl::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) + { ++ Point aPoint(0, 0); ++ if (comphelper::LibreOfficeKit::isActive()) ++ aPoint = rRect.TopLeft(); ++ + if (!rRenderContext.GetSettings().GetStyleSettings().GetHighContrastMode()) + { + if (mrSidebarWin.IsMouseOverSidebarWin() || HasFocus()) + { +- rRenderContext.DrawGradient(Rectangle(Point(0,0), rRenderContext.PixelToLogic(GetSizePixel())), ++ rRenderContext.DrawGradient(Rectangle(aPoint, rRenderContext.PixelToLogic(GetSizePixel())), + Gradient(GradientStyle_LINEAR, mrSidebarWin.ColorDark(), mrSidebarWin.ColorDark())); + } + else + { +- rRenderContext.DrawGradient(Rectangle(Point(0,0), rRenderContext.PixelToLogic(GetSizePixel())), ++ rRenderContext.DrawGradient(Rectangle(aPoint, rRenderContext.PixelToLogic(GetSizePixel())), + Gradient(GradientStyle_LINEAR, mrSidebarWin.ColorLight(), mrSidebarWin.ColorDark())); + } + } + + if (GetTextView()) + { +- GetTextView()->Paint(rRect, &rRenderContext); ++ if (comphelper::LibreOfficeKit::isActive()) ++ GetTextView()->GetOutliner()->Draw(&rRenderContext, rRect); ++ else ++ GetTextView()->Paint(rRect, &rRenderContext); + } + + if (mrSidebarWin.GetLayoutStatus() == SwPostItHelper::DELETED) +diff --git a/sw/source/uibase/docvw/SidebarTxtControl.hxx b/sw/source/uibase/docvw/SidebarTxtControl.hxx +index 1a6d6677cd43..df732434ecf5 100644 +--- a/sw/source/uibase/docvw/SidebarTxtControl.hxx ++++ b/sw/source/uibase/docvw/SidebarTxtControl.hxx +@@ -68,7 +68,8 @@ class SidebarTextControl : public Control + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE; + +- virtual void Draw(OutputDevice* pDev, const Point&, const Size&, sal_uLong) SAL_OVERRIDE; ++ virtual void Draw(OutputDevice* pDev, const Point&, const Size&, sal_uLong) override; ++ void PaintTile(vcl::RenderContext& rRenderContext, const Rectangle& rRect); + }; + + } } // end of namespace sw::sidebarwindows +diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx +index 9825839ecf33..45916b03f797 100644 +--- a/sw/source/uibase/docvw/SidebarWin.cxx ++++ b/sw/source/uibase/docvw/SidebarWin.cxx +@@ -80,6 +80,8 @@ + #include + #include + #include ++#include ++#include + + namespace sw { namespace sidebarwindows { + +@@ -230,7 +232,25 @@ void SwSidebarWin::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rR + Size(GetMetaButtonAreaWidth(), + mpMetadataAuthor->GetSizePixel().Height() + mpMetadataDate->GetSizePixel().Height())); + +- rRenderContext.DrawRect(PixelToLogic(aRectangle)); ++ if (comphelper::LibreOfficeKit::isActive()) ++ aRectangle = rRect; ++ else ++ aRectangle = PixelToLogic(aRectangle); ++ rRenderContext.DrawRect(aRectangle); ++ } ++} ++ ++void SwSidebarWin::PaintTile(vcl::RenderContext& rRenderContext, const Rectangle& rRect) ++{ ++ Paint(rRenderContext, rRect); ++ ++ for (sal_uInt16 i = 0; i < GetChildCount(); ++i) ++ { ++ vcl::Window* pChild = GetChild(i); ++ if (pChild == mpSidebarTextControl.get()) ++ mpSidebarTextControl->PaintTile(rRenderContext, rRect); ++ else ++ SAL_WARN("sw.uibase", "SwSidebarWin::PaintTile: unhandled child " << pChild); + } + } + +-- +2.12.0 + diff --git a/SOURCES/0282-sw-lok-annotations-paint-all-child-window.patch b/SOURCES/0282-sw-lok-annotations-paint-all-child-window.patch new file mode 100644 index 0000000..0dcef3a --- /dev/null +++ b/SOURCES/0282-sw-lok-annotations-paint-all-child-window.patch @@ -0,0 +1,134 @@ +From 141f83a0f86de000c2ad25b207fdd6b0684a1c70 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 6 Nov 2015 10:29:38 +0100 +Subject: [PATCH 282/398] sw lok annotations: paint all child window + +And use map modes to get the painting to the correct position instead of +manually adjusting each and every Paint() method. + +(cherry picked from commit 177e375d2e63f1c3db9f5ab41e4281af740625fb) + +Change-Id: I66798321b8bbf2c7968d6ac1edebb1f8df60bce8 +--- + sw/source/uibase/docvw/PostItMgr.cxx | 11 +++++++++-- + sw/source/uibase/docvw/SidebarTxtControl.cxx | 19 +++---------------- + sw/source/uibase/docvw/SidebarTxtControl.hxx | 1 - + sw/source/uibase/docvw/SidebarWin.cxx | 13 +++++++++---- + 4 files changed, 21 insertions(+), 23 deletions(-) + +diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx +index b6bc52c253d0..35152d05d242 100644 +--- a/sw/source/uibase/docvw/PostItMgr.cxx ++++ b/sw/source/uibase/docvw/PostItMgr.cxx +@@ -855,10 +855,17 @@ void SwPostItMgr::PaintTile(OutputDevice& rRenderContext, const Rectangle& /*rRe + if (!pPostIt) + continue; + +- Point aPoint(mpEditWin->PixelToLogic(pPostIt->GetPosPixel())); ++ rRenderContext.Push(PushFlags::MAPMODE); ++ Point aOffset(mpEditWin->PixelToLogic(pPostIt->GetPosPixel())); ++ MapMode aMapMode(rRenderContext.GetMapMode()); ++ aMapMode.SetOrigin(aMapMode.GetOrigin() + aOffset); ++ rRenderContext.SetMapMode(aMapMode); + Size aSize(pPostIt->PixelToLogic(pPostIt->GetSizePixel())); +- Rectangle aRectangle(aPoint, aSize); ++ Rectangle aRectangle(Point(0, 0), aSize); ++ + pPostIt->PaintTile(rRenderContext, aRectangle); ++ ++ rRenderContext.Pop(); + } + } + +diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx +index 06dcfea58ff6..afda8b1952ad 100644 +--- a/sw/source/uibase/docvw/SidebarTxtControl.cxx ++++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx +@@ -54,7 +54,6 @@ + #include + #include + #include +-#include + + namespace sw { namespace sidebarwindows { + +@@ -153,37 +152,25 @@ void SidebarTextControl::Draw(OutputDevice* pDev, const Point& rPt, const Size& + } + } + +-void SidebarTextControl::PaintTile(vcl::RenderContext& rRenderContext, const Rectangle& rRect) +-{ +- Paint(rRenderContext, rRect); +-} +- + void SidebarTextControl::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) + { +- Point aPoint(0, 0); +- if (comphelper::LibreOfficeKit::isActive()) +- aPoint = rRect.TopLeft(); +- + if (!rRenderContext.GetSettings().GetStyleSettings().GetHighContrastMode()) + { + if (mrSidebarWin.IsMouseOverSidebarWin() || HasFocus()) + { +- rRenderContext.DrawGradient(Rectangle(aPoint, rRenderContext.PixelToLogic(GetSizePixel())), ++ rRenderContext.DrawGradient(Rectangle(Point(0,0), rRenderContext.PixelToLogic(GetSizePixel())), + Gradient(GradientStyle_LINEAR, mrSidebarWin.ColorDark(), mrSidebarWin.ColorDark())); + } + else + { +- rRenderContext.DrawGradient(Rectangle(aPoint, rRenderContext.PixelToLogic(GetSizePixel())), ++ rRenderContext.DrawGradient(Rectangle(Point(0,0), rRenderContext.PixelToLogic(GetSizePixel())), + Gradient(GradientStyle_LINEAR, mrSidebarWin.ColorLight(), mrSidebarWin.ColorDark())); + } + } + + if (GetTextView()) + { +- if (comphelper::LibreOfficeKit::isActive()) +- GetTextView()->GetOutliner()->Draw(&rRenderContext, rRect); +- else +- GetTextView()->Paint(rRect, &rRenderContext); ++ GetTextView()->Paint(rRect, &rRenderContext); + } + + if (mrSidebarWin.GetLayoutStatus() == SwPostItHelper::DELETED) +diff --git a/sw/source/uibase/docvw/SidebarTxtControl.hxx b/sw/source/uibase/docvw/SidebarTxtControl.hxx +index df732434ecf5..1be8ab3b8b4a 100644 +--- a/sw/source/uibase/docvw/SidebarTxtControl.hxx ++++ b/sw/source/uibase/docvw/SidebarTxtControl.hxx +@@ -69,7 +69,6 @@ class SidebarTextControl : public Control + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE; + + virtual void Draw(OutputDevice* pDev, const Point&, const Size&, sal_uLong) override; +- void PaintTile(vcl::RenderContext& rRenderContext, const Rectangle& rRect); + }; + + } } // end of namespace sw::sidebarwindows +diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx +index 45916b03f797..1d0374b7f92d 100644 +--- a/sw/source/uibase/docvw/SidebarWin.cxx ++++ b/sw/source/uibase/docvw/SidebarWin.cxx +@@ -247,10 +247,15 @@ void SwSidebarWin::PaintTile(vcl::RenderContext& rRenderContext, const Rectangle + for (sal_uInt16 i = 0; i < GetChildCount(); ++i) + { + vcl::Window* pChild = GetChild(i); +- if (pChild == mpSidebarTextControl.get()) +- mpSidebarTextControl->PaintTile(rRenderContext, rRect); +- else +- SAL_WARN("sw.uibase", "SwSidebarWin::PaintTile: unhandled child " << pChild); ++ rRenderContext.Push(PushFlags::MAPMODE); ++ Point aOffset(PixelToLogic(pChild->GetPosPixel())); ++ MapMode aMapMode(rRenderContext.GetMapMode()); ++ aMapMode.SetOrigin(aMapMode.GetOrigin() + aOffset); ++ rRenderContext.SetMapMode(aMapMode); ++ ++ pChild->Paint(rRenderContext, rRect); ++ ++ rRenderContext.Pop(); + } + } + +-- +2.12.0 + diff --git a/SOURCES/0283-gtktiledviewer-larger-default-window-size.patch b/SOURCES/0283-gtktiledviewer-larger-default-window-size.patch new file mode 100644 index 0000000..60b9a41 --- /dev/null +++ b/SOURCES/0283-gtktiledviewer-larger-default-window-size.patch @@ -0,0 +1,29 @@ +From 99ddae57c6bd55b33a39eb728bb362ee56e85e81 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 6 Nov 2015 10:58:18 +0100 +Subject: [PATCH 283/398] gtktiledviewer: larger default window size + +So comments in an otherwise empty Writer doc are immediately visible. + +Change-Id: I189c4eff6e83274f609ce016f9610c307c47ff16 +(cherry picked from commit 2dba3c1b403e10f5725723193127c3e0fffd3d64) +--- + libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 6ebd5bcc6ef5..08e756fa3ef6 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -902,7 +902,7 @@ 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); ++ gtk_window_set_default_size(GTK_WINDOW(pWindow), 1280, 720); + g_signal_connect(pWindow, "destroy", G_CALLBACK(gtk_main_quit), 0); + + rWindow.m_pVBox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); +-- +2.12.0 + diff --git a/SOURCES/0284-sw-lok-annotations-disable-the-scrollbar-for-now.patch b/SOURCES/0284-sw-lok-annotations-disable-the-scrollbar-for-now.patch new file mode 100644 index 0000000..9cecb22 --- /dev/null +++ b/SOURCES/0284-sw-lok-annotations-disable-the-scrollbar-for-now.patch @@ -0,0 +1,31 @@ +From dd2f74e8a695449bc80a606b73c80ed023ebff0d Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 6 Nov 2015 13:30:54 +0100 +Subject: [PATCH 284/398] sw lok annotations: disable the scrollbar for now + +Change-Id: I7493eaab55c23c79ca0878c34a97dfb4af857260 +(cherry picked from commit 8fc6aafcb4769271bc7b208e9b9b430b875b6104) +--- + sw/source/uibase/docvw/SidebarWin.cxx | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx +index 1d0374b7f92d..038bdb243e65 100644 +--- a/sw/source/uibase/docvw/SidebarWin.cxx ++++ b/sw/source/uibase/docvw/SidebarWin.cxx +@@ -247,6 +247,12 @@ void SwSidebarWin::PaintTile(vcl::RenderContext& rRenderContext, const Rectangle + for (sal_uInt16 i = 0; i < GetChildCount(); ++i) + { + vcl::Window* pChild = GetChild(i); ++ ++ // This would at the moment just draw a gray rectangle at the top right ++ // corner, need to sort out later. ++ if (pChild == mpVScrollbar.get()) ++ continue; ++ + rRenderContext.Push(PushFlags::MAPMODE); + Point aOffset(PixelToLogic(pChild->GetPosPixel())); + MapMode aMapMode(rRenderContext.GetMapMode()); +-- +2.12.0 + diff --git a/SOURCES/0285-sc-lok-annotations-paint-range-and-anchor-overlay.patch b/SOURCES/0285-sc-lok-annotations-paint-range-and-anchor-overlay.patch new file mode 100644 index 0000000..8ec0d55 --- /dev/null +++ b/SOURCES/0285-sc-lok-annotations-paint-range-and-anchor-overlay.patch @@ -0,0 +1,40 @@ +From 6c76b4b478428d2326ea672d1bd87d1fa9654797 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 6 Nov 2015 17:12:46 +0100 +Subject: [PATCH 285/398] sc lok annotations: paint range and anchor overlay + +Change-Id: I16e51e074704026a45471e7a08c3b96846d44053 +(cherry picked from commit 5f68759810496ff3fadf5a883203449772c7392f) +--- + sw/source/uibase/docvw/SidebarWin.cxx | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx +index 038bdb243e65..e3e238715365 100644 +--- a/sw/source/uibase/docvw/SidebarWin.cxx ++++ b/sw/source/uibase/docvw/SidebarWin.cxx +@@ -263,6 +263,21 @@ void SwSidebarWin::PaintTile(vcl::RenderContext& rRenderContext, const Rectangle + + rRenderContext.Pop(); + } ++ ++ const drawinglayer::geometry::ViewInformation2D aViewInformation; ++ std::unique_ptr pProcessor(drawinglayer::processor2d::createBaseProcessor2DFromOutputDevice(rRenderContext, aViewInformation)); ++ ++ // drawinglayer sets the map mode to pixels, not needed here. ++ rRenderContext.Pop(); ++ // Work in document-global twips. ++ rRenderContext.Pop(); ++ if (mpAnchor) ++ pProcessor->process(mpAnchor->getOverlayObjectPrimitive2DSequence()); ++ if (mpTextRangeOverlay) ++ pProcessor->process(mpTextRangeOverlay->getOverlayObjectPrimitive2DSequence()); ++ rRenderContext.Push(PushFlags::NONE); ++ pProcessor.reset(); ++ rRenderContext.Push(PushFlags::NONE); + } + + void SwSidebarWin::Draw(OutputDevice* pDev, const Point& rPt, const Size& rSz, sal_uLong nInFlags) +-- +2.12.0 + diff --git a/SOURCES/0286-Revert-sc-lok-Cache-viewdata-zoom-and-reuse-for-curs.patch b/SOURCES/0286-Revert-sc-lok-Cache-viewdata-zoom-and-reuse-for-curs.patch new file mode 100644 index 0000000..ce3e2c5 --- /dev/null +++ b/SOURCES/0286-Revert-sc-lok-Cache-viewdata-zoom-and-reuse-for-curs.patch @@ -0,0 +1,82 @@ +From cc6294f25ba79ab1ad55f5cae600666eb8700d7b Mon Sep 17 00:00:00 2001 +From: Andrzej Hunt +Date: Fri, 6 Nov 2015 17:36:18 +0100 +Subject: [PATCH 286/398] Revert "sc lok: Cache viewdata zoom and reuse for + cursor callback" + +This reverts fab3c48a0cd5a0517025993502a04358308fe5ef for now. +The correct solution is to have the client "hint" at the current +resolution, which is still being developed +(gerrit-id: I34b5afcdcc06a671a8ac92c03e87404e42adf4cd). +For now the cursor will be wrongly positioned when moved as the result +of a mouse click. + +Reviewed-on: https://gerrit.libreoffice.org/19827 +Tested-by: Andrzej Hunt +Reviewed-by: Andrzej Hunt +(cherry picked from commit 064fb1f73abbc103226a8fce8a46b7e8b8347dac) + +Change-Id: I68d56eac958e607e8e2e3ad16aff4e1a7dd0b6dd +--- + sc/source/ui/inc/gridwin.hxx | 9 --------- + sc/source/ui/view/gridwin.cxx | 4 +++- + sc/source/ui/view/gridwin4.cxx | 6 +++--- + 3 files changed, 6 insertions(+), 13 deletions(-) + +diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx +index 8081f107409c..dc1cec7fd8c7 100644 +--- a/sc/source/ui/inc/gridwin.hxx ++++ b/sc/source/ui/inc/gridwin.hxx +@@ -200,15 +200,6 @@ class ScGridWindow : public vcl::Window, public DropTargetHelper, public DragSou + bool bAutoMarkVisible:1; + bool bListValButton:1; + +- // We cache the tiled rendering zoom level in order to be able to +- // calculate the correct cell cursor position (which is dependent +- // on the zoom level). The caching is necessary since +- // ScModelObj::postMouseEvent resets the zoom level to the default, +- // which means we have the default zoom level set during the +- // cell cursor position calculations in updateLibreOfficeKitCellCursor(). +- Fraction mTiledZoomX; +- Fraction mTiledZoomY; +- + DECL_LINK( PopupModeEndHdl, void* ); + DECL_LINK( PopupSpellingHdl, SpellCallbackInfo* ); + +diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx +index efa8d332ad2a..d6887b6f4e07 100644 +--- a/sc/source/ui/view/gridwin.cxx ++++ b/sc/source/ui/view/gridwin.cxx +@@ -5834,7 +5834,9 @@ void ScGridWindow::updateLibreOfficeKitCellCursor() + { + ScDocument* pDoc = pViewData->GetDocument(); + ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer(); +- OString aCursor = getCellCursor(mTiledZoomX, mTiledZoomY); ++ // TODO: the zoom levels here should be replaced by the setClientZoom values ++ // in a patch currently in gerrit (https://gerrit.libreoffice.org/#/c/19822/) ++ OString aCursor = getCellCursor(pViewData->GetZoomX(), pViewData->GetZoomY()); + pDrawLayer->libreOfficeKitCallback(LOK_CALLBACK_CELL_CURSOR, aCursor.getStr()); + } + +diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx +index cfdde43e1a04..ceaf3d8d7c3a 100644 +--- a/sc/source/ui/view/gridwin4.cxx ++++ b/sc/source/ui/view/gridwin4.cxx +@@ -955,11 +955,11 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice, + // Similarly to Writer, we should set the mapmode once on the rDevice, and + // not care about any zoom settings. + +- mTiledZoomX = Fraction(long(nOutputWidth * TWIPS_PER_PIXEL), nTileWidth); +- mTiledZoomY = Fraction(long(nOutputHeight * TWIPS_PER_PIXEL), nTileHeight); ++ Fraction aFracX(long(nOutputWidth * TWIPS_PER_PIXEL), nTileWidth); ++ Fraction aFracY(long(nOutputHeight * TWIPS_PER_PIXEL), nTileHeight); + + // page break zoom, and aLogicMode in ScViewData +- pViewData->SetZoom(mTiledZoomX, mTiledZoomY, true); ++ pViewData->SetZoom(aFracX, aFracY, true); + + double fTilePosXPixel = static_cast(nTilePosX) * nOutputWidth / nTileWidth; + double fTilePosYPixel = static_cast(nTilePosY) * nOutputHeight / nTileHeight; +-- +2.12.0 + diff --git a/SOURCES/0287-gtktiledviewer-add-Ctrl-Alt-Shift-shortcut-support.patch b/SOURCES/0287-gtktiledviewer-add-Ctrl-Alt-Shift-shortcut-support.patch new file mode 100644 index 0000000..0f4001f --- /dev/null +++ b/SOURCES/0287-gtktiledviewer-add-Ctrl-Alt-Shift-shortcut-support.patch @@ -0,0 +1,70 @@ +From 71ad9009f87480488f45f36888c0b08ce245220e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?L=C3=A1szl=C3=B3=20N=C3=A9meth?= + +Date: Fri, 6 Nov 2015 19:26:29 +0100 +Subject: [PATCH 287/398] gtktiledviewer: add Ctrl, Alt, Shift shortcut support + +For example in Writer: + +Ctrl-B for bold text +Ctrl-Shift-B/P for subscript/superscript +Ctrl-Alt-C insert comment +Ctrl-1 apply Heading 1 paragraph style + +Change-Id: Iaeb8341f2cb273980b637ff2fed89585094e0d9d +(cherry picked from commit 63d2d50ecb3f3a83374a1a01713edce14ba378ed) +--- + libreofficekit/source/gtk/lokdocview.cxx | 23 ++++++++++++++++++++++- + 1 file changed, 22 insertions(+), 1 deletion(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 73b01797dbf9..8f0a053677fa 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -337,7 +337,7 @@ signalKey (GtkWidget* pWidget, GdkEventKey* pEvent) + return FALSE; + } + +- priv->m_nKeyModifier = 0; ++ priv->m_nKeyModifier &= KEY_MOD2; + switch (pEvent->keyval) + { + case GDK_KEY_BackSpace: +@@ -381,6 +381,8 @@ signalKey (GtkWidget* pWidget, GdkEventKey* pEvent) + case GDK_KEY_Alt_R: + if (pEvent->type == GDK_KEY_PRESS) + priv->m_nKeyModifier |= KEY_MOD2; ++ else ++ priv->m_nKeyModifier &= ~KEY_MOD2; + break; + default: + if (pEvent->keyval >= GDK_KEY_F1 && pEvent->keyval <= GDK_KEY_F26) +@@ -395,6 +397,25 @@ signalKey (GtkWidget* pWidget, GdkEventKey* pEvent) + if (pEvent->state & GDK_SHIFT_MASK) + nKeyCode |= KEY_SHIFT; + ++ if (pEvent->state & GDK_CONTROL_MASK) ++ nKeyCode |= KEY_MOD1; ++ ++ if (priv->m_nKeyModifier & KEY_MOD2) ++ nKeyCode |= KEY_MOD2; ++ ++ if (nKeyCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2)) { ++ if (pEvent->keyval >= GDK_KEY_a && pEvent->keyval <= GDK_KEY_z) ++ { ++ nKeyCode |= 512 + (pEvent->keyval - GDK_KEY_a); ++ } ++ else if (pEvent->keyval >= GDK_KEY_A && pEvent->keyval <= GDK_KEY_Z) { ++ nKeyCode |= 512 + (pEvent->keyval - GDK_KEY_A); ++ } ++ else if (pEvent->keyval >= GDK_KEY_0 && pEvent->keyval <= GDK_KEY_9) { ++ nKeyCode |= 256 + (pEvent->keyval - GDK_KEY_0); ++ } ++ } ++ + if (pEvent->type == GDK_KEY_RELEASE) + { + GTask* task = g_task_new(pDocView, NULL, NULL, NULL); +-- +2.12.0 + diff --git a/SOURCES/0288-sc-lok-Add-initial-test-for-.uno-CellCursor.patch b/SOURCES/0288-sc-lok-Add-initial-test-for-.uno-CellCursor.patch new file mode 100644 index 0000000..b51547c --- /dev/null +++ b/SOURCES/0288-sc-lok-Add-initial-test-for-.uno-CellCursor.patch @@ -0,0 +1,88 @@ +From 605efe926ab66ddf5aa790051008c3ed35b9a0e9 Mon Sep 17 00:00:00 2001 +From: Andrzej Hunt +Date: Fri, 6 Nov 2015 18:09:34 +0100 +Subject: [PATCH 288/398] sc lok: Add initial test for .uno:CellCursor + +This should be extended with checking that we receive "EMPTY" +when there is no cursor shown - that would require e.g. simulating +keyboard input to hide the cell cursor. + +Change-Id: Ia7be5ec3e158f21967b4c307ac10abb2b5e2a56a +Reviewed-on: https://gerrit.libreoffice.org/19828 +Tested-by: Jenkins +Reviewed-by: Andrzej Hunt +Tested-by: Andrzej Hunt +(cherry picked from commit 2f13f051c3c39f77d5f65ff0e3f4a476ccb95f1a) +--- + desktop/qa/desktop_lib/test_desktop_lib.cxx | 20 ++++++++++++++++++++ + sc/source/ui/view/gridwin.cxx | 7 ++----- + 2 files changed, 22 insertions(+), 5 deletions(-) + +diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx +index 8c622a577231..df803c4bdaf0 100644 +--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx ++++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx +@@ -68,6 +68,7 @@ public: + void testSaveAsCalc(); + void testPasteWriter(); + void testRowColumnHeaders(); ++ void testCellCursor(); + void testCommandResult(); + + CPPUNIT_TEST_SUITE(DesktopLOKTest); +@@ -82,6 +83,7 @@ public: + CPPUNIT_TEST(testSaveAsCalc); + CPPUNIT_TEST(testPasteWriter); + CPPUNIT_TEST(testRowColumnHeaders); ++ CPPUNIT_TEST(testCellCursor); + CPPUNIT_TEST(testCommandResult); + CPPUNIT_TEST_SUITE_END(); + +@@ -435,6 +437,24 @@ void DesktopLOKTest::testRowColumnHeaders() + } + } + ++void DesktopLOKTest::testCellCursor() ++{ ++ LibLODocument_Impl* pDocument = loadDoc("search.ods"); ++ ++ boost::property_tree::ptree aTree; ++ ++ char* pJSON = pDocument->m_pDocumentClass->getCommandValues(pDocument, ".uno:CellCursor?tileWidth=1&tileHeight=1&outputWidth=1&outputHeight=1"); ++ ++ std::stringstream aStream(pJSON); ++ free(pJSON); ++ CPPUNIT_ASSERT(!aStream.str().empty()); ++ ++ boost::property_tree::read_json(aStream, aTree); ++ ++ OString aRectangle(aTree.get("commandValues").c_str()); ++ CPPUNIT_ASSERT_EQUAL(aRectangle, OString("0, 0, 1278, 254")); ++} ++ + void DesktopLOKTest::testCommandResult() + { + LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); +diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx +index d6887b6f4e07..c2d391d038ef 100644 +--- a/sc/source/ui/view/gridwin.cxx ++++ b/sc/source/ui/view/gridwin.cxx +@@ -5796,13 +5796,10 @@ OString ScGridWindow::getCellCursor( int nOutputWidth, int nOutputHeight, + } + + OString ScGridWindow::getCellCursor(const Fraction& rZoomX, const Fraction& rZoomY) { +- ScDocument* pDoc = pViewData->GetDocument(); +- ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer(); +- +- // GridWindows stores a shown cell cursor in mpOOCursors, hence ++ // GridWindow stores a shown cell cursor in mpOOCursors, hence + // we can use that to determine whether we would want to be showing + // one (client-side) for tiled rendering too. +- if (!pDrawLayer->isTiledRendering() || !mpOOCursors.get()) ++ if (!mpOOCursors.get()) + { + return OString("EMPTY"); + } +-- +2.12.0 + diff --git a/SOURCES/0289-sc-lok-add-missing-commandName.patch b/SOURCES/0289-sc-lok-add-missing-commandName.patch new file mode 100644 index 0000000..3d2de80 --- /dev/null +++ b/SOURCES/0289-sc-lok-add-missing-commandName.patch @@ -0,0 +1,28 @@ +From 715f9d097d814abf67872bf0c15222243c668219 Mon Sep 17 00:00:00 2001 +From: Henry Castro +Date: Sun, 8 Nov 2015 15:55:57 -0400 +Subject: [PATCH 289/398] sc lok: add missing commandName + +LOOL requires to filter a requested command values message + +Change-Id: If2eeb9990e0f9aec6410a70f7a6c132c080bda80 +(cherry picked from commit c615699af18635c1aa1e7c9b930748eca004c5fc) +--- + sc/source/ui/view/tabview.cxx | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx +index d8fcd4ff4a73..b1cbe8d6f950 100644 +--- a/sc/source/ui/view/tabview.cxx ++++ b/sc/source/ui/view/tabview.cxx +@@ -2372,6 +2372,7 @@ OUString ScTabView::getRowColumnHeaders(const Rectangle& rRectangle) + } + + boost::property_tree::ptree aTree; ++ aTree.put("commandName", ".uno:ViewRowColumnHeaders"); + aTree.add_child("rows", aRows); + aTree.add_child("columns", aCols); + std::stringstream aStream; +-- +2.12.0 + diff --git a/SOURCES/0290-lokdocview-assert-that-loading-of-handle-bitmaps-suc.patch b/SOURCES/0290-lokdocview-assert-that-loading-of-handle-bitmaps-suc.patch new file mode 100644 index 0000000..9eb2c30 --- /dev/null +++ b/SOURCES/0290-lokdocview-assert-that-loading-of-handle-bitmaps-suc.patch @@ -0,0 +1,194 @@ +From 6be255b70ed61eeba0035d6b03bf4455d0ce6cac Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 10 Nov 2015 09:40:10 +0100 +Subject: [PATCH 290/398] lokdocview: assert that loading of handle bitmaps + succeeded + +A number of such bitmaps were removed by accident in commit +74463457b39c9def1add630b7b0581dc195549c8 (android: chanhe handles to use +alias, tint handles with color, 2015-11-01). + +Change-Id: I253c4b5790e82de32e6fd06896645adf360fa586 +(cherry picked from commit c044e51b9983d373cf3ea74aec0ffd37752f07a0) +--- + android/source/res/drawable/handle_end.png | Bin 0 -> 1734 bytes + android/source/res/drawable/handle_middle.png | Bin 0 -> 1850 bytes + android/source/res/drawable/handle_start.png | Bin 0 -> 1676 bytes + libreofficekit/source/gtk/lokdocview.cxx | 13 +++++++++++++ + 4 files changed, 13 insertions(+) + create mode 100644 android/source/res/drawable/handle_end.png + create mode 100644 android/source/res/drawable/handle_middle.png + create mode 100644 android/source/res/drawable/handle_start.png + +diff --git a/android/source/res/drawable/handle_end.png b/android/source/res/drawable/handle_end.png +new file mode 100644 +index 0000000000000000000000000000000000000000..32b77dfa6e26a4560c1e921110e2ce0b4ed5bd76 +GIT binary patch +literal 1734 +zcmbVNX;2eq7!C-?AyNcvsU6$~wO}F1=2()2NOLVv4WxkzqZJIv0uhppn}sCcNbwd$ +zbgDu@6qxb0D5%v6Rk0{q1PW9Hybu&3LO}&7OdY#Hu>NrT(VgA>zVF@ldER?=t1LXk +z+3{0H3Weev7AlsLs~7qB+1rtCe4V`wxp)$i7$Oo&APfo|r3h45JPL$q6p5%DRj5p> +zZ=gXG%CsbPR16U#T>>jH4NYOup&2zg5>2551sin=Wim>(4g`UI0FwbS=?wCQ{6RL%fna6;FnLi)Yq%-_ +zmWz=|TjYsPO(F;#Os5+R2AY9I!|+5p$m8)W989J^so}3TX$ghVU#s_?Vi2QxC9c*H +zYD^1Q7!~nYD#53cp1uh|qmxSC5^MF7i6T=*H!5^=kj9{EG?us~wDp7>{m+f}YU`s+ +zI+QL)^;jydBh&)EM=+#WJwr->60)WAc}+lAE`pA)>;I< +zmIA$rSB&E7G*pG)m#DXYeM}K}}gqy&<_CbGI2`zYW +z!GcyQa(t`(mFiG8!K|-l)~pw@&DF(Tp&4CWSJ#(*pKt7RksU+aa;Dq9p5?M>{j&`R +zx5V$f(z+?lux6Ubvz2Chy4lGiMBs3I2yA5R>b()R%G0|rCX%w9hhBYzqH0t*dlY#r=Nn$UY|(FIM!$X)t_`;kv_C4a_6?@r#><6D}Kewq2`RF-?PonXFIs9u&t>mEnFkZH#^D? +z`&=kHl-iWj`z7qu5?^Q@f8kN|c+4kT>vwl(^~uuH=t%o`v%eiR?^R^(=8g`7Tal(N +zb}6ynboSi0IY*sf)Y`>uQO78@`r1K+M7dlVa;p*%*=cq{$lH$h(-7A +zdF)#jDyWFEZpS}kFFQDo$c#Ta*J;$)_+&@t*^Qjga?m@?CRp+~=VpCk{Ye +z9f|QRm*+gKWj5U4Qp;YqS?Q;bI-Pjb)jvH3C%ghL!XDKUo$Gfty*5vGYdqV|j9i}m +z#f6ZeeRh|kTk@~AQP6=JPE7j~&%7bOs(o1o$E+;xJu>xt&z1b5ys$Bs9UJ1f{Y*nOIBbe-@a&th +z`BmpBj~BV=`>%B@9(u{vcX)4F*7Z8bFL+_^?TU?Fr)7t^#Gc2yt~cqkZuIPR8x@xH +q=o0^KFFy1WUpP>3-qaCiWk(S+KZ*OMysydfX9<&pi_3&7*Zm8TgRNQs + +literal 0 +HcmV?d00001 + +diff --git a/android/source/res/drawable/handle_middle.png b/android/source/res/drawable/handle_middle.png +new file mode 100644 +index 0000000000000000000000000000000000000000..751eb898b136ab9814248a83df833d43f0e778dc +GIT binary patch +literal 1850 +zcmbVNdss|q7$0(}q-eJimSduXxtzJ2xzrfbTrx2u(;%|yG;^joo4J^CG*hUAHe1NL +zC9xH1TO=$|(p4^N*5ev-%i3)Tg+DD_uikgI$Rk#*mbxo +zi9{MKpDIxi>nP%x`ww1zlkl +zBYJddk_CxKQmQpc@fx0%ESwAk+xP^50l{IwW>{#%_%;FgJujcwJH#|H@LmOv7mz$NO;4aVL^$azzZcN&0+&$#N`qJnfOB0qFTO;%aMT~hehWw +z=nxkKxpXd57Q*0(cw#Ao!329bK8F=SAd?M=cp)+#3k0PgPt1e35*e2(VsfNh8KV~~ +zH)1$!)F8cfQNnHymit94Uu;2O++_bF{}N +z?b0hEdeE``*!;xd|#L#wY +z_M%(2u-rpSWa$+9+|cM79+P#y^X|M!ZVlS9wY@AmPwTAyH70Ah!qe3!H!N%wa-hz? +z4>F*_gMIkwu?52F#QVX40ZwrzLzYmzuZ((LV<=8`oAuZJgvk~2Z|1n=c{x>Gc*09M +zKEJvA6y5&!g@BDax7FTe*tb`ns2hHu!=6fMc(7@6+Qql^=>ZAPv!<^pqL)jjoDmq( +zeTzy%no=HTRff5BMaTFZc)A_`M!y&G2s(EtjP2TxkEiqv#8#~5sC`FUSrx8HRH$JOFw_Yk*KAM^8=`m1mCbbrwN4HgNhGS>Ez3{HE_PfG>?V_``Z72DYP$Fht*6Hn`_2JZ8Yu39`^I59^P(>0QHu;ns1 +zq`x4p^{kt2L-LhBD=(p!pV?Cp?Xn+UMd9BnUKaFiQ|%DR@>>*-)v=+ENo +zPUi$^O7W8X)7}#}znv6+)pGLXROHS$>wZ=3Sp){mss +z&mLFzFsCGAQ({o#+8rleln%PrYR>H%`+8N}+uX-Z)7%?2~SZY~ktPxRovI +zI+T6N^RV4Dfo9jdzQr}&e#2Z!W1F-4HFR}*bqSoG*V5^#`qjdFucC(NR=rr7lsQmX +zGwq4Ttsi%O&kAh)NxL`NXAJlC&;>4yo=zKlI(2<-W5e&ZH+UZ0nMXDAm3NwIc6Ere +zQR;=@to8b$Gi+?fB^TvC8-1KY$4{EF#;2)ro_`?xkU51n6mAglbEDICMg5Yox_byR +z$;HpVtvakpbQV>v4E?#WX_)35NAiG_AW0rXC%v=zxu;IQa@+AYlS`G7(vX<6e*p&9 +B)mZ=l + +literal 0 +HcmV?d00001 + +diff --git a/android/source/res/drawable/handle_start.png b/android/source/res/drawable/handle_start.png +new file mode 100644 +index 0000000000000000000000000000000000000000..cf12a0dcdcf3b27566fb4a4cd990306965759d3d +GIT binary patch +literal 1676 +zcmbVNeNfY87%wP_D7RCl4n&PX5T~?FKhid%Vrd%%DOAd8k&Ppyfo9OAwxJ)K?65eo +zIAuef2yQy3%&KE@Zf*yDP8i3;0dooiJUwOV2E(0-4w>Cj1m_=~e=L{eecva~@ArIP +z-0I{N!9ig`EEX#`VWlFKS?4j&(!fc~+u{nG$Sk3>Qb%j39NLaq2$oDwWfMSx5z8e~ +z2~6)?*FwaySQ89nnvT|~k`SCSvN4|y+hH^_Xcj9r&SA#zJc0(YiCoeo1@AVT0Rd7k +z1=k2wT$Nc)7|4}{7D7{)oQ4 +z6*^A}K6Of`QUh|zLI6TGKL+PQ5CFq$NFan^Xeq$sLOc$ax#1W{fCyoPCj!PUkg;ab +z=OC#Hbj%iWl7a@BHX|I4-EL>w`E1IP%Yh^kiI0QFi(xcktWFb+IbuxKh;ar5VZ|+^ +znIgo)Md@V~Ju?#&KX~4#ehij7DEvquN$FmH5w%7iwG6 +zoMwWPN?54^3(nLdCt@7TR#co9|xLtL4dD~LxW0tiw<61fBxD^Rgm#uq8Y +zC~q8_V6xJf2`9$wl8oIkEdQlgL~bE4nzE!(RQ`Aes0|cNSq+pKkZWKdT7}`H$tPIs +zE6~$;6@-Pf5qi`@8G+FZBjgJ_fD|wc%lJwNeJ*ks6^J3e2$k>z;22i_f3n75oZ$mVbSMLYC&}9;j@~3z5CroNE(ZJ}`xp +z|1ArvD~s8&_H__;)s@AaeQ-;b5p*Izc5>*3a^T#g!=e;#bk`w~bhvZkD?ypv2RsYD +z?wQ}M&uxD6k-L`MwQwXNllNz2!}-CHzEi^$&d?tui*CslN6vfy&~NpdliZHDX?IR# +zl-zFJp6QD8JGkn;Xt0JIURc^0|H+0|iowzdziXf0_Pn=5UWkB2P0oWs+Spva!ZAr(V2|gq=hD<;enm+2 +z$sLIsGaqi+^6`Qye8-x=5+_UZVO^ir1F0Li9ozFXEiz~AqRP+S_0HXQ^kMqmj4Z+G +zK-E`byVE=1zSp?=A6|d^Dx~kPwi0!J+%{VfTzyAaX;}FC1^(XJduXP1Pn98OsrLk@ +ze%^|Zmi48gu;q1Ai{R?;Q<53$J9>sX6&I&9?RMYOMp=UM;niVD0uup>&gF!}xZFRA +zaIhf@m(K4E9js1l;@gt+lLyM&RRME)(xZxs9^WW_(B)>1mkyTZ&O%ePQQMA%-`|;7 +zj}ENawIM*b^K!t=wyGJLxbjl#)ubc&=8Kpu(EDb4zl-Qq_GRxj9Jv14JH?;sevN;U +zy5#%Q9_x1n_A4PHE#10`fUdg*lcUpHhrN@#`Uj5-i{WpBO(i|ouWTqt4zy2kHH6#@ +zcHQsMTaUya(uhx&uhX7rDM#1N_eQN+w*1O=scgmv;d`31YOba2KiyVQUUSz!^bhIK +zlyl9bIxc!r&>Ii@;fy)^i1yj)S(O=OO(jnC@?L6-ZFBcgfh|RMYi9f5&1Wc&&@Ut8 +z(c$xFj?bKqs~RsKP2BoRL9y#b>;A&^St7jEJX;!dw&Cp0k0xmRDwH+03vW&B+$i2A +fy{_GQ&3_te*fBRN_wAw#-~S;&nXIUd&vN|>yUu?= + +literal 0 +HcmV?d00001 + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 8f0a053677fa..9dfa2f3b44a6 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -12,6 +12,7 @@ + #include + #include + #include ++#include + #include + + #include +@@ -1059,7 +1060,10 @@ renderOverlay(LOKDocView* pDocView, cairo_t* pCairo) + // Have a cursor, but no selection: we need the middle handle. + gchar* handleMiddlePath = g_strconcat (priv->m_aLOPath, "/../..", CURSOR_HANDLE_DIR, "handle_middle.png", NULL); + if (!priv->m_pHandleMiddle) ++ { + priv->m_pHandleMiddle = cairo_image_surface_create_from_png(handleMiddlePath); ++ assert(cairo_surface_status(priv->m_pHandleMiddle) == CAIRO_STATUS_SUCCESS); ++ } + g_free (handleMiddlePath); + renderHandle(pDocView, pCairo, priv->m_aVisibleCursor, priv->m_pHandleMiddle, priv->m_aHandleMiddleRect); + } +@@ -1084,7 +1088,10 @@ renderOverlay(LOKDocView* pDocView, cairo_t* pCairo) + // Have a start position: we need a start handle. + gchar* handleStartPath = g_strconcat (priv->m_aLOPath, "/../..", CURSOR_HANDLE_DIR, "handle_start.png", NULL); + if (!priv->m_pHandleStart) ++ { + priv->m_pHandleStart = cairo_image_surface_create_from_png(handleStartPath); ++ assert(cairo_surface_status(priv->m_pHandleStart) == CAIRO_STATUS_SUCCESS); ++ } + renderHandle(pDocView, pCairo, priv->m_aTextSelectionStart, priv->m_pHandleStart, priv->m_aHandleStartRect); + g_free (handleStartPath); + } +@@ -1093,7 +1100,10 @@ renderOverlay(LOKDocView* pDocView, cairo_t* pCairo) + // Have a start position: we need an end handle. + gchar* handleEndPath = g_strconcat (priv->m_aLOPath, "/../..", CURSOR_HANDLE_DIR, "handle_end.png", NULL); + if (!priv->m_pHandleEnd) ++ { + priv->m_pHandleEnd = cairo_image_surface_create_from_png(handleEndPath); ++ assert(cairo_surface_status(priv->m_pHandleEnd) == CAIRO_STATUS_SUCCESS); ++ } + renderHandle(pDocView, pCairo, priv->m_aTextSelectionEnd, priv->m_pHandleEnd, priv->m_aHandleEndRect); + g_free (handleEndPath); + } +@@ -1103,7 +1113,10 @@ renderOverlay(LOKDocView* pDocView, cairo_t* pCairo) + { + gchar* handleGraphicPath = g_strconcat (priv->m_aLOPath, "/../..", CURSOR_HANDLE_DIR, "handle_graphic.png", NULL); + if (!priv->m_pGraphicHandle) ++ { + priv->m_pGraphicHandle = cairo_image_surface_create_from_png(handleGraphicPath); ++ assert(cairo_surface_status(priv->m_pGraphicHandle) == CAIRO_STATUS_SUCCESS); ++ } + renderGraphicHandle(pDocView, pCairo, priv->m_aGraphicSelection, priv->m_pGraphicHandle); + g_free (handleGraphicPath); + } +-- +2.12.0 + diff --git a/SOURCES/0291-loplugin-nullptr-automatic-rewrite.patch b/SOURCES/0291-loplugin-nullptr-automatic-rewrite.patch new file mode 100644 index 0000000..76a8863 --- /dev/null +++ b/SOURCES/0291-loplugin-nullptr-automatic-rewrite.patch @@ -0,0 +1,82 @@ +From 4c85fb2dfb79b09598d8196d134398a8bb688b20 Mon Sep 17 00:00:00 2001 +From: Stephan Bergmann +Date: Tue, 10 Nov 2015 10:09:37 +0100 +Subject: [PATCH 291/398] loplugin:nullptr (automatic rewrite) + +Change-Id: Ifbab1c3bdf0bb481477e600978c640cdc052be74 +(cherry picked from commit ebc194c696e5c9b1acf320cfc582b4ab56c14900) +--- + include/LibreOfficeKit/LibreOfficeKit.hxx | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx +index c51339fa3ba8..dde371ddc95b 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.hxx ++++ b/include/LibreOfficeKit/LibreOfficeKit.hxx +@@ -47,7 +47,7 @@ public: + * @param pFormat the format to use while exporting, when omitted, then deducted from pURL's extension + * @param pFilterOptions options for the export filter, e.g. SkipImages. + */ +- inline bool saveAs(const char* pUrl, const char* pFormat = NULL, const char* pFilterOptions = NULL) ++ inline bool saveAs(const char* pUrl, const char* pFormat = nullptr, const char* pFilterOptions = nullptr) + { + return mpDoc->pClass->saveAs(mpDoc, pUrl, pFormat, pFilterOptions) != 0; + } +@@ -220,7 +220,7 @@ public: + * @param pCommand uno command to be posted to the document, like ".uno:Bold" + * @param pArguments arguments of the uno command. + */ +- inline void postUnoCommand(const char* pCommand, const char* pArguments = 0, bool bNotifyWhenFinished = false) ++ inline void postUnoCommand(const char* pCommand, const char* pArguments = nullptr, bool bNotifyWhenFinished = false) + { + mpDoc->pClass->postUnoCommand(mpDoc, pCommand, pArguments, bNotifyWhenFinished); + } +@@ -243,7 +243,7 @@ public: + * @param pMimeType suggests the return format, for example text/plain;charset=utf-8. + * @param pUsedMimeType output parameter to inform about the determined format (suggested one or plain text). + */ +- inline char* getTextSelection(const char* pMimeType, char** pUsedMimeType = 0) ++ inline char* getTextSelection(const char* pMimeType, char** pUsedMimeType = nullptr) + { + return mpDoc->pClass->getTextSelection(mpDoc, pMimeType, pUsedMimeType); + } +@@ -361,17 +361,17 @@ public: + * @param pUrl the URL of the document to load + * @param pFilterOptions options for the import filter, e.g. SkipImages. + */ +- inline Document* documentLoad(const char* pUrl, const char* pFilterOptions = NULL) ++ inline Document* documentLoad(const char* pUrl, const char* pFilterOptions = nullptr) + { +- LibreOfficeKitDocument* pDoc = NULL; ++ LibreOfficeKitDocument* pDoc = nullptr; + + if (LIBREOFFICEKIT_HAS(mpThis, documentLoadWithOptions)) + pDoc = mpThis->pClass->documentLoadWithOptions(mpThis, pUrl, pFilterOptions); + else + pDoc = mpThis->pClass->documentLoad(mpThis, pUrl); + +- if (pDoc == NULL) +- return NULL; ++ if (pDoc == nullptr) ++ return nullptr; + + return new Document(pDoc); + } +@@ -405,11 +405,11 @@ public: + }; + + /// Factory method to create a lok::Office instance. +-inline Office* lok_cpp_init(const char* pInstallPath, const char* pUserProfilePath = NULL) ++inline Office* lok_cpp_init(const char* pInstallPath, const char* pUserProfilePath = nullptr) + { + LibreOfficeKit* pThis = lok_init_2(pInstallPath, pUserProfilePath); +- if (pThis == NULL || pThis->pClass->nSize == 0) +- return NULL; ++ if (pThis == nullptr || pThis->pClass->nSize == 0) ++ return nullptr; + return new ::lok::Office(pThis); + } + +-- +2.12.0 + diff --git a/SOURCES/0292-loplugin-nullptr-automatic-rewrite.patch b/SOURCES/0292-loplugin-nullptr-automatic-rewrite.patch new file mode 100644 index 0000000..40a2993 --- /dev/null +++ b/SOURCES/0292-loplugin-nullptr-automatic-rewrite.patch @@ -0,0 +1,1004 @@ +From 7a2ed28a86aad93edca7fa6c2706a7ff78653b21 Mon Sep 17 00:00:00 2001 +From: Stephan Bergmann +Date: Tue, 10 Nov 2015 10:18:58 +0100 +Subject: [PATCH 292/398] loplugin:nullptr (automatic rewrite) + +Change-Id: Ibdb6409664cdf9499b6fec95c5de3549887b8106 +(cherry picked from commit 5678a4ce9eee64cafdbdb4fc1290535f9e03208f) +--- + .../qa/gtktiledviewer/gtktiledviewer.cxx | 96 ++++++------- + libreofficekit/qa/tilebench/tilebench.cxx | 6 +- + libreofficekit/source/gtk/lokdocview.cxx | 160 ++++++++++----------- + libreofficekit/source/gtk/tilebuffer.cxx | 12 +- + libreofficekit/source/gtk/tilebuffer.hxx | 10 +- + 5 files changed, 142 insertions(+), 142 deletions(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 08e756fa3ef6..3f57b5c6c6b9 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -119,31 +119,31 @@ public: + std::shared_ptr m_pCornerButton; + + TiledWindow() +- : m_pDocView(0), +- m_pStatusBar(0), +- m_pProgressBar(0), +- m_pStatusbarLabel(0), +- m_pZoomLabel(0), +- m_pEnableEditing(0), +- m_pBold(0), +- m_pItalic(0), +- m_pUnderline(0), +- m_pStrikethrough(0), +- m_pSuperscript(0), +- m_pSubscript(0), +- m_pLeftpara(0), +- m_pCenterpara(0), +- m_pRightpara(0), +- m_pJustifypara(0), +- m_pScrolledWindow(0), ++ : m_pDocView(nullptr), ++ m_pStatusBar(nullptr), ++ m_pProgressBar(nullptr), ++ m_pStatusbarLabel(nullptr), ++ m_pZoomLabel(nullptr), ++ m_pEnableEditing(nullptr), ++ m_pBold(nullptr), ++ m_pItalic(nullptr), ++ m_pUnderline(nullptr), ++ m_pStrikethrough(nullptr), ++ m_pSuperscript(nullptr), ++ m_pSubscript(nullptr), ++ m_pLeftpara(nullptr), ++ m_pCenterpara(nullptr), ++ m_pRightpara(nullptr), ++ m_pJustifypara(nullptr), ++ m_pScrolledWindow(nullptr), + m_bToolItemBroadcast(true), +- m_pVBox(0), +- m_pPartSelector(0), +- m_pPartModeComboBox(0), ++ m_pVBox(nullptr), ++ m_pPartSelector(nullptr), ++ m_pPartModeComboBox(nullptr), + m_bPartSelectorBroadcast(true), +- m_pFindbar(0), +- m_pFindbarEntry(0), +- m_pFindbarLabel(0), ++ m_pFindbar(nullptr), ++ m_pFindbarEntry(nullptr), ++ m_pFindbarLabel(nullptr), + m_bFindAll(false) + { + } +@@ -240,7 +240,7 @@ gboolean TiledRowColumnBar::drawImpl(GtkWidget* /*pWidget*/, cairo_t* pCairo) + void TiledRowColumnBar::docAdjustmentChanged(GtkAdjustment* /*pAdjustment*/, gpointer pData) + { + GtkWidget* pDocView = static_cast(pData); +- docConfigureEvent(pDocView, 0, 0); ++ docConfigureEvent(pDocView, nullptr, nullptr); + } + + gboolean TiledRowColumnBar::docConfigureEvent(GtkWidget* pDocView, GdkEventConfigure* /*pEvent*/, gpointer /*pData*/) +@@ -470,11 +470,11 @@ static void createView(GtkWidget* pButton, gpointer /*pItem*/) + /// Creates a new model, i.e. LOK init and document load, one view implicitly. + static void createModelAndView(const char* pLOPath, const char* pDocPath) + { +- GtkWidget* pDocView = lok_doc_view_new(pLOPath, 0, 0); ++ GtkWidget* pDocView = lok_doc_view_new(pLOPath, nullptr, nullptr); + + setupWidgetAndCreateWindow(pDocView); + +- lok_doc_view_open_document(LOK_DOC_VIEW(pDocView), pDocPath, 0, openDocumentCallback, pDocView); ++ lok_doc_view_open_document(LOK_DOC_VIEW(pDocView), pDocPath, nullptr, openDocumentCallback, pDocView); + } + + /// Our GtkClipboardGetFunc implementation for HTML. +@@ -494,7 +494,7 @@ static void htmlClearFunc(GtkClipboard* /*pClipboard*/, gpointer pData) + /// Same as gtk_clipboard_set_text(), but sets HTML. + static void clipboardSetHtml(GtkClipboard* pClipboard, const char* pSelection) + { +- GtkTargetList* pList = gtk_target_list_new(0, 0); ++ GtkTargetList* pList = gtk_target_list_new(nullptr, 0); + GdkAtom aAtom(gdk_atom_intern("text/html", false)); + gtk_target_list_add(pList, aAtom, 0, 0); + gint nTargets = 0; +@@ -512,7 +512,7 @@ static void doCopy(GtkWidget* pButton, gpointer /*pItem*/) + TiledWindow& rWindow = lcl_getTiledWindow(pButton); + LOKDocView* pLOKDocView = LOK_DOC_VIEW(rWindow.m_pDocView); + LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(pLOKDocView); +- char* pUsedFormat = 0; ++ char* pUsedFormat = nullptr; + char* pSelection = pDocument->pClass->getTextSelection(pDocument, "text/html", &pUsedFormat); + + GtkClipboard* pClipboard = gtk_clipboard_get_for_display(gtk_widget_get_display(rWindow.m_pDocView), GDK_SELECTION_CLIPBOARD); +@@ -708,9 +708,9 @@ static void signalPart(LOKDocView* pLOKDocView, int nPart, gpointer /*pData*/) + /// User clicked on a command button -> inform LOKDocView. + static void signalHyperlink(LOKDocView* /*pLOKDocView*/, char* pPayload, gpointer /*pData*/) + { +- GError* pError = NULL; +- gtk_show_uri(NULL, pPayload, GDK_CURRENT_TIME, &pError); +- if (pError != NULL) ++ GError* pError = nullptr; ++ gtk_show_uri(nullptr, pPayload, GDK_CURRENT_TIME, &pError); ++ if (pError != nullptr) + { + g_warning("Unable to show URI %s : %s", pPayload, pError->message); + g_error_free(pError); +@@ -781,7 +781,7 @@ static void toggleToolItem(GtkWidget* pWidget, gpointer /*pData*/) + // notify about the finished Save + gboolean bNotify = (rString == ".uno:Save"); + +- lok_doc_view_post_command(pLOKDocView, rString.c_str(), 0, bNotify); ++ lok_doc_view_post_command(pLOKDocView, rString.c_str(), nullptr, bNotify); + } + } + +@@ -863,8 +863,8 @@ static void openDocumentCallback (GObject* source_object, GAsyncResult* res, gpo + { + LOKDocView* pDocView = LOK_DOC_VIEW (source_object); + TiledWindow& rWindow = lcl_getTiledWindow(GTK_WIDGET(pDocView)); +- GError* error = NULL; +- GList *focusChain = NULL; ++ GError* error = nullptr; ++ GList *focusChain = nullptr; + + if (!lok_doc_view_open_document_finish(pDocView, res, &error)) + { +@@ -913,7 +913,7 @@ static GtkWidget* createWindow(TiledWindow& rWindow) + gtk_toolbar_set_style(GTK_TOOLBAR(pUpperToolbar), GTK_TOOLBAR_ICONS); + + // Save. +- GtkToolItem* pSave = gtk_tool_button_new(NULL, NULL); ++ GtkToolItem* pSave = gtk_tool_button_new(nullptr, nullptr); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(pSave), "document-save-symbolic"); + gtk_tool_item_set_tooltip_text(pSave, "Save"); + gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), pSave, -1); +@@ -922,12 +922,12 @@ static GtkWidget* createWindow(TiledWindow& rWindow) + lcl_registerToolItem(rWindow, pSave, ".uno:Save"); + + // Copy and paste. +- GtkToolItem* pCopyButton = gtk_tool_button_new( NULL, NULL); ++ GtkToolItem* pCopyButton = gtk_tool_button_new( nullptr, nullptr); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(pCopyButton), "edit-copy-symbolic"); + gtk_tool_item_set_tooltip_text(pCopyButton, "Copy"); + gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), pCopyButton, -1); + g_signal_connect(G_OBJECT(pCopyButton), "clicked", G_CALLBACK(doCopy), NULL); +- GtkToolItem* pPasteButton = gtk_tool_button_new( NULL, NULL); ++ GtkToolItem* pPasteButton = gtk_tool_button_new( nullptr, nullptr); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(pPasteButton), "edit-paste-symbolic"); + gtk_tool_item_set_tooltip_text(pPasteButton, "Paste"); + gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), pPasteButton, -1); +@@ -935,13 +935,13 @@ static GtkWidget* createWindow(TiledWindow& rWindow) + gtk_toolbar_insert( GTK_TOOLBAR(pUpperToolbar), gtk_separator_tool_item_new(), -1); + + // Undo and redo. +- GtkToolItem* pUndo = gtk_tool_button_new(NULL, NULL); ++ GtkToolItem* pUndo = gtk_tool_button_new(nullptr, nullptr); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(pUndo), "edit-undo-symbolic"); + gtk_tool_item_set_tooltip_text(pUndo, "Undo"); + gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), pUndo, -1); + g_signal_connect(G_OBJECT(pUndo), "clicked", G_CALLBACK(toggleToolItem), NULL); + lcl_registerToolItem(rWindow, pUndo, ".uno:Undo"); +- GtkToolItem* pRedo = gtk_tool_button_new(NULL, NULL); ++ GtkToolItem* pRedo = gtk_tool_button_new(nullptr, nullptr); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(pRedo), "edit-redo-symbolic"); + gtk_tool_item_set_tooltip_text(pRedo, "Redo"); + gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), pRedo, -1); +@@ -950,7 +950,7 @@ static GtkWidget* createWindow(TiledWindow& rWindow) + gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), gtk_separator_tool_item_new(), -1); + + // Find. +- GtkToolItem* pFindButton = gtk_tool_button_new( NULL, NULL); ++ GtkToolItem* pFindButton = gtk_tool_button_new( nullptr, nullptr); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pFindButton), "edit-find-symbolic"); + gtk_tool_item_set_tooltip_text(pFindButton, "Find"); + gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), pFindButton, -1); +@@ -958,19 +958,19 @@ static GtkWidget* createWindow(TiledWindow& rWindow) + gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), gtk_separator_tool_item_new(), -1); + + // Misc upper toolbar. +- GtkToolItem* pZoomIn = gtk_tool_button_new(NULL, NULL); ++ GtkToolItem* pZoomIn = gtk_tool_button_new(nullptr, nullptr); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pZoomIn), "zoom-in-symbolic"); + gtk_tool_item_set_tooltip_text(pZoomIn, "Zoom In"); + gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), pZoomIn, -1); + g_signal_connect(G_OBJECT(pZoomIn), "clicked", G_CALLBACK(changeZoom), NULL); + +- GtkToolItem* pZoom1 = gtk_tool_button_new(NULL, NULL); ++ GtkToolItem* pZoom1 = gtk_tool_button_new(nullptr, nullptr); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(pZoom1), "zoom-original-symbolic"); + gtk_tool_item_set_tooltip_text(pZoom1, "Normal Size"); + gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), pZoom1, -1); + g_signal_connect(G_OBJECT(pZoom1), "clicked", G_CALLBACK(changeZoom), NULL); + +- GtkToolItem* pZoomOut = gtk_tool_button_new(NULL, NULL); ++ GtkToolItem* pZoomOut = gtk_tool_button_new(nullptr, nullptr); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pZoomOut), "zoom-out-symbolic"); + gtk_tool_item_set_tooltip_text(pZoomOut, "Zoom Out"); + gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), pZoomOut, -1); +@@ -995,7 +995,7 @@ static GtkWidget* createWindow(TiledWindow& rWindow) + gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), pEnableEditing, -1); + g_signal_connect(G_OBJECT(pEnableEditing), "toggled", G_CALLBACK(toggleEditing), NULL); + +- GtkToolItem* pNewViewButton = gtk_tool_button_new( NULL, NULL); ++ GtkToolItem* pNewViewButton = gtk_tool_button_new( nullptr, nullptr); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pNewViewButton), "view-continuous-symbolic"); + gtk_tool_item_set_tooltip_text(pNewViewButton, "New View"); + gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), pNewViewButton, -1); +@@ -1079,7 +1079,7 @@ static GtkWidget* createWindow(TiledWindow& rWindow) + rWindow.m_pFindbar = gtk_toolbar_new(); + gtk_toolbar_set_style(GTK_TOOLBAR(rWindow.m_pFindbar), GTK_TOOLBAR_ICONS); + +- GtkToolItem* pFindbarClose = gtk_tool_button_new( NULL, NULL); ++ GtkToolItem* pFindbarClose = gtk_tool_button_new( nullptr, nullptr); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pFindbarClose), "window-close-symbolic"); + gtk_toolbar_insert(GTK_TOOLBAR(rWindow.m_pFindbar), pFindbarClose, -1); + g_signal_connect(G_OBJECT(pFindbarClose), "clicked", G_CALLBACK(toggleFindbar), NULL); +@@ -1090,12 +1090,12 @@ static GtkWidget* createWindow(TiledWindow& rWindow) + g_signal_connect(rWindow.m_pFindbarEntry, "key-press-event", G_CALLBACK(signalFindbar), 0); + gtk_toolbar_insert(GTK_TOOLBAR(rWindow.m_pFindbar), pEntryContainer, -1); + +- GtkToolItem* pFindbarNext = gtk_tool_button_new( NULL, NULL); ++ GtkToolItem* pFindbarNext = gtk_tool_button_new( nullptr, nullptr); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pFindbarNext), "go-down-symbolic"); + gtk_toolbar_insert(GTK_TOOLBAR(rWindow.m_pFindbar), pFindbarNext, -1); + g_signal_connect(G_OBJECT(pFindbarNext), "clicked", G_CALLBACK(signalSearchNext), NULL); + +- GtkToolItem* pFindbarPrev = gtk_tool_button_new( NULL, NULL); ++ GtkToolItem* pFindbarPrev = gtk_tool_button_new( nullptr, nullptr); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pFindbarPrev), "go-up-symbolic"); + gtk_toolbar_insert(GTK_TOOLBAR(rWindow.m_pFindbar), pFindbarPrev, -1); + g_signal_connect(G_OBJECT(pFindbarPrev), "clicked", G_CALLBACK(signalSearchPrev), NULL); +@@ -1126,7 +1126,7 @@ static GtkWidget* createWindow(TiledWindow& rWindow) + gtk_grid_attach(GTK_GRID(pGrid), rWindow.m_pColumnBar->m_pDrawingArea, 1, 0, 1, 1); + + // Scrolled window for DocView +- rWindow.m_pScrolledWindow = gtk_scrolled_window_new(0, 0); ++ rWindow.m_pScrolledWindow = gtk_scrolled_window_new(nullptr, nullptr); + gtk_widget_set_hexpand(rWindow.m_pScrolledWindow, TRUE); + gtk_widget_set_vexpand(rWindow.m_pScrolledWindow, TRUE); + // "B2" cell of the grid +diff --git a/libreofficekit/qa/tilebench/tilebench.cxx b/libreofficekit/qa/tilebench/tilebench.cxx +index e72c730a6dfe..20777de49fe1 100644 +--- a/libreofficekit/qa/tilebench/tilebench.cxx ++++ b/libreofficekit/qa/tilebench/tilebench.cxx +@@ -42,7 +42,7 @@ int main( int argc, char* argv[] ) + const char *mpName; + double mfTime; + +- TimeRecord() : mpName(NULL), mfTime(getTimeNow()) { } ++ TimeRecord() : mpName(nullptr), mfTime(getTimeNow()) { } + explicit TimeRecord(const char *pName) : + mpName(pName ), mfTime(getTimeNow()) { } + }; +@@ -62,7 +62,7 @@ int main( int argc, char* argv[] ) + Office *pOffice = lok_cpp_init(argv[1]); + aTimes.push_back(TimeRecord()); + +- if (argv[2] != NULL) ++ if (argv[2] != nullptr) + { + aTimes.push_back(TimeRecord("load document")); + Document *pDocument(pOffice->documentLoad(argv[2])); +@@ -157,7 +157,7 @@ int main( int argc, char* argv[] ) + { + double nDelta = aTimes[i+1].mfTime - aTimes[i].mfTime; + fprintf (stderr, " %s - %2.4f(ms)\n", aTimes[i].mpName, nDelta * 1000.0); +- if (aTimes[i+1].mpName == NULL) ++ if (aTimes[i+1].mpName == nullptr) + i++; // skip it. + nTotal += nDelta; + } +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 9dfa2f3b44a6..0d1dec1ddb05 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -119,15 +119,15 @@ struct LOKDocViewPrivateImpl + int m_nViewId; + + LOKDocViewPrivateImpl() +- : m_aLOPath(0), +- m_aDocPath(0), ++ : m_aLOPath(nullptr), ++ m_aDocPath(nullptr), + m_nLoadProgress(0), + m_bIsLoading(false), + m_bCanZoomIn(false), + m_bCanZoomOut(false), +- m_pOffice(0), +- m_pDocument(0), +- lokThreadPool(0), ++ m_pOffice(nullptr), ++ m_pDocument(nullptr), ++ lokThreadPool(nullptr), + m_fZoom(0), + m_nDocumentWidthTwips(0), + m_nDocumentHeightTwips(0), +@@ -144,16 +144,16 @@ struct LOKDocViewPrivateImpl + m_aGraphicSelection({0, 0, 0, 0}), + m_aCellCursor({0, 0, 0, 0}), + m_bInDragGraphicSelection(false), +- m_pHandleStart(0), ++ m_pHandleStart(nullptr), + m_aHandleStartRect({0, 0, 0, 0}), + m_bInDragStartHandle(0), +- m_pHandleMiddle(0), ++ m_pHandleMiddle(nullptr), + m_aHandleMiddleRect({0, 0, 0, 0}), + m_bInDragMiddleHandle(false), +- m_pHandleEnd(0), ++ m_pHandleEnd(nullptr), + m_aHandleEndRect({0, 0, 0, 0}), + m_bInDragEndHandle(false), +- m_pGraphicHandle(0), ++ m_pGraphicHandle(nullptr), + m_nViewId(0) + { + memset(&m_aGraphicHandleRects, 0, sizeof(m_aGraphicHandleRects)); +@@ -299,7 +299,7 @@ callbackTypeToString (int nType) + case LOK_CALLBACK_SEARCH_RESULT_SELECTION: + return "LOK_CALLBACK_SEARCH_RESULT_SELECTION"; + } +- return 0; ++ return nullptr; + } + + static bool +@@ -330,7 +330,7 @@ signalKey (GtkWidget* pWidget, GdkEventKey* pEvent) + LOKDocViewPrivate& priv = getPrivate(pDocView); + int nCharCode = 0; + int nKeyCode = 0; +- GError* error = NULL; ++ GError* error = nullptr; + + if (!priv->m_bEdit) + { +@@ -419,14 +419,14 @@ signalKey (GtkWidget* pWidget, GdkEventKey* pEvent) + + if (pEvent->type == GDK_KEY_RELEASE) + { +- GTask* task = g_task_new(pDocView, NULL, NULL, NULL); ++ GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr); + LOEvent* pLOEvent = new LOEvent(LOK_POST_KEY); + pLOEvent->m_nKeyEvent = LOK_KEYEVENT_KEYUP; + pLOEvent->m_nCharCode = nCharCode; + pLOEvent->m_nKeyCode = nKeyCode; + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); +- if (error != NULL) ++ if (error != nullptr) + { + g_warning("Unable to call LOK_POST_KEY: %s", error->message); + g_clear_error(&error); +@@ -435,14 +435,14 @@ signalKey (GtkWidget* pWidget, GdkEventKey* pEvent) + } + else + { +- GTask* task = g_task_new(pDocView, NULL, NULL, NULL); ++ GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr); + LOEvent* pLOEvent = new LOEvent(LOK_POST_KEY); + pLOEvent->m_nKeyEvent = LOK_KEYEVENT_KEYINPUT; + pLOEvent->m_nCharCode = nCharCode; + pLOEvent->m_nKeyCode = nKeyCode; + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); +- if (error != NULL) ++ if (error != nullptr) + { + g_warning("Unable to call LOK_POST_KEY: %s", error->message); + g_clear_error(&error); +@@ -664,7 +664,7 @@ setTilesInvalid (LOKDocView* pDocView, const GdkRectangle& rRectangle) + { + for (int j = aStart.y; j < aEnd.y; j++) + { +- GTask* task = g_task_new(pDocView, NULL, NULL, NULL); ++ GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr); + priv->m_pTileBuffer->setInvalid(i, j, priv->m_fZoom, task, priv->lokThreadPool); + g_object_unref(task); + } +@@ -927,7 +927,7 @@ paintTileFinish(LOKDocView* pDocView, GAsyncResult* res, GError **error) + + g_return_val_if_fail(LOK_IS_DOC_VIEW(pDocView), NULL); + g_return_val_if_fail(g_task_is_valid(res, pDocView), NULL); +- g_return_val_if_fail(error == NULL || *error == NULL, NULL); ++ g_return_val_if_fail(error == nullptr || *error == nullptr, NULL); + + return g_task_propagate_pointer(task, error); + } +@@ -943,9 +943,9 @@ paintTileCallback(GObject* sourceObject, GAsyncResult* res, gpointer userData) + int index = pLOEvent->m_nPaintTileX * buffer->m_nWidth + pLOEvent->m_nPaintTileY; + GError* error; + +- error = NULL; ++ error = nullptr; + GdkPixbuf* pPixBuf = static_cast(paintTileFinish(pDocView, res, &error)); +- if (error != NULL) ++ if (error != nullptr) + { + if (error->domain == LOK_TILEBUFFER_ERROR && + error->code == LOK_TILEBUFFER_CHANGED) +@@ -1008,7 +1008,7 @@ renderDocument(LOKDocView* pDocView, cairo_t* pCairo) + aTileRectangleTwips.width = pixelToTwip(aTileRectanglePixels.width, priv->m_fZoom); + aTileRectangleTwips.height = pixelToTwip(aTileRectanglePixels.height, priv->m_fZoom); + +- if (!gdk_rectangle_intersect(&aVisibleArea, &aTileRectangleTwips, 0)) ++ if (!gdk_rectangle_intersect(&aVisibleArea, &aTileRectangleTwips, nullptr)) + bPaint = false; + + if (bPaint) +@@ -1018,7 +1018,7 @@ renderDocument(LOKDocView* pDocView, cairo_t* pCairo) + pLOEvent->m_nPaintTileY = nColumn; + pLOEvent->m_fPaintTileZoom = priv->m_fZoom; + pLOEvent->m_pTileBuffer = &*priv->m_pTileBuffer; +- GTask* task = g_task_new(pDocView, NULL, paintTileCallback, pLOEvent); ++ GTask* task = g_task_new(pDocView, nullptr, paintTileCallback, pLOEvent); + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + + Tile& currentTile = priv->m_pTileBuffer->getTile(nRow, nColumn, task, priv->lokThreadPool); +@@ -1145,7 +1145,7 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + { + LOKDocView* pDocView = LOK_DOC_VIEW (pWidget); + LOKDocViewPrivate& priv = getPrivate(pDocView); +- GError* error = NULL; ++ GError* error = nullptr; + + g_info("LOKDocView_Impl::signalButton: %d, %d (in twips: %d, %d)", + (int)pEvent->x, (int)pEvent->y, +@@ -1181,7 +1181,7 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + g_info("LOKDocView_Impl::signalButton: end of drag graphic handle #%d", i); + priv->m_bInDragGraphicHandles[i] = false; + +- GTask* task = g_task_new(pDocView, NULL, NULL, NULL); ++ GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr); + LOEvent* pLOEvent = new LOEvent(LOK_SET_GRAPHIC_SELECTION); + pLOEvent->m_nSetGraphicSelectionType = LOK_SETGRAPHICSELECTION_END; + pLOEvent->m_nSetGraphicSelectionX = pixelToTwip(pEvent->x, priv->m_fZoom); +@@ -1189,7 +1189,7 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + + g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); +- if (error != NULL) ++ if (error != nullptr) + { + g_warning("Unable to call LOK_SET_GRAPHIC_SELECTION: %s", error->message); + g_clear_error(&error); +@@ -1205,7 +1205,7 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + g_info("LOKDocView_Impl::signalButton: end of drag graphic selection"); + priv->m_bInDragGraphicSelection = false; + +- GTask* task = g_task_new(pDocView, NULL, NULL, NULL); ++ GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr); + LOEvent* pLOEvent = new LOEvent(LOK_SET_GRAPHIC_SELECTION); + pLOEvent->m_nSetGraphicSelectionType = LOK_SETGRAPHICSELECTION_END; + pLOEvent->m_nSetGraphicSelectionX = pixelToTwip(pEvent->x, priv->m_fZoom); +@@ -1213,7 +1213,7 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + + g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); +- if (error != NULL) ++ if (error != nullptr) + { + g_warning("Unable to call LOK_SET_GRAPHIC_SELECTION: %s", error->message); + g_clear_error(&error); +@@ -1233,19 +1233,19 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + aClick.height = 1; + if (pEvent->type == GDK_BUTTON_PRESS) + { +- if (gdk_rectangle_intersect(&aClick, &priv->m_aHandleStartRect, NULL)) ++ if (gdk_rectangle_intersect(&aClick, &priv->m_aHandleStartRect, nullptr)) + { + g_info("LOKDocView_Impl::signalButton: start of drag start handle"); + priv->m_bInDragStartHandle = true; + return FALSE; + } +- else if (gdk_rectangle_intersect(&aClick, &priv->m_aHandleMiddleRect, NULL)) ++ else if (gdk_rectangle_intersect(&aClick, &priv->m_aHandleMiddleRect, nullptr)) + { + g_info("LOKDocView_Impl::signalButton: start of drag middle handle"); + priv->m_bInDragMiddleHandle = true; + return FALSE; + } +- else if (gdk_rectangle_intersect(&aClick, &priv->m_aHandleEndRect, NULL)) ++ else if (gdk_rectangle_intersect(&aClick, &priv->m_aHandleEndRect, nullptr)) + { + g_info("LOKDocView_Impl::signalButton: start of drag end handle"); + priv->m_bInDragEndHandle = true; +@@ -1254,12 +1254,12 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + + for (int i = 0; i < GRAPHIC_HANDLE_COUNT; ++i) + { +- if (gdk_rectangle_intersect(&aClick, &priv->m_aGraphicHandleRects[i], NULL)) ++ if (gdk_rectangle_intersect(&aClick, &priv->m_aGraphicHandleRects[i], nullptr)) + { + g_info("LOKDocView_Impl::signalButton: start of drag graphic handle #%d", i); + priv->m_bInDragGraphicHandles[i] = true; + +- GTask* task = g_task_new(pDocView, NULL, NULL, NULL); ++ GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr); + LOEvent* pLOEvent = new LOEvent(LOK_SET_GRAPHIC_SELECTION); + pLOEvent->m_nSetGraphicSelectionType = LOK_SETGRAPHICSELECTION_START; + pLOEvent->m_nSetGraphicSelectionX = pixelToTwip(priv->m_aGraphicHandleRects[i].x + priv->m_aGraphicHandleRects[i].width / 2, priv->m_fZoom); +@@ -1267,7 +1267,7 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + + g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); +- if (error != NULL) ++ if (error != nullptr) + { + g_warning("Unable to call LOK_SET_GRAPHIC_SELECTION: %s", error->message); + g_clear_error(&error); +@@ -1291,7 +1291,7 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + if ((pEvent->time - priv->m_nLastButtonPressTime) < 250) + nCount++; + priv->m_nLastButtonPressTime = pEvent->time; +- GTask* task = g_task_new(pDocView, NULL, NULL, NULL); ++ GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr); + LOEvent* pLOEvent = new LOEvent(LOK_POST_MOUSE_EVENT); + pLOEvent->m_nPostMouseEventType = LOK_MOUSEEVENT_MOUSEBUTTONDOWN; + pLOEvent->m_nPostMouseEventX = pixelToTwip(pEvent->x, priv->m_fZoom); +@@ -1314,7 +1314,7 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + + g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); +- if (error != NULL) ++ if (error != nullptr) + { + g_warning("Unable to call LOK_POST_MOUSE_EVENT: %s", error->message); + g_clear_error(&error); +@@ -1328,7 +1328,7 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + if ((pEvent->time - priv->m_nLastButtonReleaseTime) < 250) + nCount++; + priv->m_nLastButtonReleaseTime = pEvent->time; +- GTask* task = g_task_new(pDocView, NULL, NULL, NULL); ++ GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr); + LOEvent* pLOEvent = new LOEvent(LOK_POST_MOUSE_EVENT); + pLOEvent->m_nPostMouseEventType = LOK_MOUSEEVENT_MOUSEBUTTONUP; + pLOEvent->m_nPostMouseEventX = pixelToTwip(pEvent->x, priv->m_fZoom); +@@ -1351,7 +1351,7 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + + g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); +- if (error != NULL) ++ if (error != nullptr) + { + g_warning("Unable to call LOK_POST_MOUSE_EVENT: %s", error->message); + g_clear_error(&error); +@@ -1389,7 +1389,7 @@ lok_doc_view_signal_motion (GtkWidget* pWidget, GdkEventMotion* pEvent) + LOKDocView* pDocView = LOK_DOC_VIEW (pWidget); + LOKDocViewPrivate& priv = getPrivate(pDocView); + GdkPoint aPoint; +- GError* error = NULL; ++ GError* error = nullptr; + + priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId); + if (priv->m_bInDragMiddleHandle) +@@ -1432,12 +1432,12 @@ lok_doc_view_signal_motion (GtkWidget* pWidget, GdkEventMotion* pEvent) + aMotionInTwipsInTwips.y = pixelToTwip(pEvent->y, priv->m_fZoom); + aMotionInTwipsInTwips.width = 1; + aMotionInTwipsInTwips.height = 1; +- if (gdk_rectangle_intersect(&aMotionInTwipsInTwips, &priv->m_aGraphicSelection, 0)) ++ if (gdk_rectangle_intersect(&aMotionInTwipsInTwips, &priv->m_aGraphicSelection, nullptr)) + { + g_info("lcl_signalMotion: start of drag graphic selection"); + priv->m_bInDragGraphicSelection = true; + +- GTask* task = g_task_new(pDocView, NULL, NULL, NULL); ++ GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr); + LOEvent* pLOEvent = new LOEvent(LOK_SET_GRAPHIC_SELECTION); + pLOEvent->m_nSetGraphicSelectionType = LOK_SETGRAPHICSELECTION_START; + pLOEvent->m_nSetGraphicSelectionX = pixelToTwip(pEvent->x, priv->m_fZoom); +@@ -1445,7 +1445,7 @@ lok_doc_view_signal_motion (GtkWidget* pWidget, GdkEventMotion* pEvent) + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + + g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); +- if (error != NULL) ++ if (error != nullptr) + { + g_warning("Unable to call LOK_SET_GRAPHIC_SELECTION: %s", error->message); + g_clear_error(&error); +@@ -1457,7 +1457,7 @@ lok_doc_view_signal_motion (GtkWidget* pWidget, GdkEventMotion* pEvent) + + // Otherwise a mouse move, as on the desktop. + +- GTask* task = g_task_new(pDocView, NULL, NULL, NULL); ++ GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr); + LOEvent* pLOEvent = new LOEvent(LOK_POST_MOUSE_EVENT); + pLOEvent->m_nPostMouseEventType = LOK_MOUSEEVENT_MOUSEMOVE; + pLOEvent->m_nPostMouseEventX = pixelToTwip(pEvent->x, priv->m_fZoom); +@@ -1469,7 +1469,7 @@ lok_doc_view_signal_motion (GtkWidget* pWidget, GdkEventMotion* pEvent) + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + + g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); +- if (error != NULL) ++ if (error != nullptr) + { + g_warning("Unable to call LOK_MOUSEEVENT_MOUSEMOVE: %s", error->message); + g_clear_error(&error); +@@ -1522,7 +1522,7 @@ openDocumentInThread (gpointer data) + if ( priv->m_pDocument ) + { + priv->m_pDocument->pClass->destroy( priv->m_pDocument ); +- priv->m_pDocument = 0; ++ priv->m_pDocument = nullptr; + } + + priv->m_pOffice->pClass->registerCallback(priv->m_pOffice, globalCallbackWorker, pDocView); +@@ -1728,10 +1728,10 @@ static void lok_doc_view_init (LOKDocView* pDocView) + |GDK_KEY_RELEASE_MASK); + + priv->lokThreadPool = g_thread_pool_new(lokThreadFunc, +- NULL, ++ nullptr, + 1, + FALSE, +- NULL); ++ nullptr); + } + + static void lok_doc_view_set_property (GObject* object, guint propId, const GValue *value, GParamSpec *pspec) +@@ -1838,7 +1838,7 @@ static void lok_doc_view_finalize (GObject* object) + if (priv->m_pOffice) + priv->m_pOffice->pClass->destroy (priv->m_pOffice); + delete priv.m_pImpl; +- priv.m_pImpl = 0; ++ priv.m_pImpl = nullptr; + + G_OBJECT_CLASS (lok_doc_view_parent_class)->finalize (object); + } +@@ -1848,12 +1848,12 @@ static gboolean lok_doc_view_initable_init (GInitable *initable, GCancellable* / + LOKDocView *pDocView = LOK_DOC_VIEW (initable); + LOKDocViewPrivate& priv = getPrivate(pDocView); + +- if (priv->m_pOffice != NULL) ++ if (priv->m_pOffice != nullptr) + return TRUE; + + priv->m_pOffice = lok_init (priv->m_aLOPath); + +- if (priv->m_pOffice == NULL) ++ if (priv->m_pOffice == nullptr) + { + g_set_error (error, + g_quark_from_static_string ("LOK initialization error"), 0, +@@ -1896,7 +1896,7 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + g_param_spec_string("lopath", + "LO Path", + "LibreOffice Install Path", +- 0, ++ nullptr, + static_cast(G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS))); +@@ -1926,7 +1926,7 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + g_param_spec_string("docpath", + "Document Path", + "The URI of the document to open", +- 0, ++ nullptr, + static_cast(G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS))); + +@@ -2072,7 +2072,7 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + G_TYPE_FROM_CLASS (pGObjectClass), + G_SIGNAL_RUN_FIRST, + 0, +- NULL, NULL, ++ nullptr, nullptr, + g_cclosure_marshal_VOID__DOUBLE, + G_TYPE_NONE, 1, + G_TYPE_DOUBLE); +@@ -2087,7 +2087,7 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + G_TYPE_FROM_CLASS (pGObjectClass), + G_SIGNAL_RUN_FIRST, + 0, +- NULL, NULL, ++ nullptr, nullptr, + g_cclosure_marshal_VOID__BOOLEAN, + G_TYPE_NONE, 1, + G_TYPE_BOOLEAN); +@@ -2102,7 +2102,7 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + G_TYPE_FROM_CLASS(pGObjectClass), + G_SIGNAL_RUN_FIRST, + 0, +- NULL, NULL, ++ nullptr, nullptr, + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, 1, + G_TYPE_STRING); +@@ -2117,7 +2117,7 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + G_TYPE_FROM_CLASS(pGObjectClass), + G_SIGNAL_RUN_FIRST, + 0, +- NULL, NULL, ++ nullptr, nullptr, + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, 1, + G_TYPE_STRING); +@@ -2132,7 +2132,7 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + G_TYPE_FROM_CLASS(pGObjectClass), + G_SIGNAL_RUN_FIRST, + 0, +- NULL, NULL, ++ nullptr, nullptr, + g_cclosure_marshal_VOID__INT, + G_TYPE_NONE, 1, + G_TYPE_INT); +@@ -2147,7 +2147,7 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + G_TYPE_FROM_CLASS(pGObjectClass), + G_SIGNAL_RUN_FIRST, + 0, +- NULL, NULL, ++ nullptr, nullptr, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 1, + G_TYPE_INT); +@@ -2162,7 +2162,7 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + G_TYPE_FROM_CLASS(pGObjectClass), + G_SIGNAL_RUN_FIRST, + 0, +- NULL, NULL, ++ nullptr, nullptr, + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, 1, + G_TYPE_STRING); +@@ -2180,7 +2180,7 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + G_TYPE_FROM_CLASS(pGObjectClass), + G_SIGNAL_RUN_FIRST, + 0, +- NULL, NULL, ++ nullptr, nullptr, + g_cclosure_marshal_generic, + G_TYPE_NONE, 4, + G_TYPE_INT, G_TYPE_INT, +@@ -2196,7 +2196,7 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + G_TYPE_FROM_CLASS(pGObjectClass), + G_SIGNAL_RUN_FIRST, + 0, +- NULL, NULL, ++ nullptr, nullptr, + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, 1, + G_TYPE_STRING); +@@ -2212,7 +2212,7 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + G_TYPE_FROM_CLASS(pGObjectClass), + G_SIGNAL_RUN_FIRST, + 0, +- NULL, NULL, ++ nullptr, nullptr, + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, 1, + G_TYPE_STRING); +@@ -2228,7 +2228,7 @@ lok_doc_view_new (const gchar* pPath, GCancellable *cancellable, GError **error) + SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new_from_widget(LOKDocView* pOldLOKDocView) + { + LOKDocViewPrivate& pOldPriv = getPrivate(pOldLOKDocView); +- GtkWidget* pNewDocView = GTK_WIDGET(g_initable_new(LOK_TYPE_DOC_VIEW, /*cancellable=*/0, /*error=*/0, ++ GtkWidget* pNewDocView = GTK_WIDGET(g_initable_new(LOK_TYPE_DOC_VIEW, /*cancellable=*/nullptr, /*error=*/nullptr, + "lopath", pOldPriv->m_aLOPath, "lopointer", pOldPriv->m_pOffice, "docpointer", pOldPriv->m_pDocument, NULL)); + + // No documentLoad(), just a createView(). +@@ -2248,7 +2248,7 @@ lok_doc_view_open_document_finish (LOKDocView* pDocView, GAsyncResult* res, GErr + g_return_val_if_fail(g_task_is_valid(res, pDocView), false); + //FIXME: make source_tag work + //g_return_val_if_fail(g_task_get_source_tag(task) == lok_doc_view_open_document, NULL); +- g_return_val_if_fail(error == NULL || *error == NULL, false); ++ g_return_val_if_fail(error == nullptr || *error == nullptr, false); + + return g_task_propagate_boolean(task, error); + } +@@ -2262,7 +2262,7 @@ lok_doc_view_open_document (LOKDocView* pDocView, + { + GTask* task = g_task_new(pDocView, cancellable, callback, userdata); + LOKDocViewPrivate& priv = getPrivate(pDocView); +- GError* error = NULL; ++ GError* error = nullptr; + + LOEvent* pLOEvent = new LOEvent(LOK_LOAD_DOC); + pLOEvent->m_pPath = pPath; +@@ -2271,7 +2271,7 @@ lok_doc_view_open_document (LOKDocView* pDocView, + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + + g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); +- if (error != NULL) ++ if (error != nullptr) + { + g_warning("Unable to call LOK_LOAD_DOC: %s", error->message); + g_clear_error(&error); +@@ -2331,15 +2331,15 @@ SAL_DLLPUBLIC_EXPORT void + lok_doc_view_set_part (LOKDocView* pDocView, int nPart) + { + LOKDocViewPrivate& priv = getPrivate(pDocView); +- GTask* task = g_task_new(pDocView, NULL, NULL, NULL); ++ GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr); + LOEvent* pLOEvent = new LOEvent(LOK_SET_PART); +- GError* error = NULL; ++ GError* error = nullptr; + + pLOEvent->m_nPart = nPart; + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + + g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); +- if (error != NULL) ++ if (error != nullptr) + { + g_warning("Unable to call LOK_SET_PART: %s", error->message); + g_clear_error(&error); +@@ -2360,14 +2360,14 @@ lok_doc_view_set_partmode(LOKDocView* pDocView, + int nPartMode) + { + LOKDocViewPrivate& priv = getPrivate(pDocView); +- GTask* task = g_task_new(pDocView, NULL, NULL, NULL); ++ GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr); + LOEvent* pLOEvent = new LOEvent(LOK_SET_PARTMODE); +- GError* error = NULL; ++ GError* error = nullptr; + pLOEvent->m_nPartMode = nPartMode; + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + + g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); +- if (error != NULL) ++ if (error != nullptr) + { + g_warning("Unable to call LOK_SET_PARTMODE: %s", error->message); + g_clear_error(&error); +@@ -2397,22 +2397,22 @@ lok_doc_view_reset_view(LOKDocView* pDocView) + memset(&priv->m_aCellCursor, 0, sizeof(priv->m_aCellCursor)); + + cairo_surface_destroy(priv->m_pHandleStart); +- priv->m_pHandleStart = 0; ++ priv->m_pHandleStart = nullptr; + memset(&priv->m_aHandleStartRect, 0, sizeof(priv->m_aHandleStartRect)); + priv->m_bInDragStartHandle = false; + + cairo_surface_destroy(priv->m_pHandleMiddle); +- priv->m_pHandleMiddle = 0; ++ priv->m_pHandleMiddle = nullptr; + memset(&priv->m_aHandleMiddleRect, 0, sizeof(priv->m_aHandleMiddleRect)); + priv->m_bInDragMiddleHandle = false; + + cairo_surface_destroy(priv->m_pHandleEnd); +- priv->m_pHandleEnd = 0; ++ priv->m_pHandleEnd = nullptr; + memset(&priv->m_aHandleEndRect, 0, sizeof(priv->m_aHandleEndRect)); + priv->m_bInDragEndHandle = false; + + cairo_surface_destroy(priv->m_pGraphicHandle); +- priv->m_pGraphicHandle = 0; ++ priv->m_pGraphicHandle = nullptr; + memset(&priv->m_aGraphicHandleRects, 0, sizeof(priv->m_aGraphicHandleRects)); + memset(&priv->m_bInDragGraphicHandles, 0, sizeof(priv->m_bInDragGraphicHandles)); + +@@ -2426,14 +2426,14 @@ lok_doc_view_set_edit(LOKDocView* pDocView, + gboolean bEdit) + { + LOKDocViewPrivate& priv = getPrivate(pDocView); +- GTask* task = g_task_new(pDocView, NULL, NULL, NULL); ++ GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr); + LOEvent* pLOEvent = new LOEvent(LOK_SET_EDIT); +- GError* error = NULL; ++ GError* error = nullptr; + pLOEvent->m_bEdit = bEdit; + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + + g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); +- if (error != NULL) ++ if (error != nullptr) + { + g_warning("Unable to call LOK_SET_EDIT: %s", error->message); + g_clear_error(&error); +@@ -2456,16 +2456,16 @@ lok_doc_view_post_command (LOKDocView* pDocView, + gboolean bNotifyWhenFinished) + { + LOKDocViewPrivate& priv = getPrivate(pDocView); +- GTask* task = g_task_new(pDocView, NULL, NULL, NULL); ++ GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr); + LOEvent* pLOEvent = new LOEvent(LOK_POST_COMMAND); +- GError* error = NULL; ++ GError* error = nullptr; + pLOEvent->m_pCommand = pCommand; + pLOEvent->m_pArguments = g_strdup(pArguments); + pLOEvent->m_bNotifyWhenFinished = bNotifyWhenFinished; + + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); +- if (error != NULL) ++ if (error != nullptr) + { + g_warning("Unable to call LOK_POST_COMMAND: %s", error->message); + g_clear_error(&error); +diff --git a/libreofficekit/source/gtk/tilebuffer.cxx b/libreofficekit/source/gtk/tilebuffer.cxx +index 32a9534e884c..f804a1f42140 100644 +--- a/libreofficekit/source/gtk/tilebuffer.cxx ++++ b/libreofficekit/source/gtk/tilebuffer.cxx +@@ -44,7 +44,7 @@ void Tile::setPixbuf(GdkPixbuf *buffer) + if (m_pBuffer == buffer) + return; + g_clear_object(&m_pBuffer); +- if (buffer != NULL) ++ if (buffer != nullptr) + g_object_ref(buffer); + m_pBuffer = buffer; + } +@@ -66,7 +66,7 @@ void TileBuffer::setInvalid(int x, int y, float fZoom, GTask* task, + GThreadPool* lokThreadPool) + { + int index = x * m_nWidth + y; +- GError* error = NULL; ++ GError* error = nullptr; + if (m_mTiles.find(index) != m_mTiles.end()) + { + m_mTiles[index].valid = false; +@@ -77,7 +77,7 @@ void TileBuffer::setInvalid(int x, int y, float fZoom, GTask* task, + pLOEvent->m_fPaintTileZoom = fZoom; + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + g_thread_pool_push(lokThreadPool, g_object_ref(task), &error); +- if (error != NULL) ++ if (error != nullptr) + { + g_warning("Unable to call LOK_PAINT_TILE: %s", error->message); + g_clear_error(&error); +@@ -89,12 +89,12 @@ Tile& TileBuffer::getTile(int x, int y, GTask* task, + GThreadPool* lokThreadPool) + { + int index = x * m_nWidth + y; +- GError* error = NULL; ++ GError* error = nullptr; + + if (m_mTiles.find(index) != m_mTiles.end() && !m_mTiles[index].valid) + { + g_thread_pool_push(lokThreadPool, g_object_ref(task), &error); +- if (error != NULL) ++ if (error != nullptr) + { + g_warning("Unable to call LOK_PAINT_TILE: %s", error->message); + g_clear_error(&error); +@@ -104,7 +104,7 @@ Tile& TileBuffer::getTile(int x, int y, GTask* task, + else if(m_mTiles.find(index) == m_mTiles.end()) + { + g_thread_pool_push(lokThreadPool, g_object_ref(task), &error); +- if (error != NULL) ++ if (error != nullptr) + { + g_warning("Unable to call LOK_PAINT_TILE: %s", error->message); + g_clear_error(&error); +diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx +index 9407257e5fec..5482ea2b2825 100644 +--- a/libreofficekit/source/gtk/tilebuffer.hxx ++++ b/libreofficekit/source/gtk/tilebuffer.hxx +@@ -58,7 +58,7 @@ GQuark LOKTileBufferErrorQuark(void); + class Tile + { + public: +- Tile() : valid(false), m_pBuffer(0) {} ++ Tile() : valid(false), m_pBuffer(nullptr) {} + ~Tile() + { + g_clear_object(&m_pBuffer); +@@ -92,7 +92,7 @@ private: + class TileBuffer + { + public: +- TileBuffer(LibreOfficeKitDocument *document = 0, ++ TileBuffer(LibreOfficeKitDocument *document = nullptr, + int columns = 0) + : m_pLOKDocument(document) + , m_nWidth(columns) +@@ -236,10 +236,10 @@ struct LOEvent + /// Constructor to instantiate an object of type `type`. + LOEvent(int type) + : m_nType(type) +- , m_pCommand(0) +- , m_pArguments(0) ++ , m_pCommand(nullptr) ++ , m_pArguments(nullptr) + , m_bNotifyWhenFinished(false) +- , m_pPath(0) ++ , m_pPath(nullptr) + , m_bEdit(false) + , m_nPartMode(0) + , m_nPart(0) +-- +2.12.0 + diff --git a/SOURCES/0293-Keep-LibreOfficeKit.hxx-compatible-with-C-03.patch b/SOURCES/0293-Keep-LibreOfficeKit.hxx-compatible-with-C-03.patch new file mode 100644 index 0000000..85b7373 --- /dev/null +++ b/SOURCES/0293-Keep-LibreOfficeKit.hxx-compatible-with-C-03.patch @@ -0,0 +1,117 @@ +From 994720658cfc4e3e82493ca5ef1859cc0b42960c Mon Sep 17 00:00:00 2001 +From: Stephan Bergmann +Date: Tue, 10 Nov 2015 11:08:30 +0100 +Subject: [PATCH 293/398] Keep LibreOfficeKit.hxx compatible with C++03 + +Change-Id: Ic2f123c9b341dbb421b766c3bba1fc56c1bfb41d +(cherry picked from commit 1cd6e2e08eba3bc55fbf6dda3cd3d19a5d95f798) +--- + compilerplugins/clang/store/nullptr.cxx | 9 +++++++++ + include/LibreOfficeKit/LibreOfficeKit.hxx | 20 ++++++++++---------- + 2 files changed, 19 insertions(+), 10 deletions(-) + +diff --git a/compilerplugins/clang/store/nullptr.cxx b/compilerplugins/clang/store/nullptr.cxx +index 528bb6aac9bc..83812d0ccd49 100644 +--- a/compilerplugins/clang/store/nullptr.cxx ++++ b/compilerplugins/clang/store/nullptr.cxx +@@ -42,6 +42,8 @@ public: + bool VisitImplicitCastExpr(CastExpr const * expr); + + private: ++ bool isInLokIncludeFile(SourceLocation spellingLocation) const; ++ + bool isFromCIncludeFile(SourceLocation spellingLocation) const; + + bool isMacroBodyExpansion(SourceLocation location) const; +@@ -134,6 +136,8 @@ bool Nullptr::VisitImplicitCastExpr(CastExpr const * expr) { + ((!compiler.getLangOpts().CPlusPlus + || isInUnoIncludeFile( + compiler.getSourceManager().getSpellingLoc(loc)) ++ || isInLokIncludeFile( ++ compiler.getSourceManager().getSpellingLoc(loc)) + || isFromCIncludeFile( + compiler.getSourceManager().getSpellingLoc(loc))) + ? "NULL" : "nullptr")); +@@ -143,6 +147,11 @@ bool Nullptr::VisitImplicitCastExpr(CastExpr const * expr) { + return true; + } + ++bool Nullptr::isInLokIncludeFile(SourceLocation spellingLocation) const { ++ return compiler.getSourceManager().getFilename(spellingLocation) ++ .startswith(SRCDIR "/include/LibreOfficeKit/"); ++} ++ + bool Nullptr::isFromCIncludeFile(SourceLocation spellingLocation) const { + return !compat::isInMainFile(compiler.getSourceManager(), spellingLocation) + && (StringRef( +diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx +index dde371ddc95b..ec48d39368e3 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.hxx ++++ b/include/LibreOfficeKit/LibreOfficeKit.hxx +@@ -47,7 +47,7 @@ public: + * @param pFormat the format to use while exporting, when omitted, then deducted from pURL's extension + * @param pFilterOptions options for the export filter, e.g. SkipImages. + */ +- inline bool saveAs(const char* pUrl, const char* pFormat = nullptr, const char* pFilterOptions = nullptr) ++ inline bool saveAs(const char* pUrl, const char* pFormat = NULL, const char* pFilterOptions = NULL) + { + return mpDoc->pClass->saveAs(mpDoc, pUrl, pFormat, pFilterOptions) != 0; + } +@@ -220,7 +220,7 @@ public: + * @param pCommand uno command to be posted to the document, like ".uno:Bold" + * @param pArguments arguments of the uno command. + */ +- inline void postUnoCommand(const char* pCommand, const char* pArguments = nullptr, bool bNotifyWhenFinished = false) ++ inline void postUnoCommand(const char* pCommand, const char* pArguments = NULL, bool bNotifyWhenFinished = false) + { + mpDoc->pClass->postUnoCommand(mpDoc, pCommand, pArguments, bNotifyWhenFinished); + } +@@ -243,7 +243,7 @@ public: + * @param pMimeType suggests the return format, for example text/plain;charset=utf-8. + * @param pUsedMimeType output parameter to inform about the determined format (suggested one or plain text). + */ +- inline char* getTextSelection(const char* pMimeType, char** pUsedMimeType = nullptr) ++ inline char* getTextSelection(const char* pMimeType, char** pUsedMimeType = NULL) + { + return mpDoc->pClass->getTextSelection(mpDoc, pMimeType, pUsedMimeType); + } +@@ -361,17 +361,17 @@ public: + * @param pUrl the URL of the document to load + * @param pFilterOptions options for the import filter, e.g. SkipImages. + */ +- inline Document* documentLoad(const char* pUrl, const char* pFilterOptions = nullptr) ++ inline Document* documentLoad(const char* pUrl, const char* pFilterOptions = NULL) + { +- LibreOfficeKitDocument* pDoc = nullptr; ++ LibreOfficeKitDocument* pDoc = NULL; + + if (LIBREOFFICEKIT_HAS(mpThis, documentLoadWithOptions)) + pDoc = mpThis->pClass->documentLoadWithOptions(mpThis, pUrl, pFilterOptions); + else + pDoc = mpThis->pClass->documentLoad(mpThis, pUrl); + +- if (pDoc == nullptr) +- return nullptr; ++ if (pDoc == NULL) ++ return NULL; + + return new Document(pDoc); + } +@@ -405,11 +405,11 @@ public: + }; + + /// Factory method to create a lok::Office instance. +-inline Office* lok_cpp_init(const char* pInstallPath, const char* pUserProfilePath = nullptr) ++inline Office* lok_cpp_init(const char* pInstallPath, const char* pUserProfilePath = NULL) + { + LibreOfficeKit* pThis = lok_init_2(pInstallPath, pUserProfilePath); +- if (pThis == nullptr || pThis->pClass->nSize == 0) +- return nullptr; ++ if (pThis == NULL || pThis->pClass->nSize == 0) ++ return NULL; + return new ::lok::Office(pThis); + } + +-- +2.12.0 + diff --git a/SOURCES/0294-Add-a-check-for-non-LIBO_INTERNAL_ONLY-C-03-compatib.patch b/SOURCES/0294-Add-a-check-for-non-LIBO_INTERNAL_ONLY-C-03-compatib.patch new file mode 100644 index 0000000..f8129b0 --- /dev/null +++ b/SOURCES/0294-Add-a-check-for-non-LIBO_INTERNAL_ONLY-C-03-compatib.patch @@ -0,0 +1,96 @@ +From 2ad707f0ab106b238369f9810949f290ab6b9b89 Mon Sep 17 00:00:00 2001 +From: Stephan Bergmann +Date: Tue, 10 Nov 2015 13:20:42 +0100 +Subject: [PATCH 294/398] Add a check for non-LIBO_INTERNAL_ONLY, + C++03-compatible LibreOfficeKit.hxx + +Change-Id: I56336b8163de48e424526f5f426c2ad350292627 +(cherry picked from commit b17ca2d4782cea3f4d8576ed29c8760e79fb3a26) +--- + .../CppunitTest_libreofficekit_checkapi.mk | 28 ++++++++++++++++++++++ + libreofficekit/Module_libreofficekit.mk | 4 ++++ + libreofficekit/qa/unit/checkapi.cxx | 22 +++++++++++++++++ + 3 files changed, 54 insertions(+) + create mode 100644 libreofficekit/CppunitTest_libreofficekit_checkapi.mk + create mode 100644 libreofficekit/qa/unit/checkapi.cxx + +diff --git a/libreofficekit/CppunitTest_libreofficekit_checkapi.mk b/libreofficekit/CppunitTest_libreofficekit_checkapi.mk +new file mode 100644 +index 000000000000..600564a2ac13 +--- /dev/null ++++ b/libreofficekit/CppunitTest_libreofficekit_checkapi.mk +@@ -0,0 +1,28 @@ ++# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- ++# ++# 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/. ++# ++ ++$(eval $(call gb_CppunitTest_CppunitTest,libreofficekit_checkapi)) ++ ++$(eval $(call gb_CppunitTest_add_cxxflags,libreofficekit_checkapi, \ ++ $(gb_CXX03FLAGS) \ ++)) ++ ++$(eval $(call gb_CppunitTest_add_exception_objects,libreofficekit_checkapi, \ ++ libreofficekit/qa/unit/checkapi \ ++)) ++ ++$(eval $(call gb_CppunitTest_set_external_code,libreofficekit_checkapi)) ++ ++ifeq ($(OS),LINUX) ++$(eval $(call gb_CppunitTest_add_libs,libreofficekit_checkapi, \ ++ -ldl \ ++)) ++endif ++ ++# vim: set noet sw=4 ts=4: +diff --git a/libreofficekit/Module_libreofficekit.mk b/libreofficekit/Module_libreofficekit.mk +index 7d1c5ead764e..70cf40b6384e 100644 +--- a/libreofficekit/Module_libreofficekit.mk ++++ b/libreofficekit/Module_libreofficekit.mk +@@ -11,6 +11,10 @@ $(eval $(call gb_Module_Module,libreofficekit)) + + ifeq ($(OS), $(filter LINUX %BSD SOLARIS, $(OS))) + ++$(eval $(call gb_Module_add_check_targets,libreofficekit, \ ++ CppunitTest_libreofficekit_checkapi \ ++)) ++ + $(eval $(call gb_Module_add_subsequentcheck_targets,libreofficekit,\ + CppunitTest_libreofficekit_tiledrendering \ + )) +diff --git a/libreofficekit/qa/unit/checkapi.cxx b/libreofficekit/qa/unit/checkapi.cxx +new file mode 100644 +index 000000000000..acf00e0b9cb1 +--- /dev/null ++++ b/libreofficekit/qa/unit/checkapi.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/. ++ */ ++ ++#if defined LIBO_INTERNAL_ONLY ++#error Build system problem; LIBO_INTERNAL_ONLY should not be defined here ++#endif ++ ++#include ++ ++#include ++#include ++#include ++ ++CPPUNIT_PLUGIN_IMPLEMENT(); ++ ++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +-- +2.12.0 + diff --git a/SOURCES/0295-Missing-include-for-NULL.patch b/SOURCES/0295-Missing-include-for-NULL.patch new file mode 100644 index 0000000..4c47a77 --- /dev/null +++ b/SOURCES/0295-Missing-include-for-NULL.patch @@ -0,0 +1,27 @@ +From 8a40934a0202b40d4f690fdbe4c0ac28591c8160 Mon Sep 17 00:00:00 2001 +From: Stephan Bergmann +Date: Tue, 10 Nov 2015 13:21:28 +0100 +Subject: [PATCH 295/398] Missing include (for NULL) + +Change-Id: I26e448de315b56f36cfeb74a66c0db6a9148d9b0 +(cherry picked from commit 37968fd404ca04333502921e5560f893c7933888) +--- + include/LibreOfficeKit/LibreOfficeKit.hxx | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx +index ec48d39368e3..601d3bc147a5 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.hxx ++++ b/include/LibreOfficeKit/LibreOfficeKit.hxx +@@ -10,6 +10,8 @@ + #ifndef INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKIT_HXX + #define INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKIT_HXX + ++#include ++ + #include "LibreOfficeKit.h" + #include "LibreOfficeKitInit.h" + +-- +2.12.0 + diff --git a/SOURCES/0296-gtktiledviewer-don-t-hide-cursor-after-doc-size-chan.patch b/SOURCES/0296-gtktiledviewer-don-t-hide-cursor-after-doc-size-chan.patch new file mode 100644 index 0000000..4e23372 --- /dev/null +++ b/SOURCES/0296-gtktiledviewer-don-t-hide-cursor-after-doc-size-chan.patch @@ -0,0 +1,35 @@ +From 14e285cf0738a3633812028fddffadcdc7e22e2e Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 10 Nov 2015 09:59:36 +0100 +Subject: [PATCH 296/398] gtktiledviewer: don't hide cursor after doc size + changed + +Unconditional call to lok_doc_view_reset_view() resulted in hiding the +cursor, but then nothing enabled it. As a result, the cursor got hidden +after the doc size changed. + +Change-Id: I06e7c9293e7a4cdbc73421a82430816ab0001f90 +(cherry picked from commit 7a87e9718ce8b455c0780ef7606b1c219bf228b5) +--- + libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 3f57b5c6c6b9..c96ba95e7d99 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -827,8 +827,10 @@ static void changePart( GtkWidget* pSelector, gpointer /* pItem */ ) + TiledWindow& rWindow = lcl_getTiledWindow(pSelector); + + if (rWindow.m_bPartSelectorBroadcast && rWindow.m_pDocView) ++ { + lok_doc_view_set_part( LOK_DOC_VIEW(rWindow.m_pDocView), nPart ); +- lok_doc_view_reset_view(LOK_DOC_VIEW(rWindow.m_pDocView)); ++ lok_doc_view_reset_view(LOK_DOC_VIEW(rWindow.m_pDocView)); ++ } + } + + static void removeChildrenFromStatusbar(GtkWidget* children, gpointer pData) +-- +2.12.0 + diff --git a/SOURCES/0297-sw-lok-fix-width-of-the-notes-sidebar.patch b/SOURCES/0297-sw-lok-fix-width-of-the-notes-sidebar.patch new file mode 100644 index 0000000..2616e27 --- /dev/null +++ b/SOURCES/0297-sw-lok-fix-width-of-the-notes-sidebar.patch @@ -0,0 +1,50 @@ +From b2abef914624cfb7d0fd5f75d098fe37cabaf3d6 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 10 Nov 2015 14:08:26 +0100 +Subject: [PATCH 297/398] sw lok: fix width of the notes sidebar + +The map mode is in general disabled during tiled rendering, so mouse +positions can be sent in using twips, but here we have to temporarily +enable it, otherwise the width will be returned always in pixels. + +With this, the gray background of the sidebar has the proper width, not +e.g. fifteenth of the expected value (using default zoom). + +Change-Id: I4380ee0ba6bcda97cf71735161dbdc826e7a2532 +(cherry picked from commit 6c3dbdbccbcccf914360dac1167599c5b89446a8) +--- + sw/source/uibase/docvw/PostItMgr.cxx | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx +index 35152d05d242..2310dd64f4de 100644 +--- a/sw/source/uibase/docvw/PostItMgr.cxx ++++ b/sw/source/uibase/docvw/PostItMgr.cxx +@@ -74,6 +74,7 @@ + + #include + #include ++#include + + #include "annotsh.hxx" + #include "swabstdlg.hxx" +@@ -1813,7 +1814,15 @@ unsigned long SwPostItMgr::GetSidebarWidth(bool bPx) const + if (bPx) + return aWidth; + else +- return mpEditWin->PixelToLogic(Size( aWidth ,0)).Width(); ++ { ++ bool bEnableMapMode = comphelper::LibreOfficeKit::isActive() && !mpEditWin->IsMapModeEnabled(); ++ if (bEnableMapMode) ++ mpEditWin->EnableMapMode(); ++ long nRet = mpEditWin->PixelToLogic(Size(aWidth, 0)).Width(); ++ if (bEnableMapMode) ++ mpEditWin->EnableMapMode(false); ++ return nRet; ++ } + } + + unsigned long SwPostItMgr::GetSidebarBorderWidth(bool bPx) const +-- +2.12.0 + diff --git a/SOURCES/0298-Avoid-Werror-pedantic-when-building-CppunitTest_libr.patch b/SOURCES/0298-Avoid-Werror-pedantic-when-building-CppunitTest_libr.patch new file mode 100644 index 0000000..8774a97 --- /dev/null +++ b/SOURCES/0298-Avoid-Werror-pedantic-when-building-CppunitTest_libr.patch @@ -0,0 +1,33 @@ +From f351aa3ba01945a3219cf4fb0cbb7de01a415dab Mon Sep 17 00:00:00 2001 +From: Stephan Bergmann +Date: Tue, 10 Nov 2015 14:21:29 +0100 +Subject: [PATCH 298/398] Avoid -Werror=pedantic when building + CppunitTest_libreofficekit_checkapi + +...at least the Linux-deb-x86_64@56-lhm-ubuntu-trusty tinderbox complains that + +> include/LibreOfficeKit/LibreOfficeKitInit.h:223:77: error: ISO C++ forbids casting between pointer-to-function and pointer-to-object [-Werror=pedantic] +> pSym2 = (LokHookFunction2 *) lok_dlsym(dlhandle, "libreofficekit_hook_2"); + +Change-Id: Ibd75a44fcc7da35ea32bde3fd2a300a16493789f +(cherry picked from commit d5f19eb658d8b20619f5591f6de824741e348910) +--- + solenv/gbuild/platform/com_GCC_defs.mk | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/solenv/gbuild/platform/com_GCC_defs.mk b/solenv/gbuild/platform/com_GCC_defs.mk +index a062d8c33e77..05ffd91780cf 100644 +--- a/solenv/gbuild/platform/com_GCC_defs.mk ++++ b/solenv/gbuild/platform/com_GCC_defs.mk +@@ -119,7 +119,7 @@ ifeq ($(COM_GCC_IS_CLANG),TRUE) + gb_CXX03FLAGS := -std=gnu++98 -Werror=c++11-extensions -Wno-c++11-long-long \ + -Wno-deprecated-declarations + else +-gb_CXX03FLAGS := -std=gnu++98 -pedantic-errors -Wno-long-long \ ++gb_CXX03FLAGS := -std=gnu++98 -Wno-long-long \ + -Wno-variadic-macros -Wno-non-virtual-dtor -Wno-deprecated-declarations + endif + +-- +2.12.0 + diff --git a/SOURCES/0299-sw-lok-fix-length-of-the-line-overlay-above-the-note.patch b/SOURCES/0299-sw-lok-fix-length-of-the-line-overlay-above-the-note.patch new file mode 100644 index 0000000..f4806e2 --- /dev/null +++ b/SOURCES/0299-sw-lok-fix-length-of-the-line-overlay-above-the-note.patch @@ -0,0 +1,41 @@ +From 7f5920e44431b79eb9961e9ca07b322dbaf9e8c7 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 10 Nov 2015 19:29:22 +0100 +Subject: [PATCH 299/398] sw lok: fix length of the line overlay above the + notes + +With this, e.g. a line above a note (with width of 180 px) is also 180 +px, not 12 px. + +Change-Id: I7c4eeda1bc904242dc298013411b9671ba0f2149 +(cherry picked from commit 096408073c2de484cba3736d13b57d22b7f48775) +--- + sw/source/uibase/docvw/SidebarWin.cxx | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx +index e3e238715365..4975513ffc34 100644 +--- a/sw/source/uibase/docvw/SidebarWin.cxx ++++ b/sw/source/uibase/docvw/SidebarWin.cxx +@@ -606,6 +606,18 @@ void SwSidebarWin::SetPosAndSize() + break; + } + ++ // LOK has map mode disabled, and we still want to perform pixel -> ++ // twips conversion for the size of the line above the note. ++ bool bEnableMapMode = comphelper::LibreOfficeKit::isActive() && !EditWin().IsMapModeEnabled(); ++ if (bEnableMapMode) ++ EditWin().EnableMapMode(); ++ Size aSize(aLineEnd.getX() - aLineStart.getX(), aLineEnd.getY() - aLineStart.getY()); ++ aSize = EditWin().PixelToLogic(aSize); ++ aLineEnd = aLineStart; ++ aLineEnd.Move(aSize.getWidth(), aSize.getHeight()); ++ if (bEnableMapMode) ++ EditWin().EnableMapMode(false); ++ + if (!IsPreview()) + { + if (mpAnchor) +-- +2.12.0 + diff --git a/SOURCES/0300-This-PixelToLogic-call-can-be-conditional-in-SwSideb.patch b/SOURCES/0300-This-PixelToLogic-call-can-be-conditional-in-SwSideb.patch new file mode 100644 index 0000000..aa15075 --- /dev/null +++ b/SOURCES/0300-This-PixelToLogic-call-can-be-conditional-in-SwSideb.patch @@ -0,0 +1,44 @@ +From d2d19cf40a111c588489876038cb5e5c23908175 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 10 Nov 2015 20:08:49 +0100 +Subject: [PATCH 300/398] This PixelToLogic() call can be conditional in + SwSidebarWin::SetPosAndSize() + +It is only needed when tiled rendering. + +Change-Id: Ie1668f5f3d4d17abc212e2262a6c155dcb855d2e +(cherry picked from commit 88f4866803fc766503292252cb36af4a70ea98fd) +--- + sw/source/uibase/docvw/SidebarWin.cxx | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx +index 4975513ffc34..202a96767a39 100644 +--- a/sw/source/uibase/docvw/SidebarWin.cxx ++++ b/sw/source/uibase/docvw/SidebarWin.cxx +@@ -608,15 +608,15 @@ void SwSidebarWin::SetPosAndSize() + + // LOK has map mode disabled, and we still want to perform pixel -> + // twips conversion for the size of the line above the note. +- bool bEnableMapMode = comphelper::LibreOfficeKit::isActive() && !EditWin().IsMapModeEnabled(); +- if (bEnableMapMode) ++ if (comphelper::LibreOfficeKit::isActive() && !EditWin().IsMapModeEnabled()) ++ { + EditWin().EnableMapMode(); +- Size aSize(aLineEnd.getX() - aLineStart.getX(), aLineEnd.getY() - aLineStart.getY()); +- aSize = EditWin().PixelToLogic(aSize); +- aLineEnd = aLineStart; +- aLineEnd.Move(aSize.getWidth(), aSize.getHeight()); +- if (bEnableMapMode) ++ Size aSize(aLineEnd.getX() - aLineStart.getX(), aLineEnd.getY() - aLineStart.getY()); ++ aSize = EditWin().PixelToLogic(aSize); ++ aLineEnd = aLineStart; ++ aLineEnd.Move(aSize.getWidth(), aSize.getHeight()); + EditWin().EnableMapMode(false); ++ } + + if (!IsPreview()) + { +-- +2.12.0 + diff --git a/SOURCES/0301-sd-lok-ccu-1295-force-async-image-swap.patch b/SOURCES/0301-sd-lok-ccu-1295-force-async-image-swap.patch new file mode 100644 index 0000000..48d2311 --- /dev/null +++ b/SOURCES/0301-sd-lok-ccu-1295-force-async-image-swap.patch @@ -0,0 +1,51 @@ +From a181b9e9cf669742278668dc66d6296d506962cf Mon Sep 17 00:00:00 2001 +From: Andrzej Hunt +Date: Tue, 10 Nov 2015 19:45:13 +0100 +Subject: [PATCH 301/398] sd lok: ccu#1295 force async image swap + +This helps ensure that images are swapped in when we actually +render tiles. Previously we'd sometimes have placeholders +instead of the image, which results in either an invalidate +(+rerender of that tile) once the image is swapped in (for +normal tiles) or a permanently missing image in the preview tiles. + +Change-Id: I1a16a913faf9fad20e40a5d1aad3de187038c7a2 +Reviewed-on: https://gerrit.libreoffice.org/19890 +Reviewed-by: Andrzej Hunt +Tested-by: Andrzej Hunt +(cherry picked from commit 9125dbaf5db5bfb07f93be2cfedf43452a28ae32) +--- + sd/source/ui/unoidl/unomodel.cxx | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx +index d2c6b5e37603..9475ff56c505 100644 +--- a/sd/source/ui/unoidl/unomodel.cxx ++++ b/sd/source/ui/unoidl/unomodel.cxx +@@ -2380,14 +2380,21 @@ void SdXImpressDocument::initializeForTiledRendering() + + mpDoc->setTiledRendering(true); + +- // Disable map mode, so that it's possible to send mouse event coordinates +- // in logic units. + if (DrawViewShell* pViewShell = GetViewShell()) + { ++ // Disable map mode, so that it's possible to send mouse event coordinates ++ // in logic units. + if (sd::Window* pWindow = pViewShell->GetActiveWindow()) + { + pWindow->EnableMapMode(false); + } ++ ++ // Forces all images to be swapped in synchronously, this ++ // ensures that images are available when paintTile is called ++ // (whereas with async loading images start being loaded after ++ // we have painted the tile, resulting in an invalidate, followed ++ // by the tile being rerendered - which is wasteful and ugly). ++ pViewShell->GetDrawView()->SetSwapAsynchron(false); + } + // tdf#93154: in tiled rendering LO doesn't always detect changes + SvtMiscOptions aMiscOpt; +-- +2.12.0 + diff --git a/SOURCES/0302-Implement-LOK_CALLBACK_MOUSE_POINTER.patch b/SOURCES/0302-Implement-LOK_CALLBACK_MOUSE_POINTER.patch new file mode 100644 index 0000000..c29e1b2 --- /dev/null +++ b/SOURCES/0302-Implement-LOK_CALLBACK_MOUSE_POINTER.patch @@ -0,0 +1,273 @@ +From d9ec8bc53bdd81ba9ef71fdd3783522f9fd6c8f8 Mon Sep 17 00:00:00 2001 +From: Andrzej Hunt +Date: Wed, 11 Nov 2015 10:05:25 +0100 +Subject: [PATCH 302/398] Implement LOK_CALLBACK_MOUSE_POINTER + +Change-Id: I8d1f63208baf277b0a9d15908f3ea7ff3b56bf10 +Reviewed-on: https://gerrit.libreoffice.org/19883 +Reviewed-by: Andrzej Hunt +Tested-by: Andrzej Hunt +(cherry picked from commit 81b8ca683d44ba9c37f2dc8c74470a86ce70513f) +--- + desktop/source/lib/init.cxx | 69 ++++++++++++++++++++++++++++ + include/LibreOfficeKit/LibreOfficeKitEnums.h | 9 +++- + include/vcl/ITiledRenderable.hxx | 3 ++ + sc/inc/docuno.hxx | 3 ++ + sc/source/ui/unoobj/docuno.cxx | 15 ++++++ + sd/source/ui/inc/unomodel.hxx | 2 + + sd/source/ui/unoidl/unomodel.cxx | 14 ++++++ + sw/inc/unotxdoc.hxx | 2 + + sw/source/uibase/uno/unotxdoc.cxx | 11 +++++ + 9 files changed, 127 insertions(+), 1 deletion(-) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 2e6e7e73df1a..ddd7859426e7 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -65,6 +65,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -173,6 +174,58 @@ static const ExtensionMap aDrawExtensionMap[] = + { NULL, NULL } + }; + ++/* ++ * Map directly to css cursor styles to avoid further mapping in the client. ++ * Gtk (via gdk_cursor_new_from_name) also supports the same css cursor styles. ++ * ++ * This was created partially with help of the mappings in gtkdata.cxx. ++ * The list is incomplete as some cursor style simply aren't supported ++ * by css, it might turn out to be worth mapping some of these missing cursors ++ * to available cursors? ++ */ ++static const std::map aPointerMap { ++ { PointerStyle::Arrow, "default" }, ++ // PointerStyle::Null ? ++ { PointerStyle::Wait, "wait" }, ++ { PointerStyle::Text, "text" }, ++ { PointerStyle::Help, "help" }, ++ { PointerStyle::Cross, "crosshair" }, ++ { PointerStyle::Move, "move" }, ++ { PointerStyle::NSize, "n-resize" }, ++ { PointerStyle::SSize, "s-resize" }, ++ { PointerStyle::WSize, "w-resize" }, ++ { PointerStyle::ESize, "e-resize" }, ++ { PointerStyle::NWSize, "ne-resize" }, ++ { PointerStyle::NESize, "ne-resize" }, ++ { PointerStyle::SWSize, "sw-resize" }, ++ { PointerStyle::SESize, "se-resize" }, ++ // WindowNSize through WindowSESize ++ { PointerStyle::HSplit, "col-resize" }, ++ { PointerStyle::VSplit, "row-resize" }, ++ { PointerStyle::HSizeBar, "col-resize" }, ++ { PointerStyle::VSizeBar, "row-resize" }, ++ { PointerStyle::Hand, "grab" }, ++ { PointerStyle::RefHand, "grabbing" }, ++ // Pen, Magnify, Fill, Rotate ++ // HShear, VShear ++ // Mirror, Crook, Crop, MovePoint, MoveBezierWeight ++ // MoveData ++ { PointerStyle::CopyData, "copy" }, ++ { PointerStyle::LinkData, "alias" }, ++ // MoveDataLink, CopyDataLink ++ //MoveFile, CopyFile, LinkFile ++ // MoveFileLink, CopyFileLink, MoveFiless, CopyFiles ++ { PointerStyle::NotAllowed, "not-allowed" }, ++ // DrawLine through DrawCaption ++ // Chart, Detective, PivotCol, PivotRow, PivotField, Chain, ChainNotAllowed ++ // TimeEventMove, TimeEventSize ++ // AutoScrollN through AutoScrollNSWE ++ // Airbrush ++ { PointerStyle::TextVertical, "vertical-text" } ++ // Pivot Delete, TabSelectS through TabSelectSW ++ // PaintBrush, HideWhiteSpace, ShowWhiteSpace ++}; ++ + static OUString getUString(const char* pString) + { + if (pString == NULL) +@@ -1039,6 +1092,22 @@ static void doc_postMouseEvent(LibreOfficeKitDocument* pThis, int nType, int nX, + } + + pDoc->postMouseEvent(nType, nX, nY, nCount, nButtons, nModifier); ++ ++ Pointer aPointer = pDoc->getPointer(); ++ ++ // We don't map all possible pointers hence we need a default ++ OString aPointerString = "default"; ++ auto aIt = aPointerMap.find(aPointer.GetStyle()); ++ if (aIt != aPointerMap.end()) ++ { ++ aPointerString = aIt->second; ++ } ++ ++ LibLODocument_Impl* pLib = static_cast(pThis); ++ if (pLib->mpCallback && pLib->mpCallbackData) ++ { ++ pLib->mpCallback(LOK_CALLBACK_MOUSE_POINTER, aPointerString.getStr(), pLib->mpCallbackData); ++ } + } + + static void doc_setTextSelection(LibreOfficeKitDocument* pThis, int nType, int nX, int nY) +diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h +index bf6267585a0a..37837ea49b86 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h ++++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h +@@ -202,7 +202,14 @@ typedef enum + * + * Rectangle format is the same as LOK_CALLBACK_INVALIDATE_TILES. + */ +- LOK_CALLBACK_CELL_CURSOR ++ LOK_CALLBACK_CELL_CURSOR, ++ ++ /** ++ * The current mouse pointer style. ++ * ++ * Payload is a css mouse pointer style. ++ */ ++ LOK_CALLBACK_MOUSE_POINTER + } + LibreOfficeKitCallbackType; + +diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx +index 963f1fc7054a..bf0aa55e32a6 100644 +--- a/include/vcl/ITiledRenderable.hxx ++++ b/include/vcl/ITiledRenderable.hxx +@@ -14,6 +14,7 @@ + #define LOK_USE_UNSTABLE_API + #include + #include ++#include + #include + + namespace vcl +@@ -171,6 +172,8 @@ public: + return OString(); + } + ++ virtual Pointer getPointer() = 0; ++ + /// Sets the clipboard of the component. + virtual void setClipboard(const css::uno::Reference& xClipboard) = 0; + +diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx +index 70f61ca03548..b73eb12704be 100644 +--- a/sc/inc/docuno.hxx ++++ b/sc/inc/docuno.hxx +@@ -430,6 +430,9 @@ public: + int nOutputHeight, + long nTileWidth, + long nTileHeight ) override; ++ ++ /// @see vcl::ITiledRenderable::getPointer(). ++ virtual Pointer getPointer() override; + }; + + class ScDrawPagesObj : public cppu::WeakImplHelper2< +diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx +index 66794f3c6f27..0e5396e5910e 100644 +--- a/sc/source/ui/unoobj/docuno.cxx ++++ b/sc/source/ui/unoobj/docuno.cxx +@@ -903,6 +903,21 @@ OString ScModelObj::getCellCursor( int nOutputWidth, int nOutputHeight, + return "{ \"commandName\": \".uno:CellCursor\", \"commandValues\": \"" + pGridWindow->getCellCursor( nOutputWidth, nOutputHeight, nTileWidth, nTileHeight ) + "\" }"; + } + ++Pointer ScModelObj::getPointer() ++{ ++ SolarMutexGuard aGuard; ++ ++ ScViewData* pViewData = ScDocShell::GetViewData(); ++ if (!pViewData) ++ return Pointer(); ++ ++ ScGridWindow* pGridWindow = pViewData->GetActiveWin(); ++ if (!pGridWindow) ++ return Pointer(); ++ ++ return pGridWindow->GetPointer(); ++} ++ + void ScModelObj::initializeForTiledRendering() + { + SolarMutexGuard aGuard; +diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx +index 8178aab1f1fa..1c444dd478bf 100644 +--- a/sd/source/ui/inc/unomodel.hxx ++++ b/sd/source/ui/inc/unomodel.hxx +@@ -262,6 +262,8 @@ public: + virtual void setClipboard(const css::uno::Reference& xClipboard) override; + /// @see vcl::ITiledRenderable::isMimeTypeSupported(). + virtual bool isMimeTypeSupported() override; ++ /// @see vcl::ITiledRenderable::getPointer(). ++ virtual Pointer getPointer() override; + + // XComponent + +diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx +index 9475ff56c505..28ca11878044 100644 +--- a/sd/source/ui/unoidl/unomodel.cxx ++++ b/sd/source/ui/unoidl/unomodel.cxx +@@ -2568,6 +2568,20 @@ bool SdXImpressDocument::isMimeTypeSupported() + return EditEngine::HasValidData(aDataHelper.GetTransferable()); + } + ++Pointer SdXImpressDocument::getPointer() ++{ ++ SolarMutexGuard aGuard; ++ DrawViewShell* pViewShell = GetViewShell(); ++ if (!pViewShell) ++ return Pointer(); ++ ++ Window* pWindow = pViewShell->GetActiveWindow(); ++ if (!pWindow) ++ return Pointer(); ++ ++ return pWindow->GetPointer(); ++} ++ + uno::Reference< i18n::XForbiddenCharacters > SdXImpressDocument::getForbiddenCharsTable() + { + uno::Reference< i18n::XForbiddenCharacters > xForb(mxForbidenCharacters); +diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx +index 85605d56c60f..e8cb116bb671 100644 +--- a/sw/inc/unotxdoc.hxx ++++ b/sw/inc/unotxdoc.hxx +@@ -438,6 +438,8 @@ public: + virtual void setClipboard(const css::uno::Reference& xClipboard) override; + /// @see vcl::ITiledRenderable::isMimeTypeSupported(). + virtual bool isMimeTypeSupported() override; ++ /// @see vcl::ITiledRenderable::getPointer(). ++ virtual Pointer getPointer() override; + + // ::com::sun::star::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 ) throw (::css::uno::RuntimeException, ::std::exception) SAL_OVERRIDE; +diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx +index 4de023d1275c..53bb2506928b 100644 +--- a/sw/source/uibase/uno/unotxdoc.cxx ++++ b/sw/source/uibase/uno/unotxdoc.cxx +@@ -3214,6 +3214,17 @@ bool SwXTextDocument::isMimeTypeSupported() + return aDataHelper.GetXTransferable().is() && SwTransferable::IsPaste(*pWrtShell, aDataHelper); + } + ++Pointer SwXTextDocument::getPointer() ++{ ++ SolarMutexGuard aGuard; ++ ++ SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); ++ if (!pWrtShell) ++ return Pointer(); ++ ++ return pWrtShell->GetView().GetEditWin().GetPointer(); ++} ++ + int SwXTextDocument::getPart() + { + SolarMutexGuard aGuard; +-- +2.12.0 + diff --git a/SOURCES/0303-lokdocview-support-LOK_CALLBACK_MOUSE_POINTER.patch b/SOURCES/0303-lokdocview-support-LOK_CALLBACK_MOUSE_POINTER.patch new file mode 100644 index 0000000..688368c --- /dev/null +++ b/SOURCES/0303-lokdocview-support-LOK_CALLBACK_MOUSE_POINTER.patch @@ -0,0 +1,46 @@ +From b077183a4d3005427949a6b60fa8aafda4d088c8 Mon Sep 17 00:00:00 2001 +From: Andrzej Hunt +Date: Tue, 10 Nov 2015 11:40:41 +0100 +Subject: [PATCH 303/398] lokdocview: support LOK_CALLBACK_MOUSE_POINTER + +Change-Id: I2052e39fa2e25988a40f293389d5a183a625acd4 +Reviewed-on: https://gerrit.libreoffice.org/19903 +Reviewed-by: Andrzej Hunt +Tested-by: Andrzej Hunt +(cherry picked from commit cc920bc27a0c37233d65ee1b20712e3ac6896c9a) +--- + libreofficekit/source/gtk/lokdocview.cxx | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 0d1dec1ddb05..687323d6ca11 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -282,6 +282,8 @@ callbackTypeToString (int nType) + return "LOK_CALLBACK_CELL_CURSOR"; + case LOK_CALLBACK_HYPERLINK_CLICKED: + return "LOK_CALLBACK_HYPERLINK_CLICKED"; ++ case LOK_CALLBACK_MOUSE_POINTER: ++ return "LOK_CALLBACK_MOUSE_POINTER"; + case LOK_CALLBACK_STATE_CHANGED: + return "LOK_CALLBACK_STATE_CHANGED"; + case LOK_CALLBACK_STATUS_INDICATOR_START: +@@ -736,6 +738,15 @@ callback (gpointer pData) + priv->m_bCursorVisible = pCallback->m_aPayload == "true"; + } + break; ++ case LOK_CALLBACK_MOUSE_POINTER: ++ { ++ // The gtk docs claim that most css cursors should be supported, however ++ // on my system at least this is not true and many cursors are unsupported. ++ // In this case pCursor = null, which results in the default cursor being set. ++ GdkCursor* pCursor = gdk_cursor_new_from_name(gtk_widget_get_display(GTK_WIDGET(pDocView)), pCallback->m_aPayload.c_str()); ++ gdk_window_set_cursor(gtk_widget_get_window(GTK_WIDGET(pDocView)), pCursor); ++ } ++ break; + case LOK_CALLBACK_GRAPHIC_SELECTION: + { + if (pCallback->m_aPayload != "EMPTY") +-- +2.12.0 + diff --git a/SOURCES/0304-sw-lok-fix-sidebarwindows-SwSidebarWin-pixel-positio.patch b/SOURCES/0304-sw-lok-fix-sidebarwindows-SwSidebarWin-pixel-positio.patch new file mode 100644 index 0000000..7e6f673 --- /dev/null +++ b/SOURCES/0304-sw-lok-fix-sidebarwindows-SwSidebarWin-pixel-positio.patch @@ -0,0 +1,61 @@ +From 2d49f2112eacd2e65405505ccabf8d6b8d4c94ab Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Wed, 11 Nov 2015 18:05:45 +0100 +Subject: [PATCH 304/398] sw lok: fix sidebarwindows::SwSidebarWin pixel + position + +So SwSidebarWin member functions don't get twip values when they call +GetPosPixel(). + +Change-Id: Ied4ff7f49d0320766b045d78f731900af92d37ef +(cherry picked from commit c4ef30ea916752ba5a057b49960a60a55f70c84c) +--- + sw/source/uibase/docvw/PostItMgr.cxx | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx +index 2310dd64f4de..2a2e5d596056 100644 +--- a/sw/source/uibase/docvw/PostItMgr.cxx ++++ b/sw/source/uibase/docvw/PostItMgr.cxx +@@ -593,6 +593,10 @@ void SwPostItMgr::PreparePageContainer() + + void SwPostItMgr::LayoutPostIts() + { ++ bool bEnableMapMode = comphelper::LibreOfficeKit::isActive() && !mpEditWin->IsMapModeEnabled(); ++ if (bEnableMapMode) ++ mpEditWin->EnableMapMode(); ++ + if ( !mvPostItFields.empty() && !mbWaitingForCalcRects ) + { + mbLayouting = true; +@@ -809,6 +813,9 @@ void SwPostItMgr::LayoutPostIts() + + mbLayouting = false; + } ++ ++ if (bEnableMapMode) ++ mpEditWin->EnableMapMode(false); + } + + bool SwPostItMgr::BorderOverPageBorder(unsigned long aPage) const +@@ -856,6 +863,8 @@ void SwPostItMgr::PaintTile(OutputDevice& rRenderContext, const Rectangle& /*rRe + if (!pPostIt) + continue; + ++ bool bEnableMapMode = !mpEditWin->IsMapModeEnabled(); ++ mpEditWin->EnableMapMode(); + rRenderContext.Push(PushFlags::MAPMODE); + Point aOffset(mpEditWin->PixelToLogic(pPostIt->GetPosPixel())); + MapMode aMapMode(rRenderContext.GetMapMode()); +@@ -867,6 +876,8 @@ void SwPostItMgr::PaintTile(OutputDevice& rRenderContext, const Rectangle& /*rRe + pPostIt->PaintTile(rRenderContext, aRectangle); + + rRenderContext.Pop(); ++ if (bEnableMapMode) ++ mpEditWin->EnableMapMode(false); + } + } + +-- +2.12.0 + diff --git a/SOURCES/0305-lok-add-Clear-formatting-to-getStyles.patch b/SOURCES/0305-lok-add-Clear-formatting-to-getStyles.patch new file mode 100644 index 0000000..af06bb5 --- /dev/null +++ b/SOURCES/0305-lok-add-Clear-formatting-to-getStyles.patch @@ -0,0 +1,84 @@ +From 9b04a64c64b30faab0cec6c552589940181a4fa1 Mon Sep 17 00:00:00 2001 +From: Andrzej Hunt +Date: Wed, 11 Nov 2015 17:09:47 +0100 +Subject: [PATCH 305/398] lok: add Clear formatting to getStyles() + +This requires client-side support too. + +Change-Id: I5197ed3ed2b8244b50f7faf84a1cadde6a61b2cb +Reviewed-on: https://gerrit.libreoffice.org/19917 +Reviewed-by: Andrzej Hunt +Tested-by: Andrzej Hunt +(cherry picked from commit 0b5991e4862501f0fa8e34f1b403aca40e51436f) +--- + desktop/Library_sofficeapp.mk | 1 + + desktop/qa/desktop_lib/test_desktop_lib.cxx | 8 ++++++-- + desktop/source/lib/init.cxx | 8 ++++++++ + 3 files changed, 15 insertions(+), 2 deletions(-) + +diff --git a/desktop/Library_sofficeapp.mk b/desktop/Library_sofficeapp.mk +index fb73cfa78f4b..f0c99eee6078 100644 +--- a/desktop/Library_sofficeapp.mk ++++ b/desktop/Library_sofficeapp.mk +@@ -52,6 +52,7 @@ $(eval $(call gb_Library_use_libraries,sofficeapp,\ + sb \ + sfx \ + svl \ ++ svxcore \ + svt \ + tk \ + tl \ +diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx +index df803c4bdaf0..83bd5ac620b4 100644 +--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx ++++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx +@@ -181,14 +181,18 @@ void DesktopLOKTest::testGetStyles() + CPPUNIT_ASSERT( aValues.size() > 0 ); + for (const std::pair& rPair : aValues) + { +- CPPUNIT_ASSERT( rPair.second.size() > 0); ++ if( rPair.first != "ClearStyle") ++ { ++ CPPUNIT_ASSERT( rPair.second.size() > 0); ++ } + if (rPair.first != "CharacterStyles" && + rPair.first != "ParagraphStyles" && + rPair.first != "FrameStyles" && + rPair.first != "PageStyles" && + rPair.first != "NumberingStyles" && + rPair.first != "CellStyles" && +- rPair.first != "ShapeStyles") ++ rPair.first != "ShapeStyles" && ++ rPair.first != "ClearStyle") + { + CPPUNIT_FAIL("Unknown style family: " + rPair.first); + } +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index ddd7859426e7..b7459e03244c 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -58,6 +58,8 @@ + #include + #include + #include ++#include ++#include + #include + #include + #include +@@ -1265,6 +1267,12 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand) + } + aValues.add_child(sStyleFam.toUtf8().getStr(), aChildren); + } ++ ++ boost::property_tree::ptree aChildClearFormat; ++ OUString sClearFormat = SVX_RESSTR( RID_SVXSTR_CLEARFORM ); ++ aChildClearFormat.put("", sClearFormat.toUtf8()); ++ aValues.add_child("ClearStyle", aChildClearFormat); ++ + aTree.add_child("commandValues", aValues); + std::stringstream aStream; + boost::property_tree::write_json(aStream, aTree); +-- +2.12.0 + diff --git a/SOURCES/0306-lok-sw-Place-default-styles-at-top-of-style-selector.patch b/SOURCES/0306-lok-sw-Place-default-styles-at-top-of-style-selector.patch new file mode 100644 index 0000000..57b17a5 --- /dev/null +++ b/SOURCES/0306-lok-sw-Place-default-styles-at-top-of-style-selector.patch @@ -0,0 +1,72 @@ +From 9ec2ecca18e0ac62c5a9a0fcd628c6dde610e174 Mon Sep 17 00:00:00 2001 +From: Andrzej Hunt +Date: Wed, 11 Nov 2015 21:07:13 +0100 +Subject: [PATCH 306/398] lok sw: Place default styles at top of style selector + +The order/list of default styles for Writer should be hardcoded, +(by default the list contains 100+ items), it makes most sense to +place these at the start of the list, allowing the client to then +select how many styles they actually want to show. + +Change-Id: I491a426397e06b3502cee7484c5f8adfd9d9cdf2 +Reviewed-on: https://gerrit.libreoffice.org/19918 +Reviewed-by: Andrzej Hunt +Tested-by: Andrzej Hunt +(cherry picked from commit 5c6119eeaaaed322c884504a53bb558258233fe9) +--- + desktop/source/lib/init.cxx | 33 +++++++++++++++++++++++++++++++++ + 1 file changed, 33 insertions(+) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index b7459e03244c..e09ad171678e 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -1252,12 +1252,45 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand) + uno::Reference xStyleFamilies(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY); + uno::Sequence aStyleFamilies = xStyleFamilies->getElementNames(); + ++ static const sal_Char* aWriterStyles[] = ++ { ++ "Text body", ++ "Quotations", ++ "Title", ++ "Subtitle", ++ "Heading 1", ++ "Heading 2", ++ "Heading 3" ++ }; ++ + boost::property_tree::ptree aValues; + for (sal_Int32 nStyleFam = 0; nStyleFam < aStyleFamilies.getLength(); ++nStyleFam) + { + boost::property_tree::ptree aChildren; + OUString sStyleFam = aStyleFamilies[nStyleFam]; + uno::Reference xStyleFamily(xStyleFamilies->getByName(sStyleFam), uno::UNO_QUERY); ++ ++ // Writer provides a huge number of styles, we have a list of 7 "default" styles which ++ // should be shown in the normal dropdown, which we should add to the start of the list ++ // to simplify their selection. ++ if (sStyleFam == "ParagraphStyles" ++ && doc_getDocumentType(pThis) == LOK_DOCTYPE_TEXT) ++ { ++ for( sal_uInt32 nStyle = 0; nStyle < sizeof( aWriterStyles ) / sizeof( sal_Char*); ++nStyle ) ++ { ++ uno::Reference< beans::XPropertySet > xStyle; ++ xStyleFamily->getByName( OUString::createFromAscii( aWriterStyles[nStyle] )) >>= xStyle; ++ OUString sName; ++ xStyle->getPropertyValue("DisplayName") >>= sName; ++ if( !sName.isEmpty() ) ++ { ++ boost::property_tree::ptree aChild; ++ aChild.put("", sName.toUtf8()); ++ aChildren.push_back(std::make_pair("", aChild)); ++ } ++ } ++ } ++ + uno::Sequence aStyles = xStyleFamily->getElementNames(); + for (sal_Int32 nInd = 0; nInd < aStyles.getLength(); ++nInd) + { +-- +2.12.0 + diff --git a/SOURCES/0307-sw-lok-route-SwEditWin-MouseButtonDown-to-SidebarTex.patch b/SOURCES/0307-sw-lok-route-SwEditWin-MouseButtonDown-to-SidebarTex.patch new file mode 100644 index 0000000..b253ca8 --- /dev/null +++ b/SOURCES/0307-sw-lok-route-SwEditWin-MouseButtonDown-to-SidebarTex.patch @@ -0,0 +1,143 @@ +From 2770d40660412006fec7a5b0441293b89512dadf Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Thu, 12 Nov 2015 14:21:03 +0100 +Subject: [PATCH 307/398] sw lok: route SwEditWin::MouseButtonDown to + SidebarTextControl if necessary + +LOK sends all mouse events to SwEditWin, so add initial hit testing in +its mouse handler to forward the mouse events to the right VCL widget. + +(cherry picked from commit b7ecf6279ef3343f12fce776862c027bfeff6617) + +Change-Id: I67e8e19f47156261fd7c7eafd4e63f743e0c4ce9 +--- + sw/inc/PostItMgr.hxx | 6 ++++-- + sw/inc/SidebarWin.hxx | 2 ++ + sw/source/uibase/docvw/PostItMgr.cxx | 31 +++++++++++++++++++++++++++++++ + sw/source/uibase/docvw/SidebarWin.cxx | 8 ++++++++ + sw/source/uibase/docvw/edtwin.cxx | 18 +++++++++++++++++- + 5 files changed, 62 insertions(+), 3 deletions(-) + +diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx +index f306f57ba86c..4356f6daa416 100644 +--- a/sw/inc/PostItMgr.hxx ++++ b/sw/inc/PostItMgr.hxx +@@ -233,8 +233,10 @@ class SwPostItMgr: public SfxListener + Rectangle GetBottomScrollRect(const unsigned long aPage) const; + Rectangle GetTopScrollRect(const unsigned long aPage) const; + +- bool IsHit(const Point &aPointPixel); +- Color GetArrowColor(sal_uInt16 aDirection,unsigned long aPage) const; ++ bool IsHit(const Point &aPointPixel); ++ /// Get the matching window that is responsible for handling mouse events of rPointLogic, if any. ++ vcl::Window* IsHitSidebarWindow(const Point& rPointLogic); ++ Color GetArrowColor(sal_uInt16 aDirection,unsigned long aPage) const; + + sw::annotation::SwAnnotationWin* GetAnnotationWin(const SwPostItField* pField) const; + +diff --git a/sw/inc/SidebarWin.hxx b/sw/inc/SidebarWin.hxx +index d21d50d5d7d5..1eaf982ebf07 100644 +--- a/sw/inc/SidebarWin.hxx ++++ b/sw/inc/SidebarWin.hxx +@@ -179,6 +179,8 @@ class SwSidebarWin : public vcl::Window + + virtual void Draw(OutputDevice* pDev, const Point&, const Size&, sal_uLong) override; + void PaintTile(vcl::RenderContext& rRenderContext, const Rectangle& rRect); ++ /// Get the matching sub-widget inside this sidebar widget for rPointLogic, if any. ++ vcl::Window* IsHitWindow(const Point& rPointLogic); + + protected: + virtual void DataChanged( const DataChangedEvent& aEvent) SAL_OVERRIDE; +diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx +index 2a2e5d596056..eb5755e20cf9 100644 +--- a/sw/source/uibase/docvw/PostItMgr.cxx ++++ b/sw/source/uibase/docvw/PostItMgr.cxx +@@ -1706,6 +1706,37 @@ bool SwPostItMgr::IsHit(const Point &aPointPixel) + } + return false; + } ++ ++vcl::Window* SwPostItMgr::IsHitSidebarWindow(const Point& rPointLogic) ++{ ++ vcl::Window* pRet = 0; ++ ++ if (HasNotes() && ShowNotes()) ++ { ++ bool bEnableMapMode = !mpEditWin->IsMapModeEnabled(); ++ if (bEnableMapMode) ++ mpEditWin->EnableMapMode(); ++ ++ for (SwSidebarItem* pItem : mvPostItFields) ++ { ++ SwSidebarWin* pPostIt = pItem->pPostIt; ++ if (!pPostIt) ++ continue; ++ ++ if (vcl::Window* pWindow = pPostIt->IsHitWindow(rPointLogic)) ++ { ++ pRet = pWindow; ++ break; ++ } ++ } ++ ++ if (bEnableMapMode) ++ mpEditWin->EnableMapMode(false); ++ } ++ ++ return pRet; ++} ++ + Rectangle SwPostItMgr::GetBottomScrollRect(const unsigned long aPage) const + { + SwRect aPageRect = mPages[aPage-1]->mPageRect; +diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx +index 202a96767a39..87a86fbc9dc8 100644 +--- a/sw/source/uibase/docvw/SidebarWin.cxx ++++ b/sw/source/uibase/docvw/SidebarWin.cxx +@@ -280,6 +280,14 @@ void SwSidebarWin::PaintTile(vcl::RenderContext& rRenderContext, const Rectangle + rRenderContext.Push(PushFlags::NONE); + } + ++vcl::Window* SwSidebarWin::IsHitWindow(const Point& rPointLogic) ++{ ++ Rectangle aRectangleLogic(EditWin().PixelToLogic(GetPosPixel()), EditWin().PixelToLogic(GetSizePixel())); ++ if (aRectangleLogic.IsInside(rPointLogic)) ++ return mpSidebarTextControl; ++ return 0; ++} ++ + void SwSidebarWin::Draw(OutputDevice* pDev, const Point& rPt, const Size& rSz, sal_uLong nInFlags) + { + if (mpMetadataAuthor->IsVisible() ) +diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx +index f392010fb6b1..b4ed61becbfb 100644 +--- a/sw/source/uibase/docvw/edtwin.cxx ++++ b/sw/source/uibase/docvw/edtwin.cxx +@@ -2756,7 +2756,23 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) + if (m_rView.GetPostItMgr()->IsHit(rMEvt.GetPosPixel())) + return; + +- m_rView.GetPostItMgr()->SetActiveSidebarWin(0); ++ if (comphelper::LibreOfficeKit::isActive()) ++ { ++ if (vcl::Window* pWindow = m_rView.GetPostItMgr()->IsHitSidebarWindow(rMEvt.GetPosPixel())) ++ { ++ bool bDisableMapMode = pWindow->IsMapModeEnabled(); ++ if (bDisableMapMode) ++ pWindow->EnableMapMode(false); ++ ++ pWindow->MouseButtonDown(rMEvt); ++ ++ if (bDisableMapMode) ++ pWindow->EnableMapMode(); ++ return; ++ } ++ } ++ ++ m_rView.GetPostItMgr()->SetActiveSidebarWin(nullptr); + + GrabFocus(); + +-- +2.12.0 + diff --git a/SOURCES/0308-fix-build.patch b/SOURCES/0308-fix-build.patch new file mode 100644 index 0000000..580defb --- /dev/null +++ b/SOURCES/0308-fix-build.patch @@ -0,0 +1,45 @@ +From ee7c4fb2c32e306342099896c0e367c9f2d33e75 Mon Sep 17 00:00:00 2001 +From: David Tardon +Date: Mon, 20 Mar 2017 17:51:53 +0100 +Subject: [PATCH 308/398] fix build + +Change-Id: I8770c05d39e5574212461d2e48e72ed2fff6a74d +--- + sw/source/uibase/docvw/SidebarWin.cxx | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx +index 87a86fbc9dc8..575be80c0ae0 100644 +--- a/sw/source/uibase/docvw/SidebarWin.cxx ++++ b/sw/source/uibase/docvw/SidebarWin.cxx +@@ -282,7 +282,7 @@ void SwSidebarWin::PaintTile(vcl::RenderContext& rRenderContext, const Rectangle + + vcl::Window* SwSidebarWin::IsHitWindow(const Point& rPointLogic) + { +- Rectangle aRectangleLogic(EditWin().PixelToLogic(GetPosPixel()), EditWin().PixelToLogic(GetSizePixel())); ++ Rectangle aRectangleLogic(EditWin()->PixelToLogic(GetPosPixel()), EditWin()->PixelToLogic(GetSizePixel())); + if (aRectangleLogic.IsInside(rPointLogic)) + return mpSidebarTextControl; + return 0; +@@ -616,14 +616,14 @@ void SwSidebarWin::SetPosAndSize() + + // LOK has map mode disabled, and we still want to perform pixel -> + // twips conversion for the size of the line above the note. +- if (comphelper::LibreOfficeKit::isActive() && !EditWin().IsMapModeEnabled()) ++ if (comphelper::LibreOfficeKit::isActive() && !EditWin()->IsMapModeEnabled()) + { +- EditWin().EnableMapMode(); ++ EditWin()->EnableMapMode(); + Size aSize(aLineEnd.getX() - aLineStart.getX(), aLineEnd.getY() - aLineStart.getY()); +- aSize = EditWin().PixelToLogic(aSize); ++ aSize = EditWin()->PixelToLogic(aSize); + aLineEnd = aLineStart; + aLineEnd.Move(aSize.getWidth(), aSize.getHeight()); +- EditWin().EnableMapMode(false); ++ EditWin()->EnableMapMode(false); + } + + if (!IsPreview()) +-- +2.12.0 + diff --git a/SOURCES/0309-fix-build.patch b/SOURCES/0309-fix-build.patch new file mode 100644 index 0000000..71fc487 --- /dev/null +++ b/SOURCES/0309-fix-build.patch @@ -0,0 +1,35 @@ +From 32e8771bc155aed821dade81bcf09f3c8d4a76b8 Mon Sep 17 00:00:00 2001 +From: David Tardon +Date: Mon, 20 Mar 2017 18:25:27 +0100 +Subject: [PATCH 309/398] fix build + +Change-Id: I210b8e1b7db8bcf2954d70e9a3cafd51530b1647 +--- + desktop/qa/desktop_lib/test_desktop_lib.cxx | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx +index 83bd5ac620b4..c0ba1599f48b 100644 +--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx ++++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx +@@ -472,7 +472,7 @@ void DesktopLOKTest::testCommandResult() + // the condition var. + m_aCommandResultCondition.reset(); + pDocument->pClass->postUnoCommand(pDocument, ".uno:Bold", 0, true); +- m_aCommandResultCondition.wait(aTimeValue); ++ m_aCommandResultCondition.wait(&aTimeValue); + + CPPUNIT_ASSERT(m_aCommandResult.isEmpty()); + +@@ -481,7 +481,7 @@ void DesktopLOKTest::testCommandResult() + + m_aCommandResultCondition.reset(); + pDocument->pClass->postUnoCommand(pDocument, ".uno:Bold", 0, true); +- m_aCommandResultCondition.wait(aTimeValue); ++ m_aCommandResultCondition.wait(&aTimeValue); + + boost::property_tree::ptree aTree; + std::stringstream aStream(m_aCommandResult.getStr()); +-- +2.12.0 + diff --git a/SOURCES/0310-lok-send-list-of-commands-instead-of-ClearStyles.patch b/SOURCES/0310-lok-send-list-of-commands-instead-of-ClearStyles.patch new file mode 100644 index 0000000..464ec74 --- /dev/null +++ b/SOURCES/0310-lok-send-list-of-commands-instead-of-ClearStyles.patch @@ -0,0 +1,67 @@ +From 269cad6f5da53600d11157c29f234175bc06e91c Mon Sep 17 00:00:00 2001 +From: Andrzej Hunt +Date: Thu, 12 Nov 2015 13:50:52 +0100 +Subject: [PATCH 310/398] lok: send list of commands instead of ClearStyles + +We currently send just one command, but this could be expanded +server side in future. + +Change-Id: Id8f14196158f3a7fe9c54595d094603efd5e2ce3 +(cherry picked from commit fbc3965dc117967d2b5f51aa3902823da7c69d12) +--- + desktop/qa/desktop_lib/test_desktop_lib.cxx | 2 +- + desktop/source/lib/init.cxx | 25 +++++++++++++++++++++---- + 2 files changed, 22 insertions(+), 5 deletions(-) + +diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx +index c0ba1599f48b..7d94daea0fbc 100644 +--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx ++++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx +@@ -192,7 +192,7 @@ void DesktopLOKTest::testGetStyles() + rPair.first != "NumberingStyles" && + rPair.first != "CellStyles" && + rPair.first != "ShapeStyles" && +- rPair.first != "ClearStyle") ++ rPair.first != "Commands") + { + CPPUNIT_FAIL("Unknown style family: " + rPair.first); + } +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index e09ad171678e..dbe30a640ecb 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -1301,10 +1301,27 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand) + aValues.add_child(sStyleFam.toUtf8().getStr(), aChildren); + } + +- boost::property_tree::ptree aChildClearFormat; +- OUString sClearFormat = SVX_RESSTR( RID_SVXSTR_CLEARFORM ); +- aChildClearFormat.put("", sClearFormat.toUtf8()); +- aValues.add_child("ClearStyle", aChildClearFormat); ++ { ++ boost::property_tree::ptree aCommandList; ++ ++ { ++ boost::property_tree::ptree aChild; ++ ++ OUString sClearFormat = SVX_RESSTR( RID_SVXSTR_CLEARFORM ); ++ ++ boost::property_tree::ptree aName; ++ aName.put("", sClearFormat.toUtf8()); ++ aChild.push_back(std::make_pair("text", aName)); ++ ++ boost::property_tree::ptree aCommand; ++ aCommand.put("", ".uno:ResetAttributes"); ++ aChild.push_back(std::make_pair("id", aCommand)); ++ ++ aCommandList.push_back(std::make_pair("", aChild)); ++ } ++ ++ aValues.add_child("Commands", aCommandList); ++ } + + aTree.add_child("commandValues", aValues); + std::stringstream aStream; +-- +2.12.0 + diff --git a/SOURCES/0311-Use-std-vector-instead-of-an-array-of-strings.patch b/SOURCES/0311-Use-std-vector-instead-of-an-array-of-strings.patch new file mode 100644 index 0000000..5780b6c --- /dev/null +++ b/SOURCES/0311-Use-std-vector-instead-of-an-array-of-strings.patch @@ -0,0 +1,51 @@ +From e254c72be43380472dd662d2ec69dfb7eab231b6 Mon Sep 17 00:00:00 2001 +From: Andrzej Hunt +Date: Thu, 12 Nov 2015 14:30:40 +0100 +Subject: [PATCH 311/398] Use std::vector instead of an array of strings + +This makes the code much more readable / sane. + +Change-Id: I1d60f4102b6c619fa2fefac4a3644b7f04c0b9c0 +(cherry picked from commit d5545979fb27e317cce4d374a5a913790d8a2adf) +--- + desktop/source/lib/init.cxx | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index dbe30a640ecb..d724b81f9ac6 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -1252,7 +1252,7 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand) + uno::Reference xStyleFamilies(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY); + uno::Sequence aStyleFamilies = xStyleFamilies->getElementNames(); + +- static const sal_Char* aWriterStyles[] = ++ static const std::vector aWriterStyles = + { + "Text body", + "Quotations", +@@ -1263,6 +1263,8 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand) + "Heading 3" + }; + ++ // static const std::vector aList = { "aaaa", "bbb" }; ++ + boost::property_tree::ptree aValues; + for (sal_Int32 nStyleFam = 0; nStyleFam < aStyleFamilies.getLength(); ++nStyleFam) + { +@@ -1276,10 +1278,10 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand) + if (sStyleFam == "ParagraphStyles" + && doc_getDocumentType(pThis) == LOK_DOCTYPE_TEXT) + { +- for( sal_uInt32 nStyle = 0; nStyle < sizeof( aWriterStyles ) / sizeof( sal_Char*); ++nStyle ) ++ for( OUString aStyle: aWriterStyles ) + { + uno::Reference< beans::XPropertySet > xStyle; +- xStyleFamily->getByName( OUString::createFromAscii( aWriterStyles[nStyle] )) >>= xStyle; ++ xStyleFamily->getByName( aStyle ) >>= xStyle; + OUString sName; + xStyle->getPropertyValue("DisplayName") >>= sName; + if( !sName.isEmpty() ) +-- +2.12.0 + diff --git a/SOURCES/0312-More-range-based-for.patch b/SOURCES/0312-More-range-based-for.patch new file mode 100644 index 0000000..c282ea3 --- /dev/null +++ b/SOURCES/0312-More-range-based-for.patch @@ -0,0 +1,27 @@ +From b6f9915a0b3c3dfc687a930dd263c87ccc33315f Mon Sep 17 00:00:00 2001 +From: Andrzej Hunt +Date: Thu, 12 Nov 2015 14:41:02 +0100 +Subject: [PATCH 312/398] More range based for + +Change-Id: I9cdcd8dca413981389cd4db3059a420131e5f839 +(cherry picked from commit 6e6ae9803796b120e95f6e89575e03c5fd0ed3c2) +--- + desktop/source/lib/init.cxx | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index d724b81f9ac6..a51e44591847 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -1294,7 +1294,7 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand) + } + + uno::Sequence aStyles = xStyleFamily->getElementNames(); +- for (sal_Int32 nInd = 0; nInd < aStyles.getLength(); ++nInd) ++ for ( OUString aStyle: aStyles ) + { + boost::property_tree::ptree aChild; + aChild.put("", aStyles[nInd]); +-- +2.12.0 + diff --git a/SOURCES/0313-sw-lok-filter-out-defalt-styles-to-avoid-duplicates.patch b/SOURCES/0313-sw-lok-filter-out-defalt-styles-to-avoid-duplicates.patch new file mode 100644 index 0000000..0d08bb1 --- /dev/null +++ b/SOURCES/0313-sw-lok-filter-out-defalt-styles-to-avoid-duplicates.patch @@ -0,0 +1,57 @@ +From 389a3ba2f6855d22e4802381e6f23d48c9c515bc Mon Sep 17 00:00:00 2001 +From: Andrzej Hunt +Date: Thu, 12 Nov 2015 14:48:55 +0100 +Subject: [PATCH 313/398] sw lok: filter out defalt styles to avoid duplicates + +Change-Id: Iff84c2f16844a507d30f30c1fd4b23d807ded466 +(cherry picked from commit 0b3fbf8299c51767689b4e7656bbf4c331450b98) +--- + desktop/source/lib/init.cxx | 18 ++++++++++++++---- + 1 file changed, 14 insertions(+), 4 deletions(-) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index a51e44591847..1d56f2e8abae 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -1263,7 +1263,10 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand) + "Heading 3" + }; + +- // static const std::vector aList = { "aaaa", "bbb" }; ++ // We need to keep a list of the default style names ++ // in order to filter these out later when processing ++ // the full list of styles. ++ std::set aDefaultStyleNames; + + boost::property_tree::ptree aValues; + for (sal_Int32 nStyleFam = 0; nStyleFam < aStyleFamilies.getLength(); ++nStyleFam) +@@ -1286,6 +1289,8 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand) + xStyle->getPropertyValue("DisplayName") >>= sName; + if( !sName.isEmpty() ) + { ++ aDefaultStyleNames.insert( sName ); ++ + boost::property_tree::ptree aChild; + aChild.put("", sName.toUtf8()); + aChildren.push_back(std::make_pair("", aChild)); +@@ -1296,9 +1301,14 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand) + uno::Sequence aStyles = xStyleFamily->getElementNames(); + for ( OUString aStyle: aStyles ) + { +- boost::property_tree::ptree aChild; +- aChild.put("", aStyles[nInd]); +- aChildren.push_back(std::make_pair("", aChild)); ++ // Filter out the default styles - they are already at the top ++ // of the list ++ if (aDefaultStyleNames.find(aStyle) == aDefaultStyleNames.end()) ++ { ++ boost::property_tree::ptree aChild; ++ aChild.put("", aStyle); ++ aChildren.push_back(std::make_pair("", aChild)); ++ } + } + aValues.add_child(sStyleFam.toUtf8().getStr(), aChildren); + } +-- +2.12.0 + diff --git a/SOURCES/0314-sw-lok-forward-key-events-to-annotation-window-if-ne.patch b/SOURCES/0314-sw-lok-forward-key-events-to-annotation-window-if-ne.patch new file mode 100644 index 0000000..902dfc0 --- /dev/null +++ b/SOURCES/0314-sw-lok-forward-key-events-to-annotation-window-if-ne.patch @@ -0,0 +1,166 @@ +From f9fdb4feeaa51ef9c1e9a87209d4643cb98fa76a Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Thu, 12 Nov 2015 16:56:45 +0100 +Subject: [PATCH 314/398] sw lok: forward key events to annotation window if + necessary + +And to allow proper reaction by the annotation windows, inform them when +a LOK callback is registered. + +With this, it's possible to modify the contents of annotations via LOK. + +(cherry picked from commit 1ba9d7fd2a7a3e2b4f52ed0f5efdf7df867b9db3) + +Change-Id: I4489941512197880940e20cbaeb0b47a7a6f26fc +--- + sw/inc/PostItMgr.hxx | 4 ++++ + sw/inc/SidebarWin.hxx | 1 + + sw/source/core/view/viewsh.cxx | 2 ++ + sw/source/uibase/docvw/PostItMgr.cxx | 13 +++++++++++++ + sw/source/uibase/docvw/SidebarTxtControl.hxx | 4 ++-- + sw/source/uibase/docvw/SidebarWin.cxx | 6 ++++++ + sw/source/uibase/docvw/edtwin.cxx | 11 +++++++++++ + 7 files changed, 39 insertions(+), 2 deletions(-) + +diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx +index 4356f6daa416..06f7cc1f1925 100644 +--- a/sw/inc/PostItMgr.hxx ++++ b/sw/inc/PostItMgr.hxx +@@ -34,6 +34,8 @@ + #include + #include + #include ++#define LOK_USE_UNSTABLE_API ++#include + + class OutputDevice; + class SwWrtShell; +@@ -291,6 +293,8 @@ class SwPostItMgr: public SfxListener + + void DrawNotesForPage(OutputDevice *pOutDev, sal_uInt32 nPage); + void PaintTile(OutputDevice& rRenderContext, const Rectangle& rRect); ++ /// Informs already created annotations about a newly registered LOK callback. ++ void registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pData); + }; + + #endif +diff --git a/sw/inc/SidebarWin.hxx b/sw/inc/SidebarWin.hxx +index 1eaf982ebf07..c41352749c28 100644 +--- a/sw/inc/SidebarWin.hxx ++++ b/sw/inc/SidebarWin.hxx +@@ -178,6 +178,7 @@ class SwSidebarWin : public vcl::Window + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE; + + virtual void Draw(OutputDevice* pDev, const Point&, const Size&, sal_uLong) override; ++ virtual void KeyInput(const KeyEvent& rKeyEvt) override; + void PaintTile(vcl::RenderContext& rRenderContext, const Rectangle& rRect); + /// Get the matching sub-widget inside this sidebar widget for rPointLogic, if any. + vcl::Window* IsHitWindow(const Point& rPointLogic); +diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx +index fad9dc3552db..963577fb1bd8 100644 +--- a/sw/source/core/view/viewsh.cxx ++++ b/sw/source/core/view/viewsh.cxx +@@ -120,6 +120,8 @@ void SwViewShell::ToggleHeaderFooterEdit() + void SwViewShell::registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pData) + { + getIDocumentDrawModelAccess()->GetDrawModel()->registerLibreOfficeKitCallback(pCallback, pData); ++ if (SwPostItMgr* pPostItMgr = GetPostItMgr()) ++ pPostItMgr->registerLibreOfficeKitCallback(pCallback, pData); + } + + void SwViewShell::libreOfficeKitCallback(int nType, const char* pPayload) const +diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx +index eb5755e20cf9..703a433a44ee 100644 +--- a/sw/source/uibase/docvw/PostItMgr.cxx ++++ b/sw/source/uibase/docvw/PostItMgr.cxx +@@ -881,6 +881,19 @@ void SwPostItMgr::PaintTile(OutputDevice& rRenderContext, const Rectangle& /*rRe + } + } + ++void SwPostItMgr::registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pData) ++{ ++ for (SwSidebarItem* pItem : mvPostItFields) ++ { ++ SwSidebarWin* pPostIt = pItem->pPostIt; ++ if (!pPostIt) ++ continue; ++ ++ pPostIt->GetOutlinerView()->setTiledRendering(mpWrtShell->isTiledRendering()); ++ pPostIt->GetOutlinerView()->registerLibreOfficeKitCallback(pCallback, pData); ++ } ++} ++ + void SwPostItMgr::Scroll(const long lScroll,const unsigned long aPage) + { + OSL_ENSURE((lScroll % GetScrollSize() )==0,"SwPostItMgr::Scroll: scrolling by wrong value"); +diff --git a/sw/source/uibase/docvw/SidebarTxtControl.hxx b/sw/source/uibase/docvw/SidebarTxtControl.hxx +index 1be8ab3b8b4a..4f47ef4a2177 100644 +--- a/sw/source/uibase/docvw/SidebarTxtControl.hxx ++++ b/sw/source/uibase/docvw/SidebarTxtControl.hxx +@@ -40,7 +40,6 @@ class SidebarTextControl : public Control + + protected: + virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE; +- virtual void KeyInput( const KeyEvent& rKeyEvt ) SAL_OVERRIDE; + virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE; + virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; + virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE; +@@ -60,7 +59,8 @@ class SidebarTextControl : public Control + virtual ~SidebarTextControl(); + virtual void dispose() SAL_OVERRIDE; + +- virtual void GetFocus() SAL_OVERRIDE; ++ virtual void GetFocus() override; ++ virtual void KeyInput( const KeyEvent& rKeyEvt ) override; + + OutlinerView* GetTextView() const; + +diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx +index 575be80c0ae0..a40c82de5470 100644 +--- a/sw/source/uibase/docvw/SidebarWin.cxx ++++ b/sw/source/uibase/docvw/SidebarWin.cxx +@@ -356,6 +356,12 @@ void SwSidebarWin::Draw(OutputDevice* pDev, const Point& rPt, const Size& rSz, s + } + } + ++void SwSidebarWin::KeyInput(const KeyEvent& rKeyEvent) ++{ ++ if (mpSidebarTextControl) ++ mpSidebarTextControl->KeyInput(rKeyEvent); ++} ++ + void SwSidebarWin::SetPosSizePixelRect(long nX, long nY, long nWidth, long nHeight, + const SwRect& aAnchorRect, const long aPageBorder) + { +diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx +index b4ed61becbfb..10cdc0dca561 100644 +--- a/sw/source/uibase/docvw/edtwin.cxx ++++ b/sw/source/uibase/docvw/edtwin.cxx +@@ -145,6 +145,8 @@ + #include + + #include ++#include ++#include + + #include + #include +@@ -1324,6 +1326,15 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt) + { + SwWrtShell &rSh = m_rView.GetWrtShell(); + ++ if (comphelper::LibreOfficeKit::isActive() && m_rView.GetPostItMgr()) ++ { ++ if (vcl::Window* pWindow = m_rView.GetPostItMgr()->GetActiveSidebarWin()) ++ { ++ pWindow->KeyInput(rKEvt); ++ return; ++ } ++ } ++ + if( rKEvt.GetKeyCode().GetCode() == KEY_ESCAPE && + m_pApplyTempl && m_pApplyTempl->m_pFormatClipboard ) + { +-- +2.12.0 + diff --git a/SOURCES/0315-lok-Use-reference-instead-of-copy-constructing-in-ra.patch b/SOURCES/0315-lok-Use-reference-instead-of-copy-constructing-in-ra.patch new file mode 100644 index 0000000..3410be9 --- /dev/null +++ b/SOURCES/0315-lok-Use-reference-instead-of-copy-constructing-in-ra.patch @@ -0,0 +1,50 @@ +From 5b7391b183885ce1d85b76d2d6ddc46a771abc35 Mon Sep 17 00:00:00 2001 +From: Jan Holesovsky +Date: Thu, 12 Nov 2015 18:22:06 +0100 +Subject: [PATCH 315/398] lok: Use reference instead of copy constructing in + range-based for. + +Change-Id: Ie5bf5d4ab139f22e67f3654b0bb31e10b8c9f337 +(cherry picked from commit addd884799b88213df813fd8501c3ab8306593e1) +--- + desktop/source/lib/init.cxx | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 1d56f2e8abae..04a902780e6c 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -1281,10 +1281,10 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand) + if (sStyleFam == "ParagraphStyles" + && doc_getDocumentType(pThis) == LOK_DOCTYPE_TEXT) + { +- for( OUString aStyle: aWriterStyles ) ++ for (const OUString& rStyle: aWriterStyles) + { + uno::Reference< beans::XPropertySet > xStyle; +- xStyleFamily->getByName( aStyle ) >>= xStyle; ++ xStyleFamily->getByName(rStyle) >>= xStyle; + OUString sName; + xStyle->getPropertyValue("DisplayName") >>= sName; + if( !sName.isEmpty() ) +@@ -1299,14 +1299,14 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand) + } + + uno::Sequence aStyles = xStyleFamily->getElementNames(); +- for ( OUString aStyle: aStyles ) ++ for (const OUString& rStyle: aStyles ) + { + // Filter out the default styles - they are already at the top + // of the list +- if (aDefaultStyleNames.find(aStyle) == aDefaultStyleNames.end()) ++ if (aDefaultStyleNames.find(rStyle) == aDefaultStyleNames.end()) + { + boost::property_tree::ptree aChild; +- aChild.put("", aStyle); ++ aChild.put("", rStyle); + aChildren.push_back(std::make_pair("", aChild)); + } + } +-- +2.12.0 + diff --git a/SOURCES/0316-LOK-setClientZoom-sets-the-client-zoom-level.patch b/SOURCES/0316-LOK-setClientZoom-sets-the-client-zoom-level.patch new file mode 100644 index 0000000..ca976ee --- /dev/null +++ b/SOURCES/0316-LOK-setClientZoom-sets-the-client-zoom-level.patch @@ -0,0 +1,313 @@ +From 4918619e165b7869731e594bf514932cdec10d8e Mon Sep 17 00:00:00 2001 +From: Mihai Varga +Date: Fri, 6 Nov 2015 14:34:28 +0200 +Subject: [PATCH 316/398] LOK: setClientZoom() - sets the client zoom level + +We need to know the client's view level to correctly handle the mouse +events in calc. PaintTile() set a zoom level that corresponds to the +requested tiles and previously postMouseEvent would call SetZoom(1,1). +Now we can make use of knowing the client's view level and call +SetZoom() with the correct parameters + +Conflicts: + sc/source/ui/unoobj/docuno.cxx +(cherry picked from commit 96cd2abd748ed24e5aba50cc4c300cf06e512db3) + +Change-Id: I34b5afcdcc06a671a8ac92c03e87404e42adf4cd +--- + desktop/source/lib/init.cxx | 20 +++++++++++++++- + include/LibreOfficeKit/LibreOfficeKit.h | 7 ++++++ + include/LibreOfficeKit/LibreOfficeKit.hxx | 17 ++++++++++++++ + include/vcl/ITiledRenderable.hxx | 18 +++++++++++++++ + libreofficekit/source/gtk/lokdocview.cxx | 38 +++++++++++++++++++++++++++++++ + libreofficekit/source/gtk/tilebuffer.hxx | 11 ++++++++- + sc/inc/docuno.hxx | 3 +++ + sc/source/ui/unoobj/docuno.cxx | 18 ++++++++++++++- + 8 files changed, 129 insertions(+), 3 deletions(-) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 04a902780e6c..4ee862d21cd0 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -317,7 +317,11 @@ static void doc_setGraphicSelection (LibreOfficeKitDocument* pThis, + int nY); + static void doc_resetSelection (LibreOfficeKitDocument* pThis); + static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCommand); +- ++static void doc_setClientZoom(LibreOfficeKitDocument* pThis, ++ int nTilePixelWidth, ++ int nTilePixelHeight, ++ int nTileTwipWidth, ++ int nTileTwipHeight); + static int doc_createView(LibreOfficeKitDocument* pThis); + static void doc_destroyView(LibreOfficeKitDocument* pThis, int nId); + static void doc_setView(LibreOfficeKitDocument* pThis, int nId); +@@ -357,6 +361,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference setGraphicSelection = doc_setGraphicSelection; + m_pDocumentClass->resetSelection = doc_resetSelection; + m_pDocumentClass->getCommandValues = doc_getCommandValues; ++ m_pDocumentClass->setClientZoom = doc_setClientZoom; + + m_pDocumentClass->createView = doc_createView; + m_pDocumentClass->destroyView = doc_destroyView; +@@ -1470,6 +1475,19 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo + } + } + ++static void doc_setClientZoom(LibreOfficeKitDocument* pThis, int nTilePixelWidth, int nTilePixelHeight, ++ int nTileTwipWidth, int nTileTwipHeight) ++{ ++ ITiledRenderable* pDoc = getTiledRenderable(pThis); ++ if (!pDoc) ++ { ++ gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering"; ++ return; ++ } ++ ++ pDoc->setClientZoom(nTilePixelWidth, nTilePixelHeight, nTileTwipWidth, nTileTwipHeight); ++} ++ + static int doc_createView(LibreOfficeKitDocument* /*pThis*/) + { + SolarMutexGuard aGuard; +diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h +index c887f5f64b8a..03210376c61e 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.h ++++ b/include/LibreOfficeKit/LibreOfficeKit.h +@@ -181,6 +181,13 @@ struct _LibreOfficeKitDocumentClass + /// @see lok::Document::getCommandValues(). + char* (*getCommandValues) (LibreOfficeKitDocument* pThis, const char* pCommand); + ++ /// @see lok::Document::setClientZoom(). ++ void (*setClientZoom) (LibreOfficeKitDocument* pThis, ++ int nTilePixelWidth, ++ int nTilePixelHeight, ++ int nTileTwipWidth, ++ int nTileTwipHeight); ++ + /// @see lok::Document::createView(). + int (*createView) (LibreOfficeKitDocument* pThis); + /// @see lok::Document::destroyView(). +diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx +index 601d3bc147a5..c474195de213 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.hxx ++++ b/include/LibreOfficeKit/LibreOfficeKit.hxx +@@ -294,6 +294,23 @@ public: + } + + /** ++ * Save the client's view so that we can compute the right zoom level ++ * for the mouse events. This only affects CALC. ++ * @param nTilePixelWidth - tile width in pixels ++ * @param nTilePixelHeight - tile height in pixels ++ * @param nTileTwipWidth - tile width in twips ++ * @param nTileTwipHeight - tile height in twips ++ */ ++ inline void setClientZoom( ++ int nTilePixelWidth, ++ int nTilePixelHeight, ++ int nTileTwipWidth, ++ int nTileTwipHeight) ++ { ++ mpDoc->pClass->setClientZoom(mpDoc, nTilePixelWidth, nTilePixelHeight, nTileTwipWidth, nTileTwipHeight); ++ } ++ ++ /** + * Create a new view for an existing document. + * By default a loaded document has 1 view. + * @return the ID of the new view. +diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx +index bf0aa55e32a6..fa85b39399b3 100644 +--- a/include/vcl/ITiledRenderable.hxx ++++ b/include/vcl/ITiledRenderable.hxx +@@ -22,6 +22,9 @@ namespace vcl + + class VCL_DLLPUBLIC ITiledRenderable + { ++protected: ++ int nTilePixelWidth, nTilePixelHeight; ++ int nTileTwipWidth, nTileTwipHeight; + public: + virtual ~ITiledRenderable(); + +@@ -179,6 +182,21 @@ public: + + /// If the current contents of the clipboard is something we can paste. + virtual bool isMimeTypeSupported() = 0; ++ ++ /** ++ * Save the client's view so that we can compute the right zoom level ++ * for the mouse events. ++ * @param nTilePixelWidth - tile width in pixels ++ * @param nTilePixelHeight - tile height in pixels ++ * @param nTileTwipWidth - tile width in twips ++ * @param nTileTwipHeight - tile height in twips ++ */ ++ virtual void setClientZoom(int /*nTilePixelWidth*/, ++ int /*nTilePixelHeight*/, ++ int /*nTileTwipWidth*/, ++ int /*nTileTwipHeight*/) ++ { ++ } + }; + + } // namespace vcl +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 687323d6ca11..db71f80e39c8 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -1506,6 +1506,23 @@ setGraphicSelectionInThread(gpointer data) + } + + static void ++setClientZoomInThread(gpointer data) ++{ ++ GTask* task = G_TASK(data); ++ LOKDocView* pDocView = LOK_DOC_VIEW(g_task_get_source_object(task)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); ++ LOEvent* pLOEvent = static_cast(g_task_get_task_data(task)); ++ ++ if (!priv->m_pDocument) ++ return; ++ priv->m_pDocument->pClass->setClientZoom(priv->m_pDocument, ++ pLOEvent->m_nTilePixelWidth, ++ pLOEvent->m_nTilePixelHeight, ++ pLOEvent->m_nTileTwipWidth, ++ pLOEvent->m_nTileTwipHeight); ++} ++ ++static void + postMouseEventInThread(gpointer data) + { + GTask* task = G_TASK(data); +@@ -1721,6 +1738,9 @@ lokThreadFunc(gpointer data, gpointer /*user_data*/) + case LOK_SET_GRAPHIC_SELECTION: + setGraphicSelectionInThread(task); + break; ++ case LOK_SET_CLIENT_ZOOM: ++ setClientZoomInThread(task); ++ break; + } + + g_object_unref(task); +@@ -2301,6 +2321,7 @@ SAL_DLLPUBLIC_EXPORT void + lok_doc_view_set_zoom (LOKDocView* pDocView, float fZoom) + { + LOKDocViewPrivate& priv = getPrivate(pDocView); ++ GError* error = NULL; + + priv->m_fZoom = fZoom; + long nDocumentWidthPixels = twipToPixel(priv->m_nDocumentWidthTwips, fZoom); +@@ -2313,6 +2334,23 @@ lok_doc_view_set_zoom (LOKDocView* pDocView, float fZoom) + gtk_widget_set_size_request(GTK_WIDGET(pDocView), + nDocumentWidthPixels, + nDocumentHeightPixels); ++ ++ // Update the client's view size ++ GTask* task = g_task_new(pDocView, NULL, NULL, NULL); ++ LOEvent* pLOEvent = new LOEvent(LOK_SET_CLIENT_ZOOM); ++ pLOEvent->m_nTilePixelWidth = nTileSizePixels; ++ pLOEvent->m_nTilePixelHeight = nTileSizePixels; ++ pLOEvent->m_nTileTwipWidth = pixelToTwip(nTileSizePixels, fZoom); ++ pLOEvent->m_nTileTwipHeight = pixelToTwip(nTileSizePixels, fZoom); ++ g_task_set_task_data(task, pLOEvent, LOEvent::destroy); ++ ++ g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); ++ if (error != NULL) ++ { ++ g_warning("Unable to call LOK_SET_CLIENT_ZOOM: %s", error->message); ++ g_clear_error(&error); ++ } ++ g_object_unref(task); + } + + SAL_DLLPUBLIC_EXPORT float +diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx +index 5482ea2b2825..244ca882d051 100644 +--- a/libreofficekit/source/gtk/tilebuffer.hxx ++++ b/libreofficekit/source/gtk/tilebuffer.hxx +@@ -159,7 +159,8 @@ enum + LOK_POST_KEY, + LOK_PAINT_TILE, + LOK_POST_MOUSE_EVENT, +- LOK_SET_GRAPHIC_SELECTION ++ LOK_SET_GRAPHIC_SELECTION, ++ LOK_SET_CLIENT_ZOOM + }; + + enum +@@ -233,6 +234,14 @@ struct LOEvent + int m_nSetGraphicSelectionY; + ///@} + ++ /// @name setClientView parameters ++ ///@{ ++ int m_nTilePixelWidth; ++ int m_nTilePixelHeight; ++ int m_nTileTwipWidth; ++ int m_nTileTwipHeight; ++ ///@} ++ + /// Constructor to instantiate an object of type `type`. + LOEvent(int type) + : m_nType(type) +diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx +index b73eb12704be..7e00b7549733 100644 +--- a/sc/inc/docuno.hxx ++++ b/sc/inc/docuno.hxx +@@ -422,6 +422,9 @@ public: + /// @see vcl::ITiledRenderable::isMimeTypeSupported(). + virtual bool isMimeTypeSupported() override; + ++ /// @see vcl::ITiledRenderable::setClientZoom(). ++ virtual void setClientZoom(int nTilePixelWidth, int nTilePixelHeight, int nTileTwipWidth, int nTileTwipHeight) override; ++ + /// @see vcl::ITiledRenderable::getRowColumnHeaders(). + virtual OUString getRowColumnHeaders(const Rectangle& rRectangle) override; + +diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx +index 0e5396e5910e..c5a96e1e8255 100644 +--- a/sc/source/ui/unoobj/docuno.cxx ++++ b/sc/source/ui/unoobj/docuno.cxx +@@ -604,7 +604,8 @@ void ScModelObj::postMouseEvent(int nType, int nX, int nY, int nCount, int nButt + return; + + // update the aLogicMode in ScViewData to something predictable +- pViewData->SetZoom(Fraction(1, 1), Fraction(1, 1), true); ++ pViewData->SetZoom(Fraction(nTilePixelWidth * TWIPS_PER_PIXEL, nTileTwipWidth), ++ Fraction(nTilePixelHeight * TWIPS_PER_PIXEL, nTileTwipHeight), true); + + // Calc operates in pixels... + MouseEvent aEvent(Point(nX * pViewData->GetPPTX(), nY * pViewData->GetPPTY()), nCount, +@@ -873,6 +874,14 @@ bool ScModelObj::isMimeTypeSupported() + return EditEngine::HasValidData(aDataHelper.GetTransferable()); + } + ++void ScModelObj::setClientZoom(int nTilePixelWidth_, int nTilePixelHeight_, int nTileTwipWidth_, int nTileTwipHeight_) ++{ ++ nTilePixelWidth = nTilePixelWidth_; ++ nTilePixelHeight = nTilePixelHeight_; ++ nTileTwipWidth = nTileTwipWidth_; ++ nTileTwipHeight = nTileTwipHeight_; ++} ++ + OUString ScModelObj::getRowColumnHeaders(const Rectangle& rRectangle) + { + ScViewData* pViewData = ScDocShell::GetViewData(); +@@ -931,6 +940,13 @@ void ScModelObj::initializeForTiledRendering() + // tdf#93154: in tiled rendering LO doesn't always detect changes + SvtMiscOptions aMiscOpt; + aMiscOpt.SetSaveAlwaysAllowed(true); ++ ++ // default tile size in pixels ++ nTilePixelWidth = 256; ++ nTilePixelHeight = 256; ++ // the default zoom level will be 1 ++ nTileTwipWidth = nTilePixelWidth * TWIPS_PER_PIXEL; ++ nTileTwipHeight = nTilePixelHeight * TWIPS_PER_PIXEL; + } + + uno::Any SAL_CALL ScModelObj::queryInterface( const uno::Type& rType ) +-- +2.12.0 + diff --git a/SOURCES/0317-LOK-calc-formula-callback-formula-bar-implementation.patch b/SOURCES/0317-LOK-calc-formula-callback-formula-bar-implementation.patch new file mode 100644 index 0000000..f4dddc6 --- /dev/null +++ b/SOURCES/0317-LOK-calc-formula-callback-formula-bar-implementation.patch @@ -0,0 +1,202 @@ +From d57909684dd464e1e7b8616ac1cbd43a8f5817c2 Mon Sep 17 00:00:00 2001 +From: Mihai Varga +Date: Fri, 13 Nov 2015 09:48:14 +0200 +Subject: [PATCH 317/398] LOK: calc formula callback + formula bar + implementation in gtk + +We need the callback to be able implement the formula bar + +Change-Id: I1c78ab0b9ed9304c0465a9993a7101f8efb91052 + +Conflicts: + include/LibreOfficeKit/LibreOfficeKitEnums.h + libreofficekit/source/gtk/lokdocview.cxx +(cherry picked from commit 5b1e22e9ba941305a7f138adcef75a464161a145) +--- + include/LibreOfficeKit/LibreOfficeKitEnums.h | 7 +++++- + .../qa/gtktiledviewer/gtktiledviewer.cxx | 24 +++++++++++++++++++++ + libreofficekit/source/gtk/lokdocview.cxx | 25 ++++++++++++++++++++++ + sc/source/ui/app/inputhdl.cxx | 8 +++++++ + 4 files changed, 63 insertions(+), 1 deletion(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h +index 37837ea49b86..7b23fcbab1c3 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h ++++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h +@@ -209,7 +209,12 @@ typedef enum + * + * Payload is a css mouse pointer style. + */ +- LOK_CALLBACK_MOUSE_POINTER ++ LOK_CALLBACK_MOUSE_POINTER, ++ ++ /** ++ * The text content of the formula bar in Calc. ++ */ ++ LOK_CALLBACK_CELL_FORMULA + } + LibreOfficeKitCallbackType; + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index c96ba95e7d99..cd5b23c12bc4 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -101,6 +101,7 @@ public: + GtkToolItem* m_pCenterpara; + GtkToolItem* m_pRightpara; + GtkToolItem* m_pJustifypara; ++ GtkWidget* m_pFormulabarEntry; + GtkWidget* m_pScrolledWindow; + std::map m_aToolItemCommandNames; + std::map m_aCommandNameToolItems; +@@ -135,6 +136,7 @@ public: + m_pCenterpara(nullptr), + m_pRightpara(nullptr), + m_pJustifypara(nullptr), ++ m_pFormulabarEntry(nullptr), + m_pScrolledWindow(nullptr), + m_bToolItemBroadcast(true), + m_pVBox(nullptr), +@@ -631,6 +633,14 @@ static gboolean signalFindbar(GtkWidget* pWidget, GdkEventKey* pEvent, gpointer + return FALSE; + } + ++/// Handles the key-press-event of the formula entry widget. ++static gboolean signalFormulabar(GtkWidget* /*pWidget*/, GdkEventKey* /*pEvent*/, gpointer /*pData*/) ++{ ++ // for now it just displays the callback ++ // TODO - submit the edited formula ++ return TRUE; ++} ++ + /// LOKDocView changed edit state -> inform the tool button. + static void signalEdit(LOKDocView* pLOKDocView, gboolean bWasEdit, gpointer /*pData*/) + { +@@ -767,6 +777,13 @@ static void cursorChanged(LOKDocView* pDocView, gint nX, gint nY, + gtk_adjustment_set_value(hadj, lok_doc_view_twip_to_pixel(LOK_DOC_VIEW(pDocView), x)); + } + ++/// LOKDocView the formula has changed ++static void formulaChanged(LOKDocView* pLOKDocView, char* pPayload, gpointer /*pData*/) ++{ ++ TiledWindow& rWindow = lcl_getTiledWindow(GTK_WIDGET(pLOKDocView)); ++ gtk_entry_set_text((GtkEntry*)rWindow.m_pFormulabarEntry, pPayload); ++} ++ + static void toggleToolItem(GtkWidget* pWidget, gpointer /*pData*/) + { + TiledWindow& rWindow = lcl_getTiledWindow(pWidget); +@@ -1075,6 +1092,12 @@ static GtkWidget* createWindow(TiledWindow& rWindow) + gtk_toolbar_insert(GTK_TOOLBAR(pLowerToolbar), rWindow.m_pJustifypara, -1); + g_signal_connect(G_OBJECT(rWindow.m_pJustifypara), "toggled", G_CALLBACK(toggleToolItem), NULL); + lcl_registerToolItem(rWindow, rWindow.m_pJustifypara, ".uno:JustifyPara"); ++ // Formula bar ++ GtkToolItem* pFormulaEntryContainer = gtk_tool_item_new(); ++ rWindow.m_pFormulabarEntry = gtk_entry_new(); ++ gtk_container_add(GTK_CONTAINER(pFormulaEntryContainer), rWindow.m_pFormulabarEntry); ++ g_signal_connect(rWindow.m_pFormulabarEntry, "key-press-event", G_CALLBACK(signalFormulabar), 0); ++ gtk_toolbar_insert(GTK_TOOLBAR(pLowerToolbar), pFormulaEntryContainer, -1); + gtk_box_pack_start(GTK_BOX(rWindow.m_pVBox), pLowerToolbar, FALSE, FALSE, 0 ); // Adds to top. + + // Findbar +@@ -1188,6 +1211,7 @@ static void setupDocView(GtkWidget* pDocView) + g_signal_connect(pDocView, "size-changed", G_CALLBACK(signalSize), NULL); + g_signal_connect(pDocView, "hyperlink-clicked", G_CALLBACK(signalHyperlink), NULL); + g_signal_connect(pDocView, "cursor-changed", G_CALLBACK(cursorChanged), NULL); ++ g_signal_connect(pDocView, "formula-changed", G_CALLBACK(formulaChanged), NULL); + } + + int main( int argc, char* argv[] ) +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index db71f80e39c8..9d852351262e 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -184,6 +184,7 @@ enum + CURSOR_CHANGED, + SEARCH_RESULT_COUNT, + COMMAND_RESULT, ++ FORMULA_CHANGED, + + LAST_SIGNAL + }; +@@ -495,6 +496,11 @@ static void commandResult(LOKDocView* pDocView, const std::string& rString) + g_signal_emit(pDocView, doc_view_signals[COMMAND_RESULT], 0, rString.c_str()); + } + ++static void formulaChanged(LOKDocView* pDocView, const std::string& rString) ++{ ++ g_signal_emit(pDocView, doc_view_signals[FORMULA_CHANGED], 0, rString.c_str()); ++} ++ + static void + setPart(LOKDocView* pDocView, const std::string& rString) + { +@@ -809,6 +815,11 @@ callback (gpointer pData) + commandResult(pDocView, pCallback->m_aPayload); + } + break; ++ case LOK_CALLBACK_CELL_FORMULA: ++ { ++ formulaChanged(pDocView, pCallback->m_aPayload); ++ } ++ break; + default: + g_assert(false); + break; +@@ -2248,6 +2259,20 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + G_TYPE_NONE, 1, + G_TYPE_STRING); + ++ /** ++ * LOKDocView::formula-changed: ++ * @pDocView: the #LOKDocView on which the signal is emitted ++ * @aCommand: formula text content ++ */ ++ doc_view_signals[FORMULA_CHANGED] = ++ g_signal_new("formula-changed", ++ G_TYPE_FROM_CLASS(pGObjectClass), ++ G_SIGNAL_RUN_FIRST, ++ 0, ++ NULL, NULL, ++ g_cclosure_marshal_VOID__STRING, ++ G_TYPE_NONE, 1, ++ G_TYPE_STRING); + } + + SAL_DLLPUBLIC_EXPORT GtkWidget* +diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx +index 09bc73d336cd..c656ca75b9b7 100644 +--- a/sc/source/ui/app/inputhdl.cxx ++++ b/sc/source/ui/app/inputhdl.cxx +@@ -52,6 +52,7 @@ + #include + #include + #include ++#include + + #include "inputwin.hxx" + #include "tabvwsh.hxx" +@@ -2139,6 +2140,11 @@ void ScInputHandler::DataChanged( bool bFromTopNotify, bool bSetModified ) + + if ( pInputWin ) + pInputWin->SetTextString( aText ); ++ ++ ScDocShell* pDocSh = pActiveViewSh->GetViewData().GetDocShell(); ++ ScDocument& rDoc = pDocSh->GetDocument(); ++ if ( rDoc.GetDrawLayer()->isTiledRendering() ) ++ rDoc.GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_CELL_FORMULA, aText.toUtf8().getStr()); + } + + // If the cursor is before the end of a paragraph, parts are being pushed to +@@ -3475,6 +3481,8 @@ void ScInputHandler::NotifyChange( const ScInputHdlState* pState, + + if ( pInputWin ) + pInputWin->SetTextString(aString); ++ else if ( rDoc.GetDrawLayer()->isTiledRendering() ) ++ rDoc.GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_CELL_FORMULA, aString.toUtf8().getStr()); + } + + if ( pInputWin ) // Named range input +-- +2.12.0 + diff --git a/SOURCES/0318-libreofficekit-loplugin-cstylecast.patch b/SOURCES/0318-libreofficekit-loplugin-cstylecast.patch new file mode 100644 index 0000000..296938f --- /dev/null +++ b/SOURCES/0318-libreofficekit-loplugin-cstylecast.patch @@ -0,0 +1,27 @@ +From 3a915ae6d285545311c27e6d85a4b789ae5c7a2f Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 13 Nov 2015 09:45:03 +0100 +Subject: [PATCH 318/398] libreofficekit: loplugin:cstylecast + +Change-Id: Iea7ba258b661c09744191933fc23a06ed57fdf3b +(cherry picked from commit 0bf24b19c7618ee83f88aa9364f68a4db1d2c04d) +--- + libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index cd5b23c12bc4..45ccef792905 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -781,7 +781,7 @@ static void cursorChanged(LOKDocView* pDocView, gint nX, gint nY, + static void formulaChanged(LOKDocView* pLOKDocView, char* pPayload, gpointer /*pData*/) + { + TiledWindow& rWindow = lcl_getTiledWindow(GTK_WIDGET(pLOKDocView)); +- gtk_entry_set_text((GtkEntry*)rWindow.m_pFormulabarEntry, pPayload); ++ gtk_entry_set_text(GTK_ENTRY(rWindow.m_pFormulabarEntry), pPayload); + } + + static void toggleToolItem(GtkWidget* pWidget, gpointer /*pData*/) +-- +2.12.0 + diff --git a/SOURCES/0319-sw-don-t-show-main-cursor-when-editing-a-postit.patch b/SOURCES/0319-sw-don-t-show-main-cursor-when-editing-a-postit.patch new file mode 100644 index 0000000..f502763 --- /dev/null +++ b/SOURCES/0319-sw-don-t-show-main-cursor-when-editing-a-postit.patch @@ -0,0 +1,55 @@ +From e24ce4fa62084b8fb8634da280450c054f797052 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 13 Nov 2015 10:03:10 +0100 +Subject: [PATCH 319/398] sw: don't show main cursor when editing a postit + +This is primarily for tiled editing that doesn't know about multiple +cursors, so if both the postit cursor and the main cursor is shown for a +short period of time, then the main one is hidden, then gtktiledviewer +still shows the main one. + +OTOH if we can avoid showing the cursor in general just to hide it a bit +later in general, let's not do that. + +With this, the "cursor is shown at the comment anchor, not inside the +anchor when clicking on the postit" bug disappears. + +(cherry picked from commit 1c482cb54b4dab4c5b549ecd2395104f042e4101) + +Change-Id: I2383292c5f84604dc8b126510b0797b8426920ae +--- + sw/source/core/crsr/crsrsh.cxx | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx +index ffff6a6b2a93..626a2a75e47a 100644 +--- a/sw/source/core/crsr/crsrsh.cxx ++++ b/sw/source/core/crsr/crsrsh.cxx +@@ -65,6 +65,8 @@ + #include + #include + #include ++#include ++#include + + using namespace com::sun::star; + using namespace util; +@@ -1286,6 +1288,15 @@ void SwCrsrShell::Paint(vcl::RenderContext& rRenderContext, const Rectangle &rRe + pAktCrsr->Invalidate( aRect ); + + } ++ ++ if (SwPostItMgr* pPostItMgr = GetPostItMgr()) ++ { ++ // No point in showing the cursor for Writer text when there is an ++ // active annotation edit. ++ if (bVis) ++ bVis = !pPostItMgr->HasActiveSidebarWin(); ++ } ++ + if( m_bSVCrsrVis && bVis ) // also show SV cursor again + m_pVisCrsr->Show(); + } +-- +2.12.0 + diff --git a/SOURCES/0320-loplugin-nullptr.patch b/SOURCES/0320-loplugin-nullptr.patch new file mode 100644 index 0000000..281092d --- /dev/null +++ b/SOURCES/0320-loplugin-nullptr.patch @@ -0,0 +1,54 @@ +From 19770dc907fb14c29c954aba399f906ee0c44914 Mon Sep 17 00:00:00 2001 +From: Stephan Bergmann +Date: Fri, 13 Nov 2015 10:41:32 +0100 +Subject: [PATCH 320/398] loplugin:nullptr + +Change-Id: Iaf779157b97e4d3a3a449cc7f17e4d5c533955f0 +(cherry picked from commit c6c8af5ef46e2178e4b9abcd95f76c8df2db2732) +--- + libreofficekit/source/gtk/lokdocview.cxx | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 9d852351262e..47ada280dde3 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -2269,7 +2269,7 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + G_TYPE_FROM_CLASS(pGObjectClass), + G_SIGNAL_RUN_FIRST, + 0, +- NULL, NULL, ++ nullptr, nullptr, + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, 1, + G_TYPE_STRING); +@@ -2346,7 +2346,7 @@ SAL_DLLPUBLIC_EXPORT void + lok_doc_view_set_zoom (LOKDocView* pDocView, float fZoom) + { + LOKDocViewPrivate& priv = getPrivate(pDocView); +- GError* error = NULL; ++ GError* error = nullptr; + + priv->m_fZoom = fZoom; + long nDocumentWidthPixels = twipToPixel(priv->m_nDocumentWidthTwips, fZoom); +@@ -2361,7 +2361,7 @@ lok_doc_view_set_zoom (LOKDocView* pDocView, float fZoom) + nDocumentHeightPixels); + + // Update the client's view size +- GTask* task = g_task_new(pDocView, NULL, NULL, NULL); ++ GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr); + LOEvent* pLOEvent = new LOEvent(LOK_SET_CLIENT_ZOOM); + pLOEvent->m_nTilePixelWidth = nTileSizePixels; + pLOEvent->m_nTilePixelHeight = nTileSizePixels; +@@ -2370,7 +2370,7 @@ lok_doc_view_set_zoom (LOKDocView* pDocView, float fZoom) + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + + g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); +- if (error != NULL) ++ if (error != nullptr) + { + g_warning("Unable to call LOK_SET_CLIENT_ZOOM: %s", error->message); + g_clear_error(&error); +-- +2.12.0 + diff --git a/SOURCES/0321-sc-lok-during-tiled-rendering-the-cell-cursor-is-alw.patch b/SOURCES/0321-sc-lok-during-tiled-rendering-the-cell-cursor-is-alw.patch new file mode 100644 index 0000000..4083fbe --- /dev/null +++ b/SOURCES/0321-sc-lok-during-tiled-rendering-the-cell-cursor-is-alw.patch @@ -0,0 +1,63 @@ +From 9cb5bab53bf2211762f3470cba824ce1ecdc9391 Mon Sep 17 00:00:00 2001 +From: Andrzej Hunt +Date: Fri, 13 Nov 2015 11:17:43 +0100 +Subject: [PATCH 321/398] sc lok: during tiled rendering the cell-cursor is + always visible + +Change-Id: Ia802c19f5bfd2fe2e9909e3c611047c529a64200 +(cherry picked from commit e77668eb1e7abe522493235dadfca08ca451ad99) +--- + sc/source/ui/view/gridwin.cxx | 12 +++++------- + 1 file changed, 5 insertions(+), 7 deletions(-) + +diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx +index c2d391d038ef..96f10568b797 100644 +--- a/sc/source/ui/view/gridwin.cxx ++++ b/sc/source/ui/view/gridwin.cxx +@@ -6019,7 +6019,9 @@ void ScGridWindow::UpdateCursorOverlay() + + const ScPatternAttr* pPattern = pDoc->GetPattern(nX,nY,nTab); + +- if (!maVisibleRange.isInside(nX, nY)) ++ ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer(); ++ ++ if (!pDrawLayer->isTiledRendering() && !maVisibleRange.isInside(nX, nY)) + { + if (maVisibleRange.mnCol2 < nX || maVisibleRange.mnRow2 < nY) + return; // no further check needed, nothing visible +@@ -6038,13 +6040,11 @@ void ScGridWindow::UpdateCursorOverlay() + } + + // don't show the cursor in overlapped cells +- + const ScMergeFlagAttr& rMergeFlag = static_cast( pPattern->GetItem(ATTR_MERGE_FLAG) ); + bool bOverlapped = rMergeFlag.IsOverlapped(); + + // left or above of the screen? +- +- bool bVis = ( nX>=pViewData->GetPosX(eHWhich) && nY>=pViewData->GetPosY(eVWhich) ); ++ bool bVis = pDrawLayer->isTiledRendering() || ( nX>=pViewData->GetPosX(eHWhich) && nY>=pViewData->GetPosY(eVWhich) ); + if (!bVis) + { + SCCOL nEndX = nX; +@@ -6074,7 +6074,7 @@ void ScGridWindow::UpdateCursorOverlay() + } + + // in the tiled rendering case, don't limit to the screen size +- if (bMaybeVisible) ++ if (bMaybeVisible || pDrawLayer->isTiledRendering()) + { + long nSizeXPix; + long nSizeYPix; +@@ -6117,8 +6117,6 @@ void ScGridWindow::UpdateCursorOverlay() + } + } + +- ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer(); +- + if ( !aPixelRects.empty() ) + { + if (pDrawLayer->isTiledRendering()) { +-- +2.12.0 + diff --git a/SOURCES/0322-editeng-lok-respect-origin-of-map-mode-for-INVALIDAT.patch b/SOURCES/0322-editeng-lok-respect-origin-of-map-mode-for-INVALIDAT.patch new file mode 100644 index 0000000..bb15bef --- /dev/null +++ b/SOURCES/0322-editeng-lok-respect-origin-of-map-mode-for-INVALIDAT.patch @@ -0,0 +1,39 @@ +From 81c5808af3987e81f571e0436d04a6a96ccf19ca Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 13 Nov 2015 11:33:43 +0100 +Subject: [PATCH 322/398] editeng lok: respect origin of map mode for + INVALIDATE_VISIBLE_CURSOR + +Writer comments are separate widgets, but we want to have coordinates in +absolutes twips, so give Writer a chance to inform us about the delta. + +For now only do this in case the map unit is twips, as Impress sets the +origin already. + +Change-Id: Idf340944165e44b0888c00965d6be7798712ff76 +(cherry picked from commit e988ab84f1c32519bfca758086c749ba98a5a85f) +--- + editeng/source/editeng/impedit.cxx | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx +index f7e2886c0524..8038ac6d3d41 100644 +--- a/editeng/source/editeng/impedit.cxx ++++ b/editeng/source/editeng/impedit.cxx +@@ -947,6 +947,13 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor, sal_uInt16 + // LOK output is always in twips, convert from mm100 if necessary. + if (pOutWin->GetMapMode().GetMapUnit() == MAP_100TH_MM) + aRect = OutputDevice::LogicToLogic(aRect, MAP_100TH_MM, MAP_TWIP); ++ else if (pOutWin->GetMapMode().GetMapUnit() == MAP_TWIP) ++ { ++ // Writer comments: they use editeng, but are separate widgets. ++ Point aOrigin = pOutWin->GetMapMode().GetOrigin(); ++ // Move the rectangle, so that we output absolute twips. ++ aRect.Move(aOrigin.getX(), aOrigin.getY()); ++ } + // Let the LOK client decide the cursor width. + aRect.setWidth(0); + +-- +2.12.0 + diff --git a/SOURCES/0323-sw-lok-fix-blinking-cursor-position-of-comments.patch b/SOURCES/0323-sw-lok-fix-blinking-cursor-position-of-comments.patch new file mode 100644 index 0000000..3ea0171 --- /dev/null +++ b/SOURCES/0323-sw-lok-fix-blinking-cursor-position-of-comments.patch @@ -0,0 +1,155 @@ +From 0964ec395a33e8299a5caebb122c73687d1b428e Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 13 Nov 2015 13:33:32 +0100 +Subject: [PATCH 323/398] sw lok: fix blinking cursor position of comments + +With this, it is possible to click inside a comment (and get a blinking +cursor inside a comment), and also possible to use the arrow keys to +native around and still get correct blinking cursor position. + +(cherry picked from commit 5fb91dfd804cd6f3d585bb4113b9a68083ac71ee) + +Change-Id: I29eb1e60e4e571151f0b18bec8cf765ea09af09f +--- + sw/inc/SidebarWin.hxx | 5 ++-- + sw/source/uibase/docvw/PostItMgr.cxx | 4 ++-- + sw/source/uibase/docvw/SidebarTxtControl.hxx | 2 +- + sw/source/uibase/docvw/SidebarWin.cxx | 36 ++++++++++++++++++++++++---- + sw/source/uibase/docvw/edtwin.cxx | 7 ------ + 5 files changed, 38 insertions(+), 16 deletions(-) + +diff --git a/sw/inc/SidebarWin.hxx b/sw/inc/SidebarWin.hxx +index c41352749c28..e3899d5a1a8b 100644 +--- a/sw/inc/SidebarWin.hxx ++++ b/sw/inc/SidebarWin.hxx +@@ -179,9 +179,10 @@ class SwSidebarWin : public vcl::Window + + virtual void Draw(OutputDevice* pDev, const Point&, const Size&, sal_uLong) override; + virtual void KeyInput(const KeyEvent& rKeyEvt) override; ++ virtual void MouseButtonDown(const MouseEvent& rMouseEvent) override; + void PaintTile(vcl::RenderContext& rRenderContext, const Rectangle& rRect); +- /// Get the matching sub-widget inside this sidebar widget for rPointLogic, if any. +- vcl::Window* IsHitWindow(const Point& rPointLogic); ++ /// Is there a matching sub-widget inside this sidebar widget for rPointLogic? ++ bool IsHitWindow(const Point& rPointLogic); + + protected: + virtual void DataChanged( const DataChangedEvent& aEvent) SAL_OVERRIDE; +diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx +index 703a433a44ee..871a642d24da 100644 +--- a/sw/source/uibase/docvw/PostItMgr.cxx ++++ b/sw/source/uibase/docvw/PostItMgr.cxx +@@ -1736,9 +1736,9 @@ vcl::Window* SwPostItMgr::IsHitSidebarWindow(const Point& rPointLogic) + if (!pPostIt) + continue; + +- if (vcl::Window* pWindow = pPostIt->IsHitWindow(rPointLogic)) ++ if (pPostIt->IsHitWindow(rPointLogic)) + { +- pRet = pWindow; ++ pRet = pPostIt; + break; + } + } +diff --git a/sw/source/uibase/docvw/SidebarTxtControl.hxx b/sw/source/uibase/docvw/SidebarTxtControl.hxx +index 4f47ef4a2177..43d6b98d82c1 100644 +--- a/sw/source/uibase/docvw/SidebarTxtControl.hxx ++++ b/sw/source/uibase/docvw/SidebarTxtControl.hxx +@@ -41,7 +41,6 @@ class SidebarTextControl : public Control + protected: + virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE; + virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE; +- virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; + virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE; + virtual void Command( const CommandEvent& rCEvt ) SAL_OVERRIDE; + virtual void LoseFocus() SAL_OVERRIDE; +@@ -61,6 +60,7 @@ class SidebarTextControl : public Control + + virtual void GetFocus() override; + virtual void KeyInput( const KeyEvent& rKeyEvt ) override; ++ virtual void MouseButtonDown(const MouseEvent& rMouseEvent) override; + + OutlinerView* GetTextView() const; + +diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx +index a40c82de5470..dd8d2a6003b9 100644 +--- a/sw/source/uibase/docvw/SidebarWin.cxx ++++ b/sw/source/uibase/docvw/SidebarWin.cxx +@@ -280,12 +280,10 @@ void SwSidebarWin::PaintTile(vcl::RenderContext& rRenderContext, const Rectangle + rRenderContext.Push(PushFlags::NONE); + } + +-vcl::Window* SwSidebarWin::IsHitWindow(const Point& rPointLogic) ++bool SwSidebarWin::IsHitWindow(const Point& rPointLogic) + { + Rectangle aRectangleLogic(EditWin()->PixelToLogic(GetPosPixel()), EditWin()->PixelToLogic(GetSizePixel())); +- if (aRectangleLogic.IsInside(rPointLogic)) +- return mpSidebarTextControl; +- return 0; ++ return aRectangleLogic.IsInside(rPointLogic); + } + + void SwSidebarWin::Draw(OutputDevice* pDev, const Point& rPt, const Size& rSz, sal_uLong nInFlags) +@@ -356,10 +354,40 @@ void SwSidebarWin::Draw(OutputDevice* pDev, const Point& rPt, const Size& rSz, s + } + } + ++/// We want to work in absolute twips: so set delta between rChild and rParent as origin on rChild, then disable map mode on rChild. ++static void lcl_setAbsoluteTwips(vcl::Window& rParent, vcl::Window& rChild) ++{ ++ Point aOffset(rChild.GetOutOffXPixel() - rParent.GetOutOffXPixel(), rChild.GetOutOffYPixel() - rParent.GetOutOffYPixel()); ++ MapMode aMapMode(rChild.GetMapMode()); ++ aMapMode.SetOrigin(rChild.PixelToLogic(aOffset)); ++ rChild.SetMapMode(aMapMode); ++ rChild.EnableMapMode(false); ++} ++ + void SwSidebarWin::KeyInput(const KeyEvent& rKeyEvent) + { + if (mpSidebarTextControl) ++ { ++ mpSidebarTextControl->Push(PushFlags::MAPMODE); ++ lcl_setAbsoluteTwips(*EditWin(), *mpSidebarTextControl); ++ + mpSidebarTextControl->KeyInput(rKeyEvent); ++ ++ mpSidebarTextControl->Pop(); ++ } ++} ++ ++void SwSidebarWin::MouseButtonDown(const MouseEvent& rMouseEvent) ++{ ++ if (mpSidebarTextControl) ++ { ++ mpSidebarTextControl->Push(PushFlags::MAPMODE); ++ lcl_setAbsoluteTwips(*EditWin(), *mpSidebarTextControl); ++ ++ mpSidebarTextControl->MouseButtonDown(rMouseEvent); ++ ++ mpSidebarTextControl->Pop(); ++ } + } + + void SwSidebarWin::SetPosSizePixelRect(long nX, long nY, long nWidth, long nHeight, +diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx +index 10cdc0dca561..53d0afd38f94 100644 +--- a/sw/source/uibase/docvw/edtwin.cxx ++++ b/sw/source/uibase/docvw/edtwin.cxx +@@ -2771,14 +2771,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) + { + if (vcl::Window* pWindow = m_rView.GetPostItMgr()->IsHitSidebarWindow(rMEvt.GetPosPixel())) + { +- bool bDisableMapMode = pWindow->IsMapModeEnabled(); +- if (bDisableMapMode) +- pWindow->EnableMapMode(false); +- + pWindow->MouseButtonDown(rMEvt); +- +- if (bDisableMapMode) +- pWindow->EnableMapMode(); + return; + } + } +-- +2.12.0 + diff --git a/SOURCES/0324-editeng-lok-respect-origin-of-map-mode-for-TEXT_SELE.patch b/SOURCES/0324-editeng-lok-respect-origin-of-map-mode-for-TEXT_SELE.patch new file mode 100644 index 0000000..6995a41 --- /dev/null +++ b/SOURCES/0324-editeng-lok-respect-origin-of-map-mode-for-TEXT_SELE.patch @@ -0,0 +1,77 @@ +From 72385a1ddf68d7c30813b7ca964850c96850a8de Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 13 Nov 2015 14:42:35 +0100 +Subject: [PATCH 324/398] editeng lok: respect origin of map mode for + TEXT_SELECTION + +With this, selections of Writer comment text show up at the correct +position, not at the top left corner of the window. + +(cherry picked from commit 22e97c130868fe7d7529cfcfb2a240f775bd8916) + +Change-Id: If865503d9a02a27730e382d65c42c706dd533a93 +--- + editeng/source/editeng/impedit.cxx | 18 +++++++++++++----- + 1 file changed, 13 insertions(+), 5 deletions(-) + +diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx +index 8038ac6d3d41..0207155e4d75 100644 +--- a/editeng/source/editeng/impedit.cxx ++++ b/editeng/source/editeng/impedit.cxx +@@ -24,6 +24,7 @@ + #include + + #include ++#include + #include + #include + #include +@@ -327,6 +328,12 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou + if (isTiledRendering() && !pOldRegion) + { + bool bMm100ToTwip = pOutWin->GetMapMode().GetMapUnit() == MAP_100TH_MM; ++ ++ Point aOrigin; ++ if (pOutWin->GetMapMode().GetMapUnit() == MAP_TWIP) ++ // Writer comments: they use editeng, but are separate widgets. ++ aOrigin = pOutWin->GetMapMode().GetOrigin(); ++ + OString sRectangle; + // If we are not in selection mode, then the exported selection should be empty. + if (pEditEngine->pImpEditEngine->IsInSelectionMode()) +@@ -340,26 +347,27 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou + Rectangle aStart = Rectangle(rStart.Left(), rStart.Top(), rStart.Left() + 1, rStart.Bottom()); + if (bMm100ToTwip) + aStart = OutputDevice::LogicToLogic(aStart, MAP_100TH_MM, MAP_TWIP); ++ aStart.Move(aOrigin.getX(), aOrigin.getY()); + libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_START, aStart.toString().getStr()); + + Rectangle& rEnd = aRectangles.back(); + Rectangle aEnd = Rectangle(rEnd.Right() - 1, rEnd.Top(), rEnd.Right(), rEnd.Bottom()); + if (bMm100ToTwip) + aEnd = OutputDevice::LogicToLogic(aEnd, MAP_100TH_MM, MAP_TWIP); ++ aEnd.Move(aOrigin.getX(), aOrigin.getY()); + libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_END, aEnd.toString().getStr()); + } + +- std::stringstream ss; ++ std::vector v; + for (size_t i = 0; i < aRectangles.size(); ++i) + { + Rectangle& rRectangle = aRectangles[i]; +- if (i) +- ss << "; "; + if (bMm100ToTwip) + rRectangle = OutputDevice::LogicToLogic(rRectangle, MAP_100TH_MM, MAP_TWIP); +- ss << rRectangle.toString().getStr(); ++ rRectangle.Move(aOrigin.getX(), aOrigin.getY()); ++ v.push_back(rRectangle.toString().getStr()); + } +- sRectangle = ss.str().c_str(); ++ sRectangle = comphelper::string::join("; ", v); + } + libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, sRectangle.getStr()); + } +-- +2.12.0 + diff --git a/SOURCES/0325-sw-lok-disable-comment-menu-button-for-now.patch b/SOURCES/0325-sw-lok-disable-comment-menu-button-for-now.patch new file mode 100644 index 0000000..360c74c --- /dev/null +++ b/SOURCES/0325-sw-lok-disable-comment-menu-button-for-now.patch @@ -0,0 +1,29 @@ +From 4973a1ce9a3ee710f840fb39fb5e3a08f2f54005 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 13 Nov 2015 14:51:13 +0100 +Subject: [PATCH 325/398] sw lok: disable comment menu button for now + +Change-Id: Ic052544b2835181652732b8de9eaf79572a9db6e +(cherry picked from commit 022c716fc89c7315a7c454c01e2fe70d5aece289) +--- + sw/source/uibase/docvw/SidebarWin.cxx | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx +index dd8d2a6003b9..47f5022e8044 100644 +--- a/sw/source/uibase/docvw/SidebarWin.cxx ++++ b/sw/source/uibase/docvw/SidebarWin.cxx +@@ -253,6 +253,10 @@ void SwSidebarWin::PaintTile(vcl::RenderContext& rRenderContext, const Rectangle + if (pChild == mpVScrollbar.get()) + continue; + ++ // No point in showing this button till click on it are not handled. ++ if (pChild == mpMenuButton.get()) ++ continue; ++ + rRenderContext.Push(PushFlags::MAPMODE); + Point aOffset(PixelToLogic(pChild->GetPosPixel())); + MapMode aMapMode(rRenderContext.GetMapMode()); +-- +2.12.0 + diff --git a/SOURCES/0326-sw-lok-comments-fix-position-of-blinking-cursor-afte.patch b/SOURCES/0326-sw-lok-comments-fix-position-of-blinking-cursor-afte.patch new file mode 100644 index 0000000..e2e478c --- /dev/null +++ b/SOURCES/0326-sw-lok-comments-fix-position-of-blinking-cursor-afte.patch @@ -0,0 +1,79 @@ +From 4bd7e435c3476b7d267755b9e53ed7d35ce78220 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 13 Nov 2015 17:30:22 +0100 +Subject: [PATCH 326/398] sw lok comments: fix position of blinking cursor + after mouse click + +LOK always works in absolute twips (origo being the top left corner of +SwEditWin), so not only the callbacks have to translate relative twips +to absolute ones, but the opposite have to be done for mouse event +coordinates. + +With this, clicking at a random position inside a comment places the +blinking cursor at a reasonable position, not always at 0,0. + +(cherry picked from commit 57972554b58a680f47a05f4d6711c99106f80523) + +Change-Id: Ic8d20f177acd9e1908acf17698c53a1470bd4aec +--- + sw/source/uibase/docvw/SidebarWin.cxx | 24 ++++++++++++++++++------ + 1 file changed, 18 insertions(+), 6 deletions(-) + +diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx +index 47f5022e8044..71b763b84224 100644 +--- a/sw/source/uibase/docvw/SidebarWin.cxx ++++ b/sw/source/uibase/docvw/SidebarWin.cxx +@@ -358,14 +358,25 @@ void SwSidebarWin::Draw(OutputDevice* pDev, const Point& rPt, const Size& rSz, s + } + } + +-/// We want to work in absolute twips: so set delta between rChild and rParent as origin on rChild, then disable map mode on rChild. +-static void lcl_setAbsoluteTwips(vcl::Window& rParent, vcl::Window& rChild) ++/// Translate absolute <-> relative twips: LOK wants absolute coordinates as output and gives absolute coordinates as input. ++static void lcl_translateTwips(vcl::Window& rParent, vcl::Window& rChild, MouseEvent* pMouseEvent) + { ++ // Set map mode, so that callback payloads will contain absolute coordinates instead of relative ones. + Point aOffset(rChild.GetOutOffXPixel() - rParent.GetOutOffXPixel(), rChild.GetOutOffYPixel() - rParent.GetOutOffYPixel()); ++ aOffset = rChild.PixelToLogic(aOffset); + MapMode aMapMode(rChild.GetMapMode()); +- aMapMode.SetOrigin(rChild.PixelToLogic(aOffset)); ++ aMapMode.SetOrigin(aOffset); + rChild.SetMapMode(aMapMode); + rChild.EnableMapMode(false); ++ ++ if (pMouseEvent) ++ { ++ // Set event coordinates, so they contain relative coordinates instead of absolute ones. ++ Point aPos = pMouseEvent->GetPosPixel(); ++ aPos.Move(-aOffset.getX(), -aOffset.getY()); ++ MouseEvent aMouseEvent(aPos, pMouseEvent->GetClicks(), pMouseEvent->GetMode(), pMouseEvent->GetButtons(), pMouseEvent->GetModifier()); ++ *pMouseEvent = aMouseEvent; ++ } + } + + void SwSidebarWin::KeyInput(const KeyEvent& rKeyEvent) +@@ -373,7 +384,7 @@ void SwSidebarWin::KeyInput(const KeyEvent& rKeyEvent) + if (mpSidebarTextControl) + { + mpSidebarTextControl->Push(PushFlags::MAPMODE); +- lcl_setAbsoluteTwips(*EditWin(), *mpSidebarTextControl); ++ lcl_translateTwips(*EditWin(), *mpSidebarTextControl, nullptr); + + mpSidebarTextControl->KeyInput(rKeyEvent); + +@@ -386,9 +397,10 @@ void SwSidebarWin::MouseButtonDown(const MouseEvent& rMouseEvent) + if (mpSidebarTextControl) + { + mpSidebarTextControl->Push(PushFlags::MAPMODE); +- lcl_setAbsoluteTwips(*EditWin(), *mpSidebarTextControl); ++ MouseEvent aMouseEvent(rMouseEvent); ++ lcl_translateTwips(*EditWin(), *mpSidebarTextControl, &aMouseEvent); + +- mpSidebarTextControl->MouseButtonDown(rMouseEvent); ++ mpSidebarTextControl->MouseButtonDown(aMouseEvent); + + mpSidebarTextControl->Pop(); + } +-- +2.12.0 + diff --git a/SOURCES/0327-sw-lok-comments-emit-invalidation-events-in-SidebarT.patch b/SOURCES/0327-sw-lok-comments-emit-invalidation-events-in-SidebarT.patch new file mode 100644 index 0000000..0d4cbff --- /dev/null +++ b/SOURCES/0327-sw-lok-comments-emit-invalidation-events-in-SidebarT.patch @@ -0,0 +1,84 @@ +From 08ca67b7742364ecdc8bf7928ce2ef058da0e37e Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Sat, 14 Nov 2015 10:04:38 +0100 +Subject: [PATCH 327/398] sw lok comments: emit invalidation events in + SidebarTextControl + +With this, newly typed characters show up instantly in comments, not +only after changing the zoom level. + +(cherry picked from commit 4cbbaf571d3982eccd7f7267df3185b3d321d0da) + +Change-Id: I1470db1ec03cc415917375f1f95434cf0944e559 +--- + sw/source/uibase/docvw/SidebarTxtControl.cxx | 26 ++++++++++++++++++++++++++ + sw/source/uibase/docvw/SidebarTxtControl.hxx | 2 ++ + 2 files changed, 28 insertions(+) + +diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx +index afda8b1952ad..d6887a475312 100644 +--- a/sw/source/uibase/docvw/SidebarTxtControl.cxx ++++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx +@@ -23,6 +23,7 @@ + + #include + #include ++#include + + #include + #include +@@ -46,6 +47,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -186,6 +188,30 @@ void SidebarTextControl::Paint(vcl::RenderContext& rRenderContext, const Rectang + } + } + ++void SidebarTextControl::LogicInvalidate(const Rectangle* pRectangle) ++{ ++ OString sRectangle; ++ if (!pRectangle) ++ sRectangle = "EMPTY"; ++ else ++ { ++ // Convert from relative twips to absolute ones. ++ Rectangle aRectangle(*pRectangle); ++ vcl::Window& rParent = *mrSidebarWin.EditWin(); ++ Point aOffset(GetOutOffXPixel() - rParent.GetOutOffXPixel(), GetOutOffYPixel() - rParent.GetOutOffYPixel()); ++ rParent.Push(PushFlags::MAPMODE); ++ rParent.EnableMapMode(); ++ aOffset = rParent.PixelToLogic(aOffset); ++ rParent.Pop(); ++ aRectangle.Move(aOffset.getX(), aOffset.getY()); ++ ++ sRectangle = aRectangle.toString(); ++ } ++ ++ SwWrtShell& rWrtShell = mrDocView.GetWrtShell(); ++ rWrtShell.libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); ++} ++ + void SidebarTextControl::KeyInput( const KeyEvent& rKeyEvt ) + { + const vcl::KeyCode& rKeyCode = rKeyEvt.GetKeyCode(); +diff --git a/sw/source/uibase/docvw/SidebarTxtControl.hxx b/sw/source/uibase/docvw/SidebarTxtControl.hxx +index 43d6b98d82c1..f73b68c950ae 100644 +--- a/sw/source/uibase/docvw/SidebarTxtControl.hxx ++++ b/sw/source/uibase/docvw/SidebarTxtControl.hxx +@@ -40,6 +40,8 @@ class SidebarTextControl : public Control + + protected: + virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE; ++ /// @see OutputDevice::LogicInvalidate(). ++ void LogicInvalidate(const Rectangle* pRectangle) override; + virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE; + virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE; + virtual void Command( const CommandEvent& rCEvt ) SAL_OVERRIDE; +-- +2.12.0 + diff --git a/SOURCES/0328-sw-lok-comments-implement-setTextSelection-API.patch b/SOURCES/0328-sw-lok-comments-implement-setTextSelection-API.patch new file mode 100644 index 0000000..ef501e3 --- /dev/null +++ b/SOURCES/0328-sw-lok-comments-implement-setTextSelection-API.patch @@ -0,0 +1,139 @@ +From 03db067b74739dabe787dbce6af1f4b776ce888a Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Sat, 14 Nov 2015 10:37:45 +0100 +Subject: [PATCH 328/398] sw lok comments: implement setTextSelection() API + +So that it's possible to drag the text selection start/end handles in +comment text when there is an existing selection. + +(cherry picked from commit e320d070bb0d4dd0ceb696f2c7cc5afb7c4273c3) + +Change-Id: I3acc4770928d4f385f0ca09a2484a9e112409907 +--- + sw/inc/SidebarWin.hxx | 2 ++ + sw/source/uibase/docvw/SidebarWin.cxx | 60 +++++++++++++++++++++++------------ + sw/source/uibase/docvw/edtwin.cxx | 10 ++++++ + 3 files changed, 51 insertions(+), 21 deletions(-) + +diff --git a/sw/inc/SidebarWin.hxx b/sw/inc/SidebarWin.hxx +index e3899d5a1a8b..503f8f8a9771 100644 +--- a/sw/inc/SidebarWin.hxx ++++ b/sw/inc/SidebarWin.hxx +@@ -183,6 +183,8 @@ class SwSidebarWin : public vcl::Window + void PaintTile(vcl::RenderContext& rRenderContext, const Rectangle& rRect); + /// Is there a matching sub-widget inside this sidebar widget for rPointLogic? + bool IsHitWindow(const Point& rPointLogic); ++ /// Allows adjusting the point or mark of the selection to a document coordinate. ++ void SetCursorLogicPosition(const Point& rPosition, bool bPoint, bool bClearMark); + + protected: + virtual void DataChanged( const DataChangedEvent& aEvent) SAL_OVERRIDE; +diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx +index 71b763b84224..721ef95e4acf 100644 +--- a/sw/source/uibase/docvw/SidebarWin.cxx ++++ b/sw/source/uibase/docvw/SidebarWin.cxx +@@ -83,6 +83,32 @@ + #include + #include + ++namespace ++{ ++ ++/// Translate absolute <-> relative twips: LOK wants absolute coordinates as output and gives absolute coordinates as input. ++void lcl_translateTwips(vcl::Window& rParent, vcl::Window& rChild, MouseEvent* pMouseEvent) ++{ ++ // Set map mode, so that callback payloads will contain absolute coordinates instead of relative ones. ++ Point aOffset(rChild.GetOutOffXPixel() - rParent.GetOutOffXPixel(), rChild.GetOutOffYPixel() - rParent.GetOutOffYPixel()); ++ aOffset = rChild.PixelToLogic(aOffset); ++ MapMode aMapMode(rChild.GetMapMode()); ++ aMapMode.SetOrigin(aOffset); ++ rChild.SetMapMode(aMapMode); ++ rChild.EnableMapMode(false); ++ ++ if (pMouseEvent) ++ { ++ // Set event coordinates, so they contain relative coordinates instead of absolute ones. ++ Point aPos = pMouseEvent->GetPosPixel(); ++ aPos.Move(-aOffset.getX(), -aOffset.getY()); ++ MouseEvent aMouseEvent(aPos, pMouseEvent->GetClicks(), pMouseEvent->GetMode(), pMouseEvent->GetButtons(), pMouseEvent->GetModifier()); ++ *pMouseEvent = aMouseEvent; ++ } ++} ++ ++} ++ + namespace sw { namespace sidebarwindows { + + #define METABUTTON_WIDTH 16 +@@ -290,6 +316,19 @@ bool SwSidebarWin::IsHitWindow(const Point& rPointLogic) + return aRectangleLogic.IsInside(rPointLogic); + } + ++void SwSidebarWin::SetCursorLogicPosition(const Point& rPosition, bool bPoint, bool bClearMark) ++{ ++ mpSidebarTextControl->Push(PushFlags::MAPMODE); ++ MouseEvent aMouseEvent(rPosition); ++ lcl_translateTwips(*EditWin(), *mpSidebarTextControl, &aMouseEvent); ++ Point aPosition(aMouseEvent.GetPosPixel()); ++ ++ EditView& rEditView = GetOutlinerView()->GetEditView(); ++ rEditView.SetCursorLogicPosition(aPosition, bPoint, bClearMark); ++ ++ mpSidebarTextControl->Pop(); ++} ++ + void SwSidebarWin::Draw(OutputDevice* pDev, const Point& rPt, const Size& rSz, sal_uLong nInFlags) + { + if (mpMetadataAuthor->IsVisible() ) +@@ -358,27 +397,6 @@ void SwSidebarWin::Draw(OutputDevice* pDev, const Point& rPt, const Size& rSz, s + } + } + +-/// Translate absolute <-> relative twips: LOK wants absolute coordinates as output and gives absolute coordinates as input. +-static void lcl_translateTwips(vcl::Window& rParent, vcl::Window& rChild, MouseEvent* pMouseEvent) +-{ +- // Set map mode, so that callback payloads will contain absolute coordinates instead of relative ones. +- Point aOffset(rChild.GetOutOffXPixel() - rParent.GetOutOffXPixel(), rChild.GetOutOffYPixel() - rParent.GetOutOffYPixel()); +- aOffset = rChild.PixelToLogic(aOffset); +- MapMode aMapMode(rChild.GetMapMode()); +- aMapMode.SetOrigin(aOffset); +- rChild.SetMapMode(aMapMode); +- rChild.EnableMapMode(false); +- +- if (pMouseEvent) +- { +- // Set event coordinates, so they contain relative coordinates instead of absolute ones. +- Point aPos = pMouseEvent->GetPosPixel(); +- aPos.Move(-aOffset.getX(), -aOffset.getY()); +- MouseEvent aMouseEvent(aPos, pMouseEvent->GetClicks(), pMouseEvent->GetMode(), pMouseEvent->GetButtons(), pMouseEvent->GetModifier()); +- *pMouseEvent = aMouseEvent; +- } +-} +- + void SwSidebarWin::KeyInput(const KeyEvent& rKeyEvent) + { + if (mpSidebarTextControl) +diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx +index 53d0afd38f94..b9777914c5b4 100644 +--- a/sw/source/uibase/docvw/edtwin.cxx ++++ b/sw/source/uibase/docvw/edtwin.cxx +@@ -6299,6 +6299,16 @@ void SwEditWin::SetCursorTwipPosition(const Point& rPosition, bool bPoint, bool + } + } + ++ if (m_rView.GetPostItMgr()) ++ { ++ if (sw::sidebarwindows::SwSidebarWin* pWin = m_rView.GetPostItMgr()->GetActiveSidebarWin()) ++ { ++ // Editing postit text. ++ pWin->SetCursorLogicPosition(rPosition, bPoint, bClearMark); ++ return; ++ } ++ } ++ + // Not an SwWrtShell, as that would make SwCrsrShell::GetCrsr() inaccessible. + SwEditShell& rShell = m_rView.GetWrtShell(); + +-- +2.12.0 + diff --git a/SOURCES/0329-sw-lok-comments-fix-callback-of-newly-created-outlin.patch b/SOURCES/0329-sw-lok-comments-fix-callback-of-newly-created-outlin.patch new file mode 100644 index 0000000..d222239 --- /dev/null +++ b/SOURCES/0329-sw-lok-comments-fix-callback-of-newly-created-outlin.patch @@ -0,0 +1,83 @@ +From d82649ea6f8232d52e1fe4e48ad6ccf1668418a8 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Sat, 14 Nov 2015 11:06:08 +0100 +Subject: [PATCH 329/398] sw lok comments: fix callback of newly created + outliner views + +SwPostItMgr::registerLibreOfficeKitCallback() already took care of +informing existing outliners, this commit gives a callback to newly +registered ones as well. + +(cherry picked from commit dacc616f7020d045a1cfdb3806436e06046dae10) + +Change-Id: I660dcb54231a9d404bf80b4284003d119dae6a5c +--- + sw/inc/drawdoc.hxx | 2 ++ + sw/source/core/draw/drawdoc.cxx | 6 ++++++ + sw/source/uibase/docvw/SidebarWin.cxx | 13 +++++++++++++ + 3 files changed, 21 insertions(+) + +diff --git a/sw/inc/drawdoc.hxx b/sw/inc/drawdoc.hxx +index bad9c0ca41a1..bbf079911656 100644 +--- a/sw/inc/drawdoc.hxx ++++ b/sw/inc/drawdoc.hxx +@@ -42,6 +42,8 @@ public: + + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::embed::XStorage> GetDocumentStorage() const SAL_OVERRIDE; ++ /// Get the callback and callback data, previously given to registerLibreOfficeKitCallback(). ++ void getLibreOfficeKitCallback(LibreOfficeKitCallback& rCallback, void*& rLibreOfficeKitData); + + /// For saving of rectangles as control-replacement for versions < 5.0. + virtual SdrLayerID GetControlExportLayerId( const SdrObject & ) const SAL_OVERRIDE; +diff --git a/sw/source/core/draw/drawdoc.cxx b/sw/source/core/draw/drawdoc.cxx +index efd0bb1f163d..7f352c981890 100644 +--- a/sw/source/core/draw/drawdoc.cxx ++++ b/sw/source/core/draw/drawdoc.cxx +@@ -126,6 +126,12 @@ uno::Reference SwDrawModel::GetDocumentStorage() const + return m_pDoc->GetDocStorage(); + } + ++void SwDrawModel::getLibreOfficeKitCallback(LibreOfficeKitCallback& rCallback, void*& rLibreOfficeKitData) ++{ ++ rCallback = mpLibreOfficeKitCallback; ++ rLibreOfficeKitData = mpLibreOfficeKitData; ++} ++ + SdrLayerID SwDrawModel::GetControlExportLayerId( const SdrObject & ) const + { + //for versions < 5.0, there was only Hell and Heaven +diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx +index 721ef95e4acf..32d8b78815ae 100644 +--- a/sw/source/uibase/docvw/SidebarWin.cxx ++++ b/sw/source/uibase/docvw/SidebarWin.cxx +@@ -82,6 +82,8 @@ + #include + #include + #include ++#include ++#include + + namespace + { +@@ -532,6 +534,17 @@ void SwSidebarWin::InitControls() + + mpOutlinerView->SetAttribs(DefaultItem()); + ++ if (comphelper::LibreOfficeKit::isActive()) ++ { ++ // If there is a callback already registered, inform the new outliner view about it. ++ SwDrawModel* pDrawModel = mrView.GetWrtShellPtr()->getIDocumentDrawModelAccess()->GetDrawModel(); ++ LibreOfficeKitCallback pCallback = 0; ++ void* pData = 0; ++ pDrawModel->getLibreOfficeKitCallback(pCallback, pData); ++ mpOutlinerView->setTiledRendering(mrView.GetWrtShellPtr()->isTiledRendering()); ++ mpOutlinerView->registerLibreOfficeKitCallback(pCallback, pData); ++ } ++ + //create Scrollbars + mpVScrollbar = VclPtr::Create(this, WB_3DLOOK |WB_VSCROLL|WB_DRAG); + mpVScrollbar->EnableNativeWidget(false); +-- +2.12.0 + diff --git a/SOURCES/0330-sw-lok-comments-fix-cursor-position-of-a-newly-creat.patch b/SOURCES/0330-sw-lok-comments-fix-cursor-position-of-a-newly-creat.patch new file mode 100644 index 0000000..509c6fa --- /dev/null +++ b/SOURCES/0330-sw-lok-comments-fix-cursor-position-of-a-newly-creat.patch @@ -0,0 +1,47 @@ +From bade9dc2b36b7ee92fa9ada8e033639a8c49a593 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Sat, 14 Nov 2015 13:39:02 +0100 +Subject: [PATCH 330/398] sw lok comments: fix cursor position of a newly + created sidebar window + +With this, pressing ctrl-alt-c to create a new comment has the correct +cursor position. + +Change-Id: Icb8d708dab015d8ffa9bcfe28de66238a75b50bc +(cherry picked from commit d78432e9a077725046419902c542ce4e5f515705) +--- + sw/source/uibase/docvw/SidebarWin.cxx | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx +index 32d8b78815ae..cf803b618263 100644 +--- a/sw/source/uibase/docvw/SidebarWin.cxx ++++ b/sw/source/uibase/docvw/SidebarWin.cxx +@@ -666,7 +666,24 @@ void SwSidebarWin::SetPosAndSize() + { + bChange = true; + SetSizePixel(mPosSize.GetSize()); ++ ++ if (comphelper::LibreOfficeKit::isActive()) ++ { ++ // Position is not yet set at VCL level, but the map mode should ++ // contain the right origin to emit the correct cursor position. ++ mpSidebarTextControl->Push(PushFlags::MAPMODE); ++ Point aOffset(mPosSize.Left(), mPosSize.Top()); ++ aOffset = PixelToLogic(aOffset); ++ MapMode aMapMode(mpSidebarTextControl->GetMapMode()); ++ aMapMode.SetOrigin(aOffset); ++ mpSidebarTextControl->SetMapMode(aMapMode); ++ mpSidebarTextControl->EnableMapMode(false); ++ } ++ + DoResize(); ++ ++ if (comphelper::LibreOfficeKit::isActive()) ++ mpSidebarTextControl->Pop(); + } + + if (GetPosPixel().X() != mPosSize.TopLeft().X() || (std::abs(GetPosPixel().Y() - mPosSize.TopLeft().Y()) > 5) ) +-- +2.12.0 + diff --git a/SOURCES/0331-sw-lok-comments-implement-mouse-move-and-mouse-up.patch b/SOURCES/0331-sw-lok-comments-implement-mouse-move-and-mouse-up.patch new file mode 100644 index 0000000..c4ab333 --- /dev/null +++ b/SOURCES/0331-sw-lok-comments-implement-mouse-move-and-mouse-up.patch @@ -0,0 +1,164 @@ +From 21874265eac2c8f10f560941079fe651e097b9d4 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Sat, 14 Nov 2015 14:42:26 +0100 +Subject: [PATCH 331/398] sw lok comments: implement mouse move and mouse up + +As long as we don't tweak the map mode of the comment widgets +permanently we also have to disable the selection engine's timer, as +that would emit events without the correct map mode: so disable that for +the LOK case for now. + +(cherry picked from commit b3dc0d7c72c2bb997bfceaeaf25dc9153ceca244) + +Change-Id: If377ff2f064c30feb473f153f9d5b29b8ace7113 +--- + sw/inc/SidebarWin.hxx | 2 ++ + sw/source/uibase/docvw/SidebarTxtControl.hxx | 4 ++-- + sw/source/uibase/docvw/SidebarWin.cxx | 28 ++++++++++++++++++++++++++++ + sw/source/uibase/docvw/edtwin.cxx | 18 ++++++++++++++++++ + vcl/source/window/seleng.cxx | 5 ++++- + 5 files changed, 54 insertions(+), 3 deletions(-) + +diff --git a/sw/inc/SidebarWin.hxx b/sw/inc/SidebarWin.hxx +index 503f8f8a9771..e647c7aca820 100644 +--- a/sw/inc/SidebarWin.hxx ++++ b/sw/inc/SidebarWin.hxx +@@ -180,6 +180,8 @@ class SwSidebarWin : public vcl::Window + virtual void Draw(OutputDevice* pDev, const Point&, const Size&, sal_uLong) override; + virtual void KeyInput(const KeyEvent& rKeyEvt) override; + virtual void MouseButtonDown(const MouseEvent& rMouseEvent) override; ++ virtual void MouseButtonUp(const MouseEvent& rMouseEvent) override; ++ virtual void MouseMove(const MouseEvent& rMouseEvent) override; + void PaintTile(vcl::RenderContext& rRenderContext, const Rectangle& rRect); + /// Is there a matching sub-widget inside this sidebar widget for rPointLogic? + bool IsHitWindow(const Point& rPointLogic); +diff --git a/sw/source/uibase/docvw/SidebarTxtControl.hxx b/sw/source/uibase/docvw/SidebarTxtControl.hxx +index f73b68c950ae..ab2f7406bce2 100644 +--- a/sw/source/uibase/docvw/SidebarTxtControl.hxx ++++ b/sw/source/uibase/docvw/SidebarTxtControl.hxx +@@ -42,8 +42,6 @@ class SidebarTextControl : public Control + virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE; + /// @see OutputDevice::LogicInvalidate(). + void LogicInvalidate(const Rectangle* pRectangle) override; +- virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE; +- virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE; + virtual void Command( const CommandEvent& rCEvt ) SAL_OVERRIDE; + virtual void LoseFocus() SAL_OVERRIDE; + virtual void RequestHelp(const HelpEvent &rEvt) SAL_OVERRIDE; +@@ -63,6 +61,8 @@ class SidebarTextControl : public Control + virtual void GetFocus() override; + virtual void KeyInput( const KeyEvent& rKeyEvt ) override; + virtual void MouseButtonDown(const MouseEvent& rMouseEvent) override; ++ virtual void MouseButtonUp(const MouseEvent& rMEvt) override; ++ virtual void MouseMove(const MouseEvent& rMEvt) override; + + OutlinerView* GetTextView() const; + +diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx +index cf803b618263..f9163a80f44b 100644 +--- a/sw/source/uibase/docvw/SidebarWin.cxx ++++ b/sw/source/uibase/docvw/SidebarWin.cxx +@@ -412,6 +412,20 @@ void SwSidebarWin::KeyInput(const KeyEvent& rKeyEvent) + } + } + ++void SwSidebarWin::MouseMove(const MouseEvent& rMouseEvent) ++{ ++ if (mpSidebarTextControl) ++ { ++ mpSidebarTextControl->Push(PushFlags::MAPMODE); ++ MouseEvent aMouseEvent(rMouseEvent); ++ lcl_translateTwips(*EditWin(), *mpSidebarTextControl, &aMouseEvent); ++ ++ mpSidebarTextControl->MouseMove(aMouseEvent); ++ ++ mpSidebarTextControl->Pop(); ++ } ++} ++ + void SwSidebarWin::MouseButtonDown(const MouseEvent& rMouseEvent) + { + if (mpSidebarTextControl) +@@ -426,6 +440,20 @@ void SwSidebarWin::MouseButtonDown(const MouseEvent& rMouseEvent) + } + } + ++void SwSidebarWin::MouseButtonUp(const MouseEvent& rMouseEvent) ++{ ++ if (mpSidebarTextControl) ++ { ++ mpSidebarTextControl->Push(PushFlags::MAPMODE); ++ MouseEvent aMouseEvent(rMouseEvent); ++ lcl_translateTwips(*EditWin(), *mpSidebarTextControl, &aMouseEvent); ++ ++ mpSidebarTextControl->MouseButtonUp(aMouseEvent); ++ ++ mpSidebarTextControl->Pop(); ++ } ++} ++ + void SwSidebarWin::SetPosSizePixelRect(long nX, long nY, long nWidth, long nHeight, + const SwRect& aAnchorRect, const long aPageBorder) + { +diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx +index b9777914c5b4..cfb054a645fb 100644 +--- a/sw/source/uibase/docvw/edtwin.cxx ++++ b/sw/source/uibase/docvw/edtwin.cxx +@@ -3706,6 +3706,15 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt) + { + MouseEvent rMEvt(_rMEvt); + ++ if (comphelper::LibreOfficeKit::isActive()) ++ { ++ if (vcl::Window* pWindow = m_rView.GetPostItMgr()->IsHitSidebarWindow(rMEvt.GetPosPixel())) ++ { ++ pWindow->MouseMove(rMEvt); ++ return; ++ } ++ } ++ + //ignore key modifiers for format paintbrush + { + bool bExecFormatPaintbrush = m_pApplyTempl && m_pApplyTempl->m_pFormatClipboard +@@ -4211,6 +4220,15 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt) + */ + void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) + { ++ if (comphelper::LibreOfficeKit::isActive()) ++ { ++ if (vcl::Window* pWindow = m_rView.GetPostItMgr()->IsHitSidebarWindow(rMEvt.GetPosPixel())) ++ { ++ pWindow->MouseButtonUp(rMEvt); ++ return; ++ } ++ } ++ + bool bCallBase = true; + + bool bCallShadowCrsr = m_bWasShdwCrsr; +diff --git a/vcl/source/window/seleng.cxx b/vcl/source/window/seleng.cxx +index 7999818b509c..69b220bedfcc 100644 +--- a/vcl/source/window/seleng.cxx ++++ b/vcl/source/window/seleng.cxx +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + + FunctionSet::~FunctionSet() + { +@@ -301,7 +302,9 @@ bool SelectionEngine::SelMouseMove( const MouseEvent& rMEvt ) + return true; + + aWTimer.SetTimeout( nUpdateInterval ); +- aWTimer.Start(); ++ if (!comphelper::LibreOfficeKit::isActive()) ++ // Generating fake mouse moves does not work with LOK. ++ aWTimer.Start(); + if ( eSelMode != SINGLE_SELECTION ) + { + if ( !(nFlags & SelectionEngineFlags::HAS_ANCH) ) +-- +2.12.0 + diff --git a/SOURCES/0332-gtktiledviewer-the-formula-bar-is-calc-only.patch b/SOURCES/0332-gtktiledviewer-the-formula-bar-is-calc-only.patch new file mode 100644 index 0000000..f7e3c9a --- /dev/null +++ b/SOURCES/0332-gtktiledviewer-the-formula-bar-is-calc-only.patch @@ -0,0 +1,34 @@ +From 7ab3c2c56b294cb71e09fbbb1dfb7cb9a8c55504 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Sat, 14 Nov 2015 15:05:33 +0100 +Subject: [PATCH 332/398] gtktiledviewer: the formula bar is calc-only + +Change-Id: Ib989a23e5ece49b6eb16b25bb1fb6f635df25829 +(cherry picked from commit 9caca9fe23ac8e193f89a11503d92b058669a660) +--- + libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 45ccef792905..7f3d94be5959 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -303,6 +303,7 @@ gboolean TiledRowColumnBar::docConfigureEvent(GtkWidget* pDocView, GdkEventConfi + } + gtk_widget_show(rWindow.m_pColumnBar->m_pDrawingArea); + gtk_widget_queue_draw(rWindow.m_pColumnBar->m_pDrawingArea); ++ gtk_widget_show(rWindow.m_pFormulabarEntry); + } + + return TRUE; +@@ -1187,6 +1188,7 @@ static GtkWidget* createWindow(TiledWindow& rWindow) + gtk_widget_hide(rWindow.m_pCornerButton->m_pDrawingArea); + gtk_widget_hide(rWindow.m_pRowBar->m_pDrawingArea); + gtk_widget_hide(rWindow.m_pColumnBar->m_pDrawingArea); ++ gtk_widget_hide(rWindow.m_pFormulabarEntry); + // Hide the non-progressbar children of the status bar by default. + gtk_widget_hide(rWindow.m_pStatusbarLabel); + gtk_widget_hide(rWindow.m_pZoomLabel); +-- +2.12.0 + diff --git a/SOURCES/0333-gtktiledviewer-add-toolbar-buttons-to-insert-delete-.patch b/SOURCES/0333-gtktiledviewer-add-toolbar-buttons-to-insert-delete-.patch new file mode 100644 index 0000000..ef2e27b --- /dev/null +++ b/SOURCES/0333-gtktiledviewer-add-toolbar-buttons-to-insert-delete-.patch @@ -0,0 +1,43 @@ +From dbf9e629020d9b37a0dcec09dbb2e6dfd159519e Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Sat, 14 Nov 2015 15:10:18 +0100 +Subject: [PATCH 333/398] gtktiledviewer: add toolbar buttons to insert / + delete comments + +Change-Id: Ia566e983548a89d974c133823da2f07d5c2e35e4 +(cherry picked from commit bd05cc9a5093bbf5d2e136a6589be612df81d27e) +--- + libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 7f3d94be5959..86fc9e539b39 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -1093,6 +1093,23 @@ static GtkWidget* createWindow(TiledWindow& rWindow) + gtk_toolbar_insert(GTK_TOOLBAR(pLowerToolbar), rWindow.m_pJustifypara, -1); + g_signal_connect(G_OBJECT(rWindow.m_pJustifypara), "toggled", G_CALLBACK(toggleToolItem), NULL); + lcl_registerToolItem(rWindow, rWindow.m_pJustifypara, ".uno:JustifyPara"); ++ gtk_toolbar_insert(GTK_TOOLBAR(pLowerToolbar), gtk_separator_tool_item_new(), -1); ++ ++ // Insert/delete comments. ++ GtkToolItem* pInsertAnnotation = gtk_tool_button_new(nullptr, nullptr); ++ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(pInsertAnnotation), "changes-allow-symbolic"); ++ gtk_tool_item_set_tooltip_text(pInsertAnnotation, "Insert Comment"); ++ gtk_toolbar_insert(GTK_TOOLBAR(pLowerToolbar), pInsertAnnotation, -1); ++ g_signal_connect(G_OBJECT(pInsertAnnotation), "clicked", G_CALLBACK(toggleToolItem), NULL); ++ lcl_registerToolItem(rWindow, pInsertAnnotation, ".uno:InsertAnnotation"); ++ ++ GtkToolItem* pDeleteComment = gtk_tool_button_new(nullptr, nullptr); ++ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(pDeleteComment), "changes-prevent-symbolic"); ++ gtk_tool_item_set_tooltip_text(pDeleteComment, "Delete Comment"); ++ gtk_toolbar_insert(GTK_TOOLBAR(pLowerToolbar), pDeleteComment, -1); ++ g_signal_connect(G_OBJECT(pDeleteComment), "clicked", G_CALLBACK(toggleToolItem), NULL); ++ lcl_registerToolItem(rWindow, pDeleteComment, ".uno:DeleteComment"); ++ + // Formula bar + GtkToolItem* pFormulaEntryContainer = gtk_tool_item_new(); + rWindow.m_pFormulabarEntry = gtk_entry_new(); +-- +2.12.0 + diff --git a/SOURCES/0334-CppunitTest_sw_tiledrendering-replace-various-ifdefs.patch b/SOURCES/0334-CppunitTest_sw_tiledrendering-replace-various-ifdefs.patch new file mode 100644 index 0000000..d8f35c6 --- /dev/null +++ b/SOURCES/0334-CppunitTest_sw_tiledrendering-replace-various-ifdefs.patch @@ -0,0 +1,183 @@ +From 2a75ef1ce370310a06b30de34799c0cb39f6bfea Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Sat, 14 Nov 2015 15:35:18 +0100 +Subject: [PATCH 334/398] CppunitTest_sw_tiledrendering: replace various ifdefs + with a single condition + +LOK is Linux-only at the moment, don't bother with disabling each and +every unit test on Mac/Windows for now. + +Change-Id: I2ff1ed47251c16ec6a8d43138789480d95ea720e +(cherry picked from commit 18dfcbb11a05b7e702dc2161df9db8386a7ca34b) +--- + sw/Module_sw.mk | 7 +++++- + sw/qa/extras/tiledrendering/tiledrendering.cxx | 34 +------------------------- + 2 files changed, 7 insertions(+), 34 deletions(-) + +diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk +index 13453b5beb10..80b1ffb85e14 100644 +--- a/sw/Module_sw.mk ++++ b/sw/Module_sw.mk +@@ -68,11 +68,16 @@ $(eval $(call gb_Module_add_slowcheck_targets,sw,\ + CppunitTest_sw_odfexport \ + CppunitTest_sw_odfimport \ + CppunitTest_sw_uiwriter \ +- CppunitTest_sw_tiledrendering \ + CppunitTest_sw_mailmerge \ + CppunitTest_sw_globalfilter \ + )) + ++ifeq ($(OS),LINUX) ++$(eval $(call gb_Module_add_slowcheck_targets,sw,\ ++ CppunitTest_sw_tiledrendering \ ++)) ++endif ++ + ifneq ($(DISABLE_CVE_TESTS),TRUE) + $(eval $(call gb_Module_add_slowcheck_targets,sw,\ + CppunitTest_sw_filters_test \ +diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx +index 4598c50e5842..9f85fe8e1290 100644 +--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx ++++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx +@@ -150,18 +150,6 @@ void SwTiledRenderingTest::callbackImpl(int nType, const char* pPayload) + + void SwTiledRenderingTest::testRegisterCallback() + { +-#ifdef MACOSX +- // For some reason this particular test requires window system access on OS X. +- +- // Without window system access, we do get a number of "<<>> +- // AquaSalGraphics::CheckContext() FAILED!!!!" [sic] and " : CGSConnectionByID: 0 is +- // not a valid connection ID" warnings while running the other tests, too, but they still +- // succeed. +- +- if (!vcl::IsWindowSystemAvailable()) +- return; +-#endif +- + SwXTextDocument* pXTextDocument = createDoc("dummy.fodt"); + pXTextDocument->registerCallback(&SwTiledRenderingTest::callback, this); + SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell(); +@@ -170,13 +158,8 @@ void SwTiledRenderingTest::testRegisterCallback() + + // Check that the top left 256x256px tile would be invalidated. + CPPUNIT_ASSERT(!m_aInvalidation.IsEmpty()); +-#if !defined(WNT) && !defined(MACOSX) + Rectangle aTopLeft(0, 0, 256*15, 256*15); // 1 px = 15 twips, assuming 96 DPI. +- // FIXME - fails on Windows since about cbd48230bb3a90c4c485fa33123c6653234e02e9 +- // [plus minus few commits maybe] +- // Also on OS X. But is tiled rendering even supposed to work on Windows and OS X? + CPPUNIT_ASSERT(m_aInvalidation.IsOver(aTopLeft)); +-#endif + } + + void SwTiledRenderingTest::testPostKeyEvent() +@@ -290,9 +273,7 @@ void SwTiledRenderingTest::testSetGraphicSelection() + Rectangle aShapeAfter = pObject->GetSnapRect(); + // Check that a resize happened, but aspect ratio is not kept. + CPPUNIT_ASSERT_EQUAL(aShapeBefore.getWidth(), aShapeAfter.getWidth()); +-#if !defined(MACOSX) // FIXME + CPPUNIT_ASSERT_EQUAL(aShapeBefore.getHeight() + 1000, aShapeAfter.getHeight()); +-#endif + } + + void SwTiledRenderingTest::testResetSelection() +@@ -322,7 +303,6 @@ void SwTiledRenderingTest::testResetSelection() + CPPUNIT_ASSERT(!pWrtShell->IsSelFrmMode()); + } + +-#if !(defined WNT || defined MACOSX) + void lcl_search(bool bBackward) + { + uno::Sequence aPropertyValues(comphelper::InitPropertySequence( +@@ -332,11 +312,9 @@ void lcl_search(bool bBackward) + })); + comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues); + } +-#endif + + void SwTiledRenderingTest::testSearch() + { +-#if !defined(WNT) && !defined(MACOSX) + comphelper::LibreOfficeKit::setActive(); + + SwXTextDocument* pXTextDocument = createDoc("search.odt"); +@@ -377,12 +355,10 @@ void SwTiledRenderingTest::testSearch() + CPPUNIT_ASSERT_EQUAL(nNode + 1, nActual); + + comphelper::LibreOfficeKit::setActive(false); +-#endif + } + + void SwTiledRenderingTest::testSearchViewArea() + { +-#if !defined(WNT) && !defined(MACOSX) + SwXTextDocument* pXTextDocument = createDoc("search.odt"); + SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell(); + // Go to the second page, 1-based. +@@ -404,12 +380,10 @@ void SwTiledRenderingTest::testSearchViewArea() + comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues); + // This was just "Heading", i.e. SwView::SearchAndWrap() did not search from only the top of the second page. + CPPUNIT_ASSERT_EQUAL(OUString("Heading on second page"), pShellCrsr->GetPoint()->nNode.GetNode().GetTextNode()->GetText()); +-#endif + } + + void SwTiledRenderingTest::testSearchTextFrame() + { +-#if !defined(WNT) && !defined(MACOSX) + comphelper::LibreOfficeKit::setActive(); + + SwXTextDocument* pXTextDocument = createDoc("search.odt"); +@@ -424,12 +398,10 @@ void SwTiledRenderingTest::testSearchTextFrame() + CPPUNIT_ASSERT(!m_aTextSelection.isEmpty()); + + comphelper::LibreOfficeKit::setActive(false); +-#endif + } + + void SwTiledRenderingTest::testSearchTextFrameWrapAround() + { +-#if !defined(WNT) && !defined(MACOSX) + SwXTextDocument* pXTextDocument = createDoc("search.odt"); + pXTextDocument->registerCallback(&SwTiledRenderingTest::callback, this); + uno::Sequence aPropertyValues(comphelper::InitPropertySequence( +@@ -442,12 +414,10 @@ void SwTiledRenderingTest::testSearchTextFrameWrapAround() + comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues); + // This failed, i.e. the second time 'not found' was reported, instead of wrapping around. + CPPUNIT_ASSERT(m_bFound); +-#endif + } + + void SwTiledRenderingTest::testDocumentSizeChanged() + { +-#if !defined(WNT) && !defined(MACOSX) + // Get the current document size. + SwXTextDocument* pXTextDocument = createDoc("2-pages.odt"); + pXTextDocument->registerCallback(&SwTiledRenderingTest::callback, this); +@@ -462,12 +432,10 @@ void SwTiledRenderingTest::testDocumentSizeChanged() + CPPUNIT_ASSERT_EQUAL(aSize.getWidth(), m_aDocumentSize.getWidth()); + // Document height should be smaller now. + CPPUNIT_ASSERT(aSize.getHeight() > m_aDocumentSize.getHeight()); +-#endif + } + + void SwTiledRenderingTest::testSearchAll() + { +-#if !defined(WNT) && !defined(MACOSX) + comphelper::LibreOfficeKit::setActive(); + + SwXTextDocument* pXTextDocument = createDoc("search.odt"); +@@ -485,8 +453,8 @@ void SwTiledRenderingTest::testSearchAll() + CPPUNIT_ASSERT_EQUAL(0, m_aSearchResultPart[0]); + + comphelper::LibreOfficeKit::setActive(false); +-#endif + } ++ + CPPUNIT_TEST_SUITE_REGISTRATION(SwTiledRenderingTest); + + CPPUNIT_PLUGIN_IMPLEMENT(); +-- +2.12.0 + diff --git a/SOURCES/0335-CppunitTest_desktop_lib-add-Writer-comments-textcase.patch b/SOURCES/0335-CppunitTest_desktop_lib-add-Writer-comments-textcase.patch new file mode 100644 index 0000000..155d5e0 --- /dev/null +++ b/SOURCES/0335-CppunitTest_desktop_lib-add-Writer-comments-textcase.patch @@ -0,0 +1,109 @@ +From a779115ee56769b7691b02e4b8739c5c8f81258e Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Sat, 14 Nov 2015 16:59:01 +0100 +Subject: [PATCH 335/398] CppunitTest_desktop_lib: add Writer comments textcase + +Fails without e.g. the last hunk of commit +1ba9d7fd2a7a3e2b4f52ed0f5efdf7df867b9db3 (sw lok: forward key events to +annotation window if necessary, 2015-11-12). + +Change-Id: I7f39530881f6141fea956b751aa57eb2bdcadcb2 +(cherry picked from commit 1118689e70ed49604ded6e1ae83a22bdc995b2fb) +--- + desktop/CppunitTest_desktop_lib.mk | 1 + + desktop/qa/desktop_lib/test_desktop_lib.cxx | 46 +++++++++++++++++++++++++++++ + 2 files changed, 47 insertions(+) + +diff --git a/desktop/CppunitTest_desktop_lib.mk b/desktop/CppunitTest_desktop_lib.mk +index ca9d8db32c9f..bbedfdc8348e 100644 +--- a/desktop/CppunitTest_desktop_lib.mk ++++ b/desktop/CppunitTest_desktop_lib.mk +@@ -67,6 +67,7 @@ $(eval $(call gb_CppunitTest_use_components,desktop_lib,\ + xmloff/util/xo \ + i18npool/source/search/i18nsearch \ + filter/source/graphic/graphicfilter \ ++ linguistic/source/lng \ + )) + + $(eval $(call gb_CppunitTest_use_configuration,desktop_lib)) +diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx +index 7d94daea0fbc..930dd21ec081 100644 +--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx ++++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx +@@ -10,6 +10,10 @@ + #include + #include + #include ++#include ++#include ++#include ++#include + + #include + #include +@@ -70,6 +74,7 @@ public: + void testRowColumnHeaders(); + void testCellCursor(); + void testCommandResult(); ++ void testWriterComments(); + + CPPUNIT_TEST_SUITE(DesktopLOKTest); + CPPUNIT_TEST(testGetStyles); +@@ -85,6 +90,7 @@ public: + CPPUNIT_TEST(testRowColumnHeaders); + CPPUNIT_TEST(testCellCursor); + CPPUNIT_TEST(testCommandResult); ++ CPPUNIT_TEST(testWriterComments); + CPPUNIT_TEST_SUITE_END(); + + uno::Reference mxComponent; +@@ -491,6 +497,46 @@ void DesktopLOKTest::testCommandResult() + CPPUNIT_ASSERT_EQUAL(aTree.get_child("success").get_value(), true); + } + ++void DesktopLOKTest::testWriterComments() ++{ ++ comphelper::LibreOfficeKit::setActive(); ++ LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); ++ pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this); ++ uno::Reference xToolkit(com::sun::star::awt::Toolkit::create(comphelper::getProcessComponentContext()), uno::UNO_QUERY); ++ ++ // Insert a comment at the beginning of the document and wait till the main ++ // loop grabs the focus, so characters end up in the annotation window. ++ TimeValue aTimeValue = {2 , 0}; // 2 seconds max ++ m_aCommandResultCondition.reset(); ++ pDocument->pClass->postUnoCommand(pDocument, ".uno:InsertAnnotation", nullptr, true); ++ m_aCommandResultCondition.wait(aTimeValue); ++ CPPUNIT_ASSERT(!m_aCommandResult.isEmpty()); ++ xToolkit->reschedule(); ++ ++ // Test that we have a comment. ++ uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); ++ uno::Reference xParagraphEnumerationAccess(xTextDocument->getText(), uno::UNO_QUERY); ++ uno::Reference xParagraphEnumeration = xParagraphEnumerationAccess->createEnumeration(); ++ uno::Reference xParagraph(xParagraphEnumeration->nextElement(), uno::UNO_QUERY); ++ uno::Reference xTextPortionEnumeration = xParagraph->createEnumeration(); ++ uno::Reference xTextPortion(xTextPortionEnumeration->nextElement(), uno::UNO_QUERY); ++ CPPUNIT_ASSERT_EQUAL(OUString("Annotation"), xTextPortion->getPropertyValue("TextPortionType").get()); ++ ++ // Type "test" and finish editing. ++ pDocument->pClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 't', 0); ++ pDocument->pClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 'e', 0); ++ pDocument->pClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 's', 0); ++ pDocument->pClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 't', 0); ++ pDocument->pClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 0, com::sun::star::awt::Key::ESCAPE); ++ ++ // Test that the typed characters ended up in the right window. ++ auto xTextField = xTextPortion->getPropertyValue("TextField").get< uno::Reference >(); ++ // This was empty, typed characters ended up in the body text. ++ CPPUNIT_ASSERT_EQUAL(OUString("test"), xTextField->getPropertyValue("Content").get()); ++ ++ comphelper::LibreOfficeKit::setActive(false); ++} ++ + CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); + + CPPUNIT_PLUGIN_IMPLEMENT(); +-- +2.12.0 + diff --git a/SOURCES/0336-sc-lok-use-client-zoom-for-ViewRowColumnHeaders.patch b/SOURCES/0336-sc-lok-use-client-zoom-for-ViewRowColumnHeaders.patch new file mode 100644 index 0000000..360ee8d --- /dev/null +++ b/SOURCES/0336-sc-lok-use-client-zoom-for-ViewRowColumnHeaders.patch @@ -0,0 +1,48 @@ +From 381c84511f6adf660189af85ff615e841e00977a Mon Sep 17 00:00:00 2001 +From: Andrzej Hunt +Date: Mon, 16 Nov 2015 15:30:53 +0100 +Subject: [PATCH 336/398] sc lok: use client zoom for ViewRowColumnHeaders + +Change-Id: I85000851f82ea7cdc4b536683adbc8570de9af7e +(cherry picked from commit 396b5f411f7ecc7d600efdc0bb2381a7d1ed6d88) +--- + desktop/qa/desktop_lib/test_desktop_lib.cxx | 3 +++ + sc/source/ui/unoobj/docuno.cxx | 5 +++++ + 2 files changed, 8 insertions(+) + +diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx +index 930dd21ec081..1edf8d722d2f 100644 +--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx ++++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx +@@ -405,6 +405,9 @@ void DesktopLOKTest::testRowColumnHeaders() + * "text" has the header label in UTF-8 + */ + LibLODocument_Impl* pDocument = loadDoc("search.ods"); ++ ++ pDocument->pClass->initializeForRendering(pDocument); ++ + boost::property_tree::ptree aTree; + char* pJSON = pDocument->m_pDocumentClass->getCommandValues(pDocument, ".uno:ViewRowColumnHeaders"); + std::stringstream aStream(pJSON); +diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx +index c5a96e1e8255..c0f504d770c6 100644 +--- a/sc/source/ui/unoobj/docuno.cxx ++++ b/sc/source/ui/unoobj/docuno.cxx +@@ -885,9 +885,14 @@ void ScModelObj::setClientZoom(int nTilePixelWidth_, int nTilePixelHeight_, int + OUString ScModelObj::getRowColumnHeaders(const Rectangle& rRectangle) + { + ScViewData* pViewData = ScDocShell::GetViewData(); ++ + if (!pViewData) + return OUString(); + ++ // update the aLogicMode in ScViewData to something predictable ++ pViewData->SetZoom(Fraction(nTilePixelWidth * TWIPS_PER_PIXEL, nTileTwipWidth), ++ Fraction(nTilePixelHeight * TWIPS_PER_PIXEL, nTileTwipHeight), true); ++ + ScTabView* pTabView = pViewData->GetView(); + if (!pTabView) + return OUString(); +-- +2.12.0 + diff --git a/SOURCES/0337-sw-lok-comments-fix-sidebar-width-with-custom-zoom.patch b/SOURCES/0337-sw-lok-comments-fix-sidebar-width-with-custom-zoom.patch new file mode 100644 index 0000000..ca465c1 --- /dev/null +++ b/SOURCES/0337-sw-lok-comments-fix-sidebar-width-with-custom-zoom.patch @@ -0,0 +1,57 @@ +From a1641176c666645a2c61b3b9ebcba05f01350c12 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Mon, 16 Nov 2015 16:30:21 +0100 +Subject: [PATCH 337/398] sw lok comments: fix sidebar width with custom zoom + +Change-Id: I6772cce10d157421d983d6b93efb52bf8b95f5b8 +(cherry picked from commit dc65f048fd1b08d17e71e4d3a3a3c114aae871e6) +--- + sw/source/uibase/docvw/PostItMgr.cxx | 22 +++++++++++----------- + 1 file changed, 11 insertions(+), 11 deletions(-) + +diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx +index 871a642d24da..fa82556554d1 100644 +--- a/sw/source/uibase/docvw/PostItMgr.cxx ++++ b/sw/source/uibase/docvw/PostItMgr.cxx +@@ -1865,19 +1865,19 @@ bool SwPostItMgr::HasNotes() const + + unsigned long SwPostItMgr::GetSidebarWidth(bool bPx) const + { +- unsigned long aWidth = (unsigned long)(mpWrtShell->GetViewOptions()->GetZoom() * 1.8); ++ sal_uInt16 nZoom = mpWrtShell->GetViewOptions()->GetZoom(); ++ if (comphelper::LibreOfficeKit::isActive()) ++ { ++ // The output device contains the real wanted scale factor. ++ double fScaleX = mpWrtShell->GetOut()->GetMapMode().GetScaleX(); ++ nZoom = fScaleX * 100; ++ } ++ unsigned long aWidth = (unsigned long)(nZoom * 1.8); ++ + if (bPx) + return aWidth; + else +- { +- bool bEnableMapMode = comphelper::LibreOfficeKit::isActive() && !mpEditWin->IsMapModeEnabled(); +- if (bEnableMapMode) +- mpEditWin->EnableMapMode(); +- long nRet = mpEditWin->PixelToLogic(Size(aWidth, 0)).Width(); +- if (bEnableMapMode) +- mpEditWin->EnableMapMode(false); +- return nRet; +- } ++ return mpWrtShell->GetOut()->PixelToLogic(Size(aWidth, 0)).Width(); + } + + unsigned long SwPostItMgr::GetSidebarBorderWidth(bool bPx) const +@@ -1885,7 +1885,7 @@ unsigned long SwPostItMgr::GetSidebarBorderWidth(bool bPx) const + if (bPx) + return 2; + else +- return mpEditWin->PixelToLogic(Size(2,0)).Width(); ++ return mpWrtShell->GetOut()->PixelToLogic(Size(2,0)).Width(); + } + + unsigned long SwPostItMgr::GetNoteWidth() +-- +2.12.0 + diff --git a/SOURCES/0338-sw-lok-comments-fix-text-selection-with-custom-zoom.patch b/SOURCES/0338-sw-lok-comments-fix-text-selection-with-custom-zoom.patch new file mode 100644 index 0000000..ff6bb86 --- /dev/null +++ b/SOURCES/0338-sw-lok-comments-fix-text-selection-with-custom-zoom.patch @@ -0,0 +1,57 @@ +From 3fb5c82343761f02a956653d7afcdb96d509daf5 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 17 Nov 2015 12:21:42 +0100 +Subject: [PATCH 338/398] sw lok comments: fix text selection with custom zoom + +SwPostItMgr::GetSidebarWidth() can be called in two scenarios: + +- inside PaintTile() the output device contains the zoom level and has + the map mode enabled (and its scale factor is the zoom level) +- outisde PaintTile() the output device is SwEditWin and has the map + mode disabled (and the zoom level is to be taken from the view + options) + +Change-Id: I6cf19f3241a2e972ae711e0efa7b0205aae1a3f2 +(cherry picked from commit 0fd381b773cb7c15c4773affd4a3b298ad38fe92) +--- + sw/source/uibase/docvw/PostItMgr.cxx | 15 ++++++++++++--- + 1 file changed, 12 insertions(+), 3 deletions(-) + +diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx +index fa82556554d1..40e2bda8f6b7 100644 +--- a/sw/source/uibase/docvw/PostItMgr.cxx ++++ b/sw/source/uibase/docvw/PostItMgr.cxx +@@ -1865,10 +1865,11 @@ bool SwPostItMgr::HasNotes() const + + unsigned long SwPostItMgr::GetSidebarWidth(bool bPx) const + { ++ bool bEnableMapMode = !mpWrtShell->GetOut()->IsMapModeEnabled(); + sal_uInt16 nZoom = mpWrtShell->GetViewOptions()->GetZoom(); +- if (comphelper::LibreOfficeKit::isActive()) ++ if (comphelper::LibreOfficeKit::isActive() && !bEnableMapMode) + { +- // The output device contains the real wanted scale factor. ++ // The output device is the tile and contains the real wanted scale factor. + double fScaleX = mpWrtShell->GetOut()->GetMapMode().GetScaleX(); + nZoom = fScaleX * 100; + } +@@ -1877,7 +1878,15 @@ unsigned long SwPostItMgr::GetSidebarWidth(bool bPx) const + if (bPx) + return aWidth; + else +- return mpWrtShell->GetOut()->PixelToLogic(Size(aWidth, 0)).Width(); ++ { ++ if (bEnableMapMode) ++ // The output device is the window. ++ mpWrtShell->GetOut()->EnableMapMode(); ++ long nRet = mpWrtShell->GetOut()->PixelToLogic(Size(aWidth, 0)).Width(); ++ if (bEnableMapMode) ++ mpWrtShell->GetOut()->EnableMapMode(false); ++ return nRet; ++ } + } + + unsigned long SwPostItMgr::GetSidebarBorderWidth(bool bPx) const +-- +2.12.0 + diff --git a/SOURCES/0339-sw-lok-comments-fix-comment-widget-width-with-custom.patch b/SOURCES/0339-sw-lok-comments-fix-comment-widget-width-with-custom.patch new file mode 100644 index 0000000..6fdd495 --- /dev/null +++ b/SOURCES/0339-sw-lok-comments-fix-comment-widget-width-with-custom.patch @@ -0,0 +1,65 @@ +From f3edb775652b288ac0c4c38186b4d23bfa603a6c Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 17 Nov 2015 17:07:47 +0100 +Subject: [PATCH 339/398] sw lok comments: fix comment widget width with custom + zoom + +When tiled rendering, then only the render context (or failing that, +SwViewShell::GetOut()) has the correct zoom level, so use that when +doing pixel-to-logic conversion or scaling pixel values. + +Change-Id: I265a642b8253c6eced42da2a0e06a2de25c36ca8 +(cherry picked from commit c9db32de2deeaa705e3da4945f62a94b75a7e4c5) +--- + sw/source/uibase/docvw/PostItMgr.cxx | 2 +- + sw/source/uibase/docvw/SidebarWin.cxx | 7 ++++--- + 2 files changed, 5 insertions(+), 4 deletions(-) + +diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx +index 40e2bda8f6b7..e0ea88fd86b4 100644 +--- a/sw/source/uibase/docvw/PostItMgr.cxx ++++ b/sw/source/uibase/docvw/PostItMgr.cxx +@@ -870,7 +870,7 @@ void SwPostItMgr::PaintTile(OutputDevice& rRenderContext, const Rectangle& /*rRe + MapMode aMapMode(rRenderContext.GetMapMode()); + aMapMode.SetOrigin(aMapMode.GetOrigin() + aOffset); + rRenderContext.SetMapMode(aMapMode); +- Size aSize(pPostIt->PixelToLogic(pPostIt->GetSizePixel())); ++ Size aSize(rRenderContext.PixelToLogic(pPostIt->GetSizePixel())); + Rectangle aRectangle(Point(0, 0), aSize); + + pPostIt->PaintTile(rRenderContext, aRectangle); +diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx +index f9163a80f44b..693bcdf5b09a 100644 +--- a/sw/source/uibase/docvw/SidebarWin.cxx ++++ b/sw/source/uibase/docvw/SidebarWin.cxx +@@ -286,7 +286,8 @@ void SwSidebarWin::PaintTile(vcl::RenderContext& rRenderContext, const Rectangle + continue; + + rRenderContext.Push(PushFlags::MAPMODE); +- Point aOffset(PixelToLogic(pChild->GetPosPixel())); ++ const Fraction& rFraction(mrView.GetWrtShellPtr()->GetOut()->GetMapMode().GetScaleY()); ++ Point aOffset(PixelToLogic(pChild->GetPosPixel() * rFraction.GetDenominator() / rFraction.GetNumerator())); + MapMode aMapMode(rRenderContext.GetMapMode()); + aMapMode.SetOrigin(aMapMode.GetOrigin() + aOffset); + rRenderContext.SetMapMode(aMapMode); +@@ -1411,7 +1412,7 @@ sal_Int32 SwSidebarWin::GetMetaButtonAreaWidth() + + sal_Int32 SwSidebarWin::GetMetaHeight() + { +- const Fraction& f( GetMapMode().GetScaleY() ); ++ const Fraction& f(mrView.GetWrtShellPtr()->GetOut()->GetMapMode().GetScaleY()); + return POSTIT_META_HEIGHT * f.GetNumerator() / f.GetDenominator(); + } + +@@ -1422,7 +1423,7 @@ sal_Int32 SwSidebarWin::GetMinimumSizeWithMeta() + + sal_Int32 SwSidebarWin::GetMinimumSizeWithoutMeta() + { +- const Fraction& f( GetMapMode().GetScaleY() ); ++ const Fraction& f(mrView.GetWrtShellPtr()->GetOut()->GetMapMode().GetScaleY()); + return POSTIT_MINIMUMSIZE_WITHOUT_META * f.GetNumerator() / f.GetDenominator(); + } + +-- +2.12.0 + diff --git a/SOURCES/0340-sw-lok-comments-fix-meta-author-data-size-with-custo.patch b/SOURCES/0340-sw-lok-comments-fix-meta-author-data-size-with-custo.patch new file mode 100644 index 0000000..4bc662c --- /dev/null +++ b/SOURCES/0340-sw-lok-comments-fix-meta-author-data-size-with-custo.patch @@ -0,0 +1,42 @@ +From 8e392047f43791e6876e21f4e4a9deccc92f734a Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 17 Nov 2015 17:14:58 +0100 +Subject: [PATCH 340/398] sw lok comments: fix meta author/data size with + custom zoom + +Change-Id: I3310813c971aa7abffccc0b7f462e05caa83482e +(cherry picked from commit 6d00110674452c66ca6192fbf46b41331b2c7066) +--- + sw/source/uibase/docvw/SidebarWin.cxx | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx +index 693bcdf5b09a..9d12a12eae35 100644 +--- a/sw/source/uibase/docvw/SidebarWin.cxx ++++ b/sw/source/uibase/docvw/SidebarWin.cxx +@@ -669,11 +669,12 @@ void SwSidebarWin::Rescale() + mpOutliner->SetRefMapMode( aMode ); + SetMapMode( aMode ); + mpSidebarTextControl->SetMapMode( aMode ); ++ const Fraction& rFraction = mrView.GetWrtShellPtr()->GetOut()->GetMapMode().GetScaleY(); + if ( mpMetadataAuthor ) + { + vcl::Font aFont( mpMetadataAuthor->GetSettings().GetStyleSettings().GetFieldFont() ); + sal_Int32 nHeight = aFont.GetHeight(); +- nHeight = nHeight * aMode.GetScaleY().GetNumerator() / aMode.GetScaleY().GetDenominator(); ++ nHeight = nHeight * rFraction.GetNumerator() / rFraction.GetDenominator(); + aFont.SetHeight( nHeight ); + mpMetadataAuthor->SetControlFont( aFont ); + } +@@ -681,7 +682,7 @@ void SwSidebarWin::Rescale() + { + vcl::Font aFont( mpMetadataDate->GetSettings().GetStyleSettings().GetFieldFont() ); + sal_Int32 nHeight = aFont.GetHeight(); +- nHeight = nHeight * aMode.GetScaleY().GetNumerator() / aMode.GetScaleY().GetDenominator(); ++ nHeight = nHeight * rFraction.GetNumerator() / rFraction.GetDenominator(); + aFont.SetHeight( nHeight ); + mpMetadataDate->SetControlFont( aFont ); + } +-- +2.12.0 + diff --git a/SOURCES/0341-sw-lok-comments-implement-clipboard-copy.patch b/SOURCES/0341-sw-lok-comments-implement-clipboard-copy.patch new file mode 100644 index 0000000..36b35e7 --- /dev/null +++ b/SOURCES/0341-sw-lok-comments-implement-clipboard-copy.patch @@ -0,0 +1,44 @@ +From 7bcb6ab4daf9e166cbc8677dd7aa370253203d0f Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 17 Nov 2015 18:28:57 +0100 +Subject: [PATCH 341/398] sw lok comments: implement clipboard copy + +Change-Id: I0f45b1a6ab198a8403073eea05497e76f758250c +(cherry picked from commit 7b69161302bd12bf383671749e67b7d04ac4f41e) +--- + sw/source/uibase/uno/unotxdoc.cxx | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx +index 53bb2506928b..7f94eb037861 100644 +--- a/sw/source/uibase/uno/unotxdoc.cxx ++++ b/sw/source/uibase/uno/unotxdoc.cxx +@@ -134,6 +134,8 @@ + #include + #include + #include ++#include ++#include + + #include + #include +@@ -3382,6 +3384,16 @@ OString SwXTextDocument::getTextSelection(const char* pMimeType, OString& rUsedM + } + } + ++ if (SwPostItMgr* pPostItMgr = pDocShell->GetView()->GetPostItMgr()) ++ { ++ if (sw::sidebarwindows::SwSidebarWin* pWin = pPostItMgr->GetActiveSidebarWin()) ++ { ++ // Editing postit text. ++ EditView& rEditView = pWin->GetOutlinerView()->GetEditView(); ++ xTransferable = rEditView.GetEditEngine()->CreateTransferable(rEditView.GetSelection()); ++ } ++ } ++ + if (!xTransferable.is()) + xTransferable = new SwTransferable(*pWrtShell); + +-- +2.12.0 + diff --git a/SOURCES/0342-gtktiledviewer-set-author-name-when-inserting-a-comm.patch b/SOURCES/0342-gtktiledviewer-set-author-name-when-inserting-a-comm.patch new file mode 100644 index 0000000..7a3d2f5 --- /dev/null +++ b/SOURCES/0342-gtktiledviewer-set-author-name-when-inserting-a-comm.patch @@ -0,0 +1,64 @@ +From addf504efd94119f08ba227e39c04819925af608 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 17 Nov 2015 20:57:49 +0100 +Subject: [PATCH 342/398] gtktiledviewer: set author name when inserting a + comment + +Change-Id: Iee66687ce813ff801f29e4568329ed2a39f905ba +(cherry picked from commit e0080a60ac2fb0a57cbf1ecbeda250e37d8b402e) +--- + libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 17 ++++++++++++++++- + 1 file changed, 16 insertions(+), 1 deletion(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 86fc9e539b39..7dcd52446344 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -10,6 +10,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -118,6 +119,7 @@ public: + std::shared_ptr m_pRowBar; + std::shared_ptr m_pColumnBar; + std::shared_ptr m_pCornerButton; ++ std::string m_aAuthor; + + TiledWindow() + : m_pDocView(nullptr), +@@ -148,6 +150,8 @@ public: + m_pFindbarLabel(nullptr), + m_bFindAll(false) + { ++ struct passwd* pPasswd = getpwuid(getuid()); ++ m_aAuthor = std::string(pPasswd->pw_gecos); + } + }; + +@@ -799,7 +803,18 @@ static void toggleToolItem(GtkWidget* pWidget, gpointer /*pData*/) + // notify about the finished Save + gboolean bNotify = (rString == ".uno:Save"); + +- lok_doc_view_post_command(pLOKDocView, rString.c_str(), nullptr, bNotify); ++ std::string aArguments; ++ if (rString == ".uno:InsertAnnotation" && !rWindow.m_aAuthor.empty()) ++ { ++ boost::property_tree::ptree aTree; ++ aTree.put(boost::property_tree::ptree::path_type("Author/type", '/'), "string"); ++ aTree.put(boost::property_tree::ptree::path_type("Author/value", '/'), rWindow.m_aAuthor); ++ std::stringstream aStream; ++ boost::property_tree::write_json(aStream, aTree); ++ aArguments = aStream.str(); ++ } ++ ++ lok_doc_view_post_command(pLOKDocView, rString.c_str(), (aArguments.empty() ? nullptr : aArguments.c_str()), bNotify); + } + } + +-- +2.12.0 + diff --git a/SOURCES/0343-lok-Document-initializeForRendering-support-init.-ar.patch b/SOURCES/0343-lok-Document-initializeForRendering-support-init.-ar.patch new file mode 100644 index 0000000..678c81e --- /dev/null +++ b/SOURCES/0343-lok-Document-initializeForRendering-support-init.-ar.patch @@ -0,0 +1,224 @@ +From 7c206a9cb06d70fb95f7f7eae137865bb68f5b1b Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Wed, 18 Nov 2015 14:59:51 +0100 +Subject: [PATCH 343/398] lok::Document::initializeForRendering: support init. + arguments + +Change-Id: I8aaf19a50f25f495cb87fba7ff6a4b0f56ed7d80 +(cherry picked from commit 4bddfc00d25a42917db79ceaf0547c2e792132c4) +--- + desktop/qa/desktop_lib/test_desktop_lib.cxx | 4 +- + desktop/source/lib/init.cxx | 76 +++++++++++++++-------------- + desktop/source/lib/lokandroid.cxx | 2 +- + include/LibreOfficeKit/LibreOfficeKit.h | 3 +- + include/LibreOfficeKit/LibreOfficeKit.hxx | 16 +++++- + libreofficekit/source/gtk/lokdocview.cxx | 2 +- + 6 files changed, 60 insertions(+), 43 deletions(-) + +diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx +index 1edf8d722d2f..4b08f9448f61 100644 +--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx ++++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx +@@ -283,7 +283,7 @@ void DesktopLOKTest::testSearchCalc() + LibLibreOffice_Impl aOffice; + comphelper::LibreOfficeKit::setActive(); + LibLODocument_Impl* pDocument = loadDoc("search.ods"); +- pDocument->pClass->initializeForRendering(pDocument); ++ pDocument->pClass->initializeForRendering(pDocument, nullptr); + pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this); + + uno::Sequence aPropertyValues(comphelper::InitPropertySequence( +@@ -406,7 +406,7 @@ void DesktopLOKTest::testRowColumnHeaders() + */ + LibLODocument_Impl* pDocument = loadDoc("search.ods"); + +- pDocument->pClass->initializeForRendering(pDocument); ++ pDocument->pClass->initializeForRendering(pDocument, nullptr); + + boost::property_tree::ptree aTree; + char* pJSON = pDocument->m_pDocumentClass->getCommandValues(pDocument, ".uno:ViewRowColumnHeaders"); +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 4ee862d21cd0..2ff0a9d02853 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -260,6 +260,40 @@ static OUString getAbsoluteURL(const char* pURL) + return OUString(); + } + ++static void jsonToPropertyValues(const char* pJSON, uno::Sequence& rPropertyValues) ++{ ++ std::vector aArguments; ++ if (pJSON) ++ { ++ boost::property_tree::ptree aTree; ++ std::stringstream aStream(pJSON); ++ boost::property_tree::read_json(aStream, aTree); ++ ++ for (const std::pair& rPair : aTree) ++ { ++ const std::string& rType = rPair.second.get("type"); ++ const std::string& rValue = rPair.second.get("value"); ++ ++ beans::PropertyValue aValue; ++ aValue.Name = OUString::fromUtf8(rPair.first.c_str()); ++ if (rType == "string") ++ aValue.Value <<= OUString::fromUtf8(rValue.c_str()); ++ else if (rType == "boolean") ++ aValue.Value <<= OString(rValue.c_str()).toBoolean(); ++ else if (rType == "float") ++ aValue.Value <<= OString(rValue.c_str()).toFloat(); ++ else if (rType == "long") ++ aValue.Value <<= OString(rValue.c_str()).toInt32(); ++ else if (rType == "unsigned short") ++ aValue.Value <<= static_cast(OString(rValue.c_str()).toUInt32()); ++ else ++ SAL_WARN("desktop.lib", "jsonToPropertyValues: unhandled type '"< aPropertyValues; ++ jsonToPropertyValues(pArguments, aPropertyValues); + pDoc->initializeForTiledRendering(); + } + } +@@ -987,40 +1025,6 @@ static void doc_postKeyEvent(LibreOfficeKitDocument* pThis, int nType, int nChar + pDoc->postKeyEvent(nType, nCharCode, nKeyCode); + } + +-static void jsonToPropertyValues(const char* pJSON, uno::Sequence& rPropertyValues) +-{ +- std::vector aArguments; +- if (pJSON) +- { +- boost::property_tree::ptree aTree; +- std::stringstream aStream(pJSON); +- boost::property_tree::read_json(aStream, aTree); +- +- for (const std::pair& rPair : aTree) +- { +- const std::string& rType = rPair.second.get("type"); +- const std::string& rValue = rPair.second.get("value"); +- +- beans::PropertyValue aValue; +- aValue.Name = OUString::fromUtf8(rPair.first.c_str()); +- if (rType == "string") +- aValue.Value <<= OUString::fromUtf8(rValue.c_str()); +- else if (rType == "boolean") +- aValue.Value <<= OString(rValue.c_str()).toBoolean(); +- else if (rType == "float") +- aValue.Value <<= OString(rValue.c_str()).toFloat(); +- else if (rType == "long") +- aValue.Value <<= OString(rValue.c_str()).toInt32(); +- else if (rType == "unsigned short") +- aValue.Value <<= static_cast(OString(rValue.c_str()).toUInt32()); +- else +- SAL_WARN("desktop.lib", "jsonToPropertyValues: unhandled type '"<(pEnv, aObject); +- pDocument->pClass->initializeForRendering(pDocument); ++ pDocument->pClass->initializeForRendering(pDocument, NULL); + } + + extern "C" SAL_JNI_EXPORT jint JNICALL Java_org_libreoffice_kit_Office_saveAs +diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h +index 03210376c61e..93f7dca6d455 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.h ++++ b/include/LibreOfficeKit/LibreOfficeKit.h +@@ -124,7 +124,8 @@ struct _LibreOfficeKitDocumentClass + long* pHeight); + + /// @see lok::Document::initializeForRendering(). +- void (*initializeForRendering) (LibreOfficeKitDocument* pThis); ++ void (*initializeForRendering) (LibreOfficeKitDocument* pThis, ++ const char* pArguments); + + /// @see lok::Document::registerCallback(). + void (*registerCallback) (LibreOfficeKitDocument* pThis, +diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx +index c474195de213..152d0f415f17 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.hxx ++++ b/include/LibreOfficeKit/LibreOfficeKit.hxx +@@ -156,10 +156,22 @@ public: + * needed to render the document correctly using tiled rendering. This + * method has to be called right after documentLoad() in case any of the + * tiled rendering methods are to be used later. ++ * ++ * Example argument string for text documents: ++ * ++ * { ++ * ".uno:HideWhitespace": ++ * { ++ * "type": "boolean", ++ * "value": "true" ++ * } ++ * } ++ * ++ * @param pArguments arguments of the rendering + */ +- inline void initializeForRendering() ++ inline void initializeForRendering(const char* pArguments = NULL) + { +- mpDoc->pClass->initializeForRendering(mpDoc); ++ mpDoc->pClass->initializeForRendering(mpDoc, pArguments); + } + + /** +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 47ada280dde3..802d85dea553 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -530,7 +530,7 @@ static gboolean postDocumentLoad(gpointer pData) + LOKDocViewPrivate& priv = getPrivate(pLOKDocView); + + priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId); +- priv->m_pDocument->pClass->initializeForRendering(priv->m_pDocument); ++ priv->m_pDocument->pClass->initializeForRendering(priv->m_pDocument, nullptr); + priv->m_pDocument->pClass->registerCallback(priv->m_pDocument, callbackWorker, pLOKDocView); + priv->m_pDocument->pClass->getDocumentSize(priv->m_pDocument, &priv->m_nDocumentWidthTwips, &priv->m_nDocumentHeightTwips); + g_timeout_add(600, handleTimeout, pLOKDocView); +-- +2.12.0 + diff --git a/SOURCES/0344-vcl-ITiledRenderable-initializeForTiledRendering-sup.patch b/SOURCES/0344-vcl-ITiledRenderable-initializeForTiledRendering-sup.patch new file mode 100644 index 0000000..762bc70 --- /dev/null +++ b/SOURCES/0344-vcl-ITiledRenderable-initializeForTiledRendering-sup.patch @@ -0,0 +1,163 @@ +From 1acbb9bcb348f8dd0c6fb38a435945888b703837 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Wed, 18 Nov 2015 15:20:30 +0100 +Subject: [PATCH 344/398] vcl::ITiledRenderable::initializeForTiledRendering: + support init. arguments + +(cherry picked from commit 479325dec83ea2747f3ce27ca7e817695b15e1bb) + +Change-Id: I9a6a75457078dc6383673f4c1a2012b69b5cefdd +--- + desktop/source/lib/init.cxx | 2 +- + include/vcl/ITiledRenderable.hxx | 2 +- + sc/inc/docuno.hxx | 2 +- + sc/source/ui/unoobj/docuno.cxx | 2 +- + sd/qa/unit/tiledrendering/tiledrendering.cxx | 2 +- + sd/source/ui/inc/unomodel.hxx | 2 +- + sd/source/ui/unoidl/unomodel.cxx | 2 +- + sw/inc/unotxdoc.hxx | 2 +- + sw/qa/extras/tiledrendering/tiledrendering.cxx | 3 +-- + sw/source/uibase/uno/unotxdoc.cxx | 2 +- + 10 files changed, 10 insertions(+), 11 deletions(-) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 2ff0a9d02853..3c6be03a7132 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -982,7 +982,7 @@ static void doc_initializeForRendering(LibreOfficeKitDocument* pThis, + doc_iniUnoCommands(); + uno::Sequence aPropertyValues; + jsonToPropertyValues(pArguments, aPropertyValues); +- pDoc->initializeForTiledRendering(); ++ pDoc->initializeForTiledRendering(aPropertyValues); + } + } + +diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx +index fa85b39399b3..786adb76f8e6 100644 +--- a/include/vcl/ITiledRenderable.hxx ++++ b/include/vcl/ITiledRenderable.hxx +@@ -93,7 +93,7 @@ public: + * Setup various document properties that are needed for the document to + * be renderable via tiled rendering. + */ +- virtual void initializeForTiledRendering() = 0; ++ virtual void initializeForTiledRendering(const css::uno::Sequence& rArguments) = 0; + + /** + * Registers a callback that will be invoked whenever the tiled renderer +diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx +index 7e00b7549733..803d7afd334d 100644 +--- a/sc/inc/docuno.hxx ++++ b/sc/inc/docuno.hxx +@@ -393,7 +393,7 @@ public: + virtual OUString getPartName(int nPart) SAL_OVERRIDE; + + /// @see vcl::ITiledRenderable::initializeForTiledRendering(). +- virtual void initializeForTiledRendering() SAL_OVERRIDE; ++ virtual void initializeForTiledRendering(const css::uno::Sequence& rArguments) override; + + /// @see vcl::ITiledRenderable::registerCallback(). + virtual void registerCallback(LibreOfficeKitCallback pCallback, void* pData) SAL_OVERRIDE; +diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx +index c0f504d770c6..b0de3197dab4 100644 +--- a/sc/source/ui/unoobj/docuno.cxx ++++ b/sc/source/ui/unoobj/docuno.cxx +@@ -932,7 +932,7 @@ Pointer ScModelObj::getPointer() + return pGridWindow->GetPointer(); + } + +-void ScModelObj::initializeForTiledRendering() ++void ScModelObj::initializeForTiledRendering(const css::uno::Sequence& /*rArguments*/) + { + SolarMutexGuard aGuard; + pDocShell->GetDocument().GetDrawLayer()->setTiledRendering(true); +diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx +index 306a76217ca0..8c9f8aa46dfa 100644 +--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx ++++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx +@@ -120,7 +120,7 @@ SdXImpressDocument* SdTiledRenderingTest::createDoc(const char* pName) + mxComponent = loadFromDesktop(getURLFromSrc(DATA_DIRECTORY) + OUString::createFromAscii(pName), "com.sun.star.presentation.PresentationDocument"); + SdXImpressDocument* pImpressDocument = dynamic_cast(mxComponent.get()); + CPPUNIT_ASSERT(pImpressDocument); +- pImpressDocument->initializeForTiledRendering(); ++ pImpressDocument->initializeForTiledRendering(uno::Sequence()); + return pImpressDocument; + } + +diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx +index 1c444dd478bf..70478b450571 100644 +--- a/sd/source/ui/inc/unomodel.hxx ++++ b/sd/source/ui/inc/unomodel.hxx +@@ -243,7 +243,7 @@ public: + virtual void setPartMode( int nPartMode ) SAL_OVERRIDE; + + /// @see vcl::ITiledRenderable::initializeForTiledRendering(). +- virtual void initializeForTiledRendering() SAL_OVERRIDE; ++ virtual void initializeForTiledRendering(const css::uno::Sequence& rArguments) override; + /// @see vcl::ITiledRenderable::registerCallback(). + virtual void registerCallback(LibreOfficeKitCallback pCallback, void* pData) SAL_OVERRIDE; + /// @see vcl::ITiledRenderable::postKeyEvent(). +diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx +index 28ca11878044..d5e9490f6936 100644 +--- a/sd/source/ui/unoidl/unomodel.cxx ++++ b/sd/source/ui/unoidl/unomodel.cxx +@@ -2370,7 +2370,7 @@ Size SdXImpressDocument::getDocumentSize() + return Size(convertMm100ToTwip(aSize.getWidth()), convertMm100ToTwip(aSize.getHeight())); + } + +-void SdXImpressDocument::initializeForTiledRendering() ++void SdXImpressDocument::initializeForTiledRendering(const css::uno::Sequence& /*rArguments*/) + { + SolarMutexGuard aGuard; + +diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx +index e8cb116bb671..842d6299e801 100644 +--- a/sw/inc/unotxdoc.hxx ++++ b/sw/inc/unotxdoc.hxx +@@ -417,7 +417,7 @@ public: + /// @see vcl::ITiledRenderable::getPartName(). + virtual OUString getPartName(int nPart) SAL_OVERRIDE; + /// @see vcl::ITiledRenderable::initializeForTiledRendering(). +- virtual void initializeForTiledRendering() SAL_OVERRIDE; ++ virtual void initializeForTiledRendering(const css::uno::Sequence& rArguments) override; + /// @see vcl::ITiledRenderable::registerCallback(). + virtual void registerCallback(LibreOfficeKitCallback pCallback, void* pData) SAL_OVERRIDE; + /// @see vcl::ITiledRenderable::postKeyEvent(). +diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx +index 9f85fe8e1290..045f0d2676b0 100644 +--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx ++++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx +@@ -86,7 +86,7 @@ SwXTextDocument* SwTiledRenderingTest::createDoc(const char* pName) + + SwXTextDocument* pTextDocument = dynamic_cast(mxComponent.get()); + CPPUNIT_ASSERT(pTextDocument); +- pTextDocument->initializeForTiledRendering(); ++ pTextDocument->initializeForTiledRendering(uno::Sequence()); + return pTextDocument; + } + +@@ -422,7 +422,6 @@ void SwTiledRenderingTest::testDocumentSizeChanged() + SwXTextDocument* pXTextDocument = createDoc("2-pages.odt"); + pXTextDocument->registerCallback(&SwTiledRenderingTest::callback, this); + SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell(); +- pXTextDocument->initializeForTiledRendering(); + Size aSize = pXTextDocument->getDocumentSize(); + + // Delete the second page and see how the size changes. +diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx +index 7f94eb037861..e8508efd18f1 100644 +--- a/sw/source/uibase/uno/unotxdoc.cxx ++++ b/sw/source/uibase/uno/unotxdoc.cxx +@@ -3249,7 +3249,7 @@ OUString SwXTextDocument::getPartName(int nPart) + return OUString(SW_RES(STR_PAGE)) + OUString::number(nPart + 1); + } + +-void SwXTextDocument::initializeForTiledRendering() ++void SwXTextDocument::initializeForTiledRendering(const css::uno::Sequence& /*rArguments*/) + { + SolarMutexGuard aGuard; + +-- +2.12.0 + diff --git a/SOURCES/0345-gtktiledviewer-allow-passing-initializeForRendering-.patch b/SOURCES/0345-gtktiledviewer-allow-passing-initializeForRendering-.patch new file mode 100644 index 0000000..36f050e --- /dev/null +++ b/SOURCES/0345-gtktiledviewer-allow-passing-initializeForRendering-.patch @@ -0,0 +1,129 @@ +From 5192c15c3382caea037991cdbeca55c596fe042f Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Wed, 18 Nov 2015 15:57:36 +0100 +Subject: [PATCH 345/398] gtktiledviewer: allow passing + initializeForRendering() arguments + +Change-Id: Ic7b52764cf2fedbf73d4dcaaf36d1055b8ee22f2 +(cherry picked from commit 0ea68eecddf0211f842645c4d257899531692770) +--- + include/LibreOfficeKit/LibreOfficeKitGtk.h | 2 ++ + .../qa/gtktiledviewer/gtktiledviewer.cxx | 25 ++++++++++++++++++---- + libreofficekit/source/gtk/lokdocview.cxx | 5 ++++- + 3 files changed, 27 insertions(+), 5 deletions(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h +index 32cb66963220..c947ce3f8369 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h ++++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h +@@ -65,6 +65,7 @@ GtkWidget* lok_doc_view_new_from_widget (LOKDocView* + * lok_doc_view_open_document: + * @pDocView: The #LOKDocView instance + * @pPath: (transfer full): The path of the document that #LOKDocView widget should try to open ++ * @pRenderingArguments: lok::Document::initializeForRendering() arguments. + * @cancellable: + * @callback: + * @userdata: +@@ -73,6 +74,7 @@ GtkWidget* lok_doc_view_new_from_widget (LOKDocView* + */ + void lok_doc_view_open_document (LOKDocView* pDocView, + const gchar* pPath, ++ const gchar* pRenderingArguments, + GCancellable* cancellable, + GAsyncReadyCallback callback, + gpointer userdata); +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 7dcd52446344..f9034298e65c 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -29,7 +29,9 @@ + + static int help() + { +- fprintf( stderr, "Usage: gtktiledviewer \n" ); ++ fprintf(stderr, "Usage: gtktiledviewer [ ... ]\n\n"); ++ fprintf(stderr, "Options:\n\n"); ++ fprintf(stderr, "--hide-whitespace: Hide whitespace between pages in text documents.\n"); + return 1; + } + +@@ -475,13 +477,25 @@ static void createView(GtkWidget* pButton, gpointer /*pItem*/) + } + + /// Creates a new model, i.e. LOK init and document load, one view implicitly. +-static void createModelAndView(const char* pLOPath, const char* pDocPath) ++static void createModelAndView(const char* pLOPath, const char* pDocPath, const std::vector& rArguments) + { + GtkWidget* pDocView = lok_doc_view_new(pLOPath, nullptr, nullptr); + + setupWidgetAndCreateWindow(pDocView); + +- lok_doc_view_open_document(LOK_DOC_VIEW(pDocView), pDocPath, nullptr, openDocumentCallback, pDocView); ++ boost::property_tree::ptree aTree; ++ for (const std::string& rArgument : rArguments) ++ { ++ if (rArgument == "--hide-whitespace") ++ { ++ aTree.put(boost::property_tree::ptree::path_type(".uno:HideWhitespace/type", '/'), "boolean"); ++ aTree.put(boost::property_tree::ptree::path_type(".uno:HideWhitespace/value", '/'), true); ++ } ++ } ++ std::stringstream aStream; ++ boost::property_tree::write_json(aStream, aTree); ++ std::string aArguments = aStream.str(); ++ lok_doc_view_open_document(LOK_DOC_VIEW(pDocView), pDocPath, aArguments.c_str(), nullptr, openDocumentCallback, pDocView); + } + + /// Our GtkClipboardGetFunc implementation for HTML. +@@ -1262,7 +1276,10 @@ int main( int argc, char* argv[] ) + + gtk_init( &argc, &argv ); + +- createModelAndView(argv[1], argv[2]); ++ std::vector aArguments; ++ for (int i = 3; i < argc; ++i) ++ aArguments.push_back(argv[i]); ++ createModelAndView(argv[1], argv[2], aArguments); + + gtk_main(); + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 802d85dea553..464348d95f1c 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -44,6 +44,7 @@ struct LOKDocViewPrivateImpl + { + const gchar* m_aLOPath; + const gchar* m_aDocPath; ++ std::string m_aRenderingArguments; + gdouble m_nLoadProgress; + gboolean m_bIsLoading; + gboolean m_bCanZoomIn; +@@ -530,7 +531,7 @@ static gboolean postDocumentLoad(gpointer pData) + LOKDocViewPrivate& priv = getPrivate(pLOKDocView); + + priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId); +- priv->m_pDocument->pClass->initializeForRendering(priv->m_pDocument, nullptr); ++ priv->m_pDocument->pClass->initializeForRendering(priv->m_pDocument, priv->m_aRenderingArguments.c_str()); + priv->m_pDocument->pClass->registerCallback(priv->m_pDocument, callbackWorker, pLOKDocView); + priv->m_pDocument->pClass->getDocumentSize(priv->m_pDocument, &priv->m_nDocumentWidthTwips, &priv->m_nDocumentHeightTwips); + g_timeout_add(600, handleTimeout, pLOKDocView); +@@ -2312,6 +2313,7 @@ lok_doc_view_open_document_finish (LOKDocView* pDocView, GAsyncResult* res, GErr + SAL_DLLPUBLIC_EXPORT void + lok_doc_view_open_document (LOKDocView* pDocView, + const gchar* pPath, ++ const gchar* pRenderingArguments, + GCancellable* cancellable, + GAsyncReadyCallback callback, + gpointer userdata) +@@ -2324,6 +2326,7 @@ lok_doc_view_open_document (LOKDocView* pDocView, + pLOEvent->m_pPath = pPath; + + priv->m_aDocPath = pPath; ++ priv->m_aRenderingArguments = pRenderingArguments; + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + + g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); +-- +2.12.0 + diff --git a/SOURCES/0346-sw-lok-comments-don-t-paint-hidden-comment-sub-widge.patch b/SOURCES/0346-sw-lok-comments-don-t-paint-hidden-comment-sub-widge.patch new file mode 100644 index 0000000..5284131 --- /dev/null +++ b/SOURCES/0346-sw-lok-comments-don-t-paint-hidden-comment-sub-widge.patch @@ -0,0 +1,38 @@ +From 8891a0194cf213d05dd5bc96d24c20f5b224ca4f Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Thu, 19 Nov 2015 14:57:38 +0100 +Subject: [PATCH 346/398] sw lok comments: don't paint hidden comment + sub-widgets + +Change-Id: Ia513821b43729951c7b097fea498f0e22b9d10ea +(cherry picked from commit 8a1b9ac592c026de6c764277a6ad1f8db9a4a679) +--- + sw/source/uibase/docvw/SidebarWin.cxx | 8 +++----- + 1 file changed, 3 insertions(+), 5 deletions(-) + +diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx +index 9d12a12eae35..5f6cfa7c4ae0 100644 +--- a/sw/source/uibase/docvw/SidebarWin.cxx ++++ b/sw/source/uibase/docvw/SidebarWin.cxx +@@ -276,15 +276,13 @@ void SwSidebarWin::PaintTile(vcl::RenderContext& rRenderContext, const Rectangle + { + vcl::Window* pChild = GetChild(i); + +- // This would at the moment just draw a gray rectangle at the top right +- // corner, need to sort out later. +- if (pChild == mpVScrollbar.get()) +- continue; +- + // No point in showing this button till click on it are not handled. + if (pChild == mpMenuButton.get()) + continue; + ++ if (!pChild->IsVisible()) ++ continue; ++ + rRenderContext.Push(PushFlags::MAPMODE); + const Fraction& rFraction(mrView.GetWrtShellPtr()->GetOut()->GetMapMode().GetScaleY()); + Point aOffset(PixelToLogic(pChild->GetPosPixel() * rFraction.GetDenominator() / rFraction.GetNumerator())); +-- +2.12.0 + diff --git a/SOURCES/0347-editeng-lok-invalidate-on-scroll.patch b/SOURCES/0347-editeng-lok-invalidate-on-scroll.patch new file mode 100644 index 0000000..2b899f7 --- /dev/null +++ b/SOURCES/0347-editeng-lok-invalidate-on-scroll.patch @@ -0,0 +1,51 @@ +From c5aac6c349e0d227f5594005948012088045bf3f Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Thu, 19 Nov 2015 15:09:05 +0100 +Subject: [PATCH 347/398] editeng lok: invalidate on scroll + +E.g. when a Witer comment has long enough contents to get scrolled, the +desktop case repaints its contents by vcl::Window::Scroll(), followed by +a vcl::Window::Update(), i.e. vcl::Window::Invalidate() is not called. + +The result of this in case of tiled rendering is that no tile is +repainted, so call vcl::Window::Invalidate() after scrolling manually. + +A generic VCL-level invalidate-after-scroll is not wanted, as the +scrolling of the document contents and the main document window is not +in sync when tiled rendering. + +(cherry picked from commit 162ae47a046b0c501e09d611a9834e875db884b8) + +Change-Id: I74296a0f0e52c92cf3db6aefa73f28bb2b202871 +--- + editeng/source/editeng/impedit.cxx | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx +index 0207155e4d75..54ce4b06188f 100644 +--- a/editeng/source/editeng/impedit.cxx ++++ b/editeng/source/editeng/impedit.cxx +@@ -47,6 +47,8 @@ + #include + #include + #include ++#include ++#include + + using namespace ::com::sun::star; + using namespace ::com::sun::star::uno; +@@ -1085,6 +1087,11 @@ Pair ImpEditView::Scroll( long ndX, long ndY, sal_uInt8 nRangeCheck ) + aVisDocStartPos = pOutWin->PixelToLogic( aVisDocStartPos ); + Rectangle aRect( aOutArea ); + pOutWin->Scroll( nRealDiffX, nRealDiffY, aRect, SCROLL_CLIP ); ++ ++ if (comphelper::LibreOfficeKit::isActive()) ++ // Need to invalidate the window, otherwise no tile will be re-painted. ++ pOutWin->Invalidate(); ++ + pOutWin->Update(); + pCrsr->SetPos( pCrsr->GetPos() + Point( nRealDiffX, nRealDiffY ) ); + if ( bVisCursor ) +-- +2.12.0 + diff --git a/SOURCES/0348-sw-lok-comments-optimize-sidebar-text-control-invali.patch b/SOURCES/0348-sw-lok-comments-optimize-sidebar-text-control-invali.patch new file mode 100644 index 0000000..54eb456 --- /dev/null +++ b/SOURCES/0348-sw-lok-comments-optimize-sidebar-text-control-invali.patch @@ -0,0 +1,70 @@ +From eea254dd5eb834b846ff9c55662d5704c266f438 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Thu, 19 Nov 2015 16:11:43 +0100 +Subject: [PATCH 348/398] sw lok comments: optimize sidebar text control + invalidation + +Instead of invalidating the whole area, invalidate the sub-widget when +the whole area of the sub-widget would be invalidated. + +With this, a test comment with enough comment to have a scrollbar +results in 3 paintTile() calls instead of 11 ones (70% save). + +(cherry picked from commit 9ece5c870a0ce39690109777bb8f76c1463a10c2) + +Change-Id: I2fe317549eefac9a63aaf50f5a9a242e15c4dc86 +--- + sw/source/uibase/docvw/SidebarTxtControl.cxx | 34 ++++++++++++++++------------ + 1 file changed, 19 insertions(+), 15 deletions(-) + +diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx +index d6887a475312..4558c4071bfd 100644 +--- a/sw/source/uibase/docvw/SidebarTxtControl.cxx ++++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx +@@ -190,24 +190,28 @@ void SidebarTextControl::Paint(vcl::RenderContext& rRenderContext, const Rectang + + void SidebarTextControl::LogicInvalidate(const Rectangle* pRectangle) + { +- OString sRectangle; ++ Rectangle aRectangle; ++ + if (!pRectangle) +- sRectangle = "EMPTY"; +- else + { +- // Convert from relative twips to absolute ones. +- Rectangle aRectangle(*pRectangle); +- vcl::Window& rParent = *mrSidebarWin.EditWin(); +- Point aOffset(GetOutOffXPixel() - rParent.GetOutOffXPixel(), GetOutOffYPixel() - rParent.GetOutOffYPixel()); +- rParent.Push(PushFlags::MAPMODE); +- rParent.EnableMapMode(); +- aOffset = rParent.PixelToLogic(aOffset); +- rParent.Pop(); +- aRectangle.Move(aOffset.getX(), aOffset.getY()); +- +- sRectangle = aRectangle.toString(); ++ Push(PushFlags::MAPMODE); ++ EnableMapMode(); ++ aRectangle = Rectangle(Point(0, 0), PixelToLogic(GetSizePixel())); ++ Pop(); + } +- ++ else ++ aRectangle = *pRectangle; ++ ++ // Convert from relative twips to absolute ones. ++ vcl::Window& rParent = *mrSidebarWin.EditWin(); ++ Point aOffset(GetOutOffXPixel() - rParent.GetOutOffXPixel(), GetOutOffYPixel() - rParent.GetOutOffYPixel()); ++ rParent.Push(PushFlags::MAPMODE); ++ rParent.EnableMapMode(); ++ aOffset = rParent.PixelToLogic(aOffset); ++ rParent.Pop(); ++ aRectangle.Move(aOffset.getX(), aOffset.getY()); ++ ++ OString sRectangle = aRectangle.toString(); + SwWrtShell& rWrtShell = mrDocView.GetWrtShell(); + rWrtShell.libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); + } +-- +2.12.0 + diff --git a/SOURCES/0349-gtktiledviewer-allow-setting-custom-background-color.patch b/SOURCES/0349-gtktiledviewer-allow-setting-custom-background-color.patch new file mode 100644 index 0000000..923979d --- /dev/null +++ b/SOURCES/0349-gtktiledviewer-allow-setting-custom-background-color.patch @@ -0,0 +1,51 @@ +From 57101e7a5600ceffc78c92414bba545cf6c1c513 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Thu, 19 Nov 2015 17:29:31 +0100 +Subject: [PATCH 349/398] gtktiledviewer: allow setting custom background color + +E.g. it helps testing the semi-transparent shadow around Writer pages to +append "--background-color yellow" to the commandline arguments. + +Change-Id: Ib94750e936abe3f41e4982534431fd5115e2c543 +(cherry picked from commit 9dea0a9775c1ab8c6ce8bbf00df83757cba34fb0) +--- + libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index f9034298e65c..aeccab11b3b2 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -32,6 +32,7 @@ static int help() + fprintf(stderr, "Usage: gtktiledviewer [ ... ]\n\n"); + fprintf(stderr, "Options:\n\n"); + fprintf(stderr, "--hide-whitespace: Hide whitespace between pages in text documents.\n"); ++ fprintf(stderr, "--background-color : Set custom background color, e.g. 'yellow'.\n"); + return 1; + } + +@@ -484,13 +485,20 @@ static void createModelAndView(const char* pLOPath, const char* pDocPath, const + setupWidgetAndCreateWindow(pDocView); + + boost::property_tree::ptree aTree; +- for (const std::string& rArgument : rArguments) ++ for (size_t i = 0; i < rArguments.size(); ++i) + { ++ const std::string& rArgument = rArguments[i]; + if (rArgument == "--hide-whitespace") + { + aTree.put(boost::property_tree::ptree::path_type(".uno:HideWhitespace/type", '/'), "boolean"); + aTree.put(boost::property_tree::ptree::path_type(".uno:HideWhitespace/value", '/'), true); + } ++ else if (rArgument == "--background-color" && i + 1 < rArguments.size()) ++ { ++ GdkRGBA color; ++ gdk_rgba_parse(&color, rArguments[i + 1].c_str()); ++ gtk_widget_override_background_color(gtk_widget_get_toplevel(pDocView), GTK_STATE_FLAG_NORMAL, &color); ++ } + } + std::stringstream aStream; + boost::property_tree::write_json(aStream, aTree); +-- +2.12.0 + diff --git a/SOURCES/0350-Werror-Wdeprecated-declarations.patch b/SOURCES/0350-Werror-Wdeprecated-declarations.patch new file mode 100644 index 0000000..f3cc8d4 --- /dev/null +++ b/SOURCES/0350-Werror-Wdeprecated-declarations.patch @@ -0,0 +1,37 @@ +From 01d4962ea8624a5f2a020a26020f725cd652b923 Mon Sep 17 00:00:00 2001 +From: Stephan Bergmann +Date: Fri, 20 Nov 2015 08:55:58 +0100 +Subject: [PATCH 350/398] -Werror,-Wdeprecated-declarations + +Change-Id: I7c7d3dda02a3745128a5a125b4b6952e087cdcda +(cherry picked from commit 9a29e2f539fe3ca21229d6073455a736c64cc4e8) +--- + libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index aeccab11b3b2..e44a92a3f3de 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -19,6 +19,8 @@ + #include + #include + ++#include ++ + #define LOK_USE_UNSTABLE_API + #include + #include +@@ -497,7 +499,9 @@ static void createModelAndView(const char* pLOPath, const char* pDocPath, const + { + GdkRGBA color; + gdk_rgba_parse(&color, rArguments[i + 1].c_str()); ++ SAL_WNODEPRECATED_DECLARATIONS_PUSH + gtk_widget_override_background_color(gtk_widget_get_toplevel(pDocView), GTK_STATE_FLAG_NORMAL, &color); ++ SAL_WNODEPRECATED_DECLARATIONS_POP + } + } + std::stringstream aStream; +-- +2.12.0 + diff --git a/SOURCES/0351-sw-lok-comments-implement-painting-of-the-vertical-s.patch b/SOURCES/0351-sw-lok-comments-implement-painting-of-the-vertical-s.patch new file mode 100644 index 0000000..0368193 --- /dev/null +++ b/SOURCES/0351-sw-lok-comments-implement-painting-of-the-vertical-s.patch @@ -0,0 +1,50 @@ +From 10e3ea1d50a225b92a56c83ccf881807fbc7b0eb Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Fri, 20 Nov 2015 10:24:29 +0100 +Subject: [PATCH 351/398] sw lok comments: implement painting of the vertical + scrollbar + +This one is special, as normally its map mode is in pixels, but we need +all sub-widgets to work in twips when tiled rendering. + +With this, the scrollbar widget (both the buttons and the +button/background area of the scrollbar itself) is painted at the +correct location when Writer comments have enough content so the +scrollbar is visible. + +Change-Id: I4ee9ef8618974b965339078d2262364ec19732ef +(cherry picked from commit f411ef1b8065d3ae03d1a820812e64b250de0932) +--- + sw/source/uibase/docvw/SidebarWin.cxx | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx +index 5f6cfa7c4ae0..6acbc1da7077 100644 +--- a/sw/source/uibase/docvw/SidebarWin.cxx ++++ b/sw/source/uibase/docvw/SidebarWin.cxx +@@ -290,8 +290,22 @@ void SwSidebarWin::PaintTile(vcl::RenderContext& rRenderContext, const Rectangle + aMapMode.SetOrigin(aMapMode.GetOrigin() + aOffset); + rRenderContext.SetMapMode(aMapMode); + ++ bool bPopChild = false; ++ if (pChild->GetMapMode().GetMapUnit() != rRenderContext.GetMapMode().GetMapUnit()) ++ { ++ // This is needed for the scrollbar that has its map unit in pixels. ++ pChild->Push(PushFlags::MAPMODE); ++ bPopChild = true; ++ pChild->EnableMapMode(); ++ aMapMode = pChild->GetMapMode(); ++ aMapMode.SetMapUnit(rRenderContext.GetMapMode().GetMapUnit()); ++ pChild->SetMapMode(aMapMode); ++ } ++ + pChild->Paint(rRenderContext, rRect); + ++ if (bPopChild) ++ pChild->Pop(); + rRenderContext.Pop(); + } + +-- +2.12.0 + diff --git a/SOURCES/0352-LOK-add-Document-getTileMode.patch b/SOURCES/0352-LOK-add-Document-getTileMode.patch new file mode 100644 index 0000000..5706434 --- /dev/null +++ b/SOURCES/0352-LOK-add-Document-getTileMode.patch @@ -0,0 +1,105 @@ +From 12553d62d3738a51b1021c9a5d37a70cb2bc1e45 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Mon, 23 Nov 2015 09:32:37 +0100 +Subject: [PATCH 352/398] LOK: add Document::getTileMode() + +So that clients can know if they get old-style RGBA or new-style ARGB +output in paintTile(). + +Change-Id: Icfde4b3259444b3524e64478ccd976664a3fe0ed +(cherry picked from commit fc06f801ee79fd49d54c27121ae9b2904d99f09c) +--- + desktop/source/lib/init.cxx | 7 +++++++ + include/LibreOfficeKit/LibreOfficeKit.h | 3 +++ + include/LibreOfficeKit/LibreOfficeKit.hxx | 10 ++++++++++ + include/LibreOfficeKit/LibreOfficeKitEnums.h | 7 +++++++ + 4 files changed, 27 insertions(+) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 3c6be03a7132..00c1f63ddf4c 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -311,6 +311,7 @@ void doc_paintTile(LibreOfficeKitDocument* pThis, + const int nCanvasWidth, const int nCanvasHeight, + const int nTilePosX, const int nTilePosY, + const int nTileWidth, const int nTileHeight); ++static int doc_getTileMode(LibreOfficeKitDocument* pThis); + static void doc_getDocumentSize(LibreOfficeKitDocument* pThis, + long* pWidth, + long* pHeight); +@@ -384,6 +385,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference getPartName = doc_getPartName; + m_pDocumentClass->setPartMode = doc_setPartMode; + m_pDocumentClass->paintTile = doc_paintTile; ++ m_pDocumentClass->getTileMode = doc_getTileMode; + m_pDocumentClass->getDocumentSize = doc_getDocumentSize; + m_pDocumentClass->initializeForRendering = doc_initializeForRendering; + m_pDocumentClass->registerCallback = doc_registerCallback; +@@ -956,6 +958,11 @@ void doc_paintTile (LibreOfficeKitDocument* pThis, + #endif + } + ++static int doc_getTileMode(LibreOfficeKitDocument* /*pThis*/) ++{ ++ return LOK_TILEMODE_RGBA; ++} ++ + static void doc_getDocumentSize(LibreOfficeKitDocument* pThis, + long* pWidth, + long* pHeight) +diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h +index 93f7dca6d455..5189cca5eb5e 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.h ++++ b/include/LibreOfficeKit/LibreOfficeKit.h +@@ -118,6 +118,9 @@ struct _LibreOfficeKitDocumentClass + const int nTileWidth, + const int nTileHeight); + ++ /// @see lok::Document::getTileMode(). ++ int (*getTileMode) (LibreOfficeKitDocument* pThis); ++ + /// @see lok::Document::getDocumentSize(). + void (*getDocumentSize) (LibreOfficeKitDocument* pThis, + long* pWidth, +diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx +index 152d0f415f17..e592bbe549ab 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.hxx ++++ b/include/LibreOfficeKit/LibreOfficeKit.hxx +@@ -143,6 +143,16 @@ public: + nTilePosX, nTilePosY, nTileWidth, nTileHeight); + } + ++ /** ++ * Gets the tile mode: the pixel format used for the pBuffer of paintTile(). ++ * ++ * @return an element of the LibreOfficeKitTileMode enum. ++ */ ++ inline int getTileMode() ++ { ++ return mpDoc->pClass->getTileMode(mpDoc); ++ } ++ + /// Get the document sizes in TWIPs. + inline void getDocumentSize(long* pWidth, long* pHeight) + { +diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h +index 7b23fcbab1c3..b713f0ed49b7 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h ++++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h +@@ -35,6 +35,13 @@ LibreOfficeKitPartMode; + + typedef enum + { ++ LOK_TILEMODE_RGBA, ++ LOK_TILEMODE_ARGB ++} ++LibreOfficeKitTileMode; ++ ++typedef enum ++{ + /** + * Any tiles which are over the rectangle described in the payload are no + * longer valid. +-- +2.12.0 + diff --git a/SOURCES/0353-sw-lok-comments-fix-vertical-scrollbar-with-custom-z.patch b/SOURCES/0353-sw-lok-comments-fix-vertical-scrollbar-with-custom-z.patch new file mode 100644 index 0000000..1999bb2 --- /dev/null +++ b/SOURCES/0353-sw-lok-comments-fix-vertical-scrollbar-with-custom-z.patch @@ -0,0 +1,63 @@ +From 0fb40ac6ec515ccc3b1db575232aa4e01c46e815 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Mon, 23 Nov 2015 13:46:59 +0100 +Subject: [PATCH 353/398] sw lok comments: fix vertical scrollbar with custom + zoom + +With this, if a comment has enough content that it gets a vertical +scrollbar, then tiled rendering output looks OK, even with non-100% +zoom. + +Change-Id: I699aadc11b6c34fb0791e70705719fd61169d972 +(cherry picked from commit 30b511ae38e2870174db91d12f65a9c3320fc172) +--- + sw/source/core/view/viewsh.cxx | 9 +++++++++ + sw/source/uibase/docvw/SidebarWin.cxx | 5 +++-- + 2 files changed, 12 insertions(+), 2 deletions(-) + +diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx +index 963577fb1bd8..093d5208fdda 100644 +--- a/sw/source/core/view/viewsh.cxx ++++ b/sw/source/core/view/viewsh.cxx +@@ -1879,6 +1879,15 @@ void SwViewShell::PaintTile(VirtualDevice &rDevice, int contextWidth, int contex + aMapMode.SetScaleY(scaleY); + rDevice.SetMapMode(aMapMode); + ++ // Update scaling of SwEditWin and its sub-widgets, needed for comments. ++ if (GetWin() && GetWin()->GetMapMode().GetScaleX() != scaleX) ++ { ++ double fScale = scaleX; ++ SwViewOption aOption(*GetViewOptions()); ++ aOption.SetZoom(fScale * 100); ++ ApplyViewOptions(aOption); ++ } ++ + Rectangle aOutRect = Rectangle(Point(tilePosX, tilePosY), + rDevice.PixelToLogic(Size(contextWidth, contextHeight))); + +diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx +index 6acbc1da7077..47c65c86b06b 100644 +--- a/sw/source/uibase/docvw/SidebarWin.cxx ++++ b/sw/source/uibase/docvw/SidebarWin.cxx +@@ -284,8 +284,7 @@ void SwSidebarWin::PaintTile(vcl::RenderContext& rRenderContext, const Rectangle + continue; + + rRenderContext.Push(PushFlags::MAPMODE); +- const Fraction& rFraction(mrView.GetWrtShellPtr()->GetOut()->GetMapMode().GetScaleY()); +- Point aOffset(PixelToLogic(pChild->GetPosPixel() * rFraction.GetDenominator() / rFraction.GetNumerator())); ++ Point aOffset(PixelToLogic(pChild->GetPosPixel())); + MapMode aMapMode(rRenderContext.GetMapMode()); + aMapMode.SetOrigin(aMapMode.GetOrigin() + aOffset); + rRenderContext.SetMapMode(aMapMode); +@@ -299,6 +298,8 @@ void SwSidebarWin::PaintTile(vcl::RenderContext& rRenderContext, const Rectangle + pChild->EnableMapMode(); + aMapMode = pChild->GetMapMode(); + aMapMode.SetMapUnit(rRenderContext.GetMapMode().GetMapUnit()); ++ aMapMode.SetScaleX(rRenderContext.GetMapMode().GetScaleX()); ++ aMapMode.SetScaleY(rRenderContext.GetMapMode().GetScaleY()); + pChild->SetMapMode(aMapMode); + } + +-- +2.12.0 + diff --git a/SOURCES/0354-updae-getTileMode.patch b/SOURCES/0354-updae-getTileMode.patch new file mode 100644 index 0000000..d18a66d --- /dev/null +++ b/SOURCES/0354-updae-getTileMode.patch @@ -0,0 +1,41 @@ +From b233cb8b04d35d8f9c9aa8c49940b229acdde0a7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= +Date: Mon, 23 Nov 2015 11:04:26 +0000 +Subject: [PATCH 354/398] updae getTileMode + +Change-Id: Ic8d67f08d40f475020c0534570fe3bea07aa431b +(cherry picked from commit d058765ff3c4f3aaa84c3f9bec774aed8a8b32a3) +--- + desktop/source/lib/init.cxx | 2 +- + include/LibreOfficeKit/LibreOfficeKitEnums.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 00c1f63ddf4c..4630ed0095b4 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -960,7 +960,7 @@ void doc_paintTile (LibreOfficeKitDocument* pThis, + + static int doc_getTileMode(LibreOfficeKitDocument* /*pThis*/) + { +- return LOK_TILEMODE_RGBA; ++ return LOK_TILEMODE_BGRA; + } + + static void doc_getDocumentSize(LibreOfficeKitDocument* pThis, +diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h +index b713f0ed49b7..a0f5e886dcac 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h ++++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h +@@ -36,7 +36,7 @@ LibreOfficeKitPartMode; + typedef enum + { + LOK_TILEMODE_RGBA, +- LOK_TILEMODE_ARGB ++ LOK_TILEMODE_BGRA + } + LibreOfficeKitTileMode; + +-- +2.12.0 + diff --git a/SOURCES/0355-vcl-lok-fix-scrollbar-to-accept-mouse-events-in-twip.patch b/SOURCES/0355-vcl-lok-fix-scrollbar-to-accept-mouse-events-in-twip.patch new file mode 100644 index 0000000..ed843ca --- /dev/null +++ b/SOURCES/0355-vcl-lok-fix-scrollbar-to-accept-mouse-events-in-twip.patch @@ -0,0 +1,41 @@ +From 65410a3cf918fc17bf92c1ad48574e17e79a62bc Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Mon, 23 Nov 2015 16:07:49 +0100 +Subject: [PATCH 355/398] vcl lok: fix scrollbar to accept mouse events in + twips + +(cherry picked from commit 439765480695975e10c92f39aa6a4cb6f2ee7646) + +Change-Id: Ieaedaa525d613f8ba55f336c613da163a09f7a33 +--- + vcl/source/control/scrbar.cxx | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx +index a60595c2ee0d..e8004d13d177 100644 +--- a/vcl/source/control/scrbar.cxx ++++ b/vcl/source/control/scrbar.cxx +@@ -897,7 +897,19 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt ) + + if (rMEvt.IsLeft() || rMEvt.IsMiddle() || rMEvt.IsRight()) + { +- const Point& rMousePos = rMEvt.GetPosPixel(); ++ Point aPosPixel; ++ if (!IsMapModeEnabled() && GetMapMode().GetMapUnit() == MAP_TWIP) ++ { ++ // rMEvt coordinates are in twips. ++ Push(PushFlags::MAPMODE); ++ EnableMapMode(); ++ MapMode aMapMode = GetMapMode(); ++ aMapMode.SetOrigin(Point(0, 0)); ++ SetMapMode(aMapMode); ++ aPosPixel = LogicToPixel(rMEvt.GetPosPixel()); ++ Pop(); ++ } ++ const Point& rMousePos = (GetMapMode().GetMapUnit() != MAP_TWIP ? rMEvt.GetPosPixel() : aPosPixel); + sal_uInt16 nTrackFlags = 0; + bool bHorizontal = ( GetStyle() & WB_HORZ ) != 0; + bool bIsInside = false; +-- +2.12.0 + diff --git a/SOURCES/0356-sw-lok-comments-handle-mouse-up-down-events-on-the-v.patch b/SOURCES/0356-sw-lok-comments-handle-mouse-up-down-events-on-the-v.patch new file mode 100644 index 0000000..131a3a4 --- /dev/null +++ b/SOURCES/0356-sw-lok-comments-handle-mouse-up-down-events-on-the-v.patch @@ -0,0 +1,112 @@ +From 107c94bbccb8c2607d02bc37096a332c90ba9e83 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Mon, 23 Nov 2015 16:21:43 +0100 +Subject: [PATCH 356/398] sw lok comments: handle mouse up/down events on the + vertical scrollbar + +(cherry picked from commit 527190f0c0284a9a4f5a021d0a9163ef9a63a67f) + +Change-Id: Ib1c334825a6629224fe0c8fba564656d53e67410 +--- + sw/source/uibase/docvw/SidebarWin.cxx | 55 ++++++++++++++++++++++++++++------- + 1 file changed, 45 insertions(+), 10 deletions(-) + +diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx +index 47c65c86b06b..c95a8909de54 100644 +--- a/sw/source/uibase/docvw/SidebarWin.cxx ++++ b/sw/source/uibase/docvw/SidebarWin.cxx +@@ -93,9 +93,19 @@ void lcl_translateTwips(vcl::Window& rParent, vcl::Window& rChild, MouseEvent* p + { + // Set map mode, so that callback payloads will contain absolute coordinates instead of relative ones. + Point aOffset(rChild.GetOutOffXPixel() - rParent.GetOutOffXPixel(), rChild.GetOutOffYPixel() - rParent.GetOutOffYPixel()); ++ if (!rChild.IsMapModeEnabled()) ++ { ++ MapMode aMapMode(rChild.GetMapMode()); ++ aMapMode.SetMapUnit(MAP_TWIP); ++ aMapMode.SetScaleX(rParent.GetMapMode().GetScaleX()); ++ aMapMode.SetScaleY(rParent.GetMapMode().GetScaleY()); ++ rChild.SetMapMode(aMapMode); ++ rChild.EnableMapMode(); ++ } + aOffset = rChild.PixelToLogic(aOffset); + MapMode aMapMode(rChild.GetMapMode()); + aMapMode.SetOrigin(aOffset); ++ aMapMode.SetMapUnit(rParent.GetMapMode().GetMapUnit()); + rChild.SetMapMode(aMapMode); + rChild.EnableMapMode(false); + +@@ -109,6 +119,31 @@ void lcl_translateTwips(vcl::Window& rParent, vcl::Window& rChild, MouseEvent* p + } + } + ++/// Decide which one from the children of rParent should get rMouseEvent. ++vcl::Window* lcl_getHitWindow(sw::sidebarwindows::SwSidebarWin& rParent, const MouseEvent& rMouseEvent) ++{ ++ vcl::Window* pRet = 0; ++ ++ rParent.EditWin()->Push(PushFlags::MAPMODE); ++ rParent.EditWin()->EnableMapMode(); ++ for (sal_Int16 i = rParent.GetChildCount() - 1; i >= 0; --i) ++ { ++ vcl::Window* pChild = rParent.GetChild(i); ++ ++ Point aPosition(rParent.GetPosPixel()); ++ aPosition.Move(pChild->GetPosPixel().getX(), pChild->GetPosPixel().getY()); ++ Size aSize(rParent.GetSizePixel()); ++ Rectangle aRectangleLogic(rParent.EditWin()->PixelToLogic(aPosition), rParent.EditWin()->PixelToLogic(aSize)); ++ if (aRectangleLogic.IsInside(rMouseEvent.GetPosPixel())) ++ { ++ pRet = pChild; ++ break; ++ } ++ } ++ rParent.EditWin()->Pop(); ++ return pRet; ++} ++ + } + + namespace sw { namespace sidebarwindows { +@@ -442,29 +477,29 @@ void SwSidebarWin::MouseMove(const MouseEvent& rMouseEvent) + + void SwSidebarWin::MouseButtonDown(const MouseEvent& rMouseEvent) + { +- if (mpSidebarTextControl) ++ if (vcl::Window* pHit = lcl_getHitWindow(*this, rMouseEvent)) + { +- mpSidebarTextControl->Push(PushFlags::MAPMODE); ++ pHit->Push(PushFlags::MAPMODE); + MouseEvent aMouseEvent(rMouseEvent); +- lcl_translateTwips(*EditWin(), *mpSidebarTextControl, &aMouseEvent); ++ lcl_translateTwips(*EditWin(), *pHit, &aMouseEvent); + +- mpSidebarTextControl->MouseButtonDown(aMouseEvent); ++ pHit->MouseButtonDown(aMouseEvent); + +- mpSidebarTextControl->Pop(); ++ pHit->Pop(); + } + } + + void SwSidebarWin::MouseButtonUp(const MouseEvent& rMouseEvent) + { +- if (mpSidebarTextControl) ++ if (vcl::Window* pHit = lcl_getHitWindow(*this, rMouseEvent)) + { +- mpSidebarTextControl->Push(PushFlags::MAPMODE); ++ pHit->Push(PushFlags::MAPMODE); + MouseEvent aMouseEvent(rMouseEvent); +- lcl_translateTwips(*EditWin(), *mpSidebarTextControl, &aMouseEvent); ++ lcl_translateTwips(*EditWin(), *pHit, &aMouseEvent); + +- mpSidebarTextControl->MouseButtonUp(aMouseEvent); ++ pHit->MouseButtonUp(aMouseEvent); + +- mpSidebarTextControl->Pop(); ++ pHit->Pop(); + } + } + +-- +2.12.0 + diff --git a/SOURCES/0357-desktop-fix-LOK_DEBUG-rectangle-painting.patch b/SOURCES/0357-desktop-fix-LOK_DEBUG-rectangle-painting.patch new file mode 100644 index 0000000..eaef140 --- /dev/null +++ b/SOURCES/0357-desktop-fix-LOK_DEBUG-rectangle-painting.patch @@ -0,0 +1,57 @@ +From 7e9002c2a206f0c041e6437fbcfe478bab0664d6 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 24 Nov 2015 11:54:24 +0100 +Subject: [PATCH 357/398] desktop: fix LOK_DEBUG rectangle painting + +(cherry picked from commit fa377a06627bba0c995aae55b346bb9530ecdf7e) + +Change-Id: If023e409fad6fed8c0345a66ea48c1ed9924bff0 +--- + desktop/source/lib/init.cxx | 24 ++++++++++++------------ + 1 file changed, 12 insertions(+), 12 deletions(-) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 4630ed0095b4..57bb177f49db 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -922,18 +922,6 @@ void doc_paintTile (LibreOfficeKitDocument* pThis, + pDoc->paintTile(*pDevice.get(), nCanvasWidth, nCanvasHeight, + nTilePosX, nTilePosY, nTileWidth, nTileHeight); + +- // Overwrite pBuffer's alpha channel with the separate alpha buffer. +- for (int nRow = 0; nRow < nCanvasHeight; ++nRow) +- { +- for (int nCol = 0; nCol < nCanvasWidth; ++nCol) +- { +- const int nOffset = (nCanvasWidth * nRow) + nCol; +- // VCL's transparent is 0, RGBA's transparent is 0xff. +- pBuffer[nOffset * 4 +3] = 0xff - aAlpha[nOffset]; +- } +- } +-#endif +- + static bool bDebug = getenv("LOK_DEBUG") != 0; + if (bDebug) + { +@@ -947,6 +935,18 @@ void doc_paintTile (LibreOfficeKitDocument* pThis, + pDevice->Pop(); + } + ++ // Overwrite pBuffer's alpha channel with the separate alpha buffer. ++ for (int nRow = 0; nRow < nCanvasHeight; ++nRow) ++ { ++ for (int nCol = 0; nCol < nCanvasWidth; ++nCol) ++ { ++ const int nOffset = (nCanvasWidth * nRow) + nCol; ++ // VCL's transparent is 0, RGBA's transparent is 0xff. ++ pBuffer[nOffset * 4 +3] = 0xff - aAlpha[nOffset]; ++ } ++ } ++#endif ++ + #else + (void) pBuffer; + (void) nCanvasWidth; +-- +2.12.0 + diff --git a/SOURCES/0358-sw-lok-comments-fix-missing-invalidations-from-the-s.patch b/SOURCES/0358-sw-lok-comments-fix-missing-invalidations-from-the-s.patch new file mode 100644 index 0000000..2a9eedc --- /dev/null +++ b/SOURCES/0358-sw-lok-comments-fix-missing-invalidations-from-the-s.patch @@ -0,0 +1,187 @@ +From 2c28091ad868b3d4f3512600a46b51f4ab57fc03 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 24 Nov 2015 11:58:09 +0100 +Subject: [PATCH 358/398] sw lok comments: fix missing invalidations from the + scrollbar + +If a comment had a scrollbar, and the user clicked on the down arrow of +it, then the button remained in the "pushed" state, as the scrollbar +invalidations were not routed to the LOK client. + +With this, the button gets back to its non-pushed state after the mouse +button is released. + +Change-Id: Ie4ba5d0ec07229b0cfc08532e8e91ae25f7a4c9e +(cherry picked from commit 55040ea13426e337418143dcfe226dd2a395f041) +--- + sw/Library_sw.mk | 1 + + sw/source/uibase/docvw/SidebarScrollBar.cxx | 72 +++++++++++++++++++++++++++++ + sw/source/uibase/docvw/SidebarScrollBar.hxx | 43 +++++++++++++++++ + sw/source/uibase/docvw/SidebarWin.cxx | 3 +- + 4 files changed, 118 insertions(+), 1 deletion(-) + create mode 100644 sw/source/uibase/docvw/SidebarScrollBar.cxx + create mode 100644 sw/source/uibase/docvw/SidebarScrollBar.hxx + +diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk +index ea8368719f7b..1297a85b874d 100644 +--- a/sw/Library_sw.mk ++++ b/sw/Library_sw.mk +@@ -600,6 +600,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\ + sw/source/uibase/docvw/OverlayRanges \ + sw/source/uibase/docvw/PostItMgr \ + sw/source/uibase/docvw/ShadowOverlayObject \ ++ sw/source/uibase/docvw/SidebarScrollBar \ + sw/source/uibase/docvw/SidebarTxtControl \ + sw/source/uibase/docvw/SidebarTxtControlAcc \ + sw/source/uibase/docvw/SidebarWin \ +diff --git a/sw/source/uibase/docvw/SidebarScrollBar.cxx b/sw/source/uibase/docvw/SidebarScrollBar.cxx +new file mode 100644 +index 000000000000..909aa763dba1 +--- /dev/null ++++ b/sw/source/uibase/docvw/SidebarScrollBar.cxx +@@ -0,0 +1,72 @@ ++/* -*- 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 ++ ++#define LOK_USE_UNSTABLE_API ++#include ++ ++#include ++#include ++#include ++#include ++ ++namespace sw ++{ ++namespace sidebarwindows ++{ ++ ++SidebarScrollBar::SidebarScrollBar(SwSidebarWin& rSidebarWin, WinBits nStyle, SwView& rView) ++ : ScrollBar(&rSidebarWin, nStyle), ++ m_rSidebarWin(rSidebarWin), ++ m_rView(rView) ++{ ++} ++ ++void SidebarScrollBar::LogicInvalidate(const Rectangle* pRectangle) ++{ ++ Rectangle aRectangle; ++ ++ if (!pRectangle) ++ { ++ Push(PushFlags::MAPMODE); ++ EnableMapMode(); ++ MapMode aMapMode = GetMapMode(); ++ aMapMode.SetMapUnit(MAP_TWIP); ++ SetMapMode(aMapMode); ++ aRectangle = Rectangle(Point(0, 0), PixelToLogic(GetSizePixel())); ++ Pop(); ++ } ++ else ++ aRectangle = *pRectangle; ++ ++ // Convert from relative twips to absolute ones. ++ vcl::Window& rParent = m_rSidebarWin.EditWin(); ++ Point aOffset(GetOutOffXPixel() - rParent.GetOutOffXPixel(), GetOutOffYPixel() - rParent.GetOutOffYPixel()); ++ rParent.Push(PushFlags::MAPMODE); ++ rParent.EnableMapMode(); ++ aOffset = rParent.PixelToLogic(aOffset); ++ rParent.Pop(); ++ aRectangle.Move(aOffset.getX(), aOffset.getY()); ++ ++ OString sRectangle = aRectangle.toString(); ++ SwWrtShell& rWrtShell = m_rView.GetWrtShell(); ++ rWrtShell.libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); ++} ++ ++ ++SidebarScrollBar::~SidebarScrollBar() ++{ ++ disposeOnce(); ++} ++ ++} ++} // end of namespace sw::sidebarwindows ++ ++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +diff --git a/sw/source/uibase/docvw/SidebarScrollBar.hxx b/sw/source/uibase/docvw/SidebarScrollBar.hxx +new file mode 100644 +index 000000000000..9543205387df +--- /dev/null ++++ b/sw/source/uibase/docvw/SidebarScrollBar.hxx +@@ -0,0 +1,43 @@ ++/* -*- 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_SW_SOURCE_UIBASE_DOCVW_SIDEBARSCROLLBAR_HXX ++#define INCLUDED_SW_SOURCE_UIBASE_DOCVW_SIDEBARSCROLLBAR_HXX ++ ++#include ++ ++class SwView; ++ ++namespace sw ++{ ++namespace sidebarwindows ++{ ++ ++class SwSidebarWin; ++ ++/// Similar to the VCL scrollbar, but instrumented with Writer-specific details for LOK. ++class SidebarScrollBar : public ScrollBar ++{ ++ SwSidebarWin& m_rSidebarWin; ++ SwView& m_rView; ++ ++protected: ++ /// @see OutputDevice::LogicInvalidate(). ++ void LogicInvalidate(const Rectangle* pRectangle) override; ++public: ++ SidebarScrollBar(SwSidebarWin& rSidebarWin, WinBits nStyle, SwView& rView); ++ virtual ~SidebarScrollBar(); ++}; ++ ++} ++} ++ ++#endif ++ ++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx +index c95a8909de54..1bfab323e833 100644 +--- a/sw/source/uibase/docvw/SidebarWin.cxx ++++ b/sw/source/uibase/docvw/SidebarWin.cxx +@@ -26,6 +26,7 @@ + #include + + #include ++#include + #include + #include + #include +@@ -623,7 +624,7 @@ void SwSidebarWin::InitControls() + } + + //create Scrollbars +- mpVScrollbar = VclPtr::Create(this, WB_3DLOOK |WB_VSCROLL|WB_DRAG); ++ mpVScrollbar = VclPtr::Create(*this, WB_3DLOOK |WB_VSCROLL|WB_DRAG, mrView); + mpVScrollbar->EnableNativeWidget(false); + mpVScrollbar->EnableRTL( false ); + mpVScrollbar->SetScrollHdl(LINK(this, SwSidebarWin, ScrollHdl)); +-- +2.12.0 + diff --git a/SOURCES/0359-vcl-lok-handle-tracking-coordinates-which-are-in-twi.patch b/SOURCES/0359-vcl-lok-handle-tracking-coordinates-which-are-in-twi.patch new file mode 100644 index 0000000..7c8a348 --- /dev/null +++ b/SOURCES/0359-vcl-lok-handle-tracking-coordinates-which-are-in-twi.patch @@ -0,0 +1,45 @@ +From 077f463e0fdb16d1bd37154d0cfcb84959c63a66 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 24 Nov 2015 15:01:01 +0100 +Subject: [PATCH 359/398] vcl lok: handle tracking coordinates which are in + twips + +This is similar to the mouse button down handling. When the map mode is +disabled and the map mode is in twips, then in general it's possible to +send mouse coordinates in twips. The scrollbar is usually in pixels, so +add extra code to still make this possible. + +Change-Id: I0c7e404ecd7ac839e000266e396683bb7d15c505 +(cherry picked from commit d7acb44b148893fe0cc48a54c3eb73406c251668) +--- + vcl/source/control/scrbar.cxx | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx +index e8004d13d177..0679c848b682 100644 +--- a/vcl/source/control/scrbar.cxx ++++ b/vcl/source/control/scrbar.cxx +@@ -1076,7 +1076,19 @@ void ScrollBar::Tracking( const TrackingEvent& rTEvt ) + } + else + { +- const Point rMousePos = rTEvt.GetMouseEvent().GetPosPixel(); ++ Point aPosPixel; ++ if (!IsMapModeEnabled() && GetMapMode().GetMapUnit() == MAP_TWIP) ++ { ++ // rTEvt coordinates are in twips. ++ Push(PushFlags::MAPMODE); ++ EnableMapMode(); ++ MapMode aMapMode = GetMapMode(); ++ aMapMode.SetOrigin(Point(0, 0)); ++ SetMapMode(aMapMode); ++ aPosPixel = LogicToPixel(rTEvt.GetMouseEvent().GetPosPixel()); ++ Pop(); ++ } ++ const Point rMousePos = (GetMapMode().GetMapUnit() != MAP_TWIP ? rTEvt.GetMouseEvent().GetPosPixel() : aPosPixel); + + // Dragging is treated in a special way + if ( meScrollType == SCROLL_DRAG ) +-- +2.12.0 + diff --git a/SOURCES/0360-sw-lok-comments-implement-drag-of-the-scrollbar.patch b/SOURCES/0360-sw-lok-comments-implement-drag-of-the-scrollbar.patch new file mode 100644 index 0000000..88ad3d2 --- /dev/null +++ b/SOURCES/0360-sw-lok-comments-implement-drag-of-the-scrollbar.patch @@ -0,0 +1,83 @@ +From c440339bcd6661fe49ba148317b557d0b2e249b6 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 24 Nov 2015 15:04:33 +0100 +Subject: [PATCH 360/398] sw lok comments: implement drag of the scrollbar + +With this, if a comment has a vertical scrollbar, then not only the +buttons of the scrollbar can be clicked on, but also the slider of the +scrollbar can be dragged. + +(cherry picked from commit d562df03098ecb91a89e91ccf69dd6a1eeb98c89) + +Change-Id: I2e39e18bf60c42a878bb8bfd808f1d47be27eecb +--- + sw/source/uibase/docvw/SidebarScrollBar.cxx | 7 ++++++- + sw/source/uibase/docvw/SidebarScrollBar.hxx | 1 + + sw/source/uibase/docvw/SidebarWin.cxx | 10 +++++----- + 3 files changed, 12 insertions(+), 6 deletions(-) + +diff --git a/sw/source/uibase/docvw/SidebarScrollBar.cxx b/sw/source/uibase/docvw/SidebarScrollBar.cxx +index 909aa763dba1..7a80363693d1 100644 +--- a/sw/source/uibase/docvw/SidebarScrollBar.cxx ++++ b/sw/source/uibase/docvw/SidebarScrollBar.cxx +@@ -47,7 +47,7 @@ void SidebarScrollBar::LogicInvalidate(const Rectangle* pRectangle) + aRectangle = *pRectangle; + + // Convert from relative twips to absolute ones. +- vcl::Window& rParent = m_rSidebarWin.EditWin(); ++ vcl::Window& rParent = *m_rSidebarWin.EditWin(); + Point aOffset(GetOutOffXPixel() - rParent.GetOutOffXPixel(), GetOutOffYPixel() - rParent.GetOutOffYPixel()); + rParent.Push(PushFlags::MAPMODE); + rParent.EnableMapMode(); +@@ -60,6 +60,11 @@ void SidebarScrollBar::LogicInvalidate(const Rectangle* pRectangle) + rWrtShell.libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); + } + ++void SidebarScrollBar::MouseMove(const MouseEvent& rMouseEvent) ++{ ++ TrackingEvent aEvent(rMouseEvent); ++ Tracking(aEvent); ++} + + SidebarScrollBar::~SidebarScrollBar() + { +diff --git a/sw/source/uibase/docvw/SidebarScrollBar.hxx b/sw/source/uibase/docvw/SidebarScrollBar.hxx +index 9543205387df..ea5639e42e92 100644 +--- a/sw/source/uibase/docvw/SidebarScrollBar.hxx ++++ b/sw/source/uibase/docvw/SidebarScrollBar.hxx +@@ -30,6 +30,7 @@ class SidebarScrollBar : public ScrollBar + protected: + /// @see OutputDevice::LogicInvalidate(). + void LogicInvalidate(const Rectangle* pRectangle) override; ++ void MouseMove(const MouseEvent& rMouseEvent) override; + public: + SidebarScrollBar(SwSidebarWin& rSidebarWin, WinBits nStyle, SwView& rView); + virtual ~SidebarScrollBar(); +diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx +index 1bfab323e833..d22bdd0c245b 100644 +--- a/sw/source/uibase/docvw/SidebarWin.cxx ++++ b/sw/source/uibase/docvw/SidebarWin.cxx +@@ -464,15 +464,15 @@ void SwSidebarWin::KeyInput(const KeyEvent& rKeyEvent) + + void SwSidebarWin::MouseMove(const MouseEvent& rMouseEvent) + { +- if (mpSidebarTextControl) ++ if (vcl::Window* pHit = lcl_getHitWindow(*this, rMouseEvent)) + { +- mpSidebarTextControl->Push(PushFlags::MAPMODE); ++ pHit->Push(PushFlags::MAPMODE); + MouseEvent aMouseEvent(rMouseEvent); +- lcl_translateTwips(*EditWin(), *mpSidebarTextControl, &aMouseEvent); ++ lcl_translateTwips(*EditWin(), *pHit, &aMouseEvent); + +- mpSidebarTextControl->MouseMove(aMouseEvent); ++ pHit->MouseMove(aMouseEvent); + +- mpSidebarTextControl->Pop(); ++ pHit->Pop(); + } + } + +-- +2.12.0 + diff --git a/SOURCES/0361-sw-lok-comments-avoid-crash-an-exit-after-clicking-t.patch b/SOURCES/0361-sw-lok-comments-avoid-crash-an-exit-after-clicking-t.patch new file mode 100644 index 0000000..dfd4652 --- /dev/null +++ b/SOURCES/0361-sw-lok-comments-avoid-crash-an-exit-after-clicking-t.patch @@ -0,0 +1,51 @@ +From 0410c35ff5f46e51def9a2515d8e5a72f8fd37c4 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 24 Nov 2015 15:20:22 +0100 +Subject: [PATCH 361/398] sw lok comments: avoid crash an exit after clicking + the scrollbar + +Without this, vcl::Window::ImplTrackTimerHdl() will be called on a +deleted vcl::Window. + +Can be reproduced with a comment having a scrollbar in a LOK client, +then clicking on the down button of the scrollbar a number of times -> +crash on exit. + +Change-Id: I5d67f96e8baa199f65ec5cf39cb5d39c8162ff33 +(cherry picked from commit 7c654ee9d51a752e02c0a972de27d699ab5b649a) +--- + sw/source/uibase/docvw/SidebarScrollBar.cxx | 5 +++++ + sw/source/uibase/docvw/SidebarScrollBar.hxx | 1 + + 2 files changed, 6 insertions(+) + +diff --git a/sw/source/uibase/docvw/SidebarScrollBar.cxx b/sw/source/uibase/docvw/SidebarScrollBar.cxx +index 7a80363693d1..b4d70b423eec 100644 +--- a/sw/source/uibase/docvw/SidebarScrollBar.cxx ++++ b/sw/source/uibase/docvw/SidebarScrollBar.cxx +@@ -60,6 +60,11 @@ void SidebarScrollBar::LogicInvalidate(const Rectangle* pRectangle) + rWrtShell.libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); + } + ++void SidebarScrollBar::MouseButtonUp(const MouseEvent& /*rMouseEvent*/) ++{ ++ EndTracking(); ++} ++ + void SidebarScrollBar::MouseMove(const MouseEvent& rMouseEvent) + { + TrackingEvent aEvent(rMouseEvent); +diff --git a/sw/source/uibase/docvw/SidebarScrollBar.hxx b/sw/source/uibase/docvw/SidebarScrollBar.hxx +index ea5639e42e92..0de225b2a135 100644 +--- a/sw/source/uibase/docvw/SidebarScrollBar.hxx ++++ b/sw/source/uibase/docvw/SidebarScrollBar.hxx +@@ -31,6 +31,7 @@ protected: + /// @see OutputDevice::LogicInvalidate(). + void LogicInvalidate(const Rectangle* pRectangle) override; + void MouseMove(const MouseEvent& rMouseEvent) override; ++ void MouseButtonUp(const MouseEvent& rMouseEvent) override; + public: + SidebarScrollBar(SwSidebarWin& rSidebarWin, WinBits nStyle, SwView& rView); + virtual ~SidebarScrollBar(); +-- +2.12.0 + diff --git a/SOURCES/0362-sw-lok-comments-fix-map-mode-state-after-changing-zo.patch b/SOURCES/0362-sw-lok-comments-fix-map-mode-state-after-changing-zo.patch new file mode 100644 index 0000000..1581b3a --- /dev/null +++ b/SOURCES/0362-sw-lok-comments-fix-map-mode-state-after-changing-zo.patch @@ -0,0 +1,35 @@ +From 2ab4afba1e464e0a581fd9200ed0c31567982010 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 24 Nov 2015 15:37:29 +0100 +Subject: [PATCH 362/398] sw lok comments: fix map mode state after changing + zoom levels + +Zoom level of SwEditWin is kept in sync with the client, so that the +pixel-based comment widgets can be positioned correctly. But that does +not mean in general the SwEditWin map mode should not be disabled: so +that we don't have to tweak the map mode for each and every +postMouseEvent() call and still be able to send them using logic +coordinates. + +Change-Id: I6f686b93d2509d52fdd34e84a502cf04e1ce6e59 +(cherry picked from commit de2a6897876976d769504a36abf54eced626b01c) +--- + sw/source/core/view/viewsh.cxx | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx +index 093d5208fdda..e74a4a2514c8 100644 +--- a/sw/source/core/view/viewsh.cxx ++++ b/sw/source/core/view/viewsh.cxx +@@ -1886,6 +1886,8 @@ void SwViewShell::PaintTile(VirtualDevice &rDevice, int contextWidth, int contex + SwViewOption aOption(*GetViewOptions()); + aOption.SetZoom(fScale * 100); + ApplyViewOptions(aOption); ++ // Make sure the map mode (disabled in SwXTextDocument::initializeForTiledRendering()) is still disabled. ++ GetWin()->EnableMapMode(false); + } + + Rectangle aOutRect = Rectangle(Point(tilePosX, tilePosY), +-- +2.12.0 + diff --git a/SOURCES/0363-tdf-96243-don-t-crash-if-LibO-install.-wasn-t-found.patch b/SOURCES/0363-tdf-96243-don-t-crash-if-LibO-install.-wasn-t-found.patch new file mode 100644 index 0000000..d1bd737 --- /dev/null +++ b/SOURCES/0363-tdf-96243-don-t-crash-if-LibO-install.-wasn-t-found.patch @@ -0,0 +1,28 @@ +From 3f6d5ad9422e8f000527fa6d7650f9fe147242a4 Mon Sep 17 00:00:00 2001 +From: David Tardon +Date: Mon, 7 Dec 2015 13:09:07 +0100 +Subject: [PATCH 363/398] tdf#96243 don't crash if LibO install. wasn't found + +Change-Id: I538e7238feb711a7d71faf745033264894f688f4 +(cherry picked from commit 7f73ea2e3975b305e09467eb7980a3d01cd37de9) +(cherry picked from commit 125382803df6502e467cb25b6ee70c24d5f4dfc0) +--- + include/LibreOfficeKit/LibreOfficeKitInit.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitInit.h b/include/LibreOfficeKit/LibreOfficeKitInit.h +index f18e3ca3c8e4..cb3654808cf9 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitInit.h ++++ b/include/LibreOfficeKit/LibreOfficeKitInit.h +@@ -219,6 +219,8 @@ static LibreOfficeKit *lok_init_2( const char *install_path, const char *user_p + LokHookFunction2 *pSym2; + + dlhandle = lok_dlopen(install_path, &imp_lib); ++ if (!dlhandle) ++ return NULL; + + pSym2 = (LokHookFunction2 *) lok_dlsym(dlhandle, "libreofficekit_hook_2"); + if (!pSym2) +-- +2.12.0 + diff --git a/SOURCES/0364-improve-error-message-for-nonexist.-path.patch b/SOURCES/0364-improve-error-message-for-nonexist.-path.patch new file mode 100644 index 0000000..fcb7b9d --- /dev/null +++ b/SOURCES/0364-improve-error-message-for-nonexist.-path.patch @@ -0,0 +1,36 @@ +From 3c7839a75bdf8d033152d16fa9abad2c8bf7ae5c Mon Sep 17 00:00:00 2001 +From: David Tardon +Date: Mon, 7 Dec 2015 13:10:50 +0100 +Subject: [PATCH 364/398] improve error message for nonexist. path + +... which is currently somewhat misleading, because it mentions +libmerged.so. + +Change-Id: I1ab21ce0fe2f94eba1831c2c977d900827f320f1 +(cherry picked from commit 764ec21307009a84b2611fed5cb20069caa6d566) +(cherry picked from commit 01825a8c1722161876fa8209e15e413c44774a5c) +--- + include/LibreOfficeKit/LibreOfficeKitInit.h | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitInit.h b/include/LibreOfficeKit/LibreOfficeKitInit.h +index cb3654808cf9..2d0b00299800 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitInit.h ++++ b/include/LibreOfficeKit/LibreOfficeKitInit.h +@@ -154,6 +154,13 @@ static void *lok_dlopen( const char *install_path, char ** _imp_lib ) + if (!install_path) + return NULL; + ++ struct stat dir_st; ++ if (stat(install_path, &dir_st) != 0) ++ { ++ fprintf(stderr, "installation path \"%s\" does not exist\n", install_path); ++ return NULL; ++ } ++ + // allocate large enough buffer + partial_length = strlen(install_path); + imp_lib = (char *) malloc(partial_length + sizeof(TARGET_LIB) + sizeof(TARGET_MERGED_LIB) + 2); +-- +2.12.0 + diff --git a/SOURCES/0365-tdf-96246-Make-pRenderingArguments-nullable.patch b/SOURCES/0365-tdf-96246-Make-pRenderingArguments-nullable.patch new file mode 100644 index 0000000..44f5576 --- /dev/null +++ b/SOURCES/0365-tdf-96246-Make-pRenderingArguments-nullable.patch @@ -0,0 +1,36 @@ +From c61bb4b9c05be5b546d3823052a6ac2f593ce15b Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Sun, 6 Dec 2015 23:41:57 +0530 +Subject: [PATCH 365/398] tdf#96246: Make pRenderingArguments nullable + +Type gchar* is not nullable by convention. + +See: +https://wiki.gnome.org/Projects/GObjectIntrospection/Annotations#Nullable_parameters + +Change-Id: Ibfee816a3ef2d29c7376071fb61eda7bf0538efb +Reviewed-on: https://gerrit.libreoffice.org/20425 +Tested-by: Jenkins +Reviewed-by: Miklos Vajna +(cherry picked from commit 9e9703389e015d0f3520344715df6719559362e4) +(cherry picked from commit f37903004d93e7d7b008b2667881159bd8fee1e1) +--- + include/LibreOfficeKit/LibreOfficeKitGtk.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h +index c947ce3f8369..8b6092c56ef2 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h ++++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h +@@ -65,7 +65,7 @@ GtkWidget* lok_doc_view_new_from_widget (LOKDocView* + * lok_doc_view_open_document: + * @pDocView: The #LOKDocView instance + * @pPath: (transfer full): The path of the document that #LOKDocView widget should try to open +- * @pRenderingArguments: lok::Document::initializeForRendering() arguments. ++ * @pRenderingArguments: (nullable): lok::Document::initializeForRendering() arguments. + * @cancellable: + * @callback: + * @userdata: +-- +2.12.0 + diff --git a/SOURCES/0366-tdf-96250-desktop-empty-str-is-the-same-as-0-str-in-.patch b/SOURCES/0366-tdf-96250-desktop-empty-str-is-the-same-as-0-str-in-.patch new file mode 100644 index 0000000..b38fa39 --- /dev/null +++ b/SOURCES/0366-tdf-96250-desktop-empty-str-is-the-same-as-0-str-in-.patch @@ -0,0 +1,29 @@ +From cfae897d306b6b140052c4c3f06dd614f9a22943 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Mon, 7 Dec 2015 14:54:19 +0100 +Subject: [PATCH 366/398] tdf#96250 desktop: empty str is the same as 0 str in + jsonToPropertyValues() + +Change-Id: I77306dc998afc53bb1d5710a8d1ae68717f945d1 +(cherry picked from commit 5cc574fefc8a2ee39db4a4bd843a3ec67dce2f11) +(cherry picked from commit e22f9ae034addbddbb5581cdee6bfd1c39aeedea) +--- + desktop/source/lib/init.cxx | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 57bb177f49db..6bed25514137 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -263,7 +263,7 @@ static OUString getAbsoluteURL(const char* pURL) + static void jsonToPropertyValues(const char* pJSON, uno::Sequence& rPropertyValues) + { + std::vector aArguments; +- if (pJSON) ++ if (pJSON && pJSON[0] != '\0') + { + boost::property_tree::ptree aTree; + std::stringstream aStream(pJSON); +-- +2.12.0 + diff --git a/SOURCES/0367-tdf-96316-Decouple-view-only-editable-modes.patch b/SOURCES/0367-tdf-96316-Decouple-view-only-editable-modes.patch new file mode 100644 index 0000000..1c0a3cd --- /dev/null +++ b/SOURCES/0367-tdf-96316-Decouple-view-only-editable-modes.patch @@ -0,0 +1,407 @@ +From 74730e13d8ebee67a1c235ef203a9b56a8097593 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Wed, 9 Dec 2015 01:03:02 +0530 +Subject: [PATCH 367/398] tdf#96316: Decouple view-only/editable modes + +- Move text selection and graphic selection tasks into functions +- Merge GDK_BUTTON_PRESS, GDK_BUTTON_RELEASE conditional code +- Do not change to 'move' cursor in view-only mode +- Ignore LOK_POST_COMMAND, LOK_SET_GRAPHIC_SELECTION in view-only + +As a consequence this commit also allows dragging handles during text +selection in view-only mode which was earlier not possible. + +Change-Id: Iffb668d5447dd646a1e40237dee8d8d3fa3314b6 +Reviewed-on: https://gerrit.libreoffice.org/20487 +Reviewed-by: David Tardon +Tested-by: David Tardon +(cherry picked from commit b3bfc26d0863b074bb990725718f2ab23d05425d) +(cherry picked from commit 0a28049853ce84aa8ef4f871065970c1220ae855) +--- + libreofficekit/source/gtk/lokdocview.cxx | 312 ++++++++++++++++++------------- + 1 file changed, 180 insertions(+), 132 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 464348d95f1c..5e985d4a8c2f 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -312,6 +312,153 @@ isEmptyRectangle(const GdkRectangle& rRectangle) + return rRectangle.x == 0 && rRectangle.y == 0 && rRectangle.width == 0 && rRectangle.height == 0; + } + ++/// if handled, returns TRUE else FALSE ++static bool ++handleTextSelectionOnButtonPress(GdkRectangle& aClick, LOKDocView* pDocView) { ++ LOKDocViewPrivate& priv = getPrivate(pDocView); ++ ++ if (gdk_rectangle_intersect(&aClick, &priv->m_aHandleStartRect, nullptr)) ++ { ++ g_info("LOKDocView_Impl::signalButton: start of drag start handle"); ++ priv->m_bInDragStartHandle = true; ++ return TRUE; ++ } ++ else if (gdk_rectangle_intersect(&aClick, &priv->m_aHandleMiddleRect, nullptr)) ++ { ++ g_info("LOKDocView_Impl::signalButton: start of drag middle handle"); ++ priv->m_bInDragMiddleHandle = true; ++ return TRUE; ++ } ++ else if (gdk_rectangle_intersect(&aClick, &priv->m_aHandleEndRect, nullptr)) ++ { ++ g_info("LOKDocView_Impl::signalButton: start of drag end handle"); ++ priv->m_bInDragEndHandle = true; ++ return TRUE; ++ } ++ ++ return FALSE; ++} ++ ++/// if handled, returns TRUE else FALSE ++static bool ++handleGraphicSelectionOnButtonPress(GdkRectangle& aClick, LOKDocView* pDocView) { ++ LOKDocViewPrivate& priv = getPrivate(pDocView); ++ GError* error = nullptr; ++ ++ for (int i = 0; i < GRAPHIC_HANDLE_COUNT; ++i) ++ { ++ if (gdk_rectangle_intersect(&aClick, &priv->m_aGraphicHandleRects[i], nullptr)) ++ { ++ g_info("LOKDocView_Impl::signalButton: start of drag graphic handle #%d", i); ++ priv->m_bInDragGraphicHandles[i] = true; ++ ++ GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr); ++ LOEvent* pLOEvent = new LOEvent(LOK_SET_GRAPHIC_SELECTION); ++ pLOEvent->m_nSetGraphicSelectionType = LOK_SETGRAPHICSELECTION_START; ++ pLOEvent->m_nSetGraphicSelectionX = pixelToTwip(priv->m_aGraphicHandleRects[i].x + priv->m_aGraphicHandleRects[i].width / 2, priv->m_fZoom); ++ pLOEvent->m_nSetGraphicSelectionY = pixelToTwip(priv->m_aGraphicHandleRects[i].y + priv->m_aGraphicHandleRects[i].height / 2, priv->m_fZoom); ++ g_task_set_task_data(task, pLOEvent, LOEvent::destroy); ++ ++ g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); ++ if (error != nullptr) ++ { ++ g_warning("Unable to call LOK_SET_GRAPHIC_SELECTION: %s", error->message); ++ g_clear_error(&error); ++ } ++ g_object_unref(task); ++ ++ return TRUE; ++ } ++ } ++ ++ return FALSE; ++} ++ ++/// if handled, returns TRUE else FALSE ++static bool ++handleTextSelectionOnButtonRelease(LOKDocView* pDocView) { ++ LOKDocViewPrivate& priv = getPrivate(pDocView); ++ ++ if (priv->m_bInDragStartHandle) ++ { ++ g_info("LOKDocView_Impl::signalButton: end of drag start handle"); ++ priv->m_bInDragStartHandle = false; ++ return TRUE; ++ } ++ else if (priv->m_bInDragMiddleHandle) ++ { ++ g_info("LOKDocView_Impl::signalButton: end of drag middle handle"); ++ priv->m_bInDragMiddleHandle = false; ++ return TRUE; ++ } ++ else if (priv->m_bInDragEndHandle) ++ { ++ g_info("LOKDocView_Impl::signalButton: end of drag end handle"); ++ priv->m_bInDragEndHandle = false; ++ return TRUE; ++ } ++ ++ return FALSE; ++} ++ ++/// if handled, returns TRUE else FALSE ++static bool ++handleGraphicSelectionOnButtonRelease(LOKDocView* pDocView, GdkEventButton* pEvent) { ++ LOKDocViewPrivate& priv = getPrivate(pDocView); ++ GError* error = nullptr; ++ ++ for (int i = 0; i < GRAPHIC_HANDLE_COUNT; ++i) ++ { ++ if (priv->m_bInDragGraphicHandles[i]) ++ { ++ g_info("LOKDocView_Impl::signalButton: end of drag graphic handle #%d", i); ++ priv->m_bInDragGraphicHandles[i] = false; ++ ++ GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr); ++ LOEvent* pLOEvent = new LOEvent(LOK_SET_GRAPHIC_SELECTION); ++ pLOEvent->m_nSetGraphicSelectionType = LOK_SETGRAPHICSELECTION_END; ++ pLOEvent->m_nSetGraphicSelectionX = pixelToTwip(pEvent->x, priv->m_fZoom); ++ pLOEvent->m_nSetGraphicSelectionY = pixelToTwip(pEvent->y, priv->m_fZoom); ++ g_task_set_task_data(task, pLOEvent, LOEvent::destroy); ++ ++ g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); ++ if (error != nullptr) ++ { ++ g_warning("Unable to call LOK_SET_GRAPHIC_SELECTION: %s", error->message); ++ g_clear_error(&error); ++ } ++ g_object_unref(task); ++ ++ return TRUE; ++ } ++ } ++ ++ if (priv->m_bInDragGraphicSelection) ++ { ++ g_info("LOKDocView_Impl::signalButton: end of drag graphic selection"); ++ priv->m_bInDragGraphicSelection = false; ++ ++ GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr); ++ LOEvent* pLOEvent = new LOEvent(LOK_SET_GRAPHIC_SELECTION); ++ pLOEvent->m_nSetGraphicSelectionType = LOK_SETGRAPHICSELECTION_END; ++ pLOEvent->m_nSetGraphicSelectionX = pixelToTwip(pEvent->x, priv->m_fZoom); ++ pLOEvent->m_nSetGraphicSelectionY = pixelToTwip(pEvent->y, priv->m_fZoom); ++ g_task_set_task_data(task, pLOEvent, LOEvent::destroy); ++ ++ g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); ++ if (error != nullptr) ++ { ++ g_warning("Unable to call LOK_SET_GRAPHIC_SELECTION: %s", error->message); ++ g_clear_error(&error); ++ } ++ g_object_unref(task); ++ ++ return TRUE; ++ } ++ ++ return FALSE; ++} ++ + static void + postKeyEventInThread(gpointer data) + { +@@ -747,11 +894,17 @@ callback (gpointer pData) + break; + case LOK_CALLBACK_MOUSE_POINTER: + { +- // The gtk docs claim that most css cursors should be supported, however +- // on my system at least this is not true and many cursors are unsupported. +- // In this case pCursor = null, which results in the default cursor being set. +- GdkCursor* pCursor = gdk_cursor_new_from_name(gtk_widget_get_display(GTK_WIDGET(pDocView)), pCallback->m_aPayload.c_str()); +- gdk_window_set_cursor(gtk_widget_get_window(GTK_WIDGET(pDocView)), pCursor); ++ // We do not want the cursor to get changed in view-only mode ++ if (priv->m_bEdit) ++ { ++ // The gtk docs claim that most css cursors should be supported, however ++ // on my system at least this is not true and many cursors are unsupported. ++ // In this case pCursor = null, which results in the default cursor ++ // being set. ++ GdkCursor* pCursor = gdk_cursor_new_from_name(gtk_widget_get_display(GTK_WIDGET(pDocView)), ++ pCallback->m_aPayload.c_str()); ++ gdk_window_set_cursor(gtk_widget_get_window(GTK_WIDGET(pDocView)), pCursor); ++ } + } + break; + case LOK_CALLBACK_GRAPHIC_SELECTION: +@@ -1176,140 +1329,21 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + (int)pixelToTwip(pEvent->y, priv->m_fZoom)); + gtk_widget_grab_focus(GTK_WIDGET(pDocView)); + +- if (pEvent->type == GDK_BUTTON_RELEASE) ++ switch (pEvent->type) + { +- if (priv->m_bInDragStartHandle) +- { +- g_info("LOKDocView_Impl::signalButton: end of drag start handle"); +- priv->m_bInDragStartHandle = false; +- return FALSE; +- } +- else if (priv->m_bInDragMiddleHandle) +- { +- g_info("LOKDocView_Impl::signalButton: end of drag middle handle"); +- priv->m_bInDragMiddleHandle = false; +- return FALSE; +- } +- else if (priv->m_bInDragEndHandle) +- { +- g_info("LOKDocView_Impl::signalButton: end of drag end handle"); +- priv->m_bInDragEndHandle = false; +- return FALSE; +- } +- +- for (int i = 0; i < GRAPHIC_HANDLE_COUNT; ++i) +- { +- if (priv->m_bInDragGraphicHandles[i]) +- { +- g_info("LOKDocView_Impl::signalButton: end of drag graphic handle #%d", i); +- priv->m_bInDragGraphicHandles[i] = false; +- +- GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr); +- LOEvent* pLOEvent = new LOEvent(LOK_SET_GRAPHIC_SELECTION); +- pLOEvent->m_nSetGraphicSelectionType = LOK_SETGRAPHICSELECTION_END; +- pLOEvent->m_nSetGraphicSelectionX = pixelToTwip(pEvent->x, priv->m_fZoom); +- pLOEvent->m_nSetGraphicSelectionY = pixelToTwip(pEvent->y, priv->m_fZoom); +- g_task_set_task_data(task, pLOEvent, LOEvent::destroy); +- +- g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); +- if (error != nullptr) +- { +- g_warning("Unable to call LOK_SET_GRAPHIC_SELECTION: %s", error->message); +- g_clear_error(&error); +- } +- g_object_unref(task); +- +- return FALSE; +- } +- } +- +- if (priv->m_bInDragGraphicSelection) +- { +- g_info("LOKDocView_Impl::signalButton: end of drag graphic selection"); +- priv->m_bInDragGraphicSelection = false; +- +- GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr); +- LOEvent* pLOEvent = new LOEvent(LOK_SET_GRAPHIC_SELECTION); +- pLOEvent->m_nSetGraphicSelectionType = LOK_SETGRAPHICSELECTION_END; +- pLOEvent->m_nSetGraphicSelectionX = pixelToTwip(pEvent->x, priv->m_fZoom); +- pLOEvent->m_nSetGraphicSelectionY = pixelToTwip(pEvent->y, priv->m_fZoom); +- g_task_set_task_data(task, pLOEvent, LOEvent::destroy); +- +- g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); +- if (error != nullptr) +- { +- g_warning("Unable to call LOK_SET_GRAPHIC_SELECTION: %s", error->message); +- g_clear_error(&error); +- } +- g_object_unref(task); +- +- return FALSE; +- } +- } +- +- if (priv->m_bEdit) ++ case GDK_BUTTON_PRESS: + { + GdkRectangle aClick; + aClick.x = pEvent->x; + aClick.y = pEvent->y; + aClick.width = 1; + aClick.height = 1; +- if (pEvent->type == GDK_BUTTON_PRESS) +- { +- if (gdk_rectangle_intersect(&aClick, &priv->m_aHandleStartRect, nullptr)) +- { +- g_info("LOKDocView_Impl::signalButton: start of drag start handle"); +- priv->m_bInDragStartHandle = true; +- return FALSE; +- } +- else if (gdk_rectangle_intersect(&aClick, &priv->m_aHandleMiddleRect, nullptr)) +- { +- g_info("LOKDocView_Impl::signalButton: start of drag middle handle"); +- priv->m_bInDragMiddleHandle = true; +- return FALSE; +- } +- else if (gdk_rectangle_intersect(&aClick, &priv->m_aHandleEndRect, nullptr)) +- { +- g_info("LOKDocView_Impl::signalButton: start of drag end handle"); +- priv->m_bInDragEndHandle = true; +- return FALSE; +- } + +- for (int i = 0; i < GRAPHIC_HANDLE_COUNT; ++i) +- { +- if (gdk_rectangle_intersect(&aClick, &priv->m_aGraphicHandleRects[i], nullptr)) +- { +- g_info("LOKDocView_Impl::signalButton: start of drag graphic handle #%d", i); +- priv->m_bInDragGraphicHandles[i] = true; +- +- GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr); +- LOEvent* pLOEvent = new LOEvent(LOK_SET_GRAPHIC_SELECTION); +- pLOEvent->m_nSetGraphicSelectionType = LOK_SETGRAPHICSELECTION_START; +- pLOEvent->m_nSetGraphicSelectionX = pixelToTwip(priv->m_aGraphicHandleRects[i].x + priv->m_aGraphicHandleRects[i].width / 2, priv->m_fZoom); +- pLOEvent->m_nSetGraphicSelectionY = pixelToTwip(priv->m_aGraphicHandleRects[i].y + priv->m_aGraphicHandleRects[i].height / 2, priv->m_fZoom); +- g_task_set_task_data(task, pLOEvent, LOEvent::destroy); +- +- g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); +- if (error != nullptr) +- { +- g_warning("Unable to call LOK_SET_GRAPHIC_SELECTION: %s", error->message); +- g_clear_error(&error); +- } +- g_object_unref(task); +- +- return FALSE; +- } +- } +- } +- } +- +- if (!priv->m_bEdit) +- lok_doc_view_set_edit(pDocView, TRUE); ++ if (handleTextSelectionOnButtonPress(aClick, pDocView)) ++ return FALSE; ++ if (handleGraphicSelectionOnButtonPress(aClick, pDocView)) ++ return FALSE; + +- switch (pEvent->type) +- { +- case GDK_BUTTON_PRESS: +- { + int nCount = 1; + if ((pEvent->time - priv->m_nLastButtonPressTime) < 250) + nCount++; +@@ -1347,6 +1381,11 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) + } + case GDK_BUTTON_RELEASE: + { ++ if (handleTextSelectionOnButtonRelease(pDocView)) ++ return FALSE; ++ if (handleGraphicSelectionOnButtonRelease(pDocView, pEvent)) ++ return FALSE; ++ + int nCount = 1; + if ((pEvent->time - priv->m_nLastButtonReleaseTime) < 250) + nCount++; +@@ -1720,6 +1759,8 @@ lokThreadFunc(gpointer data, gpointer /*user_data*/) + { + GTask* task = G_TASK(data); + LOEvent* pLOEvent = static_cast(g_task_get_task_data(task)); ++ LOKDocView* pDocView = LOK_DOC_VIEW(g_task_get_source_object(task)); ++ LOKDocViewPrivate& priv = getPrivate(pDocView); + + switch (pLOEvent->m_nType) + { +@@ -1727,7 +1768,10 @@ lokThreadFunc(gpointer data, gpointer /*user_data*/) + openDocumentInThread(task); + break; + case LOK_POST_COMMAND: +- postCommandInThread(task); ++ if (priv->m_bEdit) ++ postCommandInThread(task); ++ else ++ g_info ("LOK_POST_COMMAND: ignoring commands in view-only mode"); + break; + case LOK_SET_EDIT: + setEditInThread(task); +@@ -1739,6 +1783,7 @@ lokThreadFunc(gpointer data, gpointer /*user_data*/) + setPartmodeInThread(task); + break; + case LOK_POST_KEY: ++ // view-only/editable mode already checked during signal key signal emission + postKeyEventInThread(task); + break; + case LOK_PAINT_TILE: +@@ -1748,7 +1793,10 @@ lokThreadFunc(gpointer data, gpointer /*user_data*/) + postMouseEventInThread(task); + break; + case LOK_SET_GRAPHIC_SELECTION: +- setGraphicSelectionInThread(task); ++ if (priv->m_bEdit) ++ setGraphicSelectionInThread(task); ++ else ++ g_info ("LOK_SET_GRAPHIC_SELECTION: skipping graphical operation in view-only mode"); + break; + case LOK_SET_CLIENT_ZOOM: + setClientZoomInThread(task); +-- +2.12.0 + diff --git a/SOURCES/0368-tdf-96318-Add-searching-API.patch b/SOURCES/0368-tdf-96318-Add-searching-API.patch new file mode 100644 index 0000000..b06dde2 --- /dev/null +++ b/SOURCES/0368-tdf-96318-Add-searching-API.patch @@ -0,0 +1,296 @@ +From cc1e87b14fae9c6fb84ee5c9307ed27945fab289 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Wed, 9 Dec 2015 10:33:05 +0530 +Subject: [PATCH 368/398] tdf#96318: Add searching API + +Clients should now use these APIs to search for text in the +widget, rather than executing UNO commands directly on the +widget. This allows searching for text in the widget in view-only +mode too. + +Change-Id: I013b6f96e69a634ec33367394d39c0f645a4994d +Reviewed-on: https://gerrit.libreoffice.org/20488 +Tested-by: Jenkins +Reviewed-by: David Tardon +(cherry picked from commit 0f64cf72ff3b930e306e937bb18f4cbe55a8026a) +(cherry picked from commit e7cdd6803485bbe4cfe27f5f466b427823318334) +--- + include/LibreOfficeKit/LibreOfficeKitGtk.h | 38 ++++++++ + .../qa/gtktiledviewer/gtktiledviewer.cxx | 46 +++------ + libreofficekit/source/gtk/lokdocview.cxx | 107 +++++++++++++++++---- + 3 files changed, 139 insertions(+), 52 deletions(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h +index 8b6092c56ef2..b2f17f14b6cb 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h ++++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h +@@ -195,6 +195,44 @@ void lok_doc_view_post_command (LOKDocView* + const gchar* pArguments, + gboolean bNotifyWhenFinished); + ++ ++/** ++ * lok_doc_view_find_next: ++ * @pDocView: The #LOKDocView instance ++ * @pText: text to search for ++ * @bHighlightAll: Whether all the matches should be highlighted or not ++ * ++ * Highlights the next matching text in the view. `search-not-found` signal will ++ * be emitted when no search is found ++ */ ++void lok_doc_view_find_next (LOKDocView* pDocView, ++ const gchar* pText, ++ gboolean bHighlightAll); ++ ++/** ++ * lok_doc_view_find_prev: ++ * @pDocView: The #LOKDocView instance ++ * @pText: text to search for ++ * @bHighlightAll: Whether all the matches should be highlighted or not ++ * ++ * Highlights the previous matching text in the view. `search-not-found` signal ++ * will be emitted when no search is found ++ */ ++void lok_doc_view_find_prev (LOKDocView* pDocView, ++ const gchar* pText, ++ gboolean bHighlightAll); ++ ++/** ++ * lok_doc_view_highlight_all: ++ * @pDocView: The #LOKDocView instance ++ * @pText: text to search for ++ * ++ * Highlights all matching texts in the view. `search-not-found` signal ++ * will be emitted when no search is found ++ */ ++void lok_doc_view_highlight_all (LOKDocView* pDocView, ++ const gchar* pText); ++ + /** + * lok_doc_view_pixel_to_twip: + * @pDocView: The #LOKDocView instance +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index e44a92a3f3de..2416e1c6dbcf 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -439,7 +439,11 @@ static void toggleEditing(GtkWidget* pButton, gpointer /*pItem*/) + static void toggleFindAll(GtkWidget* pButton, gpointer /*pItem*/) + { + TiledWindow& rWindow = lcl_getTiledWindow(pButton); ++ GtkEntry* pEntry = GTK_ENTRY(rWindow.m_pFindbarEntry); ++ const char* pText = gtk_entry_get_text(pEntry); ++ + rWindow.m_bFindAll = !rWindow.m_bFindAll; ++ lok_doc_view_highlight_all(LOK_DOC_VIEW(rWindow.m_pDocView), pText); + } + + /// Toggle the visibility of the findbar. +@@ -597,48 +601,24 @@ static void doPaste(GtkWidget* pButton, gpointer /*pItem*/) + pDocument->pClass->paste(pDocument, "text/plain;charset=utf-8", pText, strlen(pText)); + } + +-/// Searches for the next or previous text of TiledWindow::m_pFindbarEntry. +-static void doSearch(GtkWidget* pButton, bool bBackwards) ++/// Click handler for the search next button. ++static void signalSearchNext(GtkWidget* pButton, gpointer /*pItem*/) + { + TiledWindow& rWindow = lcl_getTiledWindow(pButton); + GtkEntry* pEntry = GTK_ENTRY(rWindow.m_pFindbarEntry); + const char* pText = gtk_entry_get_text(pEntry); +- boost::property_tree::ptree aTree; +- aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchString/type", '/'), "string"); +- aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchString/value", '/'), pText); +- aTree.put(boost::property_tree::ptree::path_type("SearchItem.Backward/type", '/'), "boolean"); +- aTree.put(boost::property_tree::ptree::path_type("SearchItem.Backward/value", '/'), bBackwards); +- if (rWindow.m_bFindAll) +- { +- aTree.put(boost::property_tree::ptree::path_type("SearchItem.Command/type", '/'), "unsigned short"); +- // SvxSearchCmd::FIND_ALL +- aTree.put(boost::property_tree::ptree::path_type("SearchItem.Command/value", '/'), "1"); +- } +- +- LOKDocView* pLOKDocView = LOK_DOC_VIEW(rWindow.m_pDocView); +- GdkRectangle aArea; +- getVisibleAreaTwips(rWindow.m_pDocView, &aArea); +- aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchStartPointX/type", '/'), "long"); +- aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchStartPointX/value", '/'), aArea.x); +- aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchStartPointY/type", '/'), "long"); +- aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchStartPointY/value", '/'), aArea.y); +- +- std::stringstream aStream; +- boost::property_tree::write_json(aStream, aTree); + +- lok_doc_view_post_command(pLOKDocView, ".uno:ExecuteSearch", aStream.str().c_str(), false); +-} +- +-/// Click handler for the search next button. +-static void signalSearchNext(GtkWidget* pButton, gpointer /*pItem*/) +-{ +- doSearch(pButton, /*bBackwards=*/false); ++ lok_doc_view_find_next(LOK_DOC_VIEW(rWindow.m_pDocView), pText, rWindow.m_bFindAll); + } + + /// Click handler for the search previous button. + static void signalSearchPrev(GtkWidget* pButton, gpointer /*pItem*/) + { +- doSearch(pButton, /*bBackwards=*/true); ++ TiledWindow& rWindow = lcl_getTiledWindow(pButton); ++ GtkEntry* pEntry = GTK_ENTRY(rWindow.m_pFindbarEntry); ++ const char* pText = gtk_entry_get_text(pEntry); ++ ++ lok_doc_view_find_prev(LOK_DOC_VIEW(rWindow.m_pDocView), pText, rWindow.m_bFindAll); + } + + /// Handles the key-press-event of the search entry widget. +@@ -651,7 +631,7 @@ static gboolean signalFindbar(GtkWidget* pWidget, GdkEventKey* pEvent, gpointer + case GDK_KEY_Return: + { + // Search forward. +- doSearch(pWidget, /*bBackwards=*/false); ++ signalSearchNext(pWidget, nullptr); + return TRUE; + } + case GDK_KEY_Escape: +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 5e985d4a8c2f..424d80eabcf9 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -306,6 +306,67 @@ callbackTypeToString (int nType) + return nullptr; + } + ++static void ++LOKPostCommand (LOKDocView* pDocView, ++ const gchar* pCommand, ++ const gchar* pArguments, ++ gboolean bNotifyWhenFinished) ++{ ++ LOKDocViewPrivate& priv = getPrivate(pDocView); ++ GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr); ++ LOEvent* pLOEvent = new LOEvent(LOK_POST_COMMAND); ++ GError* error = nullptr; ++ pLOEvent->m_pCommand = pCommand; ++ pLOEvent->m_pArguments = g_strdup(pArguments); ++ pLOEvent->m_bNotifyWhenFinished = bNotifyWhenFinished; ++ ++ g_task_set_task_data(task, pLOEvent, LOEvent::destroy); ++ g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); ++ if (error != nullptr) ++ { ++ g_warning("Unable to call LOK_POST_COMMAND: %s", error->message); ++ g_clear_error(&error); ++ } ++ g_object_unref(task); ++} ++ ++static void ++doSearch(LOKDocView* pDocView, const char* pText, bool bBackwards, bool highlightAll) ++{ ++ LOKDocViewPrivate& priv = getPrivate(pDocView); ++ boost::property_tree::ptree aTree; ++ GtkWidget* drawingWidget = GTK_WIDGET(pDocView); ++ GdkWindow* drawingWindow = gtk_widget_get_window(drawingWidget); ++ cairo_region_t* cairoVisRegion = gdk_window_get_visible_region(drawingWindow); ++ cairo_rectangle_int_t cairoVisRect; ++ int x, y; ++ ++ cairo_region_get_rectangle(cairoVisRegion, 0, &cairoVisRect); ++ x = pixelToTwip (cairoVisRect.x, priv->m_fZoom); ++ y = pixelToTwip (cairoVisRect.y, priv->m_fZoom); ++ ++ aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchString/type", '/'), "string"); ++ aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchString/value", '/'), pText); ++ aTree.put(boost::property_tree::ptree::path_type("SearchItem.Backward/type", '/'), "boolean"); ++ aTree.put(boost::property_tree::ptree::path_type("SearchItem.Backward/value", '/'), bBackwards); ++ if (highlightAll) ++ { ++ aTree.put(boost::property_tree::ptree::path_type("SearchItem.Command/type", '/'), "unsigned short"); ++ // SvxSearchCmd::FIND_ALL ++ aTree.put(boost::property_tree::ptree::path_type("SearchItem.Command/value", '/'), "1"); ++ } ++ ++ aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchStartPointX/type", '/'), "long"); ++ aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchStartPointX/value", '/'), x); ++ aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchStartPointY/type", '/'), "long"); ++ aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchStartPointY/value", '/'), y); ++ ++ std::stringstream aStream; ++ boost::property_tree::write_json(aStream, aTree); ++ ++ LOKPostCommand (pDocView, ".uno:ExecuteSearch", aStream.str().c_str(), false); ++} ++ + static bool + isEmptyRectangle(const GdkRectangle& rRectangle) + { +@@ -1768,10 +1829,7 @@ lokThreadFunc(gpointer data, gpointer /*user_data*/) + openDocumentInThread(task); + break; + case LOK_POST_COMMAND: +- if (priv->m_bEdit) +- postCommandInThread(task); +- else +- g_info ("LOK_POST_COMMAND: ignoring commands in view-only mode"); ++ postCommandInThread(task); + break; + case LOK_SET_EDIT: + setEditInThread(task); +@@ -2573,7 +2631,6 @@ lok_doc_view_get_edit (LOKDocView* pDocView) + return priv->m_bEdit; + } + +- + SAL_DLLPUBLIC_EXPORT void + lok_doc_view_post_command (LOKDocView* pDocView, + const gchar* pCommand, +@@ -2581,21 +2638,33 @@ lok_doc_view_post_command (LOKDocView* pDocView, + gboolean bNotifyWhenFinished) + { + LOKDocViewPrivate& priv = getPrivate(pDocView); +- GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr); +- LOEvent* pLOEvent = new LOEvent(LOK_POST_COMMAND); +- GError* error = nullptr; +- pLOEvent->m_pCommand = pCommand; +- pLOEvent->m_pArguments = g_strdup(pArguments); +- pLOEvent->m_bNotifyWhenFinished = bNotifyWhenFinished; ++ if (priv->m_bEdit) ++ LOKPostCommand(pDocView, pCommand, pArguments, bNotifyWhenFinished); ++ else ++ g_info ("LOK_POST_COMMAND: ignoring commands in view-only mode"); ++} + +- g_task_set_task_data(task, pLOEvent, LOEvent::destroy); +- g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); +- if (error != nullptr) +- { +- g_warning("Unable to call LOK_POST_COMMAND: %s", error->message); +- g_clear_error(&error); +- } +- g_object_unref(task); ++SAL_DLLPUBLIC_EXPORT void ++lok_doc_view_find_prev (LOKDocView* pDocView, ++ const gchar* pText, ++ gboolean bHighlightAll) ++{ ++ doSearch(pDocView, pText, true, bHighlightAll); ++} ++ ++SAL_DLLPUBLIC_EXPORT void ++lok_doc_view_find_next (LOKDocView* pDocView, ++ const gchar* pText, ++ gboolean bHighlightAll) ++{ ++ doSearch(pDocView, pText, false, bHighlightAll); ++} ++ ++SAL_DLLPUBLIC_EXPORT void ++lok_doc_view_highlight_all (LOKDocView* pDocView, ++ const gchar* pText) ++{ ++ doSearch(pDocView, pText, false, true); + } + + SAL_DLLPUBLIC_EXPORT float +-- +2.12.0 + diff --git a/SOURCES/0369-lokdocview-Set-a-default-path-for-LOK-init.patch b/SOURCES/0369-lokdocview-Set-a-default-path-for-LOK-init.patch new file mode 100644 index 0000000..6347e73 --- /dev/null +++ b/SOURCES/0369-lokdocview-Set-a-default-path-for-LOK-init.patch @@ -0,0 +1,65 @@ +From 3943bc9014e426740ca5f756eae4cf4dd124bc23 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Tue, 8 Dec 2015 23:14:25 +0530 +Subject: [PATCH 369/398] lokdocview: Set a 'default' path for LOK init + +When passed NULL to lok_doc_view_new, use the default path : +$libdir/libreoffice/program as LOK install path + +Change-Id: I1e033c407184b29b1509cfb8c416b514591d67ce +Reviewed-on: https://gerrit.libreoffice.org/20476 +Tested-by: Jenkins +Reviewed-by: David Tardon +(cherry picked from commit 424c09b10d3d6ba6edfed2dcf560d5ce2c950b9d) +(cherry picked from commit dabfa0ce06f605fd0e8de32774b6385fd6ffbd56) +--- + include/LibreOfficeKit/LibreOfficeKitGtk.h | 3 ++- + libreofficekit/Library_libreofficekitgtk.mk | 4 ++++ + libreofficekit/source/gtk/lokdocview.cxx | 2 +- + 3 files changed, 7 insertions(+), 2 deletions(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h +index b2f17f14b6cb..1b03e4633547 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h ++++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h +@@ -42,7 +42,8 @@ GType lok_doc_view_get_type (void) G_GNUC + + /** + * lok_doc_view_new: +- * @pPath: LibreOffice install path. ++ * @pPath: (nullable): LibreOffice install path. Pass null to set it to default ++ * path which in most cases would be $libdir/libreoffice/program + * @cancellable: The cancellable object that you can use to cancel this + * operation. + * @error: The error that will be set if the object fails to initialize. +diff --git a/libreofficekit/Library_libreofficekitgtk.mk b/libreofficekit/Library_libreofficekitgtk.mk +index 3eba939ad56c..fc62e72ca723 100644 +--- a/libreofficekit/Library_libreofficekitgtk.mk ++++ b/libreofficekit/Library_libreofficekitgtk.mk +@@ -28,6 +28,10 @@ $(eval $(call gb_Library_add_libs,libreofficekitgtk,\ + $(GTK3_LIBS) \ + )) + ++$(eval $(call gb_Library_add_defs,libreofficekitgtk,\ ++ -DLOK_PATH="\"$(LIBDIR)/libreoffice/$(LIBO_LIB_FOLDER)\"" \ ++)) ++ + ifeq ($(OS),$(filter LINUX %BSD SOLARIS, $(OS))) + $(eval $(call gb_Library_add_libs,libreofficekitgtk,\ + $(DLOPEN_LIBS) -lm \ +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 424d80eabcf9..34823437e6ad 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -2385,7 +2385,7 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + SAL_DLLPUBLIC_EXPORT GtkWidget* + lok_doc_view_new (const gchar* pPath, GCancellable *cancellable, GError **error) + { +- return GTK_WIDGET (g_initable_new (LOK_TYPE_DOC_VIEW, cancellable, error, "lopath", pPath, NULL)); ++ return GTK_WIDGET (g_initable_new (LOK_TYPE_DOC_VIEW, cancellable, error, "lopath", pPath == NULL ? LOK_PATH : pPath, NULL)); + } + + SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new_from_widget(LOKDocView* pOldLOKDocView) +-- +2.12.0 + diff --git a/SOURCES/0370-tdf-96317-Add-API-for-copy-paste-from-to-the-widget.patch b/SOURCES/0370-tdf-96317-Add-API-for-copy-paste-from-to-the-widget.patch new file mode 100644 index 0000000..57ccd78 --- /dev/null +++ b/SOURCES/0370-tdf-96317-Add-API-for-copy-paste-from-to-the-widget.patch @@ -0,0 +1,152 @@ +From 3014df80526ebd05cd12707363db42e552f17686 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Wed, 9 Dec 2015 21:45:21 +0530 +Subject: [PATCH 370/398] tdf#96317: Add API for copy/paste from/to the widget + +Change-Id: Iac869ddb65cbdd2227f96d047d83159ca7819f11 +Reviewed-on: https://gerrit.libreoffice.org/20534 +Reviewed-by: David Tardon +Tested-by: David Tardon +(cherry picked from commit 7d7fad258dfde500c5ee99b5f1691172724383bd) +(cherry picked from commit 9c01ac05618875e812c9f6a18edf5cc6a7909b5e) +--- + include/LibreOfficeKit/LibreOfficeKitGtk.h | 29 +++++++++++++++++++ + .../qa/gtktiledviewer/gtktiledviewer.cxx | 8 ++---- + libreofficekit/source/gtk/lokdocview.cxx | 33 +++++++++++++++++++++- + 3 files changed, 64 insertions(+), 6 deletions(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h +index 1b03e4633547..903a74256ffa 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h ++++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h +@@ -235,6 +235,35 @@ void lok_doc_view_highlight_all (LOKDocView* + const gchar* pText); + + /** ++ * lok_doc_view_copy_selection: ++ * @pDocView: The #LOKDocView instance ++ * @pMimeType: suggests the return format, for example text/plain;charset=utf-8 ++ * @pUsedMimeType: (out): output parameter to inform about the determined format ++ * (suggested or plain text). ++ * ++ * Returns: Selected text. The caller must free the returned buffer after use. ++ */ ++gchar* lok_doc_view_copy_selection (LOKDocView* pDocView, ++ const gchar* pMimeType, ++ gchar** pUsedMimeType); ++ ++/** ++ * lok_doc_view_paste: ++ * @pDocView: The #LOKDocView instance ++ * @pMimeType: format of pData, for example text/plain;charset=utf-8 ++ * @pData: the data to be pasted ++ * @nSize: length of data to be pasted ++ * ++ * Pastes the content at the current cursor position ++ * ++ * Returns: if pData was pasted successfully. ++ */ ++gboolean lok_doc_view_paste (LOKDocView* pDocView, ++ const gchar* pMimeType, ++ const gchar* pData, ++ gsize nSize); ++ ++/** + * lok_doc_view_pixel_to_twip: + * @pDocView: The #LOKDocView instance + * @fInput: The value in pixels to convert to twips +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 2416e1c6dbcf..d064c4ce3e47 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -548,9 +548,8 @@ static void doCopy(GtkWidget* pButton, gpointer /*pItem*/) + { + TiledWindow& rWindow = lcl_getTiledWindow(pButton); + LOKDocView* pLOKDocView = LOK_DOC_VIEW(rWindow.m_pDocView); +- LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(pLOKDocView); + char* pUsedFormat = nullptr; +- char* pSelection = pDocument->pClass->getTextSelection(pDocument, "text/html", &pUsedFormat); ++ char* pSelection = lok_doc_view_copy_selection(pLOKDocView, "text/html", &pUsedFormat); + + GtkClipboard* pClipboard = gtk_clipboard_get_for_display(gtk_widget_get_display(rWindow.m_pDocView), GDK_SELECTION_CLIPBOARD); + std::string aUsedFormat(pUsedFormat); +@@ -566,7 +565,6 @@ static void doPaste(GtkWidget* pButton, gpointer /*pItem*/) + { + TiledWindow& rWindow = lcl_getTiledWindow(pButton); + LOKDocView* pLOKDocView = LOK_DOC_VIEW(rWindow.m_pDocView); +- LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(pLOKDocView); + + GtkClipboard* pClipboard = gtk_clipboard_get_for_display(gtk_widget_get_display(rWindow.m_pDocView), GDK_SELECTION_CLIPBOARD); + +@@ -590,7 +588,7 @@ static void doPaste(GtkWidget* pButton, gpointer /*pItem*/) + GtkSelectionData* pSelectionData = gtk_clipboard_wait_for_contents(pClipboard, *oTarget); + gint nLength; + const guchar* pData = gtk_selection_data_get_data_with_length(pSelectionData, &nLength); +- bool bSuccess = pDocument->pClass->paste(pDocument, "text/html", reinterpret_cast(pData), nLength); ++ bool bSuccess = lok_doc_view_paste(pLOKDocView, "text/html", reinterpret_cast(pData), nLength); + gtk_selection_data_free(pSelectionData); + if (bSuccess) + return; +@@ -598,7 +596,7 @@ static void doPaste(GtkWidget* pButton, gpointer /*pItem*/) + + gchar* pText = gtk_clipboard_wait_for_text(pClipboard); + if (pText) +- pDocument->pClass->paste(pDocument, "text/plain;charset=utf-8", pText, strlen(pText)); ++ lok_doc_view_paste(pLOKDocView, "text/plain;charset=utf-8", pText, strlen(pText)); + } + + /// Click handler for the search next button. +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 34823437e6ad..99ad819f6e5c 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -344,7 +344,7 @@ doSearch(LOKDocView* pDocView, const char* pText, bool bBackwards, bool highligh + cairo_region_get_rectangle(cairoVisRegion, 0, &cairoVisRect); + x = pixelToTwip (cairoVisRect.x, priv->m_fZoom); + y = pixelToTwip (cairoVisRect.y, priv->m_fZoom); +- ++ + aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchString/type", '/'), "string"); + aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchString/value", '/'), pText); + aTree.put(boost::property_tree::ptree::path_type("SearchItem.Backward/type", '/'), "boolean"); +@@ -2667,6 +2667,37 @@ lok_doc_view_highlight_all (LOKDocView* pDocView, + doSearch(pDocView, pText, false, true); + } + ++SAL_DLLPUBLIC_EXPORT gchar* ++lok_doc_view_copy_selection (LOKDocView* pDocView, ++ const gchar* pMimeType, ++ gchar** pUsedMimeType) ++{ ++ LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(pDocView); ++ return pDocument->pClass->getTextSelection(pDocument, pMimeType, pUsedMimeType); ++} ++ ++SAL_DLLPUBLIC_EXPORT gboolean ++lok_doc_view_paste (LOKDocView* pDocView, ++ const gchar* pMimeType, ++ const gchar* pData, ++ gsize nSize) ++{ ++ LOKDocViewPrivate& priv = getPrivate(pDocView); ++ LibreOfficeKitDocument* pDocument = priv->m_pDocument; ++ gboolean ret = 0; ++ ++ if (!priv->m_bEdit) ++ { ++ g_info ("ignoring paste in view-only mode"); ++ return ret; ++ } ++ ++ if (pData) ++ ret = pDocument->pClass->paste(pDocument, pMimeType, pData, nSize); ++ ++ return ret; ++} ++ + SAL_DLLPUBLIC_EXPORT float + lok_doc_view_pixel_to_twip (LOKDocView* pDocView, float fInput) + { +-- +2.12.0 + diff --git a/SOURCES/0371-tdf-96384-Add-a-new-signal-text-selection-to-lokdocv.patch b/SOURCES/0371-tdf-96384-Add-a-new-signal-text-selection-to-lokdocv.patch new file mode 100644 index 0000000..dc68c43 --- /dev/null +++ b/SOURCES/0371-tdf-96384-Add-a-new-signal-text-selection-to-lokdocv.patch @@ -0,0 +1,76 @@ +From 8d11e5ab0f7d7fb882086a626c69bfb218c9ab3e Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Thu, 10 Dec 2015 21:10:16 +0530 +Subject: [PATCH 371/398] tdf#96384: Add a new signal 'text-selection' to + lokdocview + +To help client know when the user has selected a non-null text. + +Change-Id: Ie939612fc5f38e2e50e9ad9792e04e89ae918886 +Reviewed-on: https://gerrit.libreoffice.org/20621 +Tested-by: Jenkins +Reviewed-by: Miklos Vajna +(cherry picked from commit ea5c99428f56e1d3a3e782505aa2f56f905038a4) +Signed-off-by: David Tardon +(cherry picked from commit 3f13961c45ea9a6f90c0bc268a2274634d9b8033) +--- + libreofficekit/source/gtk/lokdocview.cxx | 21 ++++++++++++++++++++- + 1 file changed, 20 insertions(+), 1 deletion(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 99ad819f6e5c..012c75f29e1b 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -186,6 +186,7 @@ enum + SEARCH_RESULT_COUNT, + COMMAND_RESULT, + FORMULA_CHANGED, ++ TEXT_SELECTION, + + LAST_SIGNAL + }; +@@ -925,8 +926,9 @@ callback (gpointer pData) + case LOK_CALLBACK_TEXT_SELECTION: + { + priv->m_aTextSelectionRectangles = payloadToRectangles(pDocView, pCallback->m_aPayload.c_str()); ++ gboolean bIsTextSelected = !priv->m_aTextSelectionRectangles.empty(); + // In case the selection is empty, then we get no LOK_CALLBACK_TEXT_SELECTION_START/END events. +- if (priv->m_aTextSelectionRectangles.empty()) ++ if (!bIsTextSelected) + { + memset(&priv->m_aTextSelectionStart, 0, sizeof(priv->m_aTextSelectionStart)); + memset(&priv->m_aHandleStartRect, 0, sizeof(priv->m_aHandleStartRect)); +@@ -935,6 +937,8 @@ callback (gpointer pData) + } + else + memset(&priv->m_aHandleMiddleRect, 0, sizeof(priv->m_aHandleMiddleRect)); ++ ++ g_signal_emit(pDocView, doc_view_signals[TEXT_SELECTION], 0, bIsTextSelected); + gtk_widget_queue_draw(GTK_WIDGET(pDocView)); + } + break; +@@ -2380,6 +2384,21 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, 1, + G_TYPE_STRING); ++ ++ /** ++ * LOKDocView::text-selection: ++ * @pDocView: the #LOKDocView on which the signal is emitted ++ * @bIsTextSelected: whether text selected is non-null ++ */ ++ doc_view_signals[TEXT_SELECTION] = ++ g_signal_new("text-selection", ++ G_TYPE_FROM_CLASS(pGObjectClass), ++ G_SIGNAL_RUN_FIRST, ++ 0, ++ nullptr, nullptr, ++ g_cclosure_marshal_VOID__BOOLEAN, ++ G_TYPE_NONE, 1, ++ G_TYPE_BOOLEAN); + } + + SAL_DLLPUBLIC_EXPORT GtkWidget* +-- +2.12.0 + diff --git a/SOURCES/0372-tdf-96250-LOK-guard-against-0-pRenderingArguments.patch b/SOURCES/0372-tdf-96250-LOK-guard-against-0-pRenderingArguments.patch new file mode 100644 index 0000000..8115f59 --- /dev/null +++ b/SOURCES/0372-tdf-96250-LOK-guard-against-0-pRenderingArguments.patch @@ -0,0 +1,33 @@ +From 630f041ac5f60195fa4a75f22ad348fba1c14382 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Wed, 16 Dec 2015 20:04:01 +0100 +Subject: [PATCH 372/398] tdf#96250 LOK: guard against 0 pRenderingArguments + +(cherry picked from commit 032e34d0014d2154feaf97105d2dbe69b290b8c5) + +Change-Id: Ifa39777795ce966662c31c891ffc1b9b1a297b00 +Reviewed-on: https://gerrit.libreoffice.org/20743 +Tested-by: Jenkins +Reviewed-by: David Tardon +(cherry picked from commit e390b5f4f1267071245e452baa8dd63cdb556f1d) +--- + libreofficekit/source/gtk/lokdocview.cxx | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 012c75f29e1b..927f4b509bb8 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -2451,7 +2451,8 @@ lok_doc_view_open_document (LOKDocView* pDocView, + pLOEvent->m_pPath = pPath; + + priv->m_aDocPath = pPath; +- priv->m_aRenderingArguments = pRenderingArguments; ++ if (pRenderingArguments) ++ priv->m_aRenderingArguments = pRenderingArguments; + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + + g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); +-- +2.12.0 + diff --git a/SOURCES/0373-lokdocview-Remove-an-easy-FIXME.patch b/SOURCES/0373-lokdocview-Remove-an-easy-FIXME.patch new file mode 100644 index 0000000..0ff41f1 --- /dev/null +++ b/SOURCES/0373-lokdocview-Remove-an-easy-FIXME.patch @@ -0,0 +1,43 @@ +From f921217577611da13e097a34c18e589e09850927 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Sun, 13 Dec 2015 10:48:45 +0530 +Subject: [PATCH 373/398] lokdocview: Remove an easy FIXME + +Change-Id: I8305f3eb45330f457089ca0524a0df004410f59c +Reviewed-on: https://gerrit.libreoffice.org/20774 +Reviewed-by: David Tardon +Tested-by: David Tardon +(cherry picked from commit 244aad533b0fd714136f4f62b5a07fc136c740f0) +Reviewed-on: https://gerrit.libreoffice.org/21263 +Tested-by: Jenkins +Reviewed-by: Pranav Kant +(cherry picked from commit 2bb2c450a741a539be69494b5308428d07c56adf) +--- + libreofficekit/source/gtk/lokdocview.cxx | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 927f4b509bb8..a3e6b21165d9 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -2428,8 +2428,7 @@ lok_doc_view_open_document_finish (LOKDocView* pDocView, GAsyncResult* res, GErr + GTask* task = G_TASK(res); + + g_return_val_if_fail(g_task_is_valid(res, pDocView), false); +- //FIXME: make source_tag work +- //g_return_val_if_fail(g_task_get_source_tag(task) == lok_doc_view_open_document, NULL); ++ g_return_val_if_fail(g_task_get_source_tag(task) == lok_doc_view_open_document, false); + g_return_val_if_fail(error == nullptr || *error == nullptr, false); + + return g_task_propagate_boolean(task, error); +@@ -2454,6 +2453,7 @@ lok_doc_view_open_document (LOKDocView* pDocView, + if (pRenderingArguments) + priv->m_aRenderingArguments = pRenderingArguments; + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); ++ g_task_set_source_tag(task, reinterpret_cast(lok_doc_view_open_document)); + + g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error); + if (error != nullptr) +-- +2.12.0 + diff --git a/SOURCES/0374-lokdocview-Superfluous-_set_zoom-call-on-widget-init.patch b/SOURCES/0374-lokdocview-Superfluous-_set_zoom-call-on-widget-init.patch new file mode 100644 index 0000000..19a4d53 --- /dev/null +++ b/SOURCES/0374-lokdocview-Superfluous-_set_zoom-call-on-widget-init.patch @@ -0,0 +1,46 @@ +From 9d844459f8aed0ef85a7985f48a2460f9d594a59 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Tue, 15 Dec 2015 00:23:46 +0530 +Subject: [PATCH 374/398] lokdocview: Superfluous *_set_zoom() call on widget + initialization + +G_PARAM_CONSTRUCT implies that parameter will be set upon widget +initialization which means calling lok_doc_view_set_zoom() while +document still points to null. + +Change-Id: Ib576ac3b32c2349be2b2df6067ae79a056a03028 +Reviewed-on: https://gerrit.libreoffice.org/20775 +Reviewed-by: David Tardon +Tested-by: David Tardon +(cherry picked from commit a2682e4b081a9a8c6814db768e4ee9e5390907ae) +Reviewed-on: https://gerrit.libreoffice.org/21264 +Tested-by: Jenkins +Reviewed-by: Pranav Kant +(cherry picked from commit 0478825ba51d390486bfbecb410bf9aaa3a3ff59) +--- + libreofficekit/source/gtk/lokdocview.cxx | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index a3e6b21165d9..ccc45657626b 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -760,6 +760,7 @@ static gboolean postDocumentLoad(gpointer pData) + nDocumentHeightPixels); + gtk_widget_set_can_focus(GTK_WIDGET(pLOKDocView), TRUE); + gtk_widget_grab_focus(GTK_WIDGET(pLOKDocView)); ++ lok_doc_view_set_zoom(pLOKDocView, 1.0); + + return G_SOURCE_REMOVE; + } +@@ -2141,7 +2142,6 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + "The current zoom level of the content", + 0, 5.0, 1.0, + static_cast(G_PARAM_READWRITE | +- G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS))); + + /** +-- +2.12.0 + diff --git a/SOURCES/0375-lokdocview-Use-GLib-basic-types.patch b/SOURCES/0375-lokdocview-Use-GLib-basic-types.patch new file mode 100644 index 0000000..5a0f6d1 --- /dev/null +++ b/SOURCES/0375-lokdocview-Use-GLib-basic-types.patch @@ -0,0 +1,132 @@ +From 466c0c035a0d03c76c82ad360b350f887c221912 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Thu, 17 Dec 2015 20:35:23 +0530 +Subject: [PATCH 375/398] lokdocview: Use GLib basic types + +Change-Id: I07add7b9dcb1dc53d7ed61ff71545489de3be155 +Reviewed-on: https://gerrit.libreoffice.org/20778 +Reviewed-by: David Tardon +Tested-by: David Tardon +(cherry picked from commit b902432b431d01634c1f56e4758ec236a999650d) +Reviewed-on: https://gerrit.libreoffice.org/21265 +Tested-by: Jenkins +Reviewed-by: Pranav Kant +(cherry picked from commit 0886f49224064a259ed6615961f420ab7b6fc3ef) +--- + include/LibreOfficeKit/LibreOfficeKitGtk.h | 12 ++++++------ + libreofficekit/source/gtk/lokdocview.cxx | 12 ++++++------ + 2 files changed, 12 insertions(+), 12 deletions(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h +index 903a74256ffa..c3cba8fe3417 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h ++++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h +@@ -118,19 +118,19 @@ void lok_doc_view_set_zoom (LOKDocView* + * + * Returns: The current zoom factor value in float for pDocView + */ +-float lok_doc_view_get_zoom (LOKDocView* pDocView); ++gfloat lok_doc_view_get_zoom (LOKDocView* pDocView); + + /** + * lok_doc_view_get_parts: + * @pDocView: The #LOKDocView instance + */ +-int lok_doc_view_get_parts (LOKDocView* pDocView); ++gint lok_doc_view_get_parts (LOKDocView* pDocView); + + /** + * lok_doc_view_get_part: + * @pDocView: The #LOKDocView instance + */ +-int lok_doc_view_get_part (LOKDocView* pDocView); ++gint lok_doc_view_get_part (LOKDocView* pDocView); + + /** + * lok_doc_view_set_part: +@@ -145,7 +145,7 @@ void lok_doc_view_set_part (LOKDocView* + * @pDocView: The #LOKDocView instance + * @nPart: + */ +-char* lok_doc_view_get_part_name (LOKDocView* pDocView, ++gchar* lok_doc_view_get_part_name (LOKDocView* pDocView, + int nPart); + + /** +@@ -272,7 +272,7 @@ gboolean lok_doc_view_paste (LOKDocView* + * + * Returns: The corresponding value in twips + */ +-float lok_doc_view_pixel_to_twip (LOKDocView* pDocView, ++gfloat lok_doc_view_pixel_to_twip (LOKDocView* pDocView, + float fInput); + + /** +@@ -284,7 +284,7 @@ float lok_doc_view_pixel_to_twip (LOKDocView* + * + * Returns: The corresponding value in pixels + */ +-float lok_doc_view_twip_to_pixel (LOKDocView* pDocView, ++gfloat lok_doc_view_twip_to_pixel (LOKDocView* pDocView, + float fInput); + + G_END_DECLS +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index ccc45657626b..9d7f0740595e 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -2507,14 +2507,14 @@ lok_doc_view_set_zoom (LOKDocView* pDocView, float fZoom) + g_object_unref(task); + } + +-SAL_DLLPUBLIC_EXPORT float ++SAL_DLLPUBLIC_EXPORT gfloat + lok_doc_view_get_zoom (LOKDocView* pDocView) + { + LOKDocViewPrivate& priv = getPrivate(pDocView); + return priv->m_fZoom; + } + +-SAL_DLLPUBLIC_EXPORT int ++SAL_DLLPUBLIC_EXPORT gint + lok_doc_view_get_parts (LOKDocView* pDocView) + { + LOKDocViewPrivate& priv = getPrivate(pDocView); +@@ -2522,7 +2522,7 @@ lok_doc_view_get_parts (LOKDocView* pDocView) + return priv->m_pDocument->pClass->getParts( priv->m_pDocument ); + } + +-SAL_DLLPUBLIC_EXPORT int ++SAL_DLLPUBLIC_EXPORT gint + lok_doc_view_get_part (LOKDocView* pDocView) + { + LOKDocViewPrivate& priv = getPrivate(pDocView); +@@ -2550,7 +2550,7 @@ lok_doc_view_set_part (LOKDocView* pDocView, int nPart) + g_object_unref(task); + } + +-SAL_DLLPUBLIC_EXPORT char* ++SAL_DLLPUBLIC_EXPORT gchar* + lok_doc_view_get_part_name (LOKDocView* pDocView, int nPart) + { + LOKDocViewPrivate& priv = getPrivate(pDocView); +@@ -2718,14 +2718,14 @@ lok_doc_view_paste (LOKDocView* pDocView, + return ret; + } + +-SAL_DLLPUBLIC_EXPORT float ++SAL_DLLPUBLIC_EXPORT gfloat + lok_doc_view_pixel_to_twip (LOKDocView* pDocView, float fInput) + { + LOKDocViewPrivate& priv = getPrivate(pDocView); + return pixelToTwip(fInput, priv->m_fZoom); + } + +-SAL_DLLPUBLIC_EXPORT float ++SAL_DLLPUBLIC_EXPORT gfloat + lok_doc_view_twip_to_pixel (LOKDocView* pDocView, float fInput) + { + LOKDocViewPrivate& priv = getPrivate(pDocView); +-- +2.12.0 + diff --git a/SOURCES/0376-lokdocview-Added-some-missing-comments-annotations.patch b/SOURCES/0376-lokdocview-Added-some-missing-comments-annotations.patch new file mode 100644 index 0000000..06924a4 --- /dev/null +++ b/SOURCES/0376-lokdocview-Added-some-missing-comments-annotations.patch @@ -0,0 +1,52 @@ +From 13818ff71142e735c06b92c03c188527dedbac70 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Thu, 17 Dec 2015 20:33:06 +0530 +Subject: [PATCH 376/398] lokdocview: Added some missing comments/annotations + +Change-Id: I2f62bae37719ce96677a5ca6ffd93c8edb325a6a +Reviewed-on: https://gerrit.libreoffice.org/20777 +Reviewed-by: David Tardon +Tested-by: David Tardon +(cherry picked from commit 9c8c3acffa304e2d85dcbbdb5bf9decc9b255b13) +Reviewed-on: https://gerrit.libreoffice.org/21266 +Tested-by: Jenkins +Reviewed-by: Pranav Kant +(cherry picked from commit 2f5643d7fa1009155e900a89918d5cee3265c137) +--- + include/LibreOfficeKit/LibreOfficeKitGtk.h | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h +index c3cba8fe3417..62d2e7f29247 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h ++++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h +@@ -123,12 +123,17 @@ gfloat lok_doc_view_get_zoom (LOKDocView* + /** + * lok_doc_view_get_parts: + * @pDocView: The #LOKDocView instance ++ * ++ * Returns: Part refers to either individual sheets in a Calc, or slides in Impress, ++ * and has no relevance for Writer. + */ + gint lok_doc_view_get_parts (LOKDocView* pDocView); + + /** + * lok_doc_view_get_part: + * @pDocView: The #LOKDocView instance ++ * ++ * Returns: Current part number of the document + */ + gint lok_doc_view_get_part (LOKDocView* pDocView); + +@@ -144,6 +149,8 @@ void lok_doc_view_set_part (LOKDocView* + * lok_doc_view_get_part_name: + * @pDocView: The #LOKDocView instance + * @nPart: ++ * ++ * Returns: Get current part name of loaded document + */ + gchar* lok_doc_view_get_part_name (LOKDocView* pDocView, + int nPart); +-- +2.12.0 + diff --git a/SOURCES/0377-lokdocview-Return-if-no-document-is-set.patch b/SOURCES/0377-lokdocview-Return-if-no-document-is-set.patch new file mode 100644 index 0000000..32f7284 --- /dev/null +++ b/SOURCES/0377-lokdocview-Return-if-no-document-is-set.patch @@ -0,0 +1,199 @@ +From 192a19277531a36bccadde67fbf307eebe60b3ea Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Thu, 17 Dec 2015 21:03:47 +0530 +Subject: [PATCH 377/398] lokdocview: Return if no document is set + +For example, when document has been destroyed using +lok_doc_view_destroy_document() + +Change-Id: I531b85018ffa25bcf88fb101c912b9f11b489a97 +Reviewed-on: https://gerrit.libreoffice.org/20779 +Reviewed-by: David Tardon +Tested-by: David Tardon +(cherry picked from commit df4a196b8f1e97d8a45d1d517942e01bd13182e7) +Reviewed-on: https://gerrit.libreoffice.org/21267 +Tested-by: Jenkins +Reviewed-by: Pranav Kant +(cherry picked from commit dd6006be974ce808f276c550d32f1bc01582aaf3) +--- + include/LibreOfficeKit/LibreOfficeKitGtk.h | 10 ++++--- + .../qa/gtktiledviewer/gtktiledviewer.cxx | 3 ++ + libreofficekit/source/gtk/lokdocview.cxx | 35 ++++++++++++++++++++-- + 3 files changed, 42 insertions(+), 6 deletions(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h +index 62d2e7f29247..911bbdfa6049 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h ++++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h +@@ -125,7 +125,7 @@ gfloat lok_doc_view_get_zoom (LOKDocView* + * @pDocView: The #LOKDocView instance + * + * Returns: Part refers to either individual sheets in a Calc, or slides in Impress, +- * and has no relevance for Writer. ++ * and has no relevance for Writer. Returns -1 if no document is set currently. + */ + gint lok_doc_view_get_parts (LOKDocView* pDocView); + +@@ -133,7 +133,7 @@ gint lok_doc_view_get_parts (LOKDocView* + * lok_doc_view_get_part: + * @pDocView: The #LOKDocView instance + * +- * Returns: Current part number of the document ++ * Returns: Current part number of the document. Returns -1 if no document is set currently. + */ + gint lok_doc_view_get_part (LOKDocView* pDocView); + +@@ -150,7 +150,8 @@ void lok_doc_view_set_part (LOKDocView* + * @pDocView: The #LOKDocView instance + * @nPart: + * +- * Returns: Get current part name of loaded document ++ * Returns: Get current part name of loaded document. Returns null if no ++ * document is set, or document has been destroyed using lok_doc_view_destroy_document. + */ + gchar* lok_doc_view_get_part_name (LOKDocView* pDocView, + int nPart); +@@ -248,7 +249,8 @@ void lok_doc_view_highlight_all (LOKDocView* + * @pUsedMimeType: (out): output parameter to inform about the determined format + * (suggested or plain text). + * +- * Returns: Selected text. The caller must free the returned buffer after use. ++ * Returns: Selected text. The caller must free the returned buffer after ++ * use. Returns null if no document is set. + */ + gchar* lok_doc_view_copy_selection (LOKDocView* pDocView, + const gchar* pMimeType, +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index d064c4ce3e47..e867e1b239a7 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -549,7 +549,10 @@ static void doCopy(GtkWidget* pButton, gpointer /*pItem*/) + TiledWindow& rWindow = lcl_getTiledWindow(pButton); + LOKDocView* pLOKDocView = LOK_DOC_VIEW(rWindow.m_pDocView); + char* pUsedFormat = nullptr; ++ // TODO: Should check `text-selection` signal before trying to copy + char* pSelection = lok_doc_view_copy_selection(pLOKDocView, "text/html", &pUsedFormat); ++ if (!pSelection) ++ return; + + GtkClipboard* pClipboard = gtk_clipboard_get_for_display(gtk_widget_get_display(rWindow.m_pDocView), GDK_SELECTION_CLIPBOARD); + std::string aUsedFormat(pUsedFormat); +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 9d7f0740595e..858f08b66890 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -342,6 +342,9 @@ doSearch(LOKDocView* pDocView, const char* pText, bool bBackwards, bool highligh + cairo_rectangle_int_t cairoVisRect; + int x, y; + ++ if (!priv->m_pDocument) ++ return; ++ + cairo_region_get_rectangle(cairoVisRegion, 0, &cairoVisRect); + x = pixelToTwip (cairoVisRect.x, priv->m_fZoom); + y = pixelToTwip (cairoVisRect.y, priv->m_fZoom); +@@ -1630,8 +1633,6 @@ setClientZoomInThread(gpointer data) + LOKDocViewPrivate& priv = getPrivate(pDocView); + LOEvent* pLOEvent = static_cast(g_task_get_task_data(task)); + +- if (!priv->m_pDocument) +- return; + priv->m_pDocument->pClass->setClientZoom(priv->m_pDocument, + pLOEvent->m_nTilePixelWidth, + pLOEvent->m_nTilePixelHeight, +@@ -2518,6 +2519,9 @@ SAL_DLLPUBLIC_EXPORT gint + lok_doc_view_get_parts (LOKDocView* pDocView) + { + LOKDocViewPrivate& priv = getPrivate(pDocView); ++ if (!priv->m_pDocument) ++ return -1; ++ + priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId); + return priv->m_pDocument->pClass->getParts( priv->m_pDocument ); + } +@@ -2526,6 +2530,9 @@ SAL_DLLPUBLIC_EXPORT gint + lok_doc_view_get_part (LOKDocView* pDocView) + { + LOKDocViewPrivate& priv = getPrivate(pDocView); ++ if (!priv->m_pDocument) ++ return -1; ++ + priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId); + return priv->m_pDocument->pClass->getPart( priv->m_pDocument ); + } +@@ -2538,6 +2545,9 @@ lok_doc_view_set_part (LOKDocView* pDocView, int nPart) + LOEvent* pLOEvent = new LOEvent(LOK_SET_PART); + GError* error = nullptr; + ++ if (!priv->m_pDocument) ++ return; ++ + pLOEvent->m_nPart = nPart; + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + +@@ -2554,6 +2564,10 @@ SAL_DLLPUBLIC_EXPORT gchar* + lok_doc_view_get_part_name (LOKDocView* pDocView, int nPart) + { + LOKDocViewPrivate& priv = getPrivate(pDocView); ++ ++ if (!priv->m_pDocument) ++ return nullptr; ++ + priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId); + return priv->m_pDocument->pClass->getPartName( priv->m_pDocument, nPart ); + } +@@ -2566,6 +2580,10 @@ lok_doc_view_set_partmode(LOKDocView* pDocView, + GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr); + LOEvent* pLOEvent = new LOEvent(LOK_SET_PARTMODE); + GError* error = nullptr; ++ ++ if (!priv->m_pDocument) ++ return; ++ + pLOEvent->m_nPartMode = nPartMode; + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + +@@ -2632,6 +2650,10 @@ lok_doc_view_set_edit(LOKDocView* pDocView, + GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr); + LOEvent* pLOEvent = new LOEvent(LOK_SET_EDIT); + GError* error = nullptr; ++ ++ if (!priv->m_pDocument) ++ return; ++ + pLOEvent->m_bEdit = bEdit; + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + +@@ -2658,6 +2680,10 @@ lok_doc_view_post_command (LOKDocView* pDocView, + gboolean bNotifyWhenFinished) + { + LOKDocViewPrivate& priv = getPrivate(pDocView); ++ ++ if (!priv->m_pDocument) ++ return; ++ + if (priv->m_bEdit) + LOKPostCommand(pDocView, pCommand, pArguments, bNotifyWhenFinished); + else +@@ -2693,6 +2719,8 @@ lok_doc_view_copy_selection (LOKDocView* pDocView, + gchar** pUsedMimeType) + { + LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(pDocView); ++ if (!pDocument) ++ return nullptr; + return pDocument->pClass->getTextSelection(pDocument, pMimeType, pUsedMimeType); + } + +@@ -2706,6 +2734,9 @@ lok_doc_view_paste (LOKDocView* pDocView, + LibreOfficeKitDocument* pDocument = priv->m_pDocument; + gboolean ret = 0; + ++ if (!pDocument) ++ return false; ++ + if (!priv->m_bEdit) + { + g_info ("ignoring paste in view-only mode"); +-- +2.12.0 + diff --git a/SOURCES/0378-coverity-1343631-Resource-leak.patch b/SOURCES/0378-coverity-1343631-Resource-leak.patch new file mode 100644 index 0000000..2b200a6 --- /dev/null +++ b/SOURCES/0378-coverity-1343631-Resource-leak.patch @@ -0,0 +1,39 @@ +From 3ebf54f0b940967c5c8de7f6d9df8c0b09a4bf21 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= +Date: Sat, 19 Dec 2015 15:08:01 +0000 +Subject: [PATCH 378/398] coverity#1343631 Resource leak + +Change-Id: Ic5d7c88ae4080c2e103fb691c2e326a9e239aa12 +(cherry picked from commit 169298fa73d2c5429d1960db6049a4ed15653b4f) +Reviewed-on: https://gerrit.libreoffice.org/21268 +Reviewed-by: David Tardon +Tested-by: Jenkins +(cherry picked from commit 195866b16f044bc792526145b739602166ca7276) +--- + libreofficekit/source/gtk/lokdocview.cxx | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 858f08b66890..a5fc4e34439e 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -2647,13 +2647,13 @@ lok_doc_view_set_edit(LOKDocView* pDocView, + gboolean bEdit) + { + LOKDocViewPrivate& priv = getPrivate(pDocView); ++ if (!priv->m_pDocument) ++ return; ++ + GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr); + LOEvent* pLOEvent = new LOEvent(LOK_SET_EDIT); + GError* error = nullptr; + +- if (!priv->m_pDocument) +- return; +- + pLOEvent->m_bEdit = bEdit; + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + +-- +2.12.0 + diff --git a/SOURCES/0379-coverity-1343632-Resource-leak.patch b/SOURCES/0379-coverity-1343632-Resource-leak.patch new file mode 100644 index 0000000..fdf48db --- /dev/null +++ b/SOURCES/0379-coverity-1343632-Resource-leak.patch @@ -0,0 +1,39 @@ +From 8aacde4431b46b6ecca8aa59cdfa81fc3ef76e04 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= +Date: Sat, 19 Dec 2015 15:09:10 +0000 +Subject: [PATCH 379/398] coverity#1343632 Resource leak + +Change-Id: I79bf35a4c1a2f0463abc202f6c2b104ffdd5139c +(cherry picked from commit 5b05a3fa2d6873c1046a959c545db133b1974e2c) +Reviewed-on: https://gerrit.libreoffice.org/21269 +Reviewed-by: David Tardon +Tested-by: Jenkins +(cherry picked from commit 699b5e361d1f75b1414a351dfe4d05d88e2b49e2) +--- + libreofficekit/source/gtk/lokdocview.cxx | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index a5fc4e34439e..ec3eb4b9e3ba 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -2577,13 +2577,13 @@ lok_doc_view_set_partmode(LOKDocView* pDocView, + int nPartMode) + { + LOKDocViewPrivate& priv = getPrivate(pDocView); ++ if (!priv->m_pDocument) ++ return; ++ + GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr); + LOEvent* pLOEvent = new LOEvent(LOK_SET_PARTMODE); + GError* error = nullptr; + +- if (!priv->m_pDocument) +- return; +- + pLOEvent->m_nPartMode = nPartMode; + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + +-- +2.12.0 + diff --git a/SOURCES/0380-coverity-1343633-Resource-leak.patch b/SOURCES/0380-coverity-1343633-Resource-leak.patch new file mode 100644 index 0000000..8ea1e5a --- /dev/null +++ b/SOURCES/0380-coverity-1343633-Resource-leak.patch @@ -0,0 +1,75 @@ +From 9b6a3417e3a6190f356e9f608346d5ee07bbd19d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= +Date: Sat, 19 Dec 2015 15:11:03 +0000 +Subject: [PATCH 380/398] coverity#1343633 Resource leak + +Change-Id: I2384091557c2a3b061e2c60118309f35b65b45d6 +(cherry picked from commit 746da6b7fb3829e1ca23a4b8dfec6c502bac681c) +Reviewed-on: https://gerrit.libreoffice.org/21270 +Reviewed-by: David Tardon +Tested-by: Jenkins +(cherry picked from commit af32996eb55008b9787516a280a237b61a05ca05) +--- + libreofficekit/source/gtk/lokdocview.cxx | 14 ++++++-------- + 1 file changed, 6 insertions(+), 8 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index ec3eb4b9e3ba..4d2842005f37 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -335,6 +335,9 @@ static void + doSearch(LOKDocView* pDocView, const char* pText, bool bBackwards, bool highlightAll) + { + LOKDocViewPrivate& priv = getPrivate(pDocView); ++ if (!priv->m_pDocument) ++ return; ++ + boost::property_tree::ptree aTree; + GtkWidget* drawingWidget = GTK_WIDGET(pDocView); + GdkWindow* drawingWindow = gtk_widget_get_window(drawingWidget); +@@ -342,9 +345,6 @@ doSearch(LOKDocView* pDocView, const char* pText, bool bBackwards, bool highligh + cairo_rectangle_int_t cairoVisRect; + int x, y; + +- if (!priv->m_pDocument) +- return; +- + cairo_region_get_rectangle(cairoVisRegion, 0, &cairoVisRect); + x = pixelToTwip (cairoVisRect.x, priv->m_fZoom); + y = pixelToTwip (cairoVisRect.y, priv->m_fZoom); +@@ -2541,13 +2541,13 @@ SAL_DLLPUBLIC_EXPORT void + lok_doc_view_set_part (LOKDocView* pDocView, int nPart) + { + LOKDocViewPrivate& priv = getPrivate(pDocView); ++ if (!priv->m_pDocument) ++ return; ++ + GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr); + LOEvent* pLOEvent = new LOEvent(LOK_SET_PART); + GError* error = nullptr; + +- if (!priv->m_pDocument) +- return; +- + pLOEvent->m_nPart = nPart; + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); + +@@ -2564,7 +2564,6 @@ SAL_DLLPUBLIC_EXPORT gchar* + lok_doc_view_get_part_name (LOKDocView* pDocView, int nPart) + { + LOKDocViewPrivate& priv = getPrivate(pDocView); +- + if (!priv->m_pDocument) + return nullptr; + +@@ -2680,7 +2679,6 @@ lok_doc_view_post_command (LOKDocView* pDocView, + gboolean bNotifyWhenFinished) + { + LOKDocViewPrivate& priv = getPrivate(pDocView); +- + if (!priv->m_pDocument) + return; + +-- +2.12.0 + diff --git a/SOURCES/0381-coverity-1315075-Uninitialized-scalar-field.patch b/SOURCES/0381-coverity-1315075-Uninitialized-scalar-field.patch new file mode 100644 index 0000000..fb83cad --- /dev/null +++ b/SOURCES/0381-coverity-1315075-Uninitialized-scalar-field.patch @@ -0,0 +1,33 @@ +From eb95d95b7554c8e1417b96b030d2880dd3e61483 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= +Date: Mon, 21 Dec 2015 09:11:16 +0000 +Subject: [PATCH 381/398] coverity#1315075 Uninitialized scalar field + +Change-Id: I003839589354f02f8064b6a6af6174d2793b9b3a +(cherry picked from commit 92305c3c41d120b868e0821221a583697868ad6d) +Reviewed-on: https://gerrit.libreoffice.org/21271 +Reviewed-by: David Tardon +Tested-by: Jenkins +(cherry picked from commit d753e9e41283ca1e0d77001ec1174426451dd7fe) +--- + libreofficekit/source/gtk/tilebuffer.hxx | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx +index 244ca882d051..90d95891918b 100644 +--- a/libreofficekit/source/gtk/tilebuffer.hxx ++++ b/libreofficekit/source/gtk/tilebuffer.hxx +@@ -268,6 +268,10 @@ struct LOEvent + , m_nSetGraphicSelectionType(0) + , m_nSetGraphicSelectionX(0) + , m_nSetGraphicSelectionY(0) ++ , m_nTilePixelWidth(0) ++ , m_nTilePixelHeight(0) ++ , m_nTileTwipWidth(0) ++ , m_nTileTwipHeight(0) + { + } + +-- +2.12.0 + diff --git a/SOURCES/0382-lokdocview-Use-an-array-to-install-properties.patch b/SOURCES/0382-lokdocview-Use-an-array-to-install-properties.patch new file mode 100644 index 0000000..32ace51 --- /dev/null +++ b/SOURCES/0382-lokdocview-Use-an-array-to-install-properties.patch @@ -0,0 +1,308 @@ +From 5a4d9a54a05efee6cb004b41207e53b6eadbd1a8 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Fri, 18 Dec 2015 21:51:23 +0530 +Subject: [PATCH 382/398] lokdocview: Use an array to install properties + +This way we can directly reference any property by pointers to +GParamSpec stored in a static array, rather than looking for +property using property name. The former is a faster approach. + +This will come in handy for functions, such as, g_object_notify +which needs to access properties to notify the object of any +property change in a faster way. + +Change-Id: Ic4087bff3bdb63a3e8853d158c7af688e5e67811 +Reviewed-on: https://gerrit.libreoffice.org/20797 +Tested-by: Jenkins +Reviewed-by: David Tardon +Tested-by: David Tardon +(cherry picked from commit 81f31f5151b54899ac5461c9c7c4021cdf31a9a6) +Reviewed-on: https://gerrit.libreoffice.org/21272 +Reviewed-by: Pranav Kant +(cherry picked from commit 09c73ad5b1462161b855bf3d43a3d86a3ee28659) +--- + libreofficekit/source/gtk/lokdocview.cxx | 187 +++++++++++++++---------------- + 1 file changed, 90 insertions(+), 97 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 4d2842005f37..07e5f993b79b 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -206,10 +206,13 @@ enum + PROP_DOC_WIDTH, + PROP_DOC_HEIGHT, + PROP_CAN_ZOOM_IN, +- PROP_CAN_ZOOM_OUT ++ PROP_CAN_ZOOM_OUT, ++ ++ PROP_LAST + }; + + static guint doc_view_signals[LAST_SIGNAL] = { 0 }; ++static GParamSpec *properties[PROP_LAST] = { nullptr }; + + static void lok_doc_view_initable_iface_init (GInitableIface *iface); + static void callbackWorker (int nType, const char* pPayload, void* pData); +@@ -2046,15 +2049,14 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + * + * The absolute path of the LibreOffice install. + */ +- g_object_class_install_property (pGObjectClass, +- PROP_LO_PATH, +- g_param_spec_string("lopath", +- "LO Path", +- "LibreOffice Install Path", +- nullptr, +- static_cast(G_PARAM_READWRITE | +- G_PARAM_CONSTRUCT_ONLY | +- G_PARAM_STATIC_STRINGS))); ++ properties[PROP_LO_PATH] = ++ g_param_spec_string("lopath", ++ "LO Path", ++ "LibreOffice Install Path", ++ nullptr, ++ static_cast(G_PARAM_READWRITE | ++ G_PARAM_CONSTRUCT_ONLY | ++ G_PARAM_STATIC_STRINGS)); + + /** + * LOKDocView:lopointer: +@@ -2062,28 +2064,26 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + * A LibreOfficeKit* in case lok_init() is already called + * previously. + */ +- g_object_class_install_property (pGObjectClass, +- PROP_LO_POINTER, +- g_param_spec_pointer("lopointer", +- "LO Pointer", +- "A LibreOfficeKit* from lok_init()", +- static_cast(G_PARAM_READWRITE | +- G_PARAM_CONSTRUCT_ONLY | +- G_PARAM_STATIC_STRINGS))); ++ properties[PROP_LO_POINTER] = ++ g_param_spec_pointer("lopointer", ++ "LO Pointer", ++ "A LibreOfficeKit* from lok_init()", ++ static_cast(G_PARAM_READWRITE | ++ G_PARAM_CONSTRUCT_ONLY | ++ G_PARAM_STATIC_STRINGS)); + + /** + * LOKDocView:docpath: + * + * The path of the document that is currently being viewed. + */ +- g_object_class_install_property (pGObjectClass, +- PROP_DOC_PATH, +- g_param_spec_string("docpath", +- "Document Path", +- "The URI of the document to open", +- nullptr, +- static_cast(G_PARAM_READWRITE | +- G_PARAM_STATIC_STRINGS))); ++ properties[PROP_DOC_PATH] = ++ g_param_spec_string("docpath", ++ "Document Path", ++ "The URI of the document to open", ++ nullptr, ++ static_cast(G_PARAM_READWRITE | ++ G_PARAM_STATIC_STRINGS)); + + /** + * LOKDocView:docpointer: +@@ -2091,27 +2091,25 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + * A LibreOfficeKitDocument* in case documentLoad() is already called + * previously. + */ +- g_object_class_install_property (pGObjectClass, +- PROP_DOC_POINTER, +- g_param_spec_pointer("docpointer", +- "Document Pointer", +- "A LibreOfficeKitDocument* from documentLoad()", +- static_cast(G_PARAM_READWRITE | +- G_PARAM_STATIC_STRINGS))); ++ properties[PROP_DOC_POINTER] = ++ g_param_spec_pointer("docpointer", ++ "Document Pointer", ++ "A LibreOfficeKitDocument* from documentLoad()", ++ static_cast(G_PARAM_READWRITE | ++ G_PARAM_STATIC_STRINGS)); + + /** + * LOKDocView:editable: + * + * Whether the document loaded inside of #LOKDocView is editable or not. + */ +- g_object_class_install_property (pGObjectClass, +- PROP_EDITABLE, +- g_param_spec_boolean("editable", +- "Editable", +- "Whether the content is in edit mode or not", +- FALSE, +- static_cast(G_PARAM_READWRITE | +- G_PARAM_STATIC_STRINGS))); ++ properties[PROP_EDITABLE] = ++ g_param_spec_boolean("editable", ++ "Editable", ++ "Whether the content is in edit mode or not", ++ FALSE, ++ static_cast(G_PARAM_READWRITE | ++ G_PARAM_STATIC_STRINGS)); + + /** + * LOKDocView:load-progress: +@@ -2121,14 +2119,13 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + * very accurate progress indicator, and its value might reset it couple of + * times to 0 and start again. You should not rely on its numbers. + */ +- g_object_class_install_property (pGObjectClass, +- PROP_LOAD_PROGRESS, +- g_param_spec_double("load-progress", +- "Estimated Load Progress", +- "Shows the progress of the document load operation", +- 0.0, 1.0, 0.0, +- static_cast(G_PARAM_READABLE | +- G_PARAM_STATIC_STRINGS))); ++ properties[PROP_LOAD_PROGRESS] = ++ g_param_spec_double("load-progress", ++ "Estimated Load Progress", ++ "Shows the progress of the document load operation", ++ 0.0, 1.0, 0.0, ++ static_cast(G_PARAM_READABLE | ++ G_PARAM_STATIC_STRINGS)); + + /** + * LOKDocView:zoom-level: +@@ -2136,14 +2133,13 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + * The current zoom level of the document loaded inside #LOKDocView. The + * default value is 1.0. + */ +- g_object_class_install_property (pGObjectClass, +- PROP_ZOOM, +- g_param_spec_float("zoom-level", +- "Zoom Level", +- "The current zoom level of the content", +- 0, 5.0, 1.0, +- static_cast(G_PARAM_READWRITE | +- G_PARAM_STATIC_STRINGS))); ++ properties[PROP_ZOOM] = ++ g_param_spec_float("zoom-level", ++ "Zoom Level", ++ "The current zoom level of the content", ++ 0, 5.0, 1.0, ++ static_cast(G_PARAM_READWRITE | ++ G_PARAM_STATIC_STRINGS)); + + /** + * LOKDocView:is-loading: +@@ -2151,70 +2147,67 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + * Whether the requested document is being loaded or not. %TRUE if it is + * being loaded, otherwise %FALSE. + */ +- g_object_class_install_property (pGObjectClass, +- PROP_IS_LOADING, +- g_param_spec_boolean("is-loading", +- "Is Loading", +- "Whether the view is loading a document", +- FALSE, +- static_cast(G_PARAM_READABLE | +- G_PARAM_STATIC_STRINGS))); ++ properties[PROP_IS_LOADING] = ++ g_param_spec_boolean("is-loading", ++ "Is Loading", ++ "Whether the view is loading a document", ++ FALSE, ++ static_cast(G_PARAM_READABLE | ++ G_PARAM_STATIC_STRINGS)); + + /** + * LOKDocView:doc-width: + * + * The width of the currently loaded document in #LOKDocView in twips. + */ +- g_object_class_install_property (pGObjectClass, +- PROP_DOC_WIDTH, +- g_param_spec_long("doc-width", +- "Document Width", +- "Width of the document in twips", +- 0, G_MAXLONG, 0, +- static_cast(G_PARAM_READWRITE | +- G_PARAM_STATIC_STRINGS))); ++ properties[PROP_DOC_WIDTH] = ++ g_param_spec_long("doc-width", ++ "Document Width", ++ "Width of the document in twips", ++ 0, G_MAXLONG, 0, ++ static_cast(G_PARAM_READWRITE | ++ G_PARAM_STATIC_STRINGS)); + + /** + * LOKDocView:doc-height: + * + * The height of the currently loaded document in #LOKDocView in twips. + */ +- g_object_class_install_property (pGObjectClass, +- PROP_DOC_HEIGHT, +- g_param_spec_long("doc-height", +- "Document Height", +- "Height of the document in twips", +- 0, G_MAXLONG, 0, +- static_cast(G_PARAM_READWRITE | +- G_PARAM_STATIC_STRINGS))); ++ properties[PROP_DOC_HEIGHT] = ++ g_param_spec_long("doc-height", ++ "Document Height", ++ "Height of the document in twips", ++ 0, G_MAXLONG, 0, ++ static_cast(G_PARAM_READWRITE | ++ G_PARAM_STATIC_STRINGS)); + + /** + * LOKDocView:can-zoom-in: + * + * It tells whether the view can further be zoomed in or not. + */ +- g_object_class_install_property (pGObjectClass, +- PROP_CAN_ZOOM_IN, +- g_param_spec_boolean("can-zoom-in", +- "Can Zoom In", +- "Whether the view can be zoomed in further", +- TRUE, +- static_cast(G_PARAM_READABLE +- | G_PARAM_STATIC_STRINGS))); ++ properties[PROP_CAN_ZOOM_IN] = ++ g_param_spec_boolean("can-zoom-in", ++ "Can Zoom In", ++ "Whether the view can be zoomed in further", ++ TRUE, ++ static_cast(G_PARAM_READABLE ++ | G_PARAM_STATIC_STRINGS)); + + /** + * LOKDocView:can-zoom-out: + * + * It tells whether the view can further be zoomed out or not. + */ +- g_object_class_install_property (pGObjectClass, +- PROP_CAN_ZOOM_OUT, +- g_param_spec_boolean("can-zoom-out", +- "Can Zoom Out", +- "Whether the view can be zoomed out further", +- TRUE, +- static_cast(G_PARAM_READABLE +- | G_PARAM_STATIC_STRINGS))); ++ properties[PROP_CAN_ZOOM_OUT] = ++ g_param_spec_boolean("can-zoom-out", ++ "Can Zoom Out", ++ "Whether the view can be zoomed out further", ++ TRUE, ++ static_cast(G_PARAM_READABLE ++ | G_PARAM_STATIC_STRINGS)); ++ ++ g_object_class_install_properties(pGObjectClass, PROP_LAST, properties); + + /** + * LOKDocView::load-changed: +-- +2.12.0 + diff --git a/SOURCES/0383-tdf-96514-Emits-a-notify-signal-when-zoom-changes.patch b/SOURCES/0383-tdf-96514-Emits-a-notify-signal-when-zoom-changes.patch new file mode 100644 index 0000000..513542e --- /dev/null +++ b/SOURCES/0383-tdf-96514-Emits-a-notify-signal-when-zoom-changes.patch @@ -0,0 +1,34 @@ +From 59c312354b33f115f359900ba5db85b61792f4ea Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Fri, 18 Dec 2015 21:58:26 +0530 +Subject: [PATCH 383/398] tdf#96514: Emits a 'notify' signal when zoom changes + +Change-Id: I5f55e4cce26096afcae3ad3711efa37757aada39 +Reviewed-on: https://gerrit.libreoffice.org/20798 +Reviewed-by: David Tardon +Tested-by: David Tardon +(cherry picked from commit 398ef76d5dc3ec1ed22fa1d9fd9151b61cce54e2) +Reviewed-on: https://gerrit.libreoffice.org/21273 +Tested-by: Jenkins +Reviewed-by: Pranav Kant +(cherry picked from commit 1fb882cb1e2eedbef688cf2b3a2ca9322486c9cb) +--- + libreofficekit/source/gtk/lokdocview.cxx | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 07e5f993b79b..5cf44e98c796 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -2483,6 +2483,8 @@ lok_doc_view_set_zoom (LOKDocView* pDocView, float fZoom) + nDocumentWidthPixels, + nDocumentHeightPixels); + ++ g_object_notify_by_pspec(G_OBJECT(pDocView), properties[PROP_ZOOM]); ++ + // Update the client's view size + GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr); + LOEvent* pLOEvent = new LOEvent(LOK_SET_CLIENT_ZOOM); +-- +2.12.0 + diff --git a/SOURCES/0384-lokdocview-Use-shared_ptr-to-fix-a-possible-memory-l.patch b/SOURCES/0384-lokdocview-Use-shared_ptr-to-fix-a-possible-memory-l.patch new file mode 100644 index 0000000..98fbb45 --- /dev/null +++ b/SOURCES/0384-lokdocview-Use-shared_ptr-to-fix-a-possible-memory-l.patch @@ -0,0 +1,55 @@ +From 480d4e70b53487da92a4add51395b4068f2e73c0 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Sun, 10 Jan 2016 22:50:46 +0530 +Subject: [PATCH 384/398] lokdocview: Use shared_ptr to fix a possible memory + leak + +Possible because boost::property_tree can throw an exception. + +Change-Id: I68394ce3b30d448d40d8e22555bafdff1ffa6092 +Reviewed-on: https://gerrit.libreoffice.org/21309 +Reviewed-by: David Tardon +Tested-by: David Tardon +(cherry picked from commit 02b49890d51ec463d32846f1108344159664a9eb) +Reviewed-on: https://gerrit.libreoffice.org/21345 +Tested-by: Jenkins +Reviewed-by: Michael Stahl +(cherry picked from commit 1673606de9a520e615e1a32da94f28d55ebaea20) +--- + libreofficekit/source/gtk/lokdocview.cxx | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 5cf44e98c796..b6febbd9fe66 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -10,6 +10,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -344,13 +345,12 @@ doSearch(LOKDocView* pDocView, const char* pText, bool bBackwards, bool highligh + boost::property_tree::ptree aTree; + GtkWidget* drawingWidget = GTK_WIDGET(pDocView); + GdkWindow* drawingWindow = gtk_widget_get_window(drawingWidget); +- cairo_region_t* cairoVisRegion = gdk_window_get_visible_region(drawingWindow); ++ std::shared_ptr cairoVisRegion( gdk_window_get_visible_region(drawingWindow), ++ cairo_region_destroy); + cairo_rectangle_int_t cairoVisRect; +- int x, y; +- +- cairo_region_get_rectangle(cairoVisRegion, 0, &cairoVisRect); +- x = pixelToTwip (cairoVisRect.x, priv->m_fZoom); +- y = pixelToTwip (cairoVisRect.y, priv->m_fZoom); ++ cairo_region_get_rectangle(cairoVisRegion.get(), 0, &cairoVisRect); ++ int x = pixelToTwip (cairoVisRect.x, priv->m_fZoom); ++ int y = pixelToTwip (cairoVisRect.y, priv->m_fZoom); + + aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchString/type", '/'), "string"); + aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchString/value", '/'), pText); +-- +2.12.0 + diff --git a/SOURCES/0385-tdf-96421-Return-if-no-window-is-realized.patch b/SOURCES/0385-tdf-96421-Return-if-no-window-is-realized.patch new file mode 100644 index 0000000..1ed32d7 --- /dev/null +++ b/SOURCES/0385-tdf-96421-Return-if-no-window-is-realized.patch @@ -0,0 +1,33 @@ +From c86a367308b61437e45d2763fb2b0499767cb9bd Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Fri, 18 Dec 2015 22:42:53 +0530 +Subject: [PATCH 385/398] tdf#96421: Return if no window is realized + +Change-Id: I13de7e6eae4e73932e8441ba2e2ad3e4ff888f41 +Reviewed-on: https://gerrit.libreoffice.org/20799 +Tested-by: Jenkins +Reviewed-by: David Tardon +(cherry picked from commit 4200a678fb54f0fa5d2f0c26c655252f9267a527) +Reviewed-on: https://gerrit.libreoffice.org/21346 +Reviewed-by: Michael Stahl +(cherry picked from commit 0056a61e17e0d8faf314431c701c00c3b6c8d5f9) +--- + libreofficekit/source/gtk/lokdocview.cxx | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index b6febbd9fe66..5cfc22d611d7 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -345,6 +345,8 @@ doSearch(LOKDocView* pDocView, const char* pText, bool bBackwards, bool highligh + boost::property_tree::ptree aTree; + GtkWidget* drawingWidget = GTK_WIDGET(pDocView); + GdkWindow* drawingWindow = gtk_widget_get_window(drawingWidget); ++ if (!drawingWindow) ++ return; + std::shared_ptr cairoVisRegion( gdk_window_get_visible_region(drawingWindow), + cairo_region_destroy); + cairo_rectangle_int_t cairoVisRect; +-- +2.12.0 + diff --git a/SOURCES/0386-lokdocview-Fix-WARNING-when-creating-an-error.patch b/SOURCES/0386-lokdocview-Fix-WARNING-when-creating-an-error.patch new file mode 100644 index 0000000..bf995d1 --- /dev/null +++ b/SOURCES/0386-lokdocview-Fix-WARNING-when-creating-an-error.patch @@ -0,0 +1,39 @@ +From 6b4439ee8561429eee14e60c62788df63c318f67 Mon Sep 17 00:00:00 2001 +From: Debarshi Ray +Date: Fri, 8 Jan 2016 18:06:18 +0100 +Subject: [PATCH 386/398] lokdocview: Fix WARNING when creating an error + +A GError needs a valid GQuark as the domain. Passing 0 leads to: + GLib-WARNING **: (gerror.c:408):g_error_new_valist: runtime check + failed: (domain != 0) + +Change-Id: I2f252eaa83a1519b5d16c7ba22c8f593732807ca +Reviewed-on: https://gerrit.libreoffice.org/21261 +Tested-by: Jenkins +Reviewed-by: Pranav Kant +Reviewed-by: jan iversen +(cherry picked from commit 3ba1b60c97b342c13593d37ccf2b97a919808dfc) +Reviewed-on: https://gerrit.libreoffice.org/21384 +Reviewed-by: David Tardon +Tested-by: David Tardon +(cherry picked from commit 9f6cb113a9a6a55de34bf2fab6da757275ead6ea) +--- + libreofficekit/source/gtk/lokdocview.cxx | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 5cfc22d611d7..9774acacad83 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -1681,7 +1681,7 @@ openDocumentInThread (gpointer data) + if ( !priv->m_pDocument ) + { + char *pError = priv->m_pOffice->pClass->getError( priv->m_pOffice ); +- g_task_return_new_error(task, 0, 0, "%s", pError); ++ g_task_return_new_error(task, g_quark_from_static_string ("LOK error"), 0, "%s", pError); + } + else + { +-- +2.12.0 + diff --git a/SOURCES/0387-tdf-96513-Limit-LOKDocView-s-zoom-in-0.25-5.0.patch b/SOURCES/0387-tdf-96513-Limit-LOKDocView-s-zoom-in-0.25-5.0.patch new file mode 100644 index 0000000..2ab2e14 --- /dev/null +++ b/SOURCES/0387-tdf-96513-Limit-LOKDocView-s-zoom-in-0.25-5.0.patch @@ -0,0 +1,97 @@ +From b94feb218000f0c0a1e156cb868531295763b68d Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Sat, 19 Dec 2015 20:36:47 +0530 +Subject: [PATCH 387/398] tdf#96513: Limit LOKDocView's zoom in [0.25, 5.0] + +Change-Id: Ibee485909dca1ea4a3774fca7a840afbf2d9883c +Reviewed-on: https://gerrit.libreoffice.org/20819 +Tested-by: Jenkins +Reviewed-by: David Tardon +(cherry picked from commit ba539fa91f9c3316107dcdf4a95718a49335d92e) +Reviewed-on: https://gerrit.libreoffice.org/21347 +Reviewed-by: Christian Lohmaier +(cherry picked from commit bd85600aa4a81fba19c98e0a1c2d5ccdcb8fb3fc) +--- + include/LibreOfficeKit/LibreOfficeKitGtk.h | 4 +++- + libreofficekit/source/gtk/lokdocview.cxx | 29 +++++++++++++++++++++++++++-- + 2 files changed, 30 insertions(+), 3 deletions(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h +index 911bbdfa6049..e06d154f772e 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h ++++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h +@@ -107,7 +107,9 @@ LibreOfficeKitDocument* lok_doc_view_get_document (LOKDocView* + * @pDocView: The #LOKDocView instance + * @fZoom: The new zoom level that pDocView must set it into. + * +- * Sets the new zoom level for the widget. ++ * Sets the new zoom level for the widget. Does nothing if fZoom is equal to ++ * existing zoom level. Values outside the range [0.25, 5.0] are clamped into ++ * the nearest allowed value in the interval. + */ + void lok_doc_view_set_zoom (LOKDocView* pDocView, + float fZoom); +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 9774acacad83..d2c66b951b7d 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -39,6 +39,10 @@ + #define CURSOR_HANDLE_DIR "android/experimental/LOAndroid3/res/drawable/" + // Number of handles around a graphic selection. + #define GRAPHIC_HANDLE_COUNT 8 ++// Maximum Zoom allowed ++#define MAX_ZOOM 5.0f ++// Minimum Zoom allowed ++#define MIN_ZOOM 0.25f + + /// Private struct used by this GObject type + struct LOKDocViewPrivateImpl +@@ -125,8 +129,8 @@ struct LOKDocViewPrivateImpl + m_aDocPath(nullptr), + m_nLoadProgress(0), + m_bIsLoading(false), +- m_bCanZoomIn(false), +- m_bCanZoomOut(false), ++ m_bCanZoomIn(true), ++ m_bCanZoomOut(true), + m_pOffice(nullptr), + m_pDocument(nullptr), + lokThreadPool(nullptr), +@@ -2473,6 +2477,13 @@ lok_doc_view_set_zoom (LOKDocView* pDocView, float fZoom) + LOKDocViewPrivate& priv = getPrivate(pDocView); + GError* error = nullptr; + ++ // Clamp the input value in [MIN_ZOOM, MAX_ZOOM] ++ fZoom = fZoom < MIN_ZOOM ? MIN_ZOOM : fZoom; ++ fZoom = fZoom > MAX_ZOOM ? MAX_ZOOM : fZoom; ++ ++ if (fZoom == priv->m_fZoom) ++ return; ++ + priv->m_fZoom = fZoom; + long nDocumentWidthPixels = twipToPixel(priv->m_nDocumentWidthTwips, fZoom); + long nDocumentHeightPixels = twipToPixel(priv->m_nDocumentHeightTwips, fZoom); +@@ -2487,6 +2498,20 @@ lok_doc_view_set_zoom (LOKDocView* pDocView, float fZoom) + + g_object_notify_by_pspec(G_OBJECT(pDocView), properties[PROP_ZOOM]); + ++ // set properties to indicate if view can be further zoomed in/out ++ bool bCanZoomIn = priv->m_fZoom < MAX_ZOOM; ++ bool bCanZoomOut = priv->m_fZoom > MIN_ZOOM; ++ if (bCanZoomIn != priv->m_bCanZoomIn) ++ { ++ priv->m_bCanZoomIn = bCanZoomIn; ++ g_object_notify_by_pspec(G_OBJECT(pDocView), properties[PROP_CAN_ZOOM_IN]); ++ } ++ if (bCanZoomOut != priv->m_bCanZoomOut) ++ { ++ priv->m_bCanZoomOut = bCanZoomOut; ++ g_object_notify_by_pspec(G_OBJECT(pDocView), properties[PROP_CAN_ZOOM_OUT]); ++ } ++ + // Update the client's view size + GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr); + LOEvent* pLOEvent = new LOEvent(LOK_SET_CLIENT_ZOOM); +-- +2.12.0 + diff --git a/SOURCES/0388-lokdocview-Center-the-widget-inside-the-allocation.patch b/SOURCES/0388-lokdocview-Center-the-widget-inside-the-allocation.patch new file mode 100644 index 0000000..7de3c60 --- /dev/null +++ b/SOURCES/0388-lokdocview-Center-the-widget-inside-the-allocation.patch @@ -0,0 +1,48 @@ +From 356c869cbd52306275956973c18da53a15fe7655 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Wed, 20 Jan 2016 14:49:29 +0530 +Subject: [PATCH 388/398] lokdocview: Center the widget inside the allocation + +Change-Id: I8d7f8ffb1c5ddd07ccf7d56bdf0ccc866c927401 +Reviewed-on: https://gerrit.libreoffice.org/21624 +Tested-by: Jenkins +Reviewed-by: Pranav Kant +(cherry picked from commit 070bfedb7c0bc01ada0c0b95622543472ccb4a1c) +Reviewed-on: https://gerrit.libreoffice.org/21638 +Reviewed-by: Miklos Vajna +(cherry picked from commit 3763ab42fa88d9f2a2248eba1854f3d97fcfbde8) +--- + libreofficekit/source/gtk/lokdocview.cxx | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index d2c66b951b7d..1af678e1acc2 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -2404,14 +2404,21 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + SAL_DLLPUBLIC_EXPORT GtkWidget* + lok_doc_view_new (const gchar* pPath, GCancellable *cancellable, GError **error) + { +- return GTK_WIDGET (g_initable_new (LOK_TYPE_DOC_VIEW, cancellable, error, "lopath", pPath == NULL ? LOK_PATH : pPath, NULL)); ++ return GTK_WIDGET (g_initable_new (LOK_TYPE_DOC_VIEW, cancellable, error, ++ "lopath", pPath == nullptr ? LOK_PATH : pPath, ++ "halign", GTK_ALIGN_CENTER, ++ nullptr)); + } + + SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new_from_widget(LOKDocView* pOldLOKDocView) + { + LOKDocViewPrivate& pOldPriv = getPrivate(pOldLOKDocView); + GtkWidget* pNewDocView = GTK_WIDGET(g_initable_new(LOK_TYPE_DOC_VIEW, /*cancellable=*/nullptr, /*error=*/nullptr, +- "lopath", pOldPriv->m_aLOPath, "lopointer", pOldPriv->m_pOffice, "docpointer", pOldPriv->m_pDocument, NULL)); ++ "lopath", pOldPriv->m_aLOPath, ++ "lopointer", pOldPriv->m_pOffice, ++ "docpointer", pOldPriv->m_pDocument, ++ "halign", GTK_ALIGN_CENTER, ++ nullptr)); + + // No documentLoad(), just a createView(). + LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(LOK_DOC_VIEW(pNewDocView)); +-- +2.12.0 + diff --git a/SOURCES/0389-libreofficekit-password-interaction-optional-and-off.patch b/SOURCES/0389-libreofficekit-password-interaction-optional-and-off.patch new file mode 100644 index 0000000..eb6ce55 --- /dev/null +++ b/SOURCES/0389-libreofficekit-password-interaction-optional-and-off.patch @@ -0,0 +1,520 @@ +From 419ebb636dc46040fe508f71af3f6baad3c930ff Mon Sep 17 00:00:00 2001 +From: Michael Stahl +Date: Fri, 22 Jan 2016 13:39:32 +0100 +Subject: [PATCH 389/398] libreofficekit: password interaction optional and off + by default + +Add setOptionalFeatures() function that clients must call during +initialization, and enum LibreOfficeKitOptionalFeatures. + +Reviewed-on: https://gerrit.libreoffice.org/21809 +Reviewed-by: Jan Holesovsky +Tested-by: Jan Holesovsky +(cherry picked from commit 23a0ee3c01c3588472e1c19605909d6b9401253c) + +libreofficekit: ask for password when loading encrypted documents +(cherry picked from commit 2b63e576a5cf06f4af877d63403ad7955ac71b72) + +desktop: use x prefix for uno::Reference +(cherry picked from commit 0101cd3da6262169fa273309a86ba5e7cfe573bf) + +loplugin:defaultparams +(cherry picked from commit 95c8b8e85d3328bfbe906ef3f69145842aae01db) + +Reviewed-on: https://gerrit.libreoffice.org/21838 +Tested-by: Jenkins +Reviewed-by: Miklos Vajna +(cherry picked from commit 2241a7fd97b8b70d2d3106ac531cc72192ad708f) + +Change-Id: I73035193c87033052921c3aad94fdc057fe81111 +--- + desktop/inc/lib/init.hxx | 13 +++- + desktop/source/lib/init.cxx | 38 +++++++++- + desktop/source/lib/lokinteractionhandler.cxx | 107 +++++++++++++++++++++++++-- + desktop/source/lib/lokinteractionhandler.hxx | 19 ++++- + include/LibreOfficeKit/LibreOfficeKit.h | 9 +++ + include/LibreOfficeKit/LibreOfficeKit.hxx | 34 +++++++++ + include/LibreOfficeKit/LibreOfficeKitEnums.h | 45 ++++++++++- + libreofficekit/source/gtk/lokdocview.cxx | 10 +++ + 8 files changed, 264 insertions(+), 11 deletions(-) + +diff --git a/desktop/inc/lib/init.hxx b/desktop/inc/lib/init.hxx +index 4f878d26c007..560bd06c6cd9 100644 +--- a/desktop/inc/lib/init.hxx ++++ b/desktop/inc/lib/init.hxx +@@ -7,13 +7,16 @@ + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + #include ++#include + #include + #include + #include ++#include ++#include + #include "../../source/inc/desktopdllapi.h" + #include + +-using namespace css; ++class LOKInteractionHandler; + + namespace desktop { + struct DESKTOP_DLLPUBLIC LibLODocument_Impl : public _LibreOfficeKitDocument +@@ -34,7 +37,15 @@ namespace desktop { + oslThread maThread; + LibreOfficeKitCallback mpCallback; + void *mpCallbackData; ++ int64_t mOptionalFeatures; ++ std::map> mInteractionMap; + + LibLibreOffice_Impl(); ++ ~LibLibreOffice_Impl(); ++ ++ bool hasOptionalFeature(LibreOfficeKitOptionalFeatures const feature) ++ { ++ return (mOptionalFeatures & feature) != 0; ++ } + }; + } +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 6bed25514137..35ba91306036 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -433,11 +433,16 @@ static void lo_registerCallback (LibreOfficeKit* pThis, + LibreOfficeKitCallback pCallback, + void* pData); + static char* lo_getFilterTypes(LibreOfficeKit* pThis); ++static void lo_setOptionalFeatures(LibreOfficeKit* pThis, uint64_t features); ++static void lo_setDocumentPassword(LibreOfficeKit* pThis, ++ const char* pURL, ++ const char* pPassword); + + LibLibreOffice_Impl::LibLibreOffice_Impl() + : maThread(0) + , mpCallback(nullptr) + , mpCallbackData(nullptr) ++ , mOptionalFeatures(0) + { + if(!(m_pOfficeClass = gOfficeClass.lock())) { + m_pOfficeClass.reset(new LibreOfficeKitClass); +@@ -449,6 +454,8 @@ LibLibreOffice_Impl::LibLibreOffice_Impl() + m_pOfficeClass->documentLoadWithOptions = lo_documentLoadWithOptions; + m_pOfficeClass->registerCallback = lo_registerCallback; + m_pOfficeClass->getFilterTypes = lo_getFilterTypes; ++ m_pOfficeClass->setOptionalFeatures = lo_setOptionalFeatures; ++ m_pOfficeClass->setDocumentPassword = lo_setDocumentPassword; + + gOfficeClass = m_pOfficeClass; + } +@@ -456,6 +463,10 @@ LibLibreOffice_Impl::LibLibreOffice_Impl() + pClass = m_pOfficeClass.get(); + } + ++LibLibreOffice_Impl::~LibLibreOffice_Impl() ++{ ++} ++ + namespace + { + +@@ -517,7 +528,10 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions(LibreOfficeKit* pThis, + uno::makeAny(OUString::createFromAscii(pOptions)), + beans::PropertyState_DIRECT_VALUE); + +- uno::Reference xInteraction(new LOKInteractionHandler(::comphelper::getProcessComponentContext())); ++ rtl::Reference const pInteraction( ++ new LOKInteractionHandler(::comphelper::getProcessComponentContext(), pLib)); ++ auto const pair(pLib->mInteractionMap.insert(std::make_pair(aURL.toUtf8(), pInteraction))); ++ uno::Reference const xInteraction(pInteraction.get()); + aFilterOptions[1].Name = "InteractionHandler"; + aFilterOptions[1].Value <<= xInteraction; + +@@ -536,6 +550,12 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions(LibreOfficeKit* pThis, + aURL, OUString("_blank"), 0, + aFilterOptions); + ++ assert(!xComponent.is() || pair.second); // concurrent loading of same URL ought to fail ++ if (!pair.second) ++ { ++ pLib->mInteractionMap.erase(aURL.toUtf8()); ++ } ++ + if (!xComponent.is()) + { + pLib->maLastExceptionMsg = "loadComponentFromURL returned an empty reference"; +@@ -1579,6 +1599,22 @@ static char* lo_getFilterTypes(LibreOfficeKit* pThis) + return strdup(aStream.str().c_str()); + } + ++static void lo_setOptionalFeatures(LibreOfficeKit* pThis, uint64_t const features) ++{ ++ LibLibreOffice_Impl *const pLib = static_cast(pThis); ++ pLib->mOptionalFeatures = features; ++} ++ ++static void lo_setDocumentPassword(LibreOfficeKit* pThis, ++ const char* pURL, const char* pPassword) ++{ ++ assert(pThis); ++ assert(pURL); ++ LibLibreOffice_Impl *const pLib = static_cast(pThis); ++ assert(pLib->mInteractionMap.find(OString(pURL)) != pLib->mInteractionMap.end()); ++ pLib->mInteractionMap.find(OString(pURL))->second->SetPassword(pPassword); ++} ++ + static void force_c_locale() + { + // force locale (and resource files loaded) to en-US +diff --git a/desktop/source/lib/lokinteractionhandler.cxx b/desktop/source/lib/lokinteractionhandler.cxx +index 1d20b0219e28..50a79721ff69 100644 +--- a/desktop/source/lib/lokinteractionhandler.cxx ++++ b/desktop/source/lib/lokinteractionhandler.cxx +@@ -19,14 +19,28 @@ + + #include "lokinteractionhandler.hxx" + ++#include + #include + ++#include + #include ++#include ++#include ++ ++#define LOK_USE_UNSTABLE_API ++#include <../../inc/lib/init.hxx> ++ ++#include + + using namespace com::sun::star; + +-LOKInteractionHandler::LOKInteractionHandler(uno::Reference const & /*rxContext*/) ++LOKInteractionHandler::LOKInteractionHandler( ++ uno::Reference const & /*rxContext*/, ++ desktop::LibLibreOffice_Impl *const pLOKit) ++ : m_pLOKit(pLOKit) ++ , m_usePassword(false) + { ++ assert(m_pLOKit); + } + + LOKInteractionHandler::~LOKInteractionHandler() +@@ -58,15 +72,84 @@ void SAL_CALL LOKInteractionHandler::initialize(uno::Sequence const & + { + } + +-void SAL_CALL LOKInteractionHandler::handle(uno::Reference const & rRequest) throw (uno::RuntimeException, std::exception) ++void SAL_CALL LOKInteractionHandler::handle( ++ uno::Reference const & xRequest) ++throw (uno::RuntimeException, std::exception) + { + // just do the same thing in both cases +- handleInteractionRequest(rRequest); ++ handleInteractionRequest(xRequest); + } + +-sal_Bool SAL_CALL LOKInteractionHandler::handleInteractionRequest(const uno::Reference& rRequest) throw ( uno::RuntimeException, std::exception ) ++sal_Bool SAL_CALL LOKInteractionHandler::handleInteractionRequest( ++ const uno::Reference& xRequest) ++throw (uno::RuntimeException, std::exception) + { +- uno::Sequence> const &rContinuations = rRequest->getContinuations(); ++ uno::Sequence> const &rContinuations = xRequest->getContinuations(); ++ ++ uno::Any const request(xRequest->getRequest()); ++ task::DocumentPasswordRequest2 passwordRequest; ++ if (request >>= passwordRequest) ++ { ++ if (m_pLOKit->hasOptionalFeature((passwordRequest.IsRequestPasswordToModify) ++ ? LOK_FEATURE_DOCUMENT_PASSWORD_TO_MODIFY ++ : LOK_FEATURE_DOCUMENT_PASSWORD)) ++ { ++ OString const url(passwordRequest.Name.toUtf8()); ++ m_pLOKit->mpCallback(passwordRequest.IsRequestPasswordToModify ++ ? LOK_CALLBACK_DOCUMENT_PASSWORD_TO_MODIFY ++ : LOK_CALLBACK_DOCUMENT_PASSWORD, ++ url.getStr(), ++ m_pLOKit->mpCallbackData); ++ ++ // block until SetPassword is called ++ m_havePassword.wait(); ++ m_havePassword.reset(); ++ } ++ ++ for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i) ++ { ++ if (m_usePassword) ++ { ++ if (passwordRequest.IsRequestPasswordToModify) ++ { ++ uno::Reference const xIPW2( ++ rContinuations[i], uno::UNO_QUERY); ++ xIPW2->setPasswordToModify(m_Password); ++ xIPW2->select(); ++ } ++ else ++ { ++ uno::Reference const xIPW( ++ rContinuations[i], uno::UNO_QUERY); ++ if (xIPW.is()) ++ { ++ xIPW->setPassword(m_Password); ++ xIPW->select(); ++ } ++ } ++ } ++ else ++ { ++ if (passwordRequest.IsRequestPasswordToModify) ++ { ++ uno::Reference const xIPW2( ++ rContinuations[i], uno::UNO_QUERY); ++ xIPW2->setRecommendReadOnly(true); ++ xIPW2->select(); ++ } ++ else ++ { ++ uno::Reference const xAbort( ++ rContinuations[i], uno::UNO_QUERY); ++ if (xAbort.is()) ++ { ++ xAbort->select(); ++ } ++ } ++ } ++ } ++ return sal_True; ++ } + + // TODO: add LOK api that allows handling this for real, for the moment we + // just set the interaction as 'Approved' +@@ -80,4 +163,18 @@ sal_Bool SAL_CALL LOKInteractionHandler::handleInteractionRequest(const uno::Ref + return sal_True; + } + ++void LOKInteractionHandler::SetPassword(char const*const pPassword) ++{ ++ if (pPassword) ++ { ++ m_Password = OUString(pPassword, strlen(pPassword), RTL_TEXTENCODING_UTF8); ++ m_usePassword = true; ++ } ++ else ++ { ++ m_usePassword = false; ++ } ++ m_havePassword.set(); ++} ++ + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +diff --git a/desktop/source/lib/lokinteractionhandler.hxx b/desktop/source/lib/lokinteractionhandler.hxx +index 6d4aa8231daf..584658337fc4 100644 +--- a/desktop/source/lib/lokinteractionhandler.hxx ++++ b/desktop/source/lib/lokinteractionhandler.hxx +@@ -20,12 +20,15 @@ + #ifndef INCLUDED_DESKTOP_SOURCE_LIB_LOKINTERACTIONHANDLER_HXX + #define INCLUDED_DESKTOP_SOURCE_LIB_LOKINTERACTIONHANDLER_HXX + ++#include + #include + + #include + #include + #include + ++namespace desktop { struct LibLibreOffice_Impl; } ++ + /** InteractionHandler is an interface that provides the user with various dialogs / error messages. + + We need an own implementation for the LibreOfficeKit so that we can route the +@@ -38,11 +41,21 @@ class LOKInteractionHandler: public cppu::WeakImplHelper + { +- LOKInteractionHandler(const LOKInteractionHandler&) SAL_DELETED_FUNCTION; +- LOKInteractionHandler& operator=(const LOKInteractionHandler&) SAL_DELETED_FUNCTION; ++private: ++ desktop::LibLibreOffice_Impl * m_pLOKit; ++ OUString m_Password; ++ bool m_usePassword; ++ osl::Condition m_havePassword; ++ ++ LOKInteractionHandler(const LOKInteractionHandler&) = delete; ++ LOKInteractionHandler& operator=(const LOKInteractionHandler&) = delete; + + public: +- explicit LOKInteractionHandler(com::sun::star::uno::Reference const & rxContext); ++ void SetPassword(char const* pPassword); ++ ++ explicit LOKInteractionHandler( ++ com::sun::star::uno::Reference const & rxContext, ++ desktop::LibLibreOffice_Impl *); + + virtual ~LOKInteractionHandler(); + +diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h +index 5189cca5eb5e..b31e5eef1c01 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.h ++++ b/include/LibreOfficeKit/LibreOfficeKit.h +@@ -15,6 +15,7 @@ + #ifdef LOK_USE_UNSTABLE_API + // the unstable API needs C99's bool + #include ++#include + #endif + + #include +@@ -62,6 +63,14 @@ struct _LibreOfficeKitClass + + /// @see lok::Office::getFilterTypes(). + char* (*getFilterTypes) (LibreOfficeKit* pThis); ++ ++ /// @see lok::Office::setOptionalFeatures(). ++ void (*setOptionalFeatures)(LibreOfficeKit* pThis, uint64_t features); ++ ++ /// @see lok::Office::setDocumentPassword(). ++ void (*setDocumentPassword) (LibreOfficeKit* pThis, ++ char const* pURL, ++ char const* pPassword); + #endif + }; + +diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx +index e592bbe549ab..53ad4359357a 100644 +--- a/include/LibreOfficeKit/LibreOfficeKit.hxx ++++ b/include/LibreOfficeKit/LibreOfficeKit.hxx +@@ -442,6 +442,40 @@ public: + { + return mpThis->pClass->getFilterTypes(mpThis); + } ++ ++ /** ++ * Set bitmask of optional features supported by the client. ++ * ++ * @see LibreOfficeKitOptionalFeatures ++ */ ++ void setOptionalFeatures(uint64_t features) ++ { ++ return mpThis->pClass->setOptionalFeatures(mpThis, features); ++ } ++ ++ /** ++ * Set password required for loading or editing a document. ++ * ++ * Loading the document is blocked until the password is provided. ++ * ++ * @param pURL the URL of the document, as sent to the callback ++ * @param pPassword the password, nullptr indicates no password ++ * ++ * In response to LOK_CALLBACK_DOCUMENT_PASSWORD, a vaild password ++ * will continue loading the document, an invalid password will ++ * result in another LOK_CALLBACK_DOCUMENT_PASSWORD request, ++ * and a NULL password will abort loading the document. ++ * ++ * In response to LOK_CALLBACK_DOCUMENT_PASSWORD_TO_MODIFY, a vaild ++ * password will continue loading the document, an invalid password will ++ * result in another LOK_CALLBACK_DOCUMENT_PASSWORD_TO_MODIFY request, ++ * and a NULL password will continue loading the document in read-only ++ * mode. ++ */ ++ inline void setDocumentPassword(char const* pURL, char const* pPassword) ++ { ++ mpThis->pClass->setDocumentPassword(mpThis, pURL, pPassword); ++ } + #endif // LOK_USE_UNSTABLE_API + }; + +diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h +index a0f5e886dcac..5931f7871e50 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h ++++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h +@@ -40,6 +40,32 @@ typedef enum + } + LibreOfficeKitTileMode; + ++/** Optional features of LibreOfficeKit, in particular callbacks that block ++ * LibreOfficeKit until the corresponding reply is received, which would ++ * deadlock if the client does not support the feature. ++ * ++ * @see lok::Office::setOptionalFeatures(). ++ */ ++typedef enum ++{ ++ /** ++ * Handle LOK_CALLBACK_DOCUMENT_PASSWORD by prompting the user ++ * for a password. ++ * ++ * @see lok::Office::setDocumentPassword(). ++ */ ++ LOK_FEATURE_DOCUMENT_PASSWORD = (1ULL << 0), ++ ++ /** ++ * Handle LOK_CALLBACK_DOCUMENT_PASSWORD_TO_MODIFY by prompting the user ++ * for a password. ++ * ++ * @see lok::Office::setDocumentPassword(). ++ */ ++ LOK_FEATURE_DOCUMENT_PASSWORD_TO_MODIFY = (1ULL << 1), ++} ++LibreOfficeKitOptionalFeatures; ++ + typedef enum + { + /** +@@ -221,7 +247,24 @@ typedef enum + /** + * The text content of the formula bar in Calc. + */ +- LOK_CALLBACK_CELL_FORMULA ++ LOK_CALLBACK_CELL_FORMULA, ++ ++ /** ++ * Loading a document requires a password. ++ * ++ * Loading the document is blocked until the password is provided via ++ * lok::Office::setDocumentPassword(). The document cannot be loaded ++ * without the password. ++ */ ++ LOK_CALLBACK_DOCUMENT_PASSWORD, ++ ++ /** ++ * Editing a document requires a password. ++ * ++ * Loading the document is blocked until the password is provided via ++ * lok::Office::setDocumentPassword(). ++ */ ++ LOK_CALLBACK_DOCUMENT_PASSWORD_TO_MODIFY, + } + LibreOfficeKitCallbackType; + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 1af678e1acc2..960c8c1f2624 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -804,6 +804,14 @@ globalCallback (gpointer pData) + g_signal_emit (pCallback->m_pDocView, doc_view_signals[LOAD_CHANGED], 0, 1.0); + } + break; ++ case LOK_CALLBACK_DOCUMENT_PASSWORD: ++ case LOK_CALLBACK_DOCUMENT_PASSWORD_TO_MODIFY: ++ { ++ char const*const pURL(pCallback->m_aPayload.c_str()); ++ // TODO maybe allow more passwords ++ priv->m_pOffice->pClass->setDocumentPassword(priv->m_pOffice, pURL, "1"); ++ } ++ break; + default: + g_assert(false); + break; +@@ -2026,6 +2034,8 @@ static gboolean lok_doc_view_initable_init (GInitable *initable, GCancellable* / + return FALSE; + } + ++// priv->m_pOffice->pClass->setOptionalFeatures(priv->m_pOffice, LOK_FEATURE_DOCUMENT_PASSWORD|LOK_FEATURE_DOCUMENT_PASSWORD_TO_MODIFY); ++ + return TRUE; + } + +-- +2.12.0 + diff --git a/SOURCES/0390-libreofficekit-fix-inverted-condition.patch b/SOURCES/0390-libreofficekit-fix-inverted-condition.patch new file mode 100644 index 0000000..dc9a6ef --- /dev/null +++ b/SOURCES/0390-libreofficekit-fix-inverted-condition.patch @@ -0,0 +1,62 @@ +From 1404902fec558c589f17d757192548e009acdfc1 Mon Sep 17 00:00:00 2001 +From: Michael Stahl +Date: Mon, 1 Feb 2016 12:31:32 +0100 +Subject: [PATCH 390/398] libreofficekit: fix inverted condition +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +... that prevented loading the same URL multiple times. Also make this +exception-safe while at it. + +(cherry picked from commit 61e80cd9e3e425674e18221237b8b0574645f377) + +Change-Id: Ic71735fef1ad8f79a210279d4d03f1fd5fa8cf69 +Reviewed-on: https://gerrit.libreoffice.org/22001 +Tested-by: Jenkins +Reviewed-by: Caolán McNamara +Tested-by: Caolán McNamara +(cherry picked from commit 24c3426d07f5b8fcd19da6f4bc3ee7dd56758ab1) +--- + desktop/source/lib/init.cxx | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 35ba91306036..fe297fb09414 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -32,6 +32,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -531,6 +532,12 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions(LibreOfficeKit* pThis, + rtl::Reference const pInteraction( + new LOKInteractionHandler(::comphelper::getProcessComponentContext(), pLib)); + auto const pair(pLib->mInteractionMap.insert(std::make_pair(aURL.toUtf8(), pInteraction))); ++ comphelper::ScopeGuard const g([&] () { ++ if (pair.second) ++ { ++ pLib->mInteractionMap.erase(aURL.toUtf8()); ++ } ++ }); + uno::Reference const xInteraction(pInteraction.get()); + aFilterOptions[1].Name = "InteractionHandler"; + aFilterOptions[1].Value <<= xInteraction; +@@ -551,10 +558,6 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions(LibreOfficeKit* pThis, + aFilterOptions); + + assert(!xComponent.is() || pair.second); // concurrent loading of same URL ought to fail +- if (!pair.second) +- { +- pLib->mInteractionMap.erase(aURL.toUtf8()); +- } + + if (!xComponent.is()) + { +-- +2.12.0 + diff --git a/SOURCES/0391-Missing-include.patch b/SOURCES/0391-Missing-include.patch new file mode 100644 index 0000000..7f84315 --- /dev/null +++ b/SOURCES/0391-Missing-include.patch @@ -0,0 +1,27 @@ +From 2ae4679d0324522442a87fd11c68e4a0cd44c3ab Mon Sep 17 00:00:00 2001 +From: Stephan Bergmann +Date: Thu, 28 Jan 2016 15:47:41 +0100 +Subject: [PATCH 391/398] Missing include + +Change-Id: I4930837c2a5bd78c16a83dcccde34843d3026618 +(cherry picked from commit 63cada47911029cce512f3b8ac0b6a6d2c323032) +(cherry picked from commit 201793cb2c204475422cd0ee86f4065f03e4b9be) +--- + libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index e867e1b239a7..a21daf199fa7 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -11,6 +11,7 @@ + #include + #include + #include ++#include + #include + #include + #include +-- +2.12.0 + diff --git a/SOURCES/0392-lokdocview-Handle-password-protected-documents.patch b/SOURCES/0392-lokdocview-Handle-password-protected-documents.patch new file mode 100644 index 0000000..3cfceb0 --- /dev/null +++ b/SOURCES/0392-lokdocview-Handle-password-protected-documents.patch @@ -0,0 +1,342 @@ +From fe80bd09aa8bbe1e190d91c7f85c2a8b977c1dd1 Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Wed, 27 Jan 2016 16:56:14 +0530 +Subject: [PATCH 392/398] lokdocview: Handle password protected documents +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Reviewed-on: https://gerrit.libreoffice.org/21861 +Tested-by: Jenkins +Reviewed-by: Caolán McNamara +Tested-by: Caolán McNamara +(cherry picked from commit 18fbddcca569c109ca2f46f7d791187e672d4d83) +Signed-off-by: Michael Stahl + +Change-Id: I606a1112c8eb4c1cc4596d6947ce1223543cc87c +(cherry picked from commit 89a3c1b4d69aac447606dc6f0e661b2ef4dddc8c) +--- + include/LibreOfficeKit/LibreOfficeKitGtk.h | 12 +++ + .../qa/gtktiledviewer/gtktiledviewer.cxx | 50 ++++++++++ + libreofficekit/source/gtk/lokdocview.cxx | 109 ++++++++++++++++++++- + 3 files changed, 166 insertions(+), 5 deletions(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h +index e06d154f772e..1df27c106214 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h ++++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h +@@ -275,6 +275,18 @@ gboolean lok_doc_view_paste (LOKDocView* + gsize nSize); + + /** ++ * lok_doc_view_set_document_password: ++ * @pDocView: The #LOKDocView instance ++ * @pUrl: the URL of the document to set password for, as sent with signal `password-required` ++ * @pPassword: (nullable): the password, NULL for no password ++ * ++ * Set the password for password protected documents ++ */ ++void lok_doc_view_set_document_password (LOKDocView* pDocView, ++ const gchar* pURL, ++ const gchar* pPassword); ++ ++/** + * lok_doc_view_pixel_to_twip: + * @pDocView: The #LOKDocView instance + * @fInput: The value in pixels to convert to twips +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index a21daf199fa7..3dc9f246f18e 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -462,10 +462,20 @@ static void toggleFindbar(GtkWidget* pButton, gpointer /*pItem*/) + } + } + ++static void ++setLOKFeatures (GtkWidget* pDocView) ++{ ++ g_object_set(G_OBJECT(pDocView), ++ "doc-password", TRUE, ++ "doc-password-to-modify", TRUE, ++ nullptr); ++} ++ + /// Common initialization, regardless if it's just a new view or a full init. + static TiledWindow& setupWidgetAndCreateWindow(GtkWidget* pDocView) + { + setupDocView(pDocView); ++ setLOKFeatures(pDocView); + TiledWindow aWindow; + aWindow.m_pDocView = pDocView; + GtkWidget* pWindow = createWindow(aWindow); +@@ -797,6 +807,45 @@ static void formulaChanged(LOKDocView* pLOKDocView, char* pPayload, gpointer /*p + gtk_entry_set_text(GTK_ENTRY(rWindow.m_pFormulabarEntry), pPayload); + } + ++/// LOKDocView password is requried to open the document ++static void passwordRequired(LOKDocView* pLOKDocView, gchar* pUrl, gboolean bModify, gpointer /*pData*/) ++{ ++ GtkWidget* pPasswordDialog = gtk_dialog_new_with_buttons ("Password required", ++ GTK_WINDOW (gtk_widget_get_toplevel(GTK_WIDGET(pLOKDocView))), ++ GTK_DIALOG_MODAL, ++ "OK", ++ GTK_RESPONSE_OK, ++ nullptr); ++ g_object_set(G_OBJECT(pPasswordDialog), "resizable", FALSE, nullptr); ++ GtkWidget* pDialogMessageArea = gtk_dialog_get_content_area (GTK_DIALOG (pPasswordDialog)); ++ GtkWidget* pPasswordEntry = gtk_entry_new (); ++ gtk_entry_set_visibility (GTK_ENTRY(pPasswordEntry), FALSE); ++ gtk_entry_set_invisible_char (GTK_ENTRY(pPasswordEntry), '*'); ++ gtk_box_pack_end(GTK_BOX(pDialogMessageArea), pPasswordEntry, TRUE, TRUE, 2); ++ if (bModify) ++ { ++ GtkWidget* pSecondaryLabel = gtk_label_new ("Document requires password to edit"); ++ gtk_box_pack_end(GTK_BOX(pDialogMessageArea), pSecondaryLabel, TRUE, TRUE, 2); ++ gtk_dialog_add_button (GTK_DIALOG (pPasswordDialog), "Open as read-only", GTK_RESPONSE_ACCEPT); ++ } ++ gtk_widget_show_all(pPasswordDialog); ++ ++ gint res = gtk_dialog_run (GTK_DIALOG(pPasswordDialog)); ++ switch (res) ++ { ++ case GTK_RESPONSE_OK: ++ lok_doc_view_set_document_password (pLOKDocView, pUrl, gtk_entry_get_text(GTK_ENTRY(pPasswordEntry))); ++ break; ++ case GTK_RESPONSE_ACCEPT: ++ // User accepts to open this document as read-only ++ case GTK_RESPONSE_DELETE_EVENT: ++ lok_doc_view_set_document_password (pLOKDocView, pUrl, nullptr); ++ break; ++ } ++ ++ gtk_widget_destroy(pPasswordDialog); ++} ++ + static void toggleToolItem(GtkWidget* pWidget, gpointer /*pData*/) + { + TiledWindow& rWindow = lcl_getTiledWindow(pWidget); +@@ -1254,6 +1303,7 @@ static void setupDocView(GtkWidget* pDocView) + g_signal_connect(pDocView, "hyperlink-clicked", G_CALLBACK(signalHyperlink), NULL); + g_signal_connect(pDocView, "cursor-changed", G_CALLBACK(cursorChanged), NULL); + g_signal_connect(pDocView, "formula-changed", G_CALLBACK(formulaChanged), NULL); ++ g_signal_connect(pDocView, "password-required", G_CALLBACK(passwordRequired), nullptr); + } + + int main( int argc, char* argv[] ) +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 960c8c1f2624..f0dd7342c1a3 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -65,6 +65,8 @@ struct LOKDocViewPrivateImpl + glong m_nDocumentHeightTwips; + /// View or edit mode. + gboolean m_bEdit; ++ /// LOK Features ++ guint64 m_nLOKFeatures; + /// Position and size of the visible cursor. + GdkRectangle m_aVisibleCursor; + /// Cursor overlay is visible or hidden (for blinking). +@@ -138,6 +140,7 @@ struct LOKDocViewPrivateImpl + m_nDocumentWidthTwips(0), + m_nDocumentHeightTwips(0), + m_bEdit(FALSE), ++ m_nLOKFeatures(0), + m_aVisibleCursor({0, 0, 0, 0}), + m_bCursorOverlayVisible(false), + m_bCursorVisible(true), +@@ -192,6 +195,7 @@ enum + COMMAND_RESULT, + FORMULA_CHANGED, + TEXT_SELECTION, ++ PASSWORD_REQUIRED, + + LAST_SIGNAL + }; +@@ -212,6 +216,8 @@ enum + PROP_DOC_HEIGHT, + PROP_CAN_ZOOM_IN, + PROP_CAN_ZOOM_OUT, ++ PROP_DOC_PASSWORD, ++ PROP_DOC_PASSWORD_TO_MODIFY, + + PROP_LAST + }; +@@ -311,6 +317,10 @@ callbackTypeToString (int nType) + return "LOK_CALLBACK_SET_PART"; + case LOK_CALLBACK_SEARCH_RESULT_SELECTION: + return "LOK_CALLBACK_SEARCH_RESULT_SELECTION"; ++ case LOK_CALLBACK_DOCUMENT_PASSWORD: ++ return "LOK_CALLBACK_DOCUMENT_PASSWORD"; ++ case LOK_CALLBACK_DOCUMENT_PASSWORD_TO_MODIFY: ++ return "LOK_CALLBACK_DOCUMENT_PASSWORD_TO_MODIFY"; + } + return nullptr; + } +@@ -783,6 +793,7 @@ globalCallback (gpointer pData) + { + CallbackData* pCallback = static_cast(pData); + LOKDocViewPrivate& priv = getPrivate(pCallback->m_pDocView); ++ gboolean bModify = false; + + switch (pCallback->m_nType) + { +@@ -804,12 +815,12 @@ globalCallback (gpointer pData) + g_signal_emit (pCallback->m_pDocView, doc_view_signals[LOAD_CHANGED], 0, 1.0); + } + break; +- case LOK_CALLBACK_DOCUMENT_PASSWORD: + case LOK_CALLBACK_DOCUMENT_PASSWORD_TO_MODIFY: ++ bModify = true; ++ case LOK_CALLBACK_DOCUMENT_PASSWORD: + { + char const*const pURL(pCallback->m_aPayload.c_str()); +- // TODO maybe allow more passwords +- priv->m_pOffice->pClass->setDocumentPassword(priv->m_pOffice, pURL, "1"); ++ g_signal_emit (pCallback->m_pDocView, doc_view_signals[PASSWORD_REQUIRED], 0, pURL, bModify); + } + break; + default: +@@ -1910,6 +1921,8 @@ static void lok_doc_view_set_property (GObject* object, guint propId, const GVal + { + LOKDocView* pDocView = LOK_DOC_VIEW (object); + LOKDocViewPrivate& priv = getPrivate(pDocView); ++ gboolean bDocPasswordEnabled = priv->m_nLOKFeatures & LOK_FEATURE_DOCUMENT_PASSWORD; ++ gboolean bDocPasswordToModifyEnabled = priv->m_nLOKFeatures & LOK_FEATURE_DOCUMENT_PASSWORD_TO_MODIFY; + + switch (propId) + { +@@ -1937,6 +1950,20 @@ static void lok_doc_view_set_property (GObject* object, guint propId, const GVal + case PROP_DOC_HEIGHT: + priv->m_nDocumentHeightTwips = g_value_get_long (value); + break; ++ case PROP_DOC_PASSWORD: ++ if (g_value_get_boolean (value) != bDocPasswordEnabled) ++ { ++ priv->m_nLOKFeatures = priv->m_nLOKFeatures ^ LOK_FEATURE_DOCUMENT_PASSWORD; ++ priv->m_pOffice->pClass->setOptionalFeatures(priv->m_pOffice, priv->m_nLOKFeatures); ++ } ++ break; ++ case PROP_DOC_PASSWORD_TO_MODIFY: ++ if ( g_value_get_boolean (value) != bDocPasswordToModifyEnabled) ++ { ++ priv->m_nLOKFeatures = priv->m_nLOKFeatures ^ LOK_FEATURE_DOCUMENT_PASSWORD_TO_MODIFY; ++ priv->m_pOffice->pClass->setOptionalFeatures(priv->m_pOffice, priv->m_nLOKFeatures); ++ } ++ break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, propId, pspec); + } +@@ -1985,6 +2012,12 @@ static void lok_doc_view_get_property (GObject* object, guint propId, GValue *va + case PROP_CAN_ZOOM_OUT: + g_value_set_boolean (value, priv->m_bCanZoomOut); + break; ++ case PROP_DOC_PASSWORD: ++ g_value_set_boolean (value, priv->m_nLOKFeatures & LOK_FEATURE_DOCUMENT_PASSWORD); ++ break; ++ case PROP_DOC_PASSWORD_TO_MODIFY: ++ g_value_set_boolean (value, priv->m_nLOKFeatures & LOK_FEATURE_DOCUMENT_PASSWORD_TO_MODIFY); ++ break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, propId, pspec); + } +@@ -2034,8 +2067,6 @@ static gboolean lok_doc_view_initable_init (GInitable *initable, GCancellable* / + return FALSE; + } + +-// priv->m_pOffice->pClass->setOptionalFeatures(priv->m_pOffice, LOK_FEATURE_DOCUMENT_PASSWORD|LOK_FEATURE_DOCUMENT_PASSWORD_TO_MODIFY); +- + return TRUE; + } + +@@ -2223,6 +2254,33 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + static_cast(G_PARAM_READABLE + | G_PARAM_STATIC_STRINGS)); + ++ /** ++ * LOKDocView:doc-password: ++ * ++ * Set it to true if client supports providing password for viewing ++ * password protected documents ++ */ ++ properties[PROP_DOC_PASSWORD] = ++ g_param_spec_boolean("doc-password", ++ "Document password capability", ++ "Whether client supports providing document passwords", ++ FALSE, ++ static_cast(G_PARAM_READWRITE ++ | G_PARAM_STATIC_STRINGS)); ++ ++ /** ++ * LOKDocView:doc-password-to-modify: ++ * ++ * Set it to true if client supports providing password for edit-protected documents ++ */ ++ properties[PROP_DOC_PASSWORD_TO_MODIFY] = ++ g_param_spec_boolean("doc-password-to-modify", ++ "Edit document password capability", ++ "Whether the client supports providing passwords to edit documents", ++ FALSE, ++ static_cast(G_PARAM_READWRITE ++ | G_PARAM_STATIC_STRINGS)); ++ + g_object_class_install_properties(pGObjectClass, PROP_LAST, properties); + + /** +@@ -2409,6 +2467,37 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + g_cclosure_marshal_VOID__BOOLEAN, + G_TYPE_NONE, 1, + G_TYPE_BOOLEAN); ++ ++ /** ++ * LOKDocView::password-required: ++ * @pDocView: the #LOKDocView on which the signal is emitted ++ * @pUrl: URL of the document for which password is required ++ * @bModify: whether password id required to modify the document ++ * This is true when password is required to edit the document, ++ * while it can still be viewed without password. In such cases, provide a NULL ++ * password for read-only access to the document. ++ * If false, password is required for opening the document, and document ++ * cannot be opened without providing a valid password. ++ * ++ * Password must be provided by calling lok_doc_view_set_document_password ++ * function with pUrl as provided by the callback. ++ * ++ * Upon entering a invalid password, another `password-required` signal is ++ * emitted. ++ * Upon entering a valid password, document starts to load. ++ * Upon entering a NULL password: if bModify is %TRUE, document starts to ++ * open in view-only mode, else loading of document is aborted. ++ */ ++ doc_view_signals[PASSWORD_REQUIRED] = ++ g_signal_new("password-required", ++ G_TYPE_FROM_CLASS(pGObjectClass), ++ G_SIGNAL_RUN_FIRST, ++ 0, ++ nullptr, nullptr, ++ g_cclosure_marshal_generic, ++ G_TYPE_NONE, 2, ++ G_TYPE_STRING, ++ G_TYPE_BOOLEAN); + } + + SAL_DLLPUBLIC_EXPORT GtkWidget* +@@ -2786,6 +2875,16 @@ lok_doc_view_paste (LOKDocView* pDocView, + return ret; + } + ++SAL_DLLPUBLIC_EXPORT void ++lok_doc_view_set_document_password (LOKDocView* pDocView, ++ const gchar* pURL, ++ const gchar* pPassword) ++{ ++ LOKDocViewPrivate& priv = getPrivate(pDocView); ++ ++ priv->m_pOffice->pClass->setDocumentPassword(priv->m_pOffice, pURL, pPassword); ++} ++ + SAL_DLLPUBLIC_EXPORT gfloat + lok_doc_view_pixel_to_twip (LOKDocView* pDocView, float fInput) + { +-- +2.12.0 + diff --git a/SOURCES/0393-lok-fix-saveAs-for-a-loaded-HTML-document.patch b/SOURCES/0393-lok-fix-saveAs-for-a-loaded-HTML-document.patch new file mode 100644 index 0000000..5a737df --- /dev/null +++ b/SOURCES/0393-lok-fix-saveAs-for-a-loaded-HTML-document.patch @@ -0,0 +1,43 @@ +From ed0cf5fe7f448b471a6627b045e2ea3df464e83f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Toma=C5=BE=20Vajngerl?= +Date: Thu, 4 Feb 2016 14:44:36 +0100 +Subject: [PATCH 393/398] lok: fix saveAs for a loaded HTML document + +a HTML document is reported as "com.sun.star.text.WebDocument" +which is a unsupported document type in LOK so report it as a +LOK_DOCTYPE_TEXT instead. + +Change-Id: Iaa77cb8b1f55cf31ebbb4fd4d69c02702e60e251 +(cherry picked from commit 806d34981f480908645038f4cfc29ebcf25ca145) +Reviewed-on: https://gerrit.libreoffice.org/22119 +Tested-by: Jenkins +Reviewed-by: Miklos Vajna +(cherry picked from commit 1deed8dae78be05cafde17768d111035c111b567) +--- + desktop/source/lib/init.cxx | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index fe297fb09414..9e5c52917eb7 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -621,6 +621,7 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha + break; + case LOK_DOCTYPE_OTHER: + default: ++ SAL_INFO("lok", "Can't save document - unsopported document type."); + return false; + } + +@@ -756,7 +757,7 @@ static int doc_getDocumentType (LibreOfficeKitDocument* pThis) + { + return LOK_DOCTYPE_DRAWING; + } +- else if (xDocument->supportsService("com.sun.star.text.TextDocument")) ++ else if (xDocument->supportsService("com.sun.star.text.TextDocument") || xDocument->supportsService("com.sun.star.text.WebDocument")) + { + return LOK_DOCTYPE_TEXT; + } +-- +2.12.0 + diff --git a/SOURCES/0394-lokdocview-Center-the-widget-vertically-inside-the-a.patch b/SOURCES/0394-lokdocview-Center-the-widget-vertically-inside-the-a.patch new file mode 100644 index 0000000..a55f07b --- /dev/null +++ b/SOURCES/0394-lokdocview-Center-the-widget-vertically-inside-the-a.patch @@ -0,0 +1,38 @@ +From 8b9d23f92cc6b9efef313ea155958e48d1a3faef Mon Sep 17 00:00:00 2001 +From: Pranav Kant +Date: Sun, 14 Feb 2016 20:44:00 +0530 +Subject: [PATCH 394/398] lokdocview: Center the widget vertically inside the + allocation + +Change-Id: I891519d54212ecd99273a54aca2a44e2d54c1933 +Reviewed-on: https://gerrit.libreoffice.org/22517 +Tested-by: Jenkins +Reviewed-by: Miklos Vajna +(cherry picked from commit bcaee2b0149651173cc93763231c47ff2f5a55c2) +--- + libreofficekit/source/gtk/lokdocview.cxx | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index f0dd7342c1a3..9f47138bbc37 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -2506,6 +2506,7 @@ lok_doc_view_new (const gchar* pPath, GCancellable *cancellable, GError **error) + return GTK_WIDGET (g_initable_new (LOK_TYPE_DOC_VIEW, cancellable, error, + "lopath", pPath == nullptr ? LOK_PATH : pPath, + "halign", GTK_ALIGN_CENTER, ++ "valign", GTK_ALIGN_CENTER, + nullptr)); + } + +@@ -2517,6 +2518,7 @@ SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new_from_widget(LOKDocView* pOldLOK + "lopointer", pOldPriv->m_pOffice, + "docpointer", pOldPriv->m_pDocument, + "halign", GTK_ALIGN_CENTER, ++ "valign", GTK_ALIGN_CENTER, + nullptr)); + + // No documentLoad(), just a createView(). +-- +2.12.0 + diff --git a/SOURCES/0395-WaE-buggy-warning-in-vs2015-r1.patch b/SOURCES/0395-WaE-buggy-warning-in-vs2015-r1.patch new file mode 100644 index 0000000..e37d8f2 --- /dev/null +++ b/SOURCES/0395-WaE-buggy-warning-in-vs2015-r1.patch @@ -0,0 +1,46 @@ +From e30be4212a631189bdfb68e3a72e2f80ae0a6f75 Mon Sep 17 00:00:00 2001 +From: Norbert Thiebaud +Date: Sun, 21 Feb 2016 08:27:05 -0800 +Subject: [PATCH 395/398] WaE buggy warning in vs2015-r1 + +http://stackoverflow.com/questions/34013930/error-c4592-symbol-will-be-dynamically-initialized-vs2015-1-static-const-std + +Change-Id: Icbe882ad237d1e4f105006d8821ed5c89b06f525 +Reviewed-on: https://gerrit.libreoffice.org/22601 +Reviewed-by: Michael Stahl +Tested-by: Michael Stahl +(cherry picked from commit e895f1979ebf82cbab9739356ce97fc937efbdd0) +Signed-off-by: Michael Stahl +(cherry picked from commit c344820237efee7c3c7309a9f30ff8739aa8b5b4) +--- + desktop/source/lib/init.cxx | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx +index 9e5c52917eb7..184d7772ffc9 100644 +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -186,6 +186,10 @@ static const ExtensionMap aDrawExtensionMap[] = + * by css, it might turn out to be worth mapping some of these missing cursors + * to available cursors? + */ ++#ifdef _MSC_VER ++#pragma warning(push) ++#pragma warning( disable : 4592) ++#endif + static const std::map aPointerMap { + { PointerStyle::Arrow, "default" }, + // PointerStyle::Null ? +@@ -228,6 +232,9 @@ static const std::map aPointerMap { + // Pivot Delete, TabSelectS through TabSelectSW + // PaintBrush, HideWhiteSpace, ShowWhiteSpace + }; ++#ifdef _MSC_VER ++#pragma warning(pop) ++#endif + + static OUString getUString(const char* pString) + { +-- +2.12.0 + diff --git a/SOURCES/0396-gtktiledviewer-needs-gtk3-not-gtk2.patch b/SOURCES/0396-gtktiledviewer-needs-gtk3-not-gtk2.patch new file mode 100644 index 0000000..8204dbd --- /dev/null +++ b/SOURCES/0396-gtktiledviewer-needs-gtk3-not-gtk2.patch @@ -0,0 +1,38 @@ +From 91e8213dde243c9acf18ffe2bcdce489d0fcbd8b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= +Date: Mon, 7 Mar 2016 13:19:55 +0000 +Subject: [PATCH 396/398] gtktiledviewer needs gtk3 not gtk2 + +Change-Id: Iede2008139cb570ff65202762e92f6694548a065 +(cherry picked from commit e451b03e8c21ad23cb1abfd6dd68b6d1e8188121) +Reviewed-on: https://gerrit.libreoffice.org/22982 +Tested-by: Jenkins +Reviewed-by: Adolfo Jayme Barrientos +(cherry picked from commit 13ee59bf851b60a50d679a153641343206d58474) +--- + Repository.mk | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Repository.mk b/Repository.mk +index dd0afca39b7a..fad426921935 100644 +--- a/Repository.mk ++++ b/Repository.mk +@@ -67,13 +67,13 @@ $(eval $(call gb_Helper_register_executables,NONE, \ + svptest \ + svpclient \ + pixelctl ) \ +- $(if $(and $(ENABLE_GTK), $(filter LINUX %BSD SOLARIS,$(OS))), tilebench) \ ++ $(if $(and $(ENABLE_GTK3), $(filter LINUX %BSD SOLARIS,$(OS))), tilebench) \ + $(if $(filter LINUX MACOSX SOLARIS WNT %BSD,$(OS)),icontest \ + outdevgrind) \ + vcldemo \ + tiledrendering \ + mtfdemo \ +- $(if $(and $(ENABLE_GTK), $(filter LINUX %BSD SOLARIS,$(OS))), gtktiledviewer) \ ++ $(if $(and $(ENABLE_GTK3), $(filter LINUX %BSD SOLARIS,$(OS))), gtktiledviewer) \ + )) + + $(eval $(call gb_Helper_register_executables_for_install,SDK,sdk, \ +-- +2.12.0 + diff --git a/SOURCES/0397-tdf-99314-lokdocview-add-new-userprofileurl-property.patch b/SOURCES/0397-tdf-99314-lokdocview-add-new-userprofileurl-property.patch new file mode 100644 index 0000000..247fe7f --- /dev/null +++ b/SOURCES/0397-tdf-99314-lokdocview-add-new-userprofileurl-property.patch @@ -0,0 +1,191 @@ +From 4b8ba14da9d58594e16c317682897f195349a40c Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Tue, 19 Apr 2016 09:09:19 +0200 +Subject: [PATCH 397/398] tdf#99314 lokdocview: add new userprofileurl property +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +So that users of the widget can use a custom user profile, allowing +running widgets users and LibreOffice in parallel. + +(cherry picked from commit df784ec1bf3d1745a291056df28bec799d4fdee3) + +Conflicts: + libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx + +Change-Id: I1bd0a8e53aa3216adc721052cf30f0dd174327bd +Reviewed-on: https://gerrit.libreoffice.org/24591 +Tested-by: Jenkins +Reviewed-by: Caolán McNamara +Tested-by: Caolán McNamara +(cherry picked from commit 549f67a85774838abdefdb7916beb0f26e2f9d2c) +--- + include/LibreOfficeKit/LibreOfficeKitGtk.h | 17 ++++++++++ + .../qa/gtktiledviewer/gtktiledviewer.cxx | 12 +++++-- + libreofficekit/source/gtk/lokdocview.cxx | 37 +++++++++++++++++++++- + 3 files changed, 63 insertions(+), 3 deletions(-) + +diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h +index 1df27c106214..91e29c83db57 100644 +--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h ++++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h +@@ -55,6 +55,23 @@ GtkWidget* lok_doc_view_new (const gchar* + GError **error); + + /** ++ * lok_doc_view_new_from_user_profile: ++ * @pPath: (nullable): LibreOffice install path. Pass null to set it to default ++ * path which in most cases would be $libdir/libreoffice/program ++ * @pUserProfile: (nullable): User profile URL. Pass non-null to be able to ++ * use this widget and LibreOffice itself in parallel. ++ * @cancellable: The cancellable object that you can use to cancel this ++ * operation. ++ * @error: The error that will be set if the object fails to initialize. ++ * ++ * Returns: (transfer none): The #LOKDocView widget instance. ++ */ ++GtkWidget* lok_doc_view_new_from_user_profile (const gchar* pPath, ++ const gchar* pUserProfile, ++ GCancellable *cancellable, ++ GError **error); ++ ++/** + * lok_doc_view_new_from_widget: + * @pDocView: The #LOKDocView instance + * +diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +index 3dc9f246f18e..54c9294e5398 100644 +--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx ++++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +@@ -35,7 +35,7 @@ static int help() + fprintf(stderr, "Usage: gtktiledviewer [ ... ]\n\n"); + fprintf(stderr, "Options:\n\n"); + fprintf(stderr, "--hide-whitespace: Hide whitespace between pages in text documents.\n"); +- fprintf(stderr, "--background-color : Set custom background color, e.g. 'yellow'.\n"); ++ fprintf(stderr, "--user-profile: Path to a custom user profile.\n"); + return 1; + } + +@@ -497,7 +497,15 @@ static void createView(GtkWidget* pButton, gpointer /*pItem*/) + /// Creates a new model, i.e. LOK init and document load, one view implicitly. + static void createModelAndView(const char* pLOPath, const char* pDocPath, const std::vector& rArguments) + { +- GtkWidget* pDocView = lok_doc_view_new(pLOPath, nullptr, nullptr); ++ std::string aUserProfile; ++ for (size_t i = 0; i < rArguments.size(); ++i) ++ { ++ const std::string& rArgument = rArguments[i]; ++ if (rArgument == "--user-profile" && i + 1 < rArguments.size()) ++ aUserProfile = std::string("file://") + rArguments[i + 1].c_str(); ++ } ++ const gchar* pUserProfile = aUserProfile.empty() ? nullptr : aUserProfile.c_str(); ++ GtkWidget* pDocView = lok_doc_view_new_from_user_profile(pLOPath, pUserProfile, nullptr, nullptr); + + setupWidgetAndCreateWindow(pDocView); + +diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx +index 9f47138bbc37..13ae6ea00e63 100644 +--- a/libreofficekit/source/gtk/lokdocview.cxx ++++ b/libreofficekit/source/gtk/lokdocview.cxx +@@ -48,6 +48,7 @@ + struct LOKDocViewPrivateImpl + { + const gchar* m_aLOPath; ++ const gchar* m_pUserProfileURL; + const gchar* m_aDocPath; + std::string m_aRenderingArguments; + gdouble m_nLoadProgress; +@@ -128,6 +129,7 @@ struct LOKDocViewPrivateImpl + + LOKDocViewPrivateImpl() + : m_aLOPath(nullptr), ++ m_pUserProfileURL(nullptr), + m_aDocPath(nullptr), + m_nLoadProgress(0), + m_bIsLoading(false), +@@ -206,6 +208,7 @@ enum + + PROP_LO_PATH, + PROP_LO_POINTER, ++ PROP_USER_PROFILE_URL, + PROP_DOC_PATH, + PROP_DOC_POINTER, + PROP_EDITABLE, +@@ -1932,6 +1935,9 @@ static void lok_doc_view_set_property (GObject* object, guint propId, const GVal + case PROP_LO_POINTER: + priv->m_pOffice = static_cast(g_value_get_pointer(value)); + break; ++ case PROP_USER_PROFILE_URL: ++ priv->m_pUserProfileURL = g_value_dup_string(value); ++ break; + case PROP_DOC_PATH: + priv->m_aDocPath = g_value_dup_string (value); + break; +@@ -1982,6 +1988,9 @@ static void lok_doc_view_get_property (GObject* object, guint propId, GValue *va + case PROP_LO_POINTER: + g_value_set_pointer(value, priv->m_pOffice); + break; ++ case PROP_USER_PROFILE_URL: ++ g_value_set_string(value, priv->m_pUserProfileURL); ++ break; + case PROP_DOC_PATH: + g_value_set_string (value, priv->m_aDocPath); + break; +@@ -2056,7 +2065,7 @@ static gboolean lok_doc_view_initable_init (GInitable *initable, GCancellable* / + if (priv->m_pOffice != nullptr) + return TRUE; + +- priv->m_pOffice = lok_init (priv->m_aLOPath); ++ priv->m_pOffice = lok_init_2(priv->m_aLOPath, priv->m_pUserProfileURL); + + if (priv->m_pOffice == nullptr) + { +@@ -2120,6 +2129,20 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) + G_PARAM_STATIC_STRINGS)); + + /** ++ * LOKDocView:userprofileurl: ++ * ++ * The absolute path of the LibreOffice user profile. ++ */ ++ properties[PROP_USER_PROFILE_URL] = ++ g_param_spec_string("userprofileurl", ++ "User profile path", ++ "LibreOffice user profile path", ++ nullptr, ++ static_cast(G_PARAM_READWRITE | ++ G_PARAM_CONSTRUCT_ONLY | ++ G_PARAM_STATIC_STRINGS)); ++ ++ /** + * LOKDocView:docpath: + * + * The path of the document that is currently being viewed. +@@ -2510,11 +2533,23 @@ lok_doc_view_new (const gchar* pPath, GCancellable *cancellable, GError **error) + nullptr)); + } + ++SAL_DLLPUBLIC_EXPORT GtkWidget* ++lok_doc_view_new_from_user_profile (const gchar* pPath, const gchar* pUserProfile, GCancellable *cancellable, GError **error) ++{ ++ return GTK_WIDGET(g_initable_new(LOK_TYPE_DOC_VIEW, cancellable, error, ++ "lopath", pPath == nullptr ? LOK_PATH : pPath, ++ "userprofileurl", pUserProfile, ++ "halign", GTK_ALIGN_CENTER, ++ "valign", GTK_ALIGN_CENTER, ++ nullptr)); ++} ++ + SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new_from_widget(LOKDocView* pOldLOKDocView) + { + LOKDocViewPrivate& pOldPriv = getPrivate(pOldLOKDocView); + GtkWidget* pNewDocView = GTK_WIDGET(g_initable_new(LOK_TYPE_DOC_VIEW, /*cancellable=*/nullptr, /*error=*/nullptr, + "lopath", pOldPriv->m_aLOPath, ++ "userprofileurl", pOldPriv->m_pUserProfileURL, + "lopointer", pOldPriv->m_pOffice, + "docpointer", pOldPriv->m_pDocument, + "halign", GTK_ALIGN_CENTER, +-- +2.12.0 + diff --git a/SOURCES/0398-fix-build.patch b/SOURCES/0398-fix-build.patch new file mode 100644 index 0000000..da20034 --- /dev/null +++ b/SOURCES/0398-fix-build.patch @@ -0,0 +1,46 @@ +From d46c13839afcc2998c2b0d61058f86799b358798 Mon Sep 17 00:00:00 2001 +From: David Tardon +Date: Mon, 20 Mar 2017 21:26:13 +0100 +Subject: [PATCH 398/398] fix build + +Change-Id: I571029ffef0e7f426458197a4bbfcddc473f79dd +--- + desktop/inc/lib/init.hxx | 4 ++-- + desktop/qa/desktop_lib/test_desktop_lib.cxx | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/desktop/inc/lib/init.hxx b/desktop/inc/lib/init.hxx +index 560bd06c6cd9..3f1fd67d7ad7 100644 +--- a/desktop/inc/lib/init.hxx ++++ b/desktop/inc/lib/init.hxx +@@ -21,12 +21,12 @@ class LOKInteractionHandler; + namespace desktop { + struct DESKTOP_DLLPUBLIC LibLODocument_Impl : public _LibreOfficeKitDocument + { +- uno::Reference mxComponent; ++ css::uno::Reference mxComponent; + std::shared_ptr< LibreOfficeKitDocumentClass > m_pDocumentClass; + LibreOfficeKitCallback mpCallback; + void *mpCallbackData; + +- explicit LibLODocument_Impl(const uno::Reference &xComponent); ++ explicit LibLODocument_Impl(const css::uno::Reference &xComponent); + ~LibLODocument_Impl(); + }; + +diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx +index 4b08f9448f61..cb0bf721a4a5 100644 +--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx ++++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx +@@ -512,7 +512,7 @@ void DesktopLOKTest::testWriterComments() + TimeValue aTimeValue = {2 , 0}; // 2 seconds max + m_aCommandResultCondition.reset(); + pDocument->pClass->postUnoCommand(pDocument, ".uno:InsertAnnotation", nullptr, true); +- m_aCommandResultCondition.wait(aTimeValue); ++ m_aCommandResultCondition.wait(&aTimeValue); + CPPUNIT_ASSERT(!m_aCommandResult.isEmpty()); + xToolkit->reschedule(); + +-- +2.12.0 + diff --git a/SPECS/libreoffice.spec b/SPECS/libreoffice.spec index 87cb111..af55d26 100644 --- a/SPECS/libreoffice.spec +++ b/SPECS/libreoffice.spec @@ -29,6 +29,7 @@ # default for f23 onwards %global _hardened_build 1 %endif +%global girapiversion 0.1 # get english only and no-langpacks for a faster smoketest build # fedpkg compile/install/local/mockbuild does not handle --without ATM, @@ -52,7 +53,7 @@ Summary: Free Software Productivity Suite Name: libreoffice Epoch: 1 Version: %{libo_version}.2 -Release: 5%{?libo_prerelease}%{?dist}.1 +Release: 14%{?libo_prerelease}%{?dist} License: (MPLv1.1 or LGPLv3+) and LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and Public Domain and ASL 2.0 and Artistic and MPLv2.0 and CC0 Group: Applications/Productivity URL: http://www.libreoffice.org/ @@ -137,10 +138,12 @@ BuildRequires: pkgconfig(freetype2) BuildRequires: pkgconfig(gconf-2.0) BuildRequires: pkgconfig(glew) >= 1.10.0 BuildRequires: pkgconfig(glu) +BuildRequires: pkgconfig(gobject-introspection-1.0) BuildRequires: pkgconfig(graphite2) BuildRequires: pkgconfig(gstreamer-1.0) BuildRequires: pkgconfig(gstreamer-plugins-base-1.0) BuildRequires: pkgconfig(gtk+-2.0) +BuildRequires: pkgconfig(gtk+-3.0) BuildRequires: pkgconfig(harfbuzz) BuildRequires: pkgconfig(hunspell) BuildRequires: pkgconfig(ice) @@ -189,7 +192,6 @@ BuildRequires: vigra-devel BuildRequires: firebird-devel BuildRequires: kdelibs4-devel BuildRequires: openCOLLADA-devel -BuildRequires: pkgconfig(gtk+-3.0) BuildRequires: pkgconfig(libe-book-0.1) BuildRequires: pkgconfig(libeot) BuildRequires: pkgconfig(libgltf-0.0) @@ -310,13 +312,429 @@ Patch79: 0001-Resolves-rhbz-1364335-tooltips-are-truncated.patch Patch80: 0001-lp-1566050-prevent-cyclic-reference-zombies.patch Patch81: 0001-fix-Link-operator.patch Patch82: 0001-tdf-80999-Canceling-password-prompt-should-abort-det.patch -Patch83: 0001-disable-generation-of-ole-previews-in-ODF-format-unt.patch +Patch83: 0001-Resolves-rhbz-1401082-gnome-hangs-opening-a-certain-.patch +Patch84: 0001-Resolves-tdf-101213-drop-use-of-CAIRO_OPERATOR_DIFFE.patch +Patch85: 0001-disable-generation-of-ole-previews-in-ODF-format-unt.patch +Patch86: 0001-Resolves_rhbz-1437537-fix-csv-a11y.patch +Patch87: 0001-ofz-372-check-if-ImplSplit-succeeded.patch %if 0%{?rhel} # not upstreamed Patch500: 0001-disable-libe-book-support.patch # not upstreamed Patch501: 0001-Revert-upload-libwps-0.4.0.patch + +# rebase libreofficekit to 5.1 +Patch600: 0002-LOK-remove-unused-LOK_PARTMODE_EMBEDDEDOBJ.patch +Patch601: 0003-Look-for-libsofficeapp.dylib-in-the-right-place-on-O.patch +Patch602: 0004-Don-t-do-any-magic-LO-OS-X-application-stuff-in-a-LO.patch +Patch603: 0005-loplugin-staticmethods.patch +Patch604: 0006-loplugin-cstylecast-deal-with-those-that-are-technic.patch +Patch605: 0007-fsanitize-float-divide-by-zero.patch +Patch606: 0008-LOK-fix-the-rectangle-format-mentioned-in-documentat.patch +Patch607: 0009-loplugin-cstylecast-deal-with-remaining-pointer-cast.patch +Patch608: 0010-lokdocview-add-width-and-height-to-the-visible-recta.patch +Patch609: 0011-lokdocview-use-GtkDrawingArea-for-drawing-tiles.patch +Patch610: 0012-Add-tile-buffering-support.patch +Patch611: 0013-lokdocview-Use-maps-instead-of-vector.patch +Patch612: 0014-lokdocview-Add-support-for-editing-documents.patch +Patch613: 0015-lokdocview-move-commonly-used-functions-and-variable.patch +Patch614: 0016-lokdocview-wrap-a-functionality-inside-a-member-func.patch +Patch615: 0017-lokdocview-tilebuffer-clean-up.patch +Patch616: 0018-lokdocview-fixed-rectangle-format-in-documentation-c.patch +Patch617: 0019-lokdocview-check-payload-for-inconsistencies-before-.patch +Patch618: 0020-lokdocview-move-GtkDrawingArea-size-request-out-of-r.patch +Patch619: 0021-lokdocview-fix-render-calls-after-LOK-callbacks.patch +Patch620: 0022-lokdocview-Let-G_BEGIN-END_DECLS-handle-the-compiler.patch +Patch621: 0023-lokdocview-Lets-follow-the-GObject-naming-convention.patch +Patch622: 0024-lokdocview-Modernise-LOKDocView-as-GObject.patch +Patch623: 0025-lokdocview-mark-_get_type-with-const-function-attrib.patch +Patch624: 0026-libreofficekit-fix-RHEL5-build-of-tilebuffer.patch +Patch625: 0027-lokdocview-Make-tilebuffer-an-instance.patch +Patch626: 0028-tilebuffer-ZoomFactor-as-member-variable-is-superflu.patch +Patch627: 0029-tilebuffer-tileSize-as-member-variable-is-superfluou.patch +Patch628: 0030-Werror-Wunused-private-field.patch +Patch629: 0031-loplugin-literaltoboolconversion.patch +Patch630: 0032-loplugin-unreffun.patch +Patch631: 0033-Werror-Wignored-attributes-attribute-declaration-mus.patch +Patch632: 0034-loplugin-unreffun-workaround-for-visibility-adding-r.patch +Patch633: 0035-sw-LOK_CALLBACK_CURSOR_VISIBLE-callback.patch +Patch634: 0036-sw-tiled-rendering-set-minimal-window-size.patch +Patch635: 0037-Revert-sw-LOK_CALLBACK_CURSOR_VISIBLE-callback.patch +Patch636: 0038-CID-1306215-Uninitialized-members.patch +Patch637: 0039-lokdocview-Change-parent-class-to-GtkDrawingArea.patch +Patch638: 0040-lokdocview-Make-this-GObject-class-introspectable.patch +Patch639: 0041-lokdocview-Create-LOK-context-inside-of-lok_doc_view.patch +Patch640: 0042-Fix-RHEL5-build.patch +Patch641: 0043-cppcheck-postfixOperator.patch +Patch642: 0044-Typo.patch +Patch643: 0045-lokdocview-gtktiledviewer-Port-to-gtk3.patch +Patch644: 0046-lokdocview-Port-to-gtk3-expose-event-draw.patch +Patch645: 0047-lokdocview-gtktiledviewer-Remove-gtk-version-checks.patch +Patch646: 0048-gtktiledviewer-Replace-deprecated-Gtk-functions.patch +Patch647: 0049-Repository.mk-libreofficekitgtk-is-conditional-on-EN.patch +Patch648: 0050-lokdocview-Restructure-this-GObject-class.patch +Patch649: 0051-Superfluous-block-lets-merge-into-one.patch +Patch650: 0052-lokdocview-couple-for-missing-static_cast-GParamFlag.patch +Patch651: 0053-gtktiledviewer-add-copy-button.patch +Patch652: 0054-gtktiledviewer-do-HTML-copying-if-possible.patch +Patch653: 0055-lokdocview-Use-GInitable.patch +Patch654: 0056-lokdocview-Use-get_instance_private-to-get-private-s.patch +Patch655: 0057-lokdocview-fixed-a-signal-name.patch +Patch656: 0058-cppcheck-noExplicitConstructor.patch +Patch657: 0059-lokdocview-Don-t-handle-hyperlink-clicks.patch +Patch658: 0060-lokdocview-Remove-superfluous-_post_key.patch +Patch659: 0061-tilebuffer-Add-timer-to-measure-paintTile-call.patch +Patch660: 0062-lokdocview-Handle-DELETE-key.patch +Patch661: 0063-gtktiledviewer-Don-t-continue-on-widget-init-failure.patch +Patch662: 0064-g_assert_nonnull-was-not-declared.patch +Patch663: 0065-LOK-Don-t-try-to-absolutize-URL-s.patch +Patch664: 0066-LOK-Cleanup-absolutizing-of-URLs.patch +Patch665: 0067-LOK-Corner-case-with-working-dir-as.patch +Patch666: 0068-lokdocview-Grab-focus-on-mouse-button-press-event.patch +Patch667: 0069-vcl-ITiledRenderable-getTextSelection-can-be-pure-vi.patch +Patch668: 0070-With-enable-gtk3-we-need-GLib-2.38.patch +Patch669: 0071-gtktiledviewer-method-for-resetting-all-tiles.patch +Patch670: 0072-lokdocview-Call-open_document-in-another-thread.patch +Patch671: 0073-lokdocview-Emit-load-changed-signal-showing-load-pro.patch +Patch672: 0074-gtktiledviewer-Fill-whole-statusbar-with-progressbar.patch +Patch673: 0075-lokdocview-Use-a-thread-pool-for-most-LOK-calls.patch +Patch674: 0076-lokdocview-Make-paintTile-async.patch +Patch675: 0077-lokdocview-tilebuffer-Add-DOxygen-comments.patch +Patch676: 0078-Use-thread-pool-for-LOK-call-paintTile.patch +Patch677: 0079-lokdocview-Cannot-use-same-GTask-object-for-all-call.patch +Patch678: 0080-lokdocview-Follow-the-camelCase-naming-convention.patch +Patch679: 0081-lokdocview-Use-only-one-ctor-for-instantiating-LOEve.patch +Patch680: 0082-lokdocview-Move-postMouseEvent-in-separate-LOK-threa.patch +Patch681: 0083-lokdocview-setGraphicSelection-in-another-thread.patch +Patch682: 0084-lokdocview-post_command-arguments-are-not-supposed-t.patch +Patch683: 0085-libreofficekit-Werror-Wformat-security.patch +Patch684: 0086-LOK-Implement-parts-for-Writer-too.patch +Patch685: 0087-Removed-some-whole-page-invalidations-in-impress.patch +Patch686: 0088-coverity-1315075-Uninitialized-pointer-field.patch +Patch687: 0089-lokdocview-Don-t-use-extern-variable-lokThreadPool.patch +Patch688: 0090-LOKit-set-thread-name-lo_startmain.patch +Patch689: 0091-tdf-93154-Save-button-often-does-not-save.patch +Patch690: 0092-sc-LOK_CALLBACK_DOCUMENT_SIZE_CHANGED-callback.patch +Patch691: 0093-sc-fix-LOKit-invalidate-setPart.patch +Patch692: 0094-gtktiledviewer-Jump-to-cursor-position-when-it-chang.patch +Patch693: 0095-lok-Document-getStyles-method.patch +Patch694: 0096-lok-namespace-and-re-work-various-types-helper-funct.patch +Patch695: 0097-Fix-incomplete-g-i-annotations.patch +Patch696: 0098-log-resource-usage-of-unit-tests-on-UNX-platforms.patch +Patch697: 0099-sal-don-t-use-target-as-parameter-to-cppunittester.patch +Patch698: 0100-LOK-added-a-general-getCommandValues-method.patch +Patch699: 0101-LOK-allow-float-numbers-in-json-property-value-conve.patch +Patch700: 0102-Revert-LOK-added-a-general-getCommandValues-method.patch +Patch701: 0103-LOK-moved-the-decalaration-of-LibLODocument_Impl-to-.patch +Patch702: 0104-desktop-enable-CppunitTest_desktop_lib-only-on-Linux.patch +Patch703: 0105-LOK-added-a-general-getCommandValues-method.patch +Patch704: 0106-LOK-getFonts-method.patch +Patch705: 0107-lokdocview-GTK-calls-should-be-made-from-the-main-th.patch +Patch706: 0108-LOK-don-t-use-unstable-API-unconditionally-when-incl.patch +Patch707: 0109-LOK-Implement-an-own-trivial-InteractionHandler.patch +Patch708: 0110-create_tree.sh-Generate-g-i-files.patch +Patch709: 0111-get-feedback-for-style-font-font-size-in-tiledrender.patch +Patch710: 0112-lok-initialize-UNO-url-command-dispatch.patch +Patch711: 0113-LOK-Sync-the-list-of-commands-we-initialize-with-tho.patch +Patch712: 0114-LOK-Avoid-crash-when-the-command-is-not-available-in.patch +Patch713: 0115-tdf-94237-tiled-rendering-Use-the-entire-document-as.patch +Patch714: 0116-sysui-depend-on-libreofficekitgtk-for-introspection.patch +Patch715: 0117-vcl-ITiledRenderable-add-getCurrentViewShell-and-imp.patch +Patch716: 0118-sfx2-add-SfxLokHelper.patch +Patch717: 0119-lok-Document-add-createView.patch +Patch718: 0120-gtktiledviewer-add-button-tooltips.patch +Patch719: 0121-lok-Office-add-getViews.patch +Patch720: 0122-CppunitTest_desktop_lib-fix-reported-name-of-failed-.patch +Patch721: 0123-lok-Document-add-destroyView.patch +Patch722: 0124-sfx2-add-missing-header-guard.patch +Patch723: 0125-gtktiledviewer-these-globals-can-be-static.patch +Patch724: 0126-gtktiledviewer-allow-multiple-DocView-instances.patch +Patch725: 0127-gtktiledviewer-allow-multiple-status-bars.patch +Patch726: 0128-gtktiledviwer-allow-GtkToolItems-in-multiple-windows.patch +Patch727: 0129-gtktiledviwer-tool-item-registration-is-per-window.patch +Patch728: 0130-gtktiledviewer-allow-part-selector-in-multiple-windo.patch +Patch729: 0131-gtktiledviewer-allow-findbar-in-multiple-windows.patch +Patch730: 0132-lokdocview-allow-not-calling-documentLoad.patch +Patch731: 0133-gtktiledviewer-factor-out-createWindow-from-main.patch +Patch732: 0134-gtktiledviewer-factor-out-setupDocView-from-main.patch +Patch733: 0135-gtktiledviewer-set-up-a-new-GtkWindow-for-a-new-view.patch +Patch734: 0136-lokdocview-avoid-GTK-calls-in-openDocumentInThread.patch +Patch735: 0137-lokdocview-set-up-the-widget-in-all-windows.patch +Patch736: 0138-gtktiledviewer-add-setupWidgetAndCreateWindow-to-avo.patch +Patch737: 0139-lok-Document-add-get-setView.patch +Patch738: 0140-Use-SfxViewFrame-Current.patch +Patch739: 0141-gtktiledviewer-use-setView-before-postKeyEvent.patch +Patch740: 0142-LOK-make-getViews-be-a-member-function-of-Document.patch +Patch741: 0143-LOK-allow-postMouseEvent-in-multiple-views.patch +Patch742: 0144-Add-missing-lok-Document-setPartMode-wrapper.patch +Patch743: 0145-lokdocview-set-view-before-calling-lok-Document-memb.patch +Patch744: 0146-SfxLokHelper-setView-check-if-view-is-already-curren.patch +Patch745: 0147-sfx2-add-SfxViewShell-libreOfficeKitViewCallback.patch +Patch746: 0148-comphelper-add-LibreOfficeKit-set-isViewCallback.patch +Patch747: 0149-sw-implement-per-view-LOK_CALLBACK_INVALIDATE_TILES.patch +Patch748: 0150-lok-Document-register-callback-in-the-view-if-reques.patch +Patch749: 0151-sw-implement-per-view-LOK_CALLBACK_INVALIDATE_VISIBL.patch +Patch750: 0152-gtktiledviewer-don-t-crash-on-opening-non-existing-f.patch +Patch751: 0153-gtktiledviewer-fix-leftover-import-progressbar-in-cr.patch +Patch752: 0154-sw-implement-per-view-LOK_CALLBACK_TEXT_SELECTION.patch +Patch753: 0155-sw-implement-per-view-LOK_CALLBACK_CURSOR_VISIBLE.patch +Patch754: 0156-CppCheck-reduce-variables-scope.patch +Patch755: 0157-lok-add-Office-getFilterTypes.patch +Patch756: 0158-desktop-make-LibLibreOffice_Impl-visible-to-testcase.patch +Patch757: 0159-fix-build.patch +Patch758: 0160-Add-lok-Office-getFilterTypes-testcase.patch +Patch759: 0161-Move-all-introspection-comments-to-header-file.patch +Patch760: 0162-sd-tiled-rendering-avoid-passing-explicit-0-vcl-Wind.patch +Patch761: 0163-libreofficekit-fix-mismatched-free-delete.patch +Patch762: 0164-lok-add-Document-getPartPageRectangles.patch +Patch763: 0165-coverity-1325053-Dereference-after-null-check.patch +Patch764: 0166-lokdocview-Reset-view-completely.patch +Patch765: 0167-Impress-set-current-page-Id-before-showing-the-new-p.patch +Patch766: 0168-desktop-vcl-support-transparency-in-VirtualDevices-w.patch +Patch767: 0169-sw-tiled-rendering-default-to-transparent-background.patch +Patch768: 0170-vcl-tiled-rendering-avoid-Pixel-represents-color-val.patch +Patch769: 0171-desktop-handle-sal_uInt16-in-jsonToPropertyValues.patch +Patch770: 0172-LOK-add-CALLBACK_SEARCH_RESULT_COUNT-and-implement-i.patch +Patch771: 0173-lokdocview-handle-LOK_CALLBACK_SEARCH_RESULT_COUNT.patch +Patch772: 0174-gtktiledviewer-make-it-possible-to-trigger-SearchIte.patch +Patch773: 0175-LOK-added-the-button-type-and-key-modifier-to-postMo.patch +Patch774: 0176-CppunitTest_sw_tiledrendering-testcase-for-LOK_CALLB.patch +Patch775: 0177-LOK-add-the-search-phrase-to-the-search-result-count.patch +Patch776: 0178-LOK-fixed-duplicated-switch-case-values.patch +Patch777: 0179-LOK-add-CALLBACK_SEARCH_RESULT_SELECTION-and-impleme.patch +Patch778: 0180-gtktiledviewer-recognize-LOK_CALLBACK_SEARCH_RESULT_.patch +Patch779: 0181-CppunitTest_sw_tiledrendering-CALLBACK_SEARCH_RESULT.patch +Patch780: 0182-lokdocview-log-paintTile-arguments.patch +Patch781: 0183-sw-outline-SwViewOption-SetOnlineSpell.patch +Patch782: 0184-Disable-spellcheck-when-LOK-is-active.patch +Patch783: 0185-sw-extract-lcl_emitSearchResultCallbacks-from-SwView.patch +Patch784: 0186-sw-tiled-rendering-emit-LOK_CALLBACK_SEARCH_RESULT-f.patch +Patch785: 0187-libreofficekit-Werror-unused-macros.patch +Patch786: 0188-lokdocview-invalidate-after-selection-change.patch +Patch787: 0189-sc-tiled-rendering-fix-showing-all-search-results.patch +Patch788: 0190-Make-this-compile-for-iOS-again.patch +Patch789: 0191-comphelper-add-string-join.patch +Patch790: 0192-sc-tiled-rendering-no-need-to-show-this-dialog.patch +Patch791: 0193-lok-Document-initializeForRendering-handle-lack-of-l.patch +Patch792: 0194-CppunitTest_desktop_lib-add-Calc-find-all-testcase.patch +Patch793: 0195-editeng-sw-sc-use-comphelper-string-join.patch +Patch794: 0196-sc-tiled-rendering-implement-LOK_CALLBACK_SEARCH_RES.patch +Patch795: 0197-LOK-CALLBACK_SEARCH_RESULT_COUNT-is-redundant.patch +Patch796: 0198-lokdocview-log-postUnoCommand-arguments.patch +Patch797: 0199-gtktiledviewer-drop-tiles-on-set-part-event.patch +Patch798: 0200-sd-tiled-rendering-make-invalidation-in-DrawViewShel.patch +Patch799: 0201-tdf-95002-sd-tiled-rendering-fix-handling-of-images-.patch +Patch800: 0202-disable-test-that-causes-inf.-loop.patch +Patch801: 0203-sd-tiled-rendering-implement-LOK_CALLBACK_SEARCH_RES.patch +Patch802: 0204-CppunitTest_sd_tiledrendering-CALLBACK_SEARCH_RESULT.patch +Patch803: 0205-Bump-gtk-version-to-2.18.patch +Patch804: 0206-sd-tiled-rendering-initial-search-all.patch +Patch805: 0207-sd-tiled-rendering-search-rectangle-is-part-specific.patch +Patch806: 0208-LOK-include-part-numbers-in-CALLBACK_SEARCH_RESULT_S.patch +Patch807: 0209-lok-Document-paintTile-fix-non-rectangular-tiles-wrt.patch +Patch808: 0210-sd-tiled-rendering-let-find-all-at-least-select-the-.patch +Patch809: 0211-sd-tiled-rendering-implement-CALLBACK_SET_PART-for-f.patch +Patch810: 0212-vcl-aAlphaBitmap.ImplGetImpBitmap-seen-as-0.patch +Patch811: 0213-editeng-tiled-rendering-avoid-selections-callbacks-i.patch +Patch812: 0214-sd-tiled-rendering-emit-CALLBACK_TEXT_SELECTION-on-m.patch +Patch813: 0215-editeng-add-EditView-GetSelectionRectangles.patch +Patch814: 0216-disable-failing-test.patch +Patch815: 0217-lok-svg-export-Default-to-exporting-all-slides-use-t.patch +Patch816: 0218-lok-Document-saveAs-add-Writer-Impress-Draw-png-mapp.patch +Patch817: 0219-Add-DLOPEN_LIBS-to-configure-for-some-cases-where-ld.patch +Patch818: 0220-sc-initial-png-export.patch +Patch819: 0221-lokdocview-Use-G_PARAM_STATIC_STRINGS.patch +Patch820: 0222-lok-Avoid-adding-to-recent-documents-completely.patch +Patch821: 0223-lokdocview-Emit-a-warning-after-error.patch +Patch822: 0224-vcl-add-ITiledRenderable-getWindow-and-implement-in-.patch +Patch823: 0225-LOK-add-Document-paste.patch +Patch824: 0226-gtktiledviewer-initial-paste-support.patch +Patch825: 0227-desktop-add-lok-Document-paste-testcase.patch +Patch826: 0228-loplugin-defaultparams.patch +Patch827: 0229-vcl-ITiledRenderable-getWindow-can-be-pure-virtual-n.patch +Patch828: 0230-lok-Document-paste-check-if-the-given-mime-type-is-s.patch +Patch829: 0231-sc-implement-vcl-ITiledRenderable-isMimeTypeSupporte.patch +Patch830: 0232-vcl-add-Window-SetClipboard.patch +Patch831: 0233-lok-clipboard-support-rich-text-paste.patch +Patch832: 0234-gtktiledviwer-try-to-paste-as-html-then-as-plain-tex.patch +Patch833: 0235-sw-tiled-rendering-don-t-offer-HTML-paste-for-shape-.patch +Patch834: 0236-fix-includes-that-are-not-stand-alone.patch +Patch835: 0237-sd-implement-vcl-ITiledRenderable-getWindow.patch +Patch836: 0238-sd-implement-vcl-ITiledRenderable-isMimeTypeSupporte.patch +Patch837: 0239-vcl-getWindow-setClipboard-in-ITiledRenderable.patch +Patch838: 0240-LOK-font-back-color-feedback.patch +Patch839: 0241-LOK-font-back-color-callback-use-sal_Int32-instead-o.patch +Patch840: 0242-lokdocview-ensure-private-structure-is-allocated-wit.patch +Patch841: 0243-LOK-initial-Document-getCommandValues-for-RowColumnH.patch +Patch842: 0244-gtktiledviewer-initial-row-headers-for-spreadsheet-d.patch +Patch843: 0245-loplugin-staticmethods.patch +Patch844: 0246-gtktiledviewer-initial-column-headers-for-spreadshee.patch +Patch845: 0247-gtktiledviewer-add-missing-spreadsheet-corner-button.patch +Patch846: 0248-loplugin-staticmethods.patch +Patch847: 0249-sc-lok-Always-provide-a-reasonable-document-size.patch +Patch848: 0250-lokdocview-Fix-memory-leaks.patch +Patch849: 0251-android-don-t-use-alpha-VDev-when-painting-tiles-on-.patch +Patch850: 0252-add-LOKit-interface-missing-description.patch +Patch851: 0253-gtktiledviewer-add-a-few-more-trivial-buttons-and-br.patch +Patch852: 0254-ScTabView-getRowColumnHeaders-include-info-about-col.patch +Patch853: 0255-ScTabView-getRowColumnHeaders-emit-info-about-last-f.patch +Patch854: 0256-sc-lok-emit-RowColumnHeader-info-in-twips.patch +Patch855: 0257-gtktiledviewer-show-zoom-in-the-status-bar.patch +Patch856: 0258-sc-lok-fix-rounding-errors-with-non-100-zoom.patch +Patch857: 0259-LOK-make-use-of-MOUSEMOVE-in-calc.patch +Patch858: 0260-gtktiledviewer-adjust-spreadsheet-row-column-headers.patch +Patch859: 0261-lokdocview-Separate-painting-and-saving-of-tiles.patch +Patch860: 0262-libreofficekit-Werror-unused-parameter.patch +Patch861: 0263-lok-Fix-typo-search-result_count-search-result-count.patch +Patch862: 0264-lok-Introduce-LOK_CALLBACK_UNO_COMMAND_RESULT-callba.patch +Patch863: 0265-build-fix.patch +Patch864: 0266-sc-lok-allow-requesting-row-headers-only-for-a-logic.patch +Patch865: 0267-sc-lok-allow-requesting-column-headers-only-for-a-lo.patch +Patch866: 0268-Werror-Wformat-security.patch +Patch867: 0269-sc-lok-avoid-placeholder-row-when-providing-all-head.patch +Patch868: 0270-lok-Unit-test-for-LOK_CALLBACK_UNO_COMMAND_RESULT.patch +Patch869: 0271-lok-Fix-crash-due-to-non-initialized-callback.patch +Patch870: 0272-Werror-Wformat-security.patch +Patch871: 0273-sc-lok-return-absolute-positions-for-row-column-head.patch +Patch872: 0274-CppunitTest_desktop_lib-test-absolute-positions-for-.patch +Patch873: 0275-lokdocview-Don-t-render-tiles-while-tile-buffer-has-.patch +Patch874: 0276-sc-lok-Cell-Cursor-callback.patch +Patch875: 0277-sc-lok-Cache-viewdata-zoom-and-reuse-for-cursor-call.patch +Patch876: 0278-sc-lok-make-cell-cursor-behaviour-consistent-with-de.patch +Patch877: 0279-sc-lok-tdf-94605-introduce-uno-CellCursor.patch +Patch878: 0280-sc-lok-update-parameter-syntax-for-.uno-CellCursor.patch +Patch879: 0281-sw-tiled-rendering-initial-annotation-support.patch +Patch880: 0282-sw-lok-annotations-paint-all-child-window.patch +Patch881: 0283-gtktiledviewer-larger-default-window-size.patch +Patch882: 0284-sw-lok-annotations-disable-the-scrollbar-for-now.patch +Patch883: 0285-sc-lok-annotations-paint-range-and-anchor-overlay.patch +Patch884: 0286-Revert-sc-lok-Cache-viewdata-zoom-and-reuse-for-curs.patch +Patch885: 0287-gtktiledviewer-add-Ctrl-Alt-Shift-shortcut-support.patch +Patch886: 0288-sc-lok-Add-initial-test-for-.uno-CellCursor.patch +Patch887: 0289-sc-lok-add-missing-commandName.patch +Patch888: 0290-lokdocview-assert-that-loading-of-handle-bitmaps-suc.patch +Patch889: 0291-loplugin-nullptr-automatic-rewrite.patch +Patch890: 0292-loplugin-nullptr-automatic-rewrite.patch +Patch891: 0293-Keep-LibreOfficeKit.hxx-compatible-with-C-03.patch +Patch892: 0294-Add-a-check-for-non-LIBO_INTERNAL_ONLY-C-03-compatib.patch +Patch893: 0295-Missing-include-for-NULL.patch +Patch894: 0296-gtktiledviewer-don-t-hide-cursor-after-doc-size-chan.patch +Patch895: 0297-sw-lok-fix-width-of-the-notes-sidebar.patch +Patch896: 0298-Avoid-Werror-pedantic-when-building-CppunitTest_libr.patch +Patch897: 0299-sw-lok-fix-length-of-the-line-overlay-above-the-note.patch +Patch898: 0300-This-PixelToLogic-call-can-be-conditional-in-SwSideb.patch +Patch899: 0301-sd-lok-ccu-1295-force-async-image-swap.patch +Patch900: 0302-Implement-LOK_CALLBACK_MOUSE_POINTER.patch +Patch901: 0303-lokdocview-support-LOK_CALLBACK_MOUSE_POINTER.patch +Patch902: 0304-sw-lok-fix-sidebarwindows-SwSidebarWin-pixel-positio.patch +Patch903: 0305-lok-add-Clear-formatting-to-getStyles.patch +Patch904: 0306-lok-sw-Place-default-styles-at-top-of-style-selector.patch +Patch905: 0307-sw-lok-route-SwEditWin-MouseButtonDown-to-SidebarTex.patch +Patch906: 0308-fix-build.patch +Patch907: 0309-fix-build.patch +Patch908: 0310-lok-send-list-of-commands-instead-of-ClearStyles.patch +Patch909: 0311-Use-std-vector-instead-of-an-array-of-strings.patch +Patch910: 0312-More-range-based-for.patch +Patch911: 0313-sw-lok-filter-out-defalt-styles-to-avoid-duplicates.patch +Patch912: 0314-sw-lok-forward-key-events-to-annotation-window-if-ne.patch +Patch913: 0315-lok-Use-reference-instead-of-copy-constructing-in-ra.patch +Patch914: 0316-LOK-setClientZoom-sets-the-client-zoom-level.patch +Patch915: 0317-LOK-calc-formula-callback-formula-bar-implementation.patch +Patch916: 0318-libreofficekit-loplugin-cstylecast.patch +Patch917: 0319-sw-don-t-show-main-cursor-when-editing-a-postit.patch +Patch918: 0320-loplugin-nullptr.patch +Patch919: 0321-sc-lok-during-tiled-rendering-the-cell-cursor-is-alw.patch +Patch920: 0322-editeng-lok-respect-origin-of-map-mode-for-INVALIDAT.patch +Patch921: 0323-sw-lok-fix-blinking-cursor-position-of-comments.patch +Patch922: 0324-editeng-lok-respect-origin-of-map-mode-for-TEXT_SELE.patch +Patch923: 0325-sw-lok-disable-comment-menu-button-for-now.patch +Patch924: 0326-sw-lok-comments-fix-position-of-blinking-cursor-afte.patch +Patch925: 0327-sw-lok-comments-emit-invalidation-events-in-SidebarT.patch +Patch926: 0328-sw-lok-comments-implement-setTextSelection-API.patch +Patch927: 0329-sw-lok-comments-fix-callback-of-newly-created-outlin.patch +Patch928: 0330-sw-lok-comments-fix-cursor-position-of-a-newly-creat.patch +Patch929: 0331-sw-lok-comments-implement-mouse-move-and-mouse-up.patch +Patch930: 0332-gtktiledviewer-the-formula-bar-is-calc-only.patch +Patch931: 0333-gtktiledviewer-add-toolbar-buttons-to-insert-delete-.patch +Patch932: 0334-CppunitTest_sw_tiledrendering-replace-various-ifdefs.patch +Patch933: 0335-CppunitTest_desktop_lib-add-Writer-comments-textcase.patch +Patch934: 0336-sc-lok-use-client-zoom-for-ViewRowColumnHeaders.patch +Patch935: 0337-sw-lok-comments-fix-sidebar-width-with-custom-zoom.patch +Patch936: 0338-sw-lok-comments-fix-text-selection-with-custom-zoom.patch +Patch937: 0339-sw-lok-comments-fix-comment-widget-width-with-custom.patch +Patch938: 0340-sw-lok-comments-fix-meta-author-data-size-with-custo.patch +Patch939: 0341-sw-lok-comments-implement-clipboard-copy.patch +Patch940: 0342-gtktiledviewer-set-author-name-when-inserting-a-comm.patch +Patch941: 0343-lok-Document-initializeForRendering-support-init.-ar.patch +Patch942: 0344-vcl-ITiledRenderable-initializeForTiledRendering-sup.patch +Patch943: 0345-gtktiledviewer-allow-passing-initializeForRendering-.patch +Patch944: 0346-sw-lok-comments-don-t-paint-hidden-comment-sub-widge.patch +Patch945: 0347-editeng-lok-invalidate-on-scroll.patch +Patch946: 0348-sw-lok-comments-optimize-sidebar-text-control-invali.patch +Patch947: 0349-gtktiledviewer-allow-setting-custom-background-color.patch +Patch948: 0350-Werror-Wdeprecated-declarations.patch +Patch949: 0351-sw-lok-comments-implement-painting-of-the-vertical-s.patch +Patch950: 0352-LOK-add-Document-getTileMode.patch +Patch951: 0353-sw-lok-comments-fix-vertical-scrollbar-with-custom-z.patch +Patch952: 0354-updae-getTileMode.patch +Patch953: 0355-vcl-lok-fix-scrollbar-to-accept-mouse-events-in-twip.patch +Patch954: 0356-sw-lok-comments-handle-mouse-up-down-events-on-the-v.patch +Patch955: 0357-desktop-fix-LOK_DEBUG-rectangle-painting.patch +Patch956: 0358-sw-lok-comments-fix-missing-invalidations-from-the-s.patch +Patch957: 0359-vcl-lok-handle-tracking-coordinates-which-are-in-twi.patch +Patch958: 0360-sw-lok-comments-implement-drag-of-the-scrollbar.patch +Patch959: 0361-sw-lok-comments-avoid-crash-an-exit-after-clicking-t.patch +Patch960: 0362-sw-lok-comments-fix-map-mode-state-after-changing-zo.patch +Patch961: 0363-tdf-96243-don-t-crash-if-LibO-install.-wasn-t-found.patch +Patch962: 0364-improve-error-message-for-nonexist.-path.patch +Patch963: 0365-tdf-96246-Make-pRenderingArguments-nullable.patch +Patch964: 0366-tdf-96250-desktop-empty-str-is-the-same-as-0-str-in-.patch +Patch965: 0367-tdf-96316-Decouple-view-only-editable-modes.patch +Patch966: 0368-tdf-96318-Add-searching-API.patch +Patch967: 0369-lokdocview-Set-a-default-path-for-LOK-init.patch +Patch968: 0370-tdf-96317-Add-API-for-copy-paste-from-to-the-widget.patch +Patch969: 0371-tdf-96384-Add-a-new-signal-text-selection-to-lokdocv.patch +Patch970: 0372-tdf-96250-LOK-guard-against-0-pRenderingArguments.patch +Patch971: 0373-lokdocview-Remove-an-easy-FIXME.patch +Patch972: 0374-lokdocview-Superfluous-_set_zoom-call-on-widget-init.patch +Patch973: 0375-lokdocview-Use-GLib-basic-types.patch +Patch974: 0376-lokdocview-Added-some-missing-comments-annotations.patch +Patch975: 0377-lokdocview-Return-if-no-document-is-set.patch +Patch976: 0378-coverity-1343631-Resource-leak.patch +Patch977: 0379-coverity-1343632-Resource-leak.patch +Patch978: 0380-coverity-1343633-Resource-leak.patch +Patch979: 0381-coverity-1315075-Uninitialized-scalar-field.patch +Patch980: 0382-lokdocview-Use-an-array-to-install-properties.patch +Patch981: 0383-tdf-96514-Emits-a-notify-signal-when-zoom-changes.patch +Patch982: 0384-lokdocview-Use-shared_ptr-to-fix-a-possible-memory-l.patch +Patch983: 0385-tdf-96421-Return-if-no-window-is-realized.patch +Patch984: 0386-lokdocview-Fix-WARNING-when-creating-an-error.patch +Patch985: 0387-tdf-96513-Limit-LOKDocView-s-zoom-in-0.25-5.0.patch +Patch986: 0388-lokdocview-Center-the-widget-inside-the-allocation.patch +Patch987: 0389-libreofficekit-password-interaction-optional-and-off.patch +Patch988: 0390-libreofficekit-fix-inverted-condition.patch +Patch989: 0391-Missing-include.patch +Patch990: 0392-lokdocview-Handle-password-protected-documents.patch +Patch991: 0393-lok-fix-saveAs-for-a-loaded-HTML-document.patch +Patch992: 0394-lokdocview-Center-the-widget-vertically-inside-the-a.patch +Patch993: 0395-WaE-buggy-warning-in-vs2015-r1.patch +Patch994: 0396-gtktiledviewer-needs-gtk3-not-gtk2.patch +Patch995: 0397-tdf-99314-lokdocview-add-new-userprofileurl-property.patch +Patch996: 0398-fix-build.patch +Patch997: 0001-sysui-g-ir-scanner-is-not-available-in-when-introspe.patch +Patch998: 0002-sysui-introspection-wants-INSTDIR-not-DESTDIR-INSTAL.patch +Patch999: 0001-vcl-assign-nullptr-after-deleting.patch +Patch1000: 0001-Move-SolarMutex-down-from-tools-to-comphelper-to-mak.patch +Patch1001: 0002-vcl-add-isInitVCL-to-not-initialize-twice.patch +Patch1002: 0003-gnome-documents-rework-SfxPickList-as-pimpl.patch +Patch1003: 0004-rhbz-1444437-gnome-documents-finalize-may-not-occur-.patch +Patch1004: 0005-gnome-documents-hold-solarmutex-on-dtor-patch-as-wel.patch +Patch1005: 0006-Resolves-rhbz-144437-make-gnome-documents-not-crash-.patch +Patch1006: 0001-gtktiledviewer-allow-testing-of-destroyView.patch +Patch1007: 0001-Resolves-rhbz-1454693-segv-on-interrupting-tiled-ren.patch +#end rebase + %endif %define instdir %{_libdir} @@ -700,6 +1118,27 @@ This plugin is experimental and it is not suggested for normal use. %endif +%package -n libreofficekit +Summary: A library providing access to LibreOffice functionality +Requires: %{name}-core = %{epoch}:%{version}-%{release} +License: MPLv2.0 + +%description -n libreofficekit +LibreOfficeKit can be used to access LibreOffice functionality +through C/C++, without any need to use UNO. + +For now it only offers document conversion (in addition to an +experimental tiled rendering API). + +%package -n libreofficekit-devel +Summary: Development files for libreofficekit +Requires: libreofficekit%{?_isa} = %{epoch}:%{version}-%{release} +License: MPLv2.0 + +%description -n libreofficekit-devel +The libreofficekit-devel package contains libraries and header files for +developing applications that use libreofficekit. + %if 0%{?_enable_debug_packages} %define debug_package %{nil} @@ -1062,7 +1501,7 @@ export CXXFLAGS=$ARCH_FLAGS %if 0%{?rhel} %define distrooptions --disable-eot --disable-gltf --disable-firebird-sdbc --enable-python=system %else # fedora -%define distrooptions --enable-eot --enable-gtk3 --enable-kde4 --with-system-opencollada --with-system-ucpp +%define distrooptions --enable-eot --enable-kde4 --with-system-opencollada --with-system-ucpp export OPENCOLLADA_CFLAGS='-I/usr/include/COLLADABaseUtils -I/usr/include/COLLADAFramework -I/usr/include/COLLADASaxFrameworkLoader -I/usr/include/GeneratedSaxParser' export OPENCOLLADA_LIBS='-lOpenCOLLADABaseUtils -lOpenCOLLADAFramework -lOpenCOLLADASaxFrameworkLoader -lGeneratedSaxParser' %endif @@ -1085,6 +1524,7 @@ autoconf # TODO: enable coinmp? # avoid running autogen.sh on make touch autogen.lastrun +# NOTE: --enable-gtk3 is just for libreofficekit %configure \ %vendoroption \ %{?with_lang} \ @@ -1096,6 +1536,7 @@ touch autogen.lastrun --enable-evolution2 \ --enable-ext-nlpsolver \ --enable-ext-wiki-publisher \ + --enable-gtk3 \ --enable-release-build \ --enable-scripting-beanshell \ --enable-scripting-javascript \ @@ -1126,12 +1567,13 @@ export GNOME_MIME_THEME=hicolor export PREFIXDIR=/usr # TODO use empty variables? Should make the renaming hacks in %%install # unnecessary. -. ./bin/get_config_variables PRODUCTVERSIONSHORT PRODUCTVERSION WORKDIR +. ./bin/get_config_variables PRODUCTVERSIONSHORT PRODUCTVERSION SRCDIR WORKDIR PKG_CONFIG INSTDIR pushd $WORKDIR/CustomTarget/sysui/share/libreoffice ./create_tree.sh popd mkdir $WORKDIR/os-integration cp -pr $WORKDIR/CustomTarget/sysui/share/output/usr/share/* $WORKDIR/os-integration +cp -pr $WORKDIR/CustomTarget/sysui/share/output/girepository-1.0/LOKDocView-0.1.typelib $WORKDIR/os-integration %if %{with smallbuild} # remove the biggest offenders @@ -1364,8 +1806,25 @@ install -m 0644 -p mime-info/libreoffice$PRODUCTVERSION.mime %{buildroot}%{_data #add our mime-types, e.g. for .oxt extensions install -m 0755 -d %{buildroot}%{_datadir}/mime/packages install -m 0644 -p mime/packages/libreoffice$PRODUCTVERSION.xml %{buildroot}%{_datadir}/mime/packages/libreoffice.xml + +# install LibreOfficeKit +install -m 0755 -d %{buildroot}%{_libdir}/girepository-1.0 +install -m 0644 -p LOKDocView-%{girapiversion}.typelib %{buildroot}%{_libdir}/girepository-1.0/LOKDocView-%{girapiversion}.typelib +install -m 0755 -d %{buildroot}%{_libdir}/gir-1.0 +install -m 0644 -p gir-1.0/LOKDocView-%{girapiversion}.gir %{buildroot}%{_libdir}/gir-1.0/LOKDocView-%{girapiversion}.gir +mv %{buildroot}%{baseinstdir}/program/liblibreofficekitgtk.so %{buildroot}%{_libdir} popd +%if 0%{?fedora} +# install LibreOfficeKit headers +install -m 0755 -d %{buildroot}%{_includedir}/LibreOfficeKit +install -m 0644 -p include/LibreOfficeKit/* %{buildroot}%{_includedir}/LibreOfficeKit +%endif + +# This is only a side effect of building LibreOfficeKit. The plugin +# itself is not usable yet in 5.0, so let's drop it. +rm -f %{buildroot}%{baseinstdir}/program/libvclplug_gtk3lo.so + rm -rf %{buildroot}%{baseinstdir}/readmes rm -rf %{buildroot}%{baseinstdir}/licenses @@ -1556,8 +2015,6 @@ rm -f %{buildroot}%{baseinstdir}/program/classes/smoketest.jar %{baseinstdir}/program/libhelplinkerlo.so %{baseinstdir}/program/libhyphenlo.so %{baseinstdir}/program/libjdbclo.so -# TODO: move elsewhere? -%{baseinstdir}/program/liblibreofficekitgtk.so %{baseinstdir}/program/liblnglo.so %{baseinstdir}/program/libloglo.so %{baseinstdir}/program/liblocaledata_en.so @@ -2240,18 +2697,52 @@ update-desktop-database %{_datadir}/applications &> /dev/null || : %endif +%files -n libreofficekit +%{_libdir}/girepository-1.0/LOKDocView-%{girapiversion}.typelib +%{_libdir}/liblibreofficekitgtk.so + +%files -n libreofficekit-devel +%{_libdir}/gir-1.0/LOKDocView-%{girapiversion}.gir + %changelog -* Sun Mar 26 2017 David Tardon - 1:5.0.6.2-5.1 -- Resolves: rhbz#1435534 CVE-2017-3157 Arbitrary file disclosure in Calc and - Writer +* Fri Jun 16 2017 Caolán McNamara - 1:5.0.6.2-14 +- Resolves: rhbz#1454693 segv on interrupting tiled rendering + +* Thu Jun 15 2017 Caolán McNamara - 1:5.0.6.2-13 +- Related: rhbz#1444437 remove timer if document closed before it fires + +* Tue Jun 06 2017 Caolán McNamara - 1:5.0.6.2-12 +- Resolves: rhbz#1454598 crash on selecting bullet from toolbar + +* Thu May 25 2017 Caolán McNamara - 1:5.0.6.2-11 +- Related: rhbz#1444437 restart second instance cleanly + +* Wed May 10 2017 Caolán McNamara - 1:5.0.6.2-10 +- Resolves: rhbz#1444437 segv in gnome-documents integration + +* Wed Apr 26 2017 David Tardon - 1:5.0.6.2-9 +- Resolves: rhbz#1445635 CVE-2017-7870 Heap-buffer-overflow in + tools::Polygon::Insert + +* Fri Mar 31 2017 Caolán McNamara - 1:5.0.6.2-8 +- Resolves: rhbz#1437537 fix csv a11y + +* Sun Mar 26 2017 David Tardon - 1:5.0.6.2-7 +- Resolves: rhbz#1431539 gnome-documents needs libreofficekit +- Resolves: rhbz#1435535 CVE-2017-3157 Arbitrary file disclosure in + Calc and Writer + +* Tue Feb 21 2017 Caolán McNamara - 1:5.0.6.2-6 +- Resolves: rhbz#1401082 gnome hangs opening certain docx +- Resolves: rhbz#1421726 drop use of CAIRO_OPERATOR_DIFFERENCE * Thu Feb 09 2017 Michael Stahl - 1:5.0.6.2-5 -- Resolves: rhbz#1426348 Encrypted files opening as plain text after +- Resolves: rhbz#1411327 Encrypted files opening as plain text after cancelling password dialog * Fri Dec 02 2016 Caolán McNamara - 1:5.0.6.2-4 -- Resolves: rhbz#1425535 crash in calc on exit after using csv dialog with a11y enabled -- Resolves: rhbz#1425536 crash in calc on closing dialog with a11y enabled +- Resolves: rhbz#1378521 crash in calc on exit after using csv dialog with a11y enabled +- Resolves: rhbz#1397992 crash in calc on closing dialog with a11y enabled * Tue Aug 23 2016 David Tardon - 1:5.0.6.2-3 - Resolves: rhbz#1364335 tooltips are truncated