[PATCH] Resolves fdo#46718 : UI: Delete multiple styles at once
Rushi Shukla (via Code Review)
gerrit at gerrit.libreoffice.org
Thu Jan 17 00:54:16 PST 2013
Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/1730
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/30/1730/1
Resolves fdo#46718 : UI: Delete multiple styles at once
Allows the user to delete multiple styles at once.
Previously you need to select one style at a time and confirm its deletion. The patch enables the user to select multiple styles at once and delete them in one step. This is particularly useful when the user has numerous styles which are not not used regualarly or shall not be used in the future .
Author : Rushi Shukla (rushboy52 at gmail.com)
Change-Id: I88d0113d4d311f98de8e20a5f8c8ebc0e2025b6f
---
M sfx2/source/dialog/templdlg.cxx
M sfx2/source/inc/templdgi.hxx
2 files changed, 30 insertions(+), 8 deletions(-)
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index b315453..d707ea4 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -1991,7 +1991,12 @@
if ( pTreeBox )
{
- pTreeBox->RemoveParentKeepChildren( pTreeBox->FirstSelected() );
+ while(pTreeBox->FirstSelected)
+ {
+ SvTreeListEntry* temp = pTreeBox->NextSelected();
+ pTreeBox->RemoveParentKeepChildren( pTreeBox->FirstSelected() );
+ pTreeBox->FirstSelected() = temp ;
+ }
bDontUpdate = sal_False;
}
}
@@ -2038,6 +2043,7 @@
const SfxStyleFamilyItem *pItem = GetFamilyItem_Impl();
const SfxStyleFamily eFam = pItem->GetFamily();
sal_uInt16 nFilter = 0;
+ sal_bool DelFlag = sal_false;
if(pItem->GetFilterList().size() > nActFilter)
nFilter = pItem->GetFilterList()[ nActFilter ]->nFlags;
if(!nFilter) // automatic
@@ -2045,14 +2051,29 @@
const SfxStyleSheetBase *pStyle =
pStyleSheetPool->Find(aTemplName,eFam, pTreeBox? SFXSTYLEBIT_ALL : nFilter);
- OSL_ENSURE(pStyle, "Style ot found");
- if(pStyle && pStyle->IsUserDefined())
+ OSL_ENSURE(pStyle, "Style not found");
+ if(pStyle)
{
- EnableDel(sal_True);
- }
- else
- {
- EnableDel(sal_False);
+ while(pTreeBox->FirstSelected)
+ {
+ SfxStyleSheetBase *pcheck = GetSelectedStyle();
+ if(!(pcheck->UserDefined()))
+ {
+ sal_bool=false;
+ break;
+ }
+ SvTreeListEntry* temp = pTreeBox->NextSelected();
+ if(pTreeBox->FirstSelected)
+ pTreeBox->FirstSelected() = temp ;
+ }
+ if(DelFlag)
+ {
+ EnableDel(sal_True);
+ }
+ else
+ {
+ EnableDel(sal_False);
+ }
}
}
else
diff --git a/sfx2/source/inc/templdgi.hxx b/sfx2/source/inc/templdgi.hxx
index b5fdbd9..1bd6fe3 100644
--- a/sfx2/source/inc/templdgi.hxx
+++ b/sfx2/source/inc/templdgi.hxx
@@ -136,6 +136,7 @@
SfxTemplateItem* pFamilyState[MAX_FAMILIES];
SfxStyleSheetBasePool* pStyleSheetPool;
SvTreeListBox* pTreeBox;
+ pTreeBox.SetSelectionMode(MULTIPLE_SELECTION);
SfxObjectShell* pCurObjShell;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 >
xModuleManager;
--
To view, visit https://gerrit.libreoffice.org/1730
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I88d0113d4d311f98de8e20a5f8c8ebc0e2025b6f
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Rushi Shukla <rushboy52 at gmail.com>
More information about the LibreOffice
mailing list