summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@sun.com>2009-10-30 12:03:32 +0100
committerFrank Schoenheit [fs] <frank.schoenheit@sun.com>2009-10-30 12:03:32 +0100
commit346d0a2a7644c54da29338df9102cbbc027aa20a (patch)
tree05b19ee83a65c170dda9b54b697a3cf3146cadff /svx
parent29275473927ad7944c34c22394ccd4ffea79ed36 (diff)
removed the ConfirmDeleteDialog - its functionality is nowadays available via the usual sdb.InteractionHandler
Diffstat (limited to 'svx')
-rw-r--r--svx/source/form/confirmdelete.cxx135
-rw-r--r--svx/source/form/fmstring.src2
-rw-r--r--svx/source/form/formcontroller.cxx57
-rw-r--r--svx/source/form/makefile.mk1
-rw-r--r--svx/source/inc/confirmdelete.hxx59
5 files changed, 45 insertions, 209 deletions
diff --git a/svx/source/form/confirmdelete.cxx b/svx/source/form/confirmdelete.cxx
deleted file mode 100644
index 9bb4ab7ede49..000000000000
--- a/svx/source/form/confirmdelete.cxx
+++ /dev/null
@@ -1,135 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svx.hxx"
-#include "confirmdelete.hxx"
-#include <svx/dialmgr.hxx>
-#ifndef _SVX_FMHELP_HRC
-#include "fmhelp.hrc"
-#endif
-#ifndef _SVX_FMRESIDS_HRC
-#include "fmresids.hrc"
-#endif
-#include <unotools/configmgr.hxx>
-#include <vcl/msgbox.hxx>
-
-//........................................................................
-namespace svxform
-{
-//........................................................................
-
-#define BORDER_HEIGHT 6 // default distance control-dialog
-#define BORDER_WIDTH 6 // default distance control-dialog
-
- using namespace ::com::sun::star::uno;
-
- //====================================================================
- //= class ConfirmDeleteDialog
- //====================================================================
- //------------------------------------------------------------------------------
- ConfirmDeleteDialog::ConfirmDeleteDialog(Window* pParent, const String& _rTitle)
- :ButtonDialog(pParent, WB_HORZ | WB_STDDIALOG)
- ,m_aInfoImage (this)
- ,m_aTitle (this, WB_WORDBREAK | WB_LEFT)
- ,m_aMessage (this, WB_WORDBREAK | WB_LEFT)
- {
- String sMessage(SVX_RES(RID_STR_DELETECONFIRM));
-
- // Changed as per BugID 79541 Branding/Configuration
- Any aProductName = ::utl::ConfigManager::GetDirectConfigProperty(::utl::ConfigManager::PRODUCTNAME);
- ::rtl::OUString sProductName;
- aProductName >>= sProductName;
-
- String aTitle = sProductName;
- aProductName = ::utl::ConfigManager::GetDirectConfigProperty(::utl::ConfigManager::PRODUCTVERSION);
- aProductName >>= sProductName;
- aTitle.AppendAscii(" ");
- aTitle += String(sProductName);
- SetText(aTitle);
-
- SetHelpId(HID_DLG_DBMSG);
- SetSizePixel(LogicToPixel(Size(220, 30),MAP_APPFONT));
-
- m_aInfoImage.SetPosSizePixel(LogicToPixel(Point(6, 6),MAP_APPFONT),
- LogicToPixel(Size(20, 20),MAP_APPFONT));
- m_aInfoImage.Show();
-
- m_aTitle.SetPosSizePixel(LogicToPixel(Point(45, 6),MAP_APPFONT),
- LogicToPixel(Size(169, 20),MAP_APPFONT));
-
- Font aFont = m_aTitle.GetFont();
- aFont.SetWeight(WEIGHT_SEMIBOLD);
- m_aTitle.SetFont(aFont);
- m_aTitle.Show();
-
- m_aMessage.SetPosSizePixel(LogicToPixel(Point(45, 29),MAP_APPFONT),
- LogicToPixel(Size(169, 1),MAP_APPFONT));
- m_aMessage.Show();
-
- // Image festlegen
- m_aInfoImage.SetImage(WarningBox::GetStandardImage());
-
- // Title setzen
- m_aTitle.SetText(_rTitle);
-
- // Ermitteln der Hoehe des Textfeldes und des Dialogs
- Size aBorderSize = LogicToPixel(Size(BORDER_WIDTH, BORDER_HEIGHT),MAP_APPFONT);
- Rectangle aDlgRect(GetPosPixel(),GetSizePixel());
- Rectangle aMessageRect(m_aMessage.GetPosPixel(),m_aMessage.GetSizePixel());
- Rectangle aTextRect =
- GetTextRect(aMessageRect, sMessage, TEXT_DRAW_WORDBREAK | TEXT_DRAW_MULTILINE | TEXT_DRAW_LEFT);
-
- long nHText = aTextRect.Bottom() > aMessageRect.Bottom() ? aTextRect.Bottom() - aMessageRect.Bottom() : 0;
-
- aDlgRect.Bottom() += nHText + 2 * aBorderSize.Height();
- aMessageRect.Bottom() += nHText;
-
- // Dialog anpassen
- SetSizePixel(aDlgRect.GetSize());
- SetPageSizePixel(aDlgRect.GetSize());
-
- // Message Text anpassen und setzen
- m_aMessage.SetSizePixel(aMessageRect.GetSize());
- m_aMessage.SetText(sMessage);
-
- // Buttons anlegen
- AddButton(BUTTON_YES, BUTTONID_YES, 0);
- AddButton(BUTTON_NO, BUTTONID_NO, BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON);
- }
-
- //------------------------------------------------------------------------------
- ConfirmDeleteDialog::~ConfirmDeleteDialog()
- {
- }
-
-//........................................................................
-} // namespace svxform
-//........................................................................
-
-
-
diff --git a/svx/source/form/fmstring.src b/svx/source/form/fmstring.src
index 8b42ccadc6a6..da9b47de43cf 100644
--- a/svx/source/form/fmstring.src
+++ b/svx/source/form/fmstring.src
@@ -130,7 +130,7 @@ String RID_STR_DELETECONFIRM_RECORDS
};
String RID_STR_DELETECONFIRM
{
- Text [ en-US ] = "If you click Yes, you won't be able to undo this operation!\nDo you want to continue anyway?";
+ Text [ en-US ] = "If you click Yes, you won't be able to undo this operation.\nDo you want to continue anyway?";
};
String RID_ERR_NO_ELEMENT
diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx
index bc50ee0de517..ed3e37c3812b 100644
--- a/svx/source/form/formcontroller.cxx
+++ b/svx/source/form/formcontroller.cxx
@@ -28,7 +28,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
-#include "confirmdelete.hxx"
#include "fmcontrolbordermanager.hxx"
#include "fmcontrollayout.hxx"
#include "formcontroller.hxx"
@@ -202,6 +201,7 @@ namespace svxform
using ::com::sun::star::task::XInteractionHandler;
using ::com::sun::star::form::runtime::FormOperations;
using ::com::sun::star::container::XContainer;
+ using ::com::sun::star::sdbc::SQLWarning;
/** === end UNO using === **/
namespace ColumnValue = ::com::sun::star::sdbc::ColumnValue;
namespace PropertyAttribute = ::com::sun::star::beans::PropertyAttribute;
@@ -4033,22 +4033,53 @@ sal_Bool SAL_CALL FormController::confirmDelete(const RowChangeEvent& aEvent) th
aEvt.Source = *this;
return ((XConfirmDeleteListener*)aIter.next())->confirmDelete(aEvt);
}
+ // default handling: instantiate an interaction handler and let it handle the request
+
+ String sTitle;
+ sal_Int32 nLength = aEvent.Rows;
+ if ( nLength > 1 )
+ {
+ sTitle = SVX_RES( RID_STR_DELETECONFIRM_RECORDS );
+ sTitle.SearchAndReplace( '#', String::CreateFromInt32( nLength ) );
+ }
else
+ sTitle = SVX_RES( RID_STR_DELETECONFIRM_RECORD );
+
+ try
{
- // default handling
- UniString aTitle;
- sal_Int32 nLength = aEvent.Rows;
- if (nLength > 1)
- {
- aTitle = SVX_RES(RID_STR_DELETECONFIRM_RECORDS);
- aTitle.SearchAndReplace('#', String::CreateFromInt32(nLength));
- }
- else
- aTitle = SVX_RES(RID_STR_DELETECONFIRM_RECORD);
+ if ( !ensureInteractionHandler() )
+ return sal_False;
+
+ // two continuations allowed: Yes and No
+ OInteractionApprove* pApprove = new OInteractionApprove;
+ OInteractionDisapprove* pDisapprove = new OInteractionDisapprove;
+
+ // the request
+ SQLWarning aWarning;
+ aWarning.Message = sTitle;
+ SQLWarning aDetails;
+ aDetails.Message = String( SVX_RES( RID_STR_DELETECONFIRM ) );
+ aWarning.NextException <<= aDetails;
- ConfirmDeleteDialog aDlg(getDialogParentWindow(), aTitle);
- return RET_YES == aDlg.Execute();
+ OInteractionRequest* pRequest = new OInteractionRequest( makeAny( aWarning ) );
+ Reference< XInteractionRequest > xRequest( pRequest );
+
+ // some knittings
+ pRequest->addContinuation( pApprove );
+ pRequest->addContinuation( pDisapprove );
+
+ // handle the request
+ m_xInteractionHandler->handle( xRequest );
+
+ if ( pApprove->wasSelected() )
+ return sal_True;
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
}
+
+ return sal_False;
}
//------------------------------------------------------------------------------
diff --git a/svx/source/form/makefile.mk b/svx/source/form/makefile.mk
index 3c86a36c2685..71002531544c 100644
--- a/svx/source/form/makefile.mk
+++ b/svx/source/form/makefile.mk
@@ -65,7 +65,6 @@ LIB1OBJFILES= \
$(SLO)$/fmtextcontrolshell.obj \
$(SLO)$/ParseContext.obj \
$(SLO)$/typeconversionclient.obj \
- $(SLO)$/confirmdelete.obj \
$(SLO)$/dbtoolsclient.obj \
$(SLO)$/sqlparserclient.obj \
$(SLO)$/dataaccessdescriptor.obj \
diff --git a/svx/source/inc/confirmdelete.hxx b/svx/source/inc/confirmdelete.hxx
deleted file mode 100644
index 049f60e08f02..000000000000
--- a/svx/source/inc/confirmdelete.hxx
+++ /dev/null
@@ -1,59 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef SVX_FORM_CONFIRMDELETE_HXX
-#define SVX_FORM_CONFIRMDELETE_HXX
-
-#include <vcl/btndlg.hxx>
-#include <vcl/fixed.hxx>
-
-//........................................................................
-namespace svxform
-{
-//........................................................................
-
- //====================================================================
- //= class ConfirmDeleteDialog
- //====================================================================
- class ConfirmDeleteDialog : public ButtonDialog
- {
- FixedImage m_aInfoImage;
- FixedText m_aTitle;
- FixedText m_aMessage;
-
- public:
- ConfirmDeleteDialog(Window* pParent, const String& _rTitle);
- ~ConfirmDeleteDialog();
- };
-
-//........................................................................
-} // namespace svxform
-//........................................................................
-
-#endif // SVX_FORM_CONFIRMDELETE_HXX
-
-