Avoid potential negative array index access to cached text.
[LibreOffice.git] / sc / inc / clipparam.hxx
blob4487e77093ff6af2a79fe38f465fac499aec7b27
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #pragma once
22 #include "rangelst.hxx"
23 #include "charthelper.hxx"
24 #include "document.hxx"
26 /**
27 * This struct stores general clipboard parameters associated with a
28 * ScDocument instance created in clipboard mode.
30 struct SC_DLLPUBLIC ScClipParam
32 enum Direction { Unspecified, Column, Row };
34 ScRangeList maRanges;
35 Direction meDirection;
36 bool mbCutMode;
37 sal_uInt32 mnSourceDocID;
38 ScRangeListVector maProtectedChartRangesVector;
39 /** Was this clip transposed? */
40 bool mbTransposed = false;
42 ScClipParam();
43 ScClipParam(const ScRange& rRange, bool bCutMode);
45 bool isMultiRange() const;
47 /**
48 * Get the column size of a pasted range. Note that when the range is
49 * non-contiguous, we first compress all individual ranges into a single
50 * range, and the size of that compressed range is returned.
52 SCCOL getPasteColSize();
54 /**
55 * Same as the above method, but returns the row size of the compressed
56 * range.
58 SCROW getPasteRowSize(const ScDocument& rSrcDoc, bool bIncludeFiltered);
60 /**
61 * Return a single range that encompasses all individual ranges.
63 ScRange getWholeRange() const;
65 /**
66 * Transpose the clip parameters.
67 * Filtered rows are removed from parameters.
69 void transpose(const ScDocument& rSrcDoc, bool bIncludeFiltered,
70 bool bIsMultiRangeRowFilteredTranspose);
72 sal_uInt32 getSourceDocID() const { return mnSourceDocID; }
73 void setSourceDocID( sal_uInt32 nVal ) { mnSourceDocID = nVal; }
75 /**
76 * Was this clip transposed?
78 bool isTransposed() const { return mbTransposed; }
81 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */