summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-01-25 11:15:46 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-01-30 09:43:05 +0000
commitd0f40119e25df0aff6974c76cf3dc64a9629492e (patch)
tree162476ffd890d8342050ab43fd5a7e45f29ac371 /sd
parent0cfda5204184fa937a948b3d273ac1083896bcc7 (diff)
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/33553 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.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 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.