LibreOffice Module sw (master)  1
docdraw.cxx
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  * This file incorporates work covered by the following license notice:
9  *
10  * Licensed to the Apache Software Foundation (ASF) under one or more
11  * contributor license agreements. See the NOTICE file distributed
12  * with this work for additional information regarding copyright
13  * ownership. The ASF licenses this file to you under the Apache
14  * License, Version 2.0 (the "License"); you may not use this file
15  * except in compliance with the License. You may obtain a copy of
16  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
17  */
18 
19 #include <hintids.hxx>
20 #include <vcl/outdev.hxx>
21 #include <sfx2/printer.hxx>
22 #include <editeng/eeitem.hxx>
23 #include <editeng/flditem.hxx>
24 #include <editeng/editeng.hxx>
25 #include <svx/svdoutl.hxx>
26 #include <editeng/colritem.hxx>
27 #include <svx/svdpage.hxx>
28 #include <svx/svdogrp.hxx>
29 #include <editeng/langitem.hxx>
30 #include <editeng/unolingu.hxx>
31 #include <editeng/measfld.hxx>
32 #include <svx/svdpool.hxx>
33 #include <sal/log.hxx>
34 #include <fmtanchr.hxx>
35 #include <charatr.hxx>
36 #include <frmfmt.hxx>
37 #include <charfmt.hxx>
38 #include <viewimp.hxx>
39 #include <svl/hint.hxx>
40 #include <doc.hxx>
41 #include <docfunc.hxx>
42 #include <IDocumentUndoRedo.hxx>
46 #include <IDocumentState.hxx>
49 #include <docsh.hxx>
50 #include <rootfrm.hxx>
51 #include <poolfmt.hxx>
52 #include <viewsh.hxx>
53 #include <drawdoc.hxx>
54 #include <UndoDraw.hxx>
55 #include <swundo.hxx>
56 #include <dcontact.hxx>
57 #include <dview.hxx>
58 #include <mvsave.hxx>
59 #include <flyfrm.hxx>
60 #include <dflyobj.hxx>
61 #include <svx/svdetc.hxx>
62 #include <editeng/fhgtitem.hxx>
63 #include <svx/svdpagv.hxx>
64 #include <txtfrm.hxx>
65 #include <editeng/frmdiritem.hxx>
66 #include <fmtornt.hxx>
67 #include <svx/svditer.hxx>
68 
69 #include <vector>
70 #include <calbck.hxx>
71 
72 using namespace ::com::sun::star;
73 using namespace ::com::sun::star::linguistic2;
74 
81 static void lcl_AdjustPositioningAttr( SwDrawFrameFormat* _pFrameFormat,
82  const SdrObject& _rSdrObj )
83 {
84  const SwContact* pContact = GetUserCall( &_rSdrObj );
85  OSL_ENSURE( pContact, "<lcl_AdjustPositioningAttr(..)> - missing contact object." );
86 
87  // determine position of new group object relative to its anchor frame position
88  SwTwips nHoriRelPos = 0;
89  SwTwips nVertRelPos = 0;
90  {
91  const SwFrame* pAnchorFrame = pContact->GetAnchoredObj( &_rSdrObj )->GetAnchorFrame();
92  OSL_ENSURE( !pAnchorFrame ||
93  !pAnchorFrame->IsTextFrame() ||
94  !static_cast<const SwTextFrame*>(pAnchorFrame)->IsFollow(),
95  "<lcl_AdjustPositioningAttr(..)> - anchor frame is a follow." );
96  bool bVert = false;
97  bool bR2L = false;
98  // #i45952# - use anchor position of anchor frame, if it exist.
99  Point aAnchorPos;
100  if ( pAnchorFrame )
101  {
102  // #i45952#
103  aAnchorPos = pAnchorFrame->GetFrameAnchorPos( ::HasWrap( &_rSdrObj ) );
104  bVert = pAnchorFrame->IsVertical();
105  bR2L = pAnchorFrame->IsRightToLeft();
106  }
107  else
108  {
109  // #i45952#
110  aAnchorPos = _rSdrObj.GetAnchorPos();
111  // If no anchor frame exist - e.g. because no layout exists - the
112  // default layout direction is taken.
113  const SvxFrameDirectionItem& rDirItem =
114  _pFrameFormat->GetAttrSet().GetPool()->GetDefaultItem( RES_FRAMEDIR );
115  switch ( rDirItem.GetValue() )
116  {
117  case SvxFrameDirection::Vertical_LR_TB:
118  {
119  // vertical from left-to-right
120  bVert = true;
121  bR2L = true;
122  OSL_FAIL( "<lcl_AdjustPositioningAttr(..)> - vertical from left-to-right not supported." );
123  }
124  break;
125  case SvxFrameDirection::Vertical_RL_TB:
126  {
127  // vertical from right-to-left
128  bVert = true;
129  bR2L = false;
130  }
131  break;
132  case SvxFrameDirection::Horizontal_RL_TB:
133  {
134  // horizontal from right-to-left
135  bVert = false;
136  bR2L = true;
137  }
138  break;
139  case SvxFrameDirection::Horizontal_LR_TB:
140  {
141  // horizontal from left-to-right
142  bVert = false;
143  bR2L = false;
144  }
145  break;
146  case SvxFrameDirection::Environment:
147  SAL_WARN("sw.core", "lcl_AdjustPositioningAttr(..) SvxFrameDirection::Environment not supported");
148  break;
149  default: break;
150  }
151 
152  }
153  // use geometry of drawing object
154  const SwRect aObjRect = _rSdrObj.GetSnapRect();
155 
156  if ( bVert )
157  {
158  if ( bR2L ) {
159  //SvxFrameDirection::Vertical_LR_TB
160  nHoriRelPos = aObjRect.Left() - aAnchorPos.getX();
161  nVertRelPos = aObjRect.Top() - aAnchorPos.getY();
162  } else {
163  //SvxFrameDirection::Vertical_RL_TB
164  nHoriRelPos = aObjRect.Top() - aAnchorPos.getY();
165  nVertRelPos = aAnchorPos.getX() - aObjRect.Right();
166  }
167  }
168  else if ( bR2L )
169  {
170  nHoriRelPos = aAnchorPos.getX() - aObjRect.Right();
171  nVertRelPos = aObjRect.Top() - aAnchorPos.getY();
172  }
173  else
174  {
175  nHoriRelPos = aObjRect.Left() - aAnchorPos.getX();
176  nVertRelPos = aObjRect.Top() - aAnchorPos.getY();
177  }
178  }
179 
180  _pFrameFormat->SetFormatAttr( SwFormatHoriOrient( nHoriRelPos, text::HoriOrientation::NONE, text::RelOrientation::FRAME ) );
181  _pFrameFormat->SetFormatAttr( SwFormatVertOrient( nVertRelPos, text::VertOrientation::NONE, text::RelOrientation::FRAME ) );
182  // #i44334#, #i44681# - positioning attributes already set
183  _pFrameFormat->PosAttrSet();
184  // #i34750# - keep current object rectangle for drawing
185  // objects. The object rectangle is used on events from the drawing layer
186  // to adjust the positioning attributes - see <SwDrawContact::Changed_(..)>.
187  {
188  const SwAnchoredObject* pAnchoredObj = pContact->GetAnchoredObj( &_rSdrObj );
189  if ( auto pAnchoredDrawObj = dynamic_cast<const SwAnchoredDrawObject*>( pAnchoredObj) )
190  {
191  const SwRect aObjRect = _rSdrObj.GetSnapRect();
192  const_cast<SwAnchoredDrawObject*>(pAnchoredDrawObj)
193  ->SetLastObjRect( aObjRect.SVRect() );
194  }
195  }
196 }
197 
199 {
200  // replace marked 'virtual' drawing objects by the corresponding 'master'
201  // drawing objects.
203 
204  const SdrMarkList &rMrkList = rDrawView.GetMarkedObjectList();
205  SdrObject *pObj = rMrkList.GetMark( 0 )->GetMarkedSdrObj();
206  bool bNoGroup = ( nullptr == pObj->getParentSdrObjectFromSdrObject() );
207  SwDrawContact* pNewContact = nullptr;
208  if( bNoGroup )
209  {
210  SwDrawFrameFormat *pFormat = nullptr;
211 
212  // Revoke anchor attribute.
213  SwDrawContact *pMyContact = static_cast<SwDrawContact*>(GetUserCall(pObj));
214  const SwFormatAnchor aAnch( pMyContact->GetFormat()->GetAnchor() );
215 
216  std::unique_ptr<SwUndoDrawGroup> pUndo;
218  pUndo.reset(new SwUndoDrawGroup( static_cast<sal_uInt16>(rMrkList.GetMarkCount()) , this));
219 
220  // #i53320#
221  bool bGroupMembersNotPositioned( false );
222  {
223  SwAnchoredDrawObject* pAnchoredDrawObj =
224  static_cast<SwAnchoredDrawObject*>(pMyContact->GetAnchoredObj( pObj ));
225  bGroupMembersNotPositioned = pAnchoredDrawObj->NotYetPositioned();
226  }
227  // Destroy ContactObjects and formats.
228  for( size_t i = 0; i < rMrkList.GetMarkCount(); ++i )
229  {
230  pObj = rMrkList.GetMark( i )->GetMarkedSdrObj();
231  SwDrawContact *pContact = static_cast<SwDrawContact*>(GetUserCall(pObj));
232 
233  // #i53320#
234 #if OSL_DEBUG_LEVEL > 0
235  SwAnchoredDrawObject* pAnchoredDrawObj =
236  static_cast<SwAnchoredDrawObject*>(pContact->GetAnchoredObj( pObj ));
237  OSL_ENSURE( bGroupMembersNotPositioned == pAnchoredDrawObj->NotYetPositioned(),
238  "<SwDoc::GroupSelection(..)> - group members have different positioning status!" );
239 #endif
240 
241  pFormat = static_cast<SwDrawFrameFormat*>(pContact->GetFormat());
242  // Deletes itself!
243  pContact->Changed(*pObj, SdrUserCallType::Delete, pObj->GetLastBoundRect() );
244  pObj->SetUserCall( nullptr );
245 
246  if( pUndo )
247  pUndo->AddObj( i, pFormat, pObj );
248  else
249  DelFrameFormat( pFormat );
250 
251  // #i45952# - re-introduce position normalization of group member
252  // objects, because its anchor position is cleared, when they are
253  // grouped.
254  Point aAnchorPos( pObj->GetAnchorPos() );
255  pObj->NbcSetAnchorPos( Point( 0, 0 ) );
256  pObj->NbcMove( Size( aAnchorPos.getX(), aAnchorPos.getY() ) );
257  }
258 
259  pFormat = MakeDrawFrameFormat( "DrawObject",
260  GetDfltFrameFormat() );
261  pFormat->SetFormatAttr( aAnch );
262  // #i36010# - set layout direction of the position
263  pFormat->SetPositionLayoutDir(
264  text::PositionLayoutDir::PositionInLayoutDirOfAnchor );
265 
266  rDrawView.GroupMarked();
267  OSL_ENSURE( rMrkList.GetMarkCount() == 1, "GroupMarked more or none groups." );
268 
269  SdrObject* pNewGroupObj = rMrkList.GetMark( 0 )->GetMarkedSdrObj();
270  pNewContact = new SwDrawContact( pFormat, pNewGroupObj );
271  // #i35635#
272  pNewContact->MoveObjToVisibleLayer( pNewGroupObj );
273  pNewContact->ConnectToLayout();
274  // #i53320# - No adjustment of the positioning and alignment
275  // attributes, if group members aren't positioned yet.
276  if ( !bGroupMembersNotPositioned )
277  {
278  // #i26791# - Adjust positioning and alignment attributes.
279  lcl_AdjustPositioningAttr( pFormat, *pNewGroupObj );
280  }
281 
282  if( pUndo )
283  {
284  pUndo->SetGroupFormat( pFormat );
285  GetIDocumentUndoRedo().AppendUndo( std::move(pUndo) );
286  }
287  }
288  else
289  {
290  if (GetIDocumentUndoRedo().DoesUndo())
291  {
293  }
294 
295  rDrawView.GroupMarked();
296  OSL_ENSURE( rMrkList.GetMarkCount() == 1, "GroupMarked more or none groups." );
297  }
298 
299  return pNewContact;
300 }
301 
303 {
304  bool const bUndo = GetIDocumentUndoRedo().DoesUndo();
305  if( bUndo )
306  {
308  }
309 
310  // replace marked 'virtual' drawing objects by the corresponding 'master'
311  // drawing objects.
313 
314  const SdrMarkList &rMrkList = rDrawView.GetMarkedObjectList();
315  std::unique_ptr<std::vector< std::pair< SwDrawFrameFormat*, SdrObject* > >[]> pFormatsAndObjs;
316  const size_t nMarkCount( rMrkList.GetMarkCount() );
317  if ( nMarkCount )
318  {
319  pFormatsAndObjs.reset( new std::vector< std::pair< SwDrawFrameFormat*, SdrObject* > >[nMarkCount] );
320  SdrObject *pMyObj = rMrkList.GetMark( 0 )->GetMarkedSdrObj();
321  if( !pMyObj->getParentSdrObjectFromSdrObject() )
322  {
323  for ( size_t i = 0; i < nMarkCount; ++i )
324  {
325  SdrObject *pObj = rMrkList.GetMark( i )->GetMarkedSdrObj();
326  if ( dynamic_cast<const SdrObjGroup*>(pObj) != nullptr )
327  {
328  SwDrawContact *pContact = static_cast<SwDrawContact*>(GetUserCall(pObj));
329  SwFormatAnchor aAnch( pContact->GetFormat()->GetAnchor() );
330  SdrObjList *pLst = static_cast<SdrObjGroup*>(pObj)->GetSubList();
331 
332  SwUndoDrawUnGroup* pUndo = nullptr;
333  if( bUndo )
334  {
335  pUndo = new SwUndoDrawUnGroup( static_cast<SdrObjGroup*>(pObj), this );
336  GetIDocumentUndoRedo().AppendUndo(std::unique_ptr<SwUndo>(pUndo));
337  }
338 
339  for ( size_t i2 = 0; i2 < pLst->GetObjCount(); ++i2 )
340  {
341  SdrObject* pSubObj = pLst->GetObj( i2 );
342  SwDrawFrameFormat *pFormat = MakeDrawFrameFormat( "DrawObject",
343  GetDfltFrameFormat() );
344  pFormat->SetFormatAttr( aAnch );
345  // #i36010# - set layout direction of the position
346  pFormat->SetPositionLayoutDir(
347  text::PositionLayoutDir::PositionInLayoutDirOfAnchor );
348  pFormatsAndObjs[i].emplace_back( pFormat, pSubObj );
349 
350  if( bUndo )
351  pUndo->AddObj( static_cast<sal_uInt16>(i2), pFormat );
352  }
353  }
354  }
355  }
356  }
357  rDrawView.UnGroupMarked();
358  // creation of <SwDrawContact> instances for the former group members and
359  // its connection to the Writer layout.
360  for ( size_t i = 0; i < nMarkCount; ++i )
361  {
362  SwUndoDrawUnGroupConnectToLayout* pUndo = nullptr;
363  if( bUndo )
364  {
365  pUndo = new SwUndoDrawUnGroupConnectToLayout(this);
366  GetIDocumentUndoRedo().AppendUndo(std::unique_ptr<SwUndo>(pUndo));
367  }
368 
369  while ( !pFormatsAndObjs[i].empty() )
370  {
371  SwDrawFrameFormat* pFormat( pFormatsAndObjs[i].back().first );
372  SdrObject* pObj( pFormatsAndObjs[i].back().second );
373  pFormatsAndObjs[i].pop_back();
374 
375  SwDrawContact* pContact = new SwDrawContact( pFormat, pObj );
376  pContact->MoveObjToVisibleLayer( pObj );
377  pContact->ConnectToLayout();
378  lcl_AdjustPositioningAttr( pFormat, *pObj );
379 
380  if ( bUndo )
381  {
382  pUndo->AddFormatAndObj( pFormat, pObj );
383  }
384  }
385  }
386 }
387 
389 {
390  bool bCallBase = false;
391  const SdrMarkList &rMrkList = rDrawView.GetMarkedObjectList();
392  if( rMrkList.GetMarkCount() )
393  {
395  bool bDelMarked = true;
396 
397  if( 1 == rMrkList.GetMarkCount() )
398  {
399  SdrObject *pObj = rMrkList.GetMark( 0 )->GetMarkedSdrObj();
400  if( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) != nullptr )
401  {
402  SwFlyFrameFormat* pFrameFormat =
403  static_cast<SwVirtFlyDrawObj*>(pObj)->GetFlyFrame()->GetFormat();
404  if( pFrameFormat )
405  {
406  getIDocumentLayoutAccess().DelLayoutFormat( pFrameFormat );
407  bDelMarked = false;
408  }
409  }
410  }
411 
412  for( size_t i = 0; i < rMrkList.GetMarkCount(); ++i )
413  {
414  SdrObject *pObj = rMrkList.GetMark( i )->GetMarkedSdrObj();
415  if( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) == nullptr )
416  {
417  SwDrawContact *pC = static_cast<SwDrawContact*>(GetUserCall(pObj));
418  SwDrawFrameFormat *pFrameFormat = static_cast<SwDrawFrameFormat*>(pC->GetFormat());
419  if( pFrameFormat &&
420  RndStdIds::FLY_AS_CHAR == pFrameFormat->GetAnchor().GetAnchorId() )
421  {
422  rDrawView.MarkObj( pObj, rDrawView.Imp().GetPageView(), true );
423  --i;
424  getIDocumentLayoutAccess().DelLayoutFormat( pFrameFormat );
425  }
426  }
427  }
428 
429  if( rMrkList.GetMarkCount() && bDelMarked )
430  {
431  SdrObject *pObj = rMrkList.GetMark( 0 )->GetMarkedSdrObj();
432  if( !pObj->getParentSdrObjectFromSdrObject() )
433  {
434  std::unique_ptr<SwUndoDrawDelete> pUndo;
436  pUndo.reset(new SwUndoDrawDelete( static_cast<sal_uInt16>(rMrkList.GetMarkCount()), this ));
437 
438  // Destroy ContactObjects, save formats.
439  for( size_t i = 0; i < rMrkList.GetMarkCount(); ++i )
440  {
441  const SdrMark& rMark = *rMrkList.GetMark( i );
442  pObj = rMark.GetMarkedSdrObj();
443  SwDrawContact *pContact = static_cast<SwDrawContact*>(pObj->GetUserCall());
444  if( pContact ) // of course not for grouped objects
445  {
446  SwDrawFrameFormat *pFormat = static_cast<SwDrawFrameFormat*>(pContact->GetFormat());
447  // before delete of selection is performed, marked
448  // <SwDrawVirtObj>-objects have to be replaced by its
449  // reference objects. Thus, assert, if a
450  // <SwDrawVirt>-object is found in the mark list.
451  if ( dynamic_cast<const SwDrawVirtObj*>( pObj) != nullptr )
452  {
453  OSL_FAIL( "<SwDrawVirtObj> is still marked for delete. application will crash!" );
454  }
455  // Deletes itself!
456  pContact->Changed(*pObj, SdrUserCallType::Delete, pObj->GetLastBoundRect() );
457  pObj->SetUserCall( nullptr );
458 
459  if( pUndo )
460  pUndo->AddObj( pFormat, rMark );
461  else
462  DelFrameFormat( pFormat );
463  }
464  }
465 
466  if( pUndo )
467  {
468  GetIDocumentUndoRedo().AppendUndo( std::move(pUndo) );
469  }
470  }
471  bCallBase = true;
472  }
474 
476  }
477 
478  return bCallBase;
479 }
480 
481 ZSortFly::ZSortFly(const SwFrameFormat* pFrameFormat, const SwFormatAnchor* pFlyAn, sal_uInt32 nArrOrdNum)
482  : pFormat(pFrameFormat)
483  , pAnchor(pFlyAn)
484  , nOrdNum(nArrOrdNum)
485 {
486  SAL_WARN_IF(pFormat->Which() != RES_FLYFRMFMT && pFormat->Which() != RES_DRAWFRMFMT, "sw.core", "What kind of format is this?");
488 }
489 
492 {
493  pOutliner->SetCalcFieldValueHdl(LINK(this, SwDoc, CalcFieldValueHdl));
494 }
495 
497 IMPL_LINK(SwDoc, CalcFieldValueHdl, EditFieldInfo*, pInfo, void)
498 {
499  if (!pInfo)
500  return;
501 
502  const SvxFieldItem& rField = pInfo->GetField();
503  const SvxFieldData* pField = rField.GetField();
504 
505  if (auto pDateField = dynamic_cast<const SvxDateField*>( pField))
506  {
507  // Date field
508  pInfo->SetRepresentation(
509  pDateField->GetFormatted(
510  *GetNumberFormatter(), LANGUAGE_SYSTEM) );
511  }
512  else if (auto pURLField = dynamic_cast<const SvxURLField*>( pField))
513  {
514  // URL field
515  switch ( pURLField->GetFormat() )
516  {
517  case SvxURLFormat::AppDefault:
518  case SvxURLFormat::Repr:
519  pInfo->SetRepresentation(pURLField->GetRepresentation());
520  break;
521 
522  case SvxURLFormat::Url:
523  pInfo->SetRepresentation(pURLField->GetURL());
524  break;
525  }
526 
527  sal_uInt16 nChrFormat;
528 
529  if (IsVisitedURL(pURLField->GetURL()))
530  nChrFormat = RES_POOLCHR_INET_VISIT;
531  else
532  nChrFormat = RES_POOLCHR_INET_NORMAL;
533 
534  SwFormat *pFormat = getIDocumentStylePoolAccess().GetCharFormatFromPool(nChrFormat);
535 
536  Color aColor(COL_LIGHTBLUE);
537  if (pFormat)
538  aColor = pFormat->GetColor().GetValue();
539 
540  pInfo->SetTextColor(aColor);
541  }
542  else if (dynamic_cast<const SdrMeasureField*>( pField))
543  {
544  // Clear measure field
545  pInfo->SetFieldColor(boost::optional<Color>());
546  }
547  else if ( auto pTimeField = dynamic_cast<const SvxExtTimeField*>( pField) )
548  {
549  // Time field
550  pInfo->SetRepresentation(
551  pTimeField->GetFormatted(*GetNumberFormatter(), LANGUAGE_SYSTEM) );
552  }
553  else
554  {
555  OSL_FAIL("unknown field command");
556  pInfo->SetRepresentation( OUString( '?' ) );
557  }
558 }
559 
560 // #i62875#
561 namespace docfunc
562 {
563  bool ExistsDrawObjs( SwDoc& p_rDoc )
564  {
565  bool bExistsDrawObjs( false );
566 
567  if ( p_rDoc.getIDocumentDrawModelAccess().GetDrawModel() &&
569  {
570  const SdrPage& rSdrPage( *(p_rDoc.getIDocumentDrawModelAccess().GetDrawModel()->GetPage( 0 )) );
571 
572  SdrObjListIter aIter( &rSdrPage, SdrIterMode::Flat );
573  while( aIter.IsMore() )
574  {
575  SdrObject* pObj( aIter.Next() );
576  if ( !dynamic_cast<SwVirtFlyDrawObj*>(pObj) &&
577  !dynamic_cast<SwFlyDrawObj*>(pObj) )
578  {
579  bExistsDrawObjs = true;
580  break;
581  }
582  }
583  }
584 
585  return bExistsDrawObjs;
586  }
587 
588  bool AllDrawObjsOnPage( SwDoc& p_rDoc )
589  {
590  bool bAllDrawObjsOnPage( true );
591 
592  if ( p_rDoc.getIDocumentDrawModelAccess().GetDrawModel() &&
594  {
595  const SdrPage& rSdrPage( *(p_rDoc.getIDocumentDrawModelAccess().GetDrawModel()->GetPage( 0 )) );
596 
597  SdrObjListIter aIter( &rSdrPage, SdrIterMode::Flat );
598  while( aIter.IsMore() )
599  {
600  SdrObject* pObj( aIter.Next() );
601  if ( !dynamic_cast<SwVirtFlyDrawObj*>(pObj) &&
602  !dynamic_cast<SwFlyDrawObj*>(pObj) )
603  {
604  SwDrawContact* pDrawContact =
605  dynamic_cast<SwDrawContact*>(::GetUserCall( pObj ));
606  if ( pDrawContact )
607  {
608  SwAnchoredDrawObject* pAnchoredDrawObj =
609  dynamic_cast<SwAnchoredDrawObject*>(pDrawContact->GetAnchoredObj( pObj ));
610 
611  // error handling
612  {
613  if ( !pAnchoredDrawObj )
614  {
615  OSL_FAIL( "<docfunc::AllDrawObjsOnPage() - missing anchored draw object" );
616  bAllDrawObjsOnPage = false;
617  break;
618  }
619  }
620 
621  if ( pAnchoredDrawObj->NotYetPositioned() )
622  {
623  // The drawing object isn't yet layouted.
624  // Thus, it isn't known, if all drawing objects are on page.
625  bAllDrawObjsOnPage = false;
626  break;
627  }
628  else if ( pAnchoredDrawObj->IsOutsidePage() )
629  {
630  bAllDrawObjsOnPage = false;
631  break;
632  }
633  }
634  else
635  {
636  // contact object of drawing object doesn't exists.
637  // Thus, the drawing object isn't yet positioned.
638  // Thus, it isn't known, if all drawing objects are on page.
639  bAllDrawObjsOnPage = false;
640  break;
641  }
642  }
643  }
644  }
645 
646  return bAllDrawObjsOnPage;
647  }
648 }
649 
650 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool ExistsDrawObjs(SwDoc &p_rDoc)
method to check, if given Writer document contains at least one drawing object
Definition: docdraw.cxx:563
Base class for the following contact objects (frame + draw objects).
Definition: dcontact.hxx:66
Base class of the Writer layout elements.
Definition: frame.hxx:295
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:149
const SvxColorItem & GetColor(bool=true) const
Definition: charatr.hxx:131
static void lcl_AdjustPositioningAttr(SwDrawFrameFormat *_pFrameFormat, const SdrObject &_rSdrObj)
local method to determine positioning and alignment attributes for a drawing object, which is newly connected to the layout.
Definition: docdraw.cxx:81
size_t GetMarkCount() const
class for the positioning of drawing objects
ZSortFly(const SwFrameFormat *pFrameFormat, const SwFormatAnchor *pFlyAnchor, sal_uInt32 nArrOrdNum)
Definition: docdraw.cxx:481
const SwFrameFormat * pFormat
Definition: mvsave.hxx:155
virtual void SetModified()=0
Must be called manually at changes of format.
#define RES_FRAMEDIR
Definition: hintids.hxx:225
virtual SwUndoId EndUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Closes undo block.
Definition: doc.hxx:185
void PosAttrSet()
Definition: frmfmt.hxx:398
void AddFormatAndObj(SwDrawFrameFormat *pDrawFrameFormat, SdrObject *pDrawObject)
Definition: undraw.cxx:470
void SetCalcFieldValueHdl(Outliner *pOutliner)
In the Outliner, set a link to the method for field display in edit objects.
Definition: docdraw.cxx:491
bool DeleteSelection(SwDrawView &)
Definition: docdraw.cxx:388
long SwTwips
Definition: swtypes.hxx:49
SdrMark * GetMark(size_t nNum) const
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:176
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
SwDrawFrameFormat * MakeDrawFrameFormat(const OUString &rFormatName, SwFrameFormat *pDerivedFrom)
Definition: docfmt.cxx:773
SwContact * GetUserCall(const SdrObject *pObj)
Returns the UserCall if applicable from the group object.
Definition: dcontact.cxx:176
const SwViewShellImp & Imp() const
Definition: dview.hxx:103
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
Definition: doc.cxx:187
virtual const tools::Rectangle & GetSnapRect() const
wrapper class for the positioning of Writer fly frames and drawing objects
void Top(const long nTop)
Definition: swrect.hxx:202
bool IsMore() const
virtual void DelLayoutFormat(SwFrameFormat *pFormat)=0
bool IsTextFrame() const
Definition: frame.hxx:1210
void Right(const long nRight)
Definition: swrect.hxx:198
virtual void SetPositionLayoutDir(const sal_Int16 _nPositionLayoutDir) override
Definition: atrfrm.cxx:3334
virtual bool DoesUndo() const =0
Is Undo enabled?
SwAttrPool * GetPool() const
Definition: swatrset.hxx:190
virtual void MoveObjToVisibleLayer(SdrObject *_pDrawObj)
method to move drawing object to corresponding visible layer
Definition: dcontact.cxx:213
Base class for various Writer styles.
Definition: format.hxx:43
SwDrawContact * GroupSelection(SdrView &)
Definition: docdraw.cxx:198
long getY() const
#define RES_FLYFRMFMT
Definition: hintids.hxx:274
SdrObject * GetMarkedSdrObj() const
long getX() const
bool HasWrap(const SdrObject *pObj)
Definition: dcontact.cxx:144
virtual void AppendUndo(std::unique_ptr< SwUndo > pUndo)=0
Add new Undo action.
virtual void ClearRedo()=0
Delete all Redo actions.
Style of a layout element.
Definition: frmfmt.hxx:57
virtual SwUndoId StartUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Opens undo block.
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:81
Internet visited.
Definition: poolfmt.hxx:122
SwFrameFormat * GetFormat()
Definition: dcontact.hxx:112
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:65
#define LANGUAGE_SYSTEM
int i
const SdrMarkList & GetMarkedObjectList() const
FlyAnchors.
Definition: fmtanchr.hxx:34
const SdrPage * GetPage(sal_uInt16 nPgNum) const
virtual const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
void SetCalcFieldValueHdl(const Link< EditFieldInfo *, void > &rLink)
Internet normal.
Definition: poolfmt.hxx:121
void UnGroupSelection(SdrView &)
Definition: docdraw.cxx:302
IDocumentState const & getIDocumentState() const
Definition: doc.cxx:426
sal_uInt32 nOrdNum
Definition: mvsave.hxx:157
void SetUserCall(SdrObjUserCall *pUser)
virtual const SwAnchoredObject * GetAnchoredObj(const SdrObject *_pSdrObj) const =0
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
void UnGroupMarked()
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:437
const SwFrameFormat * GetDfltFrameFormat() const
Definition: doc.hxx:741
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:460
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:78
virtual const tools::Rectangle & GetLastBoundRect() const
SdrObject * Next()
void Left(const long nLeft)
Definition: swrect.hxx:193
bool AllDrawObjsOnPage(SwDoc &p_rDoc)
method to check, if given Writer document contains only drawing objects, which are completely on its ...
Definition: docdraw.cxx:588
tools::Rectangle SVRect() const
Definition: swrect.hxx:282
static void ReplaceMarkedDrawVirtObjs(SdrMarkView &_rMarkView)
replace marked -objects by its reference object for delete marked objects.
Definition: dview.cxx:901
void AddObj(sal_uInt16 nPos, SwDrawFrameFormat *)
Definition: undraw.cxx:422
#define SAL_WARN_IF(condition, area, stream)
void GroupMarked()
#define RES_DRAWFRMFMT
Definition: hintids.hxx:277
virtual const SwAnchoredObject * GetAnchoredObj(const SdrObject *_pSdrObj) const override
Definition: dcontact.cxx:745
virtual void NbcMove(const Size &rSiz)
void ConnectToLayout(const SwFormatAnchor *pAnch=nullptr)
Inserts SdrObject in the arrays of the layout ((SwPageFrame and SwFrame).
Definition: dcontact.cxx:1720
virtual void Changed(const SdrObject &rObj, SdrUserCallType eType, const tools::Rectangle &rOldBoundRect) override
Virtual methods of SdrObjUserCall.
Definition: dcontact.cxx:949
bool IsRightToLeft() const
Definition: frame.hxx:963
const Point & GetAnchorPos() const
SdrObject * getParentSdrObjectFromSdrObject() const
virtual void CallSwClientNotify(const SfxHint &rHint) const override
Definition: calbck.cxx:376
constexpr::Color COL_LIGHTBLUE(0x00, 0x00, 0xFF)
void DelFrameFormat(SwFrameFormat *pFormat, bool bBroadcast=false)
Definition: docfmt.cxx:715
bool IsVertical() const
Definition: frame.hxx:949
void SAL_CALL first(const css::awt::SpinEvent &rEvent) override
#define SAL_WARN(area, stream)
virtual void NbcSetAnchorPos(const Point &rPnt)
bool MarkObj(const Point &rPnt, short nTol=-2, bool bToggle=false, bool bDeep=false)
const SwFrame * GetAnchorFrame() const
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:116
Point GetFrameAnchorPos(bool bIgnoreFlysAnchoredAtThisFrame) const
returns the position for anchors based on frame direction
Definition: ssfrm.cxx:289
SdrObjUserCall * GetUserCall() const
IMPL_LINK(SwDoc, CalcFieldValueHdl, EditFieldInfo *, pInfo, void)
Recognise fields/URLs in the Outliner and set how they are displayed.
Definition: docdraw.cxx:497
const SwFrameFormat * GetFormat() const
Definition: dflyobj.cxx:441
const Color & GetValue() const
SdrPageView * GetPageView()
Definition: viewimp.hxx:158
const SvxFieldData * GetField() const