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

Generated by: LCOV version 1.10