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/zforlist.hxx>
21 #include <svl/zformat.hxx>
22 #include <vcl/svapp.hxx>
23 #include <vcl/settings.hxx>
24 #include <osl/diagnose.h>
25 
26 #include <zforauto.hxx>
27 #include <global.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 
43 void 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 
54 void 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 
60 void 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: */
#define LANGUAGE_GERMAN
void Load(SvStream &rStream, rtl_TextEncoding eByteStrSet)
Definition: zforauto.cxx:43
sal_uInt32 GetIndexPuttingAndConverting(OUString &rString, LanguageType eLnge, LanguageType eSysLnge, SvNumFormatType &rType, bool &rNewInserted, sal_Int32 &rCheckPos)
SvStream & WriteUInt16(sal_uInt16 nUInt16)
SvStream & ReadUInt16(sal_uInt16 &rUInt16)
LanguageType getLanguageType(bool bResolveSystem=true) const
void Save(SvStream &rStream, rtl_TextEncoding eByteStrSet) const
Definition: zforauto.cxx:54
static const AllSettings & GetSettings()
OUString sFormatstring
Definition: zforauto.hxx:31
const OUString & GetFormatstring() const
SvStream & WriteUniOrByteString(const OUString &rStr, rtl_TextEncoding eDestCharSet)
LanguageType eLanguage
Definition: zforauto.hxx:32
const LanguageTag & GetLanguageTag() const
#define LANGUAGE_SYSTEM
SvNumFormatType
void PutFormatIndex(sal_uInt32 nFormat, const SvNumberFormatter &rFormatter)
Definition: zforauto.cxx:60
sal_uInt32 GetFormatIndex(SvNumberFormatter &rFormatter)
Definition: zforauto.cxx:79
const SvNumberformat * GetEntry(sal_uInt32 nKey) const
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:401
LanguageType eSysLanguage
Definition: zforauto.hxx:33
LanguageType GetLanguage() const
OUString ReadUniOrByteString(rtl_TextEncoding eSrcCharSet)