Kaydet (Commit) 3d992d77 authored tarafından Caolán McNamara's avatar Caolán McNamara

we only need the PaM for its Point and only to create a uno cursor

so do that in the ctor and drop the arg from a bunch of places

Change-Id: Iaad71e9854b38d8632df057dfe9c96468d1d0098
üst 32b35d9d
...@@ -210,8 +210,6 @@ bool WW8Glossary::Load( SwTextBlocks &rBlocks, bool bSaveRelFile ) ...@@ -210,8 +210,6 @@ bool WW8Glossary::Load( SwTextBlocks &rBlocks, bool bSaveRelFile )
if (xDocSh->DoInitNew(0)) if (xDocSh->DoInitNew(0))
{ {
SwDoc *pD = static_cast<SwDocShell*>((&xDocSh))->GetDoc(); SwDoc *pD = static_cast<SwDocShell*>((&xDocSh))->GetDoc();
SwWW8ImplReader* pRdr = new SwWW8ImplReader(pGlossary->nVersion,
xStg, &rStrm, *pD, rBlocks.GetBaseURL(), true, false);
SwNodeIndex aIdx( SwNodeIndex aIdx(
*pD->GetNodes().GetEndOfContent().StartOfSectionNode(), 1); *pD->GetNodes().GetEndOfContent().StartOfSectionNode(), 1);
...@@ -223,11 +221,11 @@ bool WW8Glossary::Load( SwTextBlocks &rBlocks, bool bSaveRelFile ) ...@@ -223,11 +221,11 @@ bool WW8Glossary::Load( SwTextBlocks &rBlocks, bool bSaveRelFile )
SwPaM aPamo( aIdx ); SwPaM aPamo( aIdx );
aPamo.GetPoint()->nContent.Assign(aIdx.GetNode().GetContentNode(), aPamo.GetPoint()->nContent.Assign(aIdx.GetNode().GetContentNode(),
0); 0);
pRdr->LoadDoc(aPamo,this); std::unique_ptr<SwWW8ImplReader> xRdr(new SwWW8ImplReader(
pGlossary->nVersion, xStg, &rStrm, *pD, rBlocks.GetBaseURL(),
true, false, *aPamo.GetPoint()));
xRdr->LoadDoc(this);
bRet = MakeEntries(pD, rBlocks, bSaveRelFile, aStrings, aData); bRet = MakeEntries(pD, rBlocks, bSaveRelFile, aStrings, aData);
delete pRdr;
} }
xDocSh->DoClose(); xDocSh->DoClose();
rBlocks.EndPutMuchBlockEntries(); rBlocks.EndPutMuchBlockEntries();
......
...@@ -4124,7 +4124,7 @@ bool SwWW8ImplReader::ReadText(WW8_CP nStartCp, WW8_CP nTextLen, ManTypes nType) ...@@ -4124,7 +4124,7 @@ bool SwWW8ImplReader::ReadText(WW8_CP nStartCp, WW8_CP nTextLen, ManTypes nType)
} }
SwWW8ImplReader::SwWW8ImplReader(sal_uInt8 nVersionPara, SotStorage* pStorage, SwWW8ImplReader::SwWW8ImplReader(sal_uInt8 nVersionPara, SotStorage* pStorage,
SvStream* pSt, SwDoc& rD, const OUString& rBaseURL, bool bNewDoc, bool bSkipImages) SvStream* pSt, SwDoc& rD, const OUString& rBaseURL, bool bNewDoc, bool bSkipImages, SwPosition &rPos)
: m_pDocShell(rD.GetDocShell()) : m_pDocShell(rD.GetDocShell())
, m_pStg(pStorage) , m_pStg(pStorage)
, m_pStrm(pSt) , m_pStrm(pSt)
...@@ -4260,6 +4260,8 @@ SwWW8ImplReader::SwWW8ImplReader(sal_uInt8 nVersionPara, SotStorage* pStorage, ...@@ -4260,6 +4260,8 @@ SwWW8ImplReader::SwWW8ImplReader(sal_uInt8 nVersionPara, SotStorage* pStorage,
{ {
m_pStrm->SetEndian( SvStreamEndian::LITTLE ); m_pStrm->SetEndian( SvStreamEndian::LITTLE );
m_aApos.push_back(false); m_aApos.push_back(false);
mpCrsr = m_rDoc.CreateUnoCrsr(rPos);
} }
void SwWW8ImplReader::DeleteStk(SwFltControlStack* pStck) void SwWW8ImplReader::DeleteStk(SwFltControlStack* pStck)
...@@ -4881,7 +4883,7 @@ bool SwWW8ImplReader::ReadGlobalTemplateSettings( const OUString& sCreatedFrom, ...@@ -4881,7 +4883,7 @@ bool SwWW8ImplReader::ReadGlobalTemplateSettings( const OUString& sCreatedFrom,
return bRes; return bRes;
} }
sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos) sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss)
{ {
sal_uLong nErrRet = 0; sal_uLong nErrRet = 0;
...@@ -4917,7 +4919,6 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos) ...@@ -4917,7 +4919,6 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
pDocShell->SetReadOnlyUI(); pDocShell->SetReadOnlyUI();
} }
mpCrsr = m_rDoc.CreateUnoCrsr(rPos);
m_pPaM = mpCrsr.get(); m_pPaM = mpCrsr.get();
m_pCtrlStck = new SwWW8FltControlStack( &m_rDoc, m_nFieldFlags, *this ); m_pCtrlStck = new SwWW8FltControlStack( &m_rDoc, m_nFieldFlags, *this );
...@@ -5595,7 +5596,7 @@ namespace ...@@ -5595,7 +5596,7 @@ namespace
} }
} }
sal_uLong SwWW8ImplReader::LoadThroughDecryption(SwPaM& rPaM ,WW8Glossary *pGloss) sal_uLong SwWW8ImplReader::LoadThroughDecryption(WW8Glossary *pGloss)
{ {
sal_uLong nErrRet = 0; sal_uLong nErrRet = 0;
if (pGloss) if (pGloss)
...@@ -5765,7 +5766,7 @@ sal_uLong SwWW8ImplReader::LoadThroughDecryption(SwPaM& rPaM ,WW8Glossary *pGlos ...@@ -5765,7 +5766,7 @@ sal_uLong SwWW8ImplReader::LoadThroughDecryption(SwPaM& rPaM ,WW8Glossary *pGlos
} }
if (!nErrRet) if (!nErrRet)
nErrRet = CoreLoad(pGloss, *rPaM.GetPoint()); nErrRet = CoreLoad(pGloss);
delete pTempMain; delete pTempMain;
delete pTempTable; delete pTempTable;
...@@ -5962,7 +5963,7 @@ const OUString* SwWW8ImplReader::GetAnnotationAuthor(sal_uInt16 nIdx) ...@@ -5962,7 +5963,7 @@ const OUString* SwWW8ImplReader::GetAnnotationAuthor(sal_uInt16 nIdx)
return pRet; return pRet;
} }
sal_uLong SwWW8ImplReader::LoadDoc( SwPaM& rPaM,WW8Glossary *pGloss) sal_uLong SwWW8ImplReader::LoadDoc(WW8Glossary *pGloss)
{ {
sal_uLong nErrRet = 0; sal_uLong nErrRet = 0;
...@@ -6037,7 +6038,7 @@ sal_uLong SwWW8ImplReader::LoadDoc( SwPaM& rPaM,WW8Glossary *pGloss) ...@@ -6037,7 +6038,7 @@ sal_uLong SwWW8ImplReader::LoadDoc( SwPaM& rPaM,WW8Glossary *pGloss)
} }
if (!nErrRet) if (!nErrRet)
nErrRet = LoadThroughDecryption(rPaM ,pGloss); nErrRet = LoadThroughDecryption(pGloss);
m_rDoc.PropagateOutlineRule(); m_rDoc.PropagateOutlineRule();
...@@ -6103,7 +6104,7 @@ sal_uLong WW8Reader::OpenMainStream( tools::SvRef<SotStorageStream>& rRef, sal_u ...@@ -6103,7 +6104,7 @@ sal_uLong WW8Reader::OpenMainStream( tools::SvRef<SotStorageStream>& rRef, sal_u
return nRet; return nRet;
} }
sal_uLong WW8Reader::Read(SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPam, const OUString & /* FileName */) sal_uLong WW8Reader::Read(SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, const OUString & /* FileName */)
{ {
sal_uInt16 nOldBuffSize = 32768; sal_uInt16 nOldBuffSize = 32768;
bool bNew = !bInsertMode; // New Doc (no inserting) bool bNew = !bInsertMode; // New Doc (no inserting)
...@@ -6146,16 +6147,16 @@ sal_uLong WW8Reader::Read(SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPam, co ...@@ -6146,16 +6147,16 @@ sal_uLong WW8Reader::Read(SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPam, co
if( !nRet ) if( !nRet )
{ {
SwWW8ImplReader* pRdr = new SwWW8ImplReader(nVersion, pStg, pIn, rDoc,
rBaseURL, bNew, bSkipImages, *rPaM.GetPoint());
if (bNew) if (bNew)
{ {
// Remove Frame and offsets from Frame Template // Remove Frame and offsets from Frame Template
Reader::ResetFrameFormats( rDoc ); Reader::ResetFrameFormats( rDoc );
} }
SwWW8ImplReader* pRdr = new SwWW8ImplReader(nVersion, pStg, pIn, rDoc,
rBaseURL, bNew, bSkipImages);
try try
{ {
nRet = pRdr->LoadDoc( rPam ); nRet = pRdr->LoadDoc();
} }
catch( const std::exception& ) catch( const std::exception& )
{ {
......
...@@ -1532,9 +1532,9 @@ private: ...@@ -1532,9 +1532,9 @@ private:
//This converts MS Asian Typography information into OOo's //This converts MS Asian Typography information into OOo's
void ImportDopTypography(const WW8DopTypography &rTypo); void ImportDopTypography(const WW8DopTypography &rTypo);
sal_uLong LoadThroughDecryption(SwPaM& rPaM ,WW8Glossary *pGloss); sal_uLong LoadThroughDecryption(WW8Glossary *pGloss);
sal_uLong SetSubStreams(tools::SvRef<SotStorageStream> &rTableStream, tools::SvRef<SotStorageStream> &rDataStream); sal_uLong SetSubStreams(tools::SvRef<SotStorageStream> &rTableStream, tools::SvRef<SotStorageStream> &rDataStream);
sal_uLong CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos); sal_uLong CoreLoad(WW8Glossary *pGloss);
void ReadDocVars(); void ReadDocVars();
...@@ -1879,11 +1879,11 @@ public: // really private, but can only be done public ...@@ -1879,11 +1879,11 @@ public: // really private, but can only be done public
static ColorData GetCol(sal_uInt8 nIco); static ColorData GetCol(sal_uInt8 nIco);
SwWW8ImplReader( sal_uInt8 nVersionPara, SotStorage* pStorage, SvStream* pSt, SwWW8ImplReader( sal_uInt8 nVersionPara, SotStorage* pStorage, SvStream* pSt,
SwDoc& rD, const OUString& rBaseURL, bool bNewDoc, bool bSkipImages ); SwDoc& rD, const OUString& rBaseURL, bool bNewDoc, bool bSkipImages, SwPosition &rPos );
const OUString& GetBaseURL() const { return m_sBaseURL; } const OUString& GetBaseURL() const { return m_sBaseURL; }
// load a complete doc file // load a complete doc file
sal_uLong LoadDoc( SwPaM&,WW8Glossary *pGloss=0); sal_uLong LoadDoc(WW8Glossary *pGloss=0);
rtl_TextEncoding GetCurrentCharSet(); rtl_TextEncoding GetCurrentCharSet();
rtl_TextEncoding GetCurrentCJKCharSet(); rtl_TextEncoding GetCurrentCJKCharSet();
rtl_TextEncoding GetCharSetFromLanguage(); rtl_TextEncoding GetCharSetFromLanguage();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment