LCOV - code coverage report
Current view: top level - libreoffice/sc/source/ui/unoobj - confuno.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 216 267 80.9 %
Date: 2012-12-17 Functions: 9 17 52.9 %
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 "confuno.hxx"
      21             : #include "unonames.hxx"
      22             : #include "scdll.hxx"
      23             : #include "docsh.hxx"
      24             : #include "miscuno.hxx"
      25             : #include "forbiuno.hxx"
      26             : #include "viewopti.hxx"
      27             : #include "docpool.hxx"
      28             : #include "sc.hrc"
      29             : 
      30             : #include <com/sun/star/beans/PropertyAttribute.hpp>
      31             : #include <sfx2/printer.hxx>
      32             : #include <xmloff/xmluconv.hxx>
      33             : #include <rtl/ustrbuf.hxx>
      34             : #include <vcl/svapp.hxx>
      35             : 
      36             : using namespace com::sun::star;
      37             : 
      38             : #define SCCOMPSCPREADSHEETSETTINGS_SERVICE      "com.sun.star.comp.SpreadsheetSettings"
      39             : #define SCDOCUMENTSETTINGS_SERVICE              "com.sun.star.document.Settings"
      40             : #define SCSAVEVERSION                           "SaveVersionOnClose"
      41             : 
      42             : 
      43          72 : static const SfxItemPropertyMapEntry* lcl_GetConfigPropertyMap()
      44             : {
      45             :     static SfxItemPropertyMapEntry aConfigPropertyMap_Impl[] =
      46             :     {
      47          26 :         {MAP_CHAR_LEN(SC_UNO_SHOWZERO),     0,  &getBooleanCppuType(),              0, 0},
      48          26 :         {MAP_CHAR_LEN(SC_UNO_SHOWNOTES),    0,  &getBooleanCppuType(),              0, 0},
      49          26 :         {MAP_CHAR_LEN(SC_UNO_SHOWGRID),     0,  &getBooleanCppuType(),              0, 0},
      50          26 :         {MAP_CHAR_LEN(SC_UNO_GRIDCOLOR),    0,  &getCppuType((sal_Int32*)0),        0, 0},
      51          26 :         {MAP_CHAR_LEN(SC_UNO_SHOWPAGEBR),   0,  &getBooleanCppuType(),              0, 0},
      52          26 :         {MAP_CHAR_LEN(SC_UNONAME_LINKUPD),  0,  &getCppuType((sal_Int16*)0),        0, 0},
      53          26 :         {MAP_CHAR_LEN(SC_UNO_COLROWHDR),    0,  &getBooleanCppuType(),              0, 0},
      54          26 :         {MAP_CHAR_LEN(SC_UNO_SHEETTABS),    0,  &getBooleanCppuType(),              0, 0},
      55          26 :         {MAP_CHAR_LEN(SC_UNO_OUTLSYMB),     0,  &getBooleanCppuType(),              0, 0},
      56          26 :         {MAP_CHAR_LEN(SC_UNO_SNAPTORASTER), 0,  &getBooleanCppuType(),              0, 0},
      57          26 :         {MAP_CHAR_LEN(SC_UNO_RASTERVIS),    0,  &getBooleanCppuType(),              0, 0},
      58          26 :         {MAP_CHAR_LEN(SC_UNO_RASTERRESX),   0,  &getCppuType((sal_Int32*)0),        0, 0},
      59          26 :         {MAP_CHAR_LEN(SC_UNO_RASTERRESY),   0,  &getCppuType((sal_Int32*)0),        0, 0},
      60          26 :         {MAP_CHAR_LEN(SC_UNO_RASTERSUBX),   0,  &getCppuType((sal_Int32*)0),        0, 0},
      61          26 :         {MAP_CHAR_LEN(SC_UNO_RASTERSUBY),   0,  &getCppuType((sal_Int32*)0),        0, 0},
      62          26 :         {MAP_CHAR_LEN(SC_UNO_RASTERSYNC),   0,  &getBooleanCppuType(),              0, 0},
      63          26 :         {MAP_CHAR_LEN(SC_UNO_AUTOCALC),     0,  &getBooleanCppuType(),              0, 0},
      64          26 :         {MAP_CHAR_LEN(SC_UNO_PRINTERNAME),  0,  &getCppuType((rtl::OUString*)0),    0, 0},
      65          26 :         {MAP_CHAR_LEN(SC_UNO_PRINTERSETUP), 0,  &getCppuType((uno::Sequence<sal_Int8>*)0), 0, 0},
      66          26 :         {MAP_CHAR_LEN(SC_UNO_APPLYDOCINF),  0,  &getBooleanCppuType(),              0, 0},
      67          26 :         {MAP_CHAR_LEN(SC_UNO_FORBIDDEN),    0,  &getCppuType((uno::Reference<i18n::XForbiddenCharacters>*)0), beans::PropertyAttribute::READONLY, 0},
      68          26 :         {MAP_CHAR_LEN(SC_UNO_CHARCOMP),     0,  &getCppuType((sal_Int16*)0),        0, 0},
      69          26 :         {MAP_CHAR_LEN(SC_UNO_ASIANKERN),    0,  &getBooleanCppuType(),              0, 0},
      70          26 :         {MAP_CHAR_LEN(SCSAVEVERSION),       0,  &getBooleanCppuType(),              0, 0},
      71          26 :         {MAP_CHAR_LEN(SC_UNO_UPDTEMPL),     0,  &getBooleanCppuType(),              0, 0},
      72             :         /*Stampit enable/disable print cancel */
      73          26 :         {MAP_CHAR_LEN(SC_UNO_ALLOWPRINTJOBCANCEL), 0, &getBooleanCppuType(),        0, 0},
      74          26 :         {MAP_CHAR_LEN(SC_UNO_LOADREADONLY), 0,  &getBooleanCppuType(),              0, 0},
      75          26 :         {MAP_CHAR_LEN(SC_UNO_SHAREDOC),     0,  &getBooleanCppuType(),              0, 0},
      76          26 :         {MAP_CHAR_LEN(SC_UNO_MODIFYPASSWORDINFO), 0,  &getCppuType((uno::Sequence< beans::PropertyValue >*)0),              0, 0},
      77             :         {0,0,0,0,0,0}
      78         826 :     };
      79          72 :     return aConfigPropertyMap_Impl;
      80             : }
      81             : 
      82             : //------------------------------------------------------------------------
      83             : 
      84          72 : ScDocumentConfiguration::ScDocumentConfiguration(ScDocShell* pDocSh)
      85             :     : pDocShell(pDocSh) ,
      86          72 :     aPropSet ( lcl_GetConfigPropertyMap() )
      87             : {
      88          72 :     pDocShell->GetDocument()->AddUnoObject(*this);
      89          72 : }
      90             : 
      91         216 : ScDocumentConfiguration::~ScDocumentConfiguration()
      92             : {
      93          72 :     if (pDocShell)
      94          72 :         pDocShell->GetDocument()->RemoveUnoObject(*this);
      95         144 : }
      96             : 
      97           0 : void ScDocumentConfiguration::Notify( SfxBroadcaster&, const SfxHint& rHint )
      98             : {
      99             :     //  Referenz-Update interessiert hier nicht
     100             : 
     101           0 :     if ( rHint.ISA( SfxSimpleHint ) &&
     102           0 :             ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING )
     103             :     {
     104           0 :         pDocShell = NULL;       // ungueltig geworden
     105             :     }
     106           0 : }
     107             : 
     108             : // XPropertySet
     109             : 
     110          72 : uno::Reference<beans::XPropertySetInfo> SAL_CALL ScDocumentConfiguration::getPropertySetInfo()
     111             :                                                         throw(uno::RuntimeException)
     112             : {
     113          72 :     SolarMutexGuard aGuard;
     114             :     static uno::Reference<beans::XPropertySetInfo> aRef(
     115          72 :         new SfxItemPropertySetInfo( aPropSet.getPropertyMap() ));
     116          72 :     return aRef;
     117             : }
     118             : 
     119        1784 : void SAL_CALL ScDocumentConfiguration::setPropertyValue(
     120             :                         const rtl::OUString& aPropertyName, const uno::Any& aValue )
     121             :                 throw(beans::UnknownPropertyException, beans::PropertyVetoException,
     122             :                         lang::IllegalArgumentException, lang::WrappedTargetException,
     123             :                         uno::RuntimeException)
     124             : {
     125        1784 :     SolarMutexGuard aGuard;
     126             : 
     127        1784 :     if(pDocShell)
     128             :     {
     129        1784 :         ScDocument* pDoc = pDocShell->GetDocument();
     130        1784 :         if (pDoc)
     131             :         {
     132        1784 :             sal_Bool bUpdateHeights = false;
     133             : 
     134        1784 :             ScViewOptions aViewOpt(pDoc->GetViewOptions());
     135             : 
     136             :             /*Stampit enable/disable print cancel */
     137        1784 :             if ( aPropertyName.compareToAscii( SC_UNO_ALLOWPRINTJOBCANCEL ) == 0 )
     138          66 :                 pDocShell->Stamp_SetPrintCancelState( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
     139             :             /*Stampit enable/disable print cancel */
     140             : 
     141        1718 :             else if ( aPropertyName.compareToAscii( SC_UNO_SHOWZERO ) == 0 )
     142          66 :                 aViewOpt.SetOption(VOPT_NULLVALS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
     143        1652 :             else if ( aPropertyName.compareToAscii( SC_UNO_SHOWNOTES ) == 0 )
     144          66 :                 aViewOpt.SetOption(VOPT_NOTES, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
     145        1586 :             else if ( aPropertyName.compareToAscii( SC_UNO_SHOWGRID ) == 0 )
     146          66 :                 aViewOpt.SetOption(VOPT_GRID, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
     147        1520 :             else if ( aPropertyName.compareToAscii( SC_UNO_GRIDCOLOR ) == 0 )
     148             :             {
     149          66 :                 sal_Int64 nColor = 0;
     150          66 :                 if (aValue >>= nColor)
     151             :                 {
     152          66 :                     String aColorName;
     153          66 :                     Color aColor(static_cast<sal_uInt32>(nColor));
     154          66 :                     aViewOpt.SetGridColor(aColor, aColorName);
     155             :                 }
     156             :             }
     157        1454 :             else if ( aPropertyName.compareToAscii( SC_UNO_SHOWPAGEBR ) == 0 )
     158          66 :                 aViewOpt.SetOption(VOPT_PAGEBREAKS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
     159        1388 :             else if ( aPropertyName.compareToAscii( SC_UNONAME_LINKUPD ) == 0 )
     160          66 :                 pDoc->SetLinkMode( static_cast<ScLkUpdMode> ( ScUnoHelpFunctions::GetInt16FromAny( aValue ) ) );
     161        1322 :             else if ( aPropertyName.compareToAscii( SC_UNO_COLROWHDR ) == 0 )
     162          66 :                 aViewOpt.SetOption(VOPT_HEADER, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
     163        1256 :             else if ( aPropertyName.compareToAscii( SC_UNO_SHEETTABS ) == 0 )
     164          66 :                 aViewOpt.SetOption(VOPT_TABCONTROLS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
     165        1190 :             else if ( aPropertyName.compareToAscii( SC_UNO_OUTLSYMB ) == 0 )
     166          66 :                 aViewOpt.SetOption(VOPT_OUTLINER, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
     167        1124 :             else if ( aPropertyName.compareToAscii( SC_UNO_AUTOCALC ) == 0 )
     168          66 :                 pDoc->SetAutoCalc( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
     169        1058 :             else if ( aPropertyName.compareToAscii( SC_UNO_PRINTERNAME ) == 0 )
     170             :             {
     171          66 :                 rtl::OUString sPrinterName;
     172          66 :                 if ( aValue >>= sPrinterName )
     173             :                 {
     174             :                     // #i75610# if the name is empty, do nothing (don't create any printer)
     175          66 :                     if ( !sPrinterName.isEmpty() && pDocShell->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED )
     176             :                     {
     177           0 :                         SfxPrinter* pPrinter = pDocShell->GetPrinter();
     178           0 :                         if (pPrinter)
     179             :                         {
     180           0 :                             if (pPrinter->GetName() != sPrinterName)
     181             :                             {
     182           0 :                                 SfxPrinter* pNewPrinter = new SfxPrinter( pPrinter->GetOptions().Clone(), sPrinterName );
     183           0 :                                 if (pNewPrinter->IsKnown())
     184           0 :                                     pDocShell->SetPrinter( pNewPrinter, SFX_PRINTER_PRINTER );
     185             :                                 else
     186           0 :                                     delete pNewPrinter;
     187             :                             }
     188             :                         }
     189             :                         else
     190           0 :                             throw uno::RuntimeException();
     191             :                     }
     192             :                 }
     193             :                 else
     194           0 :                     throw lang::IllegalArgumentException();
     195             :             }
     196         992 :             else if ( aPropertyName.compareToAscii( SC_UNO_PRINTERSETUP ) == 0 )
     197             :             {
     198          66 :                 uno::Sequence<sal_Int8> aSequence;
     199          66 :                 if ( aValue >>= aSequence )
     200             :                 {
     201          66 :                     sal_uInt32 nSize = aSequence.getLength();
     202             :                     // #i75610# if the sequence is empty, do nothing (don't create any printer)
     203          66 :                     if ( nSize != 0 )
     204             :                     {
     205           2 :                         SvMemoryStream aStream (aSequence.getArray(), nSize, STREAM_READ );
     206           2 :                         aStream.Seek ( STREAM_SEEK_TO_BEGIN );
     207           2 :                         SfxItemSet* pSet = new SfxItemSet( *pDoc->GetPool(),
     208             :                                 SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
     209             :                                 SID_PRINTER_CHANGESTODOC,  SID_PRINTER_CHANGESTODOC,
     210             :                                 SID_PRINT_SELECTEDSHEET,   SID_PRINT_SELECTEDSHEET,
     211             :                                 SID_SCPRINTOPTIONS,        SID_SCPRINTOPTIONS,
     212           2 :                                 NULL );
     213           2 :                         pDocShell->SetPrinter( SfxPrinter::Create( aStream, pSet ) );
     214             :                     }
     215          66 :                 }
     216             :             }
     217         926 :             else if ( aPropertyName.compareToAscii( SC_UNO_APPLYDOCINF ) == 0 )
     218             :             {
     219          66 :                 sal_Bool bTmp=sal_True;
     220          66 :                 if ( aValue >>= bTmp )
     221          66 :                     pDocShell->SetUseUserData( bTmp );
     222             :             }
     223         860 :             else if ( aPropertyName.compareToAscii( SC_UNO_FORBIDDEN ) == 0 )
     224             :             {
     225             :                 //  read-only - should not be set
     226             :             }
     227         858 :             else if ( aPropertyName.compareToAscii( SC_UNO_CHARCOMP ) == 0 )
     228             :             {
     229             :                 // Int16 contains CharacterCompressionType values
     230          66 :                 sal_Int16 nUno = ScUnoHelpFunctions::GetInt16FromAny( aValue );
     231          66 :                 pDoc->SetAsianCompression( (sal_uInt8) nUno );
     232          66 :                 bUpdateHeights = sal_True;
     233             :             }
     234         792 :             else if ( aPropertyName.compareToAscii( SC_UNO_ASIANKERN ) == 0 )
     235             :             {
     236          66 :                 pDoc->SetAsianKerning( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
     237          66 :                 bUpdateHeights = sal_True;
     238             :             }
     239         726 :             else if ( aPropertyName.compareToAscii( SCSAVEVERSION ) == 0)
     240             :             {
     241          66 :                 sal_Bool bTmp=false;
     242          66 :                 if ( aValue >>= bTmp )
     243          66 :                     pDocShell->SetSaveVersionOnClose( bTmp );
     244             :             }
     245         660 :             else if ( aPropertyName.compareToAscii( SC_UNO_UPDTEMPL ) == 0 )
     246             :             {
     247          66 :                 sal_Bool bTmp=sal_True;
     248          66 :                 if ( aValue >>= bTmp )
     249          66 :                     pDocShell->SetQueryLoadTemplate( bTmp );
     250             :             }
     251         594 :             else if ( aPropertyName.compareToAscii( SC_UNO_LOADREADONLY ) == 0 )
     252             :             {
     253          66 :                 sal_Bool bTmp=false;
     254          66 :                 if ( aValue >>= bTmp )
     255          66 :                     pDocShell->SetLoadReadonly( bTmp );
     256             :             }
     257         528 :             else if ( aPropertyName.compareToAscii( SC_UNO_SHAREDOC ) == 0 )
     258             :             {
     259          66 :                 sal_Bool bDocShared = false;
     260          66 :                 if ( aValue >>= bDocShared )
     261             :                 {
     262          66 :                     pDocShell->SetSharedXMLFlag( bDocShared );
     263             :                 }
     264             :             }
     265         462 :             else if ( aPropertyName.compareToAscii( SC_UNO_MODIFYPASSWORDINFO ) == 0 )
     266             :             {
     267           0 :                 uno::Sequence< beans::PropertyValue > aInfo;
     268           0 :                 if ( !( aValue >>= aInfo ) )
     269             :                     throw lang::IllegalArgumentException(
     270             :                         ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Value of type Sequence<PropertyValue> expected!" ) ),
     271             :                         uno::Reference< uno::XInterface >(),
     272           0 :                         2 );
     273             : 
     274           0 :                 if ( !pDocShell->SetModifyPasswordInfo( aInfo ) )
     275             :                     throw beans::PropertyVetoException(
     276             :                         ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "The hash is not allowed to be changed now!" ) ),
     277           0 :                         uno::Reference< uno::XInterface >() );
     278             :             }
     279             :             else
     280             :             {
     281         462 :                 ScGridOptions aGridOpt(aViewOpt.GetGridOptions());
     282         462 :                 if ( aPropertyName.compareToAscii( SC_UNO_SNAPTORASTER ) == 0 )
     283          66 :                     aGridOpt.SetUseGridSnap( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
     284         396 :                 else if ( aPropertyName.compareToAscii( SC_UNO_RASTERVIS ) == 0 )
     285          66 :                     aGridOpt.SetGridVisible( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
     286         330 :                 else if ( aPropertyName.compareToAscii( SC_UNO_RASTERRESX ) == 0 )
     287          66 :                     aGridOpt.SetFldDrawX( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) );
     288         264 :                 else if ( aPropertyName.compareToAscii( SC_UNO_RASTERRESY ) == 0 )
     289          66 :                     aGridOpt.SetFldDrawY( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) );
     290         198 :                 else if ( aPropertyName.compareToAscii( SC_UNO_RASTERSUBX ) == 0 )
     291          66 :                     aGridOpt.SetFldDivisionX( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) );
     292         132 :                 else if ( aPropertyName.compareToAscii( SC_UNO_RASTERSUBY ) == 0 )
     293          66 :                     aGridOpt.SetFldDivisionY( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) );
     294          66 :                 else if ( aPropertyName.compareToAscii( SC_UNO_RASTERSYNC ) == 0 )
     295          66 :                     aGridOpt.SetSynchronize( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
     296             :                 else
     297           0 :                     throw beans::UnknownPropertyException();
     298         462 :                 aViewOpt.SetGridOptions(aGridOpt);
     299             :             }
     300        1784 :             pDoc->SetViewOptions(aViewOpt);
     301             : 
     302        1784 :             if ( bUpdateHeights && !pDoc->IsImportingXML() )
     303             :             {
     304             :                 //  update automatic row heights and repaint
     305           0 :                 SCTAB nTabCount = pDoc->GetTableCount();
     306           0 :                 for (SCTAB nTab=0; nTab<nTabCount; nTab++)
     307           0 :                     if ( !pDocShell->AdjustRowHeight( 0, MAXROW, nTab ) )
     308           0 :                         pDocShell->PostPaint(ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab), PAINT_GRID);
     309           0 :                 pDocShell->SetDocumentModified();
     310        1784 :             }
     311             :         }
     312             :         else
     313           0 :             throw uno::RuntimeException();
     314             :     }
     315             :     else
     316        1784 :         throw uno::RuntimeException();
     317        1784 : }
     318             : 
     319         118 : uno::Any SAL_CALL ScDocumentConfiguration::getPropertyValue( const rtl::OUString& aPropertyName )
     320             :                 throw(beans::UnknownPropertyException, lang::WrappedTargetException,
     321             :                         uno::RuntimeException)
     322             : {
     323         118 :     SolarMutexGuard aGuard;
     324         118 :     uno::Any aRet;
     325             : 
     326         118 :     if(pDocShell)
     327             :     {
     328         118 :         ScDocument* pDoc = pDocShell->GetDocument();
     329         118 :         if (pDoc)
     330             :         {
     331         118 :             const ScViewOptions& aViewOpt = pDoc->GetViewOptions();
     332             : 
     333             :             /*Stampit enable/disable print cancel */
     334         118 :             if ( aPropertyName.compareToAscii( SC_UNO_ALLOWPRINTJOBCANCEL ) == 0 )
     335           4 :                 ScUnoHelpFunctions::SetBoolInAny( aRet, pDocShell->Stamp_GetPrintCancelState() );
     336             :             /*Stampit enable/disable print cancel */
     337             : 
     338         114 :             else if ( aPropertyName.compareToAscii( SC_UNO_SHOWZERO ) == 0 )
     339           4 :                 ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_NULLVALS ) );
     340         110 :             else if ( aPropertyName.compareToAscii( SC_UNO_SHOWNOTES ) == 0 )
     341           4 :                 ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_NOTES ) );
     342         106 :             else if ( aPropertyName.compareToAscii( SC_UNO_SHOWGRID ) == 0 )
     343           4 :                 ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_GRID ) );
     344         102 :             else if ( aPropertyName.compareToAscii( SC_UNO_GRIDCOLOR ) == 0 )
     345             :             {
     346           4 :                 String aColorName;
     347           4 :                 Color aColor = aViewOpt.GetGridColor(&aColorName);
     348           4 :                 aRet <<= static_cast<sal_Int64>(aColor.GetColor());
     349             :             }
     350          98 :             else if ( aPropertyName.compareToAscii( SC_UNO_SHOWPAGEBR ) == 0 )
     351           4 :                 ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_PAGEBREAKS ) );
     352          94 :             else if ( aPropertyName.compareToAscii( SC_UNONAME_LINKUPD ) == 0 )
     353           4 :                 aRet <<= static_cast<sal_Int16> ( pDoc->GetLinkMode() );
     354          90 :             else if ( aPropertyName.compareToAscii( SC_UNO_COLROWHDR ) == 0 )
     355           4 :                 ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_HEADER ) );
     356          86 :             else if ( aPropertyName.compareToAscii( SC_UNO_SHEETTABS ) == 0 )
     357           4 :                 ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_TABCONTROLS ) );
     358          82 :             else if ( aPropertyName.compareToAscii( SC_UNO_OUTLSYMB ) == 0 )
     359           4 :                 ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_OUTLINER ) );
     360          78 :             else if ( aPropertyName.compareToAscii( SC_UNO_AUTOCALC ) == 0 )
     361           4 :                 ScUnoHelpFunctions::SetBoolInAny( aRet, pDoc->GetAutoCalc() );
     362          74 :             else if ( aPropertyName.compareToAscii( SC_UNO_PRINTERNAME ) == 0 )
     363             :             {
     364             :                 // #i75610# don't create the printer, return empty string if no printer created yet
     365             :                 // (as in SwXDocumentSettings)
     366           4 :                 SfxPrinter* pPrinter = pDoc->GetPrinter( false );
     367           4 :                 if (pPrinter)
     368           0 :                     aRet <<= rtl::OUString ( pPrinter->GetName());
     369             :                 else
     370           4 :                     aRet <<= rtl::OUString();
     371             :             }
     372          70 :             else if ( aPropertyName.compareToAscii( SC_UNO_PRINTERSETUP ) == 0 )
     373             :             {
     374             :                 // #i75610# don't create the printer, return empty sequence if no printer created yet
     375             :                 // (as in SwXDocumentSettings)
     376           4 :                 SfxPrinter* pPrinter = pDoc->GetPrinter( false );
     377           4 :                 if (pPrinter)
     378             :                 {
     379           0 :                     SvMemoryStream aStream;
     380           0 :                     pPrinter->Store( aStream );
     381           0 :                     aStream.Seek ( STREAM_SEEK_TO_END );
     382           0 :                     sal_uInt32 nSize = aStream.Tell();
     383           0 :                     aStream.Seek ( STREAM_SEEK_TO_BEGIN );
     384           0 :                     uno::Sequence < sal_Int8 > aSequence( nSize );
     385           0 :                     aStream.Read ( aSequence.getArray(), nSize );
     386           0 :                     aRet <<= aSequence;
     387             :                 }
     388             :                 else
     389           4 :                     aRet <<= uno::Sequence<sal_Int8>();
     390             :             }
     391          66 :             else if ( aPropertyName.compareToAscii( SC_UNO_APPLYDOCINF ) == 0 )
     392           4 :                 aRet <<= pDocShell->IsUseUserData();
     393          62 :             else if ( aPropertyName.compareToAscii( SC_UNO_FORBIDDEN ) == 0 )
     394             :             {
     395           6 :                 aRet <<= uno::Reference<i18n::XForbiddenCharacters>(new ScForbiddenCharsObj( pDocShell ));
     396             :             }
     397          56 :             else if ( aPropertyName.compareToAscii( SC_UNO_CHARCOMP ) == 0 )
     398           4 :                 aRet <<= static_cast<sal_Int16> ( pDoc->GetAsianCompression() );
     399          52 :             else if ( aPropertyName.compareToAscii( SC_UNO_ASIANKERN ) == 0 )
     400           4 :                 ScUnoHelpFunctions::SetBoolInAny( aRet, pDoc->GetAsianKerning() );
     401          48 :             else if ( aPropertyName.compareToAscii( SCSAVEVERSION ) == 0)
     402           4 :                 aRet <<= pDocShell->IsSaveVersionOnClose();
     403          44 :             else if ( aPropertyName.compareToAscii( SC_UNO_UPDTEMPL ) == 0 )
     404           4 :                 aRet <<= pDocShell->IsQueryLoadTemplate();
     405          40 :             else if ( aPropertyName.compareToAscii( SC_UNO_LOADREADONLY ) == 0 )
     406           4 :                 aRet <<= pDocShell->IsLoadReadonly();
     407          36 :             else if ( aPropertyName.compareToAscii( SC_UNO_SHAREDOC ) == 0 )
     408             :             {
     409           4 :                 ScUnoHelpFunctions::SetBoolInAny( aRet, pDocShell->HasSharedXMLFlagSet() );
     410             :             }
     411          32 :             else if ( aPropertyName.compareToAscii( SC_UNO_MODIFYPASSWORDINFO ) == 0 )
     412           4 :                 aRet <<= pDocShell->GetModifyPasswordInfo();
     413             :             else
     414             :             {
     415          28 :                 const ScGridOptions& aGridOpt = aViewOpt.GetGridOptions();
     416          28 :                 if ( aPropertyName.compareToAscii( SC_UNO_SNAPTORASTER ) == 0 )
     417           4 :                     ScUnoHelpFunctions::SetBoolInAny( aRet, aGridOpt.GetUseGridSnap() );
     418          24 :                 else if ( aPropertyName.compareToAscii( SC_UNO_RASTERVIS ) == 0 )
     419           4 :                     ScUnoHelpFunctions::SetBoolInAny( aRet, aGridOpt.GetGridVisible() );
     420          20 :                 else if ( aPropertyName.compareToAscii( SC_UNO_RASTERRESX ) == 0 )
     421           4 :                     aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFldDrawX() );
     422          16 :                 else if ( aPropertyName.compareToAscii( SC_UNO_RASTERRESY ) == 0 )
     423           4 :                     aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFldDrawY() );
     424          12 :                 else if ( aPropertyName.compareToAscii( SC_UNO_RASTERSUBX ) == 0 )
     425           4 :                     aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFldDivisionX() );
     426           8 :                 else if ( aPropertyName.compareToAscii( SC_UNO_RASTERSUBY ) == 0 )
     427           4 :                     aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFldDivisionY() );
     428           4 :                 else if ( aPropertyName.compareToAscii( SC_UNO_RASTERSYNC ) == 0 )
     429           4 :                     ScUnoHelpFunctions::SetBoolInAny( aRet, aGridOpt.GetSynchronize() );
     430             :                 else
     431           0 :                     throw beans::UnknownPropertyException();
     432             :             }
     433             :         }
     434             :         else
     435           0 :             throw uno::RuntimeException();
     436             :     }
     437             :     else
     438           0 :         throw uno::RuntimeException();
     439             : 
     440         118 :     return aRet;
     441             : }
     442             : 
     443           0 : SC_IMPL_DUMMY_PROPERTY_LISTENER( ScDocumentConfiguration )
     444             : 
     445             : // XServiceInfo
     446             : 
     447           0 : rtl::OUString SAL_CALL ScDocumentConfiguration::getImplementationName() throw(uno::RuntimeException)
     448             : {
     449           0 :     return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ScDocumentConfiguration" ));
     450             : }
     451             : 
     452           0 : sal_Bool SAL_CALL ScDocumentConfiguration::supportsService( const rtl::OUString& rServiceName )
     453             :                                                     throw(uno::RuntimeException)
     454             : {
     455           0 :     String aServiceStr( rServiceName );
     456           0 :     return aServiceStr.EqualsAscii( SCCOMPSCPREADSHEETSETTINGS_SERVICE ) ||
     457           0 :            aServiceStr.EqualsAscii( SCDOCUMENTSETTINGS_SERVICE );
     458             : }
     459             : 
     460           0 : uno::Sequence<rtl::OUString> SAL_CALL ScDocumentConfiguration::getSupportedServiceNames()
     461             :                                                     throw(uno::RuntimeException)
     462             : {
     463           0 :     uno::Sequence<rtl::OUString> aRet(2);
     464           0 :     rtl::OUString* pArray = aRet.getArray();
     465           0 :     pArray[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SCCOMPSCPREADSHEETSETTINGS_SERVICE ));
     466           0 :     pArray[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SCDOCUMENTSETTINGS_SERVICE ));
     467           0 :     return aRet;
     468         102 : }
     469             : 
     470             : //-------------------------------------------------------------------------
     471             : 
     472             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10