1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_sw.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #ifdef SW_DLLIMPLEMENTATION 32*cdf0e10cSrcweir #undef SW_DLLIMPLEMENTATION 33*cdf0e10cSrcweir #endif 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir 36*cdf0e10cSrcweir #include <hintids.hxx> 37*cdf0e10cSrcweir #include <tools/list.hxx> 38*cdf0e10cSrcweir #include <vcl/msgbox.hxx> 39*cdf0e10cSrcweir #include <svl/stritem.hxx> 40*cdf0e10cSrcweir #include <svl/intitem.hxx> 41*cdf0e10cSrcweir #include <svx/htmlmode.hxx> 42*cdf0e10cSrcweir #include <editeng/keepitem.hxx> 43*cdf0e10cSrcweir #include <editeng/brkitem.hxx> 44*cdf0e10cSrcweir #include <editeng/ulspitem.hxx> 45*cdf0e10cSrcweir #include <editeng/frmdiritem.hxx> 46*cdf0e10cSrcweir #include <svl/ctloptions.hxx> 47*cdf0e10cSrcweir #include <swmodule.hxx> 48*cdf0e10cSrcweir #include <fmtornt.hxx> 49*cdf0e10cSrcweir #include <fmtpdsc.hxx> 50*cdf0e10cSrcweir #include <fmtlsplt.hxx> 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir #include <svtools/htmlcfg.hxx> 53*cdf0e10cSrcweir #include <fmtrowsplt.hxx> 54*cdf0e10cSrcweir #include <svx/htmlmode.hxx> 55*cdf0e10cSrcweir 56*cdf0e10cSrcweir #include "access.hrc" 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir #ifndef _DOCSH_HXX 59*cdf0e10cSrcweir #include <docsh.hxx> 60*cdf0e10cSrcweir #endif 61*cdf0e10cSrcweir #include <wrtsh.hxx> 62*cdf0e10cSrcweir #ifndef _VIEW_HXX 63*cdf0e10cSrcweir #include <view.hxx> 64*cdf0e10cSrcweir #endif 65*cdf0e10cSrcweir #include <viewopt.hxx> 66*cdf0e10cSrcweir #include <uitool.hxx> 67*cdf0e10cSrcweir #include <frmatr.hxx> 68*cdf0e10cSrcweir #include <tabledlg.hxx> 69*cdf0e10cSrcweir #ifndef _TABLEPG_HXX 70*cdf0e10cSrcweir #include <tablepg.hxx> 71*cdf0e10cSrcweir #endif 72*cdf0e10cSrcweir #include <tablemgr.hxx> 73*cdf0e10cSrcweir #include <pagedesc.hxx> 74*cdf0e10cSrcweir #include <uiitems.hxx> 75*cdf0e10cSrcweir #include <poolfmt.hxx> 76*cdf0e10cSrcweir #include <SwStyleNameMapper.hxx> 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir #ifndef _CMDID_H 79*cdf0e10cSrcweir #include <cmdid.h> 80*cdf0e10cSrcweir #endif 81*cdf0e10cSrcweir #ifndef _TABLEDLG_HRC 82*cdf0e10cSrcweir #include <tabledlg.hrc> 83*cdf0e10cSrcweir #endif 84*cdf0e10cSrcweir #ifndef _TABLE_HRC 85*cdf0e10cSrcweir #include <table.hrc> 86*cdf0e10cSrcweir #endif 87*cdf0e10cSrcweir #include <svx/svxids.hrc> 88*cdf0e10cSrcweir #include <svx/dialogs.hrc> 89*cdf0e10cSrcweir #include <svx/flagsdef.hxx> 90*cdf0e10cSrcweir #include <svx/svxdlg.hxx> 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir using namespace ::com::sun::star; 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir #ifdef DEBUG_TBLDLG 96*cdf0e10cSrcweir void DbgTblRep(SwTableRep* pRep) 97*cdf0e10cSrcweir { 98*cdf0e10cSrcweir DBG_ERROR(String(pRep->GetColCount())) 99*cdf0e10cSrcweir DBG_ERROR(String(pRep->GetAllColCount())) 100*cdf0e10cSrcweir SwTwips nSum = 0; 101*cdf0e10cSrcweir for(sal_uInt16 i = 0; i < pRep->GetAllColCount(); i++) 102*cdf0e10cSrcweir { 103*cdf0e10cSrcweir String sMsg(i); 104*cdf0e10cSrcweir sMsg += pRep->GetColumns()[i].bVisible ? " v " : " h "; 105*cdf0e10cSrcweir sMsg += pRep->GetColumns()[i].nWidth; 106*cdf0e10cSrcweir nSum +=pRep->GetColumns()[i].nWidth; 107*cdf0e10cSrcweir DBG_ERROR(sMsg) 108*cdf0e10cSrcweir } 109*cdf0e10cSrcweir String sMsg("Spaltensumme: "); 110*cdf0e10cSrcweir sMsg += nSum; 111*cdf0e10cSrcweir sMsg += " Tblbreite: "; 112*cdf0e10cSrcweir sMsg += pRep->GetWidth(); 113*cdf0e10cSrcweir DBG_ERROR(sMsg) 114*cdf0e10cSrcweir sMsg = "Gesamt/Links/Rechts: "; 115*cdf0e10cSrcweir sMsg += pRep->GetSpace(); 116*cdf0e10cSrcweir sMsg += '/'; 117*cdf0e10cSrcweir sMsg += pRep->GetLeftSpace(); 118*cdf0e10cSrcweir sMsg += '/'; 119*cdf0e10cSrcweir sMsg += pRep->GetRightSpace(); 120*cdf0e10cSrcweir DBG_ERROR(sMsg) 121*cdf0e10cSrcweir sMsg = "Align: "; 122*cdf0e10cSrcweir sMsg += pRep->GetAlign(); 123*cdf0e10cSrcweir DBG_ERROR(sMsg) 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir }; 126*cdf0e10cSrcweir 127*cdf0e10cSrcweir #endif 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir SwFormatTablePage::SwFormatTablePage( Window* pParent, const SfxItemSet& rSet ) : 131*cdf0e10cSrcweir SfxTabPage(pParent, SW_RES( TP_FORMAT_TABLE ), rSet ), 132*cdf0e10cSrcweir aOptionsFL(this, SW_RES( FL_OPTIONS )), 133*cdf0e10cSrcweir aNameFT(this, SW_RES( FT_NAME )), 134*cdf0e10cSrcweir aNameED(this, SW_RES( ED_NAME )), 135*cdf0e10cSrcweir aWidthFT(this, SW_RES( FT_WIDTH )), 136*cdf0e10cSrcweir aWidthMF(this, SW_RES( ED_WIDTH )), 137*cdf0e10cSrcweir aRelWidthCB(this, SW_RES( CB_REL_WIDTH )), 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir aPosFL(this, SW_RES( FL_POS )), 140*cdf0e10cSrcweir aFullBtn(this, SW_RES( RB_FULL )), 141*cdf0e10cSrcweir aLeftBtn(this, SW_RES( RB_LEFT )), 142*cdf0e10cSrcweir aFromLeftBtn(this, SW_RES( RB_FROM_LEFT )), 143*cdf0e10cSrcweir aRightBtn(this, SW_RES( RB_RIGHT )), 144*cdf0e10cSrcweir aCenterBtn(this, SW_RES( RB_CENTER )), 145*cdf0e10cSrcweir aFreeBtn(this, SW_RES( RB_FREE )), 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir aDistFL(this, SW_RES( FL_DIST )), 148*cdf0e10cSrcweir aLeftFT(this, SW_RES( FT_LEFT_DIST )), 149*cdf0e10cSrcweir aLeftMF(this, SW_RES( ED_LEFT_DIST )), 150*cdf0e10cSrcweir aRightFT(this, SW_RES( FT_RIGHT_DIST )), 151*cdf0e10cSrcweir aRightMF(this, SW_RES( ED_RIGHT_DIST )), 152*cdf0e10cSrcweir aTopFT (this, SW_RES( FT_TOP_DIST )), 153*cdf0e10cSrcweir aTopMF(this, SW_RES( ED_TOP_DIST )), 154*cdf0e10cSrcweir aBottomFT(this, SW_RES( FT_BOTTOM_DIST )), 155*cdf0e10cSrcweir aBottomMF(this, SW_RES( ED_BOTTOM_DIST )), 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir aPropertiesFL(this, SW_RES( FL_PROPERTIES )), 158*cdf0e10cSrcweir aTextDirectionFT(this, SW_RES( FT_TEXTDIRECTION )), 159*cdf0e10cSrcweir aTextDirectionLB(this, SW_RES( LB_TEXTDIRECTION )), 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir pTblData(0), 162*cdf0e10cSrcweir nSaveWidth(0), 163*cdf0e10cSrcweir nMinTableWidth(MINLAY), 164*cdf0e10cSrcweir bModified(sal_False), 165*cdf0e10cSrcweir bFull(0), 166*cdf0e10cSrcweir bHtmlMode(sal_False) 167*cdf0e10cSrcweir { 168*cdf0e10cSrcweir FreeResource(); 169*cdf0e10cSrcweir SetExchangeSupport(); 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir const SfxPoolItem* pItem; 172*cdf0e10cSrcweir if(SFX_ITEM_SET == rSet.GetItemState(SID_HTML_MODE, sal_False, &pItem)) 173*cdf0e10cSrcweir bHtmlMode = 0 != (((const SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON); 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir sal_Bool bCTL = SW_MOD()->GetCTLOptions().IsCTLFontEnabled(); 176*cdf0e10cSrcweir if( !bHtmlMode && bCTL ) 177*cdf0e10cSrcweir { 178*cdf0e10cSrcweir aPropertiesFL.Show(); 179*cdf0e10cSrcweir aTextDirectionFT.Show(); 180*cdf0e10cSrcweir aTextDirectionLB.Show(); 181*cdf0e10cSrcweir } 182*cdf0e10cSrcweir 183*cdf0e10cSrcweir Init(); 184*cdf0e10cSrcweir } 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir /*------------------------------------------------------------------------ 187*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 188*cdf0e10cSrcweir void SwFormatTablePage::Init() 189*cdf0e10cSrcweir { 190*cdf0e10cSrcweir aLeftMF.MetricField::SetMin(-999999); 191*cdf0e10cSrcweir aRightMF.MetricField::SetMin(-999999); 192*cdf0e10cSrcweir 193*cdf0e10cSrcweir // handler 194*cdf0e10cSrcweir Link aLk = LINK( this, SwFormatTablePage, AutoClickHdl ); 195*cdf0e10cSrcweir aFullBtn.SetClickHdl( aLk ); 196*cdf0e10cSrcweir aFreeBtn.SetClickHdl( aLk ); 197*cdf0e10cSrcweir aLeftBtn.SetClickHdl( aLk ); 198*cdf0e10cSrcweir aFromLeftBtn.SetClickHdl( aLk ); 199*cdf0e10cSrcweir aRightBtn.SetClickHdl( aLk ); 200*cdf0e10cSrcweir aCenterBtn.SetClickHdl( aLk ); 201*cdf0e10cSrcweir 202*cdf0e10cSrcweir aLk = LINK( this, SwFormatTablePage, UpDownLoseFocusHdl ); 203*cdf0e10cSrcweir aTopMF.SetUpHdl( aLk ); 204*cdf0e10cSrcweir aBottomMF.SetUpHdl( aLk ); 205*cdf0e10cSrcweir aRightMF.SetUpHdl( aLk ); 206*cdf0e10cSrcweir aLeftMF.SetUpHdl( aLk ); 207*cdf0e10cSrcweir aWidthMF.SetUpHdl( aLk ); 208*cdf0e10cSrcweir 209*cdf0e10cSrcweir aTopMF.SetDownHdl( aLk ); 210*cdf0e10cSrcweir aBottomMF.SetDownHdl( aLk ); 211*cdf0e10cSrcweir aRightMF.SetDownHdl( aLk ); 212*cdf0e10cSrcweir aLeftMF.SetDownHdl( aLk ); 213*cdf0e10cSrcweir aWidthMF.SetDownHdl( aLk ); 214*cdf0e10cSrcweir 215*cdf0e10cSrcweir aTopMF.SetLoseFocusHdl( aLk ); 216*cdf0e10cSrcweir aBottomMF.SetLoseFocusHdl( aLk ); 217*cdf0e10cSrcweir aRightMF.SetLoseFocusHdl( aLk ); 218*cdf0e10cSrcweir aLeftMF.SetLoseFocusHdl( aLk ); 219*cdf0e10cSrcweir aWidthMF.SetLoseFocusHdl( aLk ); 220*cdf0e10cSrcweir 221*cdf0e10cSrcweir aRelWidthCB.SetClickHdl(LINK( this, SwFormatTablePage, RelWidthClickHdl )); 222*cdf0e10cSrcweir } 223*cdf0e10cSrcweir 224*cdf0e10cSrcweir /*------------------------------------------------------------------------*/ 225*cdf0e10cSrcweir 226*cdf0e10cSrcweir IMPL_LINK( SwFormatTablePage, RelWidthClickHdl, CheckBox *, pBtn ) 227*cdf0e10cSrcweir { 228*cdf0e10cSrcweir DBG_ASSERT(pTblData, "Tabellendaten nicht da?"); 229*cdf0e10cSrcweir sal_Bool bIsChecked = pBtn->IsChecked(); 230*cdf0e10cSrcweir sal_Int64 nLeft = aLeftMF.DenormalizePercent(aLeftMF.GetValue(FUNIT_TWIP )); 231*cdf0e10cSrcweir sal_Int64 nRight = aRightMF.DenormalizePercent(aRightMF.GetValue(FUNIT_TWIP )); 232*cdf0e10cSrcweir aWidthMF.ShowPercent(bIsChecked); 233*cdf0e10cSrcweir aLeftMF.ShowPercent(bIsChecked); 234*cdf0e10cSrcweir aRightMF.ShowPercent(bIsChecked); 235*cdf0e10cSrcweir 236*cdf0e10cSrcweir if (bIsChecked) 237*cdf0e10cSrcweir { 238*cdf0e10cSrcweir aWidthMF.SetRefValue(pTblData->GetSpace()); 239*cdf0e10cSrcweir aLeftMF.SetRefValue(pTblData->GetSpace()); 240*cdf0e10cSrcweir aRightMF.SetRefValue(pTblData->GetSpace()); 241*cdf0e10cSrcweir aLeftMF.MetricField::SetMin(0); // wird vom Percentfield ueberschrieben 242*cdf0e10cSrcweir aRightMF.MetricField::SetMin(0);// -""- 243*cdf0e10cSrcweir aLeftMF.MetricField::SetMax(99); // 244*cdf0e10cSrcweir aRightMF.MetricField::SetMax(99);// 245*cdf0e10cSrcweir aLeftMF.SetPrcntValue(aLeftMF.NormalizePercent(nLeft ), FUNIT_TWIP ); 246*cdf0e10cSrcweir aRightMF.SetPrcntValue(aRightMF.NormalizePercent(nRight ), FUNIT_TWIP ); 247*cdf0e10cSrcweir } 248*cdf0e10cSrcweir else 249*cdf0e10cSrcweir ModifyHdl(&aLeftMF); // Werte wieder korrigieren 250*cdf0e10cSrcweir 251*cdf0e10cSrcweir if(aFreeBtn.IsChecked()) 252*cdf0e10cSrcweir { 253*cdf0e10cSrcweir sal_Bool bEnable = !pBtn->IsChecked(); 254*cdf0e10cSrcweir aRightMF.Enable(bEnable); 255*cdf0e10cSrcweir aRightFT.Enable(bEnable); 256*cdf0e10cSrcweir } 257*cdf0e10cSrcweir bModified = sal_True; 258*cdf0e10cSrcweir 259*cdf0e10cSrcweir return 0; 260*cdf0e10cSrcweir } 261*cdf0e10cSrcweir 262*cdf0e10cSrcweir /*------------------------------------------------------------------------ 263*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 264*cdf0e10cSrcweir IMPL_LINK( SwFormatTablePage, AutoClickHdl, CheckBox *, pBox ) 265*cdf0e10cSrcweir { 266*cdf0e10cSrcweir sal_Bool bRestore = sal_True, 267*cdf0e10cSrcweir bLeftEnable = sal_False, 268*cdf0e10cSrcweir bRightEnable= sal_False, 269*cdf0e10cSrcweir bWidthEnable= sal_False, 270*cdf0e10cSrcweir bOthers = sal_True; 271*cdf0e10cSrcweir if( (RadioButton *) pBox == &aFullBtn ) 272*cdf0e10cSrcweir { 273*cdf0e10cSrcweir aLeftMF.SetPrcntValue(0); 274*cdf0e10cSrcweir aRightMF.SetPrcntValue(0); 275*cdf0e10cSrcweir nSaveWidth = static_cast< SwTwips >(aWidthMF.DenormalizePercent(aWidthMF.GetValue(FUNIT_TWIP ))); 276*cdf0e10cSrcweir aWidthMF.SetPrcntValue(aWidthMF.NormalizePercent(pTblData->GetSpace() ), FUNIT_TWIP ); 277*cdf0e10cSrcweir bFull = sal_True; 278*cdf0e10cSrcweir bRestore = sal_False; 279*cdf0e10cSrcweir } 280*cdf0e10cSrcweir else if( (RadioButton *) pBox == &aLeftBtn ) 281*cdf0e10cSrcweir { 282*cdf0e10cSrcweir bRightEnable = bWidthEnable = sal_True; 283*cdf0e10cSrcweir aLeftMF.SetPrcntValue(0); 284*cdf0e10cSrcweir } 285*cdf0e10cSrcweir else if( (RadioButton *) pBox == &aFromLeftBtn ) 286*cdf0e10cSrcweir { 287*cdf0e10cSrcweir bLeftEnable = bWidthEnable = sal_True; 288*cdf0e10cSrcweir aRightMF.SetPrcntValue(0); 289*cdf0e10cSrcweir } 290*cdf0e10cSrcweir else if( (RadioButton *) pBox == &aRightBtn ) 291*cdf0e10cSrcweir { 292*cdf0e10cSrcweir bLeftEnable = bWidthEnable = sal_True; 293*cdf0e10cSrcweir aRightMF.SetPrcntValue(0); 294*cdf0e10cSrcweir } 295*cdf0e10cSrcweir else if( ( RadioButton * ) pBox == &aCenterBtn ) 296*cdf0e10cSrcweir { 297*cdf0e10cSrcweir bLeftEnable = bWidthEnable = sal_True; 298*cdf0e10cSrcweir } 299*cdf0e10cSrcweir else if( ( RadioButton * ) pBox == &aFreeBtn ) 300*cdf0e10cSrcweir { 301*cdf0e10cSrcweir RightModifyHdl(&aRightMF); 302*cdf0e10cSrcweir bLeftEnable = sal_True; 303*cdf0e10cSrcweir bWidthEnable = sal_True; 304*cdf0e10cSrcweir bOthers = sal_False; 305*cdf0e10cSrcweir } 306*cdf0e10cSrcweir aLeftMF.Enable(bLeftEnable); 307*cdf0e10cSrcweir aLeftFT.Enable(bLeftEnable); 308*cdf0e10cSrcweir aWidthMF.Enable(bWidthEnable); 309*cdf0e10cSrcweir aWidthFT.Enable(bWidthEnable); 310*cdf0e10cSrcweir if ( bOthers ) 311*cdf0e10cSrcweir { 312*cdf0e10cSrcweir aRightMF.Enable(bRightEnable); 313*cdf0e10cSrcweir aRightFT.Enable(bRightEnable); 314*cdf0e10cSrcweir aRelWidthCB.Enable(bWidthEnable); 315*cdf0e10cSrcweir } 316*cdf0e10cSrcweir 317*cdf0e10cSrcweir if(bFull && bRestore) 318*cdf0e10cSrcweir { 319*cdf0e10cSrcweir // nachdem auf autom. geschaltet wurde, wurde die Breite gemerkt, 320*cdf0e10cSrcweir // um sie beim Zurueckschalten restaurieren zu koennen 321*cdf0e10cSrcweir bFull = sal_False; 322*cdf0e10cSrcweir aWidthMF.SetPrcntValue(aWidthMF.NormalizePercent(nSaveWidth ), FUNIT_TWIP ); 323*cdf0e10cSrcweir } 324*cdf0e10cSrcweir ModifyHdl(&aWidthMF); 325*cdf0e10cSrcweir bModified = sal_True; 326*cdf0e10cSrcweir return 0; 327*cdf0e10cSrcweir } 328*cdf0e10cSrcweir 329*cdf0e10cSrcweir /*----------------------------------------------------------------------*/ 330*cdf0e10cSrcweir IMPL_LINK( SwFormatTablePage, RightModifyHdl, MetricField *, EMPTYARG ) 331*cdf0e10cSrcweir { 332*cdf0e10cSrcweir if(aFreeBtn.IsChecked()) 333*cdf0e10cSrcweir { 334*cdf0e10cSrcweir sal_Bool bEnable = aRightMF.GetValue() == 0; 335*cdf0e10cSrcweir // aWidthMF.Enable(bEnable); 336*cdf0e10cSrcweir aRelWidthCB.Enable(bEnable); 337*cdf0e10cSrcweir // aWidthFT.Enable(bEnable); 338*cdf0e10cSrcweir if ( !bEnable ) 339*cdf0e10cSrcweir { 340*cdf0e10cSrcweir aRelWidthCB.Check(sal_False); 341*cdf0e10cSrcweir RelWidthClickHdl(&aRelWidthCB); 342*cdf0e10cSrcweir } 343*cdf0e10cSrcweir bEnable = aRelWidthCB.IsChecked(); 344*cdf0e10cSrcweir aRightMF.Enable(!bEnable); 345*cdf0e10cSrcweir aRightFT.Enable(!bEnable); 346*cdf0e10cSrcweir } 347*cdf0e10cSrcweir return 0; 348*cdf0e10cSrcweir } 349*cdf0e10cSrcweir 350*cdf0e10cSrcweir /*------------------------------------------------------------------------ 351*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 352*cdf0e10cSrcweir IMPL_LINK_INLINE_START( SwFormatTablePage, UpDownLoseFocusHdl, MetricField *, pEdit ) 353*cdf0e10cSrcweir { 354*cdf0e10cSrcweir if( &aRightMF == pEdit) 355*cdf0e10cSrcweir RightModifyHdl(pEdit); 356*cdf0e10cSrcweir ModifyHdl( pEdit ); 357*cdf0e10cSrcweir return 0; 358*cdf0e10cSrcweir } 359*cdf0e10cSrcweir IMPL_LINK_INLINE_END( SwFormatTablePage, UpDownLoseFocusHdl, MetricField *, pEdit ) 360*cdf0e10cSrcweir 361*cdf0e10cSrcweir void SwFormatTablePage::ModifyHdl( Edit* pEdit ) 362*cdf0e10cSrcweir { 363*cdf0e10cSrcweir 364*cdf0e10cSrcweir SwTwips nCurWidth = static_cast< SwTwips >(aWidthMF.DenormalizePercent(aWidthMF.GetValue( FUNIT_TWIP ))); 365*cdf0e10cSrcweir SwTwips nPrevWidth = nCurWidth; 366*cdf0e10cSrcweir SwTwips nRight = static_cast< SwTwips >(aRightMF.DenormalizePercent(aRightMF.GetValue( FUNIT_TWIP ))); 367*cdf0e10cSrcweir SwTwips nLeft = static_cast< SwTwips >(aLeftMF.DenormalizePercent(aLeftMF.GetValue( FUNIT_TWIP ))); 368*cdf0e10cSrcweir SwTwips nDiff; 369*cdf0e10cSrcweir 370*cdf0e10cSrcweir if( pEdit == &aWidthMF ) 371*cdf0e10cSrcweir { 372*cdf0e10cSrcweir if( nCurWidth < MINLAY ) 373*cdf0e10cSrcweir nCurWidth = MINLAY; 374*cdf0e10cSrcweir nDiff = nRight + nLeft + nCurWidth - pTblData->GetSpace() ; 375*cdf0e10cSrcweir //rechtsbuendig nur linken Rand veraendern 376*cdf0e10cSrcweir if(aRightBtn.IsChecked()) 377*cdf0e10cSrcweir nLeft -= nDiff; 378*cdf0e10cSrcweir //linksbuendig nur rechten Rand veraendern 379*cdf0e10cSrcweir else if(aLeftBtn.IsChecked()) 380*cdf0e10cSrcweir nRight -= nDiff; 381*cdf0e10cSrcweir //linker Rand und Breite erlaubt - erst rechts - dann links 382*cdf0e10cSrcweir else if(aFromLeftBtn.IsChecked()) 383*cdf0e10cSrcweir { 384*cdf0e10cSrcweir if( nRight >= nDiff ) 385*cdf0e10cSrcweir nRight -= nDiff; 386*cdf0e10cSrcweir else 387*cdf0e10cSrcweir { 388*cdf0e10cSrcweir nDiff -= nRight; 389*cdf0e10cSrcweir nRight = 0; 390*cdf0e10cSrcweir if(nLeft >= nDiff) 391*cdf0e10cSrcweir nLeft -= nDiff; 392*cdf0e10cSrcweir else 393*cdf0e10cSrcweir { 394*cdf0e10cSrcweir nRight += nLeft - nDiff; 395*cdf0e10cSrcweir nLeft = 0; 396*cdf0e10cSrcweir nCurWidth = pTblData->GetSpace(); 397*cdf0e10cSrcweir } 398*cdf0e10cSrcweir 399*cdf0e10cSrcweir } 400*cdf0e10cSrcweir } 401*cdf0e10cSrcweir //zentriert beide Seiten gleichmaessig veraendern 402*cdf0e10cSrcweir else if(aCenterBtn.IsChecked()) 403*cdf0e10cSrcweir { 404*cdf0e10cSrcweir if((nLeft != nRight)) 405*cdf0e10cSrcweir { 406*cdf0e10cSrcweir nDiff += nLeft + nRight; 407*cdf0e10cSrcweir nLeft = nDiff/2; 408*cdf0e10cSrcweir nRight = nDiff/2; 409*cdf0e10cSrcweir } 410*cdf0e10cSrcweir else 411*cdf0e10cSrcweir { 412*cdf0e10cSrcweir nLeft -= nDiff/2; 413*cdf0e10cSrcweir nRight -= nDiff/2; 414*cdf0e10cSrcweir } 415*cdf0e10cSrcweir } 416*cdf0e10cSrcweir //freie Ausrichtung: beide Raender verkleinern 417*cdf0e10cSrcweir else if(aFreeBtn.IsChecked()) 418*cdf0e10cSrcweir { 419*cdf0e10cSrcweir nLeft -= nDiff/2; 420*cdf0e10cSrcweir nRight -= nDiff/2; 421*cdf0e10cSrcweir } 422*cdf0e10cSrcweir } 423*cdf0e10cSrcweir if( pEdit == &aRightMF ) 424*cdf0e10cSrcweir { 425*cdf0e10cSrcweir 426*cdf0e10cSrcweir if( nRight + nLeft > pTblData->GetSpace() - MINLAY ) 427*cdf0e10cSrcweir nRight = pTblData->GetSpace() -nLeft - MINLAY; 428*cdf0e10cSrcweir 429*cdf0e10cSrcweir nCurWidth = pTblData->GetSpace() - nLeft - nRight; 430*cdf0e10cSrcweir } 431*cdf0e10cSrcweir if( pEdit == &aLeftMF ) 432*cdf0e10cSrcweir { 433*cdf0e10cSrcweir if(!aFromLeftBtn.IsChecked()) 434*cdf0e10cSrcweir { 435*cdf0e10cSrcweir sal_Bool bCenter = aCenterBtn.IsChecked(); 436*cdf0e10cSrcweir if( bCenter ) 437*cdf0e10cSrcweir nRight = nLeft; 438*cdf0e10cSrcweir if(nRight + nLeft > pTblData->GetSpace() - MINLAY ) 439*cdf0e10cSrcweir { 440*cdf0e10cSrcweir nLeft = bCenter ? (pTblData->GetSpace() - MINLAY) /2 : 441*cdf0e10cSrcweir (pTblData->GetSpace() - MINLAY) - nRight; 442*cdf0e10cSrcweir nRight = bCenter ? (pTblData->GetSpace() - MINLAY) /2 : nRight; 443*cdf0e10cSrcweir } 444*cdf0e10cSrcweir nCurWidth = pTblData->GetSpace() - nLeft - nRight; 445*cdf0e10cSrcweir } 446*cdf0e10cSrcweir else 447*cdf0e10cSrcweir { 448*cdf0e10cSrcweir //hier wird bei Aenderung an der linken Seite zuerst der 449*cdf0e10cSrcweir //rechte Rand veraendert, dann die Breite 450*cdf0e10cSrcweir nDiff = nRight + nLeft + nCurWidth - pTblData->GetSpace() ; 451*cdf0e10cSrcweir 452*cdf0e10cSrcweir nRight -= nDiff; 453*cdf0e10cSrcweir nCurWidth = pTblData->GetSpace() - nLeft - nRight; 454*cdf0e10cSrcweir } 455*cdf0e10cSrcweir } 456*cdf0e10cSrcweir if (nCurWidth != nPrevWidth ) 457*cdf0e10cSrcweir aWidthMF.SetPrcntValue( aWidthMF.NormalizePercent( nCurWidth ), FUNIT_TWIP ); 458*cdf0e10cSrcweir aRightMF.SetPrcntValue( aRightMF.NormalizePercent( nRight ), FUNIT_TWIP ); 459*cdf0e10cSrcweir aLeftMF.SetPrcntValue( aLeftMF.NormalizePercent( nLeft ), FUNIT_TWIP ); 460*cdf0e10cSrcweir bModified = sal_True; 461*cdf0e10cSrcweir } 462*cdf0e10cSrcweir 463*cdf0e10cSrcweir /*------------------------------------------------------------------------ 464*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 465*cdf0e10cSrcweir SfxTabPage* SwFormatTablePage::Create( Window* pParent, 466*cdf0e10cSrcweir const SfxItemSet& rAttrSet) 467*cdf0e10cSrcweir { 468*cdf0e10cSrcweir return new SwFormatTablePage( pParent, rAttrSet ); 469*cdf0e10cSrcweir } 470*cdf0e10cSrcweir 471*cdf0e10cSrcweir /*------------------------------------------------------------------------ 472*cdf0e10cSrcweir -------------------------------------------------------------------------*/ 473*cdf0e10cSrcweir sal_Bool SwFormatTablePage::FillItemSet( SfxItemSet& rCoreSet ) 474*cdf0e10cSrcweir { 475*cdf0e10cSrcweir // Testen, ob eins der Control noch den Focus hat 476*cdf0e10cSrcweir if(aWidthMF.HasFocus()) 477*cdf0e10cSrcweir ModifyHdl(&aWidthMF); 478*cdf0e10cSrcweir else if(aLeftMF.HasFocus()) 479*cdf0e10cSrcweir ModifyHdl(&aLeftMF); 480*cdf0e10cSrcweir else if(aRightMF.HasFocus()) 481*cdf0e10cSrcweir ModifyHdl(&aRightMF); 482*cdf0e10cSrcweir else if(aTopMF.HasFocus()) 483*cdf0e10cSrcweir ModifyHdl(&aTopMF); 484*cdf0e10cSrcweir else if(aBottomMF.HasFocus()) 485*cdf0e10cSrcweir ModifyHdl(&aBottomMF); 486*cdf0e10cSrcweir 487*cdf0e10cSrcweir if(bModified) 488*cdf0e10cSrcweir { 489*cdf0e10cSrcweir if( aBottomMF.GetText() != aBottomMF.GetSavedValue() || 490*cdf0e10cSrcweir aTopMF.GetText() != aTopMF.GetSavedValue() ) 491*cdf0e10cSrcweir { 492*cdf0e10cSrcweir SvxULSpaceItem aULSpace(RES_UL_SPACE); 493*cdf0e10cSrcweir aULSpace.SetUpper( (sal_uInt16) aTopMF.Denormalize( 494*cdf0e10cSrcweir aTopMF.GetValue( FUNIT_TWIP ))); 495*cdf0e10cSrcweir aULSpace.SetLower( (sal_uInt16) aBottomMF.Denormalize( 496*cdf0e10cSrcweir aBottomMF.GetValue( FUNIT_TWIP ))); 497*cdf0e10cSrcweir rCoreSet.Put(aULSpace); 498*cdf0e10cSrcweir } 499*cdf0e10cSrcweir 500*cdf0e10cSrcweir } 501*cdf0e10cSrcweir if(aNameED.GetText() != aNameED.GetSavedValue()) 502*cdf0e10cSrcweir { 503*cdf0e10cSrcweir rCoreSet.Put(SfxStringItem( FN_PARAM_TABLE_NAME, aNameED.GetText())); 504*cdf0e10cSrcweir bModified = sal_True; 505*cdf0e10cSrcweir } 506*cdf0e10cSrcweir 507*cdf0e10cSrcweir sal_uInt16 nPos; 508*cdf0e10cSrcweir if( aTextDirectionLB.IsVisible() && 509*cdf0e10cSrcweir ( nPos = aTextDirectionLB.GetSelectEntryPos() ) != 510*cdf0e10cSrcweir aTextDirectionLB.GetSavedValue() ) 511*cdf0e10cSrcweir { 512*cdf0e10cSrcweir sal_uInt32 nDirection = (sal_uInt32)(sal_uIntPtr)aTextDirectionLB.GetEntryData( nPos ); 513*cdf0e10cSrcweir rCoreSet.Put( SvxFrameDirectionItem( (SvxFrameDirection)nDirection, RES_FRAMEDIR)); 514*cdf0e10cSrcweir bModified = sal_True; 515*cdf0e10cSrcweir } 516*cdf0e10cSrcweir 517*cdf0e10cSrcweir return bModified; 518*cdf0e10cSrcweir } 519*cdf0e10cSrcweir 520*cdf0e10cSrcweir /*------------------------------------------------------------------------ 521*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 522*cdf0e10cSrcweir void SwFormatTablePage::Reset( const SfxItemSet& ) 523*cdf0e10cSrcweir { 524*cdf0e10cSrcweir const SfxItemSet& rSet = GetItemSet(); 525*cdf0e10cSrcweir const SfxPoolItem* pItem; 526*cdf0e10cSrcweir 527*cdf0e10cSrcweir if(bHtmlMode) 528*cdf0e10cSrcweir { 529*cdf0e10cSrcweir aNameED .Disable(); 530*cdf0e10cSrcweir aTopFT .Hide(); 531*cdf0e10cSrcweir aTopMF .Hide(); 532*cdf0e10cSrcweir aBottomFT.Hide(); 533*cdf0e10cSrcweir aBottomMF.Hide(); 534*cdf0e10cSrcweir aFreeBtn.Enable(sal_False); 535*cdf0e10cSrcweir } 536*cdf0e10cSrcweir FieldUnit aMetric = ::GetDfltMetric(bHtmlMode); 537*cdf0e10cSrcweir SetMetric( aWidthMF, aMetric ); 538*cdf0e10cSrcweir SetMetric( aRightMF, aMetric ); 539*cdf0e10cSrcweir SetMetric( aLeftMF, aMetric ); 540*cdf0e10cSrcweir SetMetric( aTopMF, aMetric ); 541*cdf0e10cSrcweir SetMetric( aBottomMF, aMetric ); 542*cdf0e10cSrcweir 543*cdf0e10cSrcweir //Name 544*cdf0e10cSrcweir if(SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_TABLE_NAME, sal_False, &pItem )) 545*cdf0e10cSrcweir { 546*cdf0e10cSrcweir aNameED.SetText(((const SfxStringItem*)pItem)->GetValue()); 547*cdf0e10cSrcweir aNameED.SaveValue(); 548*cdf0e10cSrcweir } 549*cdf0e10cSrcweir 550*cdf0e10cSrcweir if(SFX_ITEM_SET == rSet.GetItemState( FN_TABLE_REP, sal_False, &pItem )) 551*cdf0e10cSrcweir { 552*cdf0e10cSrcweir pTblData = (SwTableRep*)((const SwPtrItem*) pItem)->GetValue(); 553*cdf0e10cSrcweir nMinTableWidth = pTblData->GetColCount() * MINLAY; 554*cdf0e10cSrcweir 555*cdf0e10cSrcweir if(pTblData->GetWidthPercent()) 556*cdf0e10cSrcweir { 557*cdf0e10cSrcweir aRelWidthCB.Check(sal_True); 558*cdf0e10cSrcweir RelWidthClickHdl(&aRelWidthCB); 559*cdf0e10cSrcweir aWidthMF.SetPrcntValue(pTblData->GetWidthPercent(), FUNIT_CUSTOM); 560*cdf0e10cSrcweir 561*cdf0e10cSrcweir aWidthMF.SaveValue(); 562*cdf0e10cSrcweir nSaveWidth = static_cast< SwTwips >(aWidthMF.GetValue(FUNIT_CUSTOM)); 563*cdf0e10cSrcweir } 564*cdf0e10cSrcweir else 565*cdf0e10cSrcweir { 566*cdf0e10cSrcweir aWidthMF.SetPrcntValue(aWidthMF.NormalizePercent( 567*cdf0e10cSrcweir pTblData->GetWidth()), FUNIT_TWIP); 568*cdf0e10cSrcweir aWidthMF.SaveValue(); 569*cdf0e10cSrcweir nSaveWidth = pTblData->GetWidth(); 570*cdf0e10cSrcweir nMinTableWidth = Min( nSaveWidth, nMinTableWidth ); 571*cdf0e10cSrcweir } 572*cdf0e10cSrcweir 573*cdf0e10cSrcweir aWidthMF.SetRefValue(pTblData->GetSpace()); 574*cdf0e10cSrcweir aWidthMF.SetLast(aWidthMF.NormalizePercent( pTblData->GetSpace() )); 575*cdf0e10cSrcweir aLeftMF.SetLast(aLeftMF.NormalizePercent( pTblData->GetSpace() )); 576*cdf0e10cSrcweir aRightMF.SetLast(aRightMF.NormalizePercent( pTblData->GetSpace() )); 577*cdf0e10cSrcweir 578*cdf0e10cSrcweir aLeftMF.SetPrcntValue(aLeftMF.NormalizePercent( 579*cdf0e10cSrcweir pTblData->GetLeftSpace()), FUNIT_TWIP); 580*cdf0e10cSrcweir aRightMF.SetPrcntValue(aRightMF.NormalizePercent( 581*cdf0e10cSrcweir pTblData->GetRightSpace()), FUNIT_TWIP); 582*cdf0e10cSrcweir aLeftMF.SaveValue(); 583*cdf0e10cSrcweir aRightMF.SaveValue(); 584*cdf0e10cSrcweir 585*cdf0e10cSrcweir nOldAlign = pTblData->GetAlign(); 586*cdf0e10cSrcweir 587*cdf0e10cSrcweir sal_Bool bSetRight = sal_False, bRightEnable = sal_False, 588*cdf0e10cSrcweir bSetLeft = sal_False, bLeftEnable = sal_False; 589*cdf0e10cSrcweir switch( nOldAlign ) 590*cdf0e10cSrcweir { 591*cdf0e10cSrcweir case text::HoriOrientation::NONE: 592*cdf0e10cSrcweir aFreeBtn.Check(); 593*cdf0e10cSrcweir if(aRelWidthCB.IsChecked()) 594*cdf0e10cSrcweir bSetRight = sal_True; 595*cdf0e10cSrcweir break; 596*cdf0e10cSrcweir case text::HoriOrientation::FULL: 597*cdf0e10cSrcweir { 598*cdf0e10cSrcweir bSetRight = bSetLeft = sal_True; 599*cdf0e10cSrcweir aFullBtn.Check(); 600*cdf0e10cSrcweir aWidthMF.Enable(sal_False); 601*cdf0e10cSrcweir aRelWidthCB.Enable(sal_False); 602*cdf0e10cSrcweir aWidthFT.Enable(sal_False); 603*cdf0e10cSrcweir } 604*cdf0e10cSrcweir break; 605*cdf0e10cSrcweir case text::HoriOrientation::LEFT: 606*cdf0e10cSrcweir { 607*cdf0e10cSrcweir bSetLeft = sal_True; 608*cdf0e10cSrcweir aLeftBtn.Check(); 609*cdf0e10cSrcweir } 610*cdf0e10cSrcweir break; 611*cdf0e10cSrcweir case text::HoriOrientation::LEFT_AND_WIDTH : 612*cdf0e10cSrcweir { 613*cdf0e10cSrcweir bSetRight = sal_True; 614*cdf0e10cSrcweir aFromLeftBtn.Check(); 615*cdf0e10cSrcweir } 616*cdf0e10cSrcweir break; 617*cdf0e10cSrcweir case text::HoriOrientation::RIGHT: 618*cdf0e10cSrcweir { 619*cdf0e10cSrcweir bSetRight = sal_True; 620*cdf0e10cSrcweir aRightBtn.Check(); 621*cdf0e10cSrcweir } 622*cdf0e10cSrcweir break; 623*cdf0e10cSrcweir case text::HoriOrientation::CENTER: 624*cdf0e10cSrcweir { 625*cdf0e10cSrcweir bSetRight = sal_True; 626*cdf0e10cSrcweir aCenterBtn.Check(); 627*cdf0e10cSrcweir } 628*cdf0e10cSrcweir break; 629*cdf0e10cSrcweir } 630*cdf0e10cSrcweir if ( bSetRight ) 631*cdf0e10cSrcweir { 632*cdf0e10cSrcweir aRightMF.Enable(bRightEnable); 633*cdf0e10cSrcweir aRightFT.Enable(bRightEnable); 634*cdf0e10cSrcweir } 635*cdf0e10cSrcweir if ( bSetLeft ) 636*cdf0e10cSrcweir { 637*cdf0e10cSrcweir aLeftMF.Enable(bLeftEnable); 638*cdf0e10cSrcweir aLeftFT.Enable(bLeftEnable); 639*cdf0e10cSrcweir } 640*cdf0e10cSrcweir 641*cdf0e10cSrcweir } 642*cdf0e10cSrcweir 643*cdf0e10cSrcweir //Raender 644*cdf0e10cSrcweir if(SFX_ITEM_SET == rSet.GetItemState( RES_UL_SPACE, sal_False,&pItem )) 645*cdf0e10cSrcweir { 646*cdf0e10cSrcweir aTopMF.SetValue(aTopMF.Normalize( 647*cdf0e10cSrcweir ((const SvxULSpaceItem*)pItem)->GetUpper()), FUNIT_TWIP); 648*cdf0e10cSrcweir aBottomMF.SetValue(aBottomMF.Normalize( 649*cdf0e10cSrcweir ((const SvxULSpaceItem*)pItem)->GetLower()), FUNIT_TWIP); 650*cdf0e10cSrcweir aTopMF.SaveValue(); 651*cdf0e10cSrcweir aBottomMF.SaveValue(); 652*cdf0e10cSrcweir } 653*cdf0e10cSrcweir 654*cdf0e10cSrcweir //text direction 655*cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState( RES_FRAMEDIR, sal_True, &pItem ) ) 656*cdf0e10cSrcweir { 657*cdf0e10cSrcweir sal_uInt32 nVal = ((SvxFrameDirectionItem*)pItem)->GetValue(); 658*cdf0e10cSrcweir sal_uInt16 nPos = aTextDirectionLB.GetEntryPos( (void*) nVal ); 659*cdf0e10cSrcweir aTextDirectionLB.SelectEntryPos( nPos ); 660*cdf0e10cSrcweir aTextDirectionLB.SaveValue(); 661*cdf0e10cSrcweir } 662*cdf0e10cSrcweir 663*cdf0e10cSrcweir aWidthMF.SetMax( 2*aWidthMF.NormalizePercent( pTblData->GetSpace() ), FUNIT_TWIP ); 664*cdf0e10cSrcweir aRightMF.SetMax( aRightMF.NormalizePercent( pTblData->GetSpace() ), FUNIT_TWIP ); 665*cdf0e10cSrcweir aLeftMF.SetMax( aLeftMF.NormalizePercent( pTblData->GetSpace() ), FUNIT_TWIP ); 666*cdf0e10cSrcweir aWidthMF.SetMin( aWidthMF.NormalizePercent( nMinTableWidth ), FUNIT_TWIP ); 667*cdf0e10cSrcweir 668*cdf0e10cSrcweir } 669*cdf0e10cSrcweir 670*cdf0e10cSrcweir /*------------------------------------------------------------------------ 671*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 672*cdf0e10cSrcweir void SwFormatTablePage::ActivatePage( const SfxItemSet& rSet ) 673*cdf0e10cSrcweir { 674*cdf0e10cSrcweir DBG_ASSERT(pTblData, "Tabellendaten nicht da?"); 675*cdf0e10cSrcweir if(SFX_ITEM_SET == rSet.GetItemState( FN_TABLE_REP )) 676*cdf0e10cSrcweir { 677*cdf0e10cSrcweir SwTwips nCurWidth = text::HoriOrientation::FULL != pTblData->GetAlign() ? 678*cdf0e10cSrcweir pTblData->GetWidth() : 679*cdf0e10cSrcweir pTblData->GetSpace(); 680*cdf0e10cSrcweir if(pTblData->GetWidthPercent() == 0 && 681*cdf0e10cSrcweir nCurWidth != aWidthMF.DenormalizePercent(aWidthMF.GetValue(FUNIT_TWIP ))) 682*cdf0e10cSrcweir { 683*cdf0e10cSrcweir aWidthMF.SetPrcntValue(aWidthMF.NormalizePercent( 684*cdf0e10cSrcweir nCurWidth), FUNIT_TWIP); 685*cdf0e10cSrcweir aWidthMF.SaveValue(); 686*cdf0e10cSrcweir nSaveWidth = nCurWidth; 687*cdf0e10cSrcweir aLeftMF.SetPrcntValue(aLeftMF.NormalizePercent( 688*cdf0e10cSrcweir pTblData->GetLeftSpace()), FUNIT_TWIP); 689*cdf0e10cSrcweir aLeftMF.SaveValue(); 690*cdf0e10cSrcweir aRightMF.SetPrcntValue(aRightMF.NormalizePercent( 691*cdf0e10cSrcweir pTblData->GetRightSpace()), FUNIT_TWIP); 692*cdf0e10cSrcweir aRightMF.SaveValue(); 693*cdf0e10cSrcweir } 694*cdf0e10cSrcweir } 695*cdf0e10cSrcweir 696*cdf0e10cSrcweir } 697*cdf0e10cSrcweir /*------------------------------------------------------------------------ 698*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 699*cdf0e10cSrcweir int SwFormatTablePage::DeactivatePage( SfxItemSet* _pSet ) 700*cdf0e10cSrcweir { 701*cdf0e10cSrcweir // os: VCL sorgt nicht dafuer, dass das aktive Control im 702*cdf0e10cSrcweir // dialog bei OK den focus verliert 703*cdf0e10cSrcweir aNameED.GrabFocus(); 704*cdf0e10cSrcweir // Test des Tabellennamens auf Leerzeichen 705*cdf0e10cSrcweir String sTblName = aNameED.GetText(); 706*cdf0e10cSrcweir if(sTblName.Search(' ') != STRING_NOTFOUND) 707*cdf0e10cSrcweir { 708*cdf0e10cSrcweir InfoBox(this, SW_RES(MSG_WRONG_TABLENAME)).Execute(); 709*cdf0e10cSrcweir aNameED.GrabFocus(); 710*cdf0e10cSrcweir return KEEP_PAGE; 711*cdf0e10cSrcweir } 712*cdf0e10cSrcweir if(_pSet) 713*cdf0e10cSrcweir { 714*cdf0e10cSrcweir FillItemSet(*_pSet); 715*cdf0e10cSrcweir if(bModified) 716*cdf0e10cSrcweir { 717*cdf0e10cSrcweir SwTwips lLeft = static_cast< SwTwips >(aLeftMF.DenormalizePercent(aLeftMF.GetValue( FUNIT_TWIP ))); 718*cdf0e10cSrcweir SwTwips lRight = static_cast< SwTwips >(aRightMF.DenormalizePercent(aRightMF.GetValue( FUNIT_TWIP ))); 719*cdf0e10cSrcweir 720*cdf0e10cSrcweir 721*cdf0e10cSrcweir if( aLeftMF.GetText() != aLeftMF.GetSavedValue() || 722*cdf0e10cSrcweir aRightMF.GetText() != aRightMF.GetSavedValue() ) 723*cdf0e10cSrcweir { 724*cdf0e10cSrcweir pTblData->SetWidthChanged(); 725*cdf0e10cSrcweir pTblData->SetLeftSpace( lLeft); 726*cdf0e10cSrcweir pTblData->SetRightSpace( lRight); 727*cdf0e10cSrcweir } 728*cdf0e10cSrcweir 729*cdf0e10cSrcweir SwTwips lWidth; 730*cdf0e10cSrcweir if (aRelWidthCB.IsChecked() && aRelWidthCB.IsEnabled()) 731*cdf0e10cSrcweir { 732*cdf0e10cSrcweir lWidth = pTblData->GetSpace() - lRight - lLeft; 733*cdf0e10cSrcweir sal_uInt16 nPercentWidth = (sal_uInt16)aWidthMF.GetValue(FUNIT_CUSTOM); 734*cdf0e10cSrcweir if(pTblData->GetWidthPercent() != nPercentWidth) 735*cdf0e10cSrcweir { 736*cdf0e10cSrcweir pTblData->SetWidthPercent(nPercentWidth); 737*cdf0e10cSrcweir pTblData->SetWidthChanged(); 738*cdf0e10cSrcweir } 739*cdf0e10cSrcweir } 740*cdf0e10cSrcweir else 741*cdf0e10cSrcweir { 742*cdf0e10cSrcweir pTblData->SetWidthPercent(0); 743*cdf0e10cSrcweir lWidth = static_cast< SwTwips >(aWidthMF.DenormalizePercent(aWidthMF.GetValue( FUNIT_TWIP ))); 744*cdf0e10cSrcweir } 745*cdf0e10cSrcweir pTblData->SetWidth(lWidth); 746*cdf0e10cSrcweir 747*cdf0e10cSrcweir SwTwips nColSum = 0; 748*cdf0e10cSrcweir sal_uInt16 i; 749*cdf0e10cSrcweir 750*cdf0e10cSrcweir for( i = 0; i < pTblData->GetColCount(); i++) 751*cdf0e10cSrcweir { 752*cdf0e10cSrcweir nColSum += pTblData->GetColumns()[i].nWidth; 753*cdf0e10cSrcweir } 754*cdf0e10cSrcweir if(nColSum != pTblData->GetWidth()) 755*cdf0e10cSrcweir { 756*cdf0e10cSrcweir SwTwips nMinWidth = Min( (long)MINLAY, 757*cdf0e10cSrcweir (long) (pTblData->GetWidth() / 758*cdf0e10cSrcweir pTblData->GetColCount() - 1)); 759*cdf0e10cSrcweir SwTwips nDiff = nColSum - pTblData->GetWidth(); 760*cdf0e10cSrcweir while ( Abs(nDiff) > pTblData->GetColCount() + 1 ) 761*cdf0e10cSrcweir { 762*cdf0e10cSrcweir SwTwips nSub = nDiff / pTblData->GetColCount(); 763*cdf0e10cSrcweir for( i = 0; i < pTblData->GetColCount(); i++) 764*cdf0e10cSrcweir { 765*cdf0e10cSrcweir if(pTblData->GetColumns()[i].nWidth - nMinWidth > nSub) 766*cdf0e10cSrcweir { 767*cdf0e10cSrcweir pTblData->GetColumns()[i].nWidth -= nSub; 768*cdf0e10cSrcweir nDiff -= nSub; 769*cdf0e10cSrcweir } 770*cdf0e10cSrcweir else 771*cdf0e10cSrcweir { 772*cdf0e10cSrcweir nDiff -= pTblData->GetColumns()[i].nWidth - nMinWidth; 773*cdf0e10cSrcweir pTblData->GetColumns()[i].nWidth = nMinWidth; 774*cdf0e10cSrcweir } 775*cdf0e10cSrcweir 776*cdf0e10cSrcweir } 777*cdf0e10cSrcweir } 778*cdf0e10cSrcweir } 779*cdf0e10cSrcweir 780*cdf0e10cSrcweir sal_Int16 nAlign = 0; 781*cdf0e10cSrcweir if(aRightBtn.IsChecked()) 782*cdf0e10cSrcweir nAlign = text::HoriOrientation::RIGHT; 783*cdf0e10cSrcweir else if(aLeftBtn.IsChecked()) 784*cdf0e10cSrcweir nAlign = text::HoriOrientation::LEFT; 785*cdf0e10cSrcweir else if(aFromLeftBtn.IsChecked()) 786*cdf0e10cSrcweir nAlign = text::HoriOrientation::LEFT_AND_WIDTH; 787*cdf0e10cSrcweir else if(aCenterBtn.IsChecked()) 788*cdf0e10cSrcweir nAlign = text::HoriOrientation::CENTER; 789*cdf0e10cSrcweir else if(aFreeBtn.IsChecked()) 790*cdf0e10cSrcweir nAlign = text::HoriOrientation::NONE; 791*cdf0e10cSrcweir else if(aFullBtn.IsChecked()) 792*cdf0e10cSrcweir { 793*cdf0e10cSrcweir nAlign = text::HoriOrientation::FULL; 794*cdf0e10cSrcweir lWidth = lAutoWidth; 795*cdf0e10cSrcweir } 796*cdf0e10cSrcweir if(nAlign != pTblData->GetAlign()) 797*cdf0e10cSrcweir { 798*cdf0e10cSrcweir pTblData->SetWidthChanged(); 799*cdf0e10cSrcweir pTblData->SetAlign(nAlign); 800*cdf0e10cSrcweir } 801*cdf0e10cSrcweir 802*cdf0e10cSrcweir 803*cdf0e10cSrcweir // if( text::HoriOrientation::CENTER && lWidth != (SwTwips)aWidthMF.GetSavedValue()) 804*cdf0e10cSrcweir if(pTblData->GetWidth() != lWidth ) 805*cdf0e10cSrcweir { 806*cdf0e10cSrcweir pTblData->SetWidthChanged(); 807*cdf0e10cSrcweir pTblData->SetWidth( 808*cdf0e10cSrcweir nAlign == text::HoriOrientation::FULL ? pTblData->GetSpace() : lWidth ); 809*cdf0e10cSrcweir } 810*cdf0e10cSrcweir if(pTblData->HasWidthChanged()) 811*cdf0e10cSrcweir _pSet->Put(SwPtrItem(FN_TABLE_REP, pTblData)); 812*cdf0e10cSrcweir } 813*cdf0e10cSrcweir #ifdef DEBUG_TBLDLG 814*cdf0e10cSrcweir DbgTblRep(pTblData) 815*cdf0e10cSrcweir #endif 816*cdf0e10cSrcweir } 817*cdf0e10cSrcweir return sal_True; 818*cdf0e10cSrcweir } 819*cdf0e10cSrcweir /*------------------------------------------------------------------------ 820*cdf0e10cSrcweir Beschreibung: Seite Spaltenkonfiguration 821*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 822*cdf0e10cSrcweir SwTableColumnPage::SwTableColumnPage( Window* pParent, 823*cdf0e10cSrcweir const SfxItemSet& rSet ) : 824*cdf0e10cSrcweir SfxTabPage(pParent, SW_RES( TP_TABLE_COLUMN ), rSet ), 825*cdf0e10cSrcweir aModifyTableCB(this, SW_RES(CB_MOD_TBL)), 826*cdf0e10cSrcweir aProportionalCB(this, SW_RES(CB_PROP)), 827*cdf0e10cSrcweir aSpaceFT(this, SW_RES(FT_SPACE)), 828*cdf0e10cSrcweir aSpaceED(this, SW_RES(ED_SPACE)), 829*cdf0e10cSrcweir 830*cdf0e10cSrcweir aColFL(this, SW_RES(COL_FL_LAYOUT)), 831*cdf0e10cSrcweir aUpBtn(this, SW_RES(COL_BTN_UP)), 832*cdf0e10cSrcweir aFT1(this, SW_RES(COL_FT_1)), 833*cdf0e10cSrcweir aMF1(this, SW_RES(COL_MF_1)), 834*cdf0e10cSrcweir aFT2(this, SW_RES(COL_FT_2)), 835*cdf0e10cSrcweir aMF2(this, SW_RES(COL_MF_2)), 836*cdf0e10cSrcweir aFT3(this, SW_RES(COL_FT_3)), 837*cdf0e10cSrcweir aMF3(this, SW_RES(COL_MF_3)), 838*cdf0e10cSrcweir aFT4(this, SW_RES(COL_FT_4)), 839*cdf0e10cSrcweir aMF4(this, SW_RES(COL_MF_4)), 840*cdf0e10cSrcweir aFT5(this, SW_RES(COL_FT_5)), 841*cdf0e10cSrcweir aMF5(this, SW_RES(COL_MF_5)), 842*cdf0e10cSrcweir aFT6(this, SW_RES(COL_FT_6)), 843*cdf0e10cSrcweir aMF6(this, SW_RES(COL_MF_6)), 844*cdf0e10cSrcweir aDownBtn(this, SW_RES(COL_BTN_DOWN)), 845*cdf0e10cSrcweir 846*cdf0e10cSrcweir nTableWidth(0), 847*cdf0e10cSrcweir nMinWidth( MINLAY ), 848*cdf0e10cSrcweir nNoOfCols( 0 ), 849*cdf0e10cSrcweir nNoOfVisibleCols( 0 ), 850*cdf0e10cSrcweir bModified(sal_False), 851*cdf0e10cSrcweir bModifyTbl(sal_False), 852*cdf0e10cSrcweir bPercentMode(sal_False) 853*cdf0e10cSrcweir { 854*cdf0e10cSrcweir FreeResource(); 855*cdf0e10cSrcweir SetExchangeSupport(); 856*cdf0e10cSrcweir 857*cdf0e10cSrcweir aDownBtn.SetAccessibleRelationMemberOf(&aColFL); 858*cdf0e10cSrcweir aUpBtn.SetAccessibleRelationMemberOf(&aColFL); 859*cdf0e10cSrcweir 860*cdf0e10cSrcweir pFieldArr[0] = &aMF1; 861*cdf0e10cSrcweir pFieldArr[1] = &aMF2; 862*cdf0e10cSrcweir pFieldArr[2] = &aMF3; 863*cdf0e10cSrcweir pFieldArr[3] = &aMF4; 864*cdf0e10cSrcweir pFieldArr[4] = &aMF5; 865*cdf0e10cSrcweir pFieldArr[5] = &aMF6; 866*cdf0e10cSrcweir 867*cdf0e10cSrcweir pTextArr[0] = &aFT1; 868*cdf0e10cSrcweir pTextArr[1] = &aFT2; 869*cdf0e10cSrcweir pTextArr[2] = &aFT3; 870*cdf0e10cSrcweir pTextArr[3] = &aFT4; 871*cdf0e10cSrcweir pTextArr[4] = &aFT5; 872*cdf0e10cSrcweir pTextArr[5] = &aFT6; 873*cdf0e10cSrcweir 874*cdf0e10cSrcweir const SfxPoolItem* pItem; 875*cdf0e10cSrcweir Init((SFX_ITEM_SET == rSet.GetItemState( SID_HTML_MODE, sal_False,&pItem ) 876*cdf0e10cSrcweir && ((const SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON)); 877*cdf0e10cSrcweir 878*cdf0e10cSrcweir }; 879*cdf0e10cSrcweir /*------------------------------------------------------------------------ 880*cdf0e10cSrcweir Beschreibung: Seite Spaltenkonfiguration 881*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 882*cdf0e10cSrcweir SwTableColumnPage::~SwTableColumnPage() 883*cdf0e10cSrcweir { 884*cdf0e10cSrcweir }; 885*cdf0e10cSrcweir 886*cdf0e10cSrcweir /*------------------------------------------------------------------------ 887*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 888*cdf0e10cSrcweir SfxTabPage* SwTableColumnPage::Create( Window* pParent, 889*cdf0e10cSrcweir const SfxItemSet& rAttrSet) 890*cdf0e10cSrcweir { 891*cdf0e10cSrcweir return new SwTableColumnPage( pParent, rAttrSet ); 892*cdf0e10cSrcweir }; 893*cdf0e10cSrcweir 894*cdf0e10cSrcweir /*------------------------------------------------------------------------ 895*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 896*cdf0e10cSrcweir void SwTableColumnPage::Reset( const SfxItemSet& ) 897*cdf0e10cSrcweir { 898*cdf0e10cSrcweir const SfxItemSet& rSet = GetItemSet(); 899*cdf0e10cSrcweir 900*cdf0e10cSrcweir const SfxPoolItem* pItem; 901*cdf0e10cSrcweir if(SFX_ITEM_SET == rSet.GetItemState( FN_TABLE_REP, sal_False, &pItem )) 902*cdf0e10cSrcweir { 903*cdf0e10cSrcweir pTblData = (SwTableRep*)((const SwPtrItem*) pItem)->GetValue(); 904*cdf0e10cSrcweir nNoOfVisibleCols = pTblData->GetColCount(); 905*cdf0e10cSrcweir nNoOfCols = pTblData->GetAllColCount(); 906*cdf0e10cSrcweir nTableWidth = pTblData->GetAlign() != text::HoriOrientation::FULL && 907*cdf0e10cSrcweir pTblData->GetAlign() != text::HoriOrientation::LEFT_AND_WIDTH? 908*cdf0e10cSrcweir pTblData->GetWidth() : pTblData->GetSpace(); 909*cdf0e10cSrcweir 910*cdf0e10cSrcweir sal_uInt16 i; 911*cdf0e10cSrcweir for( i = 0; i < nNoOfCols; i++ ) 912*cdf0e10cSrcweir { 913*cdf0e10cSrcweir if( pTblData->GetColumns()[i].nWidth < nMinWidth ) 914*cdf0e10cSrcweir nMinWidth = pTblData->GetColumns()[i].nWidth; 915*cdf0e10cSrcweir } 916*cdf0e10cSrcweir sal_Int64 nMinTwips = pFieldArr[0]->NormalizePercent( nMinWidth ); 917*cdf0e10cSrcweir sal_Int64 nMaxTwips = pFieldArr[0]->NormalizePercent( nTableWidth ); 918*cdf0e10cSrcweir for( i = 0; (i < MET_FIELDS) && (i < nNoOfVisibleCols); i++ ) 919*cdf0e10cSrcweir { 920*cdf0e10cSrcweir pFieldArr[i]->SetPrcntValue( pFieldArr[i]->NormalizePercent( 921*cdf0e10cSrcweir GetVisibleWidth(i) ), FUNIT_TWIP ); 922*cdf0e10cSrcweir pFieldArr[i]->SetMin( nMinTwips , FUNIT_TWIP ); 923*cdf0e10cSrcweir pFieldArr[i]->SetMax( nMaxTwips , FUNIT_TWIP ); 924*cdf0e10cSrcweir pFieldArr[i]->Enable(); 925*cdf0e10cSrcweir pTextArr[i]->Enable(); 926*cdf0e10cSrcweir } 927*cdf0e10cSrcweir 928*cdf0e10cSrcweir if( nNoOfVisibleCols > MET_FIELDS ) 929*cdf0e10cSrcweir aUpBtn.Enable(); 930*cdf0e10cSrcweir i = nNoOfVisibleCols; 931*cdf0e10cSrcweir while( i < MET_FIELDS ) 932*cdf0e10cSrcweir { 933*cdf0e10cSrcweir pFieldArr[i]->SetText( aEmptyStr ); 934*cdf0e10cSrcweir pTextArr[i]->Hide(); 935*cdf0e10cSrcweir i++; 936*cdf0e10cSrcweir } 937*cdf0e10cSrcweir } 938*cdf0e10cSrcweir ActivatePage(rSet); 939*cdf0e10cSrcweir 940*cdf0e10cSrcweir }; 941*cdf0e10cSrcweir 942*cdf0e10cSrcweir /*------------------------------------------------------------------------ 943*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 944*cdf0e10cSrcweir void SwTableColumnPage::Init(sal_Bool bWeb) 945*cdf0e10cSrcweir { 946*cdf0e10cSrcweir FieldUnit aMetric = ::GetDfltMetric(bWeb); 947*cdf0e10cSrcweir Link aLkUp = LINK( this, SwTableColumnPage, UpHdl ); 948*cdf0e10cSrcweir Link aLkDown = LINK( this, SwTableColumnPage, DownHdl ); 949*cdf0e10cSrcweir Link aLkLF = LINK( this, SwTableColumnPage, LoseFocusHdl ); 950*cdf0e10cSrcweir for( sal_uInt16 i = 0; i < MET_FIELDS; i++ ) 951*cdf0e10cSrcweir { 952*cdf0e10cSrcweir aValueTbl[i] = i; 953*cdf0e10cSrcweir SetMetric(*pFieldArr[i], aMetric); 954*cdf0e10cSrcweir pFieldArr[i]->SetUpHdl( aLkUp ); 955*cdf0e10cSrcweir pFieldArr[i]->SetDownHdl( aLkDown ); 956*cdf0e10cSrcweir pFieldArr[i]->SetLoseFocusHdl( aLkLF ); 957*cdf0e10cSrcweir 958*cdf0e10cSrcweir } 959*cdf0e10cSrcweir SetMetric(aSpaceED, aMetric); 960*cdf0e10cSrcweir 961*cdf0e10cSrcweir Link aLk = LINK( this, SwTableColumnPage, AutoClickHdl ); 962*cdf0e10cSrcweir aUpBtn.SetClickHdl( aLk ); 963*cdf0e10cSrcweir aDownBtn.SetClickHdl( aLk ); 964*cdf0e10cSrcweir 965*cdf0e10cSrcweir aLk = LINK( this, SwTableColumnPage, ModeHdl ); 966*cdf0e10cSrcweir aModifyTableCB .SetClickHdl( aLk ); 967*cdf0e10cSrcweir aProportionalCB.SetClickHdl( aLk ); 968*cdf0e10cSrcweir }; 969*cdf0e10cSrcweir 970*cdf0e10cSrcweir /*------------------------------------------------------------------------ 971*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 972*cdf0e10cSrcweir IMPL_LINK( SwTableColumnPage, AutoClickHdl, CheckBox *, pBox ) 973*cdf0e10cSrcweir { 974*cdf0e10cSrcweir //Anzeigefenster verschieben 975*cdf0e10cSrcweir if(pBox == (CheckBox *)&aDownBtn) 976*cdf0e10cSrcweir { 977*cdf0e10cSrcweir if(aValueTbl[0] > 0) 978*cdf0e10cSrcweir { 979*cdf0e10cSrcweir for( sal_uInt16 i=0; i < MET_FIELDS; i++ ) 980*cdf0e10cSrcweir aValueTbl[i] -= 1; 981*cdf0e10cSrcweir } 982*cdf0e10cSrcweir } 983*cdf0e10cSrcweir if(pBox == (CheckBox *)&aUpBtn) 984*cdf0e10cSrcweir { 985*cdf0e10cSrcweir if( aValueTbl[ MET_FIELDS -1 ] < nNoOfVisibleCols -1 ) 986*cdf0e10cSrcweir { 987*cdf0e10cSrcweir for(sal_uInt16 i=0;i < MET_FIELDS;i++) 988*cdf0e10cSrcweir aValueTbl[i] += 1; 989*cdf0e10cSrcweir } 990*cdf0e10cSrcweir } 991*cdf0e10cSrcweir for( sal_uInt16 i = 0; (i < nNoOfVisibleCols ) && ( i < MET_FIELDS); i++ ) 992*cdf0e10cSrcweir { 993*cdf0e10cSrcweir String sEntry('~'); 994*cdf0e10cSrcweir String sIndex = String::CreateFromInt32( aValueTbl[i] + 1 ); 995*cdf0e10cSrcweir sEntry += sIndex; 996*cdf0e10cSrcweir pTextArr[i]->SetText( sEntry ); 997*cdf0e10cSrcweir //IAccessibility2 Impplementaton 2009----- 998*cdf0e10cSrcweir //added by menghu for SODC_5143,12/12/2006 999*cdf0e10cSrcweir String sColumnWidth = SW_RESSTR( STR_ACCESS_COLUMN_WIDTH); 1000*cdf0e10cSrcweir sColumnWidth.SearchAndReplace( DEFINE_CONST_UNICODE("%1"), sIndex ); 1001*cdf0e10cSrcweir pFieldArr[i]->SetAccessibleName( sColumnWidth ); 1002*cdf0e10cSrcweir //end of SODC_5143 1003*cdf0e10cSrcweir //-----IAccessibility2 Impplementaton 2009 1004*cdf0e10cSrcweir } 1005*cdf0e10cSrcweir 1006*cdf0e10cSrcweir aDownBtn.Enable(aValueTbl[0] > 0); 1007*cdf0e10cSrcweir aUpBtn.Enable(aValueTbl[ MET_FIELDS -1 ] < nNoOfVisibleCols -1 ); 1008*cdf0e10cSrcweir UpdateCols(0); 1009*cdf0e10cSrcweir return 0; 1010*cdf0e10cSrcweir }; 1011*cdf0e10cSrcweir 1012*cdf0e10cSrcweir /*------------------------------------------------------------------------ 1013*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 1014*cdf0e10cSrcweir IMPL_LINK_INLINE_START( SwTableColumnPage, UpHdl, PercentField *, pEdit ) 1015*cdf0e10cSrcweir { 1016*cdf0e10cSrcweir bModified = sal_True; 1017*cdf0e10cSrcweir ModifyHdl( pEdit ); 1018*cdf0e10cSrcweir return 0; 1019*cdf0e10cSrcweir }; 1020*cdf0e10cSrcweir IMPL_LINK_INLINE_END( SwTableColumnPage, UpHdl, PercentField *, pEdit ) 1021*cdf0e10cSrcweir 1022*cdf0e10cSrcweir /*------------------------------------------------------------------------ 1023*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 1024*cdf0e10cSrcweir IMPL_LINK_INLINE_START( SwTableColumnPage, DownHdl, PercentField *, pEdit ) 1025*cdf0e10cSrcweir { 1026*cdf0e10cSrcweir bModified = sal_True; 1027*cdf0e10cSrcweir ModifyHdl( pEdit ); 1028*cdf0e10cSrcweir return 0; 1029*cdf0e10cSrcweir }; 1030*cdf0e10cSrcweir IMPL_LINK_INLINE_END( SwTableColumnPage, DownHdl, PercentField *, pEdit ) 1031*cdf0e10cSrcweir 1032*cdf0e10cSrcweir /*------------------------------------------------------------------------ 1033*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 1034*cdf0e10cSrcweir IMPL_LINK_INLINE_START( SwTableColumnPage, LoseFocusHdl, PercentField *, pEdit ) 1035*cdf0e10cSrcweir { 1036*cdf0e10cSrcweir if(pEdit->IsModified()) 1037*cdf0e10cSrcweir { 1038*cdf0e10cSrcweir bModified = sal_True; 1039*cdf0e10cSrcweir ModifyHdl( pEdit ); 1040*cdf0e10cSrcweir } 1041*cdf0e10cSrcweir return 0; 1042*cdf0e10cSrcweir }; 1043*cdf0e10cSrcweir IMPL_LINK_INLINE_END( SwTableColumnPage, LoseFocusHdl, PercentField *, pEdit ) 1044*cdf0e10cSrcweir 1045*cdf0e10cSrcweir /*------------------------------------------------------------------------ 1046*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 1047*cdf0e10cSrcweir IMPL_LINK( SwTableColumnPage, ModeHdl, CheckBox*, pBox ) 1048*cdf0e10cSrcweir { 1049*cdf0e10cSrcweir sal_Bool bCheck = pBox->IsChecked(); 1050*cdf0e10cSrcweir if(pBox == &aProportionalCB) 1051*cdf0e10cSrcweir { 1052*cdf0e10cSrcweir if(bCheck) 1053*cdf0e10cSrcweir aModifyTableCB.Check(); 1054*cdf0e10cSrcweir aModifyTableCB.Enable(!bCheck && bModifyTbl); 1055*cdf0e10cSrcweir } 1056*cdf0e10cSrcweir return 0; 1057*cdf0e10cSrcweir }; 1058*cdf0e10cSrcweir 1059*cdf0e10cSrcweir /*------------------------------------------------------------------------ 1060*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 1061*cdf0e10cSrcweir sal_Bool SwTableColumnPage::FillItemSet( SfxItemSet& ) 1062*cdf0e10cSrcweir { 1063*cdf0e10cSrcweir for( sal_uInt16 i = 0; i < MET_FIELDS; i++ ) 1064*cdf0e10cSrcweir { 1065*cdf0e10cSrcweir if(pFieldArr[i]->HasFocus()) 1066*cdf0e10cSrcweir { 1067*cdf0e10cSrcweir LoseFocusHdl(pFieldArr[i]); 1068*cdf0e10cSrcweir break; 1069*cdf0e10cSrcweir } 1070*cdf0e10cSrcweir } 1071*cdf0e10cSrcweir 1072*cdf0e10cSrcweir if(bModified) 1073*cdf0e10cSrcweir { 1074*cdf0e10cSrcweir pTblData->SetColsChanged(); 1075*cdf0e10cSrcweir } 1076*cdf0e10cSrcweir return bModified; 1077*cdf0e10cSrcweir }; 1078*cdf0e10cSrcweir 1079*cdf0e10cSrcweir /*------------------------------------------------------------------------ 1080*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 1081*cdf0e10cSrcweir void SwTableColumnPage::ModifyHdl( PercentField* pEdit ) 1082*cdf0e10cSrcweir { 1083*cdf0e10cSrcweir sal_uInt16 nAktPos; 1084*cdf0e10cSrcweir sal_uInt16 i; 1085*cdf0e10cSrcweir 1086*cdf0e10cSrcweir for( i = 0; i < MET_FIELDS; i++) 1087*cdf0e10cSrcweir if(pEdit == pFieldArr[i]) 1088*cdf0e10cSrcweir break; 1089*cdf0e10cSrcweir 1090*cdf0e10cSrcweir SetVisibleWidth(aValueTbl[i], static_cast< SwTwips >(pEdit->DenormalizePercent(pEdit->GetValue( FUNIT_TWIP ))) ); 1091*cdf0e10cSrcweir nAktPos = aValueTbl[i]; 1092*cdf0e10cSrcweir 1093*cdf0e10cSrcweir UpdateCols( nAktPos ); 1094*cdf0e10cSrcweir }; 1095*cdf0e10cSrcweir 1096*cdf0e10cSrcweir /*------------------------------------------------------------------------ 1097*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 1098*cdf0e10cSrcweir void SwTableColumnPage::UpdateCols( sal_uInt16 nAktPos ) 1099*cdf0e10cSrcweir { 1100*cdf0e10cSrcweir SwTwips nSum = 0; 1101*cdf0e10cSrcweir sal_uInt16 i; 1102*cdf0e10cSrcweir 1103*cdf0e10cSrcweir for( i = 0; i < nNoOfCols; i++ ) 1104*cdf0e10cSrcweir { 1105*cdf0e10cSrcweir nSum += (pTblData->GetColumns())[i].nWidth; 1106*cdf0e10cSrcweir } 1107*cdf0e10cSrcweir SwTwips nDiff = nSum - nTableWidth; 1108*cdf0e10cSrcweir 1109*cdf0e10cSrcweir sal_Bool bModifyTable = aModifyTableCB.IsChecked(); 1110*cdf0e10cSrcweir sal_Bool bProp = aProportionalCB.IsChecked(); 1111*cdf0e10cSrcweir 1112*cdf0e10cSrcweir if(!bModifyTable && !bProp ) 1113*cdf0e10cSrcweir { 1114*cdf0e10cSrcweir // the table width is constant, the difference is balanced with the other columns 1115*cdf0e10cSrcweir sal_uInt16 nLoopCount = 0; 1116*cdf0e10cSrcweir while( nDiff ) 1117*cdf0e10cSrcweir { 1118*cdf0e10cSrcweir if( ++nAktPos == nNoOfVisibleCols) 1119*cdf0e10cSrcweir { 1120*cdf0e10cSrcweir nAktPos = 0; 1121*cdf0e10cSrcweir ++nLoopCount; 1122*cdf0e10cSrcweir //#i101353# in small tables it might not be possible to balance column width 1123*cdf0e10cSrcweir if( nLoopCount > 1 ) 1124*cdf0e10cSrcweir break; 1125*cdf0e10cSrcweir } 1126*cdf0e10cSrcweir if( nDiff < 0 ) 1127*cdf0e10cSrcweir { 1128*cdf0e10cSrcweir SetVisibleWidth(nAktPos, GetVisibleWidth(nAktPos) -nDiff); 1129*cdf0e10cSrcweir nDiff = 0; 1130*cdf0e10cSrcweir } 1131*cdf0e10cSrcweir else if( GetVisibleWidth(nAktPos) >= nDiff + nMinWidth ) 1132*cdf0e10cSrcweir { 1133*cdf0e10cSrcweir SetVisibleWidth(nAktPos, GetVisibleWidth(nAktPos) -nDiff); 1134*cdf0e10cSrcweir nDiff = 0; 1135*cdf0e10cSrcweir } 1136*cdf0e10cSrcweir if( nDiff > 0 && GetVisibleWidth(nAktPos) > nMinWidth ) 1137*cdf0e10cSrcweir { 1138*cdf0e10cSrcweir if( nDiff >= (GetVisibleWidth(nAktPos) - nMinWidth) ) 1139*cdf0e10cSrcweir { 1140*cdf0e10cSrcweir nDiff -= (GetVisibleWidth(nAktPos) - nMinWidth); 1141*cdf0e10cSrcweir SetVisibleWidth(nAktPos, nMinWidth); 1142*cdf0e10cSrcweir } 1143*cdf0e10cSrcweir else 1144*cdf0e10cSrcweir { 1145*cdf0e10cSrcweir nDiff = 0; 1146*cdf0e10cSrcweir SetVisibleWidth(nAktPos, GetVisibleWidth(nAktPos) -nDiff); 1147*cdf0e10cSrcweir } 1148*cdf0e10cSrcweir DBG_ASSERT(nDiff >= 0, "nDiff < 0 kann hier nicht sein!"); 1149*cdf0e10cSrcweir } 1150*cdf0e10cSrcweir } 1151*cdf0e10cSrcweir } 1152*cdf0e10cSrcweir else if(bModifyTable && !bProp) 1153*cdf0e10cSrcweir { 1154*cdf0e10cSrcweir // Differenz wird ueber die Tabellenbreite ausgeglichen, 1155*cdf0e10cSrcweir // andere Spalten bleiben unveraendert 1156*cdf0e10cSrcweir DBG_ASSERT(nDiff <= pTblData->GetSpace() - nTableWidth, "Maximum falsch eingestellt" ); 1157*cdf0e10cSrcweir SwTwips nActSpace = pTblData->GetSpace() - nTableWidth; 1158*cdf0e10cSrcweir if(nDiff > nActSpace) 1159*cdf0e10cSrcweir { 1160*cdf0e10cSrcweir nTableWidth = pTblData->GetSpace(); 1161*cdf0e10cSrcweir SetVisibleWidth(nAktPos, GetVisibleWidth(nAktPos) - nDiff + nActSpace ); 1162*cdf0e10cSrcweir } 1163*cdf0e10cSrcweir else 1164*cdf0e10cSrcweir { 1165*cdf0e10cSrcweir nTableWidth += nDiff; 1166*cdf0e10cSrcweir } 1167*cdf0e10cSrcweir } 1168*cdf0e10cSrcweir else if(bModifyTable & bProp) 1169*cdf0e10cSrcweir { 1170*cdf0e10cSrcweir // Alle Spalten werden proportional mitveraendert, die Tabellenbreite wird 1171*cdf0e10cSrcweir // entsprechend angepasst 1172*cdf0e10cSrcweir DBG_ASSERT(nDiff * nNoOfVisibleCols <= pTblData->GetSpace() - nTableWidth, "Maximum falsch eingestellt" ); 1173*cdf0e10cSrcweir long nAdd = nDiff; 1174*cdf0e10cSrcweir if(nDiff * nNoOfVisibleCols > pTblData->GetSpace() - nTableWidth) 1175*cdf0e10cSrcweir { 1176*cdf0e10cSrcweir nAdd = (pTblData->GetSpace() - nTableWidth) / nNoOfVisibleCols; 1177*cdf0e10cSrcweir SetVisibleWidth(nAktPos, GetVisibleWidth(nAktPos) - nDiff + nAdd ); 1178*cdf0e10cSrcweir nDiff = nAdd; 1179*cdf0e10cSrcweir } 1180*cdf0e10cSrcweir if(nAdd) 1181*cdf0e10cSrcweir for(i = 0; i < nNoOfVisibleCols; i++ ) 1182*cdf0e10cSrcweir { 1183*cdf0e10cSrcweir if(i == nAktPos) 1184*cdf0e10cSrcweir continue; 1185*cdf0e10cSrcweir SwTwips nVisWidth; 1186*cdf0e10cSrcweir if((nVisWidth = GetVisibleWidth(i)) + nDiff < MINLAY) 1187*cdf0e10cSrcweir { 1188*cdf0e10cSrcweir nAdd += nVisWidth - MINLAY; 1189*cdf0e10cSrcweir SetVisibleWidth(i, MINLAY); 1190*cdf0e10cSrcweir } 1191*cdf0e10cSrcweir else 1192*cdf0e10cSrcweir { 1193*cdf0e10cSrcweir SetVisibleWidth(i, nVisWidth + nDiff); 1194*cdf0e10cSrcweir nAdd += nDiff; 1195*cdf0e10cSrcweir } 1196*cdf0e10cSrcweir 1197*cdf0e10cSrcweir } 1198*cdf0e10cSrcweir nTableWidth += nAdd; 1199*cdf0e10cSrcweir 1200*cdf0e10cSrcweir } 1201*cdf0e10cSrcweir else 1202*cdf0e10cSrcweir { 1203*cdf0e10cSrcweir // Die Differenz wird gleichmaessig auf alle anderen Spalten aufgeteilt 1204*cdf0e10cSrcweir // die Tabellenbreite bleibt konstant 1205*cdf0e10cSrcweir /* 1206*cdf0e10cSrcweir SwTwips nDiffn = nDiff/(nNoOfVisibleCols - 1); 1207*cdf0e10cSrcweir if(nDiff < 0 && (nNoOfVisibleCols - 1) * nDiffn != nDiff) 1208*cdf0e10cSrcweir nDiffn-- ; 1209*cdf0e10cSrcweir sal_uInt16 nStart = nAktPos++; 1210*cdf0e10cSrcweir if(nAktPos == nNoOfVisibleCols) 1211*cdf0e10cSrcweir nStart = 0; 1212*cdf0e10cSrcweir for(sal_uInt16 i = 0; i < nNoOfVisibleCols; i++ ) 1213*cdf0e10cSrcweir { 1214*cdf0e10cSrcweir if((nVisWidth = GetVisibleWidth(i)) + nDiff < MINLAY) 1215*cdf0e10cSrcweir { 1216*cdf0e10cSrcweir nAdd += nVisWidth - MINLAY; 1217*cdf0e10cSrcweir SetVisibleWidth(i, MINLAY); 1218*cdf0e10cSrcweir } 1219*cdf0e10cSrcweir } 1220*cdf0e10cSrcweir */ 1221*cdf0e10cSrcweir 1222*cdf0e10cSrcweir } 1223*cdf0e10cSrcweir 1224*cdf0e10cSrcweir #ifdef DEBUG_TBLDLG 1225*cdf0e10cSrcweir DbgTblRep(pTblData) 1226*cdf0e10cSrcweir #endif 1227*cdf0e10cSrcweir 1228*cdf0e10cSrcweir if(!bPercentMode) 1229*cdf0e10cSrcweir aSpaceED.SetValue(aSpaceED.Normalize( pTblData->GetSpace() - nTableWidth) , FUNIT_TWIP); 1230*cdf0e10cSrcweir 1231*cdf0e10cSrcweir for( i = 0; ( i < nNoOfVisibleCols ) && ( i < MET_FIELDS ); i++) 1232*cdf0e10cSrcweir { 1233*cdf0e10cSrcweir pFieldArr[i]->SetPrcntValue(pFieldArr[i]->NormalizePercent( 1234*cdf0e10cSrcweir GetVisibleWidth(aValueTbl[i]) ), FUNIT_TWIP); 1235*cdf0e10cSrcweir pFieldArr[i]->ClearModifyFlag(); 1236*cdf0e10cSrcweir } 1237*cdf0e10cSrcweir 1238*cdf0e10cSrcweir } 1239*cdf0e10cSrcweir 1240*cdf0e10cSrcweir /*------------------------------------------------------------------------ 1241*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 1242*cdf0e10cSrcweir void SwTableColumnPage::ActivatePage( const SfxItemSet& ) 1243*cdf0e10cSrcweir { 1244*cdf0e10cSrcweir bPercentMode = pTblData->GetWidthPercent() != 0; 1245*cdf0e10cSrcweir for( sal_uInt16 i = 0; (i < MET_FIELDS) && (i < nNoOfVisibleCols); i++ ) 1246*cdf0e10cSrcweir { 1247*cdf0e10cSrcweir pFieldArr[i]->SetRefValue(pTblData->GetWidth()); 1248*cdf0e10cSrcweir pFieldArr[i]->ShowPercent( bPercentMode ); 1249*cdf0e10cSrcweir } 1250*cdf0e10cSrcweir 1251*cdf0e10cSrcweir sal_uInt16 nTblAlign = pTblData->GetAlign(); 1252*cdf0e10cSrcweir if((text::HoriOrientation::FULL != nTblAlign && nTableWidth != pTblData->GetWidth()) || 1253*cdf0e10cSrcweir (text::HoriOrientation::FULL == nTblAlign && nTableWidth != pTblData->GetSpace())) 1254*cdf0e10cSrcweir { 1255*cdf0e10cSrcweir nTableWidth = text::HoriOrientation::FULL == nTblAlign ? 1256*cdf0e10cSrcweir pTblData->GetSpace() : 1257*cdf0e10cSrcweir pTblData->GetWidth(); 1258*cdf0e10cSrcweir UpdateCols(0); 1259*cdf0e10cSrcweir } 1260*cdf0e10cSrcweir bModifyTbl = sal_True; 1261*cdf0e10cSrcweir if(pTblData->GetWidthPercent() || 1262*cdf0e10cSrcweir text::HoriOrientation::FULL == nTblAlign || 1263*cdf0e10cSrcweir pTblData->IsLineSelected() ) 1264*cdf0e10cSrcweir bModifyTbl = sal_False; 1265*cdf0e10cSrcweir if(bPercentMode) 1266*cdf0e10cSrcweir { 1267*cdf0e10cSrcweir aModifyTableCB .Check(sal_False); 1268*cdf0e10cSrcweir aProportionalCB .Check(sal_False); 1269*cdf0e10cSrcweir } 1270*cdf0e10cSrcweir else if( !bModifyTbl ) 1271*cdf0e10cSrcweir { 1272*cdf0e10cSrcweir aProportionalCB.Check(sal_False); 1273*cdf0e10cSrcweir aModifyTableCB.Check(sal_False); 1274*cdf0e10cSrcweir } 1275*cdf0e10cSrcweir aSpaceFT.Enable(!bPercentMode); 1276*cdf0e10cSrcweir aSpaceED.Enable(!bPercentMode); 1277*cdf0e10cSrcweir aModifyTableCB.Enable( !bPercentMode && bModifyTbl ); 1278*cdf0e10cSrcweir aProportionalCB.Enable(!bPercentMode && bModifyTbl ); 1279*cdf0e10cSrcweir 1280*cdf0e10cSrcweir /* if(pTblData->IsLineSelected() && pTblData->IsComplex()) 1281*cdf0e10cSrcweir { 1282*cdf0e10cSrcweir 1283*cdf0e10cSrcweir }*/ 1284*cdf0e10cSrcweir aSpaceED.SetValue(aSpaceED.Normalize( 1285*cdf0e10cSrcweir pTblData->GetSpace() - nTableWidth) , FUNIT_TWIP); 1286*cdf0e10cSrcweir 1287*cdf0e10cSrcweir } 1288*cdf0e10cSrcweir 1289*cdf0e10cSrcweir /*------------------------------------------------------------------------ 1290*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 1291*cdf0e10cSrcweir int SwTableColumnPage::DeactivatePage( SfxItemSet* _pSet ) 1292*cdf0e10cSrcweir { 1293*cdf0e10cSrcweir if(_pSet) 1294*cdf0e10cSrcweir { 1295*cdf0e10cSrcweir FillItemSet(*_pSet); 1296*cdf0e10cSrcweir if(text::HoriOrientation::FULL != pTblData->GetAlign() && pTblData->GetWidth() != nTableWidth) 1297*cdf0e10cSrcweir { 1298*cdf0e10cSrcweir pTblData->SetWidth(nTableWidth); 1299*cdf0e10cSrcweir SwTwips nDiff = pTblData->GetSpace() - pTblData->GetWidth() - 1300*cdf0e10cSrcweir pTblData->GetLeftSpace() - pTblData->GetRightSpace(); 1301*cdf0e10cSrcweir switch( pTblData->GetAlign() ) 1302*cdf0e10cSrcweir { 1303*cdf0e10cSrcweir case text::HoriOrientation::RIGHT: 1304*cdf0e10cSrcweir pTblData->SetLeftSpace(pTblData->GetLeftSpace() + nDiff); 1305*cdf0e10cSrcweir break; 1306*cdf0e10cSrcweir case text::HoriOrientation::LEFT: 1307*cdf0e10cSrcweir pTblData->SetRightSpace(pTblData->GetRightSpace() + nDiff); 1308*cdf0e10cSrcweir break; 1309*cdf0e10cSrcweir case text::HoriOrientation::NONE: 1310*cdf0e10cSrcweir { 1311*cdf0e10cSrcweir SwTwips nDiff2 = nDiff/2; 1312*cdf0e10cSrcweir if( nDiff > 0 || 1313*cdf0e10cSrcweir (-nDiff2 < pTblData->GetRightSpace() && - nDiff2 < pTblData->GetLeftSpace())) 1314*cdf0e10cSrcweir { 1315*cdf0e10cSrcweir pTblData->SetRightSpace(pTblData->GetRightSpace() + nDiff2); 1316*cdf0e10cSrcweir pTblData->SetLeftSpace(pTblData->GetLeftSpace() + nDiff2); 1317*cdf0e10cSrcweir } 1318*cdf0e10cSrcweir else 1319*cdf0e10cSrcweir { 1320*cdf0e10cSrcweir if(pTblData->GetRightSpace() > pTblData->GetLeftSpace()) 1321*cdf0e10cSrcweir { 1322*cdf0e10cSrcweir pTblData->SetLeftSpace(0); 1323*cdf0e10cSrcweir pTblData->SetRightSpace(pTblData->GetSpace() - pTblData->GetWidth()); 1324*cdf0e10cSrcweir } 1325*cdf0e10cSrcweir else 1326*cdf0e10cSrcweir { 1327*cdf0e10cSrcweir pTblData->SetRightSpace(0); 1328*cdf0e10cSrcweir pTblData->SetLeftSpace(pTblData->GetSpace() - pTblData->GetWidth()); 1329*cdf0e10cSrcweir } 1330*cdf0e10cSrcweir } 1331*cdf0e10cSrcweir } 1332*cdf0e10cSrcweir break; 1333*cdf0e10cSrcweir case text::HoriOrientation::CENTER: 1334*cdf0e10cSrcweir pTblData->SetRightSpace(pTblData->GetRightSpace() + nDiff/2); 1335*cdf0e10cSrcweir pTblData->SetLeftSpace(pTblData->GetLeftSpace() + nDiff/2); 1336*cdf0e10cSrcweir break; 1337*cdf0e10cSrcweir case text::HoriOrientation::LEFT_AND_WIDTH : 1338*cdf0e10cSrcweir if(nDiff > pTblData->GetRightSpace()) 1339*cdf0e10cSrcweir { 1340*cdf0e10cSrcweir pTblData->SetLeftSpace(pTblData->GetSpace() - pTblData->GetWidth()); 1341*cdf0e10cSrcweir } 1342*cdf0e10cSrcweir pTblData->SetRightSpace( 1343*cdf0e10cSrcweir pTblData->GetSpace() - pTblData->GetWidth() - pTblData->GetLeftSpace()); 1344*cdf0e10cSrcweir break; 1345*cdf0e10cSrcweir } 1346*cdf0e10cSrcweir pTblData->SetWidthChanged(); 1347*cdf0e10cSrcweir } 1348*cdf0e10cSrcweir #ifdef DEBUG_TBLDLG 1349*cdf0e10cSrcweir DbgTblRep(pTblData) 1350*cdf0e10cSrcweir #endif 1351*cdf0e10cSrcweir _pSet->Put(SwPtrItem( FN_TABLE_REP, pTblData )); 1352*cdf0e10cSrcweir } 1353*cdf0e10cSrcweir return sal_True; 1354*cdf0e10cSrcweir } 1355*cdf0e10cSrcweir 1356*cdf0e10cSrcweir /*------------------------------------------------------------------------ 1357*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 1358*cdf0e10cSrcweir SwTwips SwTableColumnPage::GetVisibleWidth(sal_uInt16 nPos) 1359*cdf0e10cSrcweir { 1360*cdf0e10cSrcweir sal_uInt16 i=0; 1361*cdf0e10cSrcweir 1362*cdf0e10cSrcweir while( nPos ) 1363*cdf0e10cSrcweir { 1364*cdf0e10cSrcweir if(pTblData->GetColumns()[i].bVisible && nPos) 1365*cdf0e10cSrcweir nPos--; 1366*cdf0e10cSrcweir i++; 1367*cdf0e10cSrcweir } 1368*cdf0e10cSrcweir SwTwips nReturn = pTblData->GetColumns()[i].nWidth; 1369*cdf0e10cSrcweir DBG_ASSERT(i < nNoOfCols, "Array index out of range"); 1370*cdf0e10cSrcweir while(!pTblData->GetColumns()[i].bVisible && (i + 1) < nNoOfCols) 1371*cdf0e10cSrcweir nReturn += pTblData->GetColumns()[++i].nWidth; 1372*cdf0e10cSrcweir 1373*cdf0e10cSrcweir // return (*ppTableColumns)[i].nWidth; 1374*cdf0e10cSrcweir return nReturn; 1375*cdf0e10cSrcweir } 1376*cdf0e10cSrcweir 1377*cdf0e10cSrcweir /*------------------------------------------------------------------------ 1378*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 1379*cdf0e10cSrcweir void SwTableColumnPage::SetVisibleWidth(sal_uInt16 nPos, SwTwips nNewWidth) 1380*cdf0e10cSrcweir { 1381*cdf0e10cSrcweir sal_uInt16 i=0; 1382*cdf0e10cSrcweir while( nPos ) 1383*cdf0e10cSrcweir { 1384*cdf0e10cSrcweir if(pTblData->GetColumns()[i].bVisible && nPos) 1385*cdf0e10cSrcweir nPos--; 1386*cdf0e10cSrcweir i++; 1387*cdf0e10cSrcweir } 1388*cdf0e10cSrcweir DBG_ASSERT(i < nNoOfCols, "Array index out of range"); 1389*cdf0e10cSrcweir pTblData->GetColumns()[i].nWidth = nNewWidth; 1390*cdf0e10cSrcweir while(!pTblData->GetColumns()[i].bVisible && (i + 1) < nNoOfCols) 1391*cdf0e10cSrcweir pTblData->GetColumns()[++i].nWidth = 0; 1392*cdf0e10cSrcweir 1393*cdf0e10cSrcweir } 1394*cdf0e10cSrcweir 1395*cdf0e10cSrcweir /*------------------------------------------------------------------------ 1396*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 1397*cdf0e10cSrcweir SwTableTabDlg::SwTableTabDlg(Window* pParent, SfxItemPool& , 1398*cdf0e10cSrcweir const SfxItemSet* pItemSet, SwWrtShell* pSh ) : 1399*cdf0e10cSrcweir SfxTabDialog(pParent, SW_RES(DLG_FORMAT_TABLE), pItemSet,0), 1400*cdf0e10cSrcweir pShell(pSh), 1401*cdf0e10cSrcweir nHtmlMode(::GetHtmlMode(pSh->GetView().GetDocShell())) 1402*cdf0e10cSrcweir { 1403*cdf0e10cSrcweir FreeResource(); 1404*cdf0e10cSrcweir SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); 1405*cdf0e10cSrcweir DBG_ASSERT(pFact, "Dialogdiet fail!"); 1406*cdf0e10cSrcweir AddTabPage(TP_FORMAT_TABLE, &SwFormatTablePage::Create, 0 ); 1407*cdf0e10cSrcweir AddTabPage(TP_TABLE_TEXTFLOW, &SwTextFlowPage::Create, 0 ); 1408*cdf0e10cSrcweir AddTabPage(TP_TABLE_COLUMN, &SwTableColumnPage::Create, 0 ); 1409*cdf0e10cSrcweir AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), 0 ); 1410*cdf0e10cSrcweir AddTabPage(TP_BORDER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), 0 ); 1411*cdf0e10cSrcweir } 1412*cdf0e10cSrcweir 1413*cdf0e10cSrcweir 1414*cdf0e10cSrcweir /*------------------------------------------------------------------------ 1415*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 1416*cdf0e10cSrcweir void SwTableTabDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage) 1417*cdf0e10cSrcweir { 1418*cdf0e10cSrcweir SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); 1419*cdf0e10cSrcweir if( TP_BACKGROUND == nId ) 1420*cdf0e10cSrcweir { 1421*cdf0e10cSrcweir sal_Int32 nFlagType = SVX_SHOW_TBLCTL; 1422*cdf0e10cSrcweir if(!( nHtmlMode & HTMLMODE_ON ) || 1423*cdf0e10cSrcweir nHtmlMode & HTMLMODE_SOME_STYLES) 1424*cdf0e10cSrcweir nFlagType |= SVX_SHOW_SELECTOR; 1425*cdf0e10cSrcweir aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, nFlagType)); 1426*cdf0e10cSrcweir rPage.PageCreated(aSet); 1427*cdf0e10cSrcweir } 1428*cdf0e10cSrcweir else if(TP_BORDER == nId) 1429*cdf0e10cSrcweir { 1430*cdf0e10cSrcweir aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,SW_BORDER_MODE_TABLE)); 1431*cdf0e10cSrcweir rPage.PageCreated(aSet); 1432*cdf0e10cSrcweir } 1433*cdf0e10cSrcweir else if(TP_TABLE_TEXTFLOW == nId) 1434*cdf0e10cSrcweir { 1435*cdf0e10cSrcweir ((SwTextFlowPage&)rPage).SetShell(pShell); 1436*cdf0e10cSrcweir const sal_uInt16 eType = pShell->GetFrmType(0,sal_True); 1437*cdf0e10cSrcweir if( !(FRMTYPE_BODY & eType) ) 1438*cdf0e10cSrcweir ((SwTextFlowPage&)rPage).DisablePageBreak(); 1439*cdf0e10cSrcweir } 1440*cdf0e10cSrcweir } 1441*cdf0e10cSrcweir 1442*cdf0e10cSrcweir /*-----------------12.12.96 12.22------------------- 1443*cdf0e10cSrcweir --------------------------------------------------*/ 1444*cdf0e10cSrcweir SwTextFlowPage::SwTextFlowPage( Window* pParent, 1445*cdf0e10cSrcweir const SfxItemSet& rSet ) : 1446*cdf0e10cSrcweir SfxTabPage(pParent, SW_RES( TP_TABLE_TEXTFLOW ), rSet ), 1447*cdf0e10cSrcweir aFlowFL (this, SW_RES(FL_FLOW )), 1448*cdf0e10cSrcweir aPgBrkCB (this, SW_RES(CB_PAGEBREAK )), 1449*cdf0e10cSrcweir aPgBrkRB (this, SW_RES(RB_BREAKPAGE )), 1450*cdf0e10cSrcweir aColBrkRB (this, SW_RES(RB_BREAKCOLUMN )), 1451*cdf0e10cSrcweir aPgBrkBeforeRB (this, SW_RES(RB_PAGEBREAKBEFORE)), 1452*cdf0e10cSrcweir aPgBrkAfterRB (this, SW_RES(RB_PAGEBREAKAFTER )), 1453*cdf0e10cSrcweir aPageCollCB (this, SW_RES(CB_PAGECOLL )), 1454*cdf0e10cSrcweir aPageCollLB (this, SW_RES(LB_PAGECOLL )), 1455*cdf0e10cSrcweir aPageNoFT (this, SW_RES(FT_PAGENUM )), 1456*cdf0e10cSrcweir aPageNoNF (this, SW_RES(NF_PAGENUM )), 1457*cdf0e10cSrcweir aSplitCB (this, SW_RES(CB_SPLIT )), 1458*cdf0e10cSrcweir aSplitRowCB (this, SW_RES(CB_SPLIT_ROW )), 1459*cdf0e10cSrcweir aKeepCB (this, SW_RES(CB_KEEP )), 1460*cdf0e10cSrcweir aHeadLineCB (this, SW_RES(CB_HEADLINE )), 1461*cdf0e10cSrcweir aRepeatHeaderFT (this, SW_RES(FT_REPEAT_HEADER )), 1462*cdf0e10cSrcweir aRepeatHeaderBeforeFT (this), 1463*cdf0e10cSrcweir aRepeatHeaderNF (this, SW_RES(NF_REPEAT_HEADER )), 1464*cdf0e10cSrcweir aRepeatHeaderAfterFT (this), 1465*cdf0e10cSrcweir aRepeatHeaderCombo (this, SW_RES(WIN_REPEAT_HEADER), aRepeatHeaderNF, aRepeatHeaderBeforeFT, aRepeatHeaderAfterFT), 1466*cdf0e10cSrcweir aTextDirectionFT(this, SW_RES(FT_TEXTDIRECTION )), 1467*cdf0e10cSrcweir aTextDirectionLB(this, SW_RES(LB_TEXTDIRECTION )), 1468*cdf0e10cSrcweir 1469*cdf0e10cSrcweir aVertOrientFL (this, SW_RES(FL_VERT_ORIENT )), 1470*cdf0e10cSrcweir aVertOrientFT(this, SW_RES(FT_VERTORIENT )), 1471*cdf0e10cSrcweir aVertOrientLB(this, SW_RES(LB_VERTORIENT )), 1472*cdf0e10cSrcweir 1473*cdf0e10cSrcweir pShell(0), 1474*cdf0e10cSrcweir 1475*cdf0e10cSrcweir bPageBreak(sal_True), 1476*cdf0e10cSrcweir bHtmlMode(sal_False) 1477*cdf0e10cSrcweir { 1478*cdf0e10cSrcweir FreeResource(); 1479*cdf0e10cSrcweir 1480*cdf0e10cSrcweir aPgBrkRB.SetAccessibleRelationMemberOf(&aPgBrkCB); 1481*cdf0e10cSrcweir aColBrkRB.SetAccessibleRelationMemberOf(&aPgBrkCB); 1482*cdf0e10cSrcweir aPgBrkBeforeRB.SetAccessibleRelationMemberOf(&aPgBrkCB); 1483*cdf0e10cSrcweir aPgBrkAfterRB.SetAccessibleRelationMemberOf(&aPgBrkCB); 1484*cdf0e10cSrcweir aPageCollLB.SetAccessibleRelationLabeledBy(&aPageCollCB); 1485*cdf0e10cSrcweir aPageCollLB.SetAccessibleName(aPageCollCB.GetText()); 1486*cdf0e10cSrcweir 1487*cdf0e10cSrcweir aPgBrkCB.SetClickHdl(LINK(this, SwTextFlowPage, PageBreakHdl_Impl)); 1488*cdf0e10cSrcweir aPgBrkBeforeRB.SetClickHdl( 1489*cdf0e10cSrcweir LINK( this, SwTextFlowPage, PageBreakPosHdl_Impl ) ); 1490*cdf0e10cSrcweir aPgBrkAfterRB.SetClickHdl( 1491*cdf0e10cSrcweir LINK( this, SwTextFlowPage, PageBreakPosHdl_Impl ) ); 1492*cdf0e10cSrcweir aPageCollCB.SetClickHdl( 1493*cdf0e10cSrcweir LINK( this, SwTextFlowPage, ApplyCollClickHdl_Impl ) ); 1494*cdf0e10cSrcweir aColBrkRB.SetClickHdl( 1495*cdf0e10cSrcweir LINK( this, SwTextFlowPage, PageBreakTypeHdl_Impl ) ); 1496*cdf0e10cSrcweir aPgBrkRB.SetClickHdl( 1497*cdf0e10cSrcweir LINK( this, SwTextFlowPage, PageBreakTypeHdl_Impl ) ); 1498*cdf0e10cSrcweir aSplitCB.SetClickHdl( 1499*cdf0e10cSrcweir LINK( this, SwTextFlowPage, SplitHdl_Impl)); 1500*cdf0e10cSrcweir aSplitRowCB.SetClickHdl( 1501*cdf0e10cSrcweir LINK( this, SwTextFlowPage, SplitRowHdl_Impl)); 1502*cdf0e10cSrcweir aHeadLineCB.SetClickHdl( LINK( this, SwTextFlowPage, HeadLineCBClickHdl ) ); 1503*cdf0e10cSrcweir 1504*cdf0e10cSrcweir #ifndef SW_FILEFORMAT_40 1505*cdf0e10cSrcweir const SfxPoolItem *pItem; 1506*cdf0e10cSrcweir if(SFX_ITEM_SET == rSet.GetItemState( SID_HTML_MODE, sal_False,&pItem ) 1507*cdf0e10cSrcweir && ((const SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON) 1508*cdf0e10cSrcweir #endif 1509*cdf0e10cSrcweir { 1510*cdf0e10cSrcweir aKeepCB.Hide(); 1511*cdf0e10cSrcweir aSplitCB.Hide(); 1512*cdf0e10cSrcweir aSplitRowCB.Hide(); 1513*cdf0e10cSrcweir } 1514*cdf0e10cSrcweir 1515*cdf0e10cSrcweir aRepeatHeaderCombo.Arrange( aRepeatHeaderFT ); 1516*cdf0e10cSrcweir 1517*cdf0e10cSrcweir HeadLineCBClickHdl(); 1518*cdf0e10cSrcweir } 1519*cdf0e10cSrcweir 1520*cdf0e10cSrcweir /*-----------------12.12.96 12.22------------------- 1521*cdf0e10cSrcweir --------------------------------------------------*/ 1522*cdf0e10cSrcweir SwTextFlowPage::~SwTextFlowPage() 1523*cdf0e10cSrcweir { 1524*cdf0e10cSrcweir } 1525*cdf0e10cSrcweir 1526*cdf0e10cSrcweir /*-----------------12.12.96 12.22------------------- 1527*cdf0e10cSrcweir --------------------------------------------------*/ 1528*cdf0e10cSrcweir SfxTabPage* SwTextFlowPage::Create( Window* pParent, 1529*cdf0e10cSrcweir const SfxItemSet& rAttrSet) 1530*cdf0e10cSrcweir { 1531*cdf0e10cSrcweir return new SwTextFlowPage(pParent, rAttrSet); 1532*cdf0e10cSrcweir } 1533*cdf0e10cSrcweir 1534*cdf0e10cSrcweir /*-----------------12.12.96 12.22------------------- 1535*cdf0e10cSrcweir --------------------------------------------------*/ 1536*cdf0e10cSrcweir sal_Bool SwTextFlowPage::FillItemSet( SfxItemSet& rSet ) 1537*cdf0e10cSrcweir { 1538*cdf0e10cSrcweir sal_Bool bModified = sal_False; 1539*cdf0e10cSrcweir 1540*cdf0e10cSrcweir //Ueberschrift wiederholen 1541*cdf0e10cSrcweir if(aHeadLineCB.IsChecked() != aHeadLineCB.GetSavedValue() || 1542*cdf0e10cSrcweir String::CreateFromInt32( static_cast< sal_Int32 >(aRepeatHeaderNF.GetValue()) ) != aRepeatHeaderNF.GetSavedValue() ) 1543*cdf0e10cSrcweir { 1544*cdf0e10cSrcweir bModified |= 0 != rSet.Put( 1545*cdf0e10cSrcweir SfxUInt16Item(FN_PARAM_TABLE_HEADLINE, aHeadLineCB.IsChecked()? sal_uInt16(aRepeatHeaderNF.GetValue()) : 0 )); 1546*cdf0e10cSrcweir } 1547*cdf0e10cSrcweir if(aKeepCB.IsChecked() != aKeepCB.GetSavedValue()) 1548*cdf0e10cSrcweir bModified |= 0 != rSet.Put( SvxFmtKeepItem( aKeepCB.IsChecked(), RES_KEEP)); 1549*cdf0e10cSrcweir 1550*cdf0e10cSrcweir if(aSplitCB.IsChecked() != aSplitCB.GetSavedValue()) 1551*cdf0e10cSrcweir bModified |= 0 != rSet.Put( SwFmtLayoutSplit( aSplitCB.IsChecked())); 1552*cdf0e10cSrcweir 1553*cdf0e10cSrcweir if(aSplitRowCB.IsChecked() != aSplitRowCB.GetSavedValue()) 1554*cdf0e10cSrcweir bModified |= 0 != rSet.Put( SwFmtRowSplit( aSplitRowCB.IsChecked())); 1555*cdf0e10cSrcweir 1556*cdf0e10cSrcweir 1557*cdf0e10cSrcweir const SvxFmtBreakItem* pBreak = (const SvxFmtBreakItem*)GetOldItem( rSet, RES_BREAK ); 1558*cdf0e10cSrcweir const SwFmtPageDesc* pDesc = (const SwFmtPageDesc*) GetOldItem( rSet, RES_PAGEDESC ); 1559*cdf0e10cSrcweir 1560*cdf0e10cSrcweir 1561*cdf0e10cSrcweir sal_Bool bState = aPageCollCB.IsChecked(); 1562*cdf0e10cSrcweir 1563*cdf0e10cSrcweir //Wenn Seitenvorlage, dann kein Break 1564*cdf0e10cSrcweir sal_Bool bPageItemPut = sal_False; 1565*cdf0e10cSrcweir if ( bState != aPageCollCB.GetSavedValue() || 1566*cdf0e10cSrcweir ( bState && 1567*cdf0e10cSrcweir aPageCollLB.GetSelectEntryPos() != aPageCollLB.GetSavedValue() ) 1568*cdf0e10cSrcweir || (aPageNoNF.IsEnabled() && aPageNoNF.IsValueModified()) ) 1569*cdf0e10cSrcweir { 1570*cdf0e10cSrcweir String sPage; 1571*cdf0e10cSrcweir 1572*cdf0e10cSrcweir if ( bState ) 1573*cdf0e10cSrcweir { 1574*cdf0e10cSrcweir sPage = aPageCollLB.GetSelectEntry(); 1575*cdf0e10cSrcweir } 1576*cdf0e10cSrcweir sal_uInt16 nPgNum = static_cast< sal_uInt16 >(aPageNoNF.GetValue()); 1577*cdf0e10cSrcweir if ( !pDesc || !pDesc->GetPageDesc() || 1578*cdf0e10cSrcweir ( pDesc->GetPageDesc() && ((pDesc->GetPageDesc()->GetName() != sPage) || 1579*cdf0e10cSrcweir aPageNoNF.GetSavedValue() != (String)nPgNum))) 1580*cdf0e10cSrcweir { 1581*cdf0e10cSrcweir SwFmtPageDesc aFmt( pShell->FindPageDescByName( sPage, sal_True ) ); 1582*cdf0e10cSrcweir aFmt.SetNumOffset(bState ? nPgNum : 0); 1583*cdf0e10cSrcweir bModified |= 0 != rSet.Put( aFmt ); 1584*cdf0e10cSrcweir bPageItemPut = bState; 1585*cdf0e10cSrcweir } 1586*cdf0e10cSrcweir } 1587*cdf0e10cSrcweir sal_Bool bIsChecked = aPgBrkCB.IsChecked(); 1588*cdf0e10cSrcweir if ( !bPageItemPut && 1589*cdf0e10cSrcweir ( bState != aPageCollCB.GetSavedValue() || 1590*cdf0e10cSrcweir bIsChecked != aPgBrkCB.GetSavedValue() || 1591*cdf0e10cSrcweir aPgBrkBeforeRB.IsChecked() != aPgBrkBeforeRB.GetSavedValue() || 1592*cdf0e10cSrcweir aPgBrkRB.IsChecked() != aPgBrkRB.GetSavedValue() )) 1593*cdf0e10cSrcweir { 1594*cdf0e10cSrcweir SvxFmtBreakItem aBreak( 1595*cdf0e10cSrcweir (const SvxFmtBreakItem&)GetItemSet().Get( RES_BREAK ) ); 1596*cdf0e10cSrcweir 1597*cdf0e10cSrcweir if(bIsChecked) 1598*cdf0e10cSrcweir { 1599*cdf0e10cSrcweir sal_Bool bBefore = aPgBrkBeforeRB.IsChecked(); 1600*cdf0e10cSrcweir 1601*cdf0e10cSrcweir if ( aPgBrkRB.IsChecked() ) 1602*cdf0e10cSrcweir { 1603*cdf0e10cSrcweir if ( bBefore ) 1604*cdf0e10cSrcweir aBreak.SetValue( SVX_BREAK_PAGE_BEFORE ); 1605*cdf0e10cSrcweir else 1606*cdf0e10cSrcweir aBreak.SetValue( SVX_BREAK_PAGE_AFTER ); 1607*cdf0e10cSrcweir } 1608*cdf0e10cSrcweir else 1609*cdf0e10cSrcweir { 1610*cdf0e10cSrcweir if ( bBefore ) 1611*cdf0e10cSrcweir aBreak.SetValue( SVX_BREAK_COLUMN_BEFORE ); 1612*cdf0e10cSrcweir else 1613*cdf0e10cSrcweir aBreak.SetValue( SVX_BREAK_COLUMN_AFTER ); 1614*cdf0e10cSrcweir } 1615*cdf0e10cSrcweir } 1616*cdf0e10cSrcweir else 1617*cdf0e10cSrcweir { 1618*cdf0e10cSrcweir aBreak.SetValue( SVX_BREAK_NONE ); 1619*cdf0e10cSrcweir } 1620*cdf0e10cSrcweir 1621*cdf0e10cSrcweir if ( !pBreak || !( *(const SvxFmtBreakItem*)pBreak == aBreak ) ) 1622*cdf0e10cSrcweir { 1623*cdf0e10cSrcweir bModified |= 0 != rSet.Put( aBreak ); 1624*cdf0e10cSrcweir } 1625*cdf0e10cSrcweir } 1626*cdf0e10cSrcweir 1627*cdf0e10cSrcweir if(aTextDirectionLB.GetSelectEntryPos() != aTextDirectionLB.GetSavedValue()) 1628*cdf0e10cSrcweir { 1629*cdf0e10cSrcweir bModified |= 0 != rSet.Put( 1630*cdf0e10cSrcweir SvxFrameDirectionItem( 1631*cdf0e10cSrcweir (SvxFrameDirection)(sal_uLong)aTextDirectionLB.GetEntryData(aTextDirectionLB.GetSelectEntryPos()) 1632*cdf0e10cSrcweir , FN_TABLE_BOX_TEXTDIRECTION)); 1633*cdf0e10cSrcweir } 1634*cdf0e10cSrcweir 1635*cdf0e10cSrcweir if(aVertOrientLB.GetSelectEntryPos() != aVertOrientLB.GetSavedValue()) 1636*cdf0e10cSrcweir { 1637*cdf0e10cSrcweir sal_uInt16 nOrient = USHRT_MAX; 1638*cdf0e10cSrcweir switch(aVertOrientLB.GetSelectEntryPos()) 1639*cdf0e10cSrcweir { 1640*cdf0e10cSrcweir case 0 : nOrient = text::VertOrientation::NONE; break; 1641*cdf0e10cSrcweir case 1 : nOrient = text::VertOrientation::CENTER; break; 1642*cdf0e10cSrcweir case 2 : nOrient = text::VertOrientation::BOTTOM; break; 1643*cdf0e10cSrcweir } 1644*cdf0e10cSrcweir if(nOrient != USHRT_MAX) 1645*cdf0e10cSrcweir bModified |= 0 != rSet.Put(SfxUInt16Item(FN_TABLE_SET_VERT_ALIGN, nOrient)); 1646*cdf0e10cSrcweir } 1647*cdf0e10cSrcweir 1648*cdf0e10cSrcweir return bModified; 1649*cdf0e10cSrcweir 1650*cdf0e10cSrcweir } 1651*cdf0e10cSrcweir 1652*cdf0e10cSrcweir /*-----------------12.12.96 12.22------------------- 1653*cdf0e10cSrcweir --------------------------------------------------*/ 1654*cdf0e10cSrcweir void SwTextFlowPage::Reset( const SfxItemSet& rSet ) 1655*cdf0e10cSrcweir { 1656*cdf0e10cSrcweir const SfxPoolItem* pItem; 1657*cdf0e10cSrcweir SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get(); 1658*cdf0e10cSrcweir sal_Bool bFlowAllowed = !bHtmlMode || pHtmlOpt->IsPrintLayoutExtension(); 1659*cdf0e10cSrcweir if(bFlowAllowed) 1660*cdf0e10cSrcweir { 1661*cdf0e10cSrcweir // Einfuegen der vorhandenen Seitenvorlagen in die Listbox 1662*cdf0e10cSrcweir const sal_uInt16 nCount = pShell->GetPageDescCnt(); 1663*cdf0e10cSrcweir sal_uInt16 i; 1664*cdf0e10cSrcweir 1665*cdf0e10cSrcweir for( i = 0; i < nCount; ++i) 1666*cdf0e10cSrcweir { 1667*cdf0e10cSrcweir const SwPageDesc &rPageDesc = pShell->GetPageDesc(i); 1668*cdf0e10cSrcweir aPageCollLB.InsertEntry(rPageDesc.GetName()); 1669*cdf0e10cSrcweir } 1670*cdf0e10cSrcweir 1671*cdf0e10cSrcweir String aFmtName; 1672*cdf0e10cSrcweir for(i = RES_POOLPAGE_BEGIN; i < RES_POOLPAGE_END; ++i) 1673*cdf0e10cSrcweir if( LISTBOX_ENTRY_NOTFOUND == aPageCollLB.GetEntryPos( 1674*cdf0e10cSrcweir aFmtName = SwStyleNameMapper::GetUIName( i, aFmtName ) )) 1675*cdf0e10cSrcweir aPageCollLB.InsertEntry( aFmtName ); 1676*cdf0e10cSrcweir 1677*cdf0e10cSrcweir if(SFX_ITEM_SET == rSet.GetItemState( RES_KEEP, sal_False, &pItem )) 1678*cdf0e10cSrcweir { 1679*cdf0e10cSrcweir aKeepCB.Check( ((const SvxFmtKeepItem*)pItem)->GetValue() ); 1680*cdf0e10cSrcweir aKeepCB.SaveValue(); 1681*cdf0e10cSrcweir } 1682*cdf0e10cSrcweir if(SFX_ITEM_SET == rSet.GetItemState( RES_LAYOUT_SPLIT, sal_False, &pItem )) 1683*cdf0e10cSrcweir { 1684*cdf0e10cSrcweir aSplitCB.Check( ((const SwFmtLayoutSplit*)pItem)->GetValue() ); 1685*cdf0e10cSrcweir } 1686*cdf0e10cSrcweir else 1687*cdf0e10cSrcweir aSplitCB.Check(); 1688*cdf0e10cSrcweir 1689*cdf0e10cSrcweir aSplitCB.SaveValue(); 1690*cdf0e10cSrcweir SplitHdl_Impl(&aSplitCB); 1691*cdf0e10cSrcweir 1692*cdf0e10cSrcweir if(SFX_ITEM_SET == rSet.GetItemState( RES_ROW_SPLIT, sal_False, &pItem )) 1693*cdf0e10cSrcweir { 1694*cdf0e10cSrcweir aSplitRowCB.Check( ((const SwFmtRowSplit*)pItem)->GetValue() ); 1695*cdf0e10cSrcweir } 1696*cdf0e10cSrcweir else 1697*cdf0e10cSrcweir aSplitRowCB.SetState(STATE_DONTKNOW); 1698*cdf0e10cSrcweir aSplitRowCB.SaveValue(); 1699*cdf0e10cSrcweir 1700*cdf0e10cSrcweir if(bPageBreak) 1701*cdf0e10cSrcweir { 1702*cdf0e10cSrcweir if(SFX_ITEM_SET == rSet.GetItemState( RES_PAGEDESC, sal_False, &pItem )) 1703*cdf0e10cSrcweir { 1704*cdf0e10cSrcweir String sPageDesc; 1705*cdf0e10cSrcweir const SwPageDesc* pDesc = ((const SwFmtPageDesc*)pItem)->GetPageDesc(); 1706*cdf0e10cSrcweir aPageNoNF.SetValue(((const SwFmtPageDesc*)pItem)->GetNumOffset()); 1707*cdf0e10cSrcweir if(pDesc) 1708*cdf0e10cSrcweir sPageDesc = pDesc->GetName(); 1709*cdf0e10cSrcweir if ( sPageDesc.Len() && 1710*cdf0e10cSrcweir aPageCollLB.GetEntryPos( sPageDesc ) != LISTBOX_ENTRY_NOTFOUND ) 1711*cdf0e10cSrcweir { 1712*cdf0e10cSrcweir aPageCollLB.SelectEntry( sPageDesc ); 1713*cdf0e10cSrcweir aPageCollCB.Check(); 1714*cdf0e10cSrcweir 1715*cdf0e10cSrcweir aPgBrkCB.Enable(); 1716*cdf0e10cSrcweir aPgBrkRB.Enable(); 1717*cdf0e10cSrcweir aColBrkRB.Enable(); 1718*cdf0e10cSrcweir aPgBrkBeforeRB.Enable(); 1719*cdf0e10cSrcweir aPgBrkAfterRB.Enable(); 1720*cdf0e10cSrcweir aPageCollCB.Enable(); 1721*cdf0e10cSrcweir aPgBrkCB.Check(); 1722*cdf0e10cSrcweir 1723*cdf0e10cSrcweir aPgBrkCB.Check( sal_True ); 1724*cdf0e10cSrcweir aColBrkRB.Check( sal_False ); 1725*cdf0e10cSrcweir aPgBrkBeforeRB.Check( sal_True ); 1726*cdf0e10cSrcweir aPgBrkAfterRB.Check( sal_False ); 1727*cdf0e10cSrcweir } 1728*cdf0e10cSrcweir else 1729*cdf0e10cSrcweir { 1730*cdf0e10cSrcweir aPageCollLB.SetNoSelection(); 1731*cdf0e10cSrcweir aPageCollCB.Check(sal_False); 1732*cdf0e10cSrcweir } 1733*cdf0e10cSrcweir } 1734*cdf0e10cSrcweir 1735*cdf0e10cSrcweir if(SFX_ITEM_SET == rSet.GetItemState( RES_BREAK, sal_False, &pItem )) 1736*cdf0e10cSrcweir { 1737*cdf0e10cSrcweir const SvxFmtBreakItem* pPageBreak = (const SvxFmtBreakItem*)pItem; 1738*cdf0e10cSrcweir SvxBreak eBreak = (SvxBreak)pPageBreak->GetValue(); 1739*cdf0e10cSrcweir 1740*cdf0e10cSrcweir if ( eBreak != SVX_BREAK_NONE ) 1741*cdf0e10cSrcweir { 1742*cdf0e10cSrcweir aPgBrkCB.Check(); 1743*cdf0e10cSrcweir aPageCollCB.Enable(sal_False); 1744*cdf0e10cSrcweir aPageCollLB.Enable(sal_False); 1745*cdf0e10cSrcweir aPageNoFT.Enable(sal_False); 1746*cdf0e10cSrcweir aPageNoNF.Enable(sal_False); 1747*cdf0e10cSrcweir } 1748*cdf0e10cSrcweir switch ( eBreak ) 1749*cdf0e10cSrcweir { 1750*cdf0e10cSrcweir case SVX_BREAK_PAGE_BEFORE: 1751*cdf0e10cSrcweir aPgBrkRB.Check( sal_True ); 1752*cdf0e10cSrcweir aColBrkRB.Check( sal_False ); 1753*cdf0e10cSrcweir aPgBrkBeforeRB.Check( sal_True ); 1754*cdf0e10cSrcweir aPgBrkAfterRB.Check( sal_False ); 1755*cdf0e10cSrcweir break; 1756*cdf0e10cSrcweir case SVX_BREAK_PAGE_AFTER: 1757*cdf0e10cSrcweir aPgBrkRB.Check( sal_True ); 1758*cdf0e10cSrcweir aColBrkRB.Check( sal_False ); 1759*cdf0e10cSrcweir aPgBrkBeforeRB.Check( sal_False ); 1760*cdf0e10cSrcweir aPgBrkAfterRB.Check( sal_True ); 1761*cdf0e10cSrcweir break; 1762*cdf0e10cSrcweir case SVX_BREAK_COLUMN_BEFORE: 1763*cdf0e10cSrcweir aPgBrkRB.Check( sal_False ); 1764*cdf0e10cSrcweir aColBrkRB.Check( sal_True ); 1765*cdf0e10cSrcweir aPgBrkBeforeRB.Check( sal_True ); 1766*cdf0e10cSrcweir aPgBrkAfterRB.Check( sal_False ); 1767*cdf0e10cSrcweir break; 1768*cdf0e10cSrcweir case SVX_BREAK_COLUMN_AFTER: 1769*cdf0e10cSrcweir aPgBrkRB.Check( sal_False ); 1770*cdf0e10cSrcweir aColBrkRB.Check( sal_True ); 1771*cdf0e10cSrcweir aPgBrkBeforeRB.Check( sal_False ); 1772*cdf0e10cSrcweir aPgBrkAfterRB.Check( sal_True ); 1773*cdf0e10cSrcweir break; 1774*cdf0e10cSrcweir default:; //prevent warning 1775*cdf0e10cSrcweir } 1776*cdf0e10cSrcweir 1777*cdf0e10cSrcweir } 1778*cdf0e10cSrcweir if ( aPgBrkBeforeRB.IsChecked() ) 1779*cdf0e10cSrcweir PageBreakPosHdl_Impl( &aPgBrkBeforeRB ); 1780*cdf0e10cSrcweir else if ( aPgBrkAfterRB.IsChecked() ) 1781*cdf0e10cSrcweir PageBreakPosHdl_Impl( &aPgBrkAfterRB ); 1782*cdf0e10cSrcweir PageBreakHdl_Impl( &aPgBrkCB ); 1783*cdf0e10cSrcweir } 1784*cdf0e10cSrcweir } 1785*cdf0e10cSrcweir else 1786*cdf0e10cSrcweir { 1787*cdf0e10cSrcweir aPgBrkRB.Enable(sal_False); 1788*cdf0e10cSrcweir aColBrkRB.Enable(sal_False); 1789*cdf0e10cSrcweir aPgBrkBeforeRB.Enable(sal_False); 1790*cdf0e10cSrcweir aPgBrkAfterRB.Enable(sal_False); 1791*cdf0e10cSrcweir aKeepCB .Enable(sal_False); 1792*cdf0e10cSrcweir aSplitCB.Enable(sal_False); 1793*cdf0e10cSrcweir aPgBrkCB.Enable(sal_False); 1794*cdf0e10cSrcweir aPageCollCB.Enable(sal_False); 1795*cdf0e10cSrcweir aPageCollLB.Enable(sal_False); 1796*cdf0e10cSrcweir } 1797*cdf0e10cSrcweir 1798*cdf0e10cSrcweir if(SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_TABLE_HEADLINE, sal_False, &pItem )) 1799*cdf0e10cSrcweir { 1800*cdf0e10cSrcweir sal_uInt16 nRep = ((const SfxUInt16Item*)pItem)->GetValue(); 1801*cdf0e10cSrcweir aHeadLineCB.Check( nRep > 0 ); 1802*cdf0e10cSrcweir aHeadLineCB.SaveValue(); 1803*cdf0e10cSrcweir aRepeatHeaderNF.SetValue( nRep ); 1804*cdf0e10cSrcweir aRepeatHeaderNF.SaveValue(); 1805*cdf0e10cSrcweir } 1806*cdf0e10cSrcweir if ( rSet.GetItemState(FN_TABLE_BOX_TEXTDIRECTION) > SFX_ITEM_AVAILABLE ) 1807*cdf0e10cSrcweir { 1808*cdf0e10cSrcweir sal_uLong nDirection = ((const SvxFrameDirectionItem&)rSet.Get(FN_TABLE_BOX_TEXTDIRECTION)).GetValue(); 1809*cdf0e10cSrcweir aTextDirectionLB.SelectEntryPos(aTextDirectionLB.GetEntryPos( (const void*)nDirection )); 1810*cdf0e10cSrcweir } 1811*cdf0e10cSrcweir 1812*cdf0e10cSrcweir if ( rSet.GetItemState(FN_TABLE_SET_VERT_ALIGN) > SFX_ITEM_AVAILABLE ) 1813*cdf0e10cSrcweir { 1814*cdf0e10cSrcweir sal_uInt16 nVert = ((const SfxUInt16Item&)rSet.Get(FN_TABLE_SET_VERT_ALIGN)).GetValue(); 1815*cdf0e10cSrcweir sal_uInt16 nPos = 0; 1816*cdf0e10cSrcweir switch(nVert) 1817*cdf0e10cSrcweir { 1818*cdf0e10cSrcweir case text::VertOrientation::NONE: nPos = 0; break; 1819*cdf0e10cSrcweir case text::VertOrientation::CENTER: nPos = 1; break; 1820*cdf0e10cSrcweir case text::VertOrientation::BOTTOM: nPos = 2; break; 1821*cdf0e10cSrcweir } 1822*cdf0e10cSrcweir aVertOrientLB.SelectEntryPos(nPos); 1823*cdf0e10cSrcweir } 1824*cdf0e10cSrcweir 1825*cdf0e10cSrcweir aPageCollCB.SaveValue(); 1826*cdf0e10cSrcweir aPageCollLB.SaveValue(); 1827*cdf0e10cSrcweir aPgBrkCB.SaveValue(); 1828*cdf0e10cSrcweir aPgBrkRB.SaveValue(); 1829*cdf0e10cSrcweir aColBrkRB.SaveValue(); 1830*cdf0e10cSrcweir aPgBrkBeforeRB.SaveValue(); 1831*cdf0e10cSrcweir aPgBrkAfterRB.SaveValue(); 1832*cdf0e10cSrcweir aPageNoNF.SaveValue(); 1833*cdf0e10cSrcweir aTextDirectionLB.SaveValue(); 1834*cdf0e10cSrcweir aVertOrientLB.SaveValue(); 1835*cdf0e10cSrcweir 1836*cdf0e10cSrcweir HeadLineCBClickHdl(); 1837*cdf0e10cSrcweir } 1838*cdf0e10cSrcweir /*-----------------16.04.98 14:48------------------- 1839*cdf0e10cSrcweir 1840*cdf0e10cSrcweir --------------------------------------------------*/ 1841*cdf0e10cSrcweir 1842*cdf0e10cSrcweir void SwTextFlowPage::SetShell(SwWrtShell* pSh) 1843*cdf0e10cSrcweir { 1844*cdf0e10cSrcweir pShell = pSh; 1845*cdf0e10cSrcweir bHtmlMode = 0 != (::GetHtmlMode(pShell->GetView().GetDocShell()) & HTMLMODE_ON); 1846*cdf0e10cSrcweir if(bHtmlMode) 1847*cdf0e10cSrcweir { 1848*cdf0e10cSrcweir aPageNoNF.Enable(sal_False); 1849*cdf0e10cSrcweir aPageNoFT.Enable(sal_False); 1850*cdf0e10cSrcweir } 1851*cdf0e10cSrcweir } 1852*cdf0e10cSrcweir 1853*cdf0e10cSrcweir /*-----------------12.12.96 16.18------------------- 1854*cdf0e10cSrcweir --------------------------------------------------*/ 1855*cdf0e10cSrcweir IMPL_LINK( SwTextFlowPage, PageBreakHdl_Impl, CheckBox*, EMPTYARG ) 1856*cdf0e10cSrcweir { 1857*cdf0e10cSrcweir if( aPgBrkCB.IsChecked() ) 1858*cdf0e10cSrcweir { 1859*cdf0e10cSrcweir aPgBrkRB. Enable(); 1860*cdf0e10cSrcweir aColBrkRB. Enable(); 1861*cdf0e10cSrcweir aPgBrkBeforeRB. Enable(); 1862*cdf0e10cSrcweir aPgBrkAfterRB. Enable(); 1863*cdf0e10cSrcweir 1864*cdf0e10cSrcweir if ( aPgBrkRB.IsChecked() && aPgBrkBeforeRB.IsChecked() ) 1865*cdf0e10cSrcweir { 1866*cdf0e10cSrcweir aPageCollCB.Enable(); 1867*cdf0e10cSrcweir 1868*cdf0e10cSrcweir sal_Bool bEnable = aPageCollCB.IsChecked() && 1869*cdf0e10cSrcweir aPageCollLB.GetEntryCount(); 1870*cdf0e10cSrcweir aPageCollLB.Enable(bEnable); 1871*cdf0e10cSrcweir if(!bHtmlMode) 1872*cdf0e10cSrcweir { 1873*cdf0e10cSrcweir aPageNoFT.Enable(bEnable); 1874*cdf0e10cSrcweir aPageNoNF.Enable(bEnable); 1875*cdf0e10cSrcweir } 1876*cdf0e10cSrcweir } 1877*cdf0e10cSrcweir } 1878*cdf0e10cSrcweir else 1879*cdf0e10cSrcweir { 1880*cdf0e10cSrcweir aPageCollCB.Check( sal_False ); 1881*cdf0e10cSrcweir aPageCollCB.Enable(sal_False); 1882*cdf0e10cSrcweir aPageCollLB.Enable(sal_False); 1883*cdf0e10cSrcweir aPageNoFT.Enable(sal_False); 1884*cdf0e10cSrcweir aPageNoNF.Enable(sal_False); 1885*cdf0e10cSrcweir aPgBrkRB. Enable(sal_False); 1886*cdf0e10cSrcweir aColBrkRB. Enable(sal_False); 1887*cdf0e10cSrcweir aPgBrkBeforeRB. Enable(sal_False); 1888*cdf0e10cSrcweir aPgBrkAfterRB. Enable(sal_False); 1889*cdf0e10cSrcweir } 1890*cdf0e10cSrcweir return 0; 1891*cdf0e10cSrcweir } 1892*cdf0e10cSrcweir 1893*cdf0e10cSrcweir /*-----------------12.12.96 16.18------------------- 1894*cdf0e10cSrcweir --------------------------------------------------*/ 1895*cdf0e10cSrcweir IMPL_LINK( SwTextFlowPage, ApplyCollClickHdl_Impl, CheckBox*, EMPTYARG ) 1896*cdf0e10cSrcweir { 1897*cdf0e10cSrcweir sal_Bool bEnable = sal_False; 1898*cdf0e10cSrcweir if ( aPageCollCB.IsChecked() && 1899*cdf0e10cSrcweir aPageCollLB.GetEntryCount() ) 1900*cdf0e10cSrcweir { 1901*cdf0e10cSrcweir bEnable = sal_True; 1902*cdf0e10cSrcweir aPageCollLB.SelectEntryPos( 0 ); 1903*cdf0e10cSrcweir } 1904*cdf0e10cSrcweir else 1905*cdf0e10cSrcweir { 1906*cdf0e10cSrcweir aPageCollLB.SetNoSelection(); 1907*cdf0e10cSrcweir } 1908*cdf0e10cSrcweir aPageCollLB.Enable(bEnable); 1909*cdf0e10cSrcweir if(!bHtmlMode) 1910*cdf0e10cSrcweir { 1911*cdf0e10cSrcweir aPageNoFT.Enable(bEnable); 1912*cdf0e10cSrcweir aPageNoNF.Enable(bEnable); 1913*cdf0e10cSrcweir } 1914*cdf0e10cSrcweir return 0; 1915*cdf0e10cSrcweir } 1916*cdf0e10cSrcweir 1917*cdf0e10cSrcweir /*-----------------12.12.96 16.18------------------- 1918*cdf0e10cSrcweir --------------------------------------------------*/ 1919*cdf0e10cSrcweir IMPL_LINK( SwTextFlowPage, PageBreakPosHdl_Impl, RadioButton*, pBtn ) 1920*cdf0e10cSrcweir { 1921*cdf0e10cSrcweir if ( aPgBrkCB.IsChecked() ) 1922*cdf0e10cSrcweir { 1923*cdf0e10cSrcweir if ( pBtn == &aPgBrkBeforeRB && aPgBrkRB.IsChecked() ) 1924*cdf0e10cSrcweir { 1925*cdf0e10cSrcweir aPageCollCB.Enable(); 1926*cdf0e10cSrcweir 1927*cdf0e10cSrcweir sal_Bool bEnable = aPageCollCB.IsChecked() && 1928*cdf0e10cSrcweir aPageCollLB.GetEntryCount(); 1929*cdf0e10cSrcweir 1930*cdf0e10cSrcweir aPageCollLB.Enable(bEnable); 1931*cdf0e10cSrcweir if(!bHtmlMode) 1932*cdf0e10cSrcweir { 1933*cdf0e10cSrcweir aPageNoFT.Enable(bEnable); 1934*cdf0e10cSrcweir aPageNoNF.Enable(bEnable); 1935*cdf0e10cSrcweir } 1936*cdf0e10cSrcweir } 1937*cdf0e10cSrcweir else if ( pBtn == &aPgBrkAfterRB ) 1938*cdf0e10cSrcweir { 1939*cdf0e10cSrcweir aPageCollCB .Check( sal_False ); 1940*cdf0e10cSrcweir aPageCollCB .Enable(sal_False); 1941*cdf0e10cSrcweir aPageCollLB .Enable(sal_False); 1942*cdf0e10cSrcweir aPageNoFT .Enable(sal_False); 1943*cdf0e10cSrcweir aPageNoNF .Enable(sal_False); 1944*cdf0e10cSrcweir } 1945*cdf0e10cSrcweir } 1946*cdf0e10cSrcweir return 0; 1947*cdf0e10cSrcweir } 1948*cdf0e10cSrcweir 1949*cdf0e10cSrcweir /*-----------------12.12.96 16.18------------------- 1950*cdf0e10cSrcweir --------------------------------------------------*/ 1951*cdf0e10cSrcweir IMPL_LINK( SwTextFlowPage, PageBreakTypeHdl_Impl, RadioButton*, pBtn ) 1952*cdf0e10cSrcweir { 1953*cdf0e10cSrcweir if ( pBtn == &aColBrkRB || aPgBrkAfterRB.IsChecked() ) 1954*cdf0e10cSrcweir { 1955*cdf0e10cSrcweir aPageCollCB .Check(sal_False); 1956*cdf0e10cSrcweir aPageCollCB .Enable(sal_False); 1957*cdf0e10cSrcweir aPageCollLB .Enable(sal_False); 1958*cdf0e10cSrcweir aPageNoFT .Enable(sal_False); 1959*cdf0e10cSrcweir aPageNoNF .Enable(sal_False); 1960*cdf0e10cSrcweir } 1961*cdf0e10cSrcweir else if ( aPgBrkBeforeRB.IsChecked() ) 1962*cdf0e10cSrcweir PageBreakPosHdl_Impl( &aPgBrkBeforeRB ); 1963*cdf0e10cSrcweir return 0; 1964*cdf0e10cSrcweir } 1965*cdf0e10cSrcweir /*-----------------17.11.2003 11:30----------------- 1966*cdf0e10cSrcweir * 1967*cdf0e10cSrcweir * --------------------------------------------------*/ 1968*cdf0e10cSrcweir IMPL_LINK( SwTextFlowPage, SplitHdl_Impl, CheckBox*, pBox ) 1969*cdf0e10cSrcweir { 1970*cdf0e10cSrcweir aSplitRowCB.Enable(pBox->IsChecked()); 1971*cdf0e10cSrcweir return 0; 1972*cdf0e10cSrcweir } 1973*cdf0e10cSrcweir /*-----------------17.11.2003 11:30----------------- 1974*cdf0e10cSrcweir * 1975*cdf0e10cSrcweir * --------------------------------------------------*/ 1976*cdf0e10cSrcweir IMPL_LINK( SwTextFlowPage, SplitRowHdl_Impl, TriStateBox*, pBox ) 1977*cdf0e10cSrcweir { 1978*cdf0e10cSrcweir pBox->EnableTriState(sal_False); 1979*cdf0e10cSrcweir return 0; 1980*cdf0e10cSrcweir } 1981*cdf0e10cSrcweir 1982*cdf0e10cSrcweir IMPL_LINK( SwTextFlowPage, HeadLineCBClickHdl, void*, EMPTYARG ) 1983*cdf0e10cSrcweir { 1984*cdf0e10cSrcweir aRepeatHeaderCombo.Enable(aHeadLineCB.IsChecked()); 1985*cdf0e10cSrcweir 1986*cdf0e10cSrcweir return 0; 1987*cdf0e10cSrcweir } 1988*cdf0e10cSrcweir 1989*cdf0e10cSrcweir /*-----------------30.05.97 07:37------------------- 1990*cdf0e10cSrcweir 1991*cdf0e10cSrcweir --------------------------------------------------*/ 1992*cdf0e10cSrcweir void SwTextFlowPage::DisablePageBreak() 1993*cdf0e10cSrcweir { 1994*cdf0e10cSrcweir bPageBreak = sal_False; 1995*cdf0e10cSrcweir aPgBrkCB .Disable(); 1996*cdf0e10cSrcweir aPgBrkRB .Disable(); 1997*cdf0e10cSrcweir aColBrkRB .Disable(); 1998*cdf0e10cSrcweir aPgBrkBeforeRB .Disable(); 1999*cdf0e10cSrcweir aPgBrkAfterRB .Disable(); 2000*cdf0e10cSrcweir aPageCollCB .Disable(); 2001*cdf0e10cSrcweir aPageCollLB .Disable(); 2002*cdf0e10cSrcweir aPageNoFT .Disable(); 2003*cdf0e10cSrcweir aPageNoNF .Disable(); 2004*cdf0e10cSrcweir } 2005*cdf0e10cSrcweir 2006*cdf0e10cSrcweir 2007*cdf0e10cSrcweir 2008