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