1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_COMPHELPER_TYPES_HXX
21 #define INCLUDED_COMPHELPER_TYPES_HXX
23 #include <com/sun/star/uno/Reference.hxx>
24 #include <com/sun/star/lang/XComponent.hpp>
25 #include <comphelper/comphelperdllapi.h>
27 namespace com::sun::star::awt
{
28 struct FontDescriptor
;
31 namespace com::sun::star::uno
{ class Any
; }
32 namespace com::sun::star::uno
{ class XInterface
; }
37 /// returns sal_True if objects of the types given are "compatible"
38 COMPHELPER_DLLPUBLIC
bool isAssignableFrom(const css::uno::Type
& _rAssignable
, const css::uno::Type
& _rFrom
);
40 /** ask the given object for an XComponent interface and dispose on it
43 void disposeComponent(css::uno::Reference
<TYPE
>& _rxComp
)
45 css::uno::Reference
<css::lang::XComponent
> xComp(_rxComp
, css::uno::UNO_QUERY
);
54 /** get a css::awt::FontDescriptor that is fully initialized with
55 the XXX_DONTKNOW enum values (which isn't the case if you instantiate it
56 via the default constructor)
58 COMPHELPER_DLLPUBLIC
css::awt::FontDescriptor
getDefaultFont();
60 /** examine a sequence for the com.sun.star.uno::Type of its elements.
62 COMPHELPER_DLLPUBLIC
css::uno::Type
getSequenceElementType(const css::uno::Type
& _rSequenceType
);
65 //= replacement of the former UsrAny.getXXX methods
67 // may be used if you need the return value just as temporary, else it's may be too inefficient...
69 // no, we don't use templates here. This would lead to a lot of implicit uses of the conversion methods,
70 // which would be difficult to trace...
72 COMPHELPER_DLLPUBLIC sal_Int64
getINT64(const css::uno::Any
& _rAny
);
73 COMPHELPER_DLLPUBLIC sal_Int32
getINT32(const css::uno::Any
& _rAny
);
74 COMPHELPER_DLLPUBLIC sal_Int16
getINT16(const css::uno::Any
& _rAny
);
75 COMPHELPER_DLLPUBLIC
double getDouble(const css::uno::Any
& _rAny
);
76 COMPHELPER_DLLPUBLIC
float getFloat(const css::uno::Any
& _rAny
);
77 COMPHELPER_DLLPUBLIC OUString
getString(const css::uno::Any
& _rAny
);
78 COMPHELPER_DLLPUBLIC
bool getBOOL(const css::uno::Any
& _rAny
);
80 /// @throws css::lang::IllegalArgumentException
81 COMPHELPER_DLLPUBLIC sal_Int32
getEnumAsINT32(const css::uno::Any
& _rAny
);
83 } // namespace comphelper
86 #endif // INCLUDED_COMPHELPER_TYPES_HXX
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */