Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <objectformatter.hxx>
30 : : #include <objectformattertxtfrm.hxx>
31 : : #include <objectformatterlayfrm.hxx>
32 : : #include <anchoredobject.hxx>
33 : : #include <anchoreddrawobject.hxx>
34 : : #include <sortedobjs.hxx>
35 : : #include <pagefrm.hxx>
36 : : #include <flyfrms.hxx>
37 : : #include <txtfrm.hxx>
38 : : #include <layact.hxx>
39 : : #include <frmfmt.hxx>
40 : : #include <fmtanchr.hxx>
41 : : #include <doc.hxx>
42 : :
43 : : #include <vector>
44 : :
45 : : // =============================================================================
46 : : // helper class <SwPageNumAndTypeOfAnchors>
47 : : // --> #i26945# - Additionally the type of the anchor text frame
48 : : // is collected - by type is meant 'master' or 'follow'.
49 : : // =============================================================================
50 : : class SwPageNumAndTypeOfAnchors
51 : : {
52 : : private:
53 : : struct tEntry
54 : : {
55 : : SwAnchoredObject* mpAnchoredObj;
56 : : sal_uInt32 mnPageNumOfAnchor;
57 : : bool mbAnchoredAtMaster;
58 : : };
59 : :
60 : : std::vector< tEntry* > maObjList;
61 : :
62 : : public:
63 : 1780 : inline SwPageNumAndTypeOfAnchors()
64 : 1780 : {
65 : 1780 : }
66 : 1780 : inline ~SwPageNumAndTypeOfAnchors()
67 : 1780 : {
68 [ + - ][ + + ]: 8130 : for ( std::vector< tEntry* >::iterator aIter = maObjList.begin();
69 : 4065 : aIter != maObjList.end(); ++aIter )
70 : : {
71 : 2285 : delete (*aIter);
72 : : }
73 : 1780 : maObjList.clear();
74 : 1780 : }
75 : :
76 : 2285 : inline void Collect( SwAnchoredObject& _rAnchoredObj )
77 : : {
78 [ + - ]: 2285 : tEntry* pNewEntry = new tEntry();
79 : 2285 : pNewEntry->mpAnchoredObj = &_rAnchoredObj;
80 : : // #i33751#, #i34060# - method <GetPageFrmOfAnchor()>
81 : : // is replaced by method <FindPageFrmOfAnchor()>. It's return value
82 : : // have to be checked.
83 [ + - ]: 2285 : SwPageFrm* pPageFrmOfAnchor = _rAnchoredObj.FindPageFrmOfAnchor();
84 [ + - ]: 2285 : if ( pPageFrmOfAnchor )
85 : : {
86 : 2285 : pNewEntry->mnPageNumOfAnchor = pPageFrmOfAnchor->GetPhyPageNum();
87 : : }
88 : : else
89 : : {
90 : 0 : pNewEntry->mnPageNumOfAnchor = 0;
91 : : }
92 : : // --> #i26945# - collect type of anchor
93 [ + - ]: 2285 : SwTxtFrm* pAnchorCharFrm = _rAnchoredObj.FindAnchorCharFrm();
94 [ + + ]: 2285 : if ( pAnchorCharFrm )
95 : : {
96 : 1990 : pNewEntry->mbAnchoredAtMaster = !pAnchorCharFrm->IsFollow();
97 : : }
98 : : else
99 : : {
100 : 295 : pNewEntry->mbAnchoredAtMaster = true;
101 : : }
102 [ + - ]: 2285 : maObjList.push_back( pNewEntry );
103 : 2285 : }
104 : :
105 : 81 : inline SwAnchoredObject* operator[]( sal_uInt32 _nIndex )
106 : : {
107 : 81 : SwAnchoredObject* bRetObj = 0L;
108 : :
109 [ + - ]: 81 : if ( _nIndex < Count())
110 : : {
111 : 81 : bRetObj = maObjList[_nIndex]->mpAnchoredObj;
112 : : }
113 : :
114 : 81 : return bRetObj;
115 : : }
116 : :
117 : 18 : inline sal_uInt32 GetPageNum( sal_uInt32 _nIndex ) const
118 : : {
119 : 18 : sal_uInt32 nRetPgNum = 0L;
120 : :
121 [ + - ]: 18 : if ( _nIndex < Count())
122 : : {
123 : 18 : nRetPgNum = maObjList[_nIndex]->mnPageNumOfAnchor;
124 : : }
125 : :
126 : 18 : return nRetPgNum;
127 : : }
128 : :
129 : : // --> #i26945#
130 : 18 : inline bool AnchoredAtMaster( sal_uInt32 _nIndex )
131 : : {
132 : 18 : bool bAnchoredAtMaster( true );
133 : :
134 [ + - ]: 18 : if ( _nIndex < Count())
135 : : {
136 : 18 : bAnchoredAtMaster = maObjList[_nIndex]->mbAnchoredAtMaster;
137 : : }
138 : :
139 : 18 : return bAnchoredAtMaster;
140 : : }
141 : :
142 : 231 : inline sal_uInt32 Count() const
143 : : {
144 : 231 : return maObjList.size();
145 : : }
146 : : };
147 : :
148 : : // =============================================================================
149 : : // implementation of class <SwObjectFormatter>
150 : : // =============================================================================
151 : 2045 : SwObjectFormatter::SwObjectFormatter( const SwPageFrm& _rPageFrm,
152 : : SwLayAction* _pLayAction,
153 : : const bool _bCollectPgNumOfAnchors )
154 : : : mrPageFrm( _rPageFrm ),
155 : : mbFormatOnlyAsCharAnchored( false ),
156 : 2045 : mbConsiderWrapOnObjPos( _rPageFrm.GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::CONSIDER_WRAP_ON_OBJECT_POSITION) ),
157 : : mpLayAction( _pLayAction ),
158 : : // --> #i26945#
159 [ + - ][ + + ]: 2045 : mpPgNumAndTypeOfAnchors( _bCollectPgNumOfAnchors ? new SwPageNumAndTypeOfAnchors() : 0L )
160 : : {
161 : 2045 : }
162 : :
163 : 2045 : SwObjectFormatter::~SwObjectFormatter()
164 : : {
165 [ + + ]: 2045 : delete mpPgNumAndTypeOfAnchors;
166 [ - + ]: 2045 : }
167 : :
168 : 36311 : SwObjectFormatter* SwObjectFormatter::CreateObjFormatter(
169 : : SwFrm& _rAnchorFrm,
170 : : const SwPageFrm& _rPageFrm,
171 : : SwLayAction* _pLayAction )
172 : : {
173 : 36311 : SwObjectFormatter* pObjFormatter = 0L;
174 [ + + ]: 36311 : if ( _rAnchorFrm.IsTxtFrm() )
175 : : {
176 : : pObjFormatter = SwObjectFormatterTxtFrm::CreateObjFormatter(
177 : : static_cast<SwTxtFrm&>(_rAnchorFrm),
178 : 30608 : _rPageFrm, _pLayAction );
179 : : }
180 [ + - ]: 5703 : else if ( _rAnchorFrm.IsLayoutFrm() )
181 : : {
182 : : pObjFormatter = SwObjectFormatterLayFrm::CreateObjFormatter(
183 : : static_cast<SwLayoutFrm&>(_rAnchorFrm),
184 : 5703 : _rPageFrm, _pLayAction );
185 : : }
186 : : else
187 : : {
188 : : OSL_FAIL( "<SwObjectFormatter::CreateObjFormatter(..)> - unexcepted type of anchor frame" );
189 : : }
190 : :
191 : 36311 : return pObjFormatter;
192 : : }
193 : :
194 : : /** method to format all floating screen objects at the given anchor frame
195 : :
196 : : @author OD
197 : : */
198 : 35873 : bool SwObjectFormatter::FormatObjsAtFrm( SwFrm& _rAnchorFrm,
199 : : const SwPageFrm& _rPageFrm,
200 : : SwLayAction* _pLayAction )
201 : : {
202 : 35873 : bool bSuccess( true );
203 : :
204 : : // create corresponding object formatter
205 : : SwObjectFormatter* pObjFormatter =
206 : 35873 : SwObjectFormatter::CreateObjFormatter( _rAnchorFrm, _rPageFrm, _pLayAction );
207 : :
208 [ + + ]: 35873 : if ( pObjFormatter )
209 : : {
210 : : // format anchored floating screen objects
211 : 1607 : bSuccess = pObjFormatter->DoFormatObjs();
212 : : }
213 [ + + ]: 35873 : delete pObjFormatter;
214 : :
215 : 35873 : return bSuccess;
216 : : }
217 : :
218 : : /** method to format a given floating screen object
219 : :
220 : : @author OD
221 : : */
222 : 438 : bool SwObjectFormatter::FormatObj( SwAnchoredObject& _rAnchoredObj,
223 : : SwFrm* _pAnchorFrm,
224 : : const SwPageFrm* _pPageFrm,
225 : : SwLayAction* _pLayAction )
226 : : {
227 : 438 : bool bSuccess( true );
228 : :
229 : : OSL_ENSURE( _pAnchorFrm || _rAnchoredObj.GetAnchorFrm(),
230 : : "<SwObjectFormatter::FormatObj(..)> - missing anchor frame" );
231 [ - + ]: 438 : SwFrm& rAnchorFrm = _pAnchorFrm ? *(_pAnchorFrm) : *(_rAnchoredObj.AnchorFrm());
232 : :
233 : : OSL_ENSURE( _pPageFrm || rAnchorFrm.FindPageFrm(),
234 : : "<SwObjectFormatter::FormatObj(..)> - missing page frame" );
235 [ - + ]: 438 : const SwPageFrm& rPageFrm = _pPageFrm ? *(_pPageFrm) : *(rAnchorFrm.FindPageFrm());
236 : :
237 : : // create corresponding object formatter
238 : : SwObjectFormatter* pObjFormatter =
239 : 438 : SwObjectFormatter::CreateObjFormatter( rAnchorFrm, rPageFrm, _pLayAction );
240 : :
241 [ + - ]: 438 : if ( pObjFormatter )
242 : : {
243 : : // format given floating screen object
244 : : // --> #i40147# - check for moved forward anchor frame
245 : 438 : bSuccess = pObjFormatter->DoFormatObj( _rAnchoredObj, true );
246 : : }
247 [ + - ]: 438 : delete pObjFormatter;
248 : :
249 : 438 : return bSuccess;
250 : : }
251 : :
252 : : /** helper method for method <_FormatObj(..)> - performs the intrinsic format
253 : : of the layout of the given layout frame and all its lower layout frames.
254 : :
255 : : #i28701#
256 : : IMPORTANT NOTE:
257 : : Method corresponds to methods <SwLayAction::FormatLayoutFly(..)> and
258 : : <SwLayAction::FormatLayout(..)>. Thus, its code for the formatting have
259 : : to be synchronised.
260 : :
261 : : @author OD
262 : : */
263 : 450 : void SwObjectFormatter::_FormatLayout( SwLayoutFrm& _rLayoutFrm )
264 : : {
265 : 450 : _rLayoutFrm.Calc();
266 : :
267 : 450 : SwFrm* pLowerFrm = _rLayoutFrm.Lower();
268 [ + + ]: 900 : while ( pLowerFrm )
269 : : {
270 [ - + ]: 450 : if ( pLowerFrm->IsLayoutFrm() )
271 : : {
272 : 0 : _FormatLayout( *(static_cast<SwLayoutFrm*>(pLowerFrm)) );
273 : : }
274 : 450 : pLowerFrm = pLowerFrm->GetNext();
275 : : }
276 : 450 : }
277 : :
278 : : /** helper method for method <_FormatObj(..)> - performs the intrinsic
279 : : format of the content of the given floating screen object.
280 : :
281 : : #i28701#
282 : :
283 : : @author OD
284 : : */
285 : 450 : void SwObjectFormatter::_FormatObjCntnt( SwAnchoredObject& _rAnchoredObj )
286 : : {
287 [ - + ]: 450 : if ( !_rAnchoredObj.ISA(SwFlyFrm) )
288 : : {
289 : : // only Writer fly frames have content
290 : 450 : return;
291 : : }
292 : :
293 : 450 : SwFlyFrm& rFlyFrm = static_cast<SwFlyFrm&>(_rAnchoredObj);
294 : 450 : SwCntntFrm* pCntnt = rFlyFrm.ContainsCntnt();
295 : :
296 [ + + ]: 900 : while ( pCntnt )
297 : : {
298 : : // format content
299 : 450 : pCntnt->OptCalc();
300 : :
301 : : // format floating screen objects at content text frame
302 : : // #i23129#, #i36347# - pass correct page frame to
303 : : // the object formatter
304 [ - + ]: 450 : if ( pCntnt->IsTxtFrm() &&
[ - + # # ]
305 : : !SwObjectFormatter::FormatObjsAtFrm( *pCntnt,
306 : 0 : *(pCntnt->FindPageFrm()),
307 : 0 : GetLayAction() ) )
308 : : {
309 : : // restart format with first content
310 : 0 : pCntnt = rFlyFrm.ContainsCntnt();
311 : 0 : continue;
312 : : }
313 : :
314 : : // continue with next content
315 : 450 : pCntnt = pCntnt->GetNextCntntFrm();
316 : : }
317 : : }
318 : :
319 : : /** performs the intrinsic format of a given floating screen object and its content.
320 : :
321 : : #i28701#
322 : :
323 : : @author OD
324 : : */
325 : 2438 : void SwObjectFormatter::_FormatObj( SwAnchoredObject& _rAnchoredObj )
326 : : {
327 : : // check, if only as-character anchored object have to be formatted, and
328 : : // check the anchor type
329 [ - + # # ]: 2438 : if ( FormatOnlyAsCharAnchored() &&
[ - + ]
330 : 0 : !(_rAnchoredObj.GetFrmFmt().GetAnchor().GetAnchorId() == FLY_AS_CHAR) )
331 : : {
332 : 2438 : return;
333 : : }
334 : :
335 : : // collect anchor object and its 'anchor' page number, if requested
336 [ + + ]: 2438 : if ( mpPgNumAndTypeOfAnchors )
337 : : {
338 : 2285 : mpPgNumAndTypeOfAnchors->Collect( _rAnchoredObj );
339 : : }
340 : :
341 [ + + ]: 2438 : if ( _rAnchoredObj.ISA(SwFlyFrm) )
342 : : {
343 : 1565 : SwFlyFrm& rFlyFrm = static_cast<SwFlyFrm&>(_rAnchoredObj);
344 : : // --> #i34753# - reset flag, which prevents a positioning
345 [ + + ]: 1565 : if ( rFlyFrm.IsFlyLayFrm() )
346 : : {
347 : 115 : static_cast<SwFlyLayFrm&>(rFlyFrm).SetNoMakePos( false );
348 : : }
349 : :
350 : : // #i81146# new loop control
351 : 1565 : sal_uInt16 nLoopControlRuns = 0;
352 : 1565 : const sal_uInt16 nLoopControlMax = 15;
353 : :
354 [ + + ][ + + : 1730 : do {
+ + + - ]
355 [ + + ]: 1619 : if ( mpLayAction )
356 : : {
357 : 1169 : mpLayAction->FormatLayoutFly( &rFlyFrm );
358 : : // --> consider, if the layout action
359 : : // has to be restarted due to a delete of a page frame.
360 [ - + ]: 1169 : if ( mpLayAction->IsAgain() )
361 : : {
362 : 0 : break;
363 : : }
364 : : }
365 : : else
366 : : {
367 : 450 : _FormatLayout( rFlyFrm );
368 : : }
369 : : // --> #i34753# - prevent further positioning, if
370 : : // to-page|to-fly anchored Writer fly frame is already clipped.
371 [ + + ][ + + ]: 1619 : if ( rFlyFrm.IsFlyLayFrm() && rFlyFrm.IsClipped() )
[ + + ]
372 : : {
373 : 12 : static_cast<SwFlyLayFrm&>(rFlyFrm).SetNoMakePos( true );
374 : : }
375 : : // #i23129#, #i36347# - pass correct page frame
376 : : // to the object formatter
377 : : SwObjectFormatter::FormatObjsAtFrm( rFlyFrm,
378 : 1619 : *(rFlyFrm.FindPageFrm()),
379 : 1619 : mpLayAction );
380 [ + + ]: 1619 : if ( mpLayAction )
381 : : {
382 : 1169 : mpLayAction->_FormatFlyCntnt( &rFlyFrm );
383 : : // --> consider, if the layout action
384 : : // has to be restarted due to a delete of a page frame.
385 [ - + ]: 1169 : if ( mpLayAction->IsAgain() )
386 : : {
387 : 0 : break;
388 : : }
389 : : }
390 : : else
391 : : {
392 : 450 : _FormatObjCntnt( rFlyFrm );
393 : : }
394 : :
395 [ - + ]: 1619 : if ( ++nLoopControlRuns >= nLoopControlMax )
396 : : {
397 : : OSL_FAIL( "LoopControl in SwObjectFormatter::_FormatObj: Stage 3!!!" );
398 : 0 : rFlyFrm.ValidateThisAndAllLowers( 2 );
399 : 0 : nLoopControlRuns = 0;
400 : : }
401 : :
402 : : // --> #i57917#
403 : : // stop formatting of anchored object, if restart of layout process is requested.
404 : 1619 : } while ( !rFlyFrm.IsValid() &&
405 : 57 : !_rAnchoredObj.RestartLayoutProcess() &&
406 : 54 : rFlyFrm.GetAnchorFrm() == &GetAnchorFrm() );
407 : : }
408 [ + - ]: 873 : else if ( _rAnchoredObj.ISA(SwAnchoredDrawObject) )
409 : : {
410 : 873 : _rAnchoredObj.MakeObjPos();
411 : : }
412 : : }
413 : :
414 : : /** invokes the intrinsic format method for all floating screen objects,
415 : : anchored at anchor frame on the given page frame
416 : :
417 : : #i28701#
418 : : #i26945# - for format of floating screen objects for
419 : : follow text frames, the 'master' text frame is passed to the method.
420 : : Thus, the objects, whose anchor character is inside the follow text
421 : : frame can be formatted.
422 : :
423 : : @author OD
424 : : */
425 : 1615 : bool SwObjectFormatter::_FormatObjsAtFrm( SwTxtFrm* _pMasterTxtFrm )
426 : : {
427 : : // --> #i26945#
428 : 1615 : SwFrm* pAnchorFrm( 0L );
429 [ + + + + ]: 2965 : if ( GetAnchorFrm().IsTxtFrm() &&
[ + + ][ + + ]
430 : 1350 : static_cast<SwTxtFrm&>(GetAnchorFrm()).IsFollow() &&
431 : : _pMasterTxtFrm )
432 : : {
433 : 8 : pAnchorFrm = _pMasterTxtFrm;
434 : : }
435 : : else
436 : : {
437 : 1607 : pAnchorFrm = &GetAnchorFrm();
438 : : }
439 [ + + ]: 1615 : if ( !pAnchorFrm->GetDrawObjs() )
440 : : {
441 : : // nothing to do, if no floating screen object is registered at the anchor frame.
442 : 142 : return true;
443 : : }
444 : :
445 : 1473 : bool bSuccess( true );
446 : :
447 : 1473 : sal_uInt32 i = 0;
448 [ + + ]: 3472 : for ( ; i < pAnchorFrm->GetDrawObjs()->Count(); ++i )
449 : : {
450 : 2008 : SwAnchoredObject* pAnchoredObj = (*pAnchorFrm->GetDrawObjs())[i];
451 : :
452 : : // check, if object's anchor is on the given page frame or
453 : : // object is registered at the given page frame.
454 : : // --> #i26945# - check, if the anchor character of the
455 : : // anchored object is located in a follow text frame. If this anchor
456 : : // follow text frame differs from the given anchor frame, the given
457 : : // anchor frame is a 'master' text frame of the anchor follow text frame.
458 : : // If the anchor follow text frame is in the same body as its 'master'
459 : : // text frame, do not format the anchored object.
460 : : // E.g., this situation can occur during the table row splitting algorithm.
461 : 2008 : SwTxtFrm* pAnchorCharFrm = pAnchoredObj->FindAnchorCharFrm();
462 : : const bool bAnchoredAtFollowInSameBodyAsMaster =
463 : 1560 : pAnchorCharFrm && pAnchorCharFrm->IsFollow() &&
464 : 14 : pAnchorCharFrm != pAnchoredObj->GetAnchorFrm() &&
465 : 0 : pAnchorCharFrm->FindBodyFrm() ==
466 [ + + + + : 3582 : static_cast<SwTxtFrm*>(pAnchoredObj->AnchorFrm())->FindBodyFrm();
- + # # ]
467 [ - + ]: 2008 : if ( bAnchoredAtFollowInSameBodyAsMaster )
468 : : {
469 : 0 : continue;
470 : : }
471 : : // #i33751#, #i34060# - method <GetPageFrmOfAnchor()>
472 : : // is replaced by method <FindPageFrmOfAnchor()>. It's return value
473 : : // have to be checked.
474 : 2008 : SwPageFrm* pPageFrmOfAnchor = pAnchoredObj->FindPageFrmOfAnchor();
475 : : OSL_ENSURE( pPageFrmOfAnchor,
476 : : "<SwObjectFormatter::_FormatObjsAtFrm()> - missing page frame." );
477 : : // --> #i26945#
478 [ + + ][ + - ]: 2008 : if ( pPageFrmOfAnchor && pPageFrmOfAnchor == &mrPageFrm )
479 : : {
480 : : // if format of object fails, stop formatting and pass fail to
481 : : // calling method via the return value.
482 [ + + ]: 2000 : if ( !DoFormatObj( *pAnchoredObj ) )
483 : : {
484 : 9 : bSuccess = false;
485 : 9 : break;
486 : : }
487 : :
488 : : // considering changes at <pAnchorFrm->GetDrawObjs()> during
489 : : // format of the object.
490 [ + - - + ]: 3982 : if ( !pAnchorFrm->GetDrawObjs() ||
[ - + ]
491 : 1991 : i > pAnchorFrm->GetDrawObjs()->Count() )
492 : : {
493 : 0 : break;
494 : : }
495 : : else
496 : : {
497 : : sal_uInt32 nActPosOfObj =
498 : 1991 : pAnchorFrm->GetDrawObjs()->ListPosOf( *pAnchoredObj );
499 [ - + ][ - + ]: 1991 : if ( nActPosOfObj == pAnchorFrm->GetDrawObjs()->Count() ||
[ + - ]
500 : : nActPosOfObj > i )
501 : : {
502 : 0 : --i;
503 : : }
504 [ - + ]: 1991 : else if ( nActPosOfObj < i )
505 : : {
506 : 0 : i = nActPosOfObj;
507 : : }
508 : : }
509 : : }
510 : : } // end of loop on <pAnchorFrm->.GetDrawObjs()>
511 : :
512 : 1615 : return bSuccess;
513 : : }
514 : :
515 : : /** accessor to collected anchored object
516 : :
517 : : #i28701#
518 : :
519 : : @author OD
520 : : */
521 : 81 : SwAnchoredObject* SwObjectFormatter::GetCollectedObj( const sal_uInt32 _nIndex )
522 : : {
523 [ + - ]: 81 : return mpPgNumAndTypeOfAnchors ? (*mpPgNumAndTypeOfAnchors)[_nIndex] : 0L;
524 : : }
525 : :
526 : : /** accessor to 'anchor' page number of collected anchored object
527 : :
528 : : #i28701#
529 : :
530 : : @author OD
531 : : */
532 : 18 : sal_uInt32 SwObjectFormatter::GetPgNumOfCollected( const sal_uInt32 _nIndex )
533 : : {
534 [ + - ]: 18 : return mpPgNumAndTypeOfAnchors ? mpPgNumAndTypeOfAnchors->GetPageNum(_nIndex) : 0L;
535 : : }
536 : :
537 : : /** accessor to 'anchor' type of collected anchored object
538 : :
539 : : #i26945#
540 : :
541 : : @author OD
542 : : */
543 : 18 : bool SwObjectFormatter::IsCollectedAnchoredAtMaster( const sal_uInt32 _nIndex )
544 : : {
545 : : return mpPgNumAndTypeOfAnchors
546 : 18 : ? mpPgNumAndTypeOfAnchors->AnchoredAtMaster(_nIndex)
547 [ + - ]: 18 : : true;
548 : : }
549 : :
550 : : /** accessor to total number of collected anchored objects
551 : :
552 : : #i28701#
553 : :
554 : : @author OD
555 : : */
556 : 114 : sal_uInt32 SwObjectFormatter::CountOfCollected()
557 : : {
558 [ + - ]: 114 : return mpPgNumAndTypeOfAnchors ? mpPgNumAndTypeOfAnchors->Count() : 0L;
559 : : }
560 : :
561 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|