make AutoFill work for Copy cells and Fill series FID_FILL_AUTO (.uno:AutoFill): - added new parameter: SfxBoolItem Copy FN_PARAM_1 - if the parameter is true, we use "Copy cells", otherwise use "Fill series" Signed-off-by: Bayram Çiçek <bayram.cicek@collabora.com> Change-Id: I639828021dcbba52f6bc21366f23faf7e38bb03e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167726 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> (cherry picked from commit 95575b8bd026e3ae4aaddf3a023488d7a5fa0976) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167677 Tested-by: Jenkins
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi index 4240bb5..3591ca1 100644 --- a/sc/sdi/scalc.sdi +++ b/sc/sdi/scalc.sdi
@@ -338,7 +338,7 @@ SfxVoidItem AutoFill FID_FILL_AUTO (SfxStringItem EndCell FID_FILL_AUTO) (SfxStringItem EndCell FID_FILL_AUTO,SfxBoolItem Copy FN_PARAM_1) [ AutoUpdate = FALSE, FastCall = FALSE,
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index ae55a33..3c59c4d 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx
@@ -876,6 +876,9 @@ SCROW nFillRow = GetViewData().GetRefEndY(); ScDocument& rDoc = GetViewData().GetDocument(); sal_uInt16 nOrigScFillModeMouseModifier = nScFillModeMouseModifier; bool bUseSelection = true; if( pReqArgs != nullptr ) { if( const SfxStringItem* pItem = pReqArgs->GetItemIfSet( FID_FILL_AUTO ) ) @@ -888,13 +891,33 @@ nFillRow = aScAddress.Row(); nFillCol = aScAddress.Col(); } SCTAB nStartTab, nEndTab; GetViewData().GetSimpleArea(nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab); bUseSelection = false; } SCTAB nStartTab, nEndTab; GetViewData().GetSimpleArea( nStartCol,nStartRow,nStartTab, nEndCol,nEndRow,nEndTab ); const SfxPoolItem* pItem; if (pReqArgs->HasItem(FN_PARAM_1, &pItem)) { /* nScFillModeMouseModifier controls if we "Copy cells" or "Fill series" - if nScFillModeMouseModifier is set to "KEY_MOD1", use "Copy cells" - otherwise use "Fill series" This is also the same with auto fill by dragging mouse - dragging with Ctrl key will set nScFillModeMouseModifier to KEY_MOD1, use "Copy cells" - only dragging will use "Fill series" (no Ctrl key) */ const bool bCopyCells = static_cast<const SfxBoolItem*>(pItem)->GetValue(); nScFillModeMouseModifier &= ~KEY_MOD1; // turn off, reset to 0 if (bCopyCells) nScFillModeMouseModifier |= KEY_MOD1; // turn on } } else // call via mouse if (bUseSelection) // call via mouse or if FN_PARAM_1 exists { // not in a merged cell @@ -968,6 +991,10 @@ OSL_FAIL( "Direction not unique for autofill" ); } } // reset nScFillModeMouseModifier to its original state // otherwise, auto fill by dragging will not work as expected nScFillModeMouseModifier = nOrigScFillModeMouseModifier; } break; case FID_FILL_SINGLE_EDIT:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4