LCOV - code coverage report
Current view: top level - sc/source/ui/docshell - docsh6.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 135 227 59.5 %
Date: 2015-06-13 12:38:46 Functions: 14 17 82.4 %
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 "scitems.hxx"
      21             : 
      22             : #include <svx/pageitem.hxx>
      23             : #include <sfx2/linkmgr.hxx>
      24             : 
      25             : #include "docsh.hxx"
      26             : 
      27             : #include "stlsheet.hxx"
      28             : #include "stlpool.hxx"
      29             : #include "global.hxx"
      30             : #include "viewdata.hxx"
      31             : #include "tabvwsh.hxx"
      32             : #include "tablink.hxx"
      33             : #include "globstr.hrc"
      34             : #include "scmod.hxx"
      35             : #include "compiler.hxx"
      36             : #include "interpre.hxx"
      37             : #include "calcconfig.hxx"
      38             : 
      39             : #include <vcl/msgbox.hxx>
      40             : 
      41             : #include <com/sun/star/beans/XPropertySet.hpp>
      42             : #include <com/sun/star/container/XNameAccess.hpp>
      43             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      44             : #include <com/sun/star/util/XChangesBatch.hpp>
      45             : #include <boost/scoped_array.hpp>
      46             : 
      47             : using ::com::sun::star::beans::XPropertySet;
      48             : using ::com::sun::star::lang::XMultiServiceFactory;
      49             : using ::com::sun::star::container::XNameAccess;
      50             : using ::com::sun::star::util::XChangesBatch;
      51             : using ::com::sun::star::uno::Any;
      52             : using ::com::sun::star::uno::Exception;
      53             : using ::com::sun::star::uno::Reference;
      54             : using ::com::sun::star::uno::Sequence;
      55             : using ::com::sun::star::uno::UNO_QUERY_THROW;
      56             : 
      57             : namespace {
      58             : 
      59             : struct ScStylePair
      60             : {
      61             :     SfxStyleSheetBase *pSource;
      62             :     SfxStyleSheetBase *pDest;
      63             : };
      64             : 
      65             : }
      66             : 
      67             : // STATIC DATA -----------------------------------------------------------
      68             : 
      69             : //  Ole
      70             : 
      71         258 : void ScDocShell::SetVisArea( const Rectangle & rVisArea )
      72             : {
      73             :     //  with the SnapVisArea call in SetVisAreaOrSize, it's safe to always
      74             :     //  use both the size and position of the VisArea
      75         258 :     SetVisAreaOrSize( rVisArea, true );
      76         258 : }
      77             : 
      78           0 : static void lcl_SetTopRight( Rectangle& rRect, const Point& rPos )
      79             : {
      80           0 :     Size aSize = rRect.GetSize();
      81           0 :     rRect.Right() = rPos.X();
      82           0 :     rRect.Left() = rPos.X() - aSize.Width() + 1;
      83           0 :     rRect.Top() = rPos.Y();
      84           0 :     rRect.Bottom() = rPos.Y() + aSize.Height() - 1;
      85           0 : }
      86             : 
      87         699 : void ScDocShell::SetVisAreaOrSize( const Rectangle& rVisArea, bool bModifyStart )
      88             : {
      89         699 :     bool bNegativePage = aDocument.IsNegativePage( aDocument.GetVisibleTab() );
      90             : 
      91         699 :     Rectangle aArea = rVisArea;
      92         699 :     if (bModifyStart)
      93             :     {
      94             :         // when loading, don't check for negative values, because the sheet orientation
      95             :         // might be set later
      96         699 :         if ( !aDocument.IsImportingXML() )
      97             :         {
      98         530 :             if ( ( bNegativePage ? (aArea.Right() > 0) : (aArea.Left() < 0) ) || aArea.Top() < 0 )
      99             :             {
     100             :                 //  VisArea start position can't be negative.
     101             :                 //  Move the VisArea, otherwise only the upper left position would
     102             :                 //  be changed in SnapVisArea, and the size would be wrong.
     103             : 
     104           0 :                 Point aNewPos( 0, std::max( aArea.Top(), (long) 0 ) );
     105           0 :                 if ( bNegativePage )
     106             :                 {
     107           0 :                     aNewPos.X() = std::min( aArea.Right(), (long) 0 );
     108           0 :                     lcl_SetTopRight( aArea, aNewPos );
     109             :                 }
     110             :                 else
     111             :                 {
     112           0 :                     aNewPos.X() = std::max( aArea.Left(), (long) 0 );
     113           0 :                     aArea.SetPos( aNewPos );
     114             :                 }
     115             :             }
     116             :         }
     117             :     }
     118             :     else
     119             :     {
     120           0 :         Rectangle aOldVisArea = SfxObjectShell::GetVisArea();
     121           0 :         if ( bNegativePage )
     122           0 :             lcl_SetTopRight( aArea, aOldVisArea.TopRight() );
     123             :         else
     124           0 :             aArea.SetPos( aOldVisArea.TopLeft() );
     125             :     }
     126             : 
     127             :     //      hier Position anpassen!
     128             : 
     129             :     //  when loading an ole object, the VisArea is set from the document's
     130             :     //  view settings and must be used as-is (document content may not be complete yet).
     131         699 :     if ( !aDocument.IsImportingXML() )
     132         530 :         SnapVisArea( aArea );
     133             : 
     134             :     //TODO/LATER: it's unclear which IPEnv is used here
     135             :     /*
     136             :     SvInPlaceEnvironment* pEnv = GetIPEnv();
     137             :     if (pEnv)
     138             :     {
     139             :         vcl::Window* pWin = pEnv->GetEditWin();
     140             :         pEnv->MakeScale( aArea.GetSize(), MAP_100TH_MM,
     141             :                             pWin->LogicToPixel( aArea.GetSize() ) );
     142             :     } */
     143             : 
     144             :     //TODO/LATER: formerly in SvInplaceObject
     145         699 :     SfxObjectShell::SetVisArea( aArea );
     146             : 
     147         699 :     if (bIsInplace)                     // Zoom in der InPlace View einstellen
     148             :     {
     149         315 :         ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell();
     150         315 :         if (pViewSh)
     151             :         {
     152           6 :             if (pViewSh->GetViewData().GetDocShell() == this)
     153           0 :                 pViewSh->UpdateOleZoom();
     154             :         }
     155             :     }
     156             : 
     157         699 :     if (aDocument.IsEmbedded())
     158             :     {
     159           0 :         ScRange aOld;
     160           0 :         aDocument.GetEmbedded( aOld);
     161           0 :         aDocument.SetEmbedded( aDocument.GetVisibleTab(), aArea );
     162           0 :         ScRange aNew;
     163           0 :         aDocument.GetEmbedded( aNew);
     164           0 :         if (aOld != aNew)
     165           0 :             PostPaint(0,0,0,MAXCOL,MAXROW,MAXTAB,PAINT_GRID);
     166             : 
     167             :         //TODO/LATER: currently not implemented
     168             :         //ViewChanged( ASPECT_CONTENT );          // auch im Container anzeigen
     169             :     }
     170         699 : }
     171             : 
     172         230 : bool ScDocShell::IsOle()
     173             : {
     174         230 :     return (GetCreateMode() == SfxObjectCreateMode::EMBEDDED);
     175             : }
     176             : 
     177          18 : void ScDocShell::UpdateOle( const ScViewData* pViewData, bool bSnapSize )
     178             : {
     179             :     //  wenn's gar nicht Ole ist, kann man sich die Berechnungen sparen
     180             :     //  (VisArea wird dann beim Save wieder zurueckgesetzt)
     181             : 
     182          18 :     if (GetCreateMode() == SfxObjectCreateMode::STANDARD)
     183          36 :         return;
     184             : 
     185             :     OSL_ENSURE(pViewData,"pViewData==0 bei ScDocShell::UpdateOle");
     186             : 
     187           0 :     Rectangle aOldArea = SfxObjectShell::GetVisArea();
     188           0 :     Rectangle aNewArea = aOldArea;
     189             : 
     190           0 :     bool bEmbedded = aDocument.IsEmbedded();
     191           0 :     if (bEmbedded)
     192           0 :         aNewArea = aDocument.GetEmbeddedRect();
     193             :     else
     194             :     {
     195           0 :         SCTAB nTab = pViewData->GetTabNo();
     196           0 :         if ( nTab != aDocument.GetVisibleTab() )
     197           0 :             aDocument.SetVisibleTab( nTab );
     198             : 
     199           0 :         bool bNegativePage = aDocument.IsNegativePage( nTab );
     200           0 :         SCCOL nX = pViewData->GetPosX(SC_SPLIT_LEFT);
     201           0 :         SCROW nY = pViewData->GetPosY(SC_SPLIT_BOTTOM);
     202           0 :         Rectangle aMMRect = aDocument.GetMMRect( nX,nY, nX,nY, nTab );
     203           0 :         if (bNegativePage)
     204           0 :             lcl_SetTopRight( aNewArea, aMMRect.TopRight() );
     205             :         else
     206           0 :             aNewArea.SetPos( aMMRect.TopLeft() );
     207           0 :         if (bSnapSize)
     208           0 :             SnapVisArea(aNewArea);            // uses the new VisibleTab
     209             :     }
     210             : 
     211           0 :     if (aNewArea != aOldArea)
     212           0 :         SetVisAreaOrSize( aNewArea, true ); // hier muss auch der Start angepasst werden
     213             : }
     214             : 
     215             : //  Style-Krempel fuer Organizer etc.
     216             : 
     217           2 : SfxStyleSheetBasePool* ScDocShell::GetStyleSheetPool()
     218             : {
     219           2 :     return static_cast<SfxStyleSheetBasePool*>(aDocument.GetStyleSheetPool());
     220             : }
     221             : 
     222             : //  nach dem Laden von Vorlagen aus einem anderen Dokment (LoadStyles, Insert)
     223             : //  muessen die SetItems (ATTR_PAGE_HEADERSET, ATTR_PAGE_FOOTERSET) auf den richtigen
     224             : //  Pool umgesetzt werden, bevor der Quell-Pool geloescht wird.
     225             : 
     226           2 : static void lcl_AdjustPool( SfxStyleSheetBasePool* pStylePool )
     227             : {
     228           2 :     pStylePool->SetSearchMask(SFX_STYLE_FAMILY_PAGE, SFXSTYLEBIT_ALL);
     229           2 :     SfxStyleSheetBase *pStyle = pStylePool->First();
     230           8 :     while ( pStyle )
     231             :     {
     232           4 :         SfxItemSet& rStyleSet = pStyle->GetItemSet();
     233             : 
     234             :         const SfxPoolItem* pItem;
     235           4 :         if (rStyleSet.GetItemState(ATTR_PAGE_HEADERSET,false,&pItem) == SfxItemState::SET)
     236             :         {
     237           4 :             const SfxItemSet& rSrcSet = static_cast<const SvxSetItem*>(pItem)->GetItemSet();
     238           4 :             SfxItemSet* pDestSet = new SfxItemSet(*rStyleSet.GetPool(),rSrcSet.GetRanges());
     239           4 :             pDestSet->Put(rSrcSet);
     240           4 :             rStyleSet.Put(SvxSetItem(ATTR_PAGE_HEADERSET,pDestSet));
     241             :         }
     242           4 :         if (rStyleSet.GetItemState(ATTR_PAGE_FOOTERSET,false,&pItem) == SfxItemState::SET)
     243             :         {
     244           4 :             const SfxItemSet& rSrcSet = static_cast<const SvxSetItem*>(pItem)->GetItemSet();
     245           4 :             SfxItemSet* pDestSet = new SfxItemSet(*rStyleSet.GetPool(),rSrcSet.GetRanges());
     246           4 :             pDestSet->Put(rSrcSet);
     247           4 :             rStyleSet.Put(SvxSetItem(ATTR_PAGE_FOOTERSET,pDestSet));
     248             :         }
     249             : 
     250           4 :         pStyle = pStylePool->Next();
     251             :     }
     252           2 : }
     253             : 
     254           0 : void ScDocShell::LoadStyles( SfxObjectShell &rSource )
     255             : {
     256           0 :     aDocument.StylesToNames();
     257             : 
     258           0 :     SfxObjectShell::LoadStyles(rSource);
     259           0 :     lcl_AdjustPool( GetStyleSheetPool() );      // SetItems anpassen
     260             : 
     261           0 :     aDocument.UpdStlShtPtrsFrmNms();
     262             : 
     263           0 :     UpdateAllRowHeights();
     264             : 
     265             :         //  Paint
     266             : 
     267           0 :     PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID | PAINT_LEFT );
     268           0 : }
     269             : 
     270           2 : void ScDocShell::LoadStylesArgs( ScDocShell& rSource, bool bReplace, bool bCellStyles, bool bPageStyles )
     271             : {
     272             :     //  similar to LoadStyles, but with selectable behavior for XStyleLoader::loadStylesFromURL call
     273             : 
     274           2 :     if ( !bCellStyles && !bPageStyles )     // nothing to do
     275           0 :         return;
     276             : 
     277           2 :     ScStyleSheetPool* pSourcePool = rSource.GetDocument().GetStyleSheetPool();
     278           2 :     ScStyleSheetPool* pDestPool = aDocument.GetStyleSheetPool();
     279             : 
     280             :     SfxStyleFamily eFamily = bCellStyles ?
     281             :             ( bPageStyles ? SFX_STYLE_FAMILY_ALL : SFX_STYLE_FAMILY_PARA ) :
     282           2 :             SFX_STYLE_FAMILY_PAGE;
     283           2 :     SfxStyleSheetIterator aIter( pSourcePool, eFamily );
     284           2 :     sal_uInt16 nSourceCount = aIter.Count();
     285           2 :     if ( nSourceCount == 0 )
     286           0 :         return;                             // no source styles
     287             : 
     288           4 :     boost::scoped_array<ScStylePair> pStyles(new ScStylePair[ nSourceCount ]);
     289           2 :     sal_uInt16 nFound = 0;
     290             : 
     291             :     //  first create all new styles
     292             : 
     293           2 :     SfxStyleSheetBase* pSourceStyle = aIter.First();
     294          20 :     while (pSourceStyle)
     295             :     {
     296          16 :         OUString aName = pSourceStyle->GetName();
     297          16 :         SfxStyleSheetBase* pDestStyle = pDestPool->Find( pSourceStyle->GetName(), pSourceStyle->GetFamily() );
     298          16 :         if ( pDestStyle )
     299             :         {
     300             :             // touch existing styles only if replace flag is set
     301          14 :             if ( bReplace )
     302             :             {
     303          14 :                 pStyles[nFound].pSource = pSourceStyle;
     304          14 :                 pStyles[nFound].pDest = pDestStyle;
     305          14 :                 ++nFound;
     306             :             }
     307             :         }
     308             :         else
     309             :         {
     310           2 :             pStyles[nFound].pSource = pSourceStyle;
     311           2 :             pStyles[nFound].pDest = &pDestPool->Make( aName, pSourceStyle->GetFamily(), pSourceStyle->GetMask() );
     312           2 :             ++nFound;
     313             :         }
     314             : 
     315          16 :         pSourceStyle = aIter.Next();
     316          16 :     }
     317             : 
     318             :     //  then copy contents (after inserting all styles, for parent etc.)
     319             : 
     320          18 :     for ( sal_uInt16 i = 0; i < nFound; ++i )
     321             :     {
     322          32 :         pStyles[i].pDest->GetItemSet().PutExtended(
     323          48 :             pStyles[i].pSource->GetItemSet(), SfxItemState::DONTCARE, SfxItemState::DEFAULT);
     324          16 :         if(pStyles[i].pSource->HasParentSupport())
     325          12 :             pStyles[i].pDest->SetParent(pStyles[i].pSource->GetParent());
     326             :         // follow is never used
     327             :     }
     328             : 
     329           2 :     lcl_AdjustPool( GetStyleSheetPool() );      // adjust SetItems
     330           2 :     UpdateAllRowHeights();
     331           4 :     PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID | PAINT_LEFT );      // Paint
     332             : }
     333             : 
     334         503 : void ScDocShell::ReconnectDdeLink(SfxObjectShell& rServer)
     335             : {
     336         503 :     ::sfx2::LinkManager* pLinkManager = aDocument.GetLinkManager();
     337         503 :     if (!pLinkManager)
     338         503 :         return;
     339             : 
     340         503 :     pLinkManager->ReconnectDdeLink(rServer);
     341             : }
     342             : 
     343         347 : void ScDocShell::UpdateLinks()
     344             : {
     345             :     typedef std::unordered_set<OUString, OUStringHash> StrSetType;
     346             : 
     347         347 :     sfx2::LinkManager* pLinkManager = aDocument.GetLinkManager();
     348         347 :     StrSetType aNames;
     349             : 
     350             :     // nicht mehr benutzte Links raus
     351             : 
     352         347 :     size_t nCount = pLinkManager->GetLinks().size();
     353         706 :     for (size_t k=nCount; k>0; )
     354             :     {
     355          12 :         --k;
     356          12 :         ::sfx2::SvBaseLink* pBase = *pLinkManager->GetLinks()[k];
     357          12 :         if (pBase->ISA(ScTableLink))
     358             :         {
     359           0 :             ScTableLink* pTabLink = static_cast<ScTableLink*>(pBase);
     360           0 :             if (pTabLink->IsUsed())
     361           0 :                 aNames.insert(pTabLink->GetFileName());
     362             :             else        // nicht mehr benutzt -> loeschen
     363             :             {
     364           0 :                 pTabLink->SetAddUndo(true);
     365           0 :                 pLinkManager->Remove(k);
     366             :             }
     367             :         }
     368             :     }
     369             : 
     370             :     // neue Links eintragen
     371             : 
     372         347 :     SCTAB nTabCount = aDocument.GetTableCount();
     373         953 :     for (SCTAB i = 0; i < nTabCount; ++i)
     374             :     {
     375         606 :         if (!aDocument.IsLinked(i))
     376         604 :             continue;
     377             : 
     378           2 :         OUString aDocName = aDocument.GetLinkDoc(i);
     379           4 :         OUString aFltName = aDocument.GetLinkFlt(i);
     380           4 :         OUString aOptions = aDocument.GetLinkOpt(i);
     381           2 :         sal_uLong nRefresh  = aDocument.GetLinkRefreshDelay(i);
     382           2 :         bool bThere = false;
     383           2 :         for (SCTAB j = 0; j < i && !bThere; ++j)                // im Dokument mehrfach?
     384             :         {
     385           0 :             if (aDocument.IsLinked(j)
     386           0 :                     && aDocument.GetLinkDoc(j) == aDocName
     387           0 :                     && aDocument.GetLinkFlt(j) == aFltName
     388           0 :                     && aDocument.GetLinkOpt(j) == aOptions)
     389             :                     // Ignore refresh delay in compare, it should be the
     390             :                     // same for identical links and we don't want dupes
     391             :                     // if it ain't.
     392           0 :                 bThere = true;
     393             :         }
     394             : 
     395           2 :         if (!bThere)                                        // schon als Filter eingetragen?
     396             :         {
     397           2 :             if (!aNames.insert(aDocName).second)
     398           0 :                 bThere = true;
     399             :         }
     400             : 
     401           2 :         if (!bThere)
     402             :         {
     403           2 :             ScTableLink* pLink = new ScTableLink( this, aDocName, aFltName, aOptions, nRefresh );
     404           2 :             pLink->SetInCreate(true);
     405           2 :             pLinkManager->InsertFileLink(*pLink, OBJECT_CLIENT_FILE, aDocName, &aFltName);
     406           2 :             pLink->Update();
     407           2 :             pLink->SetInCreate(false);
     408             :         }
     409         349 :     }
     410         347 : }
     411             : 
     412           0 : bool ScDocShell::ReloadTabLinks()
     413             : {
     414           0 :     sfx2::LinkManager* pLinkManager = aDocument.GetLinkManager();
     415             : 
     416           0 :     bool bAny = false;
     417           0 :     size_t nCount = pLinkManager->GetLinks().size();
     418           0 :     for (size_t i=0; i<nCount; i++ )
     419             :     {
     420           0 :         ::sfx2::SvBaseLink* pBase = *pLinkManager->GetLinks()[i];
     421           0 :         if (pBase->ISA(ScTableLink))
     422             :         {
     423           0 :             ScTableLink* pTabLink = static_cast<ScTableLink*>(pBase);
     424             : //                      pTabLink->SetAddUndo(sal_False);             //! Undo's zusammenfassen
     425             : 
     426             :                         // Painting only after Update() makes no sense:
     427             :                         // ScTableLink::Refresh() will post a Paint only is bDoPaint is true
     428             :             // pTabLink->SetPaint(false);          //  Paint nur einmal am Ende
     429           0 :             pTabLink->Update();
     430             :             //pTabLink->SetPaint(true);
     431             : //                      pTabLink->SetAddUndo(sal_True);
     432           0 :             bAny = true;
     433             :         }
     434             :     }
     435             : 
     436           0 :     if ( bAny )
     437             :     {
     438             :         //  Paint nur einmal
     439             :         PostPaint( ScRange(0,0,0,MAXCOL,MAXROW,MAXTAB),
     440           0 :                                     PAINT_GRID | PAINT_TOP | PAINT_LEFT );
     441             : 
     442           0 :         SetDocumentModified();
     443             :     }
     444             : 
     445           0 :     return true;        //! Fehler erkennen
     446             : }
     447             : 
     448         614 : void ScDocShell::SetFormulaOptions( const ScFormulaOptions& rOpt, bool bForLoading )
     449             : {
     450         614 :     aDocument.SetGrammar( rOpt.GetFormulaSyntax() );
     451             : 
     452             :     // This is nasty because it resets module globals from within a docshell!
     453             :     // For actual damage caused see fdo#82183 where an unconditional
     454             :     // ScGlobal::ResetFunctionList() (without checking GetUseEnglishFuncName())
     455             :     // lead to a crash becasuse the function list was still used by the Formula
     456             :     // Wizard when loading the second document.
     457             :     // Do the stupid stuff only when we're not called while loading a document.
     458             : 
     459             :     /* TODO: bForLoading is a workaround, rather get rid of setting any
     460             :      * globals from per document instances like ScDocShell. */
     461             : 
     462             :     /* XXX  this is utter crap, we rely on the options being set here at least
     463             :      * once, for the very first document, empty or loaded. */
     464             :     static bool bInitOnce = true;
     465             : 
     466         614 :     if (!bForLoading || bInitOnce)
     467             :     {
     468         467 :         bool bForceInit = bInitOnce;
     469         467 :         bInitOnce = false;
     470         467 :         if (bForceInit || rOpt.GetUseEnglishFuncName() != SC_MOD()->GetFormulaOptions().GetUseEnglishFuncName())
     471             :         {
     472             :             // This needs to be called first since it may re-initialize the entire
     473             :             // opcode map.
     474          49 :             if (rOpt.GetUseEnglishFuncName())
     475             :             {
     476             :                 // switch native symbols to English.
     477           0 :                 ScCompiler aComp(NULL, ScAddress());
     478           0 :                 ScCompiler::OpCodeMapPtr xMap = aComp.GetOpCodeMap(::com::sun::star::sheet::FormulaLanguage::ENGLISH);
     479           0 :                 ScCompiler::SetNativeSymbols(xMap);
     480             :             }
     481             :             else
     482             :                 // re-initialize native symbols with localized function names.
     483          49 :                 ScCompiler::ResetNativeSymbols();
     484             : 
     485             :             // Force re-population of function names for the function wizard, function tip etc.
     486          49 :             ScGlobal::ResetFunctionList();
     487             :         }
     488             : 
     489             :         // Update the separators.
     490             :         ScCompiler::UpdateSeparatorsNative(
     491         467 :                 rOpt.GetFormulaSepArg(), rOpt.GetFormulaSepArrayCol(), rOpt.GetFormulaSepArrayRow());
     492             : 
     493             :         // Global interpreter settings.
     494         467 :         ScInterpreter::SetGlobalConfig(rOpt.GetCalcConfig());
     495             :     }
     496             : 
     497             :     // Per document interpreter settings.
     498         614 :     SetCalcConfig( rOpt.GetCalcConfig());
     499         614 : }
     500             : 
     501         614 : void ScDocShell::SetCalcConfig( const ScCalcConfig& rConfig )
     502             : {
     503         614 :     aDocument.SetCalcConfig( rConfig);
     504         614 : }
     505             : 
     506         502 : void ScDocShell::CheckConfigOptions()
     507             : {
     508         502 :     if (IsConfigOptionsChecked())
     509             :         // no need to check repeatedly.
     510         708 :         return;
     511             : 
     512         296 :     OUString aDecSep = ScGlobal::GetpLocaleData()->getNumDecimalSep();
     513             : 
     514         296 :     ScModule* pScMod = SC_MOD();
     515         296 :     const ScFormulaOptions& rOpt=pScMod->GetFormulaOptions();
     516         592 :     OUString aSepArg = rOpt.GetFormulaSepArg();
     517         592 :     OUString aSepArrRow = rOpt.GetFormulaSepArrayRow();
     518         592 :     OUString aSepArrCol = rOpt.GetFormulaSepArrayCol();
     519             : 
     520         296 :     if (aDecSep == aSepArg || aDecSep == aSepArrRow || aDecSep == aSepArrCol)
     521             :     {
     522             :         // One of arg separators conflicts with the current decimal
     523             :         // separator.  Reset them to default.
     524           0 :         ScFormulaOptions aNew = rOpt;
     525           0 :         aNew.ResetFormulaSeparators();
     526           0 :         SetFormulaOptions(aNew);
     527           0 :         pScMod->SetFormulaOptions(aNew);
     528             : 
     529             :         // Launch a nice warning dialog to let the users know of this change.
     530           0 :         ScTabViewShell* pViewShell = GetBestViewShell();
     531           0 :         if (pViewShell)
     532             :         {
     533           0 :             vcl::Window* pParent = pViewShell->GetFrameWin();
     534           0 :             ScopedVclPtrInstance< InfoBox > aBox(pParent, ScGlobal::GetRscString(STR_OPTIONS_WARN_SEPARATORS));
     535           0 :             aBox->Execute();
     536           0 :         }
     537             : 
     538             :         // For now, this is the only option setting that could launch info
     539             :         // dialog.  But in the future we may want to implement a nicer
     540             :         // dialog to display a list of warnings in case we have several
     541             :         // pieces of information to display.
     542             :     }
     543             : 
     544         592 :     SetConfigOptionsChecked(true);
     545         156 : }
     546             : 
     547             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11