update dev300-m58
[ooovba.git] / xmloff / source / text / XMLTextPropertySetContext.cxx
blobde4f034b3ff140badc717fc2866b8ccef52fc733
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: XMLTextPropertySetContext.cxx,v $
10 * $Revision: 1.16 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_xmloff.hxx"
33 #include <tools/debug.hxx>
34 #include "XMLTextPropertySetContext.hxx"
35 #include "XMLTextColumnsContext.hxx"
36 #include "XMLBackgroundImageContext.hxx"
37 #include "XMLSectionFootnoteConfigImport.hxx"
39 #ifndef _XMLOFF_TXTPRMAP_HXX
40 #include <xmloff/txtprmap.hxx>
41 #endif
42 #include "xmltabi.hxx"
43 #ifndef _XMLOFF_TXTDROPI_HXX
44 #include "txtdropi.hxx"
45 #endif
47 using ::rtl::OUString;
49 using namespace ::com::sun::star::uno;
50 using namespace ::com::sun::star;
52 XMLTextPropertySetContext::XMLTextPropertySetContext(
53 SvXMLImport& rImport, sal_uInt16 nPrfx,
54 const OUString& rLName,
55 const Reference< xml::sax::XAttributeList > & xAttrList,
56 sal_uInt32 nFamily,
57 ::std::vector< XMLPropertyState > &rProps,
58 const UniReference < SvXMLImportPropertyMapper > &rMap,
59 OUString& rDCTextStyleName ) :
60 SvXMLPropertySetContext( rImport, nPrfx, rLName, xAttrList, nFamily,
61 rProps, rMap ),
62 rDropCapTextStyleName( rDCTextStyleName )
66 XMLTextPropertySetContext::~XMLTextPropertySetContext()
70 SvXMLImportContext *XMLTextPropertySetContext::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 )
77 SvXMLImportContext *pContext = 0;
79 switch( mxMapper->getPropertySetMapper()
80 ->GetEntryContextId( rProp.mnIndex ) )
82 case CTF_TABSTOP:
83 pContext = new SvxXMLTabStopImportContext( GetImport(), nPrefix,
84 rLocalName, rProp,
85 rProperties );
86 break;
87 case CTF_TEXTCOLUMNS:
88 #ifndef SVX_LIGHT
89 pContext = new XMLTextColumnsContext( GetImport(), nPrefix,
90 rLocalName, xAttrList, rProp,
91 rProperties );
92 #else
93 // create default context to skip content
94 pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
95 #endif // #ifndef SVX_LIGHT
96 break;
98 case CTF_DROPCAPFORMAT:
100 DBG_ASSERT( rProp.mnIndex >= 2 &&
101 CTF_DROPCAPWHOLEWORD == mxMapper->getPropertySetMapper()
102 ->GetEntryContextId( rProp.mnIndex-2 ),
103 "invalid property map!");
104 XMLTextDropCapImportContext *pDCContext =
105 new XMLTextDropCapImportContext( GetImport(), nPrefix,
106 rLocalName, xAttrList,
107 rProp,
108 rProp.mnIndex-2,
109 rProperties );
110 rDropCapTextStyleName = pDCContext->GetStyleName();
111 pContext = pDCContext;
113 break;
115 case CTF_BACKGROUND_URL:
117 DBG_ASSERT( rProp.mnIndex >= 2 &&
118 CTF_BACKGROUND_POS == mxMapper->getPropertySetMapper()
119 ->GetEntryContextId( rProp.mnIndex-2 ) &&
120 CTF_BACKGROUND_FILTER == mxMapper->getPropertySetMapper()
121 ->GetEntryContextId( rProp.mnIndex-1 ),
122 "invalid property map!");
124 // #99657# Transparency might be there as well... but doesn't have
125 // to. Thus, this is checked with an if, rather than with an assertion.
126 sal_Int32 nTranspIndex = -1;
127 if( (rProp.mnIndex >= 3) &&
128 ( CTF_BACKGROUND_TRANSPARENCY ==
129 mxMapper->getPropertySetMapper()->GetEntryContextId(
130 rProp.mnIndex-3 ) ) )
131 nTranspIndex = rProp.mnIndex-3;
133 pContext =
134 new XMLBackgroundImageContext( GetImport(), nPrefix,
135 rLocalName, xAttrList,
136 rProp,
137 rProp.mnIndex-2,
138 rProp.mnIndex-1,
139 nTranspIndex,
140 rProperties );
142 break;
143 #ifndef SVX_LIGHT
144 case CTF_SECTION_FOOTNOTE_END:
145 case CTF_SECTION_ENDNOTE_END:
146 pContext = new XMLSectionFootnoteConfigImport(
147 GetImport(), nPrefix, rLocalName, rProperties,
148 mxMapper->getPropertySetMapper());
149 break;
150 #endif // #ifndef SVX_LIGHT
153 if( !pContext )
154 pContext = SvXMLPropertySetContext::CreateChildContext( nPrefix, rLocalName,
155 xAttrList,
156 rProperties, rProp );
158 return pContext;