summaryrefslogtreecommitdiff
path: root/sd/source/ui/inc/TemplateScanner.hxx
diff options
context:
space:
mode:
authorPeter Rabi <prabi@caesar.elte.hu>2011-09-14 22:00:19 +0200
committerAndras Timar <atimar@suse.com>2011-09-14 22:25:53 +0200
commit0c113d825da98a8038cb4359cd86e765eef0b915 (patch)
tree9de740b4990e95f0c59c7e1e8dd557c28adc70cb /sd/source/ui/inc/TemplateScanner.hxx
parentb6cccb9e77111254932ebcf96f883aab04cb3f56 (diff)
Fix of localised template name problems in Impress part 1
Template entries now appear in the correct word order in their representation in TemplateScanner. That makes dlgass template listboxes work as expected. Contributed under license LGPLv3+/MPL.
Diffstat (limited to 'sd/source/ui/inc/TemplateScanner.hxx')
-rw-r--r--sd/source/ui/inc/TemplateScanner.hxx39
1 files changed, 38 insertions, 1 deletions
diff --git a/sd/source/ui/inc/TemplateScanner.hxx b/sd/source/ui/inc/TemplateScanner.hxx
index 86c862a298cf..f44c042cae18 100644
--- a/sd/source/ui/inc/TemplateScanner.hxx
+++ b/sd/source/ui/inc/TemplateScanner.hxx
@@ -37,6 +37,7 @@
#include <vector>
#include <boost/scoped_ptr.hpp>
+#include <boost/shared_ptr.hpp>
namespace com { namespace sun { namespace star { namespace ucb {
class XContent;
@@ -47,6 +48,10 @@ namespace com { namespace sun { namespace star { namespace sdbc {
class XResultSet;
} } } }
+namespace comphelper { namespace string {
+class NaturalStringSorter;
+} }
+
namespace sd {
/** Representation of a template or layout file.
@@ -64,17 +69,40 @@ public:
+/** Functor that compares two TemplateEntries based on their titles
+*/
+class TemplateEntryCompare
+{
+public:
+ TemplateEntryCompare();
+ bool operator()(TemplateEntry* pA, TemplateEntry* pB) const;
+
+private:
+ ::boost::shared_ptr<comphelper::string::NaturalStringSorter> mpStringSorter;
+};
+
+
+
+
/** Representation of a template or layout folder.
*/
class TemplateDir
{
public:
TemplateDir (const String& rsRegion, const String& rsUrl )
- : msRegion(rsRegion), msUrl(rsUrl), maEntries() {}
+ : msRegion(rsRegion), msUrl(rsUrl), maEntries(),
+ mbSortingEnabled(false), mpEntryCompare(NULL) {}
String msRegion;
String msUrl;
::std::vector<TemplateEntry*> maEntries;
+
+ void EnableSorting(bool bSortingEnabled = true);
+ void InsertEntry(TemplateEntry* pNewEntry);
+
+private:
+ bool mbSortingEnabled;
+ ::boost::scoped_ptr<TemplateEntryCompare> mpEntryCompare;
};
@@ -133,6 +161,11 @@ public:
*/
const TemplateEntry* GetLastAddedEntry (void) const;
+ /** Set wether to sort the template entries inside the regions.
+ */
+ void EnableEntrySorting (bool isEntrySortingEnabled = true)
+ {mbEntrySortingEnabled = isEntrySortingEnabled;}
+
private:
/** The current state determines which step will be executed next by
RunNextStep().
@@ -157,6 +190,10 @@ private:
*/
std::vector<TemplateDir*> maFolderList;
+ /** Weather the template entries have to be sorted.
+ */
+ bool mbEntrySortingEnabled;
+
/** This member points into the maFolderList to the member that was most
recently added.
*/