summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-09-15 15:27:34 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-09-18 10:05:31 +0200
commit0693d69d6080b6976133e0e68db2637d0030370d (patch)
treebaaca2a2f85a7b33d0e9bfc89fd805527542b513
parent5889fd4416cd9569c44e2d250ce5d027974bd243 (diff)
weld ScCharDlg
Change-Id: Ie0fe76ef5c5c706007c2285b3a309d92ff4bc2b0 Reviewed-on: https://gerrit.libreoffice.org/60528 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--include/sfx2/tabdlg.hxx10
-rw-r--r--sc/inc/scabstdlg.hxx2
-rw-r--r--sc/source/ui/attrdlg/scdlgfact.cxx5
-rw-r--r--sc/source/ui/attrdlg/scdlgfact.hxx2
-rw-r--r--sc/source/ui/drawfunc/drtxtob1.cxx2
-rw-r--r--sc/source/ui/inc/textdlgs.hxx9
-rw-r--r--sc/source/ui/inc/viewdata.hxx3
-rw-r--r--sc/source/ui/miscdlgs/textdlgs.cxx18
-rw-r--r--sc/source/ui/pagedlg/tphfedit.cxx3
-rw-r--r--sc/source/ui/view/editsh.cxx2
-rw-r--r--sc/source/ui/view/viewdata.cxx20
-rw-r--r--sc/uiconfig/scalc/ui/chardialog.ui101
-rw-r--r--sfx2/source/dialog/tabdlg.cxx12
13 files changed, 140 insertions, 49 deletions
diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx
index 9db50e400958..12dd8201fce9 100644
--- a/include/sfx2/tabdlg.hxx
+++ b/include/sfx2/tabdlg.hxx
@@ -288,9 +288,13 @@ public:
const SfxItemSet * = nullptr, bool bEditFmt = false);
virtual ~SfxTabDialogController() override;
- void AddTabPage( const OString& rName, // Name of the label for the page in the notebook .ui
- CreateTabPage pCreateFunc, // != 0
- GetTabPageRanges pRangesFunc); // can be 0
+ void AddTabPage(const OString& rName, // Name of the label for the page in the notebook .ui
+ CreateTabPage pCreateFunc, // != 0
+ GetTabPageRanges pRangesFunc); // can be 0
+
+ void AddTabPage(const OString &rName, // Name of the label for the page in the notebook .ui
+ sal_uInt16 nPageCreateId); // Identifier of the Factory Method to create the page
+
void RemoveTabPage( const OString& rName ); // Name of the label for the page in the notebook .ui
void SetCurPageId(const OString& rName);
diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index 170d739da8db..d87563051ab8 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -531,7 +531,7 @@ public:
virtual VclPtr<SfxAbstractTabDialog> CreateScSubTotalDlg( vcl::Window* pParent,
const SfxItemSet* pArgSet ) = 0;
- virtual VclPtr<SfxAbstractTabDialog> CreateScCharDlg(vcl::Window* pParent,
+ virtual VclPtr<SfxAbstractTabDialog> CreateScCharDlg(weld::Window* pParent,
const SfxItemSet* pAttr, const SfxObjectShell* pDocShell) = 0;
virtual VclPtr<SfxAbstractTabDialog> CreateScParagraphDlg(vcl::Window* pParent,
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index b1c72c9ed02b..3e5e79fe5361 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -1038,10 +1038,9 @@ VclPtr<SfxAbstractTabDialog> ScAbstractDialogFactory_Impl::CreateScSubTotalDlg(v
}
VclPtr<SfxAbstractTabDialog> ScAbstractDialogFactory_Impl::CreateScCharDlg(
- vcl::Window* pParent, const SfxItemSet* pAttr, const SfxObjectShell* pDocShell)
+ weld::Window* pParent, const SfxItemSet* pAttr, const SfxObjectShell* pDocShell)
{
- VclPtr<SfxTabDialog> pDlg = VclPtr<ScCharDlg>::Create(pParent, pAttr, pDocShell);
- return VclPtr<ScAbstractTabDialog_Impl>::Create(pDlg);
+ return VclPtr<ScAbstractTabController_Impl>::Create(o3tl::make_unique<ScCharDlg>(pParent, pAttr, pDocShell));
}
VclPtr<SfxAbstractTabDialog> ScAbstractDialogFactory_Impl::CreateScParagraphDlg(
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index a91779ce16ad..3f8675b56f52 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -677,7 +677,7 @@ public:
virtual VclPtr<SfxAbstractTabDialog> CreateScSubTotalDlg( vcl::Window* pParent,
const SfxItemSet* pArgSet ) override;
- virtual VclPtr<SfxAbstractTabDialog> CreateScCharDlg(vcl::Window* pParent,
+ virtual VclPtr<SfxAbstractTabDialog> CreateScCharDlg(weld::Window* pParent,
const SfxItemSet* pAttr, const SfxObjectShell* pDocShell) override;
virtual VclPtr<SfxAbstractTabDialog> CreateScParagraphDlg(vcl::Window* pParent,
diff --git a/sc/source/ui/drawfunc/drtxtob1.cxx b/sc/source/ui/drawfunc/drtxtob1.cxx
index dfad2d5de902..4c935934d22e 100644
--- a/sc/source/ui/drawfunc/drtxtob1.cxx
+++ b/sc/source/ui/drawfunc/drtxtob1.cxx
@@ -44,7 +44,7 @@ bool ScDrawTextObjectBar::ExecuteCharDlg( const SfxItemSet& rArgs,
{
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateScCharDlg(
- pViewData->GetDialogParent(), &rArgs,
+ pViewData->GetFrameWeld(), &rArgs,
pViewData->GetSfxDocShell()));
if (nSlot == SID_CHAR_DLG_EFFECT)
{
diff --git a/sc/source/ui/inc/textdlgs.hxx b/sc/source/ui/inc/textdlgs.hxx
index 13ff4590fd6e..2e4fc68ff472 100644
--- a/sc/source/ui/inc/textdlgs.hxx
+++ b/sc/source/ui/inc/textdlgs.hxx
@@ -24,17 +24,14 @@
class SfxObjectShell;
-class ScCharDlg : public SfxTabDialog
+class ScCharDlg : public SfxTabDialogController
{
private:
const SfxObjectShell& rDocShell;
- sal_uInt16 m_nNamePageId;
- sal_uInt16 m_nEffectsPageId;
- virtual void PageCreated(sal_uInt16 nId, SfxTabPage &rPage) override;
+ virtual void PageCreated(const OString& rId, SfxTabPage &rPage) override;
public:
- ScCharDlg(vcl::Window* pParent, const SfxItemSet* pAttr,
- const SfxObjectShell* pDocShell);
+ ScCharDlg(weld::Window* pParent, const SfxItemSet* pAttr, const SfxObjectShell* pDocShell);
};
class ScParagraphDlg : public SfxTabDialog
diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx
index 0027a73abae2..4e1c5f46a761 100644
--- a/sc/source/ui/inc/viewdata.hxx
+++ b/sc/source/ui/inc/viewdata.hxx
@@ -360,7 +360,8 @@ public:
ScMarkData& GetMarkData();
const ScMarkData& GetMarkData() const;
- vcl::Window* GetDialogParent(); // forwarded from tabvwsh
+ vcl::Window* GetDialogParent(); // forwarded from tabvwsh
+ weld::Window* GetFrameWeld(); // forwarded from tabvwsh
ScGridWindow* GetActiveWin(); // from View
const ScGridWindow* GetActiveWin() const;
ScDrawView* GetScDrawView(); // from View
diff --git a/sc/source/ui/miscdlgs/textdlgs.cxx b/sc/source/ui/miscdlgs/textdlgs.cxx
index 504d480cec36..56d804a57c6e 100644
--- a/sc/source/ui/miscdlgs/textdlgs.cxx
+++ b/sc/source/ui/miscdlgs/textdlgs.cxx
@@ -31,23 +31,19 @@
#include <svl/intitem.hxx>
#include <svx/flagsdef.hxx>
-ScCharDlg::ScCharDlg( vcl::Window* pParent, const SfxItemSet* pAttr,
- const SfxObjectShell* pDocShell )
- : SfxTabDialog(pParent, "CharDialog",
- "modules/scalc/ui/chardialog.ui", pAttr)
+ScCharDlg::ScCharDlg(weld::Window* pParent, const SfxItemSet* pAttr, const SfxObjectShell* pDocShell)
+ : SfxTabDialogController(pParent, "modules/scalc/ui/chardialog.ui", "CharDialog", pAttr)
, rDocShell(*pDocShell)
- , m_nNamePageId(0)
- , m_nEffectsPageId(0)
{
- m_nNamePageId = AddTabPage("font", RID_SVXPAGE_CHAR_NAME);
- m_nEffectsPageId = AddTabPage("fonteffects", RID_SVXPAGE_CHAR_EFFECTS);
+ AddTabPage("font", RID_SVXPAGE_CHAR_NAME);
+ AddTabPage("fonteffects", RID_SVXPAGE_CHAR_EFFECTS);
AddTabPage("position", RID_SVXPAGE_CHAR_POSITION);
}
-void ScCharDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
+void ScCharDlg::PageCreated(const OString& rId, SfxTabPage &rPage)
{
SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
- if (nId == m_nNamePageId)
+ if (rId == "font")
{
SvxFontListItem aItem(*static_cast<const SvxFontListItem*>(
( rDocShell.GetItem( SID_ATTR_CHAR_FONTLIST) ) ) );
@@ -55,7 +51,7 @@ void ScCharDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
aSet.Put (SvxFontListItem( aItem.GetFontList(), SID_ATTR_CHAR_FONTLIST));
rPage.PageCreated(aSet);
}
- else if (nId == m_nEffectsPageId)
+ else if (rId == "fonteffects")
{
aSet.Put (SfxUInt16Item(SID_DISABLE_CTL,DISABLE_CASEMAP));
rPage.PageCreated(aSet);
diff --git a/sc/source/ui/pagedlg/tphfedit.cxx b/sc/source/ui/pagedlg/tphfedit.cxx
index 617b26446b9a..a2da0b30da8d 100644
--- a/sc/source/ui/pagedlg/tphfedit.cxx
+++ b/sc/source/ui/pagedlg/tphfedit.cxx
@@ -201,8 +201,9 @@ void ScEditWindow::SetCharAttributes()
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
+ vcl::Window* pWin = GetParent();
ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateScCharDlg(
- GetParent(), &aSet, pDocSh));
+ pWin ? pWin->GetFrameWeld() : nullptr, &aSet, pDocSh));
pDlg->SetText( ScResId( STR_TEXTATTRS ) );
if ( pDlg->Execute() == RET_OK )
{
diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index 06c33982ad4d..8e0cd5593ad2 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -503,7 +503,7 @@ void ScEditShell::Execute( SfxRequest& rReq )
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateScCharDlg(
- pViewData->GetDialogParent(), &aAttrs, pObjSh));
+ pViewData->GetFrameWeld(), &aAttrs, pObjSh));
if (nSlot == SID_CHAR_DLG_EFFECT)
{
pDlg->SetCurPageId("fonteffects");
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 1aa33415f54b..019480b9acb1 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -2654,13 +2654,13 @@ ScDocFunc& ScViewData::GetDocFunc() const
SfxBindings& ScViewData::GetBindings()
{
- OSL_ENSURE( pViewShell, "GetBindings() without ViewShell" );
+ assert(pViewShell && "GetBindings() without ViewShell");
return pViewShell->GetViewFrame()->GetBindings();
}
SfxDispatcher& ScViewData::GetDispatcher()
{
- OSL_ENSURE( pViewShell, "GetDispatcher() without ViewShell" );
+ assert(pViewShell && "GetDispatcher() without ViewShell");
return *pViewShell->GetViewFrame()->GetDispatcher();
}
@@ -2676,31 +2676,37 @@ const ScMarkData& ScViewData::GetMarkData() const
vcl::Window* ScViewData::GetDialogParent()
{
- OSL_ENSURE( pViewShell, "GetDialogParent() without ViewShell" );
+ assert(pViewShell && "GetDialogParent() without ViewShell");
return pViewShell->GetDialogParent();
}
+weld::Window* ScViewData::GetFrameWeld()
+{
+ assert(pViewShell && "GetDialogParent() without ViewShell");
+ return pViewShell->GetFrameWeld();
+}
+
ScGridWindow* ScViewData::GetActiveWin()
{
- OSL_ENSURE( pView, "GetActiveWin() without View" );
+ assert(pView && "GetActiveWin() without View");
return pView->GetActiveWin();
}
const ScGridWindow* ScViewData::GetActiveWin() const
{
- OSL_ENSURE( pView, "GetActiveWin() without View" );
+ assert(pView && "GetActiveWin() without View");
return pView->GetActiveWin();
}
ScDrawView* ScViewData::GetScDrawView()
{
- OSL_ENSURE( pView, "GetScDrawView() without View" );
+ assert(pView && "GetScDrawView() without View");
return pView->GetScDrawView();
}
bool ScViewData::IsMinimized()
{
- OSL_ENSURE( pView, "IsMinimized() without View" );
+ assert(pView && "IsMinimized() without View");
return pView->IsMinimized();
}
diff --git a/sc/uiconfig/scalc/ui/chardialog.ui b/sc/uiconfig/scalc/ui/chardialog.ui
index 51e9643569ab..b9ad8b26fa62 100644
--- a/sc/uiconfig/scalc/ui/chardialog.ui
+++ b/sc/uiconfig/scalc/ui/chardialog.ui
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.0 -->
+<!-- Generated with glade 3.22.1 -->
<interface domain="sc">
<requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="CharDialog">
@@ -8,6 +8,9 @@
<property name="title" translatable="yes" context="chardialog|CharDialog">Character</property>
<property name="resizable">False</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>
@@ -18,12 +21,10 @@
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
- <object class="GtkButton" id="ok">
- <property name="label">gtk-ok</property>
+ <object class="GtkButton" id="reset">
+ <property name="label">gtk-revert-to-saved</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>
@@ -34,10 +35,12 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="cancel">
- <property name="label">gtk-cancel</property>
+ <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>
@@ -48,8 +51,8 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="help">
- <property name="label">gtk-help</property>
+ <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>
@@ -59,12 +62,11 @@
<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="reset">
- <property name="label">gtk-revert-to-saved</property>
+ <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>
@@ -74,6 +76,7 @@
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
+ <property name="secondary">True</property>
</packing>
</child>
</object>
@@ -97,6 +100,30 @@
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</object>
</child>
<child type="tab">
@@ -116,6 +143,30 @@
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</object>
<packing>
<property name="position">1</property>
@@ -139,6 +190,30 @@
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</object>
<packing>
<property name="position">2</property>
@@ -165,10 +240,10 @@
</object>
</child>
<action-widgets>
+ <action-widget response="0">reset</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">reset</action-widget>
</action-widgets>
</object>
</interface>
diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index 57a21626add1..d4bfaf1db24d 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -2016,6 +2016,18 @@ void SfxTabDialogController::AddTabPage
m_pImpl->aData.push_back(new Data_Impl(m_pImpl->aData.size(), rName, pCreateFunc, pRangesFunc));
}
+void SfxTabDialogController::AddTabPage
+(
+ const OString &rName, // Page ID
+ sal_uInt16 nPageCreateId // Identifier of the Factory Method to create the page
+)
+{
+ SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
+ CreateTabPage pCreateFunc = pFact->GetTabPageCreatorFunc(nPageCreateId);
+ GetTabPageRanges pRangesFunc = pFact->GetTabPageRangesFunc(nPageCreateId);
+ AddTabPage(rName, pCreateFunc, pRangesFunc);
+}
+
void SfxTabDialogController::CreatePages()
{
for (auto pDataObject : m_pImpl->aData)