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"
31 /** This class implements importing the sheetData element in external sheets.
33 The sheetData element embedded in the externalBook element contains cached
34 cells from externally linked sheets.
36 class ExternalSheetDataContext
: public WorkbookContextBase
39 explicit ExternalSheetDataContext(
40 WorkbookFragmentBase
& rFragment
,
41 const ::com::sun::star::uno::Reference
< ::com::sun::star::sheet::XExternalSheetCache
>& rxSheetCache
);
44 virtual ::oox::core::ContextHandlerRef
onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
) SAL_OVERRIDE
;
45 virtual void onCharacters( const OUString
& rChars
) SAL_OVERRIDE
;
47 virtual ::oox::core::ContextHandlerRef
onCreateRecordContext( sal_Int32 nRecId
, SequenceInputStream
& rStrm
) SAL_OVERRIDE
;
50 /** Imports cell settings from a c element. */
51 void importCell( const AttributeList
& rAttribs
);
53 /** Imports the EXTCELL_BLANK from the passed stream. */
54 void importExtCellBlank( SequenceInputStream
& rStrm
);
55 /** Imports the EXTCELL_BOOL from the passed stream. */
56 void importExtCellBool( SequenceInputStream
& rStrm
);
57 /** Imports the EXTCELL_DOUBLE from the passed stream. */
58 void importExtCellDouble( SequenceInputStream
& rStrm
);
59 /** Imports the EXTCELL_ERROR from the passed stream. */
60 void importExtCellError( SequenceInputStream
& rStrm
);
61 /** Imports the EXTCELL_STRING from the passed stream. */
62 void importExtCellString( SequenceInputStream
& rStrm
);
64 /** Sets the passed cell value to the current position in the sheet cache. */
65 void setCellValue( const ::com::sun::star::uno::Any
& rValue
);
68 ::com::sun::star::uno::Reference
< ::com::sun::star::sheet::XExternalSheetCache
>
69 mxSheetCache
; /// The sheet cache used to store external cell values.
70 ::com::sun::star::table::CellAddress maCurrPos
; /// Position of current cell.
71 sal_Int32 mnCurrType
; /// Data type of current cell.
74 class ExternalLinkFragment
: public WorkbookFragmentBase
77 explicit ExternalLinkFragment(
78 const WorkbookHelper
& rHelper
,
79 const OUString
& rFragmentPath
,
80 ExternalLink
& rExtLink
);
83 virtual ::oox::core::ContextHandlerRef
onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
) SAL_OVERRIDE
;
84 virtual void onCharacters( const OUString
& rChars
) SAL_OVERRIDE
;
85 virtual void onEndElement() SAL_OVERRIDE
;
87 virtual ::oox::core::ContextHandlerRef
onCreateRecordContext( sal_Int32 nRecId
, SequenceInputStream
& rStrm
) SAL_OVERRIDE
;
89 virtual const ::oox::core::RecordInfo
* getRecordInfos() const SAL_OVERRIDE
;
92 ::oox::core::ContextHandlerRef
createSheetDataContext( sal_Int32 nSheetId
);
95 ExternalLink
& mrExtLink
;
96 ExternalNameRef mxExtName
;
97 OUString maResultValue
;
98 sal_Int32 mnResultType
;
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */