LibreOffice Module svtools (master) 1
embedhlp.hxx
Go to the documentation of this file.
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#pragma once
21
22#include <svtools/svtdllapi.h>
23#include <com/sun/star/uno/Reference.hxx>
24#include <vcl/graph.hxx>
25#include <rtl/ustring.hxx>
26#include <memory>
27
28namespace com :: sun :: star :: io { class XInputStream; }
29
30namespace comphelper
31{
32 class EmbeddedObjectContainer;
33}
34
35namespace com::sun::star::embed {
36 class XEmbeddedObject;
37}
38
39class OutputDevice;
40typedef struct _xmlTextWriter* xmlTextWriterPtr;
41
42namespace svt {
43
44struct EmbeddedObjectRef_Impl;
45
47{
48 std::unique_ptr<EmbeddedObjectRef_Impl> mpImpl;
49
50 SVT_DLLPRIVATE std::unique_ptr<SvStream> GetGraphicStream( bool bUpdate ) const;
51 SVT_DLLPRIVATE void GetReplacement( bool bUpdate );
52 SVT_DLLPRIVATE void UpdateOleObject( bool bUpdateOle);
53
54 EmbeddedObjectRef& operator = ( const EmbeddedObjectRef& ) = delete;
55
56public:
57 static void DrawPaintReplacement( const tools::Rectangle &rRect, const OUString &rText, OutputDevice *pOut );
58 static void DrawShading( const tools::Rectangle &rRect, OutputDevice *pOut );
59 static bool TryRunningState( const css::uno::Reference < css::embed::XEmbeddedObject >& );
60 static void SetGraphicToContainer( const Graphic& rGraphic,
62 const OUString& aName,
63 const OUString& aMediaType );
64
65 static css::uno::Reference< css::io::XInputStream > GetGraphicReplacementStream(
66 sal_Int64 nViewAspect,
67 const css::uno::Reference < css::embed::XEmbeddedObject >&,
68 OUString* pMediaType )
69 noexcept;
70
71 static bool IsChart(const css::uno::Reference < css::embed::XEmbeddedObject >& xObj);
72
73 const css::uno::Reference <css::embed::XEmbeddedObject>& operator->() const;
74 const css::uno::Reference <css::embed::XEmbeddedObject>& GetObject() const;
75
76 // default constructed object; needs further assignment before it can be used
78
79 // assign a previously default constructed object
80 void Assign( const css::uno::Reference < css::embed::XEmbeddedObject >& xObj, sal_Int64 nAspect );
81
82 // create object for a certain view aspect
83 EmbeddedObjectRef( const css::uno::Reference < css::embed::XEmbeddedObject >& xObj, sal_Int64 nAspect );
84
87
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;
91
92 sal_Int64 GetViewAspect() const;
93 void SetViewAspect( sal_Int64 nAspect );
94 const Graphic* GetGraphic() const;
95
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 const * pTargetMapMode ) const;
99
100 void SetGraphic( const Graphic& rGraphic, const OUString& rMediaType );
101 void SetGraphicStream(
102 const css::uno::Reference< css::io::XInputStream >& xInGrStream,
103 const OUString& rMediaType );
104
105 // bUpdateOle = false update the Link-Objects
106 // = true update the OLE-Objects
107 void UpdateReplacement( bool bUpdateOle = false );
108 void UpdateReplacementOnDemand();
109 void Lock( bool bLock = true );
110 void Clear();
111 bool is() const;
112
113 bool IsLocked() const;
114
115 void SetIsProtectedHdl(const Link<LinkParamNone*, bool>& rProtectedHdl);
116 const Link<LinkParamNone*, bool> & GetIsProtectedHdl() const;
117
118 bool IsChart() const;
119
120 OUString GetChartType();
121
122 // #i104867#
123 // Provides a graphic version number for the fetchable Graphic during this object's lifetime. Internally,
124 // that number is incremented at each change of the Graphic. This mechanism is needed to identify if a
125 // remembered Graphic (e.g. primitives) has changed compared to the current one, but without actively
126 // fetching the Graphic what would be too expensive e.g. for charts
127 sal_uInt32 getGraphicVersion() const;
128 void SetDefaultSizeForChart( const Size& rSizeIn_100TH_MM );//#i103460# charts do not necessarily 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
129
130 void dumpAsXml(xmlTextWriterPtr pWriter) const;
131};
132
133}
134
135/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
EmbeddedObjectRef(const css::uno::Reference< css::embed::XEmbeddedObject > &xObj, sal_Int64 nAspect)
std::unique_ptr< EmbeddedObjectRef_Impl > mpImpl
Definition: embedhlp.hxx:48
virtual css::uno::Reference< css::embed::XEmbeddedObject > GetObject() override
struct _xmlTextWriter * xmlTextWriterPtr
Definition: embedhlp.hxx:40
struct _xmlTextWriter * xmlTextWriterPtr
void Clear(EHistoryType eHistory)
#define SVT_DLLPUBLIC
Definition: svtdllapi.h:27
#define SVT_DLLPRIVATE
Definition: svtdllapi.h:29