summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/inc/sortopt.hxx2
-rw-r--r--sw/source/core/doc/docsort.cxx18
-rw-r--r--sw/source/core/doc/sortopt.cxx5
-rw-r--r--sw/source/core/unocore/unoobj.cxx42
-rw-r--r--sw/source/ui/misc/srtdlg.cxx12
5 files changed, 38 insertions, 41 deletions
diff --git a/sw/inc/sortopt.hxx b/sw/inc/sortopt.hxx
index b29460f1f647..41667ce91f77 100644
--- a/sw/inc/sortopt.hxx
+++ b/sw/inc/sortopt.hxx
@@ -47,7 +47,7 @@ struct SW_DLLPUBLIC SwSortOptions
SwSortOptions& operator=( SwSortOptions const & ) = delete; // MSVC2015 workaround
- std::vector<std::unique_ptr<SwSortKey>> aKeys;
+ std::vector<SwSortKey> aKeys;
SwSortDirection eDirection;
sal_Unicode cDeli;
LanguageType nLanguage;
diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx
index 3c2f8c1f019c..090385d6c419 100644
--- a/sw/source/core/doc/docsort.cxx
+++ b/sw/source/core/doc/docsort.cxx
@@ -121,8 +121,8 @@ int SwSortElement::keycompare(const SwSortElement& rCmp, sal_uInt16 nKey) const
// The actual comparison
const SwSortElement *pOrig, *pCmp;
- const SwSortKey* pSrtKey = pOptions->aKeys[ nKey ].get();
- if( pSrtKey->eSortOrder == SwSortOrder::Ascending )
+ const SwSortKey& rSrtKey = pOptions->aKeys[ nKey ];
+ if( rSrtKey.eSortOrder == SwSortOrder::Ascending )
{
pOrig = this;
pCmp = &rCmp;
@@ -133,7 +133,7 @@ int SwSortElement::keycompare(const SwSortElement& rCmp, sal_uInt16 nKey) const
pCmp = this;
}
- if( pSrtKey->bIsNumeric )
+ if( rSrtKey.bIsNumeric )
{
double n1 = pOrig->GetValue( nKey );
double n2 = pCmp->GetValue( nKey );
@@ -142,12 +142,12 @@ int SwSortElement::keycompare(const SwSortElement& rCmp, sal_uInt16 nKey) const
}
else
{
- if( !pLastAlgorithm || *pLastAlgorithm != pSrtKey->sSortType )
+ if( !pLastAlgorithm || *pLastAlgorithm != rSrtKey.sSortType )
{
if( pLastAlgorithm )
- *pLastAlgorithm = pSrtKey->sSortType;
+ *pLastAlgorithm = rSrtKey.sSortType;
else
- pLastAlgorithm = new OUString( pSrtKey->sSortType );
+ pLastAlgorithm = new OUString( rSrtKey.sSortType );
pSortCollator->loadCollatorAlgorithm( *pLastAlgorithm,
*pLocale,
pOptions->bIgnoreCase ? SW_COLLATOR_IGNORES : 0 );
@@ -196,7 +196,7 @@ OUString SwSortTextElement::GetKey(sal_uInt16 nId) const
const OUString& rStr = pTextNd->GetText();
sal_Unicode nDeli = pOptions->cDeli;
- sal_uInt16 nDCount = pOptions->aKeys[nId]->nColumnId, i = 1;
+ sal_uInt16 nDCount = pOptions->aKeys[nId].nColumnId, i = 1;
sal_Int32 nStart = 0;
// Find the delimiter
@@ -228,7 +228,7 @@ SwSortBoxElement::SwSortBoxElement( sal_uInt16 nRC )
OUString SwSortBoxElement::GetKey(sal_uInt16 nKey) const
{
const FndBox_* pFndBox;
- sal_uInt16 nCol = pOptions->aKeys[nKey]->nColumnId-1;
+ sal_uInt16 nCol = pOptions->aKeys[nKey].nColumnId-1;
if( SwSortDirection::Rows == pOptions->eDirection )
pFndBox = pBox->GetBox(nCol, nRow); // Sort rows
@@ -260,7 +260,7 @@ OUString SwSortBoxElement::GetKey(sal_uInt16 nKey) const
double SwSortBoxElement::GetValue( sal_uInt16 nKey ) const
{
const FndBox_* pFndBox;
- sal_uInt16 nCol = pOptions->aKeys[nKey]->nColumnId-1;
+ sal_uInt16 nCol = pOptions->aKeys[nKey].nColumnId-1;
if( SwSortDirection::Rows == pOptions->eDirection )
pFndBox = pBox->GetBox(nCol, nRow); // Sort rows
diff --git a/sw/source/core/doc/sortopt.cxx b/sw/source/core/doc/sortopt.cxx
index 06ac058568af..b5fc62ba845d 100644
--- a/sw/source/core/doc/sortopt.cxx
+++ b/sw/source/core/doc/sortopt.cxx
@@ -45,16 +45,13 @@ SwSortOptions::SwSortOptions()
}
SwSortOptions::SwSortOptions(const SwSortOptions& rOpt) :
+ aKeys( rOpt.aKeys ),
eDirection( rOpt.eDirection ),
cDeli( rOpt.cDeli ),
nLanguage( rOpt.nLanguage ),
bTable( rOpt.bTable ),
bIgnoreCase( rOpt.bIgnoreCase )
{
- for(auto const & pKey : rOpt.aKeys)
- {
- aKeys.push_back( std::make_unique<SwSortKey>(*pKey) );
- }
}
SwSortOptions::~SwSortOptions()
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index eeff66995bd3..56ad0c297eec 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -2588,21 +2588,21 @@ bool SwUnoCursorHelper::ConvertSortProperties(
rSortOpt.cDeli = ' ';
rSortOpt.eDirection = SwSortDirection::Columns; //!! UI text may be contrary though !!
- std::unique_ptr<SwSortKey> pKey1(new SwSortKey);
- pKey1->nColumnId = USHRT_MAX;
- pKey1->bIsNumeric = true;
- pKey1->eSortOrder = SwSortOrder::Ascending;
-
- std::unique_ptr<SwSortKey> pKey2(new SwSortKey);
- pKey2->nColumnId = USHRT_MAX;
- pKey2->bIsNumeric = true;
- pKey2->eSortOrder = SwSortOrder::Ascending;
-
- std::unique_ptr<SwSortKey> pKey3(new SwSortKey);
- pKey3->nColumnId = USHRT_MAX;
- pKey3->bIsNumeric = true;
- pKey3->eSortOrder = SwSortOrder::Ascending;
- SwSortKey* aKeys[3] = {pKey1.get(), pKey2.get(), pKey3.get()};
+ SwSortKey aKey1;
+ aKey1.nColumnId = USHRT_MAX;
+ aKey1.bIsNumeric = true;
+ aKey1.eSortOrder = SwSortOrder::Ascending;
+
+ SwSortKey aKey2;
+ aKey2.nColumnId = USHRT_MAX;
+ aKey2.bIsNumeric = true;
+ aKey2.eSortOrder = SwSortOrder::Ascending;
+
+ SwSortKey aKey3;
+ aKey3.nColumnId = USHRT_MAX;
+ aKey3.bIsNumeric = true;
+ aKey3.eSortOrder = SwSortOrder::Ascending;
+ SwSortKey* aKeys[3] = {&aKey1, &aKey2, &aKey3};
bool bOldSortdescriptor(false);
bool bNewSortdescriptor(false);
@@ -2813,17 +2813,17 @@ bool SwUnoCursorHelper::ConvertSortProperties(
bRet = false;
}
- if (pKey1->nColumnId != USHRT_MAX)
+ if (aKey1.nColumnId != USHRT_MAX)
{
- rSortOpt.aKeys.push_back(std::move(pKey1));
+ rSortOpt.aKeys.push_back(aKey1);
}
- if (pKey2->nColumnId != USHRT_MAX)
+ if (aKey2.nColumnId != USHRT_MAX)
{
- rSortOpt.aKeys.push_back(std::move(pKey2));
+ rSortOpt.aKeys.push_back(aKey2);
}
- if (pKey3->nColumnId != USHRT_MAX)
+ if (aKey3.nColumnId != USHRT_MAX)
{
- rSortOpt.aKeys.push_back(std::move(pKey3));
+ rSortOpt.aKeys.push_back(aKey3);
}
return bRet && !rSortOpt.aKeys.empty();
diff --git a/sw/source/ui/misc/srtdlg.cxx b/sw/source/ui/misc/srtdlg.cxx
index 5f03f9c6ea56..52ca7ba66246 100644
--- a/sw/source/ui/misc/srtdlg.cxx
+++ b/sw/source/ui/misc/srtdlg.cxx
@@ -259,8 +259,8 @@ void SwSortDlg::Apply()
sEntry = m_xTypDLB1->get_active_id();
aOptions.aKeys.push_back(
- std::make_unique<SwSortKey>( nCol1, sEntry,
- bAsc1 ? SwSortOrder::Ascending : SwSortOrder::Descending ));
+ SwSortKey( nCol1, sEntry,
+ bAsc1 ? SwSortOrder::Ascending : SwSortOrder::Descending ));
}
if( bCheck2 )
@@ -272,8 +272,8 @@ void SwSortDlg::Apply()
sEntry = m_xTypDLB2->get_active_id();
aOptions.aKeys.push_back(
- std::make_unique<SwSortKey>( nCol2, sEntry,
- bAsc2 ? SwSortOrder::Ascending : SwSortOrder::Descending ));
+ SwSortKey( nCol2, sEntry,
+ bAsc2 ? SwSortOrder::Ascending : SwSortOrder::Descending ));
}
if( bCheck3 )
@@ -285,8 +285,8 @@ void SwSortDlg::Apply()
sEntry = m_xTypDLB3->get_active_id();
aOptions.aKeys.push_back(
- std::make_unique<SwSortKey>( nCol3, sEntry,
- bAsc3 ? SwSortOrder::Ascending : SwSortOrder::Descending ));
+ SwSortKey( nCol3, sEntry,
+ bAsc3 ? SwSortOrder::Ascending : SwSortOrder::Descending ));
}
aOptions.eDirection = bCol ? SwSortDirection::Columns : SwSortDirection::Rows;