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 ...@@ -278,22 +278,21 @@ namespace sw
NO_CONV, NO_CONV,
CONV2PG, CONV2PG,
CONV2COL_OR_PARA, CONV2COL_OR_PARA,
CONV2CHAR_OR_LINE CONV2CHAR_OR_LINE,
RELTOTABLECELL
}; };
struct WW8AnchorConvResult final struct WW8AnchorConvResult final
{ {
bool m_bHoriRelToTableCell; WW8AnchorConv m_eHoriConv;
bool m_bVertRelToTableCell; WW8AnchorConv m_eVertConv;
bool m_bConverted; bool m_bConverted;
Point m_aPos; 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 struct SW_DLLPUBLIC WW8AnchorConvHint final : SfxHint
{ {
WW8AnchorConvResult& m_rResult; WW8AnchorConvResult& m_rResult;
const WW8AnchorConv m_eHoriConv; WW8AnchorConvHint(WW8AnchorConvResult& rResult) : m_rResult(rResult) {};
const WW8AnchorConv m_eVertConv;
WW8AnchorConvHint(WW8AnchorConvResult& rResult, WW8AnchorConv eHoriConv, WW8AnchorConv eVertConv) : m_rResult(rResult), m_eHoriConv(eHoriConv), m_eVertConv(eVertConv) {};
virtual ~WW8AnchorConvHint() override; virtual ~WW8AnchorConvHint() override;
}; };
} }
......
...@@ -1366,12 +1366,18 @@ namespace ...@@ -1366,12 +1366,18 @@ namespace
} }
return pAnchorFormat; 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: 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: case sw::WW8AnchorConv::CONV2COL_OR_PARA:
return pAnchoredObj->GetRelPosToAnchorFrame(); return pAnchoredObj->GetRelPosToAnchorFrame();
case sw::WW8AnchorConv::CONV2CHAR_OR_LINE: case sw::WW8AnchorConv::CONV2CHAR_OR_LINE:
...@@ -1554,21 +1560,20 @@ void SwDrawContact::SwClientNotify(const SwModify& rMod, const SfxHint& rHint) ...@@ -1554,21 +1560,20 @@ void SwDrawContact::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
if(dynamic_cast<SwAnchoredDrawObject*>(pAnchoredObj) && !pAnchoredObj->GetAnchorFrame()) if(dynamic_cast<SwAnchoredDrawObject*>(pAnchoredObj) && !pAnchoredObj->GetAnchorFrame())
return; return;
const bool bFollowTextFlow = static_cast<const SwDrawFrameFormat&>(rMod).GetFollowTextFlow().GetValue(); const bool bFollowTextFlow = static_cast<const SwDrawFrameFormat&>(rMod).GetFollowTextFlow().GetValue();
sw::WW8AnchorConvResult& rResult(pWW8AnchorConvHint->m_rResult);
// No distinction between layout directions, because of missing // No distinction between layout directions, because of missing
// information about WW8 in vertical layout. // information about WW8 in vertical layout.
pWW8AnchorConvHint->m_rResult.m_aPos.setX(lcl_GetWW8Pos( rResult.m_aPos.setX(lcl_GetWW8Pos(
pAnchoredObj, pAnchoredObj,
pWW8AnchorConvHint->m_eHoriConv,
bFollowTextFlow, bFollowTextFlow,
true, true,
pWW8AnchorConvHint->m_rResult.m_bHoriRelToTableCell).getX()); rResult.m_eHoriConv).getX());
pWW8AnchorConvHint->m_rResult.m_aPos.setY(lcl_GetWW8Pos( rResult.m_aPos.setY(lcl_GetWW8Pos(
pAnchoredObj, pAnchoredObj,
pWW8AnchorConvHint->m_eHoriConv,
bFollowTextFlow, bFollowTextFlow,
false, false,
pWW8AnchorConvHint->m_rResult.m_bVertRelToTableCell).getY()); rResult.m_eHoriConv).getY());
pWW8AnchorConvHint->m_rResult.m_bConverted = true; rResult.m_bConverted = true;
} }
} }
......
...@@ -2648,18 +2648,19 @@ bool WinwordAnchoring::ConvertPosition( SwFormatHoriOrient& _iorHoriOri, ...@@ -2648,18 +2648,19 @@ bool WinwordAnchoring::ConvertPosition( SwFormatHoriOrient& _iorHoriOri,
} }
if(eVertConv != sw::WW8AnchorConv::NO_CONV || eHoriConv != sw::WW8AnchorConv::NO_CONV) if(eVertConv != sw::WW8AnchorConv::NO_CONV || eHoriConv != sw::WW8AnchorConv::NO_CONV)
{ {
sw::WW8AnchorConvResult aResult; sw::WW8AnchorConvResult aResult(eHoriConv, eVertConv);
_rFrameFormat.CallSwClientNotify(sw::WW8AnchorConvHint(aResult, eHoriConv, eVertConv)); _rFrameFormat.CallSwClientNotify(sw::WW8AnchorConvHint(aResult));
if(!aResult.m_bConverted) if(!aResult.m_bConverted)
return false; return false;
switch(eHoriConv) switch(eHoriConv)
{ {
case sw::WW8AnchorConv::CONV2PG: case sw::WW8AnchorConv::RELTOTABLECELL:
_iorHoriOri.SetRelationOrient(text::RelOrientation::PAGE_FRAME);
// #i33818# // #i33818#
if(aResult.m_bHoriRelToTableCell)
_iorHoriOri.SetRelationOrient(text::RelOrientation::PAGE_PRINT_AREA); _iorHoriOri.SetRelationOrient(text::RelOrientation::PAGE_PRINT_AREA);
break; break;
case sw::WW8AnchorConv::CONV2PG:
_iorHoriOri.SetRelationOrient(text::RelOrientation::PAGE_FRAME);
break;
case sw::WW8AnchorConv::CONV2COL_OR_PARA: case sw::WW8AnchorConv::CONV2COL_OR_PARA:
_iorHoriOri.SetRelationOrient(text::RelOrientation::FRAME); _iorHoriOri.SetRelationOrient(text::RelOrientation::FRAME);
break; break;
...@@ -2672,12 +2673,13 @@ bool WinwordAnchoring::ConvertPosition( SwFormatHoriOrient& _iorHoriOri, ...@@ -2672,12 +2673,13 @@ bool WinwordAnchoring::ConvertPosition( SwFormatHoriOrient& _iorHoriOri,
_iorHoriOri.SetPos(aResult.m_aPos.X()); _iorHoriOri.SetPos(aResult.m_aPos.X());
switch(eVertConv) switch(eVertConv)
{ {
case sw::WW8AnchorConv::CONV2PG: case sw::WW8AnchorConv::RELTOTABLECELL:
_iorVertOri.SetRelationOrient(text::RelOrientation::PAGE_FRAME);
// #i33818# // #i33818#
if(aResult.m_bVertRelToTableCell)
_iorVertOri.SetRelationOrient(text::RelOrientation::PAGE_PRINT_AREA); _iorVertOri.SetRelationOrient(text::RelOrientation::PAGE_PRINT_AREA);
break; break;
case sw::WW8AnchorConv::CONV2PG:
_iorVertOri.SetRelationOrient(text::RelOrientation::PAGE_FRAME);
break;
case sw::WW8AnchorConv::CONV2COL_OR_PARA: case sw::WW8AnchorConv::CONV2COL_OR_PARA:
_iorVertOri.SetRelationOrient(text::RelOrientation::FRAME); _iorVertOri.SetRelationOrient(text::RelOrientation::FRAME);
break; break;
......
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