[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.1' - include/sfx2 sc/source sfx2/source svx/source
Marco Cecchetti
marco.cecchetti at collabora.com
Wed Mar 15 10:00:11 UTC 2017
include/sfx2/viewsh.hxx | 2 +
sc/source/ui/inc/gridwin.hxx | 3 ++
sc/source/ui/inc/tabview.hxx | 5 +++
sc/source/ui/inc/tabvwsh.hxx | 6 ++++
sc/source/ui/inc/viewdata.hxx | 2 +
sc/source/ui/view/gridwin.cxx | 1
sc/source/ui/view/gridwin4.cxx | 15 ++++++++---
sc/source/ui/view/tabview5.cxx | 46 ++++++++++++++++++++++++++++++++++++
sc/source/ui/view/viewdata.cxx | 6 ++++
sfx2/source/view/viewsh.cxx | 9 +++++++
svx/source/svdraw/sdrpagewindow.cxx | 46 +++++++++++++++++++++++++++++++-----
11 files changed, 131 insertions(+), 10 deletions(-)
New commits:
commit 1b89b61bbf66472e633ee45e05b86c4030575cf0
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date: Sun Jan 1 18:02:51 2017 +0100
LOK: Calc: invalidation on insert image
Change-Id: Ib0ec104b14385473a2a7f7dc2a33558d998996fa
Reviewed-on: https://gerrit.libreoffice.org/32690
Reviewed-by: Marco Cecchetti <mrcekets at gmail.com>
Tested-by: Marco Cecchetti <mrcekets at gmail.com>
diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index e2c0b75..a20672f 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -342,6 +342,8 @@ public:
void NotifyOtherView(OutlinerViewShell* pOtherShell, int nType, const OString& rKey, const OString& rPayload) override;
/// Ask this view to send its cursor position to pViewShell.
virtual void NotifyCursor(SfxViewShell* /*pViewShell*/) const;
+ virtual bool UseLOKOutputDevice(const OutputDevice* pOutputDevice) const;
+ virtual void InvalidateWindows(std::function<void (vcl::Window& )>& f);
};
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 0432532..0dc9599 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -127,6 +127,7 @@ class ScGridWindow : public vcl::Window, public DropTargetHelper, public DragSou
std::unique_ptr<sc::SpellCheckContext> mpSpellCheckCxt;
+ VclPtr<OutputDevice> mpLOKOutputDevice;
ScViewData* pViewData;
ScSplitPos eWhich;
ScHSplitPos eHWhich;
@@ -435,6 +436,8 @@ public:
long nTileHeight);
void updateLibreOfficeKitCellCursor(SfxViewShell* pOtherShell) const;
+ const OutputDevice* GetLOKVirtualDevice() const { return mpLOKOutputDevice.get(); }
+
protected:
void ImpCreateOverlayObjects();
void ImpDestroyOverlayObjects();
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index cbb26bf..92bd6fe 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -134,6 +134,7 @@ private:
ScHeaderFunctionSet aHdrFunc;
ScDrawView* pDrawView;
+ std::unique_ptr<FmFormView> pLOKDrawView;
Size aFrameSize; // passed on as for DoResize
Point aBorderPos;
@@ -328,6 +329,9 @@ public:
// gegen CLOKs
SdrView* GetSdrView() { return pDrawView; }
+ FmFormView* GetLOKDrawView();
+ bool UseLOKOutputDevice(const OutputDevice* pOutputDevice) const;
+
bool IsMinimized() const { return bMinimized; }
/**
@@ -582,6 +586,7 @@ public:
/// @see ScModelObj::getRowColumnHeaders().
OUString getRowColumnHeaders(const Rectangle& rRectangle);
void OnLOKNoteStateChanged(const ScAddress& rPos);
+ void ForEachGridWindow(std::function<void (vcl::Window& )>& f);
};
#endif
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index 6d24e07..c9134a6 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -394,6 +394,12 @@ public:
int getPart() const override;
/// See SfxViewShell::NotifyCursor().
void NotifyCursor(SfxViewShell* pViewShell) const override;
+ /// See SfxViewShell:: UseLOKOutputDevice().
+ virtual bool UseLOKOutputDevice(const OutputDevice* pOutputDevice) const override
+ { return ScTabView::UseLOKOutputDevice(pOutputDevice); }
+ /// See SfxViewShell::InvalidateWindows().
+ virtual void InvalidateWindows(std::function<void (vcl::Window& )>& f) override
+ { ScTabView::ForEachGridWindow(f); }
};
#endif
diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx
index d3b80fc..8175b91 100644
--- a/sc/source/ui/inc/viewdata.hxx
+++ b/sc/source/ui/inc/viewdata.hxx
@@ -103,6 +103,7 @@ class ScExtDocOptions;
class ScViewData;
class ScMarkData;
class ScGridWindow;
+class FmFormView;
class ScViewDataTable // per-sheet data
{
@@ -252,6 +253,7 @@ public:
const ScGridWindow* GetActiveWin() const;
ScDrawView* GetScDrawView(); // from View
bool IsMinimized(); // from View
+ FmFormView* GetLOKDrawView(); // from View
void UpdateInputHandler( bool bForce = false, bool bStopEditing = true );
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index bbb18e0..96b3036 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -544,6 +544,7 @@ void ScGridWindow::dispose()
{
ImpDestroyOverlayObjects();
+ mpLOKOutputDevice.disposeAndClear();
mpFilterBox.disposeAndClear();
mpFilterFloat.disposeAndClear();
mpNoteMarker.reset();
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index e9b9e67..1ca1503 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1215,12 +1215,19 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice,
// setup the SdrPage so that drawinglayer works correctly
ScDrawLayer* pModel = pDoc->GetDrawLayer();
- std::unique_ptr<FmFormView> pDrawView;
+
if (pModel)
{
- pDrawView.reset(new FmFormView(pModel, &rDevice));
- pDrawView->ShowSdrPage(pDrawView->GetModel()->GetPage(nTab));
- aOutputData.SetDrawView( pDrawView.get() );
+ FmFormView* pDrawView = pViewData->GetLOKDrawView();
+ if (pDrawView)
+ {
+ if (mpLOKOutputDevice)
+ pDrawView->DeleteWindowFromPaintView(mpLOKOutputDevice.get());
+ mpLOKOutputDevice.reset(&rDevice);
+ pDrawView->AddWindowToPaintView(&rDevice, nullptr);
+ pDrawView->ShowSdrPage(pDrawView->GetModel()->GetPage(nTab));
+ aOutputData.SetDrawView( pDrawView );
+ }
}
// draw the content
diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx
index 49650b6..f743c2a 100644
--- a/sc/source/ui/view/tabview5.cxx
+++ b/sc/source/ui/view/tabview5.cxx
@@ -268,6 +268,40 @@ void ScTabView::MakeDrawView( TriState nForceDesignMode )
}
}
+FmFormView* ScTabView::GetLOKDrawView()
+{
+ if (!comphelper::LibreOfficeKit::isActive())
+ return nullptr;
+
+ if (!pLOKDrawView)
+ {
+ ScDrawLayer* pLayer = aViewData.GetDocument()->GetDrawLayer();
+ OSL_ENSURE(pLayer, "no Draw Layer available");
+ pLOKDrawView.reset(new FmFormView(pLayer, nullptr));
+ }
+
+ return pLOKDrawView.get();
+}
+
+bool ScTabView::UseLOKOutputDevice(const OutputDevice* pOutputDevice) const
+{
+ if (!comphelper::LibreOfficeKit::isActive())
+ return false;
+
+ if (pOutputDevice)
+ {
+ for (int i = 0; i < 4; ++i)
+ {
+ if (pGridWin[i])
+ {
+ if (pGridWin[i]->GetLOKVirtualDevice() == pOutputDevice)
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
void ScTabView::DoAddWin( ScGridWindow* pWin )
{
if (pDrawView)
@@ -278,6 +312,7 @@ void ScTabView::DoAddWin( ScGridWindow* pWin )
}
}
+
void ScTabView::TabChanged( bool bSameTabButMoved )
{
if (pDrawView)
@@ -692,4 +727,15 @@ void ScTabView::OnLOKNoteStateChanged(const ScAddress& rPos)
}
}
+void ScTabView::ForEachGridWindow(std::function<void (vcl::Window& )>& f)
+{
+ for (auto& pWin: pGridWin)
+ {
+ if (pWin && pWin->IsVisible())
+ {
+ f(*pWin);
+ }
+ }
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 86814e7..b5180d4 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -2205,6 +2205,12 @@ ScDrawView* ScViewData::GetScDrawView()
return pView->GetScDrawView();
}
+FmFormView* ScViewData::GetLOKDrawView()
+{
+ OSL_ENSURE( pView, "GetLOKDrawView() without View" );
+ return pView->GetLOKDrawView();
+}
+
bool ScViewData::IsMinimized()
{
OSL_ENSURE( pView, "IsMinimized() without View" );
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index e308a1b..27758f3 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -1644,6 +1644,15 @@ void SfxViewShell::NotifyCursor(SfxViewShell* /*pViewShell*/) const
{
}
+bool SfxViewShell::UseLOKOutputDevice(const OutputDevice* /*pOutputDevice*/) const
+{
+ return false;
+}
+
+void SfxViewShell::InvalidateWindows(std::function<void (vcl::Window& )>& /*f*/)
+{
+}
+
void SfxViewShell::setTiledSearching(bool bTiledSearching)
{
pImp->m_bTiledSearching = bTiledSearching;
diff --git a/svx/source/svdraw/sdrpagewindow.cxx b/svx/source/svdraw/sdrpagewindow.cxx
index 642c867..1932215 100644
--- a/svx/source/svdraw/sdrpagewindow.cxx
+++ b/svx/source/svdraw/sdrpagewindow.cxx
@@ -37,6 +37,9 @@
#include <svx/fmview.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
+#include <comphelper/lok.hxx>
+#include <sfx2/lokhelper.hxx>
using namespace ::com::sun::star;
@@ -404,14 +407,10 @@ void SdrPageWindow::RedrawLayer( const SdrLayerID* pId, sdr::contact::ViewObject
// reset redirector
GetObjectContact().SetViewObjectContactRedirector(nullptr);
}
-
-// Invalidate call, used from ObjectContact(OfPageView) in InvalidatePartOfView(...)
-void SdrPageWindow::InvalidatePageWindow(const basegfx::B2DRange& rRange)
-{
- if(GetPageView().IsVisible() && GetPaintWindow().OutputToWindow())
+namespace {
+ void lcl_InvalidateWindow(const basegfx::B2DRange& rRange, vcl::Window& rWindow)
{
const SvtOptionsDrawinglayer aDrawinglayerOpt;
- vcl::Window& rWindow(static_cast< vcl::Window& >(GetPaintWindow().GetOutputDevice()));
basegfx::B2DRange aDiscreteRange(rRange);
aDiscreteRange.transform(rWindow.GetViewTransformation());
@@ -433,6 +432,41 @@ void SdrPageWindow::InvalidatePageWindow(const basegfx::B2DRange& rRange)
rWindow.Invalidate(aVCLDiscreteRectangle, InvalidateFlags::NoErase);
rWindow.EnableMapMode(bWasMapModeEnabled);
}
+} // end of anonymous namespace
+
+// Invalidate call, used from ObjectContact(OfPageView) in InvalidatePartOfView(...)
+void SdrPageWindow::InvalidatePageWindow(const basegfx::B2DRange& rRange)
+{
+ if (!GetPageView().IsVisible())
+ return;
+ SdrPaintWindow& rPaintWindow = GetPaintWindow();
+
+ if (comphelper::LibreOfficeKit::isActive())
+ {
+ SfxViewShell* pCurViewShell = SfxViewShell::Current();
+ if (pCurViewShell)
+ {
+ OutputDevice& rOutDev = rPaintWindow.GetOutputDevice();
+ if (pCurViewShell->UseLOKOutputDevice(&rOutDev))
+ {
+ std::function<void(vcl::Window&)> lInvalidateWindow =
+ std::bind(lcl_InvalidateWindow, rRange, std::placeholders::_1);
+
+ SfxViewShell* pViewShell = SfxViewShell::GetFirst();
+ while (pViewShell)
+ {
+ pViewShell->InvalidateWindows(lInvalidateWindow);
+ pViewShell = SfxViewShell::GetNext(*pViewShell);
+ }
+ }
+ }
+ }
+
+ if(rPaintWindow.OutputToWindow())
+ {
+ vcl::Window& rWindow(static_cast< vcl::Window& >(rPaintWindow.GetOutputDevice()));
+ lcl_InvalidateWindow(rRange, rWindow);
+ }
}
// ObjectContact section
More information about the Libreoffice-commits
mailing list