summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga.extern@allotropia.de>2023-11-28 11:57:29 +0100
committerBalazs Varga <balazs.varga.extern@allotropia.de>2023-11-29 09:45:57 +0100
commit2bf8231ab5709f0d7577d6da53f50bc7f0b65079 (patch)
treeed7c4d5f41c3d5939b5f2fa613b47df23f215732
parent34d3f383b62ebd87f842e48e6627dbf5ed369667 (diff)
tdf#158244 - UI: Part 45 - Unify lockdown behavior of Options dialog
for Draw - Grid Page. Use the right grid settings associated with the application. follow-up of fbecf8009af8abdd218fbb3bd26087e8b805d06b Change-Id: I30b3c7ad80348a9cc89b6ea206a8ad9387276593 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160020 Tested-by: Jenkins Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de>
-rw-r--r--include/svx/optgrid.hxx2
-rw-r--r--sd/source/ui/dlg/tpoption.cxx31
-rw-r--r--svx/source/dialog/optgrid.cxx65
3 files changed, 71 insertions, 27 deletions
diff --git a/include/svx/optgrid.hxx b/include/svx/optgrid.hxx
index b8e1f5604286..ed71e62cdb53 100644
--- a/include/svx/optgrid.hxx
+++ b/include/svx/optgrid.hxx
@@ -152,6 +152,8 @@ protected:
std::unique_ptr<weld::MetricSpinButton> m_xMtrFldBezAngle;
std::unique_ptr<weld::Widget> m_xMtrFldBezAngleImg;
+ bool IsDrawMode() const { return m_Emode == DRAW_MODE; }
+
DECL_LINK(ClickRotateHdl_Impl, weld::Toggleable&, void);
private:
DECL_DLLPRIVATE_LINK(ChangeDrawHdl_Impl, weld::MetricSpinButton&, void);
diff --git a/sd/source/ui/dlg/tpoption.cxx b/sd/source/ui/dlg/tpoption.cxx
index 8c5416c9cb09..812d39ffd8aa 100644
--- a/sd/source/ui/dlg/tpoption.cxx
+++ b/sd/source/ui/dlg/tpoption.cxx
@@ -83,51 +83,62 @@ void SdTpOptionsSnap::Reset( const SfxItemSet* rAttrs )
SdOptionsSnapItem aOptsItem( rAttrs->Get( ATTR_OPTIONS_SNAP ) );
- bool bReadOnly = officecfg::Office::Impress::Snap::Object::SnapLine::isReadOnly();
+ bool bDrawMode = SvxGridTabPage::IsDrawMode();
+ bool bReadOnly = bDrawMode ? officecfg::Office::Draw::Snap::Object::SnapLine::isReadOnly() :
+ officecfg::Office::Impress::Snap::Object::SnapLine::isReadOnly();
m_xCbxSnapHelplines->set_active( aOptsItem.GetOptionsSnap().IsSnapHelplines() );
m_xCbxSnapHelplines->set_sensitive(!bReadOnly);
m_xCbxSnapHelplinesImg->set_visible(bReadOnly);
- bReadOnly = officecfg::Office::Impress::Snap::Object::PageMargin::isReadOnly();
+ bReadOnly = bDrawMode ? officecfg::Office::Draw::Snap::Object::PageMargin::isReadOnly() :
+ officecfg::Office::Impress::Snap::Object::PageMargin::isReadOnly();
m_xCbxSnapBorder->set_active( aOptsItem.GetOptionsSnap().IsSnapBorder() );
m_xCbxSnapBorder->set_sensitive(!bReadOnly);
m_xCbxSnapBorderImg->set_visible(bReadOnly);
- bReadOnly = officecfg::Office::Impress::Snap::Object::ObjectFrame::isReadOnly();
+ bReadOnly = bDrawMode ? officecfg::Office::Draw::Snap::Object::ObjectFrame::isReadOnly() :
+ officecfg::Office::Impress::Snap::Object::ObjectFrame::isReadOnly();
m_xCbxSnapFrame->set_active( aOptsItem.GetOptionsSnap().IsSnapFrame() );
m_xCbxSnapFrame->set_sensitive(!bReadOnly);
m_xCbxSnapFrameImg->set_visible(bReadOnly);
- bReadOnly = officecfg::Office::Impress::Snap::Object::ObjectPoint::isReadOnly();
+ bReadOnly = bDrawMode ? officecfg::Office::Draw::Snap::Object::ObjectPoint::isReadOnly() :
+ officecfg::Office::Impress::Snap::Object::ObjectPoint::isReadOnly();
m_xCbxSnapPoints->set_active( aOptsItem.GetOptionsSnap().IsSnapPoints() );
m_xCbxSnapPoints->set_sensitive(!bReadOnly);
m_xCbxSnapPointsImg->set_visible(bReadOnly);
- bReadOnly = officecfg::Office::Impress::Snap::Position::CreatingMoving::isReadOnly();
+ bReadOnly = bDrawMode ? officecfg::Office::Draw::Snap::Position::CreatingMoving::isReadOnly() :
+ officecfg::Office::Impress::Snap::Position::CreatingMoving::isReadOnly();
m_xCbxOrtho->set_active( aOptsItem.GetOptionsSnap().IsOrtho() );
m_xCbxOrtho->set_sensitive(!bReadOnly);
m_xCbxOrthoImg->set_visible(bReadOnly);
- bReadOnly = officecfg::Office::Impress::Snap::Position::ExtendEdges::isReadOnly();
+ bReadOnly = bDrawMode ? officecfg::Office::Draw::Snap::Position::ExtendEdges::isReadOnly() :
+ officecfg::Office::Impress::Snap::Position::ExtendEdges::isReadOnly();
m_xCbxBigOrtho->set_active( aOptsItem.GetOptionsSnap().IsBigOrtho() );
m_xCbxBigOrtho->set_sensitive(!bReadOnly);
m_xCbxBigOrthoImg->set_visible(bReadOnly);
- bReadOnly = officecfg::Office::Impress::Snap::Position::Rotating::isReadOnly();
+ bReadOnly = bDrawMode ? officecfg::Office::Draw::Snap::Position::Rotating::isReadOnly() :
+ officecfg::Office::Impress::Snap::Position::Rotating::isReadOnly();
m_xCbxRotate->set_active( aOptsItem.GetOptionsSnap().IsRotate() );
m_xCbxRotate->set_sensitive(!bReadOnly);
m_xCbxRotateImg->set_visible(bReadOnly);
- bReadOnly = officecfg::Office::Impress::Snap::Object::Range::isReadOnly();
+ bReadOnly = bDrawMode ? officecfg::Office::Draw::Snap::Object::Range::isReadOnly() :
+ officecfg::Office::Impress::Snap::Object::Range::isReadOnly();
m_xMtrFldSnapArea->set_value(aOptsItem.GetOptionsSnap().GetSnapArea(), FieldUnit::PIXEL);
m_xMtrFldSnapArea->set_sensitive(!bReadOnly);
m_xMtrFldSnapAreaImg->set_visible(bReadOnly);
- bReadOnly = officecfg::Office::Impress::Snap::Position::RotatingValue::isReadOnly();
+ bReadOnly = bDrawMode ? officecfg::Office::Draw::Snap::Position::RotatingValue::isReadOnly() :
+ officecfg::Office::Impress::Snap::Position::RotatingValue::isReadOnly();
m_xMtrFldAngle->set_value(aOptsItem.GetOptionsSnap().GetAngle().get(), FieldUnit::DEGREE);
m_xMtrFldAngle->set_sensitive(!bReadOnly);
- bReadOnly = officecfg::Office::Impress::Snap::Position::PointReduction::isReadOnly();
+ bReadOnly = bDrawMode ? officecfg::Office::Draw::Snap::Position::PointReduction::isReadOnly() :
+ officecfg::Office::Impress::Snap::Position::PointReduction::isReadOnly();
m_xMtrFldBezAngle->set_value(aOptsItem.GetOptionsSnap().GetEliminatePolyPointLimitAngle().get(), FieldUnit::DEGREE);
m_xMtrFldBezAngle->set_sensitive(!bReadOnly);
m_xMtrFldBezAngleImg->set_visible(bReadOnly);
diff --git a/svx/source/dialog/optgrid.cxx b/svx/source/dialog/optgrid.cxx
index b65869837711..59bc67b2e26a 100644
--- a/svx/source/dialog/optgrid.cxx
+++ b/svx/source/dialog/optgrid.cxx
@@ -19,12 +19,15 @@
#include <svl/intitem.hxx>
#include <svtools/unitconv.hxx>
-#include <unotools/moduleoptions.hxx>
#include <unotools/localedatawrapper.hxx>
#include <unotools/syslocale.hxx>
+#include <unotools/localedatawrapper.hxx>
#include <officecfg/Office/Writer.hxx>
#include <officecfg/Office/WriterWeb.hxx>
#include <officecfg/Office/Impress.hxx>
+#include <officecfg/Office/Draw.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <vcl/commandinfoprovider.hxx>
#include <svx/svxids.hrc>
#include <svx/optgrid.hxx>
@@ -160,17 +163,20 @@ SvxGridTabPage::SvxGridTabPage(weld::Container* pPage, weld::DialogController* p
if (0 != (pItem->GetValue() & HTMLMODE_ON))
m_Emode = HTML_MODE;
}
- else
+
+ if (m_Emode != HTML_MODE)
{
- SvtModuleOptions aMOpt;
- if (aMOpt.IsImpress())
+ SfxViewFrame* pCurrent = SfxViewFrame::Current();
+ OUString aModuleName = vcl::CommandInfoProvider::GetModuleIdentifier(pCurrent->GetFrame().GetFrameInterface());
+ std::u16string_view sModulename = aModuleName.subView(aModuleName.lastIndexOf('.') + 1);
+ if (sModulename.starts_with(u"Text"))
+ m_Emode = WRITER_MODE;
+ else if (sModulename.starts_with(u"Spreadsheet"))
+ m_Emode = CALC_MODE;
+ else if (sModulename.starts_with(u"Presentation"))
m_Emode = IMPRESS_MODE;
- else if (aMOpt.IsDraw())
+ else if (sModulename.starts_with(u"Drawing"))
m_Emode = DRAW_MODE;
- else if (aMOpt.IsCalc())
- m_Emode = CALC_MODE;
- else
- m_Emode = WRITER_MODE;
}
m_xCbxRotate->connect_toggled(LINK(this, SvxGridTabPage, ClickRotateHdl_Impl));
@@ -259,7 +265,8 @@ void SvxGridTabPage::Reset( const SfxItemSet* rSet )
case WRITER_MODE: bReadOnly = officecfg::Office::Writer::Grid::Option::SnapToGrid::isReadOnly(); break;
case HTML_MODE: bReadOnly = officecfg::Office::WriterWeb::Grid::Option::SnapToGrid::isReadOnly(); break;
case IMPRESS_MODE: bReadOnly = officecfg::Office::Impress::Grid::Option::SnapToGrid::isReadOnly(); break;
- default: //TODO Calc/Draw
+ case DRAW_MODE: bReadOnly = officecfg::Office::Draw::Grid::Option::SnapToGrid::isReadOnly(); break;
+ default: //TODO Calc
break;
}
m_xCbxUseGridsnap->set_active(pGridAttr->bUseGridsnap);
@@ -271,7 +278,8 @@ void SvxGridTabPage::Reset( const SfxItemSet* rSet )
case WRITER_MODE: bReadOnly = officecfg::Office::Writer::Grid::Option::Synchronize::isReadOnly(); break;
case HTML_MODE: bReadOnly = officecfg::Office::WriterWeb::Grid::Option::Synchronize::isReadOnly(); break;
case IMPRESS_MODE: bReadOnly = officecfg::Office::Impress::Grid::Option::Synchronize::isReadOnly(); break;
- default: //TODO Calc/Draw
+ case DRAW_MODE: bReadOnly = officecfg::Office::Draw::Grid::Option::Synchronize::isReadOnly(); break;
+ default: //TODO Calc
break;
}
m_xCbxSynchronize->set_active(pGridAttr->bSynchronize);
@@ -283,7 +291,8 @@ void SvxGridTabPage::Reset( const SfxItemSet* rSet )
case WRITER_MODE: bReadOnly = officecfg::Office::Writer::Grid::Option::VisibleGrid::isReadOnly(); break;
case HTML_MODE: bReadOnly = officecfg::Office::WriterWeb::Grid::Option::VisibleGrid::isReadOnly(); break;
case IMPRESS_MODE: bReadOnly = officecfg::Office::Impress::Grid::Option::VisibleGrid::isReadOnly(); break;
- default: //TODO Calc/Draw
+ case DRAW_MODE: bReadOnly = officecfg::Office::Draw::Grid::Option::VisibleGrid::isReadOnly(); break;
+ default: //TODO Calc
break;
}
m_xCbxGridVisible->set_active(pGridAttr->bGridVisible);
@@ -306,7 +315,15 @@ void SvxGridTabPage::Reset( const SfxItemSet* rSet )
bReadOnly = officecfg::Office::Impress::Grid::Resolution::XAxis::NonMetric::isReadOnly();
}
break;
- default: //TODO Calc/Draw
+ case DRAW_MODE:
+ {
+ if (lcl_IsMetricSystem())
+ bReadOnly = officecfg::Office::Draw::Grid::Resolution::XAxis::Metric::isReadOnly();
+ else
+ bReadOnly = officecfg::Office::Draw::Grid::Resolution::XAxis::NonMetric::isReadOnly();
+ }
+ break;
+ default: //TODO Calc
break;
}
m_xMtrFldDrawX->set_sensitive(!bReadOnly);
@@ -324,7 +341,15 @@ void SvxGridTabPage::Reset( const SfxItemSet* rSet )
bReadOnly = officecfg::Office::Impress::Grid::Resolution::YAxis::NonMetric::isReadOnly();
}
break;
- default: //TODO Calc/Draw
+ case DRAW_MODE:
+ {
+ if (lcl_IsMetricSystem())
+ bReadOnly = officecfg::Office::Draw::Grid::Resolution::YAxis::Metric::isReadOnly();
+ else
+ bReadOnly = officecfg::Office::Draw::Grid::Resolution::YAxis::NonMetric::isReadOnly();
+ }
+ break;
+ default: //TODO Calc
break;
}
m_xMtrFldDrawY->set_sensitive(!bReadOnly);
@@ -338,7 +363,8 @@ void SvxGridTabPage::Reset( const SfxItemSet* rSet )
case WRITER_MODE: bReadOnly = officecfg::Office::Writer::Grid::Subdivision::XAxis::isReadOnly(); break;
case HTML_MODE: bReadOnly = officecfg::Office::WriterWeb::Grid::Subdivision::XAxis::isReadOnly(); break;
case IMPRESS_MODE: bReadOnly = officecfg::Office::Impress::Grid::Subdivision::XAxis::isReadOnly(); break;
- default: //TODO Calc/Draw
+ case DRAW_MODE: bReadOnly = officecfg::Office::Draw::Grid::Subdivision::XAxis::isReadOnly(); break;
+ default: //TODO Calc
break;
}
m_xNumFldDivisionX->set_sensitive(!bReadOnly);
@@ -349,7 +375,8 @@ void SvxGridTabPage::Reset( const SfxItemSet* rSet )
case WRITER_MODE: bReadOnly = officecfg::Office::Writer::Grid::Subdivision::YAxis::isReadOnly(); break;
case HTML_MODE: bReadOnly = officecfg::Office::WriterWeb::Grid::Subdivision::YAxis::isReadOnly(); break;
case IMPRESS_MODE: bReadOnly = officecfg::Office::Impress::Grid::Subdivision::YAxis::isReadOnly(); break;
- default: //TODO Calc/Draw
+ case DRAW_MODE: bReadOnly = officecfg::Office::Draw::Grid::Subdivision::YAxis::isReadOnly(); break;
+ default: //TODO Calc
break;
}
m_xNumFldDivisionY->set_sensitive(!bReadOnly);
@@ -421,7 +448,11 @@ IMPL_LINK(SvxGridTabPage, ChangeDrawHdl_Impl, weld::MetricSpinButton&, rField, v
IMPL_LINK_NOARG(SvxGridTabPage, ClickRotateHdl_Impl, weld::Toggleable&, void)
{
if (m_xCbxRotate->get_active())
- m_xMtrFldAngle->set_sensitive(!officecfg::Office::Impress::Snap::Position::RotatingValue::isReadOnly());
+ {
+ m_xMtrFldAngle->set_sensitive(m_Emode == DRAW_MODE ?
+ !officecfg::Office::Draw::Snap::Position::RotatingValue::isReadOnly() :
+ !officecfg::Office::Impress::Snap::Position::RotatingValue::isReadOnly());
+ }
else
m_xMtrFldAngle->set_sensitive(false);
}