diff options
-rw-r--r-- | include/vcl/weld.hxx | 3 | ||||
-rw-r--r-- | sw/inc/swabstdlg.hxx | 2 | ||||
-rw-r--r-- | sw/source/ui/dialog/swdlgfact.cxx | 25 | ||||
-rw-r--r-- | sw/source/ui/dialog/swdlgfact.hxx | 11 | ||||
-rw-r--r-- | sw/source/ui/misc/insfnote.cxx | 223 | ||||
-rw-r--r-- | sw/source/uibase/inc/insfnote.hxx | 71 | ||||
-rw-r--r-- | sw/source/uibase/shells/textsh1.cxx | 6 | ||||
-rw-r--r-- | sw/source/uibase/uiview/viewdlg2.cxx | 2 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/insertfootnote.ui | 22 | ||||
-rw-r--r-- | vcl/inc/unx/gtk/gtkinst.hxx | 2 | ||||
-rw-r--r-- | vcl/source/app/salvtables.cxx | 10 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 84 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx | 5 |
13 files changed, 284 insertions, 182 deletions
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 52585c65b506..74ce9a7ab37d 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -409,6 +409,9 @@ public: virtual void set_position(int nCursorPos) = 0; virtual void set_editable(bool bEditable) = 0; + virtual vcl::Font get_font() = 0; + virtual void set_font(const vcl::Font& rFont) = 0; + void connect_changed(const Link<Entry&, void>& rLink) { m_aChangeHdl = rLink; } void connect_insert_text(const Link<OUString&, bool>& rLink) { m_aInsertTextHdl = rLink; } diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx index a72a8f17fde1..8e35a4114fc9 100644 --- a/sw/inc/swabstdlg.hxx +++ b/sw/inc/swabstdlg.hxx @@ -462,7 +462,7 @@ public: SwWrtShell *pWrtShell) = 0; virtual VclPtr<AbstractFieldInputDlg> CreateFieldInputDlg(vcl::Window *pParent, SwWrtShell &rSh, SwField* pField, bool bPrevButton, bool bNextButton) = 0; - virtual VclPtr<AbstractInsFootNoteDlg> CreateInsFootNoteDlg(vcl::Window * pParent, + virtual VclPtr<AbstractInsFootNoteDlg> CreateInsFootNoteDlg(weld::Window * pParent, SwWrtShell &rSh, bool bEd = false) = 0; virtual VclPtr<VclAbstractDialog> CreateTitlePageDlg ( vcl::Window * pParent ) = 0; virtual VclPtr<VclAbstractDialog> CreateVclSwViewDialog(SwView& rView) = 0; diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index b105bd332808..880792e93a84 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -145,11 +145,17 @@ short AbstractSwRenameXNamedDlg_Impl::Execute() IMPL_ABSTDLG_BASE(AbstractSwModalRedlineAcceptDlg_Impl); IMPL_ABSTDLG_BASE(AbstractGlossaryDlg_Impl); IMPL_ABSTDLG_BASE(AbstractFieldInputDlg_Impl); -IMPL_ABSTDLG_BASE(AbstractInsFootNoteDlg_Impl); + +short AbstractInsFootNoteDlg_Impl::Execute() +{ + return m_xDlg->execute(); +} + short AbstractInsTableDlg_Impl::Execute() { return m_xDlg->run(); } + IMPL_ABSTDLG_BASE(AbstractJavaEditDialog_Impl); IMPL_ABSTDLG_BASE(AbstractMailMergeDlg_Impl); IMPL_ABSTDLG_BASE(AbstractMailMergeCreateFromDlg_Impl); @@ -456,27 +462,27 @@ bool AbstractFieldInputDlg_Impl::NextButtonPressed() const OUString AbstractInsFootNoteDlg_Impl::GetFontName() { - return pDlg->GetFontName(); + return m_xDlg->GetFontName(); } bool AbstractInsFootNoteDlg_Impl::IsEndNote() { - return pDlg->IsEndNote(); + return m_xDlg->IsEndNote(); } OUString AbstractInsFootNoteDlg_Impl::GetStr() { - return pDlg->GetStr(); + return m_xDlg->GetStr(); } -void AbstractInsFootNoteDlg_Impl::SetHelpId( const OString& sHelpId ) +void AbstractInsFootNoteDlg_Impl::SetHelpId(const OString& rHelpId) { - pDlg->SetHelpId( sHelpId ); + m_xDlg->set_help_id(rHelpId); } void AbstractInsFootNoteDlg_Impl::SetText( const OUString& rStr ) { - pDlg->SetText( rStr ); + m_xDlg->set_title(rStr); } void AbstractInsTableDlg_Impl::GetValues( OUString& rName, sal_uInt16& rRow, sal_uInt16& rCol, @@ -928,10 +934,9 @@ VclPtr<AbstractFieldInputDlg> SwAbstractDialogFactory_Impl::CreateFieldInputDlg( } VclPtr<AbstractInsFootNoteDlg> SwAbstractDialogFactory_Impl::CreateInsFootNoteDlg( - vcl::Window * pParent, SwWrtShell &rSh, bool bEd ) + weld::Window * pParent, SwWrtShell &rSh, bool bEd ) { - VclPtr<SwInsFootNoteDlg> pDlg = VclPtr<SwInsFootNoteDlg>::Create(pParent, rSh, bEd); - return VclPtr<AbstractInsFootNoteDlg_Impl>::Create( pDlg ); + return VclPtr<AbstractInsFootNoteDlg_Impl>::Create(new SwInsFootNoteDlg(pParent, rSh, bEd)); } VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateTitlePageDlg ( vcl::Window *pParent ) diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index 363f110362d4..503049b63f8b 100644 --- a/sw/source/ui/dialog/swdlgfact.hxx +++ b/sw/source/ui/dialog/swdlgfact.hxx @@ -354,7 +354,14 @@ class AbstractFieldInputDlg_Impl : public AbstractFieldInputDlg class SwInsFootNoteDlg; class AbstractInsFootNoteDlg_Impl : public AbstractInsFootNoteDlg { - DECL_ABSTDLG_BASE(AbstractInsFootNoteDlg_Impl,SwInsFootNoteDlg) +protected: + std::unique_ptr<SwInsFootNoteDlg> m_xDlg; +public: + explicit AbstractInsFootNoteDlg_Impl(SwInsFootNoteDlg* p) + : m_xDlg(p) + { + } + virtual short Execute() override; virtual OUString GetFontName() override; virtual bool IsEndNote() override; virtual OUString GetStr() override; @@ -563,7 +570,7 @@ public: virtual VclPtr<AbstractFieldInputDlg> CreateFieldInputDlg(vcl::Window *pParent, SwWrtShell &rSh, SwField* pField, bool bPrevButton, bool bNextButton) override; virtual VclPtr<AbstractInsFootNoteDlg> CreateInsFootNoteDlg( - vcl::Window * pParent, SwWrtShell &rSh, bool bEd = false) override; + weld::Window * pParent, SwWrtShell &rSh, bool bEd = false) override; virtual VclPtr<VclAbstractDialog> CreateTitlePageDlg ( vcl::Window * pParent ) override; virtual VclPtr<VclAbstractDialog> CreateVclSwViewDialog(SwView& rView) override; virtual VclPtr<AbstractInsTableDlg> CreateInsTableDlg(SwView& rView) override; diff --git a/sw/source/ui/misc/insfnote.cxx b/sw/source/ui/misc/insfnote.cxx index 9a3aea7d3953..19dc1c01c0c8 100644 --- a/sw/source/ui/misc/insfnote.cxx +++ b/sw/source/ui/misc/insfnote.cxx @@ -43,169 +43,149 @@ static bool bFootnote = true; void SwInsFootNoteDlg::Apply() { OUString aStr; - if ( m_pNumberCharBtn->IsChecked() ) - aStr = m_pNumberCharEdit->GetText(); + if ( m_xNumberCharBtn->get_active() ) + aStr = m_xNumberCharEdit->get_text(); - if ( bEdit ) + if (m_bEdit) { - rSh.StartAction(); - rSh.Left(CRSR_SKIP_CHARS, false, 1, false ); - rSh.StartUndo( SwUndoId::START ); - SwFormatFootnote aNote( m_pEndNoteBtn->IsChecked() ); + m_rSh.StartAction(); + m_rSh.Left(CRSR_SKIP_CHARS, false, 1, false ); + m_rSh.StartUndo( SwUndoId::START ); + SwFormatFootnote aNote( m_xEndNoteBtn->get_active() ); aNote.SetNumStr( aStr ); - if( rSh.SetCurFootnote( aNote ) && bExtCharAvailable ) + if (m_rSh.SetCurFootnote( aNote ) && m_bExtCharAvailable) { - rSh.Right(CRSR_SKIP_CHARS, true, 1, false ); - SfxItemSet aSet( rSh.GetAttrPool(), svl::Items<RES_CHRATR_FONT, RES_CHRATR_FONT>{} ); - rSh.GetCurAttr( aSet ); + m_rSh.Right(CRSR_SKIP_CHARS, true, 1, false ); + SfxItemSet aSet(m_rSh.GetAttrPool(), svl::Items<RES_CHRATR_FONT, RES_CHRATR_FONT>{}); + m_rSh.GetCurAttr(aSet); const SvxFontItem &rFont = aSet.Get( RES_CHRATR_FONT ); SvxFontItem aFont( rFont.GetFamily(), m_aFontName, rFont.GetStyleName(), rFont.GetPitch(), - eCharSet, RES_CHRATR_FONT ); + m_eCharSet, RES_CHRATR_FONT ); aSet.Put( aFont ); - rSh.SetAttrSet( aSet, SetAttrMode::DONTEXPAND ); - rSh.ResetSelect(nullptr, false); - rSh.Left(CRSR_SKIP_CHARS, false, 1, false ); + m_rSh.SetAttrSet( aSet, SetAttrMode::DONTEXPAND ); + m_rSh.ResetSelect(nullptr, false); + m_rSh.Left(CRSR_SKIP_CHARS, false, 1, false ); } - rSh.EndUndo( SwUndoId::END ); - rSh.EndAction(); + m_rSh.EndUndo( SwUndoId::END ); + m_rSh.EndAction(); } - bFootnote = m_pFootnoteBtn->IsChecked(); + bFootnote = m_xFootnoteBtn->get_active(); } -IMPL_LINK_NOARG(SwInsFootNoteDlg, NumberCharHdl, Button*, void) +IMPL_LINK_NOARG(SwInsFootNoteDlg, NumberCharHdl, weld::Button&, void) { - m_pNumberCharEdit->GrabFocus(); - m_pOkBtn->Enable( !m_pNumberCharEdit->GetText().isEmpty() || bExtCharAvailable ); + m_xNumberCharEdit->grab_focus(); + m_xOkBtn->set_sensitive( !m_xNumberCharEdit->get_text().isEmpty() || m_bExtCharAvailable ); } -IMPL_LINK_NOARG(SwInsFootNoteDlg, NumberEditHdl, Edit&, void) +IMPL_LINK_NOARG(SwInsFootNoteDlg, NumberEditHdl, weld::Entry&, void) { - m_pNumberCharBtn->Check(); - m_pOkBtn->Enable( !m_pNumberCharEdit->GetText().isEmpty() ); + m_xNumberCharBtn->set_active(true); + m_xOkBtn->set_sensitive( !m_xNumberCharEdit->get_text().isEmpty() ); } -IMPL_LINK_NOARG(SwInsFootNoteDlg, NumberAutoBtnHdl, Button*, void) +IMPL_LINK_NOARG(SwInsFootNoteDlg, NumberAutoBtnHdl, weld::Button&, void) { - m_pOkBtn->Enable(); + m_xOkBtn->set_sensitive(true); } -IMPL_LINK_NOARG(SwInsFootNoteDlg, NumberExtCharHdl, Button*, void) +IMPL_LINK_NOARG(SwInsFootNoteDlg, NumberExtCharHdl, weld::Button&, void) { - m_pNumberCharBtn->Check(); + m_xNumberCharBtn->set_active(true); - SfxItemSet aSet( rSh.GetAttrPool(), svl::Items<RES_CHRATR_FONT, RES_CHRATR_FONT>{} ); - rSh.GetCurAttr( aSet ); + SfxItemSet aSet(m_rSh.GetAttrPool(), svl::Items<RES_CHRATR_FONT, RES_CHRATR_FONT>{}); + m_rSh.GetCurAttr( aSet ); const SvxFontItem &rFont = aSet.Get( RES_CHRATR_FONT ); - SfxAllItemSet aAllSet( rSh.GetAttrPool() ); + SfxAllItemSet aAllSet(m_rSh.GetAttrPool()); aAllSet.Put( SfxBoolItem( FN_PARAM_1, false ) ); aAllSet.Put( rFont ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(GetFrameWeld(), aAllSet, false)); + ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(m_xDialog.get(), aAllSet, false)); if (RET_OK == pDlg->Execute()) { const SfxStringItem* pItem = SfxItemSet::GetItem<SfxStringItem>(pDlg->GetOutputItemSet(), SID_CHARMAP, false); const SvxFontItem* pFontItem = SfxItemSet::GetItem<SvxFontItem>(pDlg->GetOutputItemSet(), SID_ATTR_CHAR_FONT, false); if ( pItem ) { - m_pNumberCharEdit->SetText( pItem->GetValue() ); + m_xNumberCharEdit->set_text(pItem->GetValue()); if ( pFontItem ) { m_aFontName = pFontItem->GetFamilyName(); - eCharSet = pFontItem->GetCharSet(); - vcl::Font aFont( m_aFontName, pFontItem->GetStyleName(), m_pNumberCharEdit->GetFont().GetFontSize() ); + m_eCharSet = pFontItem->GetCharSet(); + vcl::Font aFont(m_aFontName, pFontItem->GetStyleName(), m_xNumberCharEdit->get_font().GetFontSize()); aFont.SetCharSet( pFontItem->GetCharSet() ); aFont.SetPitch( pFontItem->GetPitch() ); - m_pNumberCharEdit->SetFont( aFont ); + m_xNumberCharEdit->set_font(aFont); } - bExtCharAvailable = true; - m_pOkBtn->Enable(!m_pNumberCharEdit->GetText().isEmpty()); + m_bExtCharAvailable = true; + m_xOkBtn->set_sensitive(!m_xNumberCharEdit->get_text().isEmpty()); } } } -IMPL_LINK( SwInsFootNoteDlg, NextPrevHdl, Button *, pBtn, void ) +IMPL_LINK( SwInsFootNoteDlg, NextPrevHdl, weld::Button&, rBtn, void ) { Apply(); // go to the next foot/endnote here - rSh.ResetSelect(nullptr, false); - if (pBtn == m_pNextBT) - rSh.GotoNextFootnoteAnchor(); + m_rSh.ResetSelect(nullptr, false); + if (&rBtn == m_xNextBT.get()) + m_rSh.GotoNextFootnoteAnchor(); else - rSh.GotoPrevFootnoteAnchor(); + m_rSh.GotoPrevFootnoteAnchor(); Init(); } -SwInsFootNoteDlg::SwInsFootNoteDlg(vcl::Window *pParent, SwWrtShell &rShell, bool bEd) - : SvxStandardDialog(pParent, "InsertFootnoteDialog", "modules/swriter/ui/insertfootnote.ui") - , rSh(rShell) - , eCharSet(RTL_TEXTENCODING_DONTKNOW) - , bExtCharAvailable(false) - , bEdit(bEd) +SwInsFootNoteDlg::SwInsFootNoteDlg(weld::Window *pParent, SwWrtShell &rShell, bool bEd) + : GenericDialogController(pParent, "modules/swriter/ui/insertfootnote.ui", "InsertFootnoteDialog") + , m_rSh(rShell) + , m_eCharSet(RTL_TEXTENCODING_DONTKNOW) + , m_bExtCharAvailable(false) + , m_bEdit(bEd) + , m_xNumberFrame(m_xBuilder->weld_widget("numberingframe")) + , m_xNumberAutoBtn(m_xBuilder->weld_radio_button("automatic")) + , m_xNumberCharBtn(m_xBuilder->weld_radio_button("character")) + , m_xNumberCharEdit(m_xBuilder->weld_entry("characterentry")) + , m_xNumberExtChar(m_xBuilder->weld_button("choosecharacter")) + , m_xFootnoteBtn(m_xBuilder->weld_radio_button("footnote")) + , m_xEndNoteBtn(m_xBuilder->weld_radio_button("endnote")) + , m_xOkBtn(m_xBuilder->weld_button("ok")) + , m_xPrevBT(m_xBuilder->weld_button("prev")) + , m_xNextBT(m_xBuilder->weld_button("next")) { - get(m_pNumberFrame, "numberingframe"); - get(m_pNumberAutoBtn, "automatic"); - get(m_pNumberCharBtn, "character"); - get(m_pNumberCharEdit, "characterentry"); - get(m_pNumberExtChar, "choosecharacter"); - get(m_pFootnoteBtn, "footnote"); - get(m_pEndNoteBtn, "endnote"); - get(m_pOkBtn, "ok"); - get(m_pPrevBT, "prev"); - get(m_pNextBT, "next"); - - m_pNumberAutoBtn->SetClickHdl(LINK(this,SwInsFootNoteDlg,NumberAutoBtnHdl)); - m_pNumberExtChar->SetClickHdl(LINK(this,SwInsFootNoteDlg,NumberExtCharHdl)); - m_pNumberCharBtn->SetClickHdl(LINK(this,SwInsFootNoteDlg,NumberCharHdl)); - m_pNumberCharEdit->SetModifyHdl(LINK(this,SwInsFootNoteDlg,NumberEditHdl)); - m_pNumberCharEdit->SetMaxTextLen(10); - m_pNumberCharEdit->Enable(); - - m_pPrevBT->SetClickHdl(LINK(this, SwInsFootNoteDlg, NextPrevHdl)); - m_pNextBT->SetClickHdl(LINK(this, SwInsFootNoteDlg, NextPrevHdl)); - - SwViewShell::SetCareWin(this); - - if (bEdit) + m_xNumberAutoBtn->connect_clicked(LINK(this,SwInsFootNoteDlg,NumberAutoBtnHdl)); + m_xNumberExtChar->connect_clicked(LINK(this,SwInsFootNoteDlg,NumberExtCharHdl)); + m_xNumberCharBtn->connect_clicked(LINK(this,SwInsFootNoteDlg,NumberCharHdl)); + m_xNumberCharEdit->connect_changed(LINK(this,SwInsFootNoteDlg,NumberEditHdl)); + + m_xPrevBT->connect_clicked(LINK(this, SwInsFootNoteDlg, NextPrevHdl)); + m_xNextBT->connect_clicked(LINK(this, SwInsFootNoteDlg, NextPrevHdl)); + + SwViewShell::SetCareDialog(m_xDialog); + + if (m_bEdit) { Init(); - m_pPrevBT->Show(); - m_pNextBT->Show(); + m_xPrevBT->show(); + m_xNextBT->show(); } } SwInsFootNoteDlg::~SwInsFootNoteDlg() { - disposeOnce(); -} + SwViewShell::SetCareDialog(nullptr); -void SwInsFootNoteDlg::dispose() -{ - SwViewShell::SetCareWin(nullptr); - - if (bEdit) - rSh.ResetSelect(nullptr, false); - - m_pNumberFrame.clear(); - m_pNumberAutoBtn.clear(); - m_pNumberCharBtn.clear(); - m_pNumberCharEdit.clear(); - m_pNumberExtChar.clear(); - m_pFootnoteBtn.clear(); - m_pEndNoteBtn.clear(); - m_pOkBtn.clear(); - m_pPrevBT.clear(); - m_pNextBT.clear(); - SvxStandardDialog::dispose(); + if (m_bEdit) + m_rSh.ResetSelect(nullptr, false); } void SwInsFootNoteDlg::Init() @@ -213,62 +193,61 @@ void SwInsFootNoteDlg::Init() SwFormatFootnote aFootnoteNote; OUString sNumStr; vcl::Font aFont; - bExtCharAvailable = false; + m_bExtCharAvailable = false; - rSh.StartAction(); + m_rSh.StartAction(); - if( rSh.GetCurFootnote( &aFootnoteNote )) + if (m_rSh.GetCurFootnote(&aFootnoteNote)) { if (!aFootnoteNote.GetNumStr().isEmpty()) { sNumStr = aFootnoteNote.GetNumStr(); - rSh.Right(CRSR_SKIP_CHARS, true, 1, false ); - SfxItemSet aSet( rSh.GetAttrPool(), svl::Items<RES_CHRATR_FONT, RES_CHRATR_FONT>{} ); - rSh.GetCurAttr( aSet ); + m_rSh.Right(CRSR_SKIP_CHARS, true, 1, false ); + SfxItemSet aSet(m_rSh.GetAttrPool(), svl::Items<RES_CHRATR_FONT, RES_CHRATR_FONT>{}); + m_rSh.GetCurAttr(aSet); const SvxFontItem &rFont = aSet.Get( RES_CHRATR_FONT ); - - aFont = m_pNumberCharEdit->GetFont(); + aFont = m_xNumberCharEdit->get_font(); m_aFontName = rFont.GetFamilyName(); - eCharSet = rFont.GetCharSet(); + m_eCharSet = rFont.GetCharSet(); aFont.SetFamilyName(m_aFontName); - aFont.SetCharSet(eCharSet); - bExtCharAvailable = true; - rSh.Left( CRSR_SKIP_CHARS, false, 1, false ); + aFont.SetCharSet(m_eCharSet); + m_bExtCharAvailable = true; + m_rSh.Left( CRSR_SKIP_CHARS, false, 1, false ); } bFootnote = !aFootnoteNote.IsEndNote(); } - m_pNumberCharEdit->SetFont(aFont); + m_xNumberCharEdit->set_font(aFont); const bool bNumChar = !sNumStr.isEmpty(); - m_pNumberCharEdit->SetText(sNumStr); - m_pNumberCharBtn->Check(bNumChar); - m_pNumberAutoBtn->Check(!bNumChar); + m_xNumberCharEdit->set_text(sNumStr); + m_xNumberCharBtn->set_active(bNumChar); + m_xNumberAutoBtn->set_active(!bNumChar); if (bNumChar) - m_pNumberCharEdit->GrabFocus(); + m_xNumberCharEdit->grab_focus(); if (bFootnote) - m_pFootnoteBtn->Check(); + m_xFootnoteBtn->set_active(true); else - m_pEndNoteBtn->Check(); + m_xEndNoteBtn->set_active(true); - bool bNext = rSh.GotoNextFootnoteAnchor(); + bool bNext = m_rSh.GotoNextFootnoteAnchor(); if (bNext) - rSh.GotoPrevFootnoteAnchor(); + m_rSh.GotoPrevFootnoteAnchor(); - bool bPrev = rSh.GotoPrevFootnoteAnchor(); + bool bPrev = m_rSh.GotoPrevFootnoteAnchor(); if (bPrev) - rSh.GotoNextFootnoteAnchor(); + m_rSh.GotoNextFootnoteAnchor(); - m_pPrevBT->Enable(bPrev); - m_pNextBT->Enable(bNext); + m_xPrevBT->set_sensitive(bPrev); + m_xNextBT->set_sensitive(bNext); - rSh.Right(CRSR_SKIP_CHARS, true, 1, false ); + m_rSh.Right(CRSR_SKIP_CHARS, true, 1, false ); - rSh.EndAction(); + m_rSh.EndAction(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/insfnote.hxx b/sw/source/uibase/inc/insfnote.hxx index 9f83638fd88d..49ea5563fede 100644 --- a/sw/source/uibase/inc/insfnote.hxx +++ b/sw/source/uibase/inc/insfnote.hxx @@ -19,64 +19,65 @@ #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_INSFNOTE_HXX #define INCLUDED_SW_SOURCE_UIBASE_INC_INSFNOTE_HXX -#include <svx/stddlg.hxx> - -#include <vcl/button.hxx> - -#include <vcl/edit.hxx> -#include <vcl/fixed.hxx> +#include <vcl/weld.hxx> class SwWrtShell; class VclFrame; -class SwInsFootNoteDlg: public SvxStandardDialog +class SwInsFootNoteDlg: public weld::GenericDialogController { - SwWrtShell &rSh; + SwWrtShell &m_rSh; // everything for the character(s) OUString m_aFontName; - rtl_TextEncoding eCharSet; - bool bExtCharAvailable; - bool bEdit; + rtl_TextEncoding m_eCharSet; + bool m_bExtCharAvailable; + bool m_bEdit; - VclPtr<VclFrame> m_pNumberFrame; - VclPtr<RadioButton> m_pNumberAutoBtn; - VclPtr<RadioButton> m_pNumberCharBtn; - VclPtr<Edit> m_pNumberCharEdit; - VclPtr<PushButton> m_pNumberExtChar; + std::unique_ptr<weld::Widget> m_xNumberFrame; + std::unique_ptr<weld::RadioButton> m_xNumberAutoBtn; + std::unique_ptr<weld::RadioButton> m_xNumberCharBtn; + std::unique_ptr<weld::Entry> m_xNumberCharEdit; + std::unique_ptr<weld::Button> m_xNumberExtChar; // everything for the selection footnote/endnote - VclPtr<RadioButton> m_pFootnoteBtn; - VclPtr<RadioButton> m_pEndNoteBtn; + std::unique_ptr<weld::RadioButton> m_xFootnoteBtn; + std::unique_ptr<weld::RadioButton> m_xEndNoteBtn; - VclPtr<PushButton> m_pOkBtn; - VclPtr<PushButton> m_pPrevBT; - VclPtr<PushButton> m_pNextBT; + std::unique_ptr<weld::Button> m_xOkBtn; + std::unique_ptr<weld::Button> m_xPrevBT; + std::unique_ptr<weld::Button> m_xNextBT; - DECL_LINK(NumberCharHdl, Button *, void); - DECL_LINK(NumberEditHdl, Edit&, void); - DECL_LINK(NumberAutoBtnHdl, Button *, void); - DECL_LINK(NumberExtCharHdl, Button *, void); - DECL_LINK(NextPrevHdl, Button *, void); + DECL_LINK(NumberCharHdl, weld::Button&, void); + DECL_LINK(NumberEditHdl, weld::Entry&, void); + DECL_LINK(NumberAutoBtnHdl, weld::Button&, void); + DECL_LINK(NumberExtCharHdl, weld::Button&, void); + DECL_LINK(NextPrevHdl, weld::Button&, void); - virtual void Apply() override; + void Apply(); void Init(); public: - SwInsFootNoteDlg(vcl::Window * pParent, SwWrtShell &rSh, bool bEd); + SwInsFootNoteDlg(weld::Window * pParent, SwWrtShell &rSh, bool bEd); virtual ~SwInsFootNoteDlg() override; - virtual void dispose() override; const OUString& GetFontName() { return m_aFontName; } - bool IsEndNote() { return m_pEndNoteBtn->IsChecked(); } + bool IsEndNote() const { return m_xEndNoteBtn->get_active(); } OUString GetStr() - { - if ( m_pNumberCharBtn->IsChecked() ) - return m_pNumberCharEdit->GetText(); - return OUString(); - } + { + if (m_xNumberCharBtn->get_active()) + return m_xNumberCharEdit->get_text(); + return OUString(); + } + short execute() + { + short nRet = run(); + if (nRet == RET_OK) + Apply(); + return nRet; + } }; #endif diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 65f4b25ce6d2..ae9eff3704e9 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -564,7 +564,7 @@ void SwTextShell::Execute(SfxRequest &rReq) SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "Dialog creation failed!"); ScopedVclPtr<AbstractInsFootNoteDlg> pDlg(pFact->CreateInsFootNoteDlg( - GetView().GetWindow(), rWrtSh)); + GetView().GetFrameWeld(), rWrtSh)); OSL_ENSURE(pDlg, "Dialog creation failed!"); pDlg->SetHelpId(GetStaticInterface()->GetSlot(nSlot)->GetCommand()); if ( pDlg->Execute() == RET_OK ) @@ -647,7 +647,7 @@ void SwTextShell::Execute(SfxRequest &rReq) { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); assert(pFact && "SwAbstractDialogFactory fail!"); - ScopedVclPtr<AbstractSwBreakDlg> pDlg(pFact->CreateSwBreakDlg(GetView().GetWindow()->GetFrameWeld(), rWrtSh)); + ScopedVclPtr<AbstractSwBreakDlg> pDlg(pFact->CreateSwBreakDlg(GetView().GetFrameWeld(), rWrtSh)); assert(pDlg && "Dialog creation failed!"); if ( pDlg->Execute() == RET_OK ) { @@ -740,7 +740,7 @@ void SwTextShell::Execute(SfxRequest &rReq) ScopedVclPtr<AbstractSwModalRedlineAcceptDlg> pDlg(pFact->CreateSwModalRedlineAcceptDlg(&GetView().GetEditWin())); OSL_ENSURE(pDlg, "Dialog creation failed!"); - switch (lcl_AskRedlineFlags(GetView().GetEditWin().GetFrameWeld())) + switch (lcl_AskRedlineFlags(GetView().GetFrameWeld())) { case RET_OK: { diff --git a/sw/source/uibase/uiview/viewdlg2.cxx b/sw/source/uibase/uiview/viewdlg2.cxx index 495bad85afd8..41bec30c8023 100644 --- a/sw/source/uibase/uiview/viewdlg2.cxx +++ b/sw/source/uibase/uiview/viewdlg2.cxx @@ -97,7 +97,7 @@ void SwView::ExecDlgExt(SfxRequest const &rReq) SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); assert(pFact && "Dialog creation failed!"); ScopedVclPtr<AbstractInsFootNoteDlg> pDlg(pFact->CreateInsFootNoteDlg( - &rMDI, *m_pWrtShell, true)); + GetFrameWeld(), *m_pWrtShell, true)); assert(pDlg && "Dialog creation failed!"); pDlg->SetHelpId(GetStaticInterface()->GetSlot(FN_EDIT_FOOTNOTE)->GetCommand()); diff --git a/sw/uiconfig/swriter/ui/insertfootnote.ui b/sw/uiconfig/swriter/ui/insertfootnote.ui index 4b0d91128b35..7d1a0b05151f 100644 --- a/sw/uiconfig/swriter/ui/insertfootnote.ui +++ b/sw/uiconfig/swriter/ui/insertfootnote.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.20.4 --> <interface domain="sw"> <requires lib="gtk+" version="3.18"/> <object class="GtkImage" id="image1"> @@ -16,6 +16,9 @@ <property name="can_focus">False</property> <property name="border_width">6</property> <property name="title" translatable="yes" context="insertfootnote|InsertFootnoteDialog">Insert Footnote/Endnote</property> + <property name="modal">True</property> + <property name="default_width">0</property> + <property name="default_height">0</property> <property name="type_hint">dialog</property> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> @@ -30,6 +33,7 @@ <object class="GtkGrid" id="grid2"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="column_spacing">6</property> <property name="column_homogeneous">True</property> <child> <object class="GtkButton" id="prev"> @@ -103,6 +107,7 @@ <property name="expand">False</property> <property name="fill">True</property> <property name="position">3</property> + <property name="secondary">True</property> </packing> </child> </object> @@ -144,12 +149,11 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> - <property name="use_underline">True</property> <property name="valign">center</property> + <property name="use_underline">True</property> <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> - <property name="group">character</property> </object> <packing> <property name="left_attach">0</property> @@ -163,8 +167,8 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> - <property name="use_underline">True</property> <property name="valign">center</property> + <property name="use_underline">True</property> <property name="xalign">0</property> <property name="draw_indicator">True</property> <property name="group">automatic</property> @@ -183,6 +187,8 @@ <property name="can_focus">True</property> <property name="halign">start</property> <property name="valign">center</property> + <property name="max_length">10</property> + <property name="activates_default">True</property> <property name="width_chars">4</property> <property name="progress_fraction">0.0099999997764825821</property> <property name="progress_pulse_step">0.090000003576278687</property> @@ -259,12 +265,11 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> - <property name="use_underline">True</property> <property name="valign">center</property> + <property name="use_underline">True</property> <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> - <property name="group">endnote</property> </object> <packing> <property name="expand">False</property> @@ -278,8 +283,8 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> - <property name="use_underline">True</property> <property name="valign">center</property> + <property name="use_underline">True</property> <property name="xalign">0</property> <property name="draw_indicator">True</property> <property name="group">footnote</property> @@ -325,5 +330,8 @@ <action-widget response="-6">cancel</action-widget> <action-widget response="-11">help</action-widget> </action-widgets> + <child> + <placeholder/> + </child> </object> </interface> diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx index b6f00a0752d7..e4cf68981392 100644 --- a/vcl/inc/unx/gtk/gtkinst.hxx +++ b/vcl/inc/unx/gtk/gtkinst.hxx @@ -43,6 +43,8 @@ class GtkPrintWrapper; } } +vcl::Font pango_to_vcl(const PangoFontDescription* font, const css::lang::Locale& rLocale); + class GenPspGraphics; class GtkYieldMutex : public SalYieldMutex { diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index d06590dace91..c478974f9482 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -1065,6 +1065,16 @@ public: m_xEntry->SetReadOnly(!bEditable); } + virtual vcl::Font get_font() override + { + return m_xEntry->GetFont(); + } + + virtual void set_font(const vcl::Font& rFont) override + { + m_xEntry->SetFont(rFont); + } + virtual ~SalInstanceEntry() override { m_xEntry->SetTextFilter(nullptr); diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 3eded538f3cb..5ce77bea39fa 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -2675,6 +2675,88 @@ public: g_signal_handler_unblock(m_pEntry, m_nInsertTextSignalId); } + virtual vcl::Font get_font() override + { + PangoContext* pContext = gtk_widget_get_pango_context(m_pWidget); + return pango_to_vcl(pango_context_get_font_description(pContext), + Application::GetSettings().GetUILanguageTag().getLocale()); + } + + virtual void set_font(const vcl::Font& rFont) override + { + PangoAttrList* pAttrList = pango_attr_list_new(); + pango_attr_list_insert(pAttrList, pango_attr_family_new(OUStringToOString(rFont.GetFamilyName(), RTL_TEXTENCODING_UTF8).getStr())); + pango_attr_list_insert(pAttrList, pango_attr_size_new(rFont.GetFontSize().Height() * PANGO_SCALE)); + switch (rFont.GetItalic()) + { + case ITALIC_NONE: + pango_attr_list_insert(pAttrList, pango_attr_style_new(PANGO_STYLE_NORMAL)); + break; + case ITALIC_NORMAL: + pango_attr_list_insert(pAttrList, pango_attr_style_new(PANGO_STYLE_ITALIC)); + break; + case ITALIC_OBLIQUE: + pango_attr_list_insert(pAttrList, pango_attr_style_new(PANGO_STYLE_OBLIQUE)); + break; + default: + break; + } + switch (rFont.GetWeight()) + { + case WEIGHT_ULTRALIGHT: + pango_attr_list_insert(pAttrList, pango_attr_weight_new(PANGO_WEIGHT_ULTRALIGHT)); + break; + case WEIGHT_LIGHT: + pango_attr_list_insert(pAttrList, pango_attr_weight_new(PANGO_WEIGHT_LIGHT)); + break; + case WEIGHT_NORMAL: + pango_attr_list_insert(pAttrList, pango_attr_weight_new(PANGO_WEIGHT_NORMAL)); + break; + case WEIGHT_BOLD: + pango_attr_list_insert(pAttrList, pango_attr_weight_new(PANGO_WEIGHT_BOLD)); + break; + case WEIGHT_ULTRABOLD: + pango_attr_list_insert(pAttrList, pango_attr_weight_new(PANGO_WEIGHT_ULTRABOLD)); + break; + default: + break; + } + switch (rFont.GetWidthType()) + { + case WIDTH_ULTRA_CONDENSED: + pango_attr_list_insert(pAttrList, pango_attr_stretch_new(PANGO_STRETCH_ULTRA_CONDENSED)); + break; + case WIDTH_EXTRA_CONDENSED: + pango_attr_list_insert(pAttrList, pango_attr_stretch_new(PANGO_STRETCH_EXTRA_CONDENSED)); + break; + case WIDTH_CONDENSED: + pango_attr_list_insert(pAttrList, pango_attr_stretch_new(PANGO_STRETCH_CONDENSED)); + break; + case WIDTH_SEMI_CONDENSED: + pango_attr_list_insert(pAttrList, pango_attr_stretch_new(PANGO_STRETCH_SEMI_CONDENSED)); + break; + case WIDTH_NORMAL: + pango_attr_list_insert(pAttrList, pango_attr_stretch_new(PANGO_STRETCH_NORMAL)); + break; + case WIDTH_SEMI_EXPANDED: + pango_attr_list_insert(pAttrList, pango_attr_stretch_new(PANGO_STRETCH_SEMI_EXPANDED)); + break; + case WIDTH_EXPANDED: + pango_attr_list_insert(pAttrList, pango_attr_stretch_new(PANGO_STRETCH_EXPANDED)); + break; + case WIDTH_EXTRA_EXPANDED: + pango_attr_list_insert(pAttrList, pango_attr_stretch_new(PANGO_STRETCH_EXTRA_EXPANDED)); + break; + case WIDTH_ULTRA_EXPANDED: + pango_attr_list_insert(pAttrList, pango_attr_stretch_new(PANGO_STRETCH_ULTRA_EXPANDED)); + break; + default: + break; + } + gtk_entry_set_attributes(m_pEntry, pAttrList); + pango_attr_list_unref(pAttrList); + } + virtual ~GtkInstanceEntry() override { g_signal_handler_disconnect(m_pEntry, m_nInsertTextSignalId); @@ -3722,7 +3804,7 @@ public: { m_xSorter.reset(new comphelper::string::NaturalStringSorter( ::comphelper::getProcessComponentContext(), - Application::GetSettings().GetLanguageTag().getLocale())); + Application::GetSettings().GetUILanguageTag().getLocale())); GtkTreeModel* pModel = gtk_combo_box_get_model(GTK_COMBO_BOX(m_pComboBoxText)); GtkTreeSortable* pSortable = GTK_TREE_SORTABLE(pModel); gtk_tree_sortable_set_sort_func(pSortable, 0, sort_func, m_xSorter.get(), nullptr); diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx index 5ea9cbcde7bd..04f5ac181c05 100644 --- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx @@ -2775,6 +2775,11 @@ static inline ::Color getColor( const GdkRGBA& rCol ) static vcl::Font getFont(GtkStyleContext* pStyle, const css::lang::Locale& rLocale) { const PangoFontDescription* font = gtk_style_context_get_font(pStyle, gtk_style_context_get_state(pStyle)); + return pango_to_vcl(font, rLocale); +} + +vcl::Font pango_to_vcl(const PangoFontDescription* font, const css::lang::Locale& rLocale) +{ OString aFamily = pango_font_description_get_family( font ); int nPangoHeight = pango_font_description_get_size( font ); PangoStyle eStyle = pango_font_description_get_style( font ); |