Kaydet (Commit) fa10ab03 authored tarafından Rafael Dominguez's avatar Rafael Dominguez

Add an option in toolbar to delete folders when you select them.

Change-Id: Iff10ff99340d9680b924c11956dc036a5f2dac4f
üst babc1806
...@@ -62,6 +62,8 @@ public: ...@@ -62,6 +62,8 @@ public:
sal_uInt16 createRegion (const rtl::OUString &rName); sal_uInt16 createRegion (const rtl::OUString &rName);
bool removeRegion (const sal_uInt16 nItemId);
bool removeTemplate (const sal_uInt16 nItemId); bool removeTemplate (const sal_uInt16 nItemId);
bool moveTemplates (std::set<const ThumbnailViewItem*> &rItems, const sal_uInt16 nTargetItem, bool bCopy); bool moveTemplates (std::set<const ThumbnailViewItem*> &rItems, const sal_uInt16 nTargetItem, bool bCopy);
......
...@@ -72,6 +72,7 @@ private: ...@@ -72,6 +72,7 @@ private:
void OnTemplateEdit (); void OnTemplateEdit ();
void OnTemplateProperties (); void OnTemplateProperties ();
void OnTemplateDelete (); void OnTemplateDelete ();
void OnFolderDelete ();
void centerTopButtons (); void centerTopButtons ();
......
...@@ -468,6 +468,18 @@ sal_uInt16 TemplateFolderView::createRegion(const rtl::OUString &rName) ...@@ -468,6 +468,18 @@ sal_uInt16 TemplateFolderView::createRegion(const rtl::OUString &rName)
return true; return true;
} }
bool TemplateFolderView::removeRegion(const sal_uInt16 nItemId)
{
sal_uInt16 nRegionId = nItemId - 1;
if (!mpDocTemplates->Delete(nRegionId,USHRT_MAX))
return false;
RemoveItem(nItemId);
return true;
}
bool TemplateFolderView::removeTemplate (const sal_uInt16 nItemId) bool TemplateFolderView::removeTemplate (const sal_uInt16 nItemId)
{ {
sal_uInt16 nRegionId = mpItemView->getRegionId(); sal_uInt16 nRegionId = mpItemView->getRegionId();
......
...@@ -310,6 +310,9 @@ IMPL_LINK_NOARG(SfxTemplateManagerDlg,TBXViewHdl) ...@@ -310,6 +310,9 @@ IMPL_LINK_NOARG(SfxTemplateManagerDlg,TBXViewHdl)
case TBI_TEMPLATE_IMPORT: case TBI_TEMPLATE_IMPORT:
OnTemplateImport(); OnTemplateImport();
break; break;
case TBI_TEMPLATE_FOLDER_DEL:
OnFolderDelete();
break;
default: default:
break; break;
} }
...@@ -418,7 +421,10 @@ IMPL_LINK(SfxTemplateManagerDlg, TVFolderStateHdl, const ThumbnailViewItem*, pIt ...@@ -418,7 +421,10 @@ IMPL_LINK(SfxTemplateManagerDlg, TVFolderStateHdl, const ThumbnailViewItem*, pIt
if (pItem->isSelected()) if (pItem->isSelected())
{ {
if (maSelFolders.empty()) if (maSelFolders.empty())
{
mpViewBar->EnableItem(TBI_TEMPLATE_IMPORT,true); mpViewBar->EnableItem(TBI_TEMPLATE_IMPORT,true);
mpViewBar->ShowItem(TBI_TEMPLATE_FOLDER_DEL);
}
maSelFolders.insert(pItem); maSelFolders.insert(pItem);
} }
...@@ -427,7 +433,10 @@ IMPL_LINK(SfxTemplateManagerDlg, TVFolderStateHdl, const ThumbnailViewItem*, pIt ...@@ -427,7 +433,10 @@ IMPL_LINK(SfxTemplateManagerDlg, TVFolderStateHdl, const ThumbnailViewItem*, pIt
maSelFolders.erase(pItem); maSelFolders.erase(pItem);
if (maSelFolders.empty()) if (maSelFolders.empty())
{
mpViewBar->EnableItem(TBI_TEMPLATE_IMPORT,false); mpViewBar->EnableItem(TBI_TEMPLATE_IMPORT,false);
mpViewBar->HideItem(TBI_TEMPLATE_FOLDER_DEL);
}
} }
return 0; return 0;
...@@ -762,6 +771,18 @@ void SfxTemplateManagerDlg::OnTemplateDelete () ...@@ -762,6 +771,18 @@ void SfxTemplateManagerDlg::OnTemplateDelete ()
} }
} }
void SfxTemplateManagerDlg::OnFolderDelete()
{
std::set<const ThumbnailViewItem*>::const_iterator pIter;
for (pIter = maSelFolders.begin(); pIter != maSelFolders.end();)
{
if (maView->removeRegion((*pIter)->mnId))
maSelFolders.erase(pIter++);
else
++pIter;
}
}
void SfxTemplateManagerDlg::centerTopButtons() void SfxTemplateManagerDlg::centerTopButtons()
{ {
Point aFirstBtnPos = aButtonAll.GetPosPixel(); Point aFirstBtnPos = aButtonAll.GetPosPixel();
......
...@@ -38,6 +38,8 @@ ...@@ -38,6 +38,8 @@
#define BTN_TEMPLATE_CLOSE 24 #define BTN_TEMPLATE_CLOSE 24
#define TBI_TEMPLATE_FOLDER_DEL 25
#define STR_CREATE_TEXT 260 #define STR_CREATE_TEXT 260
#define STR_CREATE_SHEET 261 #define STR_CREATE_SHEET 261
#define STR_CREATE_PRESENT 262 #define STR_CREATE_PRESENT 262
......
...@@ -195,6 +195,13 @@ ModalDialog DLG_TEMPLATE_MANAGER ...@@ -195,6 +195,13 @@ ModalDialog DLG_TEMPLATE_MANAGER
ImageBitmap = Bitmap { File = "import.png" ; }; ImageBitmap = Bitmap { File = "import.png" ; };
}; };
}; };
ToolBoxItem
{
Identifier = TBI_TEMPLATE_FOLDER_DEL;
Hide = TRUE;
Text [ en-US ] = "Delete";
};
}; };
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment