summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbureken <berkgureken@gmail.com>2015-10-26 03:39:00 +0300
committerCaolán McNamara <caolanm@redhat.com>2015-11-10 12:24:10 +0000
commitd7ca71d4b1ac085c575fdc24f37940100ab38961 (patch)
treea5cbfd3f2de13ff89da6bf89da26276011c62001
parent37968fd404ca04333502921e5560f893c7933888 (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>
-rw-r--r--include/sfx2/dinfdlg.hxx7
-rw-r--r--include/sfx2/objsh.hxx2
-rw-r--r--include/sfx2/sfx.hrc1
-rw-r--r--sfx2/source/dialog/dinfdlg.cxx40
-rw-r--r--sfx2/source/doc/objcont.cxx12
-rw-r--r--sfx2/source/doc/objserv.cxx6
-rw-r--r--sfx2/source/doc/objstor.cxx2
-rw-r--r--sfx2/source/inc/objshimp.hxx1
-rw-r--r--sfx2/uiconfig/ui/documentinfopage.ui19
9 files changed, 85 insertions, 5 deletions
diff --git a/include/sfx2/dinfdlg.hxx b/include/sfx2/dinfdlg.hxx
index 1d3ef7a7677a..faf6494bd920 100644
--- a/include/sfx2/dinfdlg.hxx
+++ b/include/sfx2/dinfdlg.hxx
@@ -81,6 +81,7 @@ private:
bool m_bHasTemplate;
bool m_bDeleteUserData;
bool m_bUseUserData;
+ bool m_bUseThumbnailSave;
std::vector< CustomProperty* > m_aCustomProperties;
css::uno::Sequence< css::document::CmisProperty > m_aCmisProperties;
@@ -90,7 +91,7 @@ public:
SfxDocumentInfoItem( const OUString &rFileName,
const css::uno::Reference< css::document::XDocumentProperties> & i_xDocProps,
const css::uno::Sequence< css::document::CmisProperty> & i_cmisProps,
- bool bUseUserData );
+ bool bUseUserData, bool bUseThumbnailSave );
SfxDocumentInfoItem( const SfxDocumentInfoItem& );
virtual ~SfxDocumentInfoItem();
@@ -153,8 +154,11 @@ public:
bool HasTemplate() const { return m_bHasTemplate; }
void SetDeleteUserData( bool bSet );
void SetUseUserData( bool bSet );
+ void SetUseThumbnailSave( bool bSet );
bool IsDeleteUserData() const { return m_bDeleteUserData;}
bool IsUseUserData() const { return m_bUseUserData;}
+ bool IsUseThumbnailSave() const { return m_bUseThumbnailSave;}
+
std::vector< CustomProperty* > GetCustomProperties() const;
void ClearCustomProperties();
@@ -194,6 +198,7 @@ private:
VclPtr<CheckBox> m_pUseUserDataCB;
VclPtr<PushButton> m_pDeleteBtn;
+ VclPtr<CheckBox> m_pUseThumbnailSaveCB;
VclPtr<FixedText> m_pTemplFt;
VclPtr<SelectableFixedText> m_pTemplValFt;
diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx
index 70da01048542..fed9399ed8a3 100644
--- a/include/sfx2/objsh.hxx
+++ b/include/sfx2/objsh.hxx
@@ -422,10 +422,12 @@ public:
bool IsQueryLoadTemplate() const;
bool IsUseUserData() const;
+ bool IsUseThumbnailSave() const;
bool IsLoadReadonly() const;
bool IsSaveVersionOnClose() const;
void SetQueryLoadTemplate( bool b );
void SetUseUserData( bool bNew );
+ void SetUseThumbnailSave( bool _bNew );
void SetLoadReadonly( bool _bReadonly );
void SetSaveVersionOnClose( bool bSet );
void ResetFromTemplate( const OUString& rTemplateName, const OUString& rFileName );
diff --git a/include/sfx2/sfx.hrc b/include/sfx2/sfx.hrc
index 4f63e5262607..582ad1ebeb44 100644
--- a/include/sfx2/sfx.hrc
+++ b/include/sfx2/sfx.hrc
@@ -228,6 +228,7 @@
#define MID_DOCINFO_DEFAULTTARGET 0x30
#define MID_DOCINFO_USEUSERDATA 0x31
#define MID_DOCINFO_DELETEUSERDATA 0x32
+#define MID_DOCINFO_USETHUMBNAILSAVE 0x33
// only for FastPropertySet
#define MID_TYPE 0x38
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
diff --git a/sfx2/uiconfig/ui/documentinfopage.ui b/sfx2/uiconfig/ui/documentinfopage.ui
index 633ffa18c5f8..e8863b180e16 100644
--- a/sfx2/uiconfig/ui/documentinfopage.ui
+++ b/sfx2/uiconfig/ui/documentinfopage.ui
@@ -216,6 +216,25 @@
</packing>
</child>
<child>
+ <object class="GtkCheckButton" id="thumbnailsavecb">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Save preview picture with this document</property>
+ <property name="use_action_appearance">False</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="no_show_all">True</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">13</property>
+ <property name="width">2</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkButton" id="reset">
<property name="label" translatable="yes">Reset Properties</property>
<property name="use_action_appearance">False</property>