LibreOffice Module sw (master) 1
shellio.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <hintids.hxx>
21#include <osl/diagnose.h>
22#include <tools/date.hxx>
23#include <tools/time.hxx>
24#include <svl/fstathelper.hxx>
27#include <sfx2/docfile.hxx>
28#include <sfx2/docfilt.hxx>
29#include <editeng/lrspitem.hxx>
30#include <editeng/ulspitem.hxx>
31#include <editeng/boxitem.hxx>
32#include <editeng/paperinf.hxx>
33#include <o3tl/deleter.hxx>
34#include <officecfg/Office/Writer.hxx>
35#include <node.hxx>
36#include <docary.hxx>
37#include <fmtanchr.hxx>
38#include <fmtfsize.hxx>
39#include <fmtpdsc.hxx>
40#include <shellio.hxx>
41#include <iodetect.hxx>
42#include <doc.hxx>
43#include <IDocumentUndoRedo.hxx>
49#include <IDocumentState.hxx>
51#include <pam.hxx>
52#include <editsh.hxx>
53#include <undobj.hxx>
54#include <swundo.hxx>
55#include <swtable.hxx>
56#include <tblafmt.hxx>
57#include <tblsel.hxx>
58#include <pagedesc.hxx>
59#include <poolfmt.hxx>
60#include <fltini.hxx>
61#include <docsh.hxx>
62#include <ndole.hxx>
63#include <ndtxt.hxx>
64#include <redline.hxx>
65#include <swerror.h>
67#include <frameformats.hxx>
68#include <utility>
69
70using namespace ::com::sun::star;
71
72static bool sw_MergePortions(SwNode* pNode, void *)
73{
74 if (pNode->IsTextNode())
75 {
77 }
78 return true;
79}
80
82{
83 m_sFont.clear();
85 m_eCharSet = ::osl_getThreadTextEncoding();
87 m_bIncludeBOM = true;
89}
90
91ErrCode SwReader::Read( const Reader& rOptions )
92{
93 // copy variables
94 Reader* po = const_cast<Reader*>(&rOptions);
95 po->m_pStream = mpStrm;
96 po->m_pStorage = mpStg;
97 po->m_xStorage = mxStg;
98 po->m_bInsertMode = nullptr != mpCursor;
100
101 // if a Medium is selected, get its Stream
102 if( nullptr != (po->m_pMedium = mpMedium ) &&
103 !po->SetStrmStgPtr() )
104 {
105 po->SetReadUTF8( false );
106 po->SetBlockMode( false );
107 po->SetOrganizerMode( false );
108 po->SetIgnoreHTMLComments( false );
110 }
111
112 ErrCode nError = ERRCODE_NONE;
113
114 GetDoc();
115
116 // while reading, do not call OLE-Modified
117 Link<bool,void> aOLELink( mxDoc->GetOle2Link() );
118 mxDoc->SetOle2Link( Link<bool,void>() );
119
120 mxDoc->SetInReading( true );
121 mxDoc->SetInXMLImport( dynamic_cast< XMLReader* >(po) != nullptr );
122 mxDoc->SetInWriterfilterImport(mpMedium && mpMedium->GetFilter()
123 && (mpMedium->GetFilter()->GetUserData() == FILTER_RTF
124 || mpMedium->GetFilter()->GetUserData() == sRtfWH
125 || mpMedium->GetFilter()->GetUserData() == FILTER_DOCX));
126
127 SwPaM *pPam;
128 if( mpCursor )
129 pPam = mpCursor;
130 else
131 {
132 // if the Reader was not called by a Shell, create a PaM ourselves
133 pPam = new SwPaM( mxDoc->GetNodes().GetEndOfContent(), SwNodeOffset(-1) );
134 // For Web documents the default template was set already by InitNew,
135 // unless the filter is not HTML,
136 // or a SetTemplateName was called in ConvertFrom.
137 if( !mxDoc->getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE) || ReadHTML != po || !po->mxTemplate.is() )
138 po->SetTemplate( *mxDoc );
139 }
140
141 // Pams are connected like rings; stop when we return to the 1st element
142 SwPaM *pEnd = pPam;
143
144 bool bReadPageDescs = false;
145 bool const bDocUndo = mxDoc->GetIDocumentUndoRedo().DoesUndo();
146 bool bSaveUndo = bDocUndo && mpCursor;
147 if( bSaveUndo )
148 {
149 // the reading of the page template cannot be undone!
150 bReadPageDescs = po->m_aOption.IsPageDescs();
151 if( bReadPageDescs )
152 {
153 bSaveUndo = false;
154 mxDoc->GetIDocumentUndoRedo().DelAllUndoObj();
155 }
156 else
157 {
158 mxDoc->GetIDocumentUndoRedo().ClearRedo();
159 mxDoc->GetIDocumentUndoRedo().StartUndo( SwUndoId::INSDOKUMENT, nullptr );
160 }
161 }
162 mxDoc->GetIDocumentUndoRedo().DoUndo(false);
163
164 RedlineFlags eOld = mxDoc->getIDocumentRedlineAccess().GetRedlineFlags();
165 RedlineFlags ePostReadRedlineFlags( RedlineFlags::Ignore );
166
167 // Array of FlyFormats
168 SwFrameFormatsV aFlyFrameArr;
169 // only read templates? then ignore multi selection!
170 bool bFormatsOnly = po->m_aOption.IsFormatsOnly();
171
172 while( true )
173 {
174 std::unique_ptr<SwUndoInsDoc> pUndo;
175 if( bSaveUndo )
176 pUndo.reset(new SwUndoInsDoc( *pPam ));
177
178 mxDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( RedlineFlags::Ignore );
179
180 std::optional<SwPaM> pUndoPam;
181 if( bDocUndo || mpCursor )
182 {
183 // set Pam to the previous node, so that it is not also moved
184 const SwNode& rTmp = pPam->GetPoint()->GetNode();
185 pUndoPam.emplace( rTmp, rTmp, SwNodeOffset(0), SwNodeOffset(-1) );
186 }
187
188 // store for now all Fly's
189 if( mpCursor )
190 {
191 aFlyFrameArr.insert( aFlyFrameArr.end(), mxDoc->GetSpzFrameFormats()->begin(),
192 mxDoc->GetSpzFrameFormats()->end() );
193 }
194
195 const sal_Int32 nSttContent = pPam->GetPoint()->GetContentIndex();
196
197 // make sure the End position is correct for all Readers
198 SwContentNode* pCNd = pPam->GetPointContentNode();
199 sal_Int32 nEndContent = pCNd ? pCNd->Len() - nSttContent : 0;
200 SwNodeIndex aEndPos( pPam->GetPoint()->GetNode(), 1 );
201
202 mxDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld );
203
204 nError = po->Read( *mxDoc, msBaseURL, *pPam, maFileName );
205
206 // an ODF document may contain redline mode in settings.xml; save it!
207 ePostReadRedlineFlags = mxDoc->getIDocumentRedlineAccess().GetRedlineFlags();
208
209 mxDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( RedlineFlags::Ignore );
210
211 if( ! nError.IsError() ) // set the End position already
212 {
213 --aEndPos;
214 pCNd = aEndPos.GetNode().GetContentNode();
215 if( !pCNd && nullptr == ( pCNd = SwNodes::GoPrevious( &aEndPos ) ))
216 pCNd = mxDoc->GetNodes().GoNext( &aEndPos );
217
218 const sal_Int32 nLen = pCNd->Len();
219 if( nLen < nEndContent )
220 nEndContent = 0;
221 else
222 nEndContent = nLen - nEndContent;
223 pPam->GetPoint()->Assign( *pCNd, nEndContent );
224
225 const SwStartNode* pTableBoxStart = pCNd->FindTableBoxStartNode();
226 if ( pTableBoxStart )
227 {
228 SwTableBox* pBox = pTableBoxStart->GetTableBox();
229 if ( pBox )
230 {
231 mxDoc->ChkBoxNumFormat( *pBox, true );
232 }
233 }
234 }
235
236 if( mpCursor )
237 {
238 *pUndoPam->GetMark() = *pPam->GetPoint();
239 pUndoPam->GetPoint()->Adjust(SwNodeOffset(1));
240 SwNode& rNd = pUndoPam->GetPointNode();
241 if( rNd.IsContentNode() )
242 pUndoPam->GetPoint()->SetContent( nSttContent );
243
244 bool bChkHeaderFooter = rNd.FindHeaderStartNode() ||
246
247 // search all new Fly's, and store them as individual Undo Objects
248 for( sw::FrameFormats<sw::SpzFrameFormat*>::size_type n = 0; n < mxDoc->GetSpzFrameFormats()->size(); ++n )
249 {
250 SwFrameFormat* pFrameFormat = (*mxDoc->GetSpzFrameFormats())[ n ];
251 const SwFormatAnchor& rAnchor = pFrameFormat->GetAnchor();
252 // ok, here IsAlive is a misnomer...
253 if (!aFlyFrameArr.IsAlive(pFrameFormat))
254 {
255 if ( (RndStdIds::FLY_AT_PAGE == rAnchor.GetAnchorId())
256 // TODO: why is this not handled via SetInsertRange?
258 pUndoPam->GetPoint()->GetNodeIndex(),
259 pUndoPam->GetMark()->GetNodeIndex()))
260 {
261 if( bChkHeaderFooter &&
262 (RndStdIds::FLY_AT_PARA == rAnchor.GetAnchorId()) &&
263 RES_DRAWFRMFMT == pFrameFormat->Which() )
264 {
265 // DrawObjects are not allowed in Headers/Footers!
266 pFrameFormat->DelFrames();
267 mxDoc->DelFrameFormat( pFrameFormat );
268 --n;
269 }
270 else
271 {
272 if( bSaveUndo )
273 {
274 mxDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld );
275 // UGLY: temp. enable undo
276 mxDoc->GetIDocumentUndoRedo().DoUndo(true);
277 mxDoc->GetIDocumentUndoRedo().AppendUndo(
278 std::make_unique<SwUndoInsLayFormat>( pFrameFormat, SwNodeOffset(0), 0 ) );
279 mxDoc->GetIDocumentUndoRedo().DoUndo(false);
280 mxDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( RedlineFlags::Ignore );
281 }
282 if( pFrameFormat->HasWriterListeners() )
283 {
284 // Draw-Objects create a Frame when being inserted; thus delete them
285 pFrameFormat->DelFrames();
286 }
287
288 if (RndStdIds::FLY_AT_PAGE == rAnchor.GetAnchorId())
289 {
290 if( !rAnchor.GetAnchorNode() )
291 {
292 pFrameFormat->MakeFrames();
293 }
294 else if( mpCursor )
295 {
296 mxDoc->SetContainsAtPageObjWithContentAnchor( true );
297 }
298 }
299 else
300 pFrameFormat->MakeFrames();
301 }
302 }
303 }
304 }
305 aFlyFrameArr.clear();
306
307 mxDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld );
308 if( mxDoc->getIDocumentRedlineAccess().IsRedlineOn() )
309 mxDoc->getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( RedlineType::Insert, *pUndoPam ), true);
310 else
311 mxDoc->getIDocumentRedlineAccess().SplitRedline( *pUndoPam );
312 mxDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( RedlineFlags::Ignore );
313 }
314 if( bSaveUndo )
315 {
316 mxDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld );
317 pUndo->SetInsertRange( *pUndoPam, false );
318 // UGLY: temp. enable undo
319 mxDoc->GetIDocumentUndoRedo().DoUndo(true);
320 mxDoc->GetIDocumentUndoRedo().AppendUndo( std::move(pUndo) );
321 mxDoc->GetIDocumentUndoRedo().DoUndo(false);
322 mxDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( RedlineFlags::Ignore );
323 }
324
325 pUndoPam.reset();
326
327 pPam = pPam->GetNext();
328 if( pPam == pEnd )
329 break;
330
331 // only read templates? then ignore multi selection! Bug 68593
332 if( bFormatsOnly )
333 break;
334
335 /*
336 * !!! The Status of the Stream has to be reset directly. !!!
337 * When Seeking, the current Status-, EOF- and bad-Bit is set;
338 * nobody knows why
339 */
340 if( mpStrm )
341 {
342 mpStrm->Seek(0);
344 }
345 }
346
347 // fdo#52028: ODF file import does not result in MergePortions being called
348 // for every attribute, since that would be inefficient. So call it here.
349 // This is only necessary for formats that may contain RSIDs (ODF,MSO).
350 // It's too hard to figure out which nodes were inserted in Insert->File
351 // case (redlines, flys, footnotes, header/footer) so just do every node.
352 mxDoc->GetNodes().ForEach(&sw_MergePortions);
353
354 mxDoc->SetInReading( false );
355 mxDoc->SetInXMLImport( false );
356 mxDoc->SetInWriterfilterImport(false);
357
358 mxDoc->InvalidateNumRules();
359 mxDoc->UpdateNumRule();
360 mxDoc->ChkCondColls();
361 mxDoc->SetAllUniqueFlyNames();
362 // Clear unassigned cell styles, because they aren't needed anymore.
363 mxDoc->GetCellStyles().clear();
364
365 mxDoc->GetIDocumentUndoRedo().DoUndo(bDocUndo);
366 if (!bReadPageDescs && bSaveUndo )
367 {
368 mxDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld );
369 mxDoc->GetIDocumentUndoRedo().EndUndo( SwUndoId::INSDOKUMENT, nullptr );
370 mxDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( RedlineFlags::Ignore );
371 }
372
373 // delete Pam if it was created only for reading
374 if( !mpCursor )
375 {
376 delete pPam; // open a new one
377
378 // #i42634# Moved common code of SwReader::Read() and
379 // SwDocShell::UpdateLinks() to new SwDoc::UpdateLinks():
380 // ATM still with Update
381 mxDoc->getIDocumentLinksAdministration().UpdateLinks();
382
383 // not insert: set the redline mode read from settings.xml
384 eOld = ePostReadRedlineFlags & ~RedlineFlags::Ignore;
385
386 mxDoc->getIDocumentFieldsAccess().SetFieldsDirty(true, nullptr, SwNodeOffset(0));
387 }
388
389 mxDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld );
390 mxDoc->SetOle2Link( aOLELink );
391
392 if( mpCursor ) // the document is now modified
393 mxDoc->getIDocumentState().SetModified();
394 // #i38810# - If links have been updated, the document
395 // have to be modified. During update of links the OLE link at the document
396 // isn't set. Thus, the document's modified state has to be set again after
397 // the OLE link is restored - see above <mxDoc->SetOle2Link( aOLELink )>.
398 if ( mxDoc->getIDocumentLinksAdministration().LinksUpdated() )
399 {
400 mxDoc->getIDocumentState().SetModified();
401 }
402
403 po->SetReadUTF8( false );
404 po->SetBlockMode( false );
405 po->SetOrganizerMode( false );
406 po->SetIgnoreHTMLComments( false );
407
408 return nError;
409}
410
411
412SwReader::SwReader(SfxMedium& rMedium, OUString aFileName, SwDoc *pDocument)
413 : SwDocFac(pDocument), mpStrm(nullptr), mpMedium(&rMedium), mpCursor(nullptr),
414 maFileName(std::move(aFileName)), mbSkipImages(false)
415{
416 SetBaseURL( rMedium.GetBaseURL() );
417 SetSkipImages( rMedium.IsSkipImages() );
418}
419
420
421// Read into an existing document
422SwReader::SwReader(SvStream& rStrm, OUString aFileName, const OUString& rBaseURL, SwPaM& rPam)
423 : SwDocFac(&rPam.GetDoc()), mpStrm(&rStrm), mpMedium(nullptr), mpCursor(&rPam),
424 maFileName(std::move(aFileName)), mbSkipImages(false)
425{
426 SetBaseURL( rBaseURL );
427}
428
429SwReader::SwReader(SfxMedium& rMedium, OUString aFileName, SwPaM& rPam)
430 : SwDocFac(&rPam.GetDoc()), mpStrm(nullptr), mpMedium(&rMedium),
431 mpCursor(&rPam), maFileName(std::move(aFileName)), mbSkipImages(false)
432{
433 SetBaseURL( rMedium.GetBaseURL() );
434}
435
436SwReader::SwReader( uno::Reference < embed::XStorage > xStg, OUString aFilename, SwPaM &rPam )
437 : SwDocFac(&rPam.GetDoc()), mpStrm(nullptr), mxStg( std::move(xStg) ), mpMedium(nullptr), mpCursor(&rPam), maFileName(std::move(aFilename)), mbSkipImages(false)
438{
439}
440
442 : m_aDateStamp( Date::EMPTY ),
443 m_aTimeStamp( tools::Time::EMPTY ),
444 m_aCheckDateTime( DateTime::EMPTY ),
445 m_pStream(nullptr), m_pMedium(nullptr), m_bInsertMode(false),
446 m_bTemplateBrowseMode(false), m_bReadUTF8(false), m_bBlockMode(false), m_bOrganizerMode(false),
447 m_bHasAskTemplateName(false), m_bIgnoreHTMLComments(false), m_bSkipImages(false)
448{
449}
450
452{
453}
454
455OUString Reader::GetTemplateName(SwDoc& /*rDoc*/) const
456{
457 return OUString();
458}
459
460// load the Filter template, set and release
462{
464 {
467 }
468
469 if( m_aTemplateName.isEmpty() )
471 else
472 {
474 const OUString aFileName = aTDir.GetMainURL( INetURLObject::DecodeMechanism::NONE );
475 OSL_ENSURE( !aTDir.HasError(), "No absolute path for template name!" );
476 DateTime aCurrDateTime( DateTime::SYSTEM );
477 bool bLoad = false;
478
479 // if the template is already loaded, check once-a-minute if it has changed
480 if( !mxTemplate.is() || aCurrDateTime >= m_aCheckDateTime )
481 {
482 Date aTstDate( Date::EMPTY );
486 &aTstDate, &aTstTime ) &&
487 ( !mxTemplate.is() || m_aDateStamp != aTstDate || m_aTimeStamp != aTstTime ))
488 {
489 bLoad = true;
490 m_aDateStamp = aTstDate;
491 m_aTimeStamp = aTstTime;
492 }
493
494 // only one minute later check if it has changed
495 m_aCheckDateTime = aCurrDateTime;
496 m_aCheckDateTime += tools::Time( 0, 1 );
497 }
498
499 if (bLoad)
500 {
502 OSL_ENSURE( !mxTemplate.is(), "Who holds the template doc?" );
503
504 // If the writer module is not installed,
505 // we cannot create a SwDocShell. We could create a
506 // SwWebDocShell however, because this exists always
507 // for the help.
508 SvtModuleOptions aModuleOptions;
509 if (aModuleOptions.IsWriter())
510 {
511 SwDocShell *pDocSh = new SwDocShell(SfxObjectCreateMode::INTERNAL);
512 SfxObjectShellLock xDocSh = pDocSh;
513 if (pDocSh->DoInitNew())
514 {
515 mxTemplate = pDocSh->GetDoc();
516 mxTemplate->SetOle2Link( Link<bool,void>() );
517 // always FALSE
518 mxTemplate->GetIDocumentUndoRedo().DoUndo( false );
519 mxTemplate->getIDocumentSettingAccess().set(DocumentSettingId::BROWSE_MODE, m_bTemplateBrowseMode );
520 mxTemplate->RemoveAllFormatLanguageDependencies();
521
522 ReadXML->SetOrganizerMode( true );
523 SfxMedium aMedium( aFileName, StreamMode::NONE );
524 SwReader aRdr( aMedium, OUString(), mxTemplate.get() );
525 aRdr.Read( *ReadXML );
526 ReadXML->SetOrganizerMode( false );
527 }
528 }
529 }
530
531 OSL_ENSURE( !mxTemplate.is() || FStatHelper::IsDocument( aFileName ) || m_aTemplateName=="$$Dummy$$",
532 "TemplatePtr but no template exist!" );
533 }
534
535 return mxTemplate.get();
536}
537
539{
540 bool bRet = false;
541
542 GetTemplateDoc(rDoc);
543 if( mxTemplate.is() )
544 {
546 rDoc.ReplaceStyles( *mxTemplate );
548 bRet = true;
549 }
550
551 return bRet;
552}
553
555{
556 mxTemplate.clear();
557}
558
559void Reader::SetTemplateName( const OUString& rDir )
560{
561 if( !rDir.isEmpty() && m_aTemplateName != rDir )
562 {
564 m_aTemplateName = rDir;
565 }
566}
567
569{
571 mxTemplate = new SwDoc;
572 mxTemplate->getIDocumentSettingAccess().set(DocumentSettingId::BROWSE_MODE, m_bTemplateBrowseMode );
573 mxTemplate->getIDocumentDeviceAccess().getPrinter( true );
574 mxTemplate->RemoveAllFormatLanguageDependencies();
575 m_aCheckDateTime = Date( 1, 1, 2300 ); // year 2300 should be sufficient
576 m_aTemplateName = "$$Dummy$$";
577}
578
579// Users that do not need to open these Streams / Storages,
580// have to override this method
582{
583 OSL_ENSURE( m_pMedium, "Where is the Media??" );
584
585 if( m_pMedium->IsStorage() )
586 {
588 {
590 return true;
591 }
592 }
593 else
594 {
597 {
599 m_pStream = nullptr;
600 }
601 else if ( !(SwReaderType::Stream & GetReaderType()) )
602 {
603 m_pStream = nullptr;
604 return false;
605 }
606
607 return true;
608 }
609 return false;
610}
611
613{
615}
616
617void Reader::SetFltName( const OUString& )
618{
619}
620
622{
623 rFrameSet.Put( SvxLRSpaceItem(RES_LR_SPACE) );
624 rFrameSet.Put( SvxULSpaceItem(RES_UL_SPACE) );
625 rFrameSet.Put( SvxBoxItem(RES_BOX) );
626}
627
629{
630 sal_uInt16 const s_ids[3] = {
632 };
633 for (sal_uInt16 i : s_ids)
634 {
636
637 pFrameFormat->ResetFormatAttr( RES_LR_SPACE );
638 pFrameFormat->ResetFormatAttr( RES_UL_SPACE );
639 pFrameFormat->ResetFormatAttr( RES_BOX );
640 }
641}
642
643 // read the sections of the document, which is equal to the medium.
644 // returns the count of it
645size_t Reader::GetSectionList(SfxMedium&, std::vector<OUString>&) const
646{
647 return 0;
648}
649
650bool SwReader::HasGlossaries( const Reader& rOptions )
651{
652 // copy variables
653 Reader* po = const_cast<Reader*>(&rOptions);
654 po->m_pStream = mpStrm;
655 po->m_pStorage = mpStg;
656 po->m_bInsertMode = false;
657
658 // if a Medium is selected, get its Stream
659 bool bRet = false;
660 if( nullptr == (po->m_pMedium = mpMedium ) || po->SetStrmStgPtr() )
661 bRet = po->HasGlossaries();
662 return bRet;
663}
664
665bool SwReader::ReadGlossaries( const Reader& rOptions,
666 SwTextBlocks& rBlocks, bool bSaveRelFiles )
667{
668 // copy variables
669 Reader* po = const_cast<Reader*>(&rOptions);
670 po->m_pStream = mpStrm;
671 po->m_pStorage = mpStg;
672 po->m_bInsertMode = false;
673
674 // if a Medium is selected, get its Stream
675 bool bRet = false;
676 if( nullptr == (po->m_pMedium = mpMedium ) || po->SetStrmStgPtr() )
677 bRet = po->ReadGlossaries( rBlocks, bSaveRelFiles );
678 return bRet;
679}
680
682{
683 return false;
684}
685
687{
688 return false;
689}
690
692{
694}
695
696/*
697 * Writer
698 */
699
700/*
701 * Constructors, Destructors are inline (inc/shellio.hxx).
702 */
703
704SwWriter::SwWriter(SvStream& rStrm, SwCursorShell &rShell, bool bInWriteAll)
705 : m_pStrm(&rStrm), m_pMedium(nullptr), m_pOutPam(nullptr), m_pShell(&rShell),
706 m_rDoc(*rShell.GetDoc()), m_bWriteAll(bInWriteAll)
707{
708}
709
711 : m_pStrm(&rStrm), m_pMedium(nullptr), m_pOutPam(nullptr), m_pShell(nullptr), m_rDoc(rDocument),
712 m_bWriteAll(true)
713{
714}
715
716SwWriter::SwWriter(SvStream& rStrm, SwPaM& rPam, bool bInWriteAll)
717 : m_pStrm(&rStrm), m_pMedium(nullptr), m_pOutPam(&rPam), m_pShell(nullptr),
718 m_rDoc(rPam.GetDoc()), m_bWriteAll(bInWriteAll)
719{
720}
721
722SwWriter::SwWriter( uno::Reference < embed::XStorage > xStg, SwDoc &rDocument)
723 : m_pStrm(nullptr), m_xStg( std::move(xStg) ), m_pMedium(nullptr), m_pOutPam(nullptr), m_pShell(nullptr), m_rDoc(rDocument), m_bWriteAll(true)
724{
725}
726
727SwWriter::SwWriter(SfxMedium& rMedium, SwCursorShell &rShell, bool bInWriteAll)
728 : m_pStrm(nullptr), m_pMedium(&rMedium), m_pOutPam(nullptr), m_pShell(&rShell),
729 m_rDoc(*rShell.GetDoc()), m_bWriteAll(bInWriteAll)
730{
731}
732
733SwWriter::SwWriter(SfxMedium& rMedium, SwDoc &rDocument)
734 : m_pStrm(nullptr), m_pMedium(&rMedium), m_pOutPam(nullptr), m_pShell(nullptr), m_rDoc(rDocument),
735 m_bWriteAll(true)
736{
737}
738
739static bool isFlyNode(const SwPaM& pam)
740{
741 return *pam.GetPoint() == *pam.GetMark()
742 && (pam.GetPoint()->GetNode().IsOLENode() || pam.GetPoint()->GetNode().IsGrfNode());
743}
744
745ErrCode SwWriter::Write( WriterRef const & rxWriter, const OUString* pRealFileName )
746{
747 // #i73788#
748 SwPauseThreadStarting aPauseThreadStarting;
749
750 bool bHasMark = false;
751 std::shared_ptr<SwUnoCursor> pTempCursor;
752 SwPaM * pPam;
753
755
757 {
758 m_bWriteAll = true;
759 xDoc = new SwDoc;
760
761 // Copy parts of a table:
762 // Create a table with the width of the original and copy the selected cells.
763 // The sizes are corrected by ratio.
764
765 // search the layout for cells
766 SwSelBoxes aBoxes;
767 GetTableSel( *m_pShell, aBoxes );
768 const SwTableNode* pTableNd = static_cast<const SwTableNode*>(aBoxes[0]->GetSttNd()->StartOfSectionNode());
769 SwNodeIndex aIdx( xDoc->GetNodes().GetEndOfExtras(), 2 );
770 SwContentNode *pNd = aIdx.GetNode().GetContentNode();
771 OSL_ENSURE( pNd, "Node not found" );
772 SwPosition aPos( aIdx, pNd, 0 );
773 pTableNd->GetTable().MakeCopy( *xDoc, aPos, aBoxes );
774 }
775
776 if( !m_bWriteAll && ( m_pShell || m_pOutPam ))
777 {
778 if( m_pShell )
779 pPam = m_pShell->GetCursor();
780 else
781 pPam = m_pOutPam;
782
783 SwPaM *pEnd = pPam;
784
785 // 1st round: Check if there is a selection
786 do
787 {
788 bHasMark = pPam->HasMark() || isFlyNode(*pPam);
789 pPam = pPam->GetNext();
790 } while (!bHasMark && pPam != pEnd);
791
792 // if there is no selection, select the whole document
793 if(!bHasMark)
794 {
795 if( m_pShell )
796 {
797 m_pShell->Push();
798 m_pShell->SttEndDoc(true);
799 m_pShell->SetMark();
800 m_pShell->SttEndDoc(false);
801 }
802 else
803 {
804 pPam = new SwPaM( *pPam, pPam );
805 pPam->Move( fnMoveBackward, GoInDoc );
806 pPam->SetMark();
807 pPam->Move( fnMoveForward, GoInDoc );
808 }
809 }
810 // pPam is still the current Cursor !!
811 }
812 else
813 {
814 // no Shell or write-everything -> create a Pam
815 SwDoc* pOutDoc = xDoc.is() ? xDoc.get() : &m_rDoc;
816 pTempCursor = pOutDoc->CreateUnoCursor(
817 SwPosition(pOutDoc->GetNodes().GetEndOfContent()), false);
818 pPam = pTempCursor.get();
819 if( pOutDoc->IsClipBoard() )
820 {
821 pPam->Move( fnMoveBackward, GoInDoc );
822 pPam->SetMark();
823 pPam->Move( fnMoveForward, GoInDoc );
824 }
825 else
826 {
827 pPam->SetMark();
828 pPam->Move( fnMoveBackward, GoInDoc );
829 }
830 }
831
832 rxWriter->m_bWriteAll = m_bWriteAll;
833 SwDoc* pOutDoc = xDoc.is() ? xDoc.get() : &m_rDoc;
834
835 // If the default PageDesc has still the initial value,
836 // (e.g. if no printer was set) then set it to DIN A4.
837 // #i37248# - Modifications are only allowed at a new document.
838 // <pOutDoc> contains a new document, if <xDoc> is set - see above.
839 if ( xDoc.is() && !pOutDoc->getIDocumentDeviceAccess().getPrinter( false ) )
840 {
841 const SwPageDesc& rPgDsc = pOutDoc->GetPageDesc( 0 );
842 //const SwPageDesc& rPgDsc = *pOutDoc->GetPageDescFromPool( RES_POOLPAGE_STANDARD );
843 const SwFormatFrameSize& rSz = rPgDsc.GetMaster().GetFrameSize();
844 // Clipboard-Document is always created w/o printer; thus the
845 // default PageDesc is always aug LONG_MAX !! Set then to DIN A4
846 if( LONG_MAX == rSz.GetHeight() || LONG_MAX == rSz.GetWidth() )
847 {
848 SwPageDesc aNew( rPgDsc );
849 SwFormatFrameSize aNewSz( rSz );
851 aNewSz.SetHeight( a4.Width() );
852 aNewSz.SetWidth( a4.Height() );
853 aNew.GetMaster().SetFormatAttr( aNewSz );
854 pOutDoc->ChgPageDesc( 0, aNew );
855 }
856 }
857
858 bool bLockedView(false);
859 SwEditShell* pESh = pOutDoc->GetEditShell();
860 if( pESh )
861 {
862 bLockedView = pESh->IsViewLocked();
863 pESh->LockView( true ); //lock visible section
864 pESh->StartAllAction();
865 }
866
867 std::unique_ptr<PurgeGuard, o3tl::default_delete<PurgeGuard>> xGuard(new PurgeGuard(*pOutDoc));
868
869 pOutDoc->SetInWriting(true);
870 ErrCode nError = ERRCODE_NONE;
871 if( m_pMedium )
872 nError = rxWriter->Write( *pPam, *m_pMedium, pRealFileName );
873 else if( m_pStrm )
874 nError = rxWriter->Write( *pPam, *m_pStrm, pRealFileName );
875 else if( m_xStg.is() )
876 nError = rxWriter->Write( *pPam, m_xStg, pRealFileName );
877 pOutDoc->SetInWriting(false);
878
879 xGuard.reset();
880
881 if( pESh )
882 {
883 pESh->EndAllAction();
884 pESh->LockView( bLockedView );
885 }
886
887 // If the selection was only created for printing, reset the old cursor before returning
888 if( !m_bWriteAll && ( m_pShell || m_pOutPam ))
889 {
890 if(!bHasMark)
891 {
892 if( m_pShell )
894 else
895 delete pPam;
896 }
897 }
898 else
899 {
900 // Everything was written successfully? Tell the document!
901 if ( !nError.IsError() && !xDoc.is() )
902 {
904 // #i38810# - reset also flag, that indicates updated links
906 }
907 }
908
909 if ( xDoc.is() )
910 {
911 pTempCursor.reset();
912 xDoc.clear();
913 m_bWriteAll = false;
914 }
915
916 return nError;
917}
918
919bool SetHTMLTemplate( SwDoc & rDoc )
920{
921 // get template name of the Sfx-HTML-Filter !!!
922 if( !ReadHTML->GetTemplateDoc(rDoc) )
924
925 bool bRet = ReadHTML->SetTemplate( rDoc );
926
927 SwNodes& rNds = rDoc.GetNodes();
928 SwNodeIndex aIdx( rNds.GetEndOfExtras(), 1 );
929 SwContentNode* pCNd = rNds.GoNext( &aIdx );
930 if( pCNd )
931 {
932 pCNd->SetAttr
935 }
936
937 return bRet;
938}
939
940/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@ Ignore
ignore Redlines
bool IsError() const
virtual SfxPrinter * getPrinter(bool bCreate) const =0
Return the printer set at the document.
virtual void SetFixFields(const DateTime *pNewDateTime)=0
virtual void SetLinksUpdated(const bool bNewLinksUpdated)=0
virtual void ResetModified()=0
virtual SwFrameFormat * GetFrameFormatFromPool(sal_uInt16 nId)=0
Return required automatic format.
virtual SwPageDesc * GetPageDescFromPool(sal_uInt16 nId, bool bRegardLanguage=true)=0
Return required automatic page style.
virtual SwTextFormatColl * GetTextCollFromPool(sal_uInt16 nId, bool bRegardLanguage=true)=0
Return "Auto-Collection with ID.
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
bool HasError() const
bool SetTemplate(SwDoc &rDoc)
Definition: shellio.cxx:538
virtual bool HasGlossaries() const
Definition: shellio.cxx:681
SwDoc * GetTemplateDoc(SwDoc &rDoc)
Definition: shellio.cxx:461
bool m_bInsertMode
Definition: shellio.hxx:221
static void ResetFrameFormats(SwDoc &rDoc)
Definition: shellio.cxx:628
tools::Time m_aTimeStamp
Definition: shellio.hxx:211
SvStream * m_pStream
Definition: shellio.hxx:215
bool m_bTemplateBrowseMode
Definition: shellio.hxx:222
bool m_bHasAskTemplateName
Definition: shellio.hxx:226
tools::SvRef< SotStorage > m_pStorage
Definition: shellio.hxx:216
OUString m_aTemplateName
Definition: shellio.hxx:208
virtual bool ReadGlossaries(SwTextBlocks &, bool bSaveRelFiles) const
Definition: shellio.cxx:686
virtual OUString GetTemplateName(SwDoc &rDoc) const
Definition: shellio.cxx:455
rtl::Reference< SwDoc > mxTemplate
Definition: shellio.hxx:207
bool m_bSkipImages
Definition: shellio.hxx:228
SwgReaderOption m_aOption
Definition: shellio.hxx:220
void MakeHTMLDummyTemplateDoc()
Definition: shellio.cxx:568
virtual ~Reader()
Definition: shellio.cxx:451
DateTime m_aCheckDateTime
Definition: shellio.hxx:212
void SetReadUTF8(bool bSet)
Definition: shellio.hxx:256
void SetBlockMode(bool bSet)
Definition: shellio.hxx:259
void SetIgnoreHTMLComments(bool bSet)
Definition: shellio.hxx:264
SfxMedium * m_pMedium
Definition: shellio.hxx:218
void ClearTemplate()
Definition: shellio.cxx:554
virtual void SetFltName(const OUString &rFltNm)
Definition: shellio.cxx:617
virtual bool SetStrmStgPtr()
Definition: shellio.cxx:581
void SetTemplateName(const OUString &rDir)
Definition: shellio.cxx:559
virtual SwReaderType GetReaderType()
Definition: shellio.cxx:612
virtual size_t GetSectionList(SfxMedium &rMedium, std::vector< OUString > &rStrings) const
Definition: shellio.cxx:645
void SetOrganizerMode(bool bSet)
Definition: shellio.hxx:262
virtual ErrCode Read(SwDoc &, const OUString &rBaseURL, SwPaM &, const OUString &)=0
Reader()
Definition: shellio.cxx:441
css::uno::Reference< css::embed::XStorage > m_xStorage
Definition: shellio.hxx:217
Date m_aDateStamp
Definition: shellio.hxx:210
static void ResetFrameFormatAttrs(SfxItemSet &rFrameSet)
Definition: shellio.cxx:621
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const std::shared_ptr< const SfxFilter > & GetFilter() const
OUString GetBaseURL(bool bForSaving=false)
bool IsSkipImages() const
css::uno::Reference< css::embed::XStorage > GetStorage(bool bCreateTempFile=true)
bool IsStorage()
SvStream * GetInStream()
constexpr tools::Long Height() const
constexpr tools::Long Width() const
static bool IsStorageFile(OUString const &rFileName)
virtual SwReaderType GetReaderType() override
Definition: shellio.cxx:691
virtual void ResetError()
sal_uInt64 Seek(sal_uInt64 nPos)
bool IsWriter() const
static Size GetPaperSize(Paper ePaper, MapUnit eUnit=MapUnit::MapTwip)
tools::Long GetHeight() const
tools::Long GetWidth() const
void SetHeight(tools::Long n)
void SetWidth(tools::Long n)
bool m_bIncludeHidden
Definition: shellio.hxx:69
OUString m_sFont
Definition: shellio.hxx:64
LanguageType m_nLanguage
Definition: shellio.hxx:66
void Reset()
Definition: shellio.cxx:81
rtl_TextEncoding m_eCharSet
Definition: shellio.hxx:65
LineEnd m_eCRLF_Flag
Definition: shellio.hxx:67
bool m_bIncludeBOM
Definition: shellio.hxx:68
virtual bool SetAttr(const SfxPoolItem &)
made virtual
Definition: node.cxx:1586
virtual sal_Int32 Len() const
Definition: node.cxx:1256
virtual SwFormatColl * ChgFormatColl(SwFormatColl *)
Definition: node.cxx:1258
bool Pop(PopMode, ::std::optional< SwCallLink > &roLink)
void Push()
store a copy of the current cursor on the cursor stack
Definition: crsrsh.cxx:2550
bool SttEndDoc(bool bStt)
Definition: crsrsh.cxx:579
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:194
void SetMark()
Definition: crsrsh.hxx:906
bool IsTableMode() const
Definition: crsrsh.hxx:668
SwDoc & GetDoc()
Document is created after calling Read(...).
Definition: docfact.cxx:33
rtl::Reference< SwDoc > mxDoc
Definition: docfac.hxx:29
SwDoc * GetDoc()
returns Doc. But be careful!
Definition: docsh.hxx:204
Definition: doc.hxx:197
IDocumentState const & getIDocumentState() const
Definition: doc.cxx:408
IDocumentDeviceAccess const & getIDocumentDeviceAccess() const
Definition: doc.cxx:252
void RemoveAllFormatLanguageDependencies()
Definition: poolfmt.cxx:284
bool IsClipBoard() const
Definition: doc.hxx:978
IDocumentLinksAdministration const & getIDocumentLinksAdministration() const
Definition: doc.cxx:274
SwNodes & GetNodes()
Definition: doc.hxx:422
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:371
SwEditShell const * GetEditShell() const
Definition: doccorr.cxx:330
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:440
void ChgPageDesc(const OUString &rName, const SwPageDesc &)
Definition: docdesc.cxx:978
std::shared_ptr< SwUnoCursor > CreateUnoCursor(const SwPosition &rPos, bool bTableCursor=false)
Definition: doc.cxx:1810
void ReplaceStyles(const SwDoc &rSource, bool bIncludePageStyles=true)
Definition: docfmt.cxx:1568
void SetInWriting(bool bNew)
Definition: doc.hxx:973
const SwPageDesc & GetPageDesc(const size_t i) const
Definition: doc.hxx:896
void StartAllAction()
For all views of this document.
Definition: edws.cxx:86
void EndAllAction()
Definition: edws.cxx:97
FlyAnchors.
Definition: fmtanchr.hxx:37
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:67
SwNode * GetAnchorNode() const
Definition: atrfrm.cxx:1614
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
Definition: fmtpdsc.hxx:36
const SwFormatFrameSize & GetFrameSize(bool=true) const
Definition: fmtfsize.hxx:104
virtual bool ResetFormatAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: format.cxx:618
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:82
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:88
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:447
Style of a layout element.
Definition: frmfmt.hxx:72
virtual void DelFrames()
Destroys all Frames in aDepend (Frames are identified via dynamic_cast).
Definition: atrfrm.cxx:2733
virtual void MakeFrames()
Creates the views.
Definition: atrfrm.cxx:2744
Unsorted, undeleting SwFrameFormat vector.
Definition: docary.hxx:179
Marks a node in the document model.
Definition: ndindex.hxx:31
SwNode & GetNode() const
Definition: ndindex.hxx:123
Base class of the Writer document model elements.
Definition: node.hxx:98
bool IsGrfNode() const
Definition: node.hxx:195
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:901
const SwStartNode * FindTableBoxStartNode() const
Definition: node.hxx:218
const SwStartNode * FindFooterStartNode() const
Definition: node.hxx:226
SwTableBox * GetTableBox() const
If node is in a table return the respective table box.
Definition: node.cxx:772
bool IsContentNode() const
Definition: node.hxx:188
const SwStartNode * FindHeaderStartNode() const
Definition: node.hxx:224
bool IsTextNode() const
Definition: node.hxx:190
SwContentNode * GetContentNode()
Definition: node.hxx:666
bool IsOLENode() const
Definition: node.hxx:193
SwNode & GetEndOfExtras() const
This is the last EndNode of a special section.
Definition: ndarr.hxx:163
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
Definition: ndarr.hxx:165
static SwContentNode * GoPrevious(SwNodeIndex *)
Definition: nodes.cxx:1333
SwContentNode * GoNext(SwNodeIndex *) const
Definition: nodes.cxx:1299
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:188
const SwPosition * GetMark() const
Definition: pam.hxx:255
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:643
SwContentNode * GetPointContentNode() const
Definition: pam.hxx:279
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
Definition: pam.cxx:657
SwPaM * GetNext()
Definition: pam.hxx:314
const SwPosition * GetPoint() const
Definition: pam.hxx:253
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:251
SwFrameFormat & GetMaster()
Definition: pagedesc.hxx:238
Helper class to pause starting of threads during existence of an instance of this class.
SwPaM * mpCursor
Definition: shellio.hxx:153
SwReader(SfxMedium &, OUString aFilename, SwDoc *pDoc=nullptr)
Definition: shellio.cxx:412
bool mbSkipImages
Definition: shellio.hxx:156
ErrCode Read(const Reader &)
Definition: shellio.cxx:91
bool ReadGlossaries(const Reader &, SwTextBlocks &, bool bSaveRelFiles)
Definition: shellio.cxx:665
tools::SvRef< SotStorage > mpStg
Definition: shellio.hxx:149
bool HasGlossaries(const Reader &)
Definition: shellio.cxx:650
void SetSkipImages(bool bSkipImages)
Definition: shellio.hxx:180
SvStream * mpStrm
Definition: shellio.hxx:148
void SetBaseURL(const OUString &rURL)
Definition: shellio.hxx:179
css::uno::Reference< css::embed::XStorage > mxStg
Definition: shellio.hxx:150
OUString maFileName
Definition: shellio.hxx:154
SfxMedium * mpMedium
Definition: shellio.hxx:151
OUString msBaseURL
Definition: shellio.hxx:155
Starts a section of nodes in the document model.
Definition: node.hxx:348
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:443
const SwTable & GetTable() const
Definition: node.hxx:542
bool MakeCopy(SwDoc &, const SwPosition &, const SwSelBoxes &, bool bCpyName=false, const OUString &rStyleName="") const
Definition: tblrwcl.cxx:2056
void FileLoadedInitHints()
initialize the hints after file loading (which takes shortcuts)
Definition: ndtxt.cxx:277
Undo for Insert -> Text from file.
Definition: undobj.hxx:287
static bool IsCreateUndoForNewFly(SwFormatAnchor const &rAnchor, SwNodeOffset const nStartNode, SwNodeOffset const nEndNode)
This is not the same as IsDestroyFrameAnchoredAtChar() and intentionally so: because the SwUndoInsert...
Definition: untblk.cxx:174
iterator end()
Definition: docary.hxx:91
iterator insert(iterator aIt, Value const &rVal)
Definition: docary.hxx:96
bool IsAlive(typename std::remove_pointer< Value >::type const *const p) const
check that given format is still alive (i.e. contained here)
Definition: docary.hxx:141
bool IsViewLocked() const
Definition: viewsh.hxx:490
void LockView(bool b)
Definition: viewsh.hxx:491
SvStream * m_pStrm
Definition: shellio.hxx:501
SfxMedium * m_pMedium
Definition: shellio.hxx:503
SwDoc & m_rDoc
Definition: shellio.hxx:507
bool m_bWriteAll
Definition: shellio.hxx:509
SwPaM * m_pOutPam
Definition: shellio.hxx:505
SwCursorShell * m_pShell
Definition: shellio.hxx:506
SwWriter(SvStream &, SwCursorShell &, bool bWriteAll=false)
Definition: shellio.cxx:704
ErrCode Write(WriterRef const &rxWriter, const OUString *=nullptr)
Definition: shellio.cxx:745
css::uno::Reference< css::embed::XStorage > m_xStg
Definition: shellio.hxx:502
bool IsPageDescs() const
Definition: shellio.hxx:119
bool IsFormatsOnly() const
Definition: shellio.hxx:114
FrameFormatsContainer::size_type size_type
static bool IsFuzzing()
SwDoc & m_rDoc
Definition: docbm.cxx:1228
#define ERRCODE_NONE
Reader * ReadXML
Definition: fltini.cxx:46
Reader * ReadHTML
Definition: fltini.cxx:46
GtkMediaStream * m_pStream
constexpr TypedWhichId< SwDrawFrameFormat > RES_DRAWFRMFMT(165)
constexpr TypedWhichId< SvxBoxItem > RES_BOX(112)
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(97)
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(98)
Shell * m_pShell
constexpr OUStringLiteral sRtfWH
Definition: iodetect.hxx:33
constexpr OUStringLiteral FILTER_RTF
RTF filter.
Definition: iodetect.hxx:32
constexpr OUStringLiteral FILTER_DOCX
Definition: iodetect.hxx:41
sal_Int64 n
#define LANGUAGE_SYSTEM
LineEnd GetSystemLineEnd()
const long LONG_MAX
SVL_DLLPUBLIC bool IsDocument(const OUString &rURL)
SVL_DLLPUBLIC bool GetModifiedDateTimeOfFile(const OUString &rURL, Date *pDate, tools::Time *pTime)
size
int i
void SvStream & rStrm
constexpr OUStringLiteral EMPTY
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
Definition: nodeoffset.hxx:16
bool GoInDoc(SwPaM &rPam, SwMoveFnCollection const &fnMove)
Definition: pam.cxx:1182
SwMoveFnCollection const & fnMoveBackward
Definition: paminit.cxx:60
SwMoveFnCollection const & fnMoveForward
SwPam::Move()/Find() default argument.
Definition: paminit.cxx:61
PAPER_A4
@ RES_POOLCOLL_TEXT
Text body.
Definition: poolfmt.hxx:251
@ RES_POOLPAGE_HTML
HTML.
Definition: poolfmt.hxx:176
@ RES_POOLFRM_FRAME
Frame.
Definition: poolfmt.hxx:154
@ RES_POOLFRM_OLE
OLE.
Definition: poolfmt.hxx:156
@ RES_POOLFRM_GRAPHIC
Graphics.
Definition: poolfmt.hxx:155
bool SetHTMLTemplate(SwDoc &rDoc)
Definition: shellio.cxx:919
static bool isFlyNode(const SwPaM &pam)
Definition: shellio.cxx:739
static bool sw_MergePortions(SwNode *pNode, void *)
Definition: shellio.cxx:72
SwReaderType
Definition: shellio.hxx:186
Marks a position in the document model.
Definition: pam.hxx:38
void Adjust(SwNodeOffset nDelta)
Adjust node position, and resets content position to zero.
Definition: pam.cxx:257
SwNode & GetNode() const
Definition: pam.hxx:81
void Assign(const SwNode &rNd, SwNodeOffset nDelta, sal_Int32 nContentOffset=0)
These all set both nNode and nContent.
Definition: pam.cxx:231
sal_Int32 GetContentIndex() const
Definition: pam.hxx:85
#define ERR_SWG_FILE_FORMAT_ERROR
Definition: swerror.h:24
void GetTableSel(const SwCursorShell &rShell, SwSelBoxes &rBoxes, const SwTableSearchType eSearchType)
Definition: tblsel.cxx:149