summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-11-04 12:57:56 -0500
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-11-04 12:59:32 -0500
commit50228d22a62ecfbc974130f2ff3f7c4e03a9a033 (patch)
tree0a3ca168fa9fbcffdc4987b502d7b8b5975e6c24 /svx
parent024a5d79e101b26d23054e1906505810210d4e56 (diff)
Unindent.
Change-Id: Ib274ec26768e8a3bd1006601679404799fed986a
Diffstat (limited to 'svx')
-rw-r--r--svx/inc/sdr/contact/viewcontactofsdrole2obj.hxx91
-rw-r--r--svx/source/sdr/contact/viewcontact.cxx498
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrole2obj.cxx321
3 files changed, 448 insertions, 462 deletions
diff --git a/svx/inc/sdr/contact/viewcontactofsdrole2obj.hxx b/svx/inc/sdr/contact/viewcontactofsdrole2obj.hxx
index 29fc2dfa8092..1e1c8959fb85 100644
--- a/svx/inc/sdr/contact/viewcontactofsdrole2obj.hxx
+++ b/svx/inc/sdr/contact/viewcontactofsdrole2obj.hxx
@@ -24,60 +24,53 @@
#include <svx/svdoole2.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
-
-// predeclarations
-
class Graphic;
+namespace sdr { namespace contact {
-
-namespace sdr
+class ViewContactOfSdrOle2Obj : public ViewContactOfSdrRectObj
{
- namespace contact
+private:
+ // #i123539# allow local buffering of chart data (if chart)
+ drawinglayer::primitive2d::Primitive2DReference mxChartContent;
+
+protected:
+ // Create a Object-Specific ViewObjectContact, set ViewContact and
+ // ObjectContact. Always needs to return something.
+ virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact) SAL_OVERRIDE;
+
+public:
+ // access to SdrOle2Obj
+ const SdrOle2Obj& GetOle2Obj() const
{
- class ViewContactOfSdrOle2Obj : public ViewContactOfSdrRectObj
- {
- private:
- // #i123539# allow local buffering of chart data (if chart)
- drawinglayer::primitive2d::Primitive2DReference mxChartContent;
-
- protected:
- // Create a Object-Specific ViewObjectContact, set ViewContact and
- // ObjectContact. Always needs to return something.
- virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact) SAL_OVERRIDE;
-
- public:
- // access to SdrOle2Obj
- const SdrOle2Obj& GetOle2Obj() const
- {
- return static_cast<const SdrOle2Obj&>(GetSdrObject());
- }
-
- /// helper to create transformation from SdrObject
- basegfx::B2DHomMatrix createObjectTransform() const;
-
- // basic constructor, used from SdrObject.
- explicit ViewContactOfSdrOle2Obj(SdrOle2Obj& rOle2Obj);
- virtual ~ViewContactOfSdrOle2Obj();
-
- // helper for creating a OLE sequence for this object. It takes care od attributes, needed
- // scaling (e.g. for EmptyPresObj's), the correct graphic and other stuff. It is used from
- // createViewIndependentPrimitive2DSequence with false, and with evtl. HighContrast true
- // from the VOC which knows that
- drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequenceWithParameters() const;
-
- // #i123539# get rid of buffered chart content (if there) on change
- virtual void ActionChanged() SAL_OVERRIDE;
-
- virtual basegfx::B2DRange getRange( const drawinglayer::geometry::ViewInformation2D& rViewInfo2D ) const SAL_OVERRIDE;
-
- protected:
- // This method is responsible for creating the graphical visualisation data
- // ONLY based on model data, just wraps to call createPrimitive2DSequenceWithParameters(false)
- virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const SAL_OVERRIDE;
- };
- } // end of namespace contact
-} // end of namespace sdr
+ return static_cast<const SdrOle2Obj&>(GetSdrObject());
+ }
+
+ /// helper to create transformation from SdrObject
+ basegfx::B2DHomMatrix createObjectTransform() const;
+
+ // basic constructor, used from SdrObject.
+ explicit ViewContactOfSdrOle2Obj(SdrOle2Obj& rOle2Obj);
+ virtual ~ViewContactOfSdrOle2Obj();
+
+ // helper for creating a OLE sequence for this object. It takes care od attributes, needed
+ // scaling (e.g. for EmptyPresObj's), the correct graphic and other stuff. It is used from
+ // createViewIndependentPrimitive2DSequence with false, and with evtl. HighContrast true
+ // from the VOC which knows that
+ drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequenceWithParameters() const;
+
+ // #i123539# get rid of buffered chart content (if there) on change
+ virtual void ActionChanged() SAL_OVERRIDE;
+
+ virtual basegfx::B2DRange getRange( const drawinglayer::geometry::ViewInformation2D& rViewInfo2D ) const SAL_OVERRIDE;
+
+protected:
+ // This method is responsible for creating the graphical visualisation data
+ // ONLY based on model data, just wraps to call createPrimitive2DSequenceWithParameters(false)
+ virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const SAL_OVERRIDE;
+};
+
+}}
diff --git a/svx/source/sdr/contact/viewcontact.cxx b/svx/source/sdr/contact/viewcontact.cxx
index b4c4020d5387..7d0c249225ff 100644
--- a/svx/source/sdr/contact/viewcontact.cxx
+++ b/svx/source/sdr/contact/viewcontact.cxx
@@ -28,310 +28,306 @@
#include <sdr/contact/objectcontactofpageview.hxx>
#include <tools/debug.hxx>
+namespace sdr { namespace contact {
+// Create a Object-Specific ViewObjectContact, set ViewContact and
+// ObjectContact. Always needs to return something. Default is to create
+// a standard ViewObjectContact containing the given ObjectContact and *this
+ViewObjectContact& ViewContact::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
+{
+ return *(new ViewObjectContact(rObjectContact, *this));
+}
-namespace sdr
+ViewContact::ViewContact()
+: maViewObjectContactVector(),
+ mxViewIndependentPrimitive2DSequence()
{
- namespace contact
- {
- // Create a Object-Specific ViewObjectContact, set ViewContact and
- // ObjectContact. Always needs to return something. Default is to create
- // a standard ViewObjectContact containing the given ObjectContact and *this
- ViewObjectContact& ViewContact::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
- {
- return *(new ViewObjectContact(rObjectContact, *this));
- }
+}
- ViewContact::ViewContact()
- : maViewObjectContactVector(),
- mxViewIndependentPrimitive2DSequence()
- {
- }
+// Methods to react on start getting viewed or stop getting
+// viewed. This info is derived from the count of members of
+// registered ViewObjectContacts. Default does nothing.
+void ViewContact::StartGettingViewed()
+{
+}
- // Methods to react on start getting viewed or stop getting
- // viewed. This info is derived from the count of members of
- // registered ViewObjectContacts. Default does nothing.
- void ViewContact::StartGettingViewed()
- {
- }
+void ViewContact::StopGettingViewed()
+{
+}
- void ViewContact::StopGettingViewed()
- {
- }
+ViewContact::~ViewContact()
+{
+ deleteAllVOCs();
+}
- ViewContact::~ViewContact()
- {
- deleteAllVOCs();
- }
+void ViewContact::deleteAllVOCs()
+{
+ // get rid of all VOCs
+ // #i84257# To avoid that each 'delete pCandidate' again uses
+ // the local RemoveViewObjectContact with a search and removal in the
+ // vector, simply copy and clear local vector.
+ std::vector< ViewObjectContact* > aLocalVOCList(maViewObjectContactVector);
+ maViewObjectContactVector.clear();
+
+ while(!aLocalVOCList.empty())
+ {
+ ViewObjectContact* pCandidate = aLocalVOCList.back();
+ aLocalVOCList.pop_back();
+ DBG_ASSERT(pCandidate, "Corrupted ViewObjectContactList in VC (!)");
+
+ // ViewObjectContacts only make sense with View and Object contacts.
+ // When the contact to the SdrObject is deleted like in this case,
+ // all ViewObjectContacts can be deleted, too.
+ delete pCandidate;
+ }
+
+ // assert when there were new entries added during deletion
+ DBG_ASSERT(maViewObjectContactVector.empty(), "Corrupted ViewObjectContactList in VC (!)");
+}
+
+// get a Object-specific ViewObjectContact for a specific
+// ObjectContact (->View). Always needs to return something.
+ViewObjectContact& ViewContact::GetViewObjectContact(ObjectContact& rObjectContact)
+{
+ ViewObjectContact* pRetval = 0L;
+ const sal_uInt32 nCount(maViewObjectContactVector.size());
- void ViewContact::deleteAllVOCs()
- {
- // get rid of all VOCs
- // #i84257# To avoid that each 'delete pCandidate' again uses
- // the local RemoveViewObjectContact with a search and removal in the
- // vector, simply copy and clear local vector.
- std::vector< ViewObjectContact* > aLocalVOCList(maViewObjectContactVector);
- maViewObjectContactVector.clear();
-
- while(!aLocalVOCList.empty())
- {
- ViewObjectContact* pCandidate = aLocalVOCList.back();
- aLocalVOCList.pop_back();
- DBG_ASSERT(pCandidate, "Corrupted ViewObjectContactList in VC (!)");
-
- // ViewObjectContacts only make sense with View and Object contacts.
- // When the contact to the SdrObject is deleted like in this case,
- // all ViewObjectContacts can be deleted, too.
- delete pCandidate;
- }
+ // first search if there exists a VOC for the given OC
+ for(sal_uInt32 a(0); !pRetval && a < nCount; a++)
+ {
+ ViewObjectContact* pCandidate = maViewObjectContactVector[a];
+ DBG_ASSERT(pCandidate, "Corrupted ViewObjectContactList (!)");
- // assert when there were new entries added during deletion
- DBG_ASSERT(maViewObjectContactVector.empty(), "Corrupted ViewObjectContactList in VC (!)");
+ if(&(pCandidate->GetObjectContact()) == &rObjectContact)
+ {
+ pRetval = pCandidate;
}
+ }
- // get a Object-specific ViewObjectContact for a specific
- // ObjectContact (->View). Always needs to return something.
- ViewObjectContact& ViewContact::GetViewObjectContact(ObjectContact& rObjectContact)
- {
- ViewObjectContact* pRetval = 0L;
- const sal_uInt32 nCount(maViewObjectContactVector.size());
+ if(!pRetval)
+ {
+ // create a new one. It's inserted to the local list from the
+ // ViewObjectContact constructor via AddViewObjectContact()
+ pRetval = &CreateObjectSpecificViewObjectContact(rObjectContact);
+ }
- // first search if there exists a VOC for the given OC
- for(sal_uInt32 a(0); !pRetval && a < nCount; a++)
- {
- ViewObjectContact* pCandidate = maViewObjectContactVector[a];
- DBG_ASSERT(pCandidate, "Corrupted ViewObjectContactList (!)");
+ return *pRetval;
+}
- if(&(pCandidate->GetObjectContact()) == &rObjectContact)
- {
- pRetval = pCandidate;
- }
- }
+// A new ViewObjectContact was created and shall be remembered.
+void ViewContact::AddViewObjectContact(ViewObjectContact& rVOContact)
+{
+ maViewObjectContactVector.push_back(&rVOContact);
- if(!pRetval)
- {
- // create a new one. It's inserted to the local list from the
- // ViewObjectContact constructor via AddViewObjectContact()
- pRetval = &CreateObjectSpecificViewObjectContact(rObjectContact);
- }
+ if(1L == maViewObjectContactVector.size())
+ {
+ StartGettingViewed();
+ }
+}
- return *pRetval;
- }
+// A ViewObjectContact was deleted and shall be forgotten.
+void ViewContact::RemoveViewObjectContact(ViewObjectContact& rVOContact)
+{
+ std::vector< ViewObjectContact* >::iterator aFindResult = std::find(maViewObjectContactVector.begin(), maViewObjectContactVector.end(), &rVOContact);
- // A new ViewObjectContact was created and shall be remembered.
- void ViewContact::AddViewObjectContact(ViewObjectContact& rVOContact)
- {
- maViewObjectContactVector.push_back(&rVOContact);
+ if(aFindResult != maViewObjectContactVector.end())
+ {
+ maViewObjectContactVector.erase(aFindResult);
- if(1L == maViewObjectContactVector.size())
- {
- StartGettingViewed();
- }
+ if(maViewObjectContactVector.empty())
+ {
+ // This may need to get asynchron later since it eventually triggers
+ // deletes of OCs where the VOC is still added.
+ StopGettingViewed();
}
+ }
+}
- // A ViewObjectContact was deleted and shall be forgotten.
- void ViewContact::RemoveViewObjectContact(ViewObjectContact& rVOContact)
- {
- std::vector< ViewObjectContact* >::iterator aFindResult = std::find(maViewObjectContactVector.begin(), maViewObjectContactVector.end(), &rVOContact);
+// Test if this ViewContact has ViewObjectContacts at all. This can
+// be used to test if this ViewContact is visualized ATM or not
+bool ViewContact::HasViewObjectContacts(bool bExcludePreviews) const
+{
+ const sal_uInt32 nCount(maViewObjectContactVector.size());
- if(aFindResult != maViewObjectContactVector.end())
+ if(bExcludePreviews)
+ {
+ for(sal_uInt32 a(0); a < nCount; a++)
+ {
+ if(!maViewObjectContactVector[a]->GetObjectContact().IsPreviewRenderer())
{
- maViewObjectContactVector.erase(aFindResult);
-
- if(maViewObjectContactVector.empty())
- {
- // This may need to get asynchron later since it eventually triggers
- // deletes of OCs where the VOC is still added.
- StopGettingViewed();
- }
+ return true;
}
}
- // Test if this ViewContact has ViewObjectContacts at all. This can
- // be used to test if this ViewContact is visualized ATM or not
- bool ViewContact::HasViewObjectContacts(bool bExcludePreviews) const
- {
- const sal_uInt32 nCount(maViewObjectContactVector.size());
+ return false;
+ }
+ else
+ {
+ return (0L != nCount);
+ }
+}
- if(bExcludePreviews)
- {
- for(sal_uInt32 a(0); a < nCount; a++)
- {
- if(!maViewObjectContactVector[a]->GetObjectContact().IsPreviewRenderer())
- {
- return true;
- }
- }
-
- return false;
- }
- else
- {
- return (0L != nCount);
- }
- }
+// Test if this ViewContact has ViewObjectContacts at all. This can
+// be used to test if this ViewContact is visualized ATM or not
+bool ViewContact::isAnimatedInAnyViewObjectContact() const
+{
+ const sal_uInt32 nCount(maViewObjectContactVector.size());
- // Test if this ViewContact has ViewObjectContacts at all. This can
- // be used to test if this ViewContact is visualized ATM or not
- bool ViewContact::isAnimatedInAnyViewObjectContact() const
+ for(sal_uInt32 a(0); a < nCount; a++)
+ {
+ if(maViewObjectContactVector[a]->isAnimated())
{
- const sal_uInt32 nCount(maViewObjectContactVector.size());
+ return true;
+ }
+ }
- for(sal_uInt32 a(0); a < nCount; a++)
- {
- if(maViewObjectContactVector[a]->isAnimated())
- {
- return true;
- }
- }
+ return false;
+}
- return false;
- }
+// Access to possible sub-hierarchy and parent. GetObjectCount() default is 0L
+// and GetViewContact default pops up an assert since it's an error if
+// GetObjectCount has a result != 0 and it's not overloaded.
+sal_uInt32 ViewContact::GetObjectCount() const
+{
+ // no sub-objects
+ return 0;
+}
- // Access to possible sub-hierarchy and parent. GetObjectCount() default is 0L
- // and GetViewContact default pops up an assert since it's an error if
- // GetObjectCount has a result != 0 and it's not overloaded.
- sal_uInt32 ViewContact::GetObjectCount() const
- {
- // no sub-objects
- return 0;
- }
+ViewContact& ViewContact::GetViewContact(sal_uInt32 /*nIndex*/) const
+{
+ // This is the default implementation; call would be an error
+ OSL_FAIL("ViewContact::GetViewContact: This call needs to be overloaded when GetObjectCount() can return results != 0 (!)");
+ return (ViewContact&)(*this);
+}
- ViewContact& ViewContact::GetViewContact(sal_uInt32 /*nIndex*/) const
- {
- // This is the default implementation; call would be an error
- OSL_FAIL("ViewContact::GetViewContact: This call needs to be overloaded when GetObjectCount() can return results != 0 (!)");
- return (ViewContact&)(*this);
- }
+ViewContact* ViewContact::GetParentContact() const
+{
+ // default has no parent
+ return 0;
+}
- ViewContact* ViewContact::GetParentContact() const
- {
- // default has no parent
- return 0;
- }
+void ViewContact::ActionChildInserted(ViewContact& rChild)
+{
+ // propagate change to all exsisting visualisations which
+ // will force a VOC for the new child and invalidate its range
+ const sal_uInt32 nCount(maViewObjectContactVector.size());
- void ViewContact::ActionChildInserted(ViewContact& rChild)
- {
- // propagate change to all exsisting visualisations which
- // will force a VOC for the new child and invalidate its range
- const sal_uInt32 nCount(maViewObjectContactVector.size());
+ for(sal_uInt32 a(0); a < nCount; a++)
+ {
+ ViewObjectContact* pCandidate = maViewObjectContactVector[a];
+ DBG_ASSERT(pCandidate, "ViewContact::GetViewObjectContact() invalid ViewObjectContactList (!)");
- for(sal_uInt32 a(0); a < nCount; a++)
- {
- ViewObjectContact* pCandidate = maViewObjectContactVector[a];
- DBG_ASSERT(pCandidate, "ViewContact::GetViewObjectContact() invalid ViewObjectContactList (!)");
+ // take action at all VOCs. At the VOCs ObjectContact the initial
+ // rectangle will be invalidated at the associated OutputDevice.
+ pCandidate->ActionChildInserted(rChild);
+ }
+}
- // take action at all VOCs. At the VOCs ObjectContact the initial
- // rectangle will be invalidated at the associated OutputDevice.
- pCandidate->ActionChildInserted(rChild);
- }
- }
+// React on changes of the object of this ViewContact
+void ViewContact::ActionChanged()
+{
+ // propagate change to all existing VOCs. This will invalidate
+ // all drawn visualisations in all known views
+ const sal_uInt32 nCount(maViewObjectContactVector.size());
- // React on changes of the object of this ViewContact
- void ViewContact::ActionChanged()
- {
- // propagate change to all existing VOCs. This will invalidate
- // all drawn visualisations in all known views
- const sal_uInt32 nCount(maViewObjectContactVector.size());
+ for(sal_uInt32 a(0); a < nCount; a++)
+ {
+ ViewObjectContact* pCandidate = maViewObjectContactVector[a];
+ DBG_ASSERT(pCandidate, "ViewContact::GetViewObjectContact() invalid ViewObjectContactList (!)");
- for(sal_uInt32 a(0); a < nCount; a++)
- {
- ViewObjectContact* pCandidate = maViewObjectContactVector[a];
- DBG_ASSERT(pCandidate, "ViewContact::GetViewObjectContact() invalid ViewObjectContactList (!)");
+ pCandidate->ActionChanged();
+ }
+}
- pCandidate->ActionChanged();
- }
- }
+// access to SdrObject and/or SdrPage. May return 0L like the default
+// implementations do. Needs to be overloaded as needed.
+SdrObject* ViewContact::TryToGetSdrObject() const
+{
+ return 0L;
+}
- // access to SdrObject and/or SdrPage. May return 0L like the default
- // implementations do. Needs to be overloaded as needed.
- SdrObject* ViewContact::TryToGetSdrObject() const
- {
- return 0L;
- }
+SdrPage* ViewContact::TryToGetSdrPage() const
+{
+ return 0L;
+}
- SdrPage* ViewContact::TryToGetSdrPage() const
- {
- return 0L;
- }
+// primitive stuff
- // primitive stuff
+drawinglayer::primitive2d::Primitive2DSequence ViewContact::createViewIndependentPrimitive2DSequence() const
+{
+ // This is the default implementation and should never be called (see header). If this is called,
+ // someone implemented a ViewContact (VC) visualisation object without defining the visualisation by
+ // providing a seqence of primitives -> which cannot be correct.
+ // Since we have no access to any known model data here, the default implementation creates a yellow placeholder
+ // hairline polygon with a default size of (1000, 1000, 5000, 3000)
+ OSL_FAIL("ViewContact::createViewIndependentPrimitive2DSequence(): Never call the fallback base implementation, this is always an error (!)");
+ const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(1000.0, 1000.0, 5000.0, 3000.0)));
+ const basegfx::BColor aYellow(1.0, 1.0, 0.0);
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline, aYellow));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+}
+
+drawinglayer::primitive2d::Primitive2DSequence ViewContact::getViewIndependentPrimitive2DSequence() const
+{
+ // local up-to-date checks. Create new list and compare.
+ drawinglayer::primitive2d::Primitive2DSequence xNew(createViewIndependentPrimitive2DSequence());
- drawinglayer::primitive2d::Primitive2DSequence ViewContact::createViewIndependentPrimitive2DSequence() const
- {
- // This is the default implementation and should never be called (see header). If this is called,
- // someone implemented a ViewContact (VC) visualisation object without defining the visualisation by
- // providing a seqence of primitives -> which cannot be correct.
- // Since we have no access to any known model data here, the default implementation creates a yellow placeholder
- // hairline polygon with a default size of (1000, 1000, 5000, 3000)
- OSL_FAIL("ViewContact::createViewIndependentPrimitive2DSequence(): Never call the fallback base implementation, this is always an error (!)");
- const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(1000.0, 1000.0, 5000.0, 3000.0)));
- const basegfx::BColor aYellow(1.0, 1.0, 0.0);
- const drawinglayer::primitive2d::Primitive2DReference xReference(
- new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline, aYellow));
-
- return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
- }
+ if(xNew.hasElements())
+ {
+ // allow evtl. embedding in object-specific infos, e.g. Name, Title, Description
+ xNew = embedToObjectSpecificInformation(xNew);
+ }
- drawinglayer::primitive2d::Primitive2DSequence ViewContact::getViewIndependentPrimitive2DSequence() const
- {
- // local up-to-date checks. Create new list and compare.
- drawinglayer::primitive2d::Primitive2DSequence xNew(createViewIndependentPrimitive2DSequence());
+ if(!drawinglayer::primitive2d::arePrimitive2DSequencesEqual(mxViewIndependentPrimitive2DSequence, xNew))
+ {
+ // has changed, copy content
+ const_cast< ViewContact* >(this)->mxViewIndependentPrimitive2DSequence = xNew;
+ }
- if(xNew.hasElements())
- {
- // allow evtl. embedding in object-specific infos, e.g. Name, Title, Description
- xNew = embedToObjectSpecificInformation(xNew);
- }
+ // return current Primitive2DSequence
+ return mxViewIndependentPrimitive2DSequence;
+}
- if(!drawinglayer::primitive2d::arePrimitive2DSequencesEqual(mxViewIndependentPrimitive2DSequence, xNew))
- {
- // has changed, copy content
- const_cast< ViewContact* >(this)->mxViewIndependentPrimitive2DSequence = xNew;
- }
+// add Gluepoints (if available)
+drawinglayer::primitive2d::Primitive2DSequence ViewContact::createGluePointPrimitive2DSequence() const
+{
+ // default returns empty reference
+ return drawinglayer::primitive2d::Primitive2DSequence();
+}
- // return current Primitive2DSequence
- return mxViewIndependentPrimitive2DSequence;
- }
+drawinglayer::primitive2d::Primitive2DSequence ViewContact::embedToObjectSpecificInformation(const drawinglayer::primitive2d::Primitive2DSequence& rSource) const
+{
+ // nothing to do for default
+ return rSource;
+}
- // add Gluepoints (if available)
- drawinglayer::primitive2d::Primitive2DSequence ViewContact::createGluePointPrimitive2DSequence() const
- {
- // default returns empty reference
- return drawinglayer::primitive2d::Primitive2DSequence();
- }
+basegfx::B2DRange ViewContact::getRange( const drawinglayer::geometry::ViewInformation2D& /*rViewInfo2D*/ ) const
+{
+ // Return empty range.
+ return basegfx::B2DRange();
+}
- drawinglayer::primitive2d::Primitive2DSequence ViewContact::embedToObjectSpecificInformation(const drawinglayer::primitive2d::Primitive2DSequence& rSource) const
- {
- // nothing to do for default
- return rSource;
- }
+void ViewContact::flushViewObjectContacts(bool bWithHierarchy)
+{
+ if(bWithHierarchy)
+ {
+ // flush DrawingLayer hierarchy
+ const sal_uInt32 nCount(GetObjectCount());
- basegfx::B2DRange ViewContact::getRange( const drawinglayer::geometry::ViewInformation2D& /*rViewInfo2D*/ ) const
+ for(sal_uInt32 a(0); a < nCount; a++)
{
- // Return empty range.
- return basegfx::B2DRange();
+ ViewContact& rChild = GetViewContact(a);
+ rChild.flushViewObjectContacts(bWithHierarchy);
}
+ }
- void ViewContact::flushViewObjectContacts(bool bWithHierarchy)
- {
- if(bWithHierarchy)
- {
- // flush DrawingLayer hierarchy
- const sal_uInt32 nCount(GetObjectCount());
-
- for(sal_uInt32 a(0); a < nCount; a++)
- {
- ViewContact& rChild = GetViewContact(a);
- rChild.flushViewObjectContacts(bWithHierarchy);
- }
- }
+ // delete local VOCs
+ deleteAllVOCs();
+}
- // delete local VOCs
- deleteAllVOCs();
- }
- } // end of namespace contact
-} // end of namespace sdr
+}}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx
index 1704fdda6e1d..7bb3e742ed15 100644
--- a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx
@@ -35,186 +35,183 @@
#include <svx/charthelper.hxx>
#include <svtools/embedhlp.hxx>
+namespace sdr { namespace contact {
-namespace sdr
+// Create a Object-Specific ViewObjectContact, set ViewContact and
+// ObjectContact. Always needs to return something.
+ViewObjectContact& ViewContactOfSdrOle2Obj::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
{
- namespace contact
- {
- // Create a Object-Specific ViewObjectContact, set ViewContact and
- // ObjectContact. Always needs to return something.
- ViewObjectContact& ViewContactOfSdrOle2Obj::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
- {
- ViewObjectContact* pRetval = new ViewObjectContactOfSdrOle2Obj(rObjectContact, *this);
- DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
+ ViewObjectContact* pRetval = new ViewObjectContactOfSdrOle2Obj(rObjectContact, *this);
+ DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
- return *pRetval;
- }
+ return *pRetval;
+}
- ViewContactOfSdrOle2Obj::ViewContactOfSdrOle2Obj(SdrOle2Obj& rOle2Obj)
- : ViewContactOfSdrRectObj(rOle2Obj),
- mxChartContent()
- {
- }
-
- ViewContactOfSdrOle2Obj::~ViewContactOfSdrOle2Obj()
- {
- }
+ViewContactOfSdrOle2Obj::ViewContactOfSdrOle2Obj(SdrOle2Obj& rOle2Obj)
+: ViewContactOfSdrRectObj(rOle2Obj),
+ mxChartContent()
+{
+}
- basegfx::B2DHomMatrix ViewContactOfSdrOle2Obj::createObjectTransform() const
- {
- // take unrotated snap rect (direct model data) for position and size
- Rectangle rRectangle = GetOle2Obj().GetGeoRect();
- // Hack for calc, transform position of object according
- // to current zoom so as objects relative position to grid
- // appears stable
- rRectangle += GetOle2Obj().GetGridOffset();
- const basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom());
-
- // create object matrix
- const GeoStat& rGeoStat(GetOle2Obj().GetGeoStat());
- const double fShearX(rGeoStat.nShearAngle ? tan((36000 - rGeoStat.nShearAngle) * F_PI18000) : 0.0);
- const double fRotate(rGeoStat.nRotationAngle ? (36000 - rGeoStat.nRotationAngle) * F_PI18000 : 0.0);
-
- return basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
- aObjectRange.getWidth(), aObjectRange.getHeight(),
- fShearX,
- fRotate,
- aObjectRange.getMinX(), aObjectRange.getMinY());
- }
+ViewContactOfSdrOle2Obj::~ViewContactOfSdrOle2Obj()
+{
+}
- drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrOle2Obj::createPrimitive2DSequenceWithParameters() const
- {
- // get object transformation
- const basegfx::B2DHomMatrix aObjectMatrix(createObjectTransform());
+basegfx::B2DHomMatrix ViewContactOfSdrOle2Obj::createObjectTransform() const
+{
+ // take unrotated snap rect (direct model data) for position and size
+ Rectangle rRectangle = GetOle2Obj().GetGeoRect();
+ // Hack for calc, transform position of object according
+ // to current zoom so as objects relative position to grid
+ // appears stable
+ rRectangle += GetOle2Obj().GetGridOffset();
+ const basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom());
+
+ // create object matrix
+ const GeoStat& rGeoStat(GetOle2Obj().GetGeoStat());
+ const double fShearX(rGeoStat.nShearAngle ? tan((36000 - rGeoStat.nShearAngle) * F_PI18000) : 0.0);
+ const double fRotate(rGeoStat.nRotationAngle ? (36000 - rGeoStat.nRotationAngle) * F_PI18000 : 0.0);
+
+ return basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
+ aObjectRange.getWidth(), aObjectRange.getHeight(),
+ fShearX,
+ fRotate,
+ aObjectRange.getMinX(), aObjectRange.getMinY());
+}
+
+drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrOle2Obj::createPrimitive2DSequenceWithParameters() const
+{
+ // get object transformation
+ const basegfx::B2DHomMatrix aObjectMatrix(createObjectTransform());
- // Prepare attribute settings, will be used soon anyways
- const SfxItemSet& rItemSet = GetOle2Obj().GetMergedItemSet();
+ // Prepare attribute settings, will be used soon anyways
+ const SfxItemSet& rItemSet = GetOle2Obj().GetMergedItemSet();
- // this may be refined more granular; if no content, attributes may get simpler
- const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute(
- drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(
- rItemSet,
- GetOle2Obj().getText(0),
- true));
- drawinglayer::primitive2d::Primitive2DReference xContent;
+ // this may be refined more granular; if no content, attributes may get simpler
+ const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute(
+ drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(
+ rItemSet,
+ GetOle2Obj().getText(0),
+ true));
+ drawinglayer::primitive2d::Primitive2DReference xContent;
- if(GetOle2Obj().IsChart())
+ if(GetOle2Obj().IsChart())
+ {
+ // #i123539# allow buffering and reuse of local chart data to not need to rebuild it
+ // on every ViewObjectContact::getPrimitive2DSequence call. TTTT: No tneeded for
+ // aw080, there this mechanism alraedy works differently
+ if(mxChartContent.is())
+ {
+ xContent = mxChartContent;
+ }
+ else
+ {
+ // try to get chart primitives and chart range directly from xChartModel
+ basegfx::B2DRange aChartContentRange;
+ const drawinglayer::primitive2d::Primitive2DSequence aChartSequence(
+ ChartHelper::tryToGetChartContentAsPrimitive2DSequence(
+ GetOle2Obj().getXModel(),
+ aChartContentRange));
+ const double fWidth(aChartContentRange.getWidth());
+ const double fHeight(aChartContentRange.getHeight());
+
+ if(aChartSequence.hasElements()
+ && basegfx::fTools::more(fWidth, 0.0)
+ && basegfx::fTools::more(fHeight, 0.0))
{
- // #i123539# allow buffering and reuse of local chart data to not need to rebuild it
- // on every ViewObjectContact::getPrimitive2DSequence call. TTTT: No tneeded for
- // aw080, there this mechanism alraedy works differently
- if(mxChartContent.is())
- {
- xContent = mxChartContent;
- }
- else
- {
- // try to get chart primitives and chart range directly from xChartModel
- basegfx::B2DRange aChartContentRange;
- const drawinglayer::primitive2d::Primitive2DSequence aChartSequence(
- ChartHelper::tryToGetChartContentAsPrimitive2DSequence(
- GetOle2Obj().getXModel(),
- aChartContentRange));
- const double fWidth(aChartContentRange.getWidth());
- const double fHeight(aChartContentRange.getHeight());
-
- if(aChartSequence.hasElements()
- && basegfx::fTools::more(fWidth, 0.0)
- && basegfx::fTools::more(fHeight, 0.0))
- {
- // create embedding transformation
- basegfx::B2DHomMatrix aEmbed(
- basegfx::tools::createTranslateB2DHomMatrix(
- -aChartContentRange.getMinX(),
- -aChartContentRange.getMinY()));
-
- aEmbed.scale(1.0 / fWidth, 1.0 / fHeight);
- aEmbed = aObjectMatrix * aEmbed;
- xContent = new drawinglayer::primitive2d::TransformPrimitive2D(
- aEmbed,
- aChartSequence);
- }
-
- if(xContent.is())
- {
- const_cast< ViewContactOfSdrOle2Obj* >(this)->mxChartContent = xContent;
- }
- }
+ // create embedding transformation
+ basegfx::B2DHomMatrix aEmbed(
+ basegfx::tools::createTranslateB2DHomMatrix(
+ -aChartContentRange.getMinX(),
+ -aChartContentRange.getMinY()));
+
+ aEmbed.scale(1.0 / fWidth, 1.0 / fHeight);
+ aEmbed = aObjectMatrix * aEmbed;
+ xContent = new drawinglayer::primitive2d::TransformPrimitive2D(
+ aEmbed,
+ aChartSequence);
}
- if(!xContent.is())
+ if(xContent.is())
{
- // #i102063# embed OLE content in an own primitive; this will be able to decompose accessing
- // the weak SdrOle2 reference and will also implement getB2DRange() for fast BoundRect
- // calculations without OLE Graphic access (which may trigger e.g. chart recalculation).
- // It will also take care of HighContrast and ScaleContent
- xContent = new drawinglayer::primitive2d::SdrOleContentPrimitive2D(
- GetOle2Obj(),
- aObjectMatrix,
-
- // #i104867# add GraphicVersion number to be able to check for
- // content change in the primitive later
- GetOle2Obj().getEmbeddedObjectRef().getGraphicVersion() );
+ const_cast< ViewContactOfSdrOle2Obj* >(this)->mxChartContent = xContent;
}
-
- // create primitive. Use Ole2 primitive here. Prepare attribute settings, will
- // be used soon anyways. Always create primitives to allow the decomposition of
- // SdrOle2Primitive2D to create needed invisible elements for HitTest and/or BoundRect
- const drawinglayer::primitive2d::Primitive2DReference xReference(
- new drawinglayer::primitive2d::SdrOle2Primitive2D(
- drawinglayer::primitive2d::Primitive2DSequence(&xContent, 1),
- aObjectMatrix,
- aAttribute));
-
- return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
}
+ }
- basegfx::B2DRange ViewContactOfSdrOle2Obj::getRange( const drawinglayer::geometry::ViewInformation2D& rViewInfo2D ) const
- {
- // this may be refined more granular; if no content, attributes may get simpler
- const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute =
- drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(
- GetOle2Obj().GetMergedItemSet(),
- GetOle2Obj().getText(0),
- true);
-
- basegfx::B2DHomMatrix aObjectMatrix = createObjectTransform();
-
- drawinglayer::primitive2d::Primitive2DReference xContent =
- new drawinglayer::primitive2d::SdrOleContentPrimitive2D(
- GetOle2Obj(),
- aObjectMatrix,
- GetOle2Obj().getEmbeddedObjectRef().getGraphicVersion());
-
- const drawinglayer::primitive2d::Primitive2DReference xReference(
- new drawinglayer::primitive2d::SdrOle2Primitive2D(
- drawinglayer::primitive2d::Primitive2DSequence(&xContent, 1),
- aObjectMatrix,
- aAttribute));
-
- drawinglayer::primitive2d::Primitive2DSequence xSeq =
- drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
-
- return drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(xSeq, rViewInfo2D);
- }
+ if(!xContent.is())
+ {
+ // #i102063# embed OLE content in an own primitive; this will be able to decompose accessing
+ // the weak SdrOle2 reference and will also implement getB2DRange() for fast BoundRect
+ // calculations without OLE Graphic access (which may trigger e.g. chart recalculation).
+ // It will also take care of HighContrast and ScaleContent
+ xContent = new drawinglayer::primitive2d::SdrOleContentPrimitive2D(
+ GetOle2Obj(),
+ aObjectMatrix,
+
+ // #i104867# add GraphicVersion number to be able to check for
+ // content change in the primitive later
+ GetOle2Obj().getEmbeddedObjectRef().getGraphicVersion() );
+ }
+
+ // create primitive. Use Ole2 primitive here. Prepare attribute settings, will
+ // be used soon anyways. Always create primitives to allow the decomposition of
+ // SdrOle2Primitive2D to create needed invisible elements for HitTest and/or BoundRect
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::SdrOle2Primitive2D(
+ drawinglayer::primitive2d::Primitive2DSequence(&xContent, 1),
+ aObjectMatrix,
+ aAttribute));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+}
+
+basegfx::B2DRange ViewContactOfSdrOle2Obj::getRange( const drawinglayer::geometry::ViewInformation2D& rViewInfo2D ) const
+{
+ // this may be refined more granular; if no content, attributes may get simpler
+ const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute =
+ drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(
+ GetOle2Obj().GetMergedItemSet(),
+ GetOle2Obj().getText(0),
+ true);
+
+ basegfx::B2DHomMatrix aObjectMatrix = createObjectTransform();
+
+ drawinglayer::primitive2d::Primitive2DReference xContent =
+ new drawinglayer::primitive2d::SdrOleContentPrimitive2D(
+ GetOle2Obj(),
+ aObjectMatrix,
+ GetOle2Obj().getEmbeddedObjectRef().getGraphicVersion());
+
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::SdrOle2Primitive2D(
+ drawinglayer::primitive2d::Primitive2DSequence(&xContent, 1),
+ aObjectMatrix,
+ aAttribute));
+
+ drawinglayer::primitive2d::Primitive2DSequence xSeq =
+ drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+
+ return drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(xSeq, rViewInfo2D);
+}
+
+void ViewContactOfSdrOle2Obj::ActionChanged()
+{
+ // call parent
+ ViewContactOfSdrRectObj::ActionChanged();
- void ViewContactOfSdrOle2Obj::ActionChanged()
- {
- // call parent
- ViewContactOfSdrRectObj::ActionChanged();
+ // #i123539# if we have buffered chart data, reset it
+ if(mxChartContent.is())
+ {
+ mxChartContent.clear();
+ }
+}
- // #i123539# if we have buffered chart data, reset it
- if(mxChartContent.is())
- {
- mxChartContent.clear();
- }
- }
+drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrOle2Obj::createViewIndependentPrimitive2DSequence() const
+{
+ return createPrimitive2DSequenceWithParameters();
+}
- drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrOle2Obj::createViewIndependentPrimitive2DSequence() const
- {
- return createPrimitive2DSequenceWithParameters();
- }
- } // end of namespace contact
-} // end of namespace sdr
+}}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */