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