1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: XMLTextPropertySetContext.cxx,v $
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>
42 #include "xmltabi.hxx"
43 #ifndef _XMLOFF_TXTDROPI_HXX
44 #include "txtdropi.hxx"
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
,
57 ::std::vector
< XMLPropertyState
> &rProps
,
58 const UniReference
< SvXMLImportPropertyMapper
> &rMap
,
59 OUString
& rDCTextStyleName
) :
60 SvXMLPropertySetContext( rImport
, nPrfx
, rLName
, xAttrList
, nFamily
,
62 rDropCapTextStyleName( rDCTextStyleName
)
66 XMLTextPropertySetContext::~XMLTextPropertySetContext()
70 SvXMLImportContext
*XMLTextPropertySetContext::CreateChildContext(
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
) )
83 pContext
= new SvxXMLTabStopImportContext( GetImport(), nPrefix
,
89 pContext
= new XMLTextColumnsContext( GetImport(), nPrefix
,
90 rLocalName
, xAttrList
, rProp
,
93 // create default context to skip content
94 pContext
= new SvXMLImportContext( GetImport(), nPrefix
, rLocalName
);
95 #endif // #ifndef SVX_LIGHT
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
,
110 rDropCapTextStyleName
= pDCContext
->GetStyleName();
111 pContext
= pDCContext
;
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;
134 new XMLBackgroundImageContext( GetImport(), nPrefix
,
135 rLocalName
, xAttrList
,
144 case CTF_SECTION_FOOTNOTE_END
:
145 case CTF_SECTION_ENDNOTE_END
:
146 pContext
= new XMLSectionFootnoteConfigImport(
147 GetImport(), nPrefix
, rLocalName
, rProperties
,
148 mxMapper
->getPropertySetMapper());
150 #endif // #ifndef SVX_LIGHT
154 pContext
= SvXMLPropertySetContext::CreateChildContext( nPrefix
, rLocalName
,
156 rProperties
, rProp
);