diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2023-04-06 20:56:00 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2023-04-06 21:27:30 +0200 |
commit | 45e66d20380e9facff62e8a504c8b54f49ebbefe (patch) | |
tree | b82ed37366fdf7f038cc03549e049fb811f14e7f /cui | |
parent | b3a5e338319903bb1fcffe8a9fc7d84a842df0cb (diff) |
officecfg,cui,sw: add Common::Load::ViewPositionForAnyUser
Add setting Office::Common::Load::ViewPositionForAnyUser which if
enabled skips the user name matching against meta.xml that sw does
before restoring a view position stored as ViewTop/ViewLeft/etc. in
settings.xml in an ODF file.
This is particularly useful if the user disables the "ApplyUserData"
in Document->Properties->General, which made restoring view position
impossible.
Change-Id: Ie3ced3c4ad20a35eb8453ad1521c787b0b0c8458
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/options/optsave.cxx | 12 | ||||
-rw-r--r-- | cui/source/options/optsave.hxx | 1 | ||||
-rw-r--r-- | cui/uiconfig/ui/optsavepage.ui | 15 |
3 files changed, 28 insertions, 0 deletions
diff --git a/cui/source/options/optsave.cxx b/cui/source/options/optsave.cxx index 72f736ce406b..2ce16aa16de8 100644 --- a/cui/source/options/optsave.cxx +++ b/cui/source/options/optsave.cxx @@ -29,6 +29,7 @@ #include <com/sun/star/container/XContainerQuery.hpp> #include <com/sun/star/container/XEnumeration.hpp> #include <com/sun/star/beans/PropertyValue.hpp> +#include <officecfg/Office/Common.hxx> #include <sfx2/sfxsids.hrc> #include <sfx2/docfilt.hxx> #include <unotools/optionsdlg.hxx> @@ -69,6 +70,7 @@ SvxSaveTabPage_Impl::SvxSaveTabPage_Impl() : bInitialized( false ) SvxSaveTabPage::SvxSaveTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rCoreSet) : SfxTabPage( pPage, pController, "cui/ui/optsavepage.ui", "OptSavePage", &rCoreSet ) , pImpl(new SvxSaveTabPage_Impl) + , m_xLoadViewPosAnyUserCB(m_xBuilder->weld_check_button("load_anyuser")) , m_xLoadUserSettingsCB(m_xBuilder->weld_check_button("load_settings")) , m_xLoadDocPrinterCB(m_xBuilder->weld_check_button("load_docprinter")) , m_xDocInfoCB(m_xBuilder->weld_check_button("docinfo")) @@ -215,6 +217,13 @@ bool SvxSaveTabPage::FillItemSet( SfxItemSet* rSet ) { bool bModified = false; SvtSaveOptions aSaveOpt; + if (m_xLoadViewPosAnyUserCB->get_state_changed_from_saved()) + { + std::shared_ptr<comphelper::ConfigurationChanges> pBatch( + comphelper::ConfigurationChanges::create()); + officecfg::Office::Common::Load::ViewPositionForAnyUser::set(m_xLoadViewPosAnyUserCB->get_active(), pBatch); + pBatch->commit(); + } if(m_xLoadUserSettingsCB->get_state_changed_from_saved()) { aSaveOpt.SetLoadUserSettings(m_xLoadUserSettingsCB->get_active()); @@ -353,6 +362,9 @@ static bool isODFFormat( const OUString& sFilter ) void SvxSaveTabPage::Reset( const SfxItemSet* ) { SvtSaveOptions aSaveOpt; + m_xLoadViewPosAnyUserCB->set_active(officecfg::Office::Common::Load::ViewPositionForAnyUser::get()); + m_xLoadViewPosAnyUserCB->save_state(); + m_xLoadViewPosAnyUserCB->set_sensitive(!officecfg::Office::Common::Load::ViewPositionForAnyUser::isReadOnly()); m_xLoadUserSettingsCB->set_active(aSaveOpt.IsLoadUserSettings()); m_xLoadUserSettingsCB->save_state(); m_xLoadUserSettingsCB->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::UseUserData)); diff --git a/cui/source/options/optsave.hxx b/cui/source/options/optsave.hxx index 4314bdda1ddf..f412054ae600 100644 --- a/cui/source/options/optsave.hxx +++ b/cui/source/options/optsave.hxx @@ -45,6 +45,7 @@ class SvxSaveTabPage : public SfxTabPage private: std::unique_ptr<SvxSaveTabPage_Impl> pImpl; + std::unique_ptr<weld::CheckButton> m_xLoadViewPosAnyUserCB; std::unique_ptr<weld::CheckButton> m_xLoadUserSettingsCB; std::unique_ptr<weld::CheckButton> m_xLoadDocPrinterCB; std::unique_ptr<weld::CheckButton> m_xDocInfoCB; diff --git a/cui/uiconfig/ui/optsavepage.ui b/cui/uiconfig/ui/optsavepage.ui index e9a090d45091..c95efcfc68cc 100644 --- a/cui/uiconfig/ui/optsavepage.ui +++ b/cui/uiconfig/ui/optsavepage.ui @@ -61,6 +61,21 @@ <property name="top_attach">0</property> </packing> </child> + <child> + <object class="GtkCheckButton" id="load_anyuser"> + <property name="label" translatable="yes" context="optsavepage|load_anyuser">Load view position with the document even if it was saved by a different user</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">2</property> + </packing> + </child> </object> </child> </object> |