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