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