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