22#include <osl/diagnose.h>
42 const sal_Int32 nLen =
std::min(r.getLength(),
static_cast<sal_Int32
>(8));
43 for (sal_Int32
i=0;
i<nLen; ++
i)
45 n = (
n << 1 ) + r[
i];
51 : m_aShort( rShort ), m_aLong( rLong ), m_aPackageName (rShort),
52 m_bIsOnlyTextFlagInit( false ), m_bIsOnlyText( false )
59 : m_aShort( rShort ), m_aLong( rLong ), m_aPackageName (rPackageName),
60 m_bIsOnlyTextFlagInit( false ), m_bIsOnlyText( false )
111 std::unique_ptr<SwPaM> pPam(
new SwPaM(
m_xDoc->GetNodes().GetEndOfContent() ));
130 const sal_uInt16 nHash =
Hash( s );
134 if(
pName->m_nHashS == nHash
135 &&
pName->m_aShort == s )
143 sal_uInt16 nHash =
Hash( rLong );
147 if(
pName->m_nHashL == nHash
148 &&
pName->m_aLong == rLong )
178 sal_uInt16 nIdx =
GetIndex( rShort );
179 if( nIdx != USHRT_MAX )
183 std::unique_ptr<SwBlockName> pNew(
new SwBlockName( rShort, rLong ));
184 pNew->m_bIsOnlyTextFlagInit =
true;
185 pNew->m_bIsOnlyText = bOnlyText;
273 return m_pImp->GetShortName(
n );
280 return m_pImp->GetLongName(
n );
288 if(
m_pImp->IsFileChanged() )
297 if(
n ==
m_pImp->m_nCurrentIndex )
298 m_pImp->m_nCurrentIndex = USHRT_MAX;
315 m_pImp->m_nCurrentIndex = USHRT_MAX;
324 OSL_ENSURE(
false,
"No short name provided in the rename" );
329 if(
m_pImp->IsFileChanged() )
338 bool bOnlyText =
m_pImp->m_aNames[
n ]->m_bIsOnlyText;
340 m_pImp->AddName( aNew, aLong, bOnlyText );
352 if(
m_pImp->IsFileChanged() )
359 m_pImp->m_nCurrentIndex = USHRT_MAX;
378 bool bOk =
m_pImp->m_bInPutMuchBlocks;
381 if(
m_pImp->IsFileChanged() )
400 sal_uInt16 nIdx = USHRT_MAX;
407 if(
m_pImp->m_nCurrentIndex != USHRT_MAX )
414 if( !
m_pImp->m_bInPutMuchBlocks )
417 if( !
m_pImp->m_bInPutMuchBlocks )
422 nIdx =
m_pImp->m_nCurrentIndex;
428 const OUString& rText )
430 sal_uInt16 nIdx = USHRT_MAX;
433 bool bOk =
m_pImp->m_bInPutMuchBlocks;
436 if(
m_pImp->IsFileChanged() )
446 m_pImp->m_nCurrentIndex = USHRT_MAX;
450 if( nIdx != USHRT_MAX )
451 m_pImp->m_aNames[ nIdx ]->m_aLong = rName;
457 if( !
m_pImp->m_bInPutMuchBlocks )
461 if( !
m_pImp->m_bInPutMuchBlocks )
473 return m_pImp->m_xDoc.get();
482 m_pImp->m_nCurrentIndex = USHRT_MAX;
488 return m_pImp->GetFileName();
493 return m_pImp->m_bReadOnly;
516 sal_uInt16 nIdx =
m_pImp->GetIndex( rShort );
517 if( USHRT_MAX != nIdx )
519 if(
m_pImp->m_aNames[ nIdx ]->m_bIsOnlyTextFlagInit )
520 return m_pImp->m_aNames[ nIdx ]->m_bIsOnlyText;
524 OSL_ENSURE(
false,
"Invalid name" );
548 bRet =
m_pImp->PutMuchEntries(
true );
555 m_pImp->PutMuchEntries(
false );
561 return m_pImp->GetBaseURL();
OUString uppercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
bool setExtension(std::u16string_view rTheExtension, sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
SwBlockName(const OUString &rShort, const OUString &rLong)
Unformatted text.
bool m_bIsOnlyTextFlagInit
Package name.
bool m_bIsOnlyText
Is the Flag valid?
sal_uInt16 GetLongIndex(const OUString &) const
Index for shortnames.
virtual void AddName(const OUString &, const OUString &, bool bOnlyText=false)
virtual ErrCode SetMacroTable(sal_uInt16 nIdx, const SvxMacroTableDtor &rMacroTable)
virtual void ClearDoc()
Delete the document's content.
OUString GetLongName(sal_uInt16) const
Return shortname for index.
sal_uInt16 GetCount() const
Hashcode for Block names.
OUString GetPackageName(sal_uInt16) const
Return longname for index.
virtual bool IsOnlyTextBlock(const OUString &rShort) const
static sal_uInt16 Hash(const OUString &)
Calculate hash code (is not guaranteed to be unique)
sal_uInt16 GetIndex(const OUString &) const
Get count of Text Blocks.
virtual ErrCode GetMacroTable(sal_uInt16 nIdx, SvxMacroTableDtor &rMacroTable)
OUString GetShortName(sal_uInt16) const
Index for longnames.
bool IsFileChanged() const
SwImpBlocks(const OUString &)
std::unique_ptr< SwPaM > MakePaM()
Creating a PaM, that spans the whole document.
tools::Time m_aTimeModified
static FileType GetFileType(const OUString &)
Is the provided file a storage or doesn't it exist?
virtual bool PutMuchEntries(bool bOn)
rtl::Reference< SwDoc > m_xDoc
PaM is Point and Mark: a selection of the document model.
void Rename(sal_uInt16, const OUString *, const OUString *)
bool BeginPutDoc(const OUString &, const OUString &)
void EndPutMuchBlockEntries()
sal_uInt16 GetCount() const
OUString const & GetFileName() const
std::unique_ptr< SwImpBlocks > m_pImp
sal_uInt16 PutText(const OUString &, const OUString &, const OUString &)
bool BeginGetDoc(sal_uInt16)
bool SetMacroTable(sal_uInt16 nIdx, const SvxMacroTableDtor &rMacroTable)
SwTextBlocks(const OUString &)
OUString GetBaseURL() const
bool GetMacroTable(sal_uInt16 nIdx, SvxMacroTableDtor &rMacroTable)
bool StartPutMuchBlockEntries()
bool IsOnlyTextBlock(sal_uInt16) const
void SetName(const OUString &)
sal_uInt16 GetLongIndex(const OUString &) const
sal_uInt16 GetIndex(const OUString &) const
void SetBaseURL(const OUString &rURL)
OUString GetLongName(sal_uInt16) const
OUString GetShortName(sal_uInt16) const
static bool IsFileUCBStorage(const OUString &rFileName)
const_iterator begin() const
size_type erase(const Value &x)
std::pair< const_iterator, bool > insert(Value &&x)
CharClass & GetAppCharClass()
SVL_DLLPUBLIC bool IsDocument(const OUString &rURL)
SVL_DLLPUBLIC bool GetModifiedDateTimeOfFile(const OUString &rURL, Date *pDate, tools::Time *pTime)
constexpr OUStringLiteral EMPTY
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
bool GoInDoc(SwPaM &rPam, SwMoveFnCollection const &fnMove)
SwMoveFnCollection const & fnMoveBackward
SwMoveFnCollection const & fnMoveForward
SwPam::Move()/Find() default argument.
#define ERR_SWG_FILE_FORMAT_ERROR
#define ERR_TXTBLOCK_NEWFILE_ERROR
#define ERR_SWG_INTERNAL_ERROR