merge the formfield patch from ooo-build
[ooovba.git] / binfilter / inc / bf_sc / dpobject.hxx
blob2aec44862edf036489accc0a17fad7dce9347cf4
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dpobject.hxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SC_DPOBJECT_HXX
32 #define SC_DPOBJECT_HXX
34 #ifndef SC_SCGLOB_HXX
35 #include "global.hxx"
36 #endif
38 #ifndef SC_COLLECT_HXX
39 #include "collect.hxx"
40 #endif
42 #ifndef _COM_SUN_STAR_SHEET_XDIMENSIONSSUPPLIER_HPP_
43 #include <com/sun/star/sheet/XDimensionsSupplier.hpp>
44 #endif
45 class Rectangle;
46 class SvStream;
47 namespace binfilter {
50 //------------------------------------------------------------------
53 class ScDPSaveData;
54 class ScDPOutput;
55 struct ScDPPositionData;
56 class ScMultipleReadHeader;
57 class ScMultipleWriteHeader;
58 class ScPivot;
59 class ScPivotCollection;
60 struct ScPivotParam;
61 struct ScImportSourceDesc;
62 struct ScSheetSourceDesc;
65 struct ScDPServiceDesc
67 String aServiceName;
68 String aParSource;
69 String aParName;
70 String aParUser;
71 String aParPass;
73 ScDPServiceDesc( const String& rServ, const String& rSrc, const String& rNam,
74 const String& rUser, const String& rPass ) :
75 aServiceName( rServ ), aParSource( rSrc ), aParName( rNam ),
76 aParUser( rUser ), aParPass( rPass ) { }
78 BOOL operator== ( const ScDPServiceDesc& rOther ) const
79 { return aServiceName == rOther.aServiceName &&
80 aParSource == rOther.aParSource &&
81 aParName == rOther.aParName &&
82 aParUser == rOther.aParUser &&
83 aParPass == rOther.aParPass; }
87 class ScDPObject : public DataObject
89 private:
90 ScDocument* pDoc;
91 // settings
92 ScDPSaveData* pSaveData;
93 String aTableName;
94 String aTableTag;
95 ScRange aOutRange;
96 ScSheetSourceDesc* pSheetDesc; // for sheet data
97 ScImportSourceDesc* pImpDesc; // for database data
98 ScDPServiceDesc* pServDesc; // for external service
99 // cached data
100 ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDimensionsSupplier> xSource;
101 ScDPOutput* pOutput;
102 BOOL bSettingsChanged;
103 BOOL bAlive; // FALSE if only used to hold settings
106 void CreateObjects();
108 public:
109 ScDPObject( ScDocument* pD );
110 ScDPObject(const ScDPObject& r);
111 virtual ~ScDPObject();
113 virtual DataObject* Clone() const;
115 void SetAlive(BOOL bSet);
117 void InvalidateData();
118 void InvalidateSource();
121 void SetSaveData(const ScDPSaveData& rData);
122 ScDPSaveData* GetSaveData() const { return pSaveData; }
124 void SetOutRange(const ScRange& rRange);
125 const ScRange& GetOutRange() const { return aOutRange; }
127 void SetSheetDesc(const ScSheetSourceDesc& rDesc);
128 void SetImportDesc(const ScImportSourceDesc& rDesc);
129 void SetServiceData(const ScDPServiceDesc& rDesc);
132 const ScSheetSourceDesc* GetSheetDesc() const { return pSheetDesc; }
133 const ScImportSourceDesc* GetImportSourceDesc() const { return pImpDesc; }
134 const ScDPServiceDesc* GetDPServiceDesc() const { return pServDesc; }
137 BOOL IsSheetData() const;
138 BOOL IsImportData() const { return(pImpDesc != NULL); }
139 BOOL IsServiceData() const { return(pServDesc != NULL); }
141 void SetName(const String& rNew);
142 const String& GetName() const { return aTableName; }
143 void SetTag(const String& rNew);
144 const String& GetTag() const { return aTableTag; }
148 BOOL StoreOld(SvStream& rStream, ScMultipleWriteHeader& rHdr ) const;
149 BOOL StoreNew(SvStream& rStream, ScMultipleWriteHeader& rHdr ) const;
150 BOOL LoadNew(SvStream& rStream, ScMultipleReadHeader& rHdr );
151 BOOL FillOldParam(ScPivotParam& rParam, BOOL bForFile) const;
152 void InitFromOldPivot(const ScPivot& rOld, ScDocument* pDoc, BOOL bSetSource);
154 void UpdateReference( UpdateRefMode eUpdateRefMode,
155 const ScRange& r, short nDx, short nDy, short nDz );
157 static void ConvertOrientation( ScDPSaveData& rSaveData,
158 PivotField* pFields, USHORT nCount, USHORT nOrient,
159 ScDocument* pDoc, USHORT nRow, USHORT nTab,
160 const ::com::sun::star::uno::Reference<
161 ::com::sun::star::sheet::XDimensionsSupplier>& xSource,
162 BOOL bOldDefaults,
163 PivotField* pRefColFields = NULL, USHORT nRefColCount = 0,
164 PivotField* pRefRowFields = NULL, USHORT nRefRowCount = 0 );
168 class ScDPCollection : public Collection
170 private:
171 ScDocument* pDoc;
173 public:
174 ScDPCollection(ScDocument* pDocument);
175 ScDPCollection(const ScDPCollection& r);
176 virtual ~ScDPCollection();
178 virtual DataObject* Clone() const;
180 ScDPObject* operator[](USHORT nIndex) const {return (ScDPObject*)At(nIndex);}
182 BOOL StoreOld( SvStream& rStream ) const;
183 BOOL StoreNew( SvStream& rStream ) const;
184 BOOL LoadNew( SvStream& rStream );
186 void ConvertOldTables( ScPivotCollection& rOldColl );
188 void UpdateReference( UpdateRefMode eUpdateRefMode,
189 const ScRange& r, short nDx, short nDy, short nDz );
191 String CreateNewName( USHORT nMin = 1 ) const;
192 void EnsureNames();
196 } //namespace binfilter
197 #endif