1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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"
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
37 explicit ExternalSheetDataContext(
38 WorkbookFragmentBase
& rFragment
,
39 const css::uno::Reference
< css::sheet::XExternalSheetCache
>& rxSheetCache
);
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
;
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
);
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
75 explicit ExternalLinkFragment(
76 const WorkbookHelper
& rHelper
,
77 const OUString
& rFragmentPath
,
78 ExternalLink
& rExtLink
);
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
;
90 ::oox::core::ContextHandlerRef
createSheetDataContext( sal_Int32 nSheetId
);
93 ExternalLink
& mrExtLink
;
94 ExternalNameRef mxExtName
;
95 OUString maResultValue
;
96 sal_Int32 mnResultType
;
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */