summaryrefslogtreecommitdiff
path: root/sw
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
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')
-rw-r--r--sw/inc/poolfmt.hxx12
-rw-r--r--sw/inc/strings.hrc18
-rw-r--r--sw/source/core/doc/DocumentStylePoolManager.cxx63
-rw-r--r--sw/source/core/doc/SwStyleNameMapper.cxx13
4 files changed, 70 insertions, 36 deletions
diff --git a/sw/inc/poolfmt.hxx b/sw/inc/poolfmt.hxx
index 6830faeee1ac..2ef34a0a9fa5 100644
--- a/sw/inc/poolfmt.hxx
+++ b/sw/inc/poolfmt.hxx
@@ -205,6 +205,7 @@ enum RES_POOL_TABSTYLE_TYPE
{
RES_POOLTABSTYLE_BEGIN = POOLGRP_TABSTYLE,
RES_POOLTABSTYLE_DEFAULT = RES_POOLTABSTYLE_BEGIN,
+// 16 old styles
RES_POOLTABLESTYLE_3D,
RES_POOLTABLESTYLE_BLACK1,
RES_POOLTABLESTYLE_BLACK2,
@@ -221,6 +222,17 @@ RES_POOLTABLESTYLE_LAVENDER,
RES_POOLTABLESTYLE_RED,
RES_POOLTABLESTYLE_TURQUOISE,
RES_POOLTABLESTYLE_YELLOW,
+// 10 new styles since LibreOffice 6.0
+RES_POOLTABLESTYLE_LO6_ACADEMIC,
+RES_POOLTABLESTYLE_LO6_BOX_LIST_BLUE,
+RES_POOLTABLESTYLE_LO6_BOX_LIST_GREEN,
+RES_POOLTABLESTYLE_LO6_BOX_LIST_RED,
+RES_POOLTABLESTYLE_LO6_BOX_LIST_YELLOW,
+RES_POOLTABLESTYLE_LO6_ELEGANT,
+RES_POOLTABLESTYLE_LO6_FINANCIAL,
+RES_POOLTABLESTYLE_LO6_SIMPLE_GRID_COLUMNS,
+RES_POOLTABLESTYLE_LO6_SIMPLE_GRID_ROWS,
+RES_POOLTABLESTYLE_LO6_SIMPLE_LIST_SHADED,
RES_POOLTABSTYLE_END
};
diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index 76388ee520ca..a0d2b3ae3bc4 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -211,24 +211,8 @@
#define STR_COLUMN_VALUESET_ITEM2 NC_("STR_COLUMN_VALUESET_ITEM2", "3 columns with equal size")
#define STR_COLUMN_VALUESET_ITEM3 NC_("STR_COLUMN_VALUESET_ITEM3", "2 columns with different size (left > right)")
#define STR_COLUMN_VALUESET_ITEM4 NC_("STR_COLUMN_VALUESET_ITEM4", "2 columns with different size (left < right)")
-// Table styles
+// Table styles, Writer internal, others are taken from Svx
#define STR_TABSTYLE_DEFAULT NC_("STR_TABSTYLE_DEFAULT", "Default Style")
-#define STR_TABSTYLE_3D NC_("STR_TABSTYLE_3D", "3D")
-#define STR_TABSTYLE_BLACK1 NC_("STR_TABSTYLE_BLACK1", "Black 1")
-#define STR_TABSTYLE_BLACK2 NC_("STR_TABSTYLE_BLACK2", "Black 2")
-#define STR_TABSTYLE_BLUE NC_("STR_TABSTYLE_BLUE", "Blue")
-#define STR_TABSTYLE_BROWN NC_("STR_TABSTYLE_BROWN", "Brown")
-#define STR_TABSTYLE_CURRENCY NC_("STR_TABSTYLE_CURRENCY", "Currency")
-#define STR_TABSTYLE_CURRENCY_3D NC_("STR_TABSTYLE_CURRENCY_3D", "Currency 3D")
-#define STR_TABSTYLE_CURRENCY_GRAY NC_("STR_TABSTYLE_CURRENCY_GRAY", "Currency Gray")
-#define STR_TABSTYLE_CURRENCY_LAVENDER NC_("STR_TABSTYLE_CURRENCY_LAVENDER", "Currency Lavender")
-#define STR_TABSTYLE_CURRENCY_TURQUOISE NC_("STR_TABSTYLE_CURRENCY_TURQUOISE", "Currency Turquoise")
-#define STR_TABSTYLE_GRAY NC_("STR_TABSTYLE_GRAY", "Gray")
-#define STR_TABSTYLE_GREEN NC_("STR_TABSTYLE_GREEN", "Green")
-#define STR_TABSTYLE_LAVENDER NC_("STR_TABSTYLE_LAVENDER", "Lavender")
-#define STR_TABSTYLE_RED NC_("STR_TABSTYLE_RED", "Red")
-#define STR_TABSTYLE_TURQUOISE NC_("STR_TABSTYLE_TURQUOISE", "Turquoise")
-#define STR_TABSTYLE_YELLOW NC_("STR_TABSTYLE_YELLOW", "Yellow")
#define STR_PARAGRAPHSTYLEFAMILY NC_("STR_PARAGRAPHSTYLEFAMILY", "Paragraph Styles")
#define STR_CHARACTERSTYLEFAMILY NC_("STR_CHARACTERSTYLEFAMILY", "Character Styles")
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;
}
diff --git a/sw/source/core/doc/SwStyleNameMapper.cxx b/sw/source/core/doc/SwStyleNameMapper.cxx
index 56f3f6934f1a..367fb68d7a6b 100644
--- a/sw/source/core/doc/SwStyleNameMapper.cxx
+++ b/sw/source/core/doc/SwStyleNameMapper.cxx
@@ -302,6 +302,9 @@ const struct SwTableEntry NumRuleProgNameTable [] =
{ 0, nullptr }
};
+// XXX MUST match the entries of STR_TABSTYLE_ARY in
+// sw/source/core/doc/DocumentStylePoolManager.cxx and MUST match the order of
+// RES_POOL_TABSTYLE_TYPE in sw/inc/poolfmt.hxx
const struct SwTableEntry TableStyleProgNameTable [] =
{
ENTRY( "Default Style" ), // RES_POOLTABLESTYLE_DEFAULT
@@ -321,6 +324,16 @@ const struct SwTableEntry TableStyleProgNameTable [] =
ENTRY( "Red" ), // RES_POOLTABLESTYLE_RED
ENTRY( "Turquoise" ), // RES_POOLTABLESTYLE_TURQUOISE
ENTRY( "Yellow" ), // RES_POOLTABLESTYLE_YELLOW
+ ENTRY( "Academic" ), // RES_POOLTABLESTYLE_LO6_ACADEMIC
+ ENTRY( "Box List Blue" ), // RES_POOLTABLESTYLE_LO6_BOX_LIST_BLUE
+ ENTRY( "Box List Green" ), // RES_POOLTABLESTYLE_LO6_BOX_LIST_GREEN
+ ENTRY( "Box List Red" ), // RES_POOLTABLESTYLE_LO6_BOX_LIST_RED
+ ENTRY( "Box List Yellow" ), // RES_POOLTABLESTYLE_LO6_BOX_LIST_YELLOW
+ ENTRY( "Elegant" ), // RES_POOLTABLESTYLE_LO6_ELEGANT
+ ENTRY( "Financial" ), // RES_POOLTABLESTYLE_LO6_FINANCIAL
+ ENTRY( "Simple Grid Columns" ), // RES_POOLTABLESTYLE_LO6_SIMPLE_GRID_COLUMNS
+ ENTRY( "Simple Grid Rows" ), // RES_POOLTABLESTYLE_LO6_SIMPLE_GRID_ROWS
+ ENTRY( "Simple List Shaded" ),// RES_POOLTABLESTYLE_LO6_SIMPLE_LIST_SHADED
{ 0, nullptr }
};
#undef ENTRY