summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEfe Gürkan YALAMAN <efeyalaman@gmail.com>2014-06-14 03:08:29 +0300
committerEfe Gürkan YALAMAN <efeyalaman@gmail.com>2014-06-14 03:08:29 +0300
commit138b46fb0b0951f406ea60a7beffefb1f27aa7ac (patch)
tree901f946651f0b228422c3d4010b62156d8f74d01
parentf14c4f76c29500d9340ae9b7ffbb31a03ea40cf8 (diff)
Some folder features moved to backingwindow
Create new folder and delete a folder moved from template manager dialog to startcenter. Change-Id: If89b9fd7ee499f7fccda08d3ac989728148a24a0
-rw-r--r--sfx2/source/dialog/backingwindow.cxx67
-rw-r--r--sfx2/source/dialog/backingwindow.hxx4
2 files changed, 63 insertions, 8 deletions
diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index b170b60590dc..544447f0831e 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -18,6 +18,7 @@
*/
#include "backingwindow.hxx"
+#include "inputdlg.hxx"
#include <vcl/svapp.hxx>
#include <vcl/virdev.hxx>
@@ -50,7 +51,7 @@
#include <com/sun/star/task/InteractionHandler.hpp>
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
-//well find a better way for it.
+//FIXME:well find a better way for it.
#include "../doc/doc.hrc"
using namespace ::com::sun::star;
@@ -592,6 +593,56 @@ void BackingWindow::OnTemplateImport ()
}
}
+void BackingWindow::OnFolderDelete()
+{
+ QueryBox aQueryDlg(this, WB_YES_NO | WB_DEF_YES, SfxResId(STR_QMSG_SEL_FOLDER_DELETE).toString());
+
+ if ( aQueryDlg.Execute() == RET_NO )
+ return;
+
+ OUString aFolderList;
+
+ std::set<const ThumbnailViewItem*,selection_cmp_fn>::const_iterator pIter;
+ std::set<const ThumbnailViewItem*,selection_cmp_fn> aSelFolders = maSelFolders; //Copy to avoid invalidating an iterator
+
+ for (pIter = aSelFolders.begin(); pIter != aSelFolders.end(); ++pIter)
+ {
+ if (!mpLocalView->removeRegion((*pIter)->mnId))
+ {
+ if (aFolderList.isEmpty())
+ aFolderList = (*pIter)->maTitle;
+ else
+ aFolderList = aFolderList + "\n" + (*pIter)->maTitle;
+
+ ++pIter;
+ if (pIter == aSelFolders.end())
+ break;
+ }
+ }
+
+ if (!aFolderList.isEmpty())
+ {
+ OUString aMsg( SfxResId(STR_MSG_ERROR_DELETE_FOLDER).toString() );
+ ErrorBox(this, WB_OK,aMsg.replaceFirst("$1",aFolderList)).Execute();
+ }
+}
+
+
+void BackingWindow::OnFolderNew()
+{
+ InputDialog dlg(SfxResId(STR_INPUT_NEW).toString(),this);
+
+ int ret = dlg.Execute();
+
+ if (ret)
+ {
+ OUString aName = dlg.getEntryText();
+
+ mpCurrentView->createRegion(aName);
+ }
+}
+
+
void BackingWindow::OnRegionState (const ThumbnailViewItem *pItem)
{
if (pItem->isSelected())
@@ -728,15 +779,15 @@ IMPL_LINK_NOARG(BackingWindow,TBXViewHdl)
if (nCurItemId == mpViewBar->GetItemId("import"))
OnTemplateImport();
- //else if (nCurItemId == mpViewBar->GetItemId("delete"))
- //{
- //if (mpCurView == mpLocalView)
- ////OnFolderDelete();
+ else if (nCurItemId == mpViewBar->GetItemId("delete"))
+ {
+ if (mpCurrentView == mpLocalView)
+ OnFolderDelete();
//else
////OnRepositoryDelete();
- //}
- //else if (nCurItemId == mpViewBar->GetItemId("new_folder"))
- ////OnFolderNew();
+ }
+ else if (nCurItemId == mpViewBar->GetItemId("new_folder"))
+ OnFolderNew();
//else if (nCurItemId == mpViewBar->GetItemId("save"))
////OnTemplateSaveAs();
diff --git a/sfx2/source/dialog/backingwindow.hxx b/sfx2/source/dialog/backingwindow.hxx
index b80201a1ff0e..743954cac2ec 100644
--- a/sfx2/source/dialog/backingwindow.hxx
+++ b/sfx2/source/dialog/backingwindow.hxx
@@ -98,6 +98,10 @@ class BackingWindow
void setupButton( PushButton* pButton );
void OnTemplateImport ();
+
+ void OnFolderNew ();
+ void OnFolderDelete ();
+
void OnRegionState (const ThumbnailViewItem *pItem);
void dispatchURL( const OUString& i_rURL,