Kaydet (Commit) 007f2dcf authored tarafından Luboš Luňák's avatar Luboš Luňák

map docx line alignment properly to writer's line-of-text align (bnc#820792)

Apparently the top/bottom line of text alignment in writer is backwards
compared to all others, while alignment to the top of a page puts
an object's top edge at the top of the page, top of line of text
puts the object on top of the line (i.e. bottom edge of the object
at the line). The handling of NS_rtf::LN_YAlign suggests that swapping
bottom and top in the input filter is the right way of handling this.

Change-Id: I916c8ea0f2fd00de3e17b16b31433c9b6ba92e64
üst 1bfbe496
......@@ -134,6 +134,29 @@ void PositionHandler::lcl_sprm( Sprm& )
{
}
sal_Int16 PositionHandler::orientation() const
{
if( m_nRelation == text::RelOrientation::TEXT_LINE )
{ // It appears that to 'line of text' alignment is backwards to other alignments,
// 'top' meaning putting on top of the line instead of having top at the line.
if( m_nOrient == text::VertOrientation::TOP )
return text::VertOrientation::BOTTOM;
else if( m_nOrient == text::VertOrientation::BOTTOM )
return text::VertOrientation::TOP;
}
return m_nOrient;
}
sal_Int16 PositionHandler::relation() const
{
return m_nRelation;
}
sal_Int32 PositionHandler::position() const
{
return m_nPosition;
}
void PositionHandler::setPositionOffset(const OUString & sText, bool vertical)
{
if( vertical )
......
......@@ -39,14 +39,15 @@ public:
static void setPositionOffset(const OUString & sText, bool vertical);
static void setAlignH(const OUString & sText);
static void setAlignV(const OUString & sText);
sal_Int16 m_nOrient;
sal_Int16 m_nRelation;
sal_Int32 m_nPosition;
sal_Int16 orientation() const;
sal_Int16 relation() const;
sal_Int32 position() const;
private:
virtual void lcl_attribute( Id aName, Value& rVal );
virtual void lcl_sprm( Sprm& rSprm );
sal_Int16 m_nOrient;
sal_Int16 m_nRelation;
sal_Int32 m_nPosition;
static int savedPositionOffsetV, savedPositionOffsetH;
static int savedAlignV, savedAlignH;
};
......
......@@ -1234,9 +1234,9 @@ void GraphicImport::lcl_sprm(Sprm & rSprm)
pProperties->resolve( *pHandler );
if( !m_pImpl->bUseSimplePos )
{
m_pImpl->nHoriRelation = pHandler->m_nRelation;
m_pImpl->nHoriOrient = pHandler->m_nOrient;
m_pImpl->nLeftPosition = pHandler->m_nPosition;
m_pImpl->nHoriRelation = pHandler->relation();
m_pImpl->nHoriOrient = pHandler->orientation();
m_pImpl->nLeftPosition = pHandler->position();
}
}
}
......@@ -1251,9 +1251,9 @@ void GraphicImport::lcl_sprm(Sprm & rSprm)
pProperties->resolve( *pHandler );
if( !m_pImpl->bUseSimplePos )
{
m_pImpl->nVertRelation = pHandler->m_nRelation;
m_pImpl->nVertOrient = pHandler->m_nOrient;
m_pImpl->nTopPosition = pHandler->m_nPosition;
m_pImpl->nVertRelation = pHandler->relation();
m_pImpl->nVertOrient = pHandler->orientation();
m_pImpl->nTopPosition = pHandler->position();
}
}
}
......
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