[Libreoffice-commits] core.git: Branch 'distro/suse/suse-4.0' - sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/data/bnc779620.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 10 ++ writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 25 ++- writerfilter/source/dmapper/DomainMapper_Impl.hxx| 18 ++ writerfilter/source/dmapper/PropertyMap.cxx | 15 + 5 files changed, 54 insertions(+), 14 deletions(-) New commits: commit 8ae425160d4376a1453b4e80cb2aeded1b7b4d18 Author: Miklos Vajna vmik...@collabora.co.uk Date: Tue Oct 1 16:57:56 2013 +0200 bnc#779620 DOCX import: try harder to convert floating tables to text frames Since 78d1f1c2835b9fae0f91ed771fc1d594c7817502, we convert floating tables to text frames only in case it's possible that there will be wrapping, to give better results for multi-page tables, which are multi-page, and technically floating ones, but that has no effect on the layout. The problem was that we try to do this decision too early, effectively the page width and margins were counted from the default letter size, instead of the actual values, which did not arrive at the time of the decision. Fix this by moving this logic at the section end. Change-Id: Ic1fbceb54c8ec223ed01836fafe6220bb3b2410a (cherry picked from commit bbef85c157169efa958ea1014d91d467cb243e6f) Conflicts: sw/qa/extras/ooxmlimport/ooxmlimport.cxx writerfilter/source/dmapper/DomainMapper_Impl.hxx diff --git a/sw/qa/extras/ooxmlimport/data/bnc779620.docx b/sw/qa/extras/ooxmlimport/data/bnc779620.docx new file mode 100644 index 000..23c126d Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/bnc779620.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 648baba..33c0ece 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -138,6 +138,7 @@ public: void testFdo68607(); void testVmlTextVerticalAdjust(); void testGroupshapeSdt(); +void testBnc779620(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) !defined(WNT) @@ -224,6 +225,7 @@ void Test::run() {fdo68607.docx, Test::testFdo68607}, {vml-text-vertical-adjust.docx, Test::testVmlTextVerticalAdjust}, {groupshape-sdt.docx, Test::testGroupshapeSdt}, +{bnc779620.docx, Test::testBnc779620}, }; for (unsigned int i = 0; i SAL_N_ELEMENTS(aMethods); ++i) { @@ -1398,6 +1400,14 @@ void Test::testGroupshapeSdt() CPPUNIT_ASSERT_EQUAL(sal_Int32(20), getPropertysal_Int32(getRun(getParagraphOfText(1, xShape-getText()), 1), CharKerning)); } +void Test::testBnc779620() +{ +// The problem was that the floating table was imported as a non-floating one. +uno::Referencetext::XTextFramesSupplier xTextFramesSupplier(mxComponent, uno::UNO_QUERY); +uno::Referencecontainer::XIndexAccess xIndexAccess(xTextFramesSupplier-getTextFrames(), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess-getCount()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index 571ef77..1facd2a 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -765,19 +765,7 @@ void DomainMapperTableHandler::endTable(unsigned int nestedTableLevel) uno::Referencetext::XTextRange xStart; uno::Referencetext::XTextRange xEnd; -bool bNoFly = false; -if (SectionPropertyMap* pSectionContext = m_rDMapper_Impl.GetSectionContext()) -{ -sal_Int32 nTextAreaWidth = pSectionContext-GetPageWidth() - pSectionContext-GetLeftMargin() - pSectionContext-GetRightMargin(); -sal_Int32 nTableWidth = 0; -m_aTableProperties-getValue( TablePropertyMap::TABLE_WIDTH, nTableWidth ); -// If the table is wider than the text area, then don't create a fly -// for the table: no wrapping will be performed anyway, but multi-page -// tables will be broken. -bNoFly = nTableWidth = nTextAreaWidth; -} - -bool bFloating = aFrameProperties.hasElements() !bNoFly; +bool bFloating = aFrameProperties.hasElements(); // Additional checks: if we can do this. if (bFloating (*m_pTableSeq)[0].getLength() 0 (*m_pTableSeq)[0][0].getLength() 0) { @@ -864,7 +852,16 @@ void DomainMapperTableHandler::endTable(unsigned int nestedTableLevel) // A non-zero left margin would move the table out of the frame, move the frame itself instead. xTableProperties-setPropertyValue(LeftMargin, uno::makeAny(sal_Int32(0))); -uno::Reference text::XTextContent xFrame =
[Libreoffice-commits] core.git: Branch 'distro/suse/suse-4.0' - sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/data/bnc780044_spacing.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 13 + writerfilter/source/dmapper/DomainMapper_Impl.cxx|9 + 3 files changed, 22 insertions(+) New commits: commit 3f0c3e5fc0e19f1d322f6e22b97b48816738361b Author: LuboÅ¡ LuÅák l.lu...@suse.cz Date: Wed Aug 14 15:10:34 2013 +0200 w:spacing in a paragraph should also apply to as-char objects (bnc#780044) Otherwise global w:spacing will be used even if overriden locally. Conflicts: sw/qa/extras/ooxmlimport/ooxmlimport.cxx writerfilter/source/dmapper/DomainMapper_Impl.cxx Change-Id: I01f0a3a323566f6e29faf73bf9d2ba874565eb42 diff --git a/sw/qa/extras/ooxmlimport/data/bnc780044_spacing.docx b/sw/qa/extras/ooxmlimport/data/bnc780044_spacing.docx new file mode 100644 index 000..927d4d3 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/bnc780044_spacing.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 0518809..3463541 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -129,6 +129,7 @@ public: void testN820788(); void testTableAutoColumnFixedSize(); void testFdo66474(); +void testBnc780044Spacing(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) !defined(WNT) @@ -207,6 +208,7 @@ void Test::run() {n820788.docx, Test::testN820788}, {table-auto-column-fixed-size.docx, Test::testTableAutoColumnFixedSize}, {fdo66474.docx, Test::testFdo66474}, +{bnc780044_spacing.docx, Test::testBnc780044Spacing}, }; for (unsigned int i = 0; i SAL_N_ELEMENTS(aMethods); ++i) { @@ -1293,6 +1295,17 @@ void Test::testFdo66474() CPPUNIT_ASSERT_EQUAL(sal_Int16(100), getPropertysal_Int16(xTables-getByIndex(0), RelativeWidth)); } +void Test::testBnc780044Spacing() +{ +// The document has global w:spacing in styles.xml , and local w:spacing in w:pPr, which however +// only applied to text runs, not to as-character pictures. So the picture made the line higher. +uno::Referenceframe::XModel xModel(mxComponent, uno::UNO_QUERY); +uno::Referencetext::XTextViewCursorSupplier xTextViewCursorSupplier(xModel-getCurrentController(), uno::UNO_QUERY); +uno::Referencetext::XPageCursor xCursor(xTextViewCursorSupplier-getViewCursor(), uno::UNO_QUERY); +xCursor-jumpToLastPage(); +CPPUNIT_ASSERT_EQUAL(sal_Int16(1), xCursor-getPage()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 92f6f10..57e2aed 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1714,6 +1714,15 @@ void DomainMapper_Impl::PushShapeContext( const uno::Reference drawing::XShape { xProps-setPropertyValue( rPropNameSupplier.GetName( PROP_ANCHOR_TYPE ), bIsGraphic ? uno::makeAny( text::TextContentAnchorType_AS_CHARACTER ) : uno::makeAny( text::TextContentAnchorType_AT_PARAGRAPH ) ); } +else +{ +// Fix spacing for as-character objects. If the paragraph has CT_Spacing_after set, +// it needs to be set on the object too, as that's what object placement code uses. +PropertyMapPtr paragraphContext = GetTopContextOfType( CONTEXT_PARAGRAPH ); +PropertyMap::const_iterator pos = paragraphContext-find( PropertyDefinition( PROP_PARA_BOTTOM_MARGIN, false )); +if( pos != paragraphContext-end()) +xProps-setPropertyValue( rPropNameSupplier.GetName( PROP_BOTTOM_MARGIN ), (*pos).second ); +} } } catch ( const uno::Exception e ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/suse/suse-4.0' - sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/data/fdo66474.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 11 +++ writerfilter/source/dmapper/DomainMapperTableManager.cxx | 15 +++ 3 files changed, 22 insertions(+), 4 deletions(-) New commits: commit df10efed1f8c9864b18bf41ce7b9cc29bbf19760 Author: Miklos Vajna vmik...@suse.cz Date: Fri Jul 26 16:50:07 2013 +0200 fdo#66474 DOCX import: fix handling of mixed fixed/auto cell widths Instead of checking if any cells have fixed width, check if all calls have fixed with. Regression from 74c5ed19f430327988194cdcd6bdff09591a93fa. Conflicts: sw/qa/extras/ooxmlimport/ooxmlimport.cxx Change-Id: I58d3d16cbaa2c54a8a1ac309910336c72dcb39b7 diff --git a/sw/qa/extras/ooxmlimport/data/fdo66474.docx b/sw/qa/extras/ooxmlimport/data/fdo66474.docx new file mode 100755 index 000..0252746 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/fdo66474.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index bc33ac9..2b87f4d 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -127,6 +127,7 @@ public: void testN820509(); void testN820788(); void testTableAutoColumnFixedSize(); +void testFdo66474(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) !defined(WNT) @@ -203,6 +204,7 @@ void Test::run() {n820509.docx, Test::testN820509}, {n820788.docx, Test::testN820788}, {table-auto-column-fixed-size.docx, Test::testTableAutoColumnFixedSize}, +{fdo66474.docx, Test::testFdo66474}, }; for (unsigned int i = 0; i SAL_N_ELEMENTS(aMethods); ++i) { @@ -1271,6 +1273,15 @@ void Test::testTableAutoColumnFixedSize() CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(3996)), getPropertysal_Int32(xTextTable, Width)); } +void Test::testFdo66474() +{ +// The table wasn't relative (relative with was 0), so the table didn't +// take the full available width, like it would have to. +uno::Referencetext::XTextTablesSupplier xTablesSupplier(mxComponent, uno::UNO_QUERY); +uno::Referencecontainer::XIndexAccess xTables(xTablesSupplier-getTextTables( ), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(sal_Int16(100), getPropertysal_Int16(xTables-getByIndex(0), RelativeWidth)); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index e28c171..527793e 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -135,20 +135,24 @@ bool DomainMapperTableManager::sprm(Sprm rSprm) the final sizing of the table, but then must use the contents of each cell to determine final column widths. (See 17.18.87 of the ISO/IEC 29500-1:2011.) */ -bool bFixed = false; +bool bFixed = true; sal_Int32 nRowFixedWidth = 0; if (!m_aCellWidths.empty()) { -// Step 1. Check whether any cell has fixed width in the given row of table. +// Step 1. Check whether all cells have fixed widths in the given row of table. ::std::vector IntVectorPtr ::iterator itr; for (itr = m_aCellWidths.begin(); itr != m_aCellWidths.end(); itr ++) { IntVectorPtr itrVal = (*itr); for (std::vectorsal_Int32::const_iterator aValIter = itrVal-begin(); aValIter != itrVal-end(); ++aValIter) { +if (*aValIter == -1) +{ +bFixed = false; +break; +} // Sum the width of cells to find the total width of given row nRowFixedWidth += (*aValIter); -bFixed = true; } } } @@ -351,7 +355,10 @@ bool DomainMapperTableManager::sprm(Sprm rSprm) { MeasureHandlerPtr pMeasureHandler(new MeasureHandler()); pProperties-resolve(*pMeasureHandler); - getCurrentCellWidths()-push_back(pMeasureHandler-getMeasureValue()); +if
[Libreoffice-commits] core.git: Branch 'distro/suse/suse-4.0' - sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/data/table-auto-column-fixed-size.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx| 12 ++ writerfilter/source/dmapper/DomainMapperTableManager.cxx| 44 +- writerfilter/source/dmapper/DomainMapperTableManager.hxx|1 4 files changed, 55 insertions(+), 2 deletions(-) New commits: commit 9390bbfd6e0dd1dc2d007bd391b186d7bf4c86ea Author: Adam Co rattles2...@gmail.com Date: Wed Jun 26 11:08:56 2013 +0300 DOCX import fix for table with auto size Reviewed-on: https://gerrit.libreoffice.org/4496 Conflicts: sw/qa/extras/ooxmlimport/ooxmlimport.cxx Change-Id: Ic86f4f142e579bdef3e954492e1c1e382a545739 diff --git a/sw/qa/extras/ooxmlimport/data/table-auto-column-fixed-size.docx b/sw/qa/extras/ooxmlimport/data/table-auto-column-fixed-size.docx new file mode 100644 index 000..557edcb Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/table-auto-column-fixed-size.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 7eb556c..bc33ac9 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -126,6 +126,7 @@ public: void testPageBorderShadow(); void testN820509(); void testN820788(); +void testTableAutoColumnFixedSize(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) !defined(WNT) @@ -201,6 +202,7 @@ void Test::run() {page-border-shadow.docx, Test::testPageBorderShadow}, {n820509.docx, Test::testN820509}, {n820788.docx, Test::testN820788}, +{table-auto-column-fixed-size.docx, Test::testTableAutoColumnFixedSize}, }; for (unsigned int i = 0; i SAL_N_ELEMENTS(aMethods); ++i) { @@ -1259,6 +1261,16 @@ void Test::testN820788() CPPUNIT_ASSERT_EQUAL(text::SizeType::MIN, getPropertysal_Int16(xFrame, SizeType)); } +void Test::testTableAutoColumnFixedSize() +{ +uno::Referencetext::XTextTablesSupplier xTablesSupplier(mxComponent, uno::UNO_QUERY); +uno::Referencecontainer::XIndexAccess xTables(xTablesSupplier-getTextTables(), uno::UNO_QUERY); +uno::Referencetext::XTextTable xTextTable(xTables-getByIndex(0), uno::UNO_QUERY); + +// Width was not recognized during import when table size was 'auto' +CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(3996)), getPropertysal_Int32(xTextTable, Width)); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index 28135cc..e28c171 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -52,6 +52,7 @@ DomainMapperTableManager::DomainMapperTableManager(bool bOOXML) : m_bOOXML( bOOXML ), m_bPushCurrentWidth(false), m_nLayoutType(0), +m_nMaxFixedWidth(0), m_pTablePropsHandler( new TablePropertiesHandler( bOOXML ) ) { m_pTablePropsHandler-SetTableManager( this ); @@ -127,8 +128,47 @@ bool DomainMapperTableManager::sprm(Sprm rSprm) } else if( sal::static_int_castId(pMeasureHandler-getUnit()) == NS_ooxml::LN_Value_ST_TblWidth_auto ) { -pPropMap-setValue( TablePropertyMap::TABLE_WIDTH_TYPE, text::SizeType::VARIABLE ); -pPropMap-setValue( TablePropertyMap::TABLE_WIDTH, 100 ); +/* +This attribute specifies the width type of table. This is used as part of the table layout +algorithm specified by the tblLayout element.(See 17.4.64 and 17.4.65 of the ISO/IEC 29500-1:2011.) +If this valus is 'auto', the table layout has to uses the preferred widths on the table items to generate +the final sizing of the table, but then must use the contents of each cell to determine final column widths. +(See 17.18.87 of the ISO/IEC 29500-1:2011.) +*/ +bool bFixed = false; +sal_Int32 nRowFixedWidth = 0; +if (!m_aCellWidths.empty()) +{ +// Step 1. Check whether any cell has fixed width in the given row of table. +::std::vector IntVectorPtr ::iterator itr; +for (itr = m_aCellWidths.begin(); itr != m_aCellWidths.end(); itr ++) +{ +IntVectorPtr itrVal = (*itr); +for (std::vectorsal_Int32::const_iterator aValIter = itrVal-begin(); aValIter != itrVal-end(); ++aValIter) +
[Libreoffice-commits] core.git: Branch 'distro/suse/suse-4.0' - sw/qa writerfilter/source
sw/qa/extras/rtfimport/data/n825305.rtf | 76 sw/qa/extras/rtfimport/rtfimport.cxx| 14 + writerfilter/source/rtftok/rtfsdrimport.cxx |5 + 3 files changed, 95 insertions(+) New commits: commit 073fadca38eba2960c89db07713c0d0d430e2874 Author: Miklos Vajna vmik...@suse.cz Date: Tue Jun 18 16:22:32 2013 +0200 bnc#825305 RTF import of fFilled shape property Change-Id: Iaa2ff9d5d1a28aec046f885acecbd1a44c734ec0 (cherry picked from commit 2af60e2eff4e952fff8cac0228b89f16ce3a436e) Conflicts: sw/qa/extras/rtfimport/rtfimport.cxx writerfilter/source/rtftok/rtfsdrimport.cxx diff --git a/sw/qa/extras/rtfimport/data/n825305.rtf b/sw/qa/extras/rtfimport/data/n825305.rtf new file mode 100755 index 000..72a6b52 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/n825305.rtf @@ -0,0 +1,76 @@ +{\rtf +\viewkind1\margl360\margr360 +\margt360\margb360\paperw12240\paperh15840\pard +{\shp +{\*\shpinst\shpleft555\shpright1185\shptop5715\shpbottom5970\shpbxpage +\shpbypage\shpwr3\shpz1 +{\sp +{\sn shapeType} +{\sv 1} +} +{\sp +{\sn fLine} +{\sv 1} +} +{\sp + +{\sn lineWidth} +{\sv 0} +} +{\sp +{\sn lineColor} +{\sv 10485760} +} +{\sp +{\sn lineDashing +} +{\sv 0} +} +{\sp +{\sn fFilled} +{\sv 1} +} +{\sp +{\sn fillColor} +{\sv 10485760} +} +} +} +{\shp +{\*\shpinst\shpleft780\shpright1425\shptop5790\shpbottom6030\shpbxpage +\shpbypage\shpwr3\shpz2 +{\sp +{\sn shapeType} +{\sv 202} +} +{\sp +{\sn dxTextLeft} +{\sv +0} +} +{\sp +{\sn dxTextRight} +{\sv 0} +} +{\sp +{\sn dyTextTop} +{\sv 0} +} +{\sp +{\sn +dyTextBottom} +{\sv 0} +} +{\sp +{\sn fLine} +{\sv 0} +} +{\shptxt\plain\pard\f29\fs20 Ln # +\par} +{\sp +{\sn fFilled} +{\sv 0} +} +} +} +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 3a41731..c87ba3e 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -149,6 +149,7 @@ public: void testFdo63023(); void testN818997(); void testFdo64671(); +void testN825305(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) !defined(WNT) @@ -268,6 +269,7 @@ void Test::run() {fdo63023.rtf, Test::testFdo63023}, {n818997.rtf, Test::testN818997}, {fdo64671.rtf, Test::testFdo64671}, +{n825305.rtf, Test::testN825305}, }; for (unsigned int i = 0; i SAL_N_ELEMENTS(aMethods); ++i) { @@ -1230,6 +1232,18 @@ void Test::testFdo64671() getRun(getParagraph(1), 1, OUString(\xC5\xBD, 2, RTL_TEXTENCODING_UTF8)); } +void Test::testN825305() +{ +// The problem was that the textbox wasn't transparent, due to unimplemented fFilled == 0. +uno::Referencedrawing::XDrawPageSupplier xDrawPageSupplier(mxComponent, uno::UNO_QUERY); +uno::Referencecontainer::XIndexAccess xDraws(xDrawPageSupplier-getDrawPage(), uno::UNO_QUERY); +uno::Referencebeans::XPropertyState xPropertyState(xDraws-getByIndex(1), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(sal_Int32(100), getPropertysal_Int32(xDraws-getByIndex(1), FillTransparence)); +beans::PropertyState ePropertyState = xPropertyState-getPropertyState(FillTransparence); +// Was beans::PropertyState_DEFAULT_VALUE. +CPPUNIT_ASSERT_EQUAL(beans::PropertyState_DIRECT_VALUE, ePropertyState); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index 864a8bd..3bb7af9 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -104,6 +104,7 @@ void RTFSdrImport::resolve(RTFShape rShape) uno::Any aLineColor = uno::makeAny(COL_BLACK); // Default line width is 0.75 pt (26 mm100) in Word, 0 in Writer. uno::Any aLineWidth = uno::makeAny(sal_Int32(26)); +bool bFilled = true; for (std::vector std::pairrtl::OUString, rtl::OUString ::iterator i = rShape.aProperties.begin(); i != rShape.aProperties.end(); ++i) @@ -288,6 +289,8 @@ void RTFSdrImport::resolve(RTFShape rShape) aViewBox.Height = i-second.toInt32(); else if ( i-first == dhgt ) resolveDhgt(xPropertySet, i-second.toInt32()); +else if (i-first == fFilled) +bFilled = i-second.toInt32() == 1; else SAL_INFO(writerfilter, OSL_THIS_FUNC : TODO handle shape property ' OUStringToOString( i-first, RTL_TEXTENCODING_UTF8 ).getStr() ':' @@ -357,6 +360,8 @@ void RTFSdrImport::resolve(RTFShape rShape) xPropertySet-setPropertyValue(VertOrientRelation, uno::makeAny(rShape.nVertOrientRelation)); if (rShape.nWrap != -1) xPropertySet-setPropertyValue(Surround, uno::makeAny(text::WrapTextMode(rShape.nWrap))); +if (!bFilled) +xPropertySet-setPropertyValue(FillTransparence, uno::makeAny(sal_Int32(100))); }
[Libreoffice-commits] core.git: Branch 'distro/suse/suse-4.0' - sw/qa writerfilter/source
sw/qa/extras/rtfimport/data/fdo64671.rtf |3 +++ sw/qa/extras/rtfimport/rtfimport.cxx |8 writerfilter/source/rtftok/rtfdocumentimpl.cxx |2 +- 3 files changed, 12 insertions(+), 1 deletion(-) New commits: commit 4f5f14320b61bea61c73699a42030e8aa5960c80 Author: Urmas davian...@gmail.com Date: Mon May 27 09:49:55 2013 +0200 fdo#64671 Some special RTF characters were not skipped correctly Some special characters, like { and }, were not skipped when they occured as a replacement character for \uN keyword. (cherry picked from commits bfb93ffc6d72d22a833acf9d8c9d166153dad7c0 and ec8e012e980c88c8f24a7de44e44d0319bae2801) Conflicts: sw/qa/extras/rtfimport/rtfimport.cxx Change-Id: I19b66a290cd9880924774fa89bb29df280e44a3c Signed-off-by: Miklos Vajna vmik...@suse.cz diff --git a/sw/qa/extras/rtfimport/data/fdo64671.rtf b/sw/qa/extras/rtfimport/data/fdo64671.rtf new file mode 100644 index 000..385dca4 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/fdo64671.rtf @@ -0,0 +1,3 @@ +{\rtf1 +\u381\'7d +\par} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index e31fa98..3a41731 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -148,6 +148,7 @@ public: void testFdo61193(); void testFdo63023(); void testN818997(); +void testFdo64671(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) !defined(WNT) @@ -266,6 +267,7 @@ void Test::run() {hello.rtf, Test::testFdo61193}, {fdo63023.rtf, Test::testFdo63023}, {n818997.rtf, Test::testN818997}, +{fdo64671.rtf, Test::testFdo64671}, }; for (unsigned int i = 0; i SAL_N_ELEMENTS(aMethods); ++i) { @@ -1222,6 +1224,12 @@ void Test::testN818997() CPPUNIT_ASSERT_EQUAL(2, getPages()); } +void Test::testFdo64671() +{ +// Additional '}' was inserted before the special character. +getRun(getParagraph(1), 1, OUString(\xC5\xBD, 2, RTL_TEXTENCODING_UTF8)); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 15ff924..951adc4 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -880,7 +880,7 @@ int RTFDocumentImpl::resolveChars(char ch) bool bUnicodeChecked = false; bool bSkipped = false; -while(!Strm().IsEof() ch != '{' ch != '}' ch != '\\') +while(!Strm().IsEof() (m_aStates.top().nInternalState == INTERNAL_HEX || (ch != '{' ch != '}' ch != '\\'))) { if (m_aStates.top().nInternalState == INTERNAL_HEX || (ch != 0x0d ch != 0x0a)) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/suse/suse-4.0' - sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/ooxmlimport.cxx |2 sw/qa/extras/rtfimport/rtfimport.cxx |4 - writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 15 + writerfilter/source/dmapper/DomainMapperTableManager.cxx | 39 ++- writerfilter/source/dmapper/MeasureHandler.hxx |3 + writerfilter/source/dmapper/PropertyIds.cxx |2 writerfilter/source/dmapper/PropertyIds.hxx |2 writerfilter/source/dmapper/PropertyMap.hxx |1 8 files changed, 50 insertions(+), 18 deletions(-) New commits: commit 361cc86a7ea8ad265a4afa03aa132d3fb5f73ff4 Author: Miklos Vajna vmik...@suse.cz Date: Thu May 23 16:33:22 2013 +0200 bnc#819882 DOCX import: backport table-related fixes from libreoffice-4-1 6718482c072defe5d885030826fef5ef833732e9 2013-03-28 fixed table width, supporting rel table width, fixed grid handling 84f1fa190fc2b91d21b685f4d0ea99aaeea26fe0 2013-03-28 WaE: -Wsign-compare 584322cbbd063e0a8d2c18a5e6a12f213af56057 2013-03-28 fix failing testcases diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index b735879..38f3df3 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1156,7 +1156,7 @@ void Test::testFdo59273() uno::Referencetext::XTextTable xTextTable(xTables-getByIndex(0), uno::UNO_QUERY); uno::Referencetable::XTableRows xTableRows(xTextTable-getRows(), uno::UNO_QUERY); // Was 9997, so the 4th column had ~zero width -CPPUNIT_ASSERT_EQUAL(sal_Int16(7498), getProperty uno::Sequencetext::TableColumnSeparator (xTableRows-getByIndex(0), TableColumnSeparators)[2].Position); +CPPUNIT_ASSERT_EQUAL(sal_Int16(7499), getProperty uno::Sequencetext::TableColumnSeparator (xTableRows-getByIndex(0), TableColumnSeparators)[2].Position); } void Test::testN592908_Frame() diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index a22159d..e31fa98 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -1024,7 +1024,7 @@ void Test::testFdo55525() CPPUNIT_ASSERT_EQUAL(sal_Int32(-1877), getPropertysal_Int32(xTable, LeftMargin)); // Cell width of A1 was 3332 (e.g. not set, 30% percent of total width) uno::Referencetable::XTableRows xTableRows(xTable-getRows(), uno::UNO_QUERY); -CPPUNIT_ASSERT_EQUAL(sal_Int16(1016), getProperty uno::Sequencetext::TableColumnSeparator (xTableRows-getByIndex(0), TableColumnSeparators)[0].Position); +CPPUNIT_ASSERT_EQUAL(sal_Int16(896), getProperty uno::Sequencetext::TableColumnSeparator (xTableRows-getByIndex(0), TableColumnSeparators)[0].Position); } void Test::testFdo57708() @@ -1129,7 +1129,7 @@ void Test::testFdo59953() uno::Referencetext::XTextTable xTable(xTables-getByIndex(0), uno::UNO_QUERY); // Cell width of A1 was 4998 (e.g. not set / not wide enough, ~50% of total width) uno::Referencetable::XTableRows xTableRows(xTable-getRows(), uno::UNO_QUERY); -CPPUNIT_ASSERT_EQUAL(sal_Int16(7650), getProperty uno::Sequencetext::TableColumnSeparator (xTableRows-getByIndex(0), TableColumnSeparators)[0].Position); +CPPUNIT_ASSERT_EQUAL(sal_Int16(7649), getProperty uno::Sequencetext::TableColumnSeparator (xTableRows-getByIndex(0), TableColumnSeparators)[0].Position); } void Test::testFdo59638() diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index 217c7f8..2a5f503 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -24,6 +24,7 @@ #include com/sun/star/table/BorderLine2.hpp #include com/sun/star/text/HoriOrientation.hpp #include com/sun/star/text/RelOrientation.hpp +#include com/sun/star/text/SizeType.hpp #include dmapperLoggers.hxx #ifdef DEBUG_DMAPPER_TABLE_HANDLER @@ -318,6 +319,7 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo sal_Int32 nGapHalf = 0; sal_Int32 nLeftMargin = 0; sal_Int32 nTableWidth = 0; +sal_Int32 nTableWidthType = text::SizeType::FIX; PropertyMap::iterator aTableStyleIter = m_aTableProperties-find( PropertyDefinition( META_PROP_TABLE_STYLE_NAME, false ) ); @@ -455,8 +457,17 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo } m_aTableProperties-getValue( TablePropertyMap::TABLE_WIDTH, nTableWidth ); -if( nTableWidth 0 ) -m_aTableProperties-Insert( PROP_WIDTH, false, uno::makeAny( nTableWidth )); +m_aTableProperties-getValue( TablePropertyMap::TABLE_WIDTH_TYPE, nTableWidthType ); +if( nTableWidthType == text::SizeType::FIX ) +{ +if( nTableWidth 0 ) +m_aTableProperties-Insert(
[Libreoffice-commits] core.git: Branch 'distro/suse/suse-4.0' - sw/qa writerfilter/source
sw/qa/extras/rtfimport/data/n818997.rtf | 77 ++ sw/qa/extras/rtfimport/rtfimport.cxx |8 ++ writerfilter/source/dmapper/DomainMapper.cxx | 13 +++ writerfilter/source/dmapper/DomainMapper_Impl.cxx | 15 writerfilter/source/dmapper/DomainMapper_Impl.hxx |1 writerfilter/source/rtftok/rtfdocumentimpl.cxx|4 + writerfilter/source/rtftok/rtfdocumentimpl.hxx|2 7 files changed, 120 insertions(+) New commits: commit 5177c2d7a970bf1cdefed8a068e1069a83a34396 Author: Miklos Vajna vmik...@suse.cz Date: Tue May 21 14:56:45 2013 +0200 bnc#818997 RTF import: don't ignore page breaks between shapes Change-Id: Ief71ba9a3c60356714e73d08e88d0a3105b17b1a (cherry picked from commit b40fe8e5a5037d2745cc7b1c9cc408ce6c79b9d9) Conflicts: sw/qa/extras/rtfimport/rtfimport.cxx writerfilter/source/dmapper/DomainMapper.cxx writerfilter/source/rtftok/rtfdocumentimpl.cxx diff --git a/sw/qa/extras/rtfimport/data/n818997.rtf b/sw/qa/extras/rtfimport/data/n818997.rtf new file mode 100644 index 000..2ce4404 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/n818997.rtf @@ -0,0 +1,77 @@ +{\rtf +{\shp +{\*\shpinst\shpleft2310\shpright6060\shptop8685\shpbottom8985\shpbxpage +\shpbypage\shpwr3\shpz2 +{\sp +{\sn shapeType} +{\sv 202} +} +{\sp +{\sn dxTextLeft} +{\sv +0} +} +{\sp +{\sn dxTextRight} +{\sv 0} +} +{\sp +{\sn dyTextTop} +{\sv 0} +} +{\sp +{\sn +dyTextBottom} +{\sv 0} +} +{\sp +{\sn fLine} +{\sv 0} +} +{\shptxt\plain\pard\f29\fs24 +On first page.\par} +{\sp +{\sn fFilled} +{\sv 0} +} +} +} +\page +{\shp +{\*\shpinst\shpleft4800\shpright8025\shptop780\shpbottom1080\shpbxpage +\shpbypage\shpwr3\shpz2 +{\sp +{\sn shapeType} +{\sv 202} +} +{\sp +{\sn dxTextLeft} +{\sv +0} +} +{\sp +{\sn dxTextRight} +{\sv 0} +} +{\sp +{\sn dyTextTop} +{\sv 0} +} +{\sp +{\sn +dyTextBottom} +{\sv 0} +} +{\sp +{\sn fLine} +{\sv 0} +} +{\shptxt\plain\pard\f29\fs24\b +On second page.\par} +{\sp +{\sn fFilled} +{\sv 0} +} +} +} +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index c02dac5..a22159d 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -147,6 +147,7 @@ public: void testFdo51916(); void testFdo61193(); void testFdo63023(); +void testN818997(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) !defined(WNT) @@ -264,6 +265,7 @@ void Test::run() {fdo51916.rtf, Test::testFdo51916}, {hello.rtf, Test::testFdo61193}, {fdo63023.rtf, Test::testFdo63023}, +{n818997.rtf, Test::testN818997}, }; for (unsigned int i = 0; i SAL_N_ELEMENTS(aMethods); ++i) { @@ -1214,6 +1216,12 @@ void Test::testFdo63023() CPPUNIT_ASSERT_EQUAL(sal_Int32(0x99), getPropertysal_Int32(getRun(getParagraphOfText(1, xHeaderText), 1), CharBackColor)); } +void Test::testN818997() +{ +// \page was ignored between two \shp tokens. +CPPUNIT_ASSERT_EQUAL(2, getPages()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 0e10907..66b1e6c 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -3462,6 +3462,19 @@ void DomainMapper::markLastParagraphInSection( ) void DomainMapper::lcl_startShape( uno::Reference drawing::XShape xShape ) { +// If there is a deferred page break, handle it now, so that the +// started shape will be on the correct page. +if (m_pImpl-isBreakDeferred(PAGE_BREAK)) +{ +m_pImpl-clearDeferredBreak(PAGE_BREAK); +lcl_startCharacterGroup(); +sal_uInt8 sBreak[] = { 0xd }; +lcl_text(sBreak, 1); +lcl_endCharacterGroup(); +lcl_endParagraphGroup(); +lcl_startParagraphGroup(); +m_pImpl-GetTopContext()-Insert(PROP_BREAK_TYPE, true, uno::makeAny( com::sun::star::style::BreakType_PAGE_BEFORE)); +} m_pImpl-PushShapeContext( xShape ); lcl_startParagraphGroup(); } diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 55ae949..94a535f 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -648,6 +648,21 @@ bool DomainMapper_Impl::isBreakDeferred( BreakType deferredBreakType ) } } +void DomainMapper_Impl::clearDeferredBreak(BreakType deferredBreakType) +{ +switch (deferredBreakType) +{ +case COLUMN_BREAK: +m_bIsColumnBreakDeferred = false; +break; +case PAGE_BREAK: +m_bIsPageBreakDeferred = false; +break; +default: +break; +} +} + void DomainMapper_Impl::clearDeferredBreaks() { m_bIsColumnBreakDeferred = false; diff --git