LCOV - code coverage report
Current view: top level - include/oox/ole - olehelper.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 2 0.0 %
Date: 2014-04-14 Functions: 0 4 0.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           0 : 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             : #ifdef SvxMSConvertOCXControlsRemoved
     158             :     com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > mxShapes;
     159             :     com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > mxDrawPage;
     160             :     com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer >  mxFormComps;
     161             :     com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > mxServiceFactory;
     162             : #endif
     163             : protected:
     164             :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxCtx;
     165             :     ::oox::GraphicHelper maGrfHelper;
     166             : 
     167             :     bool importControlFromStream( ::oox::BinaryInputStream& rInStrm,
     168             :                                   ::com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rxFormComp,
     169             :                                   const OUString& rGuidString );
     170             :     bool importControlFromStream( ::oox::BinaryInputStream& rInStrm,
     171             :                                   ::com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rxFormComp,
     172             :                                   const OUString& rGuidString,
     173             :                                   sal_Int32 nSize );
     174             : public:
     175             :     MSConvertOCXControls( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel );
     176             :     virtual ~MSConvertOCXControls();
     177             :     sal_Bool ReadOCXStorage( SotStorageRef& rSrc1, ::com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rxFormComp );
     178             :     sal_Bool ReadOCXCtlsStream(SotStorageStreamRef& rSrc1, ::com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rxFormComp,
     179             :                                    sal_Int32 nPos, sal_Int32 nSize );
     180             :     static sal_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);
     181             :     static sal_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);
     182             : 
     183             : #ifdef SvxMSConvertOCXControlsRemoved
     184             :     const com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > & GetShapes();
     185             :     const com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer > &  GetFormComps();
     186             :     virtual const com::sun::star::uno::Reference<
     187             :         com::sun::star::drawing::XDrawPage > & GetDrawPage();
     188             :     const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & GetServiceFactory();
     189             :     virtual sal_Bool InsertControl(
     190             :         const com::sun::star::uno::Reference<
     191             :         com::sun::star::form::XFormComponent >& /*rFComp*/,
     192             :         const com::sun::star::awt::Size& /*rSize*/,
     193             :         com::sun::star::uno::Reference<
     194             :         com::sun::star::drawing::XShape >* /*pShape*/,
     195             :         sal_Bool /*bFloatingCtrl*/ ) {return sal_False;}
     196             : #endif
     197             : };
     198             : 
     199             : 
     200             : 
     201             : 
     202             : } // namespace ole
     203             : } // namespace oox
     204             : 
     205             : #endif
     206             : 
     207             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10