summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-05-29 10:02:58 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-05-29 14:56:04 +0200
commitaa687b22991e6c674b1d8653d52fbe9a50080174 (patch)
tree9e048b07ba05362a99ea79cc79065afc4f45c734 /sfx2
parentb7b78dfc0719c3aa0e250b2992d3b04e135a26be (diff)
weld SfxDocumentInfoDialog
Change-Id: I79d5d8973a19c0e639081ec61ac596620518d0b5 Reviewed-on: https://gerrit.libreoffice.org/73145 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/dialog/dinfdlg.cxx39
-rw-r--r--sfx2/source/doc/objcont.cxx10
-rw-r--r--sfx2/source/doc/objserv.cxx12
-rw-r--r--sfx2/uiconfig/ui/custominfopage.ui2
-rw-r--r--sfx2/uiconfig/ui/documentpropertiesdialog.ui153
5 files changed, 168 insertions, 48 deletions
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 2650765ce253..02afc0af8452 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -87,8 +87,6 @@ using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::ui::dialogs;
using namespace ::com::sun::star::uno;
-const sal_uInt16 FONT_PAGE_ID = 99;
-
struct CustomProperty
{
OUString m_sName;
@@ -1089,11 +1087,9 @@ void SfxDocumentPage::Reset( const SfxItemSet* rSet )
m_xUseThumbnailSaveCB->save_state();
}
-SfxDocumentInfoDialog::SfxDocumentInfoDialog( vcl::Window* pParent,
- const SfxItemSet& rItemSet )
- : SfxTabDialog(pParent, "DocumentPropertiesDialog",
- "sfx/ui/documentpropertiesdialog.ui", &rItemSet)
- , m_nDocInfoId(0)
+SfxDocumentInfoDialog::SfxDocumentInfoDialog(weld::Window* pParent, const SfxItemSet& rItemSet)
+ : SfxTabDialogController(pParent, "sfx/ui/documentpropertiesdialog.ui",
+ "DocumentPropertiesDialog", &rItemSet)
{
const SfxDocumentInfoItem& rInfoItem = rItemSet.Get( SID_DOCINFO );
@@ -1104,7 +1100,7 @@ SfxDocumentInfoDialog::SfxDocumentInfoDialog( vcl::Window* pParent,
// Determine the Titles
const SfxPoolItem* pItem = nullptr;
- OUString aTitle( GetText() );
+ OUString aTitle(m_xDialog->get_title());
if ( SfxItemState::SET !=
rItemSet.GetItemState( SID_EXPLORER_PROPS_START, false, &pItem ) )
{
@@ -1131,27 +1127,26 @@ SfxDocumentInfoDialog::SfxDocumentInfoDialog( vcl::Window* pParent,
"SfxDocumentInfoDialog:<SfxStringItem> expected" );
aTitle = aTitle.replaceFirst("%1", static_cast<const SfxStringItem*>(pItem)->GetValue());
}
- SetText( aTitle );
+ m_xDialog->set_title(aTitle);
// Property Pages
- m_nDocInfoId = AddTabPage("general", SfxDocumentPage::Create);
- AddTabPage("description", SfxDocumentDescPage::Create);
- AddTabPage("customprops", SfxCustomPropertiesPage::Create);
- AddTabPage("cmisprops", SfxCmisPropertiesPage::Create);
- AddTabPage("security", SfxSecurityPage::Create);
+ AddTabPage("general", SfxDocumentPage::Create, nullptr);
+ AddTabPage("description", SfxDocumentDescPage::Create, nullptr);
+ AddTabPage("customprops", SfxCustomPropertiesPage::Create, nullptr);
+ AddTabPage("cmisprops", SfxCmisPropertiesPage::Create, nullptr);
+ AddTabPage("security", SfxSecurityPage::Create, nullptr);
}
-void SfxDocumentInfoDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
+void SfxDocumentInfoDialog::PageCreated(const OString& rId, SfxTabPage &rPage)
{
- if ( m_nDocInfoId == nId )
+ if (rId == "general")
static_cast<SfxDocumentPage&>(rPage).EnableUseUserData();
}
void SfxDocumentInfoDialog::AddFontTabPage()
{
- AddTabPage(FONT_PAGE_ID, SfxResId(STR_FONT_TABPAGE), SfxDocumentFontsPage::Create);
- SetPageName(FONT_PAGE_ID , "font");
+ AddTabPage("font", SfxResId(STR_FONT_TABPAGE), SfxDocumentFontsPage::Create);
}
// class CustomPropertiesYesNoButton -------------------------------------
@@ -1263,6 +1258,8 @@ namespace
{
for (size_t i = 0; i < SAL_N_ELEMENTS(SFX_CB_PROPERTY_STRINGARRAY); ++i)
rNameBox.append_text(SfxResId(SFX_CB_PROPERTY_STRINGARRAY[i]));
+ Size aSize(rNameBox.get_preferred_size());
+ rNameBox.set_size_request(aSize.Width(), aSize.Height());
}
void fillTypeBox(weld::ComboBox& rTypeBox)
@@ -1273,6 +1270,8 @@ namespace
rTypeBox.append(sId, SfxResId(SFX_LB_PROPERTY_STRINGARRAY[i].first));
}
rTypeBox.set_active(0);
+ Size aSize(rTypeBox.get_preferred_size());
+ rTypeBox.set_size_request(aSize.Width(), aSize.Height());
}
}
@@ -1781,7 +1780,7 @@ void CustomPropertiesControl::Init(weld::Builder& rBuilder)
std::unique_ptr<CustomPropertyLine> xNewLine(new CustomPropertyLine(m_xPropertiesWin.get(), m_xBody.get()));
Size aLineSize(xNewLine->m_xLine->get_preferred_size());
m_xPropertiesWin->SetLineHeight(aLineSize.Height() + 6);
- m_xBody->set_size_request(aLineSize.Width(), -1);
+ m_xBody->set_size_request(aLineSize.Width() + 6, -1);
auto nHeight = aLineSize.Height() * 8;
m_xVertScroll->set_size_request(-1, nHeight + 6);
@@ -1808,6 +1807,8 @@ void CustomPropertiesControl::Init(weld::Builder& rBuilder)
IMPL_LINK(CustomPropertiesControl, ResizeHdl, const Size&, rSize, void)
{
int nHeight = rSize.Height() - 6;
+ if (nHeight == m_xPropertiesWin->GetHeight())
+ return;
m_xPropertiesWin->SetHeight(nHeight);
sal_Int32 nScrollOffset = m_xPropertiesWin->GetLineHeight();
sal_Int32 nVisibleEntries = nHeight / nScrollOffset;
diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx
index 709d03d4ae8e..938a1c0771c7 100644
--- a/sfx2/source/doc/objcont.cxx
+++ b/sfx2/source/doc/objcont.cxx
@@ -282,16 +282,12 @@ void SfxObjectShell::UpdateTime_Impl(
}
}
-
-VclPtr<SfxDocumentInfoDialog> SfxObjectShell::CreateDocumentInfoDialog
-(
- const SfxItemSet& rSet
-)
+std::unique_ptr<SfxDocumentInfoDialog> SfxObjectShell::CreateDocumentInfoDialog(weld::Window* pParent,
+ const SfxItemSet& rSet)
{
- return VclPtr<SfxDocumentInfoDialog>::Create(nullptr, rSet);
+ return std::make_unique<SfxDocumentInfoDialog>(pParent, rSet);
}
-
std::set<Color> SfxObjectShell::GetDocColors()
{
std::set<Color> empty;
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 2063f40aa090..8df1c3e0fecf 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -500,16 +500,13 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
// creating dialog is done via virtual method; application will
// add its own statistics page
- VclAbstractDialog::AsyncContext aCtx;
std::shared_ptr<SfxRequest> pReq = std::make_shared<SfxRequest>(rReq);
- VclPtr<SfxDocumentInfoDialog> pDlg(CreateDocumentInfoDialog(aSet));
-
- aCtx.mxOwner = pDlg;
- aCtx.maEndDialogFn = [this, pDlg, xCmisDoc, pReq](sal_Int32 nResult)
+ std::shared_ptr<SfxDocumentInfoDialog> xDlg(CreateDocumentInfoDialog(rReq.GetFrameWeld(), aSet));
+ SfxTabDialogController::runAsync(xDlg, [this, xDlg, xCmisDoc, pReq](sal_Int32 nResult)
{
if (RET_OK == nResult)
{
- const SfxDocumentInfoItem* pDocInfoItem = SfxItemSet::GetItem<SfxDocumentInfoItem>(pDlg->GetOutputItemSet(), SID_DOCINFO, false);
+ const SfxDocumentInfoItem* pDocInfoItem = SfxItemSet::GetItem<SfxDocumentInfoItem>(xDlg->GetOutputItemSet(), SID_DOCINFO, false);
if ( pDocInfoItem )
{
// user has done some changes to DocumentInfo
@@ -537,9 +534,8 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
else
// nothing done; no recording
pReq->Ignore();
- };
+ });
- pDlg->StartExecuteAsync(aCtx);
rReq.Ignore();
}
diff --git a/sfx2/uiconfig/ui/custominfopage.ui b/sfx2/uiconfig/ui/custominfopage.ui
index 304b33a216f8..86e520a12095 100644
--- a/sfx2/uiconfig/ui/custominfopage.ui
+++ b/sfx2/uiconfig/ui/custominfopage.ui
@@ -96,6 +96,8 @@
<object class="GtkBox" id="properties">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="valign">start</property>
+ <property name="vexpand">False</property>
<property name="border_width">3</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
diff --git a/sfx2/uiconfig/ui/documentpropertiesdialog.ui b/sfx2/uiconfig/ui/documentpropertiesdialog.ui
index 7ddd6010714a..ca692270b94b 100644
--- a/sfx2/uiconfig/ui/documentpropertiesdialog.ui
+++ b/sfx2/uiconfig/ui/documentpropertiesdialog.ui
@@ -1,12 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.0 -->
+<!-- Generated with glade 3.22.1 -->
<interface domain="sfx">
<requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="DocumentPropertiesDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="documentpropertiesdialog|DocumentPropertiesDialog">Properties of “%1”</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>
@@ -17,12 +23,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>
@@ -33,10 +37,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>
@@ -47,8 +53,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>
@@ -58,12 +64,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>
@@ -73,6 +78,7 @@
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
+ <property name="secondary">True</property>
</packing>
</child>
</object>
@@ -87,7 +93,6 @@
<object class="GtkNotebook" id="tabcontrol">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="scrollable">True</property>
<property name="enable_popup">True</property>
<child>
<object class="GtkGrid">
@@ -96,6 +101,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">
@@ -115,6 +144,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>
@@ -138,6 +191,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>
@@ -161,6 +238,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">3</property>
@@ -184,6 +285,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">4</property>
@@ -210,10 +335,10 @@
</object>
</child>
<action-widgets>
+ <action-widget response="101">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="101">reset</action-widget>
</action-widgets>
</object>
</interface>