diff options
author | Jan Holesovsky <kendy@suse.cz> | 2011-04-22 15:10:19 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2011-04-22 15:10:19 +0200 |
commit | a093a28ffe7cae74fb731e84dd3de09102763303 (patch) | |
tree | 8ce5586e27a76180d800c09f8b60d5cce3d1c140 | |
parent | 8dc7fcfb5e5a8de2411d2bb29f450cabc3690859 (diff) | |
parent | 99796d2482c2931a1023b8230a3f6b18d1f48ebf (diff) |
Merge commit 'ooo/DEV300_m106' into libreoffice-3-4
Conflicts:
sw/source/core/docnode/ndnotxt.cxx
sw/source/core/inc/viewimp.hxx
sw/source/core/layout/fly.cxx
sw/source/core/layout/paintfrm.cxx
sw/source/filter/ww8/WW8TableInfo.cxx
sw/source/filter/ww8/wrtw8nds.cxx
sw/source/filter/ww8/wrtww8.cxx
sw/source/filter/ww8/wrtww8.hxx
sw/source/filter/ww8/ww8atr.cxx
sw/source/filter/xml/xmlitemi.cxx
sw/source/filter/xml/xmlmeta.cxx
sw/source/ui/app/docsh2.cxx
sw/source/ui/dialog/swdlgfact.cxx
sw/source/ui/shells/grfsh.cxx
61 files changed, 883 insertions, 331 deletions
diff --git a/sw/JunitTest_sw_complex.mk b/sw/JunitTest_sw_complex.mk index 84356e4c9f6f..0d59a5631a4d 100755 --- a/sw/JunitTest_sw_complex.mk +++ b/sw/JunitTest_sw_complex.mk @@ -65,7 +65,11 @@ $(eval $(call gb_JunitTest_add_classes,sw_complex,\ # fd#35657 test disabled - reenable if fixed # 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 c5f8f231451c..cda15ed0eb56 100644 --- a/sw/inc/swabstdlg.hxx +++ b/sw/inc/swabstdlg.hxx @@ -163,6 +163,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 30039539de96..ed52818918cd 100644 --- a/sw/source/core/crsr/bookmrk.cxx +++ b/sw/source/core/crsr/bookmrk.cxx @@ -112,7 +112,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 d0b1a455f73a..79fec36c98dc 100644 --- a/sw/source/core/crsr/findattr.cxx +++ b/sw/source/core/crsr/findattr.cxx @@ -312,15 +312,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 // -------------------------------------------------------------- @@ -471,9 +489,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 8f59503b2455..eb5e9a9b08ed 100644 --- a/sw/source/core/doc/doccorr.cxx +++ b/sw/source/core/doc/doccorr.cxx @@ -211,10 +211,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 8d9849f547b8..76eb486373fc 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -2482,8 +2482,6 @@ SetRedlineMode( eOld ); rPam.GetMark()->nNode = aPtNd; rPam.GetMark()->nContent.Assign( aPtNd.GetNode().GetCntntNode(), nPtCnt ); - if( bJoinTxt ) - rPam.Move( fnMoveBackward ); if( pUndoRpl ) { @@ -2605,8 +2603,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 bc6c1e6f3e16..8aabcf4b07e6 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -462,45 +462,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); } } @@ -514,29 +483,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 c244e14267c4..fd91c57f07a6 100644..100755 --- a/sw/source/core/docnode/ndnotxt.cxx +++ b/sw/source/core/docnode/ndnotxt.cxx @@ -135,7 +135,30 @@ const PolyPolygon *SwNoTxtNode::HasContour() const const MapMode aContourMap( bPixelGrf ? MAP_PIXEL : MAP_100TH_MM ); if( bPixelGrf ? !bPixelContour : aGrfMap != aContourMap ) { - OSL_ENSURE( !bPixelGrf || aGrfMap == aContourMap, + // #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(); + } + } + } + OSL_ASSERT( !bPixelGrf || aGrfMap == aContourMap, "scale factor for pixel unsupported" ); OutputDevice* pOutDev = (bPixelGrf || bPixelContour) ? Application::GetDefaultDevice() @@ -152,7 +175,15 @@ const PolyPolygon *SwNoTxtNode::HasContour() const rPoly[i] = pOutDev->LogicToPixel( rPoly[i], aContourMap ); else if( bPixelContour ) + { rPoly[i] = pOutDev->PixelToLogic( rPoly[i], aGrfMap ); + // #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, @@ -202,7 +233,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/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx index a350cc1772e1..e48b43e749e5 100644 --- a/sw/source/core/draw/dflyobj.cxx +++ b/sw/source/core/draw/dflyobj.cxx @@ -456,6 +456,52 @@ SwFrmFmt *SwVirtFlyDrawObj::GetFmt() |* *************************************************************************/ +// --> OD #i102707# +namespace +{ + class RestoreMapMode + { + public: + explicit RestoreMapMode( ViewShell* pViewShell ) + : mbMapModeRestored( false ) + , mpOutDev( pViewShell->GetOut() ) + { + if ( pViewShell->getPrePostMapMode() != mpOutDev->GetMapMode() ) + { + mpOutDev->Push(PUSH_MAPMODE); + + GDIMetaFile* pMetaFile = mpOutDev->GetConnectMetaFile(); + if ( pMetaFile && + pMetaFile->IsRecord() && !pMetaFile->IsPause() ) + { + ASSERT( false, + "MapMode restoration during meta file creation is somehow suspect - using <SetRelativeMapMode(..)>, but not sure, if correct." ) + mpOutDev->SetRelativeMapMode( pViewShell->getPrePostMapMode() ); + } + else + { + mpOutDev->SetMapMode( pViewShell->getPrePostMapMode() ); + } + + mbMapModeRestored = true; + } + }; + + ~RestoreMapMode() + { + if ( mbMapModeRestored ) + { + mpOutDev->Pop(); + } + }; + + private: + bool mbMapModeRestored; + OutputDevice* mpOutDev; + }; +} +// <-- + void SwVirtFlyDrawObj::wrap_DoPaintObject() const { ViewShell* pShell = pFlyFrm->getRootFrm()->GetCurrShell(); @@ -465,31 +511,29 @@ void SwVirtFlyDrawObj::wrap_DoPaintObject() const // but no paints. IsPaintInProgress() depends on SW repaint, so, as long // as SW paints self and calls DrawLayer() for Heaven and Hell, this will // be correct - if(pShell && pShell->IsDrawingLayerPaintInProgress()) + if ( pShell && pShell->IsDrawingLayerPaintInProgress() ) { sal_Bool bDrawObject(sal_True); - if(!SwFlyFrm::IsPaint((SdrObject*)this, pShell)) + if ( !SwFlyFrm::IsPaint( (SdrObject*)this, pShell ) ) { bDrawObject = sal_False; } - if(bDrawObject) + if ( bDrawObject ) { - if(!pFlyFrm->IsFlyInCntFrm()) + if ( !pFlyFrm->IsFlyInCntFrm() ) { // it is also necessary to restore the VCL MapMode from ViewInformation since e.g. // the VCL PixelRenderer resets it at the used OutputDevice. Unfortunately, this // excludes shears and rotates which are not expressable in MapMode. - OutputDevice* pOut = pShell->GetOut(); - - pOut->Push(PUSH_MAPMODE); - pOut->SetMapMode(pShell->getPrePostMapMode()); + // OD #i102707# + // new helper class to restore MapMode - restoration, only if + // needed and consideration of paint for meta file creation . + RestoreMapMode aRestoreMapModeIfNeeded( pShell ); // paint the FlyFrame (use standard VCL-Paint) - pFlyFrm->Paint(GetFlyFrm()->Frm()); - - pOut->Pop(); + pFlyFrm->Paint( GetFlyFrm()->Frm() ); } } } diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx index b1d1c75b54a7..916e5b91fc3d 100644..100755 --- a/sw/source/core/graphic/ndgrf.cxx +++ b/sw/source/core/graphic/ndgrf.cxx @@ -1165,7 +1165,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 84a840f43bc3..cc94622da58e 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 { @@ -206,12 +211,13 @@ public: // direction at the outliner of the draw view for painting layers <hell> // and <heaven>. - // correct type of 1st parameter + // #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 5b265942d561..7a8416d43f69 100644..100755 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -848,11 +848,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, diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 82513c75d32c..eb191dc95c4a 100644..100755 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -85,6 +85,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> @@ -2733,6 +2740,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 +// <-- /************************************************************************* |* |* SwRootFrm::Paint() @@ -2750,7 +2797,7 @@ void SwTabFrmPainter::Insert( SwLineEntry& rNew, bool bHori ) void SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) const { - OSL_ENSURE( Lower() && Lower()->IsPageFrm(), "Lower der Root keine Seite." ); + OSL_ENSURE( Lower() && Lower()->IsPageFrm(), "Lower der Root keine Seite." ); PROTOCOL( this, PROT_FILE_INIT, 0, 0) @@ -2843,10 +2890,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 ) { // Paint right shadow in single page mode, or if we're on last page of // the doc, or if ???Lower()??? or if we're on a page with no right @@ -2866,12 +2914,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; } @@ -2937,32 +2983,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, bFullBottomShadow, bRightSidebar ); SwPageFrm::PaintNotesSidebar( pPage->Frm(), pSh, pPage->GetPhyPageNum(), bRightSidebar); } @@ -2973,9 +3018,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 ) @@ -6341,21 +6389,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(); @@ -6587,22 +6634,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 623272cd4919..865bcc4e6b19 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -2101,12 +2101,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 e28b1694d8a6..5ac35972da94 100644..100755 --- a/sw/source/core/text/frmform.cxx +++ b/sw/source/core/text/frmform.cxx @@ -1025,8 +1025,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()); @@ -1081,8 +1094,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; } @@ -1093,8 +1105,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 ); @@ -1115,7 +1130,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 55ec68509498..f8d0cb1af883 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 3ca7d01e1981..ec7faaf360af 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -2134,7 +2134,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 441bf84096a4..bd0ac7049c2e 100644 --- a/sw/source/core/undo/docundo.cxx +++ b/sw/source/core/undo/docundo.cxx @@ -48,6 +48,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 4d17b8fa51a1..888ecfcafd8a 100644 --- a/sw/source/core/undo/undobj.cxx +++ b/sw/source/core/undo/undobj.cxx @@ -135,7 +135,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 e23cf3c9d4eb..4af1a5c756c0 100644..100755 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -1561,8 +1561,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()); @@ -2072,6 +2088,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 04bbd54c893b..9225ab8533cb 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 17e3723d9df0..0e3bfcdde09e 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -1676,13 +1676,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() ); @@ -1694,14 +1696,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 17710c82ee78..0e4ff69259e4 100644..100755 --- a/sw/source/core/view/vdraw.cxx +++ b/sw/source/core/view/vdraw.cxx @@ -103,7 +103,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() ) { @@ -150,7 +151,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(); // reset background color of the outliner diff --git a/sw/source/filter/ww1/fltshell.cxx b/sw/source/filter/ww1/fltshell.cxx index 91d67441286e..e33180964909 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 665a73f2721f..cba056944a15 100644 --- a/sw/source/filter/ww8/WW8TableInfo.cxx +++ b/sw/source/filter/ww8/WW8TableInfo.cxx @@ -252,6 +252,9 @@ WidthsPtr WW8TableNodeInfoInner::getWidthsOfRow() pWidths = WidthsPtr(new Widths); // number of cell written sal_uInt32 nBoxes = rTabBoxes.Count(); + if ( nBoxes > MAXTABLECELLS ) + nBoxes = MAXTABLECELLS; + for (sal_uInt32 n = 0; n < nBoxes; n++) { const SwFrmFmt* pBoxFmt = rTabBoxes[ n ]->GetFrmFmt(); @@ -280,6 +283,9 @@ RowSpansPtr WW8TableNodeInfoInner::getRowSpansOfRow() const SwTableBoxes & rTabBoxes = pTabLine->GetTabBoxes(); sal_uInt32 nBoxes = rTabBoxes.Count(); + if (nBoxes > MAXTABLECELLS) + nBoxes = MAXTABLECELLS; + for (sal_uInt32 n = 0; n < nBoxes; ++n) { pResult->push_back(rTabBoxes[n]->getRowSpan()); diff --git a/sw/source/filter/ww8/WW8TableInfo.hxx b/sw/source/filter/ww8/WW8TableInfo.hxx index 2ba703ab031f..3979db3bf204 100644 --- a/sw/source/filter/ww8/WW8TableInfo.hxx +++ b/sw/source/filter/ww8/WW8TableInfo.hxx @@ -49,6 +49,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 764b5438607f..b89c704093d1 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -439,9 +439,7 @@ void SwWW8AttrIter::OutAttr( xub_StrLen nSwPos, bool bRuby ) : 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(); @@ -1797,7 +1795,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; @@ -1941,6 +1939,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 ) @@ -1966,10 +1973,15 @@ 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 38f37ea04648..8a36688d53c5 100644 --- a/sw/source/filter/ww8/wrtw8num.cxx +++ b/sw/source/filter/ww8/wrtw8num.cxx @@ -222,8 +222,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 81920922c145..5b0df785ac8a 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -2141,6 +2141,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 ); @@ -3324,7 +3326,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 ), @@ -3340,8 +3342,6 @@ MSWordExportBase::MSWordExportBase( SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM MSWordExportBase::~MSWordExportBase() { delete pBmpPal; - if (pKeyMap) - delete[] (NfKeywordTable*)pKeyMap; delete pOLEExp; delete pOCXExp; delete pOleMap; @@ -3831,4 +3831,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; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 2a8b22f4447c..8ca0b1916969 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -470,7 +470,7 @@ public: WW8_WrtBookmarks* pBkmks; WW8_WrtRedlineAuthor* pRedlAuthors; BitmapPalette* pBmpPal; - void* pKeyMap; + boost::shared_ptr<NfKeywordTable> pKeyMap; SvxMSExportOLEObjects* pOLEExp; SwMSConvertControls* pOCXExp; WW8OleMaps* pOleMap; @@ -831,6 +831,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 9448cca6b6e8..2e2a33262a2e 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -438,10 +438,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; @@ -2337,18 +2346,13 @@ bool MSWordExportBase::GetNumberFmt(const SwField& rFld, String& rStr) const SvNumberformat* pNumFmt = pNFmtr->GetEntry( nFmtIdx ); if( pNumFmt ) { - 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 6d014a08a61a..3fca59587e58 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -2457,7 +2457,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 8d66b216d2ab..e71cd1dc4c33 100644 --- a/sw/source/filter/xml/swxml.cxx +++ b/sw/source/filter/xml/swxml.cxx @@ -913,18 +913,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 fb0f54f21bf3..40d27574a716 100644 --- a/sw/source/filter/xml/xmlbrshi.hxx +++ b/sw/source/filter/xml/xmlbrshi.hxx @@ -26,8 +26,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 b0904f059e0b..bcd148db33a3 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -410,23 +410,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(RTL_CONSTASCII_USTRINGPARAM( "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 ff17d5cc849b..ef9bc9320f57 100644 --- a/sw/source/filter/xml/xmlimp.hxx +++ b/sw/source/filter/xml/xmlimp.hxx @@ -26,14 +26,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; @@ -180,6 +184,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< @@ -208,6 +213,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 @@ -220,6 +230,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 712d56367cf3..5dc21bf5f309 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(); @@ -190,7 +196,7 @@ void SvXMLImportItemMapper::importXML( SfxItemSet& rSet, delete pUnknownItem; } - finished( rSet ); + finished(rSet, rUnitConverter); } /** this method is called for every item that has the @@ -201,7 +207,7 @@ SvXMLImportItemMapper::handleSpecialItem( const SvXMLItemMapEntry& /*rEntry*/, SfxItemSet& /*rSet*/, const OUString& /*rValue*/, const SvXMLUnitConverter& /*rUnitConverter*/, - const SvXMLNamespaceMap& /*rNamespaceMap*/ ) const + const SvXMLNamespaceMap& /*rNamespaceMap*/ ) { OSL_FAIL( "unsuported special item in xml import" ); return sal_False; @@ -213,13 +219,14 @@ sal_Bool SvXMLImportItemMapper::handleNoItem( const SvXMLItemMapEntry& /*rEntry* SfxItemSet& /*rSet*/, const OUString& /*rValue*/, const SvXMLUnitConverter& /*rUnitConverter*/, - const SvXMLNamespaceMap& /*rNamespaceMap*/ ) const + const SvXMLNamespaceMap& /*rNamespaceMap*/ ) { OSL_FAIL( "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 578084ee972a..792d2bdb2d61 100644 --- a/sw/source/filter/xml/xmlimpit.hxx +++ b/sw/source/filter/xml/xmlimpit.hxx @@ -59,7 +59,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 */ @@ -68,7 +68,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 */ @@ -76,13 +76,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; @@ -95,12 +96,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 d2c41d380cdd..819dfefcf765 100644 --- a/sw/source/filter/xml/xmlitem.cxx +++ b/sw/source/filter/xml/xmlitem.cxx @@ -40,15 +40,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 a47f73e06bb1..f388206e6b0a 100644 --- a/sw/source/filter/xml/xmlitem.hxx +++ b/sw/source/filter/xml/xmlitem.hxx @@ -54,7 +54,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 c875453e97f1..d9a98955c1f1 100644 --- a/sw/source/filter/xml/xmlitemi.cxx +++ b/sw/source/filter/xml/xmlitemi.cxx @@ -29,29 +29,34 @@ // 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> #include <xmloff/families.hxx> -#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/brshitem.hxx> #include <editeng/langitem.hxx> +#include <editeng/memberids.hrc> -#include "xmlbrshi.hxx" +#include <svx/unomid.hxx> + +#include <hintids.hxx> #include <paratr.hxx> #include <doc.hxx> #include <unomid.h> +#include "xmlbrshi.hxx" #include "xmlimp.hxx" +#include "xmlitmap.hxx" +#include "xmlimpit.hxx" +#include "xmlitem.hxx" using ::rtl::OUString; using namespace ::com::sun::star; @@ -75,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 ) { @@ -118,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"); + } + } + } } // --------------------------------------------------------------------- @@ -135,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(); @@ -152,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 5bc92baa071c..16070cb505f4 100644 --- a/sw/source/filter/xml/xmlitemm.cxx +++ b/sw/source/filter/xml/xmlitemm.cxx @@ -47,6 +47,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 } @@ -60,11 +62,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 92c743518cb6..1bdcd3592e6b 100644 --- a/sw/source/filter/xml/xmlmeta.cxx +++ b/sw/source/filter/xml/xmlmeta.cxx @@ -58,22 +58,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(RTL_CONSTASCII_USTRINGPARAM( "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 b8d9593178ec..f9710fbdf216 100644..100755 --- a/sw/source/ui/app/docsh2.cxx +++ b/sw/source/ui/app/docsh2.cxx @@ -806,7 +806,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 ); @@ -1062,6 +1066,8 @@ void SwDocShell::Execute(SfxRequest& rReq) case FN_OUTLINE_TO_CLIPBOARD: case FN_OUTLINE_TO_IMPRESS: { + sal_Bool bEnable = IsEnableSetModified(); + EnableSetModified( sal_False ); WriterRef xWrt; // mba: looks as if relative URLs don't make sense here ::GetRTFWriter( 'O', String(), xWrt ); @@ -1069,6 +1075,7 @@ void SwDocShell::Execute(SfxRequest& rReq) pStrm->SetBufferSize( 16348 ); SwWriter aWrt( *pStrm, *GetDoc() ); ErrCode eErr = aWrt.Write( xWrt ); + EnableSetModified( bEnable ); if( !ERRCODE_TOERROR( eErr ) ) { pStrm->Seek( STREAM_SEEK_TO_END ); @@ -1688,10 +1695,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; - // Set filter: String sFactory(String::CreateFromAscii(SwDocShell::Factory().GetShortName())); SfxFilterMatcher aMatcher( sFactory ); @@ -1706,10 +1709,40 @@ 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 ) + // <-- { - OSL_ENSURE((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 ) @@ -1719,16 +1752,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 ) - { - pReader = new SwReader( aMed, rURL, pDoc ); - } + } - OSL_ENSURE( pRead, "no reader found" ); - if( pRead ) - { pRead->GetReaderOpt().SetTxtFmts( rOpt.IsTxtFmts() ); pRead->GetReaderOpt().SetFrmFmts( rOpt.IsFrmFmts() ); pRead->GetReaderOpt().SetPageDescs( rOpt.IsPageDescs() ); @@ -1746,9 +1773,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 829b029ecbb3..9fa3df5a9f56 100644 --- a/sw/source/ui/dbui/dbmgr.cxx +++ b/sw/source/ui/dbui/dbmgr.cxx @@ -2487,7 +2487,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 e12ca876d899..de00a12d5704 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -494,6 +494,22 @@ 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(); +} sal_Bool AbstractMailMergeCreateFromDlg_Impl::IsThisDocument() const { diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index 2c5709d85004..9b883eaa979f 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 @@ -584,4 +588,4 @@ struct SwDialogsResMgr #endif -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx index 7ed7cea213b3..f99fe6dcfd8f 100644..100755 --- a/sw/source/ui/dochdl/swdtflvr.cxx +++ b/sw/source/ui/dochdl/swdtflvr.cxx @@ -155,24 +155,6 @@ using namespace nsTransferBufferType; #define DDE_TXT_ENCODING gsl_getSystemTextEncoding() -//--------------------------------------------- -// this struct conforms to the Microsoft -// OBJECTDESCRIPTOR -> see oleidl.h -// (MS platform sdk) -//--------------------------------------------- - -struct OleObjectDescriptor -{ - sal_uInt32 cbSize; - ClsId clsid; - sal_uInt32 dwDrawAspect; - Size sizel; - Point pointl; - sal_uInt32 dwStatus; - sal_uInt32 dwFullUserTypeName; - sal_uInt32 dwSrcOfCopy; -}; - class SwTrnsfrDdeLink : public ::sfx2::SvBaseLink { String sName; @@ -796,6 +778,10 @@ int SwTransferable::PrepareForCopy( sal_Bool bIsCut ) AddFormat( SOT_FORMATSTR_ID_EMBED_SOURCE ); + // --> OD #i98753# + // set size of embedded object at the object description structure + aObjDesc.maSize = OutputDevice::LogicToLogic( pWrtShell->GetObjSize(), MAP_TWIP, MAP_100TH_MM ); + // <-- PrepareOLE( aObjDesc ); AddFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ); @@ -1613,7 +1599,9 @@ int SwTransferable::_PasteFileContent( TransferableDataHelper& rData, Link aOldLink( rSh.GetChgLnk() ); rSh.SetChgLnk( Link() ); + const SwPosition& rInsPos = *rSh.GetCrsr()->Start(); SwReader aReader( *pStream, aEmptyStr, String(), *rSh.GetCrsr() ); + rSh.SaveTblBoxCntnt( &rInsPos ); if( IsError( aReader.Read( *pRead )) ) nResId = ERR_CLPBRD_READ; else diff --git a/sw/source/ui/docvw/AnnotationWin.cxx b/sw/source/ui/docvw/AnnotationWin.cxx index 214fef8f3d31..e936496374e3 100644 --- a/sw/source/ui/docvw/AnnotationWin.cxx +++ b/sw/source/ui/docvw/AnnotationWin.cxx @@ -109,15 +109,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 @@ -240,15 +248,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/docvw/romenu.cxx b/sw/source/ui/docvw/romenu.cxx index 1d68327189d6..ec9e9f26147f 100644..100755 --- a/sw/source/ui/docvw/romenu.cxx +++ b/sw/source/ui/docvw/romenu.cxx @@ -414,7 +414,7 @@ String ExportGraphic( const Graphic &rGraphic, const String &rGrfName ) SvtPathOptions aPathOpt; String sGrfPath( aPathOpt.GetGraphicPath() ); - FileDialogHelper aDlgHelper( TemplateDescription::FILESAVE_SIMPLE, 0 ); + FileDialogHelper aDlgHelper( TemplateDescription::FILESAVE_AUTOEXTENSION, 0 ); Reference < XFilePicker > xFP = aDlgHelper.GetFilePicker(); INetURLObject aPath; @@ -501,7 +501,7 @@ String ExportGraphic( const Graphic &rGraphic, const String &rGrfName ) nFilter = GRFILTER_FORMAT_DONTKNOW; String aFilter( rGF.GetExportFormatShortName( nFilter ) ); XOutBitmap::WriteGraphic( rGraphic, sPath, aFilter, - XOUTBMP_DONT_EXPAND_FILENAME ); + XOUTBMP_DONT_EXPAND_FILENAME|XOUTBMP_DONT_ADD_EXTENSION ); return sPath; } } diff --git a/sw/source/ui/inc/mailmrge.hxx b/sw/source/ui/inc/mailmrge.hxx index 359027244a3e..fd0fb2e0787b 100644 --- a/sw/source/ui/inc/mailmrge.hxx +++ b/sw/source/ui/inc/mailmrge.hxx @@ -147,6 +147,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/inc/view.hxx b/sw/source/ui/inc/view.hxx index 080bd8bcb316..c5cade536154 100644..100755 --- a/sw/source/ui/inc/view.hxx +++ b/sw/source/ui/inc/view.hxx @@ -285,6 +285,7 @@ class SW_DLLPUBLIC SwView: public SfxViewShell bInMailMerge : 1, bInDtor : 1, //detect destructor to prevent creating of sub shells while closing bOldShellWasPagePreView : 1, + bIsPreviewDoubleClick : 1, // #i114045# bMakeSelectionVisible : 1 // #b6330459# transport the bookmark selection ; diff --git a/sw/source/ui/index/idxmrk.src b/sw/source/ui/index/idxmrk.src index 0fdb84db1980..31c2ee7037f8 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 { @@ -528,6 +560,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 { @@ -542,6 +575,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 6c988d9b265e..adda1dbc0ce3 100644 --- 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 c7504550fc1b..9be44e27b8cd 100644 --- a/sw/source/ui/shells/grfsh.cxx +++ b/sw/source/ui/shells/grfsh.cxx @@ -526,6 +526,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() ); + SetGetStateSet( &rSet ); @@ -623,11 +626,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&) @@ -703,7 +706,4 @@ SwGrfShell::SwGrfShell(SwView &_rView) : SetHelpId(SW_GRFSHELL); } - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx index a5089d532453..14eaf04acaf3 100644..100755 --- a/sw/source/ui/uiview/view.cxx +++ b/sw/source/ui/uiview/view.cxx @@ -756,7 +756,8 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) nRightBorderDistance( 0 ), bInMailMerge(sal_False), bInDtor(sal_False), - bOldShellWasPagePreView(sal_False) + bOldShellWasPagePreView(sal_False), + bIsPreviewDoubleClick(sal_False) { // According to discussion with MBA and further // investigations, no old SfxViewShell will be set as parameter <pOldSh>, @@ -813,6 +814,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) sNewCrsrPos = ((SwPagePreView*)pExistingSh)->GetNewCrsrPos(); nNewPage = ((SwPagePreView*)pExistingSh)->GetNewPage(); bOldShellWasPagePreView = sal_True; + bIsPreviewDoubleClick = sNewCrsrPos.Len() > 0 || nNewPage != USHRT_MAX; } else if( pExistingSh->IsA( TYPE( SwSrcView ) ) ) bOldShellWasSrcView = sal_True; @@ -1262,7 +1264,7 @@ void SwView::ReadUserData( const String &rUserData, sal_Bool bBrowse ) void SwView::ReadUserDataSequence ( const uno::Sequence < beans::PropertyValue >& rSequence, sal_Bool bBrowse ) { - if(GetDocShell()->IsPreview()) + if(GetDocShell()->IsPreview()||bIsPreviewDoubleClick) return; bool bIsOwnDocument = lcl_IsOwnDocument( *this ); sal_Int32 nLength = rSequence.getLength(); diff --git a/sw/source/ui/vba/vbaapplication.cxx b/sw/source/ui/vba/vbaapplication.cxx index c1da3cc3eb61..d795e66b9a41 100644 --- a/sw/source/ui/vba/vbaapplication.cxx +++ b/sw/source/ui/vba/vbaapplication.cxx @@ -99,7 +99,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 e837785be3ab..e7f4ec236625 100644 --- a/sw/source/ui/vba/vbaeventshelper.cxx +++ b/sw/source/ui/vba/vbaeventshelper.cxx @@ -27,6 +27,7 @@ ************************************************************************/ #include "vbaeventshelper.hxx" +#include <com/sun/star/script/ModuleType.hpp> #include <com/sun/star/script/vba/VBAEventId.hpp> #include <vbahelper/helperdecl.hxx> @@ -39,12 +40,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() @@ -77,7 +79,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 a5817eef2d37..3c291a78b402 100644 --- a/sw/source/ui/vba/vbaeventshelper.hxx +++ b/sw/source/ui/vba/vbaeventshelper.hxx @@ -44,7 +44,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 cb245e9b2a09..43cf4764d223 100644 --- a/sw/source/ui/vba/vbawindow.cxx +++ b/sw/source/ui/vba/vbawindow.cxx @@ -41,7 +41,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 65cdc50b6516..99b259631324 100644 --- a/sw/source/ui/vba/vbawindow.hxx +++ b/sw/source/ui/vba/vbawindow.hxx @@ -39,8 +39,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); |