LibreOffice Module sw (master)  1
formatclipboard.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  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <memory>
21 #include <utility>
22 
23 #include <formatclipboard.hxx>
24 
25 #include <cmdid.h>
26 #include <charfmt.hxx>
27 #include <frmfmt.hxx>
28 #include <docstyle.hxx>
29 #include <fchrfmt.hxx>
30 #include <svx/svdview.hxx>
31 #include <editeng/brushitem.hxx>
32 #include <editeng/shaditem.hxx>
33 #include <editeng/boxitem.hxx>
35 #include <fmtlsplt.hxx>
36 #include <editeng/keepitem.hxx>
37 #include <editeng/frmdiritem.hxx>
38 #include <fmtpdsc.hxx>
39 #include <fmtrowsplt.hxx>
40 #include <frmatr.hxx>
41 
42 namespace
43 {
44 
45 std::unique_ptr<SfxItemSet> lcl_CreateEmptyItemSet( SelectionType nSelectionType, SfxItemPool& rPool, bool bNoParagraphFormats = false )
46 {
47  std::unique_ptr<SfxItemSet> pItemSet;
49  {
50  pItemSet = std::make_unique<SfxItemSet>(
51  rPool,
52  svl::Items<
54  // no RES_FRM_SIZE
56  // no RES_VERT_ORIENT
57  // no RES_HORI_ORIENT
58  // no RES_ANCHOR
60  // no RES_FRMMACRO
62  // no RES_URL
64  // no RES_CHAIN
66  }
67  else if( nSelectionType & SelectionType::DrawObject )
68  {
69  //is handled different
70  }
71  else if( nSelectionType & SelectionType::Text )
72  {
73  if( bNoParagraphFormats )
74  pItemSet = std::make_unique<SfxItemSet>(rPool,
76  else
77  pItemSet = std::make_unique<SfxItemSet>(
78  rPool,
79  svl::Items<
82  // no RES_FRM_SIZE
84  // no RES_VERT_ORIENT
85  // no RES_HORI_ORIENT
86  // no RES_ANCHOR
88  // no RES_FRMMACRO
90  // no RES_URL
92  // no RES_CHAIN
94  }
95  return pItemSet;
96 }
97 
98 void lcl_getTableAttributes( SfxItemSet& rSet, SwWrtShell &rSh )
99 {
100  std::unique_ptr<SvxBrushItem> aBrush(std::make_unique<SvxBrushItem>(RES_BACKGROUND));
101  rSh.GetBoxBackground(aBrush);
102  rSet.Put( *aBrush );
103  if(rSh.GetRowBackground(aBrush))
104  {
105  aBrush->SetWhich(SID_ATTR_BRUSH_ROW);
106  rSet.Put( *aBrush );
107  }
108  else
109  rSet.InvalidateItem(SID_ATTR_BRUSH_ROW);
110  rSh.GetTabBackground(aBrush);
111  aBrush->SetWhich(SID_ATTR_BRUSH_TABLE);
112  rSet.Put( *aBrush );
113 
114  SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
115  rSet.Put(aBoxInfo);
116  rSh.GetTabBorders( rSet );
117 
118  std::unique_ptr<SvxFrameDirectionItem> aBoxDirection(std::make_unique<SvxFrameDirectionItem>(SvxFrameDirection::Environment, RES_FRAMEDIR));
119  if(rSh.GetBoxDirection( aBoxDirection ))
120  {
121  aBoxDirection->SetWhich(FN_TABLE_BOX_TEXTORIENTATION);
122  rSet.Put(*aBoxDirection);
123  }
124 
126 
128 
129  SwFrameFormat *pFrameFormat = rSh.GetTableFormat();
130  if(pFrameFormat)
131  {
132  rSet.Put( pFrameFormat->GetShadow() );
133  rSet.Put( pFrameFormat->GetBreak() );
134  rSet.Put( pFrameFormat->GetPageDesc() );
135  rSet.Put( pFrameFormat->GetLayoutSplit() );
136  rSet.Put( pFrameFormat->GetKeep() );
137  rSet.Put( pFrameFormat->GetFrameDir() );
138  }
139 
140  std::unique_ptr<SwFormatRowSplit> pSplit = rSh.GetRowSplit();
141  if(pSplit)
142  rSet.Put(std::move(pSplit));
143 }
144 
145 void lcl_setTableAttributes( const SfxItemSet& rSet, SwWrtShell &rSh )
146 {
147  const SfxPoolItem* pItem = nullptr;
148  bool bBorder = ( SfxItemState::SET == rSet.GetItemState( RES_BOX ) ||
149  SfxItemState::SET == rSet.GetItemState( SID_ATTR_BORDER_INNER ) );
150  bool bBackground = SfxItemState::SET == rSet.GetItemState( RES_BACKGROUND, false, &pItem );
151  const SfxPoolItem* pRowItem = nullptr, *pTableItem = nullptr;
152  bBackground |= SfxItemState::SET == rSet.GetItemState( SID_ATTR_BRUSH_ROW, false, &pRowItem );
153  bBackground |= SfxItemState::SET == rSet.GetItemState( SID_ATTR_BRUSH_TABLE, false, &pTableItem );
154 
155  if(bBackground)
156  {
157  if(pItem)
158  rSh.SetBoxBackground( *static_cast<const SvxBrushItem*>(pItem) );
159  if(pRowItem)
160  {
161  std::unique_ptr<SvxBrushItem> aBrush(static_cast<SvxBrushItem*>(pRowItem->Clone()));
162  aBrush->SetWhich(RES_BACKGROUND);
163  rSh.SetRowBackground(*aBrush);
164  }
165  if(pTableItem)
166  {
167  std::unique_ptr<SvxBrushItem> aBrush(static_cast<SvxBrushItem*>(pTableItem->Clone()));
168  aBrush->SetWhich(RES_BACKGROUND);
169  rSh.SetTabBackground(*aBrush);
170  }
171  }
172  if(bBorder)
173  rSh.SetTabBorders( rSet );
174 
175  if( SfxItemState::SET == rSet.GetItemState( FN_PARAM_TABLE_HEADLINE, false, &pItem) )
176  rSh.SetRowsToRepeat( static_cast<const SfxUInt16Item*>(pItem)->GetValue() );
177 
178  SwFrameFormat* pFrameFormat = rSh.GetTableFormat();
179  if(pFrameFormat)
180  {
181  //RES_SHADOW
182  pItem=nullptr;
183  rSet.GetItemState(rSet.GetPool()->GetWhich(RES_SHADOW), false, &pItem);
184  if(pItem)
185  pFrameFormat->SetFormatAttr( *pItem );
186 
187  //RES_BREAK
188  pItem=nullptr;
189  rSet.GetItemState(rSet.GetPool()->GetWhich(RES_BREAK), false, &pItem);
190  if(pItem)
191  pFrameFormat->SetFormatAttr( *pItem );
192 
193  //RES_PAGEDESC
194  pItem=nullptr;
195  rSet.GetItemState(rSet.GetPool()->GetWhich(RES_PAGEDESC), false, &pItem);
196  if(pItem)
197  pFrameFormat->SetFormatAttr( *pItem );
198 
199  //RES_LAYOUT_SPLIT
200  pItem=nullptr;
201  rSet.GetItemState(rSet.GetPool()->GetWhich(RES_LAYOUT_SPLIT), false, &pItem);
202  if(pItem)
203  pFrameFormat->SetFormatAttr( *pItem );
204 
205  //RES_KEEP
206  pItem=nullptr;
207  rSet.GetItemState(rSet.GetPool()->GetWhich(RES_KEEP), false, &pItem);
208  if(pItem)
209  pFrameFormat->SetFormatAttr( *pItem );
210 
211  //RES_FRAMEDIR
212  pItem=nullptr;
213  rSet.GetItemState(rSet.GetPool()->GetWhich(RES_FRAMEDIR), false, &pItem);
214  if(pItem)
215  pFrameFormat->SetFormatAttr( *pItem );
216  }
217 
218  if( SfxItemState::SET == rSet.GetItemState( FN_TABLE_BOX_TEXTORIENTATION, false, &pItem) )
219  {
220  SvxFrameDirectionItem aDirection( SvxFrameDirection::Environment, RES_FRAMEDIR );
221  aDirection.SetValue(static_cast< const SvxFrameDirectionItem* >(pItem)->GetValue());
222  rSh.SetBoxDirection(aDirection);
223  }
224 
225  if( SfxItemState::SET == rSet.GetItemState( FN_TABLE_SET_VERT_ALIGN, false, &pItem))
226  rSh.SetBoxAlign(static_cast<const SfxUInt16Item*>(pItem)->GetValue());
227 
228  if( SfxItemState::SET == rSet.GetItemState( RES_ROW_SPLIT, false, &pItem) )
229  rSh.SetRowSplit(*static_cast<const SwFormatRowSplit*>(pItem));
230 }
231 }//end anonymous namespace
232 
234  : m_nSelectionType(SelectionType::NONE)
235  , m_bPersistentCopy(false)
236 {
237 }
238 
240 {
241  return m_pItemSet_TextAttr!=nullptr
242  || m_pItemSet_ParAttr!=nullptr
243  || m_pTableItemSet != nullptr
244  || !m_aCharStyle.isEmpty()
245  || !m_aParaStyle.isEmpty()
246  ;
247 }
249 {
250  if( !HasContent() )
251  return false;
252 
253  if( m_nSelectionType == nSelectionType )
254  return true;
255 
256  if( ( nSelectionType & (SelectionType::Frame | SelectionType::Ole | SelectionType::Graphic) )
257  &&
259  )
260  return true;
261 
262  if( nSelectionType & SelectionType::Text && m_nSelectionType & SelectionType::Text )
263  return true;
264 
265  return false;
266 }
267 
269 {
270  return bool(nSelectionType
272  | SelectionType::Text | SelectionType::DrawObject | SelectionType::Table | SelectionType::TableCell ));
273 }
274 
275 void SwFormatClipboard::Copy( SwWrtShell& rWrtShell, SfxItemPool& rPool, bool bPersistentCopy )
276 {
277  // first clear the previously stored attributes
278  Erase();
279  m_bPersistentCopy = bPersistentCopy;
280 
281  SelectionType nSelectionType = rWrtShell.GetSelectionType();
282  auto pItemSet_TextAttr = lcl_CreateEmptyItemSet( nSelectionType, rPool, true );
283  auto pItemSet_ParAttr = lcl_CreateEmptyItemSet( nSelectionType, rPool );
284 
285  rWrtShell.StartAction();
286  rWrtShell.Push();
287 
288  // modify the "Point and Mark" of the cursor
289  // in order to select only the last character of the
290  // selection(s) and then to get the attributes of this single character
291  if( nSelectionType == SelectionType::Text )
292  {
293  // get the current PaM, the cursor
294  // if there several selection it currently point
295  // on the last (sort by there creation time) selection
296  SwPaM* pCursor = rWrtShell.GetCursor();
297 
298  bool bHasSelection = pCursor->HasMark();
299  bool bForwardSelection = false;
300 
301  if(!bHasSelection && pCursor->IsMultiSelection())
302  {
303  // if cursor has multiple selections
304 
305  // clear all the selections except the last
306  rWrtShell.KillPams();
307 
308  // reset the cursor to the remaining selection
309  pCursor = rWrtShell.GetCursor();
310  bHasSelection = true;
311  }
312 
313  bool dontMove = false;
314  if (bHasSelection)
315  {
316  bForwardSelection = (*pCursor->GetPoint()) > (*pCursor->GetMark());
317 
318  // clear the selection leaving just the cursor
319  pCursor->DeleteMark();
320  pCursor->SetMark();
321  }
322  else
323  {
324  bool rightToLeft = rWrtShell.IsInRightToLeftText();
325  // if there were no selection (only a cursor) and the cursor was at
326  // the end of the paragraph then don't move
327  if ( rWrtShell.IsEndPara() && !rightToLeft )
328  dontMove = true;
329 
330  // revert left and right
331  if ( rightToLeft )
332  {
333  if (pCursor->GetPoint()->nContent == 0)
334  dontMove = true;
335  else
336  bForwardSelection = !bForwardSelection;
337  }
338  }
339 
340  // move the cursor in order to select one character
341  if (!dontMove)
342  pCursor->Move( bForwardSelection ? fnMoveBackward : fnMoveForward );
343  }
344 
345  if(pItemSet_TextAttr)
346  {
348  rWrtShell.GetFlyFrameAttr(*pItemSet_TextAttr);
349  else
350  {
351  // get the text attributes from named and automatic formatting
352  rWrtShell.GetCurAttr(*pItemSet_TextAttr);
353 
354  if( nSelectionType & SelectionType::Text )
355  {
356  // get the paragraph attributes (could be character properties)
357  // from named and automatic formatting
358  rWrtShell.GetCurParAttr(*pItemSet_ParAttr);
359  }
360  }
361  }
362  else if ( nSelectionType & SelectionType::DrawObject )
363  {
364  SdrView* pDrawView = rWrtShell.GetDrawView();
365  if(pDrawView)
366  {
367  if( pDrawView->AreObjectsMarked() )
368  {
369  pItemSet_TextAttr = std::make_unique<SfxItemSet>( pDrawView->GetAttrFromMarked(true/*bOnlyHardAttr*/) );
370  //remove attributes defining the type/data of custom shapes
371  pItemSet_TextAttr->ClearItem(SDRATTR_CUSTOMSHAPE_ENGINE);
372  pItemSet_TextAttr->ClearItem(SDRATTR_CUSTOMSHAPE_DATA);
373  pItemSet_TextAttr->ClearItem(SDRATTR_CUSTOMSHAPE_GEOMETRY);
374  }
375  }
376  }
377 
378  if( nSelectionType & SelectionType::TableCell )//only copy table attributes if really cells are selected (not only text in tables)
379  {
380  m_pTableItemSet = std::make_unique<SfxItemSet>(
381  rPool,
382  svl::Items<
384  RES_BACKGROUND, RES_SHADOW, // RES_BOX is inbetween
389  SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_SHADOW,
390  // SID_ATTR_BORDER_OUTER is inbetween
391  SID_ATTR_BRUSH_ROW, SID_ATTR_BRUSH_TABLE,
394  FN_PARAM_TABLE_HEADLINE, FN_PARAM_TABLE_HEADLINE>{});
395  lcl_getTableAttributes( *m_pTableItemSet, rWrtShell );
396  }
397 
398  m_nSelectionType = nSelectionType;
399  m_pItemSet_TextAttr = std::move(pItemSet_TextAttr);
400  m_pItemSet_ParAttr = std::move(pItemSet_ParAttr);
401 
402  if( nSelectionType & SelectionType::Text )
403  {
404  // if text is selected save the named character format
405  SwFormat* pFormat = rWrtShell.GetCurCharFormat();
406  if( pFormat )
407  m_aCharStyle = pFormat->GetName();
408 
409  // and the named paragraph format
410  pFormat = rWrtShell.GetCurTextFormatColl();
411  if( pFormat )
412  m_aParaStyle = pFormat->GetName();
413  }
414 
416  rWrtShell.EndAction();
417 }
418 
419 typedef std::vector< std::unique_ptr< SfxPoolItem > > ItemVector;
420 // collect all PoolItems from the applied styles
421 static void lcl_AppendSetItems( ItemVector& rItemVector, const SfxItemSet& rStyleAttrSet )
422 {
423  const sal_uInt16* pRanges = rStyleAttrSet.GetRanges();
424  while( *pRanges )
425  {
426  for ( sal_uInt16 nWhich = *pRanges; nWhich <= *(pRanges+1); ++nWhich )
427  {
428  const SfxPoolItem* pItem;
429  if( SfxItemState::SET == rStyleAttrSet.GetItemState( nWhich, false, &pItem ) )
430  {
431  rItemVector.emplace_back( pItem->Clone() );
432  }
433  }
434  pRanges += 2;
435  }
436 }
437 // remove all items that are inherited from the styles
438 static void lcl_RemoveEqualItems( SfxItemSet& rTemplateItemSet, const ItemVector& rItemVector )
439 {
440  for( const auto& rItem : rItemVector )
441  {
442  const SfxPoolItem* pItem;
443  if( SfxItemState::SET == rTemplateItemSet.GetItemState( rItem->Which(), true, &pItem ) &&
444  *pItem == *rItem )
445  {
446  rTemplateItemSet.ClearItem( rItem->Which() );
447  }
448  }
449 }
450 
452  , bool bNoCharacterFormats, bool bNoParagraphFormats )
453 {
454  SelectionType nSelectionType = rWrtShell.GetSelectionType();
455  if( !HasContentForThisType(nSelectionType) )
456  {
457  if(!m_bPersistentCopy)
458  Erase();
459  return;
460  }
461 
462  rWrtShell.StartAction();
463  rWrtShell.StartUndo(SwUndoId::INSATTR);
464 
465  ItemVector aItemVector;
466 
467  if( nSelectionType & SelectionType::Text )
468  {
469  // apply the named text and paragraph formatting
470  if( pPool )
471  {
472  // if there is a named text format recorded and the user wants to apply it
473  if(!m_aCharStyle.isEmpty() && !bNoCharacterFormats )
474  {
475  // look for the named text format in the pool
476  SwDocStyleSheet* pStyle = static_cast<SwDocStyleSheet*>(pPool->Find(m_aCharStyle, SfxStyleFamily::Char));
477 
478  // if the style is found
479  if( pStyle )
480  {
481  SwFormatCharFormat aFormat(pStyle->GetCharFormat());
482  // store the attributes from this style in aItemVector in order
483  // not to apply them as automatic formatting attributes later in the code
484  lcl_AppendSetItems( aItemVector, aFormat.GetCharFormat()->GetAttrSet());
485 
486  // apply the named format
487  rWrtShell.SetAttrItem( aFormat );
488  }
489  }
490 
491  // if there is a named paragraph format recorded and the user wants to apply it
492  if(!m_aParaStyle.isEmpty() && !bNoParagraphFormats )
493  {
494  // look for the named pragraph format in the pool
495  SwDocStyleSheet* pStyle = static_cast<SwDocStyleSheet*>(pPool->Find(m_aParaStyle, SfxStyleFamily::Para));
496  if( pStyle )
497  {
498  // store the attributes from this style in aItemVector in order
499  // not to apply them as automatic formatting attributes later in the code
500  lcl_AppendSetItems( aItemVector, pStyle->GetCollection()->GetAttrSet());
501 
502  // apply the named format
503  rWrtShell.SetTextFormatColl( pStyle->GetCollection() );
504  }
505  }
506  }
507 
508  // apply the paragraph automatic attributes
509  if ( m_pItemSet_ParAttr && m_pItemSet_ParAttr->Count() != 0 && !bNoParagraphFormats )
510  {
511  // temporary SfxItemSet
512  std::unique_ptr<SfxItemSet> pTemplateItemSet(lcl_CreateEmptyItemSet(
513  nSelectionType, *m_pItemSet_ParAttr->GetPool()));
514  // no need to verify the existence of pTemplateItemSet as we
515  // know that here the selection type is SEL_TXT
516 
517  pTemplateItemSet->Put( *m_pItemSet_ParAttr );
518 
519  // remove attribute that were applied by named text and paragraph formatting
520  lcl_RemoveEqualItems( *pTemplateItemSet, aItemVector );
521 
522  // apply the paragraph automatic attributes to all the nodes in the selection
523  rWrtShell.SetAttrSet(*pTemplateItemSet);
524 
525  // store the attributes in aItemVector in order not to apply them as
526  // text automatic formatting attributes later in the code
527  lcl_AppendSetItems( aItemVector, *pTemplateItemSet);
528  }
529  }
530 
532  {
533  if( nSelectionType & SelectionType::DrawObject )
534  {
535  SdrView* pDrawView = rWrtShell.GetDrawView();
536  if(pDrawView)
537  {
538  pDrawView->SetAttrToMarked(*m_pItemSet_TextAttr, true/*bReplaceAll*/);
539  }
540  }
541  else
542  {
543  // temporary SfxItemSet
544  std::unique_ptr<SfxItemSet> pTemplateItemSet(lcl_CreateEmptyItemSet(
545  nSelectionType, *m_pItemSet_TextAttr->GetPool(), true ));
546 
547  if(pTemplateItemSet)
548  {
549  // copy the stored automatic text attributes in a temporary SfxItemSet
550  pTemplateItemSet->Put( *m_pItemSet_TextAttr );
551 
552  // only attributes that were not apply by named style attributes and automatic
553  // paragraph attributes should be applied
554  lcl_RemoveEqualItems( *pTemplateItemSet, aItemVector );
555 
556  // apply the character automatic attributes
558  rWrtShell.SetFlyFrameAttr(*pTemplateItemSet);
559  else if ( !bNoCharacterFormats )
560  rWrtShell.SetAttrSet(*pTemplateItemSet);
561  }
562  }
563  }
564 
566  lcl_setTableAttributes( *m_pTableItemSet, rWrtShell );
567 
568  rWrtShell.EndUndo(SwUndoId::INSATTR);
569  rWrtShell.EndAction();
570 
571  if(!m_bPersistentCopy)
572  Erase();
573 }
574 
576 {
578 
579  m_pItemSet_TextAttr.reset();
580 
581  m_pItemSet_ParAttr.reset();
582 
583  m_pTableItemSet.reset();
584 
585  if( !m_aCharStyle.isEmpty() )
586  m_aCharStyle.clear();
587  if( !m_aParaStyle.isEmpty() )
588  m_aParaStyle.clear();
589 
590  m_bPersistentCopy = false;
591 }
592 
593 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr TypedWhichId< SvxFrameDirectionItem > RES_FRAMEDIR(120)
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
void DeleteMark()
Definition: pam.hxx:177
constexpr TypedWhichId< SwFormatSurround > RES_SURROUND(101)
constexpr TypedWhichId< SwFormatFillOrder > RES_FILL_ORDER(RES_FRMATR_BEGIN)
void KillPams()
Definition: crsrsh.cxx:1019
SwTextFormatColl * GetCurTextFormatColl() const
Get the named paragraph format of the current selection.
Definition: edattr.cxx:245
const SwFormatLayoutSplit & GetLayoutSplit(bool=true) const
Definition: fmtlsplt.hxx:46
bool IsMultiSelection() const
Definition: pam.hxx:272
SdrView * GetDrawView()
Definition: vnew.cxx:375
SwPaM * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:188
void SetRowSplit(const SwFormatRowSplit &rSz)
Definition: fetab.cxx:703
constexpr TypedWhichId< SwFormatEditInReadonly > RES_EDIT_IN_READONLY(112)
std::string GetValue
constexpr TypedWhichId< SwFormatCol > RES_COL(109)
void SetRowBackground(const SvxBrushItem &rNew)
Definition: fetab.cxx:740
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
constexpr TypedWhichId< SvxFormatKeepItem > RES_KEEP(110)
bool AreObjectsMarked() const
const SwPosition * GetMark() const
Definition: pam.hxx:209
const SvxFrameDirectionItem & GetFrameDir(bool=true) const
Definition: frmatr.hxx:94
constexpr TypedWhichId< SvxPaperBinItem > RES_PAPER_BIN(90)
void SetAttrSet(const SfxItemSet &, SetAttrMode nFlags=SetAttrMode::DEFAULT, SwPaM *pCursor=nullptr, const bool bParagraphSetting=false)
Definition: edatmisc.cxx:151
bool Pop(SwCursorShell::PopMode=SwCursorShell::PopMode::DeleteStack)
Definition: wrtsh1.cxx:1708
void InvalidateItem(sal_uInt16 nWhich)
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
Definition: edws.cxx:234
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(94)
bool HasContent() const
Test if the object contains text or paragraph attribute.
bool m_bPersistentCopy
specify if the Paste function have to clear the current object
void GetCurParAttr(SfxItemSet &rSet) const
Get the paragraph format attribute(s) of the current selection.
Definition: edattr.cxx:182
constexpr TypedWhichId< SwFormatLayoutSplit > RES_LAYOUT_SPLIT(113)
void Copy(SwWrtShell &rWrtShell, SfxItemPool &rPool, bool bPersistentCopy)
Store/Backup the text and paragraph attribute of the current selection.
static void lcl_AppendSetItems(ItemVector &rItemVector, const SfxItemSet &rStyleAttrSet)
void SetTabBackground(const SvxBrushItem &rNew)
Definition: fetab.cxx:821
Used by the UI to modify the document model.
Definition: wrtsh.hxx:90
#define FN_PARAM_TABLE_HEADLINE
Definition: cmdid.h:771
static void lcl_RemoveEqualItems(SfxItemSet &rTemplateItemSet, const ItemVector &rItemVector)
void SetAttrToMarked(const SfxItemSet &rAttr, bool bReplaceAll)
constexpr sal_uInt16 RES_PARATR_BEGIN(RES_TXTATR_END)
SwIndex nContent
Definition: pam.hxx:38
constexpr TypedWhichId< SfxStringItem > SDRATTR_CUSTOMSHAPE_DATA(SDRATTR_CUSTOMSHAPE_FIRST+1)
const OUString & GetName() const
Definition: format.hxx:111
const SvxFormatKeepItem & GetKeep(bool=true) const
Definition: frmatr.hxx:86
static bool CanCopyThisType(SelectionType nSelectionType)
SwCharFormat * GetCharFormat()
Definition: docstyle.cxx:2147
Base class for various Writer styles.
Definition: format.hxx:43
constexpr TypedWhichId< SwFormatRowSplit > RES_ROW_SPLIT(122)
bool GetFlyFrameAttr(SfxItemSet &rSet) const
Definition: fefly1.cxx:1034
std::unique_ptr< SfxItemSet > m_pTableItemSet
table attribute set
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
Definition: pam.cxx:501
void SetTabBorders(const SfxItemSet &rSet)
Definition: fetab.cxx:753
void SetBoxBackground(const SvxBrushItem &rNew)
Definition: fetab.cxx:776
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
void SetTextFormatColl(SwTextFormatColl *, const bool bResetListAttrs=false)
Add 2nd optional parameter - see also
Definition: edfcol.cxx:2180
Style of a layout element.
Definition: frmfmt.hxx:57
bool IsInRightToLeftText() const
Definition: crsrsh.cxx:3399
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
constexpr TypedWhichId< SdrCustomShapeGeometryItem > SDRATTR_CUSTOMSHAPE_GEOMETRY(SDRATTR_CUSTOMSHAPE_FIRST+2)
void SetRowsToRepeat(sal_uInt16 nNumOfRows)
Definition: fetab.cxx:998
SelectionType m_nSelectionType
const SwPosition * GetPoint() const
Definition: pam.hxx:207
css::drawing::Direction3D aDirection
bool HasContentForThisType(SelectionType nSelectionType) const
void EndAction(const bool bIdleEnd=false, const bool DoSetPosX=false)
Definition: crsrsh.cxx:238
void Push()
store a copy of the current cursor on the cursor stack
Definition: crsrsh.cxx:2235
std::unique_ptr< SfxItemSet > m_pItemSet_TextAttr
automatic/named character attribute set
void SetAttrItem(const SfxPoolItem &, SetAttrMode nFlags=SetAttrMode::DEFAULT, const bool bParagraphSetting=false)
Definition: edatmisc.cxx:112
bool SetFlyFrameAttr(SfxItemSet &rSet)
Definition: fefly1.cxx:1077
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:205
SwUndoId StartUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Undo: set up Undo parenthesis, return nUndoId of this parenthesis.
Definition: edws.cxx:223
void SetBoxAlign(sal_uInt16 nOrient)
Definition: fetab.cxx:808
const SvxFormatBreakItem & GetBreak(bool=true) const
Definition: frmatr.hxx:90
void GetTabBackground(std::unique_ptr< SvxBrushItem > &rToFill) const
Definition: fetab.cxx:834
SfxItemPool * GetPool() const
SwFrameFormat * GetTableFormat()
Definition: edws.cxx:183
void Paste(SwWrtShell &rWrtShell, SfxStyleSheetBasePool *pPool, bool bNoCharacterFormats, bool bNoParagraphFormats)
Paste the stored text and paragraph attributes on the current selection and current paragraph...
std::unique_ptr< SwFormatRowSplit > GetRowSplit() const
Definition: fetab.cxx:711
void StartAction()
Definition: crsrsh.cxx:221
SelectionType
Definition: wrtsh.hxx:58
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:458
constexpr sal_uInt16 RES_FRMATR_END(131)
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
constexpr TypedWhichId< SwTextGridItem > RES_TEXTGRID(115)
SwTextFormatColl * GetCollection()
Definition: docstyle.cxx:2154
constexpr sal_uInt16 RES_CHRATR_BEGIN(HINT_BEGIN)
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(105)
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
std::unique_ptr< SfxItemSet > m_pItemSet_ParAttr
automatic/named paragraph attribute set (it can be character attribute applied to the paragraph) ...
SwMoveFnCollection const & fnMoveForward
SwPam::Move()/Find() default argument.
Definition: paminit.cxx:59
void SetWhich(sal_uInt16 nId)
SfxItemSet GetAttrFromMarked(bool bOnlyHardAttr) const
#define FN_TABLE_BOX_TEXTORIENTATION
Definition: cmdid.h:425
OUString m_aCharStyle
name of the character format (if it exist)
bool GetCurAttr(SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
Definition: edattr.cxx:176
constexpr sal_uInt16 RES_CHRATR_END(46)
constexpr TypedWhichId< SvxBoxItem > RES_BOX(106)
void GetTabBorders(SfxItemSet &rSet) const
Definition: fetab.cxx:771
bool GetRowBackground(std::unique_ptr< SvxBrushItem > &rToFill) const
FALSE ambiguous.
Definition: fetab.cxx:748
SwMoveFnCollection const & fnMoveBackward
Definition: paminit.cxx:58
bool GetBoxDirection(std::unique_ptr< SvxFrameDirectionItem > &rToFill) const
FALSE ambiguous.
Definition: fetab.cxx:800
const sal_uInt16 * GetRanges() const
SwCharFormat * GetCurCharFormat() const
Definition: edfmt.cxx:40
sal_uInt16 GetBoxAlign() const
USHRT_MAX if ambiguous.
Definition: fetab.cxx:816
sal_uInt16 GetRowsToRepeat() const
Definition: fetab.cxx:989
OUString m_aParaStyle
name of the paragraph format (if it exist)
bool IsEndPara() const
Definition: crsrsh.cxx:1111
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:475
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:116
const SwFormatPageDesc & GetPageDesc(bool=true) const
Definition: fmtpdsc.hxx:79
SelectionType GetSelectionType() const
Definition: wrtsh1.cxx:1388
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
#define FN_TABLE_SET_VERT_ALIGN
Definition: cmdid.h:421
constexpr sal_uInt16 RES_FRMATR_BEGIN(RES_PARATR_LIST_END)
bool GetBoxBackground(std::unique_ptr< SvxBrushItem > &rToFill) const
FALSE ambiguous.
Definition: fetab.cxx:784
constexpr TypedWhichId< SfxStringItem > SDRATTR_CUSTOMSHAPE_ENGINE(SDRATTR_CUSTOMSHAPE_FIRST+0)
std::vector< std::unique_ptr< SfxPoolItem > > ItemVector
constexpr TypedWhichId< SvxShadowItem > RES_SHADOW(107)
void Erase()
Clear the currently stored text and paragraph attributes.
void SetBoxDirection(const SvxFrameDirectionItem &rNew)
Definition: fetab.cxx:792
const SvxShadowItem & GetShadow(bool=true) const
Definition: frmatr.hxx:88