LCOV - code coverage report
Current view: top level - include/oox/ole - olehelper.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 2 50.0 %
Date: 2014-11-03 Functions: 3 4 75.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_OOX_OLE_OLEHELPER_HXX
      21             : #define INCLUDED_OOX_OLE_OLEHELPER_HXX
      22             : 
      23             : #include <rtl/ustring.hxx>
      24             : #include <oox/helper/binarystreambase.hxx>
      25             : #include <oox/helper/storagebase.hxx>
      26             : #include <oox/helper/graphichelper.hxx>
      27             : #include <com/sun/star/form/XFormComponent.hpp>
      28             : #include <com/sun/star/uno/XComponentContext.hpp>
      29             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      30             : #include <com/sun/star/frame/XModel.hpp>
      31             : #include <com/sun/star/frame/XFrame.hpp>
      32             : #include <com/sun/star/drawing/XShapes.hpp>
      33             : #include <com/sun/star/awt/XControlModel.hpp>
      34             : #include <com/sun/star/io/XInputStream.hpp>
      35             : #include <com/sun/star/io/XOutputStream.hpp>
      36             : #include <com/sun/star/drawing/XDrawPage.hpp>
      37             : #include <com/sun/star/container/XIndexContainer.hpp>
      38             : #include <filter/msfilter/msocximex.hxx>
      39             : #include <oox/dllapi.h>
      40             : #include <sot/storage.hxx>
      41             : 
      42             : class SvGlobalName;
      43             : 
      44             : namespace oox {
      45             :     class BinaryInputStream;
      46             :     class BinaryOutputStream;
      47             :     class BinaryXInputStream;
      48             :     class GraphicHelper;
      49             : }
      50             : 
      51             : namespace oox {
      52             : 
      53             : typedef ::boost::shared_ptr< oox::BinaryXInputStream > BinaryXInputStreamRef;
      54             : 
      55             : namespace ole {
      56             : 
      57             : 
      58             : 
      59             : 
      60             : #define OLE_GUID_STDFONT "{0BE35203-8F91-11CE-9DE3-00AA004BB851}"
      61             : #define OLE_GUID_STDPIC  "{0BE35204-8F91-11CE-9DE3-00AA004BB851}"
      62             : #define OLE_GUID_STDHLINK "{79EAC9D0-BAF9-11CE-8C82-00AA004BA90B}"
      63             : 
      64             : 
      65             : 
      66             : const sal_uInt16 OLE_STDFONT_NORMAL     = 400;
      67             : const sal_uInt16 OLE_STDFONT_BOLD       = 700;
      68             : 
      69             : const sal_uInt8 OLE_STDFONT_ITALIC      = 0x02;
      70             : const sal_uInt8 OLE_STDFONT_UNDERLINE   = 0x04;
      71             : const sal_uInt8 OLE_STDFONT_STRIKE      = 0x08;
      72             : 
      73             : /** Stores data about a StdFont font structure. */
      74           0 : struct StdFontInfo
      75             : {
      76             :     OUString     maName;         ///< Font name.
      77             :     sal_uInt32          mnHeight;       ///< Font height (1/10,000 points).
      78             :     sal_uInt16          mnWeight;       ///< Font weight (normal/bold).
      79             :     sal_uInt16          mnCharSet;      ///< Font charset.
      80             :     sal_uInt8           mnFlags;        ///< Font flags.
      81             : 
      82             :     explicit            StdFontInfo();
      83             :     explicit            StdFontInfo(
      84             :                             const OUString& rName,
      85             :                             sal_uInt32 nHeight,
      86             :                             sal_uInt16 nWeight = OLE_STDFONT_NORMAL,
      87             :                             sal_uInt16 nCharSet = WINDOWS_CHARSET_ANSI,
      88             :                             sal_uInt8 nFlags = 0 );
      89             : };
      90             : 
      91             : 
      92             : 
      93             : /** Stores data about a StdHlink hyperlink. */
      94          24 : struct StdHlinkInfo
      95             : {
      96             :     OUString     maTarget;
      97             :     OUString     maLocation;
      98             :     OUString     maDisplay;
      99             :     OUString     maFrame;
     100             : };
     101             : 
     102             : 
     103             : 
     104             : /** Static helper functions for OLE import/export. */
     105             : class OOX_DLLPUBLIC OleHelper
     106             : {
     107             : public:
     108             :     /** Returns the UNO RGB color from the passed encoded OLE color.
     109             : 
     110             :         @param bDefaultColorBgr
     111             :             True = OLE default color type is treated as BGR color.
     112             :             False = OLE default color type is treated as palette color.
     113             :      */
     114             :     static sal_Int32    decodeOleColor(
     115             :                             const GraphicHelper& rGraphicHelper,
     116             :                             sal_uInt32 nOleColor,
     117             :                             bool bDefaultColorBgr = true );
     118             : 
     119             :     /** Returns the OLE color from the passed UNO RGB color.
     120             :      */
     121             :     static sal_uInt32   encodeOleColor( sal_Int32 nRgbColor );
     122             : 
     123             :     /** Imports a GUID from the passed binary stream and returns its string
     124             :         representation (in uppercase characters).
     125             :      */
     126             :     static OUString importGuid( BinaryInputStream& rInStrm );
     127             :     static void exportGuid( BinaryOutputStream& rOutStrm, const SvGlobalName& rId );
     128             : 
     129             :     /** Imports an OLE StdFont font structure from the current position of the
     130             :         passed binary stream.
     131             :      */
     132             :     static bool         importStdFont(
     133             :                             StdFontInfo& orFontInfo,
     134             :                             BinaryInputStream& rInStrm,
     135             :                             bool bWithGuid );
     136             : 
     137             :     /** Imports an OLE StdPic picture from the current position of the passed
     138             :         binary stream.
     139             :      */
     140             :     static bool         importStdPic(
     141             :                             StreamDataSequence& orGraphicData,
     142             :                             BinaryInputStream& rInStrm,
     143             :                             bool bWithGuid );
     144             : 
     145             : private:
     146             :                         OleHelper();        // not implemented
     147             :                         ~OleHelper();       // not implemented
     148             : };
     149             : 
     150             : // ideally it would be great to get rid of SvxMSConvertOCXControls
     151             : // however msfilter/source/msfilter/svdfppt.cxx still uses
     152             : // SvxMSConvertOCXControls as a base class, unfortunately oox depends on
     153             : // msfilter. Probably the solution would be to move the svdfppt.cxx
     154             : // implementation into the sd module itself.
     155             : class OOX_DLLPUBLIC MSConvertOCXControls : public SvxMSConvertOCXControls
     156             : {
     157             : protected:
     158             :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxCtx;
     159             :     ::oox::GraphicHelper maGrfHelper;
     160             : 
     161             :     bool importControlFromStream( ::oox::BinaryInputStream& rInStrm,
     162             :                                   ::com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rxFormComp,
     163             :                                   const OUString& rGuidString );
     164             :     bool importControlFromStream( ::oox::BinaryInputStream& rInStrm,
     165             :                                   ::com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rxFormComp,
     166             :                                   const OUString& rGuidString,
     167             :                                   sal_Int32 nSize );
     168             : public:
     169             :     MSConvertOCXControls( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel );
     170             :     virtual ~MSConvertOCXControls();
     171             :     bool ReadOCXStorage( SotStorageRef& rSrc1, ::com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rxFormComp );
     172             :     bool ReadOCXCtlsStream(SotStorageStreamRef& rSrc1, ::com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rxFormComp,
     173             :                                    sal_Int32 nPos, sal_Int32 nSize );
     174             :     static bool WriteOCXStream( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel, SotStorageRef &rSrc1, const com::sun::star::uno::Reference< com::sun::star::awt::XControlModel > &rControlModel, const com::sun::star::awt::Size& rSize,OUString &rName);
     175             :     static bool WriteOCXExcelKludgeStream( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutStrm, const com::sun::star::uno::Reference< com::sun::star::awt::XControlModel > &rControlModel, const com::sun::star::awt::Size& rSize,OUString &rName);
     176             : };
     177             : 
     178             : 
     179             : 
     180             : 
     181             : } // namespace ole
     182             : } // namespace oox
     183             : 
     184             : #endif
     185             : 
     186             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10