diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-10-16 22:20:23 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-10-17 16:06:33 +0100 |
commit | 46f1b3a5949e063953af635147acf748684c8e2f (patch) | |
tree | 086247d733a2afa89258713ee230bc2a10ce9055 /sw/source/ui | |
parent | 644d22e6765d961f6130affc84ace869d6fd5177 (diff) |
default SwInsertGrfRulerDlg to first entry
Change-Id: I843afacf4bb6880ecd9848cae3fe6071439ed995
Diffstat (limited to 'sw/source/ui')
-rw-r--r-- | sw/source/ui/inc/insrule.hxx | 17 | ||||
-rw-r--r-- | sw/source/ui/inc/swvset.hxx | 5 | ||||
-rw-r--r-- | sw/source/ui/misc/insrule.cxx | 46 |
3 files changed, 29 insertions, 39 deletions
diff --git a/sw/source/ui/inc/insrule.hxx b/sw/source/ui/inc/insrule.hxx index 78d331909355..5d9f37e9eef3 100644 --- a/sw/source/ui/inc/insrule.hxx +++ b/sw/source/ui/inc/insrule.hxx @@ -31,26 +31,21 @@ class SwInsertGrfRulerDlg : public SfxModalDialog OKButton* m_pOkPB; SwRulerValueSet* m_pExampleVS; - std::vector<String> aGrfNames; - String sSimple; - String sRulers; - sal_uInt16 nSelPos; + std::vector<OUString> m_aGrfNames; + OUString m_sSimple; protected: - DECL_LINK(SelectHdl, ValueSet*); DECL_LINK(DoubleClickHdl, void *); public: - SwInsertGrfRulerDlg( Window* pParent ); + SwInsertGrfRulerDlg(Window* pParent); ~SwInsertGrfRulerDlg(); - String GetGraphicName(); - sal_Bool IsSimpleLine() {return nSelPos == 1;} - sal_Bool HasImages() const {return !aGrfNames.empty();} + OUString GetGraphicName() const; + bool IsSimpleLine() const; + bool HasImages() const {return !m_aGrfNames.empty();} }; #endif - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/inc/swvset.hxx b/sw/source/ui/inc/swvset.hxx index a4c59fcb9dfb..7bc919d7fe83 100644 --- a/sw/source/ui/inc/swvset.hxx +++ b/sw/source/ui/inc/swvset.hxx @@ -23,9 +23,8 @@ class SwRulerValueSet : public SvxBmpNumValueSet { public: - SwRulerValueSet( Window* pParent, - const ResId& rResId ); - SwRulerValueSet( Window* pParent ); + SwRulerValueSet(Window* pParent, const ResId& rResId); + SwRulerValueSet(Window* pParent, WinBits nWinStyle); ~SwRulerValueSet(); virtual void UserDraw( const UserDrawEvent& rUDEvt ); }; diff --git a/sw/source/ui/misc/insrule.cxx b/sw/source/ui/misc/insrule.cxx index cfa03016681d..7b1b9490b11e 100644 --- a/sw/source/ui/misc/insrule.cxx +++ b/sw/source/ui/misc/insrule.cxx @@ -43,33 +43,29 @@ SwInsertGrfRulerDlg::SwInsertGrfRulerDlg( Window* pParent ) : SfxModalDialog(pParent, "HorizontalRuleDialog", "modules/swriter/ui/horizontalrule.ui") - , sSimple(SW_RESSTR(STR_SIMPLE)) - , nSelPos(USHRT_MAX) + , m_sSimple(SW_RESSTR(STR_SIMPLE)) { get(m_pOkPB, "ok"); get(m_pExampleVS, "rulers"); m_pExampleVS->SetLineCount(6); m_pExampleVS->SetColCount(1); - m_pExampleVS->SetSelectHdl(LINK(this, SwInsertGrfRulerDlg, SelectHdl)); m_pExampleVS->SetDoubleClickHdl(LINK(this, SwInsertGrfRulerDlg, DoubleClickHdl)); // determine graphic name GalleryExplorer::BeginLocking(GALLERY_THEME_RULERS); - GalleryExplorer::FillObjList( GALLERY_THEME_RULERS, aGrfNames ); - m_pExampleVS->SetHelpId(HID_VS_RULER); + GalleryExplorer::FillObjList(GALLERY_THEME_RULERS, m_aGrfNames); Color aColor(COL_WHITE); - m_pExampleVS->InsertItem( 1, 1); - m_pExampleVS->SetItemText( 1, sSimple); + m_pExampleVS->InsertItem(1, 1); + m_pExampleVS->SetItemText(1, m_sSimple); - for(sal_uInt16 i = 1; i <= aGrfNames.size(); i++) + for(sal_uInt16 i = 1; i <= m_aGrfNames.size(); ++i) { m_pExampleVS->InsertItem( i + 1, i); - m_pExampleVS->SetItemText( i + 1, aGrfNames[i-1]); + m_pExampleVS->SetItemText( i + 1, m_aGrfNames[i-1]); } m_pExampleVS->SelectItem(1); - m_pExampleVS->GrabFocus(); } SwInsertGrfRulerDlg::~SwInsertGrfRulerDlg() @@ -77,22 +73,22 @@ SwInsertGrfRulerDlg::~SwInsertGrfRulerDlg() GalleryExplorer::EndLocking(GALLERY_THEME_RULERS); } -String SwInsertGrfRulerDlg::GetGraphicName() +bool SwInsertGrfRulerDlg::IsSimpleLine() const { - String sRet; - sal_uInt16 nSel = nSelPos - 2; //align selection position with ValueSet index - if(nSel < aGrfNames.size()) - sRet = URIHelper::SmartRel2Abs( - INetURLObject(), aGrfNames[nSel], - URIHelper::GetMaybeFileHdl()); - return sRet; + return m_pExampleVS->GetSelectItemId() == 1; } -IMPL_LINK(SwInsertGrfRulerDlg, SelectHdl, ValueSet*, pVS) +OUString SwInsertGrfRulerDlg::GetGraphicName() const { - nSelPos = pVS->GetSelectItemId(); - m_pOkPB->Enable(); - return 0; + sal_uInt16 nSelPos = m_pExampleVS->GetSelectItemId(); + + sal_uInt16 nSel = nSelPos - 2; //align selection position with ValueSet index + if(nSel < m_aGrfNames.size()) + { + return URIHelper::SmartRel2Abs(INetURLObject(), m_aGrfNames[nSel], + URIHelper::GetMaybeFileHdl()); + } + return OUString(); } SwRulerValueSet::SwRulerValueSet( Window* pParent, const ResId& rResId ) @@ -101,15 +97,15 @@ SwRulerValueSet::SwRulerValueSet( Window* pParent, const ResId& rResId ) SetStyle(GetStyle() & ~WB_ITEMBORDER); } -SwRulerValueSet::SwRulerValueSet(Window* pParent) - : SvxBmpNumValueSet(pParent) +SwRulerValueSet::SwRulerValueSet(Window* pParent, WinBits nWinStyle) + : SvxBmpNumValueSet(pParent, nWinStyle) { SetStyle(GetStyle() & ~WB_ITEMBORDER); } extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSwRulerValueSet(Window *pParent, VclBuilder::stringmap &) { - return new SwRulerValueSet(pParent); + return new SwRulerValueSet(pParent, WB_ITEMBORDER | WB_TABSTOP); } SwRulerValueSet::~SwRulerValueSet() |