diff options
author | bureken <berkgureken@gmail.com> | 2015-10-26 03:39:00 +0300 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-11-10 12:24:10 +0000 |
commit | d7ca71d4b1ac085c575fdc24f37940100ab38961 (patch) | |
tree | a5cbfd3f2de13ff89da6bf89da26276011c62001 /sfx2/source | |
parent | 37968fd404ca04333502921e5560f893c7933888 (diff) |
tdf#87995 - settings : missing a checkbox in order to avoid thumbnail saving
Change-Id: I9822c930bb7e133306a3e90fd80f29648877d5f9
Reviewed-on: https://gerrit.libreoffice.org/19596
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2/source')
-rw-r--r-- | sfx2/source/dialog/dinfdlg.cxx | 40 | ||||
-rw-r--r-- | sfx2/source/doc/objcont.cxx | 12 | ||||
-rw-r--r-- | sfx2/source/doc/objserv.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/doc/objstor.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/inc/objshimp.hxx | 1 |
5 files changed, 57 insertions, 4 deletions
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index ecd40c98e4b0..1bd60c6b144d 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -214,13 +214,14 @@ SfxDocumentInfoItem::SfxDocumentInfoItem() , m_bHasTemplate( true ) , m_bDeleteUserData( false ) , m_bUseUserData( true ) + , m_bUseThumbnailSave( true ) { } SfxDocumentInfoItem::SfxDocumentInfoItem( const OUString& rFile, const uno::Reference<document::XDocumentProperties>& i_xDocProps, const uno::Sequence<document::CmisProperty>& i_cmisProps, - bool bIs ) + bool bIs, bool _bIs ) : SfxStringItem( SID_DOCINFO, rFile ) , m_AutoloadDelay( i_xDocProps->getAutoloadSecs() ) , m_AutoloadURL( i_xDocProps->getAutoloadURL() ) @@ -243,6 +244,7 @@ SfxDocumentInfoItem::SfxDocumentInfoItem( const OUString& rFile, , m_bHasTemplate( true ) , m_bDeleteUserData( false ) , m_bUseUserData( bIs ) + , m_bUseThumbnailSave( _bIs ) { try { @@ -298,6 +300,7 @@ SfxDocumentInfoItem::SfxDocumentInfoItem( const SfxDocumentInfoItem& rItem ) , m_bHasTemplate( rItem.m_bHasTemplate ) , m_bDeleteUserData( rItem.m_bDeleteUserData ) , m_bUseUserData( rItem.m_bUseUserData ) + , m_bUseThumbnailSave( rItem.m_bUseThumbnailSave ) { for ( size_t i = 0; i < rItem.m_aCustomProperties.size(); i++ ) { @@ -449,6 +452,11 @@ void SfxDocumentInfoItem::SetUseUserData( bool bSet ) m_bUseUserData = bSet; } +void SfxDocumentInfoItem::SetUseThumbnailSave( bool bSet ) +{ + m_bUseThumbnailSave = bSet; +} + std::vector< CustomProperty* > SfxDocumentInfoItem::GetCustomProperties() const { std::vector< CustomProperty* > aRet; @@ -494,6 +502,9 @@ bool SfxDocumentInfoItem::QueryValue( Any& rVal, sal_uInt8 nMemberId ) const case MID_DOCINFO_USEUSERDATA: bValue = IsUseUserData(); break; + case MID_DOCINFO_USETHUMBNAILSAVE: + bValue = IsUseThumbnailSave(); + break; case MID_DOCINFO_DELETEUSERDATA: bValue = IsDeleteUserData(); break; @@ -556,6 +567,11 @@ bool SfxDocumentInfoItem::PutValue( const Any& rVal, sal_uInt8 nMemberId ) if ( bRet ) SetUseUserData( bValue ); break; + case MID_DOCINFO_USETHUMBNAILSAVE: + bRet = (rVal >>=bValue); + if ( bRet ) + SetUseThumbnailSave( bValue ); + break; case MID_DOCINFO_DELETEUSERDATA: // QUESTION: deleting user data was done here; seems to be superfluous! bRet = (rVal >>= bValue); @@ -780,6 +796,7 @@ SfxDocumentPage::SfxDocumentPage(vcl::Window* pParent, const SfxItemSet& rItemSe get(m_pDocNoValFt, "showrevision"); get(m_pUseUserDataCB, "userdatacb"); + get(m_pUseThumbnailSaveCB, "thumbnailsavecb"); get(m_pDeleteBtn, "reset"); get(m_pTemplFt, "templateft"); @@ -823,6 +840,7 @@ void SfxDocumentPage::dispose() m_pDeleteBtn.clear(); m_pTemplFt.clear(); m_pTemplValFt.clear(); + m_pUseThumbnailSaveCB.clear(); SfxTabPage::dispose(); } @@ -986,6 +1004,22 @@ bool SfxDocumentPage::FillItemSet( SfxItemSet* rSet ) } } + if ( m_pUseThumbnailSaveCB->IsValueChangedFromSaved() && + GetTabDialog() && GetTabDialog()->GetExampleSet() ) + { + SfxItemSet* pExpSet = GetTabDialog()->GetExampleSet(); + const SfxPoolItem* pItem; + + if ( pExpSet && SfxItemState::SET == pExpSet->GetItemState( SID_DOCINFO, true, &pItem ) ) + { + const SfxDocumentInfoItem* m_pxInfoItem = static_cast<const SfxDocumentInfoItem*>(pItem); + bool bUseThumbnail = ( TRISTATE_TRUE == m_pUseThumbnailSaveCB->GetState() ); + const_cast<SfxDocumentInfoItem*>(m_pxInfoItem)->SetUseThumbnailSave( bUseThumbnail ); + rSet->Put( SfxDocumentInfoItem( *m_pxInfoItem ) ); + bRet = true; + } + } + return bRet; } @@ -1084,6 +1118,8 @@ void SfxDocumentPage::Reset( const SfxItemSet* rSet ) rInfoItem.getEditingCycles() ) ); } + bool m_bUseThumbnailSave = rInfoItem.IsUseThumbnailSave(); + // Check for cmis properties where otherwise unavailable if ( rInfoItem.isCmisDocument( ) ) { @@ -1138,6 +1174,8 @@ void SfxDocumentPage::Reset( const SfxItemSet* rSet ) m_pUseUserDataCB->Enable( bEnableUseUserData ); bHandleDelete = false; m_pDeleteBtn->Enable( bEnableUseUserData ); + m_pUseThumbnailSaveCB->SetState( static_cast<TriState>(m_bUseThumbnailSave) ); + m_pUseThumbnailSaveCB->SaveValue(); } diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index 9ccef662938d..8090351c9e3d 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -560,6 +560,11 @@ bool SfxObjectShell::IsUseUserData() const return pImp->bUseUserData; } +bool SfxObjectShell::IsUseThumbnailSave() const +{ + return pImp->bUseThumbnailSave; +} + void SfxObjectShell::SetQueryLoadTemplate( bool bNew ) { if ( pImp->bQueryLoadTemplate != bNew ) @@ -574,6 +579,13 @@ void SfxObjectShell::SetUseUserData( bool bNew ) pImp->bUseUserData = bNew; } +void SfxObjectShell::SetUseThumbnailSave( bool _bNew ) +{ + if ( pImp->bUseThumbnailSave != _bNew ) + SetModified(); + pImp->bUseThumbnailSave = _bNew; +} + bool SfxObjectShell::IsLoadReadonly() const { return pImp->bLoadReadonly; diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 5cfada6db559..522976bfe1a9 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -448,6 +448,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) // parameter, e.g. from replayed macro pDocInfItem->UpdateDocumentInfo(getDocProperties(), true); SetUseUserData( pDocInfItem->IsUseUserData() ); + SetUseThumbnailSave( pDocInfItem->IsUseThumbnailSave() ); } else { @@ -477,7 +478,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) uno::Sequence< document::CmisProperty> aCmisProperties = xCmisDoc->getCmisProperties(); SfxDocumentInfoItem aDocInfoItem( aURL, getDocProperties(), aCmisProperties, - IsUseUserData() ); + IsUseUserData(), IsUseThumbnailSave() ); if ( !GetSlotState( SID_DOCTEMPLATE ) ) // templates not supported aDocInfoItem.SetTemplate(false); @@ -505,9 +506,10 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) if ( aNewCmisProperties.getLength( ) > 0 ) xCmisDoc->updateCmisProperties( aNewCmisProperties ); SetUseUserData( pDocInfoItem->IsUseUserData() ); + SetUseThumbnailSave( pDocInfoItem-> IsUseThumbnailSave() ); // add data from dialog for possible recording purpose rReq.AppendItem( SfxDocumentInfoItem( GetTitle(), - getDocProperties(), aNewCmisProperties, IsUseUserData() ) ); + getDocProperties(), aNewCmisProperties, IsUseUserData(), IsUseThumbnailSave() ) ); } rReq.Done(); diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index e2bf783055c9..ea768f7ca3c9 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -1442,7 +1442,7 @@ bool SfxObjectShell::SaveTo_Impl //fdo#61320: only store thumbnail image if the corresponding option is enabled in the configuration if ( bOk && officecfg::Office::Common::Save::Document::GenerateThumbnail::get() - && GetCreateMode() != SfxObjectCreateMode::EMBEDDED && !bPasswdProvided ) + && GetCreateMode() != SfxObjectCreateMode::EMBEDDED && !bPasswdProvided && IsUseThumbnailSave() ) { // store the thumbnail representation image // the thumbnail is not stored in case of encrypted document diff --git a/sfx2/source/inc/objshimp.hxx b/sfx2/source/inc/objshimp.hxx index f09730c0c622..6e2f568d28e5 100644 --- a/sfx2/source/inc/objshimp.hxx +++ b/sfx2/source/inc/objshimp.hxx @@ -89,6 +89,7 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess bQueryLoadTemplate:1, bLoadReadonly:1, bUseUserData:1, + bUseThumbnailSave:1, bSaveVersionOnClose:1, m_bSharedXMLFlag:1, // whether the flag should be stored in xml file m_bAllowShareControlFileClean:1, // whether the flag should be stored in xml file |