/* -*- 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 .
*/
/** Struct to hold non-data extended area, used with ScDocument::ShrinkToUsedDataArea().
*/ struct ScDataAreaExtras
{ /// If TRUE, consider the presence of cell notes besides data. bool mbCellNotes = false; /// If TRUE, consider the presence of draw objects anchored to the cell. bool mbCellDrawObjects = false; /// If TRUE, consider the presence of cell formats. bool mbCellFormats = false;
SCCOL mnStartCol = SCCOL_MAX;
SCROW mnStartRow = SCROW_MAX;
SCCOL mnEndCol = -1;
SCROW mnEndRow = -1;
/** * Call this only during normal sorting, not from reordering.
*/
std::unique_ptr<ScSortInfo[]> const & GetFirstArray() const
{ return mvppInfo[0];
}
/** * Call this only during normal sorting, not from reordering.
*/
ScSortInfo & Get( sal_uInt16 nSort, SCCOLROW nInd )
{ return mvppInfo[nSort][ nInd - nStart ];
}
/** * Call this only during normal sorting, not from reordering.
*/ void Swap( SCCOLROW nInd1, SCCOLROW nInd2 )
{ if (nInd1 == nInd2) // avoid self-move-assign return;
SCSIZE n1 = static_cast<SCSIZE>(nInd1 - nStart);
SCSIZE n2 = static_cast<SCSIZE>(nInd2 - nStart); for ( sal_uInt16 nSort = 0; nSort < static_cast<sal_uInt16>(mvppInfo.size()); nSort++ )
{ auto & ppInfo = mvppInfo[nSort];
std::swap(ppInfo[n1], ppInfo[n2]);
}
/** * @param rIndices indices are actual row positions on the sheet, not an * offset from the top row.
*/ void ReorderByRow( const std::vector<SCCOLROW>& rIndices )
{ if (!mpRows) return;
for (constauto& rIndex : rIndices)
{
size_t nPos = rIndex - nStart; // switch to an offset to top row.
aRows2.push_back(rRows[nPos]);
aOrderIndices2.push_back(maOrderIndices[nPos]);
}
struct ReorderParam
{ /** * This sort range already takes into account the presence or absence of * header row / column i.e. if a header row / column is present, it * excludes that row / column.
*/
ScRange maSortRange;
ScDataAreaExtras maDataAreaExtras;
/** * List of original column / row positions after reordering.
*/
std::vector<SCCOLROW> maOrderIndices; bool mbByRow; bool mbHiddenFiltered; bool mbUpdateRefs; bool mbHasHeaders;
/** * Reorder the position indices such that it can be used to undo the * original reordering.
*/ void reverse();
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.