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