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