22#include <osl/diagnose.h>
36#include <com/sun/star/document/UpdateDocMode.hpp>
37#include <com/sun/star/i18n/ScriptType.hpp>
39#include <svx/svxids.hrc>
82#include <officecfg/Office/Common.hxx>
93 OSL_ENSURE(
GetMapUnit() == MapUnit::MapTwip,
"map unit is not twip!" );
94 bool bHTMLTemplSet =
false;
99 bool bWeb =
dynamic_cast< const SwWebDocShell *
>( this ) !=
nullptr;
114 for(
const lang::Locale& rLocale : aLocales)
116 ForbiddenCharacters aForbidden;
117 aAsian.
GetStartEndChars( rLocale, aForbidden.beginLine, aForbidden.endLine);
119 m_xDoc->getIDocumentSettingAccess().setForbiddenCharacters( eLang, aForbidden);
124 m_xDoc->getIDocumentDeviceAccess().setPrintData(*
SW_MOD()->GetPrtOptions(bWeb));
135 static const sal_uInt16 aFontWhich[] =
140 static const sal_uInt16 aFontHeightWhich[] =
146 static const sal_uInt16 aFontIds[] =
154 DefaultFontType::LATIN_TEXT,
155 DefaultFontType::CJK_TEXT,
156 DefaultFontType::CTL_TEXT
158 static const sal_uInt16 aLangTypes[] =
167 sal_uInt16 nFontWhich = aFontWhich[
i];
168 sal_uInt16 nFontId = aFontIds[
i];
169 std::unique_ptr<SvxFontItem> pFontItem;
179 aFont = pPrt->GetFontMetric( aFont );
192 eLanguage = eUiLanguage;
198 GetDefaultFontFlags::OnlyOne );
202 m_xDoc->SetDefault(*pFontItem);
220 sal_uInt16 aFontIdPoolId[] =
240 sal_uInt8 nLimit = bDisableBuiltinStyles ? 0 : 24;
241 for(
sal_uInt8 nIdx = 0; nIdx < nLimit; nIdx += 2)
258 sEntry = pStdFont->
GetFontFor(aFontIdPoolId[nIdx]);
262 aFont = pPrt->GetFontMetric( aFont );
264 pColl =
m_xDoc->getIDocumentStylePoolAccess().GetTextCollFromPool(aFontIdPoolId[nIdx + 1]);
265 if( !bHTMLTemplSet ||
267 nFontWhich,
false ) )
273 sal_Int32 nFontHeight = pStdFont->
GetFontHeight(
static_cast< sal_Int8 >(aFontIdPoolId[nIdx]), 0, eLanguage );
277 pColl =
m_xDoc->getIDocumentStylePoolAccess().GetTextCollFromPool(aFontIdPoolId[nIdx + 1]);
279 if(aFontHeight.
GetHeight() != sal::static_int_cast<sal_uInt32, sal_Int32>(nFontHeight))
290 SW_MOD()->GetUsrPref( bWeb )->IsAlignMathObjectsToBaseline() );
296 if( !bHTMLTemplSet &&
312 m_xDoc->getIDocumentState().ResetModified();
320 , m_IsInUpdateFontList(false)
321 , m_pStyleManager(new
svx::CommonStyleManager(*this))
323 , m_pWrtShell(nullptr)
324 , m_nUpdateDocMode(document::UpdateDocMode::ACCORDING_TO_CONFIG)
325 , m_IsATemplate(false)
326 , m_IsRemovedInvisibleContent(false)
334 , m_IsInUpdateFontList(false)
335 , m_pStyleManager(new
svx::CommonStyleManager(*this))
337 , m_pWrtShell(nullptr)
338 , m_nUpdateDocMode(document::UpdateDocMode::ACCORDING_TO_CONFIG)
339 , m_IsATemplate(false)
340 , m_IsRemovedInvisibleContent(false)
349 , m_IsInUpdateFontList(false)
350 , m_pStyleManager(new
svx::CommonStyleManager(*this))
352 , m_pWrtShell(nullptr)
353 , m_nUpdateDocMode(document::UpdateDocMode::ACCORDING_TO_CONFIG)
354 , m_IsATemplate(false)
355 , m_IsRemovedInvisibleContent(false)
366 m_xDoc->getIDocumentChartDataProviderAccess().GetChartControllerHelper().Disconnect();
404 m_xDoc->SetDocShell(
this );
405 uno::Reference< text::XTextDocument > xDoc(
GetBaseModel(), uno::UNO_QUERY);
420 OSL_ENSURE(
m_xDoc,
"No Doc no FontList");
433 uno::Reference< text::XTextDocument > xDoc(
GetBaseModel(), uno::UNO_QUERY);
443 m_xDoc->SetDocShell(
nullptr );
450 uno::Reference< text::XTextDocument > xDoc(
GetBaseModel(), uno::UNO_QUERY);
456 uno::Reference< text::XTextDocument > xDoc(
GetBaseModel(), uno::UNO_QUERY);
470 SAL_INFO(
"sw.ui",
"after SfxInPlaceObject::Load" );
492 OSL_ENSURE( !
m_xBasePool.is(),
"who hasn't destroyed their Pool?" );
500 SwWait aWait( *
this,
true );
504 case SfxObjectCreateMode::ORGANIZER:
516 case SfxObjectCreateMode::INTERNAL:
517 case SfxObjectCreateMode::EMBEDDED:
522 SW_MOD()->SetEmbeddedLoadSave(
true );
525 case SfxObjectCreateMode::STANDARD:
531 SAL_INFO(
"sw.ui",
"before ReadDocInfo" );
534 nErr = aRdr.
Read( *pReader );
539 if(
dynamic_cast< const SwWebDocShell *
>(
this ) !=
nullptr )
554 OSL_ENSURE(
false,
"Load: new CreateMode?" );
564 if (bRet && !
m_xDoc->IsInLoadAsynchron() &&
571 SW_MOD()->SetEmbeddedLoadSave(
false );
587 OUString aStreamName =
"styles.xml";
588 uno::Reference < container::XNameAccess > xAccess = rMedium.
GetStorage();
589 if ( xAccess->hasByName( aStreamName ) && rMedium.
GetStorage()->isStreamElement( aStreamName ) )
592 SwWait aWait( *
this,
true );
594 OSL_ENSURE( !
m_xBasePool.is(),
"who hasn't destroyed their Pool?" );
607 OSL_FAIL(
"Code removed!");
616 m_xDoc->getIDocumentState().ResetModified();
622 OSL_ENSURE( !
m_xBasePool.is(),
"who hasn't destroyed their Pool?" );
630 bool bWeb =
dynamic_cast< const SwWebDocShell *
>( this ) !=
nullptr;
670 aDfltSet.
Put( aHyp );
679 m_xDoc->SetDefault( aDfltSet );
684 bool bSquaredPageMode =
SW_MOD()->GetUsrPref(
false)->IsSquaredPageMode();
685 m_xDoc->SetDefaultPageMode( bSquaredPageMode );
695 m_xDoc->getIDocumentState().ResetModified();
703 return m_xDoc->getIDocumentDeviceAccess();
708 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)
void SetCompatibilityFlag(SdrCompatibilityFlag eFlag, bool bEnabled)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) 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< 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< SfxBoolItem > RES_COLLAPSING_BORDERS(131)
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