1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_sw.hxx" 26 27 28 #include <swtypes.hxx> 29 #include <tools/debug.hxx> 30 #include <unomod.hxx> 31 #include <unomid.h> 32 #include <unoprnms.hxx> 33 #include <unomap.hxx> 34 #include <prtopt.hxx> 35 #include <tools/shl.hxx> 36 #include <swmodule.hxx> 37 #include <view.hxx> 38 #include <docsh.hxx> 39 #include <wrtsh.hxx> 40 #include <viewopt.hxx> 41 #include <vos/mutex.hxx> 42 #include <vcl/svapp.hxx> 43 #include <com/sun/star/text/NotePrintMode.hpp> 44 #include <doc.hxx> 45 #include <comphelper/TypeGeneration.hxx> 46 #include <com/sun/star/beans/PropertyAttribute.hpp> 47 #include <com/sun/star/view/DocumentZoomType.hpp> 48 #include <comphelper/ChainablePropertySetInfo.hxx> 49 #include <edtwin.hxx> 50 #include <rtl/ustrbuf.hxx> 51 #include <tools/urlobj.hxx> 52 53 using namespace ::com::sun::star; 54 using namespace ::com::sun::star::uno; 55 using namespace ::com::sun::star::beans; 56 using namespace ::com::sun::star::lang; 57 using namespace ::comphelper; 58 using ::rtl::OUString; 59 using ::rtl::OUStringBuffer; 60 61 enum SwViewSettingsPropertyHandles 62 { 63 HANDLE_VIEWSET_ANNOTATIONS, 64 HANDLE_VIEWSET_BREAKS, 65 HANDLE_VIEWSET_DRAWINGS, 66 HANDLE_VIEWSET_FIELD_COMMANDS, 67 HANDLE_VIEWSET_FOOTNOTE_BACKGROUND, 68 HANDLE_VIEWSET_GRAPHICS, 69 HANDLE_VIEWSET_HIDDEN_CHARACTERS, 70 HANDLE_VIEWSET_HIDDEN_PARAGRAPHS, 71 HANDLE_VIEWSET_HIDDEN_TEXT, 72 HANDLE_VIEWSET_HRULER, 73 HANDLE_VIEWSET_HSCROLL, 74 HANDLE_VIEWSET_INDEX_MARK_BACKGROUND, 75 HANDLE_VIEWSET_NONPRINTING_CHARACTERS, 76 HANDLE_VIEWSET_ONLINE_LAYOUT, 77 HANDLE_VIEWSET_PARA_BREAKS, 78 HANDLE_VIEWSET_PROTECTED_SPACES, 79 HANDLE_VIEWSET_SOFT_HYPHENS, 80 HANDLE_VIEWSET_SPACES, 81 HANDLE_VIEWSET_TABLE_BOUNDARIES, 82 HANDLE_VIEWSET_TABLES, 83 HANDLE_VIEWSET_TABSTOPS, 84 HANDLE_VIEWSET_TEXT_BOUNDARIES, 85 HANDLE_VIEWSET_TEXT_FIELD_BACKGROUND, 86 HANDLE_VIEWSET_VRULER, 87 HANDLE_VIEWSET_VSCROLL, 88 HANDLE_VIEWSET_SMOOTH_SCROLLING, 89 HANDLE_VIEWSET_SOLID_MARK_HANDLES, 90 HANDLE_VIEWSET_ZOOM_TYPE, 91 HANDLE_VIEWSET_ZOOM, 92 HANDLE_VIEWSET_PREVENT_TIPS, 93 HANDLE_VIEWSET_HELP_URL, 94 HANDLE_VIEWSET_VRULER_RIGHT, 95 HANDLE_VIEWSET_SHOW_RULER, 96 HANDLE_VIEWSET_IS_RASTER_VISIBLE, 97 HANDLE_VIEWSET_IS_SNAP_TO_RASTER, 98 HANDLE_VIEWSET_RASTER_RESOLUTION_X, 99 HANDLE_VIEWSET_RASTER_RESOLUTION_Y, 100 HANDLE_VIEWSET_RASTER_SUBDIVISION_X, 101 HANDLE_VIEWSET_RASTER_SUBDIVISION_Y, 102 HANDLE_VIEWSET_HORI_RULER_METRIC, 103 HANDLE_VIEWSET_VERT_RULER_METRIC 104 }; 105 enum SwPrintSettingsPropertyHandles 106 { 107 HANDLE_PRINTSET_ANNOTATION_MODE, 108 HANDLE_PRINTSET_BLACK_FONTS, 109 HANDLE_PRINTSET_CONTROLS, 110 HANDLE_PRINTSET_DRAWINGS, 111 HANDLE_PRINTSET_GRAPHICS, 112 HANDLE_PRINTSET_LEFT_PAGES, 113 HANDLE_PRINTSET_PAGE_BACKGROUND, 114 HANDLE_PRINTSET_PROSPECT, 115 HANDLE_PRINTSET_REVERSED, 116 HANDLE_PRINTSET_RIGHT_PAGES, 117 HANDLE_PRINTSET_FAX_NAME, 118 HANDLE_PRINTSET_PAPER_FROM_SETUP, 119 HANDLE_PRINTSET_TABLES, 120 HANDLE_PRINTSET_SINGLE_JOBS, 121 HANDLE_PRINTSET_EMPTY_PAGES, 122 HANDLE_PRINTSET_PROSPECT_RTL, 123 HANDLE_PRINTSET_PLACEHOLDER, 124 HANDLE_PRINTSET_HIDDEN_TEXT 125 }; 126 127 static ChainablePropertySetInfo * lcl_createViewSettingsInfo() 128 { 129 static PropertyInfo aViewSettingsMap_Impl[] = 130 { 131 { RTL_CONSTASCII_STRINGPARAM ( "HelpURL" ), HANDLE_VIEWSET_HELP_URL , CPPUTYPE_OUSTRING, PROPERTY_NONE, 0}, 132 { RTL_CONSTASCII_STRINGPARAM ( "HorizontalRulerMetric"),HANDLE_VIEWSET_HORI_RULER_METRIC , CPPUTYPE_INT32, PROPERTY_NONE, 0}, 133 { RTL_CONSTASCII_STRINGPARAM ( "IsRasterVisible"), HANDLE_VIEWSET_IS_RASTER_VISIBLE, CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 134 { RTL_CONSTASCII_STRINGPARAM ( "IsSnapToRaster"), HANDLE_VIEWSET_IS_SNAP_TO_RASTER, CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 135 { RTL_CONSTASCII_STRINGPARAM ( "IsVertRulerRightAligned"),HANDLE_VIEWSET_VRULER_RIGHT , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 136 { RTL_CONSTASCII_STRINGPARAM ( "PreventHelpTips" ), HANDLE_VIEWSET_PREVENT_TIPS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 137 { RTL_CONSTASCII_STRINGPARAM ( "RasterResolutionX"), HANDLE_VIEWSET_RASTER_RESOLUTION_X, CPPUTYPE_INT32, PROPERTY_NONE, 0}, 138 { RTL_CONSTASCII_STRINGPARAM ( "RasterResolutionY"), HANDLE_VIEWSET_RASTER_RESOLUTION_Y, CPPUTYPE_INT32, PROPERTY_NONE, 0}, 139 { RTL_CONSTASCII_STRINGPARAM ( "RasterSubdivisionX"), HANDLE_VIEWSET_RASTER_SUBDIVISION_X, CPPUTYPE_INT32, PROPERTY_NONE, 0}, 140 { RTL_CONSTASCII_STRINGPARAM ( "RasterSubdivisionY"), HANDLE_VIEWSET_RASTER_SUBDIVISION_Y, CPPUTYPE_INT32, PROPERTY_NONE, 0}, 141 { RTL_CONSTASCII_STRINGPARAM ( "ShowAnnotations" ), HANDLE_VIEWSET_ANNOTATIONS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 142 { RTL_CONSTASCII_STRINGPARAM ( "ShowBreaks"), HANDLE_VIEWSET_BREAKS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 143 { RTL_CONSTASCII_STRINGPARAM ( "ShowDrawings"), HANDLE_VIEWSET_DRAWINGS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 144 { RTL_CONSTASCII_STRINGPARAM ( "ShowFieldCommands"), HANDLE_VIEWSET_FIELD_COMMANDS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 145 { RTL_CONSTASCII_STRINGPARAM ( "ShowFootnoteBackground"),HANDLE_VIEWSET_FOOTNOTE_BACKGROUND , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 146 { RTL_CONSTASCII_STRINGPARAM ( "ShowGraphics"), HANDLE_VIEWSET_GRAPHICS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 147 { RTL_CONSTASCII_STRINGPARAM ( "ShowHiddenCharacters"), HANDLE_VIEWSET_HIDDEN_CHARACTERS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 148 { RTL_CONSTASCII_STRINGPARAM ( "ShowHiddenParagraphs"), HANDLE_VIEWSET_HIDDEN_PARAGRAPHS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 149 { RTL_CONSTASCII_STRINGPARAM ( "ShowHiddenText"), HANDLE_VIEWSET_HIDDEN_TEXT , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 150 { RTL_CONSTASCII_STRINGPARAM ( "ShowHoriRuler"), HANDLE_VIEWSET_HRULER , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 151 { RTL_CONSTASCII_STRINGPARAM ( "ShowHoriScrollBar"), HANDLE_VIEWSET_HSCROLL , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 152 { RTL_CONSTASCII_STRINGPARAM ( "ShowIndexMarkBackground"),HANDLE_VIEWSET_INDEX_MARK_BACKGROUND, CPPUTYPE_BOOLEAN,PROPERTY_NONE, 0}, 153 { RTL_CONSTASCII_STRINGPARAM ( "ShowNonprintingCharacters"),HANDLE_VIEWSET_NONPRINTING_CHARACTERS, CPPUTYPE_BOOLEAN,PROPERTY_NONE, 0}, 154 { RTL_CONSTASCII_STRINGPARAM ( "ShowOnlineLayout"), HANDLE_VIEWSET_ONLINE_LAYOUT , CPPUTYPE_BOOLEAN, PropertyAttribute::MAYBEVOID, 0}, 155 { RTL_CONSTASCII_STRINGPARAM ( "ShowParaBreaks"), HANDLE_VIEWSET_PARA_BREAKS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 156 { RTL_CONSTASCII_STRINGPARAM ( "ShowProtectedSpaces"), HANDLE_VIEWSET_PROTECTED_SPACES , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 157 { RTL_CONSTASCII_STRINGPARAM ( "ShowRulers"), HANDLE_VIEWSET_SHOW_RULER , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 158 { RTL_CONSTASCII_STRINGPARAM ( "ShowSoftHyphens"), HANDLE_VIEWSET_SOFT_HYPHENS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 159 { RTL_CONSTASCII_STRINGPARAM ( "ShowSpaces"), HANDLE_VIEWSET_SPACES , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 160 { RTL_CONSTASCII_STRINGPARAM ( "ShowTableBoundaries"), HANDLE_VIEWSET_TABLE_BOUNDARIES , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 161 { RTL_CONSTASCII_STRINGPARAM ( "ShowTables"), HANDLE_VIEWSET_TABLES , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 162 { RTL_CONSTASCII_STRINGPARAM ( "ShowTabstops"), HANDLE_VIEWSET_TABSTOPS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 163 { RTL_CONSTASCII_STRINGPARAM ( "ShowTextBoundaries"), HANDLE_VIEWSET_TEXT_BOUNDARIES , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 164 { RTL_CONSTASCII_STRINGPARAM ( "ShowTextFieldBackground"),HANDLE_VIEWSET_TEXT_FIELD_BACKGROUND, CPPUTYPE_BOOLEAN,PROPERTY_NONE, 0}, 165 { RTL_CONSTASCII_STRINGPARAM ( "ShowVertRuler"), HANDLE_VIEWSET_VRULER , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 166 { RTL_CONSTASCII_STRINGPARAM ( "ShowVertScrollBar"), HANDLE_VIEWSET_VSCROLL , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 167 { RTL_CONSTASCII_STRINGPARAM ( "SmoothScrolling"), HANDLE_VIEWSET_SMOOTH_SCROLLING , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 168 { RTL_CONSTASCII_STRINGPARAM ( "SolidMarkHandles"), HANDLE_VIEWSET_SOLID_MARK_HANDLES , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 169 { RTL_CONSTASCII_STRINGPARAM ( "VerticalRulerMetric"), HANDLE_VIEWSET_VERT_RULER_METRIC , CPPUTYPE_INT32, PROPERTY_NONE, 0}, 170 { RTL_CONSTASCII_STRINGPARAM ( "ZoomType"), HANDLE_VIEWSET_ZOOM_TYPE , CPPUTYPE_INT16, PROPERTY_NONE, 0}, 171 { RTL_CONSTASCII_STRINGPARAM ( "ZoomValue"), HANDLE_VIEWSET_ZOOM , CPPUTYPE_INT16, PROPERTY_NONE, 0}, 172 { 0, 0, 0, CPPUTYPE_UNKNOWN, 0, 0 } 173 }; 174 return new ChainablePropertySetInfo ( aViewSettingsMap_Impl ); 175 } 176 static ChainablePropertySetInfo * lcl_createPrintSettingsInfo() 177 { 178 static PropertyInfo aPrintSettingsMap_Impl[] = 179 { 180 { RTL_CONSTASCII_STRINGPARAM ( "PrintAnnotationMode" ), HANDLE_PRINTSET_ANNOTATION_MODE , CPPUTYPE_INT16, PROPERTY_NONE, 0}, 181 { RTL_CONSTASCII_STRINGPARAM ( "PrintBlackFonts" ), HANDLE_PRINTSET_BLACK_FONTS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 182 { RTL_CONSTASCII_STRINGPARAM ( "PrintControls" ), HANDLE_PRINTSET_CONTROLS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 183 { RTL_CONSTASCII_STRINGPARAM ( "PrintDrawings" ), HANDLE_PRINTSET_DRAWINGS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 184 { RTL_CONSTASCII_STRINGPARAM ( "PrintGraphics" ), HANDLE_PRINTSET_GRAPHICS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 185 { RTL_CONSTASCII_STRINGPARAM ( "PrintHiddenText"), HANDLE_PRINTSET_HIDDEN_TEXT , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 186 { RTL_CONSTASCII_STRINGPARAM ( "PrintLeftPages" ), HANDLE_PRINTSET_LEFT_PAGES , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 187 { RTL_CONSTASCII_STRINGPARAM ( "PrintPageBackground" ), HANDLE_PRINTSET_PAGE_BACKGROUND , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 188 { RTL_CONSTASCII_STRINGPARAM ( "PrintProspect" ), HANDLE_PRINTSET_PROSPECT , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 189 { RTL_CONSTASCII_STRINGPARAM ( "PrintProspectRTL" ), HANDLE_PRINTSET_PROSPECT_RTL , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 190 { RTL_CONSTASCII_STRINGPARAM ( "PrintReversed" ), HANDLE_PRINTSET_REVERSED , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 191 { RTL_CONSTASCII_STRINGPARAM ( "PrintRightPages" ), HANDLE_PRINTSET_RIGHT_PAGES , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 192 { RTL_CONSTASCII_STRINGPARAM ( "PrintFaxName" ), HANDLE_PRINTSET_FAX_NAME , CPPUTYPE_OUSTRING, PROPERTY_NONE, 0}, 193 { RTL_CONSTASCII_STRINGPARAM ( "PrintPaperFromSetup" ), HANDLE_PRINTSET_PAPER_FROM_SETUP , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 194 { RTL_CONSTASCII_STRINGPARAM ( "PrintTables" ), HANDLE_PRINTSET_TABLES , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 195 { RTL_CONSTASCII_STRINGPARAM ( "PrintTextPlaceholder"), HANDLE_PRINTSET_PLACEHOLDER , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 196 { RTL_CONSTASCII_STRINGPARAM ( "PrintSingleJobs" ), HANDLE_PRINTSET_SINGLE_JOBS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 197 { RTL_CONSTASCII_STRINGPARAM ( "PrintEmptyPages" ), HANDLE_PRINTSET_EMPTY_PAGES , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0}, 198 { 0, 0, 0, CPPUTYPE_UNKNOWN, 0, 0 } 199 }; 200 return new ChainablePropertySetInfo ( aPrintSettingsMap_Impl ); 201 } 202 203 /****************************************************************** 204 * SwXModule 205 ******************************************************************/ 206 /* -----------------30.03.99 15:10------------------- 207 * 208 * --------------------------------------------------*/ 209 Reference< uno::XInterface > SAL_CALL SwXModule_createInstance( 210 const Reference< XMultiServiceFactory > & /*rSMgr*/) throw( Exception ) 211 { 212 static Reference< uno::XInterface > xModule = (cppu::OWeakObject*)new SwXModule();; 213 return xModule; 214 } 215 /* -----------------------------17.04.01 13:11-------------------------------- 216 217 ---------------------------------------------------------------------------*/ 218 Sequence< OUString > SAL_CALL SwXModule_getSupportedServiceNames() throw() 219 { 220 OUString sService( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.GlobalSettings")); 221 const Sequence< OUString > aSeq( &sService, 1 ); 222 return aSeq; 223 } 224 /* -----------------------------17.04.01 13:11-------------------------------- 225 226 ---------------------------------------------------------------------------*/ 227 OUString SAL_CALL SwXModule_getImplementationName() throw() 228 { 229 return OUString( RTL_CONSTASCII_USTRINGPARAM("SwXModule" ) ); 230 } 231 /*-- 17.12.98 12:19:01--------------------------------------------------- 232 233 -----------------------------------------------------------------------*/ 234 SwXModule::SwXModule() : 235 pxViewSettings(0), 236 pxPrintSettings(0) 237 { 238 } 239 /*-- 17.12.98 12:19:02--------------------------------------------------- 240 241 -----------------------------------------------------------------------*/ 242 SwXModule::~SwXModule() 243 { 244 delete pxViewSettings; 245 delete pxPrintSettings; 246 } 247 /*-- 17.12.98 12:19:03--------------------------------------------------- 248 249 -----------------------------------------------------------------------*/ 250 Reference< XPropertySet > SwXModule::getViewSettings(void) throw( uno::RuntimeException ) 251 { 252 ::vos::OGuard aGuard(Application::GetSolarMutex()); 253 if(!pxViewSettings) 254 { 255 ((SwXModule*)this)->pxViewSettings = new Reference< XPropertySet > ; 256 DBG_ERROR("Web oder Text?"); 257 *pxViewSettings = static_cast < HelperBaseNoState * > ( new SwXViewSettings( sal_False, 0 ) ); 258 } 259 return *pxViewSettings; 260 } 261 /*-- 17.12.98 12:19:03--------------------------------------------------- 262 263 -----------------------------------------------------------------------*/ 264 Reference< XPropertySet > SwXModule::getPrintSettings(void) throw( uno::RuntimeException ) 265 { 266 ::vos::OGuard aGuard(Application::GetSolarMutex()); 267 if(!pxPrintSettings) 268 { 269 ((SwXModule*)this)->pxPrintSettings = new Reference< XPropertySet > ; 270 DBG_ERROR("Web oder Text?"); 271 *pxPrintSettings = static_cast < HelperBaseNoState * > ( new SwXPrintSettings ( PRINT_SETTINGS_MODULE ) ); 272 } 273 return *pxPrintSettings; 274 } 275 /* -----------------------------06.04.00 10:59-------------------------------- 276 277 ---------------------------------------------------------------------------*/ 278 OUString SwXModule::getImplementationName(void) throw( RuntimeException ) 279 { 280 return SwXModule_getImplementationName(); 281 } 282 /* -----------------------------06.04.00 10:59-------------------------------- 283 284 ---------------------------------------------------------------------------*/ 285 sal_Bool SwXModule::supportsService(const OUString& rServiceName) throw( RuntimeException ) 286 { 287 const Sequence< OUString > aNames = SwXModule_getSupportedServiceNames(); 288 for(sal_Int32 nService = 0; nService < aNames.getLength(); nService++) 289 { 290 if(aNames.getConstArray()[nService] == rServiceName) 291 return sal_True; 292 } 293 return sal_False; 294 } 295 /* -----------------------------06.04.00 10:59-------------------------------- 296 297 ---------------------------------------------------------------------------*/ 298 Sequence< OUString > SwXModule::getSupportedServiceNames(void) throw( RuntimeException ) 299 { 300 return SwXModule_getSupportedServiceNames(); 301 } 302 303 /****************************************************************** 304 * SwXPrintSettings 305 ******************************************************************/ 306 /*-- 17.12.98 12:54:04--------------------------------------------------- 307 308 -----------------------------------------------------------------------*/ 309 SwXPrintSettings::SwXPrintSettings(SwXPrintSettingsType eType, SwDoc* pDoc) 310 : ChainableHelperNoState ( lcl_createPrintSettingsInfo (), &Application::GetSolarMutex() ) 311 , meType(eType) 312 , mpPrtOpt ( NULL ) 313 , mpDoc ( pDoc ) 314 { 315 } 316 /*-- 17.12.98 12:54:05--------------------------------------------------- 317 318 -----------------------------------------------------------------------*/ 319 SwXPrintSettings::~SwXPrintSettings() 320 throw() 321 { 322 } 323 324 void SwXPrintSettings::_preSetValues () 325 throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException ) 326 { 327 switch (meType) 328 { 329 case PRINT_SETTINGS_MODULE: 330 mpPrtOpt = SW_MOD()->GetPrtOptions( sal_False ); 331 break; 332 case PRINT_SETTINGS_WEB: 333 mpPrtOpt = SW_MOD()->GetPrtOptions( sal_True ); 334 break; 335 case PRINT_SETTINGS_DOCUMENT: 336 { 337 if (!mpDoc) 338 throw IllegalArgumentException (); 339 mpPrtOpt = const_cast< SwPrintData * >(&mpDoc->getPrintData()); 340 } 341 break; 342 } 343 } 344 345 void SwXPrintSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, const uno::Any &rValue ) 346 throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException ) 347 { 348 sal_Bool bVal; 349 if ( rInfo.mnHandle != HANDLE_PRINTSET_ANNOTATION_MODE && 350 rInfo.mnHandle != HANDLE_PRINTSET_FAX_NAME ) 351 bVal = *(sal_Bool*)rValue.getValue(); 352 353 switch( rInfo.mnHandle ) 354 { 355 case HANDLE_PRINTSET_LEFT_PAGES: 356 { 357 bVal = *(sal_Bool*)rValue.getValue(); 358 mpPrtOpt->SetPrintLeftPage(bVal); 359 } 360 break; 361 case HANDLE_PRINTSET_RIGHT_PAGES: 362 { 363 bVal = *(sal_Bool*)rValue.getValue(); 364 mpPrtOpt->SetPrintRightPage(bVal); 365 } 366 break; 367 case HANDLE_PRINTSET_REVERSED: 368 { 369 bVal = *(sal_Bool*)rValue.getValue(); 370 mpPrtOpt->SetPrintReverse(bVal); 371 } 372 break; 373 case HANDLE_PRINTSET_PROSPECT: 374 { 375 bVal = *(sal_Bool*)rValue.getValue(); 376 mpPrtOpt->SetPrintProspect(bVal); 377 } 378 break; 379 case HANDLE_PRINTSET_GRAPHICS: 380 { 381 bVal = *(sal_Bool*)rValue.getValue(); 382 mpPrtOpt->SetPrintGraphic(bVal); 383 } 384 break; 385 case HANDLE_PRINTSET_TABLES: 386 { 387 bVal = *(sal_Bool*)rValue.getValue(); 388 mpPrtOpt->SetPrintTable(bVal); 389 } 390 break; 391 case HANDLE_PRINTSET_DRAWINGS: 392 { 393 bVal = *(sal_Bool*)rValue.getValue(); 394 mpPrtOpt->SetPrintDraw(bVal); 395 } 396 break; 397 case HANDLE_PRINTSET_CONTROLS: 398 { 399 bVal = *(sal_Bool*)rValue.getValue(); 400 mpPrtOpt->SetPrintControl(bVal); 401 } 402 break; 403 case HANDLE_PRINTSET_PAGE_BACKGROUND: 404 { 405 bVal = *(sal_Bool*)rValue.getValue(); 406 mpPrtOpt->SetPrintPageBackground(bVal); 407 } 408 break; 409 case HANDLE_PRINTSET_BLACK_FONTS: 410 { 411 bVal = *(sal_Bool*)rValue.getValue(); 412 mpPrtOpt->SetPrintBlackFont(bVal); 413 } 414 break; 415 case HANDLE_PRINTSET_SINGLE_JOBS: 416 { 417 bVal = *(sal_Bool*)rValue.getValue(); 418 mpPrtOpt->SetPrintSingleJobs(bVal); 419 } 420 break; 421 case HANDLE_PRINTSET_PAPER_FROM_SETUP: 422 { 423 bVal = *(sal_Bool*)rValue.getValue(); 424 mpPrtOpt->SetPaperFromSetup(bVal); 425 } 426 break; 427 case HANDLE_PRINTSET_ANNOTATION_MODE: 428 { 429 sal_Int16 nVal = 0; 430 rValue >>= nVal; 431 if(nVal <= text::NotePrintMode_PAGE_END) 432 mpPrtOpt->SetPrintPostIts(nVal); 433 else 434 throw lang::IllegalArgumentException(); 435 } 436 break; 437 case HANDLE_PRINTSET_EMPTY_PAGES: 438 { 439 bVal = *(sal_Bool*)rValue.getValue(); 440 mpPrtOpt->SetPrintEmptyPages(bVal); 441 } 442 break; 443 case HANDLE_PRINTSET_FAX_NAME: 444 { 445 OUString sString; 446 if ( rValue >>= sString) 447 mpPrtOpt->SetFaxName(sString); 448 else 449 throw lang::IllegalArgumentException(); 450 } 451 break; 452 case HANDLE_PRINTSET_PROSPECT_RTL: 453 { 454 bVal = *(sal_Bool*)rValue.getValue(); 455 mpPrtOpt->SetPrintProspect_RTL(bVal); 456 } 457 break; 458 case HANDLE_PRINTSET_PLACEHOLDER: 459 { 460 bVal = *(sal_Bool*)rValue.getValue(); 461 mpPrtOpt->SetPrintTextPlaceholder(bVal); 462 } 463 break; 464 case HANDLE_PRINTSET_HIDDEN_TEXT: 465 { 466 bVal = *(sal_Bool*)rValue.getValue(); 467 mpPrtOpt->SetPrintHiddenText(bVal); 468 } 469 break; 470 default: 471 throw UnknownPropertyException(); 472 } 473 } 474 void SwXPrintSettings::_postSetValues () 475 throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException ) 476 { 477 mpPrtOpt = NULL; 478 } 479 480 void SwXPrintSettings::_preGetValues () 481 throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException ) 482 { 483 switch (meType) 484 { 485 case PRINT_SETTINGS_MODULE: 486 mpPrtOpt = SW_MOD()->GetPrtOptions( sal_False ); 487 break; 488 case PRINT_SETTINGS_WEB: 489 mpPrtOpt = SW_MOD()->GetPrtOptions( sal_True ); 490 break; 491 case PRINT_SETTINGS_DOCUMENT: 492 { 493 if (!mpDoc) 494 throw IllegalArgumentException (); 495 mpPrtOpt = const_cast< SwPrintData * >(&mpDoc->getPrintData()); 496 } 497 break; 498 } 499 } 500 void SwXPrintSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, uno::Any & rValue ) 501 throw(UnknownPropertyException, WrappedTargetException ) 502 { 503 switch( rInfo.mnHandle ) 504 { 505 case HANDLE_PRINTSET_LEFT_PAGES: 506 rValue <<= mpPrtOpt->IsPrintLeftPage(); 507 break; 508 case HANDLE_PRINTSET_RIGHT_PAGES: 509 rValue <<= mpPrtOpt->IsPrintRightPage(); 510 break; 511 case HANDLE_PRINTSET_REVERSED: 512 rValue <<= mpPrtOpt->IsPrintReverse(); 513 break; 514 case HANDLE_PRINTSET_PROSPECT: 515 rValue <<= mpPrtOpt->IsPrintProspect(); 516 break; 517 case HANDLE_PRINTSET_GRAPHICS: 518 rValue <<= mpPrtOpt->IsPrintGraphic(); 519 break; 520 case HANDLE_PRINTSET_TABLES: 521 rValue <<= mpPrtOpt->IsPrintTable(); 522 break; 523 case HANDLE_PRINTSET_DRAWINGS: 524 rValue <<= mpPrtOpt->IsPrintDraw(); 525 break; 526 case HANDLE_PRINTSET_CONTROLS: 527 rValue <<= mpPrtOpt->IsPrintControl(); 528 break; 529 case HANDLE_PRINTSET_PAGE_BACKGROUND: 530 rValue <<= mpPrtOpt->IsPrintPageBackground(); 531 break; 532 case HANDLE_PRINTSET_BLACK_FONTS: 533 rValue <<= mpPrtOpt->IsPrintBlackFont(); 534 break; 535 case HANDLE_PRINTSET_SINGLE_JOBS: 536 rValue <<= mpPrtOpt->IsPrintSingleJobs(); 537 break; 538 case HANDLE_PRINTSET_EMPTY_PAGES: 539 rValue <<= mpPrtOpt->IsPrintEmptyPages(); 540 break; 541 case HANDLE_PRINTSET_PAPER_FROM_SETUP: 542 rValue <<= mpPrtOpt->IsPaperFromSetup(); 543 break; 544 case HANDLE_PRINTSET_ANNOTATION_MODE: 545 { 546 rValue <<= static_cast < sal_Int16 > ( mpPrtOpt->GetPrintPostIts() ); 547 } 548 break; 549 case HANDLE_PRINTSET_FAX_NAME : 550 { 551 rValue <<= mpPrtOpt->GetFaxName(); 552 } 553 break; 554 case HANDLE_PRINTSET_PROSPECT_RTL: 555 { 556 rValue <<= mpPrtOpt->IsPrintProspectRTL(); 557 } 558 break; 559 case HANDLE_PRINTSET_PLACEHOLDER: 560 { 561 rValue <<= mpPrtOpt->IsPrintTextPlaceholder(); 562 } 563 break; 564 case HANDLE_PRINTSET_HIDDEN_TEXT: 565 { 566 rValue <<= mpPrtOpt->IsPrintHiddenText(); 567 } 568 break; 569 default: 570 throw UnknownPropertyException(); 571 } 572 } 573 void SwXPrintSettings::_postGetValues () 574 throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException ) 575 { 576 mpPrtOpt = NULL; 577 } 578 /* -----------------------------06.04.00 11:02-------------------------------- 579 580 ---------------------------------------------------------------------------*/ 581 OUString SwXPrintSettings::getImplementationName(void) throw( RuntimeException ) 582 { 583 return C2U("SwXPrintSettings"); 584 } 585 /* -----------------------------06.04.00 11:02-------------------------------- 586 587 ---------------------------------------------------------------------------*/ 588 sal_Bool SwXPrintSettings::supportsService(const OUString& rServiceName) throw( RuntimeException ) 589 { 590 return C2U("com.sun.star.text.PrintSettings") == rServiceName; 591 } 592 /* -----------------------------06.04.00 11:02-------------------------------- 593 594 ---------------------------------------------------------------------------*/ 595 Sequence< OUString > SwXPrintSettings::getSupportedServiceNames(void) throw( RuntimeException ) 596 { 597 Sequence< OUString > aRet(1); 598 OUString* pArray = aRet.getArray(); 599 pArray[0] = C2U("com.sun.star.text.PrintSettings"); 600 return aRet; 601 } 602 603 604 /****************************************************************** 605 * 606 ******************************************************************/ 607 /*-- 18.12.98 11:01:10--------------------------------------------------- 608 609 -----------------------------------------------------------------------*/ 610 SwXViewSettings::SwXViewSettings(sal_Bool bWebView, SwView* pVw) 611 : ChainableHelperNoState( lcl_createViewSettingsInfo (), &Application::GetSolarMutex() ) 612 , pView(pVw) 613 , mpViewOption ( NULL ) 614 , mpConstViewOption ( NULL ) 615 , bObjectValid(sal_True) 616 , bWeb(bWebView) 617 , eHRulerUnit( FUNIT_CM ) 618 , mbApplyHRulerMetric( sal_False ) 619 , eVRulerUnit( FUNIT_CM ) 620 , mbApplyVRulerMetric( sal_False ) 621 { 622 // This property only exists if we have a view (ie, not at the module ) 623 if ( !pView ) 624 mpInfo->remove ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "HelpURL" ) ) ); 625 626 } 627 /*-- 18.12.98 11:01:10--------------------------------------------------- 628 629 -----------------------------------------------------------------------*/ 630 SwXViewSettings::~SwXViewSettings() 631 throw() 632 { 633 634 } 635 void SwXViewSettings::_preSetValues () 636 throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException ) 637 { 638 const SwViewOption* pVOpt = 0; 639 if(pView) 640 { 641 if(!IsValid()) 642 return; 643 pVOpt = pView->GetWrtShell().GetViewOptions(); 644 } 645 else 646 pVOpt = SW_MOD()->GetViewOption(bWeb); 647 648 mpViewOption = new SwViewOption (*pVOpt); 649 mbApplyZoom = sal_False; 650 if(pView) 651 mpViewOption->SetStarOneSetting(sal_True); 652 } 653 void SwXViewSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, const uno::Any &rValue ) 654 throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException ) 655 { 656 sal_Bool bVal = HANDLE_VIEWSET_ZOOM != rInfo.mnHandle ? 657 *(sal_Bool*)rValue.getValue() : sal_False; 658 // the API flag should not be set to the application's view settings 659 switch( rInfo.mnHandle ) 660 { 661 case HANDLE_VIEWSET_SHOW_RULER : mpViewOption->SetViewAnyRuler(bVal); break; 662 case HANDLE_VIEWSET_HRULER : mpViewOption->SetViewHRuler(bVal); break; 663 case HANDLE_VIEWSET_VRULER : mpViewOption->SetViewVRuler(bVal);break; 664 case HANDLE_VIEWSET_VRULER_RIGHT : mpViewOption->SetVRulerRight(bVal);break; 665 case HANDLE_VIEWSET_HSCROLL : mpViewOption->SetViewHScrollBar(bVal);break; 666 case HANDLE_VIEWSET_VSCROLL : mpViewOption->SetViewVScrollBar(bVal);break; 667 case HANDLE_VIEWSET_GRAPHICS : mpViewOption->SetGraphic(bVal);break; 668 case HANDLE_VIEWSET_TABLES : mpViewOption->SetTable(bVal); break; 669 case HANDLE_VIEWSET_DRAWINGS : mpViewOption->SetDraw(bVal); break; 670 case HANDLE_VIEWSET_FIELD_COMMANDS : mpViewOption->SetFldName(bVal); break; 671 case HANDLE_VIEWSET_ANNOTATIONS : mpViewOption->SetPostIts(bVal); break; 672 case HANDLE_VIEWSET_INDEX_MARK_BACKGROUND : mpViewOption->SetAppearanceFlag(VIEWOPT_FIELD_SHADINGS, bVal, sal_True); break; 673 case HANDLE_VIEWSET_NONPRINTING_CHARACTERS: mpViewOption->SetViewMetaChars( bVal ); break; 674 case HANDLE_VIEWSET_FOOTNOTE_BACKGROUND : mpViewOption->SetAppearanceFlag(VIEWOPT_FIELD_SHADINGS, bVal, sal_True); break; 675 case HANDLE_VIEWSET_TEXT_FIELD_BACKGROUND : mpViewOption->SetAppearanceFlag(VIEWOPT_FIELD_SHADINGS, bVal, sal_True); break; 676 case HANDLE_VIEWSET_PARA_BREAKS : mpViewOption->SetParagraph(bVal); break; 677 case HANDLE_VIEWSET_SOFT_HYPHENS : mpViewOption->SetSoftHyph(bVal); break; 678 case HANDLE_VIEWSET_SPACES : mpViewOption->SetBlank(bVal); break; 679 case HANDLE_VIEWSET_PROTECTED_SPACES : mpViewOption->SetHardBlank(bVal); break; 680 case HANDLE_VIEWSET_TABSTOPS : mpViewOption->SetTab(bVal); break; 681 case HANDLE_VIEWSET_BREAKS : mpViewOption->SetLineBreak(bVal); break; 682 case HANDLE_VIEWSET_HIDDEN_TEXT : mpViewOption->SetShowHiddenField(bVal); break; 683 case HANDLE_VIEWSET_HIDDEN_CHARACTERS : mpViewOption->SetShowHiddenChar(bVal); break; 684 case HANDLE_VIEWSET_HIDDEN_PARAGRAPHS : mpViewOption->SetShowHiddenPara(bVal); break; 685 case HANDLE_VIEWSET_TABLE_BOUNDARIES : mpViewOption->SetAppearanceFlag(VIEWOPT_TABLE_BOUNDARIES, bVal, sal_True); break; 686 case HANDLE_VIEWSET_TEXT_BOUNDARIES : mpViewOption->SetDocBoundaries(bVal); break; 687 case HANDLE_VIEWSET_SMOOTH_SCROLLING : mpViewOption->SetSmoothScroll(bVal); break; 688 case HANDLE_VIEWSET_SOLID_MARK_HANDLES : mpViewOption->SetSolidMarkHdl(bVal); break; 689 case HANDLE_VIEWSET_PREVENT_TIPS : mpViewOption->SetPreventTips(bVal); break; 690 case HANDLE_VIEWSET_IS_RASTER_VISIBLE : mpViewOption->SetGridVisible(bVal); break; 691 case HANDLE_VIEWSET_IS_SNAP_TO_RASTER : mpViewOption->SetSnap(bVal); break; 692 case HANDLE_VIEWSET_RASTER_RESOLUTION_X : 693 { 694 sal_Int32 nTmp = 0; 695 if(!(rValue >>= nTmp) || nTmp < 10) 696 throw IllegalArgumentException(); 697 Size aSize( mpViewOption->GetSnapSize() ); 698 aSize.Width() = MM100_TO_TWIP( nTmp ); 699 mpViewOption->SetSnapSize( aSize ); 700 } 701 break; 702 case HANDLE_VIEWSET_RASTER_RESOLUTION_Y : 703 { 704 sal_Int32 nTmp = 0; 705 if(!(rValue >>= nTmp) || nTmp < 10) 706 throw IllegalArgumentException(); 707 Size aSize( mpViewOption->GetSnapSize() ); 708 aSize.Height() = MM100_TO_TWIP( nTmp ); 709 mpViewOption->SetSnapSize( aSize ); 710 } 711 break; 712 case HANDLE_VIEWSET_RASTER_SUBDIVISION_X : 713 { 714 sal_Int32 nTmp = 0; 715 if(!(rValue >>= nTmp) || !(0 <= nTmp && nTmp < 100)) 716 throw IllegalArgumentException(); 717 mpViewOption->SetDivisionX( (short) nTmp ); 718 } 719 break; 720 case HANDLE_VIEWSET_RASTER_SUBDIVISION_Y : 721 { 722 sal_Int32 nTmp = 0; 723 if(!(rValue >>= nTmp) || !(0 <= nTmp && nTmp < 100)) 724 throw IllegalArgumentException(); 725 mpViewOption->SetDivisionY( (short) nTmp ); 726 } 727 break; 728 case HANDLE_VIEWSET_ZOOM : 729 { 730 sal_Int16 nZoom = 0; 731 if(!(rValue >>= nZoom) || nZoom > 1000 || nZoom < 5) 732 throw lang::IllegalArgumentException(); 733 mpViewOption->SetZoom((sal_uInt16)nZoom); 734 mbApplyZoom = sal_True; 735 } 736 break; 737 case HANDLE_VIEWSET_ZOOM_TYPE: 738 { 739 sal_Int16 nZoom = 0; 740 if(!(rValue >>= nZoom)) 741 throw IllegalArgumentException(); 742 SvxZoomType eZoom = (SvxZoomType)USHRT_MAX; 743 switch (nZoom) 744 { 745 case view::DocumentZoomType::OPTIMAL: 746 eZoom = SVX_ZOOM_OPTIMAL; 747 break; 748 case view::DocumentZoomType::PAGE_WIDTH: 749 eZoom = SVX_ZOOM_PAGEWIDTH; 750 break; 751 case view::DocumentZoomType::ENTIRE_PAGE: 752 eZoom = SVX_ZOOM_WHOLEPAGE; 753 break; 754 case view::DocumentZoomType::BY_VALUE: 755 eZoom = SVX_ZOOM_PERCENT; 756 break; 757 case view::DocumentZoomType::PAGE_WIDTH_EXACT: 758 eZoom = SVX_ZOOM_PAGEWIDTH_NOBORDER; 759 break; 760 default: 761 throw IllegalArgumentException( 762 ::rtl::OUString::createFromAscii( 763 "SwXViewSettings: invalid zoom type"), 0, 0); 764 break; 765 } 766 if(eZoom < USHRT_MAX) 767 { 768 mpViewOption->SetZoomType( eZoom ); 769 mbApplyZoom = sal_True; 770 } 771 } 772 break; 773 case HANDLE_VIEWSET_ONLINE_LAYOUT : 774 { 775 if( pView && !bVal != !pView->GetWrtShell().GetViewOptions()->getBrowseMode() ) 776 { 777 SwViewOption aOpt( *pView->GetWrtShell().GetViewOptions() ); 778 aOpt.setBrowseMode( bVal ); 779 pView->GetWrtShell().ApplyViewOptions( aOpt ); 780 pView->RecheckBrowseMode(); 781 782 // must be set in mpViewOption as this will overwrite settings in _post! 783 mpViewOption->setBrowseMode( bVal ); 784 785 // disable multiple layout 786 pView->GetDocShell()->ToggleBrowserMode(bVal, pView ); 787 } 788 } 789 break; 790 case HANDLE_VIEWSET_HELP_URL : 791 { 792 if ( pView ) 793 { 794 OUString sHelpURL; 795 if ( ! ( rValue >>= sHelpURL ) ) 796 throw IllegalArgumentException(); 797 798 INetURLObject aHID( sHelpURL ); 799 if ( aHID.GetProtocol() == INET_PROT_HID ) 800 pView->GetEditWin().SetHelpId( rtl::OUStringToOString( aHID.GetURLPath(), RTL_TEXTENCODING_UTF8 ) ); 801 else 802 throw IllegalArgumentException (); 803 } 804 else 805 throw UnknownPropertyException(); 806 } 807 break; 808 case HANDLE_VIEWSET_HORI_RULER_METRIC: 809 case HANDLE_VIEWSET_VERT_RULER_METRIC: 810 { 811 sal_Int32 nUnit = -1; 812 if( rValue >>= nUnit ) 813 switch( nUnit ) 814 { 815 case FUNIT_MM: 816 case FUNIT_CM: 817 case FUNIT_POINT: 818 case FUNIT_PICA: 819 case FUNIT_INCH: 820 if( rInfo.mnHandle == HANDLE_VIEWSET_HORI_RULER_METRIC ) 821 { 822 eHRulerUnit = nUnit; 823 mbApplyHRulerMetric = sal_True; 824 } 825 else 826 { 827 eVRulerUnit = nUnit; 828 mbApplyVRulerMetric = sal_True; 829 } 830 break; 831 default: 832 throw IllegalArgumentException(); 833 } 834 } 835 break; 836 default: 837 throw UnknownPropertyException(); 838 } 839 } 840 841 void SwXViewSettings::_postSetValues () 842 throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException ) 843 { 844 if( pView ) 845 { 846 if(mbApplyZoom ) 847 pView->SetZoom( (SvxZoomType)mpViewOption->GetZoomType(), 848 mpViewOption->GetZoom(), sal_True ); 849 if(mbApplyHRulerMetric) 850 pView->ChangeTabMetric((FieldUnit)eHRulerUnit); 851 if(mbApplyVRulerMetric) 852 pView->ChangeVLinealMetric((FieldUnit)eVRulerUnit); 853 854 } 855 else 856 { 857 if(mbApplyHRulerMetric) 858 SW_MOD()->ApplyRulerMetric( (FieldUnit)eHRulerUnit, sal_True, bWeb ); 859 if(mbApplyVRulerMetric) 860 SW_MOD()->ApplyRulerMetric( (FieldUnit)eVRulerUnit, sal_False, bWeb ); 861 } 862 863 864 SW_MOD()->ApplyUsrPref( *mpViewOption, pView, pView ? VIEWOPT_DEST_VIEW_ONLY 865 : bWeb ? VIEWOPT_DEST_WEB 866 : VIEWOPT_DEST_TEXT ); 867 868 869 delete mpViewOption; 870 mpViewOption = NULL; 871 } 872 873 void SwXViewSettings::_preGetValues () 874 throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException ) 875 { 876 if(pView) 877 { 878 if(!IsValid()) 879 return; 880 mpConstViewOption = pView->GetWrtShell().GetViewOptions(); 881 } 882 else 883 mpConstViewOption = SW_MOD()->GetViewOption(bWeb); 884 } 885 void SwXViewSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, uno::Any & rValue ) 886 throw(UnknownPropertyException, WrappedTargetException ) 887 { 888 sal_Bool bBool = sal_True; 889 sal_Bool bBoolVal; 890 switch( rInfo.mnHandle ) 891 { 892 case HANDLE_VIEWSET_SHOW_RULER: bBoolVal = mpConstViewOption->IsViewAnyRuler(); break; 893 case HANDLE_VIEWSET_HRULER : bBoolVal = mpConstViewOption->IsViewHRuler(sal_True); break; 894 case HANDLE_VIEWSET_VRULER : bBoolVal = mpConstViewOption->IsViewVRuler(sal_True);break; 895 case HANDLE_VIEWSET_VRULER_RIGHT : bBoolVal = mpConstViewOption->IsVRulerRight();break; 896 case HANDLE_VIEWSET_HSCROLL: bBoolVal = mpConstViewOption->IsViewHScrollBar();break; 897 case HANDLE_VIEWSET_VSCROLL: bBoolVal = mpConstViewOption->IsViewVScrollBar();break; 898 case HANDLE_VIEWSET_GRAPHICS : bBoolVal = mpConstViewOption->IsGraphic();break; 899 case HANDLE_VIEWSET_TABLES : bBoolVal = mpConstViewOption->IsTable(); break; 900 case HANDLE_VIEWSET_DRAWINGS : bBoolVal = mpConstViewOption->IsDraw(); break; 901 case HANDLE_VIEWSET_FIELD_COMMANDS : bBoolVal = mpConstViewOption->IsFldName(); break; 902 case HANDLE_VIEWSET_ANNOTATIONS : bBoolVal = mpConstViewOption->IsPostIts(); break; 903 case HANDLE_VIEWSET_INDEX_MARK_BACKGROUND : bBoolVal = SwViewOption::IsFieldShadings(); break; 904 case HANDLE_VIEWSET_NONPRINTING_CHARACTERS: bBoolVal = mpConstViewOption->IsViewMetaChars(); break; 905 case HANDLE_VIEWSET_FOOTNOTE_BACKGROUND : bBoolVal = SwViewOption::IsFieldShadings(); break; 906 case HANDLE_VIEWSET_TEXT_FIELD_BACKGROUND : bBoolVal = SwViewOption::IsFieldShadings(); break; 907 case HANDLE_VIEWSET_PARA_BREAKS : bBoolVal = mpConstViewOption->IsParagraph(sal_True); break; 908 case HANDLE_VIEWSET_SOFT_HYPHENS : bBoolVal = mpConstViewOption->IsSoftHyph(); break; 909 case HANDLE_VIEWSET_SPACES : bBoolVal = mpConstViewOption->IsBlank(sal_True); break; 910 case HANDLE_VIEWSET_PROTECTED_SPACES : bBoolVal = mpConstViewOption->IsHardBlank(); break; 911 case HANDLE_VIEWSET_TABSTOPS : bBoolVal = mpConstViewOption->IsTab(sal_True); break; 912 case HANDLE_VIEWSET_BREAKS : bBoolVal = mpConstViewOption->IsLineBreak(sal_True); break; 913 case HANDLE_VIEWSET_HIDDEN_TEXT : bBoolVal = mpConstViewOption->IsShowHiddenField(); break; 914 case HANDLE_VIEWSET_HIDDEN_CHARACTERS : bBoolVal = mpConstViewOption->IsShowHiddenChar(sal_True); break; 915 case HANDLE_VIEWSET_HIDDEN_PARAGRAPHS : bBoolVal = mpConstViewOption->IsShowHiddenPara(); break; 916 case HANDLE_VIEWSET_TABLE_BOUNDARIES : bBoolVal = SwViewOption::IsTableBoundaries(); break; 917 case HANDLE_VIEWSET_TEXT_BOUNDARIES : bBoolVal = SwViewOption::IsDocBoundaries(); break; 918 case HANDLE_VIEWSET_SMOOTH_SCROLLING : bBoolVal = mpConstViewOption->IsSmoothScroll(); break; 919 case HANDLE_VIEWSET_SOLID_MARK_HANDLES : bBoolVal = mpConstViewOption->IsSolidMarkHdl(); break; 920 case HANDLE_VIEWSET_PREVENT_TIPS : bBoolVal = mpConstViewOption->IsPreventTips(); break; 921 case HANDLE_VIEWSET_IS_RASTER_VISIBLE : bBoolVal = mpConstViewOption->IsGridVisible(); break; 922 case HANDLE_VIEWSET_IS_SNAP_TO_RASTER : bBoolVal = mpConstViewOption->IsSnap(); break; 923 case HANDLE_VIEWSET_RASTER_RESOLUTION_X : 924 bBool = sal_False; 925 rValue <<= (sal_Int32) TWIP_TO_MM100(mpConstViewOption->GetSnapSize().Width()); 926 break; 927 case HANDLE_VIEWSET_RASTER_RESOLUTION_Y : 928 bBool = sal_False; 929 rValue <<= (sal_Int32) TWIP_TO_MM100(mpConstViewOption->GetSnapSize().Height()); 930 break; 931 case HANDLE_VIEWSET_RASTER_SUBDIVISION_X : 932 bBool = sal_False; 933 rValue <<= (sal_Int32) mpConstViewOption->GetDivisionX(); 934 break; 935 case HANDLE_VIEWSET_RASTER_SUBDIVISION_Y : 936 bBool = sal_False; 937 rValue <<= (sal_Int32) mpConstViewOption->GetDivisionY(); 938 break; 939 case HANDLE_VIEWSET_ZOOM : 940 bBool = sal_False; 941 rValue <<= (sal_Int16)mpConstViewOption->GetZoom(); 942 break; 943 case HANDLE_VIEWSET_ZOOM_TYPE: 944 { 945 bBool = sal_False; 946 sal_Int16 nRet(0); 947 switch (mpConstViewOption->GetZoomType()) 948 { 949 case SVX_ZOOM_OPTIMAL: 950 nRet = view::DocumentZoomType::OPTIMAL; 951 break; 952 case SVX_ZOOM_PAGEWIDTH: 953 nRet = view::DocumentZoomType::PAGE_WIDTH; 954 break; 955 case SVX_ZOOM_WHOLEPAGE: 956 nRet = view::DocumentZoomType::ENTIRE_PAGE; 957 break; 958 case SVX_ZOOM_PERCENT: 959 nRet = view::DocumentZoomType::BY_VALUE; 960 break; 961 case SVX_ZOOM_PAGEWIDTH_NOBORDER: 962 nRet = view::DocumentZoomType::PAGE_WIDTH_EXACT; 963 break; 964 default: 965 OSL_ENSURE(false, "SwXViewSettings: invalid zoom type"); 966 break; 967 } 968 rValue <<= nRet; 969 } 970 break; 971 case HANDLE_VIEWSET_ONLINE_LAYOUT: 972 if(pView) 973 bBoolVal = pView->GetWrtShell().GetViewOptions()->getBrowseMode(); 974 break; 975 case HANDLE_VIEWSET_HELP_URL : 976 { 977 if ( pView ) 978 { 979 bBool = sal_False; 980 OUStringBuffer sHelpURL; 981 sHelpURL.appendAscii ( INET_HID_SCHEME ); 982 SwEditWin &rEditWin = pView->GetEditWin(); 983 sHelpURL.append( rtl::OStringToOUString( rEditWin.GetHelpId(), RTL_TEXTENCODING_UTF8 ) ); 984 rValue <<= sHelpURL.makeStringAndClear(); 985 } 986 else 987 throw UnknownPropertyException(); 988 } 989 break; 990 case HANDLE_VIEWSET_HORI_RULER_METRIC: 991 { 992 if ( pView ) 993 { 994 FieldUnit eUnit; 995 pView->GetHLinealMetric( eUnit ); 996 rValue <<= (sal_Int32)eUnit; 997 } 998 else 999 { 1000 const SwMasterUsrPref* pUsrPref = SW_MOD()->GetUsrPref( bWeb ); 1001 rValue <<= (sal_Int32)pUsrPref->GetHScrollMetric(); 1002 } 1003 bBool = sal_False; 1004 } 1005 break; 1006 case HANDLE_VIEWSET_VERT_RULER_METRIC: 1007 { 1008 if ( pView ) 1009 { 1010 FieldUnit eUnit; 1011 pView->GetVLinealMetric( eUnit ); 1012 rValue <<= (sal_Int32)eUnit; 1013 } 1014 else 1015 { 1016 const SwMasterUsrPref* pUsrPref = SW_MOD()->GetUsrPref( bWeb ); 1017 rValue <<= (sal_Int32)pUsrPref->GetVScrollMetric(); 1018 } 1019 bBool = sal_False; 1020 } 1021 break; 1022 default: DBG_ERROR("Diese Id gibt's nicht!"); 1023 } 1024 if( bBool ) 1025 rValue.setValue(&bBoolVal, ::getBooleanCppuType()); 1026 } 1027 void SwXViewSettings::_postGetValues () 1028 throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException ) 1029 { 1030 mpConstViewOption = NULL; 1031 } 1032 1033 OUString SwXViewSettings::getImplementationName(void) throw( RuntimeException ) 1034 { 1035 return C2U("SwXViewSettings"); 1036 } 1037 1038 sal_Bool SwXViewSettings::supportsService(const OUString& rServiceName) throw( RuntimeException ) 1039 { 1040 return C2U("com.sun.star.text.ViewSettings") == rServiceName; 1041 } 1042 1043 Sequence< OUString > SwXViewSettings::getSupportedServiceNames(void) throw( RuntimeException ) 1044 { 1045 Sequence< OUString > aRet(1); 1046 OUString* pArray = aRet.getArray(); 1047 pArray[0] = C2U("com.sun.star.text.ViewSettings"); 1048 return aRet; 1049 } 1050 1051