LibreOffice Module sc (master)  1
sharedstringsfragment.cxx
Go to the documentation of this file.
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 
21 #include <biffhelper.hxx>
22 
23 #include <richstringcontext.hxx>
24 #include <sharedstringsbuffer.hxx>
25 #include <oox/token/namespaces.hxx>
26 
27 namespace oox::xls {
28 
29 using namespace ::oox::core;
30 
32  const WorkbookHelper& rHelper, const OUString& rFragmentPath ) :
33  WorkbookFragmentBase( rHelper, rFragmentPath )
34 {
35 }
36 
38 {
39  switch( getCurrentElement() )
40  {
41  case XML_ROOT_CONTEXT:
42  if( nElement == XLS_TOKEN( sst ) )
43  return this;
44  break;
45 
46  case XLS_TOKEN( sst ):
47  if( nElement == XLS_TOKEN( si ) )
48  return new RichStringContext( *this, getSharedStrings().createRichString() );
49  break;
50  }
51  return nullptr;
52 }
53 
55 {
56  switch( getCurrentElement() )
57  {
58  case XML_ROOT_CONTEXT:
59  if( nRecId == BIFF12_ID_SST )
60  return this;
61  break;
62 
63  case BIFF12_ID_SST:
64  if( nRecId == BIFF12_ID_SI )
65  getSharedStrings().createRichString()->importString( rStrm, true );
66  break;
67  }
68  return nullptr;
69 }
70 
71 const RecordInfo* SharedStringsFragment::getRecordInfos() const
72 {
73  static const RecordInfo spRecInfos[] =
74  {
76  { -1, -1 }
77  };
78  return spRecInfos;
79 }
80 
82 {
84 }
85 
86 } // namespace oox::xls
87 
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Helper class to provide access to global workbook data.
RichStringRef createRichString()
Creates and returns a new string entry.
const sal_Int32 BIFF12_ID_SI
Definition: biffhelper.hxx:223
SharedStringsFragment(const WorkbookHelper &rHelper, const OUString &rFragmentPath)
void finalizeImport()
Final processing after import of all strings.
Fragment handler derived from the WorkbookHelper helper class.
virtual const ::oox::core::RecordInfo * getRecordInfos() const override
const sal_Int32 BIFF12_ID_SST
Definition: biffhelper.hxx:224
virtual void finalizeImport() override
sal_Int32 getCurrentElement() const
virtual ::oox::core::ContextHandlerRef onCreateRecordContext(sal_Int32 nRecId, SequenceInputStream &rStrm) override
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
SharedStringsBuffer & getSharedStrings() const
Returns the shared strings read from the shared strings substream.
const sal_Int32 XML_ROOT_CONTEXT