diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2013-09-26 12:21:59 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-09-26 12:43:32 +0200 |
commit | 8738ded7bb1bb6262fe1038e310b5110407f4cfa (patch) | |
tree | 3d87aa158d05b18450e6bd5fc057dc93bb71d4a2 /sw | |
parent | 634f1d11d2a027887807494b3ca67f33825d5d23 (diff) |
fdo#69636 VML import: handle mso-layout-flow-alt shape prop for sw frames
Writer core doesn't support this, and this has been a problem for table
cells as well. There the workaround we're using for quite a while is to
do the rotation at a text portion level instead, which results in
reasonable layout for simple cases. Do the same here.
One additional complexity is that the API between oox and writerfilter
is a single UNO shape, we get this property in oox, and we have to
handle it in writerfilter, when the text frame is already attached to
some text. Kill this problem by adding a FrameInteropGrabBag for sw text
frames: it's useful anyway, and then we can pass around this property
inside the grab bag.
Change-Id: Idb5ec83b5cbdde8f29d15b2cebfad24226bb6507
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/hintids.hxx | 1 | ||||
-rw-r--r-- | sw/inc/unoprnms.hxx | 1 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlimport/data/fdo69636.docx | bin | 0 -> 23779 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 11 | ||||
-rw-r--r-- | sw/source/core/bastyp/init.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/unocore/unomap.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/unocore/unoprnms.cxx | 1 |
7 files changed, 18 insertions, 0 deletions
diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx index da260317f728..a8ef4f2ebef7 100644 --- a/sw/inc/hintids.hxx +++ b/sw/inc/hintids.hxx @@ -227,6 +227,7 @@ RES_FRMATR_BEGIN = RES_PARATR_LIST_END, RES_FRMATR_CONDITIONAL_STYLE_NAME, // 126 RES_FILL_STYLE, // 127 RES_FILL_GRADIENT, // 128 + RES_FRMATR_GRABBAG, RES_FRMATR_END }; diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx index 704d595505a6..ebc95c7a6f75 100644 --- a/sw/inc/unoprnms.hxx +++ b/sw/inc/unoprnms.hxx @@ -839,6 +839,7 @@ enum SwPropNameIds /* 0773 */ UNO_NAME_SHADOW_TRANSPARENCE, /* 0774 */ UNO_NAME_DOC_INTEROP_GRAB_BAG, +/* 0775 */ UNO_NAME_FRAME_INTEROP_GRAB_BAG, SW_PROPNAME_END diff --git a/sw/qa/extras/ooxmlimport/data/fdo69636.docx b/sw/qa/extras/ooxmlimport/data/fdo69636.docx Binary files differnew file mode 100644 index 000000000000..b2f3069b5020 --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/fdo69636.docx diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index fc03f75805da..df6b0a1acde7 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -135,6 +135,7 @@ public: void testVmlTextVerticalAdjust(); void testGroupshapeSdt(); void testDefaultSectBreakCols(); + void testFdo69636(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -234,6 +235,7 @@ void Test::run() {"vml-text-vertical-adjust.docx", &Test::testVmlTextVerticalAdjust}, {"groupshape-sdt.docx", &Test::testGroupshapeSdt}, {"default-sect-break-cols.docx", &Test::testDefaultSectBreakCols}, + {"fdo69636.docx", &Test::testFdo69636}, }; header(); for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) @@ -1559,6 +1561,15 @@ void Test::testDefaultSectBreakCols() CPPUNIT_ASSERT_EQUAL(sal_Int16(0), xTextColumns->getColumnCount()); } +void Test::testFdo69636() +{ + // The problem was that the mso-layout-flow-alt:bottom-to-top VML shape property wasn't handled for sw text frames. + uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(900), getProperty<sal_Int32>(getRun(getParagraphOfText(1, xFrame->getText()), 1), "CharRotation")); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index 94b859a86a99..30fc9f05177a 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -389,6 +389,7 @@ SfxItemInfo aSlotTab[] = { 0, SFX_ITEM_POOLABLE }, // RES_FRMATR_CONDITIONAL_STYLE_NAME { SID_SW_ATTR_FILL_STYLE, SFX_ITEM_POOLABLE }, // RES_FILL_STYLE { SID_SW_ATTR_FILL_GRADIENT, SFX_ITEM_POOLABLE }, // RES_FILL_GRADIENT + { 0, SFX_ITEM_POOLABLE }, // RES_FRMATR_GRABBAG { 0, SFX_ITEM_POOLABLE }, // RES_GRFATR_MIRRORGRF { SID_ATTR_GRAF_CROP, SFX_ITEM_POOLABLE }, // RES_GRFATR_CROPGRF @@ -604,6 +605,7 @@ void _InitCore() aAttrTab[ RES_FRMATR_CONDITIONAL_STYLE_NAME - POOLATTR_BEGIN ] = new SfxStringItem( RES_FRMATR_CONDITIONAL_STYLE_NAME, aEmptyStr ); aAttrTab[ RES_FILL_STYLE - POOLATTR_BEGIN ] = new XFillStyleItem(XFILL_SOLID, RES_FILL_STYLE); aAttrTab[ RES_FILL_GRADIENT - POOLATTR_BEGIN ] = new XFillGradientItem(RES_FILL_GRADIENT); + aAttrTab[ RES_FRMATR_GRABBAG - POOLATTR_BEGIN ] = new SfxGrabBagItem(RES_FRMATR_GRABBAG); aAttrTab[ RES_GRFATR_MIRRORGRF- POOLATTR_BEGIN ] = new SwMirrorGrf; aAttrTab[ RES_GRFATR_CROPGRF- POOLATTR_BEGIN ] = new SwCropGrf; diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx index 6c4c3c967748..1c1a135a9043 100644 --- a/sw/source/core/unocore/unomap.cxx +++ b/sw/source/core/unocore/unomap.cxx @@ -302,6 +302,7 @@ SwUnoPropertyMapProvider::~SwUnoPropertyMapProvider() { SW_PROP_NMID(UNO_NAME_FILL_STYLE), RES_FILL_STYLE, CPPU_E2T(CPPUTYPE_FILLSTYLE), PROPERTY_NONE ,0}, \ { SW_PROP_NMID(UNO_NAME_FILL_GRADIENT), RES_FILL_GRADIENT, CPPU_E2T(CPPUTYPE_GRADIENT), PROPERTY_NONE ,MID_FILLGRADIENT}, \ { SW_PROP_NMID(UNO_NAME_FILL_GRADIENT_NAME), RES_FILL_GRADIENT, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_NAME}, \ + { SW_PROP_NMID(UNO_NAME_FRAME_INTEROP_GRAB_BAG), RES_FRMATR_GRABBAG, CPPU_E2T(CPPUTYPE_PROPERTYVALUE), PROPERTY_NONE, 0}, \ { SW_PROP_NMID(UNO_NAME_CONTENT_PROTECTED), RES_PROTECT, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_PROTECT_CONTENT }, \ { SW_PROP_NMID(UNO_NAME_FRAME_STYLE_NAME), FN_UNO_FRAME_STYLE_NAME,CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, \ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL }, \ @@ -713,6 +714,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s { SW_PROP_NMID(UNO_NAME_FILL_STYLE), RES_FILL_STYLE, CPPU_E2T(CPPUTYPE_FILLSTYLE), PROPERTY_NONE ,0}, { SW_PROP_NMID(UNO_NAME_FILL_GRADIENT), RES_FILL_GRADIENT, CPPU_E2T(CPPUTYPE_GRADIENT), PROPERTY_NONE ,MID_FILLGRADIENT}, { SW_PROP_NMID(UNO_NAME_FILL_GRADIENT_NAME), RES_FILL_GRADIENT, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_NAME}, + { SW_PROP_NMID(UNO_NAME_FRAME_INTEROP_GRAB_BAG), RES_FRMATR_GRABBAG, CPPU_E2T(CPPUTYPE_PROPERTYVALUE), PROPERTY_NONE, 0}, // { SW_PROP_NMID(UNO_NAME_CHAIN_NEXT_NAME), RES_CHAIN, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_CHAIN_NEXTNAME}, // { SW_PROP_NMID(UNO_NAME_CHAIN_PREV_NAME), RES_CHAIN, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_CHAIN_PREVNAME}, /*not impl*/ { SW_PROP_NMID(UNO_NAME_CLIENT_MAP), RES_URL, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_URL_CLIENTMAP }, diff --git a/sw/source/core/unocore/unoprnms.cxx b/sw/source/core/unocore/unoprnms.cxx index 1bdac491b439..2324bd542ae7 100644 --- a/sw/source/core/unocore/unoprnms.cxx +++ b/sw/source/core/unocore/unoprnms.cxx @@ -806,6 +806,7 @@ const SwPropNameTab aPropNameTab = { /* 0772 UNO_NAME_CHAR_SHADOW_FORMAT */ {MAP_CHAR_LEN("CharShadowFormat")}, /* 0773 UNO_NAME_SHADOW_TRANSPARENCE */ {MAP_CHAR_LEN("ShadowTransparence")}, /* 0774 UNO_NAME_DOC_INTEROP_GRAB_BAG */ {MAP_CHAR_LEN("InteropGrabBag")}, +/* 0775 UNO_NAME_FRAME_INTEROP_GRAB_BAG */ {MAP_CHAR_LEN("FrameInteropGrabBag")}, // new items in this array must match enum SwPropNameIds |