summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorTomaž Vajngerl <quikee@gmail.com>2013-07-16 19:02:47 +0200
committerTomaž Vajngerl <quikee@gmail.com>2013-07-19 16:57:36 +0200
commitd2734a6ae65dc655787ba5a48d1fb5f44905a937 (patch)
treebfcbf259ea4af49fd5d699fdbf27676932a090b1 /sc
parentb1949c08bb32a30d28a4bc154fd43a003b1be307 (diff)
Cleanup RNG class & .ui
Change-Id: Ic43e2d7928765900bce109f25dd4dc6e2adf8c5a
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx82
-rw-r--r--sc/source/ui/inc/RandomNumberGeneratorDialog.hxx8
-rw-r--r--sc/uiconfig/scalc/ui/randomnumbergenerator.ui14
3 files changed, 41 insertions, 63 deletions
diff --git a/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx b/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx
index cc060412837c..06e02f5707af 100644
--- a/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx
@@ -65,11 +65,11 @@ ScRandomNumberGeneratorDialog::ScRandomNumberGeneratorDialog(
mAddressDetails ( mDocument->GetAddressConvention(), 0, 0 ),
mDialogLostFocus( false )
{
- get(mpFtVariableCell, "cell-range-label");
- get(mpEdVariableCell, "cell-range-edit");
- mpEdVariableCell->SetReferences(this, mpFtVariableCell);
- get(mpRBVariableCell, "cell-range-button");
- mpRBVariableCell->SetReferences(this, mpEdVariableCell);
+ get(mpInputRangeText, "cell-range-label");
+ get(mpInputRangeEdit, "cell-range-edit");
+ mpInputRangeEdit->SetReferences(this, mpInputRangeText);
+ get(mpInputRangeButton, "cell-range-button");
+ mpInputRangeButton->SetReferences(this, mpInputRangeEdit);
get(mpButtonOk, "ok");
get(mpButtonApply, "apply");
@@ -96,12 +96,12 @@ void ScRandomNumberGeneratorDialog::Init()
mpButtonApply->SetClickHdl( LINK( this, ScRandomNumberGeneratorDialog, ApplyClicked ) );
Link aLink = LINK( this, ScRandomNumberGeneratorDialog, GetFocusHandler );
- mpEdVariableCell->SetGetFocusHdl( aLink );
- mpRBVariableCell->SetGetFocusHdl( aLink );
+ mpInputRangeEdit->SetGetFocusHdl( aLink );
+ mpInputRangeButton->SetGetFocusHdl( aLink );
aLink = LINK( this, ScRandomNumberGeneratorDialog, LoseFocusHandler );
- mpEdVariableCell->SetLoseFocusHdl ( aLink );
- mpRBVariableCell->SetLoseFocusHdl ( aLink );
+ mpInputRangeEdit->SetLoseFocusHdl ( aLink );
+ mpInputRangeButton->SetLoseFocusHdl ( aLink );
mpParameter1Value->SetModifyHdl( LINK( this, ScRandomNumberGeneratorDialog, Parameter1ValueModified ));
mpParameter2Value->SetModifyHdl( LINK( this, ScRandomNumberGeneratorDialog, Parameter2ValueModified ));
@@ -110,49 +110,28 @@ void ScRandomNumberGeneratorDialog::Init()
mpEnableSeed->SetToggleHdl( LINK( this, ScRandomNumberGeneratorDialog, SeedCheckChanged ));
- mpParameter1Value->SetMin( SAL_MIN_INT64 );
- mpParameter1Value->SetMax( SAL_MAX_INT64 );
- mpParameter2Value->SetMin( SAL_MIN_INT64 );
- mpParameter2Value->SetMax( SAL_MAX_INT64 );
-
DistributionChanged(NULL);
SeedCheckChanged(NULL);
}
void ScRandomNumberGeneratorDialog::GetRangeFromSelection()
{
- String aCurrentString;
-
- SCCOL nStartCol = 0;
- SCROW nStartRow = 0;
- SCTAB nStartTab = 0;
- SCCOL nEndCol = 0;
- SCROW nEndRow = 0;
- SCTAB nEndTab = 0;
-
- mViewData->GetSimpleArea( nStartCol, nStartRow, nStartTab,
- nEndCol, nEndRow, nEndTab );
-
- mCurrentRange = ScRange( ScAddress( nStartCol, nStartRow, nStartTab ),
- ScAddress( nEndCol, nEndRow, nEndTab ) );
-
- mCurrentRange.Format( aCurrentString, ABS_DREF3D, mDocument, mAddressDetails );
-
- mpEdVariableCell->SetText( aCurrentString );
+ OUString aCurrentString;
+ mViewData->GetSimpleArea(mInputRange);
+ mInputRange.Format( aCurrentString, ABS_DREF3D, mDocument, mAddressDetails );
+ mpInputRangeEdit->SetText( aCurrentString );
}
-
ScRandomNumberGeneratorDialog::~ScRandomNumberGeneratorDialog()
-{
-}
+{}
void ScRandomNumberGeneratorDialog::SetActive()
{
if ( mDialogLostFocus )
{
mDialogLostFocus = false;
- if( mpEdVariableCell )
- mpEdVariableCell->GrabFocus();
+ if( mpInputRangeEdit )
+ mpInputRangeEdit->GrabFocus();
}
else
{
@@ -168,16 +147,16 @@ sal_Bool ScRandomNumberGeneratorDialog::Close()
void ScRandomNumberGeneratorDialog::SetReference( const ScRange& rReferenceRange, ScDocument* pDocument )
{
- if ( mpEdVariableCell->IsEnabled() )
+ if ( mpInputRangeEdit->IsEnabled() )
{
if ( rReferenceRange.aStart != rReferenceRange.aEnd )
- RefInputStart( mpEdVariableCell );
+ RefInputStart( mpInputRangeEdit );
- mCurrentRange = rReferenceRange;
+ mInputRange = rReferenceRange;
String aReferenceString;
- mCurrentRange.Format( aReferenceString, ABS_DREF3D, pDocument, mAddressDetails );
- mpEdVariableCell->SetRefString( aReferenceString );
+ mInputRange.Format( aReferenceString, ABS_DREF3D, pDocument, mAddressDetails );
+ mpInputRangeEdit->SetRefString( aReferenceString );
}
}
@@ -285,12 +264,12 @@ void ScRandomNumberGeneratorDialog::GenerateNumbers(RNG randomGenerator, OUStrin
svl::IUndoManager* pUndoManager = pDocShell->GetUndoManager();
pUndoManager->EnterListAction( aUndo, aUndo );
- SCROW nRowStart = mCurrentRange.aStart.Row();
- SCROW nRowEnd = mCurrentRange.aEnd.Row();
- SCCOL nColStart = mCurrentRange.aStart.Col();
- SCCOL nColEnd = mCurrentRange.aEnd.Col();
- SCTAB nTabStart = mCurrentRange.aStart.Tab();
- SCTAB nTabEnd = mCurrentRange.aEnd.Tab();
+ SCROW nRowStart = mInputRange.aStart.Row();
+ SCROW nRowEnd = mInputRange.aEnd.Row();
+ SCCOL nColStart = mInputRange.aStart.Col();
+ SCCOL nColEnd = mInputRange.aEnd.Col();
+ SCTAB nTabStart = mInputRange.aStart.Tab();
+ SCTAB nTabEnd = mInputRange.aEnd.Tab();
for (SCROW nTab = nTabStart; nTab <= nTabEnd; nTab++)
{
@@ -305,7 +284,7 @@ void ScRandomNumberGeneratorDialog::GenerateNumbers(RNG randomGenerator, OUStrin
pUndoManager->LeaveListAction();
- pDocShell->PostPaint( mCurrentRange, PAINT_GRID );
+ pDocShell->PostPaint( mInputRange, PAINT_GRID );
}
IMPL_LINK( ScRandomNumberGeneratorDialog, OkClicked, PushButton*, /*pButton*/ )
@@ -332,8 +311,8 @@ IMPL_LINK( ScRandomNumberGeneratorDialog, GetFocusHandler, Control*, pCtrl )
{
Edit* pEdit = NULL;
- if( (pCtrl == (Control*)mpEdVariableCell) || (pCtrl == (Control*)mpRBVariableCell) )
- pEdit = mpEdVariableCell;
+ if( (pCtrl == (Control*) mpInputRangeEdit) || (pCtrl == (Control*) mpInputRangeButton) )
+ pEdit = mpInputRangeEdit;
if( pEdit )
pEdit->SetSelection( Selection( 0, SELECTION_MAX ) );
@@ -484,5 +463,4 @@ IMPL_LINK_NOARG(ScRandomNumberGeneratorDialog, DistributionChanged)
return 0;
}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/RandomNumberGeneratorDialog.hxx b/sc/source/ui/inc/RandomNumberGeneratorDialog.hxx
index 1f5ea8018bc9..cb438c840803 100644
--- a/sc/source/ui/inc/RandomNumberGeneratorDialog.hxx
+++ b/sc/source/ui/inc/RandomNumberGeneratorDialog.hxx
@@ -35,9 +35,9 @@ public:
private:
// Widgets
- FixedText* mpFtVariableCell;
- formula::RefEdit* mpEdVariableCell;
- formula::RefButton* mpRBVariableCell;
+ FixedText* mpInputRangeText;
+ formula::RefEdit* mpInputRangeEdit;
+ formula::RefButton* mpInputRangeButton;
ListBox* mpDistributionCombo;
FixedText* mpParameter1Text;
NumericField* mpParameter1Value;
@@ -53,7 +53,7 @@ private:
ScViewData* mViewData;
ScDocument* mDocument;
- ScRange mCurrentRange;
+ ScRange mInputRange;
ScAddress::Details mAddressDetails;
bool mDialogLostFocus;
diff --git a/sc/uiconfig/scalc/ui/randomnumbergenerator.ui b/sc/uiconfig/scalc/ui/randomnumbergenerator.ui
index 25ec1436617e..3967197a806c 100644
--- a/sc/uiconfig/scalc/ui/randomnumbergenerator.ui
+++ b/sc/uiconfig/scalc/ui/randomnumbergenerator.ui
@@ -2,12 +2,6 @@
<interface>
<!-- interface-requires gtk+ 3.0 -->
<!-- interface-requires LibreOffice 1.0 -->
- <object class="GtkAdjustment" id="parameter1-adjustment">
- <property name="upper">100</property>
- <property name="value">1</property>
- <property name="step_increment">1</property>
- <property name="page_increment">10</property>
- </object>
<object class="GtkDialog" id="RandomNumberGeneratorDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
@@ -289,7 +283,7 @@
</object>
</child>
<child type="label">
- <object class="GtkLabel" id="label1">
+ <object class="GtkLabel" id="parameters-section-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Parameters</property>
@@ -397,6 +391,12 @@
</row>
</data>
</object>
+ <object class="GtkAdjustment" id="parameter1-adjustment">
+ <property name="upper">100</property>
+ <property name="value">1</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
<object class="GtkAdjustment" id="parameter2-adjustment">
<property name="upper">100</property>
<property name="step_increment">1</property>