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 INCLUDED_SC_SOURCE_FILTER_XML_XMLEXTERNALTABI_HXX 21 #define INCLUDED_SC_SOURCE_FILTER_XML_XMLEXTERNALTABI_HXX 22 23 #include <rtl/ustrbuf.hxx> 24 #include "importcontext.hxx" 25 26 namespace sax_fastparser { class FastAttributeList; } 27 28 class ScXMLImport; 29 struct ScXMLExternalTabData; 30 31 class ScXMLExternalRefTabSourceContext : public ScXMLImportContext 32 { 33 public: 34 ScXMLExternalRefTabSourceContext( ScXMLImport& rImport, 35 const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList, 36 ScXMLExternalTabData& rRefInfo ); 37 38 virtual ~ScXMLExternalRefTabSourceContext() override; 39 40 virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override; 41 42 private: 43 ScXMLExternalTabData& mrExternalRefInfo; 44 45 OUString maRelativeUrl; 46 OUString maFilterName; 47 OUString maFilterOptions; 48 }; 49 50 class ScXMLExternalRefRowsContext : public ScXMLImportContext 51 { 52 public: 53 ScXMLExternalRefRowsContext( ScXMLImport& rImport, 54 ScXMLExternalTabData& rRefInfo ); 55 56 virtual ~ScXMLExternalRefRowsContext() override; 57 58 virtual css::uno::Reference< XFastContextHandler > SAL_CALL createFastChildContext( 59 sal_Int32 nElement, 60 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override; 61 62 private: 63 ScXMLExternalTabData& mrExternalRefInfo; 64 }; 65 66 class ScXMLExternalRefRowContext : public ScXMLImportContext 67 { 68 public: 69 ScXMLExternalRefRowContext( ScXMLImport& rImport, 70 const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList, 71 ScXMLExternalTabData& rRefInfo ); 72 73 virtual ~ScXMLExternalRefRowContext() override; 74 75 virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override; 76 77 virtual css::uno::Reference< XFastContextHandler > SAL_CALL createFastChildContext( 78 sal_Int32 nElement, 79 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override; 80 81 private: 82 ScXMLImport& mrScImport; 83 ScXMLExternalTabData& mrExternalRefInfo; 84 sal_Int32 mnRepeatRowCount; 85 }; 86 87 class ScXMLExternalRefCellContext : public ScXMLImportContext 88 { 89 public: 90 ScXMLExternalRefCellContext( ScXMLImport& rImport, 91 const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList, 92 ScXMLExternalTabData& rRefInfo ); 93 94 virtual ~ScXMLExternalRefCellContext() override; 95 96 virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override; 97 98 virtual css::uno::Reference< XFastContextHandler > SAL_CALL createFastChildContext( 99 sal_Int32 nElement, 100 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override; 101 102 void SetCellString(const OUString& rStr); 103 104 private: 105 ScXMLImport& mrScImport; 106 ScXMLExternalTabData& mrExternalRefInfo; 107 OUString maCellString; 108 double mfCellValue; 109 sal_Int32 mnRepeatCount; 110 sal_Int32 mnNumberFormat; 111 sal_Int16 mnCellType; // TODO: import to document core 112 bool mbIsNumeric; 113 bool mbIsEmpty; 114 }; 115 116 class ScXMLExternalRefCellTextContext : public ScXMLImportContext 117 { 118 public: 119 ScXMLExternalRefCellTextContext( ScXMLImport& rImport, 120 ScXMLExternalRefCellContext& rParent ); 121 122 virtual ~ScXMLExternalRefCellTextContext() override; 123 124 virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override; 125 virtual void SAL_CALL characters( const OUString& rChars ) override; 126 127 private: 128 ScXMLExternalRefCellContext& mrParent; 129 130 OUStringBuffer maCellStrBuf; 131 }; 132 133 #endif 134 135 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 136