/* -*- 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 .
*/
namespace basctl
{ namespace
{ bool lcl_ParseText(OUString const& rText, size_t& rLineNr)
{ // aText should look like "# n" where n > 0 // All spaces are ignored, so there can even be spaces within the // number n. (Maybe it would be better to ignore all whitespace instead // of just spaces.)
OUString aText(rText.replaceAll(" ", "")); if (aText.isEmpty()) returnfalse;
sal_Unicode cFirst = aText[0]; if (cFirst != '#' && (cFirst < '0' || cFirst > '9')) returnfalse; if (cFirst == '#')
aText = aText.copy(1);
sal_Int32 n = aText.toInt32(); if (n <= 0) returnfalse;
rLineNr = static_cast<size_t>(n); returntrue;
}
void BreakPointDialog::CheckButtons()
{ // "New" button is enabled if the combo box edit contains a valid line // number that is not already present in the combo box list; otherwise // "OK" and "Delete" buttons are enabled:
size_t nLine; if (lcl_ParseText(m_xComboBox->get_active_text(), nLine)
&& m_aModifiedBreakPointList.FindBreakPoint(nLine) == nullptr)
{
m_xNewButton->set_sensitive(true);
m_xOKButton->set_sensitive(false);
m_xDelButton->set_sensitive(false);
m_xDialog->change_default_widget(m_xDelButton.get(), m_xNewButton.get());
} else
{
m_xNewButton->set_sensitive(false);
m_xOKButton->set_sensitive(true);
m_xDelButton->set_sensitive(true);
m_xDialog->change_default_widget(m_xNewButton.get(), m_xDelButton.get());
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.