diff options
Diffstat (limited to 'sw/source/ui/misc/insrule.cxx')
-rw-r--r-- | sw/source/ui/misc/insrule.cxx | 74 |
1 files changed, 35 insertions, 39 deletions
diff --git a/sw/source/ui/misc/insrule.cxx b/sw/source/ui/misc/insrule.cxx index 4d865e6cdd7b..20a7af373853 100644 --- a/sw/source/ui/misc/insrule.cxx +++ b/sw/source/ui/misc/insrule.cxx @@ -37,73 +37,69 @@ #include "docsh.hxx" #include "insrule.hxx" #include "swvset.hxx" -#include "insrule.hrc" +#include "app.hrc" #include "misc.hrc" #include "helpid.h" -SwInsertGrfRulerDlg::SwInsertGrfRulerDlg( Window* pParent ) : - SfxModalDialog(pParent, SW_RES(DLG_INSERT_RULER)), - aSelectionFL(this, SW_RES(FL_SEL )), - aOkPB (this, SW_RES(PB_OK )), - aCancelPB (this, SW_RES(PB_CANCEL )), - aHelpPB (this, SW_RES(PB_HELP )), - - sSimple (SW_RES(ST_SIMPLE)), - nSelPos(USHRT_MAX), - pExampleVS (new SwRulerValueSet(this, SW_RES(VS_EXAMPLE ))) +SwInsertGrfRulerDlg::SwInsertGrfRulerDlg( Window* pParent ) + : SfxModalDialog(pParent, "HorizontalRuleDialog", "modules/swriter/ui/horizontalrule.ui") + , m_sSimple(SW_RESSTR(STR_SIMPLE)) { - FreeResource(); - pExampleVS->SetLineCount(6); - pExampleVS->SetColCount(1); - pExampleVS->SetSelectHdl(LINK(this, SwInsertGrfRulerDlg, SelectHdl)); - pExampleVS->SetDoubleClickHdl(LINK(this, SwInsertGrfRulerDlg, DoubleClickHdl)); - pExampleVS->GrabFocus(); + get(m_pOkPB, "ok"); + get(m_pExampleVS, "rulers"); + + m_pExampleVS->SetLineCount(6); + m_pExampleVS->SetColCount(1); + m_pExampleVS->SetDoubleClickHdl(LINK(this, SwInsertGrfRulerDlg, DoubleClickHdl)); // determine graphic name GalleryExplorer::BeginLocking(GALLERY_THEME_RULERS); - GalleryExplorer::FillObjList( GALLERY_THEME_RULERS, aGrfNames ); - pExampleVS->SetHelpId(HID_VS_RULER); + GalleryExplorer::FillObjList(GALLERY_THEME_RULERS, m_aGrfNames); Color aColor(COL_WHITE); - pExampleVS->InsertItem( 1, 1); - 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) { - pExampleVS->InsertItem( i + 1, i); - pExampleVS->SetItemText( i + 1, aGrfNames[i-1]); + m_pExampleVS->InsertItem( i + 1, i); + m_pExampleVS->SetItemText( i + 1, m_aGrfNames[i-1]); } - pExampleVS->Show(); + m_pExampleVS->SelectItem(1); } SwInsertGrfRulerDlg::~SwInsertGrfRulerDlg() { GalleryExplorer::EndLocking(GALLERY_THEME_RULERS); - delete pExampleVS; } -String SwInsertGrfRulerDlg::GetGraphicName() +bool SwInsertGrfRulerDlg::IsSimpleLine() const +{ + return m_pExampleVS->GetSelectItemId() == 1; +} + +OUString SwInsertGrfRulerDlg::GetGraphicName() const { - String sRet; + sal_uInt16 nSelPos = m_pExampleVS->GetSelectItemId(); + sal_uInt16 nSel = nSelPos - 2; //align selection position with ValueSet index - if(nSel < aGrfNames.size()) - sRet = URIHelper::SmartRel2Abs( - INetURLObject(), aGrfNames[nSel], + if(nSel < m_aGrfNames.size()) + { + return URIHelper::SmartRel2Abs(INetURLObject(), m_aGrfNames[nSel], URIHelper::GetMaybeFileHdl()); - return sRet; + } + return OUString(); } -IMPL_LINK(SwInsertGrfRulerDlg, SelectHdl, ValueSet*, pVS) +SwRulerValueSet::SwRulerValueSet(Window* pParent, WinBits nWinStyle) + : SvxBmpNumValueSet(pParent, nWinStyle) { - nSelPos = pVS->GetSelectItemId(); - aOkPB.Enable(); - return 0; + SetStyle(GetStyle() & ~WB_ITEMBORDER); } -SwRulerValueSet::SwRulerValueSet( Window* pParent, const ResId& rResId ) : - SvxBmpNumValueSet(pParent, rResId) +extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSwRulerValueSet(Window *pParent, VclBuilder::stringmap &) { - SetStyle( GetStyle() & ~WB_ITEMBORDER ); + return new SwRulerValueSet(pParent, WB_ITEMBORDER | WB_TABSTOP); } SwRulerValueSet::~SwRulerValueSet() |