Hi Markus,
So I have hacked a bit on the UI for the new sort dialog in calc. I'm
posting my work-in-progress patch hoping to get confirmation that I'm
on the right track and also help with the specific issues below.
As you suggested I've used the same concept for as in namedlg, where I
created ScSortKeyDlg class which defines the dialog for a single sort
key entry. this class is then instantiated via a control class.
So far so good I think, then comes the ugly bits:
1.) Obviously I'm using the wrong widget class for ScSortKeyDlg since
each dialog opens in a separate window and are not embedded in the
main dialog.
Which widget should I use here?
2.) Related to the above is the question about how to position the
sort key dialogs relative to each other.
3.) The Listbox handler. The handler is used to enable/disable the
widigets of the subsequent sort key(s). Now that each sort key is an
instance of its own I'm not sure how to get "the signal across" form
one instance to the other. Can I catch this event in the control
class?
Any hints on the above are much appreciated.
Thanks in advance.
/Albert
From 5414d27131c1b914e19e712e3c6115f0dbdc0c28 Mon Sep 17 00:00:00 2001
From: Albert Thuswaldner <albert.thuswaldner@gmail.com>
Date: Thu, 26 Apr 2012 23:35:46 +0200
Subject: [PATCH] fdo#45747 - remove the limitation to 3 sort entries in calc, part 2
---
sc/AllLangResTarget_sc.mk | 1 +
sc/Library_scui.mk | 1 +
sc/inc/helpids.h | 1 +
sc/inc/sc.hrc | 4 +-
sc/source/ui/dbgui/sortkeydlg.cxx | 154 +++++++++++++++++++++++++++++++
sc/source/ui/dbgui/tpsort.cxx | 182 ++++++++++++++-----------------------
sc/source/ui/inc/sortdlg.hrc | 13 +---
sc/source/ui/inc/sortkeydlg.hrc | 40 ++++++++
sc/source/ui/inc/sortkeydlg.hxx | 84 +++++++++++++++++
sc/source/ui/inc/tpsort.hxx | 24 +----
sc/source/ui/src/sortdlg.src | 96 +------------------
sc/source/ui/src/sortkeydlg.src | 67 ++++++++++++++
toolkit/src2xml/src-sc.lst | 1 +
toolkit/src2xml/src.lst | 1 +
14 files changed, 430 insertions(+), 239 deletions(-)
create mode 100644 sc/source/ui/dbgui/sortkeydlg.cxx
create mode 100644 sc/source/ui/inc/sortkeydlg.hrc
create mode 100644 sc/source/ui/inc/sortkeydlg.hxx
create mode 100644 sc/source/ui/src/sortkeydlg.src
diff --git a/sc/AllLangResTarget_sc.mk b/sc/AllLangResTarget_sc.mk
index 09526bd..aab2146 100644
--- a/sc/AllLangResTarget_sc.mk
+++ b/sc/AllLangResTarget_sc.mk
@@ -78,6 +78,7 @@ $(eval $(call gb_SrsTarget_add_files,sc/res,\
sc/source/ui/src/dbnamdlg.src \
sc/source/ui/src/opredlin.src \
sc/source/ui/src/sortdlg.src \
+ sc/source/ui/src/sortkeydlg.src \
sc/source/ui/src/attrdlg.src \
sc/source/ui/src/filter.src \
sc/source/ui/cctrl/checklistmenu.src \
diff --git a/sc/Library_scui.mk b/sc/Library_scui.mk
index 9af5a63..37478a2 100644
--- a/sc/Library_scui.mk
+++ b/sc/Library_scui.mk
@@ -72,6 +72,7 @@ $(eval $(call gb_Library_add_exception_objects,scui,\
sc/source/ui/dbgui/scuiasciiopt \
sc/source/ui/dbgui/scuiimoptdlg \
sc/source/ui/dbgui/sortdlg \
+ sc/source/ui/dbgui/sortkeydlg \
sc/source/ui/dbgui/subtdlg \
sc/source/ui/dbgui/textimportoptions \
sc/source/ui/dbgui/tpsort \
diff --git a/sc/inc/helpids.h b/sc/inc/helpids.h
index 5eec0d1..03b9f40 100644
--- a/sc/inc/helpids.h
+++ b/sc/inc/helpids.h
@@ -88,6 +88,7 @@
#define HID_SC_FORM_ARGS "SC_HID_SC_FORM_ARGS"
#define HID_SCPAGE_SORT_FIELDS "SC_HID_SCPAGE_SORT_FIELDS"
#define HID_SCPAGE_SORT_OPTIONS "SC_HID_SCPAGE_SORT_OPTIONS"
+#define HID_SCPAGE_SORTKEY_FIELDS "SC_HID_SCPAGE_SORTKEY_FIELDS"
#define HID_SCPAGE_SUBT_OPTIONS "SC_HID_SCPAGE_SUBT_OPTIONS"
#define HID_SCPAGE_SUBT_GROUP "SC_HID_SCPAGE_SUBT_GROUP"
#define HID_SCPAGE_PROTECTION "SC_HID_SCPAGE_PROTECTION"
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index f8b1875..25b90fe 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -1221,7 +1221,9 @@
#define RID_POPUP_FILTER (SC_DIALOGS_START + 153)
#define RID_SCDLG_TAB_BG_COLOR (SC_DIALOGS_START + 154)
-#define SC_DIALOGS_END (SC_DIALOGS_START + 155)
+#define RID_SCPAGE_SORTKEY_FIELDS (SC_DIALOGS_START + 155)
+#define RID_SCDLG_SORTKEY (SC_DIALOGS_START + 156)
+#define SC_DIALOGS_END (SC_DIALOGS_START + 157)
#ifndef STD_MASKCOLOR
#define STD_MASKCOLOR Color { Red = 0xFF00; Green = 0x0000; Blue = 0xFF00; }
diff --git a/sc/source/ui/dbgui/sortkeydlg.cxx b/sc/source/ui/dbgui/sortkeydlg.cxx
new file mode 100644
index 0000000..93ac1e3
--- /dev/null
+++ b/sc/source/ui/dbgui/sortkeydlg.cxx
@@ -0,0 +1,154 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Albert Thuswaldner <albert.thuswaldner@gmail.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include "sortkeydlg.hxx"
+
+ScSortKeyDlg::ScSortKeyDlg( Window* pParent ) :
+ ModelessDialog( pParent, ScResId( RID_SCPAGE_SORTKEY_FIELDS ) ),
+ //
+ aFlSort ( this, ScResId( FL_SORT ) ),
+ aLbSort ( this, ScResId( LB_SORT ) ),
+ aBtnUp ( this, ScResId( BTN_UP ) ),
+ aBtnDown ( this, ScResId( BTN_DOWN ) )
+{
+ Init();
+ FreeResource();
+}
+
+// -----------------------------------------------------------------------
+
+void ScSortKeyDlg::Init()
+{
+ SetSortKeyNumberString();
+ ++aSortKeyNumber;
+}
+
+// -----------------------------------------------------------------------
+
+ScSortKeyDlg::~ScSortKeyDlg()
+{
+ --aSortKeyNumber;
+}
+
+// -----------------------------------------------------------------------
+
+void ScSortKeyDlg::DisableField()
+{
+ aFlSort.Disable();
+ aLbSort.Disable();
+ aBtnUp.Disable();
+ aBtnDown.Disable();
+}
+
+// -----------------------------------------------------------------------
+
+void ScSortKeyDlg::EnableField()
+{
+ aFlSort.Enable();
+ aLbSort.Enable();
+ aBtnUp.Enable();
+ aBtnDown.Enable();
+}
+
+// -----------------------------------------------------------------------
+
+void ScSortKeyDlg::ClearListBox()
+{
+ aLbSort.Clear();
+}
+
+// -----------------------------------------------------------------------
+
+
+void ScSortKeyDlg::InsertEntryListBox(String aFieldName, sal_uInt16 nPos )
+{
+ aLbSort.InsertEntry( aFieldName, nPos );
+}
+
+// -----------------------------------------------------------------------
+
+String ScSortKeyDlg::GetSelectedEntryListBox( ListBox* pLb )
+{
+ return pLb->GetSelectEntry();
+}
+
+// -----------------------------------------------------------------------
+
+
+void ScSortKeyDlg::SelectEntryPosListBox(sal_uInt16 nPos )
+{
+ aLbSort.SelectEntryPos( nPos );
+}
+
+// -----------------------------------------------------------------------
+
+sal_uInt16 ScSortKeyDlg::GetSelectEntryPosListBox()
+{
+ return aLbSort.GetSelectEntryPos();
+}
+
+// -----------------------------------------------------------------------
+
+sal_uInt16 ScSortKeyDlg::GetEntryCountListBox()
+{
+ return aLbSort.GetEntryCount();
+}
+
+// -----------------------------------------------------------------------
+
+void ScSortKeyDlg::CheckButtonDown()
+{
+ aBtnDown.Check();
+}
+
+// -----------------------------------------------------------------------
+
+void ScSortKeyDlg::CheckButtonUp()
+{
+ aBtnUp.Check();
+}
+
+// -----------------------------------------------------------------------
+
+bool ScSortKeyDlg::IsCheckedButtonUp()
+{
+ return aBtnUp.IsChecked();
+}
+
+// -----------------------------------------------------------------------
+
+void ScSortKeyDlg::SetSortKeyNumberString()
+{
+ String aLine = aFlSort.GetText();
+ aLine += String::CreateFromInt32( aSortKeyNumber );
+ aFlSort.SetText( aLine );
+}
+
+// -----------------------------------------------------------------------
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/dbgui/tpsort.cxx b/sc/source/ui/dbgui/tpsort.cxx
index f36c0a3..3b4db64 100644
--- a/sc/source/ui/dbgui/tpsort.cxx
+++ b/sc/source/ui/dbgui/tpsort.cxx
@@ -49,6 +49,8 @@
#include "sc.hrc" // -> Slot IDs
#include "globstr.hrc"
+#include "sortkeydlg.hxx"
+
#include "sortdlg.hxx"
#include "sortdlg.hrc"
@@ -58,6 +60,8 @@
using namespace com::sun::star;
+sal_uInt16 ScSortKeyDlg::aSortKeyNumber = 1;
+
// -----------------------------------------------------------------------
/*
@@ -89,21 +93,6 @@ ScTabPageSortFields::ScTabPageSortFields( Window* pParent,
ScResId( RID_SCPAGE_SORT_FIELDS ),
rArgSet ),
//
- aFlSort1 ( this, ScResId( FL_SORT1 ) ),
- aLbSort1 ( this, ScResId( LB_SORT1 ) ),
- aBtnUp1 ( this, ScResId( BTN_UP1 ) ),
- aBtnDown1 ( this, ScResId( BTN_DOWN1 ) ),
- //
- aFlSort2 ( this, ScResId( FL_SORT2 ) ),
- aLbSort2 ( this, ScResId( LB_SORT2 ) ),
- aBtnUp2 ( this, ScResId( BTN_UP2 ) ),
- aBtnDown2 ( this, ScResId( BTN_DOWN2 ) ),
- //
- aFlSort3 ( this, ScResId( FL_SORT3 ) ),
- aLbSort3 ( this, ScResId( LB_SORT3 ) ),
- aBtnUp3 ( this, ScResId( BTN_UP3 ) ),
- aBtnDown3 ( this, ScResId( BTN_DOWN3 ) ),
-
aStrUndefined ( ScResId( SCSTR_UNDEFINED ) ),
aStrColumn ( ScResId( SCSTR_COLUMN ) ),
aStrRow ( ScResId( SCSTR_ROW ) ),
@@ -114,12 +103,14 @@ ScTabPageSortFields::ScTabPageSortFields( Window* pParent,
rSortData ( ((const ScSortItem&)
rArgSet.Get( nWhichSort )).
GetSortData() ),
+ //
aNewSortData ( rSortData ),
nFieldCount ( 0 ),
nSortKeyCount ( DEFSORT ),
nCurrentOffset ( 0 ),
bHasHeader ( false ),
- bSortByRows ( false )
+ bSortByRows ( false ),
+ maSortKeyCtrl ( this, ScResId( CTRL_MANAGESORTKEY ) )
{
Init();
FreeResource();
@@ -158,29 +149,16 @@ void ScTabPageSortFields::Init()
nFirstCol = 0;
nFirstRow = 0;
- aLbSort1.SetSelectHdl( LINK( this, ScTabPageSortFields, SelectHdl ) );
- aLbSort2.SetSelectHdl( LINK( this, ScTabPageSortFields, SelectHdl ) );
- aLbSort3.SetSelectHdl( LINK( this, ScTabPageSortFields, SelectHdl ) );
- aLbSort1.Clear();
- aLbSort2.Clear();
- aLbSort3.Clear();
-
- aLbSortArr.push_back( &aLbSort1 );
- aLbSortArr.push_back( &aLbSort2 );
- aLbSortArr.push_back( &aLbSort3 );
+// aLbSort1.SetSelectHdl( LINK( this, ScTabPageSortFields, SelectHdl ) );
+// aLbSort2.SetSelectHdl( LINK( this, ScTabPageSortFields, SelectHdl ) );
+// aLbSort3.SetSelectHdl( LINK( this, ScTabPageSortFields, SelectHdl ) );
- aBtnUp.push_back( &aBtnUp1 );
- aBtnUp.push_back( &aBtnUp2 );
- aBtnUp.push_back( &aBtnUp3 );
+ // Create three sort key dialogs by default
+ for ( sal_uInt16 i=0; i<nSortKeyCount; i++ )
+ mpSortKeyDlg.push_back( new ScSortKeyDlg( &maSortKeyCtrl ) );
+}
- aBtnDown.push_back( &aBtnDown1 );
- aBtnDown.push_back( &aBtnDown2 );
- aBtnDown.push_back( &aBtnDown3 );
- aFlArr.push_back( &aFlSort1 );
- aFlArr.push_back( &aFlSort2 );
- aFlArr.push_back( &aFlSort3 );
-}
// -----------------------------------------------------------------------
@@ -197,7 +175,7 @@ void ScTabPageSortFields::Reset( const SfxItemSet& /* rArgSet */ )
bSortByRows = aNewSortData.bByRow;
bHasHeader = aNewSortData.bHasHeader;
- if ( aLbSort1.GetEntryCount() == 0 )
+ if ( mpSortKeyDlg[0] -> GetEntryCountListBox() == 0 )
FillFieldLists(0);
// ListBox selection:
@@ -207,27 +185,28 @@ void ScTabPageSortFields::Reset( const SfxItemSet& /* rArgSet */ )
{
if ( aNewSortData.maKeyState[i].bDoSort )
{
- aLbSortArr[i]->SelectEntryPos( GetFieldSelPos(
- aNewSortData.maKeyState[i].nField ) );
+ mpSortKeyDlg[i] -> SelectEntryPosListBox( GetFieldSelPos(
+ aNewSortData.maKeyState[i].nField ) );
(aNewSortData.maKeyState[i].bAscending)
- ? aBtnUp[i]->Check()
- : aBtnDown[i]->Check();
+ ? mpSortKeyDlg[i] -> CheckButtonUp()
+ : mpSortKeyDlg[i] -> CheckButtonDown();
}
else
{
- aLbSortArr[i]->SelectEntryPos( 0 ); // Select none
- aBtnUp[i]->Check();
+ mpSortKeyDlg[i] -> SelectEntryPosListBox( 0 ); // Select none
+ mpSortKeyDlg[i] -> CheckButtonUp();
}
}
// Enable or disable field depending on preceding Listbox selection
- EnableField( 0 );
+ mpSortKeyDlg[0] -> EnableField();
for ( sal_uInt16 i=1; i<nSortKeyCount; i++ )
- if ( aLbSortArr[i - 1] -> GetSelectEntryPos() == 0 )
- DisableField( i );
+ if ( mpSortKeyDlg[i - 1] -> GetSelectEntryPosListBox() == 0 )
+ mpSortKeyDlg[i] -> DisableField();
else
- EnableField( i );
+ mpSortKeyDlg[i] -> EnableField();
+
}
else
{
@@ -240,17 +219,18 @@ void ScTabPageSortFields::Reset( const SfxItemSet& /* rArgSet */ )
sal_uInt16 nSort1Pos = nCol - aNewSortData.nCol1+1;
- aLbSortArr[0] -> SelectEntryPos( nSort1Pos );
+ mpSortKeyDlg[0] -> SelectEntryPosListBox( nSort1Pos );
for ( sal_uInt16 i=1; i<nSortKeyCount; i++ )
- aLbSortArr[i] -> SelectEntryPos( 0 );
+ mpSortKeyDlg[i] -> SelectEntryPosListBox( 0 );
for ( sal_uInt16 i=0; i<nSortKeyCount; i++ )
- aBtnUp[i] -> Check();
+ mpSortKeyDlg[i] -> CheckButtonUp();
+
- EnableField ( 0 );
- EnableField ( 1 );
+ mpSortKeyDlg[0] -> EnableField();
+ mpSortKeyDlg[1] -> EnableField();
for ( sal_uInt16 i=2; i<nSortKeyCount; i++ )
- DisableField( i );
+ mpSortKeyDlg[i] -> DisableField();
}
if ( pDlg )
@@ -268,7 +248,7 @@ sal_Bool ScTabPageSortFields::FillItemSet( SfxItemSet& rArgSet )
for ( sal_uInt16 i=0; i<nSortKeyCount; i++ )
{
- nSortPos.push_back( aLbSortArr[i] -> GetSelectEntryPos() );
+ nSortPos.push_back( mpSortKeyDlg[i] -> GetSelectEntryPosListBox() );
if ( nSortPos[i] == LISTBOX_ENTRY_NOTFOUND ) nSortPos[i] = 0;
}
@@ -295,7 +275,7 @@ sal_Bool ScTabPageSortFields::FillItemSet( SfxItemSet& rArgSet )
}
for ( sal_uInt16 i=0; i<nSortKeyCount; i++ )
- aNewSortData.maKeyState[i].bAscending = aBtnUp[i] -> IsChecked();
+ aNewSortData.maKeyState[i].bAscending = mpSortKeyDlg[i] -> IsCheckedButtonUp();
// bHasHeader is in ScTabPageSortOptions::FillItemSet, where it belongs
}
@@ -322,14 +302,14 @@ void ScTabPageSortFields::ActivatePage()
{
std::vector<sal_uInt16> nCurSel;
for ( sal_uInt16 i=0; i<nSortKeyCount; i++ )
- nCurSel.push_back( aLbSortArr[i] -> GetSelectEntryPos() );
+ nCurSel.push_back( mpSortKeyDlg[i] -> GetSelectEntryPosListBox() );
bHasHeader = pDlg->GetHeaders();
bSortByRows = pDlg->GetByRows();
FillFieldLists(0);
for ( sal_uInt16 i=0; i<nSortKeyCount; i++ )
- aLbSortArr[i] -> SelectEntryPos( nCurSel[i] );
+ mpSortKeyDlg[i] -> SelectEntryPosListBox( nCurSel[i] );
}
}
}
@@ -355,32 +335,6 @@ int ScTabPageSortFields::DeactivatePage( SfxItemSet* pSetP )
// -----------------------------------------------------------------------
-void ScTabPageSortFields::DisableField( sal_uInt16 nField )
-{
- if ( nField<nSortKeyCount )
- {
- aLbSortArr[nField] -> Disable();
- aBtnUp[nField] -> Disable();
- aBtnDown[nField] -> Disable();
- aFlArr[nField] -> Disable();
- }
-}
-
-// -----------------------------------------------------------------------
-
-void ScTabPageSortFields::EnableField( sal_uInt16 nField )
-{
- if ( nField<nSortKeyCount )
- {
- aLbSortArr[nField] -> Enable();
- aBtnUp[nField] -> Enable();
- aBtnDown[nField] -> Enable();
- aFlArr[nField] -> Enable();
- }
-}
-
-// -----------------------------------------------------------------------
-
void ScTabPageSortFields::FillFieldLists( sal_uInt16 nStartField )
{
if ( pViewData )
@@ -391,8 +345,8 @@ void ScTabPageSortFields::FillFieldLists( sal_uInt16 nStartField )
{
for ( sal_uInt16 i=nStartField; i<nSortKeyCount; i++ )
{
- aLbSortArr[i] -> Clear();
- aLbSortArr[i] -> InsertEntry( aStrUndefined, 0 );
+ mpSortKeyDlg[i] -> ClearListBox();
+ mpSortKeyDlg[i] -> InsertEntryListBox( aStrUndefined, 0 );
}
SCCOL nFirstSortCol = rSortData.nCol1;
@@ -418,7 +372,7 @@ void ScTabPageSortFields::FillFieldLists( sal_uInt16 nStartField )
nFieldArr.push_back( col );
for ( sal_uInt16 j=nStartField; j<nSortKeyCount; j++ )
- aLbSortArr[j] -> InsertEntry( aFieldName, i );
+ mpSortKeyDlg[j] -> InsertEntryListBox( aFieldName, i );
i++;
}
@@ -441,7 +395,7 @@ void ScTabPageSortFields::FillFieldLists( sal_uInt16 nStartField )
nFieldArr.push_back( row );
for ( sal_uInt16 j=nStartField; j<nSortKeyCount; j++ )
- aLbSortArr[j] -> InsertEntry( aFieldName, i );
+ mpSortKeyDlg[j] -> InsertEntryListBox( aFieldName, i );
i++;
}
@@ -476,33 +430,33 @@ sal_uInt16 ScTabPageSortFields::GetFieldSelPos( SCCOLROW nField )
IMPL_LINK( ScTabPageSortFields, SelectHdl, ListBox *, pLb )
{
- String aSelEntry = pLb->GetSelectEntry();
- sal_uInt16 nPos = 0;
-
- // Find selected listbox
- while ( pLb != aLbSortArr[nPos] )
- ++nPos;
-
- // If not selecting the last Listbox modify the succeeding ones
- ++nPos;
- if ( nPos < nSortKeyCount )
- {
- if ( aSelEntry == aStrUndefined )
- {
- for ( sal_uInt16 i=nPos; i<nSortKeyCount; i++ )
- {
- aLbSortArr[i] -> SelectEntryPos( 0 );
-
- if ( aFlArr[i] -> IsEnabled() )
- DisableField( i );
- }
- }
- else
- {
- if ( !aFlArr[nPos] -> IsEnabled() )
- EnableField( nPos );
- }
- }
+// String aSelEntry = pLb->GetSelectEntry();
+// sal_uInt16 nPos = 0;
+//
+// // Find selected listbox
+// while ( pLb != aLbSortArr[nPos] )
+// ++nPos;
+//
+// // If not selecting the last Listbox modify the succeeding ones
+// ++nPos;
+// if ( nPos < nSortKeyCount )
+// {
+// if ( aSelEntry == aStrUndefined )
+// {
+// for ( sal_uInt16 i=nPos; i<nSortKeyCount; i++ )
+// {
+// aLbSortArr[i] -> SelectEntryPos( 0 );
+//
+// if ( aFlArr[i] -> IsEnabled() )
+// DisableField( i );
+// }
+// }
+// else
+// {
+// if ( !aFlArr[nPos] -> IsEnabled() )
+// EnableField( nPos );
+// }
+// }
return 0;
}
diff --git a/sc/source/ui/inc/sortdlg.hrc b/sc/source/ui/inc/sortdlg.hrc
index f583dd3d..9bb0d62 100644
--- a/sc/source/ui/inc/sortdlg.hrc
+++ b/sc/source/ui/inc/sortdlg.hrc
@@ -38,18 +38,7 @@
#define TP_OPTIONS 2
// TP_SORT_FIELDS:
-#define FL_SORT1 1
-#define FL_SORT2 2
-#define FL_SORT3 3
-#define LB_SORT1 4
-#define LB_SORT2 5
-#define LB_SORT3 6
-#define BTN_UP1 7
-#define BTN_UP2 8
-#define BTN_UP3 9
-#define BTN_DOWN1 10
-#define BTN_DOWN2 11
-#define BTN_DOWN3 12
+#define CTRL_MANAGESORTKEY 1
// TP_SORT_OPTIONS:
#define FL_DIRECTION 1
diff --git a/sc/source/ui/inc/sortkeydlg.hrc b/sc/source/ui/inc/sortkeydlg.hrc
new file mode 100644
index 0000000..de9ab91
--- /dev/null
+++ b/sc/source/ui/inc/sortkeydlg.hrc
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Albert Thuswaldner <albert.thuswaldner@gmail.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include "sc.hrc" // -> RID_SCDLG_SORTKEY
+ // -> SCSTR_NONAME
+ // -> SCSTR_UNDEFINED
+ // -> SCSTR_FIELD
+
+#define SORT_KEY_FIELDS 1
+
+// SORT_KEY_FIELDS:
+#define FL_SORT 14
+#define LB_SORT 15
+#define BTN_UP 16
+#define BTN_DOWN 17
diff --git a/sc/source/ui/inc/sortkeydlg.hxx b/sc/source/ui/inc/sortkeydlg.hxx
new file mode 100644
index 0000000..a05e022
--- /dev/null
+++ b/sc/source/ui/inc/sortkeydlg.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Albert Thuswaldner <albert.thuswaldner@gmail.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#ifndef SC_SORTKEYDLG_HXX
+#define SC_SORTKEYDLG_HXX
+
+#include "anyrefdg.hxx"
+#include "sortkeydlg.hrc"
+
+#include <vcl/edit.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/ctrl.hxx>
+#include <svtools/stdctrl.hxx>
+#include <svx/langbox.hxx>
+
+
+class ScSortKeyCtrl : public Control
+{
+public:
+ ScSortKeyCtrl(Window* pParent, const ScResId& rResId):
+ Control( pParent, rResId) {}
+};
+
+
+class ScSortKeyDlg : public ModelessDialog
+{
+private:
+ FixedLine aFlSort;
+ ListBox aLbSort;
+ RadioButton aBtnUp;
+ RadioButton aBtnDown;
+
+ void Init();
+ void SetSortKeyNumberString();
+public:
+ static sal_uInt16 aSortKeyNumber;
+
+ ScSortKeyDlg(Window* pParent);
+ ~ScSortKeyDlg();
+
+ void ClearListBox();
+ void InsertEntryListBox( String aFieldName, sal_uInt16 nPos );
+ String GetSelectedEntryListBox( ListBox* pLb );
+ void SelectEntryPosListBox( sal_uInt16 nPos );
+ sal_uInt16 GetSelectEntryPosListBox();
+ sal_uInt16 GetEntryCountListBox();
+
+ void CheckButtonDown();
+ void CheckButtonUp();
+ bool IsCheckedButtonUp();
+
+ void DisableField();
+ void EnableField();
+};
+
+#endif // SC_SORTKEYDLG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/tpsort.hxx b/sc/source/ui/inc/tpsort.hxx
index 2a447cb..fa29694 100644
--- a/sc/source/ui/inc/tpsort.hxx
+++ b/sc/source/ui/inc/tpsort.hxx
@@ -38,6 +38,7 @@
#include <svtools/stdctrl.hxx>
#include <svx/langbox.hxx>
+#include "sortkeydlg.hxx"
#include "global.hxx"
#include "address.hxx"
@@ -76,21 +77,6 @@ protected:
virtual int DeactivatePage ( SfxItemSet* pSet = 0);
private:
- FixedLine aFlSort1;
- ListBox aLbSort1;
- RadioButton aBtnUp1;
- RadioButton aBtnDown1;
-
- FixedLine aFlSort2;
- ListBox aLbSort2;
- RadioButton aBtnUp2;
- RadioButton aBtnDown2;
-
- FixedLine aFlSort3;
- ListBox aLbSort3;
- RadioButton aBtnUp3;
- RadioButton aBtnDown3;
-
String aStrUndefined;
String aStrColumn;
String aStrRow;
@@ -110,16 +96,12 @@ private:
sal_Bool bHasHeader;
sal_Bool bSortByRows;
- std::vector<ListBox*> aLbSortArr;
- std::vector<RadioButton*> aBtnUp;
- std::vector<RadioButton*> aBtnDown;
- std::vector<FixedLine*> aFlArr;
+ ScSortKeyCtrl maSortKeyCtrl;
+ std::vector<ScSortKeyDlg*> mpSortKeyDlg;
#ifdef _TPSORT_CXX
private:
void Init ();
- void DisableField ( sal_uInt16 nField );
- void EnableField ( sal_uInt16 nField );
void FillFieldLists ( sal_uInt16 nStartField );
sal_uInt16 GetFieldSelPos ( SCCOLROW nField );
diff --git a/sc/source/ui/src/sortdlg.src b/sc/source/ui/src/sortdlg.src
index 466ab7a..ff0805f 100644
--- a/sc/source/ui/src/sortdlg.src
+++ b/sc/source/ui/src/sortdlg.src
@@ -32,98 +32,12 @@ TabPage RID_SCPAGE_SORT_FIELDS
SVLook = TRUE ;
HelpId = HID_SCPAGE_SORT_FIELDS ;
Size = MAP_APPFONT ( 260 , 185 ) ;
- ListBox LB_SORT1
+ Control CTRL_MANAGESORTKEY
{
- HelpID = "sc:ListBox:RID_SCPAGE_SORT_FIELDS:LB_SORT1";
- Border = TRUE ;
- Pos = MAP_APPFONT ( 12 , 19 ) ;
- Size = MAP_APPFONT ( 154 , 90 ) ;
- TabStop = TRUE ;
- DropDown = TRUE ;
- };
- RadioButton BTN_UP1
- {
- HelpID = "sc:RadioButton:RID_SCPAGE_SORT_FIELDS:BTN_UP1";
- Pos = MAP_APPFONT ( 172 , 14 ) ;
- Size = MAP_APPFONT ( 79 , 10 ) ;
- Text [ en-US ] = "~Ascending" ;
- TabStop = TRUE ;
- };
- RadioButton BTN_DOWN1
- {
- HelpID = "sc:RadioButton:RID_SCPAGE_SORT_FIELDS:BTN_DOWN1";
- Pos = MAP_APPFONT ( 172 , 28 ) ;
- Size = MAP_APPFONT ( 79 , 10 ) ;
- Text [ en-US ] = "~Descending" ;
- TabStop = TRUE ;
- };
- FixedLine FL_SORT1
- {
- Pos = MAP_APPFONT ( 6 , 3 ) ;
- Size = MAP_APPFONT ( 248 , 8 ) ;
- Text [ en-US ] = "Sort ~key 1" ;
- };
- ListBox LB_SORT2
- {
- HelpID = "sc:ListBox:RID_SCPAGE_SORT_FIELDS:LB_SORT2";
- Border = TRUE ;
- Pos = MAP_APPFONT ( 12 , 60 ) ;
- Size = MAP_APPFONT ( 154 , 90 ) ;
- TabStop = TRUE ;
- DropDown = TRUE ;
- };
- RadioButton BTN_UP2
- {
- HelpID = "sc:RadioButton:RID_SCPAGE_SORT_FIELDS:BTN_UP2";
- Pos = MAP_APPFONT ( 172 , 55 ) ;
- Size = MAP_APPFONT ( 79 , 10 ) ;
- Text [ en-US ] = "A~scending" ;
- TabStop = TRUE ;
- };
- RadioButton BTN_DOWN2
- {
- HelpID = "sc:RadioButton:RID_SCPAGE_SORT_FIELDS:BTN_DOWN2";
- Pos = MAP_APPFONT ( 172 , 69 ) ;
- Size = MAP_APPFONT ( 79 , 10 ) ;
- Text [ en-US ] = "D~escending" ;
- TabStop = TRUE ;
- };
- FixedLine FL_SORT2
- {
- Pos = MAP_APPFONT ( 6 , 44 ) ;
- Size = MAP_APPFONT ( 248 , 8 ) ;
- Text [ en-US ] = "Sort ~key 2" ;
- };
- ListBox LB_SORT3
- {
- HelpID = "sc:ListBox:RID_SCPAGE_SORT_FIELDS:LB_SORT3";
- Border = TRUE ;
- Pos = MAP_APPFONT ( 12 , 101 ) ;
- Size = MAP_APPFONT ( 154 , 90 ) ;
- TabStop = TRUE ;
- DropDown = TRUE ;
- };
- RadioButton BTN_UP3
- {
- HelpID = "sc:RadioButton:RID_SCPAGE_SORT_FIELDS:BTN_UP3";
- Pos = MAP_APPFONT ( 172 , 96 ) ;
- Size = MAP_APPFONT ( 79 , 10 ) ;
- Text [ en-US ] = "As~cending" ;
- TabStop = TRUE ;
- };
- RadioButton BTN_DOWN3
- {
- HelpID = "sc:RadioButton:RID_SCPAGE_SORT_FIELDS:BTN_DOWN3";
- Pos = MAP_APPFONT ( 172 , 110 ) ;
- Size = MAP_APPFONT ( 79 , 10 ) ;
- Text [ en-US ] = "Desce~nding" ;
- TabStop = TRUE ;
- };
- FixedLine FL_SORT3
- {
- Pos = MAP_APPFONT ( 6 , 85 ) ;
- Size = MAP_APPFONT ( 248 , 8 ) ;
- Text [ en-US ] = "Sort ~key 3" ;
+ Pos = MAP_APPFONT( 5, 5 );
+ Size = MAP_APPFONT( 250, 189 );
+ Border = TRUE;
+ DialogControl = TRUE;
};
};
diff --git a/sc/source/ui/src/sortkeydlg.src b/sc/source/ui/src/sortkeydlg.src
new file mode 100644
index 0000000..adc1584
--- /dev/null
+++ b/sc/source/ui/src/sortkeydlg.src
@@ -0,0 +1,67 @@
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Albert Thuswaldner <albert.thuswaldner@gmail.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include "sortkeydlg.hrc"
+
+ModelessDialog RID_SCPAGE_SORTKEY_FIELDS
+{
+ Hide = FALSE ;
+ SVLook = TRUE ;
+ HelpId = HID_SCPAGE_SORTKEY_FIELDS ;
+ Size = MAP_APPFONT ( 250 , 41 ) ;
+ ListBox LB_SORT
+ {
+ HelpID = "sc:ListBox:RID_SCPAGE_SORTKEY_FIELDS:LB_SORT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 19 ) ;
+ Size = MAP_APPFONT ( 154 , 90 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ RadioButton BTN_UP
+ {
+ HelpID = "sc:RadioButton:RID_SCPAGE_SORTKEY_FIELDS:BTN_UP";
+ Pos = MAP_APPFONT ( 172 , 14 ) ;
+ Size = MAP_APPFONT ( 79 , 10 ) ;
+ Text [ en-US ] = "~Ascending" ;
+ TabStop = TRUE ;
+ };
+ RadioButton BTN_DOWN
+ {
+ HelpID = "sc:RadioButton:RID_SCPAGE_SORTKEY_FIELDS:BTN_DOWN";
+ Pos = MAP_APPFONT ( 172 , 28 ) ;
+ Size = MAP_APPFONT ( 79 , 10 ) ;
+ Text [ en-US ] = "~Descending" ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_SORT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Sort ~key " ;
+ };
+};
diff --git a/toolkit/src2xml/src-sc.lst b/toolkit/src2xml/src-sc.lst
index bb2417d..3ae8ec4 100644
--- a/toolkit/src2xml/src-sc.lst
+++ b/toolkit/src2xml/src-sc.lst
@@ -12,6 +12,7 @@
../../sc/source/ui/src/opredlin.src
../../sc/source/ui/src/namedlg.src
../../sc/source/ui/src/sortdlg.src
+../../sc/source/ui/src/sortkeydlg.src
../../sc/source/ui/src/textdlgs.src
../../sc/source/ui/src/optdlg.src
../../sc/source/ui/src/scwarngs.src
diff --git a/toolkit/src2xml/src.lst b/toolkit/src2xml/src.lst
index d0aad01..182d796 100644
--- a/toolkit/src2xml/src.lst
+++ b/toolkit/src2xml/src.lst
@@ -12,6 +12,7 @@
../../sc/source/ui/src/opredlin.src
../../sc/source/ui/src/namedlg.src
../../sc/source/ui/src/sortdlg.src
+../../sc/source/ui/src/sortkeydlg.src
../../sc/source/ui/src/textdlgs.src
../../sc/source/ui/src/optdlg.src
../../sc/source/ui/src/scwarngs.src
--
1.7.3.4
Context
- [PATCH] [WIP] fdo#45747 - [EasyHack] remove the limitation to 3 sort entries in calc, part 2 · Albert Thuswaldner
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.