diff options
author | Niklas Nebel <nn@openoffice.org> | 2002-05-16 12:09:13 +0000 |
---|---|---|
committer | Niklas Nebel <nn@openoffice.org> | 2002-05-16 12:09:13 +0000 |
commit | e893b874f702150de8e826d86fc6691fc9f88e18 (patch) | |
tree | 99fb055e2424d43151ccdb66e550642f9498b0ff /sc/source/ui | |
parent | 7b79e8a6d91f7f4b0a8571c8773524def79b8277 (diff) |
#97665# allow renaming of graphics and groups
Diffstat (limited to 'sc/source/ui')
-rw-r--r-- | sc/source/ui/drawfunc/drawsh2.cxx | 18 | ||||
-rw-r--r-- | sc/source/ui/drawfunc/drawsh5.cxx | 69 | ||||
-rw-r--r-- | sc/source/ui/drawfunc/objdraw.src | 32 | ||||
-rw-r--r-- | sc/source/ui/inc/drawsh.hxx | 11 |
4 files changed, 103 insertions, 27 deletions
diff --git a/sc/source/ui/drawfunc/drawsh2.cxx b/sc/source/ui/drawfunc/drawsh2.cxx index fa5d3548a902..cc08cead3411 100644 --- a/sc/source/ui/drawfunc/drawsh2.cxx +++ b/sc/source/ui/drawfunc/drawsh2.cxx @@ -2,9 +2,9 @@ * * $RCSfile: drawsh2.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: nn $ $Date: 2001-12-05 22:06:48 $ + * last change: $Author: nn $ $Date: 2002-05-16 13:09:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -186,15 +186,15 @@ void ScDrawShell::GetDrawFuncState( SfxItemSet& rSet ) // Funktionen disabl } } - if ( nMarkCount != 1 || - rMarkList.GetMark( 0 )->GetObj()->GetObjIdentifier() != OBJ_OLE2 ) + BOOL bCanRename = FALSE; + if ( nMarkCount == 1 ) { - // Only a single object can be renamed. - // Currently only OLE objects (charts and others) are supported, - // Graphics and groups may be added later. - - rSet.DisableItem( SID_RENAME_OBJECT ); + UINT16 nObjType = rMarkList.GetMark( 0 )->GetObj()->GetObjIdentifier(); + if ( nObjType == OBJ_OLE2 || nObjType == OBJ_GRAF || nObjType == OBJ_GRUP ) + bCanRename = TRUE; } + if ( !bCanRename ) + rSet.DisableItem( SID_RENAME_OBJECT ); if ( !nMarkCount ) // nichts selektiert { diff --git a/sc/source/ui/drawfunc/drawsh5.cxx b/sc/source/ui/drawfunc/drawsh5.cxx index 0e619a98f39a..89c4e03de1b6 100644 --- a/sc/source/ui/drawfunc/drawsh5.cxx +++ b/sc/source/ui/drawfunc/drawsh5.cxx @@ -2,9 +2,9 @@ * * $RCSfile: drawsh5.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: nn $ $Date: 2001-12-05 22:06:48 $ + * last change: $Author: nn $ $Date: 2002-05-16 13:09:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -72,6 +72,7 @@ #include <sfx2/request.hxx> #include <sfx2/bindings.hxx> #include <tools/urlobj.hxx> +#include <svx/dlgname.hxx> #include <svx/fmglob.hxx> #include <svx/hlnkitem.hxx> #include <svx/fontwork.hxx> @@ -94,6 +95,7 @@ #include "strindlg.hxx" #include "scresid.hxx" #include "undotab.hxx" +#include "drwlayer.hxx" #include "sc.hrc" @@ -505,31 +507,50 @@ void ScDrawShell::ExecDrawFunc( SfxRequest& rReq ) if ( rMarkList.GetMarkCount() == 1 ) { SdrObject* pObj = rMarkList.GetMark( 0 )->GetObj(); - if ( pObj->GetObjIdentifier() == OBJ_OLE2 ) + UINT16 nObjType = pObj->GetObjIdentifier(); + if ( nObjType == OBJ_OLE2 || nObjType == OBJ_GRAF || nObjType == OBJ_GRUP ) { // PersistName is used to identify object in Undo - String aPersistName = static_cast<SdrOle2Obj*>(pObj)->GetPersistName(); - - // Currently only OLE objects (charts and others) are supported, - // Graphics and groups may be added later (Undo must be changed then) + String aPersistName; + if ( nObjType == OBJ_OLE2 ) + aPersistName = static_cast<SdrOle2Obj*>(pObj)->GetPersistName(); String aOldName = pObj->GetName(); - ScStringInputDlg* pDlg = new ScStringInputDlg( pViewData->GetDialogParent(), - String(ScResId(SCSTR_RENAMEOBJECT)), - String(ScResId(SCSTR_NAME)), - aOldName, nSlotId ); + String aTitle(ScResId(SCSTR_RENAMEOBJECT)); + String aDesc(ScResId(SCSTR_NAME)); + + SvxNameDialog* pDlg = new SvxNameDialog( NULL, aOldName, aDesc ); + pDlg->SetText( aTitle ); + pDlg->SetCheckNameHdl( LINK( this, ScDrawShell, NameObjectHdl ) ); + USHORT nRet = pDlg->Execute(); if ( nRet == RET_OK ) { String aNewName; - pDlg->GetInputString( aNewName ); + pDlg->GetName( aNewName ); if ( aNewName != aOldName ) { + if ( nObjType == OBJ_GRAF && aNewName.Len() == 0 ) + { + // graphics objects must have names + // (all graphics are supposed to be in the navigator) + ScDrawLayer* pModel = pViewData->GetDocument()->GetDrawLayer(); + if ( pModel ) + aNewName = pModel->GetNewGraphicName(); + } + pObj->SetName( aNewName ); // set new name ScDocShell* pDocSh = pViewData->GetDocShell(); - pDocSh->GetUndoManager()->AddUndoAction( - new ScUndoRenameObject( pDocSh, aPersistName, aOldName, aNewName ) ); + + // An undo action for renaming is missing in svdraw (99363). + // For OLE objects (which can be identified using the persist name), + // ScUndoRenameObject can be used until there is a common action for all objects. + if ( aPersistName.Len() ) + { + pDocSh->GetUndoManager()->AddUndoAction( + new ScUndoRenameObject( pDocSh, aPersistName, aOldName, aNewName ) ); + } pDocSh->SetDrawModified(); } @@ -545,6 +566,26 @@ void ScDrawShell::ExecDrawFunc( SfxRequest& rReq ) } } +IMPL_LINK( ScDrawShell, NameObjectHdl, SvxNameDialog*, pDialog ) +{ + String aName; + + if( pDialog ) + pDialog->GetName( aName ); + + ScDrawLayer* pModel = pViewData->GetDocument()->GetDrawLayer(); + if ( aName.Len() && pModel ) + { + USHORT nDummyTab; + if ( pModel->GetNamedObject( aName, 0, nDummyTab ) ) + { + // existing object found -> name invalid + return 0; + } + } + + return 1; // name is valid +} //------------------------------------------------------------------ diff --git a/sc/source/ui/drawfunc/objdraw.src b/sc/source/ui/drawfunc/objdraw.src index 3b0e2edecb0b..da9412ab4d93 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.41 $ + * $Revision: 1.42 $ * - * last change: $Author: kz $ $Date: 2002-02-04 10:37:08 $ + * last change: $Author: nn $ $Date: 2002-05-16 13:09:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -93,6 +93,7 @@ Text[ language_user1 ] = " ";\ Text[ catalan ] = "Per ~defecte";\ Text[ finnish ] = "~Oletusarvo";\ + Text[ thai ] = "~ค่าเริ่มต้น";\ }; // Font (SID_ATTR_CHAR_FONT) und Groesse (SID_ATTR_CHAR_FONTHEIGHT) duerfen nicht im @@ -175,6 +176,7 @@ Text[ turkish ] = "~st simge";\ Text[ language_user1 ] = " ";\ Text[ catalan ] = "~Superndex";\ + Text[ thai ] = "~ตัวยก";\ };\ MenuItem\ {\ @@ -204,6 +206,7 @@ Text[ turkish ] = "~Alt simge";\ Text[ language_user1 ] = " ";\ Text[ catalan ] = "S~ubndex";\ + Text[ thai ] = "ตั~วยก";\ };\ };\ };\ @@ -218,6 +221,7 @@ Text[ turkish ] = "Bi~im";\ Text[ language_user1 ] = " ";\ Text[ catalan ] = "E~stil";\ + Text[ thai ] = "~ลักษณะ";\ };\ MenuItem\ {\ @@ -285,6 +289,7 @@ Text[ turkish ] = "~ki yana yasla";\ Text[ language_user1 ] = " ";\ Text[ catalan ] = "~Justificat";\ + Text[ thai ] = "~ชิดขอบ";\ };\ };\ };\ @@ -299,6 +304,7 @@ Text[ turkish ] = "~Hizalama";\ Text[ language_user1 ] = " ";\ Text[ catalan ] = "~Alineaci";\ + Text[ thai ] = "~จัดตำแหน่ง";\ };\ MenuItem\ {\ @@ -350,6 +356,7 @@ Text[ turkish ] = "~Satr aral";\ Text[ language_user1 ] = " ";\ Text[ catalan ] = "Inter~lineat";\ + Text[ thai ] = "ช่องว่าง~บรรทัด";\ }; #define MN_DRWTXT \ @@ -391,6 +398,7 @@ Text[ language_user1 ] = " ";\ Text[ catalan ] = "Te~xt...";\ Text[ finnish ] = "Teks~ti";\ + Text[ thai ] = "ข้อ~ความ...";\ }; #define MN_ORIGINALSIZE \ @@ -423,6 +431,7 @@ Text[ turkish ] = "Gerek ~boyut";\ Text[ language_user1 ] = " ";\ Text[ catalan ] = "Mida ~original";\ + Text[ thai ] = "ขนาดเ~ดิม";\ }; #define MN_RENAME_OBJECT \ @@ -452,6 +461,7 @@ Text[ turkish ] = "~Name Object...";\ Text[ arabic ] = "~Name Object...";\ Text[ catalan ] = "~Name Object...";\ + Text[ thai ] = "~Name Object...";\ }; #define MN_MIRRORSUB \ @@ -504,6 +514,7 @@ Text[ turkish ] = "~Dikey";\ Text[ language_user1 ] = " ";\ Text[ catalan ] = "~Verticalment";\ + Text[ thai ] = "แ~นวตั้ง";\ };\ MenuItem\ {\ @@ -533,6 +544,7 @@ Text[ turkish ] = "~Yatay";\ Text[ language_user1 ] = " ";\ Text[ catalan ] = "~Horitzontal";\ + Text[ thai ] = "แน~วนอน";\ };\ };\ };\ @@ -547,6 +559,7 @@ Text[ turkish ] = "~Yanst";\ Text[ language_user1 ] = " ";\ Text[ catalan ] = "In~verteix";\ + Text[ thai ] = "~พลิก";\ }; #define MN_ARRANGESUB \ @@ -604,6 +617,7 @@ Text[ turkish ] = "B~ir ne getir";\ Text[ language_user1 ] = " ";\ Text[ catalan ] = "Porta al ~davant";\ + Text[ thai ] = "ส่ง~ต่อ";\ };\ MenuItem\ {\ @@ -634,6 +648,7 @@ Text[ turkish ] = "Bir ~geri gnder";\ Text[ language_user1 ] = " ";\ Text[ catalan ] = "En~via cap enrere";\ + Text[ thai ] = "ส่ง~กลับ";\ };\ MenuItem\ {\ @@ -661,6 +676,7 @@ Text[ turkish ] = "~Sralama";\ Text[ language_user1 ] = " ";\ Text[ catalan ] = "~Organitza";\ + Text[ thai ] = "~จัดเรียง";\ }; #define MN_ANCHORSUB \ @@ -706,6 +722,7 @@ Text[ language_user1 ] = " ";\ Text[ catalan ] = "A la p~gina";\ Text[ finnish ] = "Sivul~le";\ + Text[ thai ] = "ไปยังห~น้า";\ };\ MenuItem\ {\ @@ -734,6 +751,7 @@ Text[ language_user1 ] = " ";\ Text[ catalan ] = "A la ~cella";\ Text[ finnish ] = "So~luun";\ + Text[ thai ] = "ไปยังเ~ซลล์";\ };\ };\ };\ @@ -753,6 +771,7 @@ Text[ language_user1 ] = " ";\ Text[ catalan ] = "An~cora";\ Text[ finnish ] = "Ank~kuri";\ + Text[ thai ] = "ส~มอ";\ }; #define MN_ALIGNSUB \ @@ -818,6 +837,7 @@ Text[ turkish ] = "Hiz~alama";\ Text[ language_user1 ] = " ";\ Text[ catalan ] = "A~lineaci";\ + Text[ thai ] = "จั~ดเรียง";\ }; // @@ -852,6 +872,7 @@ String RID_DRAW_OBJECTBAR Text[ turkish ] = "izim nesne ubuu"; Text[ language_user1 ] = " "; Text[ catalan ] = "Barra d'objectes de dibuix"; + Text[ thai ] = "แถบวัตถุวาดรูป"; }; ToolBox RID_DRAW_OBJECTBAR { @@ -1026,6 +1047,7 @@ String RID_TEXT_TOOLBOX Text[ turkish ] = "Metin nesne ubuu"; Text[ language_user1 ] = " "; Text[ catalan ] = "Barra d'objectes de text"; + Text[ thai ] = "แถบวัตถุข้อความ"; }; ToolBox RID_TEXT_TOOLBOX { @@ -1215,6 +1237,7 @@ String RID_GRAPHIC_OBJECTBAR Text[ arabic ] = " "; Text[ catalan ] = "Barra d'objectes grfics"; Text[ finnish ] = "Grafiikkaobjektipalkki"; + Text[ thai ] = "แถบวัตถุกราฟิค"; }; ToolBox RID_GRAPHIC_OBJECTBAR { @@ -1476,6 +1499,7 @@ String RID_POPUP_DRAW Text[ turkish ] = "izim nesneleri iin alan mn"; Text[ language_user1 ] = " "; Text[ catalan ] = "Men emergent per a objectes de dibuix"; + Text[ thai ] = "เมนูแบบผุดขึ้นสำหรับวัตถุวาดรูป"; }; // // Popup-Menue fuer (allgemeine) Zeichenobjekte @@ -1495,6 +1519,7 @@ Menu RID_POPUP_DRAW MN_ARRANGESUB MN_ALIGNSUB MN_ANCHORSUB + MN_RENAME_OBJECT //------------------------------ MenuItem { Separator = TRUE ; }; //------------------------------ @@ -1557,6 +1582,7 @@ Menu RID_POPUP_GRAPHIC MN_ARRANGESUB MN_ALIGNSUB MN_ANCHORSUB + MN_RENAME_OBJECT //------------------------------ MenuItem { Separator = TRUE ; }; //------------------------------ @@ -1633,6 +1659,7 @@ Menu RID_POPUP_CHART Text[ language_user1 ] = " "; Text[ catalan ] = "~Modifica l'rea de dades..."; Text[ finnish ] = "~Muokkaa tietoaluetta..."; + Text[ thai ] = "~ดัดแปลงช่วงข้อมูล..."; }; //------------------------------ MenuItem { Separator = TRUE ; }; @@ -1671,6 +1698,7 @@ String RID_POPUP_DRAWTEXT Text[ language_user1 ] = " "; Text[ catalan ] = "Men emergent per a objectes de text"; Text[ finnish ] = "Tekstiobjektien ponnahdusvalikko"; + Text[ thai ] = "เมนูแบบผุดขึ้นสำหรับวัตถุข้อความ"; }; Menu RID_POPUP_DRAWTEXT diff --git a/sc/source/ui/inc/drawsh.hxx b/sc/source/ui/inc/drawsh.hxx index d85d035fdf99..5d4781472fa9 100644 --- a/sc/source/ui/inc/drawsh.hxx +++ b/sc/source/ui/inc/drawsh.hxx @@ -2,9 +2,9 @@ * * $RCSfile: drawsh.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: nn $ $Date: 2000-10-20 18:22:31 $ + * last change: $Author: nn $ $Date: 2002-05-16 13:06:28 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -74,6 +74,11 @@ #include <svx/svdmark.hxx> #endif +#ifndef _LINK_HXX +#include <tools/link.hxx> +#endif + +class SvxNameDialog; class ScViewData; @@ -81,6 +86,8 @@ class ScDrawShell : public SfxShell { ScViewData* pViewData; + DECL_LINK( NameObjectHdl, SvxNameDialog* ); + protected: ScViewData* GetViewData() { return pViewData; } |