summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
authorNiklas Nebel <nn@openoffice.org>2001-03-26 18:26:30 +0000
committerNiklas Nebel <nn@openoffice.org>2001-03-26 18:26:30 +0000
commit8307bfb0388b946a86876096cef78d012479e981 (patch)
treeca1872bc41533fec5b63aee6c02fe575da279671 /sc/source/ui
parentac67f489432eebcb1b37d354f4599bbe72588ae5 (diff)
transliteration menu functions
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/docshell/docfunc.cxx40
-rw-r--r--sc/source/ui/drawfunc/drtxtob.cxx27
-rw-r--r--sc/source/ui/drawfunc/objdraw.src6
-rw-r--r--sc/source/ui/inc/cellsh.hxx5
-rw-r--r--sc/source/ui/inc/docfunc.hxx7
-rw-r--r--sc/source/ui/inc/drtxtob.hxx5
-rw-r--r--sc/source/ui/inc/editsh.hxx5
-rw-r--r--sc/source/ui/inc/viewfunc.hxx6
-rw-r--r--sc/source/ui/inc/viewutil.hxx6
-rw-r--r--sc/source/ui/view/cellsh1.cxx15
-rw-r--r--sc/source/ui/view/editsh.cxx27
-rw-r--r--sc/source/ui/view/viewfun2.cxx24
-rw-r--r--sc/source/ui/view/viewutil.cxx34
13 files changed, 176 insertions, 31 deletions
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 )