LibreOffice Module xmloff (master)  1
XMLTextPropertySetContext.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #include <tools/debug.hxx>
25 
26 #include <xmloff/xmlimppr.hxx>
27 #include <xmloff/txtprmap.hxx>
28 #include <xmltabi.hxx>
29 #include "txtdropi.hxx"
30 
31 
32 using namespace ::com::sun::star::uno;
33 using namespace ::com::sun::star;
34 
36  SvXMLImport& rImport, sal_Int32 nElement,
37  const Reference< xml::sax::XFastAttributeList > & xAttrList,
38  sal_uInt32 nFamily,
39  ::std::vector< XMLPropertyState > &rProps,
41  OUString& rDCTextStyleName ) :
42  SvXMLPropertySetContext( rImport, nElement, xAttrList, nFamily,
43  rProps, rMap ),
44  rDropCapTextStyleName( rDCTextStyleName )
45 {
46 }
47 
49 {
50 }
51 
52 css::uno::Reference< css::xml::sax::XFastContextHandler > XMLTextPropertySetContext::createFastChildContext(
53  sal_Int32 nElement,
54  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
55  ::std::vector< XMLPropertyState > &rProperties,
56  const XMLPropertyState& rProp )
57 {
58  SvXMLImportContextRef xContext;
59 
60  switch( mxMapper->getPropertySetMapper()
61  ->GetEntryContextId( rProp.mnIndex ) )
62  {
63  case CTF_TABSTOP:
64  return new SvxXMLTabStopImportContext( GetImport(), nElement,
65  rProp,
66  rProperties );
67  break;
68  case CTF_TEXTCOLUMNS:
69  return new XMLTextColumnsContext( GetImport(), nElement,
70  xAttrList, rProp,
71  rProperties );
72  break;
73 
74  case CTF_DROPCAPFORMAT:
75  {
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,
82  xAttrList,
83  rProp,
84  rProp.mnIndex-2,
85  rProperties );
86  rDropCapTextStyleName = pDCContext->GetStyleName();
87  return pDCContext;
88  }
89  break;
90 
91  case CTF_BACKGROUND_URL:
92  {
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!");
99 
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) &&
105  mxMapper->getPropertySetMapper()->GetEntryContextId(
106  rProp.mnIndex-3 ) ) )
107  nTranspIndex = rProp.mnIndex-3;
108 
109  return
110  new XMLBackgroundImageContext( GetImport(), nElement,
111  xAttrList,
112  rProp,
113  rProp.mnIndex-2,
114  rProp.mnIndex-1,
115  nTranspIndex,
116  -1,
117  rProperties );
118  }
119  break;
123  GetImport(), nElement, rProperties,
124  mxMapper->getPropertySetMapper());
125  break;
126  }
127 
129  xAttrList,
130  rProperties, rProp );
131 }
132 
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define CTF_TABSTOP
Definition: txtprmap.hxx:55
SvXMLImport & GetImport()
Definition: xmlictxt.hxx:62
sal_Int32 mnIndex
Definition: maptype.hxx:124
#define CTF_BACKGROUND_POS
Definition: txtprmap.hxx:90
XMLTextPropertySetContext(SvXMLImport &rImport, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, sal_uInt32 nFamily,::std::vector< XMLPropertyState > &rProps, const rtl::Reference< SvXMLImportPropertyMapper > &rMap, OUString &rDopCapTextStyleName)
virtual ~XMLTextPropertySetContext() override
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
Definition: xmlprcon.cxx:55
#define CTF_BACKGROUND_TRANSPARENCY
Definition: txtprmap.hxx:143
#define CTF_SECTION_ENDNOTE_END
Definition: txtprmap.hxx:122
#define CTF_DROPCAPFORMAT
Definition: txtprmap.hxx:53
#define DBG_ASSERT(sCon, aError)
#define CTF_BACKGROUND_URL
Definition: txtprmap.hxx:89
rtl::Reference< SvXMLImportPropertyMapper > mxMapper
Definition: xmlprcon.hxx:37
#define CTF_BACKGROUND_FILTER
Definition: txtprmap.hxx:91
#define CTF_DROPCAPWHOLEWORD
Definition: txtprmap.hxx:52
Smart struct to transport an Any with an index to the appropriate property-name.
Definition: maptype.hxx:122
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList,::std::vector< XMLPropertyState > &rProperties, const XMLPropertyState &rProp) override
This method is called from this instance implementation of CreateChildContext if the element matches ...
Import the footnote-/endnote-configuration element in section styles.
#define CTF_TEXTCOLUMNS
Definition: txtprmap.hxx:77
#define CTF_SECTION_FOOTNOTE_END
Definition: txtprmap.hxx:115