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<SfxItemSetFixed<
52  // no RES_FRM_SIZE
54  // no RES_VERT_ORIENT
55  // no RES_HORI_ORIENT
56  // no RES_ANCHOR
58  // no RES_FRMMACRO
60  // no RES_URL
62  // no RES_CHAIN
63  RES_TEXTGRID, RES_FRMATR_END - 1>>(rPool);
64  }
65  else if( nSelectionType & SelectionType::DrawObject )
66  {
67  //is handled different
68  }
69  else if( nSelectionType & SelectionType::Text )
70  {
71  if( bNoParagraphFormats )
72  pItemSet = std::make_unique<SfxItemSetFixed
73  <RES_CHRATR_BEGIN, RES_CHRATR_END - 1>>(rPool);
74  else
75  pItemSet = std::make_unique<SfxItemSetFixed<
78  // no RES_FRM_SIZE
80  // no RES_VERT_ORIENT
81  // no RES_HORI_ORIENT
82  // no RES_ANCHOR
84  // no RES_FRMMACRO
86  // no RES_URL
88  // no RES_CHAIN
89  RES_TEXTGRID, RES_FRMATR_END - 1>>(rPool);
90  }
91  return pItemSet;
92 }
93 
94 void lcl_getTableAttributes( SfxItemSet& rSet, SwWrtShell &rSh )
95 {
96  std::unique_ptr<SvxBrushItem> aBrush(std::make_unique<SvxBrushItem>(RES_BACKGROUND));
97  rSh.GetBoxBackground(aBrush);
98  rSet.Put( *aBrush );
99  if(rSh.GetRowBackground(aBrush))
100  {
101  aBrush->SetWhich(SID_ATTR_BRUSH_ROW);
102  rSet.Put( *aBrush );
103  }
104  else
105  rSet.InvalidateItem(SID_ATTR_BRUSH_ROW);
106  rSh.GetTabBackground(aBrush);
107  aBrush->SetWhich(SID_ATTR_BRUSH_TABLE);
108  rSet.Put( *aBrush );
109 
110  SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
111  rSet.Put(aBoxInfo);
112  rSh.GetTabBorders( rSet );
113 
114  std::unique_ptr<SvxFrameDirectionItem> aBoxDirection(std::make_unique<SvxFrameDirectionItem>(SvxFrameDirection::Environment, RES_FRAMEDIR));
115  if(rSh.GetBoxDirection( aBoxDirection ))
116  {
117  aBoxDirection->SetWhich(FN_TABLE_BOX_TEXTORIENTATION);
118  rSet.Put(*aBoxDirection);
119  }
120 
122 
124 
125  SwFrameFormat *pFrameFormat = rSh.GetTableFormat();
126  if(pFrameFormat)
127  {
128  rSet.Put( pFrameFormat->GetShadow() );
129  rSet.Put( pFrameFormat->GetBreak() );
130  rSet.Put( pFrameFormat->GetPageDesc() );
131  rSet.Put( pFrameFormat->GetLayoutSplit() );
132  rSet.Put( pFrameFormat->GetKeep() );
133  rSet.Put( pFrameFormat->GetFrameDir() );
134  }
135 
136  std::unique_ptr<SwFormatRowSplit> pSplit = rSh.GetRowSplit();
137  if(pSplit)
138  rSet.Put(std::move(pSplit));
139 }
140 
141 void lcl_setTableAttributes( const SfxItemSet& rSet, SwWrtShell &rSh )
142 {
143  bool bBorder = ( SfxItemState::SET == rSet.GetItemState( RES_BOX ) ||
144  SfxItemState::SET == rSet.GetItemState( SID_ATTR_BORDER_INNER ) );
145  const SvxBrushItem* pBackgroundItem = rSet.GetItemIfSet( RES_BACKGROUND, false );
146  const SvxBrushItem* pRowItem = rSet.GetItemIfSet( SID_ATTR_BRUSH_ROW, false );
147  const SvxBrushItem* pTableItem = rSet.GetItemIfSet( SID_ATTR_BRUSH_TABLE, false );
148  bool bBackground = pBackgroundItem || pRowItem || pTableItem;
149 
150  if(bBackground)
151  {
152  if(pBackgroundItem)
153  rSh.SetBoxBackground( *pBackgroundItem );
154  if(pRowItem)
155  {
156  std::unique_ptr<SvxBrushItem> aBrush(pRowItem->Clone());
157  aBrush->SetWhich(RES_BACKGROUND);
158  rSh.SetRowBackground(*aBrush);
159  }
160  if(pTableItem)
161  {
162  std::unique_ptr<SvxBrushItem> aBrush(pTableItem->Clone());
163  aBrush->SetWhich(RES_BACKGROUND);
164  rSh.SetTabBackground(*aBrush);
165  }
166  }
167  if(bBorder)
168  rSh.SetTabBorders( rSet );
169 
170  if( const SfxUInt16Item* pHeadlineItem = rSet.GetItemIfSet( FN_PARAM_TABLE_HEADLINE, false) )
171  rSh.SetRowsToRepeat( pHeadlineItem->GetValue() );
172 
173  SwFrameFormat* pFrameFormat = rSh.GetTableFormat();
174  if(pFrameFormat)
175  {
176  //RES_SHADOW
177  const SfxPoolItem* pItem = rSet.GetItemIfSet(rSet.GetPool()->GetWhich(RES_SHADOW), false);
178  if(pItem)
179  pFrameFormat->SetFormatAttr( *pItem );
180 
181  //RES_BREAK
182  pItem = rSet.GetItemIfSet(rSet.GetPool()->GetWhich(RES_BREAK), false);
183  if(pItem)
184  pFrameFormat->SetFormatAttr( *pItem );
185 
186  //RES_PAGEDESC
187  pItem = rSet.GetItemIfSet(rSet.GetPool()->GetWhich(RES_PAGEDESC), false);
188  if(pItem)
189  pFrameFormat->SetFormatAttr( *pItem );
190 
191  //RES_LAYOUT_SPLIT
192  pItem = rSet.GetItemIfSet(rSet.GetPool()->GetWhich(RES_LAYOUT_SPLIT), false);
193  if(pItem)
194  pFrameFormat->SetFormatAttr( *pItem );
195 
196  //RES_KEEP
197  pItem = rSet.GetItemIfSet(rSet.GetPool()->GetWhich(RES_KEEP), false);
198  if(pItem)
199  pFrameFormat->SetFormatAttr( *pItem );
200 
201  //RES_FRAMEDIR
202  pItem = rSet.GetItemIfSet(rSet.GetPool()->GetWhich(RES_FRAMEDIR), false);
203  if(pItem)
204  pFrameFormat->SetFormatAttr( *pItem );
205  }
206 
207  if( const SvxFrameDirectionItem* pTextOriItem = rSet.GetItemIfSet( FN_TABLE_BOX_TEXTORIENTATION, false ) )
208  {
209  SvxFrameDirectionItem aDirection( SvxFrameDirection::Environment, RES_FRAMEDIR );
210  aDirection.SetValue(pTextOriItem->GetValue());
211  rSh.SetBoxDirection(aDirection);
212  }
213 
214  if( const SfxUInt16Item* pVertAlignItem = rSet.GetItemIfSet( FN_TABLE_SET_VERT_ALIGN, false ))
215  rSh.SetBoxAlign(pVertAlignItem->GetValue());
216 
217  if( const SwFormatRowSplit* pSplitItem = rSet.GetItemIfSet( RES_ROW_SPLIT, false ) )
218  rSh.SetRowSplit(*pSplitItem);
219 }
220 }//end anonymous namespace
221 
223  : m_nSelectionType(SelectionType::NONE)
224  , m_bPersistentCopy(false)
225 {
226 }
227 
229 {
230  return m_pItemSet_TextAttr!=nullptr
231  || m_pItemSet_ParAttr!=nullptr
232  || m_pTableItemSet != nullptr
233  || !m_aCharStyle.isEmpty()
234  || !m_aParaStyle.isEmpty()
235  ;
236 }
238 {
239  if( !HasContent() )
240  return false;
241 
242  if( m_nSelectionType == nSelectionType )
243  return true;
244 
245  if( ( nSelectionType & (SelectionType::Frame | SelectionType::Ole | SelectionType::Graphic) )
246  &&
248  )
249  return true;
250 
251  if( nSelectionType & SelectionType::Text && m_nSelectionType & SelectionType::Text )
252  return true;
253 
254  return false;
255 }
256 
258 {
259  return bool(nSelectionType
261  | SelectionType::Text | SelectionType::DrawObject | SelectionType::Table | SelectionType::TableCell ));
262 }
263 
264 void SwFormatClipboard::Copy( SwWrtShell& rWrtShell, SfxItemPool& rPool, bool bPersistentCopy )
265 {
266  // first clear the previously stored attributes
267  Erase();
268  m_bPersistentCopy = bPersistentCopy;
269 
270  SelectionType nSelectionType = rWrtShell.GetSelectionType();
271  auto pItemSet_TextAttr = lcl_CreateEmptyItemSet( nSelectionType, rPool, true );
272  auto pItemSet_ParAttr = lcl_CreateEmptyItemSet( nSelectionType, rPool );
273 
274  rWrtShell.StartAction();
275  rWrtShell.Push();
276 
277  // modify the "Point and Mark" of the cursor
278  // in order to select only the last character of the
279  // selection(s) and then to get the attributes of this single character
280  if( nSelectionType == SelectionType::Text )
281  {
282  // get the current PaM, the cursor
283  // if there several selection it currently point
284  // on the last (sort by there creation time) selection
285  SwPaM* pCursor = rWrtShell.GetCursor();
286 
287  bool bHasSelection = pCursor->HasMark();
288  bool bForwardSelection = false;
289 
290  if(!bHasSelection && pCursor->IsMultiSelection())
291  {
292  // if cursor has multiple selections
293 
294  // clear all the selections except the last
295  rWrtShell.KillPams();
296 
297  // reset the cursor to the remaining selection
298  pCursor = rWrtShell.GetCursor();
299  bHasSelection = true;
300  }
301 
302  bool dontMove = false;
303  if (bHasSelection)
304  {
305  bForwardSelection = (*pCursor->GetPoint()) > (*pCursor->GetMark());
306 
307  // clear the selection leaving just the cursor
308  pCursor->DeleteMark();
309  pCursor->SetMark();
310  }
311  else
312  {
313  bool rightToLeft = rWrtShell.IsInRightToLeftText();
314  // if there were no selection (only a cursor) and the cursor was at
315  // the end of the paragraph then don't move
316  if ( rWrtShell.IsEndPara() && !rightToLeft )
317  dontMove = true;
318 
319  // revert left and right
320  if ( rightToLeft )
321  {
322  if (pCursor->GetPoint()->nContent == 0)
323  dontMove = true;
324  else
325  bForwardSelection = !bForwardSelection;
326  }
327  }
328 
329  // move the cursor in order to select one character
330  if (!dontMove)
331  pCursor->Move( bForwardSelection ? fnMoveBackward : fnMoveForward );
332  }
333 
334  if(pItemSet_TextAttr)
335  {
337  rWrtShell.GetFlyFrameAttr(*pItemSet_TextAttr);
338  else
339  {
340  // get the text attributes from named and automatic formatting
341  rWrtShell.GetCurAttr(*pItemSet_TextAttr);
342 
343  if( nSelectionType & SelectionType::Text )
344  {
345  // get the paragraph attributes (could be character properties)
346  // from named and automatic formatting
347  rWrtShell.GetCurParAttr(*pItemSet_ParAttr);
348  }
349  }
350  }
351  else if ( nSelectionType & SelectionType::DrawObject )
352  {
353  SdrView* pDrawView = rWrtShell.GetDrawView();
354  if(pDrawView)
355  {
356  if( pDrawView->AreObjectsMarked() )
357  {
358  pItemSet_TextAttr = std::make_unique<SfxItemSet>( pDrawView->GetAttrFromMarked(true/*bOnlyHardAttr*/) );
359  //remove attributes defining the type/data of custom shapes
360  pItemSet_TextAttr->ClearItem(SDRATTR_CUSTOMSHAPE_ENGINE);
361  pItemSet_TextAttr->ClearItem(SDRATTR_CUSTOMSHAPE_DATA);
362  pItemSet_TextAttr->ClearItem(SDRATTR_CUSTOMSHAPE_GEOMETRY);
363  }
364  }
365  }
366 
367  if( nSelectionType & SelectionType::TableCell )//only copy table attributes if really cells are selected (not only text in tables)
368  {
369  m_pTableItemSet = std::make_unique<SfxItemSetFixed<
371  RES_BACKGROUND, RES_SHADOW, // RES_BOX is inbetween
376  SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_SHADOW,
377  // SID_ATTR_BORDER_OUTER is inbetween
378  SID_ATTR_BRUSH_ROW, SID_ATTR_BRUSH_TABLE,
381  FN_PARAM_TABLE_HEADLINE, FN_PARAM_TABLE_HEADLINE>>(rPool);
382  lcl_getTableAttributes( *m_pTableItemSet, rWrtShell );
383  }
384 
385  m_nSelectionType = nSelectionType;
386  m_pItemSet_TextAttr = std::move(pItemSet_TextAttr);
387  m_pItemSet_ParAttr = std::move(pItemSet_ParAttr);
388 
389  if( nSelectionType & SelectionType::Text )
390  {
391  // if text is selected save the named character format
392  SwFormat* pFormat = rWrtShell.GetCurCharFormat();
393  if( pFormat )
394  m_aCharStyle = pFormat->GetName();
395 
396  // and the named paragraph format
397  pFormat = rWrtShell.GetCurTextFormatColl();
398  if( pFormat )
399  m_aParaStyle = pFormat->GetName();
400  }
401 
403  rWrtShell.EndAction();
404 }
405 
406 typedef std::vector< std::unique_ptr< SfxPoolItem > > ItemVector;
407 // collect all PoolItems from the applied styles
408 static void lcl_AppendSetItems( ItemVector& rItemVector, const SfxItemSet& rStyleAttrSet )
409 {
410  const WhichRangesContainer& pRanges = rStyleAttrSet.GetRanges();
411  for(const auto & rPair : pRanges)
412  {
413  for ( sal_uInt16 nWhich = rPair.first; nWhich <= rPair.second; ++nWhich )
414  {
415  const SfxPoolItem* pItem;
416  if( SfxItemState::SET == rStyleAttrSet.GetItemState( nWhich, false, &pItem ) )
417  {
418  rItemVector.emplace_back( pItem->Clone() );
419  }
420  }
421  }
422 }
423 // remove all items that are inherited from the styles
424 static void lcl_RemoveEqualItems( SfxItemSet& rTemplateItemSet, const ItemVector& rItemVector )
425 {
426  for( const auto& rItem : rItemVector )
427  {
428  const SfxPoolItem* pItem;
429  if( SfxItemState::SET == rTemplateItemSet.GetItemState( rItem->Which(), true, &pItem ) &&
430  *pItem == *rItem )
431  {
432  rTemplateItemSet.ClearItem( rItem->Which() );
433  }
434  }
435 }
436 
438  , bool bNoCharacterFormats, bool bNoParagraphFormats )
439 {
440  SelectionType nSelectionType = rWrtShell.GetSelectionType();
441  if( !HasContentForThisType(nSelectionType) )
442  {
443  if(!m_bPersistentCopy)
444  Erase();
445  return;
446  }
447 
448  rWrtShell.StartAction();
449  rWrtShell.StartUndo(SwUndoId::INSATTR);
450 
451  ItemVector aItemVector;
452 
453  if( nSelectionType & SelectionType::Text )
454  {
455  // apply the named text and paragraph formatting
456  if( pPool )
457  {
458  // if there is a named text format recorded and the user wants to apply it
459  if(!m_aCharStyle.isEmpty() && !bNoCharacterFormats )
460  {
461  // look for the named text format in the pool
462  SwDocStyleSheet* pStyle = static_cast<SwDocStyleSheet*>(pPool->Find(m_aCharStyle, SfxStyleFamily::Char));
463 
464  // if the style is found
465  if( pStyle )
466  {
467  SwFormatCharFormat aFormat(pStyle->GetCharFormat());
468  // store the attributes from this style in aItemVector in order
469  // not to apply them as automatic formatting attributes later in the code
470  lcl_AppendSetItems( aItemVector, aFormat.GetCharFormat()->GetAttrSet());
471 
472  // apply the named format
473  rWrtShell.SetAttrItem( aFormat );
474  }
475  }
476 
477  // if there is a named paragraph format recorded and the user wants to apply it
478  if(!m_aParaStyle.isEmpty() && !bNoParagraphFormats )
479  {
480  // look for the named paragraph format in the pool
481  SwDocStyleSheet* pStyle = static_cast<SwDocStyleSheet*>(pPool->Find(m_aParaStyle, SfxStyleFamily::Para));
482  if( pStyle )
483  {
484  // store the attributes from this style in aItemVector in order
485  // not to apply them as automatic formatting attributes later in the code
486  lcl_AppendSetItems( aItemVector, pStyle->GetCollection()->GetAttrSet());
487 
488  // apply the named format
489  rWrtShell.SetTextFormatColl( pStyle->GetCollection() );
490  }
491  }
492  }
493 
494  // apply the paragraph automatic attributes
495  if ( m_pItemSet_ParAttr && m_pItemSet_ParAttr->Count() != 0 && !bNoParagraphFormats )
496  {
497  // temporary SfxItemSet
498  std::unique_ptr<SfxItemSet> pTemplateItemSet(lcl_CreateEmptyItemSet(
499  nSelectionType, *m_pItemSet_ParAttr->GetPool()));
500  // no need to verify the existence of pTemplateItemSet as we
501  // know that here the selection type is SEL_TXT
502 
503  pTemplateItemSet->Put( *m_pItemSet_ParAttr );
504 
505  // remove attribute that were applied by named text and paragraph formatting
506  lcl_RemoveEqualItems( *pTemplateItemSet, aItemVector );
507 
508  // apply the paragraph automatic attributes to all the nodes in the selection
509  rWrtShell.SetAttrSet(*pTemplateItemSet);
510 
511  // store the attributes in aItemVector in order not to apply them as
512  // text automatic formatting attributes later in the code
513  lcl_AppendSetItems( aItemVector, *pTemplateItemSet);
514  }
515  }
516 
518  {
519  if( nSelectionType & SelectionType::DrawObject )
520  {
521  SdrView* pDrawView = rWrtShell.GetDrawView();
522  if(pDrawView)
523  {
524  pDrawView->SetAttrToMarked(*m_pItemSet_TextAttr, true/*bReplaceAll*/);
525  }
526  }
527  else
528  {
529  // temporary SfxItemSet
530  std::unique_ptr<SfxItemSet> pTemplateItemSet(lcl_CreateEmptyItemSet(
531  nSelectionType, *m_pItemSet_TextAttr->GetPool(), true ));
532 
533  if(pTemplateItemSet)
534  {
535  // copy the stored automatic text attributes in a temporary SfxItemSet
536  pTemplateItemSet->Put( *m_pItemSet_TextAttr );
537 
538  // only attributes that were not apply by named style attributes and automatic
539  // paragraph attributes should be applied
540  lcl_RemoveEqualItems( *pTemplateItemSet, aItemVector );
541 
542  // apply the character automatic attributes
544  rWrtShell.SetFlyFrameAttr(*pTemplateItemSet);
545  else if ( !bNoCharacterFormats )
546  rWrtShell.SetAttrSet(*pTemplateItemSet);
547  }
548  }
549  }
550 
552  lcl_setTableAttributes( *m_pTableItemSet, rWrtShell );
553 
554  rWrtShell.EndUndo(SwUndoId::INSATTR);
555  rWrtShell.EndAction();
556 
557  if(!m_bPersistentCopy)
558  Erase();
559 }
560 
562 {
564 
565  m_pItemSet_TextAttr.reset();
566 
567  m_pItemSet_ParAttr.reset();
568 
569  m_pTableItemSet.reset();
570 
571  if( !m_aCharStyle.isEmpty() )
572  m_aCharStyle.clear();
573  if( !m_aParaStyle.isEmpty() )
574  m_aParaStyle.clear();
575 
576  m_bPersistentCopy = false;
577 }
578 
579 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr TypedWhichId< SvxFrameDirectionItem > RES_FRAMEDIR(120)
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
void DeleteMark()
Definition: pam.hxx:178
constexpr TypedWhichId< SwFormatSurround > RES_SURROUND(101)
constexpr TypedWhichId< SwFormatFillOrder > RES_FILL_ORDER(RES_FRMATR_BEGIN)
void KillPams()
Definition: crsrsh.cxx:1022
SwTextFormatColl * GetCurTextFormatColl() const
Get the named paragraph format of the current selection.
Definition: edattr.cxx:238
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
const SwFormatLayoutSplit & GetLayoutSplit(bool=true) const
Definition: fmtlsplt.hxx:46
bool IsMultiSelection() const
Definition: pam.hxx:273
SdrView * GetDrawView()
Definition: vnew.cxx:373
void SetRowSplit(const SwFormatRowSplit &rSz)
Definition: fetab.cxx:781
constexpr TypedWhichId< SwFormatEditInReadonly > RES_EDIT_IN_READONLY(112)
constexpr TypedWhichId< SwFormatCol > RES_COL(109)
void SetRowBackground(const SvxBrushItem &rNew)
Definition: fetab.cxx:818
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
constexpr TypedWhichId< SvxFormatKeepItem > RES_KEEP(110)
bool AreObjectsMarked() const
const SwPosition * GetMark() const
Definition: pam.hxx:210
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:1949
const WhichRangesContainer & GetRanges() const
constexpr sal_uInt16 RES_FRMATR_END(133)
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
virtual SvxBrushItem * Clone(SfxItemPool *pPool=nullptr) const override
void GetCurParAttr(SfxItemSet &rSet) const
Get the paragraph format attribute(s) of the current selection.
Definition: edattr.cxx:177
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:899
Used by the UI to modify the document model.
Definition: wrtsh.hxx:96
#define FN_PARAM_TABLE_HEADLINE
Definition: cmdid.h:796
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:39
constexpr TypedWhichId< SfxStringItem > SDRATTR_CUSTOMSHAPE_DATA(SDRATTR_CUSTOMSHAPE_FIRST+1)
const OUString & GetName() const
Definition: format.hxx:131
const SvxFormatKeepItem & GetKeep(bool=true) const
Definition: frmatr.hxx:86
static bool CanCopyThisType(SelectionType nSelectionType)
SwCharFormat * GetCharFormat()
Definition: docstyle.cxx:2173
Base class for various Writer styles.
Definition: format.hxx:46
constexpr TypedWhichId< SwFormatRowSplit > RES_ROW_SPLIT(122)
bool GetFlyFrameAttr(SfxItemSet &rSet) const
Definition: fefly1.cxx:1061
std::unique_ptr< SfxItemSet > m_pTableItemSet
table attribute set
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:137
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
Definition: pam.cxx:502
void SetTabBorders(const SfxItemSet &rSet)
Definition: fetab.cxx:831
void SetBoxBackground(const SvxBrushItem &rNew)
Definition: fetab.cxx:854
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
void SetTextFormatColl(SwTextFormatColl *, const bool bResetListAttrs=false)
Add 2nd optional parameter - see also
Definition: edfcol.cxx:2189
Style of a layout element.
Definition: frmfmt.hxx:59
bool IsInRightToLeftText() const
Definition: crsrsh.cxx:3452
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:1076
SelectionType m_nSelectionType
const SwPosition * GetPoint() const
Definition: pam.hxx:208
css::drawing::Direction3D aDirection
bool HasContentForThisType(SelectionType nSelectionType) const
SelectionType
void Push()
store a copy of the current cursor on the cursor stack
Definition: crsrsh.cxx:2248
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:1103
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:206
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:886
const SvxFormatBreakItem & GetBreak(bool=true) const
Definition: frmatr.hxx:90
void GetTabBackground(std::unique_ptr< SvxBrushItem > &rToFill) const
Definition: fetab.cxx:912
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:789
void StartAction()
Definition: crsrsh.cxx:227
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:448
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
constexpr TypedWhichId< SwTextGridItem > RES_TEXTGRID(115)
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:195
SwTextFormatColl * GetCollection()
Definition: docstyle.cxx:2180
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:439
OUString m_aCharStyle
name of the character format (if it exist)
bool GetCurAttr(SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
Definition: edattr.cxx:171
constexpr sal_uInt16 RES_CHRATR_END(46)
constexpr TypedWhichId< SvxBoxItem > RES_BOX(106)
void GetTabBorders(SfxItemSet &rSet) const
Definition: fetab.cxx:849
bool GetRowBackground(std::unique_ptr< SvxBrushItem > &rToFill) const
FALSE ambiguous.
Definition: fetab.cxx:826
SwMoveFnCollection const & fnMoveBackward
Definition: paminit.cxx:58
bool GetBoxDirection(std::unique_ptr< SvxFrameDirectionItem > &rToFill) const
FALSE ambiguous.
Definition: fetab.cxx:878
SwCharFormat * GetCurCharFormat() const
Definition: edfmt.cxx:39
sal_uInt16 GetBoxAlign() const
USHRT_MAX if ambiguous.
Definition: fetab.cxx:894
sal_uInt16 GetRowsToRepeat() const
Definition: fetab.cxx:1067
OUString m_aParaStyle
name of the paragraph format (if it exist)
bool IsEndPara() const
Definition: crsrsh.cxx:1114
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:476
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:136
const SwFormatPageDesc & GetPageDesc(bool=true) const
Definition: fmtpdsc.hxx:78
SelectionType GetSelectionType() const
Definition: wrtsh1.cxx:1631
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
#define FN_TABLE_SET_VERT_ALIGN
Definition: cmdid.h:435
constexpr sal_uInt16 RES_FRMATR_BEGIN(RES_PARATR_LIST_END)
bool GetBoxBackground(std::unique_ptr< SvxBrushItem > &rToFill) const
FALSE ambiguous.
Definition: fetab.cxx:862
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:870
void EndAction(const bool bIdleEnd=false)
Definition: crsrsh.cxx:244
bool m_bDetectedRangeSegmentation false
const SvxShadowItem & GetShadow(bool=true) const
Definition: frmatr.hxx:88