diff options
author | Cao Cuong Ngo <cao.cuong.ngo@gmail.com> | 2013-07-18 11:55:50 +0200 |
---|---|---|
committer | Cédric Bosdonnat <cedric.bosdonnat.ooo@free.fr> | 2013-09-02 13:51:53 +0200 |
commit | eb23b2d9597345a91273bf5d530ce29ab111f864 (patch) | |
tree | 2e6c45e92441107a081d967b371dc3c4a266a666 /ucb/source | |
parent | 96d4c5358348472c347d62ab67afb52d880cd796 (diff) |
CMIS properties: Add type to the UNO API
Change-Id: Ie4f32bc840cdfab1d5f600991cd6ac8aabcb1f87
Diffstat (limited to 'ucb/source')
-rw-r--r-- | ucb/source/ucp/cmis/cmis_content.cxx | 33 | ||||
-rw-r--r-- | ucb/source/ucp/cmis/cmis_strings.hxx | 23 |
2 files changed, 55 insertions, 1 deletions
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx index 5e843822bb34..f414a8bba1c8 100644 --- a/ucb/source/ucp/cmis/cmis_content.cxx +++ b/ucb/source/ucp/cmis/cmis_content.cxx @@ -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 ) ); } diff --git a/ucb/source/ucp/cmis/cmis_strings.hxx b/ucb/source/ucp/cmis/cmis_strings.hxx new file mode 100644 index 000000000000..f478548c8269 --- /dev/null +++ b/ucb/source/ucp/cmis/cmis_strings.hxx @@ -0,0 +1,23 @@ +/* -*- 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: */ |