Branch data 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 : :
21 : : #include "XMLShapePropertySetContext.hxx"
22 : : #include <xmloff/xmlimp.hxx>
23 : : #include <xmloff/xmlnumi.hxx>
24 : : #include "xmltabi.hxx"
25 : : #include <xmloff/txtprmap.hxx>
26 : :
27 : : #include "sdpropls.hxx"
28 : :
29 : : using ::rtl::OUString;
30 : : using ::rtl::OUStringBuffer;
31 : :
32 : : using namespace ::com::sun::star;
33 : : using namespace ::com::sun::star::uno;
34 : :
35 : : //////////////////////////////////////////////////////////////////////////////
36 : :
37 [ # # ][ # # ]: 0 : TYPEINIT1( XMLShapePropertySetContext, SvXMLPropertySetContext );
38 : :
39 : 1052 : XMLShapePropertySetContext::XMLShapePropertySetContext(
40 : : SvXMLImport& rImport, sal_uInt16 nPrfx,
41 : : const OUString& rLName,
42 : : const Reference< xml::sax::XAttributeList > & xAttrList,
43 : : sal_uInt32 nFam,
44 : : ::std::vector< XMLPropertyState > &rProps,
45 : : const UniReference < SvXMLImportPropertyMapper > &rMap ) :
46 : : SvXMLPropertySetContext( rImport, nPrfx, rLName, xAttrList, nFam,
47 : : rProps, rMap ),
48 : 1052 : mnBulletIndex(-1)
49 : : {
50 : 1052 : }
51 : :
52 [ + - ]: 1052 : XMLShapePropertySetContext::~XMLShapePropertySetContext()
53 : : {
54 [ - + ]: 2064 : }
55 : :
56 : 1052 : void XMLShapePropertySetContext::EndElement()
57 : : {
58 : 1052 : Reference< container::XIndexReplace > xNumRule;
59 [ + + ]: 1052 : if( mxBulletStyle.Is() )
60 : : {
61 : 32 : SvxXMLListStyleContext* pBulletStyle = (SvxXMLListStyleContext*)&mxBulletStyle;
62 [ + - ][ + - ]: 32 : xNumRule = pBulletStyle->CreateNumRule( GetImport().GetModel() );
63 [ + - ]: 32 : if( xNumRule.is() )
64 [ + - ]: 32 : pBulletStyle->FillUnoNumRule(xNumRule, NULL /* const SvI18NMap * ??? */ );
65 : : }
66 : :
67 : 1052 : Any aAny;
68 [ + - ]: 1052 : aAny <<= xNumRule;
69 : :
70 : 1052 : XMLPropertyState aPropState( mnBulletIndex, aAny );
71 [ + - ]: 1052 : mrProperties.push_back( aPropState );
72 : :
73 [ + - ]: 1052 : SvXMLPropertySetContext::EndElement();
74 : 1052 : }
75 : :
76 : 115 : SvXMLImportContext *XMLShapePropertySetContext::CreateChildContext(
77 : : sal_uInt16 nPrefix,
78 : : const OUString& rLocalName,
79 : : const Reference< xml::sax::XAttributeList > & xAttrList,
80 : : ::std::vector< XMLPropertyState > &rProperties,
81 : : const XMLPropertyState& rProp )
82 : : {
83 : 115 : SvXMLImportContext *pContext = 0;
84 : :
85 [ + + - ]: 115 : switch( mxMapper->getPropertySetMapper()->GetEntryContextId( rProp.mnIndex ) )
86 : : {
87 : : case CTF_NUMBERINGRULES:
88 : 32 : mnBulletIndex = rProp.mnIndex;
89 [ + - ]: 32 : mxBulletStyle = pContext = new SvxXMLListStyleContext( GetImport(), nPrefix, rLocalName, xAttrList );
90 : 32 : break;
91 : : case CTF_TABSTOP:
92 : 83 : pContext = new SvxXMLTabStopImportContext( GetImport(), nPrefix,
93 : : rLocalName, rProp,
94 [ + - ]: 83 : rProperties );
95 : 83 : break;
96 : : }
97 : :
98 [ - + ]: 115 : if( !pContext )
99 : : pContext = SvXMLPropertySetContext::CreateChildContext( nPrefix, rLocalName,
100 : : xAttrList,
101 : 0 : rProperties, rProp );
102 : :
103 : 115 : return pContext;
104 : : }
105 : :
106 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|