summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-01-25 11:15:46 +0100
committerJan Holesovsky <kendy@collabora.com>2017-02-01 11:49:41 +0000
commit3e4e9c94ad2994aa9c5d3f6efb03fb5f2517734f (patch)
treefed4043130ca02b021b11528c8dacb0b0369af1a /sd
parent586626676b0aa697e153c6693a1e1407f7746989 (diff)
bnc#946678 tdf#105502 sd increase font size: handle table selection
In part of a table shape is selected, then only operate on the selected cells, not on all of them. (cherry picked from commit cbc84a6599c08e5c79e544212c69c6946d0cdbf0) Conflicts: sd/qa/unit/tiledrendering/tiledrendering.cxx Change-Id: I3a9ba2b99bcaa2e355b6fcdafdd142d4a809bce6 Reviewed-on: https://gerrit.libreoffice.org/33610 Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/func/futext.cxx43
1 files changed, 43 insertions, 0 deletions
diff --git a/sd/source/ui/func/futext.cxx b/sd/source/ui/func/futext.cxx
index 8dd9a50a3f95..412c4031359d 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>
@@ -1366,6 +1367,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 )
@@ -1384,8 +1403,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.