summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
authorThierry Emery <thierryalemery@gmail.com>2022-08-08 22:07:40 +0200
committerSamuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>2022-08-15 13:17:04 +0200
commitdbd104083dc4cc22075556811e67b5c81ef688ae (patch)
tree6f8da726af4ff996f1f54269ecd31c9fa6598c4d /sc/source/ui
parent203eaefb4ac012c36a1ecdd3753e1cb2c5876efc (diff)
tdf#133299 Anchor pasted images 'to cell' by default
This is already the default when inserting images via menu, do this also when pasting images from other applications (currently it would anchor 'to page'). Change-Id: I5e1d010b026fc8eba2d3a7cca80ea96814a2ebe8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138005 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/view/cliputil.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/sc/source/ui/view/cliputil.cxx b/sc/source/ui/view/cliputil.cxx
index bbf80bce33ad..770e309dbe97 100644
--- a/sc/source/ui/view/cliputil.cxx
+++ b/sc/source/ui/view/cliputil.cxx
@@ -81,7 +81,19 @@ void ScClipUtil::PasteFromClipboard( ScViewData& rViewData, ScTabViewShell* pTab
// normal paste
weld::WaitObject aWait( rViewData.GetDialogParent() );
if (!pOwnClip)
+ {
pTabViewShell->PasteFromSystem();
+ // Anchor To Cell rather than To Page
+ ScDrawView* pDrawView = pTabViewShell->GetScDrawView();
+ if(pDrawView && 1 == pDrawView->GetMarkedObjectCount())
+ {
+ SdrObject* pPickObj = pDrawView->GetMarkedObjectByIndex(0);
+ if(pPickObj)
+ {
+ ScDrawLayer::SetCellAnchoredFromPosition( *pPickObj, rThisDoc, nThisTab, false );
+ }
+ }
+ }
else
{
ScDocument* pClipDoc = pOwnClip->GetDocument();