[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.1' - include/svx sd/source svx/source
Miklos Vajna
vmiklos at collabora.co.uk
Wed Feb 1 11:50:15 UTC 2017
include/svx/sdr/table/tablecontroller.hxx | 3 +-
include/svx/selectioncontroller.hxx | 4 ++
sd/source/ui/func/futext.cxx | 43 ++++++++++++++++++++++++++++++
svx/source/svdraw/selectioncontroller.cxx | 4 ++
4 files changed, 53 insertions(+), 1 deletion(-)
New commits:
commit 3e4e9c94ad2994aa9c5d3f6efb03fb5f2517734f
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Wed Jan 25 11:15:46 2017 +0100
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 at collabora.com>
Tested-by: Jan Holesovsky <kendy at collabora.com>
diff --git a/include/svx/sdr/table/tablecontroller.hxx b/include/svx/sdr/table/tablecontroller.hxx
index d1a87a2..2249e2d 100644
--- a/include/svx/sdr/table/tablecontroller.hxx
+++ b/include/svx/sdr/table/tablecontroller.hxx
@@ -97,7 +97,8 @@ public:
/// @see sdr::SelectionController::setCursorLogicPosition().
SVX_DLLPRIVATE virtual bool setCursorLogicPosition(const Point& rPosition, bool bPoint) override;
- void getSelectedCells( CellPos& rFirstPos, CellPos& rLastPos );
+ /// @see sdr::SelectionController::getSelectedCells().
+ void getSelectedCells( CellPos& rFirstPos, CellPos& rLastPos ) override;
void setSelectedCells( const CellPos& rFirstPos, const CellPos& rLastPos );
void clearSelection();
void selectAll();
diff --git a/include/svx/selectioncontroller.hxx b/include/svx/selectioncontroller.hxx
index 4c4a8e5..d2fb9c4 100644
--- a/include/svx/selectioncontroller.hxx
+++ b/include/svx/selectioncontroller.hxx
@@ -37,6 +37,8 @@ class Point;
namespace sdr
{
+namespace table { struct CellPos; }
+
class SVX_DLLPUBLIC SelectionController: public cppu::OWeakObject
{
public:
@@ -74,6 +76,8 @@ public:
virtual bool hasSelectedCells() const;
/// Allows adjusting the point or mark of the selection to a document coordinate.
virtual bool setCursorLogicPosition(const Point& rPosition, bool bPoint);
+ /// Get the position of the first and the last selected cell.
+ virtual void getSelectedCells(table::CellPos& rFirstPos, table::CellPos& rLastPos);
};
}
diff --git a/sd/source/ui/func/futext.cxx b/sd/source/ui/func/futext.cxx
index 8dd9a50..412c403 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.
diff --git a/svx/source/svdraw/selectioncontroller.cxx b/svx/source/svdraw/selectioncontroller.cxx
index 3138f37..0fc2d52 100644
--- a/svx/source/svdraw/selectioncontroller.cxx
+++ b/svx/source/svdraw/selectioncontroller.cxx
@@ -110,6 +110,10 @@ bool SelectionController::hasSelectedCells() const
return false;
}
+void SelectionController::getSelectedCells(table::CellPos& /*rFirstPos*/, table::CellPos& /*rLastPos*/)
+{
+}
+
bool SelectionController::setCursorLogicPosition(const Point& /*rPosition*/, bool /*bPoint*/)
{
return false;
More information about the Libreoffice-commits
mailing list