1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: tablink.hxx,v $
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_TABLINK_HXX
32 #define SC_TABLINK_HXX
35 #include "refreshtimer.hxx"
36 #include <sfx2/lnkbase.hxx>
38 #include <sfx2/objsh.hxx>
39 //REMOVE #ifndef SO2_DECL_SVEMBEDDEDOBJECT_DEFINED
40 //REMOVE #define SO2_DECL_SVEMBEDDEDOBJECT_DEFINED
41 //REMOVE SO2_DECL_REF(SvEmbeddedObject)
45 struct TableLink_Impl
;
47 class ScTableLink
: public ::sfx2::SvBaseLink
, public ScRefreshTimer
50 TableLink_Impl
* pImpl
;
61 ScTableLink( ScDocShell
* pDocSh
, const String
& rFile
,
62 const String
& rFilter
, const String
& rOpt
, ULONG nRefresh
);
63 ScTableLink( SfxObjectShell
* pShell
, const String
& rFile
,
64 const String
& rFilter
, const String
& rOpt
, ULONG nRefresh
);
65 virtual ~ScTableLink();
66 virtual void Closed();
67 virtual void DataChanged( const String
& rMimeType
,
68 const ::com::sun::star::uno::Any
& rValue
);
70 virtual void Edit( Window
*, const Link
& rEndEditHdl
);
72 BOOL
Refresh(const String
& rNewFile
, const String
& rNewFilter
,
73 const String
* pNewOptions
/* = NULL */, ULONG nNewRefresh
);
74 void SetInCreate(BOOL bSet
) { bInCreate
= bSet
; }
75 void SetAddUndo(BOOL bSet
) { bAddUndo
= bSet
; }
76 void SetPaint(BOOL bSet
) { bDoPaint
= bSet
; }
78 const String
& GetFileName() const { return aFileName
; }
79 const String
& GetFilterName() const { return aFilterName
; }
80 const String
& GetOptions() const { return aOptions
; }
84 DECL_LINK( RefreshHdl
, ScTableLink
* );
85 DECL_LINK( TableEndEditHdl
, ::sfx2::SvBaseLink
* );
91 class SC_DLLPUBLIC ScDocumentLoader
94 ScDocShell
* pDocShell
;
95 SfxObjectShellRef aRef
;
99 ScDocumentLoader( const String
& rFileName
,
100 String
& rFilterName
, String
& rOptions
,
101 UINT32 nRekCnt
= 0, BOOL bWithInteraction
= FALSE
);
103 ScDocument
* GetDocument();
104 ScDocShell
* GetDocShell() { return pDocShell
; }
105 BOOL
IsError() const;
106 String
GetTitle() const;
108 void ReleaseDocRef(); // without calling DoClose
110 static String
GetOptions( SfxMedium
& rMedium
);
112 /** Returns the filter name and options from a file name.
114 true = Tries to detect the filter by looking at the file contents.
115 false = Detects filter by file name extension only (should be used in filter code only).
116 @return TRUE if a filter could be found, FALSE otherwise. */
117 static BOOL
GetFilterName( const String
& rFileName
,
118 String
& rFilter
, String
& rOptions
,
119 BOOL bWithContent
, BOOL bWithInteraction
);
121 static void RemoveAppPrefix( String
& rFilterName
);