LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sw/source/ui/shells - basesh.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 189 1454 13.0 %
Date: 2013-07-09 Functions: 19 42 45.2 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10