LibreOffice Module sw (master) 1
frmfmt.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_FRMFMT_HXX
20#define INCLUDED_SW_INC_FRMFMT_HXX
21
22#include <memory>
23#include <com/sun/star/text/PositionLayoutDir.hpp>
25#include <tools/gen.hxx>
26namespace sw
27{
28 template<class T> class FrameFormats;
29 class SpzFrameFormat;
30}
31#include "format.hxx"
32#include "hintids.hxx"
33#include "swdllapi.h"
34#include <list>
35#include "textboxhelper.hxx"
36
37class Graphic;
38class IMapObject;
39class ImageMap;
40class SdrObject;
44class SwFlyFrame;
46class SwRect;
47class SwRootFrame;
48class SwTableBox;
49
50namespace sw
51{
52 class DocumentLayoutManager;
53 // This is cheating: we are not really decoupling much with this hint.
54 // SwDrawFrameFormat should probably bookkeep its SdrObject (and
55 // SwDrawFrameFormat too) as members
57 {
60 : SfxHint(SfxHintId::SwFindSdrObject), m_rpObject(rpObject) {};
61 virtual ~FindSdrObjectHint() override;
62 };
63 template<class T> class FrameFormats;
64 class SpzFrameFormat;
65}
66class SwFormatsBase;
67class SwTableFormat;
68
71 : public SwFormat
72{
73 friend class SwDoc;
74 friend class SwPageDesc;
75 friend class ::sw::DocumentLayoutManager;
76 friend class sw::FrameFormats<SwTableFormat*>;
77 friend class sw::FrameFormats<sw::SpzFrameFormat*>;
78 friend class sw::FrameFormats<SwFrameFormat*>;
79 friend class SwTextBoxHelper;
80 friend class SwUndoFlyBase;
81
82 css::uno::WeakReference<css::uno::XInterface> m_wXObject;
83
84 // DrawingLayer FillAttributes in a preprocessed form for primitive usage
86
87 // The assigned SwFrmFmt list.
88 SwFormatsBase* m_ffList;
89
90 std::shared_ptr< SwTextBoxNode > m_pOtherTextBoxFormats;
91
93 {
94 change_name(const OUString &rName) : mName(rName) {}
95 void operator()(SwFormat *pFormat) { pFormat->m_aFormatName = mName; }
96 const OUString &mName;
97 };
98
99protected:
101 SwAttrPool& rPool,
102 const char* pFormatNm,
103 SwFrameFormat *pDrvdFrame,
104 sal_uInt16 nFormatWhich = RES_FRMFMT,
105 const WhichRangesContainer& pWhichRange = aFrameFormatSetRange);
106
108 SwAttrPool& rPool,
109 const OUString &rFormatNm,
110 SwFrameFormat *pDrvdFrame,
111 sal_uInt16 nFormatWhich = RES_FRMFMT,
112 const WhichRangesContainer& pWhichRange = aFrameFormatSetRange);
113
114 virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
115
116public:
117
118 const std::shared_ptr< SwTextBoxNode >& GetOtherTextBoxFormats() const { return m_pOtherTextBoxFormats; };
119 void SetOtherTextBoxFormats(const std::shared_ptr<SwTextBoxNode>& rNew) { m_pOtherTextBoxFormats = rNew; };
120
121 virtual ~SwFrameFormat() override;
122
123 SwFrameFormat(SwFrameFormat const &) = default;
127
129 virtual void DelFrames();
130
132 virtual void MakeFrames();
133
134 virtual Graphic MakeGraphic( ImageMap* pMap = nullptr, const sal_uInt32 nMaximumQuadraticPixels = 500000, const std::optional<Size>& rTargetDPI = std::nullopt );
135
140 IMapObject* GetIMapObject( const Point& rPoint,
141 const SwFlyFrame *pFly = nullptr ) const;
142
146 SwRect FindLayoutRect( const bool bPrtArea = false,
147 const Point* pPoint = nullptr ) const;
148
154 {
155 SdrObject* pObject(nullptr);
156 CallSwClientNotify(sw::FindSdrObjectHint(pObject));
157 return pObject;
158 }
160 { return const_cast<SwFrameFormat*>(this)->FindSdrObject(); }
161
162 SdrObject *FindRealSdrObject();
164 { return const_cast<SwFrameFormat*>(this)->FindRealSdrObject(); }
165
166 bool IsLowerOf( const SwFrameFormat& rFormat ) const;
167
169 {
172 VERT_R2L
173 };
174
175 virtual SwFrameFormat::tLayoutDir GetLayoutDir() const;
176 virtual void SetLayoutDir( const SwFrameFormat::tLayoutDir _eLayoutDir );
177
178 virtual sal_Int16 GetPositionLayoutDir() const;
179 virtual void SetPositionLayoutDir( const sal_Int16 _nPositionLayoutDir );
180
181 virtual OUString GetDescription() const;
182
183 SAL_DLLPRIVATE css::uno::WeakReference<css::uno::XInterface> const& GetXObject() const
184 { return m_wXObject; }
185 SAL_DLLPRIVATE void SetXObject(css::uno::Reference<css::uno::XInterface> const& xObject)
186 { m_wXObject = xObject; }
187
188 void RegisterToFormat( SwFormat& rFormat );
189
190 // Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage
191 virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const override;
192 virtual bool supportsFullDrawingLayerFillAttributeSet() const override;
193
194 void dumpAsXml(xmlTextWriterPtr pWriter) const;
195
196 virtual void SetFormatName( const OUString& rNewName, bool bBroadcast=false ) override;
197 void MoveTableBox(SwTableBox& rTableBox, const SwFrameFormat* pOldFormat);
198 virtual bool IsVisible() const;
199};
200
201namespace sw
202{
204 friend ::SwDrawFrameFormat;
205 friend ::SwFlyFrameFormat;
207 SwAttrPool& rPool,
208 const OUString& rFormatName,
209 SwFrameFormat* pDerivedFrame,
210 sal_uInt16 nFormatWhich)
211 : SwFrameFormat(rPool, rFormatName, pDerivedFrame, nFormatWhich)
212 {
213 assert(nFormatWhich == RES_DRAWFRMFMT || nFormatWhich == RES_FLYFRMFMT);
214 };
215 };
216}
217// The FlyFrame-Format
218
220{
221 friend class SwDoc;
222 OUString msTitle;
223 OUString msDesc;
225 OUString msTooltip;
226
232 std::unique_ptr<SwFlyDrawContact> m_pContact;
233
234 SwFlyFrameFormat( const SwFlyFrameFormat &rCpy ) = delete;
236
237 SwFlyFrameFormat( SwAttrPool& rPool, const OUString &rFormatNm, SwFrameFormat *pDrvdFrame );
238
239public:
240 virtual ~SwFlyFrameFormat() override;
241
243 virtual void MakeFrames() override;
244
245 SwFlyFrame* GetFrame( const Point* pDocPos = nullptr ) const;
246
247 SwAnchoredObject* GetAnchoredObj() const;
248
249 virtual Graphic MakeGraphic( ImageMap* pMap = nullptr, const sal_uInt32 nMaximumQuadraticPixels = 500000, const std::optional<Size>& rTargetDPI = std::nullopt ) override;
250
251 OUString GetObjTitle() const;
252 void SetObjTitle( const OUString& rTitle, bool bBroadcast = false );
253
254 const OUString & GetObjTooltip() const;
255 void SetObjTooltip(const OUString& rTooltip);
256
257 OUString GetObjDescription() const;
258 void SetObjDescription( const OUString& rDescription, bool bBroadcast = false );
259 void SetObjDecorative(bool isDecorative);
260
270 virtual bool IsBackgroundTransparent() const override;
271
281 bool IsBackgroundBrushInherited() const;
282
283 const Point & GetLastFlyFramePrtRectPos() const { return m_aLastFlyFramePrtRectPos; }
284 void SetLastFlyFramePrtRectPos( const Point &rPoint ) { m_aLastFlyFramePrtRectPos = rPoint; }
285
286 SwFlyDrawContact* GetOrCreateContact();
287};
288
289//The DrawFrame-Format
290
291
293class SwDrawContact;
294class SdrTextObj;
295
296namespace sw
297{
299 DYING,
307 };
309 {
313 virtual ~DrawFrameFormatHint() override;
314 };
316 {
318 CheckDrawFrameFormatLayerHint(bool* bCheckControlLayer)
320 m_bCheckControlLayer(bCheckControlLayer) {};
321 virtual ~CheckDrawFrameFormatLayerHint() override;
322 };
324 {
328 m_ppObject(ppObject) {};
329 virtual ~ContactChangedHint() override;
330 };
332 {
337 m_rDestFormat(rDestFormat), m_rDestDoc(rDestDoc) {};
338 virtual ~DrawFormatLayoutCopyHint() override;
339 };
340 enum class WW8AnchorConv
341 {
342 NO_CONV,
343 CONV2PG,
345 CONV2CHAR,
346 CONV2LINE,
348 };
350 {
355 WW8AnchorConvResult(WW8AnchorConv eHoriConv, WW8AnchorConv eVertConv) : m_eHoriConv(eHoriConv), m_eVertConv(eVertConv), m_bConverted(false) {};
356 };
358 {
362 m_rResult(rResult) {};
363 virtual ~WW8AnchorConvHint() override;
364 };
366 {
370 m_aPos(aPos) {};
371 virtual ~RestoreFlyAnchorHint() override;
372 };
374 {
378 m_ppContact(ppContact) {};
379 virtual ~CreatePortionHint() override;
380 };
382 {
383 std::list<SdrTextObj*>& m_rTextObjects;
384 CollectTextObjectsHint(std::list<SdrTextObj*>& rTextObjects)
386 m_rTextObjects(rTextObjects) {};
387 virtual ~CollectTextObjectsHint() override;
388 };
389 struct GetZOrderHint final : SfxHint
390 {
391 sal_uInt32& m_rnZOrder;
392 GetZOrderHint(sal_uInt32& rnZOrder)
394 m_rnZOrder(rnZOrder) {};
395 virtual ~GetZOrderHint() override;
396 };
398 {
401 GetObjectConnectedHint(bool& risConnected, const SwRootFrame* pRoot)
403 m_risConnected(risConnected), m_pRoot(pRoot) {};
404 virtual ~GetObjectConnectedHint() override;
405 };
406}
407
409{
410 friend class SwDoc;
411
414
415 SwDrawFrameFormat( const SwDrawFrameFormat &rCpy ) = delete;
417
419
421
423
424 SwDrawFrameFormat(SwAttrPool& rPool, const OUString& rFormatName, SwFrameFormat* pDerivedFrame)
425 : sw::SpzFrameFormat(rPool, rFormatName, pDerivedFrame, RES_DRAWFRMFMT),
426 m_pSdrObjectCached(nullptr),
427 meLayoutDir(SwFrameFormat::HORI_L2R),
428 mnPositionLayoutDir(css::text::PositionLayoutDir::PositionInLayoutDirOfAnchor),
429 mbPosAttrSet(false)
430 {}
431
432public:
433 virtual ~SwDrawFrameFormat() override;
434
437 virtual void DelFrames() override;
438
441 virtual void MakeFrames() override;
442
443 virtual Graphic MakeGraphic( ImageMap* pMap = nullptr, const sal_uInt32 nMaximumQuadraticPixels = 500000, const std::optional<Size>& rTargetDPI = std::nullopt ) override;
444
445 virtual SwFrameFormat::tLayoutDir GetLayoutDir() const override;
446 virtual void SetLayoutDir( const SwFrameFormat::tLayoutDir _eLayoutDir ) override;
447
448 virtual sal_Int16 GetPositionLayoutDir() const override;
449 virtual void SetPositionLayoutDir( const sal_Int16 _nPositionLayoutDir ) override;
450
451 bool IsPosAttrSet() const { return mbPosAttrSet; }
452 void PosAttrSet() { mbPosAttrSet = true; }
453
454 virtual OUString GetDescription() const override;
455};
456
457namespace sw {
458
460
461void CheckAnchoredFlyConsistency(SwDoc const& rDoc);
462
463}
464
465#endif
466
467/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SfxHint & operator=(SfxHint const &)=default
wrapper class for the positioning of Writer fly frames and drawing objects
Definition: doc.hxx:197
ContactObject for connection of formats as representatives of draw objects in SwClient and the object...
Definition: dcontact.hxx:305
SwDrawFrameFormat & operator=(const SwDrawFrameFormat &rCpy)=delete
SwDrawFrameFormat(SwAttrPool &rPool, const OUString &rFormatName, SwFrameFormat *pDerivedFrame)
Definition: frmfmt.hxx:424
const SdrObject * m_pSdrObjectCached
Definition: frmfmt.hxx:412
OUString m_sSdrObjectCachedComment
Definition: frmfmt.hxx:413
SwFrameFormat::tLayoutDir meLayoutDir
Definition: frmfmt.hxx:418
bool IsPosAttrSet() const
Definition: frmfmt.hxx:451
sal_Int16 mnPositionLayoutDir
Definition: frmfmt.hxx:420
void PosAttrSet()
Definition: frmfmt.hxx:452
SwDrawFrameFormat(const SwDrawFrameFormat &rCpy)=delete
ContactObject for connection between frames (or their formats respectively) in SwClient and the drawo...
Definition: dcontact.hxx:177
OUString msDesc
Definition: frmfmt.hxx:223
OUString msTitle
Definition: frmfmt.hxx:222
const Point & GetLastFlyFramePrtRectPos() const
Definition: frmfmt.hxx:283
Point m_aLastFlyFramePrtRectPos
Both not existent.
Definition: frmfmt.hxx:231
OUString msTooltip
A tooltip has priority over an SwFormatURL and is not persisted to files.
Definition: frmfmt.hxx:225
std::unique_ptr< SwFlyDrawContact > m_pContact
Definition: frmfmt.hxx:232
SwFlyFrameFormat & operator=(const SwFlyFrameFormat &rCpy)=delete
void SetLastFlyFramePrtRectPos(const Point &rPoint)
Definition: frmfmt.hxx:284
SwFlyFrameFormat(const SwFlyFrameFormat &rCpy)=delete
general base class for all free-flowing frames
Definition: flyfrm.hxx:79
Base class for various Writer styles.
Definition: format.hxx:47
OUString m_aFormatName
Definition: format.hxx:50
provides some methods for generic operations on lists that contain SwFormat* subclasses.
Definition: docary.hxx:44
Style of a layout element.
Definition: frmfmt.hxx:72
SAL_DLLPRIVATE css::uno::WeakReference< css::uno::XInterface > const & GetXObject() const
Definition: frmfmt.hxx:183
const SdrObject * FindRealSdrObject() const
Definition: frmfmt.hxx:163
SwFrameFormat(SwFrameFormat const &)=default
SwFrameFormat(SwFrameFormat &&)=default
void SetOtherTextBoxFormats(const std::shared_ptr< SwTextBoxNode > &rNew)
Definition: frmfmt.hxx:119
SAL_DLLPRIVATE void SetXObject(css::uno::Reference< css::uno::XInterface > const &xObject)
Definition: frmfmt.hxx:185
const std::shared_ptr< SwTextBoxNode > & GetOtherTextBoxFormats() const
Definition: frmfmt.hxx:118
const SdrObject * FindSdrObject() const
Definition: frmfmt.hxx:159
SdrObject * FindSdrObject()
Definition: frmfmt.hxx:153
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
The root element of a Writer document layout.
Definition: rootfrm.hxx:85
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:443
A TextBox is a TextFrame, that is tied to a drawinglayer shape.
SpzFrameFormat(SwAttrPool &rPool, const OUString &rFormatName, SwFrameFormat *pDerivedFrame, sal_uInt16 nFormatWhich)
Definition: frmfmt.hxx:206
struct _xmlTextWriter * xmlTextWriterPtr
virtual void GetDescription(OUString &rName) override
EmbeddedObjectRef * pObject
void MakeFrames(SwDoc *pDoc, SwNode &rSttIdx, SwNode &rEndIdx)
Definition: frmtool.cxx:2026
SfxHintId
@ SwCollectTextObjects
@ SwGetObjectConnected
@ SwRestoreFlyAnchor
@ SwCheckDrawFrameFormatLayer
@ SwDrawFormatLayoutCopy
@ SwContactChanged
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(162)
constexpr TypedWhichId< SwDrawFrameFormat > RES_DRAWFRMFMT(165)
constexpr TypedWhichId< SwFrameFormat > RES_FRMFMT(161)
WhichRangesContainer const aFrameFormatSetRange(svl::Items< RES_FRMATR_BEGIN, RES_FRMATR_END-1, RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1, XATTR_FILL_FIRST, XATTR_FILL_LAST >)
def text(shape, orig_st)
std::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr
Definition: format.hxx:41
Dialog to specify the properties of date form field.
DrawFrameFormatHintId
Definition: frmfmt.hxx:298
void CheckAnchoredFlyConsistency(SwDoc const &rDoc)
Definition: atrfrm.cxx:3663
bool IsFlyFrameFormatInHeader(const SwFrameFormat &rFormat)
Definition: atrfrm.cxx:3638
WW8AnchorConv
Definition: frmfmt.hxx:341
void operator()(SwFormat *pFormat)
Definition: frmfmt.hxx:95
const OUString & mName
Definition: frmfmt.hxx:96
change_name(const OUString &rName)
Definition: frmfmt.hxx:94
CheckDrawFrameFormatLayerHint(bool *bCheckControlLayer)
Definition: frmfmt.hxx:318
virtual ~CheckDrawFrameFormatLayerHint() override
Definition: atrfrm.cxx:3458
CollectTextObjectsHint(std::list< SdrTextObj * > &rTextObjects)
Definition: frmfmt.hxx:384
virtual ~CollectTextObjectsHint() override
Definition: atrfrm.cxx:3465
std::list< SdrTextObj * > & m_rTextObjects
Definition: frmfmt.hxx:383
ContactChangedHint(SdrObject **ppObject)
Definition: frmfmt.hxx:326
SdrObject ** m_ppObject
Definition: frmfmt.hxx:325
virtual ~ContactChangedHint() override
Definition: atrfrm.cxx:3459
SwDrawContact ** m_ppContact
Definition: frmfmt.hxx:375
CreatePortionHint(SwDrawContact **ppContact)
Definition: frmfmt.hxx:376
virtual ~CreatePortionHint() override
Definition: atrfrm.cxx:3463
virtual ~DrawFormatLayoutCopyHint() override
Definition: atrfrm.cxx:3460
SwDrawFrameFormat & m_rDestFormat
Definition: frmfmt.hxx:333
DrawFormatLayoutCopyHint(SwDrawFrameFormat &rDestFormat, SwDoc &rDestDoc)
Definition: frmfmt.hxx:335
DrawFrameFormatHintId m_eId
Definition: frmfmt.hxx:310
DrawFrameFormatHint(DrawFrameFormatHintId eId)
Definition: frmfmt.hxx:311
virtual ~DrawFrameFormatHint() override
Definition: atrfrm.cxx:3457
SdrObject *& m_rpObject
Definition: frmfmt.hxx:58
FindSdrObjectHint(SdrObject *&rpObject)
Definition: frmfmt.hxx:59
GetObjectConnectedHint(bool &risConnected, const SwRootFrame *pRoot)
Definition: frmfmt.hxx:401
virtual ~GetObjectConnectedHint() override
Definition: atrfrm.cxx:3467
const SwRootFrame * m_pRoot
Definition: frmfmt.hxx:400
sal_uInt32 & m_rnZOrder
Definition: frmfmt.hxx:391
GetZOrderHint(sal_uInt32 &rnZOrder)
Definition: frmfmt.hxx:392
virtual ~GetZOrderHint() override
Definition: atrfrm.cxx:3466
virtual ~RestoreFlyAnchorHint() override
Definition: atrfrm.cxx:3462
RestoreFlyAnchorHint(Point aPos)
Definition: frmfmt.hxx:368
WW8AnchorConvResult & m_rResult
Definition: frmfmt.hxx:359
WW8AnchorConvHint(WW8AnchorConvResult &rResult)
Definition: frmfmt.hxx:360
WW8AnchorConvResult(WW8AnchorConv eHoriConv, WW8AnchorConv eVertConv)
Definition: frmfmt.hxx:355
WW8AnchorConv m_eHoriConv
Definition: frmfmt.hxx:351
WW8AnchorConv m_eVertConv
Definition: frmfmt.hxx:352
#define SW_DLLPUBLIC
Definition: swdllapi.h:28