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