Line data Source code
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 : #ifndef OOX_XLS_EXTERNALLINKFRAGMENT_HXX
21 : #define OOX_XLS_EXTERNALLINKFRAGMENT_HXX
22 :
23 : #include "excelhandlers.hxx"
24 : #include "externallinkbuffer.hxx"
25 :
26 : namespace oox {
27 : namespace xls {
28 :
29 : class ExternalLink;
30 :
31 :
32 : /** This class implements importing the sheetData element in external sheets.
33 :
34 : The sheetData element embedded in the externalBook element contains cached
35 : cells from externally linked sheets.
36 : */
37 0 : class ExternalSheetDataContext : public WorkbookContextBase
38 : {
39 : public:
40 : explicit ExternalSheetDataContext(
41 : WorkbookFragmentBase& rFragment,
42 : const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XExternalSheetCache >& rxSheetCache );
43 :
44 : protected:
45 : virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) SAL_OVERRIDE;
46 : virtual void onCharacters( const OUString& rChars ) SAL_OVERRIDE;
47 :
48 : virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ) SAL_OVERRIDE;
49 :
50 : private:
51 : /** Imports cell settings from a c element. */
52 : void importCell( const AttributeList& rAttribs );
53 :
54 : /** Imports the EXTCELL_BLANK from the passed stream. */
55 : void importExtCellBlank( SequenceInputStream& rStrm );
56 : /** Imports the EXTCELL_BOOL from the passed stream. */
57 : void importExtCellBool( SequenceInputStream& rStrm );
58 : /** Imports the EXTCELL_DOUBLE from the passed stream. */
59 : void importExtCellDouble( SequenceInputStream& rStrm );
60 : /** Imports the EXTCELL_ERROR from the passed stream. */
61 : void importExtCellError( SequenceInputStream& rStrm );
62 : /** Imports the EXTCELL_STRING from the passed stream. */
63 : void importExtCellString( SequenceInputStream& rStrm );
64 :
65 : /** Sets the passed cell value to the current position in the sheet cache. */
66 : void setCellValue( const ::com::sun::star::uno::Any& rValue );
67 :
68 : private:
69 : ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XExternalSheetCache >
70 : mxSheetCache; /// The sheet cache used to store external cell values.
71 : ::com::sun::star::table::CellAddress maCurrPos; /// Position of current cell.
72 : sal_Int32 mnCurrType; /// Data type of current cell.
73 : };
74 :
75 0 : class ExternalLinkFragment : public WorkbookFragmentBase
76 : {
77 : public:
78 : explicit ExternalLinkFragment(
79 : const WorkbookHelper& rHelper,
80 : const OUString& rFragmentPath,
81 : ExternalLink& rExtLink );
82 :
83 : protected:
84 : virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) SAL_OVERRIDE;
85 : virtual void onCharacters( const OUString& rChars ) SAL_OVERRIDE;
86 : virtual void onEndElement() SAL_OVERRIDE;
87 :
88 : virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ) SAL_OVERRIDE;
89 :
90 : virtual const ::oox::core::RecordInfo* getRecordInfos() const SAL_OVERRIDE;
91 :
92 : private:
93 : ::oox::core::ContextHandlerRef createSheetDataContext( sal_Int32 nSheetId );
94 :
95 : private:
96 : ExternalLink& mrExtLink;
97 : ExternalNameRef mxExtName;
98 : OUString maResultValue;
99 : sal_Int32 mnResultType;
100 : };
101 :
102 : } // namespace xls
103 : } // namespace oox
104 :
105 : #endif
106 :
107 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|