Coverage Report

Created: 2026-03-31 11:00

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sc/source/ui/inc/PivotLayoutDialog.hxx
Line
Count
Source
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
 */
10
11
#pragma once
12
13
#include "anyrefdg.hxx"
14
#include <dpobject.hxx>
15
#include "viewdata.hxx"
16
17
#include "PivotLayoutTreeList.hxx"
18
#include "PivotLayoutTreeListData.hxx"
19
#include "PivotLayoutTreeListLabel.hxx"
20
21
#include <vcl/weld/Builder.hxx>
22
23
class ScItemValue final
24
{
25
public:
26
    OUString maName;
27
    ScPivotFuncData maFunctionData;
28
    ScItemValue* mpOriginalItemValue;
29
30
    ScItemValue(OUString aName, SCCOL nColumn, PivotFunc nFunctionMask);
31
    ScItemValue(const ScItemValue* pInputItemValue);
32
33
    ~ScItemValue();
34
};
35
36
class ScPivotLayoutDialog : public ScAnyRefDlgController
37
{
38
public:
39
    ScDPObject maPivotTableObject;
40
41
    ScPivotLayoutTreeListBase* mpPreviouslyFocusedListBox;
42
43
private:
44
    ScViewData& mrViewData;
45
    ScDocument& mrDocument;
46
47
    bool        mbNewPivotTable;
48
49
    ScAddress::Details  maAddressDetails;
50
    bool                mbDialogLostFocus;
51
52
    formula::RefEdit* mpActiveEdit;
53
    std::unique_ptr<ScPivotLayoutTreeListLabel> mxListBoxField;
54
    std::unique_ptr<ScPivotLayoutTreeList> mxListBoxPage;
55
    std::unique_ptr<ScPivotLayoutTreeList> mxListBoxColumn;
56
    std::unique_ptr<ScPivotLayoutTreeList> mxListBoxRow;
57
    std::unique_ptr<ScPivotLayoutTreeListData>  mxListBoxData;
58
59
    std::unique_ptr<weld::CheckButton> mxCheckIgnoreEmptyRows;
60
    std::unique_ptr<weld::CheckButton> mxCheckTotalColumns;
61
    std::unique_ptr<weld::CheckButton> mxCheckAddFilter;
62
    std::unique_ptr<weld::CheckButton> mxCheckIdentifyCategories;
63
    std::unique_ptr<weld::CheckButton> mxCheckTotalRows;
64
    std::unique_ptr<weld::CheckButton> mxCheckDrillToDetail;
65
    std::unique_ptr<weld::CheckButton> mxCheckExpandCollapse;
66
67
    std::unique_ptr<weld::RadioButton> mxSourceRadioNamedRange;
68
    std::unique_ptr<weld::RadioButton> mxSourceRadioSelection;
69
70
    std::unique_ptr<weld::ComboBox> mxSourceListBox;
71
    std::unique_ptr<formula::RefEdit> mxSourceEdit;
72
    std::unique_ptr<formula::RefButton> mxSourceButton;
73
74
    std::unique_ptr<weld::RadioButton> mxDestinationRadioNewSheet;
75
    std::unique_ptr<weld::RadioButton> mxDestinationRadioNamedRange;
76
    std::unique_ptr<weld::RadioButton> mxDestinationRadioSelection;
77
78
    std::unique_ptr<weld::ComboBox> mxDestinationListBox;
79
    std::unique_ptr<formula::RefEdit> mxDestinationEdit;
80
    std::unique_ptr<formula::RefButton> mxDestinationButton;
81
82
    std::unique_ptr<weld::Button> mxBtnOK;
83
    std::unique_ptr<weld::Button> mxBtnCancel;
84
85
    std::unique_ptr<weld::Frame> mxSourceFrame;
86
    std::unique_ptr<weld::Frame> mxDestFrame;
87
88
    std::unique_ptr<weld::Expander> mxOptions;
89
    std::unique_ptr<weld::Expander> mxMore;
90
91
    DECL_LINK(CancelClicked, weld::Button&, void);
92
    DECL_LINK(OKClicked, weld::Button&, void);
93
    DECL_LINK(GetEditFocusHandler, formula::RefEdit&, void);
94
    DECL_LINK(GetButtonFocusHandler, formula::RefButton&, void);
95
    DECL_LINK(LoseEditFocusHandler, formula::RefEdit&, void);
96
    DECL_LINK(LoseButtonFocusHandler, formula::RefButton&, void);
97
    DECL_LINK(ToggleSource, weld::Toggleable&, void);
98
    DECL_LINK(ToggleDestination, weld::Toggleable&, void);
99
    DECL_LINK(SourceListSelected, weld::ComboBox&, void);
100
    DECL_LINK(SourceEditModified, formula::RefEdit&, void);
101
    DECL_LINK(UpdateCheckExpandCollapse, weld::Toggleable&, void);
102
    void ToggleSource();
103
    void ToggleDestination();
104
    virtual void Close() override;
105
106
    ScPivotParam maPivotParameters;
107
108
    // UI
109
    void SetupSource();
110
    void SetupDestination();
111
    void FillValuesToListBoxes();
112
113
    // Other
114
    bool GetDestination(ScRange& aDestinationRange, bool& bToNewSheet);
115
116
public:
117
    ScPivotLayoutDialog(SfxBindings* pSfxBindings, SfxChildWindow* pChildWindow, weld::Window* pParent,
118
                             ScViewData& rViewData, const ScDPObject* pPivotTableObject, bool bCreateNewPivotTable);
119
    virtual ~ScPivotLayoutDialog() override;
120
121
    virtual void SetReference(const ScRange& rReferenceRange, ScDocument& rDocument) override;
122
    virtual void SetActive() override;
123
    virtual bool IsRefInputMode() const override;
124
125
    void ItemInserted(const ScItemValue* pItemValue, ScPivotLayoutTreeList::SvPivotTreeListType eType);
126
127
    void UpdateSourceRange();
128
129
    void ApplyChanges();
130
    void ApplySaveData(ScDPSaveData& rSaveData);
131
    void ApplyLabelData(const ScDPSaveData& rSaveData);
132
133
    ScItemValue* GetItem(SCCOL nColumn);
134
    bool IsDataElement(SCCOL nColumn);
135
    bool IsCalculatedElement(SCCOL nColumn);
136
137
    ScDPLabelData& GetLabelData(SCCOL nColumn);
138
0
    ScDPLabelDataVector& GetLabelDataVector() { return maPivotParameters.maLabelArray;}
139
    void PushDataFieldNames(std::vector<ScDPName>& rDataFieldNames);
140
};
141
142
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
143