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