summaryrefslogtreecommitdiff
path: root/uui
diff options
context:
space:
mode:
Diffstat (limited to 'uui')
-rw-r--r--uui/prj/build.lst4
-rw-r--r--uui/prj/d.lst9
-rw-r--r--uui/source/alreadyopen.cxx62
-rw-r--r--uui/source/alreadyopen.hxx42
-rw-r--r--uui/source/alreadyopen.src62
-rw-r--r--uui/source/cookiedg.cxx142
-rw-r--r--uui/source/cookiedg.hrc45
-rw-r--r--uui/source/cookiedg.hxx65
-rw-r--r--uui/source/cookiedg.src166
-rw-r--r--uui/source/filechanged.cxx51
-rw-r--r--uui/source/filechanged.hxx42
-rw-r--r--uui/source/filechanged.src46
-rw-r--r--uui/source/fltdlg.cxx248
-rw-r--r--uui/source/fltdlg.hrc38
-rw-r--r--uui/source/fltdlg.hxx97
-rw-r--r--uui/source/fltdlg.src119
-rw-r--r--uui/source/getcontinuations.hxx121
-rw-r--r--uui/source/iahndl-authentication.cxx754
-rw-r--r--uui/source/iahndl-cookies.cxx211
-rw-r--r--uui/source/iahndl-errorhandler.cxx321
-rw-r--r--uui/source/iahndl-filter.cxx473
-rw-r--r--uui/source/iahndl-ioexceptions.cxx346
-rw-r--r--uui/source/iahndl-locking.cxx318
-rw-r--r--uui/source/iahndl-ssl.cxx359
-rw-r--r--uui/source/iahndl.cxx1507
-rw-r--r--uui/source/iahndl.hxx370
-rwxr-xr-xuui/source/ids.hrc197
-rw-r--r--uui/source/ids.src434
-rw-r--r--uui/source/interactionhandler.cxx147
-rw-r--r--uui/source/interactionhandler.hxx104
-rw-r--r--uui/source/lockfailed.cxx52
-rw-r--r--uui/source/lockfailed.hxx44
-rw-r--r--uui/source/lockfailed.src46
-rw-r--r--uui/source/logindlg.cxx349
-rwxr-xr-xuui/source/logindlg.hrc59
-rw-r--r--uui/source/logindlg.hxx116
-rwxr-xr-xuui/source/logindlg.src197
-rw-r--r--uui/source/loginerr.hxx180
-rw-r--r--uui/source/makefile.mk87
-rw-r--r--uui/source/masterpasscrtdlg.cxx189
-rw-r--r--uui/source/masterpasscrtdlg.hrc72
-rw-r--r--uui/source/masterpasscrtdlg.hxx79
-rw-r--r--uui/source/masterpasscrtdlg.src133
-rw-r--r--uui/source/masterpassworddlg.cxx78
-rw-r--r--uui/source/masterpassworddlg.hrc42
-rw-r--r--uui/source/masterpassworddlg.hxx64
-rw-r--r--uui/source/masterpassworddlg.src102
-rw-r--r--uui/source/mphndl.hxx98
-rw-r--r--uui/source/newerverwarn.cxx203
-rw-r--r--uui/source/newerverwarn.hrc57
-rw-r--r--uui/source/newerverwarn.hxx63
-rw-r--r--uui/source/newerverwarn.src81
-rw-r--r--uui/source/openlocked.cxx54
-rw-r--r--uui/source/openlocked.hxx42
-rw-r--r--uui/source/openlocked.src54
-rw-r--r--uui/source/passcrtdlg.cxx128
-rw-r--r--uui/source/passcrtdlg.hrc43
-rw-r--r--uui/source/passcrtdlg.hxx66
-rw-r--r--uui/source/passcrtdlg.src108
-rw-r--r--uui/source/passwordcontainer.cxx484
-rw-r--r--uui/source/passwordcontainer.hxx200
-rw-r--r--uui/source/passworddlg.cxx117
-rw-r--r--uui/source/passworddlg.hrc40
-rw-r--r--uui/source/passworddlg.hxx65
-rwxr-xr-xuui/source/passworddlg.src98
-rwxr-xr-xuui/source/passworderrs.src74
-rw-r--r--uui/source/requeststringresolver.cxx121
-rw-r--r--uui/source/requeststringresolver.hxx93
-rw-r--r--uui/source/secmacrowarnings.cxx381
-rw-r--r--uui/source/secmacrowarnings.hrc88
-rw-r--r--uui/source/secmacrowarnings.hxx105
-rw-r--r--uui/source/secmacrowarnings.src118
-rw-r--r--uui/source/services.cxx213
-rw-r--r--uui/source/sslwarndlg.cxx89
-rw-r--r--uui/source/sslwarndlg.hrc60
-rw-r--r--uui/source/sslwarndlg.hxx85
-rw-r--r--uui/source/sslwarndlg.src106
-rw-r--r--uui/source/trylater.cxx53
-rw-r--r--uui/source/trylater.hxx42
-rw-r--r--uui/source/trylater.src50
-rw-r--r--uui/source/unknownauthdlg.cxx99
-rw-r--r--uui/source/unknownauthdlg.hrc64
-rw-r--r--uui/source/unknownauthdlg.hxx88
-rw-r--r--uui/source/unknownauthdlg.src135
-rw-r--r--uui/util/makefile.mk64
-rw-r--r--uui/util/uui.xml76
86 files changed, 12994 insertions, 0 deletions
diff --git a/uui/prj/build.lst b/uui/prj/build.lst
new file mode 100644
index 000000000000..dbe31cb1b57e
--- /dev/null
+++ b/uui/prj/build.lst
@@ -0,0 +1,4 @@
+uu uui : l10n vcl svtools NULL
+uu uui usr1 - all uu_mkout NULL
+uu uui\source nmake - all uu_source NULL
+uu uui\util nmake - all uu_util uu_source NULL
diff --git a/uui/prj/d.lst b/uui/prj/d.lst
new file mode 100644
index 000000000000..30c6f812fd5b
--- /dev/null
+++ b/uui/prj/d.lst
@@ -0,0 +1,9 @@
+mkdir: %COMMON_DEST%\bin%_EXT%\hid
+
+..\%COMMON_OUTDIR%\misc\*.hid %COMMON_DEST%\bin%_EXT%\hid\*.hid
+..\%__SRC%\bin\uui*.dll %_DEST%\bin%_EXT%\uui*.dll
+..\%__SRC%\bin\uui*.res %_DEST%\bin%_EXT%\uui*.res
+..\%__SRC%\lib\libuui*.* %_DEST%\lib%_EXT%\libuui*.*
+..\%__SRC%\lib\iuui.lib %_DEST%\lib%_EXT%\iuui.lib
+
+..\util\uui.xml %_DEST%\xml%_EXT%\uui.xml
diff --git a/uui/source/alreadyopen.cxx b/uui/source/alreadyopen.cxx
new file mode 100644
index 000000000000..3c5cba966ffe
--- /dev/null
+++ b/uui/source/alreadyopen.cxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "ids.hrc"
+#include "alreadyopen.hxx"
+
+AlreadyOpenQueryBox::AlreadyOpenQueryBox( Window* pParent, ResMgr* pResMgr, const String& aMessage, sal_Bool bIsStoring ) :
+ MessBox(pParent, 0,
+ String( ResId( STR_ALREADYOPEN_TITLE, *pResMgr ) ),
+ aMessage )
+{
+ SetImage( QueryBox::GetStandardImage() );
+
+ if ( bIsStoring )
+ {
+ AddButton( String( ResId( STR_ALREADYOPEN_RETRY_SAVE_BTN, *pResMgr ) ), RET_YES,
+ BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_OKBUTTON | BUTTONDIALOG_FOCUSBUTTON );
+ AddButton( String( ResId( STR_ALREADYOPEN_SAVE_BTN, *pResMgr ) ), RET_NO, 0 );
+ AddButton( BUTTON_CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON );
+ }
+ else
+ {
+ AddButton( String( ResId( STR_ALREADYOPEN_READONLY_BTN, *pResMgr ) ), RET_YES,
+ BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_OKBUTTON | BUTTONDIALOG_FOCUSBUTTON );
+ AddButton( String( ResId( STR_ALREADYOPEN_OPEN_BTN, *pResMgr ) ), RET_NO, 0 );
+ AddButton( BUTTON_CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON );
+ }
+
+ SetButtonHelpText( RET_YES, String::EmptyString() );
+ SetButtonHelpText( RET_NO, String::EmptyString() );
+}
+
+AlreadyOpenQueryBox::~AlreadyOpenQueryBox()
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/alreadyopen.hxx b/uui/source/alreadyopen.hxx
new file mode 100644
index 000000000000..fc1f74d98962
--- /dev/null
+++ b/uui/source/alreadyopen.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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 _UUI_ALREADYOPEN_HXX
+#define _UUI_ALREADYOPEN_HXX
+
+#include <vcl/msgbox.hxx>
+
+class AlreadyOpenQueryBox : public MessBox
+{
+public:
+ AlreadyOpenQueryBox( Window* pParent, ResMgr* pResMgr, const String& aMessage, sal_Bool bIsStoring );
+ ~AlreadyOpenQueryBox();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/alreadyopen.src b/uui/source/alreadyopen.src
new file mode 100644
index 000000000000..7541396d54d9
--- /dev/null
+++ b/uui/source/alreadyopen.src
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#define __RSC
+
+#ifndef UUI_IDS_HRC
+#include <ids.hrc>
+#endif
+
+String STR_ALREADYOPEN_TITLE
+{
+ Text = "Document in Use";
+};
+String STR_ALREADYOPEN_MSG
+{
+ Text [ en-US ] = "Document file '$(ARG1)' is locked for editing by yourself on a different system since $(ARG2)\n\nOpen document read-only, or ignore own file locking and open the document for editing.\n\n";
+};
+String STR_ALREADYOPEN_READONLY_BTN
+{
+ Text [ en-US ] = "Open ~Read-Only";
+};
+String STR_ALREADYOPEN_OPEN_BTN
+{
+ Text [ en-US ] = "~Open";
+};
+String STR_ALREADYOPEN_SAVE_MSG
+{
+ Text [ en-US ] = "Document file '$(ARG1)' is locked for editing by yourself on a different system since $(ARG2)\n\nClose document on other system and retry saving or ignore own file locking and save current document.\n\n";
+};
+String STR_ALREADYOPEN_RETRY_SAVE_BTN
+{
+ Text [ en-US ] = "~Retry Saving";
+};
+String STR_ALREADYOPEN_SAVE_BTN
+{
+ Text [ en-US ] = "~Save";
+};
+
diff --git a/uui/source/cookiedg.cxx b/uui/source/cookiedg.cxx
new file mode 100644
index 000000000000..3f987477a52b
--- /dev/null
+++ b/uui/source/cookiedg.cxx
@@ -0,0 +1,142 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include <svl/httpcook.hxx>
+#include <tools/urlobj.hxx>
+#include <vcl/msgbox.hxx>
+
+#include <cookiedg.hrc>
+#include <cookiedg.hxx>
+#include <ids.hrc>
+
+// CookiesDialog ---------------------------------------------------------
+
+IMPL_LINK( CookiesDialog, ButtonHdl_Impl, PushButton *, pBtn )
+{
+ short nRet = ( &maSendBtn == pBtn ) ? RET_OK : RET_CANCEL;
+ EndDialog( nRet );
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+CookiesDialog::CookiesDialog( Window* pParent,
+ CntHTTPCookieRequest* pRequest,
+ ResMgr* pResMgr ) :
+
+ ModalDialog( pParent, ResId( DLG_COOKIES, *pResMgr ) ),
+
+ maCookieFB ( this, ResId( FB_COOKIES, *pResMgr ) ),
+ maCookieFT ( this, ResId( FT_COOKIES, *pResMgr ) ),
+ maInFutureLine ( this, ResId( FL_COOKIES, *pResMgr ) ),
+ maInFutureSendBtn ( this, ResId( RB_INFUTURE_SEND, *pResMgr ) ),
+ maInFutureIgnoreBtn ( this, ResId( RB_INFUTURE_IGNORE, *pResMgr ) ),
+ maInFutureInteractiveBtn( this, ResId( RB_INFUTURE_INTERACTIVE, *pResMgr ) ),
+ maInFutureGB ( this, ResId( GB_INFUTURE, *pResMgr ) ),
+ maIgnoreBtn ( this, ResId( BTN_COOKIES_CANCEL, *pResMgr ) ),
+ maSendBtn ( this, ResId( BTN_COOKIES_OK, *pResMgr ) ),
+
+ mpCookieRequest ( pRequest )
+
+{
+ FreeResource();
+
+ Link aLink( LINK( this, CookiesDialog, ButtonHdl_Impl ) );
+ maIgnoreBtn.SetClickHdl( aLink );
+ maSendBtn.SetClickHdl( aLink );
+ const Bitmap& rBitmap = maCookieFB.GetBitmap();
+ Size aSize = rBitmap.GetSizePixel();
+ SetMapMode( MapMode( MAP_APPFONT ) );
+ Size aLogicSize = PixelToLogic( aSize );
+ Point aPoint( 6 ,
+ 6 + ( 145 - aLogicSize.Height() ) / 2 );
+ maCookieFB.SetPosSizePixel( LogicToPixel( aPoint ), aSize );
+ maCookieFB.Show();
+
+ USHORT nOffset = CNTHTTP_COOKIE_REQUEST_RECV == mpCookieRequest->m_eType
+ ? 0 : STR_COOKIES_SEND_START - STR_COOKIES_RECV_START;
+ INetURLObject aObj( mpCookieRequest->m_rURL );
+ SetText( String( ResId( STR_COOKIES_RECV_TITLE + nOffset, *pResMgr ) ) );
+ String aMsg( ResId( STR_COOKIES_RECV_START + nOffset, *pResMgr ) );
+ aMsg.SearchAndReplaceAscii( "${HOST}", aObj.GetHost() );
+ aMsg.SearchAndReplaceAscii( "${PATH}", aObj.GetPath() );
+ String aTemplate( ResId( STR_COOKIES_RECV_COOKIES, *pResMgr ) );
+ List& rList =mpCookieRequest->m_rCookieList;
+ String aPair, aCookie;
+
+ for ( USHORT i = (USHORT)rList.Count(); i--; )
+ {
+ CntHTTPCookie* pCookie = (CntHTTPCookie*)rList.GetObject(i);
+
+ if ( CNTHTTP_COOKIE_POLICY_INTERACTIVE == pCookie->m_nPolicy )
+ {
+ aCookie = aTemplate;
+ aCookie.SearchAndReplaceAscii( "${DOMAIN}", pCookie->m_aDomain );
+ aCookie.SearchAndReplaceAscii( "${PATH}", pCookie->m_aPath );
+ aPair = pCookie->m_aName;
+ aPair += '=';
+ aPair += pCookie->m_aValue;
+ aCookie.SearchAndReplaceAscii( "${COOKIE}", aPair );
+ aMsg += aCookie;
+ }
+ }
+ maInFutureInteractiveBtn.Check( TRUE );
+ maCookieFT.SetText( aMsg );
+}
+
+// -----------------------------------------------------------------------
+
+short CookiesDialog::Execute()
+{
+ maSendBtn.GrabFocus();
+ short nRet = ModalDialog::Execute();
+ USHORT nStatus = CNTHTTP_COOKIE_POLICY_INTERACTIVE;
+
+ if ( maInFutureSendBtn.IsChecked() )
+ nStatus = CNTHTTP_COOKIE_POLICY_ACCEPTED;
+
+ if ( maInFutureIgnoreBtn.IsChecked() )
+ nStatus = CNTHTTP_COOKIE_POLICY_BANNED;
+ List& rList = mpCookieRequest->m_rCookieList;
+
+ for ( USHORT i = (USHORT)rList.Count(); i--; )
+ {
+ USHORT& rStatus = ( (CntHTTPCookie*)rList.GetObject(i) )->m_nPolicy;
+
+ if ( rStatus == CNTHTTP_COOKIE_POLICY_INTERACTIVE )
+ rStatus = nStatus;
+ }
+
+ if ( nRet == RET_OK )
+ mpCookieRequest->m_nRet = CNTHTTP_COOKIE_POLICY_ACCEPTED;
+ else
+ mpCookieRequest->m_nRet = CNTHTTP_COOKIE_POLICY_BANNED;
+
+ return nRet;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/cookiedg.hrc b/uui/source/cookiedg.hrc
new file mode 100644
index 000000000000..b51309d2e5a0
--- /dev/null
+++ b/uui/source/cookiedg.hrc
@@ -0,0 +1,45 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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 UUI_COOKIEDG_HRC
+#define UUI_COOKIEDG_HRC
+
+//============================================================================
+#define FB_COOKIES 10
+#define FT_COOKIES 11
+#define FL_COOKIES 12
+
+#define RB_INFUTURE_SEND 20
+#define RB_INFUTURE_IGNORE 21
+#define RB_INFUTURE_INTERACTIVE 22
+#define GB_INFUTURE 23
+
+#define BTN_COOKIES_CANCEL 30
+#define BTN_COOKIES_OK 31
+
+#endif // UUI_COOKIEDG_HRC
+
diff --git a/uui/source/cookiedg.hxx b/uui/source/cookiedg.hxx
new file mode 100644
index 000000000000..70e797d7a52d
--- /dev/null
+++ b/uui/source/cookiedg.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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 UUI_COOKIEDG_HXX
+#define UUI_COOKIEDG_HXX
+
+#include <vcl/button.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/group.hxx>
+
+struct CntHTTPCookieRequest;
+
+//============================================================================
+class CookiesDialog : public ModalDialog
+{
+ FixedBitmap maCookieFB;
+ FixedText maCookieFT;
+ FixedLine maInFutureLine;
+ RadioButton maInFutureSendBtn;
+ RadioButton maInFutureIgnoreBtn;
+ RadioButton maInFutureInteractiveBtn;
+ GroupBox maInFutureGB;
+ PushButton maIgnoreBtn;
+ PushButton maSendBtn;
+
+ CntHTTPCookieRequest* mpCookieRequest;
+
+ DECL_LINK( ButtonHdl_Impl, PushButton * );
+
+public:
+ CookiesDialog( Window* pParent, CntHTTPCookieRequest* pRequest,
+ ResMgr* pResMgr );
+
+ virtual short Execute();
+};
+
+#endif // UUI_COOKIEDG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/cookiedg.src b/uui/source/cookiedg.src
new file mode 100644
index 000000000000..0737ff3f5ca3
--- /dev/null
+++ b/uui/source/cookiedg.src
@@ -0,0 +1,166 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#define __RSC
+
+#ifndef UUI_COOKIEDG_HRC
+#include <cookiedg.hrc>
+#endif
+#ifndef UUI_IDS_HRC
+#include <ids.hrc>
+#endif
+
+ModalDialog DLG_COOKIES
+{
+ HelpId = HID_DLG_COOKIES ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 295 , 193 ) ;
+ Moveable = TRUE ;
+ FixedBitmap FB_COOKIES
+ {
+ Border = True ;
+ Hide = TRUE ;
+ Fixed = Bitmap
+ {
+ File = "cookie.bmp" ;
+ };
+ };
+ FixedText FT_COOKIES
+ {
+ SVLook = TRUE ;
+ WordBreak = True ;
+ Pos = MAP_APPFONT ( 65 , 6 ) ;
+ Size = MAP_APPFONT ( 224 , 145 ) ;
+ };
+ FixedLine FL_COOKIES
+ {
+ Pos = MAP_APPFONT ( 6 , 155 ) ;
+ Size = MAP_APPFONT ( 283 , 1 ) ;
+ };
+ RadioButton RB_INFUTURE_SEND
+ {
+ Pos = MAP_APPFONT ( 12 , 171 ) ;
+ Size = MAP_APPFONT ( 52 , 10 ) ;
+ Text [ en-US ] = "~Send" ;
+ };
+ RadioButton RB_INFUTURE_IGNORE
+ {
+ Pos = MAP_APPFONT ( 67 , 171 ) ;
+ Size = MAP_APPFONT ( 52 , 10 ) ;
+ Text [ en-US ] = "I~gnore" ;
+ };
+ RadioButton RB_INFUTURE_INTERACTIVE
+ {
+ Pos = MAP_APPFONT ( 122 , 171 ) ;
+ Size = MAP_APPFONT ( 52 , 10 ) ;
+ Text [ en-US ] = "I~nteractive" ;
+ };
+ //TODO! If this dialog is ever used again (and it should definitely be
+ // redesigned then!), get rid of the following group box (see #88883#):
+ GroupBox GB_INFUTURE
+ {
+ Pos = MAP_APPFONT ( 6 , 160 ) ;
+ Size = MAP_APPFONT ( 174 , 27 ) ;
+ Text [ en-US ] = "Future Cookie Handling" ;
+ };
+ PushButton BTN_COOKIES_CANCEL
+ {
+ Pos = MAP_APPFONT ( 186 , 173 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Ignore" ;
+ };
+ PushButton BTN_COOKIES_OK
+ {
+ Pos = MAP_APPFONT ( 239 , 173 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE ;
+ Text [ en-US ] = "~Send" ;
+ };
+};
+
+String STR_COOKIES_RECV_START
+{
+ Text [ en-US ] = "The '${HOST}' server wishes to set one or more cookies.\nCookies contain information referring to certain URL classes. If %PRODUCTNAME later requests a document with a URL corresponding to the class of a previously set cookie, %PRODUCTNAME will send this information to the server. This allows a server to recognize the status of a WWW application, e.g., when shopping online.\n\nThe following Cookies should be set:\n\n" ;
+};
+
+String STR_COOKIES_RECV_COOKIES
+{
+ Text [ en-US ] = "Domain: ${DOMAIN}, Path: ${PATH}, Cookie: ${COOKIE}.\n" ;
+};
+
+String STR_COOKIES_RECV_TITLE
+{
+ Text [ en-US ] = "Cookie Reception" ;
+};
+
+String STR_COOKIES_SEND_START
+{
+ Text [ en-US ] = "%PRODUCTNAME has saved cookies for the server '${HOST}' which will be sent when requesting the document ${PATH}.\nCookies contain information which refers to certain URL classes. They are sent by some servers to %PRODUCTNAME where they are saved when certain documents are accessed. If %PRODUCTNAME loads a document that, according to the URL, corresponds to a class of one of the previously received Cookies, %PRODUCTNAME will send this information to that server. This enables a server to keep track of the status of a WWW application, e.g., when shopping online.\n\nThe following Cookies should be set:\n\n" ;
+};
+
+String STR_COOKIES_SEND_COOKIES
+{
+ Text [ en-US ] = "Domain: ${DOMAIN}, Path: ${PATH}, Cookie: ${COOKIE}.\n" ;
+};
+
+String STR_COOKIES_SEND_TITLE
+{
+ Text [ en-US ] = "Send Cookies" ;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/uui/source/filechanged.cxx b/uui/source/filechanged.cxx
new file mode 100644
index 000000000000..75b568428660
--- /dev/null
+++ b/uui/source/filechanged.cxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "ids.hrc"
+#include "filechanged.hxx"
+
+FileChangedQueryBox::FileChangedQueryBox( Window* pParent, ResMgr* pResMgr ) :
+ MessBox(pParent, 0,
+ String( ResId( STR_FILECHANGED_TITLE, *pResMgr ) ),
+ String::EmptyString() )
+{
+ SetImage( QueryBox::GetStandardImage() );
+
+ AddButton( String( ResId( STR_FILECHANGED_SAVEANYWAY_BTN, *pResMgr ) ), RET_YES,
+ BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_OKBUTTON | BUTTONDIALOG_FOCUSBUTTON );
+ AddButton( BUTTON_CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON );
+
+ SetButtonHelpText( RET_YES, String::EmptyString() );
+ SetMessText( String( ResId( STR_FILECHANGED_MSG, *pResMgr ) ) );
+}
+
+FileChangedQueryBox::~FileChangedQueryBox()
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/filechanged.hxx b/uui/source/filechanged.hxx
new file mode 100644
index 000000000000..54bfde22b1fb
--- /dev/null
+++ b/uui/source/filechanged.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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 _UUI_FILECHANGED_HXX
+#define _UUI_FILECHANGED_HXX
+
+#include <vcl/msgbox.hxx>
+
+class FileChangedQueryBox : public MessBox
+{
+public:
+ FileChangedQueryBox( Window* pParent, ResMgr* pResMgr );
+ ~FileChangedQueryBox();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/filechanged.src b/uui/source/filechanged.src
new file mode 100644
index 000000000000..b566f6344b73
--- /dev/null
+++ b/uui/source/filechanged.src
@@ -0,0 +1,46 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#define __RSC
+
+#ifndef UUI_IDS_HRC
+#include <ids.hrc>
+#endif
+
+String STR_FILECHANGED_TITLE
+{
+ Text = "Document Has Been Changed by Others";
+};
+String STR_FILECHANGED_MSG
+{
+ Text [ en-US ] = "The file has been changed since it was opened for editing in %PRODUCTNAME. Saving your version of the document will overwrite changes made by others.\n\nDo you want to save anyway?\n\n";
+};
+String STR_FILECHANGED_SAVEANYWAY_BTN
+{
+ Text [ en-US ] = "~Save Anyway";
+};
+
diff --git a/uui/source/fltdlg.cxx b/uui/source/fltdlg.cxx
new file mode 100644
index 000000000000..2cff694ef653
--- /dev/null
+++ b/uui/source/fltdlg.cxx
@@ -0,0 +1,248 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+//_________________________________________________________________________________________________________________
+// my own includes
+//_________________________________________________________________________________________________________________
+
+#include "fltdlg.hxx"
+
+#include "ids.hrc"
+
+#include "fltdlg.hrc"
+
+//_________________________________________________________________________________________________________________
+// includes of other projects
+//_________________________________________________________________________________________________________________
+#include <com/sun/star/util/XStringWidth.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <unotools/localfilehelper.hxx>
+#include <tools/list.hxx>
+#include <tools/urlobj.hxx>
+
+#include <vcl/button.hxx>
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+namespace uui
+{
+
+/*-************************************************************************************************************//**
+ @short initialize filter dialog with start values
+ @descr We set some neccessary informations on these instance for later working and create internal structures.
+ After construction user should call "SetFilters()" and "SetURL()" to fill listbox with selectable filter
+ names and set file name of file, which should be used for selected filter.
+
+ @seealso method SetFilters()
+ @seealso method SetURL()
+
+ @param "pParentWindow" , parent window for dialog
+ @param "pResMgr" , ressource manager
+ @return -
+
+ @onerror -
+ @threadsafe no
+*//*-*************************************************************************************************************/
+FilterDialog::FilterDialog( Window* pParentWindow ,
+ ResMgr* pResMgr )
+ : ModalDialog ( pParentWindow, ResId( DLG_FILTER_SELECT, *pResMgr ) )
+ , m_ftURL ( this, ResId( FT_URL, *pResMgr ) )
+ , m_lbFilters ( this, ResId( LB_FILTERS, *pResMgr ) )
+ , m_btnOK ( this, ResId( BTN_OK, *pResMgr ) )
+ , m_btnCancel ( this, ResId( BTN_CANCEL, *pResMgr ) )
+ , m_btnHelp ( this, ResId( BTN_HELP, *pResMgr ) )
+{
+ FreeResource();
+}
+
+/*-************************************************************************************************************//**
+ @short set file name on dialog control
+ @descr We convert given URL (it must be an URL!) into valid file name and show it on our dialog.
+
+ @seealso -
+
+ @param "sURL", URL for showing
+ @return -
+
+ @onerror -
+ @threadsafe no
+*//*-*************************************************************************************************************/
+void FilterDialog::SetURL( const String& sURL )
+{
+ // convert it and use given pure string as fallback if convertion failed
+ m_ftURL.SetText( impl_buildUIFileName(sURL) );
+}
+
+/*-************************************************************************************************************//**
+ @short change list of filter names
+ @descr We save given pointer internal and use it to fill our listbox with given names.
+ Saved list pointer is used on method "AskForFilter()" too, to find user selected item
+ and return pointer into these list as result of operation.
+ So it's possible to call dialog again and again for different or same filter list
+ and ask user for his decision by best performance!
+
+ @attention Don't free memory of given list after this call till object will die ... or
+ you call "ChangeFilters( NULL )"! Then we forget it too.
+
+ @seealso method AskForFilter()
+
+ @param "pFilterNames", pointer to list of filter names, which should be used for later operations.
+ @return -
+
+ @onerror We clear list box and forget our currently set filter informations completly!
+ @threadsafe no
+*//*-*************************************************************************************************************/
+void FilterDialog::ChangeFilters( const FilterNameList* pFilterNames )
+{
+ m_pFilterNames = pFilterNames;
+ m_lbFilters.Clear();
+ if( m_pFilterNames != NULL )
+ {
+ for( FilterNameListPtr pItem = m_pFilterNames->begin();
+ pItem != m_pFilterNames->end() ;
+ ++pItem )
+ {
+ m_lbFilters.InsertEntry( pItem->sUI );
+ }
+ }
+}
+
+/*-************************************************************************************************************//**
+ @short ask user for his decision
+ @descr We show the dialog and if user finish it with "OK" - we try to find selected item in internal saved
+ name list (which you must set in "ChangeFilters()"!). If we return TRUE as result, you can use out
+ parameter "pSelectedItem" as pointer into your FilterNameList to get selected item realy ...
+ but if we return FALSE ... user hsa cancel the dialog ... you shouldnt do that. pSelectedItem isnt
+ set to any valid value then. We don't change them ...
+
+ @seealso method ChangeFilters()
+
+ @param "pSelectedItem", returns result of selection as pointer into set list of filter names
+ (valid for function return TRUE only!)
+ @return true => pSelectedItem parameter points into name list and represent use decision
+ false => use has cancelled dialog (pSelectedItem isnt valid then!)
+
+ @onerror We return false ... but don't change pSelectedItem!
+ @threadsafe no
+*//*-*************************************************************************************************************/
+bool FilterDialog::AskForFilter( FilterNameListPtr& pSelectedItem )
+{
+ bool bSelected = sal_False;
+
+ if( m_pFilterNames != NULL )
+ {
+ if( ModalDialog::Execute() == RET_OK )
+ {
+ String sEntry = m_lbFilters.GetSelectEntry();
+ if( sEntry.Len() > 0 )
+ {
+ int nPos = m_lbFilters.GetSelectEntryPos();
+ if( nPos < (int)(m_pFilterNames->size()) )
+ {
+ pSelectedItem = m_pFilterNames->begin();
+ pSelectedItem += nPos;
+ bSelected = ( pSelectedItem != m_pFilterNames->end() );
+ }
+ }
+ }
+ }
+
+ return bSelected;
+}
+
+/*-************************************************************************************************************//**
+ @short helper class to calculate length of given string
+ @descr Instances of it can be used as callback for INetURLObject::getAbbreviated() method to build
+ short URLs to show it on GUI. We use in ctor set OutputDevice to call special VCL method ...
+
+ @seealso method OutputDevice::GetTextWidth()
+ @seealso method InetURLObject::getAbbreviated()
+
+ @param -
+ @return -
+
+ @onerror -
+ @threadsafe no
+*//*-*************************************************************************************************************/
+class StringCalculator : public ::cppu::WeakImplHelper1< ::com::sun::star::util::XStringWidth >
+{
+ public:
+ StringCalculator( const OutputDevice* pDevice )
+ : m_pDevice( pDevice )
+ {
+ }
+
+ sal_Int32 SAL_CALL queryStringWidth( const ::rtl::OUString& sString ) throw( ::com::sun::star::uno::RuntimeException )
+ {
+ return (sal_Int32)(m_pDevice->GetTextWidth(String(sString)));
+ }
+
+ private:
+ const OutputDevice* m_pDevice;
+};
+
+/*-************************************************************************************************************//**
+ @short try to build short name of given URL to show it n GUI
+ @descr We detect type of given URL automaticly and build this short name depend on this type ...
+ If we couldnt make it right we return full given string without any changes ...
+
+ @seealso class LocalFileHelper
+ @seealso method InetURLObject::getAbbreviated()
+
+ @param "sName", file name
+ @return A short file name ...
+
+ @onerror We return given name without any changes.
+ @threadsafe no
+*//*-*************************************************************************************************************/
+String FilterDialog::impl_buildUIFileName( const String& sName )
+{
+ String sShortName( sName );
+
+ if( ::utl::LocalFileHelper::ConvertURLToSystemPath( sName, sShortName ) == sal_True )
+ {
+ // its a system file ... build short name by using osl functionality
+ }
+ else
+ {
+ // otherwise its realy a url ... build short name by using INetURLObject
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XStringWidth > xStringCalculator( new StringCalculator(&m_ftURL) );
+ if( xStringCalculator.is() == sal_True )
+ {
+ INetURLObject aBuilder ( sName );
+ Size aSize = m_ftURL.GetOutputSize();
+ sShortName = aBuilder.getAbbreviated( xStringCalculator, aSize.Width(), INetURLObject::DECODE_UNAMBIGUOUS );
+ }
+ }
+
+ return sShortName;
+}
+
+} // namespace uui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/fltdlg.hrc b/uui/source/fltdlg.hrc
new file mode 100644
index 000000000000..3fe7f792d2d7
--- /dev/null
+++ b/uui/source/fltdlg.hrc
@@ -0,0 +1,38 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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 UUI_FLTDLG_HRC
+#define UUI_FLTDLG_HRC
+
+#define BTN_OK 20
+#define BTN_CANCEL 21
+#define BTN_HELP 22
+
+#define FT_URL 30
+#define LB_FILTERS 31
+
+#endif /* UUI_FLTDLG_HRC */
diff --git a/uui/source/fltdlg.hxx b/uui/source/fltdlg.hxx
new file mode 100644
index 000000000000..5098512f9bfe
--- /dev/null
+++ b/uui/source/fltdlg.hxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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 UUI_FLTDLG_HXX
+#define UUI_FLTDLG_HXX
+
+//_________________________________________________________________________________________________________________
+// includes
+//_________________________________________________________________________________________________________________
+
+#include <vcl/dialog.hxx>
+
+#include <vcl/msgbox.hxx>
+#include <vcl/lstbox.hxx>
+
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <tools/string.hxx>
+
+#include <vector>
+
+//_________________________________________________________________________________________________________________
+// namespace
+//_________________________________________________________________________________________________________________
+
+namespace uui
+{
+
+//_________________________________________________________________________________________________________________
+// definitions
+//_________________________________________________________________________________________________________________
+
+struct FilterNamePair
+{
+ String sInternal;
+ String sUI ;
+};
+
+typedef ::std::vector< FilterNamePair > FilterNameList ;
+typedef FilterNameList::const_iterator FilterNameListPtr;
+
+class FilterDialog : public ModalDialog
+{
+ // public interface
+ public:
+ FilterDialog ( Window* pParentWindow ,
+ ResMgr* pResMgr );
+ void SetURL ( const String& sURL );
+ void ChangeFilters( const FilterNameList* pFilterNames );
+ bool AskForFilter ( FilterNameListPtr& pSelectedItem );
+
+ // helper (or hided functions!)
+ private:
+ short Execute() { return RET_CANCEL; };
+ String impl_buildUIFileName( const String& sURL );
+
+ // member
+ private:
+ FixedText m_ftURL ;
+ ListBox m_lbFilters ;
+ OKButton m_btnOK ;
+ CancelButton m_btnCancel ;
+ HelpButton m_btnHelp ;
+ const FilterNameList* m_pFilterNames;
+
+}; // class FilterDialog
+
+} // namespace uui
+
+#endif // UUI_FLTDLG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/fltdlg.src b/uui/source/fltdlg.src
new file mode 100644
index 000000000000..82b230e38fd5
--- /dev/null
+++ b/uui/source/fltdlg.src
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#define __RSC
+
+#ifndef UUI_IDS_HRC
+#include "ids.hrc"
+#endif
+
+#ifndef UUI_FLTDLG_HRC
+#include "fltdlg.hrc"
+#endif
+
+ModalDialog DLG_FILTER_SELECT
+{
+ HelpId = HID_DLG_FILTER_SELECT ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 250 , 200 ) ;
+ Moveable = TRUE ;
+ Text [ en-US ] = "Filter Selection" ;
+
+ FixedText FT_URL
+ {
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 238 , 10 ) ;
+ WordBreak = FALSE ;
+ };
+
+ ListBox LB_FILTERS
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 19 ) ;
+ Size = MAP_APPFONT ( 182 , 175 ) ;
+ TabStop = TRUE ;
+ Sort = FALSE ;
+ AutoHScroll = TRUE;
+ };
+
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 194 , 19 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 194 , 36 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 194 , 56 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/uui/source/getcontinuations.hxx b/uui/source/getcontinuations.hxx
new file mode 100644
index 000000000000..019749895d64
--- /dev/null
+++ b/uui/source/getcontinuations.hxx
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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 INCLUDED_UUI_GETCONTINUATIONS_HXX
+#define INCLUDED_UUI_GETCONTINUATIONS_HXX
+
+#include "com/sun/star/uno/Reference.hxx"
+#include "com/sun/star/uno/Sequence.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace task {
+ class XInteractionContinuation;
+ }
+} } }
+
+template< class t1 >
+bool setContinuation(
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionContinuation > const & rContinuation,
+ com::sun::star::uno::Reference< t1 > * pContinuation)
+{
+ if (pContinuation && !pContinuation->is())
+ {
+ pContinuation->set(rContinuation, com::sun::star::uno::UNO_QUERY);
+ if (pContinuation->is())
+ return true;
+ }
+ return false;
+}
+
+template< class t1, class t2 >
+void getContinuations(
+ com::sun::star::uno::Sequence<
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionContinuation > > const &
+ rContinuations,
+ com::sun::star::uno::Reference< t1 > * pContinuation1,
+ com::sun::star::uno::Reference< t2 > * pContinuation2)
+{
+ for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i)
+ {
+ if (setContinuation(rContinuations[i], pContinuation1))
+ continue;
+ if (setContinuation(rContinuations[i], pContinuation2))
+ continue;
+ }
+}
+
+template< class t1, class t2, class t3 >
+void getContinuations(
+ com::sun::star::uno::Sequence<
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionContinuation > > const &
+ rContinuations,
+ com::sun::star::uno::Reference< t1 > * pContinuation1,
+ com::sun::star::uno::Reference< t2 > * pContinuation2,
+ com::sun::star::uno::Reference< t3 > * pContinuation3)
+{
+ for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i)
+ {
+ if (setContinuation(rContinuations[i], pContinuation1))
+ continue;
+ if (setContinuation(rContinuations[i], pContinuation2))
+ continue;
+ if (setContinuation(rContinuations[i], pContinuation3))
+ continue;
+ }
+}
+
+template< class t1, class t2, class t3, class t4 >
+void getContinuations(
+ com::sun::star::uno::Sequence<
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionContinuation > > const &
+ rContinuations,
+ com::sun::star::uno::Reference< t1 > * pContinuation1,
+ com::sun::star::uno::Reference< t2 > * pContinuation2,
+ com::sun::star::uno::Reference< t3 > * pContinuation3,
+ com::sun::star::uno::Reference< t4 > * pContinuation4)
+{
+ for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i)
+ {
+ if (setContinuation(rContinuations[i], pContinuation1))
+ continue;
+ if (setContinuation(rContinuations[i], pContinuation2))
+ continue;
+ if (setContinuation(rContinuations[i], pContinuation3))
+ continue;
+ if (setContinuation(rContinuations[i], pContinuation4))
+ continue;
+ }
+}
+
+#endif /* INCLUDED_UUI_GETCONTINUATIONS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/iahndl-authentication.cxx b/uui/source/iahndl-authentication.cxx
new file mode 100644
index 000000000000..4fa3ef3c02b7
--- /dev/null
+++ b/uui/source/iahndl-authentication.cxx
@@ -0,0 +1,754 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "com/sun/star/task/DocumentPasswordRequest.hpp"
+#include "com/sun/star/task/DocumentPasswordRequest2.hpp"
+#include "com/sun/star/task/DocumentMSPasswordRequest.hpp"
+#include "com/sun/star/task/DocumentMSPasswordRequest2.hpp"
+#include "com/sun/star/task/MasterPasswordRequest.hpp"
+#include "com/sun/star/task/XInteractionAbort.hpp"
+#include "com/sun/star/task/XInteractionPassword.hpp"
+#include "com/sun/star/task/XInteractionPassword2.hpp"
+#include "com/sun/star/task/XInteractionRetry.hpp"
+#include "com/sun/star/ucb/XInteractionSupplyAuthentication2.hpp"
+#include "com/sun/star/ucb/URLAuthenticationRequest.hpp"
+
+#include "osl/diagnose.h"
+#include "rtl/digest.h"
+#include "osl/mutex.hxx"
+#include "tools/errcode.hxx"
+#include "vcl/msgbox.hxx"
+#include "vcl/abstdlg.hxx"
+#include "vcl/svapp.hxx"
+
+#include "ids.hrc"
+#include "getcontinuations.hxx"
+#include "passwordcontainer.hxx"
+#include "loginerr.hxx"
+#include "logindlg.hxx"
+#include "masterpasscrtdlg.hxx"
+#include "masterpassworddlg.hxx"
+#include "passcrtdlg.hxx"
+#include "passworddlg.hxx"
+
+#include "iahndl.hxx"
+
+using namespace com::sun::star;
+
+namespace {
+
+void
+executeLoginDialog(
+ Window * pParent,
+ LoginErrorInfo & rInfo,
+ rtl::OUString const & rRealm)
+ SAL_THROW((uno::RuntimeException))
+{
+ try
+ {
+ SolarMutexGuard aGuard;
+
+ bool bAccount = (rInfo.GetFlags() & LOGINERROR_FLAG_MODIFY_ACCOUNT) != 0;
+ bool bSavePassword = rInfo.GetCanRememberPassword();
+ bool bCanUseSysCreds = rInfo.GetCanUseSystemCredentials();
+
+ sal_uInt16 nFlags = 0;
+ if (rInfo.GetPath().Len() == 0)
+ nFlags |= LF_NO_PATH;
+ if (rInfo.GetErrorText().Len() == 0)
+ nFlags |= LF_NO_ERRORTEXT;
+ if (!bAccount)
+ nFlags |= LF_NO_ACCOUNT;
+ if (!(rInfo.GetFlags() & LOGINERROR_FLAG_MODIFY_USER_NAME))
+ nFlags |= LF_USERNAME_READONLY;
+
+ if (!bSavePassword)
+ nFlags |= LF_NO_SAVEPASSWORD;
+
+ if (!bCanUseSysCreds)
+ nFlags |= LF_NO_USESYSCREDS;
+
+ std::auto_ptr< ResMgr > xManager( ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
+ UniString aRealm(rRealm);
+ std::auto_ptr< LoginDialog > xDialog(
+ new LoginDialog( pParent, nFlags, rInfo.GetServer(), &aRealm, xManager.get()));
+ if (rInfo.GetErrorText().Len() != 0)
+ xDialog->SetErrorText(rInfo.GetErrorText());
+ xDialog->SetName(rInfo.GetUserName());
+ if (bAccount)
+ xDialog->ClearAccount();
+ else
+ xDialog->ClearPassword();
+ xDialog->SetPassword(rInfo.GetPassword());
+
+ if (bSavePassword)
+ {
+ xDialog->SetSavePasswordText(
+ ResId(rInfo.GetIsRememberPersistent()
+ ? RID_SAVE_PASSWORD
+ : RID_KEEP_PASSWORD,
+ *xManager.get()));
+
+ xDialog->SetSavePassword(rInfo.GetIsRememberPassword());
+ }
+
+ if ( bCanUseSysCreds )
+ xDialog->SetUseSystemCredentials( rInfo.GetIsUseSystemCredentials() );
+
+ rInfo.SetResult(xDialog->Execute() == RET_OK ? ERRCODE_BUTTON_OK :
+ ERRCODE_BUTTON_CANCEL);
+ rInfo.SetUserName(xDialog->GetName());
+ rInfo.SetPassword(xDialog->GetPassword());
+ rInfo.SetAccount(xDialog->GetAccount());
+ rInfo.SetIsRememberPassword(xDialog->IsSavePassword());
+
+ if ( bCanUseSysCreds )
+ rInfo.SetIsUseSystemCredentials( xDialog->IsUseSystemCredentials() );
+ }
+ catch (std::bad_alloc const &)
+ {
+ throw uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
+ uno::Reference< uno::XInterface >());
+ }
+}
+
+void getRememberModes(
+ uno::Sequence< ucb::RememberAuthentication > const & rRememberModes,
+ ucb::RememberAuthentication & rPreferredMode,
+ ucb::RememberAuthentication & rAlternateMode )
+{
+ sal_Int32 nCount = rRememberModes.getLength();
+ OSL_ENSURE( (nCount > 0) && (nCount < 4),
+ "ucb::RememberAuthentication sequence size mismatch!" );
+ if ( nCount == 1 )
+ {
+ rPreferredMode = rAlternateMode = rRememberModes[ 0 ];
+ return;
+ }
+ else
+ {
+ //bool bHasRememberModeNo = false;
+ bool bHasRememberModeSession = false;
+ bool bHasRememberModePersistent = false;
+
+ for (sal_Int32 i = 0; i < nCount; ++i)
+ {
+ switch ( rRememberModes[i] )
+ {
+ case ucb::RememberAuthentication_NO:
+ //bHasRememberModeNo = true;
+ break;
+ case ucb::RememberAuthentication_SESSION:
+ bHasRememberModeSession = true;
+ break;
+ case ucb::RememberAuthentication_PERSISTENT:
+ bHasRememberModePersistent = true;
+ break;
+ default:
+ OSL_TRACE( "Unsupported RememberAuthentication value" );
+ break;
+ }
+ }
+
+ if (bHasRememberModePersistent)
+ {
+ rPreferredMode = ucb::RememberAuthentication_PERSISTENT;
+ if (bHasRememberModeSession)
+ rAlternateMode = ucb::RememberAuthentication_SESSION;
+ else
+ rAlternateMode = ucb::RememberAuthentication_NO;
+ }
+ else
+ {
+ rPreferredMode = ucb::RememberAuthentication_SESSION;
+ rAlternateMode = ucb::RememberAuthentication_NO;
+ }
+ }
+}
+
+void
+handleAuthenticationRequest_(
+ Window * pParent,
+ uno::Reference< task::XInteractionHandler > const & xIH,
+ uno::Reference< lang::XMultiServiceFactory > const & xServiceFactory,
+ ucb::AuthenticationRequest const & rRequest,
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
+ rContinuations,
+ const rtl::OUString & rURL)
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Reference< task::XInteractionRetry > xRetry;
+ uno::Reference< task::XInteractionAbort > xAbort;
+ uno::Reference< ucb::XInteractionSupplyAuthentication >
+ xSupplyAuthentication;
+ uno::Reference< ucb::XInteractionSupplyAuthentication2 >
+ xSupplyAuthentication2;
+ getContinuations(rContinuations, &xRetry, &xAbort, &xSupplyAuthentication);
+ if (xSupplyAuthentication.is())
+ xSupplyAuthentication2.set(xSupplyAuthentication, uno::UNO_QUERY);
+
+ //////////////////////////
+ // First, try to obtain credentials from password container service.
+ uui::PasswordContainerHelper aPwContainerHelper(xServiceFactory);
+ if (aPwContainerHelper.handleAuthenticationRequest(rRequest,
+ xSupplyAuthentication,
+ rURL,
+ xIH))
+ {
+ xSupplyAuthentication->select();
+ return;
+ }
+
+ //////////////////////////
+ // Second, try to obtain credentials from user via password dialog.
+ ucb::RememberAuthentication eDefaultRememberMode
+ = ucb::RememberAuthentication_SESSION;
+ ucb::RememberAuthentication ePreferredRememberMode
+ = eDefaultRememberMode;
+ ucb::RememberAuthentication eAlternateRememberMode
+ = ucb::RememberAuthentication_NO;
+
+ if (xSupplyAuthentication.is())
+ {
+ getRememberModes(
+ xSupplyAuthentication->getRememberPasswordModes(
+ eDefaultRememberMode),
+ ePreferredRememberMode,
+ eAlternateRememberMode);
+ }
+
+ sal_Bool bCanUseSystemCredentials;
+ sal_Bool bDefaultUseSystemCredentials;
+ if (xSupplyAuthentication2.is())
+ {
+ bCanUseSystemCredentials
+ = xSupplyAuthentication2->canUseSystemCredentials(
+ bDefaultUseSystemCredentials);
+ }
+ else
+ {
+ bCanUseSystemCredentials = sal_False;
+ bDefaultUseSystemCredentials = sal_False;
+ }
+
+ LoginErrorInfo aInfo;
+ aInfo.SetTitle(rRequest.ServerName);
+ aInfo.SetServer(rRequest.ServerName);
+ if (rRequest.HasAccount)
+ aInfo.SetAccount(rRequest.Account);
+ if (rRequest.HasUserName)
+ aInfo.SetUserName(rRequest.UserName);
+ if (rRequest.HasPassword)
+ aInfo.SetPassword(rRequest.Password);
+ aInfo.SetErrorText(rRequest.Diagnostic);
+
+ aInfo.SetCanRememberPassword(
+ ePreferredRememberMode != eAlternateRememberMode);
+ aInfo.SetIsRememberPassword(
+ ePreferredRememberMode == eDefaultRememberMode);
+ aInfo.SetIsRememberPersistent(
+ ePreferredRememberMode == ucb::RememberAuthentication_PERSISTENT);
+
+ aInfo.SetCanUseSystemCredentials(bCanUseSystemCredentials);
+ aInfo.SetIsUseSystemCredentials( bDefaultUseSystemCredentials );
+ aInfo.SetModifyAccount(rRequest.HasAccount
+ && xSupplyAuthentication.is()
+ && xSupplyAuthentication->canSetAccount());
+ aInfo.SetModifyUserName(rRequest.HasUserName
+ && xSupplyAuthentication.is()
+ && xSupplyAuthentication->canSetUserName());
+ executeLoginDialog(pParent,
+ aInfo,
+ rRequest.HasRealm ? rRequest.Realm : rtl::OUString());
+ switch (aInfo.GetResult())
+ {
+ case ERRCODE_BUTTON_OK:
+ if (xSupplyAuthentication.is())
+ {
+ if (xSupplyAuthentication->canSetUserName())
+ xSupplyAuthentication->setUserName(aInfo.GetUserName());
+ if (xSupplyAuthentication->canSetPassword())
+ xSupplyAuthentication->setPassword(aInfo.GetPassword());
+
+ if (ePreferredRememberMode != eAlternateRememberMode)
+ {
+ // user had te choice.
+ if (aInfo.GetIsRememberPassword())
+ xSupplyAuthentication->setRememberPassword(
+ ePreferredRememberMode);
+ else
+ xSupplyAuthentication->setRememberPassword(
+ eAlternateRememberMode);
+ }
+ else
+ {
+ // user had no choice.
+ xSupplyAuthentication->setRememberPassword(
+ ePreferredRememberMode);
+ }
+
+ if (rRequest.HasRealm)
+ {
+ if (xSupplyAuthentication->canSetRealm())
+ xSupplyAuthentication->setRealm(aInfo.GetAccount());
+ }
+ else if (xSupplyAuthentication->canSetAccount())
+ xSupplyAuthentication->setAccount(aInfo.GetAccount());
+
+ if ( xSupplyAuthentication2.is() && bCanUseSystemCredentials )
+ xSupplyAuthentication2->setUseSystemCredentials(
+ aInfo.GetIsUseSystemCredentials() );
+
+ xSupplyAuthentication->select();
+ }
+
+ //////////////////////////
+ // Third, store credentials in password container.
+
+ if ( aInfo.GetIsUseSystemCredentials() )
+ {
+ if (aInfo.GetIsRememberPassword())
+ {
+ if (!aPwContainerHelper.addRecord(
+ rURL.getLength() ? rURL : rRequest.ServerName,
+ rtl::OUString(), // empty u/p -> sys creds
+ uno::Sequence< rtl::OUString >(),
+ xIH,
+ ePreferredRememberMode
+ == ucb::RememberAuthentication_PERSISTENT))
+ {
+ xSupplyAuthentication->setRememberPassword(
+ ucb::RememberAuthentication_NO);
+ }
+ }
+ else if (eAlternateRememberMode
+ == ucb::RememberAuthentication_SESSION)
+ {
+ if (!aPwContainerHelper.addRecord(
+ rURL.getLength() ? rURL : rRequest.ServerName,
+ rtl::OUString(), // empty u/p -> sys creds
+ uno::Sequence< rtl::OUString >(),
+ xIH,
+ false /* SESSION */))
+ {
+ xSupplyAuthentication->setRememberPassword(
+ ucb::RememberAuthentication_NO);
+ }
+ }
+ }
+ // Empty user name can not be valid:
+ else if (aInfo.GetUserName().Len() != 0)
+ {
+ uno::Sequence< rtl::OUString >
+ aPassList(aInfo.GetAccount().Len() == 0 ? 1 : 2);
+ aPassList[0] = aInfo.GetPassword();
+ if (aInfo.GetAccount().Len() != 0)
+ aPassList[1] = aInfo.GetAccount();
+
+ if (aInfo.GetIsRememberPassword())
+ {
+ if (!aPwContainerHelper.addRecord(
+ rURL.getLength() ? rURL : rRequest.ServerName,
+ aInfo.GetUserName(),
+ aPassList,
+ xIH,
+ ePreferredRememberMode
+ == ucb::RememberAuthentication_PERSISTENT))
+ {
+ xSupplyAuthentication->setRememberPassword(
+ ucb::RememberAuthentication_NO);
+ }
+ }
+ else if (eAlternateRememberMode
+ == ucb::RememberAuthentication_SESSION)
+ {
+ if (!aPwContainerHelper.addRecord(
+ rURL.getLength() ? rURL : rRequest.ServerName,
+ aInfo.GetUserName(),
+ aPassList,
+ xIH,
+ false /* SESSION */))
+ {
+ xSupplyAuthentication->setRememberPassword(
+ ucb::RememberAuthentication_NO);
+ }
+ }
+ }
+ break;
+
+ case ERRCODE_BUTTON_RETRY:
+ if (xRetry.is())
+ xRetry->select();
+ break;
+
+ default:
+ if (xAbort.is())
+ xAbort->select();
+ break;
+ }
+}
+
+void
+executeMasterPasswordDialog(
+ Window * pParent,
+ LoginErrorInfo & rInfo,
+ task::PasswordRequestMode nMode)
+ SAL_THROW((uno::RuntimeException))
+{
+ rtl::OString aMaster;
+ try
+ {
+ SolarMutexGuard aGuard;
+
+ std::auto_ptr< ResMgr > xManager(
+ ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
+ if( nMode == task::PasswordRequestMode_PASSWORD_CREATE )
+ {
+ std::auto_ptr< MasterPasswordCreateDialog > xDialog(
+ new MasterPasswordCreateDialog(pParent, xManager.get()));
+ rInfo.SetResult(xDialog->Execute()
+ == RET_OK ? ERRCODE_BUTTON_OK : ERRCODE_BUTTON_CANCEL);
+ aMaster = rtl::OUStringToOString(
+ xDialog->GetMasterPassword(), RTL_TEXTENCODING_UTF8);
+ }
+ else
+ {
+ std::auto_ptr< MasterPasswordDialog > xDialog(
+ new MasterPasswordDialog(pParent, nMode, xManager.get()));
+ rInfo.SetResult(xDialog->Execute()
+ == RET_OK ? ERRCODE_BUTTON_OK : ERRCODE_BUTTON_CANCEL);
+ aMaster = rtl::OUStringToOString(
+ xDialog->GetMasterPassword(), RTL_TEXTENCODING_UTF8);
+ }
+ }
+ catch (std::bad_alloc const &)
+ {
+ throw uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
+ uno::Reference< uno::XInterface >());
+ }
+
+ sal_uInt8 aKey[RTL_DIGEST_LENGTH_MD5];
+ rtl_digest_PBKDF2(aKey,
+ RTL_DIGEST_LENGTH_MD5,
+ reinterpret_cast< sal_uInt8 const * >(aMaster.getStr()),
+ aMaster.getLength(),
+ reinterpret_cast< sal_uInt8 const * >(
+ "3B5509ABA6BC42D9A3A1F3DAD49E56A51"),
+ 32,
+ 1000);
+
+ rtl::OUStringBuffer aBuffer;
+ for (int i = 0; i < RTL_DIGEST_LENGTH_MD5; ++i)
+ {
+ aBuffer.append(static_cast< sal_Unicode >('a' + (aKey[i] >> 4)));
+ aBuffer.append(static_cast< sal_Unicode >('a' + (aKey[i] & 15)));
+ }
+ rInfo.SetPassword(aBuffer.makeStringAndClear());
+}
+
+void
+handleMasterPasswordRequest_(
+ Window * pParent,
+ task::PasswordRequestMode nMode,
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
+ rContinuations)
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Reference< task::XInteractionRetry > xRetry;
+ uno::Reference< task::XInteractionAbort > xAbort;
+ uno::Reference< ucb::XInteractionSupplyAuthentication >
+ xSupplyAuthentication;
+ getContinuations(rContinuations, &xRetry, &xAbort, &xSupplyAuthentication);
+ LoginErrorInfo aInfo;
+
+ // in case of master password a hash code is returned
+ executeMasterPasswordDialog(pParent, aInfo, nMode);
+
+ switch (aInfo.GetResult())
+ {
+ case ERRCODE_BUTTON_OK:
+ if (xSupplyAuthentication.is())
+ {
+ if (xSupplyAuthentication->canSetPassword())
+ xSupplyAuthentication->setPassword(aInfo.GetPassword());
+ xSupplyAuthentication->select();
+ }
+ break;
+
+ case ERRCODE_BUTTON_RETRY:
+ if (xRetry.is())
+ xRetry->select();
+ break;
+
+ default:
+ if (xAbort.is())
+ xAbort->select();
+ break;
+ }
+}
+
+void
+executePasswordDialog(
+ Window * pParent,
+ LoginErrorInfo & rInfo,
+ task::PasswordRequestMode nMode,
+ ::rtl::OUString aDocName,
+ bool bMSCryptoMode,
+ bool bIsPasswordToModify )
+ SAL_THROW((uno::RuntimeException))
+{
+ try
+ {
+ SolarMutexGuard aGuard;
+
+ std::auto_ptr< ResMgr > xManager(
+ ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
+ if( nMode == task::PasswordRequestMode_PASSWORD_CREATE )
+ {
+ const sal_uInt16 nMaxPasswdLen = bMSCryptoMode ? 15 : 0; // 0 -> allow any length
+
+ VclAbstractDialogFactory * pFact = VclAbstractDialogFactory::Create();
+ AbstractPasswordToOpenModifyDialog *pTmp = pFact->CreatePasswordToOpenModifyDialog( pParent, 0, nMaxPasswdLen, bIsPasswordToModify );
+ std::auto_ptr< AbstractPasswordToOpenModifyDialog > pDialog( pTmp );
+
+ rInfo.SetResult( pDialog->Execute() == RET_OK ? ERRCODE_BUTTON_OK : ERRCODE_BUTTON_CANCEL );
+ rInfo.SetPassword( pDialog->GetPasswordToOpen() );
+ rInfo.SetPasswordToModify( pDialog->GetPasswordToModify() );
+ rInfo.SetRecommendToOpenReadonly( pDialog->IsRecommendToOpenReadonly() );
+ }
+ else
+ {
+ std::auto_ptr< PasswordDialog > pDialog(
+ new PasswordDialog( pParent, nMode, xManager.get(), aDocName, bIsPasswordToModify ) );
+
+ rInfo.SetResult( pDialog->Execute() == RET_OK ? ERRCODE_BUTTON_OK : ERRCODE_BUTTON_CANCEL );
+ rInfo.SetPassword( bIsPasswordToModify ? String() : pDialog->GetPassword() );
+ rInfo.SetPasswordToModify( bIsPasswordToModify ? pDialog->GetPassword() : String() );
+ }
+ }
+ catch (std::bad_alloc const &)
+ {
+ throw uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
+ uno::Reference< uno::XInterface>());
+ }
+}
+
+void
+handlePasswordRequest_(
+ Window * pParent,
+ task::PasswordRequestMode nMode,
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
+ rContinuations,
+ ::rtl::OUString aDocumentName,
+ bool bMSCryptoMode,
+ bool bIsPasswordToModify )
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Reference< task::XInteractionRetry > xRetry;
+ uno::Reference< task::XInteractionAbort > xAbort;
+ uno::Reference< task::XInteractionPassword > xPassword;
+ uno::Reference< task::XInteractionPassword2 > xPassword2;
+ getContinuations(rContinuations, &xRetry, &xAbort, &xPassword2, &xPassword);
+
+ if ( xPassword2.is() && !xPassword.is() )
+ xPassword.set( xPassword2, uno::UNO_QUERY_THROW );
+
+ LoginErrorInfo aInfo;
+
+ executePasswordDialog( pParent, aInfo, nMode,
+ aDocumentName, bMSCryptoMode, bIsPasswordToModify );
+
+ switch (aInfo.GetResult())
+ {
+ case ERRCODE_BUTTON_OK:
+ OSL_ENSURE( !bIsPasswordToModify || xPassword2.is(), "PasswordToModify is requested, but there is no Interaction!" );
+ if (xPassword.is())
+ {
+ if (xPassword2.is())
+ {
+ xPassword2->setPasswordToModify( aInfo.GetPasswordToModify() );
+ xPassword2->setRecommendReadOnly( aInfo.IsRecommendToOpenReadonly() );
+ }
+
+ xPassword->setPassword(aInfo.GetPassword());
+ xPassword->select();
+ }
+ break;
+
+ case ERRCODE_BUTTON_RETRY:
+ if (xRetry.is())
+ xRetry->select();
+ break;
+
+ default:
+ if (xAbort.is())
+ xAbort->select();
+ break;
+ }
+}
+
+} // namespace
+
+bool
+UUIInteractionHelper::handleAuthenticationRequest(
+ uno::Reference< task::XInteractionRequest > const & rRequest)
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Any aAnyRequest(rRequest->getRequest());
+
+ ucb::URLAuthenticationRequest aURLAuthenticationRequest;
+ if (aAnyRequest >>= aURLAuthenticationRequest)
+ {
+ handleAuthenticationRequest_(getParentProperty(),
+ getInteractionHandler(),
+ m_xServiceFactory,
+ aURLAuthenticationRequest,
+ rRequest->getContinuations(),
+ aURLAuthenticationRequest.URL);
+ return true;
+ }
+
+ ucb::AuthenticationRequest aAuthenticationRequest;
+ if (aAnyRequest >>= aAuthenticationRequest)
+ {
+ handleAuthenticationRequest_(getParentProperty(),
+ getInteractionHandler(),
+ m_xServiceFactory,
+ aAuthenticationRequest,
+ rRequest->getContinuations(),
+ rtl::OUString());
+ return true;
+ }
+ return false;
+}
+
+bool
+UUIInteractionHelper::handleMasterPasswordRequest(
+ uno::Reference< task::XInteractionRequest > const & rRequest)
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Any aAnyRequest(rRequest->getRequest());
+
+ task::MasterPasswordRequest aMasterPasswordRequest;
+ if (aAnyRequest >>= aMasterPasswordRequest)
+ {
+ handleMasterPasswordRequest_(getParentProperty(),
+ aMasterPasswordRequest.Mode,
+ rRequest->getContinuations());
+ return true;
+ }
+ return false;
+}
+
+bool
+UUIInteractionHelper::handlePasswordRequest(
+ uno::Reference< task::XInteractionRequest > const & rRequest)
+ SAL_THROW((uno::RuntimeException))
+{
+ // parameters to be filled for the call to handlePasswordRequest_
+ Window * pParent = getParentProperty();
+ task::PasswordRequestMode nMode = task::PasswordRequestMode_PASSWORD_ENTER;
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > const & rContinuations = rRequest->getContinuations();
+ ::rtl::OUString aDocumentName;
+ bool bMSCryptoMode = false;
+ bool bIsPasswordToModify = false;
+
+ bool bDoHandleRequest = false;
+
+ uno::Any aAnyRequest(rRequest->getRequest());
+
+ task::DocumentPasswordRequest2 aDocumentPasswordRequest2;
+ if (!bDoHandleRequest && (aAnyRequest >>= aDocumentPasswordRequest2))
+ {
+ nMode = aDocumentPasswordRequest2.Mode;
+ aDocumentName = aDocumentPasswordRequest2.Name;
+ OSL_ENSURE( bMSCryptoMode == false, "bMSCryptoMode should be false" );
+ bIsPasswordToModify = aDocumentPasswordRequest2.IsRequestPasswordToModify;
+
+ bDoHandleRequest = true;
+ }
+
+ task::DocumentPasswordRequest aDocumentPasswordRequest;
+ if (!bDoHandleRequest && (aAnyRequest >>= aDocumentPasswordRequest))
+ {
+ nMode = aDocumentPasswordRequest.Mode;
+ aDocumentName = aDocumentPasswordRequest.Name;
+ OSL_ENSURE( bMSCryptoMode == false, "bMSCryptoMode should be false" );
+ OSL_ENSURE( bIsPasswordToModify == false, "bIsPasswordToModify should be false" );
+
+ bDoHandleRequest = true;
+ }
+
+ task::DocumentMSPasswordRequest2 aDocumentMSPasswordRequest2;
+ if (!bDoHandleRequest && (aAnyRequest >>= aDocumentMSPasswordRequest2))
+ {
+ nMode = aDocumentMSPasswordRequest2.Mode;
+ aDocumentName = aDocumentMSPasswordRequest2.Name;
+ bMSCryptoMode = true;
+ bIsPasswordToModify = aDocumentMSPasswordRequest2.IsRequestPasswordToModify;
+
+ bDoHandleRequest = true;
+ }
+
+ task::DocumentMSPasswordRequest aDocumentMSPasswordRequest;
+ if (!bDoHandleRequest && (aAnyRequest >>= aDocumentMSPasswordRequest))
+ {
+ nMode = aDocumentMSPasswordRequest.Mode;
+ aDocumentName = aDocumentMSPasswordRequest.Name;
+ bMSCryptoMode = true;
+ OSL_ENSURE( bIsPasswordToModify == false, "bIsPasswordToModify should be false" );
+
+ bDoHandleRequest = true;
+ }
+
+ if (bDoHandleRequest)
+ {
+ handlePasswordRequest_( pParent, nMode, rContinuations,
+ aDocumentName, bMSCryptoMode, bIsPasswordToModify );
+ return true;
+ }
+
+ task::PasswordRequest aPasswordRequest;
+ if( aAnyRequest >>= aPasswordRequest )
+ {
+ handlePasswordRequest_(getParentProperty(),
+ aPasswordRequest.Mode,
+ rRequest->getContinuations(),
+ rtl::OUString(),
+ false /* bool bMSCryptoMode */,
+ false /* bool bIsPasswordToModify */);
+ return true;
+ }
+
+ return false;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/iahndl-cookies.cxx b/uui/source/iahndl-cookies.cxx
new file mode 100644
index 000000000000..36c3b629c06c
--- /dev/null
+++ b/uui/source/iahndl-cookies.cxx
@@ -0,0 +1,211 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "com/sun/star/ucb/HandleCookiesRequest.hpp"
+#include "com/sun/star/ucb/XInteractionCookieHandling.hpp"
+#include "com/sun/star/task/XInteractionRequest.hpp"
+
+#include "osl/mutex.hxx"
+#include "tools/list.hxx"
+#include "svl/httpcook.hxx"
+#include "vcl/svapp.hxx"
+
+#include "cookiedg.hxx"
+
+#include "iahndl.hxx"
+
+using namespace com::sun::star;
+
+namespace {
+
+class CookieList: public List
+{
+public:
+ ~CookieList() SAL_THROW(());
+};
+
+CookieList::~CookieList() SAL_THROW(())
+{
+ while (Count() != 0)
+ delete static_cast< CntHTTPCookie * >(Remove(Count() - 1));
+}
+
+void
+executeCookieDialog(Window * pParent, CntHTTPCookieRequest & rRequest)
+ SAL_THROW((uno::RuntimeException))
+{
+ try
+ {
+ SolarMutexGuard aGuard;
+
+ std::auto_ptr< ResMgr > xManager(
+ ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
+ std::auto_ptr< CookiesDialog > xDialog(
+ new CookiesDialog(pParent, &rRequest, xManager.get()));
+ xDialog->Execute();
+ }
+ catch (std::bad_alloc const &)
+ {
+ throw uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
+ uno::Reference< uno::XInterface>());
+ }
+}
+
+void
+handleCookiesRequest_(
+ Window * pParent,
+ ucb::HandleCookiesRequest const & rRequest,
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
+ rContinuations)
+ SAL_THROW((uno::RuntimeException))
+{
+ CookieList aCookies;
+ for (sal_Int32 i = 0; i < rRequest.Cookies.getLength(); ++i)
+ {
+ try
+ {
+ std::auto_ptr< CntHTTPCookie > xCookie(new CntHTTPCookie);
+ xCookie->m_aName = UniString(rRequest.Cookies[i].Name);
+ xCookie->m_aValue = UniString(rRequest.Cookies[i].Value);
+ xCookie->m_aDomain = UniString(rRequest.Cookies[i].Domain);
+ xCookie->m_aPath = UniString(rRequest.Cookies[i].Path);
+ xCookie->m_aExpires
+ = DateTime(Date(rRequest.Cookies[i].Expires.Day,
+ rRequest.Cookies[i].Expires.Month,
+ rRequest.Cookies[i].Expires.Year),
+ Time(rRequest.Cookies[i].Expires.Hours,
+ rRequest.Cookies[i].Expires.Minutes,
+ rRequest.Cookies[i].Expires.Seconds,
+ rRequest.Cookies[i].Expires.HundredthSeconds));
+ xCookie->m_nFlags
+ = rRequest.Cookies[i].Secure ? CNTHTTP_COOKIE_FLAG_SECURE : 0;
+ switch (rRequest.Cookies[i].Policy)
+ {
+ case ucb::CookiePolicy_CONFIRM:
+ xCookie->m_nPolicy = CNTHTTP_COOKIE_POLICY_INTERACTIVE;
+ break;
+
+ case ucb::CookiePolicy_ACCEPT:
+ xCookie->m_nPolicy = CNTHTTP_COOKIE_POLICY_ACCEPTED;
+ break;
+
+ case ucb::CookiePolicy_IGNORE:
+ xCookie->m_nPolicy = CNTHTTP_COOKIE_POLICY_BANNED;
+ break;
+
+ default:
+ OSL_ASSERT(false);
+ break;
+ }
+ aCookies.Insert(xCookie.get(), LIST_APPEND);
+ xCookie.release();
+ }
+ catch (std::bad_alloc const &)
+ {
+ throw uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "out of memory")),
+ uno::Reference< uno::XInterface >());
+ }
+ }
+
+ CntHTTPCookieRequest
+ aRequest(rRequest.URL,
+ aCookies,
+ rRequest.Request == ucb::CookieRequest_RECEIVE
+ ? CNTHTTP_COOKIE_REQUEST_RECV
+ : CNTHTTP_COOKIE_REQUEST_SEND);
+ executeCookieDialog(pParent, aRequest);
+ for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i)
+ {
+ uno::Reference< ucb::XInteractionCookieHandling >
+ xCookieHandling(rContinuations[i], uno::UNO_QUERY);
+ if (xCookieHandling.is())
+ {
+ switch (aRequest.m_nRet)
+ {
+ case CNTHTTP_COOKIE_POLICY_INTERACTIVE:
+ xCookieHandling->
+ setGeneralPolicy(ucb::CookiePolicy_CONFIRM);
+ break;
+
+ case CNTHTTP_COOKIE_POLICY_ACCEPTED:
+ xCookieHandling->
+ setGeneralPolicy(ucb::CookiePolicy_ACCEPT);
+ break;
+
+ case CNTHTTP_COOKIE_POLICY_BANNED:
+ xCookieHandling->
+ setGeneralPolicy(ucb::CookiePolicy_IGNORE);
+ break;
+ }
+ for (sal_Int32 j = 0; j < rRequest.Cookies.getLength(); ++j)
+ if (rRequest.Cookies[j].Policy
+ == ucb::CookiePolicy_CONFIRM)
+ switch (static_cast< CntHTTPCookie * >(aCookies.
+ GetObject(j))->
+ m_nPolicy)
+ {
+ case CNTHTTP_COOKIE_POLICY_ACCEPTED:
+ xCookieHandling->
+ setSpecificPolicy(rRequest.Cookies[j], true);
+ break;
+
+ case CNTHTTP_COOKIE_POLICY_BANNED:
+ xCookieHandling->
+ setSpecificPolicy(rRequest.Cookies[j], false);
+ break;
+ }
+ xCookieHandling->select();
+ break;
+ }
+ }
+}
+
+} // namespace
+
+bool
+UUIInteractionHelper::handleCookiesRequest(
+ uno::Reference< task::XInteractionRequest > const & rRequest)
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Any aAnyRequest(rRequest->getRequest());
+
+ ucb::HandleCookiesRequest aCookiesRequest;
+ if (aAnyRequest >>= aCookiesRequest)
+ {
+ handleCookiesRequest_(getParentProperty(),
+ aCookiesRequest,
+ rRequest->getContinuations());
+ return true;
+ }
+ return false;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/iahndl-errorhandler.cxx b/uui/source/iahndl-errorhandler.cxx
new file mode 100644
index 000000000000..065dd888e824
--- /dev/null
+++ b/uui/source/iahndl-errorhandler.cxx
@@ -0,0 +1,321 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include <memory>
+
+#include "osl/mutex.hxx"
+#include "vcl/svapp.hxx"
+#include "vcl/msgbox.hxx"
+
+#include "com/sun/star/task/XInteractionAbort.hpp"
+#include "com/sun/star/task/XInteractionApprove.hpp"
+#include "com/sun/star/task/XInteractionDisapprove.hpp"
+#include "com/sun/star/task/XInteractionRetry.hpp"
+
+#include "tools/errinf.hxx" // ErrorHandler, ErrorContext, ...
+#include "svtools/svtools.hrc" // RID_ERRHDL
+
+#include "ids.hrc"
+#include "getcontinuations.hxx"
+
+#include "iahndl.hxx"
+
+using namespace com::sun::star;
+
+namespace {
+
+USHORT
+executeErrorDialog(
+ Window * pParent,
+ task::InteractionClassification eClassification,
+ rtl::OUString const & rContext,
+ rtl::OUString const & rMessage,
+ WinBits nButtonMask)
+ SAL_THROW((uno::RuntimeException))
+{
+ SolarMutexGuard aGuard;
+
+ rtl::OUStringBuffer aText(rContext);
+ if (rContext.getLength() != 0 && rMessage.getLength() != 0)
+ aText.appendAscii(RTL_CONSTASCII_STRINGPARAM(":\n"));
+ //TODO! must be internationalized
+ aText.append(rMessage);
+
+ std::auto_ptr< MessBox > xBox;
+ try
+ {
+ switch (eClassification)
+ {
+ case task::InteractionClassification_ERROR:
+ xBox.reset(new ErrorBox(pParent,
+ nButtonMask,
+ aText.makeStringAndClear()));
+ break;
+
+ case task::InteractionClassification_WARNING:
+ xBox.reset(new WarningBox(pParent,
+ nButtonMask,
+ aText.makeStringAndClear()));
+ break;
+
+ case task::InteractionClassification_INFO:
+ if ((nButtonMask & 0x01F00000) == WB_DEF_OK)
+ //TODO! missing win bit button mask define (want to ignore
+ // any default button settings)...
+ xBox.reset(new InfoBox(pParent,
+ aText.makeStringAndClear()));
+ else
+ xBox.reset(new ErrorBox(pParent,
+ nButtonMask,
+ aText.makeStringAndClear()));
+ break;
+
+ case task::InteractionClassification_QUERY:
+ xBox.reset(new QueryBox(pParent,
+ nButtonMask,
+ aText.makeStringAndClear()));
+ break;
+
+ default:
+ OSL_ASSERT(false);
+ break;
+ }
+ }
+ catch (std::bad_alloc const &)
+ {
+ throw uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
+ uno::Reference< uno::XInterface >());
+ }
+
+ USHORT aResult = xBox->Execute();
+ switch( aResult )
+ {
+ case BUTTONID_OK:
+ aResult = ERRCODE_BUTTON_OK;
+ break;
+ case BUTTONID_CANCEL:
+ aResult = ERRCODE_BUTTON_CANCEL;
+ break;
+ case BUTTONID_YES:
+ aResult = ERRCODE_BUTTON_YES;
+ break;
+ case BUTTONID_NO:
+ aResult = ERRCODE_BUTTON_NO;
+ break;
+ case BUTTONID_RETRY:
+ aResult = ERRCODE_BUTTON_RETRY;
+ break;
+ }
+
+ return aResult;
+}
+
+}
+
+void
+UUIInteractionHelper::handleErrorHandlerRequest(
+ task::InteractionClassification eClassification,
+ ErrCode nErrorCode,
+ std::vector< rtl::OUString > const & rArguments,
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
+ rContinuations,
+ bool bObtainErrorStringOnly,
+ bool & bHasErrorString,
+ rtl::OUString & rErrorString)
+ SAL_THROW((uno::RuntimeException))
+{
+ if (bObtainErrorStringOnly)
+ {
+ bHasErrorString = isInformationalErrorMessageRequest(rContinuations);
+ if (!bHasErrorString)
+ return;
+ }
+
+ rtl::OUString aMessage;
+ {
+ enum Source { SOURCE_DEFAULT, SOURCE_CNT, SOURCE_SVX, SOURCE_UUI };
+ static char const * const aManager[4]
+ = { CREATEVERSIONRESMGR_NAME(ofa),
+ CREATEVERSIONRESMGR_NAME(cnt),
+ CREATEVERSIONRESMGR_NAME(svx),
+ CREATEVERSIONRESMGR_NAME(uui) };
+ static USHORT const aId[4]
+ = { RID_ERRHDL,
+ RID_CHAOS_START + 12,
+ // cf. chaos/source/inc/cntrids.hrc, where
+ // #define RID_CHAOS_ERRHDL (RID_CHAOS_START + 12)
+ RID_SVX_START + 350, // RID_SVXERRCODE
+ RID_UUI_ERRHDL };
+ ErrCode nErrorId = nErrorCode & ~ERRCODE_WARNING_MASK;
+ Source eSource = nErrorId < ERRCODE_AREA_LIB1 ?
+ SOURCE_DEFAULT :
+ nErrorId >= ERRCODE_AREA_CHAOS
+ && nErrorId < ERRCODE_AREA_CHAOS_END ?
+ SOURCE_CNT :
+ nErrorId >= ERRCODE_AREA_SVX
+ && nErrorId <= ERRCODE_AREA_SVX_END ?
+ SOURCE_SVX :
+ SOURCE_UUI;
+
+ SolarMutexGuard aGuard;
+ std::auto_ptr< ResMgr > xManager;
+ xManager.reset(ResMgr::CreateResMgr(aManager[eSource]));
+ if (!xManager.get())
+ return;
+ ResId aResId(aId[eSource], *xManager.get());
+ if (!ErrorResource(aResId).getString(nErrorCode, &aMessage))
+ return;
+ }
+
+ aMessage = replaceMessageWithArguments( aMessage, rArguments );
+
+ if (bObtainErrorStringOnly)
+ {
+ rErrorString = aMessage;
+ return;
+ }
+ else
+ {
+ //TODO! It can happen that the buttons calculated below do not match
+ // the error text from the resource (e.g., some text that is not a
+ // question, but YES and NO buttons). Some error texts have
+ // ExtraData that specifies a set of buttons, but that data is not
+ // really useful, because a single error text may well make sense
+ // both with only an OK button and with RETRY and CANCEL buttons.
+
+ uno::Reference< task::XInteractionApprove > xApprove;
+ uno::Reference< task::XInteractionDisapprove > xDisapprove;
+ uno::Reference< task::XInteractionRetry > xRetry;
+ uno::Reference< task::XInteractionAbort > xAbort;
+ getContinuations(
+ rContinuations, &xApprove, &xDisapprove, &xRetry, &xAbort);
+
+ // The following mapping uses the bit mask
+ // Approve = 8,
+ // Disapprove = 4,
+ // Retry = 2,
+ // Abort = 1
+ //
+ // The mapping has five properties on which the code to select the
+ // correct continuation relies:
+ // 1 The OK button is mapped to Approve if that is available,
+ // otherwise to Abort if that is available, otherwise to none.
+ // 2 The CANCEL button is always mapped to Abort.
+ // 3 The RETRY button is always mapped to Retry.
+ // 4 The NO button is always mapped to Disapprove.
+ // 5 The YES button is always mapped to Approve.
+ //
+ // Because the WinBits button combinations are quite restricted, not
+ // every request can be served here.
+ //
+ // Finally, it seems to be better to leave default button
+ // determination to VCL (the favouring of CANCEL as default button
+ // seems to not always be what the user wants)...
+ WinBits const aButtonMask[16]
+ = { 0,
+ WB_OK /*| WB_DEF_OK*/, // Abort
+ 0,
+ WB_RETRY_CANCEL /*| WB_DEF_CANCEL*/, // Retry, Abort
+ 0,
+ 0,
+ 0,
+ 0,
+ WB_OK /*| WB_DEF_OK*/, // Approve
+ WB_OK_CANCEL /*| WB_DEF_CANCEL*/, // Approve, Abort
+ 0,
+ 0,
+ WB_YES_NO /*| WB_DEF_NO*/, // Approve, Disapprove
+ WB_YES_NO_CANCEL /*| WB_DEF_CANCEL*/,
+ // Approve, Disapprove, Abort
+ 0,
+ 0 };
+
+ WinBits nButtonMask = aButtonMask[(xApprove.is() ? 8 : 0)
+ | (xDisapprove.is() ? 4 : 0)
+ | (xRetry.is() ? 2 : 0)
+ | (xAbort.is() ? 1 : 0)];
+ if (nButtonMask == 0)
+ return;
+
+ //TODO! remove this backwards compatibility?
+ rtl::OUString aContext(getContextProperty());
+ if (aContext.getLength() == 0 && nErrorCode != 0)
+ {
+ SolarMutexGuard aGuard;
+ ErrorContext * pContext = ErrorContext::GetContext();
+ if (pContext)
+ {
+ UniString aContextString;
+ if (pContext->GetString(nErrorCode, aContextString))
+ aContext = aContextString;
+ }
+ }
+
+ USHORT nResult = executeErrorDialog(
+ getParentProperty(), eClassification, aContext, aMessage, nButtonMask );
+
+ switch (nResult)
+ {
+ case ERRCODE_BUTTON_OK:
+ OSL_ENSURE(xApprove.is() || xAbort.is(), "unexpected situation");
+ if (xApprove.is())
+ xApprove->select();
+ else if (xAbort.is())
+ xAbort->select();
+ break;
+
+ case ERRCODE_BUTTON_CANCEL:
+ OSL_ENSURE(xAbort.is(), "unexpected situation");
+ if (xAbort.is())
+ xAbort->select();
+ break;
+
+ case ERRCODE_BUTTON_RETRY:
+ OSL_ENSURE(xRetry.is(), "unexpected situation");
+ if (xRetry.is())
+ xRetry->select();
+ break;
+
+ case ERRCODE_BUTTON_NO:
+ OSL_ENSURE(xDisapprove.is(), "unexpected situation");
+ if (xDisapprove.is())
+ xDisapprove->select();
+ break;
+
+ case ERRCODE_BUTTON_YES:
+ OSL_ENSURE(xApprove.is(), "unexpected situation");
+ if (xApprove.is())
+ xApprove->select();
+ break;
+ }
+
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/iahndl-filter.cxx b/uui/source/iahndl-filter.cxx
new file mode 100644
index 000000000000..593972245a64
--- /dev/null
+++ b/uui/source/iahndl-filter.cxx
@@ -0,0 +1,473 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "com/sun/star/beans/XPropertyAccess.hpp"
+#include "com/sun/star/container/XContainerQuery.hpp"
+#include "com/sun/star/container/XNameContainer.hpp"
+#include "com/sun/star/document/AmbigousFilterRequest.hpp"
+#include "com/sun/star/document/FilterOptionsRequest.hpp"
+#include "com/sun/star/document/NoSuchFilterRequest.hpp"
+#include "com/sun/star/document/XImporter.hpp"
+#include "com/sun/star/document/XInteractionFilterOptions.hpp"
+#include "com/sun/star/document/XInteractionFilterSelect.hpp"
+#include "com/sun/star/lang/XMultiServiceFactory.hpp"
+#include "com/sun/star/task/XInteractionAbort.hpp"
+#include "com/sun/star/task/XInteractionRequest.hpp"
+#include "com/sun/star/ui/dialogs/XExecutableDialog.hpp"
+
+#include "osl/mutex.hxx"
+#include "comphelper/sequenceashashmap.hxx"
+#include "vcl/svapp.hxx"
+
+#include "getcontinuations.hxx"
+#include "fltdlg.hxx"
+
+#include "iahndl.hxx"
+
+using namespace com::sun::star;
+
+namespace {
+
+void
+executeFilterDialog(
+ Window * pParent ,
+ rtl::OUString const & rURL ,
+ uui::FilterNameList const & rFilters,
+ rtl::OUString & rFilter )
+ SAL_THROW((uno::RuntimeException))
+{
+ try
+ {
+ SolarMutexGuard aGuard;
+
+ std::auto_ptr< ResMgr > xManager(
+ ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
+
+ std::auto_ptr< uui::FilterDialog > xDialog(
+ new uui::FilterDialog(pParent, xManager.get()));
+
+ xDialog->SetURL(rURL);
+ xDialog->ChangeFilters(&rFilters);
+
+ uui::FilterNameListPtr pSelected = rFilters.end();
+ if( xDialog->AskForFilter( pSelected ) )
+ {
+ rFilter = pSelected->sInternal;
+ }
+ }
+ catch (std::bad_alloc const &)
+ {
+ throw uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
+ uno::Reference< uno::XInterface >());
+ }
+}
+
+void
+handleNoSuchFilterRequest_(
+ Window * pParent,
+ uno::Reference< lang::XMultiServiceFactory > const & xServiceFactory,
+ document::NoSuchFilterRequest const & rRequest,
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
+ rContinuations )
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Reference< task::XInteractionAbort > xAbort;
+ uno::Reference< document::XInteractionFilterSelect > xFilterTransport;
+ getContinuations(rContinuations, &xAbort, &xFilterTransport);
+
+ // check neccessary ressources - if they don't exist - abort or
+ // break this operation
+ if (!xAbort.is())
+ return;
+
+ if (!xFilterTransport.is())
+ {
+ xAbort->select();
+ return;
+ }
+
+ uno::Reference< container::XContainerQuery > xFilterContainer;
+ try
+ {
+ xFilterContainer.set( xServiceFactory->createInstance(
+ ::rtl::OUString::createFromAscii(
+ "com.sun.star.document.FilterFactory") ),
+ uno::UNO_QUERY );
+ }
+ catch ( uno::Exception const & )
+ {
+ }
+
+ if (!xFilterContainer.is())
+ {
+ xAbort->select();
+ return;
+ }
+
+ uui::FilterNameList lNames;
+
+ // Note: We look for all filters here which match the following criteria:
+ // - they are import filters as minimum (of course they can
+ // support export too)
+ // - we don't show any filter which are flaged as "don't show it
+ // at the UI" or "they are not installed"
+ // - we ignore filters, which have not set any valid
+ // DocumentService (e.g. our pure graphic filters)
+ // - we show it sorted by her UIName's
+ // - We don't use the order flag or prefer default filters.
+ // (Because this list shows all filters and the user should
+ // find his filter vry easy by his UIName ...)
+ // - We use "_query_all" here ... but we filter graphic filters
+ // out by using DocumentService property later!
+ uno::Reference< container::XEnumeration > xFilters
+ = xFilterContainer->createSubSetEnumerationByQuery(
+ ::rtl::OUString::createFromAscii(
+ "_query_all:sort_prop=uiname:iflags=1:eflags=143360"));
+ while (xFilters->hasMoreElements())
+ {
+ try
+ {
+ ::comphelper::SequenceAsHashMap lProps(xFilters->nextElement());
+ uui::FilterNamePair aPair;
+
+ aPair.sInternal = lProps.getUnpackedValueOrDefault(
+ rtl::OUString::createFromAscii("Name"), ::rtl::OUString());
+ aPair.sUI = lProps.getUnpackedValueOrDefault(
+ rtl::OUString::createFromAscii("UIName"), ::rtl::OUString());
+ if ( (!aPair.sInternal.Len()) || (!aPair.sUI.Len() ) )
+ {
+ continue;
+ }
+ lNames.push_back( aPair );
+ }
+ catch(const uno::RuntimeException&)
+ {
+ throw;
+ }
+ catch(const uno::Exception&)
+ {
+ continue;
+ }
+ }
+
+ // no list available for showing
+ // -> abort operation
+ if (lNames.size()<1)
+ {
+ xAbort->select();
+ return;
+ }
+
+ // let the user select the right filter
+ rtl::OUString sSelectedFilter;
+ executeFilterDialog( pParent,
+ rRequest.URL,
+ lNames,
+ sSelectedFilter );
+
+ // If he doesn't select anyone
+ // -> abort operation
+ if (sSelectedFilter.getLength()<1)
+ {
+ xAbort->select();
+ return;
+ }
+
+ // otherwhise set it for return
+ xFilterTransport->setFilter( sSelectedFilter );
+ xFilterTransport->select();
+}
+
+void
+handleAmbigousFilterRequest_(
+ Window * pParent,
+ uno::Reference< lang::XMultiServiceFactory > const & xServiceFactory,
+ document::AmbigousFilterRequest const & rRequest,
+ uno::Sequence<
+ uno::Reference<
+ task::XInteractionContinuation > > const & rContinuations)
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Reference< task::XInteractionAbort > xAbort;
+ uno::Reference< document::XInteractionFilterSelect > xFilterTransport;
+ getContinuations(rContinuations, &xAbort, &xFilterTransport);
+
+ uui::FilterNameList lNames;
+
+ uno::Reference< container::XNameContainer > xFilterContainer;
+ try
+ {
+ xFilterContainer.set( xServiceFactory->createInstance(
+ ::rtl::OUString::createFromAscii(
+ "com.sun.star.document.FilterFactory") ),
+ uno::UNO_QUERY );
+ }
+ catch ( uno::Exception & )
+ {
+ }
+
+ if( xFilterContainer.is() )
+ {
+ uno::Any aPackedSet ;
+ uno::Sequence< beans::PropertyValue > lProps ;
+ sal_Int32 nStep ;
+ uui::FilterNamePair aPair ;
+
+ try
+ {
+ aPackedSet = xFilterContainer->getByName( rRequest.SelectedFilter );
+ }
+ catch(const container::NoSuchElementException&)
+ {
+ aPackedSet.clear();
+ }
+ aPackedSet >>= lProps;
+ for( nStep=0; nStep<lProps.getLength(); ++nStep )
+ {
+ if( lProps[nStep].Name.compareToAscii("UIName") == 0 )
+ {
+ ::rtl::OUString sTemp;
+ lProps[nStep].Value >>= sTemp;
+ aPair.sUI = sTemp;
+ aPair.sInternal = rRequest.SelectedFilter;
+ lNames.push_back( aPair );
+ break;
+ }
+ }
+
+ try
+ {
+ aPackedSet = xFilterContainer->getByName( rRequest.DetectedFilter );
+ }
+ catch(const container::NoSuchElementException&)
+ {
+ aPackedSet.clear();
+ }
+ aPackedSet >>= lProps;
+ for( nStep=0; nStep<lProps.getLength(); ++nStep )
+ {
+ if( lProps[nStep].Name.compareToAscii("UIName") == 0 )
+ {
+ ::rtl::OUString sTemp;
+ lProps[nStep].Value >>= sTemp;
+ aPair.sUI = sTemp;
+ aPair.sInternal = rRequest.DetectedFilter;
+ lNames.push_back( aPair );
+ break;
+ }
+ }
+ }
+
+ if( xAbort.is() && xFilterTransport.is() )
+ {
+ if( lNames.size() < 1 )
+ {
+ xAbort->select();
+ }
+ else
+ {
+ rtl::OUString sFilter;
+ executeFilterDialog( pParent,
+ rRequest.URL,
+ lNames,
+ sFilter );
+
+ if( sFilter.getLength() > 0 )
+ {
+ xFilterTransport->setFilter( sFilter );
+ xFilterTransport->select();
+ }
+ else
+ xAbort->select();
+ }
+ }
+}
+
+void
+handleFilterOptionsRequest_(
+ uno::Reference< lang::XMultiServiceFactory > const & xServiceFactory,
+ document::FilterOptionsRequest const & rRequest,
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
+ rContinuations)
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Reference< task::XInteractionAbort > xAbort;
+ uno::Reference< document::XInteractionFilterOptions > xFilterOptions;
+ getContinuations(rContinuations, &xAbort, &xFilterOptions);
+
+ uno::Reference< container::XNameAccess > xFilterCFG;
+ try
+ {
+ xFilterCFG.set( xServiceFactory->createInstance(
+ ::rtl::OUString::createFromAscii(
+ "com.sun.star.document.FilterFactory" ) ),
+ uno::UNO_QUERY );
+ }
+ catch ( uno::Exception const & )
+ {
+ }
+
+ if( xFilterCFG.is() && rRequest.rProperties.getLength() )
+ {
+ try
+ {
+ ::rtl::OUString aFilterName;
+ sal_Int32 nPropCount = rRequest.rProperties.getLength();
+ for( sal_Int32 ind = 0; ind < nPropCount; ++ind )
+ {
+ rtl::OUString tmp = rRequest.rProperties[ind].Name;
+ if( rRequest.rProperties[ind].Name.equals(
+ ::rtl::OUString::createFromAscii("FilterName")) )
+ {
+ rRequest.rProperties[ind].Value >>= aFilterName;
+ break;
+ }
+ }
+
+ uno::Sequence < beans::PropertyValue > aProps;
+ if ( xFilterCFG->getByName( aFilterName ) >>= aProps )
+ {
+ sal_Int32 nPropertyCount = aProps.getLength();
+ for( sal_Int32 nProperty=0;
+ nProperty < nPropertyCount;
+ ++nProperty )
+ if( aProps[nProperty].Name.equals(
+ ::rtl::OUString::createFromAscii("UIComponent")) )
+ {
+ ::rtl::OUString aServiceName;
+ aProps[nProperty].Value >>= aServiceName;
+ if( aServiceName.getLength() )
+ {
+ uno::Reference<
+ ui::dialogs::XExecutableDialog > xFilterDialog(
+ xServiceFactory->createInstance(
+ aServiceName ),
+ uno::UNO_QUERY );
+ uno::Reference< beans::XPropertyAccess >
+ xFilterProperties( xFilterDialog,
+ uno::UNO_QUERY );
+
+ if( xFilterDialog.is() && xFilterProperties.is() )
+ {
+ uno::Reference<
+ document::XImporter > xImporter(
+ xFilterDialog, uno::UNO_QUERY );
+ if( xImporter.is() )
+ xImporter->setTargetDocument(
+ uno::Reference< lang::XComponent >(
+ rRequest.rModel, uno::UNO_QUERY ) );
+
+ xFilterProperties->setPropertyValues(
+ rRequest.rProperties );
+
+ if( xFilterDialog->execute() )
+ {
+ xFilterOptions->setFilterOptions(
+ xFilterProperties->getPropertyValues() );
+ xFilterOptions->select();
+ return;
+ }
+ }
+ }
+ break;
+ }
+ }
+ }
+ catch( container::NoSuchElementException& )
+ {
+ // the filter name is unknown
+ }
+ catch( uno::Exception& )
+ {
+ }
+ }
+
+ xAbort->select();
+}
+
+} // namespace
+
+bool
+UUIInteractionHelper::handleNoSuchFilterRequest(
+ uno::Reference< task::XInteractionRequest > const & rRequest)
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Any aAnyRequest(rRequest->getRequest());
+
+ document::NoSuchFilterRequest aNoSuchFilterRequest;
+ if (aAnyRequest >>= aNoSuchFilterRequest)
+ {
+ handleNoSuchFilterRequest_(getParentProperty(),
+ m_xServiceFactory,
+ aNoSuchFilterRequest,
+ rRequest->getContinuations());
+ return true;
+ }
+ return false;
+}
+
+bool
+UUIInteractionHelper::handleAmbigousFilterRequest(
+ uno::Reference< task::XInteractionRequest > const & rRequest)
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Any aAnyRequest(rRequest->getRequest());
+
+ document::AmbigousFilterRequest aAmbigousFilterRequest;
+ if (aAnyRequest >>= aAmbigousFilterRequest)
+ {
+ handleAmbigousFilterRequest_(getParentProperty(),
+ m_xServiceFactory,
+ aAmbigousFilterRequest,
+ rRequest->getContinuations());
+ return true;
+ }
+ return false;
+}
+
+bool
+UUIInteractionHelper::handleFilterOptionsRequest(
+ uno::Reference< task::XInteractionRequest > const & rRequest)
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Any aAnyRequest(rRequest->getRequest());
+
+ document::FilterOptionsRequest aFilterOptionsRequest;
+ if (aAnyRequest >>= aFilterOptionsRequest)
+ {
+ handleFilterOptionsRequest_(m_xServiceFactory,
+ aFilterOptionsRequest,
+ rRequest->getContinuations());
+ return true;
+ }
+ return false;
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/iahndl-ioexceptions.cxx b/uui/source/iahndl-ioexceptions.cxx
new file mode 100644
index 000000000000..b259ef996d13
--- /dev/null
+++ b/uui/source/iahndl-ioexceptions.cxx
@@ -0,0 +1,346 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "com/sun/star/beans/PropertyValue.hpp"
+#include "com/sun/star/task/XInteractionRequest.hpp"
+#include "com/sun/star/ucb/InteractiveAugmentedIOException.hpp"
+
+#include "ids.hrc"
+
+#include "iahndl.hxx"
+
+using namespace com::sun::star;
+
+namespace {
+
+bool
+getStringRequestArgument(uno::Sequence< uno::Any > const & rArguments,
+ rtl::OUString const & rKey,
+ rtl::OUString * pValue)
+ SAL_THROW(())
+{
+ for (sal_Int32 i = 0; i < rArguments.getLength(); ++i)
+ {
+ beans::PropertyValue aProperty;
+ if ((rArguments[i] >>= aProperty) && aProperty.Name == rKey)
+ {
+ rtl::OUString aValue;
+ if (aProperty.Value >>= aValue)
+ {
+ if (pValue)
+ *pValue = aValue;
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+bool
+getBoolRequestArgument(uno::Sequence< uno::Any > const & rArguments,
+ rtl::OUString const & rKey,
+ bool * pValue)
+ SAL_THROW(())
+{
+ for (sal_Int32 i = 0; i < rArguments.getLength(); ++i)
+ {
+ beans::PropertyValue aProperty;
+ if ((rArguments[i] >>= aProperty) && aProperty.Name == rKey)
+ {
+ sal_Bool bValue = sal_Bool();
+ if (aProperty.Value >>= bValue)
+ {
+ if (pValue)
+ *pValue = bValue;
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+bool
+getResourceNameRequestArgument(uno::Sequence< uno::Any > const & rArguments,
+ rtl::OUString * pValue)
+ SAL_THROW(())
+{
+ if (!getStringRequestArgument(rArguments,
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "Uri")),
+ pValue))
+ return false;
+ // Use the resource name only for file URLs, to avoid confusion:
+ //TODO! work with ucp locality concept instead of hardcoded "file"?
+ if (pValue
+ && pValue->matchIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM(
+ "file:")))
+ getStringRequestArgument(rArguments,
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "ResourceName")),
+ pValue);
+ return true;
+}
+
+} // namespace
+
+bool
+UUIInteractionHelper::handleInteractiveIOException(
+ uno::Reference< task::XInteractionRequest > const & rRequest,
+ bool bObtainErrorStringOnly,
+ bool & bHasErrorString,
+ rtl::OUString & rErrorString)
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Any aAnyRequest(rRequest->getRequest());
+ bHasErrorString = false;
+
+ ucb::InteractiveIOException aIoException;
+ if (aAnyRequest >>= aIoException)
+ {
+ uno::Sequence< uno::Any > aRequestArguments;
+ ucb::InteractiveAugmentedIOException aAugmentedIoException;
+ if (aAnyRequest >>= aAugmentedIoException)
+ aRequestArguments = aAugmentedIoException.Arguments;
+
+ ErrCode nErrorCode;
+ std::vector< rtl::OUString > aArguments;
+ static ErrCode const
+ aErrorCode[ucb::IOErrorCode_WRONG_VERSION + 1][2]
+ = { { ERRCODE_IO_ABORT, ERRCODE_UUI_IO_ABORT }, // ABORT
+ { ERRCODE_IO_ACCESSDENIED, ERRCODE_UUI_IO_ACCESSDENIED },
+ // ACCESS_DENIED
+ { ERRCODE_IO_ALREADYEXISTS,
+ ERRCODE_UUI_IO_ALREADYEXISTS }, // ALREADY_EXISTING
+ { ERRCODE_IO_BADCRC, ERRCODE_UUI_IO_BADCRC }, // BAD_CRC
+ { ERRCODE_IO_CANTCREATE, ERRCODE_UUI_IO_CANTCREATE },
+ // CANT_CREATE
+ { ERRCODE_IO_CANTREAD, ERRCODE_UUI_IO_CANTREAD },
+ // CANT_READ
+ { ERRCODE_IO_CANTSEEK, ERRCODE_UUI_IO_CANTSEEK },
+ // CANT_SEEK
+ { ERRCODE_IO_CANTTELL, ERRCODE_UUI_IO_CANTTELL },
+ // CANT_TELL
+ { ERRCODE_IO_CANTWRITE, ERRCODE_UUI_IO_CANTWRITE },
+ // CANT_WRITE
+ { ERRCODE_IO_CURRENTDIR, ERRCODE_UUI_IO_CURRENTDIR },
+ // CURRENT_DIRECTORY
+ { ERRCODE_IO_DEVICENOTREADY, ERRCODE_UUI_IO_NOTREADY },
+ // DEVICE_NOT_READY
+ { ERRCODE_IO_NOTSAMEDEVICE,
+ ERRCODE_UUI_IO_NOTSAMEDEVICE }, // DIFFERENT_DEVICES
+ { ERRCODE_IO_GENERAL, ERRCODE_UUI_IO_GENERAL }, // GENERAL
+ { ERRCODE_IO_INVALIDACCESS,
+ ERRCODE_UUI_IO_INVALIDACCESS }, // INVALID_ACCESS
+ { ERRCODE_IO_INVALIDCHAR, ERRCODE_UUI_IO_INVALIDCHAR },
+ // INVALID_CHARACTER
+ { ERRCODE_IO_INVALIDDEVICE,
+ ERRCODE_UUI_IO_INVALIDDEVICE }, // INVALID_DEVICE
+ { ERRCODE_IO_INVALIDLENGTH,
+ ERRCODE_UUI_IO_INVALIDLENGTH }, // INVALID_LENGTH
+ { ERRCODE_IO_INVALIDPARAMETER,
+ ERRCODE_UUI_IO_INVALIDPARAMETER }, // INVALID_PARAMETER
+ { ERRCODE_IO_ISWILDCARD, ERRCODE_UUI_IO_ISWILDCARD },
+ // IS_WILDCARD
+ { ERRCODE_IO_LOCKVIOLATION,
+ ERRCODE_UUI_IO_LOCKVIOLATION }, // LOCKING_VIOLATION
+ { ERRCODE_IO_MISPLACEDCHAR,
+ ERRCODE_UUI_IO_MISPLACEDCHAR }, // MISPLACED_CHARACTER
+ { ERRCODE_IO_NAMETOOLONG, ERRCODE_UUI_IO_NAMETOOLONG },
+ // NAME_TOO_LONG
+ { ERRCODE_IO_NOTEXISTS, ERRCODE_UUI_IO_NOTEXISTS },
+ // NOT_EXISTING
+ { ERRCODE_IO_NOTEXISTSPATH,
+ ERRCODE_UUI_IO_NOTEXISTSPATH }, // NOT_EXISTING_PATH
+ { ERRCODE_IO_NOTSUPPORTED, ERRCODE_UUI_IO_NOTSUPPORTED },
+ // NOT_SUPPORTED
+ { ERRCODE_IO_NOTADIRECTORY,
+ ERRCODE_UUI_IO_NOTADIRECTORY }, // NO_DIRECTORY
+ { ERRCODE_IO_NOTAFILE, ERRCODE_UUI_IO_NOTAFILE },
+ // NO_FILE
+ { ERRCODE_IO_OUTOFSPACE, ERRCODE_UUI_IO_OUTOFSPACE },
+ // OUT_OF_DISK_SPACE
+ { ERRCODE_IO_TOOMANYOPENFILES,
+ ERRCODE_UUI_IO_TOOMANYOPENFILES },
+ // OUT_OF_FILE_HANDLES
+ { ERRCODE_IO_OUTOFMEMORY, ERRCODE_UUI_IO_OUTOFMEMORY },
+ // OUT_OF_MEMORY
+ { ERRCODE_IO_PENDING, ERRCODE_UUI_IO_PENDING }, // PENDING
+ { ERRCODE_IO_RECURSIVE, ERRCODE_UUI_IO_RECURSIVE },
+ // RECURSIVE
+ { ERRCODE_IO_UNKNOWN, ERRCODE_UUI_IO_UNKNOWN }, // UNKNOWN
+ { ERRCODE_IO_WRITEPROTECTED,
+ ERRCODE_UUI_IO_WRITEPROTECTED }, // WRITE_PROTECTED
+ { ERRCODE_IO_WRONGFORMAT, ERRCODE_UUI_IO_WRONGFORMAT },
+ // WRONG_FORMAT
+ { ERRCODE_IO_WRONGVERSION,
+ ERRCODE_UUI_IO_WRONGVERSION } }; // WRONG_VERSION
+ switch (aIoException.Code)
+ {
+ case ucb::IOErrorCode_CANT_CREATE:
+ {
+ rtl::OUString aArgFolder;
+ if (getStringRequestArgument(
+ aRequestArguments,
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "Folder")),
+ &aArgFolder))
+ {
+ rtl::OUString aArgUri;
+ if (getResourceNameRequestArgument(aRequestArguments,
+ &aArgUri))
+ {
+ nErrorCode = ERRCODE_UUI_IO_CANTCREATE;
+ aArguments.reserve(2);
+ aArguments.push_back(aArgUri);
+ aArguments.push_back(aArgFolder);
+ }
+ else
+ {
+ nErrorCode = ERRCODE_UUI_IO_CANTCREATE_NONAME;
+ aArguments.push_back(aArgFolder);
+ }
+ }
+ else
+ nErrorCode = aErrorCode[aIoException.Code][0];
+ break;
+ }
+
+ case ucb::IOErrorCode_DEVICE_NOT_READY:
+ {
+ rtl::OUString aArgUri;
+ if (getResourceNameRequestArgument(aRequestArguments,
+ &aArgUri))
+ {
+ rtl::OUString aResourceType;
+ getStringRequestArgument(
+ aRequestArguments,
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "ResourceType")),
+ &aResourceType);
+ bool bRemovable = false;
+ getBoolRequestArgument(aRequestArguments,
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "Removable")),
+ &bRemovable);
+ nErrorCode
+ = aResourceType.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("volume"))
+ ? (bRemovable
+ ? ERRCODE_UUI_IO_NOTREADY_VOLUME_REMOVABLE
+ : ERRCODE_UUI_IO_NOTREADY_VOLUME)
+ : (bRemovable
+ ? ERRCODE_UUI_IO_NOTREADY_REMOVABLE
+ : ERRCODE_UUI_IO_NOTREADY);
+ aArguments.push_back(aArgUri);
+ }
+ else
+ nErrorCode = aErrorCode[aIoException.Code][0];
+ break;
+ }
+
+ case ucb::IOErrorCode_DIFFERENT_DEVICES:
+ {
+ rtl::OUString aArgVolume;
+ rtl::OUString aArgOtherVolume;
+ if (getStringRequestArgument(
+ aRequestArguments,
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "Volume")),
+ &aArgVolume)
+ && getStringRequestArgument(
+ aRequestArguments,
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "OtherVolume")),
+ &aArgOtherVolume))
+ {
+ nErrorCode = aErrorCode[aIoException.Code][1];
+ aArguments.reserve(2);
+ aArguments.push_back(aArgVolume);
+ aArguments.push_back(aArgOtherVolume);
+ }
+ else
+ nErrorCode = aErrorCode[aIoException.Code][0];
+ break;
+ }
+
+ case ucb::IOErrorCode_NOT_EXISTING:
+ {
+ rtl::OUString aArgUri;
+ if (getResourceNameRequestArgument(aRequestArguments,
+ &aArgUri))
+ {
+ rtl::OUString aResourceType;
+ getStringRequestArgument(
+ aRequestArguments,
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "ResourceType")),
+ &aResourceType);
+ nErrorCode
+ = aResourceType.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("volume"))
+ ? ERRCODE_UUI_IO_NOTEXISTS_VOLUME
+ : (aResourceType.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("folder"))
+ ? ERRCODE_UUI_IO_NOTEXISTS_FOLDER
+ : ERRCODE_UUI_IO_NOTEXISTS);
+ aArguments.push_back(aArgUri);
+ }
+ else
+ nErrorCode = aErrorCode[aIoException.Code][0];
+ break;
+ }
+
+ default:
+ {
+ rtl::OUString aArgUri;
+ if (getResourceNameRequestArgument(aRequestArguments,
+ &aArgUri))
+ {
+ nErrorCode = aErrorCode[aIoException.Code][1];
+ aArguments.push_back(aArgUri);
+ }
+ else
+ nErrorCode = aErrorCode[aIoException.Code][0];
+ break;
+ }
+ }
+
+ handleErrorHandlerRequest(aIoException.Classification,
+ nErrorCode,
+ aArguments,
+ rRequest->getContinuations(),
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString);
+ return true;
+ }
+ return false;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/iahndl-locking.cxx b/uui/source/iahndl-locking.cxx
new file mode 100644
index 000000000000..ee8c0742b0d8
--- /dev/null
+++ b/uui/source/iahndl-locking.cxx
@@ -0,0 +1,318 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include <memory>
+
+#include "com/sun/star/document/ChangedByOthersRequest.hpp"
+#include "com/sun/star/document/LockedDocumentRequest.hpp"
+#include "com/sun/star/document/LockedOnSavingRequest.hpp"
+#include "com/sun/star/document/LockFileIgnoreRequest.hpp"
+#include "com/sun/star/document/OwnLockOnDocumentRequest.hpp"
+#include "com/sun/star/task/XInteractionApprove.hpp"
+#include "com/sun/star/task/XInteractionDisapprove.hpp"
+#include "com/sun/star/task/XInteractionAbort.hpp"
+#include "com/sun/star/task/XInteractionRequest.hpp"
+
+#include "osl/mutex.hxx"
+#include "vcl/svapp.hxx"
+#include "vcl/msgbox.hxx"
+
+#include "ids.hrc"
+#include "getcontinuations.hxx"
+#include "openlocked.hxx"
+#include "trylater.hxx"
+#include "alreadyopen.hxx"
+#include "filechanged.hxx"
+#include "lockfailed.hxx"
+
+#include "iahndl.hxx"
+
+#define UUI_DOC_LOAD_LOCK 0
+#define UUI_DOC_OWN_LOAD_LOCK 1
+#define UUI_DOC_SAVE_LOCK 2
+#define UUI_DOC_OWN_SAVE_LOCK 3
+
+using namespace com::sun::star;
+
+namespace {
+
+void
+handleLockedDocumentRequest_(
+ Window * pParent,
+ const ::rtl::OUString& aDocumentURL,
+ const ::rtl::OUString& aInfo,
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
+ rContinuations,
+ sal_uInt16 nMode )
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Reference< task::XInteractionApprove > xApprove;
+ uno::Reference< task::XInteractionDisapprove > xDisapprove;
+ uno::Reference< task::XInteractionAbort > xAbort;
+ getContinuations(rContinuations, &xApprove, &xDisapprove, &xAbort);
+
+ if ( !xApprove.is() || !xDisapprove.is() || !xAbort.is() )
+ return;
+
+ try
+ {
+ SolarMutexGuard aGuard;
+ std::auto_ptr< ResMgr > xManager(
+ ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
+ if (!xManager.get())
+ return;
+
+ ::rtl::OUString aMessage;
+ std::vector< rtl::OUString > aArguments;
+ aArguments.push_back( aDocumentURL );
+
+ sal_Int32 nResult = RET_CANCEL;
+ if ( nMode == UUI_DOC_LOAD_LOCK )
+ {
+ aArguments.push_back( aInfo.getLength()
+ ? aInfo
+ : ::rtl::OUString( String(
+ ResId( STR_UNKNOWNUSER,
+ *xManager.get() ) ) ) );
+ aMessage = String( ResId( STR_OPENLOCKED_MSG, *xManager.get() ) );
+ aMessage = UUIInteractionHelper::replaceMessageWithArguments(
+ aMessage, aArguments );
+
+ std::auto_ptr< OpenLockedQueryBox > xDialog(new OpenLockedQueryBox(
+ pParent, xManager.get(), aMessage ) );
+ nResult = xDialog->Execute();
+ }
+ else if ( nMode == UUI_DOC_SAVE_LOCK )
+ {
+ aArguments.push_back( aInfo.getLength()
+ ? aInfo
+ : ::rtl::OUString( String(
+ ResId( STR_UNKNOWNUSER,
+ *xManager.get() ) ) ) );
+ aMessage = String( ResId( STR_TRYLATER_MSG, *xManager.get() ) );
+ aMessage = UUIInteractionHelper::replaceMessageWithArguments(
+ aMessage, aArguments );
+
+ std::auto_ptr< TryLaterQueryBox > xDialog(
+ new TryLaterQueryBox( pParent, xManager.get(), aMessage ) );
+ nResult = xDialog->Execute();
+ }
+ else if ( nMode == UUI_DOC_OWN_LOAD_LOCK ||
+ nMode == UUI_DOC_OWN_SAVE_LOCK )
+ {
+ aArguments.push_back( aInfo );
+ aMessage = String( ResId( nMode == UUI_DOC_OWN_SAVE_LOCK
+ ? STR_ALREADYOPEN_SAVE_MSG
+ : STR_ALREADYOPEN_MSG,
+ *xManager.get() ) );
+ aMessage = UUIInteractionHelper::replaceMessageWithArguments(
+ aMessage, aArguments );
+
+ std::auto_ptr< AlreadyOpenQueryBox > xDialog(
+ new AlreadyOpenQueryBox( pParent,
+ xManager.get(),
+ aMessage,
+ nMode == UUI_DOC_OWN_SAVE_LOCK ) );
+ nResult = xDialog->Execute();
+ }
+
+ if ( nResult == RET_YES )
+ xApprove->select();
+ else if ( nResult == RET_NO )
+ xDisapprove->select();
+ else
+ xAbort->select();
+ }
+ catch (std::bad_alloc const &)
+ {
+ throw uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
+ uno::Reference< uno::XInterface >());
+ }
+}
+
+void
+handleChangedByOthersRequest_(
+ Window * pParent,
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
+ rContinuations )
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Reference< task::XInteractionApprove > xApprove;
+ uno::Reference< task::XInteractionAbort > xAbort;
+ getContinuations(rContinuations, &xApprove, &xAbort);
+
+ if ( !xApprove.is() || !xAbort.is() )
+ return;
+
+ try
+ {
+ SolarMutexGuard aGuard;
+ std::auto_ptr< ResMgr > xManager(
+ ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
+ if (!xManager.get())
+ return;
+
+ std::auto_ptr< FileChangedQueryBox > xDialog(
+ new FileChangedQueryBox( pParent, xManager.get() ) );
+ sal_Int32 nResult = xDialog->Execute();
+
+ if ( nResult == RET_YES )
+ xApprove->select();
+ else
+ xAbort->select();
+ }
+ catch (std::bad_alloc const &)
+ {
+ throw uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
+ uno::Reference< uno::XInterface >());
+ }
+}
+
+void
+handleLockFileIgnoreRequest_(
+ Window * pParent,
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
+ rContinuations )
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Reference< task::XInteractionApprove > xApprove;
+ uno::Reference< task::XInteractionAbort > xAbort;
+ getContinuations(rContinuations, &xApprove, &xAbort);
+
+ if ( !xApprove.is() || !xAbort.is() )
+ return;
+
+ try
+ {
+ SolarMutexGuard aGuard;
+ std::auto_ptr< ResMgr > xManager(
+ ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
+ if (!xManager.get())
+ return;
+
+ std::auto_ptr< LockFailedQueryBox > xDialog(
+ new LockFailedQueryBox( pParent, xManager.get() ) );
+ sal_Int32 nResult = xDialog->Execute();
+
+ if ( nResult == RET_OK )
+ xApprove->select();
+ else
+ xAbort->select();
+ }
+ catch (std::bad_alloc const &)
+ {
+ throw uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
+ uno::Reference< uno::XInterface >());
+ }
+}
+
+} // namespace
+
+bool
+UUIInteractionHelper::handleLockedDocumentRequest(
+ uno::Reference< task::XInteractionRequest > const & rRequest)
+ SAL_THROW((::com::sun::star::uno::RuntimeException))
+{
+ uno::Any aAnyRequest(rRequest->getRequest());
+
+ document::LockedDocumentRequest aLockedDocumentRequest;
+ if (aAnyRequest >>= aLockedDocumentRequest )
+ {
+ handleLockedDocumentRequest_( getParentProperty(),
+ aLockedDocumentRequest.DocumentURL,
+ aLockedDocumentRequest.UserInfo,
+ rRequest->getContinuations(),
+ UUI_DOC_LOAD_LOCK );
+ return true;
+ }
+
+ document::OwnLockOnDocumentRequest aOwnLockOnDocumentRequest;
+ if (aAnyRequest >>= aOwnLockOnDocumentRequest )
+ {
+ handleLockedDocumentRequest_( getParentProperty(),
+ aOwnLockOnDocumentRequest.DocumentURL,
+ aOwnLockOnDocumentRequest.TimeInfo,
+ rRequest->getContinuations(),
+ aOwnLockOnDocumentRequest.IsStoring
+ ? UUI_DOC_OWN_SAVE_LOCK
+ : UUI_DOC_OWN_LOAD_LOCK );
+ return true;
+ }
+
+ document::LockedOnSavingRequest aLockedOnSavingRequest;
+ if (aAnyRequest >>= aLockedOnSavingRequest )
+ {
+ handleLockedDocumentRequest_( getParentProperty(),
+ aLockedOnSavingRequest.DocumentURL,
+ aLockedOnSavingRequest.UserInfo,
+ rRequest->getContinuations(),
+ UUI_DOC_SAVE_LOCK );
+ return true;
+ }
+ return false;
+}
+
+bool
+UUIInteractionHelper::handleChangedByOthersRequest(
+ uno::Reference< task::XInteractionRequest > const & rRequest)
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Any aAnyRequest(rRequest->getRequest());
+
+ document::ChangedByOthersRequest aChangedByOthersRequest;
+ if (aAnyRequest >>= aChangedByOthersRequest )
+ {
+ handleChangedByOthersRequest_( getParentProperty(),
+ rRequest->getContinuations() );
+ return true;
+ }
+ return false;
+}
+
+bool
+UUIInteractionHelper::handleLockFileIgnoreRequest(
+ uno::Reference< task::XInteractionRequest > const & rRequest)
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Any aAnyRequest(rRequest->getRequest());
+
+ document::LockFileIgnoreRequest aLockFileIgnoreRequest;
+ if (aAnyRequest >>= aLockFileIgnoreRequest )
+ {
+ handleLockFileIgnoreRequest_( getParentProperty(),
+ rRequest->getContinuations() );
+ return true;
+ }
+ return false;
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/iahndl-ssl.cxx b/uui/source/iahndl-ssl.cxx
new file mode 100644
index 000000000000..3c8452fb6b1b
--- /dev/null
+++ b/uui/source/iahndl-ssl.cxx
@@ -0,0 +1,359 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "com/sun/star/security/CertificateValidity.hpp"
+#include "com/sun/star/task/XInteractionAbort.hpp"
+#include "com/sun/star/task/XInteractionApprove.hpp"
+#include "com/sun/star/task/XInteractionRequest.hpp"
+#include "com/sun/star/ucb/CertificateValidationRequest.hpp"
+
+#include "osl/mutex.hxx"
+#include "tools/datetime.hxx"
+#include "svl/zforlist.hxx"
+#include "vcl/svapp.hxx"
+
+#include "ids.hrc"
+#include "getcontinuations.hxx"
+#include "sslwarndlg.hxx"
+#include "unknownauthdlg.hxx"
+
+#include "iahndl.hxx"
+
+#define DESCRIPTION_1 1
+#define DESCRIPTION_2 2
+#define TITLE 3
+
+using namespace com::sun::star;
+
+namespace {
+
+String
+getContentPart( const String& _rRawString )
+{
+ // search over some parts to find a string
+ //static char* aIDs[] = { "CN", "OU", "O", "E", NULL };
+ static char const * aIDs[] = { "CN=", "OU=", "O=", "E=", NULL };// By CP
+ String sPart;
+ int i = 0;
+ while ( aIDs[i] )
+ {
+ String sPartId = String::CreateFromAscii( aIDs[i++] );
+ xub_StrLen nContStart = _rRawString.Search( sPartId );
+ if ( nContStart != STRING_NOTFOUND )
+ {
+ nContStart = nContStart + sPartId.Len();
+ xub_StrLen nContEnd
+ = _rRawString.Search( sal_Unicode( ',' ), nContStart );
+ sPart = String( _rRawString, nContStart, nContEnd - nContStart );
+ break;
+ }
+ }
+ return sPart;
+}
+
+bool
+isDomainMatch(
+ rtl::OUString hostName, rtl::OUString certHostName)
+{
+ if (hostName.equalsIgnoreAsciiCase( certHostName ))
+ return true;
+
+ if ( 0 == certHostName.indexOf( rtl::OUString::createFromAscii( "*" ) ) &&
+ hostName.getLength() >= certHostName.getLength() )
+ {
+ rtl::OUString cmpStr = certHostName.copy( 1 );
+
+ if ( hostName.matchIgnoreAsciiCase(
+ cmpStr, hostName.getLength() - cmpStr.getLength()) )
+ return true;
+ }
+
+ return false;
+}
+
+rtl::OUString
+getLocalizedDatTimeStr(
+ uno::Reference< lang::XMultiServiceFactory > const & xServiceFactory,
+ util::DateTime const & rDateTime )
+{
+ rtl::OUString aDateTimeStr;
+ Date aDate;
+ Time aTime;
+
+ aDate = Date( rDateTime.Day, rDateTime.Month, rDateTime.Year );
+ aTime = Time( rDateTime.Hours, rDateTime.Minutes, rDateTime.Seconds );
+
+ LanguageType eUILang = Application::GetSettings().GetUILanguage();
+ SvNumberFormatter *pNumberFormatter
+ = new SvNumberFormatter( xServiceFactory, eUILang );
+ String aTmpStr;
+ Color* pColor = NULL;
+ Date* pNullDate = pNumberFormatter->GetNullDate();
+ sal_uInt32 nFormat
+ = pNumberFormatter->GetStandardFormat( NUMBERFORMAT_DATE, eUILang );
+
+ pNumberFormatter->GetOutputString(
+ aDate - *pNullDate, nFormat, aTmpStr, &pColor );
+ aDateTimeStr = aTmpStr + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" "));
+
+ nFormat = pNumberFormatter->GetStandardFormat( NUMBERFORMAT_TIME, eUILang );
+ pNumberFormatter->GetOutputString(
+ aTime.GetTimeInDays(), nFormat, aTmpStr, &pColor );
+ aDateTimeStr += aTmpStr;
+
+ return aDateTimeStr;
+}
+
+sal_Bool
+executeUnknownAuthDialog(
+ Window * pParent,
+ uno::Reference< lang::XMultiServiceFactory > const & xServiceFactory,
+ const uno::Reference< security::XCertificate >& rXCert)
+ SAL_THROW((uno::RuntimeException))
+{
+ try
+ {
+ SolarMutexGuard aGuard;
+
+ std::auto_ptr< ResMgr > xManager(
+ ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
+ std::auto_ptr< UnknownAuthDialog > xDialog(
+ new UnknownAuthDialog( pParent,
+ rXCert,
+ xServiceFactory,
+ xManager.get()));
+
+ // Get correct ressource string
+ rtl::OUString aMessage;
+
+ std::vector< rtl::OUString > aArguments;
+ aArguments.push_back( getContentPart( rXCert->getSubjectName()) );
+
+ if (xManager.get())
+ {
+ ResId aResId(RID_UUI_ERRHDL, *xManager.get());
+ if (ErrorResource(aResId).getString(
+ ERRCODE_UUI_UNKNOWNAUTH_UNTRUSTED, &aMessage))
+ {
+ aMessage = UUIInteractionHelper::replaceMessageWithArguments(
+ aMessage, aArguments );
+ xDialog->setDescriptionText( aMessage );
+ }
+ }
+
+ return static_cast<sal_Bool> (xDialog->Execute());
+ }
+ catch (std::bad_alloc const &)
+ {
+ throw uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
+ uno::Reference< uno::XInterface >());
+ }
+}
+
+sal_Bool
+executeSSLWarnDialog(
+ Window * pParent,
+ uno::Reference< lang::XMultiServiceFactory > const & xServiceFactory,
+ const uno::Reference< security::XCertificate >& rXCert,
+ sal_Int32 const & failure,
+ const rtl::OUString & hostName )
+ SAL_THROW((uno::RuntimeException))
+{
+ try
+ {
+ SolarMutexGuard aGuard;
+
+ std::auto_ptr< ResMgr > xManager(
+ ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
+ std::auto_ptr< SSLWarnDialog > xDialog(
+ new SSLWarnDialog( pParent,
+ rXCert,
+ xServiceFactory,
+ xManager.get()));
+
+ // Get correct ressource string
+ rtl::OUString aMessage_1;
+ std::vector< rtl::OUString > aArguments_1;
+
+ switch( failure )
+ {
+ case SSLWARN_TYPE_DOMAINMISMATCH:
+ aArguments_1.push_back( hostName );
+ aArguments_1.push_back(
+ getContentPart( rXCert->getSubjectName()) );
+ aArguments_1.push_back( hostName );
+ break;
+ case SSLWARN_TYPE_EXPIRED:
+ aArguments_1.push_back(
+ getContentPart( rXCert->getSubjectName()) );
+ aArguments_1.push_back(
+ getLocalizedDatTimeStr( xServiceFactory,
+ rXCert->getNotValidAfter() ) );
+ aArguments_1.push_back(
+ getLocalizedDatTimeStr( xServiceFactory,
+ rXCert->getNotValidAfter() ) );
+ break;
+ case SSLWARN_TYPE_INVALID:
+ break;
+ }
+
+ if (xManager.get())
+ {
+ ResId aResId(RID_UUI_ERRHDL, *xManager.get());
+ if (ErrorResource(aResId).getString(
+ ERRCODE_AREA_UUI_UNKNOWNAUTH + failure + DESCRIPTION_1,
+ &aMessage_1))
+ {
+ aMessage_1 = UUIInteractionHelper::replaceMessageWithArguments(
+ aMessage_1, aArguments_1 );
+ xDialog->setDescription1Text( aMessage_1 );
+ }
+
+ rtl::OUString aTitle;
+ ErrorResource(aResId).getString(
+ ERRCODE_AREA_UUI_UNKNOWNAUTH + failure + TITLE, &aTitle);
+ xDialog->SetText( aTitle );
+ }
+
+ return static_cast<sal_Bool> (xDialog->Execute());
+ }
+ catch (std::bad_alloc const &)
+ {
+ throw uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
+ uno::Reference< uno::XInterface >());
+ }
+}
+
+void
+handleCertificateValidationRequest_(
+ Window * pParent,
+ uno::Reference< lang::XMultiServiceFactory > const & xServiceFactory,
+ ucb::CertificateValidationRequest const & rRequest,
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
+ rContinuations)
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Reference< task::XInteractionApprove > xApprove;
+ uno::Reference< task::XInteractionAbort > xAbort;
+ getContinuations(rContinuations, &xApprove, &xAbort);
+
+ sal_Int32 failures = rRequest.CertificateValidity;
+ sal_Bool trustCert = sal_True;
+
+ if ( ((failures & security::CertificateValidity::UNTRUSTED)
+ == security::CertificateValidity::UNTRUSTED ) ||
+ ((failures & security::CertificateValidity::ISSUER_UNTRUSTED)
+ == security::CertificateValidity::ISSUER_UNTRUSTED) ||
+ ((failures & security::CertificateValidity::ROOT_UNTRUSTED)
+ == security::CertificateValidity::ROOT_UNTRUSTED) )
+ {
+ trustCert = executeUnknownAuthDialog( pParent,
+ xServiceFactory,
+ rRequest.Certificate );
+ }
+
+ if ( (!isDomainMatch(
+ rRequest.HostName,
+ getContentPart(
+ rRequest.Certificate->getSubjectName()) )) &&
+ trustCert )
+ {
+ trustCert = executeSSLWarnDialog( pParent,
+ xServiceFactory,
+ rRequest.Certificate,
+ SSLWARN_TYPE_DOMAINMISMATCH,
+ rRequest.HostName );
+ }
+
+ if ( (((failures & security::CertificateValidity::TIME_INVALID)
+ == security::CertificateValidity::TIME_INVALID) ||
+ ((failures & security::CertificateValidity::NOT_TIME_NESTED)
+ == security::CertificateValidity::NOT_TIME_NESTED)) &&
+ trustCert )
+ {
+ trustCert = executeSSLWarnDialog( pParent,
+ xServiceFactory,
+ rRequest.Certificate,
+ SSLWARN_TYPE_EXPIRED,
+ rRequest.HostName );
+ }
+
+ if ( (((failures & security::CertificateValidity::REVOKED)
+ == security::CertificateValidity::REVOKED) ||
+ ((failures & security::CertificateValidity::SIGNATURE_INVALID)
+ == security::CertificateValidity::SIGNATURE_INVALID) ||
+ ((failures & security::CertificateValidity::EXTENSION_INVALID)
+ == security::CertificateValidity::EXTENSION_INVALID) ||
+ ((failures & security::CertificateValidity::INVALID)
+ == security::CertificateValidity::INVALID)) &&
+ trustCert )
+ {
+ trustCert = executeSSLWarnDialog( pParent,
+ xServiceFactory,
+ rRequest.Certificate,
+ SSLWARN_TYPE_INVALID,
+ rRequest.HostName );
+ }
+
+ if ( trustCert )
+ {
+ if (xApprove.is())
+ xApprove->select();
+ }
+ else
+ {
+ if (xAbort.is())
+ xAbort->select();
+ }
+}
+
+} // namespace
+
+bool
+UUIInteractionHelper::handleCertificateValidationRequest(
+ uno::Reference< task::XInteractionRequest > const & rRequest)
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Any aAnyRequest(rRequest->getRequest());
+
+ ucb::CertificateValidationRequest aCertificateValidationRequest;
+ if (aAnyRequest >>= aCertificateValidationRequest)
+ {
+ handleCertificateValidationRequest_(getParentProperty(),
+ m_xServiceFactory,
+ aCertificateValidationRequest,
+ rRequest->getContinuations());
+ return true;
+ }
+
+ return false;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx
new file mode 100644
index 000000000000..a119399dcc1a
--- /dev/null
+++ b/uui/source/iahndl.cxx
@@ -0,0 +1,1507 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include <memory>
+
+#include "com/sun/star/awt/XWindow.hpp"
+#include "com/sun/star/beans/PropertyValue.hpp"
+#include "com/sun/star/configuration/backend/MergeRecoveryRequest.hpp"
+#include "com/sun/star/configuration/backend/StratumCreationException.hpp"
+#include "com/sun/star/container/XHierarchicalNameAccess.hpp"
+#include "com/sun/star/document/BrokenPackageRequest.hpp"
+#include "com/sun/star/task/DocumentMacroConfirmationRequest.hpp"
+#include "com/sun/star/java/WrongJavaVersionException.hpp"
+#include "com/sun/star/lang/XInitialization.hpp"
+#include "com/sun/star/lang/XMultiServiceFactory.hpp"
+#include "com/sun/star/script/ModuleSizeExceededRequest.hpp"
+#include "com/sun/star/sync2/BadPartnershipException.hpp"
+#include "com/sun/star/task/ErrorCodeIOException.hpp"
+#include "com/sun/star/task/ErrorCodeRequest.hpp"
+#include "com/sun/star/task/FutureDocumentVersionProductUpdateRequest.hpp"
+#include "com/sun/star/task/XInteractionAbort.hpp"
+#include "com/sun/star/task/XInteractionApprove.hpp"
+#include "com/sun/star/task/XInteractionAskLater.hpp"
+#include "com/sun/star/task/XInteractionDisapprove.hpp"
+#include "com/sun/star/task/XInteractionHandler2.hpp"
+#include "com/sun/star/task/XInteractionRequest.hpp"
+#include "com/sun/star/task/XInteractionRetry.hpp"
+#include "com/sun/star/ucb/InteractiveAppException.hpp"
+#include "com/sun/star/ucb/InteractiveCHAOSException.hpp"
+#include "com/sun/star/ucb/InteractiveLockingLockedException.hpp"
+#include "com/sun/star/ucb/InteractiveLockingNotLockedException.hpp"
+#include "com/sun/star/ucb/InteractiveLockingLockExpiredException.hpp"
+#include "com/sun/star/ucb/InteractiveNetworkConnectException.hpp"
+#include "com/sun/star/ucb/InteractiveNetworkOffLineException.hpp"
+#include "com/sun/star/ucb/InteractiveNetworkReadException.hpp"
+#include "com/sun/star/ucb/InteractiveNetworkResolveNameException.hpp"
+#include "com/sun/star/ucb/InteractiveNetworkWriteException.hpp"
+#include "com/sun/star/ucb/InteractiveWrongMediumException.hpp"
+#include "com/sun/star/ucb/NameClashException.hpp"
+#include "com/sun/star/ucb/NameClashResolveRequest.hpp"
+#include "com/sun/star/ucb/UnsupportedNameClashException.hpp"
+#include "com/sun/star/ucb/XInteractionReplaceExistingData.hpp"
+#include "com/sun/star/ucb/XInteractionSupplyName.hpp"
+#include "com/sun/star/xforms/InvalidDataOnSubmitException.hpp"
+
+#include "osl/conditn.hxx"
+#include "tools/rcid.h" // RSC_STRING
+#include "tools/errinf.hxx" // ErrorHandler, ErrorContext, ...
+#include "osl/mutex.hxx"
+#include "tools/diagnose_ex.h"
+#include "comphelper/documentconstants.hxx" // ODFVER_012_TEXT
+#include "svtools/sfxecode.hxx" // ERRCODE_SFX_*
+#include "vcl/msgbox.hxx"
+#include "vcl/svapp.hxx"
+#include "unotools/configmgr.hxx"
+#include "toolkit/helper/vclunohelper.hxx"
+#include "comphelper/namedvaluecollection.hxx"
+#include "typelib/typedescription.hxx"
+#include "unotools/confignode.hxx"
+
+#include "ids.hrc"
+
+#include "getcontinuations.hxx"
+#include "secmacrowarnings.hxx"
+#include "newerverwarn.hxx"
+
+#include "iahndl.hxx"
+
+/** === begin UNO using === **/
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::task::XInteractionContinuation;
+using ::com::sun::star::task::XInteractionAbort;
+using ::com::sun::star::task::XInteractionApprove;
+using ::com::sun::star::task::XInteractionAskLater;
+using ::com::sun::star::task::FutureDocumentVersionProductUpdateRequest;
+using ::com::sun::star::uno::XInterface;
+using ::com::sun::star::lang::XInitialization;
+using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::task::XInteractionHandler2;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::task::XInteractionRequest;
+using ::com::sun::star::lang::XMultiServiceFactory;
+/** === end UNO using === **/
+
+using namespace ::com::sun::star;
+
+namespace {
+
+class HandleData : public osl::Condition
+{
+public:
+ HandleData(
+ uno::Reference< task::XInteractionRequest > const & rRequest)
+ : osl::Condition(),
+ m_rRequest(rRequest),
+ bHandled( false )
+ {
+ }
+ uno::Reference< task::XInteractionRequest > m_rRequest;
+ bool bHandled;
+ beans::Optional< rtl::OUString > m_aResult;
+};
+
+} /* namespace */
+
+UUIInteractionHelper::UUIInteractionHelper(
+ uno::Reference< lang::XMultiServiceFactory > const & rServiceFactory,
+ uno::Sequence< uno::Any > const & rArguments)
+ SAL_THROW(()):
+ m_xServiceFactory(rServiceFactory),
+ m_aProperties(rArguments)
+{
+}
+
+UUIInteractionHelper::UUIInteractionHelper(
+ uno::Reference< lang::XMultiServiceFactory > const & rServiceFactory)
+ SAL_THROW(()):
+ m_xServiceFactory(rServiceFactory)
+{
+}
+
+UUIInteractionHelper::~UUIInteractionHelper()
+{
+}
+
+long
+UUIInteractionHelper::handlerequest(
+ void* pHandleData, void* pInteractionHelper)
+{
+ HandleData* pHND
+ = static_cast< HandleData * >(pHandleData);
+ UUIInteractionHelper* pUUI
+ = static_cast< UUIInteractionHelper * >(pInteractionHelper);
+ bool bDummy = false;
+ rtl::OUString aDummy;
+ pHND->bHandled
+ = pUUI->handleRequest_impl(pHND->m_rRequest, false, bDummy, aDummy);
+ pHND->set();
+ return 0;
+}
+
+bool
+UUIInteractionHelper::handleRequest(
+ uno::Reference< task::XInteractionRequest > const & rRequest)
+ SAL_THROW((uno::RuntimeException))
+{
+ Application* pApp = 0;
+ if(
+ // be aware,it is the same type
+ static_cast< oslThreadIdentifier >(
+ Application::GetMainThreadIdentifier())
+ != osl_getThreadIdentifier(NULL)
+ &&
+ (pApp = GetpApp())
+ != 0
+ ) {
+ // we are not in the main thread, let it handle that stuff
+ HandleData aHD(rRequest);
+ Link aLink(&aHD,handlerequest);
+ pApp->PostUserEvent(aLink,this);
+ ULONG locks = Application::ReleaseSolarMutex();
+ aHD.wait();
+ Application::AcquireSolarMutex(locks);
+ return aHD.bHandled;
+ }
+ else
+ {
+ bool bDummy = false;
+ rtl::OUString aDummy;
+ return handleRequest_impl(rRequest, false, bDummy, aDummy);
+ }
+}
+
+long
+UUIInteractionHelper::getstringfromrequest(
+ void* pHandleData,void* pInteractionHelper)
+{
+ HandleData* pHND = (HandleData*) pHandleData;
+ UUIInteractionHelper* pUUI = (UUIInteractionHelper*) pInteractionHelper;
+ pHND->m_aResult = pUUI->getStringFromRequest_impl(pHND->m_rRequest);
+ pHND->set();
+ return 0;
+}
+
+beans::Optional< rtl::OUString >
+UUIInteractionHelper::getStringFromRequest_impl(
+ uno::Reference< task::XInteractionRequest > const & rRequest)
+ SAL_THROW((uno::RuntimeException))
+{
+ bool bSuccess = false;
+ rtl::OUString aMessage;
+ handleRequest_impl(rRequest, true, bSuccess, aMessage);
+
+ OSL_ENSURE(bSuccess ||
+ !isInformationalErrorMessageRequest(
+ rRequest->getContinuations()),
+ "Interaction request is a candidate for a string representation."
+ "Please implement!");
+
+ return beans::Optional< rtl::OUString >(bSuccess, aMessage);
+}
+
+beans::Optional< rtl::OUString >
+UUIInteractionHelper::getStringFromRequest(
+ uno::Reference< task::XInteractionRequest > const & rRequest)
+ SAL_THROW((uno::RuntimeException))
+{
+ Application* pApp = 0;
+ if(
+ // be aware,it is the same type
+ static_cast< oslThreadIdentifier >(
+ Application::GetMainThreadIdentifier())
+ != osl_getThreadIdentifier(NULL)
+ &&
+ (pApp = GetpApp())
+ != 0
+ ) {
+ // we are not in the main thread, let it handle that stuff
+ HandleData aHD(rRequest);
+ Link aLink(&aHD,getstringfromrequest);
+ pApp->PostUserEvent(aLink,this);
+ ULONG locks = Application::ReleaseSolarMutex();
+ aHD.wait();
+ Application::AcquireSolarMutex(locks);
+ return aHD.m_aResult;
+ }
+ else
+ return getStringFromRequest_impl(rRequest);
+}
+
+::rtl::OUString
+UUIInteractionHelper::replaceMessageWithArguments(
+ ::rtl::OUString aMessage,
+ std::vector< rtl::OUString > const & rArguments )
+{
+ for (sal_Int32 i = 0;;)
+ {
+ i = aMessage.
+ indexOf(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("$(ARG")), i);
+ if (i == -1)
+ break;
+ if (aMessage.getLength() - i >= RTL_CONSTASCII_LENGTH("$(ARGx)")
+ && aMessage.getStr()[i + RTL_CONSTASCII_LENGTH("$(ARGx")] == ')')
+ {
+ sal_Unicode c
+ = aMessage.getStr()[i + RTL_CONSTASCII_LENGTH("$(ARG")];
+ if (c >= '1' && c <= '2')
+ {
+ std::vector< rtl::OUString >::size_type nIndex
+ = static_cast< std::vector< rtl::OUString >::size_type >(
+ c - '1');
+ if (nIndex < rArguments.size())
+ {
+ aMessage
+ = aMessage.replaceAt(i,
+ RTL_CONSTASCII_LENGTH("$(ARGx)"),
+ rArguments[nIndex]);
+ i += rArguments[nIndex].getLength();
+ continue;
+ }
+ }
+ }
+ ++i;
+ }
+
+ return aMessage;
+}
+
+bool
+UUIInteractionHelper::isInformationalErrorMessageRequest(
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
+ rContinuations)
+{
+ // Only requests with a single continuation (user has no choice, request
+ // is just informational)
+ if (rContinuations.getLength() != 1 )
+ return false;
+
+ // user can only abort or approve, all other continuations are not
+ // considered to be informational.
+ uno::Reference< task::XInteractionApprove > xApprove(
+ rContinuations[0], uno::UNO_QUERY);
+ if (xApprove.is())
+ return true;
+
+ uno::Reference< task::XInteractionAbort > xAbort(
+ rContinuations[0], uno::UNO_QUERY);
+ if (xAbort.is())
+ return true;
+
+ return false;
+}
+
+bool
+UUIInteractionHelper::tryOtherInteractionHandler(
+ uno::Reference< task::XInteractionRequest > const & rRequest)
+ SAL_THROW((uno::RuntimeException))
+{
+ InteractionHandlerDataList dataList;
+ getInteractionHandlerList(dataList);
+
+ InteractionHandlerDataList::const_iterator aEnd(dataList.end());
+ for (InteractionHandlerDataList::const_iterator aIt(dataList.begin());
+ aIt != aEnd;
+ ++aIt)
+ {
+ if ( handleCustomRequest( rRequest, aIt->ServiceName ) )
+ return true;
+ }
+ return false;
+}
+
+namespace
+{
+ // .................................................................................................................
+ static bool lcl_matchesRequest( const Any& i_rRequest, const ::rtl::OUString& i_rTypeName, const ::rtl::OUString& i_rPropagation )
+ {
+ const ::com::sun::star::uno::TypeDescription aTypeDesc( i_rTypeName );
+ const typelib_TypeDescription* pTypeDesc = aTypeDesc.get();
+ if ( !pTypeDesc || !pTypeDesc->pWeakRef )
+ {
+#if OSL_DEBUG_LEVEL > 0
+ ::rtl::OStringBuffer aMessage;
+ aMessage.append( "no type found for '" );
+ aMessage.append( ::rtl::OUStringToOString( i_rTypeName, RTL_TEXTENCODING_UTF8 ) );
+ aMessage.append( "'" );
+ OSL_ENSURE( false, aMessage.makeStringAndClear().getStr() );
+#endif
+ return false;
+ }
+ const ::com::sun::star::uno::Type aType( pTypeDesc->pWeakRef );
+
+ const bool bExactMatch = ( i_rPropagation.compareToAscii( "named-only" ) == 0 );
+ if ( bExactMatch )
+ return i_rRequest.getValueType().equals( aType );
+
+ return i_rRequest.isExtractableTo( aType );
+ }
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+bool UUIInteractionHelper::handleCustomRequest( const Reference< XInteractionRequest >& i_rRequest, const ::rtl::OUString& i_rServiceName ) const
+{
+ try
+ {
+ Reference< XInteractionHandler2 > xHandler( m_xServiceFactory->createInstance( i_rServiceName ), UNO_QUERY_THROW );
+
+ Reference< XInitialization > xHandlerInit( xHandler, UNO_QUERY );
+ if ( xHandlerInit.is() )
+ {
+ ::comphelper::NamedValueCollection aInitArgs;
+ aInitArgs.put( "Parent", getParentXWindow() );
+ xHandlerInit->initialize( aInitArgs.getWrappedPropertyValues() );
+ }
+
+ if ( xHandler->handleInteractionRequest( i_rRequest ) )
+ return true;
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return false;
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+bool UUIInteractionHelper::handleTypedHandlerImplementations( Reference< XInteractionRequest > const & rRequest )
+{
+ // the request
+ const Any aRequest( rRequest->getRequest() );
+
+ const StringHashMap::const_iterator aCacheHitTest = m_aTypedCustomHandlers.find( aRequest.getValueTypeName() );
+ if ( aCacheHitTest != m_aTypedCustomHandlers.end() )
+ return handleCustomRequest( rRequest, aCacheHitTest->second );
+
+ // the base registration node for "typed" interaction handlers
+ const ::utl::OConfigurationTreeRoot aConfigRoot( ::utl::OConfigurationTreeRoot::createWithServiceFactory(
+ m_xServiceFactory,
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Interaction/InteractionHandlers" ) ),
+ -1,
+ ::utl::OConfigurationTreeRoot::CM_READONLY
+ ) );
+
+ // loop through all registered implementations
+ const Sequence< ::rtl::OUString > aRegisteredHandlers( aConfigRoot.getNodeNames() );
+ const ::rtl::OUString* pHandlerName = aRegisteredHandlers.getConstArray();
+ const ::rtl::OUString* pHandlersEnd = aRegisteredHandlers.getConstArray() + aRegisteredHandlers.getLength();
+ for ( ; pHandlerName != pHandlersEnd; ++pHandlerName )
+ {
+ const ::utl::OConfigurationNode aHandlerNode( aConfigRoot.openNode( *pHandlerName ) );
+ const ::utl::OConfigurationNode aTypesNode( aHandlerNode.openNode( "HandledRequestTypes" ) );
+
+ // loop through all the types which the current handler is registered for
+ const Sequence< ::rtl::OUString > aHandledTypes( aTypesNode.getNodeNames() );
+ const ::rtl::OUString* pType = aHandledTypes.getConstArray();
+ const ::rtl::OUString* pTypesEnd = aHandledTypes.getConstArray() + aHandledTypes.getLength();
+ for ( ; pType != pTypesEnd; ++pType )
+ {
+ // the UNO type is the node name
+ ::utl::OConfigurationNode aType( aTypesNode.openNode( *pType ) );
+ // and there's a child denoting how the responsibility propagates
+ ::rtl::OUString sPropagation;
+ OSL_VERIFY( aType.getNodeValue( "Propagation" ) >>= sPropagation );
+ if ( lcl_matchesRequest( aRequest, *pType, sPropagation ) )
+ {
+ // retrieve the service/implementation name of the handler
+ ::rtl::OUString sServiceName;
+ OSL_VERIFY( aHandlerNode.getNodeValue( "ServiceName" ) >>= sServiceName );
+ // cache the information who feels responsible for requests of this type
+ m_aTypedCustomHandlers[ aRequest.getValueTypeName() ] = sServiceName;
+ // actually handle the request
+ return handleCustomRequest( rRequest, sServiceName );
+ }
+ }
+ }
+
+ return false;
+}
+
+bool
+UUIInteractionHelper::handleRequest_impl(
+ uno::Reference< task::XInteractionRequest > const & rRequest,
+ bool bObtainErrorStringOnly,
+ bool & bHasErrorString,
+ rtl::OUString & rErrorString)
+ SAL_THROW((uno::RuntimeException))
+{
+ try
+ {
+ if (!rRequest.is())
+ return false;
+
+ uno::Any aAnyRequest(rRequest->getRequest());
+
+ script::ModuleSizeExceededRequest aModSizeException;
+ if (aAnyRequest >>= aModSizeException )
+ {
+ ErrCode nErrorCode = ERRCODE_UUI_IO_MODULESIZEEXCEEDED;
+ std::vector< rtl::OUString > aArguments;
+ uno::Sequence< rtl::OUString > sModules
+ = aModSizeException.Names;
+ if ( sModules.getLength() )
+ {
+ rtl::OUString aName;
+ for ( sal_Int32 index=0; index< sModules.getLength(); ++index )
+ {
+ if ( index )
+ aName = aName + rtl::OUString( ',' ) + sModules[index];
+ else
+ aName = sModules[index]; // 1st name
+ }
+ aArguments.push_back( aName );
+ }
+ handleErrorHandlerRequest( task::InteractionClassification_WARNING,
+ nErrorCode,
+ aArguments,
+ rRequest->getContinuations(),
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString);
+ return true;
+ }
+
+ ucb::NameClashException aNCException;
+ if (aAnyRequest >>= aNCException)
+ {
+ ErrCode nErrorCode = ERRCODE_UUI_IO_TARGETALREADYEXISTS;
+ std::vector< rtl::OUString > aArguments;
+
+ if( aNCException.Name.getLength() )
+ {
+ nErrorCode = ERRCODE_UUI_IO_ALREADYEXISTS;
+ aArguments.push_back( aNCException.Name );
+ }
+
+ handleErrorHandlerRequest( aNCException.Classification,
+ nErrorCode,
+ aArguments,
+ rRequest->getContinuations(),
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString);
+ return true;
+ }
+
+ ucb::UnsupportedNameClashException aUORequest;
+ if (aAnyRequest >>= aUORequest)
+ {
+ ErrCode nErrorCode = ERRCODE_UUI_IO_UNSUPPORTEDOVERWRITE;
+ std::vector< rtl::OUString > aArguments;
+
+ uno::Reference< task::XInteractionApprove > xApprove;
+ uno::Reference< task::XInteractionDisapprove > xDisapprove;
+ getContinuations(
+ rRequest->getContinuations(), &xApprove, &xDisapprove);
+
+ if ( xApprove.is() && xDisapprove.is() )
+ {
+ handleErrorHandlerRequest( task::InteractionClassification_QUERY,
+ nErrorCode,
+ aArguments,
+ rRequest->getContinuations(),
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString);
+ }
+ return true;
+ }
+
+ if ( handleInteractiveIOException( rRequest,
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString ) )
+ return true;
+
+ ucb::InteractiveAppException aAppException;
+ if (aAnyRequest >>= aAppException)
+ {
+ std::vector< rtl::OUString > aArguments;
+ handleErrorHandlerRequest( aAppException.Classification,
+ aAppException.Code,
+ aArguments,
+ rRequest->getContinuations(),
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString);
+ return true;
+ }
+
+ ucb::InteractiveNetworkException aNetworkException;
+ if (aAnyRequest >>= aNetworkException)
+ {
+ ErrCode nErrorCode;
+ std::vector< rtl::OUString > aArguments;
+ ucb::InteractiveNetworkOffLineException aOffLineException;
+ ucb::InteractiveNetworkResolveNameException aResolveNameException;
+ ucb::InteractiveNetworkConnectException aConnectException;
+ ucb::InteractiveNetworkReadException aReadException;
+ ucb::InteractiveNetworkWriteException aWriteException;
+ if (aAnyRequest >>= aOffLineException)
+ nErrorCode = ERRCODE_INET_OFFLINE;
+ else if (aAnyRequest >>= aResolveNameException)
+ {
+ nErrorCode = ERRCODE_INET_NAME_RESOLVE;
+ aArguments.push_back(aResolveNameException.Server);
+ }
+ else if (aAnyRequest >>= aConnectException)
+ {
+ nErrorCode = ERRCODE_INET_CONNECT;
+ aArguments.push_back(aConnectException.Server);
+ }
+ else if (aAnyRequest >>= aReadException)
+ {
+ nErrorCode = ERRCODE_INET_READ;
+ aArguments.push_back(aReadException.Diagnostic);
+ }
+ else if (aAnyRequest >>= aWriteException)
+ {
+ nErrorCode = ERRCODE_INET_WRITE;
+ aArguments.push_back(aWriteException.Diagnostic);
+ }
+ else
+ nErrorCode = ERRCODE_INET_GENERAL;
+
+ handleErrorHandlerRequest(aNetworkException.Classification,
+ nErrorCode,
+ aArguments,
+ rRequest->getContinuations(),
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString);
+ return true;
+ }
+
+ ucb::InteractiveCHAOSException aChaosException;
+ if (aAnyRequest >>= aChaosException)
+ {
+ std::vector< rtl::OUString > aArguments;
+ sal_Int32 nCount
+ = std::min< sal_Int32 >(aChaosException.Arguments.getLength(),
+ 2);
+ aArguments.
+ reserve(static_cast< std::vector< rtl::OUString >::size_type >(
+ nCount));
+ for (sal_Int32 i = 0; i < nCount; ++i)
+ aArguments.push_back(aChaosException.Arguments[i]);
+ handleErrorHandlerRequest(aChaosException.Classification,
+ aChaosException.ID,
+ aArguments,
+ rRequest->getContinuations(),
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString);
+ return true;
+ }
+
+ ucb::InteractiveWrongMediumException aWrongMediumException;
+ if (aAnyRequest >>= aWrongMediumException)
+ {
+ sal_Int32 nMedium = 0;
+ aWrongMediumException.Medium >>= nMedium;
+ std::vector< rtl::OUString > aArguments;
+ aArguments.push_back(UniString::CreateFromInt32(nMedium + 1));
+ handleErrorHandlerRequest(aWrongMediumException.Classification,
+ ERRCODE_UUI_WRONGMEDIUM,
+ aArguments,
+ rRequest->getContinuations(),
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString);
+ return true;
+ }
+
+ java::WrongJavaVersionException aWrongJavaVersionException;
+ if (aAnyRequest >>= aWrongJavaVersionException)
+ {
+ ErrCode nErrorCode;
+ std::vector< rtl::OUString > aArguments;
+ if (aWrongJavaVersionException.DetectedVersion.getLength() == 0)
+ if (aWrongJavaVersionException.LowestSupportedVersion.
+ getLength()
+ == 0)
+ nErrorCode = ERRCODE_UUI_WRONGJAVA;
+ else
+ {
+ nErrorCode = ERRCODE_UUI_WRONGJAVA_MIN;
+ aArguments.push_back(aWrongJavaVersionException.
+ LowestSupportedVersion);
+ }
+ else if (aWrongJavaVersionException.LowestSupportedVersion.
+ getLength()
+ == 0)
+ {
+ nErrorCode = ERRCODE_UUI_WRONGJAVA_VERSION;
+ aArguments.push_back(aWrongJavaVersionException.
+ DetectedVersion);
+ }
+ else
+ {
+ nErrorCode = ERRCODE_UUI_WRONGJAVA_VERSION_MIN;
+ aArguments.reserve(2);
+ aArguments.push_back(aWrongJavaVersionException.
+ DetectedVersion);
+ aArguments.push_back(aWrongJavaVersionException.
+ LowestSupportedVersion);
+ }
+ handleErrorHandlerRequest(task::InteractionClassification_ERROR,
+ nErrorCode,
+ aArguments,
+ rRequest->getContinuations(),
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString);
+ return true;
+ }
+
+ sync2::BadPartnershipException aBadPartnershipException;
+ if (aAnyRequest >>= aBadPartnershipException)
+ {
+ ErrCode nErrorCode;
+ std::vector< rtl::OUString > aArguments;
+ if (aBadPartnershipException.Partnership.getLength() == 0)
+ nErrorCode = ERRCODE_UUI_BADPARTNERSHIP;
+ else
+ {
+ nErrorCode = ERRCODE_UUI_BADPARTNERSHIP_NAME;
+ aArguments.push_back(aBadPartnershipException.Partnership);
+ }
+ handleErrorHandlerRequest(task::InteractionClassification_ERROR,
+ nErrorCode,
+ aArguments,
+ rRequest->getContinuations(),
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString);
+ return true;
+ }
+
+ configuration::backend::MergeRecoveryRequest aMergeRecoveryRequest;
+ if (aAnyRequest >>= aMergeRecoveryRequest)
+ {
+ ErrCode nErrorCode = aMergeRecoveryRequest.IsRemovalRequest
+ ? ERRCODE_UUI_CONFIGURATION_BROKENDATA_WITHREMOVE
+ : ERRCODE_UUI_CONFIGURATION_BROKENDATA_NOREMOVE;
+
+ std::vector< rtl::OUString > aArguments;
+ aArguments.push_back(aMergeRecoveryRequest.ErrorLayerId);
+
+ handleErrorHandlerRequest(task::InteractionClassification_ERROR,
+ nErrorCode,
+ aArguments,
+ rRequest->getContinuations(),
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString);
+ return true;
+ }
+
+ configuration::backend::StratumCreationException
+ aStratumCreationException;
+
+ if (aAnyRequest >>= aStratumCreationException)
+ {
+ const ErrCode nErrorCode = ERRCODE_UUI_CONFIGURATION_BACKENDMISSING;
+
+ rtl::OUString aStratum = aStratumCreationException.StratumData;
+ if (aStratum.getLength() == 0)
+ aStratum = aStratumCreationException.StratumService;
+
+ std::vector< rtl::OUString > aArguments;
+ aArguments.push_back(aStratum);
+
+ handleErrorHandlerRequest(task::InteractionClassification_ERROR,
+ nErrorCode,
+ aArguments,
+ rRequest->getContinuations(),
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString);
+ return true;
+ }
+
+ xforms::InvalidDataOnSubmitException aInvalidDataOnSubmitException;
+ if (aAnyRequest >>= aInvalidDataOnSubmitException)
+ {
+ const ErrCode nErrorCode =
+ ERRCODE_UUI_INVALID_XFORMS_SUBMISSION_DATA;
+
+ std::vector< rtl::OUString > aArguments;
+
+ handleErrorHandlerRequest(task::InteractionClassification_QUERY,
+ nErrorCode,
+ aArguments,
+ rRequest->getContinuations(),
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString);
+ return true;
+ }
+
+ ucb::InteractiveLockingLockedException aLLException;
+ if (aAnyRequest >>= aLLException)
+ {
+ ErrCode nErrorCode = aLLException.SelfOwned
+ ? ERRCODE_UUI_LOCKING_LOCKED_SELF : ERRCODE_UUI_LOCKING_LOCKED;
+ std::vector< rtl::OUString > aArguments;
+ aArguments.push_back( aLLException.Url );
+
+ handleErrorHandlerRequest( aLLException.Classification,
+ nErrorCode,
+ aArguments,
+ rRequest->getContinuations(),
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString );
+ return true;
+ }
+
+ ucb::InteractiveLockingNotLockedException aLNLException;
+ if (aAnyRequest >>= aLNLException)
+ {
+ ErrCode nErrorCode = ERRCODE_UUI_LOCKING_NOT_LOCKED;
+ std::vector< rtl::OUString > aArguments;
+ aArguments.push_back( aLNLException.Url );
+
+ handleErrorHandlerRequest( aLNLException.Classification,
+ nErrorCode,
+ aArguments,
+ rRequest->getContinuations(),
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString );
+ return true;
+ }
+
+ ucb::InteractiveLockingLockExpiredException aLLEException;
+ if (aAnyRequest >>= aLLEException)
+ {
+ ErrCode nErrorCode = ERRCODE_UUI_LOCKING_LOCK_EXPIRED;
+ std::vector< rtl::OUString > aArguments;
+ aArguments.push_back( aLLEException.Url );
+
+ handleErrorHandlerRequest( aLLEException.Classification,
+ nErrorCode,
+ aArguments,
+ rRequest->getContinuations(),
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString );
+ return true;
+ }
+
+ document::BrokenPackageRequest aBrokenPackageRequest;
+ if (aAnyRequest >>= aBrokenPackageRequest)
+ {
+ std::vector< rtl::OUString > aArguments;
+
+ if( aBrokenPackageRequest.aName.getLength() )
+ aArguments.push_back( aBrokenPackageRequest.aName );
+
+ handleBrokenPackageRequest( aArguments,
+ rRequest->getContinuations(),
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString );
+ return true;
+ }
+
+ task::ErrorCodeRequest aErrorCodeRequest;
+ if (aAnyRequest >>= aErrorCodeRequest)
+ {
+ handleGenericErrorRequest( aErrorCodeRequest.ErrCode,
+ rRequest->getContinuations(),
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString);
+ return true;
+ }
+
+ task::ErrorCodeIOException aErrorCodeIOException;
+ if (aAnyRequest >>= aErrorCodeIOException)
+ {
+ handleGenericErrorRequest( aErrorCodeIOException.ErrCode,
+ rRequest->getContinuations(),
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString);
+ return true;
+ }
+
+
+ ///////////////////////////////////////////////////////////////////
+ // Handle requests which do not have a plain string representation.
+ ///////////////////////////////////////////////////////////////////
+ if (!bObtainErrorStringOnly)
+ {
+ if ( handleAuthenticationRequest( rRequest ) )
+ return true;
+
+ if ( handleCertificateValidationRequest( rRequest ) )
+ return true;
+
+ if ( handleMasterPasswordRequest( rRequest ) )
+ return true;
+
+ if ( handlePasswordRequest( rRequest ) )
+ return true;
+
+ if ( handleCookiesRequest( rRequest ) )
+ return true;
+
+ if ( handleNoSuchFilterRequest( rRequest ) )
+ return true;
+
+ if ( handleAmbigousFilterRequest( rRequest ) )
+ return true;
+
+ if ( handleFilterOptionsRequest( rRequest ) )
+ return true;
+
+ if ( handleLockedDocumentRequest( rRequest ) )
+ return true;
+
+ if ( handleChangedByOthersRequest( rRequest ) )
+ return true;
+
+ if ( handleLockFileIgnoreRequest( rRequest ) )
+ return true;
+
+ task::DocumentMacroConfirmationRequest aMacroConfirmRequest;
+ if (aAnyRequest >>= aMacroConfirmRequest)
+ {
+ handleMacroConfirmRequest(
+ aMacroConfirmRequest.DocumentURL,
+ aMacroConfirmRequest.DocumentStorage,
+ aMacroConfirmRequest.DocumentVersion.getLength() ? aMacroConfirmRequest.DocumentVersion : ODFVER_012_TEXT,
+ aMacroConfirmRequest.DocumentSignatureInformation,
+ rRequest->getContinuations());
+ return true;
+ }
+
+ task::FutureDocumentVersionProductUpdateRequest
+ aProductUpdateRequest;
+ if (aAnyRequest >>= aProductUpdateRequest)
+ {
+ handleFutureDocumentVersionUpdateRequest(
+ aProductUpdateRequest,
+ rRequest->getContinuations());
+ return true;
+ }
+
+ ///////////////////////////////////////////////////////////////
+ // Last chance: interaction handlers registered in the configuration
+ ///////////////////////////////////////////////////////////////
+
+ // typed InteractionHandlers (ooo.Interactions)
+ if ( handleTypedHandlerImplementations( rRequest ) )
+ return true;
+
+ // legacy configuration (ooo.ucb.InteractionHandlers)
+ if (tryOtherInteractionHandler( rRequest ))
+ return true;
+ }
+
+ // Not handled.
+ return false;
+ }
+ catch (std::bad_alloc const &)
+ {
+ throw uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
+ uno::Reference< uno::XInterface >());
+ }
+ catch( const uno::RuntimeException& )
+ {
+ throw; // allowed to leave here
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return false;
+}
+
+void
+UUIInteractionHelper::getInteractionHandlerList(
+ InteractionHandlerDataList &rdataList)
+ SAL_THROW((uno::RuntimeException))
+{
+ try
+ {
+ uno::Reference< lang::XMultiServiceFactory > xConfigProv(
+ m_xServiceFactory->createInstance(
+ rtl::OUString::createFromAscii(
+ "com.sun.star.configuration.ConfigurationProvider" ) ),
+ uno::UNO_QUERY );
+
+ if ( !xConfigProv.is() )
+ throw uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "unable to instanciate config provider service")),
+ uno::Reference< uno::XInterface >());
+
+ rtl::OUStringBuffer aFullPath;
+ aFullPath.appendAscii(
+ "/org.openoffice.ucb.InteractionHandler/InteractionHandlers" );
+
+ uno::Sequence< uno::Any > aArguments( 1 );
+ beans::PropertyValue aProperty;
+ aProperty.Name
+ = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) );
+ aProperty.Value <<= aFullPath.makeStringAndClear();
+ aArguments[ 0 ] <<= aProperty;
+
+ uno::Reference< uno::XInterface > xInterface(
+ xConfigProv->createInstanceWithArguments(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.configuration.ConfigurationAccess" ) ),
+ aArguments ) );
+
+ if ( !xInterface.is() )
+ throw uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "unable to instanciate config access")),
+ uno::Reference< uno::XInterface >());
+
+ uno::Reference< container::XNameAccess > xNameAccess(
+ xInterface, uno::UNO_QUERY );
+ if ( !xNameAccess.is() )
+ throw uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "config access does not implement XNameAccess")),
+ uno::Reference< uno::XInterface >());
+
+ uno::Sequence< rtl::OUString > aElems = xNameAccess->getElementNames();
+ const rtl::OUString* pElems = aElems.getConstArray();
+ sal_Int32 nCount = aElems.getLength();
+
+ if ( nCount > 0 )
+ {
+ uno::Reference< container::XHierarchicalNameAccess >
+ xHierNameAccess( xInterface, uno::UNO_QUERY );
+
+ if ( !xHierNameAccess.is() )
+ throw uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "config access does not implement XHierarchicalNameAccess")),
+ uno::Reference< uno::XInterface >());
+
+ // Iterate over children.
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ rtl::OUStringBuffer aElemBuffer;
+ aElemBuffer.appendAscii( "['" );
+ aElemBuffer.append( pElems[ n ] );
+
+ try
+ {
+ InteractionHandlerData aInfo;
+
+ // Obtain service name.
+ rtl::OUStringBuffer aKeyBuffer = aElemBuffer;
+ aKeyBuffer.appendAscii( "']/ServiceName" );
+
+ rtl::OUString aValue;
+ if ( !( xHierNameAccess->getByHierarchicalName(
+ aKeyBuffer.makeStringAndClear() ) >>= aValue ) )
+ {
+ OSL_ENSURE( false,
+ "GetInteractionHandlerList - "
+ "Error getting item value!" );
+ continue;
+ }
+
+ aInfo.ServiceName = aValue;
+
+ // Append info to list.
+ rdataList.push_back( aInfo );
+ }
+ catch ( container::NoSuchElementException& )
+ {
+ // getByHierarchicalName
+
+ OSL_ENSURE( false,
+ "GetInteractionHandlerList - "
+ "caught NoSuchElementException!" );
+ }
+ }
+ }
+ }
+ catch ( uno::RuntimeException const & )
+ {
+ throw;
+ }
+ catch ( uno::Exception const & )
+ {
+ OSL_ENSURE( false, "GetInteractionHandlerList - Caught Exception!" );
+ }
+}
+
+Window *
+UUIInteractionHelper::getParentProperty()
+ SAL_THROW(())
+{
+ uno::Reference< awt::XWindow > xWindow = getParentXWindow();
+ if ( xWindow.is() )
+ return VCLUnoHelper::GetWindow(xWindow);
+
+ return 0;
+}
+
+uno::Reference< awt::XWindow>
+UUIInteractionHelper::getParentXWindow() const
+ SAL_THROW(())
+{
+ osl::MutexGuard aGuard(m_aPropertyMutex);
+ ::comphelper::NamedValueCollection aProperties( m_aProperties );
+ if ( aProperties.has( "Parent" ) )
+ {
+ uno::Reference< awt::XWindow > xWindow;
+ OSL_VERIFY( aProperties.get( "Parent" ) >>= xWindow );
+ return xWindow;
+ }
+ return 0;
+}
+
+rtl::OUString
+UUIInteractionHelper::getContextProperty()
+ SAL_THROW(())
+{
+ osl::MutexGuard aGuard(m_aPropertyMutex);
+ for (sal_Int32 i = 0; i < m_aProperties.getLength(); ++i)
+ {
+ beans::PropertyValue aProperty;
+ if ((m_aProperties[i] >>= aProperty)
+ && aProperty.
+ Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Context")))
+ {
+ rtl::OUString aContext;
+ aProperty.Value >>= aContext;
+ return aContext;
+ }
+ }
+ return rtl::OUString();
+}
+
+uno::Reference< task::XInteractionHandler >
+UUIInteractionHelper::getInteractionHandler()
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Reference< task::XInteractionHandler > xIH;
+ try
+ {
+ xIH.set(m_xServiceFactory->createInstanceWithArguments(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.task.InteractionHandler")),
+ m_aProperties),
+ uno::UNO_QUERY);
+ }
+ catch (uno::Exception const &)
+ {}
+
+ if (!xIH.is())
+ throw uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "unable to instanciate Interaction Handler service")),
+ uno::Reference< uno::XInterface >());
+ return xIH;
+}
+
+namespace {
+
+USHORT
+executeMessageBox(
+ Window * pParent,
+ rtl::OUString const & rTitle,
+ rtl::OUString const & rMessage,
+ WinBits nButtonMask )
+ SAL_THROW((uno::RuntimeException))
+{
+ SolarMutexGuard aGuard;
+
+ MessBox xBox( pParent, nButtonMask, rTitle, rMessage );
+
+ USHORT aResult = xBox.Execute();
+ switch( aResult )
+ {
+ case BUTTONID_OK:
+ aResult = ERRCODE_BUTTON_OK;
+ break;
+ case BUTTONID_CANCEL:
+ aResult = ERRCODE_BUTTON_CANCEL;
+ break;
+ case BUTTONID_YES:
+ aResult = ERRCODE_BUTTON_YES;
+ break;
+ case BUTTONID_NO:
+ aResult = ERRCODE_BUTTON_NO;
+ break;
+ case BUTTONID_RETRY:
+ aResult = ERRCODE_BUTTON_RETRY;
+ break;
+ }
+
+ return aResult;
+}
+
+} // namespace
+
+void
+UUIInteractionHelper::handleGenericErrorRequest(
+ sal_Int32 nErrorCode,
+ uno::Sequence< uno::Reference<
+ task::XInteractionContinuation > > const & rContinuations,
+ bool bObtainErrorStringOnly,
+ bool & bHasErrorString,
+ rtl::OUString & rErrorString)
+ SAL_THROW((uno::RuntimeException))
+{
+ if (bObtainErrorStringOnly)
+ {
+ bHasErrorString = isInformationalErrorMessageRequest(rContinuations);
+ if (bHasErrorString)
+ {
+ String aErrorString;
+ ErrorHandler::GetErrorString(nErrorCode, aErrorString);
+ rErrorString = aErrorString;
+ }
+ }
+ else
+ {
+ uno::Reference< task::XInteractionAbort > xAbort;
+ uno::Reference< task::XInteractionApprove > xApprove;
+ getContinuations(rContinuations, &xApprove, &xAbort);
+
+ // Note: It's important to convert the transported long to the
+ // required unsigned long value. Otherwhise using as flag field
+ // can fail ...
+ ErrCode nError = static_cast< ErrCode >(nErrorCode);
+ sal_Bool bWarning = !ERRCODE_TOERROR(nError);
+
+ if ( nError == ERRCODE_SFX_BROKENSIGNATURE
+ || nError == ERRCODE_SFX_INCOMPLETE_ENCRYPTION )
+ {
+ // the security warning box needs a special title
+ String aErrorString;
+ ErrorHandler::GetErrorString( nErrorCode, aErrorString );
+
+ std::auto_ptr< ResMgr > xManager(
+ ResMgr::CreateResMgr( CREATEVERSIONRESMGR_NAME( uui ) ) );
+ ::rtl::OUString aTitle;
+
+ try
+ {
+ uno::Any aProductNameAny =
+ ::utl::ConfigManager::GetConfigManager()
+ .GetDirectConfigProperty(
+ ::utl::ConfigManager::PRODUCTNAME );
+ aProductNameAny >>= aTitle;
+ }
+ catch( uno::Exception& )
+ {
+ }
+
+ ::rtl::OUString aErrTitle
+ = String( ResId( nError == ERRCODE_SFX_BROKENSIGNATURE
+ ? STR_WARNING_BROKENSIGNATURE_TITLE
+ : STR_WARNING_INCOMPLETE_ENCRYPTION_TITLE,
+ *xManager.get() ) );
+
+ if ( aTitle.getLength() && aErrTitle.getLength() )
+ aTitle += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " - " ) );
+ aTitle += aErrTitle;
+
+ executeMessageBox(
+ getParentProperty(), aTitle, aErrorString, WB_OK );
+ }
+ else
+ ErrorHandler::HandleError(nErrorCode);
+
+ if (xApprove.is() && bWarning)
+ xApprove->select();
+ else if (xAbort.is())
+ xAbort->select();
+ }
+}
+
+void
+UUIInteractionHelper::handleMacroConfirmRequest(
+ const ::rtl::OUString& aDocumentURL,
+ const uno::Reference< embed::XStorage >& xZipStorage,
+ const ::rtl::OUString& aDocumentVersion,
+ const uno::Sequence< security::DocumentSignatureInformation > aSignInfo,
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
+ rContinuations )
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Reference< task::XInteractionAbort > xAbort;
+ uno::Reference< task::XInteractionApprove > xApprove;
+ getContinuations( rContinuations, &xApprove, &xAbort );
+
+ bool bApprove = false;
+
+ std::auto_ptr< ResMgr > pResMgr(
+ ResMgr::CreateResMgr( CREATEVERSIONRESMGR_NAME( uui ) ) );
+ if ( pResMgr.get() )
+ {
+ bool bShowSignatures = aSignInfo.getLength() > 0;
+ MacroWarning aWarning(
+ getParentProperty(), bShowSignatures, *pResMgr.get() );
+
+ aWarning.SetDocumentURL( aDocumentURL );
+ if ( aSignInfo.getLength() > 1 )
+ {
+ aWarning.SetStorage( xZipStorage, aDocumentVersion, aSignInfo );
+ }
+ else if ( aSignInfo.getLength() == 1 )
+ {
+ aWarning.SetCertificate( aSignInfo[ 0 ].Signer );
+ }
+
+ bApprove = aWarning.Execute() == RET_OK;
+ }
+
+ if ( bApprove && xApprove.is() )
+ xApprove->select();
+ else if ( xAbort.is() )
+ xAbort->select();
+}
+
+void
+UUIInteractionHelper::handleFutureDocumentVersionUpdateRequest(
+ const task::FutureDocumentVersionProductUpdateRequest& _rRequest,
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
+ rContinuations )
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Reference< task::XInteractionAbort > xAbort;
+ uno::Reference< task::XInteractionApprove > xApprove;
+ uno::Reference< task::XInteractionAskLater > xAskLater;
+ getContinuations( rContinuations, &xApprove, &xAbort, &xAskLater );
+
+ short nResult = RET_CANCEL;
+
+ static bool s_bDeferredToNextSession = false;
+ // TODO: this static variable is somewhat hacky. Formerly (before the dialog was moved from SFX2 to the
+ // interaction handler implementation), this was stored in SFX_APP()'s impl structure, in member
+ // bODFVersionWarningLater. Of course, we do not have access to it here.
+ //
+ // A proper solution which I would envision would be:
+ // - There's a central implementation (this one here) of css.task.InteractionHandler
+ // - There's a configuration which maps UNO names to service names
+ // - If the handler is confronted with a request, it tries to find the name of the UNO structure describing
+ // the request in the said configuration.
+ // - If an entry is found, then
+ // - the respective service is instantiated
+ // - the component is queried for css.task.XInteractionHandler, and the request is delegated
+ // - if no entry is found, then the request is silenced (with calling the AbortContinuation, if possible)
+ // This way, the FutureDocumentVersionProductUpdateRequest could be handled in SFX (or any other
+ // suitable place), again, and we would only have one place where we remember the s_bDeferredToNextSession
+ // flag.
+ //
+ // Note: The above pattern has been implemented in CWS autorecovery. Now the remaining task is to move the
+ // handling of this interaction to SFX, again.
+
+ if ( !s_bDeferredToNextSession )
+ {
+ std::auto_ptr< ResMgr > pResMgr(
+ ResMgr::CreateResMgr( CREATEVERSIONRESMGR_NAME( uui ) ) );
+ if ( pResMgr.get() )
+ {
+ ::uui::NewerVersionWarningDialog aDialog(
+ getParentProperty(),
+ _rRequest.DocumentODFVersion,
+ *pResMgr.get() );
+ nResult = aDialog.Execute();
+ }
+ }
+
+ switch ( nResult )
+ {
+ case RET_OK:
+ if ( xApprove.is() )
+ xApprove->select();
+ break;
+ case RET_CANCEL:
+ if ( xAbort.is() )
+ xAbort->select();
+ break;
+ case RET_ASK_LATER:
+ if ( xAskLater.is() )
+ xAskLater->select();
+ s_bDeferredToNextSession = true;
+ break;
+ default:
+ OSL_ENSURE( false,
+ "UUIInteractionHelper::handleFutureDocumentVersionUpdateRequest: "
+ "unexpected dialog return value!" );
+ break;
+ }
+}
+
+void
+UUIInteractionHelper::handleBrokenPackageRequest(
+ std::vector< rtl::OUString > const & rArguments,
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
+ rContinuations,
+ bool bObtainErrorStringOnly,
+ bool & bHasErrorString,
+ rtl::OUString & rErrorString)
+ SAL_THROW((uno::RuntimeException))
+{
+ if (bObtainErrorStringOnly)
+ {
+ bHasErrorString = isInformationalErrorMessageRequest(rContinuations);
+ if (!bHasErrorString)
+ return;
+ }
+
+ uno::Reference< task::XInteractionApprove > xApprove;
+ uno::Reference< task::XInteractionDisapprove > xDisapprove;
+ uno::Reference< task::XInteractionAbort > xAbort;
+ getContinuations(rContinuations, &xApprove, &xDisapprove, &xAbort);
+
+ ErrCode nErrorCode;
+ if( xApprove.is() && xDisapprove.is() )
+ {
+ nErrorCode = ERRCODE_UUI_IO_BROKENPACKAGE;
+ }
+ else if ( xAbort.is() )
+ {
+ nErrorCode = ERRCODE_UUI_IO_BROKENPACKAGE_CANTREPAIR;
+ }
+ else
+ return;
+
+ ::rtl::OUString aMessage;
+ {
+ SolarMutexGuard aGuard;
+ std::auto_ptr< ResMgr > xManager(
+ ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
+ if (!xManager.get())
+ return;
+
+ ResId aResId( RID_UUI_ERRHDL, *xManager.get() );
+ if ( !ErrorResource(aResId).getString(nErrorCode, &aMessage) )
+ return;
+ }
+
+ aMessage = replaceMessageWithArguments( aMessage, rArguments );
+
+ if (bObtainErrorStringOnly)
+ {
+ rErrorString = aMessage;
+ return;
+ }
+
+ WinBits nButtonMask;
+ if( xApprove.is() && xDisapprove.is() )
+ {
+ nButtonMask = WB_YES_NO | WB_DEF_YES;
+ }
+ else if ( xAbort.is() )
+ {
+ nButtonMask = WB_OK;
+ }
+ else
+ return;
+
+ uno::Any aProductNameAny =
+ ::utl::ConfigManager::GetConfigManager().GetDirectConfigProperty(
+ ::utl::ConfigManager::PRODUCTNAME );
+ uno::Any aProductVersionAny =
+ ::utl::ConfigManager::GetConfigManager().GetDirectConfigProperty(
+ ::utl::ConfigManager::PRODUCTVERSION );
+ ::rtl::OUString aProductName, aProductVersion;
+ if ( !( aProductNameAny >>= aProductName ) )
+ aProductName
+ = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StarOffice") );
+
+ ::rtl::OUString aTitle( aProductName );
+ if( aProductVersionAny >>= aProductVersion )
+ {
+ aTitle += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(" ") );
+ aTitle += aProductVersion;
+ }
+
+ switch ( executeMessageBox( getParentProperty(),
+ aTitle,
+ aMessage,
+ nButtonMask ))
+ {
+ case ERRCODE_BUTTON_OK:
+ OSL_ENSURE( xAbort.is(), "unexpected situation" );
+ if (xAbort.is())
+ xAbort->select();
+ break;
+
+ case ERRCODE_BUTTON_NO:
+ OSL_ENSURE(xDisapprove.is(), "unexpected situation");
+ if (xDisapprove.is())
+ xDisapprove->select();
+ break;
+
+ case ERRCODE_BUTTON_YES:
+ OSL_ENSURE(xApprove.is(), "unexpected situation");
+ if (xApprove.is())
+ xApprove->select();
+ break;
+ }
+}
+
+//=========================================================================
+// ErrorResource Implementation
+//=========================================================================
+
+bool
+ErrorResource::getString(ErrCode nErrorCode, rtl::OUString * pString)
+ const SAL_THROW(())
+{
+ OSL_ENSURE(pString, "specification violation");
+ ResId aResId(static_cast< USHORT >(nErrorCode & ERRCODE_RES_MASK),
+ *m_pResMgr);
+ aResId.SetRT(RSC_STRING);
+ if (!IsAvailableRes(aResId))
+ return false;
+ aResId.SetAutoRelease(false);
+ *pString = UniString(aResId);
+ m_pResMgr->PopContext();
+ return true;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/iahndl.hxx b/uui/source/iahndl.hxx
new file mode 100644
index 000000000000..87761aee789a
--- /dev/null
+++ b/uui/source/iahndl.hxx
@@ -0,0 +1,370 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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 UUI_IAHNDL_HXX
+#define UUI_IAHNDL_HXX
+
+#include <vector>
+
+#include "osl/mutex.hxx"
+#include "rtl/ustring.hxx"
+
+#include "com/sun/star/uno/Reference.hxx"
+#include "com/sun/star/uno/Sequence.hxx"
+
+#include "com/sun/star/beans/Optional.hpp"
+#include "com/sun/star/task/InteractionClassification.hpp"
+
+#include "tools/solar.h" // USHORT
+#include "tools/errcode.hxx" // ErrCode
+#include "tools/rc.hxx" // Resource
+#include "vcl/wintypes.hxx" // WinBits
+
+namespace com { namespace sun { namespace star {
+ namespace awt {
+ class XWindow;
+ }
+ namespace embed {
+ class XStorage;
+ }
+ namespace lang {
+ class XMultiServiceFactory;
+ }
+ namespace security {
+ class DocumentSignatureInformation;
+ }
+ namespace task {
+ class FutureDocumentVersionProductUpdateRequest;
+ class XInteractionContinuation;
+ class XInteractionHandler;
+ class XInteractionRequest;
+ }
+ namespace ucb {
+ class NameClashResolveRequest;
+ }
+} } }
+
+#include <hash_map>
+
+class Window;
+
+//============================================================================
+struct InteractionHandlerData
+{
+ /** The UNO service name to use to instanciate the content provider.
+ */
+ rtl::OUString ServiceName;
+
+ InteractionHandlerData() {};
+ InteractionHandlerData(const rtl::OUString & rService)
+ : ServiceName( rService ){}
+};
+
+typedef std::vector< InteractionHandlerData > InteractionHandlerDataList;
+
+typedef ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > Continuations;
+
+typedef ::std::hash_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash > StringHashMap;
+
+//============================================================================
+class UUIInteractionHelper
+{
+private:
+ mutable osl::Mutex m_aPropertyMutex;
+ ::com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceFactory;
+ ::com::sun::star::uno::Sequence< com::sun::star::uno::Any > m_aProperties;
+ StringHashMap m_aTypedCustomHandlers;
+ UUIInteractionHelper(UUIInteractionHelper &); // not implemented
+ void operator =(UUIInteractionHelper); // not implemented
+
+public:
+ UUIInteractionHelper(
+ com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory > const & rServiceFactory,
+ com::sun::star::uno::Sequence<
+ com::sun::star::uno::Any > const & rArguments)
+ SAL_THROW(());
+ UUIInteractionHelper(
+ com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory > const & rServiceFactory)
+ SAL_THROW(());
+
+ ~UUIInteractionHelper() SAL_THROW(());
+
+ bool
+ handleRequest(
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionRequest > const & rRequest)
+ SAL_THROW((com::sun::star::uno::RuntimeException));
+
+ com::sun::star::beans::Optional< rtl::OUString >
+ getStringFromRequest(
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionRequest > const & rRequest)
+ SAL_THROW((com::sun::star::uno::RuntimeException));
+
+ // Helper.
+ static ::rtl::OUString
+ replaceMessageWithArguments(
+ ::rtl::OUString aMessage,
+ std::vector< rtl::OUString > const & rArguments );
+
+private:
+ bool
+ handleRequest_impl(
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionRequest > const & rRequest,
+ bool bObtainErrorStringOnly,
+ bool & bHasErrorString,
+ rtl::OUString & rErrorString)
+ SAL_THROW((com::sun::star::uno::RuntimeException));
+
+ static long
+ handlerequest(void* pHandleData, void* pInteractionHandler);
+
+ com::sun::star::beans::Optional< rtl::OUString >
+ getStringFromRequest_impl(
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionRequest > const & rRequest)
+ SAL_THROW((com::sun::star::uno::RuntimeException));
+
+ static long
+ getstringfromrequest(void* pHandleData, void* pInteractionHandler);
+
+ Window *
+ getParentProperty()
+ SAL_THROW(());
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>
+ getParentXWindow() const
+ SAL_THROW(());
+
+ rtl::OUString
+ getContextProperty()
+ SAL_THROW(());
+
+ com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler >
+ getInteractionHandler()
+ SAL_THROW((com::sun::star::uno::RuntimeException));
+
+ bool handleTypedHandlerImplementations(
+ ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest > const & rRequest
+ );
+
+ bool
+ tryOtherInteractionHandler(
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionRequest > const & rRequest)
+ SAL_THROW((com::sun::star::uno::RuntimeException));
+
+ void
+ getInteractionHandlerList(InteractionHandlerDataList &rdataList)
+ SAL_THROW((com::sun::star::uno::RuntimeException));
+
+ static bool
+ isInformationalErrorMessageRequest(
+ com::sun::star::uno::Sequence<
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionContinuation > > const &
+ rContinuations);
+
+ //=====================================================================
+
+ bool
+ handleInteractiveIOException(
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionRequest > const & rRequest,
+ bool bObtainErrorStringOnly,
+ bool & bHasErrorString,
+ rtl::OUString & rErrorString)
+ SAL_THROW((com::sun::star::uno::RuntimeException));
+
+ bool
+ handleAuthenticationRequest(
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionRequest > const & rRequest)
+ SAL_THROW((com::sun::star::uno::RuntimeException));
+
+ bool
+ handleCertificateValidationRequest(
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionRequest > const & rRequest)
+ SAL_THROW((com::sun::star::uno::RuntimeException));
+
+ bool
+ handleMasterPasswordRequest(
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionRequest > const & rRequest)
+ SAL_THROW((com::sun::star::uno::RuntimeException));
+
+ bool
+ handlePasswordRequest(
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionRequest > const & rRequest)
+ SAL_THROW((com::sun::star::uno::RuntimeException));
+
+ bool
+ handleCookiesRequest(
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionRequest > const & rRequest)
+ SAL_THROW((com::sun::star::uno::RuntimeException));
+
+ bool
+ handleNoSuchFilterRequest(
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionRequest > const & rRequest)
+ SAL_THROW((com::sun::star::uno::RuntimeException));
+
+ bool
+ handleAmbigousFilterRequest(
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionRequest > const & rRequest)
+ SAL_THROW((com::sun::star::uno::RuntimeException));
+
+ bool
+ handleFilterOptionsRequest(
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionRequest > const & rRequest)
+ SAL_THROW((com::sun::star::uno::RuntimeException));
+
+ void
+ handleErrorHandlerRequest(
+ com::sun::star::task::InteractionClassification eClassification,
+ ErrCode nErrorCode,
+ std::vector< rtl::OUString > const & rArguments,
+ com::sun::star::uno::Sequence<
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionContinuation > > const &
+ rContinuations,
+ bool bObtainErrorStringOnly,
+ bool & bHasErrorString,
+ rtl::OUString & rErrorString)
+ SAL_THROW((com::sun::star::uno::RuntimeException));
+
+ void
+ handleGenericErrorRequest(
+ sal_Int32 nErrorCode,
+ com::sun::star::uno::Sequence<
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionContinuation > > const &
+ rContinuations,
+ bool bObtainErrorStringOnly,
+ bool & bHasErrorString,
+ rtl::OUString & rErrorString)
+ SAL_THROW((com::sun::star::uno::RuntimeException));
+
+ void
+ handleMacroConfirmRequest(
+ const ::rtl::OUString& aDocumentURL,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::embed::XStorage >& xZipStorage,
+ const ::rtl::OUString& aDocumentVersion,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::security::DocumentSignatureInformation >
+ aSignInfo,
+ com::sun::star::uno::Sequence<
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionContinuation > > const &
+ rContinuations)
+ SAL_THROW((com::sun::star::uno::RuntimeException));
+
+ void
+ handleFutureDocumentVersionUpdateRequest(
+ const ::com::sun::star::task::FutureDocumentVersionProductUpdateRequest&
+ _rRequest,
+ com::sun::star::uno::Sequence<
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionContinuation > > const &
+ rContinuations)
+ SAL_THROW((com::sun::star::uno::RuntimeException));
+
+ void
+ handleBrokenPackageRequest(
+ std::vector< rtl::OUString > const & rArguments,
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::task::XInteractionContinuation > > const &
+ rContinuations,
+ bool bObtainErrorStringOnly,
+ bool & bHasErrorString,
+ rtl::OUString & rErrorString)
+ SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ bool handleLockedDocumentRequest(
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionRequest > const & rRequest)
+ SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ bool handleChangedByOthersRequest(
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionRequest > const & rRequest)
+ SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ bool handleLockFileIgnoreRequest(
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionRequest > const & rRequest)
+ SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ bool handleCustomRequest(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& i_rRequest,
+ const ::rtl::OUString& i_rServiceName
+ ) const;
+};
+
+class ErrorResource: private Resource
+{
+public:
+ inline ErrorResource(ResId & rResId) SAL_THROW(()): Resource(rResId) {}
+
+ inline ~ErrorResource() SAL_THROW(()) { FreeResource(); }
+
+ bool getString(ErrCode nErrorCode, rtl::OUString * pString) const
+ SAL_THROW(());
+};
+
+/*
+class InteractionRequest
+{
+public:
+ InteractionRequest(
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionRequest > const & rRequest)
+ : m_aRequest( rRequest ) {}
+
+ virtual bool toString( rtl::OUString & rString ) = 0;
+ virtual bool handle( rtl::OUString & rString ) = 0;
+
+private:
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionRequest > m_aRequest;
+};
+*/
+
+#endif // UUI_IAHNDL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/ids.hrc b/uui/source/ids.hrc
new file mode 100755
index 000000000000..2641c5d32974
--- /dev/null
+++ b/uui/source/ids.hrc
@@ -0,0 +1,197 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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 UUI_IDS_HRC
+#define UUI_IDS_HRC
+
+#ifndef _SOLAR_HRC
+#include "svl/solar.hrc"
+#endif
+#ifndef _ERRCODE_HXX
+#include "tools/errcode.hxx"
+#endif
+
+#define RID_KEEP_PASSWORD (RID_UUI_START + 0)
+#define RID_SAVE_PASSWORD (RID_UUI_START + 1)
+#define DLG_UUI_LOGIN (RID_UUI_START + 2)
+#define DLG_COOKIES (RID_UUI_START + 3)
+#define STR_COOKIES_RECV_START (RID_UUI_START + 4)
+#define STR_COOKIES_RECV_COOKIES (RID_UUI_START + 5)
+#define STR_COOKIES_RECV_TITLE (RID_UUI_START + 6)
+#define STR_COOKIES_SEND_START (RID_UUI_START + 7)
+#define STR_COOKIES_SEND_COOKIES (RID_UUI_START + 8)
+#define STR_COOKIES_SEND_TITLE (RID_UUI_START + 9)
+#define DLG_FILTER_SELECT (RID_UUI_START + 10)
+// RID_UUI_START + 11 moved to ERRCODE_UUI_WRONGMEDIUM
+#define DLG_UUI_MASTERPASSWORD (RID_UUI_START + 12)
+#define STR_ERROR_PASSWORDS_NOT_IDENTICAL (RID_UUI_START + 13)
+#define STR_ERROR_MASTERPASSWORD_WRONG (RID_UUI_START + 14)
+// RID_UUI_START + 15, 16, 17 are misused by syncaccess/source/ui/resids.hrc
+#define RID_UUI_ERRHDL (RID_UUI_START + 20)
+#define DLG_UUI_MASTERPASSWORD_CRT (RID_UUI_START + 21)
+#define DLG_UUI_PASSWORD (RID_UUI_START + 22)
+#define DLG_UUI_PASSWORD_CRT (RID_UUI_START + 23)
+#define STR_ERROR_PASSWORD_TO_OPEN_WRONG (RID_UUI_START + 24)
+#define STR_ERROR_PASSWORD_TO_MODIFY_WRONG (RID_UUI_START + 25)
+#define DLG_UUI_UNKNOWNAUTH (RID_UUI_START + 26)
+#define DLG_UUI_UNKNOWNAUTH_CRT (RID_UUI_START + 27)
+#define DLG_UUI_SSLWARN (RID_UUI_START + 28)
+#define DLG_UUI_SSLWARN_CRT (RID_UUI_START + 29)
+#define RID_XMLSECDLG_MACROWARN (RID_UUI_START + 30)
+#define STR_UNKNOWNUSER (RID_UUI_START + 31)
+#define STR_OPENLOCKED_TITLE (RID_UUI_START + 32)
+#define STR_OPENLOCKED_MSG (RID_UUI_START + 33)
+#define STR_OPENLOCKED_OPENREADONLY_BTN (RID_UUI_START + 34)
+#define STR_OPENLOCKED_OPENCOPY_BTN (RID_UUI_START + 35)
+#define STR_FILECHANGED_TITLE (RID_UUI_START + 36)
+#define STR_FILECHANGED_MSG (RID_UUI_START + 37)
+#define STR_FILECHANGED_SAVEANYWAY_BTN (RID_UUI_START + 38)
+#define STR_ALREADYOPEN_TITLE (RID_UUI_START + 39)
+#define STR_ALREADYOPEN_MSG (RID_UUI_START + 40)
+#define STR_ALREADYOPEN_READONLY_BTN (RID_UUI_START + 41)
+#define STR_ALREADYOPEN_OPEN_BTN (RID_UUI_START + 42)
+#define STR_LOCKFAILED_TITLE (RID_UUI_START + 43)
+#define STR_LOCKFAILED_MSG (RID_UUI_START + 44)
+#define STR_LOCKFAILED_DONTSHOWAGAIN (RID_UUI_START + 45)
+#define STR_TRYLATER_TITLE (RID_UUI_START + 46)
+#define STR_TRYLATER_MSG (RID_UUI_START + 47)
+#define STR_TRYLATER_RETRYSAVING_BTN (RID_UUI_START + 48)
+#define STR_TRYLATER_SAVEAS_BTN (RID_UUI_START + 49)
+#define STR_ALREADYOPEN_SAVE_MSG (RID_UUI_START + 50)
+#define STR_ALREADYOPEN_RETRY_SAVE_BTN (RID_UUI_START + 51)
+#define STR_ALREADYOPEN_SAVE_BTN (RID_UUI_START + 52)
+#define RID_DLG_NEWER_VERSION_WARNING (RID_UUI_START + 53)
+#define STR_WARNING_INCOMPLETE_ENCRYPTION_TITLE (RID_UUI_START + 54)
+#define STR_WARNING_BROKENSIGNATURE_TITLE (RID_UUI_START + 55)
+#define STR_ENTER_PASSWORD_TO_OPEN (RID_UUI_START + 56)
+#define STR_ENTER_PASSWORD_TO_MODIFY (RID_UUI_START + 57)
+
+#define ERRCODE_UUI_IO_ABORT (ERRCODE_AREA_UUI + 0)
+#define ERRCODE_UUI_IO_ACCESSDENIED (ERRCODE_AREA_UUI + 1)
+#define ERRCODE_UUI_IO_ALREADYEXISTS (ERRCODE_AREA_UUI + 2)
+#define ERRCODE_UUI_IO_BADCRC (ERRCODE_AREA_UUI + 3)
+#define ERRCODE_UUI_IO_CANTCREATE (ERRCODE_AREA_UUI + 4)
+#define ERRCODE_UUI_IO_CANTREAD (ERRCODE_AREA_UUI + 5)
+#define ERRCODE_UUI_IO_CANTSEEK (ERRCODE_AREA_UUI + 6)
+#define ERRCODE_UUI_IO_CANTTELL (ERRCODE_AREA_UUI + 7)
+#define ERRCODE_UUI_IO_CANTWRITE (ERRCODE_AREA_UUI + 8)
+#define ERRCODE_UUI_IO_CURRENTDIR (ERRCODE_AREA_UUI + 9)
+#define ERRCODE_UUI_IO_NOTREADY (ERRCODE_AREA_UUI + 10)
+#define ERRCODE_UUI_IO_NOTSAMEDEVICE (ERRCODE_AREA_UUI + 11)
+#define ERRCODE_UUI_IO_GENERAL (ERRCODE_AREA_UUI + 12)
+#define ERRCODE_UUI_IO_INVALIDACCESS (ERRCODE_AREA_UUI + 13)
+#define ERRCODE_UUI_IO_INVALIDCHAR (ERRCODE_AREA_UUI + 14)
+#define ERRCODE_UUI_IO_INVALIDDEVICE (ERRCODE_AREA_UUI + 15)
+#define ERRCODE_UUI_IO_INVALIDLENGTH (ERRCODE_AREA_UUI + 16)
+#define ERRCODE_UUI_IO_INVALIDPARAMETER (ERRCODE_AREA_UUI + 17)
+#define ERRCODE_UUI_IO_ISWILDCARD (ERRCODE_AREA_UUI + 18)
+#define ERRCODE_UUI_IO_LOCKVIOLATION (ERRCODE_AREA_UUI + 19)
+#define ERRCODE_UUI_IO_MISPLACEDCHAR (ERRCODE_AREA_UUI + 20)
+#define ERRCODE_UUI_IO_NAMETOOLONG (ERRCODE_AREA_UUI + 21)
+#define ERRCODE_UUI_IO_NOTEXISTS (ERRCODE_AREA_UUI + 22)
+#define ERRCODE_UUI_IO_NOTEXISTSPATH (ERRCODE_AREA_UUI + 23)
+#define ERRCODE_UUI_IO_NOTSUPPORTED (ERRCODE_AREA_UUI + 24)
+#define ERRCODE_UUI_IO_NOTADIRECTORY (ERRCODE_AREA_UUI + 25)
+#define ERRCODE_UUI_IO_NOTAFILE (ERRCODE_AREA_UUI + 26)
+#define ERRCODE_UUI_IO_OUTOFSPACE (ERRCODE_AREA_UUI + 27)
+#define ERRCODE_UUI_IO_TOOMANYOPENFILES (ERRCODE_AREA_UUI + 28)
+#define ERRCODE_UUI_IO_OUTOFMEMORY (ERRCODE_AREA_UUI + 29)
+#define ERRCODE_UUI_IO_PENDING (ERRCODE_AREA_UUI + 30)
+#define ERRCODE_UUI_IO_RECURSIVE (ERRCODE_AREA_UUI + 31)
+#define ERRCODE_UUI_IO_UNKNOWN (ERRCODE_AREA_UUI + 32)
+#define ERRCODE_UUI_IO_WRITEPROTECTED (ERRCODE_AREA_UUI + 33)
+#define ERRCODE_UUI_IO_WRONGFORMAT (ERRCODE_AREA_UUI + 34)
+#define ERRCODE_UUI_IO_WRONGVERSION (ERRCODE_AREA_UUI + 35)
+#define ERRCODE_UUI_IO_NOTEXISTS_VOLUME (ERRCODE_AREA_UUI + 36)
+#define ERRCODE_UUI_IO_NOTEXISTS_FOLDER (ERRCODE_AREA_UUI + 37)
+#define ERRCODE_UUI_WRONGJAVA (ERRCODE_AREA_UUI + 38)
+#define ERRCODE_UUI_WRONGJAVA_VERSION (ERRCODE_AREA_UUI + 39)
+#define ERRCODE_UUI_WRONGJAVA_MIN (ERRCODE_AREA_UUI + 40)
+#define ERRCODE_UUI_WRONGJAVA_VERSION_MIN (ERRCODE_AREA_UUI + 41)
+#define ERRCODE_UUI_BADPARTNERSHIP (ERRCODE_AREA_UUI + 42)
+#define ERRCODE_UUI_BADPARTNERSHIP_NAME (ERRCODE_AREA_UUI + 43)
+#define ERRCODE_UUI_IO_NOTREADY_VOLUME (ERRCODE_AREA_UUI + 44)
+#define ERRCODE_UUI_IO_NOTREADY_REMOVABLE (ERRCODE_AREA_UUI + 45)
+#define ERRCODE_UUI_IO_NOTREADY_VOLUME_REMOVABLE (ERRCODE_AREA_UUI + 46)
+#define ERRCODE_UUI_WRONGMEDIUM (ERRCODE_AREA_UUI + 47)
+#define ERRCODE_UUI_IO_CANTCREATE_NONAME (ERRCODE_AREA_UUI + 48)
+#define ERRCODE_UUI_IO_TARGETALREADYEXISTS (ERRCODE_AREA_UUI + 49)
+#define ERRCODE_UUI_IO_UNSUPPORTEDOVERWRITE (ERRCODE_AREA_UUI + 50)
+#define ERRCODE_UUI_IO_BROKENPACKAGE (ERRCODE_AREA_UUI + 51)
+#define ERRCODE_UUI_IO_BROKENPACKAGE_CANTREPAIR (ERRCODE_AREA_UUI + 52)
+#define ERRCODE_UUI_CONFIGURATION_BROKENDATA_NOREMOVE (ERRCODE_AREA_UUI + 53)
+#define ERRCODE_UUI_CONFIGURATION_BROKENDATA_WITHREMOVE (ERRCODE_AREA_UUI + 54)
+#define ERRCODE_UUI_CONFIGURATION_BACKENDMISSING (ERRCODE_AREA_UUI + 55)
+#define ERRCODE_UUI_CONFIGURATION_BACKENDMISSING_WITHRECOVER (ERRCODE_AREA_UUI + 56)
+#define ERRCODE_UUI_INVALID_XFORMS_SUBMISSION_DATA (ERRCODE_AREA_UUI + 57)
+#define ERRCODE_UUI_IO_MODULESIZEEXCEEDED (ERRCODE_AREA_UUI + 58)
+#define ERRCODE_UUI_LOCKING_LOCKED (ERRCODE_AREA_UUI + 59)
+#define ERRCODE_UUI_LOCKING_LOCKED_SELF (ERRCODE_AREA_UUI + 60)
+#define ERRCODE_UUI_LOCKING_NOT_LOCKED (ERRCODE_AREA_UUI + 61)
+#define ERRCODE_UUI_LOCKING_LOCK_EXPIRED (ERRCODE_AREA_UUI + 62)
+
+#define ERRCODE_AREA_UUI_UNKNOWNAUTH 25000
+#define SSLWARN_TYPE_DOMAINMISMATCH 10
+#define SSLWARN_TYPE_EXPIRED 20
+#define SSLWARN_TYPE_INVALID 30
+
+#define ERRCODE_UUI_UNKNOWNAUTH_UNTRUSTED (ERRCODE_AREA_UUI_UNKNOWNAUTH + 1)
+
+#define ERRCODE_UUI_SSLWARN_EXPIRED_1 (ERRCODE_AREA_UUI_UNKNOWNAUTH + SSLWARN_TYPE_EXPIRED + 1)
+#define TITLE_UUI_SSLWARN_EXPIRED (ERRCODE_AREA_UUI_UNKNOWNAUTH + SSLWARN_TYPE_EXPIRED + 3)
+
+#define ERRCODE_UUI_SSLWARN_DOMAINMISMATCH_1 (ERRCODE_AREA_UUI_UNKNOWNAUTH + SSLWARN_TYPE_DOMAINMISMATCH + 1)
+#define TITLE_UUI_SSLWARN_DOMAINMISMATCH (ERRCODE_AREA_UUI_UNKNOWNAUTH + SSLWARN_TYPE_DOMAINMISMATCH + 3)
+
+#define ERRCODE_UUI_SSLWARN_INVALID_1 (ERRCODE_AREA_UUI_UNKNOWNAUTH + SSLWARN_TYPE_INVALID + 1)
+#define TITLE_UUI_SSLWARN_INVALID (ERRCODE_AREA_UUI_UNKNOWNAUTH + SSLWARN_TYPE_INVALID + 3)
+
+#define HID_DLG_LOGIN (HID_UUI_START + 0)
+#define HID_DLG_COOKIES (HID_UUI_START + 1)
+#define HID_DLG_MASTERPASSWORD_UUI (HID_UUI_START + 2)
+#define HID_DLG_MASTERPASSWORD_CRT (HID_UUI_START + 3)
+#define HID_DLG_FILTER_SELECT (HID_UUI_START + 4)
+#define HID_DLG_PASSWORD_UUI (HID_UUI_START + 5)
+#define HID_DLG_PASSWORD_CRT (HID_UUI_START + 6)
+#define HID_DLG_UNKNOWNAUTH_UUI (HID_UUI_START + 7)
+#define HID_DLG_SSLWARN_UUI (HID_UUI_START + 8)
+#define HID_XMLSECDLG_MACROWARN (HID_UUI_START + 9)
+#define HID_DLG_NEWERVERSIONWARNING (HID_UUI_START +10)
+
+#define HID_LOGIN_DLG_PATH (HID_UUI_START +11)
+#define HID_LOGIN_DLG_BROWSE (HID_UUI_START +12)
+#define HID_LOGIN_DLG_USER_NAME (HID_UUI_START +13)
+#define HID_LOGIN_DLG_PASSWORD (HID_UUI_START +14)
+#define HID_LOGIN_DLG_ACCOUNT (HID_UUI_START +15)
+#define HID_LOGIN_DLG_REMEMBER_PASSWORD (HID_UUI_START +16)
+#define HID_LOGIN_DLG_USE_SYSTEM_CREDENTIALS (HID_UUI_START +17)
+
+// HID_UUI_END (aka HID_CHAOS_NEW_DATABASE) is reserved in
+// sfx2/util/hidother.src
+
+#endif // UUI_IDS_HRC
+
diff --git a/uui/source/ids.src b/uui/source/ids.src
new file mode 100644
index 000000000000..efff26286130
--- /dev/null
+++ b/uui/source/ids.src
@@ -0,0 +1,434 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#define __RSC
+
+#ifndef UUI_IDS_HRC
+#include "ids.hrc"
+#endif
+
+String RID_KEEP_PASSWORD
+{
+ Text [ en-US ] = "~Remember password until end of session";
+};
+
+String RID_SAVE_PASSWORD
+{
+ Text [ en-US ] = "~Remember password";
+};
+
+
+String STR_WARNING_BROKENSIGNATURE_TITLE
+{
+ Text [ en-US ] = "Invalid Document Signature" ;
+};
+
+String STR_WARNING_INCOMPLETE_ENCRYPTION_TITLE
+{
+ Text [ en-US ] = "Non-Encrypted Streams" ;
+};
+
+Resource RID_UUI_ERRHDL
+{
+ String (ERRCODE_UUI_IO_ABORT & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "The operation executed on $(ARG1) was aborted.";
+ };
+
+ String (ERRCODE_UUI_IO_ACCESSDENIED & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "Access to $(ARG1) was denied.";
+ };
+
+ String (ERRCODE_UUI_IO_ALREADYEXISTS & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "$(ARG1) already exists.";
+ };
+
+ String (ERRCODE_UUI_IO_TARGETALREADYEXISTS & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "Target already exists.";
+ };
+
+ String (ERRCODE_UUI_IO_MODULESIZEEXCEEDED & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "You are about to save/export a password protected basic library containing module(s) \n$(ARG1)\nwhich are too large to store in binary format. If you wish users that don't have access to the library password to be able to run macros in those module(s) you must split those modules into a number of smaller modules. Do you wish to continue to save/export this library?" ;
+ };
+
+ String (ERRCODE_UUI_IO_BADCRC & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "The data from $(ARG1) has an incorrect checksum.";
+ };
+
+ String (ERRCODE_UUI_IO_CANTCREATE & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "The object $(ARG1) cannot be created in directory $(ARG2).";
+ };
+
+ String (ERRCODE_UUI_IO_CANTREAD & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "Data of $(ARG1) could not be read.";
+ };
+
+ String (ERRCODE_UUI_IO_CANTSEEK & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "The seek operation on $(ARG1) could not be performed.";
+ };
+
+ String (ERRCODE_UUI_IO_CANTTELL & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "The tell operation on $(ARG1) could not be performed.";
+ };
+
+ String (ERRCODE_UUI_IO_CANTWRITE & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "Data for $(ARG1) could not be written.";
+ };
+
+ String (ERRCODE_UUI_IO_CURRENTDIR & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "Action impossible: $(ARG1) is the current directory.";
+ };
+
+ String (ERRCODE_UUI_IO_NOTREADY & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "$(ARG1) is not ready.";
+ };
+
+ String (ERRCODE_UUI_IO_NOTSAMEDEVICE & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "Action impossible: $(ARG1) and $(ARG2) are different devices (drives).";
+ };
+
+ String (ERRCODE_UUI_IO_GENERAL & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "General input/output error while accessing $(ARG1).";
+ };
+
+ String (ERRCODE_UUI_IO_INVALIDACCESS & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "An attempt was made to access $(ARG1) in an invalid way.";
+ };
+
+ String (ERRCODE_UUI_IO_INVALIDCHAR & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "$(ARG1) contains invalid characters.";
+ };
+
+ String (ERRCODE_UUI_IO_INVALIDDEVICE & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "The device (drive) $(ARG1) is invalid.";
+ };
+
+ String (ERRCODE_UUI_IO_INVALIDLENGTH & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "The data from $(ARG1) has an invalid length.";
+ };
+
+ String (ERRCODE_UUI_IO_INVALIDPARAMETER & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "The operation on $(ARG1) was started with an invalid parameter.";
+ };
+
+ String (ERRCODE_UUI_IO_ISWILDCARD & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "The operation cannot be performed because $(ARG1) contains wildcards.";
+ };
+
+ String (ERRCODE_UUI_IO_LOCKVIOLATION & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "Error during shared access to $(ARG1).";
+ };
+
+ String (ERRCODE_UUI_IO_MISPLACEDCHAR & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "$(ARG1) contains misplaced characters.";
+ };
+
+ String (ERRCODE_UUI_IO_NAMETOOLONG & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "The name $(ARG1) contains too many characters.";
+ };
+
+ String (ERRCODE_UUI_IO_NOTEXISTS & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "$(ARG1) does not exist.";
+ };
+
+ String (ERRCODE_UUI_IO_NOTEXISTSPATH & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "The path $(ARG1) does not exist.";
+ };
+
+ String (ERRCODE_UUI_IO_NOTSUPPORTED & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "The operation on $(ARG1) is not supported on this operating system.";
+ };
+
+ String (ERRCODE_UUI_IO_NOTADIRECTORY & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "$(ARG1) is not a directory.";
+ };
+
+ String (ERRCODE_UUI_IO_NOTAFILE & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "$(ARG1) is not a file.";
+ };
+
+ String (ERRCODE_UUI_IO_OUTOFSPACE & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "There is no space left on device $(ARG1).";
+ };
+
+ String (ERRCODE_UUI_IO_TOOMANYOPENFILES & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "The operation on $(ARG1) cannot be performed because too many files are already open.";
+ };
+
+ String (ERRCODE_UUI_IO_OUTOFMEMORY & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "The operation on $(ARG1) cannot be performed because there is no more memory available.";
+ };
+
+ String (ERRCODE_UUI_IO_PENDING & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "The operation on $(ARG1) cannot continue because more data is pending.";
+ };
+
+ String (ERRCODE_UUI_IO_RECURSIVE & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "$(ARG1) cannot be copied into itself.";
+ };
+
+ String (ERRCODE_UUI_IO_UNKNOWN & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "Unknown input/output error while accessing $(ARG1).";
+ };
+
+ String (ERRCODE_UUI_IO_WRITEPROTECTED & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "$(ARG1) is write protected.";
+ };
+
+ String (ERRCODE_UUI_IO_WRONGFORMAT & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "$(ARG1) is not in the correct format.";
+ };
+
+ String (ERRCODE_UUI_IO_WRONGVERSION & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "The version of $(ARG1) is not correct.";
+ };
+
+ String (ERRCODE_UUI_IO_NOTEXISTS_VOLUME & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "Drive $(ARG1) does not exist.";
+ };
+
+ String (ERRCODE_UUI_IO_NOTEXISTS_FOLDER & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "Folder $(ARG1) does not exist.";
+ };
+
+ String (ERRCODE_UUI_WRONGJAVA & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "The installed Java version is not supported.";
+ };
+
+ String (ERRCODE_UUI_WRONGJAVA_VERSION & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "The installed Java version $(ARG1) is not supported.";
+ };
+ String (ERRCODE_UUI_WRONGJAVA_MIN & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "The installed Java version is not supported, at least version $(ARG1) is required.";
+ };
+
+ String (ERRCODE_UUI_WRONGJAVA_VERSION_MIN & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "The installed Java version $(ARG1) is not supported, at least version $(ARG2) is required.";
+ };
+
+ String (ERRCODE_UUI_BADPARTNERSHIP & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "The data associated with the partnership is corrupted.";
+ };
+
+ String (ERRCODE_UUI_BADPARTNERSHIP_NAME & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "The data associated with the partnership $(ARG1) is corrupted.";
+ };
+
+ String (ERRCODE_UUI_IO_NOTREADY_VOLUME & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "Volume $(ARG1) is not ready.";
+ };
+
+ String (ERRCODE_UUI_IO_NOTREADY_REMOVABLE & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "$(ARG1) is not ready; please insert a storage medium.";
+ };
+
+ String (ERRCODE_UUI_IO_NOTREADY_VOLUME_REMOVABLE & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "Volume $(ARG1) is not ready; please insert a storage medium.";
+ };
+
+ String (ERRCODE_UUI_WRONGMEDIUM & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "Please insert disk $(ARG1).";
+ };
+
+ String (ERRCODE_UUI_IO_CANTCREATE_NONAME & ERRCODE_RES_MASK)
+ {
+ Text[ en-US ] = "The object cannot be created in directory $(ARG1).";
+ };
+
+ String (ERRCODE_UUI_IO_UNSUPPORTEDOVERWRITE & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "%PRODUCTNAME cannot keep files from being overwritten when this transmission protocol is used. Do you want to continue anyway?";
+ };
+
+ String (ERRCODE_UUI_IO_BROKENPACKAGE & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "The file '$(ARG1)' is corrupt and therefore cannot be opened. %PRODUCTNAME can try to repair the file.\n\nThe corruption could be the result of document manipulation or of structural document damage due to data transmission.\n\nWe recommend that you do not trust the content of the repaired document.\nExecution of macros is disabled for this document.\n\nShould %PRODUCTNAME repair the file?\n";
+ };
+
+ String (ERRCODE_UUI_IO_BROKENPACKAGE_CANTREPAIR & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "The file '$(ARG1)' could not be repaired and therefore cannot be opened.";
+ };
+
+ String (ERRCODE_UUI_CONFIGURATION_BROKENDATA_NOREMOVE & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "Configuration data in '$(ARG1)' is corrupted. Without this data some functions may not operate correctly.\nDo you want to continue startup of %PRODUCTNAME without the corrupted configuration data?";
+ };
+
+ String (ERRCODE_UUI_CONFIGURATION_BROKENDATA_WITHREMOVE & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "The personal configuration file '$(ARG1)' is corrupted and must be deleted to continue. Some of your personal settings may be lost.\nDo you want to continue startup of %PRODUCTNAME without the corrupted configuration data?";
+ };
+
+ String (ERRCODE_UUI_CONFIGURATION_BACKENDMISSING & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "The configuration data source '$(ARG1)' is unavailable. Without this data some functions may not operate correctly.";
+ };
+
+ String (ERRCODE_UUI_CONFIGURATION_BACKENDMISSING_WITHRECOVER & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "The configuration data source '$(ARG1)' is unavailable. Without this data some functions may not operate correctly.\nDo you want to continue startup of %PRODUCTNAME without the missing configuration data?";
+ };
+
+ STRING (ERRCODE_UUI_INVALID_XFORMS_SUBMISSION_DATA & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "The form contains invalid data. Do you still want to continue?";
+ };
+
+ String (ERRCODE_UUI_LOCKING_LOCKED & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "The file $(ARG1) is locked by another user. Currently, another write access to this file cannot be granted.";
+
+ };
+
+ String (ERRCODE_UUI_LOCKING_LOCKED_SELF & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "The file $(ARG1) is locked by yourself. Currently, another write access to this file cannot be granted.";
+ };
+
+ String (ERRCODE_UUI_LOCKING_NOT_LOCKED & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "The file $(ARG1) is currently not locked by yourself.";
+ };
+
+ String (ERRCODE_UUI_LOCKING_LOCK_EXPIRED & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "The previously obtained lock for file $(ARG1) has expired.\nThis can happen due to problems on the server managing the file lock. It cannot be guaranteed that write operations on this file will not overwrite changes done by other users!";
+ };
+
+ STRING (ERRCODE_UUI_UNKNOWNAUTH_UNTRUSTED)
+ {
+ Text [ en-US ] = "Unable to verify the identity of $(ARG1) site.\n\nBefore accepting this certificate, you should examine this site's certificate carefully. Are you willing to accept this certificate for the purpose of identifying the Web site $(ARG1)?";
+ };
+
+ STRING (ERRCODE_UUI_SSLWARN_EXPIRED_1)
+ {
+ Text [ en-US ] = "$(ARG1) is a site that uses a security certificate to encrypt data during transmission, but its certificate expired on $(ARG2).\n\nYou should check to make sure that your computer's time is correct.";
+ };
+
+ STRING (ERRCODE_UUI_SSLWARN_DOMAINMISMATCH_1)
+ {
+ Text [ en-US ] = "You have attempted to establish a connection with $(ARG1). However, the security certificate presented belongs to $(ARG2). It is possible, though unlikely, that someone may be trying to intercept your communication with this web site.\n\nIf you suspect the certificate shown does not belong to $(ARG1), please cancel the connection and notify the site administrator.\n\nWould you like to continue anyway?";
+ };
+
+ STRING (ERRCODE_UUI_SSLWARN_INVALID_1)
+ {
+ Text [ en-US ] = "The certificate could not be validated. You should examine this site's certificate carefully.\n\nIf you suspect the certificate shown, please cancel the connection and notify the site administrator.";
+ };
+ STRING (TITLE_UUI_SSLWARN_DOMAINMISMATCH)
+ {
+ Text [ en-US ] = "Security Warning: Domain Name Mismatch";
+ };
+
+ STRING (TITLE_UUI_SSLWARN_EXPIRED)
+ {
+ Text [ en-US ] = "Security Warning: Server Certificate Expired";
+ };
+
+ STRING (TITLE_UUI_SSLWARN_INVALID)
+ {
+ Text [ en-US ] = "Security Warning: Server Certificate Invalid";
+ };
+
+
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/uui/source/interactionhandler.cxx b/uui/source/interactionhandler.cxx
new file mode 100644
index 000000000000..264367718c61
--- /dev/null
+++ b/uui/source/interactionhandler.cxx
@@ -0,0 +1,147 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "iahndl.hxx"
+#include "interactionhandler.hxx"
+
+using namespace com::sun::star;
+
+UUIInteractionHandler::UUIInteractionHandler(
+ uno::Reference< lang::XMultiServiceFactory > const &
+ rServiceFactory)
+ SAL_THROW(())
+ : m_xServiceFactory(rServiceFactory),
+ m_pImpl(new UUIInteractionHelper(m_xServiceFactory))
+{
+}
+
+UUIInteractionHandler::~UUIInteractionHandler()
+{
+ delete m_pImpl;
+}
+
+rtl::OUString SAL_CALL UUIInteractionHandler::getImplementationName()
+ throw (uno::RuntimeException)
+{
+ return rtl::OUString::createFromAscii(m_aImplementationName);
+}
+
+sal_Bool SAL_CALL
+UUIInteractionHandler::supportsService(rtl::OUString const & rServiceName)
+ throw (uno::RuntimeException)
+{
+ uno::Sequence< rtl::OUString >
+ aNames(getSupportedServiceNames_static());
+ for (sal_Int32 i = 0; i < aNames.getLength(); ++i)
+ if (aNames[i] == rServiceName)
+ return true;
+ return false;
+}
+
+uno::Sequence< rtl::OUString > SAL_CALL
+UUIInteractionHandler::getSupportedServiceNames()
+ throw (uno::RuntimeException)
+{
+ return getSupportedServiceNames_static();
+}
+
+void SAL_CALL
+UUIInteractionHandler::initialize(
+ uno::Sequence< uno::Any > const & rArguments)
+ throw (uno::Exception)
+{
+ delete m_pImpl;
+ m_pImpl = new UUIInteractionHelper(m_xServiceFactory, rArguments);
+}
+
+void SAL_CALL
+UUIInteractionHandler::handle(
+ uno::Reference< task::XInteractionRequest > const & rRequest)
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ m_pImpl->handleRequest(rRequest);
+ }
+ catch (uno::RuntimeException const & ex)
+ {
+ throw uno::RuntimeException(ex.Message, *this);
+ }
+}
+
+::sal_Bool SAL_CALL UUIInteractionHandler::handleInteractionRequest(
+ const uno::Reference< task::XInteractionRequest >& _Request ) throw ( uno::RuntimeException )
+{
+ try
+ {
+ return m_pImpl->handleRequest( _Request );
+ }
+ catch (uno::RuntimeException const & ex)
+ {
+ throw uno::RuntimeException( ex.Message, *this );
+ }
+ return sal_False;
+}
+
+char const UUIInteractionHandler::m_aImplementationName[]
+ = "com.sun.star.comp.uui.UUIInteractionHandler";
+
+uno::Sequence< rtl::OUString >
+UUIInteractionHandler::getSupportedServiceNames_static()
+{
+ uno::Sequence< rtl::OUString > aNames(3);
+ aNames[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.task.InteractionHandler"));
+ // added to indicate support for configuration.backend.MergeRecoveryRequest
+ aNames[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.configuration.backend.InteractionHandler"));
+ aNames[2] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.uui.InteractionHandler"));
+ // for backwards compatibility
+ return aNames;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL
+UUIInteractionHandler::createInstance(
+ uno::Reference< lang::XMultiServiceFactory > const &
+ rServiceFactory)
+ SAL_THROW((uno::Exception))
+{
+ try
+ {
+ return *new UUIInteractionHandler(rServiceFactory);
+ }
+ catch (std::bad_alloc const &)
+ {
+ throw uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
+ 0);
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/interactionhandler.hxx b/uui/source/interactionhandler.hxx
new file mode 100644
index 000000000000..508032d0438d
--- /dev/null
+++ b/uui/source/interactionhandler.hxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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 UUI_INTERACTIONHANDLER_HXX
+#define UUI_INTERACTIONHANDLER_HXX
+
+#include "com/sun/star/lang/XInitialization.hpp"
+#include "com/sun/star/lang/XServiceInfo.hpp"
+#include "com/sun/star/task/XInteractionHandler2.hpp"
+#include "cppuhelper/implbase3.hxx"
+
+class UUIInteractionHelper;
+
+class UUIInteractionHandler:
+ public cppu::WeakImplHelper3< com::sun::star::lang::XServiceInfo,
+ com::sun::star::lang::XInitialization,
+ com::sun::star::task::XInteractionHandler2 >
+{
+public:
+ static char const m_aImplementationName[];
+
+ static com::sun::star::uno::Sequence< rtl::OUString >
+ getSupportedServiceNames_static();
+
+ static com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
+ SAL_CALL
+ createInstance(
+ com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory > const &
+ rServiceFactory)
+ SAL_THROW((com::sun::star::uno::Exception));
+
+private:
+ com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory > m_xServiceFactory;
+ UUIInteractionHelper * m_pImpl;
+
+ UUIInteractionHandler(UUIInteractionHandler &); // not implemented
+ void operator =(UUIInteractionHandler); // not implemented
+
+ UUIInteractionHandler(com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >
+ const & rServiceFactory)
+ SAL_THROW(());
+
+ virtual ~UUIInteractionHandler() SAL_THROW(());
+
+ virtual rtl::OUString SAL_CALL getImplementationName()
+ throw (com::sun::star::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL supportsService(rtl::OUString const &
+ rServiceName)
+ throw (com::sun::star::uno::RuntimeException);
+
+ virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL
+ getSupportedServiceNames()
+ throw (com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ initialize(
+ com::sun::star::uno::Sequence< com::sun::star::uno::Any > const &
+ rArguments)
+ throw (com::sun::star::uno::Exception);
+
+ virtual void SAL_CALL
+ handle(com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionRequest > const &
+ rRequest)
+ throw (com::sun::star::uno::RuntimeException);
+
+ virtual ::sal_Bool SAL_CALL
+ handleInteractionRequest(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& _Request
+ ) throw ( ::com::sun::star::uno::RuntimeException );
+};
+
+#endif // UUI_INTERACTIONHANDLER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/lockfailed.cxx b/uui/source/lockfailed.cxx
new file mode 100644
index 000000000000..109ba5b9046c
--- /dev/null
+++ b/uui/source/lockfailed.cxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "ids.hrc"
+#include "lockfailed.hxx"
+
+#include <vcl/button.hxx>
+
+LockFailedQueryBox::LockFailedQueryBox( Window* pParent, ResMgr* pResMgr ) :
+ MessBox(pParent, 0,
+ String( ResId( STR_LOCKFAILED_TITLE, *pResMgr ) ),
+ String::EmptyString() )
+{
+ SetImage( ErrorBox::GetStandardImage() );
+
+ AddButton( BUTTON_OK, RET_OK, BUTTONDIALOG_OKBUTTON );
+ AddButton( BUTTON_CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON );
+
+ SetMessText( String( ResId( STR_LOCKFAILED_MSG, *pResMgr ) ) );
+ SetCheckBoxText( String( ResId( STR_LOCKFAILED_DONTSHOWAGAIN, *pResMgr ) ) );
+}
+
+LockFailedQueryBox::~LockFailedQueryBox()
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/lockfailed.hxx b/uui/source/lockfailed.hxx
new file mode 100644
index 000000000000..0f96b1554b52
--- /dev/null
+++ b/uui/source/lockfailed.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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 _UUI_LOCKFAILED_HXX
+#define _UUI_LOCKFAILED_HXX
+
+#include <vcl/msgbox.hxx>
+
+class CheckBox;
+
+class LockFailedQueryBox : public MessBox
+{
+public:
+ LockFailedQueryBox( Window* pParent, ResMgr* pResMgr );
+ ~LockFailedQueryBox();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/lockfailed.src b/uui/source/lockfailed.src
new file mode 100644
index 000000000000..4ccc1c78b356
--- /dev/null
+++ b/uui/source/lockfailed.src
@@ -0,0 +1,46 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#define __RSC
+
+#ifndef UUI_IDS_HRC
+#include <ids.hrc>
+#endif
+
+String STR_LOCKFAILED_TITLE
+{
+ Text = "Document Could Not Be Locked";
+};
+String STR_LOCKFAILED_MSG
+{
+ Text [ en-US ] = "The file could not be locked for exclusive access by %PRODUCTNAME, due to missing permission to create a lock file on that file location.";
+};
+String STR_LOCKFAILED_DONTSHOWAGAIN
+{
+ Text = "~Do not show this message again";
+};
+
diff --git a/uui/source/logindlg.cxx b/uui/source/logindlg.cxx
new file mode 100644
index 000000000000..b7ce1f68270a
--- /dev/null
+++ b/uui/source/logindlg.cxx
@@ -0,0 +1,349 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include <svtools/filedlg.hxx>
+#include <vcl/msgbox.hxx>
+#include "logindlg.hxx"
+
+#include "logindlg.hrc"
+#include "ids.hrc"
+#include <tools/resid.hxx>
+
+#ifdef UNX
+#include <limits.h>
+#define _MAX_PATH PATH_MAX
+#endif
+
+// LoginDialog -------------------------------------------------------
+
+//............................................................................
+//............................................................................
+
+static void lcl_Move( Window &rWin, long nOffset )
+{
+ Point aTmp( rWin.GetPosPixel() );
+ aTmp.Y() -= nOffset;
+ rWin.SetPosPixel( aTmp );
+}
+
+
+void LoginDialog::HideControls_Impl( USHORT nFlags )
+{
+ bool bPathHide = FALSE;
+ bool bErrorHide = FALSE;
+ bool bAccountHide = FALSE;
+ bool bUseSysCredsHide = FALSE;
+
+ if ( ( nFlags & LF_NO_PATH ) == LF_NO_PATH )
+ {
+ aPathFT.Hide();
+ aPathED.Hide();
+ aPathBtn.Hide();
+ bPathHide = TRUE;
+ }
+ else if ( ( nFlags & LF_PATH_READONLY ) == LF_PATH_READONLY )
+ {
+ aPathED.Enable( FALSE );
+ aPathBtn.Enable( FALSE );
+ }
+
+ if ( ( nFlags & LF_NO_USERNAME ) == LF_NO_USERNAME )
+ {
+ aNameFT.Hide();
+ aNameED.Hide();
+ }
+ else if ( ( nFlags & LF_USERNAME_READONLY ) == LF_USERNAME_READONLY )
+ {
+ aNameED.Enable( FALSE );
+ }
+
+ if ( ( nFlags & LF_NO_PASSWORD ) == LF_NO_PASSWORD )
+ {
+ aPasswordFT.Hide();
+ aPasswordED.Hide();
+ }
+
+ if ( ( nFlags & LF_NO_SAVEPASSWORD ) == LF_NO_SAVEPASSWORD )
+ aSavePasswdBtn.Hide();
+
+ if ( ( nFlags & LF_NO_ERRORTEXT ) == LF_NO_ERRORTEXT )
+ {
+ aErrorInfo.Hide();
+ aErrorFT.Hide();
+ aLogin1FL.Hide();
+ bErrorHide = TRUE;
+ }
+
+ if ( ( nFlags & LF_NO_ACCOUNT ) == LF_NO_ACCOUNT )
+ {
+ aAccountFT.Hide();
+ aAccountED.Hide();
+ bAccountHide = TRUE;
+ }
+
+ if ( ( nFlags & LF_NO_USESYSCREDS ) == LF_NO_USESYSCREDS )
+ {
+ aUseSysCredsCB.Hide();
+ bUseSysCredsHide = TRUE;
+ }
+
+ if ( bErrorHide )
+ {
+ long nOffset = aRequestInfo.GetPosPixel().Y() -
+ aErrorFT.GetPosPixel().Y();
+ lcl_Move( aRequestInfo, nOffset );
+ lcl_Move( aLogin2FL, nOffset );
+ lcl_Move( aPathFT, nOffset );
+ lcl_Move( aPathED, nOffset );
+ lcl_Move( aPathBtn, nOffset );
+ lcl_Move( aNameFT, nOffset );
+ lcl_Move( aNameED, nOffset );
+ lcl_Move( aPasswordFT, nOffset );
+ lcl_Move( aPasswordED, nOffset );
+ lcl_Move( aAccountFT, nOffset );
+ lcl_Move( aAccountED, nOffset );
+ lcl_Move( aSavePasswdBtn, nOffset );
+ lcl_Move( aUseSysCredsCB, nOffset );
+ lcl_Move( aButtonsFL, nOffset );
+ lcl_Move( aOKBtn, nOffset );
+ lcl_Move( aCancelBtn, nOffset );
+ lcl_Move( aHelpBtn, nOffset );
+
+ Size aNewSiz = GetSizePixel();
+ aNewSiz.Height() -= nOffset;
+ SetSizePixel( aNewSiz );
+ }
+
+ if ( bPathHide )
+ {
+ long nOffset = aNameED.GetPosPixel().Y() -
+ aPathED.GetPosPixel().Y();
+ lcl_Move( aNameFT, nOffset );
+ lcl_Move( aNameED, nOffset );
+ lcl_Move( aPasswordFT, nOffset );
+ lcl_Move( aPasswordED, nOffset );
+ lcl_Move( aAccountFT, nOffset );
+ lcl_Move( aAccountED, nOffset );
+ lcl_Move( aSavePasswdBtn, nOffset );
+ lcl_Move( aUseSysCredsCB, nOffset );
+ lcl_Move( aButtonsFL, nOffset );
+ lcl_Move( aOKBtn, nOffset );
+ lcl_Move( aCancelBtn, nOffset );
+ lcl_Move( aHelpBtn, nOffset );
+
+ Size aNewSz = GetSizePixel();
+ aNewSz.Height() -= nOffset;
+ SetSizePixel( aNewSz );
+ }
+
+ if ( bAccountHide )
+ {
+ long nOffset = aAccountED.GetPosPixel().Y() -
+ aPasswordED.GetPosPixel().Y();
+ lcl_Move( aSavePasswdBtn, nOffset );
+ lcl_Move( aUseSysCredsCB, nOffset );
+ lcl_Move( aButtonsFL, nOffset );
+ lcl_Move( aOKBtn, nOffset );
+ lcl_Move( aCancelBtn, nOffset );
+ lcl_Move( aHelpBtn, nOffset );
+
+ Size aNewSz = GetSizePixel();
+ aNewSz.Height() -= nOffset;
+ SetSizePixel( aNewSz );
+ }
+
+ if ( bUseSysCredsHide )
+ {
+ long nOffset = aUseSysCredsCB.GetPosPixel().Y() -
+ aSavePasswdBtn.GetPosPixel().Y();
+ lcl_Move( aButtonsFL, nOffset );
+ lcl_Move( aOKBtn, nOffset );
+ lcl_Move( aCancelBtn, nOffset );
+ lcl_Move( aHelpBtn, nOffset );
+
+ Size aNewSz = GetSizePixel();
+ aNewSz.Height() -= nOffset;
+ SetSizePixel( aNewSz );
+ }
+};
+
+// -----------------------------------------------------------------------
+void LoginDialog::EnableUseSysCredsControls_Impl( BOOL bUseSysCredsEnabled )
+{
+ aErrorInfo.Enable( !bUseSysCredsEnabled );
+ aErrorFT.Enable( !bUseSysCredsEnabled );
+ aRequestInfo.Enable( !bUseSysCredsEnabled );
+ aPathFT.Enable( !bUseSysCredsEnabled );
+ aPathED.Enable( !bUseSysCredsEnabled );
+ aPathBtn.Enable( !bUseSysCredsEnabled );
+ aNameFT.Enable( !bUseSysCredsEnabled );
+ aNameED.Enable( !bUseSysCredsEnabled );
+ aPasswordFT.Enable( !bUseSysCredsEnabled );
+ aPasswordED.Enable( !bUseSysCredsEnabled );
+ aAccountFT.Enable( !bUseSysCredsEnabled );
+ aAccountED.Enable( !bUseSysCredsEnabled );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( LoginDialog, OKHdl_Impl, OKButton *, EMPTYARG )
+{
+ // trim the strings
+ aNameED.SetText( aNameED.GetText().EraseLeadingChars().
+ EraseTrailingChars() );
+ aPasswordED.SetText( aPasswordED.GetText().EraseLeadingChars().
+ EraseTrailingChars() );
+ EndDialog( RET_OK );
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( LoginDialog, PathHdl_Impl, PushButton *, EMPTYARG )
+{
+ PathDialog* pDlg = new PathDialog( this, WB_3DLOOK );
+ pDlg->SetPath( aPathED.GetText() );
+
+ if ( pDlg->Execute() == RET_OK )
+ aPathED.SetText( pDlg->GetPath() );
+
+ delete pDlg;
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( LoginDialog, UseSysCredsHdl_Impl, CheckBox *, EMPTYARG )
+{
+ EnableUseSysCredsControls_Impl( aUseSysCredsCB.IsChecked() );
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+LoginDialog::LoginDialog
+(
+ Window* pParent,
+ USHORT nFlags,
+ const String& rServer,
+ const String* pRealm,
+ ResMgr* pResMgr
+) :
+
+ ModalDialog( pParent, ResId( DLG_UUI_LOGIN, *pResMgr ) ),
+
+ aErrorFT ( this, ResId( FT_LOGIN_ERROR, *pResMgr ) ),
+ aErrorInfo ( this, ResId( FT_INFO_LOGIN_ERROR, *pResMgr ) ),
+ aLogin1FL ( this, ResId( FL_LOGIN_1, *pResMgr ) ),
+ aRequestInfo ( this, ResId( FT_INFO_LOGIN_REQUEST, *pResMgr ) ),
+ aLogin2FL ( this, ResId( FL_LOGIN_2, *pResMgr ) ),
+ aPathFT ( this, ResId( FT_LOGIN_PATH, *pResMgr ) ),
+ aPathED ( this, ResId( ED_LOGIN_PATH, *pResMgr ) ),
+ aPathBtn ( this, ResId( BTN_LOGIN_PATH, *pResMgr ) ),
+ aNameFT ( this, ResId( FT_LOGIN_USERNAME, *pResMgr ) ),
+ aNameED ( this, ResId( ED_LOGIN_USERNAME, *pResMgr ) ),
+ aPasswordFT ( this, ResId( FT_LOGIN_PASSWORD, *pResMgr ) ),
+ aPasswordED ( this, ResId( ED_LOGIN_PASSWORD, *pResMgr ) ),
+ aAccountFT ( this, ResId( FT_LOGIN_ACCOUNT, *pResMgr ) ),
+ aAccountED ( this, ResId( ED_LOGIN_ACCOUNT, *pResMgr ) ),
+ aSavePasswdBtn ( this, ResId( CB_LOGIN_SAVEPASSWORD, *pResMgr ) ),
+ aUseSysCredsCB ( this, ResId( CB_LOGIN_USESYSCREDS, *pResMgr ) ),
+ aButtonsFL ( this, ResId( FL_BUTTONS, *pResMgr ) ),
+ aOKBtn ( this, ResId( BTN_LOGIN_OK, *pResMgr ) ),
+ aCancelBtn ( this, ResId( BTN_LOGIN_CANCEL, *pResMgr ) ),
+ aHelpBtn ( this, ResId( BTN_LOGIN_HELP, *pResMgr ) )
+
+{
+ UniString aRequest;
+ if ((nFlags & LF_NO_ACCOUNT) != 0 && pRealm && pRealm->Len() != 0)
+ {
+ aRequest = ResId(STR_LOGIN_REALM, *pResMgr);
+ aRequest.SearchAndReplaceAscii("%2", *pRealm);
+ }
+ else
+ aRequest = aRequestInfo.GetText();
+
+ if ( !( ( nFlags & LF_NO_USESYSCREDS ) == LF_NO_USESYSCREDS ) )
+ EnableUseSysCredsControls_Impl( aUseSysCredsCB.IsChecked() );
+
+ aRequest.SearchAndReplaceAscii("%1", rServer);
+ aRequestInfo.SetText(aRequest);
+
+ FreeResource();
+
+ aPathED.SetMaxTextLen( _MAX_PATH );
+ aNameED.SetMaxTextLen( _MAX_PATH );
+
+ aOKBtn.SetClickHdl( LINK( this, LoginDialog, OKHdl_Impl ) );
+ aPathBtn.SetClickHdl( LINK( this, LoginDialog, PathHdl_Impl ) );
+ aUseSysCredsCB.SetClickHdl( LINK( this, LoginDialog, UseSysCredsHdl_Impl ) );
+
+ HideControls_Impl( nFlags );
+};
+
+// -----------------------------------------------------------------------
+
+LoginDialog::~LoginDialog()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void LoginDialog::SetUseSystemCredentials( BOOL bUse )
+{
+ if ( aUseSysCredsCB.IsVisible() )
+ {
+ aUseSysCredsCB.Check( bUse );
+ EnableUseSysCredsControls_Impl( bUse );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void LoginDialog::ClearPassword()
+{
+ aPasswordED.SetText( String() );
+
+ if ( 0 == aNameED.GetText().Len() )
+ aNameED.GrabFocus();
+ else
+ aPasswordED.GrabFocus();
+};
+
+// -----------------------------------------------------------------------
+
+void LoginDialog::ClearAccount()
+{
+ aAccountED.SetText( String() );
+ aAccountED.GrabFocus();
+};
+
+//............................................................................
+//............................................................................
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/logindlg.hrc b/uui/source/logindlg.hrc
new file mode 100755
index 000000000000..d2a5d48aaf00
--- /dev/null
+++ b/uui/source/logindlg.hrc
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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 UUI_LOGINDLG_HRC
+#define UUI_LOGINDLG_HRC
+
+
+//============================================================================
+#define FT_INFO_LOGIN_ERROR 10
+#define FT_LOGIN_ERROR 11
+
+#define FT_INFO_LOGIN_REQUEST 20
+#define FT_LOGIN_PATH 21
+#define ED_LOGIN_PATH 22
+#define BTN_LOGIN_PATH 23
+#define FT_LOGIN_USERNAME 24
+#define ED_LOGIN_USERNAME 25
+#define FT_LOGIN_PASSWORD 26
+#define ED_LOGIN_PASSWORD 27
+#define FT_LOGIN_ACCOUNT 28
+#define ED_LOGIN_ACCOUNT 29
+#define CB_LOGIN_SAVEPASSWORD 30
+#define CB_LOGIN_USESYSCREDS 31
+#define FL_LOGIN_1 32
+#define FL_LOGIN_2 33
+#define FL_BUTTONS 34
+
+#define BTN_LOGIN_OK 50
+#define BTN_LOGIN_CANCEL 51
+#define BTN_LOGIN_HELP 52
+
+#define STR_LOGIN_REALM 60
+
+#endif // UUI_LOGINDLG_HRC
+
diff --git a/uui/source/logindlg.hxx b/uui/source/logindlg.hxx
new file mode 100644
index 000000000000..170a0be13554
--- /dev/null
+++ b/uui/source/logindlg.hxx
@@ -0,0 +1,116 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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 UUI_LOGINDLG_HXX
+#define UUI_LOGINDLG_HXX
+
+#include <svtools/stdctrl.hxx>
+#include <vcl/button.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/fixed.hxx>
+
+//============================================================================
+#define LF_NO_PATH 0x0001 // hide "path"
+#define LF_NO_USERNAME 0x0002 // hide "name"
+#define LF_NO_PASSWORD 0x0004 // hide "password"
+#define LF_NO_SAVEPASSWORD 0x0008 // hide "save password"
+#define LF_NO_ERRORTEXT 0x0010 // hide message
+#define LF_PATH_READONLY 0x0020 // "path" readonly
+#define LF_USERNAME_READONLY 0x0040 // "name" readonly
+#define LF_NO_ACCOUNT 0x0080 // hide "account"
+#define LF_NO_USESYSCREDS 0x0100 // hide "use system cedentials"
+
+//............................................................................
+//............................................................................
+
+//============================================================================
+class LoginDialog : public ModalDialog
+{
+ FixedText aErrorFT;
+ FixedInfo aErrorInfo;
+ FixedLine aLogin1FL;
+ FixedInfo aRequestInfo;
+ FixedLine aLogin2FL;
+ FixedText aPathFT;
+ Edit aPathED;
+ PushButton aPathBtn;
+ FixedText aNameFT;
+ Edit aNameED;
+ FixedText aPasswordFT;
+ Edit aPasswordED;
+ FixedText aAccountFT;
+ Edit aAccountED;
+ CheckBox aSavePasswdBtn;
+ CheckBox aUseSysCredsCB;
+ FixedLine aButtonsFL;
+ OKButton aOKBtn;
+ CancelButton aCancelBtn;
+ HelpButton aHelpBtn;
+
+ void HideControls_Impl( USHORT nFlags );
+ void EnableUseSysCredsControls_Impl( BOOL bUseSysCredsEnabled );
+
+ DECL_LINK( OKHdl_Impl, OKButton * );
+ DECL_LINK( PathHdl_Impl, PushButton * );
+ DECL_LINK( UseSysCredsHdl_Impl, CheckBox * );
+
+public:
+ LoginDialog( Window* pParent, USHORT nFlags,
+ const String& rServer, const String* pRealm,
+ ResMgr * pResMgr );
+ virtual ~LoginDialog();
+
+ String GetPath() const { return aPathED.GetText(); }
+ void SetPath( const String& rNewPath ) { aPathED.SetText( rNewPath ); }
+ String GetName() const { return aNameED.GetText(); }
+ void SetName( const String& rNewName ) { aNameED.SetText( rNewName ); }
+ String GetPassword() const { return aPasswordED.GetText(); }
+ void SetPassword( const String& rNew ) { aPasswordED.SetText( rNew ); }
+ String GetAccount() const { return aAccountED.GetText(); }
+ void SetAccount( const String& rNew ) { aAccountED.SetText( rNew ); }
+ BOOL IsSavePassword() const { return aSavePasswdBtn.IsChecked(); }
+ void SetSavePassword( BOOL bSave ) { aSavePasswdBtn.Check( bSave ); }
+ void SetSavePasswordText( const String& rTxt ) { aSavePasswdBtn.SetText( rTxt ); }
+ BOOL IsUseSystemCredentials() const { return aUseSysCredsCB.IsChecked(); }
+ void SetUseSystemCredentials( BOOL bUse );
+ void SetErrorText( const String& rTxt ) { aErrorInfo.SetText( rTxt ); }
+ void SetLoginRequestText( const String& rTxt ) { aRequestInfo.SetText( rTxt ); }
+ void ClearPassword();
+ void ClearAccount();
+};
+
+// -----------------------------------------------------------------------
+
+
+//............................................................................
+//............................................................................
+
+#endif // UUI_LOGINDLG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/logindlg.src b/uui/source/logindlg.src
new file mode 100755
index 000000000000..d9a0e538c982
--- /dev/null
+++ b/uui/source/logindlg.src
@@ -0,0 +1,197 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#define __RSC
+
+#ifndef UUI_IDS_HRC
+#include "ids.hrc"
+#endif
+
+#ifndef UUI_LOGINDLG_HRC
+#include "logindlg.hrc"
+#endif
+
+ModalDialog DLG_UUI_LOGIN
+{
+ HelpId = HID_DLG_LOGIN ;
+ Border = TRUE ;
+ Moveable = TRUE ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT( 177 , 247 ) ;
+ Text [ en-US ] = "Authentication Required" ;
+
+ FixedText FT_LOGIN_ERROR
+ {
+ Pos = MAP_APPFONT( 6 , 6 ) ;
+ Size = MAP_APPFONT( 165 , 8 ) ;
+ Text [ en-US ] = "Message from server:" ;
+ };
+
+ FixedText FT_INFO_LOGIN_ERROR
+ {
+ Pos = MAP_APPFONT( 6 , 14 ) ;
+ Size = MAP_APPFONT( 165 , 3*8 ) ;
+ WordBreak = TRUE ;
+ };
+
+ FixedLine FL_LOGIN_1
+ {
+ Pos = MAP_APPFONT( 6 , 41 ) ;
+ Size = MAP_APPFONT( 165 , 8 ) ;
+ };
+
+ FixedText FT_INFO_LOGIN_REQUEST
+ {
+ Pos = MAP_APPFONT( 6 , 52 ) ;
+ Size = MAP_APPFONT( 165 , 2*8 ) ;
+ WordBreak = TRUE ;
+ Text [ en-US ] = "Enter user name and password for: \n%1" ;
+ };
+
+ String STR_LOGIN_REALM
+ {
+ Text [ en-US ] = "Enter user name and password for: \n\"%2\" on %1" ;
+ };
+
+ FixedLine FL_LOGIN_2
+ {
+ Pos = MAP_APPFONT( 6 , 71 ) ;
+ Size = MAP_APPFONT( 165 , 8 ) ;
+ };
+
+ FixedText FT_LOGIN_PATH
+ {
+ Pos = MAP_APPFONT( 6 , 84 ) ;
+ Size = MAP_APPFONT( 112 , 8 ) ;
+ Text [ en-US ] = "~Path" ;
+ };
+
+ Edit ED_LOGIN_PATH
+ {
+ HelpId = HID_LOGIN_DLG_PATH;
+ Border = TRUE ;
+ Pos = MAP_APPFONT( 6 , 95 ) ;
+ Size = MAP_APPFONT( 112 , 12 ) ;
+ };
+ PushButton BTN_LOGIN_PATH
+ {
+ HelpId = HID_LOGIN_DLG_BROWSE;
+ Pos = MAP_APPFONT( 121 , 94 ) ;
+ Size = MAP_APPFONT( 50 , 14 ) ;
+ Text = "~Browse..." ;
+ };
+
+ FixedText FT_LOGIN_USERNAME
+ {
+ Pos = MAP_APPFONT( 6 , 110 ) ;
+ Size = MAP_APPFONT( 165 , 8 ) ;
+ Text [ en-US ] = "~User name" ;
+ };
+
+ Edit ED_LOGIN_USERNAME
+ {
+ HelpId = HID_LOGIN_DLG_USER_NAME;
+ Border = TRUE ;
+ Pos = MAP_APPFONT( 6 , 121 ) ;
+ Size = MAP_APPFONT( 165 , 12 ) ;
+ };
+
+ FixedText FT_LOGIN_PASSWORD
+ {
+ Pos = MAP_APPFONT( 6 , 136 ) ;
+ Size = MAP_APPFONT( 165 , 8 ) ;
+ Text [ en-US ] = "Pass~word" ;
+ };
+
+ Edit ED_LOGIN_PASSWORD
+ {
+ HelpId = HID_LOGIN_DLG_PASSWORD;
+ Border = TRUE ;
+ Pos = MAP_APPFONT( 6 , 147 ) ;
+ Size = MAP_APPFONT( 165 , 12 ) ;
+ PassWord = TRUE ;
+ };
+
+ FixedText FT_LOGIN_ACCOUNT
+ {
+ Pos = MAP_APPFONT( 6 , 162 ) ;
+ Size = MAP_APPFONT( 165 , 8 ) ;
+ Text [ en-US ] = "A~ccount";
+ };
+
+ Edit ED_LOGIN_ACCOUNT
+ {
+ HelpId = HID_LOGIN_DLG_ACCOUNT;
+ Border = TRUE ;
+ Pos = MAP_APPFONT( 6 , 173 ) ;
+ Size = MAP_APPFONT( 165 , 12 ) ;
+ PassWord = TRUE ;
+ };
+
+ CheckBox CB_LOGIN_SAVEPASSWORD
+ {
+ HelpId = HID_LOGIN_DLG_REMEMBER_PASSWORD;
+ Pos = MAP_APPFONT( 6 , 190 ) ;
+ Size = MAP_APPFONT( 165 , 10 ) ;
+ Text [ en-US ] = "~Remember password" ;
+ };
+
+ CheckBox CB_LOGIN_USESYSCREDS
+ {
+ HelpId = HID_LOGIN_DLG_USE_SYSTEM_CREDENTIALS;
+ Pos = MAP_APPFONT( 6 , 203 ) ;
+ Size = MAP_APPFONT( 165 , 10 ) ;
+ Text [ en-US ] = "~Use system credentials" ;
+ };
+
+ FixedLine FL_BUTTONS
+ {
+ Pos = MAP_APPFONT( 0 , 216 ) ;
+ Size = MAP_APPFONT( 177 , 8 ) ;
+ };
+
+ OKButton BTN_LOGIN_OK
+ {
+ Pos = MAP_APPFONT( 6 , 227 ) ;
+ Size = MAP_APPFONT( 50 , 14 ) ;
+ DefButton = TRUE ;
+ };
+
+ CancelButton BTN_LOGIN_CANCEL
+ {
+ Pos = MAP_APPFONT( 66 , 227 ) ;
+ Size = MAP_APPFONT( 50 , 14 ) ;
+ };
+
+ HelpButton BTN_LOGIN_HELP
+ {
+ Pos = MAP_APPFONT( 121 , 227 ) ;
+ Size = MAP_APPFONT( 50 , 14 ) ;
+ };
+};
+
diff --git a/uui/source/loginerr.hxx b/uui/source/loginerr.hxx
new file mode 100644
index 000000000000..d8cc696ad87b
--- /dev/null
+++ b/uui/source/loginerr.hxx
@@ -0,0 +1,180 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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 m_LOGINERR_HXX
+#define m_LOGINERR_HXX
+
+#include <tools/string.hxx>
+
+//=========================================================================
+
+#define LOGINERROR_FLAG_MODIFY_ACCOUNT 1
+#define LOGINERROR_FLAG_MODIFY_USER_NAME 2
+#define LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD 4
+#define LOGINERROR_FLAG_IS_REMEMBER_PASSWORD 8
+#define LOGINERROR_FLAG_CAN_USE_SYSCREDS 16
+#define LOGINERROR_FLAG_IS_USE_SYSCREDS 32
+#define LOGINERROR_FLAG_REMEMBER_PERSISTENT 64
+
+class LoginErrorInfo
+{
+private:
+ String m_aTitle;
+ String m_aServer;
+ String m_aAccount;
+ String m_aUserName;
+ String m_aPassword;
+ String m_aPasswordToModify;
+ String m_aPath;
+ String m_aErrorText;
+ BYTE m_nFlags;
+ USHORT m_nRet;
+ bool m_bRecommendToOpenReadonly;
+
+public:
+ LoginErrorInfo()
+ : m_nFlags( LOGINERROR_FLAG_MODIFY_USER_NAME ),
+ m_nRet( ERRCODE_BUTTON_CANCEL )
+ {
+ }
+
+ const String& GetTitle() const { return m_aTitle; }
+ const String& GetServer() const { return m_aServer; }
+ const String& GetAccount() const { return m_aAccount; }
+ const String& GetUserName() const { return m_aUserName; }
+ const String& GetPassword() const { return m_aPassword; }
+ const String& GetPasswordToModify() const { return m_aPasswordToModify; }
+ bool IsRecommendToOpenReadonly() const { return m_bRecommendToOpenReadonly; }
+ const String& GetPath() const { return m_aPath; }
+ const String& GetErrorText() const { return m_aErrorText; }
+ BOOL GetCanRememberPassword() const { return ( m_nFlags & LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD ); }
+ BOOL GetIsRememberPersistent() const { return ( m_nFlags & LOGINERROR_FLAG_REMEMBER_PERSISTENT ); }
+ BOOL GetIsRememberPassword() const { return ( m_nFlags & LOGINERROR_FLAG_IS_REMEMBER_PASSWORD ); }
+
+ BOOL GetCanUseSystemCredentials() const
+ { return ( m_nFlags & LOGINERROR_FLAG_CAN_USE_SYSCREDS ); }
+ BOOL GetIsUseSystemCredentials() const
+ { return ( m_nFlags & LOGINERROR_FLAG_IS_USE_SYSCREDS ) ==
+ LOGINERROR_FLAG_IS_USE_SYSCREDS; }
+ BYTE GetFlags() const { return m_nFlags; }
+ USHORT GetResult() const { return m_nRet; }
+
+ void SetTitle( const String& aTitle )
+ { m_aTitle = aTitle; }
+ void SetServer( const String& aServer )
+ { m_aServer = aServer; }
+ void SetAccount( const String& aAccount )
+ { m_aAccount = aAccount; }
+ void SetUserName( const String& aUserName )
+ { m_aUserName = aUserName; }
+ void SetPassword( const String& aPassword )
+ { m_aPassword = aPassword; }
+ void SetPasswordToModify( const String& aPassword )
+ { m_aPasswordToModify = aPassword; }
+ void SetRecommendToOpenReadonly( bool bVal )
+ { m_bRecommendToOpenReadonly = bVal; }
+ void SetPath( const String& aPath )
+ { m_aPath = aPath; }
+ void SetErrorText( const String& aErrorText )
+ { m_aErrorText = aErrorText; }
+ void SetFlags( BYTE nFlags )
+ { m_nFlags = nFlags; }
+
+ inline void SetCanRememberPassword( BOOL bSet );
+ inline void SetIsRememberPassword( BOOL bSet );
+ inline void SetIsRememberPersistent( BOOL bSet );
+
+ inline void SetCanUseSystemCredentials( BOOL bSet );
+ inline void SetIsUseSystemCredentials( BOOL bSet );
+ inline void SetModifyAccount( BOOL bSet );
+ inline void SetModifyUserName( BOOL bSet );
+
+ void SetResult( USHORT nRet )
+ { m_nRet = nRet; }
+};
+
+inline void LoginErrorInfo::SetCanRememberPassword( BOOL bSet )
+{
+ if ( bSet )
+ m_nFlags |= LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD;
+ else
+ m_nFlags &= ~LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD;
+}
+
+inline void LoginErrorInfo::SetIsRememberPassword( BOOL bSet )
+{
+ if ( bSet )
+ m_nFlags |= LOGINERROR_FLAG_IS_REMEMBER_PASSWORD;
+ else
+ m_nFlags &= ~LOGINERROR_FLAG_IS_REMEMBER_PASSWORD;
+}
+
+inline void LoginErrorInfo::SetIsRememberPersistent( BOOL bSet )
+{
+ if ( bSet )
+ m_nFlags |= LOGINERROR_FLAG_REMEMBER_PERSISTENT;
+ else
+ m_nFlags &= ~LOGINERROR_FLAG_REMEMBER_PERSISTENT;
+}
+
+inline void LoginErrorInfo::SetCanUseSystemCredentials( BOOL bSet )
+{
+ if ( bSet )
+ m_nFlags |= LOGINERROR_FLAG_CAN_USE_SYSCREDS;
+ else
+ m_nFlags &= ~LOGINERROR_FLAG_CAN_USE_SYSCREDS;
+}
+
+inline void LoginErrorInfo::SetIsUseSystemCredentials( BOOL bSet )
+{
+ if ( bSet )
+ m_nFlags |= LOGINERROR_FLAG_IS_USE_SYSCREDS;
+ else
+ m_nFlags &= ~LOGINERROR_FLAG_IS_USE_SYSCREDS;
+}
+
+inline void LoginErrorInfo::SetModifyAccount( BOOL bSet )
+{
+ if ( bSet )
+ m_nFlags |= LOGINERROR_FLAG_MODIFY_ACCOUNT;
+ else
+ m_nFlags &= ~LOGINERROR_FLAG_MODIFY_ACCOUNT;
+}
+
+inline void LoginErrorInfo::SetModifyUserName( BOOL bSet )
+{
+ if ( bSet )
+ m_nFlags |= LOGINERROR_FLAG_MODIFY_USER_NAME;
+ else
+ m_nFlags &= ~LOGINERROR_FLAG_MODIFY_USER_NAME;
+}
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/makefile.mk b/uui/source/makefile.mk
new file mode 100644
index 000000000000..5c20e593046a
--- /dev/null
+++ b/uui/source/makefile.mk
@@ -0,0 +1,87 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ = ..
+PRJNAME = uui
+TARGET = source
+ENABLE_EXCEPTIONS = true
+
+.INCLUDE: settings.mk
+
+SLOFILES = \
+ $(SLO)$/cookiedg.obj \
+ $(SLO)$/iahndl.obj \
+ $(SLO)$/iahndl-authentication.obj \
+ $(SLO)$/iahndl-ssl.obj \
+ $(SLO)$/iahndl-cookies.obj \
+ $(SLO)$/iahndl-filter.obj \
+ $(SLO)$/iahndl-locking.obj \
+ $(SLO)$/iahndl-ioexceptions.obj \
+ $(SLO)$/iahndl-errorhandler.obj \
+ $(SLO)$/logindlg.obj \
+ $(SLO)$/services.obj \
+ $(SLO)$/masterpassworddlg.obj \
+ $(SLO)$/masterpasscrtdlg.obj \
+ $(SLO)$/openlocked.obj \
+ $(SLO)$/passworddlg.obj \
+ $(SLO)$/passcrtdlg.obj \
+ $(SLO)$/fltdlg.obj \
+ $(SLO)$/interactionhandler.obj \
+ $(SLO)$/requeststringresolver.obj \
+ $(SLO)$/unknownauthdlg.obj \
+ $(SLO)$/sslwarndlg.obj \
+ $(SLO)$/secmacrowarnings.obj \
+ $(SLO)$/filechanged.obj \
+ $(SLO)$/alreadyopen.obj \
+ $(SLO)$/lockfailed.obj \
+ $(SLO)$/trylater.obj \
+ $(SLO)$/newerverwarn.obj \
+ $(SLO)$/passwordcontainer.obj
+
+SRS1NAME=$(TARGET)
+SRC1FILES = \
+ cookiedg.src \
+ ids.src \
+ logindlg.src \
+ masterpassworddlg.src \
+ masterpasscrtdlg.src \
+ openlocked.src \
+ passworddlg.src \
+ passcrtdlg.src \
+ passworderrs.src \
+ fltdlg.src \
+ unknownauthdlg.src\
+ sslwarndlg.src\
+ secmacrowarnings.src\
+ filechanged.src\
+ alreadyopen.src\
+ lockfailed.src\
+ trylater.src\
+ newerverwarn.src
+
+.INCLUDE: target.mk
+
diff --git a/uui/source/masterpasscrtdlg.cxx b/uui/source/masterpasscrtdlg.cxx
new file mode 100644
index 000000000000..cda0ca0f584d
--- /dev/null
+++ b/uui/source/masterpasscrtdlg.cxx
@@ -0,0 +1,189 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include <sal/macros.h>
+#include <svtools/filedlg.hxx>
+#include <vcl/msgbox.hxx>
+
+#include <ids.hrc>
+#include <masterpasscrtdlg.hrc>
+#include <masterpasscrtdlg.hxx>
+
+// MasterPasswordCreateDialog---------------------------------------------------
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( MasterPasswordCreateDialog, EditHdl_Impl, Edit *, EMPTYARG )
+{
+ aOKBtn.Enable( aEDMasterPasswordCrt.GetText().Len() >= nMinLen );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( MasterPasswordCreateDialog, OKHdl_Impl, OKButton *, EMPTYARG )
+{
+ // compare both passwords and show message box if there are not equal!!
+ if( aEDMasterPasswordCrt.GetText() == aEDMasterPasswordRepeat.GetText() )
+ EndDialog( RET_OK );
+ else
+ {
+ String aErrorMsg( ResId( STR_ERROR_PASSWORDS_NOT_IDENTICAL, *pResourceMgr ));
+ ErrorBox aErrorBox( this, WB_OK, aErrorMsg );
+ aErrorBox.Execute();
+ aEDMasterPasswordCrt.SetText( String() );
+ aEDMasterPasswordRepeat.SetText( String() );
+ aEDMasterPasswordCrt.GrabFocus();
+ }
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+MasterPasswordCreateDialog::MasterPasswordCreateDialog
+(
+ Window* pParent,
+ ResMgr* pResMgr
+) :
+
+ ModalDialog( pParent, ResId( DLG_UUI_MASTERPASSWORD_CRT, *pResMgr ) ),
+
+ aFTInfoText ( this, ResId( FT_INFOTEXT, *pResMgr ) ),
+ aFLInfoText ( this, ResId( FL_INFOTEXT, *pResMgr ) ),
+
+ aFTMasterPasswordCrt ( this, ResId( FT_MASTERPASSWORD_CRT, *pResMgr ) ),
+ aEDMasterPasswordCrt ( this, ResId( ED_MASTERPASSWORD_CRT, *pResMgr ) ),
+ aFTMasterPasswordRepeat ( this, ResId( FT_MASTERPASSWORD_REPEAT, *pResMgr ) ),
+ aEDMasterPasswordRepeat ( this, ResId( ED_MASTERPASSWORD_REPEAT, *pResMgr ) ),
+
+ aFTCautionText ( this, ResId( FT_CAUTIONTEXT, *pResMgr ) ),
+ aFLCautionText ( this, ResId( FL_CAUTIONTEXT, *pResMgr ) ),
+
+ aFTMasterPasswordWarning ( this, ResId( FT_MASTERPASSWORD_WARNING, *pResMgr ) ),
+ aFL ( this, ResId( FL_FIXED_LINE, *pResMgr ) ),
+ aOKBtn ( this, ResId( BTN_MASTERPASSCRT_OK, *pResMgr ) ),
+ aCancelBtn ( this, ResId( BTN_MASTERPASSCRT_CANCEL, *pResMgr ) ),
+ aHelpBtn ( this, ResId( BTN_MASTERPASSCRT_HELP, *pResMgr ) ),
+
+ pResourceMgr ( pResMgr ),
+ nMinLen ( 5 )
+{
+ FreeResource();
+
+ aOKBtn.Enable( sal_False );
+ aOKBtn.SetClickHdl( LINK( this, MasterPasswordCreateDialog, OKHdl_Impl ) );
+ aEDMasterPasswordCrt.SetModifyHdl( LINK( this, MasterPasswordCreateDialog, EditHdl_Impl ) );
+
+ CalculateTextHeight();
+
+ long nLableWidth = aFTMasterPasswordWarning.GetSizePixel().Width();
+ long nLabelHeight = aFTMasterPasswordWarning.GetSizePixel().Height();
+ long nTextWidth = aFTMasterPasswordWarning.GetCtrlTextWidth( aFTMasterPasswordWarning.GetText() );
+ long nTextHeight = aFTMasterPasswordWarning.GetTextHeight();
+
+ Rectangle aLabelRect( aFTMasterPasswordWarning.GetPosPixel(), aFTMasterPasswordWarning.GetSizePixel() );
+ Rectangle aRect = aFTMasterPasswordWarning.GetTextRect( aLabelRect, aFTMasterPasswordWarning.GetText() );
+
+ long nNewLabelHeight = 0;
+ if ( nTextWidth > 0 )
+ {
+ for( nNewLabelHeight = ( nTextWidth / nLableWidth + 1 ) * nTextHeight;
+ nNewLabelHeight < aRect.GetHeight();
+ nNewLabelHeight += nTextHeight ) {};
+ }
+
+ long nDelta = nNewLabelHeight - nLabelHeight;
+ Size aNewDlgSize = GetSizePixel();
+ aNewDlgSize.Height() += nDelta;
+ SetSizePixel( aNewDlgSize );
+
+ Size aNewWarningSize = aFTMasterPasswordWarning.GetSizePixel();
+ aNewWarningSize.Height() = nNewLabelHeight;
+ aFTMasterPasswordWarning.SetPosSizePixel( aFTMasterPasswordWarning.GetPosPixel(), aNewWarningSize );
+
+ Window* pControls[] = { &aFL, &aOKBtn, &aCancelBtn, &aHelpBtn };
+ const sal_Int32 nCCount = SAL_N_ELEMENTS( pControls );
+ for ( int i = 0; i < nCCount; ++i )
+ {
+ Point aNewPos =(*pControls[i]).GetPosPixel();
+ aNewPos.Y() += nDelta;
+ pControls[i]->SetPosSizePixel( aNewPos, pControls[i]->GetSizePixel() );
+ }
+};
+
+void MasterPasswordCreateDialog::CalculateTextHeight()
+{
+ Size aSize = aFTInfoText.GetSizePixel();
+ Size aMinSize = aFTInfoText.CalcMinimumSize( aSize.Width() );
+ long nDelta = 0;
+
+ if ( aSize.Height() > aMinSize.Height() )
+ {
+ aFTInfoText.SetSizePixel( aMinSize );
+ nDelta = aSize.Height() - aMinSize.Height();
+ Window* pWins[] = { &aFLInfoText, &aFTMasterPasswordCrt, &aEDMasterPasswordCrt,
+ &aFTMasterPasswordRepeat, &aEDMasterPasswordRepeat, &aFTCautionText,
+ &aFLCautionText, &aOKBtn, &aCancelBtn, &aHelpBtn };
+ Window** pWindow = pWins;
+ const sal_Int32 nCount = SAL_N_ELEMENTS( pWins );
+ for ( sal_Int32 i = 0; i < nCount; ++i, ++pWindow )
+ {
+ Point aNewPos = (*pWindow)->GetPosPixel();
+ aNewPos.Y() -= nDelta;
+ (*pWindow)->SetPosPixel( aNewPos );
+ }
+ }
+
+ aSize = aFTCautionText.GetSizePixel();
+ aMinSize = aFTCautionText.CalcMinimumSize( aSize.Width() );
+
+ if ( aSize.Height() > aMinSize.Height() )
+ {
+ aFTCautionText.SetSizePixel( aMinSize );
+ long nTemp = aSize.Height() - aMinSize.Height();
+ nDelta += nTemp;
+ Window* pWins[] = { &aFLCautionText, &aOKBtn, &aCancelBtn, &aHelpBtn };
+ Window** pWindow = pWins;
+ const sal_Int32 nCount = SAL_N_ELEMENTS( pWins );
+ for ( sal_Int32 i = 0; i < nCount; ++i, ++pWindow )
+ {
+ Point aNewPos = (*pWindow)->GetPosPixel();
+ aNewPos.Y() -= nTemp;
+ (*pWindow)->SetPosPixel( aNewPos );
+ }
+ }
+
+ if ( nDelta > 0 )
+ {
+ Size aDlgSize = GetOutputSizePixel();
+ aDlgSize.Height() -= nDelta;
+ SetSizePixel( aDlgSize );
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/masterpasscrtdlg.hrc b/uui/source/masterpasscrtdlg.hrc
new file mode 100644
index 000000000000..634a047478b6
--- /dev/null
+++ b/uui/source/masterpasscrtdlg.hrc
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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 UUI_MASTERPASSCRT_HRC
+#define UUI_MASTERPASSCRT_HRC
+
+#include <svtools/controldims.hrc>
+
+//============================================================================
+
+#define FT_INFOTEXT 10
+#define FL_INFOTEXT 11
+
+#define FT_MASTERPASSWORD_CRT 20
+#define ED_MASTERPASSWORD_CRT 21
+#define FT_MASTERPASSWORD_REPEAT 22
+#define ED_MASTERPASSWORD_REPEAT 23
+#define FT_MASTERPASSWORD_WARNING 24
+#define FL_FIXED_LINE 30
+
+#define FT_CAUTIONTEXT 30
+#define FL_CAUTIONTEXT 31
+
+#define BTN_MASTERPASSCRT_OK 50
+#define BTN_MASTERPASSCRT_CANCEL 51
+#define BTN_MASTERPASSCRT_HELP 52
+
+#define ROW_0 (RSC_SP_FLGR_INNERBORDER_TOP)
+#define ROW_1 (ROW_0+7*RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_2 (ROW_1+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_3 (ROW_2+RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_4 (ROW_3+RSC_CD_TEXTBOX_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_5 (ROW_4+RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_6 (ROW_5+RSC_CD_TEXTBOX_HEIGHT+RSC_SP_CTRL_X)
+#define ROW_7 (ROW_6+8*RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_8 (ROW_7+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_9 (ROW_8+RSC_CD_PUSHBUTTON_HEIGHT+RSC_SP_CTRL_X)
+
+#define COL_0 (RSC_SP_FLGR_INNERBORDER_LEFT)
+#define COL_2 (DLG_WIDTH-RSC_SP_FLGR_INNERBORDER_LEFT-RSC_CD_PUSHBUTTON_WIDTH)
+#define COL_1 (COL_2-RSC_SP_CTRL_GROUP_X-RSC_CD_PUSHBUTTON_WIDTH)
+
+#define DLG_WIDTH 180
+#define CTRL_WIDTH (DLG_WIDTH-2*RSC_SP_FLGR_INNERBORDER_LEFT)
+#define DLG_HEIGHT (ROW_9)
+
+#endif // UUI_MASTERPASSCRT_HRC
+
diff --git a/uui/source/masterpasscrtdlg.hxx b/uui/source/masterpasscrtdlg.hxx
new file mode 100644
index 000000000000..e9e0a98b0cfa
--- /dev/null
+++ b/uui/source/masterpasscrtdlg.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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 UUI_MASTERPASSCRTDLG_HXX
+#define UUI_MASTERPASSCRTDLG_HXX
+
+#include <com/sun/star/task/PasswordRequestMode.hpp>
+#include <svtools/stdctrl.hxx>
+#include <vcl/button.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/group.hxx>
+#include <vcl/fixed.hxx>
+
+//============================================================================
+class MasterPasswordCreateDialog : public ModalDialog
+{
+private:
+ FixedText aFTInfoText;
+ FixedLine aFLInfoText;
+
+ FixedText aFTMasterPasswordCrt;
+ Edit aEDMasterPasswordCrt;
+ FixedText aFTMasterPasswordRepeat;
+ Edit aEDMasterPasswordRepeat;
+
+ FixedText aFTCautionText;
+ FixedLine aFLCautionText;
+
+ FixedText aFTMasterPasswordWarning;
+ FixedLine aFL;
+ OKButton aOKBtn;
+ CancelButton aCancelBtn;
+ HelpButton aHelpBtn;
+
+
+ DECL_LINK( OKHdl_Impl, OKButton * );
+ DECL_LINK( EditHdl_Impl, Edit * );
+
+public:
+ MasterPasswordCreateDialog( Window* pParent, ResMgr * pResMgr );
+
+ String GetMasterPassword() const { return aEDMasterPasswordCrt.GetText(); }
+
+private:
+ ResMgr* pResourceMgr;
+ sal_uInt16 nMinLen;
+
+ void CalculateTextHeight();
+};
+
+#endif // UUI_MASTERPASSCRTDLG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/masterpasscrtdlg.src b/uui/source/masterpasscrtdlg.src
new file mode 100644
index 000000000000..65e24205a583
--- /dev/null
+++ b/uui/source/masterpasscrtdlg.src
@@ -0,0 +1,133 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#define __RSC
+
+#ifndef UUI_IDS_HRC
+#include <ids.hrc>
+#endif
+#ifndef UUI_MASTERPASSCRTDLG_HRC
+#include <masterpasscrtdlg.hrc>
+#endif
+
+ModalDialog DLG_UUI_MASTERPASSWORD_CRT
+{
+ HelpId = HID_DLG_MASTERPASSWORD_CRT ;
+ Border = TRUE ;
+ Moveable = TRUE ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( DLG_WIDTH , DLG_HEIGHT ) ;
+ Text [ en-US ] = "Set Master Password";
+ FixedText FT_INFOTEXT
+ {
+ Pos = MAP_APPFONT ( COL_0 , ROW_0 ) ;
+ Size = MAP_APPFONT ( CTRL_WIDTH , 7*RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ WordBreak = TRUE ;
+ Text [ en-US ] = "Passwords for web connections are protected by a master password. You will be asked to enter it once per session, if %PRODUCTNAME retrieves a password from the protected password list.";
+ };
+ FixedLine FL_INFOTEXT
+ {
+ Pos = MAP_APPFONT ( 0 , ROW_1 ) ;
+ Size = MAP_APPFONT ( DLG_WIDTH , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ };
+ FixedText FT_MASTERPASSWORD_CRT
+ {
+ Pos = MAP_APPFONT ( COL_0 , ROW_2 ) ;
+ Size = MAP_APPFONT ( CTRL_WIDTH , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "~Enter password";
+ };
+ Edit ED_MASTERPASSWORD_CRT
+ {
+ Pos = MAP_APPFONT ( COL_0 , ROW_3 ) ;
+ Size = MAP_APPFONT ( CTRL_WIDTH , RSC_CD_TEXTBOX_HEIGHT ) ;
+ Border = TRUE ;
+ PassWord = TRUE ;
+ };
+ FixedText FT_MASTERPASSWORD_REPEAT
+ {
+ Pos = MAP_APPFONT ( COL_0 , ROW_4 ) ;
+ Size = MAP_APPFONT ( CTRL_WIDTH , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "~Reenter password";
+ };
+ Edit ED_MASTERPASSWORD_REPEAT
+ {
+ Pos = MAP_APPFONT ( COL_0 , ROW_5 ) ;
+ Size = MAP_APPFONT ( CTRL_WIDTH , RSC_CD_TEXTBOX_HEIGHT ) ;
+ Border = TRUE ;
+ PassWord = TRUE ;
+ };
+ FixedText FT_CAUTIONTEXT
+ {
+ Pos = MAP_APPFONT ( COL_0 , ROW_6 ) ;
+ Size = MAP_APPFONT ( CTRL_WIDTH , 8*RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ WordBreak = TRUE ;
+ Text [ en-US ] = "Caution: Make sure you remember the Master Password you have set. If you forget your Master Password, you will be unable to access any of the information protected by it. Passwords are case-sensitive and at least five characters long.";
+ };
+ FixedLine FL_CAUTIONTEXT
+ {
+ Pos = MAP_APPFONT ( 0 , ROW_7 ) ;
+ Size = MAP_APPFONT ( DLG_WIDTH , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ };
+ HelpButton BTN_MASTERPASSCRT_HELP
+ {
+ Pos = MAP_APPFONT ( COL_0 , ROW_8 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ };
+ OKButton BTN_MASTERPASSCRT_OK
+ {
+ Pos = MAP_APPFONT ( COL_1 , ROW_8 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_MASTERPASSCRT_CANCEL
+ {
+ Pos = MAP_APPFONT ( COL_2 , ROW_8 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/uui/source/masterpassworddlg.cxx b/uui/source/masterpassworddlg.cxx
new file mode 100644
index 000000000000..163fbe6e23af
--- /dev/null
+++ b/uui/source/masterpassworddlg.cxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include <svtools/filedlg.hxx>
+#include <vcl/msgbox.hxx>
+
+#include <ids.hrc>
+#include <masterpassworddlg.hrc>
+#include <masterpassworddlg.hxx>
+
+// MasterPasswordDialog---------------------------------------------------
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( MasterPasswordDialog, OKHdl_Impl, OKButton *, EMPTYARG )
+{
+ EndDialog( RET_OK );
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+MasterPasswordDialog::MasterPasswordDialog
+(
+ Window* pParent,
+ ::com::sun::star::task::PasswordRequestMode aDialogMode,
+ ResMgr* pResMgr
+) :
+
+ ModalDialog( pParent, ResId( DLG_UUI_MASTERPASSWORD, *pResMgr ) ),
+
+ aFTMasterPassword ( this, ResId( FT_MASTERPASSWORD, *pResMgr ) ),
+ aEDMasterPassword ( this, ResId( ED_MASTERPASSWORD, *pResMgr ) ),
+ aFL ( this, ResId( FL_FIXED_LINE, *pResMgr ) ),
+ aOKBtn ( this, ResId( BTN_MASTERPASSWORD_OK, *pResMgr ) ),
+ aCancelBtn ( this, ResId( BTN_MASTERPASSWORD_CANCEL, *pResMgr ) ),
+ aHelpBtn ( this, ResId( BTN_MASTERPASSWORD_HELP, *pResMgr ) ),
+ nDialogMode ( aDialogMode ),
+ pResourceMgr ( pResMgr )
+{
+ if( nDialogMode == ::com::sun::star::task::PasswordRequestMode_PASSWORD_REENTER )
+ {
+ String aErrorMsg( ResId( STR_ERROR_MASTERPASSWORD_WRONG, *pResourceMgr ));
+ ErrorBox aErrorBox( pParent, WB_OK, aErrorMsg );
+ aErrorBox.Execute();
+ }
+
+ FreeResource();
+
+ aOKBtn.SetClickHdl( LINK( this, MasterPasswordDialog, OKHdl_Impl ) );
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/masterpassworddlg.hrc b/uui/source/masterpassworddlg.hrc
new file mode 100644
index 000000000000..ae6b95b1df07
--- /dev/null
+++ b/uui/source/masterpassworddlg.hrc
@@ -0,0 +1,42 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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 UUI_MASTERPASSWORD_HRC
+#define UUI_MASTERPASSWORD_HRC
+
+//============================================================================
+#define FT_MASTERPASSWORD 20
+#define ED_MASTERPASSWORD 21
+#define FT_MASTERPASSWORD_REPEAT 22
+#define ED_MASTERPASSWORD_REPEAT 23
+#define FL_FIXED_LINE 30
+
+#define BTN_MASTERPASSWORD_OK 50
+#define BTN_MASTERPASSWORD_CANCEL 51
+#define BTN_MASTERPASSWORD_HELP 52
+
+#endif // UUI_MASTERPASSWORD_HRC
diff --git a/uui/source/masterpassworddlg.hxx b/uui/source/masterpassworddlg.hxx
new file mode 100644
index 000000000000..8c4037502beb
--- /dev/null
+++ b/uui/source/masterpassworddlg.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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 UUI_MASTERPASSWORDDLG_HXX
+#define UUI_MASTERPASSWORDDLG_HXX
+
+#include <com/sun/star/task/PasswordRequestMode.hpp>
+#include <svtools/stdctrl.hxx>
+#include <vcl/button.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/group.hxx>
+
+//============================================================================
+class MasterPasswordDialog : public ModalDialog
+{
+ FixedText aFTMasterPassword;
+ Edit aEDMasterPassword;
+ FixedLine aFL;
+ OKButton aOKBtn;
+ CancelButton aCancelBtn;
+ HelpButton aHelpBtn;
+
+
+ DECL_LINK( OKHdl_Impl, OKButton * );
+
+public:
+ MasterPasswordDialog( Window* pParent, ::com::sun::star::task::PasswordRequestMode nDlgMode, ResMgr * pResMgr );
+
+ String GetMasterPassword() const { return aEDMasterPassword.GetText(); }
+
+private:
+ ::com::sun::star::task::PasswordRequestMode nDialogMode;
+ ResMgr* pResourceMgr;
+};
+
+#endif // UUI_MASTERPASSWORDDLG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/masterpassworddlg.src b/uui/source/masterpassworddlg.src
new file mode 100644
index 000000000000..29d799c5cc47
--- /dev/null
+++ b/uui/source/masterpassworddlg.src
@@ -0,0 +1,102 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#define __RSC
+
+#ifndef UUI_IDS_HRC
+#include <ids.hrc>
+#endif
+#ifndef UUI_MASTERPASSWORDDLG_HRC
+#include <masterpassworddlg.hrc>
+#endif
+
+ModalDialog DLG_UUI_MASTERPASSWORD
+{
+ HelpId = HID_DLG_MASTERPASSWORD_UUI;
+ Border = TRUE ;
+ Moveable = TRUE ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 175 , 66 ) ;
+ FixedText FT_MASTERPASSWORD
+ {
+ Pos = MAP_APPFONT ( 3 , 4 ) ;
+ Size = MAP_APPFONT ( 169 , 9 ) ;
+ Text [ en-US ] = "Enter password";
+ };
+ Edit ED_MASTERPASSWORD
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 3 , 17 ) ;
+ Size = MAP_APPFONT ( 169 , 13 ) ;
+ PassWord = TRUE ;
+ };
+ FixedLine FL_FIXED_LINE
+ {
+ Pos = MAP_APPFONT( 0, 35 );
+ Size = MAP_APPFONT( 175, 6 );
+ };
+
+ OKButton BTN_MASTERPASSWORD_OK
+ {
+ Pos = MAP_APPFONT ( 65 , 45 ) ;
+ Size = MAP_APPFONT ( 51 , 13 ) ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_MASTERPASSWORD_CANCEL
+ {
+ Pos = MAP_APPFONT ( 120 , 45 ) ;
+ Size = MAP_APPFONT ( 51 , 13 ) ;
+ };
+ HelpButton BTN_MASTERPASSWORD_HELP
+ {
+ Pos = MAP_APPFONT ( 5 , 45 ) ;
+ Size = MAP_APPFONT ( 51 , 13 ) ;
+ };
+ Text [ en-US ] = "Enter Master Password";
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/uui/source/mphndl.hxx b/uui/source/mphndl.hxx
new file mode 100644
index 000000000000..933a21c59520
--- /dev/null
+++ b/uui/source/mphndl.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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 UUI_IAHNDL_HXX
+#define UUI_IAHNDL_HXX
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/task/XInteractionHandler.hpp>
+#include <com/sun/star/task/XPasswordContainer.hpp>
+#include <cppuhelper/weak.hxx>
+
+//============================================================================
+class UUIInteractionHandler:
+ public cppu::OWeakObject,
+ public com::sun::star::lang::XServiceInfo,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::task::XInteractionHandler
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::task::XPasswordContainer > mPContainer;
+
+public:
+ static sal_Char const m_aImplementationName[];
+
+ UUIInteractionHandler( com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory > const & );
+
+ virtual com::sun::star::uno::Any SAL_CALL
+ queryInterface(com::sun::star::uno::Type const & rType)
+ throw (com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL acquire()
+ throw (com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL release()
+ throw (com::sun::star::uno::RuntimeException);
+
+ virtual rtl::OUString SAL_CALL getImplementationName()
+ throw (com::sun::star::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL supportsService(rtl::OUString const &
+ rServiceName)
+ throw (com::sun::star::uno::RuntimeException);
+
+ virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL
+ getSupportedServiceNames() throw (com::sun::star::uno::RuntimeException);
+
+ virtual
+ com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL
+ getTypes() throw (com::sun::star::uno::RuntimeException);
+
+ virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
+ getImplementationId() throw (com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ handle(com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionRequest > const &
+ rRequest)
+ throw (com::sun::star::uno::RuntimeException);
+
+ static com::sun::star::uno::Sequence< rtl::OUString >
+ getSupportedServiceNames_static();
+
+ static com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
+ SAL_CALL
+ createInstance(com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory > const &);
+};
+
+#endif // UUI_IAHNDL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/newerverwarn.cxx b/uui/source/newerverwarn.cxx
new file mode 100644
index 000000000000..ed860428cff0
--- /dev/null
+++ b/uui/source/newerverwarn.cxx
@@ -0,0 +1,203 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "newerverwarn.hxx"
+#include "newerverwarn.hrc"
+#include "ids.hrc"
+
+#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/system/XSystemShellExecute.hpp>
+#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+#include <com/sun/star/container/XNameReplace.hpp>
+
+#include <comphelper/processfactory.hxx>
+#include <comphelper/configurationhelper.hxx>
+#include <comphelper/componentcontext.hxx>
+#include <rtl/bootstrap.hxx>
+#include <tools/diagnose_ex.h>
+#include <vcl/msgbox.hxx>
+#include <osl/process.h>
+
+namespace beans = ::com::sun::star::beans;
+namespace frame = ::com::sun::star::frame;
+namespace lang = ::com::sun::star::lang;
+namespace uno = ::com::sun::star::uno;
+namespace util = ::com::sun::star::util;
+namespace container = ::com::sun::star::container;
+
+using namespace com::sun::star::system;
+
+#define DEFINE_CONST_UNICODE( CONSTASCII ) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( CONSTASCII ) )
+
+namespace uui
+{
+
+NewerVersionWarningDialog::NewerVersionWarningDialog(
+ Window* pParent, const ::rtl::OUString& rVersion, ResMgr& rResMgr ) :
+
+ ModalDialog( pParent, ResId( RID_DLG_NEWER_VERSION_WARNING, rResMgr ) ),
+
+ m_aImage ( this, ResId( FI_IMAGE, rResMgr ) ),
+ m_aInfoText ( this, ResId( FT_INFO, rResMgr ) ),
+ m_aButtonLine ( this, ResId( FL_BUTTON, rResMgr ) ),
+ m_aUpdateBtn ( this, ResId( PB_UPDATE, rResMgr ) ),
+ m_aLaterBtn ( this, ResId( PB_LATER, rResMgr ) ),
+ m_sVersion ( rVersion )
+{
+ FreeResource();
+
+ m_aUpdateBtn.SetClickHdl( LINK( this, NewerVersionWarningDialog, UpdateHdl ) );
+ m_aLaterBtn.SetClickHdl( LINK( this, NewerVersionWarningDialog, LaterHdl ) );
+
+ InitButtonWidth();
+}
+
+NewerVersionWarningDialog::~NewerVersionWarningDialog()
+{
+}
+
+IMPL_LINK( NewerVersionWarningDialog, UpdateHdl, PushButton*, EMPTYARG )
+{
+ // detect execute path
+ ::rtl::OUString sProgramPath;
+ osl_getExecutableFile( &sProgramPath.pData );
+ sal_uInt32 nLastIndex = sProgramPath.lastIndexOf( '/' );
+ if ( nLastIndex > 0 )
+ sProgramPath = sProgramPath.copy( 0, nLastIndex + 1 );
+
+ // read keys from soffice.ini (sofficerc)
+ ::rtl::OUString sIniFileName = sProgramPath;
+ sIniFileName += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SAL_CONFIGFILE( "version" ) ) );
+ ::rtl::Bootstrap aIniFile( sIniFileName );
+ ::rtl::OUString sNotifyURL;
+ aIniFile.getFrom( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ODFNotifyURL" ) ), sNotifyURL );
+
+ try
+ {
+ if ( ( sNotifyURL.getLength() > 0 ) && ( m_sVersion.getLength() > 0 ) )
+ {
+ uno::Reference< lang::XMultiServiceFactory > xSMGR =
+ ::comphelper::getProcessServiceFactory();
+ uno::Reference< XSystemShellExecute > xSystemShell(
+ xSMGR->createInstance( ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.system.SystemShellExecute" ) ) ),
+ uno::UNO_QUERY_THROW );
+ sNotifyURL += m_sVersion;
+ if ( xSystemShell.is() && sNotifyURL.getLength() )
+ {
+ xSystemShell->execute(
+ sNotifyURL, ::rtl::OUString(), SystemShellExecuteFlags::DEFAULTS );
+ }
+ }
+ else
+ {
+ ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+
+ uno::Reference < container::XNameReplace > xUpdateConfig(
+ aContext.createComponent( "com.sun.star.setup.UpdateCheckConfig" ), uno::UNO_QUERY_THROW );
+
+ sal_Bool bUpdateCheckEnabled = sal_False;
+ OSL_VERIFY( xUpdateConfig->getByName( DEFINE_CONST_UNICODE( "AutoCheckEnabled" ) ) >>= bUpdateCheckEnabled );
+
+ // TODO: do we need to respect the bUpdateCheckEnabled flag? Finally, its meaning is "are automatic
+ // updates enabled", but this here is not an automatic update, but one triggered explicitly by the user.
+
+ uno::Any aVal = ::comphelper::ConfigurationHelper::readDirectKey(
+ aContext.getLegacyServiceFactory(),
+ DEFINE_CONST_UNICODE("org.openoffice.Office.Addons/"),
+ DEFINE_CONST_UNICODE("AddonUI/OfficeHelp/UpdateCheckJob"),
+ DEFINE_CONST_UNICODE("URL"),
+ ::comphelper::ConfigurationHelper::E_READONLY );
+ util::URL aURL;
+ if ( aVal >>= aURL.Complete )
+ {
+ uno::Reference< util::XURLTransformer > xTransformer(
+ aContext.createComponent( "com.sun.star.util.URLTransformer" ), uno::UNO_QUERY_THROW );
+ xTransformer->parseStrict( aURL );
+
+ uno::Reference < frame::XDesktop > xDesktop(
+ aContext.createComponent( "com.sun.star.frame.Desktop" ), uno::UNO_QUERY_THROW );
+
+ uno::Reference< frame::XDispatchProvider > xDispatchProvider(
+ xDesktop->getCurrentFrame(), uno::UNO_QUERY );
+ if ( !xDispatchProvider.is() )
+ xDispatchProvider = uno::Reference < frame::XDispatchProvider > ( xDesktop, uno::UNO_QUERY );
+
+ uno::Reference< frame::XDispatch > xDispatch =
+ xDispatchProvider->queryDispatch( aURL, rtl::OUString(), 0 );
+ if ( xDispatch.is() )
+ xDispatch->dispatch( aURL, uno::Sequence< beans::PropertyValue >() );
+ }
+ }
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ EndDialog( RET_OK );
+ return 0;
+}
+
+IMPL_LINK( NewerVersionWarningDialog, LaterHdl, CancelButton*, EMPTYARG )
+{
+ EndDialog( RET_ASK_LATER );
+ return 0;
+}
+
+void NewerVersionWarningDialog::InitButtonWidth()
+{
+ // one button too small for its text?
+ long nBtnTextWidth = m_aUpdateBtn.GetCtrlTextWidth( m_aUpdateBtn.GetText() );
+ long nTemp = m_aLaterBtn.GetCtrlTextWidth( m_aLaterBtn.GetText() );
+ if ( nTemp > nBtnTextWidth )
+ nBtnTextWidth = nTemp;
+ nBtnTextWidth = nBtnTextWidth * 115 / 100; // a little offset
+ long nMaxBtnWidth = LogicToPixel( Size( MAX_BUTTON_WIDTH, 0 ), MAP_APPFONT ).Width();
+ nBtnTextWidth = std::min( nBtnTextWidth, nMaxBtnWidth );
+ long nButtonWidth = m_aUpdateBtn .GetSizePixel().Width();
+
+ if ( nBtnTextWidth > nButtonWidth )
+ {
+ long nDelta = nBtnTextWidth - nButtonWidth;
+ Point aNewPos = m_aUpdateBtn.GetPosPixel();
+ aNewPos.X() -= 2*nDelta;
+ Size aNewSize = m_aUpdateBtn.GetSizePixel();
+ aNewSize.Width() += nDelta;
+ m_aUpdateBtn.SetPosSizePixel( aNewPos, aNewSize );
+ aNewPos = m_aLaterBtn.GetPosPixel();
+ aNewPos.X() -= nDelta;
+ m_aLaterBtn.SetPosSizePixel( aNewPos, aNewSize );
+ }
+}
+
+} // end of namespace uui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/newerverwarn.hrc b/uui/source/newerverwarn.hrc
new file mode 100644
index 000000000000..96551021cbaa
--- /dev/null
+++ b/uui/source/newerverwarn.hrc
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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 _NEWERVERSIONWARNING_HRC
+#define _NEWERVERSIONWARNING_HRC
+
+#include <svtools/controldims.hrc>
+
+#define FI_IMAGE 10
+#define FT_INFO 11
+#define FL_BUTTON 12
+#define PB_UPDATE 13
+#define PB_LATER 14
+
+#define IMAGE_WIDTH 20
+#define IMAGE_HEIGHT IMAGE_WIDTH
+#define INFO_WIDTH 180
+#define INFO_LINES 7
+#define DLG_WIDTH (RSC_SP_DLG_INNERBORDER_LEFT + IMAGE_WIDTH + RSC_SP_CTRL_X + INFO_WIDTH + RSC_SP_DLG_INNERBORDER_RIGHT)
+
+#define COL_1 RSC_SP_DLG_INNERBORDER_LEFT
+#define COL_2 (COL_1 + IMAGE_WIDTH + RSC_SP_CTRL_X)
+#define COL_4 (DLG_WIDTH - RSC_SP_DLG_INNERBORDER_LEFT - RSC_CD_PUSHBUTTON_WIDTH)
+#define COL_3 (COL_4 - RSC_SP_CTRL_GROUP_X - RSC_CD_PUSHBUTTON_WIDTH)
+
+#define ROW_1 RSC_SP_DLG_INNERBORDER_TOP
+#define ROW_2 (ROW_1 + INFO_LINES * RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_CTRL_GROUP_Y)
+#define ROW_3 (ROW_2 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_CTRL_GROUP_Y)
+
+#define DLG_HEIGHT (ROW_3 + RSC_CD_PUSHBUTTON_HEIGHT + RSC_SP_DLG_INNERBORDER_BOTTOM)
+#define MAX_BUTTON_WIDTH (DLG_WIDTH - RSC_SP_DLG_INNERBORDER_LEFT - RSC_SP_DLG_INNERBORDER_RIGHT - RSC_SP_CTRL_GROUP_X) / 2
+
+#endif // #ifndef _NEWERVERSIONWARNING_HRC
+
diff --git a/uui/source/newerverwarn.hxx b/uui/source/newerverwarn.hxx
new file mode 100644
index 000000000000..ed8ebac75477
--- /dev/null
+++ b/uui/source/newerverwarn.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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 _NEWERVERSIONWARNING_HXX
+#define _NEWERVERSIONWARNING_HXX
+
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/dialog.hxx>
+
+#define RET_ASK_LATER short( 100 )
+
+namespace uui
+{
+ class NewerVersionWarningDialog : public ModalDialog
+ {
+ private:
+ FixedImage m_aImage;
+ FixedText m_aInfoText;
+ FixedLine m_aButtonLine;
+ PushButton m_aUpdateBtn;
+ CancelButton m_aLaterBtn;
+
+ ::rtl::OUString m_sVersion;
+
+ DECL_LINK( UpdateHdl, PushButton* );
+ DECL_LINK( LaterHdl, CancelButton* );
+
+ void InitButtonWidth();
+
+ public:
+ NewerVersionWarningDialog( Window* pParent, const ::rtl::OUString& rVersion, ResMgr& rResMgr );
+ ~NewerVersionWarningDialog();
+ };
+} // namespace uui
+
+#endif // #ifndef _NEWERVERSIONWARNING_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/newerverwarn.src b/uui/source/newerverwarn.src
new file mode 100644
index 000000000000..c9889e6648fd
--- /dev/null
+++ b/uui/source/newerverwarn.src
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#define __RSC
+
+#include "newerverwarn.hrc"
+#include "ids.hrc"
+
+#define STD_MASKCOLOR Color { Red=0xffff; Green=0x0000; Blue=0xffff; }
+
+ModalDialog RID_DLG_NEWER_VERSION_WARNING
+{
+ HelpId = HID_DLG_NEWERVERSIONWARNING;
+ OutputSize = TRUE ;
+ Size = MAP_APPFONT ( DLG_WIDTH , DLG_HEIGHT ) ;
+ SvLook = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Text [ en-US ] = "%PRODUCTNAME Update Available" ;
+ FixedImage FI_IMAGE
+ {
+ Pos = MAP_APPFONT ( COL_1 , ROW_1 );
+ Size = MAP_APPFONT ( IMAGE_WIDTH , IMAGE_HEIGHT );
+ Hide = FALSE;
+ Fixed = Image
+ {
+ ImageBitmap = Bitmap { File = "versionwarning.png"; };
+ MaskColor = STD_MASKCOLOR;
+ };
+ };
+ FixedText FT_INFO
+ {
+ Pos = MAP_APPFONT( COL_2, ROW_1 );
+ Size = MAP_APPFONT( INFO_WIDTH, INFO_LINES * RSC_CD_FIXEDTEXT_HEIGHT );
+ Wordbreak = TRUE;
+ Text [ en-US ] = "This document was created by a newer version of %PRODUCTNAME. It may contain features not supported by your current version.\n\nClick 'Update Now...' to run online update and get the latest version of %PRODUCTNAME.";
+ };
+ FixedLine FL_BUTTON
+ {
+ Pos = MAP_APPFONT ( 0 , ROW_2 ) ;
+ Size = MAP_APPFONT ( DLG_WIDTH , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ };
+ PushButton PB_UPDATE
+ {
+ Pos = MAP_APPFONT ( COL_3 , ROW_3 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Update Now..." ;
+ };
+ CancelButton PB_LATER
+ {
+ Pos = MAP_APPFONT ( COL_4 , ROW_3 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Later" ;
+ };
+};
diff --git a/uui/source/openlocked.cxx b/uui/source/openlocked.cxx
new file mode 100644
index 000000000000..4734a486d326
--- /dev/null
+++ b/uui/source/openlocked.cxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "ids.hrc"
+#include "openlocked.hxx"
+
+OpenLockedQueryBox::OpenLockedQueryBox( Window* pParent, ResMgr* pResMgr, const String& aMessage ) :
+ MessBox(pParent, 0,
+ String( ResId( STR_OPENLOCKED_TITLE, *pResMgr ) ),
+ aMessage )
+{
+ SetImage( QueryBox::GetStandardImage() );
+
+ AddButton( String( ResId( STR_OPENLOCKED_OPENREADONLY_BTN, *pResMgr ) ), RET_YES,
+ BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_OKBUTTON | BUTTONDIALOG_FOCUSBUTTON);
+
+ AddButton( String( ResId( STR_OPENLOCKED_OPENCOPY_BTN, *pResMgr ) ), RET_NO, 0);
+
+ AddButton( BUTTON_CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON );
+ SetButtonHelpText( RET_YES, String() );
+ SetButtonHelpText( RET_NO, String() );
+}
+
+OpenLockedQueryBox::~OpenLockedQueryBox()
+{
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/openlocked.hxx b/uui/source/openlocked.hxx
new file mode 100644
index 000000000000..259a355553ee
--- /dev/null
+++ b/uui/source/openlocked.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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 _UUI_OPENLOCKED_HXX
+#define _UUI_OPENLOCKED_HXX
+
+#include <vcl/msgbox.hxx>
+
+class OpenLockedQueryBox : public MessBox
+{
+public:
+ OpenLockedQueryBox( Window* pParent, ResMgr* pResMgr, const String& aMessage );
+ ~OpenLockedQueryBox();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/openlocked.src b/uui/source/openlocked.src
new file mode 100644
index 000000000000..0e862064bcec
--- /dev/null
+++ b/uui/source/openlocked.src
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#define __RSC
+
+#ifndef UUI_IDS_HRC
+#include <ids.hrc>
+#endif
+
+String STR_OPENLOCKED_TITLE
+{
+ Text [ en-US ] = "Document in Use";
+};
+String STR_OPENLOCKED_MSG
+{
+ Text [ en-US ] = "Document file '$(ARG1)' is locked for editing by:\n\n$(ARG2)\n\nOpen document read-only or open a copy of the document for editing.\n\n";
+};
+String STR_OPENLOCKED_OPENREADONLY_BTN
+{
+ Text [ en-US ] = "Open ~Read-Only";
+};
+String STR_OPENLOCKED_OPENCOPY_BTN
+{
+ Text [ en-US ] = "Open ~Copy";
+};
+String STR_UNKNOWNUSER
+{
+ Text [ en-US ] = "Unknown User";
+};
+
diff --git a/uui/source/passcrtdlg.cxx b/uui/source/passcrtdlg.cxx
new file mode 100644
index 000000000000..6b9b605b41bd
--- /dev/null
+++ b/uui/source/passcrtdlg.cxx
@@ -0,0 +1,128 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include <sal/macros.h>
+#include <svtools/filedlg.hxx>
+#include <vcl/msgbox.hxx>
+
+#include <ids.hrc>
+#include <passcrtdlg.hrc>
+#include <passcrtdlg.hxx>
+
+// PasswordCreateDialog---------------------------------------------------
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( PasswordCreateDialog, EditHdl_Impl, Edit *, EMPTYARG )
+{
+ aOKBtn.Enable( aEDPasswordCrt.GetText().Len() >= nMinLen );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( PasswordCreateDialog, OKHdl_Impl, OKButton *, EMPTYARG )
+{
+ // compare both passwords and show message box if there are not equal!!
+ if( aEDPasswordCrt.GetText() == aEDPasswordRepeat.GetText() )
+ EndDialog( RET_OK );
+ else
+ {
+ String aErrorMsg( ResId( STR_ERROR_PASSWORDS_NOT_IDENTICAL, *pResourceMgr ));
+ ErrorBox aErrorBox( this, WB_OK, aErrorMsg );
+ aErrorBox.Execute();
+ aEDPasswordCrt.SetText( String() );
+ aEDPasswordRepeat.SetText( String() );
+ aEDPasswordCrt.GrabFocus();
+ }
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+PasswordCreateDialog::PasswordCreateDialog( Window* _pParent, ResMgr * pResMgr, bool bMSCryptoMode)
+ :ModalDialog( _pParent, ResId( DLG_UUI_PASSWORD_CRT, *pResMgr ) )
+ ,aFTPasswordCrt ( this, ResId( FT_PASSWORD_CRT, *pResMgr ) )
+ ,aEDPasswordCrt ( this, ResId( ED_PASSWORD_CRT, *pResMgr ) )
+ ,aFTPasswordRepeat ( this, ResId( FT_PASSWORD_REPEAT, *pResMgr ) )
+ ,aEDPasswordRepeat ( this, ResId( ED_PASSWORD_REPEAT, *pResMgr ) )
+ ,aFTWarning ( this, ResId( bMSCryptoMode ? FT_MSPASSWORD_WARNING : FT_PASSWORD_WARNING, *pResMgr ) )
+ ,aFixedLine1 ( this, ResId( FL_FIXED_LINE_1, *pResMgr ) )
+ ,aOKBtn ( this, ResId( BTN_PASSCRT_OK, *pResMgr ) )
+ ,aCancelBtn ( this, ResId( BTN_PASSCRT_CANCEL, *pResMgr ) )
+ ,aHelpBtn ( this, ResId( BTN_PASSCRT_HELP, *pResMgr ) )
+ ,pResourceMgr ( pResMgr )
+ ,nMinLen(1) // if it should be changed for ODF, it must stay 1 for bMSCryptoMode
+{
+ FreeResource();
+
+ aOKBtn.SetClickHdl( LINK( this, PasswordCreateDialog, OKHdl_Impl ) );
+ aEDPasswordCrt.SetModifyHdl( LINK( this, PasswordCreateDialog, EditHdl_Impl ) );
+
+ aOKBtn.Enable( sal_False );
+
+ if ( bMSCryptoMode )
+ {
+ aEDPasswordCrt.SetMaxTextLen( 15 );
+ aEDPasswordRepeat.SetMaxTextLen( 15 );
+ }
+
+ long nLabelWidth = aFTWarning.GetSizePixel().Width();
+ long nLabelHeight = aFTWarning.GetSizePixel().Height();
+ long nTextWidth = aFTWarning.GetCtrlTextWidth( aFTWarning.GetText() );
+ long nTextHeight = aFTWarning.GetTextHeight();
+
+ Rectangle aLabelRect( aFTWarning.GetPosPixel(), aFTWarning.GetSizePixel() );
+ Rectangle aRect = aFTWarning.GetTextRect( aLabelRect, aFTWarning.GetText() );
+
+ long nNewLabelHeight = 0;
+ for( nNewLabelHeight = ( nTextWidth / nLabelWidth + 1 ) * nTextHeight;
+ nNewLabelHeight < aRect.GetHeight();
+ nNewLabelHeight += nTextHeight ) {} ;
+
+ long nDelta = nNewLabelHeight - nLabelHeight;
+
+ Size aNewDlgSize = GetSizePixel();
+ aNewDlgSize.Height() += nDelta;
+ SetSizePixel( aNewDlgSize );
+
+ Size aNewWarningSize = aFTWarning.GetSizePixel();
+ aNewWarningSize.Height() = nNewLabelHeight;
+ aFTWarning.SetPosSizePixel( aFTWarning.GetPosPixel(), aNewWarningSize );
+
+ Window* pControls[] = { &aFixedLine1, &aOKBtn, &aCancelBtn, &aHelpBtn };
+ const sal_Int32 nCCount = SAL_N_ELEMENTS( pControls );
+ for ( int i = 0; i < nCCount; ++i )
+ {
+ Point aNewPos =(*pControls[i]).GetPosPixel();
+ aNewPos.Y() += nDelta;
+ pControls[i]->SetPosSizePixel( aNewPos, pControls[i]->GetSizePixel() );
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/passcrtdlg.hrc b/uui/source/passcrtdlg.hrc
new file mode 100644
index 000000000000..8e3740abf037
--- /dev/null
+++ b/uui/source/passcrtdlg.hrc
@@ -0,0 +1,43 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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 UUI_PASSCRTDLG_HRC
+#define UUI_PASSCRTDLG_HRC
+
+// local identifiers
+#define BTN_PASSCRT_CANCEL 1
+#define ED_PASSWORD_CRT 2
+#define FT_PASSWORD_REPEAT 3
+#define FT_PASSWORD_WARNING 4
+#define ED_PASSWORD_REPEAT 5
+#define FL_FIXED_LINE_1 6
+#define BTN_PASSCRT_OK 7
+#define BTN_PASSCRT_HELP 8
+#define FT_PASSWORD_CRT 9
+#define FT_MSPASSWORD_WARNING 10
+
+#endif // UUI_PASSCRTDLG_HRC
diff --git a/uui/source/passcrtdlg.hxx b/uui/source/passcrtdlg.hxx
new file mode 100644
index 000000000000..4d95af006cf6
--- /dev/null
+++ b/uui/source/passcrtdlg.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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 UUI_PASSCRTDLG_HXX
+#define UUI_PASSCRTDLG_HXX
+
+#include <com/sun/star/task/PasswordRequestMode.hpp>
+#include <svtools/stdctrl.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+
+//============================================================================
+class PasswordCreateDialog : public ModalDialog
+{
+ FixedText aFTPasswordCrt;
+ Edit aEDPasswordCrt;
+ FixedText aFTPasswordRepeat;
+ Edit aEDPasswordRepeat;
+ FixedText aFTWarning;
+ FixedLine aFixedLine1;
+ OKButton aOKBtn;
+ CancelButton aCancelBtn;
+ HelpButton aHelpBtn;
+
+ ResMgr* pResourceMgr;
+ sal_uInt16 nMinLen;
+
+ DECL_LINK( OKHdl_Impl, OKButton * );
+ DECL_LINK( EditHdl_Impl, Edit * );
+
+public:
+ PasswordCreateDialog( Window* pParent, ResMgr * pResMgr, bool bMSCryptoMode = false );
+
+ String GetPassword() const { return aEDPasswordCrt.GetText(); }
+};
+
+#endif // UUI_PASSCRTDLG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/passcrtdlg.src b/uui/source/passcrtdlg.src
new file mode 100644
index 000000000000..b4ba3f212523
--- /dev/null
+++ b/uui/source/passcrtdlg.src
@@ -0,0 +1,108 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#define __RSC
+
+#ifndef UUI_IDS_HRC
+#include <ids.hrc>
+#endif
+#ifndef UUI_PASSCRTDLG_HRC
+#include "passcrtdlg.hrc"
+#endif
+
+ModalDialog DLG_UUI_PASSWORD_CRT
+{
+ HelpId = HID_DLG_PASSWORD_CRT ;
+ Border = TRUE ;
+ Moveable = TRUE ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT( 145, 129 );
+ FixedText FT_PASSWORD_CRT
+ {
+ Pos = MAP_APPFONT( 3, 4 );
+ Size = MAP_APPFONT( 139, 9 );
+ Text [ en-US ] = "Enter password";
+ };
+ Edit ED_PASSWORD_CRT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT( 3, 17 );
+ Size = MAP_APPFONT( 139, 13 );
+ PassWord = TRUE ;
+ };
+ Edit ED_PASSWORD_REPEAT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT( 3, 47 );
+ Size = MAP_APPFONT( 139, 13 );
+ PassWord = TRUE ;
+ };
+ OKButton BTN_PASSCRT_OK
+ {
+ Pos = MAP_APPFONT( 27, 110 );
+ Size = MAP_APPFONT( 37, 15 );
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_PASSCRT_CANCEL
+ {
+ Pos = MAP_APPFONT( 66, 110 );
+ Size = MAP_APPFONT( 37, 15 );
+ };
+ HelpButton BTN_PASSCRT_HELP
+ {
+ Pos = MAP_APPFONT( 105, 110 );
+ Size = MAP_APPFONT( 37, 15 );
+ };
+ FixedText FT_PASSWORD_REPEAT
+ {
+ Pos = MAP_APPFONT( 3, 34 );
+ Size = MAP_APPFONT( 139, 9 );
+ Text [ en-US ] = "Reenter password";
+ };
+ FixedText FT_PASSWORD_WARNING
+ {
+ Pos = MAP_APPFONT( 4, 64 );
+ Size = MAP_APPFONT( 137, 40 );
+ Text [ en-US ] = "WARNING: If you lose or forget the password, it cannot be recovered. It is advisable to keep passwords in a safe place. Passwords are case-sensitive.";
+ WordBreak = TRUE;
+ };
+ FixedText FT_MSPASSWORD_WARNING
+ {
+ Pos = MAP_APPFONT( 4, 64 );
+ Size = MAP_APPFONT( 137, 40 );
+ Text [ en-US ] = "WARNING: If you lose or forget the password, it cannot be recovered. It is advisable to keep passwords in a safe place. Passwords are case-sensitive and at most fifteen characters long.";
+ WordBreak = TRUE;
+ };
+ FixedLine FL_FIXED_LINE_1
+ {
+ Pos = MAP_APPFONT( 0, 104 );
+ Size = MAP_APPFONT( 145, 6 );
+ };
+ Text [ en-US ] = "Enter Password";
+};
+
diff --git a/uui/source/passwordcontainer.cxx b/uui/source/passwordcontainer.cxx
new file mode 100644
index 000000000000..357071072947
--- /dev/null
+++ b/uui/source/passwordcontainer.cxx
@@ -0,0 +1,484 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "cppuhelper/factory.hxx"
+
+#include "com/sun/star/lang/XMultiServiceFactory.hpp"
+#include "com/sun/star/task/NoMasterException.hpp"
+#include "com/sun/star/task/XInteractionHandler.hpp"
+#include "com/sun/star/task/XMasterPasswordHandling.hpp"
+#include "com/sun/star/task/XPasswordContainer.hpp"
+#include "com/sun/star/task/XUrlContainer.hpp"
+#include "com/sun/star/ucb/AuthenticationRequest.hpp"
+#include "com/sun/star/ucb/URLAuthenticationRequest.hpp"
+#include "com/sun/star/ucb/XInteractionSupplyAuthentication.hpp"
+#include "com/sun/star/ucb/XInteractionSupplyAuthentication2.hpp"
+
+#include "passwordcontainer.hxx"
+
+using namespace com::sun::star;
+
+namespace {
+
+//=========================================================================
+bool fillContinuation(
+ bool bUseSystemCredentials,
+ const ucb::AuthenticationRequest & rRequest,
+ const task::UrlRecord & aRec,
+ const uno::Reference< ucb::XInteractionSupplyAuthentication > &
+ xSupplyAuthentication,
+ const uno::Reference< ucb::XInteractionSupplyAuthentication2 > &
+ xSupplyAuthentication2,
+ bool bCanUseSystemCredentials,
+ bool bCheckForEqualPasswords )
+{
+ if ( bUseSystemCredentials )
+ {
+ // "use system creds" record found.
+ // Wants client that we use it?
+ if ( xSupplyAuthentication2.is() && bCanUseSystemCredentials )
+ {
+ xSupplyAuthentication2->setUseSystemCredentials( sal_True );
+ return true;
+ }
+ return false;
+ }
+ else if (aRec.UserList.getLength() != 0)
+ {
+ if (aRec.UserList[0].Passwords.getLength() == 0)
+ {
+ // Password sequence can be empty, for instance if master
+ // password was not given (e.g. master pw dialog canceled)
+ // pw container does not throw NoMasterException in this case.
+ // bug???
+ return false;
+ }
+
+ // "user/pass" record found.
+ if (!bCheckForEqualPasswords || !rRequest.HasPassword
+ || rRequest.Password != aRec.UserList[0].Passwords[0]) // failed login attempt?
+ {
+ if (xSupplyAuthentication->canSetUserName())
+ xSupplyAuthentication->
+ setUserName(aRec.UserList[0].UserName.getStr());
+
+ if (xSupplyAuthentication->canSetPassword())
+ xSupplyAuthentication->
+ setPassword(aRec.UserList[0].Passwords[0].getStr());
+ if (aRec.UserList[0].Passwords.getLength() > 1)
+ {
+ if (rRequest.HasRealm)
+ {
+ if (xSupplyAuthentication->canSetRealm())
+ xSupplyAuthentication->
+ setRealm(aRec.UserList[0].Passwords[1].
+ getStr());
+ }
+ else if (xSupplyAuthentication->canSetAccount())
+ xSupplyAuthentication->
+ setAccount(aRec.UserList[0].Passwords[1].
+ getStr());
+ }
+
+ if ( xSupplyAuthentication2.is() && bCanUseSystemCredentials )
+ xSupplyAuthentication2->setUseSystemCredentials( sal_False );
+
+ return true;
+ }
+ }
+ return false;
+}
+
+} // namespace
+
+namespace uui {
+
+//=========================================================================
+PasswordContainerHelper::PasswordContainerHelper(
+ uno::Reference< lang::XMultiServiceFactory > const & xServiceFactory )
+{
+ OSL_ENSURE(xServiceFactory.is(), "no service factory given!");
+ if (xServiceFactory.is())
+ try
+ {
+ m_xPasswordContainer
+ = uno::Reference< task::XPasswordContainer >(
+ xServiceFactory->
+ createInstance(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.task.PasswordContainer"))),
+ uno::UNO_QUERY);
+ }
+ catch (uno::Exception const &)
+ {}
+ OSL_ENSURE(m_xPasswordContainer.is(),
+ "unable to instanciate password container service");
+}
+
+//=========================================================================
+bool PasswordContainerHelper::handleAuthenticationRequest(
+ ucb::AuthenticationRequest const & rRequest,
+ uno::Reference< ucb::XInteractionSupplyAuthentication > const &
+ xSupplyAuthentication,
+ rtl::OUString const & rURL,
+ uno::Reference< task::XInteractionHandler > const & xIH )
+ SAL_THROW((uno::RuntimeException))
+{
+ // Is continuation even a XInteractionSupplyAuthentication2, which
+ // is derived from XInteractionSupplyAuthentication?
+ uno::Reference< ucb::XInteractionSupplyAuthentication2 >
+ xSupplyAuthentication2(xSupplyAuthentication, uno::UNO_QUERY);
+
+ sal_Bool bCanUseSystemCredentials = sal_False;
+ if (xSupplyAuthentication2.is())
+ {
+ sal_Bool bDefaultUseSystemCredentials;
+ bCanUseSystemCredentials
+ = xSupplyAuthentication2->canUseSystemCredentials(
+ bDefaultUseSystemCredentials );
+ }
+
+ uno::Reference< task::XPasswordContainer > xContainer(
+ m_xPasswordContainer );
+ uno::Reference< task::XUrlContainer > xUrlContainer(
+ m_xPasswordContainer, uno::UNO_QUERY );
+ OSL_ENSURE( xUrlContainer.is(), "Got no XUrlContainer!" );
+
+ if ( !xContainer.is() || !xUrlContainer.is() )
+ return false;
+
+ if ( bCanUseSystemCredentials )
+ {
+ // Runtime / Persistent info avail for current auth request?
+
+ rtl::OUString aResult = xUrlContainer->findUrl(
+ rURL.getLength() ? rURL : rRequest.ServerName );
+ if ( aResult.getLength() > 0 )
+ {
+ if ( fillContinuation( true,
+ rRequest,
+ task::UrlRecord(),
+ xSupplyAuthentication,
+ xSupplyAuthentication2,
+ bCanUseSystemCredentials,
+ false ) )
+ {
+ return true;
+ }
+ }
+ }
+
+ // xContainer works with userName passwdSequences pairs:
+ if (rRequest.HasUserName && rRequest.HasPassword)
+ {
+ try
+ {
+ if (rRequest.UserName.getLength() == 0)
+ {
+ task::UrlRecord aRec;
+ if ( rURL.getLength() )
+ aRec = xContainer->find(rURL, xIH);
+
+ if ( aRec.UserList.getLength() == 0 )
+ {
+ // compat: try server name.
+ aRec = xContainer->find(rRequest.ServerName, xIH);
+ }
+
+ if ( fillContinuation( false,
+ rRequest,
+ aRec,
+ xSupplyAuthentication,
+ xSupplyAuthentication2,
+ bCanUseSystemCredentials,
+ false ) )
+ {
+ return true;
+ }
+ }
+ else
+ {
+ task::UrlRecord aRec;
+ if ( rURL.getLength() )
+ aRec = xContainer->findForName(
+ rURL, rRequest.UserName, xIH);
+
+ if ( aRec.UserList.getLength() == 0 )
+ {
+ // compat: try server name.
+ aRec = xContainer->findForName(
+ rRequest.ServerName, rRequest.UserName, xIH);
+ }
+
+ if ( fillContinuation( false,
+ rRequest,
+ aRec,
+ xSupplyAuthentication,
+ xSupplyAuthentication2,
+ bCanUseSystemCredentials,
+ true ) )
+ {
+ return true;
+ }
+ }
+ }
+ catch (task::NoMasterException const &)
+ {} // user did not enter master password
+ }
+ return false;
+}
+
+//=========================================================================
+bool PasswordContainerHelper::addRecord(
+ rtl::OUString const & rURL,
+ rtl::OUString const & rUsername,
+ uno::Sequence< rtl::OUString > const & rPasswords,
+ uno::Reference< task::XInteractionHandler > const & xIH,
+ bool bPersist )
+ SAL_THROW((uno::RuntimeException))
+{
+ try
+ {
+ if ( rUsername.getLength() )
+ {
+ OSL_ENSURE( m_xPasswordContainer.is(),
+ "Got no XPasswordContainer!" );
+ if ( !m_xPasswordContainer.is() )
+ return false;
+
+ if ( bPersist )
+ {
+ uno::Reference< task::XMasterPasswordHandling > xMPH(
+ m_xPasswordContainer, uno::UNO_QUERY_THROW );
+
+ // If persistent storing of passwords is not yet
+ // allowed, enable it.
+ if ( !xMPH->isPersistentStoringAllowed() )
+ xMPH->allowPersistentStoring( sal_True );
+
+ m_xPasswordContainer->addPersistent( rURL,
+ rUsername,
+ rPasswords,
+ xIH );
+ }
+ else
+ m_xPasswordContainer->add( rURL,
+ rUsername,
+ rPasswords,
+ xIH );
+ }
+ else
+ {
+ uno::Reference< task::XUrlContainer >
+ xContainer( m_xPasswordContainer, uno::UNO_QUERY );
+ OSL_ENSURE( xContainer.is(), "Got no XUrlContainer!" );
+ if ( !xContainer.is() )
+ return false;
+
+ xContainer->addUrl( rURL, bPersist );
+ }
+ }
+ catch ( task::NoMasterException const & )
+ {
+ // user did not enter master password
+ return false;
+ }
+ return true;
+}
+
+//=========================================================================
+//=========================================================================
+//=========================================================================
+
+PasswordContainerInteractionHandler::PasswordContainerInteractionHandler(
+ const uno::Reference< lang::XMultiServiceFactory >& xSMgr )
+: m_aPwContainerHelper( xSMgr )
+{
+}
+
+//=========================================================================
+// virtual
+PasswordContainerInteractionHandler::~PasswordContainerInteractionHandler()
+{
+}
+
+//=========================================================================
+//
+// XServiceInfo methods.
+//
+//=========================================================================
+
+// virtual
+::rtl::OUString SAL_CALL
+PasswordContainerInteractionHandler::getImplementationName()
+ throw ( uno::RuntimeException )
+{
+ return getImplementationName_Static();
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL
+PasswordContainerInteractionHandler::supportsService(
+ const ::rtl::OUString& ServiceName )
+ throw ( uno::RuntimeException )
+{
+ uno::Sequence< rtl::OUString > aSNL = getSupportedServiceNames();
+ const rtl::OUString * pArray = aSNL.getConstArray();
+ for ( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
+ {
+ if ( pArray[ i ] == ServiceName )
+ return sal_True;
+ }
+ return sal_False;
+}
+
+//=========================================================================
+// virtual
+uno::Sequence< ::rtl::OUString > SAL_CALL
+PasswordContainerInteractionHandler::getSupportedServiceNames()
+ throw ( uno::RuntimeException )
+{
+ return getSupportedServiceNames_Static();
+}
+
+//=========================================================================
+// static
+rtl::OUString
+PasswordContainerInteractionHandler::getImplementationName_Static()
+{
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.comp.uui.PasswordContainerInteractionHandler" ) );
+}
+
+//=========================================================================
+// static
+uno::Sequence< rtl::OUString >
+PasswordContainerInteractionHandler::getSupportedServiceNames_Static()
+{
+ uno::Sequence< rtl::OUString > aSNS( 1 );
+ aSNS.getArray()[ 0 ]
+ = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.task.PasswordContainerInteractionHandler" ) );
+ return aSNS;
+}
+
+//=========================================================================
+//
+// XInteractionHandler methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL
+PasswordContainerInteractionHandler::handle(
+ const uno::Reference< task::XInteractionRequest >& rRequest )
+ throw ( uno::RuntimeException )
+{
+ if ( !rRequest.is() )
+ return;
+
+ uno::Any aAnyRequest( rRequest->getRequest() );
+
+ ucb::AuthenticationRequest aAuthenticationRequest;
+ if ( !( aAnyRequest >>= aAuthenticationRequest ) )
+ return;
+
+ rtl::OUString aURL;
+ ucb::URLAuthenticationRequest aURLAuthenticationRequest;
+ if ( aAnyRequest >>= aURLAuthenticationRequest )
+ aURL = aURLAuthenticationRequest.URL;
+
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > >
+ rContinuations = rRequest->getContinuations();
+
+ uno::Reference< ucb::XInteractionSupplyAuthentication >
+ xSupplyAuthentication;
+
+ for ( sal_Int32 i = 0; i < rContinuations.getLength(); ++i )
+ {
+ xSupplyAuthentication
+ = uno::Reference< ucb::XInteractionSupplyAuthentication >(
+ rContinuations[i], uno::UNO_QUERY );
+ if( xSupplyAuthentication.is() )
+ break;
+ }
+
+ if ( !xSupplyAuthentication.is() )
+ return;
+
+ // Try to obatin credentials from password container.
+ if ( m_aPwContainerHelper.
+ handleAuthenticationRequest( aAuthenticationRequest,
+ xSupplyAuthentication,
+ aURL,
+ // @@@ FIXME: this not able to
+ // handle master pw request!
+ // master pw request is never
+ // solvable without UI!
+ this ) )
+ {
+ // successfully handled
+ xSupplyAuthentication->select();
+ }
+}
+
+//=========================================================================
+//
+// Service factory implementation.
+//
+//=========================================================================
+
+static uno::Reference< uno::XInterface > SAL_CALL
+PasswordContainerInteractionHandler_CreateInstance(
+ const uno::Reference< lang::XMultiServiceFactory> & rSMgr )
+ throw( uno::Exception )
+{
+ lang::XServiceInfo * pX = static_cast< lang::XServiceInfo * >(
+ new PasswordContainerInteractionHandler( rSMgr ) );
+ return uno::Reference< uno::XInterface >::query( pX );
+}
+
+//=========================================================================
+// static
+uno::Reference< lang::XSingleServiceFactory >
+PasswordContainerInteractionHandler::createServiceFactory(
+ const uno::Reference< lang::XMultiServiceFactory >& rxServiceMgr )
+{
+ return uno::Reference< lang::XSingleServiceFactory >(
+ cppu::createOneInstanceFactory(
+ rxServiceMgr,
+ PasswordContainerInteractionHandler::getImplementationName_Static(),
+ PasswordContainerInteractionHandler_CreateInstance,
+ PasswordContainerInteractionHandler::getSupportedServiceNames_Static() ) );
+}
+
+} // namespace uui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/passwordcontainer.hxx b/uui/source/passwordcontainer.hxx
new file mode 100644
index 000000000000..cd29fb308ac6
--- /dev/null
+++ b/uui/source/passwordcontainer.hxx
@@ -0,0 +1,200 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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 INCLUDED_UUI_PASSWORDCONTAINER_HXX
+#define INCLUDED_UUI_PASSWORDCONTAINER_HXX
+
+#include "cppuhelper/implbase2.hxx"
+
+#include "com/sun/star/lang/XServiceInfo.hpp"
+#include "com/sun/star/lang/XSingleServiceFactory.hpp"
+#include "com/sun/star/task/XInteractionHandler.hpp"
+#include "com/sun/star/task/XPasswordContainer.hpp"
+
+namespace com {
+ namespace sun {
+ namespace star {
+ namespace lang {
+ class XMultiServiceFactory;
+ }
+ namespace ucb {
+ class AuthenticationRequest;
+ class XInteractionSupplyAuthentication;
+} } } }
+
+namespace uui {
+
+// ============================================================================
+
+/** Passwordcontainer UNO service (com.sun.star.task.PasswordContainer) helper.
+ */
+class PasswordContainerHelper
+{
+public:
+ PasswordContainerHelper(
+ com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory > const &
+ xServiceFactory );
+
+ // ------------------------------------------------------------------------
+
+ /** This member function tries to handle an authentication interaction
+ request by looking up credentials for the given URL in the password
+ container service.
+
+ In case of success the given interaction continuation
+ (XInteractionSupplyAuthentication) is filled with the credentials found
+ in the password container.
+
+ Please note the the continuation gets not "selected" by this
+ implementation. "Selecting" the continuation is up to the caller (e.g.
+ an implementation of XInteractionHandler::handle) of this function.
+
+ @param rRequest
+ The authentication request.
+
+ @param xSupplyAuthentication
+ The "supply authentication" interaction continuation.
+
+ @param rURL
+ The URL to lookup credentials for.
+
+ @param xIH
+ The interaction handler to use, for example if a master password is
+ needed to access the password container.
+
+ @return
+ True, if the authentication request was handled successfully.
+ False, otherwise.
+ */
+ bool handleAuthenticationRequest(
+ com::sun::star::ucb::AuthenticationRequest const & rRequest,
+ com::sun::star::uno::Reference<
+ com::sun::star::ucb::XInteractionSupplyAuthentication > const &
+ xSupplyAuthentication,
+ rtl::OUString const & rURL,
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionHandler > const & xIH )
+ SAL_THROW( (com::sun::star::uno::RuntimeException) );
+
+ /** This member function adds credentials for the given URL to the password
+ container.
+
+ @param rURL
+ The URL the credentials are valid for. rURL must not be empty.
+
+ @param rUsername
+ The user name.
+
+ @param rPasswords
+ This list of passwords.
+
+ @param xIH
+ The interaction handler to use, for example if a master password is
+ needed to access the password container.
+
+ @param bPersist
+ True, the record will get stored persistently; restored upon
+ password container initialization
+ False, the record will be stored until password container instance
+ gets destroyed.
+
+ @return
+ True, if the record was added successfully.
+ False, otherwise.
+
+ */
+ bool addRecord( rtl::OUString const & rURL,
+ rtl::OUString const & rUsername,
+ com::sun::star::uno::Sequence< rtl::OUString > const &
+ rPasswords,
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionHandler > const & xIH,
+ bool bPersist )
+ SAL_THROW( (com::sun::star::uno::RuntimeException) );
+
+ // ------------------------------------------------------------------------
+
+private:
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XPasswordContainer > m_xPasswordContainer;
+};
+
+// ============================================================================
+
+class PasswordContainerInteractionHandler :
+ public cppu::WeakImplHelper2< com::sun::star::lang::XServiceInfo,
+ com::sun::star::task::XInteractionHandler >
+{
+public:
+ PasswordContainerInteractionHandler(
+ const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >& rXSMgr );
+ virtual ~PasswordContainerInteractionHandler();
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw ( com::sun::star::uno::RuntimeException );
+
+ virtual sal_Bool SAL_CALL
+ supportsService( const ::rtl::OUString& ServiceName )
+ throw ( com::sun::star::uno::RuntimeException );
+
+ virtual com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames()
+ throw ( com::sun::star::uno::RuntimeException );
+
+ // XInteractionHandler
+ virtual void SAL_CALL
+ handle( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::task::XInteractionRequest >& Request )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // Non-UNO interfaces
+ static rtl::OUString
+ getImplementationName_Static();
+
+ static com::sun::star::uno::Sequence< rtl::OUString >
+ getSupportedServiceNames_Static();
+
+ static com::sun::star::uno::Reference<
+ com::sun::star::lang::XSingleServiceFactory >
+ createServiceFactory( const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory > & rxServiceMgr );
+
+private:
+ //com::sun::star::uno::Reference<
+ // com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
+ PasswordContainerHelper m_aPwContainerHelper;
+};
+
+} // namespace uui
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/passworddlg.cxx b/uui/source/passworddlg.cxx
new file mode 100644
index 000000000000..4875a032d5b7
--- /dev/null
+++ b/uui/source/passworddlg.cxx
@@ -0,0 +1,117 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include <sal/macros.h>
+#include <svtools/filedlg.hxx>
+#include <vcl/msgbox.hxx>
+
+#include <ids.hrc>
+#include <passworddlg.hrc>
+#include <passworddlg.hxx>
+
+// PasswordDialog---------------------------------------------------------
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( PasswordDialog, OKHdl_Impl, OKButton *, EMPTYARG )
+{
+ EndDialog( RET_OK );
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+PasswordDialog::PasswordDialog(
+ Window* _pParent,
+ ::com::sun::star::task::PasswordRequestMode nDlgMode,
+ ResMgr * pResMgr,
+ rtl::OUString& aDocURL,
+ bool bOpenToModify )
+
+ :ModalDialog( _pParent, ResId( DLG_UUI_PASSWORD, *pResMgr ) )
+ ,aFTPassword( this, ResId( FT_PASSWORD, *pResMgr ))
+ ,aEDPassword( this, ResId( ED_PASSWORD, *pResMgr ))
+ ,aOKBtn ( this, ResId( BTN_PASSWORD_OK, *pResMgr ))
+ ,aCancelBtn ( this, ResId( BTN_PASSWORD_CANCEL, *pResMgr ))
+ ,aHelpBtn ( this, ResId( BTN_PASSWORD_HELP, *pResMgr ))
+ ,aFixedLine1( this, ResId( FL_FIXED_LINE_1, *pResMgr ))
+ ,nDialogMode( nDlgMode )
+ ,pResourceMgr ( pResMgr )
+{
+ if( nDialogMode == ::com::sun::star::task::PasswordRequestMode_PASSWORD_REENTER )
+ {
+ USHORT nErrStrId = bOpenToModify ? STR_ERROR_PASSWORD_TO_MODIFY_WRONG : STR_ERROR_PASSWORD_TO_OPEN_WRONG;
+ String aErrorMsg( ResId( nErrStrId, *pResourceMgr ));
+ ErrorBox aErrorBox( _pParent, WB_OK, aErrorMsg );
+ aErrorBox.Execute();
+ }
+
+ USHORT nStrId = bOpenToModify ? STR_ENTER_PASSWORD_TO_MODIFY : STR_ENTER_PASSWORD_TO_OPEN;
+ aFTPassword.SetText( String( ResId( nStrId, *pResourceMgr ) ) );
+
+ FreeResource();
+
+ aFTPassword.SetText( aFTPassword.GetText() + aDocURL );
+
+ aOKBtn.SetClickHdl( LINK( this, PasswordDialog, OKHdl_Impl ) );
+
+ long nLabelWidth = aFTPassword.GetSizePixel().Width();
+ long nLabelHeight = aFTPassword.GetSizePixel().Height();
+ long nTextWidth = aFTPassword.GetCtrlTextWidth( aFTPassword.GetText() );
+ long nTextHeight = aFTPassword.GetTextHeight();
+
+ Rectangle aLabelRect( aFTPassword.GetPosPixel(), aFTPassword.GetSizePixel() );
+ Rectangle aRect = aFTPassword.GetTextRect( aLabelRect, aFTPassword.GetText() );
+
+ long nNewLabelHeight = 0;
+ for( nNewLabelHeight = ( nTextWidth / nLabelWidth + 1 ) * nTextHeight;
+ nNewLabelHeight < aRect.GetHeight();
+ nNewLabelHeight += nTextHeight ) {} ;
+
+ long nDelta = nNewLabelHeight - nLabelHeight;
+
+ Size aNewDlgSize = GetSizePixel();
+ aNewDlgSize.Height() += nDelta;
+ SetSizePixel( aNewDlgSize );
+
+ Size aNewLabelSize = aFTPassword.GetSizePixel();
+ aNewLabelSize.Height() = nNewLabelHeight;
+ aFTPassword.SetPosSizePixel( aFTPassword.GetPosPixel(), aNewLabelSize );
+
+ Window* pControls[] = { &aEDPassword, &aFixedLine1, &aOKBtn, &aCancelBtn, &aHelpBtn };
+ const sal_Int32 nCCount = SAL_N_ELEMENTS( pControls );
+ for ( int i = 0; i < nCCount; ++i )
+ {
+ Point aNewPos =(*pControls[i]).GetPosPixel();
+ aNewPos.Y() += nDelta;
+ pControls[i]->SetPosSizePixel( aNewPos, pControls[i]->GetSizePixel() );
+ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/passworddlg.hrc b/uui/source/passworddlg.hrc
new file mode 100644
index 000000000000..edda2504c1cd
--- /dev/null
+++ b/uui/source/passworddlg.hrc
@@ -0,0 +1,40 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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 PASSWORDDLG_HRC
+#define PASSWORDDLG_HRC
+
+// local identifiers
+#define BTN_PASSWORD_OK 1
+#define ED_PASSWORD 2
+#define FT_PASSWORD 3
+#define FL_FIXED_LINE_1 4
+#define BTN_PASSWORD_HELP 5
+#define BTN_PASSWORD_CANCEL 6
+
+
+#endif // PASSWORDDLG_HRC
diff --git a/uui/source/passworddlg.hxx b/uui/source/passworddlg.hxx
new file mode 100644
index 000000000000..a0ff98c8d907
--- /dev/null
+++ b/uui/source/passworddlg.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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 PASSWORDDLG_HXX
+#define PASSWORDDLG_HXX
+
+#include <com/sun/star/task/PasswordRequestMode.hpp>
+#include <svtools/stdctrl.hxx>
+#include <vcl/button.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/group.hxx>
+#include <vcl/fixed.hxx>
+
+//============================================================================
+class PasswordDialog : public ModalDialog
+{
+ FixedText aFTPassword;
+ Edit aEDPassword;
+ OKButton aOKBtn;
+ CancelButton aCancelBtn;
+ HelpButton aHelpBtn;
+ FixedLine aFixedLine1;
+
+
+ DECL_LINK( OKHdl_Impl, OKButton * );
+
+public:
+ PasswordDialog( Window* pParent, ::com::sun::star::task::PasswordRequestMode nDlgMode, ResMgr * pResMgr, ::rtl::OUString& aDocURL, bool bOpenToModify = false );
+
+ String GetPassword() const { return aEDPassword.GetText(); }
+
+private:
+ ::com::sun::star::task::PasswordRequestMode nDialogMode;
+ ResMgr* pResourceMgr;
+};
+
+#endif // PASSWORDDLG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/passworddlg.src b/uui/source/passworddlg.src
new file mode 100755
index 000000000000..7a96c4aa5a29
--- /dev/null
+++ b/uui/source/passworddlg.src
@@ -0,0 +1,98 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#define __RSC
+
+#ifndef UUI_IDS_HRC
+#include <ids.hrc>
+#endif
+#ifndef UUI_PASSWORDDLG_HRC
+#include <passworddlg.hrc>
+#endif
+
+ModalDialog DLG_UUI_PASSWORD
+{
+ HelpId = HID_DLG_PASSWORD_UUI;
+ Border = TRUE ;
+ Moveable = TRUE ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT( 145, 91 );
+ Text [ en-US ] = "Enter password";
+
+ FixedText FT_PASSWORD
+ {
+ Pos = MAP_APPFONT( 3, 4 );
+ Size = MAP_APPFONT( 139, 28 );
+ WordBreak = TRUE;
+ };
+
+ Edit ED_PASSWORD
+ {
+ Pos = MAP_APPFONT( 3, 51 );
+ Size = MAP_APPFONT( 139, 13 );
+ Border = TRUE ;
+ PassWord = TRUE ;
+ };
+
+ FixedLine FL_FIXED_LINE_1
+ {
+ Pos = MAP_APPFONT( 0, 66 );
+ Size = MAP_APPFONT( 145, 6 );
+ };
+
+ OKButton BTN_PASSWORD_OK
+ {
+ Pos = MAP_APPFONT( 27, 72 );
+ Size = MAP_APPFONT( 37, 15 );
+ DefButton = TRUE ;
+ DefButton = TRUE;
+ };
+
+ CancelButton BTN_PASSWORD_CANCEL
+ {
+ Pos = MAP_APPFONT( 66, 72 );
+ Size = MAP_APPFONT( 37, 15 );
+ };
+
+ HelpButton BTN_PASSWORD_HELP
+ {
+ Pos = MAP_APPFONT( 105, 72 );
+ Size = MAP_APPFONT( 37, 15 );
+ };
+
+ String STR_ENTER_PASSWORD_TO_OPEN
+ {
+ Text [ en-US ] = "Enter password to open file: \n";
+ };
+
+ String STR_ENTER_PASSWORD_TO_MODIFY
+ {
+ Text [ en-US ] = "Enter password to modify file: \n";
+ };
+};
+
diff --git a/uui/source/passworderrs.src b/uui/source/passworderrs.src
new file mode 100755
index 000000000000..6476e2831981
--- /dev/null
+++ b/uui/source/passworderrs.src
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#define __RSC
+
+#ifndef UUI_IDS_HRC
+#include <ids.hrc>
+#endif
+
+String STR_ERROR_PASSWORD_TO_OPEN_WRONG
+{
+ Text [ en-US ] = "The password is incorrect. The file cannot be opened.";
+};
+
+String STR_ERROR_PASSWORD_TO_MODIFY_WRONG
+{
+ Text [ en-US ] = "The password is incorrect. The file cannot be modified.";
+};
+
+String STR_ERROR_MASTERPASSWORD_WRONG
+{
+ Text [ en-US ] = "The wrong Master Password has been entered. %PRODUCTNAME could not access web login information protected by Master Password.\n\nNote: Passwords are case-sensitive and at least five characters long.";
+};
+
+String STR_ERROR_PASSWORDS_NOT_IDENTICAL
+{
+ Text [ en-US ] = "The password confirmation does not match.";
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/uui/source/requeststringresolver.cxx b/uui/source/requeststringresolver.cxx
new file mode 100644
index 000000000000..3fd7bebf2cee
--- /dev/null
+++ b/uui/source/requeststringresolver.cxx
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "requeststringresolver.hxx"
+#include "iahndl.hxx"
+
+using namespace com::sun;
+
+UUIInteractionRequestStringResolver::UUIInteractionRequestStringResolver(
+ star::uno::Reference< star::lang::XMultiServiceFactory > const &
+ rServiceFactory)
+ SAL_THROW(())
+ : m_xServiceFactory(rServiceFactory),
+ m_pImpl(new UUIInteractionHelper(rServiceFactory))
+{
+}
+
+UUIInteractionRequestStringResolver::~UUIInteractionRequestStringResolver()
+{
+ delete m_pImpl;
+}
+
+rtl::OUString SAL_CALL
+UUIInteractionRequestStringResolver::getImplementationName()
+ throw (star::uno::RuntimeException)
+{
+ return rtl::OUString::createFromAscii(m_aImplementationName);
+}
+
+sal_Bool SAL_CALL
+UUIInteractionRequestStringResolver::supportsService(
+ rtl::OUString const & rServiceName)
+ throw (star::uno::RuntimeException)
+{
+ star::uno::Sequence< rtl::OUString >
+ aNames(getSupportedServiceNames_static());
+ for (sal_Int32 i = 0; i < aNames.getLength(); ++i)
+ if (aNames[i] == rServiceName)
+ return true;
+ return false;
+}
+
+star::uno::Sequence< rtl::OUString > SAL_CALL
+UUIInteractionRequestStringResolver::getSupportedServiceNames()
+ throw (star::uno::RuntimeException)
+{
+ return getSupportedServiceNames_static();
+}
+
+star::beans::Optional< rtl::OUString > SAL_CALL
+UUIInteractionRequestStringResolver::getStringFromInformationalRequest(
+ const star::uno::Reference<
+ star::task::XInteractionRequest >& Request )
+ throw (star::uno::RuntimeException)
+{
+ try
+ {
+ return m_pImpl->getStringFromRequest(Request);
+ }
+ catch (star::uno::RuntimeException const & ex)
+ {
+ throw star::uno::RuntimeException(ex.Message, *this);
+ }
+}
+
+char const UUIInteractionRequestStringResolver::m_aImplementationName[]
+ = "com.sun.star.comp.uui.UUIInteractionRequestStringResolver";
+
+star::uno::Sequence< rtl::OUString >
+UUIInteractionRequestStringResolver::getSupportedServiceNames_static()
+{
+ star::uno::Sequence< rtl::OUString > aNames(1);
+ aNames[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.task.InteractionRequestStringResolver"));
+ return aNames;
+}
+
+star::uno::Reference< star::uno::XInterface > SAL_CALL
+UUIInteractionRequestStringResolver::createInstance(
+ star::uno::Reference< star::lang::XMultiServiceFactory > const &
+ rServiceFactory)
+ SAL_THROW((star::uno::Exception))
+{
+ try
+ {
+ return *new UUIInteractionRequestStringResolver(rServiceFactory);
+ }
+ catch (std::bad_alloc const &)
+ {
+ throw star::uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
+ 0);
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/requeststringresolver.hxx b/uui/source/requeststringresolver.hxx
new file mode 100644
index 000000000000..6346c7851ed2
--- /dev/null
+++ b/uui/source/requeststringresolver.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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 UUI_REQUESTSTRINGRESOLVER_HXX
+#define UUI_REQUESTSTRINGRESOLVER_HXX
+
+#include "com/sun/star/lang/XServiceInfo.hpp"
+#include "com/sun/star/task/XInteractionRequestStringResolver.hpp"
+#include "cppuhelper/implbase2.hxx"
+
+class UUIInteractionHelper;
+
+class UUIInteractionRequestStringResolver:
+ public cppu::WeakImplHelper2<
+ com::sun::star::lang::XServiceInfo,
+ com::sun::star::task::XInteractionRequestStringResolver >
+{
+public:
+ static char const m_aImplementationName[];
+
+ static com::sun::star::uno::Sequence< rtl::OUString >
+ getSupportedServiceNames_static();
+
+ static com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
+ SAL_CALL
+ createInstance(
+ com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory > const &
+ rServiceFactory)
+ SAL_THROW((com::sun::star::uno::Exception));
+
+private:
+ com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory > m_xServiceFactory;
+ UUIInteractionHelper * m_pImpl;
+
+ UUIInteractionRequestStringResolver(UUIInteractionRequestStringResolver &); // not implemented
+ void operator =(UUIInteractionRequestStringResolver); // not implemented
+
+ UUIInteractionRequestStringResolver(
+ com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >
+ const & rServiceFactory)
+ SAL_THROW(());
+
+ virtual ~UUIInteractionRequestStringResolver() SAL_THROW(());
+
+ virtual rtl::OUString SAL_CALL getImplementationName()
+ throw (com::sun::star::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL supportsService(rtl::OUString const &
+ rServiceName)
+ throw (com::sun::star::uno::RuntimeException);
+
+ virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL
+ getSupportedServiceNames()
+ throw (com::sun::star::uno::RuntimeException);
+
+ virtual com::sun::star::beans::Optional< rtl::OUString > SAL_CALL
+ getStringFromInformationalRequest(
+ const com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionRequest >& Request )
+ throw (com::sun::star::uno::RuntimeException);
+};
+
+#endif // UUI_REQUESTSTRINGRESOLVER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/secmacrowarnings.cxx b/uui/source/secmacrowarnings.cxx
new file mode 100644
index 000000000000..f17bbf4130f1
--- /dev/null
+++ b/uui/source/secmacrowarnings.cxx
@@ -0,0 +1,381 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
+#include <comphelper/sequence.hxx>
+#include "comphelper/documentconstants.hxx"
+#include <comphelper/processfactory.hxx>
+#include <sal/macros.h>
+
+#include <vcl/msgbox.hxx>
+#include <com/sun/star/security/NoPasswordException.hpp>
+
+using namespace ::com::sun::star::security;
+
+#include "ids.hrc"
+#include "secmacrowarnings.hxx"
+#include "secmacrowarnings.hrc"
+
+#ifdef _MSC_VER
+#pragma warning (disable : 4355) // 4355: this used in initializer-list
+#endif
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star;
+
+
+// HACK!!! copied from xmlsecurity/source/dialog/resourcemanager.cxx
+
+namespace
+{
+ String GetContentPart( const String& _rRawString, const String& _rPartId )
+ {
+ String s;
+
+ xub_StrLen nContStart = _rRawString.Search( _rPartId );
+ if( nContStart != STRING_NOTFOUND )
+ {
+ nContStart = nContStart + _rPartId.Len();
+ ++nContStart; // now it's start of content, directly after Id
+
+ xub_StrLen nContEnd = _rRawString.Search( sal_Unicode( ',' ), nContStart );
+
+ s = String( _rRawString, nContStart, nContEnd - nContStart );
+ }
+
+ return s;
+ }
+}
+
+
+MacroWarning::MacroWarning( Window* _pParent, bool _bWithSignatures, ResMgr& rResMgr )
+ :ModalDialog ( _pParent, ResId( RID_XMLSECDLG_MACROWARN, rResMgr ) )
+ ,mpInfos ( NULL )
+ ,maSymbolImg ( this, ResId( IMG_SYMBOL, rResMgr ) )
+ ,maDocNameFI ( this, ResId( FI_DOCNAME, rResMgr ) )
+ ,maDescr1aFI ( this, ResId( FI_DESCR1A, rResMgr ) )
+ ,maDescr1bFI ( this, ResId( FI_DESCR1B, rResMgr ) )
+ ,maSignsFI ( this, ResId( FI_SIGNS, rResMgr ) )
+ ,maViewSignsBtn ( this, ResId( PB_VIEWSIGNS, rResMgr ) )
+ ,maDescr2FI ( this, ResId( FI_DESCR2, rResMgr ) )
+ ,maAlwaysTrustCB ( this, ResId( CB_ALWAYSTRUST, rResMgr ) )
+ ,maBottomSepFL ( this, ResId( FL_BOTTOM_SEP, rResMgr ) )
+ ,maEnableBtn ( this, ResId( PB_ENABLE, rResMgr ) )
+ ,maDisableBtn ( this, ResId( PB_DISABLE, rResMgr ) )
+ ,maHelpBtn ( this, ResId( BTN_HELP, rResMgr ) )
+ ,mbSignedMode ( true )
+ ,mbShowSignatures ( _bWithSignatures )
+ ,mnActSecLevel ( 0 )
+{
+ FreeResource();
+
+ InitControls();
+
+ maDisableBtn.SetClickHdl( LINK( this, MacroWarning, DisableBtnHdl ) );
+ maEnableBtn.SetClickHdl( LINK( this, MacroWarning, EnableBtnHdl ) );
+ maDisableBtn.GrabFocus(); // Default button, but focus is on view button
+}
+
+MacroWarning::~MacroWarning()
+{
+}
+
+short MacroWarning::Execute()
+{
+ FitControls();
+ return ModalDialog::Execute();
+}
+
+void MacroWarning::SetDocumentURL( const String& rDocURL )
+{
+ maDocNameFI.SetText( rDocURL );
+}
+
+IMPL_LINK( MacroWarning, ViewSignsBtnHdl, void*, EMPTYARG )
+{
+ DBG_ASSERT( mxCert.is(), "*MacroWarning::ViewSignsBtnHdl(): no certificate set!" );
+
+ uno::Sequence< uno::Any > aArgs( 1 );
+ aArgs[0] = uno::makeAny( maODFVersion );
+ uno::Reference< security::XDocumentDigitalSignatures > xD(
+ comphelper::getProcessServiceFactory()->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.security.DocumentDigitalSignatures" ) ), aArgs ), uno::UNO_QUERY );
+ if( xD.is() )
+ {
+ if( mxCert.is() )
+ xD->showCertificate( mxCert );
+ else if( mxStore.is() )
+ xD->showScriptingContentSignatures( mxStore, uno::Reference< io::XInputStream >() );
+ }
+
+ return 0;
+}
+
+IMPL_LINK( MacroWarning, EnableBtnHdl, void*, EMPTYARG )
+{
+ if( mbSignedMode && maAlwaysTrustCB.IsChecked() )
+ { // insert path into trusted path list
+ uno::Sequence< uno::Any > aArgs( 1 );
+ aArgs[0] = uno::makeAny( maODFVersion );
+ uno::Reference< security::XDocumentDigitalSignatures > xD(
+ comphelper::getProcessServiceFactory()->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.security.DocumentDigitalSignatures" ) ), aArgs ), uno::UNO_QUERY );
+ if( xD.is() )
+ {
+ if( mxCert.is() )
+ xD->addAuthorToTrustedSources( mxCert );
+ else if( mxStore.is() )
+ {
+ DBG_ASSERT( mpInfos, "-MacroWarning::EnableBtnHdl(): no infos, search in nirvana..." );
+
+ sal_Int32 nCnt = mpInfos->getLength();
+ for( sal_Int32 i = 0 ; i < nCnt ; ++i )
+ xD->addAuthorToTrustedSources( (*mpInfos)[ i ].Signer );
+ }
+ }
+ }
+
+ EndDialog( RET_OK );
+ return 0;
+}
+
+IMPL_LINK( MacroWarning, DisableBtnHdl, void*, EMPTYARG )
+{
+ EndDialog( RET_CANCEL );
+ return 0;
+}
+
+IMPL_LINK( MacroWarning, AlwaysTrustCheckHdl, void*, EMPTYARG )
+{
+ bool bEnable = ( mnActSecLevel < 2 || maAlwaysTrustCB.IsChecked() );
+ maEnableBtn.Enable( bEnable );
+ maDisableBtn.Enable( !maAlwaysTrustCB.IsChecked() );
+
+ return 0;
+}
+
+void MacroWarning::InitControls()
+{
+ // set warning image
+ Image aImg( WarningBox::GetStandardImage() );
+ maSymbolImg.SetImage( aImg );
+ maSymbolImg.SetSizePixel( aImg.GetSizePixel() );
+ // set bold font and path ellipsis for docname fixedtext
+ Font aTmpFont = maDocNameFI.GetControlFont();
+ aTmpFont.SetWeight( WEIGHT_BOLD );
+ maDocNameFI.SetControlFont( aTmpFont );
+ WinBits nStyle = maDocNameFI.GetStyle();
+ nStyle |= WB_PATHELLIPSIS;
+ maDocNameFI.SetStyle( nStyle );
+ // show signature controls?
+ if( mbShowSignatures )
+ {
+ maDescr1bFI.Hide();
+ maViewSignsBtn.SetClickHdl( LINK( this, MacroWarning, ViewSignsBtnHdl ) );
+ maViewSignsBtn.Disable(); // default
+ maAlwaysTrustCB.SetClickHdl( LINK( this, MacroWarning, AlwaysTrustCheckHdl ) );
+
+ mnActSecLevel = SvtSecurityOptions().GetMacroSecurityLevel();
+ if ( mnActSecLevel >= 2 )
+ maEnableBtn.Disable();
+ }
+ else
+ {
+ maDescr1aFI.Hide();
+ maSignsFI.Hide();
+ maViewSignsBtn.Hide();
+ maAlwaysTrustCB.Hide();
+
+ // move hint up to position of signer list
+ maDescr2FI.SetPosPixel( maSignsFI.GetPosPixel() );
+ }
+ // without signature controls could be smaller
+ if ( !mbShowSignatures )
+ {
+ Point aPos = maDescr2FI.GetPosPixel();
+ aPos.Y() += maDescr2FI.GetSizePixel().Height();
+ aPos.Y() += LogicToPixel( Size( 3, 3 ) ).Height();
+ long nDelta = maBottomSepFL.GetPosPixel().Y() - aPos.Y();
+ Window* pWins[] =
+ {
+ &maBottomSepFL, &maEnableBtn, &maDisableBtn, &maHelpBtn
+ };
+ Window** pCurrent = pWins;
+ for ( sal_uInt32 i = 0; i < SAL_N_ELEMENTS( pWins ); ++i, ++pCurrent )
+ {
+ Point aNewPos = (*pCurrent)->GetPosPixel();
+ aNewPos.Y() -= nDelta;
+ (*pCurrent)->SetPosPixel( aNewPos );
+ }
+
+ Size aDlgSz = GetSizePixel();
+ aDlgSz.Height() -= nDelta;
+ SetSizePixel( aDlgSz );
+ }
+
+ // check if some buttontexts are to wide
+ String sText = maViewSignsBtn.GetText();
+ long nTxtW = maViewSignsBtn.GetTextWidth( sText );
+ const long nOffset = 12;
+ if ( sText.Search( '~' ) == STRING_NOTFOUND )
+ nTxtW += nOffset;
+ long nBtnW = maViewSignsBtn.GetSizePixel().Width();
+ if ( nTxtW >= nBtnW )
+ {
+ // broaden the button
+ long nDelta = Max( nTxtW - nBtnW, nOffset/3 );
+ Size aNewSize = maViewSignsBtn.GetSizePixel();
+ aNewSize.Width() += nDelta;
+ maViewSignsBtn.SetSizePixel( aNewSize );
+ // and give it a new position
+ Point aNewPos = maViewSignsBtn.GetPosPixel();
+ aNewPos.X() -= nDelta;
+ maViewSignsBtn.SetPosPixel( aNewPos );
+ // the the left fixedtext must be smaller
+ aNewSize = maSignsFI.GetSizePixel();
+ aNewSize.Width() -= nDelta;
+ maSignsFI.SetSizePixel( aNewSize );
+ }
+ // if the button text (we compare with the longest of both) is too wide, then broaden the buttons
+ String sText1 = maEnableBtn.GetText();
+ long nTxtW1 = maEnableBtn.GetTextWidth( sText1 );
+ if ( sText1.Search( '~' ) == STRING_NOTFOUND )
+ nTxtW1 += nOffset;
+ String sText2 = maDisableBtn.GetText();
+ long nTxtW2 = maDisableBtn.GetTextWidth( sText2 );
+ if ( sText2.Search( '~' ) == STRING_NOTFOUND )
+ nTxtW2 += nOffset;
+ nTxtW = Max( nTxtW1, nTxtW2 );
+ nBtnW = maEnableBtn.GetSizePixel().Width();
+ if ( nTxtW > nBtnW )
+ {
+ // broaden both buttons
+ long nDelta = nTxtW - nBtnW;
+ Size aNewSize = maEnableBtn.GetSizePixel();
+ aNewSize.Width() += nDelta;
+ maEnableBtn.SetSizePixel( aNewSize );
+ maDisableBtn.SetSizePixel( aNewSize );
+ // and give them a new position
+ Point aNewPos = maEnableBtn.GetPosPixel();
+ aNewPos.X() -= (2*nDelta);
+ maEnableBtn.SetPosPixel( aNewPos );
+ aNewPos = maDisableBtn.GetPosPixel();
+ aNewPos.X() -= nDelta;
+ maDisableBtn.SetPosPixel( aNewPos );
+ }
+}
+
+void MacroWarning::FitControls()
+{
+ Size a3Size = LogicToPixel( Size( 3, 3 ), MAP_APPFONT );
+ Size aNewSize, aMinSize;
+ long nTxtH = 0;
+ long nCtrlH = 0;
+ long nDelta = 0;
+
+ if ( mbShowSignatures )
+ {
+ aMinSize = maSignsFI.CalcMinimumSize( maSignsFI.GetSizePixel().Width() );
+ nTxtH = Max( aMinSize.Height(), maViewSignsBtn.GetSizePixel().Height() );
+ nTxtH += a3Size.Height() / 2;
+ nCtrlH = maSignsFI.GetSizePixel().Height();
+ nDelta = Max( nCtrlH - nTxtH, static_cast< long >( -100 ) ); // not too large
+ aNewSize = maSignsFI.GetSizePixel();
+ aNewSize.Height() -= nDelta;
+ maSignsFI.SetSizePixel( aNewSize );
+ }
+
+ aMinSize = maDescr2FI.CalcMinimumSize( maDescr2FI.GetSizePixel().Width() );
+ nTxtH = aMinSize.Height();
+ nCtrlH = maDescr2FI.GetSizePixel().Height();
+ long nDelta2 = ( nCtrlH - nTxtH );
+ aNewSize = maDescr2FI.GetSizePixel();
+ aNewSize.Height() -= nDelta2;
+ maDescr2FI.SetSizePixel( aNewSize );
+
+ // new position for the succeeding windows
+ Window* pWins[] =
+ {
+ &maDescr2FI, &maAlwaysTrustCB, &maBottomSepFL, &maEnableBtn, &maDisableBtn, &maHelpBtn
+ };
+ Window** pCurrent = pWins;
+ for ( sal_uInt32 i = 0; i < SAL_N_ELEMENTS( pWins ); ++i, ++pCurrent )
+ {
+ Point aNewPos = (*pCurrent)->GetPosPixel();
+ aNewPos.Y() -= nDelta;
+ (*pCurrent)->SetPosPixel( aNewPos );
+
+ if ( *pCurrent == &maDescr2FI )
+ nDelta += nDelta2;
+ }
+
+ // new size of the dialog
+ aNewSize = GetSizePixel();
+ aNewSize.Height() -= nDelta;
+ SetSizePixel( aNewSize );
+}
+
+void MacroWarning::SetStorage( const cssu::Reference < css::embed::XStorage >& rxStore,
+ const ::rtl::OUString& aODFVersion,
+ const cssu::Sequence< security::DocumentSignatureInformation >& rInfos )
+{
+ mxStore = rxStore;
+ maODFVersion = aODFVersion;
+ sal_Int32 nCnt = rInfos.getLength();
+ if( mxStore.is() && nCnt > 0 )
+ {
+ mpInfos = &rInfos;
+ String aCN_Id( String::CreateFromAscii( "CN" ) );
+ String s;
+ s = GetContentPart( rInfos[ 0 ].Signer->getSubjectName(), aCN_Id );
+
+ for( sal_Int32 i = 1 ; i < nCnt ; ++i )
+ {
+ s.AppendAscii( "\n" );
+ s += GetContentPart( rInfos[ i ].Signer->getSubjectName(), aCN_Id );
+ }
+
+ maSignsFI.SetText( s );
+ maViewSignsBtn.Enable();
+ }
+}
+
+void MacroWarning::SetCertificate( const cssu::Reference< css::security::XCertificate >& _rxCert )
+{
+ mxCert = _rxCert;
+ if( mxCert.is() )
+ {
+ String aCN_Id( String::CreateFromAscii( "CN" ) );
+ String s;
+ s = GetContentPart( mxCert->getSubjectName(), aCN_Id );
+ maSignsFI.SetText( s );
+ maViewSignsBtn.Enable();
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/secmacrowarnings.hrc b/uui/source/secmacrowarnings.hrc
new file mode 100644
index 000000000000..38ea65952ef0
--- /dev/null
+++ b/uui/source/secmacrowarnings.hrc
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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 _SECMACROWARNINGS_HRC
+#define _SECMACROWARNINGS_HRC
+
+#include <svtools/controldims.hrc>
+
+// --------- general metrics ---------
+
+#define SEP_FL_SPACE_Y 6
+#define SEP_FL_ADJ_Y(val) (val-3)
+#define DLGS_BOTTOM_BTN_L(dlgh) (dlgh-RSC_SP_DLG_INNERBORDER_BOTTOM)
+#define DLGS_BOTTOM_BTN_Y(dlgh) (DLGS_BOTTOM_BTN_L(dlgh)-RSC_CD_PUSHBUTTON_HEIGHT)
+#define DLGS_BOTTOM_FL_Y(dlgh) (DLGS_BOTTOM_BTN_Y(dlgh)-SEP_FL_SPACE_Y-5)
+#define DLGS_BOTTOM_LAST_CTRL_L(dlgh) (DLGS_BOTTOM_BTN_Y(dlgh)-2*SEP_FL_SPACE_Y-3)
+#define DLGS_BOTTOM_HELP_X(dlgw) (dlgw-RSC_SP_DLG_INNERBORDER_RIGHT-RSC_CD_PUSHBUTTON_WIDTH)
+#define DLGS_BOTTOM_CANCEL_X(dlgw) (DLGS_BOTTOM_HELP_X(dlgw)-RSC_SP_CTRL_X-RSC_CD_PUSHBUTTON_WIDTH)
+#define DLGS_BOTTOM_OK_X(dlgw) (DLGS_BOTTOM_CANCEL_X(dlgw)-RSC_SP_CTRL_GROUP_X-RSC_CD_PUSHBUTTON_WIDTH)
+
+// --------- signed macro warning ---------
+
+#define FI_DOCNAME 1
+#define FI_DESCR1A 2
+#define FI_SIGNS 3
+#define PB_VIEWSIGNS 4
+#define FI_DESCR2 5
+#define CB_ALWAYSTRUST 6
+#define PB_ENABLE 7
+#define PB_DISABLE 8
+#define FI_DESCR1B 9
+#define FL_BOTTOM_SEP 10
+#define BTN_HELP 11
+#define IMG_SYMBOL 12
+
+#define MW_WIDTH 220
+#define MW_HEIGHT 190
+
+#define MW_SYMBOL_WIDTH (20)
+#define MW_SYMBOL_HEIGHT (20)
+
+#define MW_COL_0 (RSC_SP_DLG_INNERBORDER_LEFT)
+#define MW_COL_1 (MW_COL_0+MW_SYMBOL_WIDTH+RSC_SP_CTRL_DESC_X)
+
+#define MW_COL_4 (MW_WIDTH-RSC_SP_DLG_INNERBORDER_RIGHT)
+#define MW_COL_3 (MW_COL_4-RSC_CD_PUSHBUTTON_WIDTH)
+#define MW_COL_2 (MW_COL_3-RSC_SP_CTRL_DESC_X)
+
+#define MW_COL_A (DLGS_BOTTOM_OK_X(MW_WIDTH))
+#define MW_COL_C (DLGS_BOTTOM_CANCEL_X(MW_WIDTH))
+#define MW_COL_E (DLGS_BOTTOM_HELP_X(MW_WIDTH))
+
+#define MW_ROW_0 (RSC_SP_DLG_INNERBORDER_TOP)
+#define MW_ROW_1 (MW_ROW_0+3*RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define MW_ROW_2 (MW_ROW_1+RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_DESC_Y)
+
+#define MW_ROW_7 (MW_HEIGHT-RSC_SP_DLG_INNERBORDER_BOTTOM)
+#define MW_ROW_6 (MW_ROW_7-RSC_CD_PUSHBUTTON_HEIGHT)
+#define MW_ROW_5 (MW_ROW_6-RSC_SP_CTRL_DESC_Y-RSC_CD_FIXEDTEXT_HEIGHT)
+#define MW_ROW_4 (MW_ROW_5-RSC_SP_CTRL_DESC_Y-RSC_CD_CHECKBOX_HEIGHT)
+#define MW_ROW_3 (MW_ROW_4-RSC_SP_CTRL_DESC_Y-4*RSC_CD_FIXEDTEXT_HEIGHT)
+
+#endif
+
diff --git a/uui/source/secmacrowarnings.hxx b/uui/source/secmacrowarnings.hxx
new file mode 100644
index 000000000000..04bd6f65650a
--- /dev/null
+++ b/uui/source/secmacrowarnings.hxx
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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 _SECMACROWARNINGS_HXX
+#define _SECMACROWARNINGS_HXX
+
+#include <vcl/dialog.hxx>
+#include <svtools/stdctrl.hxx>
+#include <unotools/securityoptions.hxx>
+#include <vcl/button.hxx>
+
+namespace com {
+namespace sun {
+namespace star {
+namespace security {
+ class XCertificate; }
+namespace xml { namespace crypto {
+ class XSecurityEnvironment; }}
+}}}
+
+#include <com/sun/star/uno/Sequence.hxx>
+
+
+namespace css = com::sun::star;
+namespace cssu = com::sun::star::uno;
+namespace css = ::com::sun::star;
+
+class HeaderBar;
+
+class MacroWarning : public ModalDialog
+{
+private:
+
+ cssu::Reference< css::security::XCertificate > mxCert;
+ cssu::Reference< css::embed::XStorage > mxStore;
+ ::rtl::OUString maODFVersion;
+ const cssu::Sequence< css::security::DocumentSignatureInformation >* mpInfos;
+
+ FixedImage maSymbolImg;
+ FixedInfo maDocNameFI;
+ FixedInfo maDescr1aFI;
+ FixedInfo maDescr1bFI;
+ FixedInfo maSignsFI;
+ PushButton maViewSignsBtn;
+ FixedInfo maDescr2FI;
+ CheckBox maAlwaysTrustCB;
+ FixedLine maBottomSepFL;
+ OKButton maEnableBtn;
+ CancelButton maDisableBtn;
+ HelpButton maHelpBtn;
+
+ const bool mbSignedMode; // modus of dialog (signed / unsigned macros)
+ const bool mbShowSignatures;
+ sal_Int32 mnActSecLevel;
+
+ DECL_LINK( ViewSignsBtnHdl, void* );
+ DECL_LINK( EnableBtnHdl, void* );
+ DECL_LINK( DisableBtnHdl, void* );
+ DECL_LINK( AlwaysTrustCheckHdl, void* );
+
+ void InitControls();
+ void FitControls();
+
+public:
+ MacroWarning( Window* pParent, bool _bShowSignatures, ResMgr& rResMgr );
+ ~MacroWarning();
+
+ virtual short Execute();
+
+ void SetDocumentURL( const String& rDocURL );
+
+ void SetStorage( const cssu::Reference < css::embed::XStorage >& rxStore,
+ const ::rtl::OUString& aODFVersion,
+ const cssu::Sequence< css::security::DocumentSignatureInformation >& _rInfos );
+ void SetCertificate( const cssu::Reference< css::security::XCertificate >& _rxCert );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/secmacrowarnings.src b/uui/source/secmacrowarnings.src
new file mode 100644
index 000000000000..9ae4186ec89e
--- /dev/null
+++ b/uui/source/secmacrowarnings.src
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#define __RSC
+
+#include "secmacrowarnings.hrc"
+#include "ids.hrc"
+
+ModalDialog RID_XMLSECDLG_MACROWARN
+{
+ HelpId = HID_XMLSECDLG_MACROWARN;
+ Size = MAP_APPFONT( MW_WIDTH, MW_HEIGHT );
+ OutputSize = TRUE;
+ Closeable = FALSE;
+ Moveable = TRUE;
+ SVLook = TRUE;
+
+ Text [ en-US ] = "%PRODUCTNAME - Security Warning";
+
+ FixedImage IMG_SYMBOL
+ {
+ Pos = MAP_APPFONT( MW_COL_0, MW_ROW_0 );
+ Size = MAP_APPFONT( MW_SYMBOL_WIDTH, MW_SYMBOL_HEIGHT );
+ };
+ FixedText FI_DOCNAME
+ {
+ Pos = MAP_APPFONT( MW_COL_1, MW_ROW_0+RSC_CD_FIXEDTEXT_HEIGHT );
+ Size = MAP_APPFONT( MW_COL_4-MW_COL_1, 2*RSC_CD_FIXEDTEXT_HEIGHT );
+ Wordbreak = TRUE;
+ };
+ FixedText FI_DESCR1A
+ {
+ Pos = MAP_APPFONT( MW_COL_1, MW_ROW_1 );
+ Size = MAP_APPFONT( MW_COL_4-MW_COL_1, RSC_CD_FIXEDTEXT_HEIGHT );
+ Wordbreak = TRUE;
+ Text [ en-US ] = "The document contains document macros signed by:";
+ };
+ FixedText FI_DESCR1B
+ {
+ Pos = MAP_APPFONT( MW_COL_1, MW_ROW_1 );
+ Size = MAP_APPFONT( MW_COL_4-MW_COL_1, RSC_CD_FIXEDTEXT_HEIGHT );
+ Wordbreak = TRUE;
+ Text [ en-US ] = "The document contains document macros.";
+ };
+ FixedText FI_SIGNS
+ {
+ Pos = MAP_APPFONT( MW_COL_1, MW_ROW_2 );
+ Size = MAP_APPFONT( MW_COL_2-MW_COL_1, MW_ROW_3-MW_ROW_2-RSC_SP_CTRL_DESC_Y );
+ Wordbreak = TRUE;
+ };
+ PushButton PB_VIEWSIGNS
+ {
+ Pos = MAP_APPFONT( MW_COL_3, MW_ROW_2 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ Text [ en-US ] = "View Signatures...";
+ };
+ FixedText FI_DESCR2
+ {
+ Pos = MAP_APPFONT( MW_COL_1, MW_ROW_3 );
+ Size = MAP_APPFONT( MW_COL_4-MW_COL_1, 4*RSC_CD_FIXEDTEXT_HEIGHT );
+ Wordbreak = TRUE;
+ Text [ en-US ] = "Macros may contain viruses. Disabling macros for a document is always safe. If you disable macros you may lose functionality provided by the document macros.";
+ };
+ CheckBox CB_ALWAYSTRUST
+ {
+ Pos = MAP_APPFONT( MW_COL_1, MW_ROW_4 );
+ Size = MAP_APPFONT( MW_COL_4-MW_COL_1, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "Always trust macros from this source";
+ };
+ FixedLine FL_BOTTOM_SEP
+ {
+ Pos = MAP_APPFONT( 0, MW_ROW_5 );
+ Size = MAP_APPFONT( MW_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
+ };
+ OKButton PB_ENABLE
+ {
+ Pos = MAP_APPFONT( DLGS_BOTTOM_OK_X( MW_WIDTH ), MW_ROW_6 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ Text [ en-US ] = "~Enable Macros";
+ };
+ CancelButton PB_DISABLE
+ {
+ Pos = MAP_APPFONT( DLGS_BOTTOM_CANCEL_X( MW_WIDTH ), MW_ROW_6 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ DefButton = TRUE;
+ Text [ en-US ] = "~Disable Macros";
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT( DLGS_BOTTOM_HELP_X( MW_WIDTH ), MW_ROW_6 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ };
+};
+
diff --git a/uui/source/services.cxx b/uui/source/services.cxx
new file mode 100644
index 000000000000..4ab29d376466
--- /dev/null
+++ b/uui/source/services.cxx
@@ -0,0 +1,213 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#include <cppu/macros.hxx>
+#include <cppuhelper/factory.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <uno/environment.h>
+
+#include "interactionhandler.hxx"
+#include "requeststringresolver.hxx"
+#include "passwordcontainer.hxx"
+
+using namespace rtl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::registry;
+
+namespace {
+
+sal_Bool writeInfo( void * pRegistryKey,
+ const OUString & rImplementationName,
+ Sequence< OUString > const & rServiceNames )
+{
+ OUString aKeyName( OUString::createFromAscii( "/" ) );
+ aKeyName += rImplementationName;
+ aKeyName += OUString::createFromAscii( "/UNO/SERVICES" );
+
+ Reference< XRegistryKey > xKey;
+ try
+ {
+ xKey = static_cast< XRegistryKey * >(
+ pRegistryKey )->createKey( aKeyName );
+ }
+ catch ( InvalidRegistryException const & )
+ {
+ }
+
+ if ( !xKey.is() )
+ {
+ return sal_False;
+ }
+ sal_Bool bSuccess = sal_True;
+
+ for ( sal_Int32 n = 0; n < rServiceNames.getLength(); ++n )
+ {
+ try
+ {
+ xKey->createKey( rServiceNames[ n ] );
+ }
+ catch ( InvalidRegistryException const & )
+ {
+ bSuccess = sal_False;
+ break;
+ }
+ }
+ return bSuccess;
+}
+
+} // namespace
+
+//============================================================================
+//
+// component_getImplementationEnvironment
+//
+//============================================================================
+
+extern "C" void SAL_CALL
+component_getImplementationEnvironment(sal_Char const ** pEnvTypeName,
+ uno_Environment **)
+{
+ *pEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+//============================================================================
+//
+// component_writeInfo
+//
+//============================================================================
+
+extern "C" sal_Bool SAL_CALL component_writeInfo(void *, void * pRegistryKey)
+{
+ return pRegistryKey &&
+
+ //////////////////////////////////////////////////////////////////////
+ // UUI Interaction Handler.
+ //////////////////////////////////////////////////////////////////////
+
+ writeInfo( pRegistryKey,
+ OUString::createFromAscii(
+ UUIInteractionHandler::m_aImplementationName ),
+ UUIInteractionHandler::getSupportedServiceNames_static() ) &&
+
+ //////////////////////////////////////////////////////////////////////
+ // UUI Interaction Request String Resolver.
+ //////////////////////////////////////////////////////////////////////
+
+ writeInfo( pRegistryKey,
+ OUString::createFromAscii(
+ UUIInteractionRequestStringResolver::m_aImplementationName ),
+ UUIInteractionRequestStringResolver::getSupportedServiceNames_static() ) &&
+
+ //////////////////////////////////////////////////////////////////////
+ // UUI Password Container Interaction Handler.
+ //////////////////////////////////////////////////////////////////////
+
+ writeInfo( pRegistryKey,
+ uui::PasswordContainerInteractionHandler::getImplementationName_Static(),
+ uui::PasswordContainerInteractionHandler::getSupportedServiceNames_Static() );
+}
+
+//============================================================================
+//
+// component_getFactory
+//
+//============================================================================
+
+extern "C" void * SAL_CALL component_getFactory(sal_Char const * pImplName,
+ void * pServiceManager,
+ void *)
+{
+ if (!pImplName)
+ return 0;
+
+ void * pRet = 0;
+
+ Reference< XMultiServiceFactory > xSMgr(
+ reinterpret_cast< XMultiServiceFactory * >( pServiceManager ) );
+ Reference< XSingleServiceFactory > xFactory;
+
+ //////////////////////////////////////////////////////////////////////
+ // UUI Interaction Handler.
+ //////////////////////////////////////////////////////////////////////
+
+ if ( rtl_str_compare(pImplName,
+ UUIInteractionHandler::m_aImplementationName)
+ == 0)
+ {
+ xFactory =
+ cppu::createSingleFactory(
+ static_cast< XMultiServiceFactory * >(pServiceManager),
+ OUString::createFromAscii(
+ UUIInteractionHandler::m_aImplementationName),
+ &UUIInteractionHandler::createInstance,
+ UUIInteractionHandler::getSupportedServiceNames_static());
+ }
+
+ //////////////////////////////////////////////////////////////////////
+ // UUI Interaction Request String Resolver.
+ //////////////////////////////////////////////////////////////////////
+
+ else if ( rtl_str_compare(pImplName,
+ UUIInteractionRequestStringResolver::m_aImplementationName)
+ == 0)
+ {
+ xFactory =
+ cppu::createSingleFactory(
+ static_cast< XMultiServiceFactory * >(pServiceManager),
+ OUString::createFromAscii(
+ UUIInteractionRequestStringResolver::m_aImplementationName),
+ &UUIInteractionRequestStringResolver::createInstance,
+ UUIInteractionRequestStringResolver::getSupportedServiceNames_static());
+ }
+
+ //////////////////////////////////////////////////////////////////////
+ // UUI Password Container Interaction Handler.
+ //////////////////////////////////////////////////////////////////////
+
+ else if ( uui::PasswordContainerInteractionHandler::getImplementationName_Static().
+ compareToAscii( pImplName ) == 0 )
+ {
+ xFactory =
+ uui::PasswordContainerInteractionHandler::createServiceFactory( xSMgr );
+ }
+
+ //////////////////////////////////////////////////////////////////////
+
+ if ( xFactory.is() )
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+
+ return pRet;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/sslwarndlg.cxx b/uui/source/sslwarndlg.cxx
new file mode 100644
index 000000000000..7db821a6bf04
--- /dev/null
+++ b/uui/source/sslwarndlg.cxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+************************************************************************/
+
+#include <vcl/msgbox.hxx>
+
+#include <ids.hrc>
+#include <sslwarndlg.hrc>
+#include <sslwarndlg.hxx>
+
+#include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SSLWarnDialog, OKHdl_Impl, PushButton *, EMPTYARG )
+{
+ EndDialog( RET_OK );
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SSLWarnDialog, ViewCertHdl_Impl, PushButton *, EMPTYARG )
+{
+ uno::Reference< ::com::sun::star::security::XDocumentDigitalSignatures > xDocumentDigitalSignatures;
+
+ xDocumentDigitalSignatures = uno::Reference< ::com::sun::star::security::XDocumentDigitalSignatures >(
+ getServiceFactory().get()->createInstance( rtl::OUString::createFromAscii( "com.sun.star.security.DocumentDigitalSignatures" )), uno::UNO_QUERY );
+
+ xDocumentDigitalSignatures.get()->showCertificate(getCert());
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+SSLWarnDialog::SSLWarnDialog
+(
+ Window* pParent,
+ const cssu::Reference< dcss::security::XCertificate >& rXCert,
+ const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ ResMgr* pResMgr
+) :
+
+ ModalDialog( pParent, ResId( DLG_UUI_SSLWARN, *pResMgr ) ),
+ m_aLabel1 ( this, ResId( FT_LABEL_1, *pResMgr ) ),
+ m_aOkButton ( this, ResId( PB_OK, *pResMgr ) ),
+ m_aCancelButton ( this, ResId( PB_CANCEL, *pResMgr ) ),
+ m_aCommandButtonViewCert ( this, ResId( PB_VIEW__CERTIFICATE, *pResMgr ) ),
+ m_aLine ( this, ResId( FL_LINE, *pResMgr ) ),
+ m_aWarnImage ( this, ResId( IMG_WARN, *pResMgr ) ),
+ m_xServiceFactory ( xServiceFactory ),
+ m_rXCert ( rXCert ),
+ pResourceMgr ( pResMgr )
+{
+ FreeResource();
+ m_aWarnImage.SetImage( WarningBox::GetStandardImage() );
+ m_pParent = pParent;
+ m_aCommandButtonViewCert.SetClickHdl( LINK( this, SSLWarnDialog, ViewCertHdl_Impl ) );
+ m_aOkButton.SetClickHdl( LINK( this, SSLWarnDialog, OKHdl_Impl ) );
+};
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/sslwarndlg.hrc b/uui/source/sslwarndlg.hrc
new file mode 100644
index 000000000000..6dc5822bf6cb
--- /dev/null
+++ b/uui/source/sslwarndlg.hrc
@@ -0,0 +1,60 @@
+/*************************************************************************
+*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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 UUI_SSLWARN_HRC
+#define UUI_SSLWARN_HRC
+
+#include <svtools/controldims.hrc>
+
+// local identifiers
+#define FT_LABEL_1 1
+#define PB_OK 4
+#define PB_VIEW__CERTIFICATE 5
+#define PB_CANCEL 6
+#define IMG_WARN 7
+#define FL_LINE 9
+
+// Dims
+
+#define DLG_WIDTH 240
+#define DLG_HEIGHT 125
+
+#define DLG_WARMIMG_HEIGHT 20
+#define DLG_WARMIMG_WIDTH 20
+
+#define DLG_TEXT_1_HEIGHT 90
+
+#define DLG_TEXT_START_X RSC_SP_DLG_INNERBORDER_LEFT + DLG_WARMIMG_WIDTH + RSC_SP_CTRL_X
+
+#define DLG_CTLBTN_START_Y DLG_HEIGHT - RSC_SP_CTRL_X - RSC_CD_PUSHBUTTON_HEIGHT
+
+#define DLG_CTLBTN_CANCEL_PUSHBUTTON_WIDTH RSC_CD_PUSHBUTTON_WIDTH + 20
+#define DLG_CTLBTN_CANCEL_START_X DLG_WIDTH - 45 - DLG_CTLBTN_CANCEL_PUSHBUTTON_WIDTH
+#define DLG_CTLBTN_OK_START_X DLG_CTLBTN_CANCEL_START_X - RSC_CD_PUSHBUTTON_WIDTH - RSC_SP_CTRL_GROUP_X
+#define DLG_CTLBTN_CERT_PUSHBUTTON_WIDTH RSC_CD_PUSHBUTTON_WIDTH + 25
+#define DLG_CTLBTN_CERT_START_X DLG_TEXT_START_X
+#endif //UUI_SSLWARN_HRC
diff --git a/uui/source/sslwarndlg.hxx b/uui/source/sslwarndlg.hxx
new file mode 100644
index 000000000000..65326ad14c4f
--- /dev/null
+++ b/uui/source/sslwarndlg.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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 UUI_SSLWARN_HXX
+#define UUI_SSLWARN_HXX
+
+
+#include <vcl/dialog.hxx>
+
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+#include <com/sun/star/security/XCertificate.hpp>
+#include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+namespace cssu = com::sun::star::uno;
+namespace dcss = ::com::sun::star;
+
+
+using namespace com::sun::star;
+
+//=====================================================================
+//= Https_WarnDialog
+//=====================================================================
+class SSLWarnDialog : public ModalDialog
+{
+private:
+ FixedText m_aLabel1;
+ PushButton m_aOkButton;
+ CancelButton m_aCancelButton;
+ PushButton m_aCommandButtonViewCert;
+ FixedLine m_aLine;
+ FixedImage m_aWarnImage;
+
+
+ const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& m_xServiceFactory;
+ const cssu::Reference< dcss::security::XCertificate >& m_rXCert;
+ Window* m_pParent;
+ ResMgr* pResourceMgr;
+
+ DECL_LINK( OKHdl_Impl, PushButton * );
+ DECL_LINK( ViewCertHdl_Impl, PushButton * );
+
+ public:
+ SSLWarnDialog( Window* pParent,
+ const cssu::Reference< dcss::security::XCertificate >& rXCert,
+ const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ ResMgr * pResMgr );
+
+ const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > getServiceFactory() { return m_xServiceFactory; };
+
+ cssu::Reference< dcss::security::XCertificate > getCert() { return m_rXCert; };
+
+ Window* getParent() { return m_pParent; };
+
+ void setDescription1Text( const rtl::OUString &aText ) { m_aLabel1.SetText( aText ); };
+};
+
+#endif // UUI_SSLWARN_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/sslwarndlg.src b/uui/source/sslwarndlg.src
new file mode 100644
index 000000000000..bea7d06da3cf
--- /dev/null
+++ b/uui/source/sslwarndlg.src
@@ -0,0 +1,106 @@
+/*************************************************************************
+*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+************************************************************************/
+#define __RSC
+
+
+#ifndef UUI_IDS_HRC
+#include <ids.hrc>
+#endif
+#ifndef UUI_SSLWARN_HRC
+#include <sslwarndlg.hrc>
+#endif
+
+ModalDialog DLG_UUI_SSLWARN
+{
+ HelpId = HID_DLG_SSLWARN_UUI;
+ Border = TRUE ;
+ Moveable = TRUE ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT( 221, 158 );
+ Size = MAP_APPFONT( DLG_WIDTH, DLG_HEIGHT );
+
+ Text [ en-US ] = "Security Warning: ";
+
+ FixedText FT_LABEL_1
+ {
+ Pos = MAP_APPFONT( DLG_TEXT_START_X, RSC_SP_DLG_INNERBORDER_TOP );
+ Size = MAP_APPFONT( 195, DLG_TEXT_1_HEIGHT );
+
+ Text [ en-US ] = "No Text";
+
+ Border = FALSE;
+ WordBreak = TRUE;
+ };
+
+ PushButton PB_VIEW__CERTIFICATE
+ {
+ Pos = MAP_APPFONT( DLG_CTLBTN_CERT_START_X, DLG_CTLBTN_START_Y );
+ Size = MAP_APPFONT( DLG_CTLBTN_CERT_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+
+ Text [ en-US ] = "View Certificate";
+
+ };
+
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT( DLG_CTLBTN_CANCEL_START_X, DLG_CTLBTN_START_Y );
+ Size = MAP_APPFONT( DLG_CTLBTN_CANCEL_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+
+ Text [ en-US ] = "Cancel Connection";
+
+ };
+
+ PushButton PB_OK
+ {
+ Pos = MAP_APPFONT( DLG_CTLBTN_OK_START_X, DLG_CTLBTN_START_Y );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+
+ Text [ en-US ] = "Continue";
+
+ };
+
+ FixedImage IMG_WARN
+ {
+ Pos = MAP_APPFONT( RSC_SP_DLG_INNERBORDER_LEFT, RSC_SP_DLG_INNERBORDER_TOP );
+ Size = MAP_APPFONT( DLG_WARMIMG_WIDTH , DLG_WARMIMG_HEIGHT );
+
+ Fixed = Image
+ {
+ /* ImageBitmap = Bitmap { File = "certificate_40x56.png"; }; */
+ MaskColor = Color{Red=0xffff;Green=0x0000;Blue=0xffff;};
+ };
+
+ };
+
+ FixedLine FL_LINE
+ {
+ Pos = MAP_APPFONT( 0, DLG_CTLBTN_START_Y - RSC_SP_FLGR_INNERBORDER_TOP - RSC_CD_FIXEDLINE_HEIGHT );
+ Size = MAP_APPFONT( DLG_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
+ };
+};
+
diff --git a/uui/source/trylater.cxx b/uui/source/trylater.cxx
new file mode 100644
index 000000000000..35b65271f454
--- /dev/null
+++ b/uui/source/trylater.cxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "ids.hrc"
+#include "trylater.hxx"
+
+TryLaterQueryBox::TryLaterQueryBox( Window* pParent, ResMgr* pResMgr, const String& aMessage ) :
+ MessBox(pParent, 0,
+ String( ResId( STR_TRYLATER_TITLE, *pResMgr ) ),
+ aMessage )
+{
+ SetImage( QueryBox::GetStandardImage() );
+
+ AddButton( String( ResId( STR_TRYLATER_RETRYSAVING_BTN, *pResMgr ) ), RET_YES,
+ BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_OKBUTTON | BUTTONDIALOG_FOCUSBUTTON);
+ AddButton( String( ResId( STR_TRYLATER_SAVEAS_BTN, *pResMgr ) ), RET_NO, 0);
+ AddButton( BUTTON_CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON );
+
+ SetButtonHelpText( RET_YES, String::EmptyString() );
+ SetButtonHelpText( RET_NO, String::EmptyString() );
+}
+
+TryLaterQueryBox::~TryLaterQueryBox()
+{
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/trylater.hxx b/uui/source/trylater.hxx
new file mode 100644
index 000000000000..fd9915261da3
--- /dev/null
+++ b/uui/source/trylater.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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 _UUI_TRYLATER_HXX
+#define _UUI_TRYLATER_HXX
+
+#include <vcl/msgbox.hxx>
+
+class TryLaterQueryBox : public MessBox
+{
+public:
+ TryLaterQueryBox( Window* pParent, ResMgr* pResMgr, const String& aMessage );
+ ~TryLaterQueryBox();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/trylater.src b/uui/source/trylater.src
new file mode 100644
index 000000000000..acc799ac168f
--- /dev/null
+++ b/uui/source/trylater.src
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#define __RSC
+
+#ifndef UUI_IDS_HRC
+#include <ids.hrc>
+#endif
+
+String STR_TRYLATER_TITLE
+{
+ Text [ en-US ] = "Document in Use";
+};
+String STR_TRYLATER_MSG
+{
+ Text [ en-US ] = "Document file '$(ARG1)' is locked for editing by:\n\n$(ARG2)\n\nTry again later to save document or save a copy of that document.\n\n";
+};
+String STR_TRYLATER_RETRYSAVING_BTN
+{
+ Text [ en-US ] = "~Retry Saving";
+};
+String STR_TRYLATER_SAVEAS_BTN
+{
+ Text [ en-US ] = "~Save As...";
+};
+
diff --git a/uui/source/unknownauthdlg.cxx b/uui/source/unknownauthdlg.cxx
new file mode 100644
index 000000000000..42d33d9ab3e3
--- /dev/null
+++ b/uui/source/unknownauthdlg.cxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+************************************************************************/
+
+#include <vcl/msgbox.hxx>
+
+#include <ids.hrc>
+#include <unknownauthdlg.hrc>
+#include <unknownauthdlg.hxx>
+
+#include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( UnknownAuthDialog, OKHdl_Impl, PushButton *, EMPTYARG )
+{
+ if ( m_aOptionButtonAccept.IsChecked() )
+ {
+ EndDialog( RET_OK );
+ } else
+ {
+ EndDialog( RET_CANCEL );
+ }
+
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( UnknownAuthDialog, ViewCertHdl_Impl, PushButton *, EMPTYARG )
+{
+ uno::Reference< ::com::sun::star::security::XDocumentDigitalSignatures > xDocumentDigitalSignatures;
+
+ xDocumentDigitalSignatures = uno::Reference< ::com::sun::star::security::XDocumentDigitalSignatures >(
+ getServiceFactory().get()->createInstance( rtl::OUString::createFromAscii( "com.sun.star.security.DocumentDigitalSignatures" )), uno::UNO_QUERY );
+
+ xDocumentDigitalSignatures.get()->showCertificate(getCert());
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+UnknownAuthDialog::UnknownAuthDialog
+(
+ Window* pParent,
+ const cssu::Reference< dcss::security::XCertificate >& rXCert,
+ const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ ResMgr* pResMgr
+) :
+ ModalDialog( pParent, ResId( DLG_UUI_UNKNOWNAUTH, *pResMgr ) ),
+
+ m_aCommandButtonOK ( this, ResId( PB_OK, *pResMgr ) ),
+ m_aCommandButtonCancel ( this, ResId( PB_CANCEL, *pResMgr ) ),
+ m_aCommandButtonHelp ( this, ResId( PB_HELP, *pResMgr ) ),
+ m_aView_Certificate ( this, ResId( PB_VIEW__CERTIFICATE, *pResMgr ) ),
+ m_aOptionButtonAccept ( this, ResId( RB_ACCEPT_1, *pResMgr ) ),
+ m_aOptionButtonDontAccept ( this, ResId( RB_DONTACCEPT_2, *pResMgr ) ),
+ m_aLine ( this, ResId( FL_LINE, *pResMgr ) ),
+ m_aLabel1 ( this, ResId( FT_LABEL_1, *pResMgr ) ),
+ m_aWarnImage ( this, ResId( IMG_WARN, *pResMgr ) ),
+ m_xServiceFactory ( xServiceFactory ),
+ m_rXCert ( rXCert ),
+ pResourceMgr ( pResMgr )
+{
+ //SetMapMode( MapMode( MAP_APPFONT ) );
+ FreeResource();
+
+ m_aWarnImage.SetImage( WarningBox::GetStandardImage() );
+ m_pParent = pParent;
+ m_aView_Certificate.SetClickHdl( LINK( this, UnknownAuthDialog, ViewCertHdl_Impl ) );
+ m_aCommandButtonOK.SetClickHdl( LINK( this, UnknownAuthDialog, OKHdl_Impl ) );
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/unknownauthdlg.hrc b/uui/source/unknownauthdlg.hrc
new file mode 100644
index 000000000000..9bb6b0dea642
--- /dev/null
+++ b/uui/source/unknownauthdlg.hrc
@@ -0,0 +1,64 @@
+/*************************************************************************
+*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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 UUI_UNKNOWNAUTH_HRC
+#define UUI_UNKNOWNAUTH_HRC
+
+#include <svtools/controldims.hrc>
+
+// local identifiers
+#define RB_ACCEPT_1 1
+#define PB_OK 2
+#define PB_VIEW__CERTIFICATE 3
+#define PB_CANCEL 4
+#define FT_LABEL_1 5
+#define RB_DONTACCEPT_2 6
+#define IMG_WARN 7
+#define PB_HELP 8
+#define FL_LINE 10
+
+// Dims
+
+#define DLG_WIDTH 230
+#define DLG_HEIGHT 140
+
+#define DLG_WARMIMG_HEIGHT 20
+#define DLG_WARMIMG_WIDTH 20
+
+#define DLG_TEXT_1_HEIGHT 50
+
+#define DLG_TEXT_START_X RSC_SP_DLG_INNERBORDER_LEFT + DLG_WARMIMG_WIDTH + RSC_SP_CTRL_X
+
+#define DLG_RADIOBTN_START_Y RSC_SP_DLG_INNERBORDER_TOP + DLG_TEXT_1_HEIGHT + RSC_SP_CTRL_Y + RSC_CD_PUSHBUTTON_HEIGHT + RSC_SP_CTRL_GROUP_Y
+
+#define DLG_CTLBTN_START_Y DLG_HEIGHT - RSC_SP_CTRL_X - RSC_CD_PUSHBUTTON_HEIGHT
+
+
+#define DLG_CTLBTN_OK_START_X DLG_CTLBTN_CANCEL_START_X - RSC_CD_PUSHBUTTON_WIDTH - RSC_SP_CTRL_GROUP_X
+#define DLG_CTLBTN_CANCEL_START_X DLG_CTLBTN_HELP_START_X - RSC_CD_PUSHBUTTON_WIDTH - RSC_SP_CTRL_GROUP_X
+#define DLG_CTLBTN_HELP_START_X DLG_WIDTH - RSC_SP_DLG_INNERBORDER_RIGHT - RSC_CD_PUSHBUTTON_WIDTH
+
+#endif //UUI_UNKNOWNAUTH_HRC
diff --git a/uui/source/unknownauthdlg.hxx b/uui/source/unknownauthdlg.hxx
new file mode 100644
index 000000000000..4b15f7d20f60
--- /dev/null
+++ b/uui/source/unknownauthdlg.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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 UUI_UNKNOWNAUTH_HXX
+#define UUI_UNKNOWNAUTH_HXX
+
+
+#include <vcl/dialog.hxx>
+
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+#include <com/sun/star/security/XCertificate.hpp>
+#include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+namespace cssu = com::sun::star::uno;
+namespace dcss = ::com::sun::star;
+
+
+using namespace com::sun::star;
+
+//=====================================================================
+//= Https_UADialog
+//=====================================================================
+class UnknownAuthDialog : public ModalDialog
+{
+private:
+ PushButton m_aCommandButtonOK;
+ CancelButton m_aCommandButtonCancel;
+ HelpButton m_aCommandButtonHelp;
+ PushButton m_aView_Certificate;
+ RadioButton m_aOptionButtonAccept;
+ RadioButton m_aOptionButtonDontAccept;
+ FixedLine m_aLine;
+ FixedText m_aLabel1;
+ FixedImage m_aWarnImage;
+
+ const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& m_xServiceFactory;
+ const cssu::Reference< dcss::security::XCertificate >& m_rXCert;
+ Window* m_pParent;
+ ResMgr* pResourceMgr;
+
+ DECL_LINK( OKHdl_Impl, PushButton * );
+ DECL_LINK( ViewCertHdl_Impl, PushButton * );
+
+ public:
+ UnknownAuthDialog( Window* pParent,
+ const cssu::Reference< dcss::security::XCertificate >& rXCert,
+ const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ ResMgr * pResMgr );
+
+ const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > getServiceFactory() { return m_xServiceFactory; };
+
+ cssu::Reference< dcss::security::XCertificate > getCert() { return m_rXCert; };
+
+ Window* getParent() { return m_pParent; };
+
+ void setDescriptionText( const rtl::OUString &aText ) { m_aLabel1.SetText( aText ); };
+
+};
+
+#endif // UUI_UNKNOWNAUTH_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/unknownauthdlg.src b/uui/source/unknownauthdlg.src
new file mode 100644
index 000000000000..aadb52282d42
--- /dev/null
+++ b/uui/source/unknownauthdlg.src
@@ -0,0 +1,135 @@
+/*************************************************************************
+*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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.
+ *
+************************************************************************/
+#define __RSC
+
+#ifndef UUI_IDS_HRC
+#include <ids.hrc>
+#endif
+#ifndef UUI_UNKNOWNAUTH_HRC
+#include <unknownauthdlg.hrc>
+#endif
+
+ModalDialog DLG_UUI_UNKNOWNAUTH
+{
+ HelpId = HID_DLG_UNKNOWNAUTH_UUI;
+ Border = TRUE ;
+ Moveable = TRUE ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT( 136, 79 );
+ Size = MAP_APPFONT( DLG_WIDTH, DLG_HEIGHT );
+
+ Text [ en-US ] = "Website Certified by an Unknown Authority";
+
+
+ FixedImage IMG_WARN
+ {
+ Pos = MAP_APPFONT( RSC_SP_DLG_INNERBORDER_LEFT, RSC_SP_DLG_INNERBORDER_TOP );
+ Size = MAP_APPFONT( DLG_WARMIMG_WIDTH , DLG_WARMIMG_HEIGHT );
+
+ Fixed = Image
+ {
+ /* ImageBitmap = Bitmap { File = "certificate_40x56.png"; }; */
+ MaskColor = Color{Red=0xffff;Green=0x0000;Blue=0xffff;};
+ };
+
+ };
+
+
+ PushButton PB_VIEW__CERTIFICATE
+ {
+ Pos = MAP_APPFONT( DLG_TEXT_START_X, RSC_SP_DLG_INNERBORDER_TOP + DLG_TEXT_1_HEIGHT + RSC_SP_CTRL_GROUP_Y );
+ Size = MAP_APPFONT( 70, RSC_CD_PUSHBUTTON_HEIGHT );
+
+ Text [ en-US ] = "Examine Certificate...";
+
+ };
+
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT( DLG_CTLBTN_HELP_START_X, DLG_CTLBTN_START_Y );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+
+ Text [ en-US ] = "Help";
+
+ };
+
+ PushButton PB_OK
+ {
+ Pos = MAP_APPFONT( DLG_CTLBTN_OK_START_X, DLG_CTLBTN_START_Y );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+
+ Text [ en-US ] = "OK";
+
+ };
+
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT( DLG_CTLBTN_CANCEL_START_X, DLG_CTLBTN_START_Y );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+
+ };
+
+ RadioButton RB_ACCEPT_1
+ {
+ Pos = MAP_APPFONT( DLG_TEXT_START_X, DLG_RADIOBTN_START_Y );
+ Size = MAP_APPFONT( 182, RSC_CD_RADIOBUTTON_HEIGHT );
+
+ Text [ en-US ] = "Accept this certificate temporarily for this session";
+
+ Check = TRUE;
+ };
+
+ RadioButton RB_DONTACCEPT_2
+ {
+ Pos = MAP_APPFONT( DLG_TEXT_START_X, DLG_RADIOBTN_START_Y + RSC_CD_RADIOBUTTON_HEIGHT );
+ Size = MAP_APPFONT( 182, RSC_CD_RADIOBUTTON_HEIGHT );
+
+ Text [ en-US ] = "Do not accept this certificate and do not connect to this Web site";
+
+ };
+
+ FixedText FT_LABEL_1
+ {
+ Pos = MAP_APPFONT( DLG_TEXT_START_X, RSC_SP_DLG_INNERBORDER_TOP );
+ Size = MAP_APPFONT( 190, DLG_TEXT_1_HEIGHT );
+
+ Text [ en-US ] = "No Text";
+
+ Border = FALSE;
+ WordBreak = TRUE;
+
+ };
+
+ FixedLine FL_LINE
+ {
+ Pos = MAP_APPFONT( 0, DLG_CTLBTN_START_Y - RSC_SP_FLGR_INNERBORDER_TOP - RSC_CD_FIXEDLINE_HEIGHT );
+ Size = MAP_APPFONT( DLG_WIDTH , RSC_CD_FIXEDLINE_HEIGHT );
+ };
+
+};
+
diff --git a/uui/util/makefile.mk b/uui/util/makefile.mk
new file mode 100644
index 000000000000..163a7bb5502e
--- /dev/null
+++ b/uui/util/makefile.mk
@@ -0,0 +1,64 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ = ..
+PRJNAME = uui
+TARGET = uui
+RESTARGET = $(TARGET)
+
+GEN_HID = true
+NO_BSYMBOLIC = true
+
+.INCLUDE: settings.mk
+
+SHL1TARGET = $(TARGET)$(DLLPOSTFIX)
+SHL1IMPLIB = i$(TARGET)
+
+SHL1VERSIONMAP = $(SOLARENV)/src/component.map
+SHL1DEF = $(MISC)$/$(SHL1TARGET).def
+DEF1NAME = $(SHL1TARGET)
+
+SHL1LIBS = \
+ $(SLB)$/source.lib
+
+SHL1STDLIBS = \
+ $(SVTOOLLIB) \
+ $(SVLLIB) \
+ $(TKLIB) \
+ $(VCLLIB) \
+ $(UNOTOOLSLIB) \
+ $(TOOLSLIB) \
+ $(COMPHELPERLIB) \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB)
+
+RESLIB1NAME = $(RESTARGET)
+RESLIB1SRSFILES = \
+ $(SRS)$/source.srs
+
+.INCLUDE: target.mk
diff --git a/uui/util/uui.xml b/uui/util/uui.xml
new file mode 100644
index 000000000000..d5a2537a5379
--- /dev/null
+++ b/uui/util/uui.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE
+ module-description
+ PUBLIC
+ "-//StarOffice//DTD ComponentDescription 1.0//EN"
+ "module-description.dtd">
+<module-description>
+ <module-name>uui</module-name>
+ <component-description>
+ <author>Stephan Bergmann</author>
+ <name>com.sun.star.comp.uui.UUIInteractionHandler</name>
+ <description>
+ An Interaction Handler for the UCB. It uses VCL to visualize and
+ handle interaction requests.
+ </description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>
+ com.sun.star.task.InteractionHandler
+ </supported-service>
+ </component-description>
+ <project-build-dependency>cppu</project-build-dependency>
+ <project-build-dependency>cppuhelper</project-build-dependency>
+ <project-build-dependency>sal</project-build-dependency>
+ <project-build-dependency>svtools</project-build-dependency>
+ <project-build-dependency>toolkit</project-build-dependency>
+ <project-build-dependency>tools</project-build-dependency>
+ <project-build-dependency>vcl</project-build-dependency>
+ <runtime-module-dependency>cppu3</runtime-module-dependency>
+ <runtime-module-dependency>cppuhelper3$(COM)</runtime-module-dependency>
+ <runtime-module-dependency>sal3</runtime-module-dependency>
+ <runtime-module-dependency>svt</runtime-module-dependency>
+ <runtime-module-dependency>tk</runtime-module-dependency>
+ <runtime-module-dependency>tl</runtime-module-dependency>
+ <runtime-module-dependency>vcl</runtime-module-dependency>
+ <service-dependency>
+ com.sun.star.task.PasswordContainer
+ </service-dependency>
+ <type>com.sun.star.awt.XWindow</type>
+ <type>com.sun.star.beans.PropertyValue</type>
+ <type>com.sun.star.java.WrongJavaVersionException</type>
+ <type>com.sun.star.lang.XInitialization</type>
+ <type>com.sun.star.lang.XMultiServiceFactory</type>
+ <type>com.sun.star.lang.XServiceInfo</type>
+ <type>com.sun.star.lang.XTypeProvider</type>
+ <type>com.sun.star.registry.XRegistryKey</type>
+ <type>com.sun.star.sync2.BadPartnershipException</type>
+ <type>com.sun.star.task.InteractionClassification</type>
+ <type>com.sun.star.task.NoMasterException</type>
+ <type>com.sun.star.task.PasswordRequest</type>
+ <type>com.sun.star.task.XInteractionAbort</type>
+ <type>com.sun.star.task.XInteractionApprove</type>
+ <type>com.sun.star.task.XInteractionContinuation</type>
+ <type>com.sun.star.task.XInteractionDisapprove</type>
+ <type>com.sun.star.task.XInteractionHandler</type>
+ <type>com.sun.star.task.XInteractionRetry</type>
+ <type>com.sun.star.task.XPasswordContainer</type>
+ <type>com.sun.star.ucb.AuthenticationRequest</type>
+ <type>com.sun.star.ucb.HandleCookiesRequest</type>
+ <type>com.sun.star.ucb.InteractiveAugmentedIOException</type>
+ <type>com.sun.star.ucb.InteractiveCHAOSException</type>
+ <type>com.sun.star.ucb.InteractiveNetworkConnectException</type>
+ <type>com.sun.star.ucb.InteractiveNetworkException</type>
+ <type>com.sun.star.ucb.InteractiveNetworkGeneralException</type>
+ <type>com.sun.star.ucb.InteractiveNetworkOffLineException</type>
+ <type>com.sun.star.ucb.InteractiveNetworkReadException</type>
+ <type>com.sun.star.ucb.InteractiveNetworkResolveNameException</type>
+ <type>com.sun.star.ucb.InteractiveNetworkWriteException</type>
+ <type>com.sun.star.ucb.InteractiveWrongMediumException</type>
+ <type>com.sun.star.ucb.XInteractionCookieHandling</type>
+ <type>com.sun.star.ucb.XInteractionSupplyAuthentication</type>
+ <type>com.sun.star.uno.Exception</type>
+ <type>com.sun.star.uno.RuntimeException</type>
+ <type>com.sun.star.uno.XInterface</type>
+</module-description>