1efeef26fSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file 5efeef26fSAndrew Rist * distributed with this work for additional information 6efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the 8efeef26fSAndrew Rist * "License"); you may not use this file except in compliance 9efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing, 14efeef26fSAndrew Rist * software distributed under the License is distributed on an 15efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16efeef26fSAndrew Rist * KIND, either express or implied. See the License for the 17efeef26fSAndrew Rist * specific language governing permissions and limitations 18efeef26fSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20efeef26fSAndrew Rist *************************************************************/ 21efeef26fSAndrew Rist 22efeef26fSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sw.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir 28cdf0e10cSrcweir #include <hintids.hxx> 29cdf0e10cSrcweir 30cdf0e10cSrcweir #include <svx/dialogs.hrc> 31cdf0e10cSrcweir #include <i18npool/mslangid.hxx> 32cdf0e10cSrcweir #include <sot/storinfo.hxx> 33cdf0e10cSrcweir #include <sot/storage.hxx> 34cdf0e10cSrcweir #include <svl/zforlist.hxx> 35cdf0e10cSrcweir #include <svtools/ctrltool.hxx> 36cdf0e10cSrcweir #include <unotools/lingucfg.hxx> 37cdf0e10cSrcweir #include <sfx2/docfile.hxx> 38cdf0e10cSrcweir #include <sfx2/sfxmodelfactory.hxx> 39cdf0e10cSrcweir #include <sfx2/printer.hxx> 40cdf0e10cSrcweir #include <sfx2/bindings.hxx> 41cdf0e10cSrcweir #include <svl/asiancfg.hxx> 42cdf0e10cSrcweir #include <editeng/unolingu.hxx> 43cdf0e10cSrcweir #include <sfx2/request.hxx> 44cdf0e10cSrcweir #include <svl/intitem.hxx> 45cdf0e10cSrcweir #include <editeng/adjitem.hxx> 46cdf0e10cSrcweir #include <editeng/akrnitem.hxx> 47cdf0e10cSrcweir #include <linguistic/lngprops.hxx> 48cdf0e10cSrcweir #include <com/sun/star/document/UpdateDocMode.hpp> 49cdf0e10cSrcweir #include <com/sun/star/i18n/ScriptType.hpp> 50cdf0e10cSrcweir #include <rtl/logfile.hxx> 51cdf0e10cSrcweir #include <sfx2/docfilt.hxx> 52cdf0e10cSrcweir #include <svx/xtable.hxx> 53cdf0e10cSrcweir #include <svx/drawitem.hxx> 54cdf0e10cSrcweir #include <editeng/fhgtitem.hxx> 55cdf0e10cSrcweir #include <editeng/fontitem.hxx> 56cdf0e10cSrcweir #include <editeng/flstitem.hxx> 57cdf0e10cSrcweir #include <editeng/tstpitem.hxx> 58cdf0e10cSrcweir #include <editeng/langitem.hxx> 59cdf0e10cSrcweir #include <editeng/colritem.hxx> 60cdf0e10cSrcweir #include <editeng/hyznitem.hxx> 61cdf0e10cSrcweir #include <editeng/svxacorr.hxx> 62cdf0e10cSrcweir #include <vcl/svapp.hxx> 63cdf0e10cSrcweir #include <view.hxx> 64cdf0e10cSrcweir #include <prtopt.hxx> 65cdf0e10cSrcweir #include <fmtcol.hxx> 66cdf0e10cSrcweir #include <docsh.hxx> 67cdf0e10cSrcweir #include <wdocsh.hxx> 68cdf0e10cSrcweir #include <swmodule.hxx> 69cdf0e10cSrcweir #include <doc.hxx> 70cdf0e10cSrcweir #include <docfac.hxx> 71cdf0e10cSrcweir #include <docstyle.hxx> 72cdf0e10cSrcweir #include <shellio.hxx> 73cdf0e10cSrcweir #include <tox.hxx> 74cdf0e10cSrcweir #include <swdtflvr.hxx> 75cdf0e10cSrcweir #include <dbmgr.hxx> 76cdf0e10cSrcweir #include <usrpref.hxx> 77cdf0e10cSrcweir #include <fontcfg.hxx> 78cdf0e10cSrcweir #include <poolfmt.hxx> 79cdf0e10cSrcweir #include <modcfg.hxx> 80cdf0e10cSrcweir #include <globdoc.hxx> 81cdf0e10cSrcweir #include <ndole.hxx> 82cdf0e10cSrcweir #include <mdiexp.hxx> 83cdf0e10cSrcweir #include <unotxdoc.hxx> 84cdf0e10cSrcweir #include <linkenum.hxx> 85cdf0e10cSrcweir #include <swwait.hxx> 86cdf0e10cSrcweir #include <wrtsh.hxx> 87cdf0e10cSrcweir #include <swerror.h> 88cdf0e10cSrcweir #include <globals.hrc> 89cdf0e10cSrcweir 90cdf0e10cSrcweir // #i18732# 91cdf0e10cSrcweir #include <fmtfollowtextflow.hxx> 92cdf0e10cSrcweir 93cdf0e10cSrcweir #include <unochart.hxx> 94cdf0e10cSrcweir 95cdf0e10cSrcweir // text grid 96cdf0e10cSrcweir #include <tgrditem.hxx> 97cdf0e10cSrcweir 98cdf0e10cSrcweir using namespace ::com::sun::star::i18n; 99cdf0e10cSrcweir using namespace ::com::sun::star::lang; 100cdf0e10cSrcweir using namespace ::com::sun::star::uno; 101cdf0e10cSrcweir using namespace ::com::sun::star; 102cdf0e10cSrcweir using ::rtl::OUString; 103cdf0e10cSrcweir 104cdf0e10cSrcweir /*-----------------21.09.96 15.29------------------- 105cdf0e10cSrcweir 106cdf0e10cSrcweir --------------------------------------------------*/ 107cdf0e10cSrcweir 108cdf0e10cSrcweir 109cdf0e10cSrcweir /*-------------------------------------------------------------------- 110cdf0e10cSrcweir Beschreibung: Document laden 111cdf0e10cSrcweir --------------------------------------------------------------------*/ 112cdf0e10cSrcweir 113cdf0e10cSrcweir 114cdf0e10cSrcweir sal_Bool SwDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor ) 115cdf0e10cSrcweir { 116cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::InitNew" ); 117cdf0e10cSrcweir 118cdf0e10cSrcweir sal_Bool bRet = SfxObjectShell::InitNew( xStor ); 119cdf0e10cSrcweir ASSERT( GetMapUnit() == MAP_TWIP, "map unit is not twip!" ); 120cdf0e10cSrcweir sal_Bool bHTMLTemplSet = sal_False; 121cdf0e10cSrcweir if( bRet ) 122cdf0e10cSrcweir { 123cdf0e10cSrcweir AddLink(); // pDoc / pIo ggf. anlegen 124cdf0e10cSrcweir 125cdf0e10cSrcweir sal_Bool bWeb = ISA( SwWebDocShell ); 126cdf0e10cSrcweir if ( bWeb ) 127cdf0e10cSrcweir bHTMLTemplSet = SetHTMLTemplate( *GetDoc() );//Styles aus HTML.vor 128cdf0e10cSrcweir else if( ISA( SwGlobalDocShell ) ) 129cdf0e10cSrcweir GetDoc()->set(IDocumentSettingAccess::GLOBAL_DOCUMENT, true); // Globaldokument 130cdf0e10cSrcweir 131cdf0e10cSrcweir 132cdf0e10cSrcweir /* 133cdf0e10cSrcweir //JP 12.07.95: so einfach waere es fuer die neu Mimik 134cdf0e10cSrcweir pDoc->SetDefault( SvxTabStopItem( 1, 135cdf0e10cSrcweir GetStar Writer App()->GetUsrPref()->GetDefTabDist(), 136cdf0e10cSrcweir SVX_TAB_ADJUST_DEFAULT, 137cdf0e10cSrcweir RES_PARATR_TABSTOP)); 138cdf0e10cSrcweir */ 139cdf0e10cSrcweir if ( GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) 140cdf0e10cSrcweir SwTransferable::InitOle( this, *pDoc ); 141cdf0e10cSrcweir 142cdf0e10cSrcweir // set forbidden characters if necessary 143cdf0e10cSrcweir SvxAsianConfig aAsian; 144cdf0e10cSrcweir Sequence<Locale> aLocales = aAsian.GetStartEndCharLocales(); 145cdf0e10cSrcweir if(aLocales.getLength()) 146cdf0e10cSrcweir { 147cdf0e10cSrcweir const Locale* pLocales = aLocales.getConstArray(); 148cdf0e10cSrcweir for(sal_Int32 i = 0; i < aLocales.getLength(); i++) 149cdf0e10cSrcweir { 150cdf0e10cSrcweir ForbiddenCharacters aForbidden; 151cdf0e10cSrcweir aAsian.GetStartEndChars( pLocales[i], aForbidden.beginLine, aForbidden.endLine); 152cdf0e10cSrcweir LanguageType eLang = SvxLocaleToLanguage(pLocales[i]); 153cdf0e10cSrcweir pDoc->setForbiddenCharacters( eLang, aForbidden); 154cdf0e10cSrcweir } 155cdf0e10cSrcweir } 156cdf0e10cSrcweir pDoc->set(IDocumentSettingAccess::KERN_ASIAN_PUNCTUATION, 157cdf0e10cSrcweir !aAsian.IsKerningWesternTextOnly()); 158cdf0e10cSrcweir pDoc->setCharacterCompressionType(static_cast<SwCharCompressType>(aAsian.GetCharDistanceCompression())); 159cdf0e10cSrcweir pDoc->setPrintData(*SW_MOD()->GetPrtOptions(bWeb)); 160cdf0e10cSrcweir 161cdf0e10cSrcweir SubInitNew(); 162cdf0e10cSrcweir 163cdf0e10cSrcweir // fuer alle 164cdf0e10cSrcweir 165cdf0e10cSrcweir SwStdFontConfig* pStdFont = SW_MOD()->GetStdFontConfig(); 166cdf0e10cSrcweir SfxPrinter* pPrt = pDoc->getPrinter( false ); 167cdf0e10cSrcweir 168cdf0e10cSrcweir String sEntry; 169cdf0e10cSrcweir sal_uInt16 aFontWhich[] = 170cdf0e10cSrcweir { RES_CHRATR_FONT, 171cdf0e10cSrcweir RES_CHRATR_CJK_FONT, 172cdf0e10cSrcweir RES_CHRATR_CTL_FONT 173cdf0e10cSrcweir }; 174cdf0e10cSrcweir sal_uInt16 aFontHeightWhich[] = 175cdf0e10cSrcweir { 176cdf0e10cSrcweir RES_CHRATR_FONTSIZE, 177cdf0e10cSrcweir RES_CHRATR_CJK_FONTSIZE, 178cdf0e10cSrcweir RES_CHRATR_CTL_FONTSIZE 179cdf0e10cSrcweir }; 180cdf0e10cSrcweir sal_uInt16 aFontIds[] = 181cdf0e10cSrcweir { 182cdf0e10cSrcweir FONT_STANDARD, 183cdf0e10cSrcweir FONT_STANDARD_CJK, 184cdf0e10cSrcweir FONT_STANDARD_CTL 185cdf0e10cSrcweir }; 186cdf0e10cSrcweir sal_uInt16 nFontTypes[] = 187cdf0e10cSrcweir { 188cdf0e10cSrcweir DEFAULTFONT_LATIN_TEXT, 189cdf0e10cSrcweir DEFAULTFONT_CJK_TEXT, 190cdf0e10cSrcweir DEFAULTFONT_CTL_TEXT 191cdf0e10cSrcweir }; 192cdf0e10cSrcweir sal_uInt16 aLangTypes[] = 193cdf0e10cSrcweir { 194cdf0e10cSrcweir RES_CHRATR_LANGUAGE, 195cdf0e10cSrcweir RES_CHRATR_CJK_LANGUAGE, 196cdf0e10cSrcweir RES_CHRATR_CTL_LANGUAGE 197cdf0e10cSrcweir }; 198cdf0e10cSrcweir 199cdf0e10cSrcweir for(sal_uInt8 i = 0; i < 3; i++) 200cdf0e10cSrcweir { 201cdf0e10cSrcweir sal_uInt16 nFontWhich = aFontWhich[i]; 202cdf0e10cSrcweir sal_uInt16 nFontId = aFontIds[i]; 203cdf0e10cSrcweir SvxFontItem* pFontItem = 0; 204cdf0e10cSrcweir const SvxLanguageItem& rLang = (const SvxLanguageItem&)pDoc->GetDefault( aLangTypes[i] ); 205cdf0e10cSrcweir LanguageType eLanguage = rLang.GetLanguage(); 206cdf0e10cSrcweir if(!pStdFont->IsFontDefault(nFontId)) 207cdf0e10cSrcweir { 208cdf0e10cSrcweir sEntry = pStdFont->GetFontFor(nFontId); 209cdf0e10cSrcweir 210cdf0e10cSrcweir Font aFont( sEntry, Size( 0, 10 ) ); 211cdf0e10cSrcweir if( pPrt ) 212cdf0e10cSrcweir { 213cdf0e10cSrcweir aFont = pPrt->GetFontMetric( aFont ); 214cdf0e10cSrcweir } 215cdf0e10cSrcweir 216cdf0e10cSrcweir pFontItem = new SvxFontItem(aFont.GetFamily(), aFont.GetName(), 217cdf0e10cSrcweir aEmptyStr, aFont.GetPitch(), aFont.GetCharSet(), nFontWhich); 218cdf0e10cSrcweir } 219cdf0e10cSrcweir else 220cdf0e10cSrcweir { 221cdf0e10cSrcweir // #107782# OJ use korean language if latin was used 222cdf0e10cSrcweir if ( i == 0 ) 223cdf0e10cSrcweir { 224cdf0e10cSrcweir LanguageType eUiLanguage = Application::GetSettings().GetUILanguage(); 225cdf0e10cSrcweir switch( eUiLanguage ) 226cdf0e10cSrcweir { 227cdf0e10cSrcweir case LANGUAGE_KOREAN: 228cdf0e10cSrcweir case LANGUAGE_KOREAN_JOHAB: 229cdf0e10cSrcweir eLanguage = eUiLanguage; 230cdf0e10cSrcweir break; 231cdf0e10cSrcweir } 232cdf0e10cSrcweir } 233cdf0e10cSrcweir 234cdf0e10cSrcweir Font aLangDefFont = OutputDevice::GetDefaultFont( 235cdf0e10cSrcweir nFontTypes[i], 236cdf0e10cSrcweir eLanguage, 237cdf0e10cSrcweir DEFAULTFONT_FLAGS_ONLYONE ); 238cdf0e10cSrcweir pFontItem = new SvxFontItem(aLangDefFont.GetFamily(), aLangDefFont.GetName(), 239cdf0e10cSrcweir aEmptyStr, aLangDefFont.GetPitch(), aLangDefFont.GetCharSet(), nFontWhich); 240cdf0e10cSrcweir } 241cdf0e10cSrcweir pDoc->SetDefault(*pFontItem); 242cdf0e10cSrcweir if( !bHTMLTemplSet ) 243cdf0e10cSrcweir { 244cdf0e10cSrcweir SwTxtFmtColl *pColl = pDoc->GetTxtCollFromPool(RES_POOLCOLL_STANDARD); 245cdf0e10cSrcweir pColl->ResetFmtAttr(nFontWhich); 246cdf0e10cSrcweir } 247cdf0e10cSrcweir delete pFontItem; 248cdf0e10cSrcweir sal_Int32 nFontHeight = pStdFont->GetFontHeight( FONT_STANDARD, i, eLanguage ); 249cdf0e10cSrcweir if(nFontHeight <= 0) 250cdf0e10cSrcweir nFontHeight = pStdFont->GetDefaultHeightFor( nFontId, eLanguage ); 251cdf0e10cSrcweir pDoc->SetDefault(SvxFontHeightItem( nFontHeight, 100, aFontHeightWhich[i] )); 252cdf0e10cSrcweir if( !bHTMLTemplSet ) 253cdf0e10cSrcweir { 254cdf0e10cSrcweir SwTxtFmtColl *pColl = pDoc->GetTxtCollFromPool(RES_POOLCOLL_STANDARD); 255cdf0e10cSrcweir pColl->ResetFmtAttr(aFontHeightWhich[i]); 256cdf0e10cSrcweir } 257cdf0e10cSrcweir 258cdf0e10cSrcweir } 259cdf0e10cSrcweir sal_uInt16 aFontIdPoolId[] = 260cdf0e10cSrcweir { 261cdf0e10cSrcweir FONT_OUTLINE, RES_POOLCOLL_HEADLINE_BASE, 262cdf0e10cSrcweir FONT_LIST, RES_POOLCOLL_NUMBUL_BASE, 263cdf0e10cSrcweir FONT_CAPTION, RES_POOLCOLL_LABEL, 264cdf0e10cSrcweir FONT_INDEX, RES_POOLCOLL_REGISTER_BASE, 265cdf0e10cSrcweir FONT_OUTLINE_CJK, RES_POOLCOLL_HEADLINE_BASE, 266cdf0e10cSrcweir FONT_LIST_CJK, RES_POOLCOLL_NUMBUL_BASE, 267cdf0e10cSrcweir FONT_CAPTION_CJK, RES_POOLCOLL_LABEL, 268cdf0e10cSrcweir FONT_INDEX_CJK, RES_POOLCOLL_REGISTER_BASE, 269cdf0e10cSrcweir FONT_OUTLINE_CTL, RES_POOLCOLL_HEADLINE_BASE, 270cdf0e10cSrcweir FONT_LIST_CTL, RES_POOLCOLL_NUMBUL_BASE, 271cdf0e10cSrcweir FONT_CAPTION_CTL, RES_POOLCOLL_LABEL, 272cdf0e10cSrcweir FONT_INDEX_CTL, RES_POOLCOLL_REGISTER_BASE 273cdf0e10cSrcweir }; 274cdf0e10cSrcweir 275cdf0e10cSrcweir sal_uInt16 nFontWhich = RES_CHRATR_FONT; 276cdf0e10cSrcweir sal_uInt16 nFontHeightWhich = RES_CHRATR_FONTSIZE; 277cdf0e10cSrcweir LanguageType eLanguage = static_cast<const SvxLanguageItem&>(pDoc->GetDefault( RES_CHRATR_LANGUAGE )).GetLanguage(); 278cdf0e10cSrcweir for(sal_uInt8 nIdx = 0; nIdx < 24; nIdx += 2) 279cdf0e10cSrcweir { 280cdf0e10cSrcweir if(nIdx == 8) 281cdf0e10cSrcweir { 282cdf0e10cSrcweir nFontWhich = RES_CHRATR_CJK_FONT; 283cdf0e10cSrcweir nFontHeightWhich = RES_CHRATR_CJK_FONTSIZE; 284cdf0e10cSrcweir eLanguage = static_cast<const SvxLanguageItem&>(pDoc->GetDefault( RES_CHRATR_CJK_LANGUAGE )).GetLanguage(); 285cdf0e10cSrcweir } 286cdf0e10cSrcweir else if(nIdx == 16) 287cdf0e10cSrcweir { 288cdf0e10cSrcweir nFontWhich = RES_CHRATR_CTL_FONT; 289cdf0e10cSrcweir nFontHeightWhich = RES_CHRATR_CTL_FONTSIZE; 290cdf0e10cSrcweir eLanguage = static_cast<const SvxLanguageItem&>(pDoc->GetDefault( RES_CHRATR_CTL_LANGUAGE )).GetLanguage(); 291cdf0e10cSrcweir } 292cdf0e10cSrcweir SwTxtFmtColl *pColl = 0; 293cdf0e10cSrcweir if(!pStdFont->IsFontDefault(aFontIdPoolId[nIdx])) 294cdf0e10cSrcweir { 295cdf0e10cSrcweir sEntry = pStdFont->GetFontFor(aFontIdPoolId[nIdx]); 296cdf0e10cSrcweir 297cdf0e10cSrcweir Font aFont( sEntry, Size( 0, 10 ) ); 298cdf0e10cSrcweir if( pPrt ) 299cdf0e10cSrcweir aFont = pPrt->GetFontMetric( aFont ); 300cdf0e10cSrcweir 301cdf0e10cSrcweir pColl = pDoc->GetTxtCollFromPool(aFontIdPoolId[nIdx + 1]); 302cdf0e10cSrcweir if( !bHTMLTemplSet || 303cdf0e10cSrcweir SFX_ITEM_SET != pColl->GetAttrSet().GetItemState( 304cdf0e10cSrcweir nFontWhich, sal_False ) ) 305cdf0e10cSrcweir { 306cdf0e10cSrcweir pColl->SetFmtAttr(SvxFontItem(aFont.GetFamily(), aFont.GetName(), 307cdf0e10cSrcweir aEmptyStr, aFont.GetPitch(), aFont.GetCharSet(), nFontWhich)); 308cdf0e10cSrcweir } 309cdf0e10cSrcweir } 310cdf0e10cSrcweir sal_Int32 nFontHeight = pStdFont->GetFontHeight( static_cast< sal_Int8 >(aFontIdPoolId[nIdx]), 0, eLanguage ); 311cdf0e10cSrcweir if(nFontHeight <= 0) 312cdf0e10cSrcweir nFontHeight = pStdFont->GetDefaultHeightFor( aFontIdPoolId[nIdx], eLanguage ); 313cdf0e10cSrcweir if(!pColl) 314cdf0e10cSrcweir pColl = pDoc->GetTxtCollFromPool(aFontIdPoolId[nIdx + 1]); 315cdf0e10cSrcweir SvxFontHeightItem aFontHeight( (const SvxFontHeightItem&)pColl->GetFmtAttr( nFontHeightWhich, sal_True )); 316cdf0e10cSrcweir if(aFontHeight.GetHeight() != sal::static_int_cast<sal_uInt32, sal_Int32>(nFontHeight)) 317cdf0e10cSrcweir { 318cdf0e10cSrcweir aFontHeight.SetHeight(nFontHeight); 319cdf0e10cSrcweir pColl->SetFmtAttr( aFontHeight ); 320cdf0e10cSrcweir } 321cdf0e10cSrcweir } 322cdf0e10cSrcweir 323cdf0e10cSrcweir // the default for documents created via 'File/New' should be 'on' 324cdf0e10cSrcweir // (old documents, where this property was not yet implemented, will get the 325cdf0e10cSrcweir // value 'false' in the SwDoc c-tor) 326cdf0e10cSrcweir pDoc->set( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT, 327cdf0e10cSrcweir SW_MOD()->GetUsrPref( bWeb )->IsAlignMathObjectsToBaseline() ); 328cdf0e10cSrcweir } 329cdf0e10cSrcweir 330cdf0e10cSrcweir /* #106748# If the default frame direction of a document is RTL 331cdf0e10cSrcweir the default adjusment is to the right. */ 332cdf0e10cSrcweir if( !bHTMLTemplSet && 333cdf0e10cSrcweir FRMDIR_HORI_RIGHT_TOP == GetDefaultFrameDirection(GetAppLanguage()) ) 334cdf0e10cSrcweir pDoc->SetDefault( SvxAdjustItem(SVX_ADJUST_RIGHT, RES_PARATR_ADJUST ) ); 335cdf0e10cSrcweir 336cdf0e10cSrcweir // OD 09.10.2003 #i18732# - set dynamic pool default for 337cdf0e10cSrcweir // item RES_FOLLOW_TEXT_FLOW to sal_False for *new document*. 338cdf0e10cSrcweir // Thus, redo this change in method <SwDoc::RemoveAllFmtLanguageDependencies()>, 339cdf0e10cSrcweir // which is called from <SwDocShell::ConvertFrom(..)> in order to restore 340cdf0e10cSrcweir // the static pool default. 341cdf0e10cSrcweir pDoc->SetDefault( SwFmtFollowTextFlow( sal_False ) ); 342cdf0e10cSrcweir 343cdf0e10cSrcweir // --> collapsing borders FME 2005-05-27 #i29550# 344cdf0e10cSrcweir pDoc->SetDefault( SfxBoolItem( RES_COLLAPSING_BORDERS, sal_True ) ); 345cdf0e10cSrcweir // <-- collapsing 346cdf0e10cSrcweir 347cdf0e10cSrcweir //#i16874# AutoKerning as default for new documents 348cdf0e10cSrcweir pDoc->SetDefault( SvxAutoKernItem( sal_True, RES_CHRATR_AUTOKERN ) ); 349cdf0e10cSrcweir 350cdf0e10cSrcweir // --> OD 2005-02-10 #i42080# - Due to the several calls of method <SetDefault(..)> 351cdf0e10cSrcweir // at the document instance, the document is modified. Thus, reset this 352cdf0e10cSrcweir // status here. Note: In method <SubInitNew()> this is also done. 353cdf0e10cSrcweir pDoc->ResetModified(); 354cdf0e10cSrcweir // <-- 355cdf0e10cSrcweir 356cdf0e10cSrcweir return bRet; 357cdf0e10cSrcweir } 358cdf0e10cSrcweir 359cdf0e10cSrcweir /*-------------------------------------------------------------------- 360cdf0e10cSrcweir Beschreibung: Ctor mit SfxCreateMode ????? 361cdf0e10cSrcweir --------------------------------------------------------------------*/ 362cdf0e10cSrcweir 363cdf0e10cSrcweir 364cdf0e10cSrcweir SwDocShell::SwDocShell( SfxObjectCreateMode eMode ) : 365cdf0e10cSrcweir SfxObjectShell ( eMode ), 366cdf0e10cSrcweir pDoc(0), 367cdf0e10cSrcweir pFontList(0), 368cdf0e10cSrcweir pView( 0 ), 369cdf0e10cSrcweir pWrtShell( 0 ), 370cdf0e10cSrcweir pOLEChildList( 0 ), 371cdf0e10cSrcweir nUpdateDocMode(document::UpdateDocMode::ACCORDING_TO_CONFIG), 372cdf0e10cSrcweir bInUpdateFontList(false) 373cdf0e10cSrcweir { 374cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::SwDocShell" ); 375cdf0e10cSrcweir Init_Impl(); 376cdf0e10cSrcweir } 377cdf0e10cSrcweir 378cdf0e10cSrcweir /*-------------------------------------------------------------------- 379cdf0e10cSrcweir Beschreibung: Ctor / Dtor 380cdf0e10cSrcweir --------------------------------------------------------------------*/ 381cdf0e10cSrcweir 382cdf0e10cSrcweir 383cdf0e10cSrcweir SwDocShell::SwDocShell( const sal_uInt64 i_nSfxCreationFlags ) : 384cdf0e10cSrcweir SfxObjectShell ( i_nSfxCreationFlags ), 385cdf0e10cSrcweir pDoc(0), 386cdf0e10cSrcweir pFontList(0), 387cdf0e10cSrcweir pView( 0 ), 388cdf0e10cSrcweir pWrtShell( 0 ), 389cdf0e10cSrcweir pOLEChildList( 0 ), 390cdf0e10cSrcweir nUpdateDocMode(document::UpdateDocMode::ACCORDING_TO_CONFIG), 391cdf0e10cSrcweir bInUpdateFontList(false) 392cdf0e10cSrcweir { 393cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::SwDocShell" ); 394cdf0e10cSrcweir Init_Impl(); 395cdf0e10cSrcweir } 396cdf0e10cSrcweir 397cdf0e10cSrcweir /*-------------------------------------------------------------------- 398cdf0e10cSrcweir Beschreibung: Ctor / Dtor 399cdf0e10cSrcweir --------------------------------------------------------------------*/ 400cdf0e10cSrcweir 401cdf0e10cSrcweir 402cdf0e10cSrcweir SwDocShell::SwDocShell( SwDoc *pD, SfxObjectCreateMode eMode ): 403cdf0e10cSrcweir SfxObjectShell ( eMode ), 404cdf0e10cSrcweir pDoc(pD), 405cdf0e10cSrcweir pFontList(0), 406cdf0e10cSrcweir pView( 0 ), 407cdf0e10cSrcweir pWrtShell( 0 ), 408cdf0e10cSrcweir pOLEChildList( 0 ), 409cdf0e10cSrcweir nUpdateDocMode(document::UpdateDocMode::ACCORDING_TO_CONFIG), 410cdf0e10cSrcweir bInUpdateFontList(false) 411cdf0e10cSrcweir { 412cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::SwDocShell" ); 413cdf0e10cSrcweir Init_Impl(); 414cdf0e10cSrcweir } 415cdf0e10cSrcweir 416cdf0e10cSrcweir /*-------------------------------------------------------------------- 417cdf0e10cSrcweir Beschreibung: Dtor 418cdf0e10cSrcweir --------------------------------------------------------------------*/ 419cdf0e10cSrcweir 420cdf0e10cSrcweir 421cdf0e10cSrcweir SwDocShell::~SwDocShell() 422cdf0e10cSrcweir { 423cdf0e10cSrcweir // disable chart related objects now because in ~SwDoc it may be to late for this 424cdf0e10cSrcweir if( pDoc ) 425cdf0e10cSrcweir { 426cdf0e10cSrcweir pDoc->GetChartControllerHelper().Disconnect(); 427cdf0e10cSrcweir SwChartDataProvider *pPCD = pDoc->GetChartDataProvider(); 428cdf0e10cSrcweir if (pPCD) 429cdf0e10cSrcweir pPCD->dispose(); 430cdf0e10cSrcweir } 431cdf0e10cSrcweir 432cdf0e10cSrcweir RemoveLink(); 433cdf0e10cSrcweir delete pFontList; 434cdf0e10cSrcweir 435cdf0e10cSrcweir // wir als BroadCaster werden auch unser eigener Listener 436cdf0e10cSrcweir // (fuer DocInfo/FileNamen/....) 437cdf0e10cSrcweir EndListening( *this ); 438cdf0e10cSrcweir 439cdf0e10cSrcweir delete pOLEChildList; 440cdf0e10cSrcweir } 441cdf0e10cSrcweir /* -----------------------------10.09.2001 15:59------------------------------ 442cdf0e10cSrcweir 443cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 444cdf0e10cSrcweir void SwDocShell::Init_Impl() 445cdf0e10cSrcweir { 446cdf0e10cSrcweir SetPool(&SW_MOD()->GetPool()); 447cdf0e10cSrcweir SetBaseModel(new SwXTextDocument(this)); 448cdf0e10cSrcweir // wir als BroadCaster werden auch unser eigener Listener 449cdf0e10cSrcweir // (fuer DocInfo/FileNamen/....) 450cdf0e10cSrcweir StartListening( *this ); 451cdf0e10cSrcweir //position of the "Automatic" style filter for the stylist (app.src) 452cdf0e10cSrcweir SetAutoStyleFilterIndex(3); 453cdf0e10cSrcweir 454cdf0e10cSrcweir // set map unit to twip 455cdf0e10cSrcweir SetMapUnit( MAP_TWIP ); 456cdf0e10cSrcweir } 457cdf0e10cSrcweir /*-------------------------------------------------------------------- 458cdf0e10cSrcweir Beschreibung: AddLink 459cdf0e10cSrcweir --------------------------------------------------------------------*/ 460cdf0e10cSrcweir 461cdf0e10cSrcweir 462cdf0e10cSrcweir void SwDocShell::AddLink() 463cdf0e10cSrcweir { 464cdf0e10cSrcweir if( !pDoc ) 465cdf0e10cSrcweir { 466cdf0e10cSrcweir SwDocFac aFactory; 467cdf0e10cSrcweir pDoc = aFactory.GetDoc(); 468cdf0e10cSrcweir pDoc->acquire(); 469cdf0e10cSrcweir pDoc->set(IDocumentSettingAccess::HTML_MODE, ISA(SwWebDocShell) ); 470cdf0e10cSrcweir } 471cdf0e10cSrcweir else 472cdf0e10cSrcweir pDoc->acquire(); 473cdf0e10cSrcweir pDoc->SetDocShell( this ); // am Doc den DocShell-Pointer setzen 474cdf0e10cSrcweir uno::Reference< text::XTextDocument > xDoc(GetBaseModel(), uno::UNO_QUERY); 475cdf0e10cSrcweir ((SwXTextDocument*)xDoc.get())->Reactivate(this); 476cdf0e10cSrcweir 477cdf0e10cSrcweir SetPool(&pDoc->GetAttrPool()); 478cdf0e10cSrcweir 479cdf0e10cSrcweir // am besten erst wenn eine sdbcx::View erzeugt wird !!! 480cdf0e10cSrcweir pDoc->SetOle2Link(LINK(this, SwDocShell, Ole2ModifiedHdl)); 481cdf0e10cSrcweir } 482cdf0e10cSrcweir 483cdf0e10cSrcweir /*-------------------------------------------------------------------- 484cdf0e10cSrcweir Beschreibung: neue FontList erzeugen Aenderung Drucker 485cdf0e10cSrcweir --------------------------------------------------------------------*/ 486cdf0e10cSrcweir 487cdf0e10cSrcweir 488cdf0e10cSrcweir void SwDocShell::UpdateFontList() 489cdf0e10cSrcweir { 490cdf0e10cSrcweir if(!bInUpdateFontList) 491cdf0e10cSrcweir { 492cdf0e10cSrcweir bInUpdateFontList = true; 493cdf0e10cSrcweir ASSERT(pDoc, "Kein Doc keine FontList"); 494cdf0e10cSrcweir if( pDoc ) 495cdf0e10cSrcweir { 496cdf0e10cSrcweir delete pFontList; 497cdf0e10cSrcweir pFontList = new FontList( pDoc->getReferenceDevice( true ) ); 498cdf0e10cSrcweir PutItem( SvxFontListItem( pFontList, SID_ATTR_CHAR_FONTLIST ) ); 499cdf0e10cSrcweir } 500cdf0e10cSrcweir bInUpdateFontList = false; 501cdf0e10cSrcweir } 502cdf0e10cSrcweir } 503cdf0e10cSrcweir 504cdf0e10cSrcweir /*-------------------------------------------------------------------- 505cdf0e10cSrcweir Beschreibung: RemoveLink 506cdf0e10cSrcweir --------------------------------------------------------------------*/ 507cdf0e10cSrcweir 508cdf0e10cSrcweir 509cdf0e10cSrcweir void SwDocShell::RemoveLink() 510cdf0e10cSrcweir { 511cdf0e10cSrcweir // Uno-Object abklemmen 512cdf0e10cSrcweir uno::Reference< text::XTextDocument > xDoc(GetBaseModel(), uno::UNO_QUERY); 513cdf0e10cSrcweir ((SwXTextDocument*)xDoc.get())->Invalidate(); 514cdf0e10cSrcweir aFinishedTimer.Stop(); 515cdf0e10cSrcweir if(pDoc) 516cdf0e10cSrcweir { 517cdf0e10cSrcweir if( mxBasePool.is() ) 518cdf0e10cSrcweir { 519cdf0e10cSrcweir static_cast<SwDocStyleSheetPool*>(mxBasePool.get())->dispose(); 520cdf0e10cSrcweir mxBasePool.clear(); 521cdf0e10cSrcweir } 522cdf0e10cSrcweir sal_Int8 nRefCt = static_cast< sal_Int8 >(pDoc->release()); 523cdf0e10cSrcweir pDoc->SetOle2Link(Link()); 524cdf0e10cSrcweir pDoc->SetDocShell( 0 ); 525cdf0e10cSrcweir if( !nRefCt ) 526cdf0e10cSrcweir delete pDoc; 527cdf0e10cSrcweir pDoc = 0; // wir haben das Doc nicht mehr !! 528cdf0e10cSrcweir } 529cdf0e10cSrcweir } 530cdf0e10cSrcweir void SwDocShell::InvalidateModel() 531cdf0e10cSrcweir { 532cdf0e10cSrcweir // Uno-Object abklemmen 533cdf0e10cSrcweir uno::Reference< text::XTextDocument > xDoc(GetBaseModel(), uno::UNO_QUERY); 534cdf0e10cSrcweir ((SwXTextDocument*)xDoc.get())->Invalidate(); 535cdf0e10cSrcweir } 536cdf0e10cSrcweir void SwDocShell::ReactivateModel() 537cdf0e10cSrcweir { 538cdf0e10cSrcweir // Uno-Object abklemmen 539cdf0e10cSrcweir uno::Reference< text::XTextDocument > xDoc(GetBaseModel(), uno::UNO_QUERY); 540cdf0e10cSrcweir ((SwXTextDocument*)xDoc.get())->Reactivate(this); 541cdf0e10cSrcweir } 542cdf0e10cSrcweir 543cdf0e10cSrcweir /*-------------------------------------------------------------------- 544cdf0e10cSrcweir Beschreibung: Laden, Default-Format 545cdf0e10cSrcweir --------------------------------------------------------------------*/ 546cdf0e10cSrcweir 547cdf0e10cSrcweir 548cdf0e10cSrcweir sal_Bool SwDocShell::Load( SfxMedium& rMedium ) 549cdf0e10cSrcweir { 550cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::Load" ); 551cdf0e10cSrcweir sal_Bool bRet = sal_False; 552cdf0e10cSrcweir if( SfxObjectShell::Load( rMedium )) 553cdf0e10cSrcweir { 554cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_TRACE( aLog, "after SfxInPlaceObject::Load" ); 555cdf0e10cSrcweir if( pDoc ) // fuer Letzte Version !! 556cdf0e10cSrcweir RemoveLink(); // das existierende Loslassen 557cdf0e10cSrcweir 558cdf0e10cSrcweir AddLink(); // Link setzen und Daten updaten !! 559cdf0e10cSrcweir 560cdf0e10cSrcweir // Das Laden 561cdf0e10cSrcweir // fuer MD 562cdf0e10cSrcweir ASSERT( !mxBasePool.is(), "wer hat seinen Pool nicht zerstoert?" ); 563cdf0e10cSrcweir mxBasePool = new SwDocStyleSheetPool( *pDoc, SFX_CREATE_MODE_ORGANIZER == GetCreateMode() ); 564cdf0e10cSrcweir if(GetCreateMode() != SFX_CREATE_MODE_ORGANIZER) 565cdf0e10cSrcweir { 566cdf0e10cSrcweir SFX_ITEMSET_ARG( rMedium.GetItemSet(), pUpdateDocItem, SfxUInt16Item, SID_UPDATEDOCMODE, sal_False); 567cdf0e10cSrcweir nUpdateDocMode = pUpdateDocItem ? pUpdateDocItem->GetValue() : document::UpdateDocMode::NO_UPDATE; 568cdf0e10cSrcweir } 569cdf0e10cSrcweir 570*8ef2f12bSOliver-Rainer Wittmann SwWait aWait( *this, true ); 571cdf0e10cSrcweir sal_uInt32 nErr = ERR_SWG_READ_ERROR; 572cdf0e10cSrcweir switch( GetCreateMode() ) 573cdf0e10cSrcweir { 574cdf0e10cSrcweir // case SFX_CREATE_MODE_INTERNAL: 575cdf0e10cSrcweir // nErr = 0; 576cdf0e10cSrcweir // break; 577cdf0e10cSrcweir 578cdf0e10cSrcweir case SFX_CREATE_MODE_ORGANIZER: 579cdf0e10cSrcweir { 580cdf0e10cSrcweir if( ReadXML ) 581cdf0e10cSrcweir { 582cdf0e10cSrcweir ReadXML->SetOrganizerMode( sal_True ); 583cdf0e10cSrcweir SwReader aRdr( rMedium, aEmptyStr, pDoc ); 584cdf0e10cSrcweir nErr = aRdr.Read( *ReadXML ); 585cdf0e10cSrcweir ReadXML->SetOrganizerMode( sal_False ); 586cdf0e10cSrcweir } 587cdf0e10cSrcweir } 588cdf0e10cSrcweir break; 589cdf0e10cSrcweir 590cdf0e10cSrcweir case SFX_CREATE_MODE_INTERNAL: 591cdf0e10cSrcweir case SFX_CREATE_MODE_EMBEDDED: 592cdf0e10cSrcweir { 593cdf0e10cSrcweir // fuer MWERKS (Mac-Compiler): kann nicht selbststaendig casten 594cdf0e10cSrcweir SwTransferable::InitOle( this, *pDoc ); 595cdf0e10cSrcweir } 596cdf0e10cSrcweir // SfxProgress unterdruecken, wenn man Embedded ist 597cdf0e10cSrcweir SW_MOD()->SetEmbeddedLoadSave( sal_True ); 598cdf0e10cSrcweir // kein break; 599cdf0e10cSrcweir 600cdf0e10cSrcweir case SFX_CREATE_MODE_STANDARD: 601cdf0e10cSrcweir case SFX_CREATE_MODE_PREVIEW: 602cdf0e10cSrcweir { 603cdf0e10cSrcweir Reader *pReader = ReadXML; 604cdf0e10cSrcweir if( pReader ) 605cdf0e10cSrcweir { 606cdf0e10cSrcweir // die DocInfo vom Doc am DocShell-Medium setzen 607cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_TRACE( aLog, "before ReadDocInfo" ); 608cdf0e10cSrcweir SwReader aRdr( rMedium, aEmptyStr, pDoc ); 609cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_TRACE( aLog, "before Read" ); 610cdf0e10cSrcweir nErr = aRdr.Read( *pReader ); 611cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_TRACE( aLog, "after Read" ); 612cdf0e10cSrcweir 613cdf0e10cSrcweir // If a XML document is loaded, the global doc/web doc 614cdf0e10cSrcweir // flags have to be set, because they aren't loaded 615cdf0e10cSrcweir // by this formats. 616cdf0e10cSrcweir if( ISA( SwWebDocShell ) ) 617cdf0e10cSrcweir { 618cdf0e10cSrcweir if( !pDoc->get(IDocumentSettingAccess::HTML_MODE) ) 619cdf0e10cSrcweir pDoc->set(IDocumentSettingAccess::HTML_MODE, true); 620cdf0e10cSrcweir } 621cdf0e10cSrcweir if( ISA( SwGlobalDocShell ) ) 622cdf0e10cSrcweir { 623cdf0e10cSrcweir if( !pDoc->get(IDocumentSettingAccess::GLOBAL_DOCUMENT) ) 624cdf0e10cSrcweir pDoc->set(IDocumentSettingAccess::GLOBAL_DOCUMENT, true); 625cdf0e10cSrcweir } 626cdf0e10cSrcweir } 627cdf0e10cSrcweir #ifdef DBG_UTIL 628cdf0e10cSrcweir else 629cdf0e10cSrcweir ASSERT( !this, "ohne Sw3Reader geht nichts" ); 630cdf0e10cSrcweir #endif 631cdf0e10cSrcweir } 632cdf0e10cSrcweir break; 633cdf0e10cSrcweir 634cdf0e10cSrcweir default: 635cdf0e10cSrcweir ASSERT( !this, "Load: new CreateMode?" ); 636cdf0e10cSrcweir 637cdf0e10cSrcweir } 638cdf0e10cSrcweir 639cdf0e10cSrcweir UpdateFontList(); 640cdf0e10cSrcweir InitDraw(); 641cdf0e10cSrcweir 642cdf0e10cSrcweir SetError( nErr, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); 643cdf0e10cSrcweir bRet = !IsError( nErr ); 644cdf0e10cSrcweir 645cdf0e10cSrcweir // --> OD 2006-11-07 #i59688# 646cdf0e10cSrcweir // // StartFinishedLoading rufen. 647cdf0e10cSrcweir // if( bRet && !pDoc->IsInLoadAsynchron() && 648cdf0e10cSrcweir // GetCreateMode() == SFX_CREATE_MODE_STANDARD ) 649cdf0e10cSrcweir // StartLoadFinishedTimer(); 650cdf0e10cSrcweir if ( bRet && !pDoc->IsInLoadAsynchron() && 651cdf0e10cSrcweir GetCreateMode() == SFX_CREATE_MODE_STANDARD ) 652cdf0e10cSrcweir { 653cdf0e10cSrcweir LoadingFinished(); 654cdf0e10cSrcweir } 655cdf0e10cSrcweir // <-- 656cdf0e10cSrcweir 657cdf0e10cSrcweir // SfxProgress unterdruecken, wenn man Embedded ist 658cdf0e10cSrcweir SW_MOD()->SetEmbeddedLoadSave( sal_False ); 659cdf0e10cSrcweir } 660cdf0e10cSrcweir 661cdf0e10cSrcweir return bRet; 662cdf0e10cSrcweir } 663cdf0e10cSrcweir 664cdf0e10cSrcweir /*-------------------------------------------------------------------- 665cdf0e10cSrcweir Beschreibung: 666cdf0e10cSrcweir --------------------------------------------------------------------*/ 667cdf0e10cSrcweir 668cdf0e10cSrcweir 669cdf0e10cSrcweir sal_Bool SwDocShell::LoadFrom( SfxMedium& rMedium ) 670cdf0e10cSrcweir { 671cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::LoadFrom" ); 672cdf0e10cSrcweir sal_Bool bRet = sal_False; 673cdf0e10cSrcweir if( pDoc ) 674cdf0e10cSrcweir RemoveLink(); 675cdf0e10cSrcweir 676cdf0e10cSrcweir AddLink(); // Link setzen und Daten updaten !! 677cdf0e10cSrcweir 678cdf0e10cSrcweir do { // middle check loop 679cdf0e10cSrcweir sal_uInt32 nErr = ERR_SWG_READ_ERROR; 680cdf0e10cSrcweir //const String& rNm = pStor->GetName(); 681cdf0e10cSrcweir String aStreamName; 682cdf0e10cSrcweir aStreamName = String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM("styles.xml")); 683cdf0e10cSrcweir uno::Reference < container::XNameAccess > xAccess( rMedium.GetStorage(), uno::UNO_QUERY ); 684cdf0e10cSrcweir if ( xAccess->hasByName( aStreamName ) && rMedium.GetStorage()->isStreamElement( aStreamName ) ) 685cdf0e10cSrcweir { 686cdf0e10cSrcweir // Das Laden 687*8ef2f12bSOliver-Rainer Wittmann SwWait aWait( *this, true ); 688cdf0e10cSrcweir { 689cdf0e10cSrcweir ASSERT( !mxBasePool.is(), "wer hat seinen Pool nicht zerstoert?" ); 690cdf0e10cSrcweir mxBasePool = new SwDocStyleSheetPool( *pDoc, SFX_CREATE_MODE_ORGANIZER == GetCreateMode() ); 691cdf0e10cSrcweir if( ReadXML ) 692cdf0e10cSrcweir { 693cdf0e10cSrcweir ReadXML->SetOrganizerMode( sal_True ); 694cdf0e10cSrcweir SwReader aRdr( rMedium, aEmptyStr, pDoc ); 695cdf0e10cSrcweir nErr = aRdr.Read( *ReadXML ); 696cdf0e10cSrcweir ReadXML->SetOrganizerMode( sal_False ); 697cdf0e10cSrcweir } 698cdf0e10cSrcweir } 699cdf0e10cSrcweir } 700cdf0e10cSrcweir else 701cdf0e10cSrcweir { 702cdf0e10cSrcweir DBG_ERROR("Code removed!"); 703cdf0e10cSrcweir /* 704cdf0e10cSrcweir //TODO/LATER: looks like some binary stuff?! 705cdf0e10cSrcweir // sollte es sich um eine 2. Vrolage handeln ?? 706cdf0e10cSrcweir if( SvStorage::IsStorageFile( rNm ) ) 707cdf0e10cSrcweir break; 708cdf0e10cSrcweir 709cdf0e10cSrcweir const SfxFilter* pFltr = SwIoSystem::GetFileFilter( rNm, aEmptyStr ); 710cdf0e10cSrcweir if( !pFltr || !pFltr->GetUserData().EqualsAscii( FILTER_SWG )) 711cdf0e10cSrcweir break; 712cdf0e10cSrcweir 713cdf0e10cSrcweir SfxMedium aMed( rNm, STREAM_STD_READ, sal_False ); 714cdf0e10cSrcweir if( 0 == ( nErr = aMed.GetInStream()->GetError() ) ) 715cdf0e10cSrcweir { 716cdf0e10cSrcweir SwWait aWait( *this, sal_True ); 717cdf0e10cSrcweir SwReader aRead( aMed, rNm, pDoc ); 718cdf0e10cSrcweir nErr = aRead.Read( *ReadSwg ); 719cdf0e10cSrcweir } 720cdf0e10cSrcweir */ 721cdf0e10cSrcweir } 722cdf0e10cSrcweir 723cdf0e10cSrcweir SetError( nErr, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); 724cdf0e10cSrcweir bRet = !IsError( nErr ); 725cdf0e10cSrcweir 726cdf0e10cSrcweir } while( sal_False ); 727cdf0e10cSrcweir 728cdf0e10cSrcweir SfxObjectShell::LoadFrom( rMedium ); 729cdf0e10cSrcweir pDoc->ResetModified(); 730cdf0e10cSrcweir return bRet; 731cdf0e10cSrcweir } 732cdf0e10cSrcweir 733cdf0e10cSrcweir 734cdf0e10cSrcweir void SwDocShell::SubInitNew() 735cdf0e10cSrcweir { 736cdf0e10cSrcweir ASSERT( !mxBasePool.is(), "wer hat seinen Pool nicht zerstoert?" ); 737cdf0e10cSrcweir mxBasePool = new SwDocStyleSheetPool( *pDoc, SFX_CREATE_MODE_ORGANIZER == GetCreateMode() ); 738cdf0e10cSrcweir UpdateFontList(); 739cdf0e10cSrcweir InitDraw(); 740cdf0e10cSrcweir 741cdf0e10cSrcweir pDoc->setLinkUpdateMode( GLOBALSETTING ); 742cdf0e10cSrcweir pDoc->setFieldUpdateFlags( AUTOUPD_GLOBALSETTING ); 743cdf0e10cSrcweir 744cdf0e10cSrcweir sal_Bool bWeb = ISA(SwWebDocShell); 745cdf0e10cSrcweir 746cdf0e10cSrcweir sal_uInt16 nRange[] = { 747cdf0e10cSrcweir RES_PARATR_ADJUST, RES_PARATR_ADJUST, 748cdf0e10cSrcweir RES_CHRATR_COLOR, RES_CHRATR_COLOR, 749cdf0e10cSrcweir RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE, 750cdf0e10cSrcweir RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_LANGUAGE, 751cdf0e10cSrcweir RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_LANGUAGE, 752cdf0e10cSrcweir 0, 0, 0 }; 753cdf0e10cSrcweir if(!bWeb) 754cdf0e10cSrcweir { 755cdf0e10cSrcweir nRange[ (sizeof(nRange)/sizeof(nRange[0])) - 3 ] = RES_PARATR_TABSTOP; 756cdf0e10cSrcweir nRange[ (sizeof(nRange)/sizeof(nRange[0])) - 2 ] = RES_PARATR_HYPHENZONE; 757cdf0e10cSrcweir } 758cdf0e10cSrcweir SfxItemSet aDfltSet( pDoc->GetAttrPool(), nRange ); 759cdf0e10cSrcweir 760cdf0e10cSrcweir //! get lingu options without loading lingu DLL 761cdf0e10cSrcweir SvtLinguOptions aLinguOpt; 762cdf0e10cSrcweir 763cdf0e10cSrcweir SvtLinguConfig().GetOptions( aLinguOpt ); 764cdf0e10cSrcweir 765cdf0e10cSrcweir sal_Int16 nVal = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage, ::com::sun::star::i18n::ScriptType::LATIN), 766cdf0e10cSrcweir eCJK = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CJK, ::com::sun::star::i18n::ScriptType::ASIAN), 767cdf0e10cSrcweir eCTL = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CTL, ::com::sun::star::i18n::ScriptType::COMPLEX); 768cdf0e10cSrcweir aDfltSet.Put( SvxLanguageItem( nVal, RES_CHRATR_LANGUAGE ) ); 769cdf0e10cSrcweir aDfltSet.Put( SvxLanguageItem( eCJK, RES_CHRATR_CJK_LANGUAGE ) ); 770cdf0e10cSrcweir aDfltSet.Put( SvxLanguageItem( eCTL, RES_CHRATR_CTL_LANGUAGE ) ); 771cdf0e10cSrcweir 772cdf0e10cSrcweir if(!bWeb) 773cdf0e10cSrcweir { 774cdf0e10cSrcweir SvxHyphenZoneItem aHyp( (SvxHyphenZoneItem&) pDoc->GetDefault( 775cdf0e10cSrcweir RES_PARATR_HYPHENZONE) ); 776cdf0e10cSrcweir aHyp.GetMinLead() = static_cast< sal_uInt8 >(aLinguOpt.nHyphMinLeading); 777cdf0e10cSrcweir aHyp.GetMinTrail() = static_cast< sal_uInt8 >(aLinguOpt.nHyphMinTrailing); 778cdf0e10cSrcweir 779cdf0e10cSrcweir aDfltSet.Put( aHyp ); 780cdf0e10cSrcweir 781cdf0e10cSrcweir sal_uInt16 nNewPos = static_cast< sal_uInt16 >(SW_MOD()->GetUsrPref(sal_False)->GetDefTab()); 782cdf0e10cSrcweir if( nNewPos ) 783cdf0e10cSrcweir aDfltSet.Put( SvxTabStopItem( 1, nNewPos, 784cdf0e10cSrcweir SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP ) ); 785cdf0e10cSrcweir } 786cdf0e10cSrcweir aDfltSet.Put( SvxColorItem( Color( COL_AUTO ), RES_CHRATR_COLOR ) ); 787cdf0e10cSrcweir 788cdf0e10cSrcweir pDoc->SetDefault( aDfltSet ); 789cdf0e10cSrcweir 790cdf0e10cSrcweir //default page mode for text grid 791cdf0e10cSrcweir if(!bWeb) 792cdf0e10cSrcweir { 793cdf0e10cSrcweir sal_Bool bSquaredPageMode = SW_MOD()->GetUsrPref(sal_False)->IsSquaredPageMode(); 794cdf0e10cSrcweir pDoc->SetDefaultPageMode( bSquaredPageMode ); 795cdf0e10cSrcweir } 796cdf0e10cSrcweir 797cdf0e10cSrcweir pDoc->ResetModified(); 798cdf0e10cSrcweir } 799cdf0e10cSrcweir 800cdf0e10cSrcweir /* 801cdf0e10cSrcweir * Document Interface Access 802cdf0e10cSrcweir */ 803cdf0e10cSrcweir IDocumentDeviceAccess* SwDocShell::getIDocumentDeviceAccess() { return pDoc; } 804cdf0e10cSrcweir const IDocumentSettingAccess* SwDocShell::getIDocumentSettingAccess() const { return pDoc; } 805cdf0e10cSrcweir IDocumentChartDataProviderAccess* SwDocShell::getIDocumentChartDataProviderAccess() { return pDoc; } 806