[Libreoffice-commits] core.git: 4 commits - reportdesign/source svx/inc svx/Package_inc.mk svx/source
David Tardon
dtardon at redhat.com
Sat Mar 23 00:10:20 PDT 2013
reportdesign/source/core/sdr/RptModel.cxx | 1
svx/Package_inc.mk | 1
svx/inc/svx/itextprovider.hxx | 42 ++++++++++++++
svx/inc/svx/sdr/contact/displayinfo.hxx | 14 ----
svx/inc/svx/sdr/properties/textproperties.hxx | 4 +
svx/inc/svx/svdmodel.hxx | 3 -
svx/inc/svx/svdotext.hxx | 3 -
svx/source/sdr/contact/displayinfo.cxx | 6 --
svx/source/sdr/contact/viewobjectcontactofpageobj.cxx | 2
svx/source/sdr/properties/textproperties.cxx | 38 ++++++++-----
svx/source/svdraw/svdmodel.cxx | 18 +-----
svx/source/table/cell.cxx | 52 ++++++++++++++++++
12 files changed, 131 insertions(+), 53 deletions(-)
New commits:
commit 91864e19c84ae9834d6e97ee5ddc4db5bf957681
Author: David Tardon <dtardon at redhat.com>
Date: Fri Mar 22 16:49:41 2013 +0100
rhbz#876742 speed up table manipulation in Impress
It turns out this is not actually a performance problem but an oversight
in implementation (or a bug, if you want .-)
Every manipulation with a table (e.g., move, resize; actually even a
selection of the table) leads to creation of a full copy of the table
(SdrObject::getFullDragClone()). One of the actions the table copy impl.
does is to call sdr::CellProperties::SetStyleSheet() on every cell of
the new table. CellProperties is derived from
sdr::properties::TextProperties and CellProperties::SetStyleSheet() just
passes the call to TextProperties::SetStyleSheet(). This is where the
trouble begins :-)
The SDR representation of a table, SdrTableObj, is derived from
SdrTextObj. Because of that, SdrTextObj needs to be able to contain more
than one SdrText (because a table needs one for every cell). This is
handled correctly by TextProperties. But, because there is no SDR
representation of a single cell, CellProperties uses the SdrTableObj as
the SDR object it works on. Therefore TextProperties::SetStyleSheet()
processes all SdrText objects of the _whole table_, not just a single
cell. And this is repeated for every other cell...
Change-Id: Iab2e2d0e1e8038710645c0bd24666e6032b0a003
diff --git a/svx/Package_inc.mk b/svx/Package_inc.mk
index e1deeab..cb54894 100644
--- a/svx/Package_inc.mk
+++ b/svx/Package_inc.mk
@@ -31,6 +31,7 @@ $(eval $(call gb_Package_add_file,svx_inc,inc/svx/xftdiit.hxx,svx/xftdiit.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/fntctl.hxx,svx/fntctl.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdattr.hxx,svx/svdattr.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/imapdlg.hxx,svx/imapdlg.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/itextprovider.hxx,svx/itextprovider.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/linkwarn.hxx,svx/linkwarn.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/formatpaintbrushctrl.hxx,svx/formatpaintbrushctrl.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xcolit.hxx,svx/xcolit.hxx))
diff --git a/svx/inc/svx/itextprovider.hxx b/svx/inc/svx/itextprovider.hxx
new file mode 100644
index 0000000..3202e4d
--- /dev/null
+++ b/svx/inc/svx/itextprovider.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#if !defined SVX_ITEXTPROVIDER_HXX_INCLUDED
+#define SVX_ITEXTPROVIDER_HXX_INCLUDED
+
+#include <sal/types.h>
+
+#include <svx/svxdllapi.h>
+
+class SdrText;
+
+namespace svx
+{
+
+ /** This interface provides access to text object(s) in an SdrObject.
+
+ */
+ class SVX_DLLPUBLIC ITextProvider
+ {
+ public:
+ /** Return the number of texts available for this object. */
+ virtual sal_Int32 getTextCount() const = 0;
+
+ /** Return the nth available text. */
+ virtual SdrText* getText(sal_Int32 nIndex) const = 0;
+
+ protected:
+ ~ITextProvider() {}
+ };
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/inc/svx/sdr/properties/textproperties.hxx b/svx/inc/svx/sdr/properties/textproperties.hxx
index ac6a613..456b104 100644
--- a/svx/inc/svx/sdr/properties/textproperties.hxx
+++ b/svx/inc/svx/sdr/properties/textproperties.hxx
@@ -20,6 +20,7 @@
#ifndef _SDR_PROPERTIES_TEXTPROPERTIES_HXX
#define _SDR_PROPERTIES_TEXTPROPERTIES_HXX
+#include <svx/itextprovider.hxx>
#include <svx/sdr/properties/attributeproperties.hxx>
#include "svx/svxdllapi.h"
@@ -45,6 +46,9 @@ namespace sdr
// react on ItemSet changes
virtual void ItemSetChanged(const SfxItemSet& rSet);
+ /// Get the TextProvider related to our SdrObject
+ virtual const svx::ITextProvider& getTextProvider() const;
+
public:
// basic constructor
explicit TextProperties(SdrObject& rObj);
diff --git a/svx/inc/svx/svdotext.hxx b/svx/inc/svx/svdotext.hxx
index 30a923b..a5df49b 100644
--- a/svx/inc/svx/svdotext.hxx
+++ b/svx/inc/svx/svdotext.hxx
@@ -21,6 +21,7 @@
#define _SVDOTEXT_HXX
#include <vcl/field.hxx>
+#include <svx/itextprovider.hxx>
#include <svx/svdoattr.hxx>
#include <svx/svdtrans.hxx> // GeoStat
#include <tools/datetime.hxx>
@@ -123,7 +124,7 @@ namespace sdr
// SdrTextObj
//************************************************************
-class SVX_DLLPUBLIC SdrTextObj : public SdrAttrObj
+class SVX_DLLPUBLIC SdrTextObj : public SdrAttrObj, public svx::ITextProvider
{
private:
// Cell needs access to ImpGetDrawOutliner();
diff --git a/svx/source/sdr/properties/textproperties.cxx b/svx/source/sdr/properties/textproperties.cxx
index e4b7f5f..156268f 100644
--- a/svx/source/sdr/properties/textproperties.cxx
+++ b/svx/source/sdr/properties/textproperties.cxx
@@ -82,14 +82,15 @@ namespace sdr
void TextProperties::ItemSetChanged(const SfxItemSet& rSet)
{
SdrTextObj& rObj = (SdrTextObj&)GetSdrObject();
- sal_Int32 nText = rObj.getTextCount();
+ const svx::ITextProvider& rTextProvider(getTextProvider());
+ sal_Int32 nText = rTextProvider.getTextCount();
// #i101556# ItemSet has changed -> new version
maVersion++;
while( --nText >= 0 )
{
- SdrText* pText = rObj.getText( nText );
+ SdrText* pText = rTextProvider.getText( nText );
OutlinerParaObject* pParaObj = pText ? pText->GetOutlinerParaObject() : 0;
@@ -170,10 +171,11 @@ namespace sdr
{
SdrOutliner& rOutliner = rObj.ImpGetDrawOutliner();
- sal_Int32 nCount = rObj.getTextCount();
+ const svx::ITextProvider& rTextProvider(getTextProvider());
+ sal_Int32 nCount = rTextProvider.getTextCount();
while( nCount-- )
{
- SdrText* pText = rObj.getText( nCount );
+ SdrText* pText = rTextProvider.getText( nCount );
OutlinerParaObject* pParaObj = pText->GetOutlinerParaObject();
if( pParaObj )
{
@@ -223,6 +225,11 @@ namespace sdr
}
}
+ const svx::ITextProvider& TextProperties::getTextProvider() const
+ {
+ return static_cast<const SdrTextObj&>(GetSdrObject());
+ }
+
void TextProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
{
SdrTextObj& rObj = (SdrTextObj&)GetSdrObject();
@@ -237,11 +244,12 @@ namespace sdr
{
SdrOutliner& rOutliner = rObj.ImpGetDrawOutliner();
- sal_Int32 nText = rObj.getTextCount();
+ const svx::ITextProvider& rTextProvider(getTextProvider());
+ sal_Int32 nText = rTextProvider.getTextCount();
while( --nText >= 0 )
{
- SdrText* pText = rObj.getText( nText );
+ SdrText* pText = rTextProvider.getText( nText );
OutlinerParaObject* pParaObj = pText ? pText->GetOutlinerParaObject() : 0;
if( !pParaObj )
@@ -396,11 +404,12 @@ namespace sdr
&& !rObj.IsLinkedText())
{
Outliner* pOutliner = SdrMakeOutliner(OUTLINERMODE_OUTLINEOBJECT, rObj.GetModel());
- sal_Int32 nText = rObj.getTextCount();
+ const svx::ITextProvider& rTextProvider(getTextProvider());
+ sal_Int32 nText = rTextProvider.getTextCount();
while( --nText >= 0 )
{
- SdrText* pText = rObj.getText( nText );
+ SdrText* pText = rTextProvider.getText( nText );
OutlinerParaObject* pParaObj = pText ? pText->GetOutlinerParaObject() : 0;
if( !pParaObj )
@@ -542,6 +551,7 @@ namespace sdr
SdrTextObj& rObj = (SdrTextObj&)GetSdrObject();
if(rObj.HasText())
{
+ const svx::ITextProvider& rTextProvider(getTextProvider());
if(HAS_BASE(SfxStyleSheet, &rBC))
{
SfxSimpleHint* pSimple = PTR_CAST(SfxSimpleHint, &rHint);
@@ -551,10 +561,10 @@ namespace sdr
{
rObj.SetPortionInfoChecked(sal_False);
- sal_Int32 nText = rObj.getTextCount();
+ sal_Int32 nText = rTextProvider.getTextCount();
while( --nText > 0 )
{
- OutlinerParaObject* pParaObj = rObj.getText(nText )->GetOutlinerParaObject();
+ OutlinerParaObject* pParaObj = rTextProvider.getText( nText )->GetOutlinerParaObject();
if( pParaObj )
pParaObj->ClearPortionInfo();
}
@@ -574,10 +584,10 @@ namespace sdr
if(SFX_HINT_DYING == nId)
{
rObj.SetPortionInfoChecked(sal_False);
- sal_Int32 nText = rObj.getTextCount();
+ sal_Int32 nText = rTextProvider.getTextCount();
while( --nText > 0 )
{
- OutlinerParaObject* pParaObj = rObj.getText(nText )->GetOutlinerParaObject();
+ OutlinerParaObject* pParaObj = rTextProvider.getText( nText )->GetOutlinerParaObject();
if( pParaObj )
pParaObj->ClearPortionInfo();
}
@@ -596,10 +606,10 @@ namespace sdr
if(!aOldName.Equals(aNewName))
{
- sal_Int32 nText = rObj.getTextCount();
+ sal_Int32 nText = rTextProvider.getTextCount();
while( --nText > 0 )
{
- OutlinerParaObject* pParaObj = rObj.getText(nText )->GetOutlinerParaObject();
+ OutlinerParaObject* pParaObj = rTextProvider.getText( nText )->GetOutlinerParaObject();
if( pParaObj )
pParaObj->ChangeStyleSheetName(eFamily, aOldName, aNewName);
}
diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx
index e46b486..3a33a28 100644
--- a/svx/source/table/cell.cxx
+++ b/svx/source/table/cell.cxx
@@ -99,6 +99,46 @@ static const SvxItemPropertySet* ImplGetSvxCellPropertySet()
return &aSvxCellPropertySet;
}
+namespace
+{
+
+class CellTextProvider : public svx::ITextProvider
+{
+public:
+ explicit CellTextProvider(const sdr::table::CellRef xCell);
+ virtual ~CellTextProvider();
+
+private:
+ virtual sal_Int32 getTextCount() const;
+ virtual SdrText* getText(sal_Int32 nIndex) const;
+
+private:
+ const sdr::table::CellRef m_xCell;
+};
+
+CellTextProvider::CellTextProvider(const sdr::table::CellRef xCell)
+ : m_xCell(xCell)
+{
+}
+
+CellTextProvider::~CellTextProvider()
+{
+}
+
+sal_Int32 CellTextProvider::getTextCount() const
+{
+ return 1;
+}
+
+SdrText* CellTextProvider::getText(sal_Int32 nIndex) const
+{
+ (void) nIndex;
+ assert(nIndex == 0);
+ return m_xCell.get();
+}
+
+}
+
namespace sdr
{
namespace properties
@@ -109,6 +149,8 @@ namespace sdr
// create a new itemset
SfxItemSet& CreateObjectSpecificItemSet(SfxItemPool& rPool);
+ const svx::ITextProvider& getTextProvider() const;
+
public:
// basic constructor
CellProperties(SdrObject& rObj, sdr::table::Cell* pCell );
@@ -131,6 +173,9 @@ namespace sdr
void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr);
sdr::table::CellRef mxCell;
+
+ private:
+ const CellTextProvider maTextProvider;
};
// create a new itemset
@@ -153,15 +198,22 @@ namespace sdr
0, 0));
}
+ const svx::ITextProvider& CellProperties::getTextProvider() const
+ {
+ return maTextProvider;
+ }
+
CellProperties::CellProperties(SdrObject& rObj, sdr::table::Cell* pCell)
: TextProperties(rObj)
, mxCell(pCell)
+ , maTextProvider(mxCell)
{
}
CellProperties::CellProperties(const CellProperties& rProps, SdrObject& rObj, sdr::table::Cell* pCell)
: TextProperties(rProps, rObj)
, mxCell( pCell )
+ , maTextProvider(mxCell)
{
}
commit e3ad376f601d3abfc1b9e47dc0419d52785bd9b9
Author: David Tardon <dtardon at redhat.com>
Date: Wed Mar 20 11:11:44 2013 +0100
drop unused includes
Change-Id: I819539b372d33cc8982a01d7bb72093cedb6461f
diff --git a/svx/inc/svx/sdr/contact/displayinfo.hxx b/svx/inc/svx/sdr/contact/displayinfo.hxx
index 88ccd81..6c4b85e 100644
--- a/svx/inc/svx/sdr/contact/displayinfo.hxx
+++ b/svx/inc/svx/sdr/contact/displayinfo.hxx
@@ -20,24 +20,10 @@
#ifndef _SDR_CONTACT_DISPLAYINFO_HXX
#define _SDR_CONTACT_DISPLAYINFO_HXX
-#include <sal/types.h>
#include <svx/svdsob.hxx>
-#include <svtools/colorcfg.hxx>
#include <vcl/region.hxx>
-#include <vector>
#include "svx/svxdllapi.h"
-//////////////////////////////////////////////////////////////////////////////
-// predeclarations
-
-class SdrPage;
-
-namespace sdr { namespace contact {
- class ViewObjectContact;
-}}
-
-//////////////////////////////////////////////////////////////////////////////
-
namespace sdr
{
namespace contact
diff --git a/svx/source/sdr/contact/displayinfo.cxx b/svx/source/sdr/contact/displayinfo.cxx
index 004dca2..72d7aa7 100644
--- a/svx/source/sdr/contact/displayinfo.cxx
+++ b/svx/source/sdr/contact/displayinfo.cxx
@@ -18,12 +18,6 @@
*/
#include <svx/sdr/contact/displayinfo.hxx>
-#include <vcl/outdev.hxx>
-#include <vcl/svapp.hxx>
-#include <svx/svdobj.hxx>
-#include <vcl/gdimtf.hxx>
-#include <svx/svdpagv.hxx>
-#include <svx/svdview.hxx>
//////////////////////////////////////////////////////////////////////////////
diff --git a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
index 729abfd..e830bf8 100644
--- a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
@@ -18,6 +18,8 @@
*/
+#include <svtools/colorcfg.hxx>
+
#include <svx/sdr/contact/viewobjectcontactofpageobj.hxx>
#include <svx/sdr/contact/viewcontactofpageobj.hxx>
#include <svx/svdopage.hxx>
commit 8d8868a827e0daf3edd3f69a2c22cc185a7d496c
Author: David Tardon <dtardon at redhat.com>
Date: Wed Mar 20 06:47:39 2013 +0100
drop unused member var
Change-Id: I68004a90cbfdf6bf6c5b09998406a5479e5c50d6
diff --git a/reportdesign/source/core/sdr/RptModel.cxx b/reportdesign/source/core/sdr/RptModel.cxx
index 47b0b6c..98cba0d 100644
--- a/reportdesign/source/core/sdr/RptModel.cxx
+++ b/reportdesign/source/core/sdr/RptModel.cxx
@@ -57,7 +57,6 @@ OReportModel::OReportModel(::reportdesign::OReportDefinition* _pReportDefinition
,m_pReportDefinition(_pReportDefinition)
{
DBG_CTOR( rpt_OReportModel,0);
- SetAllowShapePropertyChangeListener(true);
m_pUndoEnv = new OXUndoEnvironment(*this);
m_pUndoEnv->acquire();
SetSdrUndoFactory(new OReportUndoFactory);
diff --git a/svx/inc/svx/svdmodel.hxx b/svx/inc/svx/svdmodel.hxx
index 739028d..f8fbf82 100644
--- a/svx/inc/svx/svdmodel.hxx
+++ b/svx/inc/svx/svdmodel.hxx
@@ -233,9 +233,6 @@ public:
// for import
void SetUniqueCommentID(sal_uInt32 nNewID) { if(nNewID != mnUniqueCommentID) { mnUniqueCommentID = nNewID; } }
- /** cl: added this for OJ to complete his reporting engine, does not work
- correctly so only enable it for his model */
- void SetAllowShapePropertyChangeListener( bool bAllow );
sal_uInt16 nStarDrawPreviewMasterPageNum;
SvxForbiddenCharactersTable* mpForbiddenCharactersTable;
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index 2ea9027..c6bc6f4 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -98,7 +98,6 @@ struct SdrModelImpl
{
SfxUndoManager* mpUndoManager;
SdrUndoFactory* mpUndoFactory;
- bool mbAllowShapePropertyChangeListener;
};
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -111,7 +110,6 @@ void SdrModel::ImpCtor(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* _pEmbe
mpImpl = new SdrModelImpl;
mpImpl->mpUndoManager=0;
mpImpl->mpUndoFactory=0;
- mpImpl->mbAllowShapePropertyChangeListener = false;
mbInDestruction = false;
aObjUnit=SdrEngineDefaults::GetMapFraction();
eObjUnit=SdrEngineDefaults::GetMapUnit();
@@ -2063,16 +2061,6 @@ void SdrModel::SetSdrUndoFactory( SdrUndoFactory* pUndoFactory )
}
}
-/* added for the reporting engine, but does not work
- correctly, so only enable it for this model */
-void SdrModel::SetAllowShapePropertyChangeListener( bool bAllow )
-{
- if( mpImpl )
- {
- mpImpl->mbAllowShapePropertyChangeListener = bAllow;
- }
-}
-
namespace
{
class theSdrModelUnoTunnelImplementationId : public rtl::Static< UnoTunnelIdInit, theSdrModelUnoTunnelImplementationId > {};
commit 6a08c0cba41dc63acb2c22c48170b081cc99e46c
Author: David Tardon <dtardon at redhat.com>
Date: Mon Mar 18 15:52:42 2013 +0100
broadcast change if removing NULL page
Change-Id: Iacf5e9cc509e29aaf5dd1321407c0de9db7677f3
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index 6bddfb3..2ea9027 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -1486,12 +1486,14 @@ SdrPage* SdrModel::RemovePage(sal_uInt16 nPgNum)
void SdrModel::MovePage(sal_uInt16 nPgNum, sal_uInt16 nNewPos)
{
SdrPage* pPg=maPages[nPgNum];
- maPages.erase(maPages.begin()+nPgNum);
- PageListChanged();
if (pPg!=NULL) {
+ maPages.erase(maPages.begin()+nPgNum); // shortcut to avoid two broadcasts
+ PageListChanged();
pPg->SetInserted(sal_False);
InsertPage(pPg,nNewPos);
}
+ else
+ RemovePage(nPgNum);
}
void SdrModel::InsertMasterPage(SdrPage* pPage, sal_uInt16 nPos)
More information about the Libreoffice-commits
mailing list