summaryrefslogtreecommitdiff
path: root/sw/source/core/doc/DocumentStylePoolManager.cxx
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-11-29 23:54:26 +0100
committerEike Rathke <erack@redhat.com>2017-12-01 11:21:31 +0100
commitb56cd8050137ed4555a5aca50d4949d941e1f132 (patch)
tree9b53b74c6cc794461771fe4331b1246740aa7ecb /sw/source/core/doc/DocumentStylePoolManager.cxx
parent7d12aa833aec8e9a5c453104a23bff70cec54a45 (diff)
Prepare for translated new AutoFormat Table Styles, tdf#101349
Stored in file are resource IDs for predefined style names, user defined styles are stored with ID 0xffff and display the given name. The 16 old styles have IDs 0..15, so add strings for the 10 new styles and append those to the already existing IDs assigning them the range 16..25 Once the final autotbl.fmt file with only new styles will be available, patch that to change the 0xffff user defined to those 16..25 (0x10 to 0x19) IDs, it is the uint16 immediately following the style name (Little Endian). Order of styles should match the one in this change, if not, change the change.. Also, this eliminates the duplicated translation entries in sw/inc/strings.hrc and instead in sw/source/core/doc/DocumentStylePoolManager.cxx pulls the translations from include/svx/strings.hrc Change-Id: I7827ae22ab05901e6580ff1b9cd812db55f94f7f Reviewed-on: https://gerrit.libreoffice.org/45544 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sw/source/core/doc/DocumentStylePoolManager.cxx')
-rw-r--r--sw/source/core/doc/DocumentStylePoolManager.cxx63
1 files changed, 44 insertions, 19 deletions
diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx b/sw/source/core/doc/DocumentStylePoolManager.cxx
index abcafa39111a..316217ba8907 100644
--- a/sw/source/core/doc/DocumentStylePoolManager.cxx
+++ b/sw/source/core/doc/DocumentStylePoolManager.cxx
@@ -58,6 +58,8 @@
#include <editeng/frmdiritem.hxx>
#include <editeng/emphasismarkitem.hxx>
#include <editeng/scriptspaceitem.hxx>
+#include <svx/strings.hrc>
+#include <svx/dialmgr.hxx>
#include <strings.hrc>
#include <com/sun/star/table/BorderLineStyle.hpp>
#include <com/sun/star/text/VertOrientation.hpp>
@@ -516,25 +518,42 @@ static const char* STR_POOLNUMRULE_NUM_ARY[] =
STR_POOLNUMRULE_BUL5
};
+// XXX MUST match the entries of TableStyleProgNameTable in
+// sw/source/core/doc/SwStyleNameMapper.cxx and MUST match the order of
+// RES_POOL_TABSTYLE_TYPE in sw/inc/poolfmt.hxx
static const char* STR_TABSTYLE_ARY[] =
{
+ // XXX MUST be in order, Writer first, then Svx old, then Svx new
+ // 1 Writer resource string
STR_TABSTYLE_DEFAULT,
- STR_TABSTYLE_3D,
- STR_TABSTYLE_BLACK1,
- STR_TABSTYLE_BLACK2,
- STR_TABSTYLE_BLUE,
- STR_TABSTYLE_BROWN,
- STR_TABSTYLE_CURRENCY,
- STR_TABSTYLE_CURRENCY_3D,
- STR_TABSTYLE_CURRENCY_GRAY,
- STR_TABSTYLE_CURRENCY_LAVENDER,
- STR_TABSTYLE_CURRENCY_TURQUOISE,
- STR_TABSTYLE_GRAY,
- STR_TABSTYLE_GREEN,
- STR_TABSTYLE_LAVENDER,
- STR_TABSTYLE_RED,
- STR_TABSTYLE_TURQUOISE,
- STR_TABSTYLE_YELLOW
+ // 16 old styles Svx resource strings
+ RID_SVXSTR_TBLAFMT_3D,
+ RID_SVXSTR_TBLAFMT_BLACK1,
+ RID_SVXSTR_TBLAFMT_BLACK2,
+ RID_SVXSTR_TBLAFMT_BLUE,
+ RID_SVXSTR_TBLAFMT_BROWN,
+ RID_SVXSTR_TBLAFMT_CURRENCY,
+ RID_SVXSTR_TBLAFMT_CURRENCY_3D,
+ RID_SVXSTR_TBLAFMT_CURRENCY_GRAY,
+ RID_SVXSTR_TBLAFMT_CURRENCY_LAVENDER,
+ RID_SVXSTR_TBLAFMT_CURRENCY_TURQUOISE,
+ RID_SVXSTR_TBLAFMT_GRAY,
+ RID_SVXSTR_TBLAFMT_GREEN,
+ RID_SVXSTR_TBLAFMT_LAVENDER,
+ RID_SVXSTR_TBLAFMT_RED,
+ RID_SVXSTR_TBLAFMT_TURQUOISE,
+ RID_SVXSTR_TBLAFMT_YELLOW,
+ // 10 new styles since LibreOffice 6.0 Svx resource strings
+ RID_SVXSTR_TBLAFMT_LO6_ACADEMIC,
+ RID_SVXSTR_TBLAFMT_LO6_BOX_LIST_BLUE,
+ RID_SVXSTR_TBLAFMT_LO6_BOX_LIST_GREEN,
+ RID_SVXSTR_TBLAFMT_LO6_BOX_LIST_RED,
+ RID_SVXSTR_TBLAFMT_LO6_BOX_LIST_YELLOW,
+ RID_SVXSTR_TBLAFMT_LO6_ELEGANT,
+ RID_SVXSTR_TBLAFMT_LO6_FINANCIAL,
+ RID_SVXSTR_TBLAFMT_LO6_SIMPLE_GRID_COLUMNS,
+ RID_SVXSTR_TBLAFMT_LO6_SIMPLE_GRID_ROWS,
+ RID_SVXSTR_TBLAFMT_LO6_SIMPLE_LIST_SHADED
};
namespace sw
@@ -2517,12 +2536,16 @@ std::vector<OUString> *SwStyleNameMapper::s_pTextUINameArray = nullptr,
*SwStyleNameMapper::s_pCellStyleUINameArray = nullptr;
std::vector<OUString>*
-lcl_NewUINameArray(const char** pIds, const size_t nLen)
+lcl_NewUINameArray(const char** pIds, const size_t nLen, const size_t nSvxIds = 0)
{
+ assert(nSvxIds <= nLen);
+ const size_t nWriterIds = nLen - nSvxIds;
std::vector<OUString> *const pNameArray = new std::vector<OUString>;
pNameArray->reserve(nLen);
- for (size_t i = 0; i < nLen; ++i)
+ for (size_t i = 0; i < nWriterIds; ++i)
pNameArray->push_back(SwResId(pIds[i]));
+ for (size_t i = nWriterIds; i < nLen; ++i)
+ pNameArray->push_back(SvxResId(pIds[i]));
return pNameArray;
}
@@ -2606,7 +2629,9 @@ const std::vector<OUString>& SwStyleNameMapper::GetNumRuleUINameArray()
const std::vector<OUString>& SwStyleNameMapper::GetTableStyleUINameArray()
{
if (!s_pTableStyleUINameArray)
- s_pTableStyleUINameArray = lcl_NewUINameArray(STR_TABSTYLE_ARY, SAL_N_ELEMENTS(STR_TABSTYLE_ARY));
+ // 1 Writer resource string (XXX if this ever changes rather use offset math)
+ s_pTableStyleUINameArray = lcl_NewUINameArray(STR_TABSTYLE_ARY, SAL_N_ELEMENTS(STR_TABSTYLE_ARY),
+ static_cast<size_t>(SAL_N_ELEMENTS(STR_TABSTYLE_ARY) - 1));
return *s_pTableStyleUINameArray;
}