Coverage Report

Created: 2026-08-14 10:22

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/chart2/source/controller/dialogs/tp_PolarOptions.cxx
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
 * 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
20
#include "tp_PolarOptions.hxx"
21
#include <chartview/ChartSfxItemIds.hxx>
22
23
#include <svl/eitem.hxx>
24
#include <svx/sdangitm.hxx>
25
#include <tools/fldunit.hxx>
26
#include <officecfg/Office/Compatibility.hxx>
27
#include <vcl/weld/Builder.hxx>
28
#include <vcl/weld/CheckButton.hxx>
29
30
namespace chart
31
{
32
33
PolarOptionsTabPage::PolarOptionsTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs)
34
0
    : SfxTabPage(pPage, pController, u"modules/schart/ui/tp_PolarOptions.ui"_ustr, u"tp_PolarOptions"_ustr, &rInAttrs)
35
0
    , m_xCB_Clockwise(m_xBuilder->weld_check_button(u"CB_CLOCKWISE"_ustr))
36
0
    , m_xFL_StartingAngle(m_xBuilder->weld_frame(u"frameANGLE"_ustr))
37
0
    , m_xNF_StartingAngle(m_xBuilder->weld_metric_spin_button(u"NF_STARTING_ANGLE"_ustr, FieldUnit::DEGREE))
38
0
    , m_xFL_PlotOptions(m_xBuilder->weld_frame(u"framePLOT_OPTIONS"_ustr))
39
0
    , m_xCB_IncludeHiddenCells(m_xBuilder->weld_check_button(u"CB_INCLUDE_HIDDEN_CELLS_POLAR"_ustr))
40
0
    , m_xAngleDial(new svx::DialControl)
41
0
    , m_xAngleDialWin(new weld::CustomWeld(*m_xBuilder, u"CT_ANGLE_DIAL"_ustr, *m_xAngleDial))
42
0
{
43
0
    m_xAngleDial->SetLinkedField(m_xNF_StartingAngle.get());
44
0
}
45
46
PolarOptionsTabPage::~PolarOptionsTabPage()
47
0
{
48
0
    m_xAngleDialWin.reset();
49
0
    m_xAngleDial.reset();
50
0
}
51
52
std::unique_ptr<SfxTabPage> PolarOptionsTabPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rOutAttrs)
53
0
{
54
0
    return std::make_unique<PolarOptionsTabPage>(pPage, pController, *rOutAttrs);
55
0
}
56
57
bool PolarOptionsTabPage::FillItemSet( SfxItemSet* rOutAttrs )
58
0
{
59
0
    if (m_xAngleDialWin->get_visible())
60
0
    {
61
0
        rOutAttrs->Put(SdrAngleItem(SCHATTR_STARTING_ANGLE, m_xAngleDial->GetRotation()));
62
0
    }
63
64
0
    if( m_xCB_Clockwise->get_visible() )
65
0
        rOutAttrs->Put(SfxBoolItem(SCHATTR_CLOCKWISE,m_xCB_Clockwise->get_active()));
66
67
0
    if (m_xCB_IncludeHiddenCells->get_visible())
68
0
        rOutAttrs->Put(SfxBoolItem(SCHATTR_INCLUDE_HIDDEN_CELLS, m_xCB_IncludeHiddenCells->get_active()));
69
70
0
    return true;
71
0
}
72
73
void PolarOptionsTabPage::Reset(const SfxItemSet* rInAttrs)
74
0
{
75
0
    if (const SdrAngleItem* pAngleItem = rInAttrs->GetItemIfSet(SCHATTR_STARTING_ANGLE))
76
0
    {
77
0
        Degree100 nTmp = pAngleItem->GetValue();
78
0
        m_xAngleDial->SetRotation( nTmp );
79
0
    }
80
0
    else
81
0
    {
82
0
        m_xFL_StartingAngle->hide();
83
0
    }
84
    // tdf#108059 Hide clockwise orientation checkbox in OOXML-heavy environments it would be useless anyways
85
0
    const SfxBoolItem* pClockWiseItem = nullptr;
86
0
    if (!officecfg::Office::Compatibility::View::ClockwisePieChartDirection::get() &&
87
0
        (pClockWiseItem = rInAttrs->GetItemIfSet(SCHATTR_CLOCKWISE)))
88
0
    {
89
0
        bool bCheck = pClockWiseItem->GetValue();
90
0
        m_xCB_Clockwise->set_active(bCheck);
91
0
    }
92
0
    else
93
0
    {
94
0
        m_xCB_Clockwise->hide();
95
0
    }
96
0
    if (const SfxBoolItem* pHiddenCellsItem = rInAttrs->GetItemIfSet(SCHATTR_INCLUDE_HIDDEN_CELLS))
97
0
    {
98
0
        bool bVal = pHiddenCellsItem->GetValue();
99
0
        m_xCB_IncludeHiddenCells->set_active(bVal);
100
0
    }
101
0
    else
102
0
    {
103
0
        m_xFL_PlotOptions->hide();
104
0
    }
105
0
}
106
107
} //namespace chart
108
109
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */