Kaydet (Commit) d933a10c authored tarafından Katarina Behrens's avatar Katarina Behrens

Converted data bar options dialog to .ui

all right this time

Change-Id: I9168df3cd83cfa910e4a189b5330a28ad85773ac
üst b669e312
......@@ -53,7 +53,6 @@ $(eval $(call gb_SrsTarget_add_files,sc/res,\
sc/source/ui/src/scstring.src \
sc/source/ui/src/sortdlg.src \
sc/source/ui/src/filter.src \
sc/source/ui/src/colorformat.src \
sc/source/ui/src/condformatdlg.src \
sc/source/ui/src/condformatmgr.src \
sc/source/ui/src/xmlsourcedlg.src \
......
......@@ -29,6 +29,7 @@ $(eval $(call gb_UIConfig_add_toolbarfiles,modules/scalc,\
sc/uiconfig/scalc/toolbar/basicshapes \
sc/uiconfig/scalc/toolbar/calloutshapes \
sc/uiconfig/scalc/toolbar/colorbar \
sc/uiconfig/scalc/toolbar/databaroptions \
sc/uiconfig/scalc/toolbar/datastreams \
sc/uiconfig/scalc/toolbar/drawbar \
sc/uiconfig/scalc/toolbar/drawobjectbar \
......
......@@ -10,8 +10,8 @@
#include "colorformat.hxx"
#include "colorscale.hxx"
#include "colorformat.hrc"
#include "document.hxx"
#include "sc.hrc"
#include <svx/xtable.hxx>
#include <svx/drawitem.hxx>
......@@ -61,55 +61,47 @@ void SetValue( ScColorScaleEntry* pEntry, Edit& aEdit)
}
ScDataBarSettingsDlg::ScDataBarSettingsDlg(Window* pWindow, const ScDataBarFormatData& rData, ScDocument* pDoc, const ScAddress& rPos):
ModalDialog( pWindow, ScResId( RID_SCDLG_DATABAR ) ),
maBtnOk( this, ScResId( BTN_OK ) ),
maBtnCancel( this, ScResId( BTN_CANCEL ) ),
maFlBarColors( this, ScResId( FL_BAR_COLORS ) ),
maFlAxes( this, ScResId( FL_AXIS ) ),
maFlValues( this, ScResId( FL_VALUES ) ),
maFtMin( this, ScResId( FT_MINIMUM ) ),
maFtMax( this, ScResId( FT_MAXIMUM ) ),
maFtPositive( this, ScResId( FT_POSITIVE ) ),
maFtNegative( this, ScResId( FT_NEGATIVE ) ),
maFtPosition( this, ScResId( FT_POSITION ) ),
maFtAxisColor( this, ScResId( FT_COLOR_AXIS ) ),
maLbPos( this, ScResId( LB_POS ) ),
maLbNeg( this, ScResId( LB_NEG ) ),
maLbAxisCol( this, ScResId( LB_COL_AXIS ) ),
maLbTypeMin( this, ScResId( LB_TYPE ) ),
maLbTypeMax( this, ScResId( LB_TYPE ) ),
maLbAxisPos( this, ScResId( LB_AXIS_POSITION ) ),
maEdMin( this, ScResId( ED_MIN ) ),
maEdMax( this, ScResId( ED_MAX ) ),
maStrWarnSameValue( SC_RESSTR( STR_WARN_SAME_VALUE ) ),
ModalDialog( pWindow, "DataBarOptions", "modules/scalc/ui/databaroptions.ui" ),
mpNumberFormatter( pDoc->GetFormatTable() ),
mpDoc(pDoc),
maPos(rPos)
{
get( mpBtnOk, "ok");
get( mpBtnCancel, "cancel" );
get( mpLbPos, "positive_colour" );
get( mpLbNeg, "negative_colour" );
get( mpLbTypeMin, "min" );
get( mpLbTypeMax, "max" );
get( mpLbAxisPos, "axis_pos" );
get( mpLbAxisCol, "axis_colour" );
get( mpEdMin, "min_value" );
get( mpEdMax, "max_value" );
maStrWarnSameValue = get<FixedText>("str_same_value")->GetText();
Init();
FreeResource();
maLbPos.SelectEntry( rData.maPositiveColor );
mpLbPos->SelectEntry( rData.maPositiveColor );
if(rData.mpNegativeColor)
maLbNeg.SelectEntry( *rData.mpNegativeColor );
mpLbNeg->SelectEntry( *rData.mpNegativeColor );
switch (rData.meAxisPosition)
{
case databar::NONE:
maLbAxisPos.SelectEntryPos(2);
mpLbAxisPos->SelectEntryPos(2);
break;
case databar::AUTOMATIC:
maLbAxisPos.SelectEntryPos(0);
mpLbAxisPos->SelectEntryPos(0);
break;
case databar::MIDDLE:
maLbAxisPos.SelectEntryPos(1);
mpLbAxisPos->SelectEntryPos(1);
break;
}
::SetType(rData.mpLowerLimit.get(), maLbTypeMin);
::SetType(rData.mpUpperLimit.get(), maLbTypeMax);
SetValue(rData.mpLowerLimit.get(), maEdMin);
SetValue(rData.mpUpperLimit.get(), maEdMax);
maLbAxisCol.SelectEntry(rData.maAxisColor);
::SetType(rData.mpLowerLimit.get(), *mpLbTypeMin);
::SetType(rData.mpUpperLimit.get(), *mpLbTypeMax);
SetValue(rData.mpLowerLimit.get(), *mpEdMin);
SetValue(rData.mpUpperLimit.get(), *mpEdMax);
mpLbAxisCol->SelectEntry(rData.maAxisColor);
TypeSelectHdl(NULL);
}
......@@ -130,43 +122,40 @@ void ScDataBarSettingsDlg::Init()
if ( pColorTable.is() )
{
// filling the line color box
maLbPos.SetUpdateMode( false );
maLbNeg.SetUpdateMode( false );
maLbAxisCol.SetUpdateMode( false );
mpLbPos->SetUpdateMode( false );
mpLbNeg->SetUpdateMode( false );
mpLbAxisCol->SetUpdateMode( false );
for ( long i = 0; i < pColorTable->Count(); ++i )
{
XColorEntry* pEntry = pColorTable->GetColor(i);
maLbPos.InsertEntry( pEntry->GetColor(), pEntry->GetName() );
maLbNeg.InsertEntry( pEntry->GetColor(), pEntry->GetName() );
maLbAxisCol.InsertEntry( pEntry->GetColor(), pEntry->GetName() );
mpLbPos->InsertEntry( pEntry->GetColor(), pEntry->GetName() );
mpLbNeg->InsertEntry( pEntry->GetColor(), pEntry->GetName() );
mpLbAxisCol->InsertEntry( pEntry->GetColor(), pEntry->GetName() );
if(pEntry->GetColor() == Color(COL_LIGHTRED))
maLbNeg.SelectEntryPos(i);
mpLbNeg->SelectEntryPos(i);
if(pEntry->GetColor() == Color(COL_BLACK))
maLbAxisCol.SelectEntryPos(i);
mpLbAxisCol->SelectEntryPos(i);
if(pEntry->GetColor() == Color(COL_LIGHTBLUE))
maLbPos.SelectEntryPos(i);
mpLbPos->SelectEntryPos(i);
}
maLbPos.SetUpdateMode( sal_True );
maLbNeg.SetUpdateMode( sal_True );
maLbAxisCol.SetUpdateMode( sal_True );
mpLbPos->SetUpdateMode( sal_True );
mpLbNeg->SetUpdateMode( sal_True );
mpLbAxisCol->SetUpdateMode( sal_True );
}
maBtnOk.SetClickHdl( LINK( this, ScDataBarSettingsDlg, OkBtnHdl ) );
Point aPoint(maLbTypeMax.GetPosPixel().X(), maFtMax.GetPosPixel().Y());
maLbTypeMax.SetPosPixel(aPoint);
mpBtnOk->SetClickHdl( LINK( this, ScDataBarSettingsDlg, OkBtnHdl ) );
maLbTypeMin.SetSelectHdl( LINK( this, ScDataBarSettingsDlg, TypeSelectHdl ) );
maLbTypeMax.SetSelectHdl( LINK( this, ScDataBarSettingsDlg, TypeSelectHdl ) );
mpLbTypeMin->SetSelectHdl( LINK( this, ScDataBarSettingsDlg, TypeSelectHdl ) );
mpLbTypeMax->SetSelectHdl( LINK( this, ScDataBarSettingsDlg, TypeSelectHdl ) );
}
namespace {
void GetAxesPosition(ScDataBarFormatData* pData, const ListBox& rLbox)
void GetAxesPosition(ScDataBarFormatData* pData, const ListBox* rLbox)
{
switch(rLbox.GetSelectEntryPos())
switch(rLbox->GetSelectEntryPos())
{
case 0:
pData->meAxisPosition = databar::AUTOMATIC;
......@@ -185,16 +174,16 @@ void GetAxesPosition(ScDataBarFormatData* pData, const ListBox& rLbox)
ScDataBarFormatData* ScDataBarSettingsDlg::GetData()
{
ScDataBarFormatData* pData = new ScDataBarFormatData();
pData->maPositiveColor = maLbPos.GetSelectEntryColor();
pData->mpNegativeColor.reset(new Color(maLbNeg.GetSelectEntryColor()));
pData->maPositiveColor = mpLbPos->GetSelectEntryColor();
pData->mpNegativeColor.reset(new Color(mpLbNeg->GetSelectEntryColor()));
pData->mbGradient = true; //FIXME
pData->mpUpperLimit.reset(new ScColorScaleEntry());
pData->mpLowerLimit.reset(new ScColorScaleEntry());
pData->maAxisColor = maLbAxisCol.GetSelectEntryColor();
pData->maAxisColor = mpLbAxisCol->GetSelectEntryColor();
::GetType(maLbTypeMin, maEdMin, pData->mpLowerLimit.get(), mpNumberFormatter, mpDoc, maPos);
::GetType(maLbTypeMax, maEdMax, pData->mpUpperLimit.get(), mpNumberFormatter, mpDoc, maPos);
GetAxesPosition(pData, maLbAxisPos);
::GetType(*mpLbTypeMin, *mpEdMin, pData->mpLowerLimit.get(), mpNumberFormatter, mpDoc, maPos);
::GetType(*mpLbTypeMax, *mpEdMax, pData->mpUpperLimit.get(), mpNumberFormatter, mpDoc, maPos);
GetAxesPosition(pData, mpLbAxisPos);
return pData;
}
......@@ -203,20 +192,20 @@ IMPL_LINK_NOARG( ScDataBarSettingsDlg, OkBtnHdl )
{
//check that min < max
bool bWarn = false;
sal_Int32 nSelectMin = maLbTypeMin.GetSelectEntryPos();
sal_Int32 nSelectMin = mpLbTypeMin->GetSelectEntryPos();
if( nSelectMin == COLORSCALE_MAX )
bWarn = true;
sal_Int32 nSelectMax = maLbTypeMax.GetSelectEntryPos();
sal_Int32 nSelectMax = mpLbTypeMax->GetSelectEntryPos();
if( nSelectMax == COLORSCALE_MIN )
bWarn = true;
if(!bWarn && maLbTypeMin.GetSelectEntryPos() == maLbTypeMax.GetSelectEntryPos())
if(!bWarn && mpLbTypeMin->GetSelectEntryPos() == mpLbTypeMax->GetSelectEntryPos())
{
if(nSelectMax != COLORSCALE_FORMULA && nSelectMax != COLORSCALE_AUTO)
{
OUString aMinString = maEdMin.GetText();
OUString aMaxString = maEdMax.GetText();
OUString aMinString = mpEdMin->GetText();
OUString aMaxString = mpEdMax->GetText();
double nMinValue = 0;
sal_uInt32 nIndex = 0;
mpNumberFormatter->IsNumberFormat(aMinString, nIndex, nMinValue);
......@@ -243,33 +232,33 @@ IMPL_LINK_NOARG( ScDataBarSettingsDlg, OkBtnHdl )
IMPL_LINK_NOARG( ScDataBarSettingsDlg, TypeSelectHdl )
{
sal_Int32 nSelectMin = maLbTypeMin.GetSelectEntryPos();
sal_Int32 nSelectMin = mpLbTypeMin->GetSelectEntryPos();
if( nSelectMin <= COLORSCALE_MAX)
maEdMin.Disable();
mpEdMin->Disable();
else
{
maEdMin.Enable();
if(maEdMin.GetText().isEmpty())
mpEdMin->Enable();
if(mpEdMin->GetText().isEmpty())
{
if(nSelectMin == COLORSCALE_PERCENTILE || nSelectMin == COLORSCALE_PERCENT)
maEdMin.SetText(OUString::number(50));
mpEdMin->SetText(OUString::number(50));
else
maEdMin.SetText(OUString::number(0));
mpEdMin->SetText(OUString::number(0));
}
}
sal_Int32 nSelectMax = maLbTypeMax.GetSelectEntryPos();
sal_Int32 nSelectMax = mpLbTypeMax->GetSelectEntryPos();
if(nSelectMax <= COLORSCALE_MAX)
maEdMax.Disable();
mpEdMax->Disable();
else
{
maEdMax.Enable();
if(maEdMax.GetText().isEmpty())
mpEdMax->Enable();
if(mpEdMax->GetText().isEmpty())
{
if(nSelectMax == COLORSCALE_PERCENTILE || nSelectMax == COLORSCALE_PERCENT)
maEdMax.SetText(OUString::number(50));
mpEdMax->SetText(OUString::number(50));
else
maEdMax.SetText(OUString::number(0));
mpEdMax->SetText(OUString::number(0));
}
}
return 0;
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include "sc.hrc"
#define BTN_OK 1
#define BTN_CANCEL 2
#define FL_BAR_COLORS 10
#define FL_AXIS 11
#define FL_VALUES 12
#define FT_MINIMUM 13
#define FT_MAXIMUM 14
#define FT_POSITIVE 15
#define FT_NEGATIVE 16
#define FT_POSITION 17
#define FT_COLOR_AXIS 18
#define LB_POS 19
#define LB_NEG 20
#define LB_COL_AXIS 21
#define LB_TYPE 22
#define LB_AXIS_POSITION 23
#define ED_MIN 24
#define ED_MAX 25
#define STR_WARN_SAME_VALUE 26
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -7,9 +7,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef SC_COLORFORMAT_HXX
#define SC_COLORFORMAT_HXX
#include <vcl/button.hxx>
#include <vcl/dialog.hxx>
#include <vcl/fixed.hxx>
......@@ -23,29 +20,19 @@ class ScDocument;
class ScDataBarSettingsDlg : public ModalDialog
{
private:
OKButton maBtnOk;
CancelButton maBtnCancel;
FixedLine maFlBarColors;
FixedLine maFlAxes;
FixedLine maFlValues;
FixedText maFtMin;
FixedText maFtMax;
FixedText maFtPositive;
FixedText maFtNegative;
FixedText maFtPosition;
FixedText maFtAxisColor;
OKButton* mpBtnOk;
CancelButton* mpBtnCancel;
ColorListBox maLbPos;
ColorListBox maLbNeg;
ColorListBox maLbAxisCol;
ColorListBox* mpLbPos;
ColorListBox* mpLbNeg;
ColorListBox* mpLbAxisCol;
ListBox maLbTypeMin;
ListBox maLbTypeMax;
ListBox maLbAxisPos;
ListBox* mpLbTypeMin;
ListBox* mpLbTypeMax;
ListBox* mpLbAxisPos;
Edit maEdMin;
Edit maEdMax;
Edit* mpEdMin;
Edit* mpEdMax;
OUString maStrWarnSameValue;
SvNumberFormatter* mpNumberFormatter;
......@@ -64,6 +51,4 @@ public:
ScDataBarFormatData* GetData();
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include "colorformat.hrc"
ModalDialog RID_SCDLG_DATABAR
{
OutputSize = TRUE;
Hide = TRUE;
Size = MAP_APPFONT ( 200, 200 );
Text [ en-US ] = "Data Bar";
Moveable = TRUE;
Closeable = TRUE;
OkButton BTN_OK
{
Pos = MAP_APPFONT ( 120, 180 );
Size = MAP_APPFONT ( 30, 14 );
TabStop = TRUE;
};
CancelButton BTN_CANCEL
{
Pos = MAP_APPFONT ( 160, 180 );
Size = MAP_APPFONT ( 30, 14 );
TabStop = TRUE;
};
FixedLine FL_VALUES
{
Pos = MAP_APPFONT( 5, 5 );
Size = MAP_APPFONT( 190, 10 );
Text [ en-US ] = "Entry Values";
};
FixedLine FL_BAR_COLORS
{
Pos = MAP_APPFONT( 5, 60 );
Size = MAP_APPFONT( 190, 10 );
Text [ en-US ] = "Bar Colors";
};
FixedLine FL_AXIS
{
Pos = MAP_APPFONT( 5, 120 );
Size = MAP_APPFONT( 190, 10 );
Text [ en-US ] = "Axis";
};
FixedText FT_MINIMUM
{
Pos = MAP_APPFONT( 10, 20 );
Size = MAP_APPFONT( 50, 14 );
Text [ en-US ] = "Minimum:";
};
FixedText FT_MAXIMUM
{
Pos = MAP_APPFONT( 10, 40 );
Size = MAP_APPFONT( 50, 14 );
Text [ en-US ] = "Maximum:";
};
FixedText FT_POSITIVE
{
Pos = MAP_APPFONT( 10, 75 );
Size = MAP_APPFONT( 50, 14 );
Text [ en-US ] = "Positive:";
};
FixedText FT_NEGATIVE
{
Pos = MAP_APPFONT( 10, 95 );
Size = MAP_APPFONT( 50, 14 );
Text [ en-US ] = "Negative:";
};
FixedText FT_POSITION
{
Pos = MAP_APPFONT( 10, 135 );
Size = MAP_APPFONT( 110, 14 );
Text [ en-US ] = "Position of vertical axis";
};
FixedText FT_COLOR_AXIS
{
Pos = MAP_APPFONT( 10, 155 );
Size = MAP_APPFONT( 110, 14 );
Text [ en-US ] = "Color of vertical axis";
};
ListBox LB_POS
{
Pos = MAP_APPFONT( 80, 75 );
Size = MAP_APPFONT( 60, 50 );
Border = TRUE;
DropDown = TRUE;
DDExtraWidth = TRUE;
};
ListBox LB_NEG
{
Pos = MAP_APPFONT( 80, 95 );
Size = MAP_APPFONT( 60, 50 );
Border = TRUE;
DropDown = TRUE;
DDExtraWidth = TRUE;
};
ListBox LB_COL_AXIS
{
Pos = MAP_APPFONT( 120, 155 );
Size = MAP_APPFONT( 60, 50 );
Border = TRUE;
DropDown = TRUE;
DDExtraWidth = TRUE;
};
ListBox LB_TYPE
{
Pos = MAP_APPFONT( 80, 20 );
Size = MAP_APPFONT( 50, 50 );
Border = TRUE;
DropDown = TRUE;
StringList [ en-US ] =
{
"Automatic";
"Minimum";
"Maximum";
"Percentile";
"Value";
"Percent";
"Formula";
};
};
ListBox LB_AXIS_POSITION
{
Pos = MAP_APPFONT( 120, 135 );
Size = MAP_APPFONT( 50, 50 );
Border = TRUE;
DropDown = TRUE;
StringList [ en-US ] =
{
"Automatic";
"Middle";
"None";
};
};
Edit ED_MIN
{
Pos = MAP_APPFONT( 140, 21 );
Size = MAP_APPFONT( 40, 12 );
TabStop = TRUE;
Border = TRUE;
};
Edit ED_MAX
{
Pos = MAP_APPFONT( 140, 41 );
Size = MAP_APPFONT( 40, 12 );
TabStop = TRUE;
Border = TRUE;
};
String STR_WARN_SAME_VALUE
{
Text [ en-US ] = "Min value must be smaller than max value!";
};
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment