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>
38#include <fmtpdsc.hxx>
39#include <fmtrowsplt.hxx>
40#include <frmatr.hxx>
41
42namespace
43{
44
45std::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
94void 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(std::move(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
141void 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
188 if(pItem)
189 pFrameFormat->SetFormatAttr( *pItem );
190
191 //RES_LAYOUT_SPLIT
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
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
246 &&
248 )
249 return true;
250
252 return true;
253
254 return false;
255}
256
258{
259 return bool(nSelectionType
262}
263
264void 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()->GetContentIndex() == 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,
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
406typedef std::vector< std::unique_ptr< SfxPoolItem > > ItemVector;
407// collect all PoolItems from the applied styles
408static 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
424static 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 {
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 // reset all direct formatting
540 for( sal_uInt16 nWhich = RES_CHRATR_BEGIN; nWhich < RES_CHRATR_END; nWhich++ )
541 aAttrs.insert( nWhich );
542 rWrtShell.ResetAttr( { aAttrs } );
543
544 // only attributes that were not apply by named style attributes and automatic
545 // paragraph attributes should be applied
546 lcl_RemoveEqualItems( *pTemplateItemSet, aItemVector );
547
548 // apply the character automatic attributes
550 rWrtShell.SetFlyFrameAttr(*pTemplateItemSet);
551 else if ( !bNoCharacterFormats )
552 {
553 rWrtShell.SetAttrSet(*pTemplateItemSet);
554 }
555 }
556 }
557 }
558
560 lcl_setTableAttributes( *m_pTableItemSet, rWrtShell );
561
562 rWrtShell.EndUndo(SwUndoId::INSATTR);
563 rWrtShell.EndAction();
564
566 Erase();
567}
568
570{
572
573 m_pItemSet_TextAttr.reset();
574
575 m_pItemSet_ParAttr.reset();
576
577 m_pTableItemSet.reset();
578
579 if( !m_aCharStyle.isEmpty() )
580 m_aCharStyle.clear();
581 if( !m_aParaStyle.isEmpty() )
582 m_aParaStyle.clear();
583
584 m_bPersistentCopy = false;
585}
586
587/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SfxItemSet GetAttrFromMarked(bool bOnlyHardAttr) const
void SetAttrToMarked(const SfxItemSet &rAttr, bool bReplaceAll)
bool AreObjectsMarked() const
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
const WhichRangesContainer & GetRanges() const
SfxItemPool * GetPool() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
void InvalidateItem(sal_uInt16 nWhich)
void SetWhich(sal_uInt16 nId)
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const=0
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
virtual SvxBrushItem * Clone(SfxItemPool *pPool=nullptr) const override
void Push()
store a copy of the current cursor on the cursor stack
Definition: crsrsh.cxx:2550
void StartAction()
Definition: crsrsh.cxx:226
bool IsEndPara() const
Definition: crsrsh.cxx:1400
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:194
void EndAction(const bool bIdleEnd=false)
Definition: crsrsh.cxx:243
bool IsInRightToLeftText() const
Definition: crsrsh.cxx:3770
void KillPams()
Definition: crsrsh.cxx:1308
SwCharFormat * GetCharFormat()
Definition: docstyle.cxx:2355
SwTextFormatColl * GetCollection()
Definition: docstyle.cxx:2362
bool GetCurAttr(SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
Definition: edattr.cxx:171
SwCharFormat * GetCurCharFormat() const
Definition: edfmt.cxx:39
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 SetAttrItem(const SfxPoolItem &, SetAttrMode nFlags=SetAttrMode::DEFAULT, const bool bParagraphSetting=false)
Definition: edatmisc.cxx:98
void SetAttrSet(const SfxItemSet &, SetAttrMode nFlags=SetAttrMode::DEFAULT, SwPaM *pCursor=nullptr, const bool bParagraphSetting=false)
Definition: edatmisc.cxx:129
SwFrameFormat * GetTableFormat()
Definition: edws.cxx:183
void SetTextFormatColl(SwTextFormatColl *, const bool bResetListAttrs=false)
Add 2nd optional parameter <bResetListAttrs> - see also <SwDoc::SetTextFormatColl(....
Definition: edfcol.cxx:2202
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
Definition: edws.cxx:234
SwTextFormatColl * GetCurTextFormatColl() const
Get the named paragraph format of the current selection.
Definition: edattr.cxx:238
void ResetAttr(const o3tl::sorted_vector< sal_uInt16 > &attrs=o3tl::sorted_vector< sal_uInt16 >(), SwPaM *pCursor=nullptr)
Definition: edatmisc.cxx:32
void GetCurParAttr(SfxItemSet &rSet) const
Get the paragraph format attribute(s) of the current selection.
Definition: edattr.cxx:177
bool SetFlyFrameAttr(SfxItemSet &rSet)
Definition: fefly1.cxx:1103
bool GetRowBackground(std::unique_ptr< SvxBrushItem > &rToFill) const
FALSE ambiguous.
Definition: fetab.cxx:930
sal_uInt16 GetRowsToRepeat() const
Definition: fetab.cxx:1171
void SetBoxAlign(sal_uInt16 nOrient)
Definition: fetab.cxx:990
void SetBoxBackground(const SvxBrushItem &rNew)
Definition: fetab.cxx:958
void SetRowSplit(const SwFormatRowSplit &rSz)
Definition: fetab.cxx:885
void SetRowBackground(const SvxBrushItem &rNew)
Definition: fetab.cxx:922
bool GetBoxBackground(std::unique_ptr< SvxBrushItem > &rToFill) const
FALSE ambiguous.
Definition: fetab.cxx:966
std::unique_ptr< SwFormatRowSplit > GetRowSplit() const
Definition: fetab.cxx:893
void SetRowsToRepeat(sal_uInt16 nNumOfRows)
Definition: fetab.cxx:1180
void SetTabBorders(const SfxItemSet &rSet)
Definition: fetab.cxx:935
void SetTabBackground(const SvxBrushItem &rNew)
Definition: fetab.cxx:1003
void GetTabBorders(SfxItemSet &rSet) const
Definition: fetab.cxx:953
bool GetFlyFrameAttr(SfxItemSet &rSet) const
Definition: fefly1.cxx:1061
sal_uInt16 GetBoxAlign() const
USHRT_MAX if ambiguous.
Definition: fetab.cxx:998
void GetTabBackground(std::unique_ptr< SvxBrushItem > &rToFill) const
Definition: fetab.cxx:1016
bool GetBoxDirection(std::unique_ptr< SvxFrameDirectionItem > &rToFill) const
FALSE ambiguous.
Definition: fetab.cxx:982
void SetBoxDirection(const SvxFrameDirectionItem &rNew)
Definition: fetab.cxx:974
SwCharFormat * GetCharFormat() const
Definition: fchrfmt.hxx:70
SelectionType m_nSelectionType
void Copy(SwWrtShell &rWrtShell, SfxItemPool &rPool, bool bPersistentCopy)
Store/Backup the text and paragraph attribute of the current selection.
void Paste(SwWrtShell &rWrtShell, SfxStyleSheetBasePool *pPool, bool bNoCharacterFormats, bool bNoParagraphFormats)
Paste the stored text and paragraph attributes on the current selection and current paragraph.
void Erase()
Clear the currently stored text and paragraph attributes.
bool m_bPersistentCopy
specify if the Paste function have to clear the current object
OUString m_aCharStyle
name of the character format (if it exist)
std::unique_ptr< SfxItemSet > m_pItemSet_ParAttr
automatic/named paragraph attribute set (it can be character attribute applied to the paragraph)
static bool CanCopyThisType(SelectionType nSelectionType)
std::unique_ptr< SfxItemSet > m_pItemSet_TextAttr
automatic/named character attribute set
bool HasContentForThisType(SelectionType nSelectionType) const
std::unique_ptr< SfxItemSet > m_pTableItemSet
table attribute set
OUString m_aParaStyle
name of the paragraph format (if it exist)
bool HasContent() const
Test if the object contains text or paragraph attribute.
Controls if a table row is allowed to split or not.
Definition: fmtrowsplt.hxx:32
Base class for various Writer styles.
Definition: format.hxx:47
const SvxFrameDirectionItem & GetFrameDir(bool=true) const
Definition: frmatr.hxx:118
const SvxFormatKeepItem & GetKeep(bool=true) const
Definition: frmatr.hxx:110
const OUString & GetName() const
Definition: format.hxx:131
const SvxShadowItem & GetShadow(bool=true) const
Definition: frmatr.hxx:112
const SwFormatLayoutSplit & GetLayoutSplit(bool=true) const
Definition: fmtlsplt.hxx:46
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:136
const SvxFormatBreakItem & GetBreak(bool=true) const
Definition: frmatr.hxx:114
const SwFormatPageDesc & GetPageDesc(bool=true) const
Definition: fmtpdsc.hxx:78
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:447
Style of a layout element.
Definition: frmfmt.hxx:72
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:188
const SwPosition * GetMark() const
Definition: pam.hxx:255
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:643
bool IsMultiSelection() const
Definition: pam.hxx:322
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
Definition: pam.cxx:657
void DeleteMark()
Definition: pam.hxx:232
const SwPosition * GetPoint() const
Definition: pam.hxx:253
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:251
SdrView * GetDrawView()
Definition: vnew.cxx:386
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
SelectionType GetSelectionType() const
Definition: wrtsh1.cxx:1723
bool Pop(SwCursorShell::PopMode, ::std::optional< SwCallLink > &roLink)
Definition: wrtsh1.cxx:2047
std::pair< const_iterator, bool > insert(Value &&x)
#define FN_PARAM_TABLE_HEADLINE
Definition: cmdid.h:819
#define FN_TABLE_BOX_TEXTORIENTATION
Definition: cmdid.h:461
#define FN_TABLE_SET_VERT_ALIGN
Definition: cmdid.h:457
std::vector< std::unique_ptr< SfxPoolItem > > ItemVector
static void lcl_RemoveEqualItems(SfxItemSet &rTemplateItemSet, const ItemVector &rItemVector)
static void lcl_AppendSetItems(ItemVector &rItemVector, const SfxItemSet &rStyleAttrSet)
SelectionType
constexpr TypedWhichId< SvxFrameDirectionItem > RES_FRAMEDIR(126)
constexpr sal_uInt16 RES_FRMATR_BEGIN(RES_PARATR_LIST_END)
constexpr TypedWhichId< SvxFormatKeepItem > RES_KEEP(116)
constexpr sal_uInt16 RES_CHRATR_END(46)
constexpr TypedWhichId< SwFormatRowSplit > RES_ROW_SPLIT(128)
constexpr sal_uInt16 RES_PARATR_BEGIN(RES_TXTATR_END)
constexpr TypedWhichId< SwFormatCol > RES_COL(115)
constexpr TypedWhichId< SvxShadowItem > RES_SHADOW(113)
constexpr TypedWhichId< SwFormatLayoutSplit > RES_LAYOUT_SPLIT(119)
constexpr sal_uInt16 RES_FRMATR_END(141)
constexpr TypedWhichId< SwFormatEditInReadonly > RES_EDIT_IN_READONLY(118)
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(99)
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(111)
constexpr TypedWhichId< SwFormatFillOrder > RES_FILL_ORDER(RES_FRMATR_BEGIN)
constexpr TypedWhichId< SwTextGridItem > RES_TEXTGRID(121)
constexpr sal_uInt16 RES_CHRATR_BEGIN(HINT_BEGIN)
constexpr TypedWhichId< SvxBoxItem > RES_BOX(112)
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(100)
constexpr TypedWhichId< SwFormatSurround > RES_SURROUND(107)
constexpr TypedWhichId< SvxPaperBinItem > RES_PAPER_BIN(90)
SwMoveFnCollection const & fnMoveBackward
Definition: paminit.cxx:60
SwMoveFnCollection const & fnMoveForward
SwPam::Move()/Find() default argument.
Definition: paminit.cxx:61
static SfxItemSet & rSet
sal_Int32 GetContentIndex() const
Definition: pam.hxx:85
constexpr TypedWhichId< SfxStringItem > SDRATTR_CUSTOMSHAPE_ENGINE(SDRATTR_CUSTOMSHAPE_FIRST+0)
constexpr TypedWhichId< SdrCustomShapeGeometryItem > SDRATTR_CUSTOMSHAPE_GEOMETRY(SDRATTR_CUSTOMSHAPE_FIRST+2)
constexpr TypedWhichId< SfxStringItem > SDRATTR_CUSTOMSHAPE_DATA(SDRATTR_CUSTOMSHAPE_FIRST+1)
css::drawing::Direction3D aDirection