sw/qa/extras/ooxmltok/data/n751077.docx |binary sw/qa/extras/ooxmltok/ooxmltok.cxx | 32 +++++++++++++++ vcl/unx/generic/plugadapt/salplug.cxx | 2 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx | 26 ++++++++++++ writerfilter/source/ooxml/OOXMLFastContextHandler.hxx | 2 writerfilter/source/ooxml/OOXMLParserState.cxx | 37 +++++++++++++++++- writerfilter/source/ooxml/OOXMLParserState.hxx | 9 ++++ writerfilter/source/ooxml/model.xml | 5 +- 8 files changed, 110 insertions(+), 3 deletions(-)
New commits: commit d2e09c2872e5018becf06ffb1bc4a825f047f5b2 Author: LuboÅ¡ LuÅák <l.lu...@suse.cz> Date: Fri May 18 14:18:16 2012 +0200 testcase for bnc#751077 Change-Id: Iee60b1d41f04f4a583c7392335068ca75668f42c diff --git a/sw/qa/extras/ooxmltok/data/n751077.docx b/sw/qa/extras/ooxmltok/data/n751077.docx new file mode 100644 index 0000000..62304e1 Binary files /dev/null and b/sw/qa/extras/ooxmltok/data/n751077.docx differ diff --git a/sw/qa/extras/ooxmltok/ooxmltok.cxx b/sw/qa/extras/ooxmltok/ooxmltok.cxx index 9e0473c..896b9fd 100644 --- a/sw/qa/extras/ooxmltok/ooxmltok.cxx +++ b/sw/qa/extras/ooxmltok/ooxmltok.cxx @@ -54,6 +54,7 @@ public: void testN750935(); void testN757890(); void testFdo49940(); + void testN751077(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -63,6 +64,7 @@ public: CPPUNIT_TEST(testN750935); CPPUNIT_TEST(testN757890); CPPUNIT_TEST(testFdo49940); + CPPUNIT_TEST(testN751077); #endif CPPUNIT_TEST_SUITE_END(); @@ -206,6 +208,36 @@ void Test::testFdo49940() CPPUNIT_ASSERT_EQUAL(OUString("First Page"), aValue); } +void Test::testN751077() +{ + load( "n751077.docx" ); + +/* +enum = ThisComponent.Text.createEnumeration +enum.NextElement +para = enum.NextElement +xray para.String +xray para.PageStyleName +*/ + uno::Reference<text::XTextDocument> textDocument(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> paraEnumAccess(textDocument->getText(), uno::UNO_QUERY); + // list of paragraphs + uno::Reference<container::XEnumeration> paraEnum = paraEnumAccess->createEnumeration(); + // go to 1st paragraph + (void) paraEnum->nextElement(); + // get the 2nd paragraph + uno::Reference<uno::XInterface> paragraph(paraEnum->nextElement(), uno::UNO_QUERY); + OUString value; + // text of the paragraph + uno::Reference<text::XTextRange> text(paragraph, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL( OUString( "TEXT1" ), text->getString()); + // 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<beans::XPropertySet> paragraphProperties(paragraph, uno::UNO_QUERY); + paragraphProperties->getPropertyValue( "PageStyleName" ) >>= value; + CPPUNIT_ASSERT_EQUAL( OUString( "First Page" ), value ); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); commit f73e75e91c757b20682d1df75de2f79b3972a500 Author: LuboÅ¡ LuÅák <l.lu...@suse.cz> Date: Thu May 17 16:24:14 2012 +0200 handle recursive <w:p> because of shapes (bnc#751077) <w:p><w:pict>...<w:txbxContent><w:p><w:p/> - in this case, the inner paragraphs should not interfere with the outer one, but e.g. detecting whether it was the last paragraph in section could get broken. Change-Id: I8634ee6a0d6274f5770423ff798adfa260a33326 diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx index 58d7627..f693319 100644 --- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx +++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx @@ -814,6 +814,32 @@ void OOXMLFastContextHandler::endOfParagraph() mpStream->utext((const sal_uInt8*)sCR, 1); } +void OOXMLFastContextHandler::startTxbxContent() +{ +#ifdef DEBUG_CONTEXT_HANDLER + debug_logger->element("contexthandler.startTxbxContent"); +#endif +/* + This usually means there are recursive <w:p> elements, and the ones + inside and outside of w:txbxContent should not interfere (e.g. + the lastParagraphInSection setting). So save the whole state + and possibly start new groups for the nested content (not section + group though, as that'd cause the txbxContent to be moved onto + another page, I'm not sure how that should work exactly). +*/ + mpParserState->startTxbxContent(); + startParagraphGroup(); +} + +void OOXMLFastContextHandler::endTxbxContent() +{ +#ifdef DEBUG_CONTEXT_HANDLER + debug_logger->element("contexthandler.endTxbxContent"); +#endif + endParagraphGroup(); + mpParserState->endTxbxContent(); +} + void OOXMLFastContextHandler::text(const ::rtl::OUString & sText) { #ifdef DEBUG_CONTEXT_HANDLER diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx index bb0e889..31ca2f7 100644 --- a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx +++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx @@ -211,6 +211,8 @@ public: void positionOffset(const ::rtl::OUString & sText); void alignH(const ::rtl::OUString & sText); void alignV(const ::rtl::OUString & sText); + void startTxbxContent(); + void endTxbxContent(); virtual void propagateCharacterProperties(); virtual void propagateCharacterPropertiesAsSet(const Id & rId); virtual void propagateTableProperties(); diff --git a/writerfilter/source/ooxml/OOXMLParserState.cxx b/writerfilter/source/ooxml/OOXMLParserState.cxx index 8704645..7e9b474 100644 --- a/writerfilter/source/ooxml/OOXMLParserState.cxx +++ b/writerfilter/source/ooxml/OOXMLParserState.cxx @@ -46,7 +46,12 @@ OOXMLParserState::OOXMLParserState() : mbForwardEvents(true), mnContexts(0), mnHandle(0), - mpDocument(NULL) + mpDocument(NULL), + inTxbxContent(false), + savedInSectionGroup(false), + savedInParagraphGroup(false), + savedInCharacterGroup(false), + savedLastParagraphInSection(false) { } @@ -275,6 +280,36 @@ void OOXMLParserState::incContextCount() mnContexts++; } +void OOXMLParserState::startTxbxContent() +{ + if( inTxbxContent ) + SAL_WARN( "writerfilter", "Nested w:txbxContent" ); + inTxbxContent = true; + // Do not save and reset section group state, it'd cause a new page. +// savedInSectionGroup = mbInSectionGroup; + savedInParagraphGroup = mbInParagraphGroup; + savedInCharacterGroup = mbInCharacterGroup; + savedLastParagraphInSection = mbLastParagraphInSection; +// mbInSectionGroup = false; + mbInParagraphGroup = false; + mbInCharacterGroup = false; + mbLastParagraphInSection = false; +} + +void OOXMLParserState::endTxbxContent() +{ + if( !inTxbxContent ) + { + SAL_WARN( "writerfilter", "Non-matching closing w:txbxContent" ); + return; + } +// mbInSectionGroup = savedInSectionGroup; + mbInParagraphGroup = savedInParagraphGroup; + mbInCharacterGroup = savedInCharacterGroup; + mbLastParagraphInSection = savedLastParagraphInSection; + inTxbxContent = false; +} + #if OSL_DEBUG_LEVEL > 1 void OOXMLParserState::dumpXml( const TagLogger::Pointer_t& pLogger ) { diff --git a/writerfilter/source/ooxml/OOXMLParserState.hxx b/writerfilter/source/ooxml/OOXMLParserState.hxx index df26a24..e89b0b2 100644 --- a/writerfilter/source/ooxml/OOXMLParserState.hxx +++ b/writerfilter/source/ooxml/OOXMLParserState.hxx @@ -59,6 +59,12 @@ class OOXMLParserState stack<OOXMLPropertySet::Pointer_t> mCellProps; stack<OOXMLPropertySet::Pointer_t> mRowProps; stack<OOXMLPropertySet::Pointer_t> mTableProps; + bool inTxbxContent; + // these 4 save when inTxbxContent + bool savedInSectionGroup; + bool savedInParagraphGroup; + bool savedInCharacterGroup; + bool savedLastParagraphInSection; #if OSL_DEBUG_LEVEL > 1 XPathLogger m_xPathLogger; #endif @@ -109,6 +115,9 @@ public: void incContextCount(); + void startTxbxContent(); + void endTxbxContent(); + #if OSL_DEBUG_LEVEL > 1 public: void dumpXml( const TagLogger::Pointer_t& pLogger ); diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml index f95112e..c5fea31 100644 --- a/writerfilter/source/ooxml/model.xml +++ b/writerfilter/source/ooxml/model.xml @@ -23651,7 +23651,10 @@ <resource name="CT_GlossaryDocument" resource="Stream" tag="content"/> <resource name="document" resource="Stream" tag="content"/> <resource name="glossaryDocument" resource="Stream" tag="content"/> - <resource name="CT_TxbxContent" resource="Stream" tag="shape"/> + <resource name="CT_TxbxContent" resource="Stream" tag="shape"> + <action name="start" action="startTxbxContent"/> + <action name="end" action="endTxbxContent"/> + </resource> <resource name="CT_OMath" resource="Math" tag="math"/> <resource name="CT_OMathPara" resource="Stream" tag="math"/> </namespace> commit 4708aede266da92903f48a24badb204c2a9a54b6 Author: LuboÅ¡ LuÅák <l.lu...@suse.cz> Date: Wed May 16 12:06:33 2012 +0200 TDE is certainly not a preferred fallback over KDE4 Change-Id: Iebfe536f228e7831d81d59ea3c3692f8906f72ad diff --git a/vcl/unx/generic/plugadapt/salplug.cxx b/vcl/unx/generic/plugadapt/salplug.cxx index ab19d34..4af49cd 100644 --- a/vcl/unx/generic/plugadapt/salplug.cxx +++ b/vcl/unx/generic/plugadapt/salplug.cxx @@ -246,7 +246,7 @@ SalInstance *CreateSalInstance() pInst = autodetect_plugin(); // fallback, try everything - const char* pPlugin[] = { "gtk3", "gtk", "tde", "kde4", "kde", "gen", 0 }; + const char* pPlugin[] = { "gtk3", "gtk", "kde4", "kde", "tde", "gen", 0 }; for ( int i = 0; !pInst && pPlugin[ i ]; ++i ) pInst = tryInstance( OUString::createFromAscii( pPlugin[ i ] ) );
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits