[PATCH libreoffice-4-0] Templates Manager: if the title can't be edited, don't updat...

Bosdonnat Cedric (via Code Review) gerrit at gerrit.libreoffice.org
Mon Feb 11 09:15:36 PST 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2109

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/09/2109/1

Templates Manager: if the title can't be edited, don't update it in UI

Change-Id: Id16431fb3517c831a5e81ff72fafaa8569f99ef1
---
M sfx2/inc/sfx2/templatelocalview.hxx
M sfx2/inc/sfx2/templateview.hxx
M sfx2/inc/sfx2/thumbnailview.hxx
M sfx2/source/control/templatelocalview.cxx
M sfx2/source/control/templateview.cxx
M sfx2/source/control/thumbnailview.cxx
M sfx2/source/control/thumbnailviewitem.cxx
7 files changed, 12 insertions(+), 10 deletions(-)



diff --git a/sfx2/inc/sfx2/templatelocalview.hxx b/sfx2/inc/sfx2/templatelocalview.hxx
index dbf00ef..78cf547 100644
--- a/sfx2/inc/sfx2/templatelocalview.hxx
+++ b/sfx2/inc/sfx2/templatelocalview.hxx
@@ -71,7 +71,7 @@
 
     bool isTemplateNameUnique (const sal_uInt16 nRegionItemId, const OUString &rName) const;
 
-    virtual void renameItem(ThumbnailViewItem* pItem, rtl::OUString sNewTitle);
+    virtual bool renameItem(ThumbnailViewItem* pItem, rtl::OUString sNewTitle);
 
 private:
 
diff --git a/sfx2/inc/sfx2/templateview.hxx b/sfx2/inc/sfx2/templateview.hxx
index 07b8487..3e2a7c8 100644
--- a/sfx2/inc/sfx2/templateview.hxx
+++ b/sfx2/inc/sfx2/templateview.hxx
@@ -40,7 +40,7 @@
 
     void setCloseHdl (const Link &rLink) { maAllButton.SetClickHdl(rLink); }
     void setMasterView(TemplateAbstractView* pMasterView) { mpMasterView = pMasterView; }
-    virtual void renameItem(ThumbnailViewItem* pItem, rtl::OUString sNewTitle);
+    virtual bool renameItem(ThumbnailViewItem* pItem, rtl::OUString sNewTitle);
 
 protected:
 
diff --git a/sfx2/inc/sfx2/thumbnailview.hxx b/sfx2/inc/sfx2/thumbnailview.hxx
index a33e762..8eb9426 100644
--- a/sfx2/inc/sfx2/thumbnailview.hxx
+++ b/sfx2/inc/sfx2/thumbnailview.hxx
@@ -238,7 +238,7 @@
 
     virtual void Resize();
 
-    virtual void renameItem(ThumbnailViewItem* pItem, rtl::OUString sNewTitle);
+    virtual bool renameItem(ThumbnailViewItem* pItem, rtl::OUString sNewTitle);
 
 protected:
 
diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx
index 2bbf0d0..ca8856e 100644
--- a/sfx2/source/control/templatelocalview.cxx
+++ b/sfx2/source/control/templatelocalview.cxx
@@ -605,7 +605,7 @@
     showOverlay(true);
 }
 
-void TemplateLocalView::renameItem(ThumbnailViewItem* pItem, rtl::OUString sNewTitle)
+bool TemplateLocalView::renameItem(ThumbnailViewItem* pItem, rtl::OUString sNewTitle)
 {
     sal_uInt16 nRegionId = 0;
     sal_uInt16 nDocId = USHRT_MAX;
@@ -620,7 +620,7 @@
     {
         nRegionId = pContainerItem->mnId - 1;
     }
-    mpDocTemplates->SetName( sNewTitle, nRegionId, nDocId );
+    return mpDocTemplates->SetName( sNewTitle, nRegionId, nDocId );
 }
 
 static void lcl_updateThumbnails (TemplateContainerItem *pItem)
diff --git a/sfx2/source/control/templateview.cxx b/sfx2/source/control/templateview.cxx
index 90e86ec..615465d 100644
--- a/sfx2/source/control/templateview.cxx
+++ b/sfx2/source/control/templateview.cxx
@@ -105,10 +105,11 @@
     maDblClickHdl.Call(pItem);
 }
 
-void TemplateView::renameItem(ThumbnailViewItem* pItem, rtl::OUString sNewTitle)
+bool TemplateView::renameItem(ThumbnailViewItem* pItem, rtl::OUString sNewTitle)
 {
     if (mpMasterView)
-        mpMasterView->renameItem(pItem, sNewTitle);
+        return mpMasterView->renameItem(pItem, sNewTitle);
+    return false;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx
index 9a29381..c996f0f 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -980,9 +980,10 @@
     Invalidate();
 }
 
-void ThumbnailView::renameItem(ThumbnailViewItem*, rtl::OUString)
+bool ThumbnailView::renameItem(ThumbnailViewItem*, rtl::OUString)
 {
     // Do nothing by default
+    return false;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/control/thumbnailviewitem.cxx b/sfx2/source/control/thumbnailviewitem.cxx
index c228bab..2a83bc1 100644
--- a/sfx2/source/control/thumbnailviewitem.cxx
+++ b/sfx2/source/control/thumbnailviewitem.cxx
@@ -187,8 +187,8 @@
 
 void ThumbnailViewItem::setTitle (const rtl::OUString& rTitle)
 {
-    mrParent.renameItem(this, rTitle);
-    maTitle = rTitle;
+    if (mrParent.renameItem(this, rTitle))
+        maTitle = rTitle;
 }
 
 uno::Reference< accessibility::XAccessible > ThumbnailViewItem::GetAccessible( bool bIsTransientChildrenDisabled )

-- 
To view, visit https://gerrit.libreoffice.org/2109
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id16431fb3517c831a5e81ff72fafaa8569f99ef1
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Bosdonnat Cedric <cedric.bosdonnat at free.fr>


More information about the LibreOffice mailing list