1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 #ifndef SFX_SIDEBAR_TOOLS_HXX 23 #define SFX_SIDEBAR_TOOLS_HXX 24 25 #include <vcl/image.hxx> 26 #include <vcl/gradient.hxx> 27 #include <tools/svborder.hxx> 28 29 #include "sfx2/dllapi.h" 30 31 #include <com/sun/star/awt/Gradient.hpp> 32 #include <com/sun/star/frame/XDispatch.hpp> 33 #include <com/sun/star/frame/XFrame.hpp> 34 #include <com/sun/star/util/URL.hpp> 35 36 37 #define A2S(s) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s))) 38 #define S2A(s) rtl::OUStringToOString(s, RTL_TEXTENCODING_ASCII_US).getStr() 39 40 namespace css = ::com::sun::star; 41 namespace cssu = ::com::sun::star::uno; 42 43 44 namespace sfx2 { namespace sidebar { 45 46 class SFX2_DLLPUBLIC Tools 47 { 48 public: 49 static Image GetImage ( 50 const ::rtl::OUString& rsImageURL, 51 const ::rtl::OUString& rsHighContrastImageURL, 52 const cssu::Reference<css::frame::XFrame>& rxFrame); 53 54 static Image GetImage ( 55 const ::rtl::OUString& rsURL, 56 const cssu::Reference<css::frame::XFrame>& rxFrame); 57 58 static css::awt::Gradient VclToAwtGradient (const Gradient aGradient); 59 static Gradient AwtToVclGradient (const css::awt::Gradient aGradient); 60 61 static SvBorder RectangleToSvBorder (const Rectangle aBox); 62 63 static css::util::URL GetURL (const ::rtl::OUString& rsCommand); 64 static cssu::Reference<css::frame::XDispatch> GetDispatch ( 65 const cssu::Reference<css::frame::XFrame>& rxFrame, 66 const css::util::URL& rURL); 67 68 static ::rtl::OUString GetModuleName ( 69 const cssu::Reference<css::frame::XFrame>& rxFrame); 70 }; 71 72 73 } } // end of namespace sfx2::sidebar 74 75 #endif 76