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/txtprmap.hxx>
27 #include "xmltabi.hxx"
28 #include "txtdropi.hxx"
31 using namespace ::com::sun::star::uno
;
32 using namespace ::com::sun::star
;
34 XMLTextPropertySetContext::XMLTextPropertySetContext(
35 SvXMLImport
& rImport
, sal_uInt16 nPrfx
,
36 const OUString
& rLName
,
37 const Reference
< xml::sax::XAttributeList
> & xAttrList
,
39 ::std::vector
< XMLPropertyState
> &rProps
,
40 const rtl::Reference
< SvXMLImportPropertyMapper
> &rMap
,
41 OUString
& rDCTextStyleName
) :
42 SvXMLPropertySetContext( rImport
, nPrfx
, rLName
, xAttrList
, nFamily
,
44 rDropCapTextStyleName( rDCTextStyleName
)
48 XMLTextPropertySetContext::~XMLTextPropertySetContext()
52 SvXMLImportContext
*XMLTextPropertySetContext::CreateChildContext(
54 const OUString
& rLocalName
,
55 const Reference
< xml::sax::XAttributeList
> & xAttrList
,
56 ::std::vector
< XMLPropertyState
> &rProperties
,
57 const XMLPropertyState
& rProp
)
59 SvXMLImportContext
*pContext
= 0;
61 switch( mxMapper
->getPropertySetMapper()
62 ->GetEntryContextId( rProp
.mnIndex
) )
65 pContext
= new SvxXMLTabStopImportContext( GetImport(), nPrefix
,
70 pContext
= new XMLTextColumnsContext( GetImport(), nPrefix
,
71 rLocalName
, xAttrList
, rProp
,
75 case CTF_DROPCAPFORMAT
:
77 DBG_ASSERT( rProp
.mnIndex
>= 2 &&
78 CTF_DROPCAPWHOLEWORD
== mxMapper
->getPropertySetMapper()
79 ->GetEntryContextId( rProp
.mnIndex
-2 ),
80 "invalid property map!");
81 XMLTextDropCapImportContext
*pDCContext
=
82 new XMLTextDropCapImportContext( GetImport(), nPrefix
,
83 rLocalName
, xAttrList
,
87 rDropCapTextStyleName
= pDCContext
->GetStyleName();
88 pContext
= pDCContext
;
92 case CTF_BACKGROUND_URL
:
94 DBG_ASSERT( rProp
.mnIndex
>= 2 &&
95 CTF_BACKGROUND_POS
== mxMapper
->getPropertySetMapper()
96 ->GetEntryContextId( rProp
.mnIndex
-2 ) &&
97 CTF_BACKGROUND_FILTER
== mxMapper
->getPropertySetMapper()
98 ->GetEntryContextId( rProp
.mnIndex
-1 ),
99 "invalid property map!");
101 // #99657# Transparency might be there as well... but doesn't have
102 // to. Thus, this is checked with an if, rather than with an assertion.
103 sal_Int32 nTranspIndex
= -1;
104 if( (rProp
.mnIndex
>= 3) &&
105 ( CTF_BACKGROUND_TRANSPARENCY
==
106 mxMapper
->getPropertySetMapper()->GetEntryContextId(
107 rProp
.mnIndex
-3 ) ) )
108 nTranspIndex
= rProp
.mnIndex
-3;
111 new XMLBackgroundImageContext( GetImport(), nPrefix
,
112 rLocalName
, xAttrList
,
121 case CTF_SECTION_FOOTNOTE_END
:
122 case CTF_SECTION_ENDNOTE_END
:
123 pContext
= new XMLSectionFootnoteConfigImport(
124 GetImport(), nPrefix
, rLocalName
, rProperties
,
125 mxMapper
->getPropertySetMapper());
130 pContext
= SvXMLPropertySetContext::CreateChildContext( nPrefix
, rLocalName
,
132 rProperties
, rProp
);
138 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */