| 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
| 2 | /* |
| 3 | * This file is part of the LibreOffice project. |
| 4 | * |
| 5 | * This Source Code Form is subject to the terms of the Mozilla Public |
| 6 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 7 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 8 | * |
| 9 | * This file incorporates work covered by the following license notice: |
| 10 | * |
| 11 | * Licensed to the Apache Software Foundation (ASF) under one or more |
| 12 | * contributor license agreements. See the NOTICE file distributed |
| 13 | * with this work for additional information regarding copyright |
| 14 | * ownership. The ASF licenses this file to you under the Apache |
| 15 | * License, Version 2.0 (the "License"); you may not use this file |
| 16 | * except in compliance with the License. You may obtain a copy of |
| 17 | * the License at http://www.apache.org/licenses/LICENSE-2.0 . |
| 18 | */ |
| 19 | |
| 20 | |
| 21 | #include <sdr/properties/emptyproperties.hxx> |
| 22 | #include <svx/svdovirt.hxx> |
| 23 | #include <svx/svdhdl.hxx> |
| 24 | #include <svx/sdr/contact/viewcontactofvirtobj.hxx> |
| 25 | #include <svx/svdograf.hxx> |
| 26 | #include <svx/svddrgv.hxx> |
| 27 | #include <basegfx/matrix/b2dhommatrixtools.hxx> |
| 28 | |
| 29 | sdr::properties::BaseProperties& SdrVirtObj::GetProperties() const |
| 30 | { |
| 31 | return mxRefObj->GetProperties(); |
| 32 | } |
| 33 | |
| 34 | |
| 35 | std::unique_ptr<sdr::properties::BaseProperties> SdrVirtObj::CreateObjectSpecificProperties() |
| 36 | { |
| 37 | return std::make_unique<sdr::properties::EmptyProperties>(*this); |
| 38 | } |
| 39 | |
| 40 | // #i27224# |
| 41 | std::unique_ptr<sdr::contact::ViewContact> SdrVirtObj::CreateObjectSpecificViewContact() |
| 42 | { |
| 43 | return std::make_unique<sdr::contact::ViewContactOfVirtObj>(*this); |
| 44 | } |
| 45 | |
| 46 | SdrVirtObj::SdrVirtObj( |
| 47 | SdrModel& rSdrModel, |
| 48 | SdrObject& rNewObj) |
| 49 | : SdrObject(rSdrModel), |
| 50 | mxRefObj(&rNewObj) |
| 51 | { |
| 52 | m_bVirtObj=true; // this is only a virtual object |
| 53 | mxRefObj->AddReference(*this); |
| 54 | m_bClosedObj = mxRefObj->IsClosedObj(); |
| 55 | } |
| 56 | |
| 57 | SdrVirtObj::SdrVirtObj( |
| 58 | SdrModel& rSdrModel, SdrVirtObj const & rSource) |
| 59 | : SdrObject(rSdrModel, rSource), |
| 60 | mxRefObj(rSource.mxRefObj) |
| 61 | { |
| 62 | m_bVirtObj=true; // this is only a virtual object |
| 63 | m_bClosedObj = mxRefObj->IsClosedObj(); |
| 64 | |
| 65 | mxRefObj->AddReference(*this); |
| 66 | |
| 67 | maSnapRect = rSource.maSnapRect; |
| 68 | m_aAnchor = rSource.m_aAnchor; |
| 69 | } |
| 70 | |
| 71 | SdrVirtObj::~SdrVirtObj() |
| 72 | { |
| 73 | mxRefObj->DelReference(*this); |
| 74 | } |
| 75 | |
| 76 | const SdrObject& SdrVirtObj::GetReferencedObj() const |
| 77 | { |
| 78 | return *mxRefObj; |
| 79 | } |
| 80 | |
| 81 | SdrObject& SdrVirtObj::ReferencedObj() |
| 82 | { |
| 83 | return *mxRefObj; |
| 84 | } |
| 85 | |
| 86 | void SdrVirtObj::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& /*rHint*/) |
| 87 | { |
| 88 | m_bClosedObj = mxRefObj->IsClosedObj(); |
| 89 | SetBoundAndSnapRectsDirty(); // TODO: Optimize this. |
| 90 | |
| 91 | // Only a repaint here, rRefObj may have changed and broadcasts |
| 92 | ActionChanged(); |
| 93 | } |
| 94 | |
| 95 | void SdrVirtObj::NbcSetAnchorPos(const Point& rAnchorPos) |
| 96 | { |
| 97 | m_aAnchor=rAnchorPos; |
| 98 | } |
| 99 | |
| 100 | bool SdrVirtObj::IsPrintable() const |
| 101 | { |
| 102 | return mxRefObj->IsPrintable(); |
| 103 | } |
| 104 | |
| 105 | void SdrVirtObj::SetPrintable(bool const isPrintable) |
| 106 | { |
| 107 | mxRefObj->SetPrintable(isPrintable); |
| 108 | } |
| 109 | |
| 110 | bool SdrVirtObj::IsVisible() const |
| 111 | { |
| 112 | return mxRefObj->IsVisible(); |
| 113 | } |
| 114 | |
| 115 | void SdrVirtObj::SetVisible(bool const isVisible) |
| 116 | { |
| 117 | mxRefObj->SetVisible(isVisible); |
| 118 | } |
| 119 | |
| 120 | void SdrVirtObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const |
| 121 | { |
| 122 | mxRefObj->TakeObjInfo(rInfo); |
| 123 | } |
| 124 | |
| 125 | SdrInventor SdrVirtObj::GetObjInventor() const |
| 126 | { |
| 127 | return mxRefObj->GetObjInventor(); |
| 128 | } |
| 129 | |
| 130 | SdrObjKind SdrVirtObj::GetObjIdentifier() const |
| 131 | { |
| 132 | return mxRefObj->GetObjIdentifier(); |
| 133 | } |
| 134 | |
| 135 | SdrObjList* SdrVirtObj::GetSubList() const |
| 136 | { |
| 137 | return mxRefObj->GetSubList(); |
| 138 | } |
| 139 | |
| 140 | void SdrVirtObj::SetName(const OUString& rStr, const bool bSetChanged) |
| 141 | { |
| 142 | return mxRefObj->SetName(rStr, bSetChanged); |
| 143 | } |
| 144 | |
| 145 | const OUString & SdrVirtObj::GetName() const |
| 146 | { |
| 147 | return mxRefObj->GetName(); |
| 148 | } |
| 149 | |
| 150 | void SdrVirtObj::SetTitle(const OUString& rStr) |
| 151 | { |
| 152 | return mxRefObj->SetTitle(rStr); |
| 153 | } |
| 154 | |
| 155 | OUString SdrVirtObj::GetTitle() const |
| 156 | { |
| 157 | return mxRefObj->GetTitle(); |
| 158 | } |
| 159 | |
| 160 | void SdrVirtObj::SetDescription(const OUString& rStr) |
| 161 | { |
| 162 | return mxRefObj->SetDescription(rStr); |
| 163 | } |
| 164 | |
| 165 | OUString SdrVirtObj::GetDescription() const |
| 166 | { |
| 167 | return mxRefObj->GetDescription(); |
| 168 | } |
| 169 | |
| 170 | void SdrVirtObj::SetDecorative(bool const isDecorative) |
| 171 | { |
| 172 | return mxRefObj->SetDecorative(isDecorative); |
| 173 | } |
| 174 | |
| 175 | bool SdrVirtObj::IsDecorative() const |
| 176 | { |
| 177 | return mxRefObj->IsDecorative(); |
| 178 | } |
| 179 | |
| 180 | const tools::Rectangle& SdrVirtObj::GetCurrentBoundRect() const |
| 181 | { |
| 182 | auto aRectangle = mxRefObj->GetCurrentBoundRect(); // TODO: Optimize this. |
| 183 | aRectangle += m_aAnchor; |
| 184 | setOutRectangleConst(aRectangle); |
| 185 | return getOutRectangle(); |
| 186 | } |
| 187 | |
| 188 | const tools::Rectangle& SdrVirtObj::GetLastBoundRect() const |
| 189 | { |
| 190 | auto aRectangle = mxRefObj->GetLastBoundRect(); // TODO: Optimize this. |
| 191 | aRectangle += m_aAnchor; |
| 192 | setOutRectangleConst(aRectangle); |
| 193 | return getOutRectangle(); |
| 194 | } |
| 195 | |
| 196 | void SdrVirtObj::RecalcBoundRect() |
| 197 | { |
| 198 | tools::Rectangle aRectangle = mxRefObj->GetCurrentBoundRect(); |
| 199 | aRectangle += m_aAnchor; |
| 200 | setOutRectangle(aRectangle); |
| 201 | } |
| 202 | |
| 203 | rtl::Reference<SdrObject> SdrVirtObj::CloneSdrObject(SdrModel& rTargetModel) const |
| 204 | { |
| 205 | return new SdrVirtObj(rTargetModel, *this); |
| 206 | // TTTT not sure if the above works - how could SdrObjFactory::MakeNewObject |
| 207 | // create an object with correct rRefObj (?) OTOH VirtObj probably needs not |
| 208 | // to be cloned ever - only used in Writer for multiple instances e.g. Header/Footer |
| 209 | // return new SdrVirtObj( |
| 210 | // getSdrModelFromSdrObject(), |
| 211 | // rRefObj); // only a further reference |
| 212 | } |
| 213 | |
| 214 | OUString SdrVirtObj::TakeObjNameSingul() const |
| 215 | { |
| 216 | OUString sName = "[" + mxRefObj->TakeObjNameSingul() + "]"; |
| 217 | |
| 218 | OUString aName(GetName()); |
| 219 | if (!aName.isEmpty()) |
| 220 | sName += " '" + aName + "'"; |
| 221 | |
| 222 | return sName; |
| 223 | } |
| 224 | |
| 225 | OUString SdrVirtObj::TakeObjNamePlural() const |
| 226 | { |
| 227 | return "[" + mxRefObj->TakeObjNamePlural() + "]"; |
| 228 | } |
| 229 | |
| 230 | bool SdrVirtObj::HasLimitedRotation() const |
| 231 | { |
| 232 | // RotGrfFlyFrame: If true, this SdrObject supports only limited rotation |
| 233 | return mxRefObj->HasLimitedRotation(); |
| 234 | } |
| 235 | |
| 236 | basegfx::B2DPolyPolygon SdrVirtObj::TakeXorPoly() const |
| 237 | { |
| 238 | basegfx::B2DPolyPolygon aPolyPolygon(mxRefObj->TakeXorPoly()); |
| 239 | |
| 240 | if(m_aAnchor.X() || m_aAnchor.Y()) |
| 241 | { |
| 242 | aPolyPolygon.translate(m_aAnchor.X(), m_aAnchor.Y()); |
| 243 | } |
| 244 | |
| 245 | return aPolyPolygon; |
| 246 | } |
| 247 | |
| 248 | |
| 249 | sal_uInt32 SdrVirtObj::GetHdlCount() const |
| 250 | { |
| 251 | return mxRefObj->GetHdlCount(); |
| 252 | } |
| 253 | |
| 254 | void SdrVirtObj::AddToHdlList(SdrHdlList& rHdlList) const |
| 255 | { |
| 256 | SdrHdlList tempList(nullptr); |
| 257 | mxRefObj->AddToHdlList(tempList); |
| 258 | for (size_t i=0; i<tempList.GetHdlCount(); ++i) |
| 259 | { |
| 260 | SdrHdl* pHdl = tempList.GetHdl(i); |
| 261 | Point aP(pHdl->GetPos()+m_aAnchor); |
| 262 | pHdl->SetPos(aP); |
| 263 | } |
| 264 | tempList.MoveTo(rHdlList); |
| 265 | } |
| 266 | |
| 267 | void SdrVirtObj::AddToPlusHdlList(SdrHdlList& rHdlList, SdrHdl& rHdl) const |
| 268 | { |
| 269 | SdrHdlList tempList(nullptr); |
| 270 | mxRefObj->AddToPlusHdlList(tempList, rHdl); |
| 271 | for (size_t i=0; i<tempList.GetHdlCount(); ++i) |
| 272 | { |
| 273 | SdrHdl* pHdl = tempList.GetHdl(i); |
| 274 | Point aP(pHdl->GetPos()+m_aAnchor); |
| 275 | pHdl->SetPos(aP); |
| 276 | } |
| 277 | tempList.MoveTo(rHdlList); |
| 278 | } |
| 279 | |
| 280 | bool SdrVirtObj::hasSpecialDrag() const |
| 281 | { |
| 282 | return mxRefObj->hasSpecialDrag(); |
| 283 | } |
| 284 | |
| 285 | bool SdrVirtObj::supportsFullDrag() const |
| 286 | { |
| 287 | return false; |
| 288 | } |
| 289 | |
| 290 | rtl::Reference<SdrObject> SdrVirtObj::getFullDragClone() const |
| 291 | { |
| 292 | SdrObject& rReferencedObject = const_cast<SdrVirtObj*>(this)->ReferencedObj(); |
| 293 | return rtl::Reference<SdrObject>(new SdrGrafObj( |
| 294 | getSdrModelFromSdrObject(), |
| 295 | SdrDragView::GetObjGraphic(rReferencedObject), |
| 296 | GetLogicRect())); |
| 297 | } |
| 298 | |
| 299 | bool SdrVirtObj::beginSpecialDrag(SdrDragStat& rDrag) const |
| 300 | { |
| 301 | return mxRefObj->beginSpecialDrag(rDrag); |
| 302 | } |
| 303 | |
| 304 | bool SdrVirtObj::applySpecialDrag(SdrDragStat& rDrag) |
| 305 | { |
| 306 | return mxRefObj->applySpecialDrag(rDrag); |
| 307 | } |
| 308 | |
| 309 | basegfx::B2DPolyPolygon SdrVirtObj::getSpecialDragPoly(const SdrDragStat& rDrag) const |
| 310 | { |
| 311 | return mxRefObj->getSpecialDragPoly(rDrag); |
| 312 | // TODO: we don't handle offsets yet! |
| 313 | } |
| 314 | |
| 315 | OUString SdrVirtObj::getSpecialDragComment(const SdrDragStat& rDrag) const |
| 316 | { |
| 317 | return mxRefObj->getSpecialDragComment(rDrag); |
| 318 | } |
| 319 | |
| 320 | |
| 321 | bool SdrVirtObj::BegCreate(SdrDragStat& rStat) |
| 322 | { |
| 323 | return mxRefObj->BegCreate(rStat); |
| 324 | } |
| 325 | |
| 326 | bool SdrVirtObj::MovCreate(SdrDragStat& rStat) |
| 327 | { |
| 328 | return mxRefObj->MovCreate(rStat); |
| 329 | } |
| 330 | |
| 331 | bool SdrVirtObj::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) |
| 332 | { |
| 333 | return mxRefObj->EndCreate(rStat,eCmd); |
| 334 | } |
| 335 | |
| 336 | bool SdrVirtObj::BckCreate(SdrDragStat& rStat) |
| 337 | { |
| 338 | return mxRefObj->BckCreate(rStat); |
| 339 | } |
| 340 | |
| 341 | void SdrVirtObj::BrkCreate(SdrDragStat& rStat) |
| 342 | { |
| 343 | mxRefObj->BrkCreate(rStat); |
| 344 | } |
| 345 | |
| 346 | basegfx::B2DPolyPolygon SdrVirtObj::TakeCreatePoly(const SdrDragStat& rDrag) const |
| 347 | { |
| 348 | return mxRefObj->TakeCreatePoly(rDrag); |
| 349 | // TODO: we don't handle offsets yet! |
| 350 | } |
| 351 | |
| 352 | |
| 353 | void SdrVirtObj::NbcMove(const Size& rSiz) |
| 354 | { |
| 355 | m_aAnchor.Move(rSiz); |
| 356 | SetBoundAndSnapRectsDirty(); |
| 357 | } |
| 358 | |
| 359 | void SdrVirtObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) |
| 360 | { |
| 361 | mxRefObj->NbcResize(rRef-m_aAnchor,xFact,yFact); |
| 362 | SetBoundAndSnapRectsDirty(); |
| 363 | } |
| 364 | |
| 365 | void SdrVirtObj::NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs) |
| 366 | { |
| 367 | mxRefObj->NbcRotate(rRef-m_aAnchor,nAngle,sn,cs); |
| 368 | SetBoundAndSnapRectsDirty(); |
| 369 | } |
| 370 | |
| 371 | void SdrVirtObj::NbcMirror(const Point& rRef1, const Point& rRef2) |
| 372 | { |
| 373 | mxRefObj->NbcMirror(rRef1-m_aAnchor,rRef2-m_aAnchor); |
| 374 | SetBoundAndSnapRectsDirty(); |
| 375 | } |
| 376 | |
| 377 | void SdrVirtObj::NbcShear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear) |
| 378 | { |
| 379 | mxRefObj->NbcShear(rRef-m_aAnchor,nAngle,tn,bVShear); |
| 380 | SetBoundAndSnapRectsDirty(); |
| 381 | } |
| 382 | |
| 383 | |
| 384 | void SdrVirtObj::Move(const Size& rSiz) |
| 385 | { |
| 386 | if (!rSiz.IsEmpty()) { |
| 387 | tools::Rectangle aBoundRect0; if (m_pUserCall!=nullptr) aBoundRect0=GetLastBoundRect(); |
| 388 | NbcMove(rSiz); |
| 389 | SetChanged(); |
| 390 | BroadcastObjectChange(); |
| 391 | SendUserCall(SdrUserCallType::MoveOnly,aBoundRect0); |
| 392 | } |
| 393 | } |
| 394 | |
| 395 | void SdrVirtObj::Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative) |
| 396 | { |
| 397 | if (xFact.GetNumerator()!=xFact.GetDenominator() || yFact.GetNumerator()!=yFact.GetDenominator()) { |
| 398 | tools::Rectangle aBoundRect0; if (m_pUserCall!=nullptr) aBoundRect0=GetLastBoundRect(); |
| 399 | mxRefObj->Resize(rRef-m_aAnchor,xFact,yFact, bUnsetRelative); |
| 400 | SetBoundAndSnapRectsDirty(); |
| 401 | SendUserCall(SdrUserCallType::Resize,aBoundRect0); |
| 402 | } |
| 403 | } |
| 404 | |
| 405 | void SdrVirtObj::Rotate(const Point& rRef, Degree100 nAngle, double sn, double cs) |
| 406 | { |
| 407 | if (nAngle) { |
| 408 | tools::Rectangle aBoundRect0; if (m_pUserCall!=nullptr) aBoundRect0=GetLastBoundRect(); |
| 409 | mxRefObj->Rotate(rRef-m_aAnchor,nAngle,sn,cs); |
| 410 | SetBoundAndSnapRectsDirty(); |
| 411 | SendUserCall(SdrUserCallType::Resize,aBoundRect0); |
| 412 | } |
| 413 | } |
| 414 | |
| 415 | void SdrVirtObj::Mirror(const Point& rRef1, const Point& rRef2) |
| 416 | { |
| 417 | tools::Rectangle aBoundRect0; if (m_pUserCall!=nullptr) aBoundRect0=GetLastBoundRect(); |
| 418 | mxRefObj->Mirror(rRef1-m_aAnchor,rRef2-m_aAnchor); |
| 419 | SetBoundAndSnapRectsDirty(); |
| 420 | SendUserCall(SdrUserCallType::Resize,aBoundRect0); |
| 421 | } |
| 422 | |
| 423 | void SdrVirtObj::Shear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear) |
| 424 | { |
| 425 | if (nAngle) { |
| 426 | tools::Rectangle aBoundRect0; if (m_pUserCall!=nullptr) aBoundRect0=GetLastBoundRect(); |
| 427 | mxRefObj->Shear(rRef-m_aAnchor,nAngle,tn,bVShear); |
| 428 | SetBoundAndSnapRectsDirty(); |
| 429 | SendUserCall(SdrUserCallType::Resize,aBoundRect0); |
| 430 | } |
| 431 | } |
| 432 | |
| 433 | |
| 434 | void SdrVirtObj::RecalcSnapRect() |
| 435 | { |
| 436 | maSnapRect=mxRefObj->GetSnapRect(); |
| 437 | maSnapRect+=m_aAnchor; |
| 438 | } |
| 439 | |
| 440 | const tools::Rectangle& SdrVirtObj::GetSnapRect() const |
| 441 | { |
| 442 | const_cast<SdrVirtObj*>(this)->maSnapRect=mxRefObj->GetSnapRect(); |
| 443 | const_cast<SdrVirtObj*>(this)->maSnapRect+=m_aAnchor; |
| 444 | return maSnapRect; |
| 445 | } |
| 446 | |
| 447 | void SdrVirtObj::SetSnapRect(const tools::Rectangle& rRect) |
| 448 | { |
| 449 | tools::Rectangle aBoundRect0; if (m_pUserCall!=nullptr) aBoundRect0=GetLastBoundRect(); |
| 450 | tools::Rectangle aR(rRect); |
| 451 | aR-=m_aAnchor; |
| 452 | mxRefObj->SetSnapRect(aR); |
| 453 | SetBoundAndSnapRectsDirty(); |
| 454 | SendUserCall(SdrUserCallType::Resize,aBoundRect0); |
| 455 | } |
| 456 | |
| 457 | void SdrVirtObj::NbcSetSnapRect(const tools::Rectangle& rRect) |
| 458 | { |
| 459 | tools::Rectangle aR(rRect); |
| 460 | aR-=m_aAnchor; |
| 461 | SetBoundAndSnapRectsDirty(); |
| 462 | mxRefObj->NbcSetSnapRect(aR); |
| 463 | } |
| 464 | |
| 465 | |
| 466 | const tools::Rectangle& SdrVirtObj::GetLogicRect() const |
| 467 | { |
| 468 | const_cast<SdrVirtObj*>(this)->maSnapRect=mxRefObj->GetLogicRect(); // An abuse of aSnapRect! |
| 469 | const_cast<SdrVirtObj*>(this)->maSnapRect+=m_aAnchor; // If there's trouble, we need another Rectangle Member (or a Heap). |
| 470 | return maSnapRect; |
| 471 | } |
| 472 | |
| 473 | void SdrVirtObj::SetLogicRect(const tools::Rectangle& rRect) |
| 474 | { |
| 475 | tools::Rectangle aBoundRect0; if (m_pUserCall!=nullptr) aBoundRect0=GetLastBoundRect(); |
| 476 | tools::Rectangle aR(rRect); |
| 477 | aR-=m_aAnchor; |
| 478 | mxRefObj->SetLogicRect(aR); |
| 479 | SetBoundAndSnapRectsDirty(); |
| 480 | SendUserCall(SdrUserCallType::Resize,aBoundRect0); |
| 481 | } |
| 482 | |
| 483 | void SdrVirtObj::NbcSetLogicRect(const tools::Rectangle& rRect, bool bAdaptTextMinSize) |
| 484 | { |
| 485 | tools::Rectangle aR(rRect); |
| 486 | aR-=m_aAnchor; |
| 487 | SetBoundAndSnapRectsDirty(); |
| 488 | mxRefObj->NbcSetLogicRect(aR, bAdaptTextMinSize); |
| 489 | } |
| 490 | |
| 491 | |
| 492 | Degree100 SdrVirtObj::GetRotateAngle() const |
| 493 | { |
| 494 | return mxRefObj->GetRotateAngle(); |
| 495 | } |
| 496 | |
| 497 | Degree100 SdrVirtObj::GetShearAngle(bool bVertical) const |
| 498 | { |
| 499 | return mxRefObj->GetShearAngle(bVertical); |
| 500 | } |
| 501 | |
| 502 | |
| 503 | sal_uInt32 SdrVirtObj::GetSnapPointCount() const |
| 504 | { |
| 505 | return mxRefObj->GetSnapPointCount(); |
| 506 | } |
| 507 | |
| 508 | Point SdrVirtObj::GetSnapPoint(sal_uInt32 i) const |
| 509 | { |
| 510 | Point aP(mxRefObj->GetSnapPoint(i)); |
| 511 | aP+=m_aAnchor; |
| 512 | return aP; |
| 513 | } |
| 514 | |
| 515 | bool SdrVirtObj::IsPolyObj() const |
| 516 | { |
| 517 | return mxRefObj->IsPolyObj(); |
| 518 | } |
| 519 | |
| 520 | sal_uInt32 SdrVirtObj::GetPointCount() const |
| 521 | { |
| 522 | return mxRefObj->GetPointCount(); |
| 523 | } |
| 524 | |
| 525 | Point SdrVirtObj::GetPoint(sal_uInt32 i) const |
| 526 | { |
| 527 | return mxRefObj->GetPoint(i) + m_aAnchor; |
| 528 | } |
| 529 | |
| 530 | void SdrVirtObj::NbcSetPoint(const Point& rPnt, sal_uInt32 i) |
| 531 | { |
| 532 | Point aP(rPnt); |
| 533 | aP-=m_aAnchor; |
| 534 | mxRefObj->SetPoint(aP,i); |
| 535 | SetBoundAndSnapRectsDirty(); |
| 536 | } |
| 537 | |
| 538 | |
| 539 | std::unique_ptr<SdrObjGeoData> SdrVirtObj::NewGeoData() const |
| 540 | { |
| 541 | return mxRefObj->NewGeoData(); |
| 542 | } |
| 543 | |
| 544 | void SdrVirtObj::SaveGeoData(SdrObjGeoData& rGeo) const |
| 545 | { |
| 546 | mxRefObj->SaveGeoData(rGeo); |
| 547 | } |
| 548 | |
| 549 | void SdrVirtObj::RestoreGeoData(const SdrObjGeoData& rGeo) |
| 550 | { |
| 551 | mxRefObj->RestoreGeoData(rGeo); |
| 552 | SetBoundAndSnapRectsDirty(); |
| 553 | } |
| 554 | |
| 555 | |
| 556 | std::unique_ptr<SdrObjGeoData> SdrVirtObj::GetGeoData() const |
| 557 | { |
| 558 | return mxRefObj->GetGeoData(); |
| 559 | } |
| 560 | |
| 561 | void SdrVirtObj::SetGeoData(const SdrObjGeoData& rGeo) |
| 562 | { |
| 563 | tools::Rectangle aBoundRect0; if (m_pUserCall!=nullptr) aBoundRect0=GetLastBoundRect(); |
| 564 | mxRefObj->SetGeoData(rGeo); |
| 565 | SetBoundAndSnapRectsDirty(); |
| 566 | SendUserCall(SdrUserCallType::Resize,aBoundRect0); |
| 567 | } |
| 568 | |
| 569 | |
| 570 | void SdrVirtObj::NbcReformatText() |
| 571 | { |
| 572 | mxRefObj->NbcReformatText(); |
| 573 | } |
| 574 | |
| 575 | bool SdrVirtObj::HasMacro() const |
| 576 | { |
| 577 | return mxRefObj->HasMacro(); |
| 578 | } |
| 579 | |
| 580 | SdrObject* SdrVirtObj::CheckMacroHit(const SdrObjMacroHitRec& rRec) const |
| 581 | { |
| 582 | return mxRefObj->CheckMacroHit(rRec); // TODO: positioning offset |
| 583 | } |
| 584 | |
| 585 | PointerStyle SdrVirtObj::GetMacroPointer(const SdrObjMacroHitRec& rRec) const |
| 586 | { |
| 587 | return mxRefObj->GetMacroPointer(rRec); // TODO: positioning offset |
| 588 | } |
| 589 | |
| 590 | void SdrVirtObj::PaintMacro(OutputDevice& rOut, const tools::Rectangle& rDirtyRect, const SdrObjMacroHitRec& rRec) const |
| 591 | { |
| 592 | mxRefObj->PaintMacro(rOut,rDirtyRect,rRec); // TODO: positioning offset |
| 593 | } |
| 594 | |
| 595 | bool SdrVirtObj::DoMacro(const SdrObjMacroHitRec& rRec) |
| 596 | { |
| 597 | return mxRefObj->DoMacro(rRec); // TODO: positioning offset |
| 598 | } |
| 599 | |
| 600 | Point SdrVirtObj::GetOffset() const |
| 601 | { |
| 602 | // #i73248# default offset of SdrVirtObj is aAnchor |
| 603 | return m_aAnchor; |
| 604 | } |
| 605 | |
| 606 | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |