summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMihai Varga <mihai.mv13@gmail.com>2014-07-24 18:40:53 +0300
committerBosdonnat Cedric <cedric.bosdonnat@free.fr>2014-07-28 09:10:07 +0000
commitfc57915d1583c960f7574b5c4a67415854e974d1 (patch)
treec724c5382f697b9982af154cd12d490d635fbc2f
parentfb6e0da4d86ff71e523ab78156cc1938ef00d4db (diff)
Some properties in File->Properties->General Tab are not set for remote docs
This patch handles the case in which no meta information could be extracted from the file, so CMIS properties are displayed instead, if it is a CMIS document. Size and creation/modification dates are handled here. Change-Id: I97f920172b15a76297d78a33ac3a07a8333ef8a6 Reviewed-on: https://gerrit.libreoffice.org/10511 Reviewed-by: Bosdonnat Cedric <cedric.bosdonnat@free.fr> Tested-by: Bosdonnat Cedric <cedric.bosdonnat@free.fr>
-rw-r--r--sfx2/source/dialog/dinfdlg.cxx49
1 files changed, 49 insertions, 0 deletions
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index f0fc12efd1c7..8e89b02ca126 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -1098,6 +1098,55 @@ void SfxDocumentPage::Reset( const SfxItemSet* rSet )
m_pInfoItem->getEditingCycles() ) );
}
+ // Check for cmis properties where otherwise unavailable
+ if ( m_pInfoItem->isCmisDocument( ) )
+ {
+ uno::Sequence< document::CmisProperty > aCmisProps = m_pInfoItem->GetCmisProperties();
+ for ( sal_Int32 i = 0; i < aCmisProps.getLength(); i++ )
+ {
+ if ( aCmisProps[i].Id == "cmis:contentStreamLength" &&
+ aSizeText == m_aUnknownSize )
+ {
+ Sequence< sal_Int64 > seqValue;
+ aCmisProps[i].Value >>= seqValue;
+ SvNumberFormatter m_aNumberFormatter( ::comphelper::getProcessComponentContext(),
+ Application::GetSettings().GetLanguageTag().getLanguageType() );
+ sal_uInt32 nIndex = m_aNumberFormatter.GetFormatIndex( NF_NUMBER_SYSTEM );
+ if ( seqValue.getLength( ) > 0 )
+ {
+ OUString sValue;
+ m_aNumberFormatter.GetInputLineString( seqValue[0], nIndex, sValue );
+ m_pShowSizeFT->SetText( CreateSizeText( sValue.toInt64( ) ) );
+ }
+ }
+
+ util::DateTime uDT;
+ OUString emptyDate = ConvertDateTime_Impl( "", uDT, rLocaleWrapper );
+ if ( aCmisProps[i].Id == "cmis:creationDate" &&
+ m_pCreateValFt->GetText( ) == emptyDate ||
+ m_pCreateValFt->GetText( ).isEmpty( ) )
+ {
+ Sequence< util::DateTime > seqValue;
+ aCmisProps[i].Value >>= seqValue;
+ if ( seqValue.getLength( ) > 0 )
+ {
+ m_pCreateValFt->SetText( ConvertDateTime_Impl( "", seqValue[0], rLocaleWrapper ) );
+ }
+ }
+ if ( aCmisProps[i].Id == "cmis:lastModificationDate" &&
+ m_pChangeValFt->GetText( ) == emptyDate ||
+ m_pChangeValFt->GetText( ).isEmpty( ) )
+ {
+ Sequence< util::DateTime > seqValue;
+ aCmisProps[i].Value >>= seqValue;
+ if ( seqValue.getLength( ) > 0 )
+ {
+ m_pChangeValFt->SetText( ConvertDateTime_Impl( "", seqValue[0], rLocaleWrapper ) );
+ }
+ }
+ }
+ }
+
m_pUseUserDataCB->SetState( static_cast<TriState>(m_bUseUserData) );
m_pUseUserDataCB->SaveValue();
m_pUseUserDataCB->Enable( bEnableUseUserData );