Coverage Report

Created: 2026-06-30 11:14

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sc/source/ui/operation/PivotTableOperation.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
10
#include <operation/PivotTableOperation.hxx>
11
12
#include <docsh.hxx>
13
#include <dpobject.hxx>
14
#include <dpshttab.hxx>
15
16
namespace sc
17
{
18
PivotTableOperation::PivotTableOperation(OperationType eType, ScDocShell& rDocShell, bool bRecord,
19
                                         bool bApi)
20
309
    : Operation(eType, bRecord, bApi)
21
309
    , mrDocShell(rDocShell)
22
309
{
23
309
}
24
25
void PivotTableOperation::convertDPObjectRanges(ScDPObject& rDPObject)
26
309
{
27
309
    rDPObject.SetOutRange(convertRange(rDPObject.GetOutRange()));
28
29
309
    const ScSheetSourceDesc* pSheetDesc = rDPObject.GetSheetDesc();
30
309
    if (pSheetDesc && !pSheetDesc->HasRangeName())
31
309
    {
32
309
        ScSheetSourceDesc aDesc(*pSheetDesc);
33
309
        aDesc.SetSourceRange(convertRange(aDesc.GetSourceRange()));
34
309
        rDPObject.SetSheetDesc(aDesc);
35
309
    }
36
309
}
37
38
ScDPObject* PivotTableOperation::findDefaultViewDPObject(ScDPObject const& rSheetViewObject)
39
0
{
40
0
    SCTAB nSheetViewTab = rSheetViewObject.GetOutRange().aStart.Tab();
41
0
    SCTAB nDefaultTab = convertTab(nSheetViewTab);
42
0
    if (nSheetViewTab == nDefaultTab)
43
0
        return const_cast<ScDPObject*>(&rSheetViewObject);
44
0
    ScDPCollection& rDPs = *mrDocShell.GetDocument().GetDPCollection();
45
0
    for (size_t i = 0; i < rDPs.GetCount(); ++i)
46
0
    {
47
0
        auto& rDPObject = rDPs[i];
48
0
        if (rDPObject.GetName() == rSheetViewObject.GetName()
49
0
            && rDPObject.GetOutRange().aStart.Tab() == nDefaultTab)
50
0
        {
51
0
            return &rDPObject;
52
0
        }
53
0
    }
54
0
    return nullptr;
55
0
}
56
}
57
58
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */