1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_sw.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <com/sun/star/chart/ChartDataRowSource.hpp> 32*cdf0e10cSrcweir #include <com/sun/star/chart2/data/XDataProvider.hpp> 33*cdf0e10cSrcweir #include <com/sun/star/chart2/data/XDataReceiver.hpp> 34*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyState.hpp> 35*cdf0e10cSrcweir 36*cdf0e10cSrcweir #include <sot/storage.hxx> 37*cdf0e10cSrcweir #include <sot/clsids.hxx> 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir #include "edtwin.hxx" 40*cdf0e10cSrcweir #include "errhdl.hxx" 41*cdf0e10cSrcweir #include "wrtsh.hxx" 42*cdf0e10cSrcweir #include "cmdid.h" 43*cdf0e10cSrcweir #include "frmatr.hxx" 44*cdf0e10cSrcweir #include "view.hxx" 45*cdf0e10cSrcweir #include "basesh.hxx" 46*cdf0e10cSrcweir #include "swundo.hxx" 47*cdf0e10cSrcweir #include "tablemgr.hxx" 48*cdf0e10cSrcweir #include "frmfmt.hxx" 49*cdf0e10cSrcweir #include "instable.hxx" 50*cdf0e10cSrcweir #include "swerror.h" 51*cdf0e10cSrcweir #include "table.hrc" 52*cdf0e10cSrcweir #include "swabstdlg.hxx" 53*cdf0e10cSrcweir #include "swcli.hxx" 54*cdf0e10cSrcweir #include "docsh.hxx" 55*cdf0e10cSrcweir #include "unotbl.hxx" 56*cdf0e10cSrcweir #include "unochart.hxx" 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir using namespace ::com::sun::star; 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir /*------------------------------------------------------------------------ 61*cdf0e10cSrcweir Beschreibung: Zeilenhoehe einstellen (Dialog) 62*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir void SwTableFUNC::ColWidthDlg( Window *pParent ) 66*cdf0e10cSrcweir { 67*cdf0e10cSrcweir InitTabCols(); 68*cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 69*cdf0e10cSrcweir DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir VclAbstractDialog* pDlg = pFact->CreateSwTableWidthDlg( pParent, *this ,DLG_COL_WIDTH ); 72*cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!"); 73*cdf0e10cSrcweir pDlg->Execute(); 74*cdf0e10cSrcweir delete pDlg; 75*cdf0e10cSrcweir } 76*cdf0e10cSrcweir 77*cdf0e10cSrcweir /*-------------------------------------------------------------------- 78*cdf0e10cSrcweir Beschreibung: Breite ermitteln 79*cdf0e10cSrcweir --------------------------------------------------------------------*/ 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir 82*cdf0e10cSrcweir SwTwips SwTableFUNC::GetColWidth(sal_uInt16 nNum) const 83*cdf0e10cSrcweir { 84*cdf0e10cSrcweir SwTwips nWidth = 0; 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir if( aCols.Count() > 0 ) 87*cdf0e10cSrcweir { 88*cdf0e10cSrcweir if(aCols.Count() == GetColCount()) 89*cdf0e10cSrcweir { 90*cdf0e10cSrcweir nWidth = (SwTwips)((nNum == aCols.Count()) ? 91*cdf0e10cSrcweir aCols.GetRight() - aCols[nNum-1] : 92*cdf0e10cSrcweir nNum == 0 ? aCols[nNum] - aCols.GetLeft() : 93*cdf0e10cSrcweir aCols[nNum] - aCols[nNum-1]); 94*cdf0e10cSrcweir } 95*cdf0e10cSrcweir else 96*cdf0e10cSrcweir { 97*cdf0e10cSrcweir SwTwips nRValid = nNum < GetColCount() ? 98*cdf0e10cSrcweir aCols[(sal_uInt16)GetRightSeparator((int)nNum)]: 99*cdf0e10cSrcweir aCols.GetRight(); 100*cdf0e10cSrcweir SwTwips nLValid = nNum ? 101*cdf0e10cSrcweir aCols[(sal_uInt16)GetRightSeparator((int)nNum - 1)]: 102*cdf0e10cSrcweir aCols.GetLeft(); 103*cdf0e10cSrcweir nWidth = nRValid - nLValid; 104*cdf0e10cSrcweir } 105*cdf0e10cSrcweir } 106*cdf0e10cSrcweir else 107*cdf0e10cSrcweir nWidth = aCols.GetRight(); 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir return nWidth; 110*cdf0e10cSrcweir } 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir SwTwips SwTableFUNC::GetMaxColWidth( sal_uInt16 nNum ) const 115*cdf0e10cSrcweir { 116*cdf0e10cSrcweir ASSERT(nNum <= aCols.Count(), "Index out of Area"); 117*cdf0e10cSrcweir 118*cdf0e10cSrcweir if ( GetColCount() > 0 ) 119*cdf0e10cSrcweir { 120*cdf0e10cSrcweir // Die max. Breite ergibt sich aus der eigenen Breite und 121*cdf0e10cSrcweir // der Breite der Nachbarzellen um je MINLAY verringert 122*cdf0e10cSrcweir SwTwips nMax = nNum == 0 ? 123*cdf0e10cSrcweir GetColWidth(1) - MINLAY : 124*cdf0e10cSrcweir nNum == GetColCount() ? 125*cdf0e10cSrcweir GetColWidth( nNum-1 ) - MINLAY : 126*cdf0e10cSrcweir GetColWidth(nNum - 1) + GetColWidth( nNum + 1 ) - 2 * MINLAY; 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir return nMax + GetColWidth(nNum) ; 129*cdf0e10cSrcweir } 130*cdf0e10cSrcweir else 131*cdf0e10cSrcweir return GetColWidth(nNum); 132*cdf0e10cSrcweir } 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir void SwTableFUNC::SetColWidth(sal_uInt16 nNum, SwTwips nNewWidth ) 137*cdf0e10cSrcweir { 138*cdf0e10cSrcweir // aktuelle Breite setzen 139*cdf0e10cSrcweir // alle folgenden Verschieben 140*cdf0e10cSrcweir sal_Bool bCurrentOnly = sal_False; 141*cdf0e10cSrcweir SwTwips nWidth = 0; 142*cdf0e10cSrcweir 143*cdf0e10cSrcweir if ( aCols.Count() > 0 ) 144*cdf0e10cSrcweir { 145*cdf0e10cSrcweir if(aCols.Count() != GetColCount()) 146*cdf0e10cSrcweir bCurrentOnly = sal_True; 147*cdf0e10cSrcweir nWidth = GetColWidth(nNum); 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir int nDiff = (int)(nNewWidth - nWidth); 150*cdf0e10cSrcweir if( !nNum ) 151*cdf0e10cSrcweir aCols[ static_cast< sal_uInt16 >(GetRightSeparator(0)) ] += nDiff; 152*cdf0e10cSrcweir else if( nNum < GetColCount() ) 153*cdf0e10cSrcweir { 154*cdf0e10cSrcweir if(nDiff < GetColWidth(nNum + 1) - MINLAY) 155*cdf0e10cSrcweir aCols[ static_cast< sal_uInt16 >(GetRightSeparator(nNum)) ] += nDiff; 156*cdf0e10cSrcweir else 157*cdf0e10cSrcweir { 158*cdf0e10cSrcweir int nDiffLeft = nDiff - (int)GetColWidth(nNum + 1) + (int)MINLAY; 159*cdf0e10cSrcweir aCols[ static_cast< sal_uInt16 >(GetRightSeparator(nNum)) ] += (nDiff - nDiffLeft); 160*cdf0e10cSrcweir aCols[ static_cast< sal_uInt16 >(GetRightSeparator(nNum - 1)) ] -= nDiffLeft; 161*cdf0e10cSrcweir } 162*cdf0e10cSrcweir } 163*cdf0e10cSrcweir else 164*cdf0e10cSrcweir aCols[ static_cast< sal_uInt16 >(GetRightSeparator(nNum-1)) ] -= nDiff; 165*cdf0e10cSrcweir } 166*cdf0e10cSrcweir else 167*cdf0e10cSrcweir aCols.SetRight( Min( nNewWidth, aCols.GetRightMax()) ); 168*cdf0e10cSrcweir 169*cdf0e10cSrcweir pSh->StartAllAction(); 170*cdf0e10cSrcweir pSh->SetTabCols( aCols, bCurrentOnly ); 171*cdf0e10cSrcweir pSh->EndAllAction(); 172*cdf0e10cSrcweir } 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir void SwTableFUNC::InitTabCols() 177*cdf0e10cSrcweir { 178*cdf0e10cSrcweir ASSERT(pSh, keine Shell); 179*cdf0e10cSrcweir 180*cdf0e10cSrcweir if( pFmt && pSh) 181*cdf0e10cSrcweir pSh->GetTabCols( aCols ); 182*cdf0e10cSrcweir } 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir SwTableFUNC::SwTableFUNC(SwWrtShell *pShell, sal_Bool bCopyFmt) 187*cdf0e10cSrcweir : pFmt(pShell->GetTableFmt()), 188*cdf0e10cSrcweir pSh(pShell), 189*cdf0e10cSrcweir bCopy(bCopyFmt) 190*cdf0e10cSrcweir { 191*cdf0e10cSrcweir // gfs. das Format fuer die Bearbeitung kopieren 192*cdf0e10cSrcweir if( pFmt && bCopy ) 193*cdf0e10cSrcweir pFmt = new SwFrmFmt( *pFmt ); 194*cdf0e10cSrcweir } 195*cdf0e10cSrcweir 196*cdf0e10cSrcweir 197*cdf0e10cSrcweir 198*cdf0e10cSrcweir SwTableFUNC::~SwTableFUNC() 199*cdf0e10cSrcweir { 200*cdf0e10cSrcweir if(bCopy) 201*cdf0e10cSrcweir delete pFmt; 202*cdf0e10cSrcweir } 203*cdf0e10cSrcweir 204*cdf0e10cSrcweir void SwTableFUNC::UpdateChart() 205*cdf0e10cSrcweir { 206*cdf0e10cSrcweir //Update der Felder in der Tabelle vom User ausgeloesst, alle 207*cdf0e10cSrcweir //Charts zu der Tabelle werden auf den neuesten Stand gebracht. 208*cdf0e10cSrcweir SwFrmFmt *pFmt2 = pSh->GetTableFmt(); 209*cdf0e10cSrcweir if ( pFmt2 && pSh->HasOLEObj( pFmt2->GetName() ) ) 210*cdf0e10cSrcweir { 211*cdf0e10cSrcweir pSh->StartAllAction(); 212*cdf0e10cSrcweir pSh->UpdateCharts( pFmt2->GetName() ); 213*cdf0e10cSrcweir pSh->EndAllAction(); 214*cdf0e10cSrcweir } 215*cdf0e10cSrcweir } 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir uno::Reference< frame::XModel > SwTableFUNC::InsertChart( 218*cdf0e10cSrcweir uno::Reference< chart2::data::XDataProvider > &rxDataProvider, 219*cdf0e10cSrcweir sal_Bool bFillWithData, 220*cdf0e10cSrcweir const rtl::OUString &rCellRange, 221*cdf0e10cSrcweir SwFlyFrmFmt** ppFlyFrmFmt ) 222*cdf0e10cSrcweir { 223*cdf0e10cSrcweir uno::Reference< frame::XModel > xChartModel; 224*cdf0e10cSrcweir pSh->StartUndo( UNDO_UI_INSERT_CHART ); 225*cdf0e10cSrcweir pSh->StartAllAction(); 226*cdf0e10cSrcweir 227*cdf0e10cSrcweir String aName; 228*cdf0e10cSrcweir if (pSh->IsCrsrInTbl()) 229*cdf0e10cSrcweir { 230*cdf0e10cSrcweir aName = pSh->GetTableFmt()->GetName(); 231*cdf0e10cSrcweir // insert node before table 232*cdf0e10cSrcweir pSh->MoveTable( fnTableCurr, fnTableStart ); 233*cdf0e10cSrcweir pSh->Up( sal_False, 1, sal_False ); 234*cdf0e10cSrcweir if ( pSh->IsCrsrInTbl() ) 235*cdf0e10cSrcweir { 236*cdf0e10cSrcweir if ( aName != pSh->GetTableFmt()->GetName() ) 237*cdf0e10cSrcweir pSh->Down( sal_False, 1, sal_False ); // two adjacent tables 238*cdf0e10cSrcweir } 239*cdf0e10cSrcweir pSh->SplitNode(); 240*cdf0e10cSrcweir } 241*cdf0e10cSrcweir 242*cdf0e10cSrcweir // insert chart 243*cdf0e10cSrcweir ::rtl::OUString aObjName; 244*cdf0e10cSrcweir comphelper::EmbeddedObjectContainer aCnt; 245*cdf0e10cSrcweir uno::Reference < embed::XEmbeddedObject > xObj = 246*cdf0e10cSrcweir aCnt.CreateEmbeddedObject( SvGlobalName( SO3_SCH_CLASSID ).GetByteSequence(), aObjName ); 247*cdf0e10cSrcweir 248*cdf0e10cSrcweir ::svt::EmbeddedObjectRef aEmbObjRef( xObj, ::com::sun::star::embed::Aspects::MSOLE_CONTENT ); 249*cdf0e10cSrcweir if ( xObj.is() ) 250*cdf0e10cSrcweir { 251*cdf0e10cSrcweir 252*cdf0e10cSrcweir SwFlyFrmFmt* pTmp = 0; 253*cdf0e10cSrcweir pSh->InsertOleObject( aEmbObjRef, &pTmp ); 254*cdf0e10cSrcweir if (ppFlyFrmFmt) 255*cdf0e10cSrcweir *ppFlyFrmFmt = pTmp; 256*cdf0e10cSrcweir 257*cdf0e10cSrcweir uno::Reference< embed::XComponentSupplier > xCompSupp( xObj, uno::UNO_QUERY ); 258*cdf0e10cSrcweir if( xCompSupp.is()) 259*cdf0e10cSrcweir { 260*cdf0e10cSrcweir xChartModel.set( xCompSupp->getComponent(), uno::UNO_QUERY ); 261*cdf0e10cSrcweir if( xChartModel.is() ) 262*cdf0e10cSrcweir xChartModel->lockControllers(); //#i79578# don't request a new replacement image for charts to often - block change notifications 263*cdf0e10cSrcweir } 264*cdf0e10cSrcweir 265*cdf0e10cSrcweir // set the table name at the OLE-node 266*cdf0e10cSrcweir if (aName.Len()) 267*cdf0e10cSrcweir pSh->SetChartName( aName ); 268*cdf0e10cSrcweir } 269*cdf0e10cSrcweir pSh->EndAllAction(); 270*cdf0e10cSrcweir 271*cdf0e10cSrcweir if ( xObj.is() ) 272*cdf0e10cSrcweir { 273*cdf0e10cSrcweir // Let the chart be activated after the inserting 274*cdf0e10cSrcweir SfxInPlaceClient* pClient = pSh->GetView().FindIPClient( xObj, &pSh->GetView().GetEditWin() ); 275*cdf0e10cSrcweir if ( !pClient ) 276*cdf0e10cSrcweir { 277*cdf0e10cSrcweir pClient = new SwOleClient( &pSh->GetView(), &pSh->GetView().GetEditWin(), aEmbObjRef ); 278*cdf0e10cSrcweir pSh->SetCheckForOLEInCaption( sal_True ); 279*cdf0e10cSrcweir } 280*cdf0e10cSrcweir pSh->CalcAndSetScale( aEmbObjRef ); 281*cdf0e10cSrcweir //#50270# Error brauchen wir nicht handeln, das erledigt das 282*cdf0e10cSrcweir //DoVerb in der SfxViewShell 283*cdf0e10cSrcweir ErrCode nErr = pClient->DoVerb( SVVERB_SHOW ); 284*cdf0e10cSrcweir (void) nErr; 285*cdf0e10cSrcweir } 286*cdf0e10cSrcweir 287*cdf0e10cSrcweir uno::Reference< chart2::data::XDataReceiver > xDataReceiver( xChartModel, uno::UNO_QUERY ); 288*cdf0e10cSrcweir if (bFillWithData && xDataReceiver.is() && rxDataProvider.is()) 289*cdf0e10cSrcweir { 290*cdf0e10cSrcweir xDataReceiver->attachDataProvider( rxDataProvider ); 291*cdf0e10cSrcweir 292*cdf0e10cSrcweir uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( pSh->GetView().GetDocShell()->GetModel(), uno::UNO_QUERY ); 293*cdf0e10cSrcweir xDataReceiver->attachNumberFormatsSupplier( xNumberFormatsSupplier ); 294*cdf0e10cSrcweir 295*cdf0e10cSrcweir // default values for ranges that do not consist of a single row or column 296*cdf0e10cSrcweir bool bHasCategories = true; 297*cdf0e10cSrcweir bool bFirstCellAsLabel = true; 298*cdf0e10cSrcweir chart::ChartDataRowSource eDataRowSource = chart::ChartDataRowSource_COLUMNS; 299*cdf0e10cSrcweir 300*cdf0e10cSrcweir SwRangeDescriptor aDesc; 301*cdf0e10cSrcweir FillRangeDescriptor( aDesc, rCellRange ); 302*cdf0e10cSrcweir bool bSingleRowCol = aDesc.nTop == aDesc.nBottom || aDesc.nLeft == aDesc.nRight; 303*cdf0e10cSrcweir if (bSingleRowCol) 304*cdf0e10cSrcweir { 305*cdf0e10cSrcweir aDesc.Normalize(); 306*cdf0e10cSrcweir sal_Int32 nRowLen = aDesc.nRight - aDesc.nLeft + 1; 307*cdf0e10cSrcweir sal_Int32 nColLen = aDesc.nBottom - aDesc.nTop + 1; 308*cdf0e10cSrcweir 309*cdf0e10cSrcweir bHasCategories = false; 310*cdf0e10cSrcweir if (nRowLen == 1 && nColLen == 1) 311*cdf0e10cSrcweir bFirstCellAsLabel = false; 312*cdf0e10cSrcweir else if (nRowLen > 1) 313*cdf0e10cSrcweir eDataRowSource = chart::ChartDataRowSource_ROWS; 314*cdf0e10cSrcweir else if (nColLen > 1) 315*cdf0e10cSrcweir eDataRowSource = chart::ChartDataRowSource_COLUMNS; 316*cdf0e10cSrcweir else { 317*cdf0e10cSrcweir DBG_ERROR( "unexpected state" ); 318*cdf0e10cSrcweir } 319*cdf0e10cSrcweir } 320*cdf0e10cSrcweir 321*cdf0e10cSrcweir uno::Sequence< beans::PropertyValue > aArgs( 4 ); 322*cdf0e10cSrcweir aArgs[0] = beans::PropertyValue( 323*cdf0e10cSrcweir ::rtl::OUString::createFromAscii("CellRangeRepresentation"), -1, 324*cdf0e10cSrcweir uno::makeAny( rCellRange ), beans::PropertyState_DIRECT_VALUE ); 325*cdf0e10cSrcweir aArgs[1] = beans::PropertyValue( 326*cdf0e10cSrcweir ::rtl::OUString::createFromAscii("HasCategories"), -1, 327*cdf0e10cSrcweir uno::makeAny( bHasCategories ), beans::PropertyState_DIRECT_VALUE ); 328*cdf0e10cSrcweir aArgs[2] = beans::PropertyValue( 329*cdf0e10cSrcweir ::rtl::OUString::createFromAscii("FirstCellAsLabel"), -1, 330*cdf0e10cSrcweir uno::makeAny( bFirstCellAsLabel ), beans::PropertyState_DIRECT_VALUE ); 331*cdf0e10cSrcweir aArgs[3] = beans::PropertyValue( 332*cdf0e10cSrcweir ::rtl::OUString::createFromAscii("DataRowSource"), -1, 333*cdf0e10cSrcweir uno::makeAny( eDataRowSource ), beans::PropertyState_DIRECT_VALUE ); 334*cdf0e10cSrcweir xDataReceiver->setArguments( aArgs ); 335*cdf0e10cSrcweir } 336*cdf0e10cSrcweir 337*cdf0e10cSrcweir pSh->EndUndo( UNDO_UI_INSERT_CHART ); 338*cdf0e10cSrcweir 339*cdf0e10cSrcweir if( xChartModel.is() ) 340*cdf0e10cSrcweir xChartModel->unlockControllers(); //#i79578# don't request a new replacement image for charts to often 341*cdf0e10cSrcweir return xChartModel; 342*cdf0e10cSrcweir } 343*cdf0e10cSrcweir 344*cdf0e10cSrcweir sal_uInt16 SwTableFUNC::GetCurColNum() const 345*cdf0e10cSrcweir { 346*cdf0e10cSrcweir sal_uInt16 nPos = pSh->GetCurTabColNum(); 347*cdf0e10cSrcweir sal_uInt16 nCount = 0; 348*cdf0e10cSrcweir for(sal_uInt16 i = 0; i < nPos; i++ ) 349*cdf0e10cSrcweir if(aCols.IsHidden(i)) 350*cdf0e10cSrcweir nCount ++; 351*cdf0e10cSrcweir return nPos - nCount; 352*cdf0e10cSrcweir } 353*cdf0e10cSrcweir 354*cdf0e10cSrcweir 355*cdf0e10cSrcweir 356*cdf0e10cSrcweir 357*cdf0e10cSrcweir sal_uInt16 SwTableFUNC::GetColCount() const 358*cdf0e10cSrcweir { 359*cdf0e10cSrcweir sal_uInt16 nCount = 0; 360*cdf0e10cSrcweir for(sal_uInt16 i = 0; i < aCols.Count(); i++ ) 361*cdf0e10cSrcweir if(aCols.IsHidden(i)) 362*cdf0e10cSrcweir nCount ++; 363*cdf0e10cSrcweir return aCols.Count() - nCount; 364*cdf0e10cSrcweir } 365*cdf0e10cSrcweir 366*cdf0e10cSrcweir 367*cdf0e10cSrcweir 368*cdf0e10cSrcweir int SwTableFUNC::GetRightSeparator(int nNum) const 369*cdf0e10cSrcweir { 370*cdf0e10cSrcweir DBG_ASSERT( nNum < (int)GetColCount() ,"Index out of range"); 371*cdf0e10cSrcweir int i = 0; 372*cdf0e10cSrcweir while( nNum >= 0 ) 373*cdf0e10cSrcweir { 374*cdf0e10cSrcweir if( !aCols.IsHidden( static_cast< sal_uInt16 >(i)) ) 375*cdf0e10cSrcweir nNum--; 376*cdf0e10cSrcweir i++; 377*cdf0e10cSrcweir } 378*cdf0e10cSrcweir return i - 1; 379*cdf0e10cSrcweir } 380*cdf0e10cSrcweir 381*cdf0e10cSrcweir 382*cdf0e10cSrcweir 383