1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#undef SC_DLLIMPLEMENTATION
#include <delcodlg.hxx>
bool ScDeleteContentsDlg::bPreviousAllCheck = false;
InsertDeleteFlags ScDeleteContentsDlg::nPreviousChecks = InsertDeleteFlags::DATETIME | InsertDeleteFlags::STRING |
InsertDeleteFlags::NOTE | InsertDeleteFlags::FORMULA |
InsertDeleteFlags::VALUE;
ScDeleteContentsDlg::ScDeleteContentsDlg(weld::Window* pParent)
: GenericDialogController(pParent, "modules/scalc/ui/deletecontents.ui", "DeleteContentsDialog")
, m_bObjectsDisabled(false)
, m_xBtnDelAll(m_xBuilder->weld_check_button("deleteall"))
, m_xBtnDelStrings(m_xBuilder->weld_check_button("text"))
, m_xBtnDelNumbers(m_xBuilder->weld_check_button("numbers"))
, m_xBtnDelDateTime(m_xBuilder->weld_check_button("datetime"))
, m_xBtnDelFormulas(m_xBuilder->weld_check_button("formulas"))
, m_xBtnDelNotes(m_xBuilder->weld_check_button("comments"))
, m_xBtnDelAttrs(m_xBuilder->weld_check_button("formats"))
, m_xBtnDelObjects(m_xBuilder->weld_check_button("objects"))
{
m_xBtnDelAll->set_active( ScDeleteContentsDlg::bPreviousAllCheck );
m_xBtnDelStrings->set_active( bool(InsertDeleteFlags::STRING & ScDeleteContentsDlg::nPreviousChecks) );
m_xBtnDelNumbers->set_active( bool(InsertDeleteFlags::VALUE & ScDeleteContentsDlg::nPreviousChecks) );
m_xBtnDelDateTime->set_active( bool(InsertDeleteFlags::DATETIME & ScDeleteContentsDlg::nPreviousChecks) );
m_xBtnDelFormulas->set_active( bool(InsertDeleteFlags::FORMULA & ScDeleteContentsDlg::nPreviousChecks) );
m_xBtnDelNotes->set_active( bool(InsertDeleteFlags::NOTE & ScDeleteContentsDlg::nPreviousChecks) );
m_xBtnDelAttrs->set_active( (InsertDeleteFlags::ATTRIB & ScDeleteContentsDlg::nPreviousChecks) == InsertDeleteFlags::ATTRIB );
m_xBtnDelObjects->set_active( bool(InsertDeleteFlags::OBJECTS & ScDeleteContentsDlg::nPreviousChecks) );
DisableChecks( m_xBtnDelAll->get_active() );
m_xBtnDelAll->connect_toggled( LINK( this, ScDeleteContentsDlg, DelAllHdl ) );
}
ScDeleteContentsDlg::~ScDeleteContentsDlg()
{
}
InsertDeleteFlags ScDeleteContentsDlg::GetDelContentsCmdBits() const
{
ScDeleteContentsDlg::nPreviousChecks = InsertDeleteFlags::NONE;
if ( m_xBtnDelStrings->get_active() )
ScDeleteContentsDlg::nPreviousChecks = InsertDeleteFlags::STRING;
if ( m_xBtnDelNumbers->get_active() )
ScDeleteContentsDlg::nPreviousChecks |= InsertDeleteFlags::VALUE;
if ( m_xBtnDelDateTime->get_active())
ScDeleteContentsDlg::nPreviousChecks |= InsertDeleteFlags::DATETIME;
if ( m_xBtnDelFormulas->get_active())
ScDeleteContentsDlg::nPreviousChecks |= InsertDeleteFlags::FORMULA;
if ( m_xBtnDelNotes->get_active() )
ScDeleteContentsDlg::nPreviousChecks |= InsertDeleteFlags::NOTE;
if ( m_xBtnDelAttrs->get_active() )
ScDeleteContentsDlg::nPreviousChecks |= InsertDeleteFlags::ATTRIB;
if ( m_xBtnDelObjects->get_active() )
ScDeleteContentsDlg::nPreviousChecks |= InsertDeleteFlags::OBJECTS;
ScDeleteContentsDlg::bPreviousAllCheck = m_xBtnDelAll->get_active();
return ( ScDeleteContentsDlg::bPreviousAllCheck
? InsertDeleteFlags::ALL
: ScDeleteContentsDlg::nPreviousChecks );
}
void ScDeleteContentsDlg::DisableChecks( bool bDelAllChecked )
{
if ( bDelAllChecked )
{
m_xBtnDelStrings->set_sensitive(false);
m_xBtnDelNumbers->set_sensitive(false);
m_xBtnDelDateTime->set_sensitive(false);
m_xBtnDelFormulas->set_sensitive(false);
m_xBtnDelNotes->set_sensitive(false);
m_xBtnDelAttrs->set_sensitive(false);
m_xBtnDelObjects->set_sensitive(false);
}
else
{
m_xBtnDelStrings->set_sensitive(true);
m_xBtnDelNumbers->set_sensitive(true);
m_xBtnDelDateTime->set_sensitive(true);
m_xBtnDelFormulas->set_sensitive(true);
m_xBtnDelNotes->set_sensitive(true);
m_xBtnDelAttrs->set_sensitive(true);
if (m_bObjectsDisabled)
m_xBtnDelObjects->set_sensitive(false);
else
m_xBtnDelObjects->set_sensitive(true);
}
}
void ScDeleteContentsDlg::DisableObjects()
{
m_bObjectsDisabled = true;
m_xBtnDelObjects->set_active(false);
m_xBtnDelObjects->set_sensitive(false);
}
IMPL_LINK_NOARG(ScDeleteContentsDlg, DelAllHdl, weld::Toggleable&, void)
{
DisableChecks( m_xBtnDelAll->get_active() );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|