summaryrefslogtreecommitdiff
path: root/svx/source/svdraw/svdovirt.cxx
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2007-01-22 14:16:57 +0000
committerOliver Bolte <obo@openoffice.org>2007-01-22 14:16:57 +0000
commit921ec84121359a62a876eabace37220b45e9b84f (patch)
treedab991d710bfd7004297245a2daba8eb047951ac /svx/source/svdraw/svdovirt.cxx
parentdca2436027da8652e1440054189c174496bb8f0f (diff)
INTEGRATION: CWS aw039 (1.17.58); FILE MERGED
2007/01/08 15:58:37 aw 1.17.58.2: #i73248# one small optimization: calculate offset outside loop 2007/01/08 13:49:53 aw 1.17.58.1: #i73248#
Diffstat (limited to 'svx/source/svdraw/svdovirt.cxx')
-rw-r--r--svx/source/svdraw/svdovirt.cxx51
1 files changed, 45 insertions, 6 deletions
diff --git a/svx/source/svdraw/svdovirt.cxx b/svx/source/svdraw/svdovirt.cxx
index 708f83e72333..1deac5162efd 100644
--- a/svx/source/svdraw/svdovirt.cxx
+++ b/svx/source/svdraw/svdovirt.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: svdovirt.cxx,v $
*
- * $Revision: 1.17 $
+ * $Revision: 1.18 $
*
- * last change: $Author: ihi $ $Date: 2006-11-14 13:48:30 $
+ * last change: $Author: obo $ $Date: 2007-01-22 15:16:57 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -260,8 +260,15 @@ sal_uInt32 SdrVirtObj::GetHdlCount() const
SdrHdl* SdrVirtObj::GetHdl(sal_uInt32 nHdlNum) const
{
SdrHdl* pHdl=rRefObj.GetHdl(nHdlNum);
- Point aP(pHdl->GetPos()+aAnchor);
- pHdl->SetPos(aP);
+
+ // #i73248#
+ // GetHdl() at SdrObject is not guaranteed to return an object
+ if(pHdl)
+ {
+ Point aP(pHdl->GetPos()+aAnchor);
+ pHdl->SetPos(aP);
+ }
+
return pHdl;
}
@@ -279,7 +286,38 @@ SdrHdl* SdrVirtObj::GetPlusHdl(const SdrHdl& rHdl, sal_uInt32 nPlNum) const
void SdrVirtObj::AddToHdlList(SdrHdlList& rHdlList) const
{
- SdrObject::AddToHdlList(rHdlList);
+ // #i73248#
+ // SdrObject::AddToHdlList(rHdlList) is not a good thing to call
+ // since at SdrPathObj, only AddToHdlList may be used and the call
+ // will instead use the standard implementation which uses GetHdlCount()
+ // and GetHdl instead. This is not wrong, but may be much less effective
+ // and may not be prepared to GetHdl returning NULL
+
+ // get handles using AddToHdlList from ref object
+ SdrHdlList aLocalList(0);
+ rRefObj.AddToHdlList(aLocalList);
+ const sal_uInt32 nHdlCount(aLocalList.GetHdlCount());
+
+ if(nHdlCount)
+ {
+ // translate handles and add them to dest list. They are temporarily part of
+ // two lists then
+ const Point aOffset(GetOffset());
+
+ for(sal_uInt32 a(0L); a < nHdlCount; a++)
+ {
+ SdrHdl* pCandidate = aLocalList.GetHdl(a);
+ pCandidate->SetPos(pCandidate->GetPos() + aOffset);
+ rHdlList.AddHdl(pCandidate);
+ }
+
+ // remove them from source list, else they will be deleted when
+ // source list is deleted
+ while(aLocalList.GetHdlCount())
+ {
+ aLocalList.RemoveHdl(aLocalList.GetHdlCount() - 1L);
+ }
+ }
}
FASTBOOL SdrVirtObj::HasSpecialDrag() const
@@ -625,7 +663,8 @@ XubString SdrVirtObj::GetMacroPopupComment(const SdrObjMacroHitRec& rRec) const
const Point SdrVirtObj::GetOffset() const
{
- return Point(0,0);
+ // #i73248# default offset of SdrVirtObj is aAnchor
+ return aAnchor;
}
// eof