LibreOffice Module sc (master) 1
numberformatsbuffer.hxx
Go to the documentation of this file.
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#pragma once
21
22#include <com/sun/star/lang/Locale.hpp>
23#include "workbookhelper.hxx"
24
25namespace com::sun::star {
26 namespace util { class XNumberFormats; }
27}
28
29class SfxItemSet;
30
31namespace oox { class AttributeList; }
32namespace oox { class SequenceInputStream; }
33
34namespace oox::xls {
35
37{
38 css::lang::Locale maLocale;
39 OUString maFmtCode;
40 sal_Int16 mnPredefId;
41
42 explicit NumFmtModel();
43};
44
47{
48 sal_Int32 mnIndex;
49
50 explicit ApiNumFmtData();
51};
52
55{
56public:
57 explicit NumberFormat( const WorkbookHelper& rHelper );
58
60 void setFormatCode( std::u16string_view aFmtCode );
63 const css::lang::Locale& rLocale,
64 const char* pcFmtCode );
66 void setPredefinedId(
67 const css::lang::Locale& rLocale,
68 sal_Int16 nPredefId );
69
71 void finalizeImport(
72 const css::uno::Reference< css::util::XNumberFormats >& rxNumFmts,
73 const css::lang::Locale& rFromLocale );
74 sal_uInt32 fillToItemSet( SfxItemSet& rItemSet, bool bSkipPoolDefs = false ) const;
75
76private:
79};
80
81typedef std::shared_ptr< NumberFormat > NumberFormatRef;
82
84{
85public:
86 explicit NumberFormatsBuffer( const WorkbookHelper& rHelper );
87
89 NumberFormatRef createNumFmt( sal_uInt32 nNumFmtId, std::u16string_view aFmtCode );
90
95
97 void finalizeImport();
98
99 sal_uInt32 fillToItemSet( SfxItemSet& rItemSet, sal_uInt32 nNumFmtId, bool bSkipPoolDefs ) const;
100
101 sal_uInt32 nextFreeId(){ return ++mnHighestId; }
102private:
105
106private:
108
110 OUString maLocaleStr;
111 sal_uInt32 mnHighestId;
112};
113
114} // namespace oox::xls
115
116/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Contains all data for a number format code.
void setFormatCode(std::u16string_view aFmtCode)
Sets the passed format code.
void finalizeImport(const css::uno::Reference< css::util::XNumberFormats > &rxNumFmts, const css::lang::Locale &rFromLocale)
Final processing after import of all style settings.
sal_uInt32 fillToItemSet(SfxItemSet &rItemSet, bool bSkipPoolDefs=false) const
NumberFormat(const WorkbookHelper &rHelper)
void setPredefinedId(const css::lang::Locale &rLocale, sal_Int16 nPredefId)
Sets the passed predefined format code identifier.
void setFormatCode(const css::lang::Locale &rLocale, const char *pcFmtCode)
Sets the passed format code, encoded in UTF-8.
RefMap< sal_uInt32, NumberFormat > NumberFormatMap
NumberFormatRef createNumFmt(sal_uInt32 nNumFmtId, std::u16string_view aFmtCode)
Inserts a new number format.
NumberFormatRef importNumFmt(const AttributeList &rAttribs)
Inserts a new number format code.
OUString maLocaleStr
List of number formats.
NumberFormatsBuffer(const WorkbookHelper &rHelper)
sal_uInt32 mnHighestId
Current office locale.
void insertBuiltinFormats()
Inserts built-in number formats for the current system language.
sal_uInt32 fillToItemSet(SfxItemSet &rItemSet, sal_uInt32 nNumFmtId, bool bSkipPoolDefs) const
void finalizeImport()
Final processing after import of all style settings.
Helper class to provide access to global workbook data.
void SvStream & rStrm
std::shared_ptr< NumberFormat > NumberFormatRef
Contains all API number format attributes.
ApiNumFmtData()
API number format index.
css::lang::Locale maLocale