include/svx/svdcrtv.hxx                        |    3 +
 svx/source/svdraw/svdcrtv.cxx                  |   45 +++++++++++++------------
 sw/qa/extras/tiledrendering/tiledrendering.cxx |    6 ++-
 sw/source/core/frmedt/feshview.cxx             |    1 
 vcl/source/window/paint.cxx                    |    4 +-
 5 files changed, 37 insertions(+), 22 deletions(-)

New commits:
commit 6235787feb0377a28d26e5764b78266af1e4dc90
Author:     Jan Holesovsky <[email protected]>
AuthorDate: Sun Feb 10 11:57:58 2019 +0100
Commit:     Jan Holesovsky <[email protected]>
CommitDate: Wed Oct 9 10:34:46 2019 +0200

    lok: Fix the font previews in eg. Format -> Character... dialog.
    
    Change-Id: I5d25249c58f55c501e3e5610419753a68423b0f2
    Reviewed-on: https://gerrit.libreoffice.org/67613
    Tested-by: Jenkins
    Reviewed-by: Jan Holesovsky <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/80261
    Tested-by: Jan Holesovsky <[email protected]>

diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index 979adc09dd0a..b7b8893be618 100644
--- a/vcl/source/window/paint.cxx
+++ b/vcl/source/window/paint.cxx
@@ -1401,9 +1401,11 @@ void Window::ImplPaintToDevice( OutputDevice* 
i_pTargetOutDev, const Point& i_rP
         if (!IsPaintTransparent() && IsBackground() && ! (GetParentClipMode() 
& ParentClipMode::NoClip))
             Erase(*pDevice);
 
+        pDevice->SetMapMode(GetMapMode());
+
         Paint(*pDevice, tools::Rectangle(Point(), GetOutputSizePixel()));
 
-        i_pTargetOutDev->DrawOutDev(i_rPos, aSize, Point(), aSize, *pDevice);
+        i_pTargetOutDev->DrawOutDev(i_rPos, aSize, Point(), 
pDevice->PixelToLogic(aSize), *pDevice);
 
         // get rid of virtual device now so they don't pile up during 
recursive calls
         pDevice.disposeAndClear();
commit 663e37e85ef99bd2f88dd5681ce82f0fc32b5dd9
Author:     Jan Holesovsky <[email protected]>
AuthorDate: Fri Jan 25 14:40:40 2019 +0100
Commit:     Jan Holesovsky <[email protected]>
CommitDate: Wed Oct 9 10:34:22 2019 +0200

    sw: Ctrl + shape insertion was not setting up the layer.
    
    The consequence was that the shapes were inserted into the background
    layer.
    
    The problem was particularly visible with the LOK, but reproducible on
    the desktop too.
    
    Includes unit test.
    
    Change-Id: I16137331f944101e25679ec8c4a034bea658bc57
    Reviewed-on: https://gerrit.libreoffice.org/66917
    Tested-by: Jenkins
    Reviewed-by: Jan Holesovsky <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/80260
    Tested-by: Jan Holesovsky <[email protected]>

diff --git a/include/svx/svdcrtv.hxx b/include/svx/svdcrtv.hxx
index 9b6a08e8f93b..2b1941373fb0 100644
--- a/include/svx/svdcrtv.hxx
+++ b/include/svx/svdcrtv.hxx
@@ -118,6 +118,9 @@ public:
     bool IsCreateObj() const { return pCurrentCreate!=nullptr; }
     SdrObject* GetCreateObj() const { return pCurrentCreate; }
 
+    /// Setup layer (eg. foreground / background) of the given object.
+    static void SetupObjLayer(const SdrPageView* pPageView, const OUString& 
aActiveLayer, SdrObject* pObj);
+
     // BegCreateCaptionObj() creates a SdrCaptionObj (legend item).
     // rObjSiz is the initial size of the legend text frame.
     // Only the length of the tip is dragged
diff --git a/svx/source/svdraw/svdcrtv.cxx b/svx/source/svdraw/svdcrtv.cxx
index 5578cb193198..4f4be197c9c1 100644
--- a/svx/source/svdraw/svdcrtv.cxx
+++ b/svx/source/svdraw/svdcrtv.cxx
@@ -569,6 +569,30 @@ void SdrCreateView::MovCreateObj(const Point& rPnt)
     }
 }
 
+void SdrCreateView::SetupObjLayer(const SdrPageView* pPageView, const 
OUString& aActiveLayer, SdrObject* pObj)
+{
+    const SdrLayerAdmin& rAd = pPageView->GetPage()->GetLayerAdmin();
+    SdrLayerID nLayer(0);
+
+    // #i72535#
+    if(dynamic_cast<const FmFormObj*>( pObj) !=  nullptr)
+    {
+        // for FormControls, force to form layer
+        nLayer = rAd.GetLayerID(rAd.GetControlLayerName());
+    }
+    else
+    {
+        nLayer = rAd.GetLayerID(aActiveLayer);
+    }
+
+    if(SDRLAYER_NOTFOUND == nLayer)
+    {
+        nLayer = SdrLayerID(0);
+    }
+
+    pObj->SetLayer(nLayer);
+}
+
 bool SdrCreateView::EndCreateObj(SdrCreateCmd eCmd)
 {
     bool bRet=false;
@@ -599,26 +623,7 @@ bool SdrCreateView::EndCreateObj(SdrCreateCmd eCmd)
                 SdrObject* pObj=pCurrentCreate;
                 pCurrentCreate=nullptr;
 
-                const SdrLayerAdmin& rAd = 
pCreatePV->GetPage()->GetLayerAdmin();
-                SdrLayerID nLayer(0);
-
-                // #i72535#
-                if(dynamic_cast<const FmFormObj*>( pObj) !=  nullptr)
-                {
-                    // for FormControls, force to form layer
-                    nLayer = rAd.GetLayerID(rAd.GetControlLayerName());
-                }
-                else
-                {
-                    nLayer = rAd.GetLayerID(maActualLayer);
-                }
-
-                if(SDRLAYER_NOTFOUND == nLayer)
-                {
-                    nLayer = SdrLayerID(0);
-                }
-
-                pObj->SetLayer(nLayer);
+                SetupObjLayer(pCreatePV, maActualLayer, pObj);
 
                 // recognize creation of a new 3D object inside a 3D scene
                 bool bSceneIntoScene(false);
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx 
b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 3a13c1649576..3a3fbf4e162e 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -500,9 +500,13 @@ void SwTiledRenderingTest::testInsertShape()
     comphelper::dispatchCommand(".uno:BasicShapes.circle", 
uno::Sequence<beans::PropertyValue>());
 
     // check that the shape was inserted in the visible area, not outside
-    SdrPage* pPage = 
pWrtShell->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
+    IDocumentDrawModelAccess &rDrawModelAccess = 
pWrtShell->GetDoc()->getIDocumentDrawModelAccess();
+    SdrPage* pPage = rDrawModelAccess.GetDrawModel()->GetPage(0);
     SdrObject* pObject = pPage->GetObj(0);
     CPPUNIT_ASSERT_EQUAL(tools::Rectangle(2736, 868, 7264, 3132), 
pObject->GetSnapRect());
+
+    // check that it is in the foreground layer
+    CPPUNIT_ASSERT_EQUAL(rDrawModelAccess.GetHeavenId().get(), 
pObject->GetLayer().get());
 }
 
 static void lcl_search(bool bBackward)
diff --git a/sw/source/core/frmedt/feshview.cxx 
b/sw/source/core/frmedt/feshview.cxx
index 69bfd77ca14e..c18e91fd1694 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -3149,6 +3149,7 @@ long SwFEShell::GetSectionWidth( SwFormat const & rFormat 
) const
             }
         }
         SdrPageView* pPageView = pDrawView->GetSdrPageView();
+        SdrCreateView::SetupObjLayer(pPageView, pDrawView->GetActiveLayer(), 
pObj);
         pDrawView->InsertObjectAtView(pObj, *pPageView);
     }
     ImpEndCreate();
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to