LibreOffice Module writerfilter (master) 1
rtfsdrimport.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
10#pragma once
11
12#include <stack>
13#include <vector>
14
16#include <tools/ref.hxx>
17
18namespace com::sun::star
19{
20namespace beans
21{
22class XPropertySet;
23struct PropertyValue;
24}
25namespace drawing
26{
27class XShape;
28class XShapes;
29}
30namespace lang
31{
32class XComponent;
33}
34}
35
37{
38class RTFDocumentImpl;
39class RTFShape;
40
42class RTFSdrImport final : public virtual SvRefBase
43{
44public:
46 css::uno::Reference<css::lang::XComponent> const& xDstDoc);
47 ~RTFSdrImport() override;
48
50 {
52 PICT
53 };
54 void resolve(RTFShape& rShape, bool bClose, ShapeOrPict shapeOrPict);
55 void close();
56 void append(std::u16string_view aKey, std::u16string_view aValue);
58 void appendGroupProperty(std::u16string_view aKey, std::u16string_view aValue);
59 void resolveDhgt(css::uno::Reference<css::beans::XPropertySet> const& xPropertySet,
60 sal_Int32 nZOrder, bool bOldStyle);
62 static void
63 resolveLineColorAndWidth(bool bTextFrame,
64 const css::uno::Reference<css::beans::XPropertySet>& xPropertySet,
65 css::uno::Any const& rLineColor, css::uno::Any const& rLineWidth);
66 static void resolveFLine(css::uno::Reference<css::beans::XPropertySet> const& xPropertySet,
67 sal_Int32 nFLine);
73 static std::vector<css::beans::PropertyValue> getTextFrameDefaults(bool bNew);
75 void pushParent(css::uno::Reference<css::drawing::XShapes> const& xParent);
77 void popParent();
78 css::uno::Reference<css::drawing::XShape> const& getCurrentShape() const { return m_xShape; }
79 bool isFakePict() const { return m_bFakePict; }
80
81private:
82 void createShape(const OUString& rService, css::uno::Reference<css::drawing::XShape>& xShape,
83 css::uno::Reference<css::beans::XPropertySet>& xPropertySet);
84 void applyProperty(css::uno::Reference<css::drawing::XShape> const& xShape,
85 std::u16string_view aKey, std::u16string_view aValue) const;
86 int initShape(css::uno::Reference<css::drawing::XShape>& o_xShape,
87 css::uno::Reference<css::beans::XPropertySet>& o_xPropSet, bool& o_rIsCustomShape,
88 RTFShape const& rShape, bool bClose, ShapeOrPict shapeOrPict);
89
91 std::stack<css::uno::Reference<css::drawing::XShapes>> m_aParents;
92 css::uno::Reference<css::drawing::XShape> m_xShape;
99 std::stack<writerfilter::dmapper::GraphicZOrderHelper> m_aGraphicZOrderHelpers;
100};
101} // namespace writerfilter::rtftok
102
103/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Implementation of the RTFDocument interface.
Handles the import of drawings using RTF markup.
void createShape(const OUString &rService, css::uno::Reference< css::drawing::XShape > &xShape, css::uno::Reference< css::beans::XPropertySet > &xPropertySet)
bool m_bTextGraphicObject
If m_xShape is imported as a Writer text graphic object (instead of a drawinglayer shape).
void resolve(RTFShape &rShape, bool bClose, ShapeOrPict shapeOrPict)
static void resolveFLine(css::uno::Reference< css::beans::XPropertySet > const &xPropertySet, sal_Int32 nFLine)
css::uno::Reference< css::drawing::XShape > m_xShape
void popParent()
Pop the current group shape from the parent stack.
css::uno::Reference< css::drawing::XShape > const & getCurrentShape() const
bool m_bTextFrame
If m_xShape is imported as a Writer text frame (instead of a drawinglayer rectangle).
void pushParent(css::uno::Reference< css::drawing::XShapes > const &xParent)
Push a new group shape to the parent stack.
void append(std::u16string_view aKey, std::u16string_view aValue)
int initShape(css::uno::Reference< css::drawing::XShape > &o_xShape, css::uno::Reference< css::beans::XPropertySet > &o_xPropSet, bool &o_rIsCustomShape, RTFShape const &rShape, bool bClose, ShapeOrPict shapeOrPict)
void resolveDhgt(css::uno::Reference< css::beans::XPropertySet > const &xPropertySet, sal_Int32 nZOrder, bool bOldStyle)
RTFSdrImport(RTFDocumentImpl &rDocument, css::uno::Reference< css::lang::XComponent > const &xDstDoc)
static void resolveLineColorAndWidth(bool bTextFrame, const css::uno::Reference< css::beans::XPropertySet > &xPropertySet, css::uno::Any const &rLineColor, css::uno::Any const &rLineWidth)
Set line color and line width on the shape, using the relevant API depending on if the shape is a tex...
void appendGroupProperty(std::u16string_view aKey, std::u16string_view aValue)
Append property on the current parent.
void applyProperty(css::uno::Reference< css::drawing::XShape > const &xShape, std::u16string_view aKey, std::u16string_view aValue) const
std::stack< css::uno::Reference< css::drawing::XShapes > > m_aParents
bool m_bFakePict
if inside \pict, but actually it's a shape (not a picture)
static std::vector< css::beans::PropertyValue > getTextFrameDefaults(bool bNew)
These are the default in Word, but not in Writer.
std::stack< writerfilter::dmapper::GraphicZOrderHelper > m_aGraphicZOrderHelpers
Stores the properties of a shape.
class SAL_NO_VTABLE XPropertySet