/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
pFontItem.reset(new SvxFontItem(aFont.GetFamilyTypeMaybeAskConfig(), aFont.GetFamilyName(),
OUString(), aFont.GetPitchMaybeAskConfig(), aFont.GetCharSet(), nFontWhich));
} else
{ // #107782# OJ use korean language if latin was used if ( i == 0 )
{
LanguageType eUiLanguage = Application::GetSettings().GetUILanguageTag().getLanguageType(); if (MsLangId::isKorean(eUiLanguage))
eLanguage = eUiLanguage;
}
// the default for documents created via 'File/New' should be 'on' // (old documents, where this property was not yet implemented, will get the // value 'false' in the SwDoc c-tor)
m_xDoc->getIDocumentSettingAccess().set( DocumentSettingId::MATH_BASELINE_ALIGNMENT,
mod->GetUsrPref( bWeb )->IsAlignMathObjectsToBaseline() );
m_xDoc->getIDocumentSettingAccess().set( DocumentSettingId::FOOTNOTE_IN_COLUMN_TO_PAGEEND, true);
}
/* #106748# If the default frame direction of a document is RTL
the default adjustment is to the right. */ if( !bHTMLTemplSet &&
SvxFrameDirection::Horizontal_RL_TB == GetDefaultFrameDirection(GetAppLanguage()) )
{
m_xDoc->SetDefault( SvxAdjustItem(SvxAdjust::Right, RES_PARATR_ADJUST ) );
}
//#i16874# AutoKerning as default for new documents
m_xDoc->SetDefault( SvxAutoKernItem( true, RES_CHRATR_AUTOKERN ) );
// #i42080# - Due to the several calls of method <SetDefault(..)> // at the document instance, the document is modified. Thus, reset this // status here. Note: In method <SubInitNew()> this is also done.
m_xDoc->getIDocumentState().ResetModified();
// Dtor
SwDocShell::~SwDocShell()
{ // disable chart related objects now because in ~SwDoc it may be too late for this if (m_xDoc)
{
m_xDoc->getIDocumentChartDataProviderAccess().GetChartControllerHelper().Disconnect();
SwChartDataProvider *pPCD = m_xDoc->getIDocumentChartDataProviderAccess().GetChartDataProvider(); if (pPCD)
pPCD->dispose();
}
RemoveLink();
m_pFontList.reset();
// we, as BroadCaster also become our own Listener // (for DocInfo/FileNames/...)
EndListening( *this );
m_pOLEChildList.reset();
}
void SwDocShell::Init_Impl()
{
SetPool(&SwModule::get()->GetPool());
SetBaseModel(new SwXTextDocument(this)); // we, as BroadCaster also become our own Listener // (for DocInfo/FileNames/...)
StartListening( *this ); //position of the "Automatic" style filter for the stylist (app.src)
SetAutoStyleFilterIndex(3);
// set map unit to twip
SetMapUnit( MapUnit::MapTwip );
}
void SwDocShell::AddLink()
{ if (!m_xDoc)
{
SwDocFac aFactory;
m_xDoc = &aFactory.GetDoc();
m_xDoc->getIDocumentSettingAccess().set(DocumentSettingId::HTML_MODE, dynamic_cast< const SwWebDocShell *>( this ) != nullptr );
}
m_xDoc->SetDocShell( this ); // set the DocShell-Pointer for Doc
rtl::Reference< SwXTextDocument > xDoc(GetBaseModel());
xDoc->Reactivate(this);
SetPool(&m_xDoc->GetAttrPool());
// most suitably not until a sdbcx::View is created!!!
m_xDoc->SetOle2Link(LINK(this, SwDocShell, Ole2ModifiedHdl));
}
// create new FontList Change Printer void SwDocShell::UpdateFontList()
{ if (!m_IsInUpdateFontList)
{
m_IsInUpdateFontList = true;
OSL_ENSURE(m_xDoc, "No Doc no FontList"); if (m_xDoc)
{
m_pFontList.reset( new FontList( m_xDoc->getIDocumentDeviceAccess().getReferenceDevice(true) ) );
PutItem( SvxFontListItem( m_pFontList.get(), SID_ATTR_CHAR_FONTLIST ) );
}
m_IsInUpdateFontList = false;
}
}
if (SfxObjectShell::Load(rMedium))
{
comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer = getEmbeddedObjectContainer();
rEmbeddedObjectContainer.setUserAllowsLinkUpdate(false);
SAL_INFO( "sw.ui", "after SfxInPlaceObject::Load" ); if (m_xDoc) // for last version!!
RemoveLink(); // release the existing
AddLink(); // set Link and update Data!!
// Define some settings for legacy ODF files that have different default values now // (if required, they will be overridden later when settings will be read) if (IsOwnStorageFormat(rMedium))
{
SwDrawModel* pDrawModel = m_xDoc->getIDocumentDrawModelAccess().GetDrawModel(); if (pDrawModel)
{
pDrawModel->SetCompatibilityFlag(SdrCompatibilityFlag::AnchoredTextOverflowLegacy, true); // legacy processing for tdf#99729
pDrawModel->SetCompatibilityFlag(SdrCompatibilityFlag::LegacyFontwork, true); // legacy processing for tdf#148000
}
}
case SfxObjectCreateMode::INTERNAL: case SfxObjectCreateMode::EMBEDDED:
{
SwTransferable::InitOle( this );
} // suppress SfxProgress, when we are Embedded
mod->SetEmbeddedLoadSave( true );
[[fallthrough]];
case SfxObjectCreateMode::STANDARD:
{
Reader *pReader = ReadXML; if( pReader )
{ // set Doc's DocInfo at DocShell-Medium
SAL_INFO( "sw.ui", "before ReadDocInfo" );
SwReader aRdr(rMedium, OUString(), m_xDoc.get());
SAL_INFO( "sw.ui", "before Read" );
nErr = aRdr.Read( *pReader );
SAL_INFO( "sw.ui", "after Read" ); // If a XML document is loaded, the global doc/web doc // flags have to be set, because they aren't loaded // by this formats. if( dynamic_cast< const SwWebDocShell *>( this ) != nullptr )
{ if (!m_xDoc->getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE))
m_xDoc->getIDocumentSettingAccess().set(DocumentSettingId::HTML_MODE, true);
} if( dynamic_cast< const SwGlobalDocShell *>( this ) != nullptr )
{ if (!m_xDoc->getIDocumentSettingAccess().get(DocumentSettingId::GLOBAL_DOCUMENT))
m_xDoc->getIDocumentSettingAccess().set(DocumentSettingId::GLOBAL_DOCUMENT, true);
}
}
} break;
default:
OSL_ENSURE( false, "Load: new CreateMode?" );
}
//default page mode for text grid if(!bWeb)
{ bool bSquaredPageMode = SwModule::get()->GetUsrPref(false)->IsSquaredPageMode();
m_xDoc->SetDefaultPageMode( bSquaredPageMode );
// only set Widow/Orphan defaults on a new, non-web document - not an opened one if (GetMedium() && GetMedium()->GetOrigURL().isEmpty() && !bFuzzing)
{
m_xDoc->SetDefault( SvxWidowsItem( sal_uInt8(2), RES_PARATR_WIDOWS) );
m_xDoc->SetDefault( SvxOrphansItem( sal_uInt8(2), RES_PARATR_ORPHANS) );
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.