diff options
author | Tamás Zolnai <tamas.zolnai@collabora.com> | 2017-10-28 18:02:46 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2018-02-21 10:07:00 +0100 |
commit | a8a34468f9988ef7633a7b63f825cc484b5dc60f (patch) | |
tree | 59bc2137388b43eae1cd1710e1b2182daf63b3a4 /sd | |
parent | bc5bf595c1c8fe61ecf461786d0b7ebba7a74f1b (diff) |
tdf#110357: Impress table looses selection when clicking on ...
... Increase \ decrease font button
Change-Id: I52cf853de01b06c6c9db9779f15174f895789da8
Reviewed-on: https://gerrit.libreoffice.org/43962
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/50049
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/tiledrendering/data/tdf105502.odp | bin | 11376 -> 11629 bytes | |||
-rw-r--r-- | sd/qa/unit/tiledrendering/tiledrendering.cxx | 12 | ||||
-rw-r--r-- | sd/source/ui/func/futext.cxx | 41 |
3 files changed, 12 insertions, 41 deletions
diff --git a/sd/qa/unit/tiledrendering/data/tdf105502.odp b/sd/qa/unit/tiledrendering/data/tdf105502.odp Binary files differindex 6fe818090c8b..2150f1152ba7 100644 --- a/sd/qa/unit/tiledrendering/data/tdf105502.odp +++ b/sd/qa/unit/tiledrendering/data/tdf105502.odp diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 721efa9be498..34ff527549df 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -1590,13 +1590,21 @@ void SdTiledRenderingTest::testTdf105502() // Assert that the selected A1 has now a larger font than the unselected // A2. xmlDocPtr pXmlDoc = parseXmlDump(); - sal_Int32 nA1Height = getXPath(pXmlDoc, "//Cell[1]/SdrText/OutlinerParaObject/EditTextObject/ContentInfo/attribs[1]/SvxFontHeightItem", "height").toInt32(); + sal_Int32 nA1Height = getXPath(pXmlDoc, "//Cell[1]/SdrText/OutlinerParaObject/EditTextObject/ContentInfo/SfxItemSet/SvxFontHeightItem[1]", "height").toInt32(); sal_Int32 nA2Height = getXPath(pXmlDoc, "//Cell[3]/SdrText/OutlinerParaObject/EditTextObject/ContentInfo/attribs[1]/SvxFontHeightItem", "height").toInt32(); // This failed when FuText::ChangeFontSize() never did "continue" in the // text loop, instead of doing so depending on what IsInSelection() returns. CPPUNIT_ASSERT(nA1Height > nA2Height); - xmlFreeDoc(pXmlDoc); + // Check that selection remains the same + CPPUNIT_ASSERT(xSelectionController->hasSelectedCells()); + xSelectionController->getSelectedCells(aFirstCell, aLastCell); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), aFirstCell.mnCol); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), aFirstCell.mnRow); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), aLastCell.mnCol); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), aLastCell.mnRow); + + xmlFreeDoc(pXmlDoc); comphelper::LibreOfficeKit::setActive(false); } diff --git a/sd/source/ui/func/futext.cxx b/sd/source/ui/func/futext.cxx index 96f595c6a12b..090b590c003f 100644 --- a/sd/source/ui/func/futext.cxx +++ b/sd/source/ui/func/futext.cxx @@ -1361,24 +1361,6 @@ bool FuText::cancel() } } -/// Is rCell covered by the rFirst - rLast selection? -static bool IsInSelection(const sdr::table::CellPos& rFirst, const sdr::table::CellPos& rLast, sdr::table::CellPos& rCell) -{ - if (rCell.mnCol < rFirst.mnCol) - return false; - - if (rCell.mnCol > rLast.mnCol) - return false; - - if (rCell.mnRow < rFirst.mnRow) - return false; - - if (rCell.mnRow > rLast.mnRow) - return false; - - return true; -} - void FuText::ChangeFontSize( bool bGrow, OutlinerView* pOLV, const FontList* pFontList, ::sd::View* pView ) { if( !pFontList || !pView ) @@ -1399,31 +1381,12 @@ void FuText::ChangeFontSize( bool bGrow, OutlinerView* pOLV, const FontList* pFo if( pTextObj ) { rtl::Reference<sdr::SelectionController> xSelectionController(pView->getSelectionController()); - sdr::table::CellPos aFirstCell; - sdr::table::CellPos aLastCell; - sdr::table::SdrTableObj* pTableObject = nullptr; - if (xSelectionController.is() && xSelectionController->hasSelectedCells()) + if (xSelectionController.is() && xSelectionController->ChangeFontSize(bGrow, pFontList)) { - // This is a table object, and one or more of its cells are - // selected. - xSelectionController->getSelectedCells(aFirstCell, aLastCell); - pTableObject = dynamic_cast<sdr::table::SdrTableObj*>(pTextObj); + continue; } for( sal_Int32 nText = 0; nText < pTextObj->getTextCount(); nText++ ) { - if (pTableObject) - { - sal_Int32 nColCount = pTableObject->getColumnCount(); - if (nColCount > 0) - { - sdr::table::CellPos aPos(nText % nColCount, nText / nColCount); - if (!IsInSelection(aFirstCell, aLastCell, aPos)) - // There is a selection, but this cell is not - // part of it: don't change font size. - continue; - } - } - pTextObj->setActiveText( nText ); // Put text object into edit mode. |