diff options
author | Serge Krot <Serge.Krot@cib.de> | 2020-01-03 20:08:45 +0100 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2020-01-06 15:55:25 +0100 |
commit | 92ccf53b2a8102299ac2c3e2612bb507d3a79c0f (patch) | |
tree | 8e531d755fc6876db72a4d48f8bd702728a2043f | |
parent | f29a5020ee7bbfff1860cdd94c271ef30937fa95 (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>
-rw-r--r-- | include/svx/svdotext.hxx | 3 | ||||
-rw-r--r-- | oox/source/export/drawingml.cxx | 2 | ||||
-rw-r--r-- | oox/source/export/vmlexport.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/slidesorter/controller/SlsSlotManager.cxx | 3 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unoobj.cxx | 3 | ||||
-rw-r--r-- | sd/source/ui/view/drviews7.cxx | 3 | ||||
-rw-r--r-- | sd/source/ui/view/outlnvsh.cxx | 3 | ||||
-rw-r--r-- | svx/source/accessibility/AccessibleShape.cxx | 15 | ||||
-rw-r--r-- | svx/source/inc/cell.hxx | 3 | ||||
-rw-r--r-- | svx/source/sdr/primitive2d/sdrattributecreator.cxx | 4 | ||||
-rw-r--r-- | svx/source/svdraw/svdotext.cxx | 11 | ||||
-rw-r--r-- | svx/source/table/accessiblecell.cxx | 12 | ||||
-rw-r--r-- | svx/source/table/cell.cxx | 20 | ||||
-rw-r--r-- | svx/source/table/tablertfexporter.cxx | 2 | ||||
-rw-r--r-- | svx/source/unodraw/unoshtxt.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfsdrexport.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8esh.cxx | 2 |
17 files changed, 43 insertions, 51 deletions
diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx index ccb6686e883d..f995071617b5 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 ce6ef82348a0..087c51da5541 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -2905,7 +2905,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 ae275dd57e82..d87821f8c677 100644 --- a/sd/source/ui/unoidl/unoobj.cxx +++ b/sd/source/ui/unoidl/unoobj.cxx @@ -852,8 +852,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 4116589a4934..1c0f1e83880e 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 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 ) diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx index ab46fbb199b6..e1f80f149bad 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 ) @@ -669,7 +669,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 33f2bccd2cfe..4001977502c3 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -1323,7 +1323,7 @@ void WW8Export::WriteSdrTextObj(const SdrTextObj& rTextObj, sal_uInt8 nTyp) */ if (rTextObj.IsTextEditActive()) { - pParaObj = rTextObj.GetEditOutlinerParaObject().release(); + pParaObj = rTextObj.CreateEditOutlinerParaObject().release(); bOwnParaObj = true; } else |