1*e3508121SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*e3508121SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*e3508121SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*e3508121SAndrew Rist * distributed with this work for additional information 6*e3508121SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*e3508121SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*e3508121SAndrew Rist * "License"); you may not use this file except in compliance 9*e3508121SAndrew Rist * with the License. You may obtain a copy of the License at 10*e3508121SAndrew Rist * 11*e3508121SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*e3508121SAndrew Rist * 13*e3508121SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*e3508121SAndrew Rist * software distributed under the License is distributed on an 15*e3508121SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*e3508121SAndrew Rist * KIND, either express or implied. See the License for the 17*e3508121SAndrew Rist * specific language governing permissions and limitations 18*e3508121SAndrew Rist * under the License. 19*e3508121SAndrew Rist * 20*e3508121SAndrew Rist *************************************************************/ 21*e3508121SAndrew Rist 22*e3508121SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef OOX_OLE_OLEHELPER_HXX 25cdf0e10cSrcweir #define OOX_OLE_OLEHELPER_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <rtl/ustring.hxx> 28cdf0e10cSrcweir #include "oox/helper/binarystreambase.hxx" 29cdf0e10cSrcweir 30cdf0e10cSrcweir namespace oox { 31cdf0e10cSrcweir class BinaryInputStream; 32cdf0e10cSrcweir class GraphicHelper; 33cdf0e10cSrcweir } 34cdf0e10cSrcweir 35cdf0e10cSrcweir namespace oox { 36cdf0e10cSrcweir namespace ole { 37cdf0e10cSrcweir 38cdf0e10cSrcweir // ============================================================================ 39cdf0e10cSrcweir 40cdf0e10cSrcweir const sal_Char* const OLE_GUID_STDFONT = "{0BE35203-8F91-11CE-9DE3-00AA004BB851}"; 41cdf0e10cSrcweir const sal_Char* const OLE_GUID_STDPIC = "{0BE35204-8F91-11CE-9DE3-00AA004BB851}"; 42cdf0e10cSrcweir const sal_Char* const OLE_GUID_STDHLINK = "{79EAC9D0-BAF9-11CE-8C82-00AA004BA90B}"; 43cdf0e10cSrcweir 44cdf0e10cSrcweir // ============================================================================ 45cdf0e10cSrcweir 46cdf0e10cSrcweir const sal_uInt16 OLE_STDFONT_NORMAL = 400; 47cdf0e10cSrcweir const sal_uInt16 OLE_STDFONT_BOLD = 700; 48cdf0e10cSrcweir 49cdf0e10cSrcweir const sal_uInt8 OLE_STDFONT_ITALIC = 0x02; 50cdf0e10cSrcweir const sal_uInt8 OLE_STDFONT_UNDERLINE = 0x04; 51cdf0e10cSrcweir const sal_uInt8 OLE_STDFONT_STRIKE = 0x08; 52cdf0e10cSrcweir 53cdf0e10cSrcweir /** Stores data about a StdFont font structure. */ 54cdf0e10cSrcweir struct StdFontInfo 55cdf0e10cSrcweir { 56cdf0e10cSrcweir ::rtl::OUString maName; /// Font name. 57cdf0e10cSrcweir sal_uInt32 mnHeight; /// Font height (1/10,000 points). 58cdf0e10cSrcweir sal_uInt16 mnWeight; /// Font weight (normal/bold). 59cdf0e10cSrcweir sal_uInt16 mnCharSet; /// Font charset. 60cdf0e10cSrcweir sal_uInt8 mnFlags; /// Font flags. 61cdf0e10cSrcweir 62cdf0e10cSrcweir explicit StdFontInfo(); 63cdf0e10cSrcweir explicit StdFontInfo( 64cdf0e10cSrcweir const ::rtl::OUString& rName, 65cdf0e10cSrcweir sal_uInt32 nHeight, 66cdf0e10cSrcweir sal_uInt16 nWeight = OLE_STDFONT_NORMAL, 67cdf0e10cSrcweir sal_uInt16 nCharSet = WINDOWS_CHARSET_ANSI, 68cdf0e10cSrcweir sal_uInt8 nFlags = 0 ); 69cdf0e10cSrcweir }; 70cdf0e10cSrcweir 71cdf0e10cSrcweir // ============================================================================ 72cdf0e10cSrcweir 73cdf0e10cSrcweir /** Stores data about a StdHlink hyperlink. */ 74cdf0e10cSrcweir struct StdHlinkInfo 75cdf0e10cSrcweir { 76cdf0e10cSrcweir ::rtl::OUString maTarget; 77cdf0e10cSrcweir ::rtl::OUString maLocation; 78cdf0e10cSrcweir ::rtl::OUString maDisplay; 79cdf0e10cSrcweir ::rtl::OUString maFrame; 80cdf0e10cSrcweir }; 81cdf0e10cSrcweir 82cdf0e10cSrcweir // ============================================================================ 83cdf0e10cSrcweir 84cdf0e10cSrcweir /** Static helper functions for OLE import/export. */ 85cdf0e10cSrcweir class OleHelper 86cdf0e10cSrcweir { 87cdf0e10cSrcweir public: 88cdf0e10cSrcweir /** Returns the UNO RGB color from the passed encoded OLE color. 89cdf0e10cSrcweir 90cdf0e10cSrcweir @param bDefaultColorBgr 91cdf0e10cSrcweir True = OLE default color type is treated as BGR color. 92cdf0e10cSrcweir False = OLE default color type is treated as palette color. 93cdf0e10cSrcweir */ 94cdf0e10cSrcweir static sal_Int32 decodeOleColor( 95cdf0e10cSrcweir const GraphicHelper& rGraphicHelper, 96cdf0e10cSrcweir sal_uInt32 nOleColor, 97cdf0e10cSrcweir bool bDefaultColorBgr = true ); 98cdf0e10cSrcweir 99cdf0e10cSrcweir /** Returns the OLE color from the passed UNO RGB color. 100cdf0e10cSrcweir */ 101cdf0e10cSrcweir static sal_uInt32 encodeOleColor( sal_Int32 nRgbColor ); 102cdf0e10cSrcweir 103cdf0e10cSrcweir /** Imports a GUID from the passed binary stream and returns its string 104cdf0e10cSrcweir representation (in uppercase characters). 105cdf0e10cSrcweir */ 106cdf0e10cSrcweir static ::rtl::OUString importGuid( BinaryInputStream& rInStrm ); 107cdf0e10cSrcweir 108cdf0e10cSrcweir /** Imports an OLE StdFont font structure from the current position of the 109cdf0e10cSrcweir passed binary stream. 110cdf0e10cSrcweir */ 111cdf0e10cSrcweir static bool importStdFont( 112cdf0e10cSrcweir StdFontInfo& orFontInfo, 113cdf0e10cSrcweir BinaryInputStream& rInStrm, 114cdf0e10cSrcweir bool bWithGuid ); 115cdf0e10cSrcweir 116cdf0e10cSrcweir /** Imports an OLE StdPic picture from the current position of the passed 117cdf0e10cSrcweir binary stream. 118cdf0e10cSrcweir */ 119cdf0e10cSrcweir static bool importStdPic( 120cdf0e10cSrcweir StreamDataSequence& orGraphicData, 121cdf0e10cSrcweir BinaryInputStream& rInStrm, 122cdf0e10cSrcweir bool bWithGuid ); 123cdf0e10cSrcweir 124cdf0e10cSrcweir /** Imports an OLE StdHlink from the current position of the passed binary 125cdf0e10cSrcweir stream. 126cdf0e10cSrcweir */ 127cdf0e10cSrcweir static bool importStdHlink( 128cdf0e10cSrcweir StdHlinkInfo& orHlinkInfo, 129cdf0e10cSrcweir BinaryInputStream& rInStrm, 130cdf0e10cSrcweir bool bWithGuid ); 131cdf0e10cSrcweir 132cdf0e10cSrcweir private: 133cdf0e10cSrcweir OleHelper(); // not implemented 134cdf0e10cSrcweir ~OleHelper(); // not implemented 135cdf0e10cSrcweir }; 136cdf0e10cSrcweir 137cdf0e10cSrcweir // ============================================================================ 138cdf0e10cSrcweir 139cdf0e10cSrcweir } // namespace ole 140cdf0e10cSrcweir } // namespace oox 141cdf0e10cSrcweir 142cdf0e10cSrcweir #endif 143