[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - 2 commits - svx/source xmloff/source
Matúš Kukan
matus.kukan at collabora.com
Sun Jun 1 23:52:00 PDT 2014
svx/source/table/tablelayouter.cxx | 10 ++++------
svx/source/table/tablelayouter.hxx | 5 ++---
svx/source/table/viewcontactoftableobj.cxx | 2 +-
xmloff/source/style/xmlnumi.cxx | 6 +++---
4 files changed, 10 insertions(+), 13 deletions(-)
New commits:
commit 29162832feafca9259dc1589d10f3cfd43ea8126
Author: Matúš Kukan <matus.kukan at collabora.com>
Date: Fri May 30 10:44:51 2014 +0200
fdo#76324: Use one static SvXMLTokenMap object, it's faster.
For me it saves ~10% of load time for calc document with 2000 comments.
Thanks to Michael for noticing this oddity.
Change-Id: Id44f44c02df2ae9360d02c28081601f5f7a8ea27
(cherry picked from commit d2e0465d406b33139f3a97e1738020d6a7a6f6c3)
diff --git a/xmloff/source/style/xmlnumi.cxx b/xmloff/source/style/xmlnumi.cxx
index 6649b29..917b6f4 100644
--- a/xmloff/source/style/xmlnumi.cxx
+++ b/xmloff/source/style/xmlnumi.cxx
@@ -291,7 +291,7 @@ SvxXMLListLevelStyleContext_Impl::SvxXMLListLevelStyleContext_Impl(
else if( IsXMLToken( rLName, XML_LIST_LEVEL_STYLE_IMAGE ) )
bImage = true;
- SvXMLTokenMap aTokenMap( lcl_getLevelAttrTokenMap() );
+ static const SvXMLTokenMap aTokenMap( lcl_getLevelAttrTokenMap() );
sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
for( sal_Int16 i=0; i < nAttrCount; i++ )
{
@@ -666,7 +666,7 @@ SvxXMLListLevelStyleAttrContext_Impl::SvxXMLListLevelStyleAttrContext_Impl(
SvXMLImportContext( rImport, nPrfx, rLName ),
rListLevel( rLLevel )
{
- SvXMLTokenMap aTokenMap( lcl_getStyleAttributesAttrTokenMap() );
+ static const SvXMLTokenMap aTokenMap( lcl_getStyleAttributesAttrTokenMap() );
SvXMLUnitConverter& rUnitConv = GetImport().GetMM100UnitConverter();
OUString sFontName, sFontFamily, sFontStyleName, sFontFamilyGeneric,
@@ -960,7 +960,7 @@ SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl::SvxXMLListLevelStyleLabelAli
SvXMLImportContext( rImport, nPrfx, rLName ),
rListLevel( rLLevel )
{
- SvXMLTokenMap aTokenMap( lcl_getStyleAlignmentAttributesAttrTokenMap() );
+ static const SvXMLTokenMap aTokenMap( lcl_getStyleAlignmentAttributesAttrTokenMap() );
SvXMLUnitConverter& rUnitConv = GetImport().GetMM100UnitConverter();
sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
commit 996d5f81d049bde7148a3afc776f8cdaa6b0101e
Author: Matúš Kukan <matus.kukan at collabora.com>
Date: Wed May 28 11:55:02 2014 +0200
Pass also const CellRef& to save a lot of getCellByPosition() calls.
Change-Id: I86c89a05d263cada38ff54eaccf9ba39458db52e
(cherry picked from commit 7b9b57b41936eea673eb678407ed817856ba0912)
diff --git a/svx/source/table/tablelayouter.cxx b/svx/source/table/tablelayouter.cxx
index 687fa27..7f4651d 100644
--- a/svx/source/table/tablelayouter.cxx
+++ b/svx/source/table/tablelayouter.cxx
@@ -72,14 +72,13 @@ TableLayouter::~TableLayouter()
-basegfx::B2ITuple TableLayouter::getCellSize( const CellPos& rPos ) const
+basegfx::B2ITuple TableLayouter::getCellSize( const CellRef& xCell, const CellPos& rPos ) const
{
sal_Int32 width = 0;
sal_Int32 height = 0;
try
{
- CellRef xCell( getCell( rPos ) );
if( xCell.is() && !xCell->isMerged() )
{
CellPos aPos( rPos );
@@ -117,14 +116,13 @@ basegfx::B2ITuple TableLayouter::getCellSize( const CellPos& rPos ) const
-bool TableLayouter::getCellArea( const CellPos& rPos, basegfx::B2IRectangle& rArea ) const
+bool TableLayouter::getCellArea( const CellRef& xCell, const CellPos& rPos, basegfx::B2IRectangle& rArea ) const
{
try
{
- CellRef xCell( getCell( rPos ) );
if( xCell.is() && !xCell->isMerged() && isValid(rPos) )
{
- const basegfx::B2ITuple aCellSize( getCellSize( rPos ) );
+ const basegfx::B2ITuple aCellSize( getCellSize( xCell, rPos ) );
const bool bRTL = (mxTable->getSdrTableObj()->GetWritingMode() == WritingMode_RL_TB);
if( (rPos.mnCol < ((sal_Int32)maColumns.size()) && (rPos.mnRow < ((sal_Int32)maRows.size()) ) ) )
@@ -862,7 +860,7 @@ void TableLayouter::updateCells( Rectangle& rRectangle )
if( xCell.is() )
{
basegfx::B2IRectangle aCellArea;
- getCellArea( aPos, aCellArea );
+ getCellArea( xCell, aPos, aCellArea );
Rectangle aCellRect;
aCellRect.Left() = aCellArea.getMinX();
diff --git a/svx/source/table/tablelayouter.hxx b/svx/source/table/tablelayouter.hxx
index ce2b634..f60fc3e 100644
--- a/svx/source/table/tablelayouter.hxx
+++ b/svx/source/table/tablelayouter.hxx
@@ -73,9 +73,7 @@ public:
void UpdateBorderLayout();
- basegfx::B2ITuple getCellSize( const CellPos& rPos ) const;
- bool getCellArea( const CellRef& xCell, basegfx::B2IRectangle& rArea ) const;
- bool getCellArea( const CellPos& rPos, basegfx::B2IRectangle& rArea ) const;
+ bool getCellArea( const CellRef& xCell, const CellPos& rPos, basegfx::B2IRectangle& rArea ) const;
::sal_Int32 getRowCount() const { return static_cast< ::sal_Int32 >( maRows.size() ); }
::sal_Int32 getColumnCount() const { return static_cast< ::sal_Int32 >( maColumns.size() ); }
@@ -103,6 +101,7 @@ public:
private:
CellRef getCell( const CellPos& rPos ) const;
+ basegfx::B2ITuple getCellSize( const CellRef& xCell, const CellPos& rPos ) const;
void LayoutTableWidth( ::Rectangle& rArea, bool bFit );
void LayoutTableHeight( ::Rectangle& rArea, bool bFit );
diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx
index bc87338..08e2825 100644
--- a/svx/source/table/viewcontactoftableobj.cxx
+++ b/svx/source/table/viewcontactoftableobj.cxx
@@ -576,7 +576,7 @@ namespace sdr
if(xCurrentCell.is() && !xCurrentCell->isMerged())
{
- if(rTableLayouter.getCellArea(aCellPos, aCellArea))
+ if(rTableLayouter.getCellArea(xCurrentCell, aCellPos, aCellArea))
{
// create cell transformation matrix
basegfx::B2DHomMatrix aCellMatrix;
More information about the Libreoffice-commits
mailing list