[Libreoffice-commits] core.git: reportdesign/source sc/source sw/source xmloff/source

2020-12-14 Thread Noel (via logerrit)
 reportdesign/source/filter/xml/xmlCell.cxx|8 +--
 sc/source/filter/xml/XMLTrackedChangesContext.cxx |3 -
 sw/source/filter/xml/xmltbli.cxx  |   47 ++
 xmloff/source/chart/SchXMLTableContext.cxx|5 --
 xmloff/source/table/XMLTableImport.cxx|   10 +---
 5 files changed, 32 insertions(+), 41 deletions(-)

New commits:
commit 1b69f0c2731ec66e76073ab0f2936b7112bf1e77
Author: Noel 
AuthorDate: Mon Dec 14 15:05:37 2020 +0200
Commit: Noel Grandin 
CommitDate: Mon Dec 14 17:46:15 2020 +0100

use more direct parsing on FastAttributeList

instead of first allocating an OUString

Change-Id: I796b1b2d47eb3cb9bebb00ae1bbd465010ebf494
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107691
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/reportdesign/source/filter/xml/xmlCell.cxx 
b/reportdesign/source/filter/xml/xmlCell.cxx
index 27155525ba69..adfac9d59cc6 100644
--- a/reportdesign/source/filter/xml/xmlCell.cxx
+++ b/reportdesign/source/filter/xml/xmlCell.cxx
@@ -62,18 +62,16 @@ OXMLCell::OXMLCell( ORptFilter& rImport
 
 for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
 {
-OUString sValue = aIter.toString();
-
 switch( aIter.getToken() )
 {
 case XML_ELEMENT(TABLE, XML_STYLE_NAME):
-m_sStyleName = sValue;
+m_sStyleName = aIter.toString();
 break;
 case XML_ELEMENT(TABLE, XML_NUMBER_COLUMNS_SPANNED):
-m_pContainer->setColumnSpanned(sValue.toInt32());
+m_pContainer->setColumnSpanned(aIter.toInt32());
 break;
 case XML_ELEMENT(TABLE, XML_NUMBER_ROWS_SPANNED):
-m_pContainer->setRowSpanned(sValue.toInt32());
+m_pContainer->setRowSpanned(aIter.toInt32());
 break;
 default:
 XMLOFF_WARN_UNKNOWN("reportdesign", aIter);
diff --git a/sc/source/filter/xml/XMLTrackedChangesContext.cxx 
b/sc/source/filter/xml/XMLTrackedChangesContext.cxx
index 2accb0987344..d8292c5feecd 100644
--- a/sc/source/filter/xml/XMLTrackedChangesContext.cxx
+++ b/sc/source/filter/xml/XMLTrackedChangesContext.cxx
@@ -666,9 +666,8 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL 
ScXMLChangeTextPContext
 sal_Int32 nRepeat(0);
 for( auto& aIter : sax_fastparser::castToFastAttributeList(mxAttrList) 
)
 {
-const OUString sValue = aIter.toString();
 if (aIter.getToken() == XML_ELEMENT(TEXT, XML_C))
-nRepeat = sValue.toInt32();
+nRepeat = aIter.toInt32();
 else
 XMLOFF_WARN_UNKNOWN("sc", aIter);
 }
diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index 77f7ee7f9128..be694b483d00 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -356,15 +356,14 @@ SwXMLTableCellContext_Impl::SwXMLTableCellContext_Impl(
 m_sSaveParaDefault = 
GetImport().GetTextImport()->GetCellParaStyleDefault();
 for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
 {
-const OUString sValue = aIter.toString();
 switch( aIter.getToken() )
 {
 case XML_ELEMENT(TABLE, XML_STYLE_NAME):
-m_aStyleName = sValue;
-GetImport().GetTextImport()->SetCellParaStyleDefault(sValue);
+m_aStyleName = aIter.toString();
+GetImport().GetTextImport()->SetCellParaStyleDefault(m_aStyleName);
 break;
 case XML_ELEMENT(TABLE, XML_NUMBER_COLUMNS_SPANNED):
-m_nColSpan = static_cast(std::max(1, 
sValue.toInt32()));
+m_nColSpan = static_cast(std::max(1, 
aIter.toInt32()));
 if (m_nColSpan > 256)
 {
 SAL_INFO("sw.xml", "ignoring huge table:number-columns-spanned 
" << m_nColSpan);
@@ -372,7 +371,7 @@ SwXMLTableCellContext_Impl::SwXMLTableCellContext_Impl(
 }
 break;
 case XML_ELEMENT(TABLE, XML_NUMBER_ROWS_SPANNED):
-m_nRowSpan = static_cast(std::max(1, 
sValue.toInt32()));
+m_nRowSpan = static_cast(std::max(1, 
aIter.toInt32()));
 if (m_nRowSpan > 8192 || (m_nRowSpan > 256 && 
utl::ConfigManager::IsFuzzing()))
 {
 SAL_INFO("sw.xml", "ignoring huge table:number-rows-spanned " 
<< m_nRowSpan);
@@ -380,7 +379,7 @@ SwXMLTableCellContext_Impl::SwXMLTableCellContext_Impl(
 }
 break;
 case XML_ELEMENT(TABLE, XML_NUMBER_COLUMNS_REPEATED):
-m_nColRepeat = static_cast(std::max(1, 
sValue.toInt32()));
+m_nColRepeat = static_cast(std::max(1, 
aIter.toInt32()));
 if (m_nColRepeat > 256)
 {
 SAL_INFO("sw.xml", "ignoring huge 
table:number-columns-repeated " << m_nColRepeat);
@@ -3

[Libreoffice-commits] core.git: reportdesign/source sc/source sw/source

2019-11-13 Thread Noel Grandin (via logerrit)
 reportdesign/source/filter/xml/xmlfilter.cxx |5 ++---
 sc/source/filter/xml/xmlexternaltabi.cxx |   10 --
 sc/source/filter/xml/xmlexternaltabi.hxx |2 --
 sw/source/core/swg/SwXMLSectionList.cxx  |   16 +++-
 4 files changed, 13 insertions(+), 20 deletions(-)

New commits:
commit ead34a4d34db05d5718d96b66f5e39d886c8b699
Author: Noel Grandin 
AuthorDate: Wed Nov 13 09:35:05 2019 +0200
Commit: Noel Grandin 
CommitDate: Wed Nov 13 10:26:35 2019 +0100

no need to store reference to Import here

can just cast the parent member

Change-Id: I990bd4da3afbd78da819038c7907c28de87faaaf
Reviewed-on: https://gerrit.libreoffice.org/82567
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/reportdesign/source/filter/xml/xmlfilter.cxx 
b/reportdesign/source/filter/xml/xmlfilter.cxx
index 00f7fe86a9c5..e4df625cacce 100644
--- a/reportdesign/source/filter/xml/xmlfilter.cxx
+++ b/reportdesign/source/filter/xml/xmlfilter.cxx
@@ -86,7 +86,7 @@ using namespace ::com::sun::star::util;
 class RptMLMasterStylesContext_Impl:
 public XMLTextMasterStylesContext
 {
-ORptFilter& m_rImport;
+ORptFilter& GetImport() { return 
static_cast(XMLTextMasterStylesContext::GetImport()); }
 
 public:
 
@@ -106,14 +106,13 @@ 
RptMLMasterStylesContext_Impl::RptMLMasterStylesContext_Impl(
 const OUString& rLName ,
 const uno::Reference< xml::sax::XAttributeList > & xAttrList ) :
 XMLTextMasterStylesContext( rImport, nPrfx, rLName, xAttrList )
-,m_rImport(rImport)
 {
 }
 
 void RptMLMasterStylesContext_Impl::EndElement()
 {
 FinishStyles( true );
-m_rImport.FinishStyles();
+GetImport().FinishStyles();
 }
 
 /// read a component (file + filter version)
diff --git a/sc/source/filter/xml/xmlexternaltabi.cxx 
b/sc/source/filter/xml/xmlexternaltabi.cxx
index 8d0a810dad09..5515fd835ba5 100644
--- a/sc/source/filter/xml/xmlexternaltabi.cxx
+++ b/sc/source/filter/xml/xmlexternaltabi.cxx
@@ -43,7 +43,6 @@ 
ScXMLExternalRefTabSourceContext::ScXMLExternalRefTabSourceContext(
 ScXMLImport& rImport,
 const rtl::Reference& rAttrList, 
ScXMLExternalTabData& rRefInfo ) :
 ScXMLImportContext( rImport ),
-mrScImport(rImport),
 mrExternalRefInfo(rRefInfo)
 {
 using namespace ::xmloff::token;
@@ -98,7 +97,7 @@ static bool lcl_isValidRelativeURL(const OUString& rUrl)
 
 void SAL_CALL ScXMLExternalRefTabSourceContext::endFastElement( sal_Int32 
/*nElement*/ )
 {
-ScDocument* pDoc = mrScImport.GetDocument();
+ScDocument* pDoc = GetScImport().GetDocument();
 if (!pDoc)
 return;
 
@@ -111,7 +110,6 @@ void SAL_CALL 
ScXMLExternalRefTabSourceContext::endFastElement( sal_Int32 /*nEle
 ScXMLExternalRefRowsContext::ScXMLExternalRefRowsContext(
 ScXMLImport& rImport, ScXMLExternalTabData& rRefInfo ) :
 ScXMLImportContext( rImport ),
-mrScImport(rImport),
 mrExternalRefInfo(rRefInfo)
 {
 }
@@ -126,7 +124,7 @@ Reference< XFastContextHandler > SAL_CALL 
ScXMLExternalRefRowsContext::createFas
 // #i101319# row elements inside group, rows or header-rows
 // are treated like row elements directly in the table element
 
-const SvXMLTokenMap& rTokenMap = mrScImport.GetTableRowsElemTokenMap();
+const SvXMLTokenMap& rTokenMap = GetScImport().GetTableRowsElemTokenMap();
 sal_uInt16 nToken = rTokenMap.Get( nElement );
 sax_fastparser::FastAttributeList *pAttribList =
 sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList 
);
@@ -137,10 +135,10 @@ Reference< XFastContextHandler > SAL_CALL 
ScXMLExternalRefRowsContext::createFas
 case XML_TOK_TABLE_ROWS_HEADER_ROWS:
 case XML_TOK_TABLE_ROWS_ROWS:
 return new ScXMLExternalRefRowsContext(
-mrScImport, mrExternalRefInfo);
+GetScImport(), mrExternalRefInfo);
 case XML_TOK_TABLE_ROWS_ROW:
 return new ScXMLExternalRefRowContext(
-mrScImport, pAttribList, mrExternalRefInfo);
+GetScImport(), pAttribList, mrExternalRefInfo);
 default:
 ;
 }
diff --git a/sc/source/filter/xml/xmlexternaltabi.hxx 
b/sc/source/filter/xml/xmlexternaltabi.hxx
index 08e3fb2d2686..5afb5c5f9bfc 100644
--- a/sc/source/filter/xml/xmlexternaltabi.hxx
+++ b/sc/source/filter/xml/xmlexternaltabi.hxx
@@ -40,7 +40,6 @@ public:
 virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
 
 private:
-ScXMLImport&mrScImport;
 ScXMLExternalTabData&   mrExternalRefInfo;
 
 OUString maRelativeUrl;
@@ -61,7 +60,6 @@ public:
 const css::uno::Reference< 
css::xml::sax::XFastAttributeList >& xAttrList ) override;
 
 private:
-ScXMLImport&mrScImport;
 ScXMLExternalTabData&   mrExternalRefInfo;
 };
 
diff --git a/sw/source/core/swg/SwXMLSectionList.cxx 
b/sw/source/core/swg/SwXMLSectionList.cxx
index 1940ebfea478..2f835bd606a3 10064

[Libreoffice-commits] core.git: reportdesign/source sc/source sw/source

2015-10-19 Thread Noel Grandin
 reportdesign/source/filter/xml/xmlFixedContent.cxx  |   16 
 reportdesign/source/filter/xml/xmlFormattedField.cxx|2 +-
 reportdesign/source/filter/xml/xmlReport.hxx|1 +
 reportdesign/source/filter/xml/xmlReportElementBase.hxx |2 +-
 sc/source/ui/vba/vbaformat.cxx  |   12 +---
 sc/source/ui/vba/vbastyle.cxx   |   13 ++---
 sc/source/ui/vba/vbastyle.hxx   |1 +
 sw/source/filter/ww8/wrtw8nds.cxx   |3 ++-
 sw/source/filter/ww8/wrtww8.cxx |1 +
 sw/source/filter/ww8/wrtww8.hxx |1 +
 10 files changed, 19 insertions(+), 33 deletions(-)

New commits:
commit ebd6fec73bfd77aa78a1ae92256d59d04ba999f3
Author: Noel Grandin 
Date:   Mon Oct 19 09:00:04 2015 +0200

Revert "cppcheck:duplInheritedMember"

This reverts commit a55496a9e88ac3da821b0ae0d334866d669540c6.

diff --git a/reportdesign/source/filter/xml/xmlFixedContent.cxx 
b/reportdesign/source/filter/xml/xmlFixedContent.cxx
index 757a4f0..c18edf5 100644
--- a/reportdesign/source/filter/xml/xmlFixedContent.cxx
+++ b/reportdesign/source/filter/xml/xmlFixedContent.cxx
@@ -187,21 +187,21 @@ void OXMLFixedContent::EndElement()
 uno::Reference< uno::XInterface> xInt = 
xFactor->createInstance(SERVICE_FORMATTEDFIELD);
 Reference< report::XFormattedField > xControl(xInt,uno::UNO_QUERY);
 xControl->setDataField("rpt:" + m_sPageText);
-OSL_ENSURE(xControl.is(),"Could not create FormattedField!");
-m_pInP->m_xReportComponent = xControl.get();
-m_xReportComponent = xControl.get();
+ OSL_ENSURE(xControl.is(),"Could not create FormattedField!");
+m_pInP->m_xComponent = xControl.get();
+m_xComponent = xControl.get();
 }
 else
 {
 Reference< XFixedText > 
xControl(xFactor->createInstance(SERVICE_FIXEDTEXT),uno::UNO_QUERY);
-OSL_ENSURE(xControl.is(),"Could not create FixedContent!");
-m_pInP->m_xReportComponent = xControl.get();
-m_xReportComponent = xControl.get();
+ OSL_ENSURE(xControl.is(),"Could not create FixedContent!");
+m_pInP->m_xComponent = xControl.get();
+m_xComponent = xControl.get();
 xControl->setLabel(m_sLabel);
 }
 
-m_pContainer->addCell(m_xReportComponent);
-m_rCell.setComponent(m_xReportComponent);
+m_pContainer->addCell(m_xComponent);
+m_rCell.setComponent(m_xComponent);
 
 OXMLReportElementBase::EndElement();
 }
diff --git a/reportdesign/source/filter/xml/xmlFormattedField.cxx 
b/reportdesign/source/filter/xml/xmlFormattedField.cxx
index b244cb8..47053d3 100644
--- a/reportdesign/source/filter/xml/xmlFormattedField.cxx
+++ b/reportdesign/source/filter/xml/xmlFormattedField.cxx
@@ -43,7 +43,7 @@ OXMLFormattedField::OXMLFormattedField( ORptFilter& rImport,
 ,bool _bPageCount) :
 OXMLReportElementBase( rImport, nPrfx, 
rLName,_xComponent.get(),_pContainer)
 {
-OSL_ENSURE(m_xReportComponent.is(),"Component is NULL!");
+OSL_ENSURE(m_xComponent.is(),"Component is NULL!");
 const SvXMLNamespaceMap& rMap = rImport.GetNamespaceMap();
 const SvXMLTokenMap& rTokenMap = rImport.GetControlElemTokenMap();
 
diff --git a/reportdesign/source/filter/xml/xmlReport.hxx 
b/reportdesign/source/filter/xml/xmlReport.hxx
index 13aa3cd..0a94525 100644
--- a/reportdesign/source/filter/xml/xmlReport.hxx
+++ b/reportdesign/source/filter/xml/xmlReport.hxx
@@ -27,6 +27,7 @@ namespace rptxml
 class ORptFilter;
 class OXMLReport : public OXMLReportElementBase, public IMasterDetailFieds
 {
+::com::sun::star::uno::Reference< 
::com::sun::star::report::XReportDefinition > m_xComponent;
 ::std::vector< OUString> m_aMasterFields;
 ::std::vector< OUString> m_aDetailFields;
 OXMLReport(const OXMLReport&) = delete;
diff --git a/reportdesign/source/filter/xml/xmlReportElementBase.hxx 
b/reportdesign/source/filter/xml/xmlReportElementBase.hxx
index ec14b63..c087dbd 100644
--- a/reportdesign/source/filter/xml/xmlReportElementBase.hxx
+++ b/reportdesign/source/filter/xml/xmlReportElementBase.hxx
@@ -44,7 +44,7 @@ namespace rptxml
 protected:
 ORptFilter&   m_rImport;
 OXMLTable*m_pContainer;
-::com::sun::star::uno::Reference< 
::com::sun::star::report::XReportComponent >  m_xReportComponent;
+::com::sun::star::uno::Reference< 
::com::sun::star::report::XReportComponent >  m_xComponent;
 
 virtual SvXMLImportContext* _CreateChildContext( sal_uInt16 nPrefix,
 const OUString& rLocalName,
diff --git a/sc/source/ui/vba/vbaformat.cxx b/sc/source/ui/vba/vbaformat.cxx
index 1896a12..42aaa8f 100644
--- a/sc/source/ui/vba/vbaformat.cxx
+++ b/sc/source/ui/vb

[Libreoffice-commits] core.git: reportdesign/source sc/source sw/source

2015-10-18 Thread Noel Grandin
 reportdesign/source/filter/xml/xmlFixedContent.cxx  |   16 
 reportdesign/source/filter/xml/xmlFormattedField.cxx|2 +-
 reportdesign/source/filter/xml/xmlReport.hxx|1 -
 reportdesign/source/filter/xml/xmlReportElementBase.hxx |2 +-
 sc/source/ui/vba/vbaformat.cxx  |   12 +++-
 sc/source/ui/vba/vbastyle.cxx   |   13 +++--
 sc/source/ui/vba/vbastyle.hxx   |1 -
 sw/source/filter/ww8/wrtw8nds.cxx   |3 +--
 sw/source/filter/ww8/wrtww8.cxx |1 -
 sw/source/filter/ww8/wrtww8.hxx |1 -
 10 files changed, 33 insertions(+), 19 deletions(-)

New commits:
commit a55496a9e88ac3da821b0ae0d334866d669540c6
Author: Noel Grandin 
Date:   Sat Oct 17 18:17:22 2015 +0200

cppcheck:duplInheritedMember

Change-Id: Ie525330eb79a80fd47a6bfe46343aa25ae0aeb5c
Reviewed-on: https://gerrit.libreoffice.org/19419
Reviewed-by: Noel Grandin 
Tested-by: Noel Grandin 

diff --git a/reportdesign/source/filter/xml/xmlFixedContent.cxx 
b/reportdesign/source/filter/xml/xmlFixedContent.cxx
index c18edf5..757a4f0 100644
--- a/reportdesign/source/filter/xml/xmlFixedContent.cxx
+++ b/reportdesign/source/filter/xml/xmlFixedContent.cxx
@@ -187,21 +187,21 @@ void OXMLFixedContent::EndElement()
 uno::Reference< uno::XInterface> xInt = 
xFactor->createInstance(SERVICE_FORMATTEDFIELD);
 Reference< report::XFormattedField > xControl(xInt,uno::UNO_QUERY);
 xControl->setDataField("rpt:" + m_sPageText);
- OSL_ENSURE(xControl.is(),"Could not create FormattedField!");
-m_pInP->m_xComponent = xControl.get();
-m_xComponent = xControl.get();
+OSL_ENSURE(xControl.is(),"Could not create FormattedField!");
+m_pInP->m_xReportComponent = xControl.get();
+m_xReportComponent = xControl.get();
 }
 else
 {
 Reference< XFixedText > 
xControl(xFactor->createInstance(SERVICE_FIXEDTEXT),uno::UNO_QUERY);
- OSL_ENSURE(xControl.is(),"Could not create FixedContent!");
-m_pInP->m_xComponent = xControl.get();
-m_xComponent = xControl.get();
+OSL_ENSURE(xControl.is(),"Could not create FixedContent!");
+m_pInP->m_xReportComponent = xControl.get();
+m_xReportComponent = xControl.get();
 xControl->setLabel(m_sLabel);
 }
 
-m_pContainer->addCell(m_xComponent);
-m_rCell.setComponent(m_xComponent);
+m_pContainer->addCell(m_xReportComponent);
+m_rCell.setComponent(m_xReportComponent);
 
 OXMLReportElementBase::EndElement();
 }
diff --git a/reportdesign/source/filter/xml/xmlFormattedField.cxx 
b/reportdesign/source/filter/xml/xmlFormattedField.cxx
index 47053d3..b244cb8 100644
--- a/reportdesign/source/filter/xml/xmlFormattedField.cxx
+++ b/reportdesign/source/filter/xml/xmlFormattedField.cxx
@@ -43,7 +43,7 @@ OXMLFormattedField::OXMLFormattedField( ORptFilter& rImport,
 ,bool _bPageCount) :
 OXMLReportElementBase( rImport, nPrfx, 
rLName,_xComponent.get(),_pContainer)
 {
-OSL_ENSURE(m_xComponent.is(),"Component is NULL!");
+OSL_ENSURE(m_xReportComponent.is(),"Component is NULL!");
 const SvXMLNamespaceMap& rMap = rImport.GetNamespaceMap();
 const SvXMLTokenMap& rTokenMap = rImport.GetControlElemTokenMap();
 
diff --git a/reportdesign/source/filter/xml/xmlReport.hxx 
b/reportdesign/source/filter/xml/xmlReport.hxx
index 0a94525..13aa3cd 100644
--- a/reportdesign/source/filter/xml/xmlReport.hxx
+++ b/reportdesign/source/filter/xml/xmlReport.hxx
@@ -27,7 +27,6 @@ namespace rptxml
 class ORptFilter;
 class OXMLReport : public OXMLReportElementBase, public IMasterDetailFieds
 {
-::com::sun::star::uno::Reference< 
::com::sun::star::report::XReportDefinition > m_xComponent;
 ::std::vector< OUString> m_aMasterFields;
 ::std::vector< OUString> m_aDetailFields;
 OXMLReport(const OXMLReport&) = delete;
diff --git a/reportdesign/source/filter/xml/xmlReportElementBase.hxx 
b/reportdesign/source/filter/xml/xmlReportElementBase.hxx
index c087dbd..ec14b63 100644
--- a/reportdesign/source/filter/xml/xmlReportElementBase.hxx
+++ b/reportdesign/source/filter/xml/xmlReportElementBase.hxx
@@ -44,7 +44,7 @@ namespace rptxml
 protected:
 ORptFilter&   m_rImport;
 OXMLTable*m_pContainer;
-::com::sun::star::uno::Reference< 
::com::sun::star::report::XReportComponent >  m_xComponent;
+::com::sun::star::uno::Reference< 
::com::sun::star::report::XReportComponent >  m_xReportComponent;
 
 virtual SvXMLImportContext* _CreateChildContext( sal_uInt16 nPrefix,
 const OUString& rLocalName,
diff --git a/sc/source/ui/vba/vbaformat.cxx b/sc/source/ui/vba/vbafor