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 
28 namespace editeng { class SvxBorderLine; }
29 
30 class SwDoc;
31 class SwTableNode;
32 class SwTableBoxFormat;
33 class SwHistory;
34 class SwContentNode;
35 class SfxPoolItem;
36 class SwShareBoxFormats;
37 class SwFormatFrameSize;
38 
39 void sw_LineSetHeadCondColl( const SwTableLine* pLine );
40 
41 #ifdef DBG_UTIL
42 void CheckBoxWidth( const SwTableLine& rLine, SwTwips nSize );
43 #endif
44 
45 void InsTableBox( SwDoc& rDoc, SwTableNode* pTableNd,
46  SwTableLine* pLine, SwTableBoxFormat* pBoxFrameFormat,
47  SwTableBox* pBox, sal_uInt16 nInsPos, sal_uInt16 nCnt = 1 );
48 
49 void 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 
70 public:
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 
101 void sw_Box_CollectBox( const SwTableBox* pBox, SwCollectTableLineBoxes* pSplPara );
102 bool 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 
126  SwGCLineBorder( const SwTableBox& rBox )
127  : pLines( &rBox.GetTabLines() ), pShareFormats(nullptr), nLinePos( 0 ) {}
128  bool IsLastLine() const { return nLinePos + 1 >= o3tl::narrowing<sal_uInt16>(pLines->size()); }
129 };
130 
132 {
135 public:
136  SwGCBorder_BoxBrd() : m_pBorderLine( nullptr ), m_bAnyBorderFind( false ) {}
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 
150 void sw_GC_Line_Border( const SwTableLine* pLine, SwGCLineBorder* pGCPara );
151 
153 {
155  std::vector<SwFrameFormat*> m_aNewFormats;
156 
157 public:
158  SwShareBoxFormat( const SwFrameFormat& rFormat )
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 
179 public:
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: */
void CheckBoxWidth(const SwTableLine &rLine, SwTwips nSize)
Definition: tblrwcl.cxx:2585
std::vector< SwTableBox * > m_Boxes
Definition: tblrwcl.hxx:63
SwSaveRowSpan(SwTableBoxes &rBoxes, sal_uInt16 nSplitLn)
void sw_GC_Line_Border(const SwTableLine *pLine, SwGCLineBorder *pGCPara)
Definition: gctable.cxx:166
long Long
SwFrameFormat * GetFormat(tools::Long nWidth) const
Definition: tblrwcl.cxx:3193
Definition: doc.hxx:187
bool IsGetFromTop() const
Definition: tblrwcl.hxx:92
SwTableLine is one table row in the document model.
Definition: swtable.hxx:357
sal_uInt16 nLinePos
Definition: tblrwcl.hxx:121
SwFrameFormat * GetFormat(const SwFrameFormat &rFormat, tools::Long nWidth) const
Definition: tblrwcl.cxx:3244
std::vector< SwFrameFormat * > m_aNewFormats
Definition: tblrwcl.hxx:155
void sw_LineSetHeadCondColl(const SwTableLine *pLine)
Definition: tblrwcl.cxx:2347
void SetValues(bool bFlag)
Definition: tblrwcl.hxx:96
const SwTableLines * pLines
Definition: tblrwcl.hxx:119
size_type size() const
Definition: swtable.hxx:76
SwShareBoxFormats * pShareFormats
Definition: tblrwcl.hxx:120
sal_uInt16 mnSplitLine
Definition: tblrwcl.hxx:112
std::vector< tools::Long > mnRowSpans
Definition: tblrwcl.hxx:113
void DeleteBox_(SwTable &rTable, SwTableBox *pBox, SwUndo *pUndo, bool bCalcNewSize, const bool bCorrBorder, SwShareBoxFormats *pShareFormats=nullptr)
Definition: tblrwcl.cxx:670
void AddFormat(SwFrameFormat &rFormat)
Definition: tblrwcl.cxx:3223
SwShareBoxFormat(const SwFrameFormat &rFormat)
Definition: tblrwcl.hxx:158
This structure is needed by Undo to restore row span attributes when a table has been split into two ...
Definition: tblrwcl.hxx:110
bool Seek_Entry(const SwFrameFormat &rFormat, sal_uInt16 *pPos) const
Definition: tblrwcl.cxx:3350
SwCollectTableLineBoxes(bool bTop, SplitTable_HeadlineOption nMd=SplitTable_HeadlineOption::NONE, SwHistory *pHist=nullptr)
Definition: tblrwcl.hxx:71
bool IsLastLine() const
Definition: tblrwcl.hxx:128
bool IsGetValues() const
Definition: tblrwcl.hxx:93
Class for SplitTable Collects the uppermost or lowermost Lines of a Box from a Line in an array...
Definition: tblrwcl.hxx:60
void InsTableBox(SwDoc &rDoc, SwTableNode *pTableNd, SwTableLine *pLine, SwTableBoxFormat *pBoxFrameFormat, SwTableBox *pBox, sal_uInt16 nInsPos, sal_uInt16 nCnt=1)
Definition: swtable.cxx:132
SplitTable_HeadlineOption m_nMode
Definition: tblrwcl.hxx:65
SwGCLineBorder(const SwTable &rTable)
Definition: tblrwcl.hxx:123
void SetSize(SwTableBox &rBox, const SwFormatFrameSize &rSz)
Definition: tblrwcl.cxx:3297
Style of a layout element.
Definition: frmfmt.hxx:59
void RemoveFormat(const SwFrameFormat &rFormat)
Definition: tblrwcl.cxx:3339
std::vector< SwShareBoxFormat > m_ShareArr
Definition: tblrwcl.hxx:173
void sw_BoxSetSplitBoxFormats(SwTableBox *pBox, SwCollectTableLineBoxes *pSplPara)
Definition: ndtbl.cxx:3019
const SwTableBox & GetBox(std::size_t nPos, sal_uInt16 *pWidth=nullptr) const
Definition: tblrwcl.hxx:83
void AddFormat(const SwFrameFormat &rOld, SwFrameFormat &rNew)
Definition: tblrwcl.cxx:3260
SplitTable_HeadlineOption
Definition: tblenum.hxx:54
void AddToUndoHistory(const SwContentNode &rNd)
Definition: ndtbl.cxx:2910
tools::Long SwTwips
Definition: swtypes.hxx:51
SwTable is one table in the document model, containing rows (which contain cells).
Definition: swtable.hxx:112
size_t Count() const
Definition: tblrwcl.hxx:82
std::vector< SwTableBox * > SwTableBoxes
Definition: swtable.hxx:105
const SwTableBox * GetBoxOfPos(const SwTableBox &rBox)
Definition: ndtbl.cxx:2924
std::vector< sal_uInt16 > m_aPositionArr
Definition: tblrwcl.hxx:62
SwHistory * m_pHistory
Definition: tblrwcl.hxx:64
void ChangeFrameFormat(SwTableBox *pBox, SwTableLine *pLn, SwFrameFormat &rFormat)
Definition: tblrwcl.cxx:3273
const SwFrameFormat & GetOldFormat() const
Definition: tblrwcl.hxx:162
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:418
void SetAttr(SwTableBox &rBox, const SfxPoolItem &rItem)
Definition: tblrwcl.cxx:3311
bool CheckLeftBorderOfFormat(const SwFrameFormat &rFormat)
Check whether the left Border is the same as the set one.
Definition: gctable.cxx:34
bool Resize(sal_uInt16 nOffset, sal_uInt16 nWidth)
Definition: ndtbl.cxx:2950
const editeng::SvxBorderLine * m_pBorderLine
Definition: tblrwcl.hxx:133
bool RemoveFormat(const SwFrameFormat &rFormat)
Definition: tblrwcl.cxx:3228
void sw_Box_CollectBox(const SwTableBox *pBox, SwCollectTableLineBoxes *pSplPara)
Definition: ndtbl.cxx:3001
SwGCLineBorder(const SwTableBox &rBox)
Definition: tblrwcl.hxx:126
void AddBox(const SwTableBox &rBox)
Definition: ndtbl.cxx:2916
bool IsAnyBorderFound() const
Definition: tblrwcl.hxx:147
void SetBorder(const editeng::SvxBorderLine &rBorderLine)
Definition: tblrwcl.hxx:138
bool m_bDetectedRangeSegmentation false
bool sw_Line_CollectBox(const SwTableLine *&rpLine, void *pPara)
Definition: ndtbl.cxx:2989
SplitTable_HeadlineOption GetMode() const
Definition: tblrwcl.hxx:95
const SwFrameFormat * m_pOldFormat
Definition: tblrwcl.hxx:154