LibreOffice Module sw (master)  1
unomod.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 <com/sun/star/beans/PropertyAttribute.hpp>
21 #include <com/sun/star/view/DocumentZoomType.hpp>
24 #include <o3tl/any.hxx>
25 #include <osl/diagnose.h>
26 #include <rtl/ustrbuf.hxx>
27 #include <svl/itemprop.hxx>
28 #include <tools/urlobj.hxx>
29 #include <tools/UnitConversion.hxx>
30 #include <vcl/svapp.hxx>
31 
32 #include <unomod.hxx>
33 #include <usrpref.hxx>
34 #include <prtopt.hxx>
35 #include <swmodule.hxx>
36 #include <view.hxx>
37 #include <docsh.hxx>
38 #include <wrtsh.hxx>
39 #include <viewopt.hxx>
40 #include <doc.hxx>
42 #include <edtwin.hxx>
43 using namespace ::com::sun::star;
44 using namespace ::com::sun::star::uno;
45 using namespace ::com::sun::star::beans;
46 using namespace ::com::sun::star::lang;
47 using namespace ::comphelper;
48 
49 namespace {
50 
52 {
53  HANDLE_VIEWSET_ANNOTATIONS,
54  HANDLE_VIEWSET_BREAKS,
55  HANDLE_VIEWSET_DRAWINGS,
56  HANDLE_VIEWSET_FIELD_COMMANDS,
57  HANDLE_VIEWSET_FOOTNOTE_BACKGROUND,
58  HANDLE_VIEWSET_GRAPHICS,
59  HANDLE_VIEWSET_HIDDEN_CHARACTERS,
60  HANDLE_VIEWSET_HIDDEN_PARAGRAPHS,
61  HANDLE_VIEWSET_HIDDEN_TEXT,
62  HANDLE_VIEWSET_HRULER,
63  HANDLE_VIEWSET_HSCROLL,
64  HANDLE_VIEWSET_INDEX_MARK_BACKGROUND,
65  HANDLE_VIEWSET_NONPRINTING_CHARACTERS,
66  HANDLE_VIEWSET_ONLINE_LAYOUT,
67  HANDLE_VIEWSET_PARA_BREAKS,
68  HANDLE_VIEWSET_PROTECTED_SPACES,
69  HANDLE_VIEWSET_SOFT_HYPHENS,
70  HANDLE_VIEWSET_SPACES,
71  HANDLE_VIEWSET_TABLE_BOUNDARIES,
72  HANDLE_VIEWSET_TABLES,
73  HANDLE_VIEWSET_TABSTOPS,
74  HANDLE_VIEWSET_TEXT_BOUNDARIES,
75  HANDLE_VIEWSET_TEXT_FIELD_BACKGROUND,
76  HANDLE_VIEWSET_VRULER,
77  HANDLE_VIEWSET_VSCROLL,
78  HANDLE_VIEWSET_SMOOTH_SCROLLING,
79  HANDLE_VIEWSET_ZOOM_TYPE,
80  HANDLE_VIEWSET_ZOOM,
81  HANDLE_VIEWSET_SHOW_CONTENT_TIPS,
82  HANDLE_VIEWSET_HELP_URL,
83  HANDLE_VIEWSET_VRULER_RIGHT,
84  HANDLE_VIEWSET_SHOW_RULER,
85  HANDLE_VIEWSET_IS_RASTER_VISIBLE,
86  HANDLE_VIEWSET_IS_SNAP_TO_RASTER,
87  HANDLE_VIEWSET_RASTER_RESOLUTION_X,
88  HANDLE_VIEWSET_RASTER_RESOLUTION_Y,
89  HANDLE_VIEWSET_RASTER_SUBDIVISION_X,
90  HANDLE_VIEWSET_RASTER_SUBDIVISION_Y,
91  HANDLE_VIEWSET_HORI_RULER_METRIC,
92  HANDLE_VIEWSET_VERT_RULER_METRIC,
93  HANDLE_VIEWSET_SCROLLBAR_TIPS,
94  HANDLE_VIEWSET_INLINECHANGES_TIPS,
95  HANDLE_VIEWSET_HIDE_WHITESPACE,
96  HANDLE_VIEWSET_USE_HEADERFOOTERMENU,
97  HANDLE_VIEWSET_BOOKMARKS,
98  HANDLE_VIEWSET_SHOW_OUTLINECONTENTVISIBILITYBUTTON,
99  HANDLE_VIEWSET_TREAT_SUB_OUTLINE_LEVELS_AS_CONTENT,
100  HANDLE_VIEWSET_CHANGES_IN_MARGIN
101 };
102 
104 {
105  HANDLE_PRINTSET_ANNOTATION_MODE,
106  HANDLE_PRINTSET_BLACK_FONTS,
107  HANDLE_PRINTSET_CONTROLS,
108  HANDLE_PRINTSET_DRAWINGS,
109  HANDLE_PRINTSET_GRAPHICS,
110  HANDLE_PRINTSET_LEFT_PAGES,
111  HANDLE_PRINTSET_PAGE_BACKGROUND,
112  HANDLE_PRINTSET_PROSPECT,
113  HANDLE_PRINTSET_REVERSED,
114  HANDLE_PRINTSET_RIGHT_PAGES,
115  HANDLE_PRINTSET_FAX_NAME,
116  HANDLE_PRINTSET_PAPER_FROM_SETUP,
117  HANDLE_PRINTSET_TABLES,
118  HANDLE_PRINTSET_SINGLE_JOBS,
119  HANDLE_PRINTSET_EMPTY_PAGES,
120  HANDLE_PRINTSET_PROSPECT_RTL,
121  HANDLE_PRINTSET_PLACEHOLDER,
122  HANDLE_PRINTSET_HIDDEN_TEXT
123 };
124 
125 }
126 
128 {
129  static PropertyInfo const aViewSettingsMap_Impl[] =
130  {
131  { OUString( "HelpURL" ), HANDLE_VIEWSET_HELP_URL , cppu::UnoType<OUString>::get(), PROPERTY_NONE},
132  { OUString( "HorizontalRulerMetric"),HANDLE_VIEWSET_HORI_RULER_METRIC , cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE},
133  { OUString( "IsRasterVisible"), HANDLE_VIEWSET_IS_RASTER_VISIBLE, cppu::UnoType<bool>::get(), PROPERTY_NONE},
134  { OUString( "IsSnapToRaster"), HANDLE_VIEWSET_IS_SNAP_TO_RASTER, cppu::UnoType<bool>::get(), PROPERTY_NONE},
135  { OUString( "IsVertRulerRightAligned"),HANDLE_VIEWSET_VRULER_RIGHT , cppu::UnoType<bool>::get(), PROPERTY_NONE},
136  { OUString( "ShowContentTips" ), HANDLE_VIEWSET_SHOW_CONTENT_TIPS , cppu::UnoType<bool>::get(), PROPERTY_NONE},
137  { OUString( "ShowInlineTooltips" ), HANDLE_VIEWSET_INLINECHANGES_TIPS , cppu::UnoType<bool>::get(), PROPERTY_NONE},
138  { OUString( "UseHeaderFooterMenu" ), HANDLE_VIEWSET_USE_HEADERFOOTERMENU , cppu::UnoType<bool>::get(), PROPERTY_NONE},
139  { OUString( "ShowOutlineContentVisibilityButton" ), HANDLE_VIEWSET_SHOW_OUTLINECONTENTVISIBILITYBUTTON , cppu::UnoType<bool>::get(), PROPERTY_NONE},
140  { OUString( "TreatSubOutlineLevelsAsContent" ), HANDLE_VIEWSET_TREAT_SUB_OUTLINE_LEVELS_AS_CONTENT , cppu::UnoType<bool>::get(), PROPERTY_NONE},
141  { OUString( "ShowChangesInMargin" ), HANDLE_VIEWSET_CHANGES_IN_MARGIN, cppu::UnoType<bool>::get(), PROPERTY_NONE},
142  { OUString( "RasterResolutionX"), HANDLE_VIEWSET_RASTER_RESOLUTION_X, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE},
143  { OUString( "RasterResolutionY"), HANDLE_VIEWSET_RASTER_RESOLUTION_Y, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE},
144  { OUString( "RasterSubdivisionX"), HANDLE_VIEWSET_RASTER_SUBDIVISION_X, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE},
145  { OUString( "RasterSubdivisionY"), HANDLE_VIEWSET_RASTER_SUBDIVISION_Y, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE},
146  { OUString( "ShowAnnotations" ), HANDLE_VIEWSET_ANNOTATIONS , cppu::UnoType<bool>::get(), PROPERTY_NONE},
147  { OUString( "ShowBookmarks" ), HANDLE_VIEWSET_BOOKMARKS, cppu::UnoType<bool>::get(), PROPERTY_NONE },
148  { OUString( "ShowBreaks"), HANDLE_VIEWSET_BREAKS , cppu::UnoType<bool>::get(), PROPERTY_NONE},
149  { OUString( "ShowDrawings"), HANDLE_VIEWSET_DRAWINGS , cppu::UnoType<bool>::get(), PROPERTY_NONE},
150  { OUString( "ShowFieldCommands"), HANDLE_VIEWSET_FIELD_COMMANDS , cppu::UnoType<bool>::get(), PROPERTY_NONE},
151  { OUString( "ShowFootnoteBackground"),HANDLE_VIEWSET_FOOTNOTE_BACKGROUND , cppu::UnoType<bool>::get(), PROPERTY_NONE},
152  { OUString( "ShowGraphics"), HANDLE_VIEWSET_GRAPHICS , cppu::UnoType<bool>::get(), PROPERTY_NONE},
153  { OUString( "ShowHiddenCharacters"), HANDLE_VIEWSET_HIDDEN_CHARACTERS , cppu::UnoType<bool>::get(), PROPERTY_NONE},
154  { OUString( "HideWhitespace"), HANDLE_VIEWSET_HIDE_WHITESPACE , cppu::UnoType<bool>::get(), PROPERTY_NONE},
155  { OUString( "ShowHiddenParagraphs"), HANDLE_VIEWSET_HIDDEN_PARAGRAPHS , cppu::UnoType<bool>::get(), PROPERTY_NONE},
156  { OUString( "ShowHiddenText"), HANDLE_VIEWSET_HIDDEN_TEXT , cppu::UnoType<bool>::get(), PROPERTY_NONE},
157  { OUString( "ShowHoriRuler"), HANDLE_VIEWSET_HRULER , cppu::UnoType<bool>::get(), PROPERTY_NONE},
158  { OUString( "ShowHoriScrollBar"), HANDLE_VIEWSET_HSCROLL , cppu::UnoType<bool>::get(), PROPERTY_NONE},
159  { OUString( "ShowIndexMarkBackground"),HANDLE_VIEWSET_INDEX_MARK_BACKGROUND, cppu::UnoType<bool>::get(),PROPERTY_NONE},
160  { OUString( "ShowNonprintingCharacters"),HANDLE_VIEWSET_NONPRINTING_CHARACTERS, cppu::UnoType<bool>::get(),PROPERTY_NONE},
161  { OUString( "ShowOnlineLayout"), HANDLE_VIEWSET_ONLINE_LAYOUT , cppu::UnoType<bool>::get(), PropertyAttribute::MAYBEVOID},
162  { OUString( "ShowParaBreaks"), HANDLE_VIEWSET_PARA_BREAKS , cppu::UnoType<bool>::get(), PROPERTY_NONE},
163  { OUString( "ShowProtectedSpaces"), HANDLE_VIEWSET_PROTECTED_SPACES , cppu::UnoType<bool>::get(), PROPERTY_NONE},
164  { OUString( "ShowRulers"), HANDLE_VIEWSET_SHOW_RULER , cppu::UnoType<bool>::get(), PROPERTY_NONE},
165  { OUString( "ShowScrollBarTips"), HANDLE_VIEWSET_SCROLLBAR_TIPS , cppu::UnoType<bool>::get(), PROPERTY_NONE},
166  { OUString( "ShowSoftHyphens"), HANDLE_VIEWSET_SOFT_HYPHENS , cppu::UnoType<bool>::get(), PROPERTY_NONE},
167  { OUString( "ShowSpaces"), HANDLE_VIEWSET_SPACES , cppu::UnoType<bool>::get(), PROPERTY_NONE},
168  { OUString( "ShowTableBoundaries"), HANDLE_VIEWSET_TABLE_BOUNDARIES , cppu::UnoType<bool>::get(), PROPERTY_NONE},
169  { OUString( "ShowTables"), HANDLE_VIEWSET_TABLES , cppu::UnoType<bool>::get(), PROPERTY_NONE},
170  { OUString( "ShowTabstops"), HANDLE_VIEWSET_TABSTOPS , cppu::UnoType<bool>::get(), PROPERTY_NONE},
171  { OUString( "ShowTextBoundaries"), HANDLE_VIEWSET_TEXT_BOUNDARIES , cppu::UnoType<bool>::get(), PROPERTY_NONE},
172  { OUString( "ShowTextFieldBackground"),HANDLE_VIEWSET_TEXT_FIELD_BACKGROUND, cppu::UnoType<bool>::get(),PROPERTY_NONE},
173  { OUString( "ShowVertRuler"), HANDLE_VIEWSET_VRULER , cppu::UnoType<bool>::get(), PROPERTY_NONE},
174  { OUString( "ShowVertScrollBar"), HANDLE_VIEWSET_VSCROLL , cppu::UnoType<bool>::get(), PROPERTY_NONE},
175  { OUString( "SmoothScrolling"), HANDLE_VIEWSET_SMOOTH_SCROLLING , cppu::UnoType<bool>::get(), PROPERTY_NONE},
176  { OUString( "VerticalRulerMetric"), HANDLE_VIEWSET_VERT_RULER_METRIC , cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE},
177  { OUString( "ZoomType"), HANDLE_VIEWSET_ZOOM_TYPE , cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE},
178  { OUString( "ZoomValue"), HANDLE_VIEWSET_ZOOM , cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE},
179  { OUString(), 0, css::uno::Type(), 0 }
180  };
181  return new ChainablePropertySetInfo ( aViewSettingsMap_Impl );
182 }
183 
185 {
186  static PropertyInfo const aPrintSettingsMap_Impl[] =
187  {
188  { OUString( "PrintAnnotationMode" ), HANDLE_PRINTSET_ANNOTATION_MODE , cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE},
189  { OUString( "PrintBlackFonts" ), HANDLE_PRINTSET_BLACK_FONTS , cppu::UnoType<bool>::get(), PROPERTY_NONE},
190  { OUString( "PrintControls" ), HANDLE_PRINTSET_CONTROLS , cppu::UnoType<bool>::get(), PROPERTY_NONE},
191  { OUString( "PrintDrawings" ), HANDLE_PRINTSET_DRAWINGS , cppu::UnoType<bool>::get(), PROPERTY_NONE},
192  { OUString( "PrintGraphics" ), HANDLE_PRINTSET_GRAPHICS , cppu::UnoType<bool>::get(), PROPERTY_NONE},
193  { OUString( "PrintHiddenText"), HANDLE_PRINTSET_HIDDEN_TEXT , cppu::UnoType<bool>::get(), PROPERTY_NONE},
194  { OUString( "PrintLeftPages" ), HANDLE_PRINTSET_LEFT_PAGES , cppu::UnoType<bool>::get(), PROPERTY_NONE},
195  { OUString( "PrintPageBackground" ), HANDLE_PRINTSET_PAGE_BACKGROUND , cppu::UnoType<bool>::get(), PROPERTY_NONE},
196  { OUString( "PrintProspect" ), HANDLE_PRINTSET_PROSPECT , cppu::UnoType<bool>::get(), PROPERTY_NONE},
197  { OUString( "PrintProspectRTL" ), HANDLE_PRINTSET_PROSPECT_RTL , cppu::UnoType<bool>::get(), PROPERTY_NONE},
198  { OUString( "PrintReversed" ), HANDLE_PRINTSET_REVERSED , cppu::UnoType<bool>::get(), PROPERTY_NONE},
199  { OUString( "PrintRightPages" ), HANDLE_PRINTSET_RIGHT_PAGES , cppu::UnoType<bool>::get(), PROPERTY_NONE},
200  { OUString( "PrintFaxName" ), HANDLE_PRINTSET_FAX_NAME , cppu::UnoType<OUString>::get(), PROPERTY_NONE},
201  { OUString( "PrintPaperFromSetup" ), HANDLE_PRINTSET_PAPER_FROM_SETUP , cppu::UnoType<bool>::get(), PROPERTY_NONE},
202  { OUString( "PrintTables" ), HANDLE_PRINTSET_TABLES , cppu::UnoType<bool>::get(), PROPERTY_NONE},
203  { OUString( "PrintTextPlaceholder"), HANDLE_PRINTSET_PLACEHOLDER , cppu::UnoType<bool>::get(), PROPERTY_NONE},
204  { OUString( "PrintSingleJobs" ), HANDLE_PRINTSET_SINGLE_JOBS , cppu::UnoType<bool>::get(), PROPERTY_NONE},
205  { OUString( "PrintEmptyPages" ), HANDLE_PRINTSET_EMPTY_PAGES , cppu::UnoType<bool>::get(), PROPERTY_NONE},
206  { OUString(), 0, css::uno::Type(), 0}
207  };
208  return new ChainablePropertySetInfo ( aPrintSettingsMap_Impl );
209 }
210 
212 {
213 }
214 
216 {
217 }
218 
220 {
221  SolarMutexGuard aGuard;
222  if(!mxViewSettings.is())
223  {
224  OSL_FAIL("Web or Text?");
225  mxViewSettings = new SwXViewSettings( nullptr );
226  }
227  return mxViewSettings;
228 }
229 
231 {
232  SolarMutexGuard aGuard;
233  if(!mxPrintSettings.is())
234  {
235  OSL_FAIL("Web or Text?");
237  }
238  return mxPrintSettings;
239 }
240 
242 {
243  return "SwXModule";
244 }
245 
246 sal_Bool SwXModule::supportsService(const OUString& rServiceName)
247 {
248  return cppu::supportsService(this, rServiceName);
249 }
250 
252 {
253  return { "com.sun.star.text.GlobalSettings" };
254 }
255 
257 : ChainablePropertySet ( lcl_createPrintSettingsInfo().get(), &Application::GetSolarMutex() )
258 , meType(eType)
259 , mpPrtOpt ( nullptr )
260 , mpDoc ( pDoc )
261 {
262 }
263 
265  noexcept
266 {
267 }
268 
270 {
271  switch (meType)
272  {
274  mpPrtOpt = SW_MOD()->GetPrtOptions( false );
275  break;
277  {
278  if (!mpDoc)
279  throw IllegalArgumentException ();
281  }
282  break;
283  }
284 }
285 
286 namespace
287 {
288  bool tryBoolAccess(const uno::Any &rValue)
289  {
290  const auto xPrSet = o3tl::tryAccess<bool>(rValue);
291  if (!xPrSet)
292  throw lang::IllegalArgumentException();
293  return *xPrSet;
294  }
295 }
296 
298 {
299  switch( rInfo.mnHandle )
300  {
301  case HANDLE_PRINTSET_LEFT_PAGES:
302  {
303  mpPrtOpt->SetPrintLeftPage(tryBoolAccess(rValue));
304  }
305  break;
306  case HANDLE_PRINTSET_RIGHT_PAGES:
307  {
308  mpPrtOpt->SetPrintRightPage(tryBoolAccess(rValue));
309  }
310  break;
311  case HANDLE_PRINTSET_REVERSED:
312  {
313  mpPrtOpt->SetPrintReverse(tryBoolAccess(rValue));
314  }
315  break;
316  case HANDLE_PRINTSET_PROSPECT:
317  {
318  mpPrtOpt->SetPrintProspect(tryBoolAccess(rValue));
319  }
320  break;
321  case HANDLE_PRINTSET_GRAPHICS:
322  {
323  mpPrtOpt->SetPrintGraphic(tryBoolAccess(rValue));
324  }
325  break;
326  case HANDLE_PRINTSET_TABLES:
327  {
328  mpPrtOpt->SetPrintTable(tryBoolAccess(rValue));
329  }
330  break;
331  case HANDLE_PRINTSET_DRAWINGS:
332  {
333  mpPrtOpt->SetPrintDraw(tryBoolAccess(rValue));
334  }
335  break;
336  case HANDLE_PRINTSET_CONTROLS:
337  {
338  mpPrtOpt->SetPrintControl(tryBoolAccess(rValue));
339  }
340  break;
341  case HANDLE_PRINTSET_PAGE_BACKGROUND:
342  {
343  mpPrtOpt->SetPrintPageBackground(tryBoolAccess(rValue));
344  }
345  break;
346  case HANDLE_PRINTSET_BLACK_FONTS:
347  {
348  mpPrtOpt->SetPrintBlackFont(tryBoolAccess(rValue));
349  }
350  break;
351  case HANDLE_PRINTSET_SINGLE_JOBS:
352  {
353  mpPrtOpt->SetPrintSingleJobs(tryBoolAccess(rValue));
354  }
355  break;
356  case HANDLE_PRINTSET_PAPER_FROM_SETUP:
357  {
358  mpPrtOpt->SetPaperFromSetup(tryBoolAccess(rValue));
359  }
360  break;
361  case HANDLE_PRINTSET_ANNOTATION_MODE:
362  {
363  sal_Int16 nTmp = 0;
364  rValue >>= nTmp;
365  SwPostItMode nVal = static_cast<SwPostItMode>(nTmp);
366  if(nVal > SwPostItMode::EndPage)
367  throw lang::IllegalArgumentException();
368 
369  mpPrtOpt->SetPrintPostIts(nVal);
370  }
371  break;
372  case HANDLE_PRINTSET_EMPTY_PAGES:
373  {
374  mpPrtOpt->SetPrintEmptyPages(tryBoolAccess(rValue));
375  }
376  break;
377  case HANDLE_PRINTSET_FAX_NAME:
378  {
379  OUString sString;
380  if ( !(rValue >>= sString))
381  throw lang::IllegalArgumentException();
382 
383  mpPrtOpt->SetFaxName(sString);
384  }
385  break;
386  case HANDLE_PRINTSET_PROSPECT_RTL:
387  {
388  mpPrtOpt->SetPrintProspect_RTL(tryBoolAccess(rValue));
389  }
390  break;
391  case HANDLE_PRINTSET_PLACEHOLDER:
392  {
393  mpPrtOpt->SetPrintTextPlaceholder(tryBoolAccess(rValue));
394  }
395  break;
396  case HANDLE_PRINTSET_HIDDEN_TEXT:
397  {
398  mpPrtOpt->SetPrintHiddenText(tryBoolAccess(rValue));
399  }
400  break;
401  default:
402  throw UnknownPropertyException(OUString::number(rInfo.mnHandle));
403  }
404 }
405 
407 {
408  mpPrtOpt = nullptr;
409 }
410 
412 {
413  switch (meType)
414  {
416  mpPrtOpt = SW_MOD()->GetPrtOptions( false );
417  break;
419  {
420  if (!mpDoc)
421  throw IllegalArgumentException ();
423  }
424  break;
425  }
426 }
427 
429 {
430  switch( rInfo.mnHandle )
431  {
432  case HANDLE_PRINTSET_LEFT_PAGES:
433  rValue <<= mpPrtOpt->IsPrintLeftPage();
434  break;
435  case HANDLE_PRINTSET_RIGHT_PAGES:
436  rValue <<= mpPrtOpt->IsPrintRightPage();
437  break;
438  case HANDLE_PRINTSET_REVERSED:
439  rValue <<= mpPrtOpt->IsPrintReverse();
440  break;
441  case HANDLE_PRINTSET_PROSPECT:
442  rValue <<= mpPrtOpt->IsPrintProspect();
443  break;
444  case HANDLE_PRINTSET_GRAPHICS:
445  rValue <<= mpPrtOpt->IsPrintGraphic();
446  break;
447  case HANDLE_PRINTSET_TABLES:
448  rValue <<= mpPrtOpt->IsPrintTable();
449  break;
450  case HANDLE_PRINTSET_DRAWINGS:
451  rValue <<= mpPrtOpt->IsPrintDraw();
452  break;
453  case HANDLE_PRINTSET_CONTROLS:
454  rValue <<= mpPrtOpt->IsPrintControl();
455  break;
456  case HANDLE_PRINTSET_PAGE_BACKGROUND:
457  rValue <<= mpPrtOpt->IsPrintPageBackground();
458  break;
459  case HANDLE_PRINTSET_BLACK_FONTS:
460  rValue <<= mpPrtOpt->IsPrintBlackFont();
461  break;
462  case HANDLE_PRINTSET_SINGLE_JOBS:
463  rValue <<= mpPrtOpt->IsPrintSingleJobs();
464  break;
465  case HANDLE_PRINTSET_EMPTY_PAGES:
466  rValue <<= mpPrtOpt->IsPrintEmptyPages();
467  break;
468  case HANDLE_PRINTSET_PAPER_FROM_SETUP:
469  rValue <<= mpPrtOpt->IsPaperFromSetup();
470  break;
471  case HANDLE_PRINTSET_ANNOTATION_MODE:
472  {
473  rValue <<= static_cast < sal_Int16 > ( mpPrtOpt->GetPrintPostIts() );
474  }
475  break;
476  case HANDLE_PRINTSET_FAX_NAME :
477  {
478  rValue <<= mpPrtOpt->GetFaxName();
479  }
480  break;
481  case HANDLE_PRINTSET_PROSPECT_RTL:
482  {
483  rValue <<= mpPrtOpt->IsPrintProspectRTL();
484  }
485  break;
486  case HANDLE_PRINTSET_PLACEHOLDER:
487  {
488  rValue <<= mpPrtOpt->IsPrintTextPlaceholder();
489  }
490  break;
491  case HANDLE_PRINTSET_HIDDEN_TEXT:
492  {
493  rValue <<= mpPrtOpt->IsPrintHiddenText();
494  }
495  break;
496  default:
497  throw UnknownPropertyException(OUString::number(rInfo.mnHandle));
498  }
499 }
500 
502 {
503  mpPrtOpt = nullptr;
504 }
505 
507 {
508  return "SwXPrintSettings";
509 }
510 
511 sal_Bool SwXPrintSettings::supportsService(const OUString& rServiceName)
512 {
513  return cppu::supportsService(this, rServiceName);
514 }
515 
517 {
518  Sequence<OUString> aRet { "com.sun.star.text.PrintSettings" };
519  return aRet;
520 }
521 
523  : ChainablePropertySet( lcl_createViewSettingsInfo().get(), &Application::GetSolarMutex() )
524  , pView(pVw)
525  , mpConstViewOption(nullptr)
526  , bObjectValid(true)
527  , mbApplyZoom(false)
528  , eHRulerUnit(FieldUnit::CM)
529  , mbApplyHRulerMetric(false)
530  , eVRulerUnit(FieldUnit::CM)
531  , mbApplyVRulerMetric(false)
532 {
533  // This property only exists if we have a view (ie, not at the module )
534  if ( !pView )
535  mxInfo->remove ( "HelpURL" );
536 
537 }
538 
540  noexcept
541 {
542 
543 }
544 
546 {
547  const SwViewOption* pVOpt = nullptr;
548  if(pView)
549  {
550  if(!IsValid())
551  return;
552  pVOpt = pView->GetWrtShell().GetViewOptions();
553  }
554  else
555  pVOpt = SW_MOD()->GetViewOption(false);
556 
557  mpViewOption.reset( new SwViewOption (*pVOpt) );
558  mbApplyZoom = false;
559  if(pView)
560  mpViewOption->SetStarOneSetting(true);
561 }
562 
564 {
565  // the API flag should not be set to the application's view settings
566  switch( rInfo.mnHandle )
567  {
568  case HANDLE_VIEWSET_SHOW_RULER : mpViewOption->SetViewAnyRuler(*o3tl::doAccess<bool>(rValue)); break;
569  case HANDLE_VIEWSET_HRULER : mpViewOption->SetViewHRuler(*o3tl::doAccess<bool>(rValue)); break;
570  case HANDLE_VIEWSET_VRULER : mpViewOption->SetViewVRuler(*o3tl::doAccess<bool>(rValue));break;
571  case HANDLE_VIEWSET_VRULER_RIGHT : mpViewOption->SetVRulerRight(*o3tl::doAccess<bool>(rValue));break;
572  case HANDLE_VIEWSET_HSCROLL : mpViewOption->SetViewHScrollBar(*o3tl::doAccess<bool>(rValue));break;
573  case HANDLE_VIEWSET_VSCROLL : mpViewOption->SetViewVScrollBar(*o3tl::doAccess<bool>(rValue));break;
574  case HANDLE_VIEWSET_GRAPHICS : mpViewOption->SetGraphic(*o3tl::doAccess<bool>(rValue));break;
575  case HANDLE_VIEWSET_TABLES : mpViewOption->SetTable(*o3tl::doAccess<bool>(rValue)); break;
576  case HANDLE_VIEWSET_DRAWINGS : mpViewOption->SetDraw(*o3tl::doAccess<bool>(rValue)); break;
577  case HANDLE_VIEWSET_FIELD_COMMANDS : mpViewOption->SetFieldName(*o3tl::doAccess<bool>(rValue)); break;
578  case HANDLE_VIEWSET_ANNOTATIONS : mpViewOption->SetPostIts(*o3tl::doAccess<bool>(rValue)); break;
579  case HANDLE_VIEWSET_INDEX_MARK_BACKGROUND : SwViewOption::SetAppearanceFlag(ViewOptFlags::FieldShadings, *o3tl::doAccess<bool>(rValue), true); break;
580  case HANDLE_VIEWSET_NONPRINTING_CHARACTERS: mpViewOption->SetViewMetaChars( *o3tl::doAccess<bool>(rValue) ); break;
581  case HANDLE_VIEWSET_FOOTNOTE_BACKGROUND : SwViewOption::SetAppearanceFlag(ViewOptFlags::FieldShadings, *o3tl::doAccess<bool>(rValue), true); break;
582  case HANDLE_VIEWSET_TEXT_FIELD_BACKGROUND : SwViewOption::SetAppearanceFlag(ViewOptFlags::FieldShadings, *o3tl::doAccess<bool>(rValue), true); break;
583  case HANDLE_VIEWSET_PARA_BREAKS : mpViewOption->SetParagraph(*o3tl::doAccess<bool>(rValue)); break;
584  case HANDLE_VIEWSET_SOFT_HYPHENS : mpViewOption->SetSoftHyph(*o3tl::doAccess<bool>(rValue)); break;
585  case HANDLE_VIEWSET_SPACES : mpViewOption->SetBlank(*o3tl::doAccess<bool>(rValue)); break;
586  case HANDLE_VIEWSET_PROTECTED_SPACES : mpViewOption->SetHardBlank(*o3tl::doAccess<bool>(rValue)); break;
587  case HANDLE_VIEWSET_TABSTOPS : mpViewOption->SetTab(*o3tl::doAccess<bool>(rValue)); break;
588  case HANDLE_VIEWSET_BREAKS : mpViewOption->SetLineBreak(*o3tl::doAccess<bool>(rValue)); break;
589  case HANDLE_VIEWSET_BOOKMARKS : mpViewOption->SetShowBookmarks(*o3tl::doAccess<bool>(rValue)); break;
590  case HANDLE_VIEWSET_HIDDEN_TEXT : mpViewOption->SetShowHiddenField(*o3tl::doAccess<bool>(rValue)); break;
591  case HANDLE_VIEWSET_HIDDEN_CHARACTERS : mpViewOption->SetShowHiddenChar(*o3tl::doAccess<bool>(rValue)); break;
592  case HANDLE_VIEWSET_HIDDEN_PARAGRAPHS : mpViewOption->SetShowHiddenPara(*o3tl::doAccess<bool>(rValue)); break;
593  case HANDLE_VIEWSET_TABLE_BOUNDARIES : SwViewOption::SetAppearanceFlag(ViewOptFlags::TableBoundaries, *o3tl::doAccess<bool>(rValue), true); break;
594  case HANDLE_VIEWSET_TEXT_BOUNDARIES : SwViewOption::SetDocBoundaries(*o3tl::doAccess<bool>(rValue)); break;
595  case HANDLE_VIEWSET_SMOOTH_SCROLLING : mpViewOption->SetSmoothScroll(*o3tl::doAccess<bool>(rValue)); break;
596  case HANDLE_VIEWSET_SHOW_CONTENT_TIPS : mpViewOption->SetShowContentTips(*o3tl::doAccess<bool>(rValue)); break;
597  case HANDLE_VIEWSET_IS_RASTER_VISIBLE : mpViewOption->SetGridVisible(*o3tl::doAccess<bool>(rValue)); break;
598  case HANDLE_VIEWSET_IS_SNAP_TO_RASTER : mpViewOption->SetSnap(*o3tl::doAccess<bool>(rValue)); break;
599  case HANDLE_VIEWSET_SCROLLBAR_TIPS : mpViewOption->SetShowScrollBarTips(*o3tl::doAccess<bool>(rValue)); break;
600  case HANDLE_VIEWSET_INLINECHANGES_TIPS : mpViewOption->SetShowInlineTooltips(*o3tl::doAccess<bool>(rValue)); break;
601  case HANDLE_VIEWSET_USE_HEADERFOOTERMENU : mpViewOption->SetUseHeaderFooterMenu(*o3tl::doAccess<bool>(rValue)); break;
602  case HANDLE_VIEWSET_SHOW_OUTLINECONTENTVISIBILITYBUTTON : mpViewOption->SetShowOutlineContentVisibilityButton(*o3tl::doAccess<bool>(rValue)); break;
603  case HANDLE_VIEWSET_TREAT_SUB_OUTLINE_LEVELS_AS_CONTENT : mpViewOption->SetTreatSubOutlineLevelsAsContent(*o3tl::doAccess<bool>(rValue)); break;
604  case HANDLE_VIEWSET_CHANGES_IN_MARGIN : mpViewOption->SetShowChangesInMargin(*o3tl::doAccess<bool>(rValue)); break;
605  case HANDLE_VIEWSET_RASTER_RESOLUTION_X :
606  {
607  sal_Int32 nTmp = 0;
608  if(!(rValue >>= nTmp) || nTmp < 10)
609  throw IllegalArgumentException();
610  Size aSize( mpViewOption->GetSnapSize() );
612  mpViewOption->SetSnapSize( aSize );
613  }
614  break;
615  case HANDLE_VIEWSET_RASTER_RESOLUTION_Y :
616  {
617  sal_Int32 nTmp = 0;
618  if(!(rValue >>= nTmp) || nTmp < 10)
619  throw IllegalArgumentException();
620  Size aSize( mpViewOption->GetSnapSize() );
622  mpViewOption->SetSnapSize( aSize );
623  }
624  break;
625  case HANDLE_VIEWSET_RASTER_SUBDIVISION_X :
626  {
627  sal_Int32 nTmp = 0;
628  if(!(rValue >>= nTmp) || (0 > nTmp || nTmp >= 100))
629  throw IllegalArgumentException();
630  mpViewOption->SetDivisionX( static_cast<short>(nTmp) );
631  }
632  break;
633  case HANDLE_VIEWSET_RASTER_SUBDIVISION_Y :
634  {
635  sal_Int32 nTmp = 0;
636  if(!(rValue >>= nTmp) || (0 > nTmp || nTmp >= 100))
637  throw IllegalArgumentException();
638  mpViewOption->SetDivisionY( static_cast<short>(nTmp) );
639  }
640  break;
641  case HANDLE_VIEWSET_ZOOM :
642  {
643  sal_Int16 nZoom = 0;
644  if(!(rValue >>= nZoom) || nZoom > MAXZOOM || nZoom < MINZOOM)
645  throw lang::IllegalArgumentException();
646  mpViewOption->SetZoom(o3tl::narrowing<sal_uInt16>(nZoom));
647  mbApplyZoom = true;
648  }
649  break;
650  case HANDLE_VIEWSET_ZOOM_TYPE:
651  {
652  sal_Int16 nZoom = 0;
653  if(!(rValue >>= nZoom))
654  throw IllegalArgumentException();
655  SvxZoomType eZoom;
656  switch (nZoom)
657  {
658  case view::DocumentZoomType::OPTIMAL:
659  eZoom = SvxZoomType::OPTIMAL;
660  break;
661  case view::DocumentZoomType::PAGE_WIDTH:
662  eZoom = SvxZoomType::PAGEWIDTH;
663  break;
664  case view::DocumentZoomType::ENTIRE_PAGE:
665  eZoom = SvxZoomType::WHOLEPAGE;
666  break;
667  case view::DocumentZoomType::BY_VALUE:
668  eZoom = SvxZoomType::PERCENT;
669  break;
670  case view::DocumentZoomType::PAGE_WIDTH_EXACT:
671  eZoom = SvxZoomType::PAGEWIDTH_NOBORDER;
672  break;
673  default:
674  throw IllegalArgumentException(
675  "SwXViewSettings: invalid zoom type", nullptr, 0);
676  }
677  mpViewOption->SetZoomType( eZoom );
678  mbApplyZoom = true;
679  }
680  break;
681  case HANDLE_VIEWSET_ONLINE_LAYOUT :
682  {
683  if ( pView )
684  {
685  bool bVal = *o3tl::doAccess<bool>(rValue);
687  if (!bVal != !aOpt.getBrowseMode())
688  {
689  aOpt.setBrowseMode( bVal );
691 
692  // must be set in mpViewOption as this will overwrite settings in _post!
693  if(mpViewOption)
694  mpViewOption->setBrowseMode(bVal);
695 
697  }
698  }
699  }
700  break;
701  case HANDLE_VIEWSET_HIDE_WHITESPACE:
702  {
703  if ( pView )
704  {
705  bool bVal = *o3tl::doAccess<bool>(rValue);
707  if (!bVal != !aOpt.IsHideWhitespaceMode())
708  {
709  aOpt.SetHideWhitespaceMode( bVal );
711 
712  // must be set in mpViewOption as this will overwrite settings in _post!
713  if(mpViewOption)
714  mpViewOption->SetHideWhitespaceMode(bVal);
715  }
716  }
717  }
718  break;
719  case HANDLE_VIEWSET_HELP_URL:
720  {
721  if ( !pView )
722  throw UnknownPropertyException();
723 
724  OUString sHelpURL;
725  if ( ! ( rValue >>= sHelpURL ) )
726  throw IllegalArgumentException();
727 
728  INetURLObject aHID( sHelpURL );
729  if ( aHID.GetProtocol() != INetProtocol::Hid )
730  throw IllegalArgumentException ();
731 
732  pView->GetEditWin().SetHelpId( OUStringToOString( aHID.GetURLPath(), RTL_TEXTENCODING_UTF8 ) );
733  }
734  break;
735  case HANDLE_VIEWSET_HORI_RULER_METRIC:
736  case HANDLE_VIEWSET_VERT_RULER_METRIC:
737  {
738  sal_uInt16 nUnit;
739  if( rValue >>= nUnit )
740  switch (static_cast<FieldUnit>(nUnit))
741  {
742  case FieldUnit::MM:
743  case FieldUnit::CM:
744  case FieldUnit::POINT:
745  case FieldUnit::PICA:
746  case FieldUnit::INCH:
747  if( rInfo.mnHandle == HANDLE_VIEWSET_HORI_RULER_METRIC )
748  {
749  eHRulerUnit = static_cast<FieldUnit>(nUnit);
750  mbApplyHRulerMetric = true;
751  }
752  else
753  {
754  eVRulerUnit = static_cast<FieldUnit>(nUnit);
755  mbApplyVRulerMetric = true;
756  }
757  break;
758  default:
759  throw IllegalArgumentException();
760  }
761  }
762  break;
763  default:
764  throw UnknownPropertyException(OUString::number(rInfo.mnHandle));
765  }
766 }
767 
769 {
770  if( pView )
771  {
772  if(mbApplyZoom )
773  pView->SetZoom( mpViewOption->GetZoomType(),
774  mpViewOption->GetZoom(), true );
779 
780  }
781  else
782  {
784  SW_MOD()->ApplyRulerMetric( eHRulerUnit, true, false );
786  SW_MOD()->ApplyRulerMetric( eVRulerUnit, false, false );
787  }
788 
791 
792  mpViewOption.reset();
793 }
794 
796 {
797  if(pView)
798  {
799  if(!IsValid())
800  return;
802  }
803  else
804  mpConstViewOption = SW_MOD()->GetViewOption(false);
805 }
806 
808 {
809  bool bBool = true;
810  bool bBoolVal = false;
811  switch( rInfo.mnHandle )
812  {
813  case HANDLE_VIEWSET_SHOW_RULER: bBoolVal = mpConstViewOption->IsViewAnyRuler(); break;
814  case HANDLE_VIEWSET_HRULER : bBoolVal = mpConstViewOption->IsViewHRuler(true); break;
815  case HANDLE_VIEWSET_VRULER : bBoolVal = mpConstViewOption->IsViewVRuler(true);break;
816  case HANDLE_VIEWSET_VRULER_RIGHT : bBoolVal = mpConstViewOption->IsVRulerRight();break;
817  case HANDLE_VIEWSET_HSCROLL: bBoolVal = mpConstViewOption->IsViewHScrollBar();break;
818  case HANDLE_VIEWSET_VSCROLL: bBoolVal = mpConstViewOption->IsViewVScrollBar();break;
819  case HANDLE_VIEWSET_GRAPHICS : bBoolVal = mpConstViewOption->IsGraphic();break;
820  case HANDLE_VIEWSET_TABLES : bBoolVal = mpConstViewOption->IsTable(); break;
821  case HANDLE_VIEWSET_DRAWINGS : bBoolVal = mpConstViewOption->IsDraw(); break;
822  case HANDLE_VIEWSET_FIELD_COMMANDS : bBoolVal = mpConstViewOption->IsFieldName(); break;
823  case HANDLE_VIEWSET_ANNOTATIONS : bBoolVal = mpConstViewOption->IsPostIts(); break;
824  case HANDLE_VIEWSET_INDEX_MARK_BACKGROUND : bBoolVal = SwViewOption::IsFieldShadings(); break;
825  case HANDLE_VIEWSET_NONPRINTING_CHARACTERS: bBoolVal = mpConstViewOption->IsViewMetaChars(); break;
826  case HANDLE_VIEWSET_FOOTNOTE_BACKGROUND : bBoolVal = SwViewOption::IsFieldShadings(); break;
827  case HANDLE_VIEWSET_TEXT_FIELD_BACKGROUND : bBoolVal = SwViewOption::IsFieldShadings(); break;
828  case HANDLE_VIEWSET_PARA_BREAKS : bBoolVal = mpConstViewOption->IsParagraph(true); break;
829  case HANDLE_VIEWSET_SOFT_HYPHENS : bBoolVal = mpConstViewOption->IsSoftHyph(); break;
830  case HANDLE_VIEWSET_SPACES : bBoolVal = mpConstViewOption->IsBlank(true); break;
831  case HANDLE_VIEWSET_PROTECTED_SPACES : bBoolVal = mpConstViewOption->IsHardBlank(); break;
832  case HANDLE_VIEWSET_TABSTOPS : bBoolVal = mpConstViewOption->IsTab(true); break;
833  case HANDLE_VIEWSET_BREAKS : bBoolVal = mpConstViewOption->IsLineBreak(true); break;
834  case HANDLE_VIEWSET_BOOKMARKS : bBoolVal = mpConstViewOption->IsShowBookmarks(true); break;
835  case HANDLE_VIEWSET_HIDDEN_TEXT : bBoolVal = mpConstViewOption->IsShowHiddenField(); break;
836  case HANDLE_VIEWSET_HIDDEN_CHARACTERS : bBoolVal = mpConstViewOption->IsShowHiddenChar(true); break;
837  case HANDLE_VIEWSET_HIDE_WHITESPACE : bBoolVal = mpConstViewOption->IsHideWhitespaceMode(); break;
838  case HANDLE_VIEWSET_HIDDEN_PARAGRAPHS : bBoolVal = mpConstViewOption->IsShowHiddenPara(); break;
839  case HANDLE_VIEWSET_TABLE_BOUNDARIES : bBoolVal = SwViewOption::IsTableBoundaries(); break;
840  case HANDLE_VIEWSET_TEXT_BOUNDARIES : bBoolVal = SwViewOption::IsDocBoundaries(); break;
841  case HANDLE_VIEWSET_SMOOTH_SCROLLING : bBoolVal = mpConstViewOption->IsSmoothScroll(); break;
842  case HANDLE_VIEWSET_SHOW_CONTENT_TIPS : bBoolVal = mpConstViewOption->IsShowContentTips(); break;
843  case HANDLE_VIEWSET_INLINECHANGES_TIPS : bBoolVal = mpConstViewOption->IsShowInlineTooltips(); break;
844  case HANDLE_VIEWSET_CHANGES_IN_MARGIN : bBoolVal = mpConstViewOption->IsShowChangesInMargin(); break;
845  case HANDLE_VIEWSET_IS_RASTER_VISIBLE : bBoolVal = mpConstViewOption->IsGridVisible(); break;
846  case HANDLE_VIEWSET_IS_SNAP_TO_RASTER : bBoolVal = mpConstViewOption->IsSnap(); break;
847  case HANDLE_VIEWSET_SCROLLBAR_TIPS : bBoolVal = mpConstViewOption->IsShowScrollBarTips(); break;
848  case HANDLE_VIEWSET_RASTER_RESOLUTION_X :
849  bBool = false;
850  rValue <<= static_cast<sal_Int32>(convertTwipToMm100(mpConstViewOption->GetSnapSize().Width()));
851  break;
852  case HANDLE_VIEWSET_RASTER_RESOLUTION_Y :
853  bBool = false;
854  rValue <<= static_cast<sal_Int32>(convertTwipToMm100(mpConstViewOption->GetSnapSize().Height()));
855  break;
856  case HANDLE_VIEWSET_RASTER_SUBDIVISION_X :
857  bBool = false;
858  rValue <<= static_cast<sal_Int32>(mpConstViewOption->GetDivisionX());
859  break;
860  case HANDLE_VIEWSET_RASTER_SUBDIVISION_Y :
861  bBool = false;
862  rValue <<= static_cast<sal_Int32>(mpConstViewOption->GetDivisionY());
863  break;
864  case HANDLE_VIEWSET_ZOOM :
865  bBool = false;
866  rValue <<= static_cast<sal_Int16>(mpConstViewOption->GetZoom());
867  break;
868  case HANDLE_VIEWSET_ZOOM_TYPE:
869  {
870  bBool = false;
871  sal_Int16 nRet(0);
872  switch (mpConstViewOption->GetZoomType())
873  {
874  case SvxZoomType::OPTIMAL:
875  nRet = view::DocumentZoomType::OPTIMAL;
876  break;
877  case SvxZoomType::PAGEWIDTH:
878  nRet = view::DocumentZoomType::PAGE_WIDTH;
879  break;
880  case SvxZoomType::WHOLEPAGE:
881  nRet = view::DocumentZoomType::ENTIRE_PAGE;
882  break;
883  case SvxZoomType::PERCENT:
884  nRet = view::DocumentZoomType::BY_VALUE;
885  break;
886  case SvxZoomType::PAGEWIDTH_NOBORDER:
887  nRet = view::DocumentZoomType::PAGE_WIDTH_EXACT;
888  break;
889  default:
890  OSL_FAIL("SwXViewSettings: invalid zoom type");
891  break;
892  }
893  rValue <<= nRet;
894  }
895  break;
896  case HANDLE_VIEWSET_ONLINE_LAYOUT:
897  if(pView)
898  bBoolVal = pView->GetWrtShell().GetViewOptions()->getBrowseMode();
899  break;
900  case HANDLE_VIEWSET_HELP_URL :
901  {
902  if ( !pView )
903  throw UnknownPropertyException();
904 
905  bBool = false;
906  SwEditWin &rEditWin = pView->GetEditWin();
907  OUString sHelpURL = INET_HID_SCHEME + OUString::fromUtf8( rEditWin.GetHelpId() );
908  rValue <<= sHelpURL;
909  }
910  break;
911  case HANDLE_VIEWSET_HORI_RULER_METRIC:
912  {
913  if ( pView )
914  {
915  FieldUnit eUnit;
916  pView->GetHRulerMetric( eUnit );
917  rValue <<= static_cast<sal_Int32>(eUnit);
918  }
919  else
920  {
921  const SwMasterUsrPref* pUsrPref = SW_MOD()->GetUsrPref( false );
922  rValue <<= static_cast<sal_Int32>(pUsrPref->GetHScrollMetric());
923  }
924  bBool = false;
925  }
926  break;
927  case HANDLE_VIEWSET_VERT_RULER_METRIC:
928  {
929  if ( pView )
930  {
931  FieldUnit eUnit;
932  pView->GetVRulerMetric( eUnit );
933  rValue <<= static_cast<sal_Int32>(eUnit);
934  }
935  else
936  {
937  const SwMasterUsrPref* pUsrPref = SW_MOD()->GetUsrPref( false );
938  rValue <<= static_cast<sal_Int32>(pUsrPref->GetVScrollMetric());
939  }
940  bBool = false;
941  }
942  break;
943  default: OSL_FAIL("there is no such ID!");
944  }
945  if( bBool )
946  rValue <<= bBoolVal;
947 }
948 
950 {
951  mpConstViewOption = nullptr;
952 }
953 
955 {
956  return "SwXViewSettings";
957 }
958 
959 sal_Bool SwXViewSettings::supportsService(const OUString& rServiceName)
960 {
961  return cppu::supportsService(this, rServiceName);
962 }
963 
965 {
966  Sequence<OUString> aRet { "com.sun.star.text.ViewSettings" };
967  return aRet;
968 }
969 
970 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
971 SwXModule_get_implementation(css::uno::XComponentContext*,
972  css::uno::Sequence<css::uno::Any> const &)
973 {
974  return cppu::acquire(new SwXModule());
975 }
976 
977 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
bool IsPaperFromSetup() const
Definition: printdata.hxx:138
css::uno::Reference< css::beans::XPropertySet > mxPrintSettings
Definition: unomod.hxx:47
void SetPrintPostIts(SwPostItMode n)
Definition: printdata.hxx:159
#define MAXZOOM
Definition: view.hxx:81
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unomod.cxx:246
bool IsViewMetaChars() const
Definition: viewopt.hxx:375
bool IsSmoothScroll() const
Definition: viewopt.hxx:403
constexpr OUStringLiteral INET_HID_SCHEME
#define MINZOOM
Definition: view.hxx:80
FieldUnit
SwXPrintSettingsType meType
Definition: unomod.hxx:75
bool IsShowScrollBarTips() const
Definition: viewopt.hxx:543
static rtl::Reference< ChainablePropertySetInfo > lcl_createViewSettingsInfo()
Definition: unomod.cxx:127
void GetHRulerMetric(FieldUnit &rToFill) const
Definition: viewmdi.cxx:641
FieldUnit GetVScrollMetric() const
Definition: usrpref.hxx:225
void SetPrintLeftPage(bool b)
Definition: printdata.hxx:154
void SetPrintRightPage(bool b)
Definition: printdata.hxx:155
static bool IsDocBoundaries()
Definition: viewopt.hxx:665
constexpr auto toTwips(N number, Length from)
void setWidth(tools::Long nWidth)
SwPostItMode GetPrintPostIts() const
Definition: printdata.hxx:145
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unomod.cxx:511
bool IsShowContentTips() const
Definition: viewopt.hxx:539
bool IsViewAnyRuler() const
Definition: viewopt.hxx:581
SwXModule()
Definition: unomod.cxx:211
IDocumentDeviceAccess const & getIDocumentDeviceAccess() const
Definition: doc.cxx:238
void ToggleLayoutMode(SwView *pView)
Definition: docsh2.cxx:152
void SetPrintControl(bool b)
Definition: printdata.hxx:153
bool IsGraphic() const
Definition: viewopt.hxx:333
void ChangeTabMetric(FieldUnit eUnit)
Definition: viewmdi.cxx:618
OUString GetURLPath(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
void SetPrintTextPlaceholder(bool b)
Definition: printdata.hxx:167
virtual ~SwXViewSettings() noexcept override
Definition: unomod.cxx:539
bool IsPostIts() const
Definition: viewopt.hxx:273
static void SetDocBoundaries(bool bSet)
Definition: viewopt.hxx:677
virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getPrintSettings() override
Definition: unomod.cxx:230
FieldUnit eVRulerUnit
Definition: unomod.hxx:110
Definition: doc.hxx:188
bool IsPrintTable() const
Definition: printdata.hxx:132
bool IsHardBlank() const
Definition: viewopt.hxx:231
SwEditWin & GetEditWin()
Definition: view.hxx:416
void SetHelpId(const OString &)
bool IsShowHiddenPara() const
Definition: viewopt.hxx:397
virtual OUString SAL_CALL getImplementationName() override
Definition: unomod.cxx:506
bool IsPrintProspectRTL() const
Definition: printdata.hxx:141
void SetPrintGraphic(bool b)
Definition: printdata.hxx:150
bool mbApplyZoom
Definition: unomod.hxx:106
bool IsPrintHiddenText() const
Definition: printdata.hxx:147
FieldUnit GetHScrollMetric() const
Definition: usrpref.hxx:217
SwWrtShell & GetWrtShell() const
Definition: view.hxx:413
virtual void _postSetValues() override
Definition: unomod.cxx:768
SvxZoomType GetZoomType() const
Definition: viewopt.hxx:546
constexpr auto convertTwipToMm100(N n)
bool IsPrintReverse() const
Definition: printdata.hxx:137
virtual void _preGetValues() override
Definition: unomod.cxx:795
SwXPrintSettingsType
Definition: unomod.hxx:65
constexpr tools::Long Width() const
SwXPrintSettings(SwXPrintSettingsType eType, SwDoc *pDoc=nullptr)
Definition: unomod.cxx:256
bool IsFieldName() const
Definition: viewopt.hxx:269
SwXViewSettings(SwView *pView)
Definition: unomod.cxx:522
const OUString & GetFaxName() const
Definition: printdata.hxx:146
short GetDivisionX() const
Definition: viewopt.hxx:444
bool getBrowseMode() const
Definition: viewopt.hxx:472
short GetDivisionY() const
Definition: viewopt.hxx:446
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
void setBrowseMode(bool bSet)
Definition: viewopt.hxx:473
bool mbApplyHRulerMetric
Definition: unomod.hxx:109
bool IsViewVScrollBar() const
Definition: viewopt.hxx:519
bool IsPrintGraphic() const
Definition: printdata.hxx:131
virtual ~SwXPrintSettings() noexcept override
Definition: unomod.cxx:264
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
virtual void _preSetValues() override
Definition: unomod.cxx:269
void SetPrintEmptyPages(bool b)
Definition: printdata.hxx:158
bool IsViewHRuler(bool bDirect=false) const
Definition: viewopt.hxx:592
void SetFaxName(const OUString &rSet)
Definition: printdata.hxx:165
bool IsPrintPageBackground() const
Definition: printdata.hxx:142
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unomod.cxx:964
bool IsBlank(bool bHard=false) const
Definition: viewopt.hxx:225
virtual void _postGetValues() override
Definition: unomod.cxx:949
void SetHideWhitespaceMode(bool bMode)
Definition: viewopt.hxx:484
static void SetAppearanceFlag(ViewOptFlags nFlag, bool bSet, bool bSaveInConfig=false)
Definition: viewopt.cxx:552
void SetPrintProspect_RTL(bool b)
Definition: printdata.hxx:161
const OString & GetHelpId() const
void SetPrintBlackFont(bool b)
Definition: printdata.hxx:163
bool IsPrintRightPage() const
Definition: printdata.hxx:136
virtual void _setSingleValue(const comphelper::PropertyInfo &rInfo, const css::uno::Any &rValue) override
Definition: unomod.cxx:563
bool IsDraw() const
Definition: viewopt.hxx:348
#define SW_MOD()
Definition: swmodule.hxx:256
void SetPrintHiddenText(bool b)
Definition: printdata.hxx:166
virtual const SwPrintData & getPrintData() const =0
Returns the PrintData.
Window class for the Writer edit area, this is the one handling mouse and keyboard events and doing t...
Definition: edtwin.hxx:58
bool IsPrintSingleJobs() const
Definition: printdata.hxx:144
void SetPrintReverse(bool b)
Definition: printdata.hxx:156
virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getViewSettings() override
Definition: unomod.cxx:219
bool IsShowChangesInMargin() const
Definition: viewopt.hxx:294
bool IsParagraph(bool bHard=false) const
Definition: viewopt.hxx:236
bool IsViewVRuler(bool bDirect=false) const
Definition: viewopt.hxx:606
void SetPrintTable(bool b)
Definition: printdata.hxx:151
bool mbApplyVRulerMetric
Definition: unomod.hxx:111
unsigned char sal_Bool
bool IsTab(bool bHard=false) const
Definition: viewopt.hxx:219
SwView * pView
Definition: unomod.hxx:103
void SetPaperFromSetup(bool b)
Definition: printdata.hxx:157
bool IsPrintControl() const
Definition: printdata.hxx:134
virtual OUString SAL_CALL getImplementationName() override
Definition: unomod.cxx:241
css::uno::Type const & get()
bool IsLineBreak(bool bHard=false) const
Definition: viewopt.hxx:252
virtual void _postGetValues() override
Definition: unomod.cxx:501
void SetPrintPageBackground(bool b)
Definition: printdata.hxx:162
bool IsPrintTextPlaceholder() const
Definition: printdata.hxx:148
static bool IsFieldShadings()
Definition: viewopt.hxx:671
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unomod.cxx:516
bool IsPrintBlackFont() const
Definition: printdata.hxx:143
SwPostItMode
this must match the definitions in css::text::NotePrintMode
Definition: printdata.hxx:42
SwDocShell * GetDocShell()
Definition: view.cxx:1132
bool IsTable() const
Definition: viewopt.hxx:343
const SwViewOption * mpConstViewOption
Definition: unomod.hxx:105
bool IsHideWhitespaceMode() const
Definition: viewopt.hxx:483
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unomod.cxx:959
static rtl::Reference< ChainablePropertySetInfo > lcl_createPrintSettingsInfo()
Definition: unomod.cxx:184
virtual OUString SAL_CALL getImplementationName() override
Definition: unomod.cxx:954
bool IsVRulerRight() const
Definition: viewopt.hxx:627
void SetZoom(SvxZoomType eZoomType, short nFactor=100, bool bViewOnly=false)
Definition: viewmdi.cxx:72
virtual ~SwXModule() override
Definition: unomod.cxx:215
virtual void _getSingleValue(const comphelper::PropertyInfo &rInfo, css::uno::Any &rValue) override
Definition: unomod.cxx:428
SwPrintSettingsPropertyHandles
Definition: unomod.cxx:103
void SetPrintSingleJobs(bool b)
Definition: printdata.hxx:164
bool IsPrintDraw() const
Definition: printdata.hxx:133
#define PROPERTY_NONE
bool IsShowInlineTooltips() const
Definition: viewopt.hxx:288
constexpr tools::Long Height() const
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:428
bool IsPrintEmptyPages() const
Definition: printdata.hxx:139
bool IsValid() const
Definition: unomod.hxx:131
const Size & GetSnapSize() const
Definition: viewopt.hxx:364
INetProtocol GetProtocol() const
SwPrintData * mpPrtOpt
Definition: unomod.hxx:76
css::uno::Reference< css::beans::XPropertySet > mxViewSettings
Definition: unomod.hxx:46
void ChangeVRulerMetric(FieldUnit eUnit)
Definition: viewmdi.cxx:627
sal_uInt16 GetZoom() const
Definition: viewopt.hxx:505
static bool IsTableBoundaries()
Definition: viewopt.hxx:667
virtual void _preSetValues() override
Definition: unomod.cxx:545
void GetVRulerMetric(FieldUnit &rToFill) const
Definition: viewmdi.cxx:636
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unomod.cxx:251
virtual void _getSingleValue(const comphelper::PropertyInfo &rInfo, css::uno::Any &rValue) override
Definition: unomod.cxx:807
bool IsSoftHyph() const
Definition: viewopt.hxx:264
bool IsShowBookmarks(bool const bHard=false) const
Definition: viewopt.hxx:246
void setHeight(tools::Long nHeight)
void SetPrintProspect(bool b)
Definition: printdata.hxx:160
rtl::Reference< ChainablePropertySetInfo > mxInfo
bool IsGridVisible() const
Definition: viewopt.hxx:366
std::unique_ptr< SwViewOption > mpViewOption
Definition: unomod.hxx:104
SwViewSettingsPropertyHandles
Definition: unomod.cxx:51
detail::Optional< bool >::type tryAccess< bool >(css::uno::Any const &any)
SvxZoomType
FieldUnit eHRulerUnit
Definition: unomod.hxx:108
bool IsShowHiddenChar(bool bHard=false) const
Definition: viewopt.hxx:321
SwDoc * mpDoc
Definition: unomod.hxx:77
bool IsShowHiddenField() const
Definition: viewopt.hxx:328
bool IsPrintLeftPage() const
Definition: printdata.hxx:135
virtual void _preGetValues() override
Definition: unomod.cxx:411
bool IsPrintProspect() const
Definition: printdata.hxx:140
bool IsSnap() const
Definition: viewopt.hxx:358
virtual void ApplyViewOptions(const SwViewOption &rOpt) override
Apply ViewOptions with Start-/EndAction.
Definition: wrtsh1.cxx:1932
void SetPrintDraw(bool b)
Definition: printdata.hxx:152
bool IsViewHScrollBar() const
Definition: viewopt.hxx:527
virtual void _postSetValues() override
Definition: unomod.cxx:406
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SwXModule_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
Definition: unomod.cxx:971
virtual void _setSingleValue(const comphelper::PropertyInfo &rInfo, const css::uno::Any &rValue) override
Definition: unomod.cxx:297
RedlineType meType
Definition: view.hxx:144