[Libreoffice-commits] .: Branch 'feature/template-dialog' - 11 commits - sfx2/inc sfx2/source
Rafael Dominguez
rdominguez at kemper.freedesktop.org
Sun Jul 1 09:10:09 PDT 2012
sfx2/inc/sfx2/templatefolderview.hxx | 4 +
sfx2/inc/sfx2/templateview.hxx | 12 ++++
sfx2/inc/sfx2/thumbnailview.hxx | 1
sfx2/inc/templatedlg.hxx | 4 +
sfx2/source/control/templatefolderview.cxx | 35 ++++++++++++-
sfx2/source/control/templateview.cxx | 75 ++++++++++++++++++++++++++++-
sfx2/source/control/thumbnailview.cxx | 13 ++---
sfx2/source/doc/templatedlg.cxx | 65 ++++++++++++++++++++++---
sfx2/source/doc/templatedlg.hrc | 8 ++-
sfx2/source/doc/templatedlg.src | 12 ++++
10 files changed, 209 insertions(+), 20 deletions(-)
New commits:
commit 4524c0c609c64d86f24b70d8c6e5e4cab262a4b7
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Sun Jul 1 09:01:30 2012 -0430
Delete templates when clicking the "No folder" option in move menu.
Change-Id: Ifcbcfc0623758b32eeb20e184c3dc0b5896851cb
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 81a9d63..4494065 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -454,6 +454,14 @@ IMPL_LINK(SfxTemplateManagerDlg, MoveMenuSelectHdl, Menu*, pMenu)
}
else if (nMenuId == MNI_MOVE_DELETE)
{
+ std::set<const ThumbnailViewItem*>::const_iterator pIter;
+ for (pIter = maSelTemplates.begin(); pIter != maSelTemplates.end();)
+ {
+ if (maView->removeTemplate((*pIter)->mnId))
+ maSelTemplates.erase(pIter++);
+ else
+ ++pIter;
+ }
}
else
{
commit dddc14f2365c188757a40ad3defdc6223df9f2c6
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Sun Jul 1 08:57:40 2012 -0430
Display "No folder" entry and append available folders in move menu.
Change-Id: Ic6dc682167aae2dc8354bb6f74dd3bee107630a9
diff --git a/sfx2/inc/templatedlg.hxx b/sfx2/inc/templatedlg.hxx
index 004974f..f729b6e 100644
--- a/sfx2/inc/templatedlg.hxx
+++ b/sfx2/inc/templatedlg.hxx
@@ -86,7 +86,6 @@ private:
TemplateFolderView *maView;
PopupMenu *mpCreateMenu;
PopupMenu *mpActionMenu;
- PopupMenu *mpMoveMenu;
int mnSelectionCount;
std::set<const ThumbnailViewItem*> maSelTemplates;
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 39efc52..81a9d63 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -92,10 +92,6 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent)
mpActionMenu->InsertItem(MNI_ACTION_SORT_NAME,SfxResId(STR_ACTION_SORT_NAME).toString());
mpActionMenu->SetSelectHdl(LINK(this,SfxTemplateManagerDlg,MenuSelectHdl));
- mpMoveMenu = new PopupMenu;
- mpMoveMenu->InsertItem(MNI_MOVE_NEW,SfxResId(STR_MOVE_NEW).toString());
- mpMoveMenu->SetSelectHdl(LINK(this,SfxTemplateManagerDlg,MoveMenuSelectHdl));
-
Size aWinSize = GetOutputSize();
// Calculate thumbnail view minimum size
@@ -206,7 +202,6 @@ SfxTemplateManagerDlg::~SfxTemplateManagerDlg ()
delete maView;
delete mpCreateMenu;
delete mpActionMenu;
- delete mpMoveMenu;
}
IMPL_LINK_NOARG(SfxTemplateManagerDlg,ViewAllHdl)
@@ -335,15 +330,38 @@ IMPL_LINK(SfxTemplateManagerDlg, TBXDropdownHdl, ToolBox*, pBox)
pBox->Invalidate();
break;
case TBI_TEMPLATE_MOVE:
+ {
pBox->SetItemDown( nCurItemId, true );
- mpMoveMenu->Execute(pBox,pBox->GetItemRect(TBI_TEMPLATE_MOVE),
+ std::vector<rtl::OUString> aNames = maView->getFolderNames();
+
+ PopupMenu *pMoveMenu = new PopupMenu;
+ pMoveMenu->SetSelectHdl(LINK(this,SfxTemplateManagerDlg,MoveMenuSelectHdl));
+
+ pMoveMenu->InsertItem(MNI_MOVE_NEW,SfxResId(STR_MOVE_NEW).toString());
+
+ if (!aNames.empty())
+ {
+ pMoveMenu->InsertSeparator();
+
+ for (size_t i = 0, n = aNames.size(); i < n; ++i)
+ pMoveMenu->InsertItem(MNI_MOVE_FOLDER_BASE+i,aNames[i]);
+ }
+
+ pMoveMenu->InsertSeparator();
+
+ pMoveMenu->InsertItem(MNI_MOVE_DELETE,SfxResId(STR_MOVE_DELETE).toString());
+
+ pMoveMenu->Execute(pBox,pBox->GetItemRect(TBI_TEMPLATE_MOVE),
POPUPMENU_EXECUTE_DOWN);
+ delete pMoveMenu;
+
pBox->SetItemDown( nCurItemId, false );
pBox->EndSelection();
pBox->Invalidate();
break;
+ }
default:
break;
}
@@ -434,6 +452,9 @@ IMPL_LINK(SfxTemplateManagerDlg, MoveMenuSelectHdl, Menu*, pMenu)
if (nMenuId == MNI_MOVE_NEW)
{
}
+ else if (nMenuId == MNI_MOVE_DELETE)
+ {
+ }
else
{
}
diff --git a/sfx2/source/doc/templatedlg.hrc b/sfx2/source/doc/templatedlg.hrc
index a978f31..245466f 100644
--- a/sfx2/source/doc/templatedlg.hrc
+++ b/sfx2/source/doc/templatedlg.hrc
@@ -46,8 +46,10 @@
#define STR_ACTION_SORT_NAME 264
#define MNI_MOVE_NEW 265
-#define MNI_MOVE_FOLDER_BASE 266
+#define MNI_MOVE_DELETE 266
+#define MNI_MOVE_FOLDER_BASE 267
-#define STR_MOVE_NEW 267
+#define STR_MOVE_NEW 268
+#define STR_MOVE_DELETE 270
#define IMG_ONLINE_REPOSITORY 100
diff --git a/sfx2/source/doc/templatedlg.src b/sfx2/source/doc/templatedlg.src
index 3876396..f4b6962 100644
--- a/sfx2/source/doc/templatedlg.src
+++ b/sfx2/source/doc/templatedlg.src
@@ -40,6 +40,11 @@ String STR_MOVE_NEW
Text [ en-US ] = "New folder";
};
+String STR_MOVE_DELETE
+{
+ Text [ en-US ] = "No folder";
+};
+
ModalDialog DLG_TEMPLATE_MANAGER
{
HelpId = CMD_SID_TEMPLATE_MANAGER;
commit bbd206d6fb2fcecec51c2703e42b9e275b740c2e
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Fri Jun 29 21:37:47 2012 -0430
Set scrollbar offset as a class attribute.
Change-Id: I4127b799937771c99b69ecb8a29729c8bc3a31cc
diff --git a/sfx2/inc/sfx2/thumbnailview.hxx b/sfx2/inc/sfx2/thumbnailview.hxx
index 9c40f70..2d6bb20 100644
--- a/sfx2/inc/sfx2/thumbnailview.hxx
+++ b/sfx2/inc/sfx2/thumbnailview.hxx
@@ -335,6 +335,7 @@ protected:
long mnLines;
long mnUserItemWidth;
long mnUserItemHeight;
+ sal_uInt16 mnScrBarOffset;
sal_uInt16 mnSelItemId;
sal_uInt16 mnHighItemId;
sal_uInt16 mnCols;
diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx
index 46b0e0e..4a5ebc4 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -48,7 +48,6 @@ enum
NAME_LINE_OFF_Y = 2,
NAME_LINE_HEIGHT = 2,
NAME_OFFSET = 2,
- SCRBAR_OFFSET = 1,
SCROLL_OFFSET = 4
};
@@ -94,6 +93,7 @@ void ThumbnailView::ImplInit()
mnUserItemWidth = 0;
mnUserItemHeight = 0;
mnFirstLine = 0;
+ mnScrBarOffset = 1;
mnSelItemId = 0;
mnHighItemId = 0;
mnCols = 0;
@@ -250,7 +250,7 @@ void ThumbnailView::CalculateItemPositions ()
// calculate ScrollBar width
long nScrBarWidth = 0;
if ( mpScrBar )
- nScrBarWidth = mpScrBar->GetSizePixel().Width()+SCRBAR_OFFSET;
+ nScrBarWidth = mpScrBar->GetSizePixel().Width()+mnScrBarOffset;
// calculate maximum number of visible columns
mnCols = (sal_uInt16)((aWinSize.Width()-nScrBarWidth) / (mnItemWidth));
@@ -366,8 +366,8 @@ void ThumbnailView::CalculateItemPositions ()
// arrange ScrollBar, set values and show it
if ( mpScrBar )
{
- Point aPos( aWinSize.Width()-nScrBarWidth+SCRBAR_OFFSET, mnHeaderHeight );
- Size aSize( nScrBarWidth-SCRBAR_OFFSET, aWinSize.Height() - mnHeaderHeight );
+ Point aPos( aWinSize.Width() - nScrBarWidth - mnScrBarOffset, mnHeaderHeight );
+ Size aSize( nScrBarWidth - mnScrBarOffset, aWinSize.Height() - mnHeaderHeight );
mpScrBar->SetPosSizePixel( aPos, aSize );
mpScrBar->SetRangeMax( mnLines );
@@ -1238,7 +1238,7 @@ long ThumbnailView::GetScrollWidth() const
if ( GetStyle() & WB_VSCROLL )
{
((ThumbnailView*)this)->ImplInitScrollBar();
- return mpScrBar->GetSizePixel().Width()+SCRBAR_OFFSET;
+ return mpScrBar->GetSizePixel().Width()+mnScrBarOffset;
}
else
return 0;
commit 4863f32f39e730b62ed26ff5689712530de1d811
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Fri Jun 29 21:00:09 2012 -0430
Increase space between folder items.
Change-Id: I39655f4f11e223f16a23a976c469c0db5fa3fdd0
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index b2f6d59..39efc52 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -34,7 +34,7 @@
#define ITEM_MAX_WIDTH 192
#define ITEM_MAX_HEIGHT 192
#define ITEM_PADDING 5
-#define ITEM_SPACE 20
+#define ITEM_SPACE 30
#define ITEM_MAX_TEXT_LENGTH 20
#define THUMBNAIL_MAX_HEIGHT 128
commit 1710ad0793fd3edaf65d26bb4acc1ecc8873b5b3
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Fri Jun 29 20:56:56 2012 -0430
Close dialog after selecting a template to work on.
Change-Id: I5fc929ae08f05dbaab2680a527fe339a066cd5bc
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index b1eff28..b2f6d59 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -457,6 +457,8 @@ IMPL_LINK(SfxTemplateManagerDlg, OpenTemplateHdl, ThumbnailViewItem*, pItem)
{
}
+ Close();
+
return 0;
}
commit f55ae0944196f44bc10484b84e50a991b54c9d9c
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Fri Jun 29 20:52:34 2012 -0430
Horizontal center overlay.
Change-Id: I9343351dd300cc1a4350903d3f01e4a233b93feb
diff --git a/sfx2/inc/sfx2/templatefolderview.hxx b/sfx2/inc/sfx2/templatefolderview.hxx
index cf94930..9b23005 100644
--- a/sfx2/inc/sfx2/templatefolderview.hxx
+++ b/sfx2/inc/sfx2/templatefolderview.hxx
@@ -56,6 +56,8 @@ public:
private:
+ virtual void Resize ();
+
virtual void OnSelectionMode (bool bMode);
virtual void OnItemDblClicked (ThumbnailViewItem *pRegionItem);
diff --git a/sfx2/source/control/templatefolderview.cxx b/sfx2/source/control/templatefolderview.cxx
index d784851..15ac471 100644
--- a/sfx2/source/control/templatefolderview.cxx
+++ b/sfx2/source/control/templatefolderview.cxx
@@ -255,7 +255,6 @@ TemplateFolderView::TemplateFolderView ( Window* pParent, const ResId& rResId, b
ITEM_MAX_WIDTH,ITEM_MAX_HEIGHT,ITEM_SPACE);
mpItemView->SetColor(Color(COL_WHITE));
- mpItemView->SetPosPixel(Point(0,0));
mpItemView->SetSizePixel(aViewSize);
mpItemView->setItemDimensions(ITEM_MAX_WIDTH,THUMBNAIL_MAX_HEIGHT,
ITEM_MAX_HEIGHT-THUMBNAIL_MAX_HEIGHT,
@@ -446,6 +445,17 @@ void TemplateFolderView::copyFrom (TemplateFolderViewItem *pItem, const rtl::OUS
}
}
+void TemplateFolderView::Resize()
+{
+ Size aWinSize = GetOutputSize();
+ Size aViewSize = mpItemView->GetSizePixel();
+
+ Point aPos;
+ aPos.setX((aWinSize.getWidth() - aViewSize.getWidth())/2);
+
+ mpItemView->SetPosPixel(aPos);
+}
+
void TemplateFolderView::OnSelectionMode (bool bMode)
{
if (mpItemView->IsVisible())
commit a049352ac90700181007623603b3e301c66bb20b
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Fri Jun 29 20:16:18 2012 -0430
Rename a folder by clicking on the name in the overlay.
Change-Id: I1b3b118667d268bbcda1f1500a2ec2d6916b8f78
diff --git a/sfx2/inc/sfx2/templatefolderview.hxx b/sfx2/inc/sfx2/templatefolderview.hxx
index 87cfb14..cf94930 100644
--- a/sfx2/inc/sfx2/templatefolderview.hxx
+++ b/sfx2/inc/sfx2/templatefolderview.hxx
@@ -62,6 +62,8 @@ private:
DECL_LINK(TVTemplateStateHdl, const ThumbnailViewItem*);
+ DECL_LINK(ChangeNameHdl, TemplateView*);
+
private:
bool mbFilteredResults; // Flag keep track if overlay has been filtered so folders can get filtered too afterwards
diff --git a/sfx2/inc/sfx2/templateview.hxx b/sfx2/inc/sfx2/templateview.hxx
index 45f755a..ba9baa0 100644
--- a/sfx2/inc/sfx2/templateview.hxx
+++ b/sfx2/inc/sfx2/templateview.hxx
@@ -13,6 +13,7 @@
#include <sfx2/thumbnailview.hxx>
#include <vcl/image.hxx>
+class Edit;
class SfxDocumentTemplates;
class TemplateViewItem;
@@ -28,6 +29,8 @@ public:
sal_uInt16 getRegionId () const { return mnRegionId; }
+ const rtl::OUString& getRegionName () const { return maFolderName; }
+
virtual void Paint (const Rectangle &rRect);
void InsertItem (const TemplateViewItem *pItem);
@@ -36,12 +39,18 @@ public:
void setDblClickHdl (const Link &rLink) { maDblClickHdl = rLink; }
+ void setChangeNameHdl (const Link &rLink) { maChangeNameHdl = rLink; }
+
protected:
+ virtual void Resize ();
+
virtual void MouseButtonDown (const MouseEvent &rMEvt);
virtual void OnItemDblClicked (ThumbnailViewItem *pItem);
+ DECL_LINK (ChangeNameHdl, void*);
+
private:
Image maCloseImg;
@@ -49,6 +58,9 @@ private:
rtl::OUString maFolderName;
SfxDocumentTemplates *mpDocTemplates;
Link maDblClickHdl;
+ Link maChangeNameHdl;
+
+ Edit *mpEditName;
};
#endif // TEMPLATEVIEW_HXX
diff --git a/sfx2/source/control/templatefolderview.cxx b/sfx2/source/control/templatefolderview.cxx
index 68f622b..d784851 100644
--- a/sfx2/source/control/templatefolderview.cxx
+++ b/sfx2/source/control/templatefolderview.cxx
@@ -262,6 +262,7 @@ TemplateFolderView::TemplateFolderView ( Window* pParent, const ResId& rResId, b
ITEM_PADDING);
mpItemView->setItemStateHdl(LINK(this,TemplateFolderView,TVTemplateStateHdl));
+ mpItemView->setChangeNameHdl(LINK(this,TemplateFolderView,ChangeNameHdl));
}
TemplateFolderView::~TemplateFolderView()
@@ -479,6 +480,26 @@ IMPL_LINK(TemplateFolderView, TVTemplateStateHdl, const ThumbnailViewItem*, pIte
return 0;
}
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+IMPL_LINK(TemplateFolderView, ChangeNameHdl, TemplateView*, pView)
+{
+ sal_uInt16 nRegionId = pView->getRegionId();
+ sal_uInt16 nItemId = nRegionId + 1;
+ if (!mpDocTemplates->SetName(pView->getRegionName(),nRegionId,USHRT_MAX))
+ return false;
+ for (size_t i = 0; i < mItemList.size(); ++i)
+ {
+ if (mItemList[i]->mnId == nItemId)
+ {
+ mItemList[i]->maText = pView->getRegionName();
+ mItemList[i]->calculateItemsPosition(mpItemAttrs->nMaxTextLenght);
+ Invalidate();
+ break;
+ }
+ }
+
+ return true;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/control/templateview.cxx b/sfx2/source/control/templateview.cxx
index f0f0ed9..c757356 100644
--- a/sfx2/source/control/templateview.cxx
+++ b/sfx2/source/control/templateview.cxx
@@ -11,6 +11,7 @@
#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/range/b2drange.hxx>
#include <basegfx/vector/b2dvector.hxx>
#include <drawinglayer/attribute/fillbitmapattribute.hxx>
#include <drawinglayer/primitive2d/fillbitmapprimitive2d.hxx>
@@ -20,9 +21,13 @@
#include <sfx2/doctempl.hxx>
#include <sfx2/sfxresid.hxx>
#include <sfx2/templateviewitem.hxx>
+#include <vcl/edit.hxx>
#include "templateview.hrc"
+#define EDIT_WIDTH 180
+#define EDIT_HEIGHT 20
+
using namespace basegfx;
using namespace basegfx::tools;
using namespace drawinglayer::attribute;
@@ -32,9 +37,12 @@ TemplateView::TemplateView (Window *pParent, SfxDocumentTemplates *pTemplates)
: ThumbnailView(pParent,WB_VSCROLL),
maCloseImg(SfxResId(IMG_TEMPLATE_VIEW_CLOSE)),
mnRegionId(0),
- mpDocTemplates(pTemplates)
+ mpDocTemplates(pTemplates),
+ mpEditName(new Edit(this, WB_BORDER | WB_HIDE))
{
mnHeaderHeight = 30;
+
+ mpEditName->SetSizePixel(Size(EDIT_WIDTH,EDIT_HEIGHT));
}
TemplateView::~TemplateView ()
@@ -45,6 +53,7 @@ void TemplateView::setRegionId (const sal_uInt16 nRegionId)
{
mnRegionId = nRegionId;
maFolderName = mpDocTemplates->GetRegionName(nRegionId);
+ mpEditName->SetText(rtl::OUString());
}
void TemplateView::Paint (const Rectangle &rRect)
@@ -129,10 +138,46 @@ void TemplateView::InsertItems (const std::vector<TemplateViewItem*> &rTemplates
Invalidate();
}
+void TemplateView::Resize()
+{
+ // Set editbox size and position
+ Size aEditSize = mpEditName->GetSizePixel();
+ Size aWinSize = GetOutputSize();
+
+ Point aPos;
+ aPos.X() = (aWinSize.getWidth() - aEditSize.getWidth())/2;
+ aPos.Y() = (mnHeaderHeight - aEditSize.getHeight())/2;
+
+ mpEditName->SetPosPixel(aPos);
+
+ ThumbnailView::Resize();
+}
+
void TemplateView::MouseButtonDown (const MouseEvent &rMEvt)
{
if (rMEvt.IsLeft())
{
+ // Check if we are editing title
+ if (mpEditName->IsVisible())
+ {
+ mpEditName->Show(false);
+
+ // Update name if its not empty
+ rtl::OUString aTmp = mpEditName->GetText();
+
+ if (!aTmp.isEmpty())
+ {
+ PostUserEvent(LINK(this,TemplateView,ChangeNameHdl));
+ }
+ else
+ {
+ mpEditName->SetText(rtl::OUString());
+ Invalidate();
+ }
+
+ return;
+ }
+
Size aWinSize = GetOutputSizePixel();
Size aImageSize = maCloseImg.GetSizePixel();
@@ -147,6 +192,20 @@ void TemplateView::MouseButtonDown (const MouseEvent &rMEvt)
Show(false);
Clear();
}
+ else
+ {
+ drawinglayer::primitive2d::TextLayouterDevice aTextDev;
+
+ float fTextWidth = aTextDev.getTextWidth(maFolderName,0,maFolderName.getLength());
+
+ aPos.X() = (aWinSize.getWidth() - fTextWidth)/2;
+ aPos.Y() = (mnHeaderHeight - aTextDev.getTextHeight())/2;
+
+ Rectangle aTitleRect(aPos,Size(fTextWidth,aTextDev.getTextHeight()));
+
+ if (aTitleRect.IsInside(rMEvt.GetPosPixel()))
+ mpEditName->Show();
+ }
}
ThumbnailView::MouseButtonDown(rMEvt);
@@ -157,6 +216,20 @@ void TemplateView::OnItemDblClicked(ThumbnailViewItem *pItem)
maDblClickHdl.Call(pItem);
}
+IMPL_LINK_NOARG(TemplateView, ChangeNameHdl)
+{
+ rtl::OUString aTmp = maFolderName;
+ maFolderName = mpEditName->GetText();
+
+ if (!maChangeNameHdl.Call(this))
+ maFolderName = aTmp;
+
+ mpEditName->SetText(rtl::OUString());
+
+ Invalidate();
+ return 0;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit d1a5c90d52d9cae18b02fd826ee10ae77d8569be
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Fri Jun 29 13:16:38 2012 -0430
Display scrollbar only if its really needed.
Change-Id: I4bedf7cfe5378087466100f8b60f07de5908d8d4
diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx
index b17b467..46b0e0e 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -377,7 +377,7 @@ void ThumbnailView::CalculateItemPositions ()
if ( nPageSize < 1 )
nPageSize = 1;
mpScrBar->SetPageSize( nPageSize );
- mpScrBar->Show();
+ mpScrBar->Show(mbScroll);
}
// delete ScrollBar
commit 94e0c2473ad23924dc5d85c503bd612659dda589
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Fri Jun 29 13:11:34 2012 -0430
Dont display a scrollbar in folder view.
Change-Id: I7a56b2c13ace9c08c31e24a8b9da83756dbb3626
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index fb48b90..b1eff28 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -154,7 +154,7 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent)
mpSearchEdit->SetSizePixel(aSearchSize);
mpSearchEdit->SetPosPixel(Point(PADDING_DLG_BORDER,aActionPos.Y()+aActionSize.getHeight()));
- maView->SetStyle(WB_TABSTOP | WB_VSCROLL);
+ maView->SetStyle(WB_TABSTOP);
maView->SetColor(GetBackground().GetColor());
maView->SetSizePixel(aThumbSize);
maView->setItemMaxTextLength(ITEM_MAX_TEXT_LENGTH);
commit ea508ce93296a56a537c219879d3b5aa11f969fa
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Fri Jun 29 13:02:48 2012 -0430
Add a close button to the dialog.
Change-Id: I2bf1006107b29ce2b105830b3daf41870c5629ba
diff --git a/sfx2/inc/templatedlg.hxx b/sfx2/inc/templatedlg.hxx
index b406d25..004974f 100644
--- a/sfx2/inc/templatedlg.hxx
+++ b/sfx2/inc/templatedlg.hxx
@@ -45,6 +45,8 @@ private:
virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ DECL_LINK(CloseHdl, void*);
+
DECL_LINK(OnClickSelectionMode, ImageButton*);
DECL_LINK(TBXViewHdl, void*);
@@ -74,6 +76,7 @@ private:
PushButton aButtonPresents;
PushButton aButtonSheets;
PushButton aButtonDraws;
+ PushButton maButtonClose;
ImageButton maButtonSelMode;
Edit *mpSearchEdit;
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 4a3eb37..fb48b90 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -68,6 +68,7 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent)
aButtonPresents(this,SfxResId(BTN_SELECT_PRESENTATIONS)),
aButtonSheets(this,SfxResId(BTN_SELECT_SHEETS)),
aButtonDraws(this,SfxResId(BTN_SELECT_DRAWS)),
+ maButtonClose(this,SfxResId(BTN_TEMPLATE_CLOSE)),
maButtonSelMode(this,SfxResId(BTN_SELECTION_MODE)),
mpSearchEdit(new Edit(this,WB_HIDE | WB_BORDER)),
mpViewBar( new ToolBox(this, SfxResId(TBX_ACTION_VIEW))),
@@ -166,11 +167,22 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent)
maView->setTemplateStateHdl(LINK(this,SfxTemplateManagerDlg,TVTemplateStateHdl));
maView->setOverlayDblClickHdl(LINK(this,SfxTemplateManagerDlg,OpenTemplateHdl));
+ // Set OK button position
+ Point aBtnPos;
+ Size aBtnSize = maButtonClose.GetSizePixel();
+ aBtnPos.setX(aWinSize.getWidth() - PADDING_DLG_BORDER - aBtnSize.getWidth());
+ aBtnPos.setY(aViewPos.getY()+aThumbSize.getHeight() + PADDING_TOOLBAR_VIEW);
+ maButtonClose.SetPosPixel(aBtnPos);
+
+ if (aWinSize.getHeight() != aBtnPos.getY() + aBtnSize.getHeight() + PADDING_DLG_BORDER )
+ aWinSize.setHeight(aBtnPos.getY() + aBtnSize.getHeight() + PADDING_DLG_BORDER);
+
aButtonAll.SetClickHdl(LINK(this,SfxTemplateManagerDlg,ViewAllHdl));
aButtonDocs.SetClickHdl(LINK(this,SfxTemplateManagerDlg,ViewDocsHdl));
aButtonPresents.SetClickHdl(LINK(this,SfxTemplateManagerDlg,ViewPresentsHdl));
aButtonSheets.SetClickHdl(LINK(this,SfxTemplateManagerDlg,ViewSheetsHdl));
aButtonDraws.SetClickHdl(LINK(this,SfxTemplateManagerDlg,ViewDrawsHdl));
+ maButtonClose.SetClickHdl(LINK(this,SfxTemplateManagerDlg,CloseHdl));
maButtonSelMode.SetClickHdl(LINK(this,SfxTemplateManagerDlg,OnClickSelectionMode));
// Set dialog to correct dimensions
@@ -233,6 +245,12 @@ void SfxTemplateManagerDlg::MouseButtonDown( const MouseEvent& rMEvt )
maView->showOverlay(false);
}
+IMPL_LINK_NOARG (SfxTemplateManagerDlg, CloseHdl)
+{
+ Close();
+ return 0;
+}
+
IMPL_LINK (SfxTemplateManagerDlg, OnClickSelectionMode, ImageButton*, pButton)
{
maView->setSelectionMode(pButton->GetState() == STATE_CHECK);
diff --git a/sfx2/source/doc/templatedlg.hrc b/sfx2/source/doc/templatedlg.hrc
index 5fbbfab..a978f31 100644
--- a/sfx2/source/doc/templatedlg.hrc
+++ b/sfx2/source/doc/templatedlg.hrc
@@ -36,6 +36,8 @@
#define MNI_ACTION_SORT_NAME 23
+#define BTN_TEMPLATE_CLOSE 24
+
#define STR_CREATE_TEXT 260
#define STR_CREATE_SHEET 261
#define STR_CREATE_PRESENT 262
diff --git a/sfx2/source/doc/templatedlg.src b/sfx2/source/doc/templatedlg.src
index 48bee92..3876396 100644
--- a/sfx2/source/doc/templatedlg.src
+++ b/sfx2/source/doc/templatedlg.src
@@ -106,6 +106,13 @@ ModalDialog DLG_TEMPLATE_MANAGER
QuickHelpText [en-US] = "Enables selecting items by just clicking in the thumbnail or title.";
};
+ PushButton BTN_TEMPLATE_CLOSE
+ {
+ Size = MAP_APPFONT(50,14);
+ TabStop = TRUE;
+ Text [en-US] = "Close";
+ };
+
Control TEMPLATE_VIEW
{
Pos = MAP_APPFONT(5,30);
commit fd4ba654170c7142fb05f2183ec43384f55dfbda
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Fri Jun 29 11:05:39 2012 -0430
Display scrollbar and take into account header size for dimensions.
Change-Id: Iff580a408077e7320d532d1d4c1c7af8b6932910
diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx
index 7905e94..b17b467 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -366,8 +366,8 @@ void ThumbnailView::CalculateItemPositions ()
// arrange ScrollBar, set values and show it
if ( mpScrBar )
{
- Point aPos( aWinSize.Width()-nScrBarWidth+SCRBAR_OFFSET, 0 );
- Size aSize( nScrBarWidth-SCRBAR_OFFSET, aWinSize.Height() );
+ Point aPos( aWinSize.Width()-nScrBarWidth+SCRBAR_OFFSET, mnHeaderHeight );
+ Size aSize( nScrBarWidth-SCRBAR_OFFSET, aWinSize.Height() - mnHeaderHeight );
mpScrBar->SetPosSizePixel( aPos, aSize );
mpScrBar->SetRangeMax( mnLines );
@@ -377,6 +377,7 @@ void ThumbnailView::CalculateItemPositions ()
if ( nPageSize < 1 )
nPageSize = 1;
mpScrBar->SetPageSize( nPageSize );
+ mpScrBar->Show();
}
// delete ScrollBar
@@ -808,7 +809,7 @@ void ThumbnailView::Paint( const Rectangle &aRect)
}
if ( mpScrBar && mpScrBar->IsVisible() )
- mpScrBar->Invalidate();
+ mpScrBar->Paint(aRect);
}
void ThumbnailView::GetFocus()
More information about the Libreoffice-commits
mailing list