[Libreoffice-commits] .: 3 commits - sd/inc sd/source
Markus Mohrhard
mmohrhard at kemper.freedesktop.org
Tue Jul 26 05:59:10 PDT 2011
sd/inc/sdabstdlg.hxx | 3 +-
sd/source/ui/app/sdmod1.cxx | 10 ++++---
sd/source/ui/dlg/dlgass.cxx | 52 ++++++++++++++++++++---------------------
sd/source/ui/dlg/sddlgfact.cxx | 2 -
sd/source/ui/dlg/sddlgfact.hxx | 2 -
sd/source/ui/inc/dlgass.hxx | 3 +-
6 files changed, 38 insertions(+), 34 deletions(-)
New commits:
commit acdb57d4bacfaa63a2ecb080525dd00cc0f9c741
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue Jul 26 14:54:17 2011 +0200
change from SID_PASSWORD to SID_ENCRYPTIONDATA
diff --git a/sd/inc/sdabstdlg.hxx b/sd/inc/sdabstdlg.hxx
index bdcb832..0634e4b 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 39fe999..f0feef9 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 4409b5e..8dd9e93 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 6f36175..95681a1 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 895ac84..09f84b0 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 980e016..da6b068 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
commit 4198c641c59561abd21298243aeaffc76bb17e26
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue Jul 26 02:48:59 2011 +0200
fix typo: DeletePassords to DeletePasswords
diff --git a/sd/source/ui/dlg/dlgass.cxx b/sd/source/ui/dlg/dlgass.cxx
index 38f4b2b..4409b5e 100644
--- a/sd/source/ui/dlg/dlgass.cxx
+++ b/sd/source/ui/dlg/dlgass.cxx
@@ -207,7 +207,7 @@ public:
void SavePassword( SfxObjectShellLock xDoc, const String& rPath );
void RestorePassword( SfxItemSet* pSet, const String& rPath );
String GetPassword( const String rPath );
- void DeletePassords();
+ void DeletePasswords();
boost::ptr_vector< PasswordEntry > maPasswordList;
@@ -676,7 +676,7 @@ AssistentDlgImpl::~AssistentDlgImpl()
{
CloseDocShell();
- DeletePassords();
+ DeletePasswords();
// Delete the template file infos.
std::vector<TemplateDir*>::iterator I;
@@ -1720,7 +1720,7 @@ String AssistentDlgImpl::GetPassword( const String rPath )
return String();
}
-void AssistentDlgImpl::DeletePassords()
+void AssistentDlgImpl::DeletePasswords()
{
maPasswordList.clear();
}
commit 3956169f4e4db08346b6cf3a2fd4a8cb81f9d356
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue Jul 26 02:47:04 2011 +0200
change maPasswordList to ptr_vector
diff --git a/sd/source/ui/dlg/dlgass.cxx b/sd/source/ui/dlg/dlgass.cxx
index 5ee4d8e..38f4b2b 100644
--- a/sd/source/ui/dlg/dlgass.cxx
+++ b/sd/source/ui/dlg/dlgass.cxx
@@ -82,6 +82,7 @@
#include <comphelper/processfactory.hxx>
#include <vector>
+#include <boost/ptr_container/ptr_vector.hpp>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -208,7 +209,7 @@ public:
String GetPassword( const String rPath );
void DeletePassords();
- vector< PasswordEntry* > maPasswordList;
+ boost::ptr_vector< PasswordEntry > maPasswordList;
String maDocFile;
String maLayoutFile;
@@ -1679,9 +1680,9 @@ void AssistentDlgImpl::SavePassword( SfxObjectShellLock xDoc, const String& rPat
PasswordEntry* pEntry = NULL;
for ( size_t i = 0, n = maPasswordList.size(); i < n; ++i )
{
- if ( maPasswordList[ i ]->maPath == rPath )
+ if ( maPasswordList[ i ].maPath == rPath )
{
- pEntry = maPasswordList[ i ];
+ pEntry = &maPasswordList[ i ];
break;
}
}
@@ -1712,7 +1713,7 @@ String AssistentDlgImpl::GetPassword( const String rPath )
{
for ( size_t i = 0, n = maPasswordList.size(); i < n; ++i )
{
- PasswordEntry* pEntry = maPasswordList[ i ];
+ PasswordEntry* pEntry = &maPasswordList[ i ];
if(pEntry->maPath == rPath)
return pEntry->maPassword;
}
@@ -1721,8 +1722,6 @@ String AssistentDlgImpl::GetPassword( const String rPath )
void AssistentDlgImpl::DeletePassords()
{
- for ( size_t i = 0, n = maPasswordList.size(); i < n; ++i )
- delete maPasswordList[ i ];
maPasswordList.clear();
}
More information about the Libreoffice-commits
mailing list