[Libreoffice-commits] .: 2 commits - sfx2/inc sfx2/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Jan 8 06:32:53 PST 2013
sfx2/inc/sfx2/templateabstractview.hxx | 7 ++--
sfx2/inc/sfx2/templatelocalview.hxx | 6 ---
sfx2/inc/sfx2/templateremoteview.hxx | 2 -
sfx2/inc/sfx2/templateview.hxx | 12 ++++--
sfx2/source/control/templateabstractview.cxx | 47 +++++++++++++++++++++++++--
sfx2/source/control/templatelocalview.cxx | 34 -------------------
sfx2/source/control/templateremoteview.cxx | 11 ------
sfx2/source/control/templateview.cxx | 5 --
sfx2/source/doc/templatedlg.cxx | 12 ++++--
9 files changed, 64 insertions(+), 72 deletions(-)
New commits:
commit 7d620e26070fda48f91a8ebe0a088224d6d19f75
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date: Tue Jan 8 15:21:51 2013 +0100
Template Manager: fixed select template and scroll caused trouble with toolbar
Selecting a template in the first row and scrolling down made some items
in the toolbar disappear... Fixed this by checking if the item to update
is already in the selection.
Change-Id: I2ddffae3a1c6092241afcf2acd212fe07b3a65ce
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index cfb979e..80f180a 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -502,6 +502,7 @@ IMPL_LINK(SfxTemplateManagerDlg, TVFolderStateHdl, const ThumbnailViewItem*, pIt
IMPL_LINK(SfxTemplateManagerDlg, TVTemplateStateHdl, const ThumbnailViewItem*, pItem)
{
+ bool bInSelection = maSelTemplates.find(pItem) != maSelTemplates.end();
if (pItem->isSelected())
{
if (!mbIsSaveMode)
@@ -512,7 +513,7 @@ IMPL_LINK(SfxTemplateManagerDlg, TVTemplateStateHdl, const ThumbnailViewItem*, p
mpActionBar->Show(false);
mpTemplateBar->Show();
}
- else
+ else if (maSelTemplates.size() != 1 || !bInSelection)
{
mpTemplateBar->HideItem(TBI_TEMPLATE_EDIT);
mpTemplateBar->HideItem(TBI_TEMPLATE_PROPERTIES);
@@ -520,11 +521,12 @@ IMPL_LINK(SfxTemplateManagerDlg, TVTemplateStateHdl, const ThumbnailViewItem*, p
}
}
- maSelTemplates.insert(pItem);
+ if (!bInSelection)
+ maSelTemplates.insert(pItem);
}
else
{
- if (maSelTemplates.find(pItem) != maSelTemplates.end())
+ if (bInSelection)
{
maSelTemplates.erase(pItem);
commit 8a2bfe697bf71c8a2ca3c6ba1ef5e6324d4163aa
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date: Fri Dec 21 15:37:49 2012 +0100
Templates Manager: merged the Double Click Handling into TemplateAbstractView
Change-Id: Iafc1650d57d29fbc24921498f18da6c0e510b37a
diff --git a/sfx2/inc/sfx2/templateabstractview.hxx b/sfx2/inc/sfx2/templateabstractview.hxx
index ca51181..a5fef71 100644
--- a/sfx2/inc/sfx2/templateabstractview.hxx
+++ b/sfx2/inc/sfx2/templateabstractview.hxx
@@ -87,7 +87,7 @@ public:
virtual void filterTemplatesByApp (const FILTER_APPLICATION &eApp);
- virtual void showOverlay (bool bVisible) = 0;
+ void showOverlay (bool bVisible);
void setItemDimensions (long ItemWidth, long ThumbnailHeight, long DisplayHeight, int itemPadding);
@@ -109,7 +109,7 @@ public:
void setOverlayItemStateHdl (const Link &aLink) { maOverlayItemStateHdl = aLink; }
- void setOverlayDblClickHdl (const Link &rLink);
+ void setOpenHdl (const Link &rLink);
void setOverlayCloseHdl (const Link &rLink);
@@ -127,10 +127,13 @@ protected:
DECL_LINK(OverlayItemStateHdl, const ThumbnailViewItem*);
+ virtual void OnItemDblClicked(ThumbnailViewItem *pItem);
+
protected:
TemplateView *mpItemView;
Link maOverlayItemStateHdl;
+ Link maOpenHdl;
bool mbFilteredResults; // Flag keep track if overlay has been filtered so folders can get filtered too afterwards
FILTER_APPLICATION meFilterOption;
diff --git a/sfx2/inc/sfx2/templatelocalview.hxx b/sfx2/inc/sfx2/templatelocalview.hxx
index e11c42b..5c54375 100644
--- a/sfx2/inc/sfx2/templatelocalview.hxx
+++ b/sfx2/inc/sfx2/templatelocalview.hxx
@@ -39,8 +39,6 @@ public:
std::vector<OUString> getFolderNames ();
- virtual void showOverlay (bool bVisible);
-
std::vector<TemplateItemProperties>
getFilteredItems (const boost::function<bool (const TemplateItemProperties&) > &rFunc) const;
@@ -73,10 +71,6 @@ public:
private:
- virtual void OnItemDblClicked (ThumbnailViewItem *pRegionItem);
-
-private:
-
SfxDocumentTemplates *mpDocTemplates;
};
diff --git a/sfx2/inc/sfx2/templateremoteview.hxx b/sfx2/inc/sfx2/templateremoteview.hxx
index bd1bf5c..b760f00 100644
--- a/sfx2/inc/sfx2/templateremoteview.hxx
+++ b/sfx2/inc/sfx2/templateremoteview.hxx
@@ -25,8 +25,6 @@ public:
virtual ~TemplateRemoteView ();
- virtual void showOverlay (bool bVisible);
-
bool loadRepository (TemplateRepository* pRepository, bool bRefresh);
private:
diff --git a/sfx2/inc/sfx2/templateview.hxx b/sfx2/inc/sfx2/templateview.hxx
index 6e81ea4..8ee529d 100644
--- a/sfx2/inc/sfx2/templateview.hxx
+++ b/sfx2/inc/sfx2/templateview.hxx
@@ -36,24 +36,26 @@ public:
void InsertItems (const std::vector<TemplateItemProperties> &rTemplates);
- void setDblClickHdl (const Link &rLink) { maDblClickHdl = rLink; }
-
void setCloseHdl (const Link &rLink) { maAllButton.SetClickHdl(rLink); }
+
+ // FIXME Kept only during the refactoring
+ void setOpenHdl (const Link &rLink) { maOpenHdl = rLink; }
+ virtual void OnItemDblClicked(ThumbnailViewItem *pItem) { maOpenHdl.Call(pItem); }
+
protected:
virtual void Resize ();
- virtual void OnItemDblClicked (ThumbnailViewItem *pItem);
-
private:
+ Link maOpenHdl;
+
Control maButtons;
PushButton maAllButton;
FixedText maFTName;
sal_uInt16 mnId;
OUString maName;
- Link maDblClickHdl;
};
#endif // TEMPLATEVIEW_HXX
diff --git a/sfx2/source/control/templateabstractview.cxx b/sfx2/source/control/templateabstractview.cxx
index 6db997b..c9ea989 100644
--- a/sfx2/source/control/templateabstractview.cxx
+++ b/sfx2/source/control/templateabstractview.cxx
@@ -175,15 +175,36 @@ void TemplateAbstractView::filterTemplatesByApp (const FILTER_APPLICATION &eApp)
}
}
+void TemplateAbstractView::showOverlay (bool bVisible)
+{
+ mpItemView->Show(bVisible);
+
+ // Clear items is the overlay is closed.
+ if (!bVisible)
+ {
+ // Check if the folder view needs to be filtered
+ if (mbFilteredResults)
+ {
+ filterItems(ViewFilter_Application(meFilterOption));
+
+ mbFilteredResults = false;
+ meFilterOption = FILTER_APP_NONE;
+ }
+
+ mpItemView->Clear();
+ }
+}
+
void TemplateAbstractView::filterTemplatesByKeyword(const OUString &rKeyword)
{
if (mpItemView->IsVisible())
mpItemView->filterItems(ViewFilter_Keyword(rKeyword));
}
-void TemplateAbstractView::setOverlayDblClickHdl(const Link &rLink)
+void TemplateAbstractView::setOpenHdl(const Link &rLink)
{
- mpItemView->setDblClickHdl(rLink);
+ maOpenHdl = rLink;
+ mpItemView->setOpenHdl(rLink);
}
void TemplateAbstractView::setOverlayCloseHdl(const Link &rLink)
@@ -351,4 +372,26 @@ IMPL_LINK(TemplateAbstractView, OverlayItemStateHdl, const ThumbnailViewItem*, p
return 0;
}
+void TemplateAbstractView::OnItemDblClicked (ThumbnailViewItem *pItem)
+{
+ TemplateContainerItem* pContainerItem = dynamic_cast<TemplateContainerItem*>(pItem);
+ if ( pContainerItem )
+ {
+ // Fill templates
+ sal_uInt16 nRegionId = pContainerItem->mnId-1;
+
+ mpItemView->setId(nRegionId);
+ mpItemView->setName(pContainerItem->maTitle);
+ mpItemView->InsertItems(pContainerItem->maTemplates);
+
+ mpItemView->filterItems(ViewFilter_Application(meFilterOption));
+
+ showOverlay(true);
+ }
+ else
+ {
+ maOpenHdl.Call(pItem);
+ }
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx
index 16dcc88..16b1b44 100644
--- a/sfx2/source/control/templatelocalview.cxx
+++ b/sfx2/source/control/templatelocalview.cxx
@@ -134,26 +134,6 @@ std::vector<OUString> TemplateLocalView::getFolderNames()
return ret;
}
-void TemplateLocalView::showOverlay (bool bVisible)
-{
- mpItemView->Show(bVisible);
-
- // Clear items is the overlay is closed.
- if (!bVisible)
- {
- // Check if the folder view needs to be filtered
- if (mbFilteredResults)
- {
- filterItems(ViewFilter_Application(meFilterOption));
-
- mbFilteredResults = false;
- meFilterOption = FILTER_APP_NONE;
- }
-
- mpItemView->Clear();
- }
-}
-
std::vector<TemplateItemProperties>
TemplateLocalView::getFilteredItems(const boost::function<bool (const TemplateItemProperties&) > &rFunc) const
{
@@ -608,20 +588,6 @@ bool TemplateLocalView::isTemplateNameUnique(const sal_uInt16 nRegionItemId, con
return true;
}
-void TemplateLocalView::OnItemDblClicked (ThumbnailViewItem *pRegionItem)
-{
- // Fill templates
- sal_uInt16 nRegionId = pRegionItem->mnId-1;
-
- mpItemView->setId(nRegionId);
- mpItemView->setName(mpDocTemplates->GetRegionName(nRegionId));
- mpItemView->InsertItems(static_cast<TemplateContainerItem*>(pRegionItem)->maTemplates);
-
- mpItemView->filterItems(ViewFilter_Application(meFilterOption));
-
- showOverlay(true);
-}
-
static void lcl_updateThumbnails (TemplateContainerItem *pItem)
{
pItem->maPreview1.Clear();
diff --git a/sfx2/source/control/templateremoteview.cxx b/sfx2/source/control/templateremoteview.cxx
index 9f84053..f89bbab 100644
--- a/sfx2/source/control/templateremoteview.cxx
+++ b/sfx2/source/control/templateremoteview.cxx
@@ -60,17 +60,6 @@ TemplateRemoteView::~TemplateRemoteView ()
{
}
-void TemplateRemoteView::showOverlay (bool bVisible)
-{
- mpItemView->Show(bVisible);
-
- // Clear items is the overlay is closed.
- if (!bVisible)
- {
- mpItemView->Clear();
- }
-}
-
bool TemplateRemoteView::loadRepository (TemplateRepository* pItem, bool bRefresh)
{
if (!pItem)
diff --git a/sfx2/source/control/templateview.cxx b/sfx2/source/control/templateview.cxx
index 2efbbda..01f9206 100644
--- a/sfx2/source/control/templateview.cxx
+++ b/sfx2/source/control/templateview.cxx
@@ -90,11 +90,6 @@ void TemplateView::Resize()
ThumbnailView::Resize();
}
-void TemplateView::OnItemDblClicked(ThumbnailViewItem *pItem)
-{
- maDblClickHdl.Call(pItem);
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 48a7cff..cfb979e 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -154,7 +154,7 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent)
maView->setItemStateHdl(LINK(this,SfxTemplateManagerDlg,TVFolderStateHdl));
maView->setOverlayItemStateHdl(LINK(this,SfxTemplateManagerDlg,TVTemplateStateHdl));
- maView->setOverlayDblClickHdl(LINK(this,SfxTemplateManagerDlg,OpenTemplateHdl));
+ maView->setOpenHdl(LINK(this,SfxTemplateManagerDlg,OpenTemplateHdl));
maView->setOverlayCloseHdl(LINK(this,SfxTemplateManagerDlg,CloseOverlayHdl));
// Set online view position and dimensions
@@ -165,7 +165,7 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent)
TEMPLATE_ITEM_PADDING);
mpOnlineView->setOverlayItemStateHdl(LINK(this,SfxTemplateManagerDlg,TVTemplateStateHdl));
- mpOnlineView->setOverlayDblClickHdl(LINK(this,SfxTemplateManagerDlg,OpenTemplateHdl));
+ mpOnlineView->setOpenHdl(LINK(this,SfxTemplateManagerDlg,OpenTemplateHdl));
mpOnlineView->setOverlayCloseHdl(LINK(this,SfxTemplateManagerDlg,CloseOverlayHdl));
mpSearchView->setItemMaxTextLength(TEMPLATE_ITEM_MAX_TEXT_LENGTH);
More information about the Libreoffice-commits
mailing list