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

Generated by: LCOV version 1.10