Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / uui / source / openlocked.cxx
blobadcf060a22743483042e88e4e98bde8c6206594f
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 <strings.hrc>
21 #include "openlocked.hxx"
22 #include <officecfg/Office/Common.hxx>
23 #include <vcl/weldutils.hxx>
25 using namespace vcl;
27 IMPL_LINK(OpenLockedQueryBox, ClickHdl, weld::Button&, rButton, void)
29 if (&rButton == mxOpenReadOnlyBtn.get())
31 if (mxNotifyBtn->get_active())
32 m_xDialog->response(RET_RETRY);
33 else
34 m_xDialog->response(RET_YES);
36 else if (&rButton == mxOpenCopyBtn.get())
38 m_xDialog->response(RET_NO);
40 else if (&rButton == mxOpenBtn.get())
42 m_xDialog->response(RET_IGNORE);
44 else if (&rButton == mxCancelBtn.get())
46 m_xDialog->response(RET_CANCEL);
50 OpenLockedQueryBox::OpenLockedQueryBox(weld::Window* pParent, const OUString& rHiddenData, bool bEnableOverride)
51 : GenericDialogController(pParent, "vcl/ui/openlockedquerybox.ui", "OpenLockedQueryBox")
52 , mxQuestionMarkImage(m_xBuilder->weld_image("questionmark"))
53 , mxOpenReadOnlyBtn(m_xBuilder->weld_button("readonly"))
54 , mxOpenCopyBtn(m_xBuilder->weld_button("opencopy"))
55 , mxOpenBtn(m_xBuilder->weld_button("open"))
56 , mxCancelBtn(m_xBuilder->weld_button("cancel"))
57 , mxNotifyBtn(m_xBuilder->weld_check_button("notify"))
58 , mxHiddenText(m_xBuilder->weld_label("hiddentext"))
60 //setup click hdl
61 mxOpenReadOnlyBtn->connect_clicked(LINK(this, OpenLockedQueryBox, ClickHdl));
62 mxOpenCopyBtn->connect_clicked(LINK(this, OpenLockedQueryBox, ClickHdl));
63 mxOpenBtn->connect_clicked(LINK(this, OpenLockedQueryBox, ClickHdl));
64 mxCancelBtn->connect_clicked(LINK(this, OpenLockedQueryBox, ClickHdl));
66 if (!(bEnableOverride && officecfg::Office::Common::Misc::AllowOverrideLocking::get()))
68 //disable option to ignore the (stale?) lock file and open the document
69 mxOpenBtn->set_sensitive(false);
72 mxHiddenText->set_label(rHiddenData);
73 m_xDialog->set_centered_on_parent(true);
76 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */