1*efeef26fSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*efeef26fSAndrew Rist * distributed with this work for additional information 6*efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*efeef26fSAndrew Rist * "License"); you may not use this file except in compliance 9*efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*efeef26fSAndrew Rist * software distributed under the License is distributed on an 15*efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*efeef26fSAndrew Rist * KIND, either express or implied. See the License for the 17*efeef26fSAndrew Rist * specific language governing permissions and limitations 18*efeef26fSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*efeef26fSAndrew Rist *************************************************************/ 21*efeef26fSAndrew Rist 22*efeef26fSAndrew 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 pDoc->SetDrawDefaults(); 351cdf0e10cSrcweir 352cdf0e10cSrcweir // --> OD 2005-02-10 #i42080# - Due to the several calls of method <SetDefault(..)> 353cdf0e10cSrcweir // at the document instance, the document is modified. Thus, reset this 354cdf0e10cSrcweir // status here. Note: In method <SubInitNew()> this is also done. 355cdf0e10cSrcweir pDoc->ResetModified(); 356cdf0e10cSrcweir // <-- 357cdf0e10cSrcweir 358cdf0e10cSrcweir return bRet; 359cdf0e10cSrcweir } 360cdf0e10cSrcweir 361cdf0e10cSrcweir /*-------------------------------------------------------------------- 362cdf0e10cSrcweir Beschreibung: Ctor mit SfxCreateMode ????? 363cdf0e10cSrcweir --------------------------------------------------------------------*/ 364cdf0e10cSrcweir 365cdf0e10cSrcweir 366cdf0e10cSrcweir SwDocShell::SwDocShell( SfxObjectCreateMode eMode ) : 367cdf0e10cSrcweir SfxObjectShell ( eMode ), 368cdf0e10cSrcweir pDoc(0), 369cdf0e10cSrcweir pFontList(0), 370cdf0e10cSrcweir pView( 0 ), 371cdf0e10cSrcweir pWrtShell( 0 ), 372cdf0e10cSrcweir pOLEChildList( 0 ), 373cdf0e10cSrcweir nUpdateDocMode(document::UpdateDocMode::ACCORDING_TO_CONFIG), 374cdf0e10cSrcweir bInUpdateFontList(false) 375cdf0e10cSrcweir { 376cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::SwDocShell" ); 377cdf0e10cSrcweir Init_Impl(); 378cdf0e10cSrcweir } 379cdf0e10cSrcweir 380cdf0e10cSrcweir /*-------------------------------------------------------------------- 381cdf0e10cSrcweir Beschreibung: Ctor / Dtor 382cdf0e10cSrcweir --------------------------------------------------------------------*/ 383cdf0e10cSrcweir 384cdf0e10cSrcweir 385cdf0e10cSrcweir SwDocShell::SwDocShell( const sal_uInt64 i_nSfxCreationFlags ) : 386cdf0e10cSrcweir SfxObjectShell ( i_nSfxCreationFlags ), 387cdf0e10cSrcweir pDoc(0), 388cdf0e10cSrcweir pFontList(0), 389cdf0e10cSrcweir pView( 0 ), 390cdf0e10cSrcweir pWrtShell( 0 ), 391cdf0e10cSrcweir pOLEChildList( 0 ), 392cdf0e10cSrcweir nUpdateDocMode(document::UpdateDocMode::ACCORDING_TO_CONFIG), 393cdf0e10cSrcweir bInUpdateFontList(false) 394cdf0e10cSrcweir { 395cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::SwDocShell" ); 396cdf0e10cSrcweir Init_Impl(); 397cdf0e10cSrcweir } 398cdf0e10cSrcweir 399cdf0e10cSrcweir /*-------------------------------------------------------------------- 400cdf0e10cSrcweir Beschreibung: Ctor / Dtor 401cdf0e10cSrcweir --------------------------------------------------------------------*/ 402cdf0e10cSrcweir 403cdf0e10cSrcweir 404cdf0e10cSrcweir SwDocShell::SwDocShell( SwDoc *pD, SfxObjectCreateMode eMode ): 405cdf0e10cSrcweir SfxObjectShell ( eMode ), 406cdf0e10cSrcweir pDoc(pD), 407cdf0e10cSrcweir pFontList(0), 408cdf0e10cSrcweir pView( 0 ), 409cdf0e10cSrcweir pWrtShell( 0 ), 410cdf0e10cSrcweir pOLEChildList( 0 ), 411cdf0e10cSrcweir nUpdateDocMode(document::UpdateDocMode::ACCORDING_TO_CONFIG), 412cdf0e10cSrcweir bInUpdateFontList(false) 413cdf0e10cSrcweir { 414cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::SwDocShell" ); 415cdf0e10cSrcweir Init_Impl(); 416cdf0e10cSrcweir } 417cdf0e10cSrcweir 418cdf0e10cSrcweir /*-------------------------------------------------------------------- 419cdf0e10cSrcweir Beschreibung: Dtor 420cdf0e10cSrcweir --------------------------------------------------------------------*/ 421cdf0e10cSrcweir 422cdf0e10cSrcweir 423cdf0e10cSrcweir SwDocShell::~SwDocShell() 424cdf0e10cSrcweir { 425cdf0e10cSrcweir // disable chart related objects now because in ~SwDoc it may be to late for this 426cdf0e10cSrcweir if( pDoc ) 427cdf0e10cSrcweir { 428cdf0e10cSrcweir pDoc->GetChartControllerHelper().Disconnect(); 429cdf0e10cSrcweir SwChartDataProvider *pPCD = pDoc->GetChartDataProvider(); 430cdf0e10cSrcweir if (pPCD) 431cdf0e10cSrcweir pPCD->dispose(); 432cdf0e10cSrcweir } 433cdf0e10cSrcweir 434cdf0e10cSrcweir RemoveLink(); 435cdf0e10cSrcweir delete pFontList; 436cdf0e10cSrcweir 437cdf0e10cSrcweir // wir als BroadCaster werden auch unser eigener Listener 438cdf0e10cSrcweir // (fuer DocInfo/FileNamen/....) 439cdf0e10cSrcweir EndListening( *this ); 440cdf0e10cSrcweir SvxColorTableItem* pColItem = (SvxColorTableItem*)GetItem(SID_COLOR_TABLE); 441cdf0e10cSrcweir // wird nur die DocInfo fuer den Explorer gelesen, ist das Item nicht da 442cdf0e10cSrcweir if(pColItem) 443cdf0e10cSrcweir { 444cdf0e10cSrcweir XColorTable* pTable = pColItem->GetColorTable(); 445cdf0e10cSrcweir // wurde eine neue Table angelegt, muss sie auch geloescht werden. 446cdf0e10cSrcweir if((void*)pTable != (void*)(XColorTable::GetStdColorTable()) ) 447cdf0e10cSrcweir delete pTable; 448cdf0e10cSrcweir } 449cdf0e10cSrcweir 450cdf0e10cSrcweir delete pOLEChildList; 451cdf0e10cSrcweir } 452cdf0e10cSrcweir /* -----------------------------10.09.2001 15:59------------------------------ 453cdf0e10cSrcweir 454cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 455cdf0e10cSrcweir void SwDocShell::Init_Impl() 456cdf0e10cSrcweir { 457cdf0e10cSrcweir SetPool(&SW_MOD()->GetPool()); 458cdf0e10cSrcweir SetBaseModel(new SwXTextDocument(this)); 459cdf0e10cSrcweir // wir als BroadCaster werden auch unser eigener Listener 460cdf0e10cSrcweir // (fuer DocInfo/FileNamen/....) 461cdf0e10cSrcweir StartListening( *this ); 462cdf0e10cSrcweir //position of the "Automatic" style filter for the stylist (app.src) 463cdf0e10cSrcweir SetAutoStyleFilterIndex(3); 464cdf0e10cSrcweir 465cdf0e10cSrcweir // set map unit to twip 466cdf0e10cSrcweir SetMapUnit( MAP_TWIP ); 467cdf0e10cSrcweir } 468cdf0e10cSrcweir /*-------------------------------------------------------------------- 469cdf0e10cSrcweir Beschreibung: AddLink 470cdf0e10cSrcweir --------------------------------------------------------------------*/ 471cdf0e10cSrcweir 472cdf0e10cSrcweir 473cdf0e10cSrcweir void SwDocShell::AddLink() 474cdf0e10cSrcweir { 475cdf0e10cSrcweir if( !pDoc ) 476cdf0e10cSrcweir { 477cdf0e10cSrcweir SwDocFac aFactory; 478cdf0e10cSrcweir pDoc = aFactory.GetDoc(); 479cdf0e10cSrcweir pDoc->acquire(); 480cdf0e10cSrcweir pDoc->set(IDocumentSettingAccess::HTML_MODE, ISA(SwWebDocShell) ); 481cdf0e10cSrcweir } 482cdf0e10cSrcweir else 483cdf0e10cSrcweir pDoc->acquire(); 484cdf0e10cSrcweir pDoc->SetDocShell( this ); // am Doc den DocShell-Pointer setzen 485cdf0e10cSrcweir uno::Reference< text::XTextDocument > xDoc(GetBaseModel(), uno::UNO_QUERY); 486cdf0e10cSrcweir ((SwXTextDocument*)xDoc.get())->Reactivate(this); 487cdf0e10cSrcweir 488cdf0e10cSrcweir SetPool(&pDoc->GetAttrPool()); 489cdf0e10cSrcweir 490cdf0e10cSrcweir // am besten erst wenn eine sdbcx::View erzeugt wird !!! 491cdf0e10cSrcweir pDoc->SetOle2Link(LINK(this, SwDocShell, Ole2ModifiedHdl)); 492cdf0e10cSrcweir } 493cdf0e10cSrcweir 494cdf0e10cSrcweir /*-------------------------------------------------------------------- 495cdf0e10cSrcweir Beschreibung: neue FontList erzeugen Aenderung Drucker 496cdf0e10cSrcweir --------------------------------------------------------------------*/ 497cdf0e10cSrcweir 498cdf0e10cSrcweir 499cdf0e10cSrcweir void SwDocShell::UpdateFontList() 500cdf0e10cSrcweir { 501cdf0e10cSrcweir if(!bInUpdateFontList) 502cdf0e10cSrcweir { 503cdf0e10cSrcweir bInUpdateFontList = true; 504cdf0e10cSrcweir ASSERT(pDoc, "Kein Doc keine FontList"); 505cdf0e10cSrcweir if( pDoc ) 506cdf0e10cSrcweir { 507cdf0e10cSrcweir delete pFontList; 508cdf0e10cSrcweir pFontList = new FontList( pDoc->getReferenceDevice( true ) ); 509cdf0e10cSrcweir PutItem( SvxFontListItem( pFontList, SID_ATTR_CHAR_FONTLIST ) ); 510cdf0e10cSrcweir } 511cdf0e10cSrcweir bInUpdateFontList = false; 512cdf0e10cSrcweir } 513cdf0e10cSrcweir } 514cdf0e10cSrcweir 515cdf0e10cSrcweir /*-------------------------------------------------------------------- 516cdf0e10cSrcweir Beschreibung: RemoveLink 517cdf0e10cSrcweir --------------------------------------------------------------------*/ 518cdf0e10cSrcweir 519cdf0e10cSrcweir 520cdf0e10cSrcweir void SwDocShell::RemoveLink() 521cdf0e10cSrcweir { 522cdf0e10cSrcweir // Uno-Object abklemmen 523cdf0e10cSrcweir uno::Reference< text::XTextDocument > xDoc(GetBaseModel(), uno::UNO_QUERY); 524cdf0e10cSrcweir ((SwXTextDocument*)xDoc.get())->Invalidate(); 525cdf0e10cSrcweir aFinishedTimer.Stop(); 526cdf0e10cSrcweir if(pDoc) 527cdf0e10cSrcweir { 528cdf0e10cSrcweir if( mxBasePool.is() ) 529cdf0e10cSrcweir { 530cdf0e10cSrcweir static_cast<SwDocStyleSheetPool*>(mxBasePool.get())->dispose(); 531cdf0e10cSrcweir mxBasePool.clear(); 532cdf0e10cSrcweir } 533cdf0e10cSrcweir sal_Int8 nRefCt = static_cast< sal_Int8 >(pDoc->release()); 534cdf0e10cSrcweir pDoc->SetOle2Link(Link()); 535cdf0e10cSrcweir pDoc->SetDocShell( 0 ); 536cdf0e10cSrcweir if( !nRefCt ) 537cdf0e10cSrcweir delete pDoc; 538cdf0e10cSrcweir pDoc = 0; // wir haben das Doc nicht mehr !! 539cdf0e10cSrcweir } 540cdf0e10cSrcweir } 541cdf0e10cSrcweir void SwDocShell::InvalidateModel() 542cdf0e10cSrcweir { 543cdf0e10cSrcweir // Uno-Object abklemmen 544cdf0e10cSrcweir uno::Reference< text::XTextDocument > xDoc(GetBaseModel(), uno::UNO_QUERY); 545cdf0e10cSrcweir ((SwXTextDocument*)xDoc.get())->Invalidate(); 546cdf0e10cSrcweir } 547cdf0e10cSrcweir void SwDocShell::ReactivateModel() 548cdf0e10cSrcweir { 549cdf0e10cSrcweir // Uno-Object abklemmen 550cdf0e10cSrcweir uno::Reference< text::XTextDocument > xDoc(GetBaseModel(), uno::UNO_QUERY); 551cdf0e10cSrcweir ((SwXTextDocument*)xDoc.get())->Reactivate(this); 552cdf0e10cSrcweir } 553cdf0e10cSrcweir 554cdf0e10cSrcweir /*-------------------------------------------------------------------- 555cdf0e10cSrcweir Beschreibung: Laden, Default-Format 556cdf0e10cSrcweir --------------------------------------------------------------------*/ 557cdf0e10cSrcweir 558cdf0e10cSrcweir 559cdf0e10cSrcweir sal_Bool SwDocShell::Load( SfxMedium& rMedium ) 560cdf0e10cSrcweir { 561cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::Load" ); 562cdf0e10cSrcweir sal_Bool bRet = sal_False; 563cdf0e10cSrcweir if( SfxObjectShell::Load( rMedium )) 564cdf0e10cSrcweir { 565cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_TRACE( aLog, "after SfxInPlaceObject::Load" ); 566cdf0e10cSrcweir if( pDoc ) // fuer Letzte Version !! 567cdf0e10cSrcweir RemoveLink(); // das existierende Loslassen 568cdf0e10cSrcweir 569cdf0e10cSrcweir AddLink(); // Link setzen und Daten updaten !! 570cdf0e10cSrcweir 571cdf0e10cSrcweir // Das Laden 572cdf0e10cSrcweir // fuer MD 573cdf0e10cSrcweir ASSERT( !mxBasePool.is(), "wer hat seinen Pool nicht zerstoert?" ); 574cdf0e10cSrcweir mxBasePool = new SwDocStyleSheetPool( *pDoc, SFX_CREATE_MODE_ORGANIZER == GetCreateMode() ); 575cdf0e10cSrcweir if(GetCreateMode() != SFX_CREATE_MODE_ORGANIZER) 576cdf0e10cSrcweir { 577cdf0e10cSrcweir SFX_ITEMSET_ARG( rMedium.GetItemSet(), pUpdateDocItem, SfxUInt16Item, SID_UPDATEDOCMODE, sal_False); 578cdf0e10cSrcweir nUpdateDocMode = pUpdateDocItem ? pUpdateDocItem->GetValue() : document::UpdateDocMode::NO_UPDATE; 579cdf0e10cSrcweir } 580cdf0e10cSrcweir 581cdf0e10cSrcweir SwWait aWait( *this, sal_True ); 582cdf0e10cSrcweir sal_uInt32 nErr = ERR_SWG_READ_ERROR; 583cdf0e10cSrcweir switch( GetCreateMode() ) 584cdf0e10cSrcweir { 585cdf0e10cSrcweir // case SFX_CREATE_MODE_INTERNAL: 586cdf0e10cSrcweir // nErr = 0; 587cdf0e10cSrcweir // break; 588cdf0e10cSrcweir 589cdf0e10cSrcweir case SFX_CREATE_MODE_ORGANIZER: 590cdf0e10cSrcweir { 591cdf0e10cSrcweir if( ReadXML ) 592cdf0e10cSrcweir { 593cdf0e10cSrcweir ReadXML->SetOrganizerMode( sal_True ); 594cdf0e10cSrcweir SwReader aRdr( rMedium, aEmptyStr, pDoc ); 595cdf0e10cSrcweir nErr = aRdr.Read( *ReadXML ); 596cdf0e10cSrcweir ReadXML->SetOrganizerMode( sal_False ); 597cdf0e10cSrcweir } 598cdf0e10cSrcweir } 599cdf0e10cSrcweir break; 600cdf0e10cSrcweir 601cdf0e10cSrcweir case SFX_CREATE_MODE_INTERNAL: 602cdf0e10cSrcweir case SFX_CREATE_MODE_EMBEDDED: 603cdf0e10cSrcweir { 604cdf0e10cSrcweir // fuer MWERKS (Mac-Compiler): kann nicht selbststaendig casten 605cdf0e10cSrcweir SwTransferable::InitOle( this, *pDoc ); 606cdf0e10cSrcweir } 607cdf0e10cSrcweir // SfxProgress unterdruecken, wenn man Embedded ist 608cdf0e10cSrcweir SW_MOD()->SetEmbeddedLoadSave( sal_True ); 609cdf0e10cSrcweir // kein break; 610cdf0e10cSrcweir 611cdf0e10cSrcweir case SFX_CREATE_MODE_STANDARD: 612cdf0e10cSrcweir case SFX_CREATE_MODE_PREVIEW: 613cdf0e10cSrcweir { 614cdf0e10cSrcweir Reader *pReader = ReadXML; 615cdf0e10cSrcweir if( pReader ) 616cdf0e10cSrcweir { 617cdf0e10cSrcweir // die DocInfo vom Doc am DocShell-Medium setzen 618cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_TRACE( aLog, "before ReadDocInfo" ); 619cdf0e10cSrcweir SwReader aRdr( rMedium, aEmptyStr, pDoc ); 620cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_TRACE( aLog, "before Read" ); 621cdf0e10cSrcweir nErr = aRdr.Read( *pReader ); 622cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_TRACE( aLog, "after Read" ); 623cdf0e10cSrcweir 624cdf0e10cSrcweir // If a XML document is loaded, the global doc/web doc 625cdf0e10cSrcweir // flags have to be set, because they aren't loaded 626cdf0e10cSrcweir // by this formats. 627cdf0e10cSrcweir if( ISA( SwWebDocShell ) ) 628cdf0e10cSrcweir { 629cdf0e10cSrcweir if( !pDoc->get(IDocumentSettingAccess::HTML_MODE) ) 630cdf0e10cSrcweir pDoc->set(IDocumentSettingAccess::HTML_MODE, true); 631cdf0e10cSrcweir } 632cdf0e10cSrcweir if( ISA( SwGlobalDocShell ) ) 633cdf0e10cSrcweir { 634cdf0e10cSrcweir if( !pDoc->get(IDocumentSettingAccess::GLOBAL_DOCUMENT) ) 635cdf0e10cSrcweir pDoc->set(IDocumentSettingAccess::GLOBAL_DOCUMENT, true); 636cdf0e10cSrcweir } 637cdf0e10cSrcweir } 638cdf0e10cSrcweir #ifdef DBG_UTIL 639cdf0e10cSrcweir else 640cdf0e10cSrcweir ASSERT( !this, "ohne Sw3Reader geht nichts" ); 641cdf0e10cSrcweir #endif 642cdf0e10cSrcweir } 643cdf0e10cSrcweir break; 644cdf0e10cSrcweir 645cdf0e10cSrcweir default: 646cdf0e10cSrcweir ASSERT( !this, "Load: new CreateMode?" ); 647cdf0e10cSrcweir 648cdf0e10cSrcweir } 649cdf0e10cSrcweir 650cdf0e10cSrcweir UpdateFontList(); 651cdf0e10cSrcweir InitDraw(); 652cdf0e10cSrcweir 653cdf0e10cSrcweir SetError( nErr, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); 654cdf0e10cSrcweir bRet = !IsError( nErr ); 655cdf0e10cSrcweir 656cdf0e10cSrcweir // --> OD 2006-11-07 #i59688# 657cdf0e10cSrcweir // // StartFinishedLoading rufen. 658cdf0e10cSrcweir // if( bRet && !pDoc->IsInLoadAsynchron() && 659cdf0e10cSrcweir // GetCreateMode() == SFX_CREATE_MODE_STANDARD ) 660cdf0e10cSrcweir // StartLoadFinishedTimer(); 661cdf0e10cSrcweir if ( bRet && !pDoc->IsInLoadAsynchron() && 662cdf0e10cSrcweir GetCreateMode() == SFX_CREATE_MODE_STANDARD ) 663cdf0e10cSrcweir { 664cdf0e10cSrcweir LoadingFinished(); 665cdf0e10cSrcweir } 666cdf0e10cSrcweir // <-- 667cdf0e10cSrcweir 668cdf0e10cSrcweir // SfxProgress unterdruecken, wenn man Embedded ist 669cdf0e10cSrcweir SW_MOD()->SetEmbeddedLoadSave( sal_False ); 670cdf0e10cSrcweir } 671cdf0e10cSrcweir 672cdf0e10cSrcweir return bRet; 673cdf0e10cSrcweir } 674cdf0e10cSrcweir 675cdf0e10cSrcweir /*-------------------------------------------------------------------- 676cdf0e10cSrcweir Beschreibung: 677cdf0e10cSrcweir --------------------------------------------------------------------*/ 678cdf0e10cSrcweir 679cdf0e10cSrcweir 680cdf0e10cSrcweir sal_Bool SwDocShell::LoadFrom( SfxMedium& rMedium ) 681cdf0e10cSrcweir { 682cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::LoadFrom" ); 683cdf0e10cSrcweir sal_Bool bRet = sal_False; 684cdf0e10cSrcweir if( pDoc ) 685cdf0e10cSrcweir RemoveLink(); 686cdf0e10cSrcweir 687cdf0e10cSrcweir AddLink(); // Link setzen und Daten updaten !! 688cdf0e10cSrcweir 689cdf0e10cSrcweir do { // middle check loop 690cdf0e10cSrcweir sal_uInt32 nErr = ERR_SWG_READ_ERROR; 691cdf0e10cSrcweir //const String& rNm = pStor->GetName(); 692cdf0e10cSrcweir String aStreamName; 693cdf0e10cSrcweir aStreamName = String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM("styles.xml")); 694cdf0e10cSrcweir uno::Reference < container::XNameAccess > xAccess( rMedium.GetStorage(), uno::UNO_QUERY ); 695cdf0e10cSrcweir if ( xAccess->hasByName( aStreamName ) && rMedium.GetStorage()->isStreamElement( aStreamName ) ) 696cdf0e10cSrcweir { 697cdf0e10cSrcweir // Das Laden 698cdf0e10cSrcweir SwWait aWait( *this, sal_True ); 699cdf0e10cSrcweir { 700cdf0e10cSrcweir ASSERT( !mxBasePool.is(), "wer hat seinen Pool nicht zerstoert?" ); 701cdf0e10cSrcweir mxBasePool = new SwDocStyleSheetPool( *pDoc, SFX_CREATE_MODE_ORGANIZER == GetCreateMode() ); 702cdf0e10cSrcweir if( ReadXML ) 703cdf0e10cSrcweir { 704cdf0e10cSrcweir ReadXML->SetOrganizerMode( sal_True ); 705cdf0e10cSrcweir SwReader aRdr( rMedium, aEmptyStr, pDoc ); 706cdf0e10cSrcweir nErr = aRdr.Read( *ReadXML ); 707cdf0e10cSrcweir ReadXML->SetOrganizerMode( sal_False ); 708cdf0e10cSrcweir } 709cdf0e10cSrcweir } 710cdf0e10cSrcweir } 711cdf0e10cSrcweir else 712cdf0e10cSrcweir { 713cdf0e10cSrcweir DBG_ERROR("Code removed!"); 714cdf0e10cSrcweir /* 715cdf0e10cSrcweir //TODO/LATER: looks like some binary stuff?! 716cdf0e10cSrcweir // sollte es sich um eine 2. Vrolage handeln ?? 717cdf0e10cSrcweir if( SvStorage::IsStorageFile( rNm ) ) 718cdf0e10cSrcweir break; 719cdf0e10cSrcweir 720cdf0e10cSrcweir const SfxFilter* pFltr = SwIoSystem::GetFileFilter( rNm, aEmptyStr ); 721cdf0e10cSrcweir if( !pFltr || !pFltr->GetUserData().EqualsAscii( FILTER_SWG )) 722cdf0e10cSrcweir break; 723cdf0e10cSrcweir 724cdf0e10cSrcweir SfxMedium aMed( rNm, STREAM_STD_READ, sal_False ); 725cdf0e10cSrcweir if( 0 == ( nErr = aMed.GetInStream()->GetError() ) ) 726cdf0e10cSrcweir { 727cdf0e10cSrcweir SwWait aWait( *this, sal_True ); 728cdf0e10cSrcweir SwReader aRead( aMed, rNm, pDoc ); 729cdf0e10cSrcweir nErr = aRead.Read( *ReadSwg ); 730cdf0e10cSrcweir } 731cdf0e10cSrcweir */ 732cdf0e10cSrcweir } 733cdf0e10cSrcweir 734cdf0e10cSrcweir SetError( nErr, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); 735cdf0e10cSrcweir bRet = !IsError( nErr ); 736cdf0e10cSrcweir 737cdf0e10cSrcweir } while( sal_False ); 738cdf0e10cSrcweir 739cdf0e10cSrcweir SfxObjectShell::LoadFrom( rMedium ); 740cdf0e10cSrcweir pDoc->ResetModified(); 741cdf0e10cSrcweir return bRet; 742cdf0e10cSrcweir } 743cdf0e10cSrcweir 744cdf0e10cSrcweir 745cdf0e10cSrcweir void SwDocShell::SubInitNew() 746cdf0e10cSrcweir { 747cdf0e10cSrcweir ASSERT( !mxBasePool.is(), "wer hat seinen Pool nicht zerstoert?" ); 748cdf0e10cSrcweir mxBasePool = new SwDocStyleSheetPool( *pDoc, SFX_CREATE_MODE_ORGANIZER == GetCreateMode() ); 749cdf0e10cSrcweir UpdateFontList(); 750cdf0e10cSrcweir InitDraw(); 751cdf0e10cSrcweir 752cdf0e10cSrcweir pDoc->setLinkUpdateMode( GLOBALSETTING ); 753cdf0e10cSrcweir pDoc->setFieldUpdateFlags( AUTOUPD_GLOBALSETTING ); 754cdf0e10cSrcweir 755cdf0e10cSrcweir sal_Bool bWeb = ISA(SwWebDocShell); 756cdf0e10cSrcweir 757cdf0e10cSrcweir sal_uInt16 nRange[] = { 758cdf0e10cSrcweir RES_PARATR_ADJUST, RES_PARATR_ADJUST, 759cdf0e10cSrcweir RES_CHRATR_COLOR, RES_CHRATR_COLOR, 760cdf0e10cSrcweir RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE, 761cdf0e10cSrcweir RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_LANGUAGE, 762cdf0e10cSrcweir RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_LANGUAGE, 763cdf0e10cSrcweir 0, 0, 0 }; 764cdf0e10cSrcweir if(!bWeb) 765cdf0e10cSrcweir { 766cdf0e10cSrcweir nRange[ (sizeof(nRange)/sizeof(nRange[0])) - 3 ] = RES_PARATR_TABSTOP; 767cdf0e10cSrcweir nRange[ (sizeof(nRange)/sizeof(nRange[0])) - 2 ] = RES_PARATR_HYPHENZONE; 768cdf0e10cSrcweir } 769cdf0e10cSrcweir SfxItemSet aDfltSet( pDoc->GetAttrPool(), nRange ); 770cdf0e10cSrcweir 771cdf0e10cSrcweir //! get lingu options without loading lingu DLL 772cdf0e10cSrcweir SvtLinguOptions aLinguOpt; 773cdf0e10cSrcweir 774cdf0e10cSrcweir SvtLinguConfig().GetOptions( aLinguOpt ); 775cdf0e10cSrcweir 776cdf0e10cSrcweir sal_Int16 nVal = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage, ::com::sun::star::i18n::ScriptType::LATIN), 777cdf0e10cSrcweir eCJK = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CJK, ::com::sun::star::i18n::ScriptType::ASIAN), 778cdf0e10cSrcweir eCTL = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CTL, ::com::sun::star::i18n::ScriptType::COMPLEX); 779cdf0e10cSrcweir aDfltSet.Put( SvxLanguageItem( nVal, RES_CHRATR_LANGUAGE ) ); 780cdf0e10cSrcweir aDfltSet.Put( SvxLanguageItem( eCJK, RES_CHRATR_CJK_LANGUAGE ) ); 781cdf0e10cSrcweir aDfltSet.Put( SvxLanguageItem( eCTL, RES_CHRATR_CTL_LANGUAGE ) ); 782cdf0e10cSrcweir 783cdf0e10cSrcweir if(!bWeb) 784cdf0e10cSrcweir { 785cdf0e10cSrcweir SvxHyphenZoneItem aHyp( (SvxHyphenZoneItem&) pDoc->GetDefault( 786cdf0e10cSrcweir RES_PARATR_HYPHENZONE) ); 787cdf0e10cSrcweir aHyp.GetMinLead() = static_cast< sal_uInt8 >(aLinguOpt.nHyphMinLeading); 788cdf0e10cSrcweir aHyp.GetMinTrail() = static_cast< sal_uInt8 >(aLinguOpt.nHyphMinTrailing); 789cdf0e10cSrcweir 790cdf0e10cSrcweir aDfltSet.Put( aHyp ); 791cdf0e10cSrcweir 792cdf0e10cSrcweir sal_uInt16 nNewPos = static_cast< sal_uInt16 >(SW_MOD()->GetUsrPref(sal_False)->GetDefTab()); 793cdf0e10cSrcweir if( nNewPos ) 794cdf0e10cSrcweir aDfltSet.Put( SvxTabStopItem( 1, nNewPos, 795cdf0e10cSrcweir SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP ) ); 796cdf0e10cSrcweir } 797cdf0e10cSrcweir aDfltSet.Put( SvxColorItem( Color( COL_AUTO ), RES_CHRATR_COLOR ) ); 798cdf0e10cSrcweir 799cdf0e10cSrcweir pDoc->SetDefault( aDfltSet ); 800cdf0e10cSrcweir 801cdf0e10cSrcweir //default page mode for text grid 802cdf0e10cSrcweir if(!bWeb) 803cdf0e10cSrcweir { 804cdf0e10cSrcweir sal_Bool bSquaredPageMode = SW_MOD()->GetUsrPref(sal_False)->IsSquaredPageMode(); 805cdf0e10cSrcweir pDoc->SetDefaultPageMode( bSquaredPageMode ); 806cdf0e10cSrcweir } 807cdf0e10cSrcweir 808cdf0e10cSrcweir pDoc->ResetModified(); 809cdf0e10cSrcweir } 810cdf0e10cSrcweir 811cdf0e10cSrcweir /* 812cdf0e10cSrcweir * Document Interface Access 813cdf0e10cSrcweir */ 814cdf0e10cSrcweir IDocumentDeviceAccess* SwDocShell::getIDocumentDeviceAccess() { return pDoc; } 815cdf0e10cSrcweir const IDocumentSettingAccess* SwDocShell::getIDocumentSettingAccess() const { return pDoc; } 816cdf0e10cSrcweir IDocumentChartDataProviderAccess* SwDocShell::getIDocumentChartDataProviderAccess() { return pDoc; } 817