LCOV - code coverage report
Current view: top level - libreoffice/solver/unxlngi6.pro/inc/comphelper - embeddedobjectcontainer.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 2 2 100.0 %
Date: 2012-12-27 Functions: 2 2 100.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             : #ifndef _COMPHELPER_OBJECTCONTAINER_HXX_
      20             : #define _COMPHELPER_OBJECTCONTAINER_HXX_
      21             : 
      22             : #include <com/sun/star/uno/Reference.h>
      23             : #include <com/sun/star/uno/Sequence.hxx>
      24             : #include <com/sun/star/embed/XEmbeddedObject.hpp>
      25             : #include <com/sun/star/task/XInteractionHandler.hpp>
      26             : #include <com/sun/star/embed/XStorage.hpp>
      27             : #include <com/sun/star/io/XInputStream.hpp>
      28             : #include <com/sun/star/beans/PropertyValue.hpp>
      29             : #include <com/sun/star/frame/XModel.hpp>
      30             : #include "comphelper/comphelperdllapi.h"
      31             : 
      32             : #include <rtl/ustring.hxx>
      33             : 
      34             : namespace comphelper
      35             : {
      36             :     class EmbeddedObjectContainer;
      37             :     /** Helper interface to give access to some common object which replace the SfxObjectShell
      38             :     */
      39         649 :     class SAL_NO_VTABLE IEmbeddedHelper
      40             :     {
      41             :     public:
      42             :         virtual EmbeddedObjectContainer& getEmbeddedObjectContainer() const = 0;
      43             :         virtual com::sun::star::uno::Reference < com::sun::star::embed::XStorage > getStorage() const = 0;
      44             :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > getInteractionHandler() const = 0;
      45             :         virtual bool isEnableSetModified() const = 0;
      46             : 
      47             :     protected:
      48         322 :         ~IEmbeddedHelper() {}
      49             :     };
      50             : 
      51             : struct EmbedImpl;
      52             : class COMPHELPER_DLLPUBLIC EmbeddedObjectContainer
      53             : {
      54             :     EmbedImpl*  pImpl;
      55             : 
      56             :     ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject > Get_Impl( const ::rtl::OUString&,
      57             :             const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xCopy);
      58             : 
      59             : public:
      60             :     // add an embedded object to the container storage
      61             :     sal_Bool            StoreEmbeddedObject( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >&, ::rtl::OUString&, sal_Bool );
      62             : 
      63             :     // add an embedded object that has been imported from the container storage - should only be called by filters!
      64             :     void                AddEmbeddedObject( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >&, const ::rtl::OUString& );
      65             : 
      66             :                         EmbeddedObjectContainer();
      67             :                         EmbeddedObjectContainer( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& );
      68             :                         EmbeddedObjectContainer( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&,
      69             :                                                  const com::sun::star::uno::Reference < com::sun::star::uno::XInterface >& );
      70             :                         ~EmbeddedObjectContainer();
      71             : 
      72             :     void                SwitchPersistence( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& );
      73             :     sal_Bool            CommitImageSubStorage();
      74             :     void                ReleaseImageSubStorage();
      75             : 
      76             :     ::rtl::OUString     CreateUniqueObjectName();
      77             : 
      78             :     // get a list of object names that have been added so far
      79             :     com::sun::star::uno::Sequence < ::rtl::OUString > GetObjectNames();
      80             : 
      81             :     // check for existence of objects at all
      82             :     sal_Bool            HasEmbeddedObjects();
      83             : 
      84             :     // check existence of an object - either by identity or by name
      85             :     sal_Bool            HasEmbeddedObject( const ::rtl::OUString& );
      86             :     sal_Bool            HasEmbeddedObject( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& );
      87             :     sal_Bool            HasInstantiatedEmbeddedObject( const ::rtl::OUString& );
      88             : 
      89             :     // get the object name of an object - this is the persist name if the object has persistence
      90             :     ::rtl::OUString     GetEmbeddedObjectName( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& );
      91             : 
      92             :     // retrieve an embedded object by name that either has been added already or is available in the container storage
      93             :     ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject > GetEmbeddedObject( const ::rtl::OUString& );
      94             : 
      95             :     // create an object from a ClassId
      96             :     ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >
      97             :                         CreateEmbeddedObject( const com::sun::star::uno::Sequence < sal_Int8 >&, ::rtl::OUString& );
      98             : 
      99             :     ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >
     100             :                         CreateEmbeddedObject( const com::sun::star::uno::Sequence < sal_Int8 >&,
     101             :                         const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >&, ::rtl::OUString& );
     102             : 
     103             :     // insert an embedded object into the container - objects persistant representation will be added to the storage
     104             :     sal_Bool            InsertEmbeddedObject( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >&, ::rtl::OUString& );
     105             : 
     106             :     // load an embedded object from a MediaDescriptor and insert it into the container
     107             :     // a new object will be created from the new content and returned
     108             :     ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >
     109             :                         InsertEmbeddedObject( const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, ::rtl::OUString& );
     110             : 
     111             :     // create an embedded link based on a MediaDescriptor and insert it into the container
     112             :     // a new object will be created from the new content and returned
     113             :     ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >
     114             :                         InsertEmbeddedLink( const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, ::rtl::OUString& );
     115             : 
     116             :     // create an object from a stream that contains its persistent representation and insert it as usual (usually called from clipboard)
     117             :     // a new object will be created from the new content and returned
     118             :     ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >
     119             :                         InsertEmbeddedObject( const ::com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream >&, ::rtl::OUString& );
     120             : 
     121             :     // copy an embedded object into the storage, open the new copy and return it
     122             :     ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject > CopyAndGetEmbeddedObject( EmbeddedObjectContainer& rSrc, const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xObj, /* TODO const ::rtl::OUString& aOrigName,*/ ::rtl::OUString& rName );
     123             : 
     124             :     // move an embedded object from one container to another one
     125             :     sal_Bool MoveEmbeddedObject( EmbeddedObjectContainer& rSrc, const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >&, ::rtl::OUString& );
     126             : 
     127             :     // remove an embedded object from the container and from the storage; if object can't be closed
     128             :     sal_Bool            RemoveEmbeddedObject( const ::rtl::OUString& rName, sal_Bool bClose=sal_True );
     129             :     sal_Bool            RemoveEmbeddedObject( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >&, sal_Bool bClose=sal_True );
     130             : 
     131             :     // close and remove an embedded object from the container without removing it from the storage
     132             :     sal_Bool            CloseEmbeddedObject( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& );
     133             : 
     134             :     // move an embedded object to another container (keep the persistent name)
     135             :     sal_Bool            MoveEmbeddedObject( const ::rtl::OUString& rName, EmbeddedObjectContainer& );
     136             : 
     137             :     // get the stored graphical representation for the object
     138             :     com::sun::star::uno::Reference < com::sun::star::io::XInputStream > GetGraphicStream( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >&, ::rtl::OUString* pMediaType=0 );
     139             : 
     140             :     // get the stored graphical representation by the object name
     141             :     com::sun::star::uno::Reference < com::sun::star::io::XInputStream > GetGraphicStream( const ::rtl::OUString& aName, ::rtl::OUString* pMediaType=0 );
     142             : 
     143             :     // add a graphical representation for an object
     144             :     sal_Bool            InsertGraphicStream( const com::sun::star::uno::Reference < com::sun::star::io::XInputStream >& rStream, const ::rtl::OUString& rObjectName, const ::rtl::OUString& rMediaType );
     145             : 
     146             :     // try to add a graphical representation for an object in optimized way ( might fail )
     147             :     sal_Bool            InsertGraphicStreamDirectly( const com::sun::star::uno::Reference < com::sun::star::io::XInputStream >& rStream, const ::rtl::OUString& rObjectName, const rtl::OUString& rMediaType );
     148             : 
     149             :     // remove a graphical representation for an object
     150             :     sal_Bool            RemoveGraphicStream( const ::rtl::OUString& rObjectName );
     151             : 
     152             :     // copy the graphical representation from different container
     153             :     sal_Bool            TryToCopyGraphReplacement( EmbeddedObjectContainer& rSrc,
     154             :                                                     const ::rtl::OUString& aOrigName,
     155             :                                                     const ::rtl::OUString& aTargetName );
     156             : 
     157             :     void                CloseEmbeddedObjects();
     158             :     sal_Bool            StoreChildren(sal_Bool _bOasisFormat,sal_Bool _bObjectsOnly);
     159             :     sal_Bool            StoreAsChildren( sal_Bool _bOasisFormat
     160             :                                         ,sal_Bool _bCreateEmbedded
     161             :                                         ,const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& _xStorage);
     162             : 
     163             :     static com::sun::star::uno::Reference< com::sun::star::io::XInputStream > GetGraphicReplacementStream(
     164             :                                             sal_Int64 nViewAspect,
     165             :                                             const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject >&,
     166             :                                             ::rtl::OUString* pMediaType );
     167             : 
     168             :     /** call setPersistentEntry for each embedded object in the container
     169             :     *
     170             :     * \param _xStorage The storeage where to store the objects.
     171             :     * \param _bClearModifedFlag If <TRUE/> then the modifed flag will be set to <FALSE/> otherwise nothing happen.
     172             :     * \return <FALSE/> if no error occurred, otherwise <TRUE/>.
     173             :     */
     174             :     sal_Bool             SetPersistentEntries(const com::sun::star::uno::Reference< com::sun::star::embed::XStorage >& _xStorage,bool _bClearModifedFlag = true);
     175             : };
     176             : 
     177             : }
     178             : 
     179             : #endif
     180             : 
     181             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10