[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sw/qa writerfilter/inc writerfilter/source

Faisal M. Al-Otaibi fmalotaibi at kacst.edu.sa
Sat Dec 14 21:51:01 PST 2013


 dev/null                                     |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx     |   14 --------------
 writerfilter/inc/dmapper/DomainMapper.hxx    |    1 +
 writerfilter/source/dmapper/DomainMapper.cxx |   25 +++++++------------------
 4 files changed, 8 insertions(+), 32 deletions(-)

New commits:
commit e2de109a7424bc1ab59867dfd23a10db28b7bf9a
Author: Faisal M. Al-Otaibi <fmalotaibi at kacst.edu.sa>
Date:   Sun Dec 15 08:47:45 2013 +0300

    Revert "DOCX: fdo#72560 better solution for exchange alignment for RTL"
    
    This reverts commit 66e68fe28a7bfb37d4fdeee9bed1d9a0ff840935.
    there some error in this patch.

diff --git a/sw/qa/extras/ooxmlimport/data/fdo72560.docx b/sw/qa/extras/ooxmlimport/data/fdo72560.docx
deleted file mode 100644
index b21535b..0000000
Binary files a/sw/qa/extras/ooxmlimport/data/fdo72560.docx and /dev/null differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 8153131..d957b98 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1545,20 +1545,6 @@ DECLARE_OOXMLIMPORT_TEST(testLOCrash,"file_crash.docx")
     //The problem was libreoffice crash while opening the file.
     getParagraph(1,"Contents");
 }
-
-DECLARE_OOXMLIMPORT_TEST(testFdo72560, "fdo72560.docx")
-{
-    // The problem was libreoffice confuse when there RTL default style for paragraph
-    uno::Reference<uno::XInterface> xParaLeftRTL(getParagraph( 1, "RTL LEFT"));
-    uno::Reference<uno::XInterface> xParaRightLTR(getParagraph( 2, "LTR RIGHT"));
-
-    // this will test the text direction and alignment for paragraphs
-    CPPUNIT_ASSERT_EQUAL(text::WritingMode2::RL_TB, getProperty<sal_Int16>( xParaLeftRTL, "WritingMode" ));
-    CPPUNIT_ASSERT_EQUAL( sal_Int32 (style::ParagraphAdjust_LEFT), getProperty< sal_Int32 >( xParaLeftRTL, "ParaAdjust" ));
-
-    CPPUNIT_ASSERT_EQUAL(text::WritingMode2::LR_TB, getProperty<sal_Int16>( xParaRightLTR, "WritingMode" ));
-    CPPUNIT_ASSERT_EQUAL( sal_Int32 (style::ParagraphAdjust_RIGHT), getProperty< sal_Int32 >( xParaRightLTR, "ParaAdjust" ));
-}
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/inc/dmapper/DomainMapper.hxx b/writerfilter/inc/dmapper/DomainMapper.hxx
index 70c5b51..d6b5d37 100644
--- a/writerfilter/inc/dmapper/DomainMapper.hxx
+++ b/writerfilter/inc/dmapper/DomainMapper.hxx
@@ -163,6 +163,7 @@ private:
     sal_Unicode getFillCharFromValue(const sal_Int32 nIntValue);
     sal_Int32 mnBackgroundColor;
     bool mbIsHighlightSet;
+    bool mbIsBIDI;
     boost::scoped_ptr< GraphicZOrderHelper > zOrderHelper;
 };
 
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index e60ffbc..06ea11c 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -97,7 +97,7 @@ LoggedProperties(dmapper_logger, "DomainMapper"),
 LoggedTable(dmapper_logger, "DomainMapper"),
 LoggedStream(dmapper_logger, "DomainMapper"),
     m_pImpl( new DomainMapper_Impl( *this, xContext, xModel, eDocumentType, xInsertTextRange, bIsNewDoc )),
-    mnBackgroundColor(0), mbIsHighlightSet(false)
+    mnBackgroundColor(0), mbIsHighlightSet(false), mbIsBIDI(false)
 {
     // #i24363# tab stops relative to indent
     m_pImpl->SetDocumentSettingsProperty(
@@ -1580,7 +1580,7 @@ sal_Int32 lcl_getCurrentNumberingProperty(uno::Reference<container::XIndexAccess
 }
 
 // In rtl-paragraphs the meaning of left/right are to be exchanged
-static bool ExchangeLeftRight( const PropertyMapPtr rContext, DomainMapper_Impl* m_pImpl )
+    static bool ExchangeLeftRight( const PropertyMapPtr rContext, bool mbIsBIDI)
 {
     bool bExchangeLeftRight = false;
     PropertyMap::const_iterator aPropParaIte = rContext->find(PROP_WRITING_MODE);
@@ -1591,20 +1591,7 @@ static bool ExchangeLeftRight( const PropertyMapPtr rContext, DomainMapper_Impl*
             bExchangeLeftRight = true;
     }
     else
-    {
-        // check if there RTL <bidi> in default style for the paragraph
-        StyleSheetEntryPtr pTable = m_pImpl->GetStyleSheetTable()->FindDefaultParaStyle();
-        if ( pTable )
-        {
-            PropertyMap::const_iterator aPropStyle = pTable->pProperties->find(PROP_WRITING_MODE);
-            if( aPropStyle != pTable->pProperties->end())
-            {
-                sal_Int32 aDirect;
-                if( (aPropStyle->second.getValue() >>= aDirect) && aDirect == text::WritingMode2::RL_TB )
-                    bExchangeLeftRight = true;
-            }
-        }
-    }
+        return mbIsBIDI;
     return bExchangeLeftRight;
 }
 
@@ -1634,7 +1621,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
         break;  // sprmPIncLvl
     case NS_sprm::LN_PJcExtra: // sprmPJc Asian (undocumented)
     case NS_sprm::LN_PJc: // sprmPJc
-        handleParaJustification(nIntValue, rContext, ExchangeLeftRight( rContext, m_pImpl ));
+        handleParaJustification(nIntValue, rContext, ExchangeLeftRight( rContext, mbIsBIDI ));
         break;
     case NS_sprm::LN_PFSideBySide:
         break;  // sprmPFSideBySide
@@ -1733,7 +1720,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
     case 17:
     case NS_sprm::LN_PDxaLeft:   // sprmPDxaLeft
     {
-        bool bExchangeLeftRight = ExchangeLeftRight( rContext, m_pImpl );
+        bool bExchangeLeftRight = ExchangeLeftRight( rContext, mbIsBIDI );
         if( NS_sprm::LN_PDxaLeft == nSprmId || 0x17 == nSprmId|| (bExchangeLeftRight && nSprmId == 0x845d) || ( !bExchangeLeftRight && nSprmId == 0x845e))
             rContext->Insert(
                              eSprmType == SPRM_DEFAULT ? PROP_PARA_LEFT_MARGIN : PROP_LEFT_MARGIN,
@@ -2029,6 +2016,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
         {
             if (nIntValue != 0)
             {
+                mbIsBIDI = true;
                 rContext->Insert(PROP_WRITING_MODE, uno::makeAny( text::WritingMode2::RL_TB ));
                 rContext->Insert(PROP_PARA_ADJUST, uno::makeAny( style::ParagraphAdjust_RIGHT ));
             }
@@ -3222,6 +3210,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
     break;
     case NS_ooxml::LN_CT_PPrBase_pStyle:
     {
+        mbIsBIDI = false;
         m_pImpl->SetCurrentParaStyleId( sStringValue );
         StyleSheetTablePtr pStyleTable = m_pImpl->GetStyleSheetTable();
         const OUString sConvertedStyleName = pStyleTable->ConvertStyleName( sStringValue, true );


More information about the Libreoffice-commits mailing list