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