summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-02-23 16:15:18 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-03-01 07:28:03 +0000
commit4c09fc48e9fa9114f32f2973090cbe75177cdd37 (patch)
tree09d4ee3c2d75d038f45ba13a086a344d35aeadb6 /sc
parentd97380c66904328e9d706a0b03a6800dc048aa7d (diff)
typesafe wrappers for css::i18nutil::TransliterationModules
and related css::util::SearchOptions2 The TransliterationModules enum has it's constants spread over multiple UNO enum/constant-collections - TransliterationModules and TransliterationModulesExtra, which means that most code simply uses sal_Int32. Wrap them up into a better bundle so that only the lowest layer needs to deal directly with the UNO constants. Change-Id: I1edeab79fcc7817a4a97c933ef84ab7015bb849b Reviewed-on: https://gerrit.libreoffice.org/34582 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/document.hxx2
-rw-r--r--sc/inc/global.hxx8
-rw-r--r--sc/inc/viewutil.hxx6
-rw-r--r--sc/qa/unit/ucalc.cxx4
-rw-r--r--sc/source/core/data/documen8.cxx6
-rw-r--r--sc/source/core/data/table6.cxx8
-rw-r--r--sc/source/core/tool/cellkeytranslator.cxx5
-rw-r--r--sc/source/core/tool/interpr1.cxx4
-rw-r--r--sc/source/ui/docshell/docfunc.cxx2
-rw-r--r--sc/source/ui/drawfunc/drtxtob.cxx4
-rw-r--r--sc/source/ui/inc/docfunc.hxx7
-rw-r--r--sc/source/ui/inc/undoblk.hxx5
-rw-r--r--sc/source/ui/inc/viewfunc.hxx2
-rw-r--r--sc/source/ui/undo/undoblk.cxx2
-rw-r--r--sc/source/ui/view/cellsh1.cxx6
-rw-r--r--sc/source/ui/view/editsh.cxx4
-rw-r--r--sc/source/ui/view/viewfun2.cxx2
-rw-r--r--sc/source/ui/view/viewutil.cxx25
18 files changed, 45 insertions, 57 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index a18b2eac1314..4b05b6ada4ca 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1496,7 +1496,7 @@ public:
InsertDeleteFlags nFlags, ScPasteFunc nFunction,
bool bSkipEmpty, bool bAsLink );
- void TransliterateText( const ScMarkData& rMultiMark, sal_Int32 nType );
+ void TransliterateText( const ScMarkData& rMultiMark, TransliterationFlags nType );
SC_DLLPUBLIC void InitUndo( ScDocument* pSrcDoc, SCTAB nTab1, SCTAB nTab2,
bool bColInfo = false, bool bRowInfo = false );
diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index 77f929f0b1da..dd3fadf06bbf 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -37,12 +37,10 @@ struct ScCalcConfig;
enum class SvtScriptType;
enum class FormulaError : sal_uInt16;
-#define SC_COLLATOR_IGNORES ( \
- css::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE )
+#define SC_COLLATOR_IGNORES css::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE
-#define SC_TRANSLITERATION_IGNORECASE ( \
- css::i18n::TransliterationModules_IGNORE_CASE )
-#define SC_TRANSLITERATION_CASESENSE 0
+#define SC_TRANSLITERATION_IGNORECASE TransliterationFlags::IGNORE_CASE
+#define SC_TRANSLITERATION_CASESENSE TransliterationFlags::NONE
// Calc has lots of names...
// Clipboard names are in so3/soapp.hxx now
diff --git a/sc/inc/viewutil.hxx b/sc/inc/viewutil.hxx
index 2819ace34952..af37b9620edb 100644
--- a/sc/inc/viewutil.hxx
+++ b/sc/inc/viewutil.hxx
@@ -27,7 +27,6 @@ class SfxBindings;
class SvxFontItem;
class SfxViewShell;
class SfxViewFrame;
-
class ScChangeAction;
class ScChangeViewSettings;
class ScDocument;
@@ -35,6 +34,9 @@ class ScAddress;
class ScRange;
class ScMarkData;
enum class SvtScriptType;
+enum class TransliterationFlags;
+
+
enum class ScUpdateMode { All, Marks };
class SC_DLLPUBLIC ScViewUtil
@@ -54,7 +56,7 @@ public:
static sal_uInt16 GetEffLanguage( ScDocument* pDoc, const ScAddress& rPos );
- static sal_Int32 GetTransliterationType( sal_uInt16 nSlotID );
+ static TransliterationFlags GetTransliterationType( sal_uInt16 nSlotID );
static bool HasFiltered( const ScRange& rRange, ScDocument* pDoc );
/** Fit a range to cover nRows number of unfiltered rows.
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index c715c5e76675..cf0e984ed83d 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -94,8 +94,6 @@
#include <utility>
#include <vector>
-#include <com/sun/star/i18n/TransliterationModules.hpp>
-
struct TestImpl
{
ScDocShellRef m_xDocShell;
@@ -5912,7 +5910,7 @@ void Test::testTransliterateText()
aMark.SetMarkArea(ScRange(0,0,0,0,2,0));
ScDocFunc& rFunc = getDocShell().GetDocFunc();
rFunc.TransliterateText(
- aMark, i18n::TransliterationModules_LOWERCASE_UPPERCASE, true);
+ aMark, TransliterationFlags::LOWERCASE_UPPERCASE, true);
CPPUNIT_ASSERT_EQUAL(OUString("MIKE"), m_pDoc->GetString(ScAddress(0,0,0)));
CPPUNIT_ASSERT_EQUAL(OUString("NOAH"), m_pDoc->GetString(ScAddress(0,1,0)));
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index 30bcf9833114..59c611e62b5c 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -45,8 +45,6 @@
#include <vcl/virdev.hxx>
#include <vcl/msgbox.hxx>
-#include <com/sun/star/i18n/TransliterationModulesExtra.hpp>
-
#include "inputopt.hxx"
#include "global.hxx"
#include "table.hxx"
@@ -1184,7 +1182,7 @@ SfxBindings* ScDocument::GetViewBindings()
return nullptr;
}
-void ScDocument::TransliterateText( const ScMarkData& rMultiMark, sal_Int32 nType )
+void ScDocument::TransliterateText( const ScMarkData& rMultiMark, TransliterationFlags nType )
{
OSL_ENSURE( rMultiMark.IsMultiMarked(), "TransliterateText: no selection" );
@@ -1216,7 +1214,7 @@ void ScDocument::TransliterateText( const ScMarkData& rMultiMark, sal_Int32 nTyp
// for performance reasons.
if (aCell.meType == CELLTYPE_EDIT ||
(aCell.meType == CELLTYPE_STRING &&
- ( nType == i18n::TransliterationModulesExtra::SENTENCE_CASE || nType == i18n::TransliterationModulesExtra::TITLE_CASE)))
+ ( nType == TransliterationFlags::SENTENCE_CASE || nType == TransliterationFlags::TITLE_CASE)))
{
if (!pEngine)
pEngine.reset(new ScFieldEditEngine(this, GetEnginePool(), GetEditPool()));
diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx
index 7cf155714c8f..2d38b7b3b606 100644
--- a/sc/source/core/data/table6.cxx
+++ b/sc/source/core/data/table6.cxx
@@ -17,8 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <com/sun/star/i18n/TransliterationModules.hpp>
-
#include <unotools/textsearch.hxx>
#include <svl/srchitem.hxx>
#include <editeng/editobj.hxx>
@@ -800,7 +798,7 @@ bool ScTable::SearchAndReplace(
else
{
// SearchParam no longer needed - SearchOptions contains all settings
- css::util::SearchOptions2 aSearchOptions = rSearchItem.GetSearchOptions();
+ i18nutil::SearchOptions2 aSearchOptions = rSearchItem.GetSearchOptions();
aSearchOptions.Locale = *ScGlobal::GetLocale();
if (aSearchOptions.searchString.isEmpty() || ( rSearchItem.GetRegExp() && aSearchOptions.searchString == "^$" ) )
@@ -814,8 +812,8 @@ bool ScTable::SearchAndReplace(
// This is also done in SvxSearchDialog CommandHdl, but not in API object.
if ( !rSearchItem.IsUseAsianOptions() )
aSearchOptions.transliterateFlags &=
- ( css::i18n::TransliterationModules_IGNORE_CASE |
- css::i18n::TransliterationModules_IGNORE_WIDTH );
+ ( TransliterationFlags::IGNORE_CASE |
+ TransliterationFlags::IGNORE_WIDTH );
pSearchText = new utl::TextSearch( aSearchOptions );
diff --git a/sc/source/core/tool/cellkeytranslator.cxx b/sc/source/core/tool/cellkeytranslator.cxx
index 013e640c6f86..8ccae176afd1 100644
--- a/sc/source/core/tool/cellkeytranslator.cxx
+++ b/sc/source/core/tool/cellkeytranslator.cxx
@@ -21,11 +21,10 @@
#include <comphelper/processfactory.hxx>
#include <i18nlangtag/mslangid.hxx>
#include <i18nlangtag/lang.h>
+#include <i18nutil/transliteration.hxx>
#include <rtl/ustring.hxx>
#include <unotools/syslocale.hxx>
-#include <com/sun/star/i18n/TransliterationModules.hpp>
-
using ::com::sun::star::uno::Sequence;
using ::std::list;
@@ -171,7 +170,7 @@ void ScCellKeywordTranslator::transKeyword(OUString& rName, const lang::Locale*
ScCellKeywordTranslator::ScCellKeywordTranslator() :
maTransWrapper( ::comphelper::getProcessComponentContext(),
- i18n::TransliterationModules_LOWERCASE_UPPERCASE )
+ TransliterationFlags::LOWERCASE_UPPERCASE )
{
init();
}
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 626c9b34a955..57c15865716c 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -3338,7 +3338,7 @@ void ScInterpreter::ScChar()
static OUString lcl_convertIntoHalfWidth( const OUString & rStr )
{
static bool bFirstASCCall = true;
- static utl::TransliterationWrapper aTrans( ::comphelper::getProcessComponentContext(), 0 );
+ static utl::TransliterationWrapper aTrans( ::comphelper::getProcessComponentContext(), TransliterationFlags::NONE );
if( bFirstASCCall )
{
@@ -3352,7 +3352,7 @@ static OUString lcl_convertIntoHalfWidth( const OUString & rStr )
static OUString lcl_convertIntoFullWidth( const OUString & rStr )
{
static bool bFirstJISCall = true;
- static utl::TransliterationWrapper aTrans( ::comphelper::getProcessComponentContext(), 0 );
+ static utl::TransliterationWrapper aTrans( ::comphelper::getProcessComponentContext(), TransliterationFlags::NONE );
if( bFirstJISCall )
{
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 5273985bd960..f2d85bcfaa5b 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -714,7 +714,7 @@ bool ScDocFunc::DeleteCell(
return true;
}
-bool ScDocFunc::TransliterateText( const ScMarkData& rMark, sal_Int32 nType,
+bool ScDocFunc::TransliterateText( const ScMarkData& rMark, TransliterationFlags nType,
bool bApi )
{
ScDocShellModificator aModificator( rDocShell );
diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx
index 34e2f3b81637..7d35de73891d 100644
--- a/sc/source/ui/drawfunc/drtxtob.cxx
+++ b/sc/source/ui/drawfunc/drtxtob.cxx
@@ -1188,8 +1188,8 @@ void ScDrawTextObjectBar::GetAttrState( SfxItemSet& rDestSet )
void ScDrawTextObjectBar::ExecuteTrans( SfxRequest& rReq )
{
- sal_Int32 nType = ScViewUtil::GetTransliterationType( rReq.GetSlot() );
- if ( nType )
+ TransliterationFlags nType = ScViewUtil::GetTransliterationType( rReq.GetSlot() );
+ if ( nType != TransliterationFlags::NONE )
{
ScDrawView* pView = pViewData->GetScDrawView();
OutlinerView* pOutView = pView->GetTextEditOutlinerView();
diff --git a/sc/source/ui/inc/docfunc.hxx b/sc/source/ui/inc/docfunc.hxx
index 0c5f19899d84..d3ec7e935ef1 100644
--- a/sc/source/ui/inc/docfunc.hxx
+++ b/sc/source/ui/inc/docfunc.hxx
@@ -46,11 +46,10 @@ struct ScCellMergeOption;
class ScConditionalFormat;
class ScConditionalFormatList;
class ScUndoRemoveMerge;
+enum class TransliterationFlags;
namespace sc {
-
-struct ColRowSpan;
-
+ struct ColRowSpan;
}
class ScDocFunc
@@ -92,7 +91,7 @@ public:
bool DeleteCell(
const ScAddress& rPos, const ScMarkData& rMark, InsertDeleteFlags nFlags, bool bRecord );
- bool TransliterateText( const ScMarkData& rMark, sal_Int32 nType,
+ bool TransliterateText( const ScMarkData& rMark, TransliterationFlags nType,
bool bApi );
bool SetNormalString( bool& o_rbNumFmtSet, const ScAddress& rPos, const OUString& rText, bool bApi );
diff --git a/sc/source/ui/inc/undoblk.hxx b/sc/source/ui/inc/undoblk.hxx
index 4be768e47de1..76e4433d7e80 100644
--- a/sc/source/ui/inc/undoblk.hxx
+++ b/sc/source/ui/inc/undoblk.hxx
@@ -846,7 +846,7 @@ class ScUndoTransliterate: public ScBlockUndo
{
public:
ScUndoTransliterate( ScDocShell* pNewDocShell, const ScMarkData& rMark,
- ScDocument* pNewUndoDoc, sal_Int32 nType );
+ ScDocument* pNewUndoDoc, TransliterationFlags nType );
virtual ~ScUndoTransliterate() override;
virtual void Undo() override;
@@ -860,7 +860,8 @@ private:
ScMarkData aMarkData;
std::unique_ptr<ScDocument>
pUndoDoc;
- sal_Int32 nTransliterationType;
+ TransliterationFlags
+ nTransliterationType;
};
class ScUndoClearItems: public ScBlockUndo
diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx
index 59f7af27de2c..57f9a277d369 100644
--- a/sc/source/ui/inc/viewfunc.hxx
+++ b/sc/source/ui/inc/viewfunc.hxx
@@ -231,7 +231,7 @@ public:
void FillCrossDblClick();
void ConvertFormulaToValue();
- void TransliterateText( sal_Int32 nType );
+ void TransliterateText( TransliterationFlags nType );
ScAutoFormatData* CreateAutoFormatData();
void AutoFormat( sal_uInt16 nFormatNo );
diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index 46b5d47fa3ee..8ab8095a52da 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -1913,7 +1913,7 @@ bool ScUndoIndent::CanRepeat(SfxRepeatTarget& rTarget) const
}
ScUndoTransliterate::ScUndoTransliterate( ScDocShell* pNewDocShell, const ScMarkData& rMark,
- ScDocument* pNewUndoDoc, sal_Int32 nType ) :
+ ScDocument* pNewUndoDoc, TransliterationFlags nType ) :
ScBlockUndo( pNewDocShell, lcl_GetMultiMarkRange(rMark), SC_UNDO_AUTOHEIGHT ),
aMarkData( rMark ),
pUndoDoc( pNewUndoDoc ),
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 88c6fbc49db9..a6810dbd125d 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -98,8 +98,6 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <cppuhelper/bootstrap.hxx>
-#include <com/sun/star/i18n/TransliterationModules.hpp>
-#include <com/sun/star/i18n/TransliterationModulesExtra.hpp>
#include <memory>
@@ -2593,8 +2591,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
void ScCellShell::ExecuteTrans( SfxRequest& rReq )
{
- sal_Int32 nType = ScViewUtil::GetTransliterationType( rReq.GetSlot() );
- if ( nType )
+ TransliterationFlags nType = ScViewUtil::GetTransliterationType( rReq.GetSlot() );
+ if ( nType != TransliterationFlags::NONE )
{
GetViewData()->GetView()->TransliterateText( nType );
rReq.Done();
diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index 49d20e7ab526..03a0c6d15b9c 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -1287,8 +1287,8 @@ void ScEditShell::GetUndoState(SfxItemSet &rSet)
void ScEditShell::ExecuteTrans( SfxRequest& rReq )
{
- sal_Int32 nType = ScViewUtil::GetTransliterationType( rReq.GetSlot() );
- if ( nType )
+ TransliterationFlags nType = ScViewUtil::GetTransliterationType( rReq.GetSlot() );
+ if ( nType != TransliterationFlags::NONE )
{
ScInputHandler* pHdl = GetMyInputHdl();
assert(pHdl && "no ScInputHandler");
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 0965e89b8b2b..e0d381df6419 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -1608,7 +1608,7 @@ void ScViewFunc::ConvertFormulaToValue()
pDocSh->PostPaint(aRange, PaintPartFlags::Grid);
}
-void ScViewFunc::TransliterateText( sal_Int32 nType )
+void ScViewFunc::TransliterateText( TransliterationFlags nType )
{
ScMarkData aFuncMark = GetViewData().GetMarkData();
if ( !aFuncMark.IsMarked() && !aFuncMark.IsMultiMarked() )
diff --git a/sc/source/ui/view/viewutil.cxx b/sc/source/ui/view/viewutil.cxx
index fcd0e5c621a3..bd4afc6e47e3 100644
--- a/sc/source/ui/view/viewutil.cxx
+++ b/sc/source/ui/view/viewutil.cxx
@@ -37,9 +37,6 @@
#include <svl/stritem.hxx>
#include <svl/eitem.hxx>
-#include <com/sun/star/i18n/TransliterationModules.hpp>
-#include <com/sun/star/i18n/TransliterationModulesExtra.hpp>
-
#include "viewutil.hxx"
#include "global.hxx"
#include "chgtrack.hxx"
@@ -101,37 +98,37 @@ sal_uInt16 ScViewUtil::GetEffLanguage( ScDocument* pDoc, const ScAddress& rPos )
return eLnge;
}
-sal_Int32 ScViewUtil::GetTransliterationType( sal_uInt16 nSlotID )
+TransliterationFlags ScViewUtil::GetTransliterationType( sal_uInt16 nSlotID )
{
- sal_Int32 nType = 0;
+ TransliterationFlags nType = TransliterationFlags::NONE;
switch ( nSlotID )
{
case SID_TRANSLITERATE_SENTENCE_CASE:
- nType = css::i18n::TransliterationModulesExtra::SENTENCE_CASE;
+ nType = TransliterationFlags::SENTENCE_CASE;
break;
case SID_TRANSLITERATE_TITLE_CASE:
- nType = css::i18n::TransliterationModulesExtra::TITLE_CASE;
+ nType = TransliterationFlags::TITLE_CASE;
break;
case SID_TRANSLITERATE_TOGGLE_CASE:
- nType = css::i18n::TransliterationModulesExtra::TOGGLE_CASE;
+ nType = TransliterationFlags::TOGGLE_CASE;
break;
case SID_TRANSLITERATE_UPPER:
- nType = css::i18n::TransliterationModules_LOWERCASE_UPPERCASE;
+ nType = TransliterationFlags::LOWERCASE_UPPERCASE;
break;
case SID_TRANSLITERATE_LOWER:
- nType = css::i18n::TransliterationModules_UPPERCASE_LOWERCASE;
+ nType = TransliterationFlags::UPPERCASE_LOWERCASE;
break;
case SID_TRANSLITERATE_HALFWIDTH:
- nType = css::i18n::TransliterationModules_FULLWIDTH_HALFWIDTH;
+ nType = TransliterationFlags::FULLWIDTH_HALFWIDTH;
break;
case SID_TRANSLITERATE_FULLWIDTH:
- nType = css::i18n::TransliterationModules_HALFWIDTH_FULLWIDTH;
+ nType = TransliterationFlags::HALFWIDTH_FULLWIDTH;
break;
case SID_TRANSLITERATE_HIRAGANA:
- nType = css::i18n::TransliterationModules_KATAKANA_HIRAGANA;
+ nType = TransliterationFlags::KATAKANA_HIRAGANA;
break;
case SID_TRANSLITERATE_KATAGANA:
- nType = css::i18n::TransliterationModules_HIRAGANA_KATAKANA;
+ nType = TransliterationFlags::HIRAGANA_KATAKANA;
break;
}
return nType;