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_sw.hxx" 26 27 #include <sot/factory.hxx> 28 #include <hintids.hxx> 29 #include <svl/urihelper.hxx> 30 #include <svl/languageoptions.hxx> 31 32 #include <svx/svxids.hrc> 33 #include <sfx2/linkmgr.hxx> 34 #include <svx/htmlmode.hxx> 35 #include <svx/imapdlg.hxx> 36 #include <sfx2/dispatch.hxx> 37 #include <sfx2/docfile.hxx> 38 #include <sfx2/viewfrm.hxx> 39 #include <sfx2/request.hxx> 40 #include <svl/whiter.hxx> 41 #include <svl/visitem.hxx> 42 #include <sfx2/objitem.hxx> 43 #include <svtools/filter.hxx> 44 #include <svx/gallery.hxx> 45 #include <editeng/langitem.hxx> 46 #include <svx/clipfmtitem.hxx> 47 #include <svx/contdlg.hxx> 48 #include <vcl/graph.hxx> 49 #include <svl/slstitm.hxx> 50 #include <vcl/msgbox.hxx> 51 #include <svl/ptitem.hxx> 52 #include <svl/itemiter.hxx> 53 #include <svl/stritem.hxx> 54 #include <editeng/colritem.hxx> 55 #include <editeng/shaditem.hxx> 56 #include <editeng/boxitem.hxx> 57 #include <svl/srchitem.hxx> 58 #include <editeng/ulspitem.hxx> 59 #include <editeng/lrspitem.hxx> 60 #include <editeng/brshitem.hxx> 61 #include <editeng/opaqitem.hxx> 62 #include <editeng/sizeitem.hxx> 63 #include <svx/flagsdef.hxx> 64 #include <editeng/scripttypeitem.hxx> 65 #include <sfx2/objface.hxx> 66 #include <fmturl.hxx> 67 #include <fmthdft.hxx> 68 #include <fmtclds.hxx> 69 #include <docsh.hxx> 70 #include <wrtsh.hxx> 71 #include <view.hxx> 72 #include <swmodule.hxx> 73 #include <swundo.hxx> 74 #include <fldbas.hxx> 75 #include <uitool.hxx> 76 #include <basesh.hxx> 77 #include <viewopt.hxx> 78 #include <fontcfg.hxx> 79 #include <docstat.hxx> 80 #include <usrfld.hxx> 81 #include <expfld.hxx> 82 #include <fldmgr.hxx> 83 #include <frmmgr.hxx> 84 #include <tablemgr.hxx> 85 #include <mdiexp.hxx> 86 #include <swdtflvr.hxx> 87 #include <pagedesc.hxx> 88 #include <convert.hxx> 89 #include <fmtcol.hxx> 90 #include <edtwin.hxx> 91 #include <tblafmt.hxx> 92 #include <caption.hxx> 93 #include <swwait.hxx> 94 #include <cmdid.h> 95 #include <globals.hrc> 96 #include <shells.hrc> 97 #include <statstr.hrc> 98 #include <globals.h> 99 #include <unotxdoc.hxx> 100 #include <crsskip.hxx> 101 #include <fmtinfmt.hxx> 102 #include <doc.hxx> 103 104 #include "swabstdlg.hxx" 105 #include "dialog.hrc" 106 #include "fldui.hrc" 107 #include "table.hrc" 108 #include <modcfg.hxx> 109 #include <instable.hxx> 110 #include <svx/fmshell.hxx> // for FN_XFORMS_DESIGN_MODE 111 #include <SwRewriter.hxx> 112 #include <comcore.hrc> 113 114 #include <unomid.h> 115 #include <svx/galleryitem.hxx> 116 #include <com/sun/star/gallery/GalleryItemType.hpp> 117 118 FlyMode SwBaseShell::eFrameMode = FLY_DRAG_END; 119 120 121 //Fuer die Erkennung der Id, die variable von Gallery mit SID_GALLERY_BG_BRUSH 122 //ankommt. 123 static sal_uInt8 nParagraphPos; 124 static sal_uInt8 nGraphicPos; 125 static sal_uInt8 nOlePos; 126 static sal_uInt8 nFramePos; 127 static sal_uInt8 nTablePos; 128 static sal_uInt8 nTableRowPos; 129 static sal_uInt8 nTableCellPos; 130 static sal_uInt8 nPagePos; 131 static sal_uInt8 nHeaderPos; 132 static sal_uInt8 nFooterPos; 133 134 #define SwBaseShell 135 #define Shadow 136 #include <sfx2/msg.hxx> 137 #include "swslots.hxx" 138 139 #define SWCONTOURDLG(rView) ( (SvxContourDlg*) ( rView.GetViewFrame()->GetChildWindow( \ 140 SvxContourDlgChildWindow::GetChildWindowId() )-> \ 141 GetWindow() ) ) 142 143 #define SWIMAPDLG(rView) ( (SvxIMapDlg*) ( rView.GetViewFrame()->GetChildWindow( \ 144 SvxIMapDlgChildWindow::GetChildWindowId() )-> \ 145 GetWindow() ) ) 146 147 148 using namespace ::com::sun::star; 149 using namespace ::com::sun::star::uno; 150 using namespace ::com::sun::star::frame; 151 using namespace ::com::sun::star::lang; 152 153 154 SFX_IMPL_INTERFACE(SwBaseShell, SfxShell, SW_RES(0)) 155 { 156 SFX_CHILDWINDOW_REGISTRATION(SvxIMapDlgChildWindow::GetChildWindowId()); 157 SFX_CHILDWINDOW_REGISTRATION(SvxContourDlgChildWindow::GetChildWindowId()); 158 } 159 160 TYPEINIT1(SwBaseShell,SfxShell) 161 162 /*-------------------------------------------------------------------- 163 Beschreibung: statics 164 --------------------------------------------------------------------*/ 165 166 167 void lcl_UpdateIMapDlg( SwWrtShell& rSh ) 168 { 169 Graphic aGrf( rSh.GetIMapGraphic() ); 170 GraphicType nGrfType = aGrf.GetType(); 171 void* pEditObj = GRAPHIC_NONE != nGrfType && GRAPHIC_DEFAULT != nGrfType 172 ? rSh.GetIMapInventor() : 0; 173 TargetList* pList = new TargetList; 174 rSh.GetView().GetViewFrame()->GetTopFrame().GetTargetList(*pList); 175 176 SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL ); 177 rSh.GetFlyFrmAttr( aSet ); 178 const SwFmtURL &rURL = (SwFmtURL&)aSet.Get( RES_URL ); 179 SvxIMapDlgChildWindow::UpdateIMapDlg( 180 aGrf, rURL.GetMap(), pList, pEditObj ); 181 182 sal_uInt16 nCount = (sal_uInt16)pList->Count(); 183 if(nCount) 184 for( sal_uInt16 i = nCount; i; i-- ) 185 { 186 delete pList->GetObject(i-1); 187 } 188 delete pList; 189 } 190 191 192 sal_Bool lcl_UpdateContourDlg( SwWrtShell &rSh, int nSel ) 193 { 194 Graphic aGraf( rSh.GetIMapGraphic() ); 195 GraphicType nGrfType = aGraf.GetType(); 196 sal_Bool bRet = GRAPHIC_NONE != nGrfType && GRAPHIC_DEFAULT != nGrfType; 197 if( bRet ) 198 { 199 String aGrfName; 200 if ( nSel & nsSelectionType::SEL_GRF ) 201 rSh.GetGrfNms( &aGrfName, 0 ); 202 203 SvxContourDlg *pDlg = SWCONTOURDLG(rSh.GetView()); 204 pDlg->Update( aGraf, aGrfName.Len() > 0, 205 rSh.GetGraphicPolygon(), rSh.GetIMapInventor() ); 206 } 207 return bRet; 208 } 209 210 /*-------------------------------------------------------------------- 211 Beschreibung: loeschen 212 --------------------------------------------------------------------*/ 213 214 void SwBaseShell::ExecDelete(SfxRequest &rReq) 215 { 216 SwWrtShell &rSh = GetShell(); 217 SwEditWin& rTmpEditWin = GetView().GetEditWin(); 218 switch(rReq.GetSlot()) 219 { 220 case SID_DELETE: 221 rSh.DelRight(); 222 break; 223 224 case FN_BACKSPACE: 225 226 if( rSh.IsNoNum() ) 227 { 228 rSh.SttCrsrMove(); 229 sal_Bool bLeft = rSh.Left( CRSR_SKIP_CHARS, sal_True, 1, sal_False ); 230 if( bLeft ) 231 { 232 // JP 28.03.96: ein Backspace im Absatz ohne Nummer wird zum Delete 233 //rSh.SwapPam(); 234 //rSh.DelRight( sal_False ); 235 236 rSh.DelLeft(); 237 } 238 else 239 // JP 15.07.96: wenns nicht mehr nach vorne geht, die 240 // Numerierung aufheben. Z.B. am Doc-/ 241 // Rahmen-/Tabellen-/Bereichs-Anfang 242 rSh.DelNumRules(); 243 244 rSh.EndCrsrMove(); 245 break; 246 } 247 248 // ansonsten DelLeft rufen 249 case FN_SHIFT_BACKSPACE: 250 rSh.DelLeft(); 251 break; 252 default: 253 DBG_ERROR("falscher Dispatcher"); 254 return; 255 } 256 rReq.Done(); 257 258 //#i42732# - notify the edit window that from now on we do not use the input language 259 rTmpEditWin.SetUseInputLanguage( sal_False ); 260 } 261 262 /*-------------------------------------------------------------------- 263 Beschreibung: 264 --------------------------------------------------------------------*/ 265 266 void SwBaseShell::ExecClpbrd(SfxRequest &rReq) 267 { 268 //Achtung: Suizid gefaehrdet! Nach Paste, Paste special kann der die 269 //Shell zerstoert sein. 270 271 272 SwWrtShell &rSh = GetShell(); 273 sal_uInt16 nId = rReq.GetSlot(); 274 sal_Bool bIgnore = sal_False; 275 switch( nId ) 276 { 277 case SID_CUT: 278 case SID_COPY: 279 rView.GetEditWin().FlushInBuffer(); 280 if ( rSh.HasSelection() ) 281 { 282 SwTransferable* pTransfer = new SwTransferable( rSh ); 283 /*??*/ uno::Reference< datatransfer::XTransferable > xRef( pTransfer ); 284 285 if ( nId == SID_CUT && !rSh.IsSelObjProtected(FLYPROTECT_CONTENT|FLYPROTECT_PARENT) ) 286 pTransfer->Cut(); 287 else 288 { 289 const sal_Bool bLockedView = rSh.IsViewLocked(); 290 rSh.LockView( sal_True ); //lock visible section 291 pTransfer->Copy(); 292 rSh.LockView( bLockedView ); 293 } 294 break; 295 } 296 return; 297 298 case SID_PASTE: 299 { 300 TransferableDataHelper aDataHelper( 301 TransferableDataHelper::CreateFromSystemClipboard( 302 &rSh.GetView().GetEditWin() ) ); 303 304 if( aDataHelper.GetXTransferable().is() && 305 SwTransferable::IsPaste( rSh, aDataHelper )) 306 { 307 // temp. Variablen, da die Shell nach dem Paste schon 308 // zerstoert sein kann 309 SwView* pView = &rView; 310 SwTransferable::Paste( rSh, aDataHelper ); 311 if( rSh.IsFrmSelected() || rSh.IsObjSelected() ) 312 rSh.EnterSelFrmMode(); 313 pView->AttrChangedNotify( &rSh ); 314 } 315 else 316 return; 317 } 318 break; 319 320 case SID_CLIPBOARD_FORMAT_ITEMS: 321 { 322 const SfxItemSet* pArgs = rReq.GetArgs(); 323 const SfxPoolItem* pFmt; 324 if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( nId, sal_False, &pFmt ) ) 325 { 326 TransferableDataHelper aDataHelper( 327 TransferableDataHelper::CreateFromSystemClipboard( 328 &rSh.GetView().GetEditWin()) ); 329 if( aDataHelper.GetXTransferable().is() 330 /*&& SwTransferable::IsPaste( rSh, aDataHelper )*/ ) 331 { 332 // temp. Variablen, da die Shell nach dem Paste schon 333 // zerstoert sein kann 334 SwView* pView = &rView; 335 336 SwTransferable::PasteFormat( rSh, aDataHelper, 337 ((SfxUInt32Item*)pFmt)->GetValue() ); 338 339 //Done() has to be called before the shell has been removed 340 rReq.Done(); 341 bIgnore = sal_True; 342 if( rSh.IsFrmSelected() || rSh.IsObjSelected()) 343 rSh.EnterSelFrmMode(); 344 pView->AttrChangedNotify( &rSh ); 345 } 346 } 347 } 348 break; 349 350 case SID_PASTE_UNFORMATTED: 351 { 352 TransferableDataHelper aDataHelper( 353 TransferableDataHelper::CreateFromSystemClipboard( 354 &rSh.GetView().GetEditWin()) ); 355 if( aDataHelper.GetXTransferable().is() && 356 SwTransferable::IsPaste( rSh, aDataHelper )) 357 { 358 // temp. Variablen, da die Shell nach dem Paste schon 359 // zerstoert sein kann 360 SwView* pView = &rView; 361 rReq.Ignore(); 362 bIgnore = sal_True; 363 int nRet = SwTransferable::PasteUnformatted( rSh, aDataHelper ); 364 if(nRet)// && rReq.IsRecording() ) 365 { 366 SfxViewFrame* pViewFrame = pView->GetViewFrame(); 367 uno::Reference< frame::XDispatchRecorder > xRecorder = 368 pViewFrame->GetBindings().GetRecorder(); 369 if(xRecorder.is()) { 370 SfxRequest aReq( pViewFrame, SID_CLIPBOARD_FORMAT_ITEMS ); 371 aReq.AppendItem( SfxUInt32Item( SID_CLIPBOARD_FORMAT_ITEMS, SOT_FORMAT_STRING ) ); 372 aReq.Done(); 373 } 374 } 375 376 if (rSh.IsFrmSelected() || rSh.IsObjSelected()) 377 rSh.EnterSelFrmMode(); 378 pView->AttrChangedNotify( &rSh ); 379 } 380 else 381 return; 382 } 383 break; 384 385 case SID_PASTE_SPECIAL: 386 { 387 TransferableDataHelper aDataHelper( 388 TransferableDataHelper::CreateFromSystemClipboard( 389 &rSh.GetView().GetEditWin()) ); 390 if( aDataHelper.GetXTransferable().is() && 391 SwTransferable::IsPaste( rSh, aDataHelper )) 392 { 393 // temp. Variablen, da die Shell nach dem Paste schon 394 // zerstoert sein kann 395 SwView* pView = &rView; 396 sal_uLong nFormatId = 0; 397 rReq.Ignore(); 398 bIgnore = sal_True; 399 int nRet = SwTransferable::PasteSpecial( rSh, aDataHelper, nFormatId ); 400 if(nRet)// && rReq.IsRecording() ) 401 { 402 SfxViewFrame* pViewFrame = pView->GetViewFrame(); 403 uno::Reference< frame::XDispatchRecorder > xRecorder = 404 pViewFrame->GetBindings().GetRecorder(); 405 if(xRecorder.is()) { 406 SfxRequest aReq( pViewFrame, SID_CLIPBOARD_FORMAT_ITEMS ); 407 aReq.AppendItem( SfxUInt32Item( SID_CLIPBOARD_FORMAT_ITEMS, nFormatId ) ); 408 aReq.Done(); 409 } 410 } 411 412 if (rSh.IsFrmSelected() || rSh.IsObjSelected()) 413 rSh.EnterSelFrmMode(); 414 pView->AttrChangedNotify( &rSh ); 415 } 416 else 417 return; 418 } 419 break; 420 default: 421 DBG_ERROR("falscher Dispatcher"); 422 return; 423 } 424 if(!bIgnore) 425 rReq.Done(); 426 } 427 428 /*-------------------------------------------------------------------- 429 Beschreibung: ClipBoard-Status 430 --------------------------------------------------------------------*/ 431 432 void SwBaseShell::StateClpbrd(SfxItemSet &rSet) 433 { 434 SwWrtShell &rSh = GetShell(); 435 SfxWhichIter aIter(rSet); 436 437 const sal_Bool bCopy = rSh.HasSelection(); 438 439 sal_uInt16 nWhich = aIter.FirstWhich(); 440 441 while(nWhich) 442 { 443 switch(nWhich) 444 { 445 case SID_CUT: 446 if( 0 != rSh.IsSelObjProtected(FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) ) 447 { 448 rSet.DisableItem( nWhich ); 449 break; 450 } 451 case SID_COPY: 452 if( !bCopy ) 453 rSet.DisableItem( nWhich ); 454 break; 455 456 case SID_PASTE: 457 if( !GetView().IsPasteAllowed() ) 458 rSet.DisableItem( SID_PASTE ); 459 break; 460 461 case SID_PASTE_SPECIAL: 462 if( !GetView().IsPasteSpecialAllowed() ) 463 { 464 rSet.DisableItem( SID_PASTE_SPECIAL ); 465 rSet.DisableItem( SID_PASTE_UNFORMATTED ); 466 } 467 break; 468 469 case SID_CLIPBOARD_FORMAT_ITEMS: 470 { 471 TransferableDataHelper aDataHelper( 472 TransferableDataHelper::CreateFromSystemClipboard( 473 &rSh.GetView().GetEditWin()) ); 474 475 SvxClipboardFmtItem aFmtItem( nWhich ); 476 SwTransferable::FillClipFmtItem( rSh, aDataHelper, aFmtItem ); 477 rSet.Put( aFmtItem ); 478 } 479 break; 480 } 481 nWhich = aIter.NextWhich(); 482 } 483 } 484 485 /*-------------------------------------------------------------------- 486 Beschreibung: Undo ausfuehren 487 --------------------------------------------------------------------*/ 488 489 void SwBaseShell::ExecUndo(SfxRequest &rReq) 490 { 491 SwWrtShell &rSh = GetShell(); 492 493 sal_uInt16 nId = rReq.GetSlot(), nCnt = 1; 494 const SfxItemSet* pArgs = rReq.GetArgs(); 495 const SfxPoolItem* pItem; 496 if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( nId, sal_False, &pItem )) 497 nCnt = ((SfxUInt16Item*)pItem)->GetValue(); 498 499 // #i106349#: save pointer: undo/redo may delete the shell, i.e., this! 500 SfxViewFrame *const pViewFrame( GetView().GetViewFrame() ); 501 502 switch( nId ) 503 { 504 case SID_UNDO: 505 rSh.LockPaint(); 506 rSh.Do( SwWrtShell::UNDO, nCnt ); 507 rSh.UnlockPaint(); 508 break; 509 510 case SID_REDO: 511 rSh.LockPaint(); 512 rSh.Do( SwWrtShell::REDO, nCnt ); 513 rSh.UnlockPaint(); 514 break; 515 516 case SID_REPEAT: 517 rSh.Do( SwWrtShell::REPEAT ); 518 break; 519 default: 520 DBG_ERROR("falscher Dispatcher"); 521 } 522 523 if (pViewFrame) { pViewFrame->GetBindings().InvalidateAll(sal_False); } 524 } 525 526 /*-------------------------------------------------------------------- 527 Beschreibung: Zustand Undo 528 --------------------------------------------------------------------*/ 529 530 void SwBaseShell::StateUndo(SfxItemSet &rSet) 531 { 532 SwWrtShell &rSh = GetShell(); 533 SfxWhichIter aIter(rSet); 534 sal_uInt16 nWhich = aIter.FirstWhich(); 535 while(nWhich) 536 { 537 switch(nWhich) 538 { 539 case SID_UNDO: 540 { 541 if (rSh.GetLastUndoInfo(0, 0)) 542 { 543 rSet.Put( SfxStringItem(nWhich, 544 rSh.GetDoString(SwWrtShell::UNDO))); 545 } 546 else 547 rSet.DisableItem(nWhich); 548 break; 549 } 550 case SID_REDO: 551 { 552 if (rSh.GetFirstRedoInfo(0)) 553 { 554 rSet.Put(SfxStringItem(nWhich, 555 rSh.GetDoString(SwWrtShell::REDO))); 556 } 557 else 558 rSet.DisableItem(nWhich); 559 break; 560 } 561 case SID_REPEAT: 562 { // Repeat nur moeglich wenn kein REDO moeglich - UI-Restriktion 563 if ((!rSh.GetFirstRedoInfo(0)) && 564 !rSh.IsSelFrmMode() && 565 (UNDO_EMPTY != rSh.GetRepeatInfo(0))) 566 { 567 rSet.Put(SfxStringItem(nWhich, rSh.GetRepeatString())); 568 } 569 else 570 rSet.DisableItem(nWhich); 571 break; 572 } 573 574 case SID_GETUNDOSTRINGS: 575 if (rSh.GetLastUndoInfo(0, 0)) 576 { 577 SfxStringListItem aStrLst( nWhich ); 578 rSh.GetDoStrings( SwWrtShell::UNDO, aStrLst ); 579 rSet.Put( aStrLst ); 580 } 581 else 582 rSet.DisableItem( nWhich ); 583 break; 584 585 case SID_GETREDOSTRINGS: 586 if (rSh.GetFirstRedoInfo(0)) 587 { 588 SfxStringListItem aStrLst( nWhich ); 589 rSh.GetDoStrings( SwWrtShell::REDO, aStrLst ); 590 rSet.Put( aStrLst ); 591 } 592 else 593 rSet.DisableItem( nWhich ); 594 break; 595 } 596 nWhich = aIter.NextWhich(); 597 } 598 } 599 600 /*-------------------------------------------------------------------- 601 Beschreibung: Slot-Id auswerten bzw. Dispatchen 602 --------------------------------------------------------------------*/ 603 604 void SwBaseShell::Execute(SfxRequest &rReq) 605 { 606 const SfxPoolItem *pItem; 607 SwWrtShell &rSh = GetShell(); 608 const SfxItemSet* pArgs = rReq.GetArgs(); 609 sal_Bool bMore = sal_False; 610 611 sal_uInt16 nSlot = rReq.GetSlot(); 612 switch(nSlot) 613 { 614 case FN_REPAGINATE: 615 { 616 Reference < XModel > xModel = GetView().GetDocShell()->GetModel(); 617 Reference < XUnoTunnel > xDocTunnel ( xModel, UNO_QUERY ); 618 SwXTextDocument *pDoc = reinterpret_cast < SwXTextDocument * > ( xDocTunnel->getSomething ( SwXTextDocument::getUnoTunnelId() ) ); 619 pDoc->notifyRefreshListeners(); 620 rSh.CalcLayout(); 621 } 622 break; 623 case FN_UPDATE_FIELDS: 624 { 625 SwDocStat aDocStat; 626 rSh.UpdateDocStat(aDocStat); 627 rSh.EndAllTblBoxEdit(); 628 rSh.ViewShell::UpdateFlds(sal_True); 629 630 if( rSh.IsCrsrInTbl() ) 631 { 632 if( !rSh.IsTblComplexForChart() ) 633 SwTableFUNC( &rSh, sal_False).UpdateChart(); 634 rSh.ClearTblBoxCntnt(); 635 rSh.SaveTblBoxCntnt(); 636 } 637 } 638 break; 639 case FN_UPDATE_CHARTS: 640 { 641 SwWait aWait( *rView.GetDocShell(), sal_True ); 642 rSh.UpdateAllCharts(); 643 } 644 break; 645 646 case FN_UPDATE_ALL: 647 { 648 SwView& rTempView = GetView(); 649 rSh.EnterStdMode(); 650 if( rSh.GetLinkManager().GetLinks().Count() ) 651 { 652 rSh.StartAllAction(); 653 rSh.GetLinkManager().UpdateAllLinks( sal_False, sal_True, sal_True ); 654 rSh.EndAllAction(); 655 } 656 SfxDispatcher &rDis = *rTempView.GetViewFrame()->GetDispatcher(); 657 rDis.Execute( FN_UPDATE_FIELDS ); 658 rDis.Execute( FN_UPDATE_TOX ); 659 rDis.Execute( FN_UPDATE_CHARTS ); 660 rSh.CalcLayout(); 661 } 662 break; 663 664 case FN_UPDATE_INPUTFIELDS: 665 rSh.UpdateInputFlds(NULL, sal_False); 666 break; 667 case FN_PREV_BOOKMARK: 668 rReq.SetReturnValue(SfxBoolItem( nSlot, rSh.GoPrevBookmark())); 669 break; 670 case FN_NEXT_BOOKMARK: 671 rReq.SetReturnValue(SfxBoolItem( nSlot, rSh.GoNextBookmark())); 672 break; 673 674 case FN_GOTO_NEXT_MARK: 675 case FN_GOTO_PREV_MARK: 676 { 677 SwFldMgr aFldMgr; 678 SwFieldType* pFldType = aFldMgr.GetFldType(RES_JUMPEDITFLD); 679 680 if (pFldType) 681 { 682 if (rSh.IsSelFrmMode()) 683 { 684 rSh.UnSelectFrm(); 685 rSh.LeaveSelFrmMode(); 686 } 687 688 if (rSh.HasMark()) 689 { 690 MV_KONTEXT(&rSh); 691 if (rSh.IsCrsrPtAtEnd()) 692 rSh.SwapPam(); 693 rSh.ClearMark(); 694 rSh.EndSelect(); 695 } 696 sal_Bool bRet = rSh.MoveFldType(pFldType, nSlot == FN_GOTO_NEXT_MARK); 697 SwField* pCurField = bRet ? rSh.GetCurFld() : 0; 698 if (pCurField) 699 rSh.ClickToField(*pCurField); 700 rReq.SetReturnValue(SfxBoolItem( nSlot, bRet)); 701 } 702 } 703 break; 704 705 case FN_START_DOC_DIRECT: 706 case FN_END_DOC_DIRECT: 707 { 708 if (rSh.IsSelFrmMode()) 709 { 710 rSh.UnSelectFrm(); 711 rSh.LeaveSelFrmMode(); 712 } 713 rSh.EnterStdMode(); 714 nSlot == FN_START_DOC_DIRECT ? 715 rSh.SttEndDoc(sal_True) : 716 rSh.SttEndDoc(sal_False); 717 } 718 break; 719 case FN_GOTO_PREV_OBJ: 720 case FN_GOTO_NEXT_OBJ: 721 { 722 sal_Bool bSuccess = rSh.GotoObj( 723 nSlot == FN_GOTO_NEXT_OBJ ? sal_True : sal_False); 724 rReq.SetReturnValue(SfxBoolItem(nSlot, bSuccess)); 725 if (bSuccess && !rSh.IsSelFrmMode()) 726 { 727 rSh.HideCrsr(); 728 rSh.EnterSelFrmMode(); 729 GetView().AttrChangedNotify( &rSh ); 730 } 731 } 732 break; 733 case SID_GALLERY_FORMATS: 734 { 735 SFX_ITEMSET_ARG( pArgs, pGalleryItem, SvxGalleryItem, SID_GALLERY_FORMATS, sal_False ); 736 if ( !pGalleryItem ) 737 break; 738 739 const int nSelType = rSh.GetSelectionType(); 740 sal_Int8 nGalleryItemType( pGalleryItem->GetType() ); 741 742 if ( (!rSh.IsSelFrmMode() || nSelType & nsSelectionType::SEL_GRF) && 743 nGalleryItemType == com::sun::star::gallery::GalleryItemType::GRAPHIC ) 744 { 745 SwWait aWait( *rView.GetDocShell(), sal_True ); 746 747 String aGrfName, aFltName; 748 const Graphic aGrf( pGalleryItem->GetGraphic() ); 749 750 if( pGalleryItem->IsLink() ) 751 { 752 // Verknuepft 753 aGrfName = pGalleryItem->GetURL(); 754 aFltName = pGalleryItem->GetFilterName(); 755 } 756 757 if ( nSelType & nsSelectionType::SEL_GRF ) 758 rSh.ReRead( aGrfName, aFltName, &aGrf ); 759 else 760 rSh.Insert( aGrfName, aFltName, aGrf ); 761 762 GetView().GetEditWin().GrabFocus(); 763 } 764 else if(!rSh.IsSelFrmMode() && 765 nGalleryItemType == com::sun::star::gallery::GalleryItemType::MEDIA ) 766 { 767 const SfxStringItem aMediaURLItem( SID_INSERT_AVMEDIA, pGalleryItem->GetURL() ); 768 GetView().GetViewFrame()->GetDispatcher()->Execute( SID_INSERT_AVMEDIA, SFX_CALLMODE_SYNCHRON, &aMediaURLItem, 0L ); 769 /* 770 String sURL( pGalleryItem->GetURL().GetMainURL( INetURLObject::NO_DECODE ) ); 771 String sLabel( pGalleryItem->GetURL().getBase() ); 772 String sTarget; // empty string! 773 774 bool bIsHTMLMode = 775 0 == ( HTMLMODE_ON & 776 ::GetHtmlMode( GetView().GetDocShell() ) ); 777 778 // in Writer, we insert a button which plays the 779 // sound. In Writer/Web, we just insert a (text) link. 780 if( bIsHTMLMode ) 781 InsertURLButton( sURL, sTarget, sLabel ); 782 else 783 rSh.InsertURL( SwFmtINetFmt( sURL, sTarget ), sLabel ); 784 */ 785 } 786 } 787 break; 788 case FN_PAGE_STYLE_SET_COLS: 789 { 790 if (pArgs) 791 { 792 // aktuellen PageDescriptor ermitteln und damit den Set fuellen 793 const sal_uInt16 nCurIdx = rSh.GetCurPageDesc(); 794 SwPageDesc aPageDesc(rSh.GetPageDesc(nCurIdx)); 795 796 SwFrmFmt &rFmt = aPageDesc.GetMaster(); 797 798 SwFmtCol aFmtCol = rFmt.GetCol(); 799 800 sal_uInt16 nCount; 801 if(SFX_ITEM_SET == pArgs->GetItemState(nSlot)) 802 nCount = ((SfxUInt16Item &)pArgs->Get(nSlot)).GetValue(); 803 else 804 nCount = ((SfxUInt16Item &)pArgs->Get(SID_ATTR_COLUMNS)).GetValue(); 805 sal_uInt16 nGutterWidth = DEF_GUTTER_WIDTH; 806 807 aFmtCol.Init(nCount ? nCount : 1, nGutterWidth, USHRT_MAX); 808 aFmtCol.SetWishWidth(USHRT_MAX); 809 aFmtCol.SetGutterWidth(nGutterWidth, USHRT_MAX); 810 811 rFmt.SetFmtAttr(aFmtCol); 812 813 rSh.ChgPageDesc(nCurIdx, aPageDesc); 814 } 815 else 816 GetView().GetViewFrame()->GetDispatcher()->Execute(FN_FORMAT_PAGE_COLUMN_DLG, sal_False); 817 } 818 break; 819 case FN_CONVERT_TABLE_TO_TEXT: 820 case FN_CONVERT_TEXT_TO_TABLE: 821 case FN_CONVERT_TEXT_TABLE: 822 { 823 sal_Unicode cDelim = 0; 824 bool bToTable = false; 825 if( nSlot == FN_CONVERT_TEXT_TO_TABLE || 826 ( nSlot == FN_CONVERT_TEXT_TABLE && 0 == rSh.GetTableFmt() )) 827 bToTable = true; 828 SwInsertTableOptions aInsTblOpts( tabopts::ALL_TBL_INS_ATTR, 1 ); 829 SwTableAutoFmt* pTAFmt = 0; 830 SwTableAutoFmtTbl* pAutoFmtTbl = 0; 831 bool bDeleteFormat = true; 832 if(pArgs && SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_1, sal_True, &pItem)) 833 { 834 aInsTblOpts.mnInsMode = 0; 835 //Delimiter 836 String sDelim = static_cast< const SfxStringItem* >(pItem)->GetValue(); 837 if(sDelim.Len()) 838 cDelim = sDelim.GetChar(0); 839 //AutoFormat 840 if(SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_2, sal_True, &pItem)) 841 { 842 String sAutoFmt = static_cast< const SfxStringItem* >(pItem)->GetValue(); 843 844 pAutoFmtTbl = new SwTableAutoFmtTbl; 845 pAutoFmtTbl->Load(); 846 847 for( sal_uInt16 i = 0, nCount = pAutoFmtTbl->Count(); i < nCount; i++ ) 848 { 849 SwTableAutoFmt* pFmt = (*pAutoFmtTbl)[ i ]; 850 if( pFmt->GetName() == sAutoFmt ) 851 { 852 pTAFmt = pFmt; 853 bDeleteFormat = false; 854 break; 855 } 856 } 857 } 858 //WithHeader 859 if(SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_3, sal_True, &pItem) && 860 static_cast< const SfxBoolItem* >(pItem)->GetValue()) 861 aInsTblOpts.mnInsMode |= tabopts::HEADLINE; 862 // RepeatHeaderLines 863 if(SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_4, sal_True, &pItem)) 864 aInsTblOpts.mnRowsToRepeat = 865 (sal_uInt16)static_cast< const SfxInt16Item* >(pItem)->GetValue(); 866 //WithBorder 867 if(SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_5, sal_True, &pItem) && 868 static_cast< const SfxBoolItem* >(pItem)->GetValue()) 869 aInsTblOpts.mnInsMode |= tabopts::DEFAULT_BORDER; 870 //DontSplitTable 871 if(SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_6, sal_True, &pItem) && 872 !static_cast< const SfxBoolItem* >(pItem)->GetValue() ) 873 aInsTblOpts.mnInsMode |= tabopts::SPLIT_LAYOUT; 874 } 875 else 876 { 877 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 878 DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); 879 880 AbstractSwConvertTableDlg* pDlg = pFact->CreateSwConvertTableDlg( 881 GetView(),DLG_CONV_TEXT_TABLE , bToTable); 882 DBG_ASSERT(pDlg, "Dialogdiet fail!"); 883 if( RET_OK == pDlg->Execute() ) 884 { 885 pDlg->GetValues( cDelim, aInsTblOpts, pTAFmt ); 886 887 } 888 delete pDlg; 889 } 890 891 if( cDelim ) 892 { 893 //Shellwechsel! 894 SwView& rSaveView = rView; 895 sal_Bool bInserted = sal_False; 896 //recording: 897 898 SfxViewFrame* pViewFrame = GetView().GetViewFrame(); 899 if( SfxRequest::HasMacroRecorder(pViewFrame) ) 900 { 901 SfxRequest aReq( pViewFrame, nSlot); 902 aReq.AppendItem( SfxStringItem( FN_PARAM_1, String(cDelim) )); 903 if(bToTable) 904 { 905 if(pTAFmt) 906 aReq.AppendItem( SfxStringItem( FN_PARAM_2, pTAFmt->GetName())); 907 aReq.AppendItem( SfxBoolItem ( FN_PARAM_3, 0 != (aInsTblOpts.mnInsMode & tabopts::HEADLINE))); 908 aReq.AppendItem( SfxInt16Item( FN_PARAM_4, (short)aInsTblOpts.mnRowsToRepeat )); 909 aReq.AppendItem( SfxBoolItem ( FN_PARAM_5, 0 != (aInsTblOpts.mnInsMode & tabopts::DEFAULT_BORDER) )); 910 aReq.AppendItem( SfxBoolItem ( FN_PARAM_6, !(aInsTblOpts.mnInsMode & tabopts::SPLIT_LAYOUT))); 911 } 912 aReq.Done(); 913 } 914 915 if( !bToTable ) 916 rSh.TableToText( cDelim ); 917 else 918 { 919 bInserted = rSh.TextToTable( aInsTblOpts, cDelim, text::HoriOrientation::FULL, pTAFmt ); 920 } 921 rSh.EnterStdMode(); 922 923 if( bInserted ) 924 rSaveView.AutoCaption( TABLE_CAP ); 925 } 926 if(bDeleteFormat) 927 delete pTAFmt; 928 delete pAutoFmtTbl; 929 } 930 break; 931 case SID_STYLE_WATERCAN: 932 case SID_STYLE_UPDATE_BY_EXAMPLE: 933 case SID_STYLE_NEW_BY_EXAMPLE: 934 case SID_STYLE_APPLY: 935 { 936 ShellModes eMode = GetView().GetShellMode(); 937 if ( SHELL_MODE_DRAW != eMode && 938 SHELL_MODE_DRAW_CTRL != eMode && 939 SHELL_MODE_DRAW_FORM != eMode && 940 SHELL_MODE_DRAWTEXT != eMode && 941 SHELL_MODE_BEZIER != eMode ) 942 { 943 // oj #107754# 944 if ( SID_STYLE_WATERCAN == nSlot ) 945 { 946 const sal_Bool bLockedView = rSh.IsViewLocked(); 947 rSh.LockView( sal_True ); //lock visible section 948 949 GetView().GetDocShell()->ExecStyleSheet(rReq); 950 951 rSh.LockView( bLockedView ); 952 } 953 else 954 // wird von der DocShell aufgezeichnet 955 GetView().GetDocShell()->ExecStyleSheet(rReq); 956 } 957 } 958 break; 959 case FN_ESCAPE: 960 GetView().ExecuteSlot(rReq); 961 break; 962 case SID_IMAP: 963 { 964 sal_uInt16 nId = SvxIMapDlgChildWindow::GetChildWindowId(); 965 966 SfxViewFrame* pVFrame = GetView().GetViewFrame(); 967 pVFrame->ToggleChildWindow( nId ); 968 pVFrame->GetBindings().Invalidate( SID_IMAP ); 969 970 if ( pVFrame->HasChildWindow( nId ) && rSh.IsFrmSelected() ) 971 lcl_UpdateIMapDlg( rSh ); 972 } 973 break; 974 case SID_IMAP_EXEC: 975 { 976 SvxIMapDlg* pDlg = SWIMAPDLG(GetView()); 977 978 // Kontrolle, ob Zuweisung ueberhaupt sinnvoll/erlaubt 979 if ( rSh.IsFrmSelected() && 980 pDlg->GetEditingObject() == rSh.GetIMapInventor() ) 981 { 982 SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL ); 983 rSh.GetFlyFrmAttr( aSet ); 984 SwFmtURL aURL( (SwFmtURL&)aSet.Get( RES_URL ) ); 985 aURL.SetMap( &pDlg->GetImageMap() ); 986 aSet.Put( aURL ); 987 rSh.SetFlyFrmAttr( aSet ); 988 } 989 } 990 break; 991 case SID_CONTOUR_DLG: 992 { 993 sal_uInt16 nId = SvxContourDlgChildWindow::GetChildWindowId(); 994 995 SfxViewFrame* pVFrame = GetView().GetViewFrame(); 996 pVFrame->ToggleChildWindow( nId ); 997 pVFrame->GetBindings().Invalidate( SID_CONTOUR_DLG ); 998 999 int nSel = rSh.GetSelectionType(); 1000 if ( pVFrame->HasChildWindow( nId ) && 1001 (nSel & (nsSelectionType::SEL_GRF|nsSelectionType::SEL_OLE)) ) 1002 { 1003 lcl_UpdateContourDlg( rSh, nSel ); 1004 } 1005 } 1006 break; 1007 case SID_CONTOUR_EXEC: 1008 { 1009 SvxContourDlg *pDlg = SWCONTOURDLG(GetView()); 1010 1011 // Kontrolle, ob Zuweisung ueberhaupt sinnvoll/erlaubt 1012 int nSel = rSh.GetSelectionType(); 1013 if ( nSel & (nsSelectionType::SEL_GRF|nsSelectionType::SEL_OLE) ) 1014 { 1015 if ( pDlg->GetEditingObject() == rSh.GetIMapInventor() ) 1016 { 1017 rSh.StartAction(); 1018 SfxItemSet aSet( rSh.GetAttrPool(), RES_SURROUND, RES_SURROUND); 1019 rSh.GetFlyFrmAttr( aSet ); 1020 SwFmtSurround aSur( (SwFmtSurround&)aSet.Get( RES_SURROUND ) ); 1021 if ( !aSur.IsContour() ) 1022 { 1023 aSur.SetContour( sal_True ); 1024 if ( aSur.GetSurround() == SURROUND_NONE ) 1025 aSur.SetSurround( SURROUND_PARALLEL ); 1026 aSet.Put( aSur ); 1027 rSh.SetFlyFrmAttr( aSet ); 1028 } 1029 const PolyPolygon aPoly( pDlg->GetPolyPolygon() ); 1030 rSh.SetGraphicPolygon( &aPoly ); 1031 if ( pDlg->IsGraphicChanged() ) 1032 rSh.ReRead( aEmptyStr, aEmptyStr, &pDlg->GetGraphic()); 1033 rSh.EndAction(); 1034 } 1035 } 1036 } 1037 break; 1038 case FN_FRAME_TO_ANCHOR: 1039 { 1040 rSh.GotoFlyAnchor(); 1041 rSh.EnterStdMode(); 1042 rSh.CallChgLnk(); 1043 } 1044 break; 1045 case FN_TOOL_ANKER: 1046 break; 1047 case FN_TOOL_ANKER_PAGE: 1048 case FN_TOOL_ANKER_PARAGRAPH: 1049 case FN_TOOL_ANKER_CHAR: 1050 case FN_TOOL_ANKER_AT_CHAR: 1051 case FN_TOOL_ANKER_FRAME: 1052 { 1053 RndStdIds eSet = nSlot == FN_TOOL_ANKER_PAGE 1054 ? FLY_AT_PAGE 1055 : nSlot == FN_TOOL_ANKER_PARAGRAPH 1056 ? FLY_AT_PARA 1057 : nSlot == FN_TOOL_ANKER_FRAME 1058 ? FLY_AT_FLY 1059 : nSlot == FN_TOOL_ANKER_CHAR 1060 ? FLY_AS_CHAR 1061 : FLY_AT_CHAR; 1062 rSh.StartUndo(); 1063 if( rSh.IsObjSelected() ) 1064 rSh.ChgAnchor( eSet ); 1065 else if( rSh.IsFrmSelected() ) 1066 { 1067 // Der Set beinhaltet auch VERT/HORI_ORIENT, da in FEShell:: 1068 // SetFlyFrmAttr/SetFlyFrmAnchor ggf. als Folge des Umankerns 1069 // die Ausrichtungen veraendert werden sollen. 1070 SfxItemSet aSet( GetPool(), RES_VERT_ORIENT, RES_ANCHOR ); 1071 SwFmtAnchor aAnc( eSet, rSh.GetPhyPageNum() ); 1072 aSet.Put( aAnc ); 1073 rSh.SetFlyFrmAttr(aSet); 1074 } 1075 1076 // if new anchor is 'as char' and it is a Math object and the usual 1077 // pre-conditions are met then align the formula to the baseline of the text 1078 const uno::Reference < embed::XEmbeddedObject > xObj( rSh.GetOleRef() ); 1079 const bool bDoMathBaselineAlignment = xObj.is() && SotExchange::IsMath( xObj->getClassID() ) 1080 && FLY_AS_CHAR == eSet && rSh.GetDoc()->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT ); 1081 if (bDoMathBaselineAlignment) 1082 rSh.AlignFormulaToBaseline( xObj ); 1083 1084 sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell()); 1085 if( nHtmlMode ) 1086 { 1087 SfxItemSet aSet(GetPool(), RES_SURROUND, RES_HORI_ORIENT); 1088 rSh.GetFlyFrmAttr(aSet); 1089 1090 const SwFmtSurround& rSurround = (const SwFmtSurround&)aSet.Get(RES_SURROUND); 1091 const SwFmtVertOrient& rVert = (const SwFmtVertOrient&)aSet.Get(RES_VERT_ORIENT); 1092 const SwFmtHoriOrient& rHori = (const SwFmtHoriOrient&)aSet.Get(RES_HORI_ORIENT); 1093 sal_Int16 eVOrient = rVert.GetVertOrient(); 1094 sal_Int16 eHOrient = rHori.GetHoriOrient(); 1095 SwSurround eSurround = rSurround.GetSurround(); 1096 1097 switch( eSet ) 1098 { 1099 case FLY_AT_FLY: 1100 case FLY_AT_PAGE: 1101 1102 //Durchlauf, links oder von links, oben, von oben 1103 if(eSurround != SURROUND_THROUGHT) 1104 aSet.Put(SwFmtSurround(SURROUND_THROUGHT)); 1105 1106 if( eVOrient != text::VertOrientation::TOP && eVOrient != text::VertOrientation::NONE) 1107 aSet.Put(SwFmtVertOrient(0, text::VertOrientation::TOP)); 1108 1109 if(eHOrient != text::HoriOrientation::NONE || eHOrient != text::HoriOrientation::LEFT) 1110 aSet.Put(SwFmtHoriOrient(0, text::HoriOrientation::LEFT)); 1111 break; 1112 1113 case FLY_AT_PARA: 1114 //links, von links, rechts, oben, kein Uml, li+re Umlauf, 1115 if(eSurround != SURROUND_LEFT || eSurround != SURROUND_RIGHT) 1116 aSet.Put(SwFmtSurround(SURROUND_LEFT)); 1117 1118 if( eVOrient != text::VertOrientation::TOP) 1119 aSet.Put(SwFmtVertOrient(0, text::VertOrientation::TOP)); 1120 1121 if(eHOrient != text::HoriOrientation::NONE || eHOrient != text::HoriOrientation::LEFT || eHOrient != text::HoriOrientation::RIGHT) 1122 aSet.Put(SwFmtHoriOrient(0, text::HoriOrientation::LEFT)); 1123 break; 1124 1125 case FLY_AT_CHAR: 1126 //links, von links, rechts, oben, Durchlauf 1127 if(eSurround != SURROUND_THROUGHT) 1128 aSet.Put(SwFmtSurround(SURROUND_THROUGHT)); 1129 1130 if( eVOrient != text::VertOrientation::TOP) 1131 aSet.Put(SwFmtVertOrient(0, text::VertOrientation::TOP)); 1132 1133 if(eHOrient != text::HoriOrientation::NONE || eHOrient != text::HoriOrientation::LEFT || eHOrient != text::HoriOrientation::RIGHT) 1134 aSet.Put(SwFmtHoriOrient(0, text::HoriOrientation::LEFT)); 1135 break; 1136 1137 default: 1138 ; 1139 } 1140 1141 if( aSet.Count() ) 1142 rSh.SetFlyFrmAttr( aSet ); 1143 } 1144 rSh.EndUndo(); 1145 1146 GetView().GetViewFrame()->GetBindings().Invalidate( FN_TOOL_ANKER ); 1147 } 1148 break; 1149 1150 case FN_FRAME_NOWRAP: 1151 case FN_FRAME_WRAP: 1152 case FN_FRAME_WRAP_IDEAL: 1153 case FN_FRAME_WRAPTHRU: 1154 case FN_FRAME_WRAPTHRU_TRANSP: 1155 case FN_FRAME_WRAP_CONTOUR: 1156 case FN_WRAP_ANCHOR_ONLY: 1157 case FN_FRAME_WRAP_LEFT: 1158 case FN_FRAME_WRAP_RIGHT: 1159 SetWrapMode( nSlot ); 1160 break; 1161 1162 case FN_UPDATE_ALL_LINKS: 1163 { 1164 if( rSh.GetLinkManager().GetLinks().Count() ) 1165 { 1166 sal_Bool bUpdateGrf = sal_False, bCallErrHdl = sal_False; 1167 rSh.EnterStdMode(); 1168 rSh.StartAllAction(); 1169 rSh.GetLinkManager().UpdateAllLinks( sal_False, bCallErrHdl, bUpdateGrf ); 1170 rSh.EndAllAction(); 1171 } 1172 } 1173 break; 1174 1175 case FN_XFORMS_DESIGN_MODE: 1176 if( pArgs != NULL 1177 && pArgs->GetItemState( nSlot, sal_True, &pItem ) == SFX_ITEM_SET 1178 && pItem != NULL 1179 && pItem->ISA( SfxBoolItem ) ) 1180 { 1181 sal_Bool bDesignMode = 1182 static_cast<const SfxBoolItem*>( pItem )->GetValue(); 1183 1184 // set form design mode 1185 DBG_ASSERT( GetView().GetFormShell() != NULL, "form shell?" ); 1186 SfxRequest aReq( GetView().GetViewFrame(), SID_FM_DESIGN_MODE ); 1187 aReq.AppendItem( SfxBoolItem( SID_FM_DESIGN_MODE, bDesignMode ) ); 1188 GetView().GetFormShell()->Execute( aReq ); 1189 aReq.Done(); 1190 1191 // also set suitable view options 1192 SwViewOption aViewOption = *rSh.GetViewOptions(); 1193 aViewOption.SetFormView( ! bDesignMode ); 1194 rSh.ApplyViewOptions( aViewOption ); 1195 } 1196 break; 1197 1198 default: 1199 bMore = sal_True; 1200 } 1201 if(bMore && pArgs) 1202 { 1203 pItem = 0; 1204 pArgs->GetItemState(GetPool().GetWhich(nSlot), sal_False, &pItem); 1205 if(pItem) 1206 switch(nSlot) 1207 { 1208 case SID_ATTR_BRUSH: 1209 case SID_ATTR_BORDER_SHADOW: 1210 case RES_SHADOW: 1211 { 1212 rSh.StartAllAction(); 1213 SfxItemSet aSet( rSh.GetAttrPool(), 1214 RES_SHADOW, RES_SHADOW, 1215 RES_BACKGROUND, RES_BACKGROUND, 0 ); 1216 1217 aSet.Put(*pItem); 1218 // Tabellenzelle(n) selektiert? 1219 if ( rSh.IsTableMode() ) 1220 { 1221 SwFrmFmt *pFmt = rSh.GetTableFmt(); 1222 pFmt->SetFmtAttr( *pItem ); 1223 } 1224 else if ( rSh.IsFrmSelected() ) 1225 { 1226 // Umrandungsattribute ueber Frame-Manager setzen 1227 SwFlyFrmAttrMgr aMgr( sal_False, &rSh, FRMMGR_TYPE_NONE ); 1228 aMgr.SetAttrSet( *pArgs ); 1229 aMgr.UpdateFlyFrm(); 1230 } 1231 else 1232 { 1233 rSh.SetAttr( *pArgs ); 1234 } 1235 rSh.EndAllAction(); 1236 } 1237 break; 1238 case FN_PAGE_STYLE_SET_LR_MARGIN: 1239 case FN_PAGE_STYLE_SET_UL_MARGIN: 1240 case FN_PAGE_STYLE_SET_NUMBER_FORMAT: 1241 case FN_PAGE_STYLE_SET_PAPER_SIZE: 1242 case FN_PAGE_STYLE_SET_PAPER_BIN: 1243 { 1244 DBG_ERROR("not implemented"); 1245 } 1246 break; 1247 1248 case SID_ATTR_BORDER_OUTER: 1249 { 1250 // Tabellenzelle(n) selektiert? 1251 if ( rSh.IsTableMode() ) 1252 { 1253 // Umrandungattribute Get/SetTabBorders() setzen 1254 rSh.SetTabBorders(*pArgs); 1255 } 1256 else if ( rSh.IsFrmSelected() ) 1257 { 1258 // Umrandungsattribute ueber Frame-Manager setzen 1259 SwFlyFrmAttrMgr aMgr( sal_False, &rSh, FRMMGR_TYPE_NONE ); 1260 aMgr.SetAttrSet(*pArgs); 1261 aMgr.UpdateFlyFrm(); 1262 } 1263 else 1264 { 1265 // Umrandungsattribute ganz normal ueber Shell setzen 1266 rSh.SetAttr( *pItem ); 1267 } 1268 } 1269 break; 1270 default: 1271 DBG_ERROR("falscher Dispatcher"); 1272 } 1273 1274 } 1275 } 1276 1277 /* -----------------14.04.99 15:10------------------- 1278 * Hier wird der State fuer SID_IMAP / SID_CONTOUR behandelt, 1279 * wenn die Grafik ausgeswappt ist 1280 * --------------------------------------------------*/ 1281 IMPL_LINK(SwBaseShell, GraphicArrivedHdl, SwCrsrShell* , EMPTYARG ) 1282 { 1283 sal_uInt16 nGrfType; 1284 SwWrtShell &rSh = GetShell(); 1285 if( CNT_GRF == rSh.SwEditShell::GetCntType() && 1286 GRAPHIC_NONE != ( nGrfType = rSh.GetGraphicType() ) && 1287 aGrfUpdateSlots.Count() ) 1288 { 1289 sal_Bool bProtect = 0 != rSh.IsSelObjProtected(FLYPROTECT_CONTENT|FLYPROTECT_PARENT); 1290 SfxViewFrame* pVFrame = GetView().GetViewFrame(); 1291 sal_uInt16 nSlot; 1292 for( sal_uInt16 n = 0; n < aGrfUpdateSlots.Count(); ++n ) 1293 { 1294 sal_Bool bSetState = sal_False; 1295 sal_Bool bState = sal_False; 1296 switch( nSlot = aGrfUpdateSlots[ n ] ) 1297 { 1298 case SID_IMAP: 1299 case SID_IMAP_EXEC: 1300 { 1301 sal_uInt16 nId = SvxIMapDlgChildWindow::GetChildWindowId(); 1302 SvxIMapDlg *pDlg = pVFrame->HasChildWindow( nId ) ? 1303 (SvxIMapDlg*) ( pVFrame->GetChildWindow( nId ) 1304 ->GetWindow()) : 0; 1305 1306 if( pDlg && ( SID_IMAP_EXEC == nSlot || 1307 ( SID_IMAP == nSlot && !bProtect)) && 1308 pDlg->GetEditingObject() != rSh.GetIMapInventor()) 1309 lcl_UpdateIMapDlg( rSh ); 1310 1311 if( !bProtect && SID_IMAP == nSlot ) 1312 bSetState = sal_True, bState = 0 != pDlg; 1313 } 1314 break; 1315 1316 case SID_CONTOUR_DLG: 1317 if( !bProtect ) 1318 { 1319 sal_uInt16 nId = SvxContourDlgChildWindow::GetChildWindowId(); 1320 SvxIMapDlg *pDlg = pVFrame->HasChildWindow( nId ) ? 1321 (SvxIMapDlg*) ( pVFrame->GetChildWindow( nId ) 1322 ->GetWindow()) : 0; 1323 if( pDlg && pDlg->GetEditingObject() != 1324 rSh.GetIMapInventor() ) 1325 lcl_UpdateContourDlg( rSh, nsSelectionType::SEL_GRF ); 1326 1327 bSetState = sal_True; 1328 bState = 0 != pDlg; 1329 } 1330 break; 1331 1332 case FN_FRAME_WRAP_CONTOUR: 1333 if( !bProtect ) 1334 { 1335 SfxItemSet aSet(GetPool(), RES_SURROUND, RES_SURROUND); 1336 rSh.GetFlyFrmAttr(aSet); 1337 const SwFmtSurround& rWrap = (const SwFmtSurround&)aSet.Get(RES_SURROUND); 1338 bSetState = sal_True; 1339 bState = rWrap.IsContour(); 1340 } 1341 break; 1342 1343 case SID_GRFFILTER: 1344 case SID_GRFFILTER_INVERT: 1345 case SID_GRFFILTER_SMOOTH: 1346 case SID_GRFFILTER_SHARPEN: 1347 case SID_GRFFILTER_REMOVENOISE: 1348 case SID_GRFFILTER_SOBEL: 1349 case SID_GRFFILTER_MOSAIC: 1350 case SID_GRFFILTER_EMBOSS: 1351 case SID_GRFFILTER_POSTER: 1352 case SID_GRFFILTER_POPART: 1353 case SID_GRFFILTER_SEPIA: 1354 case SID_GRFFILTER_SOLARIZE: 1355 bSetState = bState = GRAPHIC_BITMAP == nGrfType; 1356 break; 1357 } 1358 1359 if( bSetState ) 1360 { 1361 SfxBoolItem aBool( nSlot, bState ); 1362 if( pGetStateSet ) 1363 pGetStateSet->Put( aBool ); 1364 else 1365 pVFrame->GetBindings().SetState( aBool ); 1366 } 1367 } 1368 aGrfUpdateSlots.RemoveAt( 0, aGrfUpdateSlots.Count() ); 1369 } 1370 return 0; 1371 } 1372 1373 void SwBaseShell::GetState( SfxItemSet &rSet ) 1374 { 1375 SwWrtShell &rSh = GetShell(); 1376 SfxViewFrame* pVFrame = GetView().GetViewFrame(); 1377 SfxWhichIter aIter( rSet ); 1378 sal_uInt16 nWhich = aIter.FirstWhich(); 1379 pGetStateSet = &rSet; 1380 while ( nWhich ) 1381 { 1382 switch ( nWhich ) 1383 { 1384 case SID_GALLERY_FORMATS: 1385 if ( rSh.IsObjSelected() || 1386 (rSh.IsSelFrmMode() && 1387 !(rSh.GetSelectionType() & nsSelectionType::SEL_GRF)) ) 1388 rSet.DisableItem( nWhich ); 1389 break; 1390 case SID_GALLERY_ENABLE_ADDCOPY: 1391 // #108230# allow copy from gallery in Writer AND Writer/Web! 1392 rSet.Put( SfxBoolItem( SID_GALLERY_ENABLE_ADDCOPY, sal_True ) ); 1393 break; 1394 case FN_EDIT_REGION: 1395 if( !rSh.IsAnySectionInDoc() ) 1396 rSet.DisableItem(nWhich); 1397 break; 1398 1399 case FN_INSERT_REGION: 1400 if( rSh.IsSelFrmMode() || 1401 !rSh.IsInsRegionAvailable() ) 1402 rSet.DisableItem( nWhich ); 1403 break; 1404 case FN_CONVERT_TABLE_TO_TEXT: 1405 { 1406 sal_uInt16 eFrmType = rSh.GetFrmType(0,sal_True); 1407 if( (eFrmType & FRMTYPE_FOOTNOTE) || 1408 !rSh.GetTableFmt() ) 1409 rSet.DisableItem( nWhich ); 1410 } 1411 break; 1412 case FN_CONVERT_TEXT_TO_TABLE: 1413 { 1414 sal_uInt16 eFrmType = rSh.GetFrmType(0,sal_True); 1415 if( (eFrmType & FRMTYPE_FOOTNOTE) || 1416 !rSh.IsTextToTableAvailable() ) 1417 rSet.DisableItem( nWhich ); 1418 } 1419 break; 1420 case FN_CONVERT_TEXT_TABLE: 1421 { 1422 sal_uInt16 eFrmType = rSh.GetFrmType(0,sal_True); 1423 if( (eFrmType & FRMTYPE_FOOTNOTE) || 1424 (!rSh.GetTableFmt() && !rSh.IsTextToTableAvailable() ) ) 1425 rSet.DisableItem( nWhich ); 1426 } 1427 break; 1428 case RES_SHADOW: 1429 { 1430 SfxItemSet aSet( rSh.GetAttrPool(), 1431 RES_SHADOW, RES_SHADOW ); 1432 1433 // Tabellenzelle(n) selektiert? 1434 if ( rSh.IsTableMode() ) 1435 { 1436 SwFrmFmt *pFmt = rSh.GetTableFmt(); 1437 aSet.Put(pFmt->GetFmtAttr( nWhich, sal_True )); 1438 } 1439 else if( rSh.IsFrmSelected() ) 1440 { 1441 SwFlyFrmAttrMgr aMgr( sal_False, &rSh, FRMMGR_TYPE_NONE ); 1442 aSet.Put( aMgr.GetAttrSet() ); 1443 } 1444 else 1445 rSh.GetCurAttr( aSet ); 1446 #if OSL_DEBUG_LEVEL > 1 1447 1448 const SvxShadowItem& rShItem = (const SvxShadowItem&)aSet.Get(nWhich); 1449 rSet.Put(rShItem); 1450 #else 1451 rSet.Put((const SvxShadowItem&)aSet.Get(nWhich)); 1452 #endif 1453 } 1454 break; 1455 case SID_IMAP: 1456 { 1457 // --> OD 2006-11-08 #i59688# 1458 // improve efficiency: 1459 // If selected object is protected, item has to disabled. 1460 const sal_Bool bProtect = 0 != rSh.IsSelObjProtected(FLYPROTECT_CONTENT|FLYPROTECT_PARENT); 1461 if ( bProtect ) 1462 { 1463 rSet.DisableItem( nWhich ); 1464 } 1465 else 1466 { 1467 const sal_uInt16 nId = SvxIMapDlgChildWindow::GetChildWindowId(); 1468 const sal_Bool bHas = pVFrame->HasChildWindow( nId ); 1469 const sal_Bool bFrmSel = rSh.IsFrmSelected(); 1470 const sal_Bool bIsGraphicSelection = 1471 rSh.GetSelectionType() == nsSelectionType::SEL_GRF; 1472 1473 // --> OD 2006-11-08 #i59688# 1474 // avoid unnecessary loading of selected graphic. 1475 // The graphic is only needed, if the dialog is open. 1476 //wenn die Grafik ausgeswappt ist, dann muss der 1477 //Status asynchron ermittelt werden 1478 //bis dahin wird der Slot disabled 1479 if ( bHas && bIsGraphicSelection && rSh.IsGrfSwapOut( sal_True ) ) 1480 { 1481 if( AddGrfUpdateSlot( nWhich )) 1482 rSh.GetGraphic(sal_False); // start the loading 1483 } 1484 else 1485 { 1486 if ( !bHas && 1487 ( !bFrmSel || 1488 ( bIsGraphicSelection && 1489 rSh.GetGraphicType() == GRAPHIC_NONE ) ) ) 1490 { 1491 rSet.DisableItem( nWhich ); 1492 } 1493 else 1494 { 1495 SfxBoolItem aBool(nWhich, bHas); 1496 if ( bHas && bFrmSel ) 1497 lcl_UpdateIMapDlg( rSh ); 1498 rSet.Put(aBool); 1499 } 1500 } 1501 // <-- 1502 } 1503 // <-- 1504 } 1505 break; 1506 case SID_IMAP_EXEC: 1507 { 1508 sal_Bool bDisable = sal_False; 1509 if( !rSh.IsFrmSelected()) 1510 bDisable = sal_True; 1511 sal_uInt16 nId = SvxIMapDlgChildWindow::GetChildWindowId(); 1512 if(!bDisable && pVFrame->HasChildWindow( nId )) 1513 { 1514 if(rSh.GetSelectionType() == nsSelectionType::SEL_GRF 1515 && rSh.IsGrfSwapOut(sal_True)) 1516 { 1517 if( AddGrfUpdateSlot( nWhich )) 1518 rSh.GetGraphic(sal_False); // start the loading 1519 } 1520 else 1521 { 1522 SvxIMapDlg *pDlg = SWIMAPDLG(GetView()); 1523 if( pDlg->GetEditingObject() != rSh.GetIMapInventor() ) 1524 lcl_UpdateIMapDlg( rSh ); 1525 } 1526 } 1527 rSet.Put(SfxBoolItem(nWhich, bDisable)); 1528 } 1529 break; 1530 case FN_BACKSPACE: 1531 case SID_DELETE: 1532 if (rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0) 1533 rSet.DisableItem( nWhich ); 1534 break; 1535 case SID_CONTOUR_DLG: 1536 { 1537 sal_Bool bParentCntProt = 0 != rSh.IsSelObjProtected(FLYPROTECT_CONTENT|FLYPROTECT_PARENT ); 1538 1539 if( bParentCntProt || 0 != (HTMLMODE_ON & ::GetHtmlMode( 1540 GetView().GetDocShell() )) ) 1541 rSet.DisableItem( nWhich ); 1542 else 1543 { 1544 sal_uInt16 nId = SvxContourDlgChildWindow::GetChildWindowId(); 1545 sal_Bool bHas = GetView().GetViewFrame()->HasChildWindow( nId ); 1546 int nSel = rSh.GetSelectionType(); 1547 sal_Bool bOk = 0 != (nSel & (nsSelectionType::SEL_GRF|nsSelectionType::SEL_OLE)); 1548 1549 sal_Bool bDisable = sal_False; 1550 if( !bHas && !bOk ) 1551 bDisable = sal_True; 1552 // --> OD 2006-11-08 #i59688# 1553 // avoid unnecessary loading of selected graphic. 1554 // The graphic is only needed, if the dialog is open. 1555 // wenn die Grafik ausgeswappt ist, dann muss der Status 1556 // asynchron ermittelt werden bis dahin wird der Slot 1557 // disabled 1558 else if ( bHas && (nSel & nsSelectionType::SEL_GRF) && 1559 rSh.IsGrfSwapOut(sal_True) ) 1560 { 1561 if( AddGrfUpdateSlot( nWhich )) 1562 rSh.GetGraphic(sal_False); // start the loading 1563 // --> OD 2007-07-04 #i75481# 1564 bDisable = sal_True; 1565 // <-- 1566 } 1567 else if( bHas && bOk ) 1568 bDisable = !lcl_UpdateContourDlg( rSh, nSel ); 1569 else if( bOk ) 1570 { 1571 // --> OD 2007-07-04 #i75481# 1572 // apply fix #i59688# only for selected graphics 1573 if ( nSel & nsSelectionType::SEL_GRF ) 1574 bDisable = GRAPHIC_NONE == rSh.GetGraphicType(); 1575 else 1576 bDisable = GRAPHIC_NONE == rSh.GetIMapGraphic().GetType(); 1577 // <-- 1578 } 1579 // <-- 1580 1581 if( bDisable ) 1582 rSet.DisableItem( nWhich ); 1583 else 1584 rSet.Put( SfxBoolItem(nWhich, bHas) ); 1585 } 1586 } 1587 break; 1588 case SID_CONTOUR_EXEC: 1589 { 1590 sal_Bool bDisable = sal_False; 1591 int nSel = rSh.GetSelectionType(); 1592 if( !(nSel & (nsSelectionType::SEL_GRF|nsSelectionType::SEL_OLE)) ) 1593 bDisable = sal_True; 1594 sal_uInt16 nId = SvxContourDlgChildWindow::GetChildWindowId(); 1595 if( !bDisable && GetView().GetViewFrame()->HasChildWindow( nId )) 1596 { 1597 SvxContourDlg *pDlg = SWCONTOURDLG(GetView()); 1598 if( pDlg->GetEditingObject() != rSh.GetIMapInventor() ) 1599 bDisable = sal_True; 1600 } 1601 rSet.Put(SfxBoolItem(nWhich, bDisable)); 1602 } 1603 break; 1604 1605 case FN_TOOL_ANKER: 1606 case FN_TOOL_ANKER_PAGE: 1607 case FN_TOOL_ANKER_PARAGRAPH: 1608 case FN_TOOL_ANKER_CHAR: 1609 case FN_TOOL_ANKER_AT_CHAR: 1610 case FN_TOOL_ANKER_FRAME: 1611 { 1612 sal_Bool bObj = 0 != rSh.IsObjSelected(); 1613 sal_Bool bParentCntProt = rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0; 1614 1615 if( !bParentCntProt && (bObj || rSh.IsFrmSelected())) 1616 { 1617 SfxItemSet aSet(GetPool(), RES_ANCHOR, RES_ANCHOR); 1618 if(bObj) 1619 rSh.GetObjAttr(aSet); 1620 else 1621 rSh.GetFlyFrmAttr(aSet); 1622 RndStdIds eSet = ((SwFmtAnchor&)aSet.Get(RES_ANCHOR)).GetAnchorId(); 1623 const sal_Bool bSet = 1624 ((nWhich == FN_TOOL_ANKER_PAGE) && 1625 (eSet == FLY_AT_PAGE)) 1626 || ((nWhich == FN_TOOL_ANKER_PARAGRAPH) && 1627 (eSet == FLY_AT_PARA)) 1628 || ((nWhich == FN_TOOL_ANKER_FRAME) && 1629 (eSet == FLY_AT_FLY)) 1630 || ((nWhich == FN_TOOL_ANKER_AT_CHAR) && 1631 (eSet == FLY_AT_CHAR)) 1632 || ((nWhich == FN_TOOL_ANKER_CHAR) && 1633 (eSet == FLY_AS_CHAR)); 1634 if(nWhich != FN_TOOL_ANKER) 1635 { 1636 sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell()); 1637 if( ( nWhich == FN_TOOL_ANKER_PAGE && 1638 ((HTMLMODE_ON & nHtmlMode) && (0 == (nHtmlMode & HTMLMODE_SOME_ABS_POS)))) || 1639 ( nWhich == FN_TOOL_ANKER_FRAME && !rSh.IsFlyInFly() ) ) 1640 rSet.DisableItem(nWhich); 1641 else 1642 rSet.Put(SfxBoolItem(nWhich, bSet)); 1643 } 1644 else 1645 { 1646 sal_uInt16 nSlotId = 0; 1647 1648 switch (eSet) 1649 { 1650 case FLY_AT_PAGE: 1651 nSlotId = FN_TOOL_ANKER_PAGE; 1652 break; 1653 case FLY_AT_PARA: 1654 nSlotId = FN_TOOL_ANKER_PARAGRAPH; 1655 break; 1656 case FLY_AS_CHAR: 1657 nSlotId = FN_TOOL_ANKER_CHAR; 1658 break; 1659 case FLY_AT_CHAR: 1660 nSlotId = FN_TOOL_ANKER_AT_CHAR; 1661 break; 1662 case FLY_AT_FLY: 1663 nSlotId = FN_TOOL_ANKER_FRAME; 1664 break; 1665 default: 1666 ; 1667 } 1668 rSet.Put(SfxUInt16Item(nWhich, nSlotId)); 1669 } 1670 } 1671 else 1672 rSet.DisableItem( nWhich ); 1673 } 1674 break; 1675 case FN_FRAME_NOWRAP: 1676 case FN_FRAME_WRAP: 1677 case FN_FRAME_WRAP_IDEAL: 1678 case FN_FRAME_WRAPTHRU: 1679 case FN_FRAME_WRAPTHRU_TRANSP: 1680 case FN_FRAME_WRAP_CONTOUR: 1681 case FN_WRAP_ANCHOR_ONLY: 1682 case FN_FRAME_WRAP_LEFT: 1683 case FN_FRAME_WRAP_RIGHT: 1684 { 1685 sal_Bool bObj = 0 != rSh.IsObjSelected(); 1686 sal_Bool bParentCntProt = rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0; 1687 1688 if( !bParentCntProt && (bObj || rSh.IsFrmSelected())) 1689 { 1690 SfxItemSet aSet(GetPool(), RES_OPAQUE, RES_ANCHOR); 1691 int nAnchorType; 1692 if(bObj) 1693 { 1694 rSh.GetObjAttr(aSet); 1695 nAnchorType = rSh.GetAnchorId(); 1696 } 1697 else 1698 { 1699 rSh.GetFlyFrmAttr(aSet); 1700 nAnchorType = ((SwFmtAnchor&)aSet.Get(RES_ANCHOR)).GetAnchorId(); 1701 } 1702 const SwFmtSurround& rWrap = (const SwFmtSurround&)aSet.Get(RES_SURROUND); 1703 1704 const SvxOpaqueItem& rOpaque = (const SvxOpaqueItem&)aSet.Get(RES_OPAQUE); 1705 sal_Bool bOpaque = rOpaque.GetValue(); 1706 SwSurround nSurround = rWrap.GetSurround(); 1707 sal_Bool bSet = sal_False; 1708 1709 bool bDisable = 1710 (nAnchorType == - 1) || (nAnchorType == FLY_AS_CHAR); 1711 const bool bHtmlMode = 1712 0 != ::GetHtmlMode(GetView().GetDocShell()); 1713 1714 switch( nWhich ) 1715 { 1716 case FN_FRAME_NOWRAP: 1717 bDisable |= 1718 ( (nAnchorType != FLY_AT_PARA) 1719 && (nAnchorType != FLY_AT_CHAR) 1720 && (nAnchorType != FLY_AT_PAGE)); 1721 bSet = nSurround == SURROUND_NONE; 1722 break; 1723 case FN_FRAME_WRAP: 1724 bDisable |= bHtmlMode; 1725 bSet = nSurround == SURROUND_PARALLEL; 1726 break; 1727 case FN_FRAME_WRAP_IDEAL: 1728 bDisable |= bHtmlMode; 1729 bSet = nSurround == SURROUND_IDEAL; 1730 break; 1731 case FN_FRAME_WRAPTHRU: 1732 bDisable |= (bHtmlMode || 1733 ( (nAnchorType != FLY_AT_PARA) 1734 && (nAnchorType != FLY_AT_CHAR) 1735 && (nAnchorType != FLY_AT_PAGE))); 1736 if(bObj) 1737 bSet = nSurround == SURROUND_THROUGHT && rSh.GetLayerId(); 1738 else 1739 bSet = nSurround == SURROUND_THROUGHT && bOpaque; 1740 break; 1741 case FN_FRAME_WRAPTHRU_TRANSP: 1742 bDisable |= bHtmlMode; 1743 if(bObj) 1744 bSet = nSurround == SURROUND_THROUGHT && !rSh.GetLayerId(); 1745 else 1746 bSet = nSurround == SURROUND_THROUGHT && !bOpaque; 1747 break; 1748 case FN_FRAME_WRAP_CONTOUR: 1749 bDisable |= bHtmlMode; 1750 //no contour available whenn no wrap or wrap through is set 1751 bDisable |= (nSurround == SURROUND_NONE || nSurround == SURROUND_THROUGHT); 1752 bSet = rWrap.IsContour(); 1753 if( !bDisable ) 1754 { 1755 int nSel = rSh.GetSelectionType(); 1756 if( (nSel & nsSelectionType::SEL_GRF) && 1757 rSh.IsGrfSwapOut(sal_True)) 1758 { 1759 if( AddGrfUpdateSlot( nWhich )) 1760 rSh.GetGraphic(sal_False); // start the loading 1761 } 1762 else if( rSh.IsFrmSelected() ) 1763 { 1764 // #i102253# applied patch from OD (see task) 1765 bDisable = 1766 nSel & nsSelectionType::SEL_FRM || 1767 GRAPHIC_NONE == rSh.GetIMapGraphic().GetType(); 1768 } 1769 } 1770 bSet = bDisable ? sal_False : rWrap.IsContour(); 1771 1772 break; 1773 case FN_WRAP_ANCHOR_ONLY: 1774 bDisable |= (bHtmlMode || 1775 (nAnchorType != FLY_AT_PARA)); 1776 bSet = rWrap.IsAnchorOnly(); 1777 break; 1778 case FN_FRAME_WRAP_LEFT: 1779 bSet = nSurround == SURROUND_LEFT; 1780 break; 1781 case FN_FRAME_WRAP_RIGHT: 1782 bSet = nSurround == SURROUND_RIGHT; 1783 break; 1784 } 1785 1786 if(bDisable) 1787 rSet.DisableItem(nWhich); 1788 else 1789 rSet.Put(SfxBoolItem(nWhich, bSet)); 1790 } 1791 else 1792 rSet.DisableItem(nWhich); 1793 } 1794 break; 1795 case FN_UPDATE_CHARTS: 1796 if( !rSh.HasCharts() ) 1797 rSet.DisableItem( nWhich ); 1798 break; 1799 case FN_UPDATE_ALL_LINKS: 1800 if ( !rSh.GetLinkManager().GetLinks().Count() ) 1801 rSet.DisableItem(nWhich); 1802 break; 1803 case FN_XFORMS_DESIGN_MODE: 1804 // enable if in XForms document 1805 if( rSh.GetDoc()->isXForms() ) 1806 { 1807 // determine current state from view options 1808 sal_Bool bValue = ! rSh.GetViewOptions()->IsFormView(); 1809 rSet.Put( SfxBoolItem( nWhich, bValue ) ); 1810 } 1811 else 1812 rSet.Put( SfxVisibilityItem( nWhich, sal_False ) ); 1813 break; 1814 } 1815 nWhich = aIter.NextWhich(); 1816 } 1817 pGetStateSet = 0; 1818 } 1819 1820 /*-------------------------------------------------------------------- 1821 Beschreibung: Slots mit dieser Statusmethode disablen 1822 --------------------------------------------------------------------*/ 1823 1824 1825 void SwBaseShell::StateDisableItems( SfxItemSet &rSet ) 1826 { 1827 SfxWhichIter aIter(rSet); 1828 sal_uInt16 nWhich = aIter.FirstWhich(); 1829 1830 while (nWhich) 1831 { 1832 rSet.DisableItem( nWhich ); 1833 nWhich = aIter.NextWhich(); 1834 } 1835 } 1836 1837 /*-------------------------------------------------------------------- 1838 Beschreibung: Slots mit dieser Statusmethode disablen 1839 --------------------------------------------------------------------*/ 1840 1841 1842 void SwBaseShell::StateStyle( SfxItemSet &rSet ) 1843 { 1844 sal_Bool bParentCntProt = GetShell().IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0; 1845 ShellModes eMode = GetView().GetShellMode(); 1846 1847 if ( bParentCntProt || 1848 SHELL_MODE_DRAW == eMode || 1849 SHELL_MODE_DRAW_CTRL == eMode || 1850 SHELL_MODE_DRAW_FORM == eMode || 1851 SHELL_MODE_DRAWTEXT == eMode || 1852 SHELL_MODE_BEZIER == eMode ) 1853 { 1854 SfxWhichIter aIter( rSet ); 1855 sal_uInt16 nWhich = aIter.FirstWhich(); 1856 while ( nWhich ) 1857 { 1858 rSet.DisableItem( nWhich ); 1859 nWhich = aIter.NextWhich(); 1860 } 1861 } 1862 else 1863 GetView().GetDocShell()->StateStyleSheet(rSet, &GetShell()); 1864 } 1865 1866 /*-------------------------------------------------------------------- 1867 Beschreibung: 1868 --------------------------------------------------------------------*/ 1869 1870 1871 void SwBaseShell::SetWrapMode( sal_uInt16 nSlot ) 1872 { 1873 SwWrtShell &rSh = GetShell(); 1874 sal_Bool bObj = 0 != rSh.IsObjSelected(); 1875 if( bObj || rSh.IsFrmSelected()) 1876 { 1877 SfxItemSet aSet(GetPool(), RES_OPAQUE, RES_SURROUND); 1878 if(bObj) 1879 rSh.GetObjAttr(aSet); 1880 else 1881 rSh.GetFlyFrmAttr(aSet); 1882 SwFmtSurround aWrap( (SwFmtSurround&)aSet.Get(RES_SURROUND) ); 1883 SwSurround nOldSurround(aWrap.GetSurround()); 1884 SwSurround nSurround = SURROUND_PARALLEL; 1885 1886 switch (nSlot) 1887 { 1888 case FN_FRAME_NOWRAP: 1889 nSurround = SURROUND_NONE; 1890 if (aWrap.IsContour()) 1891 aWrap.SetContour(sal_False); 1892 break; 1893 case FN_FRAME_WRAP_IDEAL: 1894 nSurround = SURROUND_IDEAL; 1895 break; 1896 case FN_WRAP_ANCHOR_ONLY: 1897 aWrap.SetAnchorOnly(!aWrap.IsAnchorOnly()); 1898 // --> OD 2006-06-02 #b6432130# 1899 // keep previous wrapping 1900 // --> OD 2006-09-21 #138144# - adjust fix #b6432130# 1901 // switch to wrap SURROUND_PARALLEL, if previous wrap is SURROUND_NONE 1902 if ( nOldSurround != SURROUND_NONE ) 1903 { 1904 nSurround = nOldSurround; 1905 } 1906 // <-- 1907 break; 1908 case FN_FRAME_WRAP_CONTOUR: 1909 aWrap.SetContour(!aWrap.IsContour()); 1910 if (nSurround == SURROUND_THROUGHT) 1911 nSurround = SURROUND_PARALLEL; 1912 break; 1913 case FN_FRAME_WRAPTHRU_TRANSP: 1914 if (aWrap.IsContour()) 1915 aWrap.SetContour(sal_False); 1916 // kein break!!! 1917 case FN_FRAME_WRAPTHRU: 1918 nSurround = SURROUND_THROUGHT; 1919 break; 1920 1921 case FN_FRAME_WRAP_LEFT: 1922 nSurround = SURROUND_LEFT; 1923 break; 1924 1925 case FN_FRAME_WRAP_RIGHT: 1926 nSurround = SURROUND_RIGHT; 1927 break; 1928 1929 default: 1930 break; 1931 } 1932 aWrap.SetSurround(nSurround); 1933 1934 if (nSlot != FN_FRAME_WRAP_CONTOUR) 1935 { 1936 // Konturumfluss bei Draw-Objekten defaulten 1937 if (bObj && nOldSurround != nSurround && 1938 (nOldSurround == SURROUND_NONE || nOldSurround == SURROUND_THROUGHT)) 1939 { 1940 aWrap.SetContour(sal_True); 1941 } 1942 } 1943 1944 aSet.Put( aWrap ); 1945 aSet.Put(SvxOpaqueItem(RES_OPAQUE, nSlot != FN_FRAME_WRAPTHRU_TRANSP)); 1946 if(bObj) 1947 { 1948 rSh.SetObjAttr(aSet); 1949 if (nSlot != FN_FRAME_WRAPTHRU_TRANSP) 1950 rSh.SelectionToHeaven(); 1951 else 1952 rSh.SelectionToHell(); 1953 } 1954 else 1955 rSh.SetFlyFrmAttr(aSet); 1956 } 1957 } 1958 1959 /*-------------------------------------------------------------------- 1960 Beschreibung: Update der Statuszeile erzwingen 1961 --------------------------------------------------------------------*/ 1962 1963 void SwBaseShell::SetFrmMode(FlyMode eMode, SwWrtShell *pSh ) 1964 { 1965 eFrameMode = eMode; 1966 SfxBindings &rBnd = pSh->GetView().GetViewFrame()->GetBindings(); 1967 1968 if( eMode == FLY_DRAG || 1969 (pSh && (pSh->IsFrmSelected() || pSh->IsObjSelected())) ) 1970 { 1971 const SfxPointItem aTmp1( SID_ATTR_POSITION, pSh->GetAnchorObjDiff()); 1972 const SvxSizeItem aTmp2( SID_ATTR_SIZE, pSh->GetObjSize()); 1973 rBnd.SetState( aTmp1 ); 1974 rBnd.SetState( aTmp2 ); 1975 } 1976 else if( eMode == FLY_DRAG_END ) 1977 { 1978 static sal_uInt16 __READONLY_DATA aInval[] = 1979 { 1980 SID_ATTR_POSITION, SID_ATTR_SIZE, 0 1981 }; 1982 rBnd.Invalidate(aInval); 1983 } 1984 } 1985 1986 /*-------------------------------------------------------------------- 1987 Beschreibung: Ctor 1988 --------------------------------------------------------------------*/ 1989 1990 SwBaseShell::SwBaseShell(SwView& rVw) : 1991 SfxShell( &rVw ), 1992 rView(rVw), 1993 pGetStateSet(0) 1994 { 1995 SwWrtShell& rWrtSh = rView.GetWrtShell(); 1996 1997 SetPool(&rWrtSh.GetAttrPool()); 1998 SetName(C2S("Base")); 1999 rWrtSh.SetGrfArrivedLnk( LINK( this, SwBaseShell, GraphicArrivedHdl)); 2000 } 2001 2002 2003 SwBaseShell::~SwBaseShell() 2004 { 2005 if( rView.GetCurShell() == this ) 2006 rView.ResetSubShell(); 2007 2008 Link aTmp( LINK( this, SwBaseShell, GraphicArrivedHdl)); 2009 if( aTmp == rView.GetWrtShell().GetGrfArrivedLnk() ) 2010 rView.GetWrtShell().SetGrfArrivedLnk( Link() ); 2011 } 2012 2013 /*-------------------------------------------------------------------- 2014 Beschreibung: 2015 --------------------------------------------------------------------*/ 2016 2017 void SwBaseShell::ExecTxtCtrl( SfxRequest& rReq ) 2018 { 2019 const SfxItemSet *pArgs = rReq.GetArgs(); 2020 2021 if( pArgs) 2022 { 2023 SwWrtShell &rSh = GetShell(); 2024 SvxScriptSetItem* pSSetItem = 0; 2025 sal_uInt16 nSlot = rReq.GetSlot(); 2026 SfxItemPool& rPool = rSh.GetAttrPool(); 2027 sal_uInt16 nWhich = rPool.GetWhich( nSlot ); 2028 sal_uInt16 nScripts = SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | SCRIPTTYPE_COMPLEX; 2029 SfxItemSet aHeightSet( GetPool(), RES_CHRATR_FONTSIZE, RES_CHRATR_FONTSIZE, 2030 RES_CHRATR_CJK_FONTSIZE, RES_CHRATR_CJK_FONTSIZE, 2031 RES_CHRATR_CTL_FONTSIZE, RES_CHRATR_CTL_FONTSIZE, 2032 0L); 2033 2034 switch( nSlot ) 2035 { 2036 case SID_ATTR_CHAR_FONT: 2037 { 2038 nScripts = rSh.GetScriptType(); 2039 // #i42732# input language should be preferred over 2040 // current cursor position to detect script type 2041 if(!rSh.HasSelection()) 2042 { 2043 LanguageType nInputLang = GetView().GetEditWin().GetInputLanguage(); 2044 if(nInputLang != LANGUAGE_DONTKNOW && nInputLang != LANGUAGE_SYSTEM) 2045 nScripts = SvtLanguageOptions::GetScriptTypeOfLanguage( nInputLang ); 2046 } 2047 } 2048 case SID_ATTR_CHAR_POSTURE: 2049 case SID_ATTR_CHAR_WEIGHT: 2050 { 2051 pSSetItem = new SvxScriptSetItem( nSlot, rPool ); 2052 pSSetItem->PutItemForScriptType( nScripts, pArgs->Get( nWhich )); 2053 pArgs = &pSSetItem->GetItemSet(); 2054 } 2055 break; 2056 case SID_ATTR_CHAR_FONTHEIGHT: 2057 { 2058 if(rSh.HasSelection()) 2059 { 2060 pSSetItem = new SvxScriptSetItem( nSlot, rPool ); 2061 pSSetItem->PutItemForScriptType( nScripts, pArgs->Get( nWhich )); 2062 pArgs = &pSSetItem->GetItemSet(); 2063 } 2064 else 2065 { 2066 nScripts = rSh.GetScriptType(); 2067 LanguageType nInputLang = GetView().GetEditWin().GetInputLanguage(); 2068 if(nInputLang != LANGUAGE_DONTKNOW && nInputLang != LANGUAGE_SYSTEM) 2069 nScripts = SvtLanguageOptions::GetScriptTypeOfLanguage( nInputLang ); 2070 sal_uInt32 nHeight = static_cast< const SvxFontHeightItem& >(pArgs->Get( nWhich )).GetHeight(); 2071 SwStdFontConfig* pStdFont = SW_MOD()->GetStdFontConfig(); 2072 2073 SfxItemSet aLangSet( GetPool(), RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE, 2074 RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_LANGUAGE, 2075 RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_LANGUAGE, 2076 0L); 2077 rSh.GetCurAttr( aLangSet ); 2078 2079 sal_Int32 nWesternSize = 2080 pStdFont->GetFontHeight(FONT_STANDARD, FONT_GROUP_DEFAULT, 2081 static_cast<const SvxLanguageItem&>(aLangSet.Get( RES_CHRATR_LANGUAGE)).GetLanguage()); 2082 sal_Int32 nCJKSize = 2083 pStdFont->GetFontHeight(FONT_STANDARD, FONT_GROUP_CJK, 2084 static_cast<const SvxLanguageItem&>(aLangSet.Get( RES_CHRATR_CJK_LANGUAGE)).GetLanguage()); 2085 sal_Int32 nCTLSize = 2086 pStdFont->GetFontHeight(FONT_STANDARD, FONT_GROUP_CTL, 2087 static_cast<const SvxLanguageItem&>(aLangSet.Get( RES_CHRATR_CTL_LANGUAGE)).GetLanguage()); 2088 2089 switch(nScripts) 2090 { 2091 case SCRIPTTYPE_LATIN: 2092 nCJKSize = nHeight * nCJKSize / nWesternSize; 2093 nCTLSize = nHeight * nCTLSize / nWesternSize; 2094 nWesternSize = (sal_Int32) nHeight; 2095 break; 2096 case SCRIPTTYPE_ASIAN: 2097 nCTLSize = nHeight* nCTLSize / nCJKSize; 2098 nWesternSize = nHeight * nWesternSize / nCJKSize; 2099 nCJKSize = (sal_Int32) nHeight; 2100 break; 2101 case SCRIPTTYPE_COMPLEX: 2102 nCJKSize = nHeight * nCJKSize / nCTLSize; 2103 nWesternSize = nHeight * nWesternSize / nCTLSize; 2104 nCTLSize = (sal_Int32) nHeight; 2105 break; 2106 } 2107 aHeightSet.Put( SvxFontHeightItem( (sal_uInt32)nWesternSize, 100, RES_CHRATR_FONTSIZE )); 2108 aHeightSet.Put( SvxFontHeightItem( (sal_uInt32)nCJKSize, 100, RES_CHRATR_CJK_FONTSIZE )); 2109 aHeightSet.Put( SvxFontHeightItem( (sal_uInt32)nCTLSize, 100, RES_CHRATR_CTL_FONTSIZE )); 2110 pArgs = &aHeightSet; 2111 } 2112 } 2113 break; 2114 } 2115 2116 if( pArgs ) 2117 { 2118 bool bAuto = false; 2119 if ( !isCHRATR(nWhich) || 2120 ( rSh.HasSelection() && rSh.IsSelFullPara() ) ) 2121 { 2122 SwTxtFmtColl * pColl = rSh.GetCurTxtFmtColl(); 2123 if ( pColl && pColl->IsAutoUpdateFmt() ) 2124 { 2125 rSh.AutoUpdatePara( pColl, *pArgs ); 2126 bAuto = true; 2127 } 2128 } 2129 2130 if (!bAuto) 2131 { 2132 rSh.SetAttr( *pArgs ); 2133 } 2134 } 2135 delete pSSetItem; 2136 } 2137 else 2138 GetView().GetViewFrame()->GetDispatcher()->Execute( SID_CHAR_DLG, sal_False); 2139 rReq.Done(); 2140 } 2141 2142 /*-------------------------------------------------------------------- 2143 Beschreibung: 2144 --------------------------------------------------------------------*/ 2145 2146 void SwBaseShell::GetTxtCtrlState( SfxItemSet& rSet ) 2147 { 2148 SwWrtShell &rSh = GetShell(); 2149 rSh.GetCurAttr( rSet ); 2150 } 2151 2152 void SwBaseShell::GetTxtFontCtrlState( SfxItemSet& rSet ) 2153 { 2154 SwWrtShell &rSh = GetShell(); 2155 sal_Bool bFirst = sal_True; 2156 SfxItemSet* pFntCoreSet = 0; 2157 sal_uInt16 nScriptType = SCRIPTTYPE_LATIN; 2158 SfxWhichIter aIter( rSet ); 2159 sal_uInt16 nWhich = aIter.FirstWhich(); 2160 while( nWhich ) 2161 { 2162 switch( nWhich ) 2163 { 2164 case RES_CHRATR_FONT: 2165 case RES_CHRATR_FONTSIZE: 2166 case RES_CHRATR_WEIGHT: 2167 case RES_CHRATR_POSTURE: 2168 { 2169 if( !pFntCoreSet ) 2170 { 2171 pFntCoreSet = new SfxItemSet( *rSet.GetPool(), 2172 RES_CHRATR_BEGIN, RES_CHRATR_END-1 ); 2173 rSh.GetCurAttr( *pFntCoreSet ); 2174 nScriptType = rSh.GetScriptType(); 2175 // #i42732# input language should be preferred over 2176 // current cursor position to detect script type 2177 SwEditWin& rEditWin = GetView().GetEditWin(); 2178 if( rEditWin.IsUseInputLanguage() ) 2179 { 2180 if(!rSh.HasSelection() && ( 2181 nWhich == RES_CHRATR_FONT || 2182 nWhich == RES_CHRATR_FONTSIZE )) 2183 { 2184 LanguageType nInputLang = rEditWin.GetInputLanguage(); 2185 if(nInputLang != LANGUAGE_DONTKNOW && nInputLang != LANGUAGE_SYSTEM) 2186 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( nInputLang ); 2187 } 2188 } 2189 } 2190 SfxItemPool& rPool = *rSet.GetPool(); 2191 SvxScriptSetItem aSetItem( rPool.GetSlotId( nWhich ), rPool ); 2192 aSetItem.GetItemSet().Put( *pFntCoreSet, sal_False ); 2193 const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScriptType ); 2194 if( pI ) 2195 rSet.Put( *pI, nWhich ); 2196 else 2197 rSet.InvalidateItem( nWhich ); 2198 //set input context of the SwEditWin according to the selected font and script type 2199 if(RES_CHRATR_FONT == nWhich) 2200 { 2201 Font aFont; 2202 if(pI && pI->ISA(SvxFontItem)) 2203 { 2204 aFont.SetName( ((const SvxFontItem*)pI)->GetFamilyName()); 2205 aFont.SetStyleName(((const SvxFontItem*)pI)->GetStyleName()); 2206 aFont.SetFamily(((const SvxFontItem*)pI)->GetFamily()); 2207 aFont.SetPitch(((const SvxFontItem*)pI)->GetPitch()); 2208 aFont.SetCharSet(((const SvxFontItem*)pI)->GetCharSet()); 2209 } 2210 2211 sal_Bool bVertical = rSh.IsInVerticalText(); 2212 aFont.SetOrientation(bVertical ? 2700 : 0); 2213 aFont.SetVertical(bVertical); 2214 GetView().GetEditWin().SetInputContext( InputContext( aFont, INPUTCONTEXT_TEXT | 2215 INPUTCONTEXT_EXTTEXTINPUT ) ); 2216 } 2217 } 2218 break; 2219 2220 default: 2221 if( bFirst ) 2222 { 2223 rSh.GetCurAttr( rSet ); 2224 bFirst = sal_False; 2225 } 2226 } 2227 nWhich = aIter.NextWhich(); 2228 } 2229 delete pFntCoreSet; 2230 } 2231 2232 /*-------------------------------------------------------------------- 2233 Beschreibung: 2234 --------------------------------------------------------------------*/ 2235 2236 void SwBaseShell::GetBckColState(SfxItemSet &rSet) 2237 { 2238 SwWrtShell &rSh = GetShell(); 2239 SfxWhichIter aIter( rSet ); 2240 sal_uInt16 nWhich = aIter.FirstWhich(); 2241 int nSelType = rSh.GetSelectionType(); 2242 2243 // if ( nSelType & nsSelectionType::SEL_GRF || 2244 if( nSelType & nsSelectionType::SEL_OLE ) 2245 { 2246 rSet.DisableItem( SID_BACKGROUND_COLOR ); 2247 return; 2248 } 2249 2250 if ( nSelType & nsSelectionType::SEL_FRM ) 2251 { 2252 sal_Bool bParentCntProt = rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0; 2253 if (bParentCntProt) 2254 { 2255 rSet.DisableItem( SID_BACKGROUND_COLOR ); 2256 return; 2257 } 2258 } 2259 2260 SvxBrushItem aBrushItem( RES_BACKGROUND ); 2261 2262 if( nsSelectionType::SEL_TBL_CELLS & nSelType ) 2263 rSh.GetBoxBackground( aBrushItem ); 2264 else 2265 { 2266 SfxItemSet aCoreSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND); 2267 if( nSelType & nsSelectionType::SEL_GRF || nsSelectionType::SEL_FRM & nSelType ) 2268 rSh.GetFlyFrmAttr( aCoreSet ); 2269 else 2270 rSh.GetCurAttr( aCoreSet ); 2271 aBrushItem = (const SvxBrushItem&)aCoreSet.Get(RES_BACKGROUND); 2272 } 2273 2274 while ( nWhich ) 2275 { 2276 switch(nWhich) 2277 { 2278 case SID_BACKGROUND_COLOR : 2279 { 2280 SvxColorItem aColorItem(aBrushItem.GetColor(), SID_BACKGROUND_COLOR); 2281 rSet.Put( aColorItem, SID_BACKGROUND_COLOR ); 2282 } 2283 break; 2284 case SID_ATTR_BRUSH: 2285 case RES_BACKGROUND: 2286 rSet.Put( aBrushItem, GetPool().GetWhich(nWhich) ); 2287 break; 2288 } 2289 nWhich = aIter.NextWhich(); 2290 } 2291 } 2292 2293 /*-------------------------------------------------------------------- 2294 Beschreibung: 2295 --------------------------------------------------------------------*/ 2296 2297 void SwBaseShell::ExecBckCol(SfxRequest& rReq) 2298 { 2299 SwWrtShell &rSh = GetShell(); 2300 int nSelType = rSh.GetSelectionType(); 2301 if ( nSelType & nsSelectionType::SEL_OLE ) 2302 { 2303 return; 2304 } 2305 2306 const SfxItemSet* pArgs = rReq.GetArgs(); 2307 sal_uInt16 nSlot = rReq.GetSlot(); 2308 if( !pArgs && nSlot != SID_BACKGROUND_COLOR) 2309 return ; 2310 2311 SvxBrushItem aBrushItem( RES_BACKGROUND ); 2312 2313 if( nsSelectionType::SEL_TBL_CELLS & nSelType ) 2314 { 2315 rSh.GetBoxBackground( aBrushItem ); 2316 } 2317 else 2318 { 2319 SfxItemSet aCoreSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND); 2320 if( (nsSelectionType::SEL_FRM & nSelType) || (nsSelectionType::SEL_GRF & nSelType) ) 2321 rSh.GetFlyFrmAttr( aCoreSet ); 2322 else 2323 rSh.GetCurAttr( aCoreSet ); 2324 aBrushItem = (const SvxBrushItem&)aCoreSet.Get(RES_BACKGROUND); 2325 } 2326 2327 // sal_Bool bMsgOk = sal_False; 2328 2329 switch (nSlot) 2330 { 2331 // RES_BACKGROUND (=SID_ATTR_BRUSH) muss ueber zwei IDs 2332 // gesetzt werden: 2333 case SID_BACKGROUND_COLOR: 2334 { 2335 aBrushItem.SetGraphicPos(GPOS_NONE); 2336 2337 //Brush &rBrush = aBrushItem.GetBrush(); 2338 if(pArgs) 2339 { 2340 const SvxColorItem& rNewColorItem = (const SvxColorItem&) 2341 pArgs->Get(SID_BACKGROUND_COLOR); 2342 const Color& rNewColor = rNewColorItem.GetValue(); 2343 aBrushItem.SetColor( rNewColor ); 2344 GetView().GetViewFrame()->GetBindings().SetState(rNewColorItem); 2345 } 2346 else 2347 { 2348 aBrushItem.SetColor( COL_TRANSPARENT ); 2349 rReq.AppendItem( SvxColorItem( Color( COL_TRANSPARENT ), nSlot ) ); 2350 } 2351 } 2352 break; 2353 2354 case SID_ATTR_BRUSH: 2355 case RES_BACKGROUND: 2356 { 2357 const SvxBrushItem& rNewBrushItem = (const SvxBrushItem&) 2358 pArgs->Get( GetPool().GetWhich(nSlot) ); 2359 aBrushItem = rNewBrushItem; 2360 } 2361 break; 2362 default: 2363 // bMsgOk = sal_False; 2364 rReq.Ignore(); 2365 DBG_ERROR( "Unbekannte Message bei ExecuteAttr!" ); 2366 return; 2367 } 2368 2369 if( nsSelectionType::SEL_TBL_CELLS & nSelType ) 2370 { 2371 rSh.SetBoxBackground( aBrushItem ); 2372 } 2373 else if( (nsSelectionType::SEL_FRM & nSelType) || 2374 (nsSelectionType::SEL_GRF & nSelType) ) 2375 { 2376 SfxItemSet aCoreSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND); 2377 aCoreSet.Put( aBrushItem ); 2378 // Vorlagen-AutoUpdate 2379 SwFrmFmt* pFmt = rSh.GetCurFrmFmt(); 2380 if(pFmt && pFmt->IsAutoUpdateFmt()) 2381 rSh.AutoUpdateFrame( pFmt, aCoreSet); 2382 else 2383 rSh.SetFlyFrmAttr( aCoreSet ); 2384 } 2385 else 2386 { 2387 SwTxtFmtColl* pColl = rSh.GetCurTxtFmtColl(); 2388 if( pColl && pColl->IsAutoUpdateFmt()) 2389 { 2390 SfxItemSet aSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND ); 2391 aSet.Put(aBrushItem); 2392 rSh.AutoUpdatePara( pColl, aSet); 2393 } 2394 else 2395 rSh.SetAttr( aBrushItem ); 2396 } 2397 2398 rReq.Done(); 2399 } 2400 2401 /*-------------------------------------------------------------------- 2402 Beschreibung: 2403 --------------------------------------------------------------------*/ 2404 2405 2406 void SwBaseShell::GetBorderState(SfxItemSet &rSet) 2407 { 2408 SwWrtShell &rSh = GetShell(); 2409 // Tabellenzelle(n) selektiert? 2410 sal_Bool bPrepare = sal_True; 2411 sal_Bool bTableMode = rSh.IsTableMode(); 2412 if ( bTableMode ) 2413 { 2414 SfxItemSet aCoreSet( GetPool(), 2415 RES_BOX, RES_BOX, 2416 SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0 ); 2417 SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER ); 2418 aCoreSet.Put( aBoxInfo ); 2419 rSh.GetTabBorders( aCoreSet ); 2420 rSet.Put( aCoreSet ); 2421 } 2422 else if ( rSh.IsFrmSelected() ) 2423 { 2424 SwFlyFrmAttrMgr aMgr( sal_False, &rSh, FRMMGR_TYPE_NONE ); 2425 rSet.Put( aMgr.GetAttrSet() ); 2426 bPrepare = sal_False; 2427 } 2428 else 2429 // Umrandungsattribute ganz normal ueber Shell holen 2430 rSh.GetCurAttr( rSet ); 2431 if ( bPrepare ) 2432 ::PrepareBoxInfo( rSet, rSh ); 2433 // switch the border toolbox controller mode 2434 rSet.Put( SfxBoolItem( SID_BORDER_REDUCED_MODE, !bTableMode )); 2435 } 2436 2437 /*-------------------------------------------------------------------- 2438 Beschreibung: 2439 --------------------------------------------------------------------*/ 2440 2441 2442 void SwBaseShell::ExecDlg(SfxRequest &rReq) 2443 { 2444 SwWrtShell &rSh = GetShell(); 2445 Window *pMDI = &GetView().GetViewFrame()->GetWindow(); 2446 //Damit aus dem Basic keine Dialoge fuer Hintergrund-Views aufgerufen werden: 2447 sal_Bool bBackground = (&GetView() != GetActiveView()); 2448 const SfxPoolItem* pItem = 0; 2449 const SfxItemSet* pArgs = rReq.GetArgs(); 2450 2451 sal_uInt16 nSlot = rReq.GetSlot(); 2452 const SfxItemSet* pOutSet = 0; 2453 bool bDone = false; 2454 if(pArgs) 2455 pArgs->GetItemState( GetPool().GetWhich(nSlot), sal_False, &pItem ); 2456 2457 switch ( nSlot ) 2458 { 2459 case FN_FORMAT_PAGE_DLG: 2460 case FN_FORMAT_PAGE_COLUMN_DLG: 2461 case FN_FORMAT_PAGE_SETTING_DLG: 2462 { 2463 if( !bBackground ) 2464 { 2465 const sal_uInt16 nCurIdx = rSh.GetCurPageDesc(); 2466 const SwPageDesc& rPageDesc = rSh.GetPageDesc( nCurIdx ); 2467 //temp. View, weil die Shell nach dem Dialog nicht mehr gueltig sein muss 2468 //z.B. Kopfzeile ausschalten 2469 SwView& rTempView = GetView(); 2470 rTempView.GetDocShell()->FormatPage( 2471 rPageDesc.GetName(), 2472 nSlot, 2473 rSh ); 2474 rTempView.InvalidateRulerPos(); 2475 } 2476 } 2477 break; 2478 case FN_FORMAT_BORDER_DLG: 2479 { 2480 SfxItemSet aSet( rSh.GetAttrPool(), 2481 RES_BOX , RES_SHADOW, 2482 SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 2483 0 ); 2484 SfxAbstractDialog * pDlg = 0; 2485 // Tabellenzelle(n) selektiert? 2486 if ( rSh.IsTableMode() ) 2487 { 2488 // Umrandungattribute Get/SetTabBorders() setzen 2489 ::PrepareBoxInfo( aSet, rSh ); 2490 rSh.GetTabBorders( aSet ); 2491 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 2492 DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); 2493 2494 pDlg = pFact->CreateSwBorderDlg( pMDI, aSet, SW_BORDER_MODE_TABLE, RC_DLG_SWBORDERDLG ); 2495 DBG_ASSERT(pDlg, "Dialogdiet fail!"); 2496 if ( pDlg->Execute() == RET_OK ) 2497 { 2498 rSh.SetTabBorders( *pDlg->GetOutputItemSet() ); 2499 pOutSet = pDlg->GetOutputItemSet(); 2500 } 2501 } 2502 else if ( rSh.IsFrmSelected() ) 2503 { 2504 // Umrandungsattribute ueber Frame-Manager setzen 2505 SwFlyFrmAttrMgr aMgr( sal_False, &rSh, FRMMGR_TYPE_NONE ); 2506 aSet.Put( aMgr.GetAttrSet() ); 2507 2508 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 2509 DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); 2510 2511 pDlg = pFact->CreateSwBorderDlg( pMDI, aSet, SW_BORDER_MODE_FRAME, RC_DLG_SWBORDERDLG ); 2512 DBG_ASSERT(pDlg, "Dialogdiet fail!"); 2513 if ( pDlg->Execute() == RET_OK ) 2514 { 2515 aMgr.SetAttrSet( *pDlg->GetOutputItemSet() ); 2516 aMgr.UpdateFlyFrm(); 2517 pOutSet = pDlg->GetOutputItemSet(); 2518 } 2519 } 2520 else 2521 { 2522 // Umrandungsattribute ganz normal ueber Shell setzen 2523 rSh.GetCurAttr( aSet ); 2524 ::PrepareBoxInfo( aSet, rSh ); 2525 2526 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 2527 DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); 2528 2529 pDlg = pFact->CreateSwBorderDlg( pMDI, aSet, SW_BORDER_MODE_PARA, RC_DLG_SWBORDERDLG ); 2530 DBG_ASSERT(pDlg, "Dialogdiet fail!"); 2531 if ( pDlg->Execute() == RET_OK ) 2532 { 2533 rSh.SetAttr( *pDlg->GetOutputItemSet() ); 2534 pOutSet = pDlg->GetOutputItemSet(); 2535 } 2536 } 2537 if(pOutSet) 2538 { 2539 rReq.Done(*pOutSet); 2540 bDone = true; 2541 } 2542 delete pDlg; 2543 } 2544 break; 2545 case FN_FORMAT_BACKGROUND_DLG: 2546 { 2547 SfxItemSet aSet( rSh.GetAttrPool(), 2548 RES_BACKGROUND, RES_BACKGROUND ); 2549 2550 SfxAbstractDialog * pDlg = 0; 2551 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 2552 DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); 2553 2554 2555 // Tabellenzelle(n) selektiert? 2556 if ( rSh.IsTableMode() ) 2557 { 2558 //Hintergrundattribute der Tabelle holen und in den Set packen 2559 SvxBrushItem aBrush(RES_BACKGROUND); 2560 rSh.GetBoxBackground( aBrush ); 2561 pDlg = pFact->CreateSfxDialog( pMDI, aSet, 2562 rView.GetViewFrame()->GetFrame().GetFrameInterface(), 2563 RC_SWDLG_BACKGROUND ); 2564 DBG_ASSERT(pDlg, "Dialogdiet fail!"); 2565 aSet.Put( aBrush ); 2566 if ( pDlg->Execute() == RET_OK ) 2567 { 2568 //aBrush = (SvxBrushItem) pDlg->GetOutputItemSet()->Get( RES_BACKGROUND ); 2569 2570 rSh.SetBoxBackground( (SvxBrushItem&) 2571 pDlg->GetOutputItemSet()->Get( RES_BACKGROUND )); 2572 pOutSet = pDlg->GetOutputItemSet(); 2573 } 2574 } 2575 else if ( rSh.IsFrmSelected() ) 2576 { 2577 2578 rSh.GetFlyFrmAttr( aSet ); 2579 2580 pDlg = pFact->CreateSfxDialog( pMDI, aSet, 2581 rView.GetViewFrame()->GetFrame().GetFrameInterface(), 2582 RC_SWDLG_BACKGROUND ); 2583 DBG_ASSERT(pDlg, "Dialogdiet fail!"); 2584 if ( pDlg->Execute() == RET_OK ) 2585 { 2586 rSh.SetFlyFrmAttr((SfxItemSet &) *pDlg->GetOutputItemSet() ); 2587 pOutSet = pDlg->GetOutputItemSet(); 2588 } 2589 } 2590 else 2591 { 2592 // Umrandungsattribute ganz normal ueber Shell setzen 2593 rSh.GetCurAttr( aSet ); 2594 2595 pDlg = pFact->CreateSfxDialog( pMDI, aSet, 2596 rView.GetViewFrame()->GetFrame().GetFrameInterface(), 2597 RC_SWDLG_BACKGROUND ); 2598 DBG_ASSERT(pDlg, "Dialogdiet fail!"); 2599 if ( pDlg->Execute() == RET_OK ) 2600 { 2601 rSh.SetAttr( *pDlg->GetOutputItemSet() ); 2602 pOutSet = pDlg->GetOutputItemSet(); 2603 } 2604 } 2605 if(pOutSet) 2606 { 2607 rReq.Done(*pOutSet); 2608 bDone = true; 2609 } 2610 delete pDlg; 2611 2612 } 2613 break; 2614 default:DBG_ERROR("falscher Dispatcher (basesh.cxx)"); 2615 } 2616 if(!bDone) 2617 rReq.Done(); 2618 } 2619 2620 // ---------------------------------------------------------------------------- 2621 2622 2623 SwWrtShell& SwBaseShell::GetShell() 2624 { 2625 return rView.GetWrtShell(); 2626 } 2627 2628 // ---------------------------------------------------------------------------- 2629 2630 SwWrtShell* SwBaseShell::GetShellPtr() 2631 { 2632 return rView.GetWrtShellPtr(); 2633 } 2634 2635 // ---------------------------------------------------------------------------- 2636 2637 void SwBaseShell::InsertTable( SfxRequest& _rRequest ) 2638 { 2639 const SfxItemSet* pArgs = _rRequest.GetArgs(); 2640 SwWrtShell& rSh = GetShell(); 2641 2642 if ( !( rSh.GetFrmType( 0, sal_True ) & FRMTYPE_FOOTNOTE ) ) 2643 { 2644 SwView &rTempView = GetView(); // Da GetView() nach Shellwechsel nicht mehr geht 2645 sal_Bool bHTMLMode = 0 != (::GetHtmlMode(rTempView.GetDocShell())&HTMLMODE_ON); 2646 sal_Bool bCallEndUndo = sal_False; 2647 2648 if( !pArgs && rSh.IsSelection() && !rSh.IsInClickToEdit() && 2649 !rSh.IsTableMode() ) 2650 { 2651 const SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig(); 2652 SwInsertTableOptions aInsTblOpts = pModOpt->GetInsTblFlags(bHTMLMode); 2653 2654 rSh.StartUndo(UNDO_INSTABLE); 2655 bCallEndUndo = sal_True; 2656 2657 sal_Bool bInserted = rSh.TextToTable( aInsTblOpts, '\t', text::HoriOrientation::FULL ); 2658 rSh.EnterStdMode(); 2659 if (bInserted) 2660 rTempView.AutoCaption(TABLE_CAP); 2661 _rRequest.Done(); 2662 } 2663 else 2664 { 2665 sal_uInt16 nCols = 0; 2666 sal_uInt16 nRows = 0; 2667 SwInsertTableOptions aInsTblOpts( tabopts::ALL_TBL_INS_ATTR, 1 ); 2668 String aTableName, aAutoName; 2669 SwTableAutoFmt* pTAFmt = 0; 2670 2671 if( pArgs && pArgs->Count() >= 2 ) 2672 { 2673 SFX_REQUEST_ARG( _rRequest, pName, SfxStringItem, FN_INSERT_TABLE, sal_False ); 2674 SFX_REQUEST_ARG( _rRequest, pCols, SfxUInt16Item, SID_ATTR_TABLE_COLUMN, sal_False ); 2675 SFX_REQUEST_ARG( _rRequest, pRows, SfxUInt16Item, SID_ATTR_TABLE_ROW, sal_False ); 2676 SFX_REQUEST_ARG( _rRequest, pFlags, SfxInt32Item, FN_PARAM_1, sal_False ); 2677 SFX_REQUEST_ARG( _rRequest, pAuto, SfxStringItem, FN_PARAM_2, sal_False ); 2678 2679 if ( pName ) 2680 aTableName = pName->GetValue(); 2681 if ( pCols ) 2682 nCols = pCols->GetValue(); 2683 if ( pRows ) 2684 nRows = pRows->GetValue(); 2685 if ( pAuto ) 2686 { 2687 aAutoName = pAuto->GetValue(); 2688 if ( aAutoName.Len() ) 2689 { 2690 SwTableAutoFmtTbl aTableTbl; 2691 aTableTbl.Load(); 2692 for ( sal_uInt16 n=0; n<aTableTbl.Count(); n++ ) 2693 { 2694 if ( aTableTbl[n]->GetName() == aAutoName ) 2695 { 2696 pTAFmt = new SwTableAutoFmt( *aTableTbl[n] ); 2697 break; 2698 } 2699 } 2700 } 2701 } 2702 2703 if ( pFlags ) 2704 aInsTblOpts.mnInsMode = (sal_uInt16) pFlags->GetValue(); 2705 else 2706 { 2707 const SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig(); 2708 aInsTblOpts = pModOpt->GetInsTblFlags(bHTMLMode); 2709 } 2710 } 2711 2712 if( !nCols || !nRows ) 2713 { 2714 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 2715 DBG_ASSERT(pFact, "Dialogdiet fail!"); 2716 AbstractInsTableDlg* pDlg = pFact->CreateInsTableDlg( DLG_INSERT_TABLE, rTempView ); 2717 DBG_ASSERT(pDlg, "Dialogdiet fail!"); 2718 if( RET_OK == pDlg->Execute() ) 2719 { 2720 pDlg->GetValues( aTableName, nRows, nCols, aInsTblOpts, aAutoName, pTAFmt ); 2721 } 2722 else 2723 _rRequest.Ignore(); 2724 delete pDlg; 2725 } 2726 2727 if( nCols && nRows ) 2728 { 2729 // record before shell change 2730 _rRequest.AppendItem( SfxStringItem( FN_INSERT_TABLE, aTableName ) ); 2731 if ( aAutoName.Len() ) 2732 _rRequest.AppendItem( SfxStringItem( FN_PARAM_2, aAutoName ) ); 2733 _rRequest.AppendItem( SfxUInt16Item( SID_ATTR_TABLE_COLUMN, nCols ) ); 2734 _rRequest.AppendItem( SfxUInt16Item( SID_ATTR_TABLE_ROW, nRows ) ); 2735 _rRequest.AppendItem( SfxInt32Item( FN_PARAM_1, (sal_Int32) aInsTblOpts.mnInsMode ) ); 2736 _rRequest.Done(); 2737 2738 rSh.StartUndo(UNDO_INSTABLE); 2739 bCallEndUndo = sal_True; 2740 2741 rSh.StartAllAction(); 2742 if( rSh.HasSelection() ) 2743 rSh.DelRight(); 2744 2745 rSh.InsertTable( aInsTblOpts, nRows, nCols, text::HoriOrientation::FULL, pTAFmt ); 2746 rSh.MoveTable( fnTablePrev, fnTableStart ); 2747 2748 if( aTableName.Len() && !rSh.GetTblStyle( aTableName ) ) 2749 rSh.GetTableFmt()->SetName( aTableName ); 2750 2751 rSh.EndAllAction(); 2752 rTempView.AutoCaption(TABLE_CAP); 2753 } 2754 delete pTAFmt; 2755 } 2756 2757 if( bCallEndUndo ) 2758 { 2759 SwRewriter aRewriter; 2760 2761 if (rSh.GetTableFmt()) 2762 { 2763 aRewriter.AddRule(UNDO_ARG1, SW_RES(STR_START_QUOTE)); 2764 aRewriter.AddRule(UNDO_ARG2, rSh.GetTableFmt()->GetName()); 2765 aRewriter.AddRule(UNDO_ARG3, SW_RES(STR_END_QUOTE)); 2766 2767 } 2768 rSh.EndUndo(UNDO_INSTABLE, &aRewriter); // wegen moegl. Shellwechsel 2769 } 2770 } 2771 } 2772 2773 // ---------------------------------------------------------------------------- 2774 2775 void SwBaseShell::GetGalleryState( SfxItemSet &rSet ) 2776 { 2777 SwWrtShell &rSh = GetShell(); 2778 SfxWhichIter aIter( rSet ); 2779 sal_uInt16 nWhich = aIter.FirstWhich(); 2780 switch ( nWhich ) 2781 { 2782 case SID_GALLERY_BG_BRUSH: 2783 { 2784 int nSel = rSh.GetSelectionType(); 2785 SfxStringListItem aLst( nWhich ); 2786 List *pLst = aLst.GetList(); 2787 nParagraphPos = nGraphicPos = nOlePos = nFramePos = nTablePos = 2788 nTableRowPos = nTableCellPos = nPagePos = 2789 nHeaderPos = nFooterPos = 0; 2790 sal_uInt8 nPos = 1; 2791 pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_PAGE ), pLst->Count() ); 2792 nPagePos = nPos++; 2793 sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell()); 2794 sal_Bool bHtmlMode = 0 != (nHtmlMode & HTMLMODE_ON); 2795 2796 if ( (!bHtmlMode || (nHtmlMode & HTMLMODE_FULL_STYLES)) && 2797 (nSel & nsSelectionType::SEL_TXT) ) 2798 { 2799 pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_PARAGRAPH ), pLst->Count() ); 2800 nParagraphPos = nPos++; 2801 } 2802 if ( (!bHtmlMode || (nHtmlMode & HTMLMODE_SOME_STYLES)) && 2803 nSel & (nsSelectionType::SEL_TBL|nsSelectionType::SEL_TBL_CELLS) ) 2804 { 2805 pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_TABLE ), pLst->Count() ); 2806 nTablePos = nPos++; 2807 2808 if(!bHtmlMode) 2809 { 2810 pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_TABLE_ROW ), pLst->Count() ); 2811 nTableRowPos = nPos++; 2812 } 2813 2814 pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_TABLE_CELL), pLst->Count() ); 2815 nTableCellPos = nPos++; 2816 } 2817 if(!bHtmlMode) 2818 { 2819 if ( nSel & nsSelectionType::SEL_FRM ) 2820 { 2821 pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_FRAME ), pLst->Count() ); 2822 nFramePos = nPos++; 2823 } 2824 if ( nSel & nsSelectionType::SEL_GRF ) 2825 { 2826 pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_GRAPHIC ), pLst->Count() ); 2827 nGraphicPos = nPos++; 2828 } 2829 if ( nSel & nsSelectionType::SEL_OLE ) 2830 { 2831 pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_OLE ), pLst->Count() ); 2832 nOlePos = nPos++; 2833 } 2834 const sal_uInt16 nType = rSh.GetFrmType(0,sal_True); 2835 if ( nType & FRMTYPE_HEADER ) 2836 { 2837 pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_HEADER ), pLst->Count() ); 2838 nHeaderPos = nPos++; 2839 } 2840 if ( nType & FRMTYPE_FOOTER ) 2841 { 2842 pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_FOOTER ), pLst->Count() ); 2843 nFooterPos = nPos; 2844 } 2845 } 2846 if ( pLst->Count() ) 2847 rSet.Put( aLst ); 2848 else 2849 rSet.DisableItem( nWhich ); 2850 break; 2851 } 2852 } 2853 } 2854 2855 2856 void SwBaseShell::ExecuteGallery(SfxRequest &rReq) 2857 { 2858 SwWrtShell &rSh = GetShell(); 2859 rSh.StartAction(); 2860 const SfxItemSet* pArgs = rReq.GetArgs(); 2861 sal_uInt16 nSlot = rReq.GetSlot(); 2862 switch(nSlot) 2863 { 2864 case SID_GALLERY_BG_BRUSH: 2865 { 2866 if ( !pArgs ) 2867 break; 2868 2869 int nSel = rSh.GetSelectionType(); 2870 if ( nSel & nsSelectionType::SEL_DRW_TXT ) 2871 break; 2872 2873 SFX_REQUEST_ARG( rReq, pPos, SfxUInt16Item, SID_GALLERY_BG_POS, sal_False ); 2874 SFX_REQUEST_ARG( rReq, pBrush, SvxBrushItem, SID_GALLERY_BG_BRUSH, sal_False ); 2875 if ( !pPos || !pBrush ) 2876 break; 2877 2878 sal_uInt8 nPos = pPos->GetValue(); 2879 ++nPos; 2880 2881 SvxBrushItem aBrush( *pBrush ); 2882 aBrush.SetWhich( RES_BACKGROUND ); 2883 if ( nPos == nParagraphPos ) 2884 rSh.SetAttr( aBrush ); 2885 else if ( nPos == nTablePos ) 2886 rSh.SetTabBackground( aBrush ); 2887 else if ( nPos == nTableRowPos ) 2888 rSh.SetRowBackground( aBrush ); 2889 else if ( nPos == nTableCellPos ) 2890 rSh.SetBoxBackground( aBrush ); 2891 else if ( nPos == nFramePos || nPos == nGraphicPos || nPos == nOlePos ) 2892 { 2893 SfxItemSet aCoreSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND); 2894 aCoreSet.Put( aBrush ); 2895 rSh.SetFlyFrmAttr( aCoreSet ); 2896 } 2897 else if ( nPos == nPagePos || nPos == nHeaderPos || nPos == nFooterPos ) 2898 { 2899 sal_uInt16 nDesc = rSh.GetCurPageDesc(); 2900 SwPageDesc aDesc( rSh.GetPageDesc( nDesc ) ); 2901 if ( nPos == nPagePos ) 2902 aDesc.GetMaster().SetFmtAttr( aBrush ); 2903 else if ( nPos == nHeaderPos ) 2904 { 2905 SwFmtHeader aHead( aDesc.GetMaster().GetHeader() ); 2906 aHead.GetHeaderFmt()->SetFmtAttr( aBrush ); 2907 aDesc.GetMaster().SetFmtAttr( aHead ); 2908 } 2909 else if ( nPos == nFooterPos ) 2910 { 2911 SwFmtFooter aFoot( aDesc.GetMaster().GetFooter() ); 2912 aFoot.GetFooterFmt()->SetFmtAttr( aBrush ); 2913 aDesc.GetMaster().SetFmtAttr( aFoot ); 2914 } 2915 rSh.ChgPageDesc( nDesc, aDesc ); 2916 } 2917 break; 2918 } 2919 } 2920 rSh.EndAction(); 2921 rReq.Done(); 2922 } 2923 2924 void SwBaseShell::ExecField( SfxRequest& rReq ) 2925 { 2926 sal_uInt16 nSlot = rReq.GetSlot(); 2927 switch( nSlot ) 2928 { 2929 case FN_CHANGE_DBFIELD: 2930 { 2931 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 2932 DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); 2933 2934 VclAbstractDialog* pDlg = pFact->CreateSwChangeDBDlg(GetView(), DLG_CHANGE_DB ); 2935 DBG_ASSERT(pDlg, "Dialogdiet fail!"); 2936 pDlg->Execute(); 2937 delete pDlg; 2938 } 2939 break; 2940 default: 2941 ASSERT(sal_False, falscher Dispatcher); 2942 } 2943 } 2944 2945