tdf#129905 tdf#160365 sw: don't always draw text boundary on frames
[LibreOffice.git] / unotools / source / config / saveopt.cxx
blobb91ba863961934728ffa03e160227212ddb6f9c0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <sal/config.h>
22 #include <sal/log.hxx>
23 #include <unotools/saveopt.hxx>
24 #include <unotools/configmgr.hxx>
26 #include <officecfg/Office/Common.hxx>
28 using namespace utl;
29 using namespace com::sun::star::uno;
31 void SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eVersion, const std::shared_ptr<comphelper::ConfigurationChanges>& xChanges )
33 sal_Int16 nTmp = (eVersion == SvtSaveOptions::ODFVER_LATEST) ? sal_Int16( 3 ) : sal_Int16( eVersion );
34 officecfg::Office::Common::Save::ODF::DefaultVersion::set(nTmp, xChanges);
37 void SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eVersion )
39 auto xChanges = comphelper::ConfigurationChanges::create();
40 SetODFDefaultVersion(eVersion, xChanges);
41 xChanges->commit();
44 SvtSaveOptions::ODFDefaultVersion GetODFDefaultVersion()
46 SvtSaveOptions::ODFDefaultVersion nRet;
47 sal_Int16 nTmp = officecfg::Office::Common::Save::ODF::DefaultVersion::get();
48 if( nTmp == 3 )
49 nRet = SvtSaveOptions::ODFVER_LATEST;
50 else
51 nRet = SvtSaveOptions::ODFDefaultVersion( nTmp );
52 SAL_WARN_IF(nRet == SvtSaveOptions::ODFVER_UNKNOWN, "unotools.config", "DefaultVersion is ODFVER_UNKNOWN?");
53 return (nRet == SvtSaveOptions::ODFVER_UNKNOWN) ? SvtSaveOptions::ODFVER_LATEST : nRet;
56 SvtSaveOptions::ODFSaneDefaultVersion GetODFSaneDefaultVersion()
58 SvtSaveOptions::ODFDefaultVersion nRet;
59 sal_Int16 nTmp = officecfg::Office::Common::Save::ODF::DefaultVersion::get();
60 if( nTmp == 3 )
61 nRet = SvtSaveOptions::ODFVER_LATEST;
62 else
63 nRet = SvtSaveOptions::ODFDefaultVersion( nTmp );
65 return GetODFSaneDefaultVersion(nRet);
68 SvtSaveOptions::ODFSaneDefaultVersion GetODFSaneDefaultVersion(SvtSaveOptions::ODFDefaultVersion eODFDefaultVersion)
70 switch (eODFDefaultVersion)
72 default:
73 assert(!"map new ODFDefaultVersion to ODFSaneDefaultVersion");
74 break;
75 case SvtSaveOptions::ODFVER_UNKNOWN:
76 case SvtSaveOptions::ODFVER_LATEST:
77 return SvtSaveOptions::ODFSVER_LATEST_EXTENDED;
78 case SvtSaveOptions::ODFVER_010:
79 return SvtSaveOptions::ODFSVER_010;
80 case SvtSaveOptions::ODFVER_011:
81 return SvtSaveOptions::ODFSVER_011;
82 case SvtSaveOptions::ODFVER_012:
83 return SvtSaveOptions::ODFSVER_012;
84 case SvtSaveOptions::ODFVER_012_EXT_COMPAT:
85 return SvtSaveOptions::ODFSVER_012_EXT_COMPAT;
86 case SvtSaveOptions::ODFVER_012_EXTENDED:
87 return SvtSaveOptions::ODFSVER_012_EXTENDED;
88 case SvtSaveOptions::ODFVER_013:
89 return SvtSaveOptions::ODFSVER_013;
91 return SvtSaveOptions::ODFSVER_LATEST_EXTENDED;
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */