diff options
author | Kohei Yoshida <kyoshida@novell.com> | 2010-10-05 10:11:12 -0400 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2010-10-05 10:19:43 -0400 |
commit | 2a154fcf9cea7f9d0c056368a66314ee89d34456 (patch) | |
tree | 4f93d12bcd185352cca7eca03342af43b50c3392 | |
parent | d5dd80d1d4e8f1537d41fdf6a716ae4c41ba8db3 (diff) |
Ported always-save-option-*.diff from ooo-build.
A new configuration option to toggle allowing of saves even when
no "modification" has been made.
-rw-r--r-- | officecfg/registry/schema/org/openoffice/Office/Common.xcs | 7 | ||||
-rw-r--r-- | sfx2/source/doc/guisaveas.cxx | 12 | ||||
-rw-r--r-- | sfx2/source/doc/objserv.cxx | 10 |
3 files changed, 23 insertions, 6 deletions
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index 113ecdc11e11..be7d7ebac7f9 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -5791,6 +5791,13 @@ </info> <value>false</value> </prop> + <prop oor:name="AlwaysAllowSave" oor:type="xs:boolean"> + <info> + <author>kohei</author> + <desc>Determines if the user can save the document even when it's not modified.</desc> + </info> + <value>false</value> + </prop> <prop oor:name="SymbolSet" oor:type="xs:short"> <!-- UIHints: Tools Options General View --> <info> diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 3c4df7276d6b..8093b96b3264 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -67,6 +67,7 @@ #include <svl/intitem.hxx> #include <unotools/useroptions.hxx> #include <unotools/saveopt.hxx> +#include <svtools/miscopt.hxx> #include <tools/debug.hxx> #include <tools/urlobj.hxx> #include <comphelper/processfactory.hxx> @@ -696,9 +697,14 @@ sal_Int8 ModelData_Impl::CheckStateForSave() if ( GetMediaDescr().size() != aAcceptedArgs.size() ) GetMediaDescr() = aAcceptedArgs; - // the document must be modified - if ( !GetModifiable()->isModified() && !bVersInfoNeedsStore ) - return STATUS_NO_ACTION; + // the document must be modified unless the always-save flag is set. + SvtMiscOptions aMiscOptions; + sal_Bool bAlwaysAllowSave = aMiscOptions.IsSaveAlwaysAllowed(); + if (!bAlwaysAllowSave) + { + if ( !GetModifiable()->isModified() && !bVersInfoNeedsStore ) + return STATUS_NO_ACTION; + } // if the document is readonly or a new one a SaveAs operation must be used if ( !GetStorable()->hasLocation() || GetStorable()->isReadonly() ) diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 717187c2fbdc..378d44da9d37 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -63,8 +63,9 @@ #include <basic/sbx.hxx> #include <unotools/pathoptions.hxx> #include <unotools/useroptions.hxx> -#include <svtools/asynclink.hxx> #include <unotools/saveopt.hxx> +#include <svtools/asynclink.hxx> +#include <svtools/miscopt.hxx> #include <comphelper/documentconstants.hxx> #include <sfx2/app.hxx> @@ -943,8 +944,11 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet) } case SID_SAVEDOC: { - BOOL bMediumRO = IsReadOnlyMedium(); - if ( !bMediumRO && GetMedium() && IsModified() ) + SvtMiscOptions aMiscOptions; + bool bAlwaysAllowSave = aMiscOptions.IsSaveAlwaysAllowed(); + bool bAllowSave = (bAlwaysAllowSave || IsModified()); + bool bMediumRO = IsReadOnlyMedium(); + if ( !bMediumRO && GetMedium() && bAllowSave ) rSet.Put(SfxStringItem( nWhich, String(SfxResId(STR_SAVEDOC)))); else |