22 #include <osl/diagnose.h>
37 #include <com/sun/star/document/UpdateDocMode.hpp>
38 #include <com/sun/star/i18n/ScriptType.hpp>
39 #include <svx/svxids.hrc>
68 #include <fontcfg.hxx>
76 #include <drawdoc.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;
101 else if( dynamic_cast< const SwGlobalDocShell *>(
this ) !=
nullptr )
112 for(
const lang::Locale& rLocale : aLocales)
114 ForbiddenCharacters aForbidden;
115 aAsian.
GetStartEndChars( rLocale, aForbidden.beginLine, aForbidden.endLine);
117 m_xDoc->getIDocumentSettingAccess().setForbiddenCharacters( eLang, aForbidden);
122 m_xDoc->getIDocumentDeviceAccess().setPrintData(*
SW_MOD()->GetPrtOptions(bWeb));
133 static const sal_uInt16 aFontWhich[] =
138 static const sal_uInt16 aFontHeightWhich[] =
144 static const sal_uInt16 aFontIds[] =
152 DefaultFontType::LATIN_TEXT,
153 DefaultFontType::CJK_TEXT,
154 DefaultFontType::CTL_TEXT
156 static const sal_uInt16 aLangTypes[] =
165 sal_uInt16 nFontWhich = aFontWhich[
i];
166 sal_uInt16 nFontId = aFontIds[
i];
167 std::unique_ptr<SvxFontItem> pFontItem;
177 aFont = pPrt->GetFontMetric( aFont );
190 eLanguage = eUiLanguage;
196 GetDefaultFontFlags::OnlyOne );
200 m_xDoc->SetDefault(*pFontItem);
218 sal_uInt16 aFontIdPoolId[] =
237 for(
sal_uInt8 nIdx = 0; nIdx < 24; nIdx += 2)
254 sEntry = pStdFont->
GetFontFor(aFontIdPoolId[nIdx]);
258 aFont = pPrt->GetFontMetric( aFont );
260 pColl =
m_xDoc->getIDocumentStylePoolAccess().GetTextCollFromPool(aFontIdPoolId[nIdx + 1]);
261 if( !bHTMLTemplSet ||
263 nFontWhich,
false ) )
269 sal_Int32 nFontHeight = pStdFont->
GetFontHeight( static_cast< sal_Int8 >(aFontIdPoolId[nIdx]), 0, eLanguage );
273 pColl =
m_xDoc->getIDocumentStylePoolAccess().GetTextCollFromPool(aFontIdPoolId[nIdx + 1]);
275 if(aFontHeight.
GetHeight() != sal::static_int_cast<sal_uInt32, sal_Int32>(nFontHeight))
286 SW_MOD()->GetUsrPref( bWeb )->IsAlignMathObjectsToBaseline() );
291 if( !bHTMLTemplSet &&
307 m_xDoc->getIDocumentState().ResetModified();
315 , m_IsInUpdateFontList(false)
316 , m_pStyleManager(new
svx::CommonStyleManager(*this))
318 , m_pWrtShell(nullptr)
319 , m_nUpdateDocMode(
document::UpdateDocMode::ACCORDING_TO_CONFIG)
320 , m_IsATemplate(false)
321 , m_IsRemovedInvisibleContent(false)
329 , m_IsInUpdateFontList(false)
330 , m_pStyleManager(new
svx::CommonStyleManager(*this))
332 , m_pWrtShell(nullptr)
333 , m_nUpdateDocMode(
document::UpdateDocMode::ACCORDING_TO_CONFIG)
334 , m_IsATemplate(false)
335 , m_IsRemovedInvisibleContent(false)
344 , m_IsInUpdateFontList(false)
345 , m_pStyleManager(new
svx::CommonStyleManager(*this))
347 , m_pWrtShell(nullptr)
348 , m_nUpdateDocMode(
document::UpdateDocMode::ACCORDING_TO_CONFIG)
349 , m_IsATemplate(false)
350 , m_IsRemovedInvisibleContent(false)
361 m_xDoc->getIDocumentChartDataProviderAccess().GetChartControllerHelper().Disconnect();
399 m_xDoc->SetDocShell(
this );
400 uno::Reference< text::XTextDocument > xDoc(
GetBaseModel(), uno::UNO_QUERY);
415 OSL_ENSURE(
m_xDoc,
"No Doc no FontList");
428 uno::Reference< text::XTextDocument > xDoc(
GetBaseModel(), uno::UNO_QUERY);
438 m_xDoc->SetDocShell(
nullptr );
445 uno::Reference< text::XTextDocument > xDoc(
GetBaseModel(), uno::UNO_QUERY);
451 uno::Reference< text::XTextDocument > xDoc(
GetBaseModel(), uno::UNO_QUERY);
465 SAL_INFO(
"sw.ui",
"after SfxInPlaceObject::Load" );
476 if (
m_xDoc->getIDocumentDrawModelAccess().GetDrawModel())
477 m_xDoc->getIDocumentDrawModelAccess().GetDrawModel()->SetAnchoredTextOverflowLegacy(
483 OSL_ENSURE( !
m_xBasePool.is(),
"who hasn't destroyed their Pool?" );
487 const SfxUInt16Item* pUpdateDocItem = SfxItemSet::GetItem<SfxUInt16Item>(rMedium.
GetItemSet(), SID_UPDATEDOCMODE,
false);
491 SwWait aWait( *
this,
true );
495 case SfxObjectCreateMode::ORGANIZER:
507 case SfxObjectCreateMode::INTERNAL:
508 case SfxObjectCreateMode::EMBEDDED:
513 SW_MOD()->SetEmbeddedLoadSave(
true );
516 case SfxObjectCreateMode::STANDARD:
522 SAL_INFO(
"sw.ui",
"before ReadDocInfo" );
525 nErr = aRdr.Read( *pReader );
526 SAL_INFO(
"sw.ui",
"after Read" );
530 if( dynamic_cast< const SwWebDocShell *>(
this ) !=
nullptr )
535 if( dynamic_cast< const SwGlobalDocShell *>(
this ) !=
nullptr )
545 OSL_ENSURE(
false,
"Load: new CreateMode?" );
555 if (bRet && !
m_xDoc->IsInLoadAsynchron() &&
562 SW_MOD()->SetEmbeddedLoadSave(
false );
578 OUString aStreamName =
"styles.xml";
579 uno::Reference < container::XNameAccess > xAccess = rMedium.
GetStorage();
580 if ( xAccess->hasByName( aStreamName ) && rMedium.
GetStorage()->isStreamElement( aStreamName ) )
583 SwWait aWait( *
this,
true );
585 OSL_ENSURE( !
m_xBasePool.is(),
"who hasn't destroyed their Pool?" );
598 OSL_FAIL(
"Code removed!");
607 m_xDoc->getIDocumentState().ResetModified();
613 OSL_ENSURE( !
m_xBasePool.is(),
"who hasn't destroyed their Pool?" );
621 bool bWeb =
dynamic_cast< const SwWebDocShell *
>( this ) !=
nullptr;
623 sal_uInt16 nRange[] = {
654 aHyp.GetMinTrail() =
static_cast< sal_uInt8 >(aLinguOpt.nHyphMinTrailing);
656 aDfltSet.Put( aHyp );
658 sal_uInt16 nNewPos =
static_cast< sal_uInt16
>(
convertMm100ToTwip(
SW_MOD()->GetUsrPref(
false)->GetDefTabInMm100()));
665 m_xDoc->SetDefault( aDfltSet );
670 bool bSquaredPageMode =
SW_MOD()->GetUsrPref(
false)->IsSquaredPageMode();
671 m_xDoc->SetDefaultPageMode( bSquaredPageMode );
681 m_xDoc->getIDocumentState().ResetModified();
689 return m_xDoc->getIDocumentDeviceAccess();
694 return m_xDoc->getIDocumentChartDataProviderAccess();
#define LINK(Instance, Class, Member)
static vcl::Font GetDefaultFont(DefaultFontType nType, LanguageType eLang, GetDefaultFontFlags nFlags, const OutputDevice *pOutDev=nullptr)
SAL_DLLPRIVATE void SubInitNew()
for InitNew and HtmlSourceMode.
Represents the style of a paragraph.
constexpr TypedWhichId< SvxTabStopItem > RES_PARATR_TABSTOP(68)
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_CTL_FONT(27)
const OUString & GetFamilyName() const
bool IsKerningWesternTextOnly() const
#define FONT_STANDARD_CJK
virtual bool Load(SfxMedium &rMedium)
const LanguageTag & GetUILanguageTag() const
LanguageType getLanguageType(bool bResolveSystem=true) const
std::unique_ptr< comphelper::EmbeddedObjectContainer > m_pOLEChildList
static LanguageType convertToLanguageType(const css::lang::Locale &rLocale, bool bResolveSystem=true)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_LANGUAGE(10)
static const AllSettings & GetSettings()
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_FONTSIZE(8)
constexpr::Color COL_AUTO(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
sal_uInt16 GetValue() const
void SetHeight(sal_uInt32 nNewHeight, const sal_uInt16 nNewProp=100, MapUnit eUnit=MapUnit::MapRelative)
void SetOrganizerMode(bool bSet)
static LanguageType resolveSystemLanguageByScriptType(LanguageType nLang, sal_Int16 nType)
constexpr TypedWhichId< SvxAutoKernItem > RES_CHRATR_AUTOKERN(17)
virtual SAL_DLLPRIVATE bool LoadFrom(SfxMedium &rMedium) override
virtual bool SetFormatAttr(const SfxPoolItem &rAttr) override
Override to recognize changes on the and register/unregister the paragragh style at t...
void LoadingFinished()
linked graphics are now loaded on demand.
sal_Int32 GetFontHeight(sal_uInt8 nFont, sal_uInt8 nScriptType, LanguageType eLang)
void PutItem(const SfxPoolItem &rItem)
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_FONT(7)
FontFamily GetFamilyType()
static bool IsOwnStorageFormat(const SfxMedium &)
virtual void set(DocumentSettingId id, bool value)=0
Set the specified document setting.
virtual ~SwDocShell() override
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CTL_LANGUAGE(29)
SfxObjectCreateMode GetCreateMode() const
virtual void SAL_CALL dispose() override
SAL_DLLPRIVATE void Init_Impl()
css::uno::Reference< css::frame::XModel > GetBaseModel() const
SfxItemPool & GetPool() const
constexpr TypedWhichId< SvxHyphenZoneItem > RES_PARATR_HYPHENZONE(69)
#define SAL_N_ELEMENTS(arr)
bool GetStartEndChars(css::lang::Locale const &locale, OUString &startChars, OUString &endChars) const
SwDoc * GetDoc()
returns Doc. But be careful!
SwDocShell(SfxObjectCreateMode eMode=SfxObjectCreateMode::EMBEDDED)
Doc is required for SO data exchange!
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
bool IsFontDefault(sal_uInt16 nFontType) const
CharCompressType GetCharDistanceCompression() const
void GetOptions(SvtLinguOptions &rOptions) const
void InitDrawModelAndDocShell(SwDocShell *pSwDocShell, SwDrawModel *pSwDrawDocument)
SAL_DLLPRIVATE void RemoveLink()
virtual SAL_DLLPRIVATE bool InitNew(const css::uno::Reference< css::embed::XStorage > &xStorage) override
FileIO.
void SetAutoStyleFilterIndex(sal_uInt16 nSet)
const OUString & GetFontFor(sal_uInt16 nFontType) const
virtual bool LoadFrom(SfxMedium &rMedium)
constexpr TypedWhichId< SfxBoolItem > RES_COLLAPSING_BORDERS(124)
void SetPool(SfxItemPool *pNewPool)
constexpr auto convertMm100ToTwip(N n)
SfxItemSet * GetItemSet() const
virtual comphelper::EmbeddedObjectContainer & getEmbeddedObjectContainer() const override
rtl::Reference< SwDoc > m_xDoc
Document.
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
std::unique_ptr< FontList > m_pFontList
Current Fontlist.
bool SetHTMLTemplate(SwDoc &rDoc)
virtual bool InitNew(const css::uno::Reference< css::embed::XStorage > &xStorage)
rtl::Reference< SfxStyleSheetBasePool > m_xBasePool
Passing through for formats.
void SetMapUnit(MapUnit nMUnit)
Provides access to the formatting devices of a document.
IDocumentDeviceAccess & getIDocumentDeviceAccess()
constexpr TypedWhichId< SvxColorItem > RES_CHRATR_COLOR(3)
LanguageType GetLanguage() const
static void InitOle(SfxObjectShell *pDoc)
css::uno::Sequence< css::lang::Locale > GetStartEndCharLocales() const
virtual void Invalidate(sal_uInt16 nId=0) override
sal_uInt32 GetHeight() const
constexpr TypedWhichId< SvxOrphansItem > RES_PARATR_ORPHANS(66)
void setUserAllowsLinkUpdate(bool bNew)
exports com.sun.star. document
css::uno::Reference< css::embed::XStorage > GetStorage(bool bCreateTempFile=true)
bool m_IsInUpdateFontList
prevent nested calls of UpdateFontList
IDocumentChartDataProviderAccess & getIDocumentChartDataProviderAccess()
MapUnit GetMapUnit() const
#define SAL_INFO(area, stream)
LanguageType GetAppLanguage()
IDocumentSettingAccess const & getIDocumentSettingAccess() const
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_CJK_FONT(22)
void EndListening(SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
void SetBaseModel(SfxBaseModel *pModel)
virtual SAL_DLLPRIVATE bool Load(SfxMedium &rMedium) override
static bool isKorean(LanguageType nLang)
virtual bool ResetFormatAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0) override
#define FONT_STANDARD_CTL
SvxFrameDirection GetDefaultFrameDirection(LanguageType nLanguage)
Return the AutoCollection by its Id.
#define ERR_SWG_READ_ERROR
sal_Int16 m_nUpdateDocMode
contains the css::document::UpdateDocMode
Give access to the data-provider for chart.
SAL_DLLPRIVATE void AddLink()
Methods for access to doc.
static sal_Int32 GetDefaultHeightFor(sal_uInt16 nFontType, LanguageType eLang)
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_CTL_FONTSIZE(28)
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_CJK_FONTSIZE(23)
void SetError(ErrCode rErr)
constexpr TypedWhichId< SvxAdjustItem > RES_PARATR_ADJUST(64)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CJK_LANGUAGE(24)
constexpr TypedWhichId< SvxWidowsItem > RES_PARATR_WIDOWS(67)
rtl_TextEncoding GetCharSet() const
SwDoc & GetDoc()
Document is created after calling Read(...).
SfxMedium * GetMedium() const