LibreOffice Module oox (master) 1
olehelper.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#ifndef INCLUDED_OOX_OLE_OLEHELPER_HXX
21#define INCLUDED_OOX_OLE_OLEHELPER_HXX
22
23#include <com/sun/star/uno/Reference.hxx>
25#include <oox/dllapi.h>
28#include <rtl/ustring.hxx>
29#include <sal/types.h>
30#include <tools/ref.hxx>
31#include <memory>
32
33namespace com::sun::star {
34 namespace awt { class XControlModel; }
35 namespace awt { struct Size; }
36 namespace form { class XFormComponent; }
37 namespace frame { class XModel; }
38 namespace io { class XOutputStream; }
39 namespace uno { class XComponentContext; }
40}
41
42class SotStorage;
44class SvGlobalName;
45
46namespace oox {
47 class BinaryInputStream;
48 class BinaryOutputStream;
49}
50
51namespace oox::ole {
52 class ControlModelBase;
53 class EmbeddedControl;
54
55
56#define OLE_GUID_STDFONT "{0BE35203-8F91-11CE-9DE3-00AA004BB851}"
57#define OLE_GUID_STDPIC "{0BE35204-8F91-11CE-9DE3-00AA004BB851}"
58
59
60const sal_uInt16 OLE_STDFONT_NORMAL = 400;
61const sal_uInt16 OLE_STDFONT_BOLD = 700;
62
66
69{
70 OUString maName;
71 sal_uInt32 mnHeight;
72 sal_uInt16 mnWeight;
73 sal_uInt16 mnCharSet;
75
76 explicit StdFontInfo();
77 explicit StdFontInfo(
78 OUString aName,
79 sal_uInt32 nHeight );
80};
81
82
85{
86 OUString maTarget;
87 OUString maLocation;
88 OUString maDisplay;
89};
90
91
93namespace OleHelper
94{
101 OOX_DLLPUBLIC ::Color decodeOleColor(
102 const GraphicHelper& rGraphicHelper,
103 sal_uInt32 nOleColor,
104 bool bDefaultColorBgr );
105
108 OOX_DLLPUBLIC sal_uInt32 encodeOleColor( sal_Int32 nRgbColor );
109 inline sal_uInt32 encodeOleColor( Color nRgbColor ) { return encodeOleColor(sal_Int32(nRgbColor)); }
110
114 OOX_DLLPUBLIC OUString importGuid( BinaryInputStream& rInStrm );
115 OOX_DLLPUBLIC void exportGuid( BinaryOutputStream& rOutStrm, const SvGlobalName& rId );
116
121 StdFontInfo& orFontInfo,
122 BinaryInputStream& rInStrm,
123 bool bWithGuid );
124
129 StreamDataSequence& orGraphicData,
130 BinaryInputStream& rInStrm );
131}
132
134{
135 std::unique_ptr<::oox::ole::EmbeddedControl> mpControl;
138 css::uno::Reference< css::frame::XModel > mxDocModel;
139 css::uno::Reference< css::awt::XControlModel > mxControlModel;
140
141 OUString maName;
142 OUString maTypeName;
143 OUString maFullName;
144 OUString maGUID;
145public:
146 OleFormCtrlExportHelper( const css::uno::Reference< css::uno::XComponentContext >& rxCtx, const css::uno::Reference< css::frame::XModel >& xDocModel, const css::uno::Reference< css::awt::XControlModel >& xModel );
148
149 std::u16string_view getGUID() const
150 {
151 std::u16string_view sResult;
152 if ( maGUID.getLength() > 2 )
153 sResult = maGUID.subView(1, maGUID.getLength() - 2 );
154 return sResult;
155 }
156 const OUString& getFullName() const { return maFullName; }
157 const OUString& getTypeName() const { return maTypeName; }
158 const OUString& getName() const { return maName; }
159 bool isValid() const { return mpModel != nullptr; }
160 void exportName( const css::uno::Reference< css::io::XOutputStream >& rxOut );
161 void exportCompObj( const css::uno::Reference< css::io::XOutputStream >& rxOut );
162 void exportControl( const css::uno::Reference< css::io::XOutputStream >& rxOut, const css::awt::Size& rSize, bool bAutoClose = false );
163};
164
165// ideally it would be great to get rid of SvxMSConvertOCXControls
166// however msfilter/source/msfilter/svdfppt.cxx still uses
167// SvxMSConvertOCXControls as a base class, unfortunately oox depends on
168// msfilter. Probably the solution would be to move the svdfppt.cxx
169// implementation into the sd module itself.
171{
172 css::uno::Reference< css::uno::XComponentContext > mxCtx;
174
175protected:
177 css::uno::Reference< css::form::XFormComponent > & rxFormComp,
178 std::u16string_view rGuidString );
180 css::uno::Reference< css::form::XFormComponent > & rxFormComp,
181 const OUString& rGuidString,
182 sal_Int32 nSize );
183public:
184 MSConvertOCXControls( const css::uno::Reference< css::frame::XModel >& rxModel );
185 virtual ~MSConvertOCXControls() override;
186 bool ReadOCXStorage( tools::SvRef<SotStorage> const & rSrc1, css::uno::Reference< css::form::XFormComponent > & rxFormComp );
187 bool ReadOCXCtlsStream(tools::SvRef<SotStorageStream> const & rSrc1, css::uno::Reference< css::form::XFormComponent > & rxFormComp,
188 sal_Int32 nPos, sal_Int32 nSize );
189 static bool WriteOCXStream( const css::uno::Reference< css::frame::XModel >& rxModel, tools::SvRef<SotStorage> const &rSrc1, const css::uno::Reference< css::awt::XControlModel > &rControlModel, const css::awt::Size& rSize,OUString &rName);
190 static bool WriteOCXExcelKludgeStream( const css::uno::Reference< css::frame::XModel >& rxModel, const css::uno::Reference< css::io::XOutputStream >& xOutStrm, const css::uno::Reference< css::awt::XControlModel > &rControlModel, const css::awt::Size& rSize,OUString &rName);
191};
192
193
194} // namespace oox::ole
195
196#endif
197
198/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Interface for binary input stream classes.
Interface for binary output stream classes.
Provides helper functions for colors, device measurement conversion, graphics, and graphic objects ha...
Base class for all models of form controls.
Definition: axcontrol.hxx:347
css::uno::Reference< css::uno::XComponentContext > mxCtx
Definition: olehelper.hxx:172
bool importControlFromStream(::oox::BinaryInputStream &rInStrm, css::uno::Reference< css::form::XFormComponent > &rxFormComp, std::u16string_view rGuidString)
::oox::GraphicHelper maGrfHelper
Definition: olehelper.hxx:173
bool importControlFromStream(::oox::BinaryInputStream &rInStrm, css::uno::Reference< css::form::XFormComponent > &rxFormComp, const OUString &rGuidString, sal_Int32 nSize)
::oox::ole::ControlModelBase * mpModel
Definition: olehelper.hxx:136
std::unique_ptr<::oox::ole::EmbeddedControl > mpControl
Definition: olehelper.hxx:135
std::u16string_view getGUID() const
Definition: olehelper.hxx:149
const OUString & getFullName() const
Definition: olehelper.hxx:156
css::uno::Reference< css::awt::XControlModel > mxControlModel
Definition: olehelper.hxx:139
::oox::GraphicHelper maGrfHelper
Definition: olehelper.hxx:137
const OUString & getTypeName() const
Definition: olehelper.hxx:157
css::uno::Reference< css::frame::XModel > mxDocModel
Definition: olehelper.hxx:138
const OUString & getName() const
Definition: olehelper.hxx:158
OUString maName
Definition: dffdumper.cxx:161
#define OOX_DLLPUBLIC
Definition: dllapi.h:28
OOX_DLLPUBLIC OUString importGuid(BinaryInputStream &rInStrm)
Imports a GUID from the passed binary stream and returns its string representation (in uppercase char...
Definition: olehelper.cxx:261
OOX_DLLPUBLIC::Color decodeOleColor(const GraphicHelper &rGraphicHelper, sal_uInt32 nOleColor, bool bDefaultColorBgr)
Returns the UNO RGB color from the passed encoded OLE color.
Definition: olehelper.cxx:216
OOX_DLLPUBLIC void exportGuid(BinaryOutputStream &rOutStrm, const SvGlobalName &rId)
Definition: olehelper.cxx:253
OOX_DLLPUBLIC bool importStdPic(StreamDataSequence &orGraphicData, BinaryInputStream &rInStrm)
Imports an OLE StdPic picture from the current position of the passed binary stream.
Definition: olehelper.cxx:303
OOX_DLLPUBLIC bool importStdFont(StdFontInfo &orFontInfo, BinaryInputStream &rInStrm, bool bWithGuid)
Imports an OLE StdFont font structure from the current position of the passed binary stream.
Definition: olehelper.cxx:280
OOX_DLLPUBLIC sal_uInt32 encodeOleColor(sal_Int32 nRgbColor)
Returns the OLE color from the passed UNO RGB color.
Definition: olehelper.cxx:248
const sal_uInt16 OLE_STDFONT_NORMAL
Definition: olehelper.hxx:60
const sal_uInt16 OLE_STDFONT_BOLD
Definition: olehelper.hxx:61
const sal_uInt8 OLE_STDFONT_ITALIC
Definition: olehelper.hxx:63
const sal_uInt8 OLE_STDFONT_UNDERLINE
Definition: olehelper.hxx:64
const sal_uInt8 OLE_STDFONT_STRIKE
Definition: olehelper.hxx:65
css::uno::Sequence< sal_Int8 > StreamDataSequence
Stores data about a StdFont font structure.
Definition: olehelper.hxx:69
sal_uInt8 mnFlags
Font flags.
Definition: olehelper.hxx:74
sal_uInt32 mnHeight
Font height (1/10,000 points).
Definition: olehelper.hxx:71
sal_uInt16 mnCharSet
Font charset.
Definition: olehelper.hxx:73
sal_uInt16 mnWeight
Font weight (normal/bold).
Definition: olehelper.hxx:72
OUString maName
Font name.
Definition: olehelper.hxx:70
Stores data about a StdHlink hyperlink.
Definition: olehelper.hxx:85
unsigned char sal_uInt8