summaryrefslogtreecommitdiff
path: root/svx/inc
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2013-03-22 16:49:41 +0100
committerDavid Tardon <dtardon@redhat.com>2013-03-23 08:09:44 +0100
commit91864e19c84ae9834d6e97ee5ddc4db5bf957681 (patch)
tree4cb75ff52dd6d760d68315b03c2ea538f3949b84 /svx/inc
parente3ad376f601d3abfc1b9e47dc0419d52785bd9b9 (diff)
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
Diffstat (limited to 'svx/inc')
-rw-r--r--svx/inc/svx/itextprovider.hxx42
-rw-r--r--svx/inc/svx/sdr/properties/textproperties.hxx4
-rw-r--r--svx/inc/svx/svdotext.hxx3
3 files changed, 48 insertions, 1 deletions
diff --git a/svx/inc/svx/itextprovider.hxx b/svx/inc/svx/itextprovider.hxx
new file mode 100644
index 000000000000..3202e4d65495
--- /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 ac6a613e2c2a..456b104e60ec 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 30a923bb566a..a5df49bdd24f 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();