tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sc / source / ui / miscdlgs / delcodlg.cxx
bloba136ec927e6f7ec070306de880d3d39c61977f60
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #undef SC_DLLIMPLEMENTATION
22 #include <delcodlg.hxx>
24 bool ScDeleteContentsDlg::bPreviousAllCheck = false;
25 InsertDeleteFlags ScDeleteContentsDlg::nPreviousChecks = InsertDeleteFlags::DATETIME | InsertDeleteFlags::STRING |
26 InsertDeleteFlags::NOTE | InsertDeleteFlags::FORMULA |
27 InsertDeleteFlags::VALUE;
29 ScDeleteContentsDlg::ScDeleteContentsDlg(weld::Window* pParent)
30 : GenericDialogController(pParent, u"modules/scalc/ui/deletecontents.ui"_ustr, u"DeleteContentsDialog"_ustr)
31 , m_bObjectsDisabled(false)
32 , m_xBtnDelAll(m_xBuilder->weld_check_button(u"deleteall"_ustr))
33 , m_xBtnDelStrings(m_xBuilder->weld_check_button(u"text"_ustr))
34 , m_xBtnDelNumbers(m_xBuilder->weld_check_button(u"numbers"_ustr))
35 , m_xBtnDelDateTime(m_xBuilder->weld_check_button(u"datetime"_ustr))
36 , m_xBtnDelFormulas(m_xBuilder->weld_check_button(u"formulas"_ustr))
37 , m_xBtnDelNotes(m_xBuilder->weld_check_button(u"comments"_ustr))
38 , m_xBtnDelAttrs(m_xBuilder->weld_check_button(u"formats"_ustr))
39 , m_xBtnDelObjects(m_xBuilder->weld_check_button(u"objects"_ustr))
41 m_xBtnDelAll->set_active( ScDeleteContentsDlg::bPreviousAllCheck );
42 m_xBtnDelStrings->set_active( bool(InsertDeleteFlags::STRING & ScDeleteContentsDlg::nPreviousChecks) );
43 m_xBtnDelNumbers->set_active( bool(InsertDeleteFlags::VALUE & ScDeleteContentsDlg::nPreviousChecks) );
44 m_xBtnDelDateTime->set_active( bool(InsertDeleteFlags::DATETIME & ScDeleteContentsDlg::nPreviousChecks) );
45 m_xBtnDelFormulas->set_active( bool(InsertDeleteFlags::FORMULA & ScDeleteContentsDlg::nPreviousChecks) );
46 m_xBtnDelNotes->set_active( bool(InsertDeleteFlags::NOTE & ScDeleteContentsDlg::nPreviousChecks) );
47 m_xBtnDelAttrs->set_active( (InsertDeleteFlags::ATTRIB & ScDeleteContentsDlg::nPreviousChecks) == InsertDeleteFlags::ATTRIB );
48 m_xBtnDelObjects->set_active( bool(InsertDeleteFlags::OBJECTS & ScDeleteContentsDlg::nPreviousChecks) );
50 DisableChecks( m_xBtnDelAll->get_active() );
52 m_xBtnDelAll->connect_toggled( LINK( this, ScDeleteContentsDlg, DelAllHdl ) );
55 ScDeleteContentsDlg::~ScDeleteContentsDlg()
59 InsertDeleteFlags ScDeleteContentsDlg::GetDelContentsCmdBits() const
61 ScDeleteContentsDlg::nPreviousChecks = InsertDeleteFlags::NONE;
63 if ( m_xBtnDelStrings->get_active() )
64 ScDeleteContentsDlg::nPreviousChecks = InsertDeleteFlags::STRING;
65 if ( m_xBtnDelNumbers->get_active() )
66 ScDeleteContentsDlg::nPreviousChecks |= InsertDeleteFlags::VALUE;
67 if ( m_xBtnDelDateTime->get_active())
68 ScDeleteContentsDlg::nPreviousChecks |= InsertDeleteFlags::DATETIME;
69 if ( m_xBtnDelFormulas->get_active())
70 ScDeleteContentsDlg::nPreviousChecks |= InsertDeleteFlags::FORMULA;
71 if ( m_xBtnDelNotes->get_active() )
72 ScDeleteContentsDlg::nPreviousChecks |= InsertDeleteFlags::NOTE;
73 if ( m_xBtnDelAttrs->get_active() )
74 ScDeleteContentsDlg::nPreviousChecks |= InsertDeleteFlags::ATTRIB;
75 if ( m_xBtnDelObjects->get_active() )
76 ScDeleteContentsDlg::nPreviousChecks |= InsertDeleteFlags::OBJECTS;
78 ScDeleteContentsDlg::bPreviousAllCheck = m_xBtnDelAll->get_active();
80 return ( ScDeleteContentsDlg::bPreviousAllCheck
81 ? InsertDeleteFlags::ALL
82 : ScDeleteContentsDlg::nPreviousChecks );
85 void ScDeleteContentsDlg::DisableChecks( bool bDelAllChecked )
87 if ( bDelAllChecked )
89 m_xBtnDelStrings->set_sensitive(false);
90 m_xBtnDelNumbers->set_sensitive(false);
91 m_xBtnDelDateTime->set_sensitive(false);
92 m_xBtnDelFormulas->set_sensitive(false);
93 m_xBtnDelNotes->set_sensitive(false);
94 m_xBtnDelAttrs->set_sensitive(false);
95 m_xBtnDelObjects->set_sensitive(false);
97 else
99 m_xBtnDelStrings->set_sensitive(true);
100 m_xBtnDelNumbers->set_sensitive(true);
101 m_xBtnDelDateTime->set_sensitive(true);
102 m_xBtnDelFormulas->set_sensitive(true);
103 m_xBtnDelNotes->set_sensitive(true);
104 m_xBtnDelAttrs->set_sensitive(true);
105 if (m_bObjectsDisabled)
106 m_xBtnDelObjects->set_sensitive(false);
107 else
108 m_xBtnDelObjects->set_sensitive(true);
112 void ScDeleteContentsDlg::DisableObjects()
114 m_bObjectsDisabled = true;
115 m_xBtnDelObjects->set_active(false);
116 m_xBtnDelObjects->set_sensitive(false);
119 IMPL_LINK_NOARG(ScDeleteContentsDlg, DelAllHdl, weld::Toggleable&, void)
121 DisableChecks( m_xBtnDelAll->get_active() );
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */