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/.
10 #ifndef INCLUDED_WRITERFILTER_SOURCE_RTFTOK_RTFSDRIMPORT_HXX
11 #define INCLUDED_WRITERFILTER_SOURCE_RTFTOK_RTFSDRIMPORT_HXX
16 #include <dmapper/GraphicZOrderHelper.hxx>
17 #include <tools/ref.hxx>
43 namespace writerfilter
47 class RTFDocumentImpl
;
50 /// Handles the import of drawings using RTF markup.
51 class RTFSdrImport final
: public virtual SvRefBase
54 RTFSdrImport(RTFDocumentImpl
& rDocument
,
55 css::uno::Reference
<css::lang::XComponent
> const& xDstDoc
);
56 ~RTFSdrImport() override
;
63 void resolve(RTFShape
& rShape
, bool bClose
, ShapeOrPict shapeOrPict
);
65 void append(const OUString
& aKey
, const OUString
& aValue
);
66 /// Append property on the current parent.
67 void appendGroupProperty(const OUString
& aKey
, const OUString
& aValue
);
68 void resolveDhgt(css::uno::Reference
<css::beans::XPropertySet
> const& xPropertySet
,
69 sal_Int32 nZOrder
, bool bOldStyle
);
70 /// Set line color and line width on the shape, using the relevant API depending on if the shape is a text frame or not.
72 resolveLineColorAndWidth(bool bTextFrame
,
73 const css::uno::Reference
<css::beans::XPropertySet
>& xPropertySet
,
74 css::uno::Any
const& rLineColor
, css::uno::Any
const& rLineWidth
);
75 static void resolveFLine(css::uno::Reference
<css::beans::XPropertySet
> const& xPropertySet
,
78 * These are the default in Word, but not in Writer.
80 * @param bNew if the frame is new-style or old-style.
82 static std::vector
<css::beans::PropertyValue
> getTextFrameDefaults(bool bNew
);
83 /// Push a new group shape to the parent stack.
84 void pushParent(css::uno::Reference
<css::drawing::XShapes
> const& xParent
);
85 /// Pop the current group shape from the parent stack.
87 css::uno::Reference
<css::drawing::XShape
> const& getCurrentShape() const { return m_xShape
; }
88 bool isFakePict() const { return m_bFakePict
; }
91 void createShape(const OUString
& rService
, css::uno::Reference
<css::drawing::XShape
>& xShape
,
92 css::uno::Reference
<css::beans::XPropertySet
>& xPropertySet
);
93 void applyProperty(css::uno::Reference
<css::drawing::XShape
> const& xShape
,
94 const OUString
& aKey
, const OUString
& aValue
);
95 int initShape(css::uno::Reference
<css::drawing::XShape
>& o_xShape
,
96 css::uno::Reference
<css::beans::XPropertySet
>& o_xPropSet
, bool& o_rIsCustomShape
,
97 RTFShape
const& rShape
, bool bClose
, ShapeOrPict shapeOrPict
);
99 RTFDocumentImpl
& m_rImport
;
100 std::stack
<css::uno::Reference
<css::drawing::XShapes
>> m_aParents
;
101 css::uno::Reference
<css::drawing::XShape
> m_xShape
;
102 /// If m_xShape is imported as a Writer text frame (instead of a drawinglayer rectangle).
104 /// If m_xShape is imported as a Writer text graphic object (instead of a drawinglayer shape).
105 bool m_bTextGraphicObject
;
106 /// if inside \pict, but actually it's a shape (not a picture)
108 std::stack
<writerfilter::dmapper::GraphicZOrderHelper
> m_aGraphicZOrderHelpers
;
110 } // namespace rtftok
111 } // namespace writerfilter
113 #endif // INCLUDED_WRITERFILTER_SOURCE_RTFTOK_RTFSDRIMPORT_HXX
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */