[Libreoffice-commits] .: Branch 'feature/template-dialog' - 4 commits - icon-themes/galaxy sfx2/inc sfx2/source

Rafael Dominguez rdominguez at kemper.freedesktop.org
Mon Jun 18 16:22:49 PDT 2012


 icon-themes/galaxy/sfx2/res/select.png    |binary
 sfx2/inc/sfx2/thumbnailviewitem.hxx       |    6 ++
 sfx2/source/control/thumbnailview.cxx     |   70 +++++++++++++++++++++++++-----
 sfx2/source/control/thumbnailviewitem.cxx |   17 +++++++
 sfx2/source/doc/templatedlg.src           |    2 
 5 files changed, 84 insertions(+), 11 deletions(-)

New commits:
commit e10392bb8c09c3a8e9b99f37d85f0814af372242
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Mon Jun 18 18:51:52 2012 -0430

    Set selection mode button image.
    
    Change-Id: I3fb2592d61622a0d3f07d70cfc26c10f4f2ef2fe

diff --git a/icon-themes/galaxy/sfx2/res/select.png b/icon-themes/galaxy/sfx2/res/select.png
new file mode 100644
index 0000000..9c7dba0
Binary files /dev/null and b/icon-themes/galaxy/sfx2/res/select.png differ
diff --git a/sfx2/source/doc/templatedlg.src b/sfx2/source/doc/templatedlg.src
index fa23895..6771611 100644
--- a/sfx2/source/doc/templatedlg.src
+++ b/sfx2/source/doc/templatedlg.src
@@ -70,7 +70,7 @@ ModalDialog DLG_TEMPLATE_MANAGER
 
         ButtonImage = Image
         {
-            ImageBitmap = Bitmap { File = "signet.png" ; };
+            ImageBitmap = Bitmap { File = "select.png" ; };
         };
     };
 
commit ecf97d7f60dc8dc0b3ce51300023bdee3e0e1e49
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Mon Jun 18 18:11:06 2012 -0430

    Paint item children control when painting an item.
    
    Change-Id: I7978e4c346d1a72b462d9916b7cdafc718a42bdc

diff --git a/sfx2/inc/sfx2/thumbnailviewitem.hxx b/sfx2/inc/sfx2/thumbnailviewitem.hxx
index f8c6c0f..7cc6252 100644
--- a/sfx2/inc/sfx2/thumbnailviewitem.hxx
+++ b/sfx2/inc/sfx2/thumbnailviewitem.hxx
@@ -89,6 +89,8 @@ struct ThumbnailViewItem
 
     bool isInsideTitle (const Point &pt) const;
 
+    void Paint (const Rectangle &aRect);
+
 private:
 
     DECL_LINK (OnClick, CheckBox *);
diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx
index 64b19ed..c8a2959 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -406,6 +406,8 @@ void ThumbnailView::DrawItem (ThumbnailViewItem *pItem)
                         *this, aNewViewInfos );
 
         pProcessor->process(aSeq);
+
+        pItem->Paint(aRect);
     }
 }
 
diff --git a/sfx2/source/control/thumbnailviewitem.cxx b/sfx2/source/control/thumbnailviewitem.cxx
index 873fb19..f86bfd0 100644
--- a/sfx2/source/control/thumbnailviewitem.cxx
+++ b/sfx2/source/control/thumbnailviewitem.cxx
@@ -149,6 +149,11 @@ bool ThumbnailViewItem::isInsideTitle (const Point &pt) const
     return aRect.IsInside(pt);
 }
 
+void ThumbnailViewItem::Paint (const Rectangle &aRect)
+{
+    mpSelectBox->Paint(aRect);
+}
+
 IMPL_LINK (ThumbnailViewItem, OnClick, CheckBox*, )
 {
     mbSelected = mpSelectBox->GetState() == STATE_CHECK;
commit 9dea0121b8f9c56ec172847ffa14fd353eda7faf
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Mon Jun 18 17:38:52 2012 -0430

    Control item visibility through the object instead of doing it directly.
    
    Change-Id: Ib70adb45d9ba5e1294abbe6b33b31be50cf554db

diff --git a/sfx2/inc/sfx2/thumbnailviewitem.hxx b/sfx2/inc/sfx2/thumbnailviewitem.hxx
index 730c4aa..f8c6c0f 100644
--- a/sfx2/inc/sfx2/thumbnailviewitem.hxx
+++ b/sfx2/inc/sfx2/thumbnailviewitem.hxx
@@ -56,6 +56,10 @@ struct ThumbnailViewItem
 
     ~ThumbnailViewItem ();
 
+    bool isVisible () const { return mbVisible; }
+
+    void show (bool bVisible);
+
     bool isSelected () const { return mbSelected; }
 
     void setSelection (bool state);
diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx
index 3e056a1..64b19ed 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -256,7 +256,7 @@ void ThumbnailView::ImplDeleteItems()
     for ( size_t i = 0; i < n; ++i )
     {
         ThumbnailViewItem *const pItem = mItemList[i];
-        if ( pItem->mbVisible && ImplHasAccessibleListeners() )
+        if ( pItem->isVisible() && ImplHasAccessibleListeners() )
         {
             ::com::sun::star::uno::Any aOldAny, aNewAny;
 
@@ -516,7 +516,7 @@ void ThumbnailView::CalculateItemPositions ()
 
         for ( size_t i = 0; i < nItemCount; i++ )
         {
-            mItemList[i]->mbVisible = false;
+            mItemList[i]->show(false);
         }
 
         if ( mpScrBar )
@@ -575,7 +575,7 @@ void ThumbnailView::CalculateItemPositions ()
 
             if ( (i >= nFirstItem) && (i < nLastItem) )
             {
-                if( !pItem->mbVisible && ImplHasAccessibleListeners() )
+                if( !pItem->isVisible() && ImplHasAccessibleListeners() )
                 {
                     ::com::sun::star::uno::Any aOldAny, aNewAny;
 
@@ -583,7 +583,7 @@ void ThumbnailView::CalculateItemPositions ()
                     ImplFireAccessibleEvent( ::com::sun::star::accessibility::AccessibleEventId::CHILD, aOldAny, aNewAny );
                 }
 
-                pItem->mbVisible = true;
+                pItem->show(true);
                 pItem->setDrawArea(Rectangle( Point(x,y), Size(mnItemWidth, mnItemHeight) ));
                 pItem->calculateItemsPosition();
 
@@ -597,7 +597,7 @@ void ThumbnailView::CalculateItemPositions ()
             }
             else
             {
-                if( pItem->mbVisible && ImplHasAccessibleListeners() )
+                if( pItem->isVisible() && ImplHasAccessibleListeners() )
                 {
                     ::com::sun::star::uno::Any aOldAny, aNewAny;
 
@@ -605,7 +605,7 @@ void ThumbnailView::CalculateItemPositions ()
                     ImplFireAccessibleEvent( ::com::sun::star::accessibility::AccessibleEventId::CHILD, aOldAny, aNewAny );
                 }
 
-                pItem->mbVisible = false;
+                pItem->show(false);
             }
         }
 
@@ -720,7 +720,7 @@ sal_uInt16 ThumbnailView::ImplGetVisibleItemCount() const
 
     for ( size_t n = 0; n < nItemCount; ++n )
     {
-        if ( mItemList[n]->mbVisible )
+        if ( mItemList[n]->isVisible() )
             ++nRet;
     }
 
@@ -735,7 +735,7 @@ ThumbnailViewItem* ThumbnailView::ImplGetVisibleItem( sal_uInt16 nVisiblePos )
     {
         ThumbnailViewItem *const pItem = mItemList[n];
 
-        if ( pItem->mbVisible && !nVisiblePos-- )
+        if ( pItem->isVisible() && !nVisiblePos-- )
             return pItem;
     }
 
@@ -791,7 +791,7 @@ IMPL_LINK( ThumbnailView,ImplScrollHdl, ScrollBar*, pScrollBar )
 
             if ( (i >= nFirstItem) && (i < nLastItem) )
             {
-                pItem->mbVisible = true;
+                pItem->show(true);
                 pItem->setDrawArea(Rectangle( Point(x,y), Size(mnItemWidth, mnItemHeight) ));
                 pItem->calculateItemsPosition();
 
@@ -805,7 +805,7 @@ IMPL_LINK( ThumbnailView,ImplScrollHdl, ScrollBar*, pScrollBar )
             }
             else
             {
-                pItem->mbVisible = false;
+                pItem->show(false);
             }
         }
 
@@ -1704,8 +1704,10 @@ void ThumbnailView::setSelectionMode (bool mode)
 
     for (size_t i = 0, n = mItemList.size(); i < n; ++i)
     {
-        if (mItemList[i]->mbVisible)
-            mItemList[i]->setSelectionMode(mode);
+        mItemList[i]->setSelectionMode(mode);
+
+        if (mItemList[i]->isVisible())
+            DrawItem(mItemList[i]);
     }
 }
 
diff --git a/sfx2/source/control/thumbnailviewitem.cxx b/sfx2/source/control/thumbnailviewitem.cxx
index f5fa81f..873fb19 100644
--- a/sfx2/source/control/thumbnailviewitem.cxx
+++ b/sfx2/source/control/thumbnailviewitem.cxx
@@ -60,6 +60,18 @@ ThumbnailViewItem::~ThumbnailViewItem()
     delete mpSelectBox;
 }
 
+void ThumbnailViewItem::show (bool bVisible)
+{
+    mbVisible = bVisible;
+
+    if (mbMode)
+        mpSelectBox->Show(bVisible);
+    else if (!bVisible)
+        mpSelectBox->Show(bVisible);
+    else if (mbSelected)
+        mpSelectBox->Show(bVisible);
+}
+
 void ThumbnailViewItem::setSelection (bool state)
 {
     mbSelected = state;
commit efd824cdde1d329181a2ac6da450d1c62673ddba
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Sun Jun 17 22:43:13 2012 -0430

    Recalculate item position when scrolling.
    
    Change-Id: I546119ab9d4ac21c86e5b0c98fa33608328e1ab3

diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx
index 33f8d13..3e056a1 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -763,6 +763,52 @@ IMPL_LINK( ThumbnailView,ImplScrollHdl, ScrollBar*, pScrollBar )
     {
         mnFirstLine = nNewFirstLine;
 
+        // Recalculate item positions
+        Size aWinSize = GetOutputSizePixel();
+        size_t nItemCount = mItemList.size();
+
+        // calculate offsets
+        long nStartX = 0;
+        long nStartY = 0;
+
+        // calculate items
+        long x = nStartX;
+        long y = nStartY;
+
+        // draw items
+        sal_uLong nFirstItem = mnFirstLine * mnCols;
+        sal_uLong nLastItem = nFirstItem + (mnVisLines * mnCols);
+
+        // If want also draw parts of items in the last line,
+        // then we add one more line if parts of these line are
+        // visible
+        if ( y+(mnVisLines*(mnItemHeight+mnSpacing)) < aWinSize.Height() )
+            nLastItem += mnCols;
+
+        for ( size_t i = 0; i < nItemCount; i++ )
+        {
+            ThumbnailViewItem *const pItem = mItemList[i];
+
+            if ( (i >= nFirstItem) && (i < nLastItem) )
+            {
+                pItem->mbVisible = true;
+                pItem->setDrawArea(Rectangle( Point(x,y), Size(mnItemWidth, mnItemHeight) ));
+                pItem->calculateItemsPosition();
+
+                if ( !((i+1) % mnCols) )
+                {
+                    x = nStartX;
+                    y += mnItemHeight+mnSpacing;
+                }
+                else
+                    x += mnItemWidth+mnSpacing;
+            }
+            else
+            {
+                pItem->mbVisible = false;
+            }
+        }
+
         if ( IsReallyVisible() && IsUpdateMode() )
             Invalidate();
     }


More information about the Libreoffice-commits mailing list