[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sc/inc sc/source sc/uiconfig

2018-02-21 Thread Marco Cecchetti
 sc/inc/sc.hrc  |1 
 sc/source/core/data/validat.cxx|   46 +++--
 sc/source/filter/excel/xicontent.cxx   |9 
 sc/source/filter/oox/worksheethelper.cxx   |6 ++-
 sc/source/filter/xml/XMLStylesExportHelper.cxx |6 +++
 sc/source/filter/xml/xmlcvali.cxx  |1 
 sc/source/ui/dbgui/validate.cxx|   27 ++
 sc/source/ui/inc/validate.hxx  |1 
 sc/source/ui/view/cellsh2.cxx  |2 -
 sc/uiconfig/scalc/ui/validationcriteriapage.ui |4 ++
 10 files changed, 91 insertions(+), 12 deletions(-)

New commits:
commit 935552e403da4ec93ce74b28e6cb9997560fc781
Author: Marco Cecchetti 
Date:   Thu Feb 1 12:28:54 2018 +0100

tdf#96698 - calc: add support for custom validation (through a formula)

Now it is possible to select a `custom` validation in the validation
dialog: this type of validation let's the user to define a formula,
the cell content is valid when the formula is evaluted to true, and
not valid when evaluated to false.

The `cutom` validation is correctly saved and restored for ods
documents, and is correctly imported and exported to xlsx documents

This patch contains an adaptation of a preliminary work of Justin Luth
for importing custom validation from xlsx documents. Thanks Justin!

Change-Id: Idc26654ba69a6f73d1b208d63acdad4b880c776d
Reviewed-on: https://gerrit.libreoffice.org/49979
Reviewed-by: Jan Holesovsky 
Tested-by: Jan Holesovsky 

diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index 64ae387c84e3..20849ac3cc90 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -954,6 +954,7 @@
 #define SCSTR_VALID_LIST(STR_START + 318)
 
 #define SCSTR_SELECT(STR_START + 319)
+#define SCSTR_VALID_FORMULA (STR_START + 320)
 
 // media shell
 #define SCSTR_MEDIASHELL(STR_START + 401)
diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx
index acc192fcc61e..f311d152a666 100644
--- a/sc/source/core/data/validat.cxx
+++ b/sc/source/core/data/validat.cxx
@@ -524,9 +524,49 @@ bool ScValidationData::IsDataValid( ScRefCellValue& rCell, 
const ScAddress& rPos
 break;
 
 case SC_VALID_CUSTOM:
-//  for Custom, it must be eOp == SC_COND_DIRECT
-//TODO: the value must be in the document !!!
-bOk = IsCellValid(rCell, rPos);
+{
+// for Custom, it must be eOp == ScConditionMode::Direct
+// the value must be in the document !!!
+
+// so we save the original value
+OUString aStrVal = mpDoc->GetString(rPos);
+svl::SharedString aSS = 
mpDoc->GetSharedStringPool().intern(aStrVal);
+std::unique_ptr pEditTextVal;
+std::unique_ptr pFormulaVal;
+
+ScRefCellValue aOriginalCellValue;
+aOriginalCellValue.meType = mpDoc->GetCellType(rPos);
+switch (aOriginalCellValue.meType)
+{
+case CELLTYPE_VALUE:
+aOriginalCellValue.mfValue = mpDoc->GetValue(rPos);
+break;
+case CELLTYPE_STRING:
+aOriginalCellValue.mpString = 
+break;
+case CELLTYPE_EDIT:
+{
+pEditTextVal.reset(new 
EditTextObject(*(mpDoc->GetEditText(rPos;
+aOriginalCellValue.mpEditText =  pEditTextVal.get();
+}
+break;
+case CELLTYPE_FORMULA:
+{
+
pFormulaVal.reset(mpDoc->GetFormulaCell(rPos)->Clone());
+aOriginalCellValue.mpFormula = pFormulaVal.get();
+}
+break;
+case CELLTYPE_NONE:
+break;
+}
+
+// set cell value to current input
+rCell.commit(*mpDoc, rPos);
+// check if the new value is valid
+bOk = IsCellValid(rCell, rPos);
+// and restore the original value
+aOriginalCellValue.commit(*mpDoc, rPos);
+}
 break;
 
 case SC_VALID_TEXTLEN:
diff --git a/sc/source/filter/excel/xicontent.cxx 
b/sc/source/filter/excel/xicontent.cxx
index c1226bcfaf21..1c0503e3fa7c 100644
--- a/sc/source/filter/excel/xicontent.cxx
+++ b/sc/source/filter/excel/xicontent.cxx
@@ -886,6 +886,15 @@ void XclImpValidationManager::ReadDV( XclImpStream& rStrm )
 // No valid validation found.  Bail out.
 return;
 
+// The default value for comparision is _BETWEEN. However, custom
+// rules are a formula, and thus the comparator should 

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sc/inc sc/source

2018-02-21 Thread Eike Rathke
 sc/inc/document.hxx  |5 -
 sc/source/core/data/documen2.cxx |7 +--
 sc/source/core/tool/interpr7.cxx |   28 +++-
 sc/source/ui/unoobj/funcuno.cxx  |2 +-
 4 files changed, 37 insertions(+), 5 deletions(-)

New commits:
commit 392794b9cd5238587cbe5d965aac46bc691a61c6
Author: Eike Rathke 
Date:   Mon Feb 19 23:43:51 2018 +0100

Resolves: tdf#115710 let css::sheet::FunctionAccess execute WEBSERVICE

... independent of a LinkManager that is not present in the
interim FunctionAccess document. FunctionAccess is executed by
extensions, Add-Ons and macros that the user gave permission
already.

(cherry picked from commit 121fda77b0cc16d54607a1f5f7b26c0f1050284f)

Change-Id: I9349a59ee24089c3657de7786b49e5e81946f175

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index a40c07509d27..884651a580ab 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -235,7 +235,8 @@ enum ScDocumentMode
 {
 SCDOCMODE_DOCUMENT,
 SCDOCMODE_CLIP,
-SCDOCMODE_UNDO
+SCDOCMODE_UNDO,
+SCDOCMODE_FUNCTIONACCESS
 };
 
 struct ScDocStat
@@ -422,6 +423,7 @@ private:
 boolbCalculatingFormulaTree;
 boolbIsClip;
 boolbIsUndo;
+boolbIsFunctionAccess;
 boolbIsVisible; // set from view ctor
 
 boolbIsEmbedded;// display/adjust 
Embedded area?
@@ -1376,6 +1378,7 @@ public:
 boolIsClipboard() const { return 
bIsClip; }
 boolIsUndoEnabled() const   { return 
mbUndoEnabled; }
 SC_DLLPUBLIC void EnableUndo( bool bVal );
+boolIsFunctionAccess() const{ return 
bIsFunctionAccess; }
 
 boolIsAdjustHeightEnabled() const   { return 
mbAdjustHeightEnabled; }
 voidEnableAdjustHeight( bool bVal ) { 
mbAdjustHeightEnabled = bVal; }
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index c6016cc15320..18c42893cd0d 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -180,12 +180,13 @@ ScDocument::ScDocument( ScDocumentMode eMode, 
SfxObjectShell* pDocShell ) :
 eHardRecalcState(HARDRECALCSTATE_OFF),
 nVisibleTab( 0 ),
 eLinkMode(LM_UNKNOWN),
-bAutoCalc( eMode == SCDOCMODE_DOCUMENT ),
+bAutoCalc( eMode == SCDOCMODE_DOCUMENT || eMode == 
SCDOCMODE_FUNCTIONACCESS ),
 bAutoCalcShellDisabled( false ),
 bForcedFormulaPending( false ),
 bCalculatingFormulaTree( false ),
 bIsClip( eMode == SCDOCMODE_CLIP ),
 bIsUndo( eMode == SCDOCMODE_UNDO ),
+bIsFunctionAccess( eMode == SCDOCMODE_FUNCTIONACCESS ),
 bIsVisible( false ),
 bIsEmbedded( false ),
 bInsertingFromOtherDoc( false ),
@@ -224,7 +225,9 @@ ScDocument::ScDocument( ScDocumentMode eMode, 
SfxObjectShell* pDocShell ) :
 
 eSrcSet = osl_getThreadTextEncoding();
 
-if ( eMode == SCDOCMODE_DOCUMENT )
+/* TODO: for SCDOCMODE_FUNCTIONACCESS it might not even be necessary to
+ * have all of these available. */
+if ( eMode == SCDOCMODE_DOCUMENT || eMode == SCDOCMODE_FUNCTIONACCESS )
 {
 xPoolHelper = new ScPoolHelper( this );
 
diff --git a/sc/source/core/tool/interpr7.cxx b/sc/source/core/tool/interpr7.cxx
index e2f562848a31..381dd4488ba3 100644
--- a/sc/source/core/tool/interpr7.cxx
+++ b/sc/source/core/tool/interpr7.cxx
@@ -256,6 +256,21 @@ static ScWebServiceLink* lcl_GetWebServiceLink(const 
sfx2::LinkManager* pLinkMgr
 return nullptr;
 }
 
+static bool lcl_FunctionAccessLoadWebServiceLink( OUString& rResult, 
ScDocument* pDoc, const OUString& rURI )
+{
+// For FunctionAccess service always force a changed data update.
+ScWebServiceLink aLink( pDoc, rURI);
+if (aLink.DataChanged( OUString(), css::uno::Any()) != 
sfx2::SvBaseLink::UpdateResult::SUCCESS)
+return false;
+
+if (!aLink.HasResult())
+return false;
+
+rResult = aLink.GetResult();
+
+return true;
+}
+
 void ScInterpreter::ScWebservice()
 {
 sal_uInt8 nParamCount = GetByte();
@@ -279,7 +294,18 @@ void ScInterpreter::ScWebservice()
 
 if (!mpLinkManager)
 {
-PushError(FormulaError::NoValue);
+if (!pDok->IsFunctionAccess() || 
pDok->HasLinkFormulaNeedingCheck())
+{
+PushError( FormulaError::NoValue);
+}
+else
+{
+OUString aResult;
+if (lcl_FunctionAccessLoadWebServiceLink( aResult, pDok, aURI))
+PushString( aResult);
+else
+PushError( FormulaError::NoValue);
+}
 return;
 }
 
diff --git a/sc/source/ui/unoobj/funcuno.cxx 

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sc/inc sc/source

2018-01-15 Thread Marco Cecchetti
 sc/inc/clipparam.hxx  |6 --
 sc/source/core/data/clipparam.cxx |6 ++
 sc/source/ui/view/viewfun3.cxx|   25 -
 3 files changed, 2 insertions(+), 35 deletions(-)

New commits:
commit ace85fd824611349e637f37b9644b6fe62cb
Author: Marco Cecchetti 
Date:   Wed Jan 10 19:19:19 2018 +0100

Revert "lok: sc: copy / paste confusion -- workaround"

This reverts commit 7fc62b59ddad40f725709f14331c38c0a78ff6ee.

This workaround is no more needed because of commit dc916fd

Change-Id: Icd13b245d5965c2b2ece326f7f5705cf06cf1b64
Reviewed-on: https://gerrit.libreoffice.org/47765
Reviewed-by: Jan Holesovsky 
Tested-by: Jan Holesovsky 

diff --git a/sc/inc/clipparam.hxx b/sc/inc/clipparam.hxx
index 16555225d074..2e5dece711e8 100644
--- a/sc/inc/clipparam.hxx
+++ b/sc/inc/clipparam.hxx
@@ -26,8 +26,6 @@
 
 #include 
 
-class SfxViewShell;
-
 /**
  * This struct stores general clipboard parameters associated with a
  * ScDocument instance created in clipboard mode.
@@ -40,7 +38,6 @@ struct ScClipParam
 Direction   meDirection;
 boolmbCutMode;
 sal_uInt32  mnSourceDocID;
-SfxViewShell*   mpSourceView;
 ScRangeListVector   maProtectedChartRangesVector;
 
 ScClipParam();
@@ -70,9 +67,6 @@ struct ScClipParam
 
 sal_uInt32 getSourceDocID() const { return mnSourceDocID; }
 void setSourceDocID( sal_uInt32 nVal ) { mnSourceDocID = nVal; }
-
-SfxViewShell* getSourceView() const { return mpSourceView; }
-void setSourceView( SfxViewShell* pSourceView ) { mpSourceView = 
pSourceView; }
 };
 
 #endif
diff --git a/sc/source/core/data/clipparam.cxx 
b/sc/source/core/data/clipparam.cxx
index bc856672fbba..9c08d6093dfc 100644
--- a/sc/source/core/data/clipparam.cxx
+++ b/sc/source/core/data/clipparam.cxx
@@ -23,16 +23,14 @@
 ScClipParam::ScClipParam() :
 meDirection(Unspecified),
 mbCutMode(false),
-mnSourceDocID(0),
-mpSourceView(nullptr)
+mnSourceDocID(0)
 {
 }
 
 ScClipParam::ScClipParam(const ScRange& rRange, bool bCutMode) :
 meDirection(Unspecified),
 mbCutMode(bCutMode),
-mnSourceDocID(0),
-mpSourceView(nullptr)
+mnSourceDocID(0)
 {
 maRanges.Append(rRange);
 }
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index 712db2c511e7..719ebda2d4c1 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -37,9 +37,6 @@
 #include 
 #include 
 
-#include 
-#include 
-
 #include "attrib.hxx"
 #include "patattr.hxx"
 #include "dociter.hxx"
@@ -228,14 +225,6 @@ bool ScViewFunc::CopyToClip( ScDocument* pClipDoc, const 
ScRangeList& rRanges, b
 // and lose the 'if' above
 aClipParam.setSourceDocID( pDoc->GetDocumentID() );
 
-// This is only a workaround, which doesn't allow to paste content
-// in one view which has been copied in a different view.
-// TODO: implement a solution providing one clipboard per view
-if (comphelper::LibreOfficeKit::isActive())
-{
-aClipParam.setSourceView(GetViewData().GetViewShell());
-}
-
 if (SfxObjectShell* pObjectShell = pDoc->GetDocumentShell())
 {
 // Copy document properties from pObjectShell to pClipDoc (to 
its clip options, as it has no object shell).
@@ -879,20 +868,6 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, 
ScDocument* pClipDoc,
 if (GetViewData().SelectionForbidsCellFill())
 return false;
 
-// This is only a workaround, which doesn't allow to paste content
-// in one view which has been copied in a different view.
-// TODO: implement a solution providing one clipboard per view
-if (comphelper::LibreOfficeKit::isActive())
-{
-ScTabViewShell* pThisView = GetViewData().GetViewShell();
-ScTabViewShell* pSourceView = 
dynamic_cast(pClipDoc->GetClipParam().getSourceView());
-
-if (pThisView && pSourceView && pThisView != pSourceView)
-{
-return false;
-}
-}
-
 //  undo: save all or no content
 InsertDeleteFlags nContFlags = InsertDeleteFlags::NONE;
 if (nFlags & InsertDeleteFlags::CONTENTS)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sc/inc sc/source

2017-12-18 Thread Ashod Nakashian
 sc/inc/attarray.hxx  |3 
 sc/inc/column.hxx|   13 +--
 sc/source/core/data/cellvalue.cxx|4 -
 sc/source/core/data/column.cxx   |  103 +++--
 sc/source/core/data/column2.cxx  |   30 +---
 sc/source/core/data/column3.cxx  |  107 ---
 sc/source/core/data/column4.cxx  |   19 +++--
 sc/source/core/data/dociter.cxx  |4 -
 sc/source/core/data/table4.cxx   |2 
 sc/source/ui/docshell/externalrefmgr.cxx |2 
 10 files changed, 153 insertions(+), 134 deletions(-)

New commits:
commit dc3f0bde0bdef2a1e94055be146b433cb9fc54ba
Author: Ashod Nakashian 
Date:   Wed Dec 6 19:41:45 2017 -0500

sc: compact ScColumn

Remove ScDocument* member from ScColumn
and re-use the one in ScAttrArray.

This saves 8 bytes and makes the code more
homogenious by using GetDoc() member everywhere.

Change-Id: I16a94b7ef7c45ef3af14e812b45f255f39939a6e
(cherry picked from commit 1168a11278ed3c2a00058e1f802f6e44cb925318)
Reviewed-on: https://gerrit.libreoffice.org/46680
Reviewed-by: Jan Holesovsky 
Tested-by: Jan Holesovsky 

diff --git a/sc/inc/attarray.hxx b/sc/inc/attarray.hxx
index 49626ea9e124..e6cfbab5201f 100644
--- a/sc/inc/attarray.hxx
+++ b/sc/inc/attarray.hxx
@@ -83,7 +83,7 @@ class ScAttrArray
 private:
 SCCOL   nCol;
 SCTAB   nTab;
-ScDocument* pDocument;
+ScDocument* const pDocument;
 
 SCSIZE  nCount;
 SCSIZE  nLimit;
@@ -109,6 +109,7 @@ public:
 ScAttrArray( SCCOL nNewCol, SCTAB nNewTab, ScDocument* pDoc, 
ScAttrArray* pNextColAttrArray = nullptr, bool bCreateEmpty = false );
 ~ScAttrArray();
 
+ScDocument* GetDoc() { return pDocument; }
 voidSetTab(SCTAB nNewTab)   { nTab = nNewTab; }
 voidSetCol(SCCOL nNewCol)   { nCol = nNewCol; }
 #if DEBUG_SC_TESTATTRARRAY
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 569f1ec06e5c..93ed1ce94e8d 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -29,6 +29,7 @@
 #include "mtvelements.hxx"
 #include 
 #include 
+#include "attarray.hxx"
 
 #include 
 #include 
@@ -137,14 +138,13 @@ class ScColumn
 // Cell values.
 sc::CellStoreType maCells;
 
-SCCOL   nCol;
-SCTAB   nTab;
-
-ScAttrArray*  pAttrArray;
-ScDocument*   pDocument;
+ScAttrArray* pAttrArray;
 
 size_t mnBlkCountFormula;
 
+SCCOL   nCol;
+SCTAB   nTab;
+
 friend class ScDocument;// for FillInfo
 friend class ScTable;
 friend class ScValueIterator;
@@ -188,8 +188,7 @@ public:
 
 voidInit(SCCOL nNewCol, SCTAB nNewTab, ScDocument* pDoc, bool 
bEmptyAttrArray = false);
 
-ScDocument& GetDoc() { return *pDocument;}
-const ScDocument& GetDoc() const { return *pDocument;}
+ScDocument* GetDoc() const { return pAttrArray->GetDoc(); }
 SCTAB GetTab() const { return nTab; }
 SCCOL GetCol() const { return nCol; }
 sc::CellStoreType& GetCellStore() { return maCells; }
diff --git a/sc/source/core/data/cellvalue.cxx 
b/sc/source/core/data/cellvalue.cxx
index 75b7c5bbb12f..5eb57751b312 100644
--- a/sc/source/core/data/cellvalue.cxx
+++ b/sc/source/core/data/cellvalue.cxx
@@ -115,7 +115,7 @@ void commitToColumn( const ScCellValue& rCell, ScColumn& 
rColumn, SCROW nRow )
 rColumn.SetRawString(nRow, *rCell.mpString);
 break;
 case CELLTYPE_EDIT:
-rColumn.SetEditText(nRow, ScEditUtil::Clone(*rCell.mpEditText, 
rColumn.GetDoc()));
+rColumn.SetEditText(nRow, ScEditUtil::Clone(*rCell.mpEditText, 
*rColumn.GetDoc()));
 break;
 case CELLTYPE_VALUE:
 rColumn.SetValue(nRow, rCell.mfValue);
@@ -123,7 +123,7 @@ void commitToColumn( const ScCellValue& rCell, ScColumn& 
rColumn, SCROW nRow )
 case CELLTYPE_FORMULA:
 {
 ScAddress aDestPos(rColumn.GetCol(), nRow, rColumn.GetTab());
-rColumn.SetFormulaCell(nRow, new ScFormulaCell(*rCell.mpFormula, 
rColumn.GetDoc(), aDestPos));
+rColumn.SetFormulaCell(nRow, new ScFormulaCell(*rCell.mpFormula, 
*rColumn.GetDoc(), aDestPos));
 }
 break;
 default:
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 350b5b19a67f..5c9b00ee12a1 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -88,11 +88,10 @@ ScColumn::ScColumn() :
 maBroadcasters(MAXROWCOUNT),
 maCellsEvent(this),
 maCells(maCellsEvent),
-nCol( 0 ),
-nTab( 0 ),
 pAttrArray( nullptr ),
-pDocument( nullptr ),
-mnBlkCountFormula(0)
+mnBlkCountFormula(0),
+nCol( 0 ),
+nTab( 0 )
 {
 maCells.resize(MAXROWCOUNT);
 }
@@ -107,11 +106,10 @@ void 

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sc/inc sc/source

2017-08-15 Thread Tamas Bunth
 sc/inc/queryparam.hxx  |3 ++-
 sc/source/core/tool/queryparam.cxx |   11 ++-
 sc/source/ui/view/gridwin.cxx  |   10 --
 3 files changed, 16 insertions(+), 8 deletions(-)

New commits:
commit 01b1870736641f954d06d8e23589225b41a4e890
Author: Tamas Bunth 
Date:   Fri Aug 11 00:45:59 2017 +0200

tdf#107797 UpdateAutoFilter handle more entries

Prepare UpdateAutoFilterFromMenu to handle more entries.

Filter items can be hold by more than one entries. In that case we have
to remove all the old entries before updating.

E.g. setting AutoFilter from vba script results in more than one
entries.

Change-Id: I4f18f26281d0b8e689cd331f9a66f4c344fb6c6b
Reviewed-on: https://gerrit.libreoffice.org/40967
Tested-by: Jenkins 
Reviewed-by: Tamás Bunth 
Reviewed-on: https://gerrit.libreoffice.org/41042
Reviewed-by: Aron Budea 
Tested-by: Aron Budea 

diff --git a/sc/inc/queryparam.hxx b/sc/inc/queryparam.hxx
index 16b4573c9fa6..ee31f473ae7a 100644
--- a/sc/inc/queryparam.hxx
+++ b/sc/inc/queryparam.hxx
@@ -58,7 +58,8 @@ struct ScQueryParamBase
 SC_DLLPUBLIC ScQueryEntry& AppendEntry();
 ScQueryEntry* FindEntryByField(SCCOLROW nField, bool bNew);
 std::vector FindAllEntriesByField(SCCOLROW nField);
-SC_DLLPUBLIC void RemoveEntryByField(SCCOLROW nField);
+SC_DLLPUBLIC bool RemoveEntryByField(SCCOLROW nField);
+SC_DLLPUBLIC void RemoveAllEntriesByField(SCCOLROW nField);
 void Resize(size_t nNew);
 void FillInExcelSyntax( svl::SharedStringPool& rPool, const OUString& 
aCellStr, SCSIZE nIndex,
 SvNumberFormatter* pFormatter );
diff --git a/sc/source/core/tool/queryparam.cxx 
b/sc/source/core/tool/queryparam.cxx
index f5630b66b565..197141c90c74 100644
--- a/sc/source/core/tool/queryparam.cxx
+++ b/sc/source/core/tool/queryparam.cxx
@@ -160,10 +160,11 @@ std::vector 
ScQueryParamBase::FindAllEntriesByField(SCCOLROW nFie
 return aEntries;
 }
 
-void ScQueryParamBase::RemoveEntryByField(SCCOLROW nField)
+bool ScQueryParamBase::RemoveEntryByField(SCCOLROW nField)
 {
 EntriesType::iterator itr = std::find_if(
 m_Entries.begin(), m_Entries.end(), FindByField(nField));
+bool bRet = false;
 
 if (itr != m_Entries.end())
 {
@@ -172,7 +173,15 @@ void ScQueryParamBase::RemoveEntryByField(SCCOLROW nField)
 // Make sure that we have at least MAXQUERY number of entries at
 // all times.
 m_Entries.push_back(o3tl::make_unique());
+bRet = true;
 }
+
+return bRet;
+}
+
+void ScQueryParamBase::RemoveAllEntriesByField(SCCOLROW nField)
+{
+while( RemoveEntryByField( nField ) ) {}
 }
 
 void ScQueryParamBase::Resize(size_t nNew)
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index d2a1223e86ce..243e2ea62ea7 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -833,12 +833,10 @@ void 
ScGridWindow::UpdateAutoFilterFromMenu(AutoFilterMode eMode)
 ScQueryParam aParam;
 pDBData->GetQueryParam(aParam);
 
-if (eMode == Normal && mpAutoFilterPopup->isAllSelected())
-{
-// Remove this entry.
-aParam.RemoveEntryByField(rPos.Col());
-}
-else
+// Remove old entries.
+aParam.RemoveAllEntriesByField(rPos.Col());
+
+if( !(eMode == Normal && mpAutoFilterPopup->isAllSelected() ) )
 {
 // Try to use the existing entry for the column (if one exists).
 ScQueryEntry* pEntry = aParam.FindEntryByField(rPos.Col(), true);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sc/inc sc/source

2017-08-15 Thread Szymon Kłos
 sc/inc/queryparam.hxx  |1 +
 sc/source/core/tool/queryparam.cxx |   17 +
 sc/source/ui/view/gridwin.cxx  |6 +++---
 3 files changed, 21 insertions(+), 3 deletions(-)

New commits:
commit c3d02e94bc315c9736f862b3783d17ca6fc2caab
Author: Szymon Kłos 
Date:   Sat May 27 19:16:58 2017 +0200

tdf#107797 select all entries in the dropdown

Change-Id: I3ee33040744eab35f841d3622cb8981b49d04333
Reviewed-on: https://gerrit.libreoffice.org/38091
Tested-by: Jenkins 
Reviewed-by: Szymon Kłos 
Reviewed-on: https://gerrit.libreoffice.org/41034
Reviewed-by: Aron Budea 
Tested-by: Aron Budea 

diff --git a/sc/inc/queryparam.hxx b/sc/inc/queryparam.hxx
index 68ac18b6f84a..16b4573c9fa6 100644
--- a/sc/inc/queryparam.hxx
+++ b/sc/inc/queryparam.hxx
@@ -57,6 +57,7 @@ struct ScQueryParamBase
 SC_DLLPUBLIC ScQueryEntry& GetEntry(SCSIZE n);
 SC_DLLPUBLIC ScQueryEntry& AppendEntry();
 ScQueryEntry* FindEntryByField(SCCOLROW nField, bool bNew);
+std::vector FindAllEntriesByField(SCCOLROW nField);
 SC_DLLPUBLIC void RemoveEntryByField(SCCOLROW nField);
 void Resize(size_t nNew);
 void FillInExcelSyntax( svl::SharedStringPool& rPool, const OUString& 
aCellStr, SCSIZE nIndex,
diff --git a/sc/source/core/tool/queryparam.cxx 
b/sc/source/core/tool/queryparam.cxx
index 5131a31f7e1f..f5630b66b565 100644
--- a/sc/source/core/tool/queryparam.cxx
+++ b/sc/source/core/tool/queryparam.cxx
@@ -143,6 +143,23 @@ ScQueryEntry* ScQueryParamBase::FindEntryByField(SCCOLROW 
nField, bool bNew)
 return ();
 }
 
+std::vector ScQueryParamBase::FindAllEntriesByField(SCCOLROW 
nField)
+{
+std::vector aEntries;
+
+EntriesType::iterator itr = std::find_if(
+m_Entries.begin(), m_Entries.end(), FindByField(nField));
+
+while (itr != m_Entries.end())
+{
+aEntries.push_back((*itr).get());
+itr = std::find_if(
+itr + 1, m_Entries.end(), FindByField(nField));
+}
+
+return aEntries;
+}
+
 void ScQueryParamBase::RemoveEntryByField(SCCOLROW nField)
 {
 EntriesType::iterator itr = std::find_if(
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 630400b94c5b..d2a1223e86ce 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -702,11 +702,11 @@ void ScGridWindow::LaunchAutoFilterMenu(SCCOL nCol, SCROW 
nRow)
 
 ScQueryParam aParam;
 pDBData->GetQueryParam(aParam);
-ScQueryEntry* pEntry = aParam.FindEntryByField(nCol, false);
+std::vector aEntries = aParam.FindAllEntriesByField(nCol);
 std::unordered_set aSelected;
-if (pEntry && pEntry->bDoQuery)
+for (ScQueryEntry* pEntry : aEntries)
 {
-if (pEntry->eOp == SC_EQUAL)
+if (pEntry && pEntry->bDoQuery && pEntry->eOp == SC_EQUAL)
 {
 ScQueryEntry::QueryItemsType& rItems = pEntry->GetQueryItems();
 std::for_each(rItems.begin(), rItems.end(), 
AddSelectedItemString(aSelected));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sc/inc sc/source

2017-07-28 Thread Marco Cecchetti
 sc/inc/clipparam.hxx  |6 ++
 sc/source/core/data/clipparam.cxx |6 --
 sc/source/ui/view/cellsh.cxx  |   23 +++
 sc/source/ui/view/viewfun3.cxx|   25 +
 4 files changed, 58 insertions(+), 2 deletions(-)

New commits:
commit 7fc62b59ddad40f725709f14331c38c0a78ff6ee
Author: Marco Cecchetti 
Date:   Wed May 24 20:46:31 2017 +0200

lok: sc: copy / paste confusion -- workaround

Problem:

1. (a) copied April
2. (a) pasted -> April
3. (b) copied March
4. (a) pasted -> March [should have been April]

where (a), (b) are different views

Solution:
A real solution would require to have one clipboard per view.
This patch is only a workaround, which doesn't allow to paste content
which has been copied in a different view; it takes also care to
disable the "Paste" entry in the context menu.

Change-Id: I3254f130af106299b0b519884a4ca03db08fc4c8
Reviewed-on: https://gerrit.libreoffice.org/40460
Reviewed-by: Jan Holesovsky 
Tested-by: Jan Holesovsky 

diff --git a/sc/inc/clipparam.hxx b/sc/inc/clipparam.hxx
index 2e5dece711e8..16555225d074 100644
--- a/sc/inc/clipparam.hxx
+++ b/sc/inc/clipparam.hxx
@@ -26,6 +26,8 @@
 
 #include 
 
+class SfxViewShell;
+
 /**
  * This struct stores general clipboard parameters associated with a
  * ScDocument instance created in clipboard mode.
@@ -38,6 +40,7 @@ struct ScClipParam
 Direction   meDirection;
 boolmbCutMode;
 sal_uInt32  mnSourceDocID;
+SfxViewShell*   mpSourceView;
 ScRangeListVector   maProtectedChartRangesVector;
 
 ScClipParam();
@@ -67,6 +70,9 @@ struct ScClipParam
 
 sal_uInt32 getSourceDocID() const { return mnSourceDocID; }
 void setSourceDocID( sal_uInt32 nVal ) { mnSourceDocID = nVal; }
+
+SfxViewShell* getSourceView() const { return mpSourceView; }
+void setSourceView( SfxViewShell* pSourceView ) { mpSourceView = 
pSourceView; }
 };
 
 #endif
diff --git a/sc/source/core/data/clipparam.cxx 
b/sc/source/core/data/clipparam.cxx
index 9c08d6093dfc..bc856672fbba 100644
--- a/sc/source/core/data/clipparam.cxx
+++ b/sc/source/core/data/clipparam.cxx
@@ -23,14 +23,16 @@
 ScClipParam::ScClipParam() :
 meDirection(Unspecified),
 mbCutMode(false),
-mnSourceDocID(0)
+mnSourceDocID(0),
+mpSourceView(nullptr)
 {
 }
 
 ScClipParam::ScClipParam(const ScRange& rRange, bool bCutMode) :
 meDirection(Unspecified),
 mbCutMode(bCutMode),
-mnSourceDocID(0)
+mnSourceDocID(0),
+mpSourceView(nullptr)
 {
 maRanges.Append(rRange);
 }
diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx
index 58fd0ee27ace..7642274eead4 100644
--- a/sc/source/ui/view/cellsh.cxx
+++ b/sc/source/ui/view/cellsh.cxx
@@ -613,6 +613,29 @@ void ScCellShell::GetClipState( SfxItemSet& rSet )
 bDisable = true;
 }
 
+// This is only a workaround, we don't want that text content copied
+// in one view is pasted in a different view.
+// This part of the patch takes care to disable the "Paste" entry
+// in the context menu.
+// TODO: implement a solution providing one clipboard per view
+if (comphelper::LibreOfficeKit::isActive())
+{
+ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard(nullptr);
+if (pOwnClip)
+{
+ScDocument* pClipDoc = pOwnClip->GetDocument();
+if (pClipDoc)
+{
+ScTabViewShell* pThisView = GetViewData()->GetViewShell();
+ScTabViewShell* pSourceView = 
dynamic_cast(pClipDoc->GetClipParam().getSourceView());
+if (pThisView && pSourceView && pThisView != pSourceView)
+{
+bDisable = true;
+}
+}
+}
+}
+
 if (bDisable)
 {
 rSet.DisableItem( SID_PASTE );
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index 2c481f5ce0fe..ba37ef4077e1 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -37,6 +37,9 @@
 #include 
 #include 
 
+#include 
+#include 
+
 #include "attrib.hxx"
 #include "patattr.hxx"
 #include "dociter.hxx"
@@ -225,6 +228,14 @@ bool ScViewFunc::CopyToClip( ScDocument* pClipDoc, const 
ScRangeList& rRanges, b
 // and lose the 'if' above
 aClipParam.setSourceDocID( pDoc->GetDocumentID() );
 
+// This is only a workaround, which doesn't allow to paste content
+// in one view which has been copied in a different view.
+// TODO: implement a solution providing one clipboard per view
+if (comphelper::LibreOfficeKit::isActive())
+{
+aClipParam.setSourceView(GetViewData().GetViewShell());
+}
+
 if 

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sc/inc sc/source

2017-05-03 Thread Kohei Yoshida
 sc/inc/colcontainer.hxx|   11 --
 sc/inc/column.hxx  |3 +
 sc/inc/document.hxx|8 
 sc/inc/table.hxx   |2 +
 sc/inc/types.hxx   |   14 
 sc/source/core/data/column4.cxx|   48 +++
 sc/source/core/data/document10.cxx |   15 
 sc/source/core/data/table7.cxx |   64 +
 sc/source/core/data/types.cxx  |7 
 sc/source/ui/view/viewfun2.cxx |   22 +---
 10 files changed, 184 insertions(+), 10 deletions(-)

New commits:
commit 21a40e668a610fada3e06ed381d8a4c459d24f69
Author: Kohei Yoshida 
Date:   Mon May 1 19:43:16 2017 -0400

tdf#107255: detect whether the range has only one data cell.

(cherry picked from commit 93f5cb55349e6de5003182462bfee434dc51f6ad)

Conflicts:
sc/inc/colcontainer.hxx

Change-Id: I4f67f15f95a428ea9068f706abc925ebfc835d39

diff --git a/sc/inc/colcontainer.hxx b/sc/inc/colcontainer.hxx
index 1a2e9d43aa9d..0f4a64589cdd 100644
--- a/sc/inc/colcontainer.hxx
+++ b/sc/inc/colcontainer.hxx
@@ -20,22 +20,20 @@
 #ifndef INCLUDED_SC_INC_COLCONTAINER_HXX
 #define INCLUDED_SC_INC_COLCONTAINER_HXX
 
-
 #include "types.hxx"
 #include "address.hxx"
 
 #include 
 
-
 class ScColumn;
 class ScDocument;
+
 class ScColContainer
 {
-public:
 typedef std::vector ScColumnVector;
-private:
 ScColumnVectoraCols;
 ScDocument*   pDocument;
+
 public:
 ScColContainer( ScDocument* pDoc, const size_t nSize );
 ~ScColContainer();
@@ -55,6 +53,11 @@ public:
 return static_cast( aCols.size() );
 }
 
+bool empty() const
+{
+return aCols.empty();
+}
+
 void Clear();
 };
 
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 82ef60773628..de28a87ae63d 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -381,6 +381,9 @@ public:
 boolHasValueData( SCROW nRow ) const;
 boolHasStringCells( SCROW nStartRow, SCROW nEndRow ) const;
 
+sc::MultiDataCellState::StateType HasDataCellsInRange(
+SCROW nRow1, SCROW nRow2, SCROW* pRow1 = nullptr ) const;
+
 bool IsFormulaDirty( SCROW nRow ) const;
 
 void CheckVectorizationState();
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 10ce2e2f750a..5e4336019fb1 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1088,6 +1088,14 @@ public:
 /** Returns true, if there is any data to create a selection list for 
rPos. */
 boolHasSelectionData( SCCOL nCol, SCROW nRow, SCTAB nTab ) 
const;
 
+/**
+ * Check if the specified range contains either: 1) one non-empty cell, 2)
+ * more than one non-empty cells, or 3) totally empty.  In case the range
+ * contains at least one non-empty cell, specify the position of the first
+ * non-empty cell.
+ */
+sc::MultiDataCellState HasMultipleDataCells( const ScRange& rRange ) const;
+
 /** Notes **/
 SC_DLLPUBLIC ScPostIt*   GetNote(const ScAddress& rPos);
 SC_DLLPUBLIC ScPostIt*   GetNote(SCCOL nCol, SCROW nRow, SCTAB nTab);
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 34f6e3fd992a..26a729227829 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -529,6 +529,8 @@ public:
 boolHasStringCells( SCCOL nStartCol, SCROW nStartRow,
 SCCOL nEndCol, SCROW nEndRow ) const;
 
+sc::MultiDataCellState HasMultipleDataCells( SCCOL nCol1, SCROW nRow1, 
SCCOL nCol2, SCROW nRow2 ) const;
+
 FormulaErrorGetErrCode( const ScAddress& rPos ) const
 {
 return ValidColRow(rPos.Col(),rPos.Row()) ?
diff --git a/sc/inc/types.hxx b/sc/inc/types.hxx
index 13983939007e..f6746063eaa8 100644
--- a/sc/inc/types.hxx
+++ b/sc/inc/types.hxx
@@ -97,6 +97,20 @@ struct RangeMatrix
 bool isRangeValid() const;
 };
 
+struct MultiDataCellState
+{
+enum StateType { Invalid = 0, Empty, HasOneCell, HasMultipleCells };
+
+StateType meState;
+
+SCCOL mnCol1; //< first non-empty column
+SCROW mnRow1; //< first non-empty row
+SCTAB mnTab1; //< first non-empty sheet
+
+MultiDataCellState();
+MultiDataCellState( StateType eState );
+};
+
 enum AreaOverlapType
 {
 AreaInside,
diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index 234a8528b4e7..69d95f96fa64 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -39,6 +39,54 @@ bool ScColumn::IsMerged( SCROW nRow ) const
 return pAttrArray->IsMerged(nRow);
 }
 
+sc::MultiDataCellState::StateType ScColumn::HasDataCellsInRange(
+SCROW nRow1, SCROW nRow2, SCROW* pRow1 ) const
+{
+sc::CellStoreType::const_position_type aPos = maCells.position(nRow1);
+sc::CellStoreType::const_iterator it = aPos.first;
+size_t nOffset = aPos.second;
+SCROW nRow = nRow1;
+bool 

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sc/inc sc/source

2017-04-21 Thread Noel Grandin
 sc/inc/markarr.hxx  |7 ---
 sc/source/core/data/markarr.cxx |   27 ++-
 2 files changed, 14 insertions(+), 20 deletions(-)

New commits:
commit e659128b744b88dbc72f142c2d8564a1243b5ad4
Author: Noel Grandin 
Date:   Fri Apr 21 16:10:35 2017 +0200

new loplugin: useuniqueptr: sc part 1 (only the ScMarkArray part)

Change-Id: I24a837c79aaef2246929bb194635f01b4ddedb0b

diff --git a/sc/inc/markarr.hxx b/sc/inc/markarr.hxx
index 2f2e27984486..f92fa94df60c 100644
--- a/sc/inc/markarr.hxx
+++ b/sc/inc/markarr.hxx
@@ -21,6 +21,7 @@
 #define INCLUDED_SC_INC_MARKARR_HXX
 
 #include "address.hxx"
+#include 
 
 #define SC_MARKARRAY_DELTA4
 
@@ -32,9 +33,9 @@ struct ScMarkEntry
 
 class ScMarkArray
 {
-SCSIZE  nCount;
-SCSIZE  nLimit;
-ScMarkEntry*pData;
+SCSIZEnCount;
+SCSIZEnLimit;
+std::unique_ptrpData;
 
 friend class ScMarkArrayIter;
 friend class ScDocument;// for FillInfo
diff --git a/sc/source/core/data/markarr.cxx b/sc/source/core/data/markarr.cxx
index 62f087cbab78..6266d5afd970 100644
--- a/sc/source/core/data/markarr.cxx
+++ b/sc/source/core/data/markarr.cxx
@@ -35,16 +35,14 @@ ScMarkArray::ScMarkArray() :
 ScMarkArray::ScMarkArray( ScMarkArray&& rArray ) :
 nCount( rArray.nCount ),
 nLimit( rArray.nLimit ),
-pData( rArray.pData )
+pData( rArray.pData.release() )
 {
 rArray.nCount = 0;
 rArray.nLimit = 0;
-rArray.pData = nullptr;
 }
 
 ScMarkArray::~ScMarkArray()
 {
-delete[] pData;
 }
 
 void ScMarkArray::Reset( bool bMarked, SCSIZE nNeeded )
@@ -52,12 +50,10 @@ void ScMarkArray::Reset( bool bMarked, SCSIZE nNeeded )
 // always create pData here
 // (or have separate method to ensure pData)
 
-delete[] pData;
-
 assert(nNeeded);
 nLimit = nNeeded;
 nCount = 1;
-pData = new ScMarkEntry[nNeeded];
+pData.reset( new ScMarkEntry[nNeeded] );
 pData[0].nRow = MAXROW;
 pData[0].bMarked = bMarked;
 }
@@ -129,9 +125,8 @@ void ScMarkArray::SetMarkArea( SCROW nStartRow, SCROW 
nEndRow, bool bMarked )
 if ( nLimit < nNeeded )
 nLimit = nNeeded;
 ScMarkEntry* pNewData = new ScMarkEntry[nLimit];
-memcpy( pNewData, pData, nCount*sizeof(ScMarkEntry) );
-delete[] pData;
-pData = pNewData;
+memcpy( pNewData, pData.get(), nCount*sizeof(ScMarkEntry) 
);
+pData.reset( pNewData );
 }
 }
 
@@ -207,7 +202,7 @@ void ScMarkArray::SetMarkArea( SCROW nStartRow, SCROW 
nEndRow, bool bMarked )
 }
 if ( ni < nj )
 {   // remove entries
-memmove( pData + ni, pData + nj, (nCount - nj) * 
sizeof(ScMarkEntry) );
+memmove( pData.get() + ni, pData.get() + nj, (nCount - nj) 
* sizeof(ScMarkEntry) );
 nCount -= nj - ni;
 }
 }
@@ -217,11 +212,11 @@ void ScMarkArray::SetMarkArea( SCROW nStartRow, SCROW 
nEndRow, bool bMarked )
 if ( nInsert <= nCount )
 {
 if ( !bSplit )
-memmove( pData + nInsert + 1, pData + nInsert,
+memmove( pData.get() + nInsert + 1, pData.get() + 
nInsert,
 (nCount - nInsert) * sizeof(ScMarkEntry) );
 else
 {
-memmove( pData + nInsert + 2, pData + nInsert,
+memmove( pData.get() + nInsert + 2, pData.get() + 
nInsert,
 (nCount - nInsert) * sizeof(ScMarkEntry) );
 pData[nInsert+1] = pData[nInsert-1];
 nCount++;
@@ -306,15 +301,13 @@ bool ScMarkArray::HasEqualRowsMarked( const ScMarkArray& 
rOther ) const
 
 void ScMarkArray::CopyMarksTo( ScMarkArray& rDestMarkArray ) const
 {
-delete[] rDestMarkArray.pData;
-
 if (pData)
 {
-rDestMarkArray.pData = new ScMarkEntry[nCount];
-memcpy( rDestMarkArray.pData, pData, nCount * sizeof(ScMarkEntry) );
+rDestMarkArray.pData.reset( new ScMarkEntry[nCount] );
+memcpy( rDestMarkArray.pData.get(), pData.get(), nCount * 
sizeof(ScMarkEntry) );
 }
 else
-rDestMarkArray.pData = nullptr;
+rDestMarkArray.pData.reset();
 
 rDestMarkArray.nCount = rDestMarkArray.nLimit = nCount;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sc/inc sc/source

2017-04-05 Thread Henry Castro
 sc/inc/column.hxx   |1 +
 sc/source/core/data/column2.cxx |7 ++-
 sc/source/core/data/column3.cxx |1 +
 3 files changed, 8 insertions(+), 1 deletion(-)

New commits:
commit f27f4dd900b50f15427f44f6d448e8e8e49ec2d5
Author: Henry Castro 
Date:   Tue Apr 4 22:50:56 2017 -0400

lok: notify cell note removes before erasing storage

Change-Id: I6181b27b6a969d94789c42ea0914b17328c5c8d5
Reviewed-on: https://gerrit.libreoffice.org/36109
Reviewed-by: Jan Holesovsky 
Tested-by: Jan Holesovsky 

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index cfce9d6a4e50..82ef60773628 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -699,6 +699,7 @@ private:
  * Call this only from those methods where maCells is modified directly.
  */
 void CellStorageModified();
+void CellNotesDeleting(SCROW nRow1, SCROW nRow2, bool 
bForgetCaptionOwnership );
 
 void CopyCellTextAttrsToDocument(SCROW nRow1, SCROW nRow2, ScColumn& 
rDestCol) const;
 
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 1fda6e22c81e..ba1af5e212a0 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -1902,11 +1902,16 @@ namespace {
 };
 } // anonymous namespace
 
-void ScColumn::DeleteCellNotes( sc::ColumnBlockPosition& rBlockPos, SCROW 
nRow1, SCROW nRow2, bool bForgetCaptionOwnership )
+void ScColumn::CellNotesDeleting(SCROW nRow1, SCROW nRow2, bool 
bForgetCaptionOwnership)
 {
 ScAddress aAddr(nCol, 0, nTab);
 CellNoteHandler aFunc(pDocument, aAddr, bForgetCaptionOwnership);
 sc::ParseNote(maCellNotes.begin(), maCellNotes, nRow1, nRow2, aFunc);
+}
+
+void ScColumn::DeleteCellNotes( sc::ColumnBlockPosition& rBlockPos, SCROW 
nRow1, SCROW nRow2, bool bForgetCaptionOwnership )
+{
+CellNotesDeleting(nRow1, nRow2, bForgetCaptionOwnership);
 
 rBlockPos.miCellNotePos =
 maCellNotes.set_empty(rBlockPos.miCellNotePos, nRow1, nRow2);
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 73da282cc1f2..55a2b36936f8 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -181,6 +181,7 @@ void ScColumn::DeleteRow( SCROW nStartRow, SCSIZE nSize, 
std::vector*
 maBroadcasters.erase(nStartRow, nEndRow);
 maBroadcasters.resize(MAXROWCOUNT);
 
+CellNotesDeleting(nStartRow, nEndRow, false);
 maCellNotes.erase(nStartRow, nEndRow);
 maCellNotes.resize(MAXROWCOUNT);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits