summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-12-29 21:18:05 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-12-29 21:20:39 +0000
commit5b373ef6d718879c359da74b5aeb63e818192f5e (patch)
tree0097aa30c5345cdac281708021cf062c438a17a5 /sc/source/ui
parentebe616de53b98e419c39782c6615877a12f0edc7 (diff)
convert tab background color to .ui
Change-Id: I121d4abd3227b96a274f1983e61ca313728419f7
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/attrdlg/scdlgfact.cxx20
-rw-r--r--sc/source/ui/attrdlg/scdlgfact.hxx3
-rw-r--r--sc/source/ui/inc/miscdlgs.hrc4
-rw-r--r--sc/source/ui/inc/tabbgcolordlg.hxx24
-rw-r--r--sc/source/ui/miscdlgs/tabbgcolordlg.cxx141
-rw-r--r--sc/source/ui/src/miscdlgs.src46
-rw-r--r--sc/source/ui/view/tabvwshf.cxx3
7 files changed, 70 insertions, 171 deletions
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index aa1a9bf7344f..743f9892295b 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -1005,27 +1005,15 @@ AbstractScStringInputDlg * ScAbstractDialogFactory_Impl::CreateScStringInputDlg
return new AbstractScStringInputDlg_Impl( pDlg );
}
-AbstractScTabBgColorDlg * ScAbstractDialogFactory_Impl::CreateScTabBgColorDlg (
+AbstractScTabBgColorDlg * ScAbstractDialogFactory_Impl::CreateScTabBgColorDlg(
Window* pParent,
const OUString& rTitle,
const OUString& rTabBgColorNoColorText,
const Color& rDefaultColor,
- const OString& sHelpId ,
- int nId )
+ const OString& sHelpId)
{
- ScTabBgColorDlg * pDlg=NULL;
- switch ( nId )
- {
- case RID_SCDLG_TAB_BG_COLOR :
- pDlg = new ScTabBgColorDlg( pParent, rTitle, rTabBgColorNoColorText, rDefaultColor, sHelpId );
- break;
- default:
- break;
- }
-
- if ( pDlg )
- return new AbstractScTabBgColorDlg_Impl( pDlg );
- return 0;
+ ScTabBgColorDlg * pDlg = new ScTabBgColorDlg( pParent, rTitle, rTabBgColorNoColorText, rDefaultColor, sHelpId );
+ return new AbstractScTabBgColorDlg_Impl( pDlg );
}
AbstractScImportOptionsDlg * ScAbstractDialogFactory_Impl::CreateScImportOptionsDlg ( Window* pParent,
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index 1cdf52505a46..78a9d2b588d8 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -532,8 +532,7 @@ public:
const OUString& rTitle, //Dialog Title
const OUString& rTabBgColorNoColorText, //Label for no tab color
const Color& rDefaultColor, //Currently selected Color
- const OString& sHelpId ,
- int nId );
+ const OString& sHelpId );
virtual AbstractScImportOptionsDlg * CreateScImportOptionsDlg ( Window* pParent,
int nId,
diff --git a/sc/source/ui/inc/miscdlgs.hrc b/sc/source/ui/inc/miscdlgs.hrc
index fc5d694db75b..b8c9a9e2808e 100644
--- a/sc/source/ui/inc/miscdlgs.hrc
+++ b/sc/source/ui/inc/miscdlgs.hrc
@@ -101,8 +101,4 @@
#define STR_GROUP 1
#define STR_UNGROUP 2
-// Tab Bg Color
-#define TAB_BG_COLOR_CT_BORDER 1
-#define TAB_BG_COLOR_SET_BGDCOLOR 2
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/tabbgcolordlg.hxx b/sc/source/ui/inc/tabbgcolordlg.hxx
index e274fef3927e..fb8330f38b4e 100644
--- a/sc/source/ui/inc/tabbgcolordlg.hxx
+++ b/sc/source/ui/inc/tabbgcolordlg.hxx
@@ -35,29 +35,29 @@ public:
const OUString& rTabBgColorNoColorText,
const Color& rDefaultColor,
const OString& nHelpId );
- ~ScTabBgColorDlg();
void GetSelectedColor( Color& rColor ) const;
-private:
class ScTabBgColorValueSet : public SvxColorValueSet
{
public:
- ScTabBgColorValueSet(Control* pParent, const ResId& rResId, ScTabBgColorDlg* pTabBgColorDlg);
+ ScTabBgColorValueSet(Window* pParent, WinBits nStyle);
+ void SetDialog(ScTabBgColorDlg* pTabBgColorDlg)
+ {
+ m_pTabBgColorDlg = pTabBgColorDlg;
+ }
virtual void KeyInput( const KeyEvent& rKEvt );
private:
- ScTabBgColorDlg* aTabBgColorDlg;
+ ScTabBgColorDlg* m_pTabBgColorDlg;
};
- Control aBorderWin;
- ScTabBgColorValueSet aTabBgColorSet;
- OKButton aBtnOk;
- CancelButton aBtnCancel;
- HelpButton aBtnHelp;
- Color aTabBgColor;
- const OUString aTabBgColorNoColorText;
- OString msHelpId;
+private:
+ ScTabBgColorValueSet* m_pTabBgColorSet;
+ OKButton* m_pBtnOk;
+ Color m_aTabBgColor;
+ const OUString m_aTabBgColorNoColorText;
+ OString m_sHelpId;
void FillColorValueSets_Impl();
diff --git a/sc/source/ui/miscdlgs/tabbgcolordlg.cxx b/sc/source/ui/miscdlgs/tabbgcolordlg.cxx
index 2c7d2266fdc2..e19317a9bf37 100644
--- a/sc/source/ui/miscdlgs/tabbgcolordlg.cxx
+++ b/sc/source/ui/miscdlgs/tabbgcolordlg.cxx
@@ -34,6 +34,7 @@
#include <tools/resid.hxx>
#include <editeng/editrids.hrc>
#include <editeng/eerdll.hxx>
+#include <vcl/builder.hxx>
#include <boost/scoped_ptr.hpp>
@@ -41,41 +42,34 @@
#define HDL(hdl) LINK(this,ScTabBgColorDlg,hdl)
-ScTabBgColorDlg::ScTabBgColorDlg( Window* pParent,
- const OUString& rTitle,
- const OUString& rTabBgColorNoColorText,
- const Color& rDefaultColor,
- const OString& sHelpId ) :
- ModalDialog ( pParent, ScResId( RID_SCDLG_TAB_BG_COLOR ) ),
- aBorderWin ( this, ScResId( TAB_BG_COLOR_CT_BORDER ) ),
- aTabBgColorSet ( &aBorderWin, ScResId( TAB_BG_COLOR_SET_BGDCOLOR ), this ),
- aBtnOk ( this, ScResId( BTN_OK ) ),
- aBtnCancel ( this, ScResId( BTN_CANCEL ) ),
- aBtnHelp ( this, ScResId( BTN_HELP ) ),
- aTabBgColor ( rDefaultColor ),
- aTabBgColorNoColorText ( rTabBgColorNoColorText ),
- msHelpId ( sHelpId )
+ScTabBgColorDlg::ScTabBgColorDlg(Window* pParent, const OUString& rTitle,
+ const OUString& rTabBgColorNoColorText, const Color& rDefaultColor,
+ const OString& sHelpId)
+ : ModalDialog(pParent, "TabColorDialog", "modules/scalc/ui/tabcolordialog.ui")
+ , m_aTabBgColor(rDefaultColor)
+ , m_aTabBgColorNoColorText(rTabBgColorNoColorText)
+ , m_sHelpId(sHelpId)
{
+ get(m_pTabBgColorSet, "colorset");
+ m_pTabBgColorSet->SetDialog(this);
+ m_pTabBgColorSet->SetColCount(m_pTabBgColorSet->getColumnCount());
+ get(m_pBtnOk, "ok");
+
SetHelpId( sHelpId );
this->SetText( rTitle );
this->SetStyle(GetStyle() | WB_BORDER | WB_STDFLOATWIN | WB_3DLOOK | WB_DIALOGCONTROL | WB_SYSTEMWINDOW | WB_STANDALONE | WB_HIDE);
FillColorValueSets_Impl();
- aTabBgColorSet.SetDoubleClickHdl( HDL(TabBgColorDblClickHdl_Impl) );
- aBtnOk.SetClickHdl( HDL(TabBgColorOKHdl_Impl) );
- FreeResource();
+ m_pTabBgColorSet->SetDoubleClickHdl( HDL(TabBgColorDblClickHdl_Impl) );
+ m_pBtnOk->SetClickHdl( HDL(TabBgColorOKHdl_Impl) );
}
//------------------------------------------------------------------------
void ScTabBgColorDlg::GetSelectedColor( Color& rColor ) const
{
- rColor = this->aTabBgColor;
-}
-
-ScTabBgColorDlg::~ScTabBgColorDlg()
-{
+ rColor = this->m_aTabBgColor;
}
void ScTabBgColorDlg::FillColorValueSets_Impl()
@@ -98,67 +92,25 @@ void ScTabBgColorDlg::FillColorValueSets_Impl()
if ( pColorList.is() )
{
nColorCount = pColorList->Count();
- aTabBgColorSet.addEntriesForXColorList(*pColorList);
+ m_pTabBgColorSet->addEntriesForXColorList(*pColorList);
}
- if(nColorCount)
+ if (nColorCount)
{
- const WinBits nBits(aTabBgColorSet.GetStyle() | WB_NAMEFIELD | WB_ITEMBORDER | WB_NONEFIELD | WB_3DLOOK | WB_NO_DIRECTSELECT | WB_NOPOINTERFOCUS);
- aTabBgColorSet.SetText( aTabBgColorNoColorText );
- aTabBgColorSet.SetStyle( nBits );
- static sal_Int32 nAdd = 4;
-
- // calculate new size of color control as base, derive size of border win
- const Size aNewSize(aTabBgColorSet.layoutAllVisible(nColorCount));
- const Size aNewSizeBorderWin(aNewSize.Width() + nAdd, aNewSize.Height() + nAdd);
-
- // from that, calculate a new dialog size
- const Size aCurrentSizeDialog(GetOutputSizePixel());
- const Size aCurrentSizeBorderWin(aBorderWin.GetOutputSizePixel());
- const long nOffsetX(aCurrentSizeDialog.Width() - aCurrentSizeBorderWin.Width());
- const long nOffsetY(aCurrentSizeDialog.Height() - aCurrentSizeBorderWin.Height());
- const Size aNewSizeDialog(aNewSizeBorderWin.Width() + nOffsetX, aNewSizeBorderWin.Height() + nOffsetY);
-
- // also need to adapt pos and size for the three buttons; as a base, take their original
- // distance from the dialog bottom and get new Y-Pos
- const long aButtonOffsetFromBottom(aCurrentSizeDialog.Height() - aBtnOk.GetPosPixel().Y());
- const long aNewButtonY(aNewSizeDialog.Height() - aButtonOffsetFromBottom);
-
- // for each button, scale width and x-pos by old/new dialog sizes and re-layout
- // for Okay-Button
- const long aNewWidthOkay((aBtnOk.GetSizePixel().Width() * aNewSizeDialog.Width()) / aCurrentSizeDialog.Width());
- const long aNewPosOkay((aBtnOk.GetPosPixel().X() * aNewSizeDialog.Width()) / aCurrentSizeDialog.Width());
- const Size aNewSizeOkay(aNewWidthOkay, aBtnOk.GetOutputSizePixel().Height());
- aBtnOk.SetOutputSizePixel(aNewSizeOkay);
- aBtnOk.SetPosSizePixel(Point(aNewPosOkay, aNewButtonY), aNewSizeOkay);
-
- // for Cancel-Button
- const long aNewWidthCancel((aBtnCancel.GetSizePixel().Width() * aNewSizeDialog.Width()) / aCurrentSizeDialog.Width());
- const long aNewPosCancel((aBtnCancel.GetPosPixel().X() * aNewSizeDialog.Width()) / aCurrentSizeDialog.Width());
- const Size aNewSizeCancel(aNewWidthCancel, aBtnCancel.GetOutputSizePixel().Height());
- aBtnCancel.SetOutputSizePixel(aNewSizeCancel);
- aBtnCancel.SetPosSizePixel(Point(aNewPosCancel, aNewButtonY), aNewSizeCancel);
-
- // for Help-Button
- const long aNewWidthHelp((aBtnHelp.GetSizePixel().Width() * aNewSizeDialog.Width()) / aCurrentSizeDialog.Width());
- const long aNewPosHelp((aBtnHelp.GetPosPixel().X() * aNewSizeDialog.Width()) / aCurrentSizeDialog.Width());
- const Size aNewSizeHelp(aNewWidthHelp, aBtnHelp.GetOutputSizePixel().Height());
- aBtnHelp.SetOutputSizePixel(aNewSizeHelp);
- aBtnHelp.SetPosSizePixel(Point(aNewPosHelp, aNewButtonY), aNewSizeHelp);
-
- // set new sizes for color control
- aTabBgColorSet.SetOutputSizePixel(aNewSize);
- aTabBgColorSet.SetPosSizePixel(Point(nAdd/2, nAdd/2), aNewSize);
-
- // set new size for border win
- aBorderWin.SetOutputSizePixel(aNewSizeBorderWin);
-
- // set new size for dialog itself
- SetOutputSizePixel(aNewSizeDialog);
+ const WinBits nBits(m_pTabBgColorSet->GetStyle() | WB_NAMEFIELD | WB_ITEMBORDER | WB_NONEFIELD | WB_3DLOOK | WB_NO_DIRECTSELECT | WB_NOPOINTERFOCUS);
+ m_pTabBgColorSet->SetText( m_aTabBgColorNoColorText );
+ m_pTabBgColorSet->SetStyle( nBits );
}
- aTabBgColorSet.SelectItem(nSelectedItem);
- aTabBgColorSet.Resize();
+ //lock down a preferred size
+ const sal_uInt32 nColCount = m_pTabBgColorSet->getColumnCount();
+ const sal_uInt32 nRowCount(ceil(double(nColorCount)/nColCount));
+ const sal_uInt32 nLength = m_pTabBgColorSet->getEntryEdgeLength();
+ Size aSize(m_pTabBgColorSet->CalcWindowSizePixel(Size(nLength, nLength), nColCount, nRowCount));
+ m_pTabBgColorSet->set_width_request(aSize.Width()+8);
+ m_pTabBgColorSet->set_height_request(aSize.Height()+8);
+
+ m_pTabBgColorSet->SelectItem(nSelectedItem);
}
IMPL_LINK_NOARG(ScTabBgColorDlg, TabBgColorDblClickHdl_Impl)
@@ -166,9 +118,9 @@ IMPL_LINK_NOARG(ScTabBgColorDlg, TabBgColorDblClickHdl_Impl)
Handler, called when color selection is changed
*/
{
- sal_uInt16 nItemId = aTabBgColorSet.GetSelectItemId();
- Color aColor = nItemId ? ( aTabBgColorSet.GetItemColor( nItemId ) ) : Color( COL_AUTO );
- aTabBgColor = aColor;
+ sal_uInt16 nItemId = m_pTabBgColorSet->GetSelectItemId();
+ Color aColor = nItemId ? ( m_pTabBgColorSet->GetItemColor( nItemId ) ) : Color( COL_AUTO );
+ m_aTabBgColor = aColor;
EndDialog( sal_True );
return 0;
}
@@ -178,17 +130,28 @@ IMPL_LINK_NOARG(ScTabBgColorDlg, TabBgColorOKHdl_Impl)
// Handler, called when the OK button is pushed
- sal_uInt16 nItemId = aTabBgColorSet.GetSelectItemId();
- Color aColor = nItemId ? ( aTabBgColorSet.GetItemColor( nItemId ) ) : Color( COL_AUTO );
- aTabBgColor = aColor;
+ sal_uInt16 nItemId = m_pTabBgColorSet->GetSelectItemId();
+ Color aColor = nItemId ? ( m_pTabBgColorSet->GetItemColor( nItemId ) ) : Color( COL_AUTO );
+ m_aTabBgColor = aColor;
EndDialog( sal_True );
return 0;
}
-ScTabBgColorDlg::ScTabBgColorValueSet::ScTabBgColorValueSet( Control* pParent, const ResId& rResId, ScTabBgColorDlg* pTabBgColorDlg ) :
- SvxColorValueSet(pParent, rResId)
+ScTabBgColorDlg::ScTabBgColorValueSet::ScTabBgColorValueSet(Window* pParent, WinBits nStyle)
+ : SvxColorValueSet(pParent, nStyle)
+ , m_pTabBgColorDlg(NULL)
{
- aTabBgColorDlg = pTabBgColorDlg;
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeScTabBgColorValueSet(Window *pParent, VclBuilder::stringmap &rMap)
+{
+ WinBits nWinBits = WB_TABSTOP;
+
+ OString sBorder = VclBuilder::extractCustomProperty(rMap);
+ if (!sBorder.isEmpty())
+ nWinBits |= WB_BORDER;
+
+ return new ScTabBgColorDlg::ScTabBgColorValueSet(pParent, nWinBits);
}
void ScTabBgColorDlg::ScTabBgColorValueSet::KeyInput( const KeyEvent& rKEvt )
@@ -200,8 +163,8 @@ void ScTabBgColorDlg::ScTabBgColorValueSet::KeyInput( const KeyEvent& rKEvt )
{
sal_uInt16 nItemId = GetSelectItemId();
const Color& aColor = nItemId ? ( GetItemColor( nItemId ) ) : Color( COL_AUTO );
- aTabBgColorDlg->aTabBgColor = aColor;
- aTabBgColorDlg->EndDialog(sal_True);
+ m_pTabBgColorDlg->m_aTabBgColor = aColor;
+ m_pTabBgColorDlg->EndDialog(sal_True);
}
break;
}
diff --git a/sc/source/ui/src/miscdlgs.src b/sc/source/ui/src/miscdlgs.src
index b22e9df0a8e9..e0344cf37f24 100644
--- a/sc/source/ui/src/miscdlgs.src
+++ b/sc/source/ui/src/miscdlgs.src
@@ -224,52 +224,6 @@ ModalDialog RID_SCDLG_INSCONT
};
};
-ModalDialog RID_SCDLG_TAB_BG_COLOR
-{
- HelpID = "sc:ModalDialog:RID_SCDLG_TAB_BG_COLOR";
- OutputSize = TRUE ;
- SVLook = TRUE ;
- Size = MAP_APPFONT ( 118 , 167 ) ;
- Moveable = TRUE ;
- Closeable = TRUE ;
- Control TAB_BG_COLOR_CT_BORDER
- {
- Border = TRUE ;
- Pos = MAP_APPFONT ( 1 , 1 ) ; //12, 32
- Size = MAP_APPFONT ( 116+2 , 145+2 ) ;
- DialogControl = TRUE;
- };
- Control TAB_BG_COLOR_SET_BGDCOLOR
- {
- // * HelpId = HID_BACKGROUND_CTL_BGDCOLORSET ;
- Hide = FALSE ;
- Pos = MAP_APPFONT ( 0 , 0 ) ;
- Size = MAP_APPFONT ( 116 , 145 ) ;
- TabStop = TRUE ;
- };
- CancelButton BTN_CANCEL
- {
- Pos = MAP_APPFONT ( 82 , 151 ) ;
- Size = MAP_APPFONT ( 35 , 14 ) ;
- TabStop = TRUE ;
- DefButton = FALSE ;
- };
- OKButton BTN_OK
- {
- Pos = MAP_APPFONT ( 45 , 151 ) ;
- Size = MAP_APPFONT ( 35 , 14 ) ;
- TabStop = TRUE ;
- DefButton = TRUE ;
- };
- HelpButton BTN_HELP
- {
- Pos = MAP_APPFONT ( 2 , 151 ) ;
- Size = MAP_APPFONT ( 35 , 14 ) ;
- TabStop = TRUE ;
- DefButton = FALSE ;
- };
-};
-
#define TXT_COLS \
Text [ en-US ] = "~Columns" ; \
diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx
index 78e956b3f54d..059fdce5b63d 100644
--- a/sc/source/ui/view/tabvwshf.cxx
+++ b/sc/source/ui/view/tabvwshf.cxx
@@ -708,8 +708,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
OUString(ScResId(SCSTR_SET_TAB_BG_COLOR)),
OUString(ScResId(SCSTR_NO_TAB_BG_COLOR)),
aTabBgColor,
- CMD_FID_TAB_SET_TAB_BG_COLOR,
- RID_SCDLG_TAB_BG_COLOR);
+ CMD_FID_TAB_SET_TAB_BG_COLOR);
while ( !bDone && nRet == RET_OK )
{
nRet = pDlg->Execute();