diff options
Diffstat (limited to 'sw/source/filter')
41 files changed, 462 insertions, 324 deletions
diff --git a/sw/source/filter/ascii/ascatr.cxx b/sw/source/filter/ascii/ascatr.cxx index f59ca89a8ce8..22957c9434af 100644 --- a/sw/source/filter/ascii/ascatr.cxx +++ b/sw/source/filter/ascii/ascatr.cxx @@ -88,20 +88,16 @@ xub_StrLen SwASC_AttrIter::SearchNext( xub_StrLen nStartPos ) const SwpHints* pTxtAttrs = rNd.GetpSwpHints(); if( pTxtAttrs ) { - USHORT i; - xub_StrLen nPos; - const xub_StrLen * pPos; - // kann noch optimiert werden, wenn ausgenutzt wird, dass die TxtAttrs // nach der Anfangsposition geordnet sind. Dann muessten // allerdings noch 2 Indices gemerkt werden - for( i = 0; i < pTxtAttrs->Count(); i++ ) + for ( USHORT i = 0; i < pTxtAttrs->Count(); i++ ) { const SwTxtAttr* pHt = (*pTxtAttrs)[i]; - nPos = *pHt->GetStart(); // gibt erstes Attr-Zeichen - pPos = pHt->GetEnd(); - if( !pPos ) + if (pHt->HasDummyChar()) { + xub_StrLen nPos = *pHt->GetStart(); + if( nPos >= nStartPos && nPos <= nMinPos ) nMinPos = nPos; @@ -124,8 +120,7 @@ BOOL SwASC_AttrIter::OutAttr( xub_StrLen nSwPos ) for( i = 0; i < pTxtAttrs->Count(); i++ ) { const SwTxtAttr* pHt = (*pTxtAttrs)[i]; - const xub_StrLen * pEnd = pHt->GetEnd(); - if( !pEnd && nSwPos == *pHt->GetStart() ) + if ( pHt->HasDummyChar() && nSwPos == *pHt->GetStart() ) { bRet = TRUE; String sOut; @@ -135,10 +130,6 @@ BOOL SwASC_AttrIter::OutAttr( xub_StrLen nSwPos ) sOut = ((SwTxtFld*)pHt)->GetFld().GetFld()->Expand(); break; - case RES_TXTATR_HARDBLANK: - sOut = ((SwTxtHardBlank*)pHt)->GetChar(); - break; - case RES_TXTATR_FTN: { const SwFmtFtn& rFtn = pHt->GetFtn(); diff --git a/sw/source/filter/ascii/parasc.cxx b/sw/source/filter/ascii/parasc.cxx index 24aa81837d62..50ba611b12e5 100644 --- a/sw/source/filter/ascii/parasc.cxx +++ b/sw/source/filter/ascii/parasc.cxx @@ -261,7 +261,7 @@ ULONG SwASCIIParser::CallParser() // !!!!! ASSERT( !this, "Have to change - hard attr. to para. style" ); - pDoc->Insert( *pInsPam, *pItemSet, 0 ); + pDoc->InsertItemSet( *pInsPam, *pItemSet, 0 ); } } delete pItemSet, pItemSet = 0; @@ -467,7 +467,7 @@ ULONG SwASCIIParser::ReadChars() InsertText( String( pLastStt )); } pDoc->SplitNode( *pPam->GetPoint(), false ); - pDoc->Insert( *pPam, SvxFmtBreakItem( + pDoc->InsertPoolItem( *pPam, SvxFmtBreakItem( SVX_BREAK_PAGE_BEFORE, RES_BREAK ), 0); pLastStt = pStt; nLineLen = 0; @@ -528,7 +528,7 @@ ULONG SwASCIIParser::ReadChars() void SwASCIIParser::InsertText( const String& rStr ) { - pDoc->Insert( *pPam, rStr, true ); + pDoc->InsertString( *pPam, rStr ); if( pItemSet && pBreakIt && nScript != ( SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | SCRIPTTYPE_COMPLEX ) ) diff --git a/sw/source/filter/basflt/fltini.cxx b/sw/source/filter/basflt/fltini.cxx index 05b1bb4eb97a..cb31050b02d3 100644 --- a/sw/source/filter/basflt/fltini.cxx +++ b/sw/source/filter/basflt/fltini.cxx @@ -670,13 +670,13 @@ void CalculateFlySize(SfxItemSet& rFlySet, const SwNodeIndex& rAnchor, // if the first node dont contained any content, then // insert one char in it calc again and delete once again SwIndex aNdIdx( pFirstTxtNd ); - pFirstTxtNd->Insert( String::CreateFromAscii( + pFirstTxtNd->InsertText( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "MM" )), aNdIdx ); ULONG nAbsMinCnts; pFirstTxtNd->GetMinMaxSize( pFirstTxtNd->GetIndex(), nMinFrm, nMaxFrm, nAbsMinCnts ); aNdIdx -= 2; - pFirstTxtNd->Erase( aNdIdx, 2 ); + pFirstTxtNd->EraseText( aNdIdx, 2 ); } // Umrandung und Abstand zum Inhalt beachten diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx index c4608a4907f2..0012d5dc0664 100644 --- a/sw/source/filter/html/htmlatr.cxx +++ b/sw/source/filter/html/htmlatr.cxx @@ -81,7 +81,6 @@ #include <txatbase.hxx> #include <frmatr.hxx> #include <charfmt.hxx> -#include <fmthbsh.hxx> #include <fmtfld.hxx> #include <doc.hxx> #include <pam.hxx> @@ -1801,8 +1800,8 @@ HTMLEndPosLst::HTMLEndPosLst( SwDoc *pD, SwDoc* pTempl, xub_StrLen nPos = 0; while( nPos < nEndPos ) { - sal_uInt16 nScript = pBreakIt->xBreak->getScriptType( rText, nPos ); - nPos = (xub_StrLen)pBreakIt->xBreak->endOfScript( rText, nPos, nScript ); + sal_uInt16 nScript = pBreakIt->GetBreakIter()->getScriptType( rText, nPos ); + nPos = (xub_StrLen)pBreakIt->GetBreakIter()->endOfScript( rText, nPos, nScript ); aScriptChgLst.Insert( nPos, aScriptChgLst.Count() ); aScriptLst.Insert( nScript, aScriptLst.Count() ); } @@ -2495,7 +2494,7 @@ Writer& OutHTML_SwTxtNode( Writer& rWrt, const SwCntntNode& rNode ) if( RES_TXTATR_FIELD == pHt->Which() ) // Felder nicht continue; // ausgeben - if( pHt->GetEnd() ) + if ( pHt->GetEnd() && !pHt->HasDummyChar() ) { xub_StrLen nHtEnd = *pHt->GetEnd(), nHtStt = *pHt->GetStart(); @@ -2555,7 +2554,7 @@ Writer& OutHTML_SwTxtNode( Writer& rWrt, const SwCntntNode& rNode ) && nStrPos != nEnde ) { do { - if( pHt->GetEnd() ) + if ( pHt->GetEnd() && !pHt->HasDummyChar() ) { if( RES_CHRATR_KERNING == pHt->Which() && rHTMLWrt.IsHTMLMode(HTMLMODE_FIRSTLINE) && @@ -3041,15 +3040,6 @@ static Writer& OutHTML_SwFlyCnt( Writer& rWrt, const SfxPoolItem& rHt ) return rWrt; } -static Writer& OutHTML_SwHardBlank( Writer& rWrt, const SfxPoolItem& rHt ) -{ - HTMLOutContext aContext ( ((SwHTMLWriter&)rWrt).eDestEnc ); - HTMLOutFuncs::Out_Char( rWrt.Strm(), ((SwFmtHardBlank&)rHt).GetChar(), - aContext, - &((SwHTMLWriter&)rWrt).aNonConvertableCharacters); - HTMLOutFuncs::FlushToAscii( rWrt.Strm(), aContext ); - return rWrt; -} // Das ist jetzt unser Blink-Item. Blinkend wird eingeschaltet, indem man // das Item auf TRUE setzt! @@ -3416,7 +3406,7 @@ SwAttrFnTab aHTMLAttrFnTab = { /* RES_TXTATR_FLYCNT */ OutHTML_SwFlyCnt, /* RES_TXTATR_FTN */ OutHTML_SwFmtFtn, /* RES_TXTATR_SOFTHYPH */ 0, -/* RES_TXTATR_HARDBLANK*/ OutHTML_SwHardBlank, +/* RES_TXTATR_HARDBLANK*/ 0, /* RES_TXTATR_DUMMY1 */ 0, // Dummy: /* RES_TXTATR_DUMMY2 */ 0, // Dummy: diff --git a/sw/source/filter/html/htmlbas.cxx b/sw/source/filter/html/htmlbas.cxx index bb003d292ed8..e591d2d5e90b 100644 --- a/sw/source/filter/html/htmlbas.cxx +++ b/sw/source/filter/html/htmlbas.cxx @@ -47,6 +47,8 @@ #include <svtools/htmltokn.h> #include <svtools/htmlkywd.hxx> +#include <com/sun/star/document/XEventsSupplier.hpp> +#include <com/sun/star/uno/Reference.hxx> #include <fmtornt.hxx> #include <fmtfld.hxx> @@ -251,7 +253,7 @@ void SwHTMLParser::AddScriptSource() } } -void SwHTMLParser::InsertBasicDocEvent( USHORT nEvent, const String& rName, +void SwHTMLParser::InsertBasicDocEvent( rtl::OUString aEvent, const String& rName, ScriptType eScrType, const String& rScrType ) { @@ -270,8 +272,10 @@ void SwHTMLParser::InsertBasicDocEvent( USHORT nEvent, const String& rName, if( EXTENDED_STYPE == eScrType ) sScriptType = rScrType; + rtl::OUString aEventName; + SfxEventConfiguration* pECfg = SFX_APP()->GetEventConfig(); - pECfg->ConfigureEvent( nEvent, SvxMacro( sEvent, sScriptType, eScrType ), + pECfg->ConfigureEvent( aEvent, SvxMacro( sEvent, sScriptType, eScrType ), pDocSh ); } @@ -338,6 +342,10 @@ void SwHTMLWriter::OutBasic() SFX_APP()->LeaveBasicCall(); } +static const char* aEventNames[] = +{ + "OnLoad", "OnPrepareUnload", "OnFocus", "OnUnfocus" +}; void SwHTMLWriter::OutBasicBodyEvents() { @@ -345,14 +353,19 @@ void SwHTMLWriter::OutBasicBodyEvents() if( !pDocSh ) return; - SfxEventConfiguration* pECfg = SFX_APP()->GetEventConfig(); - ASSERT( pECfg, "Wo ist die Event-Konfiguration?" ); - if( !pECfg ) - return; + SvxMacroTableDtor *pDocTable = new SvxMacroTableDtor; + + uno::Reference< document::XEventsSupplier > xSup( pDocSh->GetModel(), uno::UNO_QUERY ); + uno::Reference < container::XNameReplace > xEvents = xSup->getEvents(); + for ( sal_Int32 i=0; i<4; i++ ) + { + SvxMacro* pMacro = SfxEventConfiguration::ConvertToMacro( xEvents->getByName( ::rtl::OUString::createFromAscii(aEventNames[i]) ), pDocSh, TRUE ); + if ( pMacro ) + pDocTable->Insert( aBodyEventTable[i].nEvent, pMacro ); + } - SvxMacroTableDtor *pMacTable = pECfg->GetDocEventTable( pDocSh ); - if( pMacTable && pMacTable->Count() ) - HTMLOutFuncs::Out_Events( Strm(), *pMacTable, aBodyEventTable, + if( pDocTable && pDocTable->Count() ) + HTMLOutFuncs::Out_Events( Strm(), *pDocTable, aBodyEventTable, bCfgStarBasic, eDestEnc, &aNonConvertableCharacters ); } diff --git a/sw/source/filter/html/htmlfld.cxx b/sw/source/filter/html/htmlfld.cxx index 7e3e088eb7d9..c9930c3ca8ef 100644 --- a/sw/source/filter/html/htmlfld.cxx +++ b/sw/source/filter/html/htmlfld.cxx @@ -547,7 +547,7 @@ void SwHTMLParser::NewField() } else { - pDoc->Insert( *pPam, SwFmtFld(*pFld), 0 ); + pDoc->InsertPoolItem( *pPam, SwFmtFld(*pFld), 0 ); delete pFld; } bInField = TRUE; @@ -585,7 +585,7 @@ void SwHTMLParser::EndField() break; } - pDoc->Insert( *pPam, SwFmtFld(*pField), 0 ); + pDoc->InsertPoolItem( *pPam, SwFmtFld(*pField), 0 ); delete pField; pField = 0; } diff --git a/sw/source/filter/html/htmlfldw.cxx b/sw/source/filter/html/htmlfldw.cxx index b3ef7f67d75e..d9e7f92ec6a3 100644 --- a/sw/source/filter/html/htmlfldw.cxx +++ b/sw/source/filter/html/htmlfldw.cxx @@ -312,8 +312,8 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pFld, sal_Bool bNeedsCJKProcessing = sal_False; if( sExpand.Len() ) { - sal_uInt16 nScriptType = pBreakIt->xBreak->getScriptType( sExpand, 0 ); - xub_StrLen nPos = (xub_StrLen)pBreakIt->xBreak->endOfScript( sExpand, 0, + sal_uInt16 nScriptType = pBreakIt->GetBreakIter()->getScriptType( sExpand, 0 ); + xub_StrLen nPos = (xub_StrLen)pBreakIt->GetBreakIter()->endOfScript( sExpand, 0, nScriptType ); sal_uInt16 nScript = @@ -361,10 +361,10 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pFld, xub_StrLen nPos = 0; do { - sal_uInt16 nScriptType = pBreakIt->xBreak->getScriptType( sExpand, nPos ); + sal_uInt16 nScriptType = pBreakIt->GetBreakIter()->getScriptType( sExpand, nPos ); sal_uInt16 nScript = SwHTMLWriter::GetCSS1ScriptForScriptType( nScriptType ); - xub_StrLen nEndPos = (xub_StrLen)pBreakIt->xBreak->endOfScript( + xub_StrLen nEndPos = (xub_StrLen)pBreakIt->GetBreakIter()->endOfScript( sExpand, nPos, nScriptType ); if( nScript != CSS1_OUTMODE_ANY_SCRIPT && /* #108791# */ nScript != rHTMLWrt.nCSS1Script ) diff --git a/sw/source/filter/html/htmlftn.cxx b/sw/source/filter/html/htmlftn.cxx index 7a10dca5b421..f5c62bb612c2 100644 --- a/sw/source/filter/html/htmlftn.cxx +++ b/sw/source/filter/html/htmlftn.cxx @@ -228,11 +228,10 @@ void SwHTMLParser::FinishFootEndNote() if( pFootEndNoteImpl->bFixed ) aFtn.SetNumStr( pFootEndNoteImpl->sContent ); - pDoc->Insert( *pPam, aFtn, 0 ); - SwTxtFtn *pTxtFtn = - (SwTxtFtn *)pPam->GetNode()->GetTxtNode()->GetTxtAttr( - pPam->GetPoint()->nContent.GetIndex() - 1, - RES_TXTATR_FTN ); + pDoc->InsertPoolItem( *pPam, aFtn, 0 ); + SwTxtFtn * const pTxtFtn = static_cast<SwTxtFtn *>( + pPam->GetNode()->GetTxtNode()->GetTxtAttrForCharAt( + pPam->GetPoint()->nContent.GetIndex() - 1, RES_TXTATR_FTN ) ); // In Kopf- und Fusszeilen duerfen keine Fussnoten eingefuegt werden. if( pTxtFtn ) { diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx index 904648f75bd2..d18a2b762aa0 100644 --- a/sw/source/filter/html/htmlgrin.cxx +++ b/sw/source/filter/html/htmlgrin.cxx @@ -53,7 +53,7 @@ #include <svtools/imap.hxx> #include <svtools/htmltokn.h> #include <svtools/htmlkywd.hxx> - +#include <svtools/eventcfg.hxx> #include <fmtornt.hxx> #include <fmturl.hxx> @@ -841,7 +841,7 @@ void SwHTMLParser::InsertBodyOptions() { const HTMLOption *pOption = (*pHTMLOptions)[--i]; ScriptType eScriptType2 = eDfltScriptType; - USHORT nEvent = 0; + rtl::OUString aEvent; BOOL bSetEvent = FALSE; switch( pOption->GetToken() ) @@ -872,28 +872,28 @@ void SwHTMLParser::InsertBodyOptions() case HTML_O_SDONLOAD: eScriptType2 = STARBASIC; case HTML_O_ONLOAD: - nEvent = SFX_EVENT_OPENDOC; + aEvent = GlobalEventConfig::GetEventName( STR_EVENT_OPENDOC ); bSetEvent = TRUE; break; case HTML_O_SDONUNLOAD: eScriptType2 = STARBASIC; case HTML_O_ONUNLOAD: - nEvent = SFX_EVENT_PREPARECLOSEDOC; + aEvent = GlobalEventConfig::GetEventName( STR_EVENT_PREPARECLOSEDOC ); bSetEvent = TRUE; break; case HTML_O_SDONFOCUS: eScriptType2 = STARBASIC; case HTML_O_ONFOCUS: - nEvent = SFX_EVENT_ACTIVATEDOC; + aEvent = GlobalEventConfig::GetEventName( STR_EVENT_ACTIVATEDOC ); bSetEvent = TRUE; break; case HTML_O_SDONBLUR: eScriptType2 = STARBASIC; case HTML_O_ONBLUR: - nEvent = SFX_EVENT_DEACTIVATEDOC; + aEvent = GlobalEventConfig::GetEventName( STR_EVENT_DEACTIVATEDOC ); bSetEvent = TRUE; break; @@ -919,7 +919,7 @@ void SwHTMLParser::InsertBodyOptions() { const String& rEvent = pOption->GetString(); if( rEvent.Len() ) - InsertBasicDocEvent( nEvent, rEvent, eScriptType2, + InsertBasicDocEvent( aEvent, rEvent, eScriptType2, sDfltScriptType ); } } @@ -1374,7 +1374,7 @@ void SwHTMLParser::StripTrailingPara() if( pPrvNd ) { SwIndex aSrc( pCNd, 0 ); - pCNd->GetTxtNode()->Cut( pPrvNd, aSrc, pCNd->Len() ); + pCNd->GetTxtNode()->CutText( pPrvNd, aSrc, pCNd->Len() ); } } @@ -1436,9 +1436,10 @@ void SwHTMLParser::StripTrailingPara() xub_StrLen nPos = pPam->GetPoint()->nContent.GetIndex(); while( bSetSmallFont && nPos>0 ) { - bSetSmallFont = CH_TXTATR_BREAKWORD == - pTxtNd->GetTxt().GetChar( --nPos ) && - 0 != pTxtNd->GetTxtAttr( nPos, RES_TXTATR_FLYCNT ); + --nPos; + bSetSmallFont = + (CH_TXTATR_BREAKWORD == pTxtNd->GetTxt().GetChar( nPos )) && + (0 != pTxtNd->GetTxtAttrForCharAt( nPos, RES_TXTATR_FLYCNT )); } } diff --git a/sw/source/filter/html/htmlsect.cxx b/sw/source/filter/html/htmlsect.cxx index f1eb32d730a6..a4fb7f70ff66 100644 --- a/sw/source/filter/html/htmlsect.cxx +++ b/sw/source/filter/html/htmlsect.cxx @@ -351,7 +351,7 @@ void SwHTMLParser::NewDivision( int nToken ) aItemSet.ClearItem( RES_FRAMEDIR ); } - pDoc->Insert( *pPam, aSection, &aFrmItemSet, sal_False ); + pDoc->InsertSwSection( *pPam, aSection, &aFrmItemSet, false ); // ggfs. einen Bereich anspringen if( JUMPTO_REGION == eJumpTo && aName == sJmpMark ) @@ -746,7 +746,7 @@ void SwHTMLParser::NewMultiCol() aFrmItemSet.Put( *pItem ); aItemSet.ClearItem( RES_FRAMEDIR ); } - pDoc->Insert( *pPam, aSection, &aFrmItemSet, sal_False ); + pDoc->InsertSwSection( *pPam, aSection, &aFrmItemSet, false ); // Jump to section, if this is requested. if( JUMPTO_REGION == eJumpTo && aName == sJmpMark ) diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx index 4a07c89612a7..e9578e0ffaed 100644 --- a/sw/source/filter/html/htmltab.cxx +++ b/sw/source/filter/html/htmltab.cxx @@ -3030,7 +3030,7 @@ xub_StrLen SwHTMLParser::StripTrailingLF() nPos = nLen - nLFCount; SwIndex nIdx( pTxtNd, nPos ); - pTxtNd->Erase( nIdx, nLFCount ); + pTxtNd->EraseText( nIdx, nLFCount ); nStripped = nLFCount; } } @@ -5495,7 +5495,8 @@ HTMLTable *SwHTMLParser::BuildTable( SvxAdjust eParentAdjust, pNd = pTblStNd->EndOfSectionNode(); SwNodeIndex aDstIdx( *pNd, bTop ? 0 : 1 ); - pDoc->Move( aSrcRg, aDstIdx, IDocumentContentOperations::DOC_MOVEDEFAULT ); + pDoc->MoveNodeRange( aSrcRg, aDstIdx, + IDocumentContentOperations::DOC_MOVEDEFAULT ); // Wenn die Caption vor der Tabelle eingefuegt wurde muss // eine an der Tabelle gestzte Seitenvorlage noch in den diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 3760768006d9..8a44ff0e26ca 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -79,7 +79,6 @@ #include <charatr.hxx> #include <fmtfld.hxx> #include <fmtpdsc.hxx> -#include <fmthbsh.hxx> #include <txtfld.hxx> #include <fmtanchr.hxx> #include <fmtsrnd.hxx> @@ -235,7 +234,7 @@ ULONG HTMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPam, const // sonst ist sie schon gesetzt. if( !rDoc.get(IDocumentSettingAccess::HTML_MODE) ) { - rDoc.Insert( rPam, SwFmtPageDesc( + rDoc.InsertPoolItem( rPam, SwFmtPageDesc( rDoc.GetPageDescFromPool( RES_POOLPAGE_HTML, false )), 0 ); } } @@ -1282,7 +1281,9 @@ void __EXPORT SwHTMLParser::NextToken( int nToken ) pPageDesc = pCSS1Parser->GetRightPageDesc(); if( pPageDesc ) - pDoc->Insert( *pPam, SwFmtPageDesc( pPageDesc ), 0 ); + { + pDoc->InsertPoolItem( *pPam, SwFmtPageDesc( pPageDesc ), 0 ); + } } break; @@ -1436,11 +1437,11 @@ void __EXPORT SwHTMLParser::NextToken( int nToken ) break; case HTML_NONBREAKSPACE: - pDoc->Insert( *pPam, CHAR_HARDBLANK ); + pDoc->InsertString( *pPam, CHAR_HARDBLANK ); break; case HTML_SOFTHYPH: - pDoc->Insert( *pPam, CHAR_SOFTHYPHEN ); + pDoc->InsertString( *pPam, CHAR_SOFTHYPHEN ); break; case HTML_LINEFEEDCHAR: @@ -1482,7 +1483,7 @@ void __EXPORT SwHTMLParser::NextToken( int nToken ) { if( !bDocInitalized ) DocumentDetected(); - pDoc->Insert( *pPam, aToken, true ); + pDoc->InsertString( *pPam, aToken ); // wenn es noch vorlaefige Absatz-Attribute gibt, der Absatz aber // nicht leer ist, dann sind die Absatz-Attribute entgueltig. @@ -2190,9 +2191,9 @@ BOOL SwHTMLParser::AppendTxtNode( SwHTMLAppendMode eMode, BOOL bUpdateNum ) { const String& rText = pTxtNd->GetTxt(); sal_uInt16 nScriptTxt = - pBreakIt->xBreak->getScriptType( + pBreakIt->GetBreakIter()->getScriptType( rText, pAttr->GetSttCnt() ); - xub_StrLen nScriptEnd = (xub_StrLen)pBreakIt->xBreak + xub_StrLen nScriptEnd = (xub_StrLen)pBreakIt->GetBreakIter() ->endOfScript( rText, nStt, nScriptTxt ); while( nScriptEnd < nEndCnt ) { @@ -2212,9 +2213,9 @@ BOOL SwHTMLParser::AppendTxtNode( SwHTMLAppendMode eMode, BOOL bUpdateNum ) pNext->InsertPrev( pSetAttr ); } nStt = nScriptEnd; - nScriptTxt = pBreakIt->xBreak->getScriptType( + nScriptTxt = pBreakIt->GetBreakIter()->getScriptType( rText, nStt ); - nScriptEnd = (xub_StrLen)pBreakIt->xBreak + nScriptEnd = (xub_StrLen)pBreakIt->GetBreakIter() ->endOfScript( rText, nStt, nScriptTxt ); } bInsert = nScriptItem == nScriptTxt; @@ -2336,7 +2337,7 @@ BOOL SwHTMLParser::AppendTxtNode( SwHTMLAppendMode eMode, BOOL bUpdateNum ) // also delete the SwpHints!!! To avoid any trouble // we leave the loop immediately if this is the last // hint. - pTxtNd->Delete( pHt, sal_True ); + pTxtNd->DeleteAttribute( pHt ); if( 1 == nCntAttr ) break; i--; @@ -2821,7 +2822,7 @@ void SwHTMLParser::_SetAttr( BOOL bChkEnd, BOOL bBeforeTable, eJumpTo = JUMPTO_NONE; } - pDoc->Insert( *pAttrPam, *pAttr->pItem, nsSetAttrMode::SETATTR_DONTREPLACE ); + pDoc->InsertPoolItem( *pAttrPam, *pAttr->pItem, nsSetAttrMode::SETATTR_DONTREPLACE ); } pAttrPam->DeleteMark(); @@ -2903,7 +2904,7 @@ void SwHTMLParser::_SetAttr( BOOL bChkEnd, BOOL bBeforeTable, pAttrPam->Move( fnMoveBackward ); } - pDoc->Insert( *pAttrPam, *pAttr->pItem, 0 ); + pDoc->InsertPoolItem( *pAttrPam, *pAttr->pItem, 0 ); aFields.Remove( 0, 1 ); delete pAttr; @@ -3007,9 +3008,9 @@ void SwHTMLParser::EndAttr( _HTMLAttr* pAttr, _HTMLAttr **ppDepAttr, .GetTxtNode(); ASSERT( pTxtNd, "No text node" ); const String& rText = pTxtNd->GetTxt(); - sal_uInt16 nScriptTxt = pBreakIt->xBreak->getScriptType( + sal_uInt16 nScriptTxt = pBreakIt->GetBreakIter()->getScriptType( rText, pAttr->GetSttCnt() ); - xub_StrLen nScriptEnd = (xub_StrLen)pBreakIt->xBreak + xub_StrLen nScriptEnd = (xub_StrLen)pBreakIt->GetBreakIter() ->endOfScript( rText, pAttr->GetSttCnt(), nScriptTxt ); while( nScriptEnd < nEndCnt ) { @@ -3027,9 +3028,9 @@ void SwHTMLParser::EndAttr( _HTMLAttr* pAttr, _HTMLAttr **ppDepAttr, } } pAttr->nSttCntnt = nScriptEnd; - nScriptTxt = pBreakIt->xBreak->getScriptType( + nScriptTxt = pBreakIt->GetBreakIter()->getScriptType( rText, nScriptEnd ); - nScriptEnd = (xub_StrLen)pBreakIt->xBreak + nScriptEnd = (xub_StrLen)pBreakIt->GetBreakIter() ->endOfScript( rText, nScriptEnd, nScriptTxt ); } bInsert = nScriptItem == nScriptTxt; @@ -4941,7 +4942,7 @@ void SwHTMLParser::InsertSpacer() { NewAttr( &aAttrTab.pKerning, SvxKerningItem( (short)nSize, RES_CHRATR_KERNING ) ); String aTmp( ' ' ); - pDoc->Insert( *pPam, aTmp /*, CHARSET_ANSI*/, true ); + pDoc->InsertString( *pPam, aTmp ); EndAttr( aAttrTab.pKerning ); } } @@ -5149,7 +5150,7 @@ void SwHTMLParser::InsertLineBreak() // wenn kein CLEAR ausgefuehrt werden sollte oder konnte, wird // ein Zeilenumbruch eingef?gt String sTmp( (sal_Unicode)0x0a ); // make the Mac happy :-) - pDoc->Insert( *pPam, sTmp, true ); + pDoc->InsertString( *pPam, sTmp ); } else if( pPam->GetPoint()->nContent.GetIndex() ) { diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx index 7b8f08c4d69a..ee2a22f24349 100644 --- a/sw/source/filter/html/swhtml.hxx +++ b/sw/source/filter/html/swhtml.hxx @@ -782,7 +782,7 @@ private: void AddScriptSource(); // ein Event in die SFX-Konfiguation eintragen (htmlbas.cxx) - void InsertBasicDocEvent( sal_uInt16 nEvent, const String& rName, + void InsertBasicDocEvent( rtl::OUString aEventName, const String& rName, ScriptType eScrType, const String& rScrType ); // ein Event an ein VC-Control anhaengen (htmlform.cxx) diff --git a/sw/source/filter/rtf/rtfatr.cxx b/sw/source/filter/rtf/rtfatr.cxx index d1b0f0f7859c..6b033fe73e52 100644 --- a/sw/source/filter/rtf/rtfatr.cxx +++ b/sw/source/filter/rtf/rtfatr.cxx @@ -102,7 +102,6 @@ #include <fmtfld.hxx> #include <fmtflcnt.hxx> #include <fmtftn.hxx> -#include <fmthbsh.hxx> #include <fchrfmt.hxx> #include <fmtautofmt.hxx> #include <fmtcntnt.hxx> @@ -2790,8 +2789,8 @@ static Writer& OutRTF_SwField( Writer& rWrt, const SfxPoolItem& rHt ) */ const String& rFldPar1 = pFld->GetPar1(); USHORT nScript; - if( pBreakIt->xBreak.is() ) - nScript = pBreakIt->xBreak->getScriptType( rFldPar1, 0); + if( pBreakIt->GetBreakIter().is() ) + nScript = pBreakIt->GetBreakIter()->getScriptType( rFldPar1, 0); else nScript = i18n::ScriptType::ASIAN; @@ -3048,14 +3047,6 @@ static Writer& OutRTF_SwFtn( Writer& rWrt, const SfxPoolItem& rHt ) return rWrt; } -static Writer& OutRTF_SwHardBlank( Writer& rWrt, const SfxPoolItem& rHt) -{ - RTFOutFuncs::Out_String(rWrt.Strm(), - String(((SwFmtHardBlank&)rHt).GetChar()), ((SwRTFWriter&)rWrt).eDefaultEncoding, - ((SwRTFWriter&)rWrt).bWriteHelpFmt); - return rWrt; -} - static Writer& OutRTF_SwTxtCharFmt( Writer& rWrt, const SfxPoolItem& rHt ) { const SwFmtCharFmt& rChrFmt = (const SwFmtCharFmt&)rHt; @@ -3110,8 +3101,8 @@ static Writer& OutRTF_SwTxtRuby( Writer& rWrt, const SfxPoolItem& rHt ) defaulting to asian. */ USHORT nScript; - if( pBreakIt->xBreak.is() ) - nScript = pBreakIt->xBreak->getScriptType( rRuby.GetText(), 0); + if( pBreakIt->GetBreakIter().is() ) + nScript = pBreakIt->GetBreakIter()->getScriptType( rRuby.GetText(), 0); else nScript = i18n::ScriptType::ASIAN; @@ -3153,8 +3144,8 @@ static Writer& OutRTF_SwTxtRuby( Writer& rWrt, const SfxPoolItem& rHt ) rWrt.Strm() << "\\\\a" << cDirective; rWrt.Strm() << "(\\\\s\\\\up "; - if( pBreakIt->xBreak.is() ) - nScript = pBreakIt->xBreak->getScriptType( pNd->GetTxt(), + if( pBreakIt->GetBreakIter().is() ) + nScript = pBreakIt->GetBreakIter()->getScriptType( pNd->GetTxt(), *pRubyTxt->GetStart() ); else nScript = i18n::ScriptType::ASIAN; @@ -4275,7 +4266,7 @@ SwAttrFnTab aRTFAttrFnTab = { /* RES_TXTATR_FLYCNT */ OutRTF_SwFlyCntnt, /* RES_TXTATR_FTN */ OutRTF_SwFtn, /* RES_TXTATR_SOFTHYPH */ 0, // old attr. - coded now by character -/* RES_TXTATR_HARDBLANK*/ OutRTF_SwHardBlank, +/* RES_TXTATR_HARDBLANK*/ 0, /* RES_TXTATR_DUMMY1 */ 0, // Dummy: /* RES_TXTATR_DUMMY2 */ 0, // Dummy: diff --git a/sw/source/filter/rtf/rtffld.cxx b/sw/source/filter/rtf/rtffld.cxx index b608ad1b622e..8985d58429c3 100644 --- a/sw/source/filter/rtf/rtffld.cxx +++ b/sw/source/filter/rtf/rtffld.cxx @@ -450,7 +450,7 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr ) // steht jetzt geanu auf dem Format-Namen aFld.ChangeFormat( CheckNumberFmtStr( aSaveStr )); } - pDoc->Insert( *pPam, SwFmtFld( aFld ), 0 ); + pDoc->InsertPoolItem( *pPam, SwFmtFld( aFld ), 0 ); SkipGroup(); } break; @@ -469,7 +469,7 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr ) // steht jetzt geanu auf dem Format-Namen aPF.ChangeFormat( CheckNumberFmtStr( aSaveStr )); } - pDoc->Insert( *pPam, SwFmtFld( aPF ), 0 ); + pDoc->InsertPoolItem( *pPam, SwFmtFld( aPF ), 0 ); SkipGroup(); // ueberlese den Rest } break; @@ -480,8 +480,8 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr ) { // es fehlt die Format - Angabe: defaulten auf Datum pFldType = pDoc->GetSysFldType( RES_DATETIMEFLD ); - pDoc->Insert( *pPam, SwFmtFld( SwDateTimeField( - (SwDateTimeFieldType*)pFldType, DATEFLD )), 0); + pDoc->InsertPoolItem( *pPam, SwFmtFld( SwDateTimeField( + static_cast<SwDateTimeFieldType*>(pFldType), DATEFLD)), 0); } else { @@ -524,7 +524,7 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr ) if( pFld ) { - pDoc->Insert( *pPam, SwFmtFld( *pFld ), 0); + pDoc->InsertPoolItem( *pPam, SwFmtFld( *pFld ), 0); delete pFld; } } @@ -553,8 +553,8 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr ) if( bField ) { pFldType = pDoc->GetSysFldType( RES_DBNAMEFLD ); - pDoc->Insert( *pPam, SwFmtFld( SwDBNameField( - (SwDBNameFieldType*)pFldType, SwDBData() ) ), 0); + pDoc->InsertPoolItem( *pPam, SwFmtFld( SwDBNameField( + static_cast<SwDBNameFieldType*>(pFldType), SwDBData())), 0); } else pDoc->ChgDBData( aData ); // MS: Keine DBInfo verwenden @@ -569,7 +569,7 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr ) SwDBField aDBFld( (SwDBFieldType*)pDoc->InsertFldType( aTmp )); aDBFld.ChangeFormat( UF_STRING ); - pDoc->Insert( *pPam, SwFmtFld( aDBFld ), 0); + pDoc->InsertPoolItem(*pPam, SwFmtFld( aDBFld ), 0); SkipGroup(); // ueberlese den Rest } break; @@ -598,7 +598,7 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr ) sal_Unicode nChar = (sal_Unicode)sParam.ToInt32(); if( nChar ) { - pDoc->Insert( *pPam, nChar ); + pDoc->InsertString( *pPam, nChar ); bCharIns = TRUE; } } @@ -708,8 +708,8 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr ) { //Make a guess at which of asian of western we should be setting USHORT nScript; - if (pBreakIt->xBreak.is()) - nScript = pBreakIt->xBreak->getScriptType( aData.sUp, 0); + if (pBreakIt->GetBreakIter().is()) + nScript = pBreakIt->GetBreakIter()->getScriptType( aData.sUp, 0); else nScript = i18n::ScriptType::ASIAN; @@ -763,10 +763,11 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr ) aRuby.SetAdjustment( (USHORT)aData.nJustificationCode ); // im FieldStr steht der anzuzeigenden Text, im - pDoc->Insert( *pPam, aData.sText, true ); + pDoc->InsertString( *pPam, aData.sText ); pPam->SetMark(); pPam->GetMark()->nContent -= aData.sText.Len(); - pDoc->Insert( *pPam, aRuby, nsSetAttrMode::SETATTR_DONTEXPAND ); + pDoc->InsertPoolItem( *pPam, aRuby, + nsSetAttrMode::SETATTR_DONTEXPAND ); pPam->DeleteMark(); } // or a combined character field? @@ -778,7 +779,7 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr ) sFld += aData.sDown; SwCombinedCharField aFld((SwCombinedCharFieldType*)pDoc-> GetSysFldType( RES_COMBINED_CHARS ), sFld ); - pDoc->Insert( *pPam, SwFmtFld( aFld ), 0); + pDoc->InsertPoolItem( *pPam, SwFmtFld( aFld ), 0); } SkipGroup(); // ueberlese den Rest @@ -808,7 +809,9 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr ) sOrigBkmName,REF_BOOKMARK,0,REF_PAGE); if(!bNestedField) - pDoc->Insert( *pPam, SwFmtFld( aFld ), 0 ); + { + pDoc->InsertPoolItem( *pPam, SwFmtFld( aFld ), 0 ); + } else bNestedField = false; } @@ -850,14 +853,14 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr ) SwGetRefField aFld( (SwGetRefFieldType*)pDoc->GetSysFldType( RES_GETREFFLD ), sOrigBkmName,REF_BOOKMARK,0,REF_CHAPTER); - pDoc->Insert( *pPam, SwFmtFld( aFld ), 0 ); + pDoc->InsertPoolItem( *pPam, SwFmtFld( aFld ), 0 ); } else { SwGetRefField aFld( (SwGetRefFieldType*)pDoc->GetSysFldType( RES_GETREFFLD ), sOrigBkmName,REF_BOOKMARK,0,REF_CONTENT); - pDoc->Insert( *pPam, SwFmtFld( aFld ), 0 ); + pDoc->InsertPoolItem( *pPam, SwFmtFld( aFld ), 0 ); } } @@ -866,7 +869,7 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr ) SwGetRefField aFld( (SwGetRefFieldType*) pDoc->GetSysFldType( RES_GETREFFLD ), sOrigBkmName, REF_BOOKMARK, 0, REF_UPDOWN ); - pDoc->Insert(*pPam, SwFmtFld(aFld), 0); + pDoc->InsertPoolItem(*pPam, SwFmtFld(aFld), 0); } } break; @@ -882,7 +885,7 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr ) SwUserFieldType aTmp( pDoc, aSaveStr ); SwUserField aUFld( (SwUserFieldType*)pDoc->InsertFldType( aTmp )); aUFld.ChangeFormat( UF_STRING ); - pDoc->Insert( *pPam, SwFmtFld( aUFld ), 0); + pDoc->InsertPoolItem( *pPam, SwFmtFld( aUFld ), 0); nRet = RTFFLD_UNKNOWN; } break; @@ -1045,7 +1048,8 @@ void SwRTFParser::ReadField() // FieldResult wurde eingelesen if (SwTxtNode* pTxtNd = pPam->GetPoint()->nNode.GetNode().GetTxtNode()) { - SwTxtAttr* pFldAttr = pTxtNd->GetTxtAttr( + SwTxtAttr* const pFldAttr = + pTxtNd->GetTxtAttrForCharAt( pPam->GetPoint()->nContent.GetIndex()-1 ); if (pFldAttr) @@ -1078,7 +1082,7 @@ void SwRTFParser::ReadField() sNestedFieldStr.Erase(); // im FieldStr steht der anzuzeigenden Text, im - pDoc->Insert( *pPam, sFieldStr, true ); + pDoc->InsertString( *pPam, sFieldStr ); String sTarget( sFieldNm.GetToken( 1, '\1' )); if( sTarget.Len() ) @@ -1087,7 +1091,7 @@ void SwRTFParser::ReadField() // oder ueber den Stack setzen?? pPam->SetMark(); pPam->GetMark()->nContent -= sFieldStr.Len(); - pDoc->Insert( *pPam, + pDoc->InsertPoolItem( *pPam, SwFmtINetFmt( sFieldNm, sTarget ), nsSetAttrMode::SETATTR_DONTEXPAND ); pPam->DeleteMark(); diff --git a/sw/source/filter/rtf/rtffly.cxx b/sw/source/filter/rtf/rtffly.cxx index e4f1adc8850c..e4043f2e8529 100644 --- a/sw/source/filter/rtf/rtffly.cxx +++ b/sw/source/filter/rtf/rtffly.cxx @@ -396,7 +396,8 @@ void SwRTFParser::SetFlysInDoc() } } aTmpIdx = *pSttNd->EndOfSectionNode(); - pDoc->Move( aRg, aTmpIdx, IDocumentContentOperations::DOC_MOVEDEFAULT ); + pDoc->MoveNodeRange( aRg, aTmpIdx, + IDocumentContentOperations::DOC_MOVEDEFAULT ); } // patch from cmc for #i52542# @@ -1174,7 +1175,7 @@ void SwRTFParser::ReadFly( int nToken, SfxItemSet* pSet ) { SwTxtNode* pTxtNd = pFlySave->nSttNd.GetNode().GetTxtNode(); - SwTxtFlyCnt* pFlyCnt; + SwTxtFlyCnt* pFlyCnt = 0; if( 1 == pTxtNd->GetTxt().Len() && 0 != ( pFlyCnt = (SwTxtFlyCnt*)pTxtNd->GetTxtAttr( 0, RES_TXTATR_FLYCNT )) && @@ -1232,7 +1233,8 @@ void SwRTFParser::ReadFly( int nToken, SfxItemSet* pSet ) (SwTxtFmtColl*)pDoc->GetDfltTxtFmtColl() ); SwNodeIndex aTmp( pFlySave->nSttNd, +1 ); - pDoc->Move( aRg, aTmp, IDocumentContentOperations::DOC_MOVEDEFAULT ); + pDoc->MoveNodeRange( aRg, aTmp, + IDocumentContentOperations::DOC_MOVEDEFAULT ); // now delete the redundant txtnode pDoc->GetNodes().Delete( pFlySave->nSttNd, 1 ); diff --git a/sw/source/filter/rtf/rtftbl.cxx b/sw/source/filter/rtf/rtftbl.cxx index 736bbf3d750b..4fd06a26925f 100644 --- a/sw/source/filter/rtf/rtftbl.cxx +++ b/sw/source/filter/rtf/rtftbl.cxx @@ -851,7 +851,8 @@ void SwRTFParser::ReadTable( int nToken ) //table aRg.SetMark(); aRg.GetMark()->nContent.Assign(aRg.GetCntntNode(), 0); - pDoc->Move(aRg, *pPam->GetPoint(), IDocumentContentOperations::DOC_MOVEDEFAULT); + pDoc->MoveRange(aRg, *pPam->GetPoint(), + IDocumentContentOperations::DOC_MOVEDEFAULT); } //Update the attribute stack entries to reflect that the properties diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx index 6f092a855760..56ff037a6827 100644 --- a/sw/source/filter/rtf/swparrtf.cxx +++ b/sw/source/filter/rtf/swparrtf.cxx @@ -55,7 +55,6 @@ #include <svx/hyznitem.hxx> #include <fmtpdsc.hxx> #include <fmtfld.hxx> -#include <fmthbsh.hxx> #include <fmthdft.hxx> #include <fmtcntnt.hxx> #include <txtftn.hxx> @@ -449,7 +448,6 @@ if( pSttNdIdx->GetIndex()+1 == pPam->GetBound( FALSE ).nNode.GetIndex() ) for (rtfSections::myrDummyIter aI = maSegments.maDummyPageNos.rbegin(); aI != aDEnd; ++aI) pDoc->DelPageDesc(*aI); - if( aFlyArr.Count() ) SetFlysInDoc(); @@ -852,7 +850,8 @@ SwSectionFmt *rtfSections::InsertSection(SwPaM& rMyPaM, rtfSection &rSection) aSet.Put(SvxFrameDirectionItem( nRTLPgn ? FRMDIR_HORI_RIGHT_TOP : FRMDIR_HORI_LEFT_TOP, RES_FRAMEDIR)); - rSection.mpSection = mrReader.pDoc->Insert( rMyPaM, aSection, &aSet ); + rSection.mpSection = + mrReader.pDoc->InsertSwSection( rMyPaM, aSection, &aSet ); ASSERT(rSection.mpSection, "section not inserted!"); if (!rSection.mpSection) return 0; @@ -1003,7 +1002,7 @@ void rtfSections::InsertSegments(bool bNewDoc) aIter->maStart.GetNode().GetCntntNode(), 0); SwPaM aPage(aPamStart); - mrReader.pDoc->Insert(aPage, aPgDesc, 0); + mrReader.pDoc->InsertPoolItem(aPage, aPgDesc, 0); } ++nDesc; } @@ -1824,7 +1823,8 @@ void SwRTFParser::NextToken( int nToken ) if (lcl_UsedPara(*pPam)) InsertPara(); CheckInsNewTblLine(); - pDoc->Insert(*pPam, SvxFmtBreakItem(SVX_BREAK_PAGE_BEFORE, RES_BREAK), 0); + pDoc->InsertPoolItem(*pPam, + SvxFmtBreakItem(SVX_BREAK_PAGE_BEFORE, RES_BREAK), 0); } break; @@ -1976,12 +1976,13 @@ void SwRTFParser::NextToken( int nToken ) &const_cast<const SwDoc *>(pDoc) ->GetPageDesc( USHORT(nTokenValue) ); CheckInsNewTblLine(); - pDoc->Insert( *pPam, SwFmtPageDesc( pPgDsc ), 0); + pDoc->InsertPoolItem(*pPam, SwFmtPageDesc( pPgDsc ), 0); } break; case RTF_COLUM: - pDoc->Insert( *pPam, SvxFmtBreakItem( SVX_BREAK_COLUMN_BEFORE, RES_BREAK ), 0); + pDoc->InsertPoolItem(*pPam, + SvxFmtBreakItem( SVX_BREAK_COLUMN_BEFORE, RES_BREAK ), 0); break; case RTF_DXFRTEXT: // werden nur im Zusammenhang mit Flys ausgewertet @@ -2001,7 +2002,7 @@ SETCHDATEFIELD: SwDateTimeField aDateFld( (SwDateTimeFieldType*) pDoc->GetSysFldType( RES_DATETIMEFLD ), DATEFLD, nFormat); CheckInsNewTblLine(); - pDoc->Insert( *pPam, SwFmtFld( aDateFld ), 0); + pDoc->InsertPoolItem(*pPam, SwFmtFld( aDateFld ), 0); } break; @@ -2013,7 +2014,7 @@ SETCHDATEFIELD: SwDateTimeField aTimeFld( (SwDateTimeFieldType*) pDoc->GetSysFldType( RES_DATETIMEFLD ), TIMEFLD, nFormat); CheckInsNewTblLine(); - pDoc->Insert( *pPam, SwFmtFld( aTimeFld ), 0); + pDoc->InsertPoolItem(*pPam, SwFmtFld( aTimeFld ), 0); } break; @@ -2023,7 +2024,7 @@ SETCHDATEFIELD: pDoc->GetSysFldType( RES_PAGENUMBERFLD ), PG_RANDOM, SVX_NUM_ARABIC ); CheckInsNewTblLine(); - pDoc->Insert( *pPam, SwFmtFld( aPageFld), 0); + pDoc->InsertPoolItem(*pPam, SwFmtFld(aPageFld), 0); } break; @@ -2053,7 +2054,7 @@ SETCHDATEFIELD: CheckInsNewTblLine(); if( nTokenValue ) aToken = (sal_Unicode )nTokenValue; - pDoc->Insert( *pPam, aToken, true ); + pDoc->InsertString( *pPam, aToken ); } break; @@ -2119,7 +2120,7 @@ void SwRTFParser::InsertText() if(pRedlineDelete) mpRedlineStack->open(*pPam->GetPoint(), *pRedlineDelete); - pDoc->Insert( *pPam, aToken, true ); + pDoc->InsertString( *pPam, aToken ); if(pRedlineDelete) { @@ -2283,14 +2284,15 @@ void SwRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet ) } } while( 0 != (pStyle = GetStyleTbl().Next()) ); - pDoc->Insert(aPam, *pCharFmt, 0); + pDoc->InsertPoolItem(aPam, *pCharFmt, 0); rSet.GetAttrSet().ClearItem(RES_TXTATR_CHARFMT); //test hack } if (rSet.GetAttrSet().Count()) { // dann setze ueber diesen Bereich die Attrbiute SetSwgValues(rSet.GetAttrSet()); - pDoc->Insert(aPam, rSet.GetAttrSet(), nsSetAttrMode::SETATTR_DONTCHGNUMRULE); + pDoc->InsertItemSet(aPam, rSet.GetAttrSet(), + nsSetAttrMode::SETATTR_DONTCHGNUMRULE); } } @@ -2452,7 +2454,7 @@ void SwRTFParser::SetPageInformationAsDefault(const DocPageInformation &rInfo) { SwFmtPageDesc aPgDsc( &rPg ); aPgDsc.SetNumOffset( nPgStart ); - pDoc->Insert( *pPam, aPgDsc, 0 ); + pDoc->InsertPoolItem( *pPam, aPgDsc, 0 ); } } } @@ -3711,7 +3713,7 @@ void SwRTFParser::ReadHeaderFooter( int nToken, SwPageDesc* pPageDesc ) aSet.Put( SwFmtAnchor( FLY_IN_CNTNT )); pHdFtFmt = pDoc->MakeFlySection( FLY_IN_CNTNT, pPam->GetPoint(), &aSet ); - pTxtAttr = pPam->GetNode()->GetTxtNode()->GetTxtAttr( + pTxtAttr = pPam->GetNode()->GetTxtNode()->GetTxtAttrForCharAt( nPos, RES_TXTATR_FLYCNT ); ASSERT( pTxtAttr, "konnte den Fly nicht einfuegen/finden" ); @@ -4297,7 +4299,7 @@ void SwRTFParser::UnknownAttrToken( int nToken, SfxItemSet* pSet ) { const SwPageDesc* pPgDsc = &const_cast<const SwDoc *>(pDoc) ->GetPageDesc( (USHORT)nTokenValue ); - pDoc->Insert( *pPam, SwFmtPageDesc( pPgDsc ), 0); + pDoc->InsertPoolItem( *pPam, SwFmtPageDesc( pPgDsc ), 0); } break; case RTF_CS: diff --git a/sw/source/filter/writer/writer.cxx b/sw/source/filter/writer/writer.cxx index 7500adf65ef6..64ffc314d50d 100644 --- a/sw/source/filter/writer/writer.cxx +++ b/sw/source/filter/writer/writer.cxx @@ -340,10 +340,6 @@ ULONG Writer::Write( SwPaM& rPam, SfxMedium& rMed, const String* pFileName ) // This method must be overloaded in SwXMLWriter a storage from medium will be used there. // The microsoft format can write to storage but the storage will be based on the stream. return Write( rPam, *rMed.GetOutStream(), pFileName ); - - // return IsStgWriter() - // ? Write( rPam, rMed.GetStorage(), pFileName ) - // : Write( rPam, *rMed.GetOutStream(), pFileName ); } ULONG Writer::Write( SwPaM& /*rPam*/, SvStorage&, const String* ) diff --git a/sw/source/filter/ww1/fltshell.cxx b/sw/source/filter/ww1/fltshell.cxx index b66adc860f45..27017808707a 100644 --- a/sw/source/filter/ww1/fltshell.cxx +++ b/sw/source/filter/ww1/fltshell.cxx @@ -492,7 +492,7 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, SwFltStackEntry* { // XRefs und Bookmarks sind bereits geUpcased MakeBookRegionOrPoint(pEntry, pDoc, aRegion, TRUE); - pDoc->Insert(aRegion, SwFmtRefMark(rName), 0); + pDoc->InsertPoolItem(aRegion, SwFmtRefMark(rName), 0); } else if( !pB->IsOnlyRef() ) { @@ -506,7 +506,7 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, SwFltStackEntry* pB->GetValSys()); aFld.SetSubType( nsSwExtendedSubType::SUB_INVISIBLE ); MakePoint(pEntry, pDoc, aRegion); - pDoc->Insert(aRegion, SwFmtFld(aFld), 0); + pDoc->InsertPoolItem(aRegion, SwFmtFld(aFld), 0); MoveAttrs( *(aRegion.GetPoint()) ); } } @@ -564,8 +564,9 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, SwFltStackEntry* break; case RES_FLTR_SECTION: MakePoint(pEntry, pDoc, aRegion); // bislang immer Point==Mark - pDoc->Insert(aRegion, *((SwFltSection*)pEntry->pAttr)->GetSection(), - 0, FALSE); + pDoc->InsertSwSection(aRegion, + *(static_cast<SwFltSection*>(pEntry->pAttr))->GetSection(), + 0, false); delete(((SwFltSection*)pEntry->pAttr)->GetSection()); break; case RES_FLTR_REDLINE: @@ -602,7 +603,9 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, SwFltStackEntry* break; default: if (pEntry->MakeRegion(pDoc, aRegion, FALSE)) - pDoc->Insert(aRegion, *pEntry->pAttr, 0); + { + pDoc->InsertPoolItem(aRegion, *pEntry->pAttr, 0); + } break; } } @@ -1006,7 +1009,7 @@ SwFltShell::~SwFltShell() SwFltShell& SwFltShell::operator << ( const String& rStr ) { ASSERT(eSubMode != Style, "char insert while in style-mode"); - GetDoc().Insert( *pPaM, rStr, true ); + GetDoc().InsertString( *pPaM, rStr ); return *this; } @@ -1043,7 +1046,7 @@ String SwFltShell::QuoteStr( const String& rIn ) SwFltShell& SwFltShell::operator << ( const sal_Unicode c ) { ASSERT( eSubMode != Style, "char insert while in style-mode"); - GetDoc().Insert( *pPaM, c ); + GetDoc().InsertString( *pPaM, c ); return *this; } @@ -1060,7 +1063,7 @@ SwFltShell& SwFltShell::AddError( const sal_Char* pErr ) SwSetExpField aFld( (SwSetExpFieldType*)pFT, String::CreateFromAscii( pErr )); //, VVF_INVISIBLE - GetDoc().Insert(*pPaM, SwFmtFld(aFld), 0); + GetDoc().InsertPoolItem(*pPaM, SwFmtFld(aFld), 0); return *this; } @@ -1079,7 +1082,8 @@ void SwFltShell::NextParagraph() void SwFltShell::NextPage() { NextParagraph(); - GetDoc().Insert(*pPaM, SvxFmtBreakItem(SVX_BREAK_PAGE_BEFORE, RES_BREAK), 0); + GetDoc().InsertPoolItem(*pPaM, + SvxFmtBreakItem(SVX_BREAK_PAGE_BEFORE, RES_BREAK), 0); } SwFltShell& SwFltShell::AddGraphic( const String& rPicName ) @@ -1170,7 +1174,7 @@ SwFltShell& SwFltShell::EndItem( USHORT nAttrId ) SwFltShell& SwFltShell::operator << (const SwField& rField) { - GetDoc().Insert(*pPaM, SwFmtFld(rField), 0); + GetDoc().InsertPoolItem(*pPaM, SwFmtFld(rField), 0); return *this; } @@ -1931,7 +1935,7 @@ void SwFltShell::BeginFootnote() // Fussnoten im PMW uebernommen werden SwFmtFtn aFtn; - GetDoc().Insert(*pPaM, aFtn, 0); + GetDoc().InsertPoolItem(*pPaM, aFtn, 0); ASSERT(pSavedPos == NULL, "SwFltShell"); pSavedPos = new SwPosition(*pPaM->GetPoint()); pPaM->Move(fnMoveBackward, fnGoCntnt); @@ -2031,7 +2035,9 @@ SwPageDesc* SwFltShell::MakePageDesc(SwPageDesc* pFirstPageDesc) pNewPD->SetFollow(pNewPD); } else - GetDoc().Insert( *pPaM, SwFmtPageDesc( pNewPD ), 0 ); + { + GetDoc().InsertPoolItem( *pPaM, SwFmtPageDesc( pNewPD ), 0 ); + } pNewPD->WriteUseOn( // alle Seiten (UseOnPage)(nsUseOnPage::PD_ALL | nsUseOnPage::PD_HEADERSHARE | nsUseOnPage::PD_FOOTERSHARE)); return pNewPD; diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx b/sw/source/filter/ww8/attributeoutputbase.hxx index 98f2f6074349..499cc59e132a 100644 --- a/sw/source/filter/ww8/attributeoutputbase.hxx +++ b/sw/source/filter/ww8/attributeoutputbase.hxx @@ -449,9 +449,6 @@ protected: /// Sfx item RES_TXTATR_FTN virtual void TextFootnote_Impl( const SwFmtFtn& ) = 0; - /// Sfx item RES_TXTATR_HARDBLANK - virtual void TextHardBlank( const SwFmtHardBlank& ) = 0; - /// Sfx item RES_PARATR_LINESPACING void ParaLineSpacing( const SvxLineSpacingItem& ); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 537a881f76ad..0eb0284a701e 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -2776,13 +2776,6 @@ void DocxAttributeOutput::FootnotesEndnotes( bool bFootnotes ) } -void DocxAttributeOutput::TextHardBlank( const SwFmtHardBlank& ) -{ -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::TextHardBlank()\n" ); -#endif -} - void DocxAttributeOutput::ParaLineSpacing_Impl( short nSpace, short /*nMulti*/ ) { if ( !m_pSpacingAttrList ) diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx index 71b1a452f440..a84c0f40284c 100644 --- a/sw/source/filter/ww8/docxattributeoutput.hxx +++ b/sw/source/filter/ww8/docxattributeoutput.hxx @@ -434,9 +434,6 @@ protected: /// Output the footnote/endnote reference (if there's one to output). void FootnoteEndnoteReference(); - /// Sfx item RES_TXTATR_HARDBLANK - virtual void TextHardBlank( const SwFmtHardBlank& ); - /// Sfx item RES_PARATR_LINESPACING virtual void ParaLineSpacing_Impl( short nSpace, short nMulti ); diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx index 17f854eaa1d6..fb197163e226 100644 --- a/sw/source/filter/ww8/writerwordglue.cxx +++ b/sw/source/filter/ww8/writerwordglue.cxx @@ -548,8 +548,8 @@ namespace sw using namespace ::com::sun::star::i18n; sal_uInt16 nScript = i18n::ScriptType::LATIN; - if (rTxt.Len() && pBreakIt && pBreakIt->xBreak.is()) - nScript = pBreakIt->xBreak->getScriptType(rTxt, 0); + if (rTxt.Len() && pBreakIt && pBreakIt->GetBreakIter().is()) + nScript = pBreakIt->GetBreakIter()->getScriptType(rTxt, 0); rtl_TextEncoding eChrSet = ItemGet<SvxFontItem>(rTxtNd, GetWhichOfScript(RES_CHRATR_FONT, nScript)).GetCharSet(); @@ -635,20 +635,20 @@ namespace sw using sw::types::writer_cast; - if (pBreakIt && pBreakIt->xBreak.is()) + if (pBreakIt && pBreakIt->GetBreakIter().is()) { xub_StrLen nLen = rTxt.Len(); xub_StrLen nPos = 0; while (nPos < nLen) { - sal_Int32 nEnd2 = pBreakIt->xBreak->endOfScript(rTxt, nPos, + sal_Int32 nEnd2 = pBreakIt->GetBreakIter()->endOfScript(rTxt, nPos, nScript); if (nEnd2 < 0) break; // nPos = writer_cast<xub_StrLen>(nEnd2); nPos = static_cast< xub_StrLen >(nEnd2); aScripts.push_back(ScriptEntry(nPos, nScript)); - nScript = pBreakIt->xBreak->getScriptType(rTxt, nPos); + nScript = pBreakIt->GetBreakIter()->getScriptType(rTxt, nPos); } } diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index dfc3f8f92d94..5652c4c40f6e 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -885,8 +885,8 @@ void WW8_SdrAttrIter::NextPara( USHORT nPar ) pEditPool = aSet.GetPool(); eNdChrSet = ItemGet<SvxFontItem>(aSet,EE_CHAR_FONTINFO).GetCharSet(); - if( pBreakIt->xBreak.is() ) - nScript = pBreakIt->xBreak->getScriptType( pEditObj->GetText(nPara), 0); + if( pBreakIt->GetBreakIter().is() ) + nScript = pBreakIt->GetBreakIter()->getScriptType( pEditObj->GetText(nPara), 0); else nScript = i18n::ScriptType::LATIN; diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index d42a389e3704..2cbbb7943f37 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -344,9 +344,9 @@ xub_StrLen SwAttrIter::SearchNext( xub_StrLen nStartPos ) if( nPos >= nStartPos && nPos <= nMinPos ) nMinPos = nPos; } - else + if (pHt->HasDummyChar()) { - // Attr ohne Ende Laenge 1 wegen CH_TXTATR im Text + // pos + 1 because of CH_TXTATR in Text nPos = *pHt->GetStart() + 1; if( nPos >= nStartPos && nPos <= nMinPos ) nMinPos = nPos; @@ -545,13 +545,13 @@ void SwAttrIter::OutFlys(xub_StrLen nSwPos) bool SwAttrIter::IsTxtAttr( xub_StrLen nSwPos ) { - // search for attrs without end position + // search for attrs with CH_TXTATR if (const SwpHints* pTxtAttrs = rNd.GetpSwpHints()) { for (USHORT i = 0; i < pTxtAttrs->Count(); ++i) { const SwTxtAttr* pHt = (*pTxtAttrs)[i]; - if( !pHt->GetEnd() && *pHt->GetStart() == nSwPos ) + if ( pHt->HasDummyChar() && (*pHt->GetStart() == nSwPos) ) return true; } } @@ -670,15 +670,15 @@ void WW8AttributeOutput::StartRuby( const SwTxtNode& rNode, const SwFmtRuby& rRu aStr += String::CreateFromInt32( nJC ); /* - MS needs to know the name and size of the font used in the ruby item, - but we coud have written it in a mixture of asian and western - scripts, and each of these can be a different font and size than the - other, so we make a guess based upon the first character of the text, - defaulting to asian. - */ + MS needs to know the name and size of the font used in the ruby item, + but we coud have written it in a mixture of asian and western + scripts, and each of these can be a different font and size than the + other, so we make a guess based upon the first character of the text, + defaulting to asian. + */ USHORT nRubyScript; - if ( pBreakIt->xBreak.is() ) - nRubyScript = pBreakIt->xBreak->getScriptType( rRuby.GetText(), 0); + if( pBreakIt->GetBreakIter().is() ) + nRubyScript = pBreakIt->GetBreakIter()->getScriptType( rRuby.GetText(), 0); else nRubyScript = i18n::ScriptType::ASIAN; @@ -726,8 +726,8 @@ void WW8AttributeOutput::StartRuby( const SwTxtNode& rNode, const SwFmtRuby& rRu aStr.APPEND_CONST_ASC( "(\\s\\up " ); - if ( pBreakIt->xBreak.is() ) - nRubyScript = pBreakIt->xBreak->getScriptType( rNode.GetTxt(), + if ( pBreakIt->GetBreakIter().is() ) + nRubyScript = pBreakIt->GetBreakIter()->getScriptType( rNode.GetTxt(), *( pRubyTxt->GetStart() ) ); else nRubyScript = i18n::ScriptType::ASIAN; @@ -1409,8 +1409,8 @@ String SwAttrIter::GetSnippet(const String &rStr, xub_StrLen nAktPos, if (SVX_CASEMAP_TITEL == ((const SvxCaseMapItem&)rItem).GetValue()) { sal_uInt16 nScriptType = i18n::ScriptType::LATIN; - if (pBreakIt->xBreak.is()) - nScriptType = pBreakIt->xBreak->getScriptType(aSnippet, 0); + if (pBreakIt->GetBreakIter().is()) + nScriptType = pBreakIt->GetBreakIter()->getScriptType(aSnippet, 0); LanguageType nLanguage; switch (nScriptType) @@ -1435,7 +1435,7 @@ String SwAttrIter::GetSnippet(const String &rStr, xub_StrLen nAktPos, //If we weren't at the begin of a word undo the case change. //not done before doing the casemap because the sequence might start //with whitespace - if (pBreakIt->xBreak.is() && !pBreakIt->xBreak->isBeginWord( + if (pBreakIt->GetBreakIter().is() && !pBreakIt->GetBreakIter()->isBeginWord( rStr, nAktPos, pBreakIt->GetLocale(nLanguage), i18n::WordType::ANYWORD_IGNOREWHITESPACES ) ) { diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 617f6f4773da..022c14cfd579 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -2416,9 +2416,7 @@ void WW8Export::SectionBreaksAndFrames( const SwTxtNode& rNode ) void MSWordExportBase::WriteText() { #ifdef DEBUG -//!! does not compile with debug=t -> unresolved external (dbg_out), -//!! sommeone who knows what he wants to get should fix this -// ::std::clog << "<WriteText>" << ::std::endl; + ::std::clog << "<WriteText>" << ::std::endl; // ::std::clog << dbg_out(pCurPam->GetDoc()->GetNodes()) << ::std::endl; #endif diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 45416d4dbc4d..8bd1610cb9e0 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -109,7 +109,6 @@ #include <pagedesc.hxx> // for SwPageDesc #include <flddat.hxx> // for Date fields #include <ndtxt.hxx> // for Numrules -#include <fmthbsh.hxx> #include <swrect.hxx> #include <reffld.hxx> #include <ftninfo.hxx> @@ -2383,9 +2382,9 @@ void AttributeOutputBase::StartTOX( const SwSection& rSect ) GetExport( ).OutputField( 0, eCode, sStr, WRITEFIELD_START | WRITEFIELD_CMD_START | WRITEFIELD_CMD_END ); } - - GetExport( ).bStartTOX = false; } + + GetExport( ).bStartTOX = false; } void AttributeOutputBase::EndTOX( const SwSection& rSect ) @@ -2961,8 +2960,8 @@ void AttributeOutputBase::TextField( const SwFmtFld& rField ) font size of that script as our default. */ USHORT nScript; - if( pBreakIt->xBreak.is() ) - nScript = pBreakIt->xBreak->getScriptType( pFld->GetPar1(), 0); + if( pBreakIt->GetBreakIter().is() ) + nScript = pBreakIt->GetBreakIter()->getScriptType( pFld->GetPar1(), 0); else nScript = i18n::ScriptType::ASIAN; @@ -3140,10 +3139,6 @@ void WW8AttributeOutput::ParaVerticalAlign( const SvxParaVertAlignItem& rAlign ) // NoHyphen: ich habe keine Entsprechung in der SW-UI und WW-UI gefunden -void WW8AttributeOutput::TextHardBlank( const SwFmtHardBlank& rHardBlank ) -{ - m_rWW8Export.WriteChar( rHardBlank.GetChar() ); -} // RefMark, NoLineBreakHere fehlen noch @@ -3757,8 +3752,17 @@ void WW8AttributeOutput::FormatTextGrid( const SwTextGridItem& rGrid ) UINT16 nHeight = rGrid.GetBaseHeight() + rGrid.GetRubyHeight(); m_rWW8Export.InsUInt16( NS_sprm::LN_SDyaLinePitch ); m_rWW8Export.InsUInt16( nHeight ); - sal_uInt32 nPageCharSize = ItemGet<SvxFontHeightItem>(*(m_rWW8Export.pStyles->GetSwFmt()), - RES_CHRATR_CJK_FONTSIZE).GetHeight(); + + MSWordStyles * pStyles = m_rWW8Export.pStyles; + SwFmt * pSwFmt = pStyles->GetSwFmt(); + + sal_uInt32 nPageCharSize = 0; + + if (pSwFmt != NULL) + { + nPageCharSize = ItemGet<SvxFontHeightItem> + (*pSwFmt, RES_CHRATR_CJK_FONTSIZE).GetHeight(); + } INT32 nCharWidth = rGrid.GetBaseWidth() - nPageCharSize; INT32 nFraction = 0; @@ -4543,9 +4547,9 @@ void AttributeOutputBase::ParaLineSpacing( const SvxLineSpacingItem& rSpacing ) { const SwTxtNode* pNd = (const SwTxtNode*)GetExport().pOutFmtNode; pSet = &pNd->GetSwAttrSet(); - if ( pBreakIt->xBreak.is() ) + if ( pBreakIt->GetBreakIter().is() ) { - nScript = pBreakIt->xBreak-> + nScript = pBreakIt->GetBreakIter()-> getScriptType(pNd->GetTxt(), 0); } } @@ -5146,9 +5150,6 @@ void AttributeOutputBase::OutputItem( const SfxPoolItem& rHt ) case RES_TXTATR_FTN: TextFootnote( static_cast< const SwFmtFtn& >( rHt ) ); break; - case RES_TXTATR_HARDBLANK: - TextHardBlank( static_cast< const SwFmtHardBlank& >( rHt ) ); - break; case RES_PARATR_LINESPACING: ParaLineSpacing( static_cast< const SvxLineSpacingItem& >( rHt ) ); diff --git a/sw/source/filter/ww8/ww8attributeoutput.hxx b/sw/source/filter/ww8/ww8attributeoutput.hxx index cff22353d60c..4968d88887dc 100644 --- a/sw/source/filter/ww8/ww8attributeoutput.hxx +++ b/sw/source/filter/ww8/ww8attributeoutput.hxx @@ -323,9 +323,6 @@ protected: /// Sfx item RES_TXTATR_FTN virtual void TextFootnote_Impl( const SwFmtFtn& ); - /// Sfx item RES_TXTATR_HARDBLANK - virtual void TextHardBlank( const SwFmtHardBlank& ); - /// Sfx item RES_PARATR_LINESPACING virtual void ParaLineSpacing_Impl( short nSpace, short nMulti ); diff --git a/sw/source/filter/ww8/ww8glsy.cxx b/sw/source/filter/ww8/ww8glsy.cxx index 81d605457e9c..b0dabff56b2f 100644 --- a/sw/source/filter/ww8/ww8glsy.cxx +++ b/sw/source/filter/ww8/ww8glsy.cxx @@ -187,7 +187,7 @@ bool WW8Glossary::MakeEntries(SwDoc *pD, SwTextBlocks &rBlocks, -1 ); pCNd = aIdx.GetNode().GetCntntNode(); SwPosition aPos( aIdx, SwIndex( pCNd, pCNd->Len() )); - pD->Copy( aPam, aPos, false ); + pD->CopyRange( aPam, aPos, false ); rBlocks.PutDoc(); } } diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index f8bc1ce18537..241e339003d2 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -46,7 +46,7 @@ #include <unotools/tempfile.hxx> #include <svtools/sfxecode.hxx> -#include <svtools/docpasswdrequest.hxx> +#include <comphelper/docpasswordrequest.hxx> #include <hintids.hxx> #include <svx/tstpitem.hxx> @@ -81,7 +81,6 @@ #include <fmtcntnt.hxx> #include <fmtcnct.hxx> #include <fmtpdsc.hxx> -#include <fmthbsh.hxx> #include <ftninfo.hxx> #include <fmtftn.hxx> #include <txtftn.hxx> @@ -597,7 +596,7 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt, } } - if ( ( mnFix16Angle || nTextRotationAngle ) && dynamic_cast< SdrObjCustomShape* >( pObj ) ) + if ( ( ( rObjData.nSpFlags & SP_FFLIPV ) || mnFix16Angle || nTextRotationAngle ) && dynamic_cast< SdrObjCustomShape* >( pObj ) ) { SdrObjCustomShape* pCustomShape = dynamic_cast< SdrObjCustomShape* >( pObj ); @@ -606,6 +605,10 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt, { // text is already rotated, we have to take back the object rotation if DFF_Prop_RotateText is false fExtraTextRotation = -mnFix16Angle; } + if ( rObjData.nSpFlags & SP_FFLIPV ) // sj: in ppt the text is flipped, whereas in word the text + { // remains unchanged, so we have to take back the flipping here + fExtraTextRotation += 18000.0; // because our core will flip text if the shape is flipped. + } fExtraTextRotation += nTextRotationAngle; if ( !::basegfx::fTools::equalZero( fExtraTextRotation ) ) { @@ -950,7 +953,9 @@ void SwWW8FltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, pFrm->SetFmtAttr(aURL); } else - pDoc->Insert(aRegion, *pEntry->pAttr, 0); + { + pDoc->InsertPoolItem(aRegion, *pEntry->pAttr, 0); + } } } break; @@ -1068,7 +1073,7 @@ void SwWW8FltRefStack::SetAttrInDoc(const SwPosition& rTmpPos, SwTxtNode* pTxt = rBkMrkPos.nNode.GetNode().GetTxtNode(); if( pTxt && rBkMrkPos.nContent.GetIndex() ) { - SwTxtAttr* pFtn = pTxt->GetTxtAttr( + SwTxtAttr* const pFtn = pTxt->GetTxtAttrForCharAt( rBkMrkPos.nContent.GetIndex()-1, RES_TXTATR_FTN ); if( pFtn ) { @@ -1083,7 +1088,7 @@ void SwWW8FltRefStack::SetAttrInDoc(const SwPosition& rTmpPos, } } - pDoc->Insert(aPaM, *pEntry->pAttr, 0); + pDoc->InsertPoolItem(aPaM, *pEntry->pAttr, 0); MoveAttrs(*aPaM.GetPoint()); } break; @@ -1623,7 +1628,7 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes) sTxt, aDate ); aPostIt.SetTextObject(pOutliner); - rDoc.Insert(*pPaM, SwFmtFld(aPostIt), 0); + rDoc.InsertPoolItem(*pPaM, SwFmtFld(aPostIt), 0); return 0; } @@ -2177,6 +2182,66 @@ CharSet SwWW8ImplReader::GetCurrentCharSet() switch (pLang->GetLanguage()) { case LANGUAGE_CZECH: + case LANGUAGE_HUNGARIAN: + case LANGUAGE_POLISH: + eSrcCharSet = RTL_TEXTENCODING_MS_1250; + break; + case LANGUAGE_RUSSIAN: + eSrcCharSet = RTL_TEXTENCODING_MS_1251; + break; + case LANGUAGE_GREEK: + eSrcCharSet = RTL_TEXTENCODING_MS_1253; + break; + case LANGUAGE_TURKISH: + eSrcCharSet = RTL_TEXTENCODING_MS_1254; + break; + default: + eSrcCharSet = RTL_TEXTENCODING_MS_1252; + break; + } + } + } + } + return eSrcCharSet; +} + +//Takashi Ono for CJK +CharSet SwWW8ImplReader::GetCurrentCJKCharSet() +{ + /* + #i2015 + If the hard charset is set use it, if not see if there is an open + character run that has set the charset, if not then fallback to the + current underlying paragraph style. + */ + CharSet eSrcCharSet = eHardCharSet; + if (eSrcCharSet == RTL_TEXTENCODING_DONTKNOW) + { + if (!maFontSrcCJKCharSets.empty()) + eSrcCharSet = maFontSrcCJKCharSets.top(); + if ((eSrcCharSet == RTL_TEXTENCODING_DONTKNOW) && (nCharFmt != -1)) + eSrcCharSet = pCollA[nCharFmt].GetCJKCharSet(); + if (eSrcCharSet == RTL_TEXTENCODING_DONTKNOW) + eSrcCharSet = pCollA[nAktColl].GetCJKCharSet(); + if (eSrcCharSet == RTL_TEXTENCODING_DONTKNOW) + { // patch from cmc for #i52786# + /* + #i22206#/#i52786# + The (default) character set used for a run of text is the default + character set for the version of Word that last saved the document. + + This is a bit tentative, more might be required if the concept is correct. + When later version of word write older 6/95 documents the charset is + correctly set in the character runs involved, so its hard to reproduce + documents that require this to be sure of the process involved. + */ + const SvxLanguageItem *pLang = + (const SvxLanguageItem*)GetFmtAttr(RES_CHRATR_LANGUAGE); + if (pLang) + { + switch (pLang->GetLanguage()) + { + case LANGUAGE_CZECH: eSrcCharSet = RTL_TEXTENCODING_MS_1250; break; default: @@ -2335,6 +2400,8 @@ bool SwWW8ImplReader::ReadPlainChars(WW8_CP& rPos, long nEnd, long nCpOfs) const CharSet eSrcCharSet = bVer67 ? GetCurrentCharSet() : RTL_TEXTENCODING_MS_1252; + const CharSet eSrcCJKCharSet = bVer67 ? GetCurrentCJKCharSet() : + RTL_TEXTENCODING_MS_1252; // (re)alloc UniString data String sPlainCharsBuf; @@ -2395,7 +2462,7 @@ bool SwWW8ImplReader::ReadPlainChars(WW8_CP& rPos, long nEnd, long nCpOfs) sal_Char aTest[2]; aTest[0] = static_cast< sal_Char >((nUCode & 0xFF00) >> 8); aTest[1] = static_cast< sal_Char >(nUCode & 0x00FF); - String aTemp(aTest, 2, eSrcCharSet); + String aTemp(aTest, 2, eSrcCJKCharSet); ASSERT(aTemp.Len() == 1, "so much for that theory"); *pWork = aTemp.GetChar(0); } @@ -2450,7 +2517,7 @@ bool SwWW8ImplReader::AddTextToParagraph(const String& rAddString) */ if ((pNd->GetTxt().Len() + rAddString.Len()) < STRING_MAXLEN -1) { - rDoc.Insert (*pPaM, rAddString, true); + rDoc.InsertString(*pPaM, rAddString); } else { @@ -2459,16 +2526,16 @@ bool SwWW8ImplReader::AddTextToParagraph(const String& rAddString) { String sTempStr (rAddString,0, STRING_MAXLEN - pNd->GetTxt().Len() -1); - rDoc.Insert (*pPaM, sTempStr, true); + rDoc.InsertString(*pPaM, sTempStr); sTempStr = rAddString.Copy(sTempStr.Len(), rAddString.Len() - sTempStr.Len()); AppendTxtNode(*pPaM->GetPoint()); - rDoc.Insert (*pPaM,sTempStr, true ); + rDoc.InsertString(*pPaM, sTempStr); } else { AppendTxtNode(*pPaM->GetPoint()); - rDoc.Insert (*pPaM, rAddString, true); + rDoc.InsertString(*pPaM, rAddString); } } @@ -2489,7 +2556,9 @@ bool SwWW8ImplReader::ReadChars(WW8_CP& rPos, WW8_CP nNextAttr, long nTextEnd, if( bSymbol ) // Spezialzeichen einfuegen { for(USHORT nCh = 0; nCh < nEnd - rPos; ++nCh) - rDoc.Insert( *pPaM, cSymbol ); + { + rDoc.InsertString( *pPaM, cSymbol ); + } pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_FONT ); } pStrm->SeekRel( nEnd- rPos ); @@ -2570,7 +2639,7 @@ bool SwWW8ImplReader::ReadChar(long nPosCp, long nCpOfs) SwPageNumberField aFld( (SwPageNumberFieldType*)rDoc.GetSysFldType( RES_PAGENUMBERFLD ), PG_RANDOM, SVX_NUM_ARABIC); - rDoc.Insert(*pPaM, SwFmtFld(aFld), 0); + rDoc.InsertPoolItem(*pPaM, SwFmtFld(aFld), 0); } break; case 0xe: @@ -2582,7 +2651,8 @@ bool SwWW8ImplReader::ReadChar(long nPosCp, long nCpOfs) { // Always insert a txtnode for a column break, e.g. ## AppendTxtNode(*pPaM->GetPoint()); - rDoc.Insert(*pPaM, SvxFmtBreakItem(SVX_BREAK_COLUMN_BEFORE, RES_BREAK), 0); + rDoc.InsertPoolItem(*pPaM, + SvxFmtBreakItem(SVX_BREAK_COLUMN_BEFORE, RES_BREAK), 0); } break; case 0x7: @@ -2633,14 +2703,14 @@ bool SwWW8ImplReader::ReadChar(long nPosCp, long nCpOfs) case 0xc: bRet = HandlePageBreakChar(); break; - case 0x1e: - rDoc.Insert( *pPaM, CHAR_HARDHYPHEN); // Non-breaking hyphen + case 0x1e: // Non-breaking hyphen + rDoc.InsertString( *pPaM, CHAR_HARDHYPHEN ); break; - case 0x1f: - rDoc.Insert( *pPaM, CHAR_SOFTHYPHEN); // Non-required hyphens + case 0x1f: // Non-required hyphens + rDoc.InsertString( *pPaM, CHAR_SOFTHYPHEN ); break; - case 0xa0: - rDoc.Insert( *pPaM, CHAR_HARDBLANK); // Non-breaking spaces + case 0xa0: // Non-breaking spaces + rDoc.InsertString( *pPaM, CHAR_HARDBLANK ); break; case 0x1: /* @@ -3098,7 +3168,8 @@ bool SwWW8ImplReader::ReadText(long nStartCp, long nTextLen, ManTypes nType) AppendTxtNode(*pPaM->GetPoint()); } // <-- - rDoc.Insert(*pPaM, SvxFmtBreakItem(SVX_BREAK_PAGE_BEFORE, RES_BREAK), 0); + rDoc.InsertPoolItem(*pPaM, + SvxFmtBreakItem(SVX_BREAK_PAGE_BEFORE, RES_BREAK), 0); bPgSecBreak = false; } } @@ -3332,7 +3403,7 @@ void GiveNodePageDesc(SwNodeIndex &rIdx, const SwFmtPageDesc &rPgDesc, rIdx.GetNode().GetCntntNode(), 0); SwPaM aPage(aPamStart); - rDoc.Insert(aPage, rPgDesc, 0); + rDoc.InsertPoolItem(aPage, rPgDesc, 0); } } @@ -4171,8 +4242,8 @@ namespace uno::Reference< task::XInteractionHandler > xHandler( rMedium.GetInteractionHandler() ); if( xHandler.is() ) { - RequestDocumentPassword* pRequest = new RequestDocumentPassword( - task::PasswordRequestMode_PASSWORD_ENTER, + ::comphelper::DocPasswordRequest* pRequest = new ::comphelper::DocPasswordRequest( + ::comphelper::DocPasswordRequestType_MS, task::PasswordRequestMode_PASSWORD_ENTER, INetURLObject( rMedium.GetOrigURL() ).GetName( INetURLObject::DECODE_WITH_CHARSET ) ); uno::Reference< task::XInteractionRequest > xRequest( pRequest ); diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index 777b2e0055c3..93a20df1576c 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -933,6 +933,7 @@ private: Stack of textencoding being used as we progress through the document text */ std::stack<rtl_TextEncoding> maFontSrcCharSets; + std::stack<rtl_TextEncoding> maFontSrcCJKCharSets; /* Winword numbering gets imported as SwNumRules, there is a problem that @@ -1173,6 +1174,7 @@ private: rtl_TextEncoding&); bool SetNewFontAttr(USHORT nFCode, bool bSetEnums, USHORT nWhich); void ResetCharSetVars(); + void ResetCJKCharSetVars(); const SfxPoolItem* GetFmtAttr( USHORT nWhich ); bool JoinNode(SwPaM &rPam, bool bStealAttr = false); @@ -1615,6 +1617,7 @@ public: // eigentlich private, geht aber leider nur public // Laden eines kompletten DocFiles ULONG LoadDoc( SwPaM&,WW8Glossary *pGloss=0); CharSet GetCurrentCharSet(); + CharSet GetCurrentCJKCharSet(); void PostProcessAttrs(); }; diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index 7f94e2f495e8..60b17ebb5bca 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -381,7 +381,7 @@ sal_uInt16 SwWW8ImplReader::End_Ftn() sChar.Append(pTxt->GetTxt().GetChar(--nPos)); pPaM->SetMark(); pPaM->GetMark()->nContent--; - rDoc.Delete( *pPaM ); + rDoc.DeleteRange( *pPaM ); pPaM->DeleteMark(); SwFmtFtn aFtn(rDesc.meType == MAN_EDN); pFN = pTxt->InsertItem(aFtn, nPos, nPos); @@ -435,7 +435,7 @@ sal_uInt16 SwWW8ImplReader::End_Ftn() pPaM->GetMark()->nContent++; pPaM->GetMark()->nContent++; pReffingStck->Delete(*pPaM); - rDoc.Delete( *pPaM ); + rDoc.DeleteRange( *pPaM ); pPaM->DeleteMark(); } } @@ -4725,4 +4725,11 @@ CharSet SwWW8StyInf::GetCharSet() const return eLTRFontSrcCharSet; } +CharSet SwWW8StyInf::GetCJKCharSet() const +{ + if ((pFmt) && (pFmt->GetFrmDir().GetValue() == FRMDIR_HORI_RIGHT_TOP)) + return eRTLFontSrcCharSet; + return eCJKFontSrcCharSet; +} + /* vi:set tabstop=4 shiftwidth=4 expandtab: */ diff --git a/sw/source/filter/ww8/ww8par2.hxx b/sw/source/filter/ww8/ww8par2.hxx index 1d26e384a61c..302227fca0fe 100644 --- a/sw/source/filter/ww8/ww8par2.hxx +++ b/sw/source/filter/ww8/ww8par2.hxx @@ -224,6 +224,7 @@ public: return pOutlineNumrule; } CharSet GetCharSet() const; + CharSet GetCJKCharSet() const; }; class WW8RStyle: public WW8Style diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index de912778c17a..aa2737da1fa4 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -207,7 +207,7 @@ eF_ResT SwWW8ImplReader::Read_F_FormTextBox( WW8FieldDesc* pF, String& rStr ) aFld.SetHelp(aFormula.sHelp); aFld.SetToolTip(aFormula.sToolTip); - rDoc.Insert(*pPaM, SwFmtFld(aFld), 0); + rDoc.InsertPoolItem(*pPaM, SwFmtFld(aFld), 0); return FLD_OK; } else { WW8PLCFx_Book* pB = pPlcxMan->GetBook(); @@ -321,7 +321,7 @@ eF_ResT SwWW8ImplReader::Read_F_FormListBox( WW8FieldDesc* pF, String& rStr) aFld.SetSelectedItem(aFormula.maListEntries[nIndex]); } - rDoc.Insert(*pPaM, SwFmtFld(aFld), 0); + rDoc.InsertPoolItem(*pPaM, SwFmtFld(aFld), 0); return FLD_OK; } diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index b45aa575baf4..f5f82d879aac 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -61,7 +61,6 @@ #include <svx/fhgtitem.hxx> #include <svx/langitem.hxx> #include <fmtfld.hxx> -#include <fmthbsh.hxx> #include <fmtanchr.hxx> #include <pam.hxx> // fuer SwPam #include <doc.hxx> @@ -1062,7 +1061,8 @@ void SwWW8ImplReader::InsertTagField( const USHORT nId, const String& rTagText ) if( SwFltGetFlag(nFieldFlags, SwFltControlStack::TAGS_IN_TEXT)) { aName += rTagText; // als Txt taggen - rDoc.Insert(*pPaM, aName, false); + rDoc.InsertString(*pPaM, aName, + IDocumentContentOperations::INS_NOHINTEXPAND); } else { // normal tagggen @@ -1073,7 +1073,7 @@ void SwWW8ImplReader::InsertTagField( const USHORT nId, const String& rTagText ) USHORT nSubType = ( SwFltGetFlag( nFieldFlags, SwFltControlStack::TAGS_VISIBLE ) ) ? 0 : nsSwExtendedSubType::SUB_INVISIBLE; aFld.SetSubType(nSubType | nsSwGetSetExpType::GSE_STRING); - rDoc.Insert( *pPaM, SwFmtFld( aFld ), 0 ); + rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 ); } } @@ -1133,7 +1133,7 @@ eF_ResT SwWW8ImplReader::Read_F_Input( WW8FieldDesc* pF, String& rStr ) SwInputField aFld( (SwInputFieldType*)rDoc.GetSysFldType( RES_INPUTFLD ), aDef, aQ, INP_TXT, 0 ); // sichtbar ( geht z.Zt. nicht anders ) - rDoc.Insert( *pPaM, SwFmtFld( aFld ), 0 ); + rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 ); return FLD_OK; } @@ -1335,7 +1335,7 @@ eF_ResT SwWW8ImplReader::Read_F_InputVar( WW8FieldDesc* pF, String& rStr ) aFld.SetInputFlag(true); aFld.SetPromptText( aQ ); - rDoc.Insert( *pPaM, SwFmtFld( aFld ), 0 ); + rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 ); pReffedStck->SetAttr(*pPaM->GetPoint(), RES_FLTR_BOOKMARK, true, nNo); return FLD_OK; @@ -1351,7 +1351,7 @@ eF_ResT SwWW8ImplReader::Read_F_ANumber( WW8FieldDesc*, String& rStr ) SwSetExpField aFld( (SwSetExpFieldType*)pNumFldType, aEmptyStr, GetNumberPara( rStr ) ); aFld.SetValue( ++nFldNum ); - rDoc.Insert( *pPaM, SwFmtFld( aFld ), 0 ); + rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 ); return FLD_OK; } @@ -1427,7 +1427,7 @@ eF_ResT SwWW8ImplReader::Read_F_Seq( WW8FieldDesc*, String& rStr ) else if (!bCountOn) aFld.SetFormula(aSequenceName); - rDoc.Insert(*pPaM, SwFmtFld(aFld), 0); + rDoc.InsertPoolItem(*pPaM, SwFmtFld(aFld), 0); return FLD_OK; } @@ -1552,7 +1552,7 @@ eF_ResT SwWW8ImplReader::Read_F_DocInfo( WW8FieldDesc* pF, String& rStr ) */ SwDocInfoField aFld( (SwDocInfoFieldType*) rDoc.GetSysFldType( RES_DOCINFOFLD ), DI_CUSTOM|nReg, aDocProperty, GetFieldResult( pF ) ); - rDoc.Insert(*pPaM, SwFmtFld(aFld), 0); + rDoc.InsertPoolItem(*pPaM, SwFmtFld(aFld), 0); return FLD_OK; } @@ -1632,7 +1632,7 @@ eF_ResT SwWW8ImplReader::Read_F_DocInfo( WW8FieldDesc* pF, String& rStr ) rDoc.GetSysFldType( RES_DOCINFOFLD ), nSub|nReg, String(), nFormat ); if (bDateTime) ForceFieldLanguage(aFld, nLang); - rDoc.Insert(*pPaM, SwFmtFld(aFld), 0); + rDoc.InsertPoolItem(*pPaM, SwFmtFld(aFld), 0); return FLD_OK; } @@ -1645,7 +1645,7 @@ eF_ResT SwWW8ImplReader::Read_F_Author( WW8FieldDesc*, String& ) SwDocInfoField aFld( (SwDocInfoFieldType*) rDoc.GetSysFldType( RES_DOCINFOFLD ), DI_CREATE|DI_SUB_AUTHOR, String() ); - rDoc.Insert( *pPaM, SwFmtFld( aFld ), 0 ); + rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 ); return FLD_OK; } @@ -1653,7 +1653,7 @@ eF_ResT SwWW8ImplReader::Read_F_TemplName( WW8FieldDesc*, String& ) { SwTemplNameField aFld( (SwTemplNameFieldType*) rDoc.GetSysFldType( RES_TEMPLNAMEFLD ), FF_NAME ); - rDoc.Insert( *pPaM, SwFmtFld( aFld ), 0 ); + rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 ); return FLD_OK; } @@ -1708,14 +1708,14 @@ eF_ResT SwWW8ImplReader::Read_F_DateTime( WW8FieldDesc*pF, String& rStr ) SwDateTimeField aFld((SwDateTimeFieldType*) rDoc.GetSysFldType(RES_DATETIMEFLD ), DATEFLD, nFormat); ForceFieldLanguage(aFld, nLang); - rDoc.Insert( *pPaM, SwFmtFld( aFld ), 0 ); + rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 ); } else if (nDT == NUMBERFORMAT_TIME) { SwDateTimeField aFld((SwDateTimeFieldType*) rDoc.GetSysFldType(RES_DATETIMEFLD), TIMEFLD, nFormat); ForceFieldLanguage(aFld, nLang); - rDoc.Insert( *pPaM, SwFmtFld( aFld ), 0 ); + rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 ); } return FLD_OK; @@ -1745,7 +1745,7 @@ eF_ResT SwWW8ImplReader::Read_F_FileName(WW8FieldDesc*, String &rStr) SwFileNameField aFld( (SwFileNameFieldType*)rDoc.GetSysFldType(RES_FILENAMEFLD), eType); - rDoc.Insert(*pPaM, SwFmtFld(aFld), 0); + rDoc.InsertPoolItem(*pPaM, SwFmtFld(aFld), 0); return FLD_OK; } @@ -1759,7 +1759,7 @@ eF_ResT SwWW8ImplReader::Read_F_Anz( WW8FieldDesc* pF, String& rStr ) SwDocStatField aFld( (SwDocStatFieldType*) rDoc.GetSysFldType( RES_DOCSTATFLD ), nSub, GetNumberPara( rStr ) ); - rDoc.Insert( *pPaM, SwFmtFld( aFld ), 0 ); + rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 ); return FLD_OK; } @@ -1771,7 +1771,7 @@ eF_ResT SwWW8ImplReader::Read_F_CurPage( WW8FieldDesc*, String& rStr ) SwChapterField aFld( (SwChapterFieldType*) rDoc.GetSysFldType( RES_CHAPTERFLD ), CF_NUMBER ); aFld.SetLevel( nPgChpLevel ); - rDoc.Insert( *pPaM, SwFmtFld( aFld ), 0 ); + rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 ); static const sal_Char aDelim[] = "-.:\x97\x96"; BYTE nDelim = nPgChpDelim; @@ -1781,9 +1781,13 @@ eF_ResT SwWW8ImplReader::Read_F_CurPage( WW8FieldDesc*, String& rStr ) sal_Unicode c = ByteString::ConvertToUnicode( aDelim[ nDelim ], RTL_TEXTENCODING_MS_1252 ); if( '-' == c ) - rDoc.Insert( *pPaM, CHAR_HARDHYPHEN ); + { + rDoc.InsertString( *pPaM, CHAR_HARDHYPHEN ); + } else - rDoc.Insert( *pPaM, SwFmtHardBlank( c ), 0); + { + rDoc.InsertString( *pPaM, c ); // maybe insert ZWNBSP? + } } // Seitennummer @@ -1791,7 +1795,7 @@ eF_ResT SwWW8ImplReader::Read_F_CurPage( WW8FieldDesc*, String& rStr ) rDoc.GetSysFldType( RES_PAGENUMBERFLD ), PG_RANDOM, GetNumberPara(rStr, true)); - rDoc.Insert( *pPaM, SwFmtFld( aFld ), 0 ); + rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 ); return FLD_OK; } @@ -1850,7 +1854,7 @@ eF_ResT SwWW8ImplReader::Read_F_Symbol( WW8FieldDesc*, String& rStr ) NewAttr(aSz); } - rDoc.Insert(*pPaM, cChar); + rDoc.InsertString(*pPaM, cChar); if (nSize > 0) pCtrlStck->SetAttr(*pPaM->GetPoint(), RES_CHRATR_FONTSIZE); @@ -1859,7 +1863,7 @@ eF_ResT SwWW8ImplReader::Read_F_Symbol( WW8FieldDesc*, String& rStr ) } else { - rDoc.Insert(*pPaM, CREATE_CONST_ASC("###"), true); + rDoc.InsertString(*pPaM, CREATE_CONST_ASC("###")); } return FLD_OK; @@ -1920,7 +1924,7 @@ eF_ResT SwWW8ImplReader::Read_F_Set( WW8FieldDesc* pF, String& rStr ) SwSetExpField aFld( (SwSetExpFieldType*)pFT, sVal, ULONG_MAX ); aFld.SetSubType(nsSwExtendedSubType::SUB_INVISIBLE | nsSwGetSetExpType::GSE_STRING); - rDoc.Insert( *pPaM, SwFmtFld( aFld ), 0 ); + rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 ); pReffedStck->SetAttr(*pPaM->GetPoint(), RES_FLTR_BOOKMARK, true, nNo); @@ -1970,7 +1974,7 @@ eF_ResT SwWW8ImplReader::Read_F_Ref( WW8FieldDesc*, String& rStr ) SwGetRefField aFld( (SwGetRefFieldType*)rDoc.GetSysFldType( RES_GETREFFLD ), sBkmName,REF_BOOKMARK,0,REF_CHAPTER); - rDoc.Insert( *pPaM, SwFmtFld( aFld ), 0 ); + rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 ); } else { @@ -1993,7 +1997,7 @@ eF_ResT SwWW8ImplReader::Read_F_Ref( WW8FieldDesc*, String& rStr ) SwGetRefField aFld( (SwGetRefFieldType*) rDoc.GetSysFldType( RES_GETREFFLD ), sBkmName, REF_BOOKMARK, 0, REF_UPDOWN ); - rDoc.Insert(*pPaM, SwFmtFld(aFld), 0); + rDoc.InsertPoolItem(*pPaM, SwFmtFld(aFld), 0); } return FLD_OK; } @@ -2070,7 +2074,7 @@ eF_ResT SwWW8ImplReader::Read_F_PgRef( WW8FieldDesc*, String& rStr ) (SwGetRefFieldType*)rDoc.GetSysFldType( RES_GETREFFLD ), sName, REF_BOOKMARK, 0, REF_PAGE ); - rDoc.Insert( *pPaM, SwFmtFld( aFld ), 0 ); + rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 ); return FLD_OK; } @@ -2119,7 +2123,7 @@ eF_ResT SwWW8ImplReader::Read_F_Macro( WW8FieldDesc*, String& rStr) SwMacroField aFld( (SwMacroFieldType*) rDoc.GetSysFldType( RES_MACROFLD ), aName, aVText ); - rDoc.Insert( *pPaM, SwFmtFld( aFld ), 0 ); + rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 ); WW8_CP nOldCp = pPlcxMan->Where(); @@ -2280,7 +2284,7 @@ eF_ResT SwWW8ImplReader::Read_F_IncludeText( WW8FieldDesc* /*pF*/, String& rStr aSection.SetLinkFileName( aPara ); aSection.SetProtect(true); - SwSection* pSection = rDoc.Insert(*pPaM, aSection, 0 ,false); + SwSection*const pSection = rDoc.InsertSwSection(*pPaM, aSection, 0, false); ASSERT(pSection, "no section inserted"); if (!pSection) return FLD_TEXT; @@ -2327,7 +2331,7 @@ eF_ResT SwWW8ImplReader::Read_F_DBField( WW8FieldDesc* pF, String& rStr ) aFld.InitContent(aResult); - rDoc.Insert( *pPaM, SwFmtFld( aFld ), 0); + rDoc.InsertPoolItem(*pPaM, SwFmtFld( aFld ), 0); return FLD_OK; } @@ -2339,7 +2343,7 @@ eF_ResT SwWW8ImplReader::Read_F_DBNext( WW8FieldDesc*, String& ) SwFieldType* pFT = rDoc.InsertFldType( aN ); SwDBNextSetField aFld( (SwDBNextSetFieldType*)pFT, aEmptyStr, aEmptyStr, SwDBData() ); // Datenbank: Nichts - rDoc.Insert( *pPaM, SwFmtFld( aFld ), 0 ); + rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 ); return FLD_OK; } @@ -2350,7 +2354,7 @@ eF_ResT SwWW8ImplReader::Read_F_DBNum( WW8FieldDesc*, String& ) SwFieldType* pFT = rDoc.InsertFldType( aN ); SwDBSetNumberField aFld( (SwDBSetNumberFieldType*)pFT, SwDBData() ); // Datenbank: Nichts - rDoc.Insert( *pPaM, SwFmtFld( aFld ), 0 ); + rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 ); return FLD_OK; } @@ -2415,7 +2419,7 @@ void SwWW8ImplReader::Read_SubF_Combined( _ReadFieldParams& rReadParam) { SwCombinedCharField aFld((SwCombinedCharFieldType*) rDoc.GetSysFldType(RES_COMBINED_CHARS),sCombinedCharacters); - rDoc.Insert(*pPaM,SwFmtFld(aFld), 0); + rDoc.InsertPoolItem(*pPaM, SwFmtFld(aFld), 0); } } @@ -2521,8 +2525,8 @@ void SwWW8ImplReader::Read_SubF_Ruby( _ReadFieldParams& rReadParam) const SwCharFmt *pCharFmt=0; //Make a guess at which of asian of western we should be setting USHORT nScript; - if (pBreakIt->xBreak.is()) - nScript = pBreakIt->xBreak->getScriptType(sRuby, 0); + if (pBreakIt->GetBreakIter().is()) + nScript = pBreakIt->GetBreakIter()->getScriptType(sRuby, 0); else nScript = i18n::ScriptType::ASIAN; @@ -2573,7 +2577,7 @@ void SwWW8ImplReader::Read_SubF_Ruby( _ReadFieldParams& rReadParam) aRuby.SetAdjustment(nJustificationCode); NewAttr(aRuby); - rDoc.Insert( *pPaM, sText, true ); + rDoc.InsertString( *pPaM, sText ); pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_TXTATR_CJK_RUBY ); } } @@ -3423,7 +3427,7 @@ void lcl_ImportTox(SwDoc &rDoc, SwPaM &rPaM, const String &rStr, bool bIdx) if (sFldTxt.Len()) { aM.SetAlternativeText( sFldTxt ); - rDoc.Insert( rPaM, aM, 0 ); + rDoc.InsertPoolItem( rPaM, aM, 0 ); } } diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 118b2f165e3a..806a5d474237 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -698,7 +698,8 @@ SwSectionFmt *wwSectionManager::InsertSection( aSection.SetProtect(SectionIsProtected(rSection)); - rSection.mpSection = mrReader.rDoc.Insert( rMyPaM, aSection, &aSet ); + rSection.mpSection = + mrReader.rDoc.InsertSwSection( rMyPaM, aSection, &aSet ); ASSERT(rSection.mpSection, "section not inserted!"); if (!rSection.mpSection) return 0; @@ -851,7 +852,7 @@ void wwSectionManager::CreateSep(const long nTxtPos, bool /*bMustHaveBreak*/) aSection.SetProtect(true); // --> CMC, OD 2004-06-18 #i19922# improvement: // return value of method <Insert> not used. - mrReader.rDoc.Insert(*mrReader.pPaM, aSection, 0 ,false); + mrReader.rDoc.InsertSwSection(*mrReader.pPaM, aSection, 0, false); } wwSection aLastSection(*mrReader.pPaM->GetPoint()); @@ -3217,7 +3218,7 @@ SwFrmFmt *SwWW8ImplReader::ContainsSingleInlineGraphic(const SwPaM &rRegion) if ( aBegin == aEnd && nBegin == nEnd - 1 && 0 != (pTNd = aBegin.GetNode().GetTxtNode()) && - 0 != (pTFlyAttr = pTNd->GetTxtAttr(nBegin, RES_TXTATR_FLYCNT)) + 0 != (pTFlyAttr = pTNd->GetTxtAttrForCharAt(nBegin, RES_TXTATR_FLYCNT)) ) { const SwFmtFlyCnt& rFly = pTFlyAttr->GetFlyCnt(); @@ -3557,11 +3558,32 @@ bool SwWW8ImplReader::SetNewFontAttr(USHORT nFCode, bool bSetEnums, //off the stack will keep in sync if (!pAktColl && IsListOrDropcap()) { - if (!maFontSrcCharSets.empty()) - eSrcCharSet = maFontSrcCharSets.top(); + if (nWhich == RES_CHRATR_CJK_FONT) + { + if (!maFontSrcCJKCharSets.empty()) + { + eSrcCharSet = maFontSrcCJKCharSets.top(); + } + else + { + eSrcCharSet = RTL_TEXTENCODING_DONTKNOW; + } + + maFontSrcCJKCharSets.push(eSrcCharSet); + } else - eSrcCharSet = RTL_TEXTENCODING_DONTKNOW; - maFontSrcCharSets.push(eSrcCharSet); + { + if (!maFontSrcCharSets.empty()) + { + eSrcCharSet = maFontSrcCharSets.top(); + } + else + { + eSrcCharSet = RTL_TEXTENCODING_DONTKNOW; + } + + maFontSrcCharSets.push(eSrcCharSet); + } } return false; } @@ -3591,7 +3613,10 @@ bool SwWW8ImplReader::SetNewFontAttr(USHORT nFCode, bool bSetEnums, else if (IsListOrDropcap()) { //Add character text encoding to stack - maFontSrcCharSets.push(eSrcCharSet); + if (nWhich == RES_CHRATR_CJK_FONT) + maFontSrcCJKCharSets.push(eSrcCharSet); + else + maFontSrcCharSets.push(eSrcCharSet); } } @@ -3607,6 +3632,13 @@ void SwWW8ImplReader::ResetCharSetVars() maFontSrcCharSets.pop(); } +void SwWW8ImplReader::ResetCJKCharSetVars() +{ + ASSERT(!maFontSrcCJKCharSets.empty(),"no charset to remove"); + if (!maFontSrcCJKCharSets.empty()) + maFontSrcCJKCharSets.pop(); +} + /* Font ein oder ausschalten: */ @@ -3637,7 +3669,10 @@ void SwWW8ImplReader::Read_FontCode( USHORT nId, const BYTE* pData, short nLen ) if( nLen < 0 ) // Ende des Attributes { pCtrlStck->SetAttr( *pPaM->GetPoint(), nId ); - ResetCharSetVars(); + if (nId == RES_CHRATR_CJK_FONT) + ResetCJKCharSetVars(); + else + ResetCharSetVars(); } else { diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index f3a4c3630e4c..3a1f6e96c651 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -1498,8 +1498,15 @@ WW8_CP WW8ScannerBase::WW8Fc2Cp( WW8_FC nFcPos ) const } INT32 nFcStart = SVBT32ToUInt32( ((WW8_PCD*)pData)->fc ); if( 8 <= pWw8Fib->nVersion ) + { nFcStart = WW8PLCFx_PCD::TransformPieceAddress( nFcStart, bIsUnicode ); + } + else + { + if (pWw8Fib->fExtChar) + bIsUnicode=true; + } INT32 nLen = (nCpEnd - nCpStart) * (bIsUnicode ? 2 : 1); /* @@ -1581,7 +1588,10 @@ WW8_FC WW8ScannerBase::WW8Cp2Fc(WW8_CP nCpPos, bool* pIsUnicode, WW8_FC nRet = SVBT32ToUInt32( ((WW8_PCD*)pData)->fc ); if (8 > pWw8Fib->nVersion) - *pIsUnicode = false; + if (pWw8Fib->fExtChar) + *pIsUnicode=true; + else + *pIsUnicode = false; else nRet = WW8PLCFx_PCD::TransformPieceAddress( nRet, *pIsUnicode ); diff --git a/sw/source/filter/xml/XMLRedlineImportHelper.cxx b/sw/source/filter/xml/XMLRedlineImportHelper.cxx index fefa151125f9..9b653c5eb33d 100644 --- a/sw/source/filter/xml/XMLRedlineImportHelper.cxx +++ b/sw/source/filter/xml/XMLRedlineImportHelper.cxx @@ -646,7 +646,7 @@ void XMLRedlineImportHelper::InsertIntoDocument(RedlineInfo* pRedlineInfo) // delete 'deleted' redlines and forget about the whole thing if (nsRedlineType_t::REDLINE_DELETE == pRedlineInfo->eType) { - pDoc->Delete(aPaM); + pDoc->DeleteRange(aPaM); // And what about the "deleted nodes"? // They have to be deleted as well (#i80689)! if( bIgnoreRedlines && pRedlineInfo->pContentIndex != NULL ) @@ -657,7 +657,7 @@ void XMLRedlineImportHelper::InsertIntoDocument(RedlineInfo* pRedlineInfo) { SwNodeIndex aEnd( *pEnd, 1 ); SwPaM aDel( aIdx, aEnd ); - pDoc->Delete(aDel); + pDoc->DeleteRange(aDel); } } } diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx index abe69df298d6..a99e719e3fe0 100644 --- a/sw/source/filter/xml/swxml.cxx +++ b/sw/source/filter/xml/swxml.cxx @@ -216,6 +216,24 @@ sal_Int32 ReadThroughComponent( } catch( xml::sax::SAXParseException& r ) { + // sax parser sends wrapped exceptions, + // try to find the original one + xml::sax::SAXException aSaxEx = *(xml::sax::SAXException*)(&r); + sal_Bool bTryChild = sal_True; + + while( bTryChild ) + { + xml::sax::SAXException aTmp; + if ( aSaxEx.WrappedException >>= aTmp ) + aSaxEx = aTmp; + else + bTryChild = sal_False; + } + + packages::zip::ZipIOException aBrokenPackage; + if ( aSaxEx.WrappedException >>= aBrokenPackage ) + return ERRCODE_IO_BROKENPACKAGE; + if( bEncrypted ) return ERRCODE_SFX_WRONGPASSWORD; @@ -246,7 +264,10 @@ sal_Int32 ReadThroughComponent( } catch( xml::sax::SAXException& r) { - (void)r; + packages::zip::ZipIOException aBrokenPackage; + if ( r.WrappedException >>= aBrokenPackage ) + return ERRCODE_IO_BROKENPACKAGE; + if( bEncrypted ) return ERRCODE_SFX_WRONGPASSWORD; @@ -255,6 +276,7 @@ sal_Int32 ReadThroughComponent( aError += ByteString( String( r.Message), RTL_TEXTENCODING_ASCII_US ); DBG_ERROR( aError.GetBuffer() ); #endif + return ERR_SWG_READ_ERROR; } catch( packages::zip::ZipIOException& r) @@ -873,35 +895,39 @@ ULONG XMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPaM, const S // <-- sal_uInt32 nWarnRDF = 0; - // RDF metadata - must be read before styles/content - // N.B.: embedded documents have their own manifest.rdf! - try - { - const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(xModelComp, - uno::UNO_QUERY_THROW); - const uno::Reference<rdf::XURI> xBaseURI( ::sfx2::createBaseURI( - aContext.getUNOContext(), xStorage, aBaseURL, StreamPath) ); - const uno::Reference<task::XInteractionHandler> xHandler( - pDocSh->GetMedium()->GetInteractionHandler() ); - xDMA->loadMetadataFromStorage(xStorage, xBaseURI, xHandler); - } - catch (lang::WrappedTargetException & e) + if ( !(IsOrganizerMode() || IsBlockMode() || aOpt.IsFmtsOnly() || + bInsertMode) ) { - ucb::InteractiveAugmentedIOException iaioe; - if (e.TargetException >>= iaioe) + // RDF metadata - must be read before styles/content + // N.B.: embedded documents have their own manifest.rdf! + try { - // import error that was not ignored by InteractionHandler! - nWarnRDF = ERR_SWG_READ_ERROR; + const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(xModelComp, + uno::UNO_QUERY_THROW); + const uno::Reference<rdf::XURI> xBaseURI( ::sfx2::createBaseURI( + aContext.getUNOContext(), xStorage, aBaseURL, StreamPath) ); + const uno::Reference<task::XInteractionHandler> xHandler( + pDocSh->GetMedium()->GetInteractionHandler() ); + xDMA->loadMetadataFromStorage(xStorage, xBaseURI, xHandler); } - else + catch (lang::WrappedTargetException & e) + { + ucb::InteractiveAugmentedIOException iaioe; + if (e.TargetException >>= iaioe) + { + // import error that was not ignored by InteractionHandler! + nWarnRDF = ERR_SWG_READ_ERROR; + } + else + { + nWarnRDF = WARN_SWG_FEATURES_LOST; // uhh... something wrong? + } + } + catch (uno::Exception &) { nWarnRDF = WARN_SWG_FEATURES_LOST; // uhh... something went wrong? } } - catch (uno::Exception &) - { - nWarnRDF = WARN_SWG_FEATURES_LOST; // uhh... something went wrong? - } sal_uInt32 nWarn = 0; sal_uInt32 nWarn2 = 0; diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index 1add0b897f11..6b769f6c9285 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -699,7 +699,7 @@ void SwXMLTableCellContext_Impl::EndElement() SwPaM aSrcPaM( *pSrcPaM->GetPoint(), *pSrcPaM->GetMark() ); SwPosition aDstPos( *pDstTxtCrsr->GetPaM()->GetPoint() ); - pDoc->Copy( aSrcPaM, aDstPos, false ); + pDoc->CopyRange( aSrcPaM, aDstPos, false ); nColRepeat--; } |