summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2013-04-16 15:46:18 +0000
committerArmin Le Grand <alg@apache.org>2013-04-16 15:46:18 +0000
commit401e8f2db607081e62eaaa1f08a8cd8971a3f637 (patch)
tree4417318a0df957d58915715b874f922487ee7ff1 /sc
parent777eacd9f51f2ed17ece469ad714960ae561489c (diff)
i122041 Added vaues for defining behaviour of ColorValueSets to SvtAccessibilityOptions
Notes
Notes: merged as: 85f49fdccddef6b5a5bdc1b95f5b04714179c898
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/inc/tabbgcolordlg.hxx4
-rw-r--r--sc/source/ui/miscdlgs/tabbgcolordlg.cxx93
-rw-r--r--sc/source/ui/src/miscdlgs.src102
3 files changed, 68 insertions, 131 deletions
diff --git a/sc/source/ui/inc/tabbgcolordlg.hxx b/sc/source/ui/inc/tabbgcolordlg.hxx
index e9b41353e7b9..0aa7d86d817e 100644
--- a/sc/source/ui/inc/tabbgcolordlg.hxx
+++ b/sc/source/ui/inc/tabbgcolordlg.hxx
@@ -27,7 +27,7 @@
#include <vcl/dialog.hxx>
#include <vcl/fixed.hxx>
#include <vcl/button.hxx>
-#include <svtools/valueset.hxx>
+#include <svx/SvxColorValueSet.hxx>
//------------------------------------------------------------------------
@@ -44,7 +44,7 @@ public:
void GetSelectedColor( Color& rColor ) const;
private:
- class ScTabBgColorValueSet : public ValueSet
+ class ScTabBgColorValueSet : public SvxColorValueSet
{
public:
ScTabBgColorValueSet(Control* pParent, const ResId& rResId, ScTabBgColorDlg* pTabBgColorDlg);
diff --git a/sc/source/ui/miscdlgs/tabbgcolordlg.cxx b/sc/source/ui/miscdlgs/tabbgcolordlg.cxx
index f92a8b916e3e..10b5327e4c03 100644
--- a/sc/source/ui/miscdlgs/tabbgcolordlg.cxx
+++ b/sc/source/ui/miscdlgs/tabbgcolordlg.cxx
@@ -100,45 +100,84 @@ void ScTabBgColorDlg::FillColorValueSets_Impl()
DBG_ASSERT( pDocSh, "DocShell not found!" );
if ( pDocSh && ( 0 != ( pItem = pDocSh->GetItem(SID_COLOR_TABLE) ) ) )
+ {
pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable();
+ }
+
if ( !pColorTable )
{
pOwnColorTable.reset(new XColorList(SvtPathOptions().GetPalettePath()));
pColorTable = pOwnColorTable.get();
}
+
+ long nColorCount(0);
+
if ( pColorTable )
{
- sal_uInt16 i = 0;
- long nCount = pColorTable->Count();
+ nColorCount = pColorTable->Count();
XColorEntry* pEntry = NULL;
Color aColWhite( COL_WHITE );
String aStrWhite( EditResId( RID_SVXITEMS_COLOR_WHITE ) );
- WinBits nBits = ( aTabBgColorSet.GetStyle() | WB_NAMEFIELD | WB_ITEMBORDER | WB_NONEFIELD | WB_3DLOOK | WB_NO_DIRECTSELECT | WB_NOPOINTERFOCUS);
- aTabBgColorSet.SetText( aTabBgColorNoColorText );
- aTabBgColorSet.SetStyle( nBits );
- for ( i = 0; i < nCount; i++ )
- {
- pEntry = pColorTable->GetColor(i);
- aTabBgColorSet.InsertItem( i + 1, pEntry->GetColor(), pEntry->GetName() );
- if (pEntry->GetColor() == aTabBgColor)
- nSelectedItem = (i + 1);
- }
- while ( i < 80 )
- {
- aTabBgColorSet.InsertItem( i + 1, aColWhite, aStrWhite );
- i++;
- }
+ aTabBgColorSet.addEntriesForXColorList(*pColorTable);
+ }
- if ( nCount > 80 )
- {
- aTabBgColorSet.SetStyle( nBits | WB_VSCROLL );
- }
+ 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);
}
- aTabBgColorSet.SetColCount( 10 );
- aTabBgColorSet.SetLineCount( 10 );
- aTabBgColorSet.CalcWindowSizePixel( aSize15x15 );
- aTabBgColorSet.Format();
+
aTabBgColorSet.SelectItem(nSelectedItem);
aTabBgColorSet.Resize();
}
@@ -168,7 +207,7 @@ IMPL_LINK( ScTabBgColorDlg, TabBgColorOKHdl_Impl, OKButton*, EMPTYARG )
}
ScTabBgColorDlg::ScTabBgColorValueSet::ScTabBgColorValueSet( Control* pParent, const ResId& rResId, ScTabBgColorDlg* pTabBgColorDlg ) :
- ValueSet(pParent, rResId)
+ SvxColorValueSet(pParent, rResId)
{
aTabBgColorDlg = pTabBgColorDlg;
}
@@ -187,5 +226,5 @@ void ScTabBgColorDlg::ScTabBgColorValueSet::KeyInput( const KeyEvent& rKEvt )
}
break;
}
- ValueSet::KeyInput(rKEvt);
+ SvxColorValueSet::KeyInput(rKEvt);
}
diff --git a/sc/source/ui/src/miscdlgs.src b/sc/source/ui/src/miscdlgs.src
index e1f295049c45..9e0a31b6292e 100644
--- a/sc/source/ui/src/miscdlgs.src
+++ b/sc/source/ui/src/miscdlgs.src
@@ -619,108 +619,6 @@ ModalDialog RID_SCDLG_TAB_BG_COLOR
DefButton = FALSE ;
};
};
-/*
-ModalDialog RID_SCDLG_TAB_BG_COLOR
-{
- HelpID = "sc:ModalDialog:RID_SCDLG_TAB_BG_COLOR";
- OutputSize = TRUE ;
- SVLook = TRUE ;
- Size = MAP_APPFONT ( 180 , 150 ) ;
- 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 ;
- };
- OKButton BTN_OK
- {
- Pos = MAP_APPFONT ( 125 , 50 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- DefButton = TRUE ;
- };
- CancelButton BTN_CANCEL
- {
- Pos = MAP_APPFONT ( 125 , 67 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- DefButton = FALSE ;
- };
- HelpButton BTN_HELP
- {
- Pos = MAP_APPFONT ( 125 , 84 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- DefButton = FALSE ;
- };
-};
-*/
-/*
-ModalDialog RID_SCDLG_MTRINPUT
-{
- HelpID = "sc:ModalDialog:RID_SCDLG_MTRINPUT";
- OutputSize = TRUE ;
- SVLook = TRUE ;
- Size = MAP_APPFONT ( 190 , 63 ) ;
- Moveable = TRUE ;
- Closeable = FALSE ;
- OKButton BTN_OK
- {
- Pos = MAP_APPFONT ( 136 , 6 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- DefButton = TRUE ;
- };
- CancelButton BTN_CANCEL
- {
- Pos = MAP_APPFONT ( 136 , 23 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- };
- HelpButton BTN_HELP
- {
- Pos = MAP_APPFONT ( 136 , 43 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- };
- FixedText FT_LABEL
- {
- Pos = MAP_APPFONT ( 6 , 8 ) ;
- Size = MAP_APPFONT ( 60 , 10 ) ;
- };
- MetricField ED_VALUE
- {
- // HelpID, weil die generierten aus den Ableitungen nicht in die hid.lst kommen
- HelpId = HID_SC_MTRIN_VAL ;
- Border = TRUE ;
- Pos = MAP_APPFONT ( 70 , 6 ) ;
- Size = MAP_APPFONT ( 60 , 12 ) ;
- TabStop = TRUE ;
- Repeat = TRUE ;
- Spin = TRUE ;
- };
- CheckBox BTN_DEFVAL
- {
- HelpID = "sc:CheckBox:RID_SCDLG_MTRINPUT:BTN_DEFVAL";
- // HelpID, weil die generierten aus den Ableitungen nicht in die hid.lst kommen
- TabStop = TRUE ;
- Pos = MAP_APPFONT ( 70 , 24 ) ;
- Size = MAP_APPFONT ( 58 , 10 ) ;
- Text [ en-US ] = "~Default value" ;
- };
-};
-*/
ModalDialog RID_SCDLG_COL_MAN
{