summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorMikhail Voytenko <mav@openoffice.org>2010-06-08 17:01:41 +0200
committerMikhail Voytenko <mav@openoffice.org>2010-06-08 17:01:41 +0200
commitdb2236600ffc64b188d23f43fb88ee0bf13a680a (patch)
tree1eb403af574ae73ef4a9ef7bc9e62029115958c8 /sfx2
parentba8229cc9d9a4c48a9e0a01611354f64ab5fd069 (diff)
tl78: #i110383# fix reload functionality
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/inc/sfx2/objsh.hxx2
-rw-r--r--sfx2/source/dialog/filedlghelper.cxx6
-rw-r--r--sfx2/source/doc/objcont.cxx4
-rwxr-xr-xsfx2/source/doc/objmisc.cxx2
-rw-r--r--sfx2/source/view/viewfrm.cxx13
5 files changed, 17 insertions, 10 deletions
diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx
index d8a8ea2f678a..95e8f21c8d86 100644
--- a/sfx2/inc/sfx2/objsh.hxx
+++ b/sfx2/inc/sfx2/objsh.hxx
@@ -717,7 +717,7 @@ public:
SAL_DLLPRIVATE sal_uInt16 ImplCheckSignaturesInformation(
const ::com::sun::star::uno::Sequence< ::com::sun::star::security::DocumentSignatureInformation >& aInfos );
SAL_DLLPRIVATE void CheckEncryption_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler );
- SAL_DLLPRIVATE void SetModifyPasswordEntered();
+ SAL_DLLPRIVATE void SetModifyPasswordEntered( sal_Bool bEntered = sal_True );
SAL_DLLPRIVATE sal_Bool IsModifyPasswordEntered();
SAL_DLLPRIVATE void InitBasicManager_Impl();
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index 759c47598f9f..072729648628 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -1528,7 +1528,7 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList,
mbPwdCheckBoxState = ( pPassItem != NULL );
// in case the document has password to modify, the dialog should be shown
- SFX_ITEMSET_ARG( rpSet, pPassToModifyItem, SfxUInt32Item, SID_MODIFYPASSWORDHASH, FALSE );
+ SFX_ITEMSET_ARG( rpSet, pPassToModifyItem, SfxInt32Item, SID_MODIFYPASSWORDHASH, FALSE );
mbPwdCheckBoxState |= ( pPassToModifyItem && pPassToModifyItem->GetValue() );
}
@@ -1660,9 +1660,9 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList,
rpSet->Put( SfxBoolItem( SID_RECOMMENDREADONLY, sal_True ) );
// the empty password has 0 as Hash
- sal_uInt16 nHash = SfxMedium::CreatePasswordToModifyHash( pPasswordRequest->getPasswordToModify(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ).equals( pCurrentFilter->GetServiceName() ) );
+ sal_Int32 nHash = SfxMedium::CreatePasswordToModifyHash( pPasswordRequest->getPasswordToModify(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ).equals( pCurrentFilter->GetServiceName() ) );
if ( nHash )
- rpSet->Put( SfxInt32Item( SID_MODIFYPASSWORDHASH, (sal_Int32)nHash ) );
+ rpSet->Put( SfxInt32Item( SID_MODIFYPASSWORDHASH, nHash ) );
}
else
return ERRCODE_ABORT;
diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx
index dc834debd533..547198f60ace 100644
--- a/sfx2/source/doc/objcont.cxx
+++ b/sfx2/source/doc/objcont.cxx
@@ -1262,9 +1262,9 @@ sal_Bool SfxObjectShell::SetModifyPasswordHash( sal_uInt32 nHash )
// return sal_False;
}
-void SfxObjectShell::SetModifyPasswordEntered()
+void SfxObjectShell::SetModifyPasswordEntered( sal_Bool bEntered )
{
- pImp->m_bModifyPasswordEntered = sal_True;
+ pImp->m_bModifyPasswordEntered = bEntered;
}
sal_Bool SfxObjectShell::IsModifyPasswordEntered()
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index 76aed9d11ed1..afcaa1614f2c 100755
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -1389,7 +1389,7 @@ void SfxObjectShell::FinishedLoading( sal_uInt16 nFlags )
if( !IsAbortingImport() )
PositionView_Impl();
- if ( GetModifyPasswordHash() )
+ if ( GetModifyPasswordHash() && !IsModifyPasswordEntered() )
SetReadOnly();
// Salvage
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index ca95475cabe6..a80741df13a6 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -714,6 +714,10 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
}
xNewObj = SfxObjectShell::CreateObject( pFilter->GetServiceName(), SFX_CREATE_MODE_STANDARD );
+
+ if ( xOldObj->IsModifyPasswordEntered() )
+ xNewObj->SetModifyPasswordEntered();
+
uno::Sequence < beans::PropertyValue > aLoadArgs;
TransformItems( SID_OPENDOC, *pNewSet, aLoadArgs );
try
@@ -769,6 +773,12 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
}
else
{
+ if ( xNewObj->GetModifyPasswordHash() && xNewObj->GetModifyPasswordHash() != xOldObj->GetModifyPasswordHash() )
+ {
+ xNewObj->SetModifyPasswordEntered( sal_False );
+ xNewObj->SetReadOnly();
+ }
+
if ( xNewObj->IsDocShared() )
{
// the file is shared but the closing can change the sharing control file
@@ -781,10 +791,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
TransformItems( SID_OPENDOC, *xNewObj->GetMedium()->GetItemSet(), aLoadArgs );
UpdateDocument_Impl();
- }
- if ( xNewObj.Is() )
- {
try
{
while ( !aViewFrames.empty() )