23#include <com/sun/star/util/CloseVetoException.hpp>
28#include <com/sun/star/container/XChild.hpp>
36#include <osl/diagnose.h>
75 bool bResult(
false );
78 if ( bIsAAssignedToOutlineStyle != bIsBAssignedToOutlineStyle )
80 bResult = bIsBAssignedToOutlineStyle;
82 else if ( !bIsAAssignedToOutlineStyle )
97 bool IsValidSlotWhich(sal_uInt16 nSlotId, sal_uInt16 nWhichId)
99 return (nSlotId != 0 && nWhichId != 0 && nSlotId != nWhichId);
113 for(
const auto& rFly : rFlys)
122 aRet.emplace_back(rEntry, dummy);
127 aRet.emplace_back(rEntry, aPos);
139 explicit anchoredto(
const SwNode& rNode) : mrNode(rNode) {}
140 bool operator()(
const ww8::Frame &rFrame)
const
151 : mpFlyFrame(nullptr)
152 , maPos(
std::move(aPos))
153 , meWriterType(eBulletGrf)
154 , mpStartFrameContent(nullptr)
159 const MapMode aMap100mm( MapUnit::Map100thMM );
174 : mpFlyFrame(&rFormat)
175 , maPos(
std::move(aPos))
176 , meWriterType(eTextBox)
177 , mpStartFrameContent(nullptr)
183 switch (rFormat.
Which())
222 OSL_ENSURE(
false,
"Impossible");
229 if (pObj->GetObjInventor() == SdrInventor::FmForm)
233 maSize = pObj->GetSnapRect().GetSize();
238 OSL_ENSURE(
false,
"Impossible");
260 sal_uInt16 nSlotId = rSrcPool.
GetSlotId(nWhich);
261 if (IsValidSlotWhich(nSlotId, nWhich))
262 nWhich = rDestPool.
GetWhich(nSlotId);
269 const SwDoc &rDoc, sal_uInt16 nWhich)
281 : mxIPRef(rObj.GetObjRef()), mrPers(rPers),
282 mpGraphic( rObj.GetGraphic() )
289 OSL_ENSURE(
mxIPRef.is(),
"Transferring invalid object to doc");
293 uno::Reference < container::XChild > xChild(
mxIPRef, uno::UNO_QUERY );
322 catch (
const css::util::CloseVetoException& )
336 else if (nIn < SHRT_MIN)
373 : mnHeavenLayer(rDoc.getIDocumentDrawModelAccess().GetInvisibleHeavenId()),
374 mnHellLayer(rDoc.getIDocumentDrawModelAccess().GetInvisibleHellId()),
375 mnFormLayer(rDoc.getIDocumentDrawModelAccess().GetInvisibleControlsId())
382 if( bExportParentItemSet )
385 for( sal_uInt16 nItem =0; nItem < nTotal; ++nItem )
390 rItems[pItem->
Which()] = pItem;
400 rItems[pItem->Which()] = pItem;
410 auto aIter = rItems.find(
eType);
411 if (aIter != rItems.end())
412 return aIter->second;
420 if (pCharFormat->GetAttrSet().Count())
434 typedef ww8::ParaStyles::size_type mysizet;
439 for (mysizet nI = 0; nI <
nCount; ++nI)
440 aStyles.push_back((*pColls)[
static_cast< sal_uInt16
>(nI) ]);
476 std::sort(rStyles.begin(), rStyles.end(), outlinecmp());
494 SwFormatAnchor const& rAnchor = rFrame.GetFrameFormat().GetAnchor();
497 rFrame.SetPosition(*pAnchor);
501 assert(RndStdIds::FLY_AT_PAGE == rAnchor.
GetAnchorId());
509 std::copy_if(rFrames.begin(), rFrames.end(),
510 std::back_inserter(aRet), anchoredto(rNode));
517 if (nLevel < 0 || nLevel >=
MAXLEVEL)
519 OSL_FAIL(
"Invalid level");
522 return &(rRule.
Get(
static_cast< sal_uInt16
>(nLevel) ));
571 OSL_ENSURE(pIndex,
"No NodeIndex in SwFrameFormat ?, suspicious");
585 OSL_ENSURE(pApply,
"impossible");
592 return pBreak && pBreak->
GetBreak() == SvxBreak::PageBefore;
597 if(1 == rPolyPoly.
Count())
607 sal_uInt32 nPointCount(0);
610 for(
a = 0;
a < rPolyPoly.
Count();
a++)
612 nPointCount +=
static_cast<sal_uInt32
>(rPolyPoly[
a].GetSize());
615 if(nPointCount > 0x0000ffff)
617 OSL_FAIL(
"PolygonFromPolyPolygon: too many points for a single polygon (!)");
618 nPointCount = 0x0000ffff;
622 sal_uInt32 nAppendIndex(0);
624 for(
a = 0;
a < rPolyPoly.
Count();
a++)
628 for(sal_uInt16 b(0); nAppendIndex <= nPointCount && b < rCandidate.
GetSize(); b++)
630 aRetval[o3tl::narrowing<sal_uInt16>(nAppendIndex++)] = rCandidate[b];
644 if (bCorrectCrop && pAttrSet)
655 aPoly.
Move(-nCropLeft, -nCropTop);
659 aPoly.
Scale(
double(aScaleX),
double(aScaleY));
665 aPoly.
Scale(
double(aMapPolyX),
double(aMapPolyY));
683 aPoly.
Scale(
double(aHackX),
double(aHackY));
685 aPoly.
Move(-nMove, 0);
697 class SameOpenRedlineType
703 bool operator()(
const std::unique_ptr<SwFltStackEntry> & pEntry)
const
706 (pEntry->m_pAttr.get());
717 SameOpenRedlineType(
eType));
730 sw::mark::IFieldmark *
const pFieldMark(
732 SAL_WARN_IF(!pFieldMark,
"sw.ww8",
"expected a field mark");
733 if (pFieldMark && pFieldMark->GetMarkPos().GetNodeIndex() == (*aResult)->m_aMkPos.m_nNode.GetIndex()+1
734 && pFieldMark->GetMarkPos().GetContentIndex() < (*aResult)->m_aMkPos.m_nContent)
736 (*aResult)->SetEndPos(
end);
740 (*aResult)->SetEndPos(rPos);
753 sal_Int32
const nInserted = 2;
757 bool const isPoint(rMkPos == rPtPos);
763 "sw.ww8",
"redline ends after end of line");
777 "sw.ww8",
"range ends after end of line");
783 for (
size_t i = 0, nCnt =
maStack.size();
i < nCnt; ++
i)
792 SwPaM aRegion(pEntry->m_aMkPos.m_nNode);
793 if (pEntry->MakeRegion(
mrDoc, aRegion,
801 (pEntry->m_pAttr.get());
804 pFltRedline->
m_aStamp, OUString(),
nullptr);
819 const std::unique_ptr<SwFltStackEntry> & pTwoE)
const
822 (pOneE->m_pAttr.get());
824 (pTwoE->m_pAttr.get());
829 return (pOne->
m_eType == RedlineType::Insert && pTwo->
m_eType != RedlineType::Insert);
845 nRet =
static_cast< sal_uInt16
>(aIter -
maAuthors.begin());
848 nRet =
static_cast< sal_uInt16
>(
maAuthors.size());
858 : m_pTableNode(&rNode)
868 if(rHint.
GetId() == SfxHintId::Dying)
873 : mbHasRoot(rDoc.getIDocumentLayoutAccess().GetCurrentLayout())
884 OSL_ENSURE(pTable,
"Why no expected table");
889 if (pFrameFormat !=
nullptr)
@ ShowDelete
show all deletes
@ ShowInsert
show all inserts
constexpr auto convertTwipToMm100(N n)
static OutputDevice * GetDefaultDevice()
MapMode GetPrefMapMode() const
virtual ::sw::mark::IFieldmark * getFieldmarkAt(const SwPosition &rPos) const =0
get Fieldmark for CH_TXT_ATR_FIELDSTART/CH_TXT_ATR_FIELDEND at rPos
virtual AppendResult AppendRedline(SwRangeRedline *pNewRedl, bool bCallDelete)=0
Append a new redline.
virtual void SetRedlineFlags(RedlineFlags eMode)=0
Set a new redline mode.
virtual SwCharFormat * GetCharFormatFromPool(sal_uInt16 nId)=0
virtual SwTextFormatColl * GetTextCollFromPool(sal_uInt16 nId, bool bRegardLanguage=true)=0
Return "Auto-Collection with ID.
MapUnit GetMapUnit() const
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
virtual SdrInventor GetObjInventor() const
virtual void SetLayer(SdrLayerID nLayer)
const SfxPoolItem * GetCurItem() const
const SfxPoolItem * NextItem()
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
sal_uInt16 GetSlotId(sal_uInt16 nWhich) const
const WhichRangesContainer & GetRanges() const
SfxItemPool * GetPool() const
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
bool HasItem(sal_uInt16 nWhich, const SfxPoolItem **ppItem=nullptr) const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
sal_uInt16 TotalCount() const
sal_uInt16 GetWhichByPos(sal_uInt16 nPos) const
comphelper::EmbeddedObjectContainer & GetEmbeddedObjectContainer() const
css::uno::Reference< css::frame::XModel3 > GetModel() const
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const=0
constexpr tools::Long getHeight() const
constexpr tools::Long Height() const
constexpr tools::Long getWidth() const
constexpr tools::Long Width() const
bool StartListening(SvtBroadcaster &rBroadcaster)
sal_Int32 GetRight() const
sal_Int32 GetLeft() const
sal_Int32 GetBottom() const
const Size & GetSize() const
const SwCropGrf & GetCropGrf(bool=true) const
const SwAttrSet * GetpSwAttrSet() const
SwNumRule * GetOutlineNumRule() const
SwCharFormat * FindCharFormatByName(const OUString &rName) const
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
const SwTextFormatColls * GetTextFormatColls() const
IDocumentMarkAccess * getIDocumentMarkAccess()
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
SwPosFlyFrames GetAllFlyFormats(const SwPaM *, bool bDrawAlso, bool bAsCharAlso=false) const
Returns positions of all FlyFrames in the document.
SwTextFormatColl * FindTextFormatCollByName(const OUString &rName) const
const SwAttrPool & GetAttrPool() const
const SwNodeIndex * GetContentIdx() const
Layout frame for SwNoTextNode, i.e. graphics and OLE nodes (including charts).
virtual Size GetTwipSize() const =0
Graphic GetGraphic() const
Marks a node in the document model.
SwNodeOffset GetIndex() const
Base class of the Writer document model elements.
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
SwContentNode * GetContentNode()
SwNoTextNode * GetNoTextNode()
SwTableNode * GetTableNode()
SwNodeType GetNodeType() const
const SwNumFormat & Get(sal_uInt16 i) const
PaM is Point and Mark: a selection of the document model.
const SwPosition * GetMark() const
const SwPosition * GetPoint() const
Of course Writer needs its own rectangles.
tools::Rectangle SVRect() const
static SW_DLLPUBLIC sal_uInt16 GetPoolIdFromUIName(const OUString &rName, SwGetPoolIdFromName)
const SwTable & GetTable() const
void MakeOwnFrames(SwPosition *pIdxBehind=nullptr)
Creates the frms for the table node (i.e.
void DelFrames(SwRootFrame const *pLayout=nullptr)
Method deletes all views of document for the node.
SwTable is one table in the document model, containing rows (which contain cells).
SwTableFormat * GetFrameFormat()
Represents the style of a paragraph.
bool IsAssignedToListLevelOfOutlineStyle() const
int GetAssignedOutlineStyleLevel() const
SwTextNode is a paragraph in the document model.
bool IsCountedInList() const
SwNumRule * GetNumRule(bool bInParent=true) const
Returns numbering rule of this text node.
int GetActualListLevel(SwListRedlineType eRedline=SwListRedlineType::SHOW) const
Returns the actual list level of this text node, when it is a list item.
bool IsNumbered(SwRootFrame const *pLayout=nullptr) const
Returns is this text node is numbered.
const OUString & GetText() const
bool HasEmbeddedObject(const OUString &)
bool InsertEmbeddedObject(const css::uno::Reference< css::embed::XEmbeddedObject > &, OUString &)
static void SetGraphicToContainer(const Graphic &rGraphic, comphelper::EmbeddedObjectContainer &aContainer, const OUString &aName, const OUString &aMediaType)
css::uno::Reference< css::embed::XEmbeddedObject > mxIPRef
const Graphic * mpGraphic
DrawingOLEAdaptor(SdrOle2Obj &rObj, SfxObjectShell &rPers)
Take ownership of a SdrOle2Objs OLE object.
~DrawingOLEAdaptor()
Destructor will destroy the owned OLE object if not transferred.
bool TransferToDoc(OUString &rName)
Transfer ownership of the OLE object to a document's SvPersist.
bool operator()(const std::unique_ptr< SwFltStackEntry > &pOneE, const std::unique_ptr< SwFltStackEntry > &pTwoE) const
InsertedTableListener(SwTableNode &rNode)
SwTableNode * m_pTableNode
SwTableNode * GetTableNode()
virtual void Notify(const SfxHint &) override
std::map< std::unique_ptr< InsertedTableListener >, SwPosition * > maTables
void DelAndMakeTableFrames()
void InsertTable(SwTableNode &rTableNode, SwPaM &rPaM)
InsertedTablesManager(const SwDoc &rDoc)
void closeall(const SwPosition &rPos)
void open(const SwPosition &rPos, const SfxPoolItem &rAttr)
void MoveAttrsFieldmarkInserted(const SwPosition &rPos)
std::vector< std::unique_ptr< SwFltStackEntry > > maStack
bool close(const SwPosition &rPos, RedlineType eType)
void operator()(std::unique_ptr< SwFltStackEntry > &pEntry)
void SendObjectToHeaven(SdrObject &rObject) const
Make Object lives in the top layer.
void SendObjectToHell(SdrObject &rObject) const
Make Object live in the bottom drawing layer.
void SetObjectLayer(SdrObject &rObject, Layer eLayer) const
SetLayer(const SwDoc &rDoc)
Normal constructor.
sal_uInt16 AddName(const OUString &rNm)
std::vector< OUString > maAuthors
Make exporting a Writer Frame easy.
WriterSource meWriterType
Frame(const SwFrameFormat &rFlyFrame, SwPosition aPos)
const SwPosition & GetPosition() const
Get the position this frame is anchored at.
const SwNode * mpStartFrameContent
void ForceTreatAsInline()
Even if the frame isn't an inline frame, force it to behave as one.
std::set< SwPosFlyFrame, SwPosFlyFrameCmp > SwPosFlyFrames
constexpr TypedWhichId< SwFltRedline > RES_FLTR_REDLINE(194)
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(162)
constexpr sal_uInt16 RES_WHICHHINT_END(HINT_END)
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(100)
constexpr TypedWhichId< SwCropGrf > RES_GRFATR_CROPGRF(142)
#define CH_TXT_ATR_FIELDEND
#define SAL_WARN_IF(condition, area, stream)
constexpr OUStringLiteral aData
sal_uInt16 TransformWhichBetweenPools(const SfxItemPool &rDestPool, const SfxItemPool &rSrcPool, sal_uInt16 nWhich)
Map an ID valid in one SfxItemPool to its equivalent in another.
sal_uInt16 GetSetWhichFromSwDocWhich(const SfxItemSet &rSet, const SwDoc &rDoc, sal_uInt16 nWhich)
Map a SwDoc WhichId to the equivalent Id for a given SfxItemSet.
ww8::ParaStyles GetParaStyles(const SwDoc &rDoc)
Get the Paragraph Styles of a SwDoc.
SwCharFormat * GetCharStyle(SwDoc &rDoc, const OUString &rName)
Get a Character Style which fits a given name.
tools::Polygon PolygonFromPolyPolygon(const tools::PolyPolygon &rPolyPoly)
Make a best fit Polygon from a PolyPolygon.
ww8::Frames GetFrames(const SwDoc &rDoc, SwPaM const *pPaM)
Get the Floating elements in a SwDoc.
const SwNumRule * GetNormalNumRuleFromTextNode(const SwTextNode &rTextNode)
const SwNumFormat * GetNumFormatFromTextNode(const SwTextNode &rTextNode)
Get the Numbering Format used on a paragraph.
void ClearOverridesFromSet(const SwFormatCharFormat &rFormat, SfxItemSet &rSet)
Remove properties from an SfxItemSet which a SwFormatCharFormat overrides.
const SwNumFormat * GetNumFormatFromSwNumRuleLevel(const SwNumRule &rRule, int nLevel)
Get the Numbering Format for a given level from a numbering rule.
const SwNumRule * GetNumRuleFromTextNode(const SwTextNode &rTextNode)
void GetPoolItems(const SfxItemSet &rSet, ww8::PoolItems &rItems, bool bExportParentItemSet)
Get the SfxPoolItems of a SfxItemSet.
const SfxPoolItem * SearchPoolItems(const ww8::PoolItems &rItems, sal_uInt16 eType)
SwNoTextNode * GetNoTextNodeFromSwFrameFormat(const SwFrameFormat &rFormat)
Get the SwNoTextNode associated with a SwFrameFormat if here is one.
SwTextFormatColl * GetParaStyle(SwDoc &rDoc, const OUString &rName)
Get a Paragraph Style which fits a given name.
void SortByAssignedOutlineStyleListLevel(ww8::ParaStyles &rStyles)
Sort sequence of Paragraph Styles by assigned outline style list level.
void MoveAttrFieldmarkInserted(SwFltPosition &rMkPos, SwFltPosition &rPtPos, const SwPosition &rPos)
bool HasPageBreak(const SwNode &rNd)
Does a node have a "page break before" applied.
ww8::Frames GetFramesInNode(const ww8::Frames &rFrames, const SwNode &rNode)
Get the Frames anchored to a given node.
void UpdateFramePositions(ww8::Frames &rFrames)
fix up frame positions, must be called after SetRedlineFlags
tools::Polygon CorrectWordWrapPolygonForExport(const tools::PolyPolygon &rPolyPoly, const SwNoTextNode *pNd, bool bCorrectCrop)
Undo all scaling / move tricks of the wrap polygon done during import.
SwTwips MakeSafePositioningValue(SwTwips nIn)
Clips a value to MAX/MIN 16bit value to make it safe for use as a position value to give to writer.
Dialog to specify the properties of date form field.
std::vector< Frame > Frames
STL container of Frames.
std::map< sal_uInt16, const SfxPoolItem *, sw::util::ItemSort > PoolItems
STL container of SfxPoolItems (Attributes)
std::vector< SwTextFormatColl * > ParaStyles
STL container of Paragraph Styles (SwTextFormatColl)
const int nWrap100Percent
For custom wrapping.
Marks a position in the document model.
void Assign(const SwNode &rNd, SwNodeOffset nDelta, sal_Int32 nContentOffset=0)
These all set both nNode and nContent.
SwNodeOffset GetNodeIndex() const
const SwNodes & GetNodes() const
sal_Int32 GetContentIndex() const
SwDoc & GetDoc() const
Returns the document this position is in.
constexpr sal_uInt8 MAXLEVEL