LibreOffice Module sw (master) 1
docst.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 <config_wasm_strip.h>
21
22#include <memory>
23
24#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
25#include <com/sun/star/beans/XPropertySet.hpp>
26#include <com/sun/star/container/XNameAccess.hpp>
27#include <com/sun/star/frame/XModel.hpp>
29#include <o3tl/any.hxx>
30#include <sal/log.hxx>
31#include <osl/diagnose.h>
32#include <hintids.hxx>
33#include <sfx2/styledlg.hxx>
34#include <svl/whiter.hxx>
35#include <sfx2/tplpitem.hxx>
36#include <sfx2/request.hxx>
37#include <sfx2/dispatch.hxx>
38#include <sfx2/newstyle.hxx>
39#include <sfx2/printer.hxx>
40#include <sfx2/viewfrm.hxx>
41#include <svl/stritem.hxx>
42#include <svl/ctloptions.hxx>
43#include <sfx2/htmlmode.hxx>
44#include <swmodule.hxx>
45#include <fchrfmt.hxx>
46#include <svtools/htmlcfg.hxx>
47#include <svx/xdef.hxx>
48#include <SwStyleNameMapper.hxx>
49#include <SwRewriter.hxx>
50#include <numrule.hxx>
51#include <swundo.hxx>
52#include <svx/drawitem.hxx>
53#include <utility>
54#include <view.hxx>
55#include <wrtsh.hxx>
56#include <docsh.hxx>
57#include <uitool.hxx>
58#include <cmdid.h>
59#include <viewopt.hxx>
60#include <doc.hxx>
61#include <drawdoc.hxx>
63#include <IDocumentUndoRedo.hxx>
67#include <IDocumentState.hxx>
68#include <frmfmt.hxx>
69#include <charfmt.hxx>
70#include <poolfmt.hxx>
71#include <pagedesc.hxx>
72#include <docstyle.hxx>
73#include <uiitems.hxx>
74#include <fmtcol.hxx>
75#include <edtwin.hxx>
76#include <unochart.hxx>
77#include <swabstdlg.hxx>
78#include <tblafmt.hxx>
80#include <svl/grabbagitem.hxx>
81#include <SwUndoFmt.hxx>
82#include <strings.hrc>
83#include <AccessibilityCheck.hxx>
84
85using namespace ::com::sun::star;
86
88{
89 SfxWhichIter aIter(rSet);
90 sal_uInt16 nWhich = aIter.FirstWhich();
91 SfxStyleFamily nActualFamily = SfxStyleFamily(USHRT_MAX);
92
93 SwWrtShell* pShell = pSh ? pSh : GetWrtShell();
94 if(!pShell)
95 {
96 while (nWhich)
97 {
98 rSet.DisableItem(nWhich);
99 nWhich = aIter.NextWhich();
100 }
101 return;
102 }
103 else
104 {
105 SfxViewFrame* pFrame = pShell->GetView().GetViewFrame();
106 std::unique_ptr<SfxUInt16Item> pFamilyItem;
107 pFrame->GetBindings().QueryState(SID_STYLE_FAMILY, pFamilyItem);
108 if (pFamilyItem)
109 {
110 nActualFamily = static_cast<SfxStyleFamily>(pFamilyItem->GetValue());
111 }
112 }
113
114 while (nWhich)
115 {
116 // determine current template to every family
117 OUString aName;
118 SwTableAutoFormat aTableAutoFormat("dummy"); // needed to check if can take a table auto format at current cursor position
119 switch (nWhich)
120 {
121 case SID_STYLE_APPLY:
122 {// here the template and its family are passed to the StyleBox
123 // so that this family is being showed
124 if(pShell->IsFrameSelected())
125 {
126 SwFrameFormat* pFormat = pShell->GetSelectedFrameFormat();
127 if( pFormat )
128 aName = pFormat->GetName();
129 }
130 else
131 {
132 SwTextFormatColl* pColl = pShell->GetCurTextFormatColl();
133 if(pColl)
134 aName = pColl->GetName();
135 }
136 rSet.Put(SfxTemplateItem(nWhich, aName));
137 }
138 break;
139 case SID_STYLE_FAMILY1:
140 if( !pShell->IsFrameSelected() )
141 {
142 SwCharFormat* pFormat = pShell->GetCurCharFormat();
143 if(pFormat)
144 aName = pFormat->GetName();
145 else
146 aName = SwResId(STR_POOLCHR_STANDARD);
147 rSet.Put(SfxTemplateItem(nWhich, aName));
148 }
149 break;
150
151 case SID_STYLE_FAMILY2:
152 if(!pShell->IsFrameSelected())
153 {
154 OUString aProgName;
155 SwTextFormatColl* pColl = pShell->GetCurTextFormatColl();
156 if(pColl)
157 {
158 aName = pColl->GetName();
159 sal_uInt16 nId = pColl->GetPoolFormatId();
161 }
162
163 SfxTemplateItem aItem(nWhich, aName, aProgName);
164
165 SfxStyleSearchBits nMask = SfxStyleSearchBits::Auto;
166 if (m_xDoc->getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE))
167 nMask = SfxStyleSearchBits::SwHtml;
168 else
169 {
170 const FrameTypeFlags nSelection = pShell->GetFrameType(nullptr,true);
171 if(pShell->GetCurTOX())
172 nMask = SfxStyleSearchBits::SwIndex ;
173 else if(nSelection & FrameTypeFlags::HEADER ||
174 nSelection & FrameTypeFlags::FOOTER ||
175 nSelection & FrameTypeFlags::TABLE ||
176 nSelection & FrameTypeFlags::FLY_ANY ||
177 nSelection & FrameTypeFlags::FOOTNOTE ||
178 nSelection & FrameTypeFlags::FTNPAGE)
179 nMask = SfxStyleSearchBits::SwExtra;
180 else
181 nMask = SfxStyleSearchBits::SwText;
182 }
183
184 aItem.SetValue(nMask);
185 rSet.Put(aItem);
186 }
187
188 break;
189
190 case SID_STYLE_FAMILY3:
191
192 if (m_xDoc->getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE))
193 rSet.DisableItem( nWhich );
194 else
195 {
196 SwFrameFormat* pFormat = pShell->GetSelectedFrameFormat();
197 if(pFormat && pShell->IsFrameSelected())
198 {
199 aName = pFormat->GetName();
200 rSet.Put(SfxTemplateItem(nWhich, aName));
201 }
202 }
203 break;
204
205 case SID_STYLE_FAMILY4:
206 {
207 if (m_xDoc->getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE) && !SvxHtmlOptions::IsPrintLayoutExtension())
208 rSet.DisableItem( nWhich );
209 else
210 {
211 size_t n = pShell->GetCurPageDesc( false );
212 if( n < pShell->GetPageDescCnt() )
213 aName = pShell->GetPageDesc( n ).GetName();
214
215 rSet.Put(SfxTemplateItem(nWhich, aName));
216 }
217 }
218 break;
219 case SID_STYLE_FAMILY5:
220 {
221 const SwNumRule* pRule = pShell->GetNumRuleAtCurrCursorPos();
222 if( pRule )
223 aName = pRule->GetName();
224
225 rSet.Put(SfxTemplateItem(nWhich, aName));
226 }
227 break;
228 case SID_STYLE_FAMILY6:
229 {
230 const SwTableNode *pTableNd = pShell->IsCursorInTable();
231 if( pTableNd )
232 aName = pTableNd->GetTable().GetTableStyleName();
233
234 rSet.Put(SfxTemplateItem(nWhich, aName));
235 }
236 break;
237
238 case SID_STYLE_WATERCAN:
239 {
240 SwEditWin& rEdtWin = pShell->GetView().GetEditWin();
241 SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate();
242 rSet.Put(SfxBoolItem(nWhich, pApply && pApply->eType != SfxStyleFamily(0)));
243 }
244 break;
245 case SID_STYLE_UPDATE_BY_EXAMPLE:
246 if( pShell->IsFrameSelected()
247 ? SfxStyleFamily::Frame != nActualFamily
248 : ( SfxStyleFamily::Frame == nActualFamily ||
249 SfxStyleFamily::Page == nActualFamily ||
250 (SfxStyleFamily::Pseudo == nActualFamily && !pShell->GetNumRuleAtCurrCursorPos()) ||
251 (SfxStyleFamily::Table == nActualFamily && !pShell->GetTableAutoFormat(aTableAutoFormat))) )
252 {
253 rSet.DisableItem( nWhich );
254 }
255 break;
256
257 case SID_STYLE_NEW_BY_EXAMPLE:
258 if( (pShell->IsFrameSelected()
259 ? SfxStyleFamily::Frame != nActualFamily
260 : SfxStyleFamily::Frame == nActualFamily) ||
261 (SfxStyleFamily::Pseudo == nActualFamily && !pShell->GetNumRuleAtCurrCursorPos()) ||
262 (SfxStyleFamily::Table == nActualFamily && !pShell->GetTableAutoFormat(aTableAutoFormat)) )
263 {
264 rSet.DisableItem( nWhich );
265 }
266 break;
267
268 case SID_CLASSIFICATION_APPLY:
269 // Just trigger ClassificationCategoriesController::statusChanged().
270 rSet.InvalidateItem(nWhich);
271 break;
272 case SID_CLASSIFICATION_DIALOG:
273 rSet.InvalidateItem(nWhich);
274 break;
275 case SID_STYLE_EDIT:
276 break;
277 case SID_WATERMARK:
278 if (pSh)
279 {
280 SfxWatermarkItem aItem = pSh->GetWatermark();
281 rSet.Put(aItem);
282 }
283 break;
284 default:
285 OSL_FAIL("Invalid SlotId");
286 }
287 nWhich = aIter.NextWhich();
288 }
289}
290
291// evaluate StyleSheet-Requests
293{
294 sal_uInt16 nSlot = rReq.GetSlot();
295
296 const SfxItemSet* pArgs = rReq.GetArgs();
297 const SfxPoolItem* pItem;
298 switch (nSlot)
299 {
300 case SID_STYLE_NEW:
301 if( pArgs && SfxItemState::SET == pArgs->GetItemState( SID_STYLE_FAMILY,
302 false, &pItem ))
303 {
304 const SfxStyleFamily nFamily = static_cast<SfxStyleFamily>(static_cast<const SfxUInt16Item*>(pItem)->GetValue());
305
306 OUString sName;
307 SfxStyleSearchBits nMask = SfxStyleSearchBits::Auto;
308 if( SfxItemState::SET == pArgs->GetItemState( SID_STYLE_NEW,
309 false, &pItem ))
310 sName = static_cast<const SfxStringItem*>(pItem)->GetValue();
311 if( SfxItemState::SET == pArgs->GetItemState( SID_STYLE_MASK,
312 false, &pItem ))
313 nMask = static_cast<SfxStyleSearchBits>(static_cast<const SfxUInt16Item*>(pItem)->GetValue());
314 OUString sParent;
315 if( SfxItemState::SET == pArgs->GetItemState( SID_STYLE_REFERENCE,
316 false, &pItem ))
317 sParent = static_cast<const SfxStringItem*>(pItem)->GetValue();
318
319 if (sName.isEmpty() && m_xBasePool)
321
322 Edit(rReq.GetFrameWeld(), sName, sParent, nFamily, nMask, true, OString(), nullptr, &rReq, nSlot);
323 }
324 break;
325
326 case SID_STYLE_APPLY:
327 if( !pArgs )
328 {
329 GetView()->GetViewFrame()->GetDispatcher()->Execute(SID_STYLE_DESIGNER);
330 break;
331 }
332 else
333 {
334 // convert internal StyleName to DisplayName (slot implementation uses the latter)
335 const SfxStringItem* pNameItem = rReq.GetArg<SfxStringItem>(SID_APPLY_STYLE);
336 const SfxStringItem* pFamilyItem = rReq.GetArg<SfxStringItem>(SID_STYLE_FAMILYNAME);
337 if ( pFamilyItem && pNameItem )
338 {
339 uno::Reference< style::XStyleFamiliesSupplier > xModel(GetModel(), uno::UNO_QUERY);
340 try
341 {
342 uno::Reference< container::XNameAccess > xStyles;
343 uno::Reference< container::XNameAccess > xCont = xModel->getStyleFamilies();
344 xCont->getByName(pFamilyItem->GetValue()) >>= xStyles;
345 uno::Reference< beans::XPropertySet > xInfo;
346 xStyles->getByName( pNameItem->GetValue() ) >>= xInfo;
347 OUString aUIName;
348 xInfo->getPropertyValue("DisplayName") >>= aUIName;
349 if ( !aUIName.isEmpty() )
350 rReq.AppendItem( SfxStringItem( SID_STYLE_APPLY, aUIName ) );
351 }
352 catch (const uno::Exception&)
353 {
354 }
355 }
356 }
357
358 [[fallthrough]];
359
360 case SID_STYLE_EDIT:
361 case SID_STYLE_DELETE:
362 case SID_STYLE_HIDE:
363 case SID_STYLE_SHOW:
364 case SID_STYLE_WATERCAN:
365 case SID_STYLE_FAMILY:
366 case SID_STYLE_UPDATE_BY_EXAMPLE:
367 case SID_STYLE_NEW_BY_EXAMPLE:
368 {
369 OUString aParam;
370 SfxStyleFamily nFamily = SfxStyleFamily::Para;
371 SfxStyleSearchBits nMask = SfxStyleSearchBits::Auto;
372 SwWrtShell* pActShell = nullptr;
373
374 if( !pArgs )
375 {
376 switch (nSlot)
377 {
378 case SID_STYLE_NEW_BY_EXAMPLE:
379 {
381 SfxNewStyleDlg aDlg(GetView()->GetFrameWeld(), rPool, nFamily);
382 if (aDlg.run() == RET_OK)
383 {
384 aParam = aDlg.GetName();
385 rReq.AppendItem(SfxStringItem(nSlot, aParam));
386 }
387 }
388 break;
389
390 case SID_STYLE_UPDATE_BY_EXAMPLE:
391 case SID_STYLE_EDIT:
392 {
394 if(pColl)
395 {
396 aParam = pColl->GetName();
397 rReq.AppendItem(SfxStringItem(nSlot, aParam));
398 }
399 }
400 break;
401 }
402 }
403 else
404 {
405 SAL_WARN_IF( !pArgs->Count(), "sw.ui", "SfxBug ItemSet is empty" );
406
407 SwWrtShell* pShell = GetWrtShell();
408 if( SfxItemState::SET == pArgs->GetItemState(nSlot, false, &pItem ))
409 aParam = static_cast<const SfxStringItem*>(pItem)->GetValue();
410
411 if( SfxItemState::SET == pArgs->GetItemState(SID_STYLE_FAMILY,
412 false, &pItem ))
413 nFamily = static_cast<SfxStyleFamily>(static_cast<const SfxUInt16Item*>(pItem)->GetValue());
414
415 if( SfxItemState::SET == pArgs->GetItemState(SID_STYLE_FAMILYNAME, false, &pItem ))
416 {
417 OUString aFamily = static_cast<const SfxStringItem*>(pItem)->GetValue();
418 if(aFamily == "CharacterStyles")
419 nFamily = SfxStyleFamily::Char;
420 else
421 if(aFamily == "ParagraphStyles")
422 nFamily = SfxStyleFamily::Para;
423 else
424 if(aFamily == "PageStyles")
425 nFamily = SfxStyleFamily::Page;
426 else
427 if(aFamily == "FrameStyles")
428 nFamily = SfxStyleFamily::Frame;
429 else
430 if(aFamily == "NumberingStyles")
431 nFamily = SfxStyleFamily::Pseudo;
432 else
433 if(aFamily == "TableStyles")
434 nFamily = SfxStyleFamily::Table;
435 }
436
437 if( SfxItemState::SET == pArgs->GetItemState(SID_STYLE_MASK,
438 false, &pItem ))
439 nMask = static_cast<SfxStyleSearchBits>(static_cast<const SfxUInt16Item*>(pItem)->GetValue());
440 if( const SwPtrItem* pShellItem = pArgs->GetItemIfSet(FN_PARAM_WRTSHELL, false ))
441 pActShell = pShell = static_cast<SwWrtShell*>(pShellItem->GetValue());
442
443 if( nSlot == SID_STYLE_UPDATE_BY_EXAMPLE && aParam.isEmpty() )
444 {
445 switch( nFamily )
446 {
447 case SfxStyleFamily::Para:
448 {
449 SwTextFormatColl* pColl = pShell->GetCurTextFormatColl();
450 if(pColl)
451 aParam = pColl->GetName();
452 }
453 break;
454 case SfxStyleFamily::Frame:
455 {
457 if( pFrame )
458 aParam = pFrame->GetName();
459 }
460 break;
461 case SfxStyleFamily::Char:
462 {
464 if( pChar )
465 aParam = pChar->GetName();
466 }
467 break;
468 case SfxStyleFamily::Pseudo:
469 if(const SfxStringItem* pExName = pArgs->GetItemIfSet(SID_STYLE_UPD_BY_EX_NAME, false))
470 {
471 aParam = pExName->GetValue();
472 }
473 break;
474 case SfxStyleFamily::Table:
475 if(const SfxStringItem* pExName = pArgs->GetItemIfSet(SID_STYLE_UPD_BY_EX_NAME, false))
476 {
477 aParam = pExName->GetValue();
478 }
479 break;
480 default: break;
481 }
482 rReq.AppendItem(SfxStringItem(nSlot, aParam));
483 }
484 }
485 if (!aParam.isEmpty() || nSlot == SID_STYLE_WATERCAN )
486 {
487 sal_uInt16 nRet = 0xffff;
488 bool bReturns = false;
489
490 switch(nSlot)
491 {
492 case SID_STYLE_EDIT:
493 Edit(rReq.GetFrameWeld(), aParam, OUString(), nFamily, nMask, false, OString(), pActShell);
494 break;
495 case SID_STYLE_DELETE:
496 Delete(aParam, nFamily);
497 break;
498 case SID_STYLE_HIDE:
499 case SID_STYLE_SHOW:
500 Hide(aParam, nFamily, nSlot == SID_STYLE_HIDE);
501 break;
502 case SID_STYLE_APPLY:
503 // Shell-switch in ApplyStyles
504 nRet = static_cast<sal_uInt16>(ApplyStyles(aParam, nFamily, pActShell, rReq.GetModifier() ));
505 bReturns = true;
506 break;
507 case SID_STYLE_WATERCAN:
508 nRet = static_cast<sal_uInt16>(DoWaterCan(aParam, nFamily));
509 bReturns = true;
510 break;
511 case SID_STYLE_UPDATE_BY_EXAMPLE:
512 UpdateStyle(aParam, nFamily, pActShell);
513 break;
514 case SID_STYLE_NEW_BY_EXAMPLE:
515 MakeByExample(aParam, nFamily, nMask, pActShell);
516 break;
517
518 default:
519 OSL_FAIL("Invalid SlotId");
520 }
521
522 if (bReturns)
523 {
524 if(rReq.IsAPI()) // Basic only gets TRUE or FALSE
525 rReq.SetReturnValue(SfxUInt16Item(nSlot, sal_uInt16(nRet !=0)));
526 else
527 rReq.SetReturnValue(SfxUInt16Item(nSlot, nRet));
528 }
529
530 rReq.Done();
531 }
532
533 break;
534 }
535 }
536}
537
538namespace {
539
540class ApplyStyle
541{
542public:
543 ApplyStyle(SwDocShell &rDocSh, bool bNew,
547 bool bModified)
548 : m_pDlg(pDlg)
549 , m_rDocSh(rDocSh)
550 , m_bNew(bNew)
551 , m_xTmp(std::move(xTmp))
552 , m_nFamily(nFamily)
553 , m_xBasePool(std::move(xBasePool))
554 , m_bModified(bModified)
555 {
556 }
557 DECL_LINK( ApplyHdl, LinkParamNone*, void );
558 void apply()
559 {
560 ApplyHdl(nullptr);
561 }
563 // true if the document was initially modified before ApplyStyle was created
564 // or if ApplyStyle:::apply was called
565 bool DocIsModified() const
566 {
567 return m_bModified;
568 }
569private:
570 SwDocShell &m_rDocSh;
571 bool m_bNew;
573 SfxStyleFamily m_nFamily;
575 bool m_bModified;
576};
577
578}
579
580IMPL_LINK_NOARG(ApplyStyle, ApplyHdl, LinkParamNone*, void)
581{
582 SwWrtShell* pWrtShell = m_rDocSh.GetWrtShell();
583 SwDoc* pDoc = m_rDocSh.GetDoc();
584 SwView* pView = m_rDocSh.GetView();
585
586 pWrtShell->StartAllAction();
587
588 if( SfxStyleFamily::Para == m_nFamily )
589 {
590 SfxItemSet aSet( *m_pDlg->GetOutputItemSet() );
591 ::ConvertAttrGenToChar(aSet, m_xTmp->GetItemSet(), /*bIsPara=*/true);
592 ::SfxToSwPageDescAttr( *pWrtShell, aSet );
593 // reset indent attributes at paragraph style, if a list style
594 // will be applied and no indent attributes will be applied.
595 m_xTmp->SetItemSet( aSet, true );
596 }
597 else
598 {
599 if(SfxStyleFamily::Page == m_nFamily)
600 {
601 static const sal_uInt16 aInval[] = {
602 SID_IMAGE_ORIENTATION,
603 SID_ATTR_CHAR_FONT,
605 pView->GetViewFrame()->GetBindings().Invalidate(aInval);
606 }
607 SfxItemSet aTmpSet( *m_pDlg->GetOutputItemSet() );
608 if( SfxStyleFamily::Char == m_nFamily )
609 {
610 ::ConvertAttrGenToChar(aTmpSet, m_xTmp->GetItemSet());
611 }
612
613 m_xTmp->SetItemSet( aTmpSet );
614
615 if( SfxStyleFamily::Page == m_nFamily && SvtCTLOptions().IsCTLFontEnabled() )
616 {
617 const SfxPoolItem *pItem = nullptr;
618 if( aTmpSet.GetItemState( m_rDocSh.GetPool().GetTrueWhich( SID_ATTR_FRAMEDIRECTION, false ) , true, &pItem ) == SfxItemState::SET )
620 }
621
622 if (m_nFamily == SfxStyleFamily::Page)
623 {
624 if (const SfxGrabBagItem* pGrabBagItem = aTmpSet.GetItemIfSet(SID_ATTR_CHAR_GRABBAG))
625 {
626 bool bGutterAtTop{};
627 auto it = pGrabBagItem->GetGrabBag().find("GutterAtTop");
628 if (it != pGrabBagItem->GetGrabBag().end())
629 {
630 it->second >>= bGutterAtTop;
631 }
632 bool bOldGutterAtTop
634 if (bOldGutterAtTop != bGutterAtTop)
635 {
637 bGutterAtTop);
638 pWrtShell->InvalidateLayout(/*bSizeChanged=*/true);
639 }
640 }
641 }
642
643 if (m_nFamily == SfxStyleFamily::Frame)
644 {
645 if (const SfxBoolItem* pBoolItem = aTmpSet.GetItemIfSet(FN_KEEP_ASPECT_RATIO))
646 {
647 const SwViewOption* pVOpt = pWrtShell->GetViewOptions();
648 SwViewOption aUsrPref(*pVOpt);
649 aUsrPref.SetKeepRatio(pBoolItem->GetValue());
650 if (pBoolItem->GetValue() != pVOpt->IsKeepRatio())
651 {
652 SW_MOD()->ApplyUsrPref(aUsrPref, &pWrtShell->GetView());
653 }
654 }
655 }
656 }
657
658 if(m_bNew)
659 {
660 if(SfxStyleFamily::Frame == m_nFamily || SfxStyleFamily::Para == m_nFamily)
661 {
662 // clear FillStyle so that it works as a derived attribute
663 SfxItemSet aTmpSet(*m_pDlg->GetOutputItemSet());
664
665 aTmpSet.ClearItem(XATTR_FILLSTYLE);
666 m_xTmp->SetItemSet(aTmpSet);
667 }
668 }
669
670 if(SfxStyleFamily::Page == m_nFamily)
671 pView->InvalidateRulerPos();
672
673 if( m_bNew )
674 m_xBasePool->Broadcast(SfxStyleSheetHint(SfxHintId::StyleSheetCreated, *m_xTmp));
675 else
676 m_xBasePool->Broadcast(SfxStyleSheetHint(SfxHintId::StyleSheetModified, *m_xTmp));
677
679 if( !m_bModified )
680 {
682 m_bModified = true;
683 }
684
685 pWrtShell->EndAllAction();
686}
687
688namespace
689{
692void syncEndnoteOrientation(const uno::Reference< style::XStyleFamiliesSupplier >& xStyleFamSupp)
693{
694 if (!xStyleFamSupp.is())
695 {
696 SAL_WARN("sw.ui", "Ref to XStyleFamiliesSupplier is null.");
697 return;
698 }
699 uno::Reference<container::XNameAccess> xStyleFamilies = xStyleFamSupp->getStyleFamilies();
700
701 if (!xStyleFamilies.is())
702 return;
703
704 uno::Reference<container::XNameAccess> xPageStyles(xStyleFamilies->getByName("PageStyles"),
705 uno::UNO_QUERY);
706
707 if (!xPageStyles.is())
708 return;
709
710 uno::Reference<css::style::XStyle> xEndnotePageStyle(xPageStyles->getByName("Endnote"),
711 uno::UNO_QUERY);
712
713 if (!xEndnotePageStyle.is())
714 return;
715
716 // Language-independent name of the "Default Style" is "Standard"
717 uno::Reference<css::style::XStyle> xDefaultPageStyle(xPageStyles->getByName("Standard"),
718 uno::UNO_QUERY);
719 if (!xDefaultPageStyle.is())
720 return;
721
722 if (xEndnotePageStyle->isUserDefined() || !xEndnotePageStyle->isInUse())
723 return;
724
725 uno::Reference<beans::XPropertySet> xEndnotePagePropSet(xPageStyles->getByName("Endnote"), uno::UNO_QUERY);
726 uno::Reference<beans::XPropertySet> xDefaultPagePropSet(xPageStyles->getByName("Standard"), uno::UNO_QUERY);
727
728 if (!xEndnotePagePropSet.is() || !xDefaultPagePropSet.is())
729 {
730 SAL_WARN("sw.ui", "xEndnotePagePropSet or xDefaultPagePropSet is null.");
731 return;
732 }
733
734 auto const bIsDefLandScape = *o3tl::doAccess<bool>(
735 xDefaultPagePropSet->getPropertyValue("IsLandscape"));
736 auto const bIsEndLandScape = *o3tl::doAccess<bool>(
737 xEndnotePagePropSet->getPropertyValue("IsLandscape"));
738
739 if (bIsDefLandScape == bIsEndLandScape)
740 return;
741
742 auto const nWidth = xEndnotePagePropSet->getPropertyValue("Width");
743 auto const nHeight = xEndnotePagePropSet->getPropertyValue("Height");
744
745 xEndnotePagePropSet->setPropertyValue("IsLandscape", css::uno::toAny(bIsDefLandScape));
746 xEndnotePagePropSet->setPropertyValue("Width", nHeight);
747 xEndnotePagePropSet->setPropertyValue("Height", nWidth);
748}
749}
750
752 weld::Window* pDialogParent,
753 const OUString &rName,
754 const OUString &rParent,
755 const SfxStyleFamily nFamily,
756 SfxStyleSearchBits nMask,
757 const bool bNew,
758 const OString& sPage,
759 SwWrtShell* pActShell,
760 SfxRequest* pReq,
761 sal_uInt16 nSlot)
762{
763 assert( GetWrtShell() );
764 const bool bBasic = pReq && pReq->IsAPI();
765 SfxStyleSheetBase *pStyle = nullptr;
766
767 bool bModified = m_xDoc->getIDocumentState().IsModified();
768
769 SwUndoId nNewStyleUndoId(SwUndoId::EMPTY);
770
771 if( bNew )
772 {
773 if (!bBasic)
774 {
775 // start undo action in order to get only one undo action for the
776 // UI new style + change style operations
778 }
779
780 if( SfxStyleSearchBits::All != nMask && SfxStyleSearchBits::AllVisible != nMask && SfxStyleSearchBits::Used != nMask )
781 nMask |= SfxStyleSearchBits::UserDefined;
782 else
783 nMask = SfxStyleSearchBits::UserDefined;
784
785 if ( nFamily == SfxStyleFamily::Para || nFamily == SfxStyleFamily::Char || nFamily == SfxStyleFamily::Frame )
786 {
787 // Prevent undo append from being done during paragraph, character, and frame style Make
788 // Do it after ok return from style dialog when derived from style is known
789 ::sw::UndoGuard const undoGuard(GetDoc()->GetIDocumentUndoRedo());
790 pStyle = &m_xBasePool->Make( rName, nFamily, nMask );
791 }
792 else
793 {
794 pStyle = &m_xBasePool->Make( rName, nFamily, nMask );
795 }
796
797 // set the current one as Parent
798 SwDocStyleSheet* pDStyle = static_cast<SwDocStyleSheet*>(pStyle);
799 switch( nFamily )
800 {
801 case SfxStyleFamily::Para:
802 {
803 if(!rParent.isEmpty())
804 {
806 if(!pColl)
807 {
809 if(USHRT_MAX != nId)
811 }
812 pDStyle->GetCollection()->SetDerivedFrom( pColl );
813 pDStyle->PresetParent( rParent );
814 }
815 else
816 {
818 pDStyle->GetCollection()->SetDerivedFrom( pColl );
819 if( pColl )
820 pDStyle->PresetParent( pColl->GetName() );
821 }
822 }
823 break;
824 case SfxStyleFamily::Char:
825 {
826 if(!rParent.isEmpty())
827 {
828 SwCharFormat* pCFormat = m_pWrtShell->FindCharFormatByName(rParent);
829 if(!pCFormat)
830 {
832 if(USHRT_MAX != nId)
834 }
835
836 pDStyle->GetCharFormat()->SetDerivedFrom( pCFormat );
837 pDStyle->PresetParent( rParent );
838 }
839 else
840 {
842 pDStyle->GetCharFormat()->SetDerivedFrom( pCFormat );
843 if( pCFormat )
844 pDStyle->PresetParent( pCFormat->GetName() );
845 }
846 }
847 break;
848 case SfxStyleFamily::Frame :
849 {
850 if(!rParent.isEmpty())
851 {
852 SwFrameFormat* pFFormat = m_pWrtShell->GetDoc()->FindFrameFormatByName( rParent );
853 if(!pFFormat)
854 {
856 if(USHRT_MAX != nId)
858 }
859 pDStyle->GetFrameFormat()->SetDerivedFrom( pFFormat );
860 pDStyle->PresetParent( rParent );
861 }
862 }
863 break;
864 default: break;
865 }
866
867 if (!bBasic)
868 {
869 //Get the undo id for the type of style that was created in order to re-use that comment for the grouped
870 //create style + change style operations
871 m_pWrtShell->GetLastUndoInfo(nullptr, &nNewStyleUndoId);
872 }
873 }
874 else
875 {
876 pStyle = m_xBasePool->Find( rName, nFamily );
877 SAL_WARN_IF( !pStyle, "sw.ui", "Style not found" );
878 }
879
880 if(!pStyle)
881 return;
882
883 // put dialogues together
884 rtl::Reference< SwDocStyleSheet > xTmp( new SwDocStyleSheet( *static_cast<SwDocStyleSheet*>(pStyle) ) );
885 if( SfxStyleFamily::Para == nFamily )
886 {
887 SfxItemSet& rSet = xTmp->GetItemSet();
889 // merge list level indent attributes into the item set if needed
890 xTmp->MergeIndentAttrsOfListStyle( rSet );
891
892 ::ConvertAttrCharToGen(xTmp->GetItemSet(), /*bIsPara=*/true);
893 }
894 else if( SfxStyleFamily::Char == nFamily )
895 {
896 ::ConvertAttrCharToGen(xTmp->GetItemSet());
897 }
898
899 if(SfxStyleFamily::Page == nFamily || SfxStyleFamily::Para == nFamily)
900 {
901 // create needed items for XPropertyList entries from the DrawModel so that
902 // the Area TabPage can access them
903 SfxItemSet& rSet = xTmp->GetItemSet();
905
906 rSet.Put(SvxColorListItem(pDrawModel->GetColorList(), SID_COLOR_TABLE));
907 rSet.Put(SvxGradientListItem(pDrawModel->GetGradientList(), SID_GRADIENT_LIST));
908 rSet.Put(SvxHatchListItem(pDrawModel->GetHatchList(), SID_HATCH_LIST));
909 rSet.Put(SvxBitmapListItem(pDrawModel->GetBitmapList(), SID_BITMAP_LIST));
910 rSet.Put(SvxPatternListItem(pDrawModel->GetPatternList(), SID_PATTERN_LIST));
911
912 std::optional<SfxGrabBagItem> oGrabBag;
913 if (SfxGrabBagItem const* pItem = rSet.GetItemIfSet(SID_ATTR_CHAR_GRABBAG))
914 {
915 oGrabBag.emplace(*pItem);
916 }
917 else
918 {
919 oGrabBag.emplace(SID_ATTR_CHAR_GRABBAG);
920 }
921 bool bGutterAtTop
923 oGrabBag->GetGrabBag()["GutterAtTop"] <<= bGutterAtTop;
924 rSet.Put(*oGrabBag);
925 }
926
927 SwWrtShell* pCurrShell = pActShell ? pActShell : m_pWrtShell;
928 if (nFamily == SfxStyleFamily::Frame)
929 {
930 SfxItemSet& rSet = xTmp->GetItemSet();
931 const SwViewOption* pVOpt = pCurrShell->GetViewOptions();
933 }
934
935 if (!bBasic)
936 {
937 // prior to the dialog the HtmlMode at the DocShell is being sunk
938 sal_uInt16 nHtmlMode = ::GetHtmlMode(this);
939
940 // In HTML mode, we do not always have a printer. In order to show
941 // the correct page size in the Format - Page dialog, we have to
942 // get one here.
943 if( ( HTMLMODE_ON & nHtmlMode ) &&
944 !pCurrShell->getIDocumentDeviceAccess().getPrinter( false ) )
945 pCurrShell->InitPrt( pCurrShell->getIDocumentDeviceAccess().getPrinter( true ) );
946
947 PutItem(SfxUInt16Item(SID_HTML_MODE, nHtmlMode));
948 FieldUnit eMetric = ::GetDfltMetric(0 != (HTMLMODE_ON&nHtmlMode));
949 SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)));
951 if (!pDialogParent)
952 {
953 SAL_WARN("sw.ui", "no parent for dialog supplied, assuming document frame is good enough");
954 pDialogParent = GetView()->GetFrameWeld();
955 }
957 *xTmp, nFamily, sPage, pCurrShell, bNew));
958 auto pApplyStyleHelper = std::make_shared<ApplyStyle>(*this, bNew, xTmp, nFamily, pDlg.get(), m_xBasePool, bModified);
959 pDlg->SetApplyHdl(LINK(pApplyStyleHelper.get(), ApplyStyle, ApplyHdl));
960
961 std::shared_ptr<SfxRequest> pRequest;
962 if (pReq)
963 {
964 pRequest = std::make_shared<SfxRequest>(*pReq);
965 pReq->Ignore(); // the 'old' request is not relevant any more
966 }
967
968 bool bIsDefaultPage = nFamily == SfxStyleFamily::Page
969 && rName == SwResId(STR_POOLPAGE_STANDARD)
970 && pStyle->IsUsed()
971 && !pStyle->IsUserDefined();
972
973 pDlg->StartExecuteAsync([bIsDefaultPage, bNew, nFamily, nSlot, nNewStyleUndoId, pApplyStyleHelper, pRequest, xTmp, this](sal_Int32 nResult){
974 if (RET_OK == nResult)
975 pApplyStyleHelper->apply();
976
977 if (bNew)
978 {
979 switch( nFamily )
980 {
981 case SfxStyleFamily::Para:
982 {
983 if(!xTmp->GetParent().isEmpty())
984 {
985 SwTextFormatColl* pColl = m_pWrtShell->FindTextFormatCollByName(xTmp->GetParent());
986 if (GetDoc()->GetIDocumentUndoRedo().DoesUndo())
987 {
988 GetDoc()->GetIDocumentUndoRedo().AppendUndo(
989 std::make_unique<SwUndoTextFormatCollCreate>(xTmp->GetCollection(), pColl, *GetDoc()));
990 }
991 }
992 }
993 break;
994 case SfxStyleFamily::Char:
995 {
996 if(!xTmp->GetParent().isEmpty())
997 {
998 SwCharFormat* pCFormat = m_pWrtShell->FindCharFormatByName(xTmp->GetParent());
999 if (GetDoc()->GetIDocumentUndoRedo().DoesUndo())
1000 {
1001 GetDoc()->GetIDocumentUndoRedo().AppendUndo(
1002 std::make_unique<SwUndoCharFormatCreate>(xTmp->GetCharFormat(), pCFormat, *GetDoc()));
1003 }
1004 }
1005 }
1006 break;
1007 case SfxStyleFamily::Frame:
1008 {
1009 if(!xTmp->GetParent().isEmpty())
1010 {
1011 SwFrameFormat* pFFormat = m_pWrtShell->GetDoc()->FindFrameFormatByName(xTmp->GetParent());
1012 if (GetDoc()->GetIDocumentUndoRedo().DoesUndo())
1013 {
1014 GetDoc()->GetIDocumentUndoRedo().AppendUndo(
1015 std::make_unique<SwUndoFrameFormatCreate>(xTmp->GetFrameFormat(), pFFormat, *GetDoc()));
1016 }
1017 }
1018 }
1019 break;
1020 default: break;
1021 }
1022
1023 SwRewriter aRewriter;
1024 aRewriter.AddRule(UndoArg1, xTmp->GetName());
1025 //Group the create style and change style operations together under the
1026 //one "create style" comment
1027 m_pWrtShell->EndUndo(nNewStyleUndoId, &aRewriter);
1028 }
1029
1030 bool bDocModified = pApplyStyleHelper->DocIsModified();
1031
1032 if (RET_OK != nResult)
1033 {
1034 if (bNew)
1035 {
1036 GetWrtShell()->Undo();
1037 m_xDoc->GetIDocumentUndoRedo().ClearRedo();
1038 }
1039
1040 if (!bDocModified)
1041 m_xDoc->getIDocumentState().ResetModified();
1042 }
1043
1044 // Update Watermark if new page style was created
1045 if (nSlot == SID_STYLE_NEW && nFamily == SfxStyleFamily::Page)
1046 {
1047 SwWrtShell* pShell = GetWrtShell();
1048 const SfxWatermarkItem aWatermark = pShell->GetWatermark();
1049 pShell->SetWatermark(aWatermark);
1050 }
1051
1052 pApplyStyleHelper->m_pDlg.disposeAndClear();
1053 if (pRequest)
1054 pRequest->Done();
1055
1056 if (bIsDefaultPage && bDocModified)
1057 {
1058 uno::Reference< style::XStyleFamiliesSupplier > xStyleFamSupp(GetModel(), uno::UNO_QUERY);
1059
1060 if (!xStyleFamSupp.is())
1061 {
1062 SAL_WARN("sw.ui", "Ref to XStyleFamiliesSupplier is null.");
1063 return;
1064 }
1065
1066 syncEndnoteOrientation(xStyleFamSupp);
1067 }
1068 });
1069 }
1070 else
1071 {
1072 // prior to the dialog the HtmlMode at the DocShell is being sunk
1073 PutItem(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(this)));
1074
1075 GetWrtShell()->StartAllAction();
1076
1077 if( SfxStyleFamily::Para == nFamily )
1078 {
1079 ::SfxToSwPageDescAttr( *GetWrtShell(), xTmp->GetItemSet() );
1080 ::ConvertAttrGenToChar(xTmp->GetItemSet(), xTmp->GetItemSet(), /*bIsPara=*/true);
1081 }
1082 else
1083 {
1084 ::ConvertAttrGenToChar(xTmp->GetItemSet(), xTmp->GetItemSet());
1085 }
1086 if(SfxStyleFamily::Page == nFamily)
1087 m_pView->InvalidateRulerPos();
1088
1089 if( bNew )
1090 m_xBasePool->Broadcast(SfxStyleSheetHint(SfxHintId::StyleSheetCreated, *xTmp));
1091
1092 m_xDoc->getIDocumentState().SetModified();
1093 if( !bModified ) // Bug 57028
1094 {
1095 m_xDoc->GetIDocumentUndoRedo().SetUndoNoResetModified();
1096 }
1097 GetWrtShell()->EndAllAction();
1098 }
1099}
1100
1101void SwDocShell::Delete(const OUString &rName, SfxStyleFamily nFamily)
1102{
1103 SfxStyleSheetBase *pStyle = m_xBasePool->Find(rName, nFamily);
1104
1105 if(pStyle)
1106 {
1107 assert( GetWrtShell() );
1108
1110 m_xBasePool->Remove(pStyle);
1112 }
1113}
1114
1115void SwDocShell::Hide(const OUString &rName, SfxStyleFamily nFamily, bool bHidden)
1116{
1117 SfxStyleSheetBase *pStyle = m_xBasePool->Find(rName, nFamily);
1118
1119 if(pStyle)
1120 {
1121 assert( GetWrtShell() );
1122
1124 rtl::Reference< SwDocStyleSheet > xTmp( new SwDocStyleSheet( *static_cast<SwDocStyleSheet*>(pStyle) ) );
1125 xTmp->SetHidden( bHidden );
1127 }
1128}
1129
1130// apply template
1132 SwWrtShell* pShell, const sal_uInt16 nMode )
1133{
1135
1136 SwDocStyleSheet* pStyle = static_cast<SwDocStyleSheet*>( m_xBasePool->Find( rName, nFamily ) );
1137
1138 SAL_WARN_IF( !pStyle, "sw.ui", "Style not found" );
1139
1140 if(!pStyle)
1141 return SfxStyleFamily::None;
1142
1143 SwWrtShell *pSh = pShell ? pShell : GetWrtShell();
1144
1145 assert( pSh );
1146
1147 pSh->StartAllAction();
1148
1149 switch (nFamily)
1150 {
1151 case SfxStyleFamily::Char:
1152 {
1153 SwFormatCharFormat aFormat(pStyle->GetCharFormat());
1154 pSh->SetAttrItem( aFormat, (nMode & KEY_SHIFT) ?
1156 break;
1157 }
1158 case SfxStyleFamily::Para:
1159 {
1160 // #i62675#
1161 // clear also list attributes at affected text nodes, if paragraph
1162 // style has the list style attribute set.
1163 pSh->SetTextFormatColl( pStyle->GetCollection(), true );
1164 break;
1165 }
1166 case SfxStyleFamily::Frame:
1167 {
1168 if ( pSh->IsFrameSelected() )
1169 pSh->SetFrameFormat( pStyle->GetFrameFormat() );
1170 break;
1171 }
1172 case SfxStyleFamily::Page:
1173 {
1174 pSh->SetPageStyle(pStyle->GetPageDesc()->GetName());
1175 break;
1176 }
1177 case SfxStyleFamily::Pseudo:
1178 {
1179 // reset indent attribute on applying list style
1180 // continue list of list style
1181 const SwNumRule* pNumRule = pStyle->GetNumRule();
1182 if (pNumRule->GetName() == "No List")
1183 {
1185 break;
1186 }
1187 const OUString sListIdForStyle =pNumRule->GetDefaultListId();
1188 pSh->SetCurNumRule( *pNumRule, false, sListIdForStyle, true );
1189 break;
1190 }
1191 case SfxStyleFamily::Table:
1192 {
1193 pSh->SetTableStyle(pStyle->GetName());
1194 break;
1195 }
1196 default:
1197 OSL_FAIL("Unknown family");
1198 }
1199 pSh->EndAllAction();
1200
1201 return nFamily;
1202}
1203
1204// start watering-can
1206{
1207 assert( GetWrtShell() );
1208
1209 SwEditWin& rEdtWin = m_pView->GetEditWin();
1210 SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate();
1211 bool bWaterCan = !(pApply && pApply->eType != SfxStyleFamily(0));
1212
1213 if( rName.isEmpty() )
1214 bWaterCan = false;
1215
1216 SwApplyTemplate aTemplate;
1217 aTemplate.eType = nFamily;
1218
1219 if(bWaterCan)
1220 {
1221 SwDocStyleSheet* pStyle =
1222 static_cast<SwDocStyleSheet*>( m_xBasePool->Find(rName, nFamily) );
1223
1224 SAL_WARN_IF( !pStyle, "sw.ui", "Where's the StyleSheet" );
1225
1226 if(!pStyle) return nFamily;
1227
1228 switch(nFamily)
1229 {
1230 case SfxStyleFamily::Char:
1231 aTemplate.aColl.pCharFormat = pStyle->GetCharFormat();
1232 break;
1233 case SfxStyleFamily::Para:
1234 aTemplate.aColl.pTextColl = pStyle->GetCollection();
1235 break;
1236 case SfxStyleFamily::Frame:
1237 aTemplate.aColl.pFrameFormat = pStyle->GetFrameFormat();
1238 break;
1239 case SfxStyleFamily::Page:
1240 aTemplate.aColl.pPageDesc = const_cast<SwPageDesc*>(pStyle->GetPageDesc());
1241 break;
1242 case SfxStyleFamily::Pseudo:
1243 aTemplate.aColl.pNumRule = const_cast<SwNumRule*>(pStyle->GetNumRule());
1244 break;
1245
1246 default:
1247 OSL_FAIL("Unknown family");
1248 }
1249 }
1250 else
1251 aTemplate.eType = SfxStyleFamily(0);
1252
1253 m_pView->GetEditWin().SetApplyTemplate(aTemplate);
1254
1255 return nFamily;
1256}
1257
1258// update template
1259void SwDocShell::UpdateStyle(const OUString &rName, SfxStyleFamily nFamily, SwWrtShell* pShell)
1260{
1261 SwWrtShell* pCurrWrtShell = pShell ? pShell : GetWrtShell();
1262 assert( pCurrWrtShell );
1263
1264 SwDocStyleSheet* pStyle =
1265 static_cast<SwDocStyleSheet*>( m_xBasePool->Find(rName, nFamily) );
1266
1267 if (!pStyle)
1268 return;
1269
1270 switch(nFamily)
1271 {
1272 case SfxStyleFamily::Para:
1273 {
1274 SwTextFormatColl* pColl = pStyle->GetCollection();
1275 if(pColl && !pColl->IsDefault())
1276 {
1278
1279 SwRewriter aRewriter;
1280 aRewriter.AddRule(UndoArg1, pColl->GetName());
1281
1283 GetWrtShell()->FillByEx(pColl);
1284 // also apply template to remove hard set attributes
1285 GetWrtShell()->SetTextFormatColl( pColl );
1286 GetWrtShell()->EndUndo();
1288 }
1289 break;
1290 }
1291 case SfxStyleFamily::Frame:
1292 {
1293 SwFrameFormat* pFrame = pStyle->GetFrameFormat();
1294 if( pCurrWrtShell->IsFrameSelected() && pFrame && !pFrame->IsDefault() )
1295 {
1297 pCurrWrtShell->StartAllAction();
1298 pCurrWrtShell->GetFlyFrameAttr( aSet );
1299
1300 // #i105535#
1301 // no update of anchor attribute
1302 aSet.ClearItem( RES_ANCHOR );
1303
1304 pFrame->SetFormatAttr( aSet );
1305
1306 // also apply template to remove hard set attributes
1307 pCurrWrtShell->SetFrameFormat( pFrame, true );
1308 pCurrWrtShell->EndAllAction();
1309 }
1310 }
1311 break;
1312 case SfxStyleFamily::Char:
1313 {
1314 SwCharFormat* pChar = pStyle->GetCharFormat();
1315 if( pChar && !pChar->IsDefault() )
1316 {
1317 pCurrWrtShell->StartAllAction();
1318 pCurrWrtShell->FillByEx(pChar);
1319 // also apply template to remove hard set attributes
1320 pCurrWrtShell->EndAllAction();
1321 }
1322
1323 }
1324 break;
1325 case SfxStyleFamily::Pseudo:
1326 {
1327 const SwNumRule* pCurRule;
1328 if( pStyle->GetNumRule() &&
1329 nullptr != ( pCurRule = pCurrWrtShell->GetNumRuleAtCurrCursorPos() ))
1330 {
1331 SwNumRule aRule( *pCurRule );
1332 // #i91400#
1333 aRule.SetName( pStyle->GetNumRule()->GetName(),
1334 pCurrWrtShell->GetDoc()->getIDocumentListsAccess() );
1335 pCurrWrtShell->ChgNumRuleFormats( aRule );
1336 }
1337 }
1338 break;
1339 case SfxStyleFamily::Table:
1340 {
1341 if(GetFEShell()->IsTableMode())
1342 {
1344 }
1345 SwTableAutoFormat aFormat(rName);
1346 if (pCurrWrtShell->GetTableAutoFormat(aFormat))
1347 {
1348 pCurrWrtShell->StartAllAction();
1349 pCurrWrtShell->GetDoc()->ChgTableStyle(rName, aFormat);
1350 pCurrWrtShell->EndAllAction();
1351 }
1352
1353 }
1354 break;
1355 default: break;
1356 }
1357
1358 m_xDoc->BroadcastStyleOperation(rName, nFamily, SfxHintId::StyleSheetModified);
1359}
1360
1361// NewByExample
1362void SwDocShell::MakeByExample( const OUString &rName, SfxStyleFamily nFamily,
1363 SfxStyleSearchBits nMask, SwWrtShell* pShell )
1364{
1365 SwWrtShell* pCurrWrtShell = pShell ? pShell : GetWrtShell();
1366 SwDocStyleSheet* pStyle = static_cast<SwDocStyleSheet*>( m_xBasePool->Find(
1367 rName, nFamily ) );
1368 if(!pStyle)
1369 {
1370 // preserve the current mask of PI, then the new one is
1371 // immediately merged with the viewable area
1372 if( SfxStyleSearchBits::All == nMask || SfxStyleSearchBits::Used == nMask )
1373 nMask = SfxStyleSearchBits::UserDefined;
1374 else
1375 nMask |= SfxStyleSearchBits::UserDefined;
1376
1377 if (nFamily == SfxStyleFamily::Para || nFamily == SfxStyleFamily::Char || nFamily == SfxStyleFamily::Frame)
1378 {
1379 // Prevent undo append from being done during paragraph, character, and frame style Make. Do it later
1380 ::sw::UndoGuard const undoGuard(GetDoc()->GetIDocumentUndoRedo());
1381 pStyle = static_cast<SwDocStyleSheet*>(&m_xBasePool->Make(rName, nFamily, nMask));
1382 }
1383 else
1384 {
1385 pStyle = static_cast<SwDocStyleSheet*>(&m_xBasePool->Make(rName, nFamily, nMask));
1386 }
1387 }
1388
1389 switch(nFamily)
1390 {
1391 case SfxStyleFamily::Para:
1392 {
1393 SwTextFormatColl* pColl = pStyle->GetCollection();
1394 if(pColl && !pColl->IsDefault())
1395 {
1396 pCurrWrtShell->StartAllAction();
1397 pCurrWrtShell->FillByEx(pColl);
1398 // also apply template to remove hard set attributes
1399 SwTextFormatColl * pDerivedFrom = pCurrWrtShell->GetCurTextFormatColl();
1400 pColl->SetDerivedFrom(pDerivedFrom);
1401
1402 // set the mask at the Collection:
1403 sal_uInt16 nId = pColl->GetPoolFormatId() & 0x87ff;
1404 switch( nMask & static_cast<SfxStyleSearchBits>(0x0fff) )
1405 {
1406 case SfxStyleSearchBits::SwText:
1408 break;
1409 case SfxStyleSearchBits::SwChapter:
1410 nId |= COLL_DOC_BITS;
1411 break;
1412 case SfxStyleSearchBits::SwList:
1414 break;
1415 case SfxStyleSearchBits::SwIndex:
1417 break;
1418 case SfxStyleSearchBits::SwExtra:
1420 break;
1421 case SfxStyleSearchBits::SwHtml:
1423 break;
1424 default: break;
1425 }
1426 pColl->SetPoolFormatId(nId);
1427
1429 {
1431 std::make_unique<SwUndoTextFormatCollCreate>(pColl, pDerivedFrom, *GetDoc()));
1432 }
1433 pCurrWrtShell->SetTextFormatColl(pColl);
1434 pCurrWrtShell->EndAllAction();
1435 }
1436 }
1437 break;
1438 case SfxStyleFamily::Frame:
1439 {
1440 SwFrameFormat* pFrame = pStyle->GetFrameFormat();
1441 if(pCurrWrtShell->IsFrameSelected() && pFrame && !pFrame->IsDefault())
1442 {
1443 pCurrWrtShell->StartAllAction();
1444
1446 pCurrWrtShell->GetFlyFrameAttr( aSet );
1447 aSet.ClearItem(RES_ANCHOR); // tdf#112574 no anchor in styles
1448
1449 SwFrameFormat* pFFormat = pCurrWrtShell->GetSelectedFrameFormat();
1450 pFrame->SetDerivedFrom( pFFormat );
1451 pFrame->SetFormatAttr( aSet );
1452 if (GetDoc()->GetIDocumentUndoRedo().DoesUndo())
1453 {
1455 std::make_unique<SwUndoFrameFormatCreate>(pFrame, pFFormat, *GetDoc()));
1456 }
1457 // also apply template to remove hard set attributes
1458 pCurrWrtShell->SetFrameFormat(pFrame);
1459 pCurrWrtShell->EndAllAction();
1460 }
1461 }
1462 break;
1463 case SfxStyleFamily::Char:
1464 {
1465 SwCharFormat* pChar = pStyle->GetCharFormat();
1466 if(pChar && !pChar->IsDefault())
1467 {
1468 pCurrWrtShell->StartAllAction();
1469 pCurrWrtShell->FillByEx( pChar );
1470 SwCharFormat * pDerivedFrom = pCurrWrtShell->GetCurCharFormat();
1471 pChar->SetDerivedFrom( pDerivedFrom );
1472 SwFormatCharFormat aFormat( pChar );
1473
1474 if (GetDoc()->GetIDocumentUndoRedo().DoesUndo())
1475 {
1476 // Looks like sometimes pDerivedFrom can be null and this is not supported by redo code
1477 // So use default format as a derived from in such situations
1479 std::make_unique<SwUndoCharFormatCreate>(
1480 pChar, pDerivedFrom ? pDerivedFrom : GetDoc()->GetDfltCharFormat(),
1481 *GetDoc()));
1482 }
1483 pCurrWrtShell->SetAttrItem(aFormat);
1484 pCurrWrtShell->EndAllAction();
1485 }
1486 }
1487 break;
1488
1489 case SfxStyleFamily::Page:
1490 {
1491 pCurrWrtShell->StartAllAction();
1492 size_t nPgDsc = pCurrWrtShell->GetCurPageDesc();
1493 SwPageDesc& rSrc = const_cast<SwPageDesc&>(pCurrWrtShell->GetPageDesc( nPgDsc ));
1494 SwPageDesc& rDest = *const_cast<SwPageDesc*>(pStyle->GetPageDesc());
1495
1496 sal_uInt16 nPoolId = rDest.GetPoolFormatId();
1497 sal_uInt16 nHId = rDest.GetPoolHelpId();
1498 sal_uInt8 nHFId = rDest.GetPoolHlpFileId();
1499
1500 pCurrWrtShell->GetDoc()->CopyPageDesc( rSrc, rDest );
1501
1502 // PoolId must NEVER be copied!
1503 rDest.SetPoolFormatId( nPoolId );
1504 rDest.SetPoolHelpId( nHId );
1505 rDest.SetPoolHlpFileId( nHFId );
1506
1507 // when Headers/Footers are created, there is no Undo anymore!
1508 pCurrWrtShell->GetDoc()->GetIDocumentUndoRedo().DelAllUndoObj();
1509
1510 pCurrWrtShell->EndAllAction();
1511 }
1512 break;
1513
1514 case SfxStyleFamily::Pseudo:
1515 {
1516 const SwNumRule* pCurRule = pCurrWrtShell->GetNumRuleAtCurrCursorPos();
1517
1518 if (pCurRule)
1519 {
1520 pCurrWrtShell->StartAllAction();
1521
1522 SwNumRule aRule( *pCurRule );
1523 OUString sOrigRule( aRule.GetName() );
1524 // #i91400#
1525 aRule.SetName( pStyle->GetNumRule()->GetName(),
1526 pCurrWrtShell->GetDoc()->getIDocumentListsAccess() );
1527 pCurrWrtShell->ChgNumRuleFormats( aRule );
1528
1529 pCurrWrtShell->ReplaceNumRule( sOrigRule, aRule.GetName() );
1530
1531 pCurrWrtShell->EndAllAction();
1532 }
1533 }
1534 break;
1535
1536 case SfxStyleFamily::Table:
1537 {
1538 SwTableAutoFormat* pFormat = pStyle->GetTableFormat();
1539 if (pCurrWrtShell->GetTableAutoFormat(*pFormat))
1540 {
1541 pCurrWrtShell->StartAllAction();
1542
1543 pCurrWrtShell->SetTableStyle(rName);
1544
1545 pCurrWrtShell->EndAllAction();
1546 }
1547 }
1548 break;
1549
1550 default: break;
1551 }
1552
1553 m_xDoc->BroadcastStyleOperation(rName, nFamily, SfxHintId::StyleSheetCreated);
1554}
1555
1557{
1558#if !ENABLE_WASM_STRIP_ACCESSIBILITY
1559 sw::AccessibilityCheck aCheck(m_xDoc.get());
1560 aCheck.check();
1561 return aCheck.getIssueCollection();
1562#else
1564#endif
1565}
1566
1568{
1569 return m_xDoc->GetDocColors();
1570}
1571
1573{
1574 LoadStyles_(rSource, false);
1575}
1576
1577// bPreserveCurrentDocument determines whether SetFixFields() is called
1578// This call modifies the source document. This mustn't happen when the source
1579// is a document the user is working on.
1580// Calls of ::LoadStyles() normally use files especially loaded for the purpose
1581// of importing styles.
1582void SwDocShell::LoadStyles_( SfxObjectShell& rSource, bool bPreserveCurrentDocument )
1583{
1584/* [Description]
1585
1586 This method is called by SFx if Styles have to be reloaded from a
1587 document-template. Existing Styles should be overwritten by that.
1588 That's why the document has to be reformatted. Therefore applications
1589 will usually override this method and call the baseclass' implementation
1590 in their implementation.
1591*/
1592 // When the source is our document, we do the checking ourselves
1593 // (much quicker and doesn't use the crutch StxStylePool).
1594 if( dynamic_cast<const SwDocShell*>( &rSource) != nullptr)
1595 {
1596 // in order for the Headers/Footers not to get the fixed content
1597 // of the template, update all the Source's
1598 // FixFields once.
1599 if(!bPreserveCurrentDocument)
1600 static_cast<SwDocShell&>(rSource).m_xDoc->getIDocumentFieldsAccess().SetFixFields(nullptr);
1601 if (m_pWrtShell)
1602 {
1603 // rhbz#818557, fdo#58893: EndAllAction will call SelectShell(),
1604 // which pushes a bunch of SfxShells that are not cleared
1605 // (for unknown reasons) when closing the document, causing crash;
1606 // setting g_bNoInterrupt appears to avoid the problem.
1609 m_xDoc->ReplaceStyles( *static_cast<SwDocShell&>(rSource).m_xDoc );
1611 }
1612 else
1613 {
1614 bool bModified = m_xDoc->getIDocumentState().IsModified();
1615 m_xDoc->ReplaceStyles( *static_cast<SwDocShell&>(rSource).m_xDoc );
1616 if (!bModified && m_xDoc->getIDocumentState().IsModified() && !m_pView)
1617 {
1618 // the View is created later, but overwrites the Modify-Flag.
1619 // Undo doesn't work anymore anyways.
1620 m_xDoc->GetIDocumentUndoRedo().SetUndoNoResetModified();
1621 }
1622 }
1623 }
1624 else
1625 SfxObjectShell::LoadStyles( rSource );
1626}
1627
1629 weld::Window* pDialogParent,
1630 const OUString& rPage,
1631 const OString& rPageId,
1632 SwWrtShell& rActShell,
1633 SfxRequest* pRequest)
1634{
1635 Edit(pDialogParent, rPage, OUString(), SfxStyleFamily::Page, SfxStyleSearchBits::Auto, false, rPageId, &rActShell, pRequest);
1636}
1637
1638/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@ UndoArg1
Definition: SwRewriter.hxx:29
sal_uInt16 GetValue() const
const OUString & GetValue() const
virtual SfxPrinter * getPrinter(bool bCreate) const =0
Return the printer set at the document.
virtual const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
virtual void set(DocumentSettingId id, bool value)=0
Set the specified document setting.
virtual void SetModified()=0
Must be called manually at changes of format.
virtual void AppendUndo(std::unique_ptr< SwUndo > pUndo)=0
Add new Undo action.
virtual bool DoesUndo() const =0
Is Undo enabled?
virtual void DelAllUndoObj()=0
Delete all Undo actions.
virtual void SetUndoNoResetModified()=0
Disable (re)setting the document modified flag on Undo/Redo.
XBitmapListRef GetBitmapList() const
XGradientListRef GetGradientList() const
XPatternListRef GetPatternList() const
XColorListRef GetColorList() const
XHatchListRef GetHatchList() const
SfxItemState QueryState(sal_uInt16 nSID, std::unique_ptr< SfxPoolItem > &rpState)
void Invalidate(sal_uInt16 nId)
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
sal_uInt16 Count() 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 DisableItem(sal_uInt16 nWhich)
void InvalidateItem(sal_uInt16 nWhich)
OUString GetName() const
css::uno::Reference< css::frame::XModel3 > GetModel() const
virtual void LoadStyles(SfxObjectShell &rSource)
sal_uInt16 GetSlot() const
void Ignore()
const SfxItemSet * GetArgs() const
const T * GetArg(sal_uInt16 nSlotId) const
void AppendItem(const SfxPoolItem &)
void SetReturnValue(const SfxPoolItem &)
sal_uInt16 GetModifier() const
weld::Window * GetFrameWeld() const
bool IsAPI() const
void Done(bool bRemove=false)
void PutItem(const SfxPoolItem &rItem)
SfxItemPool & GetPool() const
static OUString GenerateUnusedName(SfxStyleSheetBasePool &rPool, SfxStyleFamily eFam)
const OUString & GetName() const
bool IsUserDefined() const
virtual bool IsUsed() const
void SetValue(SfxStyleSearchBits n)
static SfxViewFrame * Current()
SfxBindings & GetBindings()
SfxDispatcher * GetDispatcher()
weld::Window * GetFrameWeld() const
SfxViewFrame * GetViewFrame() const
sal_uInt16 FirstWhich()
sal_uInt16 NextWhich()
virtual VclPtr< SfxAbstractApplyTabDialog > CreateTemplateDialog(weld::Window *pParent, SfxStyleSheetBase &rBase, SfxStyleFamily nRegion, const OString &sPage, SwWrtShell *pActShell, bool bNew)=0
static SwAbstractDialogFactory * Create()
Definition: swabstdlg.cxx:36
Represents the style of a text portion.
Definition: charfmt.hxx:27
static void DoUpdateAllCharts(SwDoc *pDoc)
Definition: unochart.cxx:52
const SwTableNode * IsCursorInTable() const
Definition: crsrsh.hxx:902
void TableCursorToCursor()
enter block mode, change normal cursor into block cursor
Definition: crsrsh.cxx:895
rtl::Reference< SwDoc > m_xDoc
Document.
Definition: docsh.hxx:71
rtl::Reference< SfxStyleSheetBasePool > m_xBasePool
Passing through for formats.
Definition: docsh.hxx:72
SwWrtShell * m_pWrtShell
Definition: docsh.hxx:84
virtual std::set< Color > GetDocColors() override
Definition: docst.cxx:1567
SwFEShell * GetFEShell()
For Core - it knows the DocShell but not the WrtShell!
Definition: docsh.cxx:1225
void LoadStyles_(SfxObjectShell &rSource, bool bPreserveCurrentDocument)
Definition: docst.cxx:1582
void StateStyleSheet(SfxItemSet &, SwWrtShell *pSh=nullptr)
Definition: docst.cxx:87
SAL_DLLPRIVATE void MakeByExample(const OUString &rName, SfxStyleFamily nFamily, SfxStyleSearchBits nMask, SwWrtShell *pShell)
Definition: docst.cxx:1362
SAL_DLLPRIVATE void Delete(const OUString &rName, SfxStyleFamily nFamily)
Definition: docst.cxx:1101
const SwView * GetView() const
Definition: docsh.hxx:221
SAL_DLLPRIVATE void UpdateStyle(const OUString &rName, SfxStyleFamily nFamily, SwWrtShell *pShell)
Definition: docst.cxx:1259
SwWrtShell * GetWrtShell()
Access to the SwWrtShell belonging to SwView.
Definition: docsh.hxx:225
SAL_DLLPRIVATE void Hide(const OUString &rName, SfxStyleFamily nFamily, bool bHidden)
Definition: docst.cxx:1115
SwView * m_pView
For "historical reasons" nothing can be done without the WrtShell.
Definition: docsh.hxx:83
virtual SfxStyleSheetBasePool * GetStyleSheetPool() override
For Style PI.
Definition: docsh.cxx:1154
virtual void LoadStyles(SfxObjectShell &rSource) override
Definition: docst.cxx:1572
void ExecStyleSheet(SfxRequest &)
Definition: docst.cxx:292
void FormatPage(weld::Window *pDialogParent, const OUString &rPage, const OString &rPageId, SwWrtShell &rActShell, SfxRequest *pRequest=nullptr)
Show page style format dialog.
Definition: docst.cxx:1628
SAL_DLLPRIVATE SfxStyleFamily DoWaterCan(const OUString &rName, SfxStyleFamily nFamily)
Definition: docst.cxx:1205
sfx::AccessibilityIssueCollection runAccessibilityCheck() override
Definition: docst.cxx:1556
SwDoc * GetDoc()
returns Doc. But be careful!
Definition: docsh.hxx:204
SAL_DLLPRIVATE SfxStyleFamily ApplyStyles(const OUString &rName, const SfxStyleFamily nFamily, SwWrtShell *pShell, sal_uInt16 nMode)
Definition: docst.cxx:1131
SAL_DLLPRIVATE void Edit(weld::Window *pDialogParent, const OUString &rName, const OUString &rParent, const SfxStyleFamily nFamily, SfxStyleSearchBits nMask, const bool bNew, const OString &sPageId, SwWrtShell *pActShell, SfxRequest *pRequest=nullptr, sal_uInt16 nSlot=0)
Methods for StyleSheets.
Definition: docst.cxx:751
const SwNumRule * GetNumRule()
Definition: docstyle.cxx:2200
SwFrameFormat * GetFrameFormat()
Definition: docstyle.cxx:2245
void PresetParent(const OUString &rName)
Definition: docstyle.hxx:121
SwCharFormat * GetCharFormat()
Definition: docstyle.cxx:2179
SwTextFormatColl * GetCollection()
Definition: docstyle.cxx:2186
SwTableAutoFormat * GetTableFormat()
Definition: docstyle.cxx:2214
const SwPageDesc * GetPageDesc()
Definition: docstyle.cxx:2193
Definition: doc.hxx:192
void CopyPageDesc(const SwPageDesc &rSrcDesc, SwPageDesc &rDstDesc, bool bCopyPoolIds=true)
Copy the complete PageDesc - beyond document and "deep"! Optionally copying of PoolFormatId,...
Definition: docfmt.cxx:1422
void ChgTableStyle(const OUString &rName, const SwTableAutoFormat &rNewFormat)
Definition: ndtbl.cxx:4623
IDocumentState const & getIDocumentState() const
Definition: doc.cxx:395
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:145
IDocumentSettingAccess const & getIDocumentSettingAccess() const
Definition: doc.cxx:177
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
Definition: doc.cxx:156
IDocumentListsAccess const & getIDocumentListsAccess() const
Definition: doc.cxx:294
SwFrameFormat * FindFrameFormatByName(const OUString &rName) const
Definition: docfmt.cxx:744
const SwTOXBase * GetCurTOX() const
Get current listing before or at the Cursor.
Definition: edtox.cxx:191
void StartAllAction()
For all views of this document.
Definition: edws.cxx:86
void SetWatermark(const SfxWatermarkItem &rText)
Definition: edfcol.cxx:1608
SwCharFormat * GetCurCharFormat() const
Definition: edfmt.cxx:39
SwCharFormat * GetCharFormatFromPool(sal_uInt16 nId)
Definition: editsh.hxx:354
void ReplaceNumRule(const OUString &rOldRule, const OUString &rNewRule)
Definition: ednumber.cxx:792
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
SwCharFormat * FindCharFormatByName(const OUString &rName) const
Definition: edfmt.cxx:147
bool GetLastUndoInfo(OUString *const o_pStr, SwUndoId *const o_pId, const SwView *pView=nullptr) const
Definition: edws.cxx:237
void SetTextFormatColl(SwTextFormatColl *, const bool bResetListAttrs=false)
Add 2nd optional parameter <bResetListAttrs> - see also <SwDoc::SetTextFormatColl(....
Definition: edfcol.cxx:2189
void SetCurNumRule(const SwNumRule &, const bool bCreateNewList, const OUString &sContinuedListId=OUString(), const bool bResetIndentAttrs=false)
Optional parameter <bResetIndentAttrs> (default value false).
Definition: ednumber.cxx:738
SwTextFormatColl * FindTextFormatCollByName(const OUString &rName) const
Definition: edfmt.cxx:152
SwTextFormatColl * GetTextCollFromPool(sal_uInt16 nId)
Definition: edfmt.cxx:121
const SwNumRule * GetNumRuleAtCurrCursorPos() const
Definition: ednumber.cxx:694
SwFrameFormat * GetFrameFormatFromPool(sal_uInt16 nId)
Definition: editsh.hxx:352
void ChgNumRuleFormats(const SwNumRule &rRule)
Definition: ednumber.cxx:785
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
Definition: edws.cxx:234
SfxWatermarkItem GetWatermark() const
Definition: edfcol.cxx:1383
SwTextFormatColl * GetCurTextFormatColl() const
Get the named paragraph format of the current selection.
Definition: edattr.cxx:238
void FillByEx(SwCharFormat *)
Definition: edfmt.cxx:51
void EndAllAction()
Definition: edws.cxx:97
Window class for the Writer edit area, this is the one handling mouse and keyboard events and doing t...
Definition: edtwin.hxx:61
void SetApplyTemplate(const SwApplyTemplate &)
Apply template.
Definition: edtwin.cxx:5245
SwApplyTemplate * GetApplyTemplate() const
Definition: edtwin.hxx:234
FrameTypeFlags GetFrameType(const Point *pPt, bool bStopAtFly) const
For return values see above FrameType.
Definition: fews.cxx:237
void SetFrameFormat(SwFrameFormat *pFormat, bool bKeepOrient=false, Point const *pDocPos=nullptr)
If frame then set frame style.
Definition: fefly1.cxx:1225
bool IsFrameSelected() const
Definition: feshview.cxx:1253
void SetTableStyle(const OUString &rStyleName)
Set table style of the current table.
Definition: fetab.cxx:1281
SwFrameFormat * GetSelectedFrameFormat() const
If frame then frame style, else 0.
Definition: fefly1.cxx:1215
size_t GetCurPageDesc(const bool bCalcFrame=true) const
Definition: fedesc.cxx:167
bool GetTableAutoFormat(SwTableAutoFormat &rGet)
Definition: fetab.cxx:1357
bool GetFlyFrameAttr(SfxItemSet &rSet) const
Definition: fefly1.cxx:1063
const SwPageDesc & GetPageDesc(size_t i) const
Definition: fedesc.cxx:126
bool IsDefault() const
Definition: format.hxx:129
sal_uInt16 GetPoolFormatId() const
Get and set Pool style IDs.
Definition: format.hxx:163
void SetPoolFormatId(sal_uInt16 nId)
Definition: format.hxx:164
const OUString & GetName() const
Definition: format.hxx:131
bool SetDerivedFrom(SwFormat *pDerivedFrom=nullptr)
0 is Default.
Definition: format.cxx:320
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:449
Style of a layout element.
Definition: frmfmt.hxx:62
void SetName(const OUString &rNm, IDocumentListsAccess &rDocListAccess)
Definition: number.cxx:111
const OUString & GetDefaultListId() const
Definition: numrule.hxx:194
const OUString & GetName() const
Definition: numrule.hxx:224
sal_uInt16 GetPoolFormatId() const
Query and set PoolFormat-Id.
Definition: pagedesc.hxx:275
sal_uInt16 GetPoolHelpId() const
Definition: pagedesc.hxx:277
const OUString & GetName() const
Definition: pagedesc.hxx:196
void SetPoolHlpFileId(sal_uInt8 const nId)
Definition: pagedesc.hxx:280
sal_uInt8 GetPoolHlpFileId() const
Definition: pagedesc.hxx:279
void SetPoolFormatId(sal_uInt16 const nId)
Definition: pagedesc.hxx:276
void SetPoolHelpId(sal_uInt16 const nId)
Definition: pagedesc.hxx:278
void AddRule(SwUndoArg eWhat, const OUString &rWith)
Definition: SwRewriter.cxx:25
static SW_DLLPUBLIC sal_uInt16 GetPoolIdFromUIName(const OUString &rName, SwGetPoolIdFromName)
static void FillProgName(const OUString &rName, OUString &rFillName, SwGetPoolIdFromName)
const SwTable & GetTable() const
Definition: node.hxx:521
const OUString & GetTableStyleName() const
Return the table style name of this table.
Definition: swtable.hxx:191
Represents the style of a paragraph.
Definition: fmtcol.hxx:59
bool IsKeepRatio() const
Definition: viewopt.hxx:535
void SetKeepRatio(bool b)
Definition: viewopt.hxx:554
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:436
const IDocumentDeviceAccess & getIDocumentDeviceAccess() const
Provides access to the document device interface.
Definition: viewsh.cxx:2817
void InvalidateLayout(bool bSizeChanged)
Definition: viewsh.cxx:2115
SwDoc * GetDoc() const
Definition: viewsh.hxx:290
void InitPrt(OutputDevice *pOutDev)
Definition: vprint.cxx:177
Definition: view.hxx:146
SwEditWin & GetEditWin()
Definition: view.hxx:416
void InvalidateRulerPos()
Definition: viewport.cxx:107
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
void SetPageStyle(const OUString &rCollName)
Definition: wrtsh1.cxx:1854
const SwView & GetView() const
Definition: wrtsh.hxx:438
reference_type * get() const
AccessibilityIssueCollection & getIssueCollection()
#define FN_NUM_BULLET_OFF
Definition: cmdid.h:96
#define FN_INSERT_OBJ_CTRL
Definition: cmdid.h:265
#define FN_INSERT_CTRL
Definition: cmdid.h:264
#define FN_KEEP_ASPECT_RATIO
Definition: cmdid.h:867
#define FN_PARAM_WRTSHELL
Definition: cmdid.h:808
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
Definition: dialoghelp.cxx:19
DECL_LINK(CheckNameHdl, SvxNameDialog &, bool)
IMPL_LINK_NOARG(ApplyStyle, ApplyHdl, LinkParamNone *, void)
Definition: docst.cxx:580
FrameTypeFlags
values can be combined via logical or
Definition: fesh.hxx:63
OUString aUIName
FieldUnit
constexpr TypedWhichId< SwFormatAnchor > RES_ANCHOR(104)
HTMLMODE_ON
WhichRangesContainer const aFrameFormatSetRange(svl::Items< RES_FRMATR_BEGIN, RES_FRMATR_END-1, RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1, XATTR_FILL_FIRST, XATTR_FILL_LAST >)
OUString aName
sal_Int64 n
uno_Any a
constexpr sal_uInt16 KEY_SHIFT
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
if(aStr !=aBuf) UpdateName_Impl(m_xFollowLb.get()
const char * sName
bool IsPrintLayoutExtension()
sal_Int16 nId
const char GetValue[]
const sal_uInt16 COLL_DOC_BITS
Definition: poolfmt.hxx:69
const sal_uInt16 COLL_REGISTER_BITS
Definition: poolfmt.hxx:68
const sal_uInt16 COLL_TEXT_BITS
Definition: poolfmt.hxx:65
const sal_uInt16 COLL_HTML_BITS
Definition: poolfmt.hxx:70
const sal_uInt16 COLL_LISTS_BITS
Definition: poolfmt.hxx:66
const sal_uInt16 COLL_EXTRA_BITS
Definition: poolfmt.hxx:67
static SfxItemSet & rSet
SwCharFormat * pCharFormat
Definition: view.hxx:113
SwTextFormatColl * pTextColl
Definition: view.hxx:110
SwFrameFormat * pFrameFormat
Definition: view.hxx:112
SfxStyleFamily eType
Definition: view.hxx:117
union SwApplyTemplate::@32 aColl
SwPageDesc * pPageDesc
Definition: view.hxx:111
SwNumRule * pNumRule
Definition: view.hxx:114
SfxStyleFamily
SfxStyleSearchBits
Reference< XModel > xModel
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:164
bool g_bNoInterrupt
Definition: swmodule.cxx:114
#define SW_MOD()
Definition: swmodule.hxx:256
SwUndoId
Definition: swundo.hxx:30
unsigned char sal_uInt8
void SwToSfxPageDescAttr(SfxItemSet &rSet)
Definition: uitool.cxx:716
SW_DLLPUBLIC void ConvertAttrGenToChar(SfxItemSet &rSet, const SfxItemSet &rOrigSet, bool bPara=false)
Convert general attributes to the corresponding character attributes.
Definition: uitool.cxx:144
SW_DLLPUBLIC void ConvertAttrCharToGen(SfxItemSet &rSet, bool bPara=false)
Convert character specific attributes to general ones used by tab pages.
Definition: uitool.cxx:105
SW_DLLPUBLIC FieldUnit GetDfltMetric(bool bWeb)
Definition: uitool.cxx:755
void SfxToSwPageDescAttr(const SwWrtShell &rShell, SfxItemSet &rSet)
Definition: uitool.cxx:655
RET_OK
sal_uInt16 GetHtmlMode(const SwDocShell *pShell)
Definition: viewopt.cxx:352
constexpr TypedWhichId< XFillStyleItem > XATTR_FILLSTYLE(XATTR_FILL_FIRST)
const char * pChar