LCOV - code coverage report
Current view: top level - sc/source/ui/docshell - docsh2.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 56 69 81.2 %
Date: 2014-11-03 Functions: 7 9 77.8 %
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             : #include <svx/drawitem.hxx>
      22             : #include <svl/asiancfg.hxx>
      23             : #include <editeng/forbiddencharacterstable.hxx>
      24             : #include <editeng/unolingu.hxx>
      25             : 
      26             : #include "drwlayer.hxx"
      27             : #include "stlpool.hxx"
      28             : #include "docsh.hxx"
      29             : #include "docshimp.hxx"
      30             : #include "docfunc.hxx"
      31             : #include "sc.hrc"
      32             : 
      33             : using namespace com::sun::star;
      34             : 
      35         686 : bool ScDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor )
      36             : {
      37         686 :     bool bRet = SfxObjectShell::InitNew( xStor );
      38             : 
      39         686 :     aDocument.MakeTable(0);
      40             : 
      41             :     //  Additional tables are created by the first View, if bIsEmpty is still sal_True
      42         686 :     if( bRet )
      43             :     {
      44             :         Size aSize( (long) ( STD_COL_WIDTH           * HMM_PER_TWIPS * OLE_STD_CELLS_X ),
      45         686 :                     (long) ( ScGlobal::nStdRowHeight * HMM_PER_TWIPS * OLE_STD_CELLS_Y ) );
      46             :         // Also adjust start here
      47         686 :         SetVisAreaOrSize( Rectangle( Point(), aSize ), true );
      48             :     }
      49             : 
      50             :     // InitOptions sets the document languages, must be called before CreateStandardStyles
      51         686 :     InitOptions(false);
      52             : 
      53         686 :     aDocument.GetStyleSheetPool()->CreateStandardStyles();
      54         686 :     aDocument.UpdStlShtPtrsFrmNms();
      55             : 
      56             :     //  SetDocumentModified is not allowed anymoe in Load/InitNew!
      57         686 :     InitItems();
      58         686 :     CalcOutputFactor();
      59             : 
      60         686 :     return bRet;
      61             : }
      62             : 
      63         500 : void ScDocShell::SetEmpty(bool bSet)
      64             : {
      65         500 :     bIsEmpty = bSet;
      66         500 : }
      67             : 
      68        1940 : void ScDocShell::InitItems()
      69             : {
      70             :     // Fill AllItemSet for Controller with needed Items:
      71             :     // Printer Options are set in GetPrinter when printing
      72        1940 :     UpdateFontList();
      73             : 
      74        1940 :     ScDrawLayer* pDrawLayer = aDocument.GetDrawLayer();
      75        1940 :     if (pDrawLayer)
      76             :     {
      77        1066 :         PutItem( SvxColorListItem  ( pDrawLayer->GetColorList(), SID_COLOR_TABLE ) );
      78        1066 :         PutItem( SvxGradientListItem( pDrawLayer->GetGradientList(), SID_GRADIENT_LIST ) );
      79        1066 :         PutItem( SvxHatchListItem   ( pDrawLayer->GetHatchList(), SID_HATCH_LIST ) );
      80        1066 :         PutItem( SvxBitmapListItem  ( pDrawLayer->GetBitmapList(), SID_BITMAP_LIST ) );
      81        1066 :         PutItem( SvxDashListItem    ( pDrawLayer->GetDashList(), SID_DASH_LIST ) );
      82        1066 :         PutItem( SvxLineEndListItem ( pDrawLayer->GetLineEndList(), SID_LINEEND_LIST ) );
      83             : 
      84             :         // Other modifications after creation of the DrawLayer
      85        1066 :         pDrawLayer->SetNotifyUndoActionHdl( LINK( pDocFunc, ScDocFunc, NotifyDrawUndo ) );
      86             :     }
      87             :     else
      88             :     {
      89             :         //  always use global color table instead of local copy
      90         874 :         PutItem( SvxColorListItem( XColorList::GetStdColorList(), SID_COLOR_TABLE ) );
      91             :     }
      92             : 
      93        5846 :     if ( !aDocument.GetForbiddenCharacters().is() ||
      94        5846 :             !aDocument.IsValidAsianCompression() || !aDocument.IsValidAsianKerning() )
      95             :     {
      96             :         //  get settings from SvxAsianConfig
      97        1914 :         SvxAsianConfig aAsian;
      98             : 
      99        1914 :         if ( !aDocument.GetForbiddenCharacters().is() )
     100             :         {
     101             :             // set forbidden characters if necessary
     102        1914 :             uno::Sequence<lang::Locale> aLocales = aAsian.GetStartEndCharLocales();
     103        1914 :             if (aLocales.getLength())
     104             :             {
     105             :                 rtl::Reference<SvxForbiddenCharactersTable> xForbiddenTable =
     106           0 :                         new SvxForbiddenCharactersTable( comphelper::getProcessComponentContext() );
     107             : 
     108           0 :                 const lang::Locale* pLocales = aLocales.getConstArray();
     109           0 :                 for (sal_Int32 i = 0; i < aLocales.getLength(); i++)
     110             :                 {
     111           0 :                     i18n::ForbiddenCharacters aForbidden;
     112           0 :                     aAsian.GetStartEndChars( pLocales[i], aForbidden.beginLine, aForbidden.endLine );
     113           0 :                     LanguageType eLang = LanguageTag::convertToLanguageType(pLocales[i]);
     114             : 
     115           0 :                     xForbiddenTable->SetForbiddenCharacters( eLang, aForbidden );
     116           0 :                 }
     117             : 
     118           0 :                 aDocument.SetForbiddenCharacters( xForbiddenTable );
     119        1914 :             }
     120             :         }
     121             : 
     122        1914 :         if ( !aDocument.IsValidAsianCompression() )
     123             :         {
     124             :             // set compression mode from configuration if not already set (e.g. XML import)
     125         688 :             aDocument.SetAsianCompression( sal::static_int_cast<sal_uInt8>( aAsian.GetCharDistanceCompression() ) );
     126             :         }
     127             : 
     128        1914 :         if ( !aDocument.IsValidAsianKerning() )
     129             :         {
     130             :             // set asian punctuation kerning from configuration if not already set (e.g. XML import)
     131         688 :             aDocument.SetAsianKerning( !aAsian.IsKerningWesternTextOnly() );    // reversed
     132        1914 :         }
     133             :     }
     134        1940 : }
     135             : 
     136        2202 : void ScDocShell::ResetDrawObjectShell()
     137             : {
     138        2202 :     ScDrawLayer* pDrawLayer = aDocument.GetDrawLayer();
     139        2202 :     if (pDrawLayer)
     140         824 :         pDrawLayer->SetObjectShell( NULL );
     141        2202 : }
     142             : 
     143           0 : void ScDocShell::Activate()
     144             : {
     145           0 : }
     146             : 
     147           0 : void ScDocShell::Deactivate()
     148             : {
     149           0 : }
     150             : 
     151        2300 : ScDrawLayer* ScDocShell::MakeDrawLayer()
     152             : {
     153        2300 :     ScDrawLayer* pDrawLayer = aDocument.GetDrawLayer();
     154        2300 :     if (!pDrawLayer)
     155             :     {
     156         810 :         aDocument.InitDrawLayer(this);
     157         810 :         pDrawLayer = aDocument.GetDrawLayer();
     158         810 :         InitItems(); // including Undo and Basic
     159         810 :         Broadcast( SfxSimpleHint( SC_HINT_DRWLAYER_NEW ) );
     160         810 :         if (nDocumentLock)
     161         112 :             pDrawLayer->setLock(true);
     162             :     }
     163        2300 :     return pDrawLayer;
     164         228 : }
     165             : 
     166             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10