LibreOffice Module sw (master)  1
swmodalredlineacceptdlg.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 <redline.hxx>
21 #include <svl/eitem.hxx>
22 #include <sfx2/viewfrm.hxx>
23 #include <sfx2/dispatch.hxx>
24 #include <svx/ctredlin.hxx>
25 #include <svx/postattr.hxx>
26 #include <unotools/viewoptions.hxx>
27 #include <swtypes.hxx>
28 #include <wrtsh.hxx>
29 #include <view.hxx>
30 #include <swmodule.hxx>
31 #include <swwait.hxx>
32 #include <uitool.hxx>
33 
34 #include <cmdid.h>
35 
36 #include <vector>
37 #include <redlndlg.hxx>
39 
40 #include <unomid.h>
41 
43  : SfxDialogController(pParent, "svx/ui/acceptrejectchangesdialog.ui",
44  "AcceptRejectChangesDialog")
45  , m_xContentArea(m_xDialog->weld_content_area())
46 {
47  m_xDialog->set_modal(true);
48 
49  m_xImplDlg.reset(new SwRedlineAcceptDlg(m_xDialog, m_xBuilder.get(), m_xContentArea.get(), true));
50 
51  SvtViewOptions aDlgOpt(EViewType::Dialog, OStringToOUString(m_xDialog->get_help_id(), RTL_TEXTENCODING_UTF8));
52  if (aDlgOpt.Exists())
53  {
54  css::uno::Any aUserItem = aDlgOpt.GetUserItem("UserItem");
55  OUString sExtraData;
56  aUserItem >>= sExtraData;
57  m_xImplDlg->Initialize(sExtraData);
58  }
59  m_xImplDlg->Activate(); // for data's initialisation
60 }
61 
63 {
64  AcceptAll(false); // refuse everything remaining
65 
66  OUString sExtraData;
67  m_xImplDlg->FillInfo(sExtraData);
68  SvtViewOptions aDlgOpt(EViewType::Dialog, OStringToOUString(m_xDialog->get_help_id(), RTL_TEXTENCODING_UTF8));
69  aDlgOpt.SetUserItem("UserItem", css::uno::makeAny(sExtraData));
70 
71  m_xDialog->set_modal(false);
72 }
73 
75 {
76 }
77 
79 {
80  SvxTPFilter* pFilterTP = m_xImplDlg->GetChgCtrl().GetFilterPage();
81 
82  if (pFilterTP->IsDate() || pFilterTP->IsAuthor() ||
83  pFilterTP->IsRange() || pFilterTP->IsAction())
84  {
85  pFilterTP->CheckDate(false); // turn off all filters
86  pFilterTP->CheckAuthor(false);
87  pFilterTP->CheckRange(false);
88  pFilterTP->CheckAction(false);
89  m_xImplDlg->FilterChangedHdl(nullptr);
90  }
91 
92  m_xImplDlg->CallAcceptReject( false, bAccept );
93 }
94 
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetUserItem(const OUString &sName, const css::uno::Any &aValue)
std::unique_ptr< weld::Container > m_xContentArea
virtual void Activate() override
virtual ~SwModalRedlineAcceptDlg() override
void CheckRange(bool bFlag)
bool IsAuthor()
bool IsDate()
void CheckAuthor(bool bFlag)
void CheckAction(bool bFlag)
SwModalRedlineAcceptDlg(weld::Window *pParent)
bool IsRange()
std::unique_ptr< SwRedlineAcceptDlg > m_xImplDlg
bool IsAction()
bool Exists() const
css::uno::Any GetUserItem(const OUString &sName) const
void CheckDate(bool bFlag)