[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2023-10-06 Thread Caolán McNamara (via logerrit)
 sc/inc/strings.hrc  |1 
 sc/source/ui/inc/content.hxx|3 -
 sc/source/ui/inc/navipi.hxx |1 
 sc/source/ui/navipi/content.cxx |   95 ++--
 sc/source/ui/navipi/navipi.cxx  |1 
 5 files changed, 26 insertions(+), 75 deletions(-)

New commits:
commit c76fb134281a3d1fd56f8a6d07ad7111c85e17b9
Author: Caolán McNamara 
AuthorDate: Fri Oct 6 15:45:13 2023 +0100
Commit: Caolán McNamara 
CommitDate: Fri Oct 6 21:32:38 2023 +0200

bHiddenDoc is always false and aHiddenName is always empty

Change-Id: I05259fb648f9e1e96ac5b0f0a4d68ba9a68b89b0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157652
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sc/source/ui/inc/content.hxx b/sc/source/ui/inc/content.hxx
index 5a14cb48b4a4..2e8c6757e202 100644
--- a/sc/source/ui/inc/content.hxx
+++ b/sc/source/ui/inc/content.hxx
@@ -49,9 +49,6 @@ class ScContentTree
 o3tl::enumarray> m_aRootNodes;
 ScContentId nRootType;  // set as Root
 OUStringaManualDoc; // Switched in Navigator 
(Title)
-boolbHiddenDoc; // Hidden active?
-OUStringaHiddenName;// URL to load
-ScDocument* pHiddenDocument;// temporary
 boolbIsInNavigatorDlg;
 boolm_bFreeze;
 ImplSVEvent*m_nAsyncMouseReleaseId;
diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index 1af85b31d051..58bb28668b4d 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -124,8 +124,6 @@ 
ScContentTree::ScContentTree(std::unique_ptr xTreeView, ScNaviga
 , m_xTransferObj(new ScLinkTransferObj)
 , pParentWindow(pNavigatorDlg)
 , nRootType(ScContentId::ROOT)
-, bHiddenDoc(false)
-, pHiddenDocument(nullptr)
 , bIsInNavigatorDlg(false)
 , m_bFreeze(false)
 , m_nAsyncMouseReleaseId(nullptr)
@@ -326,9 +324,6 @@ IMPL_LINK_NOARG(ScContentTree, ContentDoubleClickHdl, 
weld::TreeView&, bool)
 
 if (xEntry && (nType != ScContentId::ROOT) && (nChild != 
SC_CONTENT_NOCHILD))
 {
-if ( bHiddenDoc )
-return false;   //! later...
-
 OUString aText(m_xTreeView->get_text(*xEntry));
 
 if ( !aManualDoc.isEmpty() )
@@ -471,8 +466,6 @@ IMPL_LINK(ScContentTree, KeyInputHdl, const KeyEvent&, 
rKEvt, bool)
 
 if (xEntry && (nType != ScContentId::ROOT) && (nChild != 
SC_CONTENT_NOCHILD))
 {
-if ( bHiddenDoc )
-return true;//! later...
 OUString aText(m_xTreeView->get_text(*xEntry));
 if (!aManualDoc.isEmpty())
 pParentWindow->SetCurrentDoc( aManualDoc );
@@ -575,7 +568,7 @@ IMPL_LINK(ScContentTree, CommandHdl, const CommandEvent&, 
rCEvt, bool)
 ++i;
 sId = "document" + OUString::number(i);
 xDocMenu->append_radio(sId, aEntry);
-if ( !bHiddenDoc && aName == aManualDoc )
+if (aName == aManualDoc)
 sActive = sId;
 }
 pSh = SfxObjectShell::GetNext( *pSh );
@@ -584,7 +577,7 @@ IMPL_LINK(ScContentTree, CommandHdl, const CommandEvent&, 
rCEvt, bool)
 ++i;
 sId = "document" + OUString::number(i);
 xDocMenu->append_radio(sId, pParentWindow->aStrActiveWin);
-if (!bHiddenDoc && aManualDoc.isEmpty())
+if (aManualDoc.isEmpty())
 sActive = sId;
 xDocMenu->set_active(sActive, true);
 
@@ -643,25 +636,15 @@ IMPL_LINK(ScContentTree, QueryTooltipHdl, const 
weld::TreeIter&, rEntry, OUStrin
 
 ScDocument* ScContentTree::GetSourceDocument()
 {
-if (bHiddenDoc)
-return pHiddenDocument;
-else
-{
-ScDocShell* pSh = GetManualOrCurrent();
-if (pSh)
-return >GetDocument();
-
-}
+ScDocShell* pSh = GetManualOrCurrent();
+if (pSh)
+return >GetDocument();
 return nullptr;
 }
 
 void ScContentTree::Refresh( ScContentId nType )
 {
-if ( bHiddenDoc && !pHiddenDocument )
-return; // other document displayed
-
 //  if nothing has changed the cancel right away (against flicker)
-
 if ( nType == ScContentId::NOTE )
 if (!NoteStringsChanged())
 return;
@@ -1189,8 +1172,6 @@ IMPL_LINK(ScContentTree, DragBeginHdl, bool&, 
rUnsetDragIcon, bool)
 
 bool bDisallow = true;
 
-std::unique_ptr pDocLoader;
-
 ScModule* pScMod = SC_MOD();
 
 ScContentId nType;
@@ -1212,18 +1193,13 @@ IMPL_LINK(ScContentTree, DragBeginHdl, bool&, 
rUnsetDragIcon, bool)
 
 ScDocument* pLocalDoc = nullptr;   // for URL 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2023-08-11 Thread Caolán McNamara (via logerrit)
 sc/inc/postit.hxx  |5 +
 sc/source/core/data/postit.cxx |   41 +
 2 files changed, 30 insertions(+), 16 deletions(-)

New commits:
commit ac40c3923580e4ec0e738d57ff8b885da93301ef
Author: Caolán McNamara 
AuthorDate: Fri Aug 11 13:08:36 2023 +0100
Commit: Caolán McNamara 
CommitDate: Fri Aug 11 18:14:15 2023 +0200

split out a common CreateNoteData

Change-Id: Ieeaf50f3a086d01b5492eb3ab9b211f132f045ac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155611
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sc/inc/postit.hxx b/sc/inc/postit.hxx
index 92602e5150ac..c6ac3b5a4bd4 100644
--- a/sc/inc/postit.hxx
+++ b/sc/inc/postit.hxx
@@ -178,6 +178,9 @@ class SC_DLLPUBLIC ScNoteUtil
 {
 static ScPostIt* InsertNote(ScDocument& rDoc, const ScAddress& rPos, 
ScNoteData&& rNoteData,
 bool bAlwaysCreateCaption, sal_uInt32 
nPostItId);
+
+static ScNoteData CreateNoteData(ScDocument& rDoc, const ScAddress& rPos, 
const OutlinerParaObject& rOutlinerObj,
+ const tools::Rectangle& rCaptionRect, 
bool bShown);
 public:
 
 /** Creates and returns a caption object for a temporary caption. */
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index 8fa13927d3d9..378323338eb1 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -929,17 +929,13 @@ ScPostIt* ScNoteUtil::CreateNoteFromCaption(
 return pNote;
 }
 
-ScPostIt* ScNoteUtil::CreateNoteFromObjectData(
-ScDocument& rDoc, const ScAddress& rPos, SfxItemSet&& rItemSet, const 
OUString& rStyleName,
-const OutlinerParaObject& rOutlinerObj, const tools::Rectangle& 
rCaptionRect,
-bool bShown )
+ScNoteData ScNoteUtil::CreateNoteData(ScDocument& rDoc, const ScAddress& rPos, 
const OutlinerParaObject& rOutlinerObj,
+  const tools::Rectangle& rCaptionRect, 
bool bShown)
 {
 ScNoteData aNoteData( bShown );
 aNoteData.mxInitData = std::make_shared();
 ScCaptionInitData& rInitData = *aNoteData.mxInitData;
-rInitData.moItemSet.emplace(std::move(rItemSet));
 rInitData.mxOutlinerObj = rOutlinerObj;
-rInitData.maStyleName = 
ScStyleNameConversion::ProgrammaticToDisplayName(rStyleName, 
SfxStyleFamily::Frame);
 
 // convert absolute caption position to relative position
 rInitData.mbDefaultPosSize = rCaptionRect.IsEmpty();
@@ -952,6 +948,19 @@ ScPostIt* ScNoteUtil::CreateNoteFromObjectData(
 rInitData.maCaptionSize = rCaptionRect.GetSize();
 }
 
+return aNoteData;
+}
+
+ScPostIt* ScNoteUtil::CreateNoteFromObjectData(
+ScDocument& rDoc, const ScAddress& rPos, SfxItemSet&& rItemSet, const 
OUString& rStyleName,
+const OutlinerParaObject& rOutlinerObj, const tools::Rectangle& 
rCaptionRect,
+bool bShown )
+{
+ScNoteData aNoteData(CreateNoteData(rDoc, rPos, rOutlinerObj, 
rCaptionRect, bShown));
+ScCaptionInitData& rInitData = *aNoteData.mxInitData;
+rInitData.moItemSet.emplace(std::move(rItemSet));
+rInitData.maStyleName = 
ScStyleNameConversion::ProgrammaticToDisplayName(rStyleName, 
SfxStyleFamily::Frame);
+
 return InsertNote(rDoc, rPos, std::move(aNoteData), 
/*bAlwaysCreateCaption*/false, 0/*nPostItId*/);
 }
 
commit 5ae486eea7a381403a9f81e5aa8ef1a0a57b95b6
Author: Caolán McNamara 
AuthorDate: Fri Aug 11 13:01:17 2023 +0100
Commit: Caolán McNamara 
CommitDate: Fri Aug 11 18:14:05 2023 +0200

split out common ScPostIt insertion piece

Change-Id: Ie9d718293f907e19e29ed6f8aea4a2bf9d88dfe9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155610
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/sc/inc/postit.hxx b/sc/inc/postit.hxx
index 828d094e49d1..92602e5150ac 100644
--- a/sc/inc/postit.hxx
+++ b/sc/inc/postit.hxx
@@ -176,6 +176,8 @@ private:
 
 class SC_DLLPUBLIC ScNoteUtil
 {
+static ScPostIt* InsertNote(ScDocument& rDoc, const ScAddress& rPos, 
ScNoteData&& rNoteData,
+bool bAlwaysCreateCaption, sal_uInt32 
nPostItId);
 public:
 
 /** Creates and returns a caption object for a temporary caption. */
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index cbb2eff1ff14..8fa13927d3d9 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -23,8 +23,8 @@
 #include 
 #include 
 #include 
-#include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -952,13 +952,18 @@ ScPostIt* ScNoteUtil::CreateNoteFromObjectData(
 rInitData.maCaptionSize = rCaptionRect.GetSize();
 }
 
+return InsertNote(rDoc, rPos, std::move(aNoteData), 
/*bAlwaysCreateCaption*/false, 0/*nPostItId*/);
+}
+
+ScPostIt* ScNoteUtil::InsertNote(ScDocument& rDoc, const ScAddress& rPos, 
ScNoteData&& rNoteData,
+ bool 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source sw/source

2023-05-17 Thread Noel Grandin (via logerrit)
 sc/inc/colorscale.hxx|1 
 sc/inc/conditio.hxx  |5 ++
 sc/source/core/data/colorscale.cxx   |6 +++
 sc/source/core/data/conditio.cxx |   20 +++
 sc/source/core/data/table2.cxx   |3 +
 sc/source/ui/Accessibility/AccessibleDocument.cxx|4 ++
 sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx |8 
 sc/source/ui/Accessibility/AccessiblePageHeader.cxx  |2 +
 sw/source/core/access/acccontext.cxx |5 ++
 sw/source/core/access/accdoc.cxx |2 +
 sw/source/core/access/accmap.cxx |3 +
 11 files changed, 59 insertions(+)

New commits:
commit 2e71891760093151bf094573dbf4ad1afe636262
Author: Noel Grandin 
AuthorDate: Wed May 17 11:28:48 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed May 17 15:56:37 2023 +0200

fire less "index hint out of range, ignoring" warnings

after
commit 3b7db802731826b6cc3b55100470b0c61c1f2dfa
Author: Noel Grandin 
Date:   Thu May 4 10:06:14 2023 +0200
tdf#105404 [API CHANGE] add index to accessiblity change event

Change-Id: I52d6b7b7368b780c1c9fdf60628311cb02429eff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151872
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx 
b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index 870851691a43..6311947f144e 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -432,6 +432,7 @@ bool ScChildrenShapes::ReplaceChild 
(::accessibility::AccessibleShape* pCurrentC
 aEvent.EventId = AccessibleEventId::CHILD;
 aEvent.Source = uno::Reference< XAccessibleContext 
>(mpAccessibleDocument);
 aEvent.OldValue <<= uno::Reference(pCurrentChild);
+aEvent.IndexHint = -1;
 
 mpAccessibleDocument->CommitChange(aEvent); // child is gone - 
event
 
@@ -449,6 +450,7 @@ bool ScChildrenShapes::ReplaceChild 
(::accessibility::AccessibleShape* pCurrentC
 aEvent.EventId = AccessibleEventId::CHILD;
 aEvent.Source = uno::Reference< XAccessibleContext 
>(mpAccessibleDocument);
 aEvent.NewValue <<= uno::Reference(pReplacement);
+aEvent.IndexHint = -1;
 
 mpAccessibleDocument->CommitChange(aEvent); // child is new - event
 bResult = true;
@@ -1223,6 +1225,7 @@ void ScChildrenShapes::AddShape(const 
uno::Reference& xShape, b
 aEvent.EventId = AccessibleEventId::CHILD;
 aEvent.Source = uno::Reference< XAccessibleContext 
>(mpAccessibleDocument);
 aEvent.NewValue <<= Get(pShape);
+aEvent.IndexHint = -1;
 
 mpAccessibleDocument->CommitChange(aEvent); // new child - event
 }
@@ -1250,6 +1253,7 @@ void ScChildrenShapes::RemoveShape(const 
uno::Reference& xShape
 aEvent.EventId = AccessibleEventId::CHILD;
 aEvent.Source = uno::Reference< XAccessibleContext 
>(mpAccessibleDocument);
 aEvent.OldValue <<= xOldAccessible;
+aEvent.IndexHint = -1;
 
 mpAccessibleDocument->CommitChange(aEvent); // child is gone - 
event
 }
diff --git a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx 
b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
index 8d968dfa3f07..077bdaead1db 100644
--- a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
@@ -440,6 +440,7 @@ struct ScChildGone
 aEvent.EventId = AccessibleEventId::CHILD;
 aEvent.Source = uno::Reference< XAccessibleContext >(mpAccDoc);
 aEvent.OldValue <<= xAccessible;
+aEvent.IndexHint = -1;
 
 mpAccDoc->CommitChange(aEvent); // gone child - event
 }
@@ -458,6 +459,7 @@ struct ScChildNew
 aEvent.EventId = AccessibleEventId::CHILD;
 aEvent.Source = uno::Reference< XAccessibleContext >(mpAccDoc);
 aEvent.NewValue <<= xAccessible;
+aEvent.IndexHint = -1;
 
 mpAccDoc->CommitChange(aEvent); // new child - event
 }
@@ -718,6 +720,7 @@ void ScShapeChildren::FindChanged(ScShapeChildVec& rOld, 
ScShapeChildVec& rNew)
 aEvent.Source = uno::Reference (mpAccDoc);
 aEvent.EventId = AccessibleEventId::CHILD;
 aEvent.NewValue <<= xAcc;
+aEvent.IndexHint = -1;
 mpAccDoc->CommitChange(aEvent);
 ++aNewItr;
 }
@@ -728,6 +731,7 @@ void ScShapeChildren::FindChanged(ScShapeChildVec& rOld, 
ScShapeChildVec& rNew)
 aEvent.Source = uno::Reference (mpAccDoc);
 aEvent.EventId = 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source svx/source

2023-03-30 Thread Maxim Monastirsky (via logerrit)
 sc/inc/drwlayer.hxx   |1 
 sc/inc/stlpool.hxx|6 ++-
 sc/source/core/data/documen9.cxx  |8 
 sc/source/core/data/drwlayer.cxx  |   18 -
 sc/source/core/data/postit.cxx|5 ++
 sc/source/core/data/stlpool.cxx   |   42 --
 sc/source/core/tool/stylehelper.cxx   |   10 +
 sc/source/ui/app/drwtrans.cxx |   22 ---
 sc/source/ui/app/transobj.cxx |6 +--
 sc/source/ui/view/viewfun5.cxx|   12 ++
 sc/source/ui/view/viewfun7.cxx|   10 -
 svx/source/sdr/properties/attributeproperties.cxx |2 -
 svx/source/sdr/properties/graphicproperties.cxx   |1 
 svx/source/sdr/properties/oleproperties.cxx   |1 
 14 files changed, 119 insertions(+), 25 deletions(-)

New commits:
commit 685a864cfc40227559ed55f6273fd118174e8e6e
Author: Maxim Monastirsky 
AuthorDate: Sun Mar 26 22:23:52 2023 +0300
Commit: Maxim Monastirsky 
CommitDate: Thu Mar 30 22:43:23 2023 +

sc drawstyles: Clipboard support

- Paste as Calc's own format (default in Calc, results with an
  OLE object elsewhere), should preserve style assignment. This
  can be in one of two ways: Either copy the shape itself, or a
  cell range that includes a shape.

- Similarly, copying or moving a whole sheet to another document
  should also preserve the style.

- Paste as drawing format (default in other apps, also default
  in Calc when copying shapes from other apps), should preserve
  the formatting as direct formatting. Pasting into Calc will
  also assign the default style to that shape.

Change-Id: Icb951dad1a77ba9ced706c33c928980d1ec7f8ac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149753
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky 

diff --git a/sc/inc/stlpool.hxx b/sc/inc/stlpool.hxx
index 51694a405202..131b82c749ef 100644
--- a/sc/inc/stlpool.hxx
+++ b/sc/inc/stlpool.hxx
@@ -45,8 +45,10 @@ public:
 voidCreateStandardStyles();
 voidCopyStdStylesFrom( ScStyleSheetPool* pSrcPool );
 
-voidCopyStyleFrom( ScStyleSheetPool* pSrcPool,
-   const OUString& rName, SfxStyleFamily 
eFamily );
+voidCopyUsedGraphicStylesFrom( SfxStyleSheetBasePool* 
pSrcPool );
+voidCopyStyleFrom( SfxStyleSheetBasePool* pSrcPool,
+   const OUString& rName, SfxStyleFamily 
eFamily,
+   bool bNewStyleHierarchy = false );
 
 boolHasStandardStyles() const { return bHasStandardStyles; 
}
 
diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx
index 34c25c761db4..f63c1ee4d1f1 100644
--- a/sc/source/core/data/documen9.cxx
+++ b/sc/source/core/data/documen9.cxx
@@ -45,6 +45,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -76,6 +77,12 @@ void ScDocument::TransferDrawPage(const ScDocument& rSrcDoc, 
SCTAB nSrcPos, SCTA
 SdrObject* pOldObject = aIter.Next();
 while (pOldObject)
 {
+// Copy style sheet
+auto pStyleSheet = pOldObject->GetStyleSheet();
+if (pStyleSheet)
+
GetStyleSheetPool()->CopyStyleFrom(rSrcDoc.GetStyleSheetPool(),
+   pStyleSheet->GetName(), 
pStyleSheet->GetFamily(), true);
+
 // Clone to target SdrModel
 rtl::Reference 
pNewObject(pOldObject->CloneSdrObject(*mpDrawLayer));
 pNewObject->NbcMove(Size(0,0));
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 263c5698c15a..a3162055d386 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -385,8 +385,11 @@ SdrModel* ScDrawLayer::AllocModel() const
 {
 //  Allocated model (for clipboard etc) must not have a pointer
 //  to the original model's document, pass NULL as document:
+auto pNewModel = std::make_unique(nullptr, aName);
+auto pNewPool = 
static_cast(pNewModel->GetStyleSheetPool());
+pNewPool->CopyUsedGraphicStylesFrom(GetStyleSheetPool());
 
-return new ScDrawLayer( nullptr, aName );
+return pNewModel.release();
 }
 
 bool ScDrawLayer::ScAddPage( SCTAB nTab )
@@ -1930,6 +1933,12 @@ void ScDrawLayer::CopyFromClip( ScDrawLayer* pClipModel, 
SCTAB nSourceTab, const
 if (bObjectInArea && (pOldObject->GetLayer() != SC_LAYER_INTERN)
 && !IsNoteCaption(pOldObject))
 {
+// Copy style sheet
+auto pStyleSheet = pOldObject->GetStyleSheet();
+if (pStyleSheet && !bSameDoc)
+

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source sc/uiconfig sc/UIConfig_scalc.mk

2023-03-22 Thread Maxim Monastirsky (via logerrit)
 sc/UIConfig_scalc.mk   |1 
 sc/inc/scabstdlg.hxx   |5 
 sc/inc/styleuno.hxx|2 
 sc/inc/unonames.hxx|1 
 sc/source/ui/attrdlg/scdlgfact.cxx |7 
 sc/source/ui/attrdlg/scdlgfact.hxx |4 
 sc/source/ui/inc/styledlg.hxx  |   16 
 sc/source/ui/styleui/styledlg.cxx  |  102 +++
 sc/source/ui/unoobj/shapeuno.cxx   |   33 +
 sc/source/ui/view/tabvwsha.cxx |7 
 sc/uiconfig/scalc/ui/drawtemplatedialog.ui |  847 +
 11 files changed, 1023 insertions(+), 2 deletions(-)

New commits:
commit ca487e3f4c0f97c14bcff3a5372717d47f32ee94
Author: Maxim Monastirsky 
AuthorDate: Fri Mar 17 14:42:20 2023 +0200
Commit: Maxim Monastirsky 
CommitDate: Wed Mar 22 10:16:12 2023 +

sc drawstyles: Add a dialog for style editing

Change-Id: I7e62251024df8f24bd6fe318f5c0262bbd6a1a11
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149279
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky 

diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk
index 13a4b98a6c7c..d83aa96dbaa1 100644
--- a/sc/UIConfig_scalc.mk
+++ b/sc/UIConfig_scalc.mk
@@ -121,6 +121,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\
sc/uiconfig/scalc/ui/deletecolumnentry \
sc/uiconfig/scalc/ui/deletecontents \
sc/uiconfig/scalc/ui/descriptivestatisticsdialog \
+   sc/uiconfig/scalc/ui/drawtemplatedialog \
sc/uiconfig/scalc/ui/dropmenu \
sc/uiconfig/scalc/ui/doubledialog \
sc/uiconfig/scalc/ui/erroralerttabpage \
diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index 9901d48bd610..1868964e9bd0 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -43,6 +43,7 @@ class ScTabViewShell;
 class ScConditionalFormat;
 class ScConditionalFormatList;
 class Date;
+class SdrView;
 enum class CreateNameFlags;
 enum class CellShiftDisabledFlags;
 
@@ -551,6 +552,10 @@ public:
   SfxStyleSheetBase&  
rStyleBase,
   bool bPage /*true : 
page, false: para*/) = 0;
 
+virtual VclPtr CreateScDrawStyleDlg(weld::Window* 
pParent,
+  
SfxStyleSheetBase& rStyleBase,
+  SdrView* pView) 
= 0;
+
 virtual VclPtr CreateScSubTotalDlg(weld::Window* 
pParent,
  const SfxItemSet& 
rArgSet) = 0;
 
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx 
b/sc/source/ui/attrdlg/scdlgfact.cxx
index 0eca6bafb8a7..d0db6f84505a 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -1328,6 +1328,13 @@ VclPtr 
ScAbstractDialogFactory_Impl::CreateScStyleDlg(weld
 return 
VclPtr::Create(std::make_shared(pParent,
 rStyleBase, bPage));
 }
 
+VclPtr 
ScAbstractDialogFactory_Impl::CreateScDrawStyleDlg(weld::Window* pParent,
+   
 SfxStyleSheetBase& rStyleBase,
+   
 SdrView* pView)
+{
+return 
VclPtr::Create(std::make_shared(pParent,
 rStyleBase, pView));
+}
+
 VclPtr 
ScAbstractDialogFactory_Impl::CreateScSubTotalDlg(weld::Window* pParent, const 
SfxItemSet& rArgSet)
 {
 return 
VclPtr::Create(std::make_shared(pParent,
 rArgSet));
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx 
b/sc/source/ui/attrdlg/scdlgfact.hxx
index e39428018287..855abeecf1c8 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -791,6 +791,10 @@ public:
   SfxStyleSheetBase& 
rStyleBase,
   bool bPage) override;
 
+virtual VclPtr CreateScDrawStyleDlg(weld::Window* 
pParent,
+  
SfxStyleSheetBase& rStyleBase,
+  SdrView* pView) 
override;
+
 virtual VclPtr CreateScSubTotalDlg(weld::Window* 
pParent,
  const SfxItemSet& 
rArgSet) override;
 virtual VclPtr CreateScCharDlg(weld::Window* pParent,
diff --git a/sc/source/ui/inc/styledlg.hxx b/sc/source/ui/inc/styledlg.hxx
index 2f43e04745a6..736849ef963d 100644
--- a/sc/source/ui/inc/styledlg.hxx
+++ b/sc/source/ui/inc/styledlg.hxx
@@ -22,6 +22,7 @@
 #include 
 
 class SfxStyleSheetBase;
+class SdrView;
 
 class ScStyleDlg : public SfxStyleDialogController
 {
@@ -38,4 +39,19 @@ private:
 bool m_bPage;
 };
 
+class ScDrawStyleDlg : public SfxStyleDialogController
+{
+public:
+ScDrawStyleDlg(weld::Window* pParent,
+   SfxStyleSheetBase& rStyleBase,

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2023-01-22 Thread Noel Grandin (via logerrit)
 sc/inc/afmtuno.hxx   |5 -
 sc/inc/cellsuno.hxx  |   10 +-
 sc/source/ui/app/transobj.cxx|   10 --
 sc/source/ui/inc/transobj.hxx|4 +++-
 sc/source/ui/unoobj/afmtuno.cxx  |6 +-
 sc/source/ui/unoobj/cellsuno.cxx |   22 +++---
 sc/source/ui/unoobj/docuno.cxx   |8 
 sc/source/ui/unoobj/funcuno.cxx  |2 +-
 sc/source/ui/unoobj/viewuno.cxx  |4 ++--
 sc/source/ui/vba/excelvbahelper.cxx  |2 +-
 sc/source/ui/vba/vbachartobjects.cxx |2 +-
 sc/source/ui/vba/vbaeventshelper.cxx |4 ++--
 sc/source/ui/vba/vbaformat.cxx   |2 +-
 sc/source/ui/vba/vbarange.cxx|   16 
 14 files changed, 36 insertions(+), 61 deletions(-)

New commits:
commit 3e7ff2a908c577b52ee0707435fb409765c37545
Author: Noel Grandin 
AuthorDate: Sat Jan 21 21:16:21 2023 +0200
Commit: Noel Grandin 
CommitDate: Mon Jan 23 07:27:51 2023 +

XUnoTunnel->dynamic_cast in ScCellRangesBase

Change-Id: Iac62a8ed51d21cc2ef957b3e4811554b62cdb0d1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145982
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/inc/cellsuno.hxx b/sc/inc/cellsuno.hxx
index 65784be7ee3d..e64c1065d5c7 100644
--- a/sc/inc/cellsuno.hxx
+++ b/sc/inc/cellsuno.hxx
@@ -81,7 +81,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -155,7 +154,7 @@ namespace ooo::vba::excel {
 class ScVbaCellRangeAccess;  // Vba Helper class
 }
 
-class SC_DLLPUBLIC ScCellRangesBase :
+class SC_DLLPUBLIC SAL_LOPLUGIN_ANNOTATE("crosscast") ScCellRangesBase :
  public cppu::WeakImplHelper<
 css::beans::XPropertySet,
  css::beans::XMultiPropertySet,
@@ -168,7 +167,6 @@ class SC_DLLPUBLIC ScCellRangesBase :
  css::util::XReplaceable,
  css::util::XModifyBroadcaster,
  css::lang::XServiceInfo,
- css::lang::XUnoTunnel,
  css::beans::XTolerantMultiPropertySet>,
  public SfxListener
 {
@@ -372,9 +370,6 @@ public:
 virtual OUString SAL_CALL getImplementationName() override;
 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) 
override;
 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() 
override;
-
-// XUnoTunnel
-UNO3_GETIMPLEMENTATION_DECL(ScCellRangesBase)
 };
 
 class UNLESS_MERGELIBS(SC_DLLPUBLIC) ScCellRangesObj final : public 
ScCellRangesBase,
@@ -959,9 +954,6 @@ public:
 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) 
override;
 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() 
override;
 
-// XUnoTunnel
-UNO3_GETIMPLEMENTATION_DECL(ScTableSheetObj);
-
 // XTypeProvider
 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() 
override;
diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index 3bba033d28e7..d0fbd02fce43 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -635,9 +635,8 @@ ScDocument* ScTransferObj::GetSourceDocument()
 
 ScDocShell* ScTransferObj::GetSourceDocShell()
 {
-ScCellRangesBase* pRangesObj = 
comphelper::getFromUnoTunnel( m_xDragSourceRanges );
-if (pRangesObj)
-return pRangesObj->GetDocShell();
+if (m_xDragSourceRanges)
+return m_xDragSourceRanges->GetDocShell();
 
 return nullptr;// none set
 }
@@ -645,10 +644,9 @@ ScDocShell* ScTransferObj::GetSourceDocShell()
 ScMarkData ScTransferObj::GetSourceMarkData() const
 {
 ScMarkData aMarkData(m_pDoc->GetSheetLimits());
-ScCellRangesBase* pRangesObj = 
comphelper::getFromUnoTunnel( m_xDragSourceRanges );
-if (pRangesObj)
+if (m_xDragSourceRanges)
 {
-const ScRangeList& rRanges = pRangesObj->GetRangeList();
+const ScRangeList& rRanges = m_xDragSourceRanges->GetRangeList();
 aMarkData.MarkFromRangeList( rRanges, false );
 }
 return aMarkData;
diff --git a/sc/source/ui/inc/transobj.hxx b/sc/source/ui/inc/transobj.hxx
index 3a597669e8b1..1c81610e6fc9 100644
--- a/sc/source/ui/inc/transobj.hxx
+++ b/sc/source/ui/inc/transobj.hxx
@@ -22,12 +22,14 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 
 class ScDocShell;
 class ScMarkData;
 enum class ScDragSrc;
+class ScCellRangesBase;
 
 namespace com::sun::star {
 namespace sheet {
@@ -44,7 +46,7 @@ private:
 TransferableObjectDescriptorm_aObjDesc;
 SfxObjectShellRef   m_aDocShellRef;
 SfxObjectShellRef   m_aDrawPersistRef;
-css::uno::Reference 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source starmath/inc starmath/source

2023-01-22 Thread Noel Grandin (via logerrit)
 sc/inc/fielduno.hxx |5 
 sc/source/ui/unoobj/cellsuno.cxx|4 +--
 sc/source/ui/unoobj/fielduno.cxx|4 ---
 sc/source/ui/unoobj/shapeuno.cxx|2 -
 sc/source/ui/unoobj/textuno.cxx |4 +--
 starmath/inc/mathml/export.hxx  |5 ++--
 starmath/inc/mathml/import.hxx  |5 ++--
 starmath/inc/mathml/mathmlimport.hxx|7 +++--
 starmath/source/document.cxx|4 +--
 starmath/source/mathml/export.cxx   |   24 ++--
 starmath/source/mathml/import.cxx   |   38 +++-
 starmath/source/mathml/mathmlimport.cxx |   18 ++-
 starmath/source/view.cxx|4 +--
 13 files changed, 49 insertions(+), 75 deletions(-)

New commits:
commit fc270b8e046d277606255018f6fc165d65beef8a
Author: Noel Grandin 
AuthorDate: Fri Jan 20 18:45:02 2023 +0200
Commit: Noel Grandin 
CommitDate: Mon Jan 23 06:34:02 2023 +

XUnoTunnel->dynamic_cast in ScEditFieldObj

Change-Id: I6bf89f1a6dc3f7bd1c1934e651e235ba572e83c7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145979
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/inc/fielduno.hxx b/sc/inc/fielduno.hxx
index 89160dfa055f..41a0eb6104f4 100644
--- a/sc/inc/fielduno.hxx
+++ b/sc/inc/fielduno.hxx
@@ -26,7 +26,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -160,7 +159,6 @@ public:
 typedef comphelper::WeakComponentImplHelper<
 css::text::XTextField,
 css::beans::XPropertySet,
-css::lang::XUnoTunnel,
 css::lang::XServiceInfo> ScEditFieldObj_Base;
 class ScEditFieldObj final : public ScEditFieldObj_Base
 {
@@ -232,9 +230,6 @@ public:
 virtual void SAL_CALL removeVetoableChangeListener( const OUString& 
PropertyName,
 const css::uno::Reference< 
css::beans::XVetoableChangeListener >& aListener ) override;
 
-// XUnoTunnel
-UNO3_GETIMPLEMENTATION_DECL(ScEditFieldObj)
-
 // XServiceInfo
 virtual OUString SAL_CALL getImplementationName() override;
 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) 
override;
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 9216ba7a4a31..5d44da0d8fca 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -6016,7 +6016,7 @@ void SAL_CALL ScCellObj::insertTextContent( const 
uno::Reference(xContent);
+ScEditFieldObj* pCellField = 
dynamic_cast(xContent.get());
 SvxUnoTextRangeBase* pTextRange = 
comphelper::getFromUnoTunnel( xRange );
 
 if ( pCellField && !pCellField->IsInserted() && pTextRange )
@@ -6066,7 +6066,7 @@ void SAL_CALL ScCellObj::removeTextContent( const 
uno::Reference(xContent);
+ScEditFieldObj* pCellField = 
dynamic_cast(xContent.get());
 if ( pCellField && pCellField->IsInserted() )
 {
 //! Check if field is in this cell
diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx
index 4d14e4139652..96271342c06d 100644
--- a/sc/source/ui/unoobj/fielduno.cxx
+++ b/sc/source/ui/unoobj/fielduno.cxx
@@ -1252,10 +1252,6 @@ uno::Any SAL_CALL ScEditFieldObj::getPropertyValue( 
const OUString& aPropertyNam
 
 SC_IMPL_DUMMY_PROPERTY_LISTENER( ScEditFieldObj )
 
-// XUnoTunnel
-
-UNO3_GETIMPLEMENTATION_IMPL(ScEditFieldObj);
-
 // XServiceInfo
 
 OUString SAL_CALL ScEditFieldObj::getImplementationName()
diff --git a/sc/source/ui/unoobj/shapeuno.cxx b/sc/source/ui/unoobj/shapeuno.cxx
index 257d15f5d9d6..2dfd6ca10701 100644
--- a/sc/source/ui/unoobj/shapeuno.cxx
+++ b/sc/source/ui/unoobj/shapeuno.cxx
@@ -1086,7 +1086,7 @@ void SAL_CALL ScShapeObj::insertTextContent( const 
uno::Reference xEffContent;
 
-ScEditFieldObj* pCellField = comphelper::getFromUnoTunnel( 
xContent );
+ScEditFieldObj* pCellField = dynamic_cast( xContent.get() 
);
 if ( pCellField )
 {
 //  createInstance("TextField.URL") from the document creates a 
ScCellFieldObj.
diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx
index b8056d0c90d1..6102cdb9fac2 100644
--- a/sc/source/ui/unoobj/textuno.cxx
+++ b/sc/source/ui/unoobj/textuno.cxx
@@ -358,7 +358,7 @@ void SAL_CALL ScHeaderFooterTextObj::insertTextContent(
 SolarMutexGuard aGuard;
 if ( xContent.is() && xRange.is() )
 {
-ScEditFieldObj* pHeaderField = 
comphelper::getFromUnoTunnel( xContent );
+ScEditFieldObj* pHeaderField = dynamic_cast( 
xContent.get() );
 
 SvxUnoTextRangeBase* pTextRange =
 comphelper::getFromUnoTunnel( xRange );
@@ -425,7 +425,7 @@ void SAL_CALL ScHeaderFooterTextObj::removeTextContent(
 SolarMutexGuard aGuard;
 if ( xContent.is() )
 {
-

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2023-01-22 Thread Noel Grandin (via logerrit)
 sc/inc/fmtuno.hxx|9 -
 sc/source/ui/unoobj/cellsuno.cxx |4 ++--
 sc/source/ui/unoobj/fmtuno.cxx   |8 
 3 files changed, 2 insertions(+), 19 deletions(-)

New commits:
commit e7ad863764052b8d5334a20b56c7d415d81b82db
Author: Noel Grandin 
AuthorDate: Fri Jan 20 18:41:25 2023 +0200
Commit: Noel Grandin 
CommitDate: Sun Jan 22 19:11:24 2023 +

XUnoTunnel->dynamic_cast in ScTableConditionalFormat

Change-Id: Ice24bb4e6258b40228213b82436ea6d1d50d0e8e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145975
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/inc/fmtuno.hxx b/sc/inc/fmtuno.hxx
index e9086a84048d..548ca3ec93bc 100644
--- a/sc/inc/fmtuno.hxx
+++ b/sc/inc/fmtuno.hxx
@@ -30,7 +30,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include 
@@ -68,7 +67,6 @@ class ScTableConditionalFormat final : public 
cppu::WeakImplHelper<
 css::sheet::XSheetConditionalEntries,
 css::container::XNameAccess,
 css::container::XEnumerationAccess,
-css::lang::XUnoTunnel,
 css::lang::XServiceInfo >
 {
 private:
@@ -107,9 +105,6 @@ public:
 virtual css::uno::Type SAL_CALL getElementType() override;
 virtual sal_Bool SAL_CALL hasElements() override;
 
-// XUnoTunnel
-UNO3_GETIMPLEMENTATION_DECL(ScTableConditionalFormat)
-
 // XServiceInfo
 virtual OUString SAL_CALL getImplementationName() override;
 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) 
override;
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 079645d79166..9216ba7a4a31 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -2255,7 +2255,7 @@ void ScCellRangesBase::SetOnePropertyValue( const 
SfxItemPropertyMapEntry* pEntr
 if ( !aRanges.empty() && xInterface.is() )  // empty = 
nothing to do
 {
 ScTableConditionalFormat* pFormat =
-
comphelper::getFromUnoTunnel( xInterface );
+dynamic_cast( 
xInterface.get() );
 if (pFormat)
 {
 ScDocument& rDoc = pDocShell->GetDocument();
diff --git a/sc/source/ui/unoobj/fmtuno.cxx b/sc/source/ui/unoobj/fmtuno.cxx
index eabdd7a17be1..d380b95f2314 100644
--- a/sc/source/ui/unoobj/fmtuno.cxx
+++ b/sc/source/ui/unoobj/fmtuno.cxx
@@ -445,10 +445,6 @@ sal_Bool SAL_CALL ScTableConditionalFormat::hasByName( 
const OUString& aName )
 return false;
 }
 
-// XUnoTunnel
-
-UNO3_GETIMPLEMENTATION_IMPL(ScTableConditionalFormat);
-
 ScTableConditionalEntry::ScTableConditionalEntry(ScCondFormatEntryItem  aItem) 
:
 aData(std::move( aItem ))
 {
commit a32675a5fef9cc8a32234ba7ba1eacb53265e735
Author: Noel Grandin 
AuthorDate: Fri Jan 20 18:39:52 2023 +0200
Commit: Noel Grandin 
CommitDate: Sun Jan 22 19:11:14 2023 +

XUnoTunnel->dynamic_cast in ScTableValidationObj

Change-Id: I7b42ed7b7d7332c24908d0011a216e9617e6c80d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145974
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/inc/fmtuno.hxx b/sc/inc/fmtuno.hxx
index 81d1532381ea..e9086a84048d 100644
--- a/sc/inc/fmtuno.hxx
+++ b/sc/inc/fmtuno.hxx
@@ -157,7 +157,6 @@ class ScTableValidationObj final : public 
cppu::WeakImplHelper<
 css::sheet::XSheetCondition2,
 css::sheet::XMultiFormulaTokens,
 css::beans::XPropertySet,
-css::lang::XUnoTunnel,
 css::lang::XServiceInfo >
 {
 private:
@@ -231,9 +230,6 @@ public:
 virtual void SAL_CALL   removeVetoableChangeListener( const OUString& 
PropertyName,
 const css::uno::Reference< 
css::beans::XVetoableChangeListener >& aListener ) override;
 
-// XUnoTunnel
-UNO3_GETIMPLEMENTATION_DECL(ScTableValidationObj)
-
 // XServiceInfo
 virtual OUString SAL_CALL getImplementationName() override;
 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) 
override;
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 851c85645351..079645d79166 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -2302,7 +2302,7 @@ void ScCellRangesBase::SetOnePropertyValue( const 
SfxItemPropertyMapEntry* pEntr
 if ( !aRanges.empty() && xInterface.is() )  // empty = 
nothing to do
 {
 ScTableValidationObj* pValidObj =
-

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2023-01-22 Thread Noel Grandin (via logerrit)
 sc/inc/srchuno.hxx   |5 -
 sc/inc/viewuno.hxx   |5 -
 sc/source/ui/unoobj/cellsuno.cxx |6 +++---
 sc/source/ui/unoobj/srchuno.cxx  |4 
 sc/source/ui/unoobj/viewuno.cxx  |3 ---
 sc/source/ui/view/drawview.cxx   |6 +++---
 sc/source/ui/view/gridwin.cxx|2 +-
 sc/source/ui/view/tabview.cxx|2 +-
 sc/source/ui/view/tabview3.cxx   |2 +-
 sc/source/ui/view/tabview5.cxx   |2 +-
 sc/source/ui/view/tabvwsh4.cxx   |2 +-
 11 files changed, 11 insertions(+), 28 deletions(-)

New commits:
commit f94dc655ec37ec8f40de70f9105a8427a362f266
Author: Noel Grandin 
AuthorDate: Fri Jan 20 13:51:27 2023 +0200
Commit: Noel Grandin 
CommitDate: Sun Jan 22 19:11:04 2023 +

XUnoTunnel->dynamic_cast in ScCellSearchObj

Change-Id: I6f2eda6daf92959973d97a4be38f58a11415776f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145973
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/inc/srchuno.hxx b/sc/inc/srchuno.hxx
index de3ac50cc925..90381fa48579 100644
--- a/sc/inc/srchuno.hxx
+++ b/sc/inc/srchuno.hxx
@@ -22,7 +22,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -31,7 +30,6 @@ class SvxSearchItem;
 
 class ScCellSearchObj final : public cppu::WeakImplHelper<
 css::util::XReplaceDescriptor,
-css::lang::XUnoTunnel,
 css::lang::XServiceInfo >
 {
 private:
@@ -70,9 +68,6 @@ public:
 virtual void SAL_CALL   removeVetoableChangeListener( const OUString& 
PropertyName,
 const css::uno::Reference< 
css::beans::XVetoableChangeListener >& aListener ) override;
 
-// XUnoTunnel
-UNO3_GETIMPLEMENTATION_DECL(ScCellSearchObj)
-
 // XServiceInfo
 virtual OUString SAL_CALL getImplementationName() override;
 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) 
override;
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 119486d79768..851c85645351 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -3758,7 +3758,7 @@ uno::Reference SAL_CALL 
ScCellRangesBase::findAll(
 uno::Reference xRet;
 if ( pDocShell && xDesc.is() )
 {
-ScCellSearchObj* pSearch = 
comphelper::getFromUnoTunnel( xDesc );
+ScCellSearchObj* pSearch = dynamic_cast( xDesc.get() 
);
 if (pSearch)
 {
 SvxSearchItem* pSearchItem = pSearch->GetSearchItem();
@@ -3797,7 +3797,7 @@ uno::Reference 
ScCellRangesBase::Find_Impl(
 uno::Reference xRet;
 if ( pDocShell && xDesc.is() )
 {
-ScCellSearchObj* pSearch = 
comphelper::getFromUnoTunnel( xDesc );
+ScCellSearchObj* pSearch = dynamic_cast( xDesc.get() 
);
 if (pSearch)
 {
 SvxSearchItem* pSearchItem = pSearch->GetSearchItem();
@@ -3878,7 +3878,7 @@ sal_Int32 SAL_CALL ScCellRangesBase::replaceAll( const 
uno::Reference( xDesc );
+ScCellSearchObj* pSearch = dynamic_cast( xDesc.get() 
);
 if (pSearch)
 {
 SvxSearchItem* pSearchItem = pSearch->GetSearchItem();
diff --git a/sc/source/ui/unoobj/srchuno.cxx b/sc/source/ui/unoobj/srchuno.cxx
index d5d78d75d6d9..036f6c89817b 100644
--- a/sc/source/ui/unoobj/srchuno.cxx
+++ b/sc/source/ui/unoobj/srchuno.cxx
@@ -189,8 +189,4 @@ uno::Sequence SAL_CALL 
ScCellSearchObj::getSupportedServiceNames()
 return {SCSEARCHDESCRIPTOR_SERVICE, SCREPLACEDESCRIPTOR_SERVICE};
 }
 
-// XUnoTunnel
-
-UNO3_GETIMPLEMENTATION_IMPL(ScCellSearchObj);
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit f647691a4f1a3a02aa4e997246ff7c16bcaa
Author: Noel Grandin 
AuthorDate: Fri Jan 20 13:47:35 2023 +0200
Commit: Noel Grandin 
CommitDate: Sun Jan 22 19:10:55 2023 +

XUnoTunnel->dynamic_cast in ScTabViewObj

Change-Id: I8400b56dd656fe2a1144696db8578869b2d26cc4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145972
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/inc/viewuno.hxx b/sc/inc/viewuno.hxx
index b4ce26f7fc8d..027b4753a944 100644
--- a/sc/inc/viewuno.hxx
+++ b/sc/inc/viewuno.hxx
@@ -38,7 +38,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
@@ -137,7 +136,6 @@ class ScTabViewObj final : public ScViewPaneBase,
  public css::sheet::XViewSplitable,
  public css::sheet::XViewFreezable,
  public css::sheet::XRangeSelection,
- public css::lang::XUnoTunnel,
  public css::datatransfer::XTransferableSupplier,
  public css::sheet::XSelectedSheetsSupplier
 {
@@ -269,9 +267,6 @@ public:
 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) 
override;
 virtual css::uno::Sequence< 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source sd/source

2023-01-16 Thread Noel Grandin (via logerrit)
 sc/inc/textuno.hxx|7 ---
 sc/source/ui/unoobj/textuno.cxx   |   16 +---
 sd/source/ui/framework/factories/Pane.cxx |   13 -
 sd/source/ui/inc/framework/Pane.hxx   |   16 
 sd/source/ui/view/ViewTabBar.cxx  |3 +--
 5 files changed, 6 insertions(+), 49 deletions(-)

New commits:
commit fe48df2684aa2877b26a112b738f3756db10fa6d
Author: Noel Grandin 
AuthorDate: Mon Jan 16 16:14:47 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Jan 17 06:43:26 2023 +

XUnoTunnel->dynamic_cast in sd::framework::Pane

Change-Id: I3e6408af0b57bd3b714551c42a31b5b0aabaf3a0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145640
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sd/source/ui/framework/factories/Pane.cxx 
b/sd/source/ui/framework/factories/Pane.cxx
index a188f0e11799..c128a5351f14 100644
--- a/sd/source/ui/framework/factories/Pane.cxx
+++ b/sd/source/ui/framework/factories/Pane.cxx
@@ -136,19 +136,6 @@ sal_Bool SAL_CALL Pane::isAnchorOnly()
 return true;
 }
 
-//- XUnoTunnel 
-
-const Sequence& Pane::getUnoTunnelId()
-{
-static const comphelper::UnoIdInit thePaneUnoTunnelId;
-return thePaneUnoTunnelId.getSeq();
-}
-
-sal_Int64 SAL_CALL Pane::getSomething (const Sequence& rId)
-{
-return comphelper::getSomethingImpl(rId, this);
-}
-
 Reference Pane::CreateCanvas()
 {
 Reference xCanvas;
diff --git a/sd/source/ui/inc/framework/Pane.hxx 
b/sd/source/ui/inc/framework/Pane.hxx
index 9e8ee25a1f73..51b7a5ed0934 100644
--- a/sd/source/ui/inc/framework/Pane.hxx
+++ b/sd/source/ui/inc/framework/Pane.hxx
@@ -21,7 +21,6 @@
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -31,8 +30,7 @@ namespace sd::framework {
 
 typedef ::cppu::WeakComponentImplHelper <
   css::drawing::framework::XPane,
-  css::drawing::framework::XPane2,
-  css::lang::XUnoTunnel
+  css::drawing::framework::XPane2
 > PaneInterfaceBase;
 
 /** A pane is a wrapper for a window and possibly for a tab bar (for view
@@ -42,8 +40,8 @@ typedef ::cppu::WeakComponentImplHelper <
 1. It implements the XPane interface.  This is the most important
 interface of this class for API based views (of which there not that
 many yet) because it gives access to the XWindow.
-2. It gives access to the underlying VCL Window by implementing the
-XUnoTunnel interface.  This is necessary at the moment and in the
+2. It gives access to the underlying VCL Window.
+This is necessary at the moment and in the
 foreseeable future because many parts of the Draw and Impress views rely
 on direct access on the Window class.
 */
@@ -69,9 +67,7 @@ public:
 
 virtual void SAL_CALL disposing() override;
 
-static const css::uno::Sequence& getUnoTunnelId();
-
-/** This method is typically used together with the XUnoTunnel to obtain
+/** This method is typically used to obtain
 a Window pointer from an XPane object.
 */
 virtual vcl::Window* GetWindow();
@@ -109,10 +105,6 @@ public:
 */
 virtual sal_Bool SAL_CALL isAnchorOnly() override;
 
-//- XUnoTunnel 
-
-virtual sal_Int64 SAL_CALL getSomething (const 
css::uno::Sequence& rId) override;
-
 protected:
 css::uno::Reference mxPaneId;
 VclPtr mpWindow;
diff --git a/sd/source/ui/view/ViewTabBar.cxx b/sd/source/ui/view/ViewTabBar.cxx
index 588b55eaee8b..d9fdd2addfdf 100644
--- a/sd/source/ui/view/ViewTabBar.cxx
+++ b/sd/source/ui/view/ViewTabBar.cxx
@@ -185,8 +185,7 @@ vcl::Window* ViewTabBar::GetAnchorWindow(
 // Tunnel through the XWindow to the VCL side.
 try
 {
-Reference xTunnel (xPane, UNO_QUERY_THROW);
-if (auto pPane = 
comphelper::getFromUnoTunnel(xTunnel))
+if (auto pPane = dynamic_cast(xPane.get()))
 pWindow = pPane->GetWindow()->GetParent();
 }
 catch (const RuntimeException&)
commit bd881e48f7860596096a45816c559ac100b0bf59
Author: Noel Grandin 
AuthorDate: Mon Jan 16 14:07:19 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Jan 17 06:43:18 2023 +

XUnoTunnel->dynamic_cast in ScHeaderFooterContentObj

Change-Id: I3edc648a4a0afbfd2922befc9e1962df0a22b54f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145637
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/inc/textuno.hxx b/sc/inc/textuno.hxx
index 55136ef2348c..e5ec1aca0cad 100644
--- a/sc/inc/textuno.hxx
+++ b/sc/inc/textuno.hxx
@@ -25,7 +25,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -54,7 +53,6 @@ enum class ScHeaderFooterPart{ LEFT, CENTER, RIGHT };
 
 class ScHeaderFooterContentObj final : public cppu::WeakImplHelper<
 css::sheet::XHeaderFooterContent,
- 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2022-12-30 Thread Noel Grandin (via logerrit)
 sc/inc/scmatrix.hxx  |5 
 sc/source/core/tool/compiler.cxx |  225 ++---
 sc/source/core/tool/interpr5.cxx |  109 +++---
 sc/source/core/tool/scmatrix.cxx |  231 ---
 4 files changed, 400 insertions(+), 170 deletions(-)

New commits:
commit 9713a4aae980a52d08d38f5b12424aa5e33f9a75
Author: Noel Grandin 
AuthorDate: Wed Dec 28 17:30:12 2022 +0200
Commit: Noel Grandin 
CommitDate: Fri Dec 30 18:59:48 2022 +

optimise SUMPRODUCT(IF..) where we have entire column/row ranges

following the same pattern as for SUM, set those ranges to shrink to
available data.

Takes it from 3s to <500ms on my test spreadsheet.

Change-Id: I53ada996393a063b12ef7dd0f9bff40c90ecc8be
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144850
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index e55a7e923c19..f97bff3053dd 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -6465,89 +6465,178 @@ void ScCompiler::AnnotateTrimOnDoubleRefs()
 // OpCode of the "root" operator (which is already in RPN array).
 OpCode eOpCode = (*(pCode - 1))->GetOpCode();
 // eOpCode can be some operator which does not change with operands with 
or contains zero values.
-if (eOpCode != ocSum)
-return;
+if (eOpCode == ocSum)
+{
+FormulaToken** ppTok = pCode - 2; // exclude the root operator.
+// The following loop runs till a "pattern" is found or there is a 
mismatch
+// and marks the push DoubleRef arguments as trimmable when there is a 
match.
+// The pattern is
+// SUM(IF(=, ))
+// such that one of the operands of ocEqual is a double-ref.
+// Examples of formula that matches this are:
+//   SUM(IF(D:D=$A$1,F:F)*$H$1*2.3/$G$2)
+//   SUM((IF(D:D=$A$1,F:F)*$H$1*2.3/$G$2)*$H$2*5/$G$3)
+//   SUM(IF(E:E=16,F:F)*$H$1*100)
+bool bTillClose = true;
+bool bCloseTillIf = false;
+sal_Int16 nToksTillIf = 0;
+constexpr sal_Int16 MAXDIST_IF = 15;
+while (*ppTok)
+{
+FormulaToken* pTok = *ppTok;
+OpCode eCurrOp = pTok->GetOpCode();
+++nToksTillIf;
+
+// TODO : Is there a better way to handle this ?
+// ocIf is too far off from the sum opcode.
+if (nToksTillIf > MAXDIST_IF)
+return;
 
-FormulaToken** ppTok = pCode - 2; // exclude the root operator.
-// The following loop runs till a "pattern" is found or there is a mismatch
-// and marks the push DoubleRef arguments as trimmable when there is a 
match.
-// The pattern is
-// SUM(IF(=, ))
-// such that one of the operands of ocEqual is a double-ref.
-// Examples of formula that matches this are:
-//   SUM(IF(D:D=$A$1,F:F)*$H$1*2.3/$G$2)
-//   SUM((IF(D:D=$A$1,F:F)*$H$1*2.3/$G$2)*$H$2*5/$G$3)
-//   SUM(IF(E:E=16,F:F)*$H$1*100)
-bool bTillClose = true;
-bool bCloseTillIf = false;
-sal_Int16 nToksTillIf = 0;
-constexpr sal_Int16 MAXDIST_IF = 15;
-while (*ppTok)
-{
-FormulaToken* pTok = *ppTok;
-OpCode eCurrOp = pTok->GetOpCode();
-++nToksTillIf;
-
-// TODO : Is there a better way to handle this ?
-// ocIf is too far off from the sum opcode.
-if (nToksTillIf > MAXDIST_IF)
-return;
+switch (eCurrOp)
+{
+case ocDiv:
+case ocMul:
+if (!bTillClose)
+return;
+break;
+case ocPush:
 
-switch (eCurrOp)
-{
-case ocDiv:
-case ocMul:
-if (!bTillClose)
-return;
-break;
-case ocPush:
+break;
+case ocClose:
+if (bTillClose)
+{
+bTillClose = false;
+bCloseTillIf = true;
+}
+else
+return;
+break;
+case ocIf:
+{
+if (!bCloseTillIf)
+return;
 
-break;
-case ocClose:
-if (bTillClose)
-{
-bTillClose = false;
-bCloseTillIf = true;
-}
-else
+if (!pTok->IsInForceArray())
+return;
+
+const short nJumpCount = pTok->GetJump()[0];
+if (nJumpCount != 2) // Should have THEN but no ELSE.
+return;
+
+OpCode eCompOp = 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source svtools/source

2022-06-27 Thread Caolán McNamara (via logerrit)
 sc/inc/cellvalue.hxx  |2 ++
 sc/source/core/data/cellvalue.cxx |   19 ---
 svtools/source/svrtf/parrtf.cxx   |2 +-
 3 files changed, 15 insertions(+), 8 deletions(-)

New commits:
commit 1ea097688f27ce1cfbceb2637437b0d60e61bc40
Author: Caolán McNamara 
AuthorDate: Mon Jun 27 16:02:15 2022 +0100
Commit: Caolán McNamara 
CommitDate: Mon Jun 27 18:46:23 2022 +0200

ofz#24932 Infinite loop

Change-Id: I05770f0209aaee1b9af6b88f85764ec98e7fa5a5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136504
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/svtools/source/svrtf/parrtf.cxx b/svtools/source/svrtf/parrtf.cxx
index c6dcef7a0b69..24272800f49c 100644
--- a/svtools/source/svrtf/parrtf.cxx
+++ b/svtools/source/svrtf/parrtf.cxx
@@ -168,7 +168,7 @@ int SvRTFParser::GetNextToken_()
 {
 nNextToken = GetNextToken_();
 }
-while (nNextToken != '{' && nNextToken != 
sal_Unicode(EOF));
+while (nNextToken != '{' && nNextToken != 
sal_Unicode(EOF) && IsParserWorking());
 
 SkipGroup();
 GetNextToken_();  // overread the last bracket
commit e7b3c961e95fdf51557702f2e74db796a6bd2c09
Author: Caolán McNamara 
AuthorDate: Mon Jun 27 15:57:02 2022 +0100
Commit: Caolán McNamara 
CommitDate: Mon Jun 27 18:46:04 2022 +0200

cid#1506511 silence Uncaught exception

and

cid#1506512 Uncaught exception
cid#1506513 Uncaught exception

Change-Id: I964430a69ce4d4beb7f7a551d3ac454c8122a3fa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136503
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sc/inc/cellvalue.hxx b/sc/inc/cellvalue.hxx
index 75e144c77252..6db9dee493cf 100644
--- a/sc/inc/cellvalue.hxx
+++ b/sc/inc/cellvalue.hxx
@@ -33,6 +33,8 @@ struct SC_DLLPUBLIC ScCellValue
 private:
 /// std::monostate is there to indicate CellType::NONE
 std::variant maData;
+
+void reset_to_empty();
 public:
 
 ScCellValue();
diff --git a/sc/source/core/data/cellvalue.cxx 
b/sc/source/core/data/cellvalue.cxx
index 44fde8c7ed03..4330ea972992 100644
--- a/sc/source/core/data/cellvalue.cxx
+++ b/sc/source/core/data/cellvalue.cxx
@@ -277,10 +277,15 @@ ScCellValue::ScCellValue( const ScCellValue& r )
 }
 }
 
+void ScCellValue::reset_to_empty()
+{
+suppress_fun_call_w_exception(maData = std::monostate()); // reset to 
empty;
+}
+
 ScCellValue::ScCellValue(ScCellValue&& r) noexcept
 : maData(std::move(r.maData))
 {
-r.maData = std::monostate(); // reset to empty;
+r.reset_to_empty();
 }
 
 ScCellValue::~ScCellValue()
@@ -308,17 +313,17 @@ void ScCellValue::clear() noexcept
 switch (getType())
 {
 case CELLTYPE_EDIT:
-delete getEditText();
+suppress_fun_call_w_exception(delete getEditText());
 break;
 case CELLTYPE_FORMULA:
-delete getFormula();
+suppress_fun_call_w_exception(delete getFormula());
 break;
 default:
 ;
 }
 
 // Reset to empty value.
-maData = std::monostate();
+reset_to_empty();
 }
 
 void ScCellValue::set( double fValue )
@@ -475,7 +480,7 @@ void ScCellValue::release( ScDocument& rDoc, const 
ScAddress& rPos )
 rDoc.SetEmptyCell(rPos);
 }
 
-maData = std::monostate(); // reset to empty
+reset_to_empty(); // reset to empty
 }
 
 void ScCellValue::release( ScColumn& rColumn, SCROW nRow, 
sc::StartListeningType eListenType )
@@ -503,7 +508,7 @@ void ScCellValue::release( ScColumn& rColumn, SCROW nRow, 
sc::StartListeningType
 rColumn.DeleteContent(nRow);
 }
 
-maData = std::monostate(); // reset to empty
+reset_to_empty(); // reset to empty
 }
 
 OUString ScCellValue::getString( const ScDocument& rDoc ) const
@@ -532,7 +537,7 @@ ScCellValue& ScCellValue::operator=(ScCellValue&& rCell) 
noexcept
 {
 clear();
 maData = std::move(rCell.maData);
-rCell.maData = std::monostate(); // reset to empty;
+rCell.reset_to_empty(); // reset to empty;
 return *this;
 }
 


[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source sc/uiconfig

2022-04-03 Thread Tomaž Vajngerl (via logerrit)
 sc/inc/SparklineGroup.hxx|   14 
 sc/inc/column.hxx|2 
 sc/inc/document.hxx  |1 
 sc/inc/global.hxx|7 
 sc/inc/mtvelements.hxx   |2 
 sc/inc/table.hxx |1 
 sc/source/core/data/column2.cxx  |   18 +
 sc/source/core/data/column3.cxx  |6 
 sc/source/core/data/document.cxx |   14 
 sc/source/core/data/table2.cxx   |   10 
 sc/source/ui/dialogs/SparklineDialog.cxx |  113 ++
 sc/source/ui/inc/SparklineDialog.hxx |   28 +
 sc/uiconfig/scalc/ui/sparklinedialog.ui  |  501 ++-
 13 files changed, 696 insertions(+), 21 deletions(-)

New commits:
commit 744722123a8ce3d3c30583ba1285a21e129b471f
Author: Tomaž Vajngerl 
AuthorDate: Tue Mar 15 15:18:16 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Sun Apr 3 09:07:19 2022 +0200

sc: support deleting a Sparkline with 'Clear Content' function

Change-Id: Ida61b402170238fb0505c777e49954c15d376cf0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132467
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 372aef84c24e..36ea217a481a 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -666,6 +666,8 @@ public:
 // Spaklines
 sc::SparklineCell* GetSparklineCell(SCROW nRow);
 void CreateSparklineCell(SCROW nRow, std::shared_ptr const& 
pSparkline);
+void DeleteSparklineCells(sc::ColumnBlockPosition& rBlockPos, SCROW nRow1, 
SCROW nRow2);
+bool DeleteSparkline(SCROW nRow);
 
 // cell notes
 ScPostIt* GetCellNote( SCROW nRow );
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 84199c00de4c..420c0eb06e35 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1252,6 +1252,7 @@ public:
 SC_DLLPUBLIC sc::Sparkline* GetSparkline(ScAddress const & rPosition);
 SC_DLLPUBLIC sc::Sparkline* CreateSparkline(ScAddress const & rPosition, 
std::shared_ptr const& pSparklineGroup);
 SC_DLLPUBLIC sc::SparklineList* GetSparklineList(SCTAB nTab);
+SC_DLLPUBLIC bool DeleteSparkline(ScAddress const& rPosition);
 
 /** Notes **/
 SC_DLLPUBLIC ScPostIt*   GetNote(const ScAddress& rPos);
diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index 5c6293432b67..decf343154ae 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -157,19 +157,20 @@ enum class InsertDeleteFlags : sal_uInt16
 OBJECTS  = 0x0080,   /// Drawing objects.
 EDITATTR = 0x0100,   /// Rich-text attributes.
 OUTLINE  = 0x0800,   /// Sheet / outlining (grouping) information
+SPARKLINES   = 0x4000,   /// Sparklines in a cell.
 NOCAPTIONS   = 0x0200,   /// Internal use only (undo etc.): do not 
copy/delete caption objects of cell notes.
 ADDNOTES = 0x0400,   /// Internal use only (copy from clip): do 
not delete existing cell contents when pasting notes.
 SPECIAL_BOOLEAN  = 0x1000,
 FORGETCAPTIONS   = 0x2000,   /// Internal use only (d undo): do not 
delete caption objects of cell notes.
 ATTRIB   = HARDATTR | STYLES,
-CONTENTS = VALUE | DATETIME | STRING | NOTE | FORMULA | OUTLINE,
-ALL  = CONTENTS | ATTRIB | OBJECTS,
+CONTENTS = VALUE | DATETIME | STRING | NOTE | FORMULA | OUTLINE | 
SPARKLINES,
+ALL  = CONTENTS | ATTRIB | OBJECTS | SPARKLINES,
 /// Copy flags for auto/series fill functions: do not touch notes and 
drawing objects.
 AUTOFILL = ALL & ~(NOTE | OBJECTS)
 };
 namespace o3tl
 {
-template<> struct typed_flags : 
is_typed_flags {};
+template<> struct typed_flags : 
is_typed_flags {};
 }
 // This doesn't work at the moment, perhaps when we have constexpr we can 
modify InsertDeleteFlags to make it work.
 //static_assert((InsertDeleteFlags::ATTRIB & InsertDeleteFlags::CONTENTS) == 
InsertDeleteFlags::NONE, "these must match");
diff --git a/sc/inc/mtvelements.hxx b/sc/inc/mtvelements.hxx
index ee669c0a6e6b..72f65d2b72ff 100644
--- a/sc/inc/mtvelements.hxx
+++ b/sc/inc/mtvelements.hxx
@@ -142,6 +142,7 @@ typedef mdds::mtv::soa::multi_type_vector CellStoreTyp
 struct ColumnBlockPosition
 {
 CellNoteStoreType::iterator miCellNotePos;
+SparklineStoreType::iterator miSparklinePos;
 BroadcasterStoreType::iterator miBroadcasterPos;
 CellTextAttrStoreType::iterator miCellTextAttrPos;
 CellStoreType::iterator miCellPos;
@@ -152,6 +153,7 @@ struct ColumnBlockPosition
 struct ColumnBlockConstPosition
 {
 CellNoteStoreType::const_iterator miCellNotePos;
+SparklineStoreType::const_iterator miSparklinePos;
 CellTextAttrStoreType::const_iterator miCellTextAttrPos;
 CellStoreType::const_iterator miCellPos;
 
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 996f9a579d70..00ae196f88ab 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -474,6 +474,7 @@ public:
 
  

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2022-03-08 Thread Luboš Luňák (via logerrit)
 sc/inc/compiler.hxx  |2 
 sc/inc/rangenam.hxx  |   30 +---
 sc/source/core/tool/compiler.cxx |   36 ++
 sc/source/core/tool/rangenam.cxx |   75 +++
 sc/source/ui/docshell/externalrefmgr.cxx |6 +-
 5 files changed, 90 insertions(+), 59 deletions(-)

New commits:
commit 4f2ec0ab9c1055920cb5c08b2d237087493130b8
Author: Luboš Luňák 
AuthorDate: Tue Mar 8 17:53:27 2022 +0100
Commit: Luboš Luňák 
CommitDate: Tue Mar 8 21:18:00 2022 +0100

optimize checking for conflicting named ranges

This extends 582fc887f1faafe8ff5f16a13a0208483a93353f, first
check if there is any named range that could possibly conflict (which
generally should be rare).

Change-Id: Ia5e9e56cab29b459bcb489e871b4960ba215b665
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131219
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 

diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx
index 15b3823f649d..5f3b6354c967 100644
--- a/sc/inc/compiler.hxx
+++ b/sc/inc/compiler.hxx
@@ -375,6 +375,8 @@ private:
  */
 ScRangeData* GetRangeData( const formula::FormulaToken& pToken ) const;
 
+bool HasPossibleNamedRangeConflict(SCTAB nTab) const;
+
 static const CharClass* GetCharClassEnglish();
 static const CharClass* GetCharClassLocalized();
 
diff --git a/sc/inc/rangenam.hxx b/sc/inc/rangenam.hxx
index d51aa85a1008..31bdd1f5a23c 100644
--- a/sc/inc/rangenam.hxx
+++ b/sc/inc/rangenam.hxx
@@ -156,6 +156,8 @@ public:
 
 SC_DLLPUBLIC static IsNameValidType IsNameValid( const OUString& 
rName, const ScDocument& rDoc );
 
+bool HasPossibleAddressConflict() const;
+
 void CompileUnresolvedXML( sc::CompileFormulaContext& rCxt );
 
 #if DEBUG_FORMULA_COMPILER
@@ -187,6 +189,12 @@ private:
 typedef ::std::map> DataType;
 DataType m_Data;
 IndexDataType maIndexToData;
+// Use for optimization, true if any of the contained names resolves
+// as a valid cell address (e.g. 'day1' with 16k columns).
+mutable bool mHasPossibleAddressConflict : 1;
+mutable bool mHasPossibleAddressConflictDirty : 1;
+
+void checkHasPossibleAddressConflict() const;
 
 public:
 /// Map that stores non-managed pointers to ScRangeName instances.
@@ -266,6 +274,13 @@ public:
 
 void clear();
 bool operator== (const ScRangeName& r) const;
+
+bool hasPossibleAddressConflict() const
+{
+if( mHasPossibleAddressConflictDirty )
+checkHasPossibleAddressConflict();
+return mHasPossibleAddressConflict;
+}
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index fca54da17f9c..151ccefd6134 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -3344,17 +3344,20 @@ bool ScCompiler::ParseSingleReference( const OUString& 
rName, const OUString* pE
 return false;
 }
 
-// A named range named e.g. 'num1' is valid with 1k columns, but would 
become a reference
-// when the document is opened later with 16k columns. Resolve the 
conflict by not
-// considering it a reference.
-OUString aUpper;
-bool bAsciiUpper = ToUpperAsciiOrI18nIsAscii( aUpper, rName );
-if (bAsciiUpper || mbCharClassesDiffer)
-aUpper = ScGlobal::getCharClass().uppercase( rName );
-mnCurrentSheetTab = aAddr.Tab(); // temporarily set for 
ParseNamedRange()
-if(ParseNamedRange( aUpper, true )) // only check
-return false;
-mnCurrentSheetTab = -1;
+if( HasPossibleNamedRangeConflict( aAddr.Tab()))
+{
+// A named range named e.g. 'num1' is valid with 1k columns, but 
would become a reference
+// when the document is opened later with 16k columns. Resolve the 
conflict by not
+// considering it a reference.
+OUString aUpper;
+bool bAsciiUpper = ToUpperAsciiOrI18nIsAscii( aUpper, rName );
+if (bAsciiUpper || mbCharClassesDiffer)
+aUpper = ScGlobal::getCharClass().uppercase( rName );
+mnCurrentSheetTab = aAddr.Tab(); // temporarily set for 
ParseNamedRange()
+if(ParseNamedRange( aUpper, true )) // only check
+return false;
+mnCurrentSheetTab = -1;
+}
 
 ScSingleRefData aRef;
 aRef.InitAddress( aAddr );
@@ -3586,6 +3589,17 @@ const ScRangeData* ScCompiler::GetRangeData( SCTAB& 
rSheet, const OUString& rUpp
 return pData;
 }
 
+bool ScCompiler::HasPossibleNamedRangeConflict( SCTAB nTab ) const
+{
+const ScRangeName* pRangeName = rDoc.GetRangeName();
+if (pRangeName && pRangeName->hasPossibleAddressConflict())
+return true;
+pRangeName = rDoc.GetRangeName(nTab);
+if (pRangeName && pRangeName->hasPossibleAddressConflict())
+

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2022-03-04 Thread Luboš Luňák (via logerrit)
 sc/inc/attarray.hxx |6 -
 sc/inc/column.hxx   |  166 +++-
 sc/source/core/data/column.cxx  |  111 --
 sc/source/core/data/column2.cxx |   68 
 sc/source/core/data/column4.cxx |5 -
 sc/source/core/data/table1.cxx  |8 -
 6 files changed, 172 insertions(+), 192 deletions(-)

New commits:
commit 16b4525e8770ca457c8b33f08c5f9ef5f35ef62e
Author: Luboš Luňák 
AuthorDate: Fri Mar 4 18:27:13 2022 +0100
Commit: Luboš Luňák 
CommitDate: Sat Mar 5 08:30:45 2022 +0100

remove more hardcoded MAXROW

Change-Id: Ica57f18d3fd1bf9ec06f05869f4a956d7d1097b0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131036
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 

diff --git a/sc/inc/attarray.hxx b/sc/inc/attarray.hxx
index 52c2793c3f3c..f55a4ee8206e 100644
--- a/sc/inc/attarray.hxx
+++ b/sc/inc/attarray.hxx
@@ -21,6 +21,7 @@
 
 #include "global.hxx"
 #include "attrib.hxx"
+#include "document.hxx"
 #include "patattr.hxx"
 
 #include 
@@ -114,6 +115,7 @@ public:
 ~ScAttrArray();
 
 ScDocument& GetDoc() { return rDocument; }
+const ScDocument& GetDoc() const { return rDocument; }
 voidSetTab(SCTAB nNewTab)   { nTab = nNewTab; }
 voidSetCol(SCCOL nNewCol)   { nCol = nNewCol; }
 #if DEBUG_SC_TESTATTRARRAY
@@ -266,10 +268,10 @@ inline const ScPatternAttr* ScAttrIterator::Next( SCROW& 
rTop, SCROW& rBottom )
 if ( !nPos )
 {
 ++nPos;
-if ( nRow > MAXROW )
+if ( nRow > pArray->GetDoc().MaxRow())
 return nullptr;
 rTop = nRow;
-rBottom = std::min( nEndRow, MAXROW );
+rBottom = std::min( nEndRow, pArray->GetDoc().MaxRow());
 nRow = rBottom + 1;
 return pDefPattern;
 }
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index de69846442ca..1ec4aac4204b 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -281,8 +281,7 @@ public:
 boolGetFirstVisibleAttr( SCROW& rFirstRow ) const;
 boolGetLastVisibleAttr( SCROW& rLastRow ) const;
 boolHasVisibleAttrIn( SCROW nStartRow, SCROW nEndRow ) const;
-boolIsVisibleAttrEqual( const ScColumn& rCol, SCROW nStartRow = 0,
-SCROW nEndRow = MAXROW ) const;
+boolIsVisibleAttrEqual( const ScColumn& rCol, SCROW nStartRow, SCROW 
nEndRow ) const;
 boolIsAllAttrEqual( const ScColumn& rCol, SCROW nStartRow, SCROW 
nEndRow ) const;
 
 boolTestInsertCol( SCROW nStartRow, SCROW nEndRow) const;
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 7329b4f455b9..99c673eb5d6a 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -631,7 +631,7 @@ bool ScTable::GetPrintArea( SCCOL& rEndCol, SCROW& rEndRow, 
bool bNotes, bool bC
 if (nMaxX == rDocument.MaxCol())// omit attribute at 
the right
 {
 --nMaxX;
-while ( nMaxX>0 && aCol[nMaxX].IsVisibleAttrEqual(aCol[nMaxX+1]) )
+while ( nMaxX>0 && aCol[nMaxX].IsVisibleAttrEqual(aCol[nMaxX+1], 0, 
rDocument.MaxRow()) )
 --nMaxX;
 }
 
@@ -645,7 +645,7 @@ bool ScTable::GetPrintArea( SCCOL& rEndCol, SCROW& rEndRow, 
bool bNotes, bool bC
 while ( nAttrStartX < (aCol.size()-1) )
 {
 SCCOL nAttrEndX = nAttrStartX;
-while ( nAttrEndX < (aCol.size()-1) && 
aCol[nAttrStartX].IsVisibleAttrEqual(aCol[nAttrEndX+1]) )
+while ( nAttrEndX < (aCol.size()-1) && 
aCol[nAttrStartX].IsVisibleAttrEqual(aCol[nAttrEndX+1], 0, rDocument.MaxRow()) )
 ++nAttrEndX;
 if ( nAttrEndX + 1 - nAttrStartX >= SC_COLUMNS_STOP )
 {
@@ -770,10 +770,10 @@ bool ScTable::GetDataStart( SCCOL& rStartCol, SCROW& 
rStartRow ) const
 
 if (nMinX == 0) // omit attribute at 
the right
 {
-if ( aCol.size() > 1 && aCol[0].IsVisibleAttrEqual(aCol[1]) )  // 
no single ones
+if ( aCol.size() > 1 && aCol[0].IsVisibleAttrEqual(aCol[1], 0, 
rDocument.MaxRow())) // no single ones
 {
 ++nMinX;
-while ( nMinX<(aCol.size()-1) && 
aCol[nMinX].IsVisibleAttrEqual(aCol[nMinX-1]) )
+while ( nMinX<(aCol.size()-1) && 
aCol[nMinX].IsVisibleAttrEqual(aCol[nMinX-1], 0, rDocument.MaxRow()))
 ++nMinX;
 }
 }
commit 2e2e30d7ae445509e39ba47c1b248079f28c8d95
Author: Luboš Luňák 
AuthorDate: Fri Mar 4 16:40:20 2022 +0100
Commit: Luboš Luňák 
CommitDate: Sat Mar 5 08:30:30 2022 +0100

remove pAttrArray nullptr checks

I don't see how it possibly could be nullptr in a correct situation,
ScColumn::Init() is called right after creating ScColumn.
Also make a bunch of trivial forwarding functions inline.

Change-Id: I710d3cd86a660a8b4dcfbb9966a685b657b93c18

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2022-02-15 Thread Luboš Luňák (via logerrit)
 sc/inc/bigrange.hxx|   28 ++---
 sc/source/core/data/bigrange.cxx   |6 -
 sc/source/core/data/documen2.cxx   |8 -
 sc/source/core/tool/chgtrack.cxx   |   88 -
 sc/source/core/tool/refupdat.cxx   |   16 +--
 sc/source/filter/xcl97/XclExpChangeTrack.cxx   |6 -
 sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx |   12 +-
 sc/source/ui/docshell/docsh3.cxx   |   20 +--
 sc/source/ui/miscdlgs/acredlin.cxx |   10 -
 sc/source/ui/miscdlgs/conflictsdlg.cxx |4 
 sc/source/ui/miscdlgs/redcom.cxx   |2 
 sc/source/ui/view/gridwin5.cxx |4 
 sc/source/ui/view/output.cxx   |4 
 sc/source/ui/view/viewutil.cxx |2 
 14 files changed, 106 insertions(+), 104 deletions(-)

New commits:
commit 28cbc0dcb955954b4d9b85376f356999af429f06
Author: Luboš Luňák 
AuthorDate: Tue Feb 15 14:19:29 2022 +0100
Commit: Luboš Luňák 
CommitDate: Tue Feb 15 21:48:36 2022 +0100

move nInt32Min/nInt32Max to ScBigRange and rename to nRangeMin/Max

Change-Id: I4537d6ebcd8293bc7a62651345a517ebfe901638
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129965
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 

diff --git a/sc/inc/bigrange.hxx b/sc/inc/bigrange.hxx
index a9927b39a4b3..538d94dcb782 100644
--- a/sc/inc/bigrange.hxx
+++ b/sc/inc/bigrange.hxx
@@ -22,9 +22,6 @@
 #include "address.hxx"
 #include "document.hxx"
 
-const sal_Int32 nInt32Min = 0x8000;
-const sal_Int32 nInt32Max = 0x7fff;
-
 // This is used by change tracking. References there may be located also 
outside of the document
 // (see ScRefUpdate::Update()), and so it needs bigger range than 
ScAddress/ScRange.
 
@@ -148,6 +145,10 @@ public:
 { return (aStart == r.aStart) && (aEnd == r.aEnd); }
 booloperator!=( const ScBigRange& r ) const
 { return !operator==( r ); }
+
+// These are used to define whole rows/cols/tabs.
+constexpr static sal_Int32 nRangeMin = 0x8000;
+constexpr static sal_Int32 nRangeMax = 0x7fff;
 };
 
 inline bool ScBigRange::Contains( const ScBigAddress& rAddr ) const
diff --git a/sc/source/core/data/bigrange.cxx b/sc/source/core/data/bigrange.cxx
index 58a11eb03735..192765743958 100644
--- a/sc/source/core/data/bigrange.cxx
+++ b/sc/source/core/data/bigrange.cxx
@@ -14,11 +14,11 @@ bool ScBigAddress::IsValid( const ScDocument& rDoc ) const
 {   // min/max interval bounds define whole col/row/tab
 return
 ((0 <= nCol && nCol <= rDoc.MaxCol())
-|| nCol == nInt32Min || nCol == nInt32Max) &&
+|| nCol == ScBigRange::nRangeMin || nCol == ScBigRange::nRangeMax) 
&&
 ((0 <= nRow && nRow <= rDoc.MaxRow())
-|| nRow == nInt32Min || nRow == nInt32Max) &&
+|| nRow == ScBigRange::nRangeMin || nRow == ScBigRange::nRangeMax) 
&&
 ((0 <= nTab && nTab < rDoc.GetTableCount())
-|| nTab == nInt32Min || nTab == nInt32Max)
+|| nTab == ScBigRange::nRangeMin || nTab == ScBigRange::nRangeMax)
 ;
 }
 
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index 1911f80af145..2ba5ee368c24 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -623,13 +623,13 @@ ScChangeActionIns::ScChangeActionIns( const ScDocument* 
pDoc, const ScRange& rRa
 {
 if ( rRange.aStart.Col() == 0 && rRange.aEnd.Col() == pDoc->MaxCol() )
 {
-aBigRange.aStart.SetCol( nInt32Min );
-aBigRange.aEnd.SetCol( nInt32Max );
+aBigRange.aStart.SetCol( ScBigRange::nRangeMin );
+aBigRange.aEnd.SetCol( ScBigRange::nRangeMax );
 if ( rRange.aStart.Row() == 0 && rRange.aEnd.Row() == pDoc->MaxRow() )
 {
 SetType( SC_CAT_INSERT_TABS );
-aBigRange.aStart.SetRow( nInt32Min );
-aBigRange.aEnd.SetRow( nInt32Max );
+aBigRange.aStart.SetRow( ScBigRange::nRangeMin );
+aBigRange.aEnd.SetRow( ScBigRange::nRangeMax );
 }
 else
 SetType( SC_CAT_INSERT_ROWS );
@@ -637,8 +637,8 @@ ScChangeActionIns::ScChangeActionIns( const ScDocument* 
pDoc, const ScRange& rRa
 else if ( rRange.aStart.Row() == 0 && rRange.aEnd.Row() == pDoc->MaxRow() )
 {
 SetType( SC_CAT_INSERT_COLS );
-aBigRange.aStart.SetRow( nInt32Min );
-aBigRange.aEnd.SetRow( nInt32Max );
+aBigRange.aStart.SetRow( ScBigRange::nRangeMin );
+aBigRange.aEnd.SetRow( ScBigRange::nRangeMax );
 }
 else
 {
@@ -743,13 +743,13 @@ ScChangeActionDel::ScChangeActionDel( const ScDocument* 
pDoc, const ScRange& rRa
 {
 if ( rRange.aStart.Col() == 0 && rRange.aEnd.Col() == pDoc->MaxCol() )
 {

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2021-11-25 Thread Luboš Luňák (via logerrit)
 sc/inc/table.hxx   |4 ++
 sc/source/core/data/table3.cxx |   81 +
 2 files changed, 70 insertions(+), 15 deletions(-)

New commits:
commit 7b0aabe71d2455f6f643553a07f1056935cf190f
Author: Luboš Luňák 
AuthorDate: Thu Nov 25 00:07:03 2021 +0100
Commit: Luboš Luňák 
CommitDate: Thu Nov 25 14:27:36 2021 +0100

sort, cache and binary search query items if they're many (tdf#136838)

This makes autofilter even with tdf#136838 almost instanteous.

Change-Id: I94b4b6d6ab6f8e73312d88c8b88c0f393707f117
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125795
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 

diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 332be67ee551..0bb6548d5dd9 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -959,6 +959,10 @@ public:
 struct ValidQueryCache
 {
 std::unordered_map 
mCachedSharedErrorStrings;
+std::vector mCachedSortedItemValues;
+std::vector mCachedSortedItemStrings;
+bool mCachedSortedItemValuesReady = false;
+bool mCachedSortedItemStringsReady = false;
 };
 bool ValidQuery(
 SCROW nRow, const ScQueryParam& rQueryParam, const ScRefCellValue* 
pCell = nullptr,
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 270c80b9ed73..4da4f23c59b4 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -2971,7 +2971,7 @@ public:
 
 std::pair validQueryProcessEntry(SCROW nRow, SCCOL nCol, SCTAB 
nTab, const ScQueryParam& rParam,
 ScRefCellValue& aCell, bool* pbTestEqualCondition, const 
ScInterpreterContext* pContext, QueryEvaluator& aEval,
-const ScQueryEntry& rEntry )
+ScTable::ValidQueryCache* pValidQueryCache, const ScQueryEntry& rEntry )
 {
 std::pair aRes(false, false);
 const ScQueryEntry::QueryItemsType& rItems = rEntry.GetQueryItems();
@@ -3007,14 +3007,35 @@ std::pair validQueryProcessEntry(SCROW nRow, 
SCCOL nCol, SCTAB nTab,
 valid = false;
 if(valid)
 {
-for (const auto& rItem : rItems)
+if(rItems.size() >= 100 && pValidQueryCache)
 {
-// For speed don't bother comparing approximately here, 
usually there either
-// will be an exact match or it wouldn't match anyway.
-if (rItem.meType == ScQueryEntry::ByValue
-&& value == rItem.mfVal)
+// Sort, cache and binary search for the value in items.
+// Don't bother comparing approximately.
+auto& values = pValidQueryCache->mCachedSortedItemValues;
+if(!pValidQueryCache->mCachedSortedItemValuesReady)
 {
+values.reserve(rItems.size());
+for (const auto& rItem : rItems)
+if (rItem.meType == ScQueryEntry::ByValue)
+values.push_back(rItem.mfVal);
+std::sort(values.begin(), values.end());
+pValidQueryCache->mCachedSortedItemValuesReady = true;
+}
+auto it = std::lower_bound(values.begin(), values.end(), 
value);
+if( it != values.end() && *it == value )
 return std::make_pair(true, true);
+}
+else
+{
+for (const auto& rItem : rItems)
+{
+// For speed don't bother comparing approximately here, 
usually there either
+// will be an exact match or it wouldn't match anyway.
+if (rItem.meType == ScQueryEntry::ByValue
+&& value == rItem.mfVal)
+{
+return std::make_pair(true, true);
+}
 }
 }
 }
@@ -3042,17 +3063,34 @@ std::pair validQueryProcessEntry(SCROW nRow, 
SCCOL nCol, SCTAB nTab,
 // generous as isQueryByString() but it should be enough and better be 
safe.
 if(cellSharedString != nullptr)
 {
-if (rParam.bCaseSens)
+if(rItems.size() >= 100 && pValidQueryCache)
 {
-for (const auto& rItem : rItems)
+// Sort, cache and binary search for the string in items.
+// Since each SharedString is identified by pointer value,
+// sorting by pointer value is enough.
+auto& values = pValidQueryCache->mCachedSortedItemStrings;
+if(!pValidQueryCache->mCachedSortedItemStringsReady)
 {
-if ((rItem.meType == ScQueryEntry::ByString
-|| (compareByValue && rItem.meType == 
ScQueryEntry::ByValue))
-&& cellSharedString->getData() == 
rItem.maString.getData())
+values.reserve(rItems.size());
+

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2021-11-22 Thread Luboš Luňák (via logerrit)
 sc/inc/global.hxx   |1 -
 sc/inc/table.hxx|9 -
 sc/source/core/data/dociter.cxx |6 --
 sc/source/core/data/global.cxx  |6 ++
 sc/source/core/data/table3.cxx  |   28 +++-
 5 files changed, 37 insertions(+), 13 deletions(-)

New commits:
commit 1a32af4192291ea5cfe7c4c143144a5dab1f156e
Author: Luboš Luňák 
AuthorDate: Mon Nov 22 13:16:43 2021 +0100
Commit: Luboš Luňák 
CommitDate: Mon Nov 22 15:46:46 2021 +0100

cache error strings for ScTable::validQuery()  (tdf#133835)

Avoid calling SharedStringPool::intern() on values that are
repeatedly the same.

Change-Id: I094f2e777a4ca24536e0c25e6a1c6358ccf49f61
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125660
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 

diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 40806e70f31a..332be67ee551 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -954,10 +954,17 @@ public:
 
 void Reorder( const sc::ReorderParam& rParam );
 
+// Internal cache that can be repeatedly used for a sequence of related 
ValidQuery()
+// calls (related meaning done in a loop for the same document and query 
data).
+struct ValidQueryCache
+{
+std::unordered_map 
mCachedSharedErrorStrings;
+};
 bool ValidQuery(
 SCROW nRow, const ScQueryParam& rQueryParam, const ScRefCellValue* 
pCell = nullptr,
 bool* pbTestEqualCondition = nullptr, const ScInterpreterContext* 
pContext = nullptr,
-sc::TableColumnBlockPositionSet* pBlockPos = nullptr );
+sc::TableColumnBlockPositionSet* pBlockPos = nullptr,
+ValidQueryCache* pQueryCache = nullptr );
 voidTopTenQuery( ScQueryParam& );
 voidPrepareQuery( ScQueryParam& rQueryParam );
 SCSIZE  Query(const ScQueryParam& rQueryParam, bool bKeepSub);
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index 378d867b4e55..91cc0a2c213c 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -1117,6 +1117,7 @@ bool ScQueryCellIterator::GetThis()
 !maParam.bHasHeader && rItem.meType == ScQueryEntry::ByString &&
 ((maParam.bByRow && nRow == maParam.nRow1) ||
  (!maParam.bByRow && nCol == maParam.nCol1));
+ScTable::ValidQueryCache validQueryCache;
 
 ScColumn* pCol = &(rDoc.maTabs[nTab])->aCol[nCol];
 while (true)
@@ -1183,7 +1184,7 @@ bool ScQueryCellIterator::GetThis()
 if ( rDoc.maTabs[nTab]->ValidQuery( nRow, maParam,
 (nCol == static_cast(nFirstQueryField) ?  : 
nullptr),
 (nTestEqualCondition ?  : nullptr),
-) )
+, nullptr, ) )
 {
 if ( nTestEqualCondition && bTestEqualCondition )
 nTestEqualCondition |= nTestEqualConditionMatched;
@@ -1506,6 +1507,7 @@ int ScCountIfCellIterator::GetCount()
 const ScQueryEntry::Item& rItem = rEntry.GetQueryItem();
 const bool bSingleQueryItem = rEntry.GetQueryItems().size() == 1;
 int count = 0;
+ScTable::ValidQueryCache validQueryCache;
 
 ScColumn* pCol = &(rDoc.maTabs[nTab])->aCol[nCol];
 while (true)
@@ -1561,7 +1563,7 @@ int ScCountIfCellIterator::GetCount()
 if ( rDoc.maTabs[nTab]->ValidQuery( nRow, maParam,
 (nCol == static_cast(rEntry.nField) ?  : nullptr),
 nullptr,
-) )
+, nullptr, ) )
 {
 if (aCell.isEmpty())
 return count;
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 0ef833511dba..6ff12c4a25b5 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -2330,6 +2330,7 @@ class QueryEvaluator
 CollatorWrapper* mpCollator;
 const bool mbMatchWholeCell;
 const bool mbCaseSensitive;
+ScTable::ValidQueryCache* mpValidQueryCache;
 
 static bool isPartialTextMatchOp(const ScQueryEntry& rEntry)
 {
@@ -2399,7 +2400,7 @@ class QueryEvaluator
 
 public:
 QueryEvaluator(ScDocument& rDoc, const ScTable& rTab, const ScQueryParam& 
rParam,
-   bool pTestEqualCondition) :
+   bool pTestEqualCondition, ScTable::ValidQueryCache* 
pValidQueryCache) :
 mrDoc(rDoc),
 mrStrPool(rDoc.GetSharedStringPool()),
 mrTab(rTab),
@@ -2408,7 +2409,8 @@ public:
 mpTransliteration(nullptr),
 mpCollator(nullptr),
 mbMatchWholeCell(rDoc.GetDocOptions().IsMatchWholeCell()),
-mbCaseSensitive( rParam.bCaseSens )
+mbCaseSensitive( rParam.bCaseSens ),
+mpValidQueryCache( pValidQueryCache )
 {
 }
 
@@ -2595,6 +2597,20 @@ public:
 if (rCell.meType == CELLTYPE_FORMULA && 
rCell.mpFormula->GetErrCode() != FormulaError::NONE)
 {
 // Error cell is evaluated as string (for now).
+ 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source vcl/source

2021-10-05 Thread Eike Rathke (via logerrit)
 sc/inc/formulacell.hxx  |3 +++
 sc/source/core/data/conditio.cxx|4 
 sc/source/core/data/formulacell.cxx |   32 ++--
 vcl/source/window/paint.cxx |9 ++---
 4 files changed, 39 insertions(+), 9 deletions(-)

New commits:
commit ce8a7278e1304f7aaa65bce34aeeda5e83b231f1
Author: Eike Rathke 
AuthorDate: Tue Oct 5 20:04:19 2021 +0200
Commit: Eike Rathke 
CommitDate: Tue Oct 5 22:01:58 2021 +0200

Fix crash if conditional format triggers recursion with iterations enabled

Could occur if a conditional format is evaluated (for example if
row height is to be obtained) while a formula cell it references
is still running and iterations are enabled so the conditional
format's temporary formula cell is added to the iteration
recursion list but iterations are not triggered if there are no
circular references. In that case the temporary formula cell's
pointer remained in the recursion list and it's dangling instance
was accessed in the next round. Mark such formula cell as
free-flying and remove from recursion list if it was added.

Observed at
https://ask.libreoffice.org/t/lo-calc-crashes-when-calling-a-macro/68800
with the original attached file that now got replaced with another
version that doesn't have iterations enabled so wouldn't trigger
the bug (and apparently even doesn't if enabling iterations).

Change-Id: I23a023356f920b8413874cab14acdc8b25580052
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123115
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
index 9ad2ba7b16f7..fd57bde39976 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -137,6 +137,7 @@ private:
 boolmbPostponedDirty : 1;   // if cell needs to be set dirty 
later
 boolmbIsExtRef   : 1; // has references in 
ScExternalRefManager; never cleared after set
 boolmbSeenInPath : 1; // For detecting cycle involving 
formula groups and singleton formulacells
+boolmbFreeFlying : 1; // Cell is out of sheets 
interpreted, like in conditional format
 ScMatrixModecMatrixFlag  : 8;
 sal_uInt16  nSeenInIteration : 16;   // Iteration cycle in which the 
cell was last encountered
 SvNumFormatType nFormatType  : 16;
@@ -222,6 +223,8 @@ public:
 
 ScFormulaCell(const ScFormulaCell& rCell, ScDocument& rDoc, const 
ScAddress& rPos, ScCloneFlags nCloneFlags = ScCloneFlags::Default);
 
+voidSetFreeFlying( bool b ) { mbFreeFlying = b; }
+
 size_t GetHash() const;
 
 voidGetFormula( OUString& rFormula,
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 008592410a75..8707e7eb4c67 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -401,6 +401,7 @@ void ScConditionEntry::MakeCells( const ScAddress& rPos )
 // pFCell1 will hold a flat-copied ScTokenArray sharing ref-counted
 // code tokens with pFormula1
 pFCell1.reset( new ScFormulaCell(*mpDoc, rPos, *pFormula1) );
+pFCell1->SetFreeFlying(true);
 pFCell1->StartListeningTo( *mpDoc );
 }
 
@@ -409,6 +410,7 @@ void ScConditionEntry::MakeCells( const ScAddress& rPos )
 // pFCell2 will hold a flat-copied ScTokenArray sharing ref-counted
 // code tokens with pFormula2
 pFCell2.reset( new ScFormulaCell(*mpDoc, rPos, *pFormula2) );
+pFCell2->SetFreeFlying(true);
 pFCell2->StartListeningTo( *mpDoc );
 }
 }
@@ -653,6 +655,7 @@ void ScConditionEntry::Interpret( const ScAddress& rPos )
 {
 pTemp1.reset(pFormula1 ? new ScFormulaCell(*mpDoc, rPos, *pFormula1) : 
new ScFormulaCell(*mpDoc, rPos));
 pEff1 = pTemp1.get();
+pEff1->SetFreeFlying(true);
 }
 if ( pEff1 )
 {
@@ -683,6 +686,7 @@ void ScConditionEntry::Interpret( const ScAddress& rPos )
 {
 pTemp2.reset(pFormula2 ? new ScFormulaCell(*mpDoc, rPos, *pFormula2) : 
new ScFormulaCell(*mpDoc, rPos));
 pEff2 = pTemp2.get();
+pEff2->SetFreeFlying(true);
 }
 if ( pEff2 )
 {
diff --git a/sc/source/core/data/formulacell.cxx 
b/sc/source/core/data/formulacell.cxx
index 1600a1248141..254f4bcee1d7 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -599,6 +599,7 @@ ScFormulaCell::ScFormulaCell( ScDocument& rDoc, const 
ScAddress& rPos ) :
 mbPostponedDirty(false),
 mbIsExtRef(false),
 mbSeenInPath(false),
+mbFreeFlying(false),
 cMatrixFlag(ScMatrixMode::NONE),
 nSeenInIteration(0),
 nFormatType(SvNumFormatType::NUMBER),
@@ -631,6 +632,7 @@ ScFormulaCell::ScFormulaCell( ScDocument& rDoc, const 
ScAddress& rPos,
 mbPostponedDirty(false),
 mbIsExtRef(false),
 mbSeenInPath(false),
+

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2021-09-24 Thread Noel Grandin (via logerrit)
 sc/inc/cellsuno.hxx  |7 ---
 sc/source/ui/inc/undostyl.hxx|6 --
 sc/source/ui/undo/undostyl.cxx   |   13 -
 sc/source/ui/unoobj/cellsuno.cxx |   26 +-
 4 files changed, 33 insertions(+), 19 deletions(-)

New commits:
commit 8792cf693dba3e05ed72a353685bc99d0d34c250
Author: Noel Grandin 
AuthorDate: Fri Sep 24 11:48:58 2021 +0200
Commit: Noel Grandin 
CommitDate: Fri Sep 24 16:24:34 2021 +0200

no need to allocate this SfxItemSet on the heap

Change-Id: I651d6091db543ebc958f888598edd2cdef4df43a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122574
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/source/ui/inc/undostyl.hxx b/sc/source/ui/inc/undostyl.hxx
index 6ea88d0d9550..a4b3a7f44f76 100644
--- a/sc/source/ui/inc/undostyl.hxx
+++ b/sc/source/ui/inc/undostyl.hxx
@@ -20,7 +20,9 @@
 #pragma once
 
 #include 
+#include 
 #include 
+#include 
 #include "undobase.hxx"
 
 class ScDocShell;
@@ -30,7 +32,7 @@ class ScStyleSaveData
 private:
 OUStringaName;
 OUStringaParent;
-std::unique_ptr  xItems;
+std::optional moItems;
 
 public:
 ScStyleSaveData();
@@ -41,7 +43,7 @@ public:
 
 const OUString& GetName() const { return aName; }
 const OUString& GetParent() const   { return aParent; }
-const SfxItemSet*   GetItems() const{ return xItems.get(); }
+const std::optional& GetItems() const { return moItems; }
 };
 
 class ScUndoModifyStyle: public ScSimpleUndo
diff --git a/sc/source/ui/undo/undostyl.cxx b/sc/source/ui/undo/undostyl.cxx
index f110d0190051..a9d47feec685 100644
--- a/sc/source/ui/undo/undostyl.cxx
+++ b/sc/source/ui/undo/undostyl.cxx
@@ -41,8 +41,8 @@ ScStyleSaveData::ScStyleSaveData( const ScStyleSaveData& 
rOther ) :
 aName( rOther.aName ),
 aParent( rOther.aParent )
 {
-if (rOther.xItems)
-xItems.reset(new SfxItemSet(*rOther.xItems));
+if (rOther.moItems)
+moItems.emplace(*rOther.moItems);
 }
 
 ScStyleSaveData& ScStyleSaveData::operator=( const ScStyleSaveData& rOther )
@@ -51,7 +51,10 @@ ScStyleSaveData& ScStyleSaveData::operator=( const 
ScStyleSaveData& rOther )
 {
 aName   = rOther.aName;
 aParent = rOther.aParent;
-xItems.reset(rOther.xItems ? new SfxItemSet(*rOther.xItems) : nullptr);
+if (rOther.moItems)
+moItems.emplace(*rOther.moItems);
+else
+moItems.reset();
 }
 return *this;
 }
@@ -62,7 +65,7 @@ void ScStyleSaveData::InitFromStyle( const SfxStyleSheetBase* 
pSource )
 {
 aName   = pSource->GetName();
 aParent = pSource->GetParent();
-xItems.reset(new 
SfxItemSet(const_cast(pSource)->GetItemSet()));
+moItems.emplace(const_cast(pSource)->GetItemSet());
 }
 else
 *this = ScStyleSaveData();  // empty
@@ -157,7 +160,7 @@ void ScUndoModifyStyle::DoChange( ScDocShell* pDocSh, const 
OUString& rName,
 pStyle->SetParent( aNewParent );
 
 SfxItemSet& rStyleSet = pStyle->GetItemSet();
-const SfxItemSet* pNewSet = rData.GetItems();
+const std::optional& pNewSet = rData.GetItems();
 OSL_ENSURE( pNewSet, "no ItemSet for style" );
 if (pNewSet)
 rStyleSet.Set( *pNewSet, false );
commit e69ca434253d3278975078600f8a77291d97b9fc
Author: Noel Grandin 
AuthorDate: Fri Sep 24 11:54:23 2021 +0200
Commit: Noel Grandin 
CommitDate: Fri Sep 24 16:24:21 2021 +0200

no need to allocate this SfxItemSet on the heap

Change-Id: I4982d075f21f74b3d0db1c61a499dceb92e50c87
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122575
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/inc/cellsuno.hxx b/sc/inc/cellsuno.hxx
index 7f1b1a0106ad..3d2080a29224 100644
--- a/sc/inc/cellsuno.hxx
+++ b/sc/inc/cellsuno.hxx
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -89,6 +90,7 @@
 #include 
 
 #include 
+#include 
 #include 
 
 namespace com::sun::star::table { struct BorderLine2; }
@@ -112,7 +114,6 @@ class SfxBroadcaster;
 class SfxHint;
 class SfxItemPropertyMap;
 class SfxItemPropertySet;
-class SfxItemSet;
 struct SfxItemPropertyMapEntry;
 
 namespace editeng { class SvxBorderLine; }
@@ -181,8 +182,8 @@ private:
 std::unique_ptr pValueListener;
 std::unique_ptr  pCurrentFlat;
 std::unique_ptr  pCurrentDeep;
-std::unique_ptr pCurrentDataSet;
-std::unique_ptr pNoDfltCurrentDataSet;
+std::optional   moCurrentDataSet;
+std::optional   moNoDfltCurrentDataSet;
 std::unique_ptr pMarkData;
 ScRangeList aRanges;
 sal_Int64   nObjectId;
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 0d9e076269bc..bab189c43d15 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2021-09-24 Thread Noel Grandin (via logerrit)
 sc/inc/postit.hxx   |5 +++--
 sc/source/core/data/postit.cxx  |   13 ++---
 sc/source/filter/excel/xiescher.cxx |2 +-
 sc/source/filter/html/htmlpars.cxx  |   18 +-
 sc/source/filter/inc/htmlpars.hxx   |6 +++---
 sc/source/filter/xml/xmlcelli.cxx   |   10 +-
 6 files changed, 27 insertions(+), 27 deletions(-)

New commits:
commit e1600348e49e1538459a0374fd97cd3173d4a4b9
Author: Noel Grandin 
AuthorDate: Fri Sep 24 08:26:46 2021 +0200
Commit: Noel Grandin 
CommitDate: Fri Sep 24 10:50:56 2021 +0200

no need to allocate this SfxItemSet on the heap

Change-Id: If398e3725b691491e51e49eadeb37a7fdaad63db
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122554
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/inc/postit.hxx b/sc/inc/postit.hxx
index 7fb61bb6ddd6..ff024e4621ea 100644
--- a/sc/inc/postit.hxx
+++ b/sc/inc/postit.hxx
@@ -20,17 +20,18 @@
 #pragma once
 
 #include 
+#include 
 #include "address.hxx"
 #include "scdllapi.h"
 
 #include 
+#include 
 
 class EditTextObject;
 class OutlinerParaObject;
 class SdrCaptionObj;
 class SdrPage;
 
-class SfxItemSet;
 class ScDocument;
 namespace tools { class Rectangle; }
 struct ScCaptionInitData;
@@ -331,7 +332,7 @@ public:
  */
 static ScPostIt*CreateNoteFromObjectData(
 ScDocument& rDoc, const ScAddress& rPos,
-std::unique_ptr pItemSet,
+SfxItemSet&& oItemSet,
 const OutlinerParaObject& rOutlinerObj,
 const tools::Rectangle& rCaptionRect, bool bShown 
);
 
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index 42649cccf66f..12b5778aead2 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -820,9 +820,9 @@ void ScCaptionPtr::clear()
 
 struct ScCaptionInitData
 {
-std::unique_ptr< SfxItemSet >   mxItemSet;  /// Caption object 
formatting.
-std::optional< OutlinerParaObject >  mxOutlinerObj;  /// Text object 
with all text portion formatting.
-OUString maSimpleText;   /// Simple text without formatting.
+std::optional< SfxItemSet > moItemSet;  /// Caption object formatting.
+std::optional< OutlinerParaObject > mxOutlinerObj; /// Text object with 
all text portion formatting.
+OUStringmaSimpleText;   /// Simple text without formatting.
 Point   maCaptionOffset;/// Caption position relative to 
cell corner.
 SizemaCaptionSize;  /// Size of the caption object.
 boolmbDefaultPosSize;   /// True = use default position 
and size for caption.
@@ -1058,7 +1058,7 @@ void ScPostIt::CreateCaptionFromInitData( const 
ScAddress& rPos ) const
 maNoteData.mxCaption->SetText( xInitData->maSimpleText );
 
 // copy all items or set default items; reset shadow items
-ScCaptionUtil::SetDefaultItems( *maNoteData.mxCaption, mrDoc, 
xInitData->mxItemSet.get() );
+ScCaptionUtil::SetDefaultItems( *maNoteData.mxCaption, mrDoc, 
xInitData->moItemSet ? &*xInitData->moItemSet : nullptr );
 
 // set position and size of the caption object
 if( xInitData->mbDefaultPosSize )
@@ -1240,15 +1240,14 @@ ScPostIt* ScNoteUtil::CreateNoteFromCaption(
 }
 
 ScPostIt* ScNoteUtil::CreateNoteFromObjectData(
-ScDocument& rDoc, const ScAddress& rPos, std::unique_ptr 
pItemSet,
+ScDocument& rDoc, const ScAddress& rPos, SfxItemSet&& rItemSet,
 const OutlinerParaObject& rOutlinerObj, const tools::Rectangle& 
rCaptionRect,
 bool bShown )
 {
-OSL_ENSURE( pItemSet, "ScNoteUtil::CreateNoteFromObjectData - item set 
expected" );
 ScNoteData aNoteData( bShown );
 aNoteData.mxInitData = std::make_shared();
 ScCaptionInitData& rInitData = *aNoteData.mxInitData;
-rInitData.mxItemSet = std::move(pItemSet);
+rInitData.moItemSet.emplace(std::move(rItemSet));
 rInitData.mxOutlinerObj = rOutlinerObj;
 
 // convert absolute caption position to relative position
diff --git a/sc/source/filter/excel/xiescher.cxx 
b/sc/source/filter/excel/xiescher.cxx
index 9ccd3521c391..6677578801e4 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -1866,7 +1866,7 @@ void XclImpNoteObj::DoPreProcessSdrObj( 
XclImpDffConverter& rDffConv, SdrObject&
 // create cell note with all data from drawing object
 ScNoteUtil::CreateNoteFromObjectData(
 GetDoc(), maScPos,
-rSdrObj.GetMergedItemSet().Clone(), // new object on 
heap expected
+rSdrObj.GetMergedItemSet().CloneAsValue(), // new 
object on heap expected
 *pOutlinerObj,
 rSdrObj.GetLogicRect(),
 ::get_flag( mnNoteFlags, EXC_NOTE_VISIBLE ) );
diff --git a/sc/source/filter/xml/xmlcelli.cxx 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2021-09-17 Thread Noel Grandin (via logerrit)
 sc/inc/global.hxx   |4 ++--
 sc/source/core/data/documen2.cxx|4 ++--
 sc/source/core/data/dpcache.cxx |2 +-
 sc/source/core/data/dptabsrc.cxx|4 ++--
 sc/source/core/data/dputil.cxx  |6 +++---
 sc/source/core/data/global.cxx  |8 
 sc/source/core/data/globalx.cxx |2 +-
 sc/source/core/data/postit.cxx  |2 +-
 sc/source/core/data/table3.cxx  |2 +-
 sc/source/core/tool/compiler.cxx|   10 +-
 sc/source/core/tool/editutil.cxx|6 +++---
 sc/source/core/tool/formulaopt.cxx  |2 +-
 sc/source/core/tool/numformat.cxx   |2 +-
 sc/source/core/tool/optutil.cxx |2 +-
 sc/source/core/tool/userlist.cxx|2 +-
 sc/source/filter/excel/excimp8.cxx  |2 +-
 sc/source/filter/html/htmlexp.cxx   |2 +-
 sc/source/filter/xcl97/xcl97rec.cxx |2 +-
 sc/source/ui/app/inputhdl.cxx   |8 
 sc/source/ui/cctrl/checklistmenu.cxx|4 ++--
 sc/source/ui/cctrl/editfield.cxx|4 ++--
 sc/source/ui/dbgui/scendlg.cxx  |4 ++--
 sc/source/ui/docshell/docsh3.cxx|4 ++--
 sc/source/ui/docshell/docsh6.cxx|4 ++--
 sc/source/ui/miscdlgs/acredlin.cxx  |   10 +-
 sc/source/ui/miscdlgs/conflictsdlg.cxx  |4 ++--
 sc/source/ui/miscdlgs/redcom.cxx|4 ++--
 sc/source/ui/miscdlgs/sharedocdlg.cxx   |8 
 sc/source/ui/miscdlgs/solveroptions.cxx |8 
 sc/source/ui/optdlg/tpformula.cxx   |2 +-
 sc/source/ui/vba/vbarange.cxx   |4 ++--
 sc/source/ui/view/cellsh2.cxx   |4 ++--
 sc/source/ui/view/colrowba.cxx  |2 +-
 sc/source/ui/view/gridwin5.cxx  |4 ++--
 sc/source/ui/view/output2.cxx   |4 ++--
 35 files changed, 73 insertions(+), 73 deletions(-)

New commits:
commit c67b9a4ce5ac3a09437730d8440c84159b581622
Author: Noel Grandin 
AuthorDate: Fri Sep 17 09:43:00 2021 +0200
Commit: Noel Grandin 
CommitDate: Fri Sep 17 14:46:39 2021 +0200

rather return ref from GetCalendar

since we never return a nullptr

Change-Id: I4cb4af99752818e323472a372330d1bc2a3df4f7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122236
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index a8c885f48155..6a3eab0d837d 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -538,7 +538,7 @@ public:
 SC_DLLPUBLIC static const LocaleDataWrapper& getLocaleData();
 SC_DLLPUBLIC static const CharClass& getCharClass();
 
-static CalendarWrapper* GetCalendar();
+static CalendarWrapper& GetCalendar();
 SC_DLLPUBLIC static CollatorWrapper*GetCollator();
 static CollatorWrapper* GetCaseCollator();
 static css::lang::Locale*   GetLocale();
diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx
index 1950c8500d39..24ef497b3424 100644
--- a/sc/source/core/data/dptabsrc.cxx
+++ b/sc/source/core/data/dptabsrc.cxx
@@ -2388,14 +2388,14 @@ ScDPMember* ScDPMembers::getByIndex(sal_Int32 nIndex) 
const
 else if ( nHier == SC_DAPI_HIERARCHY_WEEK && nLev == 
SC_DAPI_LEVEL_WEEKDAY )
 {
 nVal = nIndex;  // DayOfWeek is 0-based
-aName = ScGlobal::GetCalendar()->getDisplayName(
+aName = ScGlobal::GetCalendar().getDisplayName(
 css::i18n::CalendarDisplayIndex::DAY,
 sal::static_int_cast(nVal), 0 );
 }
 else if ( nHier == SC_DAPI_HIERARCHY_QUARTER && nLev == 
SC_DAPI_LEVEL_MONTH )
 {
 nVal = nIndex;  // Month is 0-based
-aName = ScGlobal::GetCalendar()->getDisplayName(
+aName = ScGlobal::GetCalendar().getDisplayName(
 css::i18n::CalendarDisplayIndex::MONTH,
 sal::static_int_cast(nVal), 0 );
 }
diff --git a/sc/source/core/data/dputil.cxx b/sc/source/core/data/dputil.cxx
index 23f18b906485..b589d4e80156 100644
--- a/sc/source/core/data/dputil.cxx
+++ b/sc/source/core/data/dputil.cxx
@@ -116,7 +116,7 @@ OUString ScDPUtil::getDateGroupName(
 case sheet::DataPilotFieldGroupBy::QUARTERS:
 return 
ScGlobal::getLocaleData().getQuarterAbbreviation(sal_Int16(nValue-1));// 
nValue is 1-based
 case css::sheet::DataPilotFieldGroupBy::MONTHS:
-return ScGlobal::GetCalendar()->getDisplayName(
+return ScGlobal::GetCalendar().getDisplayName(
 i18n::CalendarDisplayIndex::MONTH, 
sal_Int16(nValue-1), 0);// 0-based, get short name
 case sheet::DataPilotFieldGroupBy::DAYS:
 {
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2021-09-10 Thread Luboš Luňák (via logerrit)
 sc/inc/global.hxx  |1 +
 sc/source/core/data/global.cxx |6 --
 sc/source/core/data/table3.cxx |4 ++--
 3 files changed, 7 insertions(+), 4 deletions(-)

New commits:
commit b4c1bb2f91e9ae47820c289e2c08f640a958cf05
Author: Luboš Luňák 
AuthorDate: Thu Sep 9 16:34:08 2021 +0200
Commit: Luboš Luňák 
CommitDate: Fri Sep 10 10:49:58 2021 +0200

cache FormulaError::NoRef error string (tdf#144249)

Those COUNTIF() may call it a huge number of times, and the translation
of the string each time then actually is a noticeable impact. And
ScGlobal already does one-time intialization of objects based
on the locale, so one-time initializing a string there should be fine
too.

Change-Id: I0daeb50ccb43f780d99cf3838cfd1bf790c5f6cc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121856
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 

diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index 50041b37b323..d66801a9e205 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -509,6 +509,7 @@ class ScGlobal
 static std::unique_ptr xUserList;
 static SC_DLLPUBLIC const OUString aEmptyOUString;
 static OUString aStrClipDocName;
+static OUString aStrErrorStringNoRef;
 static std::unique_ptr xEmptyBrushItem;
 static std::unique_ptr xButtonBrushItem;
 
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index 3286794b2b88..f1e1ccf6e3f3 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -89,6 +89,7 @@ std::atomic<::utl::TransliterationWrapper*> 
ScGlobal::pCaseTransliteration(nullp
 css::uno::Reference< css::i18n::XOrdinalSuffix> ScGlobal::xOrdinalSuffix;
 const OUString  ScGlobal::aEmptyOUString;
 OUStringScGlobal::aStrClipDocName;
+OUStringScGlobal::aStrErrorStringNoRef;
 
 std::unique_ptr ScGlobal::xEmptyBrushItem;
 std::unique_ptr ScGlobal::xButtonBrushItem;
@@ -305,8 +306,8 @@ OUString ScGlobal::GetErrorString(FormulaError nErr)
 switch (nErr)
 {
 case FormulaError::NoRef:
-pErrNumber = STR_NO_REF_TABLE;
-break;
+// tdf#144249 This may get called very extensively, so cached.
+return aStrErrorStringNoRef;
 case FormulaError::NoAddin:
 pErrNumber = STR_NO_ADDIN;
 break;
@@ -452,6 +453,7 @@ void ScGlobal::Init()
 InitAddIns();
 
 aStrClipDocName = ScResId( SCSTR_NONAME ) + "1";
+aStrErrorStringNoRef = ScResId( STR_NO_REF_TABLE );
 
 //  ScDocumentPool::InitVersionMaps() has been called earlier already
 }
commit d0316985db22efd6708dffa173eaabb430f6b9a8
Author: Luboš Luňák 
AuthorDate: Thu Sep 9 16:18:02 2021 +0200
Commit: Luboš Luňák 
CommitDate: Fri Sep 10 10:49:44 2021 +0200

do not intern a temporary cell error string

Interning is way more work than a simple text comparison done once.

Change-Id: If18c478fc62d1fb09ce2141fdb77b46a6bc46c08
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121855
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 

diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 97d761f2479b..406284e17765 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -2435,8 +2435,8 @@ public:
 if (rCell.meType == CELLTYPE_FORMULA && 
rCell.mpFormula->GetErrCode() != FormulaError::NONE)
 {
 // Error cell is evaluated as string (for now).
-const svl::SharedString aCellStr = 
mrStrPool.intern(ScGlobal::GetErrorString(rCell.mpFormula->GetErrCode()));
-return compareByStringComparator(rEntry, rItem, , 
nullptr);
+const OUString aCellStr = 
ScGlobal::GetErrorString(rCell.mpFormula->GetErrCode());
+return compareByStringComparator(rEntry, rItem, nullptr, 
);
 }
 else if (rCell.meType == CELLTYPE_STRING)
 {


[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2021-09-04 Thread Noel Grandin (via logerrit)
 sc/inc/formulacell.hxx  |   20 --
 sc/source/core/data/formulacell.cxx |   68 +---
 sc/source/filter/excel/frmbase.cxx  |   10 ++---
 sc/source/filter/inc/formel.hxx |2 -
 4 files changed, 47 insertions(+), 53 deletions(-)

New commits:
commit b68e82b17998ff7ce7e5b08419ecad6b54153566
Author: Noel Grandin 
AuthorDate: Sat Sep 4 16:57:04 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Sep 4 22:00:17 2021 +0200

no need to allocate RangeListType with unique_ptr

Change-Id: I18681749501bb6750912c79b9ff04f5ffc4f0364
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121644
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/source/filter/excel/frmbase.cxx 
b/sc/source/filter/excel/frmbase.cxx
index 35bba553997e..d7144c5edea2 100644
--- a/sc/source/filter/excel/frmbase.cxx
+++ b/sc/source/filter/excel/frmbase.cxx
@@ -55,7 +55,7 @@ void ScRangeListTabs::Append( const ScAddress& aSRD, SCTAB 
nTab )
 {
 // No entry for this table yet.  Insert a new one.
 std::pair r =
-m_TabRanges.insert(std::make_pair(nTab, 
std::make_unique()));
+m_TabRanges.insert(std::make_pair(nTab, RangeListType()));
 
 if (!r.second)
 // Insertion failed.
@@ -63,7 +63,7 @@ void ScRangeListTabs::Append( const ScAddress& aSRD, SCTAB 
nTab )
 
 itr = r.first;
 }
-itr->second->push_back(ScRange(a.Col(),a.Row(),a.Tab()));
+itr->second.push_back(ScRange(a.Col(),a.Row(),a.Tab()));
 }
 
 void ScRangeListTabs::Append( const ScRange& aCRD, SCTAB nTab )
@@ -113,7 +113,7 @@ void ScRangeListTabs::Append( const ScRange& aCRD, SCTAB 
nTab )
 {
 // No entry for this table yet.  Insert a new one.
 std::pair r =
-m_TabRanges.insert(std::make_pair(nTab, 
std::make_unique()));
+m_TabRanges.insert(std::make_pair(nTab, RangeListType()));
 
 if (!r.second)
 // Insertion failed.
@@ -121,7 +121,7 @@ void ScRangeListTabs::Append( const ScRange& aCRD, SCTAB 
nTab )
 
 itr = r.first;
 }
-itr->second->push_back(a);
+itr->second.push_back(a);
 }
 
 const ScRange* ScRangeListTabs::First( SCTAB n )
@@ -133,7 +133,7 @@ const ScRange* ScRangeListTabs::First( SCTAB n )
 // No range list exists for this table.
 return nullptr;
 
-const RangeListType& rList = *itr->second;
+const RangeListType& rList = itr->second;
 maItrCur = rList.begin();
 maItrCurEnd = rList.end();
 return rList.empty() ? nullptr : &(*maItrCur);
diff --git a/sc/source/filter/inc/formel.hxx b/sc/source/filter/inc/formel.hxx
index 9af9158c9cfe..d9dcec6ec15b 100644
--- a/sc/source/filter/inc/formel.hxx
+++ b/sc/source/filter/inc/formel.hxx
@@ -54,7 +54,7 @@ enum FORMULA_TYPE
 class ScRangeListTabs
 {
 typedef ::std::vector RangeListType;
-typedef ::std::map> TabRangeType;
+typedef ::std::map TabRangeType;
 TabRangeType m_TabRanges;
 RangeListType::const_iterator maItrCur;
 RangeListType::const_iterator maItrCurEnd;
commit 9484b56401b6f544eabb3ab9f91d9fecf95242e1
Author: Noel Grandin 
AuthorDate: Sat Sep 4 15:11:13 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Sep 4 22:00:01 2021 +0200

flatten ScFormulaCellGroup

Change-Id: Ie33a6de78bd120f143da35ffc26af94178c734c3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121643
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
index 19983961825d..b685bbbf7b35 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -19,6 +19,7 @@
 
 #pragma once
 
+#include 
 #include 
 
 #include 
@@ -51,12 +52,23 @@ class ScProgress;
 class ScTokenArray;
 enum class SvNumFormatType : sal_Int16;
 
-struct SC_DLLPUBLIC ScFormulaCellGroup
+struct AreaListenerKey
 {
-private:
-struct Impl;
-std::unique_ptr mpImpl;
+ScRange maRange;
+bool mbStartFixed;
+bool mbEndFixed;
+
+AreaListenerKey( const ScRange& rRange, bool bStartFixed, bool bEndFixed ) 
:
+maRange(rRange), mbStartFixed(bStartFixed), mbEndFixed(bEndFixed) {}
+
+bool operator < ( const AreaListenerKey& r ) const;
+};
+
+typedef std::map> AreaListenersType;
 
+struct SC_DLLPUBLIC ScFormulaCellGroup
+{
+AreaListenersType m_AreaListeners;
 public:
 
 mutable size_t mnRefCount;
diff --git a/sc/source/core/data/formulacell.cxx 
b/sc/source/core/data/formulacell.cxx
index 7304ca033acd..e60768aadb99 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -478,49 +478,31 @@ void adjustDBRange(formula::FormulaToken* pToken, 
ScDocument& rNewDoc, const ScD
 pToken->SetIndex(pNewDBData->GetIndex());
 }
 
-struct AreaListenerKey
-{
-ScRange maRange;
-bool mbStartFixed;
-bool mbEndFixed;
-
-AreaListenerKey( const ScRange& rRange, bool bStartFixed, bool bEndFixed ) 
:
-maRange(rRange), 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source sw/inc sw/source

2021-07-13 Thread Noel Grandin (via logerrit)
 sc/inc/fielduno.hxx   |   13 -
 sc/source/ui/unoobj/fielduno.cxx  |   23 ++-
 sw/inc/unotxdoc.hxx   |6 ++
 sw/source/uibase/uno/unotxdoc.cxx |7 +--
 4 files changed, 9 insertions(+), 40 deletions(-)

New commits:
commit faf3da0a9676a82fd5dcb9e931480935cb985bc0
Author: Noel Grandin 
AuthorDate: Tue Jul 13 15:49:20 2021 +0200
Commit: Noel Grandin 
CommitDate: Tue Jul 13 18:51:45 2021 +0200

use ImplInheritanceHelper in SwXTextDocument

so we avoid having two copies of OWeakObject in it

Change-Id: Ia592f1d67a730da35c5d73c81c689d9da02fce1a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118853
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index 5e2619819095..79044005530a 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -90,8 +90,9 @@ namespace com::sun::star::uno { class XAggregation; }
 
 namespace com::sun::star::util { class XReplaceDescriptor; }
 
-typedef cppu::WeakImplHelper
+typedef cppu::ImplInheritanceHelper
 <
+SfxBaseModel,
 css::text::XTextDocument,
 css::text::XLineNumberingProperties,
 css::text::XChapterNumberingSupplier,
@@ -131,7 +132,6 @@ SwXTextDocumentBaseClass;
 
 class SW_DLLPUBLIC SwXTextDocument final : public SwXTextDocumentBaseClass,
 public SvxFmMSFactory,
-public SfxBaseModel,
 public vcl::ITiledRenderable,
 public css::tiledrendering::XTiledRenderable
 {
@@ -216,8 +216,6 @@ public:
 virtual void SAL_CALL release(  ) noexcept override;
 
 //XWeak
-virtual css::uno::Reference< css::uno::XAdapter > SAL_CALL queryAdapter(  
) override;
-
 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes(  ) 
override;
 
 static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId();
diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index 890ccdd8fcc3..c8c11e93da39 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -341,11 +341,6 @@ void SAL_CALL SwXTextDocument::release()noexcept
 SfxBaseModel::release();
 }
 
-Reference< XAdapter > SwXTextDocument::queryAdapter(  )
-{
-return SfxBaseModel::queryAdapter();
-}
-
 Sequence< uno::Type > SAL_CALL SwXTextDocument::getTypes()
 {
 Sequence< uno::Type > aNumTypes;
@@ -370,7 +365,7 @@ Sequence< uno::Type > SAL_CALL SwXTextDocument::getTypes()
 }
 
 SwXTextDocument::SwXTextDocument(SwDocShell* pShell)
-: SfxBaseModel(pShell)
+: SwXTextDocumentBaseClass(pShell)
 , m_pImpl(new Impl)
 ,
 m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_DOCUMENT)),
commit eb3fb2ea717f591e75b04ff828415cb9ad452dcd
Author: Noel Grandin 
AuthorDate: Tue Jul 13 15:48:49 2021 +0200
Commit: Noel Grandin 
CommitDate: Tue Jul 13 18:51:35 2021 +0200

use WeakComponentImplHelper for ScEditFieldObj

so we avoid having two copies of OWeakObject in it

Change-Id: I1dd789ced5552d8de4e164cd572c29022f662b74
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118852
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/inc/fielduno.hxx b/sc/inc/fielduno.hxx
index 23759a3c19f3..4394d5931581 100644
--- a/sc/inc/fielduno.hxx
+++ b/sc/inc/fielduno.hxx
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -159,13 +160,12 @@ public:
  * Generic UNO wrapper for edit engine's field item in cells, headers, and
  * footers.
  */
-class ScEditFieldObj final : public cppu::WeakImplHelper<
+typedef cppu::WeakComponentImplHelper<
 css::text::XTextField,
 css::beans::XPropertySet,
 css::lang::XUnoTunnel,
-css::lang::XServiceInfo>,
-public ScMutexHelper,
-public ::cppu::OComponentHelper
+css::lang::XServiceInfo> ScEditFieldObj_Base;
+class ScEditFieldObj final : public ScMutexHelper, public ScEditFieldObj_Base
 {
 ScEditFieldObj() = delete;
 ScEditFieldObj(const ScEditFieldObj&) = delete;
@@ -220,11 +220,6 @@ public:
 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL
 getAnchor() override;
 
-// XComponent
-virtual void SAL_CALL dispose() override;
-virtual void SAL_CALL addEventListener( const css::uno::Reference< 
css::lang::XEventListener >& xListener ) override;
-virtual void SAL_CALL removeEventListener( const css::uno::Reference< 
css::lang::XEventListener >& aListener ) override;
-
 // XPropertySet
 virtual css::uno::Reference< css::beans::XPropertySetInfo >
 SAL_CALL getPropertySetInfo() override;
diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx
index f537eaf94977..29f1d02e0a11 100644
--- 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2020-09-16 Thread Caolán McNamara (via logerrit)
 sc/inc/document.hxx |2 +-
 sc/source/core/data/documen5.cxx|4 ++--
 sc/source/core/data/drwlayer.cxx|2 +-
 sc/source/core/tool/charthelper.cxx |2 +-
 sc/source/ui/view/cliputil.cxx  |8 
 5 files changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 705ee514e228dc6b6fe6f13964ef866cd9df1702
Author: Caolán McNamara 
AuthorDate: Tue Sep 15 09:51:25 2020 +0100
Commit: Caolán McNamara 
CommitDate: Wed Sep 16 09:43:37 2020 +0200

lcl_checkClassification never passed a null ScDocument* destination doc

Change-Id: Ic0010d785e49c96a19e6e04e44fe6bc02cc44375
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102790
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sc/source/ui/view/cliputil.cxx b/sc/source/ui/view/cliputil.cxx
index ff3878e600f2..595e5b2e9d7a 100644
--- a/sc/source/ui/view/cliputil.cxx
+++ b/sc/source/ui/view/cliputil.cxx
@@ -27,13 +27,13 @@ namespace
 {
 
 /// Paste only if SfxClassificationHelper recommends so.
-bool lcl_checkClassification(ScDocument* pSourceDoc, const ScDocument* 
pDestinationDoc)
+bool lcl_checkClassification(ScDocument* pSourceDoc, const ScDocument& 
rDestinationDoc)
 {
-if (!pSourceDoc || !pDestinationDoc)
+if (!pSourceDoc)
 return true;
 
 ScClipOptions* pSourceOptions = pSourceDoc->GetClipOptions();
-SfxObjectShell* pDestinationShell = pDestinationDoc->GetDocumentShell();
+SfxObjectShell* pDestinationShell = rDestinationDoc.GetDocumentShell();
 if (!pSourceOptions || !pDestinationShell)
 return true;
 
@@ -84,7 +84,7 @@ void ScClipUtil::PasteFromClipboard( ScViewData* pViewData, 
ScTabViewShell* pTab
 // For multi-range paste, we paste values by default.
 nFlags &= ~InsertDeleteFlags::FORMULA;
 
-if (lcl_checkClassification(pClipDoc, ))
+if (lcl_checkClassification(pClipDoc, rThisDoc))
 pTabViewShell->PasteFromClip( nFlags, pClipDoc,
 ScPasteFunc::NONE, false, false, false, INS_NONE, 
InsertDeleteFlags::NONE,
 bShowDialog );  // allow warning dialog
commit 4e65a506f29c886195be3ee17e166a9fe1cb7a7a
Author: Caolán McNamara 
AuthorDate: Tue Sep 15 09:50:19 2020 +0100
Commit: Caolán McNamara 
CommitDate: Wed Sep 16 09:43:14 2020 +0200

GetChartRanges never passed a null ScDocument*

Change-Id: I021544d0cdfb68f6e30a4bb229eb0e8b3ea695d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102789
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 370effa1b01b..36bd437c2773 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -840,7 +840,7 @@ public:
 
 css::uno::Reference< css::chart2::XChartDocument > GetChartByName( const 
OUString& rChartName );
 
-SC_DLLPUBLIC void GetChartRanges( const OUString& rChartName, std::vector< 
ScRangeList >& rRanges, const ScDocument* pSheetNameDoc );
+SC_DLLPUBLIC void GetChartRanges( const OUString& rChartName, std::vector< 
ScRangeList >& rRanges, const ScDocument& rSheetNameDoc );
 void  SetChartRanges( const OUString& rChartName, const 
std::vector< ScRangeList >& rRanges );
 
 void  UpdateChartArea( const OUString& rChartName, const 
ScRange& rNewArea,
diff --git a/sc/source/core/data/documen5.cxx b/sc/source/core/data/documen5.cxx
index 2ae03f5f299b..33d0d74703b0 100644
--- a/sc/source/core/data/documen5.cxx
+++ b/sc/source/core/data/documen5.cxx
@@ -164,7 +164,7 @@ uno::Reference< chart2::XChartDocument > 
ScDocument::GetChartByName( const OUStr
 return xReturn;
 }
 
-void ScDocument::GetChartRanges( const OUString& rChartName, ::std::vector< 
ScRangeList >& rRangesVector, const ScDocument* pSheetNameDoc )
+void ScDocument::GetChartRanges( const OUString& rChartName, ::std::vector< 
ScRangeList >& rRangesVector, const ScDocument& rSheetNameDoc )
 {
 rRangesVector.clear();
 uno::Reference< chart2::XChartDocument > xChartDoc( GetChartByName( 
rChartName ) );
@@ -175,7 +175,7 @@ void ScDocument::GetChartRanges( const OUString& 
rChartName, ::std::vector< ScRa
 for(const OUString & aRangeString : aRangeStrings)
 {
 ScRangeList aRanges;
-aRanges.Parse( aRangeString, *pSheetNameDoc, 
pSheetNameDoc->GetAddressConvention() );
+aRanges.Parse( aRangeString, rSheetNameDoc, 
rSheetNameDoc.GetAddressConvention() );
 rRangesVector.push_back(aRanges);
 }
 }
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 4830dcc4f0fb..3a22bc354a18 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -1751,7 +1751,7 @@ void ScDrawLayer::CopyFromClip( ScDrawLayer* pClipModel, 
SCTAB nSourceTab, const
 {
 OUString aChartName = 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2020-09-15 Thread Caolán McNamara (via logerrit)
 sc/inc/address.hxx   |2 +-
 sc/inc/rangeutl.hxx  |2 +-
 sc/source/core/tool/address.cxx  |4 ++--
 sc/source/core/tool/interpr1.cxx |4 ++--
 sc/source/core/tool/rangeutl.cxx |   12 ++--
 sc/source/ui/dbgui/PivotLayoutDialog.cxx |2 +-
 sc/source/ui/dbgui/consdlg.cxx   |4 ++--
 sc/source/ui/miscdlgs/tabopdlg.cxx   |2 +-
 sc/source/ui/optdlg/tpusrlst.cxx |2 +-
 9 files changed, 17 insertions(+), 17 deletions(-)

New commits:
commit c678eba2f06ce7f16939879eedb918f303a4e1b1
Author: Caolán McNamara 
AuthorDate: Mon Sep 14 12:26:27 2020 +0100
Commit: Caolán McNamara 
CommitDate: Tue Sep 15 14:12:36 2020 +0200

ScRangeUtil::IsAbsPos ScDocument* arg dereferenced on all branches

Change-Id: Ie42e6eb280886c237b7042948298eef0bd38eebf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102720
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sc/inc/rangeutl.hxx b/sc/inc/rangeutl.hxx
index 601fdee3803f..e0d0f65c2b88 100644
--- a/sc/inc/rangeutl.hxx
+++ b/sc/inc/rangeutl.hxx
@@ -65,7 +65,7 @@ public:
   ScAddress::Details const & rDetails = 
ScAddress::detailsOOOa1 );
 
 static bool IsAbsPos( const OUString& rPosStr,
-  const ScDocument* pDoc,
+  const ScDocument& rDoc,
   SCTAB nTab,
   OUString*   pCompleteStr,
   ScRefAddress* pPosTripel   = nullptr,
diff --git a/sc/source/core/tool/rangeutl.cxx b/sc/source/core/tool/rangeutl.cxx
index 2e5c09ac2b2f..24f62c9c5de5 100644
--- a/sc/source/core/tool/rangeutl.cxx
+++ b/sc/source/core/tool/rangeutl.cxx
@@ -208,7 +208,7 @@ bool ScRangeUtil::IsAbsArea( const OUString&  rAreaStr,
 }
 
 bool ScRangeUtil::IsAbsPos( const OUString&   rPosStr,
-const ScDocument* pDoc,
+const ScDocument& rDoc,
 SCTAB   nTab,
 OUString*   pCompleteStr,
 ScRefAddress*   pPosTripel,
@@ -216,7 +216,7 @@ bool ScRangeUtil::IsAbsPos( const OUString&   rPosStr,
 {
 ScRefAddressthePos;
 
-bool bIsAbsPos = ConvertSingleRef( pDoc, rPosStr, nTab, thePos, rDetails );
+bool bIsAbsPos = ConvertSingleRef( , rPosStr, nTab, thePos, rDetails 
);
 thePos.SetRelCol( false );
 thePos.SetRelRow( false );
 thePos.SetRelTab( false );
@@ -226,7 +226,7 @@ bool ScRangeUtil::IsAbsPos( const OUString&   rPosStr,
 if ( pPosTripel )
 *pPosTripel = thePos;
 if ( pCompleteStr )
-*pCompleteStr = thePos.GetRefString( pDoc, MAXTAB+1, rDetails );
+*pCompleteStr = thePos.GetRefString( , MAXTAB+1, rDetails );
 }
 
 return bIsAbsPos;
@@ -294,7 +294,7 @@ bool ScRangeUtil::MakeRangeFromName (
 {
 CutPosString( aStrArea, aStrArea );
 
-if ( IsAbsPos( aStrArea, , nTable,
+if ( IsAbsPos( aStrArea, rDoc, nTable,
   nullptr, , rDetails ) )
 {
 nTab   = aStartPos.Tab();
diff --git a/sc/source/ui/dbgui/consdlg.cxx b/sc/source/ui/dbgui/consdlg.cxx
index 18a571a3077d..db9f53681a18 100644
--- a/sc/source/ui/dbgui/consdlg.cxx
+++ b/sc/source/ui/dbgui/consdlg.cxx
@@ -303,7 +303,7 @@ bool ScConsolidateDlg::VerifyEdit( formula::RefEdit* pEd )
 OUString aPosStr;
 
 ScRangeUtil::CutPosString( pEd->GetText(), aPosStr );
-bEditOk = ScRangeUtil::IsAbsPos( aPosStr, pDoc,
+bEditOk = ScRangeUtil::IsAbsPos( aPosStr, *pDoc,
 nTab, , nullptr, eConv 
);
 }
 
@@ -339,7 +339,7 @@ IMPL_LINK_NOARG(ScConsolidateDlg, OkHdl, weld::Button&, 
void)
 OUStringaDestPosStr( m_xEdDestArea->GetText() );
 const formula::FormulaGrammar::AddressConvention eConv = 
pDoc->GetAddressConvention();
 
-if ( ScRangeUtil::IsAbsPos( aDestPosStr, pDoc, nTab, nullptr, 
, eConv ) )
+if ( ScRangeUtil::IsAbsPos( aDestPosStr, *pDoc, nTab, nullptr, 
, eConv ) )
 {
 ScConsolidateParam  theOutParam( theConsData );
 std::unique_ptr pDataAreas(new ScArea[nDataAreaCount]);
diff --git a/sc/source/ui/optdlg/tpusrlst.cxx b/sc/source/ui/optdlg/tpusrlst.cxx
index 9dbb50e52bdb..e0e4ed90e3c2 100644
--- a/sc/source/ui/optdlg/tpusrlst.cxx
+++ b/sc/source/ui/optdlg/tpusrlst.cxx
@@ -654,7 +654,7 @@ IMPL_LINK( ScTpUserLists, BtnClickHdl, weld::Button&, rBtn, 
void )
 if ( !bAreaOk )
 {
 bAreaOk = ScRangeUtil::IsAbsPos(  theAreaStr,
- pDoc,
+ *pDoc,
   

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2020-09-15 Thread Caolán McNamara (via logerrit)
 sc/inc/address.hxx   |2 +-
 sc/inc/rangeutl.hxx  |2 +-
 sc/source/core/data/documen5.cxx |2 +-
 sc/source/core/tool/address.cxx  |6 +++---
 sc/source/core/tool/rangelst.cxx |2 +-
 sc/source/core/tool/rangeutl.cxx |4 ++--
 sc/source/filter/excel/xicontent.cxx |2 +-
 sc/source/filter/excel/xilink.cxx|2 +-
 sc/source/filter/oox/worksheetbuffer.cxx |2 +-
 sc/source/filter/oox/worksheethelper.cxx |2 +-
 sc/source/ui/app/inputhdl.cxx|2 +-
 sc/source/ui/app/inputwin.cxx|2 +-
 sc/source/ui/dbgui/consdlg.cxx   |2 +-
 sc/source/ui/dbgui/dbnamdlg.cxx  |4 ++--
 sc/source/ui/docshell/arealink.cxx   |2 +-
 sc/source/ui/docshell/docsh4.cxx |2 +-
 sc/source/ui/miscdlgs/anyrefdg.cxx   |2 +-
 sc/source/ui/miscdlgs/crnrdlg.cxx|8 
 sc/source/ui/miscdlgs/optsolver.cxx  |2 +-
 sc/source/ui/pagedlg/areasdlg.cxx|2 +-
 sc/source/ui/unoobj/addruno.cxx  |2 +-
 sc/source/ui/unoobj/cellsuno.cxx |4 ++--
 sc/source/ui/view/viewfun2.cxx   |6 +++---
 23 files changed, 33 insertions(+), 33 deletions(-)

New commits:
commit 1f7bbd1fcd81e23ed3c8965664863bc7bb7c107c
Author: Caolán McNamara 
AuthorDate: Mon Sep 14 12:18:12 2020 +0100
Commit: Caolán McNamara 
CommitDate: Tue Sep 15 11:13:30 2020 +0200

ScRangeUtil::MakeArea ScDocument* arg dereferenced on all branches

Change-Id: I91f36130322110facc8cf9d530da8af15f894650
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102705
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sc/inc/rangeutl.hxx b/sc/inc/rangeutl.hxx
index a65939e81e03..62fb8fe0a4b3 100644
--- a/sc/inc/rangeutl.hxx
+++ b/sc/inc/rangeutl.hxx
@@ -42,7 +42,7 @@ public:
 
 static bool MakeArea( const OUString&   rAreaStr,
   ScArea&   rArea,
-  const ScDocument* pDoc,
+  const ScDocument& rDoc,
   SCTAB nTab,
   ScAddress::Details const & rDetails );
 
diff --git a/sc/source/core/tool/rangeutl.cxx b/sc/source/core/tool/rangeutl.cxx
index 340b76eeada1..47a6008de5d8 100644
--- a/sc/source/core/tool/rangeutl.cxx
+++ b/sc/source/core/tool/rangeutl.cxx
@@ -35,7 +35,7 @@ using namespace ::com::sun::star;
 
 bool ScRangeUtil::MakeArea( const OUString&   rAreaStr,
 ScArea& rArea,
-const ScDocument* pDoc,
+const ScDocument& rDoc,
 SCTAB   nTab,
 ScAddress::Details const & rDetails )
 {
@@ -56,7 +56,7 @@ bool ScRangeUtil::MakeArea( const OUString&   rAreaStr,
 aStrArea += ":" + rAreaStr.copy( nPointPos+1 ); // do not include '.' 
in copy
 }
 
-bSuccess = ConvertDoubleRef( pDoc, aStrArea, nTab, startPos, endPos, 
rDetails );
+bSuccess = ConvertDoubleRef( , aStrArea, nTab, startPos, endPos, 
rDetails );
 
 if ( bSuccess )
 rArea = ScArea( startPos.Tab(),
diff --git a/sc/source/ui/dbgui/consdlg.cxx b/sc/source/ui/dbgui/consdlg.cxx
index 7f6252fe248a..82b117ddf187 100644
--- a/sc/source/ui/dbgui/consdlg.cxx
+++ b/sc/source/ui/dbgui/consdlg.cxx
@@ -347,7 +347,7 @@ IMPL_LINK_NOARG(ScConsolidateDlg, OkHdl, weld::Button&, 
void)
 for ( sal_Int32 i=0; iget_text(i),
-  pDataAreas[i], pDoc, nTab, eConv);
+  pDataAreas[i], *pDoc, nTab, eConv);
 }
 
 theOutParam.nCol= aDestAddress.Col();
commit 129ae164844c2d635fe7f152ad0c47c02e08b9d4
Author: Caolán McNamara 
AuthorDate: Mon Sep 14 11:29:43 2020 +0100
Commit: Caolán McNamara 
CommitDate: Tue Sep 15 11:13:11 2020 +0200

ScRangeList::ParseAny ScDocument* argument dereferenced on all used paths

Change-Id: Ie41a1b58f8bec0e8197aa49aa92522f11de40a28
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102667
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx
index a56572c65f8f..8a4d9b6afc98 100644
--- a/sc/inc/address.hxx
+++ b/sc/inc/address.hxx
@@ -557,7 +557,7 @@ public:
const 
css::uno::Sequence* pExternalLinks = nullptr,
const OUString* pErrRef = nullptr );
 
-SC_DLLPUBLIC ScRefFlags ParseAny( const OUString&, const ScDocument*,
+SC_DLLPUBLIC ScRefFlags ParseAny( const OUString&, const ScDocument&,
   const ScAddress::Details& rDetails = 
ScAddress::detailsOOOa1 );
 SC_DLLPUBLIC ScRefFlags ParseCols( const ScDocument& rDoc,
const OUString&,
diff --git 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2020-08-12 Thread Noel Grandin (via logerrit)
 sc/inc/global.hxx  |3 +--
 sc/source/core/data/global.cxx |   14 +++---
 2 files changed, 8 insertions(+), 9 deletions(-)

New commits:
commit b4c6ad893011eb2b78892b81cfcc496eda0290ed
Author: Noel Grandin 
AuthorDate: Tue Aug 11 17:22:21 2020 +0200
Commit: Noel Grandin 
CommitDate: Wed Aug 12 08:58:58 2020 +0200

use unique_ptr for ScGlobal::pEnglishFormatter

Change-Id: Ic570f78fadaa42efc3a61a414dbdec4dd52d3aed
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100561
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index b5231e773804..95ec2efda5c6 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -518,7 +518,7 @@ class ScGlobal
 
 static std::atomic pUnitConverter;
 
-static  SvNumberFormatter*  pEnglishFormatter;  // for UNO / XML 
export
+static std::unique_ptr xEnglishFormatter;  // 
for UNO / XML export
 
 static css::uno::Reference< css::i18n::XOrdinalSuffix> xOrdinalSuffix;
 static std::unique_ptr  xCalendar;
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index 3d0ce48eb4c4..ae9606b9c665 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -97,7 +97,7 @@ std::unique_ptr 
ScGlobal::xStarCalcFunctionList;
 std::unique_ptr ScGlobal::xStarCalcFunctionMgr;
 
 std::atomic ScGlobal::pUnitConverter(nullptr);
-SvNumberFormatter* ScGlobal::pEnglishFormatter = nullptr;
+std::unique_ptr ScGlobal::xEnglishFormatter;
 ScFieldEditEngine* ScGlobal::pFieldEditEngine = nullptr;
 
 double  ScGlobal::nScreenPPTX   = 96.0;
@@ -167,13 +167,13 @@ sal_uInt16 ScGlobal::GetStandardRowHeight()
 SvNumberFormatter* ScGlobal::GetEnglishFormatter()
 {
 assert(!bThreadedGroupCalcInProgress);
-if ( !pEnglishFormatter )
+if ( !xEnglishFormatter )
 {
-pEnglishFormatter = new SvNumberFormatter(
-::comphelper::getProcessComponentContext(), LANGUAGE_ENGLISH_US );
-pEnglishFormatter->SetEvalDateFormat( NF_EVALDATEFORMAT_INTL_FORMAT );
+xEnglishFormatter.reset( new SvNumberFormatter(
+::comphelper::getProcessComponentContext(), LANGUAGE_ENGLISH_US ) 
);
+xEnglishFormatter->SetEvalDateFormat( NF_EVALDATEFORMAT_INTL_FORMAT );
 }
-return pEnglishFormatter;
+return xEnglishFormatter.get();
 }
 
 bool ScGlobal::CheckWidthInvalidate( bool& bNumFormatChanged,
@@ -540,7 +540,7 @@ void ScGlobal::Clear()
 xEmptyBrushItem.reset();
 xButtonBrushItem.reset();
 xEmbeddedBrushItem.reset();
-DELETEZ(pEnglishFormatter);
+xEnglishFormatter.reset();
 delete pCaseTransliteration.load(); pCaseTransliteration = nullptr;
 delete pTransliteration.load(); pTransliteration = nullptr;
 delete pCaseCollator.load(); pCaseCollator = nullptr;
commit 2ad735a9577fd463399e4fd1b0f31549aed7243f
Author: Noel Grandin 
AuthorDate: Tue Aug 11 17:18:47 2020 +0200
Commit: Noel Grandin 
CommitDate: Wed Aug 12 08:58:36 2020 +0200

remove unused pScIntlWrapper field from ScGlobal

Change-Id: I687f4d5bb485724ca93cd7402c7c05743705d633
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100560
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index 9250a27c3608..b5231e773804 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -526,7 +526,6 @@ class ScGlobal
 static std::atomic pCollator;
 static std::atomic<::utl::TransliterationWrapper*> pTransliteration;
 static std::atomic<::utl::TransliterationWrapper*> pCaseTransliteration;
-static IntlWrapper* pScIntlWrapper;
 static std::atomic   pLocale;
 
 static ScFieldEditEngine*   pFieldEditEngine;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source sfx2/source

2020-08-04 Thread Szymon Kłos (via logerrit)
 sc/inc/document.hxx|   11 +++
 sc/source/core/data/documen2.cxx   |9 ++---
 sc/source/core/data/document.cxx   |   19 +--
 sfx2/source/notebookbar/SfxNotebookBar.cxx |   11 +++
 4 files changed, 25 insertions(+), 25 deletions(-)

New commits:
commit adb901ca11afa5a153ecd433375b9ab1dfc2fd03
Author: Szymon Kłos 
AuthorDate: Mon Aug 3 09:40:31 2020 +0200
Commit: Szymon Kłos 
CommitDate: Tue Aug 4 14:58:34 2020 +0200

notebookbar: control early init per view

Change-Id: I9b743bc6d62256289549cd8002b76bcb918222b0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99986
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Szymon Kłos 
(cherry picked from commit fddfeb653dfd5dd73cbccb4433678d397f092df9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99921
Tested-by: Jenkins

diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx 
b/sfx2/source/notebookbar/SfxNotebookBar.cxx
index dd79e65fa3ec..16a0608f7b30 100644
--- a/sfx2/source/notebookbar/SfxNotebookBar.cxx
+++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 using namespace sfx2;
@@ -366,13 +367,16 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow,
 if ((!sFile.isEmpty() && bChangedFile) || !pNotebookBar || 
!pNotebookBar->IsVisible()
 || bReloadNotebookbar || comphelper::LibreOfficeKit::isActive())
 {
+const SfxViewShell* pViewShell = SfxViewShell::Current();
+
 // Notebookbar was loaded too early what caused:
 //   * in LOK: Paste Special feature was incorrectly initialized
 // Skip first request so Notebookbar will be initialized after 
document was loaded
-static bool bSkipFirstInit = true;
-if (comphelper::LibreOfficeKit::isActive() && bSkipFirstInit)
+static std::map bSkippedFirstInit;
+if (comphelper::LibreOfficeKit::isActive()
+&& bSkippedFirstInit.find(pViewShell) == 
bSkippedFirstInit.end())
 {
-bSkipFirstInit = false;
+bSkippedFirstInit[pViewShell] = true;
 return false;
 }
 
@@ -393,7 +397,6 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow,
 pNotebookBar = pSysWindow->GetNotebookBar();
 pNotebookBar->Show();
 
-const SfxViewShell* pViewShell = SfxViewShell::Current();
 
 bool hasWeldedWrapper = 
m_pNotebookBarWeldedWrapper.find(pViewShell) != 
m_pNotebookBarWeldedWrapper.end();
 if ((!hasWeldedWrapper || bReloadNotebookbar) && 
pNotebookBar->IsWelded())
commit 7959953e990b9fc10dbffd5a92553037d2b419c2
Author: Noel Grandin 
AuthorDate: Tue Aug 4 11:23:16 2020 +0200
Commit: Noel Grandin 
CommitDate: Tue Aug 4 14:58:14 2020 +0200

fix leak in CppunitTest_sc_ucalc

Change-Id: Iee5f4bfcd8ad90d37e787d225928a5ae7b269f2d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100048
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index f2ceca43fcbf..69e0b06a6cab 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -296,14 +296,11 @@ const sal_uInt8 SC_DDE_IGNOREMODE= 255;   /// For 
usage in FindDdeLink()
 // During threaded calculation fields being mutated are kept in this struct
 struct ScDocumentThreadSpecific
 {
-ScRecursionHelper*  pRecursionHelper;   // information for 
recursive and iterative cell formulas
+std::unique_ptr xRecursionHelper; // information for 
recursive and iterative cell formulas
 ScInterpreterContext* pContext;  // references the context passed around 
for easier access
 
-ScDocumentThreadSpecific()
-: pRecursionHelper(nullptr)
-, pContext(nullptr)
-{
-}
+ScDocumentThreadSpecific();
+~ScDocumentThreadSpecific();
 
 // To be called in the thread at start
 static void SetupFromNonThreadedData(const ScDocumentThreadSpecific& 
rNonThreadedData);
@@ -2225,8 +,6 @@ private:
 
 DECL_LINK(TrackTimeHdl, Timer *, void);
 
-static ScRecursionHelper*   CreateRecursionHelperInstance();
-
 /** Adjust a range to available sheets.
 
 Used to start and stop listening on a sane range. Both o_rRange and
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 9b966c8d5cf5..e4413853aa71 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -387,8 +387,8 @@ ScDocument::~ScDocument()
 mxPoolHelper.clear();
 
 pScriptTypeData.reset();
-delete maNonThreaded.pRecursionHelper;
-delete maThreadSpecific.pRecursionHelper;
+maNonThreaded.xRecursionHelper.reset();
+maThreadSpecific.xRecursionHelper.reset();
 
 pPreviewFont.reset();
 SAL_WARN_IF( pAutoNameCache, "sc.core", "AutoNameCache 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source vcl/source

2019-12-03 Thread Caolán McNamara (via logerrit)
 sc/inc/markdata.hxx   |1 +
 sc/inc/markmulti.hxx  |7 ---
 sc/source/core/data/markmulti.cxx |   15 ---
 vcl/source/window/builder.cxx |   10 ++
 4 files changed, 11 insertions(+), 22 deletions(-)

New commits:
commit 41b8d8eb67a6f19ae1e19e74d055ba4c7869af8d
Author: Caolán McNamara 
AuthorDate: Mon Dec 2 17:08:58 2019 +
Commit: Caolán McNamara 
CommitDate: Tue Dec 3 22:14:56 2019 +0100

cid#1456145 Missing move assignment operator

Change-Id: I55ed7d87def93a8f5cf4f90fed1e1e5bcbee
Reviewed-on: https://gerrit.libreoffice.org/84256
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/inc/markdata.hxx b/sc/inc/markdata.hxx
index 10403066e5e8..485dcfbf9b12 100644
--- a/sc/inc/markdata.hxx
+++ b/sc/inc/markdata.hxx
@@ -68,6 +68,7 @@ public:
 ScMarkData(const ScMarkData& rData) = default;
 ScMarkData(ScMarkData&& rData) = default;
 ScMarkData& operator=(const ScMarkData& rData) = default;
+ScMarkData& operator=(ScMarkData&& rData) = default;
 ~ScMarkData();
 
 voidResetMark();
diff --git a/sc/inc/markmulti.hxx b/sc/inc/markmulti.hxx
index c6ae44701059..ac43e73cbdd5 100644
--- a/sc/inc/markmulti.hxx
+++ b/sc/inc/markmulti.hxx
@@ -40,11 +40,12 @@ friend class ScMultiSelIter;
 
 public:
 ScMultiSel(SCROW nMaxRow);
-ScMultiSel( const ScMultiSel& rMultiSel );
+ScMultiSel(const ScMultiSel& rMultiSel) = default;
+ScMultiSel(ScMultiSel&& rMultiSel) = default;
 ~ScMultiSel();
 
-ScMultiSel& operator=(const ScMultiSel& rMultiSel);
-ScMultiSel& operator=(const ScMultiSel&& rMultiSel) = delete;
+ScMultiSel& operator=(const ScMultiSel& rMultiSel) = default;
+ScMultiSel& operator=(ScMultiSel&& rMultiSel) = default;
 
 SCCOL GetMultiSelectionCount() const;
 bool HasMarks( SCCOL nCol ) const;
diff --git a/sc/source/core/data/markmulti.cxx 
b/sc/source/core/data/markmulti.cxx
index fa9262024339..1c8c38cc3584 100644
--- a/sc/source/core/data/markmulti.cxx
+++ b/sc/source/core/data/markmulti.cxx
@@ -32,25 +32,10 @@ ScMultiSel::ScMultiSel(SCROW nMaxRow)
 {
 }
 
-ScMultiSel::ScMultiSel( const ScMultiSel& rOther )
-: aRowSel(rOther.aRowSel)
-{
-aMultiSelContainer = rOther.aMultiSelContainer;
-mnMaxRow = rOther.mnMaxRow;
-}
-
 ScMultiSel::~ScMultiSel()
 {
 }
 
-ScMultiSel& ScMultiSel::operator=(const ScMultiSel& rOther)
-{
-aRowSel = rOther.aRowSel;
-aMultiSelContainer = rOther.aMultiSelContainer;
-mnMaxRow = rOther.mnMaxRow;
-return *this;
-}
-
 void ScMultiSel::Clear()
 {
 aMultiSelContainer.clear();
commit c10182573e2d29cb43fe763ec4e97e04a7d55d9b
Author: Caolán McNamara 
AuthorDate: Tue Dec 3 15:13:47 2019 +
Commit: Caolán McNamara 
CommitDate: Tue Dec 3 22:14:34 2019 +0100

toolbar item visibilty defaults to false in GtkBuilder but true in vcl

Change-Id: I91152db48fee77b95fa542790839a574b87161db
Reviewed-on: https://gerrit.libreoffice.org/84361
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index e7c4e17d7c65..6f59df71ded5 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -,12 +,14 @@ namespace
 
 bool extractVisible(VclBuilder::stringmap )
 {
+bool bRet = false;
 VclBuilder::stringmap::iterator aFind = rMap.find(OString("visible"));
 if (aFind != rMap.end())
 {
-return toBool(aFind->second);
+bRet = toBool(aFind->second);
+rMap.erase(aFind);
 }
-return false;
+return bRet;
 }
 
 Size extractSizeRequest(VclBuilder::stringmap )
@@ -3643,6 +3645,8 @@ void VclBuilder::insertMenuObject(Menu *pParent, 
PopupMenu *pSubMenu, const OStr
 if (nOldCount != pParent->GetItemCount())
 {
 pParent->SetHelpId(nNewId, m_sHelpRoot + rID);
+if (!extractVisible(rProps))
+pParent->HideItem(nNewId);
 
 for (auto const& prop : rProps)
 {
@@ -3653,8 +3657,6 @@ void VclBuilder::insertMenuObject(Menu *pParent, 
PopupMenu *pSubMenu, const OStr
 pParent->SetTipHelpText(nNewId, rValue);
 else if (rKey == "tooltip-text")
 pParent->SetTipHelpText(nNewId, rValue);
-else if (rKey == "visible")
-pParent->ShowItem(nNewId, toBool(rValue));
 else
 SAL_INFO("vcl.layout", "unhandled property: " << rKey);
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source sd/source vcl/source

2019-11-20 Thread Caolán McNamara (via logerrit)
 sc/inc/colorscale.hxx |2 +-
 sc/inc/column.hxx |2 +-
 sc/source/core/data/colorscale.cxx|2 +-
 sc/source/core/data/column.cxx|2 +-
 sd/source/ui/slidesorter/controller/SlideSorterController.cxx |2 +-
 sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx |2 +-
 vcl/source/app/salvtables.cxx |2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 1d69cf32a73c0720882731ebf3eb5d2f07fce246
Author: Caolán McNamara 
AuthorDate: Fri Oct 18 19:23:40 2019 +0100
Commit: Caolán McNamara 
CommitDate: Wed Nov 20 09:57:49 2019 +0100

Enable/Disable of children shouldn't be necessary

Change-Id: Ied2c1b1305cd099f0a7a4c403c4a81a94234f363
Reviewed-on: https://gerrit.libreoffice.org/81134
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 4836f14af52e..0e72f42d14c6 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -313,7 +313,7 @@ public:
 
 virtual void set_sensitive(bool sensitive) override
 {
-m_xWidget->Enable(sensitive);
+m_xWidget->Enable(sensitive, false);
 }
 
 virtual bool get_sensitive() const override
commit 22fb7b07d79969776f10080ada764a745b63c4b3
Author: Caolán McNamara 
AuthorDate: Tue Nov 19 21:29:11 2019 +
Commit: Caolán McNamara 
CommitDate: Wed Nov 20 09:57:27 2019 +0100

cid#1399334 Uncaught exception

and

cid#1399224 Uncaught exception
cid#1399153 Uncaught exception
cid#1399090 Uncaught exception

Change-Id: Icbafde4a1e1bd1713c25a20337f3e2d0f4103cad
Reviewed-on: https://gerrit.libreoffice.org/83240
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx
index a45f97d15d9e..861ff5e8e2fa 100644
--- a/sc/inc/colorscale.hxx
+++ b/sc/inc/colorscale.hxx
@@ -56,7 +56,7 @@ public:
 ScColorScaleEntry();
 ScColorScaleEntry(const ScColorScaleEntry& rEntry);
 ScColorScaleEntry(ScDocument* pDoc, const ScColorScaleEntry& rEntry);
-~ScColorScaleEntry();
+~ScColorScaleEntry() COVERITY_NOEXCEPT_FALSE;
 
 const Color& GetColor() const { return maColor;}
 void SetColor(const Color&);
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 9b3231ddd48f..18cf3de6231f 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -174,7 +174,7 @@ public:
 };
 
 ScColumn();
-~ScColumn();
+~ScColumn() COVERITY_NOEXCEPT_FALSE;
 
 voidInit(SCCOL nNewCol, SCTAB nNewTab, ScDocument* pDoc, bool 
bEmptyAttrArray);
 
diff --git a/sc/source/core/data/colorscale.cxx 
b/sc/source/core/data/colorscale.cxx
index 774b477b3948..31e83f26a4e3 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -197,7 +197,7 @@ ScColorScaleEntry::ScColorScaleEntry(ScDocument* pDoc, 
const ScColorScaleEntry&
 }
 }
 
-ScColorScaleEntry::~ScColorScaleEntry()
+ScColorScaleEntry::~ScColorScaleEntry() COVERITY_NOEXCEPT_FALSE
 {
 if(mpCell)
 mpCell->EndListeningTo(mpCell->GetDocument());
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index ba17b3de4a75..d1b10c128344 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -89,7 +89,7 @@ ScColumn::ScColumn() :
 maCells.resize(MAXROWCOUNT);
 }
 
-ScColumn::~ScColumn()
+ScColumn::~ScColumn() COVERITY_NOEXCEPT_FALSE
 {
 FreeAll();
 }
diff --git a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx 
b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
index 12077e62f117..0d1c019229e9 100644
--- a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
+++ b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
@@ -902,7 +902,7 @@ SlideSorterController::ModelChangeLock::ModelChangeLock (
 mpController->LockModelChange();
 }
 
-SlideSorterController::ModelChangeLock::~ModelChangeLock()
+SlideSorterController::ModelChangeLock::~ModelChangeLock() 
COVERITY_NOEXCEPT_FALSE
 {
 Release();
 }
diff --git a/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx 
b/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx
index 13409ace971b..7f444ddcee45 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx
@@ -157,7 +157,7 @@ public:
 class ModelChangeLock
 {public:
 ModelChangeLock(SlideSorterController& rController);
-~ModelChangeLock();
+~ModelChangeLock() COVERITY_NOEXCEPT_FALSE;
 void Release();
 private:
 SlideSorterController* mpController;

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2019-11-14 Thread Caolán McNamara (via logerrit)
 sc/inc/scmod.hxx   |2 
 sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx |4 -
 sc/source/ui/StatisticsDialogs/SamplingDialog.cxx  |6 -
 sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx |6 -
 sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx |8 +-
 sc/source/ui/app/inputhdl.cxx  |   16 ++---
 sc/source/ui/app/scmod.cxx |6 -
 sc/source/ui/condformat/condformatdlg.cxx  |2 
 sc/source/ui/dbgui/PivotLayoutDialog.cxx   |   32 
+-
 sc/source/ui/dbgui/consdlg.cxx |8 +-
 sc/source/ui/dbgui/dbnamdlg.cxx|4 -
 sc/source/ui/dbgui/filtdlg.cxx |4 -
 sc/source/ui/dbgui/sfiltdlg.cxx|8 +-
 sc/source/ui/dbgui/validate.cxx|4 -
 sc/source/ui/formdlg/formula.cxx   |8 +-
 sc/source/ui/inc/IAnyRefDialog.hxx |2 
 sc/source/ui/inc/PivotLayoutDialog.hxx |4 -
 sc/source/ui/inc/RandomNumberGeneratorDialog.hxx   |2 
 sc/source/ui/inc/SamplingDialog.hxx|2 
 sc/source/ui/inc/StatisticsInputOutputDialog.hxx   |2 
 sc/source/ui/inc/StatisticsTwoVariableDialog.hxx   |2 
 sc/source/ui/inc/anyrefdg.hxx  |2 
 sc/source/ui/inc/areasdlg.hxx  |2 
 sc/source/ui/inc/condformatdlg.hxx |2 
 sc/source/ui/inc/consdlg.hxx   |2 
 sc/source/ui/inc/crnrdlg.hxx   |2 
 sc/source/ui/inc/dbnamdlg.hxx  |2 
 sc/source/ui/inc/filtdlg.hxx   |4 -
 sc/source/ui/inc/formula.hxx   |2 
 sc/source/ui/inc/highred.hxx   |2 
 sc/source/ui/inc/inputhdl.hxx  |2 
 sc/source/ui/inc/namedefdlg.hxx|2 
 sc/source/ui/inc/namedlg.hxx   |2 
 sc/source/ui/inc/optsolver.hxx |2 
 sc/source/ui/inc/simpref.hxx   |2 
 sc/source/ui/inc/solvrdlg.hxx  |2 
 sc/source/ui/inc/tabopdlg.hxx  |2 
 sc/source/ui/inc/validate.hxx  |   10 +--
 sc/source/ui/inc/xmlsourcedlg.hxx  |2 
 sc/source/ui/miscdlgs/anyrefdg.cxx |2 
 sc/source/ui/miscdlgs/crnrdlg.cxx  |2 
 sc/source/ui/miscdlgs/highred.cxx  |4 -
 sc/source/ui/miscdlgs/optsolver.cxx|8 +-
 sc/source/ui/miscdlgs/simpref.cxx  |6 -
 sc/source/ui/miscdlgs/solvrdlg.cxx |4 -
 sc/source/ui/miscdlgs/tabopdlg.cxx |   10 +--
 sc/source/ui/namedlg/namedefdlg.cxx|6 -
 sc/source/ui/namedlg/namedlg.cxx   |6 -
 sc/source/ui/pagedlg/areasdlg.cxx  |2 
 sc/source/ui/view/gridwin.cxx  |2 
 sc/source/ui/view/tabcont.cxx  |2 
 sc/source/ui/view/tabview4.cxx |4 -
 sc/source/ui/xmlsource/xmlsourcedlg.cxx|4 -
 53 files changed, 120 insertions(+), 120 deletions(-)

New commits:
commit 80ee721c64014b373bbdbdd1fbf14e003dbd142f
Author: Caolán McNamara 
AuthorDate: Thu Nov 14 12:24:56 2019 +
Commit: Caolán McNamara 
CommitDate: Thu Nov 14 16:45:17 2019 +0100

mpDocument is assumed to be non-null

Change-Id: I2ca91a1baf2c34b89b972871025c4039f0eea85b
Reviewed-on: https://gerrit.libreoffice.org/82683
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/source/ui/dbgui/PivotLayoutDialog.cxx 
b/sc/source/ui/dbgui/PivotLayoutDialog.cxx
index e86ad9970685..f5011412bb03 100644
--- a/sc/source/ui/dbgui/PivotLayoutDialog.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutDialog.cxx
@@ -74,9 +74,9 @@ ScPivotLayoutDialog::ScPivotLayoutDialog(
 , maPivotTableObject(*pPivotTableObject)
 , mpPreviouslyFocusedListBox(nullptr)
 , mpViewData(pViewData)
-, mpDocument(pViewData->GetDocument())
+, mrDocument(*pViewData->GetDocument())
 , mbNewPivotTable(bNewPivotTable)
-, maAddressDetails(mpDocument->GetAddressConvention(), 0, 0)
+, 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source ucb/source

2019-10-08 Thread Noel Grandin (via logerrit)
 sc/inc/dapiuno.hxx   |   23 --
 sc/source/ui/unoobj/dapiuno.cxx  |   42 ---
 ucb/source/cacher/cachedcontentresultset.cxx |   33 -
 ucb/source/cacher/cachedcontentresultset.hxx |   22 +++---
 4 files changed, 12 insertions(+), 108 deletions(-)

New commits:
commit 353be96d175d522b21440dbe2b39a67650eebf08
Author: Noel Grandin 
AuthorDate: Mon Oct 7 15:04:36 2019 +0200
Commit: Noel Grandin 
CommitDate: Tue Oct 8 08:28:48 2019 +0200

use cppu::WeakImplHelper in CachedContentResultSetFactory

Change-Id: I1575e051fe963a4bf73453a7e6b89c9c891d1ff9
Reviewed-on: https://gerrit.libreoffice.org/80412
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/ucb/source/cacher/cachedcontentresultset.cxx 
b/ucb/source/cacher/cachedcontentresultset.cxx
index a84be15215c6..a6a2899aef99 100644
--- a/ucb/source/cacher/cachedcontentresultset.cxx
+++ b/ucb/source/cacher/cachedcontentresultset.cxx
@@ -2066,39 +2066,6 @@ 
CachedContentResultSetFactory::~CachedContentResultSetFactory()
 {
 }
 
-
-// CachedContentResultSetFactory XInterface methods.
-void SAL_CALL CachedContentResultSetFactory::acquire()
-throw()
-{
-OWeakObject::acquire();
-}
-
-void SAL_CALL CachedContentResultSetFactory::release()
-throw()
-{
-OWeakObject::release();
-}
-
-css::uno::Any SAL_CALL CachedContentResultSetFactory::queryInterface( const 
css::uno::Type & rType )
-{
-css::uno::Any aRet = cppu::queryInterface( rType,
-   static_cast< XTypeProvider* 
>(this),
-   static_cast< XServiceInfo* 
>(this),
-   static_cast< 
XCachedContentResultSetFactory* >(this)
-   );
-return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
-}
-
-// CachedContentResultSetFactory XTypeProvider methods.
-
-
-XTYPEPROVIDER_IMPL_3( CachedContentResultSetFactory,
-  XTypeProvider,
- XServiceInfo,
-  XCachedContentResultSetFactory );
-
-
 // CachedContentResultSetFactory XServiceInfo methods.
 
 XSERVICEINFO_COMMOM_IMPL( CachedContentResultSetFactory,
diff --git a/ucb/source/cacher/cachedcontentresultset.hxx 
b/ucb/source/cacher/cachedcontentresultset.hxx
index fc1741b5412f..3e450f4d01ea 100644
--- a/ucb/source/cacher/cachedcontentresultset.hxx
+++ b/ucb/source/cacher/cachedcontentresultset.hxx
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -365,11 +366,10 @@ private:
 };
 
 
-class CachedContentResultSetFactory final
-: public cppu::OWeakObject
-, public css::lang::XTypeProvider
-, public css::lang::XServiceInfo
-, public css::ucb::XCachedContentResultSetFactory
+class CachedContentResultSetFactory final :
+public cppu::WeakImplHelper<
+css::lang::XServiceInfo,
+css::ucb::XCachedContentResultSetFactory>
 {
 css::uno::Reference< css::uno::XComponentContext >m_xContext;
 
@@ -379,18 +379,6 @@ public:
 
 virtual ~CachedContentResultSetFactory() override;
 
-
-// XInterface
-virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & 
rType ) override;
-virtual void SAL_CALL acquire()
-throw() override;
-virtual void SAL_CALL release()
-throw() override;
-
-// XTypeProvider
-virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() 
override;
-virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
-
 // XServiceInfo
 virtual OUString SAL_CALL getImplementationName() override;
 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) 
override;
commit 32e48476fe514955aca5f66f6f7a632341623f01
Author: Noel Grandin 
AuthorDate: Mon Oct 7 15:00:51 2019 +0200
Commit: Noel Grandin 
CommitDate: Tue Oct 8 08:28:33 2019 +0200

use cppu::WeakImplHelper in ScDataPilotDescriptorBase

Change-Id: I16f7ba16f08c186bbdb32af5206089c497e1c8c1
Reviewed-on: https://gerrit.libreoffice.org/80411
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/inc/dapiuno.hxx b/sc/inc/dapiuno.hxx
index cc5067171293..e73e824c309c 100644
--- a/sc/inc/dapiuno.hxx
+++ b/sc/inc/dapiuno.hxx
@@ -128,13 +128,13 @@ public:
 };
 
 //  ScDataPilotDescriptorBase is never instantiated directly
-class SAL_DLLPUBLIC_RTTI ScDataPilotDescriptorBase : public 
css::sheet::XDataPilotDescriptor,
-  public css::beans::XPropertySet,
-  public 
css::sheet::XDataPilotDataLayoutFieldSupplier,
-  public css::lang::XServiceInfo,
-  public css::lang::XUnoTunnel,
-  

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2019-08-07 Thread Noel Grandin (via logerrit)
 sc/inc/document.hxx   |2 +-
 sc/source/core/data/column2.cxx   |4 +++-
 sc/source/core/data/documen2.cxx  |5 +++--
 sc/source/core/data/documen8.cxx  |3 +--
 sc/source/ui/Accessibility/AccessibleText.cxx |4 ++--
 sc/source/ui/unoobj/textuno.cxx   |2 +-
 6 files changed, 11 insertions(+), 9 deletions(-)

New commits:
commit 0e12a4055de19271e8756a323df684c0985c8e3a
Author: Noel Grandin 
AuthorDate: Wed Aug 7 14:39:22 2019 +0200
Commit: Noel Grandin 
CommitDate: Wed Aug 7 16:54:56 2019 +0200

tdf#126673 Auto-fit column and auto-fit row don't work with line break

Revert "tdf#94677 Calc is slow opening large CSV, avoid reset SetUpdateMode"

This reverts commit c47d0174f2c6c3ebcb3b33276d0277e7aceac330.

Change-Id: I38e065d44dfb9d08498176b8231aff14ff51d91c
Reviewed-on: https://gerrit.libreoffice.org/77109
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index f47177c2bd5e..bebbd4fafb9a 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -634,7 +634,7 @@ public:
 
 voidClear( bool bFromDestructor = false );
 
-std::unique_ptr CreateFieldEditEngine(bool bUpdateMode);
+std::unique_ptr CreateFieldEditEngine();
 void
DisposeFieldEditEngine(std::unique_ptr& rpEditEngine);
 
 /**
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 4bfacdde4190..151673e278af 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -363,8 +363,9 @@ long ScColumn::GetNeededSize(
 MapMode aHMMMode( MapUnit::Map100thMM, Point(), rZoomX, rZoomY );
 
 // save in document ?
-std::unique_ptr pEngine = 
pDocument->CreateFieldEditEngine(/*bUpdateMode*/false);
+std::unique_ptr pEngine = 
pDocument->CreateFieldEditEngine();
 
+pEngine->SetUpdateMode( false );
 bool bTextWysiwyg = ( pDev->GetOutDevType() == OUTDEV_PRINTER );
 EEControlBits nCtrl = pEngine->GetControlWord();
 if ( bTextWysiwyg )
@@ -455,6 +456,7 @@ long ScColumn::GetNeededSize(
 
 bool bEngineVertical = pEngine->IsVertical();
 pEngine->SetVertical( bAsianVertical );
+pEngine->SetUpdateMode( true );
 
 bool bEdWidth = bWidth;
 if ( eOrient != SvxCellOrientation::Standard && eOrient != 
SvxCellOrientation::Stacked )
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 15d95a9f77b3..b87d73a8da56 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -1091,7 +1091,7 @@ void ScDocument::SetChangeViewSettings(const 
ScChangeViewSettings& rNew)
 *pChangeViewSettings=rNew;
 }
 
-std::unique_ptr ScDocument::CreateFieldEditEngine(bool 
bUpdateMode)
+std::unique_ptr ScDocument::CreateFieldEditEngine()
 {
 std::unique_ptr pNewEditEngine;
 if (!pCacheFieldEditEngine)
@@ -1105,7 +1105,8 @@ std::unique_ptr 
ScDocument::CreateFieldEditEngine(bool bUpdat
 {
 // #i66209# previous use might not have restored update mode,
 // ensure same state as for a new EditEngine (UpdateMode = true)
- pCacheFieldEditEngine->SetUpdateMode(bUpdateMode);
+if ( !pCacheFieldEditEngine->GetUpdateMode() )
+pCacheFieldEditEngine->SetUpdateMode(true);
 }
 
 pNewEditEngine = std::move(pCacheFieldEditEngine);
diff --git a/sc/source/ui/Accessibility/AccessibleText.cxx 
b/sc/source/ui/Accessibility/AccessibleText.cxx
index c32edc078c31..acacc91ba421 100644
--- a/sc/source/ui/Accessibility/AccessibleText.cxx
+++ b/sc/source/ui/Accessibility/AccessibleText.cxx
@@ -1011,7 +1011,7 @@ SvxTextForwarder* 
ScAccessiblePreviewHeaderCellTextData::GetTextForwarder()
 if ( pDocShell )
 {
 ScDocument& rDoc = pDocShell->GetDocument();
-pEditEngine = rDoc.CreateFieldEditEngine(/*bUpdateMode*/true);
+pEditEngine = rDoc.CreateFieldEditEngine();
 }
 else
 {
@@ -1228,7 +1228,7 @@ SvxTextForwarder* 
ScAccessibleNoteTextData::GetTextForwarder()
 if ( mpDocSh )
 {
 ScDocument& rDoc = mpDocSh->GetDocument();
-mpEditEngine = rDoc.CreateFieldEditEngine(/*bUpdateMode*/true);
+mpEditEngine = rDoc.CreateFieldEditEngine();
 }
 else
 {
diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx
index 3ef1645d2542..c62d834a4475 100644
--- a/sc/source/ui/unoobj/textuno.cxx
+++ b/sc/source/ui/unoobj/textuno.cxx
@@ -802,7 +802,7 @@ SvxTextForwarder* ScCellTextData::GetTextForwarder()
 if ( pDocShell )
 {
 ScDocument& rDoc = pDocShell->GetDocument();
-pEditEngine = rDoc.CreateFieldEditEngine(/*bUpdateMode*/true);
+pEditEngine = 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2019-06-25 Thread Noel Grandin (via logerrit)
 sc/inc/document.hxx   |2 +-
 sc/source/core/data/column2.cxx   |4 +---
 sc/source/core/data/documen2.cxx  |5 ++---
 sc/source/core/data/patattr.cxx   |   12 ++--
 sc/source/ui/Accessibility/AccessibleText.cxx |4 ++--
 sc/source/ui/unoobj/textuno.cxx   |2 +-
 6 files changed, 13 insertions(+), 16 deletions(-)

New commits:
commit 2b58bb92b3d5da97290a0f273125ebc34fc5082b
Author: Noel Grandin 
AuthorDate: Mon Jun 24 15:03:17 2019 +0200
Commit: Noel Grandin 
CommitDate: Tue Jun 25 08:28:56 2019 +0200

tdf#94677 Calc is slow opening large CSV, avoid std::shared_ptr

Shaves 2s off a load time of 48s

Change-Id: I616d8b4280bee64e7c25eda8523a13cb80b121ad
Reviewed-on: https://gerrit.libreoffice.org/74640
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index bf3d1dc115e2..d3ce46ddff61 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -542,14 +542,14 @@ void ScPatternAttr::FillToEditItemSet( SfxItemSet& 
rEditSet, const SfxItemSet& r
 {
 //  Read Items
 
-std::shared_ptr 
aColorItem(std::make_shared(EE_CHAR_COLOR));  // use 
item as-is
-std::shared_ptr 
aFontItem(std::make_shared(EE_CHAR_FONTINFO));// use 
item as-is
-std::shared_ptr 
aCjkFontItem(std::make_shared(EE_CHAR_FONTINFO_CJK));
// use item as-is
-std::shared_ptr 
aCtlFontItem(std::make_shared(EE_CHAR_FONTINFO_CTL));
// use item as-is
+std::unique_ptr 
aColorItem(std::make_unique(EE_CHAR_COLOR));  // use 
item as-is
+std::unique_ptr 
aFontItem(std::make_unique(EE_CHAR_FONTINFO));// use 
item as-is
+std::unique_ptr 
aCjkFontItem(std::make_unique(EE_CHAR_FONTINFO_CJK));
// use item as-is
+std::unique_ptr 
aCtlFontItem(std::make_unique(EE_CHAR_FONTINFO_CTL));
// use item as-is
 longnTHeight, nCjkTHeight, nCtlTHeight; // Twips
 FontWeight  eWeight, eCjkWeight, eCtlWeight;
-std::shared_ptr 
aUnderlineItem(std::make_shared(LINESTYLE_NONE, 
EE_CHAR_UNDERLINE));
-std::shared_ptr 
aOverlineItem(std::make_shared(LINESTYLE_NONE, 
EE_CHAR_OVERLINE));
+std::unique_ptr 
aUnderlineItem(std::make_unique(LINESTYLE_NONE, 
EE_CHAR_UNDERLINE));
+std::unique_ptr 
aOverlineItem(std::make_unique(LINESTYLE_NONE, 
EE_CHAR_OVERLINE));
 boolbWordLine;
 FontStrikeout   eStrike;
 FontItalic  eItalic, eCjkItalic, eCtlItalic;
commit c47d0174f2c6c3ebcb3b33276d0277e7aceac330
Author: Noel Grandin 
AuthorDate: Mon Jun 24 11:41:37 2019 +0200
Commit: Noel Grandin 
CommitDate: Tue Jun 25 08:28:49 2019 +0200

tdf#94677 Calc is slow opening large CSV, avoid reset SetUpdateMode

Avoid resetting SetUpdateMode in CreateFieldEditEngine while calculating
row height.

This takes the time from 1m25 to 49s for me.

Change-Id: If406eac1a8b031f1734d9c2376c413dfa22d89f8
Reviewed-on: https://gerrit.libreoffice.org/74630
Reviewed-by: Noel Grandin 
Tested-by: Noel Grandin 

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index bebbd4fafb9a..f47177c2bd5e 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -634,7 +634,7 @@ public:
 
 voidClear( bool bFromDestructor = false );
 
-std::unique_ptr CreateFieldEditEngine();
+std::unique_ptr CreateFieldEditEngine(bool bUpdateMode);
 void
DisposeFieldEditEngine(std::unique_ptr& rpEditEngine);
 
 /**
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 0a54f877c0b1..b4dfbfac64aa 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -363,9 +363,8 @@ long ScColumn::GetNeededSize(
 MapMode aHMMMode( MapUnit::Map100thMM, Point(), rZoomX, rZoomY );
 
 // save in document ?
-std::unique_ptr pEngine = 
pDocument->CreateFieldEditEngine();
+std::unique_ptr pEngine = 
pDocument->CreateFieldEditEngine(/*bUpdateMode*/false);
 
-pEngine->SetUpdateMode( false );
 bool bTextWysiwyg = ( pDev->GetOutDevType() == OUTDEV_PRINTER );
 EEControlBits nCtrl = pEngine->GetControlWord();
 if ( bTextWysiwyg )
@@ -456,7 +455,6 @@ long ScColumn::GetNeededSize(
 
 bool bEngineVertical = pEngine->IsVertical();
 pEngine->SetVertical( bAsianVertical );
-pEngine->SetUpdateMode( true );
 
 bool bEdWidth = bWidth;
 if ( eOrient != SvxCellOrientation::Standard && eOrient != 
SvxCellOrientation::Stacked )
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index b87d73a8da56..15d95a9f77b3 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -1091,7 +1091,7 @@ void 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2019-05-16 Thread Luboš Luňák (via logerrit)
 sc/inc/cellvalue.hxx  |6 ++
 sc/inc/column.hxx |3 +++
 sc/inc/document.hxx   |   15 +++
 sc/inc/table.hxx  |5 -
 sc/source/core/data/cellvalue.cxx |   10 ++
 sc/source/core/data/column.cxx|   10 ++
 sc/source/core/data/column2.cxx   |   16 
 sc/source/core/data/documen2.cxx  |8 
 sc/source/core/data/documen4.cxx  |   11 ---
 sc/source/core/data/documen6.cxx  |   13 +
 sc/source/core/data/table1.cxx|8 
 sc/source/core/data/table3.cxx|   29 -
 sc/source/filter/html/htmlexp.cxx |   18 +++---
 sc/source/filter/inc/htmlexp.hxx  |6 +-
 14 files changed, 133 insertions(+), 25 deletions(-)

New commits:
commit 6f810e3d7dafcd7d0101173a501786226f4d8886
Author: Luboš Luňák 
AuthorDate: Wed May 15 13:13:31 2019 +0200
Commit: Luboš Luňák 
CommitDate: Thu May 16 12:34:51 2019 +0200

optimize ScHTMLExport::WriteTables() with large columns

Again, unless given a hint, mdds always starts a search from the beginning
of the container, so iterating over a column becomes quadratic.
Shows when selecting (the title of) a large column with different value 
types,
e.g. in tdf#120558, which triggers setting the selection from
VclQt5Clipboard::setContents(), which calls this.

Change-Id: Ida009c5ddf18ccdc8dff88c15530cc7e33ce80e7
Reviewed-on: https://gerrit.libreoffice.org/72366
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 

diff --git a/sc/inc/cellvalue.hxx b/sc/inc/cellvalue.hxx
index 7b6e3aad5794..281612d8874e 100644
--- a/sc/inc/cellvalue.hxx
+++ b/sc/inc/cellvalue.hxx
@@ -18,6 +18,10 @@ class EditTextObject;
 class ScColumn;
 struct ScRefCellValue;
 
+namespace sc {
+struct ColumnBlockPosition;
+}
+
 namespace svl {
 
 class SharedString;
@@ -117,6 +121,7 @@ struct SC_DLLPUBLIC ScRefCellValue
  * Take cell value from specified position in specified document.
  */
 ScRefCellValue( ScDocument& rDoc, const ScAddress& rPos );
+ScRefCellValue( ScDocument& rDoc, const ScAddress& rPos, 
sc::ColumnBlockPosition& rBlockPos );
 
 void clear();
 
@@ -124,6 +129,7 @@ struct SC_DLLPUBLIC ScRefCellValue
  * Take cell value from specified position in specified document.
  */
 void assign( ScDocument& rDoc, const ScAddress& rPos );
+void assign( ScDocument& rDoc, const ScAddress& rPos, 
sc::ColumnBlockPosition& rBlockPos );
 
 /**
  * Set cell value at specified position in specified document.
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 9a4d22a3e664..340b5628faf6 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -189,6 +189,7 @@ public:
 const sc::CellNoteStoreType& GetCellNoteStore() const { return 
maCellNotes; }
 
 ScRefCellValue GetCellValue( SCROW nRow ) const;
+ScRefCellValue GetCellValue( sc::ColumnBlockPosition& rBlockPos, SCROW 
nRow );
 ScRefCellValue GetCellValue( sc::ColumnBlockConstPosition& rBlockPos, 
SCROW nRow ) const;
 static ScRefCellValue GetCellValue( const 
sc::CellStoreType::const_iterator& itPos, size_t nOffset );
 
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index dd59a74c44e4..af372c270675 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1550,7 +1550,7 @@ public:
 void CopyTabToClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
 SCTAB nTab, ScDocument* pClipDoc);
 
-bool InitColumnBlockPosition( sc::ColumnBlockPosition& rBlockPos, SCTAB 
nTab, SCCOL nCol );
+SC_DLLPUBLIC bool InitColumnBlockPosition( sc::ColumnBlockPosition& 
rBlockPos, SCTAB nTab, SCCOL nCol );
 
 void DeleteBeforeCopyFromClip( sc::CopyFromClipContext& rCxt, const 
ScMarkData& rMark,
sc::ColumnSpanSet& rBroadcastSpans );
@@ -1692,7 +1692,9 @@ public:
 voidRemoveCondFormatData( const 
ScRangeList& rRange, SCTAB nTab, sal_uInt32 nIndex );
 
 SC_DLLPUBLIC ScConditionalFormat*   GetCondFormat( SCCOL nCol, SCROW 
nRow, SCTAB nTab ) const;
-SC_DLLPUBLIC const SfxItemSet*  GetCondResult( SCCOL nCol, SCROW 
nRow, SCTAB nTab ) const;
+// pCell is an optimization, must point to rPos
+SC_DLLPUBLIC const SfxItemSet*  GetCondResult( SCCOL nCol, SCROW 
nRow, SCTAB nTab,
+   ScRefCellValue* 
pCell = nullptr ) const;
 const SfxItemSet*   GetCondResult( ScRefCellValue& 
rCell, const ScAddress& rPos,
const 
ScConditionalFormatList& rList,
const 
ScCondFormatIndexes& rIndex ) const;
@@ -1705,8 +1707,12 @@ public:
 SC_DLLPUBLIC const css::uno::Reference< css::i18n::XBreakIterator >& 
GetBreakIterator();
 bool

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source sc/uiconfig solenv/sanitizers vcl/unx

2019-04-29 Thread Caolán McNamara (via logerrit)
 sc/inc/orcusfilters.hxx   |4 
 sc/inc/orcusxml.hxx   |   13 -
 sc/source/core/tool/orcusxml.cxx  |6 
 sc/source/filter/inc/orcusfiltersimpl.hxx |2 
 sc/source/filter/orcus/xmlcontext.cxx |   63 ++---
 sc/source/ui/inc/xmlsourcedlg.hxx |   75 +++---
 sc/source/ui/view/reffact.cxx |4 
 sc/source/ui/view/tabvwshc.cxx|   11 
 sc/source/ui/xmlsource/xmlsourcedlg.cxx   |  361 --
 sc/uiconfig/scalc/ui/xmlsourcedialog.ui   |  205 ++---
 solenv/sanitizers/ui/modules/scalc.false  |1 
 solenv/sanitizers/ui/modules/scalc.suppr  |4 
 vcl/unx/gtk3/gtk3gtkinst.cxx  |1 
 13 files changed, 376 insertions(+), 374 deletions(-)

New commits:
commit 260e5b61209b92e1583623d70b2ba3032b5ced14
Author: Caolán McNamara 
AuthorDate: Sun Apr 28 19:47:03 2019 +0100
Commit: Caolán McNamara 
CommitDate: Mon Apr 29 14:31:51 2019 +0200

weld ScXMLSourceDlg

Change-Id: If8894b7c432006f196e040571757943c940f13ea
Reviewed-on: https://gerrit.libreoffice.org/71489
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/inc/orcusfilters.hxx b/sc/inc/orcusfilters.hxx
index 1f96d6ac1769..99f55306b226 100644
--- a/sc/inc/orcusfilters.hxx
+++ b/sc/inc/orcusfilters.hxx
@@ -13,11 +13,11 @@
 #include 
 
 class ScDocument;
-class SvTreeListBox;
 struct ScOrcusXMLTreeParam;
 struct ScOrcusImportXMLParam;
 class ScOrcusXMLContext;
 class SfxMedium;
+namespace weld { class TreeView; }
 
 /**
  * Collection of orcus filter wrappers.
@@ -60,7 +60,7 @@ class ScOrcusXMLContext
 public:
 virtual ~ScOrcusXMLContext() {}
 
-virtual void loadXMLStructure(SvTreeListBox& rTreeCtrl, 
ScOrcusXMLTreeParam& rParam) = 0;
+virtual void loadXMLStructure(weld::TreeView& rTreeCtrl, 
ScOrcusXMLTreeParam& rParam) = 0;
 
 virtual void importXML(const ScOrcusImportXMLParam& rParam) = 0;
 };
diff --git a/sc/inc/orcusxml.hxx b/sc/inc/orcusxml.hxx
index 2b8f94425f73..b635eca2d43d 100644
--- a/sc/inc/orcusxml.hxx
+++ b/sc/inc/orcusxml.hxx
@@ -17,7 +17,10 @@
 #include 
 #include 
 
-class SvTreeListEntry;
+namespace weld {
+class TreeIter;
+class TreeView;
+}
 
 /**
  * Parameter used during call to ScOrcusFilters::loadXMLStructure().
@@ -40,9 +43,9 @@ struct ScOrcusXMLTreeParam
 
 typedef std::vector> UserDataStoreType;
 
-Image maImgElementDefault;
-Image maImgElementRepeat;
-Image maImgAttribute;
+OUString maImgElementDefault;
+OUString maImgElementRepeat;
+OUString maImgAttribute;
 
 /**
  * Store all custom data instances since the tree control doesn't manage
@@ -50,7 +53,7 @@ struct ScOrcusXMLTreeParam
  */
 UserDataStoreType m_UserDataStore;
 
-static SC_DLLPUBLIC EntryData* getUserData(const SvTreeListEntry& rEntry);
+static SC_DLLPUBLIC EntryData* getUserData(const weld::TreeView& rControl, 
const weld::TreeIter& rEntry);
 };
 
 struct ScOrcusImportXMLParam
diff --git a/sc/source/core/tool/orcusxml.cxx b/sc/source/core/tool/orcusxml.cxx
index 13101973d2c6..1323362b4124 100644
--- a/sc/source/core/tool/orcusxml.cxx
+++ b/sc/source/core/tool/orcusxml.cxx
@@ -9,7 +9,7 @@
 
 #include 
 
-#include 
+#include 
 
 ScOrcusXMLTreeParam::EntryData::EntryData(EntryType eType)
 : mnNamespaceID(0)
@@ -19,9 +19,9 @@ ScOrcusXMLTreeParam::EntryData::EntryData(EntryType eType)
 , mbLeafNode(true)
 {}
 
-ScOrcusXMLTreeParam::EntryData* ScOrcusXMLTreeParam::getUserData(const 
SvTreeListEntry& rEntry)
+ScOrcusXMLTreeParam::EntryData* ScOrcusXMLTreeParam::getUserData(const 
weld::TreeView& rControl, const weld::TreeIter& rEntry)
 {
-return static_cast(rEntry.GetUserData());
+return 
reinterpret_cast(rControl.get_id(rEntry).toInt64());
 }
 
 ScOrcusImportXMLParam::CellLink::CellLink(const ScAddress& rPos, const 
OString& rPath) :
diff --git a/sc/source/filter/inc/orcusfiltersimpl.hxx 
b/sc/source/filter/inc/orcusfiltersimpl.hxx
index 1a27dc93ec1c..bef07a43e2dc 100644
--- a/sc/source/filter/inc/orcusfiltersimpl.hxx
+++ b/sc/source/filter/inc/orcusfiltersimpl.hxx
@@ -41,7 +41,7 @@ public:
 ScOrcusXMLContextImpl(ScDocument& rDoc, const OUString& rPath);
 virtual ~ScOrcusXMLContextImpl() override;
 
-virtual void loadXMLStructure(SvTreeListBox& rTreeCtrl, 
ScOrcusXMLTreeParam& rParam) override;
+virtual void loadXMLStructure(weld::TreeView& rTreeCtrl, 
ScOrcusXMLTreeParam& rParam) override;
 
 virtual void importXML(const ScOrcusImportXMLParam& rParam) override;
 };
diff --git a/sc/source/filter/orcus/xmlcontext.cxx 
b/sc/source/filter/orcus/xmlcontext.cxx
index 636e66271a7d..9cac43207cf4 100644
--- a/sc/source/filter/orcus/xmlcontext.cxx
+++ b/sc/source/filter/orcus/xmlcontext.cxx
@@ -15,6 +15,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -38,11 +39,11 @@ using namespace com::sun::star;
 
 namespace {
 
-ScOrcusXMLTreeParam::EntryData& 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2019-04-18 Thread Noel Grandin (via logerrit)
 sc/inc/document.hxx|2 ++
 sc/source/core/data/dociter.cxx|4 ++--
 sc/source/core/data/documen3.cxx   |5 +
 sc/source/core/data/document10.cxx |9 +
 sc/source/filter/xml/XMLStylesExportHelper.cxx |1 +
 5 files changed, 19 insertions(+), 2 deletions(-)

New commits:
commit ac9aa53d51a4f359342274d107aed6df85658c55
Author: Noel Grandin 
AuthorDate: Wed Apr 17 21:40:28 2019 +0200
Commit: Noel Grandin 
CommitDate: Thu Apr 18 08:49:41 2019 +0200

crashtesting: failure on import of ooo6593-5.stc

since
commit 7282014e362a1529a36c88eb308df8ed359c2cfa
Date:   Fri Feb 1 15:15:16 2019 +0100
tdf#50916 Makes numbers of columns dynamic

Change-Id: I858e61b3a1158bf47b5855e56d63c77cc87aa09b
Reviewed-on: https://gerrit.libreoffice.org/70902
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 48dbe6c04e69..cdeab88fdfcb 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -787,6 +787,7 @@ public:
 ScRangePairListRef& GetRowNameRangesRef() { return xRowNameRanges; }
 
 SC_DLLPUBLIC SCCOL ClampToAllocatedColumns(SCTAB nTab, SCCOL nCol) const;
+SC_DLLPUBLIC SCCOL GetAllocatedColumnsCount(SCTAB nTab) const;
 
 SC_DLLPUBLIC ScDBCollection* GetDBCollection() const { return 
pDBCollection.get();}
 void SetDBCollection( 
std::unique_ptr pNewDBCollection,
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index 8458e2895684..ec81363846f2 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -829,7 +829,6 @@ ScCellIterator::ScCellIterator( ScDocument* pDoc, const 
ScRange& rRange, Subtota
 maEndPos(rRange.aEnd),
 mnSubTotalFlags(nSubTotalFlags)
 {
-maEndPos.SetCol( pDoc->ClampToAllocatedColumns(maStartPos.Tab(), 
maEndPos.Col()) );
 init();
 }
 
@@ -914,7 +913,8 @@ bool ScCellIterator::getCurrent()
 do
 {
 maCurPos.IncCol();
-if (maCurPos.Col() > maEndPos.Col())
+if (maCurPos.Col() >= 
mpDoc->GetAllocatedColumnsCount(maCurPos.Tab())
+|| maCurPos.Col() > maEndPos.Col())
 {
 maCurPos.SetCol(maStartPos.Col());
 maCurPos.IncTab();
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 75f1cdab071a..0bcf1aa37580 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -2103,4 +2103,9 @@ SCCOL ScDocument::ClampToAllocatedColumns(SCTAB nTab, 
SCCOL nCol) const
 return maTabs[nTab]->ClampToAllocatedColumns(nCol);
 }
 
+SCCOL ScDocument::GetAllocatedColumnsCount(SCTAB nTab) const
+{
+return maTabs[nTab]->GetAllocatedColumnsCount();
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 3df2e918408535acd2c4d028bfae70901ad24e62
Author: Noel Grandin 
AuthorDate: Wed Apr 17 21:03:26 2019 +0200
Commit: Noel Grandin 
CommitDate: Thu Apr 18 08:49:32 2019 +0200

crashtesting: failure on export of ooo118068-1.ods  to ods

since
commit 7282014e362a1529a36c88eb308df8ed359c2cfa
Date:   Fri Feb 1 15:15:16 2019 +0100
tdf#50916 Makes numbers of columns dynamic

Change-Id: Ib8dc06b80beed81a2543f343483599c425e87369
Reviewed-on: https://gerrit.libreoffice.org/70901
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index bd6db82a7d00..48dbe6c04e69 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -2454,6 +2454,7 @@ public:
 voidDeleteBroadcasters( sc::ColumnBlockPosition& 
rBlockPos, const ScAddress& rTopPos, SCROW nLength );
 
 std::unique_ptr GetColumnIterator( SCTAB nTab, SCCOL 
nCol, SCROW nRow1, SCROW nRow2 ) const;
+void CreateColumnIfNotExists( SCTAB nTab, SCCOL nCol );
 
 SC_DLLPUBLIC void StoreTabToCache(SCTAB nTab, SvStream& rStrm) const;
 SC_DLLPUBLIC void RestoreTabFromCache(SCTAB nTab, SvStream& rStream);
diff --git a/sc/source/core/data/document10.cxx 
b/sc/source/core/data/document10.cxx
index c286ecba4c98..429fc33074fb 100644
--- a/sc/source/core/data/document10.cxx
+++ b/sc/source/core/data/document10.cxx
@@ -916,6 +916,15 @@ std::unique_ptr 
ScDocument::GetColumnIterator( SCTAB nTab, S
 return pTab->GetColumnIterator(nCol, nRow1, nRow2);
 }
 
+void ScDocument::CreateColumnIfNotExists( SCTAB nTab, SCCOL nCol )
+{
+const ScTable* pTab = FetchTable(nTab);
+if (!pTab)
+return;
+
+pTab->CreateColumnIfNotExists(nCol);
+}
+
 bool ScDocument::EnsureFormulaCellResults( const ScRange& rRange, bool 
bSkipRunning )
 {
 bool bAnyDirty = false;
diff --git a/sc/source/filter/xml/XMLStylesExportHelper.cxx 
b/sc/source/filter/xml/XMLStylesExportHelper.cxx
index 6b2fb2e4a2a4..9cc648340a3c 100644
--- 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2019-04-17 Thread Caolán McNamara (via logerrit)
 sc/inc/scmod.hxx  |4 ---
 sc/source/ui/app/scmod.cxx|   31 -
 sc/source/ui/inc/anyrefdg.hxx |   44 +-
 sc/source/ui/inc/validate.hxx |4 +--
 4 files changed, 12 insertions(+), 71 deletions(-)

New commits:
commit d69db73ec1de29ec5b72cdcd2a64873b92cac672
Author: Caolán McNamara 
AuthorDate: Wed Apr 17 15:59:22 2019 +0100
Commit: Caolán McNamara 
CommitDate: Wed Apr 17 22:22:38 2019 +0200

m_mapRefWindow is unneeded now

Change-Id: I68811d64ed340f3b5f86d7c13289455009eea74e
Reviewed-on: https://gerrit.libreoffice.org/70890
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx
index 5b4e519fd693..2c517eedf770 100644
--- a/sc/inc/scmod.hxx
+++ b/sc/inc/scmod.hxx
@@ -108,7 +108,6 @@ class ScModule: public SfxModule, public SfxListener, 
public utl::ConfigurationL
 boolm_bIsInSharedDocLoading:1;
 boolm_bIsInSharedDocSaving:1;
 
-std::map > > m_mapRefWindow;
 // a way to find existing Dialogs for a given parent Window of the slot 
type
 std::map, weld::Window*>>> 
m_mapRefController;
 
@@ -249,9 +248,6 @@ public:
 voidSetInSharedDocSaving( bool bNew )   { 
m_bIsInSharedDocSaving = bNew; }
 boolIsInSharedDocSaving() const { return 
m_bIsInSharedDocSaving; }
 
-SC_DLLPUBLIC void   RegisterRefWindow( sal_uInt16 nSlotId, vcl::Window 
*pWnd );
-SC_DLLPUBLIC void   UnregisterRefWindow( sal_uInt16 nSlotId, vcl::Window 
*pWnd );
-
 SC_DLLPUBLIC void   RegisterRefController(sal_uInt16 nSlotId, 
std::shared_ptr& rWnd, weld::Window* pWndAncestor);
 SC_DLLPUBLIC void   UnregisterRefController(sal_uInt16 nSlotId, 
std::shared_ptr& rWnd);
 SC_DLLPUBLIC std::shared_ptr 
Find1RefWindow(sal_uInt16 nSlotId, weld::Window *pWndAncestor);
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index c701866a66d4..082b4e32c929 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -2197,37 +2197,6 @@ IMPL_LINK( ScModule, CalcFieldValueHdl, EditFieldInfo*, 
pInfo, void )
 }
 }
 
-void ScModule::RegisterRefWindow( sal_uInt16 nSlotId, vcl::Window *pWnd )
-{
-std::vector > & rlRefWindow = m_mapRefWindow[nSlotId];
-
-if( std::find( rlRefWindow.begin(), rlRefWindow.end(), pWnd ) == 
rlRefWindow.end() )
-{
-rlRefWindow.emplace_back(pWnd );
-}
-
-}
-
-void  ScModule::UnregisterRefWindow( sal_uInt16 nSlotId, vcl::Window *pWnd )
-{
-auto iSlot = m_mapRefWindow.find( nSlotId );
-
-if( iSlot == m_mapRefWindow.end() )
-return;
-
-std::vector > & rlRefWindow = iSlot->second;
-
-auto i = std::find( rlRefWindow.begin(), rlRefWindow.end(), pWnd );
-
-if( i == rlRefWindow.end() )
-return;
-
-rlRefWindow.erase( i );
-
-if( rlRefWindow.empty() )
-m_mapRefWindow.erase( nSlotId );
-}
-
 void ScModule::RegisterRefController(sal_uInt16 nSlotId, 
std::shared_ptr& rWnd, weld::Window* pWndAncestor)
 {
 std::vector, 
weld::Window*>> & rlRefWindow = m_mapRefController[nSlotId];
diff --git a/sc/source/ui/inc/anyrefdg.hxx b/sc/source/ui/inc/anyrefdg.hxx
index 7fd1c4b19381..978c733fb784 100644
--- a/sc/source/ui/inc/anyrefdg.hxx
+++ b/sc/source/ui/inc/anyrefdg.hxx
@@ -209,19 +209,16 @@ struct ScRefHdlrImpl: ScRefHdlrImplBase< TBase, bBindRef >
 ScRefHdlrImpl( const T1 & rt1, const T2 & rt2, const T3& rt3, const T4& 
rt4 )
 : ScRefHdlrImplBase(rt1, rt2, rt3, rt4)
 {
-SC_MOD()->RegisterRefWindow( static_cast( TDerived::SLOTID 
), this );
 }
 
 template
 ScRefHdlrImpl( const T1 & rt1, const T2 & rt2, const T3& rt3, const T4& 
rt4, const T5& rt5 )
 : ScRefHdlrImplBase(rt1, rt2, rt3, rt4, rt5)
 {
-SC_MOD()->RegisterRefWindow( static_cast( TDerived::SLOTID 
), this );
 }
 
 virtual void dispose() override
 {
-SC_MOD()->UnregisterRefWindow( static_cast( 
TDerived::SLOTID ), this );
 ScRefHdlrImplBase::disposeRefHandler();
 TBase::dispose();
 }
commit b6075c3afed5837a79a9c509f5b38f38eeacf6dc
Author: Caolán McNamara 
AuthorDate: Wed Apr 17 15:46:05 2019 +0100
Commit: Caolán McNamara 
CommitDate: Wed Apr 17 22:22:18 2019 +0200

boil incomprehensible template spew down to its simpler reality

Change-Id: I6a428b6515bffb69b6890ddcf8990c2c773b506c
Reviewed-on: https://gerrit.libreoffice.org/70889
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/source/ui/inc/anyrefdg.hxx b/sc/source/ui/inc/anyrefdg.hxx
index 99c57edf5320..7fd1c4b19381 100644
--- a/sc/source/ui/inc/anyrefdg.hxx
+++ b/sc/source/ui/inc/anyrefdg.hxx
@@ -241,49 +241,28 @@ struct ScAnyRefDlg : ::ScRefHdlrImpl< ScAnyRefDlg, 
SfxModelessDialog>
 }
 };
 
-template<  class TWindow, bool bBindRef = true >
-class 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source svx/source

2019-03-27 Thread Noel Grandin (via logerrit)
 sc/inc/conditio.hxx  |2 +-
 sc/source/core/data/conditio.cxx |   12 ++--
 sc/source/filter/excel/xecontent.cxx |6 +++---
 svx/source/form/fmshimp.cxx  |4 ++--
 svx/source/form/navigatortree.cxx|2 +-
 svx/source/inc/fmshimp.hxx   |2 +-
 6 files changed, 14 insertions(+), 14 deletions(-)

New commits:
commit 9852f09b467e3c7f8058b931010b91f447905051
Author: Noel Grandin 
AuthorDate: Wed Mar 27 10:58:14 2019 +0200
Commit: Noel Grandin 
CommitDate: Wed Mar 27 13:38:51 2019 +0100

return unique_ptr from FmXFormShell::GetConversionMenu_Lock

Change-Id: I8b262c18862429f8b6822742fb8fa454af1090a6
Reviewed-on: https://gerrit.libreoffice.org/69802
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx
index 11250b4b7827..171621ce0310 100644
--- a/svx/source/form/fmshimp.cxx
+++ b/svx/source/form/fmshimp.cxx
@@ -1030,9 +1030,9 @@ void FmXFormShell::ForceUpdateSelection_Lock()
 }
 }
 
-VclBuilder* FmXFormShell::GetConversionMenu_Lock()
+std::unique_ptr FmXFormShell::GetConversionMenu_Lock()
 {
-VclBuilder* pBuilder = new VclBuilder(nullptr, 
VclBuilderContainer::getUIRootDir(), "svx/ui/convertmenu.ui", "");
+std::unique_ptr pBuilder(new VclBuilder(nullptr, 
VclBuilderContainer::getUIRootDir(), "svx/ui/convertmenu.ui", ""));
 VclPtr pNewMenu(pBuilder->get_menu("menu"));
 for (size_t i = 0; i < SAL_N_ELEMENTS(aConvertSlots); ++i)
 {
diff --git a/svx/source/form/navigatortree.cxx 
b/svx/source/form/navigatortree.cxx
index c73bb9b01e10..bbe61c0e4e3c 100644
--- a/svx/source/form/navigatortree.cxx
+++ b/svx/source/form/navigatortree.cxx
@@ -410,7 +410,7 @@ namespace svxform
 const sal_Int16 nChangeId = 
aContextMenu->GetItemId("change");
 if (!m_bRootSelected && !m_nFormsSelected && 
(m_nControlsSelected == 1))
 {
-xBuilder.reset(FmXFormShell::GetConversionMenu_Lock());
+xBuilder = FmXFormShell::GetConversionMenu_Lock();
 xConversionMenu = xBuilder->get_menu("menu");
 aContextMenu->SetPopupMenu(nChangeId, xConversionMenu);
 #if OSL_DEBUG_LEVEL > 0
diff --git a/svx/source/inc/fmshimp.hxx b/svx/source/inc/fmshimp.hxx
index beedf5973d3a..7a9c452f866b 100644
--- a/svx/source/inc/fmshimp.hxx
+++ b/svx/source/inc/fmshimp.hxx
@@ -411,7 +411,7 @@ public:
 SAL_DLLPRIVATE void stopFiltering_Lock(bool bSave);
 
 // a menu that contains all ControlConversion entries
-SAL_DLLPRIVATE static VclBuilder* GetConversionMenu_Lock();
+SAL_DLLPRIVATE static std::unique_ptr GetConversionMenu_Lock();
 
 /// checks whether a given control conversion slot can be applied to the 
current selection
 SAL_DLLPRIVATE bool canConvertCurrentSelectionToControl_Lock(const 
OString& rIdent);
commit 16676ea2e86b1b50ba653b736c5db4eb9f32acf9
Author: Noel Grandin 
AuthorDate: Wed Mar 27 11:24:41 2019 +0200
Commit: Noel Grandin 
CommitDate: Wed Mar 27 13:38:42 2019 +0100

return unique_ptr in CreateFlatCopiedTokenArray

Change-Id: I0d44ad1eca45b0b77d5a898a553aab61b1f479a9
Reviewed-on: https://gerrit.libreoffice.org/69805
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx
index ae1097078c15..4651f7453b04 100644
--- a/sc/inc/conditio.hxx
+++ b/sc/inc/conditio.hxx
@@ -380,7 +380,7 @@ public:
 
 /** Create a flat copy using ScTokenArray copy-ctor with
 shared tokens. */
-ScTokenArray*   CreateFlatCopiedTokenArray( sal_uInt16 nPos ) const;
+std::unique_ptr CreateFlatCopiedTokenArray( sal_uInt16 nPos 
) const;
 
 voidCompileAll();
 voidCompileXML();
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index c992bd6f3ec3..359a76986da9 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -1277,18 +1277,18 @@ OUString ScConditionEntry::GetExpression( const 
ScAddress& rCursor, sal_uInt16 n
 return aRet;
 }
 
-ScTokenArray* ScConditionEntry::CreateFlatCopiedTokenArray( sal_uInt16 nIndex 
) const
+std::unique_ptr ScConditionEntry::CreateFlatCopiedTokenArray( 
sal_uInt16 nIndex ) const
 {
 assert(nIndex <= 1);
-ScTokenArray* pRet = nullptr;
+std::unique_ptr pRet;
 
 if ( nIndex==0 )
 {
 if ( pFormula1 )
-pRet = new ScTokenArray( *pFormula1 );
+pRet.reset(new ScTokenArray( *pFormula1 ));
 else
 {
-pRet = new ScTokenArray();
+pRet.reset(new ScTokenArray());
 if (bIsStr1)
 {
 svl::SharedStringPool& rSPool = mpDoc->GetSharedStringPool();
@@ -1301,10 +1301,10 @@ ScTokenArray* 
ScConditionEntry::CreateFlatCopiedTokenArray( sal_uInt16 nIndex )
 else if ( 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source sw/source

2019-01-09 Thread Libreoffice Gerrit user
 sc/inc/rangeutl.hxx   |2 +-
 sc/source/core/tool/rangeutl.cxx  |   11 +--
 sc/source/ui/dbgui/consdlg.cxx|   23 ---
 sw/source/core/bastyp/swcache.cxx |   23 +--
 sw/source/core/inc/swcache.hxx|6 +++---
 5 files changed, 26 insertions(+), 39 deletions(-)

New commits:
commit b8f497a06d585dbae3adadb4d177fe84fdb1b5fa
Author: Noel Grandin 
AuthorDate: Wed Jan 9 12:52:54 2019 +0200
Commit: Noel Grandin 
CommitDate: Thu Jan 10 08:16:27 2019 +0100

use unique_ptr in SwCache

Change-Id: I2b961380dcb5eb26ce517f7b56e5c32f5e6429e4
Reviewed-on: https://gerrit.libreoffice.org/66011
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sw/source/core/bastyp/swcache.cxx 
b/sw/source/core/bastyp/swcache.cxx
index 2693578c8b21..6a51faea 100644
--- a/sw/source/core/bastyp/swcache.cxx
+++ b/sw/source/core/bastyp/swcache.cxx
@@ -125,9 +125,6 @@ SwCache::~SwCache()
 << "; number of Cache reductions: " << m_nDecreaseMax);
 Check();
 #endif
-
-for(const auto& rpObj : m_aCacheObjects)
-delete rpObj;
 }
 
 void SwCache::IncreaseMax( const sal_uInt16 nAdd )
@@ -163,8 +160,7 @@ void SwCache::Flush()
 pTmp = pObj;
 pObj = pTmp->GetNext();
 m_aFreePositions.push_back( pTmp->GetCachePos() );
-m_aCacheObjects[pTmp->GetCachePos()] = nullptr;
-delete pTmp;
+m_aCacheObjects[pTmp->GetCachePos()].reset(); // deletes pTmp
 INCREMENT( m_nFlushedObjects );
 }
 }
@@ -236,7 +232,7 @@ SwCacheObj *SwCache::Get( const void *pOwner, const 
sal_uInt16 nIndex,
   const bool bToTop )
 {
 SwCacheObj *pRet;
-if ( nullptr != (pRet = (nIndex < m_aCacheObjects.size()) ? 
m_aCacheObjects[ nIndex ] : nullptr) )
+if ( nullptr != (pRet = (nIndex < m_aCacheObjects.size()) ? 
m_aCacheObjects[ nIndex ].get() : nullptr) )
 {
 if ( !pRet->IsOwner( pOwner ) )
 pRet = nullptr;
@@ -300,8 +296,7 @@ void SwCache::DeleteObj( SwCacheObj *pObj )
 pObj->GetNext()->SetPrev( pObj->GetPrev() );
 
 m_aFreePositions.push_back( pObj->GetCachePos() );
-m_aCacheObjects[pObj->GetCachePos()] = nullptr;
-delete pObj;
+m_aCacheObjects[pObj->GetCachePos()] = nullptr; // deletes pObj
 
 CHECK;
 if ( m_aCacheObjects.size() > m_nCurMax &&
@@ -312,9 +307,10 @@ void SwCache::DeleteObj( SwCacheObj *pObj )
 // these might not find them afterwards
 for ( size_t i = 0; i < m_aCacheObjects.size(); ++i )
 {
-SwCacheObj *pTmpObj = m_aCacheObjects[i];
+SwCacheObj *pTmpObj = m_aCacheObjects[i].get();
 if ( !pTmpObj )
-{   m_aCacheObjects.erase( m_aCacheObjects.begin() + i );
+{
+m_aCacheObjects.erase( m_aCacheObjects.begin() + i );
 --i;
 }
 else
@@ -346,7 +342,7 @@ bool SwCache::Insert( SwCacheObj *pNew )
 // there is still space; insert directly
 INCREMENT( m_nAppend );
 nPos = m_aCacheObjects.size();
-m_aCacheObjects.push_back(pNew);
+m_aCacheObjects.emplace_back(pNew);
 }
 else if ( !m_aFreePositions.empty() )
 {
@@ -354,7 +350,7 @@ bool SwCache::Insert( SwCacheObj *pNew )
 INCREMENT( m_nInsertFree );
 const sal_uInt16 nFreePos = m_aFreePositions.size() - 1;
 nPos = m_aFreePositions[ nFreePos ];
-m_aCacheObjects[nPos] = pNew;
+m_aCacheObjects[nPos].reset(pNew);
 m_aFreePositions.erase( m_aFreePositions.begin() + nFreePos );
 }
 else
@@ -403,8 +399,7 @@ bool SwCache::Insert( SwCacheObj *pNew )
 {
 pObj->GetNext()->SetPrev( pObj->GetPrev() );
 }
-delete pObj;
-m_aCacheObjects[nPos] = pNew;
+m_aCacheObjects[nPos].reset(pNew);
 }
 pNew->SetCachePos( nPos );
 
diff --git a/sw/source/core/inc/swcache.hxx b/sw/source/core/inc/swcache.hxx
index 2744b9f2f318..aa0e4188d608 100644
--- a/sw/source/core/inc/swcache.hxx
+++ b/sw/source/core/inc/swcache.hxx
@@ -43,16 +43,16 @@
  * when destroying them.
  */
 
+#include 
 #include 
 
 #include 
 
 class SwCacheObj;
 
-typedef std::vector SwCacheObjArr;
 class SwCache
 {
-SwCacheObjArr m_aCacheObjects;
+std::vector> m_aCacheObjects;
 std::vector m_aFreePositions; /// Free positions for the 
Insert if the maximum has not been reached
 /// Every time an object is 
deregistered, its position is added here
 SwCacheObj *m_pRealFirst; /// _ALWAYS_ the real first LRU
@@ -112,7 +112,7 @@ public:
 sal_uInt16 GetCurMax() const { return m_nCurMax; }
 SwCacheObj *First() { return m_pRealFirst; }
 static inline SwCacheObj *Next( SwCacheObj *pCacheObj);
-SwCacheObj* operator[](sal_uInt16 nIndex) { return 
m_aCacheObjects[nIndex]; }
+SwCacheObj* 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source starmath/inc starmath/source

2018-11-09 Thread Libreoffice Gerrit user
 sc/inc/funcdesc.hxx   |1 
 sc/source/core/data/funcdesc.cxx  |   29 +---
 sc/source/filter/excel/xepivotxml.cxx |   24 +++
 sc/source/filter/inc/xepivotxml.hxx   |3 
 sc/source/ui/drawfunc/fupoor.cxx  |   11 ---
 sc/source/ui/inc/anyrefdg.hxx |4 -
 sc/source/ui/inc/fupoor.hxx   |1 
 sc/source/ui/inc/inscodlg.hxx |1 
 sc/source/ui/miscdlgs/anyrefdg.cxx|   13 
 sc/source/ui/miscdlgs/inscodlg.cxx|6 -
 starmath/inc/dialog.hxx   |2 
 starmath/source/dialog.cxx|  110 --
 12 files changed, 72 insertions(+), 133 deletions(-)

New commits:
commit d5acb9a30fcb3b9c799bb68d9ca400c89a655724
Author: Noel Grandin 
AuthorDate: Wed Oct 31 09:36:49 2018 +0200
Commit: Noel Grandin 
CommitDate: Fri Nov 9 12:27:48 2018 +0100

loplugin:useuniqueptr in SmDistanceDialog

Change-Id: Ib5bda0c8cdd0e86ce27a56bfb1b86bc78d93a56f
Reviewed-on: https://gerrit.libreoffice.org/63129
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/starmath/inc/dialog.hxx b/starmath/inc/dialog.hxx
index 4bcd3d99b395..2e2300a9aa64 100644
--- a/starmath/inc/dialog.hxx
+++ b/starmath/inc/dialog.hxx
@@ -201,7 +201,7 @@ class SmDistanceDialog : public 
weld::GenericDialogController
 
 weld::Widget* m_pCurrentImage;
 
-SmCategoryDesc *Categories[NOCATEGORIES];
+std::unique_ptr m_xCategories[NOCATEGORIES];
 sal_uInt16  nActiveCategory;
 boolbScaleAllBrackets;
 
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx
index 5519ef39b1ac..61f3edeaf885 100644
--- a/starmath/source/dialog.cxx
+++ b/starmath/source/dialog.cxx
@@ -594,7 +594,7 @@ SmCategoryDesc::~SmCategoryDesc()
 
 IMPL_LINK( SmDistanceDialog, GetFocusHdl, weld::Widget&, rControl, void )
 {
-if (Categories[nActiveCategory])
+if (m_xCategories[nActiveCategory])
 {
 sal_uInt16  i;
 
@@ -610,7 +610,7 @@ IMPL_LINK( SmDistanceDialog, GetFocusHdl, weld::Widget&, 
rControl, void )
 return;
 if (m_pCurrentImage)
 m_pCurrentImage->hide();
-m_pCurrentImage = Categories[nActiveCategory]->GetGraphic(i);
+m_pCurrentImage = m_xCategories[nActiveCategory]->GetGraphic(i);
 m_pCurrentImage->show();
 }
 }
@@ -679,7 +679,7 @@ void SmDistanceDialog::SetCategory(sal_uInt16 nCategory)
 // before switching to the new one
 if (nActiveCategory != CATEGORY_NONE)
 {
-pCat = Categories[nActiveCategory];
+pCat = m_xCategories[nActiveCategory].get();
 pCat->SetValue(0, 
sal::static_int_cast(m_xMetricField1->get_value(FieldUnit::NONE)));
 pCat->SetValue(1, 
sal::static_int_cast(m_xMetricField2->get_value(FieldUnit::NONE)));
 pCat->SetValue(2, 
sal::static_int_cast(m_xMetricField3->get_value(FieldUnit::NONE)));
@@ -725,7 +725,7 @@ void SmDistanceDialog::SetCategory(sal_uInt16 nCategory)
 
 if (bActive)
 {
-pCat = Categories[nCategory];
+pCat = m_xCategories[nCategory].get();
 pFT->set_label(pCat->GetString(i));
 
 pMF->set_range(pCat->GetMinimum(i), pCat->GetMaximum(i), 
FieldUnit::NONE);
@@ -748,7 +748,7 @@ void SmDistanceDialog::SetCategory(sal_uInt16 nCategory)
 }
 
 m_xMenuButton->set_item_active("menuitem" + OString::number(nCategory + 
1), true);
-m_xFrame->set_label(Categories[nCategory]->GetName());
+m_xFrame->set_label(m_xCategories[nCategory]->GetName());
 
 nActiveCategory = nCategory;
 
@@ -773,7 +773,7 @@ SmDistanceDialog::SmDistanceDialog(weld::Window *pParent)
 , m_pCurrentImage(m_xBitmap.get())
 {
 for (sal_uInt16 i = 0; i < NOCATEGORIES; ++i)
-Categories[i] = new SmCategoryDesc(*m_xBuilder, i);
+m_xCategories[i].reset( new SmCategoryDesc(*m_xBuilder, i) );
 nActiveCategory   = CATEGORY_NONE;
 bScaleAllBrackets = false;
 
@@ -791,36 +791,34 @@ SmDistanceDialog::SmDistanceDialog(weld::Window *pParent)
 
 SmDistanceDialog::~SmDistanceDialog()
 {
-for (SmCategoryDesc* & rpDesc : Categories)
-DELETEZ(rpDesc);
 }
 
 void SmDistanceDialog::ReadFrom(const SmFormat )
 {
-Categories[0]->SetValue(0, rFormat.GetDistance(DIS_HORIZONTAL));
-Categories[0]->SetValue(1, rFormat.GetDistance(DIS_VERTICAL));
-Categories[0]->SetValue(2, rFormat.GetDistance(DIS_ROOT));
-Categories[1]->SetValue(0, rFormat.GetDistance(DIS_SUPERSCRIPT));
-Categories[1]->SetValue(1, rFormat.GetDistance(DIS_SUBSCRIPT));
-Categories[2]->SetValue(0, rFormat.GetDistance(DIS_NUMERATOR));
-Categories[2]->SetValue(1, rFormat.GetDistance(DIS_DENOMINATOR));
-Categories[3]->SetValue(0, rFormat.GetDistance(DIS_FRACTION));
-Categories[3]->SetValue(1, rFormat.GetDistance(DIS_STROKEWIDTH));
-Categories[4]->SetValue(0, rFormat.GetDistance(DIS_UPPERLIMIT));
-Categories[4]->SetValue(1, rFormat.GetDistance(DIS_LOWERLIMIT));
-

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source sd/source

2018-10-04 Thread Libreoffice Gerrit user
 sc/inc/dptabres.hxx |   13 +++--
 sc/source/core/data/column.cxx  |   19 +--
 sc/source/core/data/column4.cxx |1 +
 sc/source/core/data/dptabres.cxx|   22 ++
 sd/source/filter/eppt/pptx-text.cxx |   15 ---
 5 files changed, 23 insertions(+), 47 deletions(-)

New commits:
commit 96a032743339f31513fd8dc9191acffcc636
Author: Noel Grandin 
AuthorDate: Wed Oct 3 15:23:13 2018 +0200
Commit: Noel Grandin 
CommitDate: Thu Oct 4 08:15:48 2018 +0200

reserve space before appending to vector in a loop

Change-Id: Ib0017fc2a57ab90596aa494934c9579cae4bf4aa
Reviewed-on: https://gerrit.libreoffice.org/61301
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index a63cc1193254..2617a72b115b 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -3345,11 +3345,10 @@ namespace {
 class TransferListenersHandler
 {
 public:
-typedef std::vector ListenersType;
 struct Entry
 {
 size_t mnRow;
-ListenersType maListeners;
+std::vector maListeners;
 };
 typedef std::vector ListenerListType;
 
@@ -3362,22 +3361,14 @@ public:
 {
 assert(pBroadcaster);
 
-// It's important to make a copy here.
-SvtBroadcaster::ListenersType aLis = pBroadcaster->GetAllListeners();
-if (aLis.empty())
+// It's important to make a copy of the broadcasters listener list here
+Entry aEntry { nRow, pBroadcaster->GetAllListeners() };
+if (aEntry.maListeners.empty())
 // No listeners to transfer.
 return;
 
-Entry aEntry;
-aEntry.mnRow = nRow;
-
-SvtBroadcaster::ListenersType::iterator it = aLis.begin(), itEnd = 
aLis.end();
-for (; it != itEnd; ++it)
-{
-SvtListener* pLis = *it;
+for (SvtListener* pLis : aEntry.maListeners)
 pLis->EndListening(*pBroadcaster);
-aEntry.maListeners.push_back(pLis);
-}
 
 maListenerList.push_back(aEntry);
 
diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index 608cef4609e2..3fac1ea00947 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -1226,6 +1226,7 @@ public:
 void operator() ( size_t /*nRow*/, SvtBroadcaster* p )
 {
 SvtBroadcaster::ListenersType& rLis = p->GetAllListeners();
+mrListeners.reserve(mrListeners.size() + rLis.size());
 std::copy(rLis.begin(), rLis.end(), std::back_inserter(mrListeners));
 }
 };
commit 5c7de51f908e866cdab7dbf4aa22aa48f42dc153
Author: Noel Grandin 
AuthorDate: Tue Oct 2 10:55:46 2018 +0200
Commit: Noel Grandin 
CommitDate: Thu Oct 4 08:15:37 2018 +0200

loplugin:useuniqueptr in ResultMembers

no need to store a small structure separately on the heap

Change-Id: I054ca078242225d12cf8abc86e25813586e6495f
Reviewed-on: https://gerrit.libreoffice.org/61299
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/inc/dptabres.hxx b/sc/inc/dptabres.hxx
index 276392fbe6be..990fbe8172e8 100644
--- a/sc/inc/dptabres.hxx
+++ b/sc/inc/dptabres.hxx
@@ -218,11 +218,6 @@ class ScDPDataMember;
 #define SC_DPMEASURE_ALL-1
 #define SC_DPMEASURE_ANY-2
 
-struct MemberHashIndexFunc
-{
-size_t operator() (SCROW rDataIndex) const { return rDataIndex; }
-};
-
 struct ScDPParentDimData
 {
 const SCROW mnOrder;//! Ref
@@ -234,15 +229,13 @@ struct ScDPParentDimData
 ScDPParentDimData(SCROW nIndex, const ScDPDimension* pDim, const 
ScDPLevel* pLev, const ScDPMember* pMember);
 };
 
-typedef std::unordered_map < SCROW, ScDPParentDimData *, MemberHashIndexFunc>  
DimMemberHash;
-
 class ResultMembers final
 {
-DimMemberHash  maMemberHash;
+std::unordered_map maMemberHash;
 bool mbHasHideDetailsMember;
 public:
-ScDPParentDimData* FindMember( SCROW nIndex ) const;
-void InsertMember(  ScDPParentDimData* pNew );
+const ScDPParentDimData* FindMember( SCROW nIndex ) const;
+void InsertMember( ScDPParentDimData const & rNew );
 bool IsHasHideDetailsMembers() const { return mbHasHideDetailsMember; }
 void SetHasHideDetailsMembers( bool b ) { mbHasHideDetailsMember = b; }
 ResultMembers();
diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx
index e5bef46c3256..7b9e9aa9c792 100644
--- a/sc/source/core/data/dptabres.cxx
+++ b/sc/source/core/data/dptabres.cxx
@@ -929,8 +929,8 @@ ResultMembers& ScDPResultData::GetDimResultMembers(long 
nDim, const ScDPDimensio
 ScDPMember* pMember = pMembers->getByIndex(nSorted);
 if (!pResultMembers->FindMember(pMember->GetItemDataId()))
 {
-ScDPParentDimData* pNew = new ScDPParentDimData(i, pDim, pLevel, 
pMember);
-   

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source sw/inc sw/source

2018-09-28 Thread Libreoffice Gerrit user
 sc/inc/chartpos.hxx |   20 ++--
 sc/source/core/tool/chartpos.cxx|  133 
 sw/inc/IDocumentListsAccess.hxx |1 
 sw/source/core/doc/DocumentListsManager.cxx |   46 +
 sw/source/core/inc/DocumentListsManager.hxx |7 -
 5 files changed, 60 insertions(+), 147 deletions(-)

New commits:
commit 12c953fa25cc6c1e56eff6429f73cac8e870a58e
Author: Noel Grandin 
AuthorDate: Wed Sep 26 13:56:59 2018 +0200
Commit: Noel Grandin 
CommitDate: Fri Sep 28 09:04:16 2018 +0200

loplugin:useuniqueptr in DocumentListsManager

Change-Id: Id179245161d707e27e009b6ebc53d925aae5ce0f
Reviewed-on: https://gerrit.libreoffice.org/61000
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sw/inc/IDocumentListsAccess.hxx b/sw/inc/IDocumentListsAccess.hxx
index a6bf287b8ccd..ada66af3b574 100644
--- a/sw/inc/IDocumentListsAccess.hxx
+++ b/sw/inc/IDocumentListsAccess.hxx
@@ -31,7 +31,6 @@ class IDocumentListsAccess
 public:
 virtual SwList* createList( const OUString& rListId,
 const OUString& rDefaultListStyleName ) = 
0;
-virtual void deleteList( const OUString& rListId ) = 0;
 virtual SwList* getListByName( const OUString& rListId ) const = 0;
 
 virtual void createListForListStyle( const OUString& rListStyleName ) 
= 0;
diff --git a/sw/source/core/doc/DocumentListsManager.cxx 
b/sw/source/core/doc/DocumentListsManager.cxx
index 1fedbff2cc45..df335c2d6d9e 100644
--- a/sw/source/core/doc/DocumentListsManager.cxx
+++ b/sw/source/core/doc/DocumentListsManager.cxx
@@ -56,30 +56,19 @@ SwList* DocumentListsManager::createList( const OUString& 
rListId,
 }
 
 SwList* pNewList = new SwList( sListId, *pDefaultNumRuleForNewList, 
m_rDoc.GetNodes() );
-maLists[sListId] = pNewList;
+maLists[sListId].reset(pNewList);
 
 return pNewList;
 }
 
-void DocumentListsManager::deleteList( const OUString& sListId )
-{
-SwList* pList = getListByName( sListId );
-if ( pList )
-{
-maLists.erase( sListId );
-delete pList;
-}
-}
-
 SwList* DocumentListsManager::getListByName( const OUString& sListId ) const
 {
 SwList* pList = nullptr;
 
-std::unordered_map< OUString, SwList* >::const_iterator
-aListIter = maLists.find( sListId 
);
+auto aListIter = maLists.find( sListId );
 if ( aListIter != maLists.end() )
 {
-pList = (*aListIter).second;
+pList = (*aListIter).second.get();
 }
 
 return pList;
@@ -145,28 +134,21 @@ void DocumentListsManager::deleteListForListStyle( const 
OUString& sListStyleNam
 if ( !sListId.isEmpty() )
 {
 maListStyleLists.erase( sListStyleName );
-deleteList( sListId );
+maLists.erase( sListId );
 }
 }
 
 void DocumentListsManager::deleteListsByDefaultListStyle( const OUString& 
rListStyleName )
 {
-std::vector< SwList* > aListsForDeletion;
-tHashMapForLists::iterator aListIter = maLists.begin();
+auto aListIter = maLists.begin();
 while ( aListIter != maLists.end() )
 {
-SwList* pList = (*aListIter).second;
-if ( pList->GetDefaultListStyleName() == rListStyleName )
+if ( (*aListIter).second->GetDefaultListStyleName() == rListStyleName )
 {
-aListsForDeletion.push_back( pList );
+aListIter = maLists.erase(aListIter);
 }
-++aListIter;
-}
-while ( !aListsForDeletion.empty() )
-{
-SwList* pList = aListsForDeletion.back();
-aListsForDeletion.pop_back();
-deleteList( pList->GetListId() );
+else
+++aListIter;
 }
 }
 
@@ -194,16 +176,6 @@ void DocumentListsManager::trackChangeOfListStyleName( 
const OUString& sListStyl
 
 DocumentListsManager::~DocumentListsManager()
 {
-for ( std::unordered_map< OUString, SwList* >::iterator
-   aListIter = maLists.begin();
-aListIter != maLists.end();
-++aListIter )
-{
- delete (*aListIter).second;
-}
-maLists.clear();
-
-maListStyleLists.clear();
 }
 
 
diff --git a/sw/source/core/inc/DocumentListsManager.hxx 
b/sw/source/core/inc/DocumentListsManager.hxx
index dc6bdc2a5a88..ab02ab41fe8d 100644
--- a/sw/source/core/inc/DocumentListsManager.hxx
+++ b/sw/source/core/inc/DocumentListsManager.hxx
@@ -21,6 +21,7 @@
 #define INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTLISTSMANAGER_HXX
 
 #include 
+#include 
 #include 
 
 class SwList;
@@ -38,7 +39,6 @@ class DocumentListsManager : public IDocumentListsAccess
 
 SwList* createList( const OUString& rListId,
 const OUString& rDefaultListStyleName ) 
override;
-void deleteList( const OUString& rListId ) override;
 SwList* getListByName( const OUString& rListId ) const override;
 
 void createListForListStyle( 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source sw/source

2018-09-12 Thread Libreoffice Gerrit user
 sc/inc/document.hxx   |2 +-
 sc/source/core/data/document.cxx  |2 +-
 sc/source/core/tool/interpr4.cxx  |   29 ++---
 sw/source/core/access/accpara.cxx |6 ++
 4 files changed, 10 insertions(+), 29 deletions(-)

New commits:
commit 9b7ee5a05524b3c80258be6a0f6c5b496942d1f2
Author: Noel Grandin 
AuthorDate: Tue Sep 11 15:53:16 2018 +0200
Commit: Noel Grandin 
CommitDate: Wed Sep 12 09:05:31 2018 +0200

loplugin:useuniqueptr in SwAccessibleParagraph::_getRunAttributesImpl

Change-Id: I6196d15ea4d83625c7f058ecf074a860e8ca6fe9
Reviewed-on: https://gerrit.libreoffice.org/60355
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sw/source/core/access/accpara.cxx 
b/sw/source/core/access/accpara.cxx
index bdd27f7ad03b..2e234a31d1fd 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -1875,7 +1875,7 @@ void SwAccessibleParagraph::_getRunAttributesImpl(
 tAccParaPropValMap& rRunAttrSeq )
 {
 // create PaM for character at position 
-SwPaM* pPaM( nullptr );
+std::unique_ptr pPaM;
 {
 const SwTextNode* pTextNode( GetTextNode() );
 std::unique_ptr pStartPos( new SwPosition( *pTextNode ) );
@@ -1883,7 +1883,7 @@ void SwAccessibleParagraph::_getRunAttributesImpl(
 std::unique_ptr pEndPos( new SwPosition( *pTextNode ) );
 pEndPos->nContent.Assign( const_cast(pTextNode), nIndex+1 
);
 
-pPaM = new SwPaM( *pStartPos, *pEndPos );
+pPaM.reset(new SwPaM( *pStartPos, *pEndPos ));
 }
 
 // retrieve character attributes for the created PaM 
@@ -1972,8 +1972,6 @@ void SwAccessibleParagraph::_getRunAttributesImpl(
 }
 }
 }
-
-delete pPaM;
 }
 
 uno::Sequence< PropertyValue > SwAccessibleParagraph::getRunAttributes(
commit ab974915f96c907e9270423adf332ab7910466c4
Author: Noel Grandin 
AuthorDate: Tue Sep 11 15:39:30 2018 +0200
Commit: Noel Grandin 
CommitDate: Wed Sep 12 09:05:21 2018 +0200

loplugin:useuniqueptr in ScInterpreter

the ScInterpreterTableOpParams are allocated and deleted in the same
method, so the vector in ScDocument doesn't actually need to own them

Change-Id: Icd5a33c891e608abc0843c144d7a53f44c3ac02f
Reviewed-on: https://gerrit.libreoffice.org/60354
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 1bb1f65aab3c..931188800862 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -427,7 +427,7 @@ private:
 mxVbaEvents;
 public:
 /// list of ScInterpreterTableOpParams currently in use
-std::vector> m_TableOpList;
+std::vector m_TableOpList;
 ScInterpreterTableOpParams  aLastTableOpParams; // remember last params
 
 private:
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 59c821e4764a..6b6723921fae 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3920,7 +3920,7 @@ void ScDocument::AddTableOpFormulaCell( ScFormulaCell* 
pCell )
 {
 if (!m_TableOpList.empty())
 {
-ScInterpreterTableOpParams *const p = m_TableOpList.back().get();
+ScInterpreterTableOpParams *const p = m_TableOpList.back();
 if ( p->bCollectNotifications )
 {
 if ( p->bRefresh )
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 7f5b5a81d490..4b5ff2281bfa 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -92,7 +92,7 @@ void ScInterpreter::ReplaceCell( ScAddress& rPos )
 size_t ListSize = pDok->m_TableOpList.size();
 for ( size_t i = 0; i < ListSize; ++i )
 {
-ScInterpreterTableOpParams *const pTOp = pDok->m_TableOpList[ i 
].get();
+ScInterpreterTableOpParams *const pTOp = pDok->m_TableOpList[ i ];
 if ( rPos == pTOp->aOld1 )
 {
 rPos = pTOp->aNew1;
@@ -115,7 +115,7 @@ bool ScInterpreter::IsTableOpInRange( const ScRange& rRange 
)
 size_t ListSize = pDok->m_TableOpList.size();
 for ( size_t i = 0; i < ListSize; ++i )
 {
-ScInterpreterTableOpParams *const pTOp = pDok->m_TableOpList[ i 
].get();
+ScInterpreterTableOpParams *const pTOp = pDok->m_TableOpList[ i ];
 if ( rRange.In( pTOp->aOld1 ) )
 return true;
 if ( rRange.In( pTOp->aOld2 ) )
@@ -3533,21 +3533,6 @@ bool ScInterpreter::SetSbxVariable( SbxVariable* pVar, 
const ScAddress& rPos )
 
 #endif
 
-namespace {
-
-class FindByPointer
-{
-const ScInterpreterTableOpParams* mpTableOp;
-public:
-explicit FindByPointer(const ScInterpreterTableOpParams* p) : mpTableOp(p) 
{}
-bool operator() (std::unique_ptr const& val) 
const
-{
-return val.get() == mpTableOp;
-}
-};
-
-}
-
 void ScInterpreter::ScTableOp()
 {
 sal_uInt8 nParamCount = GetByte();
@@ -3556,7 +3541,7 @@ void 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source sw/source

2018-08-16 Thread Libreoffice Gerrit user
 sc/inc/tokenuno.hxx |2 +-
 sc/source/filter/oox/defnamesbuffer.cxx |2 +-
 sc/source/ui/unoobj/cellsuno.cxx|2 +-
 sc/source/ui/unoobj/nameuno.cxx |2 +-
 sc/source/ui/unoobj/tokenuno.cxx|6 ++
 sw/source/uibase/inc/wrtsh.hxx  |6 +++---
 sw/source/uibase/index/toxmgr.cxx   |3 ++-
 sw/source/uibase/wrtsh/wrtsh2.cxx   |4 +---
 sw/source/uibase/wrtsh/wrtsh4.cxx   |   10 --
 9 files changed, 16 insertions(+), 21 deletions(-)

New commits:
commit 0025cb72f2b6b19d63fb1393df910845f255a6d0
Author: Noel Grandin 
AuthorDate: Tue Aug 14 17:33:40 2018 +0200
Commit: Noel Grandin 
CommitDate: Thu Aug 16 08:54:52 2018 +0200

loplugin:returnconstant in SwWrtShell

Change-Id: I1f810108a3c79f4d8b7df6ef1ad755a29dbc62b6
Reviewed-on: https://gerrit.libreoffice.org/59127
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx
index 797bd3e525da..95877cbfe9d9 100644
--- a/sw/source/uibase/inc/wrtsh.hxx
+++ b/sw/source/uibase/inc/wrtsh.hxx
@@ -310,7 +310,7 @@ typedef bool (SwWrtShell:: *FNSimpleMove)();
 
 // indexes
 voidInsertTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet = 
nullptr);
-boolUpdateTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet = 
nullptr);
+voidUpdateTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet = 
nullptr);
 
 // numbering and bullets
 /**
@@ -539,8 +539,8 @@ private:
 SAL_DLLPRIVATE bool  PopCursor(bool bUpdate, bool bSelect = false);
 
 // take END cursor along when PageUp / -Down
-SAL_DLLPRIVATE bool SttWrd();
-SAL_DLLPRIVATE bool EndWrd();
+SAL_DLLPRIVATE void SttWrd();
+SAL_DLLPRIVATE void EndWrd();
 SAL_DLLPRIVATE bool NxtWrd_();
 SAL_DLLPRIVATE bool PrvWrd_();
 // #i92468#
diff --git a/sw/source/uibase/index/toxmgr.cxx 
b/sw/source/uibase/index/toxmgr.cxx
index b5b8b31e9198..d1b78368a7c3 100644
--- a/sw/source/uibase/index/toxmgr.cxx
+++ b/sw/source/uibase/index/toxmgr.cxx
@@ -443,7 +443,8 @@ bool SwTOXMgr::UpdateOrInsertTOX(const SwTOXDescription& 
rDesc,
 pDoc->ChgTOX(*pTOX, *pNewTOX);
 
 pTOX->DisableKeepExpression();
-bRet = pSh->UpdateTableOf(*pTOX, pSet);
+pSh->UpdateTableOf(*pTOX, pSet);
+bRet = false;
 pTOX->EnableKeepExpression();
 
 if (pDoc->GetIDocumentUndoRedo().DoesUndo())
diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx 
b/sw/source/uibase/wrtsh/wrtsh2.cxx
index 1dfaa712ecfe..a00686c468da 100644
--- a/sw/source/uibase/wrtsh/wrtsh2.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh2.cxx
@@ -318,7 +318,7 @@ void SwWrtShell::InsertTableOf(const SwTOXBase& rTOX, const 
SfxItemSet* pSet)
 
 // Update directory - remove selection
 
-bool SwWrtShell::UpdateTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet)
+void SwWrtShell::UpdateTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet)
 {
 if(CanInsert())
 {
@@ -333,8 +333,6 @@ bool SwWrtShell::UpdateTableOf(const SwTOXBase& rTOX, const 
SfxItemSet* pSet)
 }
 }
 }
-
-return false;
 }
 
 // handler for click on the field given as parameter.
diff --git a/sw/source/uibase/wrtsh/wrtsh4.cxx 
b/sw/source/uibase/wrtsh/wrtsh4.cxx
index cabec2f89244..8009ce98037b 100644
--- a/sw/source/uibase/wrtsh/wrtsh4.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh4.cxx
@@ -27,10 +27,10 @@
 // non-sentence separators on sentence separator.
 // The begin of paragraph is also the word beginning.
 
-bool SwWrtShell::SttWrd()
+void SwWrtShell::SttWrd()
 {
 if ( IsSttPara() )
-return true;
+return;
 // Create temporary cursor without selection.
 Push();
 ClearMark();
@@ -40,7 +40,6 @@ bool SwWrtShell::SttWrd()
 ClearMark();
 // If Mark was previously set, summarize.
 Combine();
-return true;
 }
 
 // The end of a word is the follow of separator to nonseparator.
@@ -48,10 +47,10 @@ bool SwWrtShell::SttWrd()
 // punctuation marks.
 // The end of a paragraph is also the end of a word.
 
-bool SwWrtShell::EndWrd()
+void SwWrtShell::EndWrd()
 {
 if ( IsEndWrd() )
-return true;
+return;
 // Create temporary cursor without selection.
 Push();
 ClearMark();
@@ -61,7 +60,6 @@ bool SwWrtShell::EndWrd()
 ClearMark();
 // If Mark was previously set, summarize.
 Combine();
-return true;
 }
 
 bool SwWrtShell::NxtWrd_()
commit c5ff0696bddc6fdcdc92d7585c70e2b5e202d11b
Author: Noel Grandin 
AuthorDate: Tue Aug 14 17:14:18 2018 +0200
Commit: Noel Grandin 
CommitDate: Thu Aug 16 08:54:42 2018 +0200

loplugin:returnconstant in ScTokenConversion

Change-Id: I17d8d188cb4a51978af41788ee3adf9d221c8bdb
Reviewed-on: https://gerrit.libreoffice.org/59126
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/inc/tokenuno.hxx b/sc/inc/tokenuno.hxx
index 2eab2a816f02..4946c5b8a536 100644

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2018-08-15 Thread Libreoffice Gerrit user
 sc/inc/chgtrack.hxx  |   28 ++--
 sc/inc/detfunc.hxx   |4 +-
 sc/source/core/tool/chgtrack.cxx |   53 ---
 sc/source/core/tool/detfunc.cxx  |   22 
 4 files changed, 33 insertions(+), 74 deletions(-)

New commits:
commit d5f9675c2dba0c2e8993078946ee669e1d61b086
Author: Noel Grandin 
AuthorDate: Mon Aug 13 09:55:51 2018 +0200
Commit: Noel Grandin 
CommitDate: Wed Aug 15 08:37:15 2018 +0200

loplugin:returnconstant in ScDetectiveFunc

Change-Id: Id6eef7772b32a93d43d0417c5b6e24d9189c4e73
Reviewed-on: https://gerrit.libreoffice.org/58955
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/inc/detfunc.hxx b/sc/inc/detfunc.hxx
index a91871560445..e0afe1ce8eb0 100644
--- a/sc/inc/detfunc.hxx
+++ b/sc/inc/detfunc.hxx
@@ -80,12 +80,12 @@ class SC_DLLPUBLIC ScDetectiveFunc
 boolHasError( const ScRange& rRange, ScAddress& rErrPos );
 
 /// called from DrawEntry/DrawAlienEntry and InsertObject
-boolInsertArrow( SCCOL nCol, SCROW nRow,
+voidInsertArrow( SCCOL nCol, SCROW nRow,
 SCCOL nRefStartCol, SCROW nRefStartRow,
 SCCOL nRefEndCol, SCROW nRefEndRow,
 bool bFromOtherTab, bool bRed,
 ScDetectiveData& rData );
-boolInsertToOtherTab( SCCOL nStartCol, SCROW nStartRow,
+voidInsertToOtherTab( SCCOL nStartCol, SCROW nStartRow,
 SCCOL nEndCol, SCROW nEndRow, bool bRed,
 ScDetectiveData& rData );
 
diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx
index a356ee396c09..c45e0e4a13ab 100644
--- a/sc/source/core/tool/detfunc.cxx
+++ b/sc/source/core/tool/detfunc.cxx
@@ -438,7 +438,7 @@ bool ScDetectiveFunc::IsNonAlienArrow( const SdrObject* 
pObject )
 
 //  InsertXXX: called from DrawEntry/DrawAlienEntry and InsertObject
 
-bool ScDetectiveFunc::InsertArrow( SCCOL nCol, SCROW nRow,
+void ScDetectiveFunc::InsertArrow( SCCOL nCol, SCROW nRow,
 SCCOL nRefStartCol, SCROW nRefStartRow,
 SCCOL nRefEndCol, SCROW nRefEndRow,
 bool bFromOtherTab, bool bRed,
@@ -517,10 +517,9 @@ bool ScDetectiveFunc::InsertArrow( SCCOL nCol, SCROW nRow,
 pData->meType = ScDrawObjData::DetectiveArrow;
 
 Modified();
-return true;
 }
 
-bool ScDetectiveFunc::InsertToOtherTab( SCCOL nStartCol, SCROW nStartRow,
+void ScDetectiveFunc::InsertToOtherTab( SCCOL nStartCol, SCROW nStartRow,
 SCCOL nEndCol, SCROW nEndRow, bool bRed,
 ScDetectiveData& rData )
 {
@@ -583,7 +582,6 @@ bool ScDetectiveFunc::InsertToOtherTab( SCCOL nStartCol, 
SCROW nStartRow,
 pData->maEnd.SetInvalid();
 
 Modified();
-return true;
 }
 
 //  DrawEntry:  formula from this spreadsheet,
@@ -604,10 +602,11 @@ bool ScDetectiveFunc::DrawEntry( SCCOL nCol, SCROW nRow,
 bool bError = HasError( rRef, aErrorPos );
 bool bAlien = ( rRef.aEnd.Tab() < nTab || rRef.aStart.Tab() > nTab );
 
-return InsertArrow( nCol, nRow,
-rRef.aStart.Col(), rRef.aStart.Row(),
-rRef.aEnd.Col(), rRef.aEnd.Row(),
-bAlien, bError, rData );
+InsertArrow( nCol, nRow,
+ rRef.aStart.Col(), rRef.aStart.Row(),
+ rRef.aEnd.Col(), rRef.aEnd.Row(),
+ bAlien, bError, rData );
+return true;
 }
 
 bool ScDetectiveFunc::DrawAlienEntry( const ScRange& rRef,
@@ -619,9 +618,10 @@ bool ScDetectiveFunc::DrawAlienEntry( const ScRange& rRef,
 ScAddress aErrorPos;
 bool bError = HasError( rRef, aErrorPos );
 
-return InsertToOtherTab( rRef.aStart.Col(), rRef.aStart.Row(),
-rRef.aEnd.Col(), rRef.aEnd.Row(),
-bError, rData );
+InsertToOtherTab( rRef.aStart.Col(), rRef.aStart.Row(),
+  rRef.aEnd.Col(), rRef.aEnd.Row(),
+  bError, rData );
+return true;
 }
 
 void ScDetectiveFunc::DrawCircle( SCCOL nCol, SCROW nRow, ScDetectiveData& 
rData )
commit 619a6fc90d9682d859e43e5297d32a0f98738c0f
Author: Noel Grandin 
AuthorDate: Tue Aug 14 15:47:41 2018 +0200
Commit: Noel Grandin 
CommitDate: Wed Aug 15 08:37:04 2018 +0200

convert ScChangeActionCellListEntry to std::vector

no need for a linked list where each cell contains a single pointer

Change-Id: I5353b178ddf3c6a69762edc23612995efd81fb41
Reviewed-on: https://gerrit.libreoffice.org/58987
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/inc/chgtrack.hxx b/sc/inc/chgtrack.hxx
index ef7a237645c2..9f554ff9c347 100644
--- a/sc/inc/chgtrack.hxx
+++ b/sc/inc/chgtrack.hxx
@@ 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source sw/inc sw/source

2018-07-24 Thread Libreoffice Gerrit user
 sc/inc/document.hxx|6 +++---
 sc/inc/validat.hxx |8 
 sc/source/core/data/documen2.cxx   |   20 
 sc/source/core/data/documen4.cxx   |8 
 sc/source/core/data/validat.cxx|6 +++---
 sw/inc/modcfg.hxx  |4 ++--
 sw/source/uibase/config/modcfg.cxx |   12 ++--
 7 files changed, 26 insertions(+), 38 deletions(-)

New commits:
commit 257b099bc4d904ebd4fae0ccd668de5ce7570d18
Author: Noel Grandin 
AuthorDate: Mon Jul 23 15:20:38 2018 +0200
Commit: Noel Grandin 
CommitDate: Tue Jul 24 08:35:16 2018 +0200

loplugin:useuniqueptr in SwInsertConfig

Change-Id: I5f39956e529b98f4114139b8c3ba1391e45440ef
Reviewed-on: https://gerrit.libreoffice.org/57876
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sw/inc/modcfg.hxx b/sw/inc/modcfg.hxx
index f4d82aaf2be3..cfdd94814231 100644
--- a/sw/inc/modcfg.hxx
+++ b/sw/inc/modcfg.hxx
@@ -118,8 +118,8 @@ class SwInsertConfig : public utl::ConfigItem
 {
 friend class SwModuleOptions;
 
-InsCaptionOptArr*   pCapOptions;
-InsCaptionOpt*  pOLEMiscOpt;
+std::unique_ptr pCapOptions;
+std::unique_ptrpOLEMiscOpt;
 
 SvGlobalNameaGlobalNames[5];
 
diff --git a/sw/source/uibase/config/modcfg.cxx 
b/sw/source/uibase/config/modcfg.cxx
index 3d73202fdb70..3a0b41f3a1b9 100644
--- a/sw/source/uibase/config/modcfg.cxx
+++ b/sw/source/uibase/config/modcfg.cxx
@@ -77,7 +77,7 @@ const InsCaptionOpt* SwModuleOptions::GetCapOption(
 for( sal_uInt16 nId = 0; nId <= GLOB_NAME_CHART && !bFound; nId++)
 bFound = *pOleId == aInsertConfig.aGlobalNames[nId  ];
 if(!bFound)
-return aInsertConfig.pOLEMiscOpt;
+return aInsertConfig.pOLEMiscOpt.get();
 }
 return aInsertConfig.pCapOptions->Find(eType, pOleId);
 }
@@ -103,7 +103,7 @@ bool SwModuleOptions::SetCapOption(bool bHTML, const 
InsCaptionOpt* pOpt)
 if(aInsertConfig.pOLEMiscOpt)
 *aInsertConfig.pOLEMiscOpt = *pOpt;
 else
-aInsertConfig.pOLEMiscOpt = new InsCaptionOpt(*pOpt);
+aInsertConfig.pOLEMiscOpt.reset(new InsCaptionOpt(*pOpt));
 }
 }
 
@@ -596,15 +596,15 @@ SwInsertConfig::SwInsertConfig(bool bWeb) :
 aGlobalNames[GLOB_NAME_MATH   ] = SvGlobalName(SO3_SM_CLASSID);
 aGlobalNames[GLOB_NAME_CHART  ] = SvGlobalName(SO3_SCH_CLASSID);
 if(!bIsWeb)
-pCapOptions = new InsCaptionOptArr;
+pCapOptions.reset(new InsCaptionOptArr);
 
 Load();
 }
 
 SwInsertConfig::~SwInsertConfig()
 {
-delete pCapOptions;
-delete pOLEMiscOpt;
+pCapOptions.reset();
+pOLEMiscOpt.reset();
 }
 
 static void lcl_WriteOpt(const InsCaptionOpt& rOpt, Any* pValues, sal_Int32 
nProp, sal_Int32 nOffset)
@@ -1072,7 +1072,7 @@ void SwInsertConfig::Load()
 case INS_PROP_CAP_OBJECT_OLEMISC_APPLYATTRIBUTES:
 if(!pOLEMiscOpt)
 {
-pOLEMiscOpt = new InsCaptionOpt(OLE_CAP);
+pOLEMiscOpt.reset(new InsCaptionOpt(OLE_CAP));
 }
 lcl_ReadOpt(*pOLEMiscOpt, pValues, nProp, nProp - 
INS_PROP_CAP_OBJECT_OLEMISC_ENABLE);
 break;
commit 63ba8ffa5c390c04e22a74015a64cefc2bf228ea
Author: Noel Grandin 
AuthorDate: Mon Jul 23 14:22:30 2018 +0200
Commit: Noel Grandin 
CommitDate: Tue Jul 24 08:35:05 2018 +0200

loplugin:useuniqueptr in ScValidationDataList

Change-Id: Icbf8eb814e7d3bd57e78d2d1a97eb44bbfd2a432
Reviewed-on: https://gerrit.libreoffice.org/57874
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 4fcee74748ca..7d34bd38a6a4 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -357,7 +357,7 @@ private:
 VclPtr mpVirtualDevice_100th_mm;
 std::unique_ptr mpDrawLayer;   // SdrModel
 rtl::Reference pColorList;
-ScValidationDataList* pValidationList;  // validity
+std::unique_ptr pValidationList;  // 
validity
 SvNumberFormatterIndexTable* pFormatExchangeList;// for application of 
number formats
 TableContainer maTabs;
 std::vector maTabNames;   // for undo document, we 
need the information tab name <-> index
@@ -1703,8 +1703,8 @@ public:
 
 SC_DLLPUBLIC ScConditionalFormatList*   GetCondFormList( SCTAB nTab ) 
const;
 
-const ScValidationDataList* GetValidationList() const { return 
pValidationList;}
-ScValidationDataList*   GetValidationList() { return 
pValidationList;}
+const ScValidationDataList* GetValidationList() const { return 
pValidationList.get();}
+ScValidationDataList*   GetValidationList() { return 
pValidationList.get();}
 
 SC_DLLPUBLIC 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2018-07-11 Thread Noel Grandin
 sc/inc/docuno.hxx  |4 ++--
 sc/source/ui/inc/printfun.hxx  |4 ++--
 sc/source/ui/unoobj/docuno.cxx |   21 +
 sc/source/ui/view/printfun.cxx |   10 +-
 4 files changed, 18 insertions(+), 21 deletions(-)

New commits:
commit 72eb6f7e47d7c8c19c76cea67330464af47648f1
Author: Noel Grandin 
Date:   Tue Jul 10 13:04:24 2018 +0200

loplugin:useuniqueptr in ScPrintFunc

Change-Id: I135c0a333633bbdc362fb80699c6d009a80b23a5
Reviewed-on: https://gerrit.libreoffice.org/57243
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/source/ui/inc/printfun.hxx b/sc/source/ui/inc/printfun.hxx
index d96fb277b788..f298eeb0db4e 100644
--- a/sc/source/ui/inc/printfun.hxx
+++ b/sc/source/ui/inc/printfun.hxx
@@ -264,8 +264,8 @@ private:
 
 sc::PrintPageRanges m_aRanges;
 
-ScHeaderEditEngine* pEditEngine;
-SfxItemSet* pEditDefaults;
+std::unique_ptr pEditEngine;
+std::unique_ptr pEditDefaults;
 
 ScHeaderFieldData   aFieldData;
 
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index f96fd9b74d28..6087ef2bee21 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -400,8 +400,8 @@ void ScPrintFunc::FillPageData()
 
 ScPrintFunc::~ScPrintFunc()
 {
-delete pEditDefaults;
-delete pEditEngine;
+pEditDefaults.reset();
+pEditEngine.reset();
 
 //  Printer settings are now restored from outside
 
@@ -1704,7 +1704,7 @@ void ScPrintFunc::MakeEditEngine()
 {
 //  can't use document's edit engine pool here,
 //  because pool must have twips as default metric
-pEditEngine = new ScHeaderEditEngine( EditEngine::CreatePool() );
+pEditEngine.reset( new ScHeaderEditEngine( EditEngine::CreatePool() ) 
);
 
 pEditEngine->EnableUndo(false);
 //fdo#45869 we want text to be positioned as it would be for the
@@ -1718,10 +1718,10 @@ void ScPrintFunc::MakeEditEngine()
 pEditEngine->EnableAutoColor( bUseStyleColor );
 
 //  Default-Set for alignment
-pEditDefaults = new SfxItemSet( pEditEngine->GetEmptyItemSet() );
+pEditDefaults.reset( new SfxItemSet( pEditEngine->GetEmptyItemSet() ) 
);
 
 const ScPatternAttr& rPattern = 
pDoc->GetPool()->GetDefaultItem(ATTR_PATTERN);
-rPattern.FillEditItemSet( pEditDefaults );
+rPattern.FillEditItemSet( pEditDefaults.get() );
 //  FillEditItemSet adjusts font height to 1/100th mm,
 //  but for header/footer twips is needed, as in the PatternAttr:
 std::unique_ptr 
pNewItem(rPattern.GetItem(ATTR_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT));
commit 92c2a7e026beaaabf4cd3b8c612c15e9b933a90a
Author: Noel Grandin 
Date:   Tue Jul 10 11:17:50 2018 +0200

loplugin:useuniqueptr in ScModelObj

Change-Id: I12635d4bc59d14134b8eef3e093f3fd4e6a0
Reviewed-on: https://gerrit.libreoffice.org/57242
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index c9a450210ef3..630caed76206 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -93,8 +93,8 @@ class SC_DLLPUBLIC ScModelObj : public SfxBaseModel,
 private:
 SfxItemPropertySet  aPropSet;
 ScDocShell* pDocShell;
-ScPrintFuncCache*   pPrintFuncCache;
-ScPrintUIOptions*   pPrinterOptions;
+std::unique_ptr pPrintFuncCache;
+std::unique_ptr pPrinterOptions;
 std::unique_ptr m_pPrintState;
 css::uno::Reference xNumberAgg;
 css::uno::Reference xDrawGradTab;
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index b910162833ef..06a5d3e122d7 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -410,8 +410,8 @@ ScModelObj::~ScModelObj()
 if (xNumberAgg.is())
 xNumberAgg->setDelegator(uno::Reference());
 
-delete pPrintFuncCache;
-delete pPrinterOptions;
+pPrintFuncCache.reset();
+pPrinterOptions.reset();
 }
 
 uno::Reference< uno::XAggregation> const & ScModelObj::GetFormatter()
@@ -1336,7 +1336,7 @@ void ScModelObj::Notify( SfxBroadcaster& rBC, const 
SfxHint& rHint )
 pNumFmt->SetNumberFormatter( nullptr );
 }
 
-DELETEZ( pPrintFuncCache ); // must be deleted because it has a 
pointer to the DocShell
+pPrintFuncCache.reset(); // must be deleted because it has a 
pointer to the DocShell
 m_pPrintState.reset();
 }
 else if ( nId == SfxHintId::DataChanged )
@@ -1344,7 +1344,7 @@ void ScModelObj::Notify( SfxBroadcaster& rBC, const 
SfxHint& rHint )
 //  cached data for rendering become invalid when contents change
 //  (if a broadcast is added to SetDrawModified, is has to be tested 
here, too)
 
-DELETEZ( pPrintFuncCache );
+pPrintFuncCache.reset();
 m_pPrintState.reset();
 
 // handle "OnCalculate" sheet events (search also for VBA event 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source sw/source

2018-07-03 Thread Noel Grandin
 sc/inc/textuno.hxx  |6 +-
 sc/source/ui/unoobj/textuno.cxx |   16 ++---
 sw/source/core/inc/SwGrammarMarkUp.hxx  |4 -
 sw/source/core/inc/wrong.hxx|   15 +++--
 sw/source/core/text/SwGrammarMarkUp.cxx |   13 ++--
 sw/source/core/text/wrong.cxx   |   77 ++--
 sw/source/core/txtnode/SwGrammarContact.cxx |   20 +++
 7 files changed, 66 insertions(+), 85 deletions(-)

New commits:
commit 3769a6271120e0e856b53f906654bc2c593804fe
Author: Noel Grandin 
Date:   Mon Jul 2 16:56:17 2018 +0200

loplugin:useuniqueptr in ScHeaderFooterTextData

Change-Id: Ia359ee8e9e4876f6bbf86702c476c9f9602295a0
Reviewed-on: https://gerrit.libreoffice.org/56832
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/inc/textuno.hxx b/sc/inc/textuno.hxx
index 0d3919727436..bb90c82f85f4 100644
--- a/sc/inc/textuno.hxx
+++ b/sc/inc/textuno.hxx
@@ -105,8 +105,8 @@ private:
 std::unique_ptr mpTextObj;
 css::uno::WeakReference xContentObj;
 ScHeaderFooterPart  nPart;
-ScEditEngineDefaulter*  pEditEngine;
-SvxEditEngineForwarder* pForwarder;
+std::unique_ptr  pEditEngine;
+std::unique_ptr pForwarder;
 boolbDataValid;
 
 public:
@@ -120,7 +120,7 @@ public:
 SvxTextForwarder*   GetTextForwarder();
 void UpdateData();
 void UpdateData(EditEngine& rEditEngine);
-ScEditEngineDefaulter*  GetEditEngine() { GetTextForwarder(); return 
pEditEngine; }
+ScEditEngineDefaulter*  GetEditEngine() { GetTextForwarder(); return 
pEditEngine.get(); }
 
 ScHeaderFooterPart  GetPart() const { return nPart; }
 const css::uno::Reference 
GetContentObj() const { return xContentObj; }
diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx
index 49fc91b2037a..7d92fd868a67 100644
--- a/sc/source/ui/unoobj/textuno.cxx
+++ b/sc/source/ui/unoobj/textuno.cxx
@@ -187,8 +187,6 @@ ScHeaderFooterTextData::ScHeaderFooterTextData(
 mpTextObj(pTextObj ? pTextObj->Clone() : nullptr),
 xContentObj( xContent ),
 nPart( nP ),
-pEditEngine( nullptr ),
-pForwarder( nullptr ),
 bDataValid(false)
 {
 }
@@ -197,8 +195,8 @@ ScHeaderFooterTextData::~ScHeaderFooterTextData()
 {
 SolarMutexGuard aGuard; //  needed for EditEngine dtor
 
-delete pForwarder;
-delete pEditEngine;
+pForwarder.reset();
+pEditEngine.reset();
 }
 
 SvxTextForwarder* ScHeaderFooterTextData::GetTextForwarder()
@@ -207,7 +205,7 @@ SvxTextForwarder* ScHeaderFooterTextData::GetTextForwarder()
 {
 SfxItemPool* pEnginePool = EditEngine::CreatePool();
 pEnginePool->FreezeIdRanges();
-ScHeaderEditEngine* pHdrEngine = new ScHeaderEditEngine( pEnginePool );
+std::unique_ptr pHdrEngine(new ScHeaderEditEngine( 
pEnginePool ));
 
 pHdrEngine->EnableUndo( false );
 pHdrEngine->SetRefMapMode(MapMode(MapUnit::MapTwip));
@@ -232,18 +230,18 @@ SvxTextForwarder* 
ScHeaderFooterTextData::GetTextForwarder()
 ScHeaderFooterTextObj::FillDummyFieldData( aData );
 pHdrEngine->SetData( aData );
 
-pEditEngine = pHdrEngine;
-pForwarder = new SvxEditEngineForwarder(*pEditEngine);
+pEditEngine = std::move(pHdrEngine);
+pForwarder.reset( new SvxEditEngineForwarder(*pEditEngine) );
 }
 
 if (bDataValid)
-return pForwarder;
+return pForwarder.get();
 
 if (mpTextObj)
 pEditEngine->SetText(*mpTextObj);
 
 bDataValid = true;
-return pForwarder;
+return pForwarder.get();
 }
 
 void ScHeaderFooterTextData::UpdateData()
commit 09d9419bf2072fdab2d7c1d1c6a8dee70b9f0f8a
Author: Noel Grandin 
Date:   Mon Jul 2 15:20:42 2018 +0200

loplugin:useuniqueptr in SwWrongList

and simplify, just use copy constructors and operator=, instead of
special-case CopyFrom methods

Change-Id: I3e14fa08e820cf7ae2c5424ae22ae95516933773
Reviewed-on: https://gerrit.libreoffice.org/56831
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sw/source/core/inc/SwGrammarMarkUp.hxx 
b/sw/source/core/inc/SwGrammarMarkUp.hxx
index f37605556353..94cf6c93a6aa 100644
--- a/sw/source/core/inc/SwGrammarMarkUp.hxx
+++ b/sw/source/core/inc/SwGrammarMarkUp.hxx
@@ -39,10 +39,10 @@ class SwGrammarMarkUp : public SwWrongList
 
 public:
 SwGrammarMarkUp() : SwWrongList( WRONGLIST_GRAMMAR ) {}
+SwGrammarMarkUp(SwGrammarMarkUp const &);
 
 virtual ~SwGrammarMarkUp() override;
-virtual SwWrongList* Clone() override;
-virtual void CopyFrom( const SwWrongList& rCopy ) override;
+virtual std::unique_ptr Clone() override;
 
 /* SwWrongList::Move() + handling of maSentence */
 void MoveGrammar( sal_Int32 nPos, sal_Int32 nDiff );
diff --git a/sw/source/core/inc/wrong.hxx b/sw/source/core/inc/wrong.hxx
index 0003d54266ba..695a33b6219d 100644
--- 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2018-06-28 Thread Noel Grandin
 sc/inc/scmod.hxx |   34 ++--
 sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx |   14 -
 sc/source/ui/app/scmod.cxx   |   87 +--
 sc/source/ui/inc/AccessibleDocumentPagePreview.hxx   |4 
 4 files changed, 67 insertions(+), 72 deletions(-)

New commits:
commit 0bd2c35937b85d7bbe60e6da25a09d4ab0022e98
Author: Noel Grandin 
Date:   Wed Jun 27 11:53:31 2018 +0200

loplugin:useuniqueptr in ScModule

Change-Id: I6433050af217668800c7257433c11bfec37d9634
Reviewed-on: https://gerrit.libreoffice.org/56557
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx
index 8349274645a7..fb9d0ab5c973 100644
--- a/sc/inc/scmod.hxx
+++ b/sc/inc/scmod.hxx
@@ -80,26 +80,26 @@ class ScModule: public SfxModule, public SfxListener, 
public utl::ConfigurationL
 {
 Timer   m_aIdleTimer;
 Idlem_aSpellIdle;
-ScDragData* m_pDragData;
+std::unique_ptr m_pDragData;
 ScSelectionTransferObj* m_pSelTransfer;
 ScMessagePool*  m_pMessagePool;
 // there is no global InputHandler anymore, each View has its own
 ScInputHandler* m_pRefInputHandler;
-ScViewCfg*  m_pViewCfg;
-ScDocCfg*   m_pDocCfg;
-ScAppCfg*   m_pAppCfg;
-ScDefaultsCfg*  m_pDefaultsCfg;
-ScFormulaCfg*   m_pFormulaCfg;
-ScInputCfg* m_pInputCfg;
-ScPrintCfg* m_pPrintCfg;
-ScNavipiCfg*m_pNavipiCfg;
-ScAddInCfg* m_pAddInCfg;
-svtools::ColorConfig*   m_pColorConfig;
-SvtAccessibilityOptions* m_pAccessOptions;
-SvtCTLOptions*  m_pCTLOptions;
-SvtUserOptions* m_pUserOptions;
-SfxErrorHandler*m_pErrorHdl;
-ScFormEditData* m_pFormEditData;
+std::unique_ptrm_pViewCfg;
+std::unique_ptr m_pDocCfg;
+std::unique_ptr m_pAppCfg;
+std::unique_ptrm_pDefaultsCfg;
+std::unique_ptr m_pFormulaCfg;
+std::unique_ptr   m_pInputCfg;
+std::unique_ptr   m_pPrintCfg;
+std::unique_ptr  m_pNavipiCfg;
+std::unique_ptr   m_pAddInCfg;
+std::unique_ptrm_pColorConfig;
+std::unique_ptr m_pAccessOptions;
+std::unique_ptr   m_pCTLOptions;
+std::unique_ptr  m_pUserOptions;
+std::unique_ptr  m_pErrorHdl;
+std::unique_ptr   m_pFormEditData;
 sal_uInt16  m_nCurRefDlgId;
 boolm_bIsWaterCan:1;
 boolm_bIsInEditCommand:1;
@@ -219,7 +219,7 @@ public:
 
 voidInitFormEditData();
 voidClearFormEditData();
-ScFormEditData* GetFormEditData()   { return m_pFormEditData; }
+ScFormEditData* GetFormEditData()   { return 
m_pFormEditData.get(); }
 
 // input of reference:
 SC_DLLPUBLIC void   SetRefDialog( sal_uInt16 nId, bool bVis, SfxViewFrame* 
pViewFrm = nullptr );
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 687ced15ef33..62cea990b760 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -175,10 +175,10 @@ ScModule::ScModule( SfxObjectFactory* pFact ) :
 // Create ErrorHandler - was in Init()
 // Between OfficeApplication::Init and ScGlobal::Init
 SvxErrorHandler::ensure();
-m_pErrorHdl= new SfxErrorHandler(RID_ERRHDLSC,
+m_pErrorHdl.reset( new SfxErrorHandler(RID_ERRHDLSC,
ErrCodeArea::Sc,
ErrCodeArea::Sc,
-   GetResLocale());
+   GetResLocale()) );
 
 m_aSpellIdle.SetInvokeHandler( LINK( this, ScModule, SpellTimerHdl ) );
 
@@ -202,10 +202,10 @@ ScModule::~ScModule()
 
 SfxItemPool::Free(m_pMessagePool);
 
-DELETEZ( m_pFormEditData );
+m_pFormEditData.reset();
 
-delete m_pDragData;
-delete m_pErrorHdl;
+m_pDragData.reset();
+m_pErrorHdl.reset();
 
 ScGlobal::Clear(); // Also calls ScDocumentPool::DeleteVersionMaps();
 
@@ -214,7 +214,7 @@ ScModule::~ScModule()
 
 void ScModule::ConfigurationChanged( utl::ConfigurationBroadcaster* p, 
ConfigurationHints )
 {
-if ( p == m_pColorConfig || p == m_pAccessOptions )
+if ( p == m_pColorConfig.get() || p == m_pAccessOptions.get() )
 {
 // Test if detective objects have to be updated with new colors
 // (if the detective colors haven't been used yet, there's nothing to 
update)
@@ -271,7 +271,7 @@ void ScModule::ConfigurationChanged( 
utl::ConfigurationBroadcaster* p, Configura
 pViewShell = SfxViewShell::GetNext( *pViewShell );
 }
 }
-else if ( p == m_pCTLOptions )
+else if ( p == m_pCTLOptions.get() )
 {
 // for all documents: set digit language for printer, recalc output 
factor, update row heights
 SfxObjectShell* 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source sd/source

2018-06-27 Thread Noel Grandin
 sc/inc/sheetevents.hxx  |4 +++-
 sc/source/core/data/sheetevents.cxx |   30 +++---
 sd/source/filter/eppt/epptso.cxx|2 +-
 sd/source/filter/eppt/pptx-text.cxx |   22 +-
 sd/source/filter/eppt/text.hxx  |4 ++--
 5 files changed, 26 insertions(+), 36 deletions(-)

New commits:
commit 20dfe973a8c1ef0d873aca735711e288734c5cba
Author: Noel Grandin 
Date:   Mon Jun 25 17:08:28 2018 +0200

loplugin:useuniqueptr in PortionObj

Change-Id: I79fcbaa12def04aa36bdf1928638b70ad490448c
Reviewed-on: https://gerrit.libreoffice.org/56494
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx
index 4ebeafe3c48e..69d520e7b742 100644
--- a/sd/source/filter/eppt/epptso.cxx
+++ b/sd/source/filter/eppt/epptso.cxx
@@ -1108,7 +1108,7 @@ void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, 
int nTextInstance, sal_u
 const PortionObj& rPortion = *(*it).get();
 if ( rPortion.mpFieldEntry )
 {
-const FieldEntry* pFieldEntry = rPortion.mpFieldEntry;
+const FieldEntry* pFieldEntry = 
rPortion.mpFieldEntry.get();
 
 switch ( pFieldEntry->nFieldType >> 28 )
 {
diff --git a/sd/source/filter/eppt/pptx-text.cxx 
b/sd/source/filter/eppt/pptx-text.cxx
index 90011a09be3d..00e8c483c327 100644
--- a/sd/source/filter/eppt/pptx-text.cxx
+++ b/sd/source/filter/eppt/pptx-text.cxx
@@ -120,7 +120,7 @@ PortionObj::PortionObj(css::uno::Reference< 
css::text::XTextRange > & rXTextRang
 nFieldType = ImplGetTextField( rXTextRange, mXPropSet, aURL );
 if ( nFieldType )
 {
-mpFieldEntry = new FieldEntry( nFieldType, 0, mnTextSize );
+mpFieldEntry.reset( new FieldEntry( nFieldType, 0, mnTextSize ) );
 if ( nFieldType >> 28 == 4 )
 {
 mpFieldEntry->aRepresentation = aString;
@@ -141,7 +141,7 @@ PortionObj::PortionObj(css::uno::Reference< 
css::text::XTextRange > & rXTextRang
 mnTextSize = 1;
 if ( bLast )
 mnTextSize++;
-mpText = new sal_uInt16[ mnTextSize ];
+mpText.reset( new sal_uInt16[ mnTextSize ] );
 mpText[ 0 ] = 0x2a;
 }
 else
@@ -155,7 +155,7 @@ PortionObj::PortionObj(css::uno::Reference< 
css::text::XTextRange > & rXTextRang
 mnTextSize++;
 bRTL_endingParen = true;
 }
-mpText = new sal_uInt16[ mnTextSize ];
+mpText.reset( new sal_uInt16[ mnTextSize ] );
 sal_uInt16 nChar;
 for ( sal_Int32 i = 0; i < aString.getLength(); i++ )
 {
@@ -261,7 +261,7 @@ void PortionObj::ImplGetPortionValues( FontCollection& 
rFontCollection, bool bGe
 sal_Int16 nScriptType = SvtLanguageOptions::FromSvtScriptTypeToI18N( 
SvtLanguageOptions::GetScriptTypeOfLanguage( 
Application::GetSettings().GetLanguageTag().getLanguageType() ) );
 if ( mpText && mnTextSize && xPPTBreakIter.is() )
 {
-OUString sT( reinterpret_cast(mpText), mnTextSize );
+OUString sT( reinterpret_cast(mpText.get()), mnTextSize 
);
 nScriptType = xPPTBreakIter->getScriptType( sT, 0 );
 }
 if ( nScriptType != css::i18n::ScriptType::COMPLEX )
@@ -440,8 +440,8 @@ void PortionObj::ImplGetPortionValues( FontCollection& 
rFontCollection, bool bGe
 
 void PortionObj::ImplClear()
 {
-delete mpFieldEntry;
-delete[] mpText;
+mpFieldEntry.reset();
+mpText.reset();
 }
 
 void PortionObj::ImplConstruct( const PortionObj& rPortionObj )
@@ -465,16 +465,12 @@ void PortionObj::ImplConstruct( const PortionObj& 
rPortionObj )
 
 if ( rPortionObj.mpText )
 {
-mpText = new sal_uInt16[ mnTextSize ];
-memcpy( mpText, rPortionObj.mpText, mnTextSize << 1 );
+mpText.reset( new sal_uInt16[ mnTextSize ] );
+memcpy( mpText.get(), rPortionObj.mpText.get(), mnTextSize << 1 );
 }
-else
-mpText = nullptr;
 
 if ( rPortionObj.mpFieldEntry )
-mpFieldEntry = new FieldEntry( *( rPortionObj.mpFieldEntry ) );
-else
-mpFieldEntry = nullptr;
+mpFieldEntry.reset( new FieldEntry( *( rPortionObj.mpFieldEntry ) ) );
 }
 
 sal_uInt32 PortionObj::ImplCalculateTextPositions( sal_uInt32 
nCurrentTextPosition )
diff --git a/sd/source/filter/eppt/text.hxx b/sd/source/filter/eppt/text.hxx
index d9e40f2ac91d..0928e9b72dba 100644
--- a/sd/source/filter/eppt/text.hxx
+++ b/sd/source/filter/eppt/text.hxx
@@ -144,8 +144,8 @@ class PortionObj final : public PropStateValue
 sal_uInt32  mnTextSize;
 boolmbLastPortion;
 
-sal_uInt16* mpText;
-FieldEntry* mpFieldEntry;
+std::unique_ptr mpText;
+std::unique_ptr mpFieldEntry;
 
 PortionObj( 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source sd/source

2018-06-21 Thread Noel Grandin
 sc/inc/dpobject.hxx   |   18 +++---
 sc/source/core/data/dpobject.cxx  |   67 +++---
 sd/source/ui/annotations/annotationwindow.cxx |   14 ++---
 sd/source/ui/annotations/annotationwindow.hxx |8 +--
 4 files changed, 49 insertions(+), 58 deletions(-)

New commits:
commit 8ce072a7dcc14750cf50a76a5da49cd84412314c
Author: Noel Grandin 
Date:   Wed Jun 20 17:03:48 2018 +0200

loplugin:useuniqueptr in ScDPObject

Change-Id: I6e1f44d4e59ef15f08692e97ad90c3ffc23cdc8c
Reviewed-on: https://gerrit.libreoffice.org/56200
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx
index 2e02ac88eed8..ee2efd74f00c 100644
--- a/sc/inc/dpobject.hxx
+++ b/sc/inc/dpobject.hxx
@@ -81,17 +81,17 @@ class SC_DLLPUBLIC ScDPObject
 private:
 ScDocument* pDoc;
 // settings
-ScDPSaveData*   pSaveData;
+std::unique_ptr pSaveData;
 OUString aTableName;
 OUString aTableTag;
 ScRange aOutRange;
-ScSheetSourceDesc*  pSheetDesc; //  for sheet data
-ScImportSourceDesc* pImpDesc;   //  for database data
-ScDPServiceDesc*pServDesc;  //  for external service
+std::unique_ptr  pSheetDesc; //  for sheet data
+std::unique_ptr pImpDesc;   //  for database data
+std::unique_ptr pServDesc;  //  for external service
 std::shared_ptr  mpTableData;
 // cached data
 css::uno::Reference xSource;
-ScDPOutput* pOutput;
+std::unique_ptr pOutput;
 longnHeaderRows;// page fields plus filter button
 boolmbHeaderLayout:1;  // true : grid, false : standard
 boolbAllowMove:1;
@@ -129,7 +129,7 @@ public:
 ScRange GetOutputRangeByType( sal_Int32 nType ) const;
 
 voidSetSaveData(const ScDPSaveData& rData);
-ScDPSaveData*   GetSaveData() const { return pSaveData; }
+ScDPSaveData*   GetSaveData() const { return pSaveData.get(); }
 
 voidSetOutRange(const ScRange& rRange);
 const ScRange&  GetOutRange() const;
@@ -144,9 +144,9 @@ public:
 voidWriteSourceDataTo( ScDPObject& rDest ) const;
 voidWriteTempDataTo( ScDPObject& rDest ) const;
 
-const ScSheetSourceDesc* GetSheetDesc() const   { return pSheetDesc; }
-const ScImportSourceDesc* GetImportSourceDesc() const   { return pImpDesc; 
}
-const ScDPServiceDesc* GetDPServiceDesc() const { return pServDesc; }
+const ScSheetSourceDesc* GetSheetDesc() const   { return pSheetDesc.get(); 
}
+const ScImportSourceDesc* GetImportSourceDesc() const   { return 
pImpDesc.get(); }
+const ScDPServiceDesc* GetDPServiceDesc() const { return pServDesc.get(); }
 
 css::uno::Reference const & GetSource();
 
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index eebe2f5f10ac..eaa827e837ac 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -340,13 +340,13 @@ ScDPObject::ScDPObject(const ScDPObject& r) :
 mbEnableGetPivotData(r.mbEnableGetPivotData)
 {
 if (r.pSaveData)
-pSaveData = new ScDPSaveData(*r.pSaveData);
+pSaveData.reset( new ScDPSaveData(*r.pSaveData) );
 if (r.pSheetDesc)
-pSheetDesc = new ScSheetSourceDesc(*r.pSheetDesc);
+pSheetDesc.reset( new ScSheetSourceDesc(*r.pSheetDesc) );
 if (r.pImpDesc)
-pImpDesc = new ScImportSourceDesc(*r.pImpDesc);
+pImpDesc.reset( new ScImportSourceDesc(*r.pImpDesc) );
 if (r.pServDesc)
-pServDesc = new ScDPServiceDesc(*r.pServDesc);
+pServDesc.reset( new ScDPServiceDesc(*r.pServDesc) );
 // xSource (and pOutput) is not copied
 }
 
@@ -370,13 +370,13 @@ ScDPObject& ScDPObject::operator= (const ScDPObject& r)
 mbEnableGetPivotData = r.mbEnableGetPivotData;
 
 if (r.pSaveData)
-pSaveData = new ScDPSaveData(*r.pSaveData);
+pSaveData.reset( new ScDPSaveData(*r.pSaveData) );
 if (r.pSheetDesc)
-pSheetDesc = new ScSheetSourceDesc(*r.pSheetDesc);
+pSheetDesc.reset( new ScSheetSourceDesc(*r.pSheetDesc) );
 if (r.pImpDesc)
-pImpDesc = new ScImportSourceDesc(*r.pImpDesc);
+pImpDesc.reset( new ScImportSourceDesc(*r.pImpDesc) );
 if (r.pServDesc)
-pServDesc = new ScDPServiceDesc(*r.pServDesc);
+pServDesc.reset( new ScDPServiceDesc(*r.pServDesc) );
 
 return *this;
 }
@@ -393,10 +393,9 @@ void ScDPObject::SetAllowMove(bool bSet)
 
 void ScDPObject::SetSaveData(const ScDPSaveData& rData)
 {
-if ( pSaveData !=  )  // API implementation modifies the 
original SaveData object
+if ( pSaveData.get() !=  )  // API implementation modifies the 
original SaveData object
 {
-

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source sc/uiconfig

2018-05-20 Thread Caolán McNamara
 sc/inc/scabstdlg.hxx  |2 
 sc/source/ui/attrdlg/scdlgfact.cxx|   13 +-
 sc/source/ui/attrdlg/scdlgfact.hxx|   13 +-
 sc/source/ui/dbgui/pvfundlg.cxx   |   37 ++
 sc/source/ui/inc/pvfundlg.hxx |   20 +--
 sc/source/ui/optdlg/calcoptionsdlg.cxx|   67 ---
 sc/source/ui/optdlg/calcoptionsdlg.hxx|   38 ++
 sc/source/ui/optdlg/tpformula.cxx |9 -
 sc/source/ui/view/cellsh1.cxx |7 -
 sc/uiconfig/scalc/ui/formulacalculationoptions.ui |  130 +++---
 sc/uiconfig/scalc/ui/showdetaildialog.ui  |   51 +++-
 11 files changed, 200 insertions(+), 187 deletions(-)

New commits:
commit 56c9746f294639583ce5422bf909ad9e4a746f70
Author: Caolán McNamara 
Date:   Sat May 19 20:44:59 2018 +0100

weld ScCalcOptionsDialog

Change-Id: I391e26bd95cb3dc6cfa983502aa960a5c54cc800
Reviewed-on: https://gerrit.libreoffice.org/54580
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx 
b/sc/source/ui/optdlg/calcoptionsdlg.cxx
index 74e7904249d7..e931a180e8bc 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.cxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx
@@ -72,43 +72,32 @@ sal_Int32 toSelectedItem( 
formula::FormulaGrammar::AddressConvention eConv )
 
 }
 
-ScCalcOptionsDialog::ScCalcOptionsDialog(vcl::Window* pParent, const 
ScCalcConfig& rConfig, bool bWriteConfig)
-: ModalDialog(pParent, "FormulaCalculationOptions",
-"modules/scalc/ui/formulacalculationoptions.ui")
+ScCalcOptionsDialog::ScCalcOptionsDialog(weld::Window* pParent, const 
ScCalcConfig& rConfig, bool bWriteConfig)
+: GenericDialogController(pParent, 
"modules/scalc/ui/formulacalculationoptions.ui", "FormulaCalculationOptions")
 , maConfig(rConfig)
 , mbSelectedEmptyStringAsZero(rConfig.mbEmptyStringAsZero)
 , mbWriteConfig(bWriteConfig)
+, mxEmptyAsZero(m_xBuilder->weld_check_button("checkEmptyAsZero"))
+, mxConversion(m_xBuilder->weld_combo_box_text("comboConversion"))
+, mxCurrentDocOnly(m_xBuilder->weld_check_button("current_doc"))
+, mxSyntax(m_xBuilder->weld_combo_box_text("comboSyntaxRef"))
 {
-get(mpConversion,"comboConversion");
-
mpConversion->SelectEntryPos(static_cast(rConfig.meStringConversion));
-mpConversion->SetSelectHdl(LINK(this, ScCalcOptionsDialog, 
ConversionModifiedHdl));
+mxConversion->set_active(static_cast(rConfig.meStringConversion));
+mxConversion->connect_changed(LINK(this, ScCalcOptionsDialog, 
ConversionModifiedHdl));
 
-get(mpEmptyAsZero,"checkEmptyAsZero");
-mpEmptyAsZero->Check(rConfig.mbEmptyStringAsZero);
-mpEmptyAsZero->SetClickHdl(LINK(this, ScCalcOptionsDialog, 
AsZeroModifiedHdl));
+mxEmptyAsZero->set_active(rConfig.mbEmptyStringAsZero);
+mxEmptyAsZero->connect_toggled(LINK(this, ScCalcOptionsDialog, 
AsZeroModifiedHdl));
 CoupleEmptyAsZeroToStringConversion();
 
-get(mpSyntax,"comboSyntaxRef");
-mpSyntax->SelectEntryPos( toSelectedItem(rConfig.meStringRefAddressSyntax) 
);
-mpSyntax->SetSelectHdl(LINK(this, ScCalcOptionsDialog, SyntaxModifiedHdl));
+mxSyntax->set_active(toSelectedItem(rConfig.meStringRefAddressSyntax));
+mxSyntax->connect_changed(LINK(this, ScCalcOptionsDialog, 
SyntaxModifiedHdl));
 
-get(mpCurrentDocOnly,"current_doc");
-mpCurrentDocOnly->Check(!mbWriteConfig);
-mpCurrentDocOnly->SetClickHdl(LINK(this, ScCalcOptionsDialog, 
CurrentDocOnlyHdl));
+mxCurrentDocOnly->set_active(!mbWriteConfig);
+mxCurrentDocOnly->connect_toggled(LINK(this, ScCalcOptionsDialog, 
CurrentDocOnlyHdl));
 }
 
 ScCalcOptionsDialog::~ScCalcOptionsDialog()
 {
-disposeOnce();
-}
-
-void ScCalcOptionsDialog::dispose()
-{
-mpEmptyAsZero.clear();
-mpConversion.clear();
-mpSyntax.clear();
-mpCurrentDocOnly.clear();
-ModalDialog::dispose();
 }
 
 void ScCalcOptionsDialog::CoupleEmptyAsZeroToStringConversion()
@@ -117,43 +106,43 @@ void 
ScCalcOptionsDialog::CoupleEmptyAsZeroToStringConversion()
 {
 case ScCalcConfig::StringConversion::ILLEGAL:
 maConfig.mbEmptyStringAsZero = false;
-mpEmptyAsZero->Check(false);
-mpEmptyAsZero->Enable(false);
+mxEmptyAsZero->set_active(false);
+mxEmptyAsZero->set_sensitive(false);
 break;
 case ScCalcConfig::StringConversion::ZERO:
 maConfig.mbEmptyStringAsZero = true;
-mpEmptyAsZero->Check();
-mpEmptyAsZero->Enable(false);
+mxEmptyAsZero->set_active(true);
+mxEmptyAsZero->set_sensitive(false);
 break;
 case ScCalcConfig::StringConversion::UNAMBIGUOUS:
 case ScCalcConfig::StringConversion::LOCALE:
 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source sc/uiconfig setup_native/source

2018-05-01 Thread Caolán McNamara
 sc/inc/scabstdlg.hxx  |6 
 sc/source/ui/attrdlg/scdlgfact.cxx|   18 +-
 sc/source/ui/attrdlg/scdlgfact.hxx|   12 +
 sc/source/ui/inc/mtrindlg.hxx |   28 +--
 sc/source/ui/miscdlgs/mtrindlg.cxx|   79 --
 sc/source/ui/view/cellsh3.cxx |8 -
 sc/uiconfig/scalc/ui/colwidthdialog.ui|   16 +-
 sc/uiconfig/scalc/ui/optimalcolwidthdialog.ui |   15 +
 sc/uiconfig/scalc/ui/optimalrowheightdialog.ui|   16 +-
 sc/uiconfig/scalc/ui/rowheightdialog.ui   |   16 +-
 setup_native/source/win32/customactions/inst_msu/inst_msu.cxx |4 
 11 files changed, 119 insertions(+), 99 deletions(-)

New commits:
commit 73ada0a095b6f09e0e1c9e779a7920d3eff468fe
Author: Caolán McNamara 
Date:   Mon Apr 30 20:34:09 2018 +0100

weld ScMetricInputDlg

Change-Id: I4693969c1ef740235e7c0d55619552dd4ace494c
Reviewed-on: https://gerrit.libreoffice.org/53675
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index 9e097aef5aa2..cbe1d45f8d61 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -241,9 +241,9 @@ public:
 class AbstractScMetricInputDlg : public VclAbstractDialog
 {
 protected:
-virtual ~AbstractScMetricInputDlg() override = default;
+virtual ~AbstractScMetricInputDlg() override = default;
 public:
-virtual long GetInputValue() const = 0;
+virtual int GetInputValue() const = 0;
 };
 
 class AbstractScMoveTableDlg : public VclAbstractDialog
@@ -455,7 +455,7 @@ public:
   const 
std::vector  ) = 0;
 virtual VclPtr 
CreateScLinkedAreaDlg(weld::Window* pParent) = 0;
 
-virtual VclPtr CreateScMetricInputDlg ( 
vcl::Window*pParent,
+virtual VclPtr 
CreateScMetricInputDlg(weld::Window* pParent,
 const OString& 
 sDialogName,
 long   
 nCurrent,
 long   
 nDefault,
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx 
b/sc/source/ui/attrdlg/scdlgfact.cxx
index 1d3d3d10f1f9..e7eb20d213f2 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -111,7 +111,12 @@ short AbstractScInsertCellDlg_Impl::Execute()
 IMPL_ABSTDLG_BASE(AbstractScInsertContentsDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractScInsertTableDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractScSelEntryDlg_Impl);
-IMPL_ABSTDLG_BASE(AbstractScMetricInputDlg_Impl);
+
+short AbstractScMetricInputDlg_Impl::Execute()
+{
+return m_xDlg->run();
+}
+
 IMPL_ABSTDLG_BASE(AbstractScMoveTableDlg_Impl);
 
 short AbstractScNameCreateDlg_Impl::Execute()
@@ -461,9 +466,9 @@ ScConditionalFormat* 
AbstractScCondFormatManagerDlg_Impl::GetCondFormatSelected(
 return pDlg->GetCondFormatSelected();
 }
 
-long AbstractScMetricInputDlg_Impl::GetInputValue() const
+int AbstractScMetricInputDlg_Impl::GetInputValue() const
 {
-return pDlg->GetInputValue();
+return m_xDlg->GetInputValue();
 }
 
 sal_uInt16 AbstractScMoveTableDlg_Impl::GetSelectedDocument() const
@@ -762,7 +767,7 @@ VclPtr 
ScAbstractDialogFactory_Impl::CreateScLinkedArea
 return VclPtr::Create(new 
ScLinkedAreaDlg(pParent));
 }
 
-VclPtr 
ScAbstractDialogFactory_Impl::CreateScMetricInputDlg (  vcl::Window*  
pParent,
+VclPtr 
ScAbstractDialogFactory_Impl::CreateScMetricInputDlg(weld::Window* pParent,
 const OString& 
sDialogName,
 long   
 nCurrent,
 long   
 nDefault,
@@ -771,9 +776,8 @@ VclPtr 
ScAbstractDialogFactory_Impl::CreateScMetricInp
 long   
 nMaximum ,
 long   
 nMinimum )
 {
-VclPtr pDlg = VclPtr::Create(pParent, 
sDialogName, nCurrent ,nDefault, eFUnit,
-nDecimals, nMaximum , nMinimum , 1, 100);
-return VclPtr::Create( pDlg );
+return VclPtr::Create(new 
ScMetricInputDlg(pParent, sDialogName, nCurrent ,nDefault, eFUnit,
+nDecimals, nMaximum , nMinimum));
 }
 
 VclPtr 
ScAbstractDialogFactory_Impl::CreateScMoveTableDlg(vcl::Window* pParent,
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx 
b/sc/source/ui/attrdlg/scdlgfact.hxx
index d4565762ed22..8eee3568f978 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source sw/source

2018-04-04 Thread Noel Grandin
 sc/inc/progress.hxx  |2 +-
 sc/source/core/tool/progress.cxx |6 +++---
 sw/source/core/edit/acorrect.cxx |7 +++
 sw/source/core/inc/acorrect.hxx  |2 +-
 4 files changed, 8 insertions(+), 9 deletions(-)

New commits:
commit 4fa280ced35631d5b51a2ac426912090e26ab903
Author: Noel Grandin 
Date:   Tue Apr 3 14:35:14 2018 +0200

loplugin:useuniqueptr in SwAutoCorrDoc

Change-Id: I1ec0a760c10b7e1da9d1c2a106bba60d84ff23f4
Reviewed-on: https://gerrit.libreoffice.org/52343
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx
index d2595462212f..709db86d2b76 100644
--- a/sw/source/core/edit/acorrect.cxx
+++ b/sw/source/core/edit/acorrect.cxx
@@ -83,7 +83,7 @@ void PaMIntoCursorShellRing::RemoveFromRing( SwPaM& rPam, 
SwPaM const * pPrev )
 
 SwAutoCorrDoc::SwAutoCorrDoc( SwEditShell& rEditShell, SwPaM& rPam,
 sal_Unicode cIns )
-: rEditSh( rEditShell ), rCursor( rPam ), pIdx( nullptr )
+: rEditSh( rEditShell ), rCursor( rPam )
 , m_nEndUndoCounter(0)
 , bUndoIdInitialized( cIns == 0 )
 {
@@ -95,7 +95,6 @@ SwAutoCorrDoc::~SwAutoCorrDoc()
 {
 rEditSh.EndUndo();
 }
-delete pIdx;
 }
 
 void SwAutoCorrDoc::DeleteSel( SwPaM& rDelPam )
@@ -276,7 +275,7 @@ OUString const* SwAutoCorrDoc::GetPrevPara(bool const 
bAtNormalPos)
 OUString const* pStr(nullptr);
 
 if( bAtNormalPos || !pIdx )
-pIdx = new SwNodeIndex( rCursor.GetPoint()->nNode, -1 );
+pIdx.reset(new SwNodeIndex( rCursor.GetPoint()->nNode, -1 ));
 else
 --(*pIdx);
 
@@ -360,7 +359,7 @@ bool SwAutoCorrDoc::ChgAutoCorrWord( sal_Int32& rSttPos, 
sal_Int32 nEndPos,
 if( pPara )
 {
 OSL_ENSURE( !pIdx, "who has not deleted his Index?" );
-pIdx = new SwNodeIndex( rCursor.GetPoint()->nNode, -1 );
+pIdx.reset(new SwNodeIndex( rCursor.GetPoint()->nNode, -1 
));
 }
 
 SwDoc* pAutoDoc = aTBlks.GetDoc();
diff --git a/sw/source/core/inc/acorrect.hxx b/sw/source/core/inc/acorrect.hxx
index f2382dbeddde..caae1184e99f 100644
--- a/sw/source/core/inc/acorrect.hxx
+++ b/sw/source/core/inc/acorrect.hxx
@@ -48,7 +48,7 @@ class SwAutoCorrDoc : public SvxAutoCorrDoc
 {
 SwEditShell& rEditSh;
 SwPaM& rCursor;
-SwNodeIndex* pIdx;
+std::unique_ptr pIdx;
 int m_nEndUndoCounter;
 boolbUndoIdInitialized;
 
commit a9d6a2584fcd36fd9e91b7339b38cc6bd524361a
Author: Noel Grandin 
Date:   Tue Apr 3 14:31:11 2018 +0200

loplugin:useuniqueptr in ScProgress

Change-Id: I92d3c3c52b5735de915db1a208cb7c0d68b4c7a0
Reviewed-on: https://gerrit.libreoffice.org/52342
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/sc/inc/progress.hxx b/sc/inc/progress.hxx
index 89fe38a40340..68cda2341bfb 100644
--- a/sc/inc/progress.hxx
+++ b/sc/inc/progress.hxx
@@ -50,7 +50,7 @@ private:
 static  boolbIdleWasEnabled;
 boolbEnabled;
 
-SfxProgress*pProgress;
+std::unique_ptr pProgress;
 
 ScProgress( const ScProgress& ) = delete;
 ScProgress& operator=( const ScProgress& ) = delete;
diff --git a/sc/source/core/tool/progress.cxx b/sc/source/core/tool/progress.cxx
index b6b09e98bacb..12ac9d857d90 100644
--- a/sc/source/core/tool/progress.cxx
+++ b/sc/source/core/tool/progress.cxx
@@ -106,8 +106,8 @@ ScProgress::ScProgress(SfxObjectShell* pObjSh, const 
OUString& rText,
 }
 else
 {
-pProgress = new SfxProgress( pObjSh, rText, nRange, bWait );
-pGlobalProgress = pProgress;
+pProgress.reset(new SfxProgress( pObjSh, rText, nRange, bWait ));
+pGlobalProgress = pProgress.get();
 nGlobalRange = nRange;
 nGlobalPercent = 0;
 }
@@ -124,7 +124,7 @@ ScProgress::~ScProgress()
 {
 if ( pProgress )
 {
-delete pProgress;
+pProgress.reset();
 pGlobalProgress = nullptr;
 nGlobalRange = 0;
 nGlobalPercent = 0;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2018-04-04 Thread Noel Grandin
 sc/inc/queryentry.hxx  |4 ++--
 sc/source/core/inc/jumpmatrix.hxx  |6 +++---
 sc/source/core/tool/interpr1.cxx   |   15 ++-
 sc/source/core/tool/interpr4.cxx   |6 +++---
 sc/source/core/tool/jumpmatrix.cxx |   17 -
 sc/source/core/tool/queryentry.cxx |   22 --
 6 files changed, 26 insertions(+), 44 deletions(-)

New commits:
commit 9d037cb837d74708358168333a0b457952de23a6
Author: Noel Grandin 
Date:   Tue Apr 3 14:05:20 2018 +0200

loplugin:useuniqueptr in ScJumpMatrix

Change-Id: Ia8461773bdb2290690616b291356edd3a9ea4f35
Reviewed-on: https://gerrit.libreoffice.org/52341
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/sc/source/core/inc/jumpmatrix.hxx 
b/sc/source/core/inc/jumpmatrix.hxx
index 084f5a91f4bb..c4a0b5784896 100644
--- a/sc/source/core/inc/jumpmatrix.hxx
+++ b/sc/source/core/inc/jumpmatrix.hxx
@@ -60,7 +60,7 @@ class ScJumpMatrix
 std::vector mvJump;  // the jumps
 ScMatrixRef pMat;   // the results
 ScRefList   mvRefList;  // array of references result, if any
-ScTokenVec* pParams;// parameter stack
+ScTokenVec  mvParams;// parameter stack
 SCSIZE  nCols;
 SCSIZE  nRows;
 SCSIZE  nCurCol;
@@ -103,8 +103,8 @@ public:
 void SetJump( SCSIZE nCol, SCSIZE nRow, double fBool, short nStart, short 
nNext );
 void GetJump( SCSIZE nCol, SCSIZE nRow, double& rBool, short& rStart, 
short& rNext, short& rStop ) const;
 void SetAllJumps( double fBool, short nStart, short nNext, short nStop = 
SHRT_MAX );
-void SetJumpParameters( ScTokenVec* p );
-const ScTokenVec* GetJumpParameters() const { return pParams;}
+void SetJumpParameters( ScTokenVec&& p );
+const ScTokenVec & GetJumpParameters() const { return mvParams;}
 bool HasResultMatrix() const;
 ScMatrix* GetResultMatrix();///< also applies pending buffered 
values
 void GetPos( SCSIZE& rCol, SCSIZE& rRow ) const;
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 06fc60b8a18e..51a2a422abfc 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -786,16 +786,13 @@ bool ScInterpreter::JumpMatrix( short nStackLevel )
 }
 if ( bCont && nStart != nNext )
 {
-const ScTokenVec* pParams = pJumpMatrix->GetJumpParameters();
-if ( pParams )
+const ScTokenVec & rParams = pJumpMatrix->GetJumpParameters();
+for ( auto const & i : rParams )
 {
-for ( ScTokenVec::const_iterator i = pParams->begin(); i != 
pParams->end(); ++i )
-{
-// This is not the current state of the interpreter, so
-// push without error, and elements' errors are coded into
-// double.
-PushWithoutError( *(*i));
-}
+// This is not the current state of the interpreter, so
+// push without error, and elements' errors are coded into
+// double.
+PushWithoutError(*i);
 }
 aCode.Jump( nStart, nNext, nStop );
 }
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index e631ffaf9139..d28d8138a88a 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -1576,15 +1576,15 @@ bool ScInterpreter::ConvertMatrixParameters()
 std::unique_ptr pJumpMat( new ScJumpMatrix( 
pCur->GetOpCode(), nJumpCols, nJumpRows));
 pJumpMat->SetAllJumps( 1.0, nStart, nNext, nStop);
 // pop parameters and store in ScJumpMatrix, push in JumpMatrix()
-ScTokenVec* pParams = new ScTokenVec( nParams);
+ScTokenVec aParams(nParams);
 for ( sal_uInt16 i=1; i <= nParams && sp > 0; ++i )
 {
 const FormulaToken* p = pStack[ --sp ];
 p->IncRef();
 // store in reverse order such that a push may simply iterate
-(*pParams)[ nParams - i ] = p;
+aParams[ nParams - i ] = p;
 }
-pJumpMat->SetJumpParameters( pParams);
+pJumpMat->SetJumpParameters( std::move(aParams) );
 xNew = new ScJumpMatrixToken( std::move(pJumpMat) );
 GetTokenMatrixMap().emplace(pCur, xNew);
 }
diff --git a/sc/source/core/tool/jumpmatrix.cxx 
b/sc/source/core/tool/jumpmatrix.cxx
index ed71c69c1a20..c3153fd5ac3e 100644
--- a/sc/source/core/tool/jumpmatrix.cxx
+++ b/sc/source/core/tool/jumpmatrix.cxx
@@ -30,7 +30,6 @@ const SCSIZE kBufferThreshold = 128;
 ScJumpMatrix::ScJumpMatrix( OpCode eOp, SCSIZE nColsP, SCSIZE nRowsP )
 : mvJump(nColsP * nRowsP)
 , pMat(new 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2018-03-27 Thread Noel Grandin
 sc/inc/drwlayer.hxx   |4 +-
 sc/inc/prnsave.hxx|8 ++---
 sc/source/core/data/drwlayer.cxx  |   12 +++-
 sc/source/core/tool/prnsave.cxx   |   16 ---
 sc/source/ui/docshell/docfunc.cxx |   52 +-
 sc/source/ui/drawfunc/futext3.cxx |8 ++---
 sc/source/ui/inc/undoolk.hxx  |2 -
 sc/source/ui/undo/undobase.cxx|6 ++--
 sc/source/ui/undo/undoblk2.cxx|2 -
 sc/source/ui/undo/undoblk3.cxx|2 -
 sc/source/ui/undo/undodat.cxx |2 -
 sc/source/ui/undo/undoolk.cxx |2 -
 sc/source/ui/undo/undotab.cxx |   10 +++
 sc/source/ui/view/drawview.cxx|2 -
 14 files changed, 54 insertions(+), 74 deletions(-)

New commits:
commit 50af4bf5c67eaac39d02cfe20584906eec058235
Author: Noel Grandin 
Date:   Fri Mar 23 14:23:42 2018 +0200

loplugin:useuniqueptr in ScDrawLayer

Change-Id: I684e391b738be23ba7769b7c5b0a354f43a9226e
Reviewed-on: https://gerrit.libreoffice.org/51903
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/sc/inc/drwlayer.hxx b/sc/inc/drwlayer.hxx
index 5f695160cc42..3d9e2b72b685 100644
--- a/sc/inc/drwlayer.hxx
+++ b/sc/inc/drwlayer.hxx
@@ -96,7 +96,7 @@ class SC_DLLPUBLIC ScDrawLayer : public FmFormModel
 private:
 OUStringaName;
 ScDocument* pDoc;
-SdrUndoGroup*   pUndoGroup;
+std::unique_ptr pUndoGroup;
 boolbRecording;
 boolbAdjustEnabled;
 boolbHyphenatorSet;
@@ -135,7 +135,7 @@ public:
 voidEnableAdjust( bool bSet ){ bAdjustEnabled = bSet; }
 
 voidBeginCalcUndo(bool bDisableTextEditUsesCommonUndoManager);
-SdrUndoGroup*   GetCalcUndo();
+std::unique_ptr GetCalcUndo();
 boolIsRecording() const { return bRecording; }
 voidAddCalcUndo( SdrUndoAction* pUndo );
 
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 6a476c4d535e..3a765e8965bd 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -248,7 +248,6 @@ ScDrawLayer::ScDrawLayer( ScDocument* pDocument, const 
OUString& rName ) :
  true ),// bUseExtColorTable (is set below)
 aName( rName ),
 pDoc( pDocument ),
-pUndoGroup( nullptr ),
 bRecording( false ),
 bAdjustEnabled( true ),
 bHyphenatorSet( false )
@@ -341,7 +340,7 @@ ScDrawLayer::~ScDrawLayer()
 
 ClearModel(true);
 
-delete pUndoGroup;
+pUndoGroup.reset();
 if( !--nInst )
 {
 delete pF3d;
@@ -1205,7 +1204,7 @@ void ScDrawLayer::AddCalcUndo( SdrUndoAction* pUndo )
 if (bRecording)
 {
 if (!pUndoGroup)
-pUndoGroup = new SdrUndoGroup(*this);
+pUndoGroup.reset(new SdrUndoGroup(*this));
 
 pUndoGroup->AddAction( pUndo );
 }
@@ -1216,14 +1215,13 @@ void ScDrawLayer::AddCalcUndo( SdrUndoAction* pUndo )
 void ScDrawLayer::BeginCalcUndo(bool bDisableTextEditUsesCommonUndoManager)
 {
 
SetDisableTextEditUsesCommonUndoManager(bDisableTextEditUsesCommonUndoManager);
-DELETEZ(pUndoGroup);
+pUndoGroup.reset();
 bRecording = true;
 }
 
-SdrUndoGroup* ScDrawLayer::GetCalcUndo()
+std::unique_ptr ScDrawLayer::GetCalcUndo()
 {
-SdrUndoGroup* pRet = pUndoGroup;
-pUndoGroup = nullptr;
+std::unique_ptr pRet = std::move(pUndoGroup);
 bRecording = false;
 SetDisableTextEditUsesCommonUndoManager(false);
 return pRet;
diff --git a/sc/source/ui/docshell/docfunc.cxx 
b/sc/source/ui/docshell/docfunc.cxx
index 80c99cef7f40..55913db5f4c9 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -179,7 +179,7 @@ bool ScDocFunc::DetectiveAddPred(const ScAddress& rPos)
 if (bUndo)
 pModel->BeginCalcUndo(false);
 bool bDone = ScDetectiveFunc( ,nTab ).ShowPred( nCol, nRow );
-SdrUndoGroup* pUndo = nullptr;
+std::unique_ptr pUndo;
 if (bUndo)
 pUndo = pModel->GetCalcUndo();
 if (bDone)
@@ -189,15 +189,13 @@ bool ScDocFunc::DetectiveAddPred(const ScAddress& rPos)
 if (bUndo)
 {
 rDocShell.GetUndoManager()->AddUndoAction(
-new ScUndoDetective( , pUndo,  ) 
);
+new ScUndoDetective( , pUndo.release(), 
 ) );
 }
 aModificator.SetDocumentModified();
 SfxBindings* pBindings = rDocShell.GetViewBindings();
 if (pBindings)
 pBindings->Invalidate( SID_DETECTIVE_REFRESH );
 }
-else
-delete pUndo;
 
 return bDone;
 }
@@ -220,7 +218,7 @@ bool ScDocFunc::DetectiveDelPred(const ScAddress& rPos)
 if (bUndo)
 pModel->BeginCalcUndo(false);
 bool bDone = ScDetectiveFunc( ,nTab ).DeletePred( nCol, nRow );
-SdrUndoGroup* pUndo = nullptr;
+std::unique_ptr pUndo;
 if (bUndo)
  

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2017-12-18 Thread Kohei Yoshida
 sc/inc/documentimport.hxx   |   10 -
 sc/source/core/data/documentimport.cxx  |   42 +++-
 sc/source/filter/inc/orcusinterface.hxx |   64 +-
 sc/source/filter/orcus/interface.cxx|  319 +---
 4 files changed, 362 insertions(+), 73 deletions(-)

New commits:
commit 1c7fa9528f7373e6798b597a42abe38f20a306aa
Author: Kohei Yoshida 
Date:   Wed Dec 13 22:27:03 2017 -0500

Defer cell value insertion until later.

Because Calc's formula engine expects all named expressions to be
present at the time of re-calculations, we need to delay insertion
of cell values until after the named expressions are inserted into
the document.

Change-Id: I54c7d3dc86b3e2c5c192337b1cebfbdfb901ab1f
Reviewed-on: https://gerrit.libreoffice.org/46665
Reviewed-by: Kohei Yoshida 
Tested-by: Kohei Yoshida 

diff --git a/sc/inc/documentimport.hxx b/sc/inc/documentimport.hxx
index b4c35e1f99b5..d881da37cf2d 100644
--- a/sc/inc/documentimport.hxx
+++ b/sc/inc/documentimport.hxx
@@ -96,7 +96,15 @@ public:
 void setNumericCell(const ScAddress& rPos, double fVal);
 void setStringCell(const ScAddress& rPos, const OUString& rStr);
 void setEditCell(const ScAddress& rPos, EditTextObject* pEditText);
-void setFormulaCell(const ScAddress& rPos, const OUString& rFormula, 
formula::FormulaGrammar::Grammar eGrammar);
+
+void setFormulaCell(
+const ScAddress& rPos, const OUString& rFormula, 
formula::FormulaGrammar::Grammar eGrammar,
+const double* pResult = nullptr );
+
+void setFormulaCell(
+const ScAddress& rPos, const OUString& rFormula, 
formula::FormulaGrammar::Grammar eGrammar,
+const OUString& rResult );
+
 void setFormulaCell(const ScAddress& rPos, ScTokenArray* pArray);
 void setFormulaCell(const ScAddress& rPos, ScFormulaCell* pCell);
 
diff --git a/sc/source/core/data/documentimport.cxx 
b/sc/source/core/data/documentimport.cxx
index 183f3e1650af..6208789f416e 100644
--- a/sc/source/core/data/documentimport.cxx
+++ b/sc/source/core/data/documentimport.cxx
@@ -25,9 +25,7 @@
 
 #include 
 #include 
-
-#include 
-#include 
+#include 
 
 namespace {
 
@@ -271,7 +269,35 @@ void ScDocumentImport::setEditCell(const ScAddress& rPos, 
EditTextObject* pEditT
 }
 
 void ScDocumentImport::setFormulaCell(
-const ScAddress& rPos, const OUString& rFormula, 
formula::FormulaGrammar::Grammar eGrammar)
+const ScAddress& rPos, const OUString& rFormula, 
formula::FormulaGrammar::Grammar eGrammar,
+const double* pResult )
+{
+ScTable* pTab = mpImpl->mrDoc.FetchTable(rPos.Tab());
+if (!pTab)
+return;
+
+sc::ColumnBlockPosition* pBlockPos = mpImpl->getBlockPosition(rPos.Tab(), 
rPos.Col());
+
+if (!pBlockPos)
+return;
+
+std::unique_ptr pFC =
+o3tl::make_unique(>mrDoc, rPos, rFormula, 
eGrammar);
+
+if (pResult)
+{
+// Set cached result to this formula cell.
+pFC->SetResultDouble(*pResult);
+}
+
+sc::CellStoreType& rCells = pTab->aCol[rPos.Col()].maCells;
+pBlockPos->miCellPos =
+rCells.set(pBlockPos->miCellPos, rPos.Row(), pFC.release());
+}
+
+void ScDocumentImport::setFormulaCell(
+const ScAddress& rPos, const OUString& rFormula, 
formula::FormulaGrammar::Grammar eGrammar,
+const OUString& rResult )
 {
 ScTable* pTab = mpImpl->mrDoc.FetchTable(rPos.Tab());
 if (!pTab)
@@ -282,9 +308,15 @@ void ScDocumentImport::setFormulaCell(
 if (!pBlockPos)
 return;
 
+std::unique_ptr pFC =
+o3tl::make_unique(>mrDoc, rPos, rFormula, 
eGrammar);
+
+// Set cached result to this formula cell.
+pFC->SetHybridString(mpImpl->mrDoc.GetSharedStringPool().intern(rResult));
+
 sc::CellStoreType& rCells = pTab->aCol[rPos.Col()].maCells;
 pBlockPos->miCellPos =
-rCells.set(pBlockPos->miCellPos, rPos.Row(), new 
ScFormulaCell(>mrDoc, rPos, rFormula, eGrammar));
+rCells.set(pBlockPos->miCellPos, rPos.Row(), pFC.release());
 }
 
 void ScDocumentImport::setFormulaCell(const ScAddress& rPos, ScTokenArray* 
pArray)
diff --git a/sc/source/filter/inc/orcusinterface.hxx 
b/sc/source/filter/inc/orcusinterface.hxx
index 851271f9806a..07c35fa78dfe 100644
--- a/sc/source/filter/inc/orcusinterface.hxx
+++ b/sc/source/filter/inc/orcusinterface.hxx
@@ -273,6 +273,8 @@ public:
 virtual orcus::spreadsheet::range_size_t get_sheet_size() const override;
 
 SCTAB getIndex() const { return mnTab; }
+
+const sc::SharedFormulaGroups& getSharedFormulaGroups() const;
 };
 
 class ScOrcusStyles : public orcus::spreadsheet::iface::import_styles
@@ -508,28 +510,51 @@ public:
 
 class ScOrcusFactory : public orcus::spreadsheet::iface::import_factory
 {
-struct StringCellCache
+struct CellStoreToken
 {
+enum class Type
+{
+Auto,
+Numeric,
+String,
+   

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2017-11-21 Thread Eike Rathke
 sc/inc/stringutil.hxx   |6 ++
 sc/source/core/data/column3.cxx |   12 ++--
 sc/source/ui/undo/undocell.cxx  |2 ++
 3 files changed, 18 insertions(+), 2 deletions(-)

New commits:
commit ba9833a1d63747eaa5124271a1ac51cb926bce7a
Author: Eike Rathke 
Date:   Tue Nov 21 15:24:56 2017 +0100

Keep number format on string cell content Undo, tdf#103234 follow-up

Change-Id: I18c281211e6eeb4816da13972c360df85d577491

diff --git a/sc/inc/stringutil.hxx b/sc/inc/stringutil.hxx
index e02c06bc392c..e44bdcc84e39 100644
--- a/sc/inc/stringutil.hxx
+++ b/sc/inc/stringutil.hxx
@@ -47,6 +47,12 @@ struct SAL_WARN_UNUSED SC_DLLPUBLIC ScSetStringParam
 SpecialNumberOnly,
 
 /**
+ * Keep an existing number format, do not set Text number format and do
+ * not set another number format.
+ */
+Keep,
+
+/**
  * Never set Text number format.
  */
 Never
diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx
index 129d2fc43191..5c10cd3282aa 100644
--- a/sc/source/ui/undo/undocell.cxx
+++ b/sc/source/ui/undo/undocell.cxx
@@ -457,6 +457,8 @@ void ScUndoSetCell::SetValue( const ScCellValue& rVal )
 {
 ScSetStringParam aParam;
 aParam.setTextInput();
+// Undo only cell content, without setting any number format.
+aParam.meSetTextNumFormat = ScSetStringParam::Keep;
 rDoc.SetString(maPos, rVal.mpString->getString(), );
 }
 break;
commit f2f0a7c5a9d8185fedef5c737d1b7479b9fc0c1e
Author: Eike Rathke 
Date:   Tue Nov 21 14:55:04 2017 +0100

Invert logic of ScSetStringParam::* enum value checks, tdf#103234 follow-up

In preparation for adding a new enum value to keep existing
formatting in any case.

Change-Id: Ic15a900adba0281d1267d95f821e1e898f80f566

diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 9a5a57205436..7a4672978a68 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -1796,7 +1796,8 @@ bool ScColumn::ParseString(
 }
 }
 }
-else if (aParam.meSetTextNumFormat != ScSetStringParam::Always)
+else if (aParam.meSetTextNumFormat == ScSetStringParam::Never ||
+ aParam.meSetTextNumFormat == 
ScSetStringParam::SpecialNumberOnly)
 {
 // Only check if the string is a regular number.
 const LocaleDataWrapper* pLocale = 
aParam.mpNumFormatter->GetLocaleData();
@@ -1824,7 +1825,14 @@ bool ScColumn::ParseString(
 
 if (rCell.meType == CELLTYPE_NONE)
 {
-if (aParam.meSetTextNumFormat != ScSetStringParam::Never && 
aParam.mpNumFormatter->IsNumberFormat(rString, nIndex, nVal))
+// If we reach here with ScSetStringParam::SpecialNumberOnly it
+// means a simple number was not detected above, so test for
+// special numbers. In any case ScSetStringParam::Always does not
+// mean always, but only always for content that could be any
+// numeric.
+if ((aParam.meSetTextNumFormat == ScSetStringParam::Always ||
+ aParam.meSetTextNumFormat == 
ScSetStringParam::SpecialNumberOnly) &&
+aParam.mpNumFormatter->IsNumberFormat(rString, nIndex, 
nVal))
 {
 // Set the cell format type to Text.
 applyTextNumFormat(*this, nRow, aParam.mpNumFormatter);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2017-10-23 Thread Eike Rathke
 sc/inc/scmatrix.hxx  |   17 ---
 sc/source/core/tool/scmatrix.cxx |   44 +--
 2 files changed, 42 insertions(+), 19 deletions(-)

New commits:
commit ad2f1d2675ce480abf06db280fc551372b3cbed3
Author: Eike Rathke 
Date:   Mon Oct 23 16:15:49 2017 +0200

Assume 6GB memory could be consumed by matrices

... if SC_MAX_MATRIX_ELEMENTS is not set.

Change-Id: I27100d5fc75e2d5288892c54997147854de781e7

diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 9fa822fad412..32dc362245bd 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -339,13 +339,23 @@ private:
 static bool bElementsMaxFetched;
 static size_t nElementsMax;
 
-/// The maximum number of elements a matrix may have at runtime.
-static size_t GetElementsMax()
+/** The maximum number of elements a matrix or the pool may have at runtime.
+
+@param  nMemory
+If 0, the arbitrary limit of one matrix is returned.
+If >0, the given memory pool divided by the average size of a
+matrix element is returned, which is used to initialize
+nElementsMax.
+ */
+static size_t GetElementsMax( size_t nMemory )
 {
 // Arbitrarily assuming 12 bytes per element, 8 bytes double plus
 // overhead. Stored as an array in an mdds container it's less, but for
 // strings or mixed matrix it can be much more..
 constexpr size_t nPerElem = 12;
+if (nMemory)
+return nMemory / nPerElem;
+
 // Arbitrarily assuming 1GB memory. Could be dynamic at some point.
 constexpr size_t nMemMax = 0x4000;
 // With 1GB that's ~85M elements, or 85 whole columns.
@@ -2797,8 +2807,21 @@ bool ScMatrix::IsSizeAllocatable( SCSIZE nC, SCSIZE nR )
 
 if (!bElementsMaxFetched)
 {
-nElementsMax = std::getenv("SC_MAX_MATRIX_ELEMENTS") ? 
std::atoi(std::getenv("SC_MAX_MATRIX_ELEMENTS"))
-   : 
GetElementsMax();
+const char* pEnv = std::getenv("SC_MAX_MATRIX_ELEMENTS");
+if (pEnv)
+{
+// Environment specifies the overall elements pool.
+nElementsMax = std::atoi(pEnv);
+}
+else
+{
+// GetElementsMax() uses an (~arbitrary) elements limit.
+// Assume 6GB memory could be consumed by matrices.
+// The actual allocation depends on the types of individual matrix
+// elements and is averaged for type double.
+constexpr size_t nMemMax = 0x18000;
+nElementsMax = GetElementsMax( nMemMax);
+}
 bElementsMaxFetched = true;
 }
 
commit 443113383296ca4781fb44e58e018a337db8e73c
Author: Eike Rathke 
Date:   Mon Oct 23 15:12:22 2017 +0200

Move GetElementsMax() to .cxx

Nothing else is using it so we don't need it in .hxx

Change-Id: I0df879a7be2c56a70c30f50f44a92bb527b5a9ed

diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx
index c80ceab0..4acd2c937f91 100644
--- a/sc/inc/scmatrix.hxx
+++ b/sc/inc/scmatrix.hxx
@@ -152,23 +152,6 @@ public:
 mfFirst(r.mfFirst), mfRest(r.mfRest), mnCount(r.mnCount) {}
 };
 
-/// The maximum number of elements a matrix may have at runtime.
-static size_t GetElementsMax()
-{
-// Arbitrarily assuming 12 bytes per element, 8 bytes double plus
-// overhead. Stored as an array in an mdds container it's less, but for
-// strings or mixed matrix it can be much more..
-constexpr size_t nPerElem = 12;
-// Arbitrarily assuming 1GB memory. Could be dynamic at some point.
-constexpr size_t nMemMax = 0x4000;
-// With 1GB that's ~85M elements, or 85 whole columns.
-constexpr size_t nElemMax = nMemMax / nPerElem;
-// With MAXROWCOUNT==1048576 and 128 columns => 128M elements, 1.5GB
-constexpr size_t nArbitraryLimit = (size_t)MAXROWCOUNT * 128;
-// With the constant 1GB from above that's the actual value.
-return nElemMax < nArbitraryLimit ? nElemMax : nArbitraryLimit;
-}
-
 /** Checks nC or nR for zero and uses GetElementsMax() whether a matrix of
 the size of nC*nR could be allocated. A zero size (both nC and nR zero)
 matrix is allowed for later resize.
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 7df5dbe52793..9fa822fad412 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -339,6 +339,23 @@ private:
 static bool bElementsMaxFetched;
 static size_t nElementsMax;
 
+/// The maximum number of elements a matrix may have at runtime.
+static size_t GetElementsMax()
+{
+// Arbitrarily assuming 12 bytes per element, 8 bytes double plus
+// overhead. Stored as an array in an mdds container it's less, but for
+// strings or mixed 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source sdext/source

2017-10-17 Thread Noel Grandin
 sc/inc/compressedarray.hxx |   11 +++
 sc/source/core/data/compressedarray.cxx|9 -
 sdext/source/pdfimport/inc/genericelements.hxx |4 ++--
 sdext/source/pdfimport/inc/imagecontainer.hxx  |4 ++--
 sdext/source/pdfimport/inc/pdfiprocessor.hxx   |4 ++--
 sdext/source/pdfimport/inc/treevisiting.hxx|4 ++--
 sdext/source/pdfimport/pdfiadaptor.cxx |2 +-
 7 files changed, 16 insertions(+), 22 deletions(-)

New commits:
commit 79fe112cdd9d59982739c04026297055e4bd8ab0
Author: Noel Grandin 
Date:   Sun Oct 15 20:30:55 2017 +0200

Simplify ScCompressedArray constructor

nobody is setting a custom delta

Change-Id: I5dd9ac691fb226697eb8cb2b6b0b673552a4f049
Reviewed-on: https://gerrit.libreoffice.org/43437
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/sc/inc/compressedarray.hxx b/sc/inc/compressedarray.hxx
index 86063049b774..93cbac83172d 100644
--- a/sc/inc/compressedarray.hxx
+++ b/sc/inc/compressedarray.hxx
@@ -25,8 +25,6 @@
 
 #include "scdllapi.h"
 
-const size_t nScCompressedArrayDelta = 4;
-
 /** Compressed array of row (or column) entries, e.g. heights, flags, ...
 
 The array stores ranges of values such that equal consecutive values 
occupy only
@@ -70,8 +68,7 @@ public:
 
 /** Construct with nMaxAccess=MAXROW, for example. */
 ScCompressedArray( A nMaxAccess,
-const D& rValue,
-size_t nDelta = 
nScCompressedArrayDelta );
+const D& rValue );
 /** Construct from a plain array of D */
 ScCompressedArray( A nMaxAccess,
 const D* pDataArray, size_t nDataCount 
);
@@ -119,7 +116,6 @@ public:
 protected:
 size_t  nCount;
 size_t  nLimit;
-size_t  nDelta;
 DataEntry*  pData;
 A   nMaxAccess;
 };
@@ -176,9 +172,8 @@ template< typename A, typename D > class 
ScBitMaskCompressedArray : public ScCom
 {
 public:
 ScBitMaskCompressedArray( A nMaxAccessP,
-const D& rValue,
-size_t nDeltaP = 
nScCompressedArrayDelta )
-: ScCompressedArray( nMaxAccessP, 
rValue, nDeltaP)
+const D& rValue )
+: ScCompressedArray( nMaxAccessP, 
rValue )
 {}
 ScBitMaskCompressedArray( A nMaxAccessP,
 const D* pDataArray, size_t nDataCount 
)
diff --git a/sc/source/core/data/compressedarray.cxx 
b/sc/source/core/data/compressedarray.cxx
index a1426792086d..6d4c67fa0e61 100644
--- a/sc/source/core/data/compressedarray.cxx
+++ b/sc/source/core/data/compressedarray.cxx
@@ -23,12 +23,12 @@
 
 #include 
 
+static const size_t nScCompressedArrayDelta = 4;
+
 template< typename A, typename D >
-ScCompressedArray::ScCompressedArray( A nMaxAccessP, const D& rValue,
-size_t nDeltaP )
+ScCompressedArray::ScCompressedArray( A nMaxAccessP, const D& rValue )
 : nCount(1)
 , nLimit(1)
-, nDelta( nDeltaP > 0 ? nDeltaP : 1)
 , pData( new DataEntry[1])
 , nMaxAccess( nMaxAccessP)
 {
@@ -41,7 +41,6 @@ ScCompressedArray::ScCompressedArray( A nMaxAccessP, 
const D* pDataArray,
 size_t nDataCount )
 : nCount(0)
 , nLimit( nDataCount)
-, nDelta( nScCompressedArrayDelta)
 , pData( new DataEntry[nDataCount])
 , nMaxAccess( nMaxAccessP)
 {
@@ -127,7 +126,7 @@ void ScCompressedArray::SetValue( A nStart, A nEnd, 
const D& rValue )
 size_t nNeeded = nCount + 2;
 if (nLimit < nNeeded)
 {
-nLimit += nDelta;
+nLimit += nScCompressedArrayDelta;
 if (nLimit < nNeeded)
 nLimit = nNeeded;
 DataEntry* pNewData = new DataEntry[nLimit];
commit b8c6a3486bb11c61539a19ae72fc938f67e9470e
Author: Stephan Bergmann 
Date:   Mon Oct 16 22:46:05 2017 +0200

Move sdext/source/pdfimport/tree include files to common include directory

...that are included from various source directories.  Change done in
preparation of loplugin:includeform.

Change-Id: Ie46f4b940ceeb34fd8883dc17f56a072f625ee3a
Reviewed-on: https://gerrit.libreoffice.org/43442
Tested-by: Jenkins 
Reviewed-by: Stephan Bergmann 

diff --git a/sdext/source/pdfimport/tree/genericelements.hxx 
b/sdext/source/pdfimport/inc/genericelements.hxx
similarity index 98%

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2017-08-15 Thread Tor Lillqvist
 sc/inc/lookupcache.hxx  |5 +
 sc/source/core/data/documen2.cxx|   10 +-
 sc/source/core/tool/lookupcache.cxx |2 +-
 3 files changed, 7 insertions(+), 10 deletions(-)

New commits:
commit 7172a7e4a64a67d43d16c2fbdbe9015fb5bf5a0c
Author: Tor Lillqvist 
Date:   Tue Aug 15 09:13:59 2017 +0300

tdf#96099: Get rid of one more pointless typedef

Change-Id: If50b022cabb0a94297cdb13c58f80884c33892d3

diff --git a/sc/inc/lookupcache.hxx b/sc/inc/lookupcache.hxx
index ef9d1521fad1..0997f6542811 100644
--- a/sc/inc/lookupcache.hxx
+++ b/sc/inc/lookupcache.hxx
@@ -191,8 +191,6 @@ private:
 
 };
 
-typedef std::unordered_map< ScRange, ScLookupCache*, ScLookupCache::Hash > 
ScLookupCacheMap;
-
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 3e2de5cb6d23..ac44da5278d2 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -111,7 +111,7 @@ using namespace com::sun::star;
 // dtor plus helpers are convenient.
 struct ScLookupCacheMapImpl
 {
-ScLookupCacheMap aCacheMap;
+std::unordered_map< ScRange, ScLookupCache*, ScLookupCache::Hash > 
aCacheMap;
 ~ScLookupCacheMapImpl()
 {
 freeCaches();
@@ -120,13 +120,13 @@ struct ScLookupCacheMapImpl
 {
 freeCaches();
 // free mapping
-ScLookupCacheMap aTmp;
+std::unordered_map< ScRange, ScLookupCache*, ScLookupCache::Hash > 
aTmp;
 aCacheMap.swap( aTmp);
 }
 private:
 void freeCaches()
 {
-for (ScLookupCacheMap::iterator it( aCacheMap.begin()); it != 
aCacheMap.end(); ++it)
+for (auto it( aCacheMap.begin()); it != aCacheMap.end(); ++it)
 delete (*it).second;
 }
 };
@@ -1232,7 +1232,7 @@ ScLookupCache & ScDocument::GetLookupCache( const ScRange 
& rRange )
 ScLookupCache* pCache = nullptr;
 if (!pLookupCacheMapImpl)
 pLookupCacheMapImpl = new ScLookupCacheMapImpl;
-ScLookupCacheMap::iterator it( pLookupCacheMapImpl->aCacheMap.find( 
rRange));
+auto it( pLookupCacheMapImpl->aCacheMap.find( rRange));
 if (it == pLookupCacheMapImpl->aCacheMap.end())
 {
 pCache = new ScLookupCache( this, rRange);
@@ -1256,7 +1256,7 @@ void ScDocument::AddLookupCache( ScLookupCache & rCache )
 
 void ScDocument::RemoveLookupCache( ScLookupCache & rCache )
 {
-ScLookupCacheMap::iterator it( pLookupCacheMapImpl->aCacheMap.find(
+auto it( pLookupCacheMapImpl->aCacheMap.find(
 rCache.getRange()));
 if (it == pLookupCacheMapImpl->aCacheMap.end())
 {
commit b051f4baa9f25e5d00fca941162b4515c76331ec
Author: Tor Lillqvist 
Date:   Tue Aug 15 09:08:42 2017 +0300

tdf#96099: Get rid of one more pointless typedef

Change-Id: I669b020f2f251ef14cbfff78f6e186876ea0127c

diff --git a/sc/inc/lookupcache.hxx b/sc/inc/lookupcache.hxx
index 905df00e5860..ef9d1521fad1 100644
--- a/sc/inc/lookupcache.hxx
+++ b/sc/inc/lookupcache.hxx
@@ -182,8 +182,7 @@ private:
 }
 };
 
-typedef std::unordered_map< QueryKey, QueryCriteriaAndResult, 
QueryKey::Hash > QueryMap;
-QueryMapmaQueryMap;
+std::unordered_map< QueryKey, QueryCriteriaAndResult, QueryKey::Hash > 
maQueryMap;
 ScRange maRange;
 ScDocument *mpDoc;
 
diff --git a/sc/source/core/tool/lookupcache.cxx 
b/sc/source/core/tool/lookupcache.cxx
index c0140d9046b6..d0258946ac20 100644
--- a/sc/source/core/tool/lookupcache.cxx
+++ b/sc/source/core/tool/lookupcache.cxx
@@ -79,7 +79,7 @@ ScLookupCache::~ScLookupCache()
 ScLookupCache::Result ScLookupCache::lookup( ScAddress & o_rResultAddress,
 const QueryCriteria & rCriteria, const ScAddress & rQueryAddress ) 
const
 {
-QueryMap::const_iterator it( maQueryMap.find( QueryKey( rQueryAddress,
+auto it( maQueryMap.find( QueryKey( rQueryAddress,
 rCriteria.getQueryOp(;
 if (it == maQueryMap.end())
 return NOT_CACHED;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2017-08-12 Thread Markus Mohrhard
 sc/inc/datamapper.hxx |2 +-
 sc/source/ui/dataprovider/csvdataprovider.cxx |7 +++
 sc/source/ui/dataprovider/dataprovider.cxx|   15 ++-
 sc/source/ui/inc/dataprovider.hxx |9 +
 4 files changed, 31 insertions(+), 2 deletions(-)

New commits:
commit e07bf6aadb301407add5d4c6fff73b3be8bd63a2
Author: Markus Mohrhard 
Date:   Sat Aug 12 19:11:02 2017 +0200

external data: avoid deadlock when the thread needs the SolarMutex

Change-Id: I222f2031dbd55515db63b1360c8248ec24e6c89d
Reviewed-on: https://gerrit.libreoffice.org/41092
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/ui/dataprovider/csvdataprovider.cxx 
b/sc/source/ui/dataprovider/csvdataprovider.cxx
index 4e2aea9cffa9..24450e0d4349 100644
--- a/sc/source/ui/dataprovider/csvdataprovider.cxx
+++ b/sc/source/ui/dataprovider/csvdataprovider.cxx
@@ -188,6 +188,7 @@ CSVDataProvider::~CSVDataProvider()
 {
 if (mxCSVFetchThread.is())
 {
+SolarMutexReleaser aReleaser;
 mxCSVFetchThread->join();
 }
 }
commit 32708687dbb496e6b8d74c806126f0f28a3ac2a2
Author: Markus Mohrhard 
Date:   Sat Aug 12 19:10:26 2017 +0200

external data: introduce a deterministic mode for the tests

Change-Id: I5804800216bd7d22b89a4e54d3f46cc3520f7c42
Reviewed-on: https://gerrit.libreoffice.org/41091
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/inc/datamapper.hxx b/sc/inc/datamapper.hxx
index b8216b0de0de..55390fc5a39b 100644
--- a/sc/inc/datamapper.hxx
+++ b/sc/inc/datamapper.hxx
@@ -87,7 +87,7 @@ public:
 OUString getDBName() const;
 void setDBData(ScDBData* pDBData);
 
-void refresh(ScDocument* pDoc);
+void refresh(ScDocument* pDoc, bool bDeterministic = false);
 };
 
 class SC_DLLPUBLIC ExternalDataMapper
diff --git a/sc/source/ui/dataprovider/csvdataprovider.cxx 
b/sc/source/ui/dataprovider/csvdataprovider.cxx
index cd87d21c3de4..4e2aea9cffa9 100644
--- a/sc/source/ui/dataprovider/csvdataprovider.cxx
+++ b/sc/source/ui/dataprovider/csvdataprovider.cxx
@@ -202,6 +202,12 @@ void CSVDataProvider::Import()
 mpDoc->ResetClip(mpDocument, (SCTAB)0);
 mxCSVFetchThread = new CSVFetchThread(*mpDoc, maURL, );
 mxCSVFetchThread->launch();
+
+if (mbDeterministic)
+{
+SolarMutexReleaser aReleaser;
+mxCSVFetchThread->join();
+}
 }
 
 IMPL_LINK_NOARG(CSVDataProvider, ImportFinishedHdl, Timer*, void)
diff --git a/sc/source/ui/dataprovider/dataprovider.cxx 
b/sc/source/ui/dataprovider/dataprovider.cxx
index 119dbdd18e9b..79b936f5d704 100644
--- a/sc/source/ui/dataprovider/dataprovider.cxx
+++ b/sc/source/ui/dataprovider/dataprovider.cxx
@@ -107,7 +107,7 @@ double ExternalDataSource::getUpdateFrequency() const
 return mnUpdateFrequency;
 }
 
-void ExternalDataSource::refresh(ScDocument* pDoc)
+void ExternalDataSource::refresh(ScDocument* pDoc, bool bDeterministic)
 {
 // no DB data available
 if (!mpDBDataManager)
@@ -121,6 +121,9 @@ void ExternalDataSource::refresh(ScDocument* pDoc)
 if (!mpDataProvider)
 return;
 
+if (bDeterministic)
+mpDataProvider->setDeterministic();
+
 mpDataProvider->Import();
 }
 
@@ -148,6 +151,16 @@ std::vector& 
ExternalDataMapper::getDataSources()
 return maDataSources;
 }
 
+DataProvider::DataProvider():
+mbDeterministic(false)
+{
+}
+
+void DataProvider::setDeterministic()
+{
+mbDeterministic = true;
+}
+
 DataProvider::~DataProvider()
 {
 }
diff --git a/sc/source/ui/inc/dataprovider.hxx 
b/sc/source/ui/inc/dataprovider.hxx
index 00fec69638fb..c45adc9616a1 100644
--- a/sc/source/ui/inc/dataprovider.hxx
+++ b/sc/source/ui/inc/dataprovider.hxx
@@ -76,7 +76,14 @@ public:
  */
 class DataProvider
 {
+protected:
+/**
+ * If true make the threaded import deterministic for the tests.
+ */
+bool mbDeterministic;
+
 public:
+DataProvider();
 virtual ~DataProvider() = 0;
 
 virtual void Import() = 0;
@@ -84,6 +91,8 @@ public:
 virtual const OUString& GetURL() const = 0;
 
 static std::unique_ptr FetchStreamFromURL(const OUString&, 
OStringBuffer& rBuffer);
+
+void setDeterministic();
 };
 
 class CSVDataProvider : public DataProvider
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

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

New commits:
commit b946ab02b246e85c34f8fa77d99e19dacda07fe5
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 

diff --git a/sc/inc/queryparam.hxx b/sc/inc/queryparam.hxx
index a96375a8002e..3b406bb49bc5 100644
--- a/sc/inc/queryparam.hxx
+++ b/sc/inc/queryparam.hxx
@@ -59,7 +59,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 72fa4919537e..c902d2796bd4 100644
--- a/sc/source/core/tool/queryparam.cxx
+++ b/sc/source/core/tool/queryparam.cxx
@@ -161,10 +161,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())
 {
@@ -173,7 +174,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 1de9b9533815..e54bf486f7d8 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -778,12 +778,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);
commit 7e728965b3f5a37a6f0bd75d616d2acb16c40f71
Author: Tamas Bunth 
Date:   Fri Aug 11 01:57:55 2017 +0200

tdf#107858 oovbaapi: Autofilter always has header

If AutoFilter created with vba macro, it should always use a header
(because Excel does the same), regardless of the type of cells in the
first row.

Change-Id: I586e092ac62c893b9873cc4b988566d8f00636cc
Reviewed-on: https://gerrit.libreoffice.org/40969
Tested-by: Jenkins 
Reviewed-by: Tamás Bunth 

diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index 5aae79fd6889..29944d78dccb 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -4438,13 +4438,7 @@ ScVbaRange::AutoFilter( const uno::Any& aField, const 
uno::Any& Criteria1, const
 xDBRangeProps->setPropertyValue( "AutoFilter", uno::Any(true) );
 // set header (autofilter always need column headers)
 uno::Reference< beans::XPropertySet > xFiltProps( 
xDataBaseRange->getFilterDescriptor(), uno::UNO_QUERY_THROW );
-bool bHasColHeader = false;
-ScDocument* pDoc = pShell ? >GetDocument() : nullptr;
-if (pDoc)
-{
-bHasColHeader = pDoc->HasColHeader(  static_cast< SCCOL >( 
autoFiltAddress.StartColumn ), 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2017-06-27 Thread Markus Mohrhard
 sc/inc/rangeutl.hxx|8 
 sc/inc/refupdatecontext.hxx|4 ++--
 sc/source/core/data/colorscale.cxx |1 +
 sc/source/core/tool/rangeutl.cxx   |   17 +
 4 files changed, 28 insertions(+), 2 deletions(-)

New commits:
commit 3d6b2fb2cdfbe6c06af8138b443f44f1140e8af6
Author: Markus Mohrhard 
Date:   Tue Jun 27 01:45:46 2017 +0200

add way to handle update refs for addresses, related tdf#107289

Change-Id: I97d1724d7aa1652619edda1cbe6a4ae4db277563
Reviewed-on: https://gerrit.libreoffice.org/39316
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/inc/rangeutl.hxx b/sc/inc/rangeutl.hxx
index 92ceaa99d84d..47cace7db2ad 100644
--- a/sc/inc/rangeutl.hxx
+++ b/sc/inc/rangeutl.hxx
@@ -269,6 +269,14 @@ public:
 bool WasDBName() const { return !bFirstPass; }
 };
 
+struct SC_DLLPUBLIC ScRangeUpdater
+{
+ScRangeUpdater() = delete;
+
+static void UpdateInsertTab(ScAddress& rAddr, const 
sc::RefUpdateInsertTabContext& rCxt);
+static void UpdateDeleteTab(ScAddress& rAddr, const 
sc::RefUpdateDeleteTabContext& rCxt);
+};
+
 #endif // INCLUDED_SC_INC_RANGEUTL_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/refupdatecontext.hxx b/sc/inc/refupdatecontext.hxx
index 2c47563dd34c..167eb0bec2d3 100644
--- a/sc/inc/refupdatecontext.hxx
+++ b/sc/inc/refupdatecontext.hxx
@@ -107,7 +107,7 @@ struct RefUpdateResult
 RefUpdateResult(const RefUpdateResult& r);
 };
 
-struct RefUpdateInsertTabContext
+struct SC_DLLPUBLIC RefUpdateInsertTabContext
 {
 ScDocument& mrDoc;
 SCTAB mnInsertPos;
@@ -117,7 +117,7 @@ struct RefUpdateInsertTabContext
 RefUpdateInsertTabContext(ScDocument& rDoc, SCTAB nInsertPos, SCTAB 
nSheets);
 };
 
-struct RefUpdateDeleteTabContext
+struct SC_DLLPUBLIC RefUpdateDeleteTabContext
 {
 ScDocument& mrDoc;
 SCTAB mnDeletePos;
diff --git a/sc/source/core/tool/rangeutl.cxx b/sc/source/core/tool/rangeutl.cxx
index 0d8ee77dd82d..872435378244 100644
--- a/sc/source/core/tool/rangeutl.cxx
+++ b/sc/source/core/tool/rangeutl.cxx
@@ -29,6 +29,7 @@
 #include "convuno.hxx"
 #include "externalrefmgr.hxx"
 #include "compiler.hxx"
+#include "refupdatecontext.hxx"
 
 using ::formula::FormulaGrammar;
 using namespace ::com::sun::star;
@@ -1014,4 +1015,20 @@ bool ScAreaNameIterator::Next( OUString& rName, ScRange& 
rRange )
 }
 }
 
+void ScRangeUpdater::UpdateInsertTab(ScAddress& rAddr, const 
sc::RefUpdateInsertTabContext& rCxt)
+{
+if (rCxt.mnInsertPos <= rAddr.Tab())
+{
+rAddr.IncTab(rCxt.mnSheets);
+}
+}
+
+void ScRangeUpdater::UpdateDeleteTab(ScAddress& rAddr, const 
sc::RefUpdateDeleteTabContext& rCxt)
+{
+if (rCxt.mnDeletePos <= rAddr.Tab())
+{
+rAddr.IncTab(-rCxt.mnSheets);
+}
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 87fa01674b1418c060b20a7f5af1d0d6eebe99cd
Author: Markus Mohrhard 
Date:   Tue Jun 27 00:36:32 2017 +0200

clear the lists with listened cells after we stop listening

Change-Id: I4bc21ff9085c0033f3ee16b7e22a73091d57c7a9
Reviewed-on: https://gerrit.libreoffice.org/39315
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/core/data/colorscale.cxx 
b/sc/source/core/data/colorscale.cxx
index 916143664b81..25a029024e28 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -127,6 +127,7 @@ void ScFormulaListener::stopListening()
 return;
 
 std::for_each(maCells.begin(), maCells.end(), StopListeningCell(mpDoc, 
this));
+maCells.clear();
 }
 
 ScFormulaListener::~ScFormulaListener()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2017-06-08 Thread Eike Rathke
 sc/inc/scmatrix.hxx   |   10 +-
 sc/source/ui/app/inputhdl.cxx |2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 27c5f2586821546ee8281bafb8b5f478ae015ac1
Author: Eike Rathke 
Date:   Thu Jun 8 20:39:00 2017 +0200

Add '~' reference union/list operator to range finder delimiters

... so formula expressions using it actually get the ranges highlighted.

Change-Id: Ibb0d2b49101e62b1f219a14d1669a501a450aaf4

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 3647a5633502..dfbd1c43bbb3 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -299,7 +299,7 @@ void ScInputHandler::InitRangeFinder( const OUString& 
rFormula )
 ScDocument& rDoc = pDocSh->GetDocument();
 const sal_Unicode cSheetSep = lcl_getSheetSeparator();
 
-OUString aDelimiters = ScEditUtil::ModifyDelimiters(" !\"");
+OUString aDelimiters = ScEditUtil::ModifyDelimiters(" !~\"");
 // delimiters (in addition to ScEditUtil): only characters that are
 // allowed in formulas next to references and the quotation mark (so
 // string constants can be skipped)
commit 5ac74f15dcdf85faa2ac1cb7317ea77e31fbcd50
Author: Eike Rathke 
Date:   Thu Jun 8 18:13:49 2017 +0200

Remove a TODO and explain

Change-Id: Ic648fd2b0a1424aa5ae5d924b29dfd2cb8dddbf9

diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx
index 886bbd86840a..553c09f0e416 100644
--- a/sc/inc/scmatrix.hxx
+++ b/sc/inc/scmatrix.hxx
@@ -133,11 +133,11 @@ public:
 /**
  * When adding all numerical matrix elements for a scalar result such as
  * summation, the interpreter wants to separate the first non-zero value
- * with the rest of the summed values.
- *
- * TODO: Find out if we still need to do this.  If not, we can re-write
- * ScInterpreter::IterateParameters() to make it simpler and remove this
- * struct.
+ * with the rest of the summed values. This is necessary for better
+ * numerical stability, unless we sort all by absolute values before
+ * summing (not really an option) or use another algorithm, e.g. Kahan's
+ * summation algorithm,
+ * https://en.wikipedia.org/wiki/Kahan_summation_algorithm
  */
 struct IterateResult
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2017-02-15 Thread Caolán McNamara
 sc/inc/pch/precompiled_sc.hxx  |1 
 sc/inc/strload.hxx |   45 
--
 sc/source/core/data/global.cxx |   20 +++-
 sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx|1 
 sc/source/ui/StatisticsDialogs/ChiSquareTestDialog.cxx |1 
 sc/source/ui/StatisticsDialogs/CorrelationDialog.cxx   |1 
 sc/source/ui/StatisticsDialogs/CovarianceDialog.cxx|1 
 sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx |1 
 sc/source/ui/StatisticsDialogs/ExponentialSmoothingDialog.cxx  |1 
 sc/source/ui/StatisticsDialogs/FTestDialog.cxx |1 
 sc/source/ui/StatisticsDialogs/MatrixComparisonGenerator.cxx   |1 
 sc/source/ui/StatisticsDialogs/MovingAverageDialog.cxx |1 
 sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx |1 
 sc/source/ui/StatisticsDialogs/RegressionDialog.cxx|1 
 sc/source/ui/StatisticsDialogs/SamplingDialog.cxx  |1 
 sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx |1 
 sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx |1 
 sc/source/ui/StatisticsDialogs/TTestDialog.cxx |1 
 sc/source/ui/StatisticsDialogs/ZTestDialog.cxx |1 
 sc/source/ui/cctrl/checklistmenu.cxx   |2 
 sc/source/ui/view/gridwin.cxx  |1 
 sc/source/ui/view/gridwin2.cxx |1 
 22 files changed, 18 insertions(+), 68 deletions(-)

New commits:
commit aff0a1d32242de794ab6bbae3cd35d208cbe876c
Author: Caolán McNamara 
Date:   Tue Feb 14 20:55:11 2017 +

move ScRscStrLoader to its sole use place

Change-Id: I8a5d4a23651868f9f3fa890cb50c0b64f58c63b7

diff --git a/sc/inc/pch/precompiled_sc.hxx b/sc/inc/pch/precompiled_sc.hxx
index 643a525..c5f20e5 100644
--- a/sc/inc/pch/precompiled_sc.hxx
+++ b/sc/inc/pch/precompiled_sc.hxx
@@ -440,7 +440,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sc/inc/strload.hxx b/sc/inc/strload.hxx
deleted file mode 100644
index aaff970..000
--- a/sc/inc/strload.hxx
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_SC_INC_STRLOAD_HXX
-#define INCLUDED_SC_INC_STRLOAD_HXX
-
-#include "scresid.hxx"
-#include 
-
-class ScRscStrLoader : public Resource
-{
-public:
-ScRscStrLoader( sal_uInt16 nRsc, sal_uInt16 nStrId ) :
-Resource( ScResId( nRsc ) ), theStr( ScResId( nStrId ) )
-{
-FreeResource();
-}
-
-const OUString& GetString() const { return theStr; }
-
-private:
-OUString theStr;
-};
-
-#define SC_STRLOAD(resource,strid) ScRscStrLoader( resource, strid).GetString()
-
-#endif // INCLUDED_SC_INC_STRLOAD_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index 6963bed..4e58714 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -69,7 +69,6 @@
 #include "adiasync.hxx"
 #include "userlist.hxx"
 #include "interpre.hxx"
-#include "strload.hxx"
 #include "docpool.hxx"
 #include "unitconv.hxx"
 #include "compiler.hxx"
@@ -311,6 +310,21 @@ void ScGlobal::SetUserList( const ScUserList* pNewList )
 }
 }
 
+class ScRscStrLoader : public Resource
+{
+public:
+ScRscStrLoader( sal_uInt16 nRsc, sal_uInt16 nStrId ) :
+Resource( ScResId( nRsc ) ), theStr( ScResId( nStrId ) )
+{
+FreeResource();
+}
+
+const OUString& GetString() const { return theStr; }
+
+private:
+OUString theStr;
+};
+
 const OUString& ScGlobal::GetRscString( sal_uInt16 nIndex )
 {
 assert( nIndex < SC_GLOBSTR_STR_COUNT);
@@ -345,9 +359,9 @@ const OUString& ScGlobal::GetRscString( sal_uInt16 nIndex )
 ;   // nothing
 }
 if (eOp != ocNone)
-ppRscString[ nIndex ] = new OUString( ScCompiler::GetNativeSymbol( 
eOp));
+   

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source svx/inc svx/source

2016-12-05 Thread Caolán McNamara
 sc/inc/sc.hrc |3 ++-
 sc/source/ui/app/scmod.cxx|6 ++
 sc/source/ui/styleui/scstyles.src |   12 +++-
 svx/inc/gallery.hrc   |4 ++--
 svx/source/gallery2/galbrws2.cxx  |4 ++--
 svx/source/gallery2/gallery.src   |8 
 6 files changed, 19 insertions(+), 18 deletions(-)

New commits:
commit 08f7304fa3ed174ea47e9c90a21ed64219b1a969
Author: Caolán McNamara 
Date:   Mon Dec 5 17:16:17 2016 +

drop these intermediate Images and use BitmapEx directly

Change-Id: Ief15df1722bb59323563c21d76f5af624fbef8c9

diff --git a/svx/inc/gallery.hrc b/svx/inc/gallery.hrc
index 659166d..b710d7c 100644
--- a/svx/inc/gallery.hrc
+++ b/svx/inc/gallery.hrc
@@ -58,8 +58,8 @@
 #define RID_SVXBMP_THEME_NORMAL (RID_SVX_GALLERY_START + 48)
 #define RID_SVXBMP_THEME_READONLY   (RID_SVX_GALLERY_START + 52)
 #define RID_SVXBMP_THEME_DEFAULT(RID_SVX_GALLERY_START + 54)
-#define RID_SVXIMG_GALLERY_VIEW_ICON(RID_SVX_GALLERY_START + 56)
-#define RID_SVXIMG_GALLERY_VIEW_LIST(RID_SVX_GALLERY_START + 57)
+#define RID_SVXBMP_GALLERY_VIEW_ICON(RID_SVX_GALLERY_START + 56)
+#define RID_SVXBMP_GALLERY_VIEW_LIST(RID_SVX_GALLERY_START + 57)
 
 // Gallery-Bitmaps fuer Sounds
 #define RID_SVXBMP_GALLERY_SOUND_1  (RID_SVX_GALLERY_START + 62)
diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx
index 7e4cdca..41ee2b8 100644
--- a/svx/source/gallery2/galbrws2.cxx
+++ b/svx/source/gallery2/galbrws2.cxx
@@ -1304,8 +1304,8 @@ IMPL_LINK_NOARG(GalleryBrowser2, MiscHdl, LinkParamNone*, 
void)
 {
 maViewBox->SetOutStyle( maMiscOptions.GetToolboxStyle() );
 
-BitmapEx aIconBmpEx = BitmapEx( Image( GAL_RES( 
RID_SVXIMG_GALLERY_VIEW_ICON ) ).GetBitmapEx() );
-BitmapEx aListBmpEx = BitmapEx( Image( GAL_RES( 
RID_SVXIMG_GALLERY_VIEW_LIST ) ).GetBitmapEx() );
+BitmapEx aIconBmpEx(GAL_RES(RID_SVXBMP_GALLERY_VIEW_ICON));
+BitmapEx aListBmpEx(GAL_RES(RID_SVXBMP_GALLERY_VIEW_LIST));
 
 if( maMiscOptions.AreCurrentSymbolsLarge() )
 {
diff --git a/svx/source/gallery2/gallery.src b/svx/source/gallery2/gallery.src
index abd82ce..bbea8503 100644
--- a/svx/source/gallery2/gallery.src
+++ b/svx/source/gallery2/gallery.src
@@ -178,14 +178,14 @@ Bitmap RID_SVXBMP_GALLERY_SOUND_7
 File = "galsnd7.png";
 };
 
-Image RID_SVXIMG_GALLERY_VIEW_ICON
+Bitmap RID_SVXBMP_GALLERY_VIEW_ICON
 {
-ImageBitmap = Bitmap { File = "galicon.png"; };
+File = "galicon.png";
 };
 
-Image RID_SVXIMG_GALLERY_VIEW_LIST
+Bitmap RID_SVXBMP_GALLERY_VIEW_LIST
 {
-ImageBitmap = Bitmap { File = "gallist.png"; };
+File = "gallist.png";
 };
 
 Menu RID_SVXMN_GALLERY1
commit e7a3a9104a4ab5709583b7506b0bd10ec6163fba
Author: Caolán McNamara 
Date:   Mon Dec 5 17:08:08 2016 +

unwind sc RID_STYLEFAMILY_IMAGELIST imagelist

Change-Id: I22bc4a615295bf43110633e22b5884b511777c2b

diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index 64ae387..d5b87c4 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -1093,7 +1093,8 @@
 
 #define RID_CELLSTYLEFAMILY (SC_DIALOGS_START + 138)
 #define RID_PAGESTYLEFAMILY (SC_DIALOGS_START + 139)
-#define RID_STYLEFAMILY_IMAGELIST   (SC_DIALOGS_START + 140)
+#define BMP_STYLES_FAMILY_CELL  (SC_DIALOGS_START + 140)
+#define BMP_STYLES_FAMILY_PAGE  (SC_DIALOGS_START + 141)
 
 #define RID_POPUP_FILTER(SC_DIALOGS_START + 153)
 
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 99e59de..ff0b4c95 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -2274,16 +2274,14 @@ SfxStyleFamilies* ScModule::CreateStyleFamilies()
 {
 SfxStyleFamilies *pStyleFamilies = new SfxStyleFamilies;
 
-ImageList aEntryImages(ScResId(RID_STYLEFAMILY_IMAGELIST));
-
 pStyleFamilies->emplace_back(SfxStyleFamilyItem(SfxStyleFamily::Para,
 
ScGlobal::GetRscString(STR_STYLE_FAMILY_CELL),
-aEntryImages.GetImage(1),
+
Image(BitmapEx(ScResId(BMP_STYLES_FAMILY_CELL))),
 
ScResId(RID_CELLSTYLEFAMILY)));
 
 pStyleFamilies->emplace_back(SfxStyleFamilyItem(SfxStyleFamily::Page,
 
ScGlobal::GetRscString(STR_STYLE_FAMILY_PAGE),
-aEntryImages.GetImage(2),
+
Image(BitmapEx(ScResId(BMP_STYLES_FAMILY_PAGE))),
 
ScResId(RID_PAGESTYLEFAMILY)));
 
 return pStyleFamilies;
diff --git a/sc/source/ui/styleui/scstyles.src 
b/sc/source/ui/styleui/scstyles.src
index 2502cee..60f304b 100644
--- 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source sc/uiconfig sc/UIConfig_scalc.mk

2016-10-05 Thread Caolán McNamara
 sc/UIConfig_scalc.mk |1 
 sc/inc/sc.hrc|7 
 sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx |8 
 sc/source/ui/sidebar/CellAppearancePropertyPanel.hrc |   70 
 sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx |   27 -
 sc/source/ui/sidebar/CellAppearancePropertyPanel.src |  205 --
 sc/source/ui/sidebar/CellBorderStyleControl.cxx  |  225 +--
 sc/source/ui/sidebar/CellBorderStyleControl.hxx  |   10 
 sc/source/ui/sidebar/CellLineStyleControl.cxx|1 
 sc/uiconfig/scalc/ui/floatingborderstyle.ui  |  271 +++
 sc/uiconfig/scalc/ui/floatinglinestyle.ui|1 
 11 files changed, 361 insertions(+), 465 deletions(-)

New commits:
commit 768e132ed82cbe73cb4ec0152a421db699f740f3
Author: Caolán McNamara 
Date:   Wed Oct 5 13:24:49 2016 +0100

grab focus to border style popup

Change-Id: I8943f78721386efaeb5bc23fca612504e4c54431

diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx 
b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
index ac57705..a2d798b 100644
--- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
+++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
@@ -156,8 +156,7 @@ IMPL_LINK(CellAppearancePropertyPanel, 
TbxCellBorderSelectHdl, ToolBox*, pToolBo
 {
 if (!mxCellBorderStylePopup)
 mxCellBorderStylePopup = 
VclPtr::Create(GetBindings()->GetDispatcher());
-mxCellBorderStylePopup->StartPopupMode(pToolBox, 
FloatWinPopupFlags::Down |
- 
FloatWinPopupFlags::NoAppFocusClose);
+mxCellBorderStylePopup->StartPopupMode(pToolBox, 
FloatWinPopupFlags::GrabFocus);
 }
 }
 
commit 5227af2e4580e478eb92eaab8a42fc188c0fddbb
Author: Caolán McNamara 
Date:   Wed Oct 5 12:39:08 2016 +0100

convert border style to .ui

and merge CellBorderStylePopup and CellBorderStyleControl

Change-Id: I96ca2784f2055e8d99380b4d4bcd1374c9c40f4e

diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk
index 41555ec..b8e8c9c5 100644
--- a/sc/UIConfig_scalc.mk
+++ b/sc/UIConfig_scalc.mk
@@ -125,6 +125,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\
sc/uiconfig/scalc/ui/footerdialog \
sc/uiconfig/scalc/ui/formatcellsdialog \
sc/uiconfig/scalc/ui/formulacalculationoptions \
+   sc/uiconfig/scalc/ui/floatingborderstyle \
sc/uiconfig/scalc/ui/floatinglinestyle \
sc/uiconfig/scalc/ui/goalseekdlg \
sc/uiconfig/scalc/ui/groupdialog \
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index 048111c..693d1fe 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -1088,12 +1088,9 @@
 
 #define RID_SCDLG_COND_FORMAT_MANAGER   (SC_DIALOGS_START + 159)
 
-// defines for CellAppearancePropertyPanel
-#define RID_POPUPPANEL_APPEARANCE_CELL_BORDERSTYLE (SC_DIALOGS_START + 163)
+#define WID_CONDFRMT_REF(SC_DIALOGS_START + 163)
 
-#define WID_CONDFRMT_REF(SC_DIALOGS_START + 164)
-
-#define SC_DIALOGS_END  
(RID_POPUPPANEL_APPEARANCE_CELL_BORDERSTYLE + 1)
+#define SC_DIALOGS_END  (WID_CONDFRMT_REF + 1)
 
 #ifndef STD_MASKCOLOR
 #define STD_MASKCOLOR Color { Red = 0xFF00; Green = 0x; Blue = 0xFF00; }
diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx 
b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
index 0915add..ac57705 100644
--- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
+++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
@@ -21,7 +21,6 @@
 #include 
 #include 
 #include "CellAppearancePropertyPanel.hxx"
-#include 
 #include "sc.hrc"
 #include "scresid.hxx"
 #include 
@@ -91,10 +90,8 @@ CellAppearancePropertyPanel::CellAppearancePropertyPanel(
 mbInnerBorder(false),
 mbTLBR(false),
 mbBLTR(false),
-
 mxCellLineStylePopup(),
 mxCellBorderStylePopup(),
-
 maContext(),
 mpBindings(pBindings)
 {
@@ -158,7 +155,7 @@ IMPL_LINK(CellAppearancePropertyPanel, 
TbxCellBorderSelectHdl, ToolBox*, pToolBo
 if (aCommand == UNO_SETBORDERSTYLE)
 {
 if (!mxCellBorderStylePopup)
-mxCellBorderStylePopup = 
VclPtr::Create(pToolBox, GetBindings()->GetDispatcher());
+mxCellBorderStylePopup = 
VclPtr::Create(GetBindings()->GetDispatcher());
 mxCellBorderStylePopup->StartPopupMode(pToolBox, 
FloatWinPopupFlags::Down |
  
FloatWinPopupFlags::NoAppFocusClose);
 }
diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hrc 
b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hrc
deleted file mode 100644
index aece513..000
--- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hrc
+++ /dev/null
@@ -1,70 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2016-05-31 Thread Marco Cecchetti
 sc/inc/column.hxx|1 +
 sc/inc/document.hxx  |1 +
 sc/inc/table.hxx |1 +
 sc/inc/tokenarray.hxx|1 +
 sc/source/core/data/column.cxx   |   29 +
 sc/source/core/data/document.cxx |   13 +
 sc/source/core/data/table2.cxx   |8 
 sc/source/core/tool/scmatrix.cxx |4 
 sc/source/ui/unoobj/docuno.cxx   |9 +
 9 files changed, 67 insertions(+)

New commits:
commit b933f9b817d8449a87841e413cbe96ce31a63555
Author: Marco Cecchetti 
Date:   Tue May 31 10:42:06 2016 +0200

tdf#84411 - OpenCL: S/W interpreter throws std::out_of_range error

The problem is that in an array fragment, row start can be beyond data
row end.

Change-Id: I33658c87c21d1be237f4675241e3eabdd4ec7058

diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 1689809..4aa0993 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -3362,6 +3362,10 @@ void ScVectorRefMatrix::ensureFullMatrix()
 size_t nRowSize = mnRowSize;
 size_t nRowEnd = mnRowStart + mnRowSize;
 size_t nDataRowEnd = mpToken->GetArrayLength();
+
+if (mnRowStart >= nDataRowEnd)
+return;
+
 if (nRowEnd > nDataRowEnd)
 {
 // Data array is shorter than the row size of the reference. Truncate
commit b75670009ca885869aa6b58ac33766808e23653c
Author: Marco Cecchetti 
Date:   Thu May 26 21:28:35 2016 +0200

tdf#100160 - Changing OpenCL state doesn't update sheet

now we re-check for vectorization state of formula token each time
OpenCL is enabled or disabled

Change-Id: I652397dd154f5fbf788cb511c70e53a47cc94293

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 9754e5a..68fb09c 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -377,6 +377,7 @@ public:
 
 bool IsFormulaDirty( SCROW nRow ) const;
 
+void CheckVectorizationState();
 void SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt );
 void SetDirtyFromClip( SCROW nRow1, SCROW nRow2, sc::ColumnSpanSet& 
rBroadcastSpans );
 void SetDirty( SCROW nRow1, SCROW nRow2, BroadcastMode );
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 5696f26..e0237ac 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1162,6 +1162,7 @@ public:
 
 voidResetChanged( const ScRange& rRange );
 
+void CheckVectorizationState();
 void SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt );
 voidSetDirty( const ScRange&, bool bIncludeEmptyCells );
 voidSetTableOpDirty( const ScRange& );  // for Interpreter 
TableOp
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index a284d27..0f0887e 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -531,6 +531,7 @@ public:
 
 voidResetChanged( const ScRange& rRange );
 
+void CheckVectorizationState();
 void SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt );
 voidSetDirty( const ScRange&, ScColumn::BroadcastMode );
 voidSetDirtyAfterLoad();
diff --git a/sc/inc/tokenarray.hxx b/sc/inc/tokenarray.hxx
index a69f624..7606431 100644
--- a/sc/inc/tokenarray.hxx
+++ b/sc/inc/tokenarray.hxx
@@ -65,6 +65,7 @@ public:
 size_t GetHash() const { return mnHashValue;}
 
 ScFormulaVectorState GetVectorState() const { return meVectorState;}
+void ResetVectorState() { meVectorState = FormulaVectorEnabled; }
 
 /**
  * If the array contains at least one relative row reference or named
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index f846028..8b6d1aa 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -2648,6 +2648,28 @@ public:
 }
 };
 
+class CheckVectorizationHandler
+{
+public:
+CheckVectorizationHandler()
+{}
+
+void operator() (size_t /*nRow*/, ScFormulaCell* p)
+{
+ScTokenArray* pCode = p->GetCode();
+if (pCode != nullptr && pCode->GetVectorState() == 
FormulaVectorDisabled)
+{
+pCode->ResetVectorState();
+FormulaToken* pFT = pCode->First();
+while (pFT != nullptr)
+{
+pCode->CheckToken(*pFT);
+pFT = pCode->Next();
+}
+}
+}
+};
+
 struct SetDirtyVarHandler
 {
 void operator() (size_t /*nRow*/, ScFormulaCell* p)
@@ -3093,6 +3115,13 @@ bool ScColumn::IsFormulaDirty( SCROW nRow ) const
 return p->GetDirty();
 }
 
+void ScColumn::CheckVectorizationState()
+{
+sc::AutoCalcSwitch aSwitch(*pDocument, false);
+CheckVectorizationHandler aFunc;
+sc::ProcessFormula(maCells, aFunc);
+}
+
 void ScColumn::SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt )
 {
 // is only done documentwide, no FormulaTracking
diff --git a/sc/source/core/data/document.cxx 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2016-05-10 Thread Jan Holesovsky
 sc/inc/document.hxx  |2 +-
 sc/source/core/data/documen2.cxx |   31 +--
 sc/source/ui/unoobj/docuno.cxx   |6 +-
 sc/source/ui/view/gridwin4.cxx   |4 +---
 sc/source/ui/view/tabview.cxx|2 --
 sc/source/ui/view/tabview3.cxx   |   11 ++-
 6 files changed, 38 insertions(+), 18 deletions(-)

New commits:
commit 6928136177a4caebfdc01d5f0c1106fa8e1683fa
Author: Jan Holesovsky 
Date:   Tue May 10 11:49:41 2016 +0200

sc lok: Extend the spreadsheet area when we are "close enough" to the end.

We can tweak later what the "close enough" means - for the moment it is 10
columns and 25 rows.

Change-Id: I92127a71aa6683c03692e96b9e0da7827942c94b

diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index a2ac002..9315d95 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -302,16 +302,17 @@ void ScTabView::SetCursor( SCCOL nPosX, SCROW nPosY, bool 
bNew )
 
 if (comphelper::LibreOfficeKit::isActive())
 {
-if ( nPosX > aViewData.GetMaxTiledCol() || nPosY > 
aViewData.GetMaxTiledRow() )
+if (nPosX > aViewData.GetMaxTiledCol() - 10 || nPosY > 
aViewData.GetMaxTiledRow() - 25)
 {
-aViewData.SetMaxTiledCol( std::max( nPosX, 
aViewData.GetMaxTiledCol() ) );
-aViewData.SetMaxTiledRow( std::max( nPosY, 
aViewData.GetMaxTiledRow() ) );
+if (nPosX > aViewData.GetMaxTiledCol() - 10)
+aViewData.SetMaxTiledCol(std::max(nPosX, 
aViewData.GetMaxTiledCol()) + 10);
+
+if (nPosY > aViewData.GetMaxTiledRow() - 25)
+aViewData.SetMaxTiledRow(std::max(nPosY, 
aViewData.GetMaxTiledRow()) + 25);
 
 ScDocShell* pDocSh = aViewData.GetDocShell();
 if (pDocSh)
-{
 
pDocSh->libreOfficeKitCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, "");
-}
 }
 }
 }
commit 5ab5c19b13bfb35eaf84e8ea5863b30d47cb515a
Author: Jan Holesovsky 
Date:   Tue May 10 10:50:13 2016 +0200

sc lok: Move the handling of the area back to GetTiledRenderingArea().

Change-Id: I4dbfc090ab43065c719f83b5355cd9832ee4d1e3

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 05b93f3..2120405 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1289,7 +1289,7 @@ public:
 voidInvalidateTableArea();
 
 /// Return the number of columns / rows that should be visible for the 
tiled rendering.
-SC_DLLPUBLIC bool   GetTiledRenderingArea(SCTAB nTab, SCCOL& 
rEndCol, SCROW& rEndRow) const;
+SC_DLLPUBLIC void   GetTiledRenderingArea(SCTAB nTab, SCCOL& 
rEndCol, SCROW& rEndRow) const;
 
 SC_DLLPUBLIC bool   GetDataStart( SCTAB nTab, SCCOL& rStartCol, 
SCROW& rStartRow ) const;
 
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index a56a0a3..77be2de 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -84,6 +84,7 @@
 #include "externalrefmgr.hxx"
 #include "appoptio.hxx"
 #include "scmod.hxx"
+#include "../../ui/inc/viewdata.hxx"
 #include "../../ui/inc/viewutil.hxx"
 #include "tabprotection.hxx"
 #include "formulaparserpool.hxx"
@@ -697,9 +698,35 @@ bool ScDocument::GetDataStart( SCTAB nTab, SCCOL& 
rStartCol, SCROW& rStartRow )
 return false;
 }
 
-bool ScDocument::GetTiledRenderingArea(SCTAB nTab, SCCOL& rEndCol, SCROW& 
rEndRow) const
+void ScDocument::GetTiledRenderingArea(SCTAB nTab, SCCOL& rEndCol, SCROW& 
rEndRow) const
 {
-return GetPrintArea(nTab, rEndCol, rEndRow, false);
+bool bHasPrintArea = GetPrintArea(nTab, rEndCol, rEndRow, false);
+
+// we need some reasonable minimal document size
+ScViewData* pViewData = ScDocShell::GetViewData();
+if (!pViewData)
+{
+if (!bHasPrintArea)
+{
+rEndCol = 20;
+rEndRow = 50;
+}
+else
+{
+rEndCol += 20;
+rEndRow += 50;
+}
+}
+else if (!bHasPrintArea)
+{
+rEndCol = pViewData->GetMaxTiledCol();
+rEndRow = pViewData->GetMaxTiledRow();
+}
+else
+{
+rEndCol = std::max(rEndCol, pViewData->GetMaxTiledCol());
+rEndRow = std::max(rEndRow, pViewData->GetMaxTiledRow());
+}
 }
 
 bool ScDocument::MoveTab( SCTAB nOldPos, SCTAB nNewPos, ScProgress* pProgress )
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 7aeb40c..064c8b6 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -543,11 +543,7 @@ Size ScModelObj::getDocumentSize()
 SCROW nEndRow = 0;
 const ScDocument& rDoc = pDocShell->GetDocument();
 
-if (!rDoc.GetTiledRenderingArea(nTab, nEndCol, nEndRow))
-return aSize;
-
-nEndCol = 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2016-04-25 Thread Eike Rathke
 sc/inc/conditio.hxx  |4 +++-
 sc/source/core/data/conditio.cxx |6 +-
 sc/source/core/data/validat.cxx  |4 ++--
 sc/source/filter/excel/xecontent.cxx |   14 +++---
 4 files changed, 17 insertions(+), 11 deletions(-)

New commits:
commit 4613f38c50c719bef36190246e1d13558b4ecbc0
Author: Eike Rathke 
Date:   Mon Apr 25 22:43:03 2016 +0200

comment flat copy sharing code tokens

Change-Id: I80f8f7cc8f812fe412346876593c11aa221cb1b9

diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 49b0f3a..e1a42f8 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -468,12 +468,16 @@ void ScConditionEntry::MakeCells( const ScAddress& rPos )
 {
 if ( pFormula1 && !pFCell1 && !bRelRef1 )
 {
+// pFCell1 will hold a flat-copied ScTokenArray sharing ref-counted
+// code tokens with pFormula1
 pFCell1 = new ScFormulaCell(mpDoc, rPos, *pFormula1);
 pFCell1->StartListeningTo( mpDoc );
 }
 
 if ( pFormula2 && !pFCell2 && !bRelRef2 )
 {
+// pFCell2 will hold a flat-copied ScTokenArray sharing ref-counted
+// code tokens with pFormula2
 pFCell2 = new ScFormulaCell(mpDoc, rPos, *pFormula2);
 pFCell2->StartListeningTo( mpDoc );
 }
commit 403d0d4a5452f2b31edd89d67fbcc532fd7fbf5a
Author: Eike Rathke 
Date:   Mon Apr 25 22:00:27 2016 +0200

be explicit about what it does, CreateFlatCopiedTokenArray()

Change-Id: I3652e4e46f85343488fb77bc4169bf6825086cf4

diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx
index 3bf6a14..a982594 100644
--- a/sc/inc/conditio.hxx
+++ b/sc/inc/conditio.hxx
@@ -254,7 +254,9 @@ public:
 OUString  GetExpression( const ScAddress& rCursor, sal_uInt16 
nPos, sal_uLong nNumFmt = 0,
 const formula::FormulaGrammar::Grammar 
eGrammar = formula::FormulaGrammar::GRAM_DEFAULT ) const;
 
-ScTokenArray*   CreateTokenArry( sal_uInt16 nPos ) const;
+/** Create a flat copy using ScTokenArray copy-ctor with
+shared tokens. */
+ScTokenArray*   CreateFlatCopiedTokenArray( sal_uInt16 nPos ) const;
 
 voidCompileAll();
 voidCompileXML();
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 8cbc8ef..49b0f3a 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -1366,7 +1366,7 @@ OUString ScConditionEntry::GetExpression( const 
ScAddress& rCursor, sal_uInt16 n
 return aRet;
 }
 
-ScTokenArray* ScConditionEntry::CreateTokenArry( sal_uInt16 nIndex ) const
+ScTokenArray* ScConditionEntry::CreateFlatCopiedTokenArray( sal_uInt16 nIndex 
) const
 {
 assert(nIndex <= 1);
 ScTokenArray* pRet = nullptr;
diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx
index 953af5c..803140d 100644
--- a/sc/source/core/data/validat.cxx
+++ b/sc/source/core/data/validat.cxx
@@ -811,7 +811,7 @@ bool 
ScValidationData::FillSelectionList(std::vector& rStrColl,
 
 if( HasSelectionList() )
 {
-std::unique_ptr pTokArr( CreateTokenArry(0) );
+std::unique_ptr pTokArr( CreateFlatCopiedTokenArray(0) );
 
 // *** try if formula is a string list ***
 
@@ -864,7 +864,7 @@ bool ScValidationData::IsListValid( ScRefCellValue& rCell, 
const ScAddress& rPos
 5)  A formula resulting in a cell/range reference or matrix/array.
 */
 
-std::unique_ptr< ScTokenArray > pTokArr( CreateTokenArry( 0 ) );
+std::unique_ptr< ScTokenArray > pTokArr( CreateFlatCopiedTokenArray( 0 ) );
 
 // *** try if formula is a string list ***
 
diff --git a/sc/source/filter/excel/xecontent.cxx 
b/sc/source/filter/excel/xecontent.cxx
index 0623f18..1a5ce8d 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -701,12 +701,12 @@ void XclExpCFImpl::WriteBody( XclExpStream& rStrm )
 
 XclExpFormulaCompiler& rFmlaComp = GetFormulaCompiler();
 
-std::unique_ptr< ScTokenArray > xScTokArr( mrFormatEntry.CreateTokenArry( 
0 ) );
+std::unique_ptr< ScTokenArray > xScTokArr( 
mrFormatEntry.CreateFlatCopiedTokenArray( 0 ) );
 mxTokArr1 = rFmlaComp.CreateFormula( EXC_FMLATYPE_CONDFMT, *xScTokArr );
 
 if (mbFormula2)
 {
-xScTokArr.reset( mrFormatEntry.CreateTokenArry( 1 ) );
+xScTokArr.reset( mrFormatEntry.CreateFlatCopiedTokenArray( 1 ) );
 mxTokArr2 = rFmlaComp.CreateFormula( EXC_FMLATYPE_CONDFMT, *xScTokArr 
);
 }
 
@@ -944,7 +944,7 @@ void XclExpCFImpl::SaveXml( XclExpXmlStream& rStrm )
 // we need to write the text without quotes
 // we have to actually get the string from
 // the token array for that
-std::unique_ptr 
pTokenArray(mrFormatEntry.CreateTokenArry(0));
+

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2016-03-27 Thread Markus Mohrhard
 sc/inc/colorscale.hxx|7 ++-
 sc/inc/document.hxx  |8 +++-
 sc/source/ui/view/output.cxx |4 ++--
 3 files changed, 11 insertions(+), 8 deletions(-)

New commits:
commit c90f1f339330644ec34c76247b5c299a18d318b4
Author: Markus Mohrhard 
Date:   Sun Mar 27 03:25:45 2016 +0200

mark the reference as const

Change-Id: I66ee342205acb9875899af9a65da9eb9cd5ecc74

diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index e4c722f..7997abd 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -873,7 +873,7 @@ void drawDataBars(vcl::RenderContext& rRenderContext, const 
ScDataBarInfo* pOldD
 }
 }
 
-BitmapEx& getIcon(sc::IconSetBitmapMap & rIconSetBitmapMap, ScIconSetType 
eType, sal_Int32 nIndex)
+const BitmapEx& getIcon(sc::IconSetBitmapMap & rIconSetBitmapMap, 
ScIconSetType eType, sal_Int32 nIndex)
 {
 return ScIconSetFormat::getBitmap(rIconSetBitmapMap, eType, nIndex);
 }
@@ -884,7 +884,7 @@ void drawIconSets(vcl::RenderContext& rRenderContext, const 
ScIconSetInfo* pOldI
 //long nSize = 16;
 ScIconSetType eType = pOldIconSetInfo->eIconSetType;
 sal_Int32 nIndex = pOldIconSetInfo->nIconIndex;
-BitmapEx& rIcon = getIcon(rIconSetBitmapMap, eType, nIndex);
+const BitmapEx& rIcon = getIcon(rIconSetBitmapMap, eType, nIndex);
 long aOrigSize = std::max(0,std::min(rRect.GetSize().getWidth() - 4 
* nOneX, rRect.GetSize().getHeight() -4 * nOneY));
 rRenderContext.DrawBitmapEx( Point( rRect.Left() + 2 * nOneX, rRect.Top() 
+ 2 * nOneY), Size(aOrigSize, aOrigSize), rIcon );
 }
commit 82510829d5be4321166ae80679b43b376f41ae9e
Author: Markus Mohrhard 
Date:   Sun Mar 27 03:12:02 2016 +0200

don't inherit from std::map

Change-Id: I50e9b27c45f6f7bd52af9e0c8a188124d6413cbc

diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx
index 992b532..96a05ee 100644
--- a/sc/inc/colorscale.hxx
+++ b/sc/inc/colorscale.hxx
@@ -14,6 +14,7 @@
 #include 
 #include "rangelst.hxx"
 #include "conditio.hxx"
+#include "document.hxx"
 
 #include 
 #include 
@@ -26,10 +27,6 @@ class ScTokenArray;
 struct ScDataBarInfo;
 class BitmapEx;
 
-namespace sc {
-class IconSetBitmapMap : public std::map {};
-}
-
 // don't change the order
 // they are also used in the dialog to determine the position
 // in the list box
@@ -375,7 +372,7 @@ public:
 virtual condformat::ScFormatEntryType GetType() const override;
 
 static ScIconSetMap* getIconSetMap();
-static BitmapEx& getBitmap(sc::IconSetBitmapMap &, ScIconSetType eType, 
sal_Int32 nIndex);
+static BitmapEx& getBitmap(sc::IconSetBitmapMap& rBitmapMap, ScIconSetType 
eType, sal_Int32 nIndex);
 
 typedef ScIconSetFormatData::Entries_t::iterator iterator;
 typedef ScIconSetFormatData::Entries_t::const_iterator const_iterator;
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 6c313a9..8caca17 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -79,7 +79,6 @@ class RefMovedHint;
 struct SortUndoParam;
 struct ReorderParam;
 class FormulaGroupAreaListener;
-class IconSetBitmapMap;
 
 }
 
@@ -190,6 +189,13 @@ class ScHint;
 class SvtBroadcaster;
 enum class ScDBDataPortion;
 enum class ScSheetEventId;
+class BitmapEx;
+
+namespace sc {
+
+typedef std::map IconSetBitmapMap;
+
+}
 
 namespace com { namespace sun { namespace star {
 namespace lang {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2016-03-14 Thread Markus Mohrhard
 sc/inc/textuno.hxx  |6 --
 sc/source/filter/excel/xeextlst.cxx |3 +--
 sc/source/ui/unoobj/textuno.cxx |7 ++-
 3 files changed, 7 insertions(+), 9 deletions(-)

New commits:
commit 7cdf055109d75ce37611bd0c4f796d67614d93d2
Author: Markus Mohrhard 
Date:   Mon Mar 14 07:15:34 2016 +0100

use unique_ptr for memory owning ptr

Change-Id: I26efcebf750ff9947b936e990ce87ddbcb41b7ba

diff --git a/sc/inc/textuno.hxx b/sc/inc/textuno.hxx
index 8629758..ef98720 100644
--- a/sc/inc/textuno.hxx
+++ b/sc/inc/textuno.hxx
@@ -33,6 +33,8 @@
 #include 
 #include "scdllapi.h"
 
+#include 
+
 #include 
 
 class EditEngine;
@@ -111,7 +113,7 @@ public:
 class ScHeaderFooterTextData : private boost::noncopyable
 {
 private:
-EditTextObject* mpTextObj;
+std::unique_ptr mpTextObj;
 rtl::Reference rContentObj;
 sal_uInt16  nPart;
 ScEditEngineDefaulter*  pEditEngine;
@@ -132,7 +134,7 @@ public:
 sal_uInt16  GetPart() const { return nPart; }
 rtl::Reference GetContentObj() const { return 
rContentObj; }
 
-const EditTextObject* GetTextObject() const { return mpTextObj; }
+const EditTextObject* GetTextObject() const { return mpTextObj.get(); }
 
 void dispose() { rContentObj.clear(); }
 };
diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx
index 0578c1f..f960d87 100644
--- a/sc/source/ui/unoobj/textuno.cxx
+++ b/sc/source/ui/unoobj/textuno.cxx
@@ -198,7 +198,6 @@ ScHeaderFooterTextData::~ScHeaderFooterTextData()
 
 delete pForwarder;
 delete pEditEngine;
-delete mpTextObj;
 }
 
 SvxTextForwarder* ScHeaderFooterTextData::GetTextForwarder()
@@ -247,15 +246,13 @@ void ScHeaderFooterTextData::UpdateData()
 {
 if (pEditEngine)
 {
-delete mpTextObj;
-mpTextObj = pEditEngine->CreateTextObject();
+mpTextObj.reset(pEditEngine->CreateTextObject());
 }
 }
 
 void ScHeaderFooterTextData::UpdateData(EditEngine& rEditEngine)
 {
-delete mpTextObj;
-mpTextObj = rEditEngine.CreateTextObject();
+mpTextObj.reset(rEditEngine.CreateTextObject());
 bDataValid = false;
 }
 
commit 82ed61ab269eca25c8bc22537327e812efe222bb
Author: Markus Mohrhard 
Date:   Sun Mar 13 23:45:45 2016 +0100

fix memory leak in cond format xlsx export

Change-Id: I0f11b30b33abf029f56ccbd8c0eb95b0acd35df4

diff --git a/sc/source/filter/excel/xeextlst.cxx 
b/sc/source/filter/excel/xeextlst.cxx
index 16f0cc4..c8f9d8b 100644
--- a/sc/source/filter/excel/xeextlst.cxx
+++ b/sc/source/filter/excel/xeextlst.cxx
@@ -101,8 +101,7 @@ XclExpExtCfvo::XclExpExtCfvo( const XclExpRoot& rRoot, 
const ScColorScaleEntry&
 OUString aFormula;
 if(pArr)
 {
-aFormula = XclXmlUtils::ToOUString( GetCompileFormulaContext(), 
rSrcPos,
-pArr->Clone());
+aFormula = XclXmlUtils::ToOUString( GetCompileFormulaContext(), 
rSrcPos, pArr);
 }
 maValue = OUStringToOString(aFormula, RTL_TEXTENCODING_UTF8 );
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2016-03-11 Thread Miklos Vajna
 sc/inc/clipoptions.hxx   |   25 +
 sc/inc/document.hxx  |5 +
 sc/source/core/data/documen2.cxx |1 +
 sc/source/core/data/documen3.cxx |7 +++
 sc/source/ui/view/cliputil.cxx   |   29 ++---
 sc/source/ui/view/viewfun3.cxx   |   12 
 6 files changed, 76 insertions(+), 3 deletions(-)

New commits:
commit e75979eaed5c417da5f33f7259f070afbaa674b8
Author: Miklos Vajna 
Date:   Fri Mar 11 13:40:59 2016 +0100

sc: handle classification during copy

This is the same feature as done for sw and sd internal copy already.

Change-Id: I6b8bd1228510fb2fb65ed1c2ab5e8307c38664b2

diff --git a/sc/source/ui/view/cliputil.cxx b/sc/source/ui/view/cliputil.cxx
index bb4fc02..c79d173 100644
--- a/sc/source/ui/view/cliputil.cxx
+++ b/sc/source/ui/view/cliputil.cxx
@@ -15,12 +15,34 @@
 #include "dpobject.hxx"
 #include "globstr.hrc"
 #include "clipparam.hxx"
+#include "clipoptions.hxx"
 #include "rangelst.hxx"
 #include "viewutil.hxx"
 #include "markdata.hxx"
 #include 
 
 #include 
+#include 
+
+namespace
+{
+
+/// Paste only if SfxClassificationHelper recommends so.
+bool lcl_checkClassification(ScDocument* pSourceDoc, ScDocument* 
pDestinationDoc)
+{
+if (!pSourceDoc || !pDestinationDoc)
+return true;
+
+ScClipOptions* pSourceOptions = pSourceDoc->GetClipOptions();
+SfxObjectShell* pDestinationShell = pDestinationDoc->GetDocumentShell();
+if (!pSourceOptions || !pDestinationShell)
+return true;
+
+SfxClassificationCheckPasteResult eResult = 
SfxClassificationHelper::CheckPaste(pSourceOptions->m_xDocumentProperties, 
pDestinationShell->getDocProperties());
+return SfxClassificationHelper::ShowPasteInfo(eResult);
+}
+
+}
 
 void ScClipUtil::PasteFromClipboard( ScViewData* pViewData, ScTabViewShell* 
pTabViewShell, bool bShowDialog )
 {
@@ -64,9 +86,10 @@ void ScClipUtil::PasteFromClipboard( ScViewData* pViewData, 
ScTabViewShell* pTab
 // For multi-range paste, we paste values by default.
 nFlags &= ~InsertDeleteFlags::FORMULA;
 
-pTabViewShell->PasteFromClip( nFlags, pClipDoc,
-ScPasteFunc::NONE, false, false, false, INS_NONE, 
InsertDeleteFlags::NONE,
-bShowDialog );  // allow warning dialog
+if (lcl_checkClassification(pClipDoc, pThisDoc))
+pTabViewShell->PasteFromClip( nFlags, pClipDoc,
+ScPasteFunc::NONE, false, false, false, INS_NONE, 
InsertDeleteFlags::NONE,
+bShowDialog );  // allow warning dialog
 }
 }
 pTabViewShell->CellContentChanged();// => PasteFromSystem() ???
commit 9db5512084bb0df58322d755b7b1770a9779ab57
Author: Miklos Vajna 
Date:   Fri Mar 11 11:17:42 2016 +0100

sc: make metadata available in copy result

Calc had the same problem as Writer: metadata is part of the doc shell,
but the clipboard document has no doc shell. So need to store this info
in ScDocument in some way in the clipboard case.

10:45 <@moggi> vmiklos: I would most likely add a ScClipOptions similar to 
ScDocOptions and only populate it in the clip document

Change-Id: I4ad01faa55cfb6fb58213d67003c8c0f9849800d

diff --git a/sc/inc/clipoptions.hxx b/sc/inc/clipoptions.hxx
new file mode 100644
index 000..d4ccb59
--- /dev/null
+++ b/sc/inc/clipoptions.hxx
@@ -0,0 +1,25 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SC_INC_CLIPOPTIONS_HXX
+#define INCLUDED_SC_INC_CLIPOPTIONS_HXX
+
+#include 
+
+/// Stores options which are only relevant for clipboard documents.
+class SC_DLLPUBLIC ScClipOptions
+{
+public:
+/// Document properties.
+css::uno::Reference 
m_xDocumentProperties;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index e486b04..7da2b4d 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -117,6 +117,7 @@ class ScBroadcastAreaSlotMachine;
 class ScChangeViewSettings;
 class ScChartCollection;
 class ScChartListenerCollection;
+class ScClipOptions;
 class ScConditionalFormat;
 class ScConditionalFormatList;
 class ScDBCollection;
@@ -351,6 +352,7 @@ private:
 ScViewOptions*  pViewOptions;   // view options
 ScDocOptions*   pDocOptions;// document options
 ScExtDocOptions*pExtDocOptions; // for import etc.
+std::unique_ptr mpClipOptions;   // clipboard options
 ScConsolidateParam* pConsolidateDlgData;
 
 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2016-03-07 Thread Eike Rathke
 sc/inc/scmatrix.hxx  |6 +
 sc/source/core/tool/scmatrix.cxx |   72 +---
 sc/source/filter/oox/workbookhelper.cxx  |2 
 sc/source/ui/docshell/externalrefmgr.cxx |  180 +++
 4 files changed, 199 insertions(+), 61 deletions(-)

New commits:
commit 088ba465d6bb0931c7034d564a3077e21078cb13
Author: Eike Rathke 
Date:   Mon Mar 7 13:46:30 2016 +0100

disable means Enable(false), not true.. tdf#98389 related

EnableAdjustHeight(true) lead to the side effect that when clearing the
range of a pivot table during import, formulas in the same rows were
recalculated with then empty data. Through xSheetOp->clearContents() in
PivotTable::finalizeImport() of
sc/source/filter/oox/pivottablebuffer.cxx

In the case of the bugdoc attached to tdf#98389 that lead to all
VLOOKUP() calls resulting in #N/A errors because an empty string was
looked up.

Change-Id: Ie629ce871d255cc871671165c4da974f21041cec

diff --git a/sc/source/filter/oox/workbookhelper.cxx 
b/sc/source/filter/oox/workbookhelper.cxx
index ec76d54..c21e471 100644
--- a/sc/source/filter/oox/workbookhelper.cxx
+++ b/sc/source/filter/oox/workbookhelper.cxx
@@ -604,7 +604,7 @@ void WorkbookGlobals::initialize( bool bWorkbookFile )
 // #i76026# disable Undo while loading the document
 mpDoc->EnableUndo(false);
 // #i79826# disable calculating automatic row height while loading the 
document
-mpDoc->EnableAdjustHeight(true);
+mpDoc->EnableAdjustHeight(false);
 // disable automatic update of linked sheets and DDE links
 mpDoc->EnableExecuteLink(false);
 
commit 9e60bbdb3aa5f80ca80c9c4fdf7accd12c4a5d1c
Author: Eike Rathke 
Date:   Mon Mar 7 13:20:54 2016 +0100

Resolves: tdf#98389 check memory requirement of matrix

Attachment 123203 of tdf#98389 has external references of the form
[1]Data!$1:$1048576
which effectively address the entire cell range of sheet Data and
allocating a matrix for a billion cells attempted to allocate 8GB+xGB of
memory which the system said no-no ...

Some brave soul along the road once decided that a check on the number
of elements wasn't needed anymore and dared to remove it during
refactoring.. This change reintroduces the check and adds it also to
other places that try to instanciate or resize a matrix.

When allocation of a matrix for an external range reference fails it is
checked whether the request is for such nasty entire rows or entire
columns ranges and if so tries to shrink the range to the actual data
area used, which at least in this case helps and works.

Additionally it fixes a long standing bug in the cached area to array
mapping which caused the cache to not be hit but instead the matrix was
aquired over and over again for the same range, causing a serious
performance bottle neck specifically for VLOOKUP and related functions
where the same external range is used in a lot of cells.

Change-Id: I35f67b48e665bf1cc8d672325c32b889f2e05c57

diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx
index 64147c2..d82cfa4 100644
--- a/sc/inc/scmatrix.hxx
+++ b/sc/inc/scmatrix.hxx
@@ -164,6 +164,12 @@ public:
 #endif
 }
 
+/** Checks nC or nR for zero and uses GetElementsMax() whether a matrix of
+the size of nC*nR could be allocated. A zero size (both nC and nR zero)
+matrix is allowed for later resize.
+ */
+bool static IsSizeAllocatable( SCSIZE nC, SCSIZE nR );
+
 /// Value or boolean.
 inline static bool IsValueType( ScMatValType nType )
 {
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 1a5d012..1477d9d 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -337,14 +337,32 @@ void ScMatrixImpl::Clear()
 
 void ScMatrixImpl::Resize(SCSIZE nC, SCSIZE nR)
 {
-maMat.resize(nR, nC);
-maMatFlag.resize(nR, nC);
+if (ScMatrix::IsSizeAllocatable( nC, nR))
+{
+maMat.resize(nR, nC);
+maMatFlag.resize(nR, nC);
+}
+else
+{
+// Invalid matrix size, allocate 1x1 matrix with error value.
+maMat.resize(1, 1, CreateDoubleError( errStackOverflow));
+maMatFlag.resize(1, 1);
+}
 }
 
 void ScMatrixImpl::Resize(SCSIZE nC, SCSIZE nR, double fVal)
 {
-maMat.resize(nR, nC, fVal);
-maMatFlag.resize(nR, nC);
+if (ScMatrix::IsSizeAllocatable( nC, nR))
+{
+maMat.resize(nR, nC, fVal);
+maMatFlag.resize(nR, nC);
+}
+else
+{
+// Invalid matrix size, allocate 1x1 matrix with error value.
+maMat.resize(1, 1, CreateDoubleError( errStackOverflow));
+maMatFlag.resize(1, 1);
+}
 }
 
 void ScMatrixImpl::SetErrorInterpreter( ScInterpreter* p)
@@ -2356,28 +2374,52 @@ void ScMatrix::DecRef() const
 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2016-02-18 Thread Eike Rathke
 sc/inc/compare.hxx |9 +
 sc/inc/queryparam.hxx  |3 
 sc/source/core/data/dociter.cxx|5 -
 sc/source/core/data/dpcache.cxx|4 
 sc/source/core/data/table3.cxx |4 
 sc/source/core/inc/interpre.hxx|   15 +++
 sc/source/core/tool/compare.cxx|   12 +-
 sc/source/core/tool/doubleref.cxx  |2 
 sc/source/core/tool/interpr1.cxx   |   77 +
 sc/source/core/tool/queryparam.cxx |   15 +--
 sc/source/filter/xml/XMLCalculationSettingsContext.cxx |9 +
 sc/source/filter/xml/XMLCalculationSettingsContext.hxx |3 
 sc/source/filter/xml/XMLExportDataPilot.cxx|   29 +++---
 sc/source/filter/xml/XMLExportDataPilot.hxx|6 -
 sc/source/filter/xml/XMLExportDatabaseRanges.cxx   |   29 +++---
 sc/source/filter/xml/xmlfilti.cxx  |   24 ++---
 sc/source/filter/xml/xmlfilti.hxx  |   10 +-
 sc/source/ui/dbgui/filtdlg.cxx |2 
 sc/source/ui/dbgui/foptmgr.cxx |2 
 sc/source/ui/dbgui/pfiltdlg.cxx|4 
 sc/source/ui/dbgui/sfiltdlg.cxx|3 
 sc/source/ui/unoobj/datauno.cxx|5 -
 sc/source/ui/view/gridwin.cxx  |4 
 23 files changed, 177 insertions(+), 99 deletions(-)

New commits:
commit 06fa2a521b49afe44a387dbfcb65198382f6c57a
Author: Eike Rathke 
Date:   Thu Feb 18 23:48:17 2016 +0100

change all bool bRegExp to utl::SearchParam::SearchType enum, tdf#72196

Later inspect all places that use utl::SearchParam::SRCH_REGEXP if and
how to use utl::SearchParam::SRCH_WILDCARD as well.

Change-Id: I6ad4e5dea3cd656fd670f2281aaceec817953211

diff --git a/sc/inc/compare.hxx b/sc/inc/compare.hxx
index adfdfbc..cd4f9e7e 100644
--- a/sc/inc/compare.hxx
+++ b/sc/inc/compare.hxx
@@ -22,6 +22,7 @@
 
 #include "queryentry.hxx"
 
+#include 
 #include 
 
 class ScDocument;
@@ -50,11 +51,11 @@ struct Compare
 
 struct CompareOptions
 {
-ScQueryEntryaQueryEntry;
-boolbRegEx;
-boolbMatchWholeCell;
+ScQueryEntryaQueryEntry;
+utl::SearchParam::SearchTypeeSearchType;
+boolbMatchWholeCell;
 
-CompareOptions( ScDocument* pDoc, const ScQueryEntry& rEntry, bool bReg );
+CompareOptions( ScDocument* pDoc, const ScQueryEntry& rEntry, 
utl::SearchParam::SearchType eSrchTyp );
 private:
 CompareOptions( const CompareOptions & ) = delete;
 CompareOptions& operator=( const CompareOptions & ) = delete;
diff --git a/sc/inc/queryparam.hxx b/sc/inc/queryparam.hxx
index c174863..dba6c53 100644
--- a/sc/inc/queryparam.hxx
+++ b/sc/inc/queryparam.hxx
@@ -20,6 +20,7 @@
 #ifndef INCLUDED_SC_INC_QUERYPARAM_HXX
 #define INCLUDED_SC_INC_QUERYPARAM_HXX
 
+#include 
 #include "global.hxx"
 #include "types.hxx"
 
@@ -39,11 +40,11 @@ class SharedStringPool;
 
 struct ScQueryParamBase
 {
+utl::SearchParam::SearchType eSearchType;
 boolbHasHeader;
 boolbByRow;
 boolbInplace;
 boolbCaseSens;
-boolbRegExp;
 boolbDuplicate;
 boolmbRangeLookup;  ///< for spreadsheet functions like 
MATCH, LOOKUP, HLOOKUP, VLOOKUP
 
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index 4ea2d54..7ff9ee9 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -1296,7 +1296,8 @@ bool ScQueryCellIterator::FindEqualOrSortedLastInRange( 
SCCOL& nFoundCol,
 SetStopOnMismatch( true ); // assume sorted keys
 SetTestEqualCondition( true );
 bIgnoreMismatchOnLeadingStrings = bIgnoreMismatchOnLeadingStringsP;
-bool bRegExp = mpParam->bRegExp && 
mpParam->GetEntry(0).GetQueryItem().meType == ScQueryEntry::ByString;
+bool bRegExp = mpParam->eSearchType == utl::SearchParam::SRCH_REGEXP &&
+mpParam->GetEntry(0).GetQueryItem().meType == ScQueryEntry::ByString;
 bool bBinary = !bRegExp && mpParam->bByRow && (mpParam->GetEntry(0).eOp ==
 SC_LESS_EQUAL || mpParam->GetEntry(0).eOp == SC_GREATER_EQUAL);
 bool bFound = false;
@@ -1412,7 +1413,7 @@ bool ScQueryCellIterator::FindEqualOrSortedLastInRange( 
SCCOL& nFoundCol,
 maCurPos = aPosSave;
 return true;
 }
-if ( (bSearchForEqualAfterMismatch || mpParam->bRegExp) &&
+if ( (bSearchForEqualAfterMismatch || mpParam->eSearchType == 
utl::SearchParam::SRCH_REGEXP) &&
 StoppedOnMismatch() )
 {
 // Assume found entry to be the last value less than respectively
diff --git a/sc/source/core/data/dpcache.cxx 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source sc/workben

2015-11-13 Thread Michael Stahl
 sc/inc/pch/precompiled_sc.hxx  |1 
 sc/inc/pch/precompiled_scfilt.hxx  |1 
 sc/inc/queryparam.hxx  |7 +-
 sc/source/core/data/dpsave.cxx |6 +-
 sc/source/core/data/sortparam.cxx  |2 
 sc/source/core/data/table3.cxx |4 -
 sc/source/core/tool/queryparam.cxx |   95 -
 sc/workben/result.cxx  |   20 +++
 sc/workben/result.hxx  |7 +-
 9 files changed, 76 insertions(+), 67 deletions(-)

New commits:
commit f3e148bda1b46dc6626f27198de757e82b73f6a7
Author: Michael Stahl 
Date:   Fri Nov 13 18:41:45 2015 +0100

sc: replace that boost::ptr_vector abomination

This looks like dead code anyway? Evidently it didnt' compile like that.

Change-Id: Id6500c18d66c6932b24c15b653d992c449e260c4

diff --git a/sc/workben/result.cxx b/sc/workben/result.cxx
index 122c2c8..0548630 100644
--- a/sc/workben/result.cxx
+++ b/sc/workben/result.cxx
@@ -23,7 +23,6 @@
 
 using namespace com::sun::star;
 
-SV_IMPL_PTRARR( XResultListenerArr_Impl, css::uno::Reference< 
css::sheet::XResultListener >* );
 
 ScAddInResult::ScAddInResult(const String& rStr) :
 aArg( rStr ),
@@ -46,8 +45,8 @@ void ScAddInResult::NewValue()
 
 sheet::ResultEvent aEvent( (cppu::OWeakObject*)this, aAny );
 
-for ( sal_uInt16 n=0; nmodified( aEvent );
+for (size_t n = 0; n < m_Listeners.size(); ++n)
+m_Listeners[n]->modified( aEvent );
 }
 
 IMPL_LINK_TYPED( ScAddInResult, TimeoutHdl, Timer*, pT, void )
@@ -64,10 +63,9 @@ ScAddInResult::~ScAddInResult()
 
 void SAL_CALL ScAddInResult::addResultListener( const css::uno::Reference< 
css::sheet::XResultListener >& aListener ) throw(css::uno::RuntimeException)
 {
-uno::Reference *pObj = new 
uno::Reference( aListener );
-aListeners.Insert( pObj, aListeners.Count() );
+m_Listeners.push_back(uno::Reference(aListener));
 
-if ( aListeners.Count() == 1 )
+if (m_Listeners.size() == 1)
 {
 acquire();  // one Ref for all listeners
 
@@ -79,15 +77,13 @@ void SAL_CALL ScAddInResult::removeResultListener( const 
css::uno::Reference< cs
 {
 acquire();
 
-sal_uInt16 nCount = aListeners.Count();
-for ( sal_uInt16 n=nCount; n--; )
+for (size_t n = m_Listeners.size(); --n; )
 {
-uno::Reference *pObj = aListeners[n];
-if ( *pObj == aListener )
+if (m_Listeners[n] == aListener)
 {
-aListeners.DeleteAndDestroy( n );
+m_Listeners.erase(m_Listeners.begin() + n);
 
-if ( aListeners.Count() == 0 )
+if (m_Listeners.empty())
 {
 nTickCount = 0; //! Test
 
diff --git a/sc/workben/result.hxx b/sc/workben/result.hxx
index e0f796a..140a6d1 100644
--- a/sc/workben/result.hxx
+++ b/sc/workben/result.hxx
@@ -22,20 +22,21 @@
 
 #include 
 #include 
-#include 
 
 #include 
 
 #include 
 
-typedef boost::ptr_vector*> 
XResultListenerArr_Impl;
+#include 
+
+typedef std::vector 
XResultListenerArr_Impl;
 
 class ScAddInResult : public cppu::WeakImplHelper< css::sheet::XVolatileResult>
 {
 private:
 String  aArg;
 longnTickCount;
-XResultListenerArr_Impl aListeners;
+XResultListenerArr_Impl m_Listeners;
 Timer   aTimer;
 
 DECL_LINK( TimeoutHdl, Timer* );
commit c0f489818595e50ed7cf01dfabc26c095617b44c
Author: Michael Stahl 
Date:   Fri Nov 13 18:32:51 2015 +0100

sc: replace boost::ptr_vector with std::vector

Change-Id: I59831588fb7bc7e907fbffb24ddfe068552b6492

diff --git a/sc/inc/pch/precompiled_sc.hxx b/sc/inc/pch/precompiled_sc.hxx
index 4a02554..1adfbfa 100644
--- a/sc/inc/pch/precompiled_sc.hxx
+++ b/sc/inc/pch/precompiled_sc.hxx
@@ -40,7 +40,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sc/inc/pch/precompiled_scfilt.hxx 
b/sc/inc/pch/precompiled_scfilt.hxx
index 468b070..4fb99bc 100644
--- a/sc/inc/pch/precompiled_scfilt.hxx
+++ b/sc/inc/pch/precompiled_scfilt.hxx
@@ -21,7 +21,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sc/inc/queryparam.hxx b/sc/inc/queryparam.hxx
index 3c96260..c174863 100644
--- a/sc/inc/queryparam.hxx
+++ b/sc/inc/queryparam.hxx
@@ -23,7 +23,8 @@
 #include "global.hxx"
 #include "types.hxx"
 
-#include 
+#include 
+#include 
 
 class SvNumberFormatter;
 
@@ -61,7 +62,7 @@ struct ScQueryParamBase
 SvNumberFormatter* pFormatter );
 
 protected:
-typedef boost::ptr_vector EntriesType;
+typedef std::vector EntriesType;
 
 public:
 typedef EntriesType::const_iterator const_iterator;
@@ -73,7 +74,7 @@ protected:
 ScQueryParamBase();
 ScQueryParamBase(const ScQueryParamBase& r);
 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2015-11-06 Thread Michael Stahl
 sc/inc/rangenam.hxx|8 -
 sc/source/core/tool/dbdata.cxx |   13 ++-
 sc/source/core/tool/rangenam.cxx   |  119 +
 sc/source/core/tool/tokenstringcontext.cxx |5 -
 4 files changed, 89 insertions(+), 56 deletions(-)

New commits:
commit ca551694bdce36dfaa795ffa8910ec86db979c56
Author: Michael Stahl 
Date:   Thu Nov 5 23:27:17 2015 +0100

sc: actually std::set::operator== does not use Compare parameter

... but operator== of the Key type, so this no longer compares the
pointed-to objects.

(regression from b5ae7dbc871df57686a603dfa99e8179a0e3a4b8)

Change-Id: I5b0caa9abfa47362383776f7c1d44b73910f15ee

diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index 2552d40..cdf0ff0 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -1169,7 +1169,18 @@ size_t ScDBCollection::NamedDBs::size() const
 
 bool ScDBCollection::NamedDBs::operator== (const NamedDBs& r) const
 {
-return m_DBs == r.m_DBs;
+if (m_DBs.size() != r.m_DBs.size())
+{
+return false;
+}
+for (auto iter1 = m_DBs.begin(), iter2 = r.m_DBs.begin(); iter1 != 
m_DBs.end(); ++iter1, ++iter2)
+{
+if (**iter1 != **iter2)
+{
+return false;
+}
+}
+return true;
 }
 
 ScDBCollection::AnonDBs::iterator ScDBCollection::AnonDBs::begin()
commit df3ed9c8432359f6d539e2e4a1819dc68d885fdf
Author: Michael Stahl 
Date:   Thu Nov 5 22:59:20 2015 +0100

sc: replace boost::ptr_map with std::map

Change-Id: Id4f24d8aa3db4e569f3eafa6d4ab32b0a95bf3c9

diff --git a/sc/inc/rangenam.hxx b/sc/inc/rangenam.hxx
index 812af42..426329a 100644
--- a/sc/inc/rangenam.hxx
+++ b/sc/inc/rangenam.hxx
@@ -26,9 +26,9 @@
 #include "scdllapi.h"
 #include "calcmacros.hxx"
 
+#include 
 #include 
 #include 
-#include 
 
 class ScDocument;
 class ScTokenArray;
@@ -170,8 +170,8 @@ class ScRangeName
 {
 private:
 typedef std::vector IndexDataType;
-typedef ::boost::ptr_map DataType;
-DataType maData;
+typedef ::std::map DataType;
+DataType m_Data;
 IndexDataType maIndexToData;
 
 public:
@@ -208,7 +208,7 @@ public:
 bool empty() const;
 
 /** Insert object into set.
-@ATTENTION: The underlying ::boost::ptr_map_adapter::insert(p) takes
+@ATTENTION: The underlying ::std::map::insert(p) takes
 ownership of p and if it can't insert it deletes the object! So, if
 this insert here returns false the object where p pointed to is gone!
  */
diff --git a/sc/source/core/tool/rangenam.cxx b/sc/source/core/tool/rangenam.cxx
index faf482d..0b0f50b 100644
--- a/sc/source/core/tool/rangenam.cxx
+++ b/sc/source/core/tool/rangenam.cxx
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "token.hxx"
 #include "tokenarray.hxx"
@@ -667,7 +668,7 @@ class MatchByRange : public unary_function
 const ScRange& mrRange;
 public:
 explicit MatchByRange(const ScRange& rRange) : mrRange(rRange) {}
-bool operator() ( boost::ptr_container_detail::ref_pair const& r) const
+bool operator() (std::pair> 
const& r) const
 {
 return r.second->IsRangeAtBlock(mrRange);
 }
@@ -677,42 +678,43 @@ public:
 
 ScRangeName::ScRangeName() {}
 
-ScRangeName::ScRangeName(const ScRangeName& r) :
-maData(r.maData)
+ScRangeName::ScRangeName(const ScRangeName& r)
 {
-// boost::ptr_map clones and deletes, so each collection needs its own
-// index to data.
+for (auto const& it : r.m_Data)
+{
+m_Data.insert(std::make_pair(it.first, 
o3tl::make_unique(*it.second)));
+}
+// std::map was cloned, so each collection needs its own index to data.
 maIndexToData.resize( r.maIndexToData.size(), NULL);
-DataType::const_iterator itr = maData.begin(), itrEnd = maData.end();
-for (; itr != itrEnd; ++itr)
+for (auto const& itr : m_Data)
 {
-size_t nPos = itr->second->GetIndex() - 1;
+size_t nPos = itr.second->GetIndex() - 1;
 if (nPos >= maIndexToData.size())
 {
 OSL_FAIL( "ScRangeName copy-ctor: maIndexToData size doesn't fit");
 maIndexToData.resize(nPos+1, NULL);
 }
-maIndexToData[nPos] = const_cast(itr->second);
+maIndexToData[nPos] = const_cast(itr.second.get());
 }
 }
 
 const ScRangeData* ScRangeName::findByRange(const ScRange& rRange) const
 {
 DataType::const_iterator itr = std::find_if(
-maData.begin(), maData.end(), MatchByRange(rRange));
-return itr == maData.end() ? NULL : itr->second;
+m_Data.begin(), m_Data.end(), MatchByRange(rRange));
+return itr == m_Data.end() ? nullptr : itr->second.get();
 }
 
 ScRangeData* 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2015-11-03 Thread Eike Rathke
 sc/inc/cellvalue.hxx  |4 
 sc/source/core/data/cellvalue.cxx |   10 ++
 2 files changed, 6 insertions(+), 8 deletions(-)

New commits:
commit 3fd400c6b67f8f9b5527720ad148c1f428a59ab2
Author: Eike Rathke 
Date:   Tue Nov 3 13:03:39 2015 +0100

implement assignment in only one place

... and comment on what to do if we really wanted a copy-swap-idiom.
The need to doc comment about not to use assign() after default ctor is
also gone with the temporary swap.

Change-Id: I2a49091b2a41cf155e912e3c373dbbe81c7f9737

diff --git a/sc/inc/cellvalue.hxx b/sc/inc/cellvalue.hxx
index 915bdee..7ac6a87 100644
--- a/sc/inc/cellvalue.hxx
+++ b/sc/inc/cellvalue.hxx
@@ -123,10 +123,6 @@ struct SC_DLLPUBLIC ScRefCellValue
 
 /**
  * Take cell value from specified position in specified document.
- *
- * Avoid the sequence of ScRefCellValue() default ctor followed by assign()
- * as it results in performance penalty, use the
- * ScRefCellValue(ScDocument&,const ScAddress&) ctor instead.
  */
 void assign( ScDocument& rDoc, const ScAddress& rPos );
 
diff --git a/sc/source/core/data/cellvalue.cxx 
b/sc/source/core/data/cellvalue.cxx
index 6903297..f0fe714 100644
--- a/sc/source/core/data/cellvalue.cxx
+++ b/sc/source/core/data/cellvalue.cxx
@@ -495,9 +495,7 @@ ScRefCellValue::ScRefCellValue( const ScRefCellValue& r ) : 
meType(r.meType), mf
 
 ScRefCellValue::ScRefCellValue( ScDocument& rDoc, const ScAddress& rPos )
 {
-const ScRefCellValue& rCell = rDoc.GetRefCellValue(rPos);
-meType = rCell.meType;
-mfValue = rCell.mfValue;
+assign( rDoc, rPos);
 }
 
 ScRefCellValue::~ScRefCellValue()
@@ -593,6 +591,11 @@ bool ScRefCellValue::equalsWithoutFormat( const 
ScRefCellValue& r ) const
 
 ScRefCellValue& ScRefCellValue::operator= ( const ScRefCellValue& r )
 {
+// So we *could* have a copy-swap-idiom here for exception-safety if we had
+// to slow down things.. but then implement an explicit move-ctor and pass
+// r by-value instead of manually creating a temporary so the compiler can
+// take advantage. And initialize
+// ScRefCellValue(ScDocument&,const ScAddress&) with default ctor.
 meType = r.meType;
 mfValue = r.mfValue;// largest member of union
 return *this;
commit 93d61feaf55cfe4484581e1985435cd1439d6f41
Author: Eike Rathke 
Date:   Mon Nov 2 19:05:24 2015 +0100

remove superfluous call to clear() in ScRefCellValue dtor

Change-Id: Iea7788f985e2c5dc7a96eab711bf7d13732ab86e

diff --git a/sc/source/core/data/cellvalue.cxx 
b/sc/source/core/data/cellvalue.cxx
index c63f493..6903297 100644
--- a/sc/source/core/data/cellvalue.cxx
+++ b/sc/source/core/data/cellvalue.cxx
@@ -502,7 +502,6 @@ ScRefCellValue::ScRefCellValue( ScDocument& rDoc, const 
ScAddress& rPos )
 
 ScRefCellValue::~ScRefCellValue()
 {
-clear();
 }
 
 void ScRefCellValue::clear()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2015-09-15 Thread Eike Rathke
 sc/inc/formulacell.hxx |3 +--
 sc/source/core/tool/chgtrack.cxx   |4 
 sc/source/core/tool/interpr4.cxx   |2 +-
 sc/source/filter/excel/xetable.cxx |1 -
 sc/source/ui/docshell/docsh3.cxx   |6 --
 5 files changed, 2 insertions(+), 14 deletions(-)

New commits:
commit fb59df3a5504ab857923149d53cd222b9b4d6388
Author: Eike Rathke 
Date:   Tue Sep 15 18:59:01 2015 +0200

there's no default ScMatrixMode enum other than the known ones

... and if there was one not handled let the compiler complain.

Change-Id: Ibe3a2a913edfbfbba30a83a8d985d5509853ff6d

diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index a33b564..3517f26 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -1689,8 +1689,6 @@ ScChangeActionContentCellType 
ScChangeActionContent::GetContentCellType( const S
 return SC_CACCT_MATORG;
 case MM_REFERENCE :
 return SC_CACCT_MATREF;
-default:
-;
 }
 return SC_CACCT_NORMAL;
 }
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index 27eddeb..3924354 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -1003,8 +1003,6 @@ void ScDocShell::MergeDocument( ScDocument& rOtherDoc, 
bool bShared, bool bCheck
 break;
 case MM_REFERENCE : // do nothing
 break;
-default:
-OSL_FAIL( "MergeDocument: unknown 
MatrixFlag" );
 }
 }
 break;
commit d8d699736334d009503a9a8e1363db7f7d237f99
Author: Eike Rathke 
Date:   Tue Sep 15 18:34:01 2015 +0200

stab MM_FAKE, it's a zombie

Change-Id: Iee70d0d027197c431926ab1194e0daa5eb429caf

diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
index 30fd1b1..9579029 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -113,8 +113,7 @@ inline void intrusive_ptr_release(const ScFormulaCellGroup 
*p)
 enum ScMatrixMode {
 MM_NONE  = 0,   // No matrix formula
 MM_FORMULA   = 1,   // Upper left matrix formula cell
-MM_REFERENCE = 2,   // Remaining cells, via ocMatRef 
reference token
-MM_FAKE  = 3// Interpret "as-if" matrix formula 
(legacy)
+MM_REFERENCE = 2// Remaining cells, via ocMatRef 
reference token
 };
 
 class SC_DLLPUBLIC ScFormulaCell : public SvtListener
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index b8785ca..a33b564 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -1660,7 +1660,6 @@ ScChangeActionContentCellType 
ScChangeActionContent::GetContentCellType( const S
 case MM_NONE :
 return SC_CACCT_NORMAL;
 case MM_FORMULA :
-case MM_FAKE :
 return SC_CACCT_MATORG;
 case MM_REFERENCE :
 return SC_CACCT_MATREF;
@@ -1687,7 +1686,6 @@ ScChangeActionContentCellType 
ScChangeActionContent::GetContentCellType( const S
 case MM_NONE :
 return SC_CACCT_NORMAL;
 case MM_FORMULA :
-case MM_FAKE :
 return SC_CACCT_MATORG;
 case MM_REFERENCE :
 return SC_CACCT_MATREF;
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 70c52bc..37ef230 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -3735,7 +3735,7 @@ ScInterpreter::ScInterpreter( ScFormulaCell* pCell, 
ScDocument* pDoc,
 if(pMyFormulaCell)
 {
 sal_uInt8 cMatFlag = pMyFormulaCell->GetMatrixFlag();
-bMatrixFormula = ( cMatFlag == MM_FORMULA || cMatFlag == MM_FAKE );
+bMatrixFormula = ( cMatFlag == MM_FORMULA );
 }
 else
 bMatrixFormula = false;
diff --git a/sc/source/filter/excel/xetable.cxx 
b/sc/source/filter/excel/xetable.cxx
index c30334a..be65181 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -945,7 +945,6 @@ void XclExpFormulaCell::SaveXml( XclExpXmlStream& rStrm )
 bWriteFormula = false;
 break;
 case MM_FORMULA:
-case MM_FAKE:
 {
 // origin of the matrix - find the used matrix range
 SCCOL nMatWidth;
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index 631e1fb..27eddeb 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -1003,10 +1003,6 @@ void 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2015-09-08 Thread Eike Rathke
 sc/inc/formulacell.hxx  |2 ++
 sc/source/core/data/formulacell.cxx |2 ++
 2 files changed, 4 insertions(+)

New commits:
commit 37a36671e0abfa0e1dfd2cfdd6470a3f2805b199
Author: Eike Rathke 
Date:   Tue Sep 8 13:59:57 2015 +0200

reactivate fixed mempool for ScFormulaCell

... it got lost with 8b252f30267d043522ff2cbf2bf42275bb7a6ec6

Change-Id: I1a7c9bbaa1fd70d24c168d53aae6691a45c29085

diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
index dbafa1b..30fd1b1 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -164,9 +164,7 @@ public:
 
 enum CompareState { NotEqual = 0, EqualInvariant, EqualRelativeRef };
 
-#ifdef USE_MEMPOOL
 DECL_FIXEDMEMPOOL_NEWDEL( ScFormulaCell )
-#endif
 
 ScAddress   aPos;
 
diff --git a/sc/source/core/data/formulacell.cxx 
b/sc/source/core/data/formulacell.cxx
index 2483382..e21a26e 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -66,9 +66,7 @@
 
 using namespace formula;
 
-#ifdef USE_MEMPOOL
 IMPL_FIXEDMEMPOOL_NEWDEL( ScFormulaCell )
-#endif
 
 #define DEBUG_CALCULATION 0
 #if DEBUG_CALCULATION
commit 7df729da30f89ad20cd5705e3a1a91866ac71898
Author: Eike Rathke 
Date:   Tue Sep 8 13:27:14 2015 +0200

Revert "USE_MEMPOOL is not defined anywhere"

Well.. then let's remove the ifdef instead of the implementation,
dammit..

This reverts commit 64c6b0ed6c67d169021732d276ec02706e139261.

diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
index 1b67b40..dbafa1b 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -164,6 +164,10 @@ public:
 
 enum CompareState { NotEqual = 0, EqualInvariant, EqualRelativeRef };
 
+#ifdef USE_MEMPOOL
+DECL_FIXEDMEMPOOL_NEWDEL( ScFormulaCell )
+#endif
+
 ScAddress   aPos;
 
 virtual ~ScFormulaCell();
diff --git a/sc/source/core/data/formulacell.cxx 
b/sc/source/core/data/formulacell.cxx
index dc3f9bb..2483382 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -66,6 +66,10 @@
 
 using namespace formula;
 
+#ifdef USE_MEMPOOL
+IMPL_FIXEDMEMPOOL_NEWDEL( ScFormulaCell )
+#endif
+
 #define DEBUG_CALCULATION 0
 #if DEBUG_CALCULATION
 static ScAddress aDebugCalculationTriggerAddress(1,2,0);// Sheet1.B3, 
whatever you like
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2015-09-03 Thread Eike Rathke
 sc/inc/dbdata.hxx|2 --
 sc/inc/document.hxx  |1 -
 sc/source/core/data/documen3.cxx |6 --
 sc/source/core/tool/dbdata.cxx   |6 --
 4 files changed, 15 deletions(-)

New commits:
commit a41d43fdc5a4942303b0b14e259d97c5edc7ded2
Author: Eike Rathke 
Date:   Thu Sep 3 18:53:36 2015 +0200

remove unused ScDBCollection::RefreshTableColumnNames(const ScRange&)

Change-Id: Ia97d6913351a012d62f9d991dd42c54d8247a824

diff --git a/sc/inc/dbdata.hxx b/sc/inc/dbdata.hxx
index 22ccc329..bf1ac4c 100644
--- a/sc/inc/dbdata.hxx
+++ b/sc/inc/dbdata.hxx
@@ -287,8 +287,6 @@ public:
 ScDBData* GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, 
SCROW nRow2);
 ScDBData* GetDBNearCursor(SCCOL nCol, SCROW nRow, SCTAB nTab );
 
-void RefreshTableColumnNames( const ScRange& rRange );
-
 voidDeleteOnTab( SCTAB nTab );
 voidUpdateReference(UpdateRefMode eUpdateRefMode,
 SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index d6e2a52..8375f55 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -1221,12 +1221,6 @@ ScDBData* ScDBCollection::GetDBAtArea(SCTAB nTab, SCCOL 
nCol1, SCROW nRow1, SCCO
 return NULL;
 }
 
-void ScDBCollection::RefreshTableColumnNames( const ScRange& rRange )
-{
-for (auto const& it : maNamedDBs)
-it->RefreshTableColumnNames( pDoc, rRange);
-}
-
 void ScDBCollection::DeleteOnTab( SCTAB nTab )
 {
 FindByTable func(nTab);
commit 884d53813a4c7b9414a135cfaae6119d78768f38
Author: Eike Rathke 
Date:   Thu Sep 3 18:47:30 2015 +0200

remove unused ScDocument::RefreshTableColumnNames(const ScRange&)

Change-Id: Ia3d09478b31503eb6ab9e352b2925bc1b496a8e3

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index c19bc6f..9ea6729 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -570,7 +570,6 @@ public:
 ScDBData* GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, 
ScDBDataPortion ePortion);
 const ScDBData* GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL 
nCol2, SCROW nRow2) const;
 ScDBData* GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, 
SCROW nRow2);
-void RefreshTableColumnNames( const ScRange& rRange );
 
 SC_DLLPUBLIC const ScRangeData* GetRangeAtBlock( const ScRange& rBlock, 
OUString* pName=NULL ) const;
 
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 53dff92..32791da 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -313,12 +313,6 @@ ScDBData* ScDocument::GetDBAtArea(SCTAB nTab, SCCOL nCol1, 
SCROW nRow1, SCCOL nC
 return NULL;
 }
 
-void ScDocument::RefreshTableColumnNames( const ScRange& rRange )
-{
-if (pDBCollection)
-pDBCollection->RefreshTableColumnNames( rRange);
-}
-
 bool ScDocument::HasPivotTable() const
 {
 return pDPCollection && pDPCollection->GetCount();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2015-08-31 Thread Eike Rathke
 sc/inc/dbdata.hxx|3 +++
 sc/source/core/tool/compiler.cxx |7 +++
 sc/source/core/tool/dbdata.cxx   |   14 --
 3 files changed, 22 insertions(+), 2 deletions(-)

New commits:
commit 0c1d3f0c17296c113358228cf36596347fd045e3
Author: Eike Rathke 
Date:   Tue Sep 1 01:04:49 2015 +0200

remove now moot comment

Change-Id: Idf8c958161a92ba73dfb60da9a10ab9d59be7c2d

diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index 17f59e1..46b9b2f 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -653,8 +653,6 @@ void ScDBData::RefreshTableColumnNames( ScDocument* pDoc )
 // Try to not have empty names and remember previous name that might had
 // been used to compile formulas, but only if same number of columns and no
 // duplicates.
-/* TODO: formula references' create string should be adapted to look for
- * the column name here if the TableRef column header cell is empty. */
 if (bHaveEmpty && aNewNames.size() == maTableColumnNames.size())
 {
 for (size_t i=0, n=aNewNames.size(); i < n; ++i)
commit e14c72954ec5b00557647cb1ec167d33828085cc
Author: Eike Rathke 
Date:   Tue Sep 1 00:56:34 2015 +0200

TableRef: fall back to stored table column name if header cell is empty

... during token string creation, as an empty column specifier is the
last thing we want to see.. which still can happen though if the stored
name was synced with the existing cell data and copying the older
original name was not possible, for example due to name clashes.

Change-Id: I6a0d313a02efafc092f0bbf7725fb3b3e77e486f

diff --git a/sc/inc/dbdata.hxx b/sc/inc/dbdata.hxx
index bacf099..967ba30 100644
--- a/sc/inc/dbdata.hxx
+++ b/sc/inc/dbdata.hxx
@@ -126,6 +126,9 @@ public:
  */
 sal_Int32   GetColumnNameOffset( const OUString& rName ) const;
 
+/** Returns table column name if nCol is within column range and name
+is stored, else empty string. */
+const OUString& GetTableColumnName( SCCOL nCol ) const;
 
 OUString GetSourceString() const;
 OUString GetOperations() const;
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 1adfaba..5aa34b3 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -4702,6 +4702,13 @@ void ScCompiler::CreateStringFromSingleRef( 
OUStringBuffer& rBuffer, const Formu
 {
 ScAddress aAbs = rRef.toAbs(aPos);
 OUString aStr = pDoc->GetString(aAbs);
+if (aStr.isEmpty())
+{
+// Hope that there's still the original column name available.
+const ScDBData* pData = pDoc->GetDBAtCursor( aPos.Col(), 
aPos.Row(), aPos.Tab(), true);
+if (pData)
+aStr = pData->GetTableColumnName( aPos.Col());
+}
 escapeTableRefColumnSpecifier( aStr);
 rBuffer.append(aStr);
 }
diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index d87351d..17f59e1 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -712,6 +712,18 @@ sal_Int32 ScDBData::GetColumnNameOffset( const OUString& 
rName ) const
 return -1;
 }
 
+const OUString& ScDBData::GetTableColumnName( SCCOL nCol ) const
+{
+if (maTableColumnNames.empty())
+return EMPTY_OUSTRING;
+
+SCCOL nOffset = nCol - nStartCol;
+if (nOffset <  0 || maTableColumnNames.size() <= 
static_cast(nOffset))
+return EMPTY_OUSTRING;
+
+return maTableColumnNames[nOffset];
+}
+
 namespace {
 
 class FindByTable : public unary_function
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2015-08-13 Thread Eike Rathke
 sc/inc/math.hxx  |   29 +
 sc/source/core/tool/interpr3.cxx |2 +-
 2 files changed, 30 insertions(+), 1 deletion(-)

New commits:
commit 8747442d179367a9cea652643a516021fa7c5510
Author: Eike Rathke er...@redhat.com
Date:   Thu Aug 13 22:36:20 2015 +0200

use sc::divide() for -fsanitize=float-divide-by-zero triggered by unit test

Change-Id: I370f2f5e3e0ceb40051cbf2f806072f4fd213811

diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index ce3dc91..3fad7e7 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -2850,7 +2850,7 @@ void ScInterpreter::ScChiTest()
 {
 double fValX = pMat1-GetDouble(i,j);
 double fValE = pMat2-GetDouble(i,j);
-fChi += (fValX - fValE) * (fValX - fValE) / fValE;
+fChi += sc::divide( (fValX - fValE) * (fValX - fValE), fValE);
 }
 else
 {
commit d0d76a9aad90c8f07330da7f67eef5c607a27aec
Author: Eike Rathke er...@redhat.com
Date:   Thu Aug 13 22:03:53 2015 +0200

add sc::divide() for defined -fsanitize=float-divide-by-zero behavior

Change-Id: I3af85344119ca0056a127a5278e8993f9d79e2f9

diff --git a/sc/inc/math.hxx b/sc/inc/math.hxx
index 8a95f21..46f9a1d 100644
--- a/sc/inc/math.hxx
+++ b/sc/inc/math.hxx
@@ -24,12 +24,41 @@
 
 namespace sc {
 
+/** Return fNumerator/fDenominator if fDenominator!=0 else #DIV/0! error coded
+into double.
+ */
 inline double div( const double fNumerator, const double fDenominator )
 {
 return (fDenominator != 0.0) ? (fNumerator / fDenominator) :
 CreateDoubleError( errDivisionByZero);
 }
 
+/** Return fNumerator/fDenominator if fDenominator!=0 else +-Infinity if
+fNumerator!=0 or NaN if fNumerator==0.
+
+This allows to build/run with -fsanitize=float-divide-by-zero and have a
+defined behavior for the otherwise undefined division by zero case (If the
+second operand of / or % is zero the behavior is undefined.
+([expr.mul]/4)).
+
+The Calc interpreter gracefully handles Infinity or NaN double values
+encountered as interim or final results, using this function we can ensure
+defined behavior where desired.
+
+Use where the double coded error creating div() is not wanted.
+ */
+inline double divide( const double fNumerator, const double fDenominator )
+{
+if (fDenominator == 0.0) {
+if (std::isfinite(fNumerator)  fNumerator != 0.0) {
+return std::copysign(INFINITY, fNumerator);
+} else {
+return NAN;
+}
+}
+return fNumerator / fDenominator;
+}
+
 }
 
 #endif
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2015-07-16 Thread Eike Rathke
 sc/inc/dbdata.hxx  |5 +
 sc/source/core/tool/dbdata.cxx |   21 +
 sc/source/ui/docshell/dbdocfun.cxx |3 +++
 sc/source/ui/view/cellsh2.cxx  |4 ++--
 4 files changed, 31 insertions(+), 2 deletions(-)

New commits:
commit 33255f974fc712b9e9e2965a350c65a2195a7ae6
Author: Eike Rathke er...@redhat.com
Date:   Thu Jul 16 17:52:29 2015 +0200

Resolves: tdf#88402 remember sort has headers at anonymous database ranges

Change-Id: I4a126f40589fd401f3a63f74be5e86e3df947ef6

diff --git a/sc/inc/dbdata.hxx b/sc/inc/dbdata.hxx
index 4965e94..fdcf678 100644
--- a/sc/inc/dbdata.hxx
+++ b/sc/inc/dbdata.hxx
@@ -128,6 +128,10 @@ public:
 voidGetSortParam(ScSortParam rSortParam) const;
 voidSetSortParam(const ScSortParam rSortParam);
 
+/** Remember some more settings of ScSortParam, only to be called at
+anonymous DB ranges as it at least overwrites bHasHeader. */
+voidUpdateFromSortParam( const ScSortParam rSortParam );
+
 SC_DLLPUBLIC void   GetQueryParam(ScQueryParam rQueryParam) const;
 SC_DLLPUBLIC void   SetQueryParam(const ScQueryParam rQueryParam);
 SC_DLLPUBLIC bool   GetAdvancedQuerySource(ScRange rSource) const;
@@ -228,6 +232,7 @@ public:
 ScDBData* getByRange(const ScRange rRange);
 void insert(ScDBData* p);
 bool empty() const;
+bool has( const ScDBData* p ) const;
 bool operator== (const AnonDBs r) const;
 };
 
diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index e51da5d..e91f2b1 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -346,6 +346,11 @@ void ScDBData::SetSortParam( const ScSortParam rSortParam 
)
 bByRow = rSortParam.bByRow;
 }
 
+void ScDBData::UpdateFromSortParam( const ScSortParam rSortParam )
+{
+bHasHeader = rSortParam.bHasHeader;
+}
+
 void ScDBData::GetQueryParam( ScQueryParam rQueryParam ) const
 {
 rQueryParam = *mpQueryParam;
@@ -744,6 +749,17 @@ public:
 }
 };
 
+class FindByPointer : public unary_functionScDBData, bool
+{
+const ScDBData* mpDBData;
+public:
+FindByPointer(const ScDBData* pDBData) : mpDBData(pDBData) {}
+bool operator() (const ScDBData r) const
+{
+return r == mpDBData;
+}
+};
+
 }
 
 ScDBCollection::NamedDBs::NamedDBs(ScDBCollection rParent, ScDocument rDoc) :
@@ -894,6 +910,11 @@ bool ScDBCollection::AnonDBs::empty() const
 return maDBs.empty();
 }
 
+bool ScDBCollection::AnonDBs::has( const ScDBData* p ) const
+{
+return find_if( maDBs.begin(), maDBs.end(), FindByPointer(p)) != 
maDBs.end();
+}
+
 bool ScDBCollection::AnonDBs::operator== (const AnonDBs r) const
 {
 return maDBs == r.maDBs;
diff --git a/sc/source/ui/docshell/dbdocfun.cxx 
b/sc/source/ui/docshell/dbdocfun.cxx
index 567e100..ff748c4 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -574,6 +574,9 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam 
rSortParam,
 }
 
 pDBData-SetSortParam(rSortParam);
+// Remember additional settings on anonymous database ranges.
+if (pDBData == rDoc.GetAnonymousDBData( nTab) || 
rDoc.GetDBCollection()-getAnonDBs().has( pDBData))
+pDBData-UpdateFromSortParam( rSortParam);
 
 if (nStartRow = aLocalParam.nRow2)
 {
commit 1077ad0ca662d71cfd23b33b23c1c34c40ce32cd
Author: Eike Rathke er...@redhat.com
Date:   Thu Jul 16 15:49:26 2015 +0200

indentation

Change-Id: I34a45d15b0be4a56dbc9cc42c97d560ab350ff0d

diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index 4eb52acc..7cfc370 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -505,8 +505,8 @@ void ScCellShell::ExecuteDB( SfxRequest rReq )
 rOutParam.bHasHeader ) );
 rReq.AppendItem( SfxBoolItem( 
SID_SORT_CASESENS,
 rOutParam.bCaseSens ) );
-rReq.AppendItem( SfxBoolItem( SID_SORT_NATURALSORT,
-rOutParam.bNaturalSort ) );
+rReq.AppendItem( SfxBoolItem( 
SID_SORT_NATURALSORT,
+rOutParam.bNaturalSort ) );
 rReq.AppendItem( SfxBoolItem( SID_SORT_ATTRIBS,
 rOutParam.bIncludePattern ) );
 sal_uInt16 nUser = rOutParam.bUserDef ? ( 
rOutParam.nUserIndex + 1 ) : 0;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2015-07-13 Thread Eike Rathke
 sc/inc/globstr.hrc| 1123 +-
 sc/source/ui/namedlg/namemgrtable.cxx |2 
 sc/source/ui/src/globstr.src  |6 
 3 files changed, 568 insertions(+), 563 deletions(-)

New commits:
commit baffa3e3768df1d016d79349ed074ba20b34d5c1
Author: Eike Rathke er...@redhat.com
Date:   Mon Jul 13 19:40:50 2015 +0200

renumber globstr.hrc STR_...

and move STR_HEADER_RANGE_OR_EXPR and STR_HEADER_RANGE to proper
positions.

Renumbered sc/inc/globstr.hrc consecutively using
sc/util/number-defines-consecutively.awk which closed a gap of six
strings.

Change-Id: Ibf643ad5b243caf7b01226af399e60bbe0433a15

diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index 6ca1fd7..f37110f 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -89,620 +89,619 @@
 #define STR_MSSG_INSERTCELLS_0  50
 #define STR_MSSG_DELETECELLS_0  51
 #define STR_MSSG_MERGECELLS_0   52
-#define STR_MSSG_SOLVE_054
-#define STR_MSSG_SOLVE_155
-#define STR_MSSG_SOLVE_256
-#define STR_MSSG_SOLVE_357
-#define STR_MSSG_SOLVE_458
-
-#define STR_TABLE_GESAMTERGEBNIS59
-#define STR_TABLE_ERGEBNIS  60
-#define STR_UNDO_SPELLING   61
-#define STR_TABLE_UND   62
-#define STR_TABLE_ODER  63
-#define STR_UNDO_INSERTCELLS64
-#define STR_TABLE_DEF   65
-#define STR_MOVE_TO_END 66
-#define STR_BOX_YNI 67
-#define STR_NO_REF_TABLE68
-
-#define STR_PIVOTFUNC_SUM   69  // pivot.cxx
-#define STR_PIVOTFUNC_COUNT 70
-#define STR_PIVOTFUNC_AVG   71
-#define STR_PIVOTFUNC_MAX   72
-#define STR_PIVOTFUNC_MIN   73
-#define STR_PIVOTFUNC_PROD  74
-#define STR_PIVOTFUNC_COUNT275
-#define STR_PIVOTFUNC_STDDEV76
-#define STR_PIVOTFUNC_STDDEV2   77
-#define STR_PIVOTFUNC_VAR   78
-#define STR_PIVOTFUNC_VAR2  79
-#define STR_PIVOT_TOTAL 80
-#define STR_PIVOT_DATA  81
-
-#define STR_PIVOT_INVALID_DBAREA82 // tabvwsh3.cxx
-
-#define STR_TABLE   83
-#define STR_COLUMN  84
-#define STR_ROW 85
-#define STR_LOAD_DOC86
-#define STR_SAVE_DOC87
-
-#define STR_ERR_INVALID_TABREF  88
-#define STR_AREA_ALREADY_INSERTED   89
-#define STR_INVALID_TABREF  90
-#define STR_INVALID_QUERYAREA   91
-
-#define STR_REIMPORT_EMPTY  92
-#define STR_NOMULTISELECT   93
-#define STR_FILL_SERIES_PROGRESS94 // documen3.cxx
-
-#define STR_UNKNOWN_FILTER  95
-
-#define STR_DATABASE_NOTFOUND   96
-#define STR_DATABASE_ABORTED97
-
-#define STR_UNDO_PRINTRANGES98
-
-#define STR_UNDO_DEC_INDENT 99
-#define STR_UNDO_INC_INDENT 100
-#define STR_UNDO_THESAURUS  101
-
-#define STR_FILL_TAB102
-#define STR_NO_VALUE103 /* moved to compiler.src, keep 
define! */
-#define STR_UPDATE_SCENARIO 104
-#define STR_ERR_NEWSCENARIO 105
-#define STR_SCENARIO106
-#define STR_PIVOT_TABLE 107
-#define STR_NEWTABNAMENOTUNIQUE 108
-
-#define STR_FUN_TEXT_SUM109
-#define STR_FUN_TEXT_COUNT  110
-#define STR_FUN_TEXT_AVG111
-#define STR_FUN_TEXT_MAX112
-#define STR_FUN_TEXT_MIN113
-#define STR_FUN_TEXT_PRODUCT114
-#define STR_FUN_TEXT_STDDEV 115
-#define STR_FUN_TEXT_VAR116
-#define STR_DOC_STAT117
-
-#define STR_DBNAME_IMPORT   118
-
-#define STR_NOCHARTATCURSOR 119
-#define STR_NOAREASELECTED  120
-#define STR_INVALIDTABNAME  121
-
-#define STR_PIVOT_NOTFOUND  122
-#define STR_ERROR_STR   123
-#define STR_NV_STR  124 /* moved to compiler.src, keep 
define! */
-#define STR_EMPTYDATA   125
-#define STR_PIVOT_NODATA126
-#define STR_PIVOT_MOVENOTALLOWED127
-
-#define STR_PRINT_INVALID_AREA  128
-
-#define STR_PAGESTYLE   129
-#define STR_HEADER  130
-#define STR_FOOTER  131
-
-#define STR_TEXTATTRS   132
-
-#define STR_HFCMD_DELIMITER 133
-#define STR_HFCMD_PAGE  134
-#define STR_HFCMD_PAGES 135
-#define STR_HFCMD_DATE  136
-#define STR_HFCMD_TIME  137
-#define STR_HFCMD_FILE  138
-#define STR_HFCMD_TABLE 139
-
-#define STR_PROTECTIONERR   140
-
-#define STR_PAGEHEADER  141
-#define STR_PAGEFOOTER  142
-#define STR_PAGE143
-#define STR_LONG_ERR_ILL_ARG144
-#define STR_LONG_ERR_ILL_PAR145
-#define STR_LONG_ERR_ILL_FPO146
-#define STR_LONG_ERR_ILL_CHAR   147
-#define STR_LONG_ERR_ILL_SEP

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2015-07-08 Thread Eike Rathke
 sc/inc/address.hxx   |3 +--
 sc/source/core/data/document.cxx |4 ++--
 sc/source/core/data/markdata.cxx |2 +-
 sc/source/core/tool/address.cxx  |   28 ++--
 sc/source/core/tool/compiler.cxx |2 +-
 sc/source/core/tool/interpr3.cxx |2 +-
 sc/source/core/tool/interpr4.cxx |2 +-
 sc/source/filter/excel/xehelper.cxx  |2 +-
 sc/source/filter/excel/xename.cxx|2 +-
 sc/source/ui/app/inputhdl.cxx|2 +-
 sc/source/ui/app/scmod.cxx   |2 +-
 sc/source/ui/docshell/externalrefmgr.cxx |2 +-
 sc/source/ui/miscdlgs/optsolver.cxx  |2 +-
 sc/source/ui/unoobj/cellsuno.cxx |   10 +-
 sc/source/ui/unoobj/chart2uno.cxx|2 +-
 sc/source/ui/unoobj/cursuno.cxx  |   18 +-
 sc/source/ui/view/gridwin.cxx|6 +++---
 sc/source/ui/view/gridwin4.cxx   |2 +-
 sc/source/ui/view/tabview3.cxx   |2 +-
 sc/source/ui/view/tabvwsh3.cxx   |4 ++--
 sc/source/ui/view/viewfun2.cxx   |4 ++--
 21 files changed, 43 insertions(+), 60 deletions(-)

New commits:
commit 5ee9e2983a4b0f3df31e7f8ea4695c2c789edc56
Author: Eike Rathke er...@redhat.com
Date:   Wed Jul 8 22:02:48 2015 +0200

remove ScRange::Justify() and replace calls with PutInOrder()

Change-Id: I350050ac085b1f220d5288d33c253ba0c9a5fd2c

diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx
index f6650d4..9c062b8 100644
--- a/sc/inc/address.hxx
+++ b/sc/inc/address.hxx
@@ -540,15 +540,14 @@ public:
 
 inline void GetVars( SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
  SCCOL nCol2, SCROW nRow2, SCTAB nTab2 ) const;
+SC_DLLPUBLIC void PutInOrder();
 // The document for the maximum defined sheet number
 SC_DLLPUBLIC bool Move( SCsCOL aDeltaX, SCsROW aDeltaY, SCsTAB aDeltaZ, 
ScDocument* pDocument = NULL );
-SC_DLLPUBLIC void Justify();
 SC_DLLPUBLIC void ExtendTo( const ScRange rRange );
 SC_DLLPUBLIC bool Intersects( const ScRange rRange ) const;// do two 
ranges intersect?
 
 ScRange Intersection( const ScRange rOther ) const;
 
-void PutInOrder();
 inline bool operator==( const ScRange rRange ) const;
 inline bool operator!=( const ScRange rRange ) const;
 inline bool operator( const ScRange rRange ) const;
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index c8e9a0e..95655f2 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -2008,7 +2008,7 @@ void ScDocument::CopyToDocument(const ScRange rRange,
 const ScMarkData* pMarks, bool bColRowFlags)
 {
 ScRange aNewRange = rRange;
-aNewRange.Justify();
+aNewRange.PutInOrder();
 
 if( pDestDoc-aDocName.isEmpty() )
 pDestDoc-aDocName = aDocName;
@@ -2041,7 +2041,7 @@ void ScDocument::UndoToDocument(const ScRange rRange,
 sc::AutoCalcSwitch aAutoCalcSwitch(*this, false);
 
 ScRange aNewRange = rRange;
-aNewRange.Justify();
+aNewRange.PutInOrder();
 SCTAB nTab1 = aNewRange.aStart.Tab();
 SCTAB nTab2 = aNewRange.aEnd.Tab();
 
diff --git a/sc/source/core/data/markdata.cxx b/sc/source/core/data/markdata.cxx
index 55537b2..28c18d7 100644
--- a/sc/source/core/data/markdata.cxx
+++ b/sc/source/core/data/markdata.cxx
@@ -99,7 +99,7 @@ void ScMarkData::ResetMark()
 void ScMarkData::SetMarkArea( const ScRange rRange )
 {
 aMarkRange = rRange;
-aMarkRange.Justify();
+aMarkRange.PutInOrder();
 if ( !bMarked )
 {
 // Upon creation of a document ScFormatShell GetTextAttrState
diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx
index a3f756d..81e4047 100644
--- a/sc/source/core/tool/address.cxx
+++ b/sc/source/core/tool/address.cxx
@@ -1426,25 +1426,6 @@ void ScRange::PutInOrder()
 }
 }
 
-void ScRange::Justify()
-{
-SCCOL nTempCol;
-if ( aEnd.Col()  (nTempCol = aStart.Col()) )
-{
-aStart.SetCol(aEnd.Col()); aEnd.SetCol(nTempCol);
-}
-SCROW nTempRow;
-if ( aEnd.Row()  (nTempRow = aStart.Row()) )
-{
-aStart.SetRow(aEnd.Row()); aEnd.SetRow(nTempRow);
-}
-SCTAB nTempTab;
-if ( aEnd.Tab()  (nTempTab = aStart.Tab()) )
-{
-aStart.SetTab(aEnd.Tab()); aEnd.SetTab(nTempTab);
-}
-}
-
 void ScRange::ExtendTo( const ScRange rRange )
 {
 OSL_ENSURE( rRange.IsValid(), ScRange::ExtendTo - cannot extend to 
invalid range );
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index e75bce8..0583f71 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -5287,7 +5287,7 @@ bool ScCompiler::HandleTableRef()
 else
 {
 aColRange.aEnd = 
mpToken-GetSingleRef()-toAbs( aPos);
-  

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2015-06-25 Thread Eike Rathke
 sc/inc/dbdata.hxx  |   16 +
 sc/source/core/tool/dbdata.cxx |   68 +
 2 files changed, 83 insertions(+), 1 deletion(-)

New commits:
commit 044f79078ae2776b786f904e5f24a745f8635a18
Author: Eike Rathke er...@redhat.com
Date:   Thu Jun 25 11:52:45 2015 +0200

TableRef: add ScDBData::GetColumnNameOffset()

Change-Id: Id80b9e8d1f54a8b795d0f4209bdf2f980f9a5344

diff --git a/sc/inc/dbdata.hxx b/sc/inc/dbdata.hxx
index b77e218..4965e94 100644
--- a/sc/inc/dbdata.hxx
+++ b/sc/inc/dbdata.hxx
@@ -112,6 +112,16 @@ public:
 voidSetStripData(bool bSet) { bStripData = bSet; }
 voidSetTableColumnNames( const ::std::vector OUString  rNames ) 
{ maTableColumnNames = rNames; }
 
+/** Finds the column named rName and returns the corresponding offset
+within the table.
+@returns -1 if not found.
+
+XXX NOTE: there is no refresh of names or anything implemented yet, use
+this only during document load time.
+ */
+sal_Int32   GetColumnNameOffset( const OUString rName ) const;
+
+
 OUString GetSourceString() const;
 OUString GetOperations() const;
 
diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index c99f893..ef39e8b 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -603,6 +603,16 @@ void ScDBData::AdjustTableColumnNames( UpdateRefMode 
eUpdateRefMode, SCCOL nDx,
 aNewNames.swap( maTableColumnNames);
 }
 
+sal_Int32 ScDBData::GetColumnNameOffset( const OUString rName ) const
+{
+::std::vectorOUString::const_iterator it(
+::std::find( maTableColumnNames.begin(), maTableColumnNames.end(), 
rName));
+if (it != maTableColumnNames.end())
+return it - maTableColumnNames.begin();
+
+return -1;
+}
+
 namespace {
 
 class FindByTable : public unary_functionScDBData, bool
commit 98ba33677c288ff80c6f2812e85039175b7fcff8
Author: Eike Rathke er...@redhat.com
Date:   Thu Jun 25 11:44:46 2015 +0200

TableRef: invalidate table column names on most sheet operations

Kept only on insertions and deletions, but even that may not be useful
as the names aren't updated at any time so even a mere cell change will
bring this out of sync. But serves as a starting point for further
implementation.

Change-Id: Idfede4b03b9f554cd35f984502fce625c725853c

diff --git a/sc/inc/dbdata.hxx b/sc/inc/dbdata.hxx
index c1d41f9..b77e218 100644
--- a/sc/inc/dbdata.hxx
+++ b/sc/inc/dbdata.hxx
@@ -110,7 +110,6 @@ public:
 voidSetKeepFmt(bool bSet)   { bKeepFmt = bSet; }
 boolIsStripData() const { return bStripData; }
 voidSetStripData(bool bSet) { bStripData = bSet; }
-const ::std::vector OUString  GetTableColumnNames() { return 
maTableColumnNames; }
 voidSetTableColumnNames( const ::std::vector OUString  rNames ) 
{ maTableColumnNames = rNames; }
 
 OUString GetSourceString() const;
@@ -154,6 +153,11 @@ public:
 SCsCOL nDx, SCsROW nDy, SCsTAB nDz);
 
 void ExtendDataArea(ScDocument* pDoc);
+
+private:
+
+void AdjustTableColumnNames( UpdateRefMode eUpdateRefMode, SCCOL nDx, 
SCCOL nCol1,
+SCCOL nOldCol1, SCCOL nOldCol2, SCCOL nNewCol1, SCCOL nNewCol2 );
 };
 
 class SC_DLLPUBLIC ScDBCollection
diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index 34c2f69..c99f893 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -276,6 +276,8 @@ void ScDBData::GetArea(ScRange rRange) const
 
 void ScDBData::SetArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, 
SCROW nRow2)
 {
+::std::vectorOUString().swap( maTableColumnNames);// invalidate 
column names/offsets
+
 nTable  = nTab;
 nStartCol = nCol1;
 nStartRow = nRow1;
@@ -488,8 +490,13 @@ void ScDBData::UpdateMoveTab(SCTAB nOldPos, SCTAB nNewPos)
 
 bool bChanged = ( nTab != aRange.aStart.Tab() );
 if (bChanged)
+{
+// Save and restore column names, as SetArea() invalidates them.
+::std::vectorOUString aNames( maTableColumnNames);
 SetArea( nTab, aRange.aStart.Col(), aRange.aStart.Row(),
 aRange.aEnd.Col(),aRange.aEnd .Row() );
+maTableColumnNames = aNames;
+}
 
 //  MoveTo ist nicht noetig, wenn nur die Tabelle geaendert ist
 
@@ -510,12 +517,20 @@ void ScDBData::UpdateReference(ScDocument* pDoc, 
UpdateRefMode eUpdateRefMode,
 SCTAB theTab2;
 GetArea( theTab1, theCol1, theRow1, theCol2, theRow2 );
 theTab2 = theTab1;
+SCCOL nOldCol1 = theCol1, nOldCol2 = theCol2;
 
 bool bDoUpdate = ScRefUpdate::Update( pDoc, eUpdateRefMode,
 nCol1,nRow1,nTab1, 
nCol2,nRow2,nTab2, nDx,nDy,nDz,
 theCol1,theRow1,theTab1, 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2015-06-17 Thread Eike Rathke
 sc/inc/refdata.hxx   |5 ++
 sc/source/core/inc/interpre.hxx  |2 +
 sc/source/core/tool/interpr1.cxx |5 +-
 sc/source/core/tool/interpr4.cxx |   20 ++
 sc/source/core/tool/refdata.cxx  |   73 ++-
 5 files changed, 101 insertions(+), 4 deletions(-)

New commits:
commit fb6dd2a73074b9695bd8ddf7ba40f1819b03024e
Author: Eike Rathke er...@redhat.com
Date:   Thu Jun 18 00:05:58 2015 +0200

Resolves: tdf#83365 push proper references in INDIRECT

... that take relative/absolute addressing and sheet 3D flag into
account to be fed to reference extension via range operator.

Change-Id: Iabe13ae384577e2d71ca87af6482ddccbf7ad0ac

diff --git a/sc/inc/refdata.hxx b/sc/inc/refdata.hxx
index ac27db8..e0d9b80 100644
--- a/sc/inc/refdata.hxx
+++ b/sc/inc/refdata.hxx
@@ -57,6 +57,8 @@ public:
 void InitAddress( SCCOL nCol, SCROW nRow, SCTAB nTab );
 /// InitAddressRel: InitFlags and set address, everything relative to rPos
 void InitAddressRel( const ScAddress rAdr, const ScAddress rPos );
+/// InitFlags and set address, relative to rPos if rRef says so.
+void InitFromRefAddress( const ScRefAddress rRef, const ScAddress rPos );
 sal_uInt8 FlagValue() const { return mnFlagValue;}
 
 void SetColRel( bool bVal ) { Flags.bColRel = bVal; }
@@ -135,6 +137,9 @@ struct ScComplexRefData
 Ref2.InitAddress( nCol2, nRow2, nTab2 );
 }
 
+/// InitFlags and set range, relative to rPos if rRef1 and rRef2 say so.
+void InitFromRefAddresses( const ScRefAddress rRef1, const ScRefAddress 
rRef2, const ScAddress rPos );
+
 bool Valid() const;
 
 /** In external references nTab is -1 for the start tab and -1 for the end
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 443164e..aea7c5f 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -333,6 +333,8 @@ void PushExternalSingleRef(sal_uInt16 nFileId, const 
OUString rTabName,
 void PushExternalDoubleRef(sal_uInt16 nFileId, const OUString rTabName,
SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
SCCOL nCol2, SCROW nRow2, SCTAB nTab2);
+void PushSingleRef( const ScRefAddress rRef );
+void PushDoubleRef( const ScRefAddress rRef1, const ScRefAddress rRef2 );
 void PushMatrix( const sc::RangeMatrix rMat );
 void PushMatrix(const ScMatrixRef pMat);
 void PushError( sal_uInt16 nError );
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 66eef72..df14604 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -7052,8 +7052,7 @@ void ScInterpreter::ScIndirect()
 aRefAd2.Col(), aRefAd2.Row(), aRefAd2.Tab());
 }
 else
-PushDoubleRef( aRefAd.Col(), aRefAd.Row(), aRefAd.Tab(),
-aRefAd2.Col(), aRefAd2.Row(), aRefAd2.Tab() );
+PushDoubleRef( aRefAd, aRefAd2);
 }
 else if (ConvertSingleRef(pDok, sRefStr, nTab, aRefAd, aDetails, 
aExtInfo))
 {
@@ -7063,7 +7062,7 @@ void ScInterpreter::ScIndirect()
 aExtInfo.mnFileId, aExtInfo.maTabName, aRefAd.Col(), 
aRefAd.Row(), aRefAd.Tab());
 }
 else
-PushSingleRef( aRefAd.Col(), aRefAd.Row(), aRefAd.Tab() );
+PushSingleRef( aRefAd);
 }
 else
 {
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 04d7770..9aee92f 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -1968,6 +1968,26 @@ void ScInterpreter::PushExternalDoubleRef(
 }
 }
 
+void ScInterpreter::PushSingleRef( const ScRefAddress rRef )
+{
+if (!IfErrorPushError())
+{
+ScSingleRefData aRef;
+aRef.InitFromRefAddress( rRef, aPos);
+PushTempTokenWithoutError( new ScSingleRefToken( aRef ) );
+}
+}
+
+void ScInterpreter::PushDoubleRef( const ScRefAddress rRef1, const 
ScRefAddress rRef2 )
+{
+if (!IfErrorPushError())
+{
+ScComplexRefData aRef;
+aRef.InitFromRefAddresses( rRef1, rRef2, aPos);
+PushTempTokenWithoutError( new ScDoubleRefToken( aRef ) );
+}
+}
+
 void ScInterpreter::PushMatrix( const sc::RangeMatrix rMat )
 {
 if (!rMat.isRangeValid())
diff --git a/sc/source/core/tool/refdata.cxx b/sc/source/core/tool/refdata.cxx
index af18610..97d419c 100644
--- a/sc/source/core/tool/refdata.cxx
+++ b/sc/source/core/tool/refdata.cxx
@@ -41,6 +41,16 @@ void ScSingleRefData::InitAddressRel( const ScAddress rAdr, 
const ScAddress rP
 SetAddress(rAdr, rPos);
 }
 
+void ScSingleRefData::InitFromRefAddress( const ScRefAddress rRef, const 
ScAddress rPos )
+{
+InitFlags();
+SetColRel( rRef.IsRelCol());
+SetRowRel( rRef.IsRelRow());
+SetTabRel( rRef.IsRelTab());
+SetFlag3D( rRef.Tab() != rPos.Tab());
+

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source svtools/source svx/source svx/workben sw/qa sw/source

2015-05-27 Thread Caolán McNamara
 sc/inc/progress.hxx|   
 4 ++
 sc/source/core/data/column2.cxx|   
17 ++
 sc/source/core/data/formulacell.cxx|   
 8 +++-
 sc/source/core/tool/progress.cxx   |   
13 ---
 svtools/source/uno/wizard/unowizard.cxx|   
 2 -
 svx/source/accessibility/AccessibleTextHelper.cxx  |   
 6 +--
 svx/source/core/extedit.cxx|   
 2 -
 svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx  |   
10 ++---
 svx/source/dialog/_bmpmask.cxx |   
 2 -
 svx/source/dialog/imapwnd.hxx  |   
 2 -
 svx/source/dialog/svxruler.cxx |   
 2 -
 svx/source/engine3d/helperminimaldepth3d.cxx   |   
 2 -
 svx/source/engine3d/scene3d.cxx|   
 4 +-
 svx/source/engine3d/view3d.cxx |   
 2 -
 svx/source/fmcomp/fmgridif.cxx |   
 2 -
 svx/source/fmcomp/gridctrl.cxx |   
 4 +-
 svx/source/form/datanavi.cxx   |   
 4 +-
 svx/source/form/filtnav.cxx|   
 6 +--
 svx/source/form/fmpgeimp.cxx   |   
 2 -
 svx/source/form/fmscriptingenv.cxx |   
 4 +-
 svx/source/form/fmshimp.cxx|   
 2 -
 svx/source/form/fmundo.cxx |   
 2 -
 svx/source/form/fmvwimp.cxx|   
 4 --
 svx/source/form/formcontrolfactory.cxx |   
 2 -
 svx/source/form/formcontroller.cxx |   
 4 +-
 svx/source/form/formcontrolling.cxx|   
 6 +--
 svx/source/form/legacyformcontroller.cxx   |   
 2 -
 svx/source/gallery2/codec.hxx  |   
 4 +-
 svx/source/gallery2/galbrws2.cxx   |   
 2 -
 svx/source/sidebar/EmptyPanel.hxx  |   
 2 -
 svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx|   
 2 -
 svx/source/stbctrls/pszctrl.cxx|   
 2 -
 svx/source/stbctrls/selctrl.cxx|   
 2 -
 svx/source/svdraw/svddrgm1.hxx |   
12 +++
 svx/source/svdraw/svdhdl.cxx   |   
 2 -
 svx/source/svdraw/svdograf.cxx |   
 2 -
 svx/source/svdraw/svdoole2.cxx |   
 6 +--
 svx/source/svdraw/svdopath.cxx |   
 2 -
 svx/source/svdraw/svdotextdecomposition.cxx|   
 2 -
 svx/source/svdraw/svdotextpathdecomposition.cxx|   
 4 +-
 svx/source/svdraw/svdotxln.cxx |   
 2 -
 svx/source/svdraw/svdouno.cxx  |   
 2 -
 svx/source/svdraw/svdpage.cxx  |   
 2 -
 svx/source/table/accessibletableshape.cxx  |   
 2 -
 svx/source/table/propertyset.hxx   |   
 4 +-
 svx/source/table/svdotable.cxx |   
 2 -
 svx/source/table/tablecolumns.hxx  |   
 2 -
 svx/source/table/tablecontroller.cxx   |   
 2 -
 svx/source/table/tablelayouter.hxx |   
 2 -
 svx/source/table/tablemodel.hxx|   
 6 +--
 svx/source/table/tablerows.hxx |   
 2 -
 svx/source/table/tablertfimporter.cxx  |   
 6 +--
 svx/source/table/tableundo.hxx |   
 8 +---
 svx/source/table/viewcontactoftableobj.hxx |   
 2 -
 svx/source/tbxctrls/bulletsnumbering.cxx   |   
 2 -
 svx/source/tbxctrls/colrctrl.cxx   |   
 9 +
 svx/source/tbxctrls/extrusioncontrols.hxx  |   
 8 ++--
 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2015-05-18 Thread Markus Mohrhard
 sc/inc/document.hxx |2 +-
 sc/source/filter/inc/defnamesbuffer.hxx |5 +
 sc/source/filter/oox/defnamesbuffer.cxx |   17 +
 sc/source/filter/oox/workbookhelper.cxx |   20 
 4 files changed, 39 insertions(+), 5 deletions(-)

New commits:
commit 158b50763962f66515062300e265839828463efa
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Tue May 19 02:24:30 2015 +0200

use XL_A1 as ref string syntax for excel produced documents

Change-Id: Ieed3521674ef713d9c09313cd41d1edd6ba3dcc5

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 0a30c7b..7ea90f1 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -2160,7 +2160,7 @@ public:
 SC_DLLPUBLIC void DumpAreaBroadcasters() const;
 #endif
 
-void SetCalcConfig( const ScCalcConfig rConfig );
+SC_DLLPUBLIC void SetCalcConfig( const ScCalcConfig rConfig );
 const ScCalcConfig GetCalcConfig() const { return maCalcConfig; }
 
 void ConvertFormulaToValue( const ScRange rRange, sc::TableValues* pUndo 
);
diff --git a/sc/source/filter/oox/workbookhelper.cxx 
b/sc/source/filter/oox/workbookhelper.cxx
index 96db289..f34332a 100644
--- a/sc/source/filter/oox/workbookhelper.cxx
+++ b/sc/source/filter/oox/workbookhelper.cxx
@@ -34,6 +34,8 @@
 #include com/sun/star/style/XStyleFamiliesSupplier.hpp
 #include com/sun/star/table/CellAddress.hpp
 #include com/sun/star/container/XNamed.hpp
+#include com/sun/star/document/XDocumentProperties.hpp
+#include com/sun/star/document/XDocumentPropertiesSupplier.hpp
 #include osl/thread.h
 #include oox/helper/progressbar.hxx
 #include oox/helper/propertyset.hxx
@@ -521,6 +523,18 @@ void WorkbookGlobals::useInternalChartDataTable( bool 
bInternal )
 
 // private 
 
+namespace {
+
+formula::FormulaGrammar::AddressConvention 
getConvention(css::uno::ReferenceXDocumentProperties xDocProps)
+{
+if (xDocProps-getGenerator().startsWithIgnoreAsciiCase(Microsoft))
+return formula::FormulaGrammar::CONV_XL_A1;
+
+return formula::FormulaGrammar::CONV_OOO;
+}
+
+}
+
 void WorkbookGlobals::initialize( bool bWorkbookFile )
 {
 maCellStyles = CellStyles;
@@ -548,6 +562,12 @@ void WorkbookGlobals::initialize( bool bWorkbookFile )
 if (!mpDoc)
 throw RuntimeException(Workbookhelper::getScDocument(): Failed to 
access ScDocument from model);
 
+Reference XDocumentPropertiesSupplier  xPropSupplier( mxDoc, UNO_QUERY);
+Reference XDocumentProperties  xDocProps = 
xPropSupplier-getDocumentProperties();
+ScCalcConfig aCalcConfig = mpDoc-GetCalcConfig();
+aCalcConfig.meStringRefAddressSyntax = getConvention(xDocProps);
+mpDoc-SetCalcConfig(aCalcConfig);
+
 mxDocImport.reset(new ScDocumentImport(*mpDoc));
 
 mxFormulaBuffer.reset( new FormulaBuffer( *this ) );
commit c43a25a7268c1b6ab81e9ba694a1f3a24afa
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Tue May 19 01:45:57 2015 +0200

replace import with direct ScCompiler calls, related tdf#91367

Change-Id: Ib605536d002071ae753e7da87137deae00529272

diff --git a/sc/source/filter/inc/defnamesbuffer.hxx 
b/sc/source/filter/inc/defnamesbuffer.hxx
index 2ce6975..4177543 100644
--- a/sc/source/filter/inc/defnamesbuffer.hxx
+++ b/sc/source/filter/inc/defnamesbuffer.hxx
@@ -23,6 +23,10 @@
 #include formulabase.hxx
 #include rangenam.hxx
 
+#include memory
+
+class ScTokenArray;
+
 namespace com { namespace sun { namespace star {
 namespace sheet { class XNamedRange; }
 } } }
@@ -111,6 +115,7 @@ public:
 /** Converts the formula string or BIFF token array for this defined name. 
*/
 voidconvertFormula();
 ApiTokenSequencegetTokens();
+std::unique_ptrScTokenArray getScTokens();
 /** Returns true, if this defined name is global in the document. */
 inline bool isGlobalName() const { return mnCalcSheet  0; }
 /** Returns true, if this defined name is a special builtin name. */
diff --git a/sc/source/filter/oox/defnamesbuffer.cxx 
b/sc/source/filter/oox/defnamesbuffer.cxx
index dc30444..a24c96a 100644
--- a/sc/source/filter/oox/defnamesbuffer.cxx
+++ b/sc/source/filter/oox/defnamesbuffer.cxx
@@ -37,6 +37,7 @@
 #include worksheetbuffer.hxx
 #include tokenarray.hxx
 #include tokenuno.hxx
+#include compiler.hxx
 
 namespace oox {
 namespace xls {
@@ -380,6 +381,16 @@ DefinedName::getTokens()
 return aTokens;
 }
 
+std::unique_ptrScTokenArray DefinedName::getScTokens()
+{
+ScTokenArray aTokenArray;
+ScCompiler aCompiler(getScDocument(), ScAddress(0, 0, mnCalcSheet));
+aCompiler.SetGrammar(formula::FormulaGrammar::GRAM_OOXML);
+std::unique_ptrScTokenArray 
pArray(aCompiler.CompileString(maModel.maFormula));
+
+return pArray;
+}
+
 void DefinedName::convertFormula()
 {
 // macro function or vba procedure
@@ -389,10 +400,8 @@ void DefinedName::convertFormula()
 // 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2015-04-15 Thread Eike Rathke
 sc/inc/column.hxx |2 -
 sc/source/core/data/column2.cxx   |   15 --
 sc/source/core/tool/grouparealistener.cxx |   31 +-
 3 files changed, 40 insertions(+), 8 deletions(-)

New commits:
commit cff5ee864b2d87d74079697425d7895dbf1b2ba4
Author: Eike Rathke er...@redhat.com
Date:   Wed Apr 15 19:38:59 2015 +0200

tdf#89957 prevent crash, not really fixed

See source code comment.

Change-Id: I3ab7ab6aec1d782de0733064fea031c895f28965

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index d7dee13..8d0db57 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -361,7 +361,7 @@ public:
 voidGetFormula( SCROW nRow, OUString rFormula ) const;
 const ScFormulaCell* GetFormulaCell( SCROW nRow ) const;
 ScFormulaCell* GetFormulaCell( SCROW nRow );
-ScFormulaCell * const * GetFormulaCellBlockAddress( SCROW nRow ) const;
+ScFormulaCell * const * GetFormulaCellBlockAddress( SCROW nRow, size_t 
rBlockSize ) const;
 CellTypeGetCellType( SCROW nRow ) const;
 SCSIZE  GetCellCount() const;
 sal_uInt32 GetWeightedCount() const;
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 9376685..ef6c073 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -2712,26 +2712,37 @@ void ScColumn::SetNumberFormat( SCROW nRow, sal_uInt32 
nNumberFormat )
 ApplyAttr(nRow, SfxUInt32Item(ATTR_VALUE_FORMAT, nNumberFormat));
 }
 
-ScFormulaCell * const * ScColumn::GetFormulaCellBlockAddress( SCROW nRow ) 
const
+ScFormulaCell * const * ScColumn::GetFormulaCellBlockAddress( SCROW nRow, 
size_t rBlockSize ) const
 {
 if (!ValidRow(nRow))
+{
+rBlockSize = 0;
 return NULL;
+}
 
 std::pairsc::CellStoreType::const_iterator,size_t aPos = 
maCells.position(nRow);
 sc::CellStoreType::const_iterator it = aPos.first;
 if (it == maCells.end())
+{
+rBlockSize = 0;
 return NULL;
+}
 
 if (it-type != sc::element_type_formula)
+{
 // Not a formula cell.
+rBlockSize = 0;
 return NULL;
+}
 
+rBlockSize = it-size;
 return sc::formula_block::at(*it-data, aPos.second);
 }
 
 const ScFormulaCell* ScColumn::FetchFormulaCell( SCROW nRow ) const
 {
-ScFormulaCell const * const * pp = GetFormulaCellBlockAddress( nRow );
+size_t nBlockSize = 0;
+ScFormulaCell const * const * pp = GetFormulaCellBlockAddress( nRow, 
nBlockSize );
 return pp ? *pp : NULL;
 }
 
diff --git a/sc/source/core/tool/grouparealistener.cxx 
b/sc/source/core/tool/grouparealistener.cxx
index e8126a0..46155f9 100644
--- a/sc/source/core/tool/grouparealistener.cxx
+++ b/sc/source/core/tool/grouparealistener.cxx
@@ -190,13 +190,30 @@ void FormulaGroupAreaListener::collectFormulaCells(
  mnTopCellRow   mnTopCellRow   length   mnGroupLen 
 , col/tab   mpColumn-GetCol()  /  mpColumn-GetTab());
 
-ScFormulaCell* const * pp = mpColumn-GetFormulaCellBlockAddress( 
mnTopCellRow);
+size_t nBlockSize = 0;
+ScFormulaCell* const * pp = mpColumn-GetFormulaCellBlockAddress( 
mnTopCellRow, nBlockSize);
 if (!pp)
 {
 SAL_WARN(sc, GetFormulaCellBlockAddress not found);
 return;
 }
 
+/* FIXME: with tdf#89957 it happened that the actual block size in column
+ * AP (shifted from AO) of sheet 'w' was smaller than the remembered group
+ * length and correct. This is just a very ugly workaround, the real cause
+ * is yet unknown, but at least don't crash in such case. The intermediate
+ * cause is that not all affected group area listeners are destroyed and
+ * newly created, so mpColumn still points to the old column that then has
+ * the content of a shifted column. Effectively this workaround has the
+ * consequence that the group area listener is fouled up and not all
+ * formula cells are notified.. */
+if (nBlockSize  static_castsize_t(mnGroupLen))
+{
+SAL_WARN(sc.core,FormulaGroupAreaListener::collectFormulaCells() 
nBlockSize  
+nBlockSize  mnGroupLen   mnGroupLen);
+const_castFormulaGroupAreaListener*(this)-mnGroupLen = 
static_castSCROW(nBlockSize);
+}
+
 ScFormulaCell* const * ppEnd = pp + mnGroupLen;
 
 if (mbStartFixed)
@@ -285,7 +302,8 @@ ScAddress FormulaGroupAreaListener::getTopCellPos() const
 
 const ScFormulaCell* FormulaGroupAreaListener::getTopCell() const
 {
-const ScFormulaCell* const * pp = mpColumn-GetFormulaCellBlockAddress( 
mnTopCellRow);
+size_t nBlockSize = 0;
+const ScFormulaCell* const * pp = mpColumn-GetFormulaCellBlockAddress( 
mnTopCellRow, nBlockSize);
 SAL_WARN_IF(!pp, sc, GetFormulaCellBlockAddress not found);
 return pp ? *pp : NULL;
 }
commit b03563571fb922636635ea72f2dbda18d736ff89
Author: Eike Rathke er...@redhat.com
Date:   Tue Apr 14 23:09:46 2015 +0200

more SAL_INFO 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2015-03-31 Thread Eike Rathke
 sc/inc/scmatrix.hxx  |5 ---
 sc/source/core/tool/interpr1.cxx |2 -
 sc/source/core/tool/interpr5.cxx |   30 +-
 sc/source/core/tool/scmatrix.cxx |   63 ---
 4 files changed, 30 insertions(+), 70 deletions(-)

New commits:
commit e27d7c38ba1de0f4bbb1197bd84c063a0fdee9d1
Author: Eike Rathke er...@redhat.com
Date:   Tue Mar 31 17:21:44 2015 +0200

Revert tdf#89387 Add functor for ScAmpersand

This reverts commit 9a7959cd63be7b2f36da8af25e7673a525c4d66c.

It is not an equivalent replacement for the existing functionality, i.e.
it lacks the number to string conversion done through SvNumberFormatter
and instead of concatenating a numeric element produces an error value
element.

diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx
index 2ad51e0..e85054e 100644
--- a/sc/inc/scmatrix.hxx
+++ b/sc/inc/scmatrix.hxx
@@ -43,10 +43,6 @@ struct CompareOptions;
 
 }
 
-namespace svl {
-class SharedStringPool;
-}
-
 /**
  * Try NOT to use this struct.  This struct should go away in a hopefully
  * not so distant futture.
@@ -398,7 +394,6 @@ public:
 void MulOp(svl::SharedString aString, double fVal, ScMatrix rMat);
 void DivOp(bool bFlag, svl::SharedString aString, double fVal, ScMatrix 
rMat);
 void PowOp(bool bFlag, svl::SharedString aString, double fVal, ScMatrix 
rMat);
-void AmpersandOp(bool bFlag, svl::SharedString aString, ScMatrix rMat, 
svl::SharedStringPool rStrPool);
 
 ScMatrix operator+= ( const ScMatrix r );
 
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index 712316f..f2f8dd6 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -1367,9 +1367,37 @@ void ScInterpreter::ScAmpersand()
 for (SCSIZE j = 0; j  nR; ++j)
 pResMat-PutError( nGlobalError, i, j);
 }
+else if (bFlag)
+{
+for (SCSIZE i = 0; i  nC; ++i)
+for (SCSIZE j = 0; j  nR; ++j)
+{
+sal_uInt16 nErr = pMat-GetErrorIfNotString( i, j);
+if (nErr)
+pResMat-PutError( nErr, i, j);
+else
+{
+OUString aTmp = sStr;
+aTmp += pMat-GetString(*pFormatter, i, 
j).getString();
+pResMat-PutString(mrStrPool.intern(aTmp), i, j);
+}
+}
+}
 else
 {
-pMat-AmpersandOp(bFlag, sStr, *pResMat, mrStrPool);
+for (SCSIZE i = 0; i  nC; ++i)
+for (SCSIZE j = 0; j  nR; ++j)
+{
+sal_uInt16 nErr = pMat-GetErrorIfNotString( i, j);
+if (nErr)
+pResMat-PutError( nErr, i, j);
+else
+{
+OUString aTmp = pMat-GetString(*pFormatter, i, 
j).getString();
+aTmp += sStr;
+pResMat-PutString(mrStrPool.intern(aTmp), i, j);
+}
+}
 }
 PushMatrix(pResMat);
 }
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index a465e09..07e90db 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -29,7 +29,6 @@
 #include boost/noncopyable.hpp
 #include svl/zforlist.hxx
 #include svl/sharedstring.hxx
-#include svl/sharedstringpool.hxx
 #include tools/stream.hxx
 #include rtl/math.hxx
 
@@ -37,7 +36,6 @@
 
 #include vector
 #include limits
-#include functional
 
 #include mdds/multi_type_matrix.hpp
 #include mdds/multi_type_vector_types.hpp
@@ -2586,49 +2584,6 @@ public:
 }
 };
 
-
-struct AmpersandOp
-{
-private:
-std::functionsvl::SharedString(svl::SharedString,svl::SharedString) maOp;
-svl::SharedString maString;
-
-public:
-typedef svl::SharedString empty_value_type;
-typedef double number_value_type;
-typedef svl::SharedString string_value_type;
-
-
AmpersandOp(std::functionsvl::SharedString(svl::SharedString,svl::SharedString)
 aOp, svl::SharedString aString):
-maOp(aOp),
-maString(aString)
-{ }
-
-double operator()(double fVal) const
-{
-return CreateDoubleError(GetDoubleErrorValue(fVal));
-}
-
-double operator()(bool fVal) const
-{
-return CreateDoubleError(GetDoubleErrorValue(double(fVal)));
-}
-
-svl::SharedString operator()(svl::SharedString aVal) const
-{
-return maOp(maString, aVal);
-}
-
-svl::SharedString operator()(char) const
-{
-return maString;
-}
-
-bool useFunctionForEmpty() const
-{
-return true;
-}
-};
-
 }
 
 void 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2015-03-13 Thread Eike Rathke
 sc/inc/token.hxx |1 +
 sc/source/core/tool/compiler.cxx |   27 ---
 sc/source/core/tool/token.cxx|5 +
 3 files changed, 30 insertions(+), 3 deletions(-)

New commits:
commit 1e060e94629aac8b37d59e34159198aa9e8f4b39
Author: Eike Rathke er...@redhat.com
Date:   Fri Mar 13 18:18:57 2015 +

add items to ScTableRefToken

Change-Id: I23ddec273f7d3df0d5342b73c54ae411b9ef3782

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 7188176..ca67769 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -3308,23 +3308,44 @@ bool ScCompiler::IsErrorConstant( const OUString rName 
) const
 
 bool ScCompiler::IsTableRefItem( const OUString rName ) const
 {
+bool bItem = false;
 OpCodeHashMap::const_iterator iLook( mxSymbols-getHashMap()-find( 
rName));
 if (iLook != mxSymbols-getHashMap()-end())
 {
+// Only called when there actually is a current TableRef, hence
+// accessing maTableRefs.back() is safe.
+ScTableRefToken* p = 
dynamic_castScTableRefToken*(maTableRefs.back().mxToken.get());
+assert(p);  // not a ScTableRefToken can't be
+
 switch ((*iLook).second)
 {
 case ocTableRefItemAll:
+bItem = true;
+p-AddItem( ScTableRefToken::ALL);
+break;
 case ocTableRefItemHeaders:
+bItem = true;
+p-AddItem( ScTableRefToken::HEADERS);
+break;
 case ocTableRefItemData:
+bItem = true;
+p-AddItem( ScTableRefToken::DATA);
+break;
 case ocTableRefItemTotals:
+bItem = true;
+p-AddItem( ScTableRefToken::TOTALS);
+break;
 case ocTableRefItemThisRow:
-maRawToken.SetOpCode( (*iLook).second );
-return true;
+bItem = true;
+p-AddItem( ScTableRefToken::THIS_ROW);
+break;
 default:
 ;
 }
+if (bItem)
+maRawToken.SetOpCode( (*iLook).second );
 }
-return false;
+return bItem;
 }
 
 void ScCompiler::SetAutoCorrection( bool bVal )
commit 7dcaa806b8583224cb24d4a37ddf855b9c02150d
Author: Eike Rathke er...@redhat.com
Date:   Fri Mar 13 17:58:59 2015 +

add ScTableRefToken::AddItem()

Change-Id: Iab74e027d9929bc100ad92c2126c17fca1e2e46a

diff --git a/sc/inc/token.hxx b/sc/inc/token.hxx
index 6f6cd4b..899d163 100644
--- a/sc/inc/token.hxx
+++ b/sc/inc/token.hxx
@@ -237,6 +237,7 @@ public:
 virtual FormulaToken*   Clone() const SAL_OVERRIDE { return new 
ScTableRefToken(*this); }
 
 ItemGetItem() const;
+voidAddItem( Item );
 
 private:
 
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index eab3f8f..8963159 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -861,6 +861,11 @@ ScTableRefToken::Item ScTableRefToken::GetItem() const
 return meItem;
 }
 
+void ScTableRefToken::AddItem( ScTableRefToken::Item eItem )
+{
+meItem = static_castScTableRefToken::Item(meItem | eItem);
+}
+
 bool ScTableRefToken::operator==( const FormulaToken r ) const
 {
 if ( !FormulaToken::operator==(r) )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2015-03-12 Thread Eike Rathke
 sc/inc/compiler.hxx  |8 
 sc/inc/token.hxx |   11 ++-
 sc/source/core/tool/compiler.cxx |   29 ++---
 3 files changed, 40 insertions(+), 8 deletions(-)

New commits:
commit a4d67c9c9c2672ca6d2405075790e0891930b2e0
Author: Eike Rathke er...@redhat.com
Date:   Wed Mar 11 14:26:39 2015 +0100

TableRef: need to distinguish between entire table and All specified

Change-Id: I507b6dfc0ce1a7b0f28142b05e15834ad6e6ac80

diff --git a/sc/inc/token.hxx b/sc/inc/token.hxx
index a0a12ab..0d1aca1 100644
--- a/sc/inc/token.hxx
+++ b/sc/inc/token.hxx
@@ -215,11 +215,12 @@ public:
 
 enum Item
 {
-ALL  = 0,
-HEADERS  = 1,
-DATA = 2,
-TOTALS   = 4,
-THIS_ROW = 8
+TABLE= 0,
+ALL  = 1,
+HEADERS  = 2,
+DATA = 4,
+TOTALS   = 8,
+THIS_ROW = 16
 };
 
 ScTableRefToken( sal_uInt16 nIndex, Item eItem );
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index fd5edd4..e3d00e5 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -3938,7 +3938,7 @@ ScTokenArray* ScCompiler::CompileString( const OUString 
rFormula )
 const FormulaToken* pPrev = pArr-PeekPrev( nIdx);
 if (pPrev  pPrev-GetOpCode() == ocDBArea)
 {
-FormulaToken* pTableRefToken = new ScTableRefToken( 
pPrev-GetIndex(), ScTableRefToken::ALL);
+FormulaToken* pTableRefToken = new ScTableRefToken( 
pPrev-GetIndex(), ScTableRefToken::TABLE);
 maTableRefs.push_back( TableRefEntry( pTableRefToken));
 // pPrev may be dead hereafter.
 static_castScTokenArray*(pArr)-ReplaceToken( 1, 
pTableRefToken);
@@ -4700,7 +4700,7 @@ bool ScCompiler::HandleTableRef()
 ScTokenArray* pNew = new ScTokenArray();
 ScTableRefToken::Item eItem = pTR-GetItem();
 bool bGotToken = false;
-if (eItem == ScTableRefToken::ALL)
+if (eItem == ScTableRefToken::TABLE || eItem == ScTableRefToken::ALL)
 {
 ScComplexRefData aRefData;
 aRefData.InitFlags();
commit 519d2f6e5e820229d3548a33313ba15155121537
Author: Eike Rathke er...@redhat.com
Date:   Tue Mar 10 15:46:10 2015 +0100

add TableRef stack

Change-Id: If781e6ab13eb5ad175352e330379776d6ca4fcd8

diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx
index 298e341..ec99d45 100644
--- a/sc/inc/compiler.hxx
+++ b/sc/inc/compiler.hxx
@@ -313,6 +313,14 @@ private:
 std::vectorOUString maTabNames;/// sheet names mangled 
for the current grammar for output
 std::vectorOUString GetSetupTabNames() const; /// get or setup tab 
names for the current grammar
 
+struct TableRefEntry
+{
+ScTokenRef  mxToken;
+sal_uInt16  mnLevel;
+TableRefEntry( formula::FormulaToken* p ) : mxToken(p), mnLevel(0) {}
+};
+std::vectorTableRefEntry maTableRefs; /// stack of currently 
active ocTableRef tokens
+
 bool   NextNewToken(bool bInArray = false);
 
 virtual void SetError(sal_uInt16 nError) SAL_OVERRIDE;
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index c913ab7..fd5edd4 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -3938,11 +3938,34 @@ ScTokenArray* ScCompiler::CompileString( const 
OUString rFormula )
 const FormulaToken* pPrev = pArr-PeekPrev( nIdx);
 if (pPrev  pPrev-GetOpCode() == ocDBArea)
 {
+FormulaToken* pTableRefToken = new ScTableRefToken( 
pPrev-GetIndex(), ScTableRefToken::ALL);
+maTableRefs.push_back( TableRefEntry( pTableRefToken));
 // pPrev may be dead hereafter.
-static_castScTokenArray*(pArr)-ReplaceToken( 1,
-new ScTableRefToken( pPrev-GetIndex(), 
ScTableRefToken::ALL));
+static_castScTokenArray*(pArr)-ReplaceToken( 1, 
pTableRefToken);
 }
 }
+switch (eOp)
+{
+case ocTableRefOpen:
+SAL_WARN_IF( maTableRefs.empty(), sc.core, ocTableRefOpen 
without TableRefEntry);
+if (maTableRefs.empty())
+SetError(errPair);
+else
+++maTableRefs.back().mnLevel;
+break;
+case ocTableRefClose:
+SAL_WARN_IF( maTableRefs.empty(), sc.core, ocTableRefClose 
without TableRefEntry);
+if (maTableRefs.empty())
+SetError(errPair);
+else
+{
+if (--maTableRefs.back().mnLevel == 0)
+maTableRefs.pop_back();
+}
+break;
+default:
+break;
+}
 eLastOp = maRawToken.GetOpCode();
 

[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2015-03-12 Thread Eike Rathke
 sc/inc/token.hxx |2 +-
 sc/source/core/tool/compiler.cxx |3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 6e690a62e419b2de364bac09d30786b66a98f2f3
Author: Eike Rathke er...@redhat.com
Date:   Thu Mar 12 21:14:16 2015 +0100

TableRef: use existing ALL instead of yet another bit

Change-Id: I7f8cdba40d1d455927557c31867b822afb9dff7e

diff --git a/sc/inc/token.hxx b/sc/inc/token.hxx
index 662c17c..6f6cd4b 100644
--- a/sc/inc/token.hxx
+++ b/sc/inc/token.hxx
@@ -224,7 +224,7 @@ public:
 HEADERS_DATA = HEADERS | DATA,
 DATA_TOTALS = DATA | TOTALS,
 HEADERS_DATA_TOTALS = HEADERS | DATA | TOTALS,
-ALL_COLUMN = HEADERS_DATA_TOTALS | 32   // semantically the same, but 
just a [#All] item
+ALL_COLUMN = HEADERS_DATA_TOTALS | ALL  // semantically the same, but 
just a [#All] item
 };
 
 ScTableRefToken( sal_uInt16 nIndex, Item eItem );
commit e36c121992819853138bbce13141fcc30e6c643c
Author: Eike Rathke er...@redhat.com
Date:   Thu Mar 12 20:34:53 2015 +0100

TableRef: parse away an optional #All in entire table

Change-Id: Ibe7c67b608ab97c83fcac6adf95d67e00a74fd72

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index fb999b4..fd0bf45 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -4745,7 +4745,8 @@ bool ScCompiler::HandleTableRef()
 // Optional [] (or [#All]) may follow.
 if ((bGotToken = GetToken())  mpToken-GetOpCode() == 
ocTableRefOpen)
 {
-if ((bGotToken = GetToken())  mpToken-GetOpCode() == 
ocTableRefClose)
+bool bAll = ((bGotToken = GetToken())  mpToken-GetOpCode() 
== ocTableRefItemAll);
+if (bGotToken  (!bAll || (bGotToken = GetToken()))  
mpToken-GetOpCode() == ocTableRefClose)
 bGotToken = false;  // get next token below
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source

2015-03-10 Thread Tor Lillqvist
 sc/inc/tokenarray.hxx   |1 +
 sc/source/core/tool/token.cxx   |6 ++
 sc/source/filter/excel/excform8.cxx |   11 ++-
 sc/source/filter/inc/tokstack.hxx   |2 +-
 4 files changed, 18 insertions(+), 2 deletions(-)

New commits:
commit ddc1f7d9a816e2cc970d48d2ccc2c0cd256e6e03
Author: Tor Lillqvist t...@collabora.com
Date:   Tue Mar 10 09:04:57 2015 +0200

Fix issue in re-use of ScTokenArray objects from a TokenPool

The TokenPool::operator[] is used to initialise and take into use an object
from the pool. Which is a fascinating thing as such and probably not 
entirely
in good style. Anyway, the objects in the pool are of type ScTokenArray, a
class derived from FormulaTokenArray. The operator[] called the
FormulaTokenArray::Clear() function to initialise the object. This left the
fields added in ScTokenArray uninitialised, having whatever value the 
previous
use of the object had set. Which of course is bad.

In practice, this showed up in the handling of formulas in the .xls input
filter. If an earlier (or the first?) formula had happened to be one for 
which
we don't want to use OpenCL, the meVectorState of its ScTokenArray object in
the pool had been set to FormulaVectorDisabled. When the same pool object 
was
later re-used for another formula, it kept that same meVectorState, even if
there was no reason to. Thus formula groups that should have been OpenCL
accelerated weren't. This can have a significant impact on performance of
document loading and recalculation for large documents.

I added a function to ScTokenArray to clear (initialise) such an object, 
both
the FormulaTokenArray part and the ScTokenArray-specific part, and call that
instead. This fixes the issue.

I named the added function ClearScTokenArray() to make it clear that it is a
separate function. Sure, possibly Clear() should be made into a virtual of
FormulaTokenArry and overridden in ScTokenArray, and the overriding Clear()
would first call the base class's Clear(). But I can't be sure that there
aren't other calls of FormulaTokenArray::Clear() that *must* mean the base
class one. Better safe than sorry.

And of course, I did *not* want to name the function in ScTokenArray also
Clear(), like in the base class, without it being virtual. That is 
horrible
style in my opinion, even if there certainly is precedence for such even in
the very same classes, i.e. the Clone() function...

Change-Id: I0e0e13e5ca705603005a1e0a46866f095cd2ac4d

diff --git a/sc/inc/tokenarray.hxx b/sc/inc/tokenarray.hxx
index 4068745..0d3fa02 100644
--- a/sc/inc/tokenarray.hxx
+++ b/sc/inc/tokenarray.hxx
@@ -58,6 +58,7 @@ public:
 /// Assignment with references to FormulaToken entries (not copied!)
 ScTokenArray( const ScTokenArray );
 virtual ~ScTokenArray();
+void ClearScTokenArray();
 ScTokenArray* Clone() const;/// True copy!
 
 // An estimate of the number of cells referenced by the token array
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 55a0601..203f378 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1651,6 +1651,12 @@ ScTokenArray ScTokenArray::operator=( const 
ScTokenArray rArr )
 return *this;
 }
 
+void ScTokenArray::ClearScTokenArray()
+{
+Clear();
+meVectorState = FormulaVectorEnabled;
+}
+
 ScTokenArray* ScTokenArray::Clone() const
 {
 ScTokenArray* p = new ScTokenArray();
diff --git a/sc/source/filter/inc/tokstack.hxx 
b/sc/source/filter/inc/tokstack.hxx
index 7513d48..9e458d7 100644
--- a/sc/source/filter/inc/tokstack.hxx
+++ b/sc/source/filter/inc/tokstack.hxx
@@ -362,7 +362,7 @@ inline const TokenId TokenPool::LastId( void ) const
 
 const inline ScTokenArray* TokenPool::operator []( const TokenId rId )
 {
-pScToken-Clear();
+pScToken-ClearScTokenArray();
 
 if( rId )
 {//...only if rId  0!
commit bb0c05cebed131805d04919fac2b83030087451b
Author: Tor Lillqvist t...@collabora.com
Date:   Tue Mar 10 00:48:28 2015 +0200

Also relative row references need to wrap around, like fdo#84556 for columns

Change-Id: I07400d6dead66ec437436b5ea8b49491f8048335

diff --git a/sc/source/filter/excel/excform8.cxx 
b/sc/source/filter/excel/excform8.cxx
index ff4bd6c..ebe3b64 100644
--- a/sc/source/filter/excel/excform8.cxx
+++ b/sc/source/filter/excel/excform8.cxx
@@ -1479,7 +1479,16 @@ void ExcelToSc8::ExcRelToScRel8( sal_uInt16 nRow, 
sal_uInt16 nC, ScSingleRefData
 
 // R O W
 if( bRowRel )
-rSRD.SetRelRow(static_castsal_Int16(nRow));
+{
+SCROW nRelRow = static_castsal_Int16(nRow);
+sal_Int32 nDiff = aEingPos.Row() + nRelRow;
+if (nDiff  0)
+{
+// relative row references wrap around
+nRelRow = 65536 + nRelRow;
+}
+  

  1   2   >