33#include <com/sun/star/report/ForceNewPage.hpp>
36#include <com/sun/star/report/XShape.hpp>
37#include <com/sun/star/report/XFixedLine.hpp>
38#include <osl/diagnose.h>
50 using ::com::sun::star::uno::Reference;
55 sal_Int16 nRet = report::ForceNewPage::NONE;
62 ,
const Reference< XFastAttributeList > & _xAttrList
63 ,uno::Reference< report::XSection > _xSection
66,m_xSection(
std::move(_xSection))
79 switch( aIter.getToken() )
94 m_xSection->setName(aIter.
toString());
111OXMLTable::~OXMLTable()
115css::uno::Reference< css::xml::sax::XFastContextHandler > OXMLTable::createFastChildContext(
117 const Reference< XFastAttributeList > & xAttrList )
119 css::uno::Reference< css::xml::sax::XFastContextHandler > xContext;
137 case XML_ELEMENT(REPORT, XML_CONDITIONAL_PRINT_EXPRESSION):
152void OXMLTable::endFastElement(sal_Int32 )
156 if ( m_xSection.is() )
158 if ( !m_sStyleName.isEmpty() )
171 sal_Int32 nHeight = std::accumulate(m_aHeight.begin(), m_aHeight.end(), sal_Int32(0),
172 [](
const sal_Int32& rSum,
const sal_Int32& rHeight) {
return rSum + rHeight; });
173 m_xSection->setHeight( nHeight );
177 ::std::vector< ::std::vector<TCell> >::iterator aRowIter = m_aGrid.begin();
178 ::std::vector< ::std::vector<TCell> >::const_iterator aRowEnd = m_aGrid.end();
179 for (sal_Int32
i = 0; aRowIter != aRowEnd; ++aRowIter,++
i)
182 ::std::vector<TCell>::iterator aColIter = (*aRowIter).begin();
183 ::std::vector<TCell>::const_iterator aColEnd = (*aRowIter).end();
184 for (sal_Int32 j = 0; aColIter != aColEnd; ++aColIter,++j)
186 TCell& rCell = *aColIter;
187 for (
const auto& rxElement : rCell.
xElements)
189 uno::Reference<report::XShape> xShape(rxElement,uno::UNO_QUERY);
192 xShape->setPositionX(xShape->getPositionX() +
nLeftMargin);
196 sal_Int32 nWidth = rCell.
nWidth;
197 sal_Int32 nColSpan = rCell.
nColSpan;
200 ::std::vector<TCell>::const_iterator aWidthIter = aColIter + 1;
201 while ( nColSpan > 1 )
203 nWidth += (aWidthIter++)->nWidth;
208 sal_Int32 nRowSpan = rCell.
nRowSpan;
211 ::std::vector< ::std::vector<TCell> >::const_iterator aHeightIter = aRowIter + 1;
214 nHeight += (*aHeightIter)[j].nHeight;
219 Reference<XFixedLine> xFixedLine(rxElement,uno::UNO_QUERY);
220 if ( xFixedLine.is() )
222 if ( xFixedLine->getOrientation() == 1 )
224 OSL_ENSURE(
o3tl::make_unsigned(j+1) < m_aWidth.size(),
"Illegal pos of col iter. There should be an empty cell for the next line part.");
225 nWidth += m_aWidth[j+1];
234 rxElement->setSize(awt::Size(nWidth,nHeight));
235 rxElement->setPosition(awt::Point(nPosX,nPosY));
238 catch(
const beans::PropertyVetoException &)
240 OSL_FAIL(
"Could not set the correct position or size!");
244 nPosX += m_aWidth[j];
246 nPosY += m_aHeight[
i];
256void OXMLTable::addCell(
const Reference<XReportComponent>& _xElement)
258 uno::Reference<report::XShape> xShape(_xElement,uno::UNO_QUERY);
260 "OXMLTable::addCell: Invalid column and row index");
263 TCell& rCell = m_aGrid[m_nRowIndex-1][m_nColumnIndex-1];
264 if ( _xElement.is() )
268 rCell.
nWidth = m_aWidth[m_nColumnIndex-1];
269 rCell.
nHeight = m_aHeight[m_nRowIndex-1];
277 m_nColSpan = m_nRowSpan = 1;
280void OXMLTable::incrementRowIndex()
284 m_aGrid.push_back(::std::vector<TCell>(m_aWidth.size()));
const SvXMLStyleContext * FindStyleChildContext(XmlStyleFamily nFamily, const OUString &rName, bool bCreateIndex=false) const
css::uno::Reference< css::style::XAutoStyleFamily > GetAutoStyles(XmlStyleFamily nFamily) const
static bool convertEnum(EnumT &rEnum, std::u16string_view rValue, const SvXMLEnumMapEntry< EnumT > *pMap)
virtual void FillPropertySet(const css::uno::Reference< css::beans::XPropertySet > &rPropSet)
static const SvXMLEnumMapEntry< sal_Int16 > * GetForceNewPageOptions()
OXMLTable(const OXMLTable &)=delete
#define TOOLS_WARN_EXCEPTION(area, stream)
tools::Long const nLeftMargin
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
static sal_Int16 lcl_getForceNewPageOption(std::string_view _sValue)
FastAttributeList & castToFastAttributeList(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
OUString toString(OptionInfo const *info)
bool IsXMLToken(std::u16string_view rString, enum XMLTokenEnum eToken)
constexpr OUStringLiteral PROPERTY_LEFTMARGIN
::std::vector< css::uno::Reference< css::report::XReportComponent > > xElements
#define PROGRESS_BAR_STEP
#define XMLOFF_WARN_UNKNOWN(area, rIter)
#define XML_ELEMENT(prefix, name)