[Libreoffice-commits] core.git: sfx2/source

Mihai Varga mihai.mv13 at gmail.com
Mon Jul 28 02:10:37 PDT 2014


 sfx2/source/dialog/dinfdlg.cxx |   49 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

New commits:
commit fc57915d1583c960f7574b5c4a67415854e974d1
Author: Mihai Varga <mihai.mv13 at gmail.com>
Date:   Thu Jul 24 18:40:53 2014 +0300

    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 at free.fr>
    Tested-by: Bosdonnat Cedric <cedric.bosdonnat at free.fr>

diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index f0fc12e..8e89b02 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 );


More information about the Libreoffice-commits mailing list