From 0a7b6388dfbf4da351e1a52d7f6571b86e10ae99 Mon Sep 17 00:00:00 2001 From: Muhammet Kara Date: Wed, 20 Nov 2019 15:30:01 +0300 Subject: Add Edit Chart button for online's mobile view To improve UX by providing mobile viewers a way to enter into edit mode of a chart via single tap Change-Id: I3cfb82df166c571a401f195a7f7c806fd6df604e Reviewed-on: https://gerrit.libreoffice.org/83614 Tested-by: Jenkins CollaboraOffice Reviewed-by: Muhammet Kara Reviewed-on: https://gerrit.libreoffice.org/85091 Tested-by: Jenkins --- .../sidebar/possize/PosSizePropertyPanel.cxx | 34 +++++++++++- .../sidebar/possize/PosSizePropertyPanel.hxx | 4 ++ svx/uiconfig/ui/sidebarpossize.ui | 62 ++++++++++------------ 3 files changed, 65 insertions(+), 35 deletions(-) (limited to 'svx') diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx index 69b4739ede2c..d631d5e57499 100644 --- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -49,6 +50,7 @@ #include #include +#include using namespace css; using namespace css::uno; @@ -107,6 +109,7 @@ PosSizePropertyPanel::PosSizePropertyPanel( get( mpDial, "orientationcontrol" ); get( mpFtFlip, "fliplabel" ); get( mpFlipTbx, "selectrotationtype" ); + get( mpBtnEditChart, "btnEditChart" ); Initialize(); mpBindings->Update( SID_ATTR_METRIC ); @@ -136,6 +139,7 @@ void PosSizePropertyPanel::dispose() mpDial.clear(); mpFtFlip.clear(); mpFlipTbx.clear(); + mpBtnEditChart.clear(); maTransfPosXControl.dispose(); maTransfPosYControl.dispose(); @@ -205,6 +209,8 @@ void PosSizePropertyPanel::Initialize() //flip: mpFlipTbx->SetSelectHdl( LINK( this, PosSizePropertyPanel, FlipHdl) ); + mpBtnEditChart->SetClickHdl( LINK( this, PosSizePropertyPanel, ClickChartEditHdl ) ); + mpMtrAngle->InsertValue(0, FieldUnit::CUSTOM); mpMtrAngle->InsertValue(4500, FieldUnit::CUSTOM); mpMtrAngle->InsertValue(9000, FieldUnit::CUSTOM); @@ -270,6 +276,8 @@ void PosSizePropertyPanel::HandleContextChange( bool bShowPosition = false; bool bShowAngle = false; bool bShowFlip = false; + bool bShowEditChart = false; + bool bIsMobile = comphelper::LibreOfficeKit::isActive() && comphelper::LibreOfficeKit::isMobile(SfxLokHelper::getView()); switch (maContext.GetCombinedContext_DI()) { @@ -295,14 +303,24 @@ void PosSizePropertyPanel::HandleContextChange( bShowFlip = true; break; + case CombinedEnumContext(Application::WriterVariants, Context::OLE): + if (bIsMobile) + bShowEditChart = true; + break; + + case CombinedEnumContext(Application::Calc, Context::OLE): + case CombinedEnumContext(Application::DrawImpress, Context::OLE): + bShowPosition = true; + if (bIsMobile) + bShowEditChart = true; + break; + case CombinedEnumContext(Application::Calc, Context::Chart): case CombinedEnumContext(Application::Calc, Context::Form): case CombinedEnumContext(Application::Calc, Context::Media): - case CombinedEnumContext(Application::Calc, Context::OLE): case CombinedEnumContext(Application::Calc, Context::MultiObject): case CombinedEnumContext(Application::DrawImpress, Context::Media): case CombinedEnumContext(Application::DrawImpress, Context::Form): - case CombinedEnumContext(Application::DrawImpress, Context::OLE): case CombinedEnumContext(Application::DrawImpress, Context::ThreeDObject): case CombinedEnumContext(Application::DrawImpress, Context::MultiObject): bShowPosition = true; @@ -324,6 +342,9 @@ void PosSizePropertyPanel::HandleContextChange( mpFtFlip->Show(bShowFlip); mpFlipTbx->Show(bShowFlip); + // Edit Chart + mpBtnEditChart->Show(bShowEditChart); + if (mxSidebar.is()) mxSidebar->requestLayout(); } @@ -498,6 +519,15 @@ IMPL_LINK( PosSizePropertyPanel, FlipHdl, ToolBox*, pBox, void ) } } +IMPL_STATIC_LINK_NOARG( PosSizePropertyPanel, ClickChartEditHdl, Button*, void ) +{ + SfxViewShell* pCurSh = SfxViewShell::Current(); + if ( pCurSh) + { + pCurSh->DoVerb( -1 ); + } +} + void PosSizePropertyPanel::NotifyItemUpdate( sal_uInt16 nSID, diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.hxx b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx index d73275f2b6d5..f049d5e4ef9e 100644 --- a/svx/source/sidebar/possize/PosSizePropertyPanel.hxx +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx @@ -113,6 +113,9 @@ private: VclPtr mpFtFlip; VclPtr mpFlipTbx; + //edit charts button for online's mobile view + VclPtr mpBtnEditChart; + // Internal variables basegfx::B2DRange maRect; basegfx::B2DRange maWorkArea; @@ -159,6 +162,7 @@ private: DECL_LINK( AngleModifiedHdl, Edit&, void ); DECL_LINK( RotationHdl, svx::DialControl*, void ); DECL_LINK( FlipHdl, ToolBox *, void ); + DECL_STATIC_LINK( PosSizePropertyPanel, ClickChartEditHdl, Button*, void ); void Initialize(); void executeSize(); diff --git a/svx/uiconfig/ui/sidebarpossize.ui b/svx/uiconfig/ui/sidebarpossize.ui index 3f584ac4d31f..8605a49d387e 100644 --- a/svx/uiconfig/ui/sidebarpossize.ui +++ b/svx/uiconfig/ui/sidebarpossize.ui @@ -1,10 +1,11 @@ + -180 - 359.99 + 359.99000000000001 5 20 @@ -38,15 +39,13 @@ True False True - 0 Position _X: True + 0 0 0 - 1 - 1 @@ -60,15 +59,13 @@ - Horizontal + Horizontal 0 1 - 1 - 1 @@ -76,15 +73,13 @@ True False True - 0 Position _Y: True + 0 1 0 - 1 - 1 @@ -98,15 +93,13 @@ - Vertical + Vertical 1 1 - 1 - 1 @@ -114,15 +107,13 @@ True False True - 0 _Width: True + 0 0 2 - 1 - 1 @@ -137,15 +128,13 @@ - Width + Width 0 3 - 1 - 1 @@ -153,15 +142,13 @@ True False True - 0 H_eight: True + 0 1 2 - 1 - 1 @@ -176,15 +163,13 @@ - Height + Height 1 3 - 1 - 1 @@ -216,9 +201,9 @@ True False - 0 _Rotation: True + 0 False @@ -243,7 +228,7 @@ - Rotation + Rotation @@ -285,10 +270,10 @@ True False True - 0 _Flip: True right + 0 True @@ -301,9 +286,6 @@ True True end - - - True @@ -332,6 +314,9 @@ True + + + True @@ -448,6 +433,19 @@ 4 + + + Edit Chart + True + True + True + + + False + True + 5 + + False @@ -459,8 +457,6 @@ 0 0 - 1 - 1 -- cgit