tdf#158008 - UI: Part 23 - Unify lockdown behavior of Options dialog
for Writer - Grid Page.
Change-Id: Ia492d0d742050d1ceec3c9ab68bf3378355977e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159290
Tested-by: Jenkins
Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de>
diff --git a/include/svx/optgrid.hxx b/include/svx/optgrid.hxx
index 223f2da..f27a4bf 100644
--- a/include/svx/optgrid.hxx
+++ b/include/svx/optgrid.hxx
@@ -106,12 +106,19 @@ private:
bool bAttrModified;
std::unique_ptr<weld::CheckButton> m_xCbxUseGridsnap;
std::unique_ptr<weld::Widget> m_xCbxUseGridsnapImg;
std::unique_ptr<weld::CheckButton> m_xCbxGridVisible;
std::unique_ptr<weld::Widget> m_xCbxGridVisibleImg;
std::unique_ptr<weld::MetricSpinButton> m_xMtrFldDrawX;
std::unique_ptr<weld::Widget> m_xMtrFldDrawXImg;
std::unique_ptr<weld::MetricSpinButton> m_xMtrFldDrawY;
std::unique_ptr<weld::Widget> m_xMtrFldDrawYImg;
std::unique_ptr<weld::SpinButton> m_xNumFldDivisionX;
std::unique_ptr<weld::Widget> m_xNumFldDivisionXImg;
std::unique_ptr<weld::SpinButton> m_xNumFldDivisionY;
std::unique_ptr<weld::Widget> m_xNumFldDivisionYImg;
std::unique_ptr<weld::CheckButton> m_xCbxSynchronize;
std::unique_ptr<weld::Widget> m_xCbxSynchronizeImg;
protected:
//these controls are used in draw and impress
std::unique_ptr<weld::Widget> m_xSnapFrames;
diff --git a/svx/source/dialog/optgrid.cxx b/svx/source/dialog/optgrid.cxx
index 736c9c7..cd73ae2 100644
--- a/svx/source/dialog/optgrid.cxx
+++ b/svx/source/dialog/optgrid.cxx
@@ -19,6 +19,7 @@
#include <svl/intitem.hxx>
#include <svtools/unitconv.hxx>
#include <officecfg/Office/Writer.hxx>
#include <svx/svxids.hrc>
#include <svx/optgrid.hxx>
@@ -91,12 +92,19 @@ SvxGridTabPage::SvxGridTabPage(weld::Container* pPage, weld::DialogController* p
: SfxTabPage(pPage, pController, "svx/ui/optgridpage.ui", "OptGridPage", &rCoreSet)
, bAttrModified(false)
, m_xCbxUseGridsnap(m_xBuilder->weld_check_button("usegridsnap"))
, m_xCbxUseGridsnapImg(m_xBuilder->weld_widget("lockusegridsnap"))
, m_xCbxGridVisible(m_xBuilder->weld_check_button("gridvisible"))
, m_xCbxGridVisibleImg(m_xBuilder->weld_widget("lockgridvisible"))
, m_xMtrFldDrawX(m_xBuilder->weld_metric_spin_button("mtrflddrawx", FieldUnit::CM))
, m_xMtrFldDrawXImg(m_xBuilder->weld_widget("lockmtrflddrawx"))
, m_xMtrFldDrawY(m_xBuilder->weld_metric_spin_button("mtrflddrawy", FieldUnit::CM))
, m_xMtrFldDrawYImg(m_xBuilder->weld_widget("lockmtrflddrawy"))
, m_xNumFldDivisionX(m_xBuilder->weld_spin_button("numflddivisionx"))
, m_xNumFldDivisionXImg(m_xBuilder->weld_widget("locknumflddivisionx"))
, m_xNumFldDivisionY(m_xBuilder->weld_spin_button("numflddivisiony"))
, m_xNumFldDivisionYImg(m_xBuilder->weld_widget("locknumflddivisiony"))
, m_xCbxSynchronize(m_xBuilder->weld_check_button("synchronize"))
, m_xCbxSynchronizeImg(m_xBuilder->weld_widget("locksynchronize"))
, m_xSnapFrames(m_xBuilder->weld_widget("snapframes"))
, m_xCbxSnapHelplines(m_xBuilder->weld_check_button("snaphelplines"))
, m_xCbxSnapBorder(m_xBuilder->weld_check_button("snapborder"))
@@ -206,15 +214,35 @@ void SvxGridTabPage::Reset( const SfxItemSet* rSet )
if( (pGridAttr = rSet->GetItemIfSet( SID_ATTR_GRID_OPTIONS , false )) )
{
m_xCbxUseGridsnap->set_active(pGridAttr->bUseGridsnap);
m_xCbxUseGridsnap->set_sensitive(!officecfg::Office::Writer::Grid::Option::SnapToGrid::isReadOnly());
m_xCbxUseGridsnapImg->set_visible(officecfg::Office::Writer::Grid::Option::SnapToGrid::isReadOnly());
m_xCbxSynchronize->set_active(pGridAttr->bSynchronize);
m_xCbxSynchronize->set_sensitive(!officecfg::Office::Writer::Grid::Option::Synchronize::isReadOnly());
m_xCbxSynchronizeImg->set_visible(officecfg::Office::Writer::Grid::Option::Synchronize::isReadOnly());
m_xCbxGridVisible->set_active(pGridAttr->bGridVisible);
m_xCbxGridVisible->set_sensitive(!officecfg::Office::Writer::Grid::Option::VisibleGrid::isReadOnly());
m_xCbxGridVisibleImg->set_visible(officecfg::Office::Writer::Grid::Option::VisibleGrid::isReadOnly());
MapUnit eUnit = rSet->GetPool()->GetMetric( SID_ATTR_GRID_OPTIONS );
SetMetricValue( *m_xMtrFldDrawX , pGridAttr->nFldDrawX, eUnit );
SetMetricValue( *m_xMtrFldDrawY , pGridAttr->nFldDrawY, eUnit );
m_xMtrFldDrawX->set_sensitive(!officecfg::Office::Writer::Grid::Resolution::XAxis::isReadOnly());
m_xMtrFldDrawXImg->set_visible(officecfg::Office::Writer::Grid::Resolution::XAxis::isReadOnly());
m_xMtrFldDrawY->set_sensitive(!officecfg::Office::Writer::Grid::Resolution::YAxis::isReadOnly());
m_xMtrFldDrawYImg->set_visible(officecfg::Office::Writer::Grid::Resolution::YAxis::isReadOnly());
m_xNumFldDivisionX->set_value(pGridAttr->nFldDivisionX + 1);
m_xNumFldDivisionY->set_value(pGridAttr->nFldDivisionY + 1);
m_xNumFldDivisionX->set_sensitive(!officecfg::Office::Writer::Grid::Subdivision::XAxis::isReadOnly());
m_xNumFldDivisionXImg->set_visible(officecfg::Office::Writer::Grid::Subdivision::XAxis::isReadOnly());
m_xNumFldDivisionY->set_sensitive(!officecfg::Office::Writer::Grid::Subdivision::YAxis::isReadOnly());
m_xNumFldDivisionYImg->set_visible(officecfg::Office::Writer::Grid::Subdivision::YAxis::isReadOnly());
}
ChangeGridsnapHdl_Impl(*m_xCbxUseGridsnap);
diff --git a/svx/uiconfig/ui/optgridpage.ui b/svx/uiconfig/ui/optgridpage.ui
index 3936a09..aa65b3e 100644
--- a/svx/uiconfig/ui/optgridpage.ui
+++ b/svx/uiconfig/ui/optgridpage.ui
@@ -57,7 +57,7 @@
<property name="label-xalign">0</property>
<property name="shadow-type">none</property>
<child>
<!-- n-columns=1 n-rows=2 -->
<!-- n-columns=2 n-rows=2 -->
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can-focus">False</property>
@@ -80,7 +80,7 @@
</child>
</object>
<packing>
<property name="left-attach">0</property>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
@@ -99,6 +99,32 @@
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkImage" id="lockusegridsnap">
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="icon-name">res/lock.png</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkImage" id="lockgridvisible">
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="icon-name">res/lock.png</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
@@ -135,7 +161,7 @@
<property name="label-xalign">0</property>
<property name="shadow-type">none</property>
<child>
<!-- n-columns=2 n-rows=3 -->
<!-- n-columns=3 n-rows=3 -->
<object class="GtkGrid" id="grid3">
<property name="visible">True</property>
<property name="can-focus">False</property>
@@ -159,7 +185,7 @@
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="left-attach">2</property>
<property name="top-attach">0</property>
</packing>
</child>
@@ -178,7 +204,7 @@
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="left-attach">2</property>
<property name="top-attach">1</property>
</packing>
</child>
@@ -192,7 +218,7 @@
<property name="xalign">0</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
@@ -206,7 +232,7 @@
<property name="xalign">0</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
@@ -226,11 +252,50 @@
</child>
</object>
<packing>
<property name="left-attach">0</property>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkImage" id="lockmtrflddrawx">
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="icon-name">res/lock.png</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkImage" id="lockmtrflddrawy">
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="icon-name">res/lock.png</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkImage" id="locksynchronize">
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="icon-name">res/lock.png</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
</object>
</child>
<child type="label">
@@ -258,7 +323,7 @@
<property name="label-xalign">0</property>
<property name="shadow-type">none</property>
<child>
<!-- n-columns=2 n-rows=2 -->
<!-- n-columns=3 n-rows=2 -->
<object class="GtkGrid" id="grid4">
<property name="visible">True</property>
<property name="can-focus">False</property>
@@ -305,7 +370,7 @@
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="left-attach">2</property>
<property name="top-attach">0</property>
</packing>
</child>
@@ -347,7 +412,7 @@
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="left-attach">2</property>
<property name="top-attach">1</property>
</packing>
</child>
@@ -361,7 +426,7 @@
<property name="xalign">0</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
@@ -375,6 +440,32 @@
<property name="xalign">0</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkImage" id="locknumflddivisionx">
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="icon-name">res/lock.png</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkImage" id="locknumflddivisiony">
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="icon-name">res/lock.png</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>