diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2015-12-22 13:12:23 +0200 |
---|---|---|
committer | Adolfo Jayme Barrientos <fitojb@ubuntu.com> | 2016-01-12 12:46:31 -0600 |
commit | 677197b3459df2c89be32595e0cb1b8b3e144c69 (patch) | |
tree | 370561ff6bb70aa54052d1cf95081792f894de19 | |
parent | feebc5953fb416c5dc8cdf8c7e924a9ff9c70f17 (diff) |
New saving behavior
Changes in this commit:
- AlwaysAllowSave config is gone. Saving is always permitted, unless in
a read only document. Also changed the behavior in dbaccess to match
sfx2.
- The toolbar save button is always enabled, to always give access to
the dropdown. That's the case even in a read only document, except
that it changes to DROPDOWNONLY, and the save as command icon+tooltip.
In table/query designers we still disable the button in read only state.
- When the document is modified, the toolbar button gets a special icon
to indicate that.
Reviewed-on: https://gerrit.libreoffice.org/20839
Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Tested-by: Maxim Monastirsky <momonasmon@gmail.com>
(cherry picked from commit 22328a224df4619218b88205838307f70612207e)
loplugin:unreffun
(cherry picked from commit ea708936c4684668f9aefc3ce9ec2001dbd4bdf2)
Change-Id: I56c169bf48b78faaf53c2989ce8624f8297ffb6e
Tango: Update Save icons and support “savemodified” status
Change-Id: I03589895437907b9048542f07128801577fe62dc
(cherry picked from commit a7198d38f0294ab5db04a7f4457565ea8b2c32f1)
Reviewed-on: https://gerrit.libreoffice.org/21260
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Tested-by: Jenkins <ci@libreoffice.org>
Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
46 files changed, 185 insertions, 269 deletions
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx index dfb517f93667..52fc00c996a0 100644 --- a/cui/source/options/optgdlg.cxx +++ b/cui/source/options/optgdlg.cxx @@ -273,7 +273,6 @@ OfaMiscTabPage::OfaMiscTabPage(vcl::Window* pParent, const SfxItemSet& rSet) get(m_pFileDlgROImage, "lockimage"); get(m_pPrintDlgCB, "printdlg"); get(m_pDocStatusCB, "docstatus"); - get(m_pSaveAlwaysCB, "savealways"); get(m_pYearFrame, "yearframe"); get(m_pYearValueField, "year"); get(m_pToYearFT, "toyear"); @@ -309,7 +308,6 @@ void OfaMiscTabPage::dispose() m_pFileDlgCB.clear(); m_pPrintDlgCB.clear(); m_pDocStatusCB.clear(); - m_pSaveAlwaysCB.clear(); m_pYearFrame.clear(); m_pYearValueField.clear(); m_pToYearFT.clear(); @@ -352,13 +350,6 @@ bool OfaMiscTabPage::FillItemSet( SfxItemSet* rSet ) bModified = true; } - if ( m_pSaveAlwaysCB->IsValueChangedFromSaved() ) - { - SvtMiscOptions aMiscOpt; - aMiscOpt.SetSaveAlwaysAllowed( m_pSaveAlwaysCB->IsChecked() ); - bModified = true; - } - const SfxUInt16Item* pUInt16Item = dynamic_cast< const SfxUInt16Item* >( GetOldItem( *rSet, SID_ATTR_YEAR2000 ) ); sal_uInt16 nNum = (sal_uInt16)m_pYearValueField->GetText().toInt32(); if ( pUInt16Item && pUInt16Item->GetValue() != nNum ) @@ -389,8 +380,6 @@ void OfaMiscTabPage::Reset( const SfxItemSet* rSet ) m_pFileDlgCB->SaveValue(); m_pPrintDlgCB->Check( !aMiscOpt.UseSystemPrintDialog() ); m_pPrintDlgCB->SaveValue(); - m_pSaveAlwaysCB->Check( aMiscOpt.IsSaveAlwaysAllowed() ); - m_pSaveAlwaysCB->SaveValue(); SvtPrintWarningOptions aPrintOptions; m_pDocStatusCB->Check(aPrintOptions.IsModifyDocumentOnPrintingAllowed()); diff --git a/cui/source/options/optgdlg.hxx b/cui/source/options/optgdlg.hxx index 6bd50151566e..e3274d1b9f99 100644 --- a/cui/source/options/optgdlg.hxx +++ b/cui/source/options/optgdlg.hxx @@ -48,7 +48,6 @@ private: VclPtr<CheckBox> m_pPrintDlgCB; VclPtr<CheckBox> m_pDocStatusCB; - VclPtr<CheckBox> m_pSaveAlwaysCB; VclPtr<VclContainer> m_pYearFrame; VclPtr<NumericField> m_pYearValueField; diff --git a/cui/uiconfig/ui/optgeneralpage.ui b/cui/uiconfig/ui/optgeneralpage.ui index c17ac99f9d83..ac98e80ba79b 100644 --- a/cui/uiconfig/ui/optgeneralpage.ui +++ b/cui/uiconfig/ui/optgeneralpage.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.16.1 --> +<!-- Generated with glade 3.19.0 --> <interface> <requires lib="gtk+" version="3.0"/> <object class="GtkAdjustment" id="adjustment1"> @@ -53,8 +53,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -87,8 +85,6 @@ <packing> <property name="left_attach">1</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -102,8 +98,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> @@ -124,8 +118,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -167,8 +159,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -184,44 +174,14 @@ <property name="top_padding">6</property> <property name="left_padding">12</property> <child> - <object class="GtkGrid" id="grid2"> + <object class="GtkCheckButton" id="docstatus"> + <property name="label" translatable="yes">_Printing sets "document modified" status</property> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="row_spacing">6</property> - <child> - <object class="GtkCheckButton" id="docstatus"> - <property name="label" translatable="yes">_Printing sets "document modified" status</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">0</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="savealways"> - <property name="label" translatable="yes">_Allow to save document even when the document is not modified </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">1</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> + <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> </child> </object> @@ -240,8 +200,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -265,16 +223,14 @@ <object class="GtkLabel" id="label6"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes">_Interpret as years between </property> <property name="use_underline">True</property> <property name="mnemonic_widget">year</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -287,8 +243,6 @@ <packing> <property name="left_attach">1</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -300,8 +254,6 @@ <packing> <property name="left_attach">2</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> @@ -322,8 +274,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">4</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -365,8 +315,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">5</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> diff --git a/dbaccess/source/core/dataaccess/intercept.cxx b/dbaccess/source/core/dataaccess/intercept.cxx index 09f7ab59fdcd..ef3713e143dd 100644 --- a/dbaccess/source/core/dataaccess/intercept.cxx +++ b/dbaccess/source/core/dataaccess/intercept.cxx @@ -22,7 +22,6 @@ #include "dbastrings.hrc" #include <com/sun/star/embed/EmbedStates.hpp> -#include <com/sun/star/document/XDocumentEventBroadcaster.hpp> #include <com/sun/star/util/XModifiable.hpp> #include <cppuhelper/weak.hxx> @@ -187,10 +186,6 @@ IMPL_LINK_TYPED( OInterceptor, OnDispatch, void*, _pDispatcher, void ) Reference< XDispatch > xDispatch = m_xSlaveDispatchProvider->queryDispatch(pHelper->aURL, "_self", 0 ); if ( xDispatch.is() ) { - Reference< css::document::XDocumentEventBroadcaster> xEvtB(m_pContentHolder->getComponent(),UNO_QUERY); - if ( xEvtB.is() ) - xEvtB->removeDocumentEventListener(this); - Reference< XInterface > xKeepContentHolderAlive( *m_pContentHolder ); xDispatch->dispatch( pHelper->aURL,pHelper->aArguments); } @@ -240,7 +235,7 @@ void SAL_CALL OInterceptor::addStatusListener( FeatureStateEvent aStateEvent; aStateEvent.FeatureURL.Complete = m_aInterceptedURL[DISPATCH_SAVE]; aStateEvent.FeatureDescriptor = "Update"; - aStateEvent.IsEnabled = m_pContentHolder != nullptr && m_pContentHolder->isModified(); + aStateEvent.IsEnabled = sal_True; aStateEvent.Requery = sal_False; Control->statusChanged(aStateEvent); @@ -251,9 +246,6 @@ void SAL_CALL OInterceptor::addStatusListener( } m_pStatCL->addInterface(_URL.Complete,Control); - Reference< css::document::XDocumentEventBroadcaster> xEvtB(m_pContentHolder->getComponent(),UNO_QUERY); - if ( xEvtB.is() ) - xEvtB->addDocumentEventListener(this); } else { @@ -395,50 +387,6 @@ void SAL_CALL OInterceptor::setMasterDispatchProvider( m_xMasterDispatchProvider = NewSupplier; } -void SAL_CALL OInterceptor::documentEventOccured( const css::document::DocumentEvent& Event ) throw (css::uno::RuntimeException, std::exception) -{ - osl::ResettableMutexGuard _rGuard(m_aMutex); - if ( m_pStatCL && Event.EventName == "OnModifyChanged" ) - { - OInterfaceContainerHelper* pListener = m_pStatCL->getContainer(m_aInterceptedURL[DISPATCH_SAVE]); - if ( pListener ) - { - FeatureStateEvent aEvt; - aEvt.FeatureURL.Complete = m_aInterceptedURL[DISPATCH_SAVE]; - aEvt.FeatureDescriptor = "Update"; - Reference<XModifiable> xModel(Event.Source,UNO_QUERY); - aEvt.IsEnabled = xModel.is() && xModel->isModified(); - aEvt.Requery = sal_False; - - Sequence< Reference< XInterface > > aListenerSeq = pListener->getElements(); - - const Reference< XInterface >* pxIntBegin = aListenerSeq.getConstArray(); - const Reference< XInterface >* pxInt = pxIntBegin + aListenerSeq.getLength(); - - _rGuard.clear(); - while( pxInt > pxIntBegin ) - { - try - { - while( pxInt > pxIntBegin ) - { - --pxInt; - static_cast< XStatusListener* >( pxInt->get() )->statusChanged(aEvt); - } - } - catch( RuntimeException& ) - { - } - } - _rGuard.reset(); - } - } -} - -void SAL_CALL OInterceptor::disposing( const css::lang::EventObject& /*Source*/ ) throw (css::uno::RuntimeException, std::exception) -{ -} - } // namespace dbaccess /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/dataaccess/intercept.hxx b/dbaccess/source/core/dataaccess/intercept.hxx index 48c8ae002c32..6d80e4f444eb 100644 --- a/dbaccess/source/core/dataaccess/intercept.hxx +++ b/dbaccess/source/core/dataaccess/intercept.hxx @@ -25,7 +25,6 @@ #include <cppuhelper/interfacecontainer.hxx> #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp> #include <com/sun/star/frame/XInterceptorInfo.hpp> -#include <com/sun/star/document/XDocumentEventListener.hpp> #include <com/sun/star/frame/XDispatch.hpp> #include "documentdefinition.hxx" #include <vcl/svapp.hxx> @@ -36,8 +35,7 @@ namespace dbaccess class OInterceptor : public ::cppu::WeakImplHelper< css::frame::XDispatchProviderInterceptor, css::frame::XInterceptorInfo, - css::frame::XDispatch, - css::document::XDocumentEventListener> + css::frame::XDispatch > { DECL_LINK_TYPED( OnDispatch, void*, void ); protected: @@ -122,10 +120,6 @@ public: css::uno::RuntimeException, std::exception ) override; - // XDocumentEventListener - virtual void SAL_CALL documentEventOccured( const css::document::DocumentEvent& Event ) throw (css::uno::RuntimeException, std::exception) override; - virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) throw (css::uno::RuntimeException, std::exception) override; - private: osl::Mutex m_aMutex; diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index 01a8f9435612..5d1d893e3775 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -599,7 +599,7 @@ FeatureState OApplicationController::GetState(sal_uInt16 _nId) const aReturn.bEnabled = true; break; case ID_BROWSER_SAVEDOC: - aReturn.bEnabled = !isDataSourceReadOnly() && m_xDocumentModify.is() && m_xDocumentModify->isModified(); + aReturn.bEnabled = !isDataSourceReadOnly(); break; case ID_BROWSER_SAVEASDOC: aReturn.bEnabled = true; @@ -2659,7 +2659,6 @@ sal_Bool SAL_CALL OApplicationController::attachModel(const Reference< XModel > } m_xModel = _rxModel; - m_xDocumentModify = xDocModify; m_xDataSource.set( xOfficeDoc.is() ? xOfficeDoc->getDataSource() : Reference< XDataSource >(), UNO_QUERY ); // connect to new model diff --git a/dbaccess/source/ui/app/AppController.hxx b/dbaccess/source/ui/app/AppController.hxx index cc7bcf1ac543..ad9cafae96dc 100644 --- a/dbaccess/source/ui/app/AppController.hxx +++ b/dbaccess/source/ui/app/AppController.hxx @@ -99,8 +99,6 @@ namespace dbaui m_xDataSource; css::uno::Reference< css::frame::XModel > m_xModel; - css::uno::Reference< css::util::XModifiable > - m_xDocumentModify; ::cppu::OInterfaceContainerHelper m_aContextMenuInterceptors; diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx index 52c76f11ab38..cc9b7d8b4c39 100644 --- a/dbaccess/source/ui/querydesign/querycontroller.cxx +++ b/dbaccess/source/ui/querydesign/querycontroller.cxx @@ -496,7 +496,7 @@ FeatureState OQueryController::GetState(sal_uInt16 _nId) const aReturn.bEnabled = !editingCommand() && !editingView() && (!m_bGraphicalDesign || !(m_vTableFieldDesc.empty() || m_vTableData.empty())); break; case ID_BROWSER_SAVEDOC: - aReturn.bEnabled = impl_isModified() && (!m_bGraphicalDesign || !(m_vTableFieldDesc.empty() || m_vTableData.empty())); + aReturn.bEnabled = isEditable() && (!m_bGraphicalDesign || !(m_vTableFieldDesc.empty() || m_vTableData.empty())); break; case SID_PRINTDOCDIRECT: break; diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx index 26e48f5e5b0f..2feca27ed36e 100644 --- a/dbaccess/source/ui/tabledesign/TableController.cxx +++ b/dbaccess/source/ui/tabledesign/TableController.cxx @@ -190,15 +190,10 @@ FeatureState OTableController::GetState(sal_uInt16 _nId) const break; case ID_BROWSER_EDITDOC: aReturn.bChecked = isEditable(); - aReturn.bEnabled = m_bNew || isEditable();// the editable flag is set through this one -> || isAddAllowed() || isDropAllowed() || isAlterAllowed(); + aReturn.bEnabled = true; break; case ID_BROWSER_SAVEDOC: - aReturn.bEnabled = impl_isModified(); - if ( aReturn.bEnabled ) - { - aReturn.bEnabled = ::std::any_of(m_vRowList.begin(),m_vRowList.end(), - ::boost::mem_fn(&OTableRow::isValid)); - } + aReturn.bEnabled = isEditable() && ::std::any_of(m_vRowList.begin(),m_vRowList.end(),::boost::mem_fn(&OTableRow::isValid)); break; case ID_BROWSER_SAVEASDOC: aReturn.bEnabled = isConnected() && isEditable(); @@ -244,6 +239,7 @@ void OTableController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >& case ID_BROWSER_EDITDOC: setEditable(!isEditable()); static_cast<OTableDesignView*>(getView())->setReadOnly(!isEditable()); + InvalidateFeature(ID_BROWSER_SAVEDOC); InvalidateFeature(ID_BROWSER_PASTE); InvalidateFeature(SID_BROWSER_CLEAR_QUERY); break; diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxx index 4055cbcd8944..111491b89fd8 100644 --- a/framework/source/uielement/popuptoolbarcontroller.cxx +++ b/framework/source/uielement/popuptoolbarcontroller.cxx @@ -21,6 +21,7 @@ #include <cppuhelper/supportsservice.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/propertyvalue.hxx> +#include <comphelper/propertysequence.hxx> #include <framework/menuconfiguration.hxx> #include <rtl/ref.hxx> #include <svtools/imagemgr.hxx> @@ -30,6 +31,7 @@ #include <toolkit/helper/vclunohelper.hxx> #include <tools/urlobj.hxx> #include <unotools/moduleoptions.hxx> +#include <vcl/commandinfoprovider.hxx> #include <vcl/svapp.hxx> #include <vcl/toolbox.hxx> @@ -38,10 +40,14 @@ #include <com/sun/star/frame/thePopupMenuControllerFactory.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/frame/XPopupMenuController.hpp> +#include <com/sun/star/frame/XStorable.hpp> +#include <com/sun/star/frame/XSubToolbarController.hpp> #include <com/sun/star/frame/XUIControllerFactory.hpp> +#include <com/sun/star/graphic/GraphicProvider.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/ucb/CommandFailedException.hpp> #include <com/sun/star/ucb/ContentCreationException.hpp> +#include <com/sun/star/util/XModifiable.hpp> using namespace framework; @@ -302,34 +308,175 @@ ToolBoxItemBits GenericPopupToolbarController::getDropDownStyle() const return m_bSplitButton ? ToolBoxItemBits::DROPDOWN : ToolBoxItemBits::DROPDOWNONLY; } -class SaveToolbarController : public PopupMenuToolbarController +class SaveToolbarController : public cppu::ImplInheritanceHelper< PopupMenuToolbarController, + css::frame::XSubToolbarController, + css::util::XModifyListener > { public: SaveToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException, std::exception ) override; + + // XSubToolbarController + // Ugly HACK to cause ToolBarManager ask our controller for updated image, in case of icon theme change. + virtual sal_Bool SAL_CALL opensSubToolbar() throw ( css::uno::RuntimeException, std::exception ) override; + virtual OUString SAL_CALL getSubToolbarName() throw ( css::uno::RuntimeException, std::exception ) override; + virtual void SAL_CALL functionSelected( const OUString& aCommand ) throw ( css::uno::RuntimeException, std::exception ) override; + virtual void SAL_CALL updateImage() throw ( css::uno::RuntimeException, std::exception ) override; + // XStatusListener virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) throw ( css::uno::RuntimeException, std::exception ) override; + // XModifyListener + virtual void SAL_CALL modified( const css::lang::EventObject& rEvent ) throw ( css::uno::RuntimeException, std::exception ) override; + + // XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& rEvent ) throw ( css::uno::RuntimeException, std::exception ) override; + + // XComponent + virtual void SAL_CALL dispose() throw ( css::uno::RuntimeException, std::exception ) override; + // XServiceInfo virtual OUString SAL_CALL getImplementationName() throw ( css::uno::RuntimeException ) override; virtual sal_Bool SAL_CALL supportsService( OUString const & rServiceName ) throw ( css::uno::RuntimeException ) override; virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw ( css::uno::RuntimeException ) override; + +private: + css::uno::Reference< css::util::XModifiable > m_xModifiable; }; SaveToolbarController::SaveToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext ) - : PopupMenuToolbarController( rxContext, ".uno:SaveAsMenu" ) + : ImplInheritanceHelper( rxContext, ".uno:SaveAsMenu" ) { } -void SaveToolbarController::statusChanged( const css::frame::FeatureStateEvent& rEvent ) +void SaveToolbarController::initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) + throw ( css::uno::Exception, css::uno::RuntimeException, std::exception ) +{ + PopupMenuToolbarController::initialize( aArguments ); + + if ( m_sModuleName.endsWith( "RelationDesign" ) ) + { + // Should not have the dropdown. + ToolBox* pToolBox = nullptr; + sal_uInt16 nId = 0; + if ( getToolboxId( nId, &pToolBox ) ) + pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) & ~ ToolBoxItemBits::DROPDOWN ); + return; + } + + css::uno::Reference< css::frame::XController > xController( m_xFrame->getController(), css::uno::UNO_QUERY ); + if ( xController.is() ) + m_xModifiable.set( xController->getModel(), css::uno::UNO_QUERY ); + + if ( !m_xModifiable.is() ) + // Can be in table/query design. + m_xModifiable.set( xController, css::uno::UNO_QUERY ); + + if ( m_xModifiable.is() ) + m_xModifiable->addModifyListener( this ); +} + +sal_Bool SaveToolbarController::opensSubToolbar() + throw ( css::uno::RuntimeException, std::exception ) +{ + return sal_True; +} + +OUString SaveToolbarController::getSubToolbarName() + throw ( css::uno::RuntimeException, std::exception ) +{ + return OUString(); +} + +void SaveToolbarController::functionSelected( const OUString& /*aCommand*/ ) + throw ( css::uno::RuntimeException, std::exception ) +{ +} + +void SaveToolbarController::updateImage() throw ( css::uno::RuntimeException, std::exception ) { ToolBox* pToolBox = nullptr; sal_uInt16 nId = 0; - if ( getToolboxId( nId, &pToolBox ) ) + if ( !getToolboxId( nId, &pToolBox ) ) + return; + + bool bLargeIcons = pToolBox->GetToolboxButtonSize() == TOOLBOX_BUTTONSIZE_LARGE; + css::uno::Reference< css::frame::XStorable > xStorable( m_xModifiable, css::uno::UNO_QUERY ); + Image aImage; + + if ( xStorable.is() && xStorable->isReadonly() ) + { + aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand( ".uno:SaveAs", bLargeIcons, m_xFrame ); + } + else if ( m_xModifiable.is() && m_xModifiable->isModified() ) + { + const OUString aImageURL( "private:graphicrepository/res/savemodified_" + ( bLargeIcons ? OUString( "large.png" ) : OUString( "small.png" ) ) ); + const css::uno::Reference< css::graphic::XGraphicProvider > xGraphicProvider( css::graphic::GraphicProvider::create( m_xContext ) ); + const css::uno::Reference< css::graphic::XGraphic > xGraphic( + xGraphicProvider->queryGraphic( comphelper::InitPropertySequence( { { "URL", css::uno::makeAny( aImageURL ) } } ) ), css::uno::UNO_QUERY ); + if ( xGraphic.is() ) + aImage = Image( xGraphic ); + } + + if ( !aImage ) + aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand( m_aCommandURL, bLargeIcons, m_xFrame ); + + if ( !!aImage ) + pToolBox->SetItemImage( nId, aImage ); +} + +void SaveToolbarController::statusChanged( const css::frame::FeatureStateEvent& rEvent ) + throw ( css::uno::RuntimeException, std::exception ) +{ + css::uno::Reference< css::frame::XStorable > xStorable( m_xModifiable, css::uno::UNO_QUERY ); + + // If the model is able to tell us whether we're in read only mode, change the button to save as only mode + // based on that. Otherwise just dumbly disable the button (because there could be other reasons why the + // save slot is disabled, where save as isn't possible as well). + if ( xStorable.is() ) + { + ToolBox* pToolBox = nullptr; + sal_uInt16 nId = 0; + if ( !getToolboxId( nId, &pToolBox ) ) + return; + + bool bReadOnly = xStorable->isReadonly(); + pToolBox->SetQuickHelpText( nId, + vcl::CommandInfoProvider::Instance().GetTooltipForCommand( bReadOnly ? OUString( ".uno:SaveAs" ) : m_aCommandURL, m_xFrame ) ); + pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) & ~( bReadOnly ? ToolBoxItemBits::DROPDOWN : ToolBoxItemBits::DROPDOWNONLY ) ); + pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ( bReadOnly ? ToolBoxItemBits::DROPDOWNONLY : ToolBoxItemBits::DROPDOWN ) ); + updateImage(); + } + else + PopupMenuToolbarController::statusChanged( rEvent ); +} + +void SaveToolbarController::modified( const css::lang::EventObject& /*rEvent*/ ) + throw ( css::uno::RuntimeException, std::exception ) +{ + updateImage(); +} + +void SaveToolbarController::disposing( const css::lang::EventObject& rEvent ) + throw ( css::uno::RuntimeException, std::exception ) +{ + if ( rEvent.Source == m_xModifiable ) + m_xModifiable.clear(); + else + PopupMenuToolbarController::disposing( rEvent ); +} + +void SaveToolbarController::dispose() + throw ( css::uno::RuntimeException, std::exception ) +{ + PopupMenuToolbarController::dispose(); + if ( m_xModifiable.is() ) { - pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) & ~( rEvent.IsEnabled ? ToolBoxItemBits::DROPDOWNONLY : ToolBoxItemBits::DROPDOWN ) ); - pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ( rEvent.IsEnabled ? ToolBoxItemBits::DROPDOWN : ToolBoxItemBits::DROPDOWNONLY ) ); + m_xModifiable->removeModifyListener( this ); + m_xModifiable.clear(); } } diff --git a/icon-themes/tango/cmd/lc_save.png b/icon-themes/tango/cmd/lc_save.png Binary files differindex 48189371afa8..41a41ec78229 100644 --- a/icon-themes/tango/cmd/lc_save.png +++ b/icon-themes/tango/cmd/lc_save.png diff --git a/icon-themes/tango/cmd/lc_saveas.png b/icon-themes/tango/cmd/lc_saveas.png Binary files differindex 8ecfd565d438..7b422e9d2d99 100644 --- a/icon-themes/tango/cmd/lc_saveas.png +++ b/icon-themes/tango/cmd/lc_saveas.png diff --git a/icon-themes/tango/cmd/lc_saveas.xcf.bz2 b/icon-themes/tango/cmd/lc_saveas.xcf.bz2 Binary files differindex 7c4d92c40fe5..f1ba72c85b9a 100644 --- a/icon-themes/tango/cmd/lc_saveas.xcf.bz2 +++ b/icon-themes/tango/cmd/lc_saveas.xcf.bz2 diff --git a/icon-themes/tango/cmd/lc_saveastemplate.png b/icon-themes/tango/cmd/lc_saveastemplate.png Binary files differindex bb47ecf184eb..0a8bd76620b6 100644 --- a/icon-themes/tango/cmd/lc_saveastemplate.png +++ b/icon-themes/tango/cmd/lc_saveastemplate.png diff --git a/icon-themes/tango/cmd/lc_saveastemplate.xcf.bz2 b/icon-themes/tango/cmd/lc_saveastemplate.xcf.bz2 Binary files differindex 74499ee1c1d7..931e71308999 100644 --- a/icon-themes/tango/cmd/lc_saveastemplate.xcf.bz2 +++ b/icon-themes/tango/cmd/lc_saveastemplate.xcf.bz2 diff --git a/icon-themes/tango/cmd/sc_save.png b/icon-themes/tango/cmd/sc_save.png Binary files differindex 545e93fca4f7..e7716c95a6b1 100644 --- a/icon-themes/tango/cmd/sc_save.png +++ b/icon-themes/tango/cmd/sc_save.png diff --git a/icon-themes/tango/cmd/sc_save.xcf.bz2 b/icon-themes/tango/cmd/sc_save.xcf.bz2 Binary files differdeleted file mode 100644 index df9d32cd2867..000000000000 --- a/icon-themes/tango/cmd/sc_save.xcf.bz2 +++ /dev/null diff --git a/icon-themes/tango/cmd/sc_saveas.png b/icon-themes/tango/cmd/sc_saveas.png Binary files differindex 3b3844bb0e0a..881b42f9c6ec 100644 --- a/icon-themes/tango/cmd/sc_saveas.png +++ b/icon-themes/tango/cmd/sc_saveas.png diff --git a/icon-themes/tango/cmd/sc_saveas.xcf.bz2 b/icon-themes/tango/cmd/sc_saveas.xcf.bz2 Binary files differindex bc489ad356b5..2970612de9e1 100644 --- a/icon-themes/tango/cmd/sc_saveas.xcf.bz2 +++ b/icon-themes/tango/cmd/sc_saveas.xcf.bz2 diff --git a/icon-themes/tango/cmd/sc_saveastemplate.png b/icon-themes/tango/cmd/sc_saveastemplate.png Binary files differindex 74c63f198411..76e41ea2873a 100644 --- a/icon-themes/tango/cmd/sc_saveastemplate.png +++ b/icon-themes/tango/cmd/sc_saveastemplate.png diff --git a/icon-themes/tango/cmd/sc_saveastemplate.xcf.bz2 b/icon-themes/tango/cmd/sc_saveastemplate.xcf.bz2 Binary files differindex fe3b96bf885a..0bb493f81499 100644 --- a/icon-themes/tango/cmd/sc_saveastemplate.xcf.bz2 +++ b/icon-themes/tango/cmd/sc_saveastemplate.xcf.bz2 diff --git a/icon-themes/tango/links.txt b/icon-themes/tango/links.txt index ec67d4a1c95c..63f253bb23ae 100644 --- a/icon-themes/tango/links.txt +++ b/icon-themes/tango/links.txt @@ -537,3 +537,4 @@ cmd/lc_charbackcolor.png cmd/lc_backcolor.png # Toggle graphics visibility in Writer cmd/sc_showgraphics.png cmd/sc_insertgraphic.png cmd/lc_showgraphics.png cmd/lc_insertgraphic.png + diff --git a/icon-themes/tango/res/savemodified_large.png b/icon-themes/tango/res/savemodified_large.png Binary files differnew file mode 100644 index 000000000000..9abf638613fe --- /dev/null +++ b/icon-themes/tango/res/savemodified_large.png diff --git a/icon-themes/tango/res/savemodified_small.png b/icon-themes/tango/res/savemodified_small.png Binary files differnew file mode 100644 index 000000000000..385ee201719d --- /dev/null +++ b/icon-themes/tango/res/savemodified_small.png diff --git a/icon-themes/tango/res/sc05502.png b/icon-themes/tango/res/sc05502.png Binary files differindex 3b3844bb0e0a..881b42f9c6ec 100644 --- a/icon-themes/tango/res/sc05502.png +++ b/icon-themes/tango/res/sc05502.png diff --git a/include/svtools/miscopt.hxx b/include/svtools/miscopt.hxx index d8da7035e364..efc4a530c34c 100644 --- a/include/svtools/miscopt.hxx +++ b/include/svtools/miscopt.hxx @@ -90,9 +90,6 @@ class SVT_DLLPUBLIC SvtMiscOptions: public utl::detail::Options void SetShowLinkWarningDialog( bool bSet ); bool IsShowLinkWarningDialogReadOnly() const; - void SetSaveAlwaysAllowed( bool bSet ); - bool IsSaveAlwaysAllowed() const; - void SetExperimentalMode( bool bSet ); bool IsExperimentalMode() const; diff --git a/officecfg/registry/data/org/openoffice/Setup.xcu b/officecfg/registry/data/org/openoffice/Setup.xcu index 2a77ab18b877..94d2c79da758 100644 --- a/officecfg/registry/data/org/openoffice/Setup.xcu +++ b/officecfg/registry/data/org/openoffice/Setup.xcu @@ -884,7 +884,6 @@ <it>/org.openoffice.Office.Common/I18N</it> <it>/org.openoffice.Office.Common/InternalMSExport</it> <it>/org.openoffice.Office.Common/Load</it> - <it>/org.openoffice.Office.Common/Misc/AlwaysAllowSave</it> <it>/org.openoffice.Office.Common/Misc/DisableUICustomization</it> <it>/org.openoffice.Office.Common/Misc/ExperimentalMode</it> <it>/org.openoffice.Office.Common/Misc/FormControlPilotsEnabled</it> diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index 7279a04b9dc5..6adfa44a1e53 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -5599,13 +5599,6 @@ </info> <value>false</value> </prop> - <prop oor:name="AlwaysAllowSave" oor:type="xs:boolean" oor:nillable="false"> - <info> - <desc>Determines if the user can save the document even when it's not - modified.</desc> - </info> - <value>false</value> - </prop> <prop oor:name="ExperimentalMode" oor:type="xs:boolean" oor:nillable="false"> <info> <desc>Determines if various experimental, and potentially unstable diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx index 15b667931407..3f61c9baa961 100644 --- a/reportdesign/source/ui/report/ReportController.cxx +++ b/reportdesign/source/ui/report/ReportController.cxx @@ -787,11 +787,7 @@ FeatureState OReportController::GetState(sal_uInt16 _nId) const aReturn.aValue <<= getSplitPos(); break; case SID_SAVEDOC: - aReturn.bEnabled = impl_isModified() && isEditable(); - break; case SID_SAVEASDOC: - aReturn.bEnabled = isConnected() && isEditable(); - break; case SID_SAVEACOPY: aReturn.bEnabled = isConnected() && isEditable(); break; @@ -1175,7 +1171,6 @@ void OReportController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue > UndoContext aUndoContext( getUndoManager(), sUndoAction ); xFunctions->removeByIndex(nIndex); select(uno::makeAny(xFunctions->getParent())); - InvalidateFeature( SID_SAVEDOC ); InvalidateFeature( SID_UNDO ); } } @@ -2621,7 +2616,6 @@ void OReportController::executeMethodWithUndo(sal_uInt16 _nUndoStrId,const ::std const OUString sUndoAction = ModuleRes(_nUndoStrId); UndoContext aUndoContext( getUndoManager(), sUndoAction ); _pMemfun( getDesignView() ); - InvalidateFeature( SID_SAVEDOC ); InvalidateFeature( SID_UNDO ); } @@ -2630,7 +2624,6 @@ void OReportController::alignControlsWithUndo(sal_uInt16 _nUndoStrId,sal_Int32 _ const OUString sUndoAction = ModuleRes(_nUndoStrId); UndoContext aUndoContext( getUndoManager(), sUndoAction ); getDesignView()->alignMarkedObjects(_nControlModification,_bAlignAtSection); - InvalidateFeature( SID_SAVEDOC ); InvalidateFeature( SID_UNDO ); } @@ -2724,7 +2717,6 @@ void OReportController::shrinkSection(sal_uInt16 _nUndoStrId, uno::Reference<rep } } - InvalidateFeature( SID_SAVEDOC ); InvalidateFeature( SID_UNDO ); } diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index c57f911a5771..7a7b0644ef5e 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -44,7 +44,6 @@ #include <tools/multisel.hxx> #include <tools/resary.hxx> #include <toolkit/awt/vclxdevice.hxx> -#include <svtools/miscopt.hxx> #include <ctype.h> #include <float.h> @@ -941,9 +940,6 @@ void ScModelObj::initializeForTiledRendering(const css::uno::Sequence<css::beans aInputOptions.SetTextWysiwyg(true); SC_MOD()->SetInputOptions(aInputOptions); pDocShell->CalcOutputFactor(); - // tdf#93154: in tiled rendering LO doesn't always detect changes - SvtMiscOptions aMiscOpt; - aMiscOpt.SetSaveAlwaysAllowed(true); // default tile size in pixels nTilePixelWidth = 256; diff --git a/sc/uiconfig/scalc/toolbar/standardbar.xml b/sc/uiconfig/scalc/toolbar/standardbar.xml index 503126fca809..c3d5c5d3ba7e 100644 --- a/sc/uiconfig/scalc/toolbar/standardbar.xml +++ b/sc/uiconfig/scalc/toolbar/standardbar.xml @@ -24,7 +24,7 @@ <toolbar:toolbaritem xlink:href=".uno:OpenFromCalc"/> <toolbar:toolbaritem xlink:href=".uno:OpenRemote" toolbar:visible="false"/> <toolbar:toolbaritem xlink:href=".uno:Save"/> - <toolbar:toolbaritem xlink:href=".uno:SaveAs"/> + <toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:visible="false"/> <toolbar:toolbaritem xlink:href=".uno:SendMail" toolbar:visible="false"/> <toolbar:toolbarseparator/> <toolbar:toolbaritem xlink:href=".uno:EditDoc" toolbar:visible="false"/> diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index e4b31bbf9279..30dfd28f8a08 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -60,7 +60,6 @@ #include <editeng/unolingu.hxx> #include <svx/svdpagv.hxx> #include <svtools/unoimap.hxx> -#include <svtools/miscopt.hxx> #include <svx/unoshape.hxx> #include <editeng/unonrule.hxx> #include <editeng/eeitem.hxx> @@ -2386,9 +2385,6 @@ void SdXImpressDocument::initializeForTiledRendering(const css::uno::Sequence<cs // by the tile being rerendered - which is wasteful and ugly). pViewShell->GetDrawView()->SetSwapAsynchron(false); } - // tdf#93154: in tiled rendering LO doesn't always detect changes - SvtMiscOptions aMiscOpt; - aMiscOpt.SetSaveAlwaysAllowed(true); } void SdXImpressDocument::registerCallback(LibreOfficeKitCallback pCallback, void* pData) diff --git a/sd/uiconfig/sdraw/toolbar/standardbar.xml b/sd/uiconfig/sdraw/toolbar/standardbar.xml index e9a5fdcf7c64..6894887743a7 100644 --- a/sd/uiconfig/sdraw/toolbar/standardbar.xml +++ b/sd/uiconfig/sdraw/toolbar/standardbar.xml @@ -24,7 +24,7 @@ <toolbar:toolbaritem xlink:href=".uno:Open"/> <toolbar:toolbaritem xlink:href=".uno:OpenRemote" toolbar:visible="false"/> <toolbar:toolbaritem xlink:href=".uno:Save" toolbar:helpid="5505"/> - <toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:helpid="5502"/> + <toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:helpid="5502" toolbar:visible="false"/> <toolbar:toolbaritem xlink:href=".uno:SendMail" toolbar:visible="false" toolbar:helpid="5331"/> <toolbar:toolbarseparator/> <toolbar:toolbaritem xlink:href=".uno:EditDoc" toolbar:helpid="6312" toolbar:visible="false"/> diff --git a/sd/uiconfig/simpress/toolbar/standardbar.xml b/sd/uiconfig/simpress/toolbar/standardbar.xml index 4ab079c67be9..64a42e8a567f 100644 --- a/sd/uiconfig/simpress/toolbar/standardbar.xml +++ b/sd/uiconfig/simpress/toolbar/standardbar.xml @@ -24,7 +24,7 @@ <toolbar:toolbaritem xlink:href=".uno:Open"/> <toolbar:toolbaritem xlink:href=".uno:OpenRemote" toolbar:visible="false"/> <toolbar:toolbaritem xlink:href=".uno:Save"/> - <toolbar:toolbaritem xlink:href=".uno:SaveAs"/> + <toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:visible="false"/> <toolbar:toolbaritem xlink:href=".uno:SendMail" toolbar:visible="false"/> <toolbar:toolbarseparator/> <toolbar:toolbaritem xlink:href=".uno:EditDoc" toolbar:visible="false"/> diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index f151bc78fd9c..b5c9e3edb25d 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -4939,7 +4939,7 @@ SfxBoolItem Save SID_SAVEDOC /* flags: */ AutoUpdate = FALSE, Cachable = Cachable, - FastCall = TRUE, + FastCall = FALSE, HasCoreId = FALSE, HasDialog = FALSE, ReadOnlyDoc = FALSE, diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index adab5fb16766..ddf888c6c841 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -257,7 +257,6 @@ class ModelData_Impl uno::Reference< frame::XModel > m_xModel; uno::Reference< frame::XStorable > m_xStorable; uno::Reference< frame::XStorable2 > m_xStorable2; - uno::Reference< util::XModifiable > m_xModifiable; OUString m_aModuleName; ::comphelper::SequenceAsHashMap* m_pDocumentPropsHM; @@ -279,7 +278,6 @@ public: uno::Reference< frame::XModel > GetModel(); uno::Reference< frame::XStorable > GetStorable(); uno::Reference< frame::XStorable2 > GetStorable2(); - uno::Reference< util::XModifiable > GetModifiable(); ::comphelper::SequenceAsHashMap& GetMediaDescr() { return m_aMediaDescrHM; } @@ -419,19 +417,6 @@ uno::Reference< frame::XStorable2 > ModelData_Impl::GetStorable2() } -uno::Reference< util::XModifiable > ModelData_Impl::GetModifiable() -{ - if ( !m_xModifiable.is() ) - { - m_xModifiable.set( m_xModel, uno::UNO_QUERY ); - if ( !m_xModifiable.is() ) - throw uno::RuntimeException(); - } - - return m_xModifiable; -} - - const ::comphelper::SequenceAsHashMap& ModelData_Impl::GetDocProps() { if ( !m_pDocumentPropsHM ) @@ -689,7 +674,6 @@ sal_Int8 ModelData_Impl::CheckStateForSave() return STATUS_SAVEAS; // check acceptable entries for media descriptor - bool bVersInfoNeedsStore = false; ::comphelper::SequenceAsHashMap aAcceptedArgs; OUString aVersionCommentString("VersionComment"); @@ -699,18 +683,15 @@ sal_Int8 ModelData_Impl::CheckStateForSave() OUString aFailOnWarningString("FailOnWarning"); if ( GetMediaDescr().find( aVersionCommentString ) != GetMediaDescr().end() ) - { - bVersInfoNeedsStore = true; aAcceptedArgs[ aVersionCommentString ] = GetMediaDescr()[ aVersionCommentString ]; - } if ( GetMediaDescr().find( aAuthorString ) != GetMediaDescr().end() ) aAcceptedArgs[ aAuthorString ] = GetMediaDescr()[ aAuthorString ]; if ( GetMediaDescr().find( aInteractionHandlerString ) != GetMediaDescr().end() ) aAcceptedArgs[ aInteractionHandlerString ] = GetMediaDescr()[ aInteractionHandlerString ]; if ( GetMediaDescr().find( aStatusIndicatorString ) != GetMediaDescr().end() ) aAcceptedArgs[ aStatusIndicatorString ] = GetMediaDescr()[ aStatusIndicatorString ]; - if ( GetMediaDescr().find( aFailOnWarningString ) != GetMediaDescr().end() ) - aAcceptedArgs[ aFailOnWarningString ] = GetMediaDescr()[ aFailOnWarningString ]; + if ( GetMediaDescr().find( aFailOnWarningString ) != GetMediaDescr().end() ) + aAcceptedArgs[ aFailOnWarningString ] = GetMediaDescr()[ aFailOnWarningString ]; // remove unacceptable entry if there is any DBG_ASSERT( GetMediaDescr().size() == aAcceptedArgs.size(), @@ -718,15 +699,6 @@ sal_Int8 ModelData_Impl::CheckStateForSave() if ( GetMediaDescr().size() != aAcceptedArgs.size() ) GetMediaDescr() = aAcceptedArgs; - // the document must be modified unless the always-save flag is set. - SvtMiscOptions aMiscOptions; - bool bAlwaysAllowSave = aMiscOptions.IsSaveAlwaysAllowed(); - if (!bAlwaysAllowSave) - { - if ( !GetModifiable()->isModified() && !bVersInfoNeedsStore ) - return STATUS_NO_ACTION; - } - // check that the old filter is acceptable OUString aOldFilterName = GetDocProps().getUnpackedValueOrDefault( aFilterNameString, diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 522976bfe1a9..d27db019168c 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -62,7 +62,6 @@ #include <unotools/useroptions.hxx> #include <unotools/saveopt.hxx> #include <svtools/asynclink.hxx> -#include <svtools/miscopt.hxx> #include <comphelper/documentconstants.hxx> #include <sfx2/app.hxx> @@ -1003,11 +1002,7 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet) } case SID_SAVEDOC: { - SvtMiscOptions aMiscOptions; - bool bAlwaysAllowSave = aMiscOptions.IsSaveAlwaysAllowed(); - bool bAllowSave = (bAlwaysAllowSave || IsModified()); - bool bMediumRO = IsReadOnlyMedium(); - if ( !bMediumRO && GetMedium() && bAllowSave ) + if ( !IsReadOnlyMedium() ) rSet.Put(SfxStringItem( nWhich, SfxResId(STR_SAVEDOC).toString())); else diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 1534261dd592..33365ec9e747 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -1320,7 +1320,6 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) { SfxBindings& rBind = GetBindings(); rBind.Invalidate( SID_DOC_MODIFIED ); - rBind.Invalidate( SID_SAVEDOC ); rBind.Invalidate( SID_RELOAD ); rBind.Invalidate( SID_EDITDOC ); break; diff --git a/svtools/source/config/miscopt.cxx b/svtools/source/config/miscopt.cxx index 5df1acf4a7a0..fb2a3160856e 100644 --- a/svtools/source/config/miscopt.cxx +++ b/svtools/source/config/miscopt.cxx @@ -58,12 +58,10 @@ using namespace ::com::sun::star; #define PROPERTYHANDLE_SHOWLINKWARNINGDIALOG 6 #define PROPERTYNAME_DISABLEUICUSTOMIZATION "DisableUICustomization" #define PROPERTYHANDLE_DISABLEUICUSTOMIZATION 7 -#define PROPERTYNAME_ALWAYSALLOWSAVE "AlwaysAllowSave" -#define PROPERTYHANDLE_ALWAYSALLOWSAVE 8 #define PROPERTYNAME_EXPERIMENTALMODE "ExperimentalMode" -#define PROPERTYHANDLE_EXPERIMENTALMODE 9 +#define PROPERTYHANDLE_EXPERIMENTALMODE 8 #define PROPERTYNAME_MACRORECORDERMODE "MacroRecorderMode" -#define PROPERTYHANDLE_MACRORECORDERMODE 10 +#define PROPERTYHANDLE_MACRORECORDERMODE 9 #define VCL_TOOLBOX_STYLE_FLAT ((sal_uInt16)0x0004) // from <vcl/toolbox.hxx> @@ -85,7 +83,6 @@ private: bool m_bShowLinkWarningDialog; bool m_bIsShowLinkWarningDialogRO; bool m_bDisableUICustomization; - bool m_bAlwaysAllowSave; bool m_bExperimentalMode; bool m_bMacroRecorderMode; bool m_bIconThemeWasSetAutomatically; @@ -131,12 +128,6 @@ public: inline bool DisableUICustomization() const { return m_bDisableUICustomization; } - inline void SetSaveAlwaysAllowed( bool bSet ) - { m_bAlwaysAllowSave = bSet; SetModified(); } - - inline bool IsSaveAlwaysAllowed() const - { return m_bAlwaysAllowSave; } - inline void SetExperimentalMode( bool bSet ) { m_bExperimentalMode = bSet; SetModified(); } @@ -241,7 +232,6 @@ SvtMiscOptions_Impl::SvtMiscOptions_Impl() , m_bIsUseSystemPrintDialogRO( false ) , m_bShowLinkWarningDialog( true ) , m_bIsShowLinkWarningDialogRO( false ) - , m_bAlwaysAllowSave( false ) , m_bExperimentalMode( false ) , m_bMacroRecorderMode( false ) , m_bIconThemeWasSetAutomatically( false ) @@ -343,12 +333,6 @@ SvtMiscOptions_Impl::SvtMiscOptions_Impl() OSL_FAIL("Wrong type of \"Misc\\DisableUICustomization\"!" ); break; } - case PROPERTYHANDLE_ALWAYSALLOWSAVE : - { - if( !(seqValues[nProperty] >>= m_bAlwaysAllowSave) ) - OSL_FAIL("Wrong type of \"Misc\\AlwaysAllowSave\"!" ); - break; - } case PROPERTYHANDLE_EXPERIMENTALMODE : { if( !(seqValues[nProperty] >>= m_bExperimentalMode) ) @@ -461,12 +445,6 @@ void SvtMiscOptions_Impl::Load( const Sequence< OUString >& rPropertyNames ) OSL_FAIL("Wrong type of \"Misc\\DisableUICustomization\"!" ); } break; - case PROPERTYHANDLE_ALWAYSALLOWSAVE: - { - if( !(seqValues[nProperty] >>= m_bAlwaysAllowSave) ) - OSL_FAIL("Wrong type of \"Misc\\AlwaysAllowSave\"!" ); - } - break; } } } @@ -624,11 +602,6 @@ void SvtMiscOptions_Impl::ImplCommit() seqValues[nProperty] <<= m_bDisableUICustomization; break; } - case PROPERTYHANDLE_ALWAYSALLOWSAVE : - { - seqValues[nProperty] <<= m_bAlwaysAllowSave; - break; - } case PROPERTYHANDLE_EXPERIMENTALMODE : { seqValues[nProperty] <<= m_bExperimentalMode; @@ -661,7 +634,6 @@ Sequence< OUString > SvtMiscOptions_Impl::GetPropertyNames() OUString(PROPERTYNAME_USESYSTEMPRINTDIALOG), OUString(PROPERTYNAME_SHOWLINKWARNINGDIALOG), OUString(PROPERTYNAME_DISABLEUICUSTOMIZATION), - OUString(PROPERTYNAME_ALWAYSALLOWSAVE), OUString(PROPERTYNAME_EXPERIMENTALMODE), OUString(PROPERTYNAME_MACRORECORDERMODE) }; @@ -821,16 +793,6 @@ bool SvtMiscOptions::IsShowLinkWarningDialogReadOnly() const return m_pDataContainer->IsShowLinkWarningDialogReadOnly(); } -void SvtMiscOptions::SetSaveAlwaysAllowed( bool bSet ) -{ - m_pDataContainer->SetSaveAlwaysAllowed( bSet ); -} - -bool SvtMiscOptions::IsSaveAlwaysAllowed() const -{ - return m_pDataContainer->IsSaveAlwaysAllowed(); -} - void SvtMiscOptions::SetExperimentalMode( bool bSet ) { m_pDataContainer->SetExperimentalMode( bSet ); diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index c0e865aafe7a..d9432d6b5391 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -138,7 +138,6 @@ #include <PostItMgr.hxx> #include <svtools/langtab.hxx> -#include <svtools/miscopt.hxx> #include <map> #include <set> #include <vector> @@ -3234,9 +3233,6 @@ void SwXTextDocument::initializeForTiledRendering(const css::uno::Sequence<css:: // directly in twips. SwEditWin& rEditWin = pDocShell->GetView()->GetEditWin(); rEditWin.EnableMapMode(false); - // tdf#93154: in tiled rendering LO doesn't always detect changes - SvtMiscOptions aMiscOpt; - aMiscOpt.SetSaveAlwaysAllowed(true); } void SwXTextDocument::registerCallback(LibreOfficeKitCallback pCallback, void* pData) diff --git a/sw/uiconfig/sglobal/toolbar/standardbar.xml b/sw/uiconfig/sglobal/toolbar/standardbar.xml index bdbd1858b79b..7af5a5047579 100644 --- a/sw/uiconfig/sglobal/toolbar/standardbar.xml +++ b/sw/uiconfig/sglobal/toolbar/standardbar.xml @@ -23,7 +23,7 @@ <toolbar:toolbaritem xlink:href=".uno:NewDoc" toolbar:visible="false" toolbar:helpid="5500"/> <toolbar:toolbaritem xlink:href=".uno:Open"/> <toolbar:toolbaritem xlink:href=".uno:Save" toolbar:helpid="5505"/> - <toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:helpid="5502"/> + <toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:helpid="5502" toolbar:visible="false"/> <toolbar:toolbaritem xlink:href=".uno:SendMail" toolbar:visible="false" toolbar:helpid="5331"/> <toolbar:toolbarseparator/> <toolbar:toolbaritem xlink:href=".uno:EditDoc" toolbar:helpid="6312" toolbar:visible="false"/> diff --git a/sw/uiconfig/sweb/toolbar/standardbar.xml b/sw/uiconfig/sweb/toolbar/standardbar.xml index 14a0048543b6..be11b5b1ee6f 100644 --- a/sw/uiconfig/sweb/toolbar/standardbar.xml +++ b/sw/uiconfig/sweb/toolbar/standardbar.xml @@ -23,7 +23,7 @@ <toolbar:toolbaritem xlink:href=".uno:NewDoc" toolbar:visible="false" toolbar:helpid="5500"/> <toolbar:toolbaritem xlink:href=".uno:Open"/> <toolbar:toolbaritem xlink:href=".uno:Save" toolbar:helpid="5505"/> - <toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:helpid="5502"/> + <toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:helpid="5502" toolbar:visible="false"/> <toolbar:toolbaritem xlink:href=".uno:SendMail" toolbar:visible="false" toolbar:helpid="5331"/> <toolbar:toolbarseparator/> <toolbar:toolbaritem xlink:href=".uno:EditDoc" toolbar:helpid="6312" toolbar:visible="false"/> diff --git a/sw/uiconfig/swform/toolbar/standardbar.xml b/sw/uiconfig/swform/toolbar/standardbar.xml index bdbd1858b79b..7af5a5047579 100644 --- a/sw/uiconfig/swform/toolbar/standardbar.xml +++ b/sw/uiconfig/swform/toolbar/standardbar.xml @@ -23,7 +23,7 @@ <toolbar:toolbaritem xlink:href=".uno:NewDoc" toolbar:visible="false" toolbar:helpid="5500"/> <toolbar:toolbaritem xlink:href=".uno:Open"/> <toolbar:toolbaritem xlink:href=".uno:Save" toolbar:helpid="5505"/> - <toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:helpid="5502"/> + <toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:helpid="5502" toolbar:visible="false"/> <toolbar:toolbaritem xlink:href=".uno:SendMail" toolbar:visible="false" toolbar:helpid="5331"/> <toolbar:toolbarseparator/> <toolbar:toolbaritem xlink:href=".uno:EditDoc" toolbar:helpid="6312" toolbar:visible="false"/> diff --git a/sw/uiconfig/swreport/toolbar/standardbar.xml b/sw/uiconfig/swreport/toolbar/standardbar.xml index bdbd1858b79b..7af5a5047579 100644 --- a/sw/uiconfig/swreport/toolbar/standardbar.xml +++ b/sw/uiconfig/swreport/toolbar/standardbar.xml @@ -23,7 +23,7 @@ <toolbar:toolbaritem xlink:href=".uno:NewDoc" toolbar:visible="false" toolbar:helpid="5500"/> <toolbar:toolbaritem xlink:href=".uno:Open"/> <toolbar:toolbaritem xlink:href=".uno:Save" toolbar:helpid="5505"/> - <toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:helpid="5502"/> + <toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:helpid="5502" toolbar:visible="false"/> <toolbar:toolbaritem xlink:href=".uno:SendMail" toolbar:visible="false" toolbar:helpid="5331"/> <toolbar:toolbarseparator/> <toolbar:toolbaritem xlink:href=".uno:EditDoc" toolbar:helpid="6312" toolbar:visible="false"/> diff --git a/sw/uiconfig/swriter/toolbar/standardbar.xml b/sw/uiconfig/swriter/toolbar/standardbar.xml index 6d36cc0f2583..b917956080b4 100644 --- a/sw/uiconfig/swriter/toolbar/standardbar.xml +++ b/sw/uiconfig/swriter/toolbar/standardbar.xml @@ -24,7 +24,7 @@ <toolbar:toolbaritem xlink:href=".uno:OpenFromWriter"/> <toolbar:toolbaritem xlink:href=".uno:OpenRemote" toolbar:visible="false"/> <toolbar:toolbaritem xlink:href=".uno:Save" toolbar:helpid="5505"/> - <toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:helpid="5502"/> + <toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:helpid="5502" toolbar:visible="false"/> <toolbar:toolbaritem xlink:href=".uno:SendMail" toolbar:visible="false" toolbar:helpid="5331"/> <toolbar:toolbarseparator/> <toolbar:toolbaritem xlink:href=".uno:EditDoc" toolbar:helpid="6312" toolbar:visible="false"/> diff --git a/sw/uiconfig/swxform/toolbar/standardbar.xml b/sw/uiconfig/swxform/toolbar/standardbar.xml index de7a044b0eeb..8368721c821e 100644 --- a/sw/uiconfig/swxform/toolbar/standardbar.xml +++ b/sw/uiconfig/swxform/toolbar/standardbar.xml @@ -23,7 +23,7 @@ <toolbar:toolbaritem xlink:href=".uno:NewDoc" toolbar:visible="false" toolbar:helpid="5500"/> <toolbar:toolbaritem xlink:href=".uno:Open"/> <toolbar:toolbaritem xlink:href=".uno:Save" toolbar:helpid="5505"/> - <toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:helpid="5502"/> + <toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:helpid="5502" toolbar:visible="false"/> <toolbar:toolbaritem xlink:href=".uno:SendMail" toolbar:visible="false" toolbar:helpid="5331"/> <toolbar:toolbarseparator/> <toolbar:toolbaritem xlink:href=".uno:EditDoc" toolbar:helpid="6312" toolbar:visible="false"/> |