xref: /aoo42x/main/sc/source/filter/inc/excimp8.hxx (revision 38d50f7b)
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 
24 #ifndef SC_EXCIMP8_HXX
25 #define SC_EXCIMP8_HXX
26 
27 #include <string.h>
28 #include "imp_op.hxx"
29 #include "root.hxx"
30 #include "excscen.hxx"
31 #include "excdefs.hxx"
32 #include "ftools.hxx"
33 #include "queryparam.hxx"
34 
35 class SotStorage;
36 
37 class ScBaseCell;
38 class ScRangeList;
39 class ScDBData;
40 
41 class ScfSimpleProgressBar;
42 
43 class XclImpStream;
44 
45 
46 
47 class ImportExcel8 : public ImportExcel
48 {
49 public:
50                             ImportExcel8( XclImpRootData& rImpData, SvStream& rStrm );
51 	virtual					~ImportExcel8( void );
52 
53 	virtual FltError		Read( void );
54 
55 protected:
56     ExcScenarioList         aScenList;
57 
58 	void					Calccount( void );				// 0x0C
59     void                    Precision( void );              // 0x0E
60 	void					Delta( void );					// 0x10
61 	void					Iteration( void );				// 0x11
62 	void					Boundsheet( void );				// 0x85
63 	void					FilterMode( void );				// 0x9B
64 	void					AutoFilterInfo( void );			// 0x9D
65 	void					AutoFilter( void );				// 0x9E
66 	void					Scenman( void );				// 0xAE
67 	void					Scenario( void );				// 0xAF
68 	void					ReadBasic( void );				// 0xD3
69 	void					Labelsst( void );				// 0xFD
70 
71 	void					Hlink( void );					// 0x01B8
72 	void					Codename( sal_Bool bWBGlobals );	// 0x01BA
73     void                    SheetProtection( void );        // 0x0867
74 
75     virtual void            EndSheet( void );
76 	virtual void			PostDocLoad( void );
77 
78 private:
79     void                    LoadDocumentProperties();
80 };
81 
82 
83 
84 //___________________________________________________________________
85 // classes AutoFilterData, AutoFilterBuffer
86 
87 class XclImpAutoFilterData : private ExcRoot
88 {
89 private:
90 	ScDBData*					pCurrDBData;
91 	ScQueryParam				aParam;
92 	SCSIZE						nFirstEmpty;
93 	sal_Bool						bActive;
94 	sal_Bool						bHasConflict;
95     sal_Bool                        bCriteria;
96     sal_Bool                        bAutoOrAdvanced;
97     ScRange                     aCriteriaRange;
98     String                      aFilterName;
99 
100 	void						CreateFromDouble( String& rStr, double fVal );
101 	void						SetCellAttribs();
102 	void						InsertQueryParam();
103 	void						AmendAFName(const sal_Bool bUseUnNamed);
104 
105 protected:
106 public:
107 								XclImpAutoFilterData(
108 									RootData* pRoot,
109 									const ScRange& rRange,
110 									const String& rName );
111 
IsActive() const112     inline bool                 IsActive() const    { return bActive; }
IsFiltered() const113     inline bool                 IsFiltered() const  { return bAutoOrAdvanced; }
Tab() const114 	inline SCTAB				Tab() const			{ return aParam.nTab; }
StartCol() const115 	inline SCCOL				StartCol() const	{ return aParam.nCol1; }
StartRow() const116 	inline SCROW				StartRow() const	{ return aParam.nRow1; }
EndCol() const117 	inline SCCOL				EndCol() const		{ return aParam.nCol2; }
EndRow() const118 	inline SCROW				EndRow() const		{ return aParam.nRow2; }
119 
120 	void						ReadAutoFilter( XclImpStream& rStrm );
121 
Activate()122 	inline void					Activate()			{ bActive = sal_True; }
123     void                        SetAdvancedRange( const ScRange* pRange );
124 	void						SetExtractPos( const ScAddress& rAddr );
SetAutoOrAdvanced()125     inline void                 SetAutoOrAdvanced()  { bAutoOrAdvanced = sal_True; }
126 	void						Apply( const sal_Bool bUseUnNamed = sal_False );
127     void                        CreateScDBData( const sal_Bool bUseUnNamed );
128     void                        EnableRemoveFilter();
129 };
130 
131 
132 class XclImpAutoFilterBuffer : private List
133 {
134 private:
135     using                       List::Insert;
136 
137 	sal_uInt16                      nAFActiveCount;
138 
_First()139     inline XclImpAutoFilterData* _First()	{ return (XclImpAutoFilterData*) List::First(); }
_Next()140 	inline XclImpAutoFilterData* _Next()	{ return (XclImpAutoFilterData*) List::Next(); }
141 
Append(XclImpAutoFilterData * pData)142 	inline void					Append( XclImpAutoFilterData* pData )
143 									{ List::Insert( pData, LIST_APPEND ); }
144 protected:
145 public:
146 								XclImpAutoFilterBuffer();
147     virtual						~XclImpAutoFilterBuffer();
148 
149 	void						Insert( RootData* pRoot, const ScRange& rRange,
150 												const String& rName );
151 	void						AddAdvancedRange( const ScRange& rRange );
152 	void						AddExtractPos( const ScRange& rRange );
153 	void						Apply();
154 
155 	XclImpAutoFilterData*		GetByTab( SCTAB nTab );
IncrementActiveAF()156     inline void                 IncrementActiveAF() { nAFActiveCount++; }
UseUnNamed()157     inline sal_Bool                 UseUnNamed() { return nAFActiveCount == 1; }
158 };
159 
160 #endif
161 
162