[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - sw/qa sw/source
sw/qa/extras/odfimport/data/tdf76322_columnBreakInHeader.docx |binary sw/qa/extras/odfimport/odfimport.cxx |6 ++ sw/source/core/layout/flowfrm.cxx |2 +- 3 files changed, 7 insertions(+), 1 deletion(-) New commits: commit 24bb46f4b6d8c0c7c0e56270a8a5daa79244feac Author: Justin LuthDate: Sat Jun 11 21:58:11 2016 +0300 tdf#76322 writer: allow column breaks in headers/footers The code blocking this came in the original OpenOffice flowfrm. Either IsInSct() or FindFooterOrHeader() works to resolve this bug. I chose FindFooterOrHeader because it seemed to match the existing targets (docbody, flyframe) better. Reviewed-on: https://gerrit.libreoffice.org/26208 Tested-by: Jenkins Reviewed-by: Miklos Vajna (cherry picked from commit 121109610f9af0b294cf042c6ae5abc6fcc4f326) Change-Id: I51fc3bdc51c76e290b47ec7b9044780e5b67136c diff --git a/sw/qa/extras/odfimport/data/tdf76322_columnBreakInHeader.docx b/sw/qa/extras/odfimport/data/tdf76322_columnBreakInHeader.docx new file mode 100755 index 000..6c050ae Binary files /dev/null and b/sw/qa/extras/odfimport/data/tdf76322_columnBreakInHeader.docx differ diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index 5c60935..61911a4 100644 --- a/sw/qa/extras/odfimport/odfimport.cxx +++ b/sw/qa/extras/odfimport/odfimport.cxx @@ -613,6 +613,12 @@ DECLARE_ODFIMPORT_TEST(testTdf92586, "tdf92586.odt") CPPUNIT_ASSERT_EQUAL(drawing::BitmapMode_STRETCH, getProperty(xPageStyle, "FillBitmapMode")); } +DECLARE_ODFIMPORT_TEST(testTdf76322_columnBreakInHeader, "tdf76322_columnBreakInHeader.docx") +{ +// column breaks were ignored. First line should start in column 2 +CPPUNIT_ASSERT_EQUAL( OUString("Test1"), parseDump("/root/page[1]/header/section/column[2]/body/txt/text()") ); +} + DECLARE_ODFIMPORT_TEST(testTdf96113, "tdf96113.odt") { // Background of the formula frame was white (0xff), not green. diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index 5320fd1..0afeacf 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -1161,7 +1161,7 @@ bool SwFlowFrm::IsColBreak( bool bAct ) const { // Determine predecessor const SwFrm *pPrev = m_rThis.FindPrev(); -while( pPrev && ( ( !pPrev->IsInDocBody() && !m_rThis.IsInFly() ) || +while( pPrev && ( ( !pPrev->IsInDocBody() && !m_rThis.IsInFly() && !m_rThis.FindFooterOrHeader() ) || ( pPrev->IsTextFrm() && static_cast(pPrev)->IsHiddenNow() ) ) ) pPrev = pPrev->FindPrev(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - sw/qa sw/source
sw/qa/extras/ooxmlimport/data/tdf95775.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx|5 + sw/source/core/doc/textboxhelper.cxx|6 ++ 3 files changed, 11 insertions(+) New commits: commit 5ed074d40e0bd7646304c066fb98c74848a33eb5 Author: Mike KaganskiDate: Sat Nov 14 14:04:20 2015 +1000 tdf#95775: Allow zero shape width/height; fix setting width/height relation Conflicts: sw/qa/extras/ooxmlimport/ooxmlimport.cxx Reviewed on: https://gerrit.libreoffice.org/19962 (cherry picked from commit ca80f73c3a330c38493e5e358bfa887adbe21db2) Change-Id: Ic91ebf4a18a77704dc1ccd1e1180b42d0bc84c74 diff --git a/sw/qa/extras/ooxmlimport/data/tdf95775.docx b/sw/qa/extras/ooxmlimport/data/tdf95775.docx new file mode 100644 index 000..a4c1293 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf95775.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index caf4a55..6ba7953 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -2879,6 +2879,11 @@ DECLARE_OOXMLIMPORT_TEST(testTdf85232, "tdf85232.docx") CPPUNIT_ASSERT_EQUAL(static_cast(2267), xShape->getPosition().X); } +DECLARE_OOXMLIMPORT_TEST(testTdf95775, "tdf95775.docx") +{ +// This must not fail in layout +} + DECLARE_OOXMLIMPORT_TEST(testTdf78902, "tdf78902.docx") { // This hung in layout. diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx index e50c238..96ba5e4 100644 --- a/sw/source/core/doc/textboxhelper.cxx +++ b/sw/source/core/doc/textboxhelper.cxx @@ -496,6 +496,12 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, sal_uInt16 nWID, sal_u case MID_FRMSIZE_IS_AUTO_HEIGHT: aPropertyName = UNO_NAME_FRAME_ISAUTOMATIC_HEIGHT; break; +case MID_FRMSIZE_REL_HEIGHT_RELATION: +aPropertyName = UNO_NAME_RELATIVE_HEIGHT_RELATION; +break; +case MID_FRMSIZE_REL_WIDTH_RELATION: +aPropertyName = UNO_NAME_RELATIVE_WIDTH_RELATION; +break; default: aPropertyName = UNO_NAME_SIZE; bAdjustSize = true; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - sw/qa sw/source
sw/qa/extras/ooxmlimport/data/tdf92157.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx|5 + sw/source/core/layout/atrfrm.cxx|5 + 3 files changed, 6 insertions(+), 4 deletions(-) New commits: commit 7fff48a80fc2374ac4916e3d907b47759985c77c Author: Mike KaganskiDate: Sat Jan 9 18:39:26 2016 +1000 tdf#92157: allow both dimensions of a graphic to be 0 Commit ca80f73 made it possible for one of dimensions to be zero. This commit goes further, allowing opening real-life documents with graphics having both width and height equal to 0. Thanks to libreoff...@arbruijn.dds.nl for debugging and initial patch! Reviewed-on: https://gerrit.libreoffice.org/21287 Tested-by: Jenkins Reviewed-by: Chris Sherlock (cherry picked from commit 654f6ff28d7a148950b48ed8905d8f13a015a5b5) Change-Id: I96a13b776adfd9fe46fc2c7691eb7904400c20a1 diff --git a/sw/qa/extras/ooxmlimport/data/tdf92157.docx b/sw/qa/extras/ooxmlimport/data/tdf92157.docx new file mode 100644 index 000..ba5bc2a Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf92157.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 4a362c3..caf4a55 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -2885,6 +2885,11 @@ DECLARE_OOXMLIMPORT_TEST(testTdf78902, "tdf78902.docx") CPPUNIT_ASSERT_EQUAL(2, getPages()); } +DECLARE_OOXMLIMPORT_TEST(testTdf92157, "tdf92157.docx") +{ +// A graphic with dimensions 0,0 should not fail on load +} + DECLARE_OOXMLIMPORT_TEST(testTdf96674, "tdf96674.docx") { uno::Reference xShape(getShape(1), uno::UNO_QUERY); diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index d000571..50e5b86 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -286,10 +286,7 @@ bool SwFormatFrmSize::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) aTmp.Height() = convertMm100ToTwip(aTmp.Height()); aTmp.Width() = convertMm100ToTwip(aTmp.Width()); } -if(aTmp.Height() && aTmp.Width()) -m_aSize = aTmp; -else -bRet = false; +m_aSize = aTmp; } } break; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - sw/qa sw/source
sw/qa/extras/tiledrendering/tiledrendering.cxx |6 ++ sw/source/core/crsr/swcrsr.cxx |4 +++- sw/source/core/crsr/viscrs.cxx |4 ++-- sw/source/core/layout/trvlfrm.cxx |3 ++- sw/source/core/view/viewimp.cxx|5 +++-- sw/source/uibase/docvw/PostItMgr.cxx |2 +- sw/source/uibase/docvw/SidebarWin.cxx |2 +- sw/source/uibase/docvw/edtwin.cxx | 18 +- sw/source/uibase/wrtsh/wrtsh2.cxx |3 ++- 9 files changed, 29 insertions(+), 18 deletions(-) New commits: commit 0d7920952a8748e3e2f02f7b27d624598d974006 Author: Ashod NakashianDate: Tue May 24 21:24:34 2016 -0400 bccu#1811 - Writer comment focusing / selection / cursor issue Partially based on fd205e40c58aa749fbe458d74ca0c2373a1017dc which caused make desktop.check to fail when viewsh.?xx changes were included, so left them out. Change-Id: I5b4576d2385c1812f358a2434b87c8ca62024430 Reviewed-on: https://gerrit.libreoffice.org/25421 Reviewed-by: Ashod Nakashian Tested-by: Ashod Nakashian diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index 00d8595..a745b14 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -174,6 +174,7 @@ void SwTiledRenderingTest::callbackImpl(int nType, const char* pPayload) void SwTiledRenderingTest::testRegisterCallback() { +comphelper::LibreOfficeKit::setActive(); SwXTextDocument* pXTextDocument = createDoc("dummy.fodt"); pXTextDocument->registerCallback(::callback, this); SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell(); @@ -184,6 +185,7 @@ void SwTiledRenderingTest::testRegisterCallback() CPPUNIT_ASSERT(!m_aInvalidation.IsEmpty()); Rectangle aTopLeft(0, 0, 256*15, 256*15); // 1 px = 15 twips, assuming 96 DPI. CPPUNIT_ASSERT(m_aInvalidation.IsOver(aTopLeft)); +comphelper::LibreOfficeKit::setActive(false); } void SwTiledRenderingTest::testPostKeyEvent() @@ -203,6 +205,7 @@ void SwTiledRenderingTest::testPostKeyEvent() void SwTiledRenderingTest::testPostMouseEvent() { +comphelper::LibreOfficeKit::setActive(); SwXTextDocument* pXTextDocument = createDoc("dummy.fodt"); SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell(); pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, /*bBasicCall=*/false); @@ -216,6 +219,7 @@ void SwTiledRenderingTest::testPostMouseEvent() pXTextDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP, aStart.getX(), aStart.getY(), 1); // The new cursor position must be before the first word. CPPUNIT_ASSERT_EQUAL(static_cast(0), pShellCrsr->GetPoint()->nContent.GetIndex()); +comphelper::LibreOfficeKit::setActive(false); } void SwTiledRenderingTest::testSetTextSelection() @@ -442,6 +446,7 @@ void SwTiledRenderingTest::testSearchTextFrameWrapAround() void SwTiledRenderingTest::testDocumentSizeChanged() { +comphelper::LibreOfficeKit::setActive(); // Get the current document size. SwXTextDocument* pXTextDocument = createDoc("2-pages.odt"); pXTextDocument->registerCallback(::callback, this); @@ -455,6 +460,7 @@ void SwTiledRenderingTest::testDocumentSizeChanged() CPPUNIT_ASSERT_EQUAL(aSize.getWidth(), m_aDocumentSize.getWidth()); // Document height should be smaller now. CPPUNIT_ASSERT(aSize.getHeight() > m_aDocumentSize.getHeight()); +comphelper::LibreOfficeKit::setActive(false); } void SwTiledRenderingTest::testSearchAll() diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index 6140342..fa05c64 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -51,6 +51,8 @@ #include #include #include +#include +#include using namespace ::com::sun::star::i18n; @@ -1379,7 +1381,7 @@ bool SwCursor::SelectWordWT( SwViewShell* pViewShell, sal_Int16 nWordType, const nWordType, bForward )); -if (pViewShell->isTiledRendering() && aBndry.startPos == aBndry.endPos && nPtPos > 0) +if (comphelper::LibreOfficeKit::isActive() && aBndry.startPos == aBndry.endPos && nPtPos > 0) { // nPtPos is the end of the paragraph, select the last word then. --nPtPos; diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index 1a0d423..9833bcd 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -92,7 +92,7 @@ void SwVisCrsr::Show() m_bIsVisible = true; // display at all? -if( m_pCrsrShell->VisArea().IsOver( m_pCrsrShell->m_aCharRect ) || m_pCrsrShell->isTiledRendering() ) +if(
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - sw/qa sw/source
sw/qa/extras/tiledrendering/data/pagedown-invalidation.odt |binary sw/qa/extras/tiledrendering/tiledrendering.cxx | 26 - sw/source/uibase/uiview/viewport.cxx |6 ++- 3 files changed, 30 insertions(+), 2 deletions(-) New commits: commit 4a0746108f93122c3d7b1f5504fda8afdc5ece6d Author: Miklos VajnaDate: Fri Jan 22 18:34:27 2016 +0100 sw tiled rendering: avoid unnecessary invalidation in SwView::SetVisArea() SwWrtShell's visible area is set to the entire document since 12e3b51abe883202af09769873f87b27d7de118b (tdf#94237 tiled rendering: Use the entire document as the visual area., 2015-09-15). Let's be consistent and do the same for SwView, so that SwView::PageDown() and all other similar functions do not cause unnecessary invalidations, as this way later we'll realize that SwView's and SwWrtShell's visible area is the same. (cherry picked from commit 7b48a8fb2f0a0d8b854ec00d5f03ec09e8cfa4da) Conflicts: sw/qa/extras/tiledrendering/tiledrendering.cxx Change-Id: Ia22f07ddfb18c6f5ab6cbafede7cf8799b1177a1 diff --git a/sw/qa/extras/tiledrendering/data/pagedown-invalidation.odt b/sw/qa/extras/tiledrendering/data/pagedown-invalidation.odt new file mode 100644 index 000..0cad2d2 Binary files /dev/null and b/sw/qa/extras/tiledrendering/data/pagedown-invalidation.odt differ diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index 48757af..240899c 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -54,6 +54,7 @@ public: void testDocumentSizeChanged(); void testSearchAll(); void testSearchAllNotifications(); +void testPageDownInvalidation(); CPPUNIT_TEST_SUITE(SwTiledRenderingTest); CPPUNIT_TEST(testRegisterCallback); @@ -70,6 +71,7 @@ public: CPPUNIT_TEST(testDocumentSizeChanged); CPPUNIT_TEST(testSearchAll); CPPUNIT_TEST(testSearchAllNotifications); +CPPUNIT_TEST(testPageDownInvalidation); CPPUNIT_TEST_SUITE_END(); private: @@ -84,12 +86,14 @@ private: std::vector m_aSearchResultPart; int m_nSelectionBeforeSearchResult; int m_nSelectionAfterSearchResult; +int m_nInvalidations; }; SwTiledRenderingTest::SwTiledRenderingTest() : m_bFound(true), m_nSelectionBeforeSearchResult(0), -m_nSelectionAfterSearchResult(0) +m_nSelectionAfterSearchResult(0), +m_nInvalidations(0) { } @@ -125,6 +129,7 @@ void SwTiledRenderingTest::callbackImpl(int nType, const char* pPayload) m_aInvalidation.setWidth(aSeq[2].toInt32()); m_aInvalidation.setHeight(aSeq[3].toInt32()); } +++m_nInvalidations; } break; case LOK_CALLBACK_DOCUMENT_SIZE_CHANGED: @@ -494,6 +499,25 @@ void SwTiledRenderingTest::testSearchAllNotifications() comphelper::LibreOfficeKit::setActive(false); } +void SwTiledRenderingTest::testPageDownInvalidation() +{ +comphelper::LibreOfficeKit::setActive(); + +SwXTextDocument* pXTextDocument = createDoc("pagedown-invalidation.odt"); +uno::Sequence aPropertyValues(comphelper::InitPropertySequence( +{ +{".uno:HideWhitespace", uno::makeAny(true)}, +})); +pXTextDocument->initializeForTiledRendering(aPropertyValues); +pXTextDocument->registerCallback(::callback, this); +comphelper::dispatchCommand(".uno:PageDown", uno::Sequence()); + +// This was 2. +CPPUNIT_ASSERT_EQUAL(0, m_nInvalidations); + +comphelper::LibreOfficeKit::setActive(false); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwTiledRenderingTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/uibase/uiview/viewport.cxx b/sw/source/uibase/uiview/viewport.cxx index db2548a..39e908d 100644 --- a/sw/source/uibase/uiview/viewport.cxx +++ b/sw/source/uibase/uiview/viewport.cxx @@ -49,6 +49,7 @@ #include #include +#include // The SetVisArea of the DocShell must not be called from InnerResizePixel. // But our adjustments must take place. @@ -212,7 +213,10 @@ m_aDocSz = rSz; void SwView::SetVisArea( const Rectangle , bool bUpdateScrollbar ) { -const Size aOldSz( m_aVisArea.GetSize() ); +Size aOldSz( m_aVisArea.GetSize() ); +if (comphelper::LibreOfficeKit::isActive() && m_pWrtShell) +// If m_pWrtShell's visible area is the whole document, do the same here. +aOldSz = m_pWrtShell->VisArea().SSize(); const Point aTopLeft( AlignToPixel( rRect.TopLeft() )); const Point aBottomRight( AlignToPixel( rRect.BottomRight() )); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - sw/qa sw/source
sw/qa/extras/uiwriter/uiwriter.cxx | 97 + sw/source/core/txtnode/thints.cxx |7 +- 2 files changed, 100 insertions(+), 4 deletions(-) New commits: commit 15d7875a814c4772d591bc26db9db6c1bffada09 Author: Jan-Marek GlogowskiDate: Wed Dec 30 01:20:23 2015 +0100 tdf#96479 workaround bookmark end pos handling... ... when inserting text into a text node. Seems SwTextNode::InsertText doesn't handle bookmark end positions correctly. This is just handled correctly, if it also contains the bookmark start. This workaround simply concats the three strings to be inserted in advance, so we just have to call SwTextNode::InsertText once for the whole string. (cherry picked from commit c91024891ff10c2ae01e11a28a9aecca2f36b6c3) Conflicts: sw/qa/extras/uiwriter/uiwriter.cxx loplugin:stringconstant (cherry picked from commit 67d440e6bd2c895833fa22d0f9bf5dc6901723e8) loplugin:stringconstant (cherry picked from commit 6aa4496c789fec271dcdc7995cf62ef2dabf1f96) Reviewed-on: https://gerrit.libreoffice.org/21077 Reviewed-by: Miklos Vajna Tested-by: Miklos Vajna (cherry picked from commit e781a8273eb2938f905485c00fbaf432e517d1dc) Conflicts: sw/qa/extras/uiwriter/uiwriter.cxx 588a9c0205e03f701b617fd1775e7f9b9b88c6b0 60ee2ccc6090c305ade4ba16d3d298866cf89c4e Reviewed-on: https://gerrit.libreoffice.org/21137 Tested-by: Jenkins Reviewed-by: Miklos Vajna (cherry picked from commit 107664a977c4893a0bc02f10cd20411c330b6d94) Change-Id: Iab7708b4cc4df406bdbc3a685c7410e0e797fdc4 diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index ce38f1e..f9d4a70b 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -109,6 +109,7 @@ public: void testTdf96943(); void testTdf96536(); void testTdf96961(); +void testTdf96479(); CPPUNIT_TEST_SUITE(SwUiWriterTest); CPPUNIT_TEST(testReplaceForward); @@ -155,6 +156,7 @@ public: CPPUNIT_TEST(testTdf96943); CPPUNIT_TEST(testTdf96536); CPPUNIT_TEST(testTdf96961); +CPPUNIT_TEST(testTdf96479); CPPUNIT_TEST_SUITE_END(); @@ -1243,6 +1245,101 @@ void SwUiWriterTest::testTdf96961() CPPUNIT_ASSERT(nLast > nOther); } +void SwUiWriterTest::testTdf96479() +{ +// We want to verify the empty input text field in the bookmark +static const OUString emptyInputTextField = +OUStringLiteral1() + OUStringLiteral1(); + +SwDoc* pDoc = createDoc(); +SwXTextDocument *xTextDoc = dynamic_cast(mxComponent.get()); +CPPUNIT_ASSERT(xTextDoc); + +// So we can clean up all references for reload +{ +// Append bookmark +SwNodeIndex aIdx(pDoc->GetNodes().GetEndOfContent(), -1); +SwPaM aPaM(aIdx); +IDocumentMarkAccess = *pDoc->getIDocumentMarkAccess(); +sw::mark::IMark *pMark = +rIDMA.makeMark(aPaM, "original", IDocumentMarkAccess::MarkType::BOOKMARK); +CPPUNIT_ASSERT(!pMark->IsExpanded()); +CPPUNIT_ASSERT_EQUAL(sal_Int32(1), rIDMA.getBookmarksCount()); + +// Get helper objects +uno::Reference xBookmarksSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xFactory(mxComponent, uno::UNO_QUERY); + +// Create cursor from bookmark +uno::Reference xTextContent(xBookmarksSupplier->getBookmarks()->getByName("original"), uno::UNO_QUERY); +uno::Reference xRange(xTextContent->getAnchor(), uno::UNO_QUERY); +uno::Reference xCursor(xRange->getText()->createTextCursorByRange(xRange), uno::UNO_QUERY); +CPPUNIT_ASSERT(xCursor->isCollapsed()); + +// Remove bookmark +xRange->getText()->removeTextContent(xTextContent); +CPPUNIT_ASSERT_EQUAL(sal_Int32(0), rIDMA.getBookmarksCount()); + +// Insert replacement bookmark +uno::Reference xBookmarkNew(xFactory->createInstance("com.sun.star.text.Bookmark"), uno::UNO_QUERY); +uno::Reference xBookmarkName(xBookmarkNew, uno::UNO_QUERY); +xBookmarkName->setName("replacement"); +CPPUNIT_ASSERT(xCursor->isCollapsed()); +// Force bookmark expansion +xCursor->getText()->insertString(xCursor, ".", true); +xCursor->getText()->insertTextContent(xCursor, xBookmarkNew, true); +CPPUNIT_ASSERT_EQUAL(sal_Int32(1), rIDMA.getBookmarksCount()); +auto mark = *(rIDMA.getBookmarksBegin()); +CPPUNIT_ASSERT(mark->IsExpanded()); + +// Create and insert input textfield with some content +uno::Reference xTextField(xFactory->createInstance("com.sun.star.text.TextField.Input"), uno::UNO_QUERY); +uno::Reference
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - sw/qa sw/source
sw/qa/extras/tiledrendering/tiledrendering.cxx | 35 - sw/source/core/crsr/viscrs.cxx |3 +- sw/source/uibase/uiview/viewsrch.cxx |9 ++ 3 files changed, 45 insertions(+), 2 deletions(-) New commits: commit aa82ad378a78a039c3bc00da8df021d3a22697b3 Author: Miklos VajnaDate: Fri Jan 15 08:24:09 2016 +0100 sw tiled rendering: it's pointless to send selection changes during search all (cherry picked from commit 07054b050eb24442be92c1733aee27fe0a80ef69) Change-Id: Iad3436c74d0ff95c84b5da870124b1e335241ca2 diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index 4901653..48757af 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -53,6 +53,7 @@ public: void testSearchTextFrameWrapAround(); void testDocumentSizeChanged(); void testSearchAll(); +void testSearchAllNotifications(); CPPUNIT_TEST_SUITE(SwTiledRenderingTest); CPPUNIT_TEST(testRegisterCallback); @@ -68,6 +69,7 @@ public: CPPUNIT_TEST(testSearchTextFrameWrapAround); CPPUNIT_TEST(testDocumentSizeChanged); CPPUNIT_TEST(testSearchAll); +CPPUNIT_TEST(testSearchAllNotifications); CPPUNIT_TEST_SUITE_END(); private: @@ -80,10 +82,14 @@ private: bool m_bFound; std::vector m_aSearchResultSelection; std::vector m_aSearchResultPart; +int m_nSelectionBeforeSearchResult; +int m_nSelectionAfterSearchResult; }; SwTiledRenderingTest::SwTiledRenderingTest() -: m_bFound(true) +: m_bFound(true), +m_nSelectionBeforeSearchResult(0), +m_nSelectionAfterSearchResult(0) { } @@ -132,6 +138,10 @@ void SwTiledRenderingTest::callbackImpl(int nType, const char* pPayload) case LOK_CALLBACK_TEXT_SELECTION: { m_aTextSelection = pPayload; +if (m_aSearchResultSelection.empty()) +++m_nSelectionBeforeSearchResult; +else +++m_nSelectionAfterSearchResult; } break; case LOK_CALLBACK_SEARCH_NOT_FOUND: @@ -461,6 +471,29 @@ void SwTiledRenderingTest::testSearchAll() comphelper::LibreOfficeKit::setActive(false); } +void SwTiledRenderingTest::testSearchAllNotifications() +{ +comphelper::LibreOfficeKit::setActive(); +SwXTextDocument* pXTextDocument = createDoc("search.odt"); +pXTextDocument->registerCallback(::callback, this); +uno::Sequence aPropertyValues(comphelper::InitPropertySequence( +{ +{"SearchItem.SearchString", uno::makeAny(OUString("shape"))}, +{"SearchItem.Backward", uno::makeAny(false)}, +{"SearchItem.Command", uno::makeAny(static_cast(SvxSearchCmd::FIND_ALL))}, +})); +comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues); +Application::Reschedule(true); +Scheduler::ProcessTaskScheduling(false); + +// This was 5, make sure that we get no notifications about selection changes during search. +CPPUNIT_ASSERT_EQUAL(0, m_nSelectionBeforeSearchResult); +// But we do get the selection afterwards. +CPPUNIT_ASSERT(m_nSelectionAfterSearchResult > 0); + +comphelper::LibreOfficeKit::setActive(false); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwTiledRenderingTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index ff37421..1a0d423 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -364,7 +364,8 @@ void SwSelPaintRects::Show(std::vector* pSelectionRectangles) // being edited. if (comphelper::LibreOfficeKit::isActive() && !pView->GetTextEditObject()) { -if (!empty()) +// If pSelectionRectangles is set, we're just collecting the text selections -> don't emit start/end. +if (!empty() && !pSelectionRectangles) { // The selection may be a complex polygon, emit the logical // start/end cursor rectangle of the selection as separate diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx index 98d2925..f3f30ce 100644 --- a/sw/source/uibase/uiview/viewsrch.cxx +++ b/sw/source/uibase/uiview/viewsrch.cxx @@ -71,6 +71,8 @@ #include #include #include +#include +#include #include "PostItMgr.hxx" @@ -275,7 +277,14 @@ void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage) break; case SvxSearchCmd::FIND_ALL: { +// Disable LOK selection notifications during search. +SwDrawModel* pModel = m_pWrtShell->getIDocumentDrawModelAccess()->GetDrawModel(); +if (pModel) +pModel->setTiledSearching(true); bool bRet = SearchAll(); +if (pModel) +pModel->setTiledSearching(false); + if(