1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_svx.hxx" 30*cdf0e10cSrcweir #include <tools/bigint.hxx> 31*cdf0e10cSrcweir #include <svx/xlnwtit.hxx> 32*cdf0e10cSrcweir #include <svl/style.hxx> 33*cdf0e10cSrcweir #include <svx/svdocapt.hxx> 34*cdf0e10cSrcweir #include <svx/xpool.hxx> 35*cdf0e10cSrcweir #include <svx/xpoly.hxx> 36*cdf0e10cSrcweir #include <svx/svdattrx.hxx> 37*cdf0e10cSrcweir #include <svx/svdpool.hxx> 38*cdf0e10cSrcweir #include <svx/svdetc.hxx> 39*cdf0e10cSrcweir #include <svx/svdtrans.hxx> 40*cdf0e10cSrcweir #include <svx/svdhdl.hxx> 41*cdf0e10cSrcweir #include <svx/svddrag.hxx> 42*cdf0e10cSrcweir #include <svx/svdmodel.hxx> 43*cdf0e10cSrcweir #include <svx/svdview.hxx> // fuer RectSnap 44*cdf0e10cSrcweir #include "svx/svdglob.hxx" // StringCache 45*cdf0e10cSrcweir #include "svx/svdstr.hrc" // Objektname 46*cdf0e10cSrcweir #include <svx/svdogrp.hxx> 47*cdf0e10cSrcweir #include <svx/svdpage.hxx> 48*cdf0e10cSrcweir #include <svx/xflhtit.hxx> 49*cdf0e10cSrcweir #include <svx/xflclit.hxx> 50*cdf0e10cSrcweir #include <svx/xfltrit.hxx> 51*cdf0e10cSrcweir #include <editeng/eeitem.hxx> 52*cdf0e10cSrcweir #include <svx/sdr/properties/captionproperties.hxx> 53*cdf0e10cSrcweir #include <vcl/salbtype.hxx> // FRound 54*cdf0e10cSrcweir #include <svx/sdr/contact/viewcontactofsdrcaptionobj.hxx> 55*cdf0e10cSrcweir #include <basegfx/tuple/b2dtuple.hxx> 56*cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrix.hxx> 57*cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygon.hxx> 58*cdf0e10cSrcweir #include <basegfx/range/b2drange.hxx> 59*cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygontools.hxx> 60*cdf0e10cSrcweir #include <svx/sdrhittesthelper.hxx> 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir // #i32599# 63*cdf0e10cSrcweir inline double ImplTwipsToMM(double fVal) { return (fVal * (127.0 / 72.0)); } 64*cdf0e10cSrcweir inline double ImplMMToTwips(double fVal) { return (fVal * (72.0 / 127.0)); } 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////// 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir enum EscDir {LKS,RTS,OBN,UNT}; 69*cdf0e10cSrcweir 70*cdf0e10cSrcweir class ImpCaptParams 71*cdf0e10cSrcweir { 72*cdf0e10cSrcweir public: 73*cdf0e10cSrcweir SdrCaptionType eType; 74*cdf0e10cSrcweir long nAngle; 75*cdf0e10cSrcweir long nGap; 76*cdf0e10cSrcweir long nEscRel; 77*cdf0e10cSrcweir long nEscAbs; 78*cdf0e10cSrcweir long nLineLen; 79*cdf0e10cSrcweir SdrCaptionEscDir eEscDir; 80*cdf0e10cSrcweir FASTBOOL bFitLineLen; 81*cdf0e10cSrcweir FASTBOOL bEscRel; 82*cdf0e10cSrcweir FASTBOOL bFixedAngle; 83*cdf0e10cSrcweir 84*cdf0e10cSrcweir public: 85*cdf0e10cSrcweir ImpCaptParams() 86*cdf0e10cSrcweir { 87*cdf0e10cSrcweir eType =SDRCAPT_TYPE3; 88*cdf0e10cSrcweir bFixedAngle=sal_False; 89*cdf0e10cSrcweir nAngle =4500; 90*cdf0e10cSrcweir nGap =0; 91*cdf0e10cSrcweir eEscDir =SDRCAPT_ESCHORIZONTAL; 92*cdf0e10cSrcweir bEscRel =sal_True; 93*cdf0e10cSrcweir nEscRel =5000; 94*cdf0e10cSrcweir nEscAbs =0; 95*cdf0e10cSrcweir nLineLen =0; 96*cdf0e10cSrcweir bFitLineLen=sal_True; 97*cdf0e10cSrcweir } 98*cdf0e10cSrcweir void CalcEscPos(const Point& rTail, const Rectangle& rRect, Point& rPt, EscDir& rDir) const; 99*cdf0e10cSrcweir }; 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir void ImpCaptParams::CalcEscPos(const Point& rTailPt, const Rectangle& rRect, Point& rPt, EscDir& rDir) const 102*cdf0e10cSrcweir { 103*cdf0e10cSrcweir Point aTl(rTailPt); // lokal kopieren wg. Performance 104*cdf0e10cSrcweir long nX,nY; 105*cdf0e10cSrcweir if (bEscRel) { 106*cdf0e10cSrcweir nX=rRect.Right()-rRect.Left(); 107*cdf0e10cSrcweir nX=BigMulDiv(nX,nEscRel,10000); 108*cdf0e10cSrcweir nY=rRect.Bottom()-rRect.Top(); 109*cdf0e10cSrcweir nY=BigMulDiv(nY,nEscRel,10000); 110*cdf0e10cSrcweir } else { 111*cdf0e10cSrcweir nX=nEscAbs; 112*cdf0e10cSrcweir nY=nEscAbs; 113*cdf0e10cSrcweir } 114*cdf0e10cSrcweir nX+=rRect.Left(); 115*cdf0e10cSrcweir nY+=rRect.Top(); 116*cdf0e10cSrcweir Point aBestPt; 117*cdf0e10cSrcweir EscDir eBestDir=LKS; 118*cdf0e10cSrcweir FASTBOOL bTryH=eEscDir==SDRCAPT_ESCBESTFIT; 119*cdf0e10cSrcweir if (!bTryH) { 120*cdf0e10cSrcweir if (eType!=SDRCAPT_TYPE1) { 121*cdf0e10cSrcweir bTryH=eEscDir==SDRCAPT_ESCHORIZONTAL; 122*cdf0e10cSrcweir } else { 123*cdf0e10cSrcweir bTryH=eEscDir==SDRCAPT_ESCVERTICAL; 124*cdf0e10cSrcweir } 125*cdf0e10cSrcweir } 126*cdf0e10cSrcweir FASTBOOL bTryV=eEscDir==SDRCAPT_ESCBESTFIT; 127*cdf0e10cSrcweir if (!bTryV) { 128*cdf0e10cSrcweir if (eType!=SDRCAPT_TYPE1) { 129*cdf0e10cSrcweir bTryV=eEscDir==SDRCAPT_ESCVERTICAL; 130*cdf0e10cSrcweir } else { 131*cdf0e10cSrcweir bTryV=eEscDir==SDRCAPT_ESCHORIZONTAL; 132*cdf0e10cSrcweir } 133*cdf0e10cSrcweir } 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir if (bTryH) { 136*cdf0e10cSrcweir Point aLft(rRect.Left()-nGap,nY); 137*cdf0e10cSrcweir Point aRgt(rRect.Right()+nGap,nY); 138*cdf0e10cSrcweir FASTBOOL bLft=(aTl.X()-aLft.X()<aRgt.X()-aTl.X()); 139*cdf0e10cSrcweir if (bLft) { 140*cdf0e10cSrcweir eBestDir=LKS; 141*cdf0e10cSrcweir aBestPt=aLft; 142*cdf0e10cSrcweir } else { 143*cdf0e10cSrcweir eBestDir=RTS; 144*cdf0e10cSrcweir aBestPt=aRgt; 145*cdf0e10cSrcweir } 146*cdf0e10cSrcweir } 147*cdf0e10cSrcweir if (bTryV) { 148*cdf0e10cSrcweir Point aTop(nX,rRect.Top()-nGap); 149*cdf0e10cSrcweir Point aBtm(nX,rRect.Bottom()+nGap); 150*cdf0e10cSrcweir FASTBOOL bTop=(aTl.Y()-aTop.Y()<aBtm.Y()-aTl.Y()); 151*cdf0e10cSrcweir Point aBest2; 152*cdf0e10cSrcweir EscDir eBest2; 153*cdf0e10cSrcweir if (bTop) { 154*cdf0e10cSrcweir eBest2=OBN; 155*cdf0e10cSrcweir aBest2=aTop; 156*cdf0e10cSrcweir } else { 157*cdf0e10cSrcweir eBest2=UNT; 158*cdf0e10cSrcweir aBest2=aBtm; 159*cdf0e10cSrcweir } 160*cdf0e10cSrcweir FASTBOOL bTakeIt=eEscDir!=SDRCAPT_ESCBESTFIT; 161*cdf0e10cSrcweir if (!bTakeIt) { 162*cdf0e10cSrcweir BigInt aHorX(aBestPt.X()-aTl.X()); aHorX*=aHorX; 163*cdf0e10cSrcweir BigInt aHorY(aBestPt.Y()-aTl.Y()); aHorY*=aHorY; 164*cdf0e10cSrcweir BigInt aVerX(aBest2.X()-aTl.X()); aVerX*=aVerX; 165*cdf0e10cSrcweir BigInt aVerY(aBest2.Y()-aTl.Y()); aVerY*=aVerY; 166*cdf0e10cSrcweir if (eType!=SDRCAPT_TYPE1) { 167*cdf0e10cSrcweir bTakeIt=aVerX+aVerY<aHorX+aHorY; 168*cdf0e10cSrcweir } else { 169*cdf0e10cSrcweir bTakeIt=aVerX+aVerY>=aHorX+aHorY; 170*cdf0e10cSrcweir } 171*cdf0e10cSrcweir } 172*cdf0e10cSrcweir if (bTakeIt) { 173*cdf0e10cSrcweir aBestPt=aBest2; 174*cdf0e10cSrcweir eBestDir=eBest2; 175*cdf0e10cSrcweir } 176*cdf0e10cSrcweir } 177*cdf0e10cSrcweir rPt=aBestPt; 178*cdf0e10cSrcweir rDir=eBestDir; 179*cdf0e10cSrcweir } 180*cdf0e10cSrcweir 181*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 182*cdf0e10cSrcweir // BaseProperties section 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir sdr::properties::BaseProperties* SdrCaptionObj::CreateObjectSpecificProperties() 185*cdf0e10cSrcweir { 186*cdf0e10cSrcweir return new sdr::properties::CaptionProperties(*this); 187*cdf0e10cSrcweir } 188*cdf0e10cSrcweir 189*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 190*cdf0e10cSrcweir // DrawContact section 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir sdr::contact::ViewContact* SdrCaptionObj::CreateObjectSpecificViewContact() 193*cdf0e10cSrcweir { 194*cdf0e10cSrcweir return new sdr::contact::ViewContactOfSdrCaptionObj(*this); 195*cdf0e10cSrcweir } 196*cdf0e10cSrcweir 197*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir TYPEINIT1(SdrCaptionObj,SdrRectObj); 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir SdrCaptionObj::SdrCaptionObj(): 202*cdf0e10cSrcweir SdrRectObj(OBJ_TEXT), 203*cdf0e10cSrcweir aTailPoly(3), // Default Groesse: 3 Punkte = 2 Linien 204*cdf0e10cSrcweir mbSpecialTextBoxShadow(sal_False), 205*cdf0e10cSrcweir mbFixedTail(sal_False) 206*cdf0e10cSrcweir { 207*cdf0e10cSrcweir } 208*cdf0e10cSrcweir 209*cdf0e10cSrcweir SdrCaptionObj::SdrCaptionObj(const Rectangle& rRect): 210*cdf0e10cSrcweir SdrRectObj(OBJ_TEXT,rRect), 211*cdf0e10cSrcweir aTailPoly(3), // Default Groesse: 3 Punkte = 2 Linien 212*cdf0e10cSrcweir mbSpecialTextBoxShadow(sal_False), 213*cdf0e10cSrcweir mbFixedTail(sal_False) 214*cdf0e10cSrcweir { 215*cdf0e10cSrcweir } 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir SdrCaptionObj::SdrCaptionObj(const Rectangle& rRect, const Point& rTail): 218*cdf0e10cSrcweir SdrRectObj(OBJ_TEXT,rRect), 219*cdf0e10cSrcweir aTailPoly(3), // Default Groesse: 3 Punkte = 2 Linien 220*cdf0e10cSrcweir mbSpecialTextBoxShadow(sal_False), 221*cdf0e10cSrcweir mbFixedTail(sal_False) 222*cdf0e10cSrcweir { 223*cdf0e10cSrcweir aTailPoly[0]=maFixedTailPos=rTail; 224*cdf0e10cSrcweir } 225*cdf0e10cSrcweir 226*cdf0e10cSrcweir SdrCaptionObj::~SdrCaptionObj() 227*cdf0e10cSrcweir { 228*cdf0e10cSrcweir } 229*cdf0e10cSrcweir 230*cdf0e10cSrcweir void SdrCaptionObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const 231*cdf0e10cSrcweir { 232*cdf0e10cSrcweir rInfo.bRotateFreeAllowed=sal_False; 233*cdf0e10cSrcweir rInfo.bRotate90Allowed =sal_False; 234*cdf0e10cSrcweir rInfo.bMirrorFreeAllowed=sal_False; 235*cdf0e10cSrcweir rInfo.bMirror45Allowed =sal_False; 236*cdf0e10cSrcweir rInfo.bMirror90Allowed =sal_False; 237*cdf0e10cSrcweir rInfo.bTransparenceAllowed = sal_False; 238*cdf0e10cSrcweir rInfo.bGradientAllowed = sal_False; 239*cdf0e10cSrcweir rInfo.bShearAllowed =sal_False; 240*cdf0e10cSrcweir rInfo.bEdgeRadiusAllowed=sal_False; 241*cdf0e10cSrcweir rInfo.bCanConvToPath =sal_True; 242*cdf0e10cSrcweir rInfo.bCanConvToPoly =sal_True; 243*cdf0e10cSrcweir rInfo.bCanConvToPathLineToArea=sal_False; 244*cdf0e10cSrcweir rInfo.bCanConvToPolyLineToArea=sal_False; 245*cdf0e10cSrcweir rInfo.bCanConvToContour = (rInfo.bCanConvToPoly || LineGeometryUsageIsNecessary()); 246*cdf0e10cSrcweir } 247*cdf0e10cSrcweir 248*cdf0e10cSrcweir sal_uInt16 SdrCaptionObj::GetObjIdentifier() const 249*cdf0e10cSrcweir { 250*cdf0e10cSrcweir return sal_uInt16(OBJ_CAPTION); 251*cdf0e10cSrcweir } 252*cdf0e10cSrcweir 253*cdf0e10cSrcweir void SdrCaptionObj::operator=(const SdrObject& rObj) 254*cdf0e10cSrcweir { 255*cdf0e10cSrcweir SdrRectObj::operator=(rObj); 256*cdf0e10cSrcweir aTailPoly=((SdrCaptionObj&)rObj).aTailPoly; 257*cdf0e10cSrcweir } 258*cdf0e10cSrcweir 259*cdf0e10cSrcweir void SdrCaptionObj::TakeObjNameSingul(XubString& rName) const 260*cdf0e10cSrcweir { 261*cdf0e10cSrcweir rName=ImpGetResStr(STR_ObjNameSingulCAPTION); 262*cdf0e10cSrcweir 263*cdf0e10cSrcweir String aName( GetName() ); 264*cdf0e10cSrcweir if(aName.Len()) 265*cdf0e10cSrcweir { 266*cdf0e10cSrcweir rName += sal_Unicode(' '); 267*cdf0e10cSrcweir rName += sal_Unicode('\''); 268*cdf0e10cSrcweir rName += aName; 269*cdf0e10cSrcweir rName += sal_Unicode('\''); 270*cdf0e10cSrcweir } 271*cdf0e10cSrcweir } 272*cdf0e10cSrcweir 273*cdf0e10cSrcweir void SdrCaptionObj::TakeObjNamePlural(XubString& rName) const 274*cdf0e10cSrcweir { 275*cdf0e10cSrcweir rName=ImpGetResStr(STR_ObjNamePluralCAPTION); 276*cdf0e10cSrcweir } 277*cdf0e10cSrcweir 278*cdf0e10cSrcweir basegfx::B2DPolyPolygon SdrCaptionObj::TakeXorPoly() const 279*cdf0e10cSrcweir { 280*cdf0e10cSrcweir basegfx::B2DPolyPolygon aPolyPoly(SdrRectObj::TakeXorPoly()); 281*cdf0e10cSrcweir aPolyPoly.append(aTailPoly.getB2DPolygon()); 282*cdf0e10cSrcweir 283*cdf0e10cSrcweir return aPolyPoly; 284*cdf0e10cSrcweir } 285*cdf0e10cSrcweir 286*cdf0e10cSrcweir sal_uInt32 SdrCaptionObj::GetHdlCount() const 287*cdf0e10cSrcweir { 288*cdf0e10cSrcweir sal_uInt32 nAnz1(SdrRectObj::GetHdlCount()); 289*cdf0e10cSrcweir // sal_uInt32 nAnz2(aTailPoly.GetSize()); 290*cdf0e10cSrcweir // Derzeit ist nur das Draggen des Schwanzendes implementiert 291*cdf0e10cSrcweir return nAnz1 + 1L; 292*cdf0e10cSrcweir } 293*cdf0e10cSrcweir 294*cdf0e10cSrcweir SdrHdl* SdrCaptionObj::GetHdl(sal_uInt32 nHdlNum) const 295*cdf0e10cSrcweir { 296*cdf0e10cSrcweir const sal_uInt32 nRectHdlAnz(SdrRectObj::GetHdlCount()); 297*cdf0e10cSrcweir 298*cdf0e10cSrcweir if(nHdlNum < nRectHdlAnz) 299*cdf0e10cSrcweir { 300*cdf0e10cSrcweir return SdrRectObj::GetHdl(nHdlNum); 301*cdf0e10cSrcweir } 302*cdf0e10cSrcweir else 303*cdf0e10cSrcweir { 304*cdf0e10cSrcweir sal_uInt32 nPntNum(nHdlNum); 305*cdf0e10cSrcweir nPntNum -= nRectHdlAnz; 306*cdf0e10cSrcweir 307*cdf0e10cSrcweir if(nPntNum < aTailPoly.GetSize()) 308*cdf0e10cSrcweir { 309*cdf0e10cSrcweir SdrHdl* pHdl = new SdrHdl(aTailPoly.GetPoint((sal_uInt16)nPntNum), HDL_POLY); 310*cdf0e10cSrcweir pHdl->SetPolyNum(1L); 311*cdf0e10cSrcweir pHdl->SetPointNum(nPntNum); 312*cdf0e10cSrcweir return pHdl; 313*cdf0e10cSrcweir } 314*cdf0e10cSrcweir else 315*cdf0e10cSrcweir { 316*cdf0e10cSrcweir return 0L; 317*cdf0e10cSrcweir } 318*cdf0e10cSrcweir } 319*cdf0e10cSrcweir } 320*cdf0e10cSrcweir 321*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////// 322*cdf0e10cSrcweir 323*cdf0e10cSrcweir bool SdrCaptionObj::hasSpecialDrag() const 324*cdf0e10cSrcweir { 325*cdf0e10cSrcweir return true; 326*cdf0e10cSrcweir } 327*cdf0e10cSrcweir 328*cdf0e10cSrcweir bool SdrCaptionObj::beginSpecialDrag(SdrDragStat& rDrag) const 329*cdf0e10cSrcweir { 330*cdf0e10cSrcweir const SdrHdl* pHdl = rDrag.GetHdl(); 331*cdf0e10cSrcweir rDrag.SetEndDragChangesAttributes(true); 332*cdf0e10cSrcweir rDrag.SetEndDragChangesGeoAndAttributes(true); 333*cdf0e10cSrcweir 334*cdf0e10cSrcweir if(pHdl && 0 == pHdl->GetPolyNum()) 335*cdf0e10cSrcweir { 336*cdf0e10cSrcweir return SdrRectObj::beginSpecialDrag(rDrag); 337*cdf0e10cSrcweir } 338*cdf0e10cSrcweir else 339*cdf0e10cSrcweir { 340*cdf0e10cSrcweir rDrag.SetOrtho8Possible(true); 341*cdf0e10cSrcweir 342*cdf0e10cSrcweir if(!pHdl) 343*cdf0e10cSrcweir { 344*cdf0e10cSrcweir if (bMovProt) 345*cdf0e10cSrcweir return 0; 346*cdf0e10cSrcweir 347*cdf0e10cSrcweir rDrag.SetNoSnap(true); 348*cdf0e10cSrcweir rDrag.SetActionRect(aRect); 349*cdf0e10cSrcweir 350*cdf0e10cSrcweir Point aHit(rDrag.GetStart()); 351*cdf0e10cSrcweir 352*cdf0e10cSrcweir if(rDrag.GetPageView() && SdrObjectPrimitiveHit(*this, aHit, 0, *rDrag.GetPageView(), 0, false)) 353*cdf0e10cSrcweir { 354*cdf0e10cSrcweir return true; 355*cdf0e10cSrcweir } 356*cdf0e10cSrcweir } 357*cdf0e10cSrcweir else 358*cdf0e10cSrcweir { 359*cdf0e10cSrcweir if((1 == pHdl->GetPolyNum()) && (0 == pHdl->GetPointNum())) 360*cdf0e10cSrcweir return true; 361*cdf0e10cSrcweir } 362*cdf0e10cSrcweir } 363*cdf0e10cSrcweir 364*cdf0e10cSrcweir return false; 365*cdf0e10cSrcweir } 366*cdf0e10cSrcweir 367*cdf0e10cSrcweir bool SdrCaptionObj::applySpecialDrag(SdrDragStat& rDrag) 368*cdf0e10cSrcweir { 369*cdf0e10cSrcweir const SdrHdl* pHdl = rDrag.GetHdl(); 370*cdf0e10cSrcweir 371*cdf0e10cSrcweir if(pHdl && 0 == pHdl->GetPolyNum()) 372*cdf0e10cSrcweir { 373*cdf0e10cSrcweir const bool bRet(SdrRectObj::applySpecialDrag(rDrag)); 374*cdf0e10cSrcweir ImpRecalcTail(); 375*cdf0e10cSrcweir ActionChanged(); 376*cdf0e10cSrcweir 377*cdf0e10cSrcweir return bRet; 378*cdf0e10cSrcweir } 379*cdf0e10cSrcweir else 380*cdf0e10cSrcweir { 381*cdf0e10cSrcweir Point aDelt(rDrag.GetNow()-rDrag.GetStart()); 382*cdf0e10cSrcweir 383*cdf0e10cSrcweir if(!pHdl) 384*cdf0e10cSrcweir { 385*cdf0e10cSrcweir aRect.Move(aDelt.X(),aDelt.Y()); 386*cdf0e10cSrcweir } 387*cdf0e10cSrcweir else 388*cdf0e10cSrcweir { 389*cdf0e10cSrcweir aTailPoly[0] += aDelt; 390*cdf0e10cSrcweir } 391*cdf0e10cSrcweir 392*cdf0e10cSrcweir ImpRecalcTail(); 393*cdf0e10cSrcweir ActionChanged(); 394*cdf0e10cSrcweir 395*cdf0e10cSrcweir return true; 396*cdf0e10cSrcweir } 397*cdf0e10cSrcweir } 398*cdf0e10cSrcweir 399*cdf0e10cSrcweir String SdrCaptionObj::getSpecialDragComment(const SdrDragStat& rDrag) const 400*cdf0e10cSrcweir { 401*cdf0e10cSrcweir const bool bCreateComment(rDrag.GetView() && this == rDrag.GetView()->GetCreateObj()); 402*cdf0e10cSrcweir 403*cdf0e10cSrcweir if(bCreateComment) 404*cdf0e10cSrcweir { 405*cdf0e10cSrcweir return String(); 406*cdf0e10cSrcweir } 407*cdf0e10cSrcweir else 408*cdf0e10cSrcweir { 409*cdf0e10cSrcweir const SdrHdl* pHdl = rDrag.GetHdl(); 410*cdf0e10cSrcweir 411*cdf0e10cSrcweir if(pHdl && 0 == pHdl->GetPolyNum()) 412*cdf0e10cSrcweir { 413*cdf0e10cSrcweir return SdrRectObj::getSpecialDragComment(rDrag); 414*cdf0e10cSrcweir } 415*cdf0e10cSrcweir else 416*cdf0e10cSrcweir { 417*cdf0e10cSrcweir XubString aStr; 418*cdf0e10cSrcweir 419*cdf0e10cSrcweir if(!pHdl) 420*cdf0e10cSrcweir { 421*cdf0e10cSrcweir ImpTakeDescriptionStr(STR_DragCaptFram, aStr); 422*cdf0e10cSrcweir } 423*cdf0e10cSrcweir else 424*cdf0e10cSrcweir { 425*cdf0e10cSrcweir ImpTakeDescriptionStr(STR_DragCaptTail, aStr); 426*cdf0e10cSrcweir } 427*cdf0e10cSrcweir 428*cdf0e10cSrcweir return aStr; 429*cdf0e10cSrcweir } 430*cdf0e10cSrcweir } 431*cdf0e10cSrcweir } 432*cdf0e10cSrcweir 433*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////// 434*cdf0e10cSrcweir 435*cdf0e10cSrcweir void SdrCaptionObj::ImpGetCaptParams(ImpCaptParams& rPara) const 436*cdf0e10cSrcweir { 437*cdf0e10cSrcweir const SfxItemSet& rSet = GetObjectItemSet(); 438*cdf0e10cSrcweir rPara.eType =((SdrCaptionTypeItem&) (rSet.Get(SDRATTR_CAPTIONTYPE ))).GetValue(); 439*cdf0e10cSrcweir rPara.bFixedAngle=((SdrCaptionFixedAngleItem&)(rSet.Get(SDRATTR_CAPTIONANGLE ))).GetValue(); 440*cdf0e10cSrcweir rPara.nAngle =((SdrCaptionAngleItem&) (rSet.Get(SDRATTR_CAPTIONFIXEDANGLE))).GetValue(); 441*cdf0e10cSrcweir rPara.nGap =((SdrCaptionGapItem&) (rSet.Get(SDRATTR_CAPTIONGAP ))).GetValue(); 442*cdf0e10cSrcweir rPara.eEscDir =((SdrCaptionEscDirItem&) (rSet.Get(SDRATTR_CAPTIONESCDIR ))).GetValue(); 443*cdf0e10cSrcweir rPara.bEscRel =((SdrCaptionEscIsRelItem&) (rSet.Get(SDRATTR_CAPTIONESCISREL ))).GetValue(); 444*cdf0e10cSrcweir rPara.nEscRel =((SdrCaptionEscRelItem&) (rSet.Get(SDRATTR_CAPTIONESCREL ))).GetValue(); 445*cdf0e10cSrcweir rPara.nEscAbs =((SdrCaptionEscAbsItem&) (rSet.Get(SDRATTR_CAPTIONESCABS ))).GetValue(); 446*cdf0e10cSrcweir rPara.nLineLen =((SdrCaptionLineLenItem&) (rSet.Get(SDRATTR_CAPTIONLINELEN ))).GetValue(); 447*cdf0e10cSrcweir rPara.bFitLineLen=((SdrCaptionFitLineLenItem&)(rSet.Get(SDRATTR_CAPTIONFITLINELEN))).GetValue(); 448*cdf0e10cSrcweir } 449*cdf0e10cSrcweir 450*cdf0e10cSrcweir void SdrCaptionObj::ImpRecalcTail() 451*cdf0e10cSrcweir { 452*cdf0e10cSrcweir ImpCaptParams aPara; 453*cdf0e10cSrcweir ImpGetCaptParams(aPara); 454*cdf0e10cSrcweir ImpCalcTail(aPara,aTailPoly,aRect); 455*cdf0e10cSrcweir SetRectsDirty(); 456*cdf0e10cSrcweir SetXPolyDirty(); 457*cdf0e10cSrcweir } 458*cdf0e10cSrcweir 459*cdf0e10cSrcweir // #i35971# 460*cdf0e10cSrcweir // SdrCaptionObj::ImpCalcTail1 does move the object(!). What a hack. 461*cdf0e10cSrcweir // I really wonder why this had not triggered problems before. I am 462*cdf0e10cSrcweir // sure there are some places where SetTailPos() is called at least 463*cdf0e10cSrcweir // twice or SetSnapRect after it again just to work around this. 464*cdf0e10cSrcweir // Changed this method to not do that. 465*cdf0e10cSrcweir // Also found why this has been done: For interactive dragging of the 466*cdf0e10cSrcweir // tail end pos for SDRCAPT_TYPE1. This sure was the simplest method 467*cdf0e10cSrcweir // to achieve this, for the cost to make a whole group of const methods 468*cdf0e10cSrcweir // of this object implicitly chainging the object's position. 469*cdf0e10cSrcweir void SdrCaptionObj::ImpCalcTail1(const ImpCaptParams& rPara, Polygon& rPoly, Rectangle& rRect) const 470*cdf0e10cSrcweir { 471*cdf0e10cSrcweir Polygon aPol(2); 472*cdf0e10cSrcweir Point aTl(rPoly[0]); 473*cdf0e10cSrcweir 474*cdf0e10cSrcweir aPol[0] = aTl; 475*cdf0e10cSrcweir aPol[1] = aTl; 476*cdf0e10cSrcweir 477*cdf0e10cSrcweir EscDir eEscDir; 478*cdf0e10cSrcweir Point aEscPos; 479*cdf0e10cSrcweir 480*cdf0e10cSrcweir rPara.CalcEscPos(aTl, rRect, aEscPos, eEscDir); 481*cdf0e10cSrcweir aPol[1] = aEscPos; 482*cdf0e10cSrcweir 483*cdf0e10cSrcweir if(eEscDir==LKS || eEscDir==RTS) 484*cdf0e10cSrcweir { 485*cdf0e10cSrcweir aPol[0].X() = aEscPos.X(); 486*cdf0e10cSrcweir } 487*cdf0e10cSrcweir else 488*cdf0e10cSrcweir { 489*cdf0e10cSrcweir aPol[0].Y() = aEscPos.Y(); 490*cdf0e10cSrcweir } 491*cdf0e10cSrcweir 492*cdf0e10cSrcweir rPoly = aPol; 493*cdf0e10cSrcweir } 494*cdf0e10cSrcweir 495*cdf0e10cSrcweir void SdrCaptionObj::ImpCalcTail2(const ImpCaptParams& rPara, Polygon& rPoly, Rectangle& rRect) const 496*cdf0e10cSrcweir { // Gap/EscDir/EscPos/Angle 497*cdf0e10cSrcweir Polygon aPol(2); 498*cdf0e10cSrcweir Point aTl(rPoly[0]); 499*cdf0e10cSrcweir aPol[0]=aTl; 500*cdf0e10cSrcweir 501*cdf0e10cSrcweir EscDir eEscDir; 502*cdf0e10cSrcweir Point aEscPos; 503*cdf0e10cSrcweir rPara.CalcEscPos(aTl,rRect,aEscPos,eEscDir); 504*cdf0e10cSrcweir aPol[1]=aEscPos; 505*cdf0e10cSrcweir 506*cdf0e10cSrcweir if (!rPara.bFixedAngle) { 507*cdf0e10cSrcweir // fehlende Implementation 508*cdf0e10cSrcweir } 509*cdf0e10cSrcweir rPoly=aPol; 510*cdf0e10cSrcweir } 511*cdf0e10cSrcweir 512*cdf0e10cSrcweir void SdrCaptionObj::ImpCalcTail3(const ImpCaptParams& rPara, Polygon& rPoly, Rectangle& rRect) const 513*cdf0e10cSrcweir { // Gap/EscDir/EscPos/Angle/LineLen 514*cdf0e10cSrcweir Polygon aPol(3); 515*cdf0e10cSrcweir Point aTl(rPoly[0]); 516*cdf0e10cSrcweir aPol[0]=aTl; 517*cdf0e10cSrcweir 518*cdf0e10cSrcweir EscDir eEscDir; 519*cdf0e10cSrcweir Point aEscPos; 520*cdf0e10cSrcweir rPara.CalcEscPos(aTl,rRect,aEscPos,eEscDir); 521*cdf0e10cSrcweir aPol[1]=aEscPos; 522*cdf0e10cSrcweir aPol[2]=aEscPos; 523*cdf0e10cSrcweir 524*cdf0e10cSrcweir if (eEscDir==LKS || eEscDir==RTS) { 525*cdf0e10cSrcweir if (rPara.bFitLineLen) { 526*cdf0e10cSrcweir aPol[1].X()=(aTl.X()+aEscPos.X())/2; 527*cdf0e10cSrcweir } else { 528*cdf0e10cSrcweir if (eEscDir==LKS) aPol[1].X()-=rPara.nLineLen; 529*cdf0e10cSrcweir else aPol[1].X()+=rPara.nLineLen; 530*cdf0e10cSrcweir } 531*cdf0e10cSrcweir } else { 532*cdf0e10cSrcweir if (rPara.bFitLineLen) { 533*cdf0e10cSrcweir aPol[1].Y()=(aTl.Y()+aEscPos.Y())/2; 534*cdf0e10cSrcweir } else { 535*cdf0e10cSrcweir if (eEscDir==OBN) aPol[1].Y()-=rPara.nLineLen; 536*cdf0e10cSrcweir else aPol[1].Y()+=rPara.nLineLen; 537*cdf0e10cSrcweir } 538*cdf0e10cSrcweir } 539*cdf0e10cSrcweir if (!rPara.bFixedAngle) { 540*cdf0e10cSrcweir // fehlende Implementation 541*cdf0e10cSrcweir } 542*cdf0e10cSrcweir rPoly=aPol; 543*cdf0e10cSrcweir } 544*cdf0e10cSrcweir 545*cdf0e10cSrcweir void SdrCaptionObj::ImpCalcTail4(const ImpCaptParams& rPara, Polygon& rPoly, Rectangle& rRect) const 546*cdf0e10cSrcweir { 547*cdf0e10cSrcweir ImpCalcTail3(rPara,rPoly,rRect); 548*cdf0e10cSrcweir } 549*cdf0e10cSrcweir 550*cdf0e10cSrcweir void SdrCaptionObj::ImpCalcTail(const ImpCaptParams& rPara, Polygon& rPoly, Rectangle& rRect) const 551*cdf0e10cSrcweir { 552*cdf0e10cSrcweir switch (rPara.eType) { 553*cdf0e10cSrcweir case SDRCAPT_TYPE1: ImpCalcTail1(rPara,rPoly,rRect); break; 554*cdf0e10cSrcweir case SDRCAPT_TYPE2: ImpCalcTail2(rPara,rPoly,rRect); break; 555*cdf0e10cSrcweir case SDRCAPT_TYPE3: ImpCalcTail3(rPara,rPoly,rRect); break; 556*cdf0e10cSrcweir case SDRCAPT_TYPE4: ImpCalcTail4(rPara,rPoly,rRect); break; 557*cdf0e10cSrcweir } 558*cdf0e10cSrcweir } 559*cdf0e10cSrcweir 560*cdf0e10cSrcweir FASTBOOL SdrCaptionObj::BegCreate(SdrDragStat& rStat) 561*cdf0e10cSrcweir { 562*cdf0e10cSrcweir if (aRect.IsEmpty()) return sal_False; // Create z.Zt. nur mit vorgegebenen Rect 563*cdf0e10cSrcweir 564*cdf0e10cSrcweir ImpCaptParams aPara; 565*cdf0e10cSrcweir ImpGetCaptParams(aPara); 566*cdf0e10cSrcweir aRect.SetPos(rStat.GetNow()); 567*cdf0e10cSrcweir aTailPoly[0]=rStat.GetStart(); 568*cdf0e10cSrcweir ImpCalcTail(aPara,aTailPoly,aRect); 569*cdf0e10cSrcweir rStat.SetActionRect(aRect); 570*cdf0e10cSrcweir return sal_True; 571*cdf0e10cSrcweir } 572*cdf0e10cSrcweir 573*cdf0e10cSrcweir FASTBOOL SdrCaptionObj::MovCreate(SdrDragStat& rStat) 574*cdf0e10cSrcweir { 575*cdf0e10cSrcweir ImpCaptParams aPara; 576*cdf0e10cSrcweir ImpGetCaptParams(aPara); 577*cdf0e10cSrcweir aRect.SetPos(rStat.GetNow()); 578*cdf0e10cSrcweir ImpCalcTail(aPara,aTailPoly,aRect); 579*cdf0e10cSrcweir rStat.SetActionRect(aRect); 580*cdf0e10cSrcweir SetBoundRectDirty(); 581*cdf0e10cSrcweir bSnapRectDirty=sal_True; 582*cdf0e10cSrcweir return sal_True; 583*cdf0e10cSrcweir } 584*cdf0e10cSrcweir 585*cdf0e10cSrcweir FASTBOOL SdrCaptionObj::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) 586*cdf0e10cSrcweir { 587*cdf0e10cSrcweir ImpCaptParams aPara; 588*cdf0e10cSrcweir ImpGetCaptParams(aPara); 589*cdf0e10cSrcweir aRect.SetPos(rStat.GetNow()); 590*cdf0e10cSrcweir ImpCalcTail(aPara,aTailPoly,aRect); 591*cdf0e10cSrcweir SetRectsDirty(); 592*cdf0e10cSrcweir return (eCmd==SDRCREATE_FORCEEND || rStat.GetPointAnz()>=2); 593*cdf0e10cSrcweir } 594*cdf0e10cSrcweir 595*cdf0e10cSrcweir FASTBOOL SdrCaptionObj::BckCreate(SdrDragStat& /*rStat*/) 596*cdf0e10cSrcweir { 597*cdf0e10cSrcweir return sal_False; 598*cdf0e10cSrcweir } 599*cdf0e10cSrcweir 600*cdf0e10cSrcweir void SdrCaptionObj::BrkCreate(SdrDragStat& /*rStat*/) 601*cdf0e10cSrcweir { 602*cdf0e10cSrcweir } 603*cdf0e10cSrcweir 604*cdf0e10cSrcweir basegfx::B2DPolyPolygon SdrCaptionObj::TakeCreatePoly(const SdrDragStat& /*rDrag*/) const 605*cdf0e10cSrcweir { 606*cdf0e10cSrcweir basegfx::B2DPolyPolygon aRetval; 607*cdf0e10cSrcweir const basegfx::B2DRange aRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom()); 608*cdf0e10cSrcweir aRetval.append(basegfx::tools::createPolygonFromRect(aRange)); 609*cdf0e10cSrcweir aRetval.append(aTailPoly.getB2DPolygon()); 610*cdf0e10cSrcweir return aRetval; 611*cdf0e10cSrcweir } 612*cdf0e10cSrcweir 613*cdf0e10cSrcweir Pointer SdrCaptionObj::GetCreatePointer() const 614*cdf0e10cSrcweir { 615*cdf0e10cSrcweir return Pointer(POINTER_DRAW_CAPTION); 616*cdf0e10cSrcweir } 617*cdf0e10cSrcweir 618*cdf0e10cSrcweir void SdrCaptionObj::NbcMove(const Size& rSiz) 619*cdf0e10cSrcweir { 620*cdf0e10cSrcweir SdrRectObj::NbcMove(rSiz); 621*cdf0e10cSrcweir MovePoly(aTailPoly,rSiz); 622*cdf0e10cSrcweir if(mbFixedTail) 623*cdf0e10cSrcweir SetTailPos(GetFixedTailPos()); 624*cdf0e10cSrcweir } 625*cdf0e10cSrcweir 626*cdf0e10cSrcweir void SdrCaptionObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) 627*cdf0e10cSrcweir { 628*cdf0e10cSrcweir SdrRectObj::NbcResize(rRef,xFact,yFact); 629*cdf0e10cSrcweir ResizePoly(aTailPoly,rRef,xFact,yFact); 630*cdf0e10cSrcweir ImpRecalcTail(); 631*cdf0e10cSrcweir if(mbFixedTail) 632*cdf0e10cSrcweir SetTailPos(GetFixedTailPos()); 633*cdf0e10cSrcweir } 634*cdf0e10cSrcweir 635*cdf0e10cSrcweir void SdrCaptionObj::NbcSetRelativePos(const Point& rPnt) 636*cdf0e10cSrcweir { 637*cdf0e10cSrcweir Point aRelPos0(aTailPoly.GetPoint(0)-aAnchor); 638*cdf0e10cSrcweir Size aSiz(rPnt.X()-aRelPos0.X(),rPnt.Y()-aRelPos0.Y()); 639*cdf0e10cSrcweir NbcMove(aSiz); // Der ruft auch das SetRectsDirty() 640*cdf0e10cSrcweir } 641*cdf0e10cSrcweir 642*cdf0e10cSrcweir Point SdrCaptionObj::GetRelativePos() const 643*cdf0e10cSrcweir { 644*cdf0e10cSrcweir return aTailPoly.GetPoint(0)-aAnchor; 645*cdf0e10cSrcweir } 646*cdf0e10cSrcweir 647*cdf0e10cSrcweir void SdrCaptionObj::NbcSetAnchorPos(const Point& rPnt) 648*cdf0e10cSrcweir { 649*cdf0e10cSrcweir SdrRectObj::NbcSetAnchorPos(rPnt); 650*cdf0e10cSrcweir // !!!!! fehlende Impl. 651*cdf0e10cSrcweir } 652*cdf0e10cSrcweir 653*cdf0e10cSrcweir const Point& SdrCaptionObj::GetAnchorPos() const 654*cdf0e10cSrcweir { 655*cdf0e10cSrcweir // !!!!! fehlende Impl. 656*cdf0e10cSrcweir return SdrRectObj::GetAnchorPos(); 657*cdf0e10cSrcweir } 658*cdf0e10cSrcweir 659*cdf0e10cSrcweir void SdrCaptionObj::RecalcSnapRect() 660*cdf0e10cSrcweir { 661*cdf0e10cSrcweir SdrRectObj::RecalcSnapRect(); 662*cdf0e10cSrcweir // #i32599# 663*cdf0e10cSrcweir // maSnapRect.Union(aTailPoly.GetBoundRect()); 664*cdf0e10cSrcweir // !!!!! fehlende Impl. 665*cdf0e10cSrcweir } 666*cdf0e10cSrcweir 667*cdf0e10cSrcweir const Rectangle& SdrCaptionObj::GetSnapRect() const 668*cdf0e10cSrcweir { 669*cdf0e10cSrcweir return SdrRectObj::GetSnapRect(); 670*cdf0e10cSrcweir } 671*cdf0e10cSrcweir 672*cdf0e10cSrcweir void SdrCaptionObj::NbcSetSnapRect(const Rectangle& rRect) 673*cdf0e10cSrcweir { 674*cdf0e10cSrcweir // #i32599# 675*cdf0e10cSrcweir // Move back to see the rectangle of the underlying SdrRectObj 676*cdf0e10cSrcweir // as the SnapRect, without the TailPos. That simplifies SnapRect 677*cdf0e10cSrcweir // handling again, if not allows it at all... 678*cdf0e10cSrcweir SdrRectObj::NbcSetSnapRect(rRect); 679*cdf0e10cSrcweir } 680*cdf0e10cSrcweir 681*cdf0e10cSrcweir const Rectangle& SdrCaptionObj::GetLogicRect() const 682*cdf0e10cSrcweir { 683*cdf0e10cSrcweir return aRect; 684*cdf0e10cSrcweir } 685*cdf0e10cSrcweir 686*cdf0e10cSrcweir void SdrCaptionObj::NbcSetLogicRect(const Rectangle& rRect) 687*cdf0e10cSrcweir { 688*cdf0e10cSrcweir SdrRectObj::NbcSetLogicRect(rRect); 689*cdf0e10cSrcweir ImpRecalcTail(); 690*cdf0e10cSrcweir } 691*cdf0e10cSrcweir 692*cdf0e10cSrcweir const Point& SdrCaptionObj::GetTailPos() const 693*cdf0e10cSrcweir { 694*cdf0e10cSrcweir return aTailPoly[0]; 695*cdf0e10cSrcweir } 696*cdf0e10cSrcweir 697*cdf0e10cSrcweir void SdrCaptionObj::SetTailPos(const Point& rPos) 698*cdf0e10cSrcweir { 699*cdf0e10cSrcweir if (aTailPoly.GetSize()==0 || aTailPoly[0]!=rPos) { 700*cdf0e10cSrcweir Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect(); 701*cdf0e10cSrcweir // #110094#-14 SendRepaintBroadcast(); 702*cdf0e10cSrcweir NbcSetTailPos(rPos); 703*cdf0e10cSrcweir SetChanged(); 704*cdf0e10cSrcweir BroadcastObjectChange(); 705*cdf0e10cSrcweir SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0); 706*cdf0e10cSrcweir } 707*cdf0e10cSrcweir } 708*cdf0e10cSrcweir 709*cdf0e10cSrcweir void SdrCaptionObj::NbcSetTailPos(const Point& rPos) 710*cdf0e10cSrcweir { 711*cdf0e10cSrcweir aTailPoly[0]=rPos; 712*cdf0e10cSrcweir ImpRecalcTail(); 713*cdf0e10cSrcweir } 714*cdf0e10cSrcweir 715*cdf0e10cSrcweir sal_uInt32 SdrCaptionObj::GetSnapPointCount() const 716*cdf0e10cSrcweir { 717*cdf0e10cSrcweir // !!!!! fehlende Impl. 718*cdf0e10cSrcweir return 0L; 719*cdf0e10cSrcweir } 720*cdf0e10cSrcweir 721*cdf0e10cSrcweir Point SdrCaptionObj::GetSnapPoint(sal_uInt32 /*i*/) const 722*cdf0e10cSrcweir { 723*cdf0e10cSrcweir // !!!!! fehlende Impl. 724*cdf0e10cSrcweir return Point(0,0); 725*cdf0e10cSrcweir } 726*cdf0e10cSrcweir 727*cdf0e10cSrcweir void SdrCaptionObj::SetModel(SdrModel* pNewModel) 728*cdf0e10cSrcweir { 729*cdf0e10cSrcweir SdrRectObj::SetModel(pNewModel); 730*cdf0e10cSrcweir ImpRecalcTail(); 731*cdf0e10cSrcweir } 732*cdf0e10cSrcweir 733*cdf0e10cSrcweir void SdrCaptionObj::Notify(SfxBroadcaster& rBC, const SfxHint& rHint) 734*cdf0e10cSrcweir { 735*cdf0e10cSrcweir SdrRectObj::Notify(rBC,rHint); 736*cdf0e10cSrcweir ImpRecalcTail(); 737*cdf0e10cSrcweir } 738*cdf0e10cSrcweir 739*cdf0e10cSrcweir SdrObjGeoData* SdrCaptionObj::NewGeoData() const 740*cdf0e10cSrcweir { 741*cdf0e10cSrcweir return new SdrCaptObjGeoData; 742*cdf0e10cSrcweir } 743*cdf0e10cSrcweir 744*cdf0e10cSrcweir void SdrCaptionObj::SaveGeoData(SdrObjGeoData& rGeo) const 745*cdf0e10cSrcweir { 746*cdf0e10cSrcweir SdrRectObj::SaveGeoData(rGeo); 747*cdf0e10cSrcweir SdrCaptObjGeoData& rCGeo=(SdrCaptObjGeoData&)rGeo; 748*cdf0e10cSrcweir rCGeo.aTailPoly=aTailPoly; 749*cdf0e10cSrcweir } 750*cdf0e10cSrcweir 751*cdf0e10cSrcweir void SdrCaptionObj::RestGeoData(const SdrObjGeoData& rGeo) 752*cdf0e10cSrcweir { 753*cdf0e10cSrcweir SdrRectObj::RestGeoData(rGeo); 754*cdf0e10cSrcweir SdrCaptObjGeoData& rCGeo=(SdrCaptObjGeoData&)rGeo; 755*cdf0e10cSrcweir aTailPoly=rCGeo.aTailPoly; 756*cdf0e10cSrcweir } 757*cdf0e10cSrcweir 758*cdf0e10cSrcweir SdrObject* SdrCaptionObj::DoConvertToPolyObj(sal_Bool bBezier) const 759*cdf0e10cSrcweir { // #42334# - Convert implementiert 760*cdf0e10cSrcweir SdrObject* pRect=SdrRectObj::DoConvertToPolyObj(bBezier); 761*cdf0e10cSrcweir SdrObject* pTail = ImpConvertMakeObj(basegfx::B2DPolyPolygon(aTailPoly.getB2DPolygon()), sal_False, bBezier); 762*cdf0e10cSrcweir SdrObject* pRet=(pTail!=NULL) ? pTail : pRect; 763*cdf0e10cSrcweir if (pTail!=NULL && pRect!=NULL) { 764*cdf0e10cSrcweir FASTBOOL bInsRect=sal_True; 765*cdf0e10cSrcweir FASTBOOL bInsTail=sal_True; 766*cdf0e10cSrcweir SdrObjList* pOL=pTail->GetSubList(); 767*cdf0e10cSrcweir if (pOL!=NULL) { pRet=pRect; bInsTail=sal_False; } 768*cdf0e10cSrcweir if (pOL==NULL) pOL=pRect->GetSubList(); 769*cdf0e10cSrcweir if (pOL!=NULL) { pRet=pRect; bInsRect=sal_False; } 770*cdf0e10cSrcweir if (pOL==NULL) { 771*cdf0e10cSrcweir SdrObjGroup* pGrp=new SdrObjGroup; 772*cdf0e10cSrcweir pOL=pGrp->GetSubList(); 773*cdf0e10cSrcweir pRet=pGrp; 774*cdf0e10cSrcweir } 775*cdf0e10cSrcweir if (bInsRect) pOL->NbcInsertObject(pRect); 776*cdf0e10cSrcweir if (bInsTail) pOL->NbcInsertObject(pTail,0); 777*cdf0e10cSrcweir } 778*cdf0e10cSrcweir return pRet; 779*cdf0e10cSrcweir } 780*cdf0e10cSrcweir 781*cdf0e10cSrcweir // #i32599# 782*cdf0e10cSrcweir // Add own implementation for TRSetBaseGeometry to handle TailPos over changes. 783*cdf0e10cSrcweir void SdrCaptionObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& /*rPolyPolygon*/) 784*cdf0e10cSrcweir { 785*cdf0e10cSrcweir // break up matrix 786*cdf0e10cSrcweir basegfx::B2DTuple aScale; 787*cdf0e10cSrcweir basegfx::B2DTuple aTranslate; 788*cdf0e10cSrcweir double fRotate, fShearX; 789*cdf0e10cSrcweir rMatrix.decompose(aScale, aTranslate, fRotate, fShearX); 790*cdf0e10cSrcweir 791*cdf0e10cSrcweir // #i75086# Old DrawingLayer (GeoStat and geometry) does not support holding negative scalings 792*cdf0e10cSrcweir // in X and Y which equal a 180 degree rotation. Recognize it and react accordingly 793*cdf0e10cSrcweir if(basegfx::fTools::less(aScale.getX(), 0.0) && basegfx::fTools::less(aScale.getY(), 0.0)) 794*cdf0e10cSrcweir { 795*cdf0e10cSrcweir aScale.setX(fabs(aScale.getX())); 796*cdf0e10cSrcweir aScale.setY(fabs(aScale.getY())); 797*cdf0e10cSrcweir fRotate = fmod(fRotate + F_PI, F_2PI); 798*cdf0e10cSrcweir } 799*cdf0e10cSrcweir 800*cdf0e10cSrcweir // force metric to pool metric 801*cdf0e10cSrcweir SfxMapUnit eMapUnit = pModel->GetItemPool().GetMetric(0); 802*cdf0e10cSrcweir if(eMapUnit != SFX_MAPUNIT_100TH_MM) 803*cdf0e10cSrcweir { 804*cdf0e10cSrcweir switch(eMapUnit) 805*cdf0e10cSrcweir { 806*cdf0e10cSrcweir case SFX_MAPUNIT_TWIP : 807*cdf0e10cSrcweir { 808*cdf0e10cSrcweir // position 809*cdf0e10cSrcweir aTranslate.setX(ImplMMToTwips(aTranslate.getX())); 810*cdf0e10cSrcweir aTranslate.setY(ImplMMToTwips(aTranslate.getY())); 811*cdf0e10cSrcweir 812*cdf0e10cSrcweir // size 813*cdf0e10cSrcweir aScale.setX(ImplMMToTwips(aScale.getX())); 814*cdf0e10cSrcweir aScale.setY(ImplMMToTwips(aScale.getY())); 815*cdf0e10cSrcweir 816*cdf0e10cSrcweir break; 817*cdf0e10cSrcweir } 818*cdf0e10cSrcweir default: 819*cdf0e10cSrcweir { 820*cdf0e10cSrcweir DBG_ERROR("TRSetBaseGeometry: Missing unit translation to PoolMetric!"); 821*cdf0e10cSrcweir } 822*cdf0e10cSrcweir } 823*cdf0e10cSrcweir } 824*cdf0e10cSrcweir 825*cdf0e10cSrcweir // if anchor is used, make position relative to it 826*cdf0e10cSrcweir if( pModel->IsWriter() ) 827*cdf0e10cSrcweir { 828*cdf0e10cSrcweir if(GetAnchorPos().X() || GetAnchorPos().Y()) 829*cdf0e10cSrcweir { 830*cdf0e10cSrcweir aTranslate += basegfx::B2DTuple(GetAnchorPos().X(), GetAnchorPos().Y()); 831*cdf0e10cSrcweir } 832*cdf0e10cSrcweir } 833*cdf0e10cSrcweir 834*cdf0e10cSrcweir // build BaseRect 835*cdf0e10cSrcweir Point aPoint(FRound(aTranslate.getX()), FRound(aTranslate.getY())); 836*cdf0e10cSrcweir Rectangle aBaseRect(aPoint, Size(FRound(aScale.getX()), FRound(aScale.getY()))); 837*cdf0e10cSrcweir 838*cdf0e10cSrcweir // set BaseRect, but rescue TailPos over this call 839*cdf0e10cSrcweir const Point aTailPoint = GetTailPos(); 840*cdf0e10cSrcweir SetSnapRect(aBaseRect); 841*cdf0e10cSrcweir SetTailPos(aTailPoint); 842*cdf0e10cSrcweir ImpRecalcTail(); 843*cdf0e10cSrcweir } 844*cdf0e10cSrcweir 845*cdf0e10cSrcweir // geometry access 846*cdf0e10cSrcweir basegfx::B2DPolygon SdrCaptionObj::getTailPolygon() const 847*cdf0e10cSrcweir { 848*cdf0e10cSrcweir return aTailPoly.getB2DPolygon(); 849*cdf0e10cSrcweir } 850*cdf0e10cSrcweir 851*cdf0e10cSrcweir // eof 852