summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/ooxmlexport/data/fdo43093.docxbin0 -> 9547 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx37
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx12
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx23
4 files changed, 65 insertions, 7 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/fdo43093.docx b/sw/qa/extras/ooxmlexport/data/fdo43093.docx
new file mode 100644
index 000000000000..9d5de58b5f8d
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/fdo43093.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index d6812f07fbc0..1cfc0aec25f9 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -27,6 +27,7 @@
#include <com/sun/star/awt/FontWeight.hpp>
#include <com/sun/star/awt/FontUnderline.hpp>
#include <com/sun/star/awt/FontSlant.hpp>
+#include <com/sun/star/text/WritingMode2.hpp>
#include <unotools/tempfile.hxx>
#include <unotools/ucbstreamhelper.hxx>
@@ -79,6 +80,7 @@ public:
void testFdo65655();
void testFDO63053();
void testWatermark();
+ void testFdo43093();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -133,6 +135,7 @@ void Test::run()
{"fdo65655.docx", &Test::testFdo65655},
{"fdo63053.docx" , &Test::testFDO63053},
{"watermark.docx", &Test::testWatermark},
+ {"fdo43093.docx", &Test::testFdo43093},
};
// Don't test the first import of these, for some reason those tests fail
const char* aBlacklist[] = {
@@ -771,6 +774,40 @@ void Test::testWatermark()
CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_NONE, getProperty<drawing::LineStyle>(xShape, "LineStyle"));
}
+void Test::testFdo43093()
+{
+ // The problem was that the alignment are not exchange when the paragraph are RTL.
+ uno::Reference<uno::XInterface> xParaRtlLeft(getParagraph( 1, "RTL Left"));
+ sal_Int32 nRtlLeft = getProperty< sal_Int32 >( xParaRtlLeft, "ParaAdjust" );
+ // test the text Direction value for the pragraph
+ sal_Int16 nRLDir = getProperty< sal_Int32 >( xParaRtlLeft, "WritingMode" );
+
+ uno::Reference<uno::XInterface> xParaRtlRight(getParagraph( 3, "RTL Right"));
+ sal_Int32 nRtlRight = getProperty< sal_Int32 >( xParaRtlRight, "ParaAdjust" );
+ sal_Int16 nRRDir = getProperty< sal_Int32 >( xParaRtlRight, "WritingMode" );
+
+ uno::Reference<uno::XInterface> xParaLtrLeft(getParagraph( 5, "LTR Left"));
+ sal_Int32 nLtrLeft = getProperty< sal_Int32 >( xParaLtrLeft, "ParaAdjust" );
+ sal_Int16 nLLDir = getProperty< sal_Int32 >( xParaLtrLeft, "WritingMode" );
+
+ uno::Reference<uno::XInterface> xParaLtrRight(getParagraph( 7, "LTR Right"));
+ sal_Int32 nLtrRight = getProperty< sal_Int32 >( xParaLtrRight, "ParaAdjust" );
+ sal_Int16 nLRDir = getProperty< sal_Int32 >( xParaLtrRight, "WritingMode" );
+
+ // this will test the both the text direction and alignment for each paragraph
+ CPPUNIT_ASSERT_EQUAL( sal_Int32 (style::ParagraphAdjust_LEFT), nRtlLeft);
+ CPPUNIT_ASSERT_EQUAL(text::WritingMode2::RL_TB, nRLDir);
+
+ CPPUNIT_ASSERT_EQUAL( sal_Int32 (style::ParagraphAdjust_RIGHT), nRtlRight);
+ CPPUNIT_ASSERT_EQUAL(text::WritingMode2::RL_TB, nRRDir);
+
+ CPPUNIT_ASSERT_EQUAL( sal_Int32 (style::ParagraphAdjust_LEFT), nLtrLeft);
+ CPPUNIT_ASSERT_EQUAL(text::WritingMode2::LR_TB, nLLDir);
+
+ CPPUNIT_ASSERT_EQUAL( sal_Int32 (style::ParagraphAdjust_RIGHT), nLtrRight);
+ CPPUNIT_ASSERT_EQUAL(text::WritingMode2::LR_TB, nLRDir);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index d2049fc4def9..254b0bf7691e 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4261,7 +4261,10 @@ void DocxAttributeOutput::ParaAdjust( const SvxAdjustItem& rAdjust )
{
case SVX_ADJUST_LEFT:
if ( bEcma )
- pAdjustString = "left";
+ if ( bRtl )
+ pAdjustString = "right";
+ else
+ pAdjustString = "left";
else if ( bRtl )
pAdjustString = "end";
else
@@ -4269,7 +4272,10 @@ void DocxAttributeOutput::ParaAdjust( const SvxAdjustItem& rAdjust )
break;
case SVX_ADJUST_RIGHT:
if ( bEcma )
- pAdjustString = "right";
+ if ( bRtl )
+ pAdjustString = "left";
+ else
+ pAdjustString = "right";
else if ( bRtl )
pAdjustString = "start";
else
@@ -5001,7 +5007,7 @@ void DocxAttributeOutput::FormatFrameDirection( const SvxFrameDirectionItem& rDi
else if ( !m_rExport.bOutFlyFrmAttrs )
{
if ( bBiDi )
- m_pSerializer->singleElementNS( XML_w, XML_bidi, FSEND );
+ m_pSerializer->singleElementNS( XML_w, XML_bidi, FSNS( XML_w, XML_val ), "1", FSEND );
}
}
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 8b7f7e8d378d..0d14f8d16ab9 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1505,6 +1505,21 @@ sal_Int32 lcl_getCurrentNumberingProperty(uno::Reference<container::XIndexAccess
return nRet;
}
+// In rtl-paragraphs the meaning of left/right are to be exchanged
+static bool ExchangeLeftRight( const PropertyMapPtr rContext )
+{
+ bool bExchangeLeftRight = false;
+ PropertyMap::const_iterator aPropParaIte = rContext->find( PropertyDefinition( PROP_WRITING_MODE, false ));
+ if( aPropParaIte != rContext->end())
+ {
+ sal_Int32 aAdjust ;
+ aPropParaIte->second >>= aAdjust;
+ if( aAdjust == text::WritingMode2::RL_TB )
+ bExchangeLeftRight = true;
+ }
+ return bExchangeLeftRight;
+}
+
void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType eSprmType )
{
OSL_ENSURE(rContext.get(), "PropertyMap has to be valid!");
@@ -1514,9 +1529,6 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
sal_uInt32 nSprmId = rSprm.getId();
//needed for page properties
SectionPropertyMap * pSectionContext = m_pImpl->GetSectionContext();
-
- //TODO: In rtl-paragraphs the meaning of left/right are to be exchanged
- bool bExchangeLeftRight = false;
Value::Pointer_t pValue = rSprm.getValue();
sal_Int32 nIntValue = pValue->getInt();
OUString sStringValue = pValue->getString();
@@ -1534,7 +1546,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, bExchangeLeftRight);
+ handleParaJustification(nIntValue, rContext, ExchangeLeftRight( rContext ));
break;
case NS_sprm::LN_PFSideBySide:
break; // sprmPFSideBySide
@@ -1629,6 +1641,8 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
case NS_sprm::LN_PDxaRight: // sprmPDxaRight - right margin
case 17:
case NS_sprm::LN_PDxaLeft: // sprmPDxaLeft
+ {
+ bool bExchangeLeftRight = ExchangeLeftRight( rContext );
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,
@@ -1638,6 +1652,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
rContext->Insert(
PROP_PARA_RIGHT_MARGIN, true,
uno::makeAny( ConversionHelper::convertTwipToMM100(nIntValue ) ));
+ }
//TODO: what happens to the right margins in numberings?
break;
case 18: // sprmPNest