/* -*- 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 .
*/
if (rxContext.is())
m_xFormatter.set( NumberFormatter::create( rxContext ), UNO_QUERY_THROW); else {
OSL_FAIL("OParameterDialog::OParameterDialog: need a service factory!");
}
IMPL_LINK(OParameterDialog, OnButtonClicked, weld::Button&, rButton, void)
{ if (m_xCancelBtn.get() == &rButton)
{ // no interpreting of the given values anymore...
m_xParam->connect_focus_out(Link<weld::Widget&, void>()); // no direct call from the control anymore ...
m_xDialog->response(RET_CANCEL);
} elseif (m_xOKBtn.get() == &rButton)
{ // transfer the current values into the Any if (OnEntrySelected())
{ // there was an error interpreting the current text return;
}
if (m_xParams.is())
{ // write the parameters try
{
PropertyValue* pValues = m_aFinalValues.getArray(); for (sal_Int32 i = 0, nCount = m_xParams->getCount(); i<nCount; ++i, ++pValues)
{
Reference< XPropertySet > xParamAsSet;
m_xParams->getByIndex(i) >>= xParamAsSet;
// search the next entry in list we haven't visited yet
sal_Int32 nNext = (nCurrent + 1) % nCount; while ((nNext != nCurrent) && ( m_aVisitedParams[nNext] & VisitFlags::Visited ))
nNext = (nNext + 1) % nCount;
if ( m_aVisitedParams[nNext] & VisitFlags::Visited ) // there is no such "not visited yet" entry -> simply take the next one
nNext = (nCurrent + 1) % nCount;
bool OParameterDialog::OnEntrySelected()
{ if (m_aResetVisitFlag.IsActive())
{
LINK(this, OParameterDialog, OnVisitedTimeout).Call(&m_aResetVisitFlag);
m_aResetVisitFlag.Stop();
} // save the old values if (m_nCurrentlySelected != -1)
{ // do the transformation of the current text if (CheckValueForError())
{ // there was an error interpreting the text
m_xAllParams->select(m_nCurrentlySelected); returntrue;
}
// initialize the controls with the new values
sal_Int32 nSelected = m_xAllParams->get_selected_index();
OSL_ENSURE(nSelected != -1, "OParameterDialog::OnEntrySelected : no current entry !");
// with this the value isn't dirty
OSL_ENSURE(o3tl::make_unsigned(m_nCurrentlySelected) < m_aVisitedParams.size(), "OParameterDialog::OnEntrySelected : invalid current entry !");
m_aVisitedParams[m_nCurrentlySelected] &= ~VisitFlags::Dirty;
// mark the currently selected entry as visited
OSL_ENSURE(o3tl::make_unsigned(m_nCurrentlySelected) < m_aVisitedParams.size(), "OParameterDialog::OnVisitedTimeout : invalid entry !");
m_aVisitedParams[m_nCurrentlySelected] |= VisitFlags::Visited;
// was it the last "not visited yet" entry ? bool bVisited = false; for (autoconst& visitedParam : m_aVisitedParams)
{ if (!(visitedParam & VisitFlags::Visited))
{
bVisited = true; break;
}
}
if (!bVisited)
{ // yes, there isn't another one -> change the "default button"
m_xDialog->change_default_widget(m_xTravelNext.get(), m_xOKBtn.get());
}
}
IMPL_LINK(OParameterDialog, OnValueModified, weld::Entry&, rEdit, void)
{ // mark the currently selected entry as dirty
OSL_ENSURE(o3tl::make_unsigned(m_nCurrentlySelected) < m_aVisitedParams.size(), "OParameterDialog::OnValueModified : invalid entry !");
m_aVisitedParams[m_nCurrentlySelected] |= VisitFlags::Dirty;
rEdit.set_message_type(weld::EntryMessageType::Normal);
}
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.