/* -*- 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 .
*/
/** Date part flags in order of the list box entries. */ const sal_Int32 spnDateParts[] =
{
css::sheet::DataPilotFieldGroupBy::SECONDS,
css::sheet::DataPilotFieldGroupBy::MINUTES,
css::sheet::DataPilotFieldGroupBy::HOURS,
css::sheet::DataPilotFieldGroupBy::DAYS,
css::sheet::DataPilotFieldGroupBy::MONTHS,
css::sheet::DataPilotFieldGroupBy::QUARTERS,
css::sheet::DataPilotFieldGroupBy::YEARS
};
IMPL_LINK(ScDPGroupEditHelper, ToggleHdl, weld::Toggleable&, rButton, void)
{ if (!rButton.get_active()) return;
if (mrRbAuto.get_active())
{ // disable edit field on clicking "automatic" radio button
mrEdValue.set_sensitive(false);
} elseif (mrRbMan.get_active())
{ // enable and set focus to edit field on clicking "manual" radio button
mrEdValue.set_sensitive(true);
mrEdValue.grab_focus();
}
}
/* Set the initial focus, currently it is somewhere after calling all the radio
button click handlers. Now the first enabled editable control is focused. */ if (mxEdStart->get_sensitive())
mxEdStart->grab_focus(); elseif (mxEdEnd->get_sensitive())
mxEdEnd->grab_focus(); else
mxEdBy->grab_focus();
}
/* Set the initial focus, currently it is somewhere after calling all the radio
button click handlers. Now the first enabled editable control is focused. */ if( mxEdStart->get_sensitive() )
mxEdStart->grab_focus(); elseif( mxEdEnd->get_sensitive() )
mxEdEnd->grab_focus(); elseif( mxEdNumDays->get_sensitive() )
mxEdNumDays->grab_focus(); elseif( mxLbUnits->get_sensitive() )
mxLbUnits->grab_focus();
// get values and silently auto-correct them, if they are not valid // TODO: error messages in OK event?
aInfo.mfStart = maStartHelper.GetValue();
aInfo.mfEnd = maEndHelper.GetValue();
sal_Int64 nNumDays = mxEdNumDays->get_value();
aInfo.mfStep = static_cast<double>( aInfo.mbDateValues ? nNumDays : 0L ); if( aInfo.mfEnd <= aInfo.mfStart )
aInfo.mfEnd = aInfo.mfStart + nNumDays;
return aInfo;
}
sal_Int32 ScDPDateGroupDlg::GetDatePart() const
{ // return DAYS for special "number of days" mode if( mxRbNumDays->get_active() ) return css::sheet::DataPilotFieldGroupBy::DAYS;
IMPL_LINK(ScDPDateGroupDlg, ToggleHdl, weld::Toggleable&, rButton, void)
{ if (!rButton.get_active()) return; if (mxRbNumDays->get_active())
{
mxLbUnits->set_sensitive(false); // enable and set focus to edit field on clicking "num of days" radio button
mxEdNumDays->set_sensitive(true);
mxEdNumDays->grab_focus();
mxBtnOk->set_sensitive(true);
} elseif (mxRbUnits->get_active())
{
mxEdNumDays->set_sensitive(false); // enable and set focus to listbox on clicking "units" radio button
mxLbUnits->set_sensitive(true);
mxLbUnits->grab_focus(); // disable OK button if no date part selected
Check();
}
}
namespace
{ bool HasCheckedEntryCount(const weld::TreeView& rView)
{ for (int i = 0; i < rView.n_children(); ++i)
{ if (rView.get_toggle(i) == TRISTATE_TRUE) returntrue;
} returnfalse;
}
}
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.