Files
Mike Kaganski 84e570b237 No need for shared_ptr overhead here
The normalizers are owned and used only internally; their lifetime
can be controlled using unique_ptr, and getValueNormalizer can
return a bare pointer, instead of a boolean plus an out parameter.

Change-Id: I3e4dca8dec00196a1558d6215316552efde7b906
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190786
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
2025-09-11 11:33:39 +02:00

51 lines
1.6 KiB
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#pragma once
#include <com/sun/star/util/XNumberFormatter.hpp>
#include <com/sun/star/uno/Any.hxx>
#include <unordered_map>
#include <memory>
namespace svt
{
class StandardFormatNormalizer;
class CellValueConversion
{
public:
CellValueConversion();
~CellValueConversion();
OUString convertToString(const css::uno::Any& i_cellValue);
private:
bool ensureNumberFormatter();
const StandardFormatNormalizer* getValueNormalizer(css::uno::Type const& i_valueType);
css::uno::Reference<css::util::XNumberFormatter> xNumberFormatter;
bool bAttemptedFormatterCreation;
std::unordered_map<OUString, std::unique_ptr<StandardFormatNormalizer>> aNormalizers;
};
} // namespace svt
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */