diff options
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/inc/strings.hxx | 12 | ||||
-rw-r--r-- | sfx2/source/bastyp/frmhtmlw.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/doc/doctempl.cxx | 36 | ||||
-rw-r--r-- | sfx2/source/doc/templatelocnames.src | 51 |
4 files changed, 36 insertions, 67 deletions
diff --git a/sfx2/inc/strings.hxx b/sfx2/inc/strings.hxx index aa4c0c662b26..bd024c27ed90 100644 --- a/sfx2/inc/strings.hxx +++ b/sfx2/inc/strings.hxx @@ -12,6 +12,18 @@ #define STR_HTML_GENERATOR "%PRODUCTNAME %PRODUCTVERSION%PRODUCTEXTENSION (%1)" +// Do not translate STR_TEMPLATE_NAME*_DEF names!! +#define STR_TEMPLATE_NAME1_DEF "Abstract Green" +#define STR_TEMPLATE_NAME2_DEF "Abstract Red" +#define STR_TEMPLATE_NAME3_DEF "Abstract Yellow" +#define STR_TEMPLATE_NAME4_DEF "Bright Blue" +#define STR_TEMPLATE_NAME5_DEF "DNA" +#define STR_TEMPLATE_NAME6_DEF "Inspiration" +#define STR_TEMPLATE_NAME7_DEF "Lush Green" +#define STR_TEMPLATE_NAME8_DEF "Metropolis" +#define STR_TEMPLATE_NAME9_DEF "Sunset" +#define STR_TEMPLATE_NAME10_DEF "Vintage" + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/sfx2/source/bastyp/frmhtmlw.cxx b/sfx2/source/bastyp/frmhtmlw.cxx index 79e2820edb80..9d9127762f3d 100644 --- a/sfx2/source/bastyp/frmhtmlw.cxx +++ b/sfx2/source/bastyp/frmhtmlw.cxx @@ -25,6 +25,7 @@ #include <svl/urihelper.hxx> #include <tools/datetime.hxx> #include <tools/stream.hxx> +#include <tools/resmgr.hxx> #include <sfx2/frmhtmlw.hxx> #include <sfx2/evntconf.hxx> @@ -36,6 +37,7 @@ #include <sfx2/objsh.hxx> #include <sfx2/sfx.hrc> #include "bastyp.hrc" +#include "strings.hxx" #include <comphelper/processfactory.hxx> #include <comphelper/string.hxx> @@ -127,7 +129,7 @@ void SfxFrameHTMLWriter::Out_DocInfo( SvStream& rStrm, const OUString& rBaseURL, } // Who we are - OUString sGenerator(STR_HTML_GENERATOR); + OUString sGenerator(ResMgr::ExpandVariables(STR_HTML_GENERATOR)); OUString os( "$_OS" ); ::rtl::Bootstrap::expandMacros(os); sGenerator = sGenerator.replaceFirst( "%1", os ); diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx index 3e40d2c3ff36..b743ba2ecc76 100644 --- a/sfx2/source/doc/doctempl.cxx +++ b/sfx2/source/doc/doctempl.cxx @@ -88,6 +88,7 @@ using namespace ::ucbhelper; #include <sfx2/sfxresid.hxx> #include <sfx2/templatelocnames.hrc> #include "doc.hrc" +#include "strings.hxx" #include <sfx2/fcontnr.hxx> #include <svtools/templatefoldercache.hxx> @@ -468,25 +469,32 @@ OUString SfxDocumentTemplates::GetTemplateTargetURLFromComponent( const OUString } -/** Convert a resource string - a template name - to its localised pair if it exists. - @param nSourceResIds - Resource ID where the list of original en-US template names begin. - @param nDestResIds - Resource ID where the list of localised template names begin. - @param nCount - The number of names that have been localised. +/** Convert a template name to its localised pair if it exists. @param rString Name to be translated. @return The localised pair of rString or rString if the former does not exist. */ -OUString SfxDocumentTemplates::ConvertResourceString ( - int nSourceResIds, int nDestResIds, int nCount, const OUString& rString ) +OUString SfxDocumentTemplates::ConvertResourceString(const OUString& rString) { - for( int i = 0; i < nCount; ++i ) + static const OUStringLiteral aTemplateNames[] = { - if( rString == SFX2_RESSTR(nSourceResIds + i)) - return SFX2_RESSTR(nDestResIds + i); + STR_TEMPLATE_NAME1_DEF, + STR_TEMPLATE_NAME2_DEF, + STR_TEMPLATE_NAME3_DEF, + STR_TEMPLATE_NAME4_DEF, + STR_TEMPLATE_NAME5_DEF, + STR_TEMPLATE_NAME6_DEF, + STR_TEMPLATE_NAME7_DEF, + STR_TEMPLATE_NAME8_DEF, + STR_TEMPLATE_NAME9_DEF, + STR_TEMPLATE_NAME10_DEF + }; + + for (int i = 0; i < NUM_TEMPLATE_NAMES; ++i) + { + if (rString == aTemplateNames[i]) + return SFX2_RESSTR(STR_TEMPLATE_NAME1 + i); } return rString; } @@ -1202,13 +1210,11 @@ void SfxDocumentTemplates::ReInitFromComponent() pImp->ReInitFromComponent(); } - DocTempl_EntryData_Impl::DocTempl_EntryData_Impl( RegionData_Impl* pParent, const OUString& rTitle ) { mpParent = pParent; - maTitle = SfxDocumentTemplates::ConvertResourceString( - STR_TEMPLATE_NAME1_DEF, STR_TEMPLATE_NAME1, NUM_TEMPLATE_NAMES, rTitle ); + maTitle = SfxDocumentTemplates::ConvertResourceString(rTitle); } diff --git a/sfx2/source/doc/templatelocnames.src b/sfx2/source/doc/templatelocnames.src index a4a313508a38..06c1ec53b76a 100644 --- a/sfx2/source/doc/templatelocnames.src +++ b/sfx2/source/doc/templatelocnames.src @@ -9,57 +9,6 @@ #include <sfx2/templatelocnames.hrc> -// Do not translate STR_TEMPLATE_NAME*_DEF names!! -String STR_TEMPLATE_NAME1_DEF -{ - Text = "Abstract Green" ; -}; - -String STR_TEMPLATE_NAME2_DEF -{ - Text = "Abstract Red" ; -}; - -String STR_TEMPLATE_NAME3_DEF -{ - Text = "Abstract Yellow" ; -}; - -String STR_TEMPLATE_NAME4_DEF -{ - Text = "Bright Blue" ; -}; - -String STR_TEMPLATE_NAME5_DEF -{ - Text = "DNA" ; -}; - -String STR_TEMPLATE_NAME6_DEF -{ - Text = "Inspiration" ; -}; - -String STR_TEMPLATE_NAME7_DEF -{ - Text = "Lush Green" ; -}; - -String STR_TEMPLATE_NAME8_DEF -{ - Text = "Metropolis" ; -}; - -String STR_TEMPLATE_NAME9_DEF -{ - Text = "Sunset" ; -}; - -String STR_TEMPLATE_NAME10_DEF -{ - Text = "Vintage" ; -}; - String STR_TEMPLATE_NAME1 { Text [ en-US ] = "Abstract Green" ; |