28#include <com/sun/star/lang/XMultiServiceFactory.hpp>
29#include <com/sun/star/report/XShape.hpp>
30#include <com/sun/star/report/XFixedLine.hpp>
31#include <com/sun/star/table/BorderLine2.hpp>
32#include <osl/diagnose.h>
46 using namespace beans;
47 using namespace xml::sax;
51 ,
const Reference< XFastAttributeList > & _xAttrList
52 ,OXMLTable* _pContainer
55 ,m_pContainer(_pContainer)
58 ,m_bContainsShape(false)
65 switch( aIter.getToken() )
70 case XML_ELEMENT(TABLE, XML_NUMBER_COLUMNS_SPANNED):
71 m_pContainer->setColumnSpanned(aIter.
toInt32());
74 m_pContainer->setRowSpanned(aIter.
toInt32());
87css::uno::Reference< css::xml::sax::XFastContextHandler > OXMLCell::createFastChildContext(
89 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
91 css::uno::Reference< css::xml::sax::XFastContextHandler > xContext;
93 Reference<XMultiServiceFactory> xFactor(rImport.GetModel(),uno::UNO_QUERY);
94 static constexpr char16_t s_sStringConcat[] =
u" & ";
105 m_sText += OUString::Concat(s_sStringConcat) +
" PageNumber()";
108 m_sText += OUString::Concat(s_sStringConcat) +
" PageCount()";
114 Reference< report::XFormattedField > xControl(xInt,uno::UNO_QUERY);
116 OSL_ENSURE(xControl.is(),
"Could not create FormattedField!");
117 setComponent(xControl);
125 Reference< XImageControl > xControl(xFactor->createInstance(
SERVICE_IMAGECONTROL),uno::UNO_QUERY);
127 OSL_ENSURE(xControl.is(),
"Could not create ImageControl!");
128 setComponent(xControl);
130 xContext =
new OXMLImage( rImport,xAttrList,xControl,m_pContainer);
136 if ( !m_bContainsShape )
137 m_nCurrentCount = m_pContainer->getSection()->getCount();
139 Reference< report::XFormattedField > xControl(xInt,uno::UNO_QUERY);
145 xContext =
new OXMLCell( rImport,xAttrList ,m_pContainer,
this);
151 if ( !m_bContainsShape )
152 m_nCurrentCount = m_pContainer->getSection()->getCount();
153 uno::Reference< drawing::XShapes > xShapes = m_pContainer->getSection();
155 m_bContainsShape =
true;
160 SAL_WARN(
"reportdesign",
"unknown element " << SvXMLImport::getPrefixAndNameFromToken(nElement));
163 if ( m_xComponent.is() )
164 m_pContainer->addCell(m_xComponent);
169void OXMLCell::endFastElement(sal_Int32)
171 if ( m_bContainsShape )
173 const sal_Int32
nCount = m_pContainer->getSection()->getCount();
174 for (sal_Int32
i = m_nCurrentCount;
i <
nCount; ++
i)
176 uno::Reference<report::XShape> xShape(m_pContainer->getSection()->getByIndex(
i),uno::UNO_QUERY);
178 m_pContainer->addCell(xShape);
181 if ( m_pCell !=
this && !m_sText.isEmpty() )
184 Reference<XMultiServiceFactory> xFactor(rImport.GetModel(),uno::UNO_QUERY);
186 Reference< report::XFormattedField > xControl(xInt,uno::UNO_QUERY);
187 xControl->setDataField(
"rpt:" + m_sText);
189 OSL_ENSURE(xControl.is(),
"Could not create FormattedField!");
190 setComponent(xControl);
191 m_xComponent = xControl.get();
192 m_pContainer->getSection()->add(m_xComponent);
193 m_pContainer->addCell(m_xComponent);
196 else if ( !m_sStyleName.isEmpty() && !m_xComponent.is() && m_pCell ==
this )
199 Reference<XMultiServiceFactory> xFactor(rImport.GetModel(),uno::UNO_QUERY);
200 Reference<XFixedLine> xFixedLine(xFactor->createInstance(
SERVICE_FIXEDLINE),uno::UNO_QUERY);
201 m_xComponent = xFixedLine.get();
202 m_pContainer->getSection()->add(m_xComponent);
203 m_pContainer->addCell(m_xComponent);
207 uno::Reference<beans::XPropertySet> xBorderProp = OXMLHelper::createBorderPropertySet();
211 table::BorderLine2 aRight,aLeft;
214 const sal_Int16 rWidth = (aRight.LineWidth == 0) ? aRight.OuterLineWidth : aRight.LineWidth;
215 const sal_Int16 lWidth = (aLeft.LineWidth == 0) ? aLeft.OuterLineWidth : aLeft.LineWidth;
216 xFixedLine->setOrientation( (rWidth != 0 || lWidth != 0) ? 1 : 0);
218 catch(uno::Exception&)
225 OXMLHelper::copyStyleElements(GetOwnImport().isOldFormat(),m_sStyleName,GetImport().GetAutoStyles(),m_xComponent);
233void OXMLCell::setComponent(
const uno::Reference< report::XReportComponent >& _xComponent)
235 m_pCell->m_xComponent = _xComponent;
236 m_xComponent = _xComponent;
239void OXMLCell::characters(
const OUString& rChars )
241 if ( !rChars.isEmpty() )
243 static const char s_Quote[] =
"\"";
244 if ( !m_sText.isEmpty() )
249 m_sText += s_Quote + rChars + s_Quote;
253void OXMLCell::setContainsShape(
bool _bContainsShape)
255 m_bContainsShape = _bContainsShape;
virtual void FillPropertySet(const css::uno::Reference< css::beans::XPropertySet > &rPropSet)
static SvXMLShapeContext * CreateGroupChildContext(SvXMLImport &rImport, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, css::uno::Reference< css::drawing::XShapes > const &rShapes, bool bTemporaryShape=false)
OXMLCell(const OXMLCell &)=delete
#define TOOLS_WARN_EXCEPTION(area, stream)
#define SAL_WARN(area, stream)
FastAttributeList & castToFastAttributeList(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
OUString toString(OptionInfo const *info)
sal_Int32 toInt32(std::u16string_view rStr)
constexpr OUStringLiteral PROPERTY_BORDERLEFT
constexpr OUStringLiteral SERVICE_FIXEDLINE
constexpr OUStringLiteral SERVICE_IMAGECONTROL
constexpr OUStringLiteral SERVICE_FORMATTEDFIELD
constexpr OUStringLiteral PROPERTY_BORDERRIGHT
#define PROGRESS_BAR_STEP
#define XMLOFF_WARN_UNKNOWN(area, rIter)
#define XML_ELEMENT(prefix, name)