LibreOffice Module sw (master)  1
swmodul1.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 <sal/config.h>
21 
22 #include <cstddef>
23 #include <memory>
24 #include <boost/property_tree/json_parser.hpp>
25 
26 #include <hintids.hxx>
27 #include <sfx2/request.hxx>
28 #include <sfx2/dispatch.hxx>
29 #include <sfx2/childwin.hxx>
30 #include <unotools/useroptions.hxx>
31 #include <cppuhelper/weak.hxx>
32 #include <com/sun/star/frame/FrameSearchFlag.hpp>
33 #include <com/sun/star/frame/XFrame.hpp>
34 #include <com/sun/star/view/XSelectionSupplier.hpp>
35 #include <svx/colorwindow.hxx>
37 #include <svx/svxids.hrc>
38 #include <editeng/wghtitem.hxx>
39 #include <editeng/postitem.hxx>
40 #include <editeng/udlnitem.hxx>
42 #include <editeng/cmapitem.hxx>
43 #include <editeng/colritem.hxx>
44 #include <editeng/brushitem.hxx>
45 #include <svl/cjkoptions.hxx>
46 #include <swmodule.hxx>
47 #include <swtypes.hxx>
48 #include <usrpref.hxx>
49 #include <modcfg.hxx>
50 #include <view.hxx>
51 #include <pview.hxx>
52 #include <wview.hxx>
53 #include <wrtsh.hxx>
54 #include <docsh.hxx>
55 #include <dbmgr.hxx>
56 #include <uinums.hxx>
57 #include <prtopt.hxx>
58 #include <navicfg.hxx>
59 #include <doc.hxx>
60 #include <cmdid.h>
61 #include <app.hrc>
62 #include <strings.hrc>
64 
65 #include <unomid.h>
66 #include <tools/color.hxx>
67 #include <PostItMgr.hxx>
68 
69 using namespace ::svx;
70 using namespace ::com::sun::star;
71 using namespace ::com::sun::star::uno;
72 using namespace ::com::sun::star::beans;
73 using namespace ::com::sun::star::frame;
74 using namespace ::com::sun::star::view;
75 using namespace ::com::sun::star::lang;
76 
77 static void lcl_SetUIPrefs(const SwViewOption &rPref, SwView* pView, SwViewShell* pSh )
78 {
79  // in FrameSets the actual visibility can differ from the ViewOption's setting
80  bool bVScrollChanged = rPref.IsViewVScrollBar() != pSh->GetViewOptions()->IsViewVScrollBar();
81  bool bHScrollChanged = rPref.IsViewHScrollBar() != pSh->GetViewOptions()->IsViewHScrollBar();
82  bool bVAlignChanged = rPref.IsVRulerRight() != pSh->GetViewOptions()->IsVRulerRight();
83 
84  pSh->SetUIOptions(rPref);
85  const SwViewOption* pNewPref = pSh->GetViewOptions();
86 
87  // Scrollbars on / off
88  if(bVScrollChanged)
89  {
90  pView->EnableVScrollbar(pNewPref->IsViewVScrollBar());
91  }
92  if(bHScrollChanged)
93  {
94  pView->EnableHScrollbar( pNewPref->IsViewHScrollBar() || pNewPref->getBrowseMode() );
95  }
96  //if only the position of the vertical ruler has been changed initiate an update
97  if(bVAlignChanged && !bHScrollChanged && !bVScrollChanged)
98  pView->InvalidateBorder();
99 
100  // Rulers on / off
101  if(pNewPref->IsViewVRuler())
102  pView->CreateVRuler();
103  else
104  pView->KillVRuler();
105 
106  // TabWindow on / off
107  if(pNewPref->IsViewHRuler())
108  pView->CreateTab();
109  else
110  pView->KillTab();
111 
112  pView->GetPostItMgr()->PrepareView(true);
113 }
114 
116 {
117  SwView *pActive = ::GetActiveView();
118  if( pActive )
119  return &pActive->GetWrtShell();
120  return nullptr;
121 }
122 
124 {
126  return dynamic_cast<SwView*>( pView );
127 }
128 
130 {
131  // returns only visible SwView
132  SwView* pView = static_cast<SwView*>(SfxViewShell::GetFirst(true, checkSfxViewShell<SwView>));
133  return pView;
134 }
135 
137 {
138  OSL_ENSURE( pView,"return no SwView" );
139  SwView* pNView = static_cast<SwView*>(SfxViewShell::GetNext(*pView, true, checkSfxViewShell<SwView>));
140  return pNView;
141 }
142 
143 // New Master for the settings is set; this affects the current view and all following.
144 void SwModule::ApplyUsrPref(const SwViewOption &rUsrPref, SwView* pActView,
145  SvViewOpt nDest )
146 {
147  SwView* pCurrView = pActView;
148  SwViewShell* pSh = pCurrView ? &pCurrView->GetWrtShell() : nullptr;
149 
150  SwMasterUsrPref* pPref = const_cast<SwMasterUsrPref*>(GetUsrPref(
151  nDest == SvViewOpt::DestWeb
152  || (nDest != SvViewOpt::DestText
153  && dynamic_cast< const SwWebView *>( pCurrView )) ));
154 
155  // with Uno, only sdbcx::View, but not the Module should be changed
156  bool bViewOnly = SvViewOpt::DestViewOnly == nDest;
157  // fob Preview off
158  SwPagePreview* pPPView;
159  if( !pCurrView && nullptr != (pPPView = dynamic_cast<SwPagePreview*>( SfxViewShell::Current())) )
160  {
161  if(!bViewOnly)
162  pPref->SetUIOptions( rUsrPref );
163  pPPView->EnableVScrollbar(pPref->IsViewVScrollBar());
164  pPPView->EnableHScrollbar(pPref->IsViewHScrollBar());
165  if(!bViewOnly)
166  {
167  pPref->SetPagePrevRow(rUsrPref.GetPagePrevRow());
168  pPref->SetPagePrevCol(rUsrPref.GetPagePrevCol());
169  }
170  return;
171  }
172 
173  if(!bViewOnly)
174  {
175  pPref->SetUsrPref( rUsrPref );
176  pPref->SetModified();
177  }
178 
179  if( !pCurrView )
180  return;
181 
182  // Passing on to CORE
183  bool bReadonly;
184  const SwDocShell* pDocSh = pCurrView->GetDocShell();
185  if (pDocSh)
186  bReadonly = pDocSh->IsReadOnly();
187  else //Use existing option if DocShell missing
188  bReadonly = pSh->GetViewOptions()->IsReadonly();
189  std::unique_ptr<SwViewOption> xViewOpt;
190  if (!bViewOnly)
191  xViewOpt.reset(new SwViewOption(*pPref));
192  else
193  xViewOpt.reset(new SwViewOption(rUsrPref));
194  xViewOpt->SetReadonly( bReadonly );
195  if( !(*pSh->GetViewOptions() == *xViewOpt) )
196  {
197  //is maybe only a SwViewShell
198  pSh->StartAction();
199  pSh->ApplyViewOptions( *xViewOpt );
200  static_cast<SwWrtShell*>(pSh)->SetReadOnlyAvailable(xViewOpt->IsCursorInProtectedArea());
201  pSh->EndAction();
202  }
203  if ( pSh->GetViewOptions()->IsReadonly() != bReadonly )
204  pSh->SetReadonlyOption(bReadonly);
205 
206  lcl_SetUIPrefs(*xViewOpt, pCurrView, pSh);
207 
208  // in the end the Idle-Flag is set again
209  pPref->SetIdle(true);
210 }
211 
212 void SwModule::ApplyUserMetric( FieldUnit eMetric, bool bWeb )
213 {
214  SwMasterUsrPref* pPref;
215  if(bWeb)
216  {
217  if(!m_pWebUsrPref)
218  GetUsrPref(true);
219  pPref = m_pWebUsrPref.get();
220  }
221  else
222  {
223  if(!m_pUsrPref)
224  GetUsrPref(false);
225  pPref = m_pUsrPref.get();
226  }
227  FieldUnit eOldMetric = pPref->GetMetric();
228  if(eOldMetric != eMetric)
229  pPref->SetMetric(eMetric);
230 
231  FieldUnit eHScrollMetric = pPref->IsHScrollMetric() ? pPref->GetHScrollMetric() : eMetric;
232  FieldUnit eVScrollMetric = pPref->IsVScrollMetric() ? pPref->GetVScrollMetric() : eMetric;
233 
234  SwView* pTmpView = SwModule::GetFirstView();
235  // switch the ruler for all MDI-Windows
236  while(pTmpView)
237  {
238  if(bWeb == (dynamic_cast<SwWebView*>( pTmpView) != nullptr) )
239  {
240  pTmpView->ChangeVRulerMetric(eVScrollMetric);
241  pTmpView->ChangeTabMetric(eHScrollMetric);
242  }
243 
244  pTmpView = SwModule::GetNextView(pTmpView);
245  }
246 }
247 
248 void SwModule::ApplyRulerMetric( FieldUnit eMetric, bool bHorizontal, bool bWeb )
249 {
250  SwMasterUsrPref* pPref;
251  if(bWeb)
252  {
253  if(!m_pWebUsrPref)
254  GetUsrPref(true);
255  pPref = m_pWebUsrPref.get();
256  }
257  else
258  {
259  if(!m_pUsrPref)
260  GetUsrPref(false);
261  pPref = m_pUsrPref.get();
262  }
263  if( bHorizontal )
264  pPref->SetHScrollMetric(eMetric);
265  else
266  pPref->SetVScrollMetric(eMetric);
267 
268  SwView* pTmpView = SwModule::GetFirstView();
269  // switch metric at the appropriate rulers
270  while(pTmpView)
271  {
272  if(bWeb == (dynamic_cast<SwWebView *>( pTmpView ) != nullptr))
273  {
274  if( bHorizontal )
275  pTmpView->ChangeTabMetric(eMetric);
276  else
277  pTmpView->ChangeVRulerMetric(eMetric);
278  }
279  pTmpView = SwModule::GetNextView(pTmpView);
280  }
281 }
282 
283 //set the usrpref 's char unit attribute and set rulers unit as char if the "apply char unit" is checked
284 void SwModule::ApplyUserCharUnit(bool bApplyChar, bool bWeb)
285 {
286  SwMasterUsrPref* pPref;
287  if(bWeb)
288  {
289  if(!m_pWebUsrPref)
290  GetUsrPref(true);
291  pPref = m_pWebUsrPref.get();
292  }
293  else
294  {
295  if(!m_pUsrPref)
296  GetUsrPref(false);
297  pPref = m_pUsrPref.get();
298  }
299  bool bOldApplyCharUnit = pPref->IsApplyCharUnit();
300  bool bHasChanged = false;
301  if(bOldApplyCharUnit != bApplyChar)
302  {
303  pPref->SetApplyCharUnit(bApplyChar);
304  bHasChanged = true;
305  }
306 
307  if( !bHasChanged )
308  return;
309 
310  FieldUnit eHScrollMetric = pPref->IsHScrollMetric() ? pPref->GetHScrollMetric() : pPref->GetMetric();
311  FieldUnit eVScrollMetric = pPref->IsVScrollMetric() ? pPref->GetVScrollMetric() : pPref->GetMetric();
312  if(bApplyChar)
313  {
314  eHScrollMetric = FieldUnit::CHAR;
315  eVScrollMetric = FieldUnit::LINE;
316  }
317  else
318  {
319  SvtCJKOptions aCJKOptions;
320  if ( !aCJKOptions.IsAsianTypographyEnabled() && ( eHScrollMetric == FieldUnit::CHAR ))
321  eHScrollMetric = FieldUnit::INCH;
322  else if ( eHScrollMetric == FieldUnit::CHAR )
323  eHScrollMetric = FieldUnit::CM;
324  if ( !aCJKOptions.IsAsianTypographyEnabled() && ( eVScrollMetric == FieldUnit::LINE ))
325  eVScrollMetric = FieldUnit::INCH;
326  else if ( eVScrollMetric == FieldUnit::LINE )
327  eVScrollMetric = FieldUnit::CM;
328  }
329  SwView* pTmpView = SwModule::GetFirstView();
330  // switch rulers for all MDI-Windows
331  while(pTmpView)
332  {
333  if(bWeb == (dynamic_cast<SwWebView*>( pTmpView) != nullptr) )
334  {
335  pTmpView->ChangeVRulerMetric(eVScrollMetric);
336  pTmpView->ChangeTabMetric(eHScrollMetric);
337  }
338 
339  pTmpView = SwModule::GetNextView(pTmpView);
340  }
341 }
342 
344 {
346  {
348  }
349  return m_pNavigationConfig.get();
350 }
351 
353 {
354  if(bWeb && !m_pWebPrintOptions)
355  {
356  m_pWebPrintOptions.reset(new SwPrintOptions(true));
357  }
358  else if(!bWeb && !m_pPrintOptions)
359  {
360  m_pPrintOptions.reset(new SwPrintOptions(false));
361  }
362 
363  return bWeb ? m_pWebPrintOptions.get() : m_pPrintOptions.get();
364 }
365 
367 {
368  if(!m_pChapterNumRules)
370  return m_pChapterNumRules.get();
371 }
372 
373 void SwModule::ShowDBObj(SwView const & rView, const SwDBData& rData)
374 {
375  Reference<XFrame> xFrame = rView.GetViewFrame()->GetFrame().GetFrameInterface();
376 
377  uno::Reference<XFrame> xBeamerFrame = xFrame->findFrame("_beamer", FrameSearchFlag::CHILDREN);
378  if (xBeamerFrame.is())
379  { // the beamer has been opened by the SfxViewFrame
380  Reference<XController> xController = xBeamerFrame->getController();
381  Reference<XSelectionSupplier> xControllerSelection(xController, UNO_QUERY);
382  if (xControllerSelection.is())
383  {
384 
385  ODataAccessDescriptor aSelection;
386  aSelection.setDataSource(rData.sDataSource);
387  aSelection[DataAccessDescriptorProperty::Command] <<= rData.sCommand;
388  aSelection[DataAccessDescriptorProperty::CommandType] <<= rData.nCommandType;
389  xControllerSelection->select(makeAny(aSelection.createPropertyValueSequence()));
390  }
391  else {
392  OSL_FAIL("no selection supplier in the beamer!");
393  }
394  }
395 }
396 
398 {
400  {
401  const SvtUserOptions& rOpt = GetUserOptions();
402  m_sActAuthor = rOpt.GetFullName();
403  if (m_sActAuthor.isEmpty())
404  {
405  m_sActAuthor = rOpt.GetID();
406  if (m_sActAuthor.isEmpty())
407  m_sActAuthor = SwResId( STR_REDLINE_UNKNOWN_AUTHOR );
408  }
409  m_bAuthorInitialised = true;
410  }
412 }
413 
414 void SwModule::SetRedlineAuthor(const OUString &rAuthor)
415 {
416  m_bAuthorInitialised = true;
417  m_sActAuthor = rAuthor;
419 }
420 
421 OUString const & SwModule::GetRedlineAuthor(std::size_t nPos)
422 {
423  OSL_ENSURE(nPos < m_pAuthorNames.size(), "author not found!"); //#i45342# RTF doc with no author table caused reader to crash
424  while(nPos >= m_pAuthorNames.size())
425  {
426  InsertRedlineAuthor("nn");
427  }
428  return m_pAuthorNames[nPos];
429 }
430 
431 static Color lcl_GetAuthorColor(std::size_t nPos)
432 {
433  static const Color aColArr[] =
434  {
438  };
439 
440  return aColArr[nPos % SAL_N_ELEMENTS(aColArr)];
441 }
442 
444 static boost::property_tree::ptree lcl_AuthorToJson(const OUString& rAuthor, std::size_t nIndex)
445 {
446  boost::property_tree::ptree aRet;
447  aRet.put("index", nIndex);
448  aRet.put("name", rAuthor.toUtf8().getStr());
449  aRet.put("color", sal_uInt32(lcl_GetAuthorColor(nIndex)));
450  return aRet;
451 }
452 
454 {
455  boost::property_tree::ptree aTable;
456  for (std::size_t nAuthor = 0; nAuthor < m_pAuthorNames.size(); ++nAuthor)
457  {
458  boost::property_tree::ptree aAuthor = lcl_AuthorToJson(m_pAuthorNames[nAuthor], nAuthor);
459  aTable.push_back(std::make_pair("", aAuthor));
460  }
461 
462  boost::property_tree::ptree aTree;
463  aTree.add_child("authors", aTable);
464  std::stringstream aStream;
465  boost::property_tree::write_json(aStream, aTree);
466  return OUString::fromUtf8(aStream.str().c_str());
467 }
468 
469 std::size_t SwModule::InsertRedlineAuthor(const OUString& rAuthor)
470 {
471  std::size_t nPos = 0;
472 
473  while(nPos < m_pAuthorNames.size() && m_pAuthorNames[nPos] != rAuthor)
474  ++nPos;
475 
476  if (nPos == m_pAuthorNames.size())
477  m_pAuthorNames.push_back(rAuthor);
478 
479  return nPos;
480 }
481 
482 static void lcl_FillAuthorAttr( std::size_t nAuthor, SfxItemSet &rSet,
483  const AuthorCharAttr &rAttr )
484 {
485  Color aCol( rAttr.m_nColor );
486 
487  if( rAttr.m_nColor == COL_TRANSPARENT )
488  aCol = lcl_GetAuthorColor(nAuthor);
489 
490  bool bBackGr = rAttr.m_nColor == COL_NONE_COLOR;
491 
492  switch (rAttr.m_nItemId)
493  {
494  case SID_ATTR_CHAR_WEIGHT:
495  {
496  SvxWeightItem aW( static_cast<FontWeight>(rAttr.m_nAttr), RES_CHRATR_WEIGHT );
497  rSet.Put( aW );
498  aW.SetWhich( RES_CHRATR_CJK_WEIGHT );
499  rSet.Put( aW );
500  aW.SetWhich( RES_CHRATR_CTL_WEIGHT );
501  rSet.Put( aW );
502  }
503  break;
504 
505  case SID_ATTR_CHAR_POSTURE:
506  {
507  SvxPostureItem aP( static_cast<FontItalic>(rAttr.m_nAttr), RES_CHRATR_POSTURE );
508  rSet.Put( aP );
509  aP.SetWhich( RES_CHRATR_CJK_POSTURE );
510  rSet.Put( aP );
511  aP.SetWhich( RES_CHRATR_CTL_POSTURE );
512  rSet.Put( aP );
513  }
514  break;
515 
516  case SID_ATTR_CHAR_UNDERLINE:
517  rSet.Put( SvxUnderlineItem( static_cast<FontLineStyle>(rAttr.m_nAttr),
519  break;
520 
521  case SID_ATTR_CHAR_STRIKEOUT:
522  rSet.Put(SvxCrossedOutItem( static_cast<FontStrikeout>(rAttr.m_nAttr),
524  break;
525 
526  case SID_ATTR_CHAR_CASEMAP:
527  rSet.Put( SvxCaseMapItem( static_cast<SvxCaseMap>(rAttr.m_nAttr),
529  break;
530 
531  case SID_ATTR_BRUSH:
532  rSet.Put( SvxBrushItem( aCol, RES_CHRATR_BACKGROUND ));
533  bBackGr = true;
534  break;
535  }
536 
537  if( !bBackGr )
538  rSet.Put( SvxColorItem( aCol, RES_CHRATR_COLOR ) );
539 }
540 
541 void SwModule::GetInsertAuthorAttr(std::size_t nAuthor, SfxItemSet &rSet)
542 {
543  lcl_FillAuthorAttr(nAuthor, rSet, m_pModuleConfig->GetInsertAuthorAttr());
544 }
545 
546 void SwModule::GetDeletedAuthorAttr(std::size_t nAuthor, SfxItemSet &rSet)
547 {
548  lcl_FillAuthorAttr(nAuthor, rSet, m_pModuleConfig->GetDeletedAuthorAttr());
549 }
550 
551 // For future extension:
552 void SwModule::GetFormatAuthorAttr( std::size_t nAuthor, SfxItemSet &rSet )
553 {
554  lcl_FillAuthorAttr( nAuthor, rSet, m_pModuleConfig->GetFormatAuthorAttr() );
555 }
556 
557 sal_uInt16 SwModule::GetRedlineMarkPos() const
558 {
559  return m_pModuleConfig->GetMarkAlignMode();
560 }
561 
562 bool SwModule::IsInsTableFormatNum(bool bHTML) const
563 {
564  return m_pModuleConfig->IsInsTableFormatNum(bHTML);
565 }
566 
568 {
569  return m_pModuleConfig->IsInsTableChangeNumFormat(bHTML);
570 }
571 
572 bool SwModule::IsInsTableAlignNum(bool bHTML) const
573 {
574  return m_pModuleConfig->IsInsTableAlignNum(bHTML);
575 }
576 
578 {
579  return m_pModuleConfig->IsSplitVerticalByDefault(bHTML);
580 }
581 
582 void SwModule::SetSplitVerticalByDefault(bool bHTML, bool value)
583 {
584  m_pModuleConfig->SetSplitVerticalByDefault(bHTML, value);
585 }
586 
588 {
589  return m_pModuleConfig->GetMarkAlignColor();
590 }
591 
593 {
594  return GetUsrPref( bWeb );
595 }
596 
597 OUString const & SwModule::GetDocStatWordDelim() const
598 {
599  return m_pModuleConfig->GetWordDelimiter();
600 }
601 
602 // Passing-through of the ModuleConfig's Metric (for HTML-Export)
603 FieldUnit SwModule::GetMetric( bool bWeb ) const
604 {
605  SwMasterUsrPref* pPref;
606  if(bWeb)
607  {
608  if(!m_pWebUsrPref)
609  GetUsrPref(true);
610  pPref = m_pWebUsrPref.get();
611  }
612  else
613  {
614  if(!m_pUsrPref)
615  GetUsrPref(false);
616  pPref = m_pUsrPref.get();
617  }
618  return pPref->GetMetric();
619 }
620 
621 // Pass-through Update-Status
622 sal_uInt16 SwModule::GetLinkUpdMode() const
623 {
624  if(!m_pUsrPref)
625  GetUsrPref(false);
626  return static_cast<sal_uInt16>(m_pUsrPref->GetUpdateLinkMode());
627 }
628 
630 {
631  if(!m_pUsrPref)
632  GetUsrPref(false);
633  return m_pUsrPref->GetFieldUpdateFlags();
634 }
635 
637 {
638  if(!m_pUsrPref)
639  GetUsrPref(false);
640  m_pUsrPref->SetFieldUpdateFlags(eFieldFlags);
641 }
642 
643 void SwModule::ApplyLinkMode(sal_Int32 nNewLinkMode)
644 {
645  if(!m_pUsrPref)
646  GetUsrPref(false);
647  m_pUsrPref->SetUpdateLinkMode(nNewLinkMode);
648 }
649 
650 void SwModule::CheckSpellChanges( bool bOnlineSpelling,
651  bool bIsSpellWrongAgain, bool bIsSpellAllAgain, bool bSmartTags )
652 {
653  bool bOnlyWrong = bIsSpellWrongAgain && !bIsSpellAllAgain;
654  bool bInvalid = bOnlyWrong || bIsSpellAllAgain;
655  if( bOnlineSpelling || bInvalid )
656  {
657  for( SwDocShell *pDocSh = static_cast<SwDocShell*>(SfxObjectShell::GetFirst(checkSfxObjectShell<SwDocShell>));
658  pDocSh;
659  pDocSh = static_cast<SwDocShell*>(SfxObjectShell::GetNext( *pDocSh, checkSfxObjectShell<SwDocShell> ) ) )
660  {
661  SwDoc* pTmp = pDocSh->GetDoc();
663  {
664  pTmp->SpellItAgainSam( bInvalid, bOnlyWrong, bSmartTags );
666  if ( bSmartTags && pViewShell && pViewShell->GetWin() )
667  pViewShell->GetWin()->Invalidate();
668  }
669  }
670  }
671 }
672 
673 void SwModule::ApplyDefaultPageMode(bool bIsSquaredPageMode)
674 {
675  if(!m_pUsrPref)
676  GetUsrPref(false);
677  m_pUsrPref->SetDefaultPageMode(bIsSquaredPageMode);
678 }
679 
681 {
682  return m_pModuleConfig->GetCompareMode();
683 }
684 
686 {
687  return m_pModuleConfig->IsUseRsid();
688 }
689 
691 {
692  return m_pModuleConfig->IsIgnorePieces();
693 }
694 
695 sal_uInt16 SwModule::GetPieceLen() const
696 {
697  return m_pModuleConfig->GetPieceLen();
698 }
699 
700 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SfxViewFrame * GetViewFrame() const
void ApplyUserCharUnit(bool bApplyChar, bool bWeb)
Definition: swmodul1.cxx:284
static void ShowDBObj(SwView const &rView, const SwDBData &rData)
Definition: swmodul1.cxx:373
#define RES_CHRATR_WEIGHT
Definition: hintids.hxx:84
FieldUnit
sal_Int32 nCommandType
Definition: swdbdata.hxx:32
virtual void ApplyViewOptions(const SwViewOption &rOpt)
Definition: viewsh.cxx:2117
void SetUsrPref(const SwViewOption &rCopy)
Definition: usrpref.cxx:44
FieldUnit GetVScrollMetric() const
Definition: usrpref.hxx:225
SwFieldUpdateFlags
Definition: fldupde.hxx:22
SwView * GetActiveView()
Definition: swmodul1.cxx:123
SwNavigationConfig * GetNavigationConfig()
Definition: swmodul1.cxx:343
void ChangeTabMetric(FieldUnit eUnit)
Definition: viewmdi.cxx:579
#define RES_CHRATR_CJK_POSTURE
Definition: hintids.hxx:94
View of a document.
Definition: pview.hxx:161
SwPrintOptions * GetPrtOptions(bool bWeb)
Definition: swmodul1.cxx:352
OUString sDataSource
Definition: swdbdata.hxx:30
Reference< XFrame > xFrame
SwChapterNumRules * GetChapterNumRules()
Definition: swmodul1.cxx:366
void SetHScrollMetric(FieldUnit eSet)
Definition: usrpref.hxx:218
SwWrtShell * GetActiveWrtShell()
Definition: swmodul1.cxx:115
Definition: doc.hxx:185
bool IsApplyCharUnit() const
Definition: usrpref.hxx:232
constexpr::Color COL_AUTHOR4_DARK(105, 43, 157)
#define RES_CHRATR_CJK_WEIGHT
Definition: hintids.hxx:95
void SetSplitVerticalByDefault(bool bHTML, bool value)
Definition: swmodul1.cxx:582
bool IsSplitVerticalByDefault(bool bHTML) const
Definition: swmodul1.cxx:577
std::unique_ptr< SwMasterUsrPref, o3tl::default_delete< SwMasterUsrPref > > m_pWebUsrPref
Definition: swmodule.hxx:82
bool IsIgnorePieces() const
Definition: swmodul1.cxx:690
void SetVScrollMetric(FieldUnit eSet)
Definition: usrpref.hxx:226
const SwMasterUsrPref * GetUsrPref(bool bWeb) const
Definition: apphdl.cxx:1048
std::unique_ptr< SwChapterNumRules > m_pChapterNumRules
Definition: swmodule.hxx:85
std::size_t GetRedlineAuthor()
Definition: swmodul1.cxx:397
void ApplyRulerMetric(FieldUnit eMetric, bool bHorizontal, bool bWeb)
Definition: swmodul1.cxx:248
void GetInsertAuthorAttr(std::size_t nAuthor, SfxItemSet &rSet)
Definition: swmodul1.cxx:541
sal_uInt16 m_nAttr
Definition: authratr.hxx:30
virtual void SetReadonlyOption(bool bSet)
Definition: viewsh.cxx:2307
void ApplyDefaultPageMode(bool bIsSquaredPageMode)
Definition: swmodul1.cxx:673
FieldUnit GetHScrollMetric() const
Definition: usrpref.hxx:217
SwWrtShell & GetWrtShell() const
Definition: view.hxx:400
void SetPagePrevRow(sal_uInt8 n)
Definition: viewopt.hxx:421
static void lcl_SetUIPrefs(const SwViewOption &rPref, SwView *pView, SwViewShell *pSh)
Definition: swmodul1.cxx:77
Used by the UI to modify the document model.
Definition: wrtsh.hxx:90
static void CheckSpellChanges(bool bOnlineSpelling, bool bIsSpellWrongAgain, bool bIsSpellAllAgain, bool bSmartTags)
Definition: swmodul1.cxx:650
constexpr::Color COL_TRANSPARENT(0xFF, 0xFF, 0xFF, 0xFF)
bool IsReadonly() const
Definition: viewopt.hxx:424
Reference< XController > xController
void InvalidateBorder()
const SwViewOption * GetViewOption(bool bWeb)
Definition: swmodul1.cxx:592
void ApplyLinkMode(sal_Int32 nNewLinkMode)
Definition: swmodul1.cxx:643
bool getBrowseMode() const
Definition: viewopt.hxx:433
void GetFormatAuthorAttr(std::size_t nAuthor, SfxItemSet &rSet)
Definition: swmodul1.cxx:552
std::unique_ptr< SwPrintOptions > m_pWebPrintOptions
Definition: swmodule.hxx:84
SfxFrame & GetFrame() const
static SfxViewShell * GetNext(const SfxViewShell &rPrev, bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
static SfxViewShell * Current()
constexpr::Color COL_AUTHOR6_DARK(0, 128, 128)
void SetUIOptions(const SwViewOption &rOpt)
Definition: viewsh.cxx:2296
constexpr::Color COL_AUTHOR8_DARK(53, 85, 107)
bool IsViewVScrollBar() const
Definition: viewopt.hxx:480
constexpr::Color COL_AUTHOR2_DARK(6, 70, 162)
#define RES_CHRATR_CASEMAP
Definition: hintids.hxx:70
void EnableHScrollbar(bool bEnable)
Definition: pview.cxx:1848
std::vector< OUString > m_pAuthorNames
Definition: swmodule.hxx:106
bool IsViewHRuler(bool bDirect=false) const
Definition: viewopt.hxx:553
void CreateVRuler()
Definition: viewmdi.cxx:607
bool m_bAuthorInitialised
Definition: swmodule.hxx:113
void PrepareView(bool bIgnoreCount=false)
Definition: PostItMgr.cxx:1879
void KillVRuler()
Definition: viewmdi.cxx:616
bool IsInsTableAlignNum(bool bHTML) const
Definition: swmodul1.cxx:572
SwCompareMode
Definition: modcfg.hxx:87
#define SAL_N_ELEMENTS(arr)
#define RES_CHRATR_COLOR
Definition: hintids.hxx:72
const Color & GetRedlineMarkColor() const
Definition: swmodul1.cxx:587
#define COL_NONE_COLOR
void SetPagePrevCol(sal_uInt8 n)
Definition: viewopt.hxx:423
#define RES_CHRATR_BACKGROUND
Definition: hintids.hxx:90
std::size_t InsertRedlineAuthor(const OUString &rAuthor)
Definition: swmodul1.cxx:469
sal_uInt16 GetLinkUpdMode() const
Definition: swmodul1.cxx:622
constexpr::Color COL_AUTHOR9_DARK(209, 118, 0)
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
void GetDeletedAuthorAttr(std::size_t nAuthor, SfxItemSet &rSet)
Definition: swmodul1.cxx:546
void StartAction()
Definition: viewsh.hxx:592
bool IsViewVRuler(bool bDirect=false) const
Definition: viewopt.hxx:567
SwFieldUpdateFlags GetFieldUpdateFlags() const
Definition: swmodul1.cxx:629
SvViewOpt
Definition: swmodule.hxx:61
static SwView * GetFirstView()
Definition: swmodul1.cxx:129
#define RES_CHRATR_UNDERLINE
Definition: hintids.hxx:83
bool IsInsTableFormatNum(bool bHTML) const
Definition: swmodul1.cxx:562
SvtUserOptions & GetUserOptions()
Definition: apphdl.cxx:1038
sal_uInt16 m_nItemId
Definition: authratr.hxx:29
OUString SwResId(const char *pId)
Definition: swmodule.cxx:190
OUString GetID() const
OUString m_sActAuthor
Definition: swmodule.hxx:77
void EnableHScrollbar(bool bEnable)
Definition: viewmdi.cxx:691
static SfxViewShell * GetFirst(bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
void CreateTab()
Definition: viewmdi.cxx:565
void SetApplyCharUnit(bool bSet, bool noModify=false)
Definition: usrpref.hxx:236
void SpellItAgainSam(bool bInvalid, bool bOnlyWrong, bool bSmartTags)
Re-trigger spelling in the idle handler.
Definition: doc.cxx:1181
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:404
SwDocShell * GetDocShell()
Definition: view.cxx:1128
const css::uno::Reference< css::frame::XFrame > & GetFrameInterface() const
bool IsReadOnly() const
Color m_nColor
Definition: authratr.hxx:31
sal_uInt8 GetPagePrevRow() const
Definition: viewopt.hxx:420
void EndAction(const bool bIdleEnd=false)
Definition: viewsh.hxx:597
constexpr::Color COL_AUTHOR1_DARK(198, 146, 0)
std::unique_ptr< SwModuleOptions, o3tl::default_delete< SwModuleOptions > > m_pModuleConfig
Definition: swmodule.hxx:80
bool IsUseRsid() const
Definition: swmodul1.cxx:685
void EnableVScrollbar(bool bEnable)
Definition: viewmdi.cxx:700
bool IsVRulerRight() const
Definition: viewopt.hxx:588
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
bool IsAsianTypographyEnabled() const
FieldUnit GetMetric() const
Definition: usrpref.hxx:208
void ApplyUserMetric(FieldUnit eMetric, bool bWeb)
Definition: swmodul1.cxx:212
void SetRedlineAuthor(const OUString &rAuthor)
Definition: swmodul1.cxx:414
bool IsVScrollMetric() const
Definition: usrpref.hxx:224
static SfxObjectShell * GetFirst(const std::function< bool(const SfxObjectShell *)> &isObjectShell=nullptr, bool bOnlyVisible=true)
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
#define RES_CHRATR_POSTURE
Definition: hintids.hxx:80
#define RES_CHRATR_CTL_WEIGHT
Definition: hintids.hxx:100
#define RES_CHRATR_CTL_POSTURE
Definition: hintids.hxx:99
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:426
vcl::Window * GetWin() const
Definition: viewsh.hxx:340
constexpr::Color COL_AUTHOR5_DARK(197, 0, 11)
bool IsInsTableChangeNumFormat(bool bHTML) const
Definition: swmodul1.cxx:567
void SetIdle(bool b) const
Definition: viewopt.hxx:209
static boost::property_tree::ptree lcl_AuthorToJson(const OUString &rAuthor, std::size_t nIndex)
Returns a JSON representation of a redline author.
Definition: swmodul1.cxx:444
bool IsHScrollMetric() const
Definition: usrpref.hxx:216
std::unique_ptr< SwMasterUsrPref, o3tl::default_delete< SwMasterUsrPref > > m_pUsrPref
Definition: swmodule.hxx:81
sal_uInt16 GetPieceLen() const
Definition: swmodul1.cxx:695
void ChangeVRulerMetric(FieldUnit eUnit)
Definition: viewmdi.cxx:588
SwPostItMgr * GetPostItMgr()
Definition: view.hxx:622
constexpr::Color COL_AUTHOR7_DARK(140, 132, 0)
std::unique_ptr< SwPrintOptions > m_pPrintOptions
Definition: swmodule.hxx:83
SwCompareMode GetCompareMode() const
Definition: swmodul1.cxx:680
std::unique_ptr< SwNavigationConfig > m_pNavigationConfig
Definition: swmodule.hxx:87
static SwView * GetNextView(SwView const *)
Definition: swmodul1.cxx:136
OUString GetFullName() const
#define RES_CHRATR_CROSSEDOUT
Definition: hintids.hxx:74
static SfxObjectShell * GetNext(const SfxObjectShell &rPrev, const std::function< bool(const SfxObjectShell *)> &isObjectShell=nullptr, bool bOnlyVisible=true)
FieldUnit GetMetric(bool bWeb) const
Definition: swmodul1.cxx:603
void ApplyFieldUpdateFlags(SwFieldUpdateFlags eFieldFlags)
Definition: swmodul1.cxx:636
void SetModified()
Definition: usrpref.hxx:157
void KillTab()
Definition: viewmdi.cxx:573
sal_uInt16 GetRedlineMarkPos() const
Definition: swmodul1.cxx:557
OUString GetRedlineAuthorInfo()
See SwXTextDocument::getTrackedChangeAuthors().
Definition: swmodul1.cxx:453
constexpr::Color COL_AUTHOR3_DARK(87, 157, 28)
static Color lcl_GetAuthorColor(std::size_t nPos)
Definition: swmodul1.cxx:431
sal_Int32 nPos
bool IsViewHScrollBar() const
Definition: viewopt.hxx:488
OUString const & GetDocStatWordDelim() const
Definition: swmodul1.cxx:597
void SetUIOptions(const SwViewOption &)
Definition: viewopt.hxx:648
OUString sCommand
Definition: swdbdata.hxx:31
sal_uInt8 GetPagePrevCol() const
Definition: viewopt.hxx:422
static void lcl_FillAuthorAttr(std::size_t nAuthor, SfxItemSet &rSet, const AuthorCharAttr &rAttr)
Definition: swmodul1.cxx:482
Definition: view.hxx:146
void SetMetric(FieldUnit eSet, bool bNoModify=false)
Definition: usrpref.hxx:209
void EnableVScrollbar(bool bEnable)
Definition: pview.cxx:1857
void ApplyUsrPref(const SwViewOption &, SwView *, SvViewOpt nDest=SvViewOpt::DestView)
Definition: swmodul1.cxx:144
css::uno::Any SAL_CALL makeAny(const SharedUNOComponent< INTERFACE, COMPONENT > &value)