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