summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorVarun Dhall <varun.dhall@studentpartner.com>2017-08-08 23:42:02 +0530
committerMichael Stahl <mstahl@redhat.com>2017-08-09 13:06:54 +0200
commit9cc75c52369d6656a5812e950641d4b9b6d0cc35 (patch)
treeb43cd28527da328d1adf7c0f3a190f78617c9480 /editeng
parent9f2a105aa1467224b662980f6d1c4a42e5d8bdfe (diff)
Removing unused SfxItemPool serialisation from sc
Change-Id: Ib8686d06f8cd477ff4fce948b0ac9c3fe463b129 Reviewed-on: https://gerrit.libreoffice.org/40901 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/editobj.cxx362
-rw-r--r--editeng/source/editeng/editobj2.hxx2
2 files changed, 0 insertions, 364 deletions
diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx
index 14eebcfbcf45..f5122fec09eb 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -393,36 +393,6 @@ SvtScriptType EditTextObject::GetScriptType() const
}
-EditTextObject* EditTextObject::Create( SvStream& rIStream )
-{
- sal_uInt64 const nStartPos = rIStream.Tell();
-
- // First check what type of Object...
- sal_uInt16 nWhich;
- rIStream.ReadUInt16( nWhich );
-
- sal_uInt32 nStructSz;
- rIStream.ReadUInt32( nStructSz );
-
- if (nWhich != EE_FORMAT_BIN)
- {
- // Unknown object we no longer support.
- rIStream.SetError(EE_READWRITE_WRONGFORMAT);
- return nullptr;
- }
-
- if ( rIStream.GetError() )
- return nullptr;
-
- EditTextObject* pTxtObj = new EditTextObject(nullptr);
- pTxtObj->mpImpl->CreateData(rIStream);
-
- // Make sure that the stream is left at the correct place.
- std::size_t nFullSz = sizeof( nWhich ) + sizeof( nStructSz ) + nStructSz;
- rIStream.Seek( nStartPos + nFullSz );
- return pTxtObj;
-}
-
EditTextObject* EditTextObject::Clone() const
{
return new EditTextObject(*this);
@@ -1089,338 +1059,6 @@ void EditTextObjectImpl::ChangeStyleSheetName( SfxStyleFamily eFamily,
ImpChangeStyleSheets( rOldName, eFamily, rNewName, eFamily );
}
-
-namespace {
-
-class FindAttribByChar
-{
- sal_uInt16 mnWhich;
- sal_Int32 mnChar;
-public:
- FindAttribByChar(sal_uInt16 nWhich, sal_Int32 nChar) : mnWhich(nWhich), mnChar(nChar) {}
- bool operator() (const std::unique_ptr<XEditAttribute>& rAttr) const
- {
- return (rAttr->GetItem()->Which() == mnWhich) && (rAttr->GetStart() <= mnChar) && (rAttr->GetEnd() > mnChar);
- }
-};
-
-}
-
-void EditTextObjectImpl::CreateData( SvStream& rIStream )
-{
- rIStream.ReadUInt16( nVersion );
-
- // The text object was first created with the current setting of
- // pTextObjectPool.
- bool bOwnerOfCurrent = bOwnerOfPool;
- bool b;
- rIStream.ReadCharAsBool( b );
- bOwnerOfPool = b;
-
- if ( bOwnerOfCurrent && !bOwnerOfPool )
- {
- // A global Pool was used, but not handed over to me, but I need it!
- OSL_FAIL( "Give me the global TextObjectPool!" );
- return;
- }
- else if ( !bOwnerOfCurrent && bOwnerOfPool )
- {
- // A global Pool should be used, but this Textobject has its own.
- pPool = EditEngine::CreatePool();
- }
-
- if ( bOwnerOfPool )
- GetPool()->Load( rIStream );
-
- // CharSet, in which it was saved:
- sal_uInt16 nCharSet;
- rIStream.ReadUInt16( nCharSet );
-
- rtl_TextEncoding eSrcEncoding = GetSOLoadTextEncoding( (rtl_TextEncoding)nCharSet );
-
- // The number of paragraphs ...
- sal_uInt16 nParagraphs(0);
- rIStream.ReadUInt16( nParagraphs );
-
- const size_t nMinParaRecordSize = 6 + eSrcEncoding == RTL_TEXTENCODING_UNICODE ? 4 : 2;
- const size_t nMaxParaRecords = rIStream.remainingSize() / nMinParaRecordSize;
- if (nParagraphs > nMaxParaRecords)
- {
- SAL_WARN("editeng", "Parsing error: " << nMaxParaRecords <<
- " max possible entries, but " << nParagraphs<< " claimed, truncating");
- nParagraphs = nMaxParaRecords;
- }
-
- // The individual paragraphs ...
- for ( sal_uLong nPara = 0; nPara < nParagraphs; nPara++ )
- {
- ContentInfo* pC = CreateAndInsertContent();
-
- // The Text...
- OString aByteString = read_uInt16_lenPrefixed_uInt8s_ToOString(rIStream);
- pC->SetText(OStringToOUString(aByteString, eSrcEncoding));
-
- // StyleName and Family...
- pC->SetStyle(rIStream.ReadUniOrByteString(eSrcEncoding));
- sal_uInt16 nStyleFamily(0);
- rIStream.ReadUInt16( nStyleFamily );
- pC->SetFamily((SfxStyleFamily)nStyleFamily);
-
- // Paragraph attributes ...
- pC->GetParaAttribs().Load( rIStream );
-
- // The number of attributes ...
- sal_uInt16 nTmp16(0);
- rIStream.ReadUInt16( nTmp16 );
- size_t nAttribs = nTmp16;
-
- const size_t nMinRecordSize(10);
- const size_t nMaxRecords = rIStream.remainingSize() / nMinRecordSize;
- if (nAttribs > nMaxRecords)
- {
- SAL_WARN("editeng", "Parsing error: " << nMaxRecords <<
- " max possible entries, but " << nAttribs << " claimed, truncating");
- nAttribs = nMaxRecords;
- }
-
- // And the individual attributes
- // Items as Surrogate => always 8 bytes per Attributes
- // Which = 2; Surrogate = 2; Start = 2; End = 2;
- for (size_t nAttr = 0; nAttr < nAttribs; ++nAttr)
- {
- sal_uInt16 _nWhich(0), nStart(0), nEnd(0);
- const SfxPoolItem* pItem;
-
- rIStream.ReadUInt16( _nWhich );
- _nWhich = pPool->GetNewWhich( _nWhich );
- pItem = pPool->LoadSurrogate( rIStream, _nWhich, 0 );
- rIStream.ReadUInt16( nStart );
- rIStream.ReadUInt16( nEnd );
- if ( pItem )
- {
- if ( pItem->Which() == EE_FEATURE_NOTCONV )
- {
- sal_Char cEncodedChar = aByteString[nStart];
- sal_Unicode cChar = OUString(&cEncodedChar, 1,
- static_cast<const SvxCharSetColorItem*>(pItem)->GetCharSet()).toChar();
- pC->SetText(pC->GetText().replaceAt(nStart, 1, OUString(cChar)));
- }
- else
- {
- XEditAttribute* pAttr = new XEditAttribute( *pItem, nStart, nEnd );
- pC->maCharAttribs.push_back(std::unique_ptr<XEditAttribute>(pAttr));
-
- if ( ( _nWhich >= EE_FEATURE_START ) && ( _nWhich <= EE_FEATURE_END ) )
- {
- // Convert CH_FEATURE to CH_FEATURE_OLD
- DBG_ASSERT( (sal_uInt8) aByteString[nStart] == CH_FEATURE_OLD, "CreateData: CH_FEATURE expected!" );
- if ( (sal_uInt8) aByteString[nStart] == CH_FEATURE_OLD )
- pC->SetText(pC->GetText().replaceAt(nStart, 1, OUString(CH_FEATURE)));
- }
- }
- }
- }
-
- // But check for paragraph and character symbol attribs here,
- // FinishLoad will not be called in OpenOffice Calc, no StyleSheets...
-
- bool bSymbolPara = false;
- if ( pC->GetParaAttribs().GetItemState( EE_CHAR_FONTINFO ) == SfxItemState::SET )
- {
- const SvxFontItem& rFontItem = static_cast<const SvxFontItem&>(pC->GetParaAttribs().Get( EE_CHAR_FONTINFO ));
- if ( rFontItem.GetCharSet() == RTL_TEXTENCODING_SYMBOL )
- {
- pC->SetText(OStringToOUString(aByteString, RTL_TEXTENCODING_SYMBOL));
- bSymbolPara = true;
- }
- }
-
- for (size_t nAttr = pC->maCharAttribs.size(); nAttr; )
- {
- const XEditAttribute& rAttr = *pC->maCharAttribs[--nAttr].get();
- if ( rAttr.GetItem()->Which() == EE_CHAR_FONTINFO )
- {
- const SvxFontItem& rFontItem = static_cast<const SvxFontItem&>(*rAttr.GetItem());
- if ( ( !bSymbolPara && ( rFontItem.GetCharSet() == RTL_TEXTENCODING_SYMBOL ) )
- || ( bSymbolPara && ( rFontItem.GetCharSet() != RTL_TEXTENCODING_SYMBOL ) ) )
- {
- // Not correctly converted
- OString aPart(aByteString.copy(rAttr.GetStart(), rAttr.GetEnd()-rAttr.GetStart()));
- OUString aNew(OStringToOUString(aPart, rFontItem.GetCharSet()));
- pC->SetText(pC->GetText().replaceAt(rAttr.GetStart(), rAttr.GetEnd()-rAttr.GetStart(), aNew));
- }
-
- // Convert StarMath and StarBats to StarSymbol
- FontToSubsFontConverter hConv = CreateFontToSubsFontConverter( rFontItem.GetFamilyName(), FontToSubsFontFlags::IMPORT | FontToSubsFontFlags::ONLYOLDSOSYMBOLFONTS );
- if ( hConv )
- {
- SvxFontItem aNewFontItem( rFontItem );
- aNewFontItem.SetFamilyName( GetFontToSubsFontName( hConv ) );
-
- // Replace the existing attribute with a new one.
- pPool->Remove(*rAttr.GetItem());
- pC->maCharAttribs[nAttr].reset(CreateAttrib(aNewFontItem, rAttr.GetStart(), rAttr.GetEnd()));
-
- XEditAttribute* pNewAttr = pC->maCharAttribs[nAttr].get();
- for ( sal_Int32 nChar = pNewAttr->GetStart(); nChar < pNewAttr->GetEnd(); nChar++ )
- {
- sal_Unicode cOld = pC->GetText()[ nChar ];
- DBG_ASSERT( cOld >= 0xF000, "cOld not converted?!" );
- sal_Unicode cConv = ConvertFontToSubsFontChar( hConv, cOld );
- if ( cConv )
- pC->SetText(pC->GetText().replaceAt(nChar, 1, OUString(cConv)));
- }
- }
- }
- }
-
-
- // Convert StarMath and StarBats to StarSymbol
- // Maybe old symbol font as paragraph attribute?
- if ( pC->GetParaAttribs().GetItemState( EE_CHAR_FONTINFO ) == SfxItemState::SET )
- {
- const SvxFontItem& rFontItem = static_cast<const SvxFontItem&>(pC->GetParaAttribs().Get( EE_CHAR_FONTINFO ));
- FontToSubsFontConverter hConv = CreateFontToSubsFontConverter( rFontItem.GetFamilyName(), FontToSubsFontFlags::IMPORT | FontToSubsFontFlags::ONLYOLDSOSYMBOLFONTS );
- if ( hConv )
- {
- SvxFontItem aNewFontItem( rFontItem );
- aNewFontItem.SetFamilyName( GetFontToSubsFontName( hConv ) );
- pC->GetParaAttribs().Put( aNewFontItem );
-
- for ( sal_Int32 nChar = 0; nChar < pC->GetText().getLength(); nChar++ )
- {
- const ContentInfo::XEditAttributesType& rAttribs = pC->maCharAttribs;
- if ( std::none_of(rAttribs.begin(), rAttribs.end(),
- FindAttribByChar(EE_CHAR_FONTINFO, nChar)) )
- {
- sal_Unicode cOld = pC->GetText()[ nChar ];
- DBG_ASSERT( cOld >= 0xF000, "cOld not converted?!" );
- sal_Unicode cConv = ConvertFontToSubsFontChar( hConv, cOld );
- if ( cConv )
- pC->SetText(pC->GetText().replaceAt(nChar, 1, OUString(cConv)));
- }
- }
- }
- }
- }
-
- // From 400 also the DefMetric:
- if ( nVersion >= 400 )
- {
- sal_uInt16 nTmpMetric;
- rIStream.ReadUInt16( nTmpMetric );
- if ( nVersion >= 401 )
- {
- // In the 400 there was a bug in text objects with the own Pool,
- // therefore evaluate only from 401
- nMetric = nTmpMetric;
- if ( bOwnerOfPool && pPool && ( nMetric != 0xFFFF ) )
- pPool->SetDefaultMetric( (MapUnit)nMetric );
- }
- }
-
- if ( nVersion >= 600 )
- {
- sal_uInt16 nTmp;
- rIStream.ReadUInt16( nTmp );
- nUserType = (OutlinerMode)nTmp;
- rIStream.ReadUInt32( nObjSettings );
- }
-
- if ( nVersion >= 601 )
- {
- bool bTmp(false);
- rIStream.ReadCharAsBool( bTmp );
- bVertical = bTmp;
- }
-
- if (nVersion >= 603)
- {
- bool bTmp(false);
- rIStream.ReadCharAsBool(bTmp);
- bIsTopToBottomVert = bTmp;
- }
-
- if ( nVersion >= 602 )
- {
- sal_uInt16 aTmp16;
- rIStream.ReadUInt16( aTmp16 );
- nScriptType = static_cast<SvtScriptType>(aTmp16);
-
- bool bUnicodeStrings(false);
- rIStream.ReadCharAsBool( bUnicodeStrings );
- if ( bUnicodeStrings )
- {
- for (sal_uInt16 nPara = 0; nPara < nParagraphs; ++nPara)
- {
- ContentInfo& rC = *aContents[nPara].get();
- sal_uInt16 nL(0);
-
- // Text
- rIStream.ReadUInt16(nL);
- if (nL)
- {
- size_t nMaxElementsPossible = rIStream.remainingSize() / sizeof(sal_Unicode);
- if (nL > nMaxElementsPossible)
- {
- SAL_WARN("editeng", "Parsing error: " << nMaxElementsPossible <<
- " max possible entries, but " << nL << " claimed, truncating");
- nL = nMaxElementsPossible;
- }
-
- rtl_uString *pStr = rtl_uString_alloc(nL);
- // FIXME this isn't endian safe, but presumably this is just used for copy/paste?
- rIStream.ReadBytes(pStr->buffer, nL*sizeof(sal_Unicode));
- rC.SetText((OUString(pStr, SAL_NO_ACQUIRE)));
-
- nL = 0;
- }
-
- // StyleSheetName
- rIStream.ReadUInt16( nL );
- if ( nL )
- {
- size_t nMaxElementsPossible = rIStream.remainingSize() / sizeof(sal_Unicode);
- if (nL > nMaxElementsPossible)
- {
- SAL_WARN("editeng", "Parsing error: " << nMaxElementsPossible <<
- " max possible entries, but " << nL << " claimed, truncating");
- nL = nMaxElementsPossible;
- }
-
- rtl_uString *pStr = rtl_uString_alloc(nL);
- rIStream.ReadBytes(pStr->buffer, nL*sizeof(sal_Unicode) );
- rC.SetStyle(OUString(pStr, SAL_NO_ACQUIRE));
- }
- }
- }
- }
-
-
- // from 500 the tabs are interpreted differently: TabPos + LI, previously only TabPos.
- // Works only if tab positions are set, not when DefTab.
- if ( nVersion < 500 )
- {
- for (std::unique_ptr<ContentInfo> & aContent : aContents)
- {
- ContentInfo& rC = *aContent.get();
- const SvxLRSpaceItem& rLRSpace = static_cast<const SvxLRSpaceItem&>(rC.GetParaAttribs().Get(EE_PARA_LRSPACE));
- if ( rLRSpace.GetTextLeft() && ( rC.GetParaAttribs().GetItemState( EE_PARA_TABS ) == SfxItemState::SET ) )
- {
- const SvxTabStopItem& rTabs = static_cast<const SvxTabStopItem&>(rC.GetParaAttribs().Get(EE_PARA_TABS));
- SvxTabStopItem aNewTabs( 0, 0, SvxTabAdjust::Left, EE_PARA_TABS );
- for ( sal_uInt16 t = 0; t < rTabs.Count(); t++ )
- {
- const SvxTabStop& rT = rTabs[ t ];
- aNewTabs.Insert( SvxTabStop( rT.GetTabPos() - rLRSpace.GetTextLeft(),
- rT.GetAdjustment(), rT.GetDecimal(), rT.GetFill() ) );
- }
- rC.GetParaAttribs().Put( aNewTabs );
- }
- }
- }
-}
-
bool EditTextObjectImpl::operator==( const EditTextObjectImpl& rCompare ) const
{
return Equals( rCompare, true);
diff --git a/editeng/source/editeng/editobj2.hxx b/editeng/source/editeng/editobj2.hxx
index 3091ddaadb65..15724a4ceef7 100644
--- a/editeng/source/editeng/editobj2.hxx
+++ b/editeng/source/editeng/editobj2.hxx
@@ -201,8 +201,6 @@ private:
const OUString& rNewName, SfxStyleFamily eNewFamily );
public:
- void CreateData( SvStream& rIStream );
-
EditTextObjectImpl( EditTextObject* pFront, SfxItemPool* pPool );
EditTextObjectImpl( EditTextObject* pFront, const EditTextObjectImpl& r );
~EditTextObjectImpl();