20#include <osl/diagnose.h>
29#include <sfx2/sfxsids.hrc>
31#include <tools/datetime.hxx>
49#include <com/sun/star/uno/Reference.h>
50#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
51#include <com/sun/star/document/XDocumentProperties.hpp>
52#include <com/sun/star/frame/XModel.hpp>
60 SPLITDOC_TO_GLOBALDOC,
69 return SplitDoc( SPLITDOC_TO_GLOBALDOC, rPath,
false, pSplitColl );
74 return SplitDoc( SPLITDOC_TO_GLOBALDOC, rPath,
true,
nullptr, nOutlineLevel );
79 return SplitDoc( SPLITDOC_TO_HTML, rPath,
true,
nullptr, nOutlineLevel );
85 return SplitDoc( SPLITDOC_TO_HTML, rPath,
false, pSplitColl );
91 for( ; *nOutl < pOutlNds->
size(); ++(*nOutl) )
93 SwNode* pNd = (*pOutlNds)[ *nOutl ];
107 for( ++(*nOutl); (*nOutl) < pOutlNds->
size(); ++(*nOutl) )
109 pNd = (*pOutlNds)[ *nOutl ];
113 if( ( 0 < nLevel && nLevel <= nOutlineLevel ) &&
125 for( ; *nOutl < pOutlNds->
size(); ++(*nOutl) )
127 SwNode* pNd = (*pOutlNds)[ *nOutl ];
141 for( ++(*nOutl); *nOutl < pOutlNds->
size(); ++(*nOutl) )
143 pNd = (*pOutlNds)[ *nOutl ];
146 if( ( pTColl == pSplitColl ||
170 std::unique_ptr<SwOutlineNodes> xTmpOutlNds;
180 pOutlNds = xTmpOutlNds.get();
183 if( pTNd->GetNodes().IsDocNodes() )
186 if( pOutlNds->
empty() )
195 if ( rFormatColls[ --
n ]->GetAttrOutlineLevel() == 1 )
197 pSplitColl = rFormatColls[
n ];
206 std::shared_ptr<const SfxFilter> pFilter;
209 case SPLITDOC_TO_HTML:
215 eDocType = SPLITDOC_TO_GLOBALDOC;
226 OUString sExt = pFilter->GetSuffixes().getToken(0,
',');
233 if(
'.' != sExt[ 0 ] )
240 OUString sLeading(aEntry.
GetBase());
253 while( nOutl < pOutlNds->
size() &&
254 (*pOutlNds)[ nOutl ]->GetIndex() <
GetNodes().GetEndOfExtras().GetIndex() )
259 pStartNd =
GetStartNode( pOutlNds, nOutlineLevel, &nOutl );
261 pStartNd =
GetStartNode( pOutlNds, pSplitColl, &nOutl );
267 pEndNd =
GetEndNode( pOutlNds, nOutlineLevel, &nOutl );
269 pEndNd =
GetEndNode( pOutlNds, pSplitColl, &nOutl );
282 uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
283 static_cast<SwDocShell*
>(&xDocSh)->GetModel(),
284 uno::UNO_QUERY_THROW);
285 uno::Reference<document::XDocumentProperties> xDocProps(
286 xDPS->getDocumentProperties());
287 OSL_ENSURE(xDocProps.is(),
"Doc has no DocumentProperties");
289 xDocProps->setTemplateName(OUString());
291 xDocProps->setTemplateDate(uDT);
292 xDocProps->setTemplateURL(rPath);
295 OUString sTitle( xDocProps->getTitle() );
296 if (!sTitle.isEmpty())
299 xDocProps->setTitle( sTitle );
320 StreamMode::STD_READWRITE );
325 if( SPLITDOC_TO_HTML == eDocType &&
341 if( !sFileName.isEmpty() )
345 case SPLITDOC_TO_HTML:
364 OSL_FAIL(
"no more Nodes!" );
374 auto pFly = rSpzs[
n];
376 SwNode const*
const pAnchorNode =
379 ((RndStdIds::FLY_AT_PARA == pAnchor->
GetAnchorId()) ||
380 (RndStdIds::FLY_AT_CHAR == pAnchor->
GetAnchorId())) &&
381 aSIdx <= *pAnchorNode &&
382 *pAnchorNode < aEIdx.
GetNode() )
399 if( !pOutlNds->
Seek_Entry( pStartNd, &nOutl ))
428 bool bMvIdx = aEndIdx == *pSectEnd;
443 while( pSectNd && pSectNd->
GetIndex() >
448 if( aEndIdx < pSectNd->EndOfSectionIndex() )
461 if (aEndIdx >= aStartIdx)
464 *pFormat, aSectData,
nullptr, &aEndIdx.
GetNode(),
false);
469 *pFormat, aSectData,
nullptr, &aStartIdx.
GetNode(),
false);
485 case SPLITDOC_TO_HTML:
493 pFilter = pFCntnr->
GetFilter4EA( pFilter->GetTypeName(), SfxFilterFlags::EXPORT );
@ GLOBAL_DOCUMENT_SAVE_LINKS
css::util::DateTime GetUNODateTime() const
virtual void DelLayoutFormat(SwFrameFormat *pFormat)=0
virtual void SetRedlineFlags_intern(RedlineFlags eMode)=0
Set a new redline mode.
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
bool removeSegment(sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true)
std::shared_ptr< const SfxFilter > GetFilter4EA(const OUString &rEA, SfxFilterFlags nMust=SfxFilterFlags::IMPORT, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED) const
void SetFilter(const std::shared_ptr< const SfxFilter > &pFilter)
SfxFilterContainer * GetFilterContainer() const
bool DoSaveAs(SfxMedium &rNewStor)
virtual bool DoSaveCompleted(SfxMedium *pNewStor=nullptr, bool bRegisterRecent=true)
virtual SfxObjectFactory & GetFactory() const=0
SfxMedium * GetMedium() const
void AppendItem(const SfxPoolItem &)
const SfxPoolItem * ExecuteSlot(SfxRequest &rReq, const SfxInterface *pIF=nullptr)
static SfxViewFrame * LoadHiddenDocument(SfxObjectShell const &i_rDoc, SfxInterfaceId i_nViewId)
bool GenerateGlobalDoc(const OUString &rPath, const SwTextFormatColl *pSplitColl)
SwSectionFormats & GetSections()
bool GenerateHTMLDoc(const OUString &rPath, const SwTextFormatColl *pSplitColl)
void CorrAbs(const SwNode &rOldNode, const SwPosition &rNewPos, const sal_Int32 nOffset=0, bool bMoveCursor=false)
SwNumRule * mpOutlineRule
IDocumentUndoRedo & GetIDocumentUndoRedo()
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
const SwTextFormatColls * GetTextFormatColls() const
void DelSectionFormat(SwSectionFormat *pFormat, bool bDelNodes=false)
OUString GetUniqueSectionName(const OUString *pChkStr=nullptr) const
::sw::DocumentContentOperationsManager const & GetDocumentContentOperationsManager() const
const SwAttrPool & GetAttrPool() const
SwSectionFormat * MakeSectionFormat()
void ReplaceStyles(const SwDoc &rSource, bool bIncludePageStyles=true)
::sw::DocumentSettingManager & GetDocumentSettingManager()
const sw::FrameFormats< sw::SpzFrameFormat * > * GetSpzFrameFormats() const
bool SplitDoc(sal_uInt16 eDocType, const OUString &rPath, bool bOutline, const SwTextFormatColl *pSplitColl, int nOutlineLevel=0)
Create sub-documents according to the given collection.
void SetOutlineNumRule(const SwNumRule &rRule)
static SW_DLLPUBLIC std::shared_ptr< const SfxFilter > GetFilterOfFormat(std::u16string_view rFormat, const SfxFilterContainer *pCnt=nullptr)
find for an internal format name the corresponding filter entry
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.
SwNodeOffset GetIndex() const
SwTableNode * FindTableNode()
Search table node, in which it is.
SwSectionNode * FindSectionNode()
Search section node, in which it is.
SwNodeOffset EndOfSectionIndex() const
const SwEndNode * EndOfSectionNode() const
const SwOutlineNodes & GetOutLineNds() const
Array of all OutlineNodes.
SwNode & GetEndOfExtras() const
This is the last EndNode of a special section.
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
bool MoveNodes(const SwNodeRange &, SwNodes &rNodes, SwNode &rPos, bool bNewFrames=true)
move the node pointer
void Delete(const SwNodeIndex &rPos, SwNodeOffset nNodes=SwNodeOffset(1))
SwSectionNode * InsertTextSection(SwNode &rNd, SwSectionFormat &rSectionFormat, SwSectionData const &, SwTOXBase const *const pTOXBase, SwNode const *pEndNd, bool const bInsAtStart=true, bool const bCreateFrames=true)
Insert a new SwSection.
bool Seek_Entry(SwNode *rP, size_type *pnPos) const
PaM is Point and Mark: a selection of the document model.
const SwPosition * GetMark() const
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
const SwPosition * GetPoint() const
SAL_DLLPRIVATE void SetProtectFlag(bool const bFlag)
void SetLinkFileName(OUString const &rNew)
A section node represents the start of a section on the UI, i.e.
const SwSection & GetSection() const
SwSectionFormat * GetFormat()
void CreateLink(LinkCreateType eType)
Represents the style of a paragraph.
int GetAttrOutlineLevel() const
SwTextNode is a paragraph in the document model.
OUString GetExpandText(SwRootFrame const *pLayout, const sal_Int32 nIdx=0, const sal_Int32 nLen=-1, const bool bWithNum=false, const bool bAddSpaceAfterListLabelStr=false, const bool bWithSpacesForLevel=false, const ExpandMode eAdditionalMode=ExpandMode::ExpandFootnote|ExpandMode::HideFieldmarkCommands) const
add 4th optional parameter <bAddSpaceAfterListLabelStr> indicating, when <bWithNum = true> that a spa...
SwTextAttr * InsertItem(SfxPoolItem &rAttr, const sal_Int32 nStart, const sal_Int32 nEnd, const SetAttrMode nMode=SetAttrMode::DEFAULT)
create new text attribute from rAttr and insert it
int GetAttrOutlineLevel() const
Returns outline level of this text node.
const OUString & GetText() const
SwTextFormatColl * GetTextColl() const
std::vector< SwTextFormatColl * >::size_type size_type
std::vector< Value >::size_type size_type
std::pair< const_iterator, bool > insert(Value &&x)
void CopyWithFlyInFly(const SwNodeRange &rRg, SwNode &rInsPos, const std::pair< const SwPaM &, const SwPosition & > *pCopiedPaM=nullptr, bool bMakeNewFrames=true, bool bDelRedlines=true, bool bCopyFlyAtFly=false, SwCopyFlags flags=SwCopyFlags::Default) const
note: rRg/rInsPos exclude a partially selected start text node; pCopiedPaM includes a partially selec...
virtual void set(DocumentSettingId id, bool value) override
Set the specified document setting.
void EnableKillingFile(bool bEnable=true)
static SwNode * GetStartNode(SwOutlineNodes const *pOutlNds, int nOutlineLevel, SwOutlineNodes::size_type *nOutl)
static SwNode * GetEndNode(SwOutlineNodes const *pOutlNds, int nOutlineLevel, SwOutlineNodes::size_type *nOutl)
constexpr OUStringLiteral FILTER_XML
XML filter.
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
OUString CreateTempURL(const OUString *pParent, bool bDirectory)
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
bool GoInNode(SwPaM &rPam, SwMoveFnCollection const &fnMove)
SwMoveFnCollection const & fnMoveBackward
SwMoveFnCollection const & fnMoveForward
SwPam::Move()/Find() default argument.
constexpr auto SFX_INTERFACE_NONE