diff options
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/uibase/utlui/uitool.cxx | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/sw/source/uibase/utlui/uitool.cxx b/sw/source/uibase/utlui/uitool.cxx index b971dc95bb2c..7f6432dbbf1d 100644 --- a/sw/source/uibase/utlui/uitool.cxx +++ b/sw/source/uibase/utlui/uitool.cxx @@ -43,6 +43,8 @@ #include <com/sun/star/util/XURLTransformer.hpp> #include <comphelper/processfactory.hxx> #include <sfx2/viewfrm.hxx> +#include <sfx2/docfile.hxx> +#include <sfx2/docfilt.hxx> #include <fmtornt.hxx> #include <tabcol.hxx> #include <fmtfsize.hxx> @@ -282,7 +284,8 @@ void ItemSetToPageDesc( const SfxItemSet& rSet, SwPageDesc& rPageDesc ) { rMaster.SetFormatAttr(SfxBoolItem(RES_BACKGROUND_FULL_SIZE, bValue)); } - if (pGrabBag->GetGrabBag().find("RtlGutter")->second >>= bValue) + auto it = pGrabBag->GetGrabBag().find("RtlGutter"); + if (it != pGrabBag->GetGrabBag().end() && (it->second >>= bValue)) { rMaster.SetFormatAttr(SfxBoolItem(RES_RTL_GUTTER, bValue)); } @@ -425,6 +428,27 @@ void ItemSetToPageDesc( const SfxItemSet& rSet, SwPageDesc& rPageDesc ) } } +namespace +{ +bool IsOwnFormat(const SwDoc& rDoc) +{ + const SwDocShell* pDocShell = rDoc.GetDocShell(); + SfxMedium* pMedium = pDocShell->GetMedium(); + if (!pMedium) + { + return false; + } + + std::shared_ptr<const SfxFilter> pFilter = pMedium->GetFilter(); + if (!pFilter) + { + return false; + } + + return pFilter->IsOwnFormat(); +} +} + void PageDescToItemSet( const SwPageDesc& rPageDesc, SfxItemSet& rSet) { const SwFrameFormat& rMaster = rPageDesc.GetMaster(); @@ -597,8 +621,13 @@ void PageDescToItemSet( const SwPageDesc& rPageDesc, SfxItemSet& rSet) } oGrabBag->GetGrabBag()["BackgroundFullSize"] <<= rMaster.GetAttrSet().GetItem<SfxBoolItem>(RES_BACKGROUND_FULL_SIZE)->GetValue(); - oGrabBag->GetGrabBag()["RtlGutter"] <<= - rMaster.GetAttrSet().GetItem<SfxBoolItem>(RES_RTL_GUTTER)->GetValue(); + + if (IsOwnFormat(*rMaster.GetDoc())) + { + oGrabBag->GetGrabBag()["RtlGutter"] + <<= rMaster.GetAttrSet().GetItem<SfxBoolItem>(RES_RTL_GUTTER)->GetValue(); + } + rSet.Put(*oGrabBag); } |