From a2759b539bcd7bf2e7b88caa2f78c0215230d026 Mon Sep 17 00:00:00 2001 From: Szymon Kłos Date: Mon, 1 Aug 2022 16:06:11 +0200 Subject: lok: Dont render active text edit on slide previews - extend ITiledRenderable interface to pass active text edit drawing state to the SdXImpressDocument - when painting tiles - allow text edit only for current part - pass new setting also to SdrPaintView where painting happens Change-Id: Ib4ff226961a76129f4f5ff11c90694cd46a83a6b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137676 Tested-by: Jenkins CollaboraOffice Reviewed-by: Mert Tumer Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137840 --- desktop/source/lib/init.cxx | 12 ++++++++++++ include/svx/svdpntv.hxx | 4 ++++ include/vcl/ITiledRenderable.hxx | 5 +++++ sd/source/ui/inc/unomodel.hxx | 4 ++++ sd/source/ui/unoidl/unomodel.cxx | 13 +++++++++++-- svx/source/svdraw/svdpntv.cxx | 4 +++- 6 files changed, 39 insertions(+), 3 deletions(-) diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index e787252525fb..4abe6f2c5166 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3679,8 +3679,20 @@ static void doc_paintPartTile(LibreOfficeKitDocument* pThis, } } + ITiledRenderable* pDoc = getTiledRenderable(pThis); + if (!pDoc) + { + SetLastExceptionMsg("Document doesn't support tiled rendering"); + return; + } + + bool bPaintTextEdit = nPart == nOrigPart; + pDoc->setPaintTextEdit( bPaintTextEdit ); + doc_paintTile(pThis, pBuffer, nCanvasWidth, nCanvasHeight, nTilePosX, nTilePosY, nTileWidth, nTileHeight); + pDoc->setPaintTextEdit( true ); + if (!isText && nPart != nOrigPart) { doc_setPartImpl(pThis, nOrigPart, false); diff --git a/include/svx/svdpntv.hxx b/include/svx/svdpntv.hxx index ad68da20dec2..1f46fc584800 100644 --- a/include/svx/svdpntv.hxx +++ b/include/svx/svdpntv.hxx @@ -193,6 +193,7 @@ protected: bool mbHideChart : 1; bool mbHideDraw : 1; // hide draw objects other than form controls bool mbHideFormControl : 1; // hide form controls only + bool mbPaintTextEdit : 1; // if should paint currently edited text public: // Interface for PagePaintingAllowed flag @@ -506,6 +507,9 @@ public: // Access to Drawinglayer configuration options const SvtOptionsDrawinglayer& getOptionsDrawinglayer() const { return maDrawinglayerOpt; } + + /// @see vcl::ITiledRenderable::setPaintTextEdit(). + void SetPaintTextEdit(bool bPaint) { mbPaintTextEdit = bPaint; } }; #endif // INCLUDED_SVX_SVDPNTV_HXX diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx index 306623234776..dceb4c9f462d 100644 --- a/include/vcl/ITiledRenderable.hxx +++ b/include/vcl/ITiledRenderable.hxx @@ -337,6 +337,11 @@ public: { return std::vector(); } + + /** + * Allow / disable drawing current text edit (used in Impress for slide previews) + */ + virtual void setPaintTextEdit(bool) {} }; } // namespace vcl diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx index 65614db92742..78e0c03b5b53 100644 --- a/sd/source/ui/inc/unomodel.hxx +++ b/sd/source/ui/inc/unomodel.hxx @@ -118,6 +118,8 @@ private: OUString maBuildId; + bool mbPaintTextEdit; + void initializeDocument(); sd::DrawViewShell* GetViewShell(); @@ -277,6 +279,8 @@ public: { return mbDisposed; } + /// @see vcl::ITiledRenderable::setPaintTextEdit(). + virtual void setPaintTextEdit(bool bPaint) override { mbPaintTextEdit = bPaint; } // XComponent diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 35caf84d649a..66ffac07e200 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -236,7 +236,8 @@ SdXImpressDocument::SdXImpressDocument(::sd::DrawDocShell* pShell, bool bClipBoa mbDisposed(false), mbImpressDoc( pShell && pShell->GetDoc() && pShell->GetDoc()->GetDocumentType() == DocumentType::Impress ), mbClipBoard( bClipBoard ), - mpPropSet( ImplGetDrawModelPropertySet() ) + mpPropSet( ImplGetDrawModelPropertySet() ), + mbPaintTextEdit( true ) { if( mpDoc ) { @@ -255,7 +256,8 @@ SdXImpressDocument::SdXImpressDocument(SdDrawDocument* pDoc, bool bClipBoard) mbDisposed(false), mbImpressDoc( pDoc && pDoc->GetDocumentType() == DocumentType::Impress ), mbClipBoard( bClipBoard ), - mpPropSet( ImplGetDrawModelPropertySet() ) + mpPropSet( ImplGetDrawModelPropertySet() ), + mbPaintTextEdit( true ) { if( mpDoc ) { @@ -2278,8 +2280,15 @@ void SdXImpressDocument::paintTile( VirtualDevice& rDevice, Size aSize(nTileWidthHMM, nTileHeightHMM); ::tools::Rectangle aRect(aPoint, aSize); + SdrView* pView = pViewSh->GetDrawView(); + if (comphelper::LibreOfficeKit::isActive()) + pView->SetPaintTextEdit(mbPaintTextEdit); + pViewSh->GetView()->CompleteRedraw(&rDevice, vcl::Region(aRect)); + if (comphelper::LibreOfficeKit::isActive()) + pView->SetPaintTextEdit(true); + LokChartHelper::PaintAllChartsOnTile(rDevice, nOutputWidth, nOutputHeight, nTilePosX, nTilePosY, nTileWidth, nTileHeight); diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx index 05dbeb02d2a6..61da840dda2d 100644 --- a/svx/source/svdraw/svdpntv.cxx +++ b/svx/source/svdraw/svdpntv.cxx @@ -160,6 +160,7 @@ SdrPaintView::SdrPaintView(SdrModel& rSdrModel, OutputDevice* pOut) , mbHideChart(false) , mbHideDraw(false) , mbHideFormControl(false) + , mbPaintTextEdit(true) , maGridColor(COL_BLACK) { maComeBackIdle.SetPriority(TaskPriority::REPAINT); @@ -638,7 +639,8 @@ void SdrPaintView::EndCompleteRedraw(SdrPaintWindow& rPaintWindow, bool bPaintFo // early and paint text edit to window. if(IsTextEdit() && GetSdrPageView()) { - static_cast< SdrView* >(this)->TextEditDrawing(rPaintWindow); + if (!comphelper::LibreOfficeKit::isActive() || mbPaintTextEdit) + static_cast< SdrView* >(this)->TextEditDrawing(rPaintWindow); } if (comphelper::LibreOfficeKit::isActive()) -- cgit v1.2.3