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

Generated by: LCOV version 1.10