[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.1' - writerfilter/source

Luboš Luňák l.lunak at suse.cz
Tue Oct 22 02:11:38 PDT 2013


 writerfilter/source/dmapper/GraphicHelpers.cxx |   23 +++++++++++++++++++++++
 writerfilter/source/dmapper/GraphicHelpers.hxx |   11 ++++++-----
 writerfilter/source/dmapper/GraphicImport.cxx  |   12 ++++++------
 3 files changed, 35 insertions(+), 11 deletions(-)

New commits:
commit 8e2b91cc93a3a1e68ba53a68ffe83b02a4377030
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Tue May 21 15:56:12 2013 +0200

    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
    (cherry picked from commit 007f2dcf166838540ed945c55fe48a944e95610a)

diff --git a/writerfilter/source/dmapper/GraphicHelpers.cxx b/writerfilter/source/dmapper/GraphicHelpers.cxx
index 4564f3a..9a259b9 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 f60da10..e3e4be6 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 302f66d..a6c6295 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -1235,9 +1235,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();
                 }
             }
         }
@@ -1252,9 +1252,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();
                 }
             }
         }


More information about the Libreoffice-commits mailing list