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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SW_INC_NDNOTXT_HXX
20 #define INCLUDED_SW_INC_NDNOTXT_HXX
23 #include <tools/poly.hxx>
28 /// Layout frame for SwNoTextNode, i.e. graphics and OLE nodes (including charts).
29 class SW_DLLPUBLIC SwNoTextNode
: public SwContentNode
32 friend class SwNoTextFrame
;
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
39 mutable bool m_bPixelContour
: 1; // contour map mode is invalid and pixel.
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
;
45 SwNoTextNode( const SwNoTextNode
& ) = delete;
46 SwNoTextNode
&operator=( const SwNoTextNode
& ) = delete;
49 SwNoTextNode( const SwNodeIndex
&rWhere
, const SwNodeType nNdType
,
50 SwGrfFormatColl
*pGrColl
, SwAttrSet
const * pAutoAttr
);
53 virtual ~SwNoTextNode() override
;
55 virtual SwContentFrame
*MakeFrame( SwFrame
* ) override
;
57 SwGrfFormatColl
*GetGrfColl() const { return const_cast<SwGrfFormatColl
*>(static_cast<const SwGrfFormatColl
*>(GetRegisteredIn())); }
59 virtual Size
GetTwipSize() const = 0;
61 virtual bool SavePersistentData();
62 virtual bool RestorePersistentData();
64 OUString
GetTitle() const;
65 void SetTitle( const OUString
& rTitle
);
66 OUString
GetDescription() const;
67 void SetDescription( const OUString
& rDescription
);
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;
76 void SetAutomaticContour( bool bSet
) { m_bAutomaticContour
= bSet
; }
77 bool HasAutomaticContour() const { return m_bAutomaticContour
; }
79 // set either a MM100 or pixel contour
80 void SetContourAPI( const tools::PolyPolygon
*pPoly
);
82 // get either a MM100 or pixel contour, return false if no contour is set.
83 bool GetContourAPI( tools::PolyPolygon
&rPoly
) const;
85 void SetPixelContour( bool bSet
) { m_bPixelContour
= bSet
; }
86 bool IsPixelContour() const;
88 bool IsContourMapModeValid() const { return m_bContourMapModeValid
; }
90 // Obtains the graphic with SwapIn for GrfNode via GetData for OLE.
91 Graphic
GetGraphic() const;
94 // Inline methods from Node.hxx - we know TextNode only here!!
95 inline SwNoTextNode
*SwNode::GetNoTextNode()
97 return SwNodeType::NoTextMask
& m_nNodeType
? static_cast<SwNoTextNode
*>(this) : nullptr;
99 inline const SwNoTextNode
*SwNode::GetNoTextNode() const
101 return SwNodeType::NoTextMask
& m_nNodeType
? static_cast<const SwNoTextNode
*>(this) : nullptr;
104 #endif // INCLUDED_SW_INC_NDNOTXT_HXX
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */