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

add relative to tablecell as state

Change-Id: I76e9d317dabeefcdf53468a89f3a6130279993f3
Reviewed-on: https://gerrit.libreoffice.org/31865Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarBjörn Michaelsen <bjoern.michaelsen@canonical.com>
üst 880e622d
......@@ -278,22 +278,21 @@ namespace sw
NO_CONV,
CONV2PG,
CONV2COL_OR_PARA,
CONV2CHAR_OR_LINE
CONV2CHAR_OR_LINE,
RELTOTABLECELL
};
struct WW8AnchorConvResult final
{
bool m_bHoriRelToTableCell;
bool m_bVertRelToTableCell;
WW8AnchorConv m_eHoriConv;
WW8AnchorConv m_eVertConv;
bool m_bConverted;
Point m_aPos;
WW8AnchorConvResult() : m_bHoriRelToTableCell(false), m_bVertRelToTableCell(false), m_bConverted(false) {};
WW8AnchorConvResult(WW8AnchorConv eHoriConv, WW8AnchorConv eVertConv) : m_eHoriConv(eHoriConv), m_eVertConv(eVertConv) {};
};
struct SW_DLLPUBLIC WW8AnchorConvHint final : SfxHint
{
WW8AnchorConvResult& m_rResult;
const WW8AnchorConv m_eHoriConv;
const WW8AnchorConv m_eVertConv;
WW8AnchorConvHint(WW8AnchorConvResult& rResult, WW8AnchorConv eHoriConv, WW8AnchorConv eVertConv) : m_rResult(rResult), m_eHoriConv(eHoriConv), m_eVertConv(eVertConv) {};
WW8AnchorConvHint(WW8AnchorConvResult& rResult) : m_rResult(rResult) {};
virtual ~WW8AnchorConvHint() override;
};
}
......
......@@ -1366,12 +1366,18 @@ namespace
}
return pAnchorFormat;
}
Point lcl_GetWW8Pos(SwAnchoredObject* pAnchoredObj, const sw::WW8AnchorConv eConv, const bool bFollowTextFlow, const bool bHori, bool& bRelToTableCell)
Point lcl_GetWW8Pos(SwAnchoredObject* pAnchoredObj, const bool bFollowTextFlow, const bool bHori, sw::WW8AnchorConv& reConv)
{
switch(eConv)
switch(reConv)
{
case sw::WW8AnchorConv::CONV2PG:
return pAnchoredObj->GetRelPosToPageFrame(bFollowTextFlow, bRelToTableCell);
{
bool bRelToTableCell(false);
Point aPos(pAnchoredObj->GetRelPosToPageFrame(bFollowTextFlow, bRelToTableCell));
if(bRelToTableCell)
reConv = sw::WW8AnchorConv::RELTOTABLECELL;
return aPos;
}
case sw::WW8AnchorConv::CONV2COL_OR_PARA:
return pAnchoredObj->GetRelPosToAnchorFrame();
case sw::WW8AnchorConv::CONV2CHAR_OR_LINE:
......@@ -1554,21 +1560,20 @@ void SwDrawContact::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
if(dynamic_cast<SwAnchoredDrawObject*>(pAnchoredObj) && !pAnchoredObj->GetAnchorFrame())
return;
const bool bFollowTextFlow = static_cast<const SwDrawFrameFormat&>(rMod).GetFollowTextFlow().GetValue();
sw::WW8AnchorConvResult& rResult(pWW8AnchorConvHint->m_rResult);
// No distinction between layout directions, because of missing
// information about WW8 in vertical layout.
pWW8AnchorConvHint->m_rResult.m_aPos.setX(lcl_GetWW8Pos(
rResult.m_aPos.setX(lcl_GetWW8Pos(
pAnchoredObj,
pWW8AnchorConvHint->m_eHoriConv,
bFollowTextFlow,
true,
pWW8AnchorConvHint->m_rResult.m_bHoriRelToTableCell).getX());
pWW8AnchorConvHint->m_rResult.m_aPos.setY(lcl_GetWW8Pos(
rResult.m_eHoriConv).getX());
rResult.m_aPos.setY(lcl_GetWW8Pos(
pAnchoredObj,
pWW8AnchorConvHint->m_eHoriConv,
bFollowTextFlow,
false,
pWW8AnchorConvHint->m_rResult.m_bVertRelToTableCell).getY());
pWW8AnchorConvHint->m_rResult.m_bConverted = true;
rResult.m_eHoriConv).getY());
rResult.m_bConverted = true;
}
}
......
......@@ -2648,17 +2648,18 @@ bool WinwordAnchoring::ConvertPosition( SwFormatHoriOrient& _iorHoriOri,
}
if(eVertConv != sw::WW8AnchorConv::NO_CONV || eHoriConv != sw::WW8AnchorConv::NO_CONV)
{
sw::WW8AnchorConvResult aResult;
_rFrameFormat.CallSwClientNotify(sw::WW8AnchorConvHint(aResult, eHoriConv, eVertConv));
sw::WW8AnchorConvResult aResult(eHoriConv, eVertConv);
_rFrameFormat.CallSwClientNotify(sw::WW8AnchorConvHint(aResult));
if(!aResult.m_bConverted)
return false;
switch(eHoriConv)
{
case sw::WW8AnchorConv::RELTOTABLECELL:
// #i33818#
_iorHoriOri.SetRelationOrient(text::RelOrientation::PAGE_PRINT_AREA);
break;
case sw::WW8AnchorConv::CONV2PG:
_iorHoriOri.SetRelationOrient(text::RelOrientation::PAGE_FRAME);
// #i33818#
if(aResult.m_bHoriRelToTableCell)
_iorHoriOri.SetRelationOrient(text::RelOrientation::PAGE_PRINT_AREA);
break;
case sw::WW8AnchorConv::CONV2COL_OR_PARA:
_iorHoriOri.SetRelationOrient(text::RelOrientation::FRAME);
......@@ -2672,11 +2673,12 @@ bool WinwordAnchoring::ConvertPosition( SwFormatHoriOrient& _iorHoriOri,
_iorHoriOri.SetPos(aResult.m_aPos.X());
switch(eVertConv)
{
case sw::WW8AnchorConv::RELTOTABLECELL:
// #i33818#
_iorVertOri.SetRelationOrient(text::RelOrientation::PAGE_PRINT_AREA);
break;
case sw::WW8AnchorConv::CONV2PG:
_iorVertOri.SetRelationOrient(text::RelOrientation::PAGE_FRAME);
// #i33818#
if(aResult.m_bVertRelToTableCell)
_iorVertOri.SetRelationOrient(text::RelOrientation::PAGE_PRINT_AREA);
break;
case sw::WW8AnchorConv::CONV2COL_OR_PARA:
_iorVertOri.SetRelationOrient(text::RelOrientation::FRAME);
......
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