LibreOffice Module sw (master) 1
ndnotxt.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#ifndef INCLUDED_SW_INC_NDNOTXT_HXX
20#define INCLUDED_SW_INC_NDNOTXT_HXX
21
22#include <optional>
23#include <tools/poly.hxx>
24#include "node.hxx"
25
26class Size;
27
30{
31 friend class SwNodes;
32 friend class SwNoTextFrame;
33
34 mutable std::optional<tools::PolyPolygon> m_pContour;
35 bool m_bAutomaticContour : 1; // automatic contour polygon, not manipulated
36 mutable bool m_bContourMapModeValid : 1; // contour map mode is not the graphics's
37 // preferred map mode, but either
38 // MM100 or pixel
39 mutable bool m_bPixelContour : 1; // contour map mode is invalid and pixel.
40
41 // Creates for all derivations an AttrSet with ranges for frame- and
42 // graphics-attributes (only called by SwContentNode).
43 virtual void NewAttrSet( SwAttrPool& ) override;
44
45 SwNoTextNode( const SwNoTextNode& ) = delete;
46 SwNoTextNode &operator=( const SwNoTextNode& ) = delete;
47
48protected:
49 SwNoTextNode( SwNode& rWhere, const SwNodeType nNdType,
50 SwGrfFormatColl *pGrColl, SwAttrSet const * pAutoAttr );
51
52public:
53 virtual ~SwNoTextNode() override;
54
55 virtual SwContentFrame *MakeFrame( SwFrame* ) override;
56
57 SwGrfFormatColl *GetGrfColl() const { return const_cast<SwGrfFormatColl*>(static_cast<const SwGrfFormatColl*>(GetRegisteredIn())); }
58
59 virtual Size GetTwipSize() const = 0;
60
61 virtual bool SavePersistentData();
62 virtual bool RestorePersistentData();
63
64 OUString GetTitle() const;
65 void SetTitle( const OUString& rTitle );
66 OUString GetDescription() const;
67 void SetDescription( const OUString& rDescription );
68
69 void SetContour( const tools::PolyPolygon *pPoly,
70 bool bAutomatic = false );
71 const tools::PolyPolygon *HasContour() const;
72 bool HasContour_() const { return bool(m_pContour); };
73 void GetContour( tools::PolyPolygon &rPoly ) const;
74 void CreateContour();
75
76 void SetAutomaticContour( bool bSet ) { m_bAutomaticContour = bSet; }
77 bool HasAutomaticContour() const { return m_bAutomaticContour; }
78
79 // set either a MM100 or pixel contour
80 void SetContourAPI( const tools::PolyPolygon *pPoly );
81
82 // get either a MM100 or pixel contour, return false if no contour is set.
83 bool GetContourAPI( tools::PolyPolygon &rPoly ) const;
84
85 void SetPixelContour( bool bSet ) { m_bPixelContour = bSet; }
86 bool IsPixelContour() const;
87
88 bool IsContourMapModeValid() const { return m_bContourMapModeValid; }
89
90 // Obtains the graphic with SwapIn for GrfNode via GetData for OLE.
91 Graphic GetGraphic() const;
92};
93
94// Inline methods from Node.hxx - we know TextNode only here!!
96{
97 return SwNodeType::NoTextMask & m_nNodeType ? static_cast<SwNoTextNode*>(this) : nullptr;
98}
100{
101 return SwNodeType::NoTextMask & m_nNodeType ? static_cast<const SwNoTextNode*>(this) : nullptr;
102}
103
104#endif // INCLUDED_SW_INC_NDNOTXT_HXX
105
106/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
Definition: cntfrm.hxx:59
virtual SwContentFrame * MakeFrame(SwFrame *pSib)=0
MakeFrame will be called for a certain layout pSib is another SwFrame of the same layout (e....
virtual void NewAttrSet(SwAttrPool &)=0
Make respective nodes create the specific AttrSets.
Base class of the Writer layout elements.
Definition: frame.hxx:315
const SwModify * GetRegisteredIn() const
Definition: calbck.hxx:166
Layout frame for SwNoTextNode, i.e. graphics and OLE nodes (including charts).
Definition: ndnotxt.hxx:30
SwNoTextNode(const SwNoTextNode &)=delete
SwGrfFormatColl * GetGrfColl() const
Definition: ndnotxt.hxx:57
bool m_bAutomaticContour
Definition: ndnotxt.hxx:35
void SetAutomaticContour(bool bSet)
Definition: ndnotxt.hxx:76
bool HasContour_() const
Definition: ndnotxt.hxx:72
bool HasAutomaticContour() const
Definition: ndnotxt.hxx:77
bool IsContourMapModeValid() const
Definition: ndnotxt.hxx:88
bool m_bPixelContour
Definition: ndnotxt.hxx:39
virtual Size GetTwipSize() const =0
void SetPixelContour(bool bSet)
Definition: ndnotxt.hxx:85
std::optional< tools::PolyPolygon > m_pContour
Definition: ndnotxt.hxx:34
bool m_bContourMapModeValid
Definition: ndnotxt.hxx:36
SwNoTextNode & operator=(const SwNoTextNode &)=delete
Base class of the Writer document model elements.
Definition: node.hxx:98
SwNodeType m_nNodeType
Definition: node.hxx:101
SwNoTextNode * GetNoTextNode()
Definition: ndnotxt.hxx:95
virtual void SetTitle(const OUString &rNewTitle) override
virtual void GetDescription(OUString &rName) override
UNOTOOLS_DLLPUBLIC bool GetTitle(OUString const &url, OUString *title)
SwNodeType
Definition: ndtyp.hxx:28
#define SW_DLLPUBLIC
Definition: swdllapi.h:28