diff options
56 files changed, 843 insertions, 350 deletions
diff --git a/sw/JunitTest_sw_complex.mk b/sw/JunitTest_sw_complex.mk index df81b22f71..bbd05ffa80 100755 --- a/sw/JunitTest_sw_complex.mk +++ b/sw/JunitTest_sw_complex.mk @@ -64,7 +64,11 @@ $(eval $(call gb_JunitTest_add_classes,sw_complex,\ complex.writer.TextPortionEnumerationTest \ )) -# currently fails (should run again in os146) (except on windows) -# complex.writer.CheckBookmarks \ +# CheckBookmarks currently fails on windows because the hashes are different +ifneq ($(OS),WNT) +$(eval $(call gb_JunitTest_add_classes,sw_complex,\ + complex.writer.CheckBookmarks \ +)) +endif # vim: set noet sw=4 ts=4: diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx index a045d0a3bf..7d0f85bcfa 100644 --- a/sw/inc/swabstdlg.hxx +++ b/sw/inc/swabstdlg.hxx @@ -164,6 +164,11 @@ public: virtual const ::rtl::OUString& GetSaveFilter() const = 0; virtual const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > GetSelection() const = 0; virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> GetResultSet() const = 0; + virtual bool IsSaveIndividualDocs() const = 0; + virtual bool IsGenerateFromDataBase() const = 0; + virtual String GetColumnName() const = 0; + virtual String GetPath() const = 0; + }; class AbstractMailMergeCreateFromDlg : public VclAbstractDialog //add for SwMailMergeCreateFromDlg { diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx index 9d60315230..0a02af3bca 100644 --- a/sw/source/core/crsr/bookmrk.cxx +++ b/sw/source/core/crsr/bookmrk.cxx @@ -109,7 +109,7 @@ namespace sw { namespace mark , m_aName(rName) { lcl_FixPosition(*m_pPos1); - if(aPaM.HasMark()) + if (aPaM.HasMark() && (*aPaM.GetMark() != *aPaM.GetPoint())) { MarkBase::SetOtherMarkPos(*(aPaM.GetMark())); lcl_FixPosition(*m_pPos2); diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx index 0869e934fa..1bf7035221 100644 --- a/sw/source/core/crsr/findattr.cxx +++ b/sw/source/core/crsr/findattr.cxx @@ -311,15 +311,33 @@ void SwAttrCheckArr::SetNewSet( const SwTxtNode& rTxtNd, const SwPaM& rPam ) pItem = aIter.NextItem(); } } + +static bool +lcl_IsAttributeIgnorable(xub_StrLen const nNdStart, xub_StrLen const nNdEnd, + _SwSrchChrAttr const& rTmp) +{ + // #i115528#: if there is a paragraph attribute, it has been added by the + // SwAttrCheckArr ctor, and nFound is 1. + // if the paragraph is entirely covered by hints that override the paragraph + // attribute, then this function must find an attribute to decrement nFound! + // so check for an empty search range, let attributes that start/end there + // cover it, and hope for the best... + return ((nNdEnd == nNdStart) + ? ((rTmp.nEnd < nNdStart) || (nNdEnd < rTmp.nStt)) + : ((rTmp.nEnd <= nNdStart) || (nNdEnd <= rTmp.nStt))); +} + int SwAttrCheckArr::SetAttrFwd( const SwTxtAttr& rAttr ) { _SwSrchChrAttr aTmp( rAttr.GetAttr(), *rAttr.GetStart(), *rAttr.GetAnyEnd() ); - // alle die nicht im Bereich sind -> ignorieren - if( aTmp.nEnd <= nNdStt || aTmp.nStt >= nNdEnd ) + + // ignore all attributes not in search range + if (lcl_IsAttributeIgnorable(nNdStt, nNdEnd, aTmp)) + { return Found(); + } const SfxPoolItem* pItem; - // -------------------------------------------------------------- // Hier wird jetzt ausdruecklich auch in Zeichenvorlagen gesucht // -------------------------------------------------------------- @@ -473,9 +491,12 @@ int SwAttrCheckArr::SetAttrFwd( const SwTxtAttr& rAttr ) int SwAttrCheckArr::SetAttrBwd( const SwTxtAttr& rAttr ) { _SwSrchChrAttr aTmp( rAttr.GetAttr(), *rAttr.GetStart(), *rAttr.GetAnyEnd() ); - // alle die nicht im Bereich sind -> ignorieren - if( aTmp.nEnd < nNdStt || aTmp.nStt >= nNdEnd ) + + // ignore all attributes not in search range + if (lcl_IsAttributeIgnorable(nNdStt, nNdEnd, aTmp)) + { return Found(); + } const SfxPoolItem* pItem; // -------------------------------------------------------------- diff --git a/sw/source/core/doc/doccorr.cxx b/sw/source/core/doc/doccorr.cxx index f409d6b0e7..ba86116714 100644 --- a/sw/source/core/doc/doccorr.cxx +++ b/sw/source/core/doc/doccorr.cxx @@ -210,10 +210,22 @@ void SwDoc::CorrAbs(const SwNodeIndex& rOldNode, getIDocumentMarkAccess()->correctMarksAbsolute(rOldNode, rNewPos, nOffset); { // fix redlines SwRedlineTbl& rTbl = *pRedlineTbl; - for( sal_uInt16 n = 0; n < rTbl.Count(); ++n ) + for (sal_uInt16 n = 0; n < rTbl.Count(); ) { // is on position ?? - lcl_PaMCorrAbs(*rTbl[ n ], *aPam.Start(), *aPam.End(), aNewPos); + SwRedline *const pRedline( rTbl[ n ] ); + bool const bChanged = + lcl_PaMCorrAbs(*pRedline, *aPam.Start(), *aPam.End(), aNewPos); + // clean up empty redlines: docredln.cxx asserts these as invalid + if (bChanged && (*pRedline->GetPoint() == *pRedline->GetMark()) + && (pRedline->GetContentIdx() == NULL)) + { + rTbl.DeleteAndDestroy(n); + } + else + { + ++n; + } } } diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index e09ae79f13..ce1911cce6 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -2515,8 +2515,6 @@ SetRedlineMode( eOld ); rPam.GetMark()->nNode = aPtNd; rPam.GetMark()->nContent.Assign( aPtNd.GetNode().GetCntntNode(), nPtCnt ); - if( bJoinTxt ) - rPam.Move( fnMoveBackward ); if( pUndoRpl ) { @@ -2642,8 +2640,15 @@ bool SwDoc::DelFullPara( SwPaM& rPam ) return sal_False; } } - // text::Bookmarks usw. verschieben - CorrAbs( aRg.aStart, aRg.aEnd, *rPam.GetPoint(), sal_True ); + // move bookmarks, redlines etc. + if (aRg.aStart == aRg.aEnd) // only first CorrAbs variant handles this + { + CorrAbs( aRg.aStart, *rPam.GetPoint(), 0, sal_True ); + } + else + { + CorrAbs( aRg.aStart, aRg.aEnd, *rPam.GetPoint(), sal_True ); + } // was ist mit Fly's ?? { diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 9b7d965950..89e3d4c2f2 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -493,45 +493,14 @@ void SwDoc::ResetAttrs( const SwPaM &rRg, SwTxtNode* pTNd = aTmpStt.GetNode().GetTxtNode(); if( pTNd && pTNd->HasSwAttrSet() && pTNd->GetpSwAttrSet()->Count() ) { - SfxItemIter aIter( *pTNd->GetpSwAttrSet() ); - const SfxPoolItem* pItem = aIter.GetCurItem(); - SfxItemSet aCharSet( GetAttrPool(), RES_CHRATR_BEGIN, RES_CHRATR_END ); - - while( sal_True ) + if (pHst) { - if( IsInRange( aCharFmtSetRange, pItem->Which() )) - { - pTNd->GetOrCreateSwpHints(); - - aCharSet.Put( *pItem ); - - if( pHst ) - { - SwRegHistory aRegH( pTNd, *pTNd, pHst ); - pTNd->ResetAttr( pItem->Which() ); - } - else - pTNd->ResetAttr( pItem->Which() ); - } - if( aIter.IsAtEnd() ) - break; - pItem = aIter.NextItem(); + SwRegHistory history(pTNd, *pTNd, pHst); + pTNd->FmtToTxtAttr(pTNd); } - - if ( aCharSet.Count() ) + else { - if ( pHst ) - { - SwRegHistory history( pTNd, *pTNd, pHst ); - history.InsertItems( aCharSet, 0, pTNd->GetTxt().Len(), - nsSetAttrMode::SETATTR_NOFORMATATTR ); - } - else - { - SwTxtAttr* pNew = - MakeTxtAttr( *this, aCharSet, 0, pTNd->GetTxt().Len() ); - pTNd->InsertHint( pNew ); - } + pTNd->FmtToTxtAttr(pTNd); } } @@ -545,29 +514,14 @@ void SwDoc::ResetAttrs( const SwPaM &rRg, SwTxtNode* pTNd = aTmpEnd.GetNode().GetTxtNode(); if( pTNd && pTNd->HasSwAttrSet() && pTNd->GetpSwAttrSet()->Count() ) { - SfxItemIter aIter( *pTNd->GetpSwAttrSet() ); - const SfxPoolItem* pItem = aIter.GetCurItem(); - while( sal_True ) + if (pHst) { - if( IsInRange( aCharFmtSetRange, pItem->Which() )) - { - SwTxtAttr* pTAttr = MakeTxtAttr( *this, - const_cast<SfxPoolItem&>(*pItem), - 0, pTNd->GetTxt().Len() ); - SwpHints & rHints = pTNd->GetOrCreateSwpHints(); - rHints.SwpHintsArray::Insert( pTAttr ); - if ( pHst ) - { - SwRegHistory aRegH( pTNd, *pTNd, pHst ); - pTNd->ResetAttr( pItem->Which() ); - pHst->Add( pTAttr, aTmpEnd.GetIndex(), true ); - } - else - pTNd->ResetAttr( pItem->Which() ); - } - if( aIter.IsAtEnd() ) - break; - pItem = aIter.NextItem(); + SwRegHistory history(pTNd, *pTNd, pHst); + pTNd->FmtToTxtAttr(pTNd); + } + else + { + pTNd->FmtToTxtAttr(pTNd); } } } diff --git a/sw/source/core/docnode/ndnotxt.cxx b/sw/source/core/docnode/ndnotxt.cxx index 7325fef02d..79b9c546d4 100644..100755 --- a/sw/source/core/docnode/ndnotxt.cxx +++ b/sw/source/core/docnode/ndnotxt.cxx @@ -136,6 +136,30 @@ const PolyPolygon *SwNoTxtNode::HasContour() const const MapMode aContourMap( bPixelGrf ? MAP_PIXEL : MAP_100TH_MM ); if( bPixelGrf ? !bPixelContour : aGrfMap != aContourMap ) { + // --> OD #i102238# + double nGrfDPIx = 0.0; + double nGrfDPIy = 0.0; + { + if ( !bPixelGrf && bPixelContour ) + { + const Size aGrfPixelSize( GetGraphic().GetSizePixel() ); + const Size aGrfPrefMapModeSize( GetGraphic().GetPrefSize() ); + if ( aGrfMap.GetMapUnit() == MAP_INCH ) + { + nGrfDPIx = aGrfPixelSize.Width() / ( (double)aGrfMap.GetScaleX() * aGrfPrefMapModeSize.Width() ); + nGrfDPIy = aGrfPixelSize.Height() / ( (double)aGrfMap.GetScaleY() * aGrfPrefMapModeSize.Height() ); + } + else + { + const Size aGrf1000thInchSize = + OutputDevice::LogicToLogic( aGrfPrefMapModeSize, + aGrfMap, MAP_1000TH_INCH ); + nGrfDPIx = 1000.0 * aGrfPixelSize.Width() / aGrf1000thInchSize.Width(); + nGrfDPIy = 1000.0 * aGrfPixelSize.Height() / aGrf1000thInchSize.Height(); + } + } + } + // <-- ASSERT( !bPixelGrf || aGrfMap == aContourMap, "scale factor for pixel unsupported" ); OutputDevice* pOutDev = @@ -153,7 +177,16 @@ const PolyPolygon *SwNoTxtNode::HasContour() const rPoly[i] = pOutDev->LogicToPixel( rPoly[i], aContourMap ); else if( bPixelContour ) + { rPoly[i] = pOutDev->PixelToLogic( rPoly[i], aGrfMap ); + // --> OD #i102238# + if ( nGrfDPIx != 0 && nGrfDPIy != 0 ) + { + rPoly[i] = Point( rPoly[i].X() * pOutDev->ImplGetDPIX() / nGrfDPIx, + rPoly[i].Y() * pOutDev->ImplGetDPIY() / nGrfDPIy ); + } + // <-- + } else rPoly[i] = OutputDevice::LogicToLogic( rPoly[i], aContourMap, @@ -203,7 +236,9 @@ sal_Bool SwNoTxtNode::GetContourAPI( PolyPolygon &rContour ) const sal_uInt16 nPolyCount = rContour.Count(); for( sal_uInt16 j=0; j<nPolyCount; j++ ) { - Polygon& rPoly = (*pContour)[j]; + // --> OD #i102238# - use the right <PolyPolygon> instance + Polygon& rPoly = rContour[j]; + // <-- sal_uInt16 nCount = rPoly.GetSize(); for( sal_uInt16 i=0 ; i<nCount; i++ ) diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx index 5eb5ff15c7..de3fe2a5b6 100644..100755 --- a/sw/source/core/graphic/ndgrf.cxx +++ b/sw/source/core/graphic/ndgrf.cxx @@ -1183,7 +1183,10 @@ void SwGrfNode::ApplyInputStream( void SwGrfNode::UpdateLinkWithInputStream() { - if ( IsLinkedFile() ) + // --> OD #i85105# + // do not work on link, if a <SwapIn> has been triggered. + if ( !bInSwapIn && IsLinkedFile() ) + // <-- { GetLink()->setStreamToLoadFrom( mxInputStream, mbIsStreamReadOnly ); GetLink()->Update(); diff --git a/sw/source/core/inc/viewimp.hxx b/sw/source/core/inc/viewimp.hxx index c7389af86b..1a2de65521 100644..100755 --- a/sw/source/core/inc/viewimp.hxx +++ b/sw/source/core/inc/viewimp.hxx @@ -59,6 +59,11 @@ class SwPrintData; class SwPagePreviewLayout; struct PrevwPage; class SwTxtFrm; +// --> OD #i76669# +namespace sdr { namespace contact { + class ViewObjectContactRedirector; +} } +// <-- class SwViewImp { @@ -215,11 +220,13 @@ public: // direction at the outliner of the draw view for painting layers <hell> // and <heaven>. // OD 25.06.2003 #108784# - correct type of 1st parameter + // OD #i76669# - added parameter <pRedirector> void PaintLayer( const SdrLayerID _nLayerID, SwPrintData const*const pPrintData, const SwRect& _rRect, const Color* _pPageBackgrdColor = 0, - const bool _bIsPageRightToLeft = false ) const; + const bool _bIsPageRightToLeft = false, + sdr::contact::ViewObjectContactRedirector* pRedirector = 0 ) const; //wird als Link an die DrawEngine uebergeben, entscheidet was wie //gepaintet wird oder nicht. diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index eaa4c9bfc4..070ef612fd 100644..100755 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -870,11 +870,10 @@ void SwFlyFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew ) UpdateObjInSortedList(); } // <-- + // --> OD #i87645# - reset flags for the layout process (only if something has been invalidated) + ResetLayoutProcessBools(); + // <-- } - - // --> OD 2005-07-18 #i51474# - reset flags for the layout process - ResetLayoutProcessBools(); - // <-- } void SwFlyFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew, @@ -2352,7 +2351,10 @@ void SwFrm::AppendDrawObj( SwAnchoredObject& _rNewObj ) // Assure the control objects and group objects containing controls are on the control layer if ( ::CheckControlLayer( _rNewObj.DrawObj() ) ) { - const IDocumentDrawModelAccess* pIDDMA = GetUpper()->GetFmt()->getIDocumentDrawModelAccess(); + const IDocumentDrawModelAccess* pIDDMA = (IsFlyFrm()) + ? static_cast<SwFlyFrm*>(this)->GetFmt()-> + getIDocumentDrawModelAccess() + : GetUpper()->GetFmt()->getIDocumentDrawModelAccess(); const SdrLayerID aCurrentLayer(_rNewObj.DrawObj()->GetLayer()); const SdrLayerID aControlLayerID(pIDDMA->GetControlsId()); const SdrLayerID aInvisibleControlLayerID(pIDDMA->GetInvisibleControlsId()); diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index a378dff426..2e03bba405 100644..100755 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -86,6 +86,13 @@ #include <svx/svdogrp.hxx> #include <sortedobjs.hxx> #include <EnhancedPDFExportHelper.hxx> +// <-- +// --> OD #i76669# +#include <svx/sdr/contact/viewobjectcontactredirector.hxx> +#include <svx/sdr/contact/viewobjectcontact.hxx> +#include <svx/sdr/contact/viewcontact.hxx> +// <-- + #include <ndole.hxx> #include <svtools/chartprettypainter.hxx> #include <PostItMgr.hxx> @@ -2696,6 +2703,46 @@ void SwTabFrmPainter::Insert( SwLineEntry& rNew, bool bHori ) // FUNCTIONS USED FOR COLLAPSING TABLE BORDER LINES END // +// --> OD #i76669# +namespace +{ + class SwViewObjectContactRedirector : public ::sdr::contact::ViewObjectContactRedirector + { + private: + const ViewShell& mrViewShell; + + public: + SwViewObjectContactRedirector( const ViewShell& rSh ) + : mrViewShell( rSh ) + {}; + + virtual ~SwViewObjectContactRedirector() + {} + + virtual drawinglayer::primitive2d::Primitive2DSequence createRedirectedPrimitive2DSequence( + const sdr::contact::ViewObjectContact& rOriginal, + const sdr::contact::DisplayInfo& rDisplayInfo) + { + sal_Bool bPaint( sal_True ); + + SdrObject* pObj = rOriginal.GetViewContact().TryToGetSdrObject(); + if ( pObj ) + { + bPaint = SwFlyFrm::IsPaint( pObj, &mrViewShell ); + } + + if ( !bPaint ) + { + return drawinglayer::primitive2d::Primitive2DSequence(); + } + + return sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence( + rOriginal, rDisplayInfo ); + } + }; + +} // end of anonymous namespace +// <-- /************************************************************************* |* @@ -2717,7 +2764,7 @@ void SwTabFrmPainter::Insert( SwLineEntry& rNew, bool bHori ) void SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) const { - ASSERT( Lower() && Lower()->IsPageFrm(), "Lower der Root keine Seite." ); + ASSERT( Lower() && Lower()->IsPageFrm(), "Lower der Root keine Seite." ); PROTOCOL( this, PROT_FILE_INIT, 0, 0) @@ -2756,8 +2803,6 @@ SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) const // --> OD 2008-10-07 #i92745# // Extend check on certain states of the 'current' <ViewShell> instance to // all existing <ViewShell> instances. -// if ( !pSh->IsInEndAction() && !pSh->IsPaintInProgress() && -// (!pSh->Imp()->IsAction() || !pSh->Imp()->GetLayAction().IsActionInProgress() ) ) bool bPerformLayoutAction( true ); { ViewShell* pTmpViewShell = pSh; @@ -2812,10 +2857,11 @@ SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) const // #i68597# const bool bGridPainting(pSh->GetWin() && pSh->Imp()->HasDrawView() && pSh->Imp()->GetDrawView()->IsGridVisible()); - // --> OD 2008-05-16 #i84659# -// while ( pPage && !::IsShortCut( aRect, pPage->Frm() ) ) - while ( pPage ) + // --> OD #i76669# + SwViewObjectContactRedirector aSwRedirector( *pSh ); // <-- + + while ( pPage ) { const bool bPaintRightShadow = !bBookMode || (pPage == Lower()) || (!bLTR && !pPage->OnRightPage()) || (bLTR && pPage->OnRightPage()); const bool bRightSidebar = pPage->SidebarPosition() == sw::sidebarwindows::SIDEBAR_RIGHT; @@ -2826,12 +2872,10 @@ SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) const SwPageFrm::GetBorderAndShadowBoundRect( pPage->Frm(), pSh, aPaintRect, bRightSidebar ); if ( aRect.IsOver( aPaintRect ) ) - // <-- { if ( pSh->GetWin() ) { pSubsLines = new SwSubsRects; - // OD 18.11.2002 #99672# - create array for special sub-lines pSpecSubsLines = new SwSubsRects; } @@ -2842,15 +2886,6 @@ SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) const // marks), if painting on a window and the paint is trigger by an // end action. The inefficient and simple enlargement of the // paint area is replaced by this invalidation. - // if ( bExtraData ) - // { - // //Ja, das ist grob, aber wie macht man es besser? - // SWRECTFN( pPage ) - // (aPaintRect.*fnRect->fnSetLeftAndWidth)( - // (pPage->Frm().*fnRect->fnGetLeft)(), - // (pPage->Frm().*fnRect->fnGetWidth)() ); - // aPaintRect._Intersection( pSh->VisArea() ); - // } if ( bExtraData && pSh->GetWin() && pSh->IsInEndAction() ) { @@ -2911,32 +2946,31 @@ SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) const if ( pSh->Imp()->HasDrawView() ) { pLines->LockLines( sal_True ); - // OD 29.08.2002 #102450# - add 3rd parameter - // OD 09.12.2002 #103045# - add 4th parameter for horizontal text direction. const IDocumentDrawModelAccess* pIDDMA = pSh->getIDocumentDrawModelAccess(); - pSh->Imp()->PaintLayer( pIDDMA->GetHellId(), pPrintData, aPaintRect, - &aPageBackgrdColor, (pPage->IsRightToLeft() ? true : false) ); + pSh->Imp()->PaintLayer( pIDDMA->GetHellId(), + pPrintData, + aPaintRect, + &aPageBackgrdColor, + (pPage->IsRightToLeft() ? true : false), + &aSwRedirector ); pLines->PaintLines( pSh->GetOut() ); pLines->LockLines( sal_False ); } if( pSh->GetWin() ) { - // OD 18.11.2002 #99672# - collect sub-lines + // collect sub-lines pPage->RefreshSubsidiary( aPaintRect ); - // OD 18.11.2002 #99672# - paint special sub-lines + // paint special sub-lines pSpecSubsLines->PaintSubsidiary( pSh->GetOut(), NULL ); } pPage->Paint( aPaintRect ); - // OD 20.12.2002 #94627# - no paint of page border and shadow, if - // writer is in place mode. + // no paint of page border and shadow, if writer is in place mode. if( pSh->GetWin() && pSh->GetDoc()->GetDocShell() && !pSh->GetDoc()->GetDocShell()->IsInPlaceActive() ) { - // OD 12.02.2003 #i9719#, #105645# - use new method - // <SwPageFrm::PaintBorderAndShadow(..)>. SwPageFrm::PaintBorderAndShadow( pPage->Frm(), pSh, bPaintRightShadow, bRightSidebar ); SwPageFrm::PaintNotesSidebar( pPage->Frm(), pSh, pPage->GetPhyPageNum(), bRightSidebar); } @@ -2947,9 +2981,12 @@ SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) const { /// OD 29.08.2002 #102450# - add 3rd parameter // OD 09.12.2002 #103045# - add 4th parameter for horizontal text direction. - pSh->Imp()->PaintLayer( pSh->GetDoc()->GetHeavenId(), pPrintData, aPaintRect, + pSh->Imp()->PaintLayer( pSh->GetDoc()->GetHeavenId(), + pPrintData, + aPaintRect, &aPageBackgrdColor, - (pPage->IsRightToLeft() ? true : false) ); + (pPage->IsRightToLeft() ? true : false), + &aSwRedirector ); } if ( bExtraData ) @@ -6413,21 +6450,20 @@ void SwFrm::Retouche( const SwPageFrm * pPage, const SwRect &rRect ) const SwRect aRetouchePart( rRetouche ); if ( aRetouchePart.HasArea() ) { - // OD 30.08.2002 #102450# - // determine background color of page for <PaintLayer> method - // calls, painting <hell> or <heaven> const Color aPageBackgrdColor = pPage->GetDrawBackgrdColor(); - // OD 29.08.2002 #102450# - // add 3rd parameter to <PaintLayer> method calls - // OD 09.12.2002 #103045# - add 4th parameter for horizontal text direction. const IDocumentDrawModelAccess* pIDDMA = pSh->getIDocumentDrawModelAccess(); + // --> OD #i76669# + SwViewObjectContactRedirector aSwRedirector( *pSh ); + // <-- pSh->Imp()->PaintLayer( pIDDMA->GetHellId(), 0, aRetouchePart, &aPageBackgrdColor, - (pPage->IsRightToLeft() ? true : false) ); + (pPage->IsRightToLeft() ? true : false), + &aSwRedirector ); pSh->Imp()->PaintLayer( pIDDMA->GetHeavenId(), 0, aRetouchePart, &aPageBackgrdColor, - (pPage->IsRightToLeft() ? true : false) ); + (pPage->IsRightToLeft() ? true : false), + &aSwRedirector ); } SetRetouche(); @@ -6668,22 +6704,22 @@ Graphic SwFlyFrmFmt::MakeGraphic( ImageMap* pMap ) // OD 09.12.2002 #103045# - determine page, fly frame is on const SwPageFrm* pFlyPage = pFly->FindPageFrm(); - // OD 30.08.2002 #102450# - // determine color of page, the fly frame is on, for <PaintLayer> method - // calls, painting <hell> or <heaven> const Color aPageBackgrdColor = pFlyPage->GetDrawBackgrdColor(); - // OD 30.08.2002 #102450# - add 3rd parameter - // OD 09.12.2002 #103045# - add 4th parameter for horizontal text direction. const IDocumentDrawModelAccess* pIDDMA = pSh->getIDocumentDrawModelAccess(); + // --> OD #i76669# + SwViewObjectContactRedirector aSwRedirector( *pSh ); + // <-- pImp->PaintLayer( pIDDMA->GetHellId(), 0, aOut, &aPageBackgrdColor, - (pFlyPage->IsRightToLeft() ? true : false) ); + (pFlyPage->IsRightToLeft() ? true : false), + &aSwRedirector ); pLines->PaintLines( &aDev ); if ( pFly->IsFlyInCntFrm() ) pFly->Paint( aOut ); pLines->PaintLines( &aDev ); /// OD 30.08.2002 #102450# - add 3rd parameter pImp->PaintLayer( pIDDMA->GetHeavenId(), 0, aOut, &aPageBackgrdColor, - (pFlyPage->IsRightToLeft() ? true : false) ); + (pFlyPage->IsRightToLeft() ? true : false), + &aSwRedirector ); pLines->PaintLines( &aDev ); DELETEZ( pLines ); pFlyOnlyDraw = 0; diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index 6b0f12f526..84dd6b71b5 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -2100,12 +2100,18 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() if ( -1 != nDestPageNum ) { - // Destination Export - const sal_Int32 nDestId = - pPDFExtOutDevData->CreateDest( rDestRect.SVRect(), nDestPageNum ); + if ( aIBeg->nLinkId != -1 ) + { + // Destination Export + const sal_Int32 nDestId = pPDFExtOutDevData->CreateDest( rDestRect.SVRect(), nDestPageNum ); - // Connect Link and Destination: - pPDFExtOutDevData->SetLinkDest( aIBeg->nLinkId, nDestId ); + // Connect Link and Destination: + pPDFExtOutDevData->SetLinkDest( aIBeg->nLinkId, nDestId ); + } + else + { + pPDFExtOutDevData->DescribeRegisteredDest( aIBeg->nDestId, rDestRect.SVRect(), nDestPageNum ); + } } } else diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx index 869ac9be16..f5b5a8acd3 100644..100755 --- a/sw/source/core/text/frmform.cxx +++ b/sw/source/core/text/frmform.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -1048,8 +1048,21 @@ void SwTxtFrm::FormatAdjust( SwTxtFormatter &rLine, !rFrmBreak.IsInside( rLine ) ) : rFrmBreak.IsBreakNow( rLine ) ) ) ) ? 1 : 0; + // --> OD #i84870# + // no split of text frame, which only contains a as-character anchored object + const bool bOnlyContainsAsCharAnchoredObj = + !IsFollow() && nStrLen == 1 && + GetDrawObjs() && GetDrawObjs()->Count() == 1 && + (*GetDrawObjs())[0]->GetFrmFmt().GetAnchor().GetAnchorId() == FLY_AS_CHAR; + if ( nNew && bOnlyContainsAsCharAnchoredObj ) + { + nNew = 0; + } + // <-- if ( nNew ) + { SplitFrm( nEnd ); + } const SwFrm *pBodyFrm = (const SwFrm*)(FindBodyFrm()); @@ -1104,8 +1117,7 @@ void SwTxtFrm::FormatAdjust( SwTxtFormatter &rLine, // the numbering and must stay. if ( GetFollow()->GetOfst() != nEnd || GetFollow()->IsFieldFollow() || - ( nStrLen == 0 && GetTxtNode()->GetNumRule()) - ) + ( nStrLen == 0 && GetTxtNode()->GetNumRule() ) ) { nNew |= 3; } @@ -1116,8 +1128,11 @@ void SwTxtFrm::FormatAdjust( SwTxtFormatter &rLine, { // OD 21.03.2003 #108121# - Only split frame, if the frame contains // content or contains no content, but has a numbering. - if ( nStrLen > 0 || - ( nStrLen == 0 && GetTxtNode()->GetNumRule()) + // OD #i84870# - no split, if text frame only contains one + // as-character anchored object. + if ( !bOnlyContainsAsCharAnchoredObj && + ( nStrLen > 0 || + ( nStrLen == 0 && GetTxtNode()->GetNumRule() ) ) ) { SplitFrm( nEnd ); @@ -1138,7 +1153,15 @@ void SwTxtFrm::FormatAdjust( SwTxtFormatter &rLine, const SwTwips nDocPrtTop = Frm().Top() + Prt().Top(); const SwTwips nOldHeight = Prt().SSize().Height(); - const SwTwips nChg = rLine.CalcBottomLine() - nDocPrtTop - nOldHeight; + SwTwips nChg = rLine.CalcBottomLine() - nDocPrtTop - nOldHeight; + // --> OD #i84870# - no shrink of text frame, if it only contains one + // as-character anchored object. + if ( nChg < 0 && + bOnlyContainsAsCharAnchoredObj ) + { + nChg = 0; + } + // <-- // Vertical Formatting: // The (rotated) repaint rectangle's x coordinate referes to the frame. diff --git a/sw/source/core/text/widorp.cxx b/sw/source/core/text/widorp.cxx index b89f364971..f7aabf7dc4 100644..100755 --- a/sw/source/core/text/widorp.cxx +++ b/sw/source/core/text/widorp.cxx @@ -150,10 +150,23 @@ sal_Bool SwTxtFrmBreak::IsInside( SwTxtMargin &rLine ) const // Der Frm besitzt eine Hoehe, mit der er auf die Seite passt. SwTwips nHeight = (*fnRect->fnYDiff)( (pFrm->GetUpper()->*fnRect->fnGetPrtBottom)(), nOrigin ); - // Wenn sich alles innerhalb des bestehenden Frames abspielt, // ist das Ergebnis sal_True; bFit = nHeight >= nLineHeight; + + // --> OD #i103292# + if ( !bFit ) + { + if ( rLine.GetNext() && + pFrm->IsInTab() && !pFrm->GetFollow() && !pFrm->GetIndNext() ) + { + // add additional space taken as lower space as last content in a table + // for all text lines except the last one. + nHeight += pFrm->CalcAddLowerSpaceAsLastInTableCell(); + bFit = nHeight >= nLineHeight; + } + } + // <-- if( !bFit ) { // Die LineHeight sprengt die aktuelle Frm-Hoehe. diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index 15a753f219..f811afce9e 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -2101,7 +2101,7 @@ struct RemovePresentAttrs const SwTxtAttr* const pAutoStyle(i_rAttrSpan.second); SfxItemIter aIter(m_rAttrSet); const SfxPoolItem* pItem(aIter.GetCurItem()); - while (true) + while (pItem) { const sal_uInt16 nWhich(pItem->Which()); if (CharFmt::IsItemIncluded(nWhich, pAutoStyle)) @@ -2143,7 +2143,8 @@ lcl_CollectHintSpans(const SwpHints& i_rHints, const sal_uInt16 nLength, const AttrSpan_t aSpan(*pHint->GetStart(), *pHint->GetEnd()); o_rSpanMap.insert(AttrSpanMap_t::value_type(aSpan, pHint)); - if (aSpan.first != nLastEnd) + // < not != because there may be multiple CHARFMT at same range + if (nLastEnd < aSpan.first) { // insert dummy span covering the gap o_rSpanMap.insert(AttrSpanMap_t::value_type( diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx index 6170b49a6a..ee8000f754 100644 --- a/sw/source/core/undo/docundo.cxx +++ b/sw/source/core/undo/docundo.cxx @@ -47,6 +47,7 @@ #include <undo.hrc> #include <editsh.hxx> #include <unobaseclass.hxx> +#include <limits> #include <limits> diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx index 88fceefe76..daecf7e0d4 100644 --- a/sw/source/core/undo/undobj.cxx +++ b/sw/source/core/undo/undobj.cxx @@ -134,7 +134,7 @@ void SwUndRng::SetPaM( SwPaM & rPam, sal_Bool bCorrToCntnt ) const } SwPaM & SwUndRng::AddUndoRedoPaM( - ::sw::UndoRedoContext & rContext, bool bCorrToCntnt) const + ::sw::UndoRedoContext & rContext, bool const bCorrToCntnt) const { SwPaM & rPaM( rContext.GetCursorSupplier().CreateNewShellCursor() ); SetPaM( rPaM, bCorrToCntnt ); diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 766458b65c..61c154c2e8 100644..100755 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -1566,8 +1566,24 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName) if(pIdx) { SwNodeIndex aIdx(*pIdx, 1); - SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode(); - Size aActSize = ((SwGrfNode*)pNoTxt)->GetTwipSize(); + // --> OD #i85105# +// SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode(); +// Size aActSize = ((SwGrfNode*)pNoTxt)->GetTwipSize(); + Size aActSize; + { + SwGrfNode* pGrfNode = dynamic_cast<SwGrfNode*>(aIdx.GetNode().GetNoTxtNode()); + if ( pGrfNode ) + { + aActSize = pGrfNode->GetTwipSize(); + if ( aActSize.Width() == 0 && aActSize.Height() == 0 && + pGrfNode->IsLinkedFile() ) + { + pGrfNode->SwapIn( sal_True ); + aActSize = pGrfNode->GetTwipSize(); + } + } + } + // <-- awt::Size aTmp; aTmp.Width = TWIP_TO_MM100(aActSize.Width()); aTmp.Height = TWIP_TO_MM100(aActSize.Height()); @@ -2078,6 +2094,8 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan aFrmSet.Put( SwFmtAnchor( FLY_AT_PAGE, 1 )); } + aPam.DeleteMark(); // mark position node will be deleted! + aIntPam.DeleteMark(); // mark position node will be deleted! pFmt = pDoc->MakeFlyAndMove( *m_pCopySource, aFrmSet, 0, pParentFrmFmt ); diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index 21e4f76e76..37bf8aab70 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -155,12 +155,16 @@ namespace ++ppMark) { ::sw::mark::IMark* const pBkmk = ppMark->get(); - bool hasOther = pBkmk->IsExpanded(); + ::sw::mark::CrossRefBookmark *const pCrossRefMark( + dynamic_cast< ::sw::mark::CrossRefBookmark*>(pBkmk)); + bool const hasOther = pBkmk->IsExpanded(); const SwPosition& rStartPos = pBkmk->GetMarkStart(); if(rStartPos.nNode == nOwnNode) { - const sal_uInt8 nType = hasOther ? BKM_TYPE_START : BKM_TYPE_START_END; + // #i109272#: cross reference marks: need special handling! + sal_uInt8 const nType = (hasOther || pCrossRefMark) + ? BKM_TYPE_START : BKM_TYPE_START_END; rBkmArr.insert(SwXBookmarkPortion_ImplSharedPtr( new SwXBookmarkPortion_Impl( SwXBookmark::CreateXBookmark(rDoc, *pBkmk), @@ -173,8 +177,10 @@ namespace auto_ptr<SwPosition> pCrossRefEndPos; const SwPosition* pEndPos = NULL; if(hasOther) + { pEndPos = &rEndPos; - else if(dynamic_cast< ::sw::mark::CrossRefBookmark*>(pBkmk)) + } + else if (pCrossRefMark) { // Crossrefbookmarks only remember the start position but have to span the whole paragraph pCrossRefEndPos = auto_ptr<SwPosition>(new SwPosition(rEndPos)); diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index 8dc3194510..f7f9a1dfa7 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -1754,13 +1754,15 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) // DelFullPara is called const uno::Reference< text::XTextRange> xInsertTextRange = new SwXTextRange(aStartPam, this); + aStartPam.DeleteMark(); // mark position node may be deleted! pNewFrame->attach( xInsertTextRange ); pNewFrame->setName(m_pImpl->m_pDoc->GetUniqueFrameName()); } - if (!aStartPam.GetTxt().Len()) + SwTxtNode *const pTxtNode(aStartPam.GetNode()->GetTxtNode()); + OSL_ASSERT(pTxtNode); + if (!pTxtNode || !pTxtNode->Len()) // don't remove if it contains text! { - bool bMoved = false; { // has to be in a block to remove the SwIndexes before // DelFullPara is called SwPaM aMovePam( *aStartPam.GetNode() ); @@ -1772,14 +1774,8 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) m_pImpl->m_pDoc->SetAttr( aNewAnchor, *pNewFrame->GetFrmFmt() ); } - bMoved = true; - } - if (bMoved) - { - aStartPam.DeleteMark(); -// SwPaM aDelPam( *aStartPam.GetNode() ); - m_pImpl->m_pDoc->DelFullPara(aStartPam/*aDelPam*/); } + m_pImpl->m_pDoc->DelFullPara(aStartPam); } } catch (lang::IllegalArgumentException& rIllegal) diff --git a/sw/source/core/view/vdraw.cxx b/sw/source/core/view/vdraw.cxx index 223b0205e0..28efd39d8e 100644..100755 --- a/sw/source/core/view/vdraw.cxx +++ b/sw/source/core/view/vdraw.cxx @@ -182,7 +182,8 @@ void SwViewImp::PaintLayer( const SdrLayerID _nLayerID, SwPrintData const*const pPrintData, const SwRect& , const Color* _pPageBackgrdColor, - const bool _bIsPageRightToLeft ) const + const bool _bIsPageRightToLeft, + sdr::contact::ViewObjectContactRedirector* pRedirector ) const { if ( HasDrawView() ) { @@ -232,7 +233,7 @@ void SwViewImp::PaintLayer( const SdrLayerID _nLayerID, SdrView &rSdrView = const_cast< SdrView & >(GetPageView()->GetView()); rSdrView.setHideDraw( !pPrintData->IsPrintDraw() ); } - GetPageView()->DrawLayer(_nLayerID, pOutDev); + GetPageView()->DrawLayer( _nLayerID, pOutDev, pRedirector ); pOutDev->Pop(); // OD 29.08.2002 #102450# diff --git a/sw/source/filter/ww1/fltshell.cxx b/sw/source/filter/ww1/fltshell.cxx index 37d08784ba..2fbb19d8d5 100644 --- a/sw/source/filter/ww1/fltshell.cxx +++ b/sw/source/filter/ww1/fltshell.cxx @@ -137,13 +137,14 @@ void SwFltStackEntry::SetEndPos(const SwPosition& rEndPos) sal_Bool SwFltStackEntry::MakeRegion(SwDoc* pDoc, SwPaM& rRegion, sal_Bool bCheck ) { - // wird ueberhaupt ein Bereich umspannt ?? - // - ist kein Bereich, dann nicht returnen wenn am Anfang vom Absatz - // - Felder aussortieren, koennen keinen Bereich haben !! - if ( - nMkNode.GetIndex() == nPtNode.GetIndex() && nMkCntnt == nPtCntnt && - nPtCntnt && RES_TXTATR_FIELD != pAttr->Which() - ) + // does this range actually contain something? + // empty range is allowed if at start of empty paragraph + // fields are special: never have range, so leave them + SwCntntNode *const pCntntNode( + SwNodeIndex(nMkNode, +1).GetNode().GetCntntNode()); + if ((nMkNode.GetIndex() == nPtNode.GetIndex()) && (nMkCntnt == nPtCntnt) + && ((0 != nPtCntnt) || (pCntntNode && (0 != pCntntNode->Len()))) + && (RES_TXTATR_FIELD != pAttr->Which())) { return sal_False; } diff --git a/sw/source/filter/ww8/WW8TableInfo.cxx b/sw/source/filter/ww8/WW8TableInfo.cxx index 9f1727d3a5..609fcc6a17 100644 --- a/sw/source/filter/ww8/WW8TableInfo.cxx +++ b/sw/source/filter/ww8/WW8TableInfo.cxx @@ -251,8 +251,8 @@ WidthsPtr WW8TableNodeInfoInner::getWidthsOfRow() pWidths = WidthsPtr(new Widths); // number of cell written sal_uInt32 nBoxes = rTabBoxes.Count(); - if ( nBoxes > 32 ) - nBoxes = 32; + if ( nBoxes > MAXTABLECELLS ) + nBoxes = MAXTABLECELLS; for (sal_uInt32 n = 0; n < nBoxes; n++) { @@ -282,8 +282,8 @@ RowSpansPtr WW8TableNodeInfoInner::getRowSpansOfRow() const SwTableBoxes & rTabBoxes = pTabLine->GetTabBoxes(); sal_uInt32 nBoxes = rTabBoxes.Count(); - if (nBoxes > 32) - nBoxes = 32; + if (nBoxes > MAXTABLECELLS) + nBoxes = MAXTABLECELLS; for (sal_uInt32 n = 0; n < nBoxes; ++n) { diff --git a/sw/source/filter/ww8/WW8TableInfo.hxx b/sw/source/filter/ww8/WW8TableInfo.hxx index 3f74d4a5fc..0afa0978f2 100644 --- a/sw/source/filter/ww8/WW8TableInfo.hxx +++ b/sw/source/filter/ww8/WW8TableInfo.hxx @@ -46,6 +46,8 @@ namespace ww8 { using namespace ::std; +const unsigned int MAXTABLECELLS = 63; + class WW8TableNodeInfo; typedef boost::shared_ptr<SwRect> SwRectPtr; typedef ::std::vector<const SwTableBox *> TableBoxVector; diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 44fb2a29c0..2699cae7aa 100755 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -179,7 +179,7 @@ MSWordAttrIter::~MSWordAttrIter() // Mit OutAttr() werden die Attribute an der angegebenen SwPos // ausgegeben. -class SwAttrIter : public MSWordAttrIter +class WW8SwAttrIter : public MSWordAttrIter { private: const SwTxtNode& rNd; @@ -210,10 +210,10 @@ private: void IterToCurrent(); //No copying - SwAttrIter(const SwAttrIter&); - SwAttrIter& operator=(const SwAttrIter&); + WW8SwAttrIter(const WW8SwAttrIter&); + WW8SwAttrIter& operator=(const WW8SwAttrIter&); public: - SwAttrIter( MSWordExportBase& rWr, const SwTxtNode& rNd ); + WW8SwAttrIter( MSWordExportBase& rWr, const SwTxtNode& rNd ); bool IsTxtAttr( xub_StrLen nSwPos ); bool IsRedlineAtEnd( xub_StrLen nPos ) const; @@ -249,7 +249,7 @@ public: } }; -void SwAttrIter::IterToCurrent() +void WW8SwAttrIter::IterToCurrent() { ASSERT(maCharRuns.begin() != maCharRuns.end(), "Impossible"); mnScript = maCharRunIter->mnScript; @@ -257,7 +257,7 @@ void SwAttrIter::IterToCurrent() mbCharIsRTL = maCharRunIter->mbRTL; } -SwAttrIter::SwAttrIter(MSWordExportBase& rWr, const SwTxtNode& rTxtNd) : +WW8SwAttrIter::WW8SwAttrIter(MSWordExportBase& rWr, const SwTxtNode& rTxtNd) : MSWordAttrIter(rWr), rNd(rTxtNd), maCharRuns(GetPseudoCharRuns(rTxtNd, 0, !rWr.HackIsWW8OrHigher())), @@ -324,7 +324,7 @@ xub_StrLen lcl_getMinPos( xub_StrLen pos1, xub_StrLen pos2 ) return min; } -xub_StrLen SwAttrIter::SearchNext( xub_StrLen nStartPos ) +xub_StrLen WW8SwAttrIter::SearchNext( xub_StrLen nStartPos ) { xub_StrLen nPos; xub_StrLen nMinPos = STRING_MAXLEN; @@ -457,7 +457,7 @@ xub_StrLen SwAttrIter::SearchNext( xub_StrLen nStartPos ) return nMinPos; } -void SwAttrIter::OutAttr( xub_StrLen nSwPos ) +void WW8SwAttrIter::OutAttr( xub_StrLen nSwPos ) { m_rExport.AttrOutput().RTLAndCJKState( IsCharRTL(), GetScript() ); @@ -501,9 +501,7 @@ void SwAttrIter::OutAttr( xub_StrLen nSwPos ) : nSwPos == *pHt->GetStart() ) { sal_uInt16 nWhich = pHt->GetAttr().Which(); - if (nWhich == nFontId) - pFont = &(item_cast<SvxFontItem>(pHt->GetAttr())); - else if( nWhich == RES_TXTATR_AUTOFMT ) + if (nWhich == RES_TXTATR_AUTOFMT) { const SwFmtAutoFmt& rAutoFmt = static_cast<const SwFmtAutoFmt&>(pHt->GetAttr()); const boost::shared_ptr<SfxItemSet> pSet = rAutoFmt.GetStyleHandle(); @@ -583,7 +581,7 @@ void SwAttrIter::OutAttr( xub_StrLen nSwPos ) } } -void SwAttrIter::OutFlys(xub_StrLen nSwPos) +void WW8SwAttrIter::OutFlys(xub_StrLen nSwPos) { /* #i2916# @@ -605,7 +603,7 @@ void SwAttrIter::OutFlys(xub_StrLen nSwPos) } } -bool SwAttrIter::IsTxtAttr( xub_StrLen nSwPos ) +bool WW8SwAttrIter::IsTxtAttr( xub_StrLen nSwPos ) { // search for attrs with CH_TXTATR if (const SwpHints* pTxtAttrs = rNd.GetpSwpHints()) @@ -621,7 +619,7 @@ bool SwAttrIter::IsTxtAttr( xub_StrLen nSwPos ) return false; } -bool SwAttrIter::IsDropCap( int nSwPos ) +bool WW8SwAttrIter::IsDropCap( int nSwPos ) { // see if the current position falls on a DropCap int nDropChars = mrSwFmtDrop.GetChars(); @@ -640,7 +638,7 @@ bool SwAttrIter::IsDropCap( int nSwPos ) return false; } -bool SwAttrIter::RequiresImplicitBookmark() +bool WW8SwAttrIter::RequiresImplicitBookmark() { SwImplBookmarksIter bkmkIterEnd = m_rExport.maImplicitBookmarks.end(); for ( SwImplBookmarksIter aIter = m_rExport.maImplicitBookmarks.begin(); aIter != bkmkIterEnd; ++aIter ) @@ -659,7 +657,7 @@ bool SwAttrIter::RequiresImplicitBookmark() // Attribut-Anfangposition fragen kann. // Es koennen nur Attribute mit Ende abgefragt werden. // Es wird mit bDeep gesucht -const SfxPoolItem* SwAttrIter::HasTextItem( sal_uInt16 nWhich ) const +const SfxPoolItem* WW8SwAttrIter::HasTextItem( sal_uInt16 nWhich ) const { const SfxPoolItem* pRet = 0; const SwpHints* pTxtAttrs = rNd.GetpSwpHints(); @@ -692,7 +690,7 @@ void WW8Export::GetCurrentItems(WW8Bytes& rItems) const rItems.Insert((*pO)[nI], rItems.Count()); } -const SfxPoolItem& SwAttrIter::GetItem(sal_uInt16 nWhich) const +const SfxPoolItem& WW8SwAttrIter::GetItem(sal_uInt16 nWhich) const { const SfxPoolItem* pRet = HasTextItem(nWhich); return pRet ? *pRet : rNd.SwCntntNode::GetAttr(nWhich); @@ -1073,7 +1071,7 @@ String BookmarkToWriter(const String &rBookmark) INetURLObject::DECODE_UNAMBIGUOUS, RTL_TEXTENCODING_ASCII_US); } -void SwAttrIter::OutSwFmtRefMark(const SwFmtRefMark& rAttr, bool) +void WW8SwAttrIter::OutSwFmtRefMark(const SwFmtRefMark& rAttr, bool) { if ( m_rExport.HasRefToObject( REF_SETREFATTR, &rAttr.GetRefName(), 0 ) ) m_rExport.AppendBookmark( m_rExport.GetBookmarkName( REF_SETREFATTR, @@ -1173,7 +1171,7 @@ void AttributeOutputBase::TOXMark( const SwTxtNode& rNode, const SwTOXMark& rAtt FieldVanish( sTxt, eType ); } -int SwAttrIter::OutAttrWithRange(xub_StrLen nPos) +int WW8SwAttrIter::OutAttrWithRange(xub_StrLen nPos) { int nRet = 0; if ( const SwpHints* pTxtAttrs = rNd.GetpSwpHints() ) @@ -1234,7 +1232,7 @@ int SwAttrIter::OutAttrWithRange(xub_StrLen nPos) return nRet; } -bool SwAttrIter::IsRedlineAtEnd( xub_StrLen nEnd ) const +bool WW8SwAttrIter::IsRedlineAtEnd( xub_StrLen nEnd ) const { bool bRet = false; // search next Redline @@ -1256,7 +1254,7 @@ bool SwAttrIter::IsRedlineAtEnd( xub_StrLen nEnd ) const return bRet; } -const SwRedlineData* SwAttrIter::GetRedline( xub_StrLen nPos ) +const SwRedlineData* WW8SwAttrIter::GetRedline( xub_StrLen nPos ) { if( pCurRedline ) { @@ -1451,7 +1449,7 @@ Convert characters that need to be converted, the basic replacements and the ridicously complicated title case attribute mapping to hardcoded upper case because word doesn't have the feature */ -String SwAttrIter::GetSnippet(const String &rStr, xub_StrLen nAktPos, +String WW8SwAttrIter::GetSnippet(const String &rStr, xub_StrLen nAktPos, xub_StrLen nLen) const { String aSnippet(rStr, nAktPos, nLen); @@ -1647,7 +1645,7 @@ void WW8AttributeOutput::FormatDrop( const SwTxtNode& rNode, const SwFmtDrop &rS m_rWW8Export.pO->Remove( 0, m_rWW8Export.pO->Count() ); } -xub_StrLen MSWordExportBase::GetNextPos( SwAttrIter* aAttrIter, const SwTxtNode& rNode, xub_StrLen nAktPos ) +xub_StrLen MSWordExportBase::GetNextPos( WW8SwAttrIter* aAttrIter, const SwTxtNode& rNode, xub_StrLen nAktPos ) { // Get the bookmarks for the normal run xub_StrLen nNextPos = aAttrIter->WhereNext(); @@ -1661,7 +1659,7 @@ xub_StrLen MSWordExportBase::GetNextPos( SwAttrIter* aAttrIter, const SwTxtNode& return std::min( nNextPos, nNextBookmark ); } -void MSWordExportBase::UpdatePosition( SwAttrIter* aAttrIter, xub_StrLen nAktPos, xub_StrLen /*nEnd*/ ) +void MSWordExportBase::UpdatePosition( WW8SwAttrIter* aAttrIter, xub_StrLen nAktPos, xub_StrLen /*nEnd*/ ) { xub_StrLen nNextPos; @@ -1799,7 +1797,7 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) // have to remember it in nStyle sal_uInt16 nStyle = nStyleBeforeFly; - SwAttrIter aAttrIter( *this, rNode ); + WW8SwAttrIter aAttrIter( *this, rNode ); rtl_TextEncoding eChrSet = aAttrIter.GetCharSet(); if ( bStartTOX ) @@ -1842,7 +1840,7 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) String aStr( rNode.GetTxt() ); xub_StrLen nAktPos = 0; - xub_StrLen nEnd = aStr.Len(); + xub_StrLen const nEnd = aStr.Len(); bool bRedlineAtEnd = false; int nOpenAttrWithRange = 0; @@ -1934,6 +1932,15 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) if ( aAttrIter.IsDropCap( nNextAttr ) ) AttrOutput().FormatDrop( rNode, aAttrIter.GetSwFmtDrop(), nStyle, pTextNodeInfo, pTextNodeInfoInner ); + if (0 != nEnd) + { + // Output the character attributes + // #i51277# do this before writing flys at end of paragraph + AttrOutput().StartRunProperties(); + aAttrIter.OutAttr( nAktPos ); + AttrOutput().EndRunProperties( pRedlineData ); + } + // At the end of line, output the attributes until the CR. // Exception: footnotes at the end of line if ( nNextAttr == nEnd ) @@ -1958,11 +1965,16 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) } } } - - // Output the character attributes - AttrOutput().StartRunProperties(); - aAttrIter.OutAttr( nAktPos ); // nAktPos - 1 ?? - AttrOutput().EndRunProperties( pRedlineData ); + + if (0 == nEnd) + { + // Output the character attributes + // do it after WriteCR for an empty paragraph (otherwise + // WW8_WrFkp::Append throws SPRMs away...) + AttrOutput().StartRunProperties(); + aAttrIter.OutAttr( nAktPos ); + AttrOutput().EndRunProperties( pRedlineData ); + } // Exception: footnotes at the end of line if ( nNextAttr == nEnd ) diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx index 121dff113c..9f15b217b9 100644 --- a/sw/source/filter/ww8/wrtw8num.cxx +++ b/sw/source/filter/ww8/wrtw8num.cxx @@ -231,8 +231,15 @@ void WW8AttributeOutput::NumberingLevel( sal_uInt8 /*nLevel*/, sal_uInt8 nAlign; switch ( eAdjust ) { - case SVX_ADJUST_CENTER: nAlign = 1; break; - default: nAlign = 0; break; + case SVX_ADJUST_CENTER: + nAlign = 1; + break; + case SVX_ADJUST_RIGHT: + nAlign = 2; + break; + default: + nAlign = 0; + break; } *m_rWW8Export.pTableStrm << nAlign; diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index dd7f0c3270..3f315b39a9 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -2166,6 +2166,8 @@ void WW8AttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner->getTableBoxesOfRow(); // number of cell written sal_uInt32 nBoxes = pTableBoxes->size(); + if (nBoxes > ww8::MAXTABLECELLS) + nBoxes = ww8::MAXTABLECELLS; // sprm header m_rWW8Export.InsUInt16( NS_sprm::LN_TDefTable ); @@ -3383,7 +3385,7 @@ sal_uLong SwWW8Writer::Write( SwPaM& rPaM, SfxMedium& rMed, MSWordExportBase::MSWordExportBase( SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM *pOriginalPam ) : aMainStg(sMainStream), pISet(0), pUsedNumTbl(0), mpTopNodeOfHdFtPage(0), - pBmpPal(0), pKeyMap(0), pOLEExp(0), pOCXExp(0), pOleMap(0), + pBmpPal(0), pOLEExp(0), pOCXExp(0), pOleMap(0), mpTableInfo(new ww8::WW8TableInfo()), nUniqueList(0), mnHdFtIndex(0), pAktPageDesc(0), pPapPlc(0), pChpPlc(0), pChpIter(0), pStyles( NULL ), @@ -3399,8 +3401,6 @@ MSWordExportBase::MSWordExportBase( SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM MSWordExportBase::~MSWordExportBase() { delete pBmpPal; - if (pKeyMap) - delete[] (NfKeywordTable*)pKeyMap; delete pOLEExp; delete pOCXExp; delete pOleMap; @@ -3884,4 +3884,35 @@ void MSWordExportBase::OutputEndNode( const SwEndNode &rNode ) #endif } +const NfKeywordTable & MSWordExportBase::GetNfKeywordTable() +{ + if (pKeyMap.get() == NULL) + { + pKeyMap.reset(new NfKeywordTable); + NfKeywordTable & rKeywordTable = *pKeyMap; + rKeywordTable[NF_KEY_D] = ::rtl::OUString::createFromAscii("d"); + rKeywordTable[NF_KEY_DD] = ::rtl::OUString::createFromAscii("dd"); + rKeywordTable[NF_KEY_DDD] = ::rtl::OUString::createFromAscii("ddd"); + rKeywordTable[NF_KEY_DDDD] = ::rtl::OUString::createFromAscii("dddd"); + rKeywordTable[NF_KEY_M] = ::rtl::OUString::createFromAscii("M"); + rKeywordTable[NF_KEY_MM] = ::rtl::OUString::createFromAscii("MM"); + rKeywordTable[NF_KEY_MMM] = ::rtl::OUString::createFromAscii("MMM"); + rKeywordTable[NF_KEY_MMMM] = ::rtl::OUString::createFromAscii("MMMM"); + rKeywordTable[NF_KEY_NN] = ::rtl::OUString::createFromAscii("ddd"); + rKeywordTable[NF_KEY_NNN] = ::rtl::OUString::createFromAscii("dddd"); + rKeywordTable[NF_KEY_NNNN] = ::rtl::OUString::createFromAscii("dddd"); + rKeywordTable[NF_KEY_YY] = ::rtl::OUString::createFromAscii("yy"); + rKeywordTable[NF_KEY_YYYY] = ::rtl::OUString::createFromAscii("yyyy"); + rKeywordTable[NF_KEY_H] = ::rtl::OUString::createFromAscii("H"); + rKeywordTable[NF_KEY_HH] = ::rtl::OUString::createFromAscii("HH"); + rKeywordTable[NF_KEY_MI] = ::rtl::OUString::createFromAscii("m"); + rKeywordTable[NF_KEY_MMI] = ::rtl::OUString::createFromAscii("mm"); + rKeywordTable[NF_KEY_S] = ::rtl::OUString::createFromAscii("s"); + rKeywordTable[NF_KEY_SS] = ::rtl::OUString::createFromAscii("ss"); + rKeywordTable[NF_KEY_AMPM] = ::rtl::OUString::createFromAscii("AM/PM"); + } + + return *pKeyMap; +} + /* vi:set tabstop=4 shiftwidth=4 expandtab: */ diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index fcf17da3f5..be83605310 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -58,7 +58,7 @@ namespace msfilter class MSCodec_Std97; } -class SwAttrIter; +class WW8SwAttrIter; class AttributeOutputBase; class DocxAttributeOutput; class RtfAttributeOutput; @@ -472,7 +472,7 @@ public: WW8_WrtBookmarks* pBkmks; WW8_WrtRedlineAuthor* pRedlAuthors; BitmapPalette* pBmpPal; - void* pKeyMap; + boost::shared_ptr<NfKeywordTable> pKeyMap; SvxMSExportOLEObjects* pOLEExp; SwMSConvertControls* pOCXExp; WW8OleMaps* pOleMap; @@ -752,10 +752,10 @@ protected: virtual void ExportDocument_Impl() = 0; /// Get the next position in the text node to output - virtual xub_StrLen GetNextPos( SwAttrIter* pAttrIter, const SwTxtNode& rNode, xub_StrLen nAktPos ); + virtual xub_StrLen GetNextPos( WW8SwAttrIter* pAttrIter, const SwTxtNode& rNode, xub_StrLen nAktPos ); /// Update the information for GetNextPos(). - virtual void UpdatePosition( SwAttrIter* pAttrIter, xub_StrLen nAktPos, xub_StrLen nEnd ); + virtual void UpdatePosition( WW8SwAttrIter* pAttrIter, xub_StrLen nAktPos, xub_StrLen nEnd ); /// Output SwTxtNode void OutputTextNode( const SwTxtNode& ); @@ -817,6 +817,8 @@ protected: bool GetBookmarks( const SwTxtNode& rNd, xub_StrLen nStt, xub_StrLen nEnd, IMarkVector& rArr ); + const NfKeywordTable & GetNfKeywordTable(); + public: MSWordExportBase( SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM *pOriginalPam ); virtual ~MSWordExportBase(); diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 8f11ff16e8..31c9808232 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -437,10 +437,19 @@ void MSWordExportBase::OutputSectionBreaks( const SfxItemSet *pSet, const SwNode //section. bool bBreakSet = false; + const SwPageDesc * pPageDesc = rNd.FindPageDesc(sal_False); + + if (pAktPageDesc != pPageDesc) + { + bBreakSet = true; + bNewPageDesc = true; + pAktPageDesc = pPageDesc; + } + if ( pSet && pSet->Count() ) { - if ( SFX_ITEM_SET == pSet->GetItemState( RES_PAGEDESC, false, &pItem ) - && ( (SwFmtPageDesc*)pItem )->KnowsPageDesc() ) + if ( SFX_ITEM_SET == pSet->GetItemState( RES_PAGEDESC, false, &pItem ) && + dynamic_cast<const SwFmtPageDesc*>(pItem)->GetRegisteredIn() != NULL) { bBreakSet = true; bNewPageDesc = true; @@ -2419,19 +2428,13 @@ bool MSWordExportBase::GetNumberFmt(const SwField& rFld, String& rStr) const SvNumberformat* pNumFmt = pNFmtr->GetEntry( nFmtIdx ); if( pNumFmt ) { - //sal_uInt16 nLng = rFld.GetLanguage(); - LocaleDataWrapper aLocDat( pNFmtr->GetServiceManager(), - MsLangId::convertLanguageToLocale( LANGUAGE_ENGLISH_US ) ); + sal_uInt16 nLng = rFld.GetLanguage(); + LocaleDataWrapper aLocDat(pNFmtr->GetServiceManager(), + MsLangId::convertLanguageToLocale(nLng)); - if( !pKeyMap ) - { - pKeyMap = new NfKeywordTable; - NfKeywordTable& rKeyMap = *(NfKeywordTable*)pKeyMap; - pNFmtr->FillKeywordTable( rKeyMap, LANGUAGE_ENGLISH_US ); - } - - String sFmt(pNumFmt->GetMappedFormatstring(*(NfKeywordTable*)pKeyMap, + String sFmt(pNumFmt->GetMappedFormatstring(GetNfKeywordTable(), aLocDat)); + if (sFmt.Len()) { sw::ms::SwapQuotesInField(sFmt); diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index 88d1f49ad8..c75f90c54d 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -2192,7 +2192,7 @@ void WW8FormulaControl::FormulaRead(SwWw8ControlType nWhich, nType=1; } fUnknown = nHeaderByte & 0x3; - fDropdownIndex = (nHeaderByte & 0xFC) >> 2; + fDropdownIndex = (nHeaderByte & 0x7C) >> 2; *pDataStream >> nField; fToolTip = nField & 0x01; fNoMark = (nField & 0x02)>>1; @@ -2485,7 +2485,15 @@ sal_Bool WW8FormulaListBox::Import(const uno::Reference < aTmp <<= aListSource; xPropSet->setPropertyValue(C2U("StringItemList"), aTmp ); - aTmp <<= aListSource[0]; + if (fDropdownIndex < nLen) + { + aTmp <<= aListSource[fDropdownIndex]; + } + else + { + aTmp <<= aListSource[0]; + } + xPropSet->setPropertyValue(C2U("DefaultText"), aTmp ); rSz = rRdr.MiserableDropDownFormHack(maListEntries[0], xPropSet); diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx index ba92c69202..7a23a98e15 100644 --- a/sw/source/filter/xml/swxml.cxx +++ b/sw/source/filter/xml/swxml.cxx @@ -925,18 +925,19 @@ sal_uLong XMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPaM, con } } - sal_uInt32 nWarn = 0; - sal_uInt32 nWarn2 = 0; // read storage streams + + // #i103539#: always read meta.xml for generator + sal_uInt32 const nWarn = ReadThroughComponent( + xStorage, xModelComp, "meta.xml", "Meta.xml", xServiceFactory, + (bOASIS ? "com.sun.star.comp.Writer.XMLOasisMetaImporter" + : "com.sun.star.comp.Writer.XMLMetaImporter"), + aEmptyArgs, rName, sal_False ); + + sal_uInt32 nWarn2 = 0; if( !(IsOrganizerMode() || IsBlockMode() || aOpt.IsFmtsOnly() || bInsertMode) ) { - nWarn = ReadThroughComponent( - xStorage, xModelComp, "meta.xml", "Meta.xml", xServiceFactory, - (bOASIS ? "com.sun.star.comp.Writer.XMLOasisMetaImporter" - : "com.sun.star.comp.Writer.XMLMetaImporter"), - aEmptyArgs, rName, sal_False ); - nWarn2 = ReadThroughComponent( xStorage, xModelComp, "settings.xml", NULL, xServiceFactory, (bOASIS ? "com.sun.star.comp.Writer.XMLOasisSettingsImporter" diff --git a/sw/source/filter/xml/xmlbrshi.hxx b/sw/source/filter/xml/xmlbrshi.hxx index 83328ca87d..994f7c578a 100644 --- a/sw/source/filter/xml/xmlbrshi.hxx +++ b/sw/source/filter/xml/xmlbrshi.hxx @@ -25,8 +25,12 @@ * ************************************************************************/ -#ifndef _XMLBRSHI_HXX -#define _XMLBRSHI_HXX +#ifndef SW_XMLBRSHI_HXX +#define SW_XMLBRSHI_HXX + +#include <com/sun/star/io/XOutputStream.hpp> + +#include <xmloff/xmlictxt.hxx> class SvXMLImport; class SvXMLUnitConverter; diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index ce282d4d2d..5a930513fd 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -419,23 +419,23 @@ SvXMLImportContext *SwXMLImport::CreateContext( pContext = CreateMetaContext(rLocalName); } else if ( XML_NAMESPACE_OFFICE==nPrefix && + IsXMLToken( rLocalName, XML_DOCUMENT_STYLES ) ) + { + pContext = new SwXMLDocStylesContext_Impl( *this, nPrefix, rLocalName, + xAttrList ); + } + else if ( XML_NAMESPACE_OFFICE==nPrefix && IsXMLToken( rLocalName, XML_DOCUMENT ) ) { uno::Reference<xml::sax::XDocumentHandler> xDocBuilder( mxServiceFactory->createInstance(::rtl::OUString::createFromAscii( "com.sun.star.xml.dom.SAXDocumentBuilder")), uno::UNO_QUERY_THROW); - uno::Reference<document::XDocumentPropertiesSupplier> xDPS( - GetModel(), UNO_QUERY_THROW); + uno::Reference<document::XDocumentProperties> const xDocProps( + GetDocumentProperties()); // flat OpenDocument file format pContext = new SwXMLOfficeDocContext_Impl( *this, nPrefix, rLocalName, - xAttrList, xDPS->getDocumentProperties(), xDocBuilder); - } - else if ( XML_NAMESPACE_OFFICE==nPrefix && - IsXMLToken( rLocalName, XML_DOCUMENT_STYLES ) ) - { - pContext = new SwXMLDocStylesContext_Impl( *this, nPrefix, rLocalName, - xAttrList ); + xAttrList, xDocProps, xDocBuilder); } // <-- else diff --git a/sw/source/filter/xml/xmlimp.hxx b/sw/source/filter/xml/xmlimp.hxx index e5f4c8ff0e..520d3c7a1b 100644 --- a/sw/source/filter/xml/xmlimp.hxx +++ b/sw/source/filter/xml/xmlimp.hxx @@ -25,14 +25,18 @@ * ************************************************************************/ -#ifndef _XMLIMP_HXX -#define _XMLIMP_HXX +#ifndef SW_XMLIMP_HXX +#define SW_XMLIMP_HXX + +#include <com/sun/star/document/XDocumentProperties.hpp> #include <sot/storage.hxx> + #include <xmloff/xmlictxt.hxx> -#include "xmlitmap.hxx" #include <xmloff/xmlimp.hxx> +#include "xmlitmap.hxx" + class SwDoc; class SwPaM; class SvXMLUnitConverter; @@ -182,6 +186,7 @@ public: inline const SvXMLUnitConverter& GetTwipUnitConverter() const; inline const SvXMLImportItemMapper& GetTableItemMapper() const; + inline SvXMLImportItemMapper& GetTableItemMapper(); SvXMLImportContext *CreateTableItemImportContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::com::sun::star::uno::Reference< @@ -210,6 +215,11 @@ public: // initialize XForms virtual void initXForms(); + + // get the document properties, but only if they actually need importing + ::com::sun::star::uno::Reference< + ::com::sun::star::document::XDocumentProperties> + GetDocumentProperties() const; }; inline const SvXMLUnitConverter& SwXMLImport::GetTwipUnitConverter() const @@ -222,6 +232,11 @@ inline const SvXMLImportItemMapper& SwXMLImport::GetTableItemMapper() const return *pTableItemMapper; } +inline SvXMLImportItemMapper& SwXMLImport::GetTableItemMapper() +{ + return *pTableItemMapper; +} + inline void SwXMLImport::SetProgressValue( sal_Int32 nValue ) { if ( bShowProgress ) diff --git a/sw/source/filter/xml/xmlimpit.cxx b/sw/source/filter/xml/xmlimpit.cxx index a3d42a2784..7860205683 100644 --- a/sw/source/filter/xml/xmlimpit.cxx +++ b/sw/source/filter/xml/xmlimpit.cxx @@ -78,11 +78,17 @@ SvXMLImportItemMapper::~SvXMLImportItemMapper() { } +void +SvXMLImportItemMapper::setMapEntries( SvXMLItemMapEntriesRef rMapEntries ) +{ + mrMapEntries = rMapEntries; +} + /** fills the given itemset with the attributes in the given list */ void SvXMLImportItemMapper::importXML( SfxItemSet& rSet, uno::Reference< xml::sax::XAttributeList > xAttrList, const SvXMLUnitConverter& rUnitConverter, - const SvXMLNamespaceMap& rNamespaceMap ) const + const SvXMLNamespaceMap& rNamespaceMap ) { sal_Int16 nAttr = xAttrList->getLength(); @@ -193,7 +199,7 @@ void SvXMLImportItemMapper::importXML( SfxItemSet& rSet, delete pUnknownItem; } - finished( rSet ); + finished(rSet, rUnitConverter); } /** this method is called for every item that has the @@ -204,7 +210,7 @@ SvXMLImportItemMapper::handleSpecialItem( const SvXMLItemMapEntry& /*rEntry*/, SfxItemSet& /*rSet*/, const OUString& /*rValue*/, const SvXMLUnitConverter& /*rUnitConverter*/, - const SvXMLNamespaceMap& /*rNamespaceMap*/ ) const + const SvXMLNamespaceMap& /*rNamespaceMap*/ ) { DBG_ERROR( "unsuported special item in xml import" ); return sal_False; @@ -216,13 +222,14 @@ sal_Bool SvXMLImportItemMapper::handleNoItem( const SvXMLItemMapEntry& /*rEntry* SfxItemSet& /*rSet*/, const OUString& /*rValue*/, const SvXMLUnitConverter& /*rUnitConverter*/, - const SvXMLNamespaceMap& /*rNamespaceMap*/ ) const + const SvXMLNamespaceMap& /*rNamespaceMap*/ ) { DBG_ERROR( "unsuported no item in xml import" ); return sal_False; } -void SvXMLImportItemMapper::finished( SfxItemSet& ) const +void +SvXMLImportItemMapper::finished(SfxItemSet &, SvXMLUnitConverter const&) const { // nothing to do here } diff --git a/sw/source/filter/xml/xmlimpit.hxx b/sw/source/filter/xml/xmlimpit.hxx index b852555b21..17dd9f4814 100644 --- a/sw/source/filter/xml/xmlimpit.hxx +++ b/sw/source/filter/xml/xmlimpit.hxx @@ -58,7 +58,7 @@ public: void importXML( SfxItemSet& rSet, ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > xAttrList, const SvXMLUnitConverter& rUnitConverter, - const SvXMLNamespaceMap& rNamespaceMap ) const; + const SvXMLNamespaceMap& rNamespaceMap ); /** this method is called for every item that has the MID_SW_FLAG_SPECIAL_ITEM_IMPORT flag set */ @@ -67,7 +67,7 @@ public: SfxItemSet& rSet, const ::rtl::OUString& rValue, const SvXMLUnitConverter& rUnitConverter, - const SvXMLNamespaceMap& rNamespaceMap ) const; + const SvXMLNamespaceMap& rNamespaceMap ); /** this method is called for every item that has the MID_SW_FLAG_NO_ITEM_IMPORT flag set */ @@ -75,13 +75,14 @@ public: SfxItemSet& rSet, const ::rtl::OUString& rValue, const SvXMLUnitConverter& rUnitConverter, - const SvXMLNamespaceMap& rNamespaceMap ) const; + const SvXMLNamespaceMap& rNamespaceMap ); /** This method is called when all attributes have benn processed. It * may be used to remove items that are incomplete */ - virtual void finished( SfxItemSet& rSet ) const; + virtual void finished(SfxItemSet & rSet, + SvXMLUnitConverter const& rUnitConverter) const; - inline void setMapEntries( SvXMLItemMapEntriesRef rMapEntries ); + virtual void setMapEntries( SvXMLItemMapEntriesRef rMapEntries ); inline SvXMLItemMapEntriesRef getMapEntries() const; @@ -94,12 +95,6 @@ public: const SvXMLUnitConverter& rUnitConverter ); }; -inline void -SvXMLImportItemMapper::setMapEntries( SvXMLItemMapEntriesRef rMapEntries ) -{ - mrMapEntries = rMapEntries; -} - inline SvXMLItemMapEntriesRef SvXMLImportItemMapper::getMapEntries() const { diff --git a/sw/source/filter/xml/xmlitem.cxx b/sw/source/filter/xml/xmlitem.cxx index 49869ccd33..4af2149488 100644 --- a/sw/source/filter/xml/xmlitem.cxx +++ b/sw/source/filter/xml/xmlitem.cxx @@ -39,15 +39,14 @@ SvXMLItemSetContext::SvXMLItemSetContext( SvXMLImport& rImp, sal_uInt16 nPrfx, const OUString& rLName, const uno::Reference< xml::sax::XAttributeList >& xAttrList, SfxItemSet& rISet, - const SvXMLImportItemMapper& rIMap, + SvXMLImportItemMapper& rIMap, const SvXMLUnitConverter& rUnitConverter ): SvXMLImportContext( rImp, nPrfx, rLName ), rItemSet( rISet ), rIMapper( rIMap ), rUnitConv( rUnitConverter ) - { - rIMapper.importXML( rItemSet, xAttrList, rUnitConv, + rIMap.importXML( rItemSet, xAttrList, rUnitConv, GetImport().GetNamespaceMap() ); } diff --git a/sw/source/filter/xml/xmlitem.hxx b/sw/source/filter/xml/xmlitem.hxx index a09fbcaff1..1847ee49c8 100644 --- a/sw/source/filter/xml/xmlitem.hxx +++ b/sw/source/filter/xml/xmlitem.hxx @@ -53,7 +53,7 @@ public: const ::rtl::OUString& rLName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList, SfxItemSet& rItemSet, - const SvXMLImportItemMapper& rIMappper, + SvXMLImportItemMapper& rIMap, const SvXMLUnitConverter& rUnitConv ); virtual ~SvXMLItemSetContext(); diff --git a/sw/source/filter/xml/xmlitemi.cxx b/sw/source/filter/xml/xmlitemi.cxx index 3a0ff6c52f..2b11661449 100644 --- a/sw/source/filter/xml/xmlitemi.cxx +++ b/sw/source/filter/xml/xmlitemi.cxx @@ -28,37 +28,35 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - - -#include <hintids.hxx> #include <rtl/ustring.hxx> + #include <rsc/rscsfx.hxx> -#include "xmlitmap.hxx" -#include "xmlimpit.hxx" -#include "xmlitem.hxx" + #include <xmloff/i18nmap.hxx> #include <xmloff/xmluconv.hxx> -#ifndef _XMLOFF_FAMILIES_HXX #include <xmloff/families.hxx> -#endif -#include <svx/unomid.hxx> +#include <xmloff/xmlnmspe.hxx> +#include <xmloff/xmltoken.hxx> + #include <editeng/boxitem.hxx> #include <editeng/fontitem.hxx> #include <editeng/tstpitem.hxx> #include <editeng/boxitem.hxx> #include <editeng/brshitem.hxx> #include <editeng/langitem.hxx> +#include <editeng/memberids.hrc> -#ifndef _XMLOFF_XMLTABI_HXX -//#include <xmloff/xmltabi.hxx> -#endif -#include "xmlbrshi.hxx" +#include <svx/unomid.hxx> + +#include <hintids.hxx> #include <paratr.hxx> #include <doc.hxx> -#ifndef _UNOMID_H #include <unomid.h> -#endif +#include "xmlbrshi.hxx" #include "xmlimp.hxx" +#include "xmlitmap.hxx" +#include "xmlimpit.hxx" +#include "xmlitem.hxx" using ::rtl::OUString; using namespace ::com::sun::star; @@ -82,32 +80,93 @@ public: SfxItemSet& rSet, const OUString& rValue, const SvXMLUnitConverter& rUnitConverter, - const SvXMLNamespaceMap& rNamespaceMap ) const; - virtual void finished( SfxItemSet& rSet ) const; + const SvXMLNamespaceMap& rNamespaceMap ); + + virtual sal_Bool + handleNoItem(SvXMLItemMapEntry const& rEntry, + SfxItemSet & rSet, + ::rtl::OUString const& rValue, + SvXMLUnitConverter const& rUnitConverter, + SvXMLNamespaceMap const& rNamespaceMap); + + virtual void finished(SfxItemSet & rSet, + SvXMLUnitConverter const& rUnitConverter) const; + + virtual void setMapEntries( SvXMLItemMapEntriesRef rMapEntries ); + +private: + void Reset(); + + ::rtl::OUString m_FoMarginValue; + enum { LEFT = 0, RIGHT = 1, TOP = 2, BOTTOM = 3 }; + bool m_bHaveMargin[4]; }; SwXMLImportTableItemMapper_Impl::SwXMLImportTableItemMapper_Impl( SvXMLItemMapEntriesRef rMapEntries ) : SvXMLImportItemMapper( rMapEntries, RES_UNKNOWNATR_CONTAINER) { + Reset(); } SwXMLImportTableItemMapper_Impl::~SwXMLImportTableItemMapper_Impl() { } +void SwXMLImportTableItemMapper_Impl::Reset() +{ + m_FoMarginValue = ::rtl::OUString(); + for (int i = 0; i < 3; ++i) + { + m_bHaveMargin[i] = false; + } +} + +void SwXMLImportTableItemMapper_Impl::setMapEntries( + SvXMLItemMapEntriesRef rMapEntries ) +{ + Reset(); + SvXMLImportItemMapper::setMapEntries(rMapEntries); +} + sal_Bool SwXMLImportTableItemMapper_Impl::handleSpecialItem( const SvXMLItemMapEntry& rEntry, SfxPoolItem& rItem, SfxItemSet& rItemSet, const OUString& rValue, const SvXMLUnitConverter& rUnitConv, - const SvXMLNamespaceMap& ) const + const SvXMLNamespaceMap& ) { sal_Bool bRet = sal_False; sal_uInt16 nMemberId = static_cast< sal_Int16 >(rEntry.nMemberId & MID_SW_FLAG_MASK); switch( rItem.Which() ) { + case RES_LR_SPACE: + switch (nMemberId) + { + case MID_L_MARGIN: + m_bHaveMargin[LEFT] = true; + break; + case MID_R_MARGIN: + m_bHaveMargin[RIGHT] = true; + break; + } + bRet = SvXMLImportItemMapper::PutXMLValue( + rItem, rValue, nMemberId, rUnitConv); + break; + case RES_UL_SPACE: + switch (nMemberId) + { + case MID_UP_MARGIN: + m_bHaveMargin[TOP] = true; + break; + case MID_LO_MARGIN: + m_bHaveMargin[BOTTOM] = true; + break; + } + bRet = SvXMLImportItemMapper::PutXMLValue( + rItem, rValue, nMemberId, rUnitConv); + break; case RES_FRM_SIZE: switch( nMemberId ) { @@ -125,8 +184,72 @@ sal_Bool SwXMLImportTableItemMapper_Impl::handleSpecialItem( return bRet; } -void SwXMLImportTableItemMapper_Impl::finished( SfxItemSet& /*rSet*/ ) const + +sal_Bool SwXMLImportTableItemMapper_Impl::handleNoItem( + SvXMLItemMapEntry const& rEntry, + SfxItemSet & rSet, + ::rtl::OUString const& rValue, + SvXMLUnitConverter const& rUnitConverter, + SvXMLNamespaceMap const& rNamespaceMap) +{ + if ((XML_NAMESPACE_FO == rEntry.nNameSpace) && + (xmloff::token::XML_MARGIN == rEntry.eLocalName)) + { + m_FoMarginValue = rValue; + return true; + } + else + { + return SvXMLImportItemMapper::handleNoItem( + rEntry, rSet, rValue, rUnitConverter, rNamespaceMap); + } +} + +void SwXMLImportTableItemMapper_Impl::finished( + SfxItemSet & rSet, SvXMLUnitConverter const& rUnitConverter) const { + if (m_FoMarginValue.getLength()) + { + sal_uInt16 const Ids[4][2] = { + { RES_LR_SPACE, MID_L_MARGIN }, + { RES_LR_SPACE, MID_R_MARGIN }, + { RES_UL_SPACE, MID_UP_MARGIN }, + { RES_UL_SPACE, MID_LO_MARGIN }, + }; + for (int i = 0; i < 4; ++i) + { + if (m_bHaveMargin[i]) + { + continue; // already read fo:margin-top etc. + } + // first get item from itemset + SfxPoolItem const* pItem = 0; + SfxItemState eState = + rSet.GetItemState(Ids[i][0], sal_True, &pItem); + + // if not set, try the pool + if ((SFX_ITEM_SET != eState) && (SFX_WHICH_MAX > Ids[i][0])) + { + pItem = &rSet.GetPool()->GetDefaultItem(Ids[i][0]); + } + + // do we have an item? + if (eState >= SFX_ITEM_DEFAULT && pItem) + { + SfxPoolItem *const pNewItem = pItem->Clone(); + bool const bPut = PutXMLValue( + *pNewItem, m_FoMarginValue, Ids[i][1], rUnitConverter); + if (bPut) + { + rSet.Put(*pNewItem); + } + } + else + { + OSL_ENSURE(false, "could not get item"); + } + } + } } // --------------------------------------------------------------------- @@ -142,7 +265,7 @@ public: const OUString& rLName, const Reference< xml::sax::XAttributeList > & xAttrList, SfxItemSet& rItemSet, - const SvXMLImportItemMapper& rIMapper, + SvXMLImportItemMapper & rIMapper, const SvXMLUnitConverter& rUnitConv ); virtual ~SwXMLItemSetContext_Impl(); @@ -159,7 +282,7 @@ SwXMLItemSetContext_Impl::SwXMLItemSetContext_Impl( const OUString& rLName, const Reference< xml::sax::XAttributeList > & xAttrList, SfxItemSet& _rItemSet, - const SvXMLImportItemMapper& _rIMapper, + SvXMLImportItemMapper & _rIMapper, const SvXMLUnitConverter& _rUnitConv ) : SvXMLItemSetContext( rImport, nPrfx, rLName, xAttrList, _rItemSet, _rIMapper, _rUnitConv ) diff --git a/sw/source/filter/xml/xmlitemm.cxx b/sw/source/filter/xml/xmlitemm.cxx index e82ef86449..70bf72a32b 100644 --- a/sw/source/filter/xml/xmlitemm.cxx +++ b/sw/source/filter/xml/xmlitemm.cxx @@ -48,6 +48,8 @@ using namespace ::xmloff::token; { XML_NAMESPACE_##p, XML_##l, w, MID_SW_FLAG_SPECIAL_ITEM_IMPORT|m } #define M_E_SE( p, l, w, m ) \ { XML_NAMESPACE_##p, XML_##l, w, MID_SW_FLAG_SPECIAL_ITEM_EXPORT|m } +#define M_E_SIE( p, l, w, m ) \ + { XML_NAMESPACE_##p, XML_##l, w, MID_SW_FLAG_SPECIAL_ITEM_EXPORT|MID_SW_FLAG_SPECIAL_ITEM_IMPORT|m } #define M_END { 0, XML_TOKEN_INVALID, 0, 0 } @@ -61,11 +63,12 @@ SvXMLItemMapEntry aXMLTableItemMap[] = // RES_PAPER_BIN // not required // TODO: RES_LR_SPACE - M_E_SE( FO, MARGIN_LEFT, RES_LR_SPACE, MID_L_MARGIN ), - M_E_SE( FO, MARGIN_RIGHT, RES_LR_SPACE, MID_R_MARGIN ), + M_E_SE( FO, MARGIN, -1, MID_SW_FLAG_NO_ITEM_IMPORT), + M_E_SIE( FO, MARGIN_LEFT, RES_LR_SPACE, MID_L_MARGIN ), + M_E_SIE( FO, MARGIN_RIGHT, RES_LR_SPACE, MID_R_MARGIN ), // RES_UL_SPACE - MAP_ENTRY( FO, MARGIN_TOP, RES_UL_SPACE, MID_UP_MARGIN ), - MAP_ENTRY( FO, MARGIN_BOTTOM, RES_UL_SPACE, MID_LO_MARGIN ), + M_E_SI( FO, MARGIN_TOP, RES_UL_SPACE, MID_UP_MARGIN ), + M_E_SI( FO, MARGIN_BOTTOM, RES_UL_SPACE, MID_LO_MARGIN ), // RES_PAGEDESC MAP_ENTRY( STYLE, PAGE_NUMBER, RES_PAGEDESC, MID_PAGEDESC_PAGENUMOFFSET), // RES_BREAK diff --git a/sw/source/filter/xml/xmlmeta.cxx b/sw/source/filter/xml/xmlmeta.cxx index 225ab05390..351006c08d 100644 --- a/sw/source/filter/xml/xmlmeta.cxx +++ b/sw/source/filter/xml/xmlmeta.cxx @@ -57,22 +57,34 @@ using namespace ::xmloff::token; // --------------------------------------------------------------------- +uno::Reference<document::XDocumentProperties> +SwXMLImport::GetDocumentProperties() const +{ + if (IsOrganizerMode() || IsStylesOnlyMode() || + IsBlockMode() || IsInsertMode()) + { + return 0; + } + uno::Reference<document::XDocumentPropertiesSupplier> const xDPS( + GetModel(), UNO_QUERY_THROW); + return xDPS->getDocumentProperties(); +} + SvXMLImportContext *SwXMLImport::CreateMetaContext( const OUString& rLocalName ) { SvXMLImportContext *pContext = 0; - if( !(IsStylesOnlyMode() || IsInsertMode()) ) + if (getImportFlags() & IMPORT_META) { - uno::Reference<xml::sax::XDocumentHandler> xDocBuilder( + uno::Reference<xml::sax::XDocumentHandler> const xDocBuilder( mxServiceFactory->createInstance(::rtl::OUString::createFromAscii( "com.sun.star.xml.dom.SAXDocumentBuilder")), - uno::UNO_QUERY_THROW); - uno::Reference<document::XDocumentPropertiesSupplier> xDPS( - GetModel(), UNO_QUERY_THROW); + uno::UNO_QUERY_THROW); + uno::Reference<document::XDocumentProperties> const xDocProps( + GetDocumentProperties()); pContext = new SvXMLMetaDocumentContext(*this, - XML_NAMESPACE_OFFICE, rLocalName, - xDPS->getDocumentProperties(), xDocBuilder); + XML_NAMESPACE_OFFICE, rLocalName, xDocProps, xDocBuilder); } if( !pContext ) diff --git a/sw/source/ui/app/docsh2.cxx b/sw/source/ui/app/docsh2.cxx index 3783458f62..1c2d3d58bc 100644..100755 --- a/sw/source/ui/app/docsh2.cxx +++ b/sw/source/ui/app/docsh2.cxx @@ -835,7 +835,11 @@ void SwDocShell::Execute(SfxRequest& rReq) const SfxFilter* pFlt = aIter.First(); while( pFlt ) { - if( pFlt && pFlt->IsAllowedAsTemplate() ) + // --> OD #i117339# +// if( pFlt && pFlt->IsAllowedAsTemplate() ) + if( pFlt && pFlt->IsAllowedAsTemplate() && + ( pFlt->GetUserData().EqualsAscii("CXML") || + pFlt->GetUserData().EqualsAscii("CXMLV") ) ) { const String sWild = ((WildCard&)pFlt->GetWildcard()).GetWildCard(); xFltMgr->appendFilter( pFlt->GetUIName(), sWild ); @@ -1775,10 +1779,6 @@ sal_uLong SwDocShell::LoadStylesFromFile( const String& rURL, INetURLObject aURLObj( rURL ); String sURL( aURLObj.GetMainURL( INetURLObject::NO_DECODE ) ); - SwRead pRead = 0; - SwReader* pReader = 0; - SwPaM* pPam = 0; - // Filter bestimmen: // const SfxFilter* pFlt = SwIoSystem::GetFileFilter( rURL, aEmptyStr ); String sFactory(String::CreateFromAscii(SwDocShell::Factory().GetShortName())); @@ -1794,10 +1794,41 @@ sal_uLong SwDocShell::LoadStylesFromFile( const String& rURL, SfxFilterMatcher aWebMatcher( sWebFactory ); aWebMatcher.DetectFilter( aMed, &pFlt, sal_False, sal_False ); } - if( aMed.IsStorage() ) + // --> OD #i117339# - trigger import only for own formats +// if( aMed.IsStorage() ) + bool bImport( false ); + { + if ( aMed.IsStorage() ) + { + // As <SfxMedium.GetFilter().IsOwnFormat() resp. IsOwnTemplateFormat() + // does not work correct (e.g., MS Word 2007 XML Template), + // use workaround provided by MAV. + uno::Reference< embed::XStorage > xStorage = aMed.GetStorage(); + if ( xStorage.is() ) + { + // use <try-catch> on retrieving <MediaType> in order to check, + // if the storage is one of our own ones. + try + { + uno::Reference< beans::XPropertySet > xProps( xStorage, uno::UNO_QUERY_THROW ); + const ::rtl::OUString aMediaTypePropName( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ); + xProps->getPropertyValue( aMediaTypePropName ); + bImport = true; + } + catch( const uno::Exception& ) + { + bImport = false; + } + } + } + } + if ( bImport ) + // <-- { DBG_ASSERT((pFlt ? pFlt->GetVersion() : 0) >= SOFFICE_FILEFORMAT_60, "which file version?"); - pRead = ReadXML; + SwRead pRead = ReadXML; + SwReader* pReader = 0; + SwPaM* pPam = 0; // the SW3IO - Reader need the pam/wrtshell, because only then he // insert the styles! if( bUnoCall ) @@ -1807,19 +1838,10 @@ sal_uLong SwDocShell::LoadStylesFromFile( const String& rURL, pReader = new SwReader( aMed, rURL, *pPam ); } else + { pReader = new SwReader( aMed, rURL, *pWrtShell->GetCrsr() ); - } - else if( pFlt ) - { -// if( pFlt->GetUserData().EqualsAscii( FILTER_SWG ) || -// pFlt->GetUserData().EqualsAscii( FILTER_SWGV )) -// pRead = ReadSwg; - pReader = new SwReader( aMed, rURL, pDoc ); - } + } - ASSERT( pRead, "no reader found" ); - if( pRead ) - { pRead->GetReaderOpt().SetTxtFmts( rOpt.IsTxtFmts() ); pRead->GetReaderOpt().SetFrmFmts( rOpt.IsFrmFmts() ); pRead->GetReaderOpt().SetPageDescs( rOpt.IsPageDescs() ); @@ -1837,9 +1859,10 @@ sal_uLong SwDocShell::LoadStylesFromFile( const String& rURL, nErr = pReader->Read( *pRead ); pWrtShell->EndAllAction(); } + delete pPam; + delete pReader; } - delete pPam; - delete pReader; + return nErr; } diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx index 7b303d4850..96f1562bc3 100644 --- a/sw/source/ui/dbui/dbmgr.cxx +++ b/sw/source/ui/dbui/dbmgr.cxx @@ -2598,7 +2598,13 @@ void SwNewDBMgr::ExecuteFormLetter( SwWrtShell& rSh, SwMergeDescriptor aMergeDesc( pImpl->pMergeDialog->GetMergeType(), pView->GetWrtShell(), aDescriptor ); aMergeDesc.sSaveToFilter = pImpl->pMergeDialog->GetSaveFilter(); - aMergeDesc.bCreateSingleFile= true; + aMergeDesc.bCreateSingleFile = !pImpl->pMergeDialog->IsSaveIndividualDocs(); + if( !aMergeDesc.bCreateSingleFile && pImpl->pMergeDialog->IsGenerateFromDataBase() ) + { + aMergeDesc.sAddressFromColumn = pImpl->pMergeDialog->GetColumnName(); + aMergeDesc.sSubject = pImpl->pMergeDialog->GetPath(); + } + MergeNew(aMergeDesc); pWorkDoc->SetNewDBMgr( pWorkDBMgr ); diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index fa885838d2..da40e4a6eb 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -526,6 +526,23 @@ uno::Reference< sdbc::XResultSet> AbstractMailMergeDlg_Impl::GetResultSet() cons { return pDlg->GetResultSet(); } +bool AbstractMailMergeDlg_Impl::IsSaveIndividualDocs() const +{ + return pDlg->IsSaveIndividualDocs(); +} +bool AbstractMailMergeDlg_Impl::IsGenerateFromDataBase() const +{ + return pDlg->IsGenerateFromDataBase(); +} +String AbstractMailMergeDlg_Impl::GetColumnName() const +{ + return pDlg->GetColumnName(); +} +String AbstractMailMergeDlg_Impl::GetPath() const +{ + return pDlg->GetPath(); +} + // AbstractMailMergeDlg_Impl end // AbstractMailMergeCreateFromDlg_Impl begin sal_Bool AbstractMailMergeCreateFromDlg_Impl::IsThisDocument() const diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index e2fe53ae36..db12ae9eca 100644 --- a/sw/source/ui/dialog/swdlgfact.hxx +++ b/sw/source/ui/dialog/swdlgfact.hxx @@ -332,6 +332,10 @@ class AbstractMailMergeDlg_Impl : public AbstractMailMergeDlg virtual const ::rtl::OUString& GetSaveFilter() const; virtual const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > GetSelection() const ; virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> GetResultSet() const; + virtual bool IsSaveIndividualDocs() const; + virtual bool IsGenerateFromDataBase() const; + virtual String GetColumnName() const; + virtual String GetPath() const; }; //for SwMailMergeDlg end //for SwMailMergeCreateFromDlg begin diff --git a/sw/source/ui/docvw/AnnotationWin.cxx b/sw/source/ui/docvw/AnnotationWin.cxx index 4675805e52..7419ee060e 100644 --- a/sw/source/ui/docvw/AnnotationWin.cxx +++ b/sw/source/ui/docvw/AnnotationWin.cxx @@ -111,15 +111,23 @@ void SwAnnotationWin::UpdateData() { if ( Engine()->IsModified() ) { - SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld(); - SwPosition aPosition( pTxtFld->GetTxtNode() ); - aPosition.nContent = *pTxtFld->GetStart(); - SwField* pOldField = mpFld->Copy(); + IDocumentUndoRedo & rUndoRedo( + DocView().GetDocShell()->GetDoc()->GetIDocumentUndoRedo()); + ::std::auto_ptr<SwField> pOldField; + if (rUndoRedo.DoesUndo()) + { + pOldField.reset(mpFld->Copy()); + } mpFld->SetPar2(Engine()->GetEditEngine().GetText()); mpFld->SetTextObject(Engine()->CreateParaObject()); - DocView().GetDocShell()->GetDoc()->GetIDocumentUndoRedo().AppendUndo( - new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true)); - delete pOldField; + if (rUndoRedo.DoesUndo()) + { + SwTxtFld *const pTxtFld = mpFmtFld->GetTxtFld(); + SwPosition aPosition( pTxtFld->GetTxtNode() ); + aPosition.nContent = *pTxtFld->GetStart(); + rUndoRedo.AppendUndo( + new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true)); + } // so we get a new layout of notes (anchor position is still the same and we would otherwise not get one) Mgr().SetLayout(); // #i98686# if we have several views, all notes should update their text @@ -242,15 +250,23 @@ void SwAnnotationWin::InitAnswer(OutlinerParaObject* pText) // lets insert an undo step so the initial text can be easily deleted // but do not use UpdateData() directly, would set modified state again and reentrance into Mgr Engine()->SetModifyHdl( Link() ); - SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld(); - SwPosition aPosition( pTxtFld->GetTxtNode() ); - aPosition.nContent = *pTxtFld->GetStart(); - SwField* pOldField = mpFld->Copy(); + IDocumentUndoRedo & rUndoRedo( + DocView().GetDocShell()->GetDoc()->GetIDocumentUndoRedo()); + ::std::auto_ptr<SwField> pOldField; + if (rUndoRedo.DoesUndo()) + { + pOldField.reset(mpFld->Copy()); + } mpFld->SetPar2(Engine()->GetEditEngine().GetText()); mpFld->SetTextObject(Engine()->CreateParaObject()); - DocView().GetDocShell()->GetDoc()->GetIDocumentUndoRedo().AppendUndo( - new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true)); - delete pOldField; + if (rUndoRedo.DoesUndo()) + { + SwTxtFld *const pTxtFld = mpFmtFld->GetTxtFld(); + SwPosition aPosition( pTxtFld->GetTxtNode() ); + aPosition.nContent = *pTxtFld->GetStart(); + rUndoRedo.AppendUndo( + new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true)); + } Engine()->SetModifyHdl( LINK( this, SwAnnotationWin, ModifyHdl ) ); Engine()->ClearModifyFlag(); Engine()->GetUndoManager().Clear(); diff --git a/sw/source/ui/inc/mailmrge.hxx b/sw/source/ui/inc/mailmrge.hxx index cb5f51d788..d762660e46 100644 --- a/sw/source/ui/inc/mailmrge.hxx +++ b/sw/source/ui/inc/mailmrge.hxx @@ -156,6 +156,12 @@ public: ~SwMailMergeDlg(); inline sal_uInt16 GetMergeType() { return nMergeType; } + + bool IsSaveIndividualDocs() const { return aSaveIndividualRB.IsChecked(); } + bool IsGenerateFromDataBase() const { return aGenerateFromDataBaseCB.IsChecked(); } + String GetColumnName() const { return aColumnLB.GetSelectEntry();} + String GetPath() const { return aPathED.GetText();} + const ::rtl::OUString& GetSaveFilter() const {return m_sSaveFilter;} inline const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > GetSelection() const { return m_aSelection; } ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> GetResultSet() const; diff --git a/sw/source/ui/index/idxmrk.src b/sw/source/ui/index/idxmrk.src index e0a1a4df9c..fc38d7c6d2 100644 --- a/sw/source/ui/index/idxmrk.src +++ b/sw/source/ui/index/idxmrk.src @@ -287,6 +287,14 @@ ModalDialog DLG_EDIT_IDXMARK #define COL_BUTTONS_2 (COL_BUTTONS+26) #define WINDOW_HEIGHT 118 IDX_DIALOG_WINDOW + #undef IDX_WIN_WIDTH + #undef GB_HEIGHT + #undef DCB_INDEX_WIDTH + #undef PHONETIC_HIDDEN + #undef LIST_WIDTH + #undef COL_BUTTONS + #undef COL_BUTTONS_2 + #undef WINDOW_HEIGHT }; ModalDialog DLG_EDIT_IDXMARK_CJK { @@ -306,6 +314,14 @@ ModalDialog DLG_EDIT_IDXMARK_CJK #define COL_BUTTONS_2 (COL_BUTTONS+26) #define WINDOW_HEIGHT 118 IDX_DIALOG_WINDOW + #undef IDX_WIN_WIDTH + #undef GB_HEIGHT + #undef DCB_INDEX_WIDTH + #undef PHONETIC_HIDDEN + #undef LIST_WIDTH + #undef COL_BUTTONS + #undef COL_BUTTONS_2 + #undef WINDOW_HEIGHT }; ModelessDialog DLG_INSIDXMARK { @@ -328,6 +344,14 @@ ModelessDialog DLG_INSIDXMARK #define COL_BUTTONS_2 (COL_BUTTONS+26) #define WINDOW_HEIGHT 138 IDX_DIALOG_WINDOW + #undef IDX_WIN_WIDTH + #undef GB_HEIGHT + #undef DCB_INDEX_WIDTH + #undef PHONETIC_HIDDEN + #undef LIST_WIDTH + #undef COL_BUTTONS + #undef COL_BUTTONS_2 + #undef WINDOW_HEIGHT }; ModelessDialog DLG_INSIDXMARK_CJK { @@ -349,6 +373,14 @@ ModelessDialog DLG_INSIDXMARK_CJK #define COL_BUTTONS_2 (COL_BUTTONS+26) #define WINDOW_HEIGHT 138 IDX_DIALOG_WINDOW + #undef IDX_WIN_WIDTH + #undef GB_HEIGHT + #undef DCB_INDEX_WIDTH + #undef PHONETIC_HIDDEN + #undef LIST_WIDTH + #undef COL_BUTTONS + #undef COL_BUTTONS_2 + #undef WINDOW_HEIGHT }; ModalDialog DLG_NEW_USER_IDX { @@ -529,6 +561,7 @@ ModalDialog DLG_EDIT_AUTHMARK Size = MAP_APPFONT ( 218 , 118 ) ; #define RADIO_BUTTON_HEIGHT 0 AUTH_DIALOG_WINDOW + #undef RADIO_BUTTON_HEIGHT }; ModelessDialog DLG_INSAUTHMARK { @@ -543,6 +576,7 @@ ModelessDialog DLG_INSAUTHMARK Size = MAP_APPFONT ( 218 , 118 + RADIO_BUTTON_HEIGHT) ; // Moveable = TRUE ; AUTH_DIALOG_WINDOW + #undef RADIO_BUTTON_HEIGHT }; ModalDialog DLG_CREATE_AUTH_ENTRY { diff --git a/sw/source/ui/ribbar/inputwin.cxx b/sw/source/ui/ribbar/inputwin.cxx index 0016a4ac45..934bde75cd 100755 --- a/sw/source/ui/ribbar/inputwin.cxx +++ b/sw/source/ui/ribbar/inputwin.cxx @@ -165,6 +165,7 @@ void SwInputWindow::CleanupUglyHackWithUndo() { SW_MOD()->GetUndoOptions().SetUndoCount(0); } + m_bResetUndo = false; // #i117122# once is enough :) } } diff --git a/sw/source/ui/shells/grfsh.cxx b/sw/source/ui/shells/grfsh.cxx index 079bf94bbc..727b0fd362 100644 --- a/sw/source/ui/shells/grfsh.cxx +++ b/sw/source/ui/shells/grfsh.cxx @@ -519,6 +519,9 @@ void SwGrfShell::GetAttrState(SfxItemSet &rSet) rSh.GetCurAttr( aCoreSet ); sal_Bool bParentCntProt = 0 != rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ); sal_Bool bIsGrfCntnt = CNT_GRF == GetShell().GetCntType(); +// const GraphicObject* pGrfObj = ( bIsGrfCntnt ? rSh.GetGraphicObj() : NULL ); +// sal_Bool bIsRenderGraphicGrfCntnt = ( pGrfObj && pGrfObj->IsRenderGraphic() ); + // --> OD 2006-11-03 #i59688# // sal_Bool bSwappedOut = rSh.IsGrfSwapOut( sal_True ); // sal_Bool bBitmapType = !bSwappedOut && GRAPHIC_BITMAP == rSh.GetGraphicType(); @@ -613,11 +616,11 @@ void SwGrfShell::GetAttrState(SfxItemSet &rSet) if( !bParentCntProt ) { // --> OD 2005-02-09 #119353# - robust - const GraphicObject* pGrfObj = rSh.GetGraphicObj(); - if ( pGrfObj ) + const GraphicObject* pGrafObj = rSh.GetGraphicObj(); + if ( pGrafObj ) { - if( pGrfObj->IsAnimated() || - GRAPHIC_GDIMETAFILE == pGrfObj->GetType() ) + if( pGrafObj->IsAnimated() || + GRAPHIC_GDIMETAFILE == pGrafObj->GetType() ) bDisable = sal_True; else rSet.Put( SfxUInt16Item( nWhich, ((SwTransparencyGrf&) @@ -701,7 +704,3 @@ SwGrfShell::SwGrfShell(SwView &_rView) : SetName(String::CreateFromAscii("Graphic")); SetHelpId(SW_GRFSHELL); } - - - - diff --git a/sw/source/ui/vba/vbaapplication.cxx b/sw/source/ui/vba/vbaapplication.cxx index fd815b2b04..ad02fda392 100644 --- a/sw/source/ui/vba/vbaapplication.cxx +++ b/sw/source/ui/vba/vbaapplication.cxx @@ -97,7 +97,9 @@ uno::Reference< word::XWindow > SAL_CALL SwVbaApplication::getActiveWindow() throw (uno::RuntimeException) { // #FIXME sofar can't determine Parent - return new SwVbaWindow( uno::Reference< XHelperInterface >(), mxContext, getCurrentDocument() ); + uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_SET_THROW ); + uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_SET_THROW ); + return new SwVbaWindow( uno::Reference< XHelperInterface >(), mxContext, xModel, xController ); } uno::Reference<word::XSystem > SAL_CALL diff --git a/sw/source/ui/vba/vbaeventshelper.cxx b/sw/source/ui/vba/vbaeventshelper.cxx index b2270b009c..197f02911e 100755 --- a/sw/source/ui/vba/vbaeventshelper.cxx +++ b/sw/source/ui/vba/vbaeventshelper.cxx @@ -26,6 +26,7 @@ ************************************************************************/ #include "vbaeventshelper.hxx" +#include <com/sun/star/script/ModuleType.hpp> #include <com/sun/star/script/vba/VBAEventId.hpp> #include <vbahelper/helperdecl.hxx> @@ -38,12 +39,13 @@ using namespace ::ooo::vba; SwVbaEventsHelper::SwVbaEventsHelper( uno::Sequence< css::uno::Any > const& aArgs, uno::Reference< uno::XComponentContext > const& xContext ) : VbaEventsHelperBase( aArgs, xContext ) { - registerEventHandler( DOCUMENT_NEW, "Document_New", EVENTHANDLER_DOCUMENT ); - registerEventHandler( AUTO_NEW, "AutoNew", EVENTHANDLER_GLOBAL ); - registerEventHandler( DOCUMENT_OPEN, "Document_Open", EVENTHANDLER_DOCUMENT ); - registerEventHandler( AUTO_OPEN, "AutoOpen", EVENTHANDLER_GLOBAL ); - registerEventHandler( DOCUMENT_CLOSE, "Document_Close", EVENTHANDLER_DOCUMENT ); - registerEventHandler( AUTO_CLOSE, "AutoClose", EVENTHANDLER_GLOBAL ); + using namespace ::com::sun::star::script::ModuleType; + registerEventHandler( DOCUMENT_NEW, DOCUMENT, "Document_New" ); + registerEventHandler( AUTO_NEW, NORMAL, "AutoNew" ); + registerEventHandler( DOCUMENT_OPEN, DOCUMENT, "Document_Open" ); + registerEventHandler( AUTO_OPEN, NORMAL, "AutoOpen" ); + registerEventHandler( DOCUMENT_CLOSE, DOCUMENT, "Document_Close" ); + registerEventHandler( AUTO_CLOSE, NORMAL, "AutoClose" ); } SwVbaEventsHelper::~SwVbaEventsHelper() @@ -76,7 +78,7 @@ uno::Sequence< uno::Any > SwVbaEventsHelper::implBuildArgumentList( const EventH } void SwVbaEventsHelper::implPostProcessEvent( EventQueue& /*rEventQueue*/, - const EventHandlerInfo& /*rInfo*/, bool /*bSuccess*/, bool /*bCancel*/ ) throw (uno::RuntimeException) + const EventHandlerInfo& /*rInfo*/, bool /*bCancel*/ ) throw (uno::RuntimeException) { // nothing to do after any event } diff --git a/sw/source/ui/vba/vbaeventshelper.hxx b/sw/source/ui/vba/vbaeventshelper.hxx index 7f951bdaa4..044eaa3388 100755 --- a/sw/source/ui/vba/vbaeventshelper.hxx +++ b/sw/source/ui/vba/vbaeventshelper.hxx @@ -43,7 +43,7 @@ public: protected: virtual bool implPrepareEvent( EventQueue& rEventQueue, const EventHandlerInfo& rInfo, const css::uno::Sequence< css::uno::Any >& rArgs ) throw (css::uno::RuntimeException); virtual css::uno::Sequence< css::uno::Any > implBuildArgumentList( const EventHandlerInfo& rInfo, const css::uno::Sequence< css::uno::Any >& rArgs ) throw (css::lang::IllegalArgumentException); - virtual void implPostProcessEvent( EventQueue& rEventQueue, const EventHandlerInfo& rInfo, bool bSuccess, bool bCancel ) throw (css::uno::RuntimeException); + virtual void implPostProcessEvent( EventQueue& rEventQueue, const EventHandlerInfo& rInfo, bool bCancel ) throw (css::uno::RuntimeException); virtual ::rtl::OUString implGetDocumentModuleName( const EventHandlerInfo& rInfo, const css::uno::Sequence< css::uno::Any >& rArgs ) const throw (css::lang::IllegalArgumentException); }; diff --git a/sw/source/ui/vba/vbawindow.cxx b/sw/source/ui/vba/vbawindow.cxx index dc5913aaa1..4f168277fd 100644 --- a/sw/source/ui/vba/vbawindow.cxx +++ b/sw/source/ui/vba/vbawindow.cxx @@ -35,7 +35,12 @@ using namespace ::com::sun::star; using namespace ::ooo::vba; -SwVbaWindow::SwVbaWindow( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : WindowImpl_BASE( xParent, xContext, xModel ) +SwVbaWindow::SwVbaWindow( + const uno::Reference< XHelperInterface >& xParent, + const uno::Reference< uno::XComponentContext >& xContext, + const uno::Reference< frame::XModel >& xModel, + const uno::Reference< frame::XController >& xController ) throw (uno::RuntimeException) : + WindowImpl_BASE( xParent, xContext, xModel, xController ) { } diff --git a/sw/source/ui/vba/vbawindow.hxx b/sw/source/ui/vba/vbawindow.hxx index 1ef1ff9141..f52b7f6326 100644 --- a/sw/source/ui/vba/vbawindow.hxx +++ b/sw/source/ui/vba/vbawindow.hxx @@ -38,8 +38,12 @@ typedef cppu::ImplInheritanceHelper1< VbaWindowBase, ov::word::XWindow > WindowI class SwVbaWindow : public WindowImpl_BASE { public: - SwVbaWindow( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::frame::XModel >& xModel ); - + SwVbaWindow( + const css::uno::Reference< ov::XHelperInterface >& xParent, + const css::uno::Reference< css::uno::XComponentContext >& xContext, + const css::uno::Reference< css::frame::XModel >& xModel, + const css::uno::Reference< css::frame::XController >& xController ) + throw (css::uno::RuntimeException); // Attributes virtual css::uno::Any SAL_CALL getView() throw (css::uno::RuntimeException); |