Update git submodules
[LibreOffice.git] / sc / source / filter / oox / sharedstringsfragment.cxx
blob841d2b1d3a3c294850ca19dbc1820fb48678cff0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #include <sharedstringsfragment.hxx>
21 #include <biffhelper.hxx>
23 #include <richstringcontext.hxx>
24 #include <sharedstringsbuffer.hxx>
25 #include <oox/token/namespaces.hxx>
27 namespace oox::xls {
29 using namespace ::oox::core;
31 SharedStringsFragment::SharedStringsFragment(
32 const WorkbookHelper& rHelper, const OUString& rFragmentPath ) :
33 WorkbookFragmentBase( rHelper, rFragmentPath )
37 ContextHandlerRef SharedStringsFragment::onCreateContext( sal_Int32 nElement, const AttributeList& )
39 switch( getCurrentElement() )
41 case XML_ROOT_CONTEXT:
42 if( nElement == XLS_TOKEN( sst ) )
43 return this;
44 break;
46 case XLS_TOKEN( sst ):
47 if( nElement == XLS_TOKEN( si ) )
48 return new RichStringContext( *this, getSharedStrings().createRichString() );
49 break;
51 return nullptr;
54 ContextHandlerRef SharedStringsFragment::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm )
56 switch( getCurrentElement() )
58 case XML_ROOT_CONTEXT:
59 if( nRecId == BIFF12_ID_SST )
60 return this;
61 break;
63 case BIFF12_ID_SST:
64 if( nRecId == BIFF12_ID_SI )
65 getSharedStrings().createRichString()->importString( rStrm, true, *this );
66 break;
68 return nullptr;
71 const RecordInfo* SharedStringsFragment::getRecordInfos() const
73 static const RecordInfo spRecInfos[] =
75 { BIFF12_ID_SST, BIFF12_ID_SST + 1 },
76 { -1, -1 }
78 return spRecInfos;
81 void SharedStringsFragment::finalizeImport()
83 getSharedStrings().finalizeImport();
86 } // namespace oox::xls
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */