LibreOffice Module sc (master) 1
tablink.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
22#include "scdllapi.h"
23#include "refreshtimer.hxx"
24#include <sfx2/lnkbase.hxx>
25
26#include <sfx2/objsh.hxx>
27#include <memory>
28
29class ScDocShell;
30struct TableLink_Impl;
31
32namespace weld { class Window; }
33
34class ScTableLink final : public ::sfx2::SvBaseLink, public ScRefreshTimer
35{
36private:
37 std::unique_ptr<TableLink_Impl> pImpl;
38 OUString aFileName;
39 OUString aFilterName;
40 OUString aOptions;
41 bool bInCreate:1;
42 bool bInEdit:1;
43 bool bAddUndo:1;
44
45public:
46 ScTableLink( ScDocShell* pDocSh, OUString aFile,
47 OUString aFilter, OUString aOpt, sal_Int32 nRefreshDelaySeconds );
48 ScTableLink( SfxObjectShell* pShell, OUString aFile,
49 OUString aFilter, OUString aOpt, sal_Int32 nRefreshDelaySeconds );
50 virtual ~ScTableLink() override;
51 virtual void Closed() override;
52 virtual ::sfx2::SvBaseLink::UpdateResult DataChanged(
53 const OUString& rMimeType, const css::uno::Any & rValue ) override;
54
55 virtual void Edit(weld::Window*, const Link<SvBaseLink&,void>& rEndEditHdl) override;
56
57 bool Refresh(const OUString& rNewFile, const OUString& rNewFilter,
58 const OUString* pNewOptions /* = NULL */, sal_Int32 nNewRefreshDelaySeconds );
59 void SetInCreate(bool bSet) { bInCreate = bSet; }
60 void SetAddUndo(bool bSet) { bAddUndo = bSet; }
61
62 const OUString& GetFileName() const { return aFileName; }
63 const OUString& GetFilterName() const { return aFilterName; }
64 const OUString& GetOptions() const { return aOptions; }
65
66 bool IsUsed() const;
67
68 DECL_LINK( RefreshHdl, Timer*, void );
69 DECL_LINK( TableEndEditHdl, ::sfx2::SvBaseLink&, void );
70};
71
72class ScDocument;
73class SfxMedium;
74class SfxFilter;
75
77{
78private:
82
83public:
84 ScDocumentLoader(const OUString& rFileName, OUString& rFilterName, OUString& rOptions,
85 sal_uInt32 nRekCnt = 0, weld::Window* pInteractionParent = nullptr,
86 css::uno::Reference<css::io::XInputStream> xInputStream
87 = css::uno::Reference<css::io::XInputStream>());
89 ScDocument* GetDocument();
90 ScDocShell* GetDocShell() { return pDocShell; }
91 bool IsError() const;
92 OUString GetTitle() const;
93
94 void ReleaseDocRef(); // without calling DoClose
95
99 static SfxMedium* CreateMedium(const OUString& rFileName, std::shared_ptr<const SfxFilter> const & pFilter,
100 const OUString& rOptions, weld::Window* pInteractionParent = nullptr);
101
102 static OUString GetOptions( const SfxMedium& rMedium );
103
110 static bool GetFilterName( const OUString& rFileName,
111 OUString& rFilter, OUString& rOptions,
112 bool bWithContent, bool bWithInteraction );
113
114 static void RemoveAppPrefix( OUString& rFilterName );
115};
116
117/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SfxObjectShellRef aRef
Definition: tablink.hxx:80
ScDocShell * pDocShell
Definition: tablink.hxx:79
ScDocShell * GetDocShell()
Definition: tablink.hxx:90
SfxMedium * pMedium
Definition: tablink.hxx:81
UNOTOOLS_DLLPUBLIC bool GetTitle(OUString const &url, OUString *title)
#define SC_DLLPUBLIC
Definition: scdllapi.h:27