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(-)

New commits:
commit 39e3a346c0978625a7f84fd2db647d4c164071ca
Author:     Szymon Kłos <[email protected]>
AuthorDate: Mon Aug 1 16:06:11 2022 +0200
Commit:     Szymon Kłos <[email protected]>
CommitDate: Thu Aug 4 11:08:02 2022 +0200

    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 <[email protected]>
    Reviewed-by: Mert Tumer <[email protected]>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 04672fb1ba34..b694ed1b8642 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3675,8 +3675,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 557846fe01d8..7dfceb7242b4 100644
--- a/include/svx/svdpntv.hxx
+++ b/include/svx/svdpntv.hxx
@@ -189,6 +189,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
@@ -499,6 +500,9 @@ public:
     // #i38135#
     // Sets the timer for Object animations and restarts.
     void SetAnimationTimer(sal_uInt32 nTime);
+
+    /// @see vcl::ITiledRenderable::setPaintTextEdit().
+    void SetPaintTextEdit(bool bPaint) { mbPaintTextEdit = bPaint; }
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index 3c0a4cacabe0..32a9a0010ef9 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -343,6 +343,11 @@ public:
      * E.g. select a list item from a drop down content control.
      */
     virtual void executeContentControlEvent(const StringMap&) {}
+
+    /**
+     *  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 cf88666f69bc..74e21ed44131 100644
--- a/sd/source/ui/inc/unomodel.hxx
+++ b/sd/source/ui/inc/unomodel.hxx
@@ -117,6 +117,8 @@ private:
 
     OUString   maBuildId;
 
+    bool mbPaintTextEdit;
+
     void initializeDocument();
 
     sd::DrawViewShell* GetViewShell();
@@ -275,6 +277,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 8af88de53951..78b39b6ff0ed 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -237,7 +237,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 )
     {
@@ -256,7 +257,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 )
     {
@@ -2270,8 +2272,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 a069edfe3362..68345e345bdc 100644
--- a/svx/source/svdraw/svdpntv.cxx
+++ b/svx/source/svdraw/svdpntv.cxx
@@ -163,6 +163,7 @@ SdrPaintView::SdrPaintView(SdrModel& rSdrModel, 
OutputDevice* pOut)
     , mbHideChart(false)
     , mbHideDraw(false)
     , mbHideFormControl(false)
+    , mbPaintTextEdit(true)
     , maGridColor(COL_BLACK)
 {
     maComeBackIdle.SetPriority(TaskPriority::REPAINT);
@@ -640,7 +641,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())

Reply via email to