diff options
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/func/futext.cxx | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/sd/source/ui/func/futext.cxx b/sd/source/ui/func/futext.cxx index 1657d2a39895..37fb65c97943 100644 --- a/sd/source/ui/func/futext.cxx +++ b/sd/source/ui/func/futext.cxx @@ -40,6 +40,7 @@ #include <sfx2/request.hxx> #include <editeng/editeng.hxx> #include <svx/svdoutl.hxx> +#include <svx/svdotable.hxx> #include <svx/svxids.hrc> #include <sfx2/docfile.hxx> #include <comphelper/processfactory.hxx> @@ -1358,6 +1359,24 @@ 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 ) @@ -1377,8 +1396,32 @@ void FuText::ChangeFontSize( bool bGrow, OutlinerView* pOLV, const FontList* pFo SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( rMarkList.GetMark(nMark)->GetMarkedSdrObj() ); 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()) + { + // 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); + } 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. |