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_sd.hxx" 26 27 #include "DrawViewShell.hxx" 28 #include <com/sun/star/form/FormButtonType.hpp> 29 #include <com/sun/star/beans/XPropertySet.hpp> 30 31 #ifndef _SVXIDS_HRC 32 #include <svx/svxids.hrc> 33 #endif 34 #ifndef _GLOBL3D_HXX 35 #include <svx/globl3d.hxx> 36 #endif 37 #include <svx/hlnkitem.hxx> 38 #include <editeng/eeitem.hxx> 39 #ifndef _FLDITEM_HXX 40 #include <editeng/flditem.hxx> 41 #endif 42 #include <sfx2/viewfrm.hxx> 43 #include <svl/whiter.hxx> 44 #include <svl/eitem.hxx> 45 #include <svl/itempool.hxx> 46 #include <sfx2/tplpitem.hxx> 47 #ifndef _BINDING_HXX //autogen 48 #include <sfx2/bindings.hxx> 49 #endif 50 #include <sfx2/app.hxx> 51 #include <sfx2/templdlg.hxx> 52 #include <svx/xdef.hxx> 53 #include <svx/svddef.hxx> 54 #include <svx/fmglob.hxx> 55 #include <svx/svdouno.hxx> 56 #include <tools/urlobj.hxx> 57 #include <svx/fmshell.hxx> 58 #include <svl/cjkoptions.hxx> 59 60 #ifndef SD_FRAME_VIEW 61 #include "FrameView.hxx" 62 #endif 63 #include "Outliner.hxx" 64 #include "app.hrc" 65 66 #include "app.hxx" 67 #include "stlsheet.hxx" 68 #include "drawview.hxx" 69 #include "drawdoc.hxx" 70 #include "Window.hxx" 71 #include "ViewShellBase.hxx" 72 #include "FormShellManager.hxx" 73 #include "cfgids.hxx" 74 #include "anminfo.hxx" 75 76 #include <editeng/lspcitem.hxx> 77 #include <editeng/ulspitem.hxx> 78 #include <editeng/lrspitem.hxx> 79 #include <editeng/escpitem.hxx> 80 using ::rtl::OUString; 81 using namespace ::com::sun::star; 82 83 namespace sd { 84 85 /************************************************************************* 86 |* 87 |* Status von Controller-SfxSlots setzen 88 |* 89 \************************************************************************/ 90 91 void DrawViewShell::GetCtrlState(SfxItemSet &rSet) 92 { 93 if (rSet.GetItemState(SID_RELOAD) != SFX_ITEM_UNKNOWN) 94 { 95 // "Letzte Version" vom SFx en/disablen lassen 96 GetViewFrame()->GetSlotState (SID_RELOAD, NULL, &rSet); 97 } 98 99 if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_HYPERLINK_GETLINK)) 100 { 101 SvxHyperlinkItem aHLinkItem; 102 103 OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView(); 104 105 if (pOLV) 106 { 107 bool bField = false; 108 const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection(); 109 if (pFieldItem) 110 { 111 ESelection aSel = pOLV->GetSelection(); 112 if ( abs( aSel.nEndPos - aSel.nStartPos ) == 1 ) 113 { 114 const SvxFieldData* pField = pFieldItem->GetField(); 115 if (pField->ISA(SvxURLField)) 116 { 117 aHLinkItem.SetName(((const SvxURLField*) pField)->GetRepresentation()); 118 aHLinkItem.SetURL(((const SvxURLField*) pField)->GetURL()); 119 aHLinkItem.SetTargetFrame(((const SvxURLField*) pField)->GetTargetFrame()); 120 bField = true; 121 } 122 } 123 } 124 if (!bField) 125 { 126 // use selected text as name for urls 127 String sReturn = pOLV->GetSelected(); 128 sReturn.Erase(255); 129 sReturn.EraseTrailingChars(); 130 aHLinkItem.SetName(sReturn); 131 } 132 } 133 else 134 { 135 if (mpDrawView->GetMarkedObjectList().GetMarkCount() > 0) 136 { 137 bool bFound = false; 138 139 SdrObject* pMarkedObj = mpDrawView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(); 140 if( pMarkedObj && (FmFormInventor == pMarkedObj->GetObjInventor()) ) 141 { 142 SdrUnoObj* pUnoCtrl = dynamic_cast< SdrUnoObj* >( pMarkedObj ); 143 144 if(pUnoCtrl) try 145 { 146 uno::Reference< awt::XControlModel > xControlModel( pUnoCtrl->GetUnoControlModel(), uno::UNO_QUERY_THROW ); 147 uno::Reference< beans::XPropertySet > xPropSet( xControlModel, uno::UNO_QUERY_THROW ); 148 uno::Reference< beans::XPropertySetInfo > xPropInfo( xPropSet->getPropertySetInfo(), uno::UNO_QUERY_THROW ); 149 150 form::FormButtonType eButtonType = form::FormButtonType_URL; 151 const OUString sButtonType( RTL_CONSTASCII_USTRINGPARAM( "ButtonType" ) ); 152 if(xPropInfo->hasPropertyByName( sButtonType ) && (xPropSet->getPropertyValue( sButtonType ) >>= eButtonType ) ) 153 { 154 OUString aString; 155 156 // Label 157 const OUString sLabel( RTL_CONSTASCII_USTRINGPARAM( "Label" ) ); 158 if(xPropInfo->hasPropertyByName(sLabel)) 159 { 160 if( xPropSet->getPropertyValue(sLabel) >>= aString ) 161 aHLinkItem.SetName(String( aString )); 162 } 163 164 // URL 165 const OUString sTargetURL(RTL_CONSTASCII_USTRINGPARAM( "TargetURL" )); 166 if(xPropInfo->hasPropertyByName(sTargetURL)) 167 { 168 if( xPropSet->getPropertyValue(sTargetURL) >>= aString ) 169 aHLinkItem.SetURL(String( aString )); 170 } 171 172 // Target 173 const OUString sTargetFrame( RTL_CONSTASCII_USTRINGPARAM( "TargetFrame" ) ); 174 if(xPropInfo->hasPropertyByName(sTargetFrame) ) 175 { 176 if( xPropSet->getPropertyValue(sTargetFrame) >>= aString ) 177 aHLinkItem.SetTargetFrame(String( aString )); 178 } 179 180 aHLinkItem.SetInsertMode(HLINK_BUTTON); 181 bFound = true; 182 } 183 } 184 catch( uno::Exception& ) 185 { 186 } 187 } 188 189 // try interaction link 190 if( !bFound && pMarkedObj ) 191 { 192 SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pMarkedObj); 193 if( pInfo && (pInfo->meClickAction == presentation::ClickAction_DOCUMENT) ) 194 aHLinkItem.SetURL( pInfo->GetBookmark()); 195 aHLinkItem.SetInsertMode(HLINK_BUTTON); 196 } 197 } 198 } 199 200 rSet.Put(aHLinkItem); 201 } 202 rSet.Put( SfxBoolItem( SID_READONLY_MODE, mbReadOnly ) ); 203 204 // Ausgabequalitaet 205 if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTPUT_QUALITY_COLOR ) || 206 SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTPUT_QUALITY_GRAYSCALE ) || 207 SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTPUT_QUALITY_BLACKWHITE ) || 208 SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTPUT_QUALITY_CONTRAST ) ) 209 { 210 const sal_uLong nMode = (sal_Int32)GetActiveWindow()->GetDrawMode(); 211 rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_COLOR, (sal_Bool)((sal_uLong)OUTPUT_DRAWMODE_COLOR == nMode) ) ); 212 rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_GRAYSCALE, (sal_Bool)((sal_uLong)OUTPUT_DRAWMODE_GRAYSCALE == nMode) ) ); 213 rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_BLACKWHITE, (sal_Bool)((sal_uLong)OUTPUT_DRAWMODE_BLACKWHITE == nMode) ) ); 214 rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_CONTRAST, (sal_Bool)((sal_uLong)OUTPUT_DRAWMODE_CONTRAST == nMode) ) ); 215 } 216 217 if ( SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_MAIL_SCROLLBODY_PAGEDOWN) ) 218 { 219 rSet.Put( SfxBoolItem( SID_MAIL_SCROLLBODY_PAGEDOWN, sal_True ) ); 220 } 221 222 if ( SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_ATTR_YEAR2000) ) 223 { 224 FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell(); 225 if (pFormShell != NULL) 226 { 227 sal_uInt16 nState = 0; 228 if (pFormShell->GetY2KState(nState)) 229 rSet.Put( SfxUInt16Item( SID_ATTR_YEAR2000, nState ) ); 230 else 231 rSet.DisableItem( SID_ATTR_YEAR2000 ); 232 } 233 } 234 235 if ( !GetView()->GetTextEditOutliner() ) 236 { 237 SvtCJKOptions aCJKOptions; 238 if( !aCJKOptions.IsChangeCaseMapEnabled() ) 239 { 240 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_False ); 241 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_False ); 242 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_False ); 243 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_False ); 244 } 245 else 246 { 247 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_True ); 248 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_True ); 249 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_True ); 250 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_True ); 251 } 252 253 rSet.DisableItem( SID_TRANSLITERATE_SENTENCE_CASE ); 254 rSet.DisableItem( SID_TRANSLITERATE_TITLE_CASE ); 255 rSet.DisableItem( SID_TRANSLITERATE_TOGGLE_CASE ); 256 rSet.DisableItem( SID_TRANSLITERATE_UPPER ); 257 rSet.DisableItem( SID_TRANSLITERATE_LOWER ); 258 rSet.DisableItem( SID_TRANSLITERATE_HALFWIDTH ); 259 rSet.DisableItem( SID_TRANSLITERATE_FULLWIDTH ); 260 rSet.DisableItem( SID_TRANSLITERATE_HIRAGANA ); 261 rSet.DisableItem( SID_TRANSLITERATE_KATAGANA ); 262 } 263 else 264 { 265 SvtCJKOptions aCJKOptions; 266 if( !aCJKOptions.IsChangeCaseMapEnabled() ) 267 { 268 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_False ); 269 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_False ); 270 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_False ); 271 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_False ); 272 rSet.DisableItem( SID_TRANSLITERATE_HALFWIDTH ); 273 rSet.DisableItem( SID_TRANSLITERATE_FULLWIDTH ); 274 rSet.DisableItem( SID_TRANSLITERATE_HIRAGANA ); 275 rSet.DisableItem( SID_TRANSLITERATE_KATAGANA ); 276 } 277 else 278 { 279 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_True ); 280 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_True ); 281 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_True ); 282 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_True ); 283 } 284 } 285 } 286 287 288 /************************************************************************* 289 |* 290 |* Status der Attribut-Items 291 |* 292 \************************************************************************/ 293 294 void DrawViewShell::GetAttrState( SfxItemSet& rSet ) 295 { 296 SfxWhichIter aIter( rSet ); 297 sal_uInt16 nWhich = aIter.FirstWhich(); 298 299 sal_Bool bAttr = sal_False; 300 SfxAllItemSet aAllSet( *rSet.GetPool() ); 301 302 while ( nWhich ) 303 { 304 sal_uInt16 nSlotId = SfxItemPool::IsWhich(nWhich) 305 ? GetPool().GetSlotId(nWhich) 306 : nWhich; 307 switch ( nSlotId ) 308 { 309 case SID_ATTR_PARA_LRSPACE: 310 { 311 SfxItemSet aAttrs( GetDoc()->GetPool() ); 312 mpDrawView->GetAttributes( aAttrs ); 313 SvxLRSpaceItem aLRSpace = ( (const SvxLRSpaceItem&) aAttrs.Get( EE_PARA_LRSPACE ) ); 314 aLRSpace.SetWhich(SID_ATTR_PARA_LRSPACE); 315 rSet.Put(aLRSpace); 316 bAttr = sal_True; 317 Invalidate(SID_ATTR_PARA_LRSPACE); 318 } 319 break; 320 case SID_ATTR_PARA_LINESPACE: 321 { 322 SfxItemSet aAttrs( GetDoc()->GetPool() ); 323 mpDrawView->GetAttributes( aAttrs ); 324 SvxLineSpacingItem aLineLR = ( (const SvxLineSpacingItem&) aAttrs.Get( EE_PARA_SBL ) ); 325 rSet.Put(aLineLR); 326 bAttr = sal_True; 327 Invalidate(SID_ATTR_PARA_LINESPACE); 328 } 329 break; 330 case SID_ATTR_PARA_ULSPACE: 331 { 332 SfxItemSet aAttrs( GetDoc()->GetPool() ); 333 mpDrawView->GetAttributes( aAttrs ); 334 SvxULSpaceItem aULSP = ( (const SvxULSpaceItem&) aAttrs.Get( EE_PARA_ULSPACE ) ); 335 aULSP.SetWhich(SID_ATTR_PARA_ULSPACE); 336 rSet.Put(aULSP); 337 bAttr = sal_True; 338 Invalidate(SID_ATTR_PARA_ULSPACE); 339 } 340 break; 341 case SID_ATTR_FILL_STYLE: 342 case SID_ATTR_FILL_COLOR: 343 case SID_ATTR_FILL_GRADIENT: 344 case SID_ATTR_FILL_HATCH: 345 case SID_ATTR_FILL_BITMAP: 346 case SID_ATTR_FILL_SHADOW: 347 case SID_ATTR_FILL_TRANSPARENCE: 348 case SID_ATTR_FILL_FLOATTRANSPARENCE: 349 case SID_ATTR_LINE_STYLE: 350 case SID_ATTR_LINE_DASH: 351 case SID_ATTR_LINE_WIDTH: 352 case SID_ATTR_LINE_COLOR: 353 case SID_ATTR_LINE_TRANSPARENCE: 354 case SID_ATTR_LINE_JOINT: 355 case SID_ATTR_LINE_CAP: 356 case SID_ATTR_TEXT_FITTOSIZE: 357 case SID_ATTR_CHAR_FONT: 358 case SID_ATTR_CHAR_FONTHEIGHT: 359 case SID_ATTR_CHAR_SHADOWED: 360 case SID_ATTR_CHAR_POSTURE: 361 case SID_ATTR_CHAR_UNDERLINE: 362 case SID_ATTR_CHAR_STRIKEOUT: 363 case SID_ATTR_CHAR_WEIGHT: 364 case SID_ATTR_CHAR_COLOR: 365 case SID_ATTR_CHAR_KERNING: 366 case SID_SET_SUB_SCRIPT: 367 case SID_SET_SUPER_SCRIPT: 368 { 369 bAttr = sal_True; 370 } 371 break; 372 373 case SID_HYPHENATION: 374 { 375 SfxItemSet aAttrs( GetDoc()->GetPool() ); 376 mpDrawView->GetAttributes( aAttrs ); 377 if( aAttrs.GetItemState( EE_PARA_HYPHENATE ) >= SFX_ITEM_AVAILABLE ) 378 { 379 sal_Bool bValue = ( (const SfxBoolItem&) aAttrs.Get( EE_PARA_HYPHENATE ) ).GetValue(); 380 rSet.Put( SfxBoolItem( SID_HYPHENATION, bValue ) ); 381 } 382 } 383 break; 384 385 case SID_STYLE_FAMILY2: 386 case SID_STYLE_FAMILY3: 387 case SID_STYLE_FAMILY5: 388 case SID_STYLE_APPLY: // StyleControl 389 { 390 SfxStyleSheet* pStyleSheet = mpDrawView->GetStyleSheet(); 391 if( pStyleSheet ) 392 { 393 if( nSlotId != SID_STYLE_APPLY && !mpDrawView->AreObjectsMarked() ) 394 { 395 SfxTemplateItem aTmpItem( nWhich, String() ); 396 aAllSet.Put( aTmpItem, aTmpItem.Which() ); 397 } 398 else 399 { 400 if (pStyleSheet->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE) 401 pStyleSheet = ((SdStyleSheet*)pStyleSheet)->GetPseudoStyleSheet(); 402 403 if( pStyleSheet ) 404 { 405 SfxStyleFamily eFamily = pStyleSheet->GetFamily(); 406 407 if ((eFamily == SD_STYLE_FAMILY_GRAPHICS && nSlotId == SID_STYLE_FAMILY2) || 408 (eFamily == SD_STYLE_FAMILY_CELL && nSlotId == SID_STYLE_FAMILY3) || 409 (eFamily == SD_STYLE_FAMILY_PSEUDO && nSlotId == SID_STYLE_FAMILY5)) 410 { 411 SfxTemplateItem aTmpItem ( nWhich, pStyleSheet->GetName() ); 412 aAllSet.Put( aTmpItem, aTmpItem.Which() ); 413 } 414 else 415 { 416 SfxTemplateItem aTmpItem(nWhich, String()); 417 aAllSet.Put(aTmpItem,aTmpItem.Which() ); 418 } 419 } 420 } 421 } 422 else 423 { SfxTemplateItem aItem( nWhich, String() ); 424 aAllSet.Put( aItem, aItem.Which() ); 425 // rSet.DisableItem( nWhich ); 426 } 427 } 428 break; 429 430 case SID_SET_DEFAULT: 431 { 432 if( !mpDrawView->GetMarkedObjectList().GetMarkCount() || 433 ( !mpDrawView->IsTextEdit() && !mpDrawView->GetStyleSheet() ) 434 ) 435 rSet.DisableItem( nWhich ); 436 } 437 break; 438 439 case SID_STYLE_WATERCAN: 440 { 441 ISfxTemplateCommon* pTemplateCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings()); 442 if (pTemplateCommon && pTemplateCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO) 443 rSet.Put(SfxBoolItem(nWhich,sal_False)); 444 else 445 { 446 SfxBoolItem aItem(nWhich, SD_MOD()->GetWaterCan()); 447 aAllSet.Put( aItem, aItem.Which()); 448 } 449 } 450 break; 451 452 case SID_STYLE_NEW: 453 { 454 ISfxTemplateCommon* pTemplateCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings()); 455 if (pTemplateCommon && pTemplateCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO) 456 rSet.DisableItem(nWhich); 457 } 458 break; 459 460 case SID_STYLE_DRAGHIERARCHIE: 461 { 462 ISfxTemplateCommon* pTemplateCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings()); 463 if (pTemplateCommon && pTemplateCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO) 464 rSet.DisableItem(nWhich); 465 } 466 break; 467 468 case SID_STYLE_NEW_BY_EXAMPLE: 469 { 470 // PseudoStyleSheets koennen nicht 'by Example' erzeugt werden; 471 // normale StyleSheets brauchen dafuer ein selektiertes Objekt 472 ISfxTemplateCommon* pTemplCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings()); 473 if (pTemplCommon) 474 { 475 if (pTemplCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO) 476 { 477 rSet.DisableItem(nWhich); 478 } 479 else if (pTemplCommon->GetActualFamily() == SD_STYLE_FAMILY_GRAPHICS) 480 { 481 if (!mpDrawView->AreObjectsMarked()) 482 { 483 rSet.DisableItem(nWhich); 484 } 485 } 486 } 487 // falls (noch) kein Gestalter da ist, muessen wir uns auf den 488 // View-Zustand zurueckziehen; eine aktuell eingestellte Familie 489 // kann nicht beruecksichtigt werden 490 else 491 { 492 if (!mpDrawView->AreObjectsMarked()) 493 { 494 rSet.DisableItem(nWhich); 495 } 496 } 497 498 } 499 break; 500 501 case SID_STYLE_UPDATE_BY_EXAMPLE: 502 { 503 if (!mpDrawView->AreObjectsMarked()) 504 { 505 rSet.DisableItem(nWhich); 506 } 507 } 508 break; 509 } 510 nWhich = aIter.NextWhich(); 511 } 512 513 SfxItemSet* pSet = NULL; 514 515 if( bAttr ) 516 { 517 pSet = new SfxItemSet( GetDoc()->GetPool() ); 518 mpDrawView->GetAttributes( *pSet ); 519 rSet.Put( *pSet, sal_False ); 520 } 521 522 rSet.Put( aAllSet, sal_False ); 523 524 // Flaechen und/oder Linienattribute wurden geaendert 525 if( bAttr && pSet ) 526 { 527 // Wenn die View selektierte Objekte besitzt, muessen entspr. Items 528 // von SFX_ITEM_DEFAULT (_ON) auf SFX_ITEM_DISABLED geaendert werden 529 if( mpDrawView->AreObjectsMarked() ) 530 { 531 SfxWhichIter aNewIter( *pSet, XATTR_LINE_FIRST, XATTR_FILL_LAST ); 532 nWhich = aNewIter.FirstWhich(); 533 while( nWhich ) 534 { 535 if( SFX_ITEM_DEFAULT == pSet->GetItemState( nWhich ) ) 536 { 537 rSet.ClearItem( nWhich ); 538 rSet.DisableItem( nWhich ); 539 } 540 nWhich = aNewIter.NextWhich(); 541 } 542 } 543 544 SfxItemState eState = pSet->GetItemState( EE_PARA_LRSPACE ); 545 if ( eState == SFX_ITEM_DONTCARE ) 546 { 547 rSet.InvalidateItem(EE_PARA_LRSPACE); 548 rSet.InvalidateItem(SID_ATTR_PARA_LRSPACE); 549 } 550 eState = pSet->GetItemState( EE_PARA_SBL ); 551 if ( eState == SFX_ITEM_DONTCARE ) 552 { 553 rSet.InvalidateItem(EE_PARA_SBL); 554 rSet.InvalidateItem(SID_ATTR_PARA_LINESPACE); 555 } 556 eState = pSet->GetItemState( EE_PARA_ULSPACE ); 557 if ( eState == SFX_ITEM_DONTCARE ) 558 { 559 rSet.InvalidateItem(EE_PARA_ULSPACE); 560 rSet.InvalidateItem(SID_ATTR_PARA_ULSPACE); 561 } 562 563 SvxEscapement eEsc = (SvxEscapement) ( (const SvxEscapementItem&) 564 pSet->Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue(); 565 if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT ) 566 { 567 rSet.Put( SfxBoolItem( SID_SET_SUPER_SCRIPT, sal_True ) ); 568 } 569 else if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT ) 570 { 571 rSet.Put( SfxBoolItem( SID_SET_SUB_SCRIPT, sal_True ) ); 572 } 573 574 eState = pSet->GetItemState( EE_CHAR_KERNING, sal_True ); 575 if ( eState == SFX_ITEM_DONTCARE ) 576 { 577 rSet.InvalidateItem(EE_CHAR_KERNING); 578 rSet.InvalidateItem(SID_ATTR_CHAR_KERNING); 579 } 580 delete pSet; 581 } 582 } 583 584 585 /************************************************************************* 586 |* 587 |* Text der Selektion zurueckgeben 588 |* 589 \************************************************************************/ 590 591 String DrawViewShell::GetSelectionText(sal_Bool bCompleteWords) 592 { 593 String aStrSelection; 594 ::Outliner* pOl = mpDrawView->GetTextEditOutliner(); 595 OutlinerView* pOlView = mpDrawView->GetTextEditOutlinerView(); 596 597 if (pOl && pOlView) 598 { 599 if (bCompleteWords) 600 { 601 ESelection aSel = pOlView->GetSelection(); 602 String aStrCurrentDelimiters = pOl->GetWordDelimiters(); 603 604 pOl->SetWordDelimiters( String( RTL_CONSTASCII_USTRINGPARAM( " .,;\"'" ))); 605 aStrSelection = pOl->GetWord( aSel.nEndPara, aSel.nEndPos ); 606 pOl->SetWordDelimiters( aStrCurrentDelimiters ); 607 } 608 else 609 { 610 aStrSelection = pOlView->GetSelected(); 611 } 612 } 613 614 return (aStrSelection); 615 } 616 617 /************************************************************************* 618 |* 619 |* Ist etwas selektiert? 620 |* 621 \************************************************************************/ 622 623 sal_Bool DrawViewShell::HasSelection(sal_Bool bText) const 624 { 625 sal_Bool bReturn = sal_False; 626 627 if (bText) 628 { 629 OutlinerView* pOlView = mpDrawView->GetTextEditOutlinerView(); 630 631 if (pOlView && pOlView->GetSelected().Len() != 0) 632 { 633 bReturn = sal_True; 634 } 635 } 636 else if (mpDrawView->GetMarkedObjectList().GetMarkCount() != 0) 637 { 638 bReturn = sal_True; 639 } 640 641 return bReturn; 642 } 643 644 } // end of namespace sd 645