Coverage Report

Created: 2025-11-16 09:57

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sc/inc/tablink.hxx
Line
Count
Source
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
29
class ScDocShell;
30
31
namespace weld { class Window; }
32
33
class ScTableLink final : public ::sfx2::SvBaseLink, public ScRefreshTimer
34
{
35
private:
36
    ScDocShell&            m_rDocSh;
37
    Link<sfx2::SvBaseLink&,void> m_aEndEditLink;
38
    OUString aFileName;
39
    OUString aFilterName;
40
    OUString aOptions;
41
    bool bInCreate:1;
42
    bool bInEdit:1;
43
    bool bAddUndo:1;
44
45
public:
46
    ScTableLink( ScDocShell& rDocSh, OUString aFile,
47
                    OUString aFilter, OUString aOpt, sal_Int32 nRefreshDelaySeconds );
48
    virtual ~ScTableLink() override;
49
    virtual void Closed() override;
50
    virtual ::sfx2::SvBaseLink::UpdateResult DataChanged(
51
        const OUString& rMimeType, const css::uno::Any & rValue ) override;
52
53
    virtual void    Edit(weld::Window*, const Link<SvBaseLink&,void>& rEndEditHdl) override;
54
55
    bool    Refresh(const OUString& rNewFile, const OUString& rNewFilter,
56
                    const OUString* pNewOptions /* = NULL */, sal_Int32 nNewRefreshDelaySeconds );
57
0
    void    SetInCreate(bool bSet)      { bInCreate = bSet; }
58
0
    void    SetAddUndo(bool bSet)       { bAddUndo = bSet; }
59
60
0
    const OUString& GetFileName() const   { return aFileName; }
61
0
    const OUString& GetFilterName() const { return aFilterName; }
62
0
    const OUString& GetOptions() const    { return aOptions; }
63
64
    bool    IsUsed() const;
65
66
    DECL_LINK( TableEndEditHdl, ::sfx2::SvBaseLink&, void );
67
};
68
69
class ScDocument;
70
class SfxMedium;
71
class SfxFilter;
72
73
class SC_DLLPUBLIC ScDocumentLoader
74
{
75
private:
76
    rtl::Reference<ScDocShell> pDocShell;
77
    SfxMedium*          pMedium;
78
79
public:
80
    ScDocumentLoader(const OUString& rFileName, OUString& rFilterName, OUString& rOptions,
81
                     sal_uInt32 nRekCnt = 0, weld::Window* pInteractionParent = nullptr,
82
                     const css::uno::Reference<css::io::XInputStream>& xInputStream
83
                     = css::uno::Reference<css::io::XInputStream>());
84
    ~ScDocumentLoader();
85
    ScDocument*         GetDocument();
86
0
    ScDocShell*         GetDocShell()       { return pDocShell.get(); }
87
    bool                IsError() const;
88
89
    void                ReleaseDocRef();    // without calling DoClose
90
91
    /** Create SfxMedium for stream read with SfxFilter and filter options set
92
        at the medium's SfxItemSet.
93
     */
94
    static SfxMedium*   CreateMedium(const OUString& rFileName, std::shared_ptr<const SfxFilter> const & pFilter,
95
                                     const OUString& rOptions, weld::Window* pInteractionParent = nullptr);
96
97
    static OUString     GetOptions( const SfxMedium& rMedium );
98
99
    /** Returns the filter name and options from a file name.
100
        @param bWithContent
101
            true = Tries to detect the filter by looking at the file contents.
102
            false = Detects filter by file name extension only (should be used in filter code only).
103
        @return sal_True if a filter could be found, sal_False otherwise. */
104
105
    static bool         GetFilterName( const OUString& rFileName,
106
                                       OUString& rFilter, OUString& rOptions,
107
                                       bool bWithContent, bool bWithInteraction );
108
109
    static void         RemoveAppPrefix( OUString& rFilterName );
110
};
111
112
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */