[Libreoffice-commits] .: sw/qa sw/source
sw/qa/extras/ww8import/data/fdo59530.doc |binary sw/qa/extras/ww8import/ww8import.cxx | 26 + sw/source/filter/ww8/ww8par.cxx | 89 +-- sw/source/filter/ww8/ww8par.hxx |6 ++ sw/source/filter/ww8/ww8struc.hxx|8 ++ 5 files changed, 125 insertions(+), 4 deletions(-) New commits: commit 7907cc0ef9751d553014bd3bab49be9e7fc31bca Author: Miklos Vajna Date: Mon Jan 21 09:31:26 2013 +0100 fdo#59530 WW8 import of commented text ranges Change-Id: I3e2928922ebcec8188c1b5416108373c4f26dd62 diff --git a/sw/qa/extras/ww8import/data/fdo59530.doc b/sw/qa/extras/ww8import/data/fdo59530.doc new file mode 100755 index 000..4e41cb8 Binary files /dev/null and b/sw/qa/extras/ww8import/data/fdo59530.doc differ diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx index d650e11..d471b7b 100644 --- a/sw/qa/extras/ww8import/ww8import.cxx +++ b/sw/qa/extras/ww8import/ww8import.cxx @@ -47,6 +47,7 @@ public: void testN757118(); void testN757905(); void testAllGapsWord(); +void testFdo59530(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -68,6 +69,7 @@ void Test::run() {"n757118.doc", &Test::testN757118}, {"n757905.doc", &Test::testN757905}, {"all_gaps_word.doc", &Test::testAllGapsWord}, +{"fdo59530.doc", &Test::testFdo59530}, }; header(); for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) @@ -226,6 +228,30 @@ void Test::testAllGapsWord() borderTest.testTheBorders(mxComponent); } +void Test::testFdo59530() +{ +// See ooxmlexport's testFdo38244(). +// Test comment range feature. +uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); +uno::Reference xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY); +uno::Reference xParaEnum = xParaEnumAccess->createEnumeration(); +uno::Reference xRunEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY); +uno::Reference xRunEnum = xRunEnumAccess->createEnumeration(); +xRunEnum->nextElement(); +uno::Reference xPropertySet(xRunEnum->nextElement(), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(OUString("TextFieldStart"), getProperty(xPropertySet, "TextPortionType")); +xRunEnum->nextElement(); +xPropertySet.set(xRunEnum->nextElement(), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(OUString("TextFieldEnd"), getProperty(xPropertySet, "TextPortionType")); + +// Test initials. +uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xFieldsAccess(xTextFieldsSupplier->getTextFields()); +uno::Reference xFields(xFieldsAccess->createEnumeration()); +xPropertySet.set(xFields->nextElement(), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(OUString("346376201"), getProperty(xPropertySet, "Name")); +CPPUNIT_ASSERT_EQUAL(OUString("M"), getProperty(xPropertySet, "Initials")); +} CPPUNIT_TEST_SUITE_REGISTRATION(Test); diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 7705aae..acfecb2 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -1761,6 +1761,8 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes) return 0; String sAuthor; +String sInitials; +String sName; if( bVer67 ) { const WW67_ATRD* pDescri = (const WW67_ATRD*)pSD->GetData(); @@ -1775,13 +1777,35 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes) { const WW8_ATRD* pDescri = (const WW8_ATRD*)pSD->GetData(); +{ +sal_uInt16 nLen = SVBT16ToShort(pDescri->xstUsrInitl[0]); +for(sal_uInt16 nIdx = 1; nIdx <= nLen; ++nIdx) +sInitials += SVBT16ToShort(pDescri->xstUsrInitl[nIdx]); +} + if (const String* pA = GetAnnotationAuthor(SVBT16ToShort(pDescri->ibst))) sAuthor = *pA; else +sAuthor = sInitials; + +// If there is a bookmark tag, a text range should be commented. +sal_uInt32 nTagBkmk = SVBT32ToUInt32(pDescri->ITagBkmk); +if (nTagBkmk != 0x) { -sal_uInt16 nLen = SVBT16ToShort(pDescri->xstUsrInitl[0]); -for(sal_uInt16 nIdx = 1; nIdx <= nLen; ++nIdx) -sAuthor += SVBT16ToShort(pDescri->xstUsrInitl[nIdx]); +sName = OUString::valueOf(sal_Int32(nTagBkmk)); +int nAtnIndex = GetAnnotationIndex(nTagBkmk); +if (nAtnIndex != -1) +{ +WW8_CP nStart = GetAnnotationStart(nAtnIndex); +WW8_CP nEnd = GetAnnotationEnd(nAtnIndex); +sal_Int32 nLen = nEnd - nStart; +// Don't support ranges affecting multiple SwTxtNode for now. +if (nLen && pPaM->GetPoint()->nContent.GetIndex() >= nLen) +{ +pPaM->SetMark(); +pPaM->GetPoint()->nContent -=
[Libreoffice-commits] .: sw/qa sw/source
sw/qa/extras/rtfexport/data/fdo52286.odt|binary sw/qa/extras/rtfexport/rtfexport.cxx|9 + sw/source/filter/ww8/rtfattributeoutput.cxx | 11 ++- 3 files changed, 19 insertions(+), 1 deletion(-) New commits: commit 796e9a796603397c79e160610c8541e16dfc4c82 Author: Miklos Vajna Date: Thu Jan 17 09:41:07 2013 +0100 fdo#52286 fix RTF export of sub/super script font height Change-Id: If71cb6a20842f2fbe8eae94955da2d53842999a4 diff --git a/sw/qa/extras/rtfexport/data/fdo52286.odt b/sw/qa/extras/rtfexport/data/fdo52286.odt new file mode 100644 index 000..b6e70ef Binary files /dev/null and b/sw/qa/extras/rtfexport/data/fdo52286.odt differ diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index 4a4e622..be9b27b 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -68,6 +68,7 @@ public: void testFdo55939(); void testTextFrames(); void testFdo53604(); +void testFdo52286(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -111,6 +112,7 @@ void Test::run() {"fdo55939.odt", &Test::testFdo55939}, {"textframes.odt", &Test::testTextFrames}, {"fdo53604.odt", &Test::testFdo53604}, +{"fdo52286.odt", &Test::testFdo52286}, }; // Don't test the first import of these, for some reason those tests fail const char* aBlacklist[] = { @@ -454,6 +456,13 @@ void Test::testFdo53604() CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xFootnotes->getCount()); } +void Test::testFdo52286() +{ +// The problem was that font size wasn't reduced in sub/super script. +CPPUNIT_ASSERT_EQUAL(sal_Int32(58), getProperty(getRun(getParagraph(1), 2), "CharEscapementHeight")); +CPPUNIT_ASSERT_EQUAL(sal_Int32(58), getProperty(getRun(getParagraph(2), 2), "CharEscapementHeight")); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 9a65c42..14afa36 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -1865,6 +1865,16 @@ void RtfAttributeOutput::CharEscapement( const SvxEscapementItem& rEsc ) { SAL_INFO("sw.rtf", OSL_THIS_FUNC); +short nEsc = rEsc.GetEsc(); +if (rEsc.GetProp() == DFLT_ESC_PROP) +{ +if ( DFLT_ESC_SUB == nEsc || DFLT_ESC_AUTO_SUB == nEsc ) +m_aStyles.append(OOO_STRING_SVTOOLS_RTF_SUB); +else if ( DFLT_ESC_SUPER == nEsc || DFLT_ESC_AUTO_SUPER == nEsc ) +m_aStyles.append(OOO_STRING_SVTOOLS_RTF_SUPER); +return; +} + const char * pUpDn; SwTwips nH = ((SvxFontHeightItem&)m_rExport.GetItem( RES_CHRATR_FONTSIZE )).GetHeight(); @@ -1879,7 +1889,6 @@ void RtfAttributeOutput::CharEscapement( const SvxEscapementItem& rEsc ) else return; -short nEsc = rEsc.GetEsc(); short nProp = rEsc.GetProp() * 100; if( DFLT_ESC_AUTO_SUPER == nEsc ) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sw/qa sw/source
sw/qa/extras/rtfexport/data/fdo53604.odt|binary sw/qa/extras/rtfexport/rtfexport.cxx| 11 +++ sw/source/filter/ww8/rtfattributeoutput.cxx |3 +++ 3 files changed, 14 insertions(+) New commits: commit b91fa392bc731376cff205d6d3e5cb245dc4179c Author: Miklos Vajna Date: Fri Dec 21 14:44:06 2012 +0100 fdo#53604 fix RTF export of empty footnotes Regression from d4069372484f18b242a42a1996767f57b031fff6 diff --git a/sw/qa/extras/rtfexport/data/fdo53604.odt b/sw/qa/extras/rtfexport/data/fdo53604.odt new file mode 100644 index 000..af090bb Binary files /dev/null and b/sw/qa/extras/rtfexport/data/fdo53604.odt differ diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index f79b13f..150fc61 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -67,6 +68,7 @@ public: void testFdo53113(); void testFdo55939(); void testTextFrames(); +void testFdo53604(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -109,6 +111,7 @@ void Test::run() {"fdo53113.odt", &Test::testFdo53113}, {"fdo55939.odt", &Test::testFdo55939}, {"textframes.odt", &Test::testTextFrames}, +{"fdo53604.odt", &Test::testFdo53604}, }; // Don't test the first import of these, for some reason those tests fail const char* aBlacklist[] = { @@ -449,6 +452,14 @@ void Test::testTextFrames() CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xIndexAccess->getCount()); } +void Test::testFdo53604() +{ +// Invalid output on empty footnote. +uno::Reference xFootnotesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xFootnotes->getCount()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index e78f9e3..36d1cea 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -2336,12 +2336,15 @@ void RtfAttributeOutput::TextFootnote_Impl( const SwFmtFtn& rFootnote ) m_aRun.clear(); bool bInRunOrig = m_bInRun; m_bInRun = false; +bool bSingleEmptyRunOrig = m_bSingleEmptyRun; +m_bSingleEmptyRun = false; m_bBufferSectionHeaders = true; m_rExport.WriteSpecialText( pIndex->GetIndex() + 1, pIndex->GetNode().EndOfSectionIndex(), !rFootnote.IsEndNote() ? TXT_FTN : TXT_EDN); m_bBufferSectionHeaders = false; m_bInRun = bInRunOrig; +m_bSingleEmptyRun = bSingleEmptyRunOrig; m_aRun = aRun; m_aRun->append(m_aSectionHeaders.makeStringAndClear()); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sw/qa sw/source
sw/qa/extras/odfimport/odfimport.cxx |9 + sw/source/ui/utlui/uitool.cxx| 34 -- 2 files changed, 41 insertions(+), 2 deletions(-) New commits: commit bee957fc48867aa1b98b8672b02a187a461f4e38 Author: Miklos Vajna Date: Wed Dec 19 22:35:38 2012 +0100 fdo#57881 sw: make UseOnPage independent from SvxPageUsage UseOnPage got changed in commit fa0f42bafbf24e9141ddee728b160b5ab47077f2, but SvxPageUsage got unchanged. Given that right now other applications don't support first page headers / footers, leave SvxPageUsage unchanged and provide conversion methods between the two types. diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index 78531b4..885413c 100644 --- a/sw/qa/extras/odfimport/odfimport.cxx +++ b/sw/qa/extras/odfimport/odfimport.cxx @@ -40,6 +40,7 @@ public: void testEmptySvgFamilyName(); void testHideAllSections(); void testOdtBorders(); +void testPageStyleLayoutDefault(); void testPageStyleLayoutRight(); CPPUNIT_TEST_SUITE(Test); @@ -58,6 +59,7 @@ void Test::run() {"empty-svg-family-name.odt", &Test::testEmptySvgFamilyName}, {"fdo53210.odt", &Test::testHideAllSections}, {"borders_ooo33.odt", &Test::testOdtBorders}, +{"hello.odt", &Test::testPageStyleLayoutDefault}, {"hello.odt", &Test::testPageStyleLayoutRight}, }; for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) @@ -273,6 +275,13 @@ void Test::testOdtBorders() } while(xParaEnum->hasMoreElements()); } +void Test::testPageStyleLayoutDefault() +{ +uno::Reference xPropertySet(getStyles("PageStyles")->getByName("Default Style"), uno::UNO_QUERY); +// This was style::PageStyleLayout_MIRRORED. +CPPUNIT_ASSERT_EQUAL(style::PageStyleLayout_ALL, getProperty(xPropertySet, "PageStyleLayout")); +} + void Test::testPageStyleLayoutRight() { uno::Reference xPropertySet(getStyles("PageStyles")->getByName("Default Style"), uno::UNO_QUERY); diff --git a/sw/source/ui/utlui/uitool.cxx b/sw/source/ui/utlui/uitool.cxx index 6cd7c8b..1db6d38 100644 --- a/sw/source/ui/utlui/uitool.cxx +++ b/sw/source/ui/utlui/uitool.cxx @@ -147,6 +147,36 @@ void FillHdFt(SwFrmFmt* pFmt, const SfxItemSet& rSet) pFmt->SetFmtAttr(aSet); } +/// Convert from UseOnPage to SvxPageUsage. +UseOnPage lcl_convertUseToSvx(UseOnPage nUse) +{ +UseOnPage nRet = nsUseOnPage::PD_NONE; +if ((nUse & nsUseOnPage::PD_LEFT) == nsUseOnPage::PD_LEFT) +nRet |= SVX_PAGE_LEFT; +if ((nUse & nsUseOnPage::PD_RIGHT) == nsUseOnPage::PD_RIGHT) +nRet |= SVX_PAGE_RIGHT; +if ((nUse & nsUseOnPage::PD_ALL) == nsUseOnPage::PD_ALL) +nRet |= SVX_PAGE_ALL; +if ((nUse & nsUseOnPage::PD_MIRROR) == nsUseOnPage::PD_MIRROR) +nRet |= SVX_PAGE_MIRROR; +return nRet; +} + +/// Convert from SvxPageUsage to UseOnPage. +UseOnPage lcl_convertUseFromSvx(UseOnPage nUse) +{ +UseOnPage nRet = nsUseOnPage::PD_NONE; +if ((nUse & SVX_PAGE_LEFT) == SVX_PAGE_LEFT) +nRet |= nsUseOnPage::PD_LEFT; +if ((nUse & SVX_PAGE_RIGHT) == SVX_PAGE_RIGHT) +nRet |= nsUseOnPage::PD_RIGHT; +if ((nUse & SVX_PAGE_ALL) == SVX_PAGE_ALL) +nRet |= nsUseOnPage::PD_ALL; +if ((nUse & SVX_PAGE_MIRROR) == SVX_PAGE_MIRROR) +nRet |= nsUseOnPage::PD_MIRROR; +return nRet; +} + /* Beschreibung: PageDesc <-> in Sets wandeln und zurueck */ @@ -171,7 +201,7 @@ void ItemSetToPageDesc( const SfxItemSet& rSet, SwPageDesc& rPageDesc ) if(nUse & 0x04) nUse |= 0x03; if(nUse) -rPageDesc.SetUseOn( (UseOnPage) nUse ); +rPageDesc.SetUseOn( lcl_convertUseFromSvx((UseOnPage) nUse) ); rPageDesc.SetLandscape(rPageItem.IsLandscape()); SvxNumberType aNumType; aNumType.SetNumberingType( static_cast< sal_Int16 >(rPageItem.GetNumType()) ); @@ -320,7 +350,7 @@ void PageDescToItemSet( const SwPageDesc& rPageDesc, SfxItemSet& rSet) // SvxPageItem aPageItem(SID_ATTR_PAGE); aPageItem.SetDescName(rPageDesc.GetName()); -aPageItem.SetPageUsage(rPageDesc.GetUseOn()); +aPageItem.SetPageUsage(lcl_convertUseToSvx(rPageDesc.GetUseOn())); aPageItem.SetLandscape(rPageDesc.GetLandscape()); aPageItem.SetNumType((SvxNumType)rPageDesc.GetNumType().GetNumberingType()); rSet.Put(aPageItem); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sw/qa sw/source
sw/qa/core/macros-test.cxx | 43 + sw/source/core/unocore/unodraw.cxx |7 +- 2 files changed, 49 insertions(+), 1 deletion(-) New commits: commit 01cd24df1ec7eaa53e9e2156d4d6890a7cc5996a Author: Michael Stahl Date: Fri Dec 7 12:23:21 2012 +0100 fdo#55289: fix crash in SwXShape::setPropertyValue: In the libreoffice-3-6 branch the docx import crashes here when setting the anchor position of a shape, because the previous setting of the AnchorType was not done properly: the position of the anchor in the SwFmt did not match the actual position of the text attribute, so we get these assertions: "Missing FlyInCnt-Hint." and crash. This cannot be reproduced with the docx import on master, because on master a different intermediate AnchorType is set, and transitioning from that happens not to cause the crash. But it can be reproduced with a unit test. The regression was introduced in libreoffice-3-6 with backport commit 10a0774b9da546557632cd09c4f6958f8939. Change-Id: I394643e11862543177ba57958a26cd8ce06dc09c diff --git a/sw/qa/core/macros-test.cxx b/sw/qa/core/macros-test.cxx index 7d71977..bdd7dee 100644 --- a/sw/qa/core/macros-test.cxx +++ b/sw/qa/core/macros-test.cxx @@ -37,8 +37,15 @@ #include #include +#include +#include #include #include +#include +#include +#include +#include +#include #include #include @@ -48,6 +55,7 @@ #include +#include #include "docsh.hxx" SV_DECL_REF(SwDocShell) @@ -73,6 +81,7 @@ public: //void testStarBasic(); void testVba(); +void testFdo55289(); CPPUNIT_TEST_SUITE(SwMacrosTest); #if !defined(MACOSX) && !defined(WNT) //enable this test if you want to play with star basic macros in unit tests @@ -80,6 +89,7 @@ public: //CPPUNIT_TEST(testStarBasic); CPPUNIT_TEST(testVba); #endif +CPPUNIT_TEST(testFdo55289); CPPUNIT_TEST_SUITE_END(); @@ -162,6 +172,39 @@ void SwMacrosTest::testVba() } } +void SwMacrosTest::testFdo55289() +{ +SwDoc *const pDoc = new SwDoc; +SwDocShellRef pDocShell = new SwDocShell(pDoc, SFX_CREATE_MODE_EMBEDDED); +// this needs to run with no layout to tickle the bugs in the special +// cases in SwXShape re-anchoring +assert(!pDoc->GetCurrentLayout()); + +uno::Reference const xModel(pDocShell->GetModel()); +uno::Reference const xDPS(xModel, UNO_QUERY); +uno::Reference const xShapes(xDPS->getDrawPage(), +UNO_QUERY); +uno::Reference const xShape( +uno::Reference(xModel, UNO_QUERY)-> +createInstance("com.sun.star.drawing.GraphicObjectShape"), +UNO_QUERY); +xShape->setPropertyValue("AnchorType", +makeAny(text::TextContentAnchorType_AT_PAGE)); +xShapes->add(uno::Reference(xShape, UNO_QUERY)); +xShape->setPropertyValue("AnchorType", +makeAny(text::TextContentAnchorType_AT_CHARACTER)); +xShape->setPropertyValue("AnchorType", +makeAny(text::TextContentAnchorType_AS_CHARACTER)); +xShape->setPropertyValue("AnchorType", +makeAny(text::TextContentAnchorType_AT_CHARACTER)); +xShape->setPropertyValue("AnchorType", +makeAny(text::TextContentAnchorType_AS_CHARACTER)); +uno::Reference const xEnd = +uno::Reference(xModel, UNO_QUERY)->getText()->getEnd(); +uno::Reference const xShapeContent(xShape, UNO_QUERY); +xShapeContent->attach(xEnd); +} + SwMacrosTest::SwMacrosTest() : m_aBaseString(RTL_CONSTASCII_USTRINGPARAM("/sw/qa/core/data")) { diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index 8193b08..62b6bc5 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -1355,7 +1355,12 @@ void SwXShape::setPropertyValue(const rtl::OUString& rPropertyName, const uno::A SwFmtFlyCnt aFmt( pFlyFmt ); pNd->InsertItem(aFmt, aPam.GetPoint()->nContent.GetIndex(), 0 ); -//aPam.GetPoint()->nContent--; +aPam.GetPoint()->nContent--; // InsertItem moved it +SwFmtAnchor aNewAnchor( +dynamic_cast( +aSet.Get(RES_ANCHOR))); +aNewAnchor.SetAnchor( aPam.GetPoint() ); +aSet.Put( aNewAnchor ); } if( bSetAttr ) pFmt->SetFmtAttr(aSet); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sw/qa sw/source
sw/qa/extras/rtfexport/data/textframes.odt |binary sw/qa/extras/rtfexport/rtfexport.cxx| 10 ++ sw/source/filter/ww8/rtfattributeoutput.cxx | 11 +-- 3 files changed, 19 insertions(+), 2 deletions(-) New commits: commit 049933c035157129cc0409bb100dfc5353847a63 Author: Miklos Vajna Date: Thu Nov 29 17:12:54 2012 +0100 sw: fix RTF export of text frames anchored to empty paragraphs Regression from d4069372484f18b242a42a1996767f57b031fff6 Change-Id: I28e095819e0c2f1a4b110741ace366329937f863 Reported-by: Michael Stahl diff --git a/sw/qa/extras/rtfexport/data/textframes.odt b/sw/qa/extras/rtfexport/data/textframes.odt new file mode 100644 index 000..301744a Binary files /dev/null and b/sw/qa/extras/rtfexport/data/textframes.odt differ diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index c2d8830..f79b13f 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -66,6 +66,7 @@ public: void testMathRuns(); void testFdo53113(); void testFdo55939(); +void testTextFrames(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -107,6 +108,7 @@ void Test::run() {"math-runs.rtf", &Test::testMathRuns}, {"fdo53113.odt", &Test::testFdo53113}, {"fdo55939.odt", &Test::testFdo55939}, +{"textframes.odt", &Test::testTextFrames}, }; // Don't test the first import of these, for some reason those tests fail const char* aBlacklist[] = { @@ -439,6 +441,14 @@ void Test::testFdo55939() getRun(xParagraph, 3, " Text after the footnote."); // However, this leading space is intentional and OK. } +void Test::testTextFrames() +{ +// The output was simply invalid, so let's check if all 3 frames were imported back. +uno::Reference xTextFramesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xIndexAccess->getCount()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index b931529..e39e191 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -386,7 +386,7 @@ void RtfAttributeOutput::EndParagraphProperties() void RtfAttributeOutput::StartRun( const SwRedlineData* pRedlineData, bool bSingleEmptyRun ) { -SAL_INFO("sw.rtf", OSL_THIS_FUNC); +SAL_INFO("sw.rtf", OSL_THIS_FUNC << ", bSingleEmptyRun: " << bSingleEmptyRun); m_bInRun = true; m_bSingleEmptyRun = bSingleEmptyRun; @@ -424,7 +424,7 @@ void RtfAttributeOutput::EndRunProperties( const SwRedlineData* /*pRedlineData*/ void RtfAttributeOutput::RunText( const String& rText, rtl_TextEncoding /*eCharSet*/ ) { -SAL_INFO("sw.rtf", OSL_THIS_FUNC); +SAL_INFO("sw.rtf", OSL_THIS_FUNC << ", rText: " << rText); RawText( rText, 0, m_rExport.eCurrentEncoding ); } @@ -1515,6 +1515,11 @@ void RtfAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Poi * would be there, causing a problem later. */ OString aSave = m_aRun.makeStringAndClear(); +// Also back m_bInRun and m_bSingleEmptyRun up. +bool bInRunOrig = m_bInRun; +m_bInRun = false; +bool bSingleEmptyRunOrig = m_bSingleEmptyRun; +m_bSingleEmptyRun = false; m_rExport.bRTFFlySyntax = true; const SwFrmFmt& rFrmFmt = rFrame.GetFrmFmt( ); @@ -1530,6 +1535,8 @@ void RtfAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Poi m_rExport.bRTFFlySyntax = false; m_aRun->append(aSave); m_aRunText.clear(); +m_bInRun = bInRunOrig; +m_bSingleEmptyRun = bSingleEmptyRunOrig; } m_rExport.mpParentFrame = NULL; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sw/qa sw/source
sw/qa/extras/ooxmlexport/data/n789482.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 20 sw/source/filter/ww8/docxattributeoutput.cxx | 13 - sw/source/filter/ww8/docxattributeoutput.hxx |2 +- 4 files changed, 29 insertions(+), 6 deletions(-) New commits: commit eac3e6e746300df379226941ba75c4e0ce1feb7a Author: Miklos Vajna Date: Wed Nov 14 19:03:05 2012 +0100 n#789482 DOCX: export track change data after w:hyperlink Change-Id: If204523d7da544b11b2d809993ada180476104ef diff --git a/sw/qa/extras/ooxmlexport/data/n789482.docx b/sw/qa/extras/ooxmlexport/data/n789482.docx new file mode 100755 index 000..493e8ee Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/n789482.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 1a1c157..8fe1985 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -66,6 +66,7 @@ public: void testFdo47669(); void testTableBorders(); void testFdo51550(); +void testN789482(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -103,6 +104,7 @@ void Test::run() {"fdo47669.docx", &Test::testFdo47669}, {"table-borders.docx", &Test::testTableBorders}, {"fdo51550.odt", &Test::testFdo51550}, +{"n789482.docx", &Test::testN789482}, }; // Don't test the first import of these, for some reason those tests fail const char* aBlacklist[] = { @@ -482,6 +484,24 @@ void Test::testFdo51550() CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws->getCount()); } +void Test::testN789482() +{ +// The problem was that w:del was exported before w:hyperlink, resulting in an invalid XML. +uno::Reference xParagraph = getParagraph(1); +getRun(xParagraph, 1, "Before. "); + +CPPUNIT_ASSERT_EQUAL(OUString("Delete"), getProperty(getRun(xParagraph, 2), "RedlineType")); +CPPUNIT_ASSERT_EQUAL(sal_True, getProperty(getRun(xParagraph, 2), "IsStart")); + +getRun(xParagraph, 3, "www.test.com"); +CPPUNIT_ASSERT_EQUAL(OUString("http://www.test.com/";), getProperty(getRun(xParagraph, 3), "HyperLinkURL")); + +CPPUNIT_ASSERT_EQUAL(OUString("Delete"), getProperty(getRun(xParagraph, 4), "RedlineType")); +CPPUNIT_ASSERT_EQUAL(sal_False, getProperty(getRun(xParagraph, 4), "IsStart")); + +getRun(xParagraph, 5, " After."); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 45abbf6..d69e2cc 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -461,8 +461,9 @@ void DocxAttributeOutput::EndParagraphProperties() void DocxAttributeOutput::StartRun( const SwRedlineData* pRedlineData, bool /*bSingleEmptyRun*/ ) { -// if there is some redlining in the document, output it -StartRedline( pRedlineData ); +// Don't start redline data here, possibly there is a hyperlink later, and +// that has to be started first. +m_pRedlineData = pRedlineData; // postpone the output of the start of a run (there are elements that need // to be written before the start of the run, but we learn which they are @@ -539,6 +540,9 @@ void DocxAttributeOutput::EndRun() m_startedHyperlink = true; } +// if there is some redlining in the document, output it +StartRedline(); + DoWriteBookmarks( ); WriteCommentRanges(); @@ -1237,12 +1241,11 @@ void DocxAttributeOutput::Redline( const SwRedlineData* /*pRedline*/ ) OSL_TRACE( "TODO DocxAttributeOutput::Redline( const SwRedlineData* pRedline )" ); } -void DocxAttributeOutput::StartRedline( const SwRedlineData* pRedlineData ) +void DocxAttributeOutput::StartRedline() { -m_pRedlineData = pRedlineData; - if ( !m_pRedlineData ) return; +const SwRedlineData* pRedlineData = m_pRedlineData; // FIXME check if it's necessary to travel over the Next()'s in pRedlineData diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx index b1302b6..f42ffdf 100644 --- a/sw/source/filter/ww8/docxattributeoutput.hxx +++ b/sw/source/filter/ww8/docxattributeoutput.hxx @@ -132,7 +132,7 @@ public: /// /// Start of the tag that encloses the run, fills the info according to /// the value of m_pRedlineData. -void StartRedline( const SwRedlineData* pRedlineData ); +void StartRedline(); /// Output redlining. /// ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sw/qa sw/source
sw/qa/extras/ooxmlexport/data/fdo51550.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 10 ++ sw/source/filter/ww8/docxattributeoutput.cxx | 45 +++ sw/source/filter/ww8/docxattributeoutput.hxx | 11 -- 4 files changed, 44 insertions(+), 22 deletions(-) New commits: commit bd6ae389008e110be62a335dfcd82c655d512e63 Author: Miklos Vajna Date: Fri Nov 9 10:42:47 2012 +0100 fdo#51550 fix DOCX export dataloss on non-math/chart OLE export This is still not complete, but having the replacement graphic only is far better than having nothing. Change-Id: I141a3de1a449f4261c7086e10f2c141b3f6cdb10 diff --git a/sw/qa/extras/ooxmlexport/data/fdo51550.odt b/sw/qa/extras/ooxmlexport/data/fdo51550.odt new file mode 100644 index 000..4cade5b Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo51550.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 24618ff..1a1c157 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -65,6 +65,7 @@ public: void testTablePosition(); void testFdo47669(); void testTableBorders(); +void testFdo51550(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -101,6 +102,7 @@ void Test::run() {"table-position.docx", &Test::testTablePosition}, {"fdo47669.docx", &Test::testFdo47669}, {"table-borders.docx", &Test::testTableBorders}, +{"fdo51550.odt", &Test::testFdo51550}, }; // Don't test the first import of these, for some reason those tests fail const char* aBlacklist[] = { @@ -472,6 +474,14 @@ void Test::testTableBorders() { } } +void Test::testFdo51550() +{ +// The problem was that we lacked the fallback to export the replacement graphic for OLE objects. +uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws->getCount()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 5a91c43..9a9b30f 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -984,7 +984,7 @@ void DocxAttributeOutput::WritePostponedGraphic() for( std::list< PostponedGraphic >::const_iterator it = m_postponedGraphic->begin(); it != m_postponedGraphic->end(); ++it ) -FlyFrameGraphic( *( it->grfNode ), it->size ); +FlyFrameGraphic( it->grfNode, it->size ); delete m_postponedGraphic; m_postponedGraphic = NULL; } @@ -1988,17 +1988,18 @@ void DocxAttributeOutput::DefaultStyle( sal_uInt16 nStyle ) #endif } -void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode& rGrfNode, const Size& rSize ) +void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size& rSize, const SwFlyFrmFmt* pOLEFrmFmt, SwOLENode* pOLENode ) { -OSL_TRACE( "TODO DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode& rGrfNode, const Size& rSize ) - some stuff still missing" ); +OSL_TRACE( "TODO DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size& rSize, const SwFlyFrmFmt* pOLEFrmFmt, SwOLENode* pOLENode ) - some stuff still missing" ); +const SwFrmFmt* pFrmFmt = pGrfNode ? pGrfNode->GetFlyFmt() : pOLEFrmFmt; // create the relation ID OString aRelId; sal_Int32 nImageType; -if ( rGrfNode.IsLinkedFile() ) +if ( pGrfNode && pGrfNode->IsLinkedFile() ) { // linked image, just create the relation String aFileName; -rGrfNode.GetFileFilterNms( &aFileName, 0 ); +pGrfNode->GetFileFilterNms( &aFileName, 0 ); // TODO Convert the file name to relative for better interoperability @@ -2011,10 +2012,14 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode& rGrfNode, const Size else { // inline, we also have to write the image itself -Graphic& rGraphic = const_cast< Graphic& >( rGrfNode.GetGrf() ); +Graphic* pGraphic = 0; +if (pGrfNode) +pGraphic = &const_cast< Graphic& >( pGrfNode->GetGrf() ); +else +pGraphic = pOLENode->GetGraphic(); m_rDrawingML.SetFS( m_pSerializer ); // to be sure that we write to the right stream -OUString aImageId = m_rDrawingML.WriteImage( rGraphic ); +OUString aImageId = m_rDrawingML.WriteImage( *pGraphic ); aRelId = OUStringToOString( aImageId, RTL_TEXTENCODING_UTF8 ); @@ -2026,11 +2031,11 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode& rGrfNode, const Size m_pSerializer->startElementNS( XML_w, XML_drawing, FSEND ); -bool isAnchor = rGrfNode.GetFlyFmt()->GetAnchor(
[Libreoffice-commits] .: sw/qa sw/source
sw/qa/extras/rtfexport/rtfexport.cxx |4 sw/source/core/text/frmpaint.cxx |2 +- sw/source/core/text/inftxt.cxx | 10 +- sw/source/core/text/itratr.cxx |6 +++--- sw/source/core/text/porexp.cxx |2 +- sw/source/core/text/porfld.cxx |2 +- sw/source/core/text/porfly.cxx |2 +- sw/source/core/text/porglue.cxx |2 +- sw/source/core/text/porlay.cxx |4 ++-- sw/source/core/text/pormulti.cxx |8 sw/source/core/text/porref.cxx |2 +- sw/source/core/text/porrst.cxx |4 ++-- sw/source/core/text/portox.cxx |2 +- sw/source/core/text/txtfld.cxx |2 +- sw/source/core/text/txtftn.cxx |4 ++-- sw/source/core/text/txthyph.cxx |6 +++--- sw/source/core/text/txttab.cxx |6 +++--- sw/source/core/text/wrong.cxx|4 ++-- sw/source/core/text/xmldump.cxx | 10 +- 19 files changed, 43 insertions(+), 39 deletions(-) New commits: commit 96ed67aadfb4e30b9870451eb3db90fae704df01 Author: gerhard oettl Date: Wed Oct 24 07:28:15 2012 +0200 rtl::OUString to OUString clean up unsing rtl::OUString, etc clauses had to be reinserted in sw/qa/extras/rtfexport/rtfexport.cxx to pass the test Change-Id: I3767ea89c8cfd9afe2dc8a80e5c7284be9d1cf57 Reviewed-on: https://gerrit.libreoffice.org/926 Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index 7381fe2..bd3f273 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -37,6 +37,10 @@ #include #include +using rtl::OString; +using rtl::OUString; +using rtl::OUStringBuffer; + class Test : public SwModelTestBase { public: diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx index ca99ba6..e548cdf 100644 --- a/sw/source/core/text/frmpaint.cxx +++ b/sw/source/core/text/frmpaint.cxx @@ -551,7 +551,7 @@ sal_Bool SwTxtFrm::PaintEmpty( const SwRect &rRect, sal_Bool bCheck ) const // Don't show the paragraph mark for collapsed paragraphs, when they are hidden if ( EmptyHeight( ) > 1 ) { -const rtl::OUString aTmp( CH_PAR ); +const OUString aTmp( CH_PAR ); SwDrawTextInfo aDrawInf( pSh, *pSh->GetOut(), 0, aTmp, 0, 1 ); aDrawInf.SetLeft( rRect.Left() ); aDrawInf.SetRight( rRect.Right() ); diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index e070151..1a1c286 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -823,7 +823,7 @@ static void lcl_DrawSpecial( const SwTxtPaintInfo& rInf, const SwLinePortion& rP } // check if char fits into rectangle -const rtl::OUString aTmp( cChar ); +const OUString aTmp( cChar ); aFontSize = rInf.GetTxtSize( aTmp ).SvLSize(); while ( aFontSize.Width() > nMaxWidth ) { @@ -1100,7 +1100,7 @@ void SwTxtPaintInfo::_DrawBackBrush( const SwLinePortion &rPor ) const if(pFieldmark) { OSL_TRACE("Found Fieldmark"); #if OSL_DEBUG_LEVEL > 1 -rtl::OUString str = pFieldmark->ToString( ); +OUString str = pFieldmark->ToString( ); fprintf( stderr, "%s\n", rtl::OUStringToOString( str, RTL_TEXTENCODING_UTF8 ).getStr( ) ); #endif } @@ -1123,7 +1123,7 @@ void SwTxtPaintInfo::_DrawBackBrush( const SwLinePortion &rPor ) const SwTxtAttr* pTxtAttr = pNd->GetTxtAttrForCharAt(nEndIdx, RES_TXTATR_FIELD); const SwFmtFld& rPostItField = pTxtAttr->GetFld(); // Look up the author name -const rtl::OUString& rAuthor = rPostItField.GetFld()->GetPar1(); +const OUString& rAuthor = rPostItField.GetFld()->GetPar1(); sal_uInt16 nIndex = pNd->GetDoc()->InsertRedlineAuthor(rAuthor); pOutDev->SetFillColor( SwPostItMgr::GetColorLight(nIndex) ); pOutDev->SetLineColor( SwPostItMgr::GetColorAnchor(nIndex) ); @@ -1636,7 +1636,7 @@ SwTxtSlot::SwTxtSlot( const SwTxtSizeInfo *pNew, const SwLinePortion *pPor, else if( !pTempList && nPos < pOldSmartTagList->Count() && nListPos < nIdx && aTxt.Len() ) { pTempList = new SwWrongList( WRONGLIST_SMARTTAG ); -pTempList->Insert( rtl::OUString(), 0, 0, aTxt.Len(), 0 ); +pTempList->Insert( OUString(), 0, 0, aTxt.Len(), 0 ); ((SwTxtPaintInfo*)pInf)->SetSmartTags( pTempList ); } else @@ -1652,7 +1652,7 @@ SwTxtSlot::SwTxtSlot( const SwTxtSizeInfo *pNew, const SwLinePortion *pPor,
[Libreoffice-commits] .: sw/qa sw/source
sw/qa/extras/rtfexport/data/fdo55939.odt|binary sw/qa/extras/rtfexport/rtfexport.cxx| 13 + sw/source/filter/ww8/rtfattributeoutput.cxx |5 - 3 files changed, 17 insertions(+), 1 deletion(-) New commits: commit 411f9007e20f8035bd2ab7bbc807c61892a5c64c Author: Miklos Vajna Date: Thu Oct 25 16:59:52 2012 +0200 fdo#55939 fix RTF export of footnotes Regression from d4069372484f18b242a42a1996767f57b031fff6. Change-Id: I58e8d48ac3222b795f7edfd0e74ecd86ea36f380 diff --git a/sw/qa/extras/rtfexport/data/fdo55939.odt b/sw/qa/extras/rtfexport/data/fdo55939.odt new file mode 100644 index 000..5358403 Binary files /dev/null and b/sw/qa/extras/rtfexport/data/fdo55939.odt differ diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index 2300c99..7381fe2 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -66,6 +66,7 @@ public: void testMathVerticalstacks(); void testMathRuns(); void testFdo53113(); +void testFdo55939(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -106,6 +107,7 @@ void Test::run() {"math-vertical-stacks.rtf", &Test::testMathVerticalstacks}, {"math-runs.rtf", &Test::testMathRuns}, {"fdo53113.odt", &Test::testFdo53113}, +{"fdo55939.odt", &Test::testFdo55939}, }; // Don't test the first import of these, for some reason those tests fail const char* aBlacklist[] = { @@ -426,6 +428,17 @@ void Test::testFdo53113() CPPUNIT_ASSERT_EQUAL(sal_Int32(102), aPairs[1].Second.Value.get()); } +void Test::testFdo55939() +{ +// The problem was that the exported RTF was invalid. +uno::Reference xParagraph(getParagraph(1)); +getRun(xParagraph, 1, "Main text before footnote."); +// Why the tab has to be removed here? +CPPUNIT_ASSERT_EQUAL(OUString("Footnote text."), +getProperty< uno::Reference >(getRun(xParagraph, 2), "Footnote")->getText()->getString().replaceAll("\t", "")); +getRun(xParagraph, 3, " Text after the footnote."); // However, this leading space is intentional and OK. +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 00558fe..b931529 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -2331,17 +2331,20 @@ void RtfAttributeOutput::TextFootnote_Impl( const SwFmtFtn& rFootnote ) /* * The footnote contains a whole paragraph, so we have to: - * 1) Reset, then later restore the contents of our run buffer. + * 1) Reset, then later restore the contents of our run buffer and run state. * 2) Buffer the output of the whole paragraph, as we do so for section headers already. */ const SwNodeIndex* pIndex = rFootnote.GetTxtFtn()->GetStartNode(); RtfStringBuffer aRun = m_aRun; m_aRun.clear(); +bool bInRunOrig = m_bInRun; +m_bInRun = false; m_bBufferSectionHeaders = true; m_rExport.WriteSpecialText( pIndex->GetIndex() + 1, pIndex->GetNode().EndOfSectionIndex(), !rFootnote.IsEndNote() ? TXT_FTN : TXT_EDN); m_bBufferSectionHeaders = false; +m_bInRun = bInRunOrig; m_aRun = aRun; m_aRun->append(m_aSectionHeaders.makeStringAndClear()); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sw/qa sw/source
sw/qa/extras/ooxmlexport/data/fdo47669.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 16 sw/source/filter/ww8/docxattributeoutput.cxx |6 +- 3 files changed, 21 insertions(+), 1 deletion(-) New commits: commit 3b042335208cb2c995f4860bf8ba3bd1e2f2e859 Author: Korrawit Pruegsanusak Date: Sun Oct 7 17:15:04 2012 +0700 Fix fdo#47669: also check if we started the tag before ending it The problem is we created imbalance end tag which shouldn't be there. So, place a check before inserting end tag should help. Inspired by (read: copied from) c1c2688912e769dfd7654e11e87dae380a8ce1eb ;) Change-Id: Ic933f6da44c788cba48bb2fe6fa29658985310b6 diff --git a/sw/qa/extras/ooxmlexport/data/fdo47669.docx b/sw/qa/extras/ooxmlexport/data/fdo47669.docx new file mode 100644 index 000..9c5ef68 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo47669.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 6f8689a..2d7f49d 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -63,6 +63,7 @@ public: void testMathSubscripts(); void testMathVerticalStacks(); void testTablePosition(); +void testFdo47669(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -86,6 +87,7 @@ public: CPPUNIT_TEST(testMathSubscripts); CPPUNIT_TEST(testMathVerticalStacks); CPPUNIT_TEST(testTablePosition); +CPPUNIT_TEST(testFdo47669); #endif CPPUNIT_TEST_SUITE_END(); @@ -397,6 +399,20 @@ void Test::testTablePosition() } } +void Test::testFdo47669() +{ +roundtrip("fdo47669.docx"); + +/* + * Problem: we created imbalance which shouldn't be there, + * resulting in loading error: missing last character of hyperlink text + * and content after it wasn't loaded. + */ +getParagraph(1, "This is a hyperlink with anchor. Also, this sentence should be seen."); +getRun(getParagraph(1), 2, "hyperlink with anchor"); +CPPUNIT_ASSERT_EQUAL(OUString("http://www.google.com/#a";), getProperty(getRun(getParagraph(1), 2), "HyperLinkURL")); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index bce14c8..2b5485a 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -535,7 +535,11 @@ void DocxAttributeOutput::EndRun() if ( m_closeHyperlinkInPreviousRun ) { -m_pSerializer->endElementNS( XML_w, XML_hyperlink ); +if ( m_startedHyperlink ) +{ +m_pSerializer->endElementNS( XML_w, XML_hyperlink ); +m_startedHyperlink = false; +} m_closeHyperlinkInPreviousRun = false; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sw/qa sw/source writerfilter/Library_writerfilter.mk writerfilter/source
sw/qa/extras/ooxmlexport/ooxmlexport.cxx |3 --- sw/qa/extras/rtfexport/rtfexport.cxx |3 --- sw/source/filter/ww8/docxattributeoutput.cxx | 11 +++ sw/source/filter/ww8/rtfattributeoutput.cxx | 18 +- writerfilter/Library_writerfilter.mk |1 + writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |9 +++-- writerfilter/source/rtftok/rtfdocumentimpl.cxx|9 +++-- 7 files changed, 31 insertions(+), 23 deletions(-) New commits: commit 2b5953a19e36a02040f2ff08bc87efe4785f80bd Author: LuboÅ¡ LuÅák Date: Thu Aug 23 14:06:45 2012 +0200 fix math export/import in docx/rtf For some reason older gcc versions don't manage to dynamic_cast to the necessary cast. I'm not quite sure why, forcing sal/osl/unx/module.cxx to always use RTLD_GLOBAL does not seem to help. Most probably compiler bug. Changing the cast to two simpler ones helps. diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 6615343..076eedc 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -49,10 +49,7 @@ public: CPPUNIT_TEST(testZoom); CPPUNIT_TEST(defaultTabStopNotInStyles); CPPUNIT_TEST(testFdo38244); -// See rtfexport test on why this is blacklisted. -#if !(__GNUC__ == 4 && __GNUC_MINOR__ == 4) CPPUNIT_TEST(testMathEscape); -#endif CPPUNIT_TEST(testFdo51034); #endif CPPUNIT_TEST_SUITE_END(); diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index de705d2..67b6242 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -81,8 +81,6 @@ public: CPPUNIT_TEST(testFdo50831); CPPUNIT_TEST(testFdo48335); CPPUNIT_TEST(testFdo38244); -// With gcc-4.4, the dynamic_cast in RtfAttributeOutput::FlyFrameOLEMath() fails, strange. -#if !(__GNUC__ == 4 && __GNUC_MINOR__ == 4) CPPUNIT_TEST(testMathAccents); CPPUNIT_TEST(testMathEqarray); CPPUNIT_TEST(testMathD); @@ -100,7 +98,6 @@ public: CPPUNIT_TEST(testMathSubscripts); CPPUNIT_TEST(testMathVerticalstacks); CPPUNIT_TEST(testMathRuns); -#endif CPPUNIT_TEST(testFdo53113); #endif CPPUNIT_TEST_SUITE_END(); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 71c1915..b5165e7 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -87,6 +87,7 @@ #include #include #include +#include #include #include @@ -2287,10 +2288,12 @@ void DocxAttributeOutput::WritePostponedMath() return; uno::Reference < embed::XEmbeddedObject > xObj(const_cast(m_postponedMath)->GetOLEObj().GetOleRef()); uno::Reference< uno::XInterface > xInterface( xObj->getComponent(), uno::UNO_QUERY ); -if( oox::FormulaExportBase* formulaexport = dynamic_cast< oox::FormulaExportBase* >( xInterface.get())) -formulaexport->writeFormulaOoxml( m_pSerializer, GetExport().GetFilter().getVersion()); -else -OSL_FAIL( "Math OLE object cannot write out OOXML" ); +// gcc4.4 (and 4.3 and possibly older) have a problem with dynamic_cast directly to the target class, +// so help it with an intermediate cast. I'm not sure what exactly the problem is, seems to be unrelated +// to RTLD_GLOBAL, so most probably a gcc bug. +oox::FormulaExportBase* formulaexport = dynamic_cast(dynamic_cast(xInterface.get())); +assert( formulaexport != NULL ); +formulaexport->writeFormulaOoxml( m_pSerializer, GetExport().GetFilter().getVersion()); m_postponedMath = NULL; } diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index a152e6e..15f15b7 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -80,6 +80,7 @@ #include #include #include +#include #include #include @@ -3362,15 +3363,14 @@ bool RtfAttributeOutput::FlyFrameOLEMath(const SwFlyFrmFmt* pFlyFrmFmt, SwOLENod m_aRunText->append("{" LO_STRING_SVTOOLS_RTF_MMATH " "); uno::Reference xClosable(xObj->getComponent(), uno::UNO_QUERY); -oox::FormulaExportBase* pBase = dynamic_cast(xClosable.get()); -SAL_WARN_IF(!pBase, "sw.rtf", "Math OLE object cannot write out RTF"); -if (pBase) -{ -OStringBuffer aBuf; -pBase->writeFormulaRtf(aBuf, m_rExport.eCurrentEncoding); -m_aRunText->append(aBuf.makeStringAndClear()); -} - +// gcc4.4 (and 4.3 and possibly older) have a problem with dynamic_cast directly to the target class, +// so help it with an intermediate cast. I'm not sure what exactly the problem is, seems to be unrelated +// to RTLD_GLOBAL, so most probably a gcc bug. +oox::FormulaExportBase* pBase = dynamic_cast(dynamic_cast(xClosable
[Libreoffice-commits] .: sw/qa sw/source
sw/qa/core/swdoc-test.cxx | 10 -- sw/source/core/txtnode/txtedt.cxx | 13 +++-- 2 files changed, 11 insertions(+), 12 deletions(-) New commits: commit 3ba107606682b5e675127483a514f0e6580ecfd1 Author: Muhammad Haggag Date: Wed Aug 22 16:46:23 2012 +0200 fdo#53399 Word count is inconsistent and wrong with non-breaking space This change replaces lcl_IsSkippableWhitespace with a call to ICU's u_isspace, which covers all Unicode separators. It also updates and fixes one of the SwScanner unit tests. Bug details: SwScanner::NextWord skips whitespace before calling into ICU's BreakIterator. The function used to identify whitespace (lcl_IsSkippableWhitespace) doesn't cover the full category of Unicode separators (code [Zs], 18 in total. See: http://www.fileformat.info/info/unicode/category/Zs/index.htm). Since 0xA0 (no-break space) is not identified as whitespace and not skipped, we end up calling ICU starting at the position 0xA0, asking it to get us the boundary of the next word forward. ICU sees that it's called at the end of a word, and reverses the query direction to backward, and returns the word before. This causes NextWord to think we've hit the end of the string and call it a day, terminating word count for the rest of the line. Change-Id: I29c89ddb0b26e88da822501253898856b28e3fa5 Reviewed-on: https://gerrit.libreoffice.org/453 Reviewed-by: Andras Timar Tested-by: Andras Timar diff --git a/sw/qa/core/swdoc-test.cxx b/sw/qa/core/swdoc-test.cxx index a5df143..54a1cff 100644 --- a/sw/qa/core/swdoc-test.cxx +++ b/sw/qa/core/swdoc-test.cxx @@ -423,6 +423,7 @@ void SwDocTest::testSwScanner() } //See https://issues.apache.org/ooo/show_bug.cgi?id=89042 +//See https://bugs.freedesktop.org/show_bug.cgi?id=53399 { SwDocStat aDocStat; @@ -439,15 +440,20 @@ void SwDocTest::testSwScanner() CPPUNIT_ASSERT_MESSAGE("Should be 3", aDocStat.nWord == 3); const sal_Unicode aShouldBeFive[] = { +// fr e n c h space 0x0046, 0x0072, 0x0065, 0x006E, 0x0063, 0x0068, 0x0020, +// << nbsps a v o i 0x00AB, 0x00A0, 0x0073, 0x0061, 0x0076, 0x006F, 0x0069, -0x0072, 0x0020, 0x0063, 0x0061, 0x006C, 0x0063, 0x0075, -0x006C, 0x0065, 0x0072, 0x00A0, 0x00BB +// rnnbsp c a l c u +0x0072, 0x202f, 0x0063, 0x0061, 0x006C, 0x0063, 0x0075, +// le r idspace >> +0x006C, 0x0065, 0x0072, 0x3000, 0x00BB }; m_pDoc->AppendTxtNode(*aPaM.GetPoint()); m_pDoc->InsertString(aPaM, rtl::OUString(aShouldBeFive, SAL_N_ELEMENTS(aShouldBeFive))); pTxtNode = aPaM.GetNode()->GetTxtNode(); +aDocStat.Reset(); pTxtNode->CountWords(aDocStat, 0, SAL_N_ELEMENTS(aShouldBeFive)); CPPUNIT_ASSERT_MESSAGE("Should be 5", aDocStat.nWord == 5); } diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index 66650ba..ca3b961 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -71,6 +71,7 @@ #include #include #include +#include #include @@ -96,14 +97,6 @@ using namespace ::com::sun::star::smarttags; extern const SwTxtNode *pLinguNode; extern SwTxtFrm *pLinguFrm; -bool lcl_IsSkippableWhiteSpace( xub_Unicode cCh ) -{ -return 0x3000 == cCh || - ' ' == cCh || - '\t' == cCh || - 0x0a == cCh; -} - /* * This has basically the same function as SwScriptInfo::MaskHiddenRanges, * only for deleted redlines @@ -731,7 +724,7 @@ sal_Bool SwScanner::NextWord() // skip non-letter characters: while ( nBegin < aText.getLength() ) { -if ( !lcl_IsSkippableWhiteSpace( aText[nBegin] ) ) +if ( !u_isspace( aText[nBegin] ) ) { if ( !pLanguage ) { @@ -1877,7 +1870,7 @@ void SwTxtNode::CountWords( SwDocStat& rStat, //do the count // all counts exclude hidden paras and hidden+redlined within para // definition of space/white chars in SwScanner (and BreakIter!) -// uses both lcl_IsSkippableWhiteSpace and BreakIter getWordBoundary in SwScanner +// uses both u_isspace and BreakIter getWordBoundary in SwScanner sal_uInt32 nTmpWords = 0;// count of all words sal_uInt32 nTmpAsianWords = 0; //count of all Asian codepoints sal_uInt32 nTmpChars = 0;// count of all chars ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sw/qa sw/source
sw/qa/extras/ww8export/data/fdo46020.odt |binary sw/qa/extras/ww8export/ww8export.cxx | 11 +++ sw/source/filter/ww8/wrtw8nds.cxx|4 +++- 3 files changed, 14 insertions(+), 1 deletion(-) New commits: commit e3aca9772f4e1f9fcabecbe5bf22123259b3143a Author: Cédric Bosdonnat Date: Thu Aug 2 14:11:50 2012 +0200 fdo#46020: fixed missing footnote docx/doc/rtf export Don't skip a next position when parsing a paragraph into runs to export. Change-Id: If7e887ea84ad24256b37aa96187bc30ea154632b diff --git a/sw/qa/extras/ww8export/data/fdo46020.odt b/sw/qa/extras/ww8export/data/fdo46020.odt new file mode 100644 index 000..478c931 Binary files /dev/null and b/sw/qa/extras/ww8export/data/fdo46020.odt differ diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx index 58692a6..f8fbba9 100644 --- a/sw/qa/extras/ww8export/ww8export.cxx +++ b/sw/qa/extras/ww8export/ww8export.cxx @@ -42,11 +42,13 @@ class Test : public SwModelTestBase public: void testN325936(); void testFdo45724(); +void testFdo46020(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) CPPUNIT_TEST(testN325936); CPPUNIT_TEST(testFdo45724); +CPPUNIT_TEST(testFdo46020); #endif CPPUNIT_TEST_SUITE_END(); @@ -95,6 +97,15 @@ void Test::testFdo45724() CPPUNIT_ASSERT_EQUAL(OUString("xxx"), xComponent->getCurrentValue().get()); } +void Test::testFdo46020() +{ +// The footnote in that document wasn't exported, check that it is actually exported +roundtrip("fdo46020.odt"); +uno::Reference xFootnotesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xFootnotes->getCount()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 09969f5..efb6e2a 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -1622,8 +1622,10 @@ void MSWordExportBase::UpdatePosition( SwWW8AttrIter* aAttrIter, xub_StrLen nAkt xub_StrLen nNextPos; // go to next attribute if no bookmark is found or if the bookmark is behind the next attribute position +// It may happend that the WhereNext() wasn't used in the previous increment because there was a +// bookmark before it. Use that position before trying to find another one. bool bNextBookmark = NearestBookmark( nNextPos, nAktPos, true ); -if( !bNextBookmark || nNextPos > aAttrIter->WhereNext() ) +if( nAktPos == aAttrIter->WhereNext() && ( !bNextBookmark || nNextPos > aAttrIter->WhereNext() ) ) aAttrIter->NextPos(); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sw/qa sw/source
sw/qa/core/swdoc-test.cxx | 37 - sw/source/core/txtnode/txtedt.cxx |5 + 2 files changed, 41 insertions(+), 1 deletion(-) New commits: commit 3442913accc4e44c3a1ac69a990edee15117948e Author: Caolán McNamara Date: Thu Jul 19 13:50:21 2012 +0100 Related: fdo#46757 fix weird word/char count with hidden deleted text i.e. changes on, but not shown then unseen deleted text counted in word/char count Change-Id: I5725063edfbfc1f6545fe1dcea9b224dbfa3a418 diff --git a/sw/qa/core/swdoc-test.cxx b/sw/qa/core/swdoc-test.cxx index 8c06e25..f76cad3 100644 --- a/sw/qa/core/swdoc-test.cxx +++ b/sw/qa/core/swdoc-test.cxx @@ -61,6 +61,8 @@ #include "fmtftn.hxx" #include "fmtrfmrk.hxx" #include "fmtfld.hxx" +#include "redline.hxx" +#include "docary.hxx" SO2_DECL_REF(SwDocShell) SO2_IMPL_REF(SwDocShell) @@ -399,7 +401,7 @@ void SwDocTest::testSwScanner() pTxtNode->CountWords(aDocStat, 0, pTxtNode->Len()); CPPUNIT_ASSERT_EQUAL(aDocStat.nWord, static_cast(2)); -//turn on red-lining +//turn on red-lining and show changes m_pDoc->SetRedlineMode(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_SHOW_DELETE|nsRedlineMode_t::REDLINE_SHOW_INSERT); CPPUNIT_ASSERT_MESSAGE("redlining should be on", m_pDoc->IsRedlineOn()); CPPUNIT_ASSERT_MESSAGE("redlines should be visible", IDocumentRedlineAccess::IsShowChanges(m_pDoc->GetRedlineMode())); @@ -414,6 +416,39 @@ void SwDocTest::testSwScanner() pTxtNode->SetWordCountDirty(true); pTxtNode->CountWords(aDocStat, 0, pTxtNode->Len()); //but word-counting the text should only count the non-deleted text CPPUNIT_ASSERT_EQUAL(aDocStat.nWord, static_cast(1)); + +pTxtNode->SetWordCountDirty(true); + +//keep red-lining on but hide changes +m_pDoc->SetRedlineMode(nsRedlineMode_t::REDLINE_ON); +CPPUNIT_ASSERT_MESSAGE("redlining should be still on", m_pDoc->IsRedlineOn()); +CPPUNIT_ASSERT_MESSAGE("redlines should be invisible", !IDocumentRedlineAccess::IsShowChanges(m_pDoc->GetRedlineMode())); + +aDocStat.Reset(); +pTxtNode->CountWords(aDocStat, 0, pTxtNode->Len()); //but word-counting the text should only count the non-deleted text +CPPUNIT_ASSERT_EQUAL(aDocStat.nWord, static_cast(1)); + +rtl::OUString sLorem = pTxtNode->GetTxt(); +CPPUNIT_ASSERT(sLorem == "Lorem"); + +const SwRedlineTbl& rTbl = m_pDoc->GetRedlineTbl(); + +SwNodes& rNds = m_pDoc->GetNodes(); +CPPUNIT_ASSERT(rTbl.Count() == 1); + +SwNodeIndex* pNodeIdx = rTbl[0]->GetContentIdx(); +CPPUNIT_ASSERT(pNodeIdx); + +pTxtNode = rNds[ pNodeIdx->GetIndex() + 1 ]->GetTxtNode(); //first deleted txtnode +CPPUNIT_ASSERT(pTxtNode); + +rtl::OUString sIpsum = pTxtNode->GetTxt(); +CPPUNIT_ASSERT(sIpsum == " ipsum"); + +aDocStat.Reset(); +pTxtNode->CountWords(aDocStat, 0, pTxtNode->Len()); //word-counting the text should only count the non-deleted text, and this whole chunk should be ignored +CPPUNIT_ASSERT_EQUAL(aDocStat.nWord, static_cast(0)); +CPPUNIT_ASSERT_EQUAL(aDocStat.nChar, static_cast(0)); } } diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index 7da33e9..9f18fc7 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -1830,6 +1830,11 @@ void SwTxtNode::ReplaceTextOnly( xub_StrLen nPos, xub_StrLen nLen, void SwTxtNode::CountWords( SwDocStat& rStat, xub_StrLen nStt, xub_StrLen nEnd ) const { +if (IsInRedlines()) +{ //not counting txtnodes used to hold deleted redline content +return; +} + sal_Bool isCountAll = ( (0 == nStt) && (GetTxt().Len() == nEnd) ); ++rStat.nAllPara; // #i93174#: count _all_ paragraphs ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sw/qa sw/source
sw/qa/extras/rtfexport/data/fdo50831.rtf | 11 +++ sw/qa/extras/rtfexport/rtfexport.cxx | 15 +++ sw/source/filter/ww8/attributeoutputbase.hxx |2 +- sw/source/filter/ww8/docxattributeoutput.cxx |2 +- sw/source/filter/ww8/docxattributeoutput.hxx |2 +- sw/source/filter/ww8/rtfattributeoutput.cxx | 12 sw/source/filter/ww8/rtfattributeoutput.hxx |5 - sw/source/filter/ww8/wrtw8nds.cxx|7 --- sw/source/filter/ww8/ww8atr.cxx |2 +- sw/source/filter/ww8/ww8attributeoutput.hxx |2 +- 10 files changed, 47 insertions(+), 13 deletions(-) New commits: commit 7f916b90500033193226332d52930ab23dd79284 Author: Miklos Vajna Date: Fri Jun 22 15:41:37 2012 +0200 fdo#50831 fix RTF export of direct run formatting for empty paragraphs Change-Id: I5f0e7aefdea80bbb9cf61b991c5b706bd2023dfa diff --git a/sw/qa/extras/rtfexport/data/fdo50831.rtf b/sw/qa/extras/rtfexport/data/fdo50831.rtf new file mode 100644 index 000..476a82f --- /dev/null +++ b/sw/qa/extras/rtfexport/data/fdo50831.rtf @@ -0,0 +1,11 @@ +{\rtf1\ansi\deff3\adeflang1025 +{\fonttbl +{\f0\froman\fprq2\fcharset0 Times New Roman;} +{\f4\fswiss\fprq2\fcharset0 Arial;} +} +\pard\plain +\fs20\loch\f4 +\par \pard\plain +{\fs20\f4 +Foo} +\par} diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index 6df0aec..428b7e1 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -48,6 +48,7 @@ public: void testFdo49683(); void testFdo44174(); void testFdo50087(); +void testFdo50831(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -56,6 +57,7 @@ public: CPPUNIT_TEST(testFdo49683); CPPUNIT_TEST(testFdo44174); CPPUNIT_TEST(testFdo50087); +CPPUNIT_TEST(testFdo50831); #endif CPPUNIT_TEST_SUITE_END(); @@ -129,6 +131,19 @@ void Test::testFdo50087() CPPUNIT_ASSERT_EQUAL(OUString("First line.\nSecond line."), xDocumentProperties->getDescription()); } +void Test::testFdo50831() +{ +roundtrip("fdo50831.rtf"); + +uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); +uno::Reference xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY); +uno::Reference xParaEnum = xParaEnumAccess->createEnumeration(); +uno::Reference xPropertySet(xParaEnum->nextElement(), uno::UNO_QUERY); +float fValue = 0; +xPropertySet->getPropertyValue("CharHeight") >>= fValue; +CPPUNIT_ASSERT_EQUAL(10.f, fValue); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx b/sw/source/filter/ww8/attributeoutputbase.hxx index 6e35bd4..9d6daf4 100644 --- a/sw/source/filter/ww8/attributeoutputbase.hxx +++ b/sw/source/filter/ww8/attributeoutputbase.hxx @@ -156,7 +156,7 @@ public: virtual void EmptyParagraph() = 0; /// Start of the text run. -virtual void StartRun( const SwRedlineData* pRedlineData ) = 0; +virtual void StartRun( const SwRedlineData* pRedlineData, bool bSingleEmptyRun = false ) = 0; /// End of the text run. virtual void EndRun() = 0; diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 4abaed0..ba345a2 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -491,7 +491,7 @@ void DocxAttributeOutput::EndParagraphProperties() m_pSerializer->mergeTopMarks( sax_fastparser::MERGE_MARKS_PREPEND ); } -void DocxAttributeOutput::StartRun( const SwRedlineData* pRedlineData ) +void DocxAttributeOutput::StartRun( const SwRedlineData* pRedlineData, bool /*bSingleEmptyRun*/ ) { // if there is some redlining in the document, output it StartRedline( pRedlineData ); diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx index 9fc093e..d8c52a0 100644 --- a/sw/source/filter/ww8/docxattributeoutput.hxx +++ b/sw/source/filter/ww8/docxattributeoutput.hxx @@ -81,7 +81,7 @@ public: virtual void EndParagraphProperties(); /// Start of the text run. -virtual void StartRun( const SwRedlineData* pRedlineData ); +virtual void StartRun( const SwRedlineData* pRedlineData, bool bSingleEmptyRun = false ); /// End of the text run. virtual void EndRun(); diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index f5cfd8c..0614492 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -379,11 +379,13 @@ void RtfAttributeOutput::EndParagraphProperties() m_rExport.Strm() << m_aStyles.makeStringAndClear().getStr(); } -void RtfAttributeOutput::StartRun( const SwRedlineData* pRedlineData ) +void RtfAttributeOutput::StartRun( const SwRedlineData* pRedlineData, bool bSingleEmptyRun )
[Libreoffice-commits] .: sw/qa sw/source
sw/qa/extras/rtfexport/data/fdo44174.rtf |6 ++ sw/qa/extras/rtfexport/rtfexport.cxx | 16 sw/source/filter/ww8/rtfexport.cxx |1 + 3 files changed, 23 insertions(+) New commits: commit b22749fd9f9cd9206549367d2b619690b87414fc Author: Miklos Vajna Date: Fri May 11 09:38:03 2012 +0200 fdo#44174 RTF_TITLEPG when title page has no header Change-Id: Ida6566b38ceaca30441a029c73bd1f52d93bbb3b diff --git a/sw/qa/extras/rtfexport/data/fdo44174.rtf b/sw/qa/extras/rtfexport/data/fdo44174.rtf new file mode 100644 index 000..5186193 --- /dev/null +++ b/sw/qa/extras/rtfexport/data/fdo44174.rtf @@ -0,0 +1,6 @@ +{\rtf1 +\titlepg +First page has no header. +\pagebb +Second page has a header. +\par } diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index 74b0ca8..a78fb9f 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -30,6 +30,8 @@ #include #include #include +#include +#include #include #include @@ -44,12 +46,14 @@ public: void testZoom(); void testFdo38176(); void testFdo49683(); +void testFdo44174(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) CPPUNIT_TEST(testZoom); CPPUNIT_TEST(testFdo38176); CPPUNIT_TEST(testFdo49683); +CPPUNIT_TEST(testFdo44174); #endif CPPUNIT_TEST_SUITE_END(); @@ -100,6 +104,18 @@ void Test::testFdo49683() CPPUNIT_ASSERT_EQUAL(OUString("two"), aKeywords[1]); } +void Test::testFdo44174() +{ +roundtrip("fdo44174.rtf"); + +uno::Reference xModel(mxComponent, uno::UNO_QUERY); +uno::Reference xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY); +uno::Reference xPropertySet(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY); +OUString aValue; +xPropertySet->getPropertyValue("PageStyleName") >>= aValue; +CPPUNIT_ASSERT_EQUAL(OUString("First Page"), aValue); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx index 801ed5b..95f8350 100644 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -1188,6 +1188,7 @@ void RtfExport::OutPageDescription( const SwPageDesc& rPgDsc, sal_Bool bWriteRes // title page if( pAktPageDesc != &rPgDsc ) { +Strm() << OOO_STRING_SVTOOLS_RTF_TITLEPG; pAktPageDesc = &rPgDsc; if( pAktPageDesc->GetMaster().GetAttrSet().GetItemState( RES_HEADER, sal_False, &pItem ) == SFX_ITEM_SET ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits