Fix build
[LibreOffice.git] / sc / inc / cellformtmpl.hxx
bloba36ba17a8bbbc3b63afa6590205b545262ff798b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "cellform.hxx"
22 #include <svl/numformat.hxx>
23 #include <svl/sharedstring.hxx>
24 #include <svl/sharedstringpool.hxx>
26 #include "formulacell.hxx"
27 #include "document.hxx"
28 #include "cellvalue.hxx"
29 #include <formula/errorcodes.hxx>
30 #include "editutil.hxx"
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)
38 ScInterpreterContext& rContext = pContext ? *pContext : rDoc.GetNonThreadedContext();
40 switch (rCell.getType())
42 case CELLTYPE_STRING:
43 case CELLTYPE_EDIT:
44 return rOper(rCell.getSharedString(&rDoc, rStrPool));
45 case CELLTYPE_VALUE:
46 return rOper(rStrPool.intern(rContext.NFGetInputLineString(
47 rCell.getDouble(), nFormat, bFiltering, bForceSystemLocale)));
48 break;
49 case CELLTYPE_FORMULA:
51 ScFormulaCell* pFC = rCell.getFormula();
52 const FormulaError nErrCode = pFC->GetErrCode();
53 if (nErrCode != FormulaError::NONE)
54 return rOper(svl::SharedString::getEmptyString());
55 else if (pFC->IsEmptyDisplayedAsString())
56 return rOper(svl::SharedString::getEmptyString());
57 else if (pFC->IsValue())
58 return rOper(rStrPool.intern(rContext.NFGetInputLineString(
59 pFC->GetValue(), nFormat, bFiltering, bForceSystemLocale)));
60 else
61 return rOper(pFC->GetString());
63 case CELLTYPE_NONE:
64 default:
65 return rOper(svl::SharedString::getEmptyString());
69 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */