1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_sw.hxx" 30*cdf0e10cSrcweir #include <hintids.hxx> 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir #ifndef _ZFORLIST_HXX 33*cdf0e10cSrcweir #define _ZFORLIST_DECLARE_TABLE 34*cdf0e10cSrcweir #include <svl/zforlist.hxx> 35*cdf0e10cSrcweir #endif 36*cdf0e10cSrcweir #include <svl/stritem.hxx> 37*cdf0e10cSrcweir #include <svl/whiter.hxx> 38*cdf0e10cSrcweir #include <unotools/moduleoptions.hxx> 39*cdf0e10cSrcweir #include <svx/rulritem.hxx> 40*cdf0e10cSrcweir #include <svl/srchitem.hxx> 41*cdf0e10cSrcweir #include <editeng/lrspitem.hxx> 42*cdf0e10cSrcweir #include <editeng/ulspitem.hxx> 43*cdf0e10cSrcweir #include <editeng/brshitem.hxx> 44*cdf0e10cSrcweir #include <editeng/boxitem.hxx> 45*cdf0e10cSrcweir #include <editeng/shaditem.hxx> 46*cdf0e10cSrcweir #include <editeng/spltitem.hxx> 47*cdf0e10cSrcweir #include <editeng/langitem.hxx> 48*cdf0e10cSrcweir #include <editeng/keepitem.hxx> 49*cdf0e10cSrcweir #include <editeng/bolnitem.hxx> 50*cdf0e10cSrcweir #include <editeng/colritem.hxx> 51*cdf0e10cSrcweir #include <editeng/frmdiritem.hxx> 52*cdf0e10cSrcweir #include <svx/numinf.hxx> 53*cdf0e10cSrcweir #include <svx/svddef.hxx> 54*cdf0e10cSrcweir #include <svx/svxdlg.hxx> 55*cdf0e10cSrcweir #include <svl/zformat.hxx> 56*cdf0e10cSrcweir #include <sfx2/bindings.hxx> 57*cdf0e10cSrcweir #include <vcl/msgbox.hxx> 58*cdf0e10cSrcweir #include <sfx2/request.hxx> 59*cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 60*cdf0e10cSrcweir #include <sfx2/objface.hxx> 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir #include <fmtornt.hxx> 64*cdf0e10cSrcweir #include <fmtclds.hxx> 65*cdf0e10cSrcweir #include <fmtlsplt.hxx> 66*cdf0e10cSrcweir #include <fmtrowsplt.hxx> 67*cdf0e10cSrcweir #include <fmtfsize.hxx> 68*cdf0e10cSrcweir #include <swmodule.hxx> 69*cdf0e10cSrcweir #include <wrtsh.hxx> 70*cdf0e10cSrcweir #include <wview.hxx> 71*cdf0e10cSrcweir #include <frmatr.hxx> 72*cdf0e10cSrcweir #include <uitool.hxx> 73*cdf0e10cSrcweir #include <inputwin.hxx> 74*cdf0e10cSrcweir #include <uiitems.hxx> 75*cdf0e10cSrcweir #include <usrpref.hxx> 76*cdf0e10cSrcweir #include <tabsh.hxx> 77*cdf0e10cSrcweir #include "swtablerep.hxx" 78*cdf0e10cSrcweir #include <tablemgr.hxx> 79*cdf0e10cSrcweir #include <cellatr.hxx> 80*cdf0e10cSrcweir #include <frmfmt.hxx> 81*cdf0e10cSrcweir #include <swundo.hxx> 82*cdf0e10cSrcweir #include <swtable.hxx> 83*cdf0e10cSrcweir #include <docsh.hxx> 84*cdf0e10cSrcweir #include <tblsel.hxx> 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir #include <dialog.hrc> 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir //!!! new: insert table 91*cdf0e10cSrcweir /* 92*cdf0e10cSrcweir #include <svx/htmlmode.hxx> 93*cdf0e10cSrcweir #include <modcfg.hxx> 94*cdf0e10cSrcweir #include <tblafmt.hxx> 95*cdf0e10cSrcweir #include <instable.hxx> 96*cdf0e10cSrcweir */ 97*cdf0e10cSrcweir //!!! 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir #ifndef _POPUP_HRC 100*cdf0e10cSrcweir #include <popup.hrc> 101*cdf0e10cSrcweir #endif 102*cdf0e10cSrcweir #ifndef _SHELLS_HRC 103*cdf0e10cSrcweir #include <shells.hrc> 104*cdf0e10cSrcweir #endif 105*cdf0e10cSrcweir #ifndef _TABLE_HRC 106*cdf0e10cSrcweir #include <table.hrc> 107*cdf0e10cSrcweir #endif 108*cdf0e10cSrcweir #include <cmdid.h> 109*cdf0e10cSrcweir #ifndef _GLOBALS_HRC 110*cdf0e10cSrcweir #include <globals.hrc> 111*cdf0e10cSrcweir #endif 112*cdf0e10cSrcweir #include <helpid.h> 113*cdf0e10cSrcweir #include <unobaseclass.hxx> 114*cdf0e10cSrcweir 115*cdf0e10cSrcweir #define SwTableShell 116*cdf0e10cSrcweir #include <sfx2/msg.hxx> 117*cdf0e10cSrcweir #include <swslots.hxx> 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir #include "swabstdlg.hxx" 120*cdf0e10cSrcweir #include <table.hrc> 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir using namespace ::com::sun::star; 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir //----------------------------------------------------------------------------- 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir SFX_IMPL_INTERFACE(SwTableShell, SwBaseShell, SW_RES(STR_SHELLNAME_TABLE)) 127*cdf0e10cSrcweir { 128*cdf0e10cSrcweir SFX_POPUPMENU_REGISTRATION(SW_RES(MN_TAB_POPUPMENU)); 129*cdf0e10cSrcweir SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_TABLE_TOOLBOX)); 130*cdf0e10cSrcweir } 131*cdf0e10cSrcweir 132*cdf0e10cSrcweir 133*cdf0e10cSrcweir TYPEINIT1(SwTableShell,SwBaseShell) 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir /************************************************************************/ 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir const sal_uInt16 __FAR_DATA aUITableAttrRange[] = 138*cdf0e10cSrcweir { 139*cdf0e10cSrcweir FN_PARAM_TABLE_NAME, FN_PARAM_TABLE_NAME, 140*cdf0e10cSrcweir FN_PARAM_TABLE_HEADLINE, FN_PARAM_TABLE_HEADLINE, 141*cdf0e10cSrcweir FN_PARAM_TABLE_SPACE, FN_PARAM_TABLE_SPACE, 142*cdf0e10cSrcweir FN_TABLE_REP, FN_TABLE_REP, 143*cdf0e10cSrcweir SID_RULER_BORDERS, SID_RULER_BORDERS, 144*cdf0e10cSrcweir RES_LR_SPACE, RES_UL_SPACE, 145*cdf0e10cSrcweir SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_SHADOW, 146*cdf0e10cSrcweir RES_BOX, RES_SHADOW, 147*cdf0e10cSrcweir RES_BACKGROUND, RES_BACKGROUND, 148*cdf0e10cSrcweir SID_BACKGRND_DESTINATION, SID_BACKGRND_DESTINATION, 149*cdf0e10cSrcweir SID_HTML_MODE, SID_HTML_MODE, 150*cdf0e10cSrcweir SID_ATTR_BRUSH_ROW, SID_ATTR_BRUSH_TABLE, 151*cdf0e10cSrcweir RES_PAGEDESC, RES_BREAK, 152*cdf0e10cSrcweir RES_KEEP, RES_KEEP, 153*cdf0e10cSrcweir RES_LAYOUT_SPLIT, RES_LAYOUT_SPLIT, 154*cdf0e10cSrcweir FN_TABLE_SET_VERT_ALIGN, FN_TABLE_SET_VERT_ALIGN, 155*cdf0e10cSrcweir RES_FRAMEDIR, RES_FRAMEDIR, 156*cdf0e10cSrcweir RES_ROW_SPLIT, RES_ROW_SPLIT, 157*cdf0e10cSrcweir FN_TABLE_BOX_TEXTDIRECTION, FN_TABLE_BOX_TEXTDIRECTION, 158*cdf0e10cSrcweir // --> collapsing borders FME 2005-05-27 #i29550# 159*cdf0e10cSrcweir RES_COLLAPSING_BORDERS, RES_COLLAPSING_BORDERS, 160*cdf0e10cSrcweir // <-- collapsing borders 161*cdf0e10cSrcweir 0 162*cdf0e10cSrcweir }; 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir const sal_uInt16* SwuiGetUITableAttrRange() 165*cdf0e10cSrcweir { 166*cdf0e10cSrcweir return aUITableAttrRange; 167*cdf0e10cSrcweir } 168*cdf0e10cSrcweir 169*cdf0e10cSrcweir static void lcl_SetAttr( SwWrtShell &rSh, const SfxPoolItem &rItem ) 170*cdf0e10cSrcweir { 171*cdf0e10cSrcweir SfxItemSet aSet( rSh.GetView().GetPool(), rItem.Which(), rItem.Which(), 0); 172*cdf0e10cSrcweir aSet.Put( rItem ); 173*cdf0e10cSrcweir rSh.SetTblAttr( aSet ); 174*cdf0e10cSrcweir } 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir /************************************************************************/ 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir 179*cdf0e10cSrcweir static SwTableRep* lcl_TableParamToItemSet( SfxItemSet& rSet, SwWrtShell &rSh ) 180*cdf0e10cSrcweir { 181*cdf0e10cSrcweir SwFrmFmt *pFmt = rSh.GetTableFmt(); 182*cdf0e10cSrcweir SwTabCols aCols; 183*cdf0e10cSrcweir rSh.GetTabCols( aCols ); 184*cdf0e10cSrcweir 185*cdf0e10cSrcweir //Ersteinmal die einfachen Attribute besorgen. 186*cdf0e10cSrcweir rSet.Put( SfxStringItem( FN_PARAM_TABLE_NAME, pFmt->GetName())); 187*cdf0e10cSrcweir rSet.Put( SfxUInt16Item( FN_PARAM_TABLE_HEADLINE, rSh.GetRowsToRepeat() ) ); 188*cdf0e10cSrcweir rSet.Put( pFmt->GetShadow() ); 189*cdf0e10cSrcweir rSet.Put(SfxUInt16Item(FN_TABLE_SET_VERT_ALIGN, rSh.GetBoxAlign())); 190*cdf0e10cSrcweir rSet.Put( pFmt->GetFrmDir() ); 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir SvxULSpaceItem aULSpace( pFmt->GetULSpace() ); 193*cdf0e10cSrcweir rSet.Put( aULSpace ); 194*cdf0e10cSrcweir 195*cdf0e10cSrcweir sal_uInt16 nBackgroundDestination = rSh.GetViewOptions()->GetTblDest(); 196*cdf0e10cSrcweir rSet.Put(SwBackgroundDestinationItem(SID_BACKGRND_DESTINATION, nBackgroundDestination )); 197*cdf0e10cSrcweir SvxBrushItem aBrush( RES_BACKGROUND ); 198*cdf0e10cSrcweir // rSh.GetBoxBackground(aBrush); 199*cdf0e10cSrcweir // rSet.Put( aBrush ); 200*cdf0e10cSrcweir if(rSh.GetRowBackground(aBrush)) 201*cdf0e10cSrcweir rSet.Put( aBrush, SID_ATTR_BRUSH_ROW ); 202*cdf0e10cSrcweir else 203*cdf0e10cSrcweir rSet.InvalidateItem(SID_ATTR_BRUSH_ROW); 204*cdf0e10cSrcweir rSh.GetTabBackground(aBrush); 205*cdf0e10cSrcweir rSet.Put( aBrush, SID_ATTR_BRUSH_TABLE ); 206*cdf0e10cSrcweir 207*cdf0e10cSrcweir // text direction in boxes 208*cdf0e10cSrcweir SvxFrameDirectionItem aBoxDirection( FRMDIR_ENVIRONMENT, RES_FRAMEDIR ); 209*cdf0e10cSrcweir if(rSh.GetBoxDirection( aBoxDirection )) 210*cdf0e10cSrcweir rSet.Put(aBoxDirection, FN_TABLE_BOX_TEXTDIRECTION); 211*cdf0e10cSrcweir 212*cdf0e10cSrcweir sal_Bool bTableSel = rSh.IsTableMode(); 213*cdf0e10cSrcweir if(!bTableSel) 214*cdf0e10cSrcweir { 215*cdf0e10cSrcweir rSh.StartAllAction(); 216*cdf0e10cSrcweir rSh.Push(); 217*cdf0e10cSrcweir rSh.GetView().GetViewFrame()->GetDispatcher()->Execute( FN_TABLE_SELECT_ALL, sal_False ); 218*cdf0e10cSrcweir } 219*cdf0e10cSrcweir SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER ); 220*cdf0e10cSrcweir 221*cdf0e10cSrcweir // Tabellenvariante, wenn mehrere Tabellenzellen selektiert 222*cdf0e10cSrcweir rSh.GetCrsr(); //Damit GetCrsrCnt() auch das Richtige liefert 223*cdf0e10cSrcweir aBoxInfo.SetTable ((rSh.IsTableMode() && rSh.GetCrsrCnt() > 1) || 224*cdf0e10cSrcweir !bTableSel); 225*cdf0e10cSrcweir // Abstandsfeld immer anzeigen 226*cdf0e10cSrcweir aBoxInfo.SetDist ((sal_Bool) sal_True); 227*cdf0e10cSrcweir // Minimalgroesse in Tabellen und Absaetzen setzen 228*cdf0e10cSrcweir aBoxInfo.SetMinDist( !bTableSel || rSh.IsTableMode() || 229*cdf0e10cSrcweir rSh.GetSelectionType() & 230*cdf0e10cSrcweir (nsSelectionType::SEL_TXT | nsSelectionType::SEL_TBL)); 231*cdf0e10cSrcweir // Default-Abstand immer setzen 232*cdf0e10cSrcweir aBoxInfo.SetDefDist (MIN_BORDER_DIST); 233*cdf0e10cSrcweir // Einzelne Linien koennen nur in Tabellen DontCare-Status haben 234*cdf0e10cSrcweir aBoxInfo.SetValid( VALID_DISABLE, !bTableSel || !rSh.IsTableMode() ); 235*cdf0e10cSrcweir 236*cdf0e10cSrcweir rSet.Put(aBoxInfo); 237*cdf0e10cSrcweir rSh.GetTabBorders( rSet ); 238*cdf0e10cSrcweir 239*cdf0e10cSrcweir //row split 240*cdf0e10cSrcweir SwFmtRowSplit* pSplit = 0; 241*cdf0e10cSrcweir rSh.GetRowSplit(pSplit); 242*cdf0e10cSrcweir if(pSplit) 243*cdf0e10cSrcweir { 244*cdf0e10cSrcweir rSet.Put(*pSplit); 245*cdf0e10cSrcweir delete pSplit; 246*cdf0e10cSrcweir } 247*cdf0e10cSrcweir 248*cdf0e10cSrcweir if(!bTableSel) 249*cdf0e10cSrcweir { 250*cdf0e10cSrcweir rSh.ClearMark(); 251*cdf0e10cSrcweir rSh.Pop(sal_False); 252*cdf0e10cSrcweir rSh.EndAllAction(); 253*cdf0e10cSrcweir } 254*cdf0e10cSrcweir 255*cdf0e10cSrcweir SwTabCols aTabCols; 256*cdf0e10cSrcweir rSh.GetTabCols( aTabCols ); 257*cdf0e10cSrcweir SvxColumnItem aColItem; 258*cdf0e10cSrcweir 259*cdf0e10cSrcweir 260*cdf0e10cSrcweir // Pointer wird nach der Dialogausfuehrung geloescht 261*cdf0e10cSrcweir SwTableRep* pRep = new SwTableRep( aTabCols, rSh.IsTblComplex()); 262*cdf0e10cSrcweir pRep->SetSpace(aCols.GetRightMax()); 263*cdf0e10cSrcweir 264*cdf0e10cSrcweir sal_uInt16 nPercent = 0; 265*cdf0e10cSrcweir long nWidth = ::GetTableWidth(pFmt, aCols, &nPercent, &rSh ); 266*cdf0e10cSrcweir // Die Tabellenbreite ist fuer relative Angaben nicht korrekt 267*cdf0e10cSrcweir if(nPercent) 268*cdf0e10cSrcweir nWidth = pRep->GetSpace() * nPercent / 100; 269*cdf0e10cSrcweir sal_uInt16 nAlign = pFmt->GetHoriOrient().GetHoriOrient(); 270*cdf0e10cSrcweir pRep->SetAlign(nAlign); 271*cdf0e10cSrcweir SvxLRSpaceItem aLRSpace( pFmt->GetLRSpace() ); 272*cdf0e10cSrcweir SwTwips nLeft = aLRSpace.GetLeft(); 273*cdf0e10cSrcweir SwTwips nRight = aLRSpace.GetRight(); 274*cdf0e10cSrcweir SwTwips nDiff = pRep->GetSpace() - nRight - nLeft - nWidth; 275*cdf0e10cSrcweir if(nAlign != text::HoriOrientation::FULL && Abs(nDiff) > 2) 276*cdf0e10cSrcweir { 277*cdf0e10cSrcweir SwTwips nLR = pRep->GetSpace() - nWidth; 278*cdf0e10cSrcweir switch ( nAlign ) 279*cdf0e10cSrcweir { 280*cdf0e10cSrcweir case text::HoriOrientation::CENTER: nLeft = nRight = nLR / 2; 281*cdf0e10cSrcweir break; 282*cdf0e10cSrcweir case text::HoriOrientation::LEFT: nRight = nLR; nLeft = 0; 283*cdf0e10cSrcweir break; 284*cdf0e10cSrcweir case text::HoriOrientation::RIGHT: nLeft = nLR, nRight = 0; 285*cdf0e10cSrcweir break; 286*cdf0e10cSrcweir case text::HoriOrientation::LEFT_AND_WIDTH: 287*cdf0e10cSrcweir nRight = nLR - nLeft; 288*cdf0e10cSrcweir break; 289*cdf0e10cSrcweir case text::HoriOrientation::NONE: 290*cdf0e10cSrcweir if(!nPercent) 291*cdf0e10cSrcweir nWidth = pRep->GetSpace() - nLeft - nRight; 292*cdf0e10cSrcweir break; 293*cdf0e10cSrcweir } 294*cdf0e10cSrcweir } 295*cdf0e10cSrcweir pRep->SetLeftSpace(nLeft); 296*cdf0e10cSrcweir pRep->SetRightSpace(nRight); 297*cdf0e10cSrcweir 298*cdf0e10cSrcweir pRep->SetWidth(nWidth); 299*cdf0e10cSrcweir pRep->SetWidthPercent(nPercent); 300*cdf0e10cSrcweir // sind einzelne Zeilen/Zellen selektiert, wird die Spaltenbearbeitung veraendert 301*cdf0e10cSrcweir pRep->SetLineSelected(bTableSel && ! rSh.HasWholeTabSelection()); 302*cdf0e10cSrcweir rSet.Put(SwPtrItem(FN_TABLE_REP, pRep)); 303*cdf0e10cSrcweir return pRep; 304*cdf0e10cSrcweir } 305*cdf0e10cSrcweir 306*cdf0e10cSrcweir /************************************************************************/ 307*cdf0e10cSrcweir 308*cdf0e10cSrcweir 309*cdf0e10cSrcweir void ItemSetToTableParam( const SfxItemSet& rSet, 310*cdf0e10cSrcweir SwWrtShell &rSh ) 311*cdf0e10cSrcweir { 312*cdf0e10cSrcweir rSh.StartAllAction(); 313*cdf0e10cSrcweir rSh.StartUndo( UNDO_TABLE_ATTR ); 314*cdf0e10cSrcweir const SfxPoolItem* pItem = 0; 315*cdf0e10cSrcweir 316*cdf0e10cSrcweir SwViewOption aUsrPref( *rSh.GetViewOptions() ); 317*cdf0e10cSrcweir sal_uInt16 nBackgroundDestination = aUsrPref.GetTblDest(); 318*cdf0e10cSrcweir if(SFX_ITEM_SET == rSet.GetItemState(SID_BACKGRND_DESTINATION, sal_False, &pItem)) 319*cdf0e10cSrcweir { 320*cdf0e10cSrcweir nBackgroundDestination = ((SfxUInt16Item*)pItem)->GetValue(); 321*cdf0e10cSrcweir aUsrPref.SetTblDest((sal_uInt8)nBackgroundDestination); 322*cdf0e10cSrcweir SW_MOD()->ApplyUsrPref(aUsrPref, &rSh.GetView()); 323*cdf0e10cSrcweir } 324*cdf0e10cSrcweir sal_Bool bBorder = ( SFX_ITEM_SET == rSet.GetItemState( RES_BOX ) || 325*cdf0e10cSrcweir SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_BORDER_INNER ) ); 326*cdf0e10cSrcweir pItem = 0; 327*cdf0e10cSrcweir sal_Bool bBackground = SFX_ITEM_SET == rSet.GetItemState( RES_BACKGROUND, sal_False, &pItem ); 328*cdf0e10cSrcweir const SfxPoolItem* pRowItem = 0, *pTableItem = 0; 329*cdf0e10cSrcweir bBackground |= SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_BRUSH_ROW, sal_False, &pRowItem ); 330*cdf0e10cSrcweir bBackground |= SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_BRUSH_TABLE, sal_False, &pTableItem ); 331*cdf0e10cSrcweir const SfxPoolItem* pSplit = 0; 332*cdf0e10cSrcweir sal_Bool bRowSplit = SFX_ITEM_SET == rSet.GetItemState( RES_ROW_SPLIT, sal_False, &pSplit ); 333*cdf0e10cSrcweir const SfxPoolItem* pBoxDirection = 0; 334*cdf0e10cSrcweir sal_Bool bBoxDirection = SFX_ITEM_SET == rSet.GetItemState( FN_TABLE_BOX_TEXTDIRECTION, sal_False, &pBoxDirection ); 335*cdf0e10cSrcweir if( bBackground || bBorder || bRowSplit || bBoxDirection) 336*cdf0e10cSrcweir { 337*cdf0e10cSrcweir /* 338*cdf0e10cSrcweir Die Umrandung wird auf die vorliegende Selektion angewendet 339*cdf0e10cSrcweir Liegt keine Selektion vor, wird die Tabelle vollstaendig selektiert. 340*cdf0e10cSrcweir Der Hintergrund wird immer auf den aktuellen Zustand angewendet. 341*cdf0e10cSrcweir */ 342*cdf0e10cSrcweir 343*cdf0e10cSrcweir sal_Bool bTableSel = rSh.IsTableMode(); 344*cdf0e10cSrcweir rSh.StartAllAction(); 345*cdf0e10cSrcweir 346*cdf0e10cSrcweir if(bBackground) 347*cdf0e10cSrcweir { 348*cdf0e10cSrcweir if(pItem) 349*cdf0e10cSrcweir rSh.SetBoxBackground( *(const SvxBrushItem*)pItem ); 350*cdf0e10cSrcweir if(pRowItem) 351*cdf0e10cSrcweir { 352*cdf0e10cSrcweir SvxBrushItem aBrush(*(const SvxBrushItem*)pRowItem); 353*cdf0e10cSrcweir aBrush.SetWhich(RES_BACKGROUND); 354*cdf0e10cSrcweir rSh.SetRowBackground(aBrush); 355*cdf0e10cSrcweir } 356*cdf0e10cSrcweir if(pTableItem) 357*cdf0e10cSrcweir { 358*cdf0e10cSrcweir SvxBrushItem aBrush(*(const SvxBrushItem*)pTableItem); 359*cdf0e10cSrcweir aBrush.SetWhich(RES_BACKGROUND); 360*cdf0e10cSrcweir rSh.SetTabBackground( aBrush ); 361*cdf0e10cSrcweir } 362*cdf0e10cSrcweir } 363*cdf0e10cSrcweir 364*cdf0e10cSrcweir if(bBoxDirection) 365*cdf0e10cSrcweir { 366*cdf0e10cSrcweir SvxFrameDirectionItem aDirection( FRMDIR_ENVIRONMENT, RES_FRAMEDIR ); 367*cdf0e10cSrcweir aDirection.SetValue(static_cast< const SvxFrameDirectionItem* >(pBoxDirection)->GetValue()); 368*cdf0e10cSrcweir rSh.SetBoxDirection(aDirection); 369*cdf0e10cSrcweir } 370*cdf0e10cSrcweir 371*cdf0e10cSrcweir if(bBorder || bRowSplit) 372*cdf0e10cSrcweir { 373*cdf0e10cSrcweir rSh.Push(); 374*cdf0e10cSrcweir if(!bTableSel) 375*cdf0e10cSrcweir { 376*cdf0e10cSrcweir rSh.GetView().GetViewFrame()->GetDispatcher()->Execute( FN_TABLE_SELECT_ALL ); 377*cdf0e10cSrcweir } 378*cdf0e10cSrcweir if(bBorder) 379*cdf0e10cSrcweir rSh.SetTabBorders( rSet ); 380*cdf0e10cSrcweir 381*cdf0e10cSrcweir if(bRowSplit) 382*cdf0e10cSrcweir { 383*cdf0e10cSrcweir rSh.SetRowSplit(*static_cast<const SwFmtRowSplit*>(pSplit)); 384*cdf0e10cSrcweir } 385*cdf0e10cSrcweir 386*cdf0e10cSrcweir if(!bTableSel) 387*cdf0e10cSrcweir { 388*cdf0e10cSrcweir rSh.ClearMark(); 389*cdf0e10cSrcweir } 390*cdf0e10cSrcweir rSh.Pop(sal_False); 391*cdf0e10cSrcweir } 392*cdf0e10cSrcweir 393*cdf0e10cSrcweir rSh.EndAllAction(); 394*cdf0e10cSrcweir } 395*cdf0e10cSrcweir 396*cdf0e10cSrcweir SwTabCols aTabCols; 397*cdf0e10cSrcweir sal_Bool bTabCols = sal_False; 398*cdf0e10cSrcweir sal_Bool bSingleLine = sal_False; 399*cdf0e10cSrcweir SwTableRep* pRep = 0; 400*cdf0e10cSrcweir SwFrmFmt *pFmt = rSh.GetTableFmt(); 401*cdf0e10cSrcweir SfxItemSet aSet( rSh.GetAttrPool(), RES_FRMATR_BEGIN, RES_FRMATR_END-1 ); 402*cdf0e10cSrcweir if(SFX_ITEM_SET == rSet.GetItemState( FN_TABLE_REP, sal_False, &pItem )) 403*cdf0e10cSrcweir { 404*cdf0e10cSrcweir pRep = (SwTableRep*)((const SwPtrItem*)pItem)->GetValue(); 405*cdf0e10cSrcweir 406*cdf0e10cSrcweir const SwTwips nWidth = pRep->GetWidth(); 407*cdf0e10cSrcweir if ( text::HoriOrientation::FULL == pRep->GetAlign() ) 408*cdf0e10cSrcweir { 409*cdf0e10cSrcweir SwFmtHoriOrient aAttr( pFmt->GetHoriOrient() ); 410*cdf0e10cSrcweir aAttr.SetHoriOrient( text::HoriOrientation::FULL ); 411*cdf0e10cSrcweir aSet.Put( aAttr ); 412*cdf0e10cSrcweir } 413*cdf0e10cSrcweir else 414*cdf0e10cSrcweir { 415*cdf0e10cSrcweir SwFmtFrmSize aSz( ATT_VAR_SIZE, nWidth ); 416*cdf0e10cSrcweir if(pRep->GetWidthPercent()) 417*cdf0e10cSrcweir { 418*cdf0e10cSrcweir aSz.SetWidthPercent( (sal_uInt8)pRep->GetWidthPercent() ); 419*cdf0e10cSrcweir } 420*cdf0e10cSrcweir aSet.Put(aSz); 421*cdf0e10cSrcweir } 422*cdf0e10cSrcweir 423*cdf0e10cSrcweir SvxLRSpaceItem aLRSpace( RES_LR_SPACE ); 424*cdf0e10cSrcweir aLRSpace.SetLeft(pRep->GetLeftSpace()); 425*cdf0e10cSrcweir aLRSpace.SetRight(pRep->GetRightSpace()); 426*cdf0e10cSrcweir aSet.Put( aLRSpace ); 427*cdf0e10cSrcweir 428*cdf0e10cSrcweir sal_Int16 eOrient = pRep->GetAlign(); 429*cdf0e10cSrcweir SwFmtHoriOrient aAttr( 0, eOrient ); 430*cdf0e10cSrcweir aSet.Put( aAttr ); 431*cdf0e10cSrcweir // Damit beim recording die Ausrichtung nicht durch die Abstaende ueberschrieben 432*cdf0e10cSrcweir // wird, darf das Item nur bei manueller Ausrichtung aufgez. werden 433*cdf0e10cSrcweir if(eOrient != text::HoriOrientation::NONE) 434*cdf0e10cSrcweir ((SfxItemSet&)rSet).ClearItem( SID_ATTR_LRSPACE ); 435*cdf0e10cSrcweir 436*cdf0e10cSrcweir 437*cdf0e10cSrcweir if(pRep->HasColsChanged()) 438*cdf0e10cSrcweir { 439*cdf0e10cSrcweir bTabCols = sal_True; 440*cdf0e10cSrcweir } 441*cdf0e10cSrcweir } 442*cdf0e10cSrcweir 443*cdf0e10cSrcweir 444*cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_TABLE_HEADLINE, sal_False, &pItem)) 445*cdf0e10cSrcweir rSh.SetRowsToRepeat( ((SfxUInt16Item*)pItem)->GetValue() ); 446*cdf0e10cSrcweir 447*cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState( FN_TABLE_SET_VERT_ALIGN, sal_False, &pItem)) 448*cdf0e10cSrcweir rSh.SetBoxAlign(((SfxUInt16Item*)(pItem))->GetValue()); 449*cdf0e10cSrcweir 450*cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_TABLE_NAME, sal_False, &pItem )) 451*cdf0e10cSrcweir rSh.SetTableName( *pFmt, ((const SfxStringItem*)pItem)->GetValue() ); 452*cdf0e10cSrcweir 453*cdf0e10cSrcweir // kopiere die ausgesuchten Attribute in den ItemSet 454*cdf0e10cSrcweir static sal_uInt16 __READONLY_DATA aIds[] = 455*cdf0e10cSrcweir { 456*cdf0e10cSrcweir RES_PAGEDESC, 457*cdf0e10cSrcweir RES_BREAK, 458*cdf0e10cSrcweir RES_KEEP, 459*cdf0e10cSrcweir RES_LAYOUT_SPLIT, 460*cdf0e10cSrcweir RES_UL_SPACE, 461*cdf0e10cSrcweir RES_SHADOW, 462*cdf0e10cSrcweir RES_FRAMEDIR, 463*cdf0e10cSrcweir // --> collapsing borders FME 2005-05-27 #i29550# 464*cdf0e10cSrcweir RES_COLLAPSING_BORDERS, 465*cdf0e10cSrcweir // <-- collapsing borders 466*cdf0e10cSrcweir 0 467*cdf0e10cSrcweir }; 468*cdf0e10cSrcweir for( const sal_uInt16* pIds = aIds; *pIds; ++pIds ) 469*cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState( *pIds, sal_False, &pItem)) 470*cdf0e10cSrcweir aSet.Put( *pItem ); 471*cdf0e10cSrcweir 472*cdf0e10cSrcweir if( aSet.Count() ) 473*cdf0e10cSrcweir rSh.SetTblAttr( aSet ); 474*cdf0e10cSrcweir 475*cdf0e10cSrcweir if(bTabCols) 476*cdf0e10cSrcweir { 477*cdf0e10cSrcweir rSh.GetTabCols( aTabCols ); 478*cdf0e10cSrcweir bSingleLine = pRep->FillTabCols( aTabCols ); 479*cdf0e10cSrcweir rSh.SetTabCols( aTabCols, bSingleLine ); 480*cdf0e10cSrcweir } 481*cdf0e10cSrcweir 482*cdf0e10cSrcweir rSh.EndUndo( UNDO_TABLE_ATTR ); 483*cdf0e10cSrcweir rSh.EndAllAction(); 484*cdf0e10cSrcweir } 485*cdf0e10cSrcweir 486*cdf0e10cSrcweir /************************************************************************/ 487*cdf0e10cSrcweir 488*cdf0e10cSrcweir 489*cdf0e10cSrcweir static void lcl_TabGetMaxLineWidth(const SvxBorderLine* pBorderLine, SvxBorderLine& rBorderLine) 490*cdf0e10cSrcweir { 491*cdf0e10cSrcweir if(pBorderLine->GetInWidth() > rBorderLine.GetInWidth()) 492*cdf0e10cSrcweir rBorderLine.SetInWidth(pBorderLine->GetInWidth()); 493*cdf0e10cSrcweir 494*cdf0e10cSrcweir if(pBorderLine->GetOutWidth() > rBorderLine.GetOutWidth()) 495*cdf0e10cSrcweir rBorderLine.SetOutWidth(pBorderLine->GetOutWidth()); 496*cdf0e10cSrcweir 497*cdf0e10cSrcweir if(pBorderLine->GetDistance() > rBorderLine.GetDistance()) 498*cdf0e10cSrcweir rBorderLine.SetDistance(pBorderLine->GetDistance()); 499*cdf0e10cSrcweir 500*cdf0e10cSrcweir rBorderLine.SetColor(pBorderLine->GetColor()); 501*cdf0e10cSrcweir } 502*cdf0e10cSrcweir 503*cdf0e10cSrcweir 504*cdf0e10cSrcweir void SwTableShell::Execute(SfxRequest &rReq) 505*cdf0e10cSrcweir { 506*cdf0e10cSrcweir sal_Bool bUseDialog = sal_True; 507*cdf0e10cSrcweir const SfxItemSet* pArgs = rReq.GetArgs(); 508*cdf0e10cSrcweir SwWrtShell &rSh = GetShell(); 509*cdf0e10cSrcweir 510*cdf0e10cSrcweir //Erstmal die Slots, die keinen FrmMgr benoetigen. 511*cdf0e10cSrcweir sal_Bool bMore = sal_False; 512*cdf0e10cSrcweir const SfxPoolItem* pItem = 0; 513*cdf0e10cSrcweir sal_uInt16 nSlot = rReq.GetSlot(); 514*cdf0e10cSrcweir if(pArgs) 515*cdf0e10cSrcweir pArgs->GetItemState(GetPool().GetWhich(nSlot), sal_False, &pItem); 516*cdf0e10cSrcweir sal_Bool bCallDone = sal_False; 517*cdf0e10cSrcweir switch ( nSlot ) 518*cdf0e10cSrcweir { 519*cdf0e10cSrcweir case SID_ATTR_BORDER: 520*cdf0e10cSrcweir { 521*cdf0e10cSrcweir /* sal_Bool bPopCrsr = sal_False; 522*cdf0e10cSrcweir if ( !rReq.IsAPI() ) 523*cdf0e10cSrcweir { 524*cdf0e10cSrcweir //Keine Tabellenselektion -> Aenderung wird auf die gesamte 525*cdf0e10cSrcweir //Tabelle. 526*cdf0e10cSrcweir if ( !rSh.IsTableMode() ) 527*cdf0e10cSrcweir { 528*cdf0e10cSrcweir rSh.StartAction(); 529*cdf0e10cSrcweir bPopCrsr = sal_True; 530*cdf0e10cSrcweir rSh.Push(); 531*cdf0e10cSrcweir rSh.EnterStdMode(); 532*cdf0e10cSrcweir rSh.MoveTable( fnTableCurr, fnTableStart ); 533*cdf0e10cSrcweir rSh.SttSelect(); 534*cdf0e10cSrcweir rSh.MoveTable( fnTableCurr, fnTableEnd ); 535*cdf0e10cSrcweir rSh.EndSelect(); 536*cdf0e10cSrcweir } 537*cdf0e10cSrcweir }*/ 538*cdf0e10cSrcweir if(!pArgs) 539*cdf0e10cSrcweir break; 540*cdf0e10cSrcweir //Items erzeugen, weil wir sowieso nacharbeiten muessen 541*cdf0e10cSrcweir SvxBoxItem aBox( RES_BOX ); 542*cdf0e10cSrcweir SfxItemSet aCoreSet( GetPool(), 543*cdf0e10cSrcweir RES_BOX, RES_BOX, 544*cdf0e10cSrcweir SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 545*cdf0e10cSrcweir 0); 546*cdf0e10cSrcweir SvxBoxInfoItem aCoreInfo( SID_ATTR_BORDER_INNER ); 547*cdf0e10cSrcweir aCoreSet.Put(aCoreInfo); 548*cdf0e10cSrcweir rSh.GetTabBorders( aCoreSet ); 549*cdf0e10cSrcweir const SvxBoxItem& rCoreBox = (const SvxBoxItem&) 550*cdf0e10cSrcweir aCoreSet.Get(RES_BOX); 551*cdf0e10cSrcweir const SfxPoolItem *pBoxItem = 0; 552*cdf0e10cSrcweir if ( pArgs->GetItemState(RES_BOX, sal_True, &pBoxItem) == SFX_ITEM_SET ) 553*cdf0e10cSrcweir { 554*cdf0e10cSrcweir aBox = *(SvxBoxItem*)pBoxItem; 555*cdf0e10cSrcweir if ( !rReq.IsAPI() ) 556*cdf0e10cSrcweir aBox.SetDistance( Max(rCoreBox.GetDistance(),sal_uInt16(55)) ); 557*cdf0e10cSrcweir else if ( aBox.GetDistance() < MIN_BORDER_DIST ) 558*cdf0e10cSrcweir aBox.SetDistance( Max(rCoreBox.GetDistance(),(sal_uInt16)MIN_BORDER_DIST) ); 559*cdf0e10cSrcweir } 560*cdf0e10cSrcweir else 561*cdf0e10cSrcweir {ASSERT( !this, "Wo ist das Box-Item?" )} 562*cdf0e10cSrcweir 563*cdf0e10cSrcweir //since the drawing layer also supports borders the which id might be a different one 564*cdf0e10cSrcweir SvxBoxInfoItem aInfo( SID_ATTR_BORDER_INNER ); 565*cdf0e10cSrcweir if (pArgs->GetItemState(SID_ATTR_BORDER_INNER, sal_True, &pBoxItem) == SFX_ITEM_SET) 566*cdf0e10cSrcweir aInfo = *(SvxBoxInfoItem*)pBoxItem; 567*cdf0e10cSrcweir else if( pArgs->GetItemState(SDRATTR_TABLE_BORDER_INNER, sal_True, &pBoxItem) == SFX_ITEM_SET ) 568*cdf0e10cSrcweir { 569*cdf0e10cSrcweir aInfo = *(SvxBoxInfoItem*)pBoxItem; 570*cdf0e10cSrcweir aInfo.SetWhich(SID_ATTR_BORDER_INNER); 571*cdf0e10cSrcweir } 572*cdf0e10cSrcweir 573*cdf0e10cSrcweir aInfo.SetTable( sal_True ); 574*cdf0e10cSrcweir aInfo.SetValid( VALID_DISABLE, sal_False ); 575*cdf0e10cSrcweir 576*cdf0e10cSrcweir 577*cdf0e10cSrcweir // Die Attribute aller Linien werden gelesen und das staerkste gewinnt 578*cdf0e10cSrcweir const SvxBorderLine* pBorderLine; 579*cdf0e10cSrcweir SvxBorderLine aBorderLine; 580*cdf0e10cSrcweir if ((pBorderLine = rCoreBox.GetTop()) != NULL) 581*cdf0e10cSrcweir lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine); 582*cdf0e10cSrcweir if ((pBorderLine = rCoreBox.GetBottom()) != NULL) 583*cdf0e10cSrcweir lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine); 584*cdf0e10cSrcweir if ((pBorderLine = rCoreBox.GetLeft()) != NULL) 585*cdf0e10cSrcweir lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine); 586*cdf0e10cSrcweir if ((pBorderLine = rCoreBox.GetRight()) != NULL) 587*cdf0e10cSrcweir lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine); 588*cdf0e10cSrcweir if ((pBorderLine = aCoreInfo.GetHori()) != NULL) 589*cdf0e10cSrcweir lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine); 590*cdf0e10cSrcweir if ((pBorderLine = aCoreInfo.GetVert()) != NULL) 591*cdf0e10cSrcweir lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine); 592*cdf0e10cSrcweir 593*cdf0e10cSrcweir if(aBorderLine.GetOutWidth() == 0) 594*cdf0e10cSrcweir { 595*cdf0e10cSrcweir aBorderLine.SetInWidth(0); 596*cdf0e10cSrcweir aBorderLine.SetOutWidth(DEF_LINE_WIDTH_0); 597*cdf0e10cSrcweir } 598*cdf0e10cSrcweir 599*cdf0e10cSrcweir sal_Bool bLine = sal_False; 600*cdf0e10cSrcweir if ( (pBorderLine = aBox.GetTop()) != NULL) 601*cdf0e10cSrcweir aBox.SetLine(&aBorderLine, BOX_LINE_TOP), bLine |= sal_True; 602*cdf0e10cSrcweir if ((pBorderLine = aBox.GetBottom()) != NULL) 603*cdf0e10cSrcweir aBox.SetLine(&aBorderLine, BOX_LINE_BOTTOM), bLine |= sal_True; 604*cdf0e10cSrcweir if ((pBorderLine = aBox.GetLeft()) != NULL) 605*cdf0e10cSrcweir aBox.SetLine(&aBorderLine, BOX_LINE_LEFT), bLine |= sal_True; 606*cdf0e10cSrcweir if ((pBorderLine = aBox.GetRight()) != NULL) 607*cdf0e10cSrcweir aBox.SetLine(&aBorderLine, BOX_LINE_RIGHT), bLine |= sal_True; 608*cdf0e10cSrcweir if ((pBorderLine = aInfo.GetHori()) != NULL) 609*cdf0e10cSrcweir aInfo.SetLine(&aBorderLine, BOXINFO_LINE_HORI), bLine |= sal_True; 610*cdf0e10cSrcweir if ((pBorderLine = aInfo.GetVert()) != NULL) 611*cdf0e10cSrcweir aInfo.SetLine(&aBorderLine, BOXINFO_LINE_VERT), bLine |= sal_True; 612*cdf0e10cSrcweir 613*cdf0e10cSrcweir // if ( bPopCrsr && !bLine ) 614*cdf0e10cSrcweir // aBox.SetDistance( 0 ); 615*cdf0e10cSrcweir 616*cdf0e10cSrcweir aCoreSet.Put( aBox ); 617*cdf0e10cSrcweir aCoreSet.Put( aInfo ); 618*cdf0e10cSrcweir rSh.SetTabBorders( aCoreSet ); 619*cdf0e10cSrcweir 620*cdf0e10cSrcweir // we must record the "real" values because otherwise the lines can't be reconstructed on playtime 621*cdf0e10cSrcweir // the coding style of the controller (setting lines with width 0) is not transportable via Query/PutValue in 622*cdf0e10cSrcweir // the SvxBoxItem 623*cdf0e10cSrcweir rReq.AppendItem( aBox ); 624*cdf0e10cSrcweir rReq.AppendItem( aInfo ); 625*cdf0e10cSrcweir bCallDone = sal_True; 626*cdf0e10cSrcweir 627*cdf0e10cSrcweir /* if ( bPopCrsr ) 628*cdf0e10cSrcweir { 629*cdf0e10cSrcweir rSh.KillPams(); 630*cdf0e10cSrcweir rSh.Pop(sal_False); 631*cdf0e10cSrcweir rSh.EndAction(); 632*cdf0e10cSrcweir }*/ 633*cdf0e10cSrcweir } 634*cdf0e10cSrcweir break; 635*cdf0e10cSrcweir case FN_INSERT_TABLE: 636*cdf0e10cSrcweir InsertTable( rReq ); 637*cdf0e10cSrcweir break; 638*cdf0e10cSrcweir case FN_FORMAT_TABLE_DLG: 639*cdf0e10cSrcweir { 640*cdf0e10cSrcweir //#127012# get the bindings before the dialog is called 641*cdf0e10cSrcweir // it might happen that this shell is removed after closing the dialog 642*cdf0e10cSrcweir SfxBindings& rBindings = GetView().GetViewFrame()->GetBindings(); 643*cdf0e10cSrcweir SfxItemSet aCoreSet( GetPool(), aUITableAttrRange); 644*cdf0e10cSrcweir 645*cdf0e10cSrcweir FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &rSh.GetView())); 646*cdf0e10cSrcweir SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric))); 647*cdf0e10cSrcweir SwTableRep* pTblRep = ::lcl_TableParamToItemSet( aCoreSet, rSh ); 648*cdf0e10cSrcweir SfxAbstractTabDialog * pDlg = NULL; 649*cdf0e10cSrcweir if ( bUseDialog ) 650*cdf0e10cSrcweir { 651*cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 652*cdf0e10cSrcweir DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); 653*cdf0e10cSrcweir 654*cdf0e10cSrcweir pDlg = pFact->CreateSwTableTabDlg( GetView().GetWindow(), GetPool(), &aCoreSet, &rSh, DLG_FORMAT_TABLE ); 655*cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!"); 656*cdf0e10cSrcweir } 657*cdf0e10cSrcweir aCoreSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(GetView().GetDocShell()))); 658*cdf0e10cSrcweir rSh.GetTblAttr(aCoreSet); 659*cdf0e10cSrcweir // GetTblAttr buegelt den Background ueber! 660*cdf0e10cSrcweir SvxBrushItem aBrush( RES_BACKGROUND ); 661*cdf0e10cSrcweir if(rSh.GetBoxBackground(aBrush)) 662*cdf0e10cSrcweir aCoreSet.Put( aBrush ); 663*cdf0e10cSrcweir else 664*cdf0e10cSrcweir aCoreSet.InvalidateItem( RES_BACKGROUND ); 665*cdf0e10cSrcweir 666*cdf0e10cSrcweir if ( (!pDlg && rReq.GetArgs()) || pDlg->Execute() == RET_OK ) 667*cdf0e10cSrcweir { 668*cdf0e10cSrcweir const SfxItemSet* pOutSet = pDlg ? pDlg->GetOutputItemSet() : rReq.GetArgs(); 669*cdf0e10cSrcweir if ( pDlg ) 670*cdf0e10cSrcweir { 671*cdf0e10cSrcweir //to record FN_INSERT_TABLE correctly 672*cdf0e10cSrcweir rReq.SetSlot(FN_FORMAT_TABLE_DLG); 673*cdf0e10cSrcweir rReq.Done( *pOutSet ); 674*cdf0e10cSrcweir } 675*cdf0e10cSrcweir ItemSetToTableParam( *pOutSet, rSh ); 676*cdf0e10cSrcweir } 677*cdf0e10cSrcweir 678*cdf0e10cSrcweir delete pDlg; 679*cdf0e10cSrcweir delete pTblRep; 680*cdf0e10cSrcweir rBindings.Update(SID_RULER_BORDERS); 681*cdf0e10cSrcweir rBindings.Update(SID_ATTR_TABSTOP); 682*cdf0e10cSrcweir rBindings.Update(SID_RULER_BORDERS_VERTICAL); 683*cdf0e10cSrcweir rBindings.Update(SID_ATTR_TABSTOP_VERTICAL); 684*cdf0e10cSrcweir } 685*cdf0e10cSrcweir break; 686*cdf0e10cSrcweir case SID_ATTR_BRUSH: 687*cdf0e10cSrcweir case SID_ATTR_BRUSH_ROW : 688*cdf0e10cSrcweir case SID_ATTR_BRUSH_TABLE : 689*cdf0e10cSrcweir if(rReq.GetArgs()) 690*cdf0e10cSrcweir ItemSetToTableParam(*rReq.GetArgs(), rSh); 691*cdf0e10cSrcweir break; 692*cdf0e10cSrcweir case FN_NUM_FORMAT_TABLE_DLG: 693*cdf0e10cSrcweir { 694*cdf0e10cSrcweir SwView* pView = GetActiveView(); 695*cdf0e10cSrcweir if(pView) 696*cdf0e10cSrcweir { 697*cdf0e10cSrcweir FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, pView)); 698*cdf0e10cSrcweir SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric))); 699*cdf0e10cSrcweir SvNumberFormatter* pFormatter = rSh.GetNumberFormatter(); 700*cdf0e10cSrcweir SfxItemSet aCoreSet( GetPool(), 701*cdf0e10cSrcweir SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_VALUE, 702*cdf0e10cSrcweir SID_ATTR_NUMBERFORMAT_INFO, SID_ATTR_NUMBERFORMAT_INFO, 703*cdf0e10cSrcweir 0 ); 704*cdf0e10cSrcweir 705*cdf0e10cSrcweir SfxItemSet aBoxSet( *aCoreSet.GetPool(), 706*cdf0e10cSrcweir RES_BOXATR_FORMAT, RES_BOXATR_FORMAT, 707*cdf0e10cSrcweir RES_BOXATR_VALUE, RES_BOXATR_VALUE, 708*cdf0e10cSrcweir 0 ); 709*cdf0e10cSrcweir rSh.GetTblBoxFormulaAttrs( aBoxSet ); 710*cdf0e10cSrcweir 711*cdf0e10cSrcweir SfxItemState eState = aBoxSet.GetItemState(RES_BOXATR_FORMAT); 712*cdf0e10cSrcweir if(eState == SFX_ITEM_DEFAULT) 713*cdf0e10cSrcweir { 714*cdf0e10cSrcweir aCoreSet.Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE, 715*cdf0e10cSrcweir pFormatter->GetFormatIndex(NF_TEXT, LANGUAGE_SYSTEM))); 716*cdf0e10cSrcweir } 717*cdf0e10cSrcweir else 718*cdf0e10cSrcweir aCoreSet.Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE, 719*cdf0e10cSrcweir ((SwTblBoxNumFormat&)aBoxSet.Get( 720*cdf0e10cSrcweir RES_BOXATR_FORMAT )).GetValue() )); 721*cdf0e10cSrcweir 722*cdf0e10cSrcweir String sCurText( rSh.GetTableBoxText() ); 723*cdf0e10cSrcweir aCoreSet.Put( SvxNumberInfoItem( pFormatter, 724*cdf0e10cSrcweir ((SwTblBoxValue&)aBoxSet.Get( 725*cdf0e10cSrcweir RES_BOXATR_VALUE)).GetValue(), 726*cdf0e10cSrcweir sCurText, SID_ATTR_NUMBERFORMAT_INFO )); 727*cdf0e10cSrcweir 728*cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 729*cdf0e10cSrcweir DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); 730*cdf0e10cSrcweir 731*cdf0e10cSrcweir SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( GetView().GetWindow(),aCoreSet, 732*cdf0e10cSrcweir pView->GetViewFrame()->GetFrame().GetFrameInterface(), 733*cdf0e10cSrcweir RC_DLG_SWNUMFMTDLG ); 734*cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!"); 735*cdf0e10cSrcweir 736*cdf0e10cSrcweir if (RET_OK == pDlg->Execute()) 737*cdf0e10cSrcweir { 738*cdf0e10cSrcweir const SfxPoolItem* pNumberFormatItem = GetView().GetDocShell()-> 739*cdf0e10cSrcweir GetItem( SID_ATTR_NUMBERFORMAT_INFO ); 740*cdf0e10cSrcweir 741*cdf0e10cSrcweir if( pNumberFormatItem && 0 != ((SvxNumberInfoItem*)pNumberFormatItem)->GetDelCount() ) 742*cdf0e10cSrcweir { 743*cdf0e10cSrcweir const sal_uInt32* pDelArr = ((SvxNumberInfoItem*) 744*cdf0e10cSrcweir pNumberFormatItem)->GetDelArray(); 745*cdf0e10cSrcweir 746*cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < ((SvxNumberInfoItem*)pNumberFormatItem)->GetDelCount(); i++ ) 747*cdf0e10cSrcweir ((SvxNumberInfoItem*)pNumberFormatItem)-> 748*cdf0e10cSrcweir GetNumberFormatter()->DeleteEntry( pDelArr[i] ); 749*cdf0e10cSrcweir } 750*cdf0e10cSrcweir 751*cdf0e10cSrcweir if( SFX_ITEM_SET == pDlg->GetOutputItemSet()->GetItemState( 752*cdf0e10cSrcweir SID_ATTR_NUMBERFORMAT_VALUE, sal_False, &pNumberFormatItem )) 753*cdf0e10cSrcweir { 754*cdf0e10cSrcweir SfxItemSet aBoxFormatSet( *aCoreSet.GetPool(), 755*cdf0e10cSrcweir RES_BOXATR_FORMAT, RES_BOXATR_FORMAT ); 756*cdf0e10cSrcweir aBoxFormatSet.Put( SwTblBoxNumFormat( 757*cdf0e10cSrcweir ((SfxUInt32Item*)pNumberFormatItem)->GetValue() )); 758*cdf0e10cSrcweir rSh.SetTblBoxFormulaAttrs( aBoxFormatSet ); 759*cdf0e10cSrcweir 760*cdf0e10cSrcweir } 761*cdf0e10cSrcweir } 762*cdf0e10cSrcweir delete pDlg; 763*cdf0e10cSrcweir } 764*cdf0e10cSrcweir } 765*cdf0e10cSrcweir break; 766*cdf0e10cSrcweir case FN_CALC_TABLE: 767*cdf0e10cSrcweir rSh.UpdateTable(); 768*cdf0e10cSrcweir bCallDone = sal_True; 769*cdf0e10cSrcweir break; 770*cdf0e10cSrcweir case FN_TABLE_OPTIMAL_HEIGHT: 771*cdf0e10cSrcweir { 772*cdf0e10cSrcweir const SwFmtFrmSize aSz; 773*cdf0e10cSrcweir rSh.SetRowHeight( aSz ); 774*cdf0e10cSrcweir bCallDone = sal_True; 775*cdf0e10cSrcweir } 776*cdf0e10cSrcweir break; 777*cdf0e10cSrcweir case FN_TABLE_DELETE_COL: 778*cdf0e10cSrcweir if ( rSh.DeleteCol() && rSh.HasSelection() ) 779*cdf0e10cSrcweir rSh.EnterStdMode(); 780*cdf0e10cSrcweir bCallDone = sal_True; 781*cdf0e10cSrcweir break; 782*cdf0e10cSrcweir case FN_END_TABLE: 783*cdf0e10cSrcweir rSh.MoveTable( fnTableCurr, fnTableEnd ); 784*cdf0e10cSrcweir bCallDone = sal_True; 785*cdf0e10cSrcweir break; 786*cdf0e10cSrcweir case FN_START_TABLE: 787*cdf0e10cSrcweir rSh.MoveTable( fnTableCurr, fnTableStart ); 788*cdf0e10cSrcweir bCallDone = sal_True; 789*cdf0e10cSrcweir break; 790*cdf0e10cSrcweir case FN_GOTO_NEXT_CELL: 791*cdf0e10cSrcweir { 792*cdf0e10cSrcweir sal_Bool bAppendLine = sal_True; 793*cdf0e10cSrcweir if( pItem ) 794*cdf0e10cSrcweir bAppendLine = ((SfxBoolItem*)pItem)->GetValue(); 795*cdf0e10cSrcweir rReq.SetReturnValue( SfxBoolItem( nSlot, 796*cdf0e10cSrcweir rSh.GoNextCell( bAppendLine ) ) ); 797*cdf0e10cSrcweir bCallDone = sal_True; 798*cdf0e10cSrcweir } 799*cdf0e10cSrcweir break; 800*cdf0e10cSrcweir case FN_GOTO_PREV_CELL: 801*cdf0e10cSrcweir rReq.SetReturnValue( SfxBoolItem( nSlot, rSh.GoPrevCell() ) ); 802*cdf0e10cSrcweir bCallDone = sal_True; 803*cdf0e10cSrcweir break; 804*cdf0e10cSrcweir case FN_TABLE_DELETE_ROW: 805*cdf0e10cSrcweir if ( rSh.DeleteRow() && rSh.HasSelection() ) 806*cdf0e10cSrcweir rSh.EnterStdMode(); 807*cdf0e10cSrcweir bCallDone = sal_True; 808*cdf0e10cSrcweir break; 809*cdf0e10cSrcweir case FN_TABLE_MERGE_CELLS: 810*cdf0e10cSrcweir if ( rSh.IsTableMode() ) 811*cdf0e10cSrcweir switch ( rSh.MergeTab() ) 812*cdf0e10cSrcweir { 813*cdf0e10cSrcweir case TBLMERGE_OK: 814*cdf0e10cSrcweir bCallDone = sal_True; 815*cdf0e10cSrcweir //no break; 816*cdf0e10cSrcweir case TBLMERGE_NOSELECTION: break; 817*cdf0e10cSrcweir case TBLMERGE_TOOCOMPLEX: 818*cdf0e10cSrcweir { 819*cdf0e10cSrcweir InfoBox aInfoBox( GetView().GetWindow(), 820*cdf0e10cSrcweir SW_RES( MSG_ERR_TABLE_MERGE ) ); 821*cdf0e10cSrcweir aInfoBox.Execute(); 822*cdf0e10cSrcweir break; 823*cdf0e10cSrcweir } 824*cdf0e10cSrcweir default: ASSERT( !this, "unbekannter Returnwert MergeTab."); 825*cdf0e10cSrcweir } 826*cdf0e10cSrcweir break; 827*cdf0e10cSrcweir case FN_TABLE_ADJUST_CELLS: 828*cdf0e10cSrcweir case FN_TABLE_BALANCE_CELLS: 829*cdf0e10cSrcweir { 830*cdf0e10cSrcweir sal_Bool bBalance = (FN_TABLE_BALANCE_CELLS == nSlot); 831*cdf0e10cSrcweir if ( rSh.IsAdjustCellWidthAllowed(bBalance) ) 832*cdf0e10cSrcweir { 833*cdf0e10cSrcweir { 834*cdf0e10cSrcweir // remove actions to make a valid table selection 835*cdf0e10cSrcweir UnoActionRemoveContext aRemoveContext(rSh.GetDoc()); 836*cdf0e10cSrcweir } 837*cdf0e10cSrcweir rSh.AdjustCellWidth(bBalance); 838*cdf0e10cSrcweir } 839*cdf0e10cSrcweir bCallDone = sal_True; 840*cdf0e10cSrcweir } 841*cdf0e10cSrcweir break; 842*cdf0e10cSrcweir case FN_TABLE_BALANCE_ROWS: 843*cdf0e10cSrcweir if ( rSh.BalanceRowHeight(sal_True) ) 844*cdf0e10cSrcweir rSh.BalanceRowHeight(sal_False); 845*cdf0e10cSrcweir bCallDone = sal_True; 846*cdf0e10cSrcweir break; 847*cdf0e10cSrcweir case FN_TABLE_SELECT_ALL: 848*cdf0e10cSrcweir rSh.EnterStdMode(); 849*cdf0e10cSrcweir rSh.MoveTable( fnTableCurr, fnTableStart ); 850*cdf0e10cSrcweir rSh.SttSelect(); 851*cdf0e10cSrcweir rSh.MoveTable( fnTableCurr, fnTableEnd ); 852*cdf0e10cSrcweir rSh.EndSelect(); 853*cdf0e10cSrcweir bCallDone = sal_True; 854*cdf0e10cSrcweir break; 855*cdf0e10cSrcweir case FN_TABLE_SELECT_COL: 856*cdf0e10cSrcweir rSh.EnterStdMode(); 857*cdf0e10cSrcweir rSh.SelectTableCol(); 858*cdf0e10cSrcweir bCallDone = sal_True; 859*cdf0e10cSrcweir break; 860*cdf0e10cSrcweir case FN_TABLE_SELECT_ROW: 861*cdf0e10cSrcweir rSh.EnterStdMode(); 862*cdf0e10cSrcweir rSh.SelectTableRow(); 863*cdf0e10cSrcweir bCallDone = sal_True; 864*cdf0e10cSrcweir break; 865*cdf0e10cSrcweir case FN_TABLE_SET_READ_ONLY_CELLS: 866*cdf0e10cSrcweir rSh.ProtectCells(); 867*cdf0e10cSrcweir rSh.ResetSelect( 0, sal_False ); 868*cdf0e10cSrcweir bCallDone = sal_True; 869*cdf0e10cSrcweir break; 870*cdf0e10cSrcweir case FN_TABLE_UNSET_READ_ONLY_CELLS: 871*cdf0e10cSrcweir rSh.UnProtectCells(); 872*cdf0e10cSrcweir bCallDone = sal_True; 873*cdf0e10cSrcweir break; 874*cdf0e10cSrcweir case SID_AUTOFORMAT: 875*cdf0e10cSrcweir { 876*cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 877*cdf0e10cSrcweir DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); 878*cdf0e10cSrcweir 879*cdf0e10cSrcweir AbstractSwAutoFormatDlg* pDlg = pFact->CreateSwAutoFormatDlg(&GetView().GetViewFrame()->GetWindow(), &rSh , DLG_AUTOFMT_TABLE ); 880*cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!"); 881*cdf0e10cSrcweir pDlg->Execute(); 882*cdf0e10cSrcweir delete pDlg; 883*cdf0e10cSrcweir } 884*cdf0e10cSrcweir break; 885*cdf0e10cSrcweir case FN_TABLE_SET_ROW_HEIGHT: 886*cdf0e10cSrcweir { 887*cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 888*cdf0e10cSrcweir DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); 889*cdf0e10cSrcweir 890*cdf0e10cSrcweir VclAbstractDialog* pDlg = pFact->CreateVclAbstractDialog( GetView().GetWindow(), rSh, DLG_ROW_HEIGHT ); 891*cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!"); 892*cdf0e10cSrcweir pDlg->Execute(); 893*cdf0e10cSrcweir delete pDlg; 894*cdf0e10cSrcweir } 895*cdf0e10cSrcweir break; 896*cdf0e10cSrcweir case FN_NUMBER_BULLETS: 897*cdf0e10cSrcweir case FN_NUM_BULLET_ON: 898*cdf0e10cSrcweir ASSERT( !this, "Funktion darf zur Zeit nicht gerufen werden." ); 899*cdf0e10cSrcweir break; 900*cdf0e10cSrcweir 901*cdf0e10cSrcweir case FN_TABLE_INSERT_COL: 902*cdf0e10cSrcweir case FN_TABLE_INSERT_ROW: 903*cdf0e10cSrcweir { 904*cdf0e10cSrcweir sal_Bool bColumn = rReq.GetSlot() == FN_TABLE_INSERT_COL; 905*cdf0e10cSrcweir sal_uInt16 nCount = 0; 906*cdf0e10cSrcweir sal_Bool bAfter = sal_True; 907*cdf0e10cSrcweir if (pItem) 908*cdf0e10cSrcweir { 909*cdf0e10cSrcweir nCount = ((const SfxInt16Item* )pItem)->GetValue(); 910*cdf0e10cSrcweir if(SFX_ITEM_SET == pArgs->GetItemState(FN_PARAM_INSERT_AFTER, sal_True, &pItem)) 911*cdf0e10cSrcweir bAfter = ((const SfxBoolItem* )pItem)->GetValue(); 912*cdf0e10cSrcweir } 913*cdf0e10cSrcweir else if( !rReq.IsAPI() ) 914*cdf0e10cSrcweir ++nCount; 915*cdf0e10cSrcweir 916*cdf0e10cSrcweir if( nCount ) 917*cdf0e10cSrcweir { 918*cdf0e10cSrcweir // i74180: Table border patch submitted by chensuchun: 919*cdf0e10cSrcweir // -->get the SvxBoxInfoItem of the table before insert 920*cdf0e10cSrcweir SfxItemSet aCoreSet( GetPool(), aUITableAttrRange); 921*cdf0e10cSrcweir ::lcl_TableParamToItemSet( aCoreSet, rSh ); 922*cdf0e10cSrcweir bool bSetInnerBorders = false; 923*cdf0e10cSrcweir SwUndoId nUndoId = UNDO_EMPTY; 924*cdf0e10cSrcweir // <--End 925*cdf0e10cSrcweir 926*cdf0e10cSrcweir if( bColumn ) 927*cdf0e10cSrcweir { 928*cdf0e10cSrcweir rSh.StartUndo( UNDO_TABLE_INSCOL ); 929*cdf0e10cSrcweir rSh.InsertCol( nCount, bAfter ); 930*cdf0e10cSrcweir bSetInnerBorders = true; 931*cdf0e10cSrcweir nUndoId = UNDO_TABLE_INSCOL; 932*cdf0e10cSrcweir } 933*cdf0e10cSrcweir else if ( !rSh.IsInRepeatedHeadline() ) 934*cdf0e10cSrcweir { 935*cdf0e10cSrcweir rSh.StartUndo( UNDO_TABLE_INSROW ); 936*cdf0e10cSrcweir rSh.InsertRow( nCount, bAfter ); 937*cdf0e10cSrcweir bSetInnerBorders = true; 938*cdf0e10cSrcweir nUndoId = UNDO_TABLE_INSROW; 939*cdf0e10cSrcweir } 940*cdf0e10cSrcweir 941*cdf0e10cSrcweir // -->after inserting,reset the inner table borders 942*cdf0e10cSrcweir if ( bSetInnerBorders ) 943*cdf0e10cSrcweir { 944*cdf0e10cSrcweir const SvxBoxInfoItem aBoxInfo((const SvxBoxInfoItem&) 945*cdf0e10cSrcweir aCoreSet.Get(SID_ATTR_BORDER_INNER)); 946*cdf0e10cSrcweir SfxItemSet aSet( GetPool(), SID_ATTR_BORDER_INNER, 947*cdf0e10cSrcweir SID_ATTR_BORDER_INNER, 0); 948*cdf0e10cSrcweir aSet.Put( aBoxInfo ); 949*cdf0e10cSrcweir ItemSetToTableParam( aSet, rSh ); 950*cdf0e10cSrcweir rSh.EndUndo( nUndoId ); 951*cdf0e10cSrcweir } 952*cdf0e10cSrcweir // <-- 953*cdf0e10cSrcweir 954*cdf0e10cSrcweir bCallDone = sal_True; 955*cdf0e10cSrcweir break; 956*cdf0e10cSrcweir } 957*cdf0e10cSrcweir 958*cdf0e10cSrcweir nSlot = bColumn ? FN_TABLE_INSERT_COL_DLG : FN_TABLE_INSERT_ROW_DLG; 959*cdf0e10cSrcweir } 960*cdf0e10cSrcweir // kein break; bei Count = 0 kommt der Dialog 961*cdf0e10cSrcweir case FN_TABLE_INSERT_COL_DLG: 962*cdf0e10cSrcweir case FN_TABLE_INSERT_ROW_DLG: 963*cdf0e10cSrcweir { 964*cdf0e10cSrcweir const SfxSlot* pSlot = GetStaticInterface()->GetSlot(nSlot); 965*cdf0e10cSrcweir if ( FN_TABLE_INSERT_ROW_DLG != nSlot || !rSh.IsInRepeatedHeadline()) 966*cdf0e10cSrcweir { 967*cdf0e10cSrcweir SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 968*cdf0e10cSrcweir ::std::auto_ptr<SvxAbstractInsRowColDlg> pDlg( pFact ? pFact->CreateSvxInsRowColDlg( GetView().GetWindow(), nSlot == FN_TABLE_INSERT_COL_DLG, pSlot->GetCommand() ) : 0); 969*cdf0e10cSrcweir 970*cdf0e10cSrcweir if( pDlg.get() && (pDlg->Execute() == 1) ) 971*cdf0e10cSrcweir { 972*cdf0e10cSrcweir sal_uInt16 nDispatchSlot = (nSlot == FN_TABLE_INSERT_COL_DLG) ? FN_TABLE_INSERT_COL : FN_TABLE_INSERT_ROW; 973*cdf0e10cSrcweir SfxUInt16Item aCountItem( nDispatchSlot, static_cast< sal_uInt16 >(pDlg->getInsertCount()) ); 974*cdf0e10cSrcweir SfxBoolItem aAfter( FN_PARAM_INSERT_AFTER, !pDlg->isInsertBefore() ); 975*cdf0e10cSrcweir SfxViewFrame* pVFrame = GetView().GetViewFrame(); 976*cdf0e10cSrcweir if( pVFrame ) 977*cdf0e10cSrcweir pVFrame->GetDispatcher()->Execute( nDispatchSlot, SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD, &aCountItem, &aAfter, 0L); 978*cdf0e10cSrcweir } 979*cdf0e10cSrcweir } 980*cdf0e10cSrcweir } 981*cdf0e10cSrcweir break; 982*cdf0e10cSrcweir case FN_TABLE_SPLIT_CELLS: 983*cdf0e10cSrcweir { 984*cdf0e10cSrcweir long nCount=0; 985*cdf0e10cSrcweir sal_Bool bHorizontal=sal_True; 986*cdf0e10cSrcweir sal_Bool bProportional = sal_False; 987*cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pSplit, SfxInt32Item, FN_TABLE_SPLIT_CELLS, sal_False ); 988*cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pHor, SfxBoolItem, FN_PARAM_1, sal_False ); 989*cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pProp, SfxBoolItem, FN_PARAM_2, sal_False ); 990*cdf0e10cSrcweir if ( pSplit ) 991*cdf0e10cSrcweir { 992*cdf0e10cSrcweir nCount = pSplit->GetValue(); 993*cdf0e10cSrcweir if ( pHor ) 994*cdf0e10cSrcweir bHorizontal = pHor->GetValue(); 995*cdf0e10cSrcweir if ( pProp ) 996*cdf0e10cSrcweir bProportional = pProp->GetValue(); 997*cdf0e10cSrcweir } 998*cdf0e10cSrcweir else 999*cdf0e10cSrcweir { 1000*cdf0e10cSrcweir SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 1001*cdf0e10cSrcweir if( pFact ) 1002*cdf0e10cSrcweir { 1003*cdf0e10cSrcweir const long nMaxVert = rSh.GetAnyCurRect( RECT_FRM ).Width() / MINLAY; 1004*cdf0e10cSrcweir SvxAbstractSplittTableDialog* pDlg = pFact->CreateSvxSplittTableDialog( GetView().GetWindow(), rSh.IsTableVertical(), nMaxVert, 99 ); 1005*cdf0e10cSrcweir if( pDlg && (pDlg->Execute() == RET_OK) ) 1006*cdf0e10cSrcweir { 1007*cdf0e10cSrcweir nCount = pDlg->GetCount(); 1008*cdf0e10cSrcweir bHorizontal = pDlg->IsHorizontal(); 1009*cdf0e10cSrcweir bProportional = pDlg->IsProportional(); 1010*cdf0e10cSrcweir rReq.AppendItem( SfxInt32Item( FN_TABLE_SPLIT_CELLS, nCount ) ); 1011*cdf0e10cSrcweir rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bHorizontal ) ); 1012*cdf0e10cSrcweir rReq.AppendItem( SfxBoolItem( FN_PARAM_2, bProportional ) ); 1013*cdf0e10cSrcweir } 1014*cdf0e10cSrcweir delete pDlg; 1015*cdf0e10cSrcweir } 1016*cdf0e10cSrcweir } 1017*cdf0e10cSrcweir 1018*cdf0e10cSrcweir if ( nCount>1 ) 1019*cdf0e10cSrcweir { 1020*cdf0e10cSrcweir rSh.SplitTab(!bHorizontal, static_cast< sal_uInt16 >( nCount-1 ), bProportional ); 1021*cdf0e10cSrcweir bCallDone = sal_True; 1022*cdf0e10cSrcweir } 1023*cdf0e10cSrcweir else 1024*cdf0e10cSrcweir rReq.Ignore(); 1025*cdf0e10cSrcweir } 1026*cdf0e10cSrcweir break; 1027*cdf0e10cSrcweir 1028*cdf0e10cSrcweir case FN_TABLE_SPLIT_TABLE: 1029*cdf0e10cSrcweir { 1030*cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pType, SfxUInt16Item, FN_PARAM_1, sal_False ); 1031*cdf0e10cSrcweir if( pType ) 1032*cdf0e10cSrcweir { 1033*cdf0e10cSrcweir switch( pType->GetValue() ) 1034*cdf0e10cSrcweir { 1035*cdf0e10cSrcweir case HEADLINE_NONE : 1036*cdf0e10cSrcweir case HEADLINE_BORDERCOPY: 1037*cdf0e10cSrcweir case HEADLINE_CNTNTCOPY: 1038*cdf0e10cSrcweir case HEADLINE_BOXATTRCOPY: 1039*cdf0e10cSrcweir case HEADLINE_BOXATRCOLLCOPY: 1040*cdf0e10cSrcweir rSh.SplitTable(pType->GetValue()) ; 1041*cdf0e10cSrcweir default: ;//wrong parameter, do nothing 1042*cdf0e10cSrcweir } 1043*cdf0e10cSrcweir } 1044*cdf0e10cSrcweir else 1045*cdf0e10cSrcweir { 1046*cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 1047*cdf0e10cSrcweir DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); 1048*cdf0e10cSrcweir 1049*cdf0e10cSrcweir AbstractSplitTableDialog* pDlg = pFact->CreateSplitTblDialog( GetView().GetWindow(), rSh ); 1050*cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!"); 1051*cdf0e10cSrcweir pDlg->Execute(); 1052*cdf0e10cSrcweir rReq.AppendItem( SfxUInt16Item( FN_PARAM_1, pDlg->GetSplitMode() ) ); 1053*cdf0e10cSrcweir delete pDlg; 1054*cdf0e10cSrcweir bCallDone = sal_True; 1055*cdf0e10cSrcweir } 1056*cdf0e10cSrcweir } 1057*cdf0e10cSrcweir break; 1058*cdf0e10cSrcweir 1059*cdf0e10cSrcweir case FN_TABLE_MERGE_TABLE: 1060*cdf0e10cSrcweir { 1061*cdf0e10cSrcweir sal_Bool bPrev = rSh.CanMergeTable( sal_True ); 1062*cdf0e10cSrcweir sal_Bool bNext = rSh.CanMergeTable( sal_False ); 1063*cdf0e10cSrcweir 1064*cdf0e10cSrcweir if( bPrev && bNext ) 1065*cdf0e10cSrcweir { 1066*cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 1067*cdf0e10cSrcweir DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); 1068*cdf0e10cSrcweir VclAbstractDialog* pDlg = pFact->CreateSwVclDialog( DLG_MERGE_TABLE, GetView().GetWindow(), bPrev ); 1069*cdf0e10cSrcweir DBG_ASSERT(pDlg, "dialogdiet pDlg fail!"); 1070*cdf0e10cSrcweir if( RET_OK != pDlg->Execute()) 1071*cdf0e10cSrcweir bPrev = bNext = sal_False; 1072*cdf0e10cSrcweir delete pDlg; 1073*cdf0e10cSrcweir } 1074*cdf0e10cSrcweir 1075*cdf0e10cSrcweir if( bPrev || bNext ) 1076*cdf0e10cSrcweir rSh.MergeTable( bPrev ); 1077*cdf0e10cSrcweir } 1078*cdf0e10cSrcweir break; 1079*cdf0e10cSrcweir 1080*cdf0e10cSrcweir case FN_TABLE_MODE_FIX : 1081*cdf0e10cSrcweir case FN_TABLE_MODE_FIX_PROP : 1082*cdf0e10cSrcweir case FN_TABLE_MODE_VARIABLE : 1083*cdf0e10cSrcweir { 1084*cdf0e10cSrcweir rSh.SetTblChgMode( ( FN_TABLE_MODE_FIX == nSlot ? TBLFIX_CHGABS 1085*cdf0e10cSrcweir : FN_TABLE_MODE_FIX_PROP == nSlot 1086*cdf0e10cSrcweir ? TBLFIX_CHGPROP 1087*cdf0e10cSrcweir : TBLVAR_CHGABS ) ); 1088*cdf0e10cSrcweir 1089*cdf0e10cSrcweir SfxBindings& rBind = GetView().GetViewFrame()->GetBindings(); 1090*cdf0e10cSrcweir static sal_uInt16 __READONLY_DATA aInva[] = 1091*cdf0e10cSrcweir { FN_TABLE_MODE_FIX, 1092*cdf0e10cSrcweir FN_TABLE_MODE_FIX_PROP, 1093*cdf0e10cSrcweir FN_TABLE_MODE_VARIABLE, 1094*cdf0e10cSrcweir 0 1095*cdf0e10cSrcweir }; 1096*cdf0e10cSrcweir rBind.Invalidate( aInva ); 1097*cdf0e10cSrcweir bCallDone = sal_True; 1098*cdf0e10cSrcweir } 1099*cdf0e10cSrcweir break; 1100*cdf0e10cSrcweir case FN_TABLE_AUTOSUM: 1101*cdf0e10cSrcweir { 1102*cdf0e10cSrcweir SfxViewFrame* pVFrame = GetView().GetViewFrame(); 1103*cdf0e10cSrcweir pVFrame->GetDispatcher()->Execute(FN_EDIT_FORMULA, SFX_CALLMODE_SYNCHRON); 1104*cdf0e10cSrcweir const sal_uInt16 nId = SwInputChild::GetChildWindowId(); 1105*cdf0e10cSrcweir SwInputChild* pChildWin = (SwInputChild*)pVFrame-> 1106*cdf0e10cSrcweir GetChildWindow( nId ); 1107*cdf0e10cSrcweir String sSum; 1108*cdf0e10cSrcweir GetShell().GetAutoSum(sSum); 1109*cdf0e10cSrcweir if( pChildWin ) 1110*cdf0e10cSrcweir pChildWin->SetFormula( sSum ); 1111*cdf0e10cSrcweir 1112*cdf0e10cSrcweir } 1113*cdf0e10cSrcweir break; 1114*cdf0e10cSrcweir case FN_TABLE_HEADLINE_REPEAT: 1115*cdf0e10cSrcweir if(0 != rSh.GetRowsToRepeat()) 1116*cdf0e10cSrcweir rSh.SetRowsToRepeat( 0 ); 1117*cdf0e10cSrcweir else 1118*cdf0e10cSrcweir rSh.SetRowsToRepeat(rSh.GetRowSelectionFromTop()); 1119*cdf0e10cSrcweir break; 1120*cdf0e10cSrcweir case FN_TABLE_SELECT_CELL : 1121*cdf0e10cSrcweir rSh.SelectTableCell(); 1122*cdf0e10cSrcweir break; 1123*cdf0e10cSrcweir case FN_TABLE_DELETE_TABLE : 1124*cdf0e10cSrcweir { 1125*cdf0e10cSrcweir rSh.StartAction(); 1126*cdf0e10cSrcweir rSh.StartUndo(); 1127*cdf0e10cSrcweir rSh.GetView().GetViewFrame()->GetDispatcher()->Execute(FN_TABLE_SELECT_ALL); 1128*cdf0e10cSrcweir rSh.DeleteRow(); 1129*cdf0e10cSrcweir rSh.EndUndo(); 1130*cdf0e10cSrcweir rSh.EndAction(); 1131*cdf0e10cSrcweir } 1132*cdf0e10cSrcweir //'this' is already destroyed 1133*cdf0e10cSrcweir return; 1134*cdf0e10cSrcweir //break; 1135*cdf0e10cSrcweir default: 1136*cdf0e10cSrcweir bMore = sal_True; 1137*cdf0e10cSrcweir } 1138*cdf0e10cSrcweir 1139*cdf0e10cSrcweir if ( !bMore ) 1140*cdf0e10cSrcweir { 1141*cdf0e10cSrcweir if(bCallDone) 1142*cdf0e10cSrcweir rReq.Done(); 1143*cdf0e10cSrcweir return; 1144*cdf0e10cSrcweir } 1145*cdf0e10cSrcweir else 1146*cdf0e10cSrcweir bMore = sal_False; 1147*cdf0e10cSrcweir //Jetzt die Slots, die direkt auf dem TableFmt arbeiten. 1148*cdf0e10cSrcweir SwFrmFmt *pFmt = rSh.GetTableFmt(); 1149*cdf0e10cSrcweir switch ( nSlot ) 1150*cdf0e10cSrcweir { 1151*cdf0e10cSrcweir case SID_ATTR_ULSPACE: 1152*cdf0e10cSrcweir { 1153*cdf0e10cSrcweir if(pItem) 1154*cdf0e10cSrcweir { 1155*cdf0e10cSrcweir SvxULSpaceItem aULSpace( *(const SvxULSpaceItem*)pItem ); 1156*cdf0e10cSrcweir aULSpace.SetWhich( RES_UL_SPACE ); 1157*cdf0e10cSrcweir ::lcl_SetAttr( rSh, aULSpace ); 1158*cdf0e10cSrcweir } 1159*cdf0e10cSrcweir } 1160*cdf0e10cSrcweir break; 1161*cdf0e10cSrcweir 1162*cdf0e10cSrcweir case SID_ATTR_LRSPACE: 1163*cdf0e10cSrcweir { 1164*cdf0e10cSrcweir if(pItem) 1165*cdf0e10cSrcweir { 1166*cdf0e10cSrcweir SfxItemSet aSet( GetPool(), RES_LR_SPACE, RES_LR_SPACE, 1167*cdf0e10cSrcweir RES_HORI_ORIENT, RES_HORI_ORIENT, 0 ); 1168*cdf0e10cSrcweir SvxLRSpaceItem aLRSpace( *(const SvxLRSpaceItem*)pItem ); 1169*cdf0e10cSrcweir aLRSpace.SetWhich( RES_LR_SPACE ); 1170*cdf0e10cSrcweir aSet.Put( aLRSpace ); 1171*cdf0e10cSrcweir SwFmtHoriOrient aHori( pFmt->GetHoriOrient() ); 1172*cdf0e10cSrcweir aHori.SetHoriOrient( text::HoriOrientation::NONE ); 1173*cdf0e10cSrcweir aSet.Put( aLRSpace ); 1174*cdf0e10cSrcweir rSh.SetTblAttr( aSet ); 1175*cdf0e10cSrcweir } 1176*cdf0e10cSrcweir } 1177*cdf0e10cSrcweir break; 1178*cdf0e10cSrcweir // der letzte case-Zweig der noch einen TabellenManager braucht!! 1179*cdf0e10cSrcweir case FN_TABLE_SET_COL_WIDTH: 1180*cdf0e10cSrcweir { 1181*cdf0e10cSrcweir SwTableFUNC aMgr( &rSh, sal_False); 1182*cdf0e10cSrcweir aMgr.ColWidthDlg(GetView().GetWindow()); 1183*cdf0e10cSrcweir } 1184*cdf0e10cSrcweir break; 1185*cdf0e10cSrcweir case FN_TABLE_VERT_NONE: 1186*cdf0e10cSrcweir case FN_TABLE_VERT_CENTER: 1187*cdf0e10cSrcweir case FN_TABLE_VERT_BOTTOM: 1188*cdf0e10cSrcweir { 1189*cdf0e10cSrcweir sal_uInt16 nAlign = nSlot == FN_TABLE_VERT_NONE ? 1190*cdf0e10cSrcweir text::VertOrientation::NONE : 1191*cdf0e10cSrcweir nSlot == FN_TABLE_VERT_CENTER ? 1192*cdf0e10cSrcweir text::VertOrientation::CENTER : text::VertOrientation::BOTTOM; 1193*cdf0e10cSrcweir rSh.SetBoxAlign(nAlign); 1194*cdf0e10cSrcweir bCallDone = sal_True; 1195*cdf0e10cSrcweir } 1196*cdf0e10cSrcweir break; 1197*cdf0e10cSrcweir 1198*cdf0e10cSrcweir case SID_ATTR_PARA_SPLIT: 1199*cdf0e10cSrcweir if ( pItem ) 1200*cdf0e10cSrcweir { 1201*cdf0e10cSrcweir SwFmtLayoutSplit aSplit( ((const SvxFmtSplitItem*)pItem)->GetValue()); 1202*cdf0e10cSrcweir SfxItemSet aSet(GetPool(), RES_LAYOUT_SPLIT, RES_LAYOUT_SPLIT, 0 ); 1203*cdf0e10cSrcweir aSet.Put(aSplit); 1204*cdf0e10cSrcweir rSh.SetTblAttr(aSet); 1205*cdf0e10cSrcweir } 1206*cdf0e10cSrcweir break; 1207*cdf0e10cSrcweir 1208*cdf0e10cSrcweir case SID_ATTR_PARA_KEEP: 1209*cdf0e10cSrcweir if ( pItem ) 1210*cdf0e10cSrcweir { 1211*cdf0e10cSrcweir SvxFmtKeepItem aKeep( *(const SvxFmtKeepItem*)pItem ); 1212*cdf0e10cSrcweir aKeep.SetWhich( RES_KEEP ); 1213*cdf0e10cSrcweir SfxItemSet aSet(GetPool(), RES_KEEP, RES_KEEP, 0 ); 1214*cdf0e10cSrcweir aSet.Put(aKeep); 1215*cdf0e10cSrcweir rSh.SetTblAttr(aSet); 1216*cdf0e10cSrcweir } 1217*cdf0e10cSrcweir break; 1218*cdf0e10cSrcweir case FN_TABLE_ROW_SPLIT : 1219*cdf0e10cSrcweir { 1220*cdf0e10cSrcweir const SfxBoolItem* pBool = static_cast<const SfxBoolItem*>(pItem); 1221*cdf0e10cSrcweir SwFmtRowSplit* pSplit = 0; 1222*cdf0e10cSrcweir if(!pBool) 1223*cdf0e10cSrcweir { 1224*cdf0e10cSrcweir rSh.GetRowSplit(pSplit); 1225*cdf0e10cSrcweir if(pSplit) 1226*cdf0e10cSrcweir pSplit->SetValue(!pSplit->GetValue()); 1227*cdf0e10cSrcweir else 1228*cdf0e10cSrcweir pSplit = new SwFmtRowSplit(sal_True); 1229*cdf0e10cSrcweir } 1230*cdf0e10cSrcweir else 1231*cdf0e10cSrcweir { 1232*cdf0e10cSrcweir pSplit = new SwFmtRowSplit(pBool->GetValue()); 1233*cdf0e10cSrcweir } 1234*cdf0e10cSrcweir rSh.SetRowSplit( *pSplit ); 1235*cdf0e10cSrcweir delete pSplit; 1236*cdf0e10cSrcweir } 1237*cdf0e10cSrcweir break; 1238*cdf0e10cSrcweir 1239*cdf0e10cSrcweir default: 1240*cdf0e10cSrcweir ASSERT( !this, "falscher Dispatcher" ); 1241*cdf0e10cSrcweir return; 1242*cdf0e10cSrcweir } 1243*cdf0e10cSrcweir if(bCallDone) 1244*cdf0e10cSrcweir rReq.Done(); 1245*cdf0e10cSrcweir } 1246*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1247*cdf0e10cSrcweir Beschreibung: 1248*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1249*cdf0e10cSrcweir 1250*cdf0e10cSrcweir void SwTableShell::GetState(SfxItemSet &rSet) 1251*cdf0e10cSrcweir { 1252*cdf0e10cSrcweir SfxWhichIter aIter( rSet ); 1253*cdf0e10cSrcweir SwWrtShell &rSh = GetShell(); 1254*cdf0e10cSrcweir SwFrmFmt *pFmt = rSh.GetTableFmt(); 1255*cdf0e10cSrcweir // os #124829# crash report: in case of an invalid shell selection return immediately 1256*cdf0e10cSrcweir if(!pFmt) 1257*cdf0e10cSrcweir return; 1258*cdf0e10cSrcweir sal_uInt16 nSlot = aIter.FirstWhich(); 1259*cdf0e10cSrcweir while ( nSlot ) 1260*cdf0e10cSrcweir { 1261*cdf0e10cSrcweir switch ( nSlot ) 1262*cdf0e10cSrcweir { 1263*cdf0e10cSrcweir case FN_TABLE_MERGE_CELLS: 1264*cdf0e10cSrcweir if ( !rSh.IsTableMode() ) 1265*cdf0e10cSrcweir rSet.DisableItem(FN_TABLE_MERGE_CELLS); 1266*cdf0e10cSrcweir break; 1267*cdf0e10cSrcweir case FN_TABLE_ADJUST_CELLS: 1268*cdf0e10cSrcweir if ( !rSh.IsAdjustCellWidthAllowed() ) 1269*cdf0e10cSrcweir rSet.DisableItem(FN_TABLE_ADJUST_CELLS); 1270*cdf0e10cSrcweir break; 1271*cdf0e10cSrcweir 1272*cdf0e10cSrcweir case FN_TABLE_BALANCE_CELLS: 1273*cdf0e10cSrcweir if ( !rSh.IsAdjustCellWidthAllowed(sal_True) ) 1274*cdf0e10cSrcweir rSet.DisableItem(FN_TABLE_BALANCE_CELLS); 1275*cdf0e10cSrcweir break; 1276*cdf0e10cSrcweir 1277*cdf0e10cSrcweir case FN_TABLE_BALANCE_ROWS: 1278*cdf0e10cSrcweir if ( !rSh.BalanceRowHeight(sal_True) ) 1279*cdf0e10cSrcweir rSet.DisableItem(FN_TABLE_BALANCE_ROWS); 1280*cdf0e10cSrcweir break; 1281*cdf0e10cSrcweir case FN_OPTIMIZE_TABLE: 1282*cdf0e10cSrcweir if ( !rSh.IsTableMode() && 1283*cdf0e10cSrcweir !rSh.IsAdjustCellWidthAllowed() && 1284*cdf0e10cSrcweir !rSh.IsAdjustCellWidthAllowed(sal_True) && 1285*cdf0e10cSrcweir !rSh.BalanceRowHeight(sal_True) ) 1286*cdf0e10cSrcweir rSet.DisableItem(FN_OPTIMIZE_TABLE); 1287*cdf0e10cSrcweir break; 1288*cdf0e10cSrcweir case SID_INSERT_DIAGRAM: 1289*cdf0e10cSrcweir { 1290*cdf0e10cSrcweir SvtModuleOptions aMOpt; 1291*cdf0e10cSrcweir if ( !aMOpt.IsMath() || rSh.IsTblComplexForChart() ) 1292*cdf0e10cSrcweir rSet.DisableItem(nSlot); 1293*cdf0e10cSrcweir } 1294*cdf0e10cSrcweir break; 1295*cdf0e10cSrcweir 1296*cdf0e10cSrcweir case FN_INSERT_TABLE: 1297*cdf0e10cSrcweir // Irgendeinen Wert "putten", damit Controller enabled bleibt. 1298*cdf0e10cSrcweir // Statt "Insert:Table" erscheint dann "Format:Table". 1299*cdf0e10cSrcweir // rSet.Put(SfxUInt16Item(nSlot, 1)); 1300*cdf0e10cSrcweir break; 1301*cdf0e10cSrcweir 1302*cdf0e10cSrcweir case FN_TABLE_OPTIMAL_HEIGHT: 1303*cdf0e10cSrcweir { 1304*cdf0e10cSrcweir //Disablen wenn bereits auto-Hoehe eingestellt ist. 1305*cdf0e10cSrcweir SwFmtFrmSize *pSz; 1306*cdf0e10cSrcweir rSh.GetRowHeight( pSz ); 1307*cdf0e10cSrcweir if ( pSz ) 1308*cdf0e10cSrcweir { 1309*cdf0e10cSrcweir if ( ATT_VAR_SIZE == pSz->GetHeightSizeType() ) 1310*cdf0e10cSrcweir rSet.DisableItem( nSlot ); 1311*cdf0e10cSrcweir delete pSz; 1312*cdf0e10cSrcweir } 1313*cdf0e10cSrcweir } 1314*cdf0e10cSrcweir break; 1315*cdf0e10cSrcweir case FN_TABLE_INSERT_ROW: 1316*cdf0e10cSrcweir case FN_TABLE_INSERT_ROW_DLG: 1317*cdf0e10cSrcweir { 1318*cdf0e10cSrcweir if ( rSh.IsInRepeatedHeadline() ) 1319*cdf0e10cSrcweir rSet.DisableItem( nSlot ); 1320*cdf0e10cSrcweir } 1321*cdf0e10cSrcweir break; 1322*cdf0e10cSrcweir case RES_LR_SPACE: 1323*cdf0e10cSrcweir rSet.Put(pFmt->GetLRSpace()); 1324*cdf0e10cSrcweir break; 1325*cdf0e10cSrcweir case RES_UL_SPACE: 1326*cdf0e10cSrcweir rSet.Put(pFmt->GetULSpace()); 1327*cdf0e10cSrcweir break; 1328*cdf0e10cSrcweir case FN_TABLE_VERT_NONE: 1329*cdf0e10cSrcweir case FN_TABLE_VERT_CENTER: 1330*cdf0e10cSrcweir case FN_TABLE_VERT_BOTTOM: 1331*cdf0e10cSrcweir { 1332*cdf0e10cSrcweir sal_uInt16 nAlign = rSh.GetBoxAlign(); 1333*cdf0e10cSrcweir sal_Bool bSet = (nSlot == FN_TABLE_VERT_NONE && nAlign == text::VertOrientation::NONE) || 1334*cdf0e10cSrcweir (nSlot == FN_TABLE_VERT_CENTER && nAlign == text::VertOrientation::CENTER) || 1335*cdf0e10cSrcweir (nSlot == FN_TABLE_VERT_BOTTOM && nAlign == text::VertOrientation::BOTTOM); 1336*cdf0e10cSrcweir rSet.Put(SfxBoolItem(nSlot, bSet)); 1337*cdf0e10cSrcweir } 1338*cdf0e10cSrcweir break; 1339*cdf0e10cSrcweir 1340*cdf0e10cSrcweir case FN_TABLE_MODE_FIX : 1341*cdf0e10cSrcweir case FN_TABLE_MODE_FIX_PROP : 1342*cdf0e10cSrcweir case FN_TABLE_MODE_VARIABLE : 1343*cdf0e10cSrcweir { 1344*cdf0e10cSrcweir TblChgMode nMode = rSh.GetTblChgMode(); 1345*cdf0e10cSrcweir sal_Bool bSet = (nSlot == FN_TABLE_MODE_FIX && nMode == TBLFIX_CHGABS) || 1346*cdf0e10cSrcweir (nSlot == FN_TABLE_MODE_FIX_PROP && nMode == TBLFIX_CHGPROP) || 1347*cdf0e10cSrcweir (nSlot == FN_TABLE_MODE_VARIABLE && nMode == TBLVAR_CHGABS); 1348*cdf0e10cSrcweir rSet.Put(SfxBoolItem(nSlot, bSet)); 1349*cdf0e10cSrcweir } 1350*cdf0e10cSrcweir break; 1351*cdf0e10cSrcweir 1352*cdf0e10cSrcweir case SID_ATTR_PARA_SPLIT: 1353*cdf0e10cSrcweir rSet.Put( pFmt->GetKeep() ); 1354*cdf0e10cSrcweir break; 1355*cdf0e10cSrcweir 1356*cdf0e10cSrcweir case SID_ATTR_PARA_KEEP: 1357*cdf0e10cSrcweir rSet.Put( pFmt->GetLayoutSplit() ); 1358*cdf0e10cSrcweir break; 1359*cdf0e10cSrcweir case FN_TABLE_SPLIT_TABLE: 1360*cdf0e10cSrcweir { 1361*cdf0e10cSrcweir if ( rSh.IsInHeadline() ) 1362*cdf0e10cSrcweir rSet.DisableItem( nSlot ); 1363*cdf0e10cSrcweir } 1364*cdf0e10cSrcweir break; 1365*cdf0e10cSrcweir case FN_TABLE_MERGE_TABLE: 1366*cdf0e10cSrcweir { 1367*cdf0e10cSrcweir sal_Bool bAsk; 1368*cdf0e10cSrcweir if( !rSh.CanMergeTable( sal_True, &bAsk )) 1369*cdf0e10cSrcweir rSet.DisableItem( nSlot ); 1370*cdf0e10cSrcweir } 1371*cdf0e10cSrcweir break; 1372*cdf0e10cSrcweir 1373*cdf0e10cSrcweir case FN_TABLE_DELETE_ROW: 1374*cdf0e10cSrcweir { 1375*cdf0e10cSrcweir SwSelBoxes aBoxes; 1376*cdf0e10cSrcweir ::GetTblSel( rSh, aBoxes, nsSwTblSearchType::TBLSEARCH_ROW ); 1377*cdf0e10cSrcweir if( ::HasProtectedCells( aBoxes )) 1378*cdf0e10cSrcweir rSet.DisableItem( nSlot ); 1379*cdf0e10cSrcweir } 1380*cdf0e10cSrcweir break; 1381*cdf0e10cSrcweir case FN_TABLE_DELETE_COL: 1382*cdf0e10cSrcweir { 1383*cdf0e10cSrcweir SwSelBoxes aBoxes; 1384*cdf0e10cSrcweir ::GetTblSel( rSh, aBoxes, nsSwTblSearchType::TBLSEARCH_COL ); 1385*cdf0e10cSrcweir if( ::HasProtectedCells( aBoxes )) 1386*cdf0e10cSrcweir rSet.DisableItem( nSlot ); 1387*cdf0e10cSrcweir } 1388*cdf0e10cSrcweir break; 1389*cdf0e10cSrcweir 1390*cdf0e10cSrcweir case FN_TABLE_UNSET_READ_ONLY_CELLS: 1391*cdf0e10cSrcweir // disable in readonly sections, but enable in protected cells 1392*cdf0e10cSrcweir if( !rSh.CanUnProtectCells() ) 1393*cdf0e10cSrcweir rSet.DisableItem( nSlot ); 1394*cdf0e10cSrcweir break; 1395*cdf0e10cSrcweir case RES_ROW_SPLIT: 1396*cdf0e10cSrcweir { 1397*cdf0e10cSrcweir const SwFmtLayoutSplit& rTabSplit = pFmt->GetLayoutSplit(); 1398*cdf0e10cSrcweir if ( 0 == rTabSplit.GetValue() ) 1399*cdf0e10cSrcweir { 1400*cdf0e10cSrcweir rSet.DisableItem( nSlot ); 1401*cdf0e10cSrcweir } 1402*cdf0e10cSrcweir else 1403*cdf0e10cSrcweir { 1404*cdf0e10cSrcweir SwFmtRowSplit* pSplit = 0; 1405*cdf0e10cSrcweir rSh.GetRowSplit(pSplit); 1406*cdf0e10cSrcweir if(pSplit) 1407*cdf0e10cSrcweir rSet.Put(*pSplit); 1408*cdf0e10cSrcweir else 1409*cdf0e10cSrcweir rSet.InvalidateItem( nSlot ); 1410*cdf0e10cSrcweir delete pSplit; 1411*cdf0e10cSrcweir } 1412*cdf0e10cSrcweir } 1413*cdf0e10cSrcweir break; 1414*cdf0e10cSrcweir case FN_TABLE_HEADLINE_REPEAT: 1415*cdf0e10cSrcweir if(0 != rSh.GetRowsToRepeat()) 1416*cdf0e10cSrcweir rSet.Put(SfxBoolItem(nSlot, sal_True)); 1417*cdf0e10cSrcweir else if(!rSh.GetRowSelectionFromTop()) 1418*cdf0e10cSrcweir rSet.DisableItem( nSlot ); 1419*cdf0e10cSrcweir else 1420*cdf0e10cSrcweir rSet.Put(SfxBoolItem(nSlot, sal_False)); 1421*cdf0e10cSrcweir break; 1422*cdf0e10cSrcweir case FN_TABLE_SELECT_CELL : 1423*cdf0e10cSrcweir if(rSh.HasBoxSelection()) 1424*cdf0e10cSrcweir rSet.DisableItem( nSlot ); 1425*cdf0e10cSrcweir break; 1426*cdf0e10cSrcweir } 1427*cdf0e10cSrcweir nSlot = aIter.NextWhich(); 1428*cdf0e10cSrcweir } 1429*cdf0e10cSrcweir } 1430*cdf0e10cSrcweir 1431*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1432*cdf0e10cSrcweir Beschreibung: 1433*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1434*cdf0e10cSrcweir 1435*cdf0e10cSrcweir SwTableShell::SwTableShell(SwView &_rView) : 1436*cdf0e10cSrcweir SwBaseShell(_rView) 1437*cdf0e10cSrcweir { 1438*cdf0e10cSrcweir SetName(String::CreateFromAscii("Table")); 1439*cdf0e10cSrcweir SetHelpId(SW_TABSHELL); 1440*cdf0e10cSrcweir } 1441*cdf0e10cSrcweir 1442*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1443*cdf0e10cSrcweir Beschreibung: 1444*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1445*cdf0e10cSrcweir 1446*cdf0e10cSrcweir void SwTableShell::GetFrmBorderState(SfxItemSet &rSet) 1447*cdf0e10cSrcweir { 1448*cdf0e10cSrcweir SfxItemSet aCoreSet( GetPool(), 1449*cdf0e10cSrcweir RES_BOX, RES_BOX, 1450*cdf0e10cSrcweir SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0 ); 1451*cdf0e10cSrcweir SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER ); 1452*cdf0e10cSrcweir aCoreSet.Put( aBoxInfo ); 1453*cdf0e10cSrcweir GetShell().GetTabBorders( aCoreSet ); 1454*cdf0e10cSrcweir rSet.Put( aCoreSet ); 1455*cdf0e10cSrcweir } 1456*cdf0e10cSrcweir 1457*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1458*cdf0e10cSrcweir Beschreibung: 1459*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1460*cdf0e10cSrcweir 1461*cdf0e10cSrcweir void SwTableShell::ExecTableStyle(SfxRequest& rReq) 1462*cdf0e10cSrcweir { 1463*cdf0e10cSrcweir SwWrtShell &rSh = GetShell(); 1464*cdf0e10cSrcweir const SfxItemSet *pArgs = rReq.GetArgs(); 1465*cdf0e10cSrcweir if(pArgs) 1466*cdf0e10cSrcweir switch ( rReq.GetSlot() ) 1467*cdf0e10cSrcweir { 1468*cdf0e10cSrcweir case SID_FRAME_LINESTYLE: 1469*cdf0e10cSrcweir case SID_FRAME_LINECOLOR: 1470*cdf0e10cSrcweir { 1471*cdf0e10cSrcweir /* Tabellenselektion ist abgeschafft 1472*cdf0e10cSrcweir sal_Bool bPopCrsr = sal_False; 1473*cdf0e10cSrcweir if ( !rReq.IsAPI() ) 1474*cdf0e10cSrcweir { 1475*cdf0e10cSrcweir //Keine Tabellenselektion -> Aenderung wird auf die gesamte 1476*cdf0e10cSrcweir //Tabelle. 1477*cdf0e10cSrcweir if ( !rSh.IsTableMode() ) 1478*cdf0e10cSrcweir { 1479*cdf0e10cSrcweir bPopCrsr = sal_True; 1480*cdf0e10cSrcweir rSh.Push(); 1481*cdf0e10cSrcweir rSh.StartAction(); 1482*cdf0e10cSrcweir rSh.EnterStdMode(); 1483*cdf0e10cSrcweir rSh.MoveTable( fnTableCurr, fnTableStart ); 1484*cdf0e10cSrcweir rSh.SttSelect(); 1485*cdf0e10cSrcweir rSh.MoveTable( fnTableCurr, fnTableEnd ); 1486*cdf0e10cSrcweir rSh.EndSelect(); 1487*cdf0e10cSrcweir } 1488*cdf0e10cSrcweir }*/ 1489*cdf0e10cSrcweir if ( rReq.GetSlot() == SID_FRAME_LINESTYLE ) 1490*cdf0e10cSrcweir { 1491*cdf0e10cSrcweir const SvxLineItem &rLineItem = (const SvxLineItem&)pArgs-> 1492*cdf0e10cSrcweir Get( SID_FRAME_LINESTYLE ); 1493*cdf0e10cSrcweir const SvxBorderLine* pBorderLine = rLineItem.GetLine(); 1494*cdf0e10cSrcweir rSh.SetTabLineStyle( 0, sal_True, pBorderLine); 1495*cdf0e10cSrcweir } 1496*cdf0e10cSrcweir else 1497*cdf0e10cSrcweir { 1498*cdf0e10cSrcweir const SvxColorItem &rNewColorItem = (const SvxColorItem&)pArgs-> 1499*cdf0e10cSrcweir Get( SID_FRAME_LINECOLOR ); 1500*cdf0e10cSrcweir rSh.SetTabLineStyle( &rNewColorItem.GetValue() ); 1501*cdf0e10cSrcweir } 1502*cdf0e10cSrcweir 1503*cdf0e10cSrcweir rReq.Done(); 1504*cdf0e10cSrcweir /* if ( bPopCrsr ) 1505*cdf0e10cSrcweir { 1506*cdf0e10cSrcweir rSh.KillPams(); 1507*cdf0e10cSrcweir rSh.Pop(sal_False); 1508*cdf0e10cSrcweir rSh.EndAction(); 1509*cdf0e10cSrcweir }*/ 1510*cdf0e10cSrcweir break; 1511*cdf0e10cSrcweir } 1512*cdf0e10cSrcweir } 1513*cdf0e10cSrcweir } 1514*cdf0e10cSrcweir 1515*cdf0e10cSrcweir 1516*cdf0e10cSrcweir void SwTableShell::GetLineStyleState(SfxItemSet &rSet) 1517*cdf0e10cSrcweir { 1518*cdf0e10cSrcweir SfxItemSet aCoreSet( GetPool(), 1519*cdf0e10cSrcweir RES_BOX, RES_BOX, 1520*cdf0e10cSrcweir SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0); 1521*cdf0e10cSrcweir SvxBoxInfoItem aCoreInfo( SID_ATTR_BORDER_INNER ); 1522*cdf0e10cSrcweir aCoreSet.Put(aCoreInfo); 1523*cdf0e10cSrcweir GetShell().GetTabBorders( aCoreSet ); 1524*cdf0e10cSrcweir 1525*cdf0e10cSrcweir const SvxBoxItem& rBoxItem = (const SvxBoxItem&)aCoreSet.Get( RES_BOX ); 1526*cdf0e10cSrcweir const SvxBorderLine* pLine = rBoxItem.GetTop(); 1527*cdf0e10cSrcweir 1528*cdf0e10cSrcweir rSet.Put( SvxColorItem( pLine ? pLine->GetColor() : Color(), SID_FRAME_LINECOLOR ) ); 1529*cdf0e10cSrcweir SvxLineItem aLine( SID_FRAME_LINESTYLE ); 1530*cdf0e10cSrcweir aLine.SetLine(pLine); 1531*cdf0e10cSrcweir rSet.Put( aLine ); 1532*cdf0e10cSrcweir } 1533*cdf0e10cSrcweir 1534*cdf0e10cSrcweir void SwTableShell::ExecNumberFormat(SfxRequest& rReq) 1535*cdf0e10cSrcweir { 1536*cdf0e10cSrcweir const SfxItemSet* pArgs = rReq.GetArgs(); 1537*cdf0e10cSrcweir SwWrtShell &rSh = GetShell(); 1538*cdf0e10cSrcweir 1539*cdf0e10cSrcweir //Erstmal die Slots, die keinen FrmMgr benoetigen. 1540*cdf0e10cSrcweir const SfxPoolItem* pItem = 0; 1541*cdf0e10cSrcweir sal_uInt16 nSlot = rReq.GetSlot(); 1542*cdf0e10cSrcweir if(pArgs) 1543*cdf0e10cSrcweir pArgs->GetItemState(GetPool().GetWhich(nSlot), sal_False, &pItem); 1544*cdf0e10cSrcweir 1545*cdf0e10cSrcweir // Sprache immer von Cursorposition besorgen 1546*cdf0e10cSrcweir LanguageType eLang = rSh.GetCurLang(); 1547*cdf0e10cSrcweir SvNumberFormatter* pFormatter = rSh.GetNumberFormatter(); 1548*cdf0e10cSrcweir sal_uInt32 nNumberFormat = NUMBERFORMAT_ENTRY_NOT_FOUND; 1549*cdf0e10cSrcweir sal_uInt16 nFmtType = 0, nOffset = 0; 1550*cdf0e10cSrcweir 1551*cdf0e10cSrcweir switch ( nSlot ) 1552*cdf0e10cSrcweir { 1553*cdf0e10cSrcweir case FN_NUMBER_FORMAT: 1554*cdf0e10cSrcweir if( pItem ) 1555*cdf0e10cSrcweir { 1556*cdf0e10cSrcweir // Index fuer String bestimmen 1557*cdf0e10cSrcweir String aCode( ((const SfxStringItem*)pItem)->GetValue() ); 1558*cdf0e10cSrcweir nNumberFormat = pFormatter->GetEntryKey( aCode, eLang ); 1559*cdf0e10cSrcweir if( NUMBERFORMAT_ENTRY_NOT_FOUND == nNumberFormat ) 1560*cdf0e10cSrcweir { 1561*cdf0e10cSrcweir // neu eintragen 1562*cdf0e10cSrcweir xub_StrLen nErrPos; 1563*cdf0e10cSrcweir short nType; 1564*cdf0e10cSrcweir if( !pFormatter->PutEntry( aCode, nErrPos, nType, 1565*cdf0e10cSrcweir nNumberFormat, eLang )) 1566*cdf0e10cSrcweir nNumberFormat = NUMBERFORMAT_ENTRY_NOT_FOUND; 1567*cdf0e10cSrcweir } 1568*cdf0e10cSrcweir } 1569*cdf0e10cSrcweir break; 1570*cdf0e10cSrcweir case FN_NUMBER_STANDARD: nFmtType = NUMBERFORMAT_NUMBER; break; 1571*cdf0e10cSrcweir case FN_NUMBER_SCIENTIFIC: nFmtType = NUMBERFORMAT_SCIENTIFIC; break; 1572*cdf0e10cSrcweir case FN_NUMBER_DATE: nFmtType = NUMBERFORMAT_DATE; break; 1573*cdf0e10cSrcweir case FN_NUMBER_TIME: nFmtType = NUMBERFORMAT_TIME; break; 1574*cdf0e10cSrcweir case FN_NUMBER_CURRENCY: nFmtType = NUMBERFORMAT_CURRENCY; break; 1575*cdf0e10cSrcweir case FN_NUMBER_PERCENT: nFmtType = NUMBERFORMAT_PERCENT; break; 1576*cdf0e10cSrcweir 1577*cdf0e10cSrcweir case FN_NUMBER_TWODEC: // #.##0,00 1578*cdf0e10cSrcweir nFmtType = NUMBERFORMAT_NUMBER; 1579*cdf0e10cSrcweir nOffset = NF_NUMBER_1000DEC2; 1580*cdf0e10cSrcweir break; 1581*cdf0e10cSrcweir 1582*cdf0e10cSrcweir default: 1583*cdf0e10cSrcweir ASSERT(sal_False, falscher Dispatcher); 1584*cdf0e10cSrcweir return; 1585*cdf0e10cSrcweir } 1586*cdf0e10cSrcweir 1587*cdf0e10cSrcweir if( nFmtType ) 1588*cdf0e10cSrcweir nNumberFormat = pFormatter->GetStandardFormat( nFmtType, eLang ) + nOffset; 1589*cdf0e10cSrcweir 1590*cdf0e10cSrcweir if( NUMBERFORMAT_ENTRY_NOT_FOUND != nNumberFormat ) 1591*cdf0e10cSrcweir { 1592*cdf0e10cSrcweir SfxItemSet aBoxSet( GetPool(), RES_BOXATR_FORMAT, RES_BOXATR_FORMAT ); 1593*cdf0e10cSrcweir aBoxSet.Put( SwTblBoxNumFormat( nNumberFormat )); 1594*cdf0e10cSrcweir rSh.SetTblBoxFormulaAttrs( aBoxSet ); 1595*cdf0e10cSrcweir } 1596*cdf0e10cSrcweir 1597*cdf0e10cSrcweir } 1598*cdf0e10cSrcweir 1599