diff options
-rw-r--r-- | include/svx/sdr/contact/viewcontact.hxx | 5 | ||||
-rw-r--r-- | svx/source/sdr/contact/viewcontact.cxx | 14 |
2 files changed, 18 insertions, 1 deletions
diff --git a/include/svx/sdr/contact/viewcontact.hxx b/include/svx/sdr/contact/viewcontact.hxx index c7119fcd93e2..eee3ea6f11cb 100644 --- a/include/svx/sdr/contact/viewcontact.hxx +++ b/include/svx/sdr/contact/viewcontact.hxx @@ -46,6 +46,11 @@ private: // Registering and de-registering is done in the VOC constructors/destructors. std::vector<ViewObjectContact*> maViewObjectContactVector; + // Primitive2DContainer of the ViewContact. This contains all necessary information + // for the graphical visualisation and needs to be supported by all VCs which + // can be visualized. + drawinglayer::primitive2d::Primitive2DContainer mxViewIndependentPrimitive2DSequence; + // A new ViewObjectContact was created and shall be remembered. void AddViewObjectContact(ViewObjectContact& rVOContact); diff --git a/svx/source/sdr/contact/viewcontact.cxx b/svx/source/sdr/contact/viewcontact.cxx index 1723a6bb91e8..52cca39d7057 100644 --- a/svx/source/sdr/contact/viewcontact.cxx +++ b/svx/source/sdr/contact/viewcontact.cxx @@ -104,7 +104,9 @@ void ViewContact::RemoveViewObjectContact(ViewObjectContact& rVOContact) maViewObjectContactVector.begin(), maViewObjectContactVector.end(), &rVOContact); if (aFindResult != maViewObjectContactVector.end()) + { maViewObjectContactVector.erase(aFindResult); + } } // Test if this ViewContact has ViewObjectContacts at all. This can @@ -229,6 +231,9 @@ ViewContact::createViewIndependentPrimitive2DSequence() const drawinglayer::primitive2d::Primitive2DContainer ViewContact::getViewIndependentPrimitive2DContainer() const { + /* Local up-to-date checks. Create new list and compare. + We cannot just always use the new data because the old data has cached bitmaps in it e.g. see the document in tdf#146108. + */ drawinglayer::primitive2d::Primitive2DContainer xNew( createViewIndependentPrimitive2DSequence()); @@ -238,7 +243,14 @@ ViewContact::getViewIndependentPrimitive2DContainer() const xNew = embedToObjectSpecificInformation(std::move(xNew)); } - return xNew; + if (mxViewIndependentPrimitive2DSequence != xNew) + { + // has changed, copy content + const_cast<ViewContact*>(this)->mxViewIndependentPrimitive2DSequence = std::move(xNew); + } + + // return current Primitive2DContainer + return mxViewIndependentPrimitive2DSequence; } // add Gluepoints (if available) |