LibreOffice Module unotools (master) 1
saveopt.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 <sal/config.h>
21
22#include <sal/log.hxx>
23#include <unotools/saveopt.hxx>
25
26#include <officecfg/Office/Common.hxx>
27
28using namespace utl;
29using namespace com::sun::star::uno;
30
31void SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eVersion, const std::shared_ptr<comphelper::ConfigurationChanges>& xChanges )
32{
33 sal_Int16 nTmp = (eVersion == SvtSaveOptions::ODFVER_LATEST) ? sal_Int16( 3 ) : sal_Int16( eVersion );
34 officecfg::Office::Common::Save::ODF::DefaultVersion::set(nTmp, xChanges);
35}
36
38{
40 SetODFDefaultVersion(eVersion, xChanges);
41 xChanges->commit();
42}
43
45{
48 if( nTmp == 3 )
50 else
52 SAL_WARN_IF(nRet == SvtSaveOptions::ODFVER_UNKNOWN, "unotools.config", "DefaultVersion is ODFVER_UNKNOWN?");
54}
55
57{
60 if( nTmp == 3 )
62 else
64
65 return GetODFSaneDefaultVersion(nRet);
66}
67
69{
70 switch (eODFDefaultVersion)
71 {
72 default:
73 assert(!"map new ODFDefaultVersion to ODFSaneDefaultVersion");
74 break;
90 }
92}
93
94/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static std::shared_ptr< ConfigurationChanges > create()
#define SAL_WARN_IF(condition, area, stream)
ODFDefaultVersion
Keep enum values sorted that a less or greater compare maps to older and newer versions.
Definition: saveopt.hxx:38
@ ODFVER_012_EXTENDED
Definition: saveopt.hxx:45
@ ODFVER_012_EXT_COMPAT
Definition: saveopt.hxx:44
ODFSaneDefaultVersion
Enums that allow a sane comparison of versions, without LATEST.
Definition: saveopt.hxx:53
@ ODFSVER_012
ODF 1.2.
Definition: saveopt.hxx:57
@ ODFSVER_011
ODF 1.1.
Definition: saveopt.hxx:56
@ ODFSVER_LATEST_EXTENDED
Definition: saveopt.hxx:66
@ ODFSVER_013
ODF 1.3.
Definition: saveopt.hxx:60
@ ODFSVER_012_EXTENDED
ODF 1.2 extended.
Definition: saveopt.hxx:59
@ ODFSVER_010
ODF 1.0.
Definition: saveopt.hxx:55
@ ODFSVER_012_EXT_COMPAT
ODF 1.2 extended, but with compatibility fallbacks.
Definition: saveopt.hxx:58
OUString get(TranslateId sContextAndId, const std::locale &loc)
Definition: resmgr.cxx:211
void SetODFDefaultVersion(SvtSaveOptions::ODFDefaultVersion eVersion, const std::shared_ptr< comphelper::ConfigurationChanges > &xChanges)
Definition: saveopt.cxx:31
SvtSaveOptions::ODFDefaultVersion GetODFDefaultVersion()
Definition: saveopt.cxx:44
SvtSaveOptions::ODFSaneDefaultVersion GetODFSaneDefaultVersion()
Definition: saveopt.cxx:56