svx/inc/svx/svdpagv.hxx | 3 ++- svx/source/svdraw/svdpagv.cxx | 7 +++++-- sw/inc/IDocumentSettingAccess.hxx | 1 + sw/inc/doc.hxx | 1 + sw/source/core/doc/doc.cxx | 6 ++++++ sw/source/core/doc/docnew.cxx | 1 + sw/source/core/doc/notxtfrm.cxx | 11 +++++++++++ sw/source/core/inc/flyfrms.hxx | 10 ++++++++++ sw/source/core/layout/flylay.cxx | 4 +++- sw/source/core/layout/paintfrm.cxx | 4 ++-- sw/source/core/view/vdraw.cxx | 4 ++-- sw/source/filter/ww8/ww8par.cxx | 1 + sw/source/filter/xml/xmlimp.cxx | 10 ++++++++++ sw/source/ui/uno/SwXDocumentSettings.cxx | 16 +++++++++++++++- writerfilter/source/filter/ImportFilter.cxx | 1 + 15 files changed, 71 insertions(+), 9 deletions(-)
New commits: commit 8af09bf33291df2fb2bfbbd6e42f9bf074fcc4fc Author: Cédric Bosdonnat <cedric.bosdonnat....@free.fr> Date: Mon Sep 3 16:52:47 2012 +0200 n#777699: Clip the objects to the pagewe are painting Change-Id: I78ac7de5346a2adea9a2c6cf3cbb0321e05d79dc diff --git a/svx/inc/svx/svdpagv.hxx b/svx/inc/svx/svdpagv.hxx index 38881e5..5ab5848 100644 --- a/svx/inc/svx/svdpagv.hxx +++ b/svx/inc/svx/svdpagv.hxx @@ -181,7 +181,8 @@ public: // write access to mpPreparedPageWindow void setPreparedPageWindow(SdrPageWindow* pKnownTarget); - void DrawLayer(SdrLayerID nID, OutputDevice* pGivenTarget = 0, sdr::contact::ViewObjectContactRedirector* pRedirector = 0L) const; + void DrawLayer(SdrLayerID nID, OutputDevice* pGivenTarget = 0, sdr::contact::ViewObjectContactRedirector* pRedirector = 0L, + const Rectangle& rRect = Rectangle()) const; void DrawPageViewGrid(OutputDevice& rOut, const Rectangle& rRect, Color aColor = Color( COL_BLACK ) ); Rectangle GetPageRect() const; diff --git a/svx/source/svdraw/svdpagv.cxx b/svx/source/svdraw/svdpagv.cxx index 5efebdf..9a3aaf1 100644 --- a/svx/source/svdraw/svdpagv.cxx +++ b/svx/source/svdraw/svdpagv.cxx @@ -346,7 +346,7 @@ void SdrPageView::setPreparedPageWindow(SdrPageWindow* pKnownTarget) mpPreparedPageWindow = pKnownTarget; } -void SdrPageView::DrawLayer(SdrLayerID nID, OutputDevice* pGivenTarget, sdr::contact::ViewObjectContactRedirector* pRedirector) const +void SdrPageView::DrawLayer(SdrLayerID nID, OutputDevice* pGivenTarget, sdr::contact::ViewObjectContactRedirector* pRedirector, const Rectangle& rRect) const { if(GetPage()) { @@ -374,7 +374,10 @@ void SdrPageView::DrawLayer(SdrLayerID nID, OutputDevice* pGivenTarget, sdr::con // Copy existing paint region to use the same as prepared in BeginDrawLayer SdrPaintWindow& rExistingPaintWindow = pPreparedTarget->GetPaintWindow(); const Region& rExistingRegion = rExistingPaintWindow.GetRedrawRegion(); - aTemporaryPaintWindow.SetRedrawRegion(rExistingRegion); + if ( rRect.IsEmpty() ) + aTemporaryPaintWindow.SetRedrawRegion(rExistingRegion); + else + aTemporaryPaintWindow.SetRedrawRegion(Region(rRect)); // patch the ExistingPageWindow pPreparedTarget->patchPaintWindow(aTemporaryPaintWindow); diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index ba26ae1..0af0b44 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -3122,7 +3122,7 @@ SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) const const IDocumentDrawModelAccess* pIDDMA = pSh->getIDocumentDrawModelAccess(); pSh->Imp()->PaintLayer( pIDDMA->GetHellId(), pPrintData, - aPaintRect, + pPage->Frm(), &aPageBackgrdColor, (pPage->IsRightToLeft() ? true : false), &aSwRedirector ); @@ -3166,7 +3166,7 @@ SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) const // OD 09.12.2002 #103045# - add 4th parameter for horizontal text direction. pSh->Imp()->PaintLayer( pSh->GetDoc()->GetHeavenId(), pPrintData, - aPaintRect, + pPage->Frm(), &aPageBackgrdColor, (pPage->IsRightToLeft() ? true : false), &aSwRedirector ); diff --git a/sw/source/core/view/vdraw.cxx b/sw/source/core/view/vdraw.cxx index 69eb0a3..d380652 100644 --- a/sw/source/core/view/vdraw.cxx +++ b/sw/source/core/view/vdraw.cxx @@ -97,7 +97,7 @@ void SwViewImp::UnlockPaint() void SwViewImp::PaintLayer( const SdrLayerID _nLayerID, SwPrintData const*const pPrintData, - const SwRect& , + const SwRect& aPaintRect, const Color* _pPageBackgrdColor, const bool _bIsPageRightToLeft, sdr::contact::ViewObjectContactRedirector* pRedirector ) const @@ -150,7 +150,7 @@ void SwViewImp::PaintLayer( const SdrLayerID _nLayerID, SdrView &rSdrView = const_cast< SdrView & >(GetPageView()->GetView()); rSdrView.setHideDraw( !pPrintData->IsPrintDraw() ); } - GetPageView()->DrawLayer( _nLayerID, pOutDev, pRedirector ); + GetPageView()->DrawLayer( _nLayerID, pOutDev, pRedirector, aPaintRect.SVRect() ); pOutDev->Pop(); // reset background color of the outliner & default horiz. text dir. commit e598ab04476a32a08f18e8f0662fafa5f78f1a4a Author: Cédric Bosdonnat <cedric.bosdonnat....@free.fr> Date: Thu Aug 30 22:15:58 2012 +0200 n#775270: clip pictures instead of scaling they don't fit Word clips pictures that are bigger than a page instead of scaling them down. This patch introduces a new compatibility option to allow clipping a picture in Writer instead of scaling it down. Change-Id: I4defbee05be81e23ec28a2ed272eaf4e4cc6faf5 diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx index 8263ca6..44eef47 100644 --- a/sw/inc/IDocumentSettingAccess.hxx +++ b/sw/inc/IDocumentSettingAccess.hxx @@ -84,6 +84,7 @@ namespace com { namespace sun { namespace star { namespace i18n { struct Forbidd SMALL_CAPS_PERCENTAGE_66, TAB_OVERFLOW, UNBREAKABLE_NUMBERINGS, + CLIPPED_PICTURES, // COMPATIBILITY FLAGS END BROWSE_MODE, diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 2702d1c..51c4f28 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -589,6 +589,7 @@ private: bool mbSmallCapsPercentage66; bool mbTabOverflow; bool mbUnbreakableNumberings; + bool mbClippedPictures; bool mbLastBrowseMode : 1; diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 45749b4..46bccde 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -199,6 +199,7 @@ bool SwDoc::get(/*[in]*/ DocumentSettingId id) const case SMALL_CAPS_PERCENTAGE_66: return mbSmallCapsPercentage66; case TAB_OVERFLOW: return mbTabOverflow; case UNBREAKABLE_NUMBERINGS: return mbUnbreakableNumberings; + case CLIPPED_PICTURES: return mbClippedPictures; case BROWSE_MODE: return mbLastBrowseMode; // Attention: normally the ViewShell has to be asked! case HTML_MODE: return mbHTMLMode; @@ -343,6 +344,11 @@ void SwDoc::set(/*[in]*/ DocumentSettingId id, /*[in]*/ bool value) case UNBREAKABLE_NUMBERINGS: mbUnbreakableNumberings = value; break; + + case CLIPPED_PICTURES: + mbClippedPictures = value; + break; + // COMPATIBILITY FLAGS END case BROWSE_MODE: //can be used temporary (load/save) when no ViewShell is avaiable diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index a6b50f0..5e9cdf6 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -358,6 +358,7 @@ SwDoc::SwDoc() mbTabOverflow = true; mbUnbreakableNumberings = false; mbFloattableNomargins = false; + mbClippedPictures = false; // // COMPATIBILITY FLAGS END diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index a04eaae..d54c90f 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -49,6 +49,7 @@ #include <fesh.hxx> #include <doc.hxx> #include <flyfrm.hxx> +#include <flyfrms.hxx> #include <frmtool.hxx> #include <viewopt.hxx> #include <viewimp.hxx> @@ -294,6 +295,16 @@ void SwNoTxtFrm::Paint(SwRect const& rRect, SwPrintData const*const) const SwRect aGrfArea( Frm() ); SwRect aPaintArea( aGrfArea ); + + // In case the picture fly frm was clipped, render it with the origin + // size instead of scaling it + if ( rNoTNd.getIDocumentSettingAccess()->get( IDocumentSettingAccess::CLIPPED_PICTURES ) ) + { + const SwFlyFreeFrm *pFly = dynamic_cast< const SwFlyFreeFrm* >( FindFlyFrm() ); + if( pFly ) + aGrfArea = SwRect( Frm().Pos( ), pFly->GetUnclippedFrm( ).SSize( ) ); + } + aPaintArea._Intersection( aOrigPaint ); SwRect aNormal( Frm().Pos() + Prt().Pos(), Prt().SSize() ); diff --git a/sw/source/core/inc/flyfrms.hxx b/sw/source/core/inc/flyfrms.hxx index 13b3c05..2f10d0c 100644 --- a/sw/source/core/inc/flyfrms.hxx +++ b/sw/source/core/inc/flyfrms.hxx @@ -47,6 +47,8 @@ class SwFlyFreeFrm : public SwFlyFrm // #i37068# - flag to prevent move in method <CheckClip(..)> bool mbNoMoveOnCheckClip; + SwRect maUnclippedFrm; + void CheckClip( const SwFmtFrmSize &rSz ); //'Emergency' Clipping. /** determines, if direct environment of fly frame has 'auto' size @@ -106,6 +108,14 @@ public: } } + inline const SwRect& GetUnclippedFrm( ) const + { + if ( maUnclippedFrm.HasArea( ) ) + return maUnclippedFrm; + else + return Frm(); + } + /** method to determine, if a format on the Writer fly frame is possible #i28701# diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx index c1ae0be..669f6df 100644 --- a/sw/source/core/layout/flylay.cxx +++ b/sw/source/core/layout/flylay.cxx @@ -74,7 +74,8 @@ SwFlyFreeFrm::SwFlyFreeFrm( SwFlyFrmFmt *pFmt, SwFrm* pSib, SwFrm *pAnch ) : // #i34753# mbNoMakePos( false ), // #i37068# - mbNoMoveOnCheckClip( false ) + mbNoMoveOnCheckClip( false ), + maUnclippedFrm( ) { } @@ -447,6 +448,7 @@ void SwFlyFreeFrm::CheckClip( const SwFmtFrmSize &rSz ) // otherwise we'll end up with unwanted side-effects const long nPrtHeightDiff = Frm().Height() - Prt().Height(); const long nPrtWidthDiff = Frm().Width() - Prt().Width(); + maUnclippedFrm = SwRect( Frm() ); Frm().Height( aFrmRect.Height() ); Frm().Width ( Max( long(MINLAY), aFrmRect.Width() ) ); if ( Lower() && Lower()->IsColumnFrm() ) diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index ee4e34b..3a86fcc 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -1536,6 +1536,7 @@ void SwWW8ImplReader::ImportDop() rDoc.set(IDocumentSettingAccess::COLLAPSE_EMPTY_CELL_PARA, true); rDoc.set(IDocumentSettingAccess::TAB_OVERFLOW, true); rDoc.set(IDocumentSettingAccess::UNBREAKABLE_NUMBERINGS, true); + rDoc.set(IDocumentSettingAccess::CLIPPED_PICTURES, true); // // COMPATIBILITY FLAGS END diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index d5a101d..4d62629 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -1154,6 +1154,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC aSet.insert(String("SmallCapsPercentage66", RTL_TEXTENCODING_ASCII_US)); aSet.insert(String("TabOverflow", RTL_TEXTENCODING_ASCII_US)); aSet.insert(String("UnbreakableNumberings", RTL_TEXTENCODING_ASCII_US)); + aSet.insert(String("ClippedPictures", RTL_TEXTENCODING_ASCII_US)); sal_Int32 nCount = aConfigProps.getLength(); const PropertyValue* pValues = aConfigProps.getConstArray(); @@ -1185,6 +1186,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC bool bSmallCapsPercentage66 = false; bool bTabOverflow = false; bool bUnbreakableNumberings = false; + bool bClippedPictures = false; OUString sRedlineProtectionKey( RTL_CONSTASCII_USTRINGPARAM( "RedlineProtectionKey" ) ); @@ -1273,6 +1275,8 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC bTabOverflow = true; else if ( pValues->Name == "UnbreakableNumberings" ) bUnbreakableNumberings = true; + else if ( pValues->Name == "ClippedPictures" ) + bClippedPictures = true; } catch( Exception& ) { @@ -1451,6 +1455,12 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC OUString( RTL_CONSTASCII_USTRINGPARAM("UnbreakableNumberings") ), makeAny( false ) ); } + if ( !bClippedPictures ) + { + xProps->setPropertyValue( + OUString( RTL_CONSTASCII_USTRINGPARAM("ClippedPictures") ), makeAny( false ) ); + } + Reference < XTextDocument > xTextDoc( GetModel(), UNO_QUERY ); Reference < XText > xText = xTextDoc->getText(); Reference<XUnoTunnel> xTextTunnel( xText, UNO_QUERY); diff --git a/sw/source/ui/uno/SwXDocumentSettings.cxx b/sw/source/ui/uno/SwXDocumentSettings.cxx index f77aefc..fda8a6c 100644 --- a/sw/source/ui/uno/SwXDocumentSettings.cxx +++ b/sw/source/ui/uno/SwXDocumentSettings.cxx @@ -127,7 +127,8 @@ enum SwDocumentSettingsPropertyHandles HANDLE_TAB_OVERFLOW, HANDLE_UNBREAKABLE_NUMBERINGS, HANDLE_STYLES_NODEFAULT, - HANDLE_FLOATTABLE_NOMARGINS + HANDLE_FLOATTABLE_NOMARGINS, + HANDLE_CLIPPED_PICTURES }; MasterPropertySetInfo * lcl_createSettingsInfo() @@ -192,6 +193,7 @@ MasterPropertySetInfo * lcl_createSettingsInfo() { RTL_CONSTASCII_STRINGPARAM("UnbreakableNumberings"), HANDLE_UNBREAKABLE_NUMBERINGS, CPPUTYPE_BOOLEAN, 0, 0}, { RTL_CONSTASCII_STRINGPARAM("StylesNoDefault"), HANDLE_STYLES_NODEFAULT, CPPUTYPE_BOOLEAN, 0, 0}, { RTL_CONSTASCII_STRINGPARAM("FloattableNomargins"), HANDLE_FLOATTABLE_NOMARGINS, CPPUTYPE_BOOLEAN, 0, 0}, + { RTL_CONSTASCII_STRINGPARAM("ClippedPictures"), HANDLE_CLIPPED_PICTURES, CPPUTYPE_BOOLEAN, 0, 0}, /* * As OS said, we don't have a view when we need to set this, so I have to * find another solution before adding them to this property set - MTG @@ -763,6 +765,12 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf mpDoc->set(IDocumentSettingAccess::FLOATTABLE_NOMARGINS, bTmp); } break; + case HANDLE_CLIPPED_PICTURES: + { + sal_Bool bTmp = *(sal_Bool*)rValue.getValue(); + mpDoc->set(IDocumentSettingAccess::CLIPPED_PICTURES, bTmp); + } + break; default: throw UnknownPropertyException(); } @@ -1147,6 +1155,12 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf rValue.setValue( &bTmp, ::getBooleanCppuType() ); } break; + case HANDLE_CLIPPED_PICTURES: + { + sal_Bool bTmp = mpDoc->get( IDocumentSettingAccess::CLIPPED_PICTURES ); + rValue.setValue( &bTmp, ::getBooleanCppuType() ); + } + break; default: throw UnknownPropertyException(); } diff --git a/writerfilter/source/filter/ImportFilter.cxx b/writerfilter/source/filter/ImportFilter.cxx index 8e60b56..576d225 100644 --- a/writerfilter/source/filter/ImportFilter.cxx +++ b/writerfilter/source/filter/ImportFilter.cxx @@ -178,6 +178,7 @@ void WriterFilter::setTargetDocument( const uno::Reference< lang::XComponent >& xSettings->setPropertyValue( "StylesNoDefault", uno::makeAny( sal_True ) ); xSettings->setPropertyValue("FloattableNomargins", uno::makeAny( sal_True )); + xSettings->setPropertyValue( "ClippedPictures", uno::makeAny( sal_True ) ); } void WriterFilter::setSourceDocument( const uno::Reference< lang::XComponent >& xDoc )
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits