/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 | 398 | { |
38 | 398 | ScInterpreterContext& rContext = pContext ? *pContext : rDoc.GetNonThreadedContext(); |
39 | | |
40 | 398 | switch (rCell.getType()) |
41 | 398 | { |
42 | 0 | case CELLTYPE_STRING: |
43 | 0 | case CELLTYPE_EDIT: |
44 | 0 | return rOper(rCell.getSharedString(rDoc, rStrPool)); |
45 | 9 | case CELLTYPE_VALUE: |
46 | 9 | return rOper(rStrPool.intern(rContext.NFGetInputLineString( |
47 | 9 | rCell.getDouble(), nFormat, bFiltering, bForceSystemLocale))); |
48 | 0 | break; |
49 | 389 | case CELLTYPE_FORMULA: |
50 | 389 | { |
51 | 389 | ScFormulaCell* pFC = rCell.getFormula(); |
52 | 389 | const FormulaError nErrCode = pFC->GetErrCode(); |
53 | 389 | if (nErrCode != FormulaError::NONE) |
54 | 0 | return rOper(svl::SharedString::getEmptyString()); |
55 | 389 | else if (pFC->IsEmptyDisplayedAsString()) |
56 | 0 | return rOper(svl::SharedString::getEmptyString()); |
57 | 389 | else if (pFC->IsValue()) |
58 | 0 | return rOper(rStrPool.intern(rContext.NFGetInputLineString( |
59 | 0 | pFC->GetValue(), nFormat, bFiltering, bForceSystemLocale))); |
60 | 389 | else |
61 | 389 | return rOper(pFC->GetString()); |
62 | 389 | } |
63 | 0 | case CELLTYPE_NONE: |
64 | 0 | default: |
65 | 0 | return rOper(svl::SharedString::getEmptyString()); |
66 | 398 | } |
67 | 398 | } 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 | 1 | { | 38 | 1 | ScInterpreterContext& rContext = pContext ? *pContext : rDoc.GetNonThreadedContext(); | 39 | | | 40 | 1 | switch (rCell.getType()) | 41 | 1 | { | 42 | 0 | case CELLTYPE_STRING: | 43 | 0 | case CELLTYPE_EDIT: | 44 | 0 | return rOper(rCell.getSharedString(rDoc, rStrPool)); | 45 | 1 | case CELLTYPE_VALUE: | 46 | 1 | return rOper(rStrPool.intern(rContext.NFGetInputLineString( | 47 | 1 | 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 | 1 | } | 67 | 1 | } |
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 | 397 | { | 38 | 397 | ScInterpreterContext& rContext = pContext ? *pContext : rDoc.GetNonThreadedContext(); | 39 | | | 40 | 397 | switch (rCell.getType()) | 41 | 397 | { | 42 | 0 | case CELLTYPE_STRING: | 43 | 0 | case CELLTYPE_EDIT: | 44 | 0 | return rOper(rCell.getSharedString(rDoc, rStrPool)); | 45 | 8 | case CELLTYPE_VALUE: | 46 | 8 | return rOper(rStrPool.intern(rContext.NFGetInputLineString( | 47 | 8 | rCell.getDouble(), nFormat, bFiltering, bForceSystemLocale))); | 48 | 0 | break; | 49 | 389 | case CELLTYPE_FORMULA: | 50 | 389 | { | 51 | 389 | ScFormulaCell* pFC = rCell.getFormula(); | 52 | 389 | const FormulaError nErrCode = pFC->GetErrCode(); | 53 | 389 | if (nErrCode != FormulaError::NONE) | 54 | 0 | return rOper(svl::SharedString::getEmptyString()); | 55 | 389 | else if (pFC->IsEmptyDisplayedAsString()) | 56 | 0 | return rOper(svl::SharedString::getEmptyString()); | 57 | 389 | else if (pFC->IsValue()) | 58 | 0 | return rOper(rStrPool.intern(rContext.NFGetInputLineString( | 59 | 0 | pFC->GetValue(), nFormat, bFiltering, bForceSystemLocale))); | 60 | 389 | else | 61 | 389 | return rOper(pFC->GetString()); | 62 | 389 | } | 63 | 0 | case CELLTYPE_NONE: | 64 | 0 | default: | 65 | 0 | return rOper(svl::SharedString::getEmptyString()); | 66 | 397 | } | 67 | 397 | } |
|
68 | | |
69 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |