summaryrefslogtreecommitdiff
path: root/sw/source/core
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedric.bosdonnat.ooo@free.fr>2012-08-30 22:15:58 +0200
committerCédric Bosdonnat <cedric.bosdonnat@free.fr>2012-09-04 12:59:52 +0200
commite598ab04476a32a08f18e8f0662fafa5f78f1a4a (patch)
treeb108dadf6159c35f7e616cb0b950ae9480edad05 /sw/source/core
parentf28e2820fc4105cf1aa8b1daf075ef540c532572 (diff)
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
Diffstat (limited to 'sw/source/core')
-rw-r--r--sw/source/core/doc/doc.cxx6
-rw-r--r--sw/source/core/doc/docnew.cxx1
-rw-r--r--sw/source/core/doc/notxtfrm.cxx11
-rw-r--r--sw/source/core/inc/flyfrms.hxx10
-rw-r--r--sw/source/core/layout/flylay.cxx4
5 files changed, 31 insertions, 1 deletions
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 45749b4edf92..46bccdee17eb 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 a6b50f0f44e4..5e9cdf6e631d 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 a04eaaeb6332..d54c90f5309f 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 13b3c05a2a40..2f10d0cc15b7 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 c1ae0be1aa23..669f6df1fc62 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() )