2010-10-12 15:59:00 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2000-09-18 16:07:07 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 21:11:39 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 21:11:39 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 21:11:39 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 21:11:39 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 21:11:39 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 21:11:39 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-07-21 12:37:44 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_sc.hxx"
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
#include <svx/svdpage.hxx>
|
|
|
|
|
|
|
|
|
2004-02-03 19:29:55 +00:00
|
|
|
#include <svx/xtable.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
#include "scitems.hxx"
|
|
|
|
#include <tools/gen.hxx>
|
|
|
|
#include <svtools/ctrltool.hxx>
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/flstitem.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <svx/drawitem.hxx>
|
|
|
|
#include <sfx2/printer.hxx>
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/smplhint.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <svx/svditer.hxx>
|
|
|
|
#include <svx/svdobj.hxx>
|
|
|
|
#include <svx/svdoole2.hxx>
|
|
|
|
#include <vcl/svapp.hxx>
|
2010-01-13 22:25:07 +01:00
|
|
|
#include <svl/asiancfg.hxx>
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/forbiddencharacterstable.hxx>
|
|
|
|
#include <editeng/unolingu.hxx>
|
2001-07-27 18:19:54 +00:00
|
|
|
#include <rtl/logfile.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2009-09-29 14:47:18 +00:00
|
|
|
#include <comphelper/processfactory.hxx>
|
|
|
|
#include <basic/sbstar.hxx>
|
|
|
|
#include <basic/basmgr.hxx>
|
|
|
|
#include <sfx2/app.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// INCLUDE ---------------------------------------------------------------
|
|
|
|
#include "drwlayer.hxx"
|
|
|
|
#include "stlpool.hxx"
|
|
|
|
#include "docsh.hxx"
|
2006-11-22 09:45:32 +00:00
|
|
|
#include "docshimp.hxx"
|
2000-09-18 16:07:07 +00:00
|
|
|
#include "docfunc.hxx"
|
|
|
|
#include "sc.hrc"
|
|
|
|
|
2001-04-06 13:37:54 +00:00
|
|
|
using namespace com::sun::star;
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
|
2011-03-10 16:55:21 -05:00
|
|
|
sal_Bool ScDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-08-01 06:32:37 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDocShell::InitNew" );
|
2001-07-27 18:19:54 +00:00
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bRet = SfxObjectShell::InitNew( xStor );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
aDocument.MakeTable(0);
|
|
|
|
// zusaetzliche Tabellen werden von der ersten View angelegt,
|
2011-01-17 13:20:22 +01:00
|
|
|
// wenn bIsEmpty dann noch sal_True ist
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if( bRet )
|
|
|
|
{
|
|
|
|
Size aSize( (long) ( STD_COL_WIDTH * HMM_PER_TWIPS * OLE_STD_CELLS_X ),
|
|
|
|
(long) ( ScGlobal::nStdRowHeight * HMM_PER_TWIPS * OLE_STD_CELLS_Y ) );
|
|
|
|
// hier muss auch der Start angepasst werden
|
2011-01-17 13:20:22 +01:00
|
|
|
SetVisAreaOrSize( Rectangle( Point(), aSize ), sal_True );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2006-12-19 11:59:52 +00:00
|
|
|
aDocument.SetDrawDefaults(); // drawing layer defaults that are set only in InitNew
|
|
|
|
|
2001-08-20 07:11:38 +00:00
|
|
|
// InitOptions sets the document languages, must be called before CreateStandardStyles
|
2010-06-04 18:59:28 +02:00
|
|
|
InitOptions(false);
|
2001-08-20 07:11:38 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
aDocument.GetStyleSheetPool()->CreateStandardStyles();
|
|
|
|
aDocument.UpdStlShtPtrsFrmNms();
|
|
|
|
|
|
|
|
// SetDocumentModified ist in Load/InitNew nicht mehr erlaubt!
|
|
|
|
|
|
|
|
InitItems();
|
|
|
|
CalcOutputFactor();
|
|
|
|
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool ScDocShell::IsEmpty() const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
return bIsEmpty;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
void ScDocShell::SetEmpty(sal_Bool bSet)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2008-01-10 12:15:51 +00:00
|
|
|
bIsEmpty = bSet;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
|
|
|
|
void ScDocShell::InitItems()
|
|
|
|
{
|
|
|
|
// AllItemSet fuer Controller mit benoetigten Items fuellen:
|
|
|
|
|
|
|
|
// Druck-Optionen werden beim Drucken und evtl. in GetPrinter gesetzt
|
|
|
|
|
2006-05-04 14:03:15 +00:00
|
|
|
UpdateFontList();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
ScDrawLayer* pDrawLayer = aDocument.GetDrawLayer();
|
|
|
|
if (pDrawLayer)
|
|
|
|
{
|
2007-05-10 15:55:49 +00:00
|
|
|
PutItem( SvxColorTableItem ( pDrawLayer->GetColorTable(), SID_COLOR_TABLE ) );
|
|
|
|
PutItem( SvxGradientListItem( pDrawLayer->GetGradientList(), SID_GRADIENT_LIST ) );
|
|
|
|
PutItem( SvxHatchListItem ( pDrawLayer->GetHatchList(), SID_HATCH_LIST ) );
|
|
|
|
PutItem( SvxBitmapListItem ( pDrawLayer->GetBitmapList(), SID_BITMAP_LIST ) );
|
|
|
|
PutItem( SvxDashListItem ( pDrawLayer->GetDashList(), SID_DASH_LIST ) );
|
|
|
|
PutItem( SvxLineEndListItem ( pDrawLayer->GetLineEndList(), SID_LINEEND_LIST ) );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// andere Anpassungen nach dem Anlegen des DrawLayers
|
|
|
|
|
|
|
|
pDrawLayer->SetNotifyUndoActionHdl( LINK( pDocFunc, ScDocFunc, NotifyDrawUndo ) );
|
|
|
|
|
|
|
|
pDrawLayer->UpdateBasic(); // DocShell-Basic in DrawPages setzen
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-02-08 14:02:10 +00:00
|
|
|
// always use global color table instead of local copy
|
2011-05-17 10:00:34 +01:00
|
|
|
PutItem( SvxColorTableItem( &XColorTable::GetStdColorTable(), SID_COLOR_TABLE ) );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2001-04-06 13:37:54 +00:00
|
|
|
|
2010-10-15 12:20:01 -05:00
|
|
|
if ( !aDocument.GetForbiddenCharacters().is() ||
|
2001-10-19 15:01:00 +00:00
|
|
|
!aDocument.IsValidAsianCompression() || !aDocument.IsValidAsianKerning() )
|
2001-04-06 13:37:54 +00:00
|
|
|
{
|
2001-10-19 15:01:00 +00:00
|
|
|
// get settings from SvxAsianConfig
|
2011-03-10 16:55:21 -05:00
|
|
|
SvxAsianConfig aAsian( false );
|
2001-04-06 13:37:54 +00:00
|
|
|
|
2010-10-15 12:20:01 -05:00
|
|
|
if ( !aDocument.GetForbiddenCharacters().is() )
|
2001-10-19 15:01:00 +00:00
|
|
|
{
|
|
|
|
// set forbidden characters if necessary
|
|
|
|
uno::Sequence<lang::Locale> aLocales = aAsian.GetStartEndCharLocales();
|
|
|
|
if (aLocales.getLength())
|
2001-04-06 13:37:54 +00:00
|
|
|
{
|
2010-10-15 12:20:01 -05:00
|
|
|
rtl::Reference<SvxForbiddenCharactersTable> xForbiddenTable =
|
2001-10-19 15:01:00 +00:00
|
|
|
new SvxForbiddenCharactersTable( aDocument.GetServiceManager() );
|
|
|
|
|
|
|
|
const lang::Locale* pLocales = aLocales.getConstArray();
|
|
|
|
for (sal_Int32 i = 0; i < aLocales.getLength(); i++)
|
|
|
|
{
|
|
|
|
i18n::ForbiddenCharacters aForbidden;
|
|
|
|
aAsian.GetStartEndChars( pLocales[i], aForbidden.beginLine, aForbidden.endLine );
|
|
|
|
LanguageType eLang = SvxLocaleToLanguage(pLocales[i]);
|
2001-04-06 13:37:54 +00:00
|
|
|
|
2001-10-19 15:01:00 +00:00
|
|
|
xForbiddenTable->SetForbiddenCharacters( eLang, aForbidden );
|
|
|
|
}
|
|
|
|
|
|
|
|
aDocument.SetForbiddenCharacters( xForbiddenTable );
|
2001-04-06 13:37:54 +00:00
|
|
|
}
|
2001-10-19 15:01:00 +00:00
|
|
|
}
|
2001-04-06 13:37:54 +00:00
|
|
|
|
2001-10-19 15:01:00 +00:00
|
|
|
if ( !aDocument.IsValidAsianCompression() )
|
|
|
|
{
|
|
|
|
// set compression mode from configuration if not already set (e.g. XML import)
|
2011-01-17 13:20:22 +01:00
|
|
|
aDocument.SetAsianCompression( sal::static_int_cast<sal_uInt8>( aAsian.GetCharDistanceCompression() ) );
|
2001-04-06 13:37:54 +00:00
|
|
|
}
|
2001-06-25 19:21:32 +00:00
|
|
|
|
2001-10-19 15:01:00 +00:00
|
|
|
if ( !aDocument.IsValidAsianKerning() )
|
|
|
|
{
|
|
|
|
// set asian punctuation kerning from configuration if not already set (e.g. XML import)
|
|
|
|
aDocument.SetAsianKerning( !aAsian.IsKerningWesternTextOnly() ); // reversed
|
|
|
|
}
|
2001-06-25 19:21:32 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
|
|
|
|
void ScDocShell::ResetDrawObjectShell()
|
|
|
|
{
|
|
|
|
ScDrawLayer* pDrawLayer = aDocument.GetDrawLayer();
|
|
|
|
if (pDrawLayer)
|
|
|
|
pDrawLayer->SetObjectShell( NULL );
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
|
2010-12-11 23:25:30 +01:00
|
|
|
void ScDocShell::Activate()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-11 23:25:30 +01:00
|
|
|
void ScDocShell::Deactivate()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
ScDrawLayer* ScDocShell::MakeDrawLayer()
|
|
|
|
{
|
|
|
|
ScDrawLayer* pDrawLayer = aDocument.GetDrawLayer();
|
|
|
|
if (!pDrawLayer)
|
|
|
|
{
|
2001-08-01 06:32:37 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDocShell::MakeDrawLayer" );
|
2001-07-27 18:19:54 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
aDocument.InitDrawLayer(this);
|
|
|
|
pDrawLayer = aDocument.GetDrawLayer();
|
|
|
|
InitItems(); // incl. Undo und Basic
|
|
|
|
Broadcast( SfxSimpleHint( SC_HINT_DRWLAYER_NEW ) );
|
2001-07-23 14:18:23 +00:00
|
|
|
if (nDocumentLock)
|
2010-12-17 20:43:45 +00:00
|
|
|
pDrawLayer->setLock(true);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
return pDrawLayer;
|
|
|
|
}
|
2010-10-12 15:59:00 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|