[Libreoffice-commits] core.git: Branch 'feature/cmis' - 2 commits - include/sfx2 offapi/com offapi/UnoApi_offapi.mk sfx2/source ucb/source
Cao Cuong Ngo
cao.cuong.ngo at gmail.com
Mon Jun 17 10:39:05 PDT 2013
include/sfx2/dinfdlg.hxx | 27 +++--
include/sfx2/sfxbasemodel.hxx | 12 --
offapi/UnoApi_offapi.mk | 1
offapi/com/sun/star/document/CmisPropertyValue.idl | 57 +++++++++++
offapi/com/sun/star/document/XCmisDocument.idl | 8 -
sfx2/source/dialog/dinfdlg.cxx | 103 ++++++++++++++++-----
sfx2/source/doc/objserv.cxx | 6 -
sfx2/source/doc/sfxbasemodel.cxx | 31 +-----
sfx2/source/view/sfxbasecontroller.cxx | 2
ucb/source/ucp/cmis/cmis_content.cxx | 39 ++-----
10 files changed, 181 insertions(+), 105 deletions(-)
New commits:
commit 69ea6d0890984274983ff2a7370d3f355b6aa32a
Author: Cao Cuong Ngo <cao.cuong.ngo at gmail.com>
Date: Mon Jun 17 15:17:00 2013 +0200
CMIS properties
Create a CmisPropertyValue with additional DisplayName,
Updatable and Required properties.
Change-Id: Ia20d76a739ac5c51d7c89ef6f1a40a299697cb0e
diff --git a/include/sfx2/dinfdlg.hxx b/include/sfx2/dinfdlg.hxx
index 3830c46..9edaf7d 100644
--- a/include/sfx2/dinfdlg.hxx
+++ b/include/sfx2/dinfdlg.hxx
@@ -24,6 +24,7 @@
#include <com/sun/star/util/DateTime.hpp>
#include <com/sun/star/util/Duration.hpp>
+#include <com/sun/star/document/CmisPropertyValue.hpp>
#include <svl/stritem.hxx>
#include <svl/zforlist.hxx>
@@ -49,6 +50,7 @@ namespace com { namespace sun { namespace star {
} } }
struct CustomProperty;
+struct CmisProperty;
// class SfxDocumentInfoItem ---------------------------------------------
@@ -76,8 +78,8 @@ private:
sal_Bool m_bHasTemplate;
sal_Bool m_bDeleteUserData;
sal_Bool m_bUseUserData;
- std::vector< CustomProperty* > m_aCustomProperties;
- std::vector< CustomProperty* > m_aCmisProperties;
+ std::vector< CustomProperty* > m_aCustomProperties;
+ std::vector< CmisProperty* > m_aCmisProperties;
public:
TYPEINFO();
@@ -86,7 +88,7 @@ public:
const ::com::sun::star::uno::Reference<
::com::sun::star::document::XDocumentProperties> & i_xDocProps,
const ::com::sun::star::uno::Sequence<
- ::com::sun::star::beans::PropertyValue> & i_cmisProps,
+ ::com::sun::star::document::CmisPropertyValue> & i_cmisProps,
sal_Bool bUseUserData );
SfxDocumentInfoItem( const SfxDocumentInfoItem& );
virtual ~SfxDocumentInfoItem();
@@ -159,10 +161,11 @@ public:
void AddCustomProperty( const OUString& sName,
const com::sun::star::uno::Any& rValue );
- std::vector< CustomProperty* > GetCmisProperties() const;
+ std::vector< CmisProperty* > GetCmisProperties() const;
void ClearCmisProperties();
- void AddCmisProperty( const OUString& sName,
- const com::sun::star::uno::Any& rValue );
+ void AddCmisProperty( const OUString& sId, const OUString& sName,
+ const bool bUpdatable, const bool bRequired,
+ const com::sun::star::uno::Any& rValue );
virtual SfxPoolItem* Clone( SfxItemPool* pPool = NULL ) const;
virtual int operator==( const SfxPoolItem& ) const;
@@ -624,12 +627,14 @@ public:
void InitControls( HeaderBar* pHeaderBar, const ScrollBar* pScrollBar );
sal_uInt16 GetLineCount() const;
inline sal_Int32 GetLineHeight() const { return m_nLineHeight; }
- void AddLine( const OUString& sName, com::sun::star::uno::Any& rAny );
+ void AddLine( const OUString& sId, const OUString& sName,
+ const bool bUpdatable, const bool bRequired,
+ com::sun::star::uno::Any& rAny );
bool AreAllLinesValid() const;
void ClearAllLines();
void DoScroll( sal_Int32 nNewPos );
- ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
+ ::com::sun::star::uno::Sequence< ::com::sun::star::document::CmisPropertyValue >
GetCmisProperties() const;
void updateLineWidth();
};
@@ -651,11 +656,13 @@ public:
CmisPropertiesControl(Window* pParent);
~CmisPropertiesControl();
- void AddLine( const OUString& sName, com::sun::star::uno::Any& rAny, bool bInteractive );
+ void AddLine( const OUString& sId, const OUString& sName,
+ const bool bUpdatable, const bool bRequired,
+ com::sun::star::uno::Any& rAny, bool bInteractive );
inline bool AreAllLinesValid() const { return m_pPropertiesWin->AreAllLinesValid(); }
inline void ClearAllLines() { m_pPropertiesWin->ClearAllLines(); }
- inline ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
+ inline ::com::sun::star::uno::Sequence< ::com::sun::star::document::CmisPropertyValue >
GetCmisProperties() const
{ return m_pPropertiesWin->GetCmisProperties(); }
void Init(VclBuilderContainer& rParent);
diff --git a/include/sfx2/sfxbasemodel.hxx b/include/sfx2/sfxbasemodel.hxx
index 524c86b..37abb06 100644
--- a/include/sfx2/sfxbasemodel.hxx
+++ b/include/sfx2/sfxbasemodel.hxx
@@ -63,6 +63,7 @@
#include <com/sun/star/frame/XStorable2.hpp>
#include <com/sun/star/frame/XLoadable.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/document/CmisPropertyValue.hpp>
#include <com/sun/star/lang/EventObject.hpp>
#include <com/sun/star/datatransfer/XTransferable.hpp>
#include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
@@ -1307,19 +1308,12 @@ public:
// XCmisDocument
- virtual css::uno::Sequence< css::beans::PropertyValue >
+ virtual css::uno::Sequence< css::document::CmisPropertyValue >
SAL_CALL getCmisPropertiesValues()
throw (css::uno::RuntimeException);
virtual void SAL_CALL setCmisPropertiesValues(
const css::uno::Sequence<
- css::beans::PropertyValue >& _cmispropertiesvalues )
- throw (css::uno::RuntimeException);
- virtual css::uno::Sequence< css::beans::PropertyValue >
- SAL_CALL getCmisPropertiesDisplayNames()
- throw (css::uno::RuntimeException);
- virtual void SAL_CALL setCmisPropertiesDisplayNames(
- const css::uno::Sequence<
- css::beans::PropertyValue >& _cmispropertiesdisplaynames )
+ css::document::CmisPropertyValue >& _cmispropertiesvalues )
throw (css::uno::RuntimeException);
virtual void SAL_CALL checkOut( ) throw ( css::uno::RuntimeException );
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index dcaf757..ae31d36 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -2174,6 +2174,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/document,\
AmbigousFilterRequest \
BrokenPackageRequest \
ChangedByOthersRequest \
+ CmisPropertyValue \
CorruptedFilterConfigurationException \
DocumentEvent \
EmptyUndoStackException \
diff --git a/offapi/com/sun/star/document/CmisPropertyValue.idl b/offapi/com/sun/star/document/CmisPropertyValue.idl
new file mode 100644
index 0000000..f60bb6d
--- /dev/null
+++ b/offapi/com/sun/star/document/CmisPropertyValue.idl
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef __com_sun_star_document_CmisPropertyValue_idl__
+#define __com_sun_star_document_CmisPropertyValue_idl__
+
+#include <com/sun/star/beans/PropertyValue.idl>
+
+module com { module sun { module star { module document {
+
+/** specifies a CMIS property value.
+ */
+struct CmisPropertyValue
+{
+ /** unique ID of the Cmis property
+ */
+ string Id;
+
+ /** specifies the display name of the CMIS property.
+ */
+ string Name;
+
+ /** specifies if the property is updatable.
+ */
+ boolean Updatable;
+
+ /** specifies if the property is required and
+ can not be empty.
+ */
+ boolean Required;
+
+ /** specifies value of the property
+ */
+ any Value;
+};
+
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/document/XCmisDocument.idl b/offapi/com/sun/star/document/XCmisDocument.idl
index d1a94f9..66e478a 100644
--- a/offapi/com/sun/star/document/XCmisDocument.idl
+++ b/offapi/com/sun/star/document/XCmisDocument.idl
@@ -9,7 +9,7 @@
#ifndef __com_sun_star_document_XCmisDocument_idl__
#define __com_sun_star_document_XCmisDocument_idl__
-#include <com/sun/star/beans/PropertyValues.idl>
+#include <com/sun/star/document/CmisPropertyValue.idl>
#include <com/sun/star/uno/XInterface.idl>
module com { module sun { module star { module document {
@@ -46,11 +46,7 @@ interface XCmisDocument : com::sun::star::uno::XInterface
/** Contains the properties values named after their CMIS ID.
*/
- [attribute] com::sun::star::beans::PropertyValues CmisPropertiesValues;
-
- /** Contains the property names to show to the user from their CMIS id.
- */
- [attribute] com::sun::star::beans::PropertyValues CmisPropertiesDisplayNames;
+ [attribute] sequence <com::sun::star::document::CmisPropertyValue> CmisPropertiesValues;
};
}; }; }; };
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 20f22b0..0fbbbb4 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -44,6 +44,7 @@
#include <com/sun/star/util/Time.hpp>
#include <com/sun/star/util/Duration.hpp>
#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/document/CmisPropertyValue.hpp>
#include <vcl/timer.hxx>
#include "sfx2/dinfdlg.hxx"
@@ -90,6 +91,35 @@ struct CustomProperty
{ return m_sName.equals( rProp.m_sName ) && m_aValue == rProp.m_aValue; }
};
+struct CmisProperty
+{
+ OUString m_sId;
+ OUString m_sName;
+ bool m_bUpdatable;
+ bool m_bRequired;
+ com::sun::star::uno::Any m_aValue;
+
+ CmisProperty( const OUString& sId,
+ const OUString& sName,
+ const bool bUpdatable,
+ const bool bRequired,
+ const com::sun::star::uno::Any& rValue ) :
+ m_sId( sId ),
+ m_sName( sName ),
+ m_bUpdatable( bUpdatable ),
+ m_bRequired( bRequired ),
+ m_aValue( rValue )
+ {}
+
+ inline bool operator==( const CmisProperty& rProp )
+ { return m_sId.equals( rProp.m_sId )
+ && m_sName == rProp.m_sName
+ && m_bUpdatable == rProp.m_bUpdatable
+ && m_bRequired == rProp.m_bRequired
+ && m_aValue == rProp.m_aValue;
+ }
+};
+
static
bool operator==(const util::DateTime &i_rLeft, const util::DateTime &i_rRight)
{
@@ -220,7 +250,7 @@ SfxDocumentInfoItem::SfxDocumentInfoItem()
SfxDocumentInfoItem::SfxDocumentInfoItem( const String& rFile,
const uno::Reference<document::XDocumentProperties>& i_xDocProps,
- const uno::Sequence<beans::PropertyValue>& i_cmisProps,
+ const uno::Sequence<document::CmisPropertyValue>& i_cmisProps,
sal_Bool bIs )
: SfxStringItem( SID_DOCINFO, rFile )
, m_AutoloadDelay( i_xDocProps->getAutoloadSecs() )
@@ -272,7 +302,11 @@ SfxDocumentInfoItem::SfxDocumentInfoItem( const String& rFile,
for ( sal_Int32 i = 0; i < i_cmisProps.getLength(); ++i )
{
- CustomProperty* pProp = new CustomProperty( i_cmisProps[i].Name, i_cmisProps[i].Value );
+ CmisProperty* pProp = new CmisProperty( i_cmisProps[i].Id,
+ i_cmisProps[i].Name,
+ i_cmisProps[i].Updatable,
+ i_cmisProps[i].Required,
+ i_cmisProps[i].Value );
m_aCmisProperties.push_back( pProp );
}
}
@@ -312,8 +346,11 @@ SfxDocumentInfoItem::SfxDocumentInfoItem( const SfxDocumentInfoItem& rItem )
}
for ( sal_uInt32 i = 0; i < rItem.m_aCmisProperties.size(); i++ )
{
- CustomProperty* pProp = new CustomProperty( rItem.m_aCmisProperties[i]->m_sName,
- rItem.m_aCmisProperties[i]->m_aValue );
+ CmisProperty* pProp = new CmisProperty( rItem.m_aCmisProperties[i]->m_sId,
+ rItem.m_aCmisProperties[i]->m_sName,
+ rItem.m_aCmisProperties[i]->m_bUpdatable,
+ rItem.m_aCmisProperties[i]->m_bRequired,
+ rItem.m_aCmisProperties[i]->m_aValue );
m_aCmisProperties.push_back( pProp );
}
}
@@ -500,13 +537,16 @@ void SfxDocumentInfoItem::AddCustomProperty( const OUString& sName, const Any& r
}
-std::vector< CustomProperty* > SfxDocumentInfoItem::GetCmisProperties() const
+std::vector< CmisProperty* > SfxDocumentInfoItem::GetCmisProperties() const
{
- std::vector< CustomProperty* > aRet;
+ std::vector< CmisProperty* > aRet;
for ( sal_uInt32 i = 0; i < m_aCmisProperties.size(); i++ )
{
- CustomProperty* pProp = new CustomProperty( m_aCmisProperties[i]->m_sName,
- m_aCmisProperties[i]->m_aValue );
+ CmisProperty* pProp = new CmisProperty( m_aCmisProperties[i]->m_sId,
+ m_aCmisProperties[i]->m_sName,
+ m_aCmisProperties[i]->m_bUpdatable,
+ m_aCmisProperties[i]->m_bRequired,
+ m_aCmisProperties[i]->m_aValue );
aRet.push_back( pProp );
}
@@ -520,9 +560,14 @@ void SfxDocumentInfoItem::ClearCmisProperties()
m_aCmisProperties.clear();
}
-void SfxDocumentInfoItem::AddCmisProperty( const OUString& sName, const Any& rValue )
+void SfxDocumentInfoItem::AddCmisProperty( const OUString& sId,
+ const OUString& sName,
+ const bool bUpdatable,
+ const bool bRequired,
+ const Any& rValue )
{
- CustomProperty* pProp = new CustomProperty( sName, rValue );
+ CmisProperty* pProp = new CmisProperty( sId, sName, bUpdatable,
+ bRequired, rValue );
m_aCmisProperties.push_back( pProp );
}
@@ -2371,7 +2416,9 @@ void CmisPropertiesWindow::updateLineWidth()
}
}
-void CmisPropertiesWindow::AddLine( const OUString& sName, Any& rAny )
+void CmisPropertiesWindow::AddLine( const OUString& /*sId*/, const OUString& sName,
+ const bool /*bUpdatable*/, const bool /*bRequired*/,
+ Any& rAny )
{
CmisPropertyLine* pNewLine = new CmisPropertyLine( this );
pNewLine->m_aValueEdit.SetLoseFocusHdl( LINK( this, CmisPropertiesWindow, EditLoseFocusHdl ) );
@@ -2523,9 +2570,9 @@ void CmisPropertiesWindow::DoScroll( sal_Int32 nNewPos )
}
}
-Sequence< beans::PropertyValue > CmisPropertiesWindow::GetCmisProperties() const
+Sequence< document::CmisPropertyValue > CmisPropertiesWindow::GetCmisProperties() const
{
- Sequence< beans::PropertyValue > aPropertiesSeq( m_aCmisPropertiesLines.size() );
+ Sequence< document::CmisPropertyValue > aPropertiesSeq( m_aCmisPropertiesLines.size() );
sal_Int32 i = 0;
std::vector< CmisPropertyLine* >::const_iterator pIter;
for ( pIter = m_aCmisPropertiesLines.begin();
@@ -2663,11 +2710,14 @@ IMPL_LINK( CmisPropertiesControl, ScrollHdl, ScrollBar*, pScrollBar )
}
-void CmisPropertiesControl::AddLine( const OUString& sName, Any& rAny, bool bInteractive )
+void CmisPropertiesControl::AddLine( const OUString& sId, const OUString& sName,
+ const bool bUpdatable, const bool bRequired,
+ Any& rAny, bool bInteractive )
{
- m_pPropertiesWin->AddLine( sName, rAny );
+ m_pPropertiesWin->AddLine( sId, sName, bUpdatable, bRequired, rAny );
m_pVertScroll->SetRangeMax( m_pPropertiesWin->GetLineCount() + 1 );
- if ( bInteractive && m_pPropertiesWin->GetOutputSizePixel().Height() < m_pPropertiesWin->GetLineCount() * m_pPropertiesWin->GetLineHeight() )
+ if ( bInteractive && m_pPropertiesWin->GetOutputSizePixel().Height() <
+ m_pPropertiesWin->GetLineCount() * m_pPropertiesWin->GetLineHeight() )
m_pVertScroll->DoScroll( m_pPropertiesWin->GetLineCount() + 1 );
}
@@ -2701,12 +2751,16 @@ sal_Bool SfxCmisPropertiesPage::FillItemSet( SfxItemSet& rSet )
if ( pInfo )
{
pInfo->ClearCmisProperties();
- Sequence< beans::PropertyValue > aPropertySeq = m_pPropertiesCtrl->GetCmisProperties();
+ Sequence< document::CmisPropertyValue > aPropertySeq = m_pPropertiesCtrl->GetCmisProperties();
sal_Int32 i = 0, nCount = aPropertySeq.getLength();
for ( ; i < nCount; ++i )
{
if ( !aPropertySeq[i].Name.isEmpty() )
- pInfo->AddCmisProperty( aPropertySeq[i].Name, aPropertySeq[i].Value );
+ pInfo->AddCmisProperty( aPropertySeq[i].Id,
+ aPropertySeq[i].Name,
+ aPropertySeq[i].Updatable,
+ aPropertySeq[i].Required,
+ aPropertySeq[i].Value );
}
}
@@ -2720,10 +2774,14 @@ void SfxCmisPropertiesPage::Reset( const SfxItemSet& rItemSet )
{
m_pPropertiesCtrl->ClearAllLines();
const SfxDocumentInfoItem* m_pInfoItem = &(const SfxDocumentInfoItem &)rItemSet.Get(SID_DOCINFO);
- std::vector< CustomProperty* > aCmisProps = m_pInfoItem->GetCmisProperties();
+ std::vector< CmisProperty* > aCmisProps = m_pInfoItem->GetCmisProperties();
for ( sal_uInt32 i = 0; i < aCmisProps.size(); i++ )
{
- m_pPropertiesCtrl->AddLine( aCmisProps[i]->m_sName, aCmisProps[i]->m_aValue, false );
+ m_pPropertiesCtrl->AddLine( aCmisProps[i]->m_sId,
+ aCmisProps[i]->m_sName,
+ aCmisProps[i]->m_bUpdatable,
+ aCmisProps[i]->m_bRequired,
+ aCmisProps[i]->m_aValue, false );
}
}
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 43fb024..1647a89 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -492,7 +492,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
}
Reference< XCmisDocument > xCmisDoc( GetModel(), uno::UNO_QUERY );
- beans::PropertyValues aCmisProperties = xCmisDoc->getCmisPropertiesValues();
+ uno::Sequence< document::CmisPropertyValue> aCmisProperties = xCmisDoc->getCmisPropertiesValues();
SfxDocumentInfoItem aDocInfoItem( aURL, getDocProperties(), aCmisProperties,
IsUseUserData() );
@@ -940,7 +940,7 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet)
{
bool bShow = false;
Reference< XCmisDocument > xCmisDoc( GetModel(), uno::UNO_QUERY );
- beans::PropertyValues aCmisProperties = xCmisDoc->getCmisPropertiesValues();
+ uno::Sequence< document::CmisPropertyValue> aCmisProperties = xCmisDoc->getCmisPropertiesValues();
if ( xCmisDoc->isVersionable( ) && aCmisProperties.hasElements( ) )
{
@@ -971,7 +971,7 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet)
{
bool bShow = false;
Reference< XCmisDocument > xCmisDoc( GetModel(), uno::UNO_QUERY );
- beans::PropertyValues aCmisProperties = xCmisDoc->getCmisPropertiesValues( );
+ uno::Sequence< document::CmisPropertyValue> aCmisProperties = xCmisDoc->getCmisPropertiesValues( );
if ( xCmisDoc->isVersionable( ) && aCmisProperties.hasElements( ) )
{
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index d5d5814..794f32e 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -122,6 +122,7 @@
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using ::com::sun::star::beans::PropertyValue;
+using ::com::sun::star::document::CmisPropertyValue;
using ::com::sun::star::frame::XFrame;
using ::com::sun::star::frame::XController;
using ::com::sun::star::frame::XController2;
@@ -213,9 +214,7 @@ struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument
Reference< frame::XUntitledNumbers > m_xNumberedControllers;
Reference< rdf::XDocumentMetadataAccess> m_xDocumentMetadata;
::rtl::Reference< ::sfx2::DocumentUndoManager > m_pDocumentUndoManager;
- Sequence< beans::PropertyValue> m_cmisPropertiesValues;
- Sequence< beans::PropertyValue> m_cmisPropertiesDisplayNames;
-
+ Sequence< document::CmisPropertyValue> m_cmisPropertiesValues;
IMPL_SfxBaseModel_DataContainer( ::osl::Mutex& rMutex, SfxObjectShell* pObjectShell )
: m_pObjectShell ( pObjectShell )
@@ -234,7 +233,6 @@ struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument
, m_xDocumentMetadata () // lazy
, m_pDocumentUndoManager ()
, m_cmisPropertiesValues ()
- , m_cmisPropertiesDisplayNames ()
{
// increase global instance counter.
++g_nInstanceCounter;
@@ -2466,30 +2464,18 @@ void SAL_CALL SfxBaseModel::notifyDocumentEvent( const OUString&, const Referenc
throw lang::NoSupportException( OUString( "SfxBaseModel controlls all the sent notifications itself!" ), Reference< XInterface >() );
}
-Sequence< beans::PropertyValue > SAL_CALL SfxBaseModel::getCmisPropertiesValues()
+Sequence< document::CmisPropertyValue > SAL_CALL SfxBaseModel::getCmisPropertiesValues()
throw ( RuntimeException )
{
return m_pData->m_cmisPropertiesValues;
}
-void SAL_CALL SfxBaseModel::setCmisPropertiesValues( const Sequence< beans::PropertyValue >& _cmispropertiesvalues )
+void SAL_CALL SfxBaseModel::setCmisPropertiesValues( const Sequence< document::CmisPropertyValue >& _cmispropertiesvalues )
throw ( RuntimeException )
{
m_pData->m_cmisPropertiesValues = _cmispropertiesvalues;
}
-Sequence< beans::PropertyValue > SAL_CALL SfxBaseModel::getCmisPropertiesDisplayNames()
- throw ( RuntimeException )
-{
- return m_pData->m_cmisPropertiesDisplayNames;
-}
-
-void SAL_CALL SfxBaseModel::setCmisPropertiesDisplayNames( const Sequence< beans::PropertyValue >& _cmispropertiesdisplaynames )
- throw ( RuntimeException )
-{
- m_pData->m_cmisPropertiesDisplayNames = _cmispropertiesdisplaynames;
-}
-
void SAL_CALL SfxBaseModel::checkOut( ) throw ( RuntimeException )
{
SfxMedium* pMedium = m_pData->m_pObjectShell->GetMedium();
@@ -2654,19 +2640,12 @@ void SfxBaseModel::loadCmisProperties( )
comphelper::getProcessComponentContext() );
Reference < beans::XPropertySetInfo > xProps = aContent.getProperties();
OUString aCmisPropsValues( "CmisPropertiesValues" );
- OUString aCmisPropsNames( "CmisPropertiesDisplayNames" );
if ( xProps->hasPropertyByName( aCmisPropsValues ) )
{
- beans::PropertyValues aCmisValues;
+ Sequence< document::CmisPropertyValue> aCmisValues;
aContent.getPropertyValue( aCmisPropsValues ) >>= aCmisValues;
setCmisPropertiesValues( aCmisValues );
}
- if ( xProps->hasPropertyByName( aCmisPropsNames ) )
- {
- beans::PropertyValues aPropNames;
- aContent.getPropertyValue( aCmisPropsNames ) >>= aPropNames;
- setCmisPropertiesDisplayNames( aPropNames );
- }
}
catch (const ucb::ContentCreationException &)
{
diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx
index 9816437..2beec0f 100644
--- a/sfx2/source/view/sfxbasecontroller.cxx
+++ b/sfx2/source/view/sfxbasecontroller.cxx
@@ -1430,7 +1430,7 @@ void SfxBaseController::ShowInfoBars( )
Reference< document::XCmisDocument > xCmisDoc( m_pData->m_pViewShell->GetObjectShell()->GetModel(), uno::UNO_QUERY );
if ( xCmisDoc.is( ) && xCmisDoc->canCheckOut( ) )
{
- beans::PropertyValues aCmisProperties = xCmisDoc->getCmisPropertiesValues( );
+ uno::Sequence< document::CmisPropertyValue> aCmisProperties = xCmisDoc->getCmisPropertiesValues( );
if ( xCmisDoc->isVersionable( ) && aCmisProperties.hasElements( ) )
{
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index f15d4c1..2465ffb 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -16,6 +16,7 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/PropertyValues.hpp>
#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/document/CmisPropertyValue.hpp>
#include <com/sun/star/io/XActiveDataSink.hpp>
#include <com/sun/star/io/XActiveDataStreamer.hpp>
#include <com/sun/star/lang/IllegalAccessException.hpp>
@@ -580,14 +581,20 @@ namespace cmis
{
libcmis::ObjectPtr object = getObject( xEnv );
map< string, libcmis::PropertyPtr >& aProperties = object->getProperties( );
- beans::PropertyValues aCmisProperties( aProperties.size( ) );
- beans::PropertyValue* pCmisProps = aCmisProperties.getArray( );
+ uno::Sequence< document::CmisPropertyValue > aCmisProperties( aProperties.size( ) );
+ document::CmisPropertyValue* pCmisProps = aCmisProperties.getArray( );
sal_Int32 i = 0;
for ( map< string, libcmis::PropertyPtr >::iterator it = aProperties.begin();
it != aProperties.end( ); ++it, ++i )
{
- string name = it->first;
- pCmisProps[i].Name = STD_TO_OUSTR( name );
+ string sId = it->first;
+ string sDisplayName = it->second->getPropertyType()->getDisplayName( );
+ bool isUpdatable = it->second->getPropertyType()->isUpdatable( );
+ bool isRequired = it->second->getPropertyType()->isRequired( );
+ pCmisProps[i].Id = STD_TO_OUSTR( sId );
+ pCmisProps[i].Name = STD_TO_OUSTR( sDisplayName );
+ pCmisProps[i].Updatable = isUpdatable;
+ pCmisProps[i].Required = isRequired;
pCmisProps[i].Value = lcl_cmisPropertyToUno( it->second );
}
xRow->appendObject( rProp.Name, uno::makeAny( aCmisProperties ) );
@@ -597,30 +604,6 @@ namespace cmis
xRow->appendVoid( rProp );
}
}
- else if ( rProp.Name == "CmisPropertiesDisplayNames" )
- {
- try
- {
- libcmis::ObjectPtr object = getObject( xEnv );
- map< string, libcmis::PropertyPtr >& aProperties = object->getProperties( );
- beans::PropertyValues aCmisProperties( aProperties.size( ) );
- beans::PropertyValue* pCmisProps = aCmisProperties.getArray( );
- sal_Int32 i = 0;
- for ( map< string, libcmis::PropertyPtr >::iterator it = aProperties.begin();
- it != aProperties.end( ); ++it, ++i )
- {
- string name = it->first;
- string displayName = it->second->getPropertyType()->getDisplayName( );
- pCmisProps[i].Name = STD_TO_OUSTR( name );
- pCmisProps[i].Value = uno::makeAny( STD_TO_OUSTR( displayName ) );
- }
- xRow->appendObject( rProp.Name, uno::makeAny( aCmisProperties ) );
- }
- catch ( const libcmis::Exception& )
- {
- xRow->appendVoid( rProp );
- }
- }
else if ( rProp.Name == "IsVersionable" )
{
try
commit d134524802e62772346c1caa4a09cd9634874610
Author: Cao Cuong Ngo <cao.cuong.ngo at gmail.com>
Date: Mon Jun 17 10:35:37 2013 +0200
CMIS properties dialog
Fixed type width
Change-Id: I0afbfcb33539533269f2867972a8ab71e6dadef7
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 8f148dc..20f22b0 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -2173,7 +2173,7 @@ void CmisPropertiesYesNoButton::Resize()
// struct CmisPropertyLine ---------------------------------------------
CmisPropertyLine::CmisPropertyLine( Window* pParent ) :
- m_aName ( pParent, SfxResId( SFX_CMIS_PROPERTY_TYPE ) ),
+ m_aName ( pParent, SfxResId( SFX_CMIS_PROPERTY_NAME ) ),
m_aType ( pParent, SfxResId( SFX_CMIS_PROPERTY_TYPE ) ),
m_aValueEdit ( pParent, SfxResId( SFX_CMIS_ED_PROPERTY_VALUE ), this ),
m_aDateField ( pParent, SfxResId( SFX_CMIS_FLD_DATE), this),
@@ -2291,7 +2291,8 @@ void CmisPropertiesWindow::InitControls( HeaderBar* pHeaderBar, const ScrollBar*
const long nOffset = 4;
const long nScrollBarWidth = pScrollBar->GetSizePixel().Width();
const long nButtonWidth = nScrollBarWidth + nOffset;
- long nTypeWidth = m_aType.CalcMinimumSize().Width() + ( 2 * nOffset );
+ long nTypeWidth = m_aValueEdit.CalcMinimumSizeForText( CMIS_TYPE_DATETIME ).Width( )
+ + ( 2 * nOffset );
long nFullWidth = pHeaderBar->GetSizePixel().Width();
long nItemWidth = ( nFullWidth - nTypeWidth - nButtonWidth ) / 2;
pHeaderBar->SetItemSize( HI_NAME, nItemWidth );
More information about the Libreoffice-commits
mailing list