1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23 #ifndef _FLTGLBS_HXX
24 #define _FLTGLBS_HXX
25
26 #include <tools/string.hxx>
27 #include <i18npool/lang.h>
28 #include <svl/svarray.hxx>
29
30
31 class SfxPoolItem;
32 class SwDoc;
33 class SwPaM;
34 class SwTable;
35
36 class XF_Buffer;
37 class ColorBuffer;
38 class FontBuffer;
39 class SvNumberFormatter;
40
41
42 class ExcGlob;
43 extern ExcGlob *pExcGlob;
44
45 class LotGlob;
46 extern LotGlob *pLotGlob;
47
48 // ----- Basis-Klasse ----------------------------------------------------
49 class FilterGlobals
50 {
51 protected:
52 SvPtrarr aTblFmts;
53 sal_uInt16 nColStart;
54 sal_uInt16 nColEnd;
55 sal_uInt16 nRowStart;
56 sal_uInt16 nRowEnd;
57 sal_uInt16 nAnzCols;
58 sal_uInt16 nAnzRows;
59
60 public:
61 FilterGlobals( SwDoc& rDoc, const SwPaM& rPam );
62 ~FilterGlobals();
63
64 SwDoc *pD;
65 SwPaM *pPam;
66 const SwTable *pTable;
67
68 SvNumberFormatter *pNumFormatter;
69 LanguageType eDefLanguage;
70 sal_uLong nStandard;
71 sal_uLong nDefFormat; // = 0xFFFFFFFF
72
73 void SetRange( sal_uInt16 nCS, sal_uInt16 nCE, sal_uInt16 nRS, sal_uInt16 nRE );
74
IsInColRange(sal_uInt16 nCol)75 sal_Bool IsInColRange( sal_uInt16 nCol )
76 { return ( nCol >= nColStart && nCol <= nColEnd ); }
IsInRowRange(sal_uInt16 nRow)77 sal_Bool IsInRowRange( sal_uInt16 nRow )
78 { return ( nRow >= nRowStart && nRow <= nRowEnd ); }
IsInRange(sal_uInt16 nCol,sal_uInt16 nRow)79 sal_Bool IsInRange( sal_uInt16 nCol, sal_uInt16 nRow )
80 { return IsInRowRange(nRow) && IsInColRange(nCol); }
81
NormalizeCol(sal_uInt16 & rCol)82 void NormalizeCol( sal_uInt16 &rCol ) { rCol -= nColStart; }
NormalizeRow(sal_uInt16 & rRow)83 void NormalizeRow( sal_uInt16 &rRow ) { rRow -= nRowStart; }
Normalize(sal_uInt16 & rCol,sal_uInt16 & rRow)84 void Normalize( sal_uInt16 &rCol, sal_uInt16 &rRow )
85 { NormalizeCol( rCol ); NormalizeRow( rRow ); }
86
AnzCols() const87 sal_uInt16 AnzCols() const { return nAnzCols; }
AnzRows() const88 sal_uInt16 AnzRows() const { return nAnzRows; }
89
90 sal_Bool ColRangeLimitter( sal_uInt16 &rCS, sal_uInt16 &rCE );
91
92 void InsertText( sal_uInt16 nCol, sal_uInt16 nRow, const String& rStr );
93 void CreateTable();
94 void InsertAttr( const SfxPoolItem& rItem );
95
96 inline void ColLimitter( sal_uInt16 &rCol );
97 inline void RowLimitter( sal_uInt16 &rRow );
98 };
99
100
101
102
103
ColLimitter(sal_uInt16 & rCol)104 inline void FilterGlobals::ColLimitter( sal_uInt16 &rCol )
105 {
106 if( rCol < nColStart )
107 rCol = nColStart;
108 else if( rCol > nColEnd )
109 rCol = nColEnd;
110 }
111
RowLimitter(sal_uInt16 & rRow)112 inline void FilterGlobals::RowLimitter( sal_uInt16 &rRow )
113 {
114 if( rRow < nRowStart )
115 rRow = nRowStart;
116 else if( rRow > nRowEnd )
117 rRow = nRowEnd;
118 }
119
120 #endif
121