xref: /aoo41x/main/sc/inc/tablink.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_TABLINK_HXX
25cdf0e10cSrcweir #define SC_TABLINK_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "scdllapi.h"
28cdf0e10cSrcweir #include "refreshtimer.hxx"
29cdf0e10cSrcweir #include <sfx2/lnkbase.hxx>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include <sfx2/objsh.hxx>
32cdf0e10cSrcweir //REMOVE	#ifndef SO2_DECL_SVEMBEDDEDOBJECT_DEFINED
33cdf0e10cSrcweir //REMOVE	#define SO2_DECL_SVEMBEDDEDOBJECT_DEFINED
34cdf0e10cSrcweir //REMOVE	SO2_DECL_REF(SvEmbeddedObject)
35cdf0e10cSrcweir //REMOVE	#endif
36cdf0e10cSrcweir 
37cdf0e10cSrcweir class ScDocShell;
38cdf0e10cSrcweir struct TableLink_Impl;
39cdf0e10cSrcweir 
40cdf0e10cSrcweir class ScTableLink : public ::sfx2::SvBaseLink, public ScRefreshTimer
41cdf0e10cSrcweir {
42cdf0e10cSrcweir private:
43cdf0e10cSrcweir     TableLink_Impl* pImpl;
44cdf0e10cSrcweir     String          aFileName;
45cdf0e10cSrcweir     String          aFilterName;
46cdf0e10cSrcweir     String          aOptions;
47cdf0e10cSrcweir     sal_Bool            bInCreate;
48cdf0e10cSrcweir     sal_Bool            bInEdit;
49cdf0e10cSrcweir     sal_Bool            bAddUndo;
50cdf0e10cSrcweir     sal_Bool            bDoPaint;
51cdf0e10cSrcweir 
52cdf0e10cSrcweir public:
53cdf0e10cSrcweir 	TYPEINFO();
54cdf0e10cSrcweir 	ScTableLink( ScDocShell* pDocSh, const String& rFile,
55cdf0e10cSrcweir 					const String& rFilter, const String& rOpt, sal_uLong nRefresh );
56cdf0e10cSrcweir 	ScTableLink( SfxObjectShell* pShell, const String& rFile,
57cdf0e10cSrcweir 					const String& rFilter, const String& rOpt, sal_uLong nRefresh );
58cdf0e10cSrcweir 	virtual ~ScTableLink();
59cdf0e10cSrcweir 	virtual void Closed();
60cdf0e10cSrcweir 	virtual void DataChanged( const String& rMimeType,
61cdf0e10cSrcweir 							  const ::com::sun::star::uno::Any & rValue );
62cdf0e10cSrcweir 
63cdf0e10cSrcweir     virtual void    Edit( Window*, const Link& rEndEditHdl );
64cdf0e10cSrcweir 
65cdf0e10cSrcweir 	sal_Bool	Refresh(const String& rNewFile, const String& rNewFilter,
66cdf0e10cSrcweir 					const String* pNewOptions /* = NULL */, sal_uLong nNewRefresh );
SetInCreate(sal_Bool bSet)67cdf0e10cSrcweir 	void	SetInCreate(sal_Bool bSet)		{ bInCreate = bSet; }
SetAddUndo(sal_Bool bSet)68cdf0e10cSrcweir 	void	SetAddUndo(sal_Bool bSet)		{ bAddUndo = bSet; }
SetPaint(sal_Bool bSet)69cdf0e10cSrcweir 	void	SetPaint(sal_Bool bSet)			{ bDoPaint = bSet; }
70cdf0e10cSrcweir 
GetFileName() const71cdf0e10cSrcweir 	const String& GetFileName() const	{ return aFileName; }
GetFilterName() const72cdf0e10cSrcweir 	const String& GetFilterName() const	{ return aFilterName; }
GetOptions() const73cdf0e10cSrcweir 	const String& GetOptions() const	{ return aOptions; }
74cdf0e10cSrcweir 
75cdf0e10cSrcweir 	sal_Bool	IsUsed() const;
76cdf0e10cSrcweir 
77cdf0e10cSrcweir 	DECL_LINK( RefreshHdl, ScTableLink* );
78cdf0e10cSrcweir     DECL_LINK( TableEndEditHdl, ::sfx2::SvBaseLink* );
79cdf0e10cSrcweir };
80cdf0e10cSrcweir 
81cdf0e10cSrcweir class ScDocument;
82cdf0e10cSrcweir class SfxMedium;
83cdf0e10cSrcweir 
84cdf0e10cSrcweir class SC_DLLPUBLIC ScDocumentLoader
85cdf0e10cSrcweir {
86cdf0e10cSrcweir private:
87cdf0e10cSrcweir 	ScDocShell*			pDocShell;
88cdf0e10cSrcweir     SfxObjectShellRef   aRef;
89cdf0e10cSrcweir 	SfxMedium*			pMedium;
90cdf0e10cSrcweir 
91cdf0e10cSrcweir public:
92cdf0e10cSrcweir 						ScDocumentLoader( const String& rFileName,
93cdf0e10cSrcweir 											String& rFilterName, String& rOptions,
94cdf0e10cSrcweir 											sal_uInt32 nRekCnt = 0, sal_Bool bWithInteraction = sal_False );
95cdf0e10cSrcweir 						~ScDocumentLoader();
96cdf0e10cSrcweir 	ScDocument*			GetDocument();
GetDocShell()97cdf0e10cSrcweir 	ScDocShell*			GetDocShell()		{ return pDocShell; }
98cdf0e10cSrcweir 	sal_Bool				IsError() const;
99cdf0e10cSrcweir 	String				GetTitle() const;
100cdf0e10cSrcweir 
101cdf0e10cSrcweir 	void				ReleaseDocRef();	// without calling DoClose
102cdf0e10cSrcweir 
103cdf0e10cSrcweir 	static String		GetOptions( SfxMedium& rMedium );
104cdf0e10cSrcweir 
105cdf0e10cSrcweir     /** Returns the filter name and options from a file name.
106cdf0e10cSrcweir         @param bWithContent
107cdf0e10cSrcweir             true = Tries to detect the filter by looking at the file contents.
108cdf0e10cSrcweir             false = Detects filter by file name extension only (should be used in filter code only).
109cdf0e10cSrcweir         @return sal_True if a filter could be found, sal_False otherwise. */
110cdf0e10cSrcweir 	static sal_Bool			GetFilterName( const String& rFileName,
111cdf0e10cSrcweir 										String& rFilter, String& rOptions,
112cdf0e10cSrcweir                                         sal_Bool bWithContent, sal_Bool bWithInteraction );
113cdf0e10cSrcweir 
114cdf0e10cSrcweir 	static void			RemoveAppPrefix( String& rFilterName );
115cdf0e10cSrcweir };
116cdf0e10cSrcweir 
117cdf0e10cSrcweir #endif
118