1*f6e50924SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*f6e50924SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*f6e50924SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*f6e50924SAndrew Rist * distributed with this work for additional information 6*f6e50924SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*f6e50924SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*f6e50924SAndrew Rist * "License"); you may not use this file except in compliance 9*f6e50924SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*f6e50924SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*f6e50924SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*f6e50924SAndrew Rist * software distributed under the License is distributed on an 15*f6e50924SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*f6e50924SAndrew Rist * KIND, either express or implied. See the License for the 17*f6e50924SAndrew Rist * specific language governing permissions and limitations 18*f6e50924SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*f6e50924SAndrew Rist *************************************************************/ 21*f6e50924SAndrew Rist 22*f6e50924SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_svx.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <svl/style.hxx> 28cdf0e10cSrcweir #include <svx/svdotext.hxx> 29cdf0e10cSrcweir #include "svx/svditext.hxx" 30cdf0e10cSrcweir #include <svx/svdmodel.hxx> // fuer GetMaxObjSize und GetStyleSheetPool 31cdf0e10cSrcweir #include <svx/svdoutl.hxx> 32cdf0e10cSrcweir #include <svx/svdorect.hxx> // fuer SetDirty bei NbcAdjustTextFrameWidthAndHeight 33cdf0e10cSrcweir #include <svx/svdocapt.hxx> // fuer SetDirty bei NbcAdjustTextFrameWidthAndHeight 34cdf0e10cSrcweir #include <svx/svdetc.hxx> 35cdf0e10cSrcweir #include <editeng/writingmodeitem.hxx> 36cdf0e10cSrcweir #include <editeng/editeng.hxx> 37cdf0e10cSrcweir #include <editeng/eeitem.hxx> 38cdf0e10cSrcweir #include <editeng/flditem.hxx> 39cdf0e10cSrcweir #include <svx/sdtfchim.hxx> 40cdf0e10cSrcweir 41cdf0e10cSrcweir 42cdf0e10cSrcweir #include <editeng/editview.hxx> 43cdf0e10cSrcweir #include <svl/smplhint.hxx> 44cdf0e10cSrcweir #include <svl/whiter.hxx> 45cdf0e10cSrcweir #include <editeng/outlobj.hxx> 46cdf0e10cSrcweir #include <editeng/outliner.hxx> 47cdf0e10cSrcweir #include <editeng/eeitem.hxx> 48cdf0e10cSrcweir #include <editeng/editobj.hxx> 49cdf0e10cSrcweir #include <editeng/fhgtitem.hxx> 50cdf0e10cSrcweir 51cdf0e10cSrcweir #include <editeng/charscaleitem.hxx> 52cdf0e10cSrcweir #include <svl/style.hxx> 53cdf0e10cSrcweir #include <svl/itemiter.hxx> 54cdf0e10cSrcweir #include <editeng/lrspitem.hxx> 55cdf0e10cSrcweir #include <svl/itempool.hxx> 56cdf0e10cSrcweir #include <editeng/numitem.hxx> 57cdf0e10cSrcweir #include <editeng/editeng.hxx> 58cdf0e10cSrcweir #include <editeng/postitem.hxx> 59cdf0e10cSrcweir 60cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////// 61cdf0e10cSrcweir // 62cdf0e10cSrcweir // @@@@@@ @@@@@ @@ @@ @@@@@@ @@@@ @@@@@ @@@@@@ 63cdf0e10cSrcweir // @@ @@ @@@ @@@ @@ @@ @@ @@ @@ @@ 64cdf0e10cSrcweir // @@ @@ @@@@@ @@ @@ @@ @@ @@ @@ 65cdf0e10cSrcweir // @@ @@@@ @@@ @@ @@ @@ @@@@@ @@ 66cdf0e10cSrcweir // @@ @@ @@@@@ @@ @@ @@ @@ @@ @@ 67cdf0e10cSrcweir // @@ @@ @@@ @@@ @@ @@ @@ @@ @@ @@ @@ 68cdf0e10cSrcweir // @@ @@@@@ @@ @@ @@ @@@@ @@@@@ @@@@ 69cdf0e10cSrcweir // 70cdf0e10cSrcweir // Attribute, StyleSheets und AutoGrow 71cdf0e10cSrcweir // 72cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////// 73cdf0e10cSrcweir 74cdf0e10cSrcweir FASTBOOL SdrTextObj::AdjustTextFrameWidthAndHeight(Rectangle& rR, FASTBOOL bHgt, FASTBOOL bWdt) const 75cdf0e10cSrcweir { 76cdf0e10cSrcweir if (bTextFrame && pModel!=NULL && !rR.IsEmpty()) 77cdf0e10cSrcweir { 78cdf0e10cSrcweir SdrFitToSizeType eFit=GetFitToSize(); 79cdf0e10cSrcweir FASTBOOL bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES); 80cdf0e10cSrcweir FASTBOOL bWdtGrow=bWdt && IsAutoGrowWidth(); 81cdf0e10cSrcweir FASTBOOL bHgtGrow=bHgt && IsAutoGrowHeight(); 82cdf0e10cSrcweir SdrTextAniKind eAniKind=GetTextAniKind(); 83cdf0e10cSrcweir SdrTextAniDirection eAniDir=GetTextAniDirection(); 84cdf0e10cSrcweir FASTBOOL bScroll=eAniKind==SDRTEXTANI_SCROLL || eAniKind==SDRTEXTANI_ALTERNATE || eAniKind==SDRTEXTANI_SLIDE; 85cdf0e10cSrcweir FASTBOOL bHScroll=bScroll && (eAniDir==SDRTEXTANI_LEFT || eAniDir==SDRTEXTANI_RIGHT); 86cdf0e10cSrcweir FASTBOOL bVScroll=bScroll && (eAniDir==SDRTEXTANI_UP || eAniDir==SDRTEXTANI_DOWN); 87cdf0e10cSrcweir if (!bFitToSize && (bWdtGrow || bHgtGrow)) 88cdf0e10cSrcweir { 89cdf0e10cSrcweir Rectangle aR0(rR); 90cdf0e10cSrcweir long nHgt=0,nMinHgt=0,nMaxHgt=0; 91cdf0e10cSrcweir long nWdt=0,nMinWdt=0,nMaxWdt=0; 92cdf0e10cSrcweir Size aSiz(rR.GetSize()); aSiz.Width()--; aSiz.Height()--; 93cdf0e10cSrcweir Size aMaxSiz(100000,100000); 94cdf0e10cSrcweir Size aTmpSiz(pModel->GetMaxObjSize()); 95cdf0e10cSrcweir if (aTmpSiz.Width()!=0) aMaxSiz.Width()=aTmpSiz.Width(); 96cdf0e10cSrcweir if (aTmpSiz.Height()!=0) aMaxSiz.Height()=aTmpSiz.Height(); 97cdf0e10cSrcweir if (bWdtGrow) 98cdf0e10cSrcweir { 99cdf0e10cSrcweir nMinWdt=GetMinTextFrameWidth(); 100cdf0e10cSrcweir nMaxWdt=GetMaxTextFrameWidth(); 101cdf0e10cSrcweir if (nMaxWdt==0 || nMaxWdt>aMaxSiz.Width()) nMaxWdt=aMaxSiz.Width(); 102cdf0e10cSrcweir if (nMinWdt<=0) nMinWdt=1; 103cdf0e10cSrcweir aSiz.Width()=nMaxWdt; 104cdf0e10cSrcweir } 105cdf0e10cSrcweir if (bHgtGrow) 106cdf0e10cSrcweir { 107cdf0e10cSrcweir nMinHgt=GetMinTextFrameHeight(); 108cdf0e10cSrcweir nMaxHgt=GetMaxTextFrameHeight(); 109cdf0e10cSrcweir if (nMaxHgt==0 || nMaxHgt>aMaxSiz.Height()) nMaxHgt=aMaxSiz.Height(); 110cdf0e10cSrcweir if (nMinHgt<=0) nMinHgt=1; 111cdf0e10cSrcweir aSiz.Height()=nMaxHgt; 112cdf0e10cSrcweir } 113cdf0e10cSrcweir long nHDist=GetTextLeftDistance()+GetTextRightDistance(); 114cdf0e10cSrcweir long nVDist=GetTextUpperDistance()+GetTextLowerDistance(); 115cdf0e10cSrcweir aSiz.Width()-=nHDist; 116cdf0e10cSrcweir aSiz.Height()-=nVDist; 117cdf0e10cSrcweir if (aSiz.Width()<2) aSiz.Width()=2; // Mindestgroesse 2 118cdf0e10cSrcweir if (aSiz.Height()<2) aSiz.Height()=2; // Mindestgroesse 2 119cdf0e10cSrcweir 120cdf0e10cSrcweir // #101684# 121cdf0e10cSrcweir sal_Bool bInEditMode = IsInEditMode(); 122cdf0e10cSrcweir 123cdf0e10cSrcweir if(!bInEditMode) 124cdf0e10cSrcweir { 125cdf0e10cSrcweir if (bHScroll) aSiz.Width()=0x0FFFFFFF; // Laufschrift nicht umbrechen 126cdf0e10cSrcweir if (bVScroll) aSiz.Height()=0x0FFFFFFF; 127cdf0e10cSrcweir } 128cdf0e10cSrcweir 129cdf0e10cSrcweir if(pEdtOutl) 130cdf0e10cSrcweir { 131cdf0e10cSrcweir pEdtOutl->SetMaxAutoPaperSize(aSiz); 132cdf0e10cSrcweir if (bWdtGrow) { 133cdf0e10cSrcweir Size aSiz2(pEdtOutl->CalcTextSize()); 134cdf0e10cSrcweir nWdt=aSiz2.Width()+1; // lieber etwas Tolleranz 135cdf0e10cSrcweir if (bHgtGrow) nHgt=aSiz2.Height()+1; // lieber etwas Tolleranz 136cdf0e10cSrcweir } else { 137cdf0e10cSrcweir nHgt=pEdtOutl->GetTextHeight()+1; // lieber etwas Tolleranz 138cdf0e10cSrcweir } 139cdf0e10cSrcweir } else { 140cdf0e10cSrcweir Outliner& rOutliner=ImpGetDrawOutliner(); 141cdf0e10cSrcweir rOutliner.SetPaperSize(aSiz); 142cdf0e10cSrcweir rOutliner.SetUpdateMode(sal_True); 143cdf0e10cSrcweir // !!! hier sollte ich wohl auch noch mal die Optimierung mit 144cdf0e10cSrcweir // bPortionInfoChecked usw einbauen 145cdf0e10cSrcweir OutlinerParaObject* pOutlinerParaObject = GetOutlinerParaObject(); 146cdf0e10cSrcweir if ( pOutlinerParaObject != NULL ) 147cdf0e10cSrcweir { 148cdf0e10cSrcweir rOutliner.SetText(*pOutlinerParaObject); 149cdf0e10cSrcweir rOutliner.SetFixedCellHeight(((const SdrTextFixedCellHeightItem&)GetMergedItem(SDRATTR_TEXT_USEFIXEDCELLHEIGHT)).GetValue()); 150cdf0e10cSrcweir } 151cdf0e10cSrcweir if (bWdtGrow) 152cdf0e10cSrcweir { 153cdf0e10cSrcweir Size aSiz2(rOutliner.CalcTextSize()); 154cdf0e10cSrcweir nWdt=aSiz2.Width()+1; // lieber etwas Tolleranz 155cdf0e10cSrcweir if (bHgtGrow) nHgt=aSiz2.Height()+1; // lieber etwas Tolleranz 156cdf0e10cSrcweir } else { 157cdf0e10cSrcweir nHgt=rOutliner.GetTextHeight()+1; // lieber etwas Tolleranz 158cdf0e10cSrcweir } 159cdf0e10cSrcweir rOutliner.Clear(); 160cdf0e10cSrcweir } 161cdf0e10cSrcweir if (nWdt<nMinWdt) nWdt=nMinWdt; 162cdf0e10cSrcweir if (nWdt>nMaxWdt) nWdt=nMaxWdt; 163cdf0e10cSrcweir nWdt+=nHDist; 164cdf0e10cSrcweir if (nWdt<1) nWdt=1; // nHDist kann auch negativ sein 165cdf0e10cSrcweir if (nHgt<nMinHgt) nHgt=nMinHgt; 166cdf0e10cSrcweir if (nHgt>nMaxHgt) nHgt=nMaxHgt; 167cdf0e10cSrcweir nHgt+=nVDist; 168cdf0e10cSrcweir if (nHgt<1) nHgt=1; // nVDist kann auch negativ sein 169cdf0e10cSrcweir long nWdtGrow=nWdt-(rR.Right()-rR.Left()); 170cdf0e10cSrcweir long nHgtGrow=nHgt-(rR.Bottom()-rR.Top()); 171cdf0e10cSrcweir if (nWdtGrow==0) bWdtGrow=sal_False; 172cdf0e10cSrcweir if (nHgtGrow==0) bHgtGrow=sal_False; 173cdf0e10cSrcweir if (bWdtGrow || bHgtGrow) { 174cdf0e10cSrcweir if (bWdtGrow) { 175cdf0e10cSrcweir SdrTextHorzAdjust eHAdj=GetTextHorizontalAdjust(); 176cdf0e10cSrcweir if (eHAdj==SDRTEXTHORZADJUST_LEFT) rR.Right()+=nWdtGrow; 177cdf0e10cSrcweir else if (eHAdj==SDRTEXTHORZADJUST_RIGHT) rR.Left()-=nWdtGrow; 178cdf0e10cSrcweir else { 179cdf0e10cSrcweir long nWdtGrow2=nWdtGrow/2; 180cdf0e10cSrcweir rR.Left()-=nWdtGrow2; 181cdf0e10cSrcweir rR.Right()=rR.Left()+nWdt; 182cdf0e10cSrcweir } 183cdf0e10cSrcweir } 184cdf0e10cSrcweir if (bHgtGrow) { 185cdf0e10cSrcweir SdrTextVertAdjust eVAdj=GetTextVerticalAdjust(); 186cdf0e10cSrcweir if (eVAdj==SDRTEXTVERTADJUST_TOP) rR.Bottom()+=nHgtGrow; 187cdf0e10cSrcweir else if (eVAdj==SDRTEXTVERTADJUST_BOTTOM) rR.Top()-=nHgtGrow; 188cdf0e10cSrcweir else { 189cdf0e10cSrcweir long nHgtGrow2=nHgtGrow/2; 190cdf0e10cSrcweir rR.Top()-=nHgtGrow2; 191cdf0e10cSrcweir rR.Bottom()=rR.Top()+nHgt; 192cdf0e10cSrcweir } 193cdf0e10cSrcweir } 194cdf0e10cSrcweir if (aGeo.nDrehWink!=0) { 195cdf0e10cSrcweir Point aD1(rR.TopLeft()); 196cdf0e10cSrcweir aD1-=aR0.TopLeft(); 197cdf0e10cSrcweir Point aD2(aD1); 198cdf0e10cSrcweir RotatePoint(aD2,Point(),aGeo.nSin,aGeo.nCos); 199cdf0e10cSrcweir aD2-=aD1; 200cdf0e10cSrcweir rR.Move(aD2.X(),aD2.Y()); 201cdf0e10cSrcweir } 202cdf0e10cSrcweir return sal_True; 203cdf0e10cSrcweir } 204cdf0e10cSrcweir } 205cdf0e10cSrcweir } 206cdf0e10cSrcweir return sal_False; 207cdf0e10cSrcweir } 208cdf0e10cSrcweir 209cdf0e10cSrcweir FASTBOOL SdrTextObj::NbcAdjustTextFrameWidthAndHeight(FASTBOOL bHgt, FASTBOOL bWdt) 210cdf0e10cSrcweir { 211cdf0e10cSrcweir FASTBOOL bRet=AdjustTextFrameWidthAndHeight(aRect,bHgt,bWdt); 212cdf0e10cSrcweir if (bRet) { 213cdf0e10cSrcweir SetRectsDirty(); 214cdf0e10cSrcweir if (HAS_BASE(SdrRectObj,this)) { // mal wieder 'nen Hack 215cdf0e10cSrcweir ((SdrRectObj*)this)->SetXPolyDirty(); 216cdf0e10cSrcweir } 217cdf0e10cSrcweir if (HAS_BASE(SdrCaptionObj,this)) { // mal wieder 'nen Hack 218cdf0e10cSrcweir ((SdrCaptionObj*)this)->ImpRecalcTail(); 219cdf0e10cSrcweir } 220cdf0e10cSrcweir } 221cdf0e10cSrcweir return bRet; 222cdf0e10cSrcweir } 223cdf0e10cSrcweir 224cdf0e10cSrcweir FASTBOOL SdrTextObj::AdjustTextFrameWidthAndHeight(FASTBOOL bHgt, FASTBOOL bWdt) 225cdf0e10cSrcweir { 226cdf0e10cSrcweir Rectangle aNeuRect(aRect); 227cdf0e10cSrcweir FASTBOOL bRet=AdjustTextFrameWidthAndHeight(aNeuRect,bHgt,bWdt); 228cdf0e10cSrcweir if (bRet) { 229cdf0e10cSrcweir Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect(); 230cdf0e10cSrcweir // #110094#-14 SendRepaintBroadcast(); 231cdf0e10cSrcweir aRect=aNeuRect; 232cdf0e10cSrcweir SetRectsDirty(); 233cdf0e10cSrcweir if (HAS_BASE(SdrRectObj,this)) { // mal wieder 'nen Hack 234cdf0e10cSrcweir ((SdrRectObj*)this)->SetXPolyDirty(); 235cdf0e10cSrcweir } 236cdf0e10cSrcweir if (HAS_BASE(SdrCaptionObj,this)) { // mal wieder 'nen Hack 237cdf0e10cSrcweir ((SdrCaptionObj*)this)->ImpRecalcTail(); 238cdf0e10cSrcweir } 239cdf0e10cSrcweir SetChanged(); 240cdf0e10cSrcweir BroadcastObjectChange(); 241cdf0e10cSrcweir SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0); 242cdf0e10cSrcweir } 243cdf0e10cSrcweir return bRet; 244cdf0e10cSrcweir } 245cdf0e10cSrcweir 246cdf0e10cSrcweir void SdrTextObj::ImpSetTextStyleSheetListeners() 247cdf0e10cSrcweir { 248cdf0e10cSrcweir SfxStyleSheetBasePool* pStylePool=pModel!=NULL ? pModel->GetStyleSheetPool() : NULL; 249cdf0e10cSrcweir if (pStylePool!=NULL) 250cdf0e10cSrcweir { 251cdf0e10cSrcweir Container aStyles(1024,64,64); 252cdf0e10cSrcweir OutlinerParaObject* pOutlinerParaObject = GetOutlinerParaObject(); 253cdf0e10cSrcweir if (pOutlinerParaObject!=NULL) 254cdf0e10cSrcweir { 255cdf0e10cSrcweir // Zunaechst werden alle im ParaObject enthaltenen StyleSheets 256cdf0e10cSrcweir // im Container aStyles gesammelt. Dazu wird die Family jeweils 257cdf0e10cSrcweir // ans Ende des StyleSheet-Namen drangehaengt. 258cdf0e10cSrcweir const EditTextObject& rTextObj=pOutlinerParaObject->GetTextObject(); 259cdf0e10cSrcweir XubString aStyleName; 260cdf0e10cSrcweir SfxStyleFamily eStyleFam; 261cdf0e10cSrcweir sal_uInt16 nParaAnz=rTextObj.GetParagraphCount(); 262cdf0e10cSrcweir 263cdf0e10cSrcweir for(sal_uInt16 nParaNum(0); nParaNum < nParaAnz; nParaNum++) 264cdf0e10cSrcweir { 265cdf0e10cSrcweir rTextObj.GetStyleSheet(nParaNum, aStyleName, eStyleFam); 266cdf0e10cSrcweir 267cdf0e10cSrcweir if(aStyleName.Len()) 268cdf0e10cSrcweir { 269cdf0e10cSrcweir XubString aFam = UniString::CreateFromInt32((sal_uInt16)eStyleFam); 270cdf0e10cSrcweir aFam.Expand(5); 271cdf0e10cSrcweir 272cdf0e10cSrcweir aStyleName += sal_Unicode('|'); 273cdf0e10cSrcweir aStyleName += aFam; 274cdf0e10cSrcweir 275cdf0e10cSrcweir sal_Bool bFnd(sal_False); 276cdf0e10cSrcweir sal_uInt32 nNum(aStyles.Count()); 277cdf0e10cSrcweir 278cdf0e10cSrcweir while(!bFnd && nNum > 0) 279cdf0e10cSrcweir { 280cdf0e10cSrcweir // kein StyleSheet doppelt! 281cdf0e10cSrcweir nNum--; 282cdf0e10cSrcweir bFnd = (aStyleName.Equals(*(XubString*)aStyles.GetObject(nNum))); 283cdf0e10cSrcweir } 284cdf0e10cSrcweir 285cdf0e10cSrcweir if(!bFnd) 286cdf0e10cSrcweir { 287cdf0e10cSrcweir aStyles.Insert(new XubString(aStyleName), CONTAINER_APPEND); 288cdf0e10cSrcweir } 289cdf0e10cSrcweir } 290cdf0e10cSrcweir } 291cdf0e10cSrcweir } 292cdf0e10cSrcweir 293cdf0e10cSrcweir // nun die Strings im Container durch StyleSheet* ersetzten 294cdf0e10cSrcweir sal_uIntPtr nNum=aStyles.Count(); 295cdf0e10cSrcweir while (nNum>0) { 296cdf0e10cSrcweir nNum--; 297cdf0e10cSrcweir XubString* pName=(XubString*)aStyles.GetObject(nNum); 298cdf0e10cSrcweir 299cdf0e10cSrcweir // UNICODE: String aFam(pName->Cut(pName->Len()-6)); 300cdf0e10cSrcweir String aFam = pName->Copy(0, pName->Len() - 6); 301cdf0e10cSrcweir 302cdf0e10cSrcweir aFam.Erase(0,1); 303cdf0e10cSrcweir aFam.EraseTrailingChars(); 304cdf0e10cSrcweir 305cdf0e10cSrcweir // UNICODE: sal_uInt16 nFam=sal_uInt16(aFam); 306cdf0e10cSrcweir sal_uInt16 nFam = (sal_uInt16)aFam.ToInt32(); 307cdf0e10cSrcweir 308cdf0e10cSrcweir SfxStyleFamily eFam=(SfxStyleFamily)nFam; 309cdf0e10cSrcweir SfxStyleSheetBase* pStyleBase=pStylePool->Find(*pName,eFam); 310cdf0e10cSrcweir SfxStyleSheet* pStyle=PTR_CAST(SfxStyleSheet,pStyleBase); 311cdf0e10cSrcweir delete pName; 312cdf0e10cSrcweir if (pStyle!=NULL && pStyle!=GetStyleSheet()) { 313cdf0e10cSrcweir aStyles.Replace(pStyle,nNum); 314cdf0e10cSrcweir } else { 315cdf0e10cSrcweir aStyles.Remove(nNum); 316cdf0e10cSrcweir } 317cdf0e10cSrcweir } 318cdf0e10cSrcweir // jetzt alle ueberfluessigen StyleSheets entfernen 319cdf0e10cSrcweir nNum=GetBroadcasterCount(); 320cdf0e10cSrcweir while (nNum>0) { 321cdf0e10cSrcweir nNum--; 322cdf0e10cSrcweir SfxBroadcaster* pBroadcast=GetBroadcasterJOE((sal_uInt16)nNum); 323cdf0e10cSrcweir SfxStyleSheet* pStyle=PTR_CAST(SfxStyleSheet,pBroadcast); 324cdf0e10cSrcweir if (pStyle!=NULL && pStyle!=GetStyleSheet()) { // Sonderbehandlung fuer den StyleSheet des Objekts 325cdf0e10cSrcweir if (aStyles.GetPos(pStyle)==CONTAINER_ENTRY_NOTFOUND) { 326cdf0e10cSrcweir EndListening(*pStyle); 327cdf0e10cSrcweir } 328cdf0e10cSrcweir } 329cdf0e10cSrcweir } 330cdf0e10cSrcweir // und schliesslich alle in aStyles enthaltenen StyleSheets mit den vorhandenen Broadcastern mergen 331cdf0e10cSrcweir nNum=aStyles.Count(); 332cdf0e10cSrcweir while (nNum>0) { 333cdf0e10cSrcweir nNum--; 334cdf0e10cSrcweir SfxStyleSheet* pStyle=(SfxStyleSheet*)aStyles.GetObject(nNum); 335cdf0e10cSrcweir // StartListening soll selbst nachsehen, ob hier nicht evtl. schon gehorcht wird 336cdf0e10cSrcweir StartListening(*pStyle,sal_True); 337cdf0e10cSrcweir } 338cdf0e10cSrcweir } 339cdf0e10cSrcweir } 340cdf0e10cSrcweir 341cdf0e10cSrcweir void SdrTextObj::NbcResizeTextAttributes(const Fraction& xFact, const Fraction& yFact) 342cdf0e10cSrcweir { 343cdf0e10cSrcweir OutlinerParaObject* pOutlinerParaObject = GetOutlinerParaObject(); 344cdf0e10cSrcweir if (pOutlinerParaObject!=NULL && xFact.IsValid() && yFact.IsValid()) 345cdf0e10cSrcweir { 346cdf0e10cSrcweir Fraction n100(100,1); 347cdf0e10cSrcweir long nX=long(xFact*n100); 348cdf0e10cSrcweir long nY=long(yFact*n100); 349cdf0e10cSrcweir if (nX<0) nX=-nX; 350cdf0e10cSrcweir if (nX<1) nX=1; 351cdf0e10cSrcweir if (nX>0xFFFF) nX=0xFFFF; 352cdf0e10cSrcweir if (nY<0) nY=-nY; 353cdf0e10cSrcweir if (nY<1) nY=1; 354cdf0e10cSrcweir if (nY>0xFFFF) nY=0xFFFF; 355cdf0e10cSrcweir if (nX!=100 || nY!=100) 356cdf0e10cSrcweir { 357cdf0e10cSrcweir // Rahmenattribute 358cdf0e10cSrcweir const SfxItemSet& rSet = GetObjectItemSet(); 359cdf0e10cSrcweir const SvxCharScaleWidthItem& rOldWdt=(SvxCharScaleWidthItem&)rSet.Get(EE_CHAR_FONTWIDTH); 360cdf0e10cSrcweir const SvxFontHeightItem& rOldHgt=(SvxFontHeightItem&)rSet.Get(EE_CHAR_FONTHEIGHT); 361cdf0e10cSrcweir 362cdf0e10cSrcweir // erstmal die alten Werte holen 363cdf0e10cSrcweir long nRelWdt=rOldWdt.GetValue(); 364cdf0e10cSrcweir long nAbsHgt=rOldHgt.GetHeight(); 365cdf0e10cSrcweir long nRelHgt=rOldHgt.GetProp(); 366cdf0e10cSrcweir 367cdf0e10cSrcweir // Relative Breite aendern 368cdf0e10cSrcweir nRelWdt*=nX; 369cdf0e10cSrcweir nRelWdt/=nY; 370cdf0e10cSrcweir if (nRelWdt<0) nRelWdt=-nRelWdt; // nicht negativ 371cdf0e10cSrcweir if (nRelWdt<=0) nRelWdt=1; // und mind. 1% 372cdf0e10cSrcweir if (nRelWdt>0xFFFF) nRelWdt=0xFFFF; 373cdf0e10cSrcweir 374cdf0e10cSrcweir // Absolute Hoehe aendern 375cdf0e10cSrcweir nAbsHgt*=nY; 376cdf0e10cSrcweir nAbsHgt/=100; 377cdf0e10cSrcweir if (nAbsHgt<0) nAbsHgt=-nAbsHgt; // nicht negativ 378cdf0e10cSrcweir if (nAbsHgt<=0) nAbsHgt=1; // und mind. 1 379cdf0e10cSrcweir if (nAbsHgt>0xFFFF) nAbsHgt=0xFFFF; 380cdf0e10cSrcweir 381cdf0e10cSrcweir // und nun attributieren 382cdf0e10cSrcweir SetObjectItem(SvxCharScaleWidthItem( (sal_uInt16) nRelWdt, EE_CHAR_FONTWIDTH)); 383cdf0e10cSrcweir SetObjectItem(SvxFontHeightItem(nAbsHgt,(sal_uInt16)nRelHgt, EE_CHAR_FONTHEIGHT)); 384cdf0e10cSrcweir // Zeichen- und Absatzattribute innerhalb des OutlinerParaObjects 385cdf0e10cSrcweir Outliner& rOutliner=ImpGetDrawOutliner(); 386cdf0e10cSrcweir rOutliner.SetPaperSize(Size(LONG_MAX,LONG_MAX)); 387cdf0e10cSrcweir rOutliner.SetText(*pOutlinerParaObject); 388cdf0e10cSrcweir rOutliner.DoStretchChars((sal_uInt16)nX,(sal_uInt16)nY); 389cdf0e10cSrcweir OutlinerParaObject* pNewPara=rOutliner.CreateParaObject(); 390cdf0e10cSrcweir NbcSetOutlinerParaObject(pNewPara); 391cdf0e10cSrcweir rOutliner.Clear(); 392cdf0e10cSrcweir } 393cdf0e10cSrcweir } 394cdf0e10cSrcweir } 395cdf0e10cSrcweir 396cdf0e10cSrcweir /** #103836# iterates over the paragraphs of a given SdrObject and removes all 397cdf0e10cSrcweir hard set character attributes with the which ids contained in the 398cdf0e10cSrcweir given vector 399cdf0e10cSrcweir */ 400cdf0e10cSrcweir void SdrTextObj::RemoveOutlinerCharacterAttribs( const std::vector<sal_uInt16>& rCharWhichIds ) 401cdf0e10cSrcweir { 402cdf0e10cSrcweir sal_Int32 nText = getTextCount(); 403cdf0e10cSrcweir 404cdf0e10cSrcweir while( --nText >= 0 ) 405cdf0e10cSrcweir { 406cdf0e10cSrcweir SdrText* pText = getText( nText ); 407cdf0e10cSrcweir OutlinerParaObject* pOutlinerParaObject = pText ? pText->GetOutlinerParaObject() : 0; 408cdf0e10cSrcweir 409cdf0e10cSrcweir if(pOutlinerParaObject) 410cdf0e10cSrcweir { 411cdf0e10cSrcweir Outliner* pOutliner = 0; 412cdf0e10cSrcweir 413cdf0e10cSrcweir if( pEdtOutl || (pText == getActiveText()) ) 414cdf0e10cSrcweir pOutliner = pEdtOutl; 415cdf0e10cSrcweir 416cdf0e10cSrcweir if(!pOutliner) 417cdf0e10cSrcweir { 418cdf0e10cSrcweir pOutliner = &ImpGetDrawOutliner(); 419cdf0e10cSrcweir pOutliner->SetText(*pOutlinerParaObject); 420cdf0e10cSrcweir } 421cdf0e10cSrcweir 422cdf0e10cSrcweir ESelection aSelAll( 0, 0, 0xffff, 0xffff ); 423cdf0e10cSrcweir std::vector<sal_uInt16>::const_iterator aIter( rCharWhichIds.begin() ); 424cdf0e10cSrcweir while( aIter != rCharWhichIds.end() ) 425cdf0e10cSrcweir { 426cdf0e10cSrcweir pOutliner->RemoveAttribs( aSelAll, false, (*aIter++) ); 427cdf0e10cSrcweir } 428cdf0e10cSrcweir 429cdf0e10cSrcweir if(!pEdtOutl || (pText != getActiveText()) ) 430cdf0e10cSrcweir { 431cdf0e10cSrcweir const sal_uInt32 nParaCount = pOutliner->GetParagraphCount(); 432cdf0e10cSrcweir OutlinerParaObject* pTemp = pOutliner->CreateParaObject(0, (sal_uInt16)nParaCount); 433cdf0e10cSrcweir pOutliner->Clear(); 434cdf0e10cSrcweir NbcSetOutlinerParaObjectForText(pTemp, pText); 435cdf0e10cSrcweir } 436cdf0e10cSrcweir } 437cdf0e10cSrcweir } 438cdf0e10cSrcweir } 439cdf0e10cSrcweir 440cdf0e10cSrcweir bool SdrTextObj::HasText() const 441cdf0e10cSrcweir { 442cdf0e10cSrcweir if( pEdtOutl ) 443cdf0e10cSrcweir return HasEditText(); 444cdf0e10cSrcweir 445cdf0e10cSrcweir OutlinerParaObject* pOPO = GetOutlinerParaObject(); 446cdf0e10cSrcweir 447cdf0e10cSrcweir bool bHasText = false; 448cdf0e10cSrcweir if( pOPO ) 449cdf0e10cSrcweir { 450cdf0e10cSrcweir const EditTextObject& rETO = pOPO->GetTextObject(); 451cdf0e10cSrcweir sal_uInt16 nParaCount = rETO.GetParagraphCount(); 452cdf0e10cSrcweir 453cdf0e10cSrcweir if( nParaCount > 0 ) 454cdf0e10cSrcweir bHasText = (nParaCount > 1) || (rETO.GetText( 0 ).Len() != 0); 455cdf0e10cSrcweir } 456cdf0e10cSrcweir 457cdf0e10cSrcweir return bHasText; 458cdf0e10cSrcweir } 459