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 #ifndef INCLUDED_SC_SOURCE_FILTER_INC_NUMBERFORMATSBUFFER_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_NUMBERFORMATSBUFFER_HXX
22 
23 #include <com/sun/star/lang/Locale.hpp>
24 #include "workbookhelper.hxx"
25 
26 namespace com::sun::star {
27  namespace util { class XNumberFormats; }
28 }
29 
30 class SfxItemSet;
31 
32 namespace oox { class AttributeList; }
33 namespace oox { class SequenceInputStream; }
34 
35 namespace oox::xls {
36 
38 {
39  css::lang::Locale maLocale;
40  OUString maFmtCode;
41  sal_Int16 mnPredefId;
42 
43  explicit NumFmtModel();
44 };
45 
48 {
49  sal_Int32 mnIndex;
50 
51  explicit ApiNumFmtData();
52 };
53 
56 {
57 public:
58  explicit NumberFormat( const WorkbookHelper& rHelper );
59 
61  void setFormatCode( const OUString& rFmtCode );
63  void setFormatCode(
64  const css::lang::Locale& rLocale,
65  const char* pcFmtCode );
67  void setPredefinedId(
68  const css::lang::Locale& rLocale,
69  sal_Int16 nPredefId );
70 
72  void finalizeImport(
73  const css::uno::Reference< css::util::XNumberFormats >& rxNumFmts,
74  const css::lang::Locale& rFromLocale );
75  sal_uInt32 fillToItemSet( SfxItemSet& rItemSet, bool bSkipPoolDefs = false ) const;
76 
77 private:
80 };
81 
82 typedef std::shared_ptr< NumberFormat > NumberFormatRef;
83 
85 {
86 public:
87  explicit NumberFormatsBuffer( const WorkbookHelper& rHelper );
88 
90  NumberFormatRef createNumFmt( sal_uInt32 nNumFmtId, const OUString& rFmtCode );
91 
93  NumberFormatRef importNumFmt( const AttributeList& rAttribs );
96 
98  void finalizeImport();
99 
100  sal_uInt32 fillToItemSet( SfxItemSet& rItemSet, sal_uInt32 nNumFmtId, bool bSkipPoolDefs ) const;
101 
102  sal_uInt32 nextFreeId(){ return ++mnHighestId; }
103 private:
105  void insertBuiltinFormats();
106 
107 private:
109 
110  NumberFormatMap maNumFmts;
111  OUString maLocaleStr;
112  sal_uInt32 mnHighestId;
113 };
114 
115 } // namespace oox::xls
116 
117 #endif
118 
119 /* 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.