summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--extras/source/glade/libreoffice-catalog.xml.in3
-rwxr-xr-xsolenv/bin/native-code.py1
-rw-r--r--sw/inc/swabstdlg.hxx2
-rw-r--r--sw/source/ui/config/optload.cxx1
-rw-r--r--sw/source/ui/dialog/swdlgfact.cxx5
-rw-r--r--sw/source/ui/dialog/swdlgfact.hxx2
-rw-r--r--sw/source/ui/frmdlg/cption.cxx219
-rw-r--r--sw/source/uibase/inc/cption.hxx69
-rw-r--r--sw/source/uibase/uiview/viewdlg2.cxx4
-rw-r--r--sw/uiconfig/swriter/ui/insertcaption.ui202
10 files changed, 258 insertions, 250 deletions
diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in
index 2882a06c3370..78b49b2f0cf5 100644
--- a/extras/source/glade/libreoffice-catalog.xml.in
+++ b/extras/source/glade/libreoffice-catalog.xml.in
@@ -223,9 +223,6 @@
<glade-widget-class title="Calc Table Preview" name="sclo-ScAutoFmtPreview"
generic-name="Calc Table Preview Window" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/>
- <glade-widget-class title="Caption Preview" name="swuilo-SwCaptionPreview"
- generic-name="Caption Preview Window" parent="GtkDrawingArea"
- icon-name="widget-gtk-drawingarea"/>
<glade-widget-class title="Extension List" name="deploymentgui-ExtensionBox"
generic-name="Extensions List" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/>
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index fdfb22224519..42f29473cb27 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -510,7 +510,6 @@ custom_widgets = [
'SvxTextEncodingBox',
'SvxTextEncodingBox',
'SwAddressPreview',
- 'SwCaptionPreview',
'SwFieldRefTreeListBox',
'SwGlTreeListBox',
'SwIdxTreeListBox',
diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx
index 5bffda4b0f2d..2e97df323db9 100644
--- a/sw/inc/swabstdlg.hxx
+++ b/sw/inc/swabstdlg.hxx
@@ -377,7 +377,7 @@ public:
virtual VclPtr<SfxAbstractTabDialog> CreateSwCharDlg(weld::Window* pParent, SwView& pVw, const SfxItemSet& rCoreSet,
SwCharDlgMode nDialogMode, const OUString* pFormatStr = nullptr) = 0;
virtual VclPtr<AbstractSwConvertTableDlg> CreateSwConvertTableDlg(SwView& rView, bool bToTable) = 0;
- virtual VclPtr<VclAbstractDialog> CreateSwCaptionDialog ( vcl::Window *pParent, SwView &rV) = 0;
+ virtual VclPtr<VclAbstractDialog> CreateSwCaptionDialog(weld::Window *pParent, SwView &rV) = 0;
virtual VclPtr<AbstractSwInsertDBColAutoPilot> CreateSwInsertDBColAutoPilot(SwView& rView,
css::uno::Reference< css::sdbc::XDataSource> rxSource,
diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx
index cbba58516fdd..f4c2edff172f 100644
--- a/sw/source/ui/config/optload.cxx
+++ b/sw/source/ui/config/optload.cxx
@@ -495,7 +495,6 @@ void CaptionPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rect
rRenderContext.DrawText(Point(4, 6), maText);
}
-
IMPL_LINK(SwCaptionOptPage, TextFilterHdl, OUString&, rTest, bool)
{
rTest = m_aTextFilter.filter(rTest);
diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx
index 504a5c03eb33..c40f17d9cf4a 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -801,10 +801,9 @@ VclPtr<AbstractSwConvertTableDlg> SwAbstractDialogFactory_Impl::CreateSwConvertT
return VclPtr<AbstractSwConvertTableDlg_Impl>::Create(o3tl::make_unique<SwConvertTableDlg>(rView, bToTable));
}
-VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateSwCaptionDialog ( vcl::Window *pParent, SwView &rV)
+VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateSwCaptionDialog(weld::Window *pParent, SwView &rV)
{
- VclPtr<Dialog> pDlg = VclPtr<SwCaptionDialog>::Create( pParent, rV );
- return VclPtr<VclAbstractDialog_Impl>::Create( pDlg );
+ return VclPtr<AbstractGenericDialog_Impl>::Create(o3tl::make_unique<SwCaptionDialog>(pParent, rV));
}
VclPtr<AbstractSwInsertDBColAutoPilot> SwAbstractDialogFactory_Impl::CreateSwInsertDBColAutoPilot( SwView& rView,
diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx
index 6cca057829be..2d9251ce3095 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -604,7 +604,7 @@ public:
virtual VclPtr<SfxAbstractTabDialog> CreateSwCharDlg(weld::Window* pParent, SwView& pVw, const SfxItemSet& rCoreSet,
SwCharDlgMode nDialogMode, const OUString* pFormatStr = nullptr) override;
virtual VclPtr<AbstractSwConvertTableDlg> CreateSwConvertTableDlg(SwView& rView, bool bToTable) override;
- virtual VclPtr<VclAbstractDialog> CreateSwCaptionDialog ( vcl::Window *pParent, SwView &rV) override;
+ virtual VclPtr<VclAbstractDialog> CreateSwCaptionDialog(weld::Window *pParent, SwView &rV) override;
virtual VclPtr<AbstractSwInsertDBColAutoPilot> CreateSwInsertDBColAutoPilot(SwView& rView,
css::uno::Reference< css::sdbc::XDataSource> rxSource,
css::uno::Reference<css::sdbcx::XColumnsSupplier> xColSupp,
diff --git a/sw/source/ui/frmdlg/cption.cxx b/sw/source/ui/frmdlg/cption.cxx
index cf1668f42c2f..49993753e587 100644
--- a/sw/source/ui/frmdlg/cption.cxx
+++ b/sw/source/ui/frmdlg/cption.cxx
@@ -97,30 +97,36 @@ OUString TextFilterAutoConvert::filter(const OUString &rText)
return rText;
}
-SwCaptionDialog::SwCaptionDialog( vcl::Window *pParent, SwView &rV ) :
- SvxStandardDialog( pParent, "InsertCaptionDialog", "modules/swriter/ui/insertcaption.ui" ),
- m_sNone( SwResId(SW_STR_NONE) ),
- m_aTextFilter(m_sNone),
- rView( rV ),
- pMgr( new SwFieldMgr(rView.GetWrtShellPtr()) ),
- bCopyAttributes( false ),
- bOrderNumberingFirst( SW_MOD()->GetModuleConfig()->IsCaptionOrderNumberingFirst() )
+IMPL_LINK(SwCaptionDialog, TextFilterHdl, OUString&, rTest, bool)
{
- get(m_pTextEdit, "caption_edit");
- get(m_pCategoryBox, "category");
- m_pCategoryBox->SetTextFilter(&m_aTextFilter);
- get(m_pFormatText, "numbering_label");
- get(m_pFormatBox, "numbering");
- get(m_pNumberingSeparatorFT, "num_separator");
- get(m_pNumberingSeparatorED, "num_separator_edit");
- get(m_pSepText, "separator_label");
- get(m_pSepEdit, "separator_edit");
- get(m_pPosText, "position_label");
- get(m_pPosBox, "position");
- get(m_pPreview, "preview");
- get(m_pOKButton, "ok");
- get(m_pAutoCaptionButton, "auto");
- get(m_pOptionButton, "options");
+ rTest = m_aTextFilter.filter(rTest);
+ return true;
+}
+
+SwCaptionDialog::SwCaptionDialog(weld::Window *pParent, SwView &rV)
+ : SfxDialogController(pParent, "modules/swriter/ui/insertcaption.ui", "InsertCaptionDialog")
+ , m_sNone(SwResId(SW_STR_NONE))
+ , m_aTextFilter(m_sNone)
+ , rView(rV)
+ , pMgr(new SwFieldMgr(rView.GetWrtShellPtr()))
+ , bCopyAttributes(false)
+ , bOrderNumberingFirst(SW_MOD()->GetModuleConfig()->IsCaptionOrderNumberingFirst())
+ , m_xTextEdit(m_xBuilder->weld_entry("caption_edit"))
+ , m_xCategoryBox(m_xBuilder->weld_combo_box("category"))
+ , m_xFormatText(m_xBuilder->weld_label("numbering_label"))
+ , m_xFormatBox(m_xBuilder->weld_combo_box("numbering"))
+ , m_xNumberingSeparatorFT(m_xBuilder->weld_label("num_separator"))
+ , m_xNumberingSeparatorED(m_xBuilder->weld_entry("num_separator_edit"))
+ , m_xSepText(m_xBuilder->weld_label("separator_label"))
+ , m_xSepEdit(m_xBuilder->weld_entry("separator_edit"))
+ , m_xPosText(m_xBuilder->weld_label("position_label"))
+ , m_xPosBox(m_xBuilder->weld_combo_box("position"))
+ , m_xOKButton(m_xBuilder->weld_button("ok"))
+ , m_xAutoCaptionButton(m_xBuilder->weld_button("auto"))
+ , m_xOptionButton(m_xBuilder->weld_button("options"))
+ , m_xPreview(new weld::CustomWeld(*m_xBuilder, "preview", m_aPreview))
+{
+ m_xCategoryBox->connect_entry_insert_text(LINK(this, SwCaptionDialog, TextFilterHdl));
//#i61007# order of captions
ApplyCaptionOrder();
@@ -135,25 +141,24 @@ SwCaptionDialog::SwCaptionDialog( vcl::Window *pParent, SwView &rV ) :
xNameAccess = xObjs->getEmbeddedObjects();
}
- Link<Edit&,void> aLk = LINK( this, SwCaptionDialog, ModifyHdl );
- m_pCategoryBox->SetModifyHdl( aLk );
- m_pTextEdit->SetModifyHdl( aLk );
- m_pNumberingSeparatorED->SetModifyHdl ( aLk );
- m_pSepEdit->SetModifyHdl( aLk );
+ m_xCategoryBox->connect_changed(LINK(this, SwCaptionDialog, ModifyComboHdl));
+ Link<weld::Entry&,void> aLk = LINK(this, SwCaptionDialog, ModifyEntryHdl);
+ m_xTextEdit->connect_changed(aLk);
+ m_xNumberingSeparatorED->connect_changed(aLk);
+ m_xSepEdit->connect_changed(aLk);
- m_pCategoryBox->SetSelectHdl( LINK(this, SwCaptionDialog, SelectHdl) );
- m_pFormatBox->SetSelectHdl( LINK(this, SwCaptionDialog, SelectListBoxHdl) );
- m_pOptionButton->SetClickHdl( LINK( this, SwCaptionDialog, OptionHdl ) );
- m_pAutoCaptionButton->SetClickHdl(LINK(this, SwCaptionDialog, CaptionHdl));
+ m_xFormatBox->connect_changed(LINK(this, SwCaptionDialog, SelectListBoxHdl));
+ m_xOptionButton->connect_clicked(LINK(this, SwCaptionDialog, OptionHdl));
+ m_xAutoCaptionButton->connect_clicked(LINK(this, SwCaptionDialog, CaptionHdl));
- m_pCategoryBox->InsertEntry( m_sNone );
+ m_xCategoryBox->append_text(m_sNone);
size_t nCount = pMgr->GetFieldTypeCount();
for (size_t i = 0; i < nCount; ++i)
{
SwFieldType *pType = pMgr->GetFieldType( SwFieldIds::Unknown, i );
if( pType->Which() == SwFieldIds::SetExp &&
static_cast<SwSetExpFieldType *>( pType)->GetType() & nsSwGetSetExpType::GSE_SEQ )
- m_pCategoryBox->InsertEntry(pType->GetName());
+ m_xCategoryBox->append_text(pType->GetName());
}
OUString sString;
@@ -205,11 +210,13 @@ SwCaptionDialog::SwCaptionDialog( vcl::Window *pParent, SwView &rV ) :
}
if( nPoolId )
{
- if (!sString.isEmpty())
- m_pCategoryBox->SetText( sString );
+ if (sString.isEmpty())
+ sString = SwStyleNameMapper::GetUIName(nPoolId, OUString());
+ auto nIndex = m_xCategoryBox->find_text(sString);
+ if (nIndex != -1)
+ m_xCategoryBox->set_active(nIndex);
else
- m_pCategoryBox->SetText(
- SwStyleNameMapper::GetUIName( nPoolId, OUString() ));
+ m_xCategoryBox->set_entry_text(sString);
}
// aFormatBox
@@ -218,7 +225,7 @@ SwCaptionDialog::SwCaptionDialog( vcl::Window *pParent, SwView &rV ) :
for ( size_t i = nCount; i; )
{
SwFieldType* pFieldType = pMgr->GetFieldType(SwFieldIds::Unknown, --i);
- if( pFieldType->GetName() == m_pCategoryBox->GetText() )
+ if (pFieldType->GetName() == m_xCategoryBox->get_active_text())
{
nSelFormat = static_cast<sal_uInt16>(static_cast<SwSetExpFieldType*>(pFieldType)->GetSeqFormat());
break;
@@ -228,11 +235,10 @@ SwCaptionDialog::SwCaptionDialog( vcl::Window *pParent, SwView &rV ) :
sal_uInt16 nFormatCount = pMgr->GetFormatCount(TYP_SEQFLD, false);
for ( sal_uInt16 i = 0; i < nFormatCount; ++i )
{
- m_pFormatBox->InsertEntry( pMgr->GetFormatStr(TYP_SEQFLD, i) );
const sal_uInt16 nFormatId = pMgr->GetFormatId(TYP_SEQFLD, i);
- m_pFormatBox->SetEntryData( i, reinterpret_cast<void*>( nFormatId ) );
- if( nFormatId == nSelFormat )
- m_pFormatBox->SelectEntryPos( i );
+ m_xFormatBox->append(OUString::number(nFormatId), pMgr->GetFormatStr(TYP_SEQFLD, i));
+ if (nFormatId == nSelFormat)
+ m_xFormatBox->set_active(i);
}
// aPosBox
@@ -244,29 +250,29 @@ SwCaptionDialog::SwCaptionDialog( vcl::Window *pParent, SwView &rV ) :
|| eType == SelectionType::DrawObject
|| eType == (SelectionType::DrawObject | SelectionType::Ornament))
{
- m_pPosBox->InsertEntry(SwResId(STR_CAPTION_ABOVE));
- m_pPosBox->InsertEntry(SwResId(STR_CAPTION_BELOW));
+ m_xPosBox->append_text(SwResId(STR_CAPTION_ABOVE));
+ m_xPosBox->append_text(SwResId(STR_CAPTION_BELOW));
}
else if(eType == SelectionType::Frame
|| eType == SelectionType::Text)
{
- m_pPosBox->InsertEntry(SwResId(STR_CAPTION_BEGINNING));
- m_pPosBox->InsertEntry(SwResId(STR_CAPTION_END ));
+ m_xPosBox->append_text(SwResId(STR_CAPTION_BEGINNING));
+ m_xPosBox->append_text(SwResId(STR_CAPTION_END));
}
if (eType & SelectionType::Table)
{
- m_pPosBox->SelectEntryPos(0);
+ m_xPosBox->set_active(0);
}
else
{
- m_pPosBox->SelectEntryPos(1);
+ m_xPosBox->set_active(1);
}
- m_pCategoryBox->GetModifyHdl().Call(*m_pCategoryBox);
+ ModifyHdl();
- m_pSepEdit->SetText(our_aSepTextSave);
- m_pTextEdit->GrabFocus();
+ m_xSepEdit->set_text(our_aSepTextSave);
+ m_xTextEdit->grab_focus();
DrawSample();
}
@@ -274,7 +280,7 @@ void SwCaptionDialog::Apply()
{
InsCaptionOpt aOpt;
aOpt.UseCaption() = true;
- OUString aName( m_pCategoryBox->GetText() );
+ OUString aName(m_xCategoryBox->get_active_text());
if ( aName == m_sNone )
{
aOpt.SetCategory( OUString() );
@@ -283,25 +289,33 @@ void SwCaptionDialog::Apply()
else
{
aOpt.SetCategory(comphelper::string::strip(aName, ' '));
- aOpt.SetNumSeparator( m_pNumberingSeparatorED->GetText() );
+ aOpt.SetNumSeparator(m_xNumberingSeparatorED->get_text());
}
- aOpt.SetNumType( static_cast<sal_uInt16>(reinterpret_cast<sal_uIntPtr>(m_pFormatBox->GetSelectedEntryData())) );
- aOpt.SetSeparator( m_pSepEdit->IsEnabled() ? m_pSepEdit->GetText() : OUString() );
- aOpt.SetCaption( m_pTextEdit->GetText() );
- aOpt.SetPos( m_pPosBox->GetSelectedEntryPos() );
+ aOpt.SetNumType(m_xFormatBox->get_active_id().toUInt32());
+ aOpt.SetSeparator(m_xSepEdit->get_sensitive() ? m_xSepEdit->get_text() : OUString());
+ aOpt.SetCaption(m_xTextEdit->get_text());
+ aOpt.SetPos(m_xPosBox->get_active());
aOpt.IgnoreSeqOpts() = true;
aOpt.CopyAttributes() = bCopyAttributes;
aOpt.SetCharacterStyle( sCharacterStyle );
rView.InsertCaption( &aOpt );
- our_aSepTextSave = m_pSepEdit->GetText();
+ our_aSepTextSave = m_xSepEdit->get_text();
}
-IMPL_LINK_NOARG( SwCaptionDialog, OptionHdl, Button*, void )
+short SwCaptionDialog::run()
{
- OUString sFieldTypeName = m_pCategoryBox->GetText();
+ short nRet = SfxDialogController::run();
+ if (nRet == RET_OK)
+ Apply();
+ return nRet;
+}
+
+IMPL_LINK_NOARG(SwCaptionDialog, OptionHdl, weld::Button&, void)
+{
+ OUString sFieldTypeName = m_xCategoryBox->get_active_text();
if(sFieldTypeName == m_sNone)
sFieldTypeName.clear();
- SwSequenceOptionDialog aDlg(GetFrameWeld(), rView, sFieldTypeName);
+ SwSequenceOptionDialog aDlg(m_xDialog.get(), rView, sFieldTypeName);
aDlg.SetApplyBorderAndShadow(bCopyAttributes);
aDlg.SetCharacterStyle( sCharacterStyle );
aDlg.SetOrderNumberingFirst( bOrderNumberingFirst );
@@ -318,56 +332,62 @@ IMPL_LINK_NOARG( SwCaptionDialog, OptionHdl, Button*, void )
DrawSample();
}
-IMPL_LINK_NOARG(SwCaptionDialog, SelectListBoxHdl, ListBox&, void)
-{
- DrawSample();
-}
-IMPL_LINK_NOARG(SwCaptionDialog, SelectHdl, ComboBox&, void)
+IMPL_LINK_NOARG(SwCaptionDialog, SelectListBoxHdl, weld::ComboBox&, void)
{
DrawSample();
}
-IMPL_LINK_NOARG(SwCaptionDialog, ModifyHdl, Edit&, void)
+void SwCaptionDialog::ModifyHdl()
{
SwWrtShell &rSh = rView.GetWrtShell();
- OUString sFieldTypeName = m_pCategoryBox->GetText();
+ OUString sFieldTypeName = m_xCategoryBox->get_active_text();
bool bCorrectFieldName = !sFieldTypeName.isEmpty();
bool bNone = sFieldTypeName == m_sNone;
SwFieldType* pType = (bCorrectFieldName && !bNone)
? rSh.GetFieldType( SwFieldIds::SetExp, sFieldTypeName )
: nullptr;
- m_pOKButton->Enable( bCorrectFieldName &&
+ m_xOKButton->set_sensitive( bCorrectFieldName &&
(!pType ||
static_cast<SwSetExpFieldType*>(pType)->GetType() == nsSwGetSetExpType::GSE_SEQ) );
- m_pOptionButton->Enable( m_pOKButton->IsEnabled() && !bNone );
- m_pNumberingSeparatorFT->Enable( bOrderNumberingFirst && !bNone );
- m_pNumberingSeparatorED->Enable( bOrderNumberingFirst && !bNone );
- m_pFormatText->Enable( !bNone );
- m_pFormatBox->Enable( !bNone );
- m_pSepText->Enable( !bNone );
- m_pSepEdit->Enable( !bNone );
+ m_xOptionButton->set_sensitive(m_xOKButton->get_sensitive() && !bNone);
+ m_xNumberingSeparatorFT->set_sensitive(bOrderNumberingFirst && !bNone);
+ m_xNumberingSeparatorED->set_sensitive(bOrderNumberingFirst && !bNone);
+ m_xFormatText->set_sensitive(!bNone);
+ m_xFormatBox->set_sensitive(!bNone);
+ m_xSepText->set_sensitive(!bNone);
+ m_xSepEdit->set_sensitive(!bNone);
DrawSample();
}
-IMPL_LINK_NOARG(SwCaptionDialog, CaptionHdl, Button*, void)
+IMPL_LINK_NOARG(SwCaptionDialog, ModifyEntryHdl, weld::Entry&, void)
{
- SfxItemSet aSet( rView.GetDocShell()->GetDoc()->GetAttrPool() );
- SwCaptionOptDlg aDlg(GetFrameWeld(), aSet);
+ ModifyHdl();
+}
+
+IMPL_LINK_NOARG(SwCaptionDialog, ModifyComboHdl, weld::ComboBox&, void)
+{
+ ModifyHdl();
+}
+
+IMPL_LINK_NOARG(SwCaptionDialog, CaptionHdl, weld::Button&, void)
+{
+ SfxItemSet aSet(rView.GetDocShell()->GetDoc()->GetAttrPool());
+ SwCaptionOptDlg aDlg(m_xDialog.get(), aSet);
aDlg.run();
}
void SwCaptionDialog::DrawSample()
{
OUString aStr;
- OUString sCaption = m_pTextEdit->GetText();
+ OUString sCaption = m_xTextEdit->get_text();
// number
- OUString sFieldTypeName = m_pCategoryBox->GetText();
+ OUString sFieldTypeName = m_xCategoryBox->get_active_text();
bool bNone = sFieldTypeName == m_sNone;
if( !bNone )
{
- const sal_uInt16 nNumFormat = static_cast<sal_uInt16>(reinterpret_cast<sal_uIntPtr>(m_pFormatBox->GetSelectedEntryData()));
- if( SVX_NUM_NUMBER_NONE != nNumFormat )
+ const sal_uInt16 nNumFormat = m_xFormatBox->get_active_id().toUInt32();
+ if (SVX_NUM_NUMBER_NONE != nNumFormat)
{
// category
//#i61007# order of captions
@@ -405,43 +425,22 @@ void SwCaptionDialog::DrawSample()
//#i61007# order of captions
if( bOrderNumberingFirst )
{
- aStr += m_pNumberingSeparatorED->GetText() + sFieldTypeName;
+ aStr += m_xNumberingSeparatorED->get_text() + sFieldTypeName;
}
}
if( !sCaption.isEmpty() )
{
- aStr += m_pSepEdit->GetText();
+ aStr += m_xSepEdit->get_text();
}
}
aStr += sCaption;
// do preview!
- m_pPreview->SetPreviewText( aStr );
+ m_aPreview.SetPreviewText(aStr);
}
SwCaptionDialog::~SwCaptionDialog()
{
- disposeOnce();
-}
-
-void SwCaptionDialog::dispose()
-{
- pMgr.reset();
- m_pTextEdit.clear();
- m_pCategoryBox.clear();
- m_pFormatText.clear();
- m_pFormatBox.clear();
- m_pNumberingSeparatorFT.clear();
- m_pNumberingSeparatorED.clear();
- m_pSepText.clear();
- m_pSepEdit.clear();
- m_pPosText.clear();
- m_pPosBox.clear();
- m_pOKButton.clear();
- m_pAutoCaptionButton.clear();
- m_pOptionButton.clear();
- m_pPreview.clear();
- SvxStandardDialog::dispose();
}
SwSequenceOptionDialog::SwSequenceOptionDialog(weld::Window *pParent, SwView &rV, const OUString& rSeqFieldType )
@@ -530,8 +529,8 @@ void SwSequenceOptionDialog::SetCharacterStyle(const OUString& rStyle)
// #i61007# order of captions
void SwCaptionDialog::ApplyCaptionOrder()
{
- m_pNumberingSeparatorFT->Enable(bOrderNumberingFirst);
- m_pNumberingSeparatorED->Enable(bOrderNumberingFirst);
+ m_xNumberingSeparatorFT->set_sensitive(bOrderNumberingFirst);
+ m_xNumberingSeparatorED->set_sensitive(bOrderNumberingFirst);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/inc/cption.hxx b/sw/source/uibase/inc/cption.hxx
index 38783cb35fe0..fc3be92a3adf 100644
--- a/sw/source/uibase/inc/cption.hxx
+++ b/sw/source/uibase/inc/cption.hxx
@@ -19,11 +19,7 @@
#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_CPTION_HXX
#define INCLUDED_SW_SOURCE_UIBASE_INC_CPTION_HXX
-#include <svx/stddlg.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/lstbox.hxx>
-#include <vcl/edit.hxx>
-#include <vcl/button.hxx>
+#include <sfx2/basedlgs.hxx>
#include "actctrl.hxx"
#include <com/sun/star/container/XNameAccess.hpp>
@@ -34,28 +30,10 @@
class SwFieldMgr;
class SwView;
-
-class SwCaptionDialog : public SvxStandardDialog
+class SwCaptionDialog : public SfxDialogController
{
- VclPtr<Edit> m_pTextEdit;
- VclPtr<ComboBox> m_pCategoryBox;
OUString const m_sNone;
TextFilterAutoConvert m_aTextFilter;
- VclPtr<FixedText> m_pFormatText;
- VclPtr<ListBox> m_pFormatBox;
- //#i61007# order of captions
- VclPtr<FixedText> m_pNumberingSeparatorFT;
- VclPtr<Edit> m_pNumberingSeparatorED;
- VclPtr<FixedText> m_pSepText;
- VclPtr<Edit> m_pSepEdit;
- VclPtr<FixedText> m_pPosText;
- VclPtr<ListBox> m_pPosBox;
- VclPtr<OKButton> m_pOKButton;
- VclPtr<PushButton> m_pAutoCaptionButton;
- VclPtr<PushButton> m_pOptionButton;
-
- VclPtr<SwCaptionPreview> m_pPreview;
-
SwView &rView; // search per active, avoid View
std::unique_ptr<SwFieldMgr> pMgr; // pointer to save the include
@@ -65,22 +43,41 @@ class SwCaptionDialog : public SvxStandardDialog
css::uno::Reference< css::container::XNameAccess > xNameAccess;
- DECL_LINK(SelectHdl, ComboBox&, void);
- DECL_LINK(SelectListBoxHdl, ListBox&, void);
- DECL_LINK(ModifyHdl, Edit&, void);
- DECL_LINK(OptionHdl, Button *, void);
- DECL_LINK(CaptionHdl, Button *, void);
-
- virtual void Apply() override;
-
- void DrawSample();
- void ApplyCaptionOrder(); //#i61007# order of captions
+ CaptionPreview m_aPreview;
+ std::unique_ptr<weld::Entry> m_xTextEdit;
+ std::unique_ptr<weld::ComboBox> m_xCategoryBox;
+ std::unique_ptr<weld::Label> m_xFormatText;
+ std::unique_ptr<weld::ComboBox> m_xFormatBox;
+ //#i61007# order of captions
+ std::unique_ptr<weld::Label> m_xNumberingSeparatorFT;
+ std::unique_ptr<weld::Entry> m_xNumberingSeparatorED;
+ std::unique_ptr<weld::Label> m_xSepText;
+ std::unique_ptr<weld::Entry> m_xSepEdit;
+ std::unique_ptr<weld::Label> m_xPosText;
+ std::unique_ptr<weld::ComboBox> m_xPosBox;
+ std::unique_ptr<weld::Button> m_xOKButton;
+ std::unique_ptr<weld::Button> m_xAutoCaptionButton;
+ std::unique_ptr<weld::Button> m_xOptionButton;
+ std::unique_ptr<weld::CustomWeld> m_xPreview;
+
+ DECL_LINK(SelectListBoxHdl, weld::ComboBox&, void);
+ DECL_LINK(ModifyEntryHdl, weld::Entry&, void);
+ DECL_LINK(ModifyComboHdl, weld::ComboBox&, void);
+ DECL_LINK(OptionHdl, weld::Button&, void);
+ DECL_LINK(CaptionHdl, weld::Button&, void);
+ DECL_LINK(TextFilterHdl, OUString&, bool);
+
+ void Apply();
+
+ void ModifyHdl();
+ void DrawSample();
+ void ApplyCaptionOrder(); //#i61007# order of captions
static OUString our_aSepTextSave; // Save caption separator text
public:
- SwCaptionDialog( vcl::Window *pParent, SwView &rV );
+ SwCaptionDialog(weld::Window *pParent, SwView &rV);
+ virtual short run() override;
virtual ~SwCaptionDialog() override;
- virtual void dispose() override;
};
#endif
diff --git a/sw/source/uibase/uiview/viewdlg2.cxx b/sw/source/uibase/uiview/viewdlg2.cxx
index 08b3985a046e..8bef973e1cd1 100644
--- a/sw/source/uibase/uiview/viewdlg2.cxx
+++ b/sw/source/uibase/uiview/viewdlg2.cxx
@@ -46,14 +46,12 @@ using namespace css;
void SwView::ExecDlgExt(SfxRequest const &rReq)
{
- vcl::Window& rMDI = GetViewFrame()->GetWindow();
-
switch ( rReq.GetSlot() )
{
case FN_INSERT_CAPTION:
{
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- ScopedVclPtr<VclAbstractDialog> pDialog(pFact->CreateSwCaptionDialog( &rMDI, *this ));
+ ScopedVclPtr<VclAbstractDialog> pDialog(pFact->CreateSwCaptionDialog(GetFrameWeld(), *this ));
pDialog->Execute();
break;
}
diff --git a/sw/uiconfig/swriter/ui/insertcaption.ui b/sw/uiconfig/swriter/ui/insertcaption.ui
index a6a05b8cd1dc..e4959fd3e81f 100644
--- a/sw/uiconfig/swriter/ui/insertcaption.ui
+++ b/sw/uiconfig/swriter/ui/insertcaption.ui
@@ -1,18 +1,106 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
<interface domain="sw">
<requires lib="gtk+" version="3.18"/>
- <requires lib="LibreOffice" version="1.0"/>
<object class="GtkDialog" id="InsertCaptionDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="insertcaption|InsertCaptionDialog">Insert Caption</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>
+ <placeholder/>
+ </child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox" id="dialog-action_area1">
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="auto">
+ <property name="label" translatable="yes" context="insertcaption|auto">Auto...</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="options">
+ <property name="label" translatable="yes" context="insertcaption|options">Options...</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="ok">
+ <property name="label">gtk-ok</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="cancel">
+ <property name="label">gtk-cancel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="help">
+ <property name="label">gtk-help</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">4</property>
+ <property name="secondary">True</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
@@ -123,7 +211,7 @@
</packing>
</child>
<child>
- <object class="GtkComboBox" id="numbering">
+ <object class="GtkComboBoxText" id="numbering">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
@@ -172,7 +260,7 @@
</packing>
</child>
<child>
- <object class="GtkComboBox" id="position">
+ <object class="GtkComboBoxText" id="position">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
@@ -247,9 +335,24 @@
<property name="top_padding">6</property>
<property name="left_padding">12</property>
<child>
- <object class="swuilo-SwCaptionPreview" id="preview:border">
+ <object class="GtkScrolledWindow">
<property name="visible">True</property>
- <property name="can_focus">False</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>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
</child>
</object>
@@ -278,97 +381,14 @@
<property name="position">0</property>
</packing>
</child>
- <child internal-child="action_area">
- <object class="GtkButtonBox" id="dialog-action_area1">
- <property name="can_focus">False</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="ok">
- <property name="label">gtk-ok</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="has_default">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="cancel">
- <property name="label">gtk-cancel</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="help">
- <property name="label">gtk-help</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- <property name="secondary">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="auto">
- <property name="label" translatable="yes" context="insertcaption|auto">Auto...</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="options">
- <property name="label" translatable="yes" context="insertcaption|options">Options...</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">4</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">end</property>
- <property name="position">1</property>
- </packing>
- </child>
</object>
</child>
<action-widgets>
+ <action-widget response="101">auto</action-widget>
+ <action-widget response="102">options</action-widget>
<action-widget response="-5">ok</action-widget>
<action-widget response="-6">cancel</action-widget>
<action-widget response="-11">help</action-widget>
- <action-widget response="0">auto</action-widget>
- <action-widget response="0">options</action-widget>
</action-widgets>
</object>
<object class="GtkAdjustment" id="adjustment1">