20#include <libxml/xmlwriter.h>
27#include <osl/diagnose.h>
45 :
sw::BroadcastingModify()
46 , m_StyleName( rName )
47 , m_Master( pDoc->GetAttrPool(), rName, pFormat )
48 , m_Left( pDoc->GetAttrPool(), rName, pFormat )
49 , m_FirstMaster( pDoc->GetAttrPool(), rName, pFormat )
50 , m_FirstLeft( pDoc->GetAttrPool(), rName, pFormat )
54 , m_pTextFormatColl(nullptr)
58 , m_nVerticalAdjustment( drawing::TextVerticalAdjust_TOP )
60 , m_IsLandscape( false )
67 :
sw::BroadcastingModify()
70 , m_Master( rCpy.GetMaster() )
71 , m_Left( rCpy.GetLeft() )
72 , m_FirstMaster( rCpy.GetFirstMaster() )
73 , m_FirstLeft( rCpy.GetFirstLeft() )
75 , m_pTextFormatColl(nullptr)
76 , m_pFollow( rCpy.m_pFollow )
77 , m_nRegHeight( rCpy.GetRegHeight() )
78 , m_nRegAscent( rCpy.GetRegAscent() )
79 , m_nVerticalAdjustment( rCpy.GetVerticalAdjustment() )
80 , m_eUse( rCpy.ReadUseOn() )
81 , m_IsLandscape( rCpy.GetLandscape() )
83 , m_FootnoteInfo( rCpy.GetFootnoteInfo() )
153 SAL_WARN(
"sw",
"SwPageDesc not found in expected m_pdList" );
203 if (!
m_Left.GetInfo(rInfo))
252 if( pLast->IsPageFrame() )
253 static_cast<SwPageFrame*
>(pLast)->PrepareRegisterChg();
260 if( pLast->IsPageFrame() )
261 static_cast<SwPageFrame*
>(pLast)->PrepareRegisterChg();
268 if( pLast->IsPageFrame() )
269 static_cast<SwPageFrame*
>(pLast)->PrepareRegisterChg();
276 if( pLast->IsPageFrame() )
277 static_cast<SwPageFrame*
>(pLast)->PrepareRegisterChg();
285 if (rHint.
GetId() == SfxHintId::SwLegacyModify)
288 const sal_uInt16 nWhich = pLegacyHint->
m_pOld
289 ? pLegacyHint->m_pOld->
Which()
290 : pLegacyHint->m_pNew
291 ? pLegacyHint->m_pNew->Which()
293 CallSwClientNotify(rHint);
311 const sw::BroadcastingModify* pMod;
320 pMod =
static_cast<const SwTableNode&
>(rNd).GetTable().GetFrameFormat();
327 std::pair<Point, bool>
const tmp(aNullPt,
false);
336 if (pChkFrame &&
nullptr != (pChkFrame = pChkFrame->
FindPageFrame()))
337 pRet =
static_cast<const SwPageFrame*
>(pChkFrame)->GetPageDesc();
342 bool bCheckForThisPgDc )
const
348 if( pChkFrame &&
nullptr != ( pChkFrame = pChkFrame->
FindPageFrame() ))
350 const SwPageDesc* pPd = bCheckForThisPgDc ? this :
351 static_cast<const SwPageFrame*
>(pChkFrame)->GetPageDesc();
353 OSL_ENSURE(
static_cast<const SwPageFrame*
>(pChkFrame)->GetPageDesc() == pPd,
"Wrong node for detection of page format!" );
358 OSL_ENSURE( pChkFrame->
KnowsFormat(*pRet),
"Wrong node for detection of page format!" );
372 if( pChkFrame &&
nullptr != ( pChkFrame = pChkFrame->
FindPageFrame() ) &&
411 assert(rFormat.GetRegisteredIn());
412 std::shared_ptr<SwFrameFormat>* pFormat =
nullptr;
416 if (bLeft && !bFirst)
418 else if (!bLeft && bFirst)
420 else if (bLeft && bFirst)
425 if (bLeft && !bFirst)
427 else if (!bLeft && bFirst)
429 else if (bLeft && bFirst)
435 *pFormat = std::make_shared<SwFrameFormat>(rFormat);
441 "SwPageDesc::StashFrameFormat: Stashing the right page header/footer is pointless.");
447 std::shared_ptr<SwFrameFormat>* pFormat =
nullptr;
449 if (bLeft && !bFirst)
453 else if (!bLeft && bFirst)
457 else if (bLeft && bFirst)
464 return pFormat->get();
468 SAL_WARN(
"sw",
"SwPageDesc::GetStashedFrameFormat: Right page format is never stashed.");
477 if (bLeft && !bFirst)
481 else if (!bLeft && bFirst)
485 else if (bLeft && bFirst)
491 SAL_WARN(
"sw",
"SwPageDesc::HasStashedFormat: Right page format is never stashed.");
497 if (bLeft && !bFirst)
501 else if (!bLeft && bFirst)
505 else if (bLeft && bFirst)
511 SAL_WARN(
"sw",
"SwPageDesc::HasStashedFormat: Right page format is never stashed.");
521 if (bLeft && !bFirst)
525 else if (!bLeft && bFirst)
529 else if (bLeft && bFirst)
535 SAL_WARN(
"sw",
"SwPageDesc::RemoveStashedFormat: Right page format is never stashed.");
540 if (bLeft && !bFirst)
544 else if (!bLeft && bFirst)
548 else if (bLeft && bFirst)
554 SAL_WARN(
"sw",
"SwPageDesc::RemoveStashedFormat: Right page format is never stashed.");
562 STR_POOLPAGE_STANDARD,
566 STR_POOLPAGE_ENVELOPE,
567 STR_POOLPAGE_REGISTER,
569 STR_POOLPAGE_FOOTNOTE,
570 STR_POOLPAGE_ENDNOTE,
571 STR_POOLPAGE_LANDSCAPE
578 for(
size_t i = 0;
i < nDCount;
i++ )
601 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"SwPageDesc"));
602 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST(
"ptr"),
"%p",
this);
603 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST(
"m_StyleName"),
"%s",
605 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST(
"m_pFollow"),
"%p",
m_pFollow);
606 (void)xmlTextWriterWriteFormatAttribute(
607 pWriter, BAD_CAST(
"m_eUse"),
"0x%s",
608 BAD_CAST(OString::number(
static_cast<int>(
m_eUse), 16).getStr()));
610 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"m_Master"));
612 (void)xmlTextWriterEndElement(pWriter);
614 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"m_Left"));
616 (void)xmlTextWriterEndElement(pWriter);
618 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"m_FirstMaster"));
620 (void)xmlTextWriterEndElement(pWriter);
622 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"m_FirstLeft"));
624 (void)xmlTextWriterEndElement(pWriter);
626 (void)xmlTextWriterEndElement(pWriter);
635 , m_nBottomDist( 57 )
638 css::text::HorizontalAdjust_RIGHT :
639 css::text::HorizontalAdjust_LEFT;
643 : m_nMaxHeight(rCpy.GetHeight())
644 , m_nLineWidth(rCpy.m_nLineWidth)
645 , m_eLineStyle(rCpy.m_eLineStyle)
646 , m_LineColor(rCpy.m_LineColor)
647 , m_Width(rCpy.GetWidth())
648 , m_eAdjust(rCpy.GetAdj())
649 , m_nTopDist(rCpy.GetTopDist())
650 , m_nBottomDist(rCpy.GetBottomDist())
680 : m_PageDesc(rPageDesc)
687 : m_PageDesc(rSrc.m_PageDesc)
688 , m_pDoc(rSrc.m_pDoc)
727 SwPageDesc * pPageDesc = m_pDoc->FindPageDesc(m_sFollow);
729 if (
nullptr != pPageDesc )
736 : m_PosIndex( m_Array.
get<0>() )
737 , m_NameIndex( m_Array.
get<1>() )
750 return m_Array.iterator_to( *it );
756 assert(
x->m_pdList ==
nullptr );
758 std::pair<iterator,bool> res =
m_PosIndex.push_back(
x );
767 assert(
x->m_pdList ==
this );
773 SAL_WARN(
"sw",
"SwPageDesc is not in SwPageDescs m_pdList!" );
774 x->m_pdList =
nullptr;
780 assert( (*position)->m_pdList ==
this );
782 (*position)->m_pdList =
nullptr;
793 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"SwPageDescs"));
797 pPageDesc->dumpAsXml(pWriter);
800 (void)xmlTextWriterEndElement(pWriter);
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
virtual SwPageDesc * GetPageDescFromPool(sal_uInt16 nId, bool bRegardLanguage=true)=0
Return required automatic page style.
const WhichRangesContainer & GetRanges() const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
void SetRight(const tools::Long nR, const sal_uInt16 nProp=100)
tools::Long GetRight() const
void SetRightGutterMargin(const tools::Long nRightGutterMargin)
tools::Long GetGutterMargin() const
tools::Long GetLeft() const
void SetLeft(const tools::Long nL, const sal_uInt16 nProp=100)
SwAttrPool * GetPool() const
size_t GetPageDescCnt() const
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
const SwPageDesc & GetPageDesc(const size_t i) const
Base class of the Writer layout elements.
bool KnowsFormat(const SwFormat &rFormat) const
SwPageFrame * FindPageFrame()
Base class of the Writer document model elements.
bool IsContentNode() const
OUString const & GetName() const
void SetPageDesc(const SwPageDesc &rPageDesc)
SwPageDescExt & operator=(const SwPageDescExt &rSrc)
SwPageDescExt(const SwPageDesc &rPageDesc, SwDoc *pDoc)
void dumpAsXml(xmlTextWriterPtr pWriter) const
SwPageDescs * m_pdList
Backref to the assigned SwPageDescs list to handle renames.
void StashFrameFormat(const SwFrameFormat &rFormat, bool bHeader, bool bLeft, bool bFirst)
Remember original header/footer formats even when they are hidden by "sharing".
const OUString & GetName() const
sal_uInt16 m_nRegAscent
For grid alignment (Registerhaltigkeit).
drawing::TextVerticalAdjust m_nVerticalAdjustment
void SetFollow(const SwPageDesc *pNew)
SwFrameFormat m_FirstMaster
SAL_DLLPRIVATE void Mirror()
Called for mirroring of Chg (doc).
SwFrameFormat & GetMaster()
const SwFrameFormat * GetPageFormatOfNode(const SwNode &rNd, bool bCheckForThisPgDc=true) const
SwFrameFormat m_FirstLeft
bool IsFirstShared() const
SwPageDesc & operator=(const SwPageDesc &)
SwFrameFormat & GetFirstLeft()
SwFrameFormat & GetFirstMaster()
void RegisterChange()
notify all affected page frames
SAL_DLLPRIVATE SwPageDesc(const OUString &, SwFrameFormat *, SwDoc *pDc)
bool HasStashedFormat(bool bHeader, bool bLeft, bool bFirst)
Checks if the pagedescriptor has a stashed format according to the parameters or not.
bool SetName(const OUString &rNewName)
SwFrameFormat * GetRightFormat(bool const bFirst=false)
Layout uses the following methods to obtain a format in order to be able to create a page.
SwFrameFormat & GetLeft()
void ChgFirstShare(bool bNew)
const SwPageDesc * GetFollow() const
sw::WriterMultiListener m_aDepends
Because of grid alignment (Registerhaltigkeit).
static const SwPageDesc * GetPageDescOfNode(const SwNode &rNd)
Given a SwNode return the pagedesc in use at that location.
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
special handling if the style of the grid alignment changes
void RemoveStashedFormat(bool bHeader, bool bLeft, bool bFirst)
Gives the feature of removing the stashed format by hand if it is necessary.
bool IsFollowNextPageOfNode(const SwNode &rNd) const
sal_uInt16 m_nRegHeight
Sentence spacing and fontascent of style.
static SwPageDesc * GetByName(SwDoc &rDoc, std::u16string_view rName)
void SetRegisterFormatColl(const SwTextFormatColl *rFormat)
set the style for the grid alignment
SAL_DLLPRIVATE void ResetAllAttr()
virtual ~SwPageDesc() override
const SwTextFormatColl * m_pTextFormatColl
SwFrameFormat * GetLeftFormat(bool const bFirst=false)
virtual bool GetInfo(SfxPoolItem &) const override
Query information from Client.
StashedPageDesc m_aStashedFooter
const SwFrameFormat * GetStashedFrameFormat(bool bHeader, bool bLeft, bool bFirst) const
Used to restore hidden header/footer formats.
const SwTextFormatColl * GetRegisterFormatColl() const
retrieve the style for the grid alignment
StashedPageDesc m_aStashedHeader
SwPageDescsBase::value_type value_type
SwPageDescsBase::size_type size_type
std::pair< const_iterator, bool > push_back(const value_type &x)
const_iterator begin() const
void erase(const value_type &x)
void dumpAsXml(xmlTextWriterPtr pWriter) const
iterator find_(const OUString &name) const
const_iterator end() const
ByPos::const_iterator const_iterator
A page of the document layout.
SwPageDesc * GetPageDesc()
Represents the style of a paragraph.
bool IsListeningTo(const SwModify *const pDepend) const
void StartListening(SwModify *pDepend)
struct _xmlTextWriter * xmlTextWriterPtr
virtual OUString GetName() const override
constexpr OUStringLiteral IsHidden(u"IsHidden")
constexpr TypedWhichId< SvxFrameDirectionItem > RES_FRAMEDIR(126)
bool isCHRATR(const sal_uInt16 nWhich)
constexpr TypedWhichId< SwAttrSetChg > RES_ATTRSET_CHG(169)
constexpr TypedWhichId< SvxLineSpacingItem > RES_PARATR_LINESPACING(RES_PARATR_BEGIN)
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(97)
constexpr TypedWhichId< SwFormatChg > RES_FMT_CHG(168)
LanguageType GetAppLanguage()
#define SAL_WARN(area, stream)
#define SAL_N_ELEMENTS(arr)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
Dialog to specify the properties of date form field.
const TranslateId STR_POOLPAGE[]
static const SwFrame * lcl_GetFrameOfNode(const SwNode &rNd)
SvxFrameDirection GetDefaultFrameDirection(LanguageType nLanguage)
Return the AutoCollection by its Id.
std::shared_ptr< SwFrameFormat > m_pStashedFirst
std::shared_ptr< SwFrameFormat > m_pStashedFirstLeft
std::shared_ptr< SwFrameFormat > m_pStashedLeft
const SfxPoolItem * m_pOld
OUString SwResId(TranslateId aId)
WW8LvlType GetNumType(sal_uInt8 nWwLevelNo)