| 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 "refreshtimer.hxx" |
| 23 | #include "address.hxx" |
| 24 | #include <sfx2/lnkbase.hxx> |
| 25 | #include "scdllapi.h" |
| 26 | |
| 27 | class ScDocShell; |
| 28 | |
| 29 | class SAL_DLLPUBLIC_RTTI ScAreaLink final : public ::sfx2::SvBaseLink, public ScRefreshTimer |
| 30 | { |
| 31 | private: |
| 32 | ScDocShell& m_rDocSh; |
| 33 | OUString aFileName; |
| 34 | OUString aFilterName; |
| 35 | OUString aOptions; |
| 36 | OUString aSourceArea; |
| 37 | ScRange aDestArea; |
| 38 | bool bAddUndo; |
| 39 | bool bInCreate; |
| 40 | bool bDoInsert; // is set to FALSE for first update |
| 41 | static bool FindExtRange( ScRange& rRange, const ScDocument& rSrcDoc, const OUString& rAreaName ); |
| 42 | |
| 43 | public: |
| 44 | SC_DLLPUBLIC ScAreaLink( ScDocShell& rShell, OUString aFile, |
| 45 | OUString aFilter, OUString aOpt, |
| 46 | OUString aArea, const ScRange& rDest, sal_Int32 nRefreshDelaySeconds ); |
| 47 | virtual ~ScAreaLink() override; |
| 48 | |
| 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& rNewArea, sal_Int32 nRefreshDelaySeconds ); |
| 57 | |
| 58 | void SetInCreate(bool bSet) { bInCreate = bSet; } |
| 59 | void SetDoInsert(bool bSet) { bDoInsert = bSet; } |
| 60 | void SetDestArea(const ScRange& rNew); |
| 61 | void SetSource(const OUString& rDoc, const OUString& rFlt, const OUString& rOpt, |
| 62 | const OUString& rArea); |
| 63 | |
| 64 | bool IsEqual( std::u16string_view rFile, std::u16string_view rFilter, std::u16string_view rOpt, |
| 65 | std::u16string_view rSource, const ScRange& rDest ) const; |
| 66 | |
| 67 | const OUString& GetFile() const { return aFileName; } |
| 68 | const OUString& GetFilter() const { return aFilterName; } |
| 69 | const OUString& GetOptions() const { return aOptions; } |
| 70 | const OUString& GetSource() const { return aSourceArea; } |
| 71 | const ScRange& GetDestArea() const { return aDestArea; } |
| 72 | |
| 73 | DECL_DLLPRIVATE_LINK( RefreshHdl, Timer*, void ); |
| 74 | }; |
| 75 | |
| 76 | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |