/* -*- 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 .
*/
sal_Bool SAL_CALL ODBTableDecorator::convertFastPropertyValue(
Any & rConvertedValue,
Any & rOldValue,
sal_Int32 nHandle, const Any& rValue )
{ bool bRet = true; switch(nHandle)
{ case PROPERTY_ID_PRIVILEGES: case PROPERTY_ID_FILTER: case PROPERTY_ID_ORDER: case PROPERTY_ID_APPLYFILTER: case PROPERTY_ID_FONT: case PROPERTY_ID_ROW_HEIGHT: case PROPERTY_ID_AUTOGROW: case PROPERTY_ID_TEXTCOLOR: case PROPERTY_ID_TEXTLINECOLOR: case PROPERTY_ID_TEXTEMPHASIS: case PROPERTY_ID_TEXTRELIEF: case PROPERTY_ID_FONTCHARWIDTH: case PROPERTY_ID_FONTCHARSET: case PROPERTY_ID_FONTFAMILY: case PROPERTY_ID_FONTHEIGHT: case PROPERTY_ID_FONTKERNING: case PROPERTY_ID_FONTNAME: case PROPERTY_ID_FONTORIENTATION: case PROPERTY_ID_FONTPITCH: case PROPERTY_ID_FONTSLANT: case PROPERTY_ID_FONTSTRIKEOUT: case PROPERTY_ID_FONTSTYLENAME: case PROPERTY_ID_FONTUNDERLINE: case PROPERTY_ID_FONTWEIGHT: case PROPERTY_ID_FONTWIDTH: case PROPERTY_ID_FONTWORDLINEMODE: case PROPERTY_ID_FONTTYPE:
bRet = ODataSettings::convertFastPropertyValue(rConvertedValue, rOldValue,nHandle,rValue); break;
default:
{
Any aValue;
getFastPropertyValue(aValue,nHandle);
bRet = ::comphelper::tryPropertyValue(rConvertedValue,rOldValue,rValue,aValue,::cppu::UnoType<OUString>::get());
} break; // we assume that it works
} return bRet;
}
void ODBTableDecorator::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, const Any& _rValue)
{ switch(_nHandle)
{ case PROPERTY_ID_PRIVILEGES:
SAL_WARN("dbaccess", "Property is readonly!");
[[fallthrough]]; case PROPERTY_ID_FILTER: case PROPERTY_ID_ORDER: case PROPERTY_ID_APPLYFILTER: case PROPERTY_ID_FONT: case PROPERTY_ID_ROW_HEIGHT: case PROPERTY_ID_AUTOGROW: case PROPERTY_ID_TEXTCOLOR: case PROPERTY_ID_TEXTLINECOLOR: case PROPERTY_ID_TEXTEMPHASIS: case PROPERTY_ID_TEXTRELIEF: case PROPERTY_ID_FONTCHARWIDTH: case PROPERTY_ID_FONTCHARSET: case PROPERTY_ID_FONTFAMILY: case PROPERTY_ID_FONTHEIGHT: case PROPERTY_ID_FONTKERNING: case PROPERTY_ID_FONTNAME: case PROPERTY_ID_FONTORIENTATION: case PROPERTY_ID_FONTPITCH: case PROPERTY_ID_FONTSLANT: case PROPERTY_ID_FONTSTRIKEOUT: case PROPERTY_ID_FONTSTYLENAME: case PROPERTY_ID_FONTUNDERLINE: case PROPERTY_ID_FONTWEIGHT: case PROPERTY_ID_FONTWIDTH: case PROPERTY_ID_FONTWORDLINEMODE: case PROPERTY_ID_FONTTYPE:
ODataSettings::setFastPropertyValue_NoBroadcast(_nHandle, _rValue); break; case PROPERTY_ID_CATALOGNAME:
{
Reference<XPropertySet> xProp(m_xTable,UNO_QUERY);
xProp->setPropertyValue(PROPERTY_CATALOGNAME,_rValue);
} break; case PROPERTY_ID_SCHEMANAME:
{
Reference<XPropertySet> xProp(m_xTable,UNO_QUERY);
xProp->setPropertyValue(PROPERTY_SCHEMANAME,_rValue);
} break; case PROPERTY_ID_NAME:
{
Reference<XPropertySet> xProp(m_xTable,UNO_QUERY);
xProp->setPropertyValue(PROPERTY_NAME,_rValue);
} break; case PROPERTY_ID_DESCRIPTION:
{
Reference<XPropertySet> xProp(m_xTable,UNO_QUERY);
xProp->setPropertyValue(PROPERTY_DESCRIPTION,_rValue);
} break; case PROPERTY_ID_TYPE:
{
Reference<XPropertySet> xProp(m_xTable,UNO_QUERY);
xProp->setPropertyValue(PROPERTY_TYPE,_rValue);
} break;
}
}
switch(_nHandle)
{ case PROPERTY_ID_PRIVILEGES:
{ if ( -1 == m_nPrivileges )
fillPrivileges();
Reference<XPropertySet> xProp(m_xTable,UNO_QUERY);
Reference<XPropertySetInfo> xInfo = xProp->getPropertySetInfo(); if ( xInfo->hasPropertyByName(PROPERTY_PRIVILEGES) )
{
_rValue <<= m_nPrivileges; break;
}
}
[[fallthrough]];
case PROPERTY_ID_FILTER: case PROPERTY_ID_ORDER: case PROPERTY_ID_APPLYFILTER: case PROPERTY_ID_FONT: case PROPERTY_ID_ROW_HEIGHT: case PROPERTY_ID_AUTOGROW: case PROPERTY_ID_TEXTCOLOR: case PROPERTY_ID_TEXTLINECOLOR: case PROPERTY_ID_TEXTEMPHASIS: case PROPERTY_ID_TEXTRELIEF: case PROPERTY_ID_FONTCHARWIDTH: case PROPERTY_ID_FONTCHARSET: case PROPERTY_ID_FONTFAMILY: case PROPERTY_ID_FONTHEIGHT: case PROPERTY_ID_FONTKERNING: case PROPERTY_ID_FONTNAME: case PROPERTY_ID_FONTORIENTATION: case PROPERTY_ID_FONTPITCH: case PROPERTY_ID_FONTSLANT: case PROPERTY_ID_FONTSTRIKEOUT: case PROPERTY_ID_FONTSTYLENAME: case PROPERTY_ID_FONTUNDERLINE: case PROPERTY_ID_FONTWEIGHT: case PROPERTY_ID_FONTWIDTH: case PROPERTY_ID_FONTWORDLINEMODE: case PROPERTY_ID_FONTTYPE:
ODataSettings::getFastPropertyValue(_rValue, _nHandle); break; case PROPERTY_ID_CATALOGNAME:
{
Reference<XPropertySet> xProp(m_xTable,UNO_QUERY);
_rValue = xProp->getPropertyValue(PROPERTY_CATALOGNAME);
} break; case PROPERTY_ID_SCHEMANAME:
{
Reference<XPropertySet> xProp(m_xTable,UNO_QUERY);
_rValue = xProp->getPropertyValue(PROPERTY_SCHEMANAME);
} break; case PROPERTY_ID_NAME:
{
Reference<XPropertySet> xProp(m_xTable,UNO_QUERY);
_rValue = xProp->getPropertyValue(PROPERTY_NAME);
} break; case PROPERTY_ID_DESCRIPTION:
{
Reference<XPropertySet> xProp(m_xTable,UNO_QUERY);
_rValue = xProp->getPropertyValue(PROPERTY_DESCRIPTION);
} break; case PROPERTY_ID_TYPE:
{
Reference<XPropertySet> xProp(m_xTable,UNO_QUERY);
_rValue = xProp->getPropertyValue(PROPERTY_TYPE);
} break; default:
SAL_WARN("dbaccess", "Invalid Handle for table");
}
}
// TODO: this is a HACK, and prone to errors // The OIdPropertyArrayUsageHelper is intended for classes where there exists a known, limited // number of different property set infos (distinguished by the ID), all implemented by this very // same class. // However, in this case here we have an unknown, potentially unlimited number of different // property set infos: Depending on the table for which we act as decorator, different property // sets might exist.
}
// XServiceInfo
OUString SAL_CALL ODBTableDecorator::getImplementationName()
{ return u"com.sun.star.sdb.dbaccess.ODBTableDecorator"_ustr;
}
sal_Bool SAL_CALL ODBTableDecorator::supportsService(const OUString& _rServiceName)
{ const css::uno::Sequence< OUString > aSupported(getSupportedServiceNames()); for (const OUString& s : aSupported) if (s == _rServiceName) returntrue;
Any SAL_CALL ODBTableDecorator::queryInterface( const Type & rType )
{
Any aRet; if(m_xTable.is())
{
aRet = m_xTable->queryInterface(rType); if(aRet.hasValue())
{ // now we know that our table supports this type so we return ourself
aRet = OTableDescriptor_BASE::queryInterface(rType); if(!aRet.hasValue())
aRet = ODataSettings::queryInterface(rType);
}
}
return aRet;
}
Sequence< Type > SAL_CALL ODBTableDecorator::getTypes( )
{
Reference<XTypeProvider> xTypes(m_xTable,UNO_QUERY);
OSL_ENSURE(xTypes.is(),"Table must be a TypeProvider!"); return xTypes->getTypes();
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.