summaryrefslogtreecommitdiff
path: root/sw/source/uibase/table/tablepg.hxx
blob: 4aa1c6d3faf6aeb2fa6e2e7f97da32d1a1c9f8a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */
#pragma once

#include <sfx2/tabdlg.hxx>
#include <prcntfld.hxx>
#include <swtypes.hxx>
#include <svx/frmdirlbox.hxx>

class SwWrtShell;
class SwTableRep;
struct ImplSVEvent;

class SwFormatTablePage : public SfxTabPage
{
    SwTableRep*     pTableData;
    std::unique_ptr<SwTableRep> m_xOrigTableData;
    SwTwips         nSaveWidth;
    SwTwips         nMinTableWidth;
    bool            bModified;
    bool            bFull:1;
    bool            bHtmlMode : 1;

    std::unique_ptr<weld::Entry> m_xNameED;
    std::unique_ptr<weld::Label> m_xWidthFT;
    std::unique_ptr<SwPercentField> m_xWidthMF;
    std::unique_ptr<weld::CheckButton> m_xRelWidthCB;

    std::unique_ptr<weld::RadioButton> m_xFullBtn;
    std::unique_ptr<weld::RadioButton> m_xLeftBtn;
    std::unique_ptr<weld::RadioButton> m_xFromLeftBtn;
    std::unique_ptr<weld::RadioButton> m_xRightBtn;
    std::unique_ptr<weld::RadioButton> m_xCenterBtn;
    std::unique_ptr<weld::RadioButton> m_xFreeBtn;

    std::unique_ptr<weld::Label> m_xLeftFT;
    std::unique_ptr<SwPercentField> m_xLeftMF;
    std::unique_ptr<weld::Label> m_xRightFT;
    std::unique_ptr<SwPercentField> m_xRightMF;
    std::unique_ptr<weld::Label> m_xTopFT;
    std::unique_ptr<weld::MetricSpinButton> m_xTopMF;
    std::unique_ptr<weld::Label> m_xBottomFT;
    std::unique_ptr<weld::MetricSpinButton> m_xBottomMF;

    std::unique_ptr<svx::FrameDirectionListBox> m_xTextDirectionLB;
    std::unique_ptr<weld::Widget> m_xProperties;

    int m_nOrigWidthMin;
    int m_nOrigWidthMax;
    int m_nOrigLeftMin;
    int m_nOrigLeftMax;
    int m_nOrigRightMin;
    int m_nOrigRightMax;

    void        Init();
    void ModifyHdl(const weld::MetricSpinButton& rEdit, bool bAllowInconsistencies = false);

    DECL_LINK(AutoClickHdl, weld::Toggleable&, void);
    DECL_LINK(RelWidthClickHdl, weld::Toggleable&, void);
    void RightModify();
    DECL_LINK(ValueChangedHdl, weld::MetricSpinButton&, void);

public:
    SwFormatTablePage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet );
    static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet);
    virtual ~SwFormatTablePage() override;

    virtual bool        FillItemSet( SfxItemSet* rSet ) override;
    virtual void        Reset( const SfxItemSet* rSet ) override;
    virtual void        ActivatePage( const SfxItemSet& rSet ) override;
    virtual DeactivateRC   DeactivatePage( SfxItemSet* pSet ) override;
};

// TabPage Format/Table/Columns
#define MET_FIELDS 5 //Number of the used MetricFields

class SwTableColumnPage : public SfxTabPage
{
    SwTableRep*     m_pTableData;
    std::unique_ptr<SwTableRep> m_xOrigTableData;
    ImplSVEvent*    m_pSizeHdlEvent;
    SwTwips         m_nTableWidth;
    SwTwips         m_nMinWidth;
    sal_uInt16      m_nMetFields;
    sal_uInt16      m_nNoOfCols;
    sal_uInt16      m_nNoOfVisibleCols;
    // Remember the width, when switching to autoalign
    sal_uInt16      m_aValueTable[MET_FIELDS];// primary assignment of the MetricFields
    bool            m_bModified:1;
    bool            m_bModifyTable:1;
    bool            m_bPercentMode:1;

    SwPercentField  m_aFieldArr[MET_FIELDS];
    std::unique_ptr<weld::Label> m_aTextArr[MET_FIELDS];
    std::unique_ptr<weld::CheckButton> m_xModifyTableCB;
    std::unique_ptr<weld::CheckButton> m_xProportionalCB;
    std::unique_ptr<weld::Label> m_xSpaceFT;
    std::unique_ptr<weld::Label> m_xSpaceSFT;
    std::unique_ptr<weld::MetricSpinButton> m_xSpaceED;
    std::unique_ptr<weld::Button> m_xUpBtn;
    std::unique_ptr<weld::Button> m_xDownBtn;

    void        Init(bool bWeb);
    DECL_LINK(AutoClickHdl, weld::Button&, void);
    void        ModifyHdl(const weld::MetricSpinButton* pEdit);
    DECL_LINK(ValueChangedHdl, weld::MetricSpinButton&, void);
    DECL_LINK(ModeHdl, weld::Toggleable&, void);
    void        UpdateCols( sal_uInt16 nCurrentPos );
    SwTwips     GetVisibleWidth(sal_uInt16 nPos);
    void        SetVisibleWidth(sal_uInt16 nPos, SwTwips nNewWidth);
    DECL_LINK(SizeHdl, void*, void);

public:
    SwTableColumnPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
    static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet);
    virtual ~SwTableColumnPage() override;

    virtual bool        FillItemSet( SfxItemSet* rSet ) override;
    virtual void        Reset( const SfxItemSet* rSet ) override;
    virtual void        ActivatePage( const SfxItemSet& rSet ) override;
    virtual DeactivateRC   DeactivatePage( SfxItemSet* pSet ) override;

};

class SwTextFlowPage : public SfxTabPage
{
    SwWrtShell*     pShell;
    bool            bPageBreak;
    bool            bHtmlMode;

    std::unique_ptr<weld::CheckButton> m_xPgBrkCB;
    std::unique_ptr<weld::RadioButton> m_xPgBrkRB;
    std::unique_ptr<weld::RadioButton> m_xColBrkRB;
    std::unique_ptr<weld::RadioButton> m_xPgBrkBeforeRB;
    std::unique_ptr<weld::RadioButton> m_xPgBrkAfterRB;
    std::unique_ptr<weld::CheckButton> m_xPageCollCB;
    std::unique_ptr<weld::ComboBox> m_xPageCollLB;
    std::unique_ptr<weld::CheckButton> m_xPageNoCB;
    std::unique_ptr<weld::SpinButton> m_xPageNoNF;
    std::unique_ptr<weld::CheckButton> m_xSplitCB;
    std::unique_ptr<weld::CheckButton> m_xSplitRowCB;
    std::unique_ptr<weld::CheckButton> m_xKeepCB;
    std::unique_ptr<weld::CheckButton> m_xHeadLineCB;
    std::unique_ptr<weld::Widget> m_xRepeatHeaderCombo;
    std::unique_ptr<weld::SpinButton> m_xRepeatHeaderNF;
    std::unique_ptr<weld::ComboBox> m_xTextDirectionLB;
    std::unique_ptr<weld::ComboBox> m_xVertOrientLB;

    DECL_LINK(PageBreakHdl_Impl, weld::Toggleable&, void);
    DECL_LINK(ApplyCollClickHdl_Impl, weld::Toggleable&, void);
    DECL_LINK(PageBreakPosHdl_Impl, weld::Toggleable&, void);
    DECL_LINK(PageBreakTypeHdl_Impl, weld::Toggleable&, void);
    DECL_LINK(PageNoClickHdl_Impl, weld::Toggleable&, void);
    DECL_LINK(SplitHdl_Impl, weld::Toggleable&, void);
    DECL_LINK(HeadLineCBClickHdl, weld::Toggleable&, void);

public:
    SwTextFlowPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
    static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet);
    virtual ~SwTextFlowPage() override;
    virtual bool        FillItemSet( SfxItemSet* rSet ) override;
    virtual void        Reset( const SfxItemSet* rSet ) override;

    void                SetShell(SwWrtShell* pSh);

    void                DisablePageBreak();
};

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */