1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <tools/debug.hxx>
21 #include "XMLTextPropertySetContext.hxx"
22 #include <XMLTextColumnsContext.hxx>
23 #include <XMLBackgroundImageContext.hxx>
24 #include "XMLSectionFootnoteConfigImport.hxx"
26 #include <xmloff/xmlimppr.hxx>
27 #include <xmloff/txtprmap.hxx>
28 #include <xmltabi.hxx>
29 #include "txtdropi.hxx"
32 using namespace ::com::sun::star::uno
;
33 using namespace ::com::sun::star
;
35 XMLTextPropertySetContext::XMLTextPropertySetContext(
36 SvXMLImport
& rImport
, sal_Int32 nElement
,
37 const Reference
< xml::sax::XFastAttributeList
> & xAttrList
,
39 ::std::vector
< XMLPropertyState
> &rProps
,
40 const rtl::Reference
< SvXMLImportPropertyMapper
> &rMap
,
41 OUString
& rDCTextStyleName
) :
42 SvXMLPropertySetContext( rImport
, nElement
, xAttrList
, nFamily
,
44 rDropCapTextStyleName( rDCTextStyleName
)
48 XMLTextPropertySetContext::~XMLTextPropertySetContext()
52 css::uno::Reference
< css::xml::sax::XFastContextHandler
> XMLTextPropertySetContext::createFastChildContext(
54 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
,
55 ::std::vector
< XMLPropertyState
> &rProperties
,
56 const XMLPropertyState
& rProp
)
58 SvXMLImportContextRef xContext
;
60 switch( mxMapper
->getPropertySetMapper()
61 ->GetEntryContextId( rProp
.mnIndex
) )
64 return new SvxXMLTabStopImportContext( GetImport(), nElement
,
69 return new XMLTextColumnsContext( GetImport(), nElement
,
74 case CTF_DROPCAPFORMAT
:
76 DBG_ASSERT( rProp
.mnIndex
>= 2 &&
77 CTF_DROPCAPWHOLEWORD
== mxMapper
->getPropertySetMapper()
78 ->GetEntryContextId( rProp
.mnIndex
-2 ),
79 "invalid property map!");
80 XMLTextDropCapImportContext
*pDCContext
=
81 new XMLTextDropCapImportContext( GetImport(), nElement
,
86 rDropCapTextStyleName
= pDCContext
->GetStyleName();
91 case CTF_BACKGROUND_URL
:
93 DBG_ASSERT( rProp
.mnIndex
>= 2 &&
94 CTF_BACKGROUND_POS
== mxMapper
->getPropertySetMapper()
95 ->GetEntryContextId( rProp
.mnIndex
-2 ) &&
96 CTF_BACKGROUND_FILTER
== mxMapper
->getPropertySetMapper()
97 ->GetEntryContextId( rProp
.mnIndex
-1 ),
98 "invalid property map!");
100 // #99657# Transparency might be there as well... but doesn't have
101 // to. Thus, this is checked with an if, rather than with an assertion.
102 sal_Int32 nTranspIndex
= -1;
103 if( (rProp
.mnIndex
>= 3) &&
104 ( CTF_BACKGROUND_TRANSPARENCY
==
105 mxMapper
->getPropertySetMapper()->GetEntryContextId(
106 rProp
.mnIndex
-3 ) ) )
107 nTranspIndex
= rProp
.mnIndex
-3;
110 new XMLBackgroundImageContext( GetImport(), nElement
,
120 case CTF_SECTION_FOOTNOTE_END
:
121 case CTF_SECTION_ENDNOTE_END
:
122 return new XMLSectionFootnoteConfigImport(
123 GetImport(), nElement
, rProperties
,
124 mxMapper
->getPropertySetMapper());
128 return SvXMLPropertySetContext::createFastChildContext( nElement
,
130 rProperties
, rProp
);
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */