/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
// these angles always relate to the top left corner of aRect if (maGeo.m_nShearAngle) ShearXPoly(aXPoly, getRectangle().TopLeft(), maGeo.mfTanShearAngle); if (maGeo.m_nRotationAngle) RotateXPoly(aXPoly, getRectangle().TopLeft(), maGeo.mfSinRotationAngle, maGeo.mfCosRotationAngle); return aXPoly;
}
void SdrRectObj::AddToHdlList(SdrHdlList& rHdlList) const
{ // A text box has an additional (pseudo-)handle for the blinking frame. if(IsTextFrame())
{
OSL_ENSURE(!IsTextEditActive(), "Do not use an ImpTextframeHdl for highlighting text in active text edit, this will collide with EditEngine paints (!)");
std::unique_ptr<SdrHdl> pH(new ImpTextframeHdl(getRectangle()));
pH->SetObj(const_cast<SdrRectObj*>(this));
pH->SetRotationAngle(maGeo.m_nRotationAngle);
rHdlList.AddHdl(std::move(pH));
}
for(sal_Int32 nHdlNum = 1; nHdlNum <= 9; ++nHdlNum)
{
Point aPnt;
SdrHdlKind eKind = SdrHdlKind::Move; autoconst& rRectangle = getRectangle(); switch(nHdlNum)
{ case 1: // Handle for changing the corner radius
{
tools::Long a = GetEckenradius();
tools::Long b = std::max(rRectangle.GetWidth(), rRectangle.GetHeight())/2; // rounded up, because GetWidth() adds 1 if (a>b) a=b; if (a<0) a=0;
aPnt = rRectangle.TopLeft();
aPnt.AdjustX(a );
eKind = SdrHdlKind::Circle; break;
} case 2: aPnt = rRectangle.TopLeft(); eKind = SdrHdlKind::UpperLeft; break; case 3: aPnt = rRectangle.TopCenter(); eKind = SdrHdlKind::Upper; break; case 4: aPnt = rRectangle.TopRight(); eKind = SdrHdlKind::UpperRight; break; case 5: aPnt = rRectangle.LeftCenter(); eKind = SdrHdlKind::Left ; break; case 6: aPnt = rRectangle.RightCenter(); eKind = SdrHdlKind::Right; break; case 7: aPnt = rRectangle.BottomLeft(); eKind = SdrHdlKind::LowerLeft; break; case 8: aPnt = rRectangle.BottomCenter(); eKind = SdrHdlKind::Lower; break; case 9: aPnt = rRectangle.BottomRight(); eKind = SdrHdlKind::LowerRight; break;
}
if (maGeo.m_nShearAngle)
{
ShearPoint(aPnt,rRectangle.TopLeft(),maGeo.mfTanShearAngle);
} if (maGeo.m_nRotationAngle)
{
RotatePoint(aPnt,rRectangle.TopLeft(),maGeo.mfSinRotationAngle,maGeo.mfCosRotationAngle);
}
Point aPt; autoconst& rRectangle = getRectangle(); switch (nPosNum) { case 0: aPt = rRectangle.TopLeft(); aPt.AdjustX( -nWdt ); aPt.AdjustY( -nWdt ); break; case 1: aPt = rRectangle.TopRight(); aPt.AdjustX(nWdt ); aPt.AdjustY( -nWdt ); break; case 2: aPt = rRectangle.BottomRight(); aPt.AdjustX(nWdt ); aPt.AdjustY(nWdt ); break; case 3: aPt = rRectangle.BottomLeft(); aPt.AdjustX( -nWdt ); aPt.AdjustY(nWdt ); break;
} if (maGeo.m_nShearAngle)
ShearPoint(aPt, rRectangle.TopLeft(),maGeo.mfTanShearAngle); if (maGeo.m_nRotationAngle)
RotatePoint(aPt, rRectangle.TopLeft(),maGeo.mfSinRotationAngle,maGeo.mfCosRotationAngle);
aPt-=GetSnapRect().Center();
SdrGluePoint aGP(aPt);
aGP.SetPercent(false); return aGP;
}
rtl::Reference<SdrObject> SdrRectObj::DoConvertToPolyObj(bool bBezier, bool bAddText) const
{
XPolygon aXP(ImpCalcXPoly(getRectangle(), GetEckenradius()));
{ // TODO: this is only for the moment, until we have the new TakeContour()
aXP.Remove(0,1);
aXP[aXP.GetPointCount()-1]=aXP[0];
}
// small correction: Do not create something when no fill and no line. To // be sure to not damage something with non-text frames, do this only // when used with bAddText==false from other converters if((bAddText && !IsTextFrame()) || HasFill() || HasLine())
{
pRet = ImpConvertMakeObj(aPolyPolygon, true, bBezier);
}
if(bAddText)
{
pRet = ImpConvertAddText(std::move(pRet), bBezier);
}
return pRet;
}
void SdrRectObj::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
{
SdrTextObj::Notify(rBC,rHint);
SetXPolyDirty(); // because of the corner radius
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.