tdf#85976 consider 'contains column labels' property for database range

A database range  is an <table:database-range> element in file  format. It has the
attribute 'table:contains-header'  with values  'true' (default) and  'false', and
the attribute  'table:orientation' with values  'row' (default) and  'column'. The
attributes are only written to file, if the value is not default.

If the  selected range has a  database range element then  use its contains-header
property rather than what was last selected.

Change-Id: I120daa2756c50b6c51fab4f6a0549a0b874abaee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177231
Reviewed-by: Sahil Gautam <sahil.gautam.extern@allotropia.de>
Tested-by: Jenkins
This commit is contained in:
Sahil Gautam 2024-11-25 13:10:30 +05:30
parent 4fef75d4c8
commit e2378e0074

View file

@ -144,13 +144,27 @@ void ScDuplicateRecordsDlg::Init()
m_xOkBtn->connect_clicked(LINK(this, ScDuplicateRecordsDlg, OkHdl));
m_xAllChkBtn->connect_toggled(LINK(this, ScDuplicateRecordsDlg, AllCheckBtnHdl));
const ScDocument& rDoc = mrViewData.GetDocument();
bool bIncludeHeaders
= officecfg::Office::Calc::Misc::HandleDuplicateRecords::DataIncludesHeaders::get();
ScDBCollection* pDBColl = rDoc.GetDBCollection();
const SCTAB nCurTab = mrViewData.GetTabNo();
if (pDBColl)
{
ScDBData* pDBData
= pDBColl->GetDBAtArea(nCurTab, mrRange.aStart.Col(), mrRange.aStart.Row(),
mrRange.aEnd.Col(), mrRange.aEnd.Row());
if (pDBData)
bIncludeHeaders = pDBData->HasHeader();
}
// defaults (find duplicate rows | data doesn't include headers)
m_xIncludesHeaders->set_active(bIncludeHeaders);
m_xRadioRow->set_active(
officecfg::Office::Calc::Misc::HandleDuplicateRecords::RemoveDuplicateRows::get());
m_xRadioColumn->set_active(
!officecfg::Office::Calc::Misc::HandleDuplicateRecords::RemoveDuplicateRows::get());
m_xIncludesHeaders->set_active(
officecfg::Office::Calc::Misc::HandleDuplicateRecords::DataIncludesHeaders::get());
m_xRadioRemove->set_active(
officecfg::Office::Calc::Misc::HandleDuplicateRecords::RemoveRecords::get());
m_xRadioSelect->set_active(