Bump version to 4.3-4
[LibreOffice.git] / sc / inc / tablink.hxx
blobf4125f38527e1cf92f60d3297b01d681391be838
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SC_INC_TABLINK_HXX
21 #define INCLUDED_SC_INC_TABLINK_HXX
23 #include "scdllapi.h"
24 #include "refreshtimer.hxx"
25 #include <sfx2/lnkbase.hxx>
27 #include <sfx2/objsh.hxx>
29 class ScDocShell;
30 struct TableLink_Impl;
32 class ScTableLink : public ::sfx2::SvBaseLink, public ScRefreshTimer
34 private:
35 TableLink_Impl* pImpl;
36 OUString aFileName;
37 OUString aFilterName;
38 OUString aOptions;
39 bool bInCreate:1;
40 bool bInEdit:1;
41 bool bAddUndo:1;
42 bool bDoPaint:1;
44 public:
45 TYPEINFO_OVERRIDE();
46 ScTableLink( ScDocShell* pDocSh, const OUString& rFile,
47 const OUString& rFilter, const OUString& rOpt, sal_uLong nRefresh );
48 ScTableLink( SfxObjectShell* pShell, const OUString& rFile,
49 const OUString& rFilter, const OUString& rOpt, sal_uLong nRefresh );
50 virtual ~ScTableLink();
51 virtual void Closed() SAL_OVERRIDE;
52 virtual ::sfx2::SvBaseLink::UpdateResult DataChanged(
53 const OUString& rMimeType, const ::com::sun::star::uno::Any & rValue ) SAL_OVERRIDE;
55 virtual void Edit( Window*, const Link& rEndEditHdl ) SAL_OVERRIDE;
57 bool Refresh(const OUString& rNewFile, const OUString& rNewFilter,
58 const OUString* pNewOptions /* = NULL */, sal_uLong nNewRefresh );
59 void SetInCreate(bool bSet) { bInCreate = bSet; }
60 void SetAddUndo(bool bSet) { bAddUndo = bSet; }
61 void SetPaint(bool bSet) { bDoPaint = bSet; }
63 const OUString& GetFileName() const { return aFileName; }
64 const OUString& GetFilterName() const { return aFilterName; }
65 const OUString& GetOptions() const { return aOptions; }
67 bool IsUsed() const;
69 DECL_LINK( RefreshHdl, void* );
70 DECL_LINK( TableEndEditHdl, ::sfx2::SvBaseLink* );
73 class ScDocument;
74 class SfxMedium;
75 class SfxFilter;
77 class SC_DLLPUBLIC ScDocumentLoader
79 private:
80 ScDocShell* pDocShell;
81 SfxObjectShellRef aRef;
82 SfxMedium* pMedium;
84 public:
85 ScDocumentLoader( const OUString& rFileName,
86 OUString& rFilterName, OUString& rOptions,
87 sal_uInt32 nRekCnt = 0, bool bWithInteraction = false );
88 ~ScDocumentLoader();
89 ScDocument* GetDocument();
90 ScDocShell* GetDocShell() { return pDocShell; }
91 bool IsError() const;
92 OUString GetTitle() const;
94 void ReleaseDocRef(); // without calling DoClose
96 /** Create SfxMedium for stream read with SfxFilter and filter options set
97 at the medium's SfxItemSet.
99 static SfxMedium* CreateMedium( const OUString& rFileName, const SfxFilter* pFilter, const OUString& rOptions );
101 static OUString GetOptions( SfxMedium& rMedium );
103 /** Returns the filter name and options from a file name.
104 @param bWithContent
105 true = Tries to detect the filter by looking at the file contents.
106 false = Detects filter by file name extension only (should be used in filter code only).
107 @return sal_True if a filter could be found, sal_False otherwise. */
109 static bool GetFilterName( const OUString& rFileName,
110 OUString& rFilter, OUString& rOptions,
111 bool bWithContent, bool bWithInteraction );
113 static void RemoveAppPrefix( OUString& rFilterName );
116 #endif
118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */