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

weld ScAttrDlg

Change-Id: I11eb9001604a1997a8bfa80a144306ddcb913d93
Reviewed-on: https://gerrit.libreoffice.org/61011
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst a9805819
......@@ -84,7 +84,6 @@ private:
std::unique_ptr<SvxNumberInfoItem> pNumItem;
std::unique_ptr<SvxNumberFormatShell> pNumFmtShell;
sal_uLong nInitFormat;
Link<SfxPoolItem const *,void> fnOkHdl;
bool bNumItemFlag; ///< for handling with DocShell
bool bOneAreaFlag;
......
......@@ -1126,10 +1126,8 @@ IMPL_LINK(SvxNumberFormatTabPage, DoubleClickHdl_Impl, weld::TreeView&, rLb, voi
{
SelFormatHdl_Impl(&rLb);
if ( fnOkHdl.IsSet() )
{ // temporary solution, should be offered by SfxTabPage
fnOkHdl.Call( nullptr );
}
if (SfxTabDialogController* pController = GetDialogController())
pController->getDialog()->response(RET_OK);
else
{
SfxSingleTabDialog* pParent = dynamic_cast<SfxSingleTabDialog*>(GetParentDialog());
......@@ -1734,11 +1732,8 @@ void SvxNumberFormatTabPage::AddAutomaticLanguage_Impl(LanguageType eAutoLang, b
void SvxNumberFormatTabPage::PageCreated(const SfxAllItemSet& aSet)
{
const SvxNumberInfoItem* pNumberInfoItem = aSet.GetItem<SvxNumberInfoItem>(SID_ATTR_NUMBERFORMAT_INFO, false);
const SfxLinkItem* pLinkItem = aSet.GetItem<SfxLinkItem>(SID_LINK_TYPE, false);
if (pNumberInfoItem && !pNumItem)
pNumItem.reset( static_cast<SvxNumberInfoItem*>(pNumberInfoItem->Clone()) );
if (pLinkItem)
fnOkHdl = pLinkItem->GetValue();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -817,7 +817,7 @@ class SfxStringItem;
#define SID_FLAG_TYPE ( SID_SVX_START + 1034 )
#define SID_SWMODE_TYPE ( SID_SVX_START + 1035 )
#define SID_DISABLE_CTL ( SID_SVX_START + 1036 )
#define SID_LINK_TYPE ( SID_SVX_START + 1037 )
//FREE
#define SID_ENUM_PAGE_MODE ( SID_SVX_START + 1038 )
#define SID_PAPER_START ( SID_SVX_START + 1039 )
#define SID_PAPER_END ( SID_SVX_START + 1040 )
......
......@@ -515,8 +515,8 @@ public:
bool bOnlyDbtoolsEncodings,
bool bImport = true ) = 0;
virtual VclPtr<SfxAbstractTabDialog> CreateScAttrDlg( vcl::Window* pParent,
const SfxItemSet* pCellAttrs ) = 0;
virtual VclPtr<SfxAbstractTabDialog> CreateScAttrDlg(weld::Window* pParent,
const SfxItemSet* pCellAttrs) = 0;
virtual VclPtr<SfxAbstractTabDialog> CreateScHFEditDlg(vcl::Window* pParent,
const SfxItemSet& rCoreSet,
......
......@@ -268,11 +268,9 @@ VclPtr<VclAbstractDialog> ScScreenshotTest::createDialogByID(sal_uInt32 nID)
mpItemSet->MergeRange(SID_ATTR_NUMBERFORMAT_INFO, SID_ATTR_NUMBERFORMAT_INFO);
mpItemSet->Put(*pNumberInfoItem);
pReturnDialog = mpFact->CreateScAttrDlg(mpViewShell->GetDialogParent(), mpItemSet.get());
pReturnDialog = mpFact->CreateScAttrDlg(mpViewShell->GetFrameWeld(), mpItemSet.get());
break;
}
//ScopedVclPtrInstance<ScShareDocumentDlg> pDlg14( mpViewShell->GetDialogParent(), &rViewData );
//ScopedVclPtrInstance<ScTableProtectionDlg> pDlg16(mpViewShell->GetDialogParent());
default:
break;
}
......
......@@ -33,22 +33,23 @@
#include <editeng/flstitem.hxx>
#include <sfx2/app.hxx>
ScAttrDlg::ScAttrDlg(vcl::Window* pParent, const SfxItemSet* pCellAttrs)
: SfxTabDialog(pParent, "FormatCellsDialog", "modules/scalc/ui/formatcellsdialog.ui", pCellAttrs)
ScAttrDlg::ScAttrDlg(weld::Window* pParent, const SfxItemSet* pCellAttrs)
: SfxTabDialogController(pParent, "modules/scalc/ui/formatcellsdialog.ui",
"FormatCellsDialog", pCellAttrs)
{
SvtCJKOptions aCJKOptions;
SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ), "GetTabPageCreatorFunc fail!");
m_nNumberPageId = AddTabPage( "numbers", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ), nullptr );
AddTabPage( "numbers", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ), nullptr );
OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), "GetTabPageCreatorFunc fail!");
m_nFontPageId = AddTabPage( "font", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), nullptr );
AddTabPage( "font", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), nullptr );
OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), "GetTabPageCreatorFunc fail!");
AddTabPage( "fonteffects", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), nullptr );
OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT ), "GetTabPageCreatorFunc fail!");
AddTabPage( "alignment", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT ), nullptr );
if ( aCJKOptions.IsAsianTypographyEnabled() )
SvtCJKOptions aCJKOptions;
if (aCJKOptions.IsAsianTypographyEnabled())
{
OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageCreatorFunc fail!");
AddTabPage( "asiantypography", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), nullptr );
......@@ -66,29 +67,21 @@ ScAttrDlg::~ScAttrDlg()
{
}
void ScAttrDlg::PageCreated( sal_uInt16 nPageId, SfxTabPage& rTabPage )
void ScAttrDlg::PageCreated(const OString& rPageId, SfxTabPage& rTabPage)
{
SfxObjectShell* pDocSh = SfxObjectShell::Current();
SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
if (nPageId == m_nNumberPageId)
if (rPageId == "numbers")
{
aSet.Put (SfxLinkItem( SID_LINK_TYPE, LINK( this, ScAttrDlg, OkHandler )));
rTabPage.PageCreated(aSet);
}
else if (nPageId == m_nFontPageId)
else if (rPageId == "font")
{
const SfxPoolItem* pInfoItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST );
OSL_ENSURE( pInfoItem, "FontListItem not found :-(" );
assert(pInfoItem && "FontListItem not found :-(");
aSet.Put (SvxFontListItem(static_cast<const SvxFontListItem*>(pInfoItem)->GetFontList(), SID_ATTR_CHAR_FONTLIST ));
rTabPage.PageCreated(aSet);
}
}
IMPL_LINK_NOARG(ScAttrDlg, OkHandler, SfxPoolItem const *, void)
{
GetOKButton().GetClickHdl().Call( nullptr );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -693,6 +693,11 @@ short ScAbstractTabController_Impl::Execute()
return m_xDlg->execute();
}
bool ScAbstractTabController_Impl::StartExecuteAsync(AsyncContext &rCtx)
{
return SfxTabDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
}
void ScAbstractTabController_Impl::SetCurPageId( const OString &rName )
{
m_xDlg->SetCurPageId( rName );
......@@ -957,10 +962,9 @@ VclPtr<AbstractScImportOptionsDlg> ScAbstractDialogFactory_Impl::CreateScImportO
return VclPtr<AbstractScImportOptionsDlg_Impl>::Create( pDlg );
}
VclPtr<SfxAbstractTabDialog> ScAbstractDialogFactory_Impl::CreateScAttrDlg(vcl::Window* pParent, const SfxItemSet* pCellAttrs)
VclPtr<SfxAbstractTabDialog> ScAbstractDialogFactory_Impl::CreateScAttrDlg(weld::Window* pParent, const SfxItemSet* pCellAttrs)
{
VclPtr<SfxTabDialog> pDlg = VclPtr<ScAttrDlg>::Create(pParent, pCellAttrs);
return VclPtr<ScAbstractTabDialog_Impl>::Create(pDlg);
return VclPtr<ScAbstractTabController_Impl>::Create(o3tl::make_unique<ScAttrDlg>(pParent, pCellAttrs));
}
VclPtr<SfxAbstractTabDialog> ScAbstractDialogFactory_Impl::CreateScHFEditDlg( vcl::Window* pParent,
......
......@@ -518,13 +518,14 @@ class ScAbstractTabDialog_Impl : public SfxAbstractTabDialog
class ScAbstractTabController_Impl : public SfxAbstractTabDialog
{
protected:
std::unique_ptr<SfxTabDialogController> m_xDlg;
std::shared_ptr<SfxTabDialogController> m_xDlg;
public:
explicit ScAbstractTabController_Impl(std::unique_ptr<SfxTabDialogController> p)
: m_xDlg(std::move(p))
{
}
virtual short Execute() override;
virtual bool StartExecuteAsync(AsyncContext &rCtx) override;
virtual void SetCurPageId( const OString &rName ) override;
virtual const SfxItemSet* GetOutputItemSet() const override;
virtual const sal_uInt16* GetInputRanges( const SfxItemPool& pItem ) override;
......@@ -662,8 +663,8 @@ public:
const OUString* pStrTitle,
bool bOnlyDbtoolsEncodings,
bool bImport = true ) override;
virtual VclPtr<SfxAbstractTabDialog> CreateScAttrDlg( vcl::Window* pParent,
const SfxItemSet* pCellAttrs ) override;
virtual VclPtr<SfxAbstractTabDialog> CreateScAttrDlg(weld::Window* pParent,
const SfxItemSet* pCellAttrs) override;
virtual VclPtr<SfxAbstractTabDialog> CreateScHFEditDlg(vcl::Window* pParent,
const SfxItemSet& rCoreSet,
......
......@@ -22,24 +22,17 @@
#include <sfx2/tabdlg.hxx>
namespace vcl { class Window; }
namespace weld { class Window; }
class SfxViewFrame;
class SfxItemSet;
class ScAttrDlg : public SfxTabDialog
class ScAttrDlg : public SfxTabDialogController
{
public:
ScAttrDlg( vcl::Window* pParent,
const SfxItemSet* pCellAttrs );
virtual ~ScAttrDlg() override;
ScAttrDlg(weld::Window* pParent, const SfxItemSet* pCellAttrs);
virtual ~ScAttrDlg() override;
protected:
virtual void PageCreated( sal_uInt16 nPageId, SfxTabPage& rTabPage ) override;
private:
DECL_LINK( OkHandler, SfxPoolItem const *, void ); // for closing by double clicking in TabPages
sal_uInt16 m_nNumberPageId;
sal_uInt16 m_nFontPageId;
virtual void PageCreated(const OString& rPageId, SfxTabPage& rTabPage) override;
};
#endif // INCLUDED_SC_SOURCE_UI_INC_ATTRDLG_HXX
......
......@@ -542,7 +542,7 @@ void ScTabViewShell::ExecuteCellFormatDlg(SfxRequest& rReq, const OString &rName
bInFormatDialog = true;
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
VclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateScAttrDlg(GetDialogParent(), pOldSet.get()));
VclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateScAttrDlg(GetFrameWeld(), pOldSet.get()));
if (!rName.isEmpty())
pDlg->SetCurPageId(rName);
......@@ -551,23 +551,25 @@ void ScTabViewShell::ExecuteCellFormatDlg(SfxRequest& rReq, const OString &rName
rReq.Ignore(); // the 'old' request is not relevant any more
pDlg->StartExecuteAsync([=](sal_Int32 nResult){
bInFormatDialog = false;
bInFormatDialog = false;
if ( nResult == RET_OK )
if ( nResult == RET_OK )
{
const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
const SfxPoolItem* pItem=nullptr;
if(pOutSet->GetItemState(SID_ATTR_NUMBERFORMAT_INFO,true,&pItem)==SfxItemState::SET)
{
const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
UpdateNumberFormatter(static_cast<const SvxNumberInfoItem&>(*pItem));
}
const SfxPoolItem* pItem=nullptr;
if(pOutSet->GetItemState(SID_ATTR_NUMBERFORMAT_INFO,true,&pItem)==SfxItemState::SET)
{
UpdateNumberFormatter(static_cast<const SvxNumberInfoItem&>(*pItem));
}
ApplyAttributes(pOutSet, pOldSet.get());
ApplyAttributes(pOutSet, pOldSet.get());
pRequest->Done(*pOutSet);
}
pRequest->Done(*pOutSet);
}
});
pDlg->disposeOnce();
});
}
bool ScTabViewShell::IsRefInputMode() const
......
......@@ -87,8 +87,6 @@ SvxFontListBox::SvxFontListBox(vcl::Window* pParent, WinBits nStyle)
maEntryFont = aStdFont;
}
VCL_BUILDER_FACTORY_CONSTRUCTOR(SvxFontListBox, WB_TABSTOP)
void SvxFontListBox::InsertFontEntry( const OUString& rString, const vcl::Font& rFont, const Color* pColor )
{
mbUseFont = true; // InitEntry() will use maEntryFont
......
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