Kaydet (Commit) 16d7ace9 authored tarafından Caolán McNamara's avatar Caolán McNamara

rework the calc sort dialog to use .ui snippet

this should have the side-effect that the scrollbar is in the right place, and
not jammed into some odd place in the dialog

Change-Id: Ie1648568de755172b77378b19e0b59b5056c116f
üst f41a2804
...@@ -11,7 +11,9 @@ $(eval $(call gb_UI_UI,modules/scalc)) ...@@ -11,7 +11,9 @@ $(eval $(call gb_UI_UI,modules/scalc))
$(eval $(call gb_UI_add_uifiles,modules/scalc,\ $(eval $(call gb_UI_add_uifiles,modules/scalc,\
sc/uiconfig/scalc/ui/printeroptions \ sc/uiconfig/scalc/ui/printeroptions \
sc/uiconfig/scalc/ui/sortpage \ sc/uiconfig/scalc/ui/sortcriteriapage \
sc/uiconfig/scalc/ui/sortkey \
sc/uiconfig/scalc/ui/sortoptionspage \
sc/uiconfig/scalc/ui/textimportoptions \ sc/uiconfig/scalc/ui/textimportoptions \
)) ))
......
...@@ -32,54 +32,47 @@ ...@@ -32,54 +32,47 @@
// ======================================================================= // =======================================================================
ScSortKeyItem::ScSortKeyItem( Window* pParent ) : ScSortKeyItem::ScSortKeyItem(Window* pParent)
//
aFlSort ( pParent, ScResId( FL_SORT ) ),
aLbSort ( pParent, ScResId( LB_SORT ) ),
aBtnUp ( pParent, ScResId( BTN_UP ) ),
aBtnDown ( pParent, ScResId( BTN_DOWN ) )
{ {
m_pUIBuilder = new VclBuilder(pParent, getUIRootDir(), "modules/scalc/ui/sortkey.ui");
get(m_pFrame, "SortKeyFrame");
get(m_pFlSort, "sortft");
get(m_pLbSort, "sortlb");
get(m_pBtnUp, "up");
get(m_pBtnDown, "down");
} }
// ----------------------------------------------------------------------- long ScSortKeyItem::getItemHeight() const
{
return m_pFrame->get_preferred_size().Height();
}
void ScSortKeyItem::DisableField() void ScSortKeyItem::DisableField()
{ {
aFlSort.Disable(); m_pFrame->Disable();
aLbSort.Disable();
aBtnUp.Disable();
aBtnDown.Disable();
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
void ScSortKeyItem::EnableField() void ScSortKeyItem::EnableField()
{ {
aFlSort.Enable(); m_pFrame->Enable();
aLbSort.Enable();
aBtnUp.Enable();
aBtnDown.Enable();
} }
// ======================================================================= // =======================================================================
ScSortKeyWindow::ScSortKeyWindow( Window* pParent, const ResId& rResId, ScSortKeyItems& rSortKeyItems ) : ScSortKeyWindow::ScSortKeyWindow(SfxTabPage* pParent, ScSortKeyItems& rSortKeyItems)
Window( pParent, rResId ), : mrSortKeyItems(rSortKeyItems)
//
aFlSort ( this, ScResId( FL_SORT ) ),
aLbSort ( this, ScResId( LB_SORT ) ),
aBtnUp ( this, ScResId( BTN_UP ) ),
aBtnDown ( this, ScResId( BTN_DOWN ) ),
//
nScrollPos ( 0 ),
mrSortKeyItems( rSortKeyItems )
{ {
aFlSort.Hide(); pParent->get(m_pBox, "SortKeyWindow");
aLbSort.Hide(); if (!mrSortKeyItems.empty())
aBtnUp.Hide(); nItemHeight = mrSortKeyItems.front().getItemHeight();
aBtnDown.Hide(); else
{
nItemHeight = aBtnDown.GetPosPixel().Y() + aBtnDown.GetSizePixel().Height(); ScSortKeyItem aTemp(m_pBox);
nItemHeight = aTemp.getItemHeight();
}
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
...@@ -93,95 +86,56 @@ ScSortKeyWindow::~ScSortKeyWindow() ...@@ -93,95 +86,56 @@ ScSortKeyWindow::~ScSortKeyWindow()
void ScSortKeyWindow::AddSortKey( sal_uInt16 nItemNumber ) void ScSortKeyWindow::AddSortKey( sal_uInt16 nItemNumber )
{ {
ScSortKeyItem* pSortKeyItem = new ScSortKeyItem( this ); ScSortKeyItem* pSortKeyItem = new ScSortKeyItem(m_pBox);
// Set Sort key number // Set Sort key number
String aLine = pSortKeyItem->aFlSort.GetText(); String aLine = pSortKeyItem->m_pFlSort->GetText();
aLine += String::CreateFromInt32( nItemNumber ); aLine += String::CreateFromInt32( nItemNumber );
pSortKeyItem->aFlSort.SetText( aLine ); pSortKeyItem->m_pFlSort->SetText( aLine );
mrSortKeyItems.push_back( pSortKeyItem );
Window* pWindows[] = { &aFlSort, &aLbSort, &aBtnUp, &aBtnDown, NULL }; mrSortKeyItems.push_back(pSortKeyItem);
Window* pNewWindows[] = { &pSortKeyItem->aFlSort, &pSortKeyItem->aLbSort,
&pSortKeyItem->aBtnUp, &pSortKeyItem->aBtnDown, NULL };
Window** pCurrent = pWindows;
Window** pNewCurrent = pNewWindows;
while ( *pCurrent )
{
Size aSize = (*pCurrent)->GetSizePixel();
Point aPos = (*pCurrent)->GetPosPixel();
aPos.Y() += ( nItemNumber - 1 ) * GetItemHeight();
aPos.Y() += nScrollPos;
(*pNewCurrent)->SetPosSizePixel( aPos, aSize );
(*pNewCurrent)->Show();
pCurrent++;
pNewCurrent++;
}
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
void ScSortKeyWindow::DoScroll( sal_Int32 nNewPos ) void ScSortKeyWindow::DoScroll(sal_Int32 nNewPos)
{ {
nScrollPos += nNewPos; m_pBox->SetPosPixel(Point(0, nNewPos));
ScSortKeyItems::iterator pIter;
for ( pIter = mrSortKeyItems.begin(); pIter != mrSortKeyItems.end(); ++pIter )
{
Window* pNewWindows[] = { &pIter->aFlSort, &pIter->aLbSort,
&pIter->aBtnUp, &pIter->aBtnDown, NULL };
Window** pCurrent = pNewWindows;
while ( *pCurrent )
{
Point aPos = (*pCurrent)->GetPosPixel();
aPos.Y() += nNewPos;
(*pCurrent)->SetPosPixel( aPos );
pCurrent++;
}
}
} }
// ======================================================================= // =======================================================================
ScSortKeyCtrl::ScSortKeyCtrl( Window* pParent, const ScResId& rResId, ScSortKeyItems& rItems ): ScSortKeyCtrl::ScSortKeyCtrl(SfxTabPage* pParent, ScSortKeyItems& rItems)
Control( pParent, rResId), : m_aSortWin(pParent, rItems)
// , m_rScrolledWindow(*pParent->get<VclScrolledWindow>("SortCriteriaPage"))
aSortWin ( this, ResId( WIN_MANAGESORTKEY, *rResId.GetResMgr() ), rItems ), , m_rVertScroll(m_rScrolledWindow.getVertScrollBar())
aVertScroll ( this, ResId( SB_SORT, *rResId.GetResMgr() ) ), , nThumbPos(0)
nThumbPos ( 0 )
{ {
aVertScroll.EnableDrag(); m_rVertScroll.EnableDrag();
aVertScroll.Show(); m_rVertScroll.Show();
FreeResource();
aVertScroll.SetRangeMin( 0 ); m_rVertScroll.SetRangeMin( 0 );
sal_Int32 nScrollOffset = aSortWin.GetItemHeight(); m_rVertScroll.SetVisibleSize( 0xFFFF );
sal_Int32 nVisibleItems = aSortWin.GetSizePixel().Height() / nScrollOffset;
aVertScroll.SetRangeMax( nVisibleItems );
aVertScroll.SetPageSize( nVisibleItems - 1 );
aVertScroll.SetVisibleSize( nVisibleItems );
Link aScrollLink = LINK( this, ScSortKeyCtrl, ScrollHdl ); Link aScrollLink = LINK( this, ScSortKeyCtrl, ScrollHdl );
aVertScroll.SetScrollHdl( aScrollLink ); m_rVertScroll.SetScrollHdl( aScrollLink );
} }
// ----------------------------------------------------------------------- void ScSortKeyCtrl::setScrollRange()
ScSortKeyCtrl::~ScSortKeyCtrl()
{ {
sal_Int32 nScrollOffset = m_aSortWin.GetItemHeight();
sal_Int32 nVisibleItems = m_rScrolledWindow.getVisibleChildSize().Height() / nScrollOffset;
m_rVertScroll.SetPageSize( nVisibleItems - 1 );
m_rVertScroll.SetVisibleSize( nVisibleItems );
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
IMPL_LINK( ScSortKeyCtrl, ScrollHdl, ScrollBar*, pScrollBar ) IMPL_LINK( ScSortKeyCtrl, ScrollHdl, ScrollBar*, pScrollBar )
{ {
sal_Int32 nOffset = aSortWin.GetItemHeight(); sal_Int32 nOffset = m_aSortWin.GetItemHeight();
nOffset *= ( nThumbPos - pScrollBar->GetThumbPos() ); nOffset *= pScrollBar->GetThumbPos();
nThumbPos = pScrollBar->GetThumbPos(); m_aSortWin.DoScroll( -nOffset );
aSortWin.DoScroll( nOffset );
return 0; return 0;
} }
...@@ -189,9 +143,9 @@ IMPL_LINK( ScSortKeyCtrl, ScrollHdl, ScrollBar*, pScrollBar ) ...@@ -189,9 +143,9 @@ IMPL_LINK( ScSortKeyCtrl, ScrollHdl, ScrollBar*, pScrollBar )
void ScSortKeyCtrl::AddSortKey( sal_uInt16 nItem ) void ScSortKeyCtrl::AddSortKey( sal_uInt16 nItem )
{ {
aVertScroll.SetRangeMax( nItem ); m_rVertScroll.SetRangeMax( nItem );
aVertScroll.DoScroll( nItem ); m_rVertScroll.DoScroll( nItem );
aSortWin.AddSortKey( nItem ); m_aSortWin.AddSortKey( nItem );
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -75,12 +75,11 @@ using namespace com::sun::star; ...@@ -75,12 +75,11 @@ using namespace com::sun::star;
//======================================================================== //========================================================================
// Sort Criteria Tab page // Sort Criteria Tab page
ScTabPageSortFields::ScTabPageSortFields( Window* pParent, ScTabPageSortFields::ScTabPageSortFields(Window* pParent,
const SfxItemSet& rArgSet ) const SfxItemSet& rArgSet)
: SfxTabPage(pParent, "SortCriteriaPage",
: SfxTabPage ( pParent, "modules/scalc/ui/sortcriteriapage.ui", rArgSet)
ScResId( RID_SCPAGE_SORT_FIELDS ), ,
rArgSet ),
// //
aStrUndefined ( SC_RESSTR( SCSTR_UNDEFINED ) ), aStrUndefined ( SC_RESSTR( SCSTR_UNDEFINED ) ),
aStrColumn ( SC_RESSTR( SCSTR_COLUMN ) ), aStrColumn ( SC_RESSTR( SCSTR_COLUMN ) ),
...@@ -96,13 +95,30 @@ ScTabPageSortFields::ScTabPageSortFields( Window* pParent, ...@@ -96,13 +95,30 @@ ScTabPageSortFields::ScTabPageSortFields( Window* pParent,
nSortKeyCount ( DEFSORT ), nSortKeyCount ( DEFSORT ),
bHasHeader ( false ), bHasHeader ( false ),
bSortByRows ( false ), bSortByRows ( false ),
maSortKeyCtrl ( this, ScResId( CTRL_MANAGESORTKEY ), maSortKeyItems ) maSortKeyCtrl ( this, maSortKeyItems )
{ {
Init(); Init();
FreeResource();
SetExchangeSupport(); SetExchangeSupport();
} }
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();
}
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
ScTabPageSortFields::~ScTabPageSortFields() ScTabPageSortFields::~ScTabPageSortFields()
...@@ -127,7 +143,7 @@ void ScTabPageSortFields::Init() ...@@ -127,7 +143,7 @@ void ScTabPageSortFields::Init()
for ( sal_uInt16 i=0; i<nSortKeyCount; i++ ) for ( sal_uInt16 i=0; i<nSortKeyCount; i++ )
{ {
maSortKeyCtrl.AddSortKey(i+1); maSortKeyCtrl.AddSortKey(i+1);
maSortKeyItems[i].aLbSort.SetSelectHdl( LINK( this, ScTabPageSortFields, SelectHdl ) ); maSortKeyItems[i].m_pLbSort->SetSelectHdl( LINK( this, ScTabPageSortFields, SelectHdl ) );
} }
} }
...@@ -146,7 +162,7 @@ void ScTabPageSortFields::Reset( const SfxItemSet& /* rArgSet */ ) ...@@ -146,7 +162,7 @@ void ScTabPageSortFields::Reset( const SfxItemSet& /* rArgSet */ )
bSortByRows = aSortData.bByRow; bSortByRows = aSortData.bByRow;
bHasHeader = aSortData.bHasHeader; bHasHeader = aSortData.bHasHeader;
if ( maSortKeyItems[0].aLbSort.GetEntryCount() == 0 ) if ( maSortKeyItems[0].m_pLbSort->GetEntryCount() == 0 )
FillFieldLists(0); FillFieldLists(0);
// ListBox selection: // ListBox selection:
...@@ -156,24 +172,24 @@ void ScTabPageSortFields::Reset( const SfxItemSet& /* rArgSet */ ) ...@@ -156,24 +172,24 @@ void ScTabPageSortFields::Reset( const SfxItemSet& /* rArgSet */ )
{ {
if ( i < aSortData.maKeyState.size() && aSortData.maKeyState[i].bDoSort ) if ( i < aSortData.maKeyState.size() && aSortData.maKeyState[i].bDoSort )
{ {
maSortKeyItems[i].aLbSort.SelectEntryPos( GetFieldSelPos( maSortKeyItems[i].m_pLbSort->SelectEntryPos( GetFieldSelPos(
aSortData.maKeyState[i].nField ) ); aSortData.maKeyState[i].nField ) );
(aSortData.maKeyState[i].bAscending) (aSortData.maKeyState[i].bAscending)
? maSortKeyItems[i].aBtnUp.Check() ? maSortKeyItems[i].m_pBtnUp->Check()
: maSortKeyItems[i].aBtnDown.Check(); : maSortKeyItems[i].m_pBtnDown->Check();
} }
else else
{ {
maSortKeyItems[i].aLbSort.SelectEntryPos( 0 ); // Select none maSortKeyItems[i].m_pLbSort->SelectEntryPos( 0 ); // Select none
maSortKeyItems[i].aBtnUp.Check(); maSortKeyItems[i].m_pBtnUp->Check();
} }
} }
// Enable or disable field depending on preceding Listbox selection // Enable or disable field depending on preceding Listbox selection
maSortKeyItems[0].EnableField(); maSortKeyItems[0].EnableField();
for ( sal_uInt16 i=1; i<nSortKeyCount; i++ ) for ( sal_uInt16 i=1; i<nSortKeyCount; i++ )
if ( maSortKeyItems[i - 1].aLbSort.GetSelectEntryPos() == 0 ) if ( maSortKeyItems[i - 1].m_pLbSort->GetSelectEntryPos() == 0 )
maSortKeyItems[i].DisableField(); maSortKeyItems[i].DisableField();
else else
maSortKeyItems[i].EnableField(); maSortKeyItems[i].EnableField();
...@@ -190,12 +206,12 @@ void ScTabPageSortFields::Reset( const SfxItemSet& /* rArgSet */ ) ...@@ -190,12 +206,12 @@ void ScTabPageSortFields::Reset( const SfxItemSet& /* rArgSet */ )
sal_uInt16 nSort1Pos = nCol - aSortData.nCol1+1; sal_uInt16 nSort1Pos = nCol - aSortData.nCol1+1;
maSortKeyItems[0].aLbSort.SelectEntryPos( nSort1Pos ); maSortKeyItems[0].m_pLbSort->SelectEntryPos( nSort1Pos );
for ( sal_uInt16 i=1; i<nSortKeyCount; i++ ) for ( sal_uInt16 i=1; i<nSortKeyCount; i++ )
maSortKeyItems[i].aLbSort.SelectEntryPos( 0 ); maSortKeyItems[i].m_pLbSort->SelectEntryPos( 0 );
for ( sal_uInt16 i=0; i<nSortKeyCount; i++ ) for ( sal_uInt16 i=0; i<nSortKeyCount; i++ )
maSortKeyItems[i].aBtnUp.Check(); maSortKeyItems[i].m_pBtnUp->Check();
maSortKeyItems[0].EnableField(); maSortKeyItems[0].EnableField();
...@@ -232,7 +248,7 @@ sal_Bool ScTabPageSortFields::FillItemSet( SfxItemSet& rArgSet ) ...@@ -232,7 +248,7 @@ sal_Bool ScTabPageSortFields::FillItemSet( SfxItemSet& rArgSet )
for ( sal_uInt16 i=0; i<nSortKeyCount; i++ ) for ( sal_uInt16 i=0; i<nSortKeyCount; i++ )
{ {
nSortPos.push_back( maSortKeyItems[i].aLbSort.GetSelectEntryPos() ); nSortPos.push_back( maSortKeyItems[i].m_pLbSort->GetSelectEntryPos() );
if ( nSortPos[i] == LISTBOX_ENTRY_NOTFOUND ) nSortPos[i] = 0; if ( nSortPos[i] == LISTBOX_ENTRY_NOTFOUND ) nSortPos[i] = 0;
} }
...@@ -262,7 +278,7 @@ sal_Bool ScTabPageSortFields::FillItemSet( SfxItemSet& rArgSet ) ...@@ -262,7 +278,7 @@ sal_Bool ScTabPageSortFields::FillItemSet( SfxItemSet& rArgSet )
} }
for ( sal_uInt16 i=0; i<nSortKeyCount; i++ ) for ( sal_uInt16 i=0; i<nSortKeyCount; i++ )
aNewSortData.maKeyState[i].bAscending = maSortKeyItems[i].aBtnUp.IsChecked(); aNewSortData.maKeyState[i].bAscending = maSortKeyItems[i].m_pBtnUp->IsChecked();
// bHasHeader is in ScTabPageSortOptions::FillItemSet, where it belongs // bHasHeader is in ScTabPageSortOptions::FillItemSet, where it belongs
} }
...@@ -291,14 +307,14 @@ void ScTabPageSortFields::ActivatePage( const SfxItemSet& rSet ) ...@@ -291,14 +307,14 @@ void ScTabPageSortFields::ActivatePage( const SfxItemSet& rSet )
{ {
std::vector<sal_uInt16> nCurSel; std::vector<sal_uInt16> nCurSel;
for ( sal_uInt16 i=0; i<nSortKeyCount; i++ ) for ( sal_uInt16 i=0; i<nSortKeyCount; i++ )
nCurSel.push_back( maSortKeyItems[i].aLbSort.GetSelectEntryPos() ); nCurSel.push_back( maSortKeyItems[i].m_pLbSort->GetSelectEntryPos() );
bHasHeader = pDlg->GetHeaders(); bHasHeader = pDlg->GetHeaders();
bSortByRows = pDlg->GetByRows(); bSortByRows = pDlg->GetByRows();
FillFieldLists(0); FillFieldLists(0);
for ( sal_uInt16 i=0; i<nSortKeyCount; i++ ) for ( sal_uInt16 i=0; i<nSortKeyCount; i++ )
maSortKeyItems[i].aLbSort.SelectEntryPos( nCurSel[i] ); maSortKeyItems[i].m_pLbSort->SelectEntryPos( nCurSel[i] );
} }
} }
} }
...@@ -334,8 +350,8 @@ void ScTabPageSortFields::FillFieldLists( sal_uInt16 nStartField ) ...@@ -334,8 +350,8 @@ void ScTabPageSortFields::FillFieldLists( sal_uInt16 nStartField )
{ {
for ( sal_uInt16 i=nStartField; i<nSortKeyCount; i++ ) for ( sal_uInt16 i=nStartField; i<nSortKeyCount; i++ )
{ {
maSortKeyItems[i].aLbSort.Clear(); maSortKeyItems[i].m_pLbSort->Clear();
maSortKeyItems[i].aLbSort.InsertEntry( aStrUndefined, 0 ); maSortKeyItems[i].m_pLbSort->InsertEntry( aStrUndefined, 0 );
} }
SCCOL nFirstSortCol = aSortData.nCol1; SCCOL nFirstSortCol = aSortData.nCol1;
...@@ -361,7 +377,7 @@ void ScTabPageSortFields::FillFieldLists( sal_uInt16 nStartField ) ...@@ -361,7 +377,7 @@ void ScTabPageSortFields::FillFieldLists( sal_uInt16 nStartField )
nFieldArr.push_back( col ); nFieldArr.push_back( col );
for ( sal_uInt16 j=nStartField; j<nSortKeyCount; j++ ) for ( sal_uInt16 j=nStartField; j<nSortKeyCount; j++ )
maSortKeyItems[j].aLbSort.InsertEntry( aFieldName, i ); maSortKeyItems[j].m_pLbSort->InsertEntry( aFieldName, i );
i++; i++;
} }
...@@ -387,7 +403,7 @@ void ScTabPageSortFields::FillFieldLists( sal_uInt16 nStartField ) ...@@ -387,7 +403,7 @@ void ScTabPageSortFields::FillFieldLists( sal_uInt16 nStartField )
nFieldArr.push_back( row ); nFieldArr.push_back( row );
for ( sal_uInt16 j=nStartField; j<nSortKeyCount; j++ ) for ( sal_uInt16 j=nStartField; j<nSortKeyCount; j++ )
maSortKeyItems[j].aLbSort.InsertEntry( aFieldName, i ); maSortKeyItems[j].m_pLbSort->InsertEntry( aFieldName, i );
i++; i++;
} }
...@@ -427,7 +443,7 @@ IMPL_LINK( ScTabPageSortFields, SelectHdl, ListBox *, pLb ) ...@@ -427,7 +443,7 @@ IMPL_LINK( ScTabPageSortFields, SelectHdl, ListBox *, pLb )
sal_uInt16 nSortKeyIndex = nSortKeyCount; sal_uInt16 nSortKeyIndex = nSortKeyCount;
// If last listbox is enabled add one item // If last listbox is enabled add one item
if ( &maSortKeyItems.back().aLbSort == pLb ) if ( maSortKeyItems.back().m_pLbSort == pLb )
if ( aSelEntry != aStrUndefined ) if ( aSelEntry != aStrUndefined )
{ {
// Extend local SortParam copy // Extend local SortParam copy
...@@ -437,20 +453,20 @@ IMPL_LINK( ScTabPageSortFields, SelectHdl, ListBox *, pLb ) ...@@ -437,20 +453,20 @@ IMPL_LINK( ScTabPageSortFields, SelectHdl, ListBox *, pLb )
// Add Sort Key Item // Add Sort Key Item
++nSortKeyCount; ++nSortKeyCount;
maSortKeyCtrl.AddSortKey( nSortKeyCount ); maSortKeyCtrl.AddSortKey( nSortKeyCount );
maSortKeyItems[nSortKeyIndex].aLbSort.SetSelectHdl( LINK( this, ScTabPageSortFields, SelectHdl ) ); maSortKeyItems[nSortKeyIndex].m_pLbSort->SetSelectHdl( LINK( this, ScTabPageSortFields, SelectHdl ) );
FillFieldLists( nSortKeyIndex ); FillFieldLists( nSortKeyIndex );
// Set Status // Set Status
maSortKeyItems[nSortKeyIndex].aBtnUp.Check(); maSortKeyItems[nSortKeyIndex].m_pBtnUp->Check();
maSortKeyItems[nSortKeyIndex].aLbSort.SelectEntryPos( 0 ); maSortKeyItems[nSortKeyIndex].m_pLbSort->SelectEntryPos( 0 );
return 0; return 0;
} }
// Find selected listbox // Find selected listbox
for ( pIter = maSortKeyItems.begin(); pIter != maSortKeyItems.end(); ++pIter ) for ( pIter = maSortKeyItems.begin(); pIter != maSortKeyItems.end(); ++pIter )
{ {
if ( &pIter->aLbSort == pLb ) break; if ( pIter->m_pLbSort == pLb ) break;
} }
// If not selecting the last Listbox, modify the succeeding ones // If not selecting the last Listbox, modify the succeeding ones
...@@ -461,15 +477,15 @@ IMPL_LINK( ScTabPageSortFields, SelectHdl, ListBox *, pLb ) ...@@ -461,15 +477,15 @@ IMPL_LINK( ScTabPageSortFields, SelectHdl, ListBox *, pLb )
{ {
for ( ; pIter != maSortKeyItems.end(); ++pIter ) for ( ; pIter != maSortKeyItems.end(); ++pIter )
{ {
pIter->aLbSort.SelectEntryPos( 0 ); pIter->m_pLbSort->SelectEntryPos( 0 );
if ( pIter->aFlSort.IsEnabled() ) if ( pIter->m_pFlSort->IsEnabled() )
pIter->DisableField(); pIter->DisableField();
} }
} }
else else
{ {
if ( !pIter->aFlSort.IsEnabled() ) if ( !pIter->m_pFlSort->IsEnabled() )
pIter->EnableField(); pIter->EnableField();
} }
} }
...@@ -482,7 +498,8 @@ IMPL_LINK( ScTabPageSortFields, SelectHdl, ListBox *, pLb ) ...@@ -482,7 +498,8 @@ IMPL_LINK( ScTabPageSortFields, SelectHdl, ListBox *, pLb )
ScTabPageSortOptions::ScTabPageSortOptions( Window* pParent, ScTabPageSortOptions::ScTabPageSortOptions( Window* pParent,
const SfxItemSet& rArgSet ) const SfxItemSet& rArgSet )
: SfxTabPage(pParent, "SortPage", "modules/scalc/ui/sortpage.ui", rArgSet) : SfxTabPage(pParent, "SortOptionsPage",
"modules/scalc/ui/sortoptionspage.ui", rArgSet)
, aStrRowLabel(SC_RESSTR(SCSTR_ROW_LABEL)) , aStrRowLabel(SC_RESSTR(SCSTR_ROW_LABEL))
, aStrColLabel(SC_RESSTR(SCSTR_COL_LABEL)) , aStrColLabel(SC_RESSTR(SCSTR_COL_LABEL))
, aStrUndefined(SC_RESSTR(SCSTR_UNDEFINED)) , aStrUndefined(SC_RESSTR(SCSTR_UNDEFINED))
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <vcl/edit.hxx> #include <vcl/edit.hxx>
#include <vcl/fixed.hxx> #include <vcl/fixed.hxx>
#include <vcl/layout.hxx>
#include <vcl/lstbox.hxx> #include <vcl/lstbox.hxx>
#include <vcl/scrbar.hxx> #include <vcl/scrbar.hxx>
#include <vcl/ctrl.hxx> #include <vcl/ctrl.hxx>
...@@ -44,61 +45,61 @@ ...@@ -44,61 +45,61 @@
// ======================================================================= // =======================================================================
struct ScSortKeyItem struct ScSortKeyItem : public VclBuilderContainer
{ {
FixedLine aFlSort; VclFrame* m_pFrame;
ListBox aLbSort; FixedText* m_pFlSort;
RadioButton aBtnUp; ListBox* m_pLbSort;
RadioButton aBtnDown; RadioButton* m_pBtnUp;
RadioButton* m_pBtnDown;
ScSortKeyItem ( Window* pParent ); ScSortKeyItem(Window* pParent);
void DisableField(); void DisableField();
void EnableField(); void EnableField();
long getItemHeight() const;
}; };
typedef boost::ptr_vector<ScSortKeyItem> ScSortKeyItems; typedef boost::ptr_vector<ScSortKeyItem> ScSortKeyItems;
// ======================================================================= // =======================================================================
class ScSortKeyWindow : public Window class ScSortKeyWindow
{ {
private: private:
FixedLine aFlSort; VclBox* m_pBox;
ListBox aLbSort;
RadioButton aBtnUp;
RadioButton aBtnDown;
sal_Int32 nScrollPos; sal_Int32 nScrollPos;
sal_Int32 nItemHeight; sal_Int32 nItemHeight;
ScSortKeyItems& mrSortKeyItems; ScSortKeyItems& mrSortKeyItems;
public: public:
ScSortKeyWindow( Window* pParent, const ResId& rResId, ScSortKeyItems& mrSortKeyItems ); ScSortKeyWindow(SfxTabPage* pParent, ScSortKeyItems& mrSortKeyItems);
~ScSortKeyWindow(); ~ScSortKeyWindow();
void AddSortKey( sal_uInt16 nItem ); void AddSortKey( sal_uInt16 nItem );
void DoScroll( sal_Int32 nNewPos ); void DoScroll( sal_Int32 nNewPos );
sal_Int32 GetItemHeight() const { return nItemHeight; } sal_Int32 GetItemHeight() const { return nItemHeight; }
sal_Int32 GetTotalHeight() const { return m_pBox->GetSizePixel().Height(); }
}; };
// ======================================================================= // =======================================================================
class ScSortKeyCtrl : public Control class ScSortKeyCtrl
{ {
private: private:
ScSortKeyWindow aSortWin; ScSortKeyWindow m_aSortWin;
ScrollBar aVertScroll; VclScrolledWindow& m_rScrolledWindow;
ScrollBar& m_rVertScroll;
sal_Int32 nThumbPos; sal_Int32 nThumbPos;
DECL_LINK( ScrollHdl, ScrollBar* ); DECL_LINK(ScrollHdl, ScrollBar*);
public: public:
ScSortKeyCtrl( Window* pParent, const ScResId& rResId, ScSortKeyItems& mrSortKeyItems ); ScSortKeyCtrl(SfxTabPage* pParent, ScSortKeyItems& mrSortKeyItems);
~ScSortKeyCtrl(); void setScrollRange();
void AddSortKey( sal_uInt16 nItem ); void AddSortKey( sal_uInt16 nItem );
}; };
......
...@@ -59,6 +59,10 @@ public: ...@@ -59,6 +59,10 @@ public:
virtual sal_Bool FillItemSet ( SfxItemSet& rArgSet ); virtual sal_Bool FillItemSet ( SfxItemSet& rArgSet );
virtual void Reset ( const SfxItemSet& rArgSet ); virtual void Reset ( const SfxItemSet& rArgSet );
virtual void SetPosSizePixel(const Point& rAllocPos, const Size& rAllocation);
virtual void SetSizePixel(const Size& rAllocation);
virtual void SetPosPixel(const Point& rAllocPos);
protected: protected:
virtual void ActivatePage ( const SfxItemSet& rSet ); virtual void ActivatePage ( const SfxItemSet& rSet );
using SfxTabPage::ActivatePage; using SfxTabPage::ActivatePage;
......
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkScrolledWindow" id="SortCriteriaPage">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="hscrollbar_policy">never</property>
<property name="vscrollbar_policy">always</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkBox" id="SortKeyWindow">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
</interface>
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<interface> <interface>
<!-- interface-requires gtk+ 3.0 --> <!-- interface-requires gtk+ 3.0 -->
<object class="GtkBox" id="SortPage"> <object class="GtkBox" id="SortOptionsPage">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment