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