/* -*- 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 .
*/ #ifndef INCLUDED_TOOLS_MULTISEL_HXX #define INCLUDED_TOOLS_MULTISEL_HXX
class SAL_WARN_UNUSED TOOLS_DLLPUBLIC MultiSelection
{ private:
std::vector< Range >
aSels; // array of SV-selections
Range aTotRange; // total range of indexes
std::size_t nCurSubSel; // index in aSels of current selected index
sal_Int32 nCurIndex; // current selected entry
sal_Int32 nSelCount; // number of selected indexes bool bCurValid; // are nCurIndex and nCurSubSel valid
/** i_rPageRange: the string to be changed into a sequence of numbers valid format example "5-3,9,9,7-8" ; instead of ',' ';' or ' ' are allowed as well o_rPageVector: the output sequence of numbers i_nLogicalOffset: an offset to be applied to each number in the string before inserting it in the resulting sequence example: a user enters page numbers from 1 to n (since that is logical) of course usable page numbers in code would start from 0 and end at n-1 so the logical offset would be -1 i_nMinNumber: the minimum allowed number i_nMaxNumber: the maximum allowed number
@returns: true if the input string was valid, o_rPageVector will contain the resulting sequence false if the input string was invalid, o_rPageVector will contain the sequence that parser is able to extract
behavior: - only non-negative sequence numbers are allowed - only non-negative values in the input string are allowed - the string "-3" means the sequence i_nMinNumber to 3 - the string "3-" means the sequence 3 to i_nMaxNumber - the string "-" means the sequence i_nMinNumber to i_nMaxNumber - single number that doesn't fit in [i_nMinNumber,i_nMaxNumber] will be ignored - range that doesn't fit in [i_nMinNumber,i_nMaxNumber] will be adjusted
*/ staticbool getRangesFromString( std::u16string_view i_rPageRange,
std::vector< sal_Int32 >& o_rPageVector,
sal_Int32 i_nMinNumber,
sal_Int32 i_nMaxNumber,
sal_Int32 i_nLogicalOffset = -1,
o3tl::sorted_vector< sal_Int32 > const * i_pPossibleValues = nullptr
);
};
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 ist noch experimentell.