summaryrefslogtreecommitdiff
path: root/writerfilter/source/dmapper
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2013-05-21 15:56:12 +0200
committerLuboš Luňák <l.lunak@suse.cz>2013-05-23 16:36:46 +0200
commit007f2dcf166838540ed945c55fe48a944e95610a (patch)
treebfcd94d2fe5bffd31d6f2f3c76e0a1df05e312af /writerfilter/source/dmapper
parent1bfbe4963db6edb7dc4333988d147d9b13689e2b (diff)
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
Diffstat (limited to 'writerfilter/source/dmapper')
-rw-r--r--writerfilter/source/dmapper/GraphicHelpers.cxx23
-rw-r--r--writerfilter/source/dmapper/GraphicHelpers.hxx11
-rw-r--r--writerfilter/source/dmapper/GraphicImport.cxx12
3 files changed, 35 insertions, 11 deletions
diff --git a/writerfilter/source/dmapper/GraphicHelpers.cxx b/writerfilter/source/dmapper/GraphicHelpers.cxx
index 4564f3aede14..9a259b9e73e8 100644
--- a/writerfilter/source/dmapper/GraphicHelpers.cxx
+++ b/writerfilter/source/dmapper/GraphicHelpers.cxx
@@ -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 )
diff --git a/writerfilter/source/dmapper/GraphicHelpers.hxx b/writerfilter/source/dmapper/GraphicHelpers.hxx
index f60da105f580..e3e4be66a2d6 100644
--- a/writerfilter/source/dmapper/GraphicHelpers.hxx
+++ b/writerfilter/source/dmapper/GraphicHelpers.hxx
@@ -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;
};
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index b44056417581..8403f72187a1 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -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();
}
}
}