22#include <osl/diagnose.h>
36#include <com/sun/star/document/UpdateDocMode.hpp>
37#include <com/sun/star/i18n/ScriptType.hpp>
38#include <svx/svxids.hrc>
81#include <officecfg/Office/Common.hxx>
92 OSL_ENSURE(
GetMapUnit() == MapUnit::MapTwip,
"map unit is not twip!" );
93 bool bHTMLTemplSet =
false;
98 bool bWeb =
dynamic_cast< const SwWebDocShell *
>( this ) !=
nullptr;
113 for(
const lang::Locale& rLocale : aLocales)
115 ForbiddenCharacters aForbidden;
116 aAsian.
GetStartEndChars( rLocale, aForbidden.beginLine, aForbidden.endLine);
118 m_xDoc->getIDocumentSettingAccess().setForbiddenCharacters( eLang, aForbidden);
123 m_xDoc->getIDocumentDeviceAccess().setPrintData(*
SW_MOD()->GetPrtOptions(bWeb));
134 static const sal_uInt16 aFontWhich[] =
139 static const sal_uInt16 aFontHeightWhich[] =
145 static const sal_uInt16 aFontIds[] =
153 DefaultFontType::LATIN_TEXT,
154 DefaultFontType::CJK_TEXT,
155 DefaultFontType::CTL_TEXT
157 static const sal_uInt16 aLangTypes[] =
166 sal_uInt16 nFontWhich = aFontWhich[
i];
167 sal_uInt16 nFontId = aFontIds[
i];
168 std::unique_ptr<SvxFontItem> pFontItem;
178 aFont = pPrt->GetFontMetric( aFont );
191 eLanguage = eUiLanguage;
197 GetDefaultFontFlags::OnlyOne );
201 m_xDoc->SetDefault(*pFontItem);
219 sal_uInt16 aFontIdPoolId[] =
239 sal_uInt8 nLimit = bDisableBuiltinStyles ? 0 : 24;
240 for(
sal_uInt8 nIdx = 0; nIdx < nLimit; nIdx += 2)
257 sEntry = pStdFont->
GetFontFor(aFontIdPoolId[nIdx]);
261 aFont = pPrt->GetFontMetric( aFont );
263 pColl =
m_xDoc->getIDocumentStylePoolAccess().GetTextCollFromPool(aFontIdPoolId[nIdx + 1]);
264 if( !bHTMLTemplSet ||
266 nFontWhich,
false ) )
272 sal_Int32 nFontHeight = pStdFont->
GetFontHeight(
static_cast< sal_Int8 >(aFontIdPoolId[nIdx]), 0, eLanguage );
276 pColl =
m_xDoc->getIDocumentStylePoolAccess().GetTextCollFromPool(aFontIdPoolId[nIdx + 1]);
278 if(aFontHeight.
GetHeight() != sal::static_int_cast<sal_uInt32, sal_Int32>(nFontHeight))
289 SW_MOD()->GetUsrPref( bWeb )->IsAlignMathObjectsToBaseline() );
295 if( !bHTMLTemplSet &&
311 m_xDoc->getIDocumentState().ResetModified();
319 , m_IsInUpdateFontList(false)
320 , m_pStyleManager(new
svx::CommonStyleManager(*this))
322 , m_pWrtShell(nullptr)
323 , m_nUpdateDocMode(document::UpdateDocMode::ACCORDING_TO_CONFIG)
324 , m_IsATemplate(false)
325 , m_IsRemovedInvisibleContent(false)
333 , m_IsInUpdateFontList(false)
334 , m_pStyleManager(new
svx::CommonStyleManager(*this))
336 , m_pWrtShell(nullptr)
337 , m_nUpdateDocMode(document::UpdateDocMode::ACCORDING_TO_CONFIG)
338 , m_IsATemplate(false)
339 , m_IsRemovedInvisibleContent(false)
348 , m_IsInUpdateFontList(false)
349 , m_pStyleManager(new
svx::CommonStyleManager(*this))
351 , m_pWrtShell(nullptr)
352 , m_nUpdateDocMode(document::UpdateDocMode::ACCORDING_TO_CONFIG)
353 , m_IsATemplate(false)
354 , m_IsRemovedInvisibleContent(false)
365 m_xDoc->getIDocumentChartDataProviderAccess().GetChartControllerHelper().Disconnect();
403 m_xDoc->SetDocShell(
this );
404 uno::Reference< text::XTextDocument > xDoc(
GetBaseModel(), uno::UNO_QUERY);
419 OSL_ENSURE(
m_xDoc,
"No Doc no FontList");
432 uno::Reference< text::XTextDocument > xDoc(
GetBaseModel(), uno::UNO_QUERY);
442 m_xDoc->SetDocShell(
nullptr );
449 uno::Reference< text::XTextDocument > xDoc(
GetBaseModel(), uno::UNO_QUERY);
455 uno::Reference< text::XTextDocument > xDoc(
GetBaseModel(), uno::UNO_QUERY);
469 SAL_INFO(
"sw.ui",
"after SfxInPlaceObject::Load" );
480 if (
m_xDoc->getIDocumentDrawModelAccess().GetDrawModel())
481 m_xDoc->getIDocumentDrawModelAccess().GetDrawModel()->SetAnchoredTextOverflowLegacy(
487 OSL_ENSURE( !
m_xBasePool.is(),
"who hasn't destroyed their Pool?" );
491 const SfxUInt16Item* pUpdateDocItem = SfxItemSet::GetItem<SfxUInt16Item>(rMedium.
GetItemSet(), SID_UPDATEDOCMODE,
false);
495 SwWait aWait( *
this,
true );
499 case SfxObjectCreateMode::ORGANIZER:
511 case SfxObjectCreateMode::INTERNAL:
512 case SfxObjectCreateMode::EMBEDDED:
517 SW_MOD()->SetEmbeddedLoadSave(
true );
520 case SfxObjectCreateMode::STANDARD:
526 SAL_INFO(
"sw.ui",
"before ReadDocInfo" );
529 nErr = aRdr.
Read( *pReader );
534 if(
dynamic_cast< const SwWebDocShell *
>(
this ) !=
nullptr )
549 OSL_ENSURE(
false,
"Load: new CreateMode?" );
559 if (bRet && !
m_xDoc->IsInLoadAsynchron() &&
566 SW_MOD()->SetEmbeddedLoadSave(
false );
582 OUString aStreamName =
"styles.xml";
583 uno::Reference < container::XNameAccess > xAccess = rMedium.
GetStorage();
584 if ( xAccess->hasByName( aStreamName ) && rMedium.
GetStorage()->isStreamElement( aStreamName ) )
587 SwWait aWait( *
this,
true );
589 OSL_ENSURE( !
m_xBasePool.is(),
"who hasn't destroyed their Pool?" );
602 OSL_FAIL(
"Code removed!");
611 m_xDoc->getIDocumentState().ResetModified();
617 OSL_ENSURE( !
m_xBasePool.is(),
"who hasn't destroyed their Pool?" );
625 bool bWeb =
dynamic_cast< const SwWebDocShell *
>( this ) !=
nullptr;
664 aDfltSet.
Put( aHyp );
673 m_xDoc->SetDefault( aDfltSet );
678 bool bSquaredPageMode =
SW_MOD()->GetUsrPref(
false)->IsSquaredPageMode();
679 m_xDoc->SetDefaultPageMode( bSquaredPageMode );
689 m_xDoc->getIDocumentState().ResetModified();
697 return m_xDoc->getIDocumentDeviceAccess();
702 return m_xDoc->getIDocumentChartDataProviderAccess();
@ MATH_BASELINE_ALIGNMENT
@ FOOTNOTE_IN_COLUMN_TO_PAGEEND
const LanguageTag & GetUILanguageTag() const
static const AllSettings & GetSettings()
sal_uInt16 GetValue() const
Give access to the data-provider for chart.
Provides access to the formatting devices of a document.
virtual void set(DocumentSettingId id, bool value)=0
Set the specified document setting.
LanguageType getLanguageType(bool bResolveSystem=true) const
static LanguageType convertToLanguageType(const css::lang::Locale &rLocale, bool bResolveSystem=true)
static LanguageType resolveSystemLanguageByScriptType(LanguageType nLang, sal_Int16 nType)
static bool isKorean(LanguageType nLang)
static vcl::Font GetDefaultFont(DefaultFontType nType, LanguageType eLang, GetDefaultFontFlags nFlags, const OutputDevice *pOutDev=nullptr)
void SetOrganizerMode(bool bSet)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
void EndListening(SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
SfxItemSet * GetItemSet() const
css::uno::Reference< css::embed::XStorage > GetStorage(bool bCreateTempFile=true)
virtual bool InitNew(const css::uno::Reference< css::embed::XStorage > &xStorage)
void SetError(ErrCode rErr)
virtual bool LoadFrom(SfxMedium &rMedium)
virtual bool Load(SfxMedium &rMedium)
MapUnit GetMapUnit() const
static bool IsOwnStorageFormat(const SfxMedium &)
virtual void Invalidate(sal_uInt16 nId=0) override
void SetMapUnit(MapUnit nMUnit)
void SetAutoStyleFilterIndex(sal_uInt16 nSet)
SfxMedium * GetMedium() const
css::uno::Reference< css::frame::XModel3 > GetBaseModel() const
SfxObjectCreateMode GetCreateMode() const
virtual comphelper::EmbeddedObjectContainer & getEmbeddedObjectContainer() const override
void SetBaseModel(SfxBaseModel *pModel)
void PutItem(const SfxPoolItem &rItem)
SfxItemPool & GetPool() const
void SetPool(SfxItemPool *pNewPool)
void GetOptions(SvtLinguOptions &rOptions) const
CharCompressType GetCharDistanceCompression() const
bool GetStartEndChars(css::lang::Locale const &locale, OUString &startChars, OUString &endChars) const
css::uno::Sequence< css::lang::Locale > GetStartEndCharLocales() const
bool IsKerningWesternTextOnly() const
sal_uInt32 GetHeight() const
void SetHeight(sal_uInt32 nNewHeight, const sal_uInt16 nNewProp=100, MapUnit eUnit=MapUnit::MapRelative)
sal_uInt8 & GetMinWordLength()
sal_uInt8 & GetMinTrail()
LanguageType GetLanguage() const
virtual void SAL_CALL dispose() override
SwDoc & GetDoc()
Document is created after calling Read(...).
IDocumentChartDataProviderAccess & getIDocumentChartDataProviderAccess()
rtl::Reference< SwDoc > m_xDoc
Document.
rtl::Reference< SfxStyleSheetBasePool > m_xBasePool
Passing through for formats.
std::unique_ptr< comphelper::EmbeddedObjectContainer > m_pOLEChildList
bool m_IsInUpdateFontList
prevent nested calls of UpdateFontList
virtual ~SwDocShell() override
virtual SAL_DLLPRIVATE bool Load(SfxMedium &rMedium) override
SAL_DLLPRIVATE void RemoveLink()
IDocumentDeviceAccess & getIDocumentDeviceAccess()
SwDocShell(SfxObjectCreateMode eMode=SfxObjectCreateMode::EMBEDDED)
Doc is required for SO data exchange!
sal_Int16 m_nUpdateDocMode
contains the css::document::UpdateDocMode
SAL_DLLPRIVATE void SubInitNew()
for InitNew and HtmlSourceMode.
SAL_DLLPRIVATE void AddLink()
Methods for access to doc.
std::unique_ptr< FontList > m_pFontList
Current Fontlist.
void LoadingFinished()
linked graphics are now loaded on demand.
SAL_DLLPRIVATE void Init_Impl()
virtual SAL_DLLPRIVATE bool InitNew(const css::uno::Reference< css::embed::XStorage > &xStorage) override
FileIO.
virtual SAL_DLLPRIVATE bool LoadFrom(SfxMedium &rMedium) override
SwDoc * GetDoc()
returns Doc. But be careful!
IDocumentSettingAccess const & getIDocumentSettingAccess() const
ErrCode Read(const Reader &)
sal_Int32 GetFontHeight(sal_uInt8 nFont, sal_uInt8 nScriptType, LanguageType eLang)
static sal_Int32 GetDefaultHeightFor(sal_uInt16 nFontType, LanguageType eLang)
const OUString & GetFontFor(sal_uInt16 nFontType) const
bool IsFontDefault(sal_uInt16 nFontType) const
Represents the style of a paragraph.
virtual bool ResetFormatAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0) override
virtual bool SetFormatAttr(const SfxPoolItem &rAttr) override
Override to recognize changes on the <SwNumRuleItem> and register/unregister the paragragh style at t...
static void InitOle(SfxObjectShell *pDoc)
void setUserAllowsLinkUpdate(bool bNew)
FontFamily GetFamilyType()
const OUString & GetFamilyName() const
rtl_TextEncoding GetCharSet() const
constexpr ::Color COL_AUTO(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
void InitDrawModelAndDocShell(SwDocShell *pSwDocShell, SwDrawModel *pSwDrawDocument)
#define FONT_STANDARD_CTL
#define FONT_STANDARD_CJK
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_CTL_FONTSIZE(28)
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_CJK_FONT(22)
constexpr TypedWhichId< SvxAutoKernItem > RES_CHRATR_AUTOKERN(17)
constexpr TypedWhichId< SfxBoolItem > RES_COLLAPSING_BORDERS(124)
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_FONTSIZE(8)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_LANGUAGE(10)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CTL_LANGUAGE(29)
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_CJK_FONTSIZE(23)
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_CTL_FONT(27)
constexpr TypedWhichId< SvxHyphenZoneItem > RES_PARATR_HYPHENZONE(69)
constexpr TypedWhichId< SvxAdjustItem > RES_PARATR_ADJUST(64)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CJK_LANGUAGE(24)
constexpr TypedWhichId< SvxTabStopItem > RES_PARATR_TABSTOP(68)
constexpr TypedWhichId< SvxOrphansItem > RES_PARATR_ORPHANS(66)
constexpr TypedWhichId< SvxWidowsItem > RES_PARATR_WIDOWS(67)
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_FONT(7)
constexpr TypedWhichId< SvxColorItem > RES_CHRATR_COLOR(3)
LanguageType GetAppLanguage()
#define LINK(Instance, Class, Member)
#define SAL_INFO(area, stream)
constexpr auto toTwips(N number, Length from)
static constexpr auto Items
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
SvxFrameDirection GetDefaultFrameDirection(LanguageType nLanguage)
Return the AutoCollection by its Id.
@ RES_POOLCOLL_STANDARD
Standard.
@ RES_POOLCOLL_REGISTER_BASE
Base index.
@ RES_POOLCOLL_LABEL
Subgroup labels.
@ RES_POOLCOLL_NUMBER_BULLET_BASE
Base list.
@ RES_POOLCOLL_HEADLINE_BASE
Subgroup headings.
bool SetHTMLTemplate(SwDoc &rDoc)
LanguageType nDefaultLanguage
LanguageType nDefaultLanguage_CTL
LanguageType nDefaultLanguage_CJK
sal_Int16 nHyphMinTrailing
sal_Int16 nHyphMinLeading
sal_Int16 nHyphMinWordLength
#define ERR_SWG_READ_ERROR