summaryrefslogtreecommitdiff
path: root/xmlscript
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-05-27 13:21:16 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-05-27 14:58:28 +0200
commita76ae1c3d1076cbcb58d3fc27723e4eefffac0a3 (patch)
treeeb80e9db7480a71ee25c9b0eeea72c6779ba6a9d /xmlscript
parent2d0eea0a79df9bc54e075c90ee7d6134b03250c0 (diff)
no need to allocate Style objects separately
Change-Id: I88e4642a81b18c41216784332cc4a37a3bde9d95 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116247 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmlscript')
-rw-r--r--xmlscript/source/xmldlg_imexp/exp_share.hxx2
-rw-r--r--xmlscript/source/xmldlg_imexp/xmldlg_export.cxx64
2 files changed, 33 insertions, 33 deletions
diff --git a/xmlscript/source/xmldlg_imexp/exp_share.hxx b/xmlscript/source/xmldlg_imexp/exp_share.hxx
index dc7da2477194..919950c79bef 100644
--- a/xmlscript/source/xmldlg_imexp/exp_share.hxx
+++ b/xmlscript/source/xmldlg_imexp/exp_share.hxx
@@ -73,7 +73,7 @@ struct Style
};
class StyleBag
{
- ::std::vector< std::unique_ptr<Style> > _styles;
+ ::std::vector<Style> _styles;
public:
~StyleBag() ;
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
index 55ee293bc464..6a7af3fc3d85 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
@@ -1272,72 +1272,72 @@ OUString StyleBag::getStyleId( Style const & rStyle )
}
// lookup existing style
- for (auto const & pStyle : _styles)
+ for (auto & rExistingStyle : _styles)
{
short demanded_defaults = ~rStyle._set & rStyle._all;
// test, if defaults are not set
- if ((~pStyle->_set & demanded_defaults) == demanded_defaults &&
- (rStyle._set & (pStyle->_all & ~pStyle->_set)) == 0)
+ if ((~rExistingStyle._set & demanded_defaults) == demanded_defaults &&
+ (rStyle._set & (rExistingStyle._all & ~rExistingStyle._set)) == 0)
{
- short bset = rStyle._set & pStyle->_set;
+ short bset = rStyle._set & rExistingStyle._set;
if ((bset & 0x1) &&
- rStyle._backgroundColor != pStyle->_backgroundColor)
+ rStyle._backgroundColor != rExistingStyle._backgroundColor)
continue;
if ((bset & 0x2) &&
- rStyle._textColor != pStyle->_textColor)
+ rStyle._textColor != rExistingStyle._textColor)
continue;
if ((bset & 0x20) &&
- rStyle._textLineColor != pStyle->_textLineColor)
+ rStyle._textLineColor != rExistingStyle._textLineColor)
continue;
if ((bset & 0x10) &&
- rStyle._fillColor != pStyle->_fillColor)
+ rStyle._fillColor != rExistingStyle._fillColor)
continue;
if ((bset & 0x4) &&
- (rStyle._border != pStyle->_border ||
+ (rStyle._border != rExistingStyle._border ||
(rStyle._border == BORDER_SIMPLE_COLOR &&
- rStyle._borderColor != pStyle->_borderColor)))
+ rStyle._borderColor != rExistingStyle._borderColor)))
continue;
if ((bset & 0x8) &&
- !equalFont( rStyle, *pStyle ))
+ !equalFont( rStyle, rExistingStyle ))
continue;
if ((bset & 0x40) &&
- rStyle._visualEffect != pStyle->_visualEffect)
+ rStyle._visualEffect != rExistingStyle._visualEffect)
continue;
// merge in
- short bnset = rStyle._set & ~pStyle->_set;
+ short bnset = rStyle._set & ~rExistingStyle._set;
if (bnset & 0x1)
- pStyle->_backgroundColor = rStyle._backgroundColor;
+ rExistingStyle._backgroundColor = rStyle._backgroundColor;
if (bnset & 0x2)
- pStyle->_textColor = rStyle._textColor;
+ rExistingStyle._textColor = rStyle._textColor;
if (bnset & 0x20)
- pStyle->_textLineColor = rStyle._textLineColor;
+ rExistingStyle._textLineColor = rStyle._textLineColor;
if (bnset & 0x10)
- pStyle->_fillColor = rStyle._fillColor;
+ rExistingStyle._fillColor = rStyle._fillColor;
if (bnset & 0x4) {
- pStyle->_border = rStyle._border;
- pStyle->_borderColor = rStyle._borderColor;
+ rExistingStyle._border = rStyle._border;
+ rExistingStyle._borderColor = rStyle._borderColor;
}
if (bnset & 0x8) {
- pStyle->_descr = rStyle._descr;
- pStyle->_fontRelief = rStyle._fontRelief;
- pStyle->_fontEmphasisMark = rStyle._fontEmphasisMark;
+ rExistingStyle._descr = rStyle._descr;
+ rExistingStyle._fontRelief = rStyle._fontRelief;
+ rExistingStyle._fontEmphasisMark = rStyle._fontEmphasisMark;
}
if (bnset & 0x40)
- pStyle->_visualEffect = rStyle._visualEffect;
+ rExistingStyle._visualEffect = rStyle._visualEffect;
- pStyle->_all |= rStyle._all;
- pStyle->_set |= rStyle._set;
+ rExistingStyle._all |= rStyle._all;
+ rExistingStyle._set |= rStyle._set;
- return pStyle->_id;
+ return rExistingStyle._id;
}
}
// no appr style found, append new
- std::unique_ptr<Style> pStyle(new Style( rStyle ));
- pStyle->_id = OUString::number( _styles.size() );
- _styles.push_back( std::move(pStyle) );
- return _styles.back()->_id;
+ Style aNewStyle( rStyle );
+ aNewStyle._id = OUString::number( _styles.size() );
+ _styles.push_back( aNewStyle );
+ return _styles.back()._id;
}
StyleBag::~StyleBag()
@@ -1353,9 +1353,9 @@ void StyleBag::dump( Reference< xml::sax::XExtendedDocumentHandler > const & xOu
xOut->ignorableWhitespace( OUString() );
xOut->startElement( aStylesName, Reference< xml::sax::XAttributeList >() );
// export styles
- for (auto const & _style : _styles)
+ for (auto & _style : _styles)
{
- Reference< xml::sax::XAttributeList > xAttr( _style->createElement() );
+ Reference< xml::sax::XAttributeList > xAttr( _style.createElement() );
static_cast< ElementDescriptor * >( xAttr.get() )->dump( xOut );
}
xOut->ignorableWhitespace( OUString() );