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 5134 : 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 rtl::Reference < SvXMLImportPropertyMapper > &rMap ) :
40 : SvXMLPropertySetContext( rImport, nPrfx, rLName, xAttrList, nFam,
41 : rProps, rMap ),
42 5134 : mnBulletIndex(-1)
43 : {
44 5134 : }
45 :
46 9660 : XMLShapePropertySetContext::~XMLShapePropertySetContext()
47 : {
48 9660 : }
49 :
50 5134 : void XMLShapePropertySetContext::EndElement()
51 : {
52 5134 : Reference< container::XIndexReplace > xNumRule;
53 5134 : if( mxBulletStyle.Is() )
54 : {
55 154 : SvxXMLListStyleContext* pBulletStyle = static_cast<SvxXMLListStyleContext*>(&mxBulletStyle);
56 154 : xNumRule = SvxXMLListStyleContext::CreateNumRule( GetImport().GetModel() );
57 154 : if( xNumRule.is() )
58 154 : pBulletStyle->FillUnoNumRule(xNumRule, NULL /* const SvI18NMap * ??? */ );
59 : }
60 :
61 10268 : Any aAny;
62 5134 : aAny <<= xNumRule;
63 :
64 10268 : XMLPropertyState aPropState( mnBulletIndex, aAny );
65 5134 : mrProperties.push_back( aPropState );
66 :
67 10268 : SvXMLPropertySetContext::EndElement();
68 5134 : }
69 :
70 630 : 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 630 : SvXMLImportContext *pContext = 0;
78 :
79 630 : switch( mxMapper->getPropertySetMapper()->GetEntryContextId( rProp.mnIndex ) )
80 : {
81 : case CTF_NUMBERINGRULES:
82 154 : mnBulletIndex = rProp.mnIndex;
83 154 : mxBulletStyle = pContext = new SvxXMLListStyleContext( GetImport(), nPrefix, rLocalName, xAttrList );
84 154 : break;
85 : case CTF_TABSTOP:
86 476 : pContext = new SvxXMLTabStopImportContext( GetImport(), nPrefix,
87 : rLocalName, rProp,
88 476 : rProperties );
89 476 : break;
90 : }
91 :
92 630 : if( !pContext )
93 : pContext = SvXMLPropertySetContext::CreateChildContext( nPrefix, rLocalName,
94 : xAttrList,
95 0 : rProperties, rProp );
96 :
97 630 : return pContext;
98 : }
99 :
100 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|