Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / sc / source / filter / inc / externallinkfragment.hxx
blobe2964c961401657aadf1efbf5bbea72f94cbdfd6
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_SOURCE_FILTER_INC_EXTERNALLINKFRAGMENT_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_EXTERNALLINKFRAGMENT_HXX
23 #include "excelhandlers.hxx"
24 #include "externallinkbuffer.hxx"
26 namespace oox {
27 namespace xls {
29 /** This class implements importing the sheetData element in external sheets.
31 The sheetData element embedded in the externalBook element contains cached
32 cells from externally linked sheets.
34 class ExternalSheetDataContext : public WorkbookContextBase
36 public:
37 explicit ExternalSheetDataContext(
38 WorkbookFragmentBase& rFragment,
39 const css::uno::Reference< css::sheet::XExternalSheetCache >& rxSheetCache );
41 protected:
42 virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
43 virtual void onCharacters( const OUString& rChars ) override;
45 virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ) override;
47 private:
48 /** Imports cell settings from a c element. */
49 void importCell( const AttributeList& rAttribs );
51 /** Imports the EXTCELL_BLANK from the passed stream. */
52 void importExtCellBlank( SequenceInputStream& rStrm );
53 /** Imports the EXTCELL_BOOL from the passed stream. */
54 void importExtCellBool( SequenceInputStream& rStrm );
55 /** Imports the EXTCELL_DOUBLE from the passed stream. */
56 void importExtCellDouble( SequenceInputStream& rStrm );
57 /** Imports the EXTCELL_ERROR from the passed stream. */
58 void importExtCellError( SequenceInputStream& rStrm );
59 /** Imports the EXTCELL_STRING from the passed stream. */
60 void importExtCellString( SequenceInputStream& rStrm );
62 /** Sets the passed cell value to the current position in the sheet cache. */
63 void setCellValue( const css::uno::Any& rValue );
65 private:
66 css::uno::Reference< css::sheet::XExternalSheetCache >
67 mxSheetCache; /// The sheet cache used to store external cell values.
68 ScAddress maCurrPos; /// Position of current cell.
69 sal_Int32 mnCurrType; /// Data type of current cell.
72 class ExternalLinkFragment : public WorkbookFragmentBase
74 public:
75 explicit ExternalLinkFragment(
76 const WorkbookHelper& rHelper,
77 const OUString& rFragmentPath,
78 ExternalLink& rExtLink );
80 protected:
81 virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
82 virtual void onCharacters( const OUString& rChars ) override;
83 virtual void onEndElement() override;
85 virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ) override;
87 virtual const ::oox::core::RecordInfo* getRecordInfos() const override;
89 private:
90 ::oox::core::ContextHandlerRef createSheetDataContext( sal_Int32 nSheetId );
92 private:
93 ExternalLink& mrExtLink;
94 ExternalNameRef mxExtName;
95 OUString maResultValue;
96 sal_Int32 mnResultType;
99 } // namespace xls
100 } // namespace oox
102 #endif
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */