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 <tools/stream.hxx>
28 
30  sFormatstring ( "Standard" ),
31  eLanguage (LANGUAGE_SYSTEM),
32  eSysLanguage (LANGUAGE_GERMAN) // otherwise "Standard" does not fit
33 {
34 }
35 
37  const SvNumberFormatter& rFormatter)
38 {
39  PutFormatIndex(nFormat, rFormatter);
40 }
41 
42 void ScNumFormatAbbrev::Load( SvStream& rStream, rtl_TextEncoding eByteStrSet )
43 {
44  sal_uInt16 nSysLang, nLang;
45  sFormatstring = rStream.ReadUniOrByteString( eByteStrSet );
46  rStream.ReadUInt16( nSysLang ).ReadUInt16( nLang );
47  eLanguage = LanguageType(nLang);
48  eSysLanguage = LanguageType(nSysLang);
49  if ( eSysLanguage == LANGUAGE_SYSTEM ) // old versions did write it
51 }
52 
53 void ScNumFormatAbbrev::Save( SvStream& rStream, rtl_TextEncoding eByteStrSet ) const
54 {
55  rStream.WriteUniOrByteString( sFormatstring, eByteStrSet );
56  rStream.WriteUInt16( static_cast<sal_uInt16>(eSysLanguage) ).WriteUInt16( static_cast<sal_uInt16>(eLanguage) );
57 }
58 
59 void ScNumFormatAbbrev::PutFormatIndex(sal_uInt32 nFormat,
60  const SvNumberFormatter& rFormatter)
61 {
62  const SvNumberformat* pFormat = rFormatter.GetEntry(nFormat);
63  if (pFormat)
64  {
66  eLanguage = pFormat->GetLanguage();
67  sFormatstring = pFormat->GetFormatstring();
68  }
69  else
70  {
71  OSL_FAIL("SCNumFormatAbbrev:: unknown number format");
73  eSysLanguage = LANGUAGE_GERMAN; // otherwise "Standard" does not fit
74  sFormatstring = "Standard";
75  }
76 }
77 
79 {
81  bool bNewInserted;
82  sal_Int32 nCheckPos;
84  eSysLanguage, nType, bNewInserted, nCheckPos);
85 }
86 
87 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define LANGUAGE_GERMAN
void Load(SvStream &rStream, rtl_TextEncoding eByteStrSet)
Definition: zforauto.cxx:42
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:53
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:59
sal_uInt32 GetFormatIndex(SvNumberFormatter &rFormatter)
Definition: zforauto.cxx:78
const SvNumberformat * GetEntry(sal_uInt32 nKey) const
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:400
LanguageType eSysLanguage
Definition: zforauto.hxx:33
LanguageType GetLanguage() const
OUString ReadUniOrByteString(rtl_TextEncoding eSrcCharSet)