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