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 
25 namespace com::sun::star {
26  namespace util { class XNumberFormats; }
27 }
28 
29 class SfxItemSet;
30 
31 namespace oox { class AttributeList; }
32 namespace oox { class SequenceInputStream; }
33 
34 namespace 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 {
56 public:
57  explicit NumberFormat( const WorkbookHelper& rHelper );
58 
60  void setFormatCode( const OUString& rFmtCode );
62  void setFormatCode(
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 
76 private:
79 };
80 
81 typedef std::shared_ptr< NumberFormat > NumberFormatRef;
82 
84 {
85 public:
86  explicit NumberFormatsBuffer( const WorkbookHelper& rHelper );
87 
89  NumberFormatRef createNumFmt( sal_uInt32 nNumFmtId, const OUString& rFmtCode );
90 
92  NumberFormatRef importNumFmt( const AttributeList& rAttribs );
95 
97  void finalizeImport();
98 
99  sal_uInt32 fillToItemSet( SfxItemSet& rItemSet, sal_uInt32 nNumFmtId, bool bSkipPoolDefs ) const;
100 
101  sal_uInt32 nextFreeId(){ return ++mnHighestId; }
102 private:
104  void insertBuiltinFormats();
105 
106 private:
108 
109  NumberFormatMap maNumFmts;
110  OUString maLocaleStr;
111  sal_uInt32 mnHighestId;
112 };
113 
114 } // namespace oox::xls
115 
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
exports com.sun.star.lib. util
Helper class to provide access to global workbook data.
sal_uInt32 mnHighestId
Current office locale.
void setPredefinedId(const css::lang::Locale &rLocale, sal_Int16 nPredefId)
Sets the passed predefined format code identifier.
NumberFormatsBuffer(const WorkbookHelper &rHelper)
void finalizeImport(const css::uno::Reference< css::util::XNumberFormats > &rxNumFmts, const css::lang::Locale &rFromLocale)
Final processing after import of all style settings.
OUString maLocaleStr
List of number formats.
NumberFormatRef importNumFmt(const AttributeList &rAttribs)
Inserts a new number format code.
std::shared_ptr< NumberFormat > NumberFormatRef
sal_uInt32 fillToItemSet(SfxItemSet &rItemSet, bool bSkipPoolDefs=false) const
sal_uInt32 fillToItemSet(SfxItemSet &rItemSet, sal_uInt32 nNumFmtId, bool bSkipPoolDefs) const
void setFormatCode(const OUString &rFmtCode)
Sets the passed format code.
Contains all data for a number format code.
void insertBuiltinFormats()
Inserts built-in number formats for the current system language.
css::lang::Locale maLocale
NumberFormatRef createNumFmt(sal_uInt32 nNumFmtId, const OUString &rFmtCode)
Inserts a new number format.
RefMap< sal_uInt32, NumberFormat > NumberFormatMap
Contains all API number format attributes.
void SvStream & rStrm
NumberFormat(const WorkbookHelper &rHelper)
ApiNumFmtData()
API number format index.
void finalizeImport()
Final processing after import of all style settings.