Kaydet (Commit) 3777d302 authored tarafından Michael Stahl's avatar Michael Stahl

i#105557: more thread-safe caching of SwXFrame instances

There's another over-engineered factory function to convert...

Change-Id: I4a51ea197f1a550f712f6542a4ebaf305e293f3f
üst 00b5f1ef
...@@ -1002,6 +1002,12 @@ namespace ...@@ -1002,6 +1002,12 @@ namespace
{ {
typedef SwXTextFrame core_frame_t; typedef SwXTextFrame core_frame_t;
typedef XTextFrame uno_frame_t; typedef XTextFrame uno_frame_t;
static inline uno::Any wrapFrame(SwFrmFmt & rFrmFmt)
{
uno::Reference<text::XTextFrame> const xRet(
SwXTextFrame::CreateXTextFrame(*rFrmFmt.GetDoc(), &rFrmFmt));
return uno::makeAny(xRet);
}
static inline bool filter(const SwNode* const pNode) { return !pNode->IsNoTxtNode(); }; static inline bool filter(const SwNode* const pNode) { return !pNode->IsNoTxtNode(); };
}; };
...@@ -1010,6 +1016,12 @@ namespace ...@@ -1010,6 +1016,12 @@ namespace
{ {
typedef SwXTextGraphicObject core_frame_t; typedef SwXTextGraphicObject core_frame_t;
typedef XTextContent uno_frame_t; typedef XTextContent uno_frame_t;
static inline uno::Any wrapFrame(SwFrmFmt & rFrmFmt)
{
uno::Reference<text::XTextContent> const xRet(
SwXTextGraphicObject::CreateXTextGraphicObject(*rFrmFmt.GetDoc(), &rFrmFmt));
return uno::makeAny(xRet);
}
static inline bool filter(const SwNode* const pNode) { return pNode->IsGrfNode(); }; static inline bool filter(const SwNode* const pNode) { return pNode->IsGrfNode(); };
}; };
...@@ -1018,18 +1030,19 @@ namespace ...@@ -1018,18 +1030,19 @@ namespace
{ {
typedef SwXTextEmbeddedObject core_frame_t; typedef SwXTextEmbeddedObject core_frame_t;
typedef XEmbeddedObjectSupplier uno_frame_t; typedef XEmbeddedObjectSupplier uno_frame_t;
static inline uno::Any wrapFrame(SwFrmFmt & rFrmFmt)
{
uno::Reference<text::XTextContent> const xRet(
SwXTextEmbeddedObject::CreateXTextEmbeddedObject(*rFrmFmt.GetDoc(), &rFrmFmt));
return uno::makeAny(xRet);
}
static inline bool filter(const SwNode* const pNode) { return pNode->IsOLENode(); }; static inline bool filter(const SwNode* const pNode) { return pNode->IsOLENode(); };
}; };
template<FlyCntType T> template<FlyCntType T>
static uno::Any lcl_UnoWrapFrame(SwFrmFmt* pFmt) static uno::Any lcl_UnoWrapFrame(SwFrmFmt* pFmt)
{ {
SwXFrame* pFrm = SwIterator<SwXFrame,SwFmt>::FirstElement( *pFmt ); return UnoFrameWrap_traits<T>::wrapFrame(*pFmt);
if(!pFrm)
pFrm = new typename UnoFrameWrap_traits<T>::core_frame_t(*pFmt);
Reference< typename UnoFrameWrap_traits<T>::uno_frame_t > xFrm =
static_cast< typename UnoFrameWrap_traits<T>::core_frame_t* >(pFrm);
return uno::makeAny(xFrm);
} }
// runtime adapter for lcl_UnoWrapFrame // runtime adapter for lcl_UnoWrapFrame
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment