xref: /trunk/main/sc/inc/clipparam.hxx (revision 38d50f7b)
1*38d50f7bSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*38d50f7bSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*38d50f7bSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*38d50f7bSAndrew Rist  * distributed with this work for additional information
6*38d50f7bSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*38d50f7bSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*38d50f7bSAndrew Rist  * "License"); you may not use this file except in compliance
9*38d50f7bSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*38d50f7bSAndrew Rist  *
11*38d50f7bSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*38d50f7bSAndrew Rist  *
13*38d50f7bSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*38d50f7bSAndrew Rist  * software distributed under the License is distributed on an
15*38d50f7bSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*38d50f7bSAndrew Rist  * KIND, either express or implied.  See the License for the
17*38d50f7bSAndrew Rist  * specific language governing permissions and limitations
18*38d50f7bSAndrew Rist  * under the License.
19*38d50f7bSAndrew Rist  *
20*38d50f7bSAndrew Rist  *************************************************************/
21*38d50f7bSAndrew Rist 
22*38d50f7bSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef SC_CLIPPARAM_HXX
25cdf0e10cSrcweir #define SC_CLIPPARAM_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "rangelst.hxx"
28cdf0e10cSrcweir #include "rangenam.hxx"
29cdf0e10cSrcweir #include "charthelper.hxx"
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include <vector>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir /**
34cdf0e10cSrcweir  * This struct stores general clipboard parameters associated with a
35cdf0e10cSrcweir  * ScDocument instance created in clipboard mode.
36cdf0e10cSrcweir  */
37cdf0e10cSrcweir struct ScClipParam
38cdf0e10cSrcweir {
39cdf0e10cSrcweir     enum Direction { Unspecified, Column, Row };
40cdf0e10cSrcweir 
41cdf0e10cSrcweir     ScRangeList         maRanges;
42cdf0e10cSrcweir     Direction           meDirection;
43cdf0e10cSrcweir     bool                mbCutMode;
44cdf0e10cSrcweir     sal_uInt32          mnSourceDocID;
45cdf0e10cSrcweir     ScRangeListVector   maProtectedChartRangesVector;
46cdf0e10cSrcweir 
47cdf0e10cSrcweir     ScClipParam();
48cdf0e10cSrcweir     ScClipParam(const ScRange& rRange, bool bCutMode);
49cdf0e10cSrcweir     explicit ScClipParam(const ScClipParam& r);
50cdf0e10cSrcweir 
51cdf0e10cSrcweir     bool isMultiRange() const;
52cdf0e10cSrcweir 
53cdf0e10cSrcweir     /**
54cdf0e10cSrcweir      * Get the column size of a pasted range.  Note that when the range is
55cdf0e10cSrcweir      * non-contiguous, we first compress all individual ranges into a single
56cdf0e10cSrcweir      * range, and the size of that compressed range is returned.
57cdf0e10cSrcweir      */
58cdf0e10cSrcweir     SCCOL getPasteColSize();
59cdf0e10cSrcweir 
60cdf0e10cSrcweir     /**
61cdf0e10cSrcweir      * Same as the above method, but returns the row size of the compressed
62cdf0e10cSrcweir      * range.
63cdf0e10cSrcweir      */
64cdf0e10cSrcweir     SCROW getPasteRowSize();
65cdf0e10cSrcweir 
66cdf0e10cSrcweir     /**
67cdf0e10cSrcweir      * Return a single range that encompasses all individual ranges.
68cdf0e10cSrcweir      */
69cdf0e10cSrcweir     ScRange getWholeRange() const;
70cdf0e10cSrcweir 
71cdf0e10cSrcweir     void transpose();
72cdf0e10cSrcweir 
getSourceDocIDScClipParam73cdf0e10cSrcweir     sal_uInt32 getSourceDocID() const { return mnSourceDocID; }
setSourceDocIDScClipParam74cdf0e10cSrcweir     void setSourceDocID( sal_uInt32 nVal ) { mnSourceDocID = nVal; }
75cdf0e10cSrcweir };
76cdf0e10cSrcweir 
77cdf0e10cSrcweir // ============================================================================
78cdf0e10cSrcweir 
79cdf0e10cSrcweir struct ScClipRangeNameData
80cdf0e10cSrcweir {
81cdf0e10cSrcweir     ScRangeData::IndexMap       maRangeMap;
82cdf0e10cSrcweir     ::std::vector<ScRangeData*> mpRangeNames;
83cdf0e10cSrcweir     bool                        mbReplace;
84cdf0e10cSrcweir 
85cdf0e10cSrcweir     ScClipRangeNameData();
86cdf0e10cSrcweir     ~ScClipRangeNameData();
87cdf0e10cSrcweir     void insert(sal_uInt16 nOldIndex, sal_uInt16 nNewIndex);
88cdf0e10cSrcweir };
89cdf0e10cSrcweir 
90cdf0e10cSrcweir #endif
91