[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-1+backports' - include/svx oox/source sd/source svx/source sw/source
Serge Krot (via logerrit)
logerrit at kemper.freedesktop.org
Mon Apr 27 23:10:36 UTC 2020
include/svx/svdotext.hxx | 3 +-
oox/source/export/drawingml.cxx | 2 -
oox/source/export/vmlexport.cxx | 2 -
sd/source/ui/slidesorter/controller/SlsSlotManager.cxx | 4 ---
sd/source/ui/unoidl/unoobj.cxx | 3 --
sd/source/ui/view/drviews7.cxx | 4 ---
sd/source/ui/view/outlnvsh.cxx | 4 ---
svx/source/accessibility/AccessibleShape.cxx | 15 +-----------
svx/source/inc/cell.hxx | 3 +-
svx/source/sdr/primitive2d/sdrattributecreator.cxx | 5 +---
svx/source/svdraw/svdotext.cxx | 15 +++++++++---
svx/source/table/accessiblecell.cxx | 12 ---------
svx/source/table/cell.cxx | 21 ++++++++++-------
svx/source/table/tablertfexporter.cxx | 2 -
svx/source/unodraw/unoshtxt.cxx | 19 ++++++++++++++-
sw/source/filter/ww8/rtfsdrexport.cxx | 2 -
sw/source/filter/ww8/wrtw8esh.cxx | 2 -
17 files changed, 61 insertions(+), 57 deletions(-)
New commits:
commit c075add8c86d11baba63a13c637b5b1a5a886283
Author: Serge Krot <Serge.Krot at cib.de>
AuthorDate: Fri Jan 3 20:08:45 2020 +0100
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Tue Apr 28 01:10:04 2020 +0200
tdf#129708 speed-up: check if we could create outline instead of creation of it
Conflicts:
include/svx/svdotext.hxx
oox/source/export/drawingml.cxx
oox/source/export/vmlexport.cxx
sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
sd/source/ui/view/drviews7.cxx
sd/source/ui/view/outlnvsh.cxx
svx/source/accessibility/AccessibleShape.cxx
svx/source/inc/cell.hxx
svx/source/sdr/primitive2d/sdrattributecreator.cxx
svx/source/svdraw/svdotext.cxx
svx/source/table/accessiblecell.cxx
svx/source/table/cell.cxx
svx/source/table/tablertfexporter.cxx
svx/source/unodraw/unoshtxt.cxx
sw/source/filter/ww8/rtfsdrexport.cxx
sw/source/filter/ww8/wrtw8esh.cxx
Change-Id: I0629b4e6ccae4ab9be0142fe39c627f2f9a8f5ea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86199
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92650
Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index 7be26b52d40f..8fccc05978c8 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -491,7 +491,8 @@ public:
virtual void NbcSetOutlinerParaObject(OutlinerParaObject* pTextObject) override;
void NbcSetOutlinerParaObjectForText( OutlinerParaObject* pTextObject, SdrText* pText );
virtual OutlinerParaObject* GetOutlinerParaObject() const override;
- OutlinerParaObject* GetEditOutlinerParaObject() const;
+ bool CanCreateEditOutlinerParaObject() const;
+ std::unique_ptr<OutlinerParaObject> CreateEditOutlinerParaObject() const;
virtual void NbcReformatText() override;
virtual void ReformatText() override;
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 943d5aed9add..b6249f535aa9 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2490,7 +2490,7 @@ void DrawingML::WriteText( const Reference< XInterface >& rXIface, const OUStrin
*/
if (pTxtObj->IsTextEditActive())
{
- pParaObj = pTxtObj->GetEditOutlinerParaObject();
+ pParaObj = pTxtObj->CreateEditOutlinerParaObject().release();
bOwnParaObj = true;
}
else
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index 2ec6992381a6..c3078b6cd983 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -1346,7 +1346,7 @@ sal_Int32 VMLExport::StartShape()
*/
if (pTxtObj->IsTextEditActive())
{
- pParaObj = pTxtObj->GetEditOutlinerParaObject();
+ 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 18b9b01b24cc..0c996d8dedf8 100644
--- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
@@ -560,10 +560,8 @@ void SlotManager::GetMenuState (SfxItemSet& rSet)
SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
if( pTextObj )
{
- OutlinerParaObject* pParaObj = pTextObj->GetEditOutlinerParaObject();
- if( pParaObj )
+ if( pTextObj->CanCreateEditOutlinerParaObject() )
{
- delete pParaObj;
bDisable = false;
}
}
diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx
index 72df58e77918..82152eef5577 100644
--- a/sd/source/ui/unoidl/unoobj.cxx
+++ b/sd/source/ui/unoidl/unoobj.cxx
@@ -891,8 +891,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 230d75c2e853..43053b053aa7 100644
--- a/sd/source/ui/view/drviews7.cxx
+++ b/sd/source/ui/view/drviews7.cxx
@@ -378,10 +378,8 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet )
SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
if( pTextObj )
{
- OutlinerParaObject* pParaObj = pTextObj->GetEditOutlinerParaObject();
- if( pParaObj )
+ if( pTextObj->CanCreateEditOutlinerParaObject() )
{
- delete pParaObj;
bDisable = false;
}
}
diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx
index 21ecec524955..c396fa0e2163 100644
--- a/sd/source/ui/view/outlnvsh.cxx
+++ b/sd/source/ui/view/outlnvsh.cxx
@@ -970,10 +970,8 @@ void OutlineViewShell::GetMenuState( SfxItemSet &rSet )
SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
if( pTextObj )
{
- OutlinerParaObject* pParaObj = pTextObj->GetEditOutlinerParaObject();
- if( pParaObj )
+ if( pTextObj->CanCreateEditOutlinerParaObject() )
{
- delete pParaObj;
bDisable = false;
}
}
diff --git a/svx/source/accessibility/AccessibleShape.cxx b/svx/source/accessibility/AccessibleShape.cxx
index da50d27cac19..2d09f0f4db18 100644
--- a/svx/source/accessibility/AccessibleShape.cxx
+++ b/svx/source/accessibility/AccessibleShape.cxx
@@ -158,18 +158,10 @@ void AccessibleShape::Init()
if( pSdrObject )
{
SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>( pSdrObject );
- OutlinerParaObject* pOutlinerParaObject = nullptr;
-
- if( pTextObj )
- pOutlinerParaObject = pTextObj->GetEditOutlinerParaObject(); // Get the OutlinerParaObject if text edit is active
-
- bool bOwnParaObj = pOutlinerParaObject != nullptr;
-
- if( !pOutlinerParaObject && pSdrObject )
- 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( o3tl::make_unique<AccessibleEmptyEditSource >(*pSdrObject, *pView, *pWindow) ) );
@@ -182,9 +174,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 2f9a9dfec8c7..0844aa1e6434 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; }
- 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 f66d789d7ddc..31f3d22170a1 100644
--- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx
+++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
@@ -545,17 +545,16 @@ namespace drawinglayer
if(bInEditMode)
{
- OutlinerParaObject* pTempObj = rTextObj.GetEditOutlinerParaObject();
+ std::unique_ptr<OutlinerParaObject> pTempObj = rTextObj.CreateEditOutlinerParaObject();
if(pTempObj)
{
aOutlinerParaObject = *pTempObj;
- delete pTempObj;
}
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 18b628b35991..19c1018d0be7 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -802,13 +802,22 @@ void SdrTextObj::TakeTextRect( SdrOutliner& rOutliner, tools::Rectangle& rTextRe
rTextRect=aAnkRect;
}
-OutlinerParaObject* SdrTextObj::GetEditOutlinerParaObject() const
+bool SdrTextObj::CanCreateEditOutlinerParaObject() const
{
- OutlinerParaObject* pPara=nullptr;
+ if( HasTextImpl( pEdtOutl ) )
+ {
+ return pEdtOutl->GetParagraphCount() > 0;
+ }
+ return false;
+}
+
+std::unique_ptr<OutlinerParaObject> SdrTextObj::CreateEditOutlinerParaObject() const
+{
+ std::unique_ptr<OutlinerParaObject> pPara;
if( HasTextImpl( pEdtOutl ) )
{
sal_Int32 nParaCount = pEdtOutl->GetParagraphCount();
- pPara = pEdtOutl->CreateParaObject(0, nParaCount);
+ pPara.reset(pEdtOutl->CreateParaObject(0, nParaCount));
}
return pPara;
}
diff --git a/svx/source/table/accessiblecell.cxx b/svx/source/table/accessiblecell.cxx
index 08754ad21160..22452c359a38 100644
--- a/svx/source/table/accessiblecell.cxx
+++ b/svx/source/table/accessiblecell.cxx
@@ -71,15 +71,8 @@ void AccessibleCell::Init()
const vcl::Window* pWindow = maShapeTreeInfo.GetWindow ();
if( (pView != nullptr) && (pWindow != nullptr) && mxCell.is())
{
- OutlinerParaObject* pOutlinerParaObject = mxCell->GetEditOutlinerParaObject(); // 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
@@ -88,9 +81,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 e402c483a5ba..dce86cd0c769 100644
--- a/svx/source/table/cell.cxx
+++ b/svx/source/table/cell.cxx
@@ -228,7 +228,7 @@ namespace sdr
if( mxCell.is() )
{
- OutlinerParaObject* pParaObj = mxCell->GetEditOutlinerParaObject();
+ OutlinerParaObject* pParaObj = mxCell->CreateEditOutlinerParaObject().release();
const bool bOwnParaObj = pParaObj != nullptr;
@@ -308,7 +308,7 @@ namespace sdr
rObj.SetVerticalWriting(bVertical);
// Set a cell vertical property
- OutlinerParaObject* pParaObj = mxCell->GetEditOutlinerParaObject();
+ OutlinerParaObject* pParaObj = mxCell->CreateEditOutlinerParaObject().release();
const bool bOwnParaObj = pParaObj != nullptr;
@@ -329,7 +329,7 @@ namespace sdr
const SvxTextRotateItem* pRotateItem = static_cast<const SvxTextRotateItem*>(pNewItem);
// Set a cell vertical property
- OutlinerParaObject* pParaObj = mxCell->GetEditOutlinerParaObject();
+ OutlinerParaObject* pParaObj = mxCell->CreateEditOutlinerParaObject().release();
const bool bOwnParaObj = pParaObj != nullptr;
@@ -593,11 +593,9 @@ bool Cell::IsTextEditActive()
SdrTableObj& rTableObj = dynamic_cast< SdrTableObj& >( GetObject() );
if(rTableObj.getActiveCell().get() == this )
{
- OutlinerParaObject* pParaObj = rTableObj.GetEditOutlinerParaObject();
- if( pParaObj != nullptr )
+ if( rTableObj.CanCreateEditOutlinerParaObject() )
{
isActive = true;
- delete pParaObj;
}
}
return isActive;
@@ -624,12 +622,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;
+}
-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 37d793de6df3..748e7efe866d 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();
+ 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 af313e15731e..105f9808e648 100644
--- a/svx/source/unodraw/unoshtxt.cxx
+++ b/svx/source/unodraw/unoshtxt.cxx
@@ -547,7 +547,7 @@ SvxTextForwarder* SvxTextEditSourceImpl::GetBackgroundTextForwarder()
OutlinerParaObject* pOutlinerParaObject = nullptr;
SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>( mpObject );
if( pTextObj && pTextObj->getActiveText() == mpText )
- pOutlinerParaObject = pTextObj->GetEditOutlinerParaObject(); // 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 )
@@ -665,7 +665,24 @@ SvxTextForwarder* SvxTextEditSourceImpl::GetTextForwarder()
return GetBackgroundTextForwarder();
}
else
+ {
+ // tdf#123470 if the text edit mode of the shape is active, then we
+ // cannot trust a previously cached TextForwarder state as the text may
+ // be out of date, so force a refetch in that case.
+ if (IsEditMode())
+ {
+ assert(!mbForwarderIsEditMode); // because without a view there is no other option except !mbForwarderIsEditMode
+ 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->CanCreateEditOutlinerParaObject())
+ bTextEditActive = true; // text edit active
+ if (bTextEditActive)
+ mbDataValid = false;
+ }
+
return GetBackgroundTextForwarder();
+ }
}
diff --git a/sw/source/filter/ww8/rtfsdrexport.cxx b/sw/source/filter/ww8/rtfsdrexport.cxx
index c1b835194784..e299c704fdb4 100644
--- a/sw/source/filter/ww8/rtfsdrexport.cxx
+++ b/sw/source/filter/ww8/rtfsdrexport.cxx
@@ -617,7 +617,7 @@ sal_Int32 RtfSdrExport::StartShape()
*/
if (pTextObj->IsTextEditActive())
{
- pOwnedParaObj.reset(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 278d459cdc53..bc74bf8232eb 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -1319,7 +1319,7 @@ void WW8Export::WriteSdrTextObj(const SdrTextObj& rTextObj, sal_uInt8 nTyp)
*/
if (rTextObj.IsTextEditActive())
{
- pParaObj = rTextObj.GetEditOutlinerParaObject();
+ pParaObj = rTextObj.CreateEditOutlinerParaObject().release();
bOwnParaObj = true;
}
else
More information about the Libreoffice-commits
mailing list