2010-10-14 08:30:41 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2000-09-18 23:08:29 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 13:31:21 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2008-04-10 13:31:21 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2008-04-10 13:31:21 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2008-04-10 13:31:21 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2008-04-10 13:31:21 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2008-04-10 13:31:21 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
#ifndef _TBLRWCL_HXX
|
|
|
|
#define _TBLRWCL_HXX
|
2011-09-20 09:43:40 +02:00
|
|
|
#include <cstddef>
|
2007-11-02 13:41:29 +00:00
|
|
|
#include <vector>
|
2000-09-18 23:08:29 +00:00
|
|
|
#include <swtypes.hxx>
|
|
|
|
#include <tblsel.hxx>
|
|
|
|
#include <swtable.hxx>
|
|
|
|
|
2011-03-25 15:51:54 +01:00
|
|
|
namespace editeng { class SvxBorderLine; }
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
class SwDoc;
|
|
|
|
class SwTableNode;
|
|
|
|
class _FndLine;
|
|
|
|
class _FndBox;
|
|
|
|
class SwTableLine;
|
|
|
|
class SwTableBox;
|
|
|
|
class SwTableBoxFmt;
|
|
|
|
class SwHistory;
|
|
|
|
class SwCntntNode;
|
|
|
|
class SfxPoolItem;
|
|
|
|
class SwShareBoxFmts;
|
|
|
|
class SwFmtFrmSize;
|
2012-04-25 15:39:10 +03:00
|
|
|
struct _CpyPara;
|
|
|
|
struct _InsULPara;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool lcl_BoxSetHeadCondColl( const SwTableBox*& rpBox, void* pPara );
|
|
|
|
sal_Bool lcl_LineSetHeadCondColl( const SwTableLine*& rpLine, void* pPara );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
|
2011-11-24 00:52:00 +01:00
|
|
|
#ifdef DBG_UTIL
|
2000-09-18 23:08:29 +00:00
|
|
|
void _CheckBoxWidth( const SwTableLine& rLine, SwTwips nSize );
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void _InsTblBox( SwDoc* pDoc, SwTableNode* pTblNd,
|
|
|
|
SwTableLine* pLine, SwTableBoxFmt* pBoxFrmFmt,
|
2011-01-17 15:06:54 +01:00
|
|
|
SwTableBox* pBox, sal_uInt16 nInsPos, sal_uInt16 nCnt = 1 );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2009-01-05 14:06:42 +00:00
|
|
|
SW_DLLPUBLIC void _DeleteBox( SwTable& rTbl, SwTableBox* pBox, SwUndo* pUndo = 0,
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool bCalcNewSize = sal_True, const sal_Bool bCorrBorder = sal_True,
|
2000-09-18 23:08:29 +00:00
|
|
|
SwShareBoxFmts* pShareFmts = 0 );
|
|
|
|
|
|
|
|
// Klasse fuers SplitTable
|
|
|
|
// sammelt von einer Line die Boxen aller obersten oder untersten Lines
|
|
|
|
// in einem Array. Zusaetzlich werden die Positionen vermerkt.
|
|
|
|
// ( die Implementierung steht im ndtbl.cxx)
|
|
|
|
|
|
|
|
class SwCollectTblLineBoxes
|
|
|
|
{
|
2011-09-19 23:18:28 +00:00
|
|
|
std::vector<sal_uInt16> aPosArr;
|
2012-05-05 10:25:52 +01:00
|
|
|
SwSelBoxes_SAR aBoxes;
|
2000-09-18 23:08:29 +00:00
|
|
|
SwHistory* pHst;
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 nMode, nWidth;
|
|
|
|
sal_Bool bGetFromTop : 1;
|
|
|
|
sal_Bool bGetValues : 1;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
public:
|
2011-01-17 15:06:54 +01:00
|
|
|
SwCollectTblLineBoxes( sal_Bool bTop, sal_uInt16 nMd = 0, SwHistory* pHist=0 )
|
2012-05-05 10:25:52 +01:00
|
|
|
: aBoxes( 16 ),
|
|
|
|
pHst( pHist ), nMode( nMd ), nWidth( 0 ),
|
|
|
|
bGetFromTop( bTop ), bGetValues( sal_True )
|
2007-09-27 07:59:01 +00:00
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
void AddBox( const SwTableBox& rBox );
|
|
|
|
const SwTableBox* GetBoxOfPos( const SwTableBox& rBox );
|
|
|
|
void AddToUndoHistory( const SwCntntNode& rNd );
|
|
|
|
|
2012-05-05 10:25:52 +01:00
|
|
|
sal_uInt16 Count() const { return aBoxes.Count(); }
|
2011-09-20 09:43:40 +02:00
|
|
|
const SwTableBox& GetBox( std::size_t nPos, sal_uInt16* pWidth = 0 ) const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
// hier wird die EndPos der Spalte benoetigt!
|
|
|
|
if( pWidth )
|
2011-09-20 09:43:40 +02:00
|
|
|
*pWidth = (nPos+1 == aPosArr.size()) ? nWidth
|
2000-09-18 23:08:29 +00:00
|
|
|
: aPosArr[ nPos+1 ];
|
|
|
|
return *aBoxes[ nPos ];
|
|
|
|
}
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool IsGetFromTop() const { return bGetFromTop; }
|
|
|
|
sal_Bool IsGetValues() const { return bGetValues; }
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 GetMode() const { return nMode; }
|
|
|
|
void SetValues( sal_Bool bFlag ) { bGetValues = sal_False; nWidth = 0;
|
2000-09-18 23:08:29 +00:00
|
|
|
bGetFromTop = bFlag; }
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool Resize( sal_uInt16 nOffset, sal_uInt16 nWidth );
|
2000-09-18 23:08:29 +00:00
|
|
|
};
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool lcl_Box_CollectBox( const SwTableBox*& rpBox, void* pPara );
|
|
|
|
sal_Bool lcl_Line_CollectBox( const SwTableLine*& rpLine, void* pPara );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool lcl_BoxSetSplitBoxFmts( const SwTableBox*& rpBox, void* pPara );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2007-11-02 13:41:29 +00:00
|
|
|
// This structure is needed by Undo to restore row span attributes
|
|
|
|
// when a table has been splitted into two tables
|
|
|
|
struct SwSaveRowSpan
|
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 mnSplitLine; // the line number where the table has been splitted
|
2007-11-02 13:41:29 +00:00
|
|
|
std::vector< long > mnRowSpans; // the row span attributes in this line
|
2011-01-17 15:06:54 +01:00
|
|
|
SwSaveRowSpan( SwTableBoxes& rBoxes, sal_uInt16 nSplitLn );
|
2007-11-02 13:41:29 +00:00
|
|
|
};
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
struct _SwGCLineBorder
|
|
|
|
{
|
|
|
|
const SwTableLines* pLines;
|
|
|
|
SwShareBoxFmts* pShareFmts;
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 nLinePos;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
_SwGCLineBorder( const SwTable& rTable )
|
2007-09-27 07:59:01 +00:00
|
|
|
: pLines( &rTable.GetTabLines() ), pShareFmts(0), nLinePos( 0 ) {}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
_SwGCLineBorder( const SwTableBox& rBox )
|
2007-09-27 07:59:01 +00:00
|
|
|
: pLines( &rBox.GetTabLines() ), pShareFmts(0), nLinePos( 0 ) {}
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool IsLastLine() const { return nLinePos + 1 >= pLines->Count(); }
|
2000-09-18 23:08:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class _SwGCBorder_BoxBrd
|
|
|
|
{
|
2011-03-25 15:51:54 +01:00
|
|
|
const editeng::SvxBorderLine* pBrdLn;
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool bAnyBorderFnd;
|
2000-09-18 23:08:29 +00:00
|
|
|
public:
|
2011-01-17 15:06:54 +01:00
|
|
|
_SwGCBorder_BoxBrd() : pBrdLn( 0 ), bAnyBorderFnd( sal_False ) {}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2011-03-25 15:51:54 +01:00
|
|
|
void SetBorder( const editeng::SvxBorderLine& rBorderLine )
|
2011-01-17 15:06:54 +01:00
|
|
|
{ pBrdLn = &rBorderLine; bAnyBorderFnd = sal_False; }
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
// checke, ob die linke Border dieselbe wie die gesetzte ist
|
2011-01-17 15:06:54 +01:00
|
|
|
// returnt sal_False falls gar keine Border gesetzt ist
|
|
|
|
sal_Bool CheckLeftBorderOfFormat( const SwFrmFmt& rFmt );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool IsAnyBorderFound() const { return bAnyBorderFnd; }
|
2000-09-18 23:08:29 +00:00
|
|
|
};
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool lcl_GC_Line_Border( const SwTableLine*& , void* pPara );
|
|
|
|
sal_Bool lcl_GC_Box_Border( const SwTableBox*& , void* pPara );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool lcl_GCBorder_ChkBoxBrd_L( const SwTableLine*& , void* pPara );
|
|
|
|
sal_Bool lcl_GCBorder_ChkBoxBrd_B( const SwTableBox*& , void* pPara );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool lcl_GCBorder_GetLastBox_L( const SwTableLine*& , void* pPara );
|
|
|
|
sal_Bool lcl_GCBorder_GetLastBox_B( const SwTableBox*& , void* pPara );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
class SwShareBoxFmt
|
|
|
|
{
|
|
|
|
const SwFrmFmt* pOldFmt;
|
|
|
|
SvPtrarr aNewFmts;
|
|
|
|
|
|
|
|
public:
|
|
|
|
SwShareBoxFmt( const SwFrmFmt& rFmt )
|
2012-01-21 15:21:16 +01:00
|
|
|
: pOldFmt( &rFmt ), aNewFmts( 1 )
|
2000-09-18 23:08:29 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
const SwFrmFmt& GetOldFormat() const { return *pOldFmt; }
|
|
|
|
|
|
|
|
SwFrmFmt* GetFormat( long nWidth ) const;
|
|
|
|
SwFrmFmt* GetFormat( const SfxPoolItem& rItem ) const;
|
|
|
|
void AddFormat( const SwFrmFmt& rFmt );
|
2011-01-17 15:06:54 +01:00
|
|
|
// returnt sal_True, wenn geloescht werden kann
|
|
|
|
sal_Bool RemoveFormat( const SwFrmFmt& rFmt );
|
2000-09-18 23:08:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-01-21 15:21:16 +01:00
|
|
|
SV_DECL_PTRARR_DEL( _SwShareBoxFmts, SwShareBoxFmt*, 8 )
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
class SwShareBoxFmts
|
|
|
|
{
|
|
|
|
_SwShareBoxFmts aShareArr;
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool Seek_Entry( const SwFrmFmt& rFmt, sal_uInt16* pPos ) const;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
void ChangeFrmFmt( SwTableBox* pBox, SwTableLine* pLn, SwFrmFmt& rFmt );
|
|
|
|
|
|
|
|
public:
|
|
|
|
SwShareBoxFmts() {}
|
|
|
|
~SwShareBoxFmts();
|
|
|
|
|
|
|
|
SwFrmFmt* GetFormat( const SwFrmFmt& rFmt, long nWidth ) const;
|
|
|
|
SwFrmFmt* GetFormat( const SwFrmFmt& rFmt, const SfxPoolItem& ) const;
|
|
|
|
|
|
|
|
void AddFormat( const SwFrmFmt& rOld, const SwFrmFmt& rNew );
|
|
|
|
|
|
|
|
void SetSize( SwTableBox& rBox, const SwFmtFrmSize& rSz );
|
|
|
|
void SetAttr( SwTableBox& rBox, const SfxPoolItem& rItem );
|
|
|
|
void SetAttr( SwTableLine& rLine, const SfxPoolItem& rItem );
|
|
|
|
|
|
|
|
void RemoveFormat( const SwFrmFmt& rFmt );
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
2010-10-14 08:30:41 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|