LCOV - code coverage report
Current view: top level - sw/source/uibase/uno - unomod.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 433 508 85.2 %
Date: 2015-06-13 12:38:46 Functions: 36 39 92.3 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.11