bool SdrTextObj::HasTextEdit() const
{ // linked text objects may be changed (no automatic reload) returntrue;
}
bool SdrTextObj::BegTextEdit(SdrOutliner& rOutl)
{ if (mpEditingOutliner!=nullptr) returnfalse; // Textedit might already run in another View!
mpEditingOutliner=&rOutl;
// if necessary, set frame attributes for the first (new) paragraph of the // outliner if( !HasTextImpl( &rOutl ) )
{ // Outliner has no text so we must set some // empty text so the outliner initialise itself
rOutl.SetText( u""_ustr, rOutl.GetParagraph( 0 ) );
// When setting the "hard" attributes for first paragraph, the Parent // pOutlAttr (i. e. the template) has to be removed temporarily. Else, // at SetParaAttribs(), all attributes contained in the parent become // attributed hard to the paragraph. const SfxItemSet& rSet = GetObjectItemSet();
SfxItemSet aFilteredSet(SfxItemSet::makeFixedSfxItemSet<EE_ITEMS_START, EE_ITEMS_END>(*rSet.GetPool()));
aFilteredSet.Put(rSet);
rOutl.SetParaAttribs(0, aFilteredSet);
} if (bFitToSize)
{
tools::Rectangle aAnchorRect;
tools::Rectangle aTextRect;
TakeTextRect(rOutl, aTextRect, false,
&aAnchorRect);
Fraction aFitXCorrection(1,1);
ImpSetCharStretching(rOutl,aTextRect.GetSize(),aAnchorRect.GetSize(),aFitXCorrection);
} elseif (IsAutoFit())
{
setupAutoFitText(rOutl);
}
if(pOutlinerParaObject)
{ if (maGeo.m_nRotationAngle || IsFontwork())
{ // only repaint here, no real objectchange
BroadcastObjectChange();
}
}
rOutl.UpdateFields();
rOutl.ClearModifyFlag();
returntrue;
}
void SdrTextObj::TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, tools::Rectangle* pViewInit, tools::Rectangle* pViewMin) const
{ bool bFitToSize(IsFitToSize());
Size aPaperMin,aPaperMax;
tools::Rectangle aViewInit;
TakeTextAnchorRect(aViewInit); if (maGeo.m_nRotationAngle) {
Point aCenter(aViewInit.Center());
aCenter-=aViewInit.TopLeft();
Point aCenter0(aCenter);
RotatePoint(aCenter,Point(),maGeo.mfSinRotationAngle,maGeo.mfCosRotationAngle);
aCenter-=aCenter0;
aViewInit.Move(aCenter.X(),aCenter.Y());
}
Size aAnkSiz(aViewInit.GetSize());
aAnkSiz.AdjustWidth( -1 ); aAnkSiz.AdjustHeight( -1 ); // because GetSize() adds 1
Size aMaxSiz(1000000,1000000);
Size aTmpSiz(getSdrModelFromSdrObject().GetMaxObjSize()); if (aTmpSiz.Width()!=0) aMaxSiz.setWidth(aTmpSiz.Width() ); if (aTmpSiz.Height()!=0) aMaxSiz.setHeight(aTmpSiz.Height() );
// Done earlier since used in else tree below
SdrTextHorzAdjust eHAdj(GetTextHorizontalAdjust());
SdrTextVertAdjust eVAdj(GetTextVerticalAdjust());
if(IsTextFrame())
{
tools::Long nMinWdt=GetMinTextFrameWidth();
tools::Long nMinHgt=GetMinTextFrameHeight();
tools::Long nMaxWdt=GetMaxTextFrameWidth();
tools::Long nMaxHgt=GetMaxTextFrameHeight(); if (nMinWdt<1) nMinWdt=1; if (nMinHgt<1) nMinHgt=1; if (!bFitToSize) { if (nMaxWdt==0 || nMaxWdt>aMaxSiz.Width()) nMaxWdt=aMaxSiz.Width(); if (nMaxHgt==0 || nMaxHgt>aMaxSiz.Height()) nMaxHgt=aMaxSiz.Height();
if (!bInEditMode && (eAniKind==SdrTextAniKind::Scroll || eAniKind==SdrTextAniKind::Alternate || eAniKind==SdrTextAniKind::Slide))
{ // ticker text uses an unlimited paper size if (eAniDirection==SdrTextAniDirection::Left || eAniDirection==SdrTextAniDirection::Right) nMaxWdt=1000000; if (eAniDirection==SdrTextAniDirection::Up || eAniDirection==SdrTextAniDirection::Down) nMaxHgt=1000000;
}
bool bChainedFrame = IsChainable(); // Might be required for overflow check working: do limit height to frame if box is chainable. if (!bChainedFrame) { // #i119885# Do not limit/force height to geometrical frame (vice versa for vertical writing) if(IsVerticalWriting())
{
nMaxWdt = 1000000;
} else
{
nMaxHgt = 1000000;
}
}
aPaperMax.setWidth(nMaxWdt );
aPaperMax.setHeight(nMaxHgt );
} else
{
aPaperMax=aMaxSiz;
}
aPaperMin.setWidth(nMinWdt );
aPaperMin.setHeight(nMinHgt );
} else
{ // aPaperMin needs to be set to object's size if full width is activated // for hor or ver writing respectively if((SDRTEXTHORZADJUST_BLOCK == eHAdj && !IsVerticalWriting())
|| (SDRTEXTVERTADJUST_BLOCK == eVAdj && IsVerticalWriting()))
{
aPaperMin = aAnkSiz;
}
// For complete vertical adjustment support, set paper min height to 0, here. if(SDRTEXTVERTADJUST_BLOCK != eVAdj || bFitToSize)
{
aPaperMin.setHeight( 0 );
}
if (pPaperMin!=nullptr) *pPaperMin=aPaperMin; if (pPaperMax!=nullptr) *pPaperMax=aPaperMax; if (pViewInit!=nullptr) *pViewInit=aViewInit;
}
// need to end edit mode early since SetOutlinerParaObject already // uses GetCurrentBoundRect() which needs to take the text into account // to work correct
mbInEditMode = false;
// We don't want broadcasting if we are merely trying to move to next box (this prevents infinite loops) if (IsChainable() && GetTextChain()->GetSwitchingToNextBox(this)) {
GetTextChain()->SetSwitchingToNextBox(this, false); if( getActiveText() )
{
getActiveText()->SetOutlinerParaObject( std::move(pNewText) );
}
} else { // If we are not doing in-chaining switching just set the ParaObject
SetOutlinerParaObject(std::move(pNewText));
}
if (isAnnotationObject())
{ auto xTextAPI(getAnnotationData()->mxAnnotation->getTextApiObject());
std::optional<OutlinerParaObject> pAnnotationText = rOutl.CreateParaObject(0, rOutl.GetParagraphCount());
xTextAPI->SetText(*pAnnotationText);
}
}
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.