2010-10-12 15:59:00 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-11-30 12:23:25 +00:00
|
|
|
/*
|
|
|
|
* 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 .
|
|
|
|
*/
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2004-08-23 08:32:01 +00:00
|
|
|
#undef SC_DLLIMPLEMENTATION
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <vcl/msgbox.hxx>
|
2013-04-05 18:40:39 +02:00
|
|
|
#include <i18nlangtag/languagetag.hxx>
|
2001-03-13 09:05:29 +00:00
|
|
|
#include <svtools/collatorres.hxx>
|
|
|
|
#include <unotools/collatorwrapper.hxx>
|
|
|
|
#include <unotools/localedatawrapper.hxx>
|
|
|
|
#include <comphelper/processfactory.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
#include "scitems.hxx"
|
|
|
|
#include "uiitems.hxx"
|
|
|
|
#include "viewdata.hxx"
|
|
|
|
#include "document.hxx"
|
|
|
|
#include "global.hxx"
|
2011-03-24 23:14:28 -04:00
|
|
|
#include "globalnames.hxx"
|
2011-05-13 23:11:42 -04:00
|
|
|
#include "dbdata.hxx"
|
2000-09-18 16:07:07 +00:00
|
|
|
#include "userlist.hxx"
|
|
|
|
#include "rangeutl.hxx"
|
|
|
|
#include "scresid.hxx"
|
2013-10-22 15:58:57 +03:00
|
|
|
#include "sc.hrc"
|
2000-09-18 16:07:07 +00:00
|
|
|
#include "globstr.hrc"
|
|
|
|
|
2012-05-21 23:04:12 +02:00
|
|
|
#include "sortkeydlg.hxx"
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
#include "sortdlg.hxx"
|
|
|
|
|
|
|
|
#include "tpsort.hxx"
|
|
|
|
|
2001-03-13 09:05:29 +00:00
|
|
|
using namespace com::sun::star;
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
/*
|
2012-02-28 19:14:26 +05:30
|
|
|
* Since the settings on the second Tab Page (Options) effects
|
|
|
|
* the first Tab Page, there must be a way for it to communicate with the
|
|
|
|
* other Page.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2012-02-28 19:14:26 +05:30
|
|
|
* At the moment this problem is solved through using two data members of the
|
|
|
|
* Tab Pages. If a page is enabled / disabled, it compares this data member
|
|
|
|
* with its own state (-> Activate() / Deactivate()).
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2012-02-28 19:14:26 +05:30
|
|
|
* In the meantime the class SfxTabPage offers the following method:
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2011-01-17 13:20:22 +01:00
|
|
|
* virtual sal_Bool HasExchangeSupport() const; -> return sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
* virtual void ActivatePage(const SfxItemSet &);
|
|
|
|
* virtual int DeactivatePage(SfxItemSet * = 0);
|
|
|
|
*
|
2012-02-28 19:14:26 +05:30
|
|
|
* This still needs to be changed!
|
2000-09-18 16:07:07 +00:00
|
|
|
*/
|
|
|
|
|
2012-02-28 19:14:26 +05:30
|
|
|
// Sort Criteria Tab page
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
ScTabPageSortFields::ScTabPageSortFields(vcl::Window* pParent,
|
2012-12-04 09:35:19 +00:00
|
|
|
const SfxItemSet& rArgSet)
|
|
|
|
: SfxTabPage(pParent, "SortCriteriaPage",
|
2014-06-11 14:34:46 +02:00
|
|
|
"modules/scalc/ui/sortcriteriapage.ui", &rArgSet)
|
2012-12-04 09:35:19 +00:00
|
|
|
,
|
2014-02-25 19:58:48 +01:00
|
|
|
|
2012-08-15 10:46:08 +02:00
|
|
|
aStrUndefined ( SC_RESSTR( SCSTR_UNDEFINED ) ),
|
|
|
|
aStrColumn ( SC_RESSTR( SCSTR_COLUMN ) ),
|
|
|
|
aStrRow ( SC_RESSTR( SCSTR_ROW ) ),
|
2014-02-25 19:58:48 +01:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
nWhichSort ( rArgSet.GetPool()->GetWhich( SID_SORT ) ),
|
2014-10-27 14:18:17 +02:00
|
|
|
pDlg ( static_cast<ScSortDlg*>(GetParentDialog()) ),
|
2007-02-27 12:05:23 +00:00
|
|
|
pViewData ( NULL ),
|
2014-10-27 14:18:17 +02:00
|
|
|
aSortData ( static_cast<const ScSortItem&>(
|
2000-09-18 16:07:07 +00:00
|
|
|
rArgSet.Get( nWhichSort )).
|
|
|
|
GetSortData() ),
|
|
|
|
nFieldCount ( 0 ),
|
2012-04-05 05:05:40 +02:00
|
|
|
nSortKeyCount ( DEFSORT ),
|
2011-03-10 16:55:21 -05:00
|
|
|
bHasHeader ( false ),
|
2012-05-21 23:04:12 +02:00
|
|
|
bSortByRows ( false ),
|
2012-12-04 09:35:19 +00:00
|
|
|
maSortKeyCtrl ( this, maSortKeyItems )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
Init();
|
|
|
|
SetExchangeSupport();
|
|
|
|
}
|
|
|
|
|
2015-03-09 14:29:30 +02:00
|
|
|
ScTabPageSortFields::~ScTabPageSortFields()
|
|
|
|
{
|
2015-03-10 09:07:06 +02:00
|
|
|
disposeOnce();
|
2015-03-09 14:29:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScTabPageSortFields::dispose()
|
|
|
|
{
|
|
|
|
pDlg.clear();
|
2015-05-07 19:08:18 +01:00
|
|
|
maSortKeyItems.clear();
|
|
|
|
maSortKeyCtrl.dispose();
|
2015-03-09 14:29:30 +02:00
|
|
|
SfxTabPage::dispose();
|
|
|
|
}
|
|
|
|
|
2012-12-04 09:35:19 +00:00
|
|
|
void ScTabPageSortFields::SetPosSizePixel(const Point& rAllocPos, const Size& rAllocation)
|
|
|
|
{
|
|
|
|
SfxTabPage::SetPosSizePixel(rAllocPos, rAllocation);
|
|
|
|
maSortKeyCtrl.setScrollRange();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScTabPageSortFields::SetSizePixel(const Size& rAllocation)
|
|
|
|
{
|
|
|
|
SfxTabPage::SetSizePixel(rAllocation);
|
|
|
|
maSortKeyCtrl.setScrollRange();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScTabPageSortFields::SetPosPixel(const Point& rAllocPos)
|
|
|
|
{
|
|
|
|
SfxTabPage::SetPosPixel(rAllocPos);
|
|
|
|
maSortKeyCtrl.setScrollRange();
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
void ScTabPageSortFields::Init()
|
|
|
|
{
|
2014-10-27 14:18:17 +02:00
|
|
|
const ScSortItem& rSortItem = static_cast<const ScSortItem&>(
|
|
|
|
GetItemSet().Get( nWhichSort ));
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
pViewData = rSortItem.GetViewData();
|
2011-05-21 15:04:26 +02:00
|
|
|
OSL_ENSURE( pViewData, "ViewData not found!" );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2012-04-05 05:05:40 +02:00
|
|
|
nFieldArr.push_back( 0 );
|
2004-06-04 10:21:49 +00:00
|
|
|
nFirstCol = 0;
|
|
|
|
nFirstRow = 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2012-05-21 23:04:12 +02:00
|
|
|
// Create three sort key dialogs by default
|
|
|
|
for ( sal_uInt16 i=0; i<nSortKeyCount; i++ )
|
2013-04-15 22:41:17 +02:00
|
|
|
{
|
|
|
|
maSortKeyCtrl.AddSortKey(i+1);
|
|
|
|
maSortKeyItems[i].m_pLbSort->SetSelectHdl( LINK( this, ScTabPageSortFields, SelectHdl ) );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2015-04-17 13:51:33 +01:00
|
|
|
VclPtr<SfxTabPage> ScTabPageSortFields::Create( vcl::Window* pParent,
|
|
|
|
const SfxItemSet* rArgSet )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2015-04-17 13:51:33 +01:00
|
|
|
return VclPtr<ScTabPageSortFields>::Create( pParent, *rArgSet );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2014-06-11 10:35:24 +02:00
|
|
|
void ScTabPageSortFields::Reset( const SfxItemSet* /* rArgSet */ )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2012-05-21 23:04:12 +02:00
|
|
|
bSortByRows = aSortData.bByRow;
|
|
|
|
bHasHeader = aSortData.bHasHeader;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2012-12-04 09:35:19 +00:00
|
|
|
if ( maSortKeyItems[0].m_pLbSort->GetEntryCount() == 0 )
|
2012-04-05 05:05:40 +02:00
|
|
|
FillFieldLists(0);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2012-02-28 19:14:26 +05:30
|
|
|
// ListBox selection:
|
2015-01-23 14:42:28 +00:00
|
|
|
if (!aSortData.maKeyState.empty() && aSortData.maKeyState[0].bDoSort)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-04-06 21:43:48 +02:00
|
|
|
// Make sure that the all sort keys are reset
|
2013-05-07 20:19:54 +02:00
|
|
|
for ( sal_uInt16 i=nSortKeyCount; i<aSortData.GetSortKeyCount(); i++ )
|
2013-04-15 22:41:17 +02:00
|
|
|
{
|
|
|
|
maSortKeyCtrl.AddSortKey(i+1);
|
|
|
|
maSortKeyItems[i].m_pLbSort->SetSelectHdl( LINK( this,
|
|
|
|
ScTabPageSortFields, SelectHdl ) );
|
|
|
|
}
|
2013-05-07 20:19:54 +02:00
|
|
|
nSortKeyCount = aSortData.GetSortKeyCount();
|
2013-04-06 21:43:48 +02:00
|
|
|
FillFieldLists(0);
|
|
|
|
|
2012-04-05 05:05:40 +02:00
|
|
|
for ( sal_uInt16 i=0; i<nSortKeyCount; i++ )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-04-06 21:43:48 +02:00
|
|
|
if (aSortData.maKeyState[i].bDoSort )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2012-12-04 09:35:19 +00:00
|
|
|
maSortKeyItems[i].m_pLbSort->SelectEntryPos( GetFieldSelPos(
|
2012-05-21 23:04:12 +02:00
|
|
|
aSortData.maKeyState[i].nField ) );
|
|
|
|
(aSortData.maKeyState[i].bAscending)
|
2012-12-04 09:35:19 +00:00
|
|
|
? maSortKeyItems[i].m_pBtnUp->Check()
|
|
|
|
: maSortKeyItems[i].m_pBtnDown->Check();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-12-04 09:35:19 +00:00
|
|
|
maSortKeyItems[i].m_pLbSort->SelectEntryPos( 0 ); // Select none
|
|
|
|
maSortKeyItems[i].m_pBtnUp->Check();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-04-05 05:05:40 +02:00
|
|
|
// Enable or disable field depending on preceding Listbox selection
|
2012-05-21 23:04:12 +02:00
|
|
|
maSortKeyItems[0].EnableField();
|
2012-04-05 05:05:40 +02:00
|
|
|
for ( sal_uInt16 i=1; i<nSortKeyCount; i++ )
|
2012-12-04 09:35:19 +00:00
|
|
|
if ( maSortKeyItems[i - 1].m_pLbSort->GetSelectEntryPos() == 0 )
|
2012-05-21 23:04:12 +02:00
|
|
|
maSortKeyItems[i].DisableField();
|
2012-04-05 05:05:40 +02:00
|
|
|
else
|
2012-05-21 23:04:12 +02:00
|
|
|
maSortKeyItems[i].EnableField();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-12-11 08:36:38 +00:00
|
|
|
SCCOL nCol = pViewData->GetCurX();
|
|
|
|
|
2012-05-21 23:04:12 +02:00
|
|
|
if( nCol < aSortData.nCol1 )
|
|
|
|
nCol = aSortData.nCol1;
|
|
|
|
else if( nCol > aSortData.nCol2 )
|
|
|
|
nCol = aSortData.nCol2;
|
2012-04-05 05:05:40 +02:00
|
|
|
|
2012-05-21 23:04:12 +02:00
|
|
|
sal_uInt16 nSort1Pos = nCol - aSortData.nCol1+1;
|
2012-04-05 05:05:40 +02:00
|
|
|
|
2012-12-04 09:35:19 +00:00
|
|
|
maSortKeyItems[0].m_pLbSort->SelectEntryPos( nSort1Pos );
|
2012-04-05 05:05:40 +02:00
|
|
|
for ( sal_uInt16 i=1; i<nSortKeyCount; i++ )
|
2012-12-04 09:35:19 +00:00
|
|
|
maSortKeyItems[i].m_pLbSort->SelectEntryPos( 0 );
|
2012-04-05 05:05:40 +02:00
|
|
|
|
|
|
|
for ( sal_uInt16 i=0; i<nSortKeyCount; i++ )
|
2012-12-04 09:35:19 +00:00
|
|
|
maSortKeyItems[i].m_pBtnUp->Check();
|
2012-05-21 23:04:12 +02:00
|
|
|
|
|
|
|
maSortKeyItems[0].EnableField();
|
|
|
|
maSortKeyItems[1].EnableField();
|
2012-04-05 05:05:40 +02:00
|
|
|
for ( sal_uInt16 i=2; i<nSortKeyCount; i++ )
|
2012-05-21 23:04:12 +02:00
|
|
|
maSortKeyItems[i].DisableField();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( pDlg )
|
|
|
|
{
|
|
|
|
pDlg->SetByRows ( bSortByRows );
|
|
|
|
pDlg->SetHeaders( bHasHeader );
|
|
|
|
}
|
2013-05-04 01:39:24 +02:00
|
|
|
|
|
|
|
// Make sure that there is always a last undefined sort key
|
|
|
|
if ( maSortKeyItems[nSortKeyCount - 1].m_pLbSort->GetSelectEntryPos() > 0 )
|
|
|
|
SetLastSortKey( nSortKeyCount );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2014-06-10 17:23:12 +02:00
|
|
|
bool ScTabPageSortFields::FillItemSet( SfxItemSet* rArgSet )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2012-05-21 23:04:12 +02:00
|
|
|
ScSortParam aNewSortData = aSortData;
|
2012-05-07 02:43:11 +02:00
|
|
|
|
2012-07-13 08:16:57 +02:00
|
|
|
if (pDlg)
|
|
|
|
{
|
|
|
|
const SfxItemSet* pExample = pDlg->GetExampleSet();
|
|
|
|
const SfxPoolItem* pItem;
|
2014-09-10 17:53:41 +02:00
|
|
|
if ( pExample && pExample->GetItemState( nWhichSort, true, &pItem ) == SfxItemState::SET )
|
2012-07-13 08:16:57 +02:00
|
|
|
{
|
|
|
|
ScSortParam aTempData = static_cast<const ScSortItem*>(pItem)->GetSortData();
|
|
|
|
aTempData.maKeyState = aNewSortData.maKeyState;
|
|
|
|
aNewSortData = aTempData;
|
|
|
|
}
|
|
|
|
}
|
2014-03-01 03:13:28 +01:00
|
|
|
std::vector<sal_Int32> nSortPos;
|
2012-03-31 18:33:21 +02:00
|
|
|
|
2012-04-05 05:05:40 +02:00
|
|
|
for ( sal_uInt16 i=0; i<nSortKeyCount; i++ )
|
|
|
|
{
|
2012-12-04 09:35:19 +00:00
|
|
|
nSortPos.push_back( maSortKeyItems[i].m_pLbSort->GetSelectEntryPos() );
|
2012-04-04 15:30:35 -04:00
|
|
|
|
2012-04-05 05:05:40 +02:00
|
|
|
if ( nSortPos[i] == LISTBOX_ENTRY_NOTFOUND ) nSortPos[i] = 0;
|
|
|
|
}
|
2012-04-04 15:30:35 -04:00
|
|
|
|
2013-05-07 20:19:54 +02:00
|
|
|
if( nSortKeyCount >= aNewSortData.GetSortKeyCount() )
|
2012-11-12 03:08:54 +01:00
|
|
|
aNewSortData.maKeyState.resize(nSortKeyCount);
|
|
|
|
|
2012-04-05 05:05:40 +02:00
|
|
|
if ( nSortPos[0] > 0 )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2012-04-05 05:05:40 +02:00
|
|
|
for ( sal_uInt16 i=0; i<nSortKeyCount; i++ )
|
|
|
|
aNewSortData.maKeyState[i].bDoSort = (nSortPos[i] > 0);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2012-02-28 19:14:26 +05:30
|
|
|
// If the "OK" was selected on the Options page while the sort
|
|
|
|
// direction was changed, then the first field (i.e. nFieldArr[0])
|
|
|
|
// of the respective direction is chosen as the sorting criterion:
|
2014-02-24 09:44:17 +00:00
|
|
|
if ( pDlg && bSortByRows != pDlg->GetByRows() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2012-04-05 05:05:40 +02:00
|
|
|
for ( sal_uInt16 i=0; i<nSortKeyCount; i++ )
|
|
|
|
aNewSortData.maKeyState[i].nField = ( bSortByRows ?
|
|
|
|
static_cast<SCCOLROW>(nFirstRow) :
|
|
|
|
static_cast<SCCOLROW>(nFirstCol) );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-04-05 05:05:40 +02:00
|
|
|
for ( sal_uInt16 i=0; i<nSortKeyCount; i++ )
|
|
|
|
aNewSortData.maKeyState[i].nField = nFieldArr[nSortPos[i]];
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2012-04-05 05:05:40 +02:00
|
|
|
for ( sal_uInt16 i=0; i<nSortKeyCount; i++ )
|
2012-12-04 09:35:19 +00:00
|
|
|
aNewSortData.maKeyState[i].bAscending = maSortKeyItems[i].m_pBtnUp->IsChecked();
|
2012-04-05 05:05:40 +02:00
|
|
|
|
2012-02-28 19:14:26 +05:30
|
|
|
// bHasHeader is in ScTabPageSortOptions::FillItemSet, where it belongs
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-04-05 05:05:40 +02:00
|
|
|
for ( sal_uInt16 i=0; i<nSortKeyCount; i++ )
|
|
|
|
aNewSortData.maKeyState[i].bDoSort = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2014-06-10 17:23:12 +02:00
|
|
|
rArgSet->Put( ScSortItem( SCITEM_SORTDATA, NULL, &aNewSortData ) );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-03-26 15:34:49 +02:00
|
|
|
return true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2012-10-17 11:01:15 +02:00
|
|
|
// for data exchange without dialogue detour:
|
|
|
|
void ScTabPageSortFields::ActivatePage( const SfxItemSet& rSet )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2012-10-17 11:01:15 +02:00
|
|
|
// Refresh local copy with shared data
|
|
|
|
aSortData = static_cast<const ScSortItem&>(rSet.Get( SCITEM_SORTDATA )).GetSortData();
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( pDlg )
|
|
|
|
{
|
2012-04-05 05:05:40 +02:00
|
|
|
if ( bHasHeader != pDlg->GetHeaders()
|
|
|
|
|| bSortByRows != pDlg->GetByRows() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2012-04-05 05:05:40 +02:00
|
|
|
std::vector<sal_uInt16> nCurSel;
|
|
|
|
for ( sal_uInt16 i=0; i<nSortKeyCount; i++ )
|
2012-12-04 09:35:19 +00:00
|
|
|
nCurSel.push_back( maSortKeyItems[i].m_pLbSort->GetSelectEntryPos() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
bHasHeader = pDlg->GetHeaders();
|
|
|
|
bSortByRows = pDlg->GetByRows();
|
2012-04-05 05:05:40 +02:00
|
|
|
FillFieldLists(0);
|
|
|
|
|
|
|
|
for ( sal_uInt16 i=0; i<nSortKeyCount; i++ )
|
2012-12-04 09:35:19 +00:00
|
|
|
maSortKeyItems[i].m_pLbSort->SelectEntryPos( nCurSel[i] );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-27 16:43:07 +02:00
|
|
|
SfxTabPage::sfxpg ScTabPageSortFields::DeactivatePage( SfxItemSet* pSetP )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if ( pDlg )
|
|
|
|
{
|
|
|
|
if ( bHasHeader != pDlg->GetHeaders() )
|
|
|
|
pDlg->SetHeaders( bHasHeader );
|
|
|
|
|
|
|
|
if ( bSortByRows != pDlg->GetByRows() )
|
|
|
|
pDlg->SetByRows( bSortByRows );
|
|
|
|
}
|
|
|
|
|
2007-02-27 12:05:23 +00:00
|
|
|
if ( pSetP )
|
2014-06-10 17:23:12 +02:00
|
|
|
FillItemSet( pSetP );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
return SfxTabPage::LEAVE_PAGE;
|
|
|
|
}
|
|
|
|
|
2012-04-05 05:05:40 +02:00
|
|
|
void ScTabPageSortFields::FillFieldLists( sal_uInt16 nStartField )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if ( pViewData )
|
|
|
|
{
|
|
|
|
ScDocument* pDoc = pViewData->GetDocument();
|
|
|
|
|
|
|
|
if ( pDoc )
|
|
|
|
{
|
2012-04-05 05:05:40 +02:00
|
|
|
for ( sal_uInt16 i=nStartField; i<nSortKeyCount; i++ )
|
|
|
|
{
|
2012-12-04 09:35:19 +00:00
|
|
|
maSortKeyItems[i].m_pLbSort->Clear();
|
|
|
|
maSortKeyItems[i].m_pLbSort->InsertEntry( aStrUndefined, 0 );
|
2012-04-05 05:05:40 +02:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2012-05-21 23:04:12 +02:00
|
|
|
SCCOL nFirstSortCol = aSortData.nCol1;
|
|
|
|
SCROW nFirstSortRow = aSortData.nRow1;
|
2004-06-04 10:21:49 +00:00
|
|
|
SCTAB nTab = pViewData->GetTabNo();
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_uInt16 i = 1;
|
2013-01-18 10:17:57 +01:00
|
|
|
nFieldArr.clear();
|
|
|
|
nFieldArr.push_back(0);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( bSortByRows )
|
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString aFieldName;
|
2012-05-21 23:04:12 +02:00
|
|
|
SCCOL nMaxCol = aSortData.nCol2;
|
2004-06-04 10:21:49 +00:00
|
|
|
SCCOL col;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2007-02-27 12:05:23 +00:00
|
|
|
for ( col=nFirstSortCol; col<=nMaxCol && i<SC_MAXFIELDS; col++ )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-01-30 01:19:15 -05:00
|
|
|
aFieldName = pDoc->GetString(col, nFirstSortRow, nTab);
|
2012-08-15 10:46:08 +02:00
|
|
|
if ( !bHasHeader || aFieldName.isEmpty() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-11-08 14:22:21 +01:00
|
|
|
aFieldName = ScGlobal::ReplaceOrAppend( aStrColumn, "%1", ScColToAlpha( col ));
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2012-04-05 05:05:40 +02:00
|
|
|
nFieldArr.push_back( col );
|
|
|
|
|
|
|
|
for ( sal_uInt16 j=nStartField; j<nSortKeyCount; j++ )
|
2012-12-04 09:35:19 +00:00
|
|
|
maSortKeyItems[j].m_pLbSort->InsertEntry( aFieldName, i );
|
2012-04-05 05:05:40 +02:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString aFieldName;
|
2012-05-21 23:04:12 +02:00
|
|
|
SCROW nMaxRow = aSortData.nRow2;
|
2004-06-04 10:21:49 +00:00
|
|
|
SCROW row;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2007-02-27 12:05:23 +00:00
|
|
|
for ( row=nFirstSortRow; row<=nMaxRow && i<SC_MAXFIELDS; row++ )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-01-30 01:19:15 -05:00
|
|
|
aFieldName = pDoc->GetString(nFirstSortCol, row, nTab);
|
2012-08-15 10:46:08 +02:00
|
|
|
if ( !bHasHeader || aFieldName.isEmpty() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-11-08 14:22:21 +01:00
|
|
|
aFieldName = ScGlobal::ReplaceOrAppend( aStrRow, "%1", OUString::number( row+1));
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2012-04-05 05:05:40 +02:00
|
|
|
nFieldArr.push_back( row );
|
|
|
|
|
|
|
|
for ( sal_uInt16 j=nStartField; j<nSortKeyCount; j++ )
|
2012-12-04 09:35:19 +00:00
|
|
|
maSortKeyItems[j].m_pLbSort->InsertEntry( aFieldName, i );
|
2012-04-05 05:05:40 +02:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
nFieldCount = i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_uInt16 ScTabPageSortFields::GetFieldSelPos( SCCOLROW nField )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_uInt16 nFieldPos = 0;
|
2014-04-23 11:08:48 +02:00
|
|
|
bool bFound = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
for ( sal_uInt16 n=1; n<nFieldCount && !bFound; n++ )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if ( nFieldArr[n] == nField )
|
|
|
|
{
|
|
|
|
nFieldPos = n;
|
2014-04-23 11:08:48 +02:00
|
|
|
bFound = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nFieldPos;
|
|
|
|
}
|
|
|
|
|
2013-05-04 01:39:24 +02:00
|
|
|
void ScTabPageSortFields::SetLastSortKey( sal_uInt16 nItem )
|
|
|
|
{
|
|
|
|
// Extend local SortParam copy
|
|
|
|
const ScSortKeyState atempKeyState = { false, 0, true };
|
|
|
|
aSortData.maKeyState.push_back( atempKeyState );
|
|
|
|
|
|
|
|
// Add Sort Key Item
|
|
|
|
++nSortKeyCount;
|
|
|
|
maSortKeyCtrl.AddSortKey( nSortKeyCount );
|
|
|
|
maSortKeyItems[nItem].m_pLbSort->SetSelectHdl(
|
|
|
|
LINK( this, ScTabPageSortFields, SelectHdl ) );
|
|
|
|
|
|
|
|
FillFieldLists( nItem );
|
|
|
|
|
|
|
|
// Set Status
|
|
|
|
maSortKeyItems[nItem].m_pBtnUp->Check();
|
|
|
|
maSortKeyItems[nItem].m_pLbSort->SelectEntryPos( 0 );
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
// Handler:
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
IMPL_LINK( ScTabPageSortFields, SelectHdl, ListBox *, pLb )
|
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString aSelEntry = pLb->GetSelectEntry();
|
2012-05-21 23:04:12 +02:00
|
|
|
ScSortKeyItems::iterator pIter;
|
|
|
|
|
|
|
|
// If last listbox is enabled add one item
|
2012-12-04 09:35:19 +00:00
|
|
|
if ( maSortKeyItems.back().m_pLbSort == pLb )
|
2012-05-21 23:04:12 +02:00
|
|
|
if ( aSelEntry != aStrUndefined )
|
|
|
|
{
|
2013-05-04 01:39:24 +02:00
|
|
|
SetLastSortKey( nSortKeyCount );
|
2012-05-21 23:04:12 +02:00
|
|
|
return 0;
|
|
|
|
}
|
2012-03-31 18:33:21 +02:00
|
|
|
|
2012-04-05 05:05:40 +02:00
|
|
|
// Find selected listbox
|
2012-05-21 23:04:12 +02:00
|
|
|
for ( pIter = maSortKeyItems.begin(); pIter != maSortKeyItems.end(); ++pIter )
|
|
|
|
{
|
2012-12-04 09:35:19 +00:00
|
|
|
if ( pIter->m_pLbSort == pLb ) break;
|
2012-05-21 23:04:12 +02:00
|
|
|
}
|
2012-04-04 15:30:35 -04:00
|
|
|
|
2012-05-21 23:04:12 +02:00
|
|
|
// If not selecting the last Listbox, modify the succeeding ones
|
|
|
|
++pIter;
|
|
|
|
if ( std::distance(maSortKeyItems.begin(), pIter) < nSortKeyCount )
|
2012-04-04 15:30:35 -04:00
|
|
|
{
|
|
|
|
if ( aSelEntry == aStrUndefined )
|
|
|
|
{
|
2012-05-21 23:04:12 +02:00
|
|
|
for ( ; pIter != maSortKeyItems.end(); ++pIter )
|
2012-04-05 05:05:40 +02:00
|
|
|
{
|
2012-12-04 09:35:19 +00:00
|
|
|
pIter->m_pLbSort->SelectEntryPos( 0 );
|
2012-04-05 05:05:40 +02:00
|
|
|
|
2012-12-04 09:35:19 +00:00
|
|
|
if ( pIter->m_pFlSort->IsEnabled() )
|
2012-05-21 23:04:12 +02:00
|
|
|
pIter->DisableField();
|
2012-04-05 05:05:40 +02:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-12-04 09:35:19 +00:00
|
|
|
if ( !pIter->m_pFlSort->IsEnabled() )
|
2012-05-21 23:04:12 +02:00
|
|
|
pIter->EnableField();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2012-05-21 23:04:12 +02:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-02-28 19:14:26 +05:30
|
|
|
// Sort option Tab Page:
|
2014-02-25 19:58:48 +01:00
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
ScTabPageSortOptions::ScTabPageSortOptions( vcl::Window* pParent,
|
2000-09-18 16:07:07 +00:00
|
|
|
const SfxItemSet& rArgSet )
|
2012-12-04 09:35:19 +00:00
|
|
|
: SfxTabPage(pParent, "SortOptionsPage",
|
2014-06-11 14:34:46 +02:00
|
|
|
"modules/scalc/ui/sortoptionspage.ui", &rArgSet)
|
2012-11-29 17:20:43 +00:00
|
|
|
, aStrRowLabel(SC_RESSTR(SCSTR_ROW_LABEL))
|
|
|
|
, aStrColLabel(SC_RESSTR(SCSTR_COL_LABEL))
|
|
|
|
, aStrUndefined(SC_RESSTR(SCSTR_UNDEFINED))
|
|
|
|
, nWhichSort(rArgSet.GetPool()->GetWhich(SID_SORT))
|
2014-10-27 14:18:17 +02:00
|
|
|
, aSortData(static_cast<const ScSortItem&>(rArgSet.Get(nWhichSort)).GetSortData())
|
2012-11-29 17:20:43 +00:00
|
|
|
, pViewData(NULL)
|
|
|
|
, pDoc(NULL)
|
2014-10-27 14:18:17 +02:00
|
|
|
, pDlg(static_cast<ScSortDlg*>(GetParentDialog()))
|
2012-11-29 17:20:43 +00:00
|
|
|
, pColRes( NULL )
|
|
|
|
, pColWrap( NULL )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2012-11-29 17:20:43 +00:00
|
|
|
get(m_pBtnCase, "case");
|
|
|
|
get(m_pBtnHeader, "header");
|
|
|
|
get(m_pBtnFormats, "formats");
|
|
|
|
get(m_pBtnNaturalSort, "naturalsort");
|
|
|
|
get(m_pBtnCopyResult, "copyresult");
|
|
|
|
get(m_pLbOutPos, "outarealb");
|
|
|
|
get(m_pEdOutPos, "outareaed");
|
|
|
|
get(m_pBtnSortUser, "sortuser");
|
|
|
|
get(m_pLbSortUser, "sortuserlb");
|
|
|
|
get(m_pFtAlgorithm, "algorithmft");
|
|
|
|
get(m_pLbAlgorithm, "algorithmlb");
|
|
|
|
get(m_pBtnTopDown, "topdown");
|
|
|
|
get(m_pBtnLeftRight, "leftright");
|
|
|
|
get(m_pLbLanguage, "language");
|
2000-09-18 16:07:07 +00:00
|
|
|
Init();
|
|
|
|
SetExchangeSupport();
|
2011-01-20 16:34:26 +01:00
|
|
|
|
2012-11-29 17:20:43 +00:00
|
|
|
m_pLbOutPos->SetAccessibleName(m_pBtnCopyResult->GetText());
|
|
|
|
m_pEdOutPos->SetAccessibleName(m_pBtnCopyResult->GetText());
|
|
|
|
m_pLbSortUser->SetAccessibleName(m_pBtnSortUser->GetText());
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2010-12-11 23:25:30 +01:00
|
|
|
ScTabPageSortOptions::~ScTabPageSortOptions()
|
2015-01-26 13:16:18 +02:00
|
|
|
{
|
2015-03-10 09:07:06 +02:00
|
|
|
disposeOnce();
|
2015-01-26 13:16:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScTabPageSortOptions::dispose()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2012-11-29 17:20:43 +00:00
|
|
|
sal_uInt16 nEntries = m_pLbOutPos->GetEntryCount();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
for ( sal_uInt16 i=1; i<nEntries; i++ )
|
2015-03-28 19:06:09 +01:00
|
|
|
delete static_cast<OUString*>(m_pLbOutPos->GetEntryData( i ));
|
2001-03-13 09:05:29 +00:00
|
|
|
|
|
|
|
delete pColRes;
|
|
|
|
delete pColWrap; //! not if from document
|
2015-03-09 14:29:30 +02:00
|
|
|
m_pBtnCase.clear();
|
|
|
|
m_pBtnHeader.clear();
|
|
|
|
m_pBtnFormats.clear();
|
|
|
|
m_pBtnNaturalSort.clear();
|
|
|
|
m_pBtnCopyResult.clear();
|
|
|
|
m_pLbOutPos.clear();
|
|
|
|
m_pEdOutPos.clear();
|
|
|
|
m_pBtnSortUser.clear();
|
|
|
|
m_pLbSortUser.clear();
|
|
|
|
m_pLbLanguage.clear();
|
|
|
|
m_pFtAlgorithm.clear();
|
|
|
|
m_pLbAlgorithm.clear();
|
|
|
|
m_pBtnTopDown.clear();
|
|
|
|
m_pBtnLeftRight.clear();
|
|
|
|
pDlg.clear();
|
2015-01-26 13:16:18 +02:00
|
|
|
SfxTabPage::dispose();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScTabPageSortOptions::Init()
|
|
|
|
{
|
2012-07-30 08:41:34 +02:00
|
|
|
// CollatorResource has user-visible names for sort algorithms
|
|
|
|
pColRes = new CollatorResource();
|
2001-03-13 09:05:29 +00:00
|
|
|
|
|
|
|
//! use CollatorWrapper from document?
|
2012-11-20 12:57:26 +02:00
|
|
|
pColWrap = new CollatorWrapper( comphelper::getProcessComponentContext() );
|
2001-03-13 09:05:29 +00:00
|
|
|
|
2014-10-27 14:18:17 +02:00
|
|
|
const ScSortItem& rSortItem = static_cast<const ScSortItem&>(
|
|
|
|
GetItemSet().Get( nWhichSort ));
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2012-11-29 17:20:43 +00:00
|
|
|
m_pLbOutPos->SetSelectHdl ( LINK( this, ScTabPageSortOptions, SelOutPosHdl ) );
|
|
|
|
m_pBtnCopyResult->SetClickHdl( LINK( this, ScTabPageSortOptions, EnableHdl ) );
|
|
|
|
m_pBtnSortUser->SetClickHdl ( LINK( this, ScTabPageSortOptions, EnableHdl ) );
|
|
|
|
m_pBtnTopDown->SetClickHdl ( LINK( this, ScTabPageSortOptions, SortDirHdl ) );
|
|
|
|
m_pBtnLeftRight->SetClickHdl ( LINK( this, ScTabPageSortOptions, SortDirHdl ) );
|
|
|
|
m_pLbLanguage->SetSelectHdl ( LINK( this, ScTabPageSortOptions, FillAlgorHdl ) );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
pViewData = rSortItem.GetViewData();
|
|
|
|
pDoc = pViewData ? pViewData->GetDocument() : NULL;
|
|
|
|
|
2011-05-21 15:04:26 +02:00
|
|
|
OSL_ENSURE( pViewData, "ViewData not found! :-/" );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( pViewData && pDoc )
|
|
|
|
{
|
|
|
|
ScDBCollection* pDBColl = pDoc->GetDBCollection();
|
2012-04-05 05:05:40 +02:00
|
|
|
const SCTAB nCurTab = pViewData->GetTabNo();
|
2013-05-06 16:32:22 +02:00
|
|
|
OUString theDbName = OUString(STR_DB_LOCAL_NONAME);
|
CWS-TOOLING: integrate CWS frmdlg
2008-12-18 09:13:09 +0100 oj r265667 : merge from odff05
2008-12-18 07:58:16 +0100 oj r265658 : #i94555# patch from <regina>, ODFF:
Add GAMMA, CHISQDIST, CHISQINV.
Make the 'cumulative' parameter of GAMMADIST optional.
Adapt the domain of CHIDIST to allow negative x.
Remove the constraint "degrees of freedom < 1.0E5" from CHIDIST and CHIINV.
Plus a mechanism to write the now optional parameter of GAMMADIST to PODF and
ODFF if omitted, for backwards compatibility.
2008-12-15 14:06:11 +0100 oj r265490 : CWS-TOOLING: rebase CWS frmdlg to trunk@264807 (milestone: DEV300:m37)
2008-12-15 13:55:28 +0100 oj r265488 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:55:07 +0100 oj r265487 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:54:48 +0100 oj r265486 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:54:36 +0100 oj r265485 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:54:24 +0100 oj r265484 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:48:11 +0100 oj r265483 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:31:12 +0100 oj r265479 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:13:58 +0100 oj r265477 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:10:09 +0100 oj r265476 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:05:11 +0100 oj r265475 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 10:47:17 +0100 oj r265467 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 10:46:19 +0100 oj r265466 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 10:45:47 +0100 oj r265465 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 07:35:07 +0100 oj r265458 : add dependency to formula
2008-12-15 07:34:24 +0100 oj r265457 : add dependency to formula
2008-12-12 13:22:00 +0100 msc r265413 : #i97089#
2008-12-12 13:20:25 +0100 msc r265412 : #i97089#
2008-12-12 12:35:12 +0100 msc r265406 : #i97089#
2008-12-12 12:34:16 +0100 msc r265405 : #i97089#
2008-12-12 12:33:05 +0100 msc r265404 : #i97089#
2008-12-12 12:31:11 +0100 msc r265403 : #i97089#
2008-12-08 11:59:10 +0100 oj r264981 : insert RTL_LOG
2008-12-08 11:50:17 +0100 oj r264980 : some small changes
2008-12-05 12:57:57 +0100 oj r264902 : eof changed
2008-12-05 12:56:46 +0100 oj r264901 : eof changed
2008-12-05 12:28:47 +0100 oj r264899 : wrong var used
2008-12-05 10:08:57 +0100 oj r264890 : token order reversed
2008-12-04 13:49:22 +0100 oc r264843 : #i96688: Adapt autotests because of outsourced functionwizard
2008-12-04 13:45:27 +0100 oc r264842 : #i96688: Adapt autotests because of outsourced functionwizard
2008-12-04 13:42:54 +0100 oc r264841 : #i96688: Adapt autotests because of outsourced functionwizard
2008-12-04 13:37:41 +0100 oc r264840 : #i96688: Adapt autotests because of outsourced functionwizard
2008-12-04 13:34:11 +0100 oc r264839 : #i96688: Adapt autotests because of outsourced functionwizard
2008-12-04 12:35:31 +0100 oj r264835 : new help ids for struct and function tabpage
2008-12-04 12:00:35 +0100 oj r264828 : set explicit help id
2008-12-03 14:53:27 +0100 oj r264786 : #i96845# change ref button
2008-12-03 14:51:49 +0100 oj r264785 : #i96845# change ref button
2008-12-03 08:51:57 +0100 oj r264746 : convert dos to unix lineends
2008-12-03 08:50:45 +0100 oj r264745 : convert dos to unix lineends
2008-12-03 08:50:05 +0100 oj r264744 : convert dos to unix lineends
2008-12-02 12:28:33 +0100 oj r264686 : clear help text when new helpid is set
2008-12-02 12:28:02 +0100 oj r264685 : set help id for listbox category
2008-12-02 07:15:56 +0100 oj r264655 : remove define to auto generate help ids
2008-12-01 14:36:43 +0100 oj r264604 : use temp var
2008-12-01 14:18:31 +0100 oj r264601 : moved ScJumpToken to formula
2008-12-01 14:18:11 +0100 oj r264600 : moved ScJumpToken to formula
2008-12-01 14:14:35 +0100 oj r264599 : moved ScJumpToken from sc
2008-12-01 10:48:51 +0100 oj r264589 : change quickhelptext from Shrink to Select
2008-12-01 10:28:41 +0100 oj r264588 : fix opcode data, has to be Any.Void
2008-11-28 11:16:48 +0100 oj r264532 : add help ids
2008-11-28 10:16:56 +0100 oj r264529 : set help id
2008-11-28 10:16:43 +0100 oj r264528 : set help id
2008-11-26 13:55:04 +0100 oj r264381 : #94535# use of optional instead of deleting a string myself and some small changes
2008-11-26 09:53:20 +0100 oj r264346 : compile error with debug/without debug
2008-11-25 07:41:28 +0100 oj r264271 : put static into the method which make use of them
2008-11-24 08:16:07 +0100 oj r264196 : removed not needed classes for op code
2008-11-24 08:13:44 +0100 oj r264195 : removed not needed classes for op code
2008-11-21 14:05:53 +0100 oj r264135 : make GetOpCode inline
2008-11-21 12:35:27 +0100 oj r264124 : hold symbols
2008-11-20 09:27:27 +0100 oj r264028 : merged code from DEV300_m35 which got lost
2008-11-19 20:42:12 +0100 oj r264022 : more changes for formula dialog remove
2008-11-19 20:37:41 +0100 oj r264021 : removed unused var
2008-11-19 20:35:35 +0100 oj r264020 : some more changes at token
2008-11-19 10:59:47 +0100 oj r263967 : deleted
2008-11-19 10:58:24 +0100 oj r263966 : add forui and for res files
2008-11-18 15:27:36 +0100 oj r263777 : unused para removed
2008-11-18 15:23:23 +0100 oj r263775 : add insert button to add field dlg
2008-11-18 13:39:53 +0100 oj r263764 : enable the formula dialog as well for conditional print as for conditional formatting
2008-11-18 12:03:25 +0100 oj r263760 : rename isRef in IsRef
2008-11-17 11:46:16 +0100 oj r263711 : patches for function handling
2008-11-17 11:36:22 +0100 oj r263710 : add new for forui and res file
2008-11-17 09:21:12 +0100 oj r263704 : patches for some resource for libformula
2008-11-15 12:45:30 +0100 oj r263701 : changes for formula editor extraction
2008-11-07 08:23:27 +0100 oj r263416 : merge from DEV300:m35
2008-11-07 08:22:35 +0100 oj r263415 : merge from DEV300:m35
2008-11-07 08:22:16 +0100 oj r263414 : merge from DEV300:m35
2008-11-07 08:21:41 +0100 oj r263413 : merge from DEV300:m35
2008-11-07 08:21:31 +0100 oj r263412 : merge from DEV300:m35
2008-11-07 08:20:38 +0100 oj r263411 : merge from DEV300:m35
2008-11-07 08:20:00 +0100 oj r263410 : merge from DEV300:m35
2008-11-07 08:18:50 +0100 oj r263409 : merge from DEV300:m35
2008-11-07 08:18:19 +0100 oj r263408 : merge from DEV300:m35
2008-11-07 08:10:27 +0100 oj r263407 : merge from DEV300:m35
2008-10-21 07:43:46 +0200 oj r262560 : some compile errors resolved
2008-10-17 16:40:01 +0200 oj r262291 : dep for 1st target
2008-10-07 10:08:39 +0200 oj r262077 : copy
2008-10-07 09:45:31 +0200 oj r262076 : #i94535#
2008-10-07 09:44:26 +0200 oj r262075 : #i94535# new base class
2008-10-07 09:43:21 +0200 oj r262074 : moved to formula
2008-10-07 09:41:51 +0200 oj r262073 : new images
2008-10-07 09:03:01 +0200 oj r262072 : new ids for formula
2008-10-02 08:46:27 +0200 oj r262024 : #i94535# move the formula compiler to formula
2008-10-02 08:08:54 +0200 oj r262023 : #i94535#
2008-10-02 08:06:28 +0200 oj r262022 : #i94535#
2008-10-02 08:05:52 +0200 oj r262021 : #i94535#
2008-10-01 17:15:29 +0200 oj r262014 : #i94535#
2008-10-01 17:12:40 +0200 oj r262013 : new module formula
2008-10-01 17:04:55 +0200 oj r262012 : #i94535#
2008-10-01 16:49:03 +0200 oj r262010 : #i94535#
2008-10-01 16:46:59 +0200 oj r262009 : #i94535#
2009-01-08 10:47:13 +00:00
|
|
|
const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2012-11-29 17:20:43 +00:00
|
|
|
m_pLbOutPos->Clear();
|
|
|
|
m_pLbOutPos->InsertEntry( aStrUndefined, 0 );
|
|
|
|
m_pLbOutPos->Disable();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
ScAreaNameIterator aIter( pDoc );
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString aName;
|
2000-09-18 16:07:07 +00:00
|
|
|
ScRange aRange;
|
|
|
|
while ( aIter.Next( aName, aRange ) )
|
|
|
|
{
|
2012-11-29 17:20:43 +00:00
|
|
|
sal_uInt16 nInsert = m_pLbOutPos->InsertEntry( aName );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-08-29 20:44:22 +01:00
|
|
|
OUString aRefStr(aRange.aStart.Format(SCA_ABS_3D, pDoc, eConv));
|
2013-04-07 12:06:47 +02:00
|
|
|
m_pLbOutPos->SetEntryData( nInsert, new OUString( aRefStr ) );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2012-11-29 17:20:43 +00:00
|
|
|
m_pLbOutPos->SelectEntryPos( 0 );
|
2013-10-16 14:27:58 +02:00
|
|
|
m_pEdOutPos->SetText( EMPTY_OUSTRING );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2012-02-28 19:14:26 +05:30
|
|
|
// Check whether the field that is passed on is a database field:
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2012-05-21 23:04:12 +02:00
|
|
|
ScAddress aScAddress( aSortData.nCol1, aSortData.nRow1, nCurTab );
|
2013-10-07 14:26:21 +02:00
|
|
|
OUString theArea =
|
2013-08-29 20:44:22 +01:00
|
|
|
ScRange( aScAddress,
|
2012-05-21 23:04:12 +02:00
|
|
|
ScAddress( aSortData.nCol2, aSortData.nRow2, nCurTab )
|
2013-08-29 20:44:22 +01:00
|
|
|
).Format(SCR_ABS, pDoc, eConv);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( pDBColl )
|
|
|
|
{
|
|
|
|
ScDBData* pDBData
|
|
|
|
= pDBColl->GetDBAtArea( nCurTab,
|
2012-05-21 23:04:12 +02:00
|
|
|
aSortData.nCol1, aSortData.nRow1,
|
|
|
|
aSortData.nCol2, aSortData.nRow2 );
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( pDBData )
|
|
|
|
{
|
2011-05-10 15:50:44 -04:00
|
|
|
theDbName = pDBData->GetName();
|
2012-11-29 17:20:43 +00:00
|
|
|
m_pBtnHeader->Check( pDBData->HasHeader() );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-07 14:26:21 +02:00
|
|
|
theArea += " (" + theDbName + ")";
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2012-11-29 17:20:43 +00:00
|
|
|
m_pBtnHeader->SetText( aStrColLabel );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
FillUserSortListBox();
|
2001-03-13 09:05:29 +00:00
|
|
|
|
|
|
|
// get available languages
|
|
|
|
|
2015-04-22 16:19:37 +02:00
|
|
|
m_pLbLanguage->SetLanguageList( SvxLanguageListFlags::ALL | SvxLanguageListFlags::ONLY_KNOWN, false );
|
2012-11-29 17:20:43 +00:00
|
|
|
m_pLbLanguage->InsertLanguage( LANGUAGE_SYSTEM );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2015-04-17 13:51:33 +01:00
|
|
|
VclPtr<SfxTabPage> ScTabPageSortOptions::Create( vcl::Window* pParent,
|
|
|
|
const SfxItemSet* rArgSet )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2015-04-17 13:51:33 +01:00
|
|
|
return VclPtr<ScTabPageSortOptions>::Create( pParent, *rArgSet );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2014-06-11 10:35:24 +02:00
|
|
|
void ScTabPageSortOptions::Reset( const SfxItemSet* /* rArgSet */ )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2012-05-21 23:04:12 +02:00
|
|
|
if ( aSortData.bUserDef )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-02-21 12:53:51 +01:00
|
|
|
m_pBtnSortUser->Check( true );
|
2012-11-29 17:20:43 +00:00
|
|
|
m_pLbSortUser->Enable();
|
|
|
|
m_pLbSortUser->SelectEntryPos( aSortData.nUserIndex );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-11-29 17:20:43 +00:00
|
|
|
m_pBtnSortUser->Check( false );
|
|
|
|
m_pLbSortUser->Disable();
|
|
|
|
m_pLbSortUser->SelectEntryPos( 0 );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2012-11-29 17:20:43 +00:00
|
|
|
m_pBtnCase->Check ( aSortData.bCaseSens );
|
|
|
|
m_pBtnFormats->Check ( aSortData.bIncludePattern );
|
|
|
|
m_pBtnHeader->Check ( aSortData.bHasHeader );
|
|
|
|
m_pBtnNaturalSort->Check ( aSortData.bNaturalSort );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2012-05-21 23:04:12 +02:00
|
|
|
if ( aSortData.bByRow )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2012-11-29 17:20:43 +00:00
|
|
|
m_pBtnTopDown->Check();
|
|
|
|
m_pBtnHeader->SetText( aStrColLabel );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-11-29 17:20:43 +00:00
|
|
|
m_pBtnLeftRight->Check();
|
|
|
|
m_pBtnHeader->SetText( aStrRowLabel );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2013-07-13 02:54:05 +02:00
|
|
|
LanguageType eLang = LanguageTag::convertToLanguageType( aSortData.aCollatorLocale, false);
|
2001-03-13 09:05:29 +00:00
|
|
|
if ( eLang == LANGUAGE_DONTKNOW )
|
|
|
|
eLang = LANGUAGE_SYSTEM;
|
2012-11-29 17:20:43 +00:00
|
|
|
m_pLbLanguage->SelectLanguage( eLang );
|
|
|
|
FillAlgorHdl(m_pLbLanguage); // get algorithms, select default
|
2012-05-21 23:04:12 +02:00
|
|
|
if ( !aSortData.aCollatorAlgorithm.isEmpty() )
|
2012-11-29 17:20:43 +00:00
|
|
|
m_pLbAlgorithm->SelectEntry( pColRes->GetTranslation( aSortData.aCollatorAlgorithm ) );
|
2001-03-13 09:05:29 +00:00
|
|
|
|
2012-05-21 23:04:12 +02:00
|
|
|
if ( pDoc && !aSortData.bInplace )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2012-05-21 23:04:12 +02:00
|
|
|
sal_uInt16 nFormat = (aSortData.nDestTab != pViewData->GetTabNo())
|
2000-09-18 16:07:07 +00:00
|
|
|
? SCR_ABS_3D
|
|
|
|
: SCR_ABS;
|
|
|
|
|
2012-05-21 23:04:12 +02:00
|
|
|
theOutPos.Set( aSortData.nDestCol,
|
|
|
|
aSortData.nDestRow,
|
|
|
|
aSortData.nDestTab );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-08-29 20:44:22 +01:00
|
|
|
OUString aStr(theOutPos.Format(nFormat, pDoc, pDoc->GetAddressConvention()));
|
2012-11-29 17:20:43 +00:00
|
|
|
m_pBtnCopyResult->Check();
|
|
|
|
m_pLbOutPos->Enable();
|
|
|
|
m_pEdOutPos->Enable();
|
|
|
|
m_pEdOutPos->SetText( aStr );
|
|
|
|
EdOutPosModHdl(m_pEdOutPos);
|
|
|
|
m_pEdOutPos->GrabFocus();
|
|
|
|
m_pEdOutPos->SetSelection( Selection( 0, SELECTION_MAX ) );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-11-29 17:20:43 +00:00
|
|
|
m_pBtnCopyResult->Check( false );
|
|
|
|
m_pLbOutPos->Disable();
|
|
|
|
m_pEdOutPos->Disable();
|
2013-10-16 14:27:58 +02:00
|
|
|
m_pEdOutPos->SetText( EMPTY_OUSTRING );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-10 17:23:12 +02:00
|
|
|
bool ScTabPageSortOptions::FillItemSet( SfxItemSet* rArgSet )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2012-05-07 02:43:11 +02:00
|
|
|
// Create local copy of ScParam
|
2012-05-21 23:04:12 +02:00
|
|
|
ScSortParam aNewSortData = aSortData;
|
2012-05-07 02:43:11 +02:00
|
|
|
|
2012-07-13 08:16:57 +02:00
|
|
|
if (pDlg)
|
|
|
|
{
|
|
|
|
const SfxItemSet* pExample = pDlg->GetExampleSet();
|
|
|
|
const SfxPoolItem* pItem;
|
2014-09-10 17:53:41 +02:00
|
|
|
if ( pExample && pExample->GetItemState( nWhichSort, true, &pItem ) == SfxItemState::SET )
|
2012-07-13 08:16:57 +02:00
|
|
|
aNewSortData = static_cast<const ScSortItem*>(pItem)->GetSortData();
|
|
|
|
}
|
2012-11-29 17:20:43 +00:00
|
|
|
aNewSortData.bByRow = m_pBtnTopDown->IsChecked();
|
|
|
|
aNewSortData.bHasHeader = m_pBtnHeader->IsChecked();
|
|
|
|
aNewSortData.bCaseSens = m_pBtnCase->IsChecked();
|
|
|
|
aNewSortData.bNaturalSort = m_pBtnNaturalSort->IsChecked();
|
|
|
|
aNewSortData.bIncludePattern = m_pBtnFormats->IsChecked();
|
|
|
|
aNewSortData.bInplace = !m_pBtnCopyResult->IsChecked();
|
2012-04-05 05:05:40 +02:00
|
|
|
aNewSortData.nDestCol = theOutPos.Col();
|
|
|
|
aNewSortData.nDestRow = theOutPos.Row();
|
|
|
|
aNewSortData.nDestTab = theOutPos.Tab();
|
2012-11-29 17:20:43 +00:00
|
|
|
aNewSortData.bUserDef = m_pBtnSortUser->IsChecked();
|
|
|
|
aNewSortData.nUserIndex = (m_pBtnSortUser->IsChecked())
|
|
|
|
? m_pLbSortUser->GetSelectEntryPos()
|
2012-04-05 05:05:40 +02:00
|
|
|
: 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-03-13 09:05:29 +00:00
|
|
|
// get locale
|
2012-11-29 17:20:43 +00:00
|
|
|
LanguageType eLang = m_pLbLanguage->GetSelectLanguage();
|
2013-07-13 02:54:05 +02:00
|
|
|
aNewSortData.aCollatorLocale = LanguageTag::convertToLocale( eLang, false);
|
2001-03-13 09:05:29 +00:00
|
|
|
|
|
|
|
// get algorithm
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString sAlg;
|
2001-03-13 15:09:50 +00:00
|
|
|
if ( eLang != LANGUAGE_SYSTEM )
|
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
uno::Sequence<OUString> aAlgos = pColWrap->listCollatorAlgorithms(
|
2012-04-05 05:05:40 +02:00
|
|
|
aNewSortData.aCollatorLocale );
|
2012-11-29 17:20:43 +00:00
|
|
|
sal_uInt16 nSel = m_pLbAlgorithm->GetSelectEntryPos();
|
2001-03-13 15:09:50 +00:00
|
|
|
if ( nSel < aAlgos.getLength() )
|
|
|
|
sAlg = aAlgos[nSel];
|
|
|
|
}
|
2012-04-05 05:05:40 +02:00
|
|
|
aNewSortData.aCollatorAlgorithm = sAlg;
|
2001-03-13 09:05:29 +00:00
|
|
|
|
2014-06-10 17:23:12 +02:00
|
|
|
rArgSet->Put( ScSortItem( SCITEM_SORTDATA, &aNewSortData ) );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-03-26 15:34:49 +02:00
|
|
|
return true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2012-10-17 11:01:15 +02:00
|
|
|
// for data exchange without dialogue detour:
|
|
|
|
void ScTabPageSortOptions::ActivatePage( const SfxItemSet& rSet )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2012-10-17 11:01:15 +02:00
|
|
|
// Refresh local copy with shared data
|
|
|
|
aSortData = static_cast<const ScSortItem&>(rSet.Get( SCITEM_SORTDATA )).GetSortData();
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( pDlg )
|
|
|
|
{
|
2014-02-19 13:26:00 +01:00
|
|
|
if ( m_pBtnHeader->IsChecked() != pDlg->GetHeaders() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2012-11-29 17:20:43 +00:00
|
|
|
m_pBtnHeader->Check( pDlg->GetHeaders() );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2014-02-21 12:53:51 +01:00
|
|
|
if ( m_pBtnTopDown->IsChecked() != pDlg->GetByRows() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2012-11-29 17:20:43 +00:00
|
|
|
m_pBtnTopDown->Check( pDlg->GetByRows() );
|
|
|
|
m_pBtnLeftRight->Check( !pDlg->GetByRows() );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2012-11-29 17:20:43 +00:00
|
|
|
m_pBtnHeader->SetText( (pDlg->GetByRows())
|
2000-09-18 16:07:07 +00:00
|
|
|
? aStrColLabel
|
|
|
|
: aStrRowLabel );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-27 16:43:07 +02:00
|
|
|
SfxTabPage::sfxpg ScTabPageSortOptions::DeactivatePage( SfxItemSet* pSetP )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-04-23 11:08:48 +02:00
|
|
|
bool bPosInputOk = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2012-11-29 17:20:43 +00:00
|
|
|
if ( m_pBtnCopyResult->IsChecked() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-10-07 14:26:21 +02:00
|
|
|
OUString thePosStr = m_pEdOutPos->GetText();
|
2000-09-18 16:07:07 +00:00
|
|
|
ScAddress thePos;
|
2013-10-07 14:26:21 +02:00
|
|
|
sal_Int32 nColonPos = thePosStr.indexOf( ':' );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-10-07 14:26:21 +02:00
|
|
|
if ( -1 != nColonPos )
|
|
|
|
thePosStr = thePosStr.copy( 0, nColonPos );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-08-03 15:43:02 +00:00
|
|
|
if ( pViewData )
|
|
|
|
{
|
|
|
|
// visible table is default for input without table
|
|
|
|
// must be changed to GetRefTabNo when sorting has RefInput!
|
|
|
|
thePos.SetTab( pViewData->GetTabNo() );
|
|
|
|
}
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_uInt16 nResult = thePos.Parse( thePosStr, pDoc, pDoc->GetAddressConvention() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
bPosInputOk = ( SCA_VALID == (nResult & SCA_VALID) );
|
|
|
|
|
|
|
|
if ( !bPosInputOk )
|
|
|
|
{
|
2015-05-26 16:26:35 +02:00
|
|
|
ScopedVclPtrInstance<MessageDialog>::Create(this, ScGlobal::GetRscString( STR_INVALID_TABREF))->Execute();
|
2012-11-29 17:20:43 +00:00
|
|
|
m_pEdOutPos->GrabFocus();
|
|
|
|
m_pEdOutPos->SetSelection( Selection( 0, SELECTION_MAX ) );
|
2000-09-18 16:07:07 +00:00
|
|
|
theOutPos.Set(0,0,0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-11-29 17:20:43 +00:00
|
|
|
m_pEdOutPos->SetText( thePosStr );
|
2000-09-18 16:07:07 +00:00
|
|
|
theOutPos = thePos;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( pDlg && bPosInputOk )
|
|
|
|
{
|
2012-11-29 17:20:43 +00:00
|
|
|
pDlg->SetHeaders( m_pBtnHeader->IsChecked() );
|
|
|
|
pDlg->SetByRows ( m_pBtnTopDown->IsChecked() );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2007-02-27 12:05:23 +00:00
|
|
|
if ( pSetP && bPosInputOk )
|
2014-06-10 17:23:12 +02:00
|
|
|
FillItemSet( pSetP );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
return bPosInputOk ? SfxTabPage::LEAVE_PAGE : SfxTabPage::KEEP_PAGE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScTabPageSortOptions::FillUserSortListBox()
|
|
|
|
{
|
|
|
|
ScUserList* pUserLists = ScGlobal::GetUserList();
|
|
|
|
|
2012-11-29 17:20:43 +00:00
|
|
|
m_pLbSortUser->Clear();
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( pUserLists )
|
|
|
|
{
|
2011-06-01 19:14:40 -04:00
|
|
|
size_t nCount = pUserLists->size();
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( nCount > 0 )
|
2011-06-01 19:14:40 -04:00
|
|
|
for ( size_t i=0; i<nCount; ++i )
|
2012-11-29 17:20:43 +00:00
|
|
|
m_pLbSortUser->InsertEntry( (*pUserLists)[i]->GetString() );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Handler:
|
|
|
|
|
|
|
|
IMPL_LINK( ScTabPageSortOptions, EnableHdl, CheckBox *, pBox )
|
|
|
|
{
|
2012-11-29 17:20:43 +00:00
|
|
|
if (pBox == m_pBtnCopyResult)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if ( pBox->IsChecked() )
|
|
|
|
{
|
2012-11-29 17:20:43 +00:00
|
|
|
m_pLbOutPos->Enable();
|
|
|
|
m_pEdOutPos->Enable();
|
|
|
|
m_pEdOutPos->GrabFocus();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-11-29 17:20:43 +00:00
|
|
|
m_pLbOutPos->Disable();
|
|
|
|
m_pEdOutPos->Disable();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
2012-11-29 17:20:43 +00:00
|
|
|
else if (pBox == m_pBtnSortUser)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if ( pBox->IsChecked() )
|
|
|
|
{
|
2012-11-29 17:20:43 +00:00
|
|
|
m_pLbSortUser->Enable();
|
|
|
|
m_pLbSortUser->GrabFocus();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
2012-11-29 17:20:43 +00:00
|
|
|
m_pLbSortUser->Disable();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
IMPL_LINK( ScTabPageSortOptions, SelOutPosHdl, ListBox *, pLb )
|
|
|
|
{
|
2012-11-29 17:20:43 +00:00
|
|
|
if (pLb == m_pLbOutPos)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString aString;
|
2012-11-29 17:20:43 +00:00
|
|
|
sal_uInt16 nSelPos = m_pLbOutPos->GetSelectEntryPos();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( nSelPos > 0 )
|
2015-03-28 19:06:09 +01:00
|
|
|
aString = *static_cast<OUString*>(m_pLbOutPos->GetEntryData( nSelPos ));
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2012-11-29 17:20:43 +00:00
|
|
|
m_pEdOutPos->SetText( aString );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
IMPL_LINK( ScTabPageSortOptions, SortDirHdl, RadioButton *, pBtn )
|
|
|
|
{
|
2012-11-29 17:20:43 +00:00
|
|
|
if (pBtn == m_pBtnTopDown)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2012-11-29 17:20:43 +00:00
|
|
|
m_pBtnHeader->SetText( aStrColLabel );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2012-11-29 17:20:43 +00:00
|
|
|
else if (pBtn == m_pBtnLeftRight)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2012-11-29 17:20:43 +00:00
|
|
|
m_pBtnHeader->SetText( aStrRowLabel );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-12-11 23:25:30 +01:00
|
|
|
void ScTabPageSortOptions::EdOutPosModHdl( Edit* pEd )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2012-11-29 17:20:43 +00:00
|
|
|
if (pEd == m_pEdOutPos)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-10-07 14:26:21 +02:00
|
|
|
OUString theCurPosStr = m_pEdOutPos->GetText();
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_uInt16 nResult = ScAddress().Parse( theCurPosStr, pDoc, pDoc->GetAddressConvention() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( SCA_VALID == (nResult & SCA_VALID) )
|
|
|
|
{
|
2014-04-23 11:08:48 +02:00
|
|
|
bool bFound = false;
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_uInt16 i = 0;
|
2012-11-29 17:20:43 +00:00
|
|
|
sal_uInt16 nCount = m_pLbOutPos->GetEntryCount();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
for ( i=2; i<nCount && !bFound; i++ )
|
|
|
|
{
|
2015-03-28 19:06:09 +01:00
|
|
|
OUString* pStr = static_cast<OUString*>(m_pLbOutPos->GetEntryData( i ));
|
2000-09-18 16:07:07 +00:00
|
|
|
bFound = (theCurPosStr == *pStr);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( bFound )
|
2012-11-29 17:20:43 +00:00
|
|
|
m_pLbOutPos->SelectEntryPos( --i );
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2012-11-29 17:20:43 +00:00
|
|
|
m_pLbOutPos->SelectEntryPos( 0 );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-01 18:00:32 +01:00
|
|
|
IMPL_LINK_NOARG(ScTabPageSortOptions, FillAlgorHdl)
|
2001-03-13 09:05:29 +00:00
|
|
|
{
|
2012-11-29 17:20:43 +00:00
|
|
|
m_pLbAlgorithm->SetUpdateMode( false );
|
|
|
|
m_pLbAlgorithm->Clear();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2012-11-29 17:20:43 +00:00
|
|
|
LanguageType eLang = m_pLbLanguage->GetSelectLanguage();
|
2001-03-13 15:09:50 +00:00
|
|
|
if ( eLang == LANGUAGE_SYSTEM )
|
2001-03-13 09:05:29 +00:00
|
|
|
{
|
2001-03-13 15:09:50 +00:00
|
|
|
// for LANGUAGE_SYSTEM no algorithm can be selected because
|
|
|
|
// it wouldn't necessarily exist for other languages
|
|
|
|
// -> leave list box empty if LANGUAGE_SYSTEM is selected
|
2012-11-29 17:20:43 +00:00
|
|
|
m_pFtAlgorithm->Enable( false ); // nothing to select
|
|
|
|
m_pLbAlgorithm->Enable( false ); // nothing to select
|
2001-03-13 09:05:29 +00:00
|
|
|
}
|
2001-03-13 15:09:50 +00:00
|
|
|
else
|
|
|
|
{
|
2013-07-13 02:54:05 +02:00
|
|
|
lang::Locale aLocale( LanguageTag::convertToLocale( eLang ));
|
2013-04-07 12:06:47 +02:00
|
|
|
uno::Sequence<OUString> aAlgos = pColWrap->listCollatorAlgorithms( aLocale );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-03-13 15:09:50 +00:00
|
|
|
long nCount = aAlgos.getLength();
|
2013-04-07 12:06:47 +02:00
|
|
|
const OUString* pArray = aAlgos.getConstArray();
|
2001-03-13 15:09:50 +00:00
|
|
|
for (long i=0; i<nCount; i++)
|
|
|
|
{
|
2013-10-07 14:26:21 +02:00
|
|
|
OUString sAlg = pArray[i];
|
|
|
|
OUString sUser = pColRes->GetTranslation( sAlg );
|
2012-11-29 17:20:43 +00:00
|
|
|
m_pLbAlgorithm->InsertEntry( sUser, LISTBOX_APPEND );
|
2001-03-13 15:09:50 +00:00
|
|
|
}
|
2012-11-29 17:20:43 +00:00
|
|
|
m_pLbAlgorithm->SelectEntryPos( 0 ); // first entry is default
|
|
|
|
m_pFtAlgorithm->Enable( nCount > 1 ); // enable only if there is a choice
|
|
|
|
m_pLbAlgorithm->Enable( nCount > 1 ); // enable only if there is a choice
|
2001-03-13 15:09:50 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-02-21 12:53:51 +01:00
|
|
|
m_pLbAlgorithm->SetUpdateMode( true );
|
2001-03-13 09:05:29 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2010-10-12 15:59:00 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|