Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/1869

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/69/1869/1

fdo#59056: Re-calculate cell anchor position of a pasted drawing object.

Else it would re-use the anchor position of the original one (minus the
sheet index which is correctly adjusted).

Change-Id: I52d11eb9953ee7539c9d5da41edd7dd28604587c
---
M sc/inc/drwlayer.hxx
M sc/source/core/data/drwlayer.cxx
M sc/source/ui/view/viewfun7.cxx
3 files changed, 14 insertions(+), 2 deletions(-)



diff --git a/sc/inc/drwlayer.hxx b/sc/inc/drwlayer.hxx
index 298d619..72b980d 100644
--- a/sc/inc/drwlayer.hxx
+++ b/sc/inc/drwlayer.hxx
@@ -166,6 +166,7 @@
     String          GetNewGraphicName( long* pnCounter = NULL ) const;
     void            EnsureGraphicNames();
 
+    static bool IsCellAnchored( const SdrObject& rObj );
     static void             SetPageAnchored( SdrObject& );
     static void             SetCellAnchored( SdrObject&, const ScDrawObjData &rAnchor );
     // Updates rAnchor based on position of rObj
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 76d6794..8ea4fca 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -1787,6 +1787,13 @@
         pAnchor->maEndOffset.X() = aCellRect.Right()-aObjRect.Left();
 }
 
+bool ScDrawLayer::IsCellAnchored( const SdrObject& rObj )
+{
+    // Cell anchored object always has a user data, to store the anchor cell
+    // info. If it doesn't then it's page-anchored.
+    return GetFirstUserDataOfType(&rObj, SC_UD_OBJDATA) != NULL;
+}
+
 void ScDrawLayer::SetPageAnchored( SdrObject &rObj )
 {
     DeleteFirstUserDataOfType(&rObj, SC_UD_OBJDATA);
diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx
index c69dc65..63e2f1a 100644
--- a/sc/source/ui/view/viewfun7.cxx
+++ b/sc/source/ui/view/viewfun7.cxx
@@ -172,8 +172,8 @@
                     pDestPage->InsertObject( pNeuObj );
                     pScDrawView->AddUndo(new SdrUndoInsertObj( *pNeuObj ));
 
-                    //  Chart braucht nicht mehr getrennt behandelt zu werden,
-                    //  weil es seine Daten jetzt selber hat
+                    if (ScDrawLayer::IsCellAnchored(*pNeuObj))
+                        ScDrawLayer::SetCellAnchoredFromPosition(*pNeuObj, 
*GetViewData()->GetDocument(), nTab);
                 }
             }
 
@@ -238,6 +238,10 @@
             {
                 if ( pObject->ISA(SdrUnoObj) && pObject->GetLayer() != SC_LAYER_CONTROLS )
                     pObject->NbcSetLayer(SC_LAYER_CONTROLS);
+
+                if (ScDrawLayer::IsCellAnchored(*pObject))
+                    ScDrawLayer::SetCellAnchoredFromPosition(*pObject, 
*GetViewData()->GetDocument(), nTab);
+
                 pObject = aIter.Next();
             }
         }

-- 
To view, visit https://gerrit.libreoffice.org/1869
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I52d11eb9953ee7539c9d5da41edd7dd28604587c
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Kohei Yoshida <kohei.yoshida@gmail.com>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.