diff options
author | Jan Holesovsky <kendy@collabora.com> | 2019-01-25 14:40:40 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2019-01-30 07:29:52 +0100 |
commit | b6b28931435e44aca92b8c0e1659f701e3ed1a87 (patch) | |
tree | 722eaccb5cbb0e596f9d75bd6176d47708f61a7f /svx | |
parent | c2c60eb9969716ef91a83952203948b5e334ec85 (diff) |
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 <kendy@collabora.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/svdraw/svdcrtv.cxx | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/svx/source/svdraw/svdcrtv.cxx b/svx/source/svdraw/svdcrtv.cxx index 911481038d79..711080113382 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); |