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