diff options
author | Niklas Nebel <nn@openoffice.org> | 2001-03-26 18:26:30 +0000 |
---|---|---|
committer | Niklas Nebel <nn@openoffice.org> | 2001-03-26 18:26:30 +0000 |
commit | 8307bfb0388b946a86876096cef78d012479e981 (patch) | |
tree | ca1872bc41533fec5b63aee6c02fe575da279671 | |
parent | ac67f489432eebcb1b37d354f4599bbe72588ae5 (diff) |
transliteration menu functions
-rw-r--r-- | sc/inc/document.hxx | 6 | ||||
-rw-r--r-- | sc/sdi/cellsh.sdi | 11 | ||||
-rw-r--r-- | sc/sdi/drtxtob.sdi | 7 | ||||
-rw-r--r-- | sc/sdi/editsh.sdi | 7 | ||||
-rw-r--r-- | sc/source/core/data/documen8.cxx | 63 | ||||
-rw-r--r-- | sc/source/ui/docshell/docfunc.cxx | 40 | ||||
-rw-r--r-- | sc/source/ui/drawfunc/drtxtob.cxx | 27 | ||||
-rw-r--r-- | sc/source/ui/drawfunc/objdraw.src | 6 | ||||
-rw-r--r-- | sc/source/ui/inc/cellsh.hxx | 5 | ||||
-rw-r--r-- | sc/source/ui/inc/docfunc.hxx | 7 | ||||
-rw-r--r-- | sc/source/ui/inc/drtxtob.hxx | 5 | ||||
-rw-r--r-- | sc/source/ui/inc/editsh.hxx | 5 | ||||
-rw-r--r-- | sc/source/ui/inc/viewfunc.hxx | 6 | ||||
-rw-r--r-- | sc/source/ui/inc/viewutil.hxx | 6 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh1.cxx | 15 | ||||
-rw-r--r-- | sc/source/ui/view/editsh.cxx | 27 | ||||
-rw-r--r-- | sc/source/ui/view/viewfun2.cxx | 24 | ||||
-rw-r--r-- | sc/source/ui/view/viewutil.cxx | 34 |
18 files changed, 265 insertions, 36 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 166c52371983..503e54a80acf 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -2,9 +2,9 @@ * * $RCSfile: document.hxx,v $ * - * $Revision: 1.29 $ + * $Revision: 1.30 $ * - * last change: $Author: nn $ $Date: 2001-03-23 09:48:27 $ + * last change: $Author: nn $ $Date: 2001-03-26 19:20:15 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -929,6 +929,8 @@ public: USHORT nFlags, USHORT nFunction, BOOL bSkipEmpty, BOOL bAsLink ); + void TransliterateText( const ScMarkData& rMultiMark, sal_Int32 nType ); + void InitUndo( ScDocument* pSrcDoc, USHORT nTab1, USHORT nTab2, BOOL bColInfo = FALSE, BOOL bRowInfo = FALSE ); void AddUndoTab( USHORT nTab1, USHORT nTab2, diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi index abce92be7130..2bf64b7c68ad 100644 --- a/sc/sdi/cellsh.sdi +++ b/sc/sdi/cellsh.sdi @@ -3,7 +3,7 @@ // StarCalc // // (C) 1994 StarDivision GmbH, Hamburg, Germany - // $Author: er $ $Date: 2001-02-06 14:46:11 $ $Revision: 1.2 $ + // $Author: nn $ $Date: 2001-03-26 19:18:57 $ $Revision: 1.3 $ // $Logfile: T:/sc/sdi/cellsh.sdv $ $Workfile: cellsh.sdi $ //---------------------------------------------------------------------------- @@ -161,6 +161,12 @@ interface CellSelection : Selection SID_THESAURUS [ ExecMethod = ExecuteEdit; StateMethod = GetCellState; ] SID_SPELLING [ ExecMethod = ExecuteEdit; StateMethod = GetState; ] + SID_TRANSLITERATE_UPPER [ ExecMethod = ExecuteTrans; StateMethod = GetBlockState; ] + SID_TRANSLITERATE_LOWER [ ExecMethod = ExecuteTrans; StateMethod = GetBlockState; ] + SID_TRANSLITERATE_HALFWIDTH [ ExecMethod = ExecuteTrans; StateMethod = GetBlockState; ] + SID_TRANSLITERATE_FULLWIDTH [ ExecMethod = ExecuteTrans; StateMethod = GetBlockState; ] + SID_TRANSLITERATE_HIRAGANA [ ExecMethod = ExecuteTrans; StateMethod = GetBlockState; ] + SID_TRANSLITERATE_KATAGANA [ ExecMethod = ExecuteTrans; StateMethod = GetBlockState; ] } // =========================================================================== @@ -370,6 +376,9 @@ shell ScCellShell : ScFormatShell /*------------------------------------------------------------------------ $Log: not supported by cvs2svn $ + Revision 1.2 2001/02/06 14:46:11 er + SID_DEL_COLS, SID_DEL_ROWS: StateMethod GetBlockState instead of GetState (need matrix formula check) + Revision 1.1.1.1 2000/09/18 16:44:52 hr initial import diff --git a/sc/sdi/drtxtob.sdi b/sc/sdi/drtxtob.sdi index 98a2c0d7bd46..e92bfb06b550 100644 --- a/sc/sdi/drtxtob.sdi +++ b/sc/sdi/drtxtob.sdi @@ -86,6 +86,13 @@ interface TableDrawText : Selection SID_TEXTDIRECTION_LEFT_TO_RIGHT [ ExecMethod = Execute; StateMethod = GetAttrState; Export = FALSE; ] SID_TEXTDIRECTION_TOP_TO_BOTTOM [ ExecMethod = Execute; StateMethod = GetAttrState; Export = FALSE; ] + + SID_TRANSLITERATE_UPPER [ ExecMethod = ExecuteTrans; StateMethod = GetState; Export = FALSE; ] + SID_TRANSLITERATE_LOWER [ ExecMethod = ExecuteTrans; StateMethod = GetState; Export = FALSE; ] + SID_TRANSLITERATE_HALFWIDTH [ ExecMethod = ExecuteTrans; StateMethod = GetState; Export = FALSE; ] + SID_TRANSLITERATE_FULLWIDTH [ ExecMethod = ExecuteTrans; StateMethod = GetState; Export = FALSE; ] + SID_TRANSLITERATE_HIRAGANA [ ExecMethod = ExecuteTrans; StateMethod = GetState; Export = FALSE; ] + SID_TRANSLITERATE_KATAGANA [ ExecMethod = ExecuteTrans; StateMethod = GetState; Export = FALSE; ] } diff --git a/sc/sdi/editsh.sdi b/sc/sdi/editsh.sdi index bb04de8e4347..74a381092c41 100644 --- a/sc/sdi/editsh.sdi +++ b/sc/sdi/editsh.sdi @@ -50,6 +50,13 @@ interface TableText : Selection SID_HYPERLINK_SETLINK [ ExecMethod = Execute; Export = FALSE; ] SID_HYPERLINK_GETLINK [ StateMethod = GetState; Export = FALSE; ] + + SID_TRANSLITERATE_UPPER [ ExecMethod = ExecuteTrans; StateMethod = GetState; Export = FALSE; ] + SID_TRANSLITERATE_LOWER [ ExecMethod = ExecuteTrans; StateMethod = GetState; Export = FALSE; ] + SID_TRANSLITERATE_HALFWIDTH [ ExecMethod = ExecuteTrans; StateMethod = GetState; Export = FALSE; ] + SID_TRANSLITERATE_FULLWIDTH [ ExecMethod = ExecuteTrans; StateMethod = GetState; Export = FALSE; ] + SID_TRANSLITERATE_HIRAGANA [ ExecMethod = ExecuteTrans; StateMethod = GetState; Export = FALSE; ] + SID_TRANSLITERATE_KATAGANA [ ExecMethod = ExecuteTrans; StateMethod = GetState; Export = FALSE; ] } diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx index 2233c19c0055..622f20b36888 100644 --- a/sc/source/core/data/documen8.cxx +++ b/sc/source/core/data/documen8.cxx @@ -2,9 +2,9 @@ * * $RCSfile: documen8.cxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: jp $ $Date: 2001-03-08 20:46:40 $ + * last change: $Author: nn $ $Date: 2001-03-26 19:20:53 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -72,6 +72,7 @@ #include <svx/editstat.hxx> #include <svx/langitem.hxx> #include <svx/linkmgr.hxx> +#include <svx/scripttypeitem.hxx> #include <svx/unolingu.hxx> #include <sfx2/objsh.hxx> #include <sfx2/printer.hxx> @@ -83,6 +84,7 @@ #include <svtools/zformat.hxx> #include <sfx2/misccfg.hxx> #include <sfx2/app.hxx> +#include <unotools/transliterationwrapper.hxx> #include <vcl/msgbox.hxx> #include <vcl/system.hxx> @@ -112,6 +114,7 @@ #include "chartlis.hxx" #include "refupdat.hxx" #include "validat.hxx" // fuer HasMacroCalls +#include "markdata.hxx" #include "globstr.hrc" #include "sc.hrc" @@ -1560,5 +1563,61 @@ SfxBindings* ScDocument::GetViewBindings() return NULL; } +//------------------------------------------------------------------------ + +void ScDocument::TransliterateText( const ScMarkData& rMultiMark, sal_Int32 nType ) +{ + DBG_ASSERT( rMultiMark.IsMultiMarked(), "TransliterateText: no selection" ); + + utl::TransliterationWrapper aTranslitarationWrapper( xServiceManager, nType ); + BOOL bConsiderLanguage = aTranslitarationWrapper.needLanguageForTheMode(); + sal_uInt16 nLanguage = LANGUAGE_SYSTEM; + + USHORT nCount = GetTableCount(); + for (USHORT nTab = 0; nTab < nCount; nTab++) + if ( pTab[nTab] && rMultiMark.GetTableSelect(nTab) ) + { + USHORT nCol = 0; + USHORT nRow = 0; + + BOOL bFound = rMultiMark.IsCellMarked( nCol, nRow ); + if (!bFound) + bFound = GetNextMarkedCell( nCol, nRow, nTab, rMultiMark ); + + while (bFound) + { + const ScBaseCell* pCell = GetCell( ScAddress( nCol, nRow, nTab ) ); + CellType eType = pCell ? pCell->GetCellType() : CELLTYPE_NONE; + + //! TransliterateText method for EditEngine needed + + if ( eType == CELLTYPE_STRING || eType == CELLTYPE_EDIT ) + { + String aOldStr; + if ( eType == CELLTYPE_STRING ) + ((const ScStringCell*)pCell)->GetString(aOldStr); + else + ((const ScEditCell*)pCell)->GetString(aOldStr); + xub_StrLen nOldLen = aOldStr.Len(); + + if ( bConsiderLanguage ) + { + BYTE nScript = GetStringScriptType( aOldStr ); //! cell script type? + USHORT nWhich = ( nScript == SCRIPTTYPE_ASIAN ) ? ATTR_CJK_FONT_LANGUAGE : + ( ( nScript == SCRIPTTYPE_COMPLEX ) ? ATTR_CTL_FONT_LANGUAGE : + ATTR_FONT_LANGUAGE ); + nLanguage = ((const SvxLanguageItem*)GetAttr( nCol, nRow, nTab, nWhich ))->GetValue(); + } + + com::sun::star::uno::Sequence<sal_Int32> aOffsets; + String aNewStr = aTranslitarationWrapper.transliterate( aOldStr, nLanguage, 0, nOldLen, &aOffsets ); + if ( aNewStr != aOldStr ) + PutCell( ScAddress( nCol, nRow, nTab ), new ScStringCell( aNewStr ) ); + } + + bFound = GetNextMarkedCell( nCol, nRow, nTab, rMultiMark ); + } + } +} diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 540d717c857e..c10e816e57d0 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -2,9 +2,9 @@ * * $RCSfile: docfunc.cxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: nn $ $Date: 2001-03-23 09:51:58 $ + * last change: $Author: nn $ $Date: 2001-03-26 19:25:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -685,6 +685,42 @@ BOOL ScDocFunc::DeleteContents( const ScMarkData& rMark, USHORT nFlags, //------------------------------------------------------------------------ +BOOL ScDocFunc::TransliterateText( const ScMarkData& rMark, sal_Int32 nType, + BOOL bRecord, BOOL bApi ) +{ + ScDocShellModificator aModificator( rDocShell ); + + ScDocument* pDoc = rDocShell.GetDocument(); + if (bRecord && !pDoc->IsUndoEnabled()) + bRecord = FALSE; + + if (!pDoc->IsSelectionEditable(rMark)) + { + if (!bApi) + rDocShell.ErrorMessage(STR_PROTECTIONERR); + return FALSE; + } + + ScRange aMarkRange; + ScMarkData aMultiMark = rMark; + aMultiMark.SetMarking(FALSE); // for MarkToMulti + aMultiMark.MarkToMulti(); + aMultiMark.GetMultiMarkArea( aMarkRange ); + + //! undo + + pDoc->TransliterateText( aMultiMark, nType ); + + if (!AdjustRowHeight( aMarkRange )) + rDocShell.PostPaint( aMarkRange, PAINT_GRID ); + + aModificator.SetDocumentModified(); + + return TRUE; +} + +//------------------------------------------------------------------------ + BOOL ScDocFunc::SetNormalString( const ScAddress& rPos, const String& rText, BOOL bApi ) { ScDocShellModificator aModificator( rDocShell ); diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx index acb43150ed6a..0caf5ffa70f5 100644 --- a/sc/source/ui/drawfunc/drtxtob.cxx +++ b/sc/source/ui/drawfunc/drtxtob.cxx @@ -2,9 +2,9 @@ * * $RCSfile: drtxtob.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: nn $ $Date: 2001-03-09 19:47:42 $ + * last change: $Author: nn $ $Date: 2001-03-26 19:26:30 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -573,7 +573,7 @@ void lcl_RemoveFields( OutlinerView& rOutView ) if ( nPar >= aSel.nStartPara && nPar <= aSel.nEndPara ) { SvUShorts aPortions; - rEditEng.GetPortions( nPar, aPortions ); + rEditEng.GetPortions( (USHORT)nPar, aPortions ); //! GetPortions should use xub_StrLen instead of USHORT for ( USHORT nPos = aPortions.Count(); nPos; ) @@ -586,7 +586,7 @@ void lcl_RemoveFields( OutlinerView& rOutView ) ( nPar > aSel.nStartPara || nStart >= aSel.nStartPos ) && ( nPar < aSel.nEndPara || nEnd <= aSel.nEndPos ) ) { - ESelection aFieldSel( nPar, nStart, nPar, nEnd ); + ESelection aFieldSel( (USHORT)nPar, nStart, (USHORT)nPar, nEnd ); SfxItemSet aSet = rEditEng.GetAttribs( aFieldSel ); if ( aSet.GetItemState( EE_FEATURE_FIELD ) == SFX_ITEM_ON ) { @@ -940,5 +940,22 @@ void __EXPORT ScDrawTextObjectBar::GetAttrState( SfxItemSet& rDestSet ) rDestSet.Put( SfxBoolItem( SID_TEXTDIRECTION_TOP_TO_BOTTOM, !bLeftToRight ) ); } - +void ScDrawTextObjectBar::ExecuteTrans( SfxRequest& rReq ) +{ + sal_Int32 nType = ScViewUtil::GetTransliterationType( rReq.GetSlot() ); + if ( nType ) + { + ScDrawView* pView = pViewData->GetScDrawView(); + OutlinerView* pOutView = pView->GetTextEditOutlinerView(); + if ( pOutView ) + { + // change selected text in object + pOutView->TransliterateText( nType ); + } + else + { + //! apply to whole objects? + } + } +} diff --git a/sc/source/ui/drawfunc/objdraw.src b/sc/source/ui/drawfunc/objdraw.src index 96eb072d3daf..2c258b637408 100644 --- a/sc/source/ui/drawfunc/objdraw.src +++ b/sc/source/ui/drawfunc/objdraw.src @@ -2,9 +2,9 @@ * * $RCSfile: objdraw.src,v $ * - * $Revision: 1.16 $ + * $Revision: 1.17 $ * - * last change: $Author: obo $ $Date: 2001-03-21 20:32:08 $ + * last change: $Author: nn $ $Date: 2001-03-26 19:26:30 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1380,6 +1380,8 @@ Menu RID_OBJECTMENU_DRAWTEXT MenuItem { Separator = TRUE ; }; MN_DRWTXT MenuItem { Separator = TRUE ; }; + ITEM_TRANSLITERATE_MENU + MenuItem { Separator = TRUE ; }; MN_DRWTXTATTR MenuItem { diff --git a/sc/source/ui/inc/cellsh.hxx b/sc/source/ui/inc/cellsh.hxx index a98b6e0c7f79..2d27dee10dea 100644 --- a/sc/source/ui/inc/cellsh.hxx +++ b/sc/source/ui/inc/cellsh.hxx @@ -2,9 +2,9 @@ * * $RCSfile: cellsh.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:44:57 $ + * last change: $Author: nn $ $Date: 2001-03-26 19:21:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -92,6 +92,7 @@ public: void GetState(SfxItemSet &); void ExecuteEdit( SfxRequest& rReq ); + void ExecuteTrans( SfxRequest& rReq ); void GetBlockState( SfxItemSet& rSet ); void GetCellState( SfxItemSet& rSet ); diff --git a/sc/source/ui/inc/docfunc.hxx b/sc/source/ui/inc/docfunc.hxx index 93015725cee6..422ed66776ae 100644 --- a/sc/source/ui/inc/docfunc.hxx +++ b/sc/source/ui/inc/docfunc.hxx @@ -2,9 +2,9 @@ * * $RCSfile: docfunc.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:44:58 $ + * last change: $Author: nn $ $Date: 2001-03-26 19:21:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -113,6 +113,9 @@ public: BOOL DeleteContents( const ScMarkData& rMark, USHORT nFlags, BOOL bRecord, BOOL bApi ); + BOOL TransliterateText( const ScMarkData& rMark, sal_Int32 nType, + BOOL bRecord, BOOL bApi ); + BOOL SetNormalString( const ScAddress& rPos, const String& rText, BOOL bApi ); BOOL PutCell( const ScAddress& rPos, ScBaseCell* pNewCell, BOOL bApi ); BOOL PutData( const ScAddress& rPos, EditEngine& rEngine, diff --git a/sc/source/ui/inc/drtxtob.hxx b/sc/source/ui/inc/drtxtob.hxx index 913e253d4898..c670fafbb822 100644 --- a/sc/source/ui/inc/drtxtob.hxx +++ b/sc/source/ui/inc/drtxtob.hxx @@ -2,9 +2,9 @@ * * $RCSfile: drtxtob.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:44:58 $ + * last change: $Author: nn $ $Date: 2001-03-26 19:21:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -92,6 +92,7 @@ public: void StateDisableItems( SfxItemSet &rSet ); void Execute( SfxRequest &rReq ); + void ExecuteTrans( SfxRequest& rReq ); void GetState( SfxItemSet& rSet ); void GetClipState( SfxItemSet& rSet ); diff --git a/sc/source/ui/inc/editsh.hxx b/sc/source/ui/inc/editsh.hxx index f4cb74f58b40..b3157cc600ae 100644 --- a/sc/source/ui/inc/editsh.hxx +++ b/sc/source/ui/inc/editsh.hxx @@ -2,9 +2,9 @@ * * $RCSfile: editsh.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: nn $ $Date: 2000-12-13 11:39:20 $ + * last change: $Author: nn $ $Date: 2001-03-26 19:21:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -94,6 +94,7 @@ public: void SetEditView(EditView* pView); void Execute(SfxRequest& rReq); + void ExecuteTrans(SfxRequest& rReq); void GetState(SfxItemSet &rSet); void GetClipState(SfxItemSet& rSet); diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx index c74a99d52660..eb88a543096b 100644 --- a/sc/source/ui/inc/viewfunc.hxx +++ b/sc/source/ui/inc/viewfunc.hxx @@ -2,9 +2,9 @@ * * $RCSfile: viewfunc.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: nn $ $Date: 2001-02-14 19:16:31 $ + * last change: $Author: nn $ $Date: 2001-03-26 19:21:59 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -281,6 +281,8 @@ public: void FillAuto( FillDir eDir, USHORT nStartCol, USHORT nStartRow, USHORT nEndCol, USHORT nEndRow, USHORT nCount, BOOL bRecord = TRUE ); + void TransliterateText( sal_Int32 nType ); + ScAutoFormatData* CreateAutoFormatData(); void AutoFormat( USHORT nFormatNo, BOOL bRecord = TRUE ); diff --git a/sc/source/ui/inc/viewutil.hxx b/sc/source/ui/inc/viewutil.hxx index cdb3acc6c2da..1fde471cdcc0 100644 --- a/sc/source/ui/inc/viewutil.hxx +++ b/sc/source/ui/inc/viewutil.hxx @@ -2,9 +2,9 @@ * * $RCSfile: viewutil.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: nn $ $Date: 2000-11-26 13:42:40 $ + * last change: $Author: nn $ $Date: 2001-03-26 19:21:59 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -96,6 +96,8 @@ public: USHORT nWhichId, USHORT nScript ); static USHORT GetEffLanguage( ScDocument* pDoc, const ScAddress& rPos ); + + static sal_Int32 GetTransliterationType( USHORT nSlotID ); }; // --------------------------------------------------------------------------- diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 7dd2d11ddf21..5547dc2d897a 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -2,9 +2,9 @@ * * $RCSfile: cellsh1.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: nn $ $Date: 2001-02-14 19:29:04 $ + * last change: $Author: nn $ $Date: 2001-03-26 19:24:33 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1792,7 +1792,14 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) } } - - +void ScCellShell::ExecuteTrans( SfxRequest& rReq ) +{ + sal_Int32 nType = ScViewUtil::GetTransliterationType( rReq.GetSlot() ); + if ( nType ) + { + GetViewData()->GetView()->TransliterateText( nType ); + rReq.Done(); + } +} diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index f256a8cf841e..63983cd1528e 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -2,9 +2,9 @@ * * $RCSfile: editsh.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: nn $ $Date: 2000-12-13 11:40:08 $ + * last change: $Author: nn $ $Date: 2001-03-26 19:24:33 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -881,3 +881,26 @@ void ScEditShell::GetUndoState(SfxItemSet &rSet) } } +void ScEditShell::ExecuteTrans( SfxRequest& rReq ) +{ + sal_Int32 nType = ScViewUtil::GetTransliterationType( rReq.GetSlot() ); + if ( nType ) + { + ScInputHandler* pHdl = SC_MOD()->GetInputHdl(); + DBG_ASSERT( pHdl, "no ScInputHandler" ); + + EditView* pTopView = pHdl->GetTopView(); + EditView* pTableView = pHdl->GetTableView(); + DBG_ASSERT( pTableView, "no EditView" ); + + EditEngine* pEngine = pTableView->GetEditEngine(); + pHdl->DataChanging(); + + pTableView->TransliterateText( nType ); + if (pTopView) + pTopView->TransliterateText( nType ); + + pHdl->DataChanged(); + } +} + diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index 64a604813498..8057a9a03025 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -2,9 +2,9 @@ * * $RCSfile: viewfun2.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: nn $ $Date: 2001-02-26 14:12:11 $ + * last change: $Author: nn $ $Date: 2001-03-26 19:24:33 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1003,6 +1003,26 @@ void ScViewFunc::FillTab( USHORT nFlags, USHORT nFunction, BOOL bSkipEmpty, BOOL pDocSh->PostDataChanged(); } +//---------------------------------------------------------------------------- + +void ScViewFunc::TransliterateText( sal_Int32 nType ) +{ + ScMarkData aFuncMark = GetViewData()->GetMarkData(); + if ( !aFuncMark.IsMarked() && !aFuncMark.IsMultiMarked() ) + { + // no selection -> use cursor position + + ScAddress aCursor( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); + aFuncMark.SetMarkArea( ScRange( aCursor ) ); + } + + BOOL bSuccess = GetViewData()->GetDocShell()->GetDocFunc(). + TransliterateText( aFuncMark, nType, TRUE, FALSE ); + if (bSuccess) + { + GetViewData()->GetViewShell()->UpdateInputHandler(); + } +} //---------------------------------------------------------------------------- // AutoFormat diff --git a/sc/source/ui/view/viewutil.cxx b/sc/source/ui/view/viewutil.cxx index c5ceef79cf6b..2e1973b637a8 100644 --- a/sc/source/ui/view/viewutil.cxx +++ b/sc/source/ui/view/viewutil.cxx @@ -2,9 +2,9 @@ * * $RCSfile: viewutil.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: nn $ $Date: 2000-11-26 13:44:00 $ + * last change: $Author: nn $ $Date: 2001-03-26 19:24:33 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -79,6 +79,8 @@ #include <vcl/msgbox.hxx> #include <vcl/wrkwin.hxx> +#include <com/sun/star/i18n/TransliterationModules.hpp> + #include "viewutil.hxx" #include "global.hxx" #include "chgtrack.hxx" @@ -136,6 +138,34 @@ USHORT ScViewUtil::GetEffLanguage( ScDocument* pDoc, const ScAddress& rPos ) } // static +sal_Int32 ScViewUtil::GetTransliterationType( USHORT nSlotID ) +{ + sal_Int32 nType = 0; + switch ( nSlotID ) + { + case SID_TRANSLITERATE_UPPER: + nType = com::sun::star::i18n::TransliterationModules_LOWERCASE_UPPERCASE; + break; + case SID_TRANSLITERATE_LOWER: + nType = com::sun::star::i18n::TransliterationModules_UPPERCASE_LOWERCASE; + break; + case SID_TRANSLITERATE_HALFWIDTH: + nType = com::sun::star::i18n::TransliterationModules_FULLWIDTH_HALFWIDTH; + break; + case SID_TRANSLITERATE_FULLWIDTH: + nType = com::sun::star::i18n::TransliterationModules_HALFWIDTH_FULLWIDTH; + break; + case SID_TRANSLITERATE_HIRAGANA: + nType = com::sun::star::i18n::TransliterationModules_KATAKANA_HIRAGANA; + break; + case SID_TRANSLITERATE_KATAGANA: + nType = com::sun::star::i18n::TransliterationModules_HIRAGANA_KATAKANA; + break; + } + return nType; +} + +// static BOOL ScViewUtil::IsActionShown( const ScChangeAction& rAction, const ScChangeViewSettings& rSettings, ScDocument& rDocument ) |