20 #include <libxml/xmlwriter.h>
27 #include <osl/diagnose.h>
38 #include <strings.hrc>
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" );
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()
300 else if (
auto pModifyChangedHint = dynamic_cast<const sw::ModifyChangedHint*>(&rHint))
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() ) &&
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++ )
589 if (rName ==
SwResId(STR_POOLPAGE[
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);
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
Base class of the Writer layout elements.
constexpr TypedWhichId< SvxFrameDirectionItem > RES_FRAMEDIR(120)
void SetRight(const tools::Long nR, const sal_uInt16 nProp=100)
Represents the style of a paragraph.
const_iterator end() const
static const SwPageDesc * GetPageDescOfNode(const SwNode &rNd)
Given a SwNode return the pagedesc in use at that location.
const_iterator begin() const
SwFrameFormat & GetLeft()
bool isCHRATR(const sal_uInt16 nWhich)
constexpr TypedWhichId< SwFormatChg > RES_FMT_CHG(162)
SwPageDescsBase::value_type value_type
iterator find_(const OUString &name) const
tools::Long GetRight() const
SwFrameFormat & GetFirstMaster()
const WhichRangesContainer & GetRanges() const
void dumpAsXml(xmlTextWriterPtr pWriter) const
bool KnowsFormat(const SwFormat &rFormat) const
SwPageDescExt(const SwPageDesc &rPageDesc, SwDoc *pDoc)
WW8LvlType GetNumType(sal_uInt8 nWwLevelNo)
sal_uInt16 m_nRegAscent
For grid alignment (Registerhaltigkeit).
const TranslateId STR_POOLPAGE[]
Dialog to specify the properties of date form field.
SwPageDesc & operator=(const SwPageDesc &)
virtual bool GetInfo(SfxPoolItem &) const override
SwPageDescExt & operator=(const SwPageDescExt &rSrc)
void SetFollow(const SwPageDesc *pNew)
const OUString & GetName() const
OUString SwResId(TranslateId aId)
SAL_DLLPRIVATE SwPageDesc(const OUString &, SwFrameFormat *, SwDoc *pDc)
tools::Long GetGutterMargin() const
static SwPageDesc * GetByName(SwDoc &rDoc, std::u16string_view rName)
bool IsFollowNextPageOfNode(const SwNode &rNd) const
std::pair< const_iterator, bool > push_back(const value_type &x)
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
ByPos::const_iterator const_iterator
sw::WriterMultiListener m_aDepends
Because of grid alignment (Registerhaltigkeit).
constexpr OUStringLiteral IsHidden(u"IsHidden")
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
special handling if the style of the grid alignment changes
StashedPageDesc m_aStashedHeader
drawing::TextVerticalAdjust m_nVerticalAdjustment
exports com.sun.star. drawing
virtual OUString GetName() const override
void RemoveStashedFormat(bool bHeader, bool bLeft, bool bFirst)
Gives the feature of removing the stashed format by hand if it is necessary.
SwAttrPool * GetPool() const
virtual SwPageDesc * GetPageDescFromPool(sal_uInt16 nId, bool bRegardLanguage=true)=0
Return required automatic page style.
virtual ~SwPageDesc() override
#define SAL_N_ELEMENTS(arr)
SwFrameFormat m_FirstMaster
bool IsContentNode() const
void SetPageDesc(const SwPageDesc &rPageDesc)
void erase(const value_type &x)
sal_uInt16 m_nRegHeight
Sentence spacing and fontascent of style.
const SwFrameFormat * GetStashedFrameFormat(bool bHeader, bool bLeft, bool bFirst) const
Used to restore hidden header/footer formats.
const SwPageDesc & GetPageDesc(const size_t i) const
SAL_DLLPRIVATE void Mirror()
Called for mirroring of Chg (doc).
SwPageFrame * FindPageFrame()
bool IsListeningTo(const SwModify *const pDepend) const
void ChgFirstShare(bool bNew)
SwFrameFormat * GetLeftFormat(bool const bFirst=false)
tools::Long GetLeft() const
constexpr TypedWhichId< SwAttrSetChg > RES_ATTRSET_CHG(163)
void dumpAsXml(xmlTextWriterPtr pWriter) const
size_t GetPageDescCnt() const
const SwTextFormatColl * GetRegisterFormatColl() const
retrieve the style for the grid alignment
SwPageDescsBase::size_type size_type
constexpr TypedWhichId< SvxLineSpacingItem > RES_PARATR_LINESPACING(RES_PARATR_BEGIN)
A page of the document layout.
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
static const SwFrame * lcl_GetFrameOfNode(const SwNode &rNd)
const SwPageDesc * GetFollow() const
void SetRightGutterMargin(const tools::Long nRightGutterMargin)
void StartListening(SwModify *pDepend)
SwFrameFormat & GetMaster()
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SwFrameFormat * GetPageFormatOfNode(const SwNode &rNd, bool bCheckForThisPgDc=true) const
void SetLeft(const tools::Long nL, const sal_uInt16 nProp=100)
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
virtual bool GetInfo(SfxPoolItem &) const override
Query information from Client.
const SfxPoolItem * m_pOld
OUString const & GetName() const
SwFrameFormat & GetFirstLeft()
SwFrameFormat * GetRightFormat(bool const bFirst=false)
Layout uses the following methods to obtain a format in order to be able to create a page...
LanguageType GetAppLanguage()
const SwModify * GetRegisteredIn() const
bool SetName(const OUString &rNewName)
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
const SwTextFormatColl * m_pTextFormatColl
virtual void CallSwClientNotify(const SfxHint &rHint) const override
SvxFrameDirection GetDefaultFrameDirection(LanguageType nLanguage)
Return the AutoCollection by its Id.
SwFrameFormat m_FirstLeft
#define SAL_WARN(area, stream)
std::shared_ptr< SwFrameFormat > m_pStashedFirstLeft
struct _xmlTextWriter * xmlTextWriterPtr
SAL_DLLPRIVATE void ResetAllAttr()
bool IsFirstShared() const
void RegisterChange()
notify all affected page frames
StashedPageDesc m_aStashedFooter
std::shared_ptr< SwFrameFormat > m_pStashedLeft
SwPageDescs * m_pdList
Backref to the assigned SwPageDescs list to handle renames.
bool HasStashedFormat(bool bHeader, bool bLeft, bool bFirst)
Checks if the pagedescriptor has a stashed format according to the parameters or not.
std::shared_ptr< SwFrameFormat > m_pStashedFirst
bool m_bDetectedRangeSegmentation false
void SetRegisterFormatColl(const SwTextFormatColl *rFormat)
set the style for the grid alignment
void StashFrameFormat(const SwFrameFormat &rFormat, bool bHeader, bool bLeft, bool bFirst)
Remember original header/footer formats even when they are hidden by "sharing".
Base class of the Writer document model elements.