Kaydet (Commit) 46f1b3a5 authored tarafından Caolán McNamara's avatar Caolán McNamara

default SwInsertGrfRulerDlg to first entry

Change-Id: I843afacf4bb6880ecd9848cae3fe6071439ed995
üst 644d22e6
......@@ -174,7 +174,7 @@ static snewfoil_value_info standard[] =
};
LayoutMenu::LayoutMenu( TreeNode* pParent, ToolPanelViewShell& i_rPanelViewShell )
: ValueSet (pParent->GetWindow()),
: ValueSet(pParent->GetWindow(), WB_ITEMBORDER),
TreeNode(pParent),
DragSourceHelper(this),
DropTargetHelper(this),
......
......@@ -296,7 +296,7 @@ protected:
virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
public:
ValueSet( Window* pParent, WinBits nWinStyle = WB_ITEMBORDER, bool bDisableTransientChildren = false );
ValueSet( Window* pParent, WinBits nWinStyle, bool bDisableTransientChildren = false );
ValueSet( Window* pParent, const ResId& rResId, bool bDisableTransientChildren = false );
~ValueSet();
......
......@@ -69,7 +69,7 @@ class SVX_DLLPUBLIC SvxNumValueSet : public ValueSet
public:
SvxNumValueSet( Window* pParent, const ResId& rResId, sal_uInt16 nType );
SvxNumValueSet( Window* pParent, sal_uInt16 nType );
SvxNumValueSet( Window* pParent, WinBits nWinStyle, sal_uInt16 nType );
~SvxNumValueSet();
virtual void UserDraw( const UserDrawEvent& rUDEvt );
......@@ -108,7 +108,7 @@ class SVX_DLLPUBLIC SvxBmpNumValueSet : public SvxNumValueSet
public:
SvxBmpNumValueSet(Window* pParent, const ResId& rResId);
SvxBmpNumValueSet(Window* pParent);
SvxBmpNumValueSet(Window* pParent, WinBits nWinStyle);
~SvxBmpNumValueSet();
virtual void UserDraw( const UserDrawEvent& rUDEvt );
......
......@@ -408,8 +408,8 @@ SvxNumValueSet::SvxNumValueSet( Window* pParent, const ResId& rResId, sal_uInt16
init(nType);
}
SvxNumValueSet::SvxNumValueSet( Window* pParent, sal_uInt16 nType )
: ValueSet( pParent )
SvxNumValueSet::SvxNumValueSet( Window* pParent, WinBits nWinStyle, sal_uInt16 nType )
: ValueSet( pParent, nWinStyle )
{
init(nType);
}
......@@ -481,8 +481,8 @@ SvxBmpNumValueSet::SvxBmpNumValueSet( Window* pParent, const ResId& rResId )
init();
}
SvxBmpNumValueSet::SvxBmpNumValueSet( Window* pParent )
: SvxNumValueSet( pParent, NUM_PAGETYPE_BMP )
SvxBmpNumValueSet::SvxBmpNumValueSet( Window* pParent, WinBits nWinStyle )
: SvxNumValueSet( pParent, nWinStyle, NUM_PAGETYPE_BMP )
{
init();
}
......
......@@ -68,7 +68,6 @@
#define HID_VS_NUM "SW_HID_VS_NUM"
#define HID_VS_BULLET "SW_HID_VS_BULLET"
#define HID_VS_NUMBMP "SW_HID_VS_NUMBMP"
#define HID_VS_RULER "SW_HID_VS_RULER"
#define HID_INSERT_ABSTRACT "SW_HID_INSERT_ABSTRACT"
#define HID_NAVI_TBX1 "SW_HID_NAVI_TBX1"
#define HID_NAVI_TBX2 "SW_HID_NAVI_TBX2"
......
......@@ -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: */
......@@ -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 );
};
......
......@@ -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()
......
......@@ -115,7 +115,8 @@
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Name</property>
<property name="label" translatable="yes">&lt;b&gt;Name&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
......@@ -220,7 +221,7 @@
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Size</property>
<property name="label" translatable="yes">&lt;b&gt;Size&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
......@@ -389,7 +390,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0.47999998927116394</property>
<property name="label" translatable="yes">Options</property>
<property name="label" translatable="yes">&lt;b&gt;Options&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment