Coverage Report

Created: 2026-05-16 09:25

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sc/inc/cellformtmpl.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
 * 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 "cellform.hxx"
21
22
#include <svl/numformat.hxx>
23
#include <svl/sharedstring.hxx>
24
#include <svl/sharedstringpool.hxx>
25
26
#include "formulacell.hxx"
27
#include "document.hxx"
28
#include "cellvalue.hxx"
29
#include <formula/errorcodes.hxx>
30
#include "editutil.hxx"
31
32
template <typename TFunctor>
33
auto ScCellFormat::visitInputSharedString(const ScRefCellValue& rCell, sal_uInt32 nFormat,
34
                                          ScInterpreterContext* pContext, const ScDocument& rDoc,
35
                                          svl::SharedStringPool& rStrPool, bool bFiltering,
36
                                          bool bForceSystemLocale, const TFunctor& rOper)
37
587
{
38
587
    ScInterpreterContext& rContext = pContext ? *pContext : rDoc.GetNonThreadedContext();
39
40
587
    switch (rCell.getType())
41
587
    {
42
0
        case CELLTYPE_STRING:
43
0
        case CELLTYPE_EDIT:
44
0
            return rOper(rCell.getSharedString(rDoc, rStrPool));
45
18
        case CELLTYPE_VALUE:
46
18
            return rOper(rStrPool.intern(rContext.NFGetInputLineString(
47
18
                rCell.getDouble(), nFormat, bFiltering, bForceSystemLocale)));
48
0
            break;
49
569
        case CELLTYPE_FORMULA:
50
569
        {
51
569
            ScFormulaCell* pFC = rCell.getFormula();
52
569
            const FormulaError nErrCode = pFC->GetErrCode();
53
569
            if (nErrCode != FormulaError::NONE)
54
0
                return rOper(svl::SharedString::getEmptyString());
55
569
            else if (pFC->IsEmptyDisplayedAsString())
56
0
                return rOper(svl::SharedString::getEmptyString());
57
569
            else if (pFC->IsValue())
58
0
                return rOper(rStrPool.intern(rContext.NFGetInputLineString(
59
0
                    pFC->GetValue(), nFormat, bFiltering, bForceSystemLocale)));
60
569
            else
61
569
                return rOper(pFC->GetString());
62
569
        }
63
0
        case CELLTYPE_NONE:
64
0
        default:
65
0
            return rOper(svl::SharedString::getEmptyString());
66
587
    }
67
587
}
queryevaluator.cxx:auto ScCellFormat::visitInputSharedString<ScQueryEvaluator::getCellSharedString(ScRefCellValue const&, int, short)::$_0>(ScRefCellValue const&, unsigned int, ScInterpreterContext*, ScDocument const&, svl::SharedStringPool&, bool, bool, ScQueryEvaluator::getCellSharedString(ScRefCellValue const&, int, short)::$_0 const&)
Line
Count
Source
37
2
{
38
2
    ScInterpreterContext& rContext = pContext ? *pContext : rDoc.GetNonThreadedContext();
39
40
2
    switch (rCell.getType())
41
2
    {
42
0
        case CELLTYPE_STRING:
43
0
        case CELLTYPE_EDIT:
44
0
            return rOper(rCell.getSharedString(rDoc, rStrPool));
45
2
        case CELLTYPE_VALUE:
46
2
            return rOper(rStrPool.intern(rContext.NFGetInputLineString(
47
2
                rCell.getDouble(), nFormat, bFiltering, bForceSystemLocale)));
48
0
            break;
49
0
        case CELLTYPE_FORMULA:
50
0
        {
51
0
            ScFormulaCell* pFC = rCell.getFormula();
52
0
            const FormulaError nErrCode = pFC->GetErrCode();
53
0
            if (nErrCode != FormulaError::NONE)
54
0
                return rOper(svl::SharedString::getEmptyString());
55
0
            else if (pFC->IsEmptyDisplayedAsString())
56
0
                return rOper(svl::SharedString::getEmptyString());
57
0
            else if (pFC->IsValue())
58
0
                return rOper(rStrPool.intern(rContext.NFGetInputLineString(
59
0
                    pFC->GetValue(), nFormat, bFiltering, bForceSystemLocale)));
60
0
            else
61
0
                return rOper(pFC->GetString());
62
0
        }
63
0
        case CELLTYPE_NONE:
64
0
        default:
65
0
            return rOper(svl::SharedString::getEmptyString());
66
2
    }
67
2
}
queryevaluator.cxx:auto ScCellFormat::visitInputSharedString<ScQueryEvaluator::equalCellSharedString(ScRefCellValue const&, int, int, bool, svl::SharedString const&)::$_0>(ScRefCellValue const&, unsigned int, ScInterpreterContext*, ScDocument const&, svl::SharedStringPool&, bool, bool, ScQueryEvaluator::equalCellSharedString(ScRefCellValue const&, int, int, bool, svl::SharedString const&)::$_0 const&)
Line
Count
Source
37
585
{
38
585
    ScInterpreterContext& rContext = pContext ? *pContext : rDoc.GetNonThreadedContext();
39
40
585
    switch (rCell.getType())
41
585
    {
42
0
        case CELLTYPE_STRING:
43
0
        case CELLTYPE_EDIT:
44
0
            return rOper(rCell.getSharedString(rDoc, rStrPool));
45
16
        case CELLTYPE_VALUE:
46
16
            return rOper(rStrPool.intern(rContext.NFGetInputLineString(
47
16
                rCell.getDouble(), nFormat, bFiltering, bForceSystemLocale)));
48
0
            break;
49
569
        case CELLTYPE_FORMULA:
50
569
        {
51
569
            ScFormulaCell* pFC = rCell.getFormula();
52
569
            const FormulaError nErrCode = pFC->GetErrCode();
53
569
            if (nErrCode != FormulaError::NONE)
54
0
                return rOper(svl::SharedString::getEmptyString());
55
569
            else if (pFC->IsEmptyDisplayedAsString())
56
0
                return rOper(svl::SharedString::getEmptyString());
57
569
            else if (pFC->IsValue())
58
0
                return rOper(rStrPool.intern(rContext.NFGetInputLineString(
59
0
                    pFC->GetValue(), nFormat, bFiltering, bForceSystemLocale)));
60
569
            else
61
569
                return rOper(pFC->GetString());
62
569
        }
63
0
        case CELLTYPE_NONE:
64
0
        default:
65
0
            return rOper(svl::SharedString::getEmptyString());
66
585
    }
67
585
}
68
69
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */