[Libreoffice-commits] .: 2 commits - sfx2/inc sfx2/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Dec 12 01:20:25 PST 2012


 sfx2/inc/sfx2/templateabstractview.hxx        |    4 ----
 sfx2/inc/sfx2/thumbnailview.hxx               |    4 ++++
 sfx2/inc/sfx2/thumbnailviewitem.hxx           |    1 +
 sfx2/inc/templatedlg.hxx                      |    2 +-
 sfx2/source/appl/appopen.cxx                  |    2 +-
 sfx2/source/control/templateabstractview.cxx  |   18 +++++-------------
 sfx2/source/control/templatelocalview.cxx     |    3 +++
 sfx2/source/control/templatelocalviewitem.cxx |    6 +++++-
 sfx2/source/control/templateview.cxx          |   18 +++++++++++++++---
 sfx2/source/control/templateviewitem.cxx      |    6 +++++-
 sfx2/source/control/thumbnailview.cxx         |   20 ++++++++++++++++++--
 sfx2/source/doc/objserv.cxx                   |    2 +-
 12 files changed, 59 insertions(+), 27 deletions(-)

New commits:
commit 32ca77577f781010aa4549016adaebff1a5a3624
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date:   Wed Dec 12 10:07:24 2012 +0100

    Template manager: dialog has no parent to show 'X' button
    
    Change-Id: I1d7806a125fb34000f588f0936b48dd7ce411356

diff --git a/sfx2/inc/templatedlg.hxx b/sfx2/inc/templatedlg.hxx
index c0d1284..ae2cb16 100644
--- a/sfx2/inc/templatedlg.hxx
+++ b/sfx2/inc/templatedlg.hxx
@@ -37,7 +37,7 @@ class SfxTemplateManagerDlg : public ModelessDialog
 {
 public:
 
-    SfxTemplateManagerDlg (Window *parent = NULL);
+    SfxTemplateManagerDlg (Window *parent = DIALOG_NO_PARENT);
 
     ~SfxTemplateManagerDlg ();
 
diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx
index afddf87..9a295b7 100644
--- a/sfx2/source/appl/appopen.cxx
+++ b/sfx2/source/appl/appopen.cxx
@@ -566,7 +566,7 @@ void SfxApplication::NewDocExec_Impl( SfxRequest& rReq )
         sal_Bool bNewWin = sal_False;
         Window* pTopWin = GetTopWindow();
 
-        SfxTemplateManagerDlg aTemplDlg(NULL);
+        SfxTemplateManagerDlg aTemplDlg;
         int nRet = aTemplDlg.Execute();
         if ( nRet == RET_OK )
         {
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 722c00f..7d313e7 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -863,7 +863,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
         case SID_DOCTEMPLATE:
         {
             // save as document templates
-            SfxTemplateManagerDlg aDlg(NULL);
+            SfxTemplateManagerDlg aDlg;
             aDlg.setDocumentModel(GetModel());
             aDlg.setSaveMode(true);
             aDlg.Execute();
commit d4dc0293a839e615f302d27b92e008d5d0f7d511
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date:   Tue Dec 11 17:19:11 2012 +0100

    Template Manager: better show the folder overlay.
    
    Still to be improved:
     - Add some shadow
     - White background colors is may be not ideal
    
    Change-Id: Id89320ebef8ee95ed24a844bbd98e3bd6bebc678

diff --git a/sfx2/inc/sfx2/templateabstractview.hxx b/sfx2/inc/sfx2/templateabstractview.hxx
index 4eb7e6f..9194b8e 100644
--- a/sfx2/inc/sfx2/templateabstractview.hxx
+++ b/sfx2/inc/sfx2/templateabstractview.hxx
@@ -118,10 +118,6 @@ protected:
 
     virtual void Resize();
 
-    virtual void Paint( const Rectangle& rRect );
-
-    virtual void DrawItem (ThumbnailViewItem *pItem);
-
     DECL_LINK(OverlayItemStateHdl, const ThumbnailViewItem*);
 
 protected:
diff --git a/sfx2/inc/sfx2/thumbnailview.hxx b/sfx2/inc/sfx2/thumbnailview.hxx
index 6ebe23f..935624b 100644
--- a/sfx2/inc/sfx2/thumbnailview.hxx
+++ b/sfx2/inc/sfx2/thumbnailview.hxx
@@ -225,6 +225,8 @@ public:
 
     Color GetColor() const { return maColor; }
 
+    void SetTransparence( double nTransparence );
+
     bool IsColor() const { return maColor.GetTransparency() == 0; }
 
     Size CalcWindowSizePixel(sal_uInt16 nCalcCols, sal_uInt16 nCalcLines,
@@ -304,6 +306,7 @@ protected:
     ScrollBar* mpScrBar;
     Rectangle maItemListRect;
     long mnHeaderHeight;
+    long mnFooterHeight;
     long mnItemWidth;
     long mnItemHeight;
     long mnItemPadding;
@@ -321,6 +324,7 @@ protected:
     bool mbIsTransientChildrenDisabled : 1;
     bool mbHasVisibleItems : 1;
     Color maColor;
+    double mnTransparence;
 
     Link maItemStateHdl;
     ThumbnailItemAttributes *mpItemAttrs;
diff --git a/sfx2/inc/sfx2/thumbnailviewitem.hxx b/sfx2/inc/sfx2/thumbnailviewitem.hxx
index 9609667..e454599 100644
--- a/sfx2/inc/sfx2/thumbnailviewitem.hxx
+++ b/sfx2/inc/sfx2/thumbnailviewitem.hxx
@@ -53,6 +53,7 @@ struct ThumbnailItemAttributes
 {
     sal_uInt32 nMaxTextLenght;
     basegfx::BColor aFillColor;
+    double nFillTransparence;
     basegfx::BColor aHighlightColor;
     basegfx::B2DVector aFontSize;
     drawinglayer::attribute::FontAttribute aFontAttr;
diff --git a/sfx2/source/control/templateabstractview.cxx b/sfx2/source/control/templateabstractview.cxx
index 5d5cd3e..a93ccdc 100644
--- a/sfx2/source/control/templateabstractview.cxx
+++ b/sfx2/source/control/templateabstractview.cxx
@@ -268,19 +268,11 @@ BitmapEx TemplateAbstractView::fetchThumbnail (const OUString &msURL, long width
 
 void TemplateAbstractView::Resize()
 {
-    mpItemView->SetSizePixel(GetSizePixel());
-}
-
-void TemplateAbstractView::Paint(const Rectangle &rRect)
-{
-    if (!mpItemView->IsVisible())
-        ThumbnailView::Paint(rRect);
-}
-
-void TemplateAbstractView::DrawItem(ThumbnailViewItem *pItem)
-{
-    if (!mpItemView->IsVisible())
-        ThumbnailView::DrawItem(pItem);
+    Size aSize = GetSizePixel();
+    aSize.setHeight(aSize.getHeight() * 0.5);
+    aSize.setWidth(aSize.getWidth() - 20);
+    Point aPos(10, 10);
+    mpItemView->SetPosSizePixel(aPos, aSize);
 }
 
 IMPL_LINK(TemplateAbstractView, OverlayItemStateHdl, const ThumbnailViewItem*, pItem)
diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx
index 557b8ff..5147014 100644
--- a/sfx2/source/control/templatelocalview.cxx
+++ b/sfx2/source/control/templatelocalview.cxx
@@ -230,7 +230,10 @@ void TemplateLocalView::showOverlay (bool bVisible)
         }
 
         mpItemView->Clear();
+        SetTransparence(0.0);
     }
+    else
+        SetTransparence(0.5);
 }
 
 void TemplateLocalView::filterTemplatesByApp (const FILTER_APPLICATION &eApp)
diff --git a/sfx2/source/control/templatelocalviewitem.cxx b/sfx2/source/control/templatelocalviewitem.cxx
index 54ba379..025cf5f 100644
--- a/sfx2/source/control/templatelocalviewitem.cxx
+++ b/sfx2/source/control/templatelocalviewitem.cxx
@@ -17,6 +17,7 @@
 #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
 #include <drawinglayer/primitive2d/textlayoutdevice.hxx>
 #include <drawinglayer/primitive2d/textprimitive2d.hxx>
+#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
 #include <drawinglayer/processor2d/baseprocessor2d.hxx>
 #include <sfx2/templateviewitem.hxx>
 #include <vcl/button.hxx>
@@ -140,7 +141,10 @@ void TemplateLocalViewItem::Paint (drawinglayer::processor2d::BaseProcessor2D *p
                                                  com::sun::star::lang::Locale(),
                                                  Color(COL_BLACK).getBColor() ) );
 
-    pProcessor->process(aSeq);
+    Primitive2DSequence aTranspSeq(1);
+    aTranspSeq[0] = Primitive2DReference( new UnifiedTransparencePrimitive2D(aSeq, pAttrs->nFillTransparence));
+
+    pProcessor->process(aTranspSeq);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/control/templateview.cxx b/sfx2/source/control/templateview.cxx
index 0892a15..ff0e906 100644
--- a/sfx2/source/control/templateview.cxx
+++ b/sfx2/source/control/templateview.cxx
@@ -11,6 +11,8 @@
 
 #include <basegfx/matrix/b2dhommatrixtools.hxx>
 #include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
 #include <basegfx/range/b2drange.hxx>
 #include <basegfx/vector/b2dvector.hxx>
 #include <drawinglayer/attribute/fillbitmapattribute.hxx>
@@ -18,9 +20,11 @@
 #include <drawinglayer/primitive2d/textlayoutdevice.hxx>
 #include <drawinglayer/primitive2d/textprimitive2d.hxx>
 #include <drawinglayer/processor2d/baseprocessor2d.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
 #include <sfx2/sfxresid.hxx>
 #include <sfx2/templateviewitem.hxx>
 #include <vcl/edit.hxx>
+#include <vcl/scrbar.hxx>
 
 #include "templateview.hrc"
 
@@ -39,6 +43,7 @@ TemplateView::TemplateView (Window *pParent)
       mpEditName(new Edit(this, WB_BORDER | WB_HIDE))
 {
     mnHeaderHeight = 30;
+    mnFooterHeight = 5;
 }
 
 TemplateView::~TemplateView ()
@@ -57,7 +62,7 @@ void TemplateView::Paint (const Rectangle &rRect)
     ThumbnailView::Paint(rRect);
 
     int nCount = 0;
-    int nMaxCount = 1;
+    int nMaxCount = 2;
 
     if (mbRenderTitle)
         ++nMaxCount;
@@ -78,11 +83,14 @@ void TemplateView::Paint (const Rectangle &rRect)
                     mpItemAttrs->aFontSize.getX(), mpItemAttrs->aFontSize.getY(),
                     double( aPos.X() ), double( aPos.Y() ) ) );
 
+        const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+        B2DVector aFontSize;
+        FontAttribute aFontAttr = getFontAttributeFromVclFont(aFontSize, rStyleSettings.GetTitleFont(), false, false);
         aSeq[nCount++] = Primitive2DReference(
                     new TextSimplePortionPrimitive2D(aTextMatrix,
                                                      maName,0,maName.getLength(),
                                                      std::vector< double >( ),
-                                                     mpItemAttrs->aFontAttr,
+                                                     aFontAttr,
                                                      com::sun::star::lang::Locale(),
                                                      Color(COL_BLACK).getBColor() ) );
     }
@@ -93,7 +101,7 @@ void TemplateView::Paint (const Rectangle &rRect)
     aPos.Y() = (mnHeaderHeight - aImageSize.Height())/2;
     aPos.X() = aWinSize.Width() - aImageSize.Width() - aPos.Y();
 
-    aSeq[nCount] = Primitive2DReference( new FillBitmapPrimitive2D(
+    aSeq[nCount++] = Primitive2DReference( new FillBitmapPrimitive2D(
                                         createTranslateB2DHomMatrix(aPos.X(),aPos.Y()),
                                         FillBitmapAttribute(maCloseImg.GetBitmapEx(),
                                                             B2DPoint(0,0),
@@ -101,6 +109,10 @@ void TemplateView::Paint (const Rectangle &rRect)
                                                             false)
                                         ));
 
+    // TODO Draw some shadow
+    Rectangle aBounds(Point(0, 0), Size(aWinSize.getWidth() - 1, aWinSize.getHeight() - 1));
+    B2DPolygon aBoundsPolygon(Polygon(aBounds, 5, 5).getB2DPolygon());
+    aSeq[nCount] = Primitive2DReference( new PolyPolygonHairlinePrimitive2D(B2DPolyPolygon(aBoundsPolygon), Color(0,0,0).getBColor()));
     mpProcessor->process(aSeq);
 }
 
diff --git a/sfx2/source/control/templateviewitem.cxx b/sfx2/source/control/templateviewitem.cxx
index 51a2862..1cb3d23 100644
--- a/sfx2/source/control/templateviewitem.cxx
+++ b/sfx2/source/control/templateviewitem.cxx
@@ -17,6 +17,7 @@
 #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
 #include <drawinglayer/primitive2d/textlayoutdevice.hxx>
 #include <drawinglayer/primitive2d/textprimitive2d.hxx>
+#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
 #include <drawinglayer/processor2d/baseprocessor2d.hxx>
 #include <vcl/button.hxx>
 
@@ -138,7 +139,10 @@ void TemplateViewItem::Paint(drawinglayer::processor2d::BaseProcessor2D *pProces
                                                      Color(COL_BLACK).getBColor() ) );
     }
 
-    pProcessor->process(aSeq);
+    Primitive2DSequence aTranspSeq(1);
+    aTranspSeq[0] = Primitive2DReference( new UnifiedTransparencePrimitive2D(aSeq, pAttrs->nFillTransparence));
+
+    pProcessor->process(aTranspSeq);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx
index db8d626..0c0cec8 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -24,6 +24,7 @@
 #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
 #include <drawinglayer/primitive2d/textlayoutdevice.hxx>
 #include <drawinglayer/primitive2d/textprimitive2d.hxx>
+#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
 #include <drawinglayer/processor2d/baseprocessor2d.hxx>
 #include <drawinglayer/processor2d/processorfromoutputdevice.hxx>
 #include <rtl/ustring.hxx>
@@ -85,6 +86,7 @@ void ThumbnailView::ImplInit()
 {
     mpScrBar            = NULL;
     mnHeaderHeight      = 0;
+    mnFooterHeight      = 0;
     mnItemWidth         = 0;
     mnItemHeight        = 0;
     mnItemPadding = 0;
@@ -100,6 +102,7 @@ void ThumbnailView::ImplInit()
     mbHasVisibleItems   = false;
     maFilterFunc = ViewFilterAll();
     maColor = GetSettings().GetStyleSettings().GetFieldColor();
+    mnTransparence = 0.0;
 
     // Create the processor and process the primitives
     const drawinglayer::geometry::ViewInformation2D aNewViewInfos;
@@ -162,6 +165,7 @@ void ThumbnailView::ImplInitSettings( bool bFont, bool bForeground, bool bBackgr
 
     mpItemAttrs = new ThumbnailItemAttributes;
     mpItemAttrs->aFillColor = maColor.getBColor();
+    mpItemAttrs->nFillTransparence = mnTransparence;
     mpItemAttrs->aHighlightColor = rStyleSettings.GetHighlightColor().getBColor();
     mpItemAttrs->aFontAttr = getFontAttributeFromVclFont(mpItemAttrs->aFontSize,GetFont(),false,true);
     mpItemAttrs->nMaxTextLenght = -1;
@@ -373,7 +377,7 @@ void ThumbnailView::CalculateItemPositions ()
         long nLines = (nCurCount+mnCols-1)/mnCols;
 
         Point aPos( aWinSize.Width() - nScrBarWidth - mnScrBarOffset, mnHeaderHeight );
-        Size aSize( nScrBarWidth - mnScrBarOffset, aWinSize.Height() - mnHeaderHeight );
+        Size aSize( nScrBarWidth - mnScrBarOffset, aWinSize.Height() - mnHeaderHeight - mnFooterHeight );
 
         mpScrBar->SetPosSizePixel( aPos, aSize );
         mpScrBar->SetRangeMax( (nCurCount+mnCols-1)/mnCols);
@@ -558,7 +562,10 @@ void ThumbnailView::Paint( const Rectangle &aRect)
                                         B2DPolyPolygon(Polygon(aRect,5,5).getB2DPolygon()),
                                         maColor.getBColor()));
 
-    mpProcessor->process(aSeq);
+    Primitive2DSequence aTranspSeq(1);
+    aTranspSeq[0] = Primitive2DReference( new UnifiedTransparencePrimitive2D(aSeq, mnTransparence));
+
+    mpProcessor->process(aTranspSeq);
 
     // draw items
     for ( size_t i = 0; i < nItemCount; i++ )
@@ -909,6 +916,15 @@ void ThumbnailView::SetColor( const Color& rColor )
         Invalidate();
 }
 
+void ThumbnailView::SetTransparence( double nTransparence )
+{
+    mnTransparence = nTransparence;
+    mpItemAttrs->nFillTransparence = nTransparence;
+
+    if ( IsReallyVisible() && IsUpdateMode() )
+        Invalidate();
+}
+
 bool ThumbnailView::StartDrag( const CommandEvent& rCEvt, Region& rRegion )
 {
     if ( rCEvt.GetCommand() != COMMAND_STARTDRAG )


More information about the Libreoffice-commits mailing list