LibreOffice Module sw (master) 1
SwXMLTextBlocks.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 <com/sun/star/embed/ElementModes.hpp>
21#include <com/sun/star/embed/XTransactedObject.hpp>
22#include <com/sun/star/embed/XStorage.hpp>
23#include <com/sun/star/container/ElementExistException.hpp>
24#include <com/sun/star/beans/XPropertySet.hpp>
25#include <osl/file.hxx>
26#include <rtl/ustring.hxx>
27#include <sal/log.hxx>
28#include <sot/exchange.hxx>
29#include <sot/stg.hxx>
30#include <sfx2/docfile.hxx>
31#include <tools/urlobj.hxx>
34#include <o3tl/string_view.hxx>
35
37#include <doc.hxx>
38#include <IDocumentUndoRedo.hxx>
40#include <docsh.hxx>
41#include <pam.hxx>
42#include <swblocks.hxx>
43#include <ndtxt.hxx>
44#include <shellio.hxx>
45#include <poolfmt.hxx>
46#include <SwXMLTextBlocks.hxx>
47#include <swerror.h>
48
49using namespace ::com::sun::star;
50
51void SwXMLTextBlocks::InitBlockMode ( const uno::Reference < embed::XStorage >& rStorage )
52{
53 m_xBlkRoot = rStorage;
54 m_xRoot = nullptr;
55}
56
58{
59 m_xBlkRoot = nullptr;
60 m_xRoot = nullptr;
61}
62
63SwXMLTextBlocks::SwXMLTextBlocks( const OUString& rFile )
64 : SwImpBlocks(rFile)
66{
67 SwDocShell* pDocSh = new SwDocShell ( SfxObjectCreateMode::INTERNAL );
68 if( !pDocSh->DoInitNew() )
69 return;
70 m_bReadOnly = true;
71 m_xDoc = pDocSh->GetDoc();
72 m_xDocShellRef = pDocSh;
73 m_xDoc->SetOle2Link( Link<bool,void>() );
74 m_xDoc->GetIDocumentUndoRedo().DoUndo(false);
75 uno::Reference< embed::XStorage > refStg;
77 Touch(); // If it's created anew -> get a new timestamp
78
79 try
80 {
81 refStg = comphelper::OStorageHelper::GetStorageFromURL( rFile, embed::ElementModes::READWRITE );
82 m_bReadOnly = false;
83 }
84 catch(const uno::Exception&)
85 {
86 //FIXME: couldn't open the file - maybe it's readonly
87 }
88 if( !refStg.is())
89 {
90 try
91 {
92 refStg = comphelper::OStorageHelper::GetStorageFromURL( rFile, embed::ElementModes::READ );
93 }
94 catch(const uno::Exception&)
95 {
96 TOOLS_WARN_EXCEPTION( "sw", "exception while creating AutoText storage");
97 }
98 }
99 InitBlockMode ( refStg );
100 ReadInfo();
102 m_bInfoChanged = false;
103}
104
105SwXMLTextBlocks::SwXMLTextBlocks( const uno::Reference < embed::XStorage >& rStg, const OUString& rName )
106 : SwImpBlocks( rName )
108{
109 SwDocShell* pDocSh = new SwDocShell ( SfxObjectCreateMode::INTERNAL );
110 if( !pDocSh->DoInitNew() )
111 return;
112 m_bReadOnly = false;
113 m_xDoc = pDocSh->GetDoc();
114 m_xDocShellRef = pDocSh;
115 m_xDoc->SetOle2Link( Link<bool,void>() );
116 m_xDoc->GetIDocumentUndoRedo().DoUndo(false);
117
118 InitBlockMode ( rStg );
119 ReadInfo();
120 m_bInfoChanged = false;
121}
122
124{
125 if ( m_bInfoChanged )
126 WriteInfo();
128 if(m_xDocShellRef.is())
129 m_xDocShellRef->DoClose();
130 m_xDocShellRef = nullptr;
131}
132
134{
135 SwDocShell * pDocShell = m_xDoc->GetDocShell();
136 pDocShell->InvalidateModel();
137 pDocShell->ReactivateModel();
138
139 m_xDoc->ClearDoc();
140 pDocShell->ClearEmbeddedObjects();
141}
142
143void SwXMLTextBlocks::AddName( const OUString& rShort, const OUString& rLong, bool bOnlyText )
144{
146 AddName(rShort, rLong, m_aPackageName, bOnlyText);
147}
148
149void SwXMLTextBlocks::AddName( const OUString& rShort, const OUString& rLong,
150 const OUString& rPackageName, bool bOnlyText )
151{
152 sal_uInt16 nIdx = GetIndex( rShort );
153 if (nIdx != USHRT_MAX)
154 {
155 m_aNames.erase( m_aNames.begin() + nIdx );
156 }
157 std::unique_ptr<SwBlockName> pNew(new SwBlockName( rShort, rLong, rPackageName ));
158 pNew->m_bIsOnlyTextFlagInit = true;
159 pNew->m_bIsOnlyText = bOnlyText;
160 m_aNames.insert( std::move(pNew) );
161 m_bInfoChanged = true;
162}
163
165{
166 const OUString aPckName (m_aNames[n]->m_aPackageName);
167 if ( m_xBlkRoot.is() &&
168 m_xBlkRoot->hasByName( aPckName ) && m_xBlkRoot->isStreamElement( aPckName ) )
169 {
170 try
171 {
172 m_xBlkRoot->removeElement ( aPckName );
173 uno::Reference < embed::XTransactedObject > xTrans( m_xBlkRoot, uno::UNO_QUERY );
174 if ( xTrans.is() )
175 xTrans->commit();
176 return ERRCODE_NONE;
177 }
178 catch (const uno::Exception&)
179 {
180 return ERR_SWG_WRITE_ERROR;
181 }
182 }
183 return ERRCODE_NONE;
184}
185
186ErrCode SwXMLTextBlocks::Rename( sal_uInt16 nIdx, const OUString& rNewShort )
187{
188 OSL_ENSURE( m_xBlkRoot.is(), "No storage set" );
189 if(!m_xBlkRoot.is())
190 return ERRCODE_NONE;
191 OUString aOldName (m_aNames[nIdx]->m_aPackageName);
192 m_aShort = rNewShort;
194
195 if(aOldName != m_aPackageName)
196 {
197 if (IsOnlyTextBlock ( nIdx ) )
198 {
199 OUString sExt(".xml");
200 OUString aOldStreamName = aOldName + sExt;
201 OUString aNewStreamName = m_aPackageName + sExt;
202
203 m_xRoot = m_xBlkRoot->openStorageElement( aOldName, embed::ElementModes::READWRITE );
204 try
205 {
206 m_xRoot->renameElement ( aOldStreamName, aNewStreamName );
207 }
208 catch(const container::ElementExistException&)
209 {
210 SAL_WARN("sw", "Couldn't rename " << aOldStreamName << " to " << aNewStreamName);
211 }
212 uno::Reference < embed::XTransactedObject > xTrans( m_xRoot, uno::UNO_QUERY );
213 if ( xTrans.is() )
214 xTrans->commit();
215 m_xRoot = nullptr;
216 }
217
218 try
219 {
220 m_xBlkRoot->renameElement ( aOldName, m_aPackageName );
221 }
222 catch(const container::ElementExistException&)
223 {
224 SAL_WARN("sw", "Couldn't rename " << aOldName << " to " << m_aPackageName);
225 }
226 }
227 uno::Reference < embed::XTransactedObject > xTrans( m_xBlkRoot, uno::UNO_QUERY );
228 if ( xTrans.is() )
229 xTrans->commit();
230 // No need to commit xBlkRoot here as SwTextBlocks::Rename calls
231 // WriteInfo which does the commit
232 return ERRCODE_NONE;
233}
234
235ErrCode SwXMLTextBlocks::CopyBlock( SwImpBlocks& rDestImp, OUString& rShort,
236 const OUString& rLong)
237{
238 ErrCode nError = ERRCODE_NONE;
239 OpenFile();
240 rDestImp.OpenFile(false);
241 const OUString aGroup( rShort );
242 bool bTextOnly = IsOnlyTextBlock ( rShort ) ;//pImp->pBlkRoot->IsStream( aGroup );
243 sal_uInt16 nIndex = GetIndex ( rShort );
244 OUString sPackageName( GetPackageName (nIndex) );
245 OUString sDestShortName( sPackageName );
246 sal_uInt16 nIdx = 0;
247
248 OSL_ENSURE( m_xBlkRoot.is(), "No storage set" );
249 if(!m_xBlkRoot.is())
250 return ERR_SWG_WRITE_ERROR;
251
252 uno::Reference < container::XNameAccess > xAccess(static_cast<SwXMLTextBlocks&>(rDestImp).m_xBlkRoot);
253 while ( xAccess->hasByName( sDestShortName ) )
254 {
255 ++nIdx;
256 // If someone is that crazy ...
257 if(USHRT_MAX == nIdx)
258 {
259 CloseFile();
260 rDestImp.CloseFile();
261 return ERR_SWG_WRITE_ERROR;
262 }
263 sDestShortName = sPackageName + OUString::number( nIdx );
264 }
265
266 try
267 {
268 uno::Reference < embed::XStorage > rSourceRoot = m_xBlkRoot->openStorageElement( aGroup, embed::ElementModes::READ );
269 uno::Reference < embed::XStorage > rDestRoot = static_cast<SwXMLTextBlocks&>(rDestImp).m_xBlkRoot->openStorageElement( sDestShortName, embed::ElementModes::READWRITE );
270 rSourceRoot->copyToStorage( rDestRoot );
271 }
272 catch (const uno::Exception&)
273 {
274 nError = ERR_SWG_WRITE_ERROR;
275 }
276
277 if(!nError)
278 {
279 rShort = sDestShortName;
280 static_cast<SwXMLTextBlocks&>(rDestImp).AddName( rShort, rLong, bTextOnly );
281 static_cast<SwXMLTextBlocks&>(rDestImp).MakeBlockList();
282 }
283 CloseFile();
284 rDestImp.CloseFile();
285 return nError;
286}
287
288ErrCode SwXMLTextBlocks::StartPutBlock( const OUString& rShort, const OUString& rPackageName )
289{
290 OSL_ENSURE( m_xBlkRoot.is(), "No storage set" );
291 if(!m_xBlkRoot.is())
292 return ERRCODE_NONE;
293 GetIndex ( rShort );
294 try
295 {
296 m_xRoot = m_xBlkRoot->openStorageElement( rPackageName, embed::ElementModes::READWRITE );
297
298 uno::Reference< beans::XPropertySet > xRootProps( m_xRoot, uno::UNO_QUERY_THROW );
299 OUString aMime( SotExchange::GetFormatMimeType( SotClipboardFormatId::STARWRITER_8 ) );
300 xRootProps->setPropertyValue( "MediaType", uno::Any( aMime ) );
301 }
302 catch (const uno::Exception&)
303 {
304 }
305 return ERRCODE_NONE;
306}
307
308ErrCode SwXMLTextBlocks::BeginPutDoc( const OUString& rShort, const OUString& rLong )
309{
310 // Store in base class
311 m_aShort = rShort;
312 m_aLong = rLong;
314 SetIsTextOnly( rShort, false);
315 return StartPutBlock (rShort, m_aPackageName);
316}
317
319{
320 ErrCode nRes = ERRCODE_NONE; // dead variable, this always returns 0
321 SwXmlFlags nCommitFlags = m_nFlags;
322
323 WriterRef xWrt;
324 ::GetXMLWriter ( std::u16string_view(), GetBaseURL(), xWrt);
325 SwWriter aWriter (m_xRoot, *m_xDoc );
326
327 xWrt->m_bBlock = true;
328 nRes = aWriter.Write ( xWrt );
329 xWrt->m_bBlock = false;
330 // Save OLE objects if there are some
331 SwDocShell *pDocSh = m_xDoc->GetDocShell();
332
333 bool bHasChildren = pDocSh && pDocSh->GetEmbeddedObjectContainer().HasEmbeddedObjects();
334 if( !nRes && bHasChildren )
335 {
336 // we have to write to the temporary storage first, since the used below functions are optimized
337 // TODO/LATER: it is only a temporary solution, that should be changed soon, the used methods should be
338 // called without optimization
339 bool bOK = false;
340
341 if ( m_xRoot.is() )
342 {
343 std::unique_ptr<SfxMedium> pTmpMedium;
344 try
345 {
346 uno::Reference< embed::XStorage > xTempStorage =
348
349 m_xRoot->copyToStorage( xTempStorage );
350
351 // TODO/LATER: no progress bar?!
352 // TODO/MBA: strange construct
353 pTmpMedium.reset(new SfxMedium(xTempStorage, GetBaseURL()));
354 bool bTmpOK = pDocSh->SaveAsChildren( *pTmpMedium );
355 if( bTmpOK )
356 bTmpOK = pDocSh->SaveCompletedChildren();
357
358 xTempStorage->copyToStorage( m_xRoot );
359 bOK = bTmpOK;
360 }
361 catch(const uno::Exception&)
362 {
363 }
364 }
365
366 if( !bOK )
367 nRes = ERR_SWG_WRITE_ERROR;
368 }
369
370 try
371 {
372 uno::Reference < embed::XTransactedObject > xTrans( m_xRoot, uno::UNO_QUERY );
373 if ( xTrans.is() )
374 xTrans->commit();
375 m_xRoot = nullptr;
376 if ( nCommitFlags == SwXmlFlags::NONE )
377 {
378 uno::Reference < embed::XTransactedObject > xTmpTrans( m_xBlkRoot, uno::UNO_QUERY );
379 if ( xTmpTrans.is() )
380 xTmpTrans->commit();
381 }
382 }
383 catch (const uno::Exception&)
384 {
385 }
386
387 //TODO/LATER: error handling
388 return ERRCODE_NONE;
389}
390
392{
393 std::unique_ptr<SwPaM> pPaM = MakePaM();
394 ErrCode nErr = PutBlock();
395 return nErr;
396}
397
398ErrCode SwXMLTextBlocks::GetText( std::u16string_view rShort, OUString& rText )
399{
400 return GetBlockText( rShort, rText );
401}
402
404{
405 WriteInfo();
406 return ERRCODE_NONE;
407}
408
410{
411 bool bRet = false;
412 if( bOn )
413 {
415 {
416 OSL_ENSURE( false, "Nested calls are not allowed");
417 }
418 else if( !IsFileChanged() )
419 {
420 bRet = ERRCODE_NONE == OpenFile( false );
421 if( bRet )
422 {
424 m_bInPutMuchBlocks = true;
425 }
426 }
427 }
428 else if( m_bInPutMuchBlocks )
429 {
431 if( m_xBlkRoot.is() )
432 {
433 try
434 {
435 uno::Reference < embed::XTransactedObject > xTrans( m_xBlkRoot, uno::UNO_QUERY );
436 if ( xTrans.is() )
437 xTrans->commit();
439 CloseFile();
440 Touch();
441 m_bInPutMuchBlocks = false;
442 bRet = true;
443 }
444 catch (const uno::Exception&)
445 {
446 }
447 }
448 }
449 return bRet;
450}
451
453{
454 ErrCode nRet = ERRCODE_NONE;
455 try
456 {
457 uno::Reference < embed::XStorage > refStg = comphelper::OStorageHelper::GetStorageFromURL( m_aFile,
458 bRdOnly ? embed::ElementModes::READ : embed::ElementModes::READWRITE );
459 InitBlockMode ( refStg );
460 }
461 catch (const uno::Exception&)
462 {
463 //TODO/LATER: error handling
464 nRet = ErrCode(1);
465 }
466
467 return nRet;
468}
469
471{
472 if (m_bInfoChanged)
473 WriteInfo();
475}
476
477void SwXMLTextBlocks::SetIsTextOnly( const OUString& rShort, bool bNewValue )
478{
479 sal_uInt16 nIdx = GetIndex ( rShort );
480 if (nIdx != USHRT_MAX)
481 m_aNames[nIdx]->m_bIsOnlyText = bNewValue;
482}
483
484bool SwXMLTextBlocks::IsOnlyTextBlock( const OUString& rShort ) const
485{
486 sal_uInt16 nIdx = GetIndex ( rShort );
487 bool bRet = false;
488 if (nIdx != USHRT_MAX)
489 {
490 bRet = m_aNames[nIdx]->m_bIsOnlyText;
491 }
492 return bRet;
493}
494bool SwXMLTextBlocks::IsOnlyTextBlock( sal_uInt16 nIdx ) const
495{
496 return m_aNames[nIdx]->m_bIsOnlyText;
497}
498
499bool SwXMLTextBlocks::IsFileUCBStorage( const OUString & rFileName)
500{
501 OUString aName( rFileName );
502 INetURLObject aObj( aName );
503 if ( aObj.GetProtocol() == INetProtocol::NotValid )
504 {
505 OUString aURL;
506 osl::FileBase::getFileURLFromSystemPath( aName, aURL );
507 aObj.SetURL( aURL );
509 }
510
511 std::unique_ptr<SvStream> pStm = ::utl::UcbStreamHelper::CreateStream( aName, StreamMode::STD_READ );
512 bool bRet = UCBStorage::IsStorageFile( pStm.get() );
513 return bRet;
514}
515
516OUString SwXMLTextBlocks::GeneratePackageName ( std::u16string_view rShort )
517{
518 OString sByte(OUStringToOString(rShort, RTL_TEXTENCODING_UTF7));
519 OUStringBuffer aBuf(OStringToOUString(sByte, RTL_TEXTENCODING_ASCII_US));
520 const sal_Int32 nLen = aBuf.getLength();
521 for (sal_Int32 nPos=0; nPos<nLen; ++nPos)
522 {
523 switch (aBuf[nPos])
524 {
525 case '!':
526 case '/':
527 case ':':
528 case '.':
529 case '\\':
530 aBuf[nPos] = '_';
531 break;
532 default:
533 break;
534 }
535 }
536 return aBuf.makeStringAndClear();
537}
538
539ErrCode SwXMLTextBlocks::PutText( const OUString& rShort, const OUString& rName,
540 const OUString& rText )
541{
542 ErrCode nRes = ERRCODE_NONE;
543 m_aShort = rShort;
544 m_aLong = rName;
545 m_aCurrentText = rText;
546 SetIsTextOnly( m_aShort, true );
548 ClearDoc();
549 nRes = PutBlockText( rShort, rText, m_aPackageName );
550 return nRes;
551}
552
553void SwXMLTextBlocks::MakeBlockText( std::u16string_view rText )
554{
555 SwTextNode* pTextNode = m_xDoc->GetNodes()[ m_xDoc->GetNodes().GetEndOfContent().
556 GetIndex() - 1 ]->GetTextNode();
557 if( pTextNode->GetTextColl() == m_xDoc->GetDfltTextFormatColl() )
558 pTextNode->ChgFormatColl( m_xDoc->getIDocumentStylePoolAccess().GetTextCollFromPool( RES_POOLCOLL_STANDARD ));
559
560 sal_Int32 nPos = 0;
561 do
562 {
563 if ( nPos )
564 {
565 pTextNode = static_cast<SwTextNode*>(pTextNode->AppendNode( SwPosition( *pTextNode ) ));
566 }
567 SwContentIndex aIdx( pTextNode );
568 pTextNode->InsertText( OUString(o3tl::getToken(rText, 0, '\015', nPos )), aIdx );
569 } while ( -1 != nPos );
570}
571
572/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwXmlFlags
sal_Int32 GetDate() const
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
INetProtocol GetProtocol() const
bool SetURL(std::u16string_view rTheAbsURIRef, EncodeMechanism eMechanism=EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
comphelper::EmbeddedObjectContainer & GetEmbeddedObjectContainer() const
bool SaveCompletedChildren()
bool SaveAsChildren(SfxMedium &rMedium)
void ClearEmbeddedObjects()
static OUString GetFormatMimeType(SotClipboardFormatId nFormat)
Marks a character position inside a document model content node (SwContentNode)
void ReactivateModel()
Definition: docshini.cxx:453
void InvalidateModel()
Definition: docshini.cxx:447
SwDoc * GetDoc()
returns Doc. But be careful!
Definition: docsh.hxx:204
void Touch()
Definition: swblocks.cxx:199
OUString m_aShort
Definition: swblocks.hxx:61
const OUString & GetBaseURL() const
Definition: swblocks.hxx:104
OUString GetPackageName(sal_uInt16) const
Return longname for index.
Definition: swblocks.cxx:169
bool m_bReadOnly
Definition: swblocks.hxx:68
OUString m_aLong
Definition: swblocks.hxx:61
sal_uInt16 GetIndex(const OUString &) const
Get count of Text Blocks.
Definition: swblocks.cxx:128
SwBlockNames m_aNames
Definition: swblocks.hxx:63
virtual ErrCode OpenFile(bool bReadOnly=true)=0
bool IsFileChanged() const
Definition: swblocks.cxx:190
std::unique_ptr< SwPaM > MakePaM()
Creating a PaM, that spans the whole document.
Definition: swblocks.cxx:110
bool m_bInPutMuchBlocks
Definition: swblocks.hxx:69
OUString m_aFile
Definition: swblocks.hxx:58
tools::Time m_aTimeModified
Definition: swblocks.hxx:65
Date m_aDateModified
Definition: swblocks.hxx:64
rtl::Reference< SwDoc > m_xDoc
Definition: swblocks.hxx:66
OUString m_aCurrentText
Definition: swblocks.hxx:60
virtual void CloseFile()=0
bool m_bInfoChanged
Definition: swblocks.hxx:70
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:112
SwContentNode * AppendNode(const SwPosition &)
Definition: ndtxt.cxx:3130
virtual SwFormatColl * ChgFormatColl(SwFormatColl *) override
Definition: ndtxt.cxx:4060
OUString InsertText(const OUString &rStr, const SwContentIndex &rIdx, const SwInsertFlags nMode=SwInsertFlags::DEFAULT)
insert text content
Definition: ndtxt.cxx:2372
SwTextFormatColl * GetTextColl() const
Definition: ndtxt.hxx:895
ErrCode Write(WriterRef const &rxWriter, const OUString *=nullptr)
Definition: shellio.cxx:745
virtual ErrCode CopyBlock(SwImpBlocks &rImp, OUString &rShort, const OUString &rLong) override
void SetIsTextOnly(const OUString &rShort, bool bNewValue)
virtual bool PutMuchEntries(bool bOn) override
virtual ErrCode MakeBlockList() override
void InitBlockMode(const css::uno::Reference< css::embed::XStorage > &rStorage)
virtual bool IsOnlyTextBlock(const OUString &rShort) const override
SwXMLTextBlocks(const OUString &rFile)
virtual ErrCode PutText(const OUString &, const OUString &, const OUString &) override
css::uno::Reference< css::embed::XStorage > m_xBlkRoot
void MakeBlockText(std::u16string_view rText)
static OUString GeneratePackageName(std::u16string_view rShort)
SfxObjectShellRef m_xDocShellRef
virtual void ClearDoc() override
Delete the document's content.
ErrCode GetBlockText(std::u16string_view rShort, OUString &rText)
virtual ErrCode Rename(sal_uInt16, const OUString &) override
static bool IsFileUCBStorage(const OUString &rFileName)
virtual ErrCode PutDoc() override
virtual ErrCode Delete(sal_uInt16) override
ErrCode GetText(std::u16string_view rShort, OUString &)
ErrCode StartPutBlock(const OUString &rShort, const OUString &rPackageName)
ErrCode PutBlockText(const OUString &rShort, std::u16string_view rText, const OUString &rPackageName)
virtual void CloseFile() override
void AddName(const OUString &, const OUString &, const OUString &, bool bOnlyText)
css::uno::Reference< css::embed::XStorage > m_xRoot
virtual ~SwXMLTextBlocks() override
virtual ErrCode OpenFile(bool bReadOnly=true) override
virtual ErrCode BeginPutDoc(const OUString &, const OUString &) override
static bool IsStorageFile(SvStream *)
static css::uno::Reference< css::embed::XStorage > GetStorageFromURL(const OUString &aURL, sal_Int32 nStorageMode, const css::uno::Reference< css::uno::XComponentContext > &rxContext=css::uno::Reference< css::uno::XComponentContext >())
static css::uno::Reference< css::embed::XStorage > GetTemporaryStorage(const css::uno::Reference< css::uno::XComponentContext > &rxContext=css::uno::Reference< css::uno::XComponentContext >())
const_iterator begin() const
size_type erase(const Value &x)
std::pair< const_iterator, bool > insert(Value &&x)
bool is() const
sal_Int64 GetTime() const
static std::unique_ptr< SvStream > CreateStream(const OUString &rFileName, StreamMode eOpenMode, css::uno::Reference< css::awt::XWindow > xParentWin=nullptr)
#define TOOLS_WARN_EXCEPTION(area, stream)
URL aURL
#define ERRCODE_NONE
sal_Int32 m_nFlags
sal_Int32 nIndex
OUString aName
sal_Int64 n
sal_uInt16 nPos
#define SAL_WARN(area, stream)
aBuf
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
@ RES_POOLCOLL_STANDARD
Standard.
Definition: poolfmt.hxx:250
Marks a position in the document model.
Definition: pam.hxx:38
#define ERR_SWG_WRITE_ERROR
Definition: swerror.h:30
void GetXMLWriter(std::u16string_view, const OUString &rBaseURL, WriterRef &xRet)
Definition: wrtxml.cxx:580