/src/libreoffice/oox/source/drawingml/textspacingcontext.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/drawingml/drawingmltypes.hxx> |
21 | | #include <oox/helper/attributelist.hxx> |
22 | | #include <oox/token/namespaces.hxx> |
23 | | #include <oox/token/tokens.hxx> |
24 | | #include <drawingml/textspacing.hxx> |
25 | | #include "textspacingcontext.hxx" |
26 | | |
27 | | using namespace ::oox::core; |
28 | | using namespace ::com::sun::star::xml::sax; |
29 | | |
30 | | namespace oox::drawingml { |
31 | | |
32 | | TextSpacingContext::TextSpacingContext( ContextHandler2Helper const & rParent, TextSpacing & aSpacing ) |
33 | 135k | : ContextHandler2( rParent ) |
34 | 135k | , maSpacing( aSpacing ) |
35 | 135k | { |
36 | 135k | maSpacing.bHasValue = true; |
37 | 135k | } |
38 | | |
39 | | ContextHandlerRef TextSpacingContext::onCreateContext( ::sal_Int32 aElement, |
40 | | const AttributeList& rAttribs ) |
41 | 135k | { |
42 | 135k | switch( aElement ) |
43 | 135k | { |
44 | 95.6k | case A_TOKEN( spcPct ): |
45 | 95.6k | maSpacing.nUnit = TextSpacing::Unit::Percent; |
46 | 95.6k | maSpacing.nValue = GetPercent( rAttribs.getStringDefaulted( XML_val ) ); |
47 | 95.6k | break; |
48 | 39.9k | case A_TOKEN( spcPts ): |
49 | 39.9k | maSpacing.nUnit = TextSpacing::Unit::Points; |
50 | 39.9k | maSpacing.nValue = GetTextSpacingPoint( rAttribs.getStringDefaulted( XML_val ) ); |
51 | 39.9k | maSpacing.bExactValue = true; |
52 | 39.9k | break; |
53 | 0 | default: |
54 | 0 | break; |
55 | 135k | } |
56 | | |
57 | 135k | return this; |
58 | 135k | } |
59 | | |
60 | | } |
61 | | |
62 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |