ooo-build r12950 - in trunk: . patches/dev300



Author: thorstenb
Date: Tue Jun 24 10:46:08 2008
New Revision: 12950
URL: http://svn.gnome.org/viewvc/ooo-build?rev=12950&view=rev

Log:
	* patches/dev300/fit-list-to-size.diff: intermediate,
	work-in-progress, scale-font-down if typing text in Impress and
	the text box becomes too small.



Modified:
   trunk/ChangeLog
   trunk/patches/dev300/fit-list-to-size.diff

Modified: trunk/patches/dev300/fit-list-to-size.diff
==============================================================================
--- trunk/patches/dev300/fit-list-to-size.diff	(original)
+++ trunk/patches/dev300/fit-list-to-size.diff	Tue Jun 24 10:46:08 2008
@@ -1,31 +1,28 @@
-basically working, still repaint errors
+ svx/inc/svx/svdotext.hxx         |    3 ++
+ svx/source/msfilter/msdffimp.cxx |   14 ++++++++++-
+ svx/source/svdraw/svdedxv.cxx    |   13 ++++++++--
+ svx/source/svdraw/svdotext.cxx   |   50 +++++++++++++++++++++++++++++++++++---
+ 4 files changed, 72 insertions(+), 8 deletions(-)
 
-
----
-
- svx/inc/svx/svdedxv.hxx          |    1 
- svx/source/msfilter/msdffimp.cxx |   14 ++++
- svx/source/svdraw/svdedxv.cxx    |  134 +++++++++++++++++++++++++++++++++++++-
- svx/source/svdraw/svdotext.cxx   |    2 -
- 4 files changed, 145 insertions(+), 6 deletions(-)
-
-diff --git a/svx/inc/svx/svdedxv.hxx b/svx/inc/svx/svdedxv.hxx
-index 1a6d437..e59b7e0 100644
---- svx/inc/svx/svdedxv.hxx
-+++ svx/inc/svx/svdedxv.hxx
-@@ -110,6 +110,7 @@ protected:
- 
- 	USHORT						nMacroTol;
- 
-+	unsigned					bInDownScale : 1;
- 	unsigned					bTextEditDontDelete : 1;   // Outliner und View bei SdrEndTextEdit nicht deleten (f. Rechtschreibpruefung)
- 	unsigned					bTextEditOnlyOneView : 1;  // Nur eine OutlinerView (f. Rechtschreibpruefung)
- 	unsigned					bTextEditNewObj : 1;       // Aktuell editiertes Objekt wurde gerade neu erzeugt
+diff --git a/svx/inc/svx/svdotext.hxx b/svx/inc/svx/svdotext.hxx
+index e90c491..7d1d0ae 100644
+--- svx/inc/svx/svdotext.hxx
++++ svx/inc/svx/svdotext.hxx
+@@ -244,6 +244,9 @@ protected:
+ 	// Flag for allowing text animation. Default is sal_true.
+ 	BOOL						mbTextAnimationAllowed : 1;
+ 
++    // flag for preventing recursive onEditOutlinerStatusEvent calls
++	BOOL					    mbInDownScale : 1;
++
+ 	SVX_DLLPRIVATE SdrOutliner& ImpGetDrawOutliner() const;
+ 
+ private:
 diff --git a/svx/source/msfilter/msdffimp.cxx b/svx/source/msfilter/msdffimp.cxx
-index 60244ad..6665922 100644
+index e34d920..d572729 100644
 --- svx/source/msfilter/msdffimp.cxx
 +++ svx/source/msfilter/msdffimp.cxx
-@@ -2105,7 +2105,16 @@ void DffPropertyReader::ApplyCustomShapeTextAttributes( SfxItemSet& rSet ) const
+@@ -1921,7 +1921,16 @@ void DffPropertyReader::ApplyCustomShapeTextAttributes( SfxItemSet& rSet ) const
  	rSet.Put( SdrTextLowerDistItem( nTextBottom ) );
  
  	rSet.Put( SdrTextWordWrapItem( (MSO_WrapMode)GetPropertyValue( DFF_Prop_WrapText, mso_wrapSquare ) != mso_wrapNone ? sal_True : sal_False ) );
@@ -43,7 +40,7 @@
  
  //	rSet.Put( SdrTextAutoGrowWidthItem( (MSO_WrapMode)GetPropertyValue( DFF_Prop_WrapText, mso_wrapSquare ) != mso_wrapNone ? sal_False : sal_True ) );
  //	rSet.Put( SdrTextAutoGrowHeightItem( ( GetPropertyValue( DFF_Prop_FitTextToShape ) & 2 ) != 0 ) );
-@@ -5802,6 +5811,9 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
+@@ -5587,6 +5596,9 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
              }
              else
              {
@@ -54,18 +51,10 @@
                  aSet.Put( SdrTextAutoGrowWidthItem( FALSE ) );
              }
 diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
-index b71a616..aaa3648 100644
+index 40d9ee8..4a576be 100644
 --- svx/source/svdraw/svdedxv.cxx
 +++ svx/source/svdraw/svdedxv.cxx
-@@ -138,6 +138,7 @@ void SdrObjEditView::ImpClearVars()
-     pTextEditWin=NULL;
-     pTextEditCursorMerker=NULL;
-     pEditPara=NULL;
-+    bInDownScale=FALSE;
-     bTextEditNewObj=FALSE;
-     bMacroDown=FALSE;
-     pMacroObj=NULL;
-@@ -364,7 +365,7 @@ void SdrObjEditView::ImpPaintOutlinerView(OutlinerView& rOutlView, const Rectang
+@@ -318,7 +318,7 @@ void SdrObjEditView::ImpPaintOutlinerView(OutlinerView& rOutlView, const Rectang
  	{
  		const SdrTextObj* pText = PTR_CAST(SdrTextObj,GetTextEditObject());
  		bool bTextFrame(pText && pText->IsTextFrame());
@@ -74,7 +63,7 @@
  		bool bModifyMerk(pTextEditOutliner->IsModified()); // #43095#
  		Rectangle aBlankRect(rOutlView.GetOutputArea());
  		aBlankRect.Union(aMinTextEditArea);
-@@ -526,8 +527,15 @@ OutlinerView* SdrObjEditView::ImpMakeOutlinerView(Window* pWin, BOOL /*bNoPaint*
+@@ -485,8 +485,15 @@ OutlinerView* SdrObjEditView::ImpMakeOutlinerView(Window* pWin, BOOL /*bNoPaint*
      // Scrollen verbieten
      ULONG nStat=pOutlView->GetControlWord();
      nStat&=~EV_CNTRL_AUTOSCROLL;
@@ -92,138 +81,51 @@
      if (bTextFrame) {
          USHORT nPixSiz=aHdl.GetHdlSize()*2+1;
          nStat|=EV_CNTRL_INVONEMORE;
-@@ -566,7 +574,125 @@ IMPL_LINK(SdrObjEditView,ImpOutlinerStatusEventHdl,EditStatus*,pEditStat)
-     BOOL bAutoGrowHgt= bTextFrame && pTextObj->IsAutoGrowHeight();
-     BOOL bAutoGrowWdt= bTextFrame && pTextObj->IsAutoGrowWidth();
- 
--    if ((bGrowX && bAutoGrowWdt) || (bGrowY && bAutoGrowHgt))
-+    const SdrFitToSizeType eFit = pTextObj->GetFitToSize();
-+    if( (bGrowX || bGrowY) &&
-+        (eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES) )
-+    {
-+        const Size aShapeSize = pTextObj->GetLastBoundRect().GetSize();
-+        const Size aCurrTextSize = pTextEditOutliner->CalcTextSize();
-+        const double fFactor( 
-+            std::min( 
-+                double(aShapeSize.Width())/
-+                (aCurrTextSize.Width()+pTextObj->GetTextLeftDistance()+pTextObj->GetTextRightDistance()),
-+                double(aShapeSize.Height())/
-+                (aCurrTextSize.Height()+pTextObj->GetTextUpperDistance()+pTextObj->GetTextLowerDistance())));
-+#if 0
-+			SfxItemSet	aSet( pSdrModel->GetItemPool() );
-+			SdrFitToSizeType eFTS = SDRTEXTFIT_PROPORTIONAL;
-+			aSet.Put( SdrTextFitToSizeTypeItem( eFTS ) );
-+            pNewObj->SetMergedItemSet(rSet);
-+#endif
-+
-+        USHORT nOldStretchX, nOldStretchY;
-+        pTextEditOutliner->GetGlobalCharStretching(nOldStretchX, nOldStretchY);
-+
-+        if( !bInDownScale && (fFactor < 1.0 || (fFactor >= 1.0 && nOldStretchX != 100)) )
-+        {
-+            bInDownScale = TRUE;
-+
-+            BOOL bOldUpdateMode = pTextEditOutliner->GetUpdateMode();
-+            pTextEditOutliner->SetUpdateMode( FALSE );
-+            
-+            pTextEditOutliner->SetControlWord(
-+                pTextEditOutliner->GetControlWord()|EE_CNTRL_STRETCHING);
-+
-+            nOldStretchX = sal::static_int_cast<USHORT>(nOldStretchX*fFactor);
-+            nOldStretchY = sal::static_int_cast<USHORT>(nOldStretchY*fFactor);
-+            pTextEditOutliner->SetGlobalCharStretching(std::min(USHORT(100),nOldStretchX),
-+                                                       std::min(USHORT(100),nOldStretchY));
-+
-+            OSL_TRACE("SdrObjEditView::ImpOutlinerStatusEventHdl: shrink factor is %f, shrink X: %d, shrink Y: %d\n", fFactor, nOldStretchX, nOldStretchY);
-+
-+            pTextEditOutliner->SetUpdateMode( bOldUpdateMode );
-+
-+            ULONG nOutlViewAnz=pTextEditOutliner->GetViewCount();
-+
-+                for (ULONG nOV=0; nOV<nOutlViewAnz; nOV++)
-+				{
-+                    OutlinerView* pOLV=pTextEditOutliner->GetView(nOV);
-+                    { // Alten OutlinerView-Bereich invalidieren
-+                        Window* pWin=pOLV->GetWindow();
-+                        Rectangle aTmpRect(aOldArea);
-+                        USHORT nPixSiz=pOLV->GetInvalidateMore()+1;
-+                        Size aMore(pWin->PixelToLogic(Size(nPixSiz,nPixSiz)));
-+                        aTmpRect.Left()-=aMore.Width();
-+                        aTmpRect.Right()+=aMore.Width();
-+                        aTmpRect.Top()-=aMore.Height();
-+                        aTmpRect.Bottom()+=aMore.Height();
-+                        InvalidateOneWin(*pWin,aTmpRect);
-+                    }
-+                    if (bAnchorChg)
-+						pOLV->SetAnchorMode(eNewAnchor);
-+                    if (bColorChg)
-+						pOLV->SetBackgroundColor( aNewColor );
-+
-+					pOLV->SetOutputArea(aTextEditArea); // weil sonst scheinbar nicht richtig umgeankert wird
-+                    ImpInvalidateOutlinerView(*pOLV);
-+                }
-+
-+void SdrObjEditView::ImpInvalidateOutlinerView(OutlinerView& rOutlView) const
-+{
-+    Window* pWin = rOutlView.GetWindow();
-+
-+	if(pWin)
-+	{
-+		const SdrTextObj* pText = PTR_CAST(SdrTextObj,GetTextEditObject());
-+		bool bTextFrame(pText && pText->IsTextFrame());
-+		bool bFitToSize(0 != (pTextEditOutliner->GetControlWord() & EE_CNTRL_STRETCHING));
-+
-+		if(bTextFrame && !bFitToSize) 
-+		{
-+			Rectangle aBlankRect(rOutlView.GetOutputArea());
-+			aBlankRect.Union(aMinTextEditArea);
-+			Rectangle aPixRect(pWin->LogicToPixel(aBlankRect));
-+			sal_uInt16 nPixSiz(rOutlView.GetInvalidateMore() - 1);
-+
-+			aPixRect.Left()--;
-+			aPixRect.Top()--;
-+			aPixRect.Right()++;
-+			aPixRect.Bottom()++;
-+			
-+			{ 
-+				// xPixRect Begrenzen, wegen Treiberproblem bei zu weit hinausragenden Pixelkoordinaten
-+				Size aMaxXY(pWin->GetOutputSizePixel());
-+				long a(2 * nPixSiz);
-+				long nMaxX(aMaxXY.Width() + a);
-+				long nMaxY(aMaxXY.Height() + a);
-+
-+				if (aPixRect.Left  ()<-a) aPixRect.Left()=-a;
-+				if (aPixRect.Top   ()<-a) aPixRect.Top ()=-a;
-+				if (aPixRect.Right ()>nMaxX) aPixRect.Right ()=nMaxX;
-+				if (aPixRect.Bottom()>nMaxY) aPixRect.Bottom()=nMaxY;
-+			}
-+
-+			Rectangle aOuterPix(aPixRect);
-+			aOuterPix.Left()-=nPixSiz;
-+			aOuterPix.Top()-=nPixSiz;
-+			aOuterPix.Right()+=nPixSiz;
-+			aOuterPix.Bottom()+=nPixSiz;
-+
-+			bool bMerk(pWin->IsMapModeEnabled());
-+			pWin->EnableMapMode(FALSE);
-+			pWin->Invalidate(aOuterPix);
-+			pWin->EnableMapMode(bMerk);
-+		}
-+	}
-+}
-+
-+            bInDownScale = FALSE;
-+        }
-+    }
-+    else if ((bGrowX && bAutoGrowWdt) || (bGrowY && bAutoGrowHgt))
- 	{
-         pTextObj->AdjustTextFrameWidthAndHeight();
-     }
 diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
-index 400e95b..9b095c4 100644
+index 65d164b..4cfa426 100644
 --- svx/source/svdraw/svdotext.cxx
 +++ svx/source/svdraw/svdotext.cxx
-@@ -1182,7 +1182,7 @@ void SdrTextObj::ImpSetCharStretching(SdrOutliner& rOutliner, const Rectangle& r
+@@ -140,6 +140,7 @@ SdrTextObj::SdrTextObj()
+ 
+ 	// #i25616#
+ 	mbSupportTextIndentingOnLineWidthChange = sal_True;
++    mbInDownScale = sal_False;
+ }
+ 
+ SdrTextObj::SdrTextObj(const Rectangle& rNewRect)
+@@ -165,6 +166,7 @@ SdrTextObj::SdrTextObj(const Rectangle& rNewRect)
+ 
+ 	// #111096#
+ 	mbTextAnimationAllowed = sal_True;
++    mbInDownScale = sal_False;
+ 
+ 	// #108784#
+ 	maTextEditOffset = Point(0, 0);
+@@ -195,6 +197,7 @@ SdrTextObj::SdrTextObj(SdrObjKind eNewTextKind)
+ 
+ 	// #111096#
+ 	mbTextAnimationAllowed = sal_True;
++    mbInDownScale = sal_False;
+ 
+ 	// #108784#
+ 	maTextEditOffset = Point(0, 0);
+@@ -227,6 +230,7 @@ SdrTextObj::SdrTextObj(SdrObjKind eNewTextKind, const Rectangle& rNewRect)
+ 
+ 	// #111096#
+ 	mbTextAnimationAllowed = sal_True;
++    mbInDownScale = sal_False;
+ 
+ 	// #108784#
+ 	maTextEditOffset = Point(0, 0);
+@@ -261,6 +265,7 @@ SdrTextObj::SdrTextObj(SdrObjKind eNewTextKind, const Rectangle& rNewRect, SvStr
+ 
+ 	// #111096#
+ 	mbTextAnimationAllowed = sal_True;
++    mbInDownScale = sal_False;
+ 
+ 	// #108784#
+ 	maTextEditOffset = Point(0, 0);
+@@ -1077,7 +1082,7 @@ void SdrTextObj::ImpSetCharStretching(SdrOutliner& rOutliner, const Rectangle& r
  			bNoMoreLoop = TRUE;
  		}
  
@@ -232,3 +134,54 @@
  		nLoopCount++;
  		Size aSiz(rOutliner.CalcTextSize());
  		long nXDiff=aSiz.Width()-nWantWdt;
+@@ -2414,10 +2419,47 @@ void SdrTextObj::onEditOutlinerStatusEvent( EditStatus* pEditStatus )
+ 	const bool bGrowY=(nStat & EE_STAT_TEXTHEIGHTCHANGED) !=0;
+     if(bTextFrame && (bGrowX || bGrowY))
+ 	{
+-		const bool bAutoGrowHgt= bTextFrame && IsAutoGrowHeight();
+-		const bool bAutoGrowWdt= bTextFrame && IsAutoGrowWidth();
++        // auto-shrink text when GetFitToSize() demands it
++        const SdrFitToSizeType eFit = GetFitToSize();
++        if( (bGrowX || bGrowY) &&
++            (eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES) )
++        {
++            const Size aShapeSize = GetLastBoundRect().GetSize();
++            const Size aCurrTextSize = pEdtOutl->CalcTextSize();
++            const double fFactor( 
++                std::min( 
++                    double(aShapeSize.Width())/
++                    (aCurrTextSize.Width()+GetTextLeftDistance()+GetTextRightDistance()),
++                    double(aShapeSize.Height())/
++                    (aCurrTextSize.Height()+GetTextUpperDistance()+GetTextLowerDistance())));
++
++            USHORT nOldStretchX, nOldStretchY;
++            pEdtOutl->GetGlobalCharStretching(nOldStretchX, nOldStretchY);
++
++            // only do the scaling once (we'll get notified again, recursively)
++            if( !mbInDownScale && (fFactor < 1.0 || (fFactor >= 1.0 && nOldStretchX != 100)) )
++            {
++                mbInDownScale = sal_True;
++
++                BOOL bOldUpdateMode = pEdtOutl->GetUpdateMode();
++                pEdtOutl->SetUpdateMode( FALSE );
++            
++                pEdtOutl->SetControlWord(
++                    pEdtOutl->GetControlWord()|EE_CNTRL_STRETCHING);
++
++                nOldStretchX = sal::static_int_cast<USHORT>(nOldStretchX*fFactor);
++                nOldStretchY = sal::static_int_cast<USHORT>(nOldStretchY*fFactor);
++                pEdtOutl->SetGlobalCharStretching(std::min(USHORT(100),nOldStretchX),
++                                                           std::min(USHORT(100),nOldStretchY));
+ 
+-	    if ((bGrowX && bAutoGrowWdt) || (bGrowY && bAutoGrowHgt))
++                OSL_TRACE("SdrObjEditView::ImpOutlinerStatusEventHdl: shrink factor is %f, shrink X: %d, shrink Y: %d\n", fFactor, nOldStretchX, nOldStretchY);
++
++                pEdtOutl->SetUpdateMode( bOldUpdateMode );
++
++                mbInDownScale = sal_False;
++            }
++        }
++        else if ((bGrowX && IsAutoGrowWidth()) || (bGrowY && IsAutoGrowHeight()))
+ 		{
+ 			AdjustTextFrameWidthAndHeight();
+ 		}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]