1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <swtypes.hxx>
21 #include <osl/diagnose.h>
24 #include <unoprnms.hxx>
27 #include <tools/shl.hxx>
28 #include <swmodule.hxx>
32 #include <viewopt.hxx>
33 #include <osl/mutex.hxx>
34 #include <vcl/svapp.hxx>
35 #include <com/sun/star/text/NotePrintMode.hpp>
37 #include <comphelper/TypeGeneration.hxx>
38 #include <com/sun/star/beans/PropertyAttribute.hpp>
39 #include <com/sun/star/view/DocumentZoomType.hpp>
40 #include <comphelper/ChainablePropertySetInfo.hxx>
42 #include <rtl/ustrbuf.hxx>
43 #include <tools/urlobj.hxx>
44 using namespace ::com::sun::star
;
45 using namespace ::com::sun::star::uno
;
46 using namespace ::com::sun::star::beans
;
47 using namespace ::com::sun::star::lang
;
48 using namespace ::comphelper
;
50 enum SwViewSettingsPropertyHandles
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
,
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
94 enum SwPrintSettingsPropertyHandles
96 HANDLE_PRINTSET_ANNOTATION_MODE
,
97 HANDLE_PRINTSET_BLACK_FONTS
,
98 HANDLE_PRINTSET_CONTROLS
,
99 HANDLE_PRINTSET_DRAWINGS
,
100 HANDLE_PRINTSET_GRAPHICS
,
101 HANDLE_PRINTSET_LEFT_PAGES
,
102 HANDLE_PRINTSET_PAGE_BACKGROUND
,
103 HANDLE_PRINTSET_PROSPECT
,
104 HANDLE_PRINTSET_REVERSED
,
105 HANDLE_PRINTSET_RIGHT_PAGES
,
106 HANDLE_PRINTSET_FAX_NAME
,
107 HANDLE_PRINTSET_PAPER_FROM_SETUP
,
108 HANDLE_PRINTSET_TABLES
,
109 HANDLE_PRINTSET_SINGLE_JOBS
,
110 HANDLE_PRINTSET_EMPTY_PAGES
,
111 HANDLE_PRINTSET_PROSPECT_RTL
,
112 HANDLE_PRINTSET_PLACEHOLDER
,
113 HANDLE_PRINTSET_HIDDEN_TEXT
116 static ChainablePropertySetInfo
* lcl_createViewSettingsInfo()
118 static PropertyInfo aViewSettingsMap_Impl
[] =
120 { RTL_CONSTASCII_STRINGPARAM ( "HelpURL" ), HANDLE_VIEWSET_HELP_URL
, CPPUTYPE_OUSTRING
, PROPERTY_NONE
, 0},
121 { RTL_CONSTASCII_STRINGPARAM ( "HorizontalRulerMetric"),HANDLE_VIEWSET_HORI_RULER_METRIC
, CPPUTYPE_INT32
, PROPERTY_NONE
, 0},
122 { RTL_CONSTASCII_STRINGPARAM ( "IsRasterVisible"), HANDLE_VIEWSET_IS_RASTER_VISIBLE
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
123 { RTL_CONSTASCII_STRINGPARAM ( "IsSnapToRaster"), HANDLE_VIEWSET_IS_SNAP_TO_RASTER
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
124 { RTL_CONSTASCII_STRINGPARAM ( "IsVertRulerRightAligned"),HANDLE_VIEWSET_VRULER_RIGHT
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
125 { RTL_CONSTASCII_STRINGPARAM ( "ShowContentTips" ), HANDLE_VIEWSET_SHOW_CONTENT_TIPS
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
126 { RTL_CONSTASCII_STRINGPARAM ( "RasterResolutionX"), HANDLE_VIEWSET_RASTER_RESOLUTION_X
, CPPUTYPE_INT32
, PROPERTY_NONE
, 0},
127 { RTL_CONSTASCII_STRINGPARAM ( "RasterResolutionY"), HANDLE_VIEWSET_RASTER_RESOLUTION_Y
, CPPUTYPE_INT32
, PROPERTY_NONE
, 0},
128 { RTL_CONSTASCII_STRINGPARAM ( "RasterSubdivisionX"), HANDLE_VIEWSET_RASTER_SUBDIVISION_X
, CPPUTYPE_INT32
, PROPERTY_NONE
, 0},
129 { RTL_CONSTASCII_STRINGPARAM ( "RasterSubdivisionY"), HANDLE_VIEWSET_RASTER_SUBDIVISION_Y
, CPPUTYPE_INT32
, PROPERTY_NONE
, 0},
130 { RTL_CONSTASCII_STRINGPARAM ( "ShowAnnotations" ), HANDLE_VIEWSET_ANNOTATIONS
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
131 { RTL_CONSTASCII_STRINGPARAM ( "ShowBreaks"), HANDLE_VIEWSET_BREAKS
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
132 { RTL_CONSTASCII_STRINGPARAM ( "ShowDrawings"), HANDLE_VIEWSET_DRAWINGS
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
133 { RTL_CONSTASCII_STRINGPARAM ( "ShowFieldCommands"), HANDLE_VIEWSET_FIELD_COMMANDS
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
134 { RTL_CONSTASCII_STRINGPARAM ( "ShowFootnoteBackground"),HANDLE_VIEWSET_FOOTNOTE_BACKGROUND
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
135 { RTL_CONSTASCII_STRINGPARAM ( "ShowGraphics"), HANDLE_VIEWSET_GRAPHICS
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
136 { RTL_CONSTASCII_STRINGPARAM ( "ShowHiddenCharacters"), HANDLE_VIEWSET_HIDDEN_CHARACTERS
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
137 { RTL_CONSTASCII_STRINGPARAM ( "ShowHiddenParagraphs"), HANDLE_VIEWSET_HIDDEN_PARAGRAPHS
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
138 { RTL_CONSTASCII_STRINGPARAM ( "ShowHiddenText"), HANDLE_VIEWSET_HIDDEN_TEXT
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
139 { RTL_CONSTASCII_STRINGPARAM ( "ShowHoriRuler"), HANDLE_VIEWSET_HRULER
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
140 { RTL_CONSTASCII_STRINGPARAM ( "ShowHoriScrollBar"), HANDLE_VIEWSET_HSCROLL
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
141 { RTL_CONSTASCII_STRINGPARAM ( "ShowIndexMarkBackground"),HANDLE_VIEWSET_INDEX_MARK_BACKGROUND
, CPPUTYPE_BOOLEAN
,PROPERTY_NONE
, 0},
142 { RTL_CONSTASCII_STRINGPARAM ( "ShowNonprintingCharacters"),HANDLE_VIEWSET_NONPRINTING_CHARACTERS
, CPPUTYPE_BOOLEAN
,PROPERTY_NONE
, 0},
143 { RTL_CONSTASCII_STRINGPARAM ( "ShowOnlineLayout"), HANDLE_VIEWSET_ONLINE_LAYOUT
, CPPUTYPE_BOOLEAN
, PropertyAttribute::MAYBEVOID
, 0},
144 { RTL_CONSTASCII_STRINGPARAM ( "ShowParaBreaks"), HANDLE_VIEWSET_PARA_BREAKS
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
145 { RTL_CONSTASCII_STRINGPARAM ( "ShowProtectedSpaces"), HANDLE_VIEWSET_PROTECTED_SPACES
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
146 { RTL_CONSTASCII_STRINGPARAM ( "ShowRulers"), HANDLE_VIEWSET_SHOW_RULER
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
147 { RTL_CONSTASCII_STRINGPARAM ( "ShowSoftHyphens"), HANDLE_VIEWSET_SOFT_HYPHENS
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
148 { RTL_CONSTASCII_STRINGPARAM ( "ShowSpaces"), HANDLE_VIEWSET_SPACES
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
149 { RTL_CONSTASCII_STRINGPARAM ( "ShowTableBoundaries"), HANDLE_VIEWSET_TABLE_BOUNDARIES
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
150 { RTL_CONSTASCII_STRINGPARAM ( "ShowTables"), HANDLE_VIEWSET_TABLES
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
151 { RTL_CONSTASCII_STRINGPARAM ( "ShowTabstops"), HANDLE_VIEWSET_TABSTOPS
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
152 { RTL_CONSTASCII_STRINGPARAM ( "ShowTextBoundaries"), HANDLE_VIEWSET_TEXT_BOUNDARIES
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
153 { RTL_CONSTASCII_STRINGPARAM ( "ShowTextFieldBackground"),HANDLE_VIEWSET_TEXT_FIELD_BACKGROUND
, CPPUTYPE_BOOLEAN
,PROPERTY_NONE
, 0},
154 { RTL_CONSTASCII_STRINGPARAM ( "ShowVertRuler"), HANDLE_VIEWSET_VRULER
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
155 { RTL_CONSTASCII_STRINGPARAM ( "ShowVertScrollBar"), HANDLE_VIEWSET_VSCROLL
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
156 { RTL_CONSTASCII_STRINGPARAM ( "SmoothScrolling"), HANDLE_VIEWSET_SMOOTH_SCROLLING
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
157 { RTL_CONSTASCII_STRINGPARAM ( "VerticalRulerMetric"), HANDLE_VIEWSET_VERT_RULER_METRIC
, CPPUTYPE_INT32
, PROPERTY_NONE
, 0},
158 { RTL_CONSTASCII_STRINGPARAM ( "ZoomType"), HANDLE_VIEWSET_ZOOM_TYPE
, CPPUTYPE_INT16
, PROPERTY_NONE
, 0},
159 { RTL_CONSTASCII_STRINGPARAM ( "ZoomValue"), HANDLE_VIEWSET_ZOOM
, CPPUTYPE_INT16
, PROPERTY_NONE
, 0},
160 { 0, 0, 0, CPPUTYPE_UNKNOWN
, 0, 0 }
162 return new ChainablePropertySetInfo ( aViewSettingsMap_Impl
);
165 static ChainablePropertySetInfo
* lcl_createPrintSettingsInfo()
167 static PropertyInfo aPrintSettingsMap_Impl
[] =
169 { RTL_CONSTASCII_STRINGPARAM ( "PrintAnnotationMode" ), HANDLE_PRINTSET_ANNOTATION_MODE
, CPPUTYPE_INT16
, PROPERTY_NONE
, 0},
170 { RTL_CONSTASCII_STRINGPARAM ( "PrintBlackFonts" ), HANDLE_PRINTSET_BLACK_FONTS
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
171 { RTL_CONSTASCII_STRINGPARAM ( "PrintControls" ), HANDLE_PRINTSET_CONTROLS
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
172 { RTL_CONSTASCII_STRINGPARAM ( "PrintDrawings" ), HANDLE_PRINTSET_DRAWINGS
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
173 { RTL_CONSTASCII_STRINGPARAM ( "PrintGraphics" ), HANDLE_PRINTSET_GRAPHICS
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
174 { RTL_CONSTASCII_STRINGPARAM ( "PrintHiddenText"), HANDLE_PRINTSET_HIDDEN_TEXT
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
175 { RTL_CONSTASCII_STRINGPARAM ( "PrintLeftPages" ), HANDLE_PRINTSET_LEFT_PAGES
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
176 { RTL_CONSTASCII_STRINGPARAM ( "PrintPageBackground" ), HANDLE_PRINTSET_PAGE_BACKGROUND
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
177 { RTL_CONSTASCII_STRINGPARAM ( "PrintProspect" ), HANDLE_PRINTSET_PROSPECT
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
178 { RTL_CONSTASCII_STRINGPARAM ( "PrintProspectRTL" ), HANDLE_PRINTSET_PROSPECT_RTL
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
179 { RTL_CONSTASCII_STRINGPARAM ( "PrintReversed" ), HANDLE_PRINTSET_REVERSED
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
180 { RTL_CONSTASCII_STRINGPARAM ( "PrintRightPages" ), HANDLE_PRINTSET_RIGHT_PAGES
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
181 { RTL_CONSTASCII_STRINGPARAM ( "PrintFaxName" ), HANDLE_PRINTSET_FAX_NAME
, CPPUTYPE_OUSTRING
, PROPERTY_NONE
, 0},
182 { RTL_CONSTASCII_STRINGPARAM ( "PrintPaperFromSetup" ), HANDLE_PRINTSET_PAPER_FROM_SETUP
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
183 { RTL_CONSTASCII_STRINGPARAM ( "PrintTables" ), HANDLE_PRINTSET_TABLES
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
184 { RTL_CONSTASCII_STRINGPARAM ( "PrintTextPlaceholder"), HANDLE_PRINTSET_PLACEHOLDER
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
185 { RTL_CONSTASCII_STRINGPARAM ( "PrintSingleJobs" ), HANDLE_PRINTSET_SINGLE_JOBS
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
186 { RTL_CONSTASCII_STRINGPARAM ( "PrintEmptyPages" ), HANDLE_PRINTSET_EMPTY_PAGES
, CPPUTYPE_BOOLEAN
, PROPERTY_NONE
, 0},
187 { 0, 0, 0, CPPUTYPE_UNKNOWN
, 0, 0 }
189 return new ChainablePropertySetInfo ( aPrintSettingsMap_Impl
);
192 /******************************************************************
194 ******************************************************************/
195 Reference
< uno::XInterface
> SAL_CALL
SwXModule_createInstance(
196 const Reference
< XMultiServiceFactory
> & /*rSMgr*/) throw( Exception
)
198 static Reference
< uno::XInterface
> xModule
= (cppu::OWeakObject
*)new SwXModule();
202 Sequence
< OUString
> SAL_CALL
SwXModule_getSupportedServiceNames() throw()
204 OUString
sService( "com.sun.star.text.GlobalSettings");
205 const Sequence
< OUString
> aSeq( &sService
, 1 );
209 OUString SAL_CALL
SwXModule_getImplementationName() throw()
211 return OUString( "SwXModule" );
214 SwXModule::SwXModule() :
220 SwXModule::~SwXModule()
222 delete pxViewSettings
;
223 delete pxPrintSettings
;
226 Reference
< XPropertySet
> SwXModule::getViewSettings(void) throw( uno::RuntimeException
)
228 SolarMutexGuard aGuard
;
231 ((SwXModule
*)this)->pxViewSettings
= new Reference
< XPropertySet
> ;
232 OSL_FAIL("Web or Text?");
233 *pxViewSettings
= static_cast < HelperBaseNoState
* > ( new SwXViewSettings( sal_False
, 0 ) );
235 return *pxViewSettings
;
238 Reference
< XPropertySet
> SwXModule::getPrintSettings(void) throw( uno::RuntimeException
)
240 SolarMutexGuard aGuard
;
243 ((SwXModule
*)this)->pxPrintSettings
= new Reference
< XPropertySet
> ;
244 OSL_FAIL("Web or Text?");
245 *pxPrintSettings
= static_cast < HelperBaseNoState
* > ( new SwXPrintSettings ( PRINT_SETTINGS_MODULE
) );
247 return *pxPrintSettings
;
250 OUString
SwXModule::getImplementationName(void) throw( RuntimeException
)
252 return SwXModule_getImplementationName();
255 sal_Bool
SwXModule::supportsService(const OUString
& rServiceName
) throw( RuntimeException
)
257 const Sequence
< OUString
> aNames
= SwXModule_getSupportedServiceNames();
258 for(sal_Int32 nService
= 0; nService
< aNames
.getLength(); nService
++)
260 if(aNames
.getConstArray()[nService
] == rServiceName
)
266 Sequence
< OUString
> SwXModule::getSupportedServiceNames(void) throw( RuntimeException
)
268 return SwXModule_getSupportedServiceNames();
271 /******************************************************************
273 ******************************************************************/
274 SwXPrintSettings::SwXPrintSettings(SwXPrintSettingsType eType
, SwDoc
* pDoc
)
275 : ChainableHelperNoState ( lcl_createPrintSettingsInfo (), &Application::GetSolarMutex() )
282 SwXPrintSettings::~SwXPrintSettings()
287 void SwXPrintSettings::_preSetValues ()
288 throw(UnknownPropertyException
, PropertyVetoException
, IllegalArgumentException
, WrappedTargetException
)
292 case PRINT_SETTINGS_MODULE
:
293 mpPrtOpt
= SW_MOD()->GetPrtOptions( sal_False
);
295 case PRINT_SETTINGS_WEB
:
296 mpPrtOpt
= SW_MOD()->GetPrtOptions( sal_True
);
298 case PRINT_SETTINGS_DOCUMENT
:
301 throw IllegalArgumentException ();
302 mpPrtOpt
= const_cast< SwPrintData
* >(&mpDoc
->getPrintData());
308 void SwXPrintSettings::_setSingleValue( const comphelper::PropertyInfo
& rInfo
, const uno::Any
&rValue
)
309 throw(UnknownPropertyException
, PropertyVetoException
, IllegalArgumentException
, WrappedTargetException
)
312 if ( rInfo
.mnHandle
!= HANDLE_PRINTSET_ANNOTATION_MODE
&&
313 rInfo
.mnHandle
!= HANDLE_PRINTSET_FAX_NAME
)
314 bVal
= *(sal_Bool
*)rValue
.getValue();
316 switch( rInfo
.mnHandle
)
318 case HANDLE_PRINTSET_LEFT_PAGES
:
320 bVal
= *(sal_Bool
*)rValue
.getValue();
321 mpPrtOpt
->SetPrintLeftPage(bVal
);
324 case HANDLE_PRINTSET_RIGHT_PAGES
:
326 bVal
= *(sal_Bool
*)rValue
.getValue();
327 mpPrtOpt
->SetPrintRightPage(bVal
);
330 case HANDLE_PRINTSET_REVERSED
:
332 bVal
= *(sal_Bool
*)rValue
.getValue();
333 mpPrtOpt
->SetPrintReverse(bVal
);
336 case HANDLE_PRINTSET_PROSPECT
:
338 bVal
= *(sal_Bool
*)rValue
.getValue();
339 mpPrtOpt
->SetPrintProspect(bVal
);
342 case HANDLE_PRINTSET_GRAPHICS
:
344 bVal
= *(sal_Bool
*)rValue
.getValue();
345 mpPrtOpt
->SetPrintGraphic(bVal
);
348 case HANDLE_PRINTSET_TABLES
:
350 bVal
= *(sal_Bool
*)rValue
.getValue();
351 mpPrtOpt
->SetPrintTable(bVal
);
354 case HANDLE_PRINTSET_DRAWINGS
:
356 bVal
= *(sal_Bool
*)rValue
.getValue();
357 mpPrtOpt
->SetPrintDraw(bVal
);
360 case HANDLE_PRINTSET_CONTROLS
:
362 bVal
= *(sal_Bool
*)rValue
.getValue();
363 mpPrtOpt
->SetPrintControl(bVal
);
366 case HANDLE_PRINTSET_PAGE_BACKGROUND
:
368 bVal
= *(sal_Bool
*)rValue
.getValue();
369 mpPrtOpt
->SetPrintPageBackground(bVal
);
372 case HANDLE_PRINTSET_BLACK_FONTS
:
374 bVal
= *(sal_Bool
*)rValue
.getValue();
375 mpPrtOpt
->SetPrintBlackFont(bVal
);
378 case HANDLE_PRINTSET_SINGLE_JOBS
:
380 bVal
= *(sal_Bool
*)rValue
.getValue();
381 mpPrtOpt
->SetPrintSingleJobs(bVal
);
384 case HANDLE_PRINTSET_PAPER_FROM_SETUP
:
386 bVal
= *(sal_Bool
*)rValue
.getValue();
387 mpPrtOpt
->SetPaperFromSetup(bVal
);
390 case HANDLE_PRINTSET_ANNOTATION_MODE
:
394 if(nVal
<= text::NotePrintMode_PAGE_END
)
395 mpPrtOpt
->SetPrintPostIts(nVal
);
397 throw lang::IllegalArgumentException();
400 case HANDLE_PRINTSET_EMPTY_PAGES
:
402 bVal
= *(sal_Bool
*)rValue
.getValue();
403 mpPrtOpt
->SetPrintEmptyPages(bVal
);
406 case HANDLE_PRINTSET_FAX_NAME
:
409 if ( rValue
>>= sString
)
410 mpPrtOpt
->SetFaxName(sString
);
412 throw lang::IllegalArgumentException();
415 case HANDLE_PRINTSET_PROSPECT_RTL
:
417 bVal
= *(sal_Bool
*)rValue
.getValue();
418 mpPrtOpt
->SetPrintProspect_RTL(bVal
);
421 case HANDLE_PRINTSET_PLACEHOLDER
:
423 bVal
= *(sal_Bool
*)rValue
.getValue();
424 mpPrtOpt
->SetPrintTextPlaceholder(bVal
);
427 case HANDLE_PRINTSET_HIDDEN_TEXT
:
429 bVal
= *(sal_Bool
*)rValue
.getValue();
430 mpPrtOpt
->SetPrintHiddenText(bVal
);
434 throw UnknownPropertyException();
438 void SwXPrintSettings::_postSetValues ()
439 throw(UnknownPropertyException
, PropertyVetoException
, IllegalArgumentException
, WrappedTargetException
)
444 void SwXPrintSettings::_preGetValues ()
445 throw(UnknownPropertyException
, PropertyVetoException
, IllegalArgumentException
, WrappedTargetException
)
449 case PRINT_SETTINGS_MODULE
:
450 mpPrtOpt
= SW_MOD()->GetPrtOptions( sal_False
);
452 case PRINT_SETTINGS_WEB
:
453 mpPrtOpt
= SW_MOD()->GetPrtOptions( sal_True
);
455 case PRINT_SETTINGS_DOCUMENT
:
458 throw IllegalArgumentException ();
459 mpPrtOpt
= const_cast< SwPrintData
* >(&mpDoc
->getPrintData());
465 void SwXPrintSettings::_getSingleValue( const comphelper::PropertyInfo
& rInfo
, uno::Any
& rValue
)
466 throw(UnknownPropertyException
, WrappedTargetException
)
468 switch( rInfo
.mnHandle
)
470 case HANDLE_PRINTSET_LEFT_PAGES
:
471 rValue
<<= mpPrtOpt
->IsPrintLeftPage();
473 case HANDLE_PRINTSET_RIGHT_PAGES
:
474 rValue
<<= mpPrtOpt
->IsPrintRightPage();
476 case HANDLE_PRINTSET_REVERSED
:
477 rValue
<<= mpPrtOpt
->IsPrintReverse();
479 case HANDLE_PRINTSET_PROSPECT
:
480 rValue
<<= mpPrtOpt
->IsPrintProspect();
482 case HANDLE_PRINTSET_GRAPHICS
:
483 rValue
<<= mpPrtOpt
->IsPrintGraphic();
485 case HANDLE_PRINTSET_TABLES
:
486 rValue
<<= mpPrtOpt
->IsPrintTable();
488 case HANDLE_PRINTSET_DRAWINGS
:
489 rValue
<<= mpPrtOpt
->IsPrintDraw();
491 case HANDLE_PRINTSET_CONTROLS
:
492 rValue
<<= mpPrtOpt
->IsPrintControl();
494 case HANDLE_PRINTSET_PAGE_BACKGROUND
:
495 rValue
<<= mpPrtOpt
->IsPrintPageBackground();
497 case HANDLE_PRINTSET_BLACK_FONTS
:
498 rValue
<<= mpPrtOpt
->IsPrintBlackFont();
500 case HANDLE_PRINTSET_SINGLE_JOBS
:
501 rValue
<<= mpPrtOpt
->IsPrintSingleJobs();
503 case HANDLE_PRINTSET_EMPTY_PAGES
:
504 rValue
<<= mpPrtOpt
->IsPrintEmptyPages();
506 case HANDLE_PRINTSET_PAPER_FROM_SETUP
:
507 rValue
<<= mpPrtOpt
->IsPaperFromSetup();
509 case HANDLE_PRINTSET_ANNOTATION_MODE
:
511 rValue
<<= static_cast < sal_Int16
> ( mpPrtOpt
->GetPrintPostIts() );
514 case HANDLE_PRINTSET_FAX_NAME
:
516 rValue
<<= mpPrtOpt
->GetFaxName();
519 case HANDLE_PRINTSET_PROSPECT_RTL
:
521 rValue
<<= mpPrtOpt
->IsPrintProspectRTL();
524 case HANDLE_PRINTSET_PLACEHOLDER
:
526 rValue
<<= mpPrtOpt
->IsPrintTextPlaceholder();
529 case HANDLE_PRINTSET_HIDDEN_TEXT
:
531 rValue
<<= mpPrtOpt
->IsPrintHiddenText();
535 throw UnknownPropertyException();
539 void SwXPrintSettings::_postGetValues ()
540 throw(UnknownPropertyException
, PropertyVetoException
, IllegalArgumentException
, WrappedTargetException
)
545 OUString
SwXPrintSettings::getImplementationName(void) throw( RuntimeException
)
547 return OUString("SwXPrintSettings");
550 sal_Bool
SwXPrintSettings::supportsService(const OUString
& rServiceName
) throw( RuntimeException
)
552 return rServiceName
== "com.sun.star.text.PrintSettings";
555 Sequence
< OUString
> SwXPrintSettings::getSupportedServiceNames(void) throw( RuntimeException
)
557 Sequence
< OUString
> aRet(1);
558 OUString
* pArray
= aRet
.getArray();
559 pArray
[0] = "com.sun.star.text.PrintSettings";
563 SwXViewSettings::SwXViewSettings(sal_Bool bWebView
, SwView
* pVw
)
564 : ChainableHelperNoState( lcl_createViewSettingsInfo (), &Application::GetSolarMutex() )
566 , mpViewOption ( NULL
)
567 , mpConstViewOption ( NULL
)
568 , bObjectValid(sal_True
)
570 , eHRulerUnit( FUNIT_CM
)
571 , mbApplyHRulerMetric( sal_False
)
572 , eVRulerUnit( FUNIT_CM
)
573 , mbApplyVRulerMetric( sal_False
)
575 // This property only exists if we have a view (ie, not at the module )
577 mpInfo
->remove ( OUString ( "HelpURL" ) );
581 SwXViewSettings::~SwXViewSettings()
587 void SwXViewSettings::_preSetValues ()
588 throw(UnknownPropertyException
, PropertyVetoException
, IllegalArgumentException
, WrappedTargetException
)
590 const SwViewOption
* pVOpt
= 0;
595 pVOpt
= pView
->GetWrtShell().GetViewOptions();
598 pVOpt
= SW_MOD()->GetViewOption(bWeb
);
600 mpViewOption
= new SwViewOption (*pVOpt
);
601 mbApplyZoom
= sal_False
;
603 mpViewOption
->SetStarOneSetting(sal_True
);
606 void SwXViewSettings::_setSingleValue( const comphelper::PropertyInfo
& rInfo
, const uno::Any
&rValue
)
607 throw(UnknownPropertyException
, PropertyVetoException
, IllegalArgumentException
, WrappedTargetException
)
609 sal_Bool bVal
= HANDLE_VIEWSET_ZOOM
!= rInfo
.mnHandle
?
610 *(sal_Bool
*)rValue
.getValue() : sal_False
;
611 // the API flag should not be set to the application's view settings
612 switch( rInfo
.mnHandle
)
614 case HANDLE_VIEWSET_SHOW_RULER
: mpViewOption
->SetViewAnyRuler(bVal
); break;
615 case HANDLE_VIEWSET_HRULER
: mpViewOption
->SetViewHRuler(bVal
); break;
616 case HANDLE_VIEWSET_VRULER
: mpViewOption
->SetViewVRuler(bVal
);break;
617 case HANDLE_VIEWSET_VRULER_RIGHT
: mpViewOption
->SetVRulerRight(bVal
);break;
618 case HANDLE_VIEWSET_HSCROLL
: mpViewOption
->SetViewHScrollBar(bVal
);break;
619 case HANDLE_VIEWSET_VSCROLL
: mpViewOption
->SetViewVScrollBar(bVal
);break;
620 case HANDLE_VIEWSET_GRAPHICS
: mpViewOption
->SetGraphic(bVal
);break;
621 case HANDLE_VIEWSET_TABLES
: mpViewOption
->SetTable(bVal
); break;
622 case HANDLE_VIEWSET_DRAWINGS
: mpViewOption
->SetDraw(bVal
); break;
623 case HANDLE_VIEWSET_FIELD_COMMANDS
: mpViewOption
->SetFldName(bVal
); break;
624 case HANDLE_VIEWSET_ANNOTATIONS
: mpViewOption
->SetPostIts(bVal
); break;
625 case HANDLE_VIEWSET_INDEX_MARK_BACKGROUND
: mpViewOption
->SetAppearanceFlag(VIEWOPT_FIELD_SHADINGS
, bVal
, sal_True
); break;
626 case HANDLE_VIEWSET_NONPRINTING_CHARACTERS
: mpViewOption
->SetViewMetaChars( bVal
); break;
627 case HANDLE_VIEWSET_FOOTNOTE_BACKGROUND
: mpViewOption
->SetAppearanceFlag(VIEWOPT_FIELD_SHADINGS
, bVal
, sal_True
); break;
628 case HANDLE_VIEWSET_TEXT_FIELD_BACKGROUND
: mpViewOption
->SetAppearanceFlag(VIEWOPT_FIELD_SHADINGS
, bVal
, sal_True
); break;
629 case HANDLE_VIEWSET_PARA_BREAKS
: mpViewOption
->SetParagraph(bVal
); break;
630 case HANDLE_VIEWSET_SOFT_HYPHENS
: mpViewOption
->SetSoftHyph(bVal
); break;
631 case HANDLE_VIEWSET_SPACES
: mpViewOption
->SetBlank(bVal
); break;
632 case HANDLE_VIEWSET_PROTECTED_SPACES
: mpViewOption
->SetHardBlank(bVal
); break;
633 case HANDLE_VIEWSET_TABSTOPS
: mpViewOption
->SetTab(bVal
); break;
634 case HANDLE_VIEWSET_BREAKS
: mpViewOption
->SetLineBreak(bVal
); break;
635 case HANDLE_VIEWSET_HIDDEN_TEXT
: mpViewOption
->SetShowHiddenField(bVal
); break;
636 case HANDLE_VIEWSET_HIDDEN_CHARACTERS
: mpViewOption
->SetShowHiddenChar(bVal
); break;
637 case HANDLE_VIEWSET_HIDDEN_PARAGRAPHS
: mpViewOption
->SetShowHiddenPara(bVal
); break;
638 case HANDLE_VIEWSET_TABLE_BOUNDARIES
: mpViewOption
->SetAppearanceFlag(VIEWOPT_TABLE_BOUNDARIES
, bVal
, sal_True
); break;
639 case HANDLE_VIEWSET_TEXT_BOUNDARIES
: mpViewOption
->SetDocBoundaries(bVal
); break;
640 case HANDLE_VIEWSET_SMOOTH_SCROLLING
: mpViewOption
->SetSmoothScroll(bVal
); break;
641 case HANDLE_VIEWSET_SHOW_CONTENT_TIPS
: mpViewOption
->SetShowContentTips(bVal
); break;
642 case HANDLE_VIEWSET_IS_RASTER_VISIBLE
: mpViewOption
->SetGridVisible(bVal
); break;
643 case HANDLE_VIEWSET_IS_SNAP_TO_RASTER
: mpViewOption
->SetSnap(bVal
); break;
644 case HANDLE_VIEWSET_RASTER_RESOLUTION_X
:
647 if(!(rValue
>>= nTmp
) || nTmp
< 10)
648 throw IllegalArgumentException();
649 Size
aSize( mpViewOption
->GetSnapSize() );
650 aSize
.Width() = MM100_TO_TWIP( nTmp
);
651 mpViewOption
->SetSnapSize( aSize
);
654 case HANDLE_VIEWSET_RASTER_RESOLUTION_Y
:
657 if(!(rValue
>>= nTmp
) || nTmp
< 10)
658 throw IllegalArgumentException();
659 Size
aSize( mpViewOption
->GetSnapSize() );
660 aSize
.Height() = MM100_TO_TWIP( nTmp
);
661 mpViewOption
->SetSnapSize( aSize
);
664 case HANDLE_VIEWSET_RASTER_SUBDIVISION_X
:
667 if(!(rValue
>>= nTmp
) || !(0 <= nTmp
&& nTmp
< 100))
668 throw IllegalArgumentException();
669 mpViewOption
->SetDivisionX( (short) nTmp
);
672 case HANDLE_VIEWSET_RASTER_SUBDIVISION_Y
:
675 if(!(rValue
>>= nTmp
) || !(0 <= nTmp
&& nTmp
< 100))
676 throw IllegalArgumentException();
677 mpViewOption
->SetDivisionY( (short) nTmp
);
680 case HANDLE_VIEWSET_ZOOM
:
683 if(!(rValue
>>= nZoom
) || nZoom
> 1000 || nZoom
< 5)
684 throw lang::IllegalArgumentException();
685 mpViewOption
->SetZoom((sal_uInt16
)nZoom
);
686 mbApplyZoom
= sal_True
;
689 case HANDLE_VIEWSET_ZOOM_TYPE
:
692 if(!(rValue
>>= nZoom
))
693 throw IllegalArgumentException();
697 case view::DocumentZoomType::OPTIMAL
:
698 eZoom
= SVX_ZOOM_OPTIMAL
;
700 case view::DocumentZoomType::PAGE_WIDTH
:
701 eZoom
= SVX_ZOOM_PAGEWIDTH
;
703 case view::DocumentZoomType::ENTIRE_PAGE
:
704 eZoom
= SVX_ZOOM_WHOLEPAGE
;
706 case view::DocumentZoomType::BY_VALUE
:
707 eZoom
= SVX_ZOOM_PERCENT
;
709 case view::DocumentZoomType::PAGE_WIDTH_EXACT
:
710 eZoom
= SVX_ZOOM_PAGEWIDTH_NOBORDER
;
713 throw IllegalArgumentException(
714 OUString( "SwXViewSettings: invalid zoom type"), 0, 0);
716 mpViewOption
->SetZoomType( eZoom
);
717 mbApplyZoom
= sal_True
;
720 case HANDLE_VIEWSET_ONLINE_LAYOUT
:
722 if( pView
&& !bVal
!= !pView
->GetWrtShell().GetViewOptions()->getBrowseMode() )
724 SwViewOption
aOpt( *pView
->GetWrtShell().GetViewOptions() );
725 aOpt
.setBrowseMode( bVal
);
726 pView
->GetWrtShell().ApplyViewOptions( aOpt
);
727 pView
->RecheckBrowseMode();
729 // must be set in mpViewOption as this will overwrite settings in _post!
731 mpViewOption
->setBrowseMode(bVal
);
733 // disable multiple layout
734 pView
->GetDocShell()->ToggleBrowserMode(bVal
, pView
);
738 case HANDLE_VIEWSET_HELP_URL
:
743 if ( ! ( rValue
>>= sHelpURL
) )
744 throw IllegalArgumentException();
746 INetURLObject
aHID( sHelpURL
);
747 if ( aHID
.GetProtocol() == INET_PROT_HID
)
748 pView
->GetEditWin().SetHelpId( OUStringToOString( aHID
.GetURLPath(), RTL_TEXTENCODING_UTF8
) );
750 throw IllegalArgumentException ();
753 throw UnknownPropertyException();
756 case HANDLE_VIEWSET_HORI_RULER_METRIC
:
757 case HANDLE_VIEWSET_VERT_RULER_METRIC
:
759 sal_Int32 nUnit
= -1;
760 if( rValue
>>= nUnit
)
768 if( rInfo
.mnHandle
== HANDLE_VIEWSET_HORI_RULER_METRIC
)
771 mbApplyHRulerMetric
= sal_True
;
776 mbApplyVRulerMetric
= sal_True
;
780 throw IllegalArgumentException();
785 throw UnknownPropertyException();
789 void SwXViewSettings::_postSetValues ()
790 throw(UnknownPropertyException
, PropertyVetoException
, IllegalArgumentException
, WrappedTargetException
)
795 pView
->SetZoom( (SvxZoomType
)mpViewOption
->GetZoomType(),
796 mpViewOption
->GetZoom(), sal_True
);
797 if(mbApplyHRulerMetric
)
798 pView
->ChangeTabMetric((FieldUnit
)eHRulerUnit
);
799 if(mbApplyVRulerMetric
)
800 pView
->ChangeVRulerMetric((FieldUnit
)eVRulerUnit
);
805 if(mbApplyHRulerMetric
)
806 SW_MOD()->ApplyRulerMetric( (FieldUnit
)eHRulerUnit
, sal_True
, bWeb
);
807 if(mbApplyVRulerMetric
)
808 SW_MOD()->ApplyRulerMetric( (FieldUnit
)eVRulerUnit
, sal_False
, bWeb
);
812 SW_MOD()->ApplyUsrPref( *mpViewOption
, pView
, pView
? VIEWOPT_DEST_VIEW_ONLY
813 : bWeb
? VIEWOPT_DEST_WEB
814 : VIEWOPT_DEST_TEXT
);
821 void SwXViewSettings::_preGetValues ()
822 throw(UnknownPropertyException
, PropertyVetoException
, IllegalArgumentException
, WrappedTargetException
)
828 mpConstViewOption
= pView
->GetWrtShell().GetViewOptions();
831 mpConstViewOption
= SW_MOD()->GetViewOption(bWeb
);
834 void SwXViewSettings::_getSingleValue( const comphelper::PropertyInfo
& rInfo
, uno::Any
& rValue
)
835 throw(UnknownPropertyException
, WrappedTargetException
)
839 switch( rInfo
.mnHandle
)
841 case HANDLE_VIEWSET_SHOW_RULER
: bBoolVal
= mpConstViewOption
->IsViewAnyRuler(); break;
842 case HANDLE_VIEWSET_HRULER
: bBoolVal
= mpConstViewOption
->IsViewHRuler(sal_True
); break;
843 case HANDLE_VIEWSET_VRULER
: bBoolVal
= mpConstViewOption
->IsViewVRuler(sal_True
);break;
844 case HANDLE_VIEWSET_VRULER_RIGHT
: bBoolVal
= mpConstViewOption
->IsVRulerRight();break;
845 case HANDLE_VIEWSET_HSCROLL
: bBoolVal
= mpConstViewOption
->IsViewHScrollBar();break;
846 case HANDLE_VIEWSET_VSCROLL
: bBoolVal
= mpConstViewOption
->IsViewVScrollBar();break;
847 case HANDLE_VIEWSET_GRAPHICS
: bBoolVal
= mpConstViewOption
->IsGraphic();break;
848 case HANDLE_VIEWSET_TABLES
: bBoolVal
= mpConstViewOption
->IsTable(); break;
849 case HANDLE_VIEWSET_DRAWINGS
: bBoolVal
= mpConstViewOption
->IsDraw(); break;
850 case HANDLE_VIEWSET_FIELD_COMMANDS
: bBoolVal
= mpConstViewOption
->IsFldName(); break;
851 case HANDLE_VIEWSET_ANNOTATIONS
: bBoolVal
= mpConstViewOption
->IsPostIts(); break;
852 case HANDLE_VIEWSET_INDEX_MARK_BACKGROUND
: bBoolVal
= SwViewOption::IsFieldShadings(); break;
853 case HANDLE_VIEWSET_NONPRINTING_CHARACTERS
: bBoolVal
= mpConstViewOption
->IsViewMetaChars(); break;
854 case HANDLE_VIEWSET_FOOTNOTE_BACKGROUND
: bBoolVal
= SwViewOption::IsFieldShadings(); break;
855 case HANDLE_VIEWSET_TEXT_FIELD_BACKGROUND
: bBoolVal
= SwViewOption::IsFieldShadings(); break;
856 case HANDLE_VIEWSET_PARA_BREAKS
: bBoolVal
= mpConstViewOption
->IsParagraph(sal_True
); break;
857 case HANDLE_VIEWSET_SOFT_HYPHENS
: bBoolVal
= mpConstViewOption
->IsSoftHyph(); break;
858 case HANDLE_VIEWSET_SPACES
: bBoolVal
= mpConstViewOption
->IsBlank(sal_True
); break;
859 case HANDLE_VIEWSET_PROTECTED_SPACES
: bBoolVal
= mpConstViewOption
->IsHardBlank(); break;
860 case HANDLE_VIEWSET_TABSTOPS
: bBoolVal
= mpConstViewOption
->IsTab(sal_True
); break;
861 case HANDLE_VIEWSET_BREAKS
: bBoolVal
= mpConstViewOption
->IsLineBreak(sal_True
); break;
862 case HANDLE_VIEWSET_HIDDEN_TEXT
: bBoolVal
= mpConstViewOption
->IsShowHiddenField(); break;
863 case HANDLE_VIEWSET_HIDDEN_CHARACTERS
: bBoolVal
= mpConstViewOption
->IsShowHiddenChar(sal_True
); break;
864 case HANDLE_VIEWSET_HIDDEN_PARAGRAPHS
: bBoolVal
= mpConstViewOption
->IsShowHiddenPara(); break;
865 case HANDLE_VIEWSET_TABLE_BOUNDARIES
: bBoolVal
= SwViewOption::IsTableBoundaries(); break;
866 case HANDLE_VIEWSET_TEXT_BOUNDARIES
: bBoolVal
= SwViewOption::IsDocBoundaries(); break;
867 case HANDLE_VIEWSET_SMOOTH_SCROLLING
: bBoolVal
= mpConstViewOption
->IsSmoothScroll(); break;
868 case HANDLE_VIEWSET_SHOW_CONTENT_TIPS
: bBoolVal
= mpConstViewOption
->IsShowContentTips(); break;
869 case HANDLE_VIEWSET_IS_RASTER_VISIBLE
: bBoolVal
= mpConstViewOption
->IsGridVisible(); break;
870 case HANDLE_VIEWSET_IS_SNAP_TO_RASTER
: bBoolVal
= mpConstViewOption
->IsSnap(); break;
871 case HANDLE_VIEWSET_RASTER_RESOLUTION_X
:
873 rValue
<<= (sal_Int32
) TWIP_TO_MM100(mpConstViewOption
->GetSnapSize().Width());
875 case HANDLE_VIEWSET_RASTER_RESOLUTION_Y
:
877 rValue
<<= (sal_Int32
) TWIP_TO_MM100(mpConstViewOption
->GetSnapSize().Height());
879 case HANDLE_VIEWSET_RASTER_SUBDIVISION_X
:
881 rValue
<<= (sal_Int32
) mpConstViewOption
->GetDivisionX();
883 case HANDLE_VIEWSET_RASTER_SUBDIVISION_Y
:
885 rValue
<<= (sal_Int32
) mpConstViewOption
->GetDivisionY();
887 case HANDLE_VIEWSET_ZOOM
:
889 rValue
<<= (sal_Int16
)mpConstViewOption
->GetZoom();
891 case HANDLE_VIEWSET_ZOOM_TYPE
:
895 switch (mpConstViewOption
->GetZoomType())
897 case SVX_ZOOM_OPTIMAL
:
898 nRet
= view::DocumentZoomType::OPTIMAL
;
900 case SVX_ZOOM_PAGEWIDTH
:
901 nRet
= view::DocumentZoomType::PAGE_WIDTH
;
903 case SVX_ZOOM_WHOLEPAGE
:
904 nRet
= view::DocumentZoomType::ENTIRE_PAGE
;
906 case SVX_ZOOM_PERCENT
:
907 nRet
= view::DocumentZoomType::BY_VALUE
;
909 case SVX_ZOOM_PAGEWIDTH_NOBORDER
:
910 nRet
= view::DocumentZoomType::PAGE_WIDTH_EXACT
;
913 OSL_FAIL("SwXViewSettings: invalid zoom type");
919 case HANDLE_VIEWSET_ONLINE_LAYOUT
:
921 bBoolVal
= pView
->GetWrtShell().GetViewOptions()->getBrowseMode();
923 case HANDLE_VIEWSET_HELP_URL
:
928 OUStringBuffer sHelpURL
;
929 sHelpURL
.appendAscii ( INET_HID_SCHEME
);
930 SwEditWin
&rEditWin
= pView
->GetEditWin();
931 sHelpURL
.append( OStringToOUString( rEditWin
.GetHelpId(), RTL_TEXTENCODING_UTF8
) );
932 rValue
<<= sHelpURL
.makeStringAndClear();
935 throw UnknownPropertyException();
938 case HANDLE_VIEWSET_HORI_RULER_METRIC
:
943 pView
->GetHRulerMetric( eUnit
);
944 rValue
<<= (sal_Int32
)eUnit
;
948 const SwMasterUsrPref
* pUsrPref
= SW_MOD()->GetUsrPref( bWeb
);
949 rValue
<<= (sal_Int32
)pUsrPref
->GetHScrollMetric();
954 case HANDLE_VIEWSET_VERT_RULER_METRIC
:
959 pView
->GetVRulerMetric( eUnit
);
960 rValue
<<= (sal_Int32
)eUnit
;
964 const SwMasterUsrPref
* pUsrPref
= SW_MOD()->GetUsrPref( bWeb
);
965 rValue
<<= (sal_Int32
)pUsrPref
->GetVScrollMetric();
970 default: OSL_FAIL("there is no such ID!");
973 rValue
.setValue(&bBoolVal
, ::getBooleanCppuType());
976 void SwXViewSettings::_postGetValues ()
977 throw(UnknownPropertyException
, PropertyVetoException
, IllegalArgumentException
, WrappedTargetException
)
979 mpConstViewOption
= NULL
;
982 OUString
SwXViewSettings::getImplementationName(void) throw( RuntimeException
)
984 return OUString("SwXViewSettings");
987 sal_Bool
SwXViewSettings::supportsService(const OUString
& rServiceName
) throw( RuntimeException
)
989 return rServiceName
== "com.sun.star.text.ViewSettings";
992 Sequence
< OUString
> SwXViewSettings::getSupportedServiceNames(void) throw( RuntimeException
)
994 Sequence
< OUString
> aRet(1);
995 OUString
* pArray
= aRet
.getArray();
996 pArray
[0] = "com.sun.star.text.ViewSettings";
1000 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */