Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef SC_TABLINK_HXX
30 : : #define SC_TABLINK_HXX
31 : :
32 : : #include "scdllapi.h"
33 : : #include "refreshtimer.hxx"
34 : : #include <sfx2/lnkbase.hxx>
35 : :
36 : : #include <sfx2/objsh.hxx>
37 : :
38 : : class ScDocShell;
39 : : struct TableLink_Impl;
40 : :
41 : : class ScTableLink : public ::sfx2::SvBaseLink, public ScRefreshTimer
42 : : {
43 : : private:
44 : : TableLink_Impl* pImpl;
45 : : rtl::OUString aFileName;
46 : : rtl::OUString aFilterName;
47 : : rtl::OUString aOptions;
48 : : bool bInCreate:1;
49 : : bool bInEdit:1;
50 : : bool bAddUndo:1;
51 : : bool bDoPaint:1;
52 : :
53 : : public:
54 : : TYPEINFO();
55 : : ScTableLink( ScDocShell* pDocSh, const String& rFile,
56 : : const String& rFilter, const String& rOpt, sal_uLong nRefresh );
57 : : ScTableLink( SfxObjectShell* pShell, const String& rFile,
58 : : const String& rFilter, const String& rOpt, sal_uLong nRefresh );
59 : : virtual ~ScTableLink();
60 : : virtual void Closed();
61 : : virtual ::sfx2::SvBaseLink::UpdateResult DataChanged(
62 : : const String& rMimeType, const ::com::sun::star::uno::Any & rValue );
63 : :
64 : : virtual void Edit( Window*, const Link& rEndEditHdl );
65 : :
66 : : sal_Bool Refresh(const String& rNewFile, const String& rNewFilter,
67 : : const String* pNewOptions /* = NULL */, sal_uLong nNewRefresh );
68 : 4 : void SetInCreate(bool bSet) { bInCreate = bSet; }
69 : 0 : void SetAddUndo(bool bSet) { bAddUndo = bSet; }
70 : 0 : void SetPaint(bool bSet) { bDoPaint = bSet; }
71 : :
72 : 2 : const rtl::OUString& GetFileName() const { return aFileName; }
73 : 0 : const rtl::OUString& GetFilterName() const { return aFilterName; }
74 : 0 : const rtl::OUString& GetOptions() const { return aOptions; }
75 : :
76 : : sal_Bool IsUsed() const;
77 : :
78 : : DECL_LINK( RefreshHdl, void* );
79 : : DECL_LINK( TableEndEditHdl, ::sfx2::SvBaseLink* );
80 : : };
81 : :
82 : : class ScDocument;
83 : : class SfxMedium;
84 : :
85 : : class SC_DLLPUBLIC ScDocumentLoader
86 : : {
87 : : private:
88 : : ScDocShell* pDocShell;
89 : : SfxObjectShellRef aRef;
90 : : SfxMedium* pMedium;
91 : :
92 : : static bool GetFilterName( const String& rFileName,
93 : : String& rFilter, String& rOptions,
94 : : bool bWithContent, bool bWithInteraction );
95 : :
96 : : public:
97 : : ScDocumentLoader( const rtl::OUString& rFileName,
98 : : rtl::OUString& rFilterName, rtl::OUString& rOptions,
99 : : sal_uInt32 nRekCnt = 0, bool bWithInteraction = false );
100 : : ~ScDocumentLoader();
101 : : ScDocument* GetDocument();
102 : 0 : ScDocShell* GetDocShell() { return pDocShell; }
103 : : bool IsError() const;
104 : : rtl::OUString GetTitle() const;
105 : :
106 : : void ReleaseDocRef(); // without calling DoClose
107 : :
108 : : static rtl::OUString GetOptions( SfxMedium& rMedium );
109 : :
110 : : /** Returns the filter name and options from a file name.
111 : : @param bWithContent
112 : : true = Tries to detect the filter by looking at the file contents.
113 : : false = Detects filter by file name extension only (should be used in filter code only).
114 : : @return sal_True if a filter could be found, sal_False otherwise. */
115 : :
116 : : static bool GetFilterName( const ::rtl::OUString& rFileName,
117 : : ::rtl::OUString& rFilter, ::rtl::OUString& rOptions,
118 : : bool bWithContent, bool bWithInteraction );
119 : :
120 : : static void RemoveAppPrefix( rtl::OUString& rFilterName );
121 : : };
122 : :
123 : : #endif
124 : :
125 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|