Line data Source code
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 : #ifndef INCLUDED_WRITERFILTER_SOURCE_RTFTOK_RTFSDRIMPORT_HXX
11 : #define INCLUDED_WRITERFILTER_SOURCE_RTFTOK_RTFSDRIMPORT_HXX
12 :
13 : #include <stack>
14 :
15 : #include <rtfdocumentimpl.hxx>
16 :
17 : namespace writerfilter
18 : {
19 : namespace rtftok
20 : {
21 : /// Handles the import of drawings using RTF markup.
22 : class RTFSdrImport
23 : {
24 : public:
25 : RTFSdrImport(RTFDocumentImpl& rImport, css::uno::Reference<css::lang::XComponent> const& xDstDoc);
26 : virtual ~RTFSdrImport();
27 :
28 : enum ShapeOrPict { SHAPE, PICT };
29 : void resolve(RTFShape& rShape, bool bClose, ShapeOrPict shapeOrPict);
30 : void close();
31 : void append(const OUString& aKey, const OUString& aValue);
32 : /// Append property on the current parent.
33 : void appendGroupProperty(const OUString& aKey, const OUString& aValue);
34 : void resolveDhgt(css::uno::Reference<css::beans::XPropertySet> const& xPropertySet, sal_Int32 nZOrder, bool bOldStyle);
35 : void resolveFLine(css::uno::Reference<css::beans::XPropertySet> const& xPropertySet, sal_Int32 nFLine);
36 : /**
37 : * These are the default in Word, but not in Writer.
38 : *
39 : * @param bNew if the frame is new-style or old-style.
40 : */
41 : std::vector<css::beans::PropertyValue> getTextFrameDefaults(bool bNew);
42 : /// Push a new group shape to the parent stack.
43 : void pushParent(css::uno::Reference<css::drawing::XShapes> const& xParent);
44 : /// Pop the current group shape from the parent stack.
45 : void popParent();
46 34 : css::uno::Reference<css::drawing::XShape> const& getCurrentShape()
47 : {
48 34 : return m_xShape;
49 : }
50 38 : bool isFakePict()
51 : {
52 38 : return m_bFakePict;
53 : }
54 : private:
55 : void createShape(const OUString& aService, css::uno::Reference<css::drawing::XShape>& xShape, css::uno::Reference<css::beans::XPropertySet>& xPropertySet);
56 : void applyProperty(css::uno::Reference<css::drawing::XShape> const& xShape, const OUString& aKey, const OUString& aValue);
57 : int initShape(css::uno::Reference<css::drawing::XShape>& o_xShape,
58 : css::uno::Reference<css::beans::XPropertySet>& o_xPropSet,
59 : bool& o_rIsCustomShape,
60 : RTFShape const& rShape, bool bClose, ShapeOrPict const shapeOrPict);
61 :
62 : RTFDocumentImpl& m_rImport;
63 : std::stack< css::uno::Reference<css::drawing::XShapes> > m_aParents;
64 : css::uno::Reference<css::drawing::XShape> m_xShape;
65 : /// If m_xShape is imported as a Writer text frame (instead of a drawinglayer rectangle).
66 : bool m_bTextFrame;
67 : /// if inside \pict, but actually it's a shape (not a picture)
68 : bool m_bFakePict;
69 : };
70 : } // namespace rtftok
71 : } // namespace writerfilter
72 :
73 : #endif // INCLUDED_WRITERFILTER_SOURCE_RTFTOK_RTFSDRIMPORT_HXX
74 :
75 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|