1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_sc.hxx" 26 27 28 // INCLUDE --------------------------------------------------------------- 29 30 #include "scitems.hxx" 31 #include <editeng/adjitem.hxx> 32 #include <svx/algitem.hxx> 33 #include <editeng/boxitem.hxx> 34 #include <editeng/bolnitem.hxx> 35 #include <editeng/brshitem.hxx> 36 #include <editeng/charreliefitem.hxx> 37 #include <editeng/cntritem.hxx> 38 #include <svtools/colorcfg.hxx> 39 #include <editeng/colritem.hxx> 40 #include <editeng/crsditem.hxx> 41 #include <editeng/emphitem.hxx> 42 #include <editeng/fhgtitem.hxx> 43 #include <editeng/fontitem.hxx> 44 #include <editeng/forbiddenruleitem.hxx> 45 #include <editeng/frmdiritem.hxx> 46 #include <editeng/langitem.hxx> 47 #include <editeng/postitem.hxx> 48 #include <svx/rotmodit.hxx> 49 #include <editeng/scriptspaceitem.hxx> 50 #include <editeng/scripttypeitem.hxx> 51 #include <editeng/shaditem.hxx> 52 #include <editeng/shdditem.hxx> 53 #include <editeng/udlnitem.hxx> 54 #include <editeng/wghtitem.hxx> 55 #include <editeng/wrlmitem.hxx> 56 #include <svl/intitem.hxx> 57 #include <svl/zforlist.hxx> 58 #include <vcl/outdev.hxx> 59 #include <vcl/svapp.hxx> 60 61 #include "patattr.hxx" 62 #include "docpool.hxx" 63 #include "stlsheet.hxx" 64 #include "stlpool.hxx" 65 #include "document.hxx" 66 #include "global.hxx" 67 #include "globstr.hrc" 68 #include "conditio.hxx" 69 #include "validat.hxx" 70 #include "scmod.hxx" 71 #include "fillinfo.hxx" 72 73 // STATIC DATA ----------------------------------------------------------- 74 75 ScDocument* ScPatternAttr::pDoc = NULL; 76 77 // ----------------------------------------------------------------------- 78 79 //! move to some header file 80 inline long TwipsToHMM(long nTwips) { return (nTwips * 127 + 36) / 72; } 81 inline long HMMToTwips(long nHMM) { return (nHMM * 72 + 63) / 127; } 82 83 // ----------------------------------------------------------------------- 84 85 ScPatternAttr::ScPatternAttr( SfxItemSet* pItemSet, const String& rStyleName ) 86 : SfxSetItem ( ATTR_PATTERN, pItemSet ), 87 pName ( new String( rStyleName ) ), 88 pStyle ( NULL ) 89 { 90 } 91 92 ScPatternAttr::ScPatternAttr( SfxItemSet* pItemSet, ScStyleSheet* pStyleSheet ) 93 : SfxSetItem ( ATTR_PATTERN, pItemSet ), 94 pName ( NULL ), 95 pStyle ( pStyleSheet ) 96 { 97 if ( pStyleSheet ) 98 GetItemSet().SetParent( &pStyleSheet->GetItemSet() ); 99 } 100 101 ScPatternAttr::ScPatternAttr( SfxItemPool* pItemPool ) 102 : SfxSetItem ( ATTR_PATTERN, new SfxItemSet( *pItemPool, ATTR_PATTERN_START, ATTR_PATTERN_END ) ), 103 pName ( NULL ), 104 pStyle ( NULL ) 105 { 106 } 107 108 ScPatternAttr::ScPatternAttr( const ScPatternAttr& rPatternAttr ) 109 : SfxSetItem ( rPatternAttr ), 110 pStyle ( rPatternAttr.pStyle ) 111 { 112 if (rPatternAttr.pName) 113 pName = new String(*rPatternAttr.pName); 114 else 115 pName = NULL; 116 } 117 118 __EXPORT ScPatternAttr::~ScPatternAttr() 119 { 120 delete pName; 121 } 122 123 SfxPoolItem* __EXPORT ScPatternAttr::Clone( SfxItemPool *pPool ) const 124 { 125 ScPatternAttr* pPattern = new ScPatternAttr( GetItemSet().Clone(sal_True, pPool) ); 126 127 pPattern->pStyle = pStyle; 128 pPattern->pName = pName ? new String(*pName) : NULL; 129 130 return pPattern; 131 } 132 133 inline int StrCmp( const String* pStr1, const String* pStr2 ) 134 { 135 return ( pStr1 ? ( pStr2 ? ( *pStr1 == *pStr2 ) : sal_False ) : ( pStr2 ? sal_False : sal_True ) ); 136 } 137 138 139 140 int __EXPORT ScPatternAttr::operator==( const SfxPoolItem& rCmp ) const 141 { 142 // #i62090# Use quick comparison between ScPatternAttr's ItemSets 143 144 //optimize a comparing operation from 'memcmp' to 'hash compare' to improve xls loading performance, i120575 145 //More quickly comparing method using hashkey. 146 //the const_cast here will then only change the HashKey of that SfxItemSet, so it's safe. 147 return ((const_cast<ScPatternAttr&>(*this)).GetItemSet().QuickCompare( (const_cast<ScPatternAttr&>(static_cast<const ScPatternAttr&>(rCmp))).GetItemSet())&& 148 StrCmp( GetStyleName(), static_cast<const ScPatternAttr&>(rCmp).GetStyleName() ) ); 149 } 150 151 SfxPoolItem* __EXPORT ScPatternAttr::Create( SvStream& rStream, sal_uInt16 /* nVersion */ ) const 152 { 153 String* pStr; 154 sal_Bool bHasStyle; 155 short eFamDummy; 156 157 rStream >> bHasStyle; 158 159 if ( bHasStyle ) 160 { 161 pStr = new String; 162 rStream.ReadByteString( *pStr, rStream.GetStreamCharSet() ); 163 rStream >> eFamDummy; // wg. altem Dateiformat 164 } 165 else 166 pStr = new String( ScGlobal::GetRscString(STR_STYLENAME_STANDARD) ); 167 168 SfxItemSet *pNewSet = new SfxItemSet( *GetItemSet().GetPool(), 169 ATTR_PATTERN_START, ATTR_PATTERN_END ); 170 pNewSet->Load( rStream ); 171 172 ScPatternAttr* pPattern = new ScPatternAttr( pNewSet ); 173 174 pPattern->pName = pStr; 175 176 return pPattern; 177 } 178 179 SvStream& __EXPORT ScPatternAttr::Store(SvStream& rStream, sal_uInt16 /* nItemVersion */) const 180 { 181 rStream << (sal_Bool)sal_True; 182 183 if ( pStyle ) 184 rStream.WriteByteString( pStyle->GetName(), rStream.GetStreamCharSet() ); 185 else if ( pName ) // wenn Style geloescht ist/war 186 rStream.WriteByteString( *pName, rStream.GetStreamCharSet() ); 187 else 188 rStream.WriteByteString( ScGlobal::GetRscString(STR_STYLENAME_STANDARD), 189 rStream.GetStreamCharSet() ); 190 191 rStream << (short)SFX_STYLE_FAMILY_PARA; // wg. altem Dateiformat 192 193 GetItemSet().Store( rStream ); 194 195 return rStream; 196 } 197 198 SvxCellOrientation ScPatternAttr::GetCellOrientation( const SfxItemSet& rItemSet, const SfxItemSet* pCondSet ) 199 { 200 SvxCellOrientation eOrient = SVX_ORIENTATION_STANDARD; 201 202 if( ((const SfxBoolItem&)GetItem( ATTR_STACKED, rItemSet, pCondSet )).GetValue() ) 203 { 204 eOrient = SVX_ORIENTATION_STACKED; 205 } 206 else 207 { 208 sal_Int32 nAngle = ((const SfxInt32Item&)GetItem( ATTR_ROTATE_VALUE, rItemSet, pCondSet )).GetValue(); 209 if( nAngle == 9000 ) 210 eOrient = SVX_ORIENTATION_BOTTOMTOP; 211 else if( nAngle == 27000 ) 212 eOrient = SVX_ORIENTATION_TOPBOTTOM; 213 } 214 215 return eOrient; 216 } 217 218 SvxCellOrientation ScPatternAttr::GetCellOrientation( const SfxItemSet* pCondSet ) const 219 { 220 return GetCellOrientation( GetItemSet(), pCondSet ); 221 } 222 223 void ScPatternAttr::GetFont( 224 Font& rFont, const SfxItemSet& rItemSet, ScAutoFontColorMode eAutoMode, 225 OutputDevice* pOutDev, const Fraction* pScale, 226 const SfxItemSet* pCondSet, sal_uInt8 nScript, 227 const Color* pBackConfigColor, const Color* pTextConfigColor ) 228 { 229 // Items auslesen 230 231 const SvxFontItem* pFontAttr; 232 sal_uInt32 nFontHeight; 233 FontWeight eWeight; 234 FontItalic eItalic; 235 FontUnderline eUnder; 236 FontUnderline eOver; 237 sal_Bool bWordLine; 238 FontStrikeout eStrike; 239 sal_Bool bOutline; 240 sal_Bool bShadow; 241 FontEmphasisMark eEmphasis; 242 FontRelief eRelief; 243 Color aColor; 244 LanguageType eLang; 245 246 sal_uInt16 nFontId, nHeightId, nWeightId, nPostureId, nLangId; 247 if ( nScript == SCRIPTTYPE_ASIAN ) 248 { 249 nFontId = ATTR_CJK_FONT; 250 nHeightId = ATTR_CJK_FONT_HEIGHT; 251 nWeightId = ATTR_CJK_FONT_WEIGHT; 252 nPostureId = ATTR_CJK_FONT_POSTURE; 253 nLangId = ATTR_CJK_FONT_LANGUAGE; 254 } 255 else if ( nScript == SCRIPTTYPE_COMPLEX ) 256 { 257 nFontId = ATTR_CTL_FONT; 258 nHeightId = ATTR_CTL_FONT_HEIGHT; 259 nWeightId = ATTR_CTL_FONT_WEIGHT; 260 nPostureId = ATTR_CTL_FONT_POSTURE; 261 nLangId = ATTR_CTL_FONT_LANGUAGE; 262 } 263 else 264 { 265 nFontId = ATTR_FONT; 266 nHeightId = ATTR_FONT_HEIGHT; 267 nWeightId = ATTR_FONT_WEIGHT; 268 nPostureId = ATTR_FONT_POSTURE; 269 nLangId = ATTR_FONT_LANGUAGE; 270 } 271 272 if ( pCondSet ) 273 { 274 const SfxPoolItem* pItem; 275 276 if ( pCondSet->GetItemState( nFontId, sal_True, &pItem ) != SFX_ITEM_SET ) 277 pItem = &rItemSet.Get( nFontId ); 278 pFontAttr = (const SvxFontItem*) pItem; 279 280 if ( pCondSet->GetItemState( nHeightId, sal_True, &pItem ) != SFX_ITEM_SET ) 281 pItem = &rItemSet.Get( nHeightId ); 282 nFontHeight = ((const SvxFontHeightItem*)pItem)->GetHeight(); 283 284 if ( pCondSet->GetItemState( nWeightId, sal_True, &pItem ) != SFX_ITEM_SET ) 285 pItem = &rItemSet.Get( nWeightId ); 286 eWeight = (FontWeight)((const SvxWeightItem*)pItem)->GetValue(); 287 288 if ( pCondSet->GetItemState( nPostureId, sal_True, &pItem ) != SFX_ITEM_SET ) 289 pItem = &rItemSet.Get( nPostureId ); 290 eItalic = (FontItalic)((const SvxPostureItem*)pItem)->GetValue(); 291 292 if ( pCondSet->GetItemState( ATTR_FONT_UNDERLINE, sal_True, &pItem ) != SFX_ITEM_SET ) 293 pItem = &rItemSet.Get( ATTR_FONT_UNDERLINE ); 294 eUnder = (FontUnderline)((const SvxUnderlineItem*)pItem)->GetValue(); 295 296 if ( pCondSet->GetItemState( ATTR_FONT_OVERLINE, sal_True, &pItem ) != SFX_ITEM_SET ) 297 pItem = &rItemSet.Get( ATTR_FONT_OVERLINE ); 298 eOver = (FontUnderline)((const SvxOverlineItem*)pItem)->GetValue(); 299 300 if ( pCondSet->GetItemState( ATTR_FONT_WORDLINE, sal_True, &pItem ) != SFX_ITEM_SET ) 301 pItem = &rItemSet.Get( ATTR_FONT_WORDLINE ); 302 bWordLine = ((const SvxWordLineModeItem*)pItem)->GetValue(); 303 304 if ( pCondSet->GetItemState( ATTR_FONT_CROSSEDOUT, sal_True, &pItem ) != SFX_ITEM_SET ) 305 pItem = &rItemSet.Get( ATTR_FONT_CROSSEDOUT ); 306 eStrike = (FontStrikeout)((const SvxCrossedOutItem*)pItem)->GetValue(); 307 308 if ( pCondSet->GetItemState( ATTR_FONT_CONTOUR, sal_True, &pItem ) != SFX_ITEM_SET ) 309 pItem = &rItemSet.Get( ATTR_FONT_CONTOUR ); 310 bOutline = ((const SvxContourItem*)pItem)->GetValue(); 311 312 if ( pCondSet->GetItemState( ATTR_FONT_SHADOWED, sal_True, &pItem ) != SFX_ITEM_SET ) 313 pItem = &rItemSet.Get( ATTR_FONT_SHADOWED ); 314 bShadow = ((const SvxShadowedItem*)pItem)->GetValue(); 315 316 if ( pCondSet->GetItemState( ATTR_FONT_EMPHASISMARK, sal_True, &pItem ) != SFX_ITEM_SET ) 317 pItem = &rItemSet.Get( ATTR_FONT_EMPHASISMARK ); 318 eEmphasis = ((const SvxEmphasisMarkItem*)pItem)->GetEmphasisMark(); 319 320 if ( pCondSet->GetItemState( ATTR_FONT_RELIEF, sal_True, &pItem ) != SFX_ITEM_SET ) 321 pItem = &rItemSet.Get( ATTR_FONT_RELIEF ); 322 eRelief = (FontRelief)((const SvxCharReliefItem*)pItem)->GetValue(); 323 324 if ( pCondSet->GetItemState( ATTR_FONT_COLOR, sal_True, &pItem ) != SFX_ITEM_SET ) 325 pItem = &rItemSet.Get( ATTR_FONT_COLOR ); 326 aColor = ((const SvxColorItem*)pItem)->GetValue(); 327 328 if ( pCondSet->GetItemState( nLangId, sal_True, &pItem ) != SFX_ITEM_SET ) 329 pItem = &rItemSet.Get( nLangId ); 330 eLang = ((const SvxLanguageItem*)pItem)->GetLanguage(); 331 } 332 else // alles aus rItemSet 333 { 334 pFontAttr = &(const SvxFontItem&)rItemSet.Get( nFontId ); 335 nFontHeight = ((const SvxFontHeightItem&) 336 rItemSet.Get( nHeightId )).GetHeight(); 337 eWeight = (FontWeight)((const SvxWeightItem&) 338 rItemSet.Get( nWeightId )).GetValue(); 339 eItalic = (FontItalic)((const SvxPostureItem&) 340 rItemSet.Get( nPostureId )).GetValue(); 341 eUnder = (FontUnderline)((const SvxUnderlineItem&) 342 rItemSet.Get( ATTR_FONT_UNDERLINE )).GetValue(); 343 eOver = (FontUnderline)((const SvxOverlineItem&) 344 rItemSet.Get( ATTR_FONT_OVERLINE )).GetValue(); 345 bWordLine = ((const SvxWordLineModeItem&) 346 rItemSet.Get( ATTR_FONT_WORDLINE )).GetValue(); 347 eStrike = (FontStrikeout)((const SvxCrossedOutItem&) 348 rItemSet.Get( ATTR_FONT_CROSSEDOUT )).GetValue(); 349 bOutline = ((const SvxContourItem&) 350 rItemSet.Get( ATTR_FONT_CONTOUR )).GetValue(); 351 bShadow = ((const SvxShadowedItem&) 352 rItemSet.Get( ATTR_FONT_SHADOWED )).GetValue(); 353 eEmphasis = ((const SvxEmphasisMarkItem&) 354 rItemSet.Get( ATTR_FONT_EMPHASISMARK )).GetEmphasisMark(); 355 eRelief = (FontRelief)((const SvxCharReliefItem&) 356 rItemSet.Get( ATTR_FONT_RELIEF )).GetValue(); 357 aColor = ((const SvxColorItem&) 358 rItemSet.Get( ATTR_FONT_COLOR )).GetValue(); 359 // for graphite language features 360 eLang = 361 ((const SvxLanguageItem&)rItemSet.Get( nLangId )).GetLanguage(); 362 } 363 DBG_ASSERT(pFontAttr,"nanu?"); 364 365 // auswerten 366 367 // FontItem: 368 369 if (rFont.GetName() != pFontAttr->GetFamilyName()) 370 rFont.SetName( pFontAttr->GetFamilyName() ); 371 if (rFont.GetStyleName() != pFontAttr->GetStyleName()) 372 rFont.SetStyleName( pFontAttr->GetStyleName() ); 373 374 rFont.SetFamily( pFontAttr->GetFamily() ); 375 rFont.SetCharSet( pFontAttr->GetCharSet() ); 376 rFont.SetPitch( pFontAttr->GetPitch() ); 377 378 rFont.SetLanguage(eLang); 379 380 // Groesse 381 382 if ( pOutDev != NULL ) 383 { 384 Size aEffSize; 385 Fraction aFraction( 1,1 ); 386 if (pScale) 387 aFraction = *pScale; 388 Size aSize( 0, (long) nFontHeight ); 389 MapMode aDestMode = pOutDev->GetMapMode(); 390 MapMode aSrcMode( MAP_TWIP, Point(), aFraction, aFraction ); 391 if (aDestMode.GetMapUnit() == MAP_PIXEL) 392 aEffSize = pOutDev->LogicToPixel( aSize, aSrcMode ); 393 else 394 { 395 Fraction aFractOne(1,1); 396 aDestMode.SetScaleX( aFractOne ); 397 aDestMode.SetScaleY( aFractOne ); 398 aEffSize = OutputDevice::LogicToLogic( aSize, aSrcMode, aDestMode ); 399 } 400 rFont.SetSize( aEffSize ); 401 } 402 else /* if pOutDev != NULL */ 403 { 404 rFont.SetSize( Size( 0, (long) nFontHeight ) ); 405 } 406 407 // determine effective font color 408 409 if ( ( aColor.GetColor() == COL_AUTO && eAutoMode != SC_AUTOCOL_RAW ) || 410 eAutoMode == SC_AUTOCOL_IGNOREFONT || eAutoMode == SC_AUTOCOL_IGNOREALL ) 411 { 412 if ( eAutoMode == SC_AUTOCOL_BLACK ) 413 aColor.SetColor( COL_BLACK ); 414 else 415 { 416 // get background color from conditional or own set 417 Color aBackColor; 418 if ( pCondSet ) 419 { 420 const SfxPoolItem* pItem; 421 if ( pCondSet->GetItemState( ATTR_BACKGROUND, sal_True, &pItem ) != SFX_ITEM_SET ) 422 pItem = &rItemSet.Get( ATTR_BACKGROUND ); 423 aBackColor = ((const SvxBrushItem*)pItem)->GetColor(); 424 } 425 else 426 aBackColor = ((const SvxBrushItem&)rItemSet.Get( ATTR_BACKGROUND )).GetColor(); 427 428 // if background color attribute is transparent, use window color for brightness comparisons 429 if ( aBackColor == COL_TRANSPARENT || 430 eAutoMode == SC_AUTOCOL_IGNOREBACK || eAutoMode == SC_AUTOCOL_IGNOREALL ) 431 { 432 if ( eAutoMode == SC_AUTOCOL_PRINT ) 433 aBackColor.SetColor( COL_WHITE ); 434 else if ( pBackConfigColor ) 435 { 436 // pBackConfigColor can be used to avoid repeated lookup of the configured color 437 aBackColor = *pBackConfigColor; 438 } 439 else 440 aBackColor.SetColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor ); 441 } 442 443 // get system text color for comparison 444 Color aSysTextColor; 445 if ( eAutoMode == SC_AUTOCOL_PRINT ) 446 aSysTextColor.SetColor( COL_BLACK ); 447 else if ( pTextConfigColor ) 448 { 449 // pTextConfigColor can be used to avoid repeated lookup of the configured color 450 aSysTextColor = *pTextConfigColor; 451 } 452 else 453 aSysTextColor.SetColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor ); 454 455 // select the resulting color 456 if ( aBackColor.IsDark() && aSysTextColor.IsDark() ) 457 { 458 // use white instead of dark on dark 459 aColor.SetColor( COL_WHITE ); 460 } 461 else if ( aBackColor.IsBright() && aSysTextColor.IsBright() ) 462 { 463 // use black instead of bright on bright 464 aColor.SetColor( COL_BLACK ); 465 } 466 else 467 { 468 // use aSysTextColor (black for SC_AUTOCOL_PRINT, from style settings otherwise) 469 aColor = aSysTextColor; 470 } 471 } 472 } 473 474 // set font effects 475 rFont.SetWeight( eWeight ); 476 rFont.SetItalic( eItalic ); 477 rFont.SetUnderline( eUnder ); 478 rFont.SetOverline( eOver ); 479 rFont.SetWordLineMode( bWordLine ); 480 rFont.SetStrikeout( eStrike ); 481 rFont.SetOutline( bOutline ); 482 rFont.SetShadow( bShadow ); 483 rFont.SetEmphasisMark( eEmphasis ); 484 rFont.SetRelief( eRelief ); 485 rFont.SetColor( aColor ); 486 rFont.SetTransparent( sal_True ); 487 } 488 489 void ScPatternAttr::GetFont( 490 Font& rFont, ScAutoFontColorMode eAutoMode, 491 OutputDevice* pOutDev, const Fraction* pScale, 492 const SfxItemSet* pCondSet, sal_uInt8 nScript, 493 const Color* pBackConfigColor, const Color* pTextConfigColor ) const 494 { 495 GetFont( rFont, GetItemSet(), eAutoMode, pOutDev, pScale, pCondSet, nScript, pBackConfigColor, pTextConfigColor ); 496 } 497 498 499 void ScPatternAttr::FillToEditItemSet( SfxItemSet& rEditSet, const SfxItemSet& rSrcSet, const SfxItemSet* pCondSet ) 500 { 501 // Items auslesen 502 503 SvxColorItem aColorItem(EE_CHAR_COLOR); // use item as-is 504 SvxFontItem aFontItem(EE_CHAR_FONTINFO); // use item as-is 505 SvxFontItem aCjkFontItem(EE_CHAR_FONTINFO_CJK); 506 SvxFontItem aCtlFontItem(EE_CHAR_FONTINFO_CTL); 507 long nTHeight, nCjkTHeight, nCtlTHeight; // Twips 508 FontWeight eWeight, eCjkWeight, eCtlWeight; 509 SvxUnderlineItem aUnderlineItem(UNDERLINE_NONE, EE_CHAR_UNDERLINE); 510 SvxOverlineItem aOverlineItem(UNDERLINE_NONE, EE_CHAR_OVERLINE); 511 sal_Bool bWordLine; 512 FontStrikeout eStrike; 513 FontItalic eItalic, eCjkItalic, eCtlItalic; 514 sal_Bool bOutline; 515 sal_Bool bShadow; 516 sal_Bool bForbidden; 517 FontEmphasisMark eEmphasis; 518 FontRelief eRelief; 519 LanguageType eLang, eCjkLang, eCtlLang; 520 sal_Bool bHyphenate; 521 SvxFrameDirection eDirection; 522 523 //! additional parameter to control if language is needed? 524 525 if ( pCondSet ) 526 { 527 const SfxPoolItem* pItem; 528 529 if ( pCondSet->GetItemState( ATTR_FONT_COLOR, sal_True, &pItem ) != SFX_ITEM_SET ) 530 pItem = &rSrcSet.Get( ATTR_FONT_COLOR ); 531 aColorItem = *(const SvxColorItem*)pItem; 532 533 if ( pCondSet->GetItemState( ATTR_FONT, sal_True, &pItem ) != SFX_ITEM_SET ) 534 pItem = &rSrcSet.Get( ATTR_FONT ); 535 aFontItem = *(const SvxFontItem*)pItem; 536 if ( pCondSet->GetItemState( ATTR_CJK_FONT, sal_True, &pItem ) != SFX_ITEM_SET ) 537 pItem = &rSrcSet.Get( ATTR_CJK_FONT ); 538 aCjkFontItem = *(const SvxFontItem*)pItem; 539 if ( pCondSet->GetItemState( ATTR_CTL_FONT, sal_True, &pItem ) != SFX_ITEM_SET ) 540 pItem = &rSrcSet.Get( ATTR_CTL_FONT ); 541 aCtlFontItem = *(const SvxFontItem*)pItem; 542 543 if ( pCondSet->GetItemState( ATTR_FONT_HEIGHT, sal_True, &pItem ) != SFX_ITEM_SET ) 544 pItem = &rSrcSet.Get( ATTR_FONT_HEIGHT ); 545 nTHeight = ((const SvxFontHeightItem*)pItem)->GetHeight(); 546 if ( pCondSet->GetItemState( ATTR_CJK_FONT_HEIGHT, sal_True, &pItem ) != SFX_ITEM_SET ) 547 pItem = &rSrcSet.Get( ATTR_CJK_FONT_HEIGHT ); 548 nCjkTHeight = ((const SvxFontHeightItem*)pItem)->GetHeight(); 549 if ( pCondSet->GetItemState( ATTR_CTL_FONT_HEIGHT, sal_True, &pItem ) != SFX_ITEM_SET ) 550 pItem = &rSrcSet.Get( ATTR_CTL_FONT_HEIGHT ); 551 nCtlTHeight = ((const SvxFontHeightItem*)pItem)->GetHeight(); 552 553 if ( pCondSet->GetItemState( ATTR_FONT_WEIGHT, sal_True, &pItem ) != SFX_ITEM_SET ) 554 pItem = &rSrcSet.Get( ATTR_FONT_WEIGHT ); 555 eWeight = (FontWeight)((const SvxWeightItem*)pItem)->GetValue(); 556 if ( pCondSet->GetItemState( ATTR_CJK_FONT_WEIGHT, sal_True, &pItem ) != SFX_ITEM_SET ) 557 pItem = &rSrcSet.Get( ATTR_CJK_FONT_WEIGHT ); 558 eCjkWeight = (FontWeight)((const SvxWeightItem*)pItem)->GetValue(); 559 if ( pCondSet->GetItemState( ATTR_CTL_FONT_WEIGHT, sal_True, &pItem ) != SFX_ITEM_SET ) 560 pItem = &rSrcSet.Get( ATTR_CTL_FONT_WEIGHT ); 561 eCtlWeight = (FontWeight)((const SvxWeightItem*)pItem)->GetValue(); 562 563 if ( pCondSet->GetItemState( ATTR_FONT_POSTURE, sal_True, &pItem ) != SFX_ITEM_SET ) 564 pItem = &rSrcSet.Get( ATTR_FONT_POSTURE ); 565 eItalic = (FontItalic)((const SvxPostureItem*)pItem)->GetValue(); 566 if ( pCondSet->GetItemState( ATTR_CJK_FONT_POSTURE, sal_True, &pItem ) != SFX_ITEM_SET ) 567 pItem = &rSrcSet.Get( ATTR_CJK_FONT_POSTURE ); 568 eCjkItalic = (FontItalic)((const SvxPostureItem*)pItem)->GetValue(); 569 if ( pCondSet->GetItemState( ATTR_CTL_FONT_POSTURE, sal_True, &pItem ) != SFX_ITEM_SET ) 570 pItem = &rSrcSet.Get( ATTR_CTL_FONT_POSTURE ); 571 eCtlItalic = (FontItalic)((const SvxPostureItem*)pItem)->GetValue(); 572 573 if ( pCondSet->GetItemState( ATTR_FONT_UNDERLINE, sal_True, &pItem ) != SFX_ITEM_SET ) 574 pItem = &rSrcSet.Get( ATTR_FONT_UNDERLINE ); 575 aUnderlineItem = *(const SvxUnderlineItem*)pItem; 576 577 if ( pCondSet->GetItemState( ATTR_FONT_OVERLINE, sal_True, &pItem ) != SFX_ITEM_SET ) 578 pItem = &rSrcSet.Get( ATTR_FONT_OVERLINE ); 579 aOverlineItem = *(const SvxOverlineItem*)pItem; 580 581 if ( pCondSet->GetItemState( ATTR_FONT_WORDLINE, sal_True, &pItem ) != SFX_ITEM_SET ) 582 pItem = &rSrcSet.Get( ATTR_FONT_WORDLINE ); 583 bWordLine = ((const SvxWordLineModeItem*)pItem)->GetValue(); 584 585 if ( pCondSet->GetItemState( ATTR_FONT_CROSSEDOUT, sal_True, &pItem ) != SFX_ITEM_SET ) 586 pItem = &rSrcSet.Get( ATTR_FONT_CROSSEDOUT ); 587 eStrike = (FontStrikeout)((const SvxCrossedOutItem*)pItem)->GetValue(); 588 589 if ( pCondSet->GetItemState( ATTR_FONT_CONTOUR, sal_True, &pItem ) != SFX_ITEM_SET ) 590 pItem = &rSrcSet.Get( ATTR_FONT_CONTOUR ); 591 bOutline = ((const SvxContourItem*)pItem)->GetValue(); 592 593 if ( pCondSet->GetItemState( ATTR_FONT_SHADOWED, sal_True, &pItem ) != SFX_ITEM_SET ) 594 pItem = &rSrcSet.Get( ATTR_FONT_SHADOWED ); 595 bShadow = ((const SvxShadowedItem*)pItem)->GetValue(); 596 597 if ( pCondSet->GetItemState( ATTR_FORBIDDEN_RULES, sal_True, &pItem ) != SFX_ITEM_SET ) 598 pItem = &rSrcSet.Get( ATTR_FORBIDDEN_RULES ); 599 bForbidden = ((const SvxForbiddenRuleItem*)pItem)->GetValue(); 600 601 if ( pCondSet->GetItemState( ATTR_FONT_EMPHASISMARK, sal_True, &pItem ) != SFX_ITEM_SET ) 602 pItem = &rSrcSet.Get( ATTR_FONT_EMPHASISMARK ); 603 eEmphasis = ((const SvxEmphasisMarkItem*)pItem)->GetEmphasisMark(); 604 if ( pCondSet->GetItemState( ATTR_FONT_RELIEF, sal_True, &pItem ) != SFX_ITEM_SET ) 605 pItem = &rSrcSet.Get( ATTR_FONT_RELIEF ); 606 eRelief = (FontRelief)((const SvxCharReliefItem*)pItem)->GetValue(); 607 608 if ( pCondSet->GetItemState( ATTR_FONT_LANGUAGE, sal_True, &pItem ) != SFX_ITEM_SET ) 609 pItem = &rSrcSet.Get( ATTR_FONT_LANGUAGE ); 610 eLang = ((const SvxLanguageItem*)pItem)->GetLanguage(); 611 if ( pCondSet->GetItemState( ATTR_CJK_FONT_LANGUAGE, sal_True, &pItem ) != SFX_ITEM_SET ) 612 pItem = &rSrcSet.Get( ATTR_CJK_FONT_LANGUAGE ); 613 eCjkLang = ((const SvxLanguageItem*)pItem)->GetLanguage(); 614 if ( pCondSet->GetItemState( ATTR_CTL_FONT_LANGUAGE, sal_True, &pItem ) != SFX_ITEM_SET ) 615 pItem = &rSrcSet.Get( ATTR_CTL_FONT_LANGUAGE ); 616 eCtlLang = ((const SvxLanguageItem*)pItem)->GetLanguage(); 617 618 if ( pCondSet->GetItemState( ATTR_HYPHENATE, sal_True, &pItem ) != SFX_ITEM_SET ) 619 pItem = &rSrcSet.Get( ATTR_HYPHENATE ); 620 bHyphenate = ((const SfxBoolItem*)pItem)->GetValue(); 621 622 if ( pCondSet->GetItemState( ATTR_WRITINGDIR, sal_True, &pItem ) != SFX_ITEM_SET ) 623 pItem = &rSrcSet.Get( ATTR_WRITINGDIR ); 624 eDirection = (SvxFrameDirection)((const SvxFrameDirectionItem*)pItem)->GetValue(); 625 } 626 else // alles direkt aus Pattern 627 { 628 aColorItem = (const SvxColorItem&) rSrcSet.Get( ATTR_FONT_COLOR ); 629 aFontItem = (const SvxFontItem&) rSrcSet.Get( ATTR_FONT ); 630 aCjkFontItem = (const SvxFontItem&) rSrcSet.Get( ATTR_CJK_FONT ); 631 aCtlFontItem = (const SvxFontItem&) rSrcSet.Get( ATTR_CTL_FONT ); 632 nTHeight = ((const SvxFontHeightItem&) 633 rSrcSet.Get( ATTR_FONT_HEIGHT )).GetHeight(); 634 nCjkTHeight = ((const SvxFontHeightItem&) 635 rSrcSet.Get( ATTR_CJK_FONT_HEIGHT )).GetHeight(); 636 nCtlTHeight = ((const SvxFontHeightItem&) 637 rSrcSet.Get( ATTR_CTL_FONT_HEIGHT )).GetHeight(); 638 eWeight = (FontWeight)((const SvxWeightItem&) 639 rSrcSet.Get( ATTR_FONT_WEIGHT )).GetValue(); 640 eCjkWeight = (FontWeight)((const SvxWeightItem&) 641 rSrcSet.Get( ATTR_CJK_FONT_WEIGHT )).GetValue(); 642 eCtlWeight = (FontWeight)((const SvxWeightItem&) 643 rSrcSet.Get( ATTR_CTL_FONT_WEIGHT )).GetValue(); 644 eItalic = (FontItalic)((const SvxPostureItem&) 645 rSrcSet.Get( ATTR_FONT_POSTURE )).GetValue(); 646 eCjkItalic = (FontItalic)((const SvxPostureItem&) 647 rSrcSet.Get( ATTR_CJK_FONT_POSTURE )).GetValue(); 648 eCtlItalic = (FontItalic)((const SvxPostureItem&) 649 rSrcSet.Get( ATTR_CTL_FONT_POSTURE )).GetValue(); 650 aUnderlineItem = (const SvxUnderlineItem&) rSrcSet.Get( ATTR_FONT_UNDERLINE ); 651 aOverlineItem = (const SvxOverlineItem&) rSrcSet.Get( ATTR_FONT_OVERLINE ); 652 bWordLine = ((const SvxWordLineModeItem&) 653 rSrcSet.Get( ATTR_FONT_WORDLINE )).GetValue(); 654 eStrike = (FontStrikeout)((const SvxCrossedOutItem&) 655 rSrcSet.Get( ATTR_FONT_CROSSEDOUT )).GetValue(); 656 bOutline = ((const SvxContourItem&) 657 rSrcSet.Get( ATTR_FONT_CONTOUR )).GetValue(); 658 bShadow = ((const SvxShadowedItem&) 659 rSrcSet.Get( ATTR_FONT_SHADOWED )).GetValue(); 660 bForbidden = ((const SvxForbiddenRuleItem&) 661 rSrcSet.Get( ATTR_FORBIDDEN_RULES )).GetValue(); 662 eEmphasis = ((const SvxEmphasisMarkItem&) 663 rSrcSet.Get( ATTR_FONT_EMPHASISMARK )).GetEmphasisMark(); 664 eRelief = (FontRelief)((const SvxCharReliefItem&) 665 rSrcSet.Get( ATTR_FONT_RELIEF )).GetValue(); 666 eLang = ((const SvxLanguageItem&) 667 rSrcSet.Get( ATTR_FONT_LANGUAGE )).GetLanguage(); 668 eCjkLang = ((const SvxLanguageItem&) 669 rSrcSet.Get( ATTR_CJK_FONT_LANGUAGE )).GetLanguage(); 670 eCtlLang = ((const SvxLanguageItem&) 671 rSrcSet.Get( ATTR_CTL_FONT_LANGUAGE )).GetLanguage(); 672 bHyphenate = ((const SfxBoolItem&) 673 rSrcSet.Get( ATTR_HYPHENATE )).GetValue(); 674 eDirection = (SvxFrameDirection)((const SvxFrameDirectionItem&) 675 rSrcSet.Get( ATTR_WRITINGDIR )).GetValue(); 676 } 677 678 // kompatibel zu LogicToLogic rechnen, also 2540/1440 = 127/72, und runden 679 680 long nHeight = TwipsToHMM(nTHeight); 681 long nCjkHeight = TwipsToHMM(nCjkTHeight); 682 long nCtlHeight = TwipsToHMM(nCtlTHeight); 683 684 // put items into EditEngine ItemSet 685 686 if ( aColorItem.GetValue().GetColor() == COL_AUTO ) 687 { 688 // #108979# When cell attributes are converted to EditEngine paragraph attributes, 689 // don't create a hard item for automatic color, because that would be converted 690 // to black when the item's Store method is used in CreateTransferable/WriteBin. 691 // COL_AUTO is the EditEngine's pool default, so ClearItem will result in automatic 692 // color, too, without having to store the item. 693 rEditSet.ClearItem( EE_CHAR_COLOR ); 694 } 695 else 696 rEditSet.Put( aColorItem ); 697 rEditSet.Put( aFontItem ); 698 rEditSet.Put( aCjkFontItem ); 699 rEditSet.Put( aCtlFontItem ); 700 rEditSet.Put( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT ) ); 701 rEditSet.Put( SvxFontHeightItem( nCjkHeight, 100, EE_CHAR_FONTHEIGHT_CJK ) ); 702 rEditSet.Put( SvxFontHeightItem( nCtlHeight, 100, EE_CHAR_FONTHEIGHT_CTL ) ); 703 rEditSet.Put( SvxWeightItem ( eWeight, EE_CHAR_WEIGHT ) ); 704 rEditSet.Put( SvxWeightItem ( eCjkWeight, EE_CHAR_WEIGHT_CJK ) ); 705 rEditSet.Put( SvxWeightItem ( eCtlWeight, EE_CHAR_WEIGHT_CTL ) ); 706 rEditSet.Put( aUnderlineItem ); 707 rEditSet.Put( aOverlineItem ); 708 rEditSet.Put( SvxWordLineModeItem( bWordLine, EE_CHAR_WLM ) ); 709 rEditSet.Put( SvxCrossedOutItem( eStrike, EE_CHAR_STRIKEOUT ) ); 710 rEditSet.Put( SvxPostureItem ( eItalic, EE_CHAR_ITALIC ) ); 711 rEditSet.Put( SvxPostureItem ( eCjkItalic, EE_CHAR_ITALIC_CJK ) ); 712 rEditSet.Put( SvxPostureItem ( eCtlItalic, EE_CHAR_ITALIC_CTL ) ); 713 rEditSet.Put( SvxContourItem ( bOutline, EE_CHAR_OUTLINE ) ); 714 rEditSet.Put( SvxShadowedItem ( bShadow, EE_CHAR_SHADOW ) ); 715 rEditSet.Put( SfxBoolItem ( EE_PARA_FORBIDDENRULES, bForbidden ) ); 716 rEditSet.Put( SvxEmphasisMarkItem( eEmphasis, EE_CHAR_EMPHASISMARK ) ); 717 rEditSet.Put( SvxCharReliefItem( eRelief, EE_CHAR_RELIEF ) ); 718 rEditSet.Put( SvxLanguageItem ( eLang, EE_CHAR_LANGUAGE ) ); 719 rEditSet.Put( SvxLanguageItem ( eCjkLang, EE_CHAR_LANGUAGE_CJK ) ); 720 rEditSet.Put( SvxLanguageItem ( eCtlLang, EE_CHAR_LANGUAGE_CTL ) ); 721 rEditSet.Put( SfxBoolItem ( EE_PARA_HYPHENATE, bHyphenate ) ); 722 rEditSet.Put( SvxFrameDirectionItem( eDirection, EE_PARA_WRITINGDIR ) ); 723 724 // #111216# Script spacing is always off. 725 // The cell attribute isn't used here as long as there is no UI to set it 726 // (don't evaluate attributes that can't be changed). 727 // If a locale-dependent default is needed, it has to go into the cell 728 // style, like the fonts. 729 rEditSet.Put( SvxScriptSpaceItem( sal_False, EE_PARA_ASIANCJKSPACING ) ); 730 } 731 732 void ScPatternAttr::FillEditItemSet( SfxItemSet* pEditSet, const SfxItemSet* pCondSet ) const 733 { 734 if( pEditSet ) 735 FillToEditItemSet( *pEditSet, GetItemSet(), pCondSet ); 736 } 737 738 739 void ScPatternAttr::GetFromEditItemSet( SfxItemSet& rDestSet, const SfxItemSet& rEditSet ) 740 { 741 const SfxPoolItem* pItem; 742 743 if (rEditSet.GetItemState(EE_CHAR_COLOR,sal_True,&pItem) == SFX_ITEM_SET) 744 rDestSet.Put( SvxColorItem(ATTR_FONT_COLOR) = *(const SvxColorItem*)pItem ); 745 746 if (rEditSet.GetItemState(EE_CHAR_FONTINFO,sal_True,&pItem) == SFX_ITEM_SET) 747 rDestSet.Put( SvxFontItem(ATTR_FONT) = *(const SvxFontItem*)pItem ); 748 if (rEditSet.GetItemState(EE_CHAR_FONTINFO_CJK,sal_True,&pItem) == SFX_ITEM_SET) 749 rDestSet.Put( SvxFontItem(ATTR_CJK_FONT) = *(const SvxFontItem*)pItem ); 750 if (rEditSet.GetItemState(EE_CHAR_FONTINFO_CTL,sal_True,&pItem) == SFX_ITEM_SET) 751 rDestSet.Put( SvxFontItem(ATTR_CTL_FONT) = *(const SvxFontItem*)pItem ); 752 753 if (rEditSet.GetItemState(EE_CHAR_FONTHEIGHT,sal_True,&pItem) == SFX_ITEM_SET) 754 rDestSet.Put( SvxFontHeightItem( HMMToTwips( ((const SvxFontHeightItem*)pItem)->GetHeight() ), 755 100, ATTR_FONT_HEIGHT ) ); 756 if (rEditSet.GetItemState(EE_CHAR_FONTHEIGHT_CJK,sal_True,&pItem) == SFX_ITEM_SET) 757 rDestSet.Put( SvxFontHeightItem( HMMToTwips( ((const SvxFontHeightItem*)pItem)->GetHeight() ), 758 100, ATTR_CJK_FONT_HEIGHT ) ); 759 if (rEditSet.GetItemState(EE_CHAR_FONTHEIGHT_CTL,sal_True,&pItem) == SFX_ITEM_SET) 760 rDestSet.Put( SvxFontHeightItem( HMMToTwips( ((const SvxFontHeightItem*)pItem)->GetHeight() ), 761 100, ATTR_CTL_FONT_HEIGHT ) ); 762 763 if (rEditSet.GetItemState(EE_CHAR_WEIGHT,sal_True,&pItem) == SFX_ITEM_SET) 764 rDestSet.Put( SvxWeightItem( (FontWeight)((const SvxWeightItem*)pItem)->GetValue(), 765 ATTR_FONT_WEIGHT) ); 766 if (rEditSet.GetItemState(EE_CHAR_WEIGHT_CJK,sal_True,&pItem) == SFX_ITEM_SET) 767 rDestSet.Put( SvxWeightItem( (FontWeight)((const SvxWeightItem*)pItem)->GetValue(), 768 ATTR_CJK_FONT_WEIGHT) ); 769 if (rEditSet.GetItemState(EE_CHAR_WEIGHT_CTL,sal_True,&pItem) == SFX_ITEM_SET) 770 rDestSet.Put( SvxWeightItem( (FontWeight)((const SvxWeightItem*)pItem)->GetValue(), 771 ATTR_CTL_FONT_WEIGHT) ); 772 773 // SvxTextLineItem contains enum and color 774 if (rEditSet.GetItemState(EE_CHAR_UNDERLINE,sal_True,&pItem) == SFX_ITEM_SET) 775 rDestSet.Put( SvxUnderlineItem(UNDERLINE_NONE,ATTR_FONT_UNDERLINE) = *(const SvxUnderlineItem*)pItem ); 776 if (rEditSet.GetItemState(EE_CHAR_OVERLINE,sal_True,&pItem) == SFX_ITEM_SET) 777 rDestSet.Put( SvxOverlineItem(UNDERLINE_NONE,ATTR_FONT_OVERLINE) = *(const SvxOverlineItem*)pItem ); 778 if (rEditSet.GetItemState(EE_CHAR_WLM,sal_True,&pItem) == SFX_ITEM_SET) 779 rDestSet.Put( SvxWordLineModeItem( ((const SvxWordLineModeItem*)pItem)->GetValue(), 780 ATTR_FONT_WORDLINE) ); 781 782 if (rEditSet.GetItemState(EE_CHAR_STRIKEOUT,sal_True,&pItem) == SFX_ITEM_SET) 783 rDestSet.Put( SvxCrossedOutItem( (FontStrikeout)((const SvxCrossedOutItem*)pItem)->GetValue(), 784 ATTR_FONT_CROSSEDOUT) ); 785 786 if (rEditSet.GetItemState(EE_CHAR_ITALIC,sal_True,&pItem) == SFX_ITEM_SET) 787 rDestSet.Put( SvxPostureItem( (FontItalic)((const SvxPostureItem*)pItem)->GetValue(), 788 ATTR_FONT_POSTURE) ); 789 if (rEditSet.GetItemState(EE_CHAR_ITALIC_CJK,sal_True,&pItem) == SFX_ITEM_SET) 790 rDestSet.Put( SvxPostureItem( (FontItalic)((const SvxPostureItem*)pItem)->GetValue(), 791 ATTR_CJK_FONT_POSTURE) ); 792 if (rEditSet.GetItemState(EE_CHAR_ITALIC_CTL,sal_True,&pItem) == SFX_ITEM_SET) 793 rDestSet.Put( SvxPostureItem( (FontItalic)((const SvxPostureItem*)pItem)->GetValue(), 794 ATTR_CTL_FONT_POSTURE) ); 795 796 if (rEditSet.GetItemState(EE_CHAR_OUTLINE,sal_True,&pItem) == SFX_ITEM_SET) 797 rDestSet.Put( SvxContourItem( ((const SvxContourItem*)pItem)->GetValue(), 798 ATTR_FONT_CONTOUR) ); 799 if (rEditSet.GetItemState(EE_CHAR_SHADOW,sal_True,&pItem) == SFX_ITEM_SET) 800 rDestSet.Put( SvxShadowedItem( ((const SvxShadowedItem*)pItem)->GetValue(), 801 ATTR_FONT_SHADOWED) ); 802 if (rEditSet.GetItemState(EE_CHAR_EMPHASISMARK,sal_True,&pItem) == SFX_ITEM_SET) 803 rDestSet.Put( SvxEmphasisMarkItem( ((const SvxEmphasisMarkItem*)pItem)->GetEmphasisMark(), 804 ATTR_FONT_EMPHASISMARK) ); 805 if (rEditSet.GetItemState(EE_CHAR_RELIEF,sal_True,&pItem) == SFX_ITEM_SET) 806 rDestSet.Put( SvxCharReliefItem( (FontRelief)((const SvxCharReliefItem*)pItem)->GetValue(), 807 ATTR_FONT_RELIEF) ); 808 809 if (rEditSet.GetItemState(EE_CHAR_LANGUAGE,sal_True,&pItem) == SFX_ITEM_SET) 810 rDestSet.Put( SvxLanguageItem(static_cast<const SvxLanguageItem*>(pItem)->GetValue(), ATTR_FONT_LANGUAGE) ); 811 if (rEditSet.GetItemState(EE_CHAR_LANGUAGE_CJK,sal_True,&pItem) == SFX_ITEM_SET) 812 rDestSet.Put( SvxLanguageItem(static_cast<const SvxLanguageItem*>(pItem)->GetValue(), ATTR_CJK_FONT_LANGUAGE) ); 813 if (rEditSet.GetItemState(EE_CHAR_LANGUAGE_CTL,sal_True,&pItem) == SFX_ITEM_SET) 814 rDestSet.Put( SvxLanguageItem(static_cast<const SvxLanguageItem*>(pItem)->GetValue(), ATTR_CTL_FONT_LANGUAGE) ); 815 816 if (rEditSet.GetItemState(EE_PARA_JUST,sal_True,&pItem) == SFX_ITEM_SET) 817 { 818 SvxCellHorJustify eVal; 819 switch ( ((const SvxAdjustItem*)pItem)->GetAdjust() ) 820 { 821 case SVX_ADJUST_LEFT: 822 // #30154# EditEngine Default ist bei dem GetAttribs() ItemSet 823 // immer gesetzt! 824 // ob links oder rechts entscheiden wir selbst bei Text/Zahl 825 eVal = SVX_HOR_JUSTIFY_STANDARD; 826 break; 827 case SVX_ADJUST_RIGHT: 828 eVal = SVX_HOR_JUSTIFY_RIGHT; 829 break; 830 case SVX_ADJUST_BLOCK: 831 eVal = SVX_HOR_JUSTIFY_BLOCK; 832 break; 833 case SVX_ADJUST_CENTER: 834 eVal = SVX_HOR_JUSTIFY_CENTER; 835 break; 836 case SVX_ADJUST_BLOCKLINE: 837 eVal = SVX_HOR_JUSTIFY_BLOCK; 838 break; 839 case SVX_ADJUST_END: 840 eVal = SVX_HOR_JUSTIFY_RIGHT; 841 break; 842 default: 843 eVal = SVX_HOR_JUSTIFY_STANDARD; 844 } 845 if ( eVal != SVX_HOR_JUSTIFY_STANDARD ) 846 rDestSet.Put( SvxHorJustifyItem( eVal, ATTR_HOR_JUSTIFY) ); 847 } 848 } 849 850 void ScPatternAttr::GetFromEditItemSet( const SfxItemSet* pEditSet ) 851 { 852 if( pEditSet ) 853 GetFromEditItemSet( GetItemSet(), *pEditSet ); 854 } 855 856 void ScPatternAttr::FillEditParaItems( SfxItemSet* pEditSet ) const 857 { 858 // in GetFromEditItemSet schon dabei, in FillEditItemSet aber nicht 859 // Hor. Ausrichtung Standard wird immer als "links" umgesetzt 860 861 const SfxItemSet& rMySet = GetItemSet(); 862 863 SvxCellHorJustify eHorJust = (SvxCellHorJustify) 864 ((const SvxHorJustifyItem&)rMySet.Get(ATTR_HOR_JUSTIFY)).GetValue(); 865 866 SvxAdjust eSvxAdjust; 867 switch (eHorJust) 868 { 869 case SVX_HOR_JUSTIFY_RIGHT: eSvxAdjust = SVX_ADJUST_RIGHT; break; 870 case SVX_HOR_JUSTIFY_CENTER: eSvxAdjust = SVX_ADJUST_CENTER; break; 871 case SVX_HOR_JUSTIFY_BLOCK: eSvxAdjust = SVX_ADJUST_BLOCK; break; 872 default: eSvxAdjust = SVX_ADJUST_LEFT; break; 873 } 874 pEditSet->Put( SvxAdjustItem( eSvxAdjust, EE_PARA_JUST ) ); 875 } 876 877 void ScPatternAttr::DeleteUnchanged( const ScPatternAttr* pOldAttrs ) 878 { 879 SfxItemSet& rThisSet = GetItemSet(); 880 const SfxItemSet& rOldSet = pOldAttrs->GetItemSet(); 881 882 const SfxPoolItem* pThisItem; 883 const SfxPoolItem* pOldItem; 884 885 for ( sal_uInt16 nSubWhich=ATTR_PATTERN_START; nSubWhich<=ATTR_PATTERN_END; nSubWhich++ ) 886 { 887 // only items that are set are interesting 888 if ( rThisSet.GetItemState( nSubWhich, sal_False, &pThisItem ) == SFX_ITEM_SET ) 889 { 890 SfxItemState eOldState = rOldSet.GetItemState( nSubWhich, sal_True, &pOldItem ); 891 if ( eOldState == SFX_ITEM_SET ) 892 { 893 // item is set in OldAttrs (or its parent) -> compare pointers 894 if ( pThisItem == pOldItem ) 895 rThisSet.ClearItem( nSubWhich ); 896 } 897 else if ( eOldState != SFX_ITEM_DONTCARE ) 898 { 899 // not set in OldAttrs -> compare item value to default item 900 if ( *pThisItem == rThisSet.GetPool()->GetDefaultItem( nSubWhich ) ) 901 rThisSet.ClearItem( nSubWhich ); 902 } 903 } 904 } 905 } 906 907 sal_Bool ScPatternAttr::HasItemsSet( const sal_uInt16* pWhich ) const 908 { 909 const SfxItemSet& rSet = GetItemSet(); 910 for (sal_uInt16 i=0; pWhich[i]; i++) 911 if ( rSet.GetItemState( pWhich[i], sal_False ) == SFX_ITEM_SET ) 912 return sal_True; 913 return sal_False; 914 } 915 916 void ScPatternAttr::ClearItems( const sal_uInt16* pWhich ) 917 { 918 SfxItemSet& rSet = GetItemSet(); 919 for (sal_uInt16 i=0; pWhich[i]; i++) 920 rSet.ClearItem(pWhich[i]); 921 } 922 923 SfxStyleSheetBase* lcl_CopyStyleToPool 924 ( 925 SfxStyleSheetBase* pSrcStyle, 926 SfxStyleSheetBasePool* pSrcPool, 927 SfxStyleSheetBasePool* pDestPool, 928 const SvNumberFormatterIndexTable* pFormatExchangeList 929 ) 930 { 931 if ( !pSrcStyle || !pDestPool || !pSrcPool ) 932 { 933 DBG_ERROR( "CopyStyleToPool: Invalid Arguments :-/" ); 934 return NULL; 935 } 936 937 //-------------------------------------------------------- 938 939 const String aStrSrcStyle = pSrcStyle->GetName(); 940 const SfxStyleFamily eFamily = pSrcStyle->GetFamily(); 941 SfxStyleSheetBase* pDestStyle = pDestPool->Find( aStrSrcStyle, eFamily ); 942 943 if ( !pDestStyle ) 944 { 945 const String aStrParent = pSrcStyle->GetParent(); 946 const SfxItemSet& rSrcSet = pSrcStyle->GetItemSet(); 947 948 pDestStyle = &pDestPool->Make( aStrSrcStyle, eFamily, SFXSTYLEBIT_USERDEF ); 949 SfxItemSet& rDestSet = pDestStyle->GetItemSet(); 950 rDestSet.Put( rSrcSet ); 951 952 // #b5017505# number format exchange list has to be handled here, too 953 // (only called for cell styles) 954 955 const SfxPoolItem* pSrcItem; 956 if ( pFormatExchangeList && 957 rSrcSet.GetItemState( ATTR_VALUE_FORMAT, sal_False, &pSrcItem ) == SFX_ITEM_SET ) 958 { 959 sal_uLong nOldFormat = static_cast<const SfxUInt32Item*>(pSrcItem)->GetValue(); 960 sal_uInt32* pNewFormat = static_cast<sal_uInt32*>(pFormatExchangeList->Get( nOldFormat )); 961 if (pNewFormat) 962 rDestSet.Put( SfxUInt32Item( ATTR_VALUE_FORMAT, *pNewFormat ) ); 963 } 964 965 // ggF. abgeleitete Styles erzeugen, wenn nicht vorhanden: 966 967 if ( ScGlobal::GetRscString(STR_STYLENAME_STANDARD) != aStrParent && 968 aStrSrcStyle != aStrParent && 969 !pDestPool->Find( aStrParent, eFamily ) ) 970 { 971 lcl_CopyStyleToPool( pSrcPool->Find( aStrParent, eFamily ), 972 pSrcPool, pDestPool, pFormatExchangeList ); 973 } 974 975 pDestStyle->SetParent( aStrParent ); 976 } 977 978 return pDestStyle; 979 } 980 981 ScPatternAttr* ScPatternAttr::PutInPool( ScDocument* pDestDoc, ScDocument* pSrcDoc ) const 982 { 983 const SfxItemSet* pSrcSet = &GetItemSet(); 984 985 ScPatternAttr* pDestPattern = new ScPatternAttr(pDestDoc->GetPool()); 986 SfxItemSet* pDestSet = &pDestPattern->GetItemSet(); 987 988 // Zellformatvorlage in anderes Dokument kopieren: 989 990 if ( pDestDoc != pSrcDoc ) 991 { 992 DBG_ASSERT( pStyle, "Missing Pattern-Style! :-/" ); 993 994 // wenn Vorlage im DestDoc vorhanden, dieses benutzen, sonst Style 995 // mit Parent-Vorlagen kopieren/ggF. erzeugen und dem DestDoc hinzufuegen 996 997 SfxStyleSheetBase* pStyleCpy = lcl_CopyStyleToPool( pStyle, 998 pSrcDoc->GetStyleSheetPool(), 999 pDestDoc->GetStyleSheetPool(), 1000 pDestDoc->GetFormatExchangeList() ); 1001 1002 pDestPattern->SetStyleSheet( (ScStyleSheet*)pStyleCpy ); 1003 } 1004 1005 for ( sal_uInt16 nAttrId = ATTR_PATTERN_START; nAttrId <= ATTR_PATTERN_END; nAttrId++ ) 1006 { 1007 const SfxPoolItem* pSrcItem; 1008 SfxItemState eItemState = pSrcSet->GetItemState( nAttrId, sal_False, &pSrcItem ); 1009 if (eItemState==SFX_ITEM_ON) 1010 { 1011 SfxPoolItem* pNewItem = NULL; 1012 1013 if ( nAttrId == ATTR_CONDITIONAL ) 1014 { 1015 // Bedingte Formate ins neue Dokument kopieren 1016 1017 sal_uLong nNewIndex = 0; 1018 ScConditionalFormatList* pSrcList = pSrcDoc->GetCondFormList(); 1019 if ( pSrcList ) 1020 { 1021 sal_uLong nOldIndex = ((const SfxUInt32Item*)pSrcItem)->GetValue(); 1022 const ScConditionalFormat* pOldData = pSrcList->GetFormat( nOldIndex ); 1023 if ( pOldData ) 1024 { 1025 nNewIndex = pDestDoc->AddCondFormat( *pOldData ); 1026 1027 // zugehoerige Styles auch mitkopieren 1028 //! nur wenn Format bei Add neu angelegt 1029 1030 ScStyleSheetPool* pSrcSPool = pSrcDoc->GetStyleSheetPool(); 1031 ScStyleSheetPool* pDestSPool = pDestDoc->GetStyleSheetPool(); 1032 const SvNumberFormatterIndexTable* pFormatExchangeList = pDestDoc->GetFormatExchangeList(); 1033 sal_uInt16 nStlCnt = pOldData->Count(); 1034 for (sal_uInt16 i=0; i<nStlCnt; i++) 1035 { 1036 String aName = pOldData->GetEntry(i)->GetStyle(); 1037 SfxStyleSheetBase* pSrcStl = 1038 pSrcDoc->GetStyleSheetPool()->Find(aName, SFX_STYLE_FAMILY_PARA); 1039 lcl_CopyStyleToPool( pSrcStl, pSrcSPool, pDestSPool, pFormatExchangeList ); 1040 } 1041 } 1042 } 1043 pNewItem = new SfxUInt32Item( ATTR_CONDITIONAL, nNewIndex ); 1044 } 1045 else if ( nAttrId == ATTR_VALIDDATA ) 1046 { 1047 // Gueltigkeit ins neue Dokument kopieren 1048 1049 sal_uLong nNewIndex = 0; 1050 ScValidationDataList* pSrcList = pSrcDoc->GetValidationList(); 1051 if ( pSrcList ) 1052 { 1053 sal_uLong nOldIndex = ((const SfxUInt32Item*)pSrcItem)->GetValue(); 1054 const ScValidationData* pOldData = pSrcList->GetData( nOldIndex ); 1055 if ( pOldData ) 1056 nNewIndex = pDestDoc->AddValidationEntry( *pOldData ); 1057 } 1058 pNewItem = new SfxUInt32Item( ATTR_VALIDDATA, nNewIndex ); 1059 } 1060 else if ( nAttrId == ATTR_VALUE_FORMAT && pDestDoc->GetFormatExchangeList() ) 1061 { 1062 // Zahlformate nach Exchange-Liste 1063 1064 sal_uLong nOldFormat = ((const SfxUInt32Item*)pSrcItem)->GetValue(); 1065 sal_uInt32* pNewFormat = static_cast<sal_uInt32*>(pDestDoc->GetFormatExchangeList()->Get(nOldFormat)); 1066 if (pNewFormat) 1067 pNewItem = new SfxUInt32Item( ATTR_VALUE_FORMAT, (sal_uInt32) (*pNewFormat) ); 1068 } 1069 1070 if ( pNewItem ) 1071 { 1072 pDestSet->Put(*pNewItem); 1073 delete pNewItem; 1074 } 1075 else 1076 pDestSet->Put(*pSrcItem); 1077 } 1078 } 1079 1080 ScPatternAttr* pPatternAttr = 1081 (ScPatternAttr*) &pDestDoc->GetPool()->Put(*pDestPattern); 1082 delete pDestPattern; 1083 return pPatternAttr; 1084 } 1085 1086 sal_Bool ScPatternAttr::IsVisible() const 1087 { 1088 const SfxItemSet& rSet = GetItemSet(); 1089 1090 const SfxPoolItem* pItem; 1091 SfxItemState eState; 1092 1093 eState = rSet.GetItemState( ATTR_BACKGROUND, sal_True, &pItem ); 1094 if ( eState == SFX_ITEM_SET ) 1095 if ( ((const SvxBrushItem*)pItem)->GetColor().GetColor() != COL_TRANSPARENT ) 1096 return sal_True; 1097 1098 eState = rSet.GetItemState( ATTR_BORDER, sal_True, &pItem ); 1099 if ( eState == SFX_ITEM_SET ) 1100 { 1101 const SvxBoxItem* pBoxItem = (SvxBoxItem*) pItem; 1102 if ( pBoxItem->GetTop() || pBoxItem->GetBottom() || 1103 pBoxItem->GetLeft() || pBoxItem->GetRight() ) 1104 return sal_True; 1105 } 1106 1107 eState = rSet.GetItemState( ATTR_BORDER_TLBR, sal_True, &pItem ); 1108 if ( eState == SFX_ITEM_SET ) 1109 if( static_cast< const SvxLineItem* >( pItem )->GetLine() ) 1110 return sal_True; 1111 1112 eState = rSet.GetItemState( ATTR_BORDER_BLTR, sal_True, &pItem ); 1113 if ( eState == SFX_ITEM_SET ) 1114 if( static_cast< const SvxLineItem* >( pItem )->GetLine() ) 1115 return sal_True; 1116 1117 eState = rSet.GetItemState( ATTR_SHADOW, sal_True, &pItem ); 1118 if ( eState == SFX_ITEM_SET ) 1119 if ( ((const SvxShadowItem*)pItem)->GetLocation() != SVX_SHADOW_NONE ) 1120 return sal_True; 1121 1122 return sal_False; 1123 } 1124 1125 inline sal_Bool OneEqual( const SfxItemSet& rSet1, const SfxItemSet& rSet2, sal_uInt16 nId ) 1126 { 1127 const SfxPoolItem* pItem1 = &rSet1.Get(nId); 1128 const SfxPoolItem* pItem2 = &rSet2.Get(nId); 1129 return ( pItem1 == pItem2 || *pItem1 == *pItem2 ); 1130 } 1131 1132 sal_Bool ScPatternAttr::IsVisibleEqual( const ScPatternAttr& rOther ) const 1133 { 1134 const SfxItemSet& rThisSet = GetItemSet(); 1135 const SfxItemSet& rOtherSet = rOther.GetItemSet(); 1136 1137 return OneEqual( rThisSet, rOtherSet, ATTR_BACKGROUND ) && 1138 OneEqual( rThisSet, rOtherSet, ATTR_BORDER ) && 1139 OneEqual( rThisSet, rOtherSet, ATTR_BORDER_TLBR ) && 1140 OneEqual( rThisSet, rOtherSet, ATTR_BORDER_BLTR ) && 1141 OneEqual( rThisSet, rOtherSet, ATTR_SHADOW ); 1142 1143 //! auch hier nur wirklich sichtbare Werte testen !!! 1144 } 1145 1146 const String* ScPatternAttr::GetStyleName() const 1147 { 1148 return pName ? pName : ( pStyle ? &pStyle->GetName() : NULL ); 1149 } 1150 1151 1152 void ScPatternAttr::SetStyleSheet( ScStyleSheet* pNewStyle ) 1153 { 1154 if (pNewStyle) 1155 { 1156 SfxItemSet& rPatternSet = GetItemSet(); 1157 const SfxItemSet& rStyleSet = pNewStyle->GetItemSet(); 1158 1159 for (sal_uInt16 i=ATTR_PATTERN_START; i<=ATTR_PATTERN_END; i++) 1160 { 1161 if (rStyleSet.GetItemState(i, sal_True) == SFX_ITEM_SET) 1162 rPatternSet.ClearItem(i); 1163 } 1164 rPatternSet.SetParent(&pNewStyle->GetItemSet()); 1165 pStyle = pNewStyle; 1166 DELETEZ( pName ); 1167 } 1168 else 1169 { 1170 DBG_ERROR( "ScPatternAttr::SetStyleSheet( NULL ) :-|" ); 1171 GetItemSet().SetParent(NULL); 1172 pStyle = NULL; 1173 } 1174 } 1175 1176 void ScPatternAttr::UpdateStyleSheet() 1177 { 1178 if (pName) 1179 { 1180 pStyle = (ScStyleSheet*)pDoc->GetStyleSheetPool()->Find(*pName, SFX_STYLE_FAMILY_PARA); 1181 1182 // wenn Style nicht gefunden, Standard nehmen, 1183 // damit keine leere Anzeige im Toolbox-Controller 1184 //! es wird vorausgesetzt, dass "Standard" immer der erste Eintrag ist! 1185 if (!pStyle) 1186 { 1187 SfxStyleSheetIteratorPtr pIter = pDoc->GetStyleSheetPool()->CreateIterator( SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_ALL ); 1188 pStyle = dynamic_cast< ScStyleSheet* >(pIter->First()); 1189 } 1190 1191 if (pStyle) 1192 { 1193 GetItemSet().SetParent(&pStyle->GetItemSet()); 1194 DELETEZ( pName ); 1195 } 1196 } 1197 else 1198 pStyle = NULL; 1199 } 1200 1201 void ScPatternAttr::StyleToName() 1202 { 1203 // Style wurde geloescht, Namen merken: 1204 1205 if ( pStyle ) 1206 { 1207 if ( pName ) 1208 *pName = pStyle->GetName(); 1209 else 1210 pName = new String( pStyle->GetName() ); 1211 1212 pStyle = NULL; 1213 GetItemSet().SetParent( NULL ); 1214 } 1215 } 1216 1217 sal_Bool ScPatternAttr::IsSymbolFont() const 1218 { 1219 const SfxPoolItem* pItem; 1220 if( GetItemSet().GetItemState( ATTR_FONT, sal_True, &pItem ) == SFX_ITEM_SET ) 1221 return sal_Bool( ((const SvxFontItem*) pItem)->GetCharSet() 1222 == RTL_TEXTENCODING_SYMBOL ); 1223 else 1224 return sal_False; 1225 } 1226 1227 //UNUSED2008-05 FontToSubsFontConverter ScPatternAttr::GetSubsFontConverter( sal_uLong nFlags ) const 1228 //UNUSED2008-05 { 1229 //UNUSED2008-05 const SfxPoolItem* pItem; 1230 //UNUSED2008-05 if( GetItemSet().GetItemState( ATTR_FONT, sal_True, &pItem ) == SFX_ITEM_SET ) 1231 //UNUSED2008-05 return CreateFontToSubsFontConverter( 1232 //UNUSED2008-05 ((const SvxFontItem*) pItem)->GetFamilyName(), nFlags ); 1233 //UNUSED2008-05 else 1234 //UNUSED2008-05 return 0; 1235 //UNUSED2008-05 } 1236 1237 1238 sal_uLong ScPatternAttr::GetNumberFormat( SvNumberFormatter* pFormatter ) const 1239 { 1240 sal_uLong nFormat = 1241 ((SfxUInt32Item*)&GetItemSet().Get( ATTR_VALUE_FORMAT ))->GetValue(); 1242 LanguageType eLang = 1243 ((SvxLanguageItem*)&GetItemSet().Get( ATTR_LANGUAGE_FORMAT ))->GetLanguage(); 1244 if ( nFormat < SV_COUNTRY_LANGUAGE_OFFSET && eLang == LANGUAGE_SYSTEM ) 1245 ; // es bleibt wie es ist 1246 else if ( pFormatter ) 1247 nFormat = pFormatter->GetFormatForLanguageIfBuiltIn( nFormat, eLang ); 1248 return nFormat; 1249 } 1250 1251 // dasselbe, wenn bedingte Formatierung im Spiel ist: 1252 1253 sal_uLong ScPatternAttr::GetNumberFormat( SvNumberFormatter* pFormatter, 1254 const SfxItemSet* pCondSet ) const 1255 { 1256 DBG_ASSERT(pFormatter,"GetNumberFormat ohne Formatter"); 1257 1258 const SfxPoolItem* pFormItem; 1259 if ( !pCondSet || pCondSet->GetItemState(ATTR_VALUE_FORMAT,sal_True,&pFormItem) != SFX_ITEM_SET ) 1260 pFormItem = &GetItemSet().Get(ATTR_VALUE_FORMAT); 1261 1262 const SfxPoolItem* pLangItem; 1263 if ( !pCondSet || pCondSet->GetItemState(ATTR_LANGUAGE_FORMAT,sal_True,&pLangItem) != SFX_ITEM_SET ) 1264 pLangItem = &GetItemSet().Get(ATTR_LANGUAGE_FORMAT); 1265 1266 return pFormatter->GetFormatForLanguageIfBuiltIn( 1267 ((SfxUInt32Item*)pFormItem)->GetValue(), 1268 ((SvxLanguageItem*)pLangItem)->GetLanguage() ); 1269 } 1270 1271 const SfxPoolItem& ScPatternAttr::GetItem( sal_uInt16 nWhich, const SfxItemSet& rItemSet, const SfxItemSet* pCondSet ) 1272 { 1273 const SfxPoolItem* pCondItem; 1274 if ( pCondSet && pCondSet->GetItemState( nWhich, sal_True, &pCondItem ) == SFX_ITEM_SET ) 1275 return *pCondItem; 1276 return rItemSet.Get(nWhich); 1277 } 1278 1279 const SfxPoolItem& ScPatternAttr::GetItem( sal_uInt16 nSubWhich, const SfxItemSet* pCondSet ) const 1280 { 1281 return GetItem( nSubWhich, GetItemSet(), pCondSet ); 1282 } 1283 1284 // GetRotateVal testet vorher ATTR_ORIENTATION 1285 1286 long ScPatternAttr::GetRotateVal( const SfxItemSet* pCondSet ) const 1287 { 1288 long nAttrRotate = 0; 1289 if ( GetCellOrientation() == SVX_ORIENTATION_STANDARD ) 1290 { 1291 sal_Bool bRepeat = ( static_cast<const SvxHorJustifyItem&>(GetItem(ATTR_HOR_JUSTIFY, pCondSet)). 1292 GetValue() == SVX_HOR_JUSTIFY_REPEAT ); 1293 // ignore orientation/rotation if "repeat" is active 1294 if ( !bRepeat ) 1295 nAttrRotate = ((const SfxInt32Item&)GetItem( ATTR_ROTATE_VALUE, pCondSet )).GetValue(); 1296 } 1297 return nAttrRotate; 1298 } 1299 1300 sal_uInt8 ScPatternAttr::GetRotateDir( const SfxItemSet* pCondSet ) const 1301 { 1302 sal_uInt8 nRet = SC_ROTDIR_NONE; 1303 1304 long nAttrRotate = GetRotateVal( pCondSet ); 1305 if ( nAttrRotate ) 1306 { 1307 SvxRotateMode eRotMode = (SvxRotateMode)((const SvxRotateModeItem&) 1308 GetItem(ATTR_ROTATE_MODE, pCondSet)).GetValue(); 1309 1310 if ( eRotMode == SVX_ROTATE_MODE_STANDARD || nAttrRotate == 18000 ) 1311 nRet = SC_ROTDIR_STANDARD; 1312 else if ( eRotMode == SVX_ROTATE_MODE_CENTER ) 1313 nRet = SC_ROTDIR_CENTER; 1314 else if ( eRotMode == SVX_ROTATE_MODE_TOP || eRotMode == SVX_ROTATE_MODE_BOTTOM ) 1315 { 1316 long nRot180 = nAttrRotate % 18000; // 1/100 Grad 1317 if ( nRot180 == 9000 ) 1318 nRet = SC_ROTDIR_CENTER; 1319 else if ( ( eRotMode == SVX_ROTATE_MODE_TOP && nRot180 < 9000 ) || 1320 ( eRotMode == SVX_ROTATE_MODE_BOTTOM && nRot180 > 9000 ) ) 1321 nRet = SC_ROTDIR_LEFT; 1322 else 1323 nRet = SC_ROTDIR_RIGHT; 1324 } 1325 } 1326 1327 return nRet; 1328 } 1329 1330 1331 1332 1333