summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2015-12-22 13:12:23 +0200
committerAdolfo Jayme Barrientos <fitojb@ubuntu.com>2016-01-12 12:46:31 -0600
commit677197b3459df2c89be32595e0cb1b8b3e144c69 (patch)
tree370561ff6bb70aa54052d1cf95081792f894de19 /dbaccess
parentfeebc5953fb416c5dc8cdf8c7e924a9ff9c70f17 (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>
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/core/dataaccess/intercept.cxx54
-rw-r--r--dbaccess/source/core/dataaccess/intercept.hxx8
-rw-r--r--dbaccess/source/ui/app/AppController.cxx3
-rw-r--r--dbaccess/source/ui/app/AppController.hxx2
-rw-r--r--dbaccess/source/ui/querydesign/querycontroller.cxx2
-rw-r--r--dbaccess/source/ui/tabledesign/TableController.cxx10
6 files changed, 7 insertions, 72 deletions
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;