/* -*- 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 INCLUDED_COMPHELPER_EXTRACT_HXX #define INCLUDED_COMPHELPER_EXTRACT_HXX #include #include #include #include #include #include namespace cppu { /** * Sets enum from int32 value. This function does NOT check for valid enum values! * * @param nEnum int32 enum value * @param rType enum type * @return enum or empty any. */ inline css::uno::Any int2enum( sal_Int32 nEnum, const css::uno::Type & rType ) { assert(rType.getTypeClass() == css::uno::TypeClass_ENUM); return css::uno::Any( &nEnum, rType ); } /** * Sets int32 from enum or int in any. * * @param[out] rnEnum int32 enum value * @param rAny enum or int * @retval true if enum or int value was set * @retval false otherwise */ inline bool enum2int( sal_Int32 & rnEnum, const css::uno::Any & rAny ) { if (rAny.getValueTypeClass() == css::uno::TypeClass_ENUM) { rnEnum = * static_cast< const sal_Int32 * >( rAny.getValue() ); return true; } return rAny >>= rnEnum; } /** * Sets int32 from enum or int in any with additional typecheck * * @param[out] eRet the enum value as int. If there is no enum of the given type * a css::lang::IllegalArgumentException is thrown * @param rAny enum or int * @throws css::lang::IllegalArgumentException */ template< typename E > inline void any2enum( E & eRet, const css::uno::Any & rAny ) { // check for typesafe enum if (! (rAny >>= eRet)) { // if not enum, maybe integer? sal_Int32 nValue = 0; if (! (rAny >>= nValue)) throw css::lang::IllegalArgumentException(); eRet = static_cast(nValue); } } /** * Extracts a boolean either as a bool or an integer from * an any. If there is no bool or integer inside the any * a css::lang::IllegalArgumentException is thrown * * @throws css::lang::IllegalArgumentException */ inline bool any2bool( const css::uno::Any & rAny ) { bool b; if (rAny >>= b) { return b; } else { sal_Int32 nValue = 0; if (! (rAny >>= nValue)) throw css::lang::IllegalArgumentException(); return nValue != 0; } } } #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ tion value='distro/collabora/co-24.04.7'>distro/collabora/co-24.04.7 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
path: root/offapi
AgeCommit message (Expand)Author
2017-03-04gpg4libre: List and view GPG keysSamuel Mehrbrodt
2017-03-02Fix typosAndrea Gelmini
2017-02-27uitest: add a specific method for executing dialogsMarkus Mohrhard
2017-02-14Resolves: tdf#79250 add typed list to form control listboxEike Rathke
2017-02-14Missing @since tagsStephan Bergmann
2017-02-13comment XPopupRequest APITomaž Vajngerl
2017-02-12[API CHANGE] Add PopupRequest - a callback to open a pop-up win. in calcTomaž Vajngerl
2017-02-11Revert "Resolves: tdf#79250 add typed list to form control listbox"Eike Rathke
2017-02-10Resolves: tdf#79250 add typed list to form control listboxEike Rathke
2017-02-07Remove duplicate documentation commentStephan Bergmann
2017-02-07uitest: provide a way to get a json representation of the ui infoMarkus Mohrhard
2017-02-02Fix some typosSamuel Mehrbrodt
2017-01-30offapi: improve some Settings documentationMichael Stahl
2017-01-27offapi: FormulaProperties doc broken linkMichael Stahl
2017-01-26[API CHANGE] offapi: remove unused xsec_fw UNO servicesMiklos Vajna
2017-01-19drop now unusd private:resource/.../image urlsCaolán McNamara
2017-01-19Use the old-fashion way to instantiate a UNO service.Kohei Yoshida
2017-01-18XPackageTypeInfo::getIcon is uselessCaolán McNamara
2017-01-17tdf#97597: attempt to add test for multithreaded input stream buffering.Kohei Yoshida
2016-12-30drop imagelist example from idl commentsCaolán McNamara
2016-12-22Revert "[API CHANGE] createSecurityContext() was always called with an empty ...Tor Lillqvist
2016-12-21[API CHANGE] createSecurityContext() was always called with an empty stringTor Lillqvist
2016-12-13tdf#66212 - Add Hebrew NATNUM1 to numbering-format menus.Yossi Zahn
2016-11-23[API Change]: Create new GeneralFunction2 for adding medianTamás Zolnai
2016-11-22[API CHANGE] offapi: remove unused XSecurityController interfaceMiklos Vajna
2016-11-22[API Change] revert incompatible change of enum css::sheet::GeneralFunctionEike Rathke
2016-11-21Update the reference rdbs to libreoffice-5-2Stephan Bergmann
2016-11-21[API CHANGE] Remove tdf#96398 leftover XRemoteServiceManagerProviderStephan Bergmann
2016-11-21[API Change]: Move recently added median function to the end of enumTamás Zolnai
2016-11-20[API Change] PivotMedian: Add median to pivot table function typeTamás Zolnai
2016-11-11fix spelling XFastAttrbitueList->XFastAttributeListNoel Grandin
2016-11-09Typo in documentationStephan Bergmann
2016-11-07vcl: improve accounting of SVG images in graphics cacheMichael Stahl
2016-11-03Bin unused XSecuritySAXEventKeeper::cloneElementCollectorTor Lillqvist
2016-10-31css.xml.sax.XAttributeList is broken by designStephan Bergmann
2016-10-31Clean up #include lineStephan Bergmann
2016-10-30tdf#95014 initial support for 32 px icons in toolbarTomaž Vajngerl