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