Kaydet (Commit) 3b493525 authored tarafından Caolán McNamara's avatar Caolán McNamara

weld SvxLineDefTabPage

Change-Id: I7a7f421190c89cec8e1a772015b7544d60b26298
Reviewed-on: https://gerrit.libreoffice.org/61158
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 64d764e0
......@@ -242,22 +242,6 @@ class SvxLineDefTabPage : public SfxTabPage
using TabPage::ActivatePage;
using TabPage::DeactivatePage;
private:
VclPtr<LineLB> m_pLbLineStyles;
VclPtr<ListBox> m_pLbType1;
VclPtr<ListBox> m_pLbType2;
VclPtr<NumericField> m_pNumFldNumber1;
VclPtr<NumericField> m_pNumFldNumber2;
VclPtr<MetricField> m_pMtrLength1;
VclPtr<MetricField> m_pMtrLength2;
VclPtr<MetricField> m_pMtrDistance;
VclPtr<CheckBox> m_pCbxSynchronize;
VclPtr<PushButton> m_pBtnAdd;
VclPtr<PushButton> m_pBtnModify;
VclPtr<PushButton> m_pBtnDelete;
VclPtr<PushButton> m_pBtnLoad;
VclPtr<PushButton> m_pBtnSave;
VclPtr<SvxXLinePreview> m_pCtlPreview;
const SfxItemSet& rOutAttrs;
XDash aDash;
......@@ -274,27 +258,45 @@ private:
MapUnit ePoolUnit;
FieldUnit eFUnit;
XLinePreview m_aCtlPreview;
std::unique_ptr<SvxLineLB> m_xLbLineStyles;
std::unique_ptr<weld::ComboBox> m_xLbType1;
std::unique_ptr<weld::ComboBox> m_xLbType2;
std::unique_ptr<weld::SpinButton> m_xNumFldNumber1;
std::unique_ptr<weld::SpinButton> m_xNumFldNumber2;
std::unique_ptr<weld::MetricSpinButton> m_xMtrLength1;
std::unique_ptr<weld::MetricSpinButton> m_xMtrLength2;
std::unique_ptr<weld::MetricSpinButton> m_xMtrDistance;
std::unique_ptr<weld::CheckButton> m_xCbxSynchronize;
std::unique_ptr<weld::Button> m_xBtnAdd;
std::unique_ptr<weld::Button> m_xBtnModify;
std::unique_ptr<weld::Button> m_xBtnDelete;
std::unique_ptr<weld::Button> m_xBtnLoad;
std::unique_ptr<weld::Button> m_xBtnSave;
std::unique_ptr<weld::CustomWeld> m_xCtlPreview;
void FillDash_Impl();
void FillDialog_Impl();
DECL_LINK( ClickAddHdl_Impl, Button*, void );
DECL_LINK( ClickModifyHdl_Impl, Button*, void );
DECL_LINK( ClickDeleteHdl_Impl, Button*, void );
DECL_LINK( SelectLinestyleListBoxHdl_Impl, ListBox&, void );
void SelectLinestyleHdl_Impl(ListBox const *);
DECL_LINK( ChangePreviewHdl_Impl, Edit&, void );
DECL_LINK( ChangeNumber1Hdl_Impl, Edit&, void );
DECL_LINK( ChangeNumber2Hdl_Impl, Edit&, void );
DECL_LINK( ClickLoadHdl_Impl, Button*, void );
DECL_LINK( ClickSaveHdl_Impl, Button*, void );
DECL_LINK( ChangeMetricHdl_Impl, Button*, void );
DECL_LINK( SelectTypeListBoxHdl_Impl, ListBox&, void );
void SelectTypeHdl_Impl(ListBox*);
DECL_LINK(ClickAddHdl_Impl, weld::Button&, void);
DECL_LINK(ClickModifyHdl_Impl, weld::Button&, void);
DECL_LINK(ClickDeleteHdl_Impl, weld::Button&, void);
DECL_LINK(SelectLinestyleListBoxHdl_Impl, weld::ComboBox&, void);
void SelectLinestyleHdl_Impl(const weld::ComboBox*);
DECL_LINK(ChangePreviewHdl_Impl, weld::MetricSpinButton&, void);
DECL_LINK(ChangeNumber1Hdl_Impl, weld::SpinButton&, void);
DECL_LINK(ChangeNumber2Hdl_Impl, weld::SpinButton&, void);
DECL_LINK(ClickLoadHdl_Impl, weld::Button&, void);
DECL_LINK(ClickSaveHdl_Impl, weld::Button&, void);
DECL_LINK(ChangeMetricHdl_Impl, weld::ToggleButton&, void);
DECL_LINK(SelectTypeListBoxHdl_Impl, weld::ComboBox&, void);
void SelectTypeHdl_Impl(weld::ComboBox*);
void ChangeMetricHdl_Impl(weld::ToggleButton*);
void CheckChanges_Impl();
public:
SvxLineDefTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs );
SvxLineDefTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs);
virtual ~SvxLineDefTabPage() override;
virtual void dispose() override;
......
......@@ -91,7 +91,7 @@
<child>
<object class="GtkEntry" id="EDT_NAME">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can_focus">True</property>
<property name="halign">start</property>
<property name="hexpand">True</property>
<property name="width_chars">30</property>
......@@ -148,7 +148,7 @@
<object class="GtkButton" id="BTN_ADD">
<property name="label">gtk-add</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
......@@ -163,7 +163,7 @@
<object class="GtkButton" id="BTN_MODIFY">
<property name="label" translatable="yes" context="lineendstabpage|BTN_MODIFY">_Modify</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
</object>
......@@ -177,7 +177,7 @@
<object class="GtkButton" id="BTN_DELETE">
<property name="label">gtk-delete</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
......
......@@ -268,6 +268,34 @@ public:
void Modify(const XDashEntry& rEntry, sal_Int32 nPos, const BitmapEx& rBitmap );
};
class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxLineLB
{
private:
std::unique_ptr<weld::ComboBox> m_xControl;
/// defines if standard fields (none, solid) are added, default is true
bool mbAddStandardFields : 1;
public:
SvxLineLB(std::unique_ptr<weld::ComboBox> pControl);
void Fill(const XDashListRef &pList);
bool getAddStandardFields() const { return mbAddStandardFields; }
void setAddStandardFields(bool bNew);
void Append(const XDashEntry& rEntry, const BitmapEx& rBitmap );
void Modify(const XDashEntry& rEntry, sal_Int32 nPos, const BitmapEx& rBitmap );
void clear() { m_xControl->clear(); }
void remove(int nPos) { m_xControl->remove(nPos); }
int get_active() const { return m_xControl->get_active(); }
void set_active(int nPos) { m_xControl->set_active(nPos); }
void set_active_text(const OUString& rStr) { m_xControl->set_active_text(rStr); }
OUString get_active_text() const { return m_xControl->get_active_text(); }
void connect_changed(const Link<weld::ComboBox&, void>& rLink) { m_xControl->connect_changed(rLink); }
int get_count() const { return m_xControl->get_count(); }
};
/************************************************************************/
class SAL_WARN_UNUSED SVX_DLLPUBLIC LineEndLB : public ListBox
......@@ -299,6 +327,7 @@ public:
void remove(int nPos) { m_xControl->remove(nPos); }
int get_active() const { return m_xControl->get_active(); }
void set_active(int nPos) { m_xControl->set_active(nPos); }
void set_active_text(const OUString& rStr) { m_xControl->set_active_text(rStr); }
OUString get_active_text() const { return m_xControl->get_active_text(); }
void connect_changed(const Link<weld::ComboBox&, void>& rLink) { m_xControl->connect_changed(rLink); }
int get_count() const { return m_xControl->get_count(); }
......
......@@ -764,6 +764,11 @@ public:
return convert_value_to(m_xSpinButton->get_value(), eDestUnit);
}
// typically you only need to call this if set_text (e.g. with "") was
// previously called to display some arbitrary text instead of the
// formatted value and now you want to show it as formattted again
void reformat() { set_value(get_value(m_eSrcUnit), m_eSrcUnit); }
void set_range(int min, int max, FieldUnit eValueUnit)
{
min = convert_value_from(min, eValueUnit);
......
......@@ -265,11 +265,9 @@ cui/uiconfig/ui/linetabpage.ui://GtkSpinButton[@id='MF_SYMBOL_HEIGHT:0cm'] no-la
cui/uiconfig/ui/lineendstabpage.ui://GtkLabel[@id='FT_LINE_END_STYLE'] orphan-label
cui/uiconfig/ui/lineendstabpage.ui://svxlo-LineEndLB[@id='LB_LINEENDS'] no-labelled-by
cui/uiconfig/ui/lineendstabpage.ui://GtkLabel[@id='FI_TIP'] orphan-label
cui/uiconfig/ui/linestyletabpage.ui://GtkLabel[@id='FT_LINESTYLE'] orphan-label
cui/uiconfig/ui/linestyletabpage.ui://svxlo-LineLB[@id='LB_LINESTYLES'] no-labelled-by
cui/uiconfig/ui/linestyletabpage.ui://GtkComboBox[@id='LB_TYPE_2'] no-labelled-by
cui/uiconfig/ui/linestyletabpage.ui://GtkSpinButton[@id='NUM_FLD_2'] no-labelled-by
cui/uiconfig/ui/linestyletabpage.ui://GtkSpinButton[@id='MTR_FLD_LENGTH_2:0.00cm'] no-labelled-by
cui/uiconfig/ui/linestyletabpage.ui://GtkSpinButton[@id='MTR_FLD_LENGTH_2'] no-labelled-by
cui/uiconfig/ui/macroassignpage.ui://cuilo-MacroEventListBox[@id='assignments:border'] no-labelled-by
cui/uiconfig/ui/macroassignpage.ui://GtkLabel[@id='eventft'] orphan-label
cui/uiconfig/ui/macroassignpage.ui://GtkLabel[@id='assignft'] orphan-label
......
......@@ -1076,6 +1076,105 @@ void LineLB::Modify( const XDashEntry& rEntry, sal_Int32 nPos, const BitmapEx& r
}
}
SvxLineLB::SvxLineLB(std::unique_ptr<weld::ComboBox> pControl)
: m_xControl(std::move(pControl))
, mbAddStandardFields(true)
{
}
void SvxLineLB::setAddStandardFields(bool bNew)
{
if(getAddStandardFields() != bNew)
{
mbAddStandardFields = bNew;
}
}
// Fills the listbox (provisional) with strings
void SvxLineLB::Fill( const XDashListRef &pList )
{
m_xControl->clear();
if( !pList.is() )
return;
ScopedVclPtrInstance< VirtualDevice > pVD;
if(getAddStandardFields())
{
// entry for 'none'
m_xControl->append_text(pList->GetStringForUiNoLine());
// entry for solid line
const BitmapEx aBitmap = pList->GetBitmapForUISolidLine();
const Size aBmpSize(aBitmap.GetSizePixel());
pVD->SetOutputSizePixel(aBmpSize, false);
pVD->DrawBitmapEx(Point(), aBitmap);
m_xControl->append("", pList->GetStringForUiSolidLine(), *pVD);
}
// entries for dashed lines
long nCount = pList->Count();
m_xControl->freeze();
for( long i = 0; i < nCount; i++ )
{
const XDashEntry* pEntry = pList->GetDash(i);
const BitmapEx aBitmap = pList->GetUiBitmap( i );
if( !aBitmap.IsEmpty() )
{
const Size aBmpSize(aBitmap.GetSizePixel());
pVD->SetOutputSizePixel(aBmpSize, false);
pVD->DrawBitmapEx(Point(), aBitmap);
m_xControl->append("", pEntry->GetName(), *pVD);
}
else
{
m_xControl->append_text(pEntry->GetName());
}
}
m_xControl->thaw();
}
void SvxLineLB::Append( const XDashEntry& rEntry, const BitmapEx& rBitmap )
{
if (!rBitmap.IsEmpty())
{
ScopedVclPtrInstance< VirtualDevice > pVD;
const Size aBmpSize(rBitmap.GetSizePixel());
pVD->SetOutputSizePixel(aBmpSize, false);
pVD->DrawBitmapEx(Point(), rBitmap);
m_xControl->append("", rEntry.GetName(), *pVD);
}
else
{
m_xControl->append_text(rEntry.GetName());
}
}
void SvxLineLB::Modify(const XDashEntry& rEntry, sal_Int32 nPos, const BitmapEx& rBitmap)
{
m_xControl->remove(nPos);
if (!rBitmap.IsEmpty())
{
ScopedVclPtrInstance< VirtualDevice > pVD;
const Size aBmpSize(rBitmap.GetSizePixel());
pVD->SetOutputSizePixel(aBmpSize, false);
pVD->DrawBitmapEx(Point(), rBitmap);
m_xControl->insert(nPos, "", rEntry.GetName(), nullptr, pVD);
}
else
{
m_xControl->insert_text(nPos, rEntry.GetName());
}
}
// Fills the listbox (provisional) with strings
LineEndLB::LineEndLB( vcl::Window* pParent, WinBits aWB )
......
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