[Libreoffice-commits] core.git: 2 commits - sw/source

Michael Stahl mstahl at redhat.com
Fri Dec 16 16:42:38 UTC 2016


 sw/source/core/access/accfrmobj.cxx |   11 ++++++++---
 sw/source/core/draw/dcontact.cxx    |    9 ++++++++-
 2 files changed, 16 insertions(+), 4 deletions(-)

New commits:
commit ae3ec0d53a22ae5d2b7fb244a6056d0627b71873
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Dec 16 17:21:48 2016 +0100

    tdf#91260 sw: fix nasty corner case of SdrGroupObject in header
    
    or footer.  Some very special handling going on to paint these in
    VOCOfDrawVirtObj with a GetSwDrawVirtObj().GetOffset() added;
    they are falsely identified as invisible because their
    sub-objects have an anchor set but it is always on the first page
    so to properly check them we'd have to add the same GetOffset()
    thing but checking the top-level object should be sufficient.
    
    (regression from 689cead9e0837dc932e3a4cd765f7d319b529018)
    
    Change-Id: Ida6fcd41948f46410ca02193549e426bc9dae8c5

diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index 4d8d224..a1651f6 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -2117,6 +2117,13 @@ namespace sdr
 
         drawinglayer::primitive2d::Primitive2DContainer VOCOfDrawVirtObj::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const
         {
+            // tdf#91260 have already checked top-level one is on the right page
+            assert(isPrimitiveVisible(rDisplayInfo));
+            // nasty corner case: override to clear page frame to disable the
+            // sub-objects' anchor check, because their anchor is always on
+            // the first page that the page style is applied to
+            DisplayInfo aDisplayInfo(rDisplayInfo);
+            aDisplayInfo.SetWriterPageFrame(basegfx::B2IRectangle());
             const VCOfDrawVirtObj& rVC = static_cast< const VCOfDrawVirtObj& >(GetViewContact());
             const SdrObject& rReferencedObject = rVC.GetSwDrawVirtObj().GetReferencedObj();
             drawinglayer::primitive2d::Primitive2DContainer xRetval;
@@ -2141,7 +2148,7 @@ namespace sdr
 
                 // Get the VOC of the referenced object (the Group) and fetch primitives from it
                 const ViewObjectContact& rVOCOfRefObj = rReferencedObject.GetViewContact().GetViewObjectContact(GetObjectContact());
-                impAddPrimitivesFromGroup(rVOCOfRefObj, aOffsetMatrix, rDisplayInfo, xRetval);
+                impAddPrimitivesFromGroup(rVOCOfRefObj, aOffsetMatrix, aDisplayInfo, xRetval);
             }
             else
             {
commit bdd1a03b450f9f8a0ead46c38bec58f6879b2c5d
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Dec 16 15:49:19 2016 +0100

    tdf#101464 tdf#91260 tdf#104620 sw: fix null SwPageFrame crash
    
    It turns out that draw objects in header/footer often don't have
    AnchoredObject::mpPageFrame set, so use FindPageFrameOfAnchor()
    instead.
    
    (regression from ae06f4be6bbdebc10a88c386064d548848e57f80)
    
    Change-Id: I6d54baa3acffa6775d5b57a1517c77a964065dd0

diff --git a/sw/source/core/access/accfrmobj.cxx b/sw/source/core/access/accfrmobj.cxx
index bc7f06d..3c6b3e5 100644
--- a/sw/source/core/access/accfrmobj.cxx
+++ b/sw/source/core/access/accfrmobj.cxx
@@ -257,14 +257,19 @@ SwRect SwAccessibleChild::GetBox( const SwAccessibleMap& rAccMap ) const
     }
     else if( mpDrawObj )
     {
-        aBox = SwRect( mpDrawObj->GetCurrentBoundRect() );
         SwDrawContact const*const pContact(dynamic_cast<SwDrawContact const*>(::GetUserCall(mpDrawObj)));
         // assume that a) the SwVirt* objects that don't have this are handled
         // by the mpFrame case above b) for genuine SdrObject this must be set
         // if it's connected to layout
         assert(pContact);
-        // tdf#91260 drawing object may be partially off-page
-        aBox.Intersection(pContact->GetPageFrame()->Frame());
+        SwPageFrame const*const pPage(const_cast<SwAnchoredObject *>(
+            pContact->GetAnchoredObj(mpDrawObj))->FindPageFrameOfAnchor());
+        if (pPage) // may end up here with partial layout -> not visible
+        {
+            aBox = SwRect( mpDrawObj->GetCurrentBoundRect() );
+            // tdf#91260 drawing object may be partially off-page
+            aBox.Intersection(pPage->Frame());
+        }
     }
     else if ( mpWindow )
     {


More information about the Libreoffice-commits mailing list