summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-06-13 16:31:39 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-06-14 09:53:36 +0200
commitfa5f3096c9f669a063fe81325b5b47c6903d94a5 (patch)
treeb081bb0adf711d96a13c27c27a6ecf3209a127d8 /cui
parent9c18b25f19855709cf4adddeefe4c9765f2f4f4f (diff)
weld SvxCharTwoLinesPage
Change-Id: I54a8963cd8b12f5fd51bf6b3bb791a4a15fbd13d Reviewed-on: https://gerrit.libreoffice.org/55766 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'cui')
-rw-r--r--cui/source/inc/chardlg.hxx23
-rw-r--r--cui/source/tabpages/chardlg.cxx130
-rw-r--r--cui/uiconfig/ui/twolinespage.ui117
3 files changed, 153 insertions, 117 deletions
diff --git a/cui/source/inc/chardlg.hxx b/cui/source/inc/chardlg.hxx
index fd46e3c3c334..489ea991b5a4 100644
--- a/cui/source/inc/chardlg.hxx
+++ b/cui/source/inc/chardlg.hxx
@@ -354,32 +354,31 @@ public:
// class SvxCharTwoLinesPage ---------------------------------------------
-class SvxCharTwoLinesPage : public SvxCharBasePage
+class SvxCharTwoLinesPage : public CharBasePage
{
friend class VclPtr<SvxCharTwoLinesPage>;
private:
static const sal_uInt16 pTwoLinesRanges[];
- VclPtr<CheckBox> m_pTwoLinesBtn;
- VclPtr<VclContainer> m_pEnclosingFrame;
- VclPtr<ListBox> m_pStartBracketLB;
- VclPtr<ListBox> m_pEndBracketLB;
-
sal_uInt16 m_nStartBracketPosition;
sal_uInt16 m_nEndBracketPosition;
- SvxCharTwoLinesPage(vcl::Window* pParent, const SfxItemSet& rSet);
+ std::unique_ptr<weld::CheckButton> m_xTwoLinesBtn;
+ std::unique_ptr<weld::Widget> m_xEnclosingFrame;
+ std::unique_ptr<weld::TreeView> m_xStartBracketLB;
+ std::unique_ptr<weld::TreeView> m_xEndBracketLB;
+
+ SvxCharTwoLinesPage(TabPageParent pParent, const SfxItemSet& rSet);
void UpdatePreview_Impl();
void Initialize();
- void SelectCharacter( ListBox* pBox );
- void SetBracket( sal_Unicode cBracket, bool bStart );
+ void SelectCharacter(weld::TreeView* pBox);
+ void SetBracket(sal_Unicode cBracket, bool bStart);
- DECL_LINK(TwoLinesHdl_Impl, Button*, void);
- DECL_LINK(CharacterMapHdl_Impl, ListBox&, void );
+ DECL_LINK(TwoLinesHdl_Impl, weld::ToggleButton&, void);
+ DECL_LINK(CharacterMapHdl_Impl, weld::TreeView&, void);
public:
virtual ~SvxCharTwoLinesPage() override;
- virtual void dispose() override;
using SfxTabPage::ActivatePage;
using SfxTabPage::DeactivatePage;
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index 22422651f504..c2b7a78eda83 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -3130,45 +3130,33 @@ void SvxCharPositionPage::PageCreated(const SfxAllItemSet& aSet)
}
// class SvxCharTwoLinesPage ------------------------------------------------
-SvxCharTwoLinesPage::SvxCharTwoLinesPage(vcl::Window* pParent, const SfxItemSet& rInSet)
- : SvxCharBasePage(pParent, "TwoLinesPage", "cui/ui/twolinespage.ui", rInSet)
+SvxCharTwoLinesPage::SvxCharTwoLinesPage(TabPageParent pParent, const SfxItemSet& rInSet)
+ : CharBasePage(pParent, "cui/ui/twolinespage.ui", "TwoLinesPage", rInSet)
, m_nStartBracketPosition( 0 )
, m_nEndBracketPosition( 0 )
+ , m_xTwoLinesBtn(m_xBuilder->weld_check_button("twolines"))
+ , m_xEnclosingFrame(m_xBuilder->weld_widget("enclosing"))
+ , m_xStartBracketLB(m_xBuilder->weld_tree_view("startbracket"))
+ , m_xEndBracketLB(m_xBuilder->weld_tree_view("endbracket"))
{
- get(m_pTwoLinesBtn, "twolines");
- get(m_pEnclosingFrame, "enclosing");
- get(m_pStartBracketLB, "startbracket");
- get(m_pEndBracketLB, "endbracket");
-
- get(m_pPreviewWin, "preview");
-
+ m_xPreviewWin.reset(new weld::CustomWeld(*m_xBuilder, "preview", m_aPreviewWin));
Initialize();
}
SvxCharTwoLinesPage::~SvxCharTwoLinesPage()
{
- disposeOnce();
-}
-
-void SvxCharTwoLinesPage::dispose()
-{
- m_pTwoLinesBtn.clear();
- m_pEnclosingFrame.clear();
- m_pStartBracketLB.clear();
- m_pEndBracketLB.clear();
- SvxCharBasePage::dispose();
}
void SvxCharTwoLinesPage::Initialize()
{
- m_pTwoLinesBtn->Check( false );
- TwoLinesHdl_Impl( nullptr );
+ m_xTwoLinesBtn->set_active(false);
+ TwoLinesHdl_Impl(*m_xTwoLinesBtn);
- m_pTwoLinesBtn->SetClickHdl( LINK( this, SvxCharTwoLinesPage, TwoLinesHdl_Impl ) );
+ m_xTwoLinesBtn->connect_toggled(LINK(this, SvxCharTwoLinesPage, TwoLinesHdl_Impl));
- Link<ListBox&,void> aLink = LINK( this, SvxCharTwoLinesPage, CharacterMapHdl_Impl );
- m_pStartBracketLB->SetSelectHdl( aLink );
- m_pEndBracketLB->SetSelectHdl( aLink );
+ Link<weld::TreeView&,void> aLink = LINK(this, SvxCharTwoLinesPage, CharacterMapHdl_Impl);
+ m_xStartBracketLB->connect_changed(aLink);
+ m_xEndBracketLB->connect_changed(aLink);
SvxFont& rFont = GetPreviewFont();
SvxFont& rCJKFont = GetPreviewCJKFont();
@@ -3178,10 +3166,9 @@ void SvxCharTwoLinesPage::Initialize()
rCTLFont.SetFontSize( Size( 0, 220 ) );
}
-
-void SvxCharTwoLinesPage::SelectCharacter( ListBox* pBox )
+void SvxCharTwoLinesPage::SelectCharacter(weld::TreeView* pBox)
{
- bool bStart = pBox == m_pStartBracketLB;
+ bool bStart = pBox == m_xStartBracketLB.get();
SvxCharacterMap aDlg(GetFrameWeld(), nullptr, false);
aDlg.DisableFontSelection();
@@ -3192,28 +3179,28 @@ void SvxCharTwoLinesPage::SelectCharacter( ListBox* pBox )
}
else
{
- pBox->SelectEntryPos( bStart ? m_nStartBracketPosition : m_nEndBracketPosition );
+ pBox->select(bStart ? m_nStartBracketPosition : m_nEndBracketPosition);
}
}
void SvxCharTwoLinesPage::SetBracket( sal_Unicode cBracket, bool bStart )
{
- sal_Int32 nEntryPos = 0;
- ListBox* pBox = bStart ? m_pStartBracketLB.get() : m_pEndBracketLB.get();
- if ( 0 == cBracket )
- pBox->SelectEntryPos(0);
+ int nEntryPos = 0;
+ weld::TreeView* pBox = bStart ? m_xStartBracketLB.get() : m_xEndBracketLB.get();
+ if (cBracket == 0)
+ pBox->select(0);
else
{
bool bFound = false;
- for ( sal_Int32 i = 1; i < pBox->GetEntryCount(); ++i )
+ for (int i = 1; i < pBox->n_children(); ++i)
{
- if ( reinterpret_cast<sal_uLong>(pBox->GetEntryData(i)) != CHRDLG_ENCLOSE_SPECIAL_CHAR )
+ if (pBox->get_id(i).toInt32() != CHRDLG_ENCLOSE_SPECIAL_CHAR)
{
- const sal_Unicode cChar = pBox->GetEntry(i)[0];
- if ( cChar == cBracket )
+ const sal_Unicode cChar = pBox->get_text(i)[0];
+ if (cChar == cBracket)
{
- pBox->SelectEntryPos(i);
+ pBox->select(i);
nEntryPos = i;
bFound = true;
break;
@@ -3221,37 +3208,35 @@ void SvxCharTwoLinesPage::SetBracket( sal_Unicode cBracket, bool bStart )
}
}
- if ( !bFound )
+ if (!bFound)
{
- nEntryPos = pBox->InsertEntry( OUString(cBracket) );
- pBox->SelectEntryPos( nEntryPos );
+ pBox->append_text(OUString(cBracket));
+ nEntryPos = pBox->n_children() - 1;
+ pBox->select(nEntryPos);
}
}
- if( bStart )
+ if (bStart)
m_nStartBracketPosition = nEntryPos;
else
m_nEndBracketPosition = nEntryPos;
}
-
-IMPL_LINK_NOARG(SvxCharTwoLinesPage, TwoLinesHdl_Impl, Button*, void)
+IMPL_LINK_NOARG(SvxCharTwoLinesPage, TwoLinesHdl_Impl, weld::ToggleButton&, void)
{
- bool bChecked = m_pTwoLinesBtn->IsChecked();
- m_pEnclosingFrame->Enable( bChecked );
-
+ bool bChecked = m_xTwoLinesBtn->get_active();
+ m_xEnclosingFrame->set_sensitive(bChecked);
UpdatePreview_Impl();
}
-
-IMPL_LINK( SvxCharTwoLinesPage, CharacterMapHdl_Impl, ListBox&, rBox, void )
+IMPL_LINK(SvxCharTwoLinesPage, CharacterMapHdl_Impl, weld::TreeView&, rBox, void)
{
- sal_Int32 nPos = rBox.GetSelectedEntryPos();
- if ( CHRDLG_ENCLOSE_SPECIAL_CHAR == reinterpret_cast<sal_uLong>(rBox.GetEntryData( nPos )) )
+ int nPos = rBox.get_selected_index();
+ if (rBox.get_id(nPos).toInt32() == CHRDLG_ENCLOSE_SPECIAL_CHAR)
SelectCharacter( &rBox );
else
{
- bool bStart = &rBox == m_pStartBracketLB;
- if( bStart )
+ bool bStart = &rBox == m_xStartBracketLB.get();
+ if (bStart)
m_nStartBracketPosition = nPos;
else
m_nEndBracketPosition = nPos;
@@ -3259,13 +3244,11 @@ IMPL_LINK( SvxCharTwoLinesPage, CharacterMapHdl_Impl, ListBox&, rBox, void )
UpdatePreview_Impl();
}
-
void SvxCharTwoLinesPage::ActivatePage( const SfxItemSet& rSet )
{
- SvxCharBasePage::ActivatePage( rSet );
+ CharBasePage::ActivatePage(rSet);
}
-
DeactivateRC SvxCharTwoLinesPage::DeactivatePage( SfxItemSet* _pSet )
{
if ( _pSet )
@@ -3273,22 +3256,21 @@ DeactivateRC SvxCharTwoLinesPage::DeactivatePage( SfxItemSet* _pSet )
return DeactivateRC::LeavePage;
}
-
-VclPtr<SfxTabPage> SvxCharTwoLinesPage::Create( TabPageParent pParent, const SfxItemSet* rSet )
+VclPtr<SfxTabPage> SvxCharTwoLinesPage::Create(TabPageParent pParent, const SfxItemSet* rSet)
{
- return VclPtr<SvxCharTwoLinesPage>::Create( pParent.pParent, *rSet );
+ return VclPtr<SvxCharTwoLinesPage>::Create(pParent, *rSet);
}
void SvxCharTwoLinesPage::Reset( const SfxItemSet* rSet )
{
- m_pTwoLinesBtn->Check( false );
+ m_xTwoLinesBtn->set_active(false);
sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_TWO_LINES );
SfxItemState eState = rSet->GetItemState( nWhich );
if ( eState >= SfxItemState::DONTCARE )
{
const SvxTwoLinesItem& rItem = static_cast<const SvxTwoLinesItem&>(rSet->Get( nWhich ));
- m_pTwoLinesBtn->Check( rItem.GetValue() );
+ m_xTwoLinesBtn->set_active(rItem.GetValue());
if ( rItem.GetValue() )
{
@@ -3296,7 +3278,7 @@ void SvxCharTwoLinesPage::Reset( const SfxItemSet* rSet )
SetBracket( rItem.GetEndBracket(), false );
}
}
- TwoLinesHdl_Impl( nullptr );
+ TwoLinesHdl_Impl(*m_xTwoLinesBtn);
SetPrevFontWidthScale( *rSet );
}
@@ -3307,11 +3289,11 @@ bool SvxCharTwoLinesPage::FillItemSet( SfxItemSet* rSet )
bool bModified = false, bChanged = true;
sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_TWO_LINES );
const SfxPoolItem* pOld = GetOldItem( *rSet, SID_ATTR_CHAR_TWO_LINES );
- bool bOn = m_pTwoLinesBtn->IsChecked();
- sal_Unicode cStart = ( bOn && m_pStartBracketLB->GetSelectedEntryPos() > 0 )
- ? m_pStartBracketLB->GetSelectedEntry()[0] : 0;
- sal_Unicode cEnd = ( bOn && m_pEndBracketLB->GetSelectedEntryPos() > 0 )
- ? m_pEndBracketLB->GetSelectedEntry()[0] : 0;
+ bool bOn = m_xTwoLinesBtn->get_active();
+ sal_Unicode cStart = ( bOn && m_xStartBracketLB->get_selected_index() > 0 )
+ ? m_xStartBracketLB->get_selected_text()[0] : 0;
+ sal_Unicode cEnd = ( bOn && m_xEndBracketLB->get_selected_index() > 0 )
+ ? m_xEndBracketLB->get_selected_text()[0] : 0;
if ( pOld )
{
@@ -3334,13 +3316,13 @@ bool SvxCharTwoLinesPage::FillItemSet( SfxItemSet* rSet )
void SvxCharTwoLinesPage::UpdatePreview_Impl()
{
- sal_Unicode cStart = m_pStartBracketLB->GetSelectedEntryPos() > 0
- ? m_pStartBracketLB->GetSelectedEntry()[0] : 0;
- sal_Unicode cEnd = m_pEndBracketLB->GetSelectedEntryPos() > 0
- ? m_pEndBracketLB->GetSelectedEntry()[0] : 0;
- m_pPreviewWin->SetBrackets(cStart, cEnd);
- m_pPreviewWin->SetTwoLines(m_pTwoLinesBtn->IsChecked());
- m_pPreviewWin->Invalidate();
+ sal_Unicode cStart = m_xStartBracketLB->get_selected_index() > 0
+ ? m_xStartBracketLB->get_selected_text()[0] : 0;
+ sal_Unicode cEnd = m_xEndBracketLB->get_selected_index() > 0
+ ? m_xEndBracketLB->get_selected_text()[0] : 0;
+ m_aPreviewWin.SetBrackets(cStart, cEnd);
+ m_aPreviewWin.SetTwoLines(m_xTwoLinesBtn->get_active());
+ m_aPreviewWin.Invalidate();
}
void SvxCharTwoLinesPage::PageCreated(const SfxAllItemSet& aSet)
diff --git a/cui/uiconfig/ui/twolinespage.ui b/cui/uiconfig/ui/twolinespage.ui
index e3a5fac7b77c..e5cb2f908de9 100644
--- a/cui/uiconfig/ui/twolinespage.ui
+++ b/cui/uiconfig/ui/twolinespage.ui
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.20.4 -->
<interface domain="cui">
- <!-- interface-requires gtk+ 3.0 -->
- <!-- interface-requires LibreOffice 1.0 -->
+ <requires lib="gtk+" version="3.18"/>
<object class="GtkListStore" id="liststore1">
<columns>
- <!-- column-name gchararray1 -->
+ <!-- column-name text -->
+ <column type="gchararray"/>
+ <!-- column-name id -->
<column type="gchararray"/>
- <!-- column-name gint1 -->
- <column type="gint"/>
</columns>
<data>
<row>
@@ -38,10 +38,10 @@
</object>
<object class="GtkListStore" id="liststore2">
<columns>
- <!-- column-name gchararray1 -->
+ <!-- column-name text -->
+ <column type="gchararray"/>
+ <!-- column-name id -->
<column type="gchararray"/>
- <!-- column-name gint1 -->
- <column type="gint"/>
</columns>
<data>
<row>
@@ -145,8 +145,6 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -158,42 +156,84 @@
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
- <object class="GtkTreeView" id="startbracket:border">
+ <object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="model">liststore1</property>
- <property name="search_column">0</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection" id="treeview-selection5"/>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="startbracket">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="model">liststore1</property>
+ <property name="headers_visible">False</property>
+ <property name="headers_clickable">False</property>
+ <property name="search_column">0</property>
+ <property name="show_expanders">False</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="treeview-selection1"/>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn1">
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext1"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
- <object class="GtkTreeView" id="endbracket:border">
+ <object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="model">liststore2</property>
- <property name="search_column">0</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection" id="treeview-selection6"/>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="endbracket">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="model">liststore2</property>
+ <property name="headers_visible">False</property>
+ <property name="headers_clickable">False</property>
+ <property name="search_column">0</property>
+ <property name="show_expanders">False</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="treeview-selection2"/>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn2">
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext2"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
</object>
@@ -226,12 +266,27 @@
<property name="left_padding">12</property>
<property name="right_padding">12</property>
<child>
- <object class="svxlo-SvxFontPrevWindow" id="preview:border">
+ <object class="GtkScrolledWindow">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="preview:border-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes" context="twolinespage|preview-atkobject">Preview</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">never</property>
+ <property name="vscrollbar_policy">never</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkViewport">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkDrawingArea" id="preview">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="preview-atkobject">
+ <property name="AtkObject::accessible-name" translatable="yes" context="twolinespage|preview-atkobject">Preview</property>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
</child>
</object>