LibreOffice Module sw (master) 1
tblrwcl.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19#ifndef INCLUDED_SW_SOURCE_CORE_INC_TBLRWCL_HXX
20#define INCLUDED_SW_SOURCE_CORE_INC_TBLRWCL_HXX
21
22#include <cstddef>
23#include <vector>
24
25#include <swtypes.hxx>
26#include <swtable.hxx>
27
28namespace editeng { class SvxBorderLine; }
29
30class SwDoc;
31class SwTableNode;
33class SwHistory;
34class SwContentNode;
35class SfxPoolItem;
38
39void sw_LineSetHeadCondColl( const SwTableLine* pLine );
40
41#ifdef DBG_UTIL
42void CheckBoxWidth( const SwTableLine& rLine, SwTwips nSize );
43#endif
44
45void InsTableBox( SwDoc& rDoc, SwTableNode* pTableNd,
46 SwTableLine* pLine, SwTableBoxFormat* pBoxFrameFormat,
47 SwTableBox* pBox, sal_uInt16 nInsPos, sal_uInt16 nCnt = 1 );
48
49void DeleteBox_( SwTable& rTable, SwTableBox* pBox, SwUndo* pUndo,
50 bool bCalcNewSize, const bool bCorrBorder,
51 SwShareBoxFormats* pShareFormats = nullptr );
52
61{
62 std::vector<sal_uInt16> m_aPositionArr;
63 std::vector<SwTableBox*> m_Boxes;
66 sal_uInt16 m_nWidth;
67 bool m_bGetFromTop : 1;
68 bool m_bGetValues : 1;
69
70public:
72 :
73 m_pHistory( pHist ), m_nMode( nMd ), m_nWidth( 0 ),
74 m_bGetFromTop( bTop ), m_bGetValues( true )
75
76 {}
77
78 void AddBox( const SwTableBox& rBox );
79 const SwTableBox* GetBoxOfPos( const SwTableBox& rBox );
80 void AddToUndoHistory( const SwContentNode& rNd );
81
82 size_t Count() const { return m_Boxes.size(); }
83 const SwTableBox& GetBox( std::size_t nPos, sal_uInt16* pWidth = nullptr ) const
84 {
85 // We need the EndPos of the column here!
86 if( pWidth )
87 *pWidth = (nPos+1 == m_aPositionArr.size()) ? m_nWidth
88 : m_aPositionArr[ nPos+1 ];
89 return *m_Boxes[ nPos ];
90 }
91
92 bool IsGetFromTop() const { return m_bGetFromTop; }
93 bool IsGetValues() const { return m_bGetValues; }
94
96 void SetValues( bool bFlag ) { m_bGetValues = false; m_nWidth = 0;
97 m_bGetFromTop = bFlag; }
98 bool Resize( sal_uInt16 nOffset, sal_uInt16 nWidth );
99};
100
101void sw_Box_CollectBox( const SwTableBox* pBox, SwCollectTableLineBoxes* pSplPara );
102bool sw_Line_CollectBox( const SwTableLine*& rpLine, void* pPara );
103
105
111{
112 sal_uInt16 mnSplitLine; // the line number where the table has been split
113 std::vector< tools::Long > mnRowSpans; // the row span attributes in this line
114 SwSaveRowSpan( SwTableBoxes& rBoxes, sal_uInt16 nSplitLn );
115};
116
118{
121 sal_uInt16 nLinePos;
122
123 SwGCLineBorder( const SwTable& rTable )
124 : pLines( &rTable.GetTabLines() ), pShareFormats(nullptr), nLinePos( 0 ) {}
125
127 : pLines( &rBox.GetTabLines() ), pShareFormats(nullptr), nLinePos( 0 ) {}
128 bool IsLastLine() const { return nLinePos + 1 >= o3tl::narrowing<sal_uInt16>(pLines->size()); }
129};
130
132{
135public:
137
138 void SetBorder( const editeng::SvxBorderLine& rBorderLine )
139 { m_pBorderLine = &rBorderLine; m_bAnyBorderFind = false; }
140
145 bool CheckLeftBorderOfFormat( const SwFrameFormat& rFormat );
146
147 bool IsAnyBorderFound() const { return m_bAnyBorderFind; }
148};
149
150void sw_GC_Line_Border( const SwTableLine* pLine, SwGCLineBorder* pGCPara );
151
153{
155 std::vector<SwFrameFormat*> m_aNewFormats;
156
157public:
159 : m_pOldFormat( &rFormat )
160 {}
161
162 const SwFrameFormat& GetOldFormat() const { return *m_pOldFormat; }
163
164 SwFrameFormat* GetFormat( tools::Long nWidth ) const;
165 SwFrameFormat* GetFormat( const SfxPoolItem& rItem ) const;
166 void AddFormat( SwFrameFormat& rFormat );
168 bool RemoveFormat( const SwFrameFormat& rFormat );
169};
170
172{
173 std::vector<SwShareBoxFormat> m_ShareArr;
174
175 bool Seek_Entry( const SwFrameFormat& rFormat, sal_uInt16* pPos ) const;
176
177 void ChangeFrameFormat( SwTableBox* pBox, SwTableLine* pLn, SwFrameFormat& rFormat );
178
179public:
182
183 SwFrameFormat* GetFormat( const SwFrameFormat& rFormat, tools::Long nWidth ) const;
184 SwFrameFormat* GetFormat( const SwFrameFormat& rFormat, const SfxPoolItem& ) const;
185
186 void AddFormat( const SwFrameFormat& rOld, SwFrameFormat& rNew );
187
188 void SetSize( SwTableBox& rBox, const SwFormatFrameSize& rSz );
189 void SetAttr( SwTableBox& rBox, const SfxPoolItem& rItem );
190 void SetAttr( SwTableLine& rLine, const SfxPoolItem& rItem );
191
192 void RemoveFormat( const SwFrameFormat& rFormat );
193};
194
195#endif
196
197/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Class for SplitTable Collects the uppermost or lowermost Lines of a Box from a Line in an array.
Definition: tblrwcl.hxx:61
SplitTable_HeadlineOption GetMode() const
Definition: tblrwcl.hxx:95
void AddBox(const SwTableBox &rBox)
Definition: ndtbl.cxx:2929
bool Resize(sal_uInt16 nOffset, sal_uInt16 nWidth)
Definition: ndtbl.cxx:2963
std::vector< SwTableBox * > m_Boxes
Definition: tblrwcl.hxx:63
SwCollectTableLineBoxes(bool bTop, SplitTable_HeadlineOption nMd=SplitTable_HeadlineOption::NONE, SwHistory *pHist=nullptr)
Definition: tblrwcl.hxx:71
SwHistory * m_pHistory
Definition: tblrwcl.hxx:64
bool IsGetValues() const
Definition: tblrwcl.hxx:93
bool IsGetFromTop() const
Definition: tblrwcl.hxx:92
std::vector< sal_uInt16 > m_aPositionArr
Definition: tblrwcl.hxx:62
void SetValues(bool bFlag)
Definition: tblrwcl.hxx:96
const SwTableBox & GetBox(std::size_t nPos, sal_uInt16 *pWidth=nullptr) const
Definition: tblrwcl.hxx:83
size_t Count() const
Definition: tblrwcl.hxx:82
void AddToUndoHistory(const SwContentNode &rNd)
Definition: ndtbl.cxx:2923
SplitTable_HeadlineOption m_nMode
Definition: tblrwcl.hxx:65
const SwTableBox * GetBoxOfPos(const SwTableBox &rBox)
Definition: ndtbl.cxx:2937
Definition: doc.hxx:192
Style of a layout element.
Definition: frmfmt.hxx:62
bool CheckLeftBorderOfFormat(const SwFrameFormat &rFormat)
Check whether the left Border is the same as the set one.
Definition: gctable.cxx:34
bool IsAnyBorderFound() const
Definition: tblrwcl.hxx:147
const editeng::SvxBorderLine * m_pBorderLine
Definition: tblrwcl.hxx:133
void SetBorder(const editeng::SvxBorderLine &rBorderLine)
Definition: tblrwcl.hxx:138
SwFrameFormat * GetFormat(tools::Long nWidth) const
Definition: tblrwcl.cxx:3192
const SwFrameFormat * m_pOldFormat
Definition: tblrwcl.hxx:154
bool RemoveFormat(const SwFrameFormat &rFormat)
Definition: tblrwcl.cxx:3227
SwShareBoxFormat(const SwFrameFormat &rFormat)
Definition: tblrwcl.hxx:158
const SwFrameFormat & GetOldFormat() const
Definition: tblrwcl.hxx:162
void AddFormat(SwFrameFormat &rFormat)
Definition: tblrwcl.cxx:3222
std::vector< SwFrameFormat * > m_aNewFormats
Definition: tblrwcl.hxx:155
std::vector< SwShareBoxFormat > m_ShareArr
Definition: tblrwcl.hxx:173
SwFrameFormat * GetFormat(const SwFrameFormat &rFormat, tools::Long nWidth) const
Definition: tblrwcl.cxx:3243
void RemoveFormat(const SwFrameFormat &rFormat)
Definition: tblrwcl.cxx:3338
void ChangeFrameFormat(SwTableBox *pBox, SwTableLine *pLn, SwFrameFormat &rFormat)
Definition: tblrwcl.cxx:3272
bool Seek_Entry(const SwFrameFormat &rFormat, sal_uInt16 *pPos) const
Definition: tblrwcl.cxx:3349
void SetAttr(SwTableBox &rBox, const SfxPoolItem &rItem)
Definition: tblrwcl.cxx:3310
void SetSize(SwTableBox &rBox, const SwFormatFrameSize &rSz)
Definition: tblrwcl.cxx:3296
void AddFormat(const SwFrameFormat &rOld, SwFrameFormat &rNew)
Definition: tblrwcl.cxx:3259
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:419
SwTableLine is one table row in the document model.
Definition: swtable.hxx:358
size_type size() const
Definition: swtable.hxx:76
SwTable is one table in the document model, containing rows (which contain cells).
Definition: swtable.hxx:113
sal_uInt16 nPos
long Long
bool IsLastLine() const
Definition: tblrwcl.hxx:128
const SwTableLines * pLines
Definition: tblrwcl.hxx:119
SwGCLineBorder(const SwTableBox &rBox)
Definition: tblrwcl.hxx:126
SwGCLineBorder(const SwTable &rTable)
Definition: tblrwcl.hxx:123
SwShareBoxFormats * pShareFormats
Definition: tblrwcl.hxx:120
sal_uInt16 nLinePos
Definition: tblrwcl.hxx:121
This structure is needed by Undo to restore row span attributes when a table has been split into two ...
Definition: tblrwcl.hxx:111
sal_uInt16 mnSplitLine
Definition: tblrwcl.hxx:112
SwSaveRowSpan(SwTableBoxes &rBoxes, sal_uInt16 nSplitLn)
std::vector< tools::Long > mnRowSpans
Definition: tblrwcl.hxx:113
std::vector< SwTableBox * > SwTableBoxes
Definition: swtable.hxx:105
tools::Long SwTwips
Definition: swtypes.hxx:51
SplitTable_HeadlineOption
Definition: tblenum.hxx:55
void InsTableBox(SwDoc &rDoc, SwTableNode *pTableNd, SwTableLine *pLine, SwTableBoxFormat *pBoxFrameFormat, SwTableBox *pBox, sal_uInt16 nInsPos, sal_uInt16 nCnt=1)
Definition: swtable.cxx:127
void sw_GC_Line_Border(const SwTableLine *pLine, SwGCLineBorder *pGCPara)
Definition: gctable.cxx:166
void CheckBoxWidth(const SwTableLine &rLine, SwTwips nSize)
Definition: tblrwcl.cxx:2584
void sw_LineSetHeadCondColl(const SwTableLine *pLine)
Definition: tblrwcl.cxx:2346
bool sw_Line_CollectBox(const SwTableLine *&rpLine, void *pPara)
Definition: ndtbl.cxx:3002
void sw_Box_CollectBox(const SwTableBox *pBox, SwCollectTableLineBoxes *pSplPara)
Definition: ndtbl.cxx:3014
void DeleteBox_(SwTable &rTable, SwTableBox *pBox, SwUndo *pUndo, bool bCalcNewSize, const bool bCorrBorder, SwShareBoxFormats *pShareFormats=nullptr)
Definition: tblrwcl.cxx:669
void sw_BoxSetSplitBoxFormats(SwTableBox *pBox, SwCollectTableLineBoxes *pSplPara)
Definition: ndtbl.cxx:3032