2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 #ifndef SFX_SIDEBAR_TOOLS_HXX
19 #define SFX_SIDEBAR_TOOLS_HXX
21 #include <vcl/image.hxx>
22 #include <vcl/gradient.hxx>
23 #include <tools/svborder.hxx>
25 #include "sfx2/dllapi.h"
27 #include <com/sun/star/awt/Gradient.hpp>
28 #include <com/sun/star/frame/XDispatch.hpp>
29 #include <com/sun/star/frame/XFrame.hpp>
30 #include <com/sun/star/util/URL.hpp>
33 #define A2S(s) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)))
34 #define S2A(s) rtl::OUStringToOString(s, RTL_TEXTENCODING_ASCII_US).getStr()
36 namespace css
= ::com::sun::star
;
37 namespace cssu
= ::com::sun::star::uno
;
40 namespace sfx2
{ namespace sidebar
{
42 class SFX2_DLLPUBLIC Tools
45 static Image
GetImage (
46 const ::rtl::OUString
& rsImageURL
,
47 const ::rtl::OUString
& rsHighContrastImageURL
,
48 const cssu::Reference
<css::frame::XFrame
>& rxFrame
);
50 static Image
GetImage (
51 const ::rtl::OUString
& rsURL
,
52 const cssu::Reference
<css::frame::XFrame
>& rxFrame
);
54 static css::awt::Gradient
VclToAwtGradient (const Gradient aGradient
);
55 static Gradient
AwtToVclGradient (const css::awt::Gradient aGradient
);
57 static SvBorder
RectangleToSvBorder (const Rectangle aBox
);
59 static css::util::URL
GetURL (const ::rtl::OUString
& rsCommand
);
60 static cssu::Reference
<css::frame::XDispatch
> GetDispatch (
61 const cssu::Reference
<css::frame::XFrame
>& rxFrame
,
62 const css::util::URL
& rURL
);
64 static ::rtl::OUString
GetModuleName (
65 const cssu::Reference
<css::frame::XFrame
>& rxFrame
);
69 } } // end of namespace sfx2::sidebar