tdf#164047 Don't include libicuuc in libraptor2-lo link list on macOS
[LibreOffice.git] / svx / source / dialog / linkwarn.cxx
blob438a9da77571d5160b2976c7eee99db479395af6
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 <osl/file.hxx>
21 #include <svx/linkwarn.hxx>
22 #include <officecfg/Office/Common.hxx>
24 SvxLinkWarningDialog::SvxLinkWarningDialog(weld::Widget* pParent, const OUString& _rFileName)
25 : MessageDialogController(pParent, u"svx/ui/linkwarndialog.ui"_ustr, u"LinkWarnDialog"_ustr,
26 u"ask"_ustr)
27 , m_xWarningOnBox(m_xBuilder->weld_check_button(u"ask"_ustr))
29 // replace filename
30 OUString sInfoText = m_xDialog->get_primary_text();
31 OUString aPath;
32 if (osl::FileBase::E_None != osl::FileBase::getSystemPathFromFileURL(_rFileName, aPath))
33 aPath = _rFileName;
34 sInfoText = sInfoText.replaceAll("%FILENAME", aPath);
35 m_xDialog->set_primary_text(sInfoText);
37 // load state of "warning on" checkbox from misc options
38 m_xWarningOnBox->set_active(officecfg::Office::Common::Misc::ShowLinkWarningDialog::get());
39 m_xWarningOnBox->set_sensitive(
40 !officecfg::Office::Common::Misc::ShowLinkWarningDialog::isReadOnly());
43 SvxLinkWarningDialog::~SvxLinkWarningDialog()
45 try
47 // save value of "warning off" checkbox, if necessary
48 bool bChecked = m_xWarningOnBox->get_active();
49 if (officecfg::Office::Common::Misc::ShowLinkWarningDialog::get() != bChecked)
51 std::shared_ptr<comphelper::ConfigurationChanges> xChanges(
52 comphelper::ConfigurationChanges::create());
53 officecfg::Office::Common::Misc::ShowLinkWarningDialog::set(bChecked, xChanges);
54 xChanges->commit();
57 catch (...)
62 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */