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 : #include "sharedstringsfragment.hxx"
21 :
22 : #include "richstringcontext.hxx"
23 : #include "sharedstringsbuffer.hxx"
24 :
25 : namespace oox {
26 : namespace xls {
27 :
28 : using namespace ::oox::core;
29 :
30 90 : SharedStringsFragment::SharedStringsFragment(
31 : const WorkbookHelper& rHelper, const OUString& rFragmentPath ) :
32 90 : WorkbookFragmentBase( rHelper, rFragmentPath )
33 : {
34 90 : }
35 :
36 1454 : ContextHandlerRef SharedStringsFragment::onCreateContext( sal_Int32 nElement, const AttributeList& )
37 : {
38 1454 : switch( getCurrentElement() )
39 : {
40 : case XML_ROOT_CONTEXT:
41 90 : if( nElement == XLS_TOKEN( sst ) )
42 90 : return this;
43 0 : break;
44 :
45 : case XLS_TOKEN( sst ):
46 1364 : if( nElement == XLS_TOKEN( si ) )
47 1364 : return new RichStringContext( *this, getSharedStrings().createRichString() );
48 0 : break;
49 : }
50 0 : return 0;
51 : }
52 :
53 0 : ContextHandlerRef SharedStringsFragment::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm )
54 : {
55 0 : switch( getCurrentElement() )
56 : {
57 : case XML_ROOT_CONTEXT:
58 0 : if( nRecId == BIFF12_ID_SST )
59 0 : return this;
60 0 : break;
61 :
62 : case BIFF12_ID_SST:
63 0 : if( nRecId == BIFF12_ID_SI )
64 0 : getSharedStrings().createRichString()->importString( rStrm, true );
65 0 : break;
66 : }
67 0 : return 0;
68 : }
69 :
70 0 : const RecordInfo* SharedStringsFragment::getRecordInfos() const
71 : {
72 : static const RecordInfo spRecInfos[] =
73 : {
74 : { BIFF12_ID_SST, BIFF12_ID_SST + 1 },
75 : { -1, -1 }
76 : };
77 0 : return spRecInfos;
78 : }
79 :
80 90 : void SharedStringsFragment::finalizeImport()
81 : {
82 90 : getSharedStrings().finalizeImport();
83 90 : }
84 :
85 : } // namespace xls
86 48 : } // namespace oox
87 :
88 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|