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