LibreOffice Module uui (master) 1
openlocked.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 <strings.hrc>
21#include "openlocked.hxx"
22#include <officecfg/Office/Common.hxx>
23#include <vcl/weldutils.hxx>
24
25using namespace vcl;
26
27IMPL_LINK(OpenLockedQueryBox, ClickHdl, weld::Button&, rButton, void)
28{
29 if (&rButton == mxOpenReadOnlyBtn.get())
30 {
31 if (mxNotifyBtn->get_active())
32 m_xDialog->response(RET_RETRY);
33 else
34 m_xDialog->response(RET_YES);
35 }
36 else if (&rButton == mxOpenCopyBtn.get())
37 {
38 m_xDialog->response(RET_NO);
39 }
40 else if (&rButton == mxOpenBtn.get())
41 {
42 m_xDialog->response(RET_IGNORE);
43 }
44 else if (&rButton == mxCancelBtn.get())
45 {
46 m_xDialog->response(RET_CANCEL);
47 }
48}
49
50OpenLockedQueryBox::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"))
59{
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));
65
66 if (!(bEnableOverride && officecfg::Office::Common::Misc::AllowOverrideLocking::get()))
67 {
68 //disable option to ignore the (stale?) lock file and open the document
69 mxOpenBtn->set_sensitive(false);
70 }
71
72 mxHiddenText->set_label(rHiddenData);
73 m_xDialog->set_centered_on_parent(true);
74}
75
76/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Reference< XExecutableDialog > m_xDialog
std::unique_ptr< weld::Label > mxHiddenText
Definition: openlocked.hxx:45
std::unique_ptr< weld::Button > mxOpenCopyBtn
Definition: openlocked.hxx:39
std::unique_ptr< weld::Button > mxOpenBtn
Definition: openlocked.hxx:40
std::unique_ptr< weld::Button > mxOpenReadOnlyBtn
Definition: openlocked.hxx:38
std::unique_ptr< weld::Button > mxCancelBtn
Definition: openlocked.hxx:41
std::shared_ptr< weld::Dialog > m_xDialog
IMPL_LINK(OpenLockedQueryBox, ClickHdl, weld::Button &, rButton, void)
Definition: openlocked.cxx:27
RET_CANCEL
RET_NO
RET_IGNORE
RET_RETRY
RET_YES