Kaydet (Commit) 3a87ba97 authored tarafından Miklos Vajna's avatar Miklos Vajna

bnc#822175 DOCX filter: export wrapping of text frames

Change-Id: I5c5128686e96a97570b8cdf109dd75976a071ca8
üst 9c773140
......@@ -29,6 +29,7 @@
#include <com/sun/star/awt/FontUnderline.hpp>
#include <com/sun/star/awt/FontSlant.hpp>
#include <com/sun/star/text/WritingMode2.hpp>
#include <com/sun/star/text/WrapTextMode.hpp>
#include <unotools/tempfile.hxx>
#include <unotools/ucbstreamhelper.hxx>
......@@ -87,6 +88,7 @@ public:
void testFdo56679();
void testFdo65400();
void testFdo66543();
void testN822175();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
......@@ -147,6 +149,7 @@ void Test::run()
{"fdo56679.docx", &Test::testFdo56679},
{"fdo65400.docx", &Test::testFdo65400},
{"fdo66543.docx", &Test::testFdo66543},
{"n822175.odt", &Test::testN822175},
};
// Don't test the first import of these, for some reason those tests fail
const char* aBlacklist[] = {
......@@ -890,6 +893,15 @@ void Test::testFdo66543()
CPPUNIT_ASSERT_EQUAL( sal_Int32( 1 ), getProperty< sal_Int32 >( paragraph1, "ParaLineNumberStartValue" ));
}
void Test::testN822175()
{
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
uno::Reference<beans::XPropertySet> xFrame(xDraws->getByIndex(0), uno::UNO_QUERY);
// Was text::WrapTextMode_THROUGH, due to missing Surround handling in the exporter.
CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_PARALLEL, getProperty<text::WrapTextMode>(xFrame, "Surround"));
}
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
......
......@@ -340,6 +340,14 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT
m_rExport.WriteText( );
m_pSerializer->endElementNS( XML_w, XML_txbxContent );
m_pSerializer->endElementNS( XML_v, XML_textbox );
if (m_pFlyWrapAttrList)
{
XFastAttributeListRef xFlyWrapAttrList(m_pFlyWrapAttrList);
m_pFlyWrapAttrList = NULL;
m_pSerializer->singleElementNS(XML_w10, XML_wrap, xFlyWrapAttrList);
}
m_pSerializer->endElementNS( XML_v, XML_rect );
m_pSerializer->endElementNS( XML_w, XML_pict );
m_pSerializer->endElementNS( XML_w, XML_r );
......@@ -4658,6 +4666,37 @@ void DocxAttributeOutput::FormatSurround( const SwFmtSurround& rSurround )
{
if (m_bTextFrameSyntax)
{
OString sType, sSide;
switch (rSurround.GetSurround())
{
case SURROUND_NONE:
sType = "topAndBottom";
break;
case SURROUND_PARALLEL:
sType = "square";
break;
case SURROUND_IDEAL:
sType = "square";
sSide = "largest";
case SURROUND_LEFT:
sType = "square";
sSide = "left";
case SURROUND_RIGHT:
sType = "square";
sSide = "right";
break;
case SURROUND_THROUGHT:
default:
break;
}
if (!sType.isEmpty() || !sSide.isEmpty())
{
m_pFlyWrapAttrList = m_pSerializer->createAttrList();
if (!sType.isEmpty())
m_pFlyWrapAttrList->add(XML_type, sType);
if (!sSide.isEmpty())
m_pFlyWrapAttrList->add(XML_side, sSide);
}
}
else if ( m_rExport.bOutFlyFrmAttrs )
{
......@@ -5055,6 +5094,7 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSeri
m_pHyperlinkAttrList( NULL ),
m_pFlyAttrList( NULL ),
m_pFlyFillAttrList( NULL ),
m_pFlyWrapAttrList( NULL ),
m_pTextboxAttrList( NULL ),
m_pFlyFrameSize(0),
m_pFootnotesList( new ::docx::FootnotesList() ),
......
......@@ -586,6 +586,7 @@ private:
::sax_fastparser::FastAttributeList *m_pHyperlinkAttrList;
::sax_fastparser::FastAttributeList *m_pFlyAttrList;
::sax_fastparser::FastAttributeList *m_pFlyFillAttrList;
::sax_fastparser::FastAttributeList *m_pFlyWrapAttrList;
/// Attributes of the next v:textbox element.
::sax_fastparser::FastAttributeList *m_pTextboxAttrList;
/// When exporting fly frames, this holds the real size of the frame.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment