/src/libreoffice/oox/source/ppt/customshowlistcontext.cxx
Line | Count | Source |
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 <oox/ppt/customshowlistcontext.hxx> |
21 | | |
22 | | #include <oox/helper/attributelist.hxx> |
23 | | #include <oox/token/namespaces.hxx> |
24 | | #include <oox/token/tokens.hxx> |
25 | | #include <sax/fastattribs.hxx> |
26 | | |
27 | | using namespace ::oox::core; |
28 | | using namespace ::com::sun::star::uno; |
29 | | using namespace ::com::sun::star::xml::sax; |
30 | | |
31 | | namespace oox::ppt { |
32 | | |
33 | | namespace { |
34 | | |
35 | | class CustomShowContext : public ::oox::core::FragmentHandler2 |
36 | | { |
37 | | std::vector< CustomShow >& mrCustomShowList; |
38 | | |
39 | | public: |
40 | | CustomShowContext( ::oox::core::FragmentHandler2 const & rParent, |
41 | | const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttribs, |
42 | | std::vector< CustomShow >& rCustomShowList ); |
43 | | |
44 | | virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) override; |
45 | | }; |
46 | | |
47 | | } |
48 | | |
49 | | CustomShowContext::CustomShowContext( FragmentHandler2 const & rParent, |
50 | | const Reference< XFastAttributeList >& rxAttribs, |
51 | | std::vector< CustomShow >& rCustomShowList ) |
52 | 0 | : FragmentHandler2( rParent ) |
53 | 0 | , mrCustomShowList( rCustomShowList ) |
54 | 0 | { |
55 | 0 | CustomShow aCustomShow; |
56 | 0 | aCustomShow.maCustomShowName = rxAttribs->getOptionalValue( XML_name ); |
57 | 0 | aCustomShow.mnId = rxAttribs->getOptionalValue( XML_id ); |
58 | 0 | mrCustomShowList.push_back(std::move(aCustomShow)); |
59 | 0 | } |
60 | | |
61 | | ::oox::core::ContextHandlerRef CustomShowContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) |
62 | 0 | { |
63 | 0 | switch( aElementToken ) |
64 | 0 | { |
65 | 0 | case PPT_TOKEN( sld ) : |
66 | 0 | mrCustomShowList.back().maSldLst.push_back( |
67 | 0 | getRelations() |
68 | 0 | .getRelationFromRelId(rAttribs.getStringDefaulted(R_TOKEN(id))) |
69 | 0 | ->maTarget); |
70 | 0 | return this; |
71 | 0 | default: |
72 | 0 | break; |
73 | 0 | } |
74 | | |
75 | 0 | return this; |
76 | 0 | } |
77 | | |
78 | | CustomShowListContext::CustomShowListContext( FragmentHandler2 const & rParent, |
79 | | std::vector< CustomShow >& rCustomShowList ) |
80 | 28 | : FragmentHandler2( rParent ) |
81 | 28 | , mrCustomShowList( rCustomShowList ) |
82 | 28 | { |
83 | 28 | } |
84 | | |
85 | | CustomShowListContext::~CustomShowListContext( ) |
86 | 28 | { |
87 | 28 | } |
88 | | |
89 | | ::oox::core::ContextHandlerRef CustomShowListContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) |
90 | 0 | { |
91 | 0 | switch( aElementToken ) |
92 | 0 | { |
93 | 0 | case PPT_TOKEN( custShow ) : |
94 | 0 | { |
95 | 0 | return new CustomShowContext( *this, rAttribs.getFastAttributeList(), mrCustomShowList ); |
96 | 0 | } |
97 | 0 | default: |
98 | 0 | break; |
99 | 0 | } |
100 | | |
101 | 0 | return this; |
102 | 0 | } |
103 | | |
104 | | } |
105 | | |
106 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |