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