Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef OOX_XLS_EXTERNALLINKFRAGMENT_HXX
30 : : #define OOX_XLS_EXTERNALLINKFRAGMENT_HXX
31 : :
32 : : #include "excelhandlers.hxx"
33 : : #include "externallinkbuffer.hxx"
34 : :
35 : : namespace oox {
36 : : namespace xls {
37 : :
38 : : class ExternalLink;
39 : :
40 : : // ============================================================================
41 : : // ============================================================================
42 : :
43 : : /** This class implements importing the sheetData element in external sheets.
44 : :
45 : : The sheetData element embedded in the externalBook element contains cached
46 : : cells from externally linked sheets.
47 : : */
48 [ # # ]: 0 : class ExternalSheetDataContext : public WorkbookContextBase
49 : : {
50 : : public:
51 : : explicit ExternalSheetDataContext(
52 : : WorkbookFragmentBase& rFragment,
53 : : const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XExternalSheetCache >& rxSheetCache );
54 : :
55 : : protected:
56 : : virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
57 : : virtual void onCharacters( const ::rtl::OUString& rChars );
58 : :
59 : : virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
60 : :
61 : : private:
62 : : /** Imports cell settings from a c element. */
63 : : void importCell( const AttributeList& rAttribs );
64 : :
65 : : /** Imports the EXTCELL_BLANK from the passed stream. */
66 : : void importExtCellBlank( SequenceInputStream& rStrm );
67 : : /** Imports the EXTCELL_BOOL from the passed stream. */
68 : : void importExtCellBool( SequenceInputStream& rStrm );
69 : : /** Imports the EXTCELL_DOUBLE from the passed stream. */
70 : : void importExtCellDouble( SequenceInputStream& rStrm );
71 : : /** Imports the EXTCELL_ERROR from the passed stream. */
72 : : void importExtCellError( SequenceInputStream& rStrm );
73 : : /** Imports the EXTCELL_STRING from the passed stream. */
74 : : void importExtCellString( SequenceInputStream& rStrm );
75 : :
76 : : /** Sets the passed cell value to the current position in the sheet cache. */
77 : : void setCellValue( const ::com::sun::star::uno::Any& rValue );
78 : :
79 : : private:
80 : : ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XExternalSheetCache >
81 : : mxSheetCache; /// The sheet cache used to store external cell values.
82 : : ::com::sun::star::table::CellAddress maCurrPos; /// Position of current cell.
83 : : sal_Int32 mnCurrType; /// Data type of current cell.
84 : : };
85 : :
86 : : // ============================================================================
87 : :
88 [ # # ][ # # ]: 0 : class ExternalLinkFragment : public WorkbookFragmentBase
89 : : {
90 : : public:
91 : : explicit ExternalLinkFragment(
92 : : const WorkbookHelper& rHelper,
93 : : const ::rtl::OUString& rFragmentPath,
94 : : ExternalLink& rExtLink );
95 : :
96 : : protected:
97 : : virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
98 : : virtual void onCharacters( const ::rtl::OUString& rChars );
99 : : virtual void onEndElement();
100 : :
101 : : virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
102 : :
103 : : virtual const ::oox::core::RecordInfo* getRecordInfos() const;
104 : :
105 : : private:
106 : : ::oox::core::ContextHandlerRef createSheetDataContext( sal_Int32 nSheetId );
107 : :
108 : : private:
109 : : ExternalLink& mrExtLink;
110 : : ExternalNameRef mxExtName;
111 : : ::rtl::OUString maResultValue;
112 : : sal_Int32 mnResultType;
113 : : };
114 : :
115 : : // ============================================================================
116 : :
117 : : } // namespace xls
118 : : } // namespace oox
119 : :
120 : : #endif
121 : :
122 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|