diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-05-29 12:39:17 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-05-30 11:37:19 -0400 |
commit | ce2bcf8901d491866b62bff4b5bfe63918a0fe24 (patch) | |
tree | 195e9fec2299262dc575965e403364a05d7d717a | |
parent | f1010e946f2bed587d7e7ad4e52e20c38062f683 (diff) |
Added options list and other misc stuff.
Change-Id: Idd7b8823a26e2a272d911c097dbde350092ec0e8
-rw-r--r-- | sc/source/ui/optdlg/calcoptionsdlg.cxx | 87 | ||||
-rw-r--r-- | sc/source/ui/optdlg/calcoptionsdlg.hrc | 6 | ||||
-rw-r--r-- | sc/source/ui/optdlg/calcoptionsdlg.hxx | 18 | ||||
-rw-r--r-- | sc/source/ui/optdlg/calcoptionsdlg.src | 42 |
4 files changed, 149 insertions, 4 deletions
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx index ebd6370170f7..ae3569446362 100644 --- a/sc/source/ui/optdlg/calcoptionsdlg.cxx +++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx @@ -30,13 +30,98 @@ #include "calcoptionsdlg.hrc" #include "scresid.hxx" +#include "svtools/svlbitm.hxx" + +namespace { + +class OptionString : public SvLBoxString +{ + rtl::OUString maDesc; + rtl::OUString maValue; +public: + OptionString(const rtl::OUString& rDesc, const rtl::OUString& rValue) : + maDesc(rDesc), maValue(rValue) {} + + virtual void Paint(const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags, SvLBoxEntry* pEntry); +}; + +void OptionString::Paint(const Point& rPos, SvLBox& rDev, sal_uInt16 /*nFlags*/, SvLBoxEntry* /*pEntry*/) +{ + Point aPos = rPos; + rtl::OUString aDesc = maDesc + rtl::OUString(": "); + rDev.DrawText(aPos, aDesc); + + aPos.X() += rDev.GetTextWidth(aDesc); + Font aOldFont = rDev.GetFont(); + Font aFont = aOldFont; + aFont.SetWeight(WEIGHT_BOLD); + + rDev.SetFont(aFont); + rDev.DrawText(aPos, maValue); + + rDev.SetFont(aOldFont); +} + +} + ScCalcOptionsDialog::ScCalcOptionsDialog(Window* pParent) : ModalDialog(pParent, ScResId(RID_SCDLG_FORMULA_CALCOPTIONS)), + maLbSettings(this, ScResId(LB_SETTINGS)), + maBtnEdit(this, ScResId(BTN_EDIT)), + maFlAnnotation(this, ScResId(FL_ANNOTATION)), + maFtAnnotation(this, ScResId(FT_ANNOTATION)), maBtnOK(this, ScResId(BTN_OK)), - maBtnCancel(this, ScResId(BTN_CANCEL)) + maBtnCancel(this, ScResId(BTN_CANCEL)), + maDescIndirectSyntax(ScResId(STR_INDIRECT_SYNTAX_DESC).toString()) { + maLbSettings.SetStyle(maLbSettings.GetStyle() | WB_CLIPCHILDREN | WB_FORCE_MAKEVISIBLE); + maLbSettings.SetHighlightRange(); + + maLbSettings.SetSelectHdl(LINK(this, ScCalcOptionsDialog, SettingsSelHdl)); + maLbSettings.SetDoubleClickHdl(LINK(this, ScCalcOptionsDialog, SettingsDoubleClickHdl)); + + FillOptionsList(); + FreeResource(); + SelectionChanged(); } ScCalcOptionsDialog::~ScCalcOptionsDialog() {} +void ScCalcOptionsDialog::FillOptionsList() +{ + maLbSettings.SetUpdateMode(false); + + SvLBoxTreeList* pModel = maLbSettings.GetModel(); + SvLBoxEntry* pEntry = new SvLBoxEntry; + pEntry->AddItem(new SvLBoxString(pEntry, 0, rtl::OUString())); + pEntry->AddItem(new SvLBoxContextBmp(pEntry, 0, Image(), Image(), 0)); + OptionString* pItem = new OptionString("Formula syntax INDIRECT function expects", "Calc A1"); + pEntry->AddItem(pItem); + + pModel->Insert(pEntry); + + maLbSettings.SetUpdateMode(true); +} + +void ScCalcOptionsDialog::SelectionChanged() +{ + maFtAnnotation.SetText(maDescIndirectSyntax); +} + +void ScCalcOptionsDialog::EditOption() +{ +} + +IMPL_LINK_NOARG(ScCalcOptionsDialog, SettingsSelHdl) +{ + SelectionChanged(); + return 0; +} + +IMPL_LINK_NOARG(ScCalcOptionsDialog, SettingsDoubleClickHdl) +{ + EditOption(); + return 0; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/optdlg/calcoptionsdlg.hrc b/sc/source/ui/optdlg/calcoptionsdlg.hrc index 364383984c63..6dc6ae5f727c 100644 --- a/sc/source/ui/optdlg/calcoptionsdlg.hrc +++ b/sc/source/ui/optdlg/calcoptionsdlg.hrc @@ -30,5 +30,11 @@ #define BTN_OK 1 #define BTN_CANCEL 2 +#define LB_SETTINGS 3 +#define BTN_EDIT 4 +#define FL_ANNOTATION 5 +#define FT_ANNOTATION 6 + +#define STR_INDIRECT_SYNTAX_DESC 10 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/optdlg/calcoptionsdlg.hxx b/sc/source/ui/optdlg/calcoptionsdlg.hxx index 76f99b3fba3d..9bb1ca582cff 100644 --- a/sc/source/ui/optdlg/calcoptionsdlg.hxx +++ b/sc/source/ui/optdlg/calcoptionsdlg.hxx @@ -31,6 +31,8 @@ #include "vcl/dialog.hxx" #include "vcl/button.hxx" +#include "vcl/fixed.hxx" +#include "svx/checklbx.hxx" class ScCalcOptionsDialog : public ModalDialog { @@ -38,9 +40,25 @@ public: ScCalcOptionsDialog(Window* pParent); virtual ~ScCalcOptionsDialog(); + DECL_LINK( SettingsSelHdl, void* ); + DECL_LINK( SettingsDoubleClickHdl, void* ); + +private: + void FillOptionsList(); + void SelectionChanged(); + void EditOption(); + private: + SvxCheckListBox maLbSettings; + + PushButton maBtnEdit; + FixedLine maFlAnnotation; + FixedText maFtAnnotation; + OKButton maBtnOK; CancelButton maBtnCancel; + + rtl::OUString maDescIndirectSyntax; }; #endif diff --git a/sc/source/ui/optdlg/calcoptionsdlg.src b/sc/source/ui/optdlg/calcoptionsdlg.src index f0e72e3d6e96..e80fa098c55d 100644 --- a/sc/source/ui/optdlg/calcoptionsdlg.src +++ b/sc/source/ui/optdlg/calcoptionsdlg.src @@ -32,20 +32,56 @@ ModalDialog RID_SCDLG_FORMULA_CALCOPTIONS OutputSize = TRUE ; Hide = TRUE ; SVLook = TRUE ; - Size = MAP_APPFONT ( 260, 200 ) ; + Size = MAP_APPFONT ( 230, 200 ) ; Text [ en-US ] = "Detailed Calculation Settings" ; + Control LB_SETTINGS + { + Border = TRUE ; + Pos = MAP_APPFONT ( 6 , 10 ) ; + Size = MAP_APPFONT ( 218 , 67 ) ; + TabStop = TRUE ; + }; + + PushButton BTN_EDIT + { + Pos = MAP_APPFONT ( 8 , 82 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Edit..."; + }; + + FixedLine FL_ANNOTATION + { + Pos = MAP_APPFONT ( 6 , 98 ) ; + Size = MAP_APPFONT ( 218 , 8 ) ; + TabStop = TRUE ; + }; + + FixedText FT_ANNOTATION + { + Pos = MAP_APPFONT ( 8 , 108 ) ; + Size = MAP_APPFONT ( 214 , 70 ) ; + WordBreak = TRUE ; + NoLabel = TRUE ; + }; + OKButton BTN_OK { - Pos = MAP_APPFONT ( 148 , 180 ) ; + Pos = MAP_APPFONT ( 118 , 180 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; }; CancelButton BTN_CANCEL { - Pos = MAP_APPFONT ( 204 , 180 ) ; + Pos = MAP_APPFONT ( 174 , 180 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; }; + + String STR_INDIRECT_SYNTAX_DESC + { + Text [ en-US ] = "Formula syntax that built-in function INDIRECT expects."; + }; }; |