diff options
author | Michael Stahl <mstahl@redhat.com> | 2014-08-15 23:21:05 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2014-08-20 16:40:08 +0200 |
commit | 00b5f1ef2e06d5ae2ce7469710e85c4a06c20a5f (patch) | |
tree | 1ecc3c0d541f1d6be7ce4128f7feaa6d466eed9d /sw/source/core/unocore/unodraw.cxx | |
parent | bcbab38792f47cb1e27a8fb4bc0523ea135a2e75 (diff) |
i#105557: thread-safe caching of SwXFrame instances
Replace SwXFrames::GetObject() with factory functions that use the
WeakReference SwFrmFmt::m_wXObject to cache the instance in a thread-safe
way.
Change-Id: If56e4d7f95cb4f2e112139f228fb832ae9bf7d76
Diffstat (limited to 'sw/source/core/unocore/unodraw.cxx')
-rw-r--r-- | sw/source/core/unocore/unodraw.cxx | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index d05805814c51..891bc28b5b1e 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -311,7 +311,6 @@ uno::Reference< drawing::XShape > SwFmDrawPage::_CreateShape( SdrObject *pObj ) SwFlyDrawContact* pFlyContact = (SwFlyDrawContact*)pObj->GetUserCall(); if(pFlyContact) { - FlyCntType eType = FLYCNTTYPE_ALL; SwFrmFmt* pFlyFmt = pFlyContact->GetFmt(); SwDoc* pDoc = pFlyFmt->GetDoc(); const SwNodeIndex* pIdx; @@ -322,19 +321,26 @@ uno::Reference< drawing::XShape > SwFmDrawPage::_CreateShape( SdrObject *pObj ) { const SwNode* pNd = pDoc->GetNodes()[ pIdx->GetIndex() + 1 ]; if(!pNd->IsNoTxtNode()) - eType = FLYCNTTYPE_FRM; + { + xRet.set(SwXTextFrame::CreateXTextFrame(*pDoc, pFlyFmt), + uno::UNO_QUERY); + } else if( pNd->IsGrfNode() ) - eType = FLYCNTTYPE_GRF; + { + xRet.set(SwXTextGraphicObject::CreateXTextGraphicObject( + *pDoc, pFlyFmt), uno::UNO_QUERY); + } else if( pNd->IsOLENode() ) - eType = FLYCNTTYPE_OLE; + { + xRet.set(SwXTextEmbeddedObject::CreateXTextEmbeddedObject( + *pDoc, pFlyFmt), uno::UNO_QUERY); + } } else { OSL_FAIL( "<SwFmDrawPage::_CreateShape(..)> - could not retrieve type. Thus, no shape created." ); return xRet; } - OSL_ENSURE( eType != FLYCNTTYPE_ALL, "unexpected FlyCntType value for eType" ); - xRet = SwXFrames::GetObject( *pFlyFmt, eType ); } } else |