Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SVTOOLS_EMBEDHLP_HXX
30 : : #define _SVTOOLS_EMBEDHLP_HXX
31 : :
32 : : #include "svtools/svtdllapi.h"
33 : : #include <com/sun/star/uno/Reference.hxx>
34 : : #include <com/sun/star/embed/XEmbeddedObject.hpp>
35 : : #include <com/sun/star/embed/Aspects.hpp>
36 : : #include <com/sun/star/io/XInputStream.hpp>
37 : : #include <vcl/graph.hxx>
38 : : #include <tools/mapunit.hxx>
39 : : #include <rtl/ustring.hxx>
40 : :
41 : : namespace comphelper
42 : : {
43 : : class EmbeddedObjectContainer;
44 : : }
45 : :
46 : : class Rectangle;
47 : : class OutputDevice;
48 : : class String;
49 : : namespace svt
50 : : {
51 : : struct EmbeddedObjectRef_Impl;
52 : : class SVT_DLLPUBLIC EmbeddedObjectRef
53 : : {
54 : : EmbeddedObjectRef_Impl* mpImp;
55 : : ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject > mxObj;
56 : :
57 : : SVT_DLLPRIVATE SvStream* GetGraphicStream( sal_Bool bUpdate ) const;
58 : : /* SVT_DLLPRIVATE */ void GetReplacement( sal_Bool bUpdate );
59 : : SVT_DLLPRIVATE void Construct_Impl();
60 : :
61 : : EmbeddedObjectRef& operator = ( const EmbeddedObjectRef& );
62 : :
63 : : public:
64 : 7640 : const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& operator ->() const { return mxObj; }
65 : 15312 : const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& GetObject() const { return mxObj; }
66 : :
67 : : static void DrawPaintReplacement( const Rectangle &rRect, const String &rText, OutputDevice *pOut );
68 : : static void DrawShading( const Rectangle &rRect, OutputDevice *pOut );
69 : : static sal_Bool TryRunningState( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& );
70 : : static void SetGraphicToContainer( const Graphic& rGraphic,
71 : : comphelper::EmbeddedObjectContainer& aContainer,
72 : : const ::rtl::OUString& aName,
73 : : const ::rtl::OUString& aMediaType );
74 : :
75 : : static ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetGraphicReplacementStream(
76 : : sal_Int64 nViewAspect,
77 : : const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >&,
78 : : ::rtl::OUString* pMediaType )
79 : : throw();
80 : :
81 : : // default constructed object; needs further assignment before it can be used
82 : : EmbeddedObjectRef();
83 : :
84 : : // assign a previously default constructed object
85 : : void Assign( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xObj, sal_Int64 nAspect );
86 : :
87 : : // create object for a certain view aspect
88 : : EmbeddedObjectRef( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xObj, sal_Int64 nAspect );
89 : :
90 : : ~EmbeddedObjectRef();
91 : : EmbeddedObjectRef( const EmbeddedObjectRef& );
92 : :
93 : : // assigning to a container enables the object to exchange graphical representations with a storage
94 : : void AssignToContainer( comphelper::EmbeddedObjectContainer* pContainer, const ::rtl::OUString& rPersistName );
95 : : comphelper::EmbeddedObjectContainer* GetContainer() const;
96 : :
97 : : sal_Int64 GetViewAspect() const;
98 : : void SetViewAspect( sal_Int64 nAspect );
99 : : Graphic* GetGraphic( ::rtl::OUString* pMediaType=0 ) const;
100 : :
101 : : // the original size of the object ( size of the icon for iconified object )
102 : : // no conversion is done if no target mode is provided
103 : : Size GetSize( MapMode* pTargetMapMode = NULL ) const;
104 : :
105 : : void SetGraphic( const Graphic& rGraphic, const ::rtl::OUString& rMediaType );
106 : : void SetGraphicStream(
107 : : const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInGrStream,
108 : : const ::rtl::OUString& rMediaType );
109 : :
110 : 6816 : void UpdateReplacement() { GetReplacement( sal_True ); }
111 : : void UpdateReplacementOnDemand();
112 : : void Lock( sal_Bool bLock = sal_True );
113 : : sal_Bool IsLocked() const;
114 : : void Clear();
115 : 8394 : sal_Bool is() const { return mxObj.is(); }
116 : :
117 : : sal_Bool IsChart() const;
118 : :
119 : : // #i104867#
120 : : // Provides a graphic version number for the fetchable Graphic during this object's lifetime. Internally,
121 : : // that number is incremented at each change of the Graphic. This mechanism is needed to identify if a
122 : : // remembered Graphic (e.g. primitives) has changed compared to the current one, but without actively
123 : : // fetching the Graphic what would be too expensive e.g. for charts
124 : : sal_uInt32 getGraphicVersion() const;
125 : : void SetDefaultSizeForChart( const Size& rSizeIn_100TH_MM );//#i103460# charts do not necessaryly have an own size within ODF files, in this case they need to use the size settings from the surrounding frame, which is made available with this method
126 : : };
127 : : }
128 : :
129 : : #endif
130 : :
131 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|