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 <svl/itemprop.hxx>
27#include <tools/urlobj.hxx>
29#include <vcl/svapp.hxx>
30
31#include <unomod.hxx>
32#include <usrpref.hxx>
33#include <prtopt.hxx>
34#include <swmodule.hxx>
35#include <view.hxx>
36#include <docsh.hxx>
37#include <wrtsh.hxx>
38#include <viewopt.hxx>
39#include <doc.hxx>
41#include <edtwin.hxx>
42using namespace ::com::sun::star;
43using namespace ::com::sun::star::uno;
44using namespace ::com::sun::star::beans;
45using namespace ::com::sun::star::lang;
46using namespace ::comphelper;
47
48namespace {
49
50enum SwViewSettingsPropertyHandles
51{
52 HANDLE_VIEWSET_ANNOTATIONS,
53 HANDLE_VIEWSET_BREAKS,
54 HANDLE_VIEWSET_DRAWINGS,
55 HANDLE_VIEWSET_FIELD_COMMANDS,
56 HANDLE_VIEWSET_FOOTNOTE_BACKGROUND,
57 HANDLE_VIEWSET_GRAPHICS,
58 HANDLE_VIEWSET_HIDDEN_CHARACTERS,
59 HANDLE_VIEWSET_HIDDEN_PARAGRAPHS,
60 HANDLE_VIEWSET_HIDDEN_TEXT,
61 HANDLE_VIEWSET_HRULER,
62 HANDLE_VIEWSET_HSCROLL,
63 HANDLE_VIEWSET_INDEX_MARK_BACKGROUND,
64 HANDLE_VIEWSET_NONPRINTING_CHARACTERS,
65 HANDLE_VIEWSET_ONLINE_LAYOUT,
66 HANDLE_VIEWSET_PARA_BREAKS,
67 HANDLE_VIEWSET_PROTECTED_SPACES,
68 HANDLE_VIEWSET_SOFT_HYPHENS,
69 HANDLE_VIEWSET_SPACES,
70 HANDLE_VIEWSET_TABLE_BOUNDARIES,
71 HANDLE_VIEWSET_TABLES,
72 HANDLE_VIEWSET_TABSTOPS,
73 HANDLE_VIEWSET_TEXT_BOUNDARIES,
74 HANDLE_VIEWSET_TEXT_FIELD_BACKGROUND,
75 HANDLE_VIEWSET_VRULER,
76 HANDLE_VIEWSET_VSCROLL,
77 HANDLE_VIEWSET_SMOOTH_SCROLLING,
78 HANDLE_VIEWSET_ZOOM_TYPE,
79 HANDLE_VIEWSET_ZOOM,
80 HANDLE_VIEWSET_SHOW_CONTENT_TIPS,
81 HANDLE_VIEWSET_HELP_URL,
82 HANDLE_VIEWSET_VRULER_RIGHT,
83 HANDLE_VIEWSET_SHOW_RULER,
84 HANDLE_VIEWSET_IS_RASTER_VISIBLE,
85 HANDLE_VIEWSET_IS_SNAP_TO_RASTER,
86 HANDLE_VIEWSET_RASTER_RESOLUTION_X,
87 HANDLE_VIEWSET_RASTER_RESOLUTION_Y,
88 HANDLE_VIEWSET_RASTER_SUBDIVISION_X,
89 HANDLE_VIEWSET_RASTER_SUBDIVISION_Y,
90 HANDLE_VIEWSET_HORI_RULER_METRIC,
91 HANDLE_VIEWSET_VERT_RULER_METRIC,
92 HANDLE_VIEWSET_SCROLLBAR_TIPS,
93 HANDLE_VIEWSET_INLINECHANGES_TIPS,
94 HANDLE_VIEWSET_HIDE_WHITESPACE,
95 HANDLE_VIEWSET_USE_HEADERFOOTERMENU,
96 HANDLE_VIEWSET_BOOKMARKS,
97 HANDLE_VIEWSET_SHOW_OUTLINECONTENTVISIBILITYBUTTON,
98 HANDLE_VIEWSET_TREAT_SUB_OUTLINE_LEVELS_AS_CONTENT,
99 HANDLE_VIEWSET_CHANGES_IN_MARGIN
100};
101
102enum SwPrintSettingsPropertyHandles
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
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( "TreatSubOutlineLevelsAsContent" ), HANDLE_VIEWSET_TREAT_SUB_OUTLINE_LEVELS_AS_CONTENT , cppu::UnoType<bool>::get(), PROPERTY_NONE},
140 { OUString( "ShowChangesInMargin" ), HANDLE_VIEWSET_CHANGES_IN_MARGIN, cppu::UnoType<bool>::get(), PROPERTY_NONE},
141 { OUString( "RasterResolutionX"), HANDLE_VIEWSET_RASTER_RESOLUTION_X, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE},
142 { OUString( "RasterResolutionY"), HANDLE_VIEWSET_RASTER_RESOLUTION_Y, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE},
143 { OUString( "RasterSubdivisionX"), HANDLE_VIEWSET_RASTER_SUBDIVISION_X, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE},
144 { OUString( "RasterSubdivisionY"), HANDLE_VIEWSET_RASTER_SUBDIVISION_Y, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE},
145 { OUString( "ShowAnnotations" ), HANDLE_VIEWSET_ANNOTATIONS , cppu::UnoType<bool>::get(), PROPERTY_NONE},
146 { OUString( "ShowBookmarks" ), HANDLE_VIEWSET_BOOKMARKS, cppu::UnoType<bool>::get(), PROPERTY_NONE },
147 { OUString( "ShowBreaks"), HANDLE_VIEWSET_BREAKS , cppu::UnoType<bool>::get(), PROPERTY_NONE},
148 { OUString( "ShowDrawings"), HANDLE_VIEWSET_DRAWINGS , cppu::UnoType<bool>::get(), PROPERTY_NONE},
149 { OUString( "ShowFieldCommands"), HANDLE_VIEWSET_FIELD_COMMANDS , cppu::UnoType<bool>::get(), PROPERTY_NONE},
150 { OUString( "ShowFootnoteBackground"),HANDLE_VIEWSET_FOOTNOTE_BACKGROUND , cppu::UnoType<bool>::get(), PROPERTY_NONE},
151 { OUString( "ShowGraphics"), HANDLE_VIEWSET_GRAPHICS , cppu::UnoType<bool>::get(), PROPERTY_NONE},
152 { OUString( "ShowHiddenCharacters"), HANDLE_VIEWSET_HIDDEN_CHARACTERS , cppu::UnoType<bool>::get(), PROPERTY_NONE},
153 { OUString( "HideWhitespace"), HANDLE_VIEWSET_HIDE_WHITESPACE , cppu::UnoType<bool>::get(), PROPERTY_NONE},
154 { OUString( "ShowHiddenParagraphs"), HANDLE_VIEWSET_HIDDEN_PARAGRAPHS , cppu::UnoType<bool>::get(), PROPERTY_NONE},
155 { OUString( "ShowHiddenText"), HANDLE_VIEWSET_HIDDEN_TEXT , cppu::UnoType<bool>::get(), PROPERTY_NONE},
156 { OUString( "ShowHoriRuler"), HANDLE_VIEWSET_HRULER , cppu::UnoType<bool>::get(), PROPERTY_NONE},
157 { OUString( "ShowHoriScrollBar"), HANDLE_VIEWSET_HSCROLL , cppu::UnoType<bool>::get(), PROPERTY_NONE},
158 { OUString( "ShowIndexMarkBackground"),HANDLE_VIEWSET_INDEX_MARK_BACKGROUND, cppu::UnoType<bool>::get(),PROPERTY_NONE},
159 { OUString( "ShowNonprintingCharacters"),HANDLE_VIEWSET_NONPRINTING_CHARACTERS, cppu::UnoType<bool>::get(),PROPERTY_NONE},
160 { OUString( "ShowOnlineLayout"), HANDLE_VIEWSET_ONLINE_LAYOUT , cppu::UnoType<bool>::get(), PropertyAttribute::MAYBEVOID},
161 { OUString( "ShowParaBreaks"), HANDLE_VIEWSET_PARA_BREAKS , cppu::UnoType<bool>::get(), PROPERTY_NONE},
162 { OUString( "ShowProtectedSpaces"), HANDLE_VIEWSET_PROTECTED_SPACES , cppu::UnoType<bool>::get(), PROPERTY_NONE},
163 { OUString( "ShowRulers"), HANDLE_VIEWSET_SHOW_RULER , cppu::UnoType<bool>::get(), PROPERTY_NONE},
164 { OUString( "ShowScrollBarTips"), HANDLE_VIEWSET_SCROLLBAR_TIPS , cppu::UnoType<bool>::get(), PROPERTY_NONE},
165 { OUString( "ShowSoftHyphens"), HANDLE_VIEWSET_SOFT_HYPHENS , cppu::UnoType<bool>::get(), PROPERTY_NONE},
166 { OUString( "ShowSpaces"), HANDLE_VIEWSET_SPACES , cppu::UnoType<bool>::get(), PROPERTY_NONE},
167 { OUString( "ShowTableBoundaries"), HANDLE_VIEWSET_TABLE_BOUNDARIES , cppu::UnoType<bool>::get(), PROPERTY_NONE},
168 { OUString( "ShowTables"), HANDLE_VIEWSET_TABLES , cppu::UnoType<bool>::get(), PROPERTY_NONE},
169 { OUString( "ShowTabstops"), HANDLE_VIEWSET_TABSTOPS , cppu::UnoType<bool>::get(), PROPERTY_NONE},
170 { OUString( "ShowTextBoundaries"), HANDLE_VIEWSET_TEXT_BOUNDARIES , cppu::UnoType<bool>::get(), PROPERTY_NONE},
171 { OUString( "ShowTextFieldBackground"),HANDLE_VIEWSET_TEXT_FIELD_BACKGROUND, cppu::UnoType<bool>::get(),PROPERTY_NONE},
172 { OUString( "ShowVertRuler"), HANDLE_VIEWSET_VRULER , cppu::UnoType<bool>::get(), PROPERTY_NONE},
173 { OUString( "ShowVertScrollBar"), HANDLE_VIEWSET_VSCROLL , cppu::UnoType<bool>::get(), PROPERTY_NONE},
174 { OUString( "SmoothScrolling"), HANDLE_VIEWSET_SMOOTH_SCROLLING , cppu::UnoType<bool>::get(), PROPERTY_NONE},
175 { OUString( "VerticalRulerMetric"), HANDLE_VIEWSET_VERT_RULER_METRIC , cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE},
176 { OUString( "ZoomType"), HANDLE_VIEWSET_ZOOM_TYPE , cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE},
177 { OUString( "ZoomValue"), HANDLE_VIEWSET_ZOOM , cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE},
178 { OUString(), 0, css::uno::Type(), 0 }
179 };
180 return new ChainablePropertySetInfo ( aViewSettingsMap_Impl );
181}
182
184{
185 static PropertyInfo const aPrintSettingsMap_Impl[] =
186 {
187 { OUString( "PrintAnnotationMode" ), HANDLE_PRINTSET_ANNOTATION_MODE , cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE},
188 { OUString( "PrintBlackFonts" ), HANDLE_PRINTSET_BLACK_FONTS , cppu::UnoType<bool>::get(), PROPERTY_NONE},
189 { OUString( "PrintControls" ), HANDLE_PRINTSET_CONTROLS , cppu::UnoType<bool>::get(), PROPERTY_NONE},
190 { OUString( "PrintDrawings" ), HANDLE_PRINTSET_DRAWINGS , cppu::UnoType<bool>::get(), PROPERTY_NONE},
191 { OUString( "PrintGraphics" ), HANDLE_PRINTSET_GRAPHICS , cppu::UnoType<bool>::get(), PROPERTY_NONE},
192 { OUString( "PrintHiddenText"), HANDLE_PRINTSET_HIDDEN_TEXT , cppu::UnoType<bool>::get(), PROPERTY_NONE},
193 { OUString( "PrintLeftPages" ), HANDLE_PRINTSET_LEFT_PAGES , cppu::UnoType<bool>::get(), PROPERTY_NONE},
194 { OUString( "PrintPageBackground" ), HANDLE_PRINTSET_PAGE_BACKGROUND , cppu::UnoType<bool>::get(), PROPERTY_NONE},
195 { OUString( "PrintProspect" ), HANDLE_PRINTSET_PROSPECT , cppu::UnoType<bool>::get(), PROPERTY_NONE},
196 { OUString( "PrintProspectRTL" ), HANDLE_PRINTSET_PROSPECT_RTL , cppu::UnoType<bool>::get(), PROPERTY_NONE},
197 { OUString( "PrintReversed" ), HANDLE_PRINTSET_REVERSED , cppu::UnoType<bool>::get(), PROPERTY_NONE},
198 { OUString( "PrintRightPages" ), HANDLE_PRINTSET_RIGHT_PAGES , cppu::UnoType<bool>::get(), PROPERTY_NONE},
199 { OUString( "PrintFaxName" ), HANDLE_PRINTSET_FAX_NAME , cppu::UnoType<OUString>::get(), PROPERTY_NONE},
200 { OUString( "PrintPaperFromSetup" ), HANDLE_PRINTSET_PAPER_FROM_SETUP , cppu::UnoType<bool>::get(), PROPERTY_NONE},
201 { OUString( "PrintTables" ), HANDLE_PRINTSET_TABLES , cppu::UnoType<bool>::get(), PROPERTY_NONE},
202 { OUString( "PrintTextPlaceholder"), HANDLE_PRINTSET_PLACEHOLDER , cppu::UnoType<bool>::get(), PROPERTY_NONE},
203 { OUString( "PrintSingleJobs" ), HANDLE_PRINTSET_SINGLE_JOBS , cppu::UnoType<bool>::get(), PROPERTY_NONE},
204 { OUString( "PrintEmptyPages" ), HANDLE_PRINTSET_EMPTY_PAGES , cppu::UnoType<bool>::get(), PROPERTY_NONE},
205 { OUString(), 0, css::uno::Type(), 0}
206 };
207 return new ChainablePropertySetInfo ( aPrintSettingsMap_Impl );
208}
209
211{
212}
213
215{
216}
217
218Reference< XPropertySet > SwXModule::getViewSettings()
219{
220 SolarMutexGuard aGuard;
221 if(!mxViewSettings.is())
222 {
223 OSL_FAIL("Web or Text?");
224 mxViewSettings = new SwXViewSettings( nullptr );
225 }
226 return mxViewSettings;
227}
228
229Reference< XPropertySet > SwXModule::getPrintSettings()
230{
231 SolarMutexGuard aGuard;
232 if(!mxPrintSettings.is())
233 {
234 OSL_FAIL("Web or Text?");
236 }
237 return mxPrintSettings;
238}
239
241{
242 return "SwXModule";
243}
244
245sal_Bool SwXModule::supportsService(const OUString& rServiceName)
246{
247 return cppu::supportsService(this, rServiceName);
248}
249
251{
252 return { "com.sun.star.text.GlobalSettings" };
253}
254
256: ChainablePropertySet ( lcl_createPrintSettingsInfo().get(), &Application::GetSolarMutex() )
257, meType(eType)
258, mpPrtOpt ( nullptr )
259, mpDoc ( pDoc )
260{
261}
262
264 noexcept
265{
266}
267
269{
270 switch (meType)
271 {
273 mpPrtOpt = SW_MOD()->GetPrtOptions( false );
274 break;
276 {
277 if (!mpDoc)
278 throw IllegalArgumentException ();
280 }
281 break;
282 }
283}
284
285namespace
286{
287 bool tryBoolAccess(const uno::Any &rValue)
288 {
289 const auto xPrSet = o3tl::tryAccess<bool>(rValue);
290 if (!xPrSet)
291 throw lang::IllegalArgumentException();
292 return *xPrSet;
293 }
294}
295
297{
298 switch( rInfo.mnHandle )
299 {
300 case HANDLE_PRINTSET_LEFT_PAGES:
301 {
302 mpPrtOpt->SetPrintLeftPage(tryBoolAccess(rValue));
303 }
304 break;
305 case HANDLE_PRINTSET_RIGHT_PAGES:
306 {
307 mpPrtOpt->SetPrintRightPage(tryBoolAccess(rValue));
308 }
309 break;
310 case HANDLE_PRINTSET_REVERSED:
311 {
312 mpPrtOpt->SetPrintReverse(tryBoolAccess(rValue));
313 }
314 break;
315 case HANDLE_PRINTSET_PROSPECT:
316 {
317 mpPrtOpt->SetPrintProspect(tryBoolAccess(rValue));
318 }
319 break;
320 case HANDLE_PRINTSET_GRAPHICS:
321 {
322 mpPrtOpt->SetPrintGraphic(tryBoolAccess(rValue));
323 }
324 break;
325 case HANDLE_PRINTSET_TABLES:
326 {
327 mpPrtOpt->SetPrintTable(tryBoolAccess(rValue));
328 }
329 break;
330 case HANDLE_PRINTSET_DRAWINGS:
331 {
332 mpPrtOpt->SetPrintDraw(tryBoolAccess(rValue));
333 }
334 break;
335 case HANDLE_PRINTSET_CONTROLS:
336 {
337 mpPrtOpt->SetPrintControl(tryBoolAccess(rValue));
338 }
339 break;
340 case HANDLE_PRINTSET_PAGE_BACKGROUND:
341 {
342 mpPrtOpt->SetPrintPageBackground(tryBoolAccess(rValue));
343 }
344 break;
345 case HANDLE_PRINTSET_BLACK_FONTS:
346 {
347 mpPrtOpt->SetPrintBlackFont(tryBoolAccess(rValue));
348 }
349 break;
350 case HANDLE_PRINTSET_SINGLE_JOBS:
351 {
352 mpPrtOpt->SetPrintSingleJobs(tryBoolAccess(rValue));
353 }
354 break;
355 case HANDLE_PRINTSET_PAPER_FROM_SETUP:
356 {
357 mpPrtOpt->SetPaperFromSetup(tryBoolAccess(rValue));
358 }
359 break;
360 case HANDLE_PRINTSET_ANNOTATION_MODE:
361 {
362 sal_Int16 nTmp = 0;
363 rValue >>= nTmp;
364 SwPostItMode nVal = static_cast<SwPostItMode>(nTmp);
365 if(nVal > SwPostItMode::EndPage)
366 throw lang::IllegalArgumentException();
367
369 }
370 break;
371 case HANDLE_PRINTSET_EMPTY_PAGES:
372 {
373 mpPrtOpt->SetPrintEmptyPages(tryBoolAccess(rValue));
374 }
375 break;
376 case HANDLE_PRINTSET_FAX_NAME:
377 {
378 OUString sString;
379 if ( !(rValue >>= sString))
380 throw lang::IllegalArgumentException();
381
382 mpPrtOpt->SetFaxName(sString);
383 }
384 break;
385 case HANDLE_PRINTSET_PROSPECT_RTL:
386 {
387 mpPrtOpt->SetPrintProspect_RTL(tryBoolAccess(rValue));
388 }
389 break;
390 case HANDLE_PRINTSET_PLACEHOLDER:
391 {
392 mpPrtOpt->SetPrintTextPlaceholder(tryBoolAccess(rValue));
393 }
394 break;
395 case HANDLE_PRINTSET_HIDDEN_TEXT:
396 {
397 mpPrtOpt->SetPrintHiddenText(tryBoolAccess(rValue));
398 }
399 break;
400 default:
401 throw UnknownPropertyException(OUString::number(rInfo.mnHandle));
402 }
403}
404
406{
407 mpPrtOpt = nullptr;
408}
409
411{
412 switch (meType)
413 {
415 mpPrtOpt = SW_MOD()->GetPrtOptions( false );
416 break;
418 {
419 if (!mpDoc)
420 throw IllegalArgumentException ();
422 }
423 break;
424 }
425}
426
428{
429 switch( rInfo.mnHandle )
430 {
431 case HANDLE_PRINTSET_LEFT_PAGES:
432 rValue <<= mpPrtOpt->IsPrintLeftPage();
433 break;
434 case HANDLE_PRINTSET_RIGHT_PAGES:
435 rValue <<= mpPrtOpt->IsPrintRightPage();
436 break;
437 case HANDLE_PRINTSET_REVERSED:
438 rValue <<= mpPrtOpt->IsPrintReverse();
439 break;
440 case HANDLE_PRINTSET_PROSPECT:
441 rValue <<= mpPrtOpt->IsPrintProspect();
442 break;
443 case HANDLE_PRINTSET_GRAPHICS:
444 rValue <<= mpPrtOpt->IsPrintGraphic();
445 break;
446 case HANDLE_PRINTSET_TABLES:
447 rValue <<= mpPrtOpt->IsPrintTable();
448 break;
449 case HANDLE_PRINTSET_DRAWINGS:
450 rValue <<= mpPrtOpt->IsPrintDraw();
451 break;
452 case HANDLE_PRINTSET_CONTROLS:
453 rValue <<= mpPrtOpt->IsPrintControl();
454 break;
455 case HANDLE_PRINTSET_PAGE_BACKGROUND:
456 rValue <<= mpPrtOpt->IsPrintPageBackground();
457 break;
458 case HANDLE_PRINTSET_BLACK_FONTS:
459 rValue <<= mpPrtOpt->IsPrintBlackFont();
460 break;
461 case HANDLE_PRINTSET_SINGLE_JOBS:
462 rValue <<= mpPrtOpt->IsPrintSingleJobs();
463 break;
464 case HANDLE_PRINTSET_EMPTY_PAGES:
465 rValue <<= mpPrtOpt->IsPrintEmptyPages();
466 break;
467 case HANDLE_PRINTSET_PAPER_FROM_SETUP:
468 rValue <<= mpPrtOpt->IsPaperFromSetup();
469 break;
470 case HANDLE_PRINTSET_ANNOTATION_MODE:
471 {
472 rValue <<= static_cast < sal_Int16 > ( mpPrtOpt->GetPrintPostIts() );
473 }
474 break;
475 case HANDLE_PRINTSET_FAX_NAME :
476 {
477 rValue <<= mpPrtOpt->GetFaxName();
478 }
479 break;
480 case HANDLE_PRINTSET_PROSPECT_RTL:
481 {
482 rValue <<= mpPrtOpt->IsPrintProspectRTL();
483 }
484 break;
485 case HANDLE_PRINTSET_PLACEHOLDER:
486 {
487 rValue <<= mpPrtOpt->IsPrintTextPlaceholder();
488 }
489 break;
490 case HANDLE_PRINTSET_HIDDEN_TEXT:
491 {
492 rValue <<= mpPrtOpt->IsPrintHiddenText();
493 }
494 break;
495 default:
496 throw UnknownPropertyException(OUString::number(rInfo.mnHandle));
497 }
498}
499
501{
502 mpPrtOpt = nullptr;
503}
504
506{
507 return "SwXPrintSettings";
508}
509
510sal_Bool SwXPrintSettings::supportsService(const OUString& rServiceName)
511{
512 return cppu::supportsService(this, rServiceName);
513}
514
516{
517 Sequence<OUString> aRet { "com.sun.star.text.PrintSettings" };
518 return aRet;
519}
520
522 : ChainablePropertySet( lcl_createViewSettingsInfo().get(), &Application::GetSolarMutex() )
523 , m_pView(pVw)
524 , mpConstViewOption(nullptr)
525 , m_bObjectValid(true)
526 , mbApplyZoom(false)
527 , m_eHRulerUnit(FieldUnit::CM)
528 , mbApplyHRulerMetric(false)
529 , m_eVRulerUnit(FieldUnit::CM)
530 , mbApplyVRulerMetric(false)
531{
532 // This property only exists if we have a view (ie, not at the module )
533 if ( !m_pView )
534 mxInfo->remove ( "HelpURL" );
535
536}
537
539 noexcept
540{
541
542}
543
545{
546 const SwViewOption* pVOpt = nullptr;
547 if(m_pView)
548 {
549 if(!IsValid())
550 return;
552 }
553 else
554 pVOpt = SW_MOD()->GetViewOption(false);
555
556 mpViewOption.reset( new SwViewOption (*pVOpt) );
557 mbApplyZoom = false;
558 if(m_pView)
559 mpViewOption->SetStarOneSetting(true);
560}
561
563{
564 // the API flag should not be set to the application's view settings
565 switch( rInfo.mnHandle )
566 {
567 case HANDLE_VIEWSET_SHOW_RULER : mpViewOption->SetViewAnyRuler(*o3tl::doAccess<bool>(rValue)); break;
568 case HANDLE_VIEWSET_HRULER : mpViewOption->SetViewHRuler(*o3tl::doAccess<bool>(rValue)); break;
569 case HANDLE_VIEWSET_VRULER : mpViewOption->SetViewVRuler(*o3tl::doAccess<bool>(rValue));break;
570 case HANDLE_VIEWSET_VRULER_RIGHT : mpViewOption->SetVRulerRight(*o3tl::doAccess<bool>(rValue));break;
571 case HANDLE_VIEWSET_HSCROLL : mpViewOption->SetViewHScrollBar(*o3tl::doAccess<bool>(rValue));break;
572 case HANDLE_VIEWSET_VSCROLL : mpViewOption->SetViewVScrollBar(*o3tl::doAccess<bool>(rValue));break;
573 case HANDLE_VIEWSET_GRAPHICS : mpViewOption->SetGraphic(*o3tl::doAccess<bool>(rValue));break;
574 case HANDLE_VIEWSET_TABLES : mpViewOption->SetTable(*o3tl::doAccess<bool>(rValue)); break;
575 case HANDLE_VIEWSET_DRAWINGS : mpViewOption->SetDraw(*o3tl::doAccess<bool>(rValue)); break;
576 case HANDLE_VIEWSET_FIELD_COMMANDS : mpViewOption->SetFieldName(*o3tl::doAccess<bool>(rValue)); break;
577 case HANDLE_VIEWSET_ANNOTATIONS : mpViewOption->SetPostIts(*o3tl::doAccess<bool>(rValue)); break;
578 case HANDLE_VIEWSET_INDEX_MARK_BACKGROUND : mpViewOption->SetAppearanceFlag(ViewOptFlags::FieldShadings, *o3tl::doAccess<bool>(rValue), true); break;
579 case HANDLE_VIEWSET_NONPRINTING_CHARACTERS: mpViewOption->SetViewMetaChars( *o3tl::doAccess<bool>(rValue) ); break;
580 case HANDLE_VIEWSET_FOOTNOTE_BACKGROUND : mpViewOption->SetAppearanceFlag(ViewOptFlags::FieldShadings, *o3tl::doAccess<bool>(rValue), true); break;
581 case HANDLE_VIEWSET_TEXT_FIELD_BACKGROUND : mpViewOption->SetAppearanceFlag(ViewOptFlags::FieldShadings, *o3tl::doAccess<bool>(rValue), true); break;
582 case HANDLE_VIEWSET_PARA_BREAKS : mpViewOption->SetParagraph(*o3tl::doAccess<bool>(rValue)); break;
583 case HANDLE_VIEWSET_SOFT_HYPHENS : mpViewOption->SetSoftHyph(*o3tl::doAccess<bool>(rValue)); break;
584 case HANDLE_VIEWSET_SPACES : mpViewOption->SetBlank(*o3tl::doAccess<bool>(rValue)); break;
585 case HANDLE_VIEWSET_PROTECTED_SPACES : mpViewOption->SetHardBlank(*o3tl::doAccess<bool>(rValue)); break;
586 case HANDLE_VIEWSET_TABSTOPS : mpViewOption->SetTab(*o3tl::doAccess<bool>(rValue)); break;
587 case HANDLE_VIEWSET_BREAKS : mpViewOption->SetLineBreak(*o3tl::doAccess<bool>(rValue)); break;
588 case HANDLE_VIEWSET_BOOKMARKS : mpViewOption->SetShowBookmarks(*o3tl::doAccess<bool>(rValue)); break;
589 case HANDLE_VIEWSET_HIDDEN_TEXT : mpViewOption->SetShowHiddenField(*o3tl::doAccess<bool>(rValue)); break;
590 case HANDLE_VIEWSET_HIDDEN_CHARACTERS : mpViewOption->SetShowHiddenChar(*o3tl::doAccess<bool>(rValue)); break;
591 case HANDLE_VIEWSET_HIDDEN_PARAGRAPHS : mpViewOption->SetShowHiddenPara(*o3tl::doAccess<bool>(rValue)); break;
592 case HANDLE_VIEWSET_TABLE_BOUNDARIES : mpViewOption->SetAppearanceFlag(ViewOptFlags::TableBoundaries, *o3tl::doAccess<bool>(rValue), true); break;
593 case HANDLE_VIEWSET_TEXT_BOUNDARIES : mpViewOption->SetDocBoundaries(*o3tl::doAccess<bool>(rValue)); break;
594 case HANDLE_VIEWSET_SMOOTH_SCROLLING : mpViewOption->SetSmoothScroll(*o3tl::doAccess<bool>(rValue)); break;
595 case HANDLE_VIEWSET_SHOW_CONTENT_TIPS : mpViewOption->SetShowContentTips(*o3tl::doAccess<bool>(rValue)); break;
596 case HANDLE_VIEWSET_IS_RASTER_VISIBLE : mpViewOption->SetGridVisible(*o3tl::doAccess<bool>(rValue)); break;
597 case HANDLE_VIEWSET_IS_SNAP_TO_RASTER : mpViewOption->SetSnap(*o3tl::doAccess<bool>(rValue)); break;
598 case HANDLE_VIEWSET_SCROLLBAR_TIPS : mpViewOption->SetShowScrollBarTips(*o3tl::doAccess<bool>(rValue)); break;
599 case HANDLE_VIEWSET_INLINECHANGES_TIPS : mpViewOption->SetShowInlineTooltips(*o3tl::doAccess<bool>(rValue)); break;
600 case HANDLE_VIEWSET_USE_HEADERFOOTERMENU : mpViewOption->SetUseHeaderFooterMenu(*o3tl::doAccess<bool>(rValue)); break;
601 case HANDLE_VIEWSET_SHOW_OUTLINECONTENTVISIBILITYBUTTON : mpViewOption->SetShowOutlineContentVisibilityButton(*o3tl::doAccess<bool>(rValue)); break;
602 case HANDLE_VIEWSET_TREAT_SUB_OUTLINE_LEVELS_AS_CONTENT : mpViewOption->SetTreatSubOutlineLevelsAsContent(*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() );
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() );
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(o3tl::narrowing<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 ( m_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 ( m_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 ( !m_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
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 m_eHRulerUnit = static_cast<FieldUnit>(nUnit);
749 mbApplyHRulerMetric = true;
750 }
751 else
752 {
753 m_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( m_pView )
770 {
771 if(mbApplyZoom )
772 m_pView->SetZoom( mpViewOption->GetZoomType(),
773 mpViewOption->GetZoom(), true );
778
779 }
780 else
781 {
783 SW_MOD()->ApplyRulerMetric( m_eHRulerUnit, true, false );
785 SW_MOD()->ApplyRulerMetric( m_eVRulerUnit, false, false );
786 }
787
790
791 mpViewOption.reset();
792}
793
795{
796 if(m_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 = mpConstViewOption->IsFieldShadings(); break;
824 case HANDLE_VIEWSET_NONPRINTING_CHARACTERS: bBoolVal = mpConstViewOption->IsViewMetaChars(); break;
825 case HANDLE_VIEWSET_FOOTNOTE_BACKGROUND : bBoolVal = mpConstViewOption->IsFieldShadings(); break;
826 case HANDLE_VIEWSET_TEXT_FIELD_BACKGROUND : bBoolVal = mpConstViewOption->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 = mpConstViewOption->IsTableBoundaries(); break;
839 case HANDLE_VIEWSET_TEXT_BOUNDARIES : bBoolVal = mpConstViewOption->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);
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(m_pView)
898 break;
899 case HANDLE_VIEWSET_HELP_URL :
900 {
901 if ( !m_pView )
902 throw UnknownPropertyException();
903
904 bBool = false;
905 SwEditWin &rEditWin = m_pView->GetEditWin();
906 OUString sHelpURL = INET_HID_SCHEME + rEditWin.GetHelpId();
907 rValue <<= sHelpURL;
908 }
909 break;
910 case HANDLE_VIEWSET_HORI_RULER_METRIC:
911 {
912 if ( m_pView )
913 {
914 FieldUnit eUnit;
915 m_pView->GetHRulerMetric( eUnit );
916 rValue <<= static_cast<sal_Int32>(eUnit);
917 }
918 else
919 {
920 const SwMasterUsrPref* pUsrPref = SW_MOD()->GetUsrPref( false );
921 rValue <<= static_cast<sal_Int32>(pUsrPref->GetHScrollMetric());
922 }
923 bBool = false;
924 }
925 break;
926 case HANDLE_VIEWSET_VERT_RULER_METRIC:
927 {
928 if ( m_pView )
929 {
930 FieldUnit eUnit;
931 m_pView->GetVRulerMetric( eUnit );
932 rValue <<= static_cast<sal_Int32>(eUnit);
933 }
934 else
935 {
936 const SwMasterUsrPref* pUsrPref = SW_MOD()->GetUsrPref( false );
937 rValue <<= static_cast<sal_Int32>(pUsrPref->GetVScrollMetric());
938 }
939 bBool = false;
940 }
941 break;
942 default: OSL_FAIL("there is no such ID!");
943 }
944 if( bBool )
945 rValue <<= bBoolVal;
946}
947
949{
950 mpConstViewOption = nullptr;
951}
952
954{
955 return "SwXViewSettings";
956}
957
958sal_Bool SwXViewSettings::supportsService(const OUString& rServiceName)
959{
960 return cppu::supportsService(this, rServiceName);
961}
962
964{
965 Sequence<OUString> aRet { "com.sun.star.text.ViewSettings" };
966 return aRet;
967}
968
969extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
970SwXModule_get_implementation(css::uno::XComponentContext*,
971 css::uno::Sequence<css::uno::Any> const &)
972{
973 return cppu::acquire(new SwXModule());
974}
975
976/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr auto convertTwipToMm100(N n)
virtual const SwPrintData & getPrintData() const =0
Returns the PrintData.
OUString GetURLPath(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
INetProtocol GetProtocol() const
constexpr tools::Long Height() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
void ToggleLayoutMode(SwView *pView)
Definition: docsh2.cxx:154
Definition: doc.hxx:197
IDocumentDeviceAccess const & getIDocumentDeviceAccess() const
Definition: doc.cxx:252
Window class for the Writer edit area, this is the one handling mouse and keyboard events and doing t...
Definition: edtwin.hxx:61
FieldUnit GetHScrollMetric() const
Definition: usrpref.hxx:217
FieldUnit GetVScrollMetric() const
Definition: usrpref.hxx:225
SwPostItMode GetPrintPostIts() const
Definition: printdata.hxx:145
void SetPrintReverse(bool b)
Definition: printdata.hxx:156
bool IsPrintReverse() const
Definition: printdata.hxx:137
void SetPrintHiddenText(bool b)
Definition: printdata.hxx:166
void SetPrintTable(bool b)
Definition: printdata.hxx:151
bool IsPrintBlackFont() const
Definition: printdata.hxx:143
bool IsPrintLeftPage() const
Definition: printdata.hxx:135
void SetPrintRightPage(bool b)
Definition: printdata.hxx:155
void SetPrintBlackFont(bool b)
Definition: printdata.hxx:163
bool IsPrintProspect() const
Definition: printdata.hxx:140
void SetFaxName(const OUString &rSet)
Definition: printdata.hxx:165
void SetPrintLeftPage(bool b)
Definition: printdata.hxx:154
void SetPaperFromSetup(bool b)
Definition: printdata.hxx:157
bool IsPrintRightPage() const
Definition: printdata.hxx:136
bool IsPrintControl() const
Definition: printdata.hxx:134
bool IsPrintTextPlaceholder() const
Definition: printdata.hxx:148
void SetPrintProspect_RTL(bool b)
Definition: printdata.hxx:161
bool IsPaperFromSetup() const
Definition: printdata.hxx:138
void SetPrintDraw(bool b)
Definition: printdata.hxx:152
void SetPrintSingleJobs(bool b)
Definition: printdata.hxx:164
bool IsPrintProspectRTL() const
Definition: printdata.hxx:141
void SetPrintTextPlaceholder(bool b)
Definition: printdata.hxx:167
void SetPrintGraphic(bool b)
Definition: printdata.hxx:150
bool IsPrintEmptyPages() const
Definition: printdata.hxx:139
void SetPrintControl(bool b)
Definition: printdata.hxx:153
bool IsPrintSingleJobs() const
Definition: printdata.hxx:144
void SetPrintPostIts(SwPostItMode n)
Definition: printdata.hxx:159
bool IsPrintGraphic() const
Definition: printdata.hxx:131
void SetPrintProspect(bool b)
Definition: printdata.hxx:160
void SetPrintEmptyPages(bool b)
Definition: printdata.hxx:158
bool IsPrintDraw() const
Definition: printdata.hxx:133
bool IsPrintPageBackground() const
Definition: printdata.hxx:142
bool IsPrintHiddenText() const
Definition: printdata.hxx:147
void SetPrintPageBackground(bool b)
Definition: printdata.hxx:162
const OUString & GetFaxName() const
Definition: printdata.hxx:146
bool IsPrintTable() const
Definition: printdata.hxx:132
bool IsViewHRuler(bool bDirect=false) const
Definition: viewopt.hxx:756
bool IsHideWhitespaceMode() const
Definition: viewopt.hxx:647
bool IsParagraph(bool bHard=false) const
Definition: viewopt.hxx:369
void SetHideWhitespaceMode(bool bMode)
Definition: viewopt.hxx:648
bool IsVRulerRight() const
Definition: viewopt.hxx:791
bool IsSmoothScroll() const
Definition: viewopt.hxx:574
bool IsShowBookmarks(bool const bHard=false) const
Definition: viewopt.hxx:383
bool IsBlank(bool bHard=false) const
Definition: viewopt.hxx:351
bool IsGridVisible() const
Definition: viewopt.hxx:532
SvxZoomType GetZoomType() const
Definition: viewopt.hxx:710
bool IsShowHiddenField() const
Definition: viewopt.hxx:494
bool IsTable() const
Definition: viewopt.hxx:509
bool IsShowHiddenPara() const
Definition: viewopt.hxx:568
short GetDivisionY() const
Definition: viewopt.hxx:610
bool IsHardBlank() const
Definition: viewopt.hxx:360
sal_uInt16 GetZoom() const
Definition: viewopt.hxx:669
bool IsShowScrollBarTips() const
Definition: viewopt.hxx:707
bool IsViewAnyRuler() const
Definition: viewopt.hxx:745
bool IsViewHScrollBar() const
Definition: viewopt.hxx:691
const Size & GetSnapSize() const
Definition: viewopt.hxx:530
bool IsShowContentTips() const
Definition: viewopt.hxx:703
bool getBrowseMode() const
Definition: viewopt.hxx:636
bool IsShowHiddenChar(bool bHard=false) const
Definition: viewopt.hxx:487
bool IsViewVRuler(bool bDirect=false) const
Definition: viewopt.hxx:770
bool IsGraphic() const
Definition: viewopt.hxx:499
bool IsViewVScrollBar() const
Definition: viewopt.hxx:683
bool IsSoftHyph() const
Definition: viewopt.hxx:409
bool IsFieldName() const
Definition: viewopt.hxx:417
bool IsTableBoundaries() const
Definition: viewopt.hxx:831
bool IsPostIts() const
Definition: viewopt.hxx:425
bool IsViewMetaChars() const
Definition: viewopt.hxx:546
bool IsLineBreak(bool bHard=false) const
Definition: viewopt.hxx:389
bool IsTab(bool bHard=false) const
Definition: viewopt.hxx:342
short GetDivisionX() const
Definition: viewopt.hxx:608
bool IsDocBoundaries() const
Definition: viewopt.hxx:829
bool IsShowInlineTooltips() const
Definition: viewopt.hxx:446
bool IsShowChangesInMargin() const
Definition: viewopt.hxx:455
bool IsFieldShadings() const
Definition: viewopt.hxx:835
void setBrowseMode(bool bSet)
Definition: viewopt.hxx:637
bool IsSnap() const
Definition: viewopt.hxx:524
bool IsDraw() const
Definition: viewopt.hxx:514
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:452
Definition: view.hxx:146
void GetHRulerMetric(FieldUnit &rToFill) const
Definition: viewmdi.cxx:684
SwWrtShell & GetWrtShell() const
Definition: view.hxx:423
void GetVRulerMetric(FieldUnit &rToFill) const
Definition: viewmdi.cxx:679
void ChangeVRulerMetric(FieldUnit eUnit)
Definition: viewmdi.cxx:670
SwEditWin & GetEditWin()
Definition: view.hxx:426
SwDocShell * GetDocShell()
Definition: view.cxx:1193
void SetZoom(SvxZoomType eZoomType, short nFactor=100, bool bViewOnly=false)
Definition: viewmdi.cxx:73
void ChangeTabMetric(FieldUnit eUnit)
Definition: viewmdi.cxx:661
virtual void ApplyViewOptions(const SwViewOption &rOpt) override
Apply ViewOptions with Start-/EndAction.
Definition: wrtsh1.cxx:2122
virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getViewSettings() override
Definition: unomod.cxx:218
virtual ~SwXModule() override
Definition: unomod.cxx:214
css::uno::Reference< css::beans::XPropertySet > mxViewSettings
Definition: unomod.hxx:46
virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getPrintSettings() override
Definition: unomod.cxx:229
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unomod.cxx:250
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unomod.cxx:245
virtual OUString SAL_CALL getImplementationName() override
Definition: unomod.cxx:240
SwXModule()
Definition: unomod.cxx:210
css::uno::Reference< css::beans::XPropertySet > mxPrintSettings
Definition: unomod.hxx:47
virtual void _getSingleValue(const comphelper::PropertyInfo &rInfo, css::uno::Any &rValue) override
Definition: unomod.cxx:427
virtual void _postGetValues() override
Definition: unomod.cxx:500
virtual ~SwXPrintSettings() noexcept override
Definition: unomod.cxx:263
SwPrintData * mpPrtOpt
Definition: unomod.hxx:76
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unomod.cxx:510
SwDoc * mpDoc
Definition: unomod.hxx:77
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unomod.cxx:515
virtual void _postSetValues() override
Definition: unomod.cxx:405
SwXPrintSettingsType meType
Definition: unomod.hxx:75
SwXPrintSettings(SwXPrintSettingsType eType, SwDoc *pDoc=nullptr)
Definition: unomod.cxx:255
virtual void _setSingleValue(const comphelper::PropertyInfo &rInfo, const css::uno::Any &rValue) override
Definition: unomod.cxx:296
virtual OUString SAL_CALL getImplementationName() override
Definition: unomod.cxx:505
virtual void _preGetValues() override
Definition: unomod.cxx:410
virtual void _preSetValues() override
Definition: unomod.cxx:268
Implements com.sun.star.text.ViewSettings: UNO access to per-view settings (e.g.
Definition: unomod.hxx:104
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unomod.cxx:963
virtual void _postGetValues() override
Definition: unomod.cxx:948
virtual void _preGetValues() override
Definition: unomod.cxx:794
bool mbApplyZoom
Definition: unomod.hxx:110
virtual ~SwXViewSettings() noexcept override
Definition: unomod.cxx:538
virtual void _getSingleValue(const comphelper::PropertyInfo &rInfo, css::uno::Any &rValue) override
Definition: unomod.cxx:806
virtual void _setSingleValue(const comphelper::PropertyInfo &rInfo, const css::uno::Any &rValue) override
Definition: unomod.cxx:562
std::unique_ptr< SwViewOption > mpViewOption
Definition: unomod.hxx:108
SwXViewSettings(SwView *pView)
Definition: unomod.cxx:521
bool IsValid() const
Definition: unomod.hxx:135
const SwViewOption * mpConstViewOption
Definition: unomod.hxx:109
virtual OUString SAL_CALL getImplementationName() override
Definition: unomod.cxx:953
virtual void _preSetValues() override
Definition: unomod.cxx:544
FieldUnit m_eHRulerUnit
Definition: unomod.hxx:112
FieldUnit m_eVRulerUnit
Definition: unomod.hxx:114
bool mbApplyVRulerMetric
Definition: unomod.hxx:115
virtual void _postSetValues() override
Definition: unomod.cxx:767
bool mbApplyHRulerMetric
Definition: unomod.hxx:113
SwView * m_pView
Definition: unomod.hxx:107
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unomod.cxx:958
rtl::Reference< ChainablePropertySetInfo > mxInfo
css::uno::Type const & get()
const OUString & GetHelpId() const
void SetHelpId(const OUString &)
FieldUnit
DocumentType eType
#define PROPERTY_NONE
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
detail::Optional< bool >::type tryAccess< bool >(css::uno::Any const &any)
constexpr auto toTwips(N number, Length from)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
SwPostItMode
this must match the definitions in css::text::NotePrintMode
Definition: printdata.hxx:43
#define SW_MOD()
Definition: swmodule.hxx:254
unsigned char sal_Bool
static rtl::Reference< ChainablePropertySetInfo > lcl_createViewSettingsInfo()
Definition: unomod.cxx:126
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SwXModule_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
Definition: unomod.cxx:970
static rtl::Reference< ChainablePropertySetInfo > lcl_createPrintSettingsInfo()
Definition: unomod.cxx:183
SwXPrintSettingsType
Definition: unomod.hxx:66
constexpr OUStringLiteral INET_HID_SCHEME
#define MINZOOM
Definition: view.hxx:81
#define MAXZOOM
Definition: view.hxx:82
RedlineType meType
SvxZoomType