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[] = ...@@ -174,7 +174,7 @@ static snewfoil_value_info standard[] =
}; };
LayoutMenu::LayoutMenu( TreeNode* pParent, ToolPanelViewShell& i_rPanelViewShell ) LayoutMenu::LayoutMenu( TreeNode* pParent, ToolPanelViewShell& i_rPanelViewShell )
: ValueSet (pParent->GetWindow()), : ValueSet(pParent->GetWindow(), WB_ITEMBORDER),
TreeNode(pParent), TreeNode(pParent),
DragSourceHelper(this), DragSourceHelper(this),
DropTargetHelper(this), DropTargetHelper(this),
......
...@@ -296,7 +296,7 @@ protected: ...@@ -296,7 +296,7 @@ protected:
virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible(); virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
public: 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( Window* pParent, const ResId& rResId, bool bDisableTransientChildren = false );
~ValueSet(); ~ValueSet();
......
...@@ -69,7 +69,7 @@ class SVX_DLLPUBLIC SvxNumValueSet : public ValueSet ...@@ -69,7 +69,7 @@ class SVX_DLLPUBLIC SvxNumValueSet : public ValueSet
public: public:
SvxNumValueSet( Window* pParent, const ResId& rResId, sal_uInt16 nType ); SvxNumValueSet( Window* pParent, const ResId& rResId, sal_uInt16 nType );
SvxNumValueSet( Window* pParent, sal_uInt16 nType ); SvxNumValueSet( Window* pParent, WinBits nWinStyle, sal_uInt16 nType );
~SvxNumValueSet(); ~SvxNumValueSet();
virtual void UserDraw( const UserDrawEvent& rUDEvt ); virtual void UserDraw( const UserDrawEvent& rUDEvt );
...@@ -108,7 +108,7 @@ class SVX_DLLPUBLIC SvxBmpNumValueSet : public SvxNumValueSet ...@@ -108,7 +108,7 @@ class SVX_DLLPUBLIC SvxBmpNumValueSet : public SvxNumValueSet
public: public:
SvxBmpNumValueSet(Window* pParent, const ResId& rResId); SvxBmpNumValueSet(Window* pParent, const ResId& rResId);
SvxBmpNumValueSet(Window* pParent); SvxBmpNumValueSet(Window* pParent, WinBits nWinStyle);
~SvxBmpNumValueSet(); ~SvxBmpNumValueSet();
virtual void UserDraw( const UserDrawEvent& rUDEvt ); virtual void UserDraw( const UserDrawEvent& rUDEvt );
......
...@@ -408,8 +408,8 @@ SvxNumValueSet::SvxNumValueSet( Window* pParent, const ResId& rResId, sal_uInt16 ...@@ -408,8 +408,8 @@ SvxNumValueSet::SvxNumValueSet( Window* pParent, const ResId& rResId, sal_uInt16
init(nType); init(nType);
} }
SvxNumValueSet::SvxNumValueSet( Window* pParent, sal_uInt16 nType ) SvxNumValueSet::SvxNumValueSet( Window* pParent, WinBits nWinStyle, sal_uInt16 nType )
: ValueSet( pParent ) : ValueSet( pParent, nWinStyle )
{ {
init(nType); init(nType);
} }
...@@ -481,8 +481,8 @@ SvxBmpNumValueSet::SvxBmpNumValueSet( Window* pParent, const ResId& rResId ) ...@@ -481,8 +481,8 @@ SvxBmpNumValueSet::SvxBmpNumValueSet( Window* pParent, const ResId& rResId )
init(); init();
} }
SvxBmpNumValueSet::SvxBmpNumValueSet( Window* pParent ) SvxBmpNumValueSet::SvxBmpNumValueSet( Window* pParent, WinBits nWinStyle )
: SvxNumValueSet( pParent, NUM_PAGETYPE_BMP ) : SvxNumValueSet( pParent, nWinStyle, NUM_PAGETYPE_BMP )
{ {
init(); init();
} }
......
...@@ -68,7 +68,6 @@ ...@@ -68,7 +68,6 @@
#define HID_VS_NUM "SW_HID_VS_NUM" #define HID_VS_NUM "SW_HID_VS_NUM"
#define HID_VS_BULLET "SW_HID_VS_BULLET" #define HID_VS_BULLET "SW_HID_VS_BULLET"
#define HID_VS_NUMBMP "SW_HID_VS_NUMBMP" #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_INSERT_ABSTRACT "SW_HID_INSERT_ABSTRACT"
#define HID_NAVI_TBX1 "SW_HID_NAVI_TBX1" #define HID_NAVI_TBX1 "SW_HID_NAVI_TBX1"
#define HID_NAVI_TBX2 "SW_HID_NAVI_TBX2" #define HID_NAVI_TBX2 "SW_HID_NAVI_TBX2"
......
...@@ -31,26 +31,21 @@ class SwInsertGrfRulerDlg : public SfxModalDialog ...@@ -31,26 +31,21 @@ class SwInsertGrfRulerDlg : public SfxModalDialog
OKButton* m_pOkPB; OKButton* m_pOkPB;
SwRulerValueSet* m_pExampleVS; SwRulerValueSet* m_pExampleVS;
std::vector<String> aGrfNames; std::vector<OUString> m_aGrfNames;
String sSimple; OUString m_sSimple;
String sRulers;
sal_uInt16 nSelPos;
protected: protected:
DECL_LINK(SelectHdl, ValueSet*);
DECL_LINK(DoubleClickHdl, void *); DECL_LINK(DoubleClickHdl, void *);
public: public:
SwInsertGrfRulerDlg( Window* pParent ); SwInsertGrfRulerDlg(Window* pParent);
~SwInsertGrfRulerDlg(); ~SwInsertGrfRulerDlg();
String GetGraphicName(); OUString GetGraphicName() const;
sal_Bool IsSimpleLine() {return nSelPos == 1;} bool IsSimpleLine() const;
sal_Bool HasImages() const {return !aGrfNames.empty();} bool HasImages() const {return !m_aGrfNames.empty();}
}; };
#endif #endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -23,9 +23,8 @@ ...@@ -23,9 +23,8 @@
class SwRulerValueSet : public SvxBmpNumValueSet class SwRulerValueSet : public SvxBmpNumValueSet
{ {
public: public:
SwRulerValueSet( Window* pParent, SwRulerValueSet(Window* pParent, const ResId& rResId);
const ResId& rResId ); SwRulerValueSet(Window* pParent, WinBits nWinStyle);
SwRulerValueSet( Window* pParent );
~SwRulerValueSet(); ~SwRulerValueSet();
virtual void UserDraw( const UserDrawEvent& rUDEvt ); virtual void UserDraw( const UserDrawEvent& rUDEvt );
}; };
......
...@@ -43,33 +43,29 @@ ...@@ -43,33 +43,29 @@
SwInsertGrfRulerDlg::SwInsertGrfRulerDlg( Window* pParent ) SwInsertGrfRulerDlg::SwInsertGrfRulerDlg( Window* pParent )
: SfxModalDialog(pParent, "HorizontalRuleDialog", "modules/swriter/ui/horizontalrule.ui") : SfxModalDialog(pParent, "HorizontalRuleDialog", "modules/swriter/ui/horizontalrule.ui")
, sSimple(SW_RESSTR(STR_SIMPLE)) , m_sSimple(SW_RESSTR(STR_SIMPLE))
, nSelPos(USHRT_MAX)
{ {
get(m_pOkPB, "ok"); get(m_pOkPB, "ok");
get(m_pExampleVS, "rulers"); get(m_pExampleVS, "rulers");
m_pExampleVS->SetLineCount(6); m_pExampleVS->SetLineCount(6);
m_pExampleVS->SetColCount(1); m_pExampleVS->SetColCount(1);
m_pExampleVS->SetSelectHdl(LINK(this, SwInsertGrfRulerDlg, SelectHdl));
m_pExampleVS->SetDoubleClickHdl(LINK(this, SwInsertGrfRulerDlg, DoubleClickHdl)); m_pExampleVS->SetDoubleClickHdl(LINK(this, SwInsertGrfRulerDlg, DoubleClickHdl));
// determine graphic name // determine graphic name
GalleryExplorer::BeginLocking(GALLERY_THEME_RULERS); GalleryExplorer::BeginLocking(GALLERY_THEME_RULERS);
GalleryExplorer::FillObjList( GALLERY_THEME_RULERS, aGrfNames ); GalleryExplorer::FillObjList(GALLERY_THEME_RULERS, m_aGrfNames);
m_pExampleVS->SetHelpId(HID_VS_RULER);
Color aColor(COL_WHITE); Color aColor(COL_WHITE);
m_pExampleVS->InsertItem( 1, 1); m_pExampleVS->InsertItem(1, 1);
m_pExampleVS->SetItemText( 1, sSimple); 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->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->SelectItem(1);
m_pExampleVS->GrabFocus();
} }
SwInsertGrfRulerDlg::~SwInsertGrfRulerDlg() SwInsertGrfRulerDlg::~SwInsertGrfRulerDlg()
...@@ -77,22 +73,22 @@ SwInsertGrfRulerDlg::~SwInsertGrfRulerDlg() ...@@ -77,22 +73,22 @@ SwInsertGrfRulerDlg::~SwInsertGrfRulerDlg()
GalleryExplorer::EndLocking(GALLERY_THEME_RULERS); GalleryExplorer::EndLocking(GALLERY_THEME_RULERS);
} }
String SwInsertGrfRulerDlg::GetGraphicName() bool SwInsertGrfRulerDlg::IsSimpleLine() const
{ {
String sRet; return m_pExampleVS->GetSelectItemId() == 1;
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;
} }
IMPL_LINK(SwInsertGrfRulerDlg, SelectHdl, ValueSet*, pVS) OUString SwInsertGrfRulerDlg::GetGraphicName() const
{ {
nSelPos = pVS->GetSelectItemId(); sal_uInt16 nSelPos = m_pExampleVS->GetSelectItemId();
m_pOkPB->Enable();
return 0; 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 ) SwRulerValueSet::SwRulerValueSet( Window* pParent, const ResId& rResId )
...@@ -101,15 +97,15 @@ SwRulerValueSet::SwRulerValueSet( Window* pParent, const ResId& rResId ) ...@@ -101,15 +97,15 @@ SwRulerValueSet::SwRulerValueSet( Window* pParent, const ResId& rResId )
SetStyle(GetStyle() & ~WB_ITEMBORDER); SetStyle(GetStyle() & ~WB_ITEMBORDER);
} }
SwRulerValueSet::SwRulerValueSet(Window* pParent) SwRulerValueSet::SwRulerValueSet(Window* pParent, WinBits nWinStyle)
: SvxBmpNumValueSet(pParent) : SvxBmpNumValueSet(pParent, nWinStyle)
{ {
SetStyle(GetStyle() & ~WB_ITEMBORDER); SetStyle(GetStyle() & ~WB_ITEMBORDER);
} }
extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSwRulerValueSet(Window *pParent, VclBuilder::stringmap &) 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() SwRulerValueSet::~SwRulerValueSet()
......
...@@ -115,7 +115,8 @@ ...@@ -115,7 +115,8 @@
<object class="GtkLabel" id="label1"> <object class="GtkLabel" id="label1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</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> </object>
</child> </child>
</object> </object>
...@@ -220,7 +221,7 @@ ...@@ -220,7 +221,7 @@
<object class="GtkLabel" id="label2"> <object class="GtkLabel" id="label2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</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> <property name="use_markup">True</property>
</object> </object>
</child> </child>
...@@ -389,7 +390,7 @@ ...@@ -389,7 +390,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0.47999998927116394</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> <property name="use_markup">True</property>
</object> </object>
</child> </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