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:51:55 +0200
commitd129dd2a863906ed05b34b01dd9ca23d5c1c6a22 (patch)
tree4ddc181115677ba5cbe357c876685302739eddae /writerfilter/source/dmapper
parentff2ead2c359e65afc25c0ddb74a127572aecc516 (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 7b3ae3f06630..e21eaefd56ec 100644
--- a/writerfilter/source/dmapper/GraphicHelpers.cxx
+++ b/writerfilter/source/dmapper/GraphicHelpers.cxx
@@ -117,6 +117,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 ::rtl::OUString & sText, bool vertical)
{
if( vertical )
diff --git a/writerfilter/source/dmapper/GraphicHelpers.hxx b/writerfilter/source/dmapper/GraphicHelpers.hxx
index f87b6f9c015c..39f471beea40 100644
--- a/writerfilter/source/dmapper/GraphicHelpers.hxx
+++ b/writerfilter/source/dmapper/GraphicHelpers.hxx
@@ -21,14 +21,15 @@ public:
static void setPositionOffset(const ::rtl::OUString & sText, bool vertical);
static void setAlignH(const ::rtl::OUString & sText);
static void setAlignV(const ::rtl::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 925aaa635877..efcfa7e19b78 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -1216,9 +1216,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();
}
}
}
@@ -1233,9 +1233,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();
}
}
}