LibreOffice Module sw (master)  1
tabcol.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_INC_TABCOL_HXX
20 #define INCLUDED_SW_INC_TABCOL_HXX
21 
22 #include <vector>
23 #include <memory>
24 
25 #include "swdllapi.h"
26 
28 {
29  long nPos;
30  long nMin;
31  long nMax;
32  bool bHidden; // For each entry a flag, hidden or not.
33  // If the flag bHidden is true column separator
34  // is not in current line. It must maintained
35  // but it may not be displayed.
36 };
37 
38 typedef std::vector< SwTabColsEntry > SwTabColsEntries;
39 
41 {
42  long m_nLeftMin; // Leftmost border (reference point) for
43  // document coordinates.
44  // All other values are relative to this point!
45  long m_nLeft; // Left border of table.
46  long m_nRight; // Right border of table.
47  long m_nRightMax; // Maximum right border of table.
48 
49  bool m_bLastRowAllowedToChange; // If the last row of the table frame
50  // is split across pages, it may not
51  // change its size.
52 
54 
55  //For the CopyCTor.
56  const SwTabColsEntries& GetData() const { return m_aData; }
57 
58 public:
59  SwTabCols( sal_uInt16 nSize = 0 );
60  SwTabCols( const SwTabCols& );
61  SwTabCols &operator=( const SwTabCols& );
62  long& operator[]( size_t nPos ) { return m_aData[nPos].nPos; }
63  long operator[]( size_t nPos ) const { return m_aData[nPos].nPos; }
64  size_t Count() const { return m_aData.size(); }
65 
66  bool IsHidden( size_t nPos ) const { return m_aData[nPos].bHidden; }
67  void SetHidden( size_t nPos, bool bValue ) { m_aData[nPos].bHidden = bValue; }
68 
69  void Insert( long nValue, bool bValue, size_t nPos );
70  void Insert( long nValue, long nMin, long nMax, bool bValue, size_t nPos );
71  void Remove( size_t nPos, size_t nCount = 1 );
72 
73  const SwTabColsEntry& GetEntry( size_t nPos ) const { return m_aData[nPos]; }
74  SwTabColsEntry& GetEntry( size_t nPos ) { return m_aData[nPos]; }
75 
76  long GetLeftMin() const { return m_nLeftMin; }
77  long GetLeft() const { return m_nLeft; }
78  long GetRight() const { return m_nRight; }
79  long GetRightMax()const { return m_nRightMax;}
80 
81  void SetLeftMin ( long nNew ) { m_nLeftMin = nNew; }
82  void SetLeft ( long nNew ) { m_nLeft = nNew; }
83  void SetRight ( long nNew ) { m_nRight = nNew; }
84  void SetRightMax( long nNew ) { m_nRightMax = nNew;}
85 
86  bool IsLastRowAllowedToChange() const { return m_bLastRowAllowedToChange; }
87  void SetLastRowAllowedToChange( bool bNew ) { m_bLastRowAllowedToChange = bNew; }
88 };
89 
90 class SwTable;
91 class SwTabFrame;
92 class SwFrame;
93 
94 struct SwColCache {
95  std::unique_ptr<SwTabCols> pLastCols;
96  SwTable const* pLastTable = nullptr;
97  SwTabFrame const* pLastTabFrame = nullptr;
98  SwFrame const* pLastCellFrame = nullptr;
99 };
100 
101 #endif // INCLUDED_SW_INC_TABCOL_HXX
102 
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Base class of the Writer layout elements.
Definition: frame.hxx:295
std::unique_ptr< SwTabCols > pLastCols
Definition: tabcol.hxx:95
const SwTabColsEntries & GetData() const
Definition: tabcol.hxx:56
long GetLeftMin() const
Definition: tabcol.hxx:76
SwTabFrame is one table in the document layout, containing rows (which contain cells).
Definition: tabfrm.hxx:30
long GetRightMax() const
Definition: tabcol.hxx:79
long m_nLeftMin
Definition: tabcol.hxx:42
const SwTabColsEntry & GetEntry(size_t nPos) const
Definition: tabcol.hxx:73
long GetRight() const
Definition: tabcol.hxx:78
long m_nLeft
Definition: tabcol.hxx:45
long operator[](size_t nPos) const
Definition: tabcol.hxx:63
bool IsLastRowAllowedToChange() const
Definition: tabcol.hxx:86
bool bHidden
Definition: tabcol.hxx:32
long m_nRight
Definition: tabcol.hxx:46
bool IsHidden(size_t nPos) const
Definition: tabcol.hxx:66
SwTabFrame const * pLastTabFrame
Definition: tabcol.hxx:97
void SetLeft(long nNew)
Definition: tabcol.hxx:82
SwTabColsEntry & GetEntry(size_t nPos)
Definition: tabcol.hxx:74
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
SwTable is one table in the document model, containing rows (which contain cells).
Definition: swtable.hxx:110
void SetRightMax(long nNew)
Definition: tabcol.hxx:84
std::vector< SwTabColsEntry > SwTabColsEntries
Definition: tabcol.hxx:38
bool m_bLastRowAllowedToChange
Definition: tabcol.hxx:49
void SetLastRowAllowedToChange(bool bNew)
Definition: tabcol.hxx:87
void SetLeftMin(long nNew)
Definition: tabcol.hxx:81
void SetHidden(size_t nPos, bool bValue)
Definition: tabcol.hxx:67
long m_nRightMax
Definition: tabcol.hxx:47
SwTable const * pLastTable
Definition: tabcol.hxx:96
SwTabColsEntries m_aData
Definition: tabcol.hxx:53
SwFrame const * pLastCellFrame
Definition: tabcol.hxx:98
void SetRight(long nNew)
Definition: tabcol.hxx:83
long & operator[](size_t nPos)
Definition: tabcol.hxx:62
long GetLeft() const
Definition: tabcol.hxx:77
size_t Count() const
Definition: tabcol.hxx:64