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 <memory>
24 #include <vector>
25 
26 #include <swtypes.hxx>
27 #include <swtable.hxx>
28 
29 namespace editeng { class SvxBorderLine; }
30 
31 class SwDoc;
32 class SwTableNode;
33 class SwTableBoxFormat;
34 class SwHistory;
35 class SwContentNode;
36 class SfxPoolItem;
37 class SwShareBoxFormats;
38 class SwFormatFrameSize;
39 
40 void sw_LineSetHeadCondColl( const SwTableLine* pLine );
41 
42 #ifdef DBG_UTIL
43 void CheckBoxWidth( const SwTableLine& rLine, SwTwips nSize );
44 #endif
45 
46 void InsTableBox( SwDoc* pDoc, SwTableNode* pTableNd,
47  SwTableLine* pLine, SwTableBoxFormat* pBoxFrameFormat,
48  SwTableBox* pBox, sal_uInt16 nInsPos, sal_uInt16 nCnt = 1 );
49 
50 void DeleteBox_( SwTable& rTable, SwTableBox* pBox, SwUndo* pUndo,
51  bool bCalcNewSize, const bool bCorrBorder,
52  SwShareBoxFormats* pShareFormats = nullptr );
53 
62 {
63  std::vector<sal_uInt16> aPosArr;
64  std::vector<SwTableBox*> m_Boxes;
67  sal_uInt16 nWidth;
68  bool bGetFromTop : 1;
69  bool bGetValues : 1;
70 
71 public:
73  :
74  pHst( pHist ), nMode( nMd ), nWidth( 0 ),
75  bGetFromTop( bTop ), bGetValues( true )
76 
77  {}
78 
79  void AddBox( const SwTableBox& rBox );
80  const SwTableBox* GetBoxOfPos( const SwTableBox& rBox );
81  void AddToUndoHistory( const SwContentNode& rNd );
82 
83  size_t Count() const { return m_Boxes.size(); }
84  const SwTableBox& GetBox( std::size_t nPos, sal_uInt16* pWidth = nullptr ) const
85  {
86  // We need the EndPos of the column here!
87  if( pWidth )
88  *pWidth = (nPos+1 == aPosArr.size()) ? nWidth
89  : aPosArr[ nPos+1 ];
90  return *m_Boxes[ nPos ];
91  }
92 
93  bool IsGetFromTop() const { return bGetFromTop; }
94  bool IsGetValues() const { return bGetValues; }
95 
97  void SetValues( bool bFlag ) { bGetValues = false; nWidth = 0;
98  bGetFromTop = bFlag; }
99  bool Resize( sal_uInt16 nOffset, sal_uInt16 nWidth );
100 };
101 
102 void sw_Box_CollectBox( const SwTableBox* pBox, SwCollectTableLineBoxes* pSplPara );
103 bool sw_Line_CollectBox( const SwTableLine*& rpLine, void* pPara );
104 
106 
112 {
113  sal_uInt16 const mnSplitLine; // the line number where the table has been split
114  std::vector< long > mnRowSpans; // the row span attributes in this line
115  SwSaveRowSpan( SwTableBoxes& rBoxes, sal_uInt16 nSplitLn );
116 };
117 
119 {
122  sal_uInt16 nLinePos;
123 
124  SwGCLineBorder( const SwTable& rTable )
125  : pLines( &rTable.GetTabLines() ), pShareFormats(nullptr), nLinePos( 0 ) {}
126 
127  SwGCLineBorder( const SwTableBox& rBox )
128  : pLines( &rBox.GetTabLines() ), pShareFormats(nullptr), nLinePos( 0 ) {}
129  bool IsLastLine() const { return nLinePos + 1 >= static_cast<sal_uInt16>(pLines->size()); }
130 };
131 
133 {
136 public:
137  SwGCBorder_BoxBrd() : pBrdLn( nullptr ), bAnyBorderFnd( false ) {}
138 
139  void SetBorder( const editeng::SvxBorderLine& rBorderLine )
140  { pBrdLn = &rBorderLine; bAnyBorderFnd = false; }
141 
146  bool CheckLeftBorderOfFormat( const SwFrameFormat& rFormat );
147 
148  bool IsAnyBorderFound() const { return bAnyBorderFnd; }
149 };
150 
151 void sw_GC_Line_Border( const SwTableLine* pLine, SwGCLineBorder* pGCPara );
152 
154 {
156  std::vector<SwFrameFormat*> aNewFormats;
157 
158 public:
159  SwShareBoxFormat( const SwFrameFormat& rFormat )
160  : pOldFormat( &rFormat )
161  {}
162 
163  const SwFrameFormat& GetOldFormat() const { return *pOldFormat; }
164 
165  SwFrameFormat* GetFormat( long nWidth ) const;
166  SwFrameFormat* GetFormat( const SfxPoolItem& rItem ) const;
167  void AddFormat( SwFrameFormat& rFormat );
169  bool RemoveFormat( const SwFrameFormat& rFormat );
170 };
171 
173 {
174  std::vector<std::unique_ptr<SwShareBoxFormat>> m_ShareArr;
175 
176  bool Seek_Entry( const SwFrameFormat& rFormat, sal_uInt16* pPos ) const;
177 
178  void ChangeFrameFormat( SwTableBox* pBox, SwTableLine* pLn, SwFrameFormat& rFormat );
179 
180 public:
183 
184  SwFrameFormat* GetFormat( const SwFrameFormat& rFormat, long nWidth ) const;
185  SwFrameFormat* GetFormat( const SwFrameFormat& rFormat, const SfxPoolItem& ) const;
186 
187  void AddFormat( const SwFrameFormat& rOld, SwFrameFormat& rNew );
188 
189  void SetSize( SwTableBox& rBox, const SwFormatFrameSize& rSz );
190  void SetAttr( SwTableBox& rBox, const SfxPoolItem& rItem );
191  void SetAttr( SwTableLine& rLine, const SfxPoolItem& rItem );
192 
193  void RemoveFormat( const SwFrameFormat& rFormat );
194 };
195 
196 #endif
197 
198 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void CheckBoxWidth(const SwTableLine &rLine, SwTwips nSize)
Definition: tblrwcl.cxx:2540
std::vector< SwTableBox * > m_Boxes
Definition: tblrwcl.hxx:64
SwSaveRowSpan(SwTableBoxes &rBoxes, sal_uInt16 nSplitLn)
void sw_GC_Line_Border(const SwTableLine *pLine, SwGCLineBorder *pGCPara)
Definition: gctable.cxx:163
std::vector< sal_uInt16 > aPosArr
Definition: tblrwcl.hxx:63
Definition: doc.hxx:185
bool IsGetFromTop() const
Definition: tblrwcl.hxx:93
SwTableLine is one table row in the document model.
Definition: swtable.hxx:344
sal_uInt16 nLinePos
Definition: tblrwcl.hxx:122
long SwTwips
Definition: swtypes.hxx:49
void sw_LineSetHeadCondColl(const SwTableLine *pLine)
Definition: tblrwcl.cxx:2305
void SetValues(bool bFlag)
Definition: tblrwcl.hxx:97
const SwTableLines * pLines
Definition: tblrwcl.hxx:120
size_type size() const
Definition: swtable.hxx:74
SwShareBoxFormats * pShareFormats
Definition: tblrwcl.hxx:121
void DeleteBox_(SwTable &rTable, SwTableBox *pBox, SwUndo *pUndo, bool bCalcNewSize, const bool bCorrBorder, SwShareBoxFormats *pShareFormats=nullptr)
Definition: tblrwcl.cxx:640
void AddFormat(SwFrameFormat &rFormat)
Definition: tblrwcl.cxx:3214
SwShareBoxFormat(const SwFrameFormat &rFormat)
Definition: tblrwcl.hxx:159
This structure is needed by Undo to restore row span attributes when a table has been split into two ...
Definition: tblrwcl.hxx:111
bool Seek_Entry(const SwFrameFormat &rFormat, sal_uInt16 *pPos) const
Definition: tblrwcl.cxx:3343
SwCollectTableLineBoxes(bool bTop, SplitTable_HeadlineOption nMd=SplitTable_HeadlineOption::NONE, SwHistory *pHist=nullptr)
Definition: tblrwcl.hxx:72
bool IsLastLine() const
Definition: tblrwcl.hxx:129
bool IsGetValues() const
Definition: tblrwcl.hxx:94
std::vector< long > mnRowSpans
Definition: tblrwcl.hxx:114
Class for SplitTable Collects the uppermost or lowermost Lines of a Box from a Line in an array...
Definition: tblrwcl.hxx:61
SwGCLineBorder(const SwTable &rTable)
Definition: tblrwcl.hxx:124
void SetSize(SwTableBox &rBox, const SwFormatFrameSize &rSz)
Definition: tblrwcl.cxx:3290
Style of a layout element.
Definition: frmfmt.hxx:57
void RemoveFormat(const SwFrameFormat &rFormat)
Definition: tblrwcl.cxx:3332
void sw_BoxSetSplitBoxFormats(SwTableBox *pBox, SwCollectTableLineBoxes *pSplPara)
Definition: ndtbl.cxx:2986
const SwTableBox & GetBox(std::size_t nPos, sal_uInt16 *pWidth=nullptr) const
Definition: tblrwcl.hxx:84
void AddFormat(const SwFrameFormat &rOld, SwFrameFormat &rNew)
Definition: tblrwcl.cxx:3251
void InsTableBox(SwDoc *pDoc, SwTableNode *pTableNd, SwTableLine *pLine, SwTableBoxFormat *pBoxFrameFormat, SwTableBox *pBox, sal_uInt16 nInsPos, sal_uInt16 nCnt=1)
Definition: swtable.cxx:157
SplitTable_HeadlineOption
Definition: tblenum.hxx:53
SwFrameFormat * GetFormat(long nWidth) const
Definition: tblrwcl.cxx:3184
void AddToUndoHistory(const SwContentNode &rNd)
Definition: ndtbl.cxx:2877
const SwFrameFormat * pOldFormat
Definition: tblrwcl.hxx:155
std::vector< std::unique_ptr< SwShareBoxFormat > > m_ShareArr
Definition: tblrwcl.hxx:174
SwTable is one table in the document model, containing rows (which contain cells).
Definition: swtable.hxx:110
std::vector< SwFrameFormat * > aNewFormats
Definition: tblrwcl.hxx:156
SwFrameFormat * GetFormat(const SwFrameFormat &rFormat, long nWidth) const
Definition: tblrwcl.cxx:3235
size_t Count() const
Definition: tblrwcl.hxx:83
std::vector< SwTableBox * > SwTableBoxes
Definition: swtable.hxx:103
const SwTableBox * GetBoxOfPos(const SwTableBox &rBox)
Definition: ndtbl.cxx:2891
void ChangeFrameFormat(SwTableBox *pBox, SwTableLine *pLn, SwFrameFormat &rFormat)
Definition: tblrwcl.cxx:3266
const SwFrameFormat & GetOldFormat() const
Definition: tblrwcl.hxx:163
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:386
void SetAttr(SwTableBox &rBox, const SfxPoolItem &rItem)
Definition: tblrwcl.cxx:3304
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:2917
const editeng::SvxBorderLine * pBrdLn
Definition: tblrwcl.hxx:134
sal_uInt16 const mnSplitLine
Definition: tblrwcl.hxx:113
bool RemoveFormat(const SwFrameFormat &rFormat)
Definition: tblrwcl.cxx:3219
void sw_Box_CollectBox(const SwTableBox *pBox, SwCollectTableLineBoxes *pSplPara)
Definition: ndtbl.cxx:2968
SwGCLineBorder(const SwTableBox &rBox)
Definition: tblrwcl.hxx:127
void AddBox(const SwTableBox &rBox)
Definition: ndtbl.cxx:2883
SplitTable_HeadlineOption const nMode
Definition: tblrwcl.hxx:66
bool IsAnyBorderFound() const
Definition: tblrwcl.hxx:148
void SetBorder(const editeng::SvxBorderLine &rBorderLine)
Definition: tblrwcl.hxx:139
bool sw_Line_CollectBox(const SwTableLine *&rpLine, void *pPara)
Definition: ndtbl.cxx:2956
SplitTable_HeadlineOption GetMode() const
Definition: tblrwcl.hxx:96