summaryrefslogtreecommitdiff
path: root/svx/source/table
diff options
context:
space:
mode:
authorSerge Krot <Serge.Krot@cib.de>2020-01-03 20:08:45 +0100
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2020-01-06 15:55:25 +0100
commit92ccf53b2a8102299ac2c3e2612bb507d3a79c0f (patch)
tree8e531d755fc6876db72a4d48f8bd702728a2043f /svx/source/table
parentf29a5020ee7bbfff1860cdd94c271ef30937fa95 (diff)
tdf#129708 speed-up: check if we could create outline instead of creation of it
Change-Id: I0629b4e6ccae4ab9be0142fe39c627f2f9a8f5ea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86199 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'svx/source/table')
-rw-r--r--svx/source/table/accessiblecell.cxx12
-rw-r--r--svx/source/table/cell.cxx20
-rw-r--r--svx/source/table/tablertfexporter.cxx2
3 files changed, 15 insertions, 19 deletions
diff --git a/svx/source/table/accessiblecell.cxx b/svx/source/table/accessiblecell.cxx
index 60942150bdf6..77c91a0db481 100644
--- a/svx/source/table/accessiblecell.cxx
+++ b/svx/source/table/accessiblecell.cxx
@@ -73,15 +73,8 @@ void AccessibleCell::Init()
const vcl::Window* pWindow = maShapeTreeInfo.GetWindow ();
if( (pView != nullptr) && (pWindow != nullptr) && mxCell.is())
{
- OutlinerParaObject* pOutlinerParaObject = mxCell->GetEditOutlinerParaObject().release(); // Get the OutlinerParaObject if text edit is active
-
- bool bOwnParaObject = pOutlinerParaObject != nullptr;
-
- if( !pOutlinerParaObject )
- pOutlinerParaObject = mxCell->GetOutlinerParaObject();
-
// create AccessibleTextHelper to handle this shape's text
- if( pOutlinerParaObject )
+ if( mxCell->CanCreateEditOutlinerParaObject() || mxCell->GetOutlinerParaObject() != nullptr )
{
// non-empty text -> use full-fledged edit source right away
@@ -90,9 +83,6 @@ void AccessibleCell::Init()
mpText->SetFocus();
mpText->SetEventSource(this);
}
-
- if( bOwnParaObject)
- delete pOutlinerParaObject;
}
}
diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx
index 9a752e00599c..67511b76fcc3 100644
--- a/svx/source/table/cell.cxx
+++ b/svx/source/table/cell.cxx
@@ -231,7 +231,7 @@ namespace sdr
if( mxCell.is() )
{
- OutlinerParaObject* pParaObj = mxCell->GetEditOutlinerParaObject().release();
+ OutlinerParaObject* pParaObj = mxCell->CreateEditOutlinerParaObject().release();
const bool bOwnParaObj = pParaObj != nullptr;
@@ -311,7 +311,7 @@ namespace sdr
rObj.SetVerticalWriting(bVertical);
// Set a cell vertical property
- OutlinerParaObject* pParaObj = mxCell->GetEditOutlinerParaObject().release();
+ OutlinerParaObject* pParaObj = mxCell->CreateEditOutlinerParaObject().release();
const bool bOwnParaObj = pParaObj != nullptr;
@@ -332,7 +332,7 @@ namespace sdr
const SvxTextRotateItem* pRotateItem = static_cast<const SvxTextRotateItem*>(pNewItem);
// Set a cell vertical property
- OutlinerParaObject* pParaObj = mxCell->GetEditOutlinerParaObject().release();
+ OutlinerParaObject* pParaObj = mxCell->CreateEditOutlinerParaObject().release();
const bool bOwnParaObj = pParaObj != nullptr;
@@ -601,8 +601,7 @@ bool Cell::IsTextEditActive() const
SdrTableObj& rTableObj = dynamic_cast< SdrTableObj& >( GetObject() );
if(rTableObj.getActiveCell().get() == this )
{
- std::unique_ptr<OutlinerParaObject> pParaObj = rTableObj.GetEditOutlinerParaObject();
- if( pParaObj != nullptr )
+ if( rTableObj.CanCreateEditOutlinerParaObject() )
{
isActive = true;
}
@@ -631,12 +630,19 @@ bool Cell::hasText() const
return false;
}
+bool Cell::CanCreateEditOutlinerParaObject() const
+{
+ SdrTableObj& rTableObj = dynamic_cast< SdrTableObj& >( GetObject() );
+ if( rTableObj.getActiveCell().get() == this )
+ return rTableObj.CanCreateEditOutlinerParaObject();
+ return false;
+}
-std::unique_ptr<OutlinerParaObject> Cell::GetEditOutlinerParaObject() const
+std::unique_ptr<OutlinerParaObject> Cell::CreateEditOutlinerParaObject() const
{
SdrTableObj& rTableObj = dynamic_cast< SdrTableObj& >( GetObject() );
if( rTableObj.getActiveCell().get() == this )
- return rTableObj.GetEditOutlinerParaObject();
+ return rTableObj.CreateEditOutlinerParaObject();
return nullptr;
}
diff --git a/svx/source/table/tablertfexporter.cxx b/svx/source/table/tablertfexporter.cxx
index 732fadfea100..ef1823cf7fed 100644
--- a/svx/source/table/tablertfexporter.cxx
+++ b/svx/source/table/tablertfexporter.cxx
@@ -174,7 +174,7 @@ void SdrTableRtfExporter::WriteCell( sal_Int32 nCol, sal_Int32 nRow )
OUString aContent;
- OutlinerParaObject* pParaObj = xCell->GetEditOutlinerParaObject().release();
+ OutlinerParaObject* pParaObj = xCell->CreateEditOutlinerParaObject().release();
bool bOwnParaObj = pParaObj != nullptr;
if( pParaObj == nullptr )