LibreOffice Module sw (master) 1
objectformatter.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_SOURCE_CORE_INC_OBJECTFORMATTER_HXX
20#define INCLUDED_SW_SOURCE_CORE_INC_OBJECTFORMATTER_HXX
21
22#include <sal/types.h>
23#include <memory>
24
25class SwFrame;
26// #i26945#
27class SwTextFrame;
28class SwLayoutFrame;
29class SwPageFrame;
31class SwLayAction;
32// OD 2004-10-04 #i26945#
34
35// #i28701#
36// Format floating screen objects, which are anchored at the given anchor frame
37// and registered at the given page frame.
38
40{
41 private:
42 // page frame, at which the floating screen objects are registered.
44
45 // value of document compatibility option 'Consider wrapping style on
46 // object positioning'
48
49 // layout action calling the format of the floating screen objects
51
52 // data structure to collect page number of object's 'anchor'
53 // #i26945#
54 std::unique_ptr<SwPageNumAndTypeOfAnchors> mpPgNumAndTypeOfAnchors;
55
66 void FormatLayout_( SwLayoutFrame& _rLayoutFrame );
67
73 void FormatObjContent( SwAnchoredObject& _rAnchoredObj );
74
75 protected:
76 SwObjectFormatter( const SwPageFrame& _rPageFrame,
77 SwLayAction* _pLayAction,
78 const bool _bCollectPgNumOfAnchors = false );
79
80 static std::unique_ptr<SwObjectFormatter> CreateObjFormatter( SwFrame& _rAnchorFrame,
81 const SwPageFrame& _rPageFrame,
82 SwLayAction* _pLayAction );
83
84 virtual SwFrame& GetAnchorFrame() = 0;
85
87 {
88 return mrPageFrame;
89 }
90
92 {
94 }
95
97 {
98 return mpLayAction;
99 }
100
103 void FormatObj_( SwAnchoredObject& _rAnchoredObj );
104
116 bool FormatObjsAtFrame_( SwTextFrame* _pMasterTextFrame = nullptr );
117
120 SwAnchoredObject* GetCollectedObj( const sal_uInt32 _nIndex );
121
124 sal_uInt32 GetPgNumOfCollected( const sal_uInt32 _nIndex );
125
128 bool IsCollectedAnchoredAtMaster( const sal_uInt32 _nIndex );
129
132 sal_uInt32 CountOfCollected();
133
134 public:
135 virtual ~SwObjectFormatter();
136
152 virtual bool DoFormatObj( SwAnchoredObject& _rAnchoredObj,
153 const bool _bCheckForMovedFwd = false ) = 0;
154
157 virtual bool DoFormatObjs() = 0;
158
161 static bool FormatObjsAtFrame( SwFrame& _rAnchorFrame,
162 const SwPageFrame& _rPageFrame,
163 SwLayAction* _pLayAction = nullptr );
164
167 static bool FormatObj( SwAnchoredObject& _rAnchoredObj,
168 SwFrame* _pAnchorFrame = nullptr,
169 const SwPageFrame* _pPageFrame = nullptr );
170};
171
172#endif
173
174/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
wrapper class for the positioning of Writer fly frames and drawing objects
Base class of the Writer layout elements.
Definition: frame.hxx:315
The usage of LayAction is always the same:
Definition: layact.hxx:59
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame.
Definition: layfrm.hxx:36
SwLayAction * GetLayAction()
virtual bool DoFormatObj(SwAnchoredObject &_rAnchoredObj, const bool _bCheckForMovedFwd=false)=0
intrinsic method to format a certain floating screen object
const SwPageFrame & GetPageFrame() const
static std::unique_ptr< SwObjectFormatter > CreateObjFormatter(SwFrame &_rAnchorFrame, const SwPageFrame &_rPageFrame, SwLayAction *_pLayAction)
virtual SwFrame & GetAnchorFrame()=0
const bool mbConsiderWrapOnObjPos
SwAnchoredObject * GetCollectedObj(const sal_uInt32 _nIndex)
accessor to collected anchored object
void FormatObj_(SwAnchoredObject &_rAnchoredObj)
performs the intrinsic format of a given floating screen object and its content.
bool FormatObjsAtFrame_(SwTextFrame *_pMasterTextFrame=nullptr)
invokes the intrinsic format method for all floating screen objects, anchored at anchor frame on the ...
virtual bool DoFormatObjs()=0
intrinsic method to format all floating screen objects
static bool FormatObjsAtFrame(SwFrame &_rAnchorFrame, const SwPageFrame &_rPageFrame, SwLayAction *_pLayAction=nullptr)
method to format all floating screen objects at the given anchor frame
virtual ~SwObjectFormatter()
static bool FormatObj(SwAnchoredObject &_rAnchoredObj, SwFrame *_pAnchorFrame=nullptr, const SwPageFrame *_pPageFrame=nullptr)
method to format a given floating screen object
bool ConsiderWrapOnObjPos() const
SwObjectFormatter(const SwPageFrame &_rPageFrame, SwLayAction *_pLayAction, const bool _bCollectPgNumOfAnchors=false)
const SwPageFrame & mrPageFrame
void FormatObjContent(SwAnchoredObject &_rAnchoredObj)
helper method for method <FormatObj_(..)> - performs the intrinsic format of the content of the given...
void FormatLayout_(SwLayoutFrame &_rLayoutFrame)
helper method for method <FormatObj_(..)> - performs the intrinsic format of the layout of the given ...
sal_uInt32 GetPgNumOfCollected(const sal_uInt32 _nIndex)
accessor to 'anchor' page number of collected anchored object
SwLayAction * mpLayAction
bool IsCollectedAnchoredAtMaster(const sal_uInt32 _nIndex)
accessor to 'anchor' type of collected anchored object
sal_uInt32 CountOfCollected()
accessor to total number of collected anchored objects
std::unique_ptr< SwPageNumAndTypeOfAnchors > mpPgNumAndTypeOfAnchors
A page of the document layout.
Definition: pagefrm.hxx:60
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:168