Kaydet (Commit) eb23b2d9 authored tarafından Cao Cuong Ngo's avatar Cao Cuong Ngo Kaydeden (comit) Cédric Bosdonnat

CMIS properties: Add type to the UNO API

Change-Id: Ie4f32bc840cdfab1d5f600991cd6ac8aabcb1f87
üst 96d4c535
......@@ -584,6 +584,7 @@ public:
struct CmisPropertyLine
{
OUString m_sId;
OUString m_sType;
bool m_bUpdatable;
bool m_bRequired;
bool m_bMultiValued;
......@@ -638,8 +639,9 @@ public:
sal_uInt16 GetLineCount() const;
inline sal_Int32 GetLineHeight() const { return m_nLineHeight; }
void AddLine( const OUString& sId, const OUString& sName,
const bool bUpdatable, const bool bRequired,
const bool bMultiValued, const bool bOpenChoice,
const OUString& sType, const bool bUpdatable,
const bool bRequired, const bool bMultiValued,
const bool bOpenChoice,
com::sun::star::uno::Any& aChoices,
com::sun::star::uno::Any& rAny );
bool AreAllLinesValid() const;
......@@ -669,8 +671,9 @@ public:
~CmisPropertiesControl();
void AddLine( const OUString& sId, const OUString& sName,
const bool bUpdatable, const bool bRequired,
const bool bMultiValude, const bool bOpenChoice,
const OUString& sType, const bool bUpdatable,
const bool bRequired, const bool bMultiValude,
const bool bOpenChoice,
com::sun::star::uno::Any& aChoices,
com::sun::star::uno::Any& rAny, bool bInteractive );
......
......@@ -33,6 +33,10 @@ struct CmisProperty
*/
string Name;
/** type of the property
*/
string Type;
/** specifies if the property is updatable.
*/
boolean Updatable;
......
This diff is collapsed.
......@@ -31,11 +31,11 @@
#define CUSTOM_TYPE_DURATION 5
#define CUSTOM_TYPE_DATETIME 6
#define CMIS_TYPE_ANY "Any"
#define CMIS_TYPE_STRING "String"
#define CMIS_TYPE_NUMBER "Number"
#define CMIS_TYPE_INTEGER "Integer"
#define CMIS_TYPE_DECIMAL "Decimal"
#define CMIS_TYPE_DATETIME "Datetime"
#define CMIS_TYPE_BOOLEAN "Boolean"
#define CMIS_TYPE_BOOL "Bool"
// defines ---------------------------------------------------------------
......
......@@ -47,6 +47,7 @@
#include "cmis_provider.hxx"
#include "cmis_resultset.hxx"
#include "cmis_oauth2_providers.hxx"
#include "cmis_strings.hxx"
#define OUSTR_TO_STDSTR(s) string( OUStringToOString( s, RTL_TEXTENCODING_UTF8 ).getStr() )
#define STD_TO_OUSTR( str ) OUString( str.c_str(), str.length( ), RTL_TEXTENCODING_UTF8 )
......@@ -205,7 +206,17 @@ namespace
bool bMultiValued = prop.MultiValued;
bool bOpenChoice = prop.OpenChoice;
uno::Any value = prop.Value;
libcmis::PropertyType::Type type = libcmis::PropertyType::String;
libcmis::PropertyType::Type type;
if ( prop.Type == CMIS_TYPE_STRING )
type = libcmis::PropertyType::String;
else if ( prop.Type == CMIS_TYPE_BOOL )
type = libcmis::PropertyType::Bool;
else if ( prop.Type == CMIS_TYPE_INTEGER )
type = libcmis::PropertyType::Integer;
else if ( prop.Type == CMIS_TYPE_DECIMAL )
type = libcmis::PropertyType::Decimal;
else if ( prop.Type == CMIS_TYPE_DATETIME )
type = libcmis::PropertyType::DateTime;
propertyType->setId( OUSTR_TO_STDSTR( id ));
propertyType->setDisplayName( OUSTR_TO_STDSTR( name ) );
......@@ -682,6 +693,26 @@ namespace cmis
pCmisProps[i].MultiValued = bMultiValued;
pCmisProps[i].OpenChoice = bOpenChoice;
pCmisProps[i].Value = lcl_cmisPropertyToUno( it->second );
switch ( it->second->getPropertyType( )->getType( ) )
{
default:
case libcmis::PropertyType::String:
pCmisProps[i].Type = CMIS_TYPE_STRING;
break;
case libcmis::PropertyType::Integer:
pCmisProps[i].Type = CMIS_TYPE_INTEGER;
break;
case libcmis::PropertyType::Decimal:
pCmisProps[i].Type = CMIS_TYPE_DECIMAL;
break;
case libcmis::PropertyType::Bool:
pCmisProps[i].Type = CMIS_TYPE_BOOL;
break;
case libcmis::PropertyType::DateTime:
pCmisProps[i].Type = CMIS_TYPE_DATETIME;
break;
}
}
xRow->appendObject( rProp.Name, uno::makeAny( aCmisProperties ) );
}
......
/* -*- 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:
*
*/
#ifndef CMIS_STRINGS_HXX
#define CMIS_STRINGS_HXX
#define CMIS_TYPE_STRING "String"
#define CMIS_TYPE_INTEGER "Integer"
#define CMIS_TYPE_DECIMAL "Decimal"
#define CMIS_TYPE_DATETIME "Datetime"
#define CMIS_TYPE_BOOL "Bool"
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment