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 .
22 #include "excelhandlers.hxx"
23 #include "externallinkbuffer.hxx"
27 /** This class implements importing the sheetData element in external sheets.
29 The sheetData element embedded in the externalBook element contains cached
30 cells from externally linked sheets.
32 class ExternalSheetDataContext
: public WorkbookContextBase
35 explicit ExternalSheetDataContext(
36 WorkbookFragmentBase
& rFragment
,
37 const css::uno::Reference
< css::sheet::XExternalSheetCache
>& rxSheetCache
);
40 virtual ::oox::core::ContextHandlerRef
onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
) override
;
41 virtual void onCharacters( const OUString
& rChars
) override
;
43 virtual ::oox::core::ContextHandlerRef
onCreateRecordContext( sal_Int32 nRecId
, SequenceInputStream
& rStrm
) override
;
46 /** Imports cell settings from a c element. */
47 void importCell( const AttributeList
& rAttribs
);
49 /** Imports the EXTCELL_BLANK from the passed stream. */
50 void importExtCellBlank( SequenceInputStream
& rStrm
);
51 /** Imports the EXTCELL_BOOL from the passed stream. */
52 void importExtCellBool( SequenceInputStream
& rStrm
);
53 /** Imports the EXTCELL_DOUBLE from the passed stream. */
54 void importExtCellDouble( SequenceInputStream
& rStrm
);
55 /** Imports the EXTCELL_ERROR from the passed stream. */
56 void importExtCellError( SequenceInputStream
& rStrm
);
57 /** Imports the EXTCELL_STRING from the passed stream. */
58 void importExtCellString( SequenceInputStream
& rStrm
);
60 /** Sets the passed cell value to the current position in the sheet cache. */
61 void setCellValue( const css::uno::Any
& rValue
);
64 css::uno::Reference
< css::sheet::XExternalSheetCache
>
65 mxSheetCache
; /// The sheet cache used to store external cell values.
66 ScAddress maCurrPos
; /// Position of current cell.
67 sal_Int32 mnCurrType
; /// Data type of current cell.
70 class ExternalLinkFragment
: public WorkbookFragmentBase
73 explicit ExternalLinkFragment(
74 const WorkbookHelper
& rHelper
,
75 const OUString
& rFragmentPath
,
76 ExternalLink
& rExtLink
);
79 virtual ::oox::core::ContextHandlerRef
onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
) override
;
80 virtual void onCharacters( const OUString
& rChars
) override
;
81 virtual void onEndElement() override
;
83 virtual ::oox::core::ContextHandlerRef
onCreateRecordContext( sal_Int32 nRecId
, SequenceInputStream
& rStrm
) override
;
85 virtual const ::oox::core::RecordInfo
* getRecordInfos() const override
;
88 ::oox::core::ContextHandlerRef
createSheetDataContext( sal_Int32 nSheetId
);
91 ExternalLink
& mrExtLink
;
92 ExternalNameRef mxExtName
;
93 OUString maResultValue
;
94 sal_Int32 mnResultType
;
97 } // namespace oox::xls
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */