summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerge Krot <Serge.Krot@cib.de>2020-01-03 20:08:45 +0100
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-01-07 05:56:19 +0100
commite88a993b5b0a1a6245a0ae9e1d1e9f365ec7cba3 (patch)
tree9d74e5d4560c7ad49506724ec50df4c37dc138f9
parentResolves: tdf#129527 enable/disable edit-style button at the right time (diff)
downloadcore-e88a993b5b0a1a6245a0ae9e1d1e9f365ec7cba3.tar.gz
core-e88a993b5b0a1a6245a0ae9e1d1e9f365ec7cba3.zip
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> (cherry picked from commit 92ccf53b2a8102299ac2c3e2612bb507d3a79c0f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86278
-rw-r--r--include/svx/svdotext.hxx3
-rw-r--r--oox/source/export/drawingml.cxx2
-rw-r--r--oox/source/export/vmlexport.cxx2
-rw-r--r--sd/source/ui/slidesorter/controller/SlsSlotManager.cxx3
-rw-r--r--sd/source/ui/unoidl/unoobj.cxx3
-rw-r--r--sd/source/ui/view/drviews7.cxx3
-rw-r--r--sd/source/ui/view/outlnvsh.cxx3
-rw-r--r--svx/source/accessibility/AccessibleShape.cxx15
-rw-r--r--svx/source/inc/cell.hxx3
-rw-r--r--svx/source/sdr/primitive2d/sdrattributecreator.cxx4
-rw-r--r--svx/source/svdraw/svdotext.cxx11
-rw-r--r--svx/source/table/accessiblecell.cxx12
-rw-r--r--svx/source/table/cell.cxx20
-rw-r--r--svx/source/table/tablertfexporter.cxx2
-rw-r--r--svx/source/unodraw/unoshtxt.cxx4
-rw-r--r--sw/source/filter/ww8/rtfsdrexport.cxx2
-rw-r--r--sw/source/filter/ww8/wrtw8esh.cxx2
17 files changed, 43 insertions, 51 deletions
diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index d49f1221dc98..78e09d508199 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -492,7 +492,8 @@ public:
virtual void NbcSetOutlinerParaObject(std::unique_ptr<OutlinerParaObject> pTextObject) override;
void NbcSetOutlinerParaObjectForText( std::unique_ptr<OutlinerParaObject> pTextObject, SdrText* pText );
virtual OutlinerParaObject* GetOutlinerParaObject() const override;
- std::unique_ptr<OutlinerParaObject> GetEditOutlinerParaObject() const;
+ bool CanCreateEditOutlinerParaObject() const;
+ std::unique_ptr<OutlinerParaObject> CreateEditOutlinerParaObject() const;
virtual void NbcReformatText() override;
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index d5e035528651..438135e7c851 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2895,7 +2895,7 @@ void DrawingML::WriteText( const Reference< XInterface >& rXIface, const OUStrin
*/
if (pTxtObj->IsTextEditActive())
{
- pParaObj = pTxtObj->GetEditOutlinerParaObject().release();
+ pParaObj = pTxtObj->CreateEditOutlinerParaObject().release();
bOwnParaObj = true;
}
else
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index a5dc0f403271..98f3243e5461 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -1359,7 +1359,7 @@ sal_Int32 VMLExport::StartShape()
*/
if (pTxtObj->IsTextEditActive())
{
- pParaObj = pTxtObj->GetEditOutlinerParaObject().release();
+ pParaObj = pTxtObj->CreateEditOutlinerParaObject().release();
bOwnParaObj = true;
}
else
diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
index 99be5ad168bb..c49d9ddad355 100644
--- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
@@ -578,8 +578,7 @@ void SlotManager::GetMenuState (SfxItemSet& rSet)
SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
if( pTextObj )
{
- std::unique_ptr<OutlinerParaObject> pParaObj = pTextObj->GetEditOutlinerParaObject();
- if( pParaObj )
+ if( pTextObj->CanCreateEditOutlinerParaObject() )
{
bDisable = false;
}
diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx
index 6c728052b2cb..e0dab445c5c6 100644
--- a/sd/source/ui/unoidl/unoobj.cxx
+++ b/sd/source/ui/unoidl/unoobj.cxx
@@ -854,8 +854,7 @@ bool SdXShape::IsEmptyPresObj() const
if( pTextObj == nullptr )
return true;
- const std::unique_ptr<OutlinerParaObject> pParaObj(pTextObj->GetEditOutlinerParaObject());
- return !pParaObj;
+ return !pTextObj->CanCreateEditOutlinerParaObject();
}
return false;
diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx
index 7fd0ce58368e..21a4d187c014 100644
--- a/sd/source/ui/view/drviews7.cxx
+++ b/sd/source/ui/view/drviews7.cxx
@@ -382,8 +382,7 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet )
SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
if( pTextObj )
{
- std::unique_ptr<OutlinerParaObject> pParaObj = pTextObj->GetEditOutlinerParaObject();
- if( pParaObj )
+ if( pTextObj->CanCreateEditOutlinerParaObject() )
{
bDisable = false;
}
diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx
index 87bb5de8a454..180dd2486923 100644
--- a/sd/source/ui/view/outlnvsh.cxx
+++ b/sd/source/ui/view/outlnvsh.cxx
@@ -959,8 +959,7 @@ void OutlineViewShell::GetMenuState( SfxItemSet &rSet )
SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
if( pTextObj )
{
- std::unique_ptr<OutlinerParaObject> pParaObj = pTextObj->GetEditOutlinerParaObject();
- if( pParaObj )
+ if( pTextObj->CanCreateEditOutlinerParaObject() )
{
bDisable = false;
}
diff --git a/svx/source/accessibility/AccessibleShape.cxx b/svx/source/accessibility/AccessibleShape.cxx
index 3e181647808b..debd4fa7243e 100644
--- a/svx/source/accessibility/AccessibleShape.cxx
+++ b/svx/source/accessibility/AccessibleShape.cxx
@@ -159,18 +159,10 @@ void AccessibleShape::Init()
if( pSdrObject )
{
SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>( pSdrObject );
- OutlinerParaObject* pOutlinerParaObject = nullptr;
-
- if( pTextObj )
- pOutlinerParaObject = pTextObj->GetEditOutlinerParaObject().release(); // Get the OutlinerParaObject if text edit is active
-
- bool bOwnParaObj = pOutlinerParaObject != nullptr;
-
- if (!pOutlinerParaObject)
- pOutlinerParaObject = pSdrObject->GetOutlinerParaObject();
+ const bool hasOutlinerParaObject = pTextObj->CanCreateEditOutlinerParaObject() || pSdrObject->GetOutlinerParaObject() != nullptr;
// create AccessibleTextHelper to handle this shape's text
- if( !pOutlinerParaObject )
+ if( !hasOutlinerParaObject )
{
// empty text -> use proxy edit source to delay creation of EditEngine
mpText.reset( new AccessibleTextHelper( std::make_unique<AccessibleEmptyEditSource >(*pSdrObject, *pView, *pWindow) ) );
@@ -183,9 +175,6 @@ void AccessibleShape::Init()
if( pWindow->HasFocus() )
mpText->SetFocus();
- if( bOwnParaObj )
- delete pOutlinerParaObject;
-
mpText->SetEventSource(this);
}
}
diff --git a/svx/source/inc/cell.hxx b/svx/source/inc/cell.hxx
index 0eb09149ffcb..a0c3d1a7e73e 100644
--- a/svx/source/inc/cell.hxx
+++ b/svx/source/inc/cell.hxx
@@ -71,7 +71,8 @@ public:
SVX_DLLPRIVATE const ::tools::Rectangle& getCellRect() const { return maCellRect; }
SVX_DLLPRIVATE ::tools::Rectangle& getCellRect() { return maCellRect; }
- std::unique_ptr<OutlinerParaObject> GetEditOutlinerParaObject() const;
+ bool CanCreateEditOutlinerParaObject() const;
+ std::unique_ptr<OutlinerParaObject> CreateEditOutlinerParaObject() const;
SVX_DLLPRIVATE void SetStyleSheet( SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr );
SVX_DLLPRIVATE virtual SfxStyleSheet* GetStyleSheet() const override;
SVX_DLLPRIVATE void TakeTextAnchorRect(tools::Rectangle& rAnchorRect) const;
diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
index fb4b8407297f..cb9c2f50c909 100644
--- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx
+++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
@@ -546,7 +546,7 @@ namespace drawinglayer
if(bInEditMode)
{
- std::unique_ptr<OutlinerParaObject> pTempObj = rTextObj.GetEditOutlinerParaObject();
+ std::unique_ptr<OutlinerParaObject> pTempObj = rTextObj.CreateEditOutlinerParaObject();
if(pTempObj)
{
@@ -555,7 +555,7 @@ namespace drawinglayer
else
{
// #i100537#
- // GetEditOutlinerParaObject() returning no object does not mean that
+ // CreateEditOutlinerParaObject() returning no object does not mean that
// text edit mode is not active. Do not reset the flag here
// bInEditMode = false;
}
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index c593b9a2beaa..4ce65ca33f61 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -805,7 +805,16 @@ void SdrTextObj::TakeTextRect( SdrOutliner& rOutliner, tools::Rectangle& rTextRe
rTextRect=aAnkRect;
}
-std::unique_ptr<OutlinerParaObject> SdrTextObj::GetEditOutlinerParaObject() const
+bool SdrTextObj::CanCreateEditOutlinerParaObject() const
+{
+ if( HasTextImpl( pEdtOutl ) )
+ {
+ return pEdtOutl->GetParagraphCount() > 0;
+ }
+ return false;
+}
+
+std::unique_ptr<OutlinerParaObject> SdrTextObj::CreateEditOutlinerParaObject() const
{
std::unique_ptr<OutlinerParaObject> pPara;
if( HasTextImpl( pEdtOutl ) )
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 03b52f66b953..32c0cd09c6be 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;
@@ -596,8 +596,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;
}
@@ -626,12 +625,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 3bcba8d8e0cf..abefdf53a101 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 )
diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx
index 64e13012ac86..adabc3c061ec 100644
--- a/svx/source/unodraw/unoshtxt.cxx
+++ b/svx/source/unodraw/unoshtxt.cxx
@@ -538,7 +538,7 @@ SvxTextForwarder* SvxTextEditSourceImpl::GetBackgroundTextForwarder()
OutlinerParaObject* pOutlinerParaObject = nullptr;
SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>( mpObject );
if( pTextObj && pTextObj->getActiveText() == mpText )
- pOutlinerParaObject = pTextObj->GetEditOutlinerParaObject().release(); // Get the OutlinerParaObject if text edit is active
+ pOutlinerParaObject = pTextObj->CreateEditOutlinerParaObject().release(); // Get the OutlinerParaObject if text edit is active
bool bOwnParaObj(false);
if( pOutlinerParaObject )
@@ -666,7 +666,7 @@ SvxTextForwarder* SvxTextEditSourceImpl::GetTextForwarder()
bool bTextEditActive = false;
SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>(mpObject);
// similar to the GetBackgroundTextForwarder check, see if the text edit is active
- if (pTextObj && pTextObj->getActiveText() == mpText && pTextObj->GetEditOutlinerParaObject())
+ if (pTextObj && pTextObj->getActiveText() == mpText && pTextObj->CanCreateEditOutlinerParaObject())
bTextEditActive = true; // text edit active
if (bTextEditActive)
mbDataValid = false;
diff --git a/sw/source/filter/ww8/rtfsdrexport.cxx b/sw/source/filter/ww8/rtfsdrexport.cxx
index 7eedcc45064d..0aa351aa4c77 100644
--- a/sw/source/filter/ww8/rtfsdrexport.cxx
+++ b/sw/source/filter/ww8/rtfsdrexport.cxx
@@ -624,7 +624,7 @@ sal_Int32 RtfSdrExport::StartShape()
*/
if (pTextObj->IsTextEditActive())
{
- pOwnedParaObj = pTextObj->GetEditOutlinerParaObject();
+ pOwnedParaObj = pTextObj->CreateEditOutlinerParaObject();
pParaObj = pOwnedParaObj.get();
}
else
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index f3d1fb00997e..fb90d4c406e8 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -1336,7 +1336,7 @@ void WW8Export::WriteSdrTextObj(const SdrTextObj& rTextObj, sal_uInt8 nTyp)
*/
if (rTextObj.IsTextEditActive())
{
- pParaObj = rTextObj.GetEditOutlinerParaObject().release();
+ pParaObj = rTextObj.CreateEditOutlinerParaObject().release();
bOwnParaObj = true;
}
else