LibreOffice Module sc (master) 1
zforauto.cxx
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#include <svl/numformat.hxx>
21#include <svl/zforlist.hxx>
22#include <svl/zformat.hxx>
23#include <vcl/svapp.hxx>
24#include <vcl/settings.hxx>
25#include <osl/diagnose.h>
26
27#include <zforauto.hxx>
28#include <tools/stream.hxx>
29
31 sFormatstring ( "Standard" ),
32 eLanguage (LANGUAGE_SYSTEM),
33 eSysLanguage (LANGUAGE_GERMAN) // otherwise "Standard" does not fit
34{
35}
36
38 const SvNumberFormatter& rFormatter)
39{
40 PutFormatIndex(nFormat, rFormatter);
41}
42
43void ScNumFormatAbbrev::Load( SvStream& rStream, rtl_TextEncoding eByteStrSet )
44{
45 sal_uInt16 nSysLang, nLang;
46 sFormatstring = rStream.ReadUniOrByteString( eByteStrSet );
47 rStream.ReadUInt16( nSysLang ).ReadUInt16( nLang );
48 eLanguage = LanguageType(nLang);
49 eSysLanguage = LanguageType(nSysLang);
50 if ( eSysLanguage == LANGUAGE_SYSTEM ) // old versions did write it
52}
53
54void ScNumFormatAbbrev::Save( SvStream& rStream, rtl_TextEncoding eByteStrSet ) const
55{
56 rStream.WriteUniOrByteString( sFormatstring, eByteStrSet );
57 rStream.WriteUInt16( static_cast<sal_uInt16>(eSysLanguage) ).WriteUInt16( static_cast<sal_uInt16>(eLanguage) );
58}
59
60void ScNumFormatAbbrev::PutFormatIndex(sal_uInt32 nFormat,
61 const SvNumberFormatter& rFormatter)
62{
63 const SvNumberformat* pFormat = rFormatter.GetEntry(nFormat);
64 if (pFormat)
65 {
67 eLanguage = pFormat->GetLanguage();
68 sFormatstring = pFormat->GetFormatstring();
69 }
70 else
71 {
72 OSL_FAIL("SCNumFormatAbbrev:: unknown number format");
74 eSysLanguage = LANGUAGE_GERMAN; // otherwise "Standard" does not fit
75 sFormatstring = "Standard";
76 }
77}
78
80{
82 bool bNewInserted;
83 sal_Int32 nCheckPos;
85 eSysLanguage, nType, bNewInserted, nCheckPos);
86}
87
88/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const LanguageTag & GetLanguageTag() const
static const AllSettings & GetSettings()
LanguageType getLanguageType(bool bResolveSystem=true) const
sal_uInt32 GetFormatIndex(SvNumberFormatter &rFormatter)
Definition: zforauto.cxx:79
void Load(SvStream &rStream, rtl_TextEncoding eByteStrSet)
Definition: zforauto.cxx:43
LanguageType eSysLanguage
Definition: zforauto.hxx:32
LanguageType eLanguage
Definition: zforauto.hxx:31
void Save(SvStream &rStream, rtl_TextEncoding eByteStrSet) const
Definition: zforauto.cxx:54
void PutFormatIndex(sal_uInt32 nFormat, const SvNumberFormatter &rFormatter)
Definition: zforauto.cxx:60
OUString sFormatstring
Definition: zforauto.hxx:30
sal_uInt32 GetIndexPuttingAndConverting(OUString &rString, LanguageType eLnge, LanguageType eSysLnge, SvNumFormatType &rType, bool &rNewInserted, sal_Int32 &rCheckPos)
const SvNumberformat * GetEntry(sal_uInt32 nKey) const
LanguageType GetLanguage() const
const OUString & GetFormatstring() const
SvStream & WriteUniOrByteString(std::u16string_view rStr, rtl_TextEncoding eDestCharSet)
OUString ReadUniOrByteString(rtl_TextEncoding eSrcCharSet)
SvStream & WriteUInt16(sal_uInt16 nUInt16)
SvStream & ReadUInt16(sal_uInt16 &rUInt16)
#define LANGUAGE_SYSTEM
#define LANGUAGE_GERMAN
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:398
SvNumFormatType