diff options
Diffstat (limited to 'sw/source/filter')
26 files changed, 106 insertions, 77 deletions
diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx index 49b3af998897..8b741562b2e1 100644 --- a/sw/source/filter/html/css1atr.cxx +++ b/sw/source/filter/html/css1atr.cxx @@ -57,6 +57,7 @@ #include <editeng/spltitem.hxx> #include <editeng/orphitem.hxx> #include <svx/xoutbmp.hxx> +#include <svx/svdobj.hxx> #include <editeng/langitem.hxx> #include <editeng/frmdiritem.hxx> #include <svtools/htmlout.hxx> @@ -86,8 +87,6 @@ #include <txtftn.hxx> #include <fmtftn.hxx> // FOOTNOTES -#include <dcontact.hxx> - #include "doc.hxx" #include "swerror.h" #include "charatr.hxx" diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx index 47ce516701f2..1c7c129a6573 100644 --- a/sw/source/filter/html/htmlforw.cxx +++ b/sw/source/filter/html/htmlforw.cxx @@ -68,12 +68,11 @@ #include "pam.hxx" #include "doc.hxx" #include "ndtxt.hxx" -#include "dcontact.hxx" #include "flypos.hxx" #include "wrthtml.hxx" #include "htmlfly.hxx" #include "htmlform.hxx" - +#include "frmfmt.hxx" using namespace ::com::sun::star; using ::rtl::OUString; diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx index 1fe0e4898395..265e9234e3fc 100644 --- a/sw/source/filter/html/htmltab.cxx +++ b/sw/source/filter/html/htmltab.cxx @@ -5088,7 +5088,7 @@ void _TblSaveStruct::MakeTable( sal_uInt16 nWidth, SwPosition& rPos, SwDoc *pDoc SwTableNode *pTblNd = pTCntxt->GetTableNode(); OSL_ENSURE( pTblNd, "Wo ist der Tabellen-Node" ); - if( pDoc->GetRootFrm() && pTblNd ) + if( pDoc->GetCurrentViewShell() && pTblNd ) //swmod 071108//swmod 071225 { // Existiert schon ein Layout, dann muss an dieser Tabelle die // BoxFrames neu erzeugt werden. diff --git a/sw/source/filter/html/htmlvsh.hxx b/sw/source/filter/html/htmlvsh.hxx index 99343566048a..aa8159b3858e 100644 --- a/sw/source/filter/html/htmlvsh.hxx +++ b/sw/source/filter/html/htmlvsh.hxx @@ -35,7 +35,8 @@ class ViewShell; class SwHTMLViewShellClient : public SwClient { - virtual void Modify( SfxPoolItem *pOld, SfxPoolItem *pNew ); +protected: + virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ); public: @@ -46,7 +47,7 @@ public: void Register( ViewShell *pVsh ); void DeRegister(); - /*inline*/ ViewShell *GetViewShell(); // im swhtml.cxx + ViewShell *GetViewShell(); }; diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 88aaad70f09f..393787297392 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -924,15 +924,15 @@ if( pSttNdIdx->GetIndex()+1 == pPam->GetBound( sal_False ).nNode.GetIndex() ) #endif } -void SwHTMLParser::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew ) +void SwHTMLParser::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) { switch( pOld ? pOld->Which() : pNew ? pNew->Which() : 0 ) { case RES_OBJECTDYING: - if( ((SwPtrMsgPoolItem *)pOld)->pObject == pRegisteredIn ) + if( ((SwPtrMsgPoolItem *)pOld)->pObject == GetRegisteredIn() ) { // dann uns selbst beenden - pRegisteredIn->Remove( this ); + GetRegisteredInNonConst()->Remove( this ); ReleaseRef(); // ansonsten sind wir fertig! } break; diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx index ae072aa7ec2e..0df5b3923f79 100644 --- a/sw/source/filter/html/swhtml.hxx +++ b/sw/source/filter/html/swhtml.hxx @@ -920,7 +920,7 @@ protected: virtual ~SwHTMLParser(); // wird das Dok geloescht, ist auch der Parser zu loeschen - virtual void Modify( SfxPoolItem *pOld, SfxPoolItem *pNew ); + virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ); virtual void AddMetaUserDefined( ::rtl::OUString const & i_rMetaName ); diff --git a/sw/source/filter/inc/fltshell.hxx b/sw/source/filter/inc/fltshell.hxx index 61208b30c445..91647089d1cb 100644 --- a/sw/source/filter/inc/fltshell.hxx +++ b/sw/source/filter/inc/fltshell.hxx @@ -167,7 +167,7 @@ class SwFltAnchorClient : public SwClient public: SwFltAnchorClient(SwFltAnchor * pFltAnchor); - virtual void Modify (SfxPoolItem *pOld, SfxPoolItem *pNew); + virtual void Modify (const SfxPoolItem *pOld, const SfxPoolItem *pNew); }; diff --git a/sw/source/filter/rtf/rtfnum.cxx b/sw/source/filter/rtf/rtfnum.cxx index 5552ed7c5cb5..b91c26d1c763 100644 --- a/sw/source/filter/rtf/rtfnum.cxx +++ b/sw/source/filter/rtf/rtfnum.cxx @@ -673,7 +673,7 @@ void SwRTFParser::RemoveUnusedNumRule( SwNumRule* pRule ) SwCharFmt* pCFmt = rNFmt.GetCharFmt(); if( pCFmt ) { - pCFmt->Remove( &rNFmt ); + rNFmt.ForgetCharFmt(); if( !pCFmt->GetDepends() ) pDoc->DelCharFmt( pCFmt ); } diff --git a/sw/source/filter/rtf/rtftbl.cxx b/sw/source/filter/rtf/rtftbl.cxx index 5adb998937a9..aac3ef89132d 100644 --- a/sw/source/filter/rtf/rtftbl.cxx +++ b/sw/source/filter/rtf/rtftbl.cxx @@ -710,9 +710,9 @@ void SwRTFParser::ReadTable( int nToken ) { SwTableBox* pBox = pNewLine->GetTabBoxes()[0]; pBoxFmt = (SwTableBoxFmt*)pBox->GetFrmFmt(); - pBoxFmt->Remove( pBox ); + pBox->ForgetFrmFmt(); delete pBoxFmt; - aBoxFmts[0]->Add( pBox ); + pBox->RegisterToFormat( *aBoxFmts[0] ); SwTxtNode* pTNd = pDoc->GetNodes()[ pBox->GetSttIdx()+1 ] ->GetTxtNode(); OSL_ENSURE( pTNd, "wo ist der Textnode dieser Box?" ); diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx index 91d9543609f4..56df822e16dd 100644 --- a/sw/source/filter/rtf/swparrtf.cxx +++ b/sw/source/filter/rtf/swparrtf.cxx @@ -1050,11 +1050,11 @@ InsertedTableClient::InsertedTableClient(SwTableNode & rNode) SwTableNode * InsertedTableClient::GetTableNode() { - return dynamic_cast<SwTableNode *> (pRegisteredIn); + return dynamic_cast<SwTableNode *> (GetRegisteredInNonConst()); } InsertedTablesManager::InsertedTablesManager(const SwDoc &rDoc) - : mbHasRoot(rDoc.GetRootFrm()) + : mbHasRoot(rDoc.GetCurrentLayout()) //swmod 080218 { } diff --git a/sw/source/filter/ww1/fltshell.cxx b/sw/source/filter/ww1/fltshell.cxx index 9e16b86bb583..91d67441286e 100644 --- a/sw/source/filter/ww1/fltshell.cxx +++ b/sw/source/filter/ww1/fltshell.cxx @@ -428,7 +428,7 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, SwFltStackEntry* pFmt->SetFmtAttr(aAnchor); // Damit die Frames bei Einfuegen in existierendes Doc // erzeugt werden (erst nach Setzen des Ankers!): - if(pDoc->GetRootFrm() + if(pDoc->GetCurrentViewShell() //swmod 071108//swmod 071225 && (FLY_AT_PARA == pFmt->GetAnchor().GetAnchorId())) { pFmt->MakeFrms(); @@ -772,11 +772,11 @@ SwFltAnchorClient::SwFltAnchorClient(SwFltAnchor * pFltAnchor) { } -void SwFltAnchorClient::Modify(SfxPoolItem *, SfxPoolItem * pNew) +void SwFltAnchorClient::Modify(const SfxPoolItem *, const SfxPoolItem * pNew) { if (pNew->Which() == RES_FMT_CHG) { - SwFmtChg * pFmtChg = dynamic_cast<SwFmtChg *> (pNew); + const SwFmtChg * pFmtChg = dynamic_cast<const SwFmtChg *> (pNew); if (pFmtChg != NULL) { @@ -1600,7 +1600,7 @@ void SwFltOutDoc::EndTable() rStack.SetAttr( *pPaM->GetPoint(), 0, sal_False ); rEndStack.SetAttr( *pPaM->GetPoint(), 0, sal_False ); - if (GetDoc().GetRootFrm()){ + if (GetDoc().GetCurrentViewShell()){ //swmod 071108//swmod 071225 SwTableNode* pTableNode = GetDoc().IsIdxInTbl( pPaM->GetPoint()->nNode); pTableNode->DelFrms(); diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx index c4d2e906e797..da30b43553b3 100644..100755 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -1265,7 +1265,7 @@ void RtfExport::WriteHeaderFooter(const SwFrmFmt& rFmt, bool bHeader, const sal_ class SwRTFWriter : public Writer { private: - bool bOutOutlineOnly; + bool m_bOutOutlineOnly; public: SwRTFWriter( const String& rFilterName, const String& rBaseURL ); @@ -1277,7 +1277,8 @@ SwRTFWriter::SwRTFWriter( const String& rFltName, const String & rBaseURL ) { OSL_TRACE("%s", OSL_THIS_FUNC); SetBaseURL( rBaseURL ); - bOutOutlineOnly = 'O' == rFltName.GetChar( 0 ); + // export outline nodes, only (send outline to clipboard/presentation) + m_bOutOutlineOnly = 'O' == rFltName.GetChar( 0 ); } SwRTFWriter::~SwRTFWriter() @@ -1286,7 +1287,7 @@ SwRTFWriter::~SwRTFWriter() sal_uLong SwRTFWriter::WriteStream() { OSL_TRACE("%s", OSL_THIS_FUNC); - RtfExport aExport( NULL, pDoc, new SwPaM( *pCurPam->End(), *pCurPam->Start() ), pCurPam, this, bOutOutlineOnly ); + RtfExport aExport( NULL, pDoc, new SwPaM( *pCurPam->End(), *pCurPam->Start() ), pCurPam, this, m_bOutOutlineOnly ); aExport.ExportDocument( true ); return 0; } diff --git a/sw/source/filter/ww8/rtfexport.hxx b/sw/source/filter/ww8/rtfexport.hxx index 60b6c347ae0c..60b6c347ae0c 100644..100755 --- a/sw/source/filter/ww8/rtfexport.hxx +++ b/sw/source/filter/ww8/rtfexport.hxx diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index fc5593b2a8db..df5c897ae684 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -2066,7 +2066,7 @@ bool WinwordAnchoring::ConvertPosition( SwFmtHoriOrient& _iorHoriOri, const SwContact* pContact = _rFrmFmt.FindContactObj(); if ( pContact ) { - std::vector<SwAnchoredObject*> aAnchoredObjs; + std::list<SwAnchoredObject*> aAnchoredObjs; pContact->GetAnchoredObjs( aAnchoredObjs ); if ( !aAnchoredObjs.empty() ) { diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index d9f8c318ba0a..764b5438607f 100644..100755 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -108,6 +108,7 @@ #include <ndgrf.hxx> #include <ndole.hxx> + #include <cstdio> using namespace ::com::sun::star; @@ -516,7 +517,7 @@ void SwWW8AttrIter::OutAttr( xub_StrLen nSwPos, bool bRuby ) characters. */ if ( !m_rExport.SupportsUnicode() ) - aFont.GetCharSet() = GetCharSet(); + aFont.SetCharSet( GetCharSet() ); if ( rParentFont != aFont ) m_rExport.AttrOutput().OutputItem( aFont ); @@ -1608,12 +1609,13 @@ xub_StrLen MSWordExportBase::GetNextPos( SwWW8AttrIter* aAttrIter, const SwTxtNo { // Get the bookmarks for the normal run xub_StrLen nNextPos = aAttrIter->WhereNext(); - - GetSortedBookmarks( rNode, nAktPos, nNextPos - nAktPos ); - xub_StrLen nNextBookmark = nNextPos; - NearestBookmark( nNextPos, nAktPos, false ); + if( nNextBookmark > nAktPos )//no need to search for bookmarks otherwise + { + GetSortedBookmarks( rNode, nAktPos, nNextBookmark - nAktPos ); + NearestBookmark( nNextBookmark, nAktPos, false ); + } return std::min( nNextPos, nNextBookmark ); } @@ -1621,9 +1623,9 @@ void MSWordExportBase::UpdatePosition( SwWW8AttrIter* aAttrIter, xub_StrLen nAkt { xub_StrLen nNextPos; - // go to next attribute if no bookmark is found of if the bookmark is behind the next attribute position + // go to next attribute if no bookmark is found and if the next attribute position if at the current position bool bNextBookmark = NearestBookmark( nNextPos, nAktPos, true ); - if( !bNextBookmark || nNextPos < aAttrIter->WhereNext() ) + if( !bNextBookmark && nAktPos >= aAttrIter->WhereNext() ) aAttrIter->NextPos(); } @@ -2032,8 +2034,8 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) if (pTextNodeInfoInner->isFirstInTable()) { const SwTable * pTable = pTextNodeInfoInner->getTable(); - const SwTableFmt * pTabFmt = - dynamic_cast<const SwTableFmt *>(pTable->GetRegisteredIn()); + + const SwTableFmt * pTabFmt = pTable->GetTableFmt(); if (pTabFmt != NULL) { if (pTabFmt->GetBreak().GetBreak() == SVX_BREAK_PAGE_BEFORE) @@ -2246,7 +2248,7 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) // this has to be overruled. const SwFmtPageDesc& rPageDescAtParaStyle = ItemGet<SwFmtPageDesc>( rNode, RES_PAGEDESC ); - if( rPageDescAtParaStyle.GetRegisteredIn() ) + if( rPageDescAtParaStyle.KnowsPageDesc() ) pTmpSet->ClearItem( RES_BREAK ); } } @@ -2734,8 +2736,12 @@ void MSWordExportBase::OutputContentNode( const SwCntntNode& rNode ) switch ( rNode.GetNodeType() ) { case ND_TEXTNODE: - OutputTextNode( *rNode.GetTxtNode() ); - break; + { + const SwTxtNode& rTextNode = *rNode.GetTxtNode(); + if( !mbOutOutlineOnly || rTextNode.IsOutline() ) + OutputTextNode( rTextNode ); + } + break; case ND_GRFNODE: OutputGrfNode( *rNode.GetGrfNode() ); break; diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 9f63574adfd5..fe160b9493fe 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -2092,7 +2092,7 @@ void WW8AttributeOutput::TableOrientation( ww8::WW8TableNodeInfoInner::Pointer_t void WW8AttributeOutput::TableSpacing(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner) { const SwTable * pTable = pTableTextNodeInfoInner->getTable(); - const SwTableFmt * pTableFmt = dynamic_cast<const SwTableFmt *>(pTable->GetRegisteredIn()); + const SwTableFmt * pTableFmt = pTable->GetTableFmt(); if (pTableFmt != NULL) { @@ -3330,6 +3330,7 @@ MSWordExportBase::MSWordExportBase( SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM pStyles( NULL ), bHasHdr(false), bHasFtr(false), bSubstituteBullets(true), mbExportModeRTF( false ), + mbOutOutlineOnly( false ), pDoc( pDocument ), pCurPam( pCurrentPam ), pOrigPam( pOriginalPam ) diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index a3a42d923386..ce9da3f26873 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -551,6 +551,7 @@ public: sal_uInt8 bSubstituteBullets : 1; // true: SubstituteBullet() gets called bool mbExportModeRTF; + bool mbOutOutlineOnly; // export outline nodes, only (send outline to clipboard/presentation) SwDoc *pDoc; SwPaM *pCurPam, *pOrigPam; diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 9690e38f0b2f..55808fefc1aa 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -326,21 +326,19 @@ void MSWordExportBase::OutputItemSet( const SfxItemSet& rSet, bool bPapFmt, bool pISet = 0; // fuer Doppel-Attribute } } - +#include "switerator.hxx" void MSWordExportBase::GatherChapterFields() { //If the header/footer contains a chapter field - SwClientIter aIter(*pDoc->GetSysFldType(RES_CHAPTERFLD)); - const SwClient *pField = aIter.First(TYPE(SwFmtFld)); - while (pField) + SwFieldType* pType = pDoc->GetSysFldType( RES_CHAPTERFLD ); + SwIterator<SwFmtFld,SwFieldType> aFmtFlds( *pType ); + for ( SwFmtFld* pFld = aFmtFlds.First(); pFld; pFld = aFmtFlds.Next() ) { - const SwFmtFld* pFld = (const SwFmtFld*)(pField); if (const SwTxtFld *pTxtFld = pFld->GetTxtFld()) { const SwTxtNode &rTxtNode = pTxtFld->GetTxtNode(); maChapterFieldLocs.push_back(rTxtNode.GetIndex()); } - pField = aIter.Next(); } } @@ -442,7 +440,7 @@ void MSWordExportBase::OutputSectionBreaks( const SfxItemSet *pSet, const SwNode if ( pSet && pSet->Count() ) { if ( SFX_ITEM_SET == pSet->GetItemState( RES_PAGEDESC, false, &pItem ) - && ( (SwFmtPageDesc*)pItem )->GetRegisteredIn() ) + && ( (SwFmtPageDesc*)pItem )->KnowsPageDesc() ) { bBreakSet = true; bNewPageDesc = true; @@ -524,7 +522,7 @@ void MSWordExportBase::OutputSectionBreaks( const SfxItemSet *pSet, const SwNode // but a pagedesc item is an implicit page break before... const SwFmtPageDesc &rPageDesc = ItemGet<SwFmtPageDesc>( *pNd, RES_PAGEDESC ); - if ( rPageDesc.GetRegisteredIn() ) + if ( rPageDesc.KnowsPageDesc() ) bHackInBreak = true; } } @@ -856,10 +854,10 @@ void MSWordExportBase::OutputFormat( const SwFmt& rFmt, bool bPapFmt, bool bChpF bool MSWordExportBase::HasRefToObject( sal_uInt16 nTyp, const String* pName, sal_uInt16 nSeqNo ) { const SwTxtNode* pNd; - SwClientIter aIter( *pDoc->GetSysFldType( RES_GETREFFLD ) ); - for ( SwFmtFld* pFld = static_cast< SwFmtFld* >( aIter.First( TYPE( SwFmtFld ) ) ); - pFld; - pFld = static_cast< SwFmtFld* >( aIter.Next() ) ) + + SwFieldType* pType = pDoc->GetSysFldType( RES_GETREFFLD ); + SwIterator<SwFmtFld, SwFieldType> aFmtFlds( *pType ); + for ( SwFmtFld* pFld = aFmtFlds.First(); pFld; pFld = aFmtFlds.Next() ) { if ( pFld->GetTxtFld() && nTyp == pFld->GetFld()->GetSubType() && 0 != ( pNd = pFld->GetTxtFld()->GetpTxtNode() ) && @@ -3532,7 +3530,7 @@ void AttributeOutputBase::FormatPageDescription( const SwFmtPageDesc& rPageDesc if ( GetExport().bStyDef && GetExport().pOutFmtNode && GetExport().pOutFmtNode->ISA( SwTxtFmtColl ) ) { const SwTxtFmtColl* pC = (SwTxtFmtColl*)GetExport().pOutFmtNode; - if ( (SFX_ITEM_SET != pC->GetItemState( RES_BREAK, false ) ) && rPageDesc.GetRegisteredIn() ) + if ( (SFX_ITEM_SET != pC->GetItemState( RES_BREAK, false ) ) && rPageDesc.KnowsPageDesc() ) FormatBreak( SvxFmtBreakItem( SVX_BREAK_PAGE_BEFORE, RES_BREAK ) ); } } diff --git a/sw/source/filter/ww8/ww8graf2.cxx b/sw/source/filter/ww8/ww8graf2.cxx index 2bd9ab8b5681..0a8a99510fe0 100644 --- a/sw/source/filter/ww8/ww8graf2.cxx +++ b/sw/source/filter/ww8/ww8graf2.cxx @@ -41,7 +41,6 @@ #include <sfx2/app.hxx> #include <sfx2/docfile.hxx> #include <sfx2/fcontnr.hxx> -#include <dcontact.hxx> #include <grfatr.hxx> // class SwCropGrf #include <fmtflcnt.hxx> #include <fmtanchr.hxx> @@ -388,7 +387,7 @@ SwFlyFrmFmt* SwWW8ImplReader::MakeGrafNotInCntnt(const WW8PicDesc& rPD, &aFlySet, &rGrfSet, NULL); // Damit die Frames bei Einfuegen in existierendes Doc erzeugt werden: - if (rDoc.GetRootFrm() && + if (rDoc.GetCurrentViewShell() && //swmod 071108//swmod 071225 (FLY_AT_PARA == pFlyFmt->GetAnchor().GetAnchorId())) { pFlyFmt->MakeFrms(); diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index be19f7453432..e8a1d22f06ce 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -2761,7 +2761,7 @@ void lcl_toxMatchACSwitch( SwWW8ImplReader& /*rReader*/, if( STRING_NOTFOUND != n ) { SwTOXType* pType = (SwTOXType*)rDoc.GetTOXType( TOX_ILLUSTRATIONS, 0); - pType->Add( &rBase ); + rBase.RegisterToTOXType( *pType ); rBase.SetCaptionDisplay( eCaptionType ); // Read Sequence Name and store in TOXBase String sSeqName( rParam.GetResult() ); diff --git a/sw/source/filter/xml/XMLRedlineImportHelper.cxx b/sw/source/filter/xml/XMLRedlineImportHelper.cxx index ade7d08baf9c..1a1f1ed4aa2b 100644 --- a/sw/source/filter/xml/XMLRedlineImportHelper.cxx +++ b/sw/source/filter/xml/XMLRedlineImportHelper.cxx @@ -71,21 +71,22 @@ using ::com::sun::star::beans::XPropertySetInfo; SwDoc* lcl_GetDocViaTunnel( Reference<XTextCursor> & rCursor ) { Reference<XUnoTunnel> xTunnel( rCursor, UNO_QUERY); - OSL_ENSURE( xTunnel.is(), "missing XUnoTunnel for Cursor" ); - OTextCursorHelper* pSwXCursor = reinterpret_cast< OTextCursorHelper * >( - sal::static_int_cast< sal_IntPtr >(xTunnel->getSomething(OTextCursorHelper::getUnoTunnelId())) ); - OSL_ENSURE( NULL != pSwXCursor, "OTextCursorHelper missing" ); - return pSwXCursor->GetDoc(); + OSL_ENSURE(xTunnel.is(), "missing XUnoTunnel for XTextCursor"); + OTextCursorHelper *const pXCursor = + ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xTunnel); + OSL_ENSURE( pXCursor, "OTextCursorHelper missing" ); + return (pXCursor) ? pXCursor->GetDoc() : 0; } SwDoc* lcl_GetDocViaTunnel( Reference<XTextRange> & rRange ) { Reference<XUnoTunnel> xTunnel(rRange, UNO_QUERY); - OSL_ENSURE(xTunnel.is(), "Can't tunnel XTextRange"); - SwXTextRange *pRange = reinterpret_cast< SwXTextRange *>( - sal::static_int_cast< sal_IntPtr >(xTunnel->getSomething(SwXTextRange::getUnoTunnelId())) ); - OSL_ENSURE( NULL != pRange, "SwXTextRange missing" ); - return pRange->GetDoc(); + OSL_ENSURE(xTunnel.is(), "missing XUnoTunnel for XTextRange"); + SwXTextRange *const pXRange = + ::sw::UnoTunnelGetImplementation<SwXTextRange>(xTunnel); + // #i115174#: this may be a SvxUnoTextRange +// OSL_ENSURE( pXRange, "SwXTextRange missing" ); + return (pXRange) ? pXRange->GetDoc() : 0; } @@ -112,7 +113,7 @@ public: void Set( SwNodeIndex& rIndex ); void SetAsNodeIndex( Reference<XTextRange> & rRange ); - void CopyPositionInto(SwPosition& rPos); + void CopyPositionInto(SwPosition& rPos, SwDoc & rDoc); SwDoc* GetDoc(); sal_Bool IsValid(); @@ -155,6 +156,12 @@ void XTextRangeOrNodeIndexPosition::SetAsNodeIndex( // XTextRange -> XTunnel -> SwXTextRange SwDoc* pDoc = lcl_GetDocViaTunnel(rRange); + if (!pDoc) + { + OSL_TRACE("SetAsNodeIndex: no SwDoc"); + return; + } + // SwXTextRange -> PaM SwUnoInternalPaM aPaM(*pDoc); #if OSL_DEBUG_LEVEL > 0 @@ -167,14 +174,15 @@ void XTextRangeOrNodeIndexPosition::SetAsNodeIndex( Set(aPaM.GetPoint()->nNode); } -void XTextRangeOrNodeIndexPosition::CopyPositionInto(SwPosition& rPos) +void +XTextRangeOrNodeIndexPosition::CopyPositionInto(SwPosition& rPos, SwDoc & rDoc) { OSL_ENSURE(IsValid(), "Can't get Position"); // create PAM from start cursor (if no node index is present) if (NULL == pIndex) { - SwUnoInternalPaM aUnoPaM(*GetDoc()); + SwUnoInternalPaM aUnoPaM(rDoc); #if OSL_DEBUG_LEVEL > 0 sal_Bool bSuccess = #endif @@ -480,6 +488,13 @@ Reference<XTextCursor> XMLRedlineImportHelper::CreateRedlineTextSection( // get document from old cursor (via tunnel) SwDoc* pDoc = lcl_GetDocViaTunnel(xOldCursor); + if (!pDoc) + { + OSL_TRACE("XMLRedlineImportHelper::CreateRedlineTextSection: " + "no SwDoc => cannot create section."); + return 0; + } + // create text section for redline SwTxtFmtColl *pColl = pDoc->GetTxtCollFromPool (RES_POOLCOLL_STANDARD, false ); @@ -612,11 +627,18 @@ void XMLRedlineImportHelper::InsertIntoDocument(RedlineInfo* pRedlineInfo) // get the document (from one of the positions) SwDoc* pDoc = pRedlineInfo->aAnchorStart.GetDoc(); + if (!pDoc) + { + OSL_TRACE("XMLRedlineImportHelper::InsertIntoDocument: " + "no SwDoc => cannot insert redline."); + return; + } + // now create the PaM for the redline SwPaM aPaM(pDoc->GetNodes().GetEndOfContent()); - pRedlineInfo->aAnchorStart.CopyPositionInto(*aPaM.GetPoint()); + pRedlineInfo->aAnchorStart.CopyPositionInto(*aPaM.GetPoint(), *pDoc); aPaM.SetMark(); - pRedlineInfo->aAnchorEnd.CopyPositionInto(*aPaM.GetPoint()); + pRedlineInfo->aAnchorEnd.CopyPositionInto(*aPaM.GetPoint(), *pDoc); // collapse PaM if (start == end) if (*aPaM.GetPoint() == *aPaM.GetMark()) diff --git a/sw/source/filter/xml/wrtxml.cxx b/sw/source/filter/xml/wrtxml.cxx index a6bbc52d92ad..0a32e8f07d8b 100644 --- a/sw/source/filter/xml/wrtxml.cxx +++ b/sw/source/filter/xml/wrtxml.cxx @@ -439,7 +439,7 @@ pGraphicHelper = SvXMLGraphicHelper::Create( xStg, } } - if( pDoc->GetRootFrm() && pDoc->GetDocStat().nPage > 1 && + if( pDoc->GetCurrentViewShell() && pDoc->GetDocStat().nPage > 1 && //swmod 071108//swmod 071225 !(bOrganizerMode || bBlock || bErr) ) { OUString sStreamName( RTL_CONSTASCII_USTRINGPARAM("layout-cache") ); diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx index ad314a6a1177..4820b9f11a3d 100644 --- a/sw/source/filter/xml/xmlexp.cxx +++ b/sw/source/filter/xml/xmlexp.cxx @@ -52,6 +52,7 @@ #include <doc.hxx> #include <swmodule.hxx> #include <docsh.hxx> +#include <viewsh.hxx> #include <docstat.hxx> #include <swerror.h> #include <unotext.hxx> @@ -579,7 +580,8 @@ void SwXMLExport::SetBodyAttributes() if( pText ) { SwDoc *pDoc = pText->GetDoc(); - if( pDoc && pDoc->GetPageCount() > 1 ) + if( pDoc && pDoc->GetCurrentViewShell() && + pDoc->GetCurrentViewShell()->GetPageCount() > 1 ) { sal_Bool bValue = sal_True; rtl::OUStringBuffer sBuffer; diff --git a/sw/source/filter/xml/xmlfmt.cxx b/sw/source/filter/xml/xmlfmt.cxx index 43b203637673..10780d5cf88b 100644 --- a/sw/source/filter/xml/xmlfmt.cxx +++ b/sw/source/filter/xml/xmlfmt.cxx @@ -701,7 +701,7 @@ void SwXMLItemSetStyleContext_Impl::ConnectPageDesc() if( pFmtPageDesc ) { - pPageDesc->Add( pFmtPageDesc ); + pFmtPageDesc->RegisterToPageDesc( *pPageDesc ); pItemSet->Put( *pFmtPageDesc ); delete pFmtPageDesc; } @@ -1082,7 +1082,7 @@ void SwXMLImport::UpdateTxtCollConditions( SwDoc *pDoc ) if( bSendModify ) { SwCondCollCondChg aMsg( pColl ); - pColl->Modify( &aMsg, &aMsg ); + pColl->ModifyNotification( &aMsg, &aMsg ); } } } diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index fafa66f926e4..db85d42b1d9f 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -2832,7 +2832,7 @@ void SwXMLTableContext::MakeTable() } // ??? this is always false: root frame is only created in ViewShell::Init - if( pTableNode->GetDoc()->GetRootFrm() ) + if( pTableNode->GetDoc()->GetCurrentViewShell() ) //swmod 071108//swmod 071225 { pTableNode->DelFrms(); SwNodeIndex aIdx( *pTableNode->EndOfSectionNode(), 1 ); diff --git a/sw/source/filter/xml/xmltexti.cxx b/sw/source/filter/xml/xmltexti.cxx index 3eed5ae93a8f..57046f9b1a95 100644 --- a/sw/source/filter/xml/xmltexti.cxx +++ b/sw/source/filter/xml/xmltexti.cxx @@ -64,6 +64,7 @@ #include <ndole.hxx> #include <docsh.hxx> #include <sfx2/docfile.hxx> +#include <switerator.hxx> // for locking SolarMutex: svapp + mutex #include <vcl/svapp.hxx> @@ -321,9 +322,8 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertOLEObject( { // check whether an object with this name already exists in the document String aName; - SwClientIter aIter( *(SwModify*)pDoc->GetDfltGrfFmtColl() ); - for( SwCntntNode* pNd = (SwCntntNode*)aIter.First( TYPE( SwCntntNode ) ); - pNd; pNd = (SwCntntNode*)aIter.Next() ) + SwIterator<SwCntntNode,SwFmtColl> aIter( *pDoc->GetDfltGrfFmtColl() ); + for( SwCntntNode* pNd = aIter.First(); pNd; pNd = aIter.Next() ) { SwOLENode* pExistingOLENd = pNd->GetOLENode(); if( pExistingOLENd ) |