1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
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
);
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"))
61 mxQuestionMarkImage
->set_from_icon_name(u
"vcl/res/help.png");
64 mxOpenReadOnlyBtn
->connect_clicked(LINK(this, OpenLockedQueryBox
, ClickHdl
));
65 mxOpenCopyBtn
->connect_clicked(LINK(this, OpenLockedQueryBox
, ClickHdl
));
66 mxOpenBtn
->connect_clicked(LINK(this, OpenLockedQueryBox
, ClickHdl
));
67 mxCancelBtn
->connect_clicked(LINK(this, OpenLockedQueryBox
, ClickHdl
));
69 if (!(bEnableOverride
&& officecfg::Office::Common::Misc::AllowOverrideLocking::get()))
71 //disable option to ignore the (stale?) lock file and open the document
72 mxOpenBtn
->set_sensitive(false);
75 mxHiddenText
->set_label(rHiddenData
);
76 m_xDialog
->set_centered_on_parent(true);
79 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */