summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2011-07-26 14:54:17 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2011-07-26 14:57:33 +0200
commitacdb57d4bacfaa63a2ecb080525dd00cc0f9c741 (patch)
tree58b72e5e11b641ffdfd2a8b451aec84fd5f18761
parent4198c641c59561abd21298243aeaffc76bb17e26 (diff)
change from SID_PASSWORD to SID_ENCRYPTIONDATA
-rw-r--r--sd/inc/sdabstdlg.hxx3
-rw-r--r--sd/source/ui/app/sdmod1.cxx10
-rw-r--r--sd/source/ui/dlg/dlgass.cxx35
-rw-r--r--sd/source/ui/dlg/sddlgfact.cxx2
-rw-r--r--sd/source/ui/dlg/sddlgfact.hxx2
-rw-r--r--sd/source/ui/inc/dlgass.hxx3
6 files changed, 30 insertions, 25 deletions
diff --git a/sd/inc/sdabstdlg.hxx b/sd/inc/sdabstdlg.hxx
index bdcb832c3..0634e4b72 100644
--- a/sd/inc/sdabstdlg.hxx
+++ b/sd/inc/sdabstdlg.hxx
@@ -34,6 +34,7 @@
#include <tools/string.hxx>
#include <sfx2/sfxdlg.hxx>
#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/beans/XPropertyAccess.hpp>
#include "prlayout.hxx"
#include "sdenumdef.hxx"
@@ -95,7 +96,7 @@ public:
virtual String GetDocPath() const = 0;
virtual sal_Bool GetStartWithFlag() const = 0;
virtual sal_Bool IsDocEmpty() const = 0;
- virtual String GetPassword() = 0;
+ virtual com::sun::star::uno::Sequence< com::sun::star::beans::NamedValue > GetPassword() = 0;
};
class AbstractSdModifyFieldDlg : public VclAbstractDialog //add for SdModifyFieldDlg
diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx
index 39fe99981..f0feef96f 100644
--- a/sd/source/ui/app/sdmod1.cxx
+++ b/sd/source/ui/app/sdmod1.cxx
@@ -48,6 +48,7 @@
#include <editeng/paperinf.hxx>
#include <editeng/eeitem.hxx>
#include <unotools/useroptions.hxx>
+#include <com/sun/star/uno/Sequence.h>
#include "app.hrc"
#include "glob.hrc"
@@ -84,6 +85,7 @@
using ::sd::framework::FrameworkHelper;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::frame::XFrame;
+using ::com::sun::star::uno::Sequence;
namespace {
@@ -615,11 +617,11 @@ SfxFrame* SdModule::ExecuteNewDocument( SfxRequest& rReq )
DBG_ASSERT( aFileToOpen.Len()!=0, "The autopilot should have asked for a file itself already!" );
if(aFileToOpen.Len() != 0)
{
- const String aPasswrd( pPilotDlg->GetPassword() );
+ com::sun::star::uno::Sequence< com::sun::star::beans::NamedValue > aPasswrd( pPilotDlg->GetPassword() );
SfxStringItem aFile( SID_FILE_NAME, aFileToOpen );
SfxStringItem aReferer( SID_REFERER, UniString() );
- SfxStringItem aPassword( SID_PASSWORD, aPasswrd );
+ SfxUnoAnyItem aPassword( SID_ENCRYPTIONDATA, com::sun::star::uno::makeAny(aPasswrd) );
if ( xTargetFrame.is() )
{
@@ -628,7 +630,7 @@ SfxFrame* SdModule::ExecuteNewDocument( SfxRequest& rReq )
aSet.Put( aReferer );
// Put the password into the request
// only if it is not empty.
- if (aPasswrd.Len() > 0)
+ if (aPasswrd.getLength() > 0)
aSet.Put( aPassword );
const SfxPoolItem* pRet = SfxFrame::OpenDocumentSynchron( aSet, xTargetFrame );
@@ -643,7 +645,7 @@ SfxFrame* SdModule::ExecuteNewDocument( SfxRequest& rReq )
aRequest.AppendItem (aReferer);
// Put the password into the request
// only if it is not empty.
- if (aPasswrd.Len() > 0)
+ if (aPasswrd.getLength() > 0)
aRequest.AppendItem (aPassword);
aRequest.AppendItem (SfxStringItem (
SID_TARGETNAME,
diff --git a/sd/source/ui/dlg/dlgass.cxx b/sd/source/ui/dlg/dlgass.cxx
index 4409b5ed7..8dd9e93bd 100644
--- a/sd/source/ui/dlg/dlgass.cxx
+++ b/sd/source/ui/dlg/dlgass.cxx
@@ -116,7 +116,7 @@ const char* PageHelpIds[] =
class PasswordEntry
{
public:
- String maPassword;
+ uno::Sequence< beans::NamedValue > aEncryptionData;
String maPath;
};
@@ -206,7 +206,7 @@ public:
void SavePassword( SfxObjectShellLock xDoc, const String& rPath );
void RestorePassword( SfxItemSet* pSet, const String& rPath );
- String GetPassword( const String rPath );
+ uno::Sequence < beans::NamedValue > GetPassword( const String rPath );
void DeletePasswords();
boost::ptr_vector< PasswordEntry > maPasswordList;
@@ -1668,14 +1668,15 @@ void AssistentDlgImpl::SavePassword( SfxObjectShellLock xDoc, const String& rPat
SfxMedium * pMedium = xDoc->GetMedium();
if(pMedium && pMedium->IsStorage())
{
- SfxItemSet * pSet = pMedium->GetItemSet();
- const SfxPoolItem *pItem = 0;
- if( pSet->GetItemState(SID_PASSWORD, sal_True, &pItem) == SFX_ITEM_SET )
+ SfxItemSet * pSet = pMedium->GetItemSet();
+ SFX_ITEMSET_ARG( pSet, pEncryptionDataItem, SfxUnoAnyItem, SID_ENCRYPTIONDATA, sal_False);
+ uno::Sequence < beans::NamedValue > aEncryptionData;
+ if (pEncryptionDataItem)
+ pEncryptionDataItem->GetValue() >>= aEncryptionData;
+ else
+ return;
+ if( aEncryptionData.getLength() )
{
- //TODO/MBA: testing
- String aPass( ((const SfxStringItem*)pItem)->GetValue());
- if(aPass.Len() == 0)
- return;
PasswordEntry* pEntry = NULL;
for ( size_t i = 0, n = maPasswordList.size(); i < n; ++i )
@@ -1695,7 +1696,7 @@ void AssistentDlgImpl::SavePassword( SfxObjectShellLock xDoc, const String& rPat
}
if(pEntry)
- pEntry->maPassword = aPass;
+ pEntry->aEncryptionData = aEncryptionData;
}
}
}
@@ -1703,21 +1704,21 @@ void AssistentDlgImpl::SavePassword( SfxObjectShellLock xDoc, const String& rPat
void AssistentDlgImpl::RestorePassword( SfxItemSet* pSet, const String& rPath )
{
- String aPassword( GetPassword( rPath ) );
+ uno::Sequence < beans::NamedValue > aEncryptionData( GetPassword( rPath ) );
- if(aPassword.Len())
- pSet->Put( SfxStringItem( SID_PASSWORD, aPassword ) );
+ if(aEncryptionData.getLength())
+ pSet->Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, uno::makeAny( aEncryptionData ) ) );
}
-String AssistentDlgImpl::GetPassword( const String rPath )
+uno::Sequence < beans::NamedValue > AssistentDlgImpl::GetPassword( const String rPath )
{
for ( size_t i = 0, n = maPasswordList.size(); i < n; ++i )
{
PasswordEntry* pEntry = &maPasswordList[ i ];
if(pEntry->maPath == rPath)
- return pEntry->maPassword;
+ return pEntry->aEncryptionData;
}
- return String();
+ return uno::Sequence < beans::NamedValue > ();;
}
void AssistentDlgImpl::DeletePasswords()
@@ -1954,7 +1955,7 @@ sal_Bool AssistentDlg::IsDocEmpty() const
mpImpl->GetLayoutFileName().Len() == 0;
}
-String AssistentDlg::GetPassword()
+uno::Sequence< beans::NamedValue > AssistentDlg::GetPassword()
{
return mpImpl->GetPassword( mpImpl->maDocFile );
}
diff --git a/sd/source/ui/dlg/sddlgfact.cxx b/sd/source/ui/dlg/sddlgfact.cxx
index 6f361755e..95681a13e 100644
--- a/sd/source/ui/dlg/sddlgfact.cxx
+++ b/sd/source/ui/dlg/sddlgfact.cxx
@@ -222,7 +222,7 @@ sal_Bool AbstractAssistentDlg_Impl::IsDocEmpty() const
{
return pDlg->IsDocEmpty();
}
-String AbstractAssistentDlg_Impl::GetPassword()
+com::sun::star::uno::Sequence< com::sun::star::beans::NamedValue > AbstractAssistentDlg_Impl::GetPassword()
{
return pDlg->GetPassword();
}
diff --git a/sd/source/ui/dlg/sddlgfact.hxx b/sd/source/ui/dlg/sddlgfact.hxx
index 895ac8408..09f84b014 100644
--- a/sd/source/ui/dlg/sddlgfact.hxx
+++ b/sd/source/ui/dlg/sddlgfact.hxx
@@ -138,7 +138,7 @@ class AbstractAssistentDlg_Impl : public AbstractAssistentDlg
virtual String GetDocPath() const;
virtual sal_Bool GetStartWithFlag() const;
virtual sal_Bool IsDocEmpty() const;
- virtual String GetPassword();
+ virtual com::sun::star::uno::Sequence< com::sun::star::beans::NamedValue > GetPassword();
};
// add for SdModifyFieldDlg
diff --git a/sd/source/ui/inc/dlgass.hxx b/sd/source/ui/inc/dlgass.hxx
index 980e0161b..da6b06801 100644
--- a/sd/source/ui/inc/dlgass.hxx
+++ b/sd/source/ui/inc/dlgass.hxx
@@ -38,6 +38,7 @@
#include "assclass.hxx"
#include <vcl/lstbox.hxx>
#include <sfx2/app.hxx>
+#include <com/sun/star/uno/Sequence.h>
#include "sdenumdef.hxx"
@@ -62,7 +63,7 @@ public:
sal_Bool GetStartWithFlag() const;
sal_Bool IsDocEmpty() const;
- String GetPassword();
+ com::sun::star::uno::Sequence< com::sun::star::beans::NamedValue > GetPassword();
};
#endif