LibreOffice Module sc (master)  1
delcodlg.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 #undef SC_DLLIMPLEMENTATION
21 
22 #include <delcodlg.hxx>
23 
28 
30  : GenericDialogController(pParent, "modules/scalc/ui/deletecontents.ui", "DeleteContentsDialog")
31  , m_bObjectsDisabled(false)
32  , m_xBtnDelAll(m_xBuilder->weld_check_button("deleteall"))
33  , m_xBtnDelStrings(m_xBuilder->weld_check_button("text"))
34  , m_xBtnDelNumbers(m_xBuilder->weld_check_button("numbers"))
35  , m_xBtnDelDateTime(m_xBuilder->weld_check_button("datetime"))
36  , m_xBtnDelFormulas(m_xBuilder->weld_check_button("formulas"))
37  , m_xBtnDelNotes(m_xBuilder->weld_check_button("comments"))
38  , m_xBtnDelAttrs(m_xBuilder->weld_check_button("formats"))
39  , m_xBtnDelObjects(m_xBuilder->weld_check_button("objects"))
40  , m_xBtnOk(m_xBuilder->weld_button("ok"))
41 {
44  m_xBtnDelNumbers->set_active( bool(InsertDeleteFlags::VALUE & ScDeleteContentsDlg::nPreviousChecks) );
45  m_xBtnDelDateTime->set_active( bool(InsertDeleteFlags::DATETIME & ScDeleteContentsDlg::nPreviousChecks) );
46  m_xBtnDelFormulas->set_active( bool(InsertDeleteFlags::FORMULA & ScDeleteContentsDlg::nPreviousChecks) );
47  m_xBtnDelNotes->set_active( bool(InsertDeleteFlags::NOTE & ScDeleteContentsDlg::nPreviousChecks) );
48  m_xBtnDelAttrs->set_active( (InsertDeleteFlags::ATTRIB & ScDeleteContentsDlg::nPreviousChecks) == InsertDeleteFlags::ATTRIB );
49  m_xBtnDelObjects->set_active( bool(InsertDeleteFlags::OBJECTS & ScDeleteContentsDlg::nPreviousChecks) );
50 
51  DisableChecks( m_xBtnDelAll->get_active() );
52 
53  m_xBtnDelAll->connect_toggled( LINK( this, ScDeleteContentsDlg, DelAllHdl ) );
54 }
55 
57 {
58 }
59 
61 {
63 
64  if ( m_xBtnDelStrings->get_active() )
66  if ( m_xBtnDelNumbers->get_active() )
68  if ( m_xBtnDelDateTime->get_active())
70  if ( m_xBtnDelFormulas->get_active())
72  if ( m_xBtnDelNotes->get_active() )
74  if ( m_xBtnDelAttrs->get_active() )
76  if ( m_xBtnDelObjects->get_active() )
78 
80 
84 }
85 
86 void ScDeleteContentsDlg::DisableChecks( bool bDelAllChecked )
87 {
88  if ( bDelAllChecked )
89  {
90  m_xBtnDelStrings->set_sensitive(false);
91  m_xBtnDelNumbers->set_sensitive(false);
92  m_xBtnDelDateTime->set_sensitive(false);
93  m_xBtnDelFormulas->set_sensitive(false);
94  m_xBtnDelNotes->set_sensitive(false);
95  m_xBtnDelAttrs->set_sensitive(false);
96  m_xBtnDelObjects->set_sensitive(false);
97  }
98  else
99  {
100  m_xBtnDelStrings->set_sensitive(true);
101  m_xBtnDelNumbers->set_sensitive(true);
102  m_xBtnDelDateTime->set_sensitive(true);
103  m_xBtnDelFormulas->set_sensitive(true);
104  m_xBtnDelNotes->set_sensitive(true);
105  m_xBtnDelAttrs->set_sensitive(true);
106  if (m_bObjectsDisabled)
107  m_xBtnDelObjects->set_sensitive(false);
108  else
109  m_xBtnDelObjects->set_sensitive(true);
110  }
111 }
112 
114 {
115  m_bObjectsDisabled = true;
116  m_xBtnDelObjects->set_active(false);
117  m_xBtnDelObjects->set_sensitive(false);
118 }
119 
121 {
122  DisableChecks( m_xBtnDelAll->get_active() );
123 }
124 
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Numeric values (and numeric results if InsertDeleteFlags::FORMULA is not set).
std::unique_ptr< weld::CheckButton > m_xBtnDelNumbers
Definition: delcodlg.hxx:32
std::unique_ptr< weld::CheckButton > m_xBtnDelDateTime
Definition: delcodlg.hxx:33
virtual ~ScDeleteContentsDlg() override
Definition: delcodlg.cxx:56
void DisableChecks(bool bDelAllChecked)
Definition: delcodlg.cxx:86
IMPL_LINK_NOARG(ScDeleteContentsDlg, DelAllHdl, weld::Toggleable &, void)
Definition: delcodlg.cxx:120
Internal use only (d&d undo): do not delete caption objects of cell notes.
static bool bPreviousAllCheck
Definition: delcodlg.hxx:40
std::unique_ptr< weld::CheckButton > m_xBtnDelAttrs
Definition: delcodlg.hxx:36
std::unique_ptr< weld::CheckButton > m_xBtnDelFormulas
Definition: delcodlg.hxx:34
InsertDeleteFlags
Definition: global.hxx:147
InsertDeleteFlags GetDelContentsCmdBits() const
Definition: delcodlg.cxx:60
static InsertDeleteFlags nPreviousChecks
Definition: delcodlg.hxx:41
std::unique_ptr< weld::CheckButton > m_xBtnDelStrings
Definition: delcodlg.hxx:31
ScDeleteContentsDlg(weld::Window *pParent)
Definition: delcodlg.cxx:29
std::unique_ptr< weld::CheckButton > m_xBtnDelAll
Definition: delcodlg.hxx:30
std::unique_ptr< weld::CheckButton > m_xBtnDelNotes
Definition: delcodlg.hxx:35
Dates, times, datetime values.
Strings (and string results if InsertDeleteFlags::FORMULA is not set).
bool m_bDetectedRangeSegmentation false
std::unique_ptr< weld::CheckButton > m_xBtnDelObjects
Definition: delcodlg.hxx:37