1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SVTOOLS_EMBEDHLP_HXX
21 #define INCLUDED_SVTOOLS_EMBEDHLP_HXX
23 #include <svtools/svtdllapi.h>
24 #include <com/sun/star/uno/Reference.hxx>
25 #include <com/sun/star/io/XInputStream.hpp>
26 #include <vcl/graph.hxx>
27 #include <tools/mapunit.hxx>
28 #include <rtl/ustring.hxx>
32 class EmbeddedObjectContainer
;
35 namespace com
{ namespace sun
{ namespace star
{ namespace embed
{
36 class XEmbeddedObject
;
44 struct EmbeddedObjectRef_Impl
;
46 class SVT_DLLPUBLIC EmbeddedObjectRef
48 EmbeddedObjectRef_Impl
* mpImpl
;
50 SVT_DLLPRIVATE SvStream
* GetGraphicStream( bool bUpdate
) const;
51 SVT_DLLPRIVATE
void GetReplacement( bool bUpdate
);
53 EmbeddedObjectRef
& operator = ( const EmbeddedObjectRef
& ) SAL_DELETED_FUNCTION
;
56 static void DrawPaintReplacement( const Rectangle
&rRect
, const OUString
&rText
, OutputDevice
*pOut
);
57 static void DrawShading( const Rectangle
&rRect
, OutputDevice
*pOut
);
58 static bool TryRunningState( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XEmbeddedObject
>& );
59 static void SetGraphicToContainer( const Graphic
& rGraphic
,
60 comphelper::EmbeddedObjectContainer
& aContainer
,
61 const OUString
& aName
,
62 const OUString
& aMediaType
);
64 static ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
> GetGraphicReplacementStream(
65 sal_Int64 nViewAspect
,
66 const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XEmbeddedObject
>&,
67 OUString
* pMediaType
)
70 static bool IsChart(const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XEmbeddedObject
>& xObj
);
71 static bool IsGLChart(const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XEmbeddedObject
>& xObj
);
73 const com::sun::star::uno::Reference
<com::sun::star::embed::XEmbeddedObject
>& operator->() const;
74 const com::sun::star::uno::Reference
<com::sun::star::embed::XEmbeddedObject
>& GetObject() const;
76 // default constructed object; needs further assignment before it can be used
79 // assign a previously default constructed object
80 void Assign( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XEmbeddedObject
>& xObj
, sal_Int64 nAspect
);
82 // create object for a certain view aspect
83 EmbeddedObjectRef( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XEmbeddedObject
>& xObj
, sal_Int64 nAspect
);
86 EmbeddedObjectRef( const EmbeddedObjectRef
& );
88 // assigning to a container enables the object to exchange graphical representations with a storage
89 void AssignToContainer( comphelper::EmbeddedObjectContainer
* pContainer
, const OUString
& rPersistName
);
90 comphelper::EmbeddedObjectContainer
* GetContainer() const;
92 sal_Int64
GetViewAspect() const;
93 void SetViewAspect( sal_Int64 nAspect
);
94 const Graphic
* GetGraphic( OUString
* pMediaType
= NULL
) const;
96 // the original size of the object ( size of the icon for iconified object )
97 // no conversion is done if no target mode is provided
98 Size
GetSize( MapMode
* pTargetMapMode
= NULL
) const;
100 void SetGraphic( const Graphic
& rGraphic
, const OUString
& rMediaType
);
101 void SetGraphicStream(
102 const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
>& xInGrStream
,
103 const OUString
& rMediaType
);
105 void UpdateReplacement();
106 void UpdateReplacementOnDemand();
107 void Lock( bool bLock
= true );
111 bool IsLocked() const;
112 bool IsChart() const;
113 bool IsGLChart() const;
115 OUString
GetChartType();
118 // Provides a graphic version number for the fetchable Graphic during this object's lifetime. Internally,
119 // that number is incremented at each change of the Graphic. This mechanism is needed to identify if a
120 // remembered Graphic (e.g. primitives) has changed compared to the current one, but without actively
121 // fetching the Graphic what would be too expensive e.g. for charts
122 sal_uInt32
getGraphicVersion() const;
123 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
130 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */