[Libreoffice-commits] .: 2 commits - sw/qa writerfilter/source
sw/qa/extras/rtfimport/data/copypaste-footnote-paste.rtf |3 sw/qa/extras/rtfimport/data/copypaste-footnote.rtf |6 + sw/qa/extras/rtfimport/rtfimport.cxx | 47 +++ writerfilter/source/dmapper/DomainMapper_Impl.cxx|7 +- 4 files changed, 49 insertions(+), 14 deletions(-) New commits: commit 078e8583eaee630dc24e4c355914b532cadeb316 Author: Miklos Vajna Date: Tue Jan 15 11:12:55 2013 +0100 clean up copy&paste tests duplication Change-Id: Idc3e959ba701f9967f7bdb95bd920c8e7416c80a diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 2e07e3b..480a63b 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -148,6 +148,27 @@ private: void run(); /// Get page count. int getPages(); +/// Copy&paste helper. +void paste(OUString aFilename, uno::Reference xTextRange = uno::Reference()) +{ +uno::Reference xFilter(m_xSFactory->createInstance("com.sun.star.comp.Writer.RtfFilter"), uno::UNO_QUERY_THROW); +uno::Reference xImporter(xFilter, uno::UNO_QUERY_THROW); +xImporter->setTargetDocument(mxComponent); +uno::Sequence aDescriptor(xTextRange.is() ? 3 : 2); +aDescriptor[0].Name = "InputStream"; +SvStream* pStream = utl::UcbStreamHelper::CreateStream(getURLFromSrc("/sw/qa/extras/rtfimport/data/") + aFilename, STREAM_WRITE); +uno::Reference xStream(new utl::OStreamWrapper(*pStream)); +aDescriptor[0].Value <<= xStream; +aDescriptor[1].Name = "IsNewDoc"; +aDescriptor[1].Value <<= sal_False; +if (xTextRange.is()) +{ +aDescriptor[2].Name = "TextInsertModeRange"; +aDescriptor[2].Value <<= xTextRange; +} +xFilter->filter(aDescriptor); +} + }; void Test::run() @@ -849,18 +870,7 @@ void Test::testCopyPastePageStyle() { // The problem was that RTF import during copy&paste did not ignore page styles. // Once we have more copy&paste tests, makes sense to refactor this to some helper method. -uno::Reference xInterface(m_xSFactory->createInstance("com.sun.star.comp.Writer.RtfFilter"), uno::UNO_QUERY_THROW); -uno::Reference xImporter(xInterface, uno::UNO_QUERY_THROW); -xImporter->setTargetDocument(mxComponent); -uno::Reference xFilter(xInterface, uno::UNO_QUERY_THROW); -uno::Sequence aDescriptor(2); -aDescriptor[0].Name = "InputStream"; -SvStream* pStream = utl::UcbStreamHelper::CreateStream(getURLFromSrc("/sw/qa/extras/rtfimport/data/") + "copypaste-pagestyle-paste.rtf", STREAM_WRITE); -uno::Reference xStream(new utl::OStreamWrapper(*pStream)); -aDescriptor[0].Value <<= xStream; -aDescriptor[1].Name = "IsNewDoc"; -aDescriptor[1].Value <<= sal_False; -xFilter->filter(aDescriptor); +paste("copypaste-pagestyle-paste.rtf"); uno::Reference xPropertySet(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(21001), getProperty(xPropertySet, "Width")); // Was letter, i.e. 21590 @@ -872,21 +882,7 @@ void Test::testCopyPasteFootnote() uno::Reference xFootnotesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY); uno::Reference xTextRange(xFootnotes->getByIndex(0), uno::UNO_QUERY); - -uno::Reference xInterface(m_xSFactory->createInstance("com.sun.star.comp.Writer.RtfFilter"), uno::UNO_QUERY_THROW); -uno::Reference xImporter(xInterface, uno::UNO_QUERY_THROW); -xImporter->setTargetDocument(mxComponent); -uno::Reference xFilter(xInterface, uno::UNO_QUERY_THROW); -uno::Sequence aDescriptor(3); -aDescriptor[0].Name = "InputStream"; -SvStream* pStream = utl::UcbStreamHelper::CreateStream(getURLFromSrc("/sw/qa/extras/rtfimport/data/") + "copypaste-footnote-paste.rtf", STREAM_WRITE); -uno::Reference xStream(new utl::OStreamWrapper(*pStream)); -aDescriptor[0].Value <<= xStream; -aDescriptor[1].Name = "IsNewDoc"; -aDescriptor[1].Value <<= sal_False; -aDescriptor[2].Name = "TextInsertModeRange"; -aDescriptor[2].Value <<= xTextRange; -xFilter->filter(aDescriptor); +paste("copypaste-footnote-paste.rtf", xTextRange); CPPUNIT_ASSERT_EQUAL(OUString("bbb"), xTextRange->getString()); } commit b6a2083b9dfe5aceb0900315363ef41e2f3abef5 Author: Miklos Vajna Date: Tue Jan 15 09:58:48 2013 +0100 fdo#59338 fix RTF paste into footnote Change-Id: I89501f267fd4256eb3b1316ef41a0f9b0786e0f0 diff --git a/sw/qa/extras/rtfimport/data/copypaste-footnote-paste.rtf b/sw/qa/extras/rtfimport/data/copypaste-footnote-paste.rtf new file mode 100644 index 000..1f4a75e --- /dev/null +++ b/sw/qa/extras/rtfimport/data/copypaste-footnote-paste.rtf @@ -0,0 +1,3 @@ +{\rtf1 +bbb +\par } diff --git a/sw/qa/extras/rtfimport/data/copypaste-footnote.rtf b/sw/qa
[Libreoffice-commits] .: 2 commits - sw/qa sw/source
sw/qa/complex/writer/CheckTable.java | 32 + sw/source/core/unocore/unocrsrhelper.cxx | 39 +-- sw/source/core/unocore/unoobj.cxx|4 +++ sw/source/core/unocore/unoobj2.cxx |7 +++-- 4 files changed, 67 insertions(+), 15 deletions(-) New commits: commit 68d40d2cae3700f4134375fcaf9649ac626ada7d Author: Michael Stahl Date: Wed Jan 9 15:45:32 2013 +0100 fdo#58242: sw: fix more crashes when not on SwTxtNode In getCrsrPropertyValue etc.; also add a unit test for the problem. Change-Id: Ibd459a43393c39b4fed9fb89aae4a5f7bacff007 diff --git a/sw/qa/complex/writer/CheckTable.java b/sw/qa/complex/writer/CheckTable.java index 449dc1a..6fe9b28 100644 --- a/sw/qa/complex/writer/CheckTable.java +++ b/sw/qa/complex/writer/CheckTable.java @@ -10,12 +10,16 @@ package complex.writer; import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.RuntimeException; import com.sun.star.uno.XComponentContext; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.beans.XPropertySet; +import com.sun.star.beans.XPropertySetInfo; +import com.sun.star.beans.Property; import com.sun.star.text.XText; import com.sun.star.text.XTextDocument; import com.sun.star.text.XTextCursor; +import com.sun.star.text.XTextRange; import com.sun.star.text.XTextTable; import com.sun.star.table.TableBorder; import com.sun.star.table.TableBorder2; @@ -258,6 +262,34 @@ public class CheckTable assertTrue(border2.IsDistanceValid); assertEquals(97, border2.Distance); } + +@Test +public void test_fdo58242() throws Exception +{ +// insert table +XMultiServiceFactory xDocF = +UnoRuntime.queryInterface(XMultiServiceFactory.class, m_xDoc); +XTextTable xTable = UnoRuntime.queryInterface(XTextTable.class, +xDocF.createInstance("com.sun.star.text.TextTable")); +xTable.initialize(3, 3); +XText xText = m_xDoc.getText(); +XTextCursor xCursor = xText.createTextCursor(); +xText.insertTextContent(xCursor, xTable, false); +// get anchor +XTextRange xAnchor = xTable.getAnchor(); +// check all properties on the anchor - shouldn't crash despite +// pointing to a non-SwTxtNode +XPropertySet xProps = (XPropertySet) +UnoRuntime.queryInterface(XPropertySet.class, xAnchor); +XPropertySetInfo xPropsInfo = xProps.getPropertySetInfo(); +Property[] props = xPropsInfo.getProperties(); +for (int i = 0; i < props.length; ++i) +{ +try { +xProps.getPropertyValue(props[i].Name); +} catch (RuntimeException e) { } +} +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index 21f553a..a1d068d 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -487,9 +487,9 @@ bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry case FN_UNO_CHARFMT_SEQUENCE: { -SwTxtNode* pTxtNode; -if((pTxtNode = (SwTxtNode*)rPam.GetNode( sal_True )) == rPam.GetNode(sal_False) && -pTxtNode->GetpSwpHints()) +SwTxtNode *const pTxtNode = rPam.GetNode()->GetTxtNode(); +if (rPam.GetNode(sal_True) == rPam.GetNode(sal_False) +&& pTxtNode && pTxtNode->GetpSwpHints()) { sal_uInt16 nPaMStart = rPam.GetPoint()->nContent.GetIndex(); sal_uInt16 nPaMEnd = rPam.GetMark() ? rPam.GetMark()->nContent.GetIndex() : nPaMStart; @@ -940,6 +940,11 @@ bool DocInsertStringSplitCR( xub_StrLen nStartIdx = 0; SwTxtNode* const pTxtNd = rNewCursor.GetPoint()->nNode.GetNode().GetTxtNode(); +if (!pTxtNd) +{ +SAL_INFO("sw.uno", "DocInsertStringSplitCR: need a text node"); +return false; +} const xub_StrLen nMaxLength = ( pTxtNd ) ? STRING_LEN - pTxtNd->GetTxt().Len() : STRING_LEN; diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index f5736b8..3162e5a 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -529,6 +529,10 @@ throw (lang::IllegalArgumentException) { // multi selection is not considered SwTxtNode *const pTxtNd = rPam.GetNode()->GetTxtNode(); +if (!pTxtNd) +{ +throw lang::IllegalArgumentException(); +} if (FN_UNO_NUM_LEVEL == rEntry.nWID) { sal_Int16 nLevel = 0; diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx index 043f0cf..62f73db 100644 --- a/sw/source/core/unocore/unoobj2.cxx +++ b/sw/source/core/unocore/unoobj2.cxx @@ -1839,9 +1839,10 @@ lcl_F
[Libreoffice-commits] .: 2 commits - sw/qa writerfilter/source
sw/qa/extras/rtfimport/data/fdo56512.rtf |5 + sw/qa/extras/rtfimport/rtfimport.cxx | 11 +++ writerfilter/source/rtftok/rtfdocumentimpl.cxx |6 +- 3 files changed, 21 insertions(+), 1 deletion(-) New commits: commit 2f6097e677dbb7e5387599f3bed4aa2d40755c88 Author: Miklos Vajna Date: Tue Oct 30 17:39:31 2012 +0100 fdo#56512 testcase Change-Id: Ib075209a2b61041ed40685093bc277243a0bef04 diff --git a/sw/qa/extras/rtfimport/data/fdo56512.rtf b/sw/qa/extras/rtfimport/data/fdo56512.rtf new file mode 100644 index 000..bc400cf --- /dev/null +++ b/sw/qa/extras/rtfimport/data/fdo56512.rtf @@ -0,0 +1,5 @@ +{\rtf1\ansi\ansicpg1255 +{\*\do\dobxpage\dobypara\dodhgt8192\dptxbx\dptxbxmar0 +{\dptxbxtext\ltrpar\f0\fs20\cf1\vertalc\qr\rtlch òåñ÷ îåøùä \par} +\dpx929\dpy1700\dpxsize10556\dpysize221\dplinehollow0} +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index ba09889..4da71c6 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -121,6 +121,7 @@ public: void testDplinehollow(); void testLeftmarginDefault(); void testDppolyline(); +void testFdo56512(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -193,6 +194,7 @@ void Test::run() {"dplinehollow.rtf", &Test::testDplinehollow}, {"leftmargin-default.rtf", &Test::testLeftmarginDefault}, {"dppolyline.rtf", &Test::testDppolyline}, +{"fdo56512.rtf", &Test::testFdo56512}, }; for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) { @@ -884,6 +886,15 @@ void Test::testDppolyline() CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xDraws->getCount()); } +void Test::testFdo56512() +{ +uno::Reference xTextFramesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); +uno::Reference xTextRange(xIndexAccess->getByIndex(0), uno::UNO_QUERY); +OUString aExpected("×¢×סק ×××¨×©× ", 20, RTL_TEXTENCODING_UTF8); +CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); commit b99b91763f96dcd5ff24c2d4cd9233a493b58aa0 Author: Miklos Vajna Date: Tue Oct 30 16:41:24 2012 +0100 fdo#56512 fix RTF import of non-unicode Hebrew text The trick here is that we can't just fall back to Hebrew encoding for the whole document, as that would mirror shapes as well. Instead, check where \rtlch is used, and there fall back to the default encoding. Change-Id: Iaf155912fab6a559ed165870b8524c23cabcb86d diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index f350a7f..2333f52 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -2064,8 +2064,11 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) } break; case RTF_LTRCH: +// dmapper does not support this. +break; case RTF_RTLCH: -// dmapper does not support these. +if (m_aDefaultState.nCurrentEncoding == RTL_TEXTENCODING_MS_1255) +m_aStates.top().nCurrentEncoding = m_aDefaultState.nCurrentEncoding; break; case RTF_ULNONE: { @@ -2587,6 +2590,7 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) } break; case RTF_ANSICPG: +m_aDefaultState.nCurrentEncoding = rtl_getTextEncodingFromWindowsCodePage(nParam); m_aStates.top().nCurrentEncoding = rtl_getTextEncodingFromWindowsCodePage(nParam); break; case RTF_CPG: ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: 2 commits - sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/data/n783638.docx|binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 13 writerfilter/source/dmapper/GraphicImport.cxx | 28 +- 3 files changed, 32 insertions(+), 9 deletions(-) New commits: commit e2c481db7b905305128e733bb1fc8d0ad8cadbf5 Author: Miklos Vajna Date: Thu Oct 11 10:48:16 2012 +0200 n#783638 testcase Change-Id: I6b6093ba1e6961e421ac9754fdbdea9ba63eeda0 diff --git a/sw/qa/extras/ooxmlimport/data/n783638.docx b/sw/qa/extras/ooxmlimport/data/n783638.docx new file mode 100644 index 000..93b587b Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n783638.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index acc2097..c3a0bc5 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -104,6 +104,7 @@ public: void testShadow(); void testN782061(); void testN782345(); +void testN783638(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -150,6 +151,7 @@ public: CPPUNIT_TEST(testShadow); CPPUNIT_TEST(testN782061); CPPUNIT_TEST(testN782345); +CPPUNIT_TEST(testN783638); #endif CPPUNIT_TEST_SUITE_END(); @@ -1077,6 +1079,17 @@ void Test::testN779957() } } +void Test::testN783638() +{ +// The problem was that the margins of inline images were not zero. +load("n783638.docx"); + +uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); +uno::Reference xPropertySet(xDraws->getByIndex(0), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty(xPropertySet, "LeftMargin")); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); commit 3d7e168a2a43c2414b0633379102ddb29437e75b Author: Miklos Vajna Date: Thu Oct 11 10:21:57 2012 +0200 n#783638 DOCX import of wp:inline's distT/B/L/R attributes Change-Id: I181fcae021eed07608b06744b469628e4d78ccba diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index 9042f80..5709a17 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -339,6 +339,15 @@ public: { return bYSizeValid; } + +void applyMargins(uno::Reference< beans::XPropertySet > xGraphicObjectProperties) const +{ +PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier(); +xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_LEFT_MARGIN ), uno::makeAny(nLeftMargin)); +xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_RIGHT_MARGIN ), uno::makeAny(nRightMargin)); +xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_TOP_MARGIN ), uno::makeAny(nTopMargin)); +xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_BOTTOM_MARGIN ), uno::makeAny(nBottomMargin)); +} }; @@ -969,10 +978,17 @@ void GraphicImport::lcl_attribute(Id nName, Value & val) } break; case NS_ooxml::LN_CT_Inline_distT: +m_pImpl->nTopMargin = ConversionHelper::convertTwipToMM100(nIntValue); +break; case NS_ooxml::LN_CT_Inline_distB: +m_pImpl->nBottomMargin = ConversionHelper::convertTwipToMM100(nIntValue); +break; case NS_ooxml::LN_CT_Inline_distL: +m_pImpl->nLeftMargin = ConversionHelper::convertTwipToMM100(nIntValue); +break; case NS_ooxml::LN_CT_Inline_distR: -//TODO: need to be handled +m_pImpl->nRightMargin = ConversionHelper::convertTwipToMM100(nIntValue); +break; break; case NS_ooxml::LN_CT_GraphicalObjectData_uri: val.getString(); @@ -1453,14 +1469,7 @@ uno::Reference< text::XTextContent > GraphicImport::createGraphicObject( const b uno::makeAny(m_pImpl->bContour)); xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_CONTOUR_OUTSIDE ), uno::makeAny(m_pImpl->bContourOutside)); - xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_LEFT_MARGIN ), -uno::makeAny(m_pImpl->nLeftMargin)); - xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_RIGHT_MARGIN ), -uno::makeAny(m_pImpl->nRightMargin)); - xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_TOP_MARGIN ), -uno::makeAny(m_pImpl->nTopMargin)); - xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_BOTTOM_MARGIN ), -uno::makeAny(m_pImpl->nBottomMar
[Libreoffice-commits] .: 2 commits - sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/ooxmlimport.cxx |2 +- writerfilter/source/dmapper/GraphicImport.cxx |4 2 files changed, 5 insertions(+), 1 deletion(-) New commits: commit ecb252af18f64b99f4ecfe34512dedfb7655fb40 Author: Cédric Bosdonnat Date: Wed Oct 3 14:38:04 2012 +0200 testShadow: test shadow width to be non-0 to avoid precision errors Change-Id: I956f2c7f55d7e4966971bc310858967298d2933d diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index ceb2381..acc2097 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -990,7 +990,7 @@ void Test::testShadow() table::ShadowFormat aShadow; xPropertySet->getPropertyValue("ShadowFormat") >>= aShadow; -CPPUNIT_ASSERT_EQUAL(sal_Int32(273), sal_Int32(aShadow.ShadowWidth)); +CPPUNIT_ASSERT(sal_Int32(aShadow.ShadowWidth) > 0); } void Test::testN782061() commit f1fc7c5655dde547b721b3afffabcd8bdbe0add2 Author: Cédric Bosdonnat Date: Wed Oct 3 14:11:31 2012 +0200 fdo#44278: fix leaked image when import docx Unused temporary XShape need to be disposed to avoid remaining garbage in the document. Change-Id: Iaf6e720a1c47605136f7f9ccafb605cab6dc260a diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index cbd59f9..9042f80 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -922,6 +922,10 @@ void GraphicImport::lcl_attribute(Id nName, Value & val) uno::makeAny( aSize.Height ) ); xGraphProps->setPropertyValue("Width", uno::makeAny( aSize.Width ) ); + +// We need to drop the shape here somehow +uno::Reference< lang::XComponent > xShapeComponent( xShape, uno::UNO_QUERY ); +xShapeComponent->dispose( ); } } catch( const beans::UnknownPropertyException & ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: 2 commits - sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/data/n782345.docx|binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 13 + writerfilter/source/dmapper/DomainMapper.cxx | 10 ++ writerfilter/source/dmapper/SettingsTable.cxx | 10 ++ writerfilter/source/dmapper/SettingsTable.hxx |1 + 5 files changed, 34 insertions(+) New commits: commit 738d5dab435084737aab2e0519fd817f62f1e83b Author: Miklos Vajna Date: Mon Oct 1 15:06:25 2012 +0200 n#782345 testcase Change-Id: Id5204572ab9fddf3f15b5fd1b96d8f25e7166878 diff --git a/sw/qa/extras/ooxmlimport/data/n782345.docx b/sw/qa/extras/ooxmlimport/data/n782345.docx new file mode 100644 index 000..f25709f Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n782345.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index a83a398..c545a89 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -97,6 +98,7 @@ public: void testN780843(); void testShadow(); void testN782061(); +void testN782345(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -140,6 +142,7 @@ public: CPPUNIT_TEST(testN780843); CPPUNIT_TEST(testShadow); CPPUNIT_TEST(testN782061); +CPPUNIT_TEST(testN782345); #endif CPPUNIT_TEST_SUITE_END(); @@ -993,6 +996,16 @@ void Test::testN782061() CPPUNIT_ASSERT_EQUAL(sal_Int32(-9), getProperty(getRun(getParagraph(1), 2), "CharEscapement")); } +void Test::testN782345() +{ +/* + * The problem was that the page break was inserted before the 3rd para, instead of before the 2nd para. + */ +load("n782345.docx"); + +CPPUNIT_ASSERT_EQUAL(style::BreakType_PAGE_BEFORE, getProperty(getParagraph(2), "BreakType")); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); commit 40d93d978d4f8fa709bdeb061b106122789d8e32 Author: Miklos Vajna Date: Mon Oct 1 13:42:02 2012 +0200 n#782345 import DOCX w:splitPgBreakAndParaMark compat option This fixes docx import of page breaks in empty paragraphs, when the compat option in question is set. Even empty paragraphs have an "end of paragraph" character in dmapper: import page breaks there, instead of delaying the import till the all-catcher importer at the start of the next paragraph. Change-Id: Ie5c37042b3c445e0669771d15c8eb46380192db3 diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 8b51034..64618bf 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -3542,6 +3542,16 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len) if(len == 1 && (sText[0] == 0x0d || sText[0] == 0x07)) { +PropertyMapPtr pContext = m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH); +if (pContext && m_pImpl->GetSettingsTable()->GetSplitPgBreakAndParaMark()) +{ +if (m_pImpl->isBreakDeferred(PAGE_BREAK)) +pContext->Insert(PROP_BREAK_TYPE, true, uno::makeAny( com::sun::star::style::BreakType_PAGE_BEFORE)); +else if (m_pImpl->isBreakDeferred(COLUMN_BREAK)) +pContext->Insert(PROP_BREAK_TYPE, true, uno::makeAny( com::sun::star::style::BreakType_COLUMN_BEFORE)); +m_pImpl->clearDeferredBreaks(); +} + bool bSingleParagraph = m_pImpl->GetIsFirstParagraphInSection() && m_pImpl->GetIsLastParagraphInSection(); // If the paragraph contains only the section properties and it has // no runs, we should not create a paragraph for it in Writer, unless that would remove the whole section. diff --git a/writerfilter/source/dmapper/SettingsTable.cxx b/writerfilter/source/dmapper/SettingsTable.cxx index 18bef92..b01047a 100644 --- a/writerfilter/source/dmapper/SettingsTable.cxx +++ b/writerfilter/source/dmapper/SettingsTable.cxx @@ -72,6 +72,7 @@ struct SettingsTable_Impl boolembedTrueTypeFonts; boolembedSystemFonts; boolm_bDoNotUseHTMLParagraphAutoSpacing; +boolm_bSplitPgBreakAndParaMark; SettingsTable_Impl( DomainMapper& rDMapper, const uno::Reference< lang::XMultiServiceFactory > xTextFactory ) : m_rDMapper( rDMapper ) @@ -95,6 +96,7 @@ struct SettingsTable_Impl , embedTrueTypeFonts(false) , embedSystemFonts(false) , m_bDoNotUseHTMLParagraphAutoSpacing(false) +, m_bSplitPgBreakAndParaMark(false) {} }; @@ -214,6 +216,9 @@ void SettingsTable::lcl_sprm(Sprm& rSprm) case NS_ooxml::LN_CT_Compat_doNotUseHTMLParagraphAutoSpacing: m_pImpl->m_bDoNotUseHTMLParagraphAutoSpacing = nIntValue; break; +case NS_ooxml
[Libreoffice-commits] .: 2 commits - sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/data/n782061.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx| 12 writerfilter/source/dmapper/DomainMapper.cxx| 14 +- writerfilter/source/dmapper/StyleSheetTable.cxx |4 writerfilter/source/dmapper/StyleSheetTable.hxx |3 +++ 5 files changed, 32 insertions(+), 1 deletion(-) New commits: commit 7a3a8a254363801bf6893b23d67f86a7461f8f3b Author: Miklos Vajna Date: Fri Sep 28 09:52:29 2012 +0100 n#782061 testcase Change-Id: I6aa95063ac8fe825b47decc68b08a35d81e4d59d diff --git a/sw/qa/extras/ooxmlimport/data/n782061.docx b/sw/qa/extras/ooxmlimport/data/n782061.docx new file mode 100644 index 000..9d8218b Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n782061.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 1cefa39..a83a398 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -96,6 +96,7 @@ public: void testN780853(); void testN780843(); void testShadow(); +void testN782061(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -138,6 +139,7 @@ public: CPPUNIT_TEST(testN780853); CPPUNIT_TEST(testN780843); CPPUNIT_TEST(testShadow); +CPPUNIT_TEST(testN782061); #endif CPPUNIT_TEST_SUITE_END(); @@ -981,6 +983,16 @@ void Test::testShadow() CPPUNIT_ASSERT_EQUAL(sal_Int32(273), sal_Int32(aShadow.ShadowWidth)); } +void Test::testN782061() +{ +/* + * The problem was that the character escapement in the second run was -58. + */ +load("n782061.docx"); + +CPPUNIT_ASSERT_EQUAL(sal_Int32(-9), getProperty(getRun(getParagraph(1), 2), "CharEscapement")); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); commit 0c8017a364efb0e8a1cab57b22257e9b319fa0a1 Author: Miklos Vajna Date: Fri Sep 28 09:51:42 2012 +0100 n#782061 DOCX import: w:position should respect w:sz in w:rPrDefault Subscript relative font size (w:position) is in percents in Writer, but is in half points in Word. When checking for the default font size to count the percent value, the mapper should search font size (w:sz) not only in direct character properties, but also in default character properties (w:rPrDefault). Change-Id: I9286d44c6498c765ddfee795d50921ef58b80071 diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 52d8c1a..cfd8dad 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -2132,7 +2132,9 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType if (xCharStyle.is()) xCharStyle->setPropertyValue(rPropNameSupplier.GetName(PROP_CHAR_HEIGHT), aVal); } -m_pImpl->deferCharacterProperty( nSprmId, uno::makeAny( nIntValue )); +// Make sure char sizes defined in the stylesheets don't affect char props from direct formatting. +if (!m_pImpl->IsStyleSheetImport()) +m_pImpl->deferCharacterProperty( nSprmId, uno::makeAny( nIntValue )); } break; case NS_sprm::LN_CHpsInc: @@ -3300,12 +3302,22 @@ void DomainMapper::processDeferredCharacterProperties( const std::map< sal_Int32 else { std::map< sal_Int32, uno::Any >::const_iterator font = deferredCharacterProperties.find( NS_sprm::LN_CHps ); +PropertyMapPtr pDefaultCharProps = m_pImpl->GetStyleSheetTable()->GetDefaultCharProps(); +PropertyMap::iterator aDefaultFont = pDefaultCharProps->find(PropertyDefinition( PROP_CHAR_HEIGHT, false )); if( font != deferredCharacterProperties.end()) { double fontSize = 0; font->second >>= fontSize; nEscapement = nIntValue * 100 / fontSize; } +// TODO if not direct formatting, check the style first, not directly the default char props. +else if (aDefaultFont != pDefaultCharProps->end()) +{ +double fHeight = 0; +aDefaultFont->second >>= fHeight; +// fHeight is in points, nIntValue is in half points, nEscapement is in percents. +nEscapement = nIntValue * 100 / fHeight / 2; +} else { // TODO: Find out the font size. The 58/-58 values were here previous, but I have // no idea what they are (they are probably some random guess that did fit whatever diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index be06d59..044b53c 100644 --- a/writerfilter/source/dmapper/StyleSheetTa
[Libreoffice-commits] .: 2 commits - sw/qa writerfilter/source
sw/qa/extras/rtfimport/data/fdo49655.rtf |5 + sw/qa/extras/rtfimport/rtfimport.cxx | 15 +++ writerfilter/source/dmapper/PropertyMap.cxx|2 ++ writerfilter/source/rtftok/rtfdocumentimpl.cxx |8 4 files changed, 30 insertions(+) New commits: commit af6b7d8ba30d395e5f4a17876526434cf0a06005 Author: Miklos Vajna Date: Mon Sep 24 09:41:02 2012 +0100 fdo#49655 fix RTF import of text in the middle of table definition Usually table text comes after the \intbl control word, but it turns out text is allowed earlier. Make sure such text is buffered, otherwise we'll send paragraph / run properties to the dmapper in the middle of table properties, which is obviously not allowed. Change-Id: I34f1df7e171316a7d926179689627301860d492f diff --git a/sw/qa/extras/rtfimport/data/fdo49655.rtf b/sw/qa/extras/rtfimport/data/fdo49655.rtf new file mode 100644 index 000..60f90fc --- /dev/null +++ b/sw/qa/extras/rtfimport/data/fdo49655.rtf @@ -0,0 +1,5 @@ +{\rtf1 +{\colortbl \red0\green0\blue0;\red128\green128\blue128;\red255\green255\blue255;} +\trowd \clvertalt \clbrdrt\brdrw15\brdrs \clbrdrl\brdrw15\brdrs \clbrdrb\brdrw15\brdrs \clbrdrr\brdrw15\brdrs \clcbpat1\cellx9600 \intbl\qc\cf2\b Travaux Exceptionnels de Jardinage N° 12.03.0005.TEJ \b0\cell \row +} +\pard\par diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 9d56761..873213b 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -111,6 +111,7 @@ public: void testFdo52052(); void testInk(); void testFdo52389(); +void testFdo49655(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -161,6 +162,7 @@ public: CPPUNIT_TEST(testFdo52052); CPPUNIT_TEST(testInk); CPPUNIT_TEST(testFdo52389); +CPPUNIT_TEST(testFdo49655); #endif CPPUNIT_TEST_SUITE_END(); @@ -970,6 +972,19 @@ void Test::testFdo52389() CPPUNIT_ASSERT_EQUAL(6, getLength()); } +void Test::testFdo49655() +{ +/* + * The problem was that the table was not imported due to the ' ' string in the middle of the table definition. + * + * xray ThisComponent.TextTables.Count 'was 0 + */ +load("fdo49655.rtf"); +uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xIndexAccess(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index f8200ff..5e33654 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -1006,6 +1006,14 @@ void RTFDocumentImpl::text(OUString& rString) return; } +// Are we in the middle of the table definition? (No cell defs yet, but we already have some cell props.) +if (m_aStates.top().aTableCellSprms.find(NS_ooxml::LN_CT_TcPrBase_vAlign).get() && +m_aStates.top().nCells == 0) +{ +m_aTableBuffer.push_back(make_pair(BUFFER_UTEXT, RTFValue::Pointer_t(new RTFValue(rString; +return; +} + checkFirstRun(); checkNeedPap(); commit da9acd209918ac26b44bddcf7b38b8887d23bfef Author: Miklos Vajna Date: Mon Sep 24 09:40:30 2012 +0100 fdo#49655 dmapper: fix default page style layout The default in Writer is mirrored, but in Word it's left and right. Change-Id: I8c615a3a18ad7493deb2a3a9369c13f3e4d5799d diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index d271299..8a0ece4 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -303,6 +303,8 @@ SectionPropertyMap::SectionPropertyMap(bool bIsFirstSection) : Insert( PROP_TOP_MARGIN, false, uno::makeAny( (sal_Int32)2540 ) ); //page bottom margin, default 0x5a0 (1440) twip -> 2540 1/100 mm Insert( PROP_BOTTOM_MARGIN, false, uno::makeAny( (sal_Int32) 2540 ) ); +//page style layout +Insert(PROP_PAGE_STYLE_LAYOUT, false, uno::makeAny(style::PageStyleLayout::PageStyleLayout_ALL)); uno::Any aFalse( ::uno::makeAny( false ) ); Insert( PROP_GRID_DISPLAY, false, aFalse); Insert( PROP_GRID_PRINT, false, aFalse); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: 2 commits - sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/data/n780563.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 13 writerfilter/source/dmapper/DomainMapperTableManager.cxx | 24 --- writerfilter/source/dmapper/DomainMapperTableManager.hxx |2 - writerfilter/source/dmapper/DomainMapper_Impl.cxx|1 5 files changed, 28 insertions(+), 12 deletions(-) New commits: commit 207aebf733cc568845cea5c2aeff78493e056b9a Author: Cédric Bosdonnat Date: Fri Sep 21 17:17:33 2012 +0200 n#780563: Fixed table import in shapes table handler was missing Change-Id: I7720cfc706d9612fcc1e8a53b13a31f22b91d99e diff --git a/sw/qa/extras/ooxmlimport/data/n780563.docx b/sw/qa/extras/ooxmlimport/data/n780563.docx new file mode 100644 index 000..508dc74 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n780563.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 6b1c425..34581e5 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -92,6 +92,7 @@ public: void testN779834(); void testN779627(); void testFdo55187(); +void testN780563(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -130,6 +131,7 @@ public: CPPUNIT_TEST(testN779834); CPPUNIT_TEST(testN779627); CPPUNIT_TEST(testFdo55187); +CPPUNIT_TEST(testN780563); #endif CPPUNIT_TEST_SUITE_END(); @@ -894,6 +896,17 @@ void Test::testFdo55187() getParagraph(1, OUString("lupÄka", 7, RTL_TEXTENCODING_UTF8)); } +void Test::testN780563() +{ +/* + * Make sure we have the table in the fly frame created + */ +load("n780563.docx"); +uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount( )); +} + 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 e144f6e..112b837 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1598,6 +1598,7 @@ void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape } appendTableManager( ); +appendTableHandler( ); getTableManager().startLevel(); } catch ( const uno::Exception& e ) commit b14b0f2b953b68612b8c230dbf3cabc15247c72d Author: Cédric Bosdonnat Date: Thu Sep 20 13:28:37 2012 +0200 n#779627: fixed writerfilter import of grid when there are nested tables When a nested table is ended, it resets the m_nCell to 0... and thus the filter forgets about the previous cells of the outer table row it is importing. Using a vector to store the m_nCell values for each table solves the problem Change-Id: I8007960f4c95d713bfedc6b815d5783a5d25af23 diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index bdcaa70..2753d7f 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -42,7 +42,7 @@ using namespace ::std; DomainMapperTableManager::DomainMapperTableManager(bool bOOXML, bool bImplicitMerges) : m_nRow(0), -m_nCell(0), +m_nCell(), m_nGridSpan(1), m_nCellBorderIndex(0), m_nHeaderRepeat(0), @@ -343,6 +343,7 @@ void DomainMapperTableManager::startLevel( ) IntVectorPtr pNewSpans( new vector ); m_aTableGrid.push_back( pNewGrid ); m_aGridSpans.push_back( pNewSpans ); +m_nCell.push_back( 0 ); m_nTableWidth = 0; } @@ -350,6 +351,7 @@ void DomainMapperTableManager::endLevel( ) { m_aTableGrid.pop_back( ); m_aGridSpans.pop_back( ); +m_nCell.pop_back( ); m_nTableWidth = 0; DomainMapperTableManager_Base_t::endLevel( ); @@ -373,7 +375,7 @@ void DomainMapperTableManager::endOfCellAction() getCurrentSpans()->push_back(m_nGridSpan); m_nGridSpan = 1; -++m_nCell; +++m_nCell.back( ); } @@ -416,10 +418,10 @@ void DomainMapperTableManager::endOfRowAction() } IntVectorPtr pCurrentSpans = getCurrentSpans( ); -if( pCurrentSpans->size() < m_nCell) +if( pCurrentSpans->size() < m_nCell.back( ) ) { //fill missing elements with '1' -pCurrentSpans->insert( pCurrentSpans->end( ), m_nCell - pCurrentSpans->size(), 1 ); +pCurrentSpans->insert( pCurrentSpans->end( ), m_nCell.back( ) - pCurrentSpans->size(), 1 ); } #ifdef DEBUG_DOMAINMAPPER @@ -450,15 +452,15 @@ void DomainMapperTableManager::endOfRowAction() double nFullWidth = m_nTableWidth; //the positions have to be distibuted in a range of 1 const double nFullWi
[Libreoffice-commits] .: 2 commits - sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/data/n778828.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx| 17 + writerfilter/source/dmapper/PropertyMap.cxx |5 +++-- 3 files changed, 20 insertions(+), 2 deletions(-) New commits: commit e8a169c93d7e2443a2e56afe7e99cd0721a2c27b Author: Miklos Vajna Date: Wed Sep 19 13:03:43 2012 +0200 n#778828 testcase Change-Id: I38ba0fd4128acfa114eac0b6b6e28ea49c335f0c diff --git a/sw/qa/extras/ooxmlimport/data/n778828.docx b/sw/qa/extras/ooxmlimport/data/n778828.docx new file mode 100644 index 000..ad2e22d Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n778828.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 4d25c9b..e2ab2b0 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -91,6 +91,7 @@ public: void testN777337(); void testN778836(); void testN778140(); +void testN778828(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -124,6 +125,7 @@ public: CPPUNIT_TEST(testN777337); CPPUNIT_TEST(testN778836); CPPUNIT_TEST(testN778140); +CPPUNIT_TEST(testN778828); #endif CPPUNIT_TEST_SUITE_END(); @@ -830,6 +832,21 @@ void Test::testN778140() CPPUNIT_ASSERT_EQUAL(sal_Int32(353), getProperty(getParagraph(0), "ParaBottomMargin")); } +void Test::testN778828() +{ +/* + * The problem was that a page break after a continous section break caused + * double page break on title page. + */ +load("n778828.docx"); + +uno::Reference xModel(mxComponent, uno::UNO_QUERY); +uno::Reference xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY); +uno::Reference xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY); +xCursor->jumpToLastPage(); +CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xCursor->getPage()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); commit 1a60519fcd7706b487ceb7c5e879a81a6109f839 Author: Miklos Vajna Date: Wed Sep 19 12:06:57 2012 +0100 n#778828 fix docx import of continous section break on title page Change-Id: Ib9e9cce5abdcf00c2546f831c8af191da10e1b15 diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index fcb7572..d271299 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -996,8 +996,9 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) uno::Reference xRangeProperties(lcl_GetRangeProperties(m_bIsFirstSection, rDM_Impl, m_xStartingRange)); /* break type 0 - No break 1 - New Colunn 2 - New page 3 - Even page 4 - odd page */ -xRangeProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_PAGE_DESC_NAME ), -uno::makeAny( m_bTitlePage ? m_sFirstPageStyleName : m_sFollowPageStyleName )); +if ((m_bTitlePage && m_bIsFirstSection) || !m_bTitlePage) + xRangeProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_PAGE_DESC_NAME ), +uno::makeAny( m_bTitlePage ? m_sFirstPageStyleName : m_sFollowPageStyleName )); // handle page breaks with odd/even page numbering style::PageStyleLayout nPageStyleLayout(style::PageStyleLayout_ALL); if (m_nBreakType == 3) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: 2 commits - sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/data/n777337.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx| 20 ++-- writerfilter/source/dmapper/PropertyMap.cxx |4 3 files changed, 22 insertions(+), 2 deletions(-) New commits: commit dd11bca8ab191ce10054a5f2de7010ca400eb0b5 Author: Miklos Vajna Date: Thu Aug 30 09:11:58 2012 +0100 n#777337 testcase Also remove the #if 0 I forgot to remove previously. Change-Id: I2cc5e1407c509414c8395d0fd63ab3b379bef04f diff --git a/sw/qa/extras/ooxmlimport/data/n777337.docx b/sw/qa/extras/ooxmlimport/data/n777337.docx new file mode 100644 index 000..8bb377d Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n777337.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 00e36b8..ec61993 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -88,10 +88,10 @@ public: void testN775906(); void testN775899(); void testN777345(); +void testN777337(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) -#if 0 CPPUNIT_TEST(testN751054); CPPUNIT_TEST(testN751117); CPPUNIT_TEST(testN751017); @@ -118,8 +118,8 @@ public: CPPUNIT_TEST(testAllGapsWord); CPPUNIT_TEST(testN775906); CPPUNIT_TEST(testN775899); -#endif CPPUNIT_TEST(testN777345); +CPPUNIT_TEST(testN777337); #endif CPPUNIT_TEST_SUITE_END(); @@ -785,6 +785,22 @@ void Test::testN777345() CPPUNIT_ASSERT_EQUAL(sal_uLong(2404338915U), aGraphic.GetChecksum()); } +void Test::testN777337() +{ +/* + * The problem was that the top and bottom margin on the first page was only 0.1cm instead of 1.7cm. + * + * oFirst = ThisComponent.StyleFamilies.PageStyles.getByName("First Page") + * xray oFirst.TopMargin + * xray oFirst.BottomMargin + */ +load("n777337.docx"); + +uno::Reference xPropertySet(getStyles("PageStyles")->getByName("First Page"), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(sal_Int32(1702), getProperty(xPropertySet, "TopMargin")); +CPPUNIT_ASSERT_EQUAL(sal_Int32(1702), getProperty(xPropertySet, "BottomMargin")); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); commit a474559ff1e560b83952f00595dbd8ae7fde88b6 Author: Miklos Vajna Date: Thu Aug 30 09:11:17 2012 +0100 n#777337 fix DOCX import of title page top/bottom margin with headers/footers SectionPropertyMap::PrepareHeaderFooterProperties() already backed up m_nTopMargin to have the same result when that method is called multiple times. Do the same for the header footer height values as well to match the WW8 behaviour. Change-Id: Ib2347abc3db39308900c7721c0e15de040d9a01f diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index 70bb53b..aceba89 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -712,6 +712,7 @@ void SectionPropertyMap::CopyLastHeaderFooter( bool bFirstPage, DomainMapper_Imp void SectionPropertyMap::PrepareHeaderFooterProperties( bool bFirstPage ) { sal_Int32 nTopMargin = m_nTopMargin; +sal_Int32 nHeaderTop = m_nHeaderTop; if(HasHeader(bFirstPage)) { m_nTopMargin = m_nHeaderTop; @@ -745,6 +746,7 @@ void SectionPropertyMap::PrepareHeaderFooterProperties( bool bFirstPage ) } sal_Int32 nBottomMargin = m_nBottomMargin; +sal_Int32 nHeaderBottom = m_nHeaderBottom; if( HasFooter( bFirstPage ) ) { m_nBottomMargin = m_nHeaderBottom; @@ -779,6 +781,8 @@ void SectionPropertyMap::PrepareHeaderFooterProperties( bool bFirstPage ) // Restore original top margin, so we don't end up with a smaller margin in case we have to produce two page styles from one Word section. m_nTopMargin = nTopMargin; +m_nHeaderTop = nHeaderTop; +m_nHeaderBottom = nHeaderBottom; } uno::Reference lcl_GetRangeProperties(bool bIsFirstSection, DomainMapper_Impl& rDM_Impl, uno::Reference xStartingRange) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: 2 commits - sw/qa writerfilter/source
sw/qa/extras/rtfimport/data/fdo52052.rtf | 23 +++ sw/qa/extras/rtfimport/rtfimport.cxx |9 sw/qa/extras/swmodeltestbase.hxx | 15 +-- writerfilter/source/rtftok/rtfdocumentimpl.cxx | 51 ++--- writerfilter/source/rtftok/rtfdocumentimpl.hxx |3 + 5 files changed, 92 insertions(+), 9 deletions(-) New commits: commit 1efa576ef88141c4deb5da9818537e053dc6517b Author: Miklos Vajna Date: Tue Aug 28 11:21:50 2012 +0200 fdo#52052 fix RTF import of page breaks on landscape pages The problem was that we tried to insert a page break before reaching the first section break, where section properties are sent. Additionally, the continuous section break at the end of the doc caused trouble, so ignore it explicitly. Change-Id: I22bc355994991beeadb41d26b44ce3e2beedbdb2 diff --git a/sw/qa/extras/rtfimport/data/fdo52052.rtf b/sw/qa/extras/rtfimport/data/fdo52052.rtf new file mode 100644 index 000..329762e --- /dev/null +++ b/sw/qa/extras/rtfimport/data/fdo52052.rtf @@ -0,0 +1,23 @@ +{\rtf1\ansi\ansicpg1251\deff0\deflang1033 +{\fonttbl +{\f0\fswiss\fcharset204 Arial;} +} +{\colortbl;\red0\green0\blue0;} +{\info +{\title } +{\author Crystal Reports} +{\doccomm Powered By Crystal} +{\company Crystal Decisions} +} +\landscape\paperw16836\paperh11904\margl567\margr397\margt567\margb284\gutter0\windowctrl\ftnbj\viewkind1\viewscale100\sectd\linex0\sbknone +{\pard first +\par } +\page\sect +{\pard \pvpg\phpg\posx13152\posy612\absw2984\absh-210\fi0 \ltrpar\qr\tx360\tx720\tx1080\tx1440\tx1800\tx2160\tx2520\tx2880 +{\ltrch\f0 \b\i0\ul0\strike0\fs15 \cf1 second} +\par } +\page\sect +{\pard \pvpg\phpg\posx13152\posy612\absw2984\absh-210\fi0 \ltrpar\qr\tx360\tx720\tx1080\tx1440\tx1800\tx2160\tx2520\tx2880 +{\ltrch\f0 \b\i0\ul0\strike0\fs15 \cf1 third} +\par } +\sect } diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 219acbe..918e7a5 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -106,6 +106,7 @@ public: void testFdo48446(); void testFdo47495(); void testAllGapsWord(); +void testFdo52052(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -153,6 +154,7 @@ public: CPPUNIT_TEST(testFdo48446); CPPUNIT_TEST(testFdo47495); CPPUNIT_TEST(testAllGapsWord); +CPPUNIT_TEST(testFdo52052); #endif CPPUNIT_TEST_SUITE_END(); @@ -915,6 +917,13 @@ void Test::testAllGapsWord() borderTest.testTheBorders(mxComponent); } +void Test::testFdo52052() +{ +load("fdo52052.rtf"); +// Make sure the textframe containing the text "third" appears on the 3rd page. +CPPUNIT_ASSERT_EQUAL(OUString("third"), parseDump("/root/page[3]/body/txt/anchored/fly/txt/text()")); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 8120540..330c34d 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -270,7 +270,8 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Reference const& x m_bFormField(false), m_bIsInFrame(false), m_aUnicodeBuffer(), -m_aHexBuffer() +m_aHexBuffer(), +m_bDeferredContSectBreak(false) { OSL_ASSERT(xInputStream.is()); m_pInStream.reset(utl::UcbStreamHelper::CreateStream(xInputStream, sal_True)); @@ -1093,6 +1094,7 @@ void RTFDocumentImpl::replayBuffer(RTFBuffer_t& rBuffer) int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) { checkUnicode(); +checkDeferredContSectBreak(); RTFSkipDestination aSkip(*this); switch (nKeyword) { @@ -1516,6 +1518,7 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) { if (nKeyword != RTF_HEXCHAR) checkUnicode(); +checkDeferredContSectBreak(); RTFSkipDestination aSkip(*this); sal_uInt8 cCh = 0; @@ -1572,7 +1575,17 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) } break; case RTF_SECT: -sectBreak(); +{ +RTFValue::Pointer_t pBreak = m_aStates.top().aSectionSprms.find(NS_sprm::LN_SBkc); +if (pBreak.get() && !pBreak->getInt()) +{ +// This is a continous section break, don't send it yet. +// It's possible that we'll have nothing after this token, and then we should ignore it. +m_bDeferredContSectBreak = true; +} +else +sectBreak(); +} break; case RTF_NOBREAK: { @@ -1693,10 +1706,21 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) break; case RTF_PAGE: { -sal_uInt8 sBreak[] = { 0xc };
[Libreoffice-commits] .: 2 commits - sw/qa writerfilter/source
dev/null |binary sw/qa/extras/odfimport/data/fdo53210.odt |binary sw/qa/extras/odfimport/odfimport.cxx | 23 +++ writerfilter/source/rtftok/rtfdocumentimpl.cxx |5 - writerfilter/source/rtftok/rtfdocumentimpl.hxx |3 +-- writerfilter/source/rtftok/rtftokenizer.cxx|4 ++-- 6 files changed, 18 insertions(+), 17 deletions(-) New commits: commit 10e02dfdffb5ef3a02a40b52c6cda176f7f4447c Author: Miklos Vajna Date: Mon Aug 13 10:59:26 2012 +0200 fdo#53210 testcase Change-Id: I23606a7601b71890acf7e260951e1bacc0fc2df9 diff --git a/sw/qa/extras/odfimport/data/fdo53210.odt b/sw/qa/extras/odfimport/data/fdo53210.odt new file mode 100644 index 000..cfa5044 Binary files /dev/null and b/sw/qa/extras/odfimport/data/fdo53210.odt differ diff --git a/sw/qa/extras/odfimport/data/hello.odt b/sw/qa/extras/odfimport/data/hello.odt deleted file mode 100644 index 23ce6a4..000 Binary files a/sw/qa/extras/odfimport/data/hello.odt and /dev/null differ diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index d473893..ef51e31 100644 --- a/sw/qa/extras/odfimport/odfimport.cxx +++ b/sw/qa/extras/odfimport/odfimport.cxx @@ -32,13 +32,13 @@ using rtl::OUString; class Test : public SwModelTestBase { public: -void testHello(); void testEmptySvgFamilyName(); +void testHideAllSections(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) -CPPUNIT_TEST(testHello); CPPUNIT_TEST(testEmptySvgFamilyName); +CPPUNIT_TEST(testHideAllSections); #endif CPPUNIT_TEST_SUITE_END(); @@ -52,18 +52,25 @@ void Test::load(const OUString& rFilename) mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/odfimport/data/") + rFilename); } -void Test::testHello() -{ -load("hello.odt"); -CPPUNIT_ASSERT_EQUAL(12, getLength()); -} - void Test::testEmptySvgFamilyName() { // .odt import did crash on the empty font list (which I think is valid according SVG spec) load( "empty-svg-family-name.odt" ); } +void Test::testHideAllSections() +{ +// This document has a section that is conditionally hidden, but has no empty paragraph after it. +load("fdo53210.odt"); +uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xMasters = xTextFieldsSupplier->getTextFieldMasters(); +// Set _CS_Allgemein to 0 +uno::Reference xMaster(xMasters->getByName("com.sun.star.text.fieldmaster.User._CS_Allgemein"), uno::UNO_QUERY); +xMaster->setPropertyValue("Content", uno::makeAny(OUString("0"))); +// This used to crash +uno::Reference(xTextFieldsSupplier->getTextFields(), uno::UNO_QUERY)->refresh(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); commit 7b87ccf916547b4d59d0e892519600a2bf53b867 Author: Miklos Vajna Date: Mon Aug 13 10:45:42 2012 +0200 drop unnecessary RTFDocumentImpl::isEmpty Change-Id: I657266697c30be0760971528adb1abf07f03ea23 diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index adfb18c..2d66ed3 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -3902,11 +3902,6 @@ int RTFDocumentImpl::getGroup() const return m_nGroup; } -bool RTFDocumentImpl::isEmpty() const -{ -return m_aStates.empty(); -} - void RTFDocumentImpl::setDestinationText(OUString& rString) { m_aStates.top().aDestinationText.setLength(0); diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx index c05a0f5..0759a4c 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -424,8 +424,7 @@ namespace writerfilter { void seek(sal_uInt32 nPos); uno::Reference getModelFactory(); RTFParserState& getState(); -/// If the stack of states is empty. -bool isEmpty() const; +/// Number of states on the stack. int getGroup() const; void setDestinationText(rtl::OUString& rString); /// Resolve a picture: If not inline, then anchored. diff --git a/writerfilter/source/rtftok/rtftokenizer.cxx b/writerfilter/source/rtftok/rtftokenizer.cxx index e596aae..abe8cff 100644 --- a/writerfilter/source/rtftok/rtftokenizer.cxx +++ b/writerfilter/source/rtftok/rtftokenizer.cxx @@ -95,7 +95,7 @@ int RTFTokenizer::resolveParse() if (m_rImport.getGroup() < 0) return ERROR_GROUP_UNDER; -if (!m_rImport.isEmpty() && m_rImport.getState().nInternalState == INTERNAL_BIN) +if (m_rImport.getGroup() > 0 && m_rImport.getState().nInternalState == INTERNAL_BIN) { ret = m_rImport.resolveChars(ch); if (ret) @@ -130,7 +
[Libreoffice-commits] .: 2 commits - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/fdo51034.odt|binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx |9 + writerfilter/source/dmapper/DomainMapper_Impl.cxx |2 +- 3 files changed, 10 insertions(+), 1 deletion(-) New commits: commit 6ff70708b4a39011a61aa0f53541eb7eec09c813 Author: Miklos Vajna Date: Thu Aug 2 10:57:07 2012 +0200 fdo#51034 testcase Change-Id: I9a7a4e596ffb14cdcb211ff0d905c66831d30708 diff --git a/sw/qa/extras/ooxmlexport/data/fdo51034.odt b/sw/qa/extras/ooxmlexport/data/fdo51034.odt new file mode 100644 index 000..9720cfb Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo51034.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 02f66a2..020bffd 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -42,6 +42,7 @@ public: void defaultTabStopNotInStyles(); void testFdo38244(); void testMathEscape(); +void testFdo51034(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -52,6 +53,7 @@ public: #if !(__GNUC__ == 4 && __GNUC_MINOR__ == 4) CPPUNIT_TEST(testMathEscape); #endif +CPPUNIT_TEST(testFdo51034); #endif CPPUNIT_TEST_SUITE_END(); @@ -170,6 +172,13 @@ void Test::testMathEscape() CPPUNIT_ASSERT_EQUAL(OUString("\\{ left [ right ] left ( right ) \\}"), getFormula(getRun(getParagraph(1), 1))); } +void Test::testFdo51034() +{ +// The problem was that the 'l' param of the HYPERLINK field was parsed with = "#", not += "#". +roundtrip("fdo51034.odt"); +CPPUNIT_ASSERT_EQUAL(OUString("http://Www.google.com/#a";), getProperty(getRun(getParagraph(1), 1), "HyperLinkURL")); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); commit 9c53a7f94f3bdcb694498db335a01af25257853a Author: Miklos Vajna Date: Thu Aug 2 10:49:02 2012 +0200 fdo#51034 fix docx import of HYPERLINK field, l param Change-Id: Ic6896f7c795d7d303bf7589a74afb937d4a8e8b5 diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index ebee085..164a2d4 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -2871,7 +2871,7 @@ void DomainMapper_Impl::CloseFieldCommand() if (aPartIt == aItEnd) break; -sURL = OUString('#'); +sURL += OUString('#'); sURL += *aPartIt; } else if ( *aPartIt == "\\m" || *aPartIt == "\\n" ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: 2 commits - sw/qa vcl/generic
sw/qa/extras/swmodeltestbase.hxx |4 ++-- vcl/generic/glyphs/gcach_ftyp.cxx | 11 +++ 2 files changed, 9 insertions(+), 6 deletions(-) New commits: commit 9b3348597520781497082a09b1ff8fb4a8709463 Author: Caolán McNamara Date: Sat Jul 14 14:07:08 2012 +0100 WaE: possibly uninitialized values Change-Id: Ic4d21f9a2a3389d915620331463d32f27101fd77 diff --git a/sw/qa/extras/swmodeltestbase.hxx b/sw/qa/extras/swmodeltestbase.hxx index 8792eb3..39e41da 100644 --- a/sw/qa/extras/swmodeltestbase.hxx +++ b/sw/qa/extras/swmodeltestbase.hxx @@ -147,7 +147,7 @@ protected: T getProperty( uno::Any obj, const rtl::OUString& name ) const { uno::Reference< beans::XPropertySet > properties( obj, uno::UNO_QUERY ); -T data; +T data = T(); properties->getPropertyValue( name ) >>= data; return data; } @@ -156,7 +156,7 @@ protected: T getProperty( uno::Reference< uno::XInterface > obj, const rtl::OUString& name ) const { uno::Reference< beans::XPropertySet > properties( obj, uno::UNO_QUERY ); -T data; +T data = T(); properties->getPropertyValue( name ) >>= data; return data; } commit 50d0b31d330b3eb245e96d9950328261e89e00cd Author: Caolán McNamara Date: Sat Jul 14 14:03:56 2012 +0100 Related: fdo#31821 pull tables from otf fonts as well Change-Id: If3bd4ac640aaf6b68fa4ae2a363f691601ff942b diff --git a/vcl/generic/glyphs/gcach_ftyp.cxx b/vcl/generic/glyphs/gcach_ftyp.cxx index 9da8993..d186aef 100644 --- a/vcl/generic/glyphs/gcach_ftyp.cxx +++ b/vcl/generic/glyphs/gcach_ftyp.cxx @@ -449,7 +449,9 @@ static unsigned GetUInt( const unsigned char* p ) { return((p[0]<<24)+(p[1]<<16) static unsigned GetUShort( const unsigned char* p ){ return((p[0]<<8)+p[1]);} //static signed GetSShort( const unsigned char* p ){ return((short)((p[0]<<8)+p[1]));} -// --- +static const sal_uInt32 T_true = 0x74727565;/* 'true' */ +static const sal_uInt32 T_ttcf = 0x74746366;/* 'ttcf' */ +static const sal_uInt32 T_otto = 0x4f54544f;/* 'OTTO' */ const unsigned char* FtFontInfo::GetTable( const char* pTag, sal_uLong* pLength ) const { @@ -458,12 +460,13 @@ const unsigned char* FtFontInfo::GetTable( const char* pTag, sal_uLong* pLength if( !pBuffer || nFileSize<1024 ) return NULL; -// we currently only handle TTF and TTC headers +// we currently handle TTF, TTC and OTF headers unsigned nFormat = GetUInt( pBuffer ); + const unsigned char* p = pBuffer + 12; -if( nFormat == 0x74746366 ) // TTC_MAGIC +if( nFormat == T_ttcf ) // TTC_MAGIC p += GetUInt( p + 4 * mnFaceNum ); -else if( (nFormat!=0x0001) && (nFormat!=0x74727565) )// TTF_MAGIC and Apple TTF Magic +else if( nFormat != 0x0001 && nFormat != T_true && nFormat != T_otto) // TTF_MAGIC and Apple TTF Magic and PS-OpenType font return NULL; // walk table directory until match ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: 2 commits - sw/qa
sw/qa/extras/README | 19 +++ sw/qa/extras/ooxmlexport/ooxmlexport.cxx |4 - sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 75 +-- sw/qa/extras/swmodeltestbase.hxx | 35 ++ sw/qa/extras/ww8export/ww8export.cxx |3 - 5 files changed, 61 insertions(+), 75 deletions(-) New commits: commit 76fd08ed822e791c812dd674265d977a4b3c59bb Author: LuboÅ¡ LuÅák Date: Fri Jul 13 20:18:52 2012 +0200 getParagraph helper Change-Id: I8170f95e01b98db2fe79070dacfd7436e37019a2 diff --git a/sw/qa/extras/README b/sw/qa/extras/README index b65a2b0..75d45bb 100644 --- a/sw/qa/extras/README +++ b/sw/qa/extras/README @@ -159,6 +159,11 @@ uno::Reference paraEnum = paraEnumAccess->createEnumera // get the 2nd paragraph uno::Reference paragraph(paraEnum->nextElement(), uno::UNO_QUERY); +Note that for paragraphs it's easier to use getParagraph(), which gets the given +paragraph (counted from 1) and optionally checks the paragraph text. + +uno::Reference< text::XTextRange > paragraph = getParagraph( 2, "TEXT" ) + === XNamedAccess (e.g. get a bookmark named 'position1'): Basic: diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index fab93b1..cfbd45f 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -269,22 +269,10 @@ para = enum.NextElement xray para.String xray para.PageStyleName */ -uno::Reference textDocument(mxComponent, uno::UNO_QUERY); -uno::Reference paraEnumAccess(textDocument->getText(), uno::UNO_QUERY); -// list of paragraphs -uno::Reference paraEnum = paraEnumAccess->createEnumeration(); -// go to 1st paragraph -(void) paraEnum->nextElement(); -// get the 2nd paragraph -uno::Reference paragraph(paraEnum->nextElement(), uno::UNO_QUERY); -// text of the paragraph -uno::Reference text(paragraph, uno::UNO_QUERY); -CPPUNIT_ASSERT_EQUAL( OUString( "TEXT1" ), text->getString()); +uno::Reference paragraph = getParagraph( 2, "TEXT1" ); // we want to test the paragraph is on the first page (it was put onto another page without the fix), // use a small trick and instead of checking the page layout, check the page style -uno::Reference paragraphProperties(paragraph, uno::UNO_QUERY); -OUString pageStyle; -paragraphProperties->getPropertyValue( "PageStyleName" ) >>= pageStyle; +OUString pageStyle = getProperty< OUString >( paragraph, "PageStyleName" ); CPPUNIT_ASSERT_EQUAL( OUString( "First Page" ), pageStyle ); } @@ -385,24 +373,11 @@ para2 = enum.nextElement xray para2.String xray para2.PageStyleName */ -uno::Reference textDocument(mxComponent, uno::UNO_QUERY); -uno::Reference paraEnumAccess(textDocument->getText(), uno::UNO_QUERY); -// list of paragraphs -uno::Reference paraEnum = paraEnumAccess->createEnumeration(); -// go to 1st paragraph -(void) paraEnum->nextElement(); // get the 2nd and 3rd paragraph -uno::Reference paragraph1(paraEnum->nextElement(), uno::UNO_QUERY); -uno::Reference paragraph2(paraEnum->nextElement(), uno::UNO_QUERY); -uno::Reference text1(paragraph1, uno::UNO_QUERY); -uno::Reference text2(paragraph2, uno::UNO_QUERY); -CPPUNIT_ASSERT_EQUAL( OUString( "one" ), text1->getString()); -CPPUNIT_ASSERT_EQUAL( OUString( "two" ), text2->getString()); -uno::Reference paragraphProperties1(paragraph1, uno::UNO_QUERY); -uno::Reference paragraphProperties2(paragraph2, uno::UNO_QUERY); -OUString pageStyle1, pageStyle2; -paragraphProperties1->getPropertyValue( "PageStyleName" ) >>= pageStyle1; -paragraphProperties2->getPropertyValue( "PageStyleName" ) >>= pageStyle2; +uno::Reference paragraph1 = getParagraph( 2, "one" ); +uno::Reference paragraph2 = getParagraph( 3, "two" ); +OUString pageStyle1 = getProperty< OUString >( paragraph1, "PageStyleName" ); +OUString pageStyle2 = getProperty< OUString >( paragraph2, "PageStyleName" ); CPPUNIT_ASSERT_EQUAL( OUString( "Converted1" ), pageStyle1 ); CPPUNIT_ASSERT_EQUAL( OUString( "Converted2" ), pageStyle2 ); @@ -424,24 +399,11 @@ para2 = enum.nextElement xray para2.String xray para2.PageStyleName */ -uno::Reference textDocument(mxComponent, uno::UNO_QUERY); -uno::Reference paraEnumAccess(textDocument->getText(), uno::UNO_QUERY); -// list of paragraphs -uno::Reference paraEnum = paraEnumAccess->createEnumeration(); // get the 2nd and 4th paragraph -(void) paraEnum->nextElement(); -uno::Reference paragraph1(paraEnum->nextElement(), uno::UNO_QUERY); -(void) paraEnum->nextElement(); -uno::Reference paragraph2(paraEnum->nextElement(), uno::UNO_QUERY); -uno::Reference text1(paragraph1, uno::UNO_QUERY); -uno::Reference text2(paragraph2, uno::UNO_QUERY); -CPPUNIT_ASSERT_EQUAL( OUString( "text1" ), text1->getString()); -
[Libreoffice-commits] .: 2 commits - sw/qa writerfilter/source
sw/qa/extras/ooxmltok/data/n766481.docx |binary sw/qa/extras/ooxmltok/ooxmltok.cxx| 21 ++ writerfilter/source/dmapper/DomainMapper.cxx | 11 +++ writerfilter/source/dmapper/DomainMapper_Impl.cxx | 31 ++ writerfilter/source/dmapper/DomainMapper_Impl.hxx | 10 +++ writerfilter/source/dmapper/PropertyMap.cxx |1 6 files changed, 74 insertions(+) New commits: commit 0eb3a0f2fa66e67f21035c5c14a41d2d6fb4b345 Author: Miklos Vajna Date: Mon Jun 25 16:01:37 2012 +0200 n#766481 testcase Change-Id: I0ebcb5c35f2e255da593c62b0a98cd4e0f44ba99 diff --git a/sw/qa/extras/ooxmltok/data/n766481.docx b/sw/qa/extras/ooxmltok/data/n766481.docx new file mode 100644 index 000..e1521ec Binary files /dev/null and b/sw/qa/extras/ooxmltok/data/n766481.docx differ diff --git a/sw/qa/extras/ooxmltok/ooxmltok.cxx b/sw/qa/extras/ooxmltok/ooxmltok.cxx index 4cd2aa3..1d1bbb1 100644 --- a/sw/qa/extras/ooxmltok/ooxmltok.cxx +++ b/sw/qa/extras/ooxmltok/ooxmltok.cxx @@ -71,6 +71,7 @@ public: void testN764745(); void testN766477(); void testN758883(); +void testN766481(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -92,6 +93,7 @@ public: CPPUNIT_TEST(testN764745); CPPUNIT_TEST(testN766477); CPPUNIT_TEST(testN758883); +CPPUNIT_TEST(testN766481); #endif CPPUNIT_TEST_SUITE_END(); @@ -605,6 +607,25 @@ void Test::testN758883() CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, eAnchorType); } +void Test::testN766481() +{ +/* + * The problem was that we had an additional paragraph before the pagebreak. + * + * oParas = ThisComponent.Text.createEnumeration + * oPara = oParas.nextElement + * oPara = oParas.nextElement + * xray oParas.hasMoreElements ' should be false + */ +load("n766481.docx"); +uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); +uno::Reference xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY); +uno::Reference xParaEnum(xParaEnumAccess->createEnumeration()); +for (int i = 0; i < 2; ++i) +xParaEnum->nextElement(); +CPPUNIT_ASSERT_EQUAL(sal_False, xParaEnum->hasMoreElements()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); commit b696600821d8aafb63b6a88016d299ef89478f56 Author: Miklos Vajna Date: Mon Jun 25 15:58:11 2012 +0200 n#766481 dmapper: don't import fake paragraph containing sectpr only, take two Change-Id: I4623dfd05498b5ba8de73b7e301eaf486f667738 diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index f51ce3f..c11935d 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -2795,6 +2795,8 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType case NS_ooxml::LN_CT_Style_rPr: case NS_ooxml::LN_CT_PPr_rPr: case NS_ooxml::LN_CT_PPrBase_numPr: +if (nSprmId == NS_ooxml::LN_CT_PPr_sectPr) +m_pImpl->SetParaSectpr(true); resolveSprmProps(*this, rSprm); break; case NS_ooxml::LN_EG_SectPrContents_footnotePr: @@ -3396,7 +3398,16 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len) // RTF always uses text() instead of utext() for run break if(len == 1 && ((*data_) == 0x0d || (*data_) == 0x07) && !IsRTFImport()) +{ +bool bSingleParagraph = m_pImpl->GetIsFirstParagraphInSection() && m_pImpl->GetIsLastParagraphInSection(); +// If the paragraph contains only the section properties and it has +// no runs, we should not create a paragraph for it in Writer, unless that would remove the whole section. +bool bRemove = !m_pImpl->GetParaChanged() && m_pImpl->GetParaSectpr() && !bSingleParagraph; +m_pImpl->SetParaSectpr(false); m_pImpl->finishParagraph(m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH)); +if (bRemove) +m_pImpl->RemoveLastParagraph(); +} else { diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 8e6d2c6..776aaba 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -206,7 +206,9 @@ DomainMapper_Impl::DomainMapper_Impl( m_bIsCustomFtnMark( false ), m_bIsParaChange( false ), m_bParaChanged( false ), +m_bIsFirstParaInSection( true ), m_bIsLastParaInSection( false ), +m_bParaSectpr( false ), m_bUsingEnhancedFields( false ) { appendTableManager( ); @@ -307,7 +309,35 @@ void DomainMapper_Impl::SetIsLastParagraphInSection( bool bIsLast ) m_bIsLastParaInSection = bIsLast; } +bool DomainMapper_Impl::GetIsLastParagraphInSection(
[Libreoffice-commits] .: 2 commits - sw/qa writerfilter/source
sw/qa/extras/ooxmltok/ooxmltok.cxx| 13 + sw/qa/extras/rtftok/rtftok.cxx| 10 -- sw/qa/extras/swmodeltestbase.hxx | 10 ++ writerfilter/source/dmapper/DomainMapper_Impl.cxx |4 ++-- writerfilter/source/dmapper/SettingsTable.cxx | 10 ++ writerfilter/source/dmapper/SettingsTable.hxx |2 ++ 6 files changed, 37 insertions(+), 12 deletions(-) New commits: commit 7193d4ef0d61d82fe2138b4736f27b6d27fc8e0a Author: Miklos Vajna Date: Fri Jun 15 15:09:53 2012 +0200 n#750935 fix docx import of w:evenAndOddHeaders Change-Id: I172073bac10e8d0449c0f5c0a226dd7ace013376 diff --git a/sw/qa/extras/ooxmltok/ooxmltok.cxx b/sw/qa/extras/ooxmltok/ooxmltok.cxx index 5026530..3afb8b7 100644 --- a/sw/qa/extras/ooxmltok/ooxmltok.cxx +++ b/sw/qa/extras/ooxmltok/ooxmltok.cxx @@ -193,7 +193,20 @@ void Test::testN750935() uno::Reference xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY); uno::Reference xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY); xCursor->jumpToLastPage(); +// Some page break types were ignores, resulting in less pages. CPPUNIT_ASSERT_EQUAL(sal_Int16(5), xCursor->getPage()); + +/* + * The problem was that the header and footer was not shared. + * + * xray ThisComponent.StyleFamilies.PageStyles.Default.FooterIsShared + */ +uno::Reference xPropertySet(getStyles("PageStyles")->getByName("Default"), uno::UNO_QUERY); +sal_Bool bValue = false; +xPropertySet->getPropertyValue("HeaderIsShared") >>= bValue; +CPPUNIT_ASSERT_EQUAL(sal_Bool(true), bValue); +xPropertySet->getPropertyValue("FooterIsShared") >>= bValue; +CPPUNIT_ASSERT_EQUAL(sal_Bool(true), bValue); } void Test::testN757890() diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index bda064d..1dcb7f5 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1271,7 +1271,7 @@ void DomainMapper_Impl::PushPageHeader(SectionPropertyMap::PageType eType) uno::makeAny(sal_True) ); // if a left header is available then header are not shared bool bLeft = eType == SectionPropertyMap::PAGE_LEFT; -if( bLeft ) +if( bLeft && m_pSettingsTable->GetEvenAndOddHeaders()) xPageStyle->setPropertyValue(rPropNameSupplier.GetName(PROP_HEADER_IS_SHARED), uno::makeAny( false )); //set the interface @@ -1310,7 +1310,7 @@ void DomainMapper_Impl::PushPageFooter(SectionPropertyMap::PageType eType) uno::makeAny(sal_True) ); // if a left header is available then footer is not shared bool bLeft = eType == SectionPropertyMap::PAGE_LEFT; -if( bLeft ) +if( bLeft && m_pSettingsTable->GetEvenAndOddHeaders()) xPageStyle->setPropertyValue(rPropNameSupplier.GetName(PROP_FOOTER_IS_SHARED), uno::makeAny( false )); //set the interface uno::Reference< text::XText > xFooterText; diff --git a/writerfilter/source/dmapper/SettingsTable.cxx b/writerfilter/source/dmapper/SettingsTable.cxx index ab89c6a..2a69cc6 100644 --- a/writerfilter/source/dmapper/SettingsTable.cxx +++ b/writerfilter/source/dmapper/SettingsTable.cxx @@ -76,6 +76,7 @@ struct SettingsTable_Impl ::rtl::OUString m_sSalt; boolm_bLinkStyles; sal_Int16 m_nZoomFactor; +boolm_bEvenAndOddHeaders; SettingsTable_Impl( DomainMapper& rDMapper, const uno::Reference< lang::XMultiServiceFactory > xTextFactory ) : m_rDMapper( rDMapper ) @@ -94,6 +95,7 @@ struct SettingsTable_Impl , m_nCryptSpinCount(0) , m_bLinkStyles(false) , m_nZoomFactor(0) +, m_bEvenAndOddHeaders(false) {} }; @@ -165,6 +167,9 @@ void SettingsTable::lcl_sprm(Sprm& rSprm) case NS_ooxml::LN_CT_Settings_linkStyles: // 92663; m_pImpl->m_bLinkStyles = nIntValue; break; +case NS_ooxml::LN_CT_Settings_evenAndOddHeaders: +m_pImpl->m_bEvenAndOddHeaders = nIntValue; +break; case NS_ooxml::LN_CT_Settings_noPunctuationKerning: // 92526; m_pImpl->m_bNoPunctuationKerning = nIntValue ? true : false; break; @@ -230,6 +235,11 @@ sal_Int16 SettingsTable::GetZoomFactor() const return m_pImpl->m_nZoomFactor; } +bool SettingsTable::GetEvenAndOddHeaders() const +{ +return m_pImpl->m_bEvenAndOddHeaders; +} + void SettingsTable::ApplyProperties( uno::Reference< text::XTextDocument > xDoc ) { uno::Reference< beans::XPropertySet> xDocProps( xDoc, uno::UNO_QUERY ); diff --git a/writerfilter/source/dmapper/SettingsTable.hxx b/writerfilter/source/dmapper/SettingsTable.hxx index 3d9a560..2c43ec6 100644 --- a/writerfilter/source/dmapper/SettingsTable.hxx +++ b/writer
[Libreoffice-commits] .: 2 commits - sw/qa
sw/qa/extras/README | 20 sw/qa/extras/ooxmltok/data/n705956-1.docx |binary sw/qa/extras/ooxmltok/ooxmltok.cxx| 25 + 3 files changed, 45 insertions(+) New commits: commit 1472935fd74c289717cd7783d99bc99d82d7866d Author: LuboÅ¡ LuÅák Date: Fri May 18 19:18:02 2012 +0200 note how to find images using UNO, as it's not exactly easy to find out Change-Id: If5440cae646a56fef4c054774705689e5512b8e4 diff --git a/sw/qa/extras/README b/sw/qa/extras/README index eb25955..49dc9aa 100644 --- a/sw/qa/extras/README +++ b/sw/qa/extras/README @@ -198,3 +198,23 @@ uno::Reference bookmarks(bookmarksSupplier->getBookmark uno::Reference bookmark; // get the bookmark by index bookmarks->getByIndex(0) >>= bookmark; + +=== Images + +Embedded images seem to be accessed like this: + +Basic: + +image = ThisComponent.DrawPage.getByIndex(0) +graphic = image.Graphic + +C++: + +uno::Reference textDocument(mxComponent, uno::UNO_QUERY); +uno::Reference drawPageSupplier(textDocument, uno::UNO_QUERY); +uno::Reference drawPage = drawPageSupplier->getDrawPage(); +uno::Reference image; +drawPage->getByIndex(0) >>= image; +uno::Reference imageProperties(image, uno::UNO_QUERY); +uno::Reference graphic; +imageProperties->getPropertyValue( "Graphic" ) >>= graphic; commit a28f5713a7e91b5d99cc0e63470db1512b997320 Author: LuboÅ¡ LuÅák Date: Fri May 18 19:10:12 2012 +0200 testcase for part of bnc#705956 60cb70b94537e9ff1155fb80255fc04ce41363b2 specifically Change-Id: I160b24505d3e2425ce807f92f80d6737b725941b diff --git a/sw/qa/extras/ooxmltok/data/n705956-1.docx b/sw/qa/extras/ooxmltok/data/n705956-1.docx new file mode 100644 index 000..edff3ba Binary files /dev/null and b/sw/qa/extras/ooxmltok/data/n705956-1.docx differ diff --git a/sw/qa/extras/ooxmltok/ooxmltok.cxx b/sw/qa/extras/ooxmltok/ooxmltok.cxx index 896b9fd..1238192 100644 --- a/sw/qa/extras/ooxmltok/ooxmltok.cxx +++ b/sw/qa/extras/ooxmltok/ooxmltok.cxx @@ -27,6 +27,7 @@ #include "../swmodeltestbase.hxx" +#include #include #include #include @@ -55,6 +56,7 @@ public: void testN757890(); void testFdo49940(); void testN751077(); +void testN705956(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -65,6 +67,7 @@ public: CPPUNIT_TEST(testN757890); CPPUNIT_TEST(testFdo49940); CPPUNIT_TEST(testN751077); +CPPUNIT_TEST(testN705956); #endif CPPUNIT_TEST_SUITE_END(); @@ -238,6 +241,28 @@ xray para.PageStyleName CPPUNIT_ASSERT_EQUAL( OUString( "First Page" ), value ); } +void Test::testN705956() +{ +load( "n705956-1.docx" ); +/* +Get the first image in the document and check it's the one image in the document. +image = ThisComponent.DrawPage.getByIndex(0) +graphic = image.Graphic +xray graphic.Size +*/ +uno::Reference textDocument(mxComponent, uno::UNO_QUERY); +uno::Reference drawPageSupplier(textDocument, uno::UNO_QUERY); +uno::Reference drawPage = drawPageSupplier->getDrawPage(); +uno::Reference image; +drawPage->getByIndex(0) >>= image; +uno::Reference imageProperties(image, uno::UNO_QUERY); +uno::Reference graphic; +imageProperties->getPropertyValue( "Graphic" ) >>= graphic; +uno::Reference bitmap(graphic, uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL( 120, bitmap->getSize().Width ); +CPPUNIT_ASSERT_EQUAL( 106, bitmap->getSize().Height ); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: 2 commits - sw/qa
sw/qa/extras/ooxmltok/data/fdo49940.docx |binary sw/qa/extras/ooxmltok/ooxmltok.cxx | 15 +++ sw/qa/extras/ww8tok/data/n760294.doc |binary sw/qa/extras/ww8tok/ww8tok.cxx | 17 + 4 files changed, 32 insertions(+) New commits: commit 163e136650adba01382ec47e017d4b426aa49112 Author: Miklos Vajna Date: Tue May 15 10:36:53 2012 +0200 fdo#49940 testcase Change-Id: I3a6fc3bf2915699d886f3b8e966ae2718517d7bd diff --git a/sw/qa/extras/ooxmltok/data/fdo49940.docx b/sw/qa/extras/ooxmltok/data/fdo49940.docx new file mode 100644 index 000..2422844 Binary files /dev/null and b/sw/qa/extras/ooxmltok/data/fdo49940.docx differ diff --git a/sw/qa/extras/ooxmltok/ooxmltok.cxx b/sw/qa/extras/ooxmltok/ooxmltok.cxx index 2c672d2..9e0473c 100644 --- a/sw/qa/extras/ooxmltok/ooxmltok.cxx +++ b/sw/qa/extras/ooxmltok/ooxmltok.cxx @@ -53,6 +53,7 @@ public: void testN751017(); void testN750935(); void testN757890(); +void testFdo49940(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -61,6 +62,7 @@ public: CPPUNIT_TEST(testN751017); CPPUNIT_TEST(testN750935); CPPUNIT_TEST(testN757890); +CPPUNIT_TEST(testFdo49940); #endif CPPUNIT_TEST_SUITE_END(); @@ -191,6 +193,19 @@ void Test::testN757890() CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER, nValue); } +void Test::testFdo49940() +{ +load("fdo49940.docx"); + +uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); +uno::Reference xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY); +uno::Reference xParaEnum = xParaEnumAccess->createEnumeration(); +uno::Reference xPara(xParaEnum->nextElement(), uno::UNO_QUERY); +OUString aValue; +xPara->getPropertyValue("PageStyleName") >>= aValue; +CPPUNIT_ASSERT_EQUAL(OUString("First Page"), aValue); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); commit 7d8077f2aea1f42ca19d5c685e64f597293f89bc Author: Miklos Vajna Date: Tue May 15 10:24:26 2012 +0200 n#760294 testcase Change-Id: I52f063848c7bd63bdef73fb21eaad4256a14d128 diff --git a/sw/qa/extras/ww8tok/data/n760294.doc b/sw/qa/extras/ww8tok/data/n760294.doc new file mode 100644 index 000..04960d0 Binary files /dev/null and b/sw/qa/extras/ww8tok/data/n760294.doc differ diff --git a/sw/qa/extras/ww8tok/ww8tok.cxx b/sw/qa/extras/ww8tok/ww8tok.cxx index 6a3ec74..dfc047e 100644 --- a/sw/qa/extras/ww8tok/ww8tok.cxx +++ b/sw/qa/extras/ww8tok/ww8tok.cxx @@ -28,8 +28,10 @@ #include "../swmodeltestbase.hxx" #include +#include #include #include +#include #include @@ -41,10 +43,12 @@ class Test : public SwModelTestBase { public: void testN757910(); +void testN760294(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) CPPUNIT_TEST(testN757910); +CPPUNIT_TEST(testN760294); #endif CPPUNIT_TEST_SUITE_END(); @@ -76,6 +80,19 @@ void Test::testN757910() CPPUNIT_ASSERT(aBorder.LineWidth > 0); } +void Test::testN760294() +{ +load("n760294.doc"); + +uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xIndexAccess(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); +uno::Reference xTable(xIndexAccess->getByIndex(0), uno::UNO_QUERY); +table::TableBorder aTableBorder; +xTable->getPropertyValue("TableBorder") >>= aTableBorder; +CPPUNIT_ASSERT_EQUAL(aTableBorder.TopLine.InnerLineWidth, aTableBorder.TopLine.OuterLineWidth); +CPPUNIT_ASSERT_EQUAL(aTableBorder.TopLine.InnerLineWidth, aTableBorder.TopLine.LineDistance); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: 2 commits - sw/qa writerfilter/source
sw/qa/extras/rtftok/data/fdo49501.rtf |5 sw/qa/extras/rtftok/rtftok.cxx | 26 writerfilter/source/rtftok/rtfdocumentimpl.cxx | 27 - 3 files changed, 44 insertions(+), 14 deletions(-) New commits: commit d6acd86fe1d2924a378e3053f83d47084a8bb108 Author: Miklos Vajna Date: Wed May 9 11:30:13 2012 +0200 fdo#49501 RTF_MARGL/R/T/B should also set the current margin Change-Id: I I69b92d0cd07c9f08f14affb447b55b26b2556186 diff --git a/sw/qa/extras/rtftok/data/fdo49501.rtf b/sw/qa/extras/rtftok/data/fdo49501.rtf new file mode 100644 index 000..47bd691 --- /dev/null +++ b/sw/qa/extras/rtftok/data/fdo49501.rtf @@ -0,0 +1,5 @@ +{\rtf +\landscape \paperw15309 \paperh11907 \margl567 \margr567 \margt567 \margb567 +Department +\par +} diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx index 605a20d..e6de843 100644 --- a/sw/qa/extras/rtftok/rtftok.cxx +++ b/sw/qa/extras/rtftok/rtftok.cxx @@ -95,6 +95,7 @@ public: void testFdo47764(); void testFdo38786(); void testN757651(); +void testFdo49501(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -127,6 +128,7 @@ public: CPPUNIT_TEST(testFdo47764); CPPUNIT_TEST(testFdo38786); CPPUNIT_TEST(testN757651); +CPPUNIT_TEST(testFdo49501); #endif CPPUNIT_TEST_SUITE_END(); @@ -701,6 +703,30 @@ void Test::testN757651() CPPUNIT_ASSERT_EQUAL(1, getPages()); } +void Test::testFdo49501() +{ +load("fdo49501.rtf"); + +uno::Reference xStyleFamiliesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xStyles(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY); +uno::Reference xPageStyles(xStyles->getByName("PageStyles"), uno::UNO_QUERY); +uno::Reference xStyle(xPageStyles->getByName("Default"), uno::UNO_QUERY); + +sal_Bool bIsLandscape = sal_False; +xStyle->getPropertyValue("IsLandscape") >>= bIsLandscape; +CPPUNIT_ASSERT_EQUAL(sal_True, bIsLandscape); +sal_Int32 nExpected(TWIP_TO_MM100(567)); +sal_Int32 nValue = 0; +xStyle->getPropertyValue("LeftMargin") >>= nValue; +CPPUNIT_ASSERT_EQUAL(nExpected, nValue); +xStyle->getPropertyValue("RightMargin") >>= nValue; +CPPUNIT_ASSERT_EQUAL(nExpected, nValue); +xStyle->getPropertyValue("TopMargin") >>= nValue; +CPPUNIT_ASSERT_EQUAL(nExpected, nValue); +xStyle->getPropertyValue("BottomMargin") >>= nValue; +CPPUNIT_ASSERT_EQUAL(nExpected, nValue); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index b2f6c88..957174e 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -2620,34 +2620,30 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) lcl_putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgSz, NS_ooxml::LN_CT_PageSz_w, pIntValue, true); break; -case RTF_MARGL: +case RTF_MARGL: // fall through: set the default + current value lcl_putNestedAttribute(m_aDefaultState.aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_left, pIntValue, true); -break; -case RTF_MARGR: -lcl_putNestedAttribute(m_aDefaultState.aSectionSprms, -NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_right, pIntValue, true); -break; -case RTF_MARGT: -lcl_putNestedAttribute(m_aDefaultState.aSectionSprms, -NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_top, pIntValue, true); -break; -case RTF_MARGB: -lcl_putNestedAttribute(m_aDefaultState.aSectionSprms, -NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_bottom, pIntValue, true); -break; case RTF_MARGLSXN: lcl_putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_left, pIntValue, true); break; +case RTF_MARGR: // fall through: set the default + current value +lcl_putNestedAttribute(m_aDefaultState.aSectionSprms, +NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_right, pIntValue, true); case RTF_MARGRSXN: lcl_putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_right, pIntValue, true); break; +case RTF_MARGT: // fall through: set the default + current value +lcl_putNestedAttribute(m_aDefaultState.aSectionSprms, +NS_ooxml::LN_EG_SectPrContents_
[Libreoffice-commits] .: 2 commits - sw/qa writerfilter/source
sw/qa/extras/rtftok/data/fdo48193.rtf | 10 +++ sw/qa/extras/rtftok/rtftok.cxx |8 ++ writerfilter/source/rtftok/rtfdocumentimpl.cxx | 80 + writerfilter/source/rtftok/rtfdocumentimpl.hxx | 11 +++ 4 files changed, 60 insertions(+), 49 deletions(-) New commits: commit f1fdcdea5436e927dde9b4dd242c4f90c2a75e9d Author: Miklos Vajna Date: Wed Apr 25 11:28:49 2012 +0200 avoid code duplication by introducing RTFDocumentImpl::singleChar diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index ed89aa2..ba4db68 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -833,6 +833,24 @@ bool RTFFrame::inFrame() || nY > 0; } +void RTFDocumentImpl::singleChar(sal_uInt8 nValue) +{ +sal_uInt8 sValue[] = { nValue }; +if (!m_pCurrentBuffer) +{ +Mapper().startCharacterGroup(); +Mapper().text(sValue, 1); +Mapper().endCharacterGroup(); +} +else +{ +m_pCurrentBuffer->push_back(make_pair(BUFFER_STARTRUN, RTFValue::Pointer_t())); +RTFValue::Pointer_t pValue(new RTFValue(*sValue)); +m_pCurrentBuffer->push_back(make_pair(BUFFER_TEXT, pValue)); +m_pCurrentBuffer->push_back(make_pair(BUFFER_ENDRUN, RTFValue::Pointer_t())); +} +} + void RTFDocumentImpl::text(OUString& rString) { bool bRet = true; @@ -1075,22 +1093,7 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) if (aBuf.toString().equals("EQ")) m_bEq = true; else -{ -sal_uInt8 sFieldStart[] = { 0x13 }; -if (!m_pCurrentBuffer) -{ -Mapper().startCharacterGroup(); -Mapper().text(sFieldStart, 1); -Mapper().endCharacterGroup(); -} -else -{ -m_pCurrentBuffer->push_back(make_pair(BUFFER_STARTRUN, RTFValue::Pointer_t())); -RTFValue::Pointer_t pValue(new RTFValue(*sFieldStart)); -m_pCurrentBuffer->push_back(make_pair(BUFFER_TEXT, pValue)); -m_pCurrentBuffer->push_back(make_pair(BUFFER_ENDRUN, RTFValue::Pointer_t())); -} -} +singleChar(0x13); m_aStates.top().nDestinationState = DESTINATION_FIELDINSTRUCTION; } break; @@ -3025,42 +3028,12 @@ int RTFDocumentImpl::popState() m_aFormfieldSprms->clear(); } if (!m_bEq) -{ -sal_uInt8 sFieldSep[] = { 0x14 }; -if (!m_pCurrentBuffer) -{ -Mapper().startCharacterGroup(); -Mapper().text(sFieldSep, 1); -Mapper().endCharacterGroup(); -} -else -{ -m_pCurrentBuffer->push_back(make_pair(BUFFER_STARTRUN, RTFValue::Pointer_t())); -RTFValue::Pointer_t pValue(new RTFValue(*sFieldSep)); -m_pCurrentBuffer->push_back(make_pair(BUFFER_TEXT, pValue)); -m_pCurrentBuffer->push_back(make_pair(BUFFER_ENDRUN, RTFValue::Pointer_t())); -} -} +singleChar(0x14); } else if (m_aStates.top().nDestinationState == DESTINATION_FIELDRESULT) { if (!m_bEq) -{ -sal_uInt8 sFieldEnd[] = { 0x15 }; -if (!m_pCurrentBuffer) -{ -Mapper().startCharacterGroup(); -Mapper().text(sFieldEnd, 1); -Mapper().endCharacterGroup(); -} -else -{ -m_pCurrentBuffer->push_back(make_pair(BUFFER_STARTRUN, RTFValue::Pointer_t())); -RTFValue::Pointer_t pValue(new RTFValue(*sFieldEnd)); -m_pCurrentBuffer->push_back(make_pair(BUFFER_TEXT, pValue)); -m_pCurrentBuffer->push_back(make_pair(BUFFER_ENDRUN, RTFValue::Pointer_t())); -} -} +singleChar(0x15); else m_bEq = false; } @@ -3465,22 +3438,7 @@ int RTFDocumentImpl::popState() else if (aState.nDestinationState == DESTINATION_FIELD) { if (aState.nFieldStatus == FIELD_INSTRUCTION) -{ -sal_uInt8 sFieldEnd[] = { 0x15 }; -if (!m_pCurrentBuffer) -{ -Mapper().startCharacterGroup(); -Mapper().text(sFieldEnd, 1); -Mapper().endCharacterGroup(); -} -else -{ -m_pCurrentBuffer->push_back(make_pair(BUFFER_STARTRUN, RTFValue::Pointer_t())); -RTFValue::Pointer_t pValue(new RTFValue(*sFieldEnd)); -m_pCurrentBuf