update dev300-m58
[ooovba.git] / sw / source / ui / uno / unomod.cxx
blob2f7716bac1bab6f916711979d4900f5210c8fefa
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: unomod.cxx,v $
10 * $Revision: 1.33 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
35 #include <swtypes.hxx>
36 #include <tools/debug.hxx>
37 #include <unomod.hxx>
38 #include <unoobj.hxx>
39 #include <unoprnms.hxx>
40 #include <unomap.hxx>
41 #include <prtopt.hxx>
42 #include <tools/shl.hxx>
43 #include <swmodule.hxx>
44 #include <view.hxx>
45 #include <docsh.hxx>
46 #include <wrtsh.hxx>
47 #include <viewopt.hxx>
48 #include <vos/mutex.hxx>
49 #include <vcl/svapp.hxx>
50 #include <com/sun/star/text/NotePrintMode.hpp>
51 #include <doc.hxx>
52 #include <comphelper/TypeGeneration.hxx>
53 #include <com/sun/star/beans/PropertyAttribute.hpp>
54 #include <com/sun/star/view/DocumentZoomType.hpp>
55 #include <comphelper/ChainablePropertySetInfo.hxx>
56 #include <edtwin.hxx>
57 #include <rtl/ustrbuf.hxx>
60 using namespace ::com::sun::star;
61 using namespace ::com::sun::star::uno;
62 using namespace ::com::sun::star::beans;
63 using namespace ::com::sun::star::lang;
64 using namespace ::comphelper;
65 using ::rtl::OUString;
66 using ::rtl::OUStringBuffer;
68 enum SwViewSettingsPropertyHandles
70 HANDLE_VIEWSET_ANNOTATIONS,
71 HANDLE_VIEWSET_BREAKS,
72 HANDLE_VIEWSET_DRAWINGS,
73 HANDLE_VIEWSET_FIELD_COMMANDS,
74 HANDLE_VIEWSET_FOOTNOTE_BACKGROUND,
75 HANDLE_VIEWSET_GRAPHICS,
76 HANDLE_VIEWSET_HIDDEN_CHARACTERS,
77 HANDLE_VIEWSET_HIDDEN_PARAGRAPHS,
78 HANDLE_VIEWSET_HIDDEN_TEXT,
79 HANDLE_VIEWSET_HRULER,
80 HANDLE_VIEWSET_HSCROLL,
81 HANDLE_VIEWSET_INDEX_MARK_BACKGROUND,
82 HANDLE_VIEWSET_NONPRINTING_CHARACTERS,
83 HANDLE_VIEWSET_ONLINE_LAYOUT,
84 HANDLE_VIEWSET_PARA_BREAKS,
85 HANDLE_VIEWSET_PROTECTED_SPACES,
86 HANDLE_VIEWSET_SOFT_HYPHENS,
87 HANDLE_VIEWSET_SPACES,
88 HANDLE_VIEWSET_TABLE_BOUNDARIES,
89 HANDLE_VIEWSET_TABLES,
90 HANDLE_VIEWSET_TABSTOPS,
91 HANDLE_VIEWSET_TEXT_BOUNDARIES,
92 HANDLE_VIEWSET_TEXT_FIELD_BACKGROUND,
93 HANDLE_VIEWSET_VRULER,
94 HANDLE_VIEWSET_VSCROLL,
95 HANDLE_VIEWSET_SMOOTH_SCROLLING,
96 HANDLE_VIEWSET_SOLID_MARK_HANDLES,
97 HANDLE_VIEWSET_ZOOM_TYPE,
98 HANDLE_VIEWSET_ZOOM,
99 HANDLE_VIEWSET_PREVENT_TIPS,
100 HANDLE_VIEWSET_HELP_URL,
101 HANDLE_VIEWSET_VRULER_RIGHT,
102 HANDLE_VIEWSET_SHOW_RULER,
103 HANDLE_VIEWSET_IS_RASTER_VISIBLE,
104 HANDLE_VIEWSET_IS_SNAP_TO_RASTER,
105 HANDLE_VIEWSET_RASTER_RESOLUTION_X,
106 HANDLE_VIEWSET_RASTER_RESOLUTION_Y,
107 HANDLE_VIEWSET_RASTER_SUBDIVISION_X,
108 HANDLE_VIEWSET_RASTER_SUBDIVISION_Y,
109 HANDLE_VIEWSET_HORI_RULER_METRIC,
110 HANDLE_VIEWSET_VERT_RULER_METRIC
112 enum SwPrintSettingsPropertyHandles
114 HANDLE_PRINTSET_ANNOTATION_MODE,
115 HANDLE_PRINTSET_BLACK_FONTS,
116 HANDLE_PRINTSET_CONTROLS,
117 HANDLE_PRINTSET_DRAWINGS,
118 HANDLE_PRINTSET_GRAPHICS,
119 HANDLE_PRINTSET_LEFT_PAGES,
120 HANDLE_PRINTSET_PAGE_BACKGROUND,
121 HANDLE_PRINTSET_PROSPECT,
122 HANDLE_PRINTSET_REVERSED,
123 HANDLE_PRINTSET_RIGHT_PAGES,
124 HANDLE_PRINTSET_FAX_NAME,
125 HANDLE_PRINTSET_PAPER_FROM_SETUP,
126 HANDLE_PRINTSET_TABLES,
127 HANDLE_PRINTSET_SINGLE_JOBS,
128 HANDLE_PRINTSET_EMPTY_PAGES,
129 HANDLE_PRINTSET_PROSPECT_RTL,
130 HANDLE_PRINTSET_PLACEHOLDER,
131 HANDLE_PRINTSET_HIDDEN_TEXT
134 static ChainablePropertySetInfo * lcl_createViewSettingsInfo()
136 static PropertyInfo aViewSettingsMap_Impl[] =
138 { RTL_CONSTASCII_STRINGPARAM ( "HelpURL" ), HANDLE_VIEWSET_HELP_URL , CPPUTYPE_OUSTRING, PROPERTY_NONE, 0},
139 { RTL_CONSTASCII_STRINGPARAM ( "HorizontalRulerMetric"),HANDLE_VIEWSET_HORI_RULER_METRIC , CPPUTYPE_INT32, PROPERTY_NONE, 0},
140 { RTL_CONSTASCII_STRINGPARAM ( "IsRasterVisible"), HANDLE_VIEWSET_IS_RASTER_VISIBLE, CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
141 { RTL_CONSTASCII_STRINGPARAM ( "IsSnapToRaster"), HANDLE_VIEWSET_IS_SNAP_TO_RASTER, CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
142 { RTL_CONSTASCII_STRINGPARAM ( "IsVertRulerRightAligned"),HANDLE_VIEWSET_VRULER_RIGHT , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
143 { RTL_CONSTASCII_STRINGPARAM ( "PreventHelpTips" ), HANDLE_VIEWSET_PREVENT_TIPS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
144 { RTL_CONSTASCII_STRINGPARAM ( "RasterResolutionX"), HANDLE_VIEWSET_RASTER_RESOLUTION_X, CPPUTYPE_INT32, PROPERTY_NONE, 0},
145 { RTL_CONSTASCII_STRINGPARAM ( "RasterResolutionY"), HANDLE_VIEWSET_RASTER_RESOLUTION_Y, CPPUTYPE_INT32, PROPERTY_NONE, 0},
146 { RTL_CONSTASCII_STRINGPARAM ( "RasterSubdivisionX"), HANDLE_VIEWSET_RASTER_SUBDIVISION_X, CPPUTYPE_INT32, PROPERTY_NONE, 0},
147 { RTL_CONSTASCII_STRINGPARAM ( "RasterSubdivisionY"), HANDLE_VIEWSET_RASTER_SUBDIVISION_Y, CPPUTYPE_INT32, PROPERTY_NONE, 0},
148 { RTL_CONSTASCII_STRINGPARAM ( "ShowAnnotations" ), HANDLE_VIEWSET_ANNOTATIONS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
149 { RTL_CONSTASCII_STRINGPARAM ( "ShowBreaks"), HANDLE_VIEWSET_BREAKS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
150 { RTL_CONSTASCII_STRINGPARAM ( "ShowDrawings"), HANDLE_VIEWSET_DRAWINGS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
151 { RTL_CONSTASCII_STRINGPARAM ( "ShowFieldCommands"), HANDLE_VIEWSET_FIELD_COMMANDS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
152 { RTL_CONSTASCII_STRINGPARAM ( "ShowFootnoteBackground"),HANDLE_VIEWSET_FOOTNOTE_BACKGROUND , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
153 { RTL_CONSTASCII_STRINGPARAM ( "ShowGraphics"), HANDLE_VIEWSET_GRAPHICS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
154 { RTL_CONSTASCII_STRINGPARAM ( "ShowHiddenCharacters"), HANDLE_VIEWSET_HIDDEN_CHARACTERS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
155 { RTL_CONSTASCII_STRINGPARAM ( "ShowHiddenParagraphs"), HANDLE_VIEWSET_HIDDEN_PARAGRAPHS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
156 { RTL_CONSTASCII_STRINGPARAM ( "ShowHiddenText"), HANDLE_VIEWSET_HIDDEN_TEXT , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
157 { RTL_CONSTASCII_STRINGPARAM ( "ShowHoriRuler"), HANDLE_VIEWSET_HRULER , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
158 { RTL_CONSTASCII_STRINGPARAM ( "ShowHoriScrollBar"), HANDLE_VIEWSET_HSCROLL , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
159 { RTL_CONSTASCII_STRINGPARAM ( "ShowIndexMarkBackground"),HANDLE_VIEWSET_INDEX_MARK_BACKGROUND, CPPUTYPE_BOOLEAN,PROPERTY_NONE, 0},
160 { RTL_CONSTASCII_STRINGPARAM ( "ShowNonprintingCharacters"),HANDLE_VIEWSET_NONPRINTING_CHARACTERS, CPPUTYPE_BOOLEAN,PROPERTY_NONE, 0},
161 { RTL_CONSTASCII_STRINGPARAM ( "ShowOnlineLayout"), HANDLE_VIEWSET_ONLINE_LAYOUT , CPPUTYPE_BOOLEAN, PropertyAttribute::MAYBEVOID, 0},
162 { RTL_CONSTASCII_STRINGPARAM ( "ShowParaBreaks"), HANDLE_VIEWSET_PARA_BREAKS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
163 { RTL_CONSTASCII_STRINGPARAM ( "ShowProtectedSpaces"), HANDLE_VIEWSET_PROTECTED_SPACES , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
164 { RTL_CONSTASCII_STRINGPARAM ( "ShowRulers"), HANDLE_VIEWSET_SHOW_RULER , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
165 { RTL_CONSTASCII_STRINGPARAM ( "ShowSoftHyphens"), HANDLE_VIEWSET_SOFT_HYPHENS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
166 { RTL_CONSTASCII_STRINGPARAM ( "ShowSpaces"), HANDLE_VIEWSET_SPACES , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
167 { RTL_CONSTASCII_STRINGPARAM ( "ShowTableBoundaries"), HANDLE_VIEWSET_TABLE_BOUNDARIES , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
168 { RTL_CONSTASCII_STRINGPARAM ( "ShowTables"), HANDLE_VIEWSET_TABLES , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
169 { RTL_CONSTASCII_STRINGPARAM ( "ShowTabstops"), HANDLE_VIEWSET_TABSTOPS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
170 { RTL_CONSTASCII_STRINGPARAM ( "ShowTextBoundaries"), HANDLE_VIEWSET_TEXT_BOUNDARIES , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
171 { RTL_CONSTASCII_STRINGPARAM ( "ShowTextFieldBackground"),HANDLE_VIEWSET_TEXT_FIELD_BACKGROUND, CPPUTYPE_BOOLEAN,PROPERTY_NONE, 0},
172 { RTL_CONSTASCII_STRINGPARAM ( "ShowVertRuler"), HANDLE_VIEWSET_VRULER , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
173 { RTL_CONSTASCII_STRINGPARAM ( "ShowVertScrollBar"), HANDLE_VIEWSET_VSCROLL , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
174 { RTL_CONSTASCII_STRINGPARAM ( "SmoothScrolling"), HANDLE_VIEWSET_SMOOTH_SCROLLING , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
175 { RTL_CONSTASCII_STRINGPARAM ( "SolidMarkHandles"), HANDLE_VIEWSET_SOLID_MARK_HANDLES , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
176 { RTL_CONSTASCII_STRINGPARAM ( "VerticalRulerMetric"), HANDLE_VIEWSET_VERT_RULER_METRIC , CPPUTYPE_INT32, PROPERTY_NONE, 0},
177 { RTL_CONSTASCII_STRINGPARAM ( "ZoomType"), HANDLE_VIEWSET_ZOOM_TYPE , CPPUTYPE_INT16, PROPERTY_NONE, 0},
178 { RTL_CONSTASCII_STRINGPARAM ( "ZoomValue"), HANDLE_VIEWSET_ZOOM , CPPUTYPE_INT16, PROPERTY_NONE, 0},
179 { 0, 0, 0, CPPUTYPE_UNKNOWN, 0, 0 }
181 return new ChainablePropertySetInfo ( aViewSettingsMap_Impl );
183 static ChainablePropertySetInfo * lcl_createPrintSettingsInfo()
185 static PropertyInfo aPrintSettingsMap_Impl[] =
187 { RTL_CONSTASCII_STRINGPARAM ( "PrintAnnotationMode" ), HANDLE_PRINTSET_ANNOTATION_MODE , CPPUTYPE_INT16, PROPERTY_NONE, 0},
188 { RTL_CONSTASCII_STRINGPARAM ( "PrintBlackFonts" ), HANDLE_PRINTSET_BLACK_FONTS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
189 { RTL_CONSTASCII_STRINGPARAM ( "PrintControls" ), HANDLE_PRINTSET_CONTROLS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
190 { RTL_CONSTASCII_STRINGPARAM ( "PrintDrawings" ), HANDLE_PRINTSET_DRAWINGS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
191 { RTL_CONSTASCII_STRINGPARAM ( "PrintGraphics" ), HANDLE_PRINTSET_GRAPHICS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
192 { RTL_CONSTASCII_STRINGPARAM ( "PrintHiddenText"), HANDLE_PRINTSET_HIDDEN_TEXT , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
193 { RTL_CONSTASCII_STRINGPARAM ( "PrintLeftPages" ), HANDLE_PRINTSET_LEFT_PAGES , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
194 { RTL_CONSTASCII_STRINGPARAM ( "PrintPageBackground" ), HANDLE_PRINTSET_PAGE_BACKGROUND , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
195 { RTL_CONSTASCII_STRINGPARAM ( "PrintProspect" ), HANDLE_PRINTSET_PROSPECT , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
196 { RTL_CONSTASCII_STRINGPARAM ( "PrintProspectRTL" ), HANDLE_PRINTSET_PROSPECT_RTL , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
197 { RTL_CONSTASCII_STRINGPARAM ( "PrintReversed" ), HANDLE_PRINTSET_REVERSED , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
198 { RTL_CONSTASCII_STRINGPARAM ( "PrintRightPages" ), HANDLE_PRINTSET_RIGHT_PAGES , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
199 { RTL_CONSTASCII_STRINGPARAM ( "PrintFaxName" ), HANDLE_PRINTSET_FAX_NAME , CPPUTYPE_OUSTRING, PROPERTY_NONE, 0},
200 { RTL_CONSTASCII_STRINGPARAM ( "PrintPaperFromSetup" ), HANDLE_PRINTSET_PAPER_FROM_SETUP , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
201 { RTL_CONSTASCII_STRINGPARAM ( "PrintTables" ), HANDLE_PRINTSET_TABLES , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
202 { RTL_CONSTASCII_STRINGPARAM ( "PrintTextPlaceholder"), HANDLE_PRINTSET_PLACEHOLDER , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
203 { RTL_CONSTASCII_STRINGPARAM ( "PrintSingleJobs" ), HANDLE_PRINTSET_SINGLE_JOBS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
204 { RTL_CONSTASCII_STRINGPARAM ( "PrintEmptyPages" ), HANDLE_PRINTSET_EMPTY_PAGES , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
205 { 0, 0, 0, CPPUTYPE_UNKNOWN, 0, 0 }
207 return new ChainablePropertySetInfo ( aPrintSettingsMap_Impl );
210 /******************************************************************
211 * SwXModule
212 ******************************************************************/
213 /* -----------------30.03.99 15:10-------------------
215 * --------------------------------------------------*/
216 Reference< uno::XInterface > SAL_CALL SwXModule_createInstance(
217 const Reference< XMultiServiceFactory > & /*rSMgr*/) throw( Exception )
219 static Reference< uno::XInterface > xModule = (cppu::OWeakObject*)new SwXModule();;
220 return xModule;
222 /* -----------------------------17.04.01 13:11--------------------------------
224 ---------------------------------------------------------------------------*/
225 Sequence< OUString > SAL_CALL SwXModule_getSupportedServiceNames() throw()
227 OUString sService( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.GlobalSettings"));
228 const Sequence< OUString > aSeq( &sService, 1 );
229 return aSeq;
231 /* -----------------------------17.04.01 13:11--------------------------------
233 ---------------------------------------------------------------------------*/
234 OUString SAL_CALL SwXModule_getImplementationName() throw()
236 return OUString( RTL_CONSTASCII_USTRINGPARAM("SwXModule" ) );
238 /*-- 17.12.98 12:19:01---------------------------------------------------
240 -----------------------------------------------------------------------*/
241 SwXModule::SwXModule() :
242 pxViewSettings(0),
243 pxPrintSettings(0)
246 /*-- 17.12.98 12:19:02---------------------------------------------------
248 -----------------------------------------------------------------------*/
249 SwXModule::~SwXModule()
251 delete pxViewSettings;
252 delete pxPrintSettings;
254 /*-- 17.12.98 12:19:03---------------------------------------------------
256 -----------------------------------------------------------------------*/
257 Reference< XPropertySet > SwXModule::getViewSettings(void) throw( uno::RuntimeException )
259 ::vos::OGuard aGuard(Application::GetSolarMutex());
260 if(!pxViewSettings)
262 ((SwXModule*)this)->pxViewSettings = new Reference< XPropertySet > ;
263 DBG_ERROR("Web oder Text?");
264 *pxViewSettings = static_cast < HelperBaseNoState * > ( new SwXViewSettings( sal_False, 0 ) );
266 return *pxViewSettings;
268 /*-- 17.12.98 12:19:03---------------------------------------------------
270 -----------------------------------------------------------------------*/
271 Reference< XPropertySet > SwXModule::getPrintSettings(void) throw( uno::RuntimeException )
273 ::vos::OGuard aGuard(Application::GetSolarMutex());
274 if(!pxPrintSettings)
276 ((SwXModule*)this)->pxPrintSettings = new Reference< XPropertySet > ;
277 DBG_ERROR("Web oder Text?");
278 *pxPrintSettings = static_cast < HelperBaseNoState * > ( new SwXPrintSettings ( PRINT_SETTINGS_MODULE ) );
280 return *pxPrintSettings;
282 /* -----------------------------06.04.00 10:59--------------------------------
284 ---------------------------------------------------------------------------*/
285 OUString SwXModule::getImplementationName(void) throw( RuntimeException )
287 return SwXModule_getImplementationName();
289 /* -----------------------------06.04.00 10:59--------------------------------
291 ---------------------------------------------------------------------------*/
292 sal_Bool SwXModule::supportsService(const OUString& rServiceName) throw( RuntimeException )
294 const Sequence< OUString > aNames = SwXModule_getSupportedServiceNames();
295 for(sal_Int32 nService = 0; nService < aNames.getLength(); nService++)
297 if(aNames.getConstArray()[nService] == rServiceName)
298 return TRUE;
300 return FALSE;
302 /* -----------------------------06.04.00 10:59--------------------------------
304 ---------------------------------------------------------------------------*/
305 Sequence< OUString > SwXModule::getSupportedServiceNames(void) throw( RuntimeException )
307 return SwXModule_getSupportedServiceNames();
310 /******************************************************************
311 * SwXPrintSettings
312 ******************************************************************/
313 /*-- 17.12.98 12:54:04---------------------------------------------------
315 -----------------------------------------------------------------------*/
316 SwXPrintSettings::SwXPrintSettings(SwXPrintSettingsType eType, SwDoc* pDoc)
317 : ChainableHelperNoState ( lcl_createPrintSettingsInfo (), &Application::GetSolarMutex() )
318 , meType(eType)
319 , mpPrtOpt ( NULL )
320 , mpDoc ( pDoc )
323 /*-- 17.12.98 12:54:05---------------------------------------------------
325 -----------------------------------------------------------------------*/
326 SwXPrintSettings::~SwXPrintSettings()
327 throw()
331 void SwXPrintSettings::_preSetValues ()
332 throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException )
334 switch (meType)
336 case PRINT_SETTINGS_MODULE:
337 mpPrtOpt = SW_MOD()->GetPrtOptions( sal_False );
338 break;
339 case PRINT_SETTINGS_WEB:
340 mpPrtOpt = SW_MOD()->GetPrtOptions( sal_True );
341 break;
342 case PRINT_SETTINGS_DOCUMENT:
344 if (!mpDoc)
345 throw IllegalArgumentException ();
346 if ( !mpDoc->getPrintData() )
348 mpPrtOpt = new SwPrintData;
349 mpDoc->setPrintData ( *mpPrtOpt );
350 delete mpPrtOpt;
352 mpPrtOpt = mpDoc->getPrintData();
354 break;
358 void SwXPrintSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, const uno::Any &rValue )
359 throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException )
361 sal_Bool bVal;
362 if ( rInfo.mnHandle != HANDLE_PRINTSET_ANNOTATION_MODE &&
363 rInfo.mnHandle != HANDLE_PRINTSET_FAX_NAME )
364 bVal = *(sal_Bool*)rValue.getValue();
366 switch( rInfo.mnHandle )
368 case HANDLE_PRINTSET_LEFT_PAGES:
370 bVal = *(sal_Bool*)rValue.getValue();
371 mpPrtOpt->SetPrintLeftPage(bVal);
373 break;
374 case HANDLE_PRINTSET_RIGHT_PAGES:
376 bVal = *(sal_Bool*)rValue.getValue();
377 mpPrtOpt->SetPrintRightPage(bVal);
379 break;
380 case HANDLE_PRINTSET_REVERSED:
382 bVal = *(sal_Bool*)rValue.getValue();
383 mpPrtOpt->SetPrintReverse(bVal);
385 break;
386 case HANDLE_PRINTSET_PROSPECT:
388 bVal = *(sal_Bool*)rValue.getValue();
389 mpPrtOpt->SetPrintProspect(bVal);
391 break;
392 case HANDLE_PRINTSET_GRAPHICS:
394 bVal = *(sal_Bool*)rValue.getValue();
395 mpPrtOpt->SetPrintGraphic(bVal);
397 break;
398 case HANDLE_PRINTSET_TABLES:
400 bVal = *(sal_Bool*)rValue.getValue();
401 mpPrtOpt->SetPrintTable(bVal);
403 break;
404 case HANDLE_PRINTSET_DRAWINGS:
406 bVal = *(sal_Bool*)rValue.getValue();
407 mpPrtOpt->SetPrintDraw(bVal);
409 break;
410 case HANDLE_PRINTSET_CONTROLS:
412 bVal = *(sal_Bool*)rValue.getValue();
413 mpPrtOpt->SetPrintControl(bVal);
415 break;
416 case HANDLE_PRINTSET_PAGE_BACKGROUND:
418 bVal = *(sal_Bool*)rValue.getValue();
419 mpPrtOpt->SetPrintPageBackground(bVal);
421 break;
422 case HANDLE_PRINTSET_BLACK_FONTS:
424 bVal = *(sal_Bool*)rValue.getValue();
425 mpPrtOpt->SetPrintBlackFont(bVal);
427 break;
428 case HANDLE_PRINTSET_SINGLE_JOBS:
430 bVal = *(sal_Bool*)rValue.getValue();
431 mpPrtOpt->SetPrintSingleJobs(bVal);
433 break;
434 case HANDLE_PRINTSET_PAPER_FROM_SETUP:
436 bVal = *(sal_Bool*)rValue.getValue();
437 mpPrtOpt->SetPaperFromSetup(bVal);
439 break;
440 case HANDLE_PRINTSET_ANNOTATION_MODE:
442 sal_Int16 nVal = 0;
443 rValue >>= nVal;
444 if(nVal <= text::NotePrintMode_PAGE_END)
445 mpPrtOpt->SetPrintPostIts(nVal);
446 else
447 throw lang::IllegalArgumentException();
449 break;
450 case HANDLE_PRINTSET_EMPTY_PAGES:
452 bVal = *(sal_Bool*)rValue.getValue();
453 mpPrtOpt->SetPrintEmptyPages(bVal);
455 break;
456 case HANDLE_PRINTSET_FAX_NAME:
458 OUString sString;
459 if ( rValue >>= sString)
460 mpPrtOpt->SetFaxName(sString);
461 else
462 throw lang::IllegalArgumentException();
464 break;
465 case HANDLE_PRINTSET_PROSPECT_RTL:
467 bVal = *(sal_Bool*)rValue.getValue();
468 mpPrtOpt->SetPrintProspect_RTL(bVal);
470 break;
471 case HANDLE_PRINTSET_PLACEHOLDER:
473 bVal = *(sal_Bool*)rValue.getValue();
474 mpPrtOpt->SetPrintTextPlaceholder(bVal);
476 break;
477 case HANDLE_PRINTSET_HIDDEN_TEXT:
479 bVal = *(sal_Bool*)rValue.getValue();
480 mpPrtOpt->SetPrintHiddenText(bVal);
482 break;
483 default:
484 throw UnknownPropertyException();
487 void SwXPrintSettings::_postSetValues ()
488 throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException )
490 mpPrtOpt = NULL;
493 void SwXPrintSettings::_preGetValues ()
494 throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException )
496 switch (meType)
498 case PRINT_SETTINGS_MODULE:
499 mpPrtOpt = SW_MOD()->GetPrtOptions( sal_False );
500 break;
501 case PRINT_SETTINGS_WEB:
502 mpPrtOpt = SW_MOD()->GetPrtOptions( sal_True );
503 break;
504 case PRINT_SETTINGS_DOCUMENT:
506 if (!mpDoc)
507 throw IllegalArgumentException ();
508 if ( !mpDoc->getPrintData() )
510 mpPrtOpt = new SwPrintData;
511 mpDoc->setPrintData ( *mpPrtOpt );
512 delete mpPrtOpt;
514 mpPrtOpt = mpDoc->getPrintData();
516 break;
519 void SwXPrintSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, uno::Any & rValue )
520 throw(UnknownPropertyException, WrappedTargetException )
522 sal_Bool bBool = TRUE;
523 sal_Bool bBoolVal;
524 switch( rInfo.mnHandle )
526 case HANDLE_PRINTSET_LEFT_PAGES:
527 bBoolVal = mpPrtOpt->IsPrintLeftPage();
528 break;
529 case HANDLE_PRINTSET_RIGHT_PAGES:
530 bBoolVal = mpPrtOpt->IsPrintRightPage();
531 break;
532 case HANDLE_PRINTSET_REVERSED:
533 bBoolVal = mpPrtOpt->IsPrintReverse();
534 break;
535 case HANDLE_PRINTSET_PROSPECT:
536 bBoolVal = mpPrtOpt->IsPrintProspect();
537 break;
538 case HANDLE_PRINTSET_GRAPHICS:
539 bBoolVal = mpPrtOpt->IsPrintGraphic();
540 break;
541 case HANDLE_PRINTSET_TABLES:
542 bBoolVal = mpPrtOpt->IsPrintTable();
543 break;
544 case HANDLE_PRINTSET_DRAWINGS:
545 bBoolVal = mpPrtOpt->IsPrintDraw();
546 break;
547 case HANDLE_PRINTSET_CONTROLS:
548 bBoolVal = mpPrtOpt->IsPrintControl();
549 break;
550 case HANDLE_PRINTSET_PAGE_BACKGROUND:
551 bBoolVal = mpPrtOpt->IsPrintPageBackground();
552 break;
553 case HANDLE_PRINTSET_BLACK_FONTS:
554 bBoolVal = mpPrtOpt->IsPrintBlackFont();
555 break;
556 case HANDLE_PRINTSET_SINGLE_JOBS:
557 bBoolVal = mpPrtOpt->IsPrintSingleJobs();
558 break;
559 case HANDLE_PRINTSET_EMPTY_PAGES:
560 bBoolVal = mpPrtOpt->IsPrintEmptyPages();
561 break;
562 case HANDLE_PRINTSET_PAPER_FROM_SETUP:
563 bBoolVal = mpPrtOpt->IsPaperFromSetup();
564 break;
565 case HANDLE_PRINTSET_ANNOTATION_MODE:
567 bBool = FALSE;
568 rValue <<= static_cast < sal_Int16 > ( mpPrtOpt->GetPrintPostIts() );
570 break;
571 case HANDLE_PRINTSET_FAX_NAME :
573 bBool = FALSE;
574 rValue <<= mpPrtOpt->GetFaxName();
576 break;
577 case HANDLE_PRINTSET_PROSPECT_RTL:
579 rValue <<= mpPrtOpt->IsPrintProspect_RTL();
581 break;
582 case HANDLE_PRINTSET_PLACEHOLDER:
584 rValue <<= mpPrtOpt->IsPrintTextPlaceholder();
586 break;
587 case HANDLE_PRINTSET_HIDDEN_TEXT:
589 rValue <<= mpPrtOpt->IsPrintHiddenText();
591 break;
592 default:
593 throw UnknownPropertyException();
595 if(bBool)
596 rValue.setValue(&bBoolVal, ::getBooleanCppuType());
598 void SwXPrintSettings::_postGetValues ()
599 throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException )
601 mpPrtOpt = NULL;
603 /* -----------------------------06.04.00 11:02--------------------------------
605 ---------------------------------------------------------------------------*/
606 OUString SwXPrintSettings::getImplementationName(void) throw( RuntimeException )
608 return C2U("SwXPrintSettings");
610 /* -----------------------------06.04.00 11:02--------------------------------
612 ---------------------------------------------------------------------------*/
613 sal_Bool SwXPrintSettings::supportsService(const OUString& rServiceName) throw( RuntimeException )
615 return C2U("com.sun.star.text.PrintSettings") == rServiceName;
617 /* -----------------------------06.04.00 11:02--------------------------------
619 ---------------------------------------------------------------------------*/
620 Sequence< OUString > SwXPrintSettings::getSupportedServiceNames(void) throw( RuntimeException )
622 Sequence< OUString > aRet(1);
623 OUString* pArray = aRet.getArray();
624 pArray[0] = C2U("com.sun.star.text.PrintSettings");
625 return aRet;
629 /******************************************************************
631 ******************************************************************/
632 /*-- 18.12.98 11:01:10---------------------------------------------------
634 -----------------------------------------------------------------------*/
635 SwXViewSettings::SwXViewSettings(sal_Bool bWebView, SwView* pVw)
636 : ChainableHelperNoState( lcl_createViewSettingsInfo (), &Application::GetSolarMutex() )
637 , pView(pVw)
638 , mpViewOption ( NULL )
639 , mpConstViewOption ( NULL )
640 , bObjectValid(sal_True)
641 , bWeb(bWebView)
642 , eHRulerUnit( FUNIT_CM )
643 , mbApplyHRulerMetric( sal_False )
644 , eVRulerUnit( FUNIT_CM )
645 , mbApplyVRulerMetric( sal_False )
647 // This property only exists if we have a view (ie, not at the module )
648 if ( !pView )
649 mpInfo->remove ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "HelpURL" ) ) );
652 /*-- 18.12.98 11:01:10---------------------------------------------------
654 -----------------------------------------------------------------------*/
655 SwXViewSettings::~SwXViewSettings()
656 throw()
660 void SwXViewSettings::_preSetValues ()
661 throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException )
663 const SwViewOption* pVOpt = 0;
664 if(pView)
666 if(!IsValid())
667 return;
668 pVOpt = pView->GetWrtShell().GetViewOptions();
670 else
671 pVOpt = SW_MOD()->GetViewOption(bWeb);
673 mpViewOption = new SwViewOption (*pVOpt);
674 mbApplyZoom = sal_False;
675 if(pView)
676 mpViewOption->SetStarOneSetting(sal_True);
678 void SwXViewSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, const uno::Any &rValue )
679 throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException )
681 sal_Bool bVal = HANDLE_VIEWSET_ZOOM != rInfo.mnHandle ?
682 *(sal_Bool*)rValue.getValue() : sal_False;
683 // the API flag should not be set to the application's view settings
684 switch( rInfo.mnHandle )
686 case HANDLE_VIEWSET_SHOW_RULER : mpViewOption->SetViewAnyRuler(bVal); break;
687 case HANDLE_VIEWSET_HRULER : mpViewOption->SetViewHRuler(bVal); break;
688 case HANDLE_VIEWSET_VRULER : mpViewOption->SetViewVRuler(bVal);break;
689 case HANDLE_VIEWSET_VRULER_RIGHT : mpViewOption->SetVRulerRight(bVal);break;
690 case HANDLE_VIEWSET_HSCROLL : mpViewOption->SetViewHScrollBar(bVal);break;
691 case HANDLE_VIEWSET_VSCROLL : mpViewOption->SetViewVScrollBar(bVal);break;
692 case HANDLE_VIEWSET_GRAPHICS : mpViewOption->SetGraphic(bVal);break;
693 case HANDLE_VIEWSET_TABLES : mpViewOption->SetTable(bVal); break;
694 case HANDLE_VIEWSET_DRAWINGS : mpViewOption->SetDraw(bVal); break;
695 case HANDLE_VIEWSET_FIELD_COMMANDS : mpViewOption->SetFldName(bVal); break;
696 case HANDLE_VIEWSET_ANNOTATIONS : mpViewOption->SetPostIts(bVal); break;
697 case HANDLE_VIEWSET_INDEX_MARK_BACKGROUND : mpViewOption->SetAppearanceFlag(VIEWOPT_FIELD_SHADINGS, bVal, TRUE); break;
698 case HANDLE_VIEWSET_NONPRINTING_CHARACTERS: mpViewOption->SetViewMetaChars( bVal ); break;
699 case HANDLE_VIEWSET_FOOTNOTE_BACKGROUND : mpViewOption->SetAppearanceFlag(VIEWOPT_FIELD_SHADINGS, bVal, TRUE); break;
700 case HANDLE_VIEWSET_TEXT_FIELD_BACKGROUND : mpViewOption->SetAppearanceFlag(VIEWOPT_FIELD_SHADINGS, bVal, TRUE); break;
701 case HANDLE_VIEWSET_PARA_BREAKS : mpViewOption->SetParagraph(bVal); break;
702 case HANDLE_VIEWSET_SOFT_HYPHENS : mpViewOption->SetSoftHyph(bVal); break;
703 case HANDLE_VIEWSET_SPACES : mpViewOption->SetBlank(bVal); break;
704 case HANDLE_VIEWSET_PROTECTED_SPACES : mpViewOption->SetHardBlank(bVal); break;
705 case HANDLE_VIEWSET_TABSTOPS : mpViewOption->SetTab(bVal); break;
706 case HANDLE_VIEWSET_BREAKS : mpViewOption->SetLineBreak(bVal); break;
707 case HANDLE_VIEWSET_HIDDEN_TEXT : mpViewOption->SetShowHiddenField(bVal); break;
708 case HANDLE_VIEWSET_HIDDEN_CHARACTERS : mpViewOption->SetShowHiddenChar(bVal); break;
709 case HANDLE_VIEWSET_HIDDEN_PARAGRAPHS : mpViewOption->SetShowHiddenPara(bVal); break;
710 case HANDLE_VIEWSET_TABLE_BOUNDARIES : mpViewOption->SetAppearanceFlag(VIEWOPT_TABLE_BOUNDARIES, bVal, TRUE); break;
711 case HANDLE_VIEWSET_TEXT_BOUNDARIES : mpViewOption->SetDocBoundaries(bVal); break;
712 case HANDLE_VIEWSET_SMOOTH_SCROLLING : mpViewOption->SetSmoothScroll(bVal); break;
713 case HANDLE_VIEWSET_SOLID_MARK_HANDLES : mpViewOption->SetSolidMarkHdl(bVal); break;
714 case HANDLE_VIEWSET_PREVENT_TIPS : mpViewOption->SetPreventTips(bVal); break;
715 case HANDLE_VIEWSET_IS_RASTER_VISIBLE : mpViewOption->SetGridVisible(bVal); break;
716 case HANDLE_VIEWSET_IS_SNAP_TO_RASTER : mpViewOption->SetSnap(bVal); break;
717 case HANDLE_VIEWSET_RASTER_RESOLUTION_X :
719 sal_Int32 nTmp = 0;
720 if(!(rValue >>= nTmp) || nTmp < 10)
721 throw IllegalArgumentException();
722 Size aSize( mpViewOption->GetSnapSize() );
723 aSize.Width() = MM100_TO_TWIP( nTmp );
724 mpViewOption->SetSnapSize( aSize );
726 break;
727 case HANDLE_VIEWSET_RASTER_RESOLUTION_Y :
729 sal_Int32 nTmp = 0;
730 if(!(rValue >>= nTmp) || nTmp < 10)
731 throw IllegalArgumentException();
732 Size aSize( mpViewOption->GetSnapSize() );
733 aSize.Height() = MM100_TO_TWIP( nTmp );
734 mpViewOption->SetSnapSize( aSize );
736 break;
737 case HANDLE_VIEWSET_RASTER_SUBDIVISION_X :
739 sal_Int32 nTmp = 0;
740 if(!(rValue >>= nTmp) || !(0 <= nTmp && nTmp < 100))
741 throw IllegalArgumentException();
742 mpViewOption->SetDivisionX( (short) nTmp );
744 break;
745 case HANDLE_VIEWSET_RASTER_SUBDIVISION_Y :
747 sal_Int32 nTmp = 0;
748 if(!(rValue >>= nTmp) || !(0 <= nTmp && nTmp < 100))
749 throw IllegalArgumentException();
750 mpViewOption->SetDivisionY( (short) nTmp );
752 break;
753 case HANDLE_VIEWSET_ZOOM :
755 sal_Int16 nZoom = 0;
756 if(!(rValue >>= nZoom) || nZoom > 1000 || nZoom < 5)
757 throw lang::IllegalArgumentException();
758 mpViewOption->SetZoom((sal_uInt16)nZoom);
759 mbApplyZoom = sal_True;
761 break;
762 case HANDLE_VIEWSET_ZOOM_TYPE:
764 sal_Int16 nZoom = 0;
765 if(!(rValue >>= nZoom))
766 throw IllegalArgumentException();
767 SvxZoomType eZoom = (SvxZoomType)USHRT_MAX;
768 switch (nZoom)
770 case view::DocumentZoomType::OPTIMAL:
771 eZoom = SVX_ZOOM_OPTIMAL;
772 break;
773 case view::DocumentZoomType::PAGE_WIDTH:
774 eZoom = SVX_ZOOM_PAGEWIDTH;
775 break;
776 case view::DocumentZoomType::ENTIRE_PAGE:
777 eZoom = SVX_ZOOM_WHOLEPAGE;
778 break;
779 case view::DocumentZoomType::BY_VALUE:
780 eZoom = SVX_ZOOM_PERCENT;
781 break;
782 case view::DocumentZoomType::PAGE_WIDTH_EXACT:
783 eZoom = SVX_ZOOM_PAGEWIDTH_NOBORDER;
784 break;
785 default:
786 throw IllegalArgumentException(
787 ::rtl::OUString::createFromAscii(
788 "SwXViewSettings: invalid zoom type"), 0, 0);
789 break;
791 if(eZoom < USHRT_MAX)
793 mpViewOption->SetZoomType( eZoom );
794 mbApplyZoom = sal_True;
797 break;
798 case HANDLE_VIEWSET_ONLINE_LAYOUT :
800 if( pView && !bVal != !pView->GetWrtShell().getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) )
801 pView->GetDocShell()->ToggleBrowserMode(bVal, pView );
803 break;
804 case HANDLE_VIEWSET_HELP_URL :
806 if ( pView )
808 OUString sHelpURL;
809 if ( ! ( rValue >>= sHelpURL ) )
810 throw IllegalArgumentException();
811 SwEditWin &rEditWin = pView->GetEditWin();
812 OUString sPrefix = sHelpURL.copy ( 0, 4 );
813 // Make sure we have a valid string...should be in the format HID:12345
814 if ( ! sPrefix.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "HID:" ) ) )
815 throw IllegalArgumentException ();
816 OUString sNumber = sHelpURL.copy ( 4 );
817 sal_uInt32 nHelpId = sNumber.toInt32();
818 rEditWin.SetHelpId ( nHelpId );
820 else
821 throw UnknownPropertyException();
823 break;
824 case HANDLE_VIEWSET_HORI_RULER_METRIC:
825 case HANDLE_VIEWSET_VERT_RULER_METRIC:
827 sal_Int32 nUnit = -1;
828 if( rValue >>= nUnit )
829 switch( nUnit )
831 case FUNIT_MM:
832 case FUNIT_CM:
833 case FUNIT_POINT:
834 case FUNIT_PICA:
835 case FUNIT_INCH:
836 if( rInfo.mnHandle == HANDLE_VIEWSET_HORI_RULER_METRIC )
838 eHRulerUnit = nUnit;
839 mbApplyHRulerMetric = sal_True;
841 else
843 eVRulerUnit = nUnit;
844 mbApplyVRulerMetric = sal_True;
846 break;
847 default:
848 throw IllegalArgumentException();
851 break;
852 default:
853 throw UnknownPropertyException();
857 void SwXViewSettings::_postSetValues ()
858 throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException )
860 if( pView )
862 if(mbApplyZoom )
863 pView->SetZoom( (SvxZoomType)mpViewOption->GetZoomType(),
864 mpViewOption->GetZoom(), sal_True );
865 if(mbApplyHRulerMetric)
866 pView->ChangeTabMetric((FieldUnit)eHRulerUnit);
867 if(mbApplyVRulerMetric)
868 pView->ChangeVLinealMetric((FieldUnit)eVRulerUnit);
871 else
873 if(mbApplyHRulerMetric)
874 SW_MOD()->ApplyRulerMetric( (FieldUnit)eHRulerUnit, sal_True, bWeb );
875 if(mbApplyVRulerMetric)
876 SW_MOD()->ApplyRulerMetric( (FieldUnit)eVRulerUnit, sal_False, bWeb );
880 SW_MOD()->ApplyUsrPref( *mpViewOption, pView, pView ? VIEWOPT_DEST_VIEW_ONLY
881 : bWeb ? VIEWOPT_DEST_WEB
882 : VIEWOPT_DEST_TEXT );
885 delete mpViewOption;
886 mpViewOption = NULL;
889 void SwXViewSettings::_preGetValues ()
890 throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException )
892 if(pView)
894 if(!IsValid())
895 return;
896 mpConstViewOption = pView->GetWrtShell().GetViewOptions();
898 else
899 mpConstViewOption = SW_MOD()->GetViewOption(bWeb);
901 void SwXViewSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, uno::Any & rValue )
902 throw(UnknownPropertyException, WrappedTargetException )
904 sal_Bool bBool = TRUE;
905 sal_Bool bBoolVal;
906 switch( rInfo.mnHandle )
908 case HANDLE_VIEWSET_SHOW_RULER: bBoolVal = mpConstViewOption->IsViewAnyRuler(); break;
909 case HANDLE_VIEWSET_HRULER : bBoolVal = mpConstViewOption->IsViewHRuler(TRUE); break;
910 case HANDLE_VIEWSET_VRULER : bBoolVal = mpConstViewOption->IsViewVRuler(TRUE);break;
911 case HANDLE_VIEWSET_VRULER_RIGHT : bBoolVal = mpConstViewOption->IsVRulerRight();break;
912 case HANDLE_VIEWSET_HSCROLL: bBoolVal = mpConstViewOption->IsViewHScrollBar();break;
913 case HANDLE_VIEWSET_VSCROLL: bBoolVal = mpConstViewOption->IsViewVScrollBar();break;
914 case HANDLE_VIEWSET_GRAPHICS : bBoolVal = mpConstViewOption->IsGraphic();break;
915 case HANDLE_VIEWSET_TABLES : bBoolVal = mpConstViewOption->IsTable(); break;
916 case HANDLE_VIEWSET_DRAWINGS : bBoolVal = mpConstViewOption->IsDraw(); break;
917 case HANDLE_VIEWSET_FIELD_COMMANDS : bBoolVal = mpConstViewOption->IsFldName(); break;
918 case HANDLE_VIEWSET_ANNOTATIONS : bBoolVal = mpConstViewOption->IsPostIts(); break;
919 case HANDLE_VIEWSET_INDEX_MARK_BACKGROUND : bBoolVal = SwViewOption::IsFieldShadings(); break;
920 case HANDLE_VIEWSET_NONPRINTING_CHARACTERS: bBoolVal = mpConstViewOption->IsViewMetaChars(); break;
921 case HANDLE_VIEWSET_FOOTNOTE_BACKGROUND : bBoolVal = SwViewOption::IsFieldShadings(); break;
922 case HANDLE_VIEWSET_TEXT_FIELD_BACKGROUND : bBoolVal = SwViewOption::IsFieldShadings(); break;
923 case HANDLE_VIEWSET_PARA_BREAKS : bBoolVal = mpConstViewOption->IsParagraph(sal_True); break;
924 case HANDLE_VIEWSET_SOFT_HYPHENS : bBoolVal = mpConstViewOption->IsSoftHyph(); break;
925 case HANDLE_VIEWSET_SPACES : bBoolVal = mpConstViewOption->IsBlank(sal_True); break;
926 case HANDLE_VIEWSET_PROTECTED_SPACES : bBoolVal = mpConstViewOption->IsHardBlank(); break;
927 case HANDLE_VIEWSET_TABSTOPS : bBoolVal = mpConstViewOption->IsTab(sal_True); break;
928 case HANDLE_VIEWSET_BREAKS : bBoolVal = mpConstViewOption->IsLineBreak(sal_True); break;
929 case HANDLE_VIEWSET_HIDDEN_TEXT : bBoolVal = mpConstViewOption->IsShowHiddenField(); break;
930 case HANDLE_VIEWSET_HIDDEN_CHARACTERS : bBoolVal = mpConstViewOption->IsShowHiddenChar(); break;
931 case HANDLE_VIEWSET_HIDDEN_PARAGRAPHS : bBoolVal = mpConstViewOption->IsShowHiddenPara(); break;
932 case HANDLE_VIEWSET_TABLE_BOUNDARIES : bBoolVal = SwViewOption::IsTableBoundaries(); break;
933 case HANDLE_VIEWSET_TEXT_BOUNDARIES : bBoolVal = SwViewOption::IsDocBoundaries(); break;
934 case HANDLE_VIEWSET_SMOOTH_SCROLLING : bBoolVal = mpConstViewOption->IsSmoothScroll(); break;
935 case HANDLE_VIEWSET_SOLID_MARK_HANDLES : bBoolVal = mpConstViewOption->IsSolidMarkHdl(); break;
936 case HANDLE_VIEWSET_PREVENT_TIPS : bBoolVal = mpConstViewOption->IsPreventTips(); break;
937 case HANDLE_VIEWSET_IS_RASTER_VISIBLE : bBoolVal = mpConstViewOption->IsGridVisible(); break;
938 case HANDLE_VIEWSET_IS_SNAP_TO_RASTER : bBoolVal = mpConstViewOption->IsSnap(); break;
939 case HANDLE_VIEWSET_RASTER_RESOLUTION_X :
940 bBool = FALSE;
941 rValue <<= (sal_Int32) TWIP_TO_MM100(mpConstViewOption->GetSnapSize().Width());
942 break;
943 case HANDLE_VIEWSET_RASTER_RESOLUTION_Y :
944 bBool = FALSE;
945 rValue <<= (sal_Int32) TWIP_TO_MM100(mpConstViewOption->GetSnapSize().Height());
946 break;
947 case HANDLE_VIEWSET_RASTER_SUBDIVISION_X :
948 bBool = FALSE;
949 rValue <<= (sal_Int32) mpConstViewOption->GetDivisionX();
950 break;
951 case HANDLE_VIEWSET_RASTER_SUBDIVISION_Y :
952 bBool = FALSE;
953 rValue <<= (sal_Int32) mpConstViewOption->GetDivisionY();
954 break;
955 case HANDLE_VIEWSET_ZOOM :
956 bBool = FALSE;
957 rValue <<= (sal_Int16)mpConstViewOption->GetZoom();
958 break;
959 case HANDLE_VIEWSET_ZOOM_TYPE:
961 bBool = FALSE;
962 sal_Int16 nRet(0);
963 switch (mpConstViewOption->GetZoomType())
965 case SVX_ZOOM_OPTIMAL:
966 nRet = view::DocumentZoomType::OPTIMAL;
967 break;
968 case SVX_ZOOM_PAGEWIDTH:
969 nRet = view::DocumentZoomType::PAGE_WIDTH;
970 break;
971 case SVX_ZOOM_WHOLEPAGE:
972 nRet = view::DocumentZoomType::ENTIRE_PAGE;
973 break;
974 case SVX_ZOOM_PERCENT:
975 nRet = view::DocumentZoomType::BY_VALUE;
976 break;
977 case SVX_ZOOM_PAGEWIDTH_NOBORDER:
978 nRet = view::DocumentZoomType::PAGE_WIDTH_EXACT;
979 break;
980 default:
981 OSL_ENSURE(false, "SwXViewSettings: invalid zoom type");
982 break;
984 rValue <<= nRet;
986 break;
987 case HANDLE_VIEWSET_ONLINE_LAYOUT:
988 if(pView)
989 bBoolVal = pView->GetWrtShell().getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE);
990 break;
991 case HANDLE_VIEWSET_HELP_URL :
993 if ( pView )
995 bBool = sal_False;
996 OUStringBuffer sHelpURL;
997 sHelpURL.appendAscii ( "HID:" );
998 SwEditWin &rEditWin = pView->GetEditWin();
999 sHelpURL.append ( static_cast < sal_Int32 > ( rEditWin.GetHelpId() ) );
1000 rValue <<= sHelpURL.makeStringAndClear();
1002 else
1003 throw UnknownPropertyException();
1005 break;
1006 case HANDLE_VIEWSET_HORI_RULER_METRIC:
1008 if ( pView )
1010 FieldUnit eUnit;
1011 pView->GetHLinealMetric( eUnit );
1012 rValue <<= (sal_Int32)eUnit;
1014 else
1016 const SwMasterUsrPref* pUsrPref = SW_MOD()->GetUsrPref( bWeb );
1017 rValue <<= (sal_Int32)pUsrPref->GetHScrollMetric();
1019 bBool = sal_False;
1021 break;
1022 case HANDLE_VIEWSET_VERT_RULER_METRIC:
1024 if ( pView )
1026 FieldUnit eUnit;
1027 pView->GetVLinealMetric( eUnit );
1028 rValue <<= (sal_Int32)eUnit;
1030 else
1032 const SwMasterUsrPref* pUsrPref = SW_MOD()->GetUsrPref( bWeb );
1033 rValue <<= (sal_Int32)pUsrPref->GetVScrollMetric();
1035 bBool = sal_False;
1037 break;
1038 default: DBG_ERROR("Diese Id gibt's nicht!");
1040 if( bBool )
1041 rValue.setValue(&bBoolVal, ::getBooleanCppuType());
1043 void SwXViewSettings::_postGetValues ()
1044 throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException )
1046 mpConstViewOption = NULL;
1049 OUString SwXViewSettings::getImplementationName(void) throw( RuntimeException )
1051 return C2U("SwXViewSettings");
1054 sal_Bool SwXViewSettings::supportsService(const OUString& rServiceName) throw( RuntimeException )
1056 return C2U("com.sun.star.text.ViewSettings") == rServiceName;
1059 Sequence< OUString > SwXViewSettings::getSupportedServiceNames(void) throw( RuntimeException )
1061 Sequence< OUString > aRet(1);
1062 OUString* pArray = aRet.getArray();
1063 pArray[0] = C2U("com.sun.star.text.ViewSettings");
1064 return aRet;