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 <o3tl/deleter.hxx>
21 #include <svx/ctredlin.hxx>
22 #include <unotools/viewoptions.hxx>
24 #include <redlndlg.hxx>
25 #include <swmodalredlineacceptdlg.hxx>
27 SwModalRedlineAcceptDlg::SwModalRedlineAcceptDlg(weld::Window
*pParent
)
28 : SfxDialogController(pParent
, u
"svx/ui/acceptrejectchangesdialog.ui"_ustr
,
29 u
"AcceptRejectChangesDialog"_ustr
)
30 , m_xContentArea(m_xDialog
->weld_content_area())
32 m_xDialog
->set_modal(true);
34 m_xImplDlg
.reset(new SwRedlineAcceptDlg(m_xDialog
, m_xBuilder
.get(), m_xContentArea
.get(), true));
36 SvtViewOptions
aDlgOpt(EViewType::Dialog
, m_xDialog
->get_help_id());
39 css::uno::Any aUserItem
= aDlgOpt
.GetUserItem(u
"UserItem"_ustr
);
41 aUserItem
>>= sExtraData
;
42 m_xImplDlg
->Initialize(sExtraData
);
44 m_xImplDlg
->Activate(); // for data's initialisation
47 void SwModalRedlineAcceptDlg::ImplDestroy()
49 AcceptAll(false); // refuse everything remaining
52 m_xImplDlg
->FillInfo(sExtraData
);
53 SvtViewOptions
aDlgOpt(EViewType::Dialog
, m_xDialog
->get_help_id());
54 aDlgOpt
.SetUserItem(u
"UserItem"_ustr
, css::uno::Any(sExtraData
));
56 m_xDialog
->set_modal(false);
59 SwModalRedlineAcceptDlg::~SwModalRedlineAcceptDlg()
61 suppress_fun_call_w_exception(ImplDestroy());
64 void SwModalRedlineAcceptDlg::Activate()
68 void SwModalRedlineAcceptDlg::AcceptAll( bool bAccept
)
70 SvxTPFilter
* pFilterTP
= m_xImplDlg
->GetChgCtrl().GetFilterPage();
72 if (pFilterTP
->IsDate() || pFilterTP
->IsAuthor() ||
73 pFilterTP
->IsRange() || pFilterTP
->IsAction())
75 pFilterTP
->CheckDate(false); // turn off all filters
76 pFilterTP
->CheckAuthor(false);
77 pFilterTP
->CheckRange(false);
78 pFilterTP
->CheckAction(false);
79 m_xImplDlg
->FilterChangedHdl(nullptr);
82 m_xImplDlg
->CallAcceptReject( false, bAccept
);
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */