[Libreoffice-commits] .: 3 commits - sc/source sc/uiconfig sc/UI_scalc.mk vcl/inc vcl/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Dec 4 08:19:35 PST 2012
sc/UI_scalc.mk | 4
sc/source/ui/dbgui/sortkeydlg.cxx | 148 ++++----------
sc/source/ui/dbgui/tpsort.cxx | 89 +++++---
sc/source/ui/inc/sortkeydlg.hxx | 41 +--
sc/source/ui/inc/tpsort.hxx | 4
sc/uiconfig/scalc/ui/sortcriteriapage.ui | 25 ++
sc/uiconfig/scalc/ui/sortoptionspage.ui | 327 +++++++++++++++++++++++++++++++
sc/uiconfig/scalc/ui/sortpage.ui | 327 -------------------------------
vcl/inc/vcl/layout.hxx | 40 +++
vcl/inc/vcl/scrbar.hxx | 3
vcl/source/control/scrbar.cxx | 11 -
vcl/source/window/builder.cxx | 15 -
vcl/source/window/dialog.cxx | 10
vcl/source/window/layout.cxx | 99 ++++++++-
vcl/source/window/tabdlg.cxx | 6
vcl/source/window/tabpage.cxx | 2
vcl/source/window/window2.cxx | 2
17 files changed, 636 insertions(+), 517 deletions(-)
New commits:
commit 16d7ace9eea35284e012bd2519d691946dadff58
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Dec 4 09:35:19 2012 +0000
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
diff --git a/sc/UI_scalc.mk b/sc/UI_scalc.mk
index 4dd79cd..aee514e 100644
--- a/sc/UI_scalc.mk
+++ b/sc/UI_scalc.mk
@@ -11,7 +11,9 @@ $(eval $(call gb_UI_UI,modules/scalc))
$(eval $(call gb_UI_add_uifiles,modules/scalc,\
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 \
))
diff --git a/sc/source/ui/dbgui/sortkeydlg.cxx b/sc/source/ui/dbgui/sortkeydlg.cxx
index 29e69d0..45d65ca 100644
--- a/sc/source/ui/dbgui/sortkeydlg.cxx
+++ b/sc/source/ui/dbgui/sortkeydlg.cxx
@@ -32,54 +32,47 @@
// =======================================================================
-ScSortKeyItem::ScSortKeyItem( Window* pParent ) :
- //
- aFlSort ( pParent, ScResId( FL_SORT ) ),
- aLbSort ( pParent, ScResId( LB_SORT ) ),
- aBtnUp ( pParent, ScResId( BTN_UP ) ),
- aBtnDown ( pParent, ScResId( BTN_DOWN ) )
+ScSortKeyItem::ScSortKeyItem(Window* pParent)
{
+ 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()
{
- aFlSort.Disable();
- aLbSort.Disable();
- aBtnUp.Disable();
- aBtnDown.Disable();
+ m_pFrame->Disable();
}
// -----------------------------------------------------------------------
void ScSortKeyItem::EnableField()
{
- aFlSort.Enable();
- aLbSort.Enable();
- aBtnUp.Enable();
- aBtnDown.Enable();
+ m_pFrame->Enable();
}
// =======================================================================
-ScSortKeyWindow::ScSortKeyWindow( Window* pParent, const ResId& rResId, ScSortKeyItems& rSortKeyItems ) :
- Window( pParent, rResId ),
- //
- aFlSort ( this, ScResId( FL_SORT ) ),
- aLbSort ( this, ScResId( LB_SORT ) ),
- aBtnUp ( this, ScResId( BTN_UP ) ),
- aBtnDown ( this, ScResId( BTN_DOWN ) ),
- //
- nScrollPos ( 0 ),
- mrSortKeyItems( rSortKeyItems )
+ScSortKeyWindow::ScSortKeyWindow(SfxTabPage* pParent, ScSortKeyItems& rSortKeyItems)
+ : mrSortKeyItems(rSortKeyItems)
{
- aFlSort.Hide();
- aLbSort.Hide();
- aBtnUp.Hide();
- aBtnDown.Hide();
-
- nItemHeight = aBtnDown.GetPosPixel().Y() + aBtnDown.GetSizePixel().Height();
+ pParent->get(m_pBox, "SortKeyWindow");
+ if (!mrSortKeyItems.empty())
+ nItemHeight = mrSortKeyItems.front().getItemHeight();
+ else
+ {
+ ScSortKeyItem aTemp(m_pBox);
+ nItemHeight = aTemp.getItemHeight();
+ }
}
// -----------------------------------------------------------------------
@@ -93,95 +86,56 @@ ScSortKeyWindow::~ScSortKeyWindow()
void ScSortKeyWindow::AddSortKey( sal_uInt16 nItemNumber )
{
- ScSortKeyItem* pSortKeyItem = new ScSortKeyItem( this );
+ ScSortKeyItem* pSortKeyItem = new ScSortKeyItem(m_pBox);
// Set Sort key number
- String aLine = pSortKeyItem->aFlSort.GetText();
+ String aLine = pSortKeyItem->m_pFlSort->GetText();
aLine += String::CreateFromInt32( nItemNumber );
- pSortKeyItem->aFlSort.SetText( aLine );
-
- mrSortKeyItems.push_back( pSortKeyItem );
+ pSortKeyItem->m_pFlSort->SetText( aLine );
- Window* pWindows[] = { &aFlSort, &aLbSort, &aBtnUp, &aBtnDown, NULL };
-
- 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++;
- }
+ mrSortKeyItems.push_back(pSortKeyItem);
}
// -----------------------------------------------------------------------
-void ScSortKeyWindow::DoScroll( sal_Int32 nNewPos )
+void ScSortKeyWindow::DoScroll(sal_Int32 nNewPos)
{
- nScrollPos += 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++;
- }
- }
+ m_pBox->SetPosPixel(Point(0, nNewPos));
}
// =======================================================================
-ScSortKeyCtrl::ScSortKeyCtrl( Window* pParent, const ScResId& rResId, ScSortKeyItems& rItems ):
- Control( pParent, rResId),
- //
- aSortWin ( this, ResId( WIN_MANAGESORTKEY, *rResId.GetResMgr() ), rItems ),
- aVertScroll ( this, ResId( SB_SORT, *rResId.GetResMgr() ) ),
- nThumbPos ( 0 )
+ScSortKeyCtrl::ScSortKeyCtrl(SfxTabPage* pParent, ScSortKeyItems& rItems)
+ : m_aSortWin(pParent, rItems)
+ , m_rScrolledWindow(*pParent->get<VclScrolledWindow>("SortCriteriaPage"))
+ , m_rVertScroll(m_rScrolledWindow.getVertScrollBar())
+ , nThumbPos(0)
{
- aVertScroll.EnableDrag();
- aVertScroll.Show();
-
- FreeResource();
+ m_rVertScroll.EnableDrag();
+ m_rVertScroll.Show();
- aVertScroll.SetRangeMin( 0 );
- sal_Int32 nScrollOffset = aSortWin.GetItemHeight();
- sal_Int32 nVisibleItems = aSortWin.GetSizePixel().Height() / nScrollOffset;
- aVertScroll.SetRangeMax( nVisibleItems );
- aVertScroll.SetPageSize( nVisibleItems - 1 );
- aVertScroll.SetVisibleSize( nVisibleItems );
+ m_rVertScroll.SetRangeMin( 0 );
+ m_rVertScroll.SetVisibleSize( 0xFFFF );
Link aScrollLink = LINK( this, ScSortKeyCtrl, ScrollHdl );
- aVertScroll.SetScrollHdl( aScrollLink );
+ m_rVertScroll.SetScrollHdl( aScrollLink );
}
-// -----------------------------------------------------------------------
-
-ScSortKeyCtrl::~ScSortKeyCtrl()
+void ScSortKeyCtrl::setScrollRange()
{
+ 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 )
{
- sal_Int32 nOffset = aSortWin.GetItemHeight();
- nOffset *= ( nThumbPos - pScrollBar->GetThumbPos() );
- nThumbPos = pScrollBar->GetThumbPos();
- aSortWin.DoScroll( nOffset );
+ sal_Int32 nOffset = m_aSortWin.GetItemHeight();
+ nOffset *= pScrollBar->GetThumbPos();
+ m_aSortWin.DoScroll( -nOffset );
return 0;
}
@@ -189,9 +143,9 @@ IMPL_LINK( ScSortKeyCtrl, ScrollHdl, ScrollBar*, pScrollBar )
void ScSortKeyCtrl::AddSortKey( sal_uInt16 nItem )
{
- aVertScroll.SetRangeMax( nItem );
- aVertScroll.DoScroll( nItem );
- aSortWin.AddSortKey( nItem );
+ m_rVertScroll.SetRangeMax( nItem );
+ m_rVertScroll.DoScroll( nItem );
+ m_aSortWin.AddSortKey( nItem );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/dbgui/tpsort.cxx b/sc/source/ui/dbgui/tpsort.cxx
index eea965b..6688166 100644
--- a/sc/source/ui/dbgui/tpsort.cxx
+++ b/sc/source/ui/dbgui/tpsort.cxx
@@ -75,12 +75,11 @@ using namespace com::sun::star;
//========================================================================
// Sort Criteria Tab page
-ScTabPageSortFields::ScTabPageSortFields( Window* pParent,
- const SfxItemSet& rArgSet )
-
- : SfxTabPage ( pParent,
- ScResId( RID_SCPAGE_SORT_FIELDS ),
- rArgSet ),
+ScTabPageSortFields::ScTabPageSortFields(Window* pParent,
+ const SfxItemSet& rArgSet)
+ : SfxTabPage(pParent, "SortCriteriaPage",
+ "modules/scalc/ui/sortcriteriapage.ui", rArgSet)
+ ,
//
aStrUndefined ( SC_RESSTR( SCSTR_UNDEFINED ) ),
aStrColumn ( SC_RESSTR( SCSTR_COLUMN ) ),
@@ -96,13 +95,30 @@ ScTabPageSortFields::ScTabPageSortFields( Window* pParent,
nSortKeyCount ( DEFSORT ),
bHasHeader ( false ),
bSortByRows ( false ),
- maSortKeyCtrl ( this, ScResId( CTRL_MANAGESORTKEY ), maSortKeyItems )
+ maSortKeyCtrl ( this, maSortKeyItems )
{
Init();
- FreeResource();
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()
@@ -127,7 +143,7 @@ void ScTabPageSortFields::Init()
for ( sal_uInt16 i=0; i<nSortKeyCount; i++ )
{
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 */ )
bSortByRows = aSortData.bByRow;
bHasHeader = aSortData.bHasHeader;
- if ( maSortKeyItems[0].aLbSort.GetEntryCount() == 0 )
+ if ( maSortKeyItems[0].m_pLbSort->GetEntryCount() == 0 )
FillFieldLists(0);
// ListBox selection:
@@ -156,24 +172,24 @@ void ScTabPageSortFields::Reset( const SfxItemSet& /* rArgSet */ )
{
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].bAscending)
- ? maSortKeyItems[i].aBtnUp.Check()
- : maSortKeyItems[i].aBtnDown.Check();
+ ? maSortKeyItems[i].m_pBtnUp->Check()
+ : maSortKeyItems[i].m_pBtnDown->Check();
}
else
{
- maSortKeyItems[i].aLbSort.SelectEntryPos( 0 ); // Select none
- maSortKeyItems[i].aBtnUp.Check();
+ maSortKeyItems[i].m_pLbSort->SelectEntryPos( 0 ); // Select none
+ maSortKeyItems[i].m_pBtnUp->Check();
}
}
// Enable or disable field depending on preceding Listbox selection
maSortKeyItems[0].EnableField();
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();
else
maSortKeyItems[i].EnableField();
@@ -190,12 +206,12 @@ void ScTabPageSortFields::Reset( const SfxItemSet& /* rArgSet */ )
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++ )
- maSortKeyItems[i].aLbSort.SelectEntryPos( 0 );
+ maSortKeyItems[i].m_pLbSort->SelectEntryPos( 0 );
for ( sal_uInt16 i=0; i<nSortKeyCount; i++ )
- maSortKeyItems[i].aBtnUp.Check();
+ maSortKeyItems[i].m_pBtnUp->Check();
maSortKeyItems[0].EnableField();
@@ -232,7 +248,7 @@ sal_Bool ScTabPageSortFields::FillItemSet( SfxItemSet& rArgSet )
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;
}
@@ -262,7 +278,7 @@ sal_Bool ScTabPageSortFields::FillItemSet( SfxItemSet& rArgSet )
}
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
}
@@ -291,14 +307,14 @@ void ScTabPageSortFields::ActivatePage( const SfxItemSet& rSet )
{
std::vector<sal_uInt16> nCurSel;
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();
bSortByRows = pDlg->GetByRows();
FillFieldLists(0);
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 )
{
for ( sal_uInt16 i=nStartField; i<nSortKeyCount; i++ )
{
- maSortKeyItems[i].aLbSort.Clear();
- maSortKeyItems[i].aLbSort.InsertEntry( aStrUndefined, 0 );
+ maSortKeyItems[i].m_pLbSort->Clear();
+ maSortKeyItems[i].m_pLbSort->InsertEntry( aStrUndefined, 0 );
}
SCCOL nFirstSortCol = aSortData.nCol1;
@@ -361,7 +377,7 @@ void ScTabPageSortFields::FillFieldLists( sal_uInt16 nStartField )
nFieldArr.push_back( col );
for ( sal_uInt16 j=nStartField; j<nSortKeyCount; j++ )
- maSortKeyItems[j].aLbSort.InsertEntry( aFieldName, i );
+ maSortKeyItems[j].m_pLbSort->InsertEntry( aFieldName, i );
i++;
}
@@ -387,7 +403,7 @@ void ScTabPageSortFields::FillFieldLists( sal_uInt16 nStartField )
nFieldArr.push_back( row );
for ( sal_uInt16 j=nStartField; j<nSortKeyCount; j++ )
- maSortKeyItems[j].aLbSort.InsertEntry( aFieldName, i );
+ maSortKeyItems[j].m_pLbSort->InsertEntry( aFieldName, i );
i++;
}
@@ -427,7 +443,7 @@ IMPL_LINK( ScTabPageSortFields, SelectHdl, ListBox *, pLb )
sal_uInt16 nSortKeyIndex = nSortKeyCount;
// If last listbox is enabled add one item
- if ( &maSortKeyItems.back().aLbSort == pLb )
+ if ( maSortKeyItems.back().m_pLbSort == pLb )
if ( aSelEntry != aStrUndefined )
{
// Extend local SortParam copy
@@ -437,20 +453,20 @@ IMPL_LINK( ScTabPageSortFields, SelectHdl, ListBox *, pLb )
// Add Sort Key Item
++nSortKeyCount;
maSortKeyCtrl.AddSortKey( nSortKeyCount );
- maSortKeyItems[nSortKeyIndex].aLbSort.SetSelectHdl( LINK( this, ScTabPageSortFields, SelectHdl ) );
+ maSortKeyItems[nSortKeyIndex].m_pLbSort->SetSelectHdl( LINK( this, ScTabPageSortFields, SelectHdl ) );
FillFieldLists( nSortKeyIndex );
// Set Status
- maSortKeyItems[nSortKeyIndex].aBtnUp.Check();
- maSortKeyItems[nSortKeyIndex].aLbSort.SelectEntryPos( 0 );
+ maSortKeyItems[nSortKeyIndex].m_pBtnUp->Check();
+ maSortKeyItems[nSortKeyIndex].m_pLbSort->SelectEntryPos( 0 );
return 0;
}
// Find selected listbox
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
@@ -461,15 +477,15 @@ IMPL_LINK( ScTabPageSortFields, SelectHdl, ListBox *, pLb )
{
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();
}
}
else
{
- if ( !pIter->aFlSort.IsEnabled() )
+ if ( !pIter->m_pFlSort->IsEnabled() )
pIter->EnableField();
}
}
@@ -482,7 +498,8 @@ IMPL_LINK( ScTabPageSortFields, SelectHdl, ListBox *, pLb )
ScTabPageSortOptions::ScTabPageSortOptions( Window* pParent,
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))
, aStrColLabel(SC_RESSTR(SCSTR_COL_LABEL))
, aStrUndefined(SC_RESSTR(SCSTR_UNDEFINED))
diff --git a/sc/source/ui/inc/sortkeydlg.hxx b/sc/source/ui/inc/sortkeydlg.hxx
index 274a9b9..ddec0f6 100644
--- a/sc/source/ui/inc/sortkeydlg.hxx
+++ b/sc/source/ui/inc/sortkeydlg.hxx
@@ -36,6 +36,7 @@
#include <vcl/edit.hxx>
#include <vcl/fixed.hxx>
+#include <vcl/layout.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/scrbar.hxx>
#include <vcl/ctrl.hxx>
@@ -44,61 +45,61 @@
// =======================================================================
-struct ScSortKeyItem
+struct ScSortKeyItem : public VclBuilderContainer
{
- FixedLine aFlSort;
- ListBox aLbSort;
- RadioButton aBtnUp;
- RadioButton aBtnDown;
+ VclFrame* m_pFrame;
+ FixedText* m_pFlSort;
+ ListBox* m_pLbSort;
+ RadioButton* m_pBtnUp;
+ RadioButton* m_pBtnDown;
- ScSortKeyItem ( Window* pParent );
+ ScSortKeyItem(Window* pParent);
void DisableField();
void EnableField();
+
+ long getItemHeight() const;
};
typedef boost::ptr_vector<ScSortKeyItem> ScSortKeyItems;
// =======================================================================
-class ScSortKeyWindow : public Window
+class ScSortKeyWindow
{
private:
- FixedLine aFlSort;
- ListBox aLbSort;
- RadioButton aBtnUp;
- RadioButton aBtnDown;
-
+ VclBox* m_pBox;
sal_Int32 nScrollPos;
sal_Int32 nItemHeight;
ScSortKeyItems& mrSortKeyItems;
public:
- ScSortKeyWindow( Window* pParent, const ResId& rResId, ScSortKeyItems& mrSortKeyItems );
+ ScSortKeyWindow(SfxTabPage* pParent, ScSortKeyItems& mrSortKeyItems);
~ScSortKeyWindow();
void AddSortKey( sal_uInt16 nItem );
void DoScroll( sal_Int32 nNewPos );
sal_Int32 GetItemHeight() const { return nItemHeight; }
+ sal_Int32 GetTotalHeight() const { return m_pBox->GetSizePixel().Height(); }
};
// =======================================================================
-class ScSortKeyCtrl : public Control
+class ScSortKeyCtrl
{
private:
- ScSortKeyWindow aSortWin;
- ScrollBar aVertScroll;
+ ScSortKeyWindow m_aSortWin;
+ VclScrolledWindow& m_rScrolledWindow;
+ ScrollBar& m_rVertScroll;
sal_Int32 nThumbPos;
- DECL_LINK( ScrollHdl, ScrollBar* );
+ DECL_LINK(ScrollHdl, ScrollBar*);
public:
- ScSortKeyCtrl( Window* pParent, const ScResId& rResId, ScSortKeyItems& mrSortKeyItems );
- ~ScSortKeyCtrl();
-
+ ScSortKeyCtrl(SfxTabPage* pParent, ScSortKeyItems& mrSortKeyItems);
+ void setScrollRange();
void AddSortKey( sal_uInt16 nItem );
};
diff --git a/sc/source/ui/inc/tpsort.hxx b/sc/source/ui/inc/tpsort.hxx
index 0d71e82..8ce4a42 100644
--- a/sc/source/ui/inc/tpsort.hxx
+++ b/sc/source/ui/inc/tpsort.hxx
@@ -59,6 +59,10 @@ public:
virtual sal_Bool FillItemSet ( 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:
virtual void ActivatePage ( const SfxItemSet& rSet );
using SfxTabPage::ActivatePage;
diff --git a/sc/uiconfig/scalc/ui/sortcriteriapage.ui b/sc/uiconfig/scalc/ui/sortcriteriapage.ui
new file mode 100644
index 0000000..39e3a21
--- /dev/null
+++ b/sc/uiconfig/scalc/ui/sortcriteriapage.ui
@@ -0,0 +1,25 @@
+<?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>
diff --git a/sc/uiconfig/scalc/ui/sortoptionspage.ui b/sc/uiconfig/scalc/ui/sortoptionspage.ui
new file mode 100644
index 0000000..ce62207
--- /dev/null
+++ b/sc/uiconfig/scalc/ui/sortoptionspage.ui
@@ -0,0 +1,327 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.0 -->
+ <object class="GtkBox" id="SortOptionsPage">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkAlignment" id="alignment2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkGrid" id="grid2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">6</property>
+ <child>
+ <object class="GtkCheckButton" id="case">
+ <property name="label" translatable="yes">Case _sensitive</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="header">
+ <property name="label">Range contains...</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="formats">
+ <property name="label" translatable="yes">Include formats</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="naturalsort">
+ <property name="label" translatable="yes">Enable natural sort</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="copyresult">
+ <property name="label" translatable="yes">Copy sort results to:</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">4</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="outarealb">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_left">20</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">5</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="outareaed">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="invisible_char">â¢</property>
+ <property name="invisible_char_set">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">5</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="sortuser">
+ <property name="label" translatable="yes">Custom sort order</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">6</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="sortuserlb">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_left">20</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">7</property>
+ <property name="width">2</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">Language</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">8</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="algorithmft">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">Options</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">8</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="svxcorelo:SvxLanguageBox" id="language">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">9</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="algorithmlb">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">9</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFrame" id="frame1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkGrid" id="grid1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkRadioButton" id="topdown">
+ <property name="label" translatable="yes">_Top to bottom (sort rows)</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">leftright</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="leftright">
+ <property name="label" translatable="yes">L_eft to right (sort columns)</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">topdown</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Direction</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">10</property>
+ </packing>
+ </child>
+ </object>
+</interface>
diff --git a/sc/uiconfig/scalc/ui/sortpage.ui b/sc/uiconfig/scalc/ui/sortpage.ui
deleted file mode 100644
index 3645264..0000000
--- a/sc/uiconfig/scalc/ui/sortpage.ui
+++ /dev/null
@@ -1,327 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<interface>
- <!-- interface-requires gtk+ 3.0 -->
- <object class="GtkBox" id="SortPage">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkAlignment" id="alignment2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="left_padding">12</property>
- <child>
- <object class="GtkGrid" id="grid2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
- <child>
- <object class="GtkCheckButton" id="case">
- <property name="label" translatable="yes">Case _sensitive</property>
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
- <property name="use_underline">True</property>
- <property name="xalign">0</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="header">
- <property name="label">Range contains...</property>
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
- <property name="xalign">0</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="formats">
- <property name="label" translatable="yes">Include formats</property>
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
- <property name="xalign">0</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">2</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="naturalsort">
- <property name="label" translatable="yes">Enable natural sort</property>
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
- <property name="xalign">0</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">3</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="copyresult">
- <property name="label" translatable="yes">Copy sort results to:</property>
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
- <property name="xalign">0</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">4</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBox" id="outarealb">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin_left">20</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">5</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="outareaed">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hexpand">True</property>
- <property name="invisible_char">â¢</property>
- <property name="invisible_char_set">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">5</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="sortuser">
- <property name="label" translatable="yes">Custom sort order</property>
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
- <property name="xalign">0</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">6</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBox" id="sortuserlb">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin_left">20</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">7</property>
- <property name="width">2</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label6">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">start</property>
- <property name="label" translatable="yes">Language</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">8</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="algorithmft">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">start</property>
- <property name="label" translatable="yes">Options</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">8</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="svxcorelo:SvxLanguageBox" id="language">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">9</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBox" id="algorithmlb">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">9</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkFrame" id="frame1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">none</property>
- <child>
- <object class="GtkAlignment" id="alignment1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="left_padding">12</property>
- <child>
- <object class="GtkGrid" id="grid1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkRadioButton" id="topdown">
- <property name="label" translatable="yes">_Top to bottom (sort rows)</property>
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
- <property name="use_underline">True</property>
- <property name="xalign">0</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
- <property name="group">leftright</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkRadioButton" id="leftright">
- <property name="label" translatable="yes">L_eft to right (sort columns)</property>
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
- <property name="use_underline">True</property>
- <property name="xalign">0</property>
- <property name="draw_indicator">True</property>
- <property name="group">topdown</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child type="label">
- <object class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Direction</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">10</property>
- </packing>
- </child>
- </object>
-</interface>
commit f41a2804dd4a23352b7af2dd28c03df02debfb13
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Dec 4 16:16:14 2012 +0000
make sure ScrollBar OptimalSize is up to date
Change-Id: I12e95c3594ffbb508c7f79bd512e07aaf44a6eab
diff --git a/vcl/inc/vcl/scrbar.hxx b/vcl/inc/vcl/scrbar.hxx
index 8dbe270..7c62d94 100644
--- a/vcl/inc/vcl/scrbar.hxx
+++ b/vcl/inc/vcl/scrbar.hxx
@@ -83,8 +83,9 @@ private:
SAL_DLLPRIVATE long ImplDoAction( sal_Bool bCallEndScroll );
SAL_DLLPRIVATE void ImplDoMouseAction( const Point& rPos, sal_Bool bCallAction = sal_True );
SAL_DLLPRIVATE void ImplInvert();
- SAL_DLLPRIVATE sal_Bool ImplDrawNative( sal_uInt16 nDrawFlags );
+ SAL_DLLPRIVATE sal_Bool ImplDrawNative( sal_uInt16 nDrawFlags );
SAL_DLLPRIVATE void ImplDragThumb( const Point& rMousePos );
+ SAL_DLLPRIVATE Size getCurrentCalcSize() const;
DECL_DLLPRIVATE_LINK( ImplTimerHdl, Timer* );
DECL_DLLPRIVATE_LINK( ImplAutoTimerHdl, void* );
diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx
index 9e90362..b99ff26 100644
--- a/vcl/source/control/scrbar.cxx
+++ b/vcl/source/control/scrbar.cxx
@@ -323,7 +323,7 @@ void ScrollBar::ImplCalc( sal_Bool bUpdate )
Rectangle& maTrackRect = mpData->maTrackRect; // TODO: remove when maTrackRect is no longer in mpData
if ( mbCalcSize )
{
- Size aOldSize = GetOptimalSize(WINDOWSIZE_PREFERRED);
+ Size aOldSize = getCurrentCalcSize();
const Rectangle aControlRegion( Point(0,0), aSize );
Rectangle aBtn1Region, aBtn2Region, aTrackRegion, aBoundingRegion;
@@ -416,7 +416,7 @@ void ScrollBar::ImplCalc( sal_Bool bUpdate )
mbCalcSize = sal_False;
- Size aNewSize = GetOptimalSize(WINDOWSIZE_PREFERRED);
+ Size aNewSize = getCurrentCalcSize();
if (aOldSize != aNewSize)
{
queue_resize();
@@ -1509,6 +1509,13 @@ void ScrollBar::SetVisibleSize( long nNewSize )
Size ScrollBar::GetOptimalSize(WindowSizeType) const
{
+ if (mbCalcSize)
+ const_cast<ScrollBar*>(this)->ImplCalc(sal_False);
+ return getCurrentCalcSize();
+}
+
+Size ScrollBar::getCurrentCalcSize() const
+{
Rectangle aCtrlRegion;
aCtrlRegion.Union(maBtn1Rect);
aCtrlRegion.Union(maBtn2Rect);
commit 953cb304b16d04e8ec6e023643b9393395e2d99a
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Dec 4 15:28:48 2012 +0000
export VclScrolledWindow for external-to-builder use
as a work-in-progress
Change-Id: I6065f3a4db5056cd925152dccd275de0d17b77b9
diff --git a/vcl/inc/vcl/layout.hxx b/vcl/inc/vcl/layout.hxx
index 04ee7e3..b09b112 100644
--- a/vcl/inc/vcl/layout.hxx
+++ b/vcl/inc/vcl/layout.hxx
@@ -12,13 +12,14 @@
#include <vcl/dllapi.h>
#include <vcl/button.hxx>
+#include <vcl/scrbar.hxx>
#include <vcl/window.hxx>
#include <boost/multi_array.hpp>
class VCL_DLLPUBLIC VclContainer : public Window
{
public:
- VclContainer(Window *pParent);
+ VclContainer(Window *pParent, WinBits nStyle = WB_HIDE);
virtual Size GetOptimalSize(WindowSizeType eType) const;
virtual void SetPosSizePixel(const Point& rNewPos, const Size& rNewSize);
virtual void SetPosPixel(const Point& rAllocPos);
@@ -426,7 +427,10 @@ VCL_DLLPUBLIC void setGridAttach(Window &rWidget, sal_Int32 nLeft, sal_Int32 nTo
class VCL_DLLPUBLIC VclBin : public VclContainer
{
public:
- VclBin(Window *pParent) : VclContainer(pParent) {}
+ VclBin(Window *pParent, WinBits nStyle = WB_HIDE)
+ : VclContainer(pParent, nStyle)
+ {
+ }
virtual Window *get_child();
virtual const Window *get_child() const;
virtual Size calculateRequisition() const;
@@ -498,6 +502,32 @@ private:
DECL_DLLPRIVATE_LINK(ClickHdl, DisclosureButton* pBtn);
};
+//This is a work in progress, so if you want to put something inside a
+//scrolled window that doesn't handle its own scrolling, then you may need to
+//implement this fully
+class VCL_DLLPUBLIC VclScrolledWindow : public VclBin
+{
+public:
+ VclScrolledWindow(Window *pParent, WinBits nStyle = WB_HIDE | WB_AUTOHSCROLL | WB_AUTOVSCROLL)
+ : VclBin(pParent, nStyle)
+ , m_aVScroll(this, WB_HIDE | WB_VERT)
+ , m_aHScroll(this, WB_HIDE | WB_HORZ)
+ {
+ SetType(WINDOW_SCROLLWINDOW);
+ }
+ virtual Window *get_child();
+ virtual const Window *get_child() const;
+ virtual bool set_property(const OString &rKey, const OString &rValue);
+ ScrollBar& getVertScrollBar() { return m_aVScroll; }
+ ScrollBar& getHorzScrollBar() { return m_aHScroll; }
+ Size getVisibleChildSize() const;
+protected:
+ virtual Size calculateRequisition() const;
+ virtual void setAllocation(const Size &rAllocation);
+private:
+ ScrollBar m_aVScroll;
+ ScrollBar m_aHScroll;
+};
// retro-fitting utilities //
@@ -525,6 +555,12 @@ bool isEnabledInLayout(const Window *pWindow);
Window* nextLogicalChildOfParent(Window *pTopLevel, Window *pChild);
Window* prevLogicalChildOfParent(Window *pTopLevel, Window *pChild);
+inline bool isContainerWindow(const Window &rWindow)
+{
+ WindowType eType = rWindow.GetType();
+ return (eType == WINDOW_CONTAINER || eType == WINDOW_SCROLLWINDOW);
+}
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 0d8068b..5b4b5e2 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -573,21 +573,6 @@ bool VclBuilder::extractImage(const OString &id, stringmap &rMap)
return false;
}
-//This doesn't actually do anything yet, so hide it down here in builder.cxx as
-//merely a temporary storage for scrolling information for vcl controls which
-//actually manage their own scrolling. If you want to put something inside
-//a scrolled window that doesn't handle its own scrolling, then you
-//need to implement this fully and move into a top-level header
-class VclScrolledWindow : public Window
-{
-public:
- VclScrolledWindow(Window *pParent)
- : Window(WINDOW_SCROLLWINDOW)
- {
- ImplInit(pParent, WB_HIDE | WB_AUTOHSCROLL | WB_AUTOVSCROLL, NULL);
- }
-};
-
#ifndef DISABLE_DYNLOADING
extern "C" { static void SAL_CALL thisModule() {} }
#endif
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 20f1431..3ef0f44 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -123,7 +123,7 @@ Window * nextLogicalChildOfParent(Window *pTopLevel, Window *pChild)
{
Window *pLastChild = pChild;
- if (pChild->GetType() == WINDOW_CONTAINER)
+ if (isContainerWindow(*pChild))
pChild = pChild->GetWindow(WINDOW_FIRSTCHILD);
else
pChild = pChild->GetWindow(WINDOW_NEXT);
@@ -139,7 +139,7 @@ Window * nextLogicalChildOfParent(Window *pTopLevel, Window *pChild)
pChild = pParent->GetWindow(WINDOW_NEXT);
}
- if (pChild && pChild->GetType() == WINDOW_CONTAINER)
+ if (pChild && isContainerWindow(*pChild))
pChild = nextLogicalChildOfParent(pTopLevel, pChild);
return pChild;
@@ -149,7 +149,7 @@ Window * prevLogicalChildOfParent(Window *pTopLevel, Window *pChild)
{
Window *pLastChild = pChild;
- if (pChild->GetType() == WINDOW_CONTAINER)
+ if (isContainerWindow(*pChild))
pChild = pChild->GetWindow(WINDOW_LASTCHILD);
else
pChild = pChild->GetWindow(WINDOW_PREV);
@@ -165,7 +165,7 @@ Window * prevLogicalChildOfParent(Window *pTopLevel, Window *pChild)
pChild = pParent->GetWindow(WINDOW_PREV);
}
- if (pChild && pChild->GetType() == WINDOW_CONTAINER)
+ if (pChild && isContainerWindow(*pChild))
pChild = prevLogicalChildOfParent(pTopLevel, pChild);
return pChild;
@@ -1170,7 +1170,7 @@ bool Dialog::isLayoutEnabled() const
{
//pre dtor called, and single child is a container => we're layout enabled
const Window *pChild = mpDialogImpl ? GetWindow(WINDOW_FIRSTCHILD) : NULL;
- return pChild && pChild->GetType() == WINDOW_CONTAINER && !pChild->GetWindow(WINDOW_NEXT);
+ return pChild && isContainerWindow(*pChild) && !pChild->GetWindow(WINDOW_NEXT);
}
Size Dialog::GetOptimalSize(WindowSizeType eType) const
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index f947bee..91017d5 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -11,11 +11,11 @@
#include <vcl/layout.hxx>
#include "window.h"
-VclContainer::VclContainer(Window *pParent)
+VclContainer::VclContainer(Window *pParent, WinBits nStyle)
: Window(WINDOW_CONTAINER)
, m_bLayoutDirty(true)
{
- ImplInit(pParent, WB_HIDE, NULL);
+ ImplInit(pParent, nStyle, NULL);
EnableChildTransparentMode();
SetPaintTransparent(sal_True);
SetBackground();
@@ -1195,6 +1195,93 @@ IMPL_LINK( VclExpander, ClickHdl, DisclosureButton*, pBtn )
return 0;
}
+const Window *VclScrolledWindow::get_child() const
+{
+ assert(GetChildCount() == 3);
+ const WindowImpl* pWindowImpl = ImplGetWindowImpl();
+ return pWindowImpl->mpLastChild;
+}
+
+Window *VclScrolledWindow::get_child()
+{
+ return const_cast<Window*>(const_cast<const VclScrolledWindow*>(this)->get_child());
+}
+
+Size VclScrolledWindow::calculateRequisition() const
+{
+ Size aRet(0, 0);
+
+ const Window *pChild = get_child();
+ if (pChild && pChild->IsVisible())
+ aRet = getLayoutRequisition(*pChild);
+
+ if (m_aVScroll.IsVisible())
+ aRet.Width() += getLayoutRequisition(m_aVScroll).Width();
+
+ if (m_aHScroll.IsVisible())
+ aRet.Height() += getLayoutRequisition(m_aVScroll).Height();
+
+ return aRet;
+}
+
+void VclScrolledWindow::setAllocation(const Size &rAllocation)
+{
+ Size aChildAllocation(rAllocation);
+ Size aChildReq;
+
+ Window *pChild = get_child();
+ if (pChild && pChild->IsVisible())
+ aChildReq = getLayoutRequisition(*pChild);
+
+ if (m_aVScroll.IsVisible())
+ {
+ long nScrollBarWidth = getLayoutRequisition(m_aVScroll).Width();
+ Point aScrollPos(rAllocation.Width() - nScrollBarWidth, 0);
+ Size aScrollSize(nScrollBarWidth, rAllocation.Height());
+ setLayoutAllocation(m_aVScroll, aScrollPos, aScrollSize);
+ aChildAllocation.Width() -= nScrollBarWidth;
+ aChildAllocation.Height() = aChildReq.Height();
+ }
+
+ if (m_aHScroll.IsVisible())
+ {
+ long nScrollBarHeight = getLayoutRequisition(m_aHScroll).Height();
+ Point aScrollPos(0, rAllocation.Height() - nScrollBarHeight);
+ Size aScrollSize(rAllocation.Width(), nScrollBarHeight);
+ setLayoutAllocation(m_aHScroll, aScrollPos, aScrollSize);
+ aChildAllocation.Height() -= nScrollBarHeight;
+ aChildAllocation.Width() = aChildReq.Width();
+ }
+
+ if (pChild && pChild->IsVisible())
+ {
+ Point aChildPos(pChild->GetPosPixel());
+ if (!m_aHScroll.IsVisible())
+ aChildPos.X() = 0;
+ if (!m_aVScroll.IsVisible())
+ aChildPos.Y() = 0;
+ setLayoutAllocation(*pChild, aChildPos, aChildAllocation);
+ }
+}
+
+Size VclScrolledWindow::getVisibleChildSize() const
+{
+ Size aRet(GetSizePixel());
+ if (m_aVScroll.IsVisible())
+ aRet.Width() -= m_aVScroll.GetSizePixel().Width();
+ if (m_aHScroll.IsVisible())
+ aRet.Height() -= m_aHScroll.GetSizePixel().Height();
+ return aRet;
+}
+
+bool VclScrolledWindow::set_property(const rtl::OString &rKey, const rtl::OString &rValue)
+{
+ bool bRet = VclBin::set_property(rKey, rValue);
+ m_aVScroll.Show(GetStyle() & WB_VERT);
+ m_aHScroll.Show(GetStyle() & WB_HORZ);
+ return bRet;
+}
+
Size getLegacyBestSizeForChildren(const Window &rWindow)
{
Rectangle aBounds;
@@ -1225,7 +1312,7 @@ Window* getNonLayoutParent(Window *pWindow)
while (pWindow)
{
pWindow = pWindow->GetParent();
- if (!pWindow || pWindow->GetType() != WINDOW_CONTAINER)
+ if (!pWindow || !isContainerWindow(*pWindow))
break;
}
return pWindow;
@@ -1236,7 +1323,7 @@ Window* getNonLayoutRealParent(Window *pWindow)
while (pWindow)
{
pWindow = pWindow->ImplGetParent();
- if (!pWindow || pWindow->GetType() != WINDOW_CONTAINER)
+ if (!pWindow || !isContainerWindow(*pWindow))
break;
}
return pWindow;
@@ -1249,7 +1336,7 @@ bool isVisibleInLayout(const Window *pWindow)
{
bVisible = pWindow->IsVisible();
pWindow = pWindow->GetParent();
- if (!pWindow || pWindow->GetType() != WINDOW_CONTAINER)
+ if (!pWindow || !isContainerWindow(*pWindow))
break;
}
return bVisible;
@@ -1262,7 +1349,7 @@ bool isEnabledInLayout(const Window *pWindow)
{
bEnabled = pWindow->IsEnabled();
pWindow = pWindow->GetParent();
- if (!pWindow || pWindow->GetType() != WINDOW_CONTAINER)
+ if (!pWindow || !isContainerWindow(*pWindow))
break;
}
return bEnabled;
diff --git a/vcl/source/window/tabdlg.cxx b/vcl/source/window/tabdlg.cxx
index 64b44b5..d6dbcd3 100644
--- a/vcl/source/window/tabdlg.cxx
+++ b/vcl/source/window/tabdlg.cxx
@@ -18,6 +18,7 @@
*/
#include <vcl/fixed.hxx>
+#include <vcl/layout.hxx>
#include <vcl/tabctrl.hxx>
#include <vcl/tabdlg.hxx>
#include <tools/rc.h>
@@ -51,8 +52,7 @@ void TabDialog::ImplPosControls()
{
if ( pChild->IsVisible() && (pChild != mpViewWindow) )
{
- WindowType eChildType = pChild->GetType();
- if ( eChildType == WINDOW_TABCONTROL || eChildType == WINDOW_CONTAINER )
+ if (pChild->GetType() == WINDOW_TABCONTROL || isContainerWindow(*pChild))
pTabControl = pChild;
else if ( pTabControl )
{
@@ -85,7 +85,7 @@ void TabDialog::ImplPosControls()
Point aTabOffset( IMPL_DIALOG_OFFSET, IMPL_DIALOG_OFFSET+nOffY );
- if (pTabControl->GetType() == WINDOW_CONTAINER)
+ if (isContainerWindow(*pTabControl))
pTabControl->SetSizePixel(pTabControl->GetOptimalSize(WINDOWSIZE_PREFERRED));
Size aTabSize = pTabControl->GetSizePixel();
diff --git a/vcl/source/window/tabpage.cxx b/vcl/source/window/tabpage.cxx
index 820a73f..3546c4f 100644
--- a/vcl/source/window/tabpage.cxx
+++ b/vcl/source/window/tabpage.cxx
@@ -213,7 +213,7 @@ bool TabPage::isLayoutEnabled() const
{
//Child is a container => we're layout enabled
const Window *pChild = GetWindow(WINDOW_FIRSTCHILD);
- return pChild && pChild->GetType() == WINDOW_CONTAINER && !pChild->GetWindow(WINDOW_NEXT);
+ return pChild && isContainerWindow(*pChild) && !pChild->GetWindow(WINDOW_NEXT);
}
Size TabPage::GetOptimalSize(WindowSizeType eType) const
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index 647463c..0459a5b 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -1746,7 +1746,7 @@ void Window::queue_resize()
while( pWindow )
{
- if (pWindow->GetType() == WINDOW_CONTAINER)
+ if (isContainerWindow(*pWindow))
{
VclContainer *pContainer = static_cast<VclContainer*>(pWindow);
pContainer->markLayoutDirty();
More information about the Libreoffice-commits
mailing list