Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <tools/debug.hxx>
30 : : #include "XMLTextPropertySetContext.hxx"
31 : : #include "XMLTextColumnsContext.hxx"
32 : : #include "XMLBackgroundImageContext.hxx"
33 : : #include "XMLSectionFootnoteConfigImport.hxx"
34 : :
35 : : #include <xmloff/txtprmap.hxx>
36 : : #include "xmltabi.hxx"
37 : : #include "txtdropi.hxx"
38 : :
39 : : using ::rtl::OUString;
40 : :
41 : : using namespace ::com::sun::star::uno;
42 : : using namespace ::com::sun::star;
43 : :
44 : 1408 : XMLTextPropertySetContext::XMLTextPropertySetContext(
45 : : SvXMLImport& rImport, sal_uInt16 nPrfx,
46 : : const OUString& rLName,
47 : : const Reference< xml::sax::XAttributeList > & xAttrList,
48 : : sal_uInt32 nFamily,
49 : : ::std::vector< XMLPropertyState > &rProps,
50 : : const UniReference < SvXMLImportPropertyMapper > &rMap,
51 : : OUString& rDCTextStyleName ) :
52 : : SvXMLPropertySetContext( rImport, nPrfx, rLName, xAttrList, nFamily,
53 : : rProps, rMap ),
54 : 1408 : rDropCapTextStyleName( rDCTextStyleName )
55 : : {
56 : 1408 : }
57 : :
58 : 1408 : XMLTextPropertySetContext::~XMLTextPropertySetContext()
59 : : {
60 [ - + ]: 2816 : }
61 : :
62 : 61 : SvXMLImportContext *XMLTextPropertySetContext::CreateChildContext(
63 : : sal_uInt16 nPrefix,
64 : : const OUString& rLocalName,
65 : : const Reference< xml::sax::XAttributeList > & xAttrList,
66 : : ::std::vector< XMLPropertyState > &rProperties,
67 : : const XMLPropertyState& rProp )
68 : : {
69 : 61 : SvXMLImportContext *pContext = 0;
70 : :
71 [ + + - + : 122 : switch( mxMapper->getPropertySetMapper()
- - ]
72 : 61 : ->GetEntryContextId( rProp.mnIndex ) )
73 : : {
74 : : case CTF_TABSTOP:
75 : 29 : pContext = new SvxXMLTabStopImportContext( GetImport(), nPrefix,
76 : : rLocalName, rProp,
77 [ + - ]: 29 : rProperties );
78 : 29 : break;
79 : : case CTF_TEXTCOLUMNS:
80 : 19 : pContext = new XMLTextColumnsContext( GetImport(), nPrefix,
81 : : rLocalName, xAttrList, rProp,
82 [ + - ]: 19 : rProperties );
83 : 19 : break;
84 : :
85 : : case CTF_DROPCAPFORMAT:
86 : : {
87 : : DBG_ASSERT( rProp.mnIndex >= 2 &&
88 : : CTF_DROPCAPWHOLEWORD == mxMapper->getPropertySetMapper()
89 : : ->GetEntryContextId( rProp.mnIndex-2 ),
90 : : "invalid property map!");
91 : : XMLTextDropCapImportContext *pDCContext =
92 : 0 : new XMLTextDropCapImportContext( GetImport(), nPrefix,
93 : : rLocalName, xAttrList,
94 : : rProp,
95 : : rProp.mnIndex-2,
96 [ # # ]: 0 : rProperties );
97 : 0 : rDropCapTextStyleName = pDCContext->GetStyleName();
98 : 0 : pContext = pDCContext;
99 : : }
100 : 0 : break;
101 : :
102 : : case CTF_BACKGROUND_URL:
103 : : {
104 : : DBG_ASSERT( rProp.mnIndex >= 2 &&
105 : : CTF_BACKGROUND_POS == mxMapper->getPropertySetMapper()
106 : : ->GetEntryContextId( rProp.mnIndex-2 ) &&
107 : : CTF_BACKGROUND_FILTER == mxMapper->getPropertySetMapper()
108 : : ->GetEntryContextId( rProp.mnIndex-1 ),
109 : : "invalid property map!");
110 : :
111 : : // #99657# Transparency might be there as well... but doesn't have
112 : : // to. Thus, this is checked with an if, rather than with an assertion.
113 : 13 : sal_Int32 nTranspIndex = -1;
114 [ + - - + ]: 26 : if( (rProp.mnIndex >= 3) &&
[ - + ]
115 : : ( CTF_BACKGROUND_TRANSPARENCY ==
116 : 13 : mxMapper->getPropertySetMapper()->GetEntryContextId(
117 : 13 : rProp.mnIndex-3 ) ) )
118 : 0 : nTranspIndex = rProp.mnIndex-3;
119 : :
120 : : pContext =
121 : 13 : new XMLBackgroundImageContext( GetImport(), nPrefix,
122 : : rLocalName, xAttrList,
123 : : rProp,
124 : : rProp.mnIndex-2,
125 : : rProp.mnIndex-1,
126 : : nTranspIndex,
127 [ + - ]: 13 : rProperties );
128 : : }
129 : 13 : break;
130 : : case CTF_SECTION_FOOTNOTE_END:
131 : : case CTF_SECTION_ENDNOTE_END:
132 : : pContext = new XMLSectionFootnoteConfigImport(
133 : 0 : GetImport(), nPrefix, rLocalName, rProperties,
134 [ # # ]: 0 : mxMapper->getPropertySetMapper());
135 : 0 : break;
136 : : }
137 : :
138 [ - + ]: 61 : if( !pContext )
139 : : pContext = SvXMLPropertySetContext::CreateChildContext( nPrefix, rLocalName,
140 : : xAttrList,
141 : 0 : rProperties, rProp );
142 : :
143 : 61 : return pContext;
144 : : }
145 : :
146 : :
147 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|