summaryrefslogtreecommitdiff
path: root/reportdesign/source/filter/xml
diff options
context:
space:
mode:
Diffstat (limited to 'reportdesign/source/filter/xml')
-rw-r--r--reportdesign/source/filter/xml/xmlAutoStyle.cxx12
-rw-r--r--reportdesign/source/filter/xml/xmlExport.cxx21
-rw-r--r--reportdesign/source/filter/xml/xmlReport.cxx6
-rw-r--r--reportdesign/source/filter/xml/xmlTable.cxx102
4 files changed, 64 insertions, 77 deletions
diff --git a/reportdesign/source/filter/xml/xmlAutoStyle.cxx b/reportdesign/source/filter/xml/xmlAutoStyle.cxx
index 4e0873d976fb..f3855b704df8 100644
--- a/reportdesign/source/filter/xml/xmlAutoStyle.cxx
+++ b/reportdesign/source/filter/xml/xmlAutoStyle.cxx
@@ -39,23 +39,21 @@ void OXMLAutoStylePoolP::exportStyleAttributes(
if ( nFamily == XML_STYLE_FAMILY_TABLE_CELL )
{
rtl::Reference< XMLPropertySetMapper > aPropMapper = rORptExport.GetCellStylePropertyMapper();
- ::std::vector< XMLPropertyState >::const_iterator i = rProperties.begin();
- ::std::vector< XMLPropertyState >::const_iterator aEnd = rProperties.end();
- for (; i != aEnd ; ++i)
+ for (const auto& rProp : rProperties)
{
- sal_Int16 nContextID = aPropMapper->GetEntryContextId(i->mnIndex);
+ sal_Int16 nContextID = aPropMapper->GetEntryContextId(rProp.mnIndex);
switch (nContextID)
{
case CTF_RPT_NUMBERFORMAT :
{
OUString sAttrValue;
- if ( i->maValue >>= sAttrValue )
+ if ( rProp.maValue >>= sAttrValue )
{
if ( !sAttrValue.isEmpty() )
{
rORptExport.AddAttribute(
- aPropMapper->GetEntryNameSpace(i->mnIndex),
- aPropMapper->GetEntryXMLName(i->mnIndex),
+ aPropMapper->GetEntryNameSpace(rProp.mnIndex),
+ aPropMapper->GetEntryXMLName(rProp.mnIndex),
sAttrValue );
}
}
diff --git a/reportdesign/source/filter/xml/xmlExport.cxx b/reportdesign/source/filter/xml/xmlExport.cxx
index 0a7acc361788..a907b3c237c1 100644
--- a/reportdesign/source/filter/xml/xmlExport.cxx
+++ b/reportdesign/source/filter/xml/xmlExport.cxx
@@ -177,29 +177,26 @@ namespace rptxml
static void lcl_adjustColumnSpanOverRows(ORptExport::TSectionsGrid& _rGrid)
{
- ORptExport::TSectionsGrid::iterator aSectionIter = _rGrid.begin();
- ORptExport::TSectionsGrid::const_iterator aSectionEnd = _rGrid.end();
- for (;aSectionIter != aSectionEnd ; ++aSectionIter)
+ for (auto& rEntry : _rGrid)
{
- ORptExport::TGrid::iterator aRowIter = aSectionIter->second.begin();
- ORptExport::TGrid::const_iterator aRowEnd = aSectionIter->second.end();
+ ORptExport::TGrid::iterator aRowIter = rEntry.second.begin();
+ ORptExport::TGrid::const_iterator aRowEnd = rEntry.second.end();
for (; aRowIter != aRowEnd; ++aRowIter)
{
if ( aRowIter->first )
{
- ::std::vector< ORptExport::TCell >::const_iterator aColIter = aRowIter->second.begin();
- ::std::vector< ORptExport::TCell >::const_iterator aColEnd = aRowIter->second.end();
- for (; aColIter != aColEnd; ++aColIter)
+ sal_Int32 nColIndex = 0;
+ for (const auto& rCell : aRowIter->second)
{
- if ( aColIter->nRowSpan > 1 )
+ if ( rCell.nRowSpan > 1 )
{
- sal_Int32 nColSpan = aColIter->nColSpan;
- sal_Int32 nColIndex = aColIter - aRowIter->second.begin();
- for (sal_Int32 i = 1; i < aColIter->nRowSpan; ++i)
+ sal_Int32 nColSpan = rCell.nColSpan;
+ for (sal_Int32 i = 1; i < rCell.nRowSpan; ++i)
{
(aRowIter+i)->second[nColIndex].nColSpan = nColSpan;
}
}
+ ++nColIndex;
}
}
}
diff --git a/reportdesign/source/filter/xml/xmlReport.cxx b/reportdesign/source/filter/xml/xmlReport.cxx
index d33424691292..52079a32baae 100644
--- a/reportdesign/source/filter/xml/xmlReport.cxx
+++ b/reportdesign/source/filter/xml/xmlReport.cxx
@@ -202,10 +202,8 @@ void OXMLReport::EndElement()
{
Reference< XFunctions > xFunctions = m_xReportDefinition->getFunctions();
const ORptFilter::TGroupFunctionMap& aFunctions = m_rImport.getFunctions();
- ORptFilter::TGroupFunctionMap::const_iterator aIter = aFunctions.begin();
- const ORptFilter::TGroupFunctionMap::const_iterator aEnd = aFunctions.end();
- for (; aIter != aEnd; ++aIter)
- xFunctions->insertByIndex(xFunctions->getCount(),uno::makeAny(aIter->second));
+ for (const auto& rEntry : aFunctions)
+ xFunctions->insertByIndex(xFunctions->getCount(),uno::makeAny(rEntry.second));
if ( !m_aMasterFields.empty() )
m_xReportDefinition->setMasterFields(Sequence< OUString>(&*m_aMasterFields.begin(),m_aMasterFields.size()));
diff --git a/reportdesign/source/filter/xml/xmlTable.cxx b/reportdesign/source/filter/xml/xmlTable.cxx
index a9bd5d1b1d9a..60030675a095 100644
--- a/reportdesign/source/filter/xml/xmlTable.cxx
+++ b/reportdesign/source/filter/xml/xmlTable.cxx
@@ -35,6 +35,8 @@
#include <com/sun/star/report/XShape.hpp>
#include <com/sun/star/report/XFixedLine.hpp>
+#include <numeric>
+
#define MIN_WIDTH 80
#define MIN_HEIGHT 20
@@ -178,11 +180,8 @@ void OXMLTable::EndElement()
}
}
// set height
- ::std::vector<sal_Int32>::const_iterator aIter = m_aHeight.begin();
- ::std::vector<sal_Int32>::const_iterator aEnd = m_aHeight.end();
- sal_Int32 nHeight = 0;
- for (; aIter != aEnd; ++aIter)
- nHeight += *aIter;
+ sal_Int32 nHeight = std::accumulate(m_aHeight.begin(), m_aHeight.end(), sal_Int32(0),
+ [](const sal_Int32& rSum, const sal_Int32& rHeight) { return rSum + rHeight; });
m_xSection->setHeight( nHeight );
// set positions, widths, and heights
sal_Int32 nLeftMargin = rptui::getStyleProperty<sal_Int32>(m_xSection->getReportDefinition(),PROPERTY_LEFTMARGIN);
@@ -197,64 +196,59 @@ void OXMLTable::EndElement()
for (sal_Int32 j = 0; aColIter != aColEnd; ++aColIter,++j)
{
TCell& rCell = *aColIter;
- if ( !rCell.xElements.empty())
+ for (const auto& rxElement : rCell.xElements)
{
- ::std::vector< uno::Reference< report::XReportComponent> >::const_iterator aCellIter = rCell.xElements.begin();
- const ::std::vector< uno::Reference< report::XReportComponent> >::const_iterator aCellEnd = rCell.xElements.end();
- for (;aCellIter != aCellEnd ; ++aCellIter)
+ uno::Reference<report::XShape> xShape(rxElement,uno::UNO_QUERY);
+ if ( xShape.is() )
{
- uno::Reference<report::XShape> xShape(*aCellIter,uno::UNO_QUERY);
- if ( xShape.is() )
- {
- xShape->setPositionX(xShape->getPositionX() + nLeftMargin);
- }
- else
+ xShape->setPositionX(xShape->getPositionX() + nLeftMargin);
+ }
+ else
+ {
+ sal_Int32 nWidth = rCell.nWidth;
+ sal_Int32 nColSpan = rCell.nColSpan;
+ if ( nColSpan > 1 )
{
- sal_Int32 nWidth = rCell.nWidth;
- sal_Int32 nColSpan = rCell.nColSpan;
- if ( nColSpan > 1 )
- {
- ::std::vector<TCell>::const_iterator aWidthIter = aColIter + 1;
- while ( nColSpan > 1 )
- {
- nWidth += (aWidthIter++)->nWidth;
- --nColSpan;
- }
- }
- nHeight = rCell.nHeight;
- sal_Int32 nRowSpan = rCell.nRowSpan;
- if ( nRowSpan > 1 )
- {
- ::std::vector< ::std::vector<TCell> >::const_iterator aHeightIter = aRowIter + 1;
- while( nRowSpan > 1)
- {
- nHeight += (*aHeightIter)[j].nHeight;
- ++aHeightIter;
- --nRowSpan;
- }
- }
- Reference<XFixedLine> xFixedLine(*aCellIter,uno::UNO_QUERY);
- if ( xFixedLine.is() )
+ ::std::vector<TCell>::const_iterator aWidthIter = aColIter + 1;
+ while ( nColSpan > 1 )
{
- if ( xFixedLine->getOrientation() == 1 ) // vertical
- {
- OSL_ENSURE(static_cast<sal_uInt32>(j+1) < m_aWidth.size(),"Illegal pos of col iter. There should be an empty cell for the next line part.");
- nWidth += m_aWidth[j+1];
- if ( nWidth < MIN_WIDTH )
- nWidth = MIN_WIDTH;
- }
- else if ( nHeight < MIN_HEIGHT )
- nHeight = MIN_HEIGHT;
+ nWidth += (aWidthIter++)->nWidth;
+ --nColSpan;
}
- try
+ }
+ nHeight = rCell.nHeight;
+ sal_Int32 nRowSpan = rCell.nRowSpan;
+ if ( nRowSpan > 1 )
+ {
+ ::std::vector< ::std::vector<TCell> >::const_iterator aHeightIter = aRowIter + 1;
+ while( nRowSpan > 1)
{
- (*aCellIter)->setSize(awt::Size(nWidth,nHeight));
- (*aCellIter)->setPosition(awt::Point(nPosX,nPosY));
+ nHeight += (*aHeightIter)[j].nHeight;
+ ++aHeightIter;
+ --nRowSpan;
}
- catch(const beans::PropertyVetoException &)
+ }
+ Reference<XFixedLine> xFixedLine(rxElement,uno::UNO_QUERY);
+ if ( xFixedLine.is() )
+ {
+ if ( xFixedLine->getOrientation() == 1 ) // vertical
{
- OSL_FAIL("Could not set the correct position or size!");
+ OSL_ENSURE(static_cast<sal_uInt32>(j+1) < m_aWidth.size(),"Illegal pos of col iter. There should be an empty cell for the next line part.");
+ nWidth += m_aWidth[j+1];
+ if ( nWidth < MIN_WIDTH )
+ nWidth = MIN_WIDTH;
}
+ else if ( nHeight < MIN_HEIGHT )
+ nHeight = MIN_HEIGHT;
+ }
+ try
+ {
+ rxElement->setSize(awt::Size(nWidth,nHeight));
+ rxElement->setPosition(awt::Point(nPosX,nPosY));
+ }
+ catch(const beans::PropertyVetoException &)
+ {
+ OSL_FAIL("Could not set the correct position or size!");
}
}
}