/* -*- 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/.
*/
if (bHasOne)
{ // We've already found one data cell in another column.
aRet.meState = sc::MultiDataCellState::HasMultipleCells; return aRet;
}
bHasOne = true; break;
} case sc::MultiDataCellState::HasMultipleCells:
{
setFirstCell(aRet, nCol, nFirstDataRow);
if (IsScenario()) // TODO: I don't even know what this scenario thingie is. Perhaps we // should check it against the scenario ranges? returnfalse;
assert(pTabProtection);
switch (eAction)
{ case sc::EditAction::InsertColumnsBefore: case sc::EditAction::InsertColumnsAfter:
{ // TODO: improve the matrix range handling for the insert-before action. if (HasBlockMatrixFragment(nStartCol, nStartRow, nEndCol, nEndRow)) returnfalse;
return pTabProtection->isOptionEnabled(ScTableProtection::INSERT_COLUMNS);
} case sc::EditAction::InsertRowsBefore: case sc::EditAction::InsertRowsAfter:
{ // TODO: improve the matrix range handling for the insert-before action. if (HasBlockMatrixFragment(nStartCol, nStartRow, nEndCol, nEndRow)) returnfalse;
return pTabProtection->isOptionEnabled(ScTableProtection::INSERT_ROWS);
} case sc::EditAction::DeleteColumns:
{ if (!pTabProtection->isOptionEnabled(ScTableProtection::DELETE_COLUMNS)) returnfalse;
return !HasAttrib(nStartCol, nStartRow, nEndCol, nEndRow, HasAttrFlags::Protected);
} case sc::EditAction::DeleteRows:
{ if (!pTabProtection->isOptionEnabled(ScTableProtection::DELETE_ROWS)) returnfalse;
return !HasAttrib(nStartCol, nStartRow, nEndCol, nEndRow, HasAttrFlags::Protected);
} case sc::EditAction::UpdatePivotTable:
{ if (pTabProtection->isOptionEnabled(ScTableProtection::PIVOT_TABLES)) returntrue;
OString ScTable::dumpSheetGeomData(bool bColumns, SheetGeomType eGeomType)
{ switch (eGeomType)
{ case SheetGeomType::SIZES: // returns a non-empty space separated list of spans with trailing space. // The format of the span is <size of any row/col in the span in print twips>:<last row/col of the span> // Example (for columns with three spans if MAXCOL is 1023): "1280:3 1049:50 1280:1023" return dumpColumnRowSizes(bColumns); case SheetGeomType::HIDDEN: // returns a non-empty space separated list of spans with trailing space. // The format of the span is: // 1) First span: <1 (span is hidden) / 0 (not hidden)>:<last row/col of the span> // 2) Rest of the spans: <last row/col of the span> // The hidden state of the spans after the first can be inferred from the first span's flag as no adjacent // spans can have the same state by definition of span. return dumpHiddenFiltered(bColumns, /*bHidden*/ true); case SheetGeomType::FILTERED: // has exactly the same format as 'hidden'. return dumpHiddenFiltered(bColumns, /*bHidden*/ false); case SheetGeomType::GROUPS: // returns a space separated list of 'levels' with trailing space. // A 'level' is a comma separated list of groups(outline entries) with trailing comma. // format of a group is: // <start row/col of group>:<number of rows/cols in the group>:<1/0(group is hidden?)>:<1/0(control is visible?)> return dumpColumnRowGroups(bColumns); default:
;
}
return""_ostr;
}
OString ScTable::dumpColumnRowSizes(bool bColumns)
{ // If the data-structures are not available, just report that all // rows/cols have the default sizes. staticconst OString aDefaultForCols
= OString::number(STD_COL_WIDTH) + ":" + OString::number(GetDoc().MaxCol()) + " "; staticconst OString aDefaultForRows
= OString::number(GetOptimalMinRowHeight()) + ":" + OString::number(GetDoc().MaxRow()) + " ";
// ScCompressedArray is a template class and we don't want to impose // the restriction that its value type should be string serializable, // instead just operate on the specialized object. typedef ScCompressedArray<SCCOL, sal_uInt16> ColWidthsType; auto dumpColWidths = [this](const ColWidthsType& rWidths) -> OString {
OStringBuffer aOutput;
SCCOL nStartCol = 0; const SCCOL nMaxCol = std::min(rWidths.GetLastPos(), GetDoc().MaxCol());
size_t nDummy = 0; while (nStartCol <= nMaxCol)
{
SCCOL nEndCol;
sal_uInt16 nWidth = rWidths.GetValue(nStartCol, nDummy, nEndCol); // The last span nEndCol is always MAXCOL+1 for some reason, and we don't want that. if (nEndCol > nMaxCol)
nEndCol = nMaxCol;
aOutput.append(OString::number(nWidth) + ":" + OString::number(nEndCol) + " ");
nStartCol = nEndCol + 1;
}
return aOutput.makeStringAndClear();
};
if (bColumns) return mpColWidth ? dumpColWidths(*mpColWidth) : aDefaultForCols;
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.