[Libreoffice-commits] core.git: 3 commits - drawinglayer/source filter/source sd/source vcl/source

Armin Le Grand alg at apache.org
Tue Jun 11 03:31:24 PDT 2013


 drawinglayer/source/processor2d/vclhelperbitmaprender.cxx |    5 +
 filter/source/msfilter/escherex.cxx                       |   49 ++++++++------
 sd/source/filter/eppt/eppt.cxx                            |    6 +
 sd/source/filter/eppt/epptbase.hxx                        |    1 
 sd/source/filter/eppt/pptx-epptbase.cxx                   |    1 
 vcl/source/window/menu.cxx                                |   42 ++++++++----
 6 files changed, 70 insertions(+), 34 deletions(-)

New commits:
commit dbc7c605d65cc2dc37af3d2077ac553754bc4f7d
Author: Armin Le Grand <alg at apache.org>
Date:   Tue Oct 9 14:41:38 2012 +0000

    Resolves: #i121183# enhance export of ppt hatch masterpagebackground
    
    (cherry picked from commit 60f299f255a8a2fd2c4aabde6933d4388af3643b)
    
    Conflicts:
    	filter/source/msfilter/escherex.cxx
    	sd/source/filter/eppt/eppt.cxx
    	sd/source/filter/eppt/eppt.hxx
    
    Change-Id: I62d772ab67ed03bfa964040bd07b3684cf2dee8f

diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index c530081..a517f32 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -1389,26 +1389,30 @@ sal_Bool EscherPropertyContainer::CreateEmbeddedBitmapProperties(
 
 namespace {
 
-GraphicObject lclDrawHatch( const ::com::sun::star::drawing::Hatch& rHatch, const Color& rBackColor, bool bFillBackground )
+GraphicObject lclDrawHatch( const ::com::sun::star::drawing::Hatch& rHatch, const Color& rBackColor, bool bFillBackground, const Rectangle& rRect )
 {
-    const MapMode aMap100( MAP_100TH_MM );
-    VirtualDevice aVDev( *Application::GetDefaultDevice(), 0, 1 );
-    aVDev.SetMapMode( aMap100 );
-
-    const Size aOutSize = aVDev.PixelToLogic( Size( 28, 28 ) );
-    aVDev.SetOutputSize( aOutSize );
-
-    Rectangle aRectangle( Point( 0, 0 ), aOutSize );
-    const PolyPolygon aPolyPoly( aRectangle );
-
-    aVDev.SetLineColor();
-    aVDev.SetFillColor( bFillBackground ? rBackColor : Color( COL_TRANSPARENT ) );
-    aVDev.DrawRect( Rectangle( Point(), aOutSize ) );
-
-    Hatch aVclHatch( (HatchStyle) rHatch.Style, Color( rHatch.Color ), rHatch.Distance, (sal_uInt16)rHatch.Angle );
-    aVDev.DrawHatch( aPolyPoly, aVclHatch );
-
-    return GraphicObject( Graphic( aVDev.GetBitmapEx( Point(), aOutSize ) ) );
+    // #i121183# For hatch, do no longer create a bitmap with the fixed size of 28x28 pixels. Also
+    // do not create a bitmap in page size, that would explode file sizes (and have no good quality).
+    // Better use a MetaFile graphic in page size; thus we have good quality due to vector format and
+    // no bit file sizes.
+    VirtualDevice aOut;
+    GDIMetaFile aMtf;
+
+    aOut.SetOutputSizePixel(Size(2, 2));
+    aOut.EnableOutput(false);
+    aOut.SetMapMode(MapMode(MAP_100TH_MM));
+    aMtf.Clear();
+    aMtf.Record(&aOut);
+    aOut.SetLineColor();
+    aOut.SetFillColor(bFillBackground ? rBackColor : Color(COL_TRANSPARENT));
+    aOut.DrawRect(rRect);
+    aOut.DrawHatch(PolyPolygon(rRect), Hatch((HatchStyle)rHatch.Style, Color(rHatch.Color), rHatch.Distance, (sal_uInt16)rHatch.Angle));
+    aMtf.Stop();
+    aMtf.WindStart();
+    aMtf.SetPrefMapMode(MapMode(MAP_100TH_MM));
+    aMtf.SetPrefSize(rRect.GetSize());
+
+    return GraphicObject(Graphic(aMtf));
 }
 
 } // namespace
@@ -1416,7 +1420,8 @@ GraphicObject lclDrawHatch( const ::com::sun::star::drawing::Hatch& rHatch, cons
 
 sal_Bool EscherPropertyContainer::CreateEmbeddedHatchProperties( const ::com::sun::star::drawing::Hatch& rHatch, const Color& rBackColor, bool bFillBackground )
 {
-    GraphicObject aGraphicObject = lclDrawHatch( rHatch, rBackColor, bFillBackground );
+    const Rectangle aRect(pShapeBoundRect ? *pShapeBoundRect : Rectangle(Point(0,0), Size(28000, 21000)));
+    GraphicObject aGraphicObject = lclDrawHatch( rHatch, rBackColor, bFillBackground, aRect );
     OString aUniqueId = aGraphicObject.GetUniqueID();
     sal_Bool bRetValue = ImplCreateEmbeddedBmp( aUniqueId );
     if ( bRetValue )
@@ -1515,7 +1520,9 @@ sal_Bool EscherPropertyContainer::CreateGraphicProperties(
                 {
                     aAny >>= bFillBackground;
                 }
-                aGraphicObject = lclDrawHatch( aHatch, aBackColor, bFillBackground );
+
+                const Rectangle aRect(Point(0, 0), pShapeBoundRect ? pShapeBoundRect->GetSize() : Size(28000, 21000));
+                aGraphicObject = lclDrawHatch( aHatch, aBackColor, bFillBackground, aRect );
                 aUniqueId = aGraphicObject.GetUniqueID();
                 eBitmapMode = ::com::sun::star::drawing::BitmapMode_REPEAT;
                 bIsGraphicMtf = aGraphicObject.GetType() == GRAPHIC_GDIMETAFILE;
diff --git a/sd/source/filter/eppt/eppt.cxx b/sd/source/filter/eppt/eppt.cxx
index dc05938..861d06a 100644
--- a/sd/source/filter/eppt/eppt.cxx
+++ b/sd/source/filter/eppt/eppt.cxx
@@ -1202,8 +1202,10 @@ void PPTWriter::ImplWriteBackground( ::com::sun::star::uno::Reference< ::com::su
 
     mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
     mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xc00 );                     // Flags: Connector | Background | HasSpt
-    Point aEmptyPoint = Point();
-    Rectangle aRect( aEmptyPoint, Size( 28000, 21000 ) );
+
+    // #i121183# Use real PageSize in 100th mm
+    Rectangle aRect(Point(0, 0), Size(maPageSize.Width, maPageSize.Height));
+
     EscherPropertyContainer aPropOpt( mpPptEscherEx->GetGraphicProvider(), mpPicStrm, aRect );
     aPropOpt.AddOpt( ESCHER_Prop_fillType, ESCHER_FillSolid );
     ::com::sun::star::drawing::FillStyle aFS( ::com::sun::star::drawing::FillStyle_NONE );
diff --git a/sd/source/filter/eppt/epptbase.hxx b/sd/source/filter/eppt/epptbase.hxx
index f84360d..212e3e3 100644
--- a/sd/source/filter/eppt/epptbase.hxx
+++ b/sd/source/filter/eppt/epptbase.hxx
@@ -353,6 +353,7 @@ protected:
     MapMode                         maMapModeSrc;
     MapMode                         maMapModeDest;
     ::com::sun::star::awt::Size     maDestPageSize;
+    ::com::sun::star::awt::Size     maPageSize; // #i121183# Keep size in logic coordinates (100th mm)
     ::com::sun::star::awt::Size     maNotesPageSize;
 
     PageType                        meLatestPageType;
diff --git a/sd/source/filter/eppt/pptx-epptbase.cxx b/sd/source/filter/eppt/pptx-epptbase.cxx
index 8e9ff5c..7f829e9 100644
--- a/sd/source/filter/eppt/pptx-epptbase.cxx
+++ b/sd/source/filter/eppt/pptx-epptbase.cxx
@@ -197,6 +197,7 @@ void PPTWriterBase::exportPPT( const std::vector< com::sun::star::beans::Propert
     if ( ImplGetPropertyValue( mXPagePropSet, OUString( "Height" ) ) )
         mAny >>= nHeight;
     maDestPageSize = MapSize( awt::Size( nWidth, nHeight ) );
+    maPageSize = awt::Size(nWidth, nHeight);
 
     DBG(printf( "call exportDocumentPre()\n"));
     exportPPTPre(rMediaData);
commit 45d011ba375c469771ef652c25bd42ce85d3071f
Author: Armin Le Grand <alg at apache.org>
Date:   Fri Oct 5 10:23:37 2012 +0000

    Resolves: #i121153# adapted RenderBitmapPrimitive2D_self...
    
    bitmap transformation to metafile case where no destination bitmap size is
    given
    
    (cherry picked from commit 1f0b83f0e62094257a1c69ff18969f07422772dc)
    
    Change-Id: I12ece7aa36df6a9895303af59693de3b9813bb17

diff --git a/drawinglayer/source/processor2d/vclhelperbitmaprender.cxx b/drawinglayer/source/processor2d/vclhelperbitmaprender.cxx
index 37ee61d..3cd0bfb 100644
--- a/drawinglayer/source/processor2d/vclhelperbitmaprender.cxx
+++ b/drawinglayer/source/processor2d/vclhelperbitmaprender.cxx
@@ -167,6 +167,11 @@ namespace drawinglayer
             // take a rotation of 45 degrees (sqrt(2)) as maximum expansion into account
             const Size aSourceSizePixel(rBitmapEx.GetSizePixel());
             const double fMaximumArea(
+
+                // #i121153# With Metafile, aOutputRectPixel may be empty and a virtual
+                // maximum quadratic size has to be used
+                bRecordToMetaFile ? 500000.0 :
+
                 (double)aOutputRectPixel.getWidth() *
                 (double)aOutputRectPixel.getHeight() *
                 1.4142136); // 1.4142136 taken as sqrt(2.0)
commit 29474304550512f56ef597464bfdb5304bf56bb1
Author: Isamu Mogi <saturday6c at gmail.com>
Date:   Sat Jun 8 06:54:34 2013 +0000

    fdo#65450 Not to call MenuBar's selection logic for rollover effect
    
    Currently when we rollovers on MenuBar, MenuBar's selection logic
    (ChangeHighlightItem et al) is called. But calling these logic on background
    window seems to illegal and causes fdo#65450.

diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 9b4b32f..2d39189 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -676,6 +676,7 @@ private:
     Menu*           pMenu;
     PopupMenu*      pActivePopup;
     sal_uInt16          nHighlightedItem;
+    sal_uInt16          nRolloveredItem;
     sal_uLong           nSaveFocusId;
     sal_Bool            mbAutoPopup;
     sal_Bool            bIgnoreFirstMove;
@@ -5152,6 +5153,7 @@ MenuBarWindow::MenuBarWindow( Window* pParent ) :
     pActivePopup = NULL;
     nSaveFocusId = 0;
     nHighlightedItem = ITEMPOS_INVALID;
+    nRolloveredItem = ITEMPOS_INVALID;
     mbAutoPopup = sal_True;
     nSaveFocusId = 0;
     bIgnoreFirstMove = sal_True;
@@ -5416,11 +5418,29 @@ void MenuBarWindow::MouseMove( const MouseEvent& rMEvt )
     if ( rMEvt.IsSynthetic() || rMEvt.IsEnterWindow() )
         return;
 
-    if ( rMEvt.IsLeaveWindow() && !pActivePopup )
+    if ( rMEvt.IsLeaveWindow() )
     {
-        ChangeHighlightItem( ITEMPOS_INVALID, sal_False );
+        if ( nRolloveredItem != ITEMPOS_INVALID && nRolloveredItem != nHighlightedItem )
+            HighlightItem( nRolloveredItem, sal_False );
+
+        nRolloveredItem = ITEMPOS_INVALID;
+        return;
+    }
+
+    sal_uInt16 nEntry = ImplFindEntry( rMEvt.GetPosPixel() );
+    if ( nHighlightedItem == ITEMPOS_INVALID )
+    {
+        if ( nRolloveredItem != nEntry  )
+        {
+            if ( nRolloveredItem != ITEMPOS_INVALID )
+                HighlightItem( nRolloveredItem, sal_False );
+
+            nRolloveredItem = nEntry;
+            HighlightItem( nRolloveredItem, sal_True );
+        }
         return;
     }
+    nRolloveredItem = nEntry;
 
     if( bIgnoreFirstMove )
     {
@@ -5428,15 +5448,9 @@ void MenuBarWindow::MouseMove( const MouseEvent& rMEvt )
         return;
     }
 
-    sal_uInt16 nEntry = ImplFindEntry( rMEvt.GetPosPixel() );
     if ( ( nEntry != ITEMPOS_INVALID )
        && ( nEntry != nHighlightedItem ) )
-    {
-        if ( ! pActivePopup )
-            mbAutoPopup = sal_False;
-
         ChangeHighlightItem( nEntry, sal_False );
-    }
 }
 
 void MenuBarWindow::ChangeHighlightItem( sal_uInt16 n, sal_Bool bSelectEntry, sal_Bool bAllowRestoreFocus, sal_Bool bDefaultToDocument)
@@ -5505,13 +5519,19 @@ void MenuBarWindow::ChangeHighlightItem( sal_uInt16 n, sal_Bool bSelectEntry, sa
 
     if ( nHighlightedItem != ITEMPOS_INVALID )
     {
-        HighlightItem( nHighlightedItem, sal_False );
+        if ( nHighlightedItem != nRolloveredItem )
+            HighlightItem( nHighlightedItem, sal_False );
+
         pMenu->ImplCallEventListeners( VCLEVENT_MENU_DEHIGHLIGHT, nHighlightedItem );
     }
 
     nHighlightedItem = (sal_uInt16)n;
     DBG_ASSERT( ( nHighlightedItem == ITEMPOS_INVALID ) || pMenu->ImplIsVisible( nHighlightedItem ), "ChangeHighlightItem: Not visible!" );
-    HighlightItem( nHighlightedItem, sal_True );
+    if ( nHighlightedItem != ITEMPOS_INVALID )
+        HighlightItem( nHighlightedItem, sal_True );
+    else if ( nRolloveredItem != ITEMPOS_INVALID )
+        HighlightItem( nRolloveredItem, sal_True );
+
     pMenu->ImplCallHighlight( nHighlightedItem );
 
     if( mbAutoPopup )
@@ -5540,7 +5560,7 @@ void MenuBarWindow::HighlightItem( sal_uInt16 nPos, sal_Bool bHighlight )
                 Rectangle aRect = Rectangle( Point( nX, 1 ), Size( pData->aSz.Width(), GetOutputSizePixel().Height()-2 ) );
                 Push( PUSH_CLIPREGION );
                 IntersectClipRegion( aRect );
-                bool bRollover = bHighlight && ( !pActivePopup && !mbAutoPopup );
+                bool bRollover = bHighlight && nPos != nHighlightedItem;
                 if ( bHighlight )
                 {
                     if( IsNativeControlSupported( CTRL_MENUBAR, PART_MENU_ITEM ) &&


More information about the Libreoffice-commits mailing list