22#include <osl/diagnose.h>
43 const sal_Int32 nLen =
std::min(sal_Int32(r.size()),
static_cast<sal_Int32
>(8));
44 for (sal_Int32
i=0;
i<nLen; ++
i)
46 n = (
n << 1 ) + r[
i];
52 : m_aShort( rShort ), m_aLong( rLong ), m_aPackageName (rShort),
53 m_bIsOnlyTextFlagInit( false ), m_bIsOnlyText( false )
60 : m_aShort( rShort ), m_aLong( rLong ), m_aPackageName (
std::move(aPackageName)),
61 m_bIsOnlyTextFlagInit( false ), m_bIsOnlyText( false )
112 std::unique_ptr<SwPaM> pPam(
new SwPaM(
m_xDoc->GetNodes().GetEndOfContent() ));
131 const sal_uInt16 nHash =
Hash( s );
135 if(
pName->m_nHashS == nHash
136 &&
pName->m_aShort == s )
144 sal_uInt16 nHash =
Hash( aLong );
148 if(
pName->m_nHashL == nHash
149 &&
pName->m_aLong == aLong )
179 sal_uInt16 nIdx =
GetIndex( rShort );
180 if( nIdx != USHRT_MAX )
184 std::unique_ptr<SwBlockName> pNew(
new SwBlockName( rShort, rLong ));
185 pNew->m_bIsOnlyTextFlagInit =
true;
186 pNew->m_bIsOnlyText = bOnlyText;
274 return m_pImp->GetShortName(
n );
281 return m_pImp->GetLongName(
n );
289 if(
m_pImp->IsFileChanged() )
298 if(
n ==
m_pImp->m_nCurrentIndex )
299 m_pImp->m_nCurrentIndex = USHRT_MAX;
316 m_pImp->m_nCurrentIndex = USHRT_MAX;
325 OSL_ENSURE(
false,
"No short name provided in the rename" );
330 if(
m_pImp->IsFileChanged() )
339 bool bOnlyText =
m_pImp->m_aNames[
n ]->m_bIsOnlyText;
341 m_pImp->AddName( aNew, aLong, bOnlyText );
350 const OUString& rLong )
352 if (
m_pImp->m_bInPutMuchBlocks)
363 if(
m_pImp->IsFileChanged() )
370 m_pImp->m_nCurrentIndex = USHRT_MAX;
389 bool bOk =
m_pImp->m_bInPutMuchBlocks;
392 if(
m_pImp->IsFileChanged() )
411 sal_uInt16 nIdx = USHRT_MAX;
418 if(
m_pImp->m_nCurrentIndex != USHRT_MAX )
425 if( !
m_pImp->m_bInPutMuchBlocks )
428 if( !
m_pImp->m_bInPutMuchBlocks )
433 nIdx =
m_pImp->m_nCurrentIndex;
439 const OUString& rText )
441 sal_uInt16 nIdx = USHRT_MAX;
444 bool bOk =
m_pImp->m_bInPutMuchBlocks;
447 if(
m_pImp->IsFileChanged() )
457 m_pImp->m_nCurrentIndex = USHRT_MAX;
461 if( nIdx != USHRT_MAX )
462 m_pImp->m_aNames[ nIdx ]->m_aLong = rName;
468 if( !
m_pImp->m_bInPutMuchBlocks )
472 if( !
m_pImp->m_bInPutMuchBlocks )
484 return m_pImp->m_xDoc.get();
493 m_pImp->m_nCurrentIndex = USHRT_MAX;
499 return m_pImp->GetFileName();
504 return m_pImp->m_bReadOnly;
527 sal_uInt16 nIdx =
m_pImp->GetIndex( rShort );
528 if( USHRT_MAX != nIdx )
530 if(
m_pImp->m_aNames[ nIdx ]->m_bIsOnlyTextFlagInit )
531 return m_pImp->m_aNames[ nIdx ]->m_bIsOnlyText;
535 OSL_ENSURE(
false,
"Invalid name" );
559 bRet =
m_pImp->PutMuchEntries(
true );
566 m_pImp->PutMuchEntries(
false );
572 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?
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.
static sal_uInt16 Hash(std::u16string_view)
Calculate hash code (is not guaranteed to be unique)
sal_uInt16 GetCount() const
Hashcode for Block names.
OUString GetPackageName(sal_uInt16) const
Return longname for index.
virtual bool IsOnlyTextBlock(const OUString &rShort) const
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.
sal_uInt16 GetLongIndex(std::u16string_view) const
Index for shortnames.
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
ErrCode const & CopyBlock(SwTextBlocks const &rSource, OUString &rSrcShort, const OUString &rLong)
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 GetIndex(const OUString &) const
void SetBaseURL(const OUString &rURL)
sal_uInt16 GetLongIndex(std::u16string_view) const
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