[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source
Eike Rathke
erack at redhat.com
Thu Jul 16 08:56:37 PDT 2015
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 <erack at 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:
void GetSortParam(ScSortParam& rSortParam) const;
void SetSortParam(const ScSortParam& rSortParam);
+ /** Remember some more settings of ScSortParam, only to be called at
+ anonymous DB ranges as it at least overwrites bHasHeader. */
+ void UpdateFromSortParam( 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_function<ScDBData, 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 <erack at 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;
More information about the Libreoffice-commits
mailing list