Kaydet (Commit) a4c6d5c8 authored tarafından Bjoern Michaelsen's avatar Bjoern Michaelsen Kaydeden (comit) Björn Michaelsen

refactor out lcl_SetRelationOrient

Change-Id: I9759a0f21641b6f5ba5e456e5c45ac28238ca672
Reviewed-on: https://gerrit.libreoffice.org/31866Reviewed-by: 's avatarBjörn Michaelsen <bjoern.michaelsen@canonical.com>
Tested-by: 's avatarBjörn Michaelsen <bjoern.michaelsen@canonical.com>
üst d505b5d8
...@@ -2445,6 +2445,32 @@ void SwEscherEx::FinishEscher() ...@@ -2445,6 +2445,32 @@ void SwEscherEx::FinishEscher()
pEscherStrm = nullptr; pEscherStrm = nullptr;
} }
namespace
{
template<typename OrientType>
void lcl_SetRelationOrient(OrientType& rOrient, const sw::WW8AnchorConv eConv, const bool bHori, std::function<void()> fDefault)
{
switch(eConv)
{
case sw::WW8AnchorConv::RELTOTABLECELL:
// #i33818#
rOrient.SetRelationOrient(text::RelOrientation::PAGE_PRINT_AREA);
break;
case sw::WW8AnchorConv::CONV2PG:
rOrient.SetRelationOrient(text::RelOrientation::PAGE_FRAME);
break;
case sw::WW8AnchorConv::CONV2COL_OR_PARA:
rOrient.SetRelationOrient(text::RelOrientation::FRAME);
break;
case sw::WW8AnchorConv::CONV2CHAR_OR_LINE:
rOrient.SetRelationOrient(bHori ? text::RelOrientation::CHAR : text::RelOrientation::TEXT_LINE);
break;
default:
fDefault();//rOrient.SetHoriOrient(text::HoriOrientation::NONE);
}
}
}
/** method to perform conversion of positioning attributes with the help /** method to perform conversion of positioning attributes with the help
of corresponding layout information of corresponding layout information
...@@ -2652,43 +2678,9 @@ bool WinwordAnchoring::ConvertPosition( SwFormatHoriOrient& _iorHoriOri, ...@@ -2652,43 +2678,9 @@ bool WinwordAnchoring::ConvertPosition( SwFormatHoriOrient& _iorHoriOri,
_rFrameFormat.CallSwClientNotify(sw::WW8AnchorConvHint(aResult)); _rFrameFormat.CallSwClientNotify(sw::WW8AnchorConvHint(aResult));
if(!aResult.m_bConverted) if(!aResult.m_bConverted)
return false; return false;
switch(eHoriConv) lcl_SetRelationOrient(_iorHoriOri, eHoriConv, true, [&_iorHoriOri]() {_iorHoriOri.SetHoriOrient(text::HoriOrientation::NONE);} );
{
case sw::WW8AnchorConv::RELTOTABLECELL:
// #i33818#
_iorHoriOri.SetRelationOrient(text::RelOrientation::PAGE_PRINT_AREA);
break;
case sw::WW8AnchorConv::CONV2PG:
_iorHoriOri.SetRelationOrient(text::RelOrientation::PAGE_FRAME);
break;
case sw::WW8AnchorConv::CONV2COL_OR_PARA:
_iorHoriOri.SetRelationOrient(text::RelOrientation::FRAME);
break;
case sw::WW8AnchorConv::CONV2CHAR_OR_LINE:
_iorHoriOri.SetRelationOrient(text::RelOrientation::CHAR);
break;
default:
_iorHoriOri.SetHoriOrient(text::HoriOrientation::NONE);
}
_iorHoriOri.SetPos(aResult.m_aPos.X()); _iorHoriOri.SetPos(aResult.m_aPos.X());
switch(eVertConv) lcl_SetRelationOrient(_iorVertOri, eVertConv, false, [&_iorVertOri]() {_iorVertOri.SetVertOrient(text::VertOrientation::NONE);} );
{
case sw::WW8AnchorConv::RELTOTABLECELL:
// #i33818#
_iorVertOri.SetRelationOrient(text::RelOrientation::PAGE_PRINT_AREA);
break;
case sw::WW8AnchorConv::CONV2PG:
_iorVertOri.SetRelationOrient(text::RelOrientation::PAGE_FRAME);
break;
case sw::WW8AnchorConv::CONV2COL_OR_PARA:
_iorVertOri.SetRelationOrient(text::RelOrientation::FRAME);
break;
case sw::WW8AnchorConv::CONV2CHAR_OR_LINE:
_iorVertOri.SetRelationOrient(text::RelOrientation::TEXT_LINE);
break;
default:
_iorVertOri.SetVertOrient(text::VertOrientation::NONE);
}
_iorVertOri.SetPos(aResult.m_aPos.Y()); _iorVertOri.SetPos(aResult.m_aPos.Y());
return true; return true;
} }
......
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