Apache OpenOffice (AOO) Bugzilla – Issue 23518
Patch to add Language item to Object Toolbar
Last modified: 2013-08-07 14:38:26 UTC
Adds a Language dropdown to the Object toolbar in Writer. Improvements to be made: 1) Need to find out where to give the name for this. Its currently blank when you try to Customize the toolbar 2) Add it to Draw and Calc Object toolbars 3) Cache the value of the language and check "if (oldLang != newLang ) then set lang" for performance reasons
Created attachment 11915 [details] cd to svx, patch -p0 < /path/to/patchfile
Created attachment 11916 [details] cd sw, patch -p0 < /path/to/patchfile
starting
Another issue: How do you get the thing to be the right size when it first appears? Another one: How to handle non-western languages? Are they already handled by this menu and if not, how should that happen? Comments please...
Created attachment 11917 [details] screenshot of Language item on toolbar
Hi Dan, Great Job! I will study what you have done in your patches here over the weekend and try to see if I can help. Thanks! Kevin
Hi Dan, I added this to my cws_src680_ooo20031216 build. I ran into a problem when trying to compile + +void SvxLanguageToolBoxControl::StateChanged( + USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ) +{ + USHORT nId = GetId(); + ToolBox& rTbx = GetToolBox(); + SvxLanguageBox_Impl* pBox = (SvxLanguageBox_Impl*)(rTbx.GetItemWindow( nId )); + + DBG_ASSERT( pBox, "Control not found!" ); + + if ( SFX_ITEM_DISABLED == eState ) + { + pBox->Disable(); + pBox->Update( (const SvxLanguageItem*)NULL ); + } It seems pBox->Update( (const SvxLanguageItem*)NULL ) does not exactly match the signature for that method. + +void SvxLanguageBox_Impl::Update( const SvxLanguageItem& rLanguageItem ) +{ + SvxLanguageBox::SetLanguageList( LANG_LIST_ALL, TRUE, FALSE, TRUE ); + So without -fpermissive, gcc 3.2.2 barfs. So I simply commented it out for my test build. Once I manually resized the LangauageBox pulldown, everything seemed to work. I will try to find and fix the sizing issue and try and see if I can figure out where to put this in calc and impress. Great Job! Kevin
Reassigned to AMA
Hi Dan, I change some of the fields for Language in svx/ in svx.sdi (I have no idea what an sdi file is anyway!) and now after rebuilding, I get "Langauge" in the Tools->Configure Text Obejct Bar and can manipulate it. The only problems remaining seem to be - how to get the size to be set properly - how to update it only when state changes - adding it to calc and impress - tranlations for "Language" to be grabbed from the Spell Dialog code that already has made these translations so we can simply cut and paste. It can now be seen and manipulated in the toolbar configuration code Here is the diff (just for the record). --- sdi/svx.sdi.~1.41.~ 2003-10-20 10:15:23.000000000 -0400 +++ sdi/svx.sdi 2003-12-14 20:27:33.000000000 -0500 @@ -6092,8 +6092,8 @@ /* config: */ AccelConfig = FALSE, MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, + StatusBarConfig = TRUE, + ToolBoxConfig = TRUE, GroupId = GID_FORMAT; ] I am going to work on the default size thing a bit to see if I can figure that out as well. The problem is that I simply don't know where to look so this is a bit of a trial and error treasure hunt! Thanks, Kevin
Kevin, I looked at those yesterday and added ToolbarConfig=TRUE, but missed the StatusBarConfig. I'll respin the patches. What really irks me is the default size thing. It should also be fairly easy to add to the toolbars of Calc and Draw, I can look into that if you'd like since I think I know where the thing is (well, just look at the sw/ patch and you'll have an idea what's required). Dan
Oliver, please have a look at this patch!
Created attachment 11964 [details] Tranlations for the word "Language"
Hi, I have attached a patch to add in translations for "Languages" borrowed from svx/source/dialog/spldlg.src which I think belongs in svx/globlmn.hrc I still can't figure out the missing initial size problem. I did noticve that when the spldlg.src uses the Language Pulldown it sets this in the spldlg.src ListBox LB_LANGUAGE { Pos = MAP_APPFONT( 51, 111 ); Size = MAP_APPFONT( 87, 55 ); Border = TRUE; Sort = TRUE; DropDown = TRUE; }; Perhaps there is s a similar src file for the ToolBox someplace we need to add some size info too? I am not sure. We are getting closer! Kevin
Kevin, After adding your patch and rebuilding svx and sw, I still don't get the item's name to appear in the Customize list...
Kevin, WRT the sizing issue, it seems that the SvxLanguageBox that we create (Since SvxLangaugeBox_Impl inherits from SvxLanguageBox) is created iwth a size of (4,4). That's obviously not correct. I discovered that we need to size the ListBox in the constructor of SvxLanguageBox_Impl() and then it will turn out fine. New svx patch attached. Are you sure the encoding is right on the translations patch you attached? It doesn't look quite right to me on Fedora Core 1... Looks like ASCII aproximation, where all other language strings from files I open locally are OK. Dan
Created attachment 11966 [details] replaces previous svx patch PLUS translations.patch
Created attachment 11967 [details] new tranlations patch (hopefully not messed up)
Hi Dan, Yes, the copy /paste converted the emacs encodings to text so that the whole thing was messed up. I have tried one more time. This time I literally included a piece of spldlg.src right into the file to prevent any copy / past issues converting non-ascii characters. Hopefully this does the trick. Also, I have found and made changes for sc, and sd which should enable the language toolbar there as well. I will add in your size patch, Nice Job! Kevin
Created attachment 11968 [details] my *guess* at adding to sc
Created attachment 11969 [details] my *guess* at draw/impress
Hi Dan, Okay I am rebuilding svx with your latest patch plus my hopefully fixed translations, plus your sw patch, plus my ****guesses**** for sc and sd/impress. So I have attached my guesses .... just in case they help. I won't know if they work or not until a couple of hours from now. If everything seems to work, I will post a new cumulative svx patch with your code and your changes and my updated translations all for cws_src680_ooo20031216 so that should apply cleanly of SRC680_m17 as well I think. Thanks! Kevin
Ok, will await your cumulative patches and test tomorrow.
FYI, a complete rebuild (without dmake clean) and re-install did the trick for getting the "Language" text to show up in the toolbar customization. That file's got to be there somewhere :)
Hi Dan, Well my guesses were not too good :-( I ended up with the word "Language" in the toolbar in the right place, but no Language pulldown was actually there. So I am only part way to getting this to work for sc, sd, and impress. So back to the drawing board .... On the good news front your changes to svx and sw worked wonders and it seems to be properly sizing itself just fine. I have attached will attach svx_langbox_20031216.patch and sw_langbox_20031216.patch to this issue for the record. I will then go and figure out what I messed up in sd, sc, ... Thanks, Kevin
Created attachment 11974 [details] cumulative svx patch with Dan's work and my translations
Created attachment 11975 [details] Dan's code to add toolbar in sw
Created attachment 11976 [details] Patch to sc to add Lang to toolbar. cd to sc, patch -p0 < /path/to/patchfile
Kevin, with my modification of your patch to SC I was able to get the dropdown just fine, but no language is listed in it by default. That's not a problem for the moment I think...
Hi Dan, In 680 there is no sc/idl/ directory at all so things seem to have changed since 645. There is a drtxtob.cxx file that seems to build the Text Object bar on the fly. I took a shot at modifying it as well. I similar thing is used in sd/ where the Text Object Bar is not visable at first and it intialized on the fly when built. I was kinbd of hoping that someone from Hamburg would give us some hints or at least take a look at these patches and comment in some way. A few hints would certainly help. Thanks, Kevin ps. I am rebuilding with a modified version of your sc patch now on the 680 tree and if it works I will post a patch for 680. Thanks!
Created attachment 11980 [details] 645 patch to sd to add Lang item in toolbar. cd to sd, patch -p0 < /path/to/patchfile
Kevin, attached a 645 patch for sd that works.
Hi, A quick scan of Issuezilla Enhancements shows this patch would help resolve issues: 1034, 10406, 16959, and 23351 Would someone form hamburg please evaluate these patches and approve them for committing to the next cws_src680_ooo* tree that comes along. Thanks! Kevin
Created attachment 11984 [details] Version of Dan's sc patch for 680 builds
Created attachment 11985 [details] Version of Dan's sd patch for 680
Hi, For 680 trees the patches to review for approval would be: svx_langbox_20031216.patch sw_langbox_20031216.patch sc_680_langbox_20031216.patch sd_680_langbox_20031216.patch For 645 trees the patches to review for approal would be: svx_langbox_20031216.patch sw_langbox_20031216.patch sc_langbox_20031216.patch sd_langbox_20031216.patch Will someone from Hamburg please give these a look over and let us know if these can be incorporated into the OOo trees. Thank you. Kevin
Hi Dan, Well my patches for sd and sc do now show the pulldown, I have done a lot more testing and they do not seem to work. In sc the language attribute never seems to get set in the cell (check this by going to format cell and seeing what the language pulldown says in that dialog). So somehow, we need to interface this to cell atrributes in some sane way. As for sd, I can create text in Impress and format it as English and some as German but when I try to actually spellcheck it, I get a segfault. So I think, even though we have the langauge pulldown there, it does not seem to be fully functional in either sd or sc. Testing does show it works well for sw. I will play with it some mroe to see if I can find out what else has to be changed. Kevin
After reading Kevin's comments in dev@native-lang, I must say I like this and I already vote. Please include this in 2.0. The question is about its default state: show or not show it by default?
+1 from Slovenian team. We could find this very useful.
Hi Kevin, Dan, sorry for my late response. I took a look at the code but didn't compile it. In SC the method ScFormatShell::GetTextAttrState() that has to handle the language attribute needs some appropriate code to do this. The same applies to SdDrawTextObjectBar::GetAttrState() in SD. The Writer returns all known attributes without special case by default in SwBaseShell::GetTxtFontCtrlState(). For the text in drawings in SW this is done in SwDrawTextShell::GetDrawTxtCtrlState() It should also be considered that it is necessary to take the script type into consideration. This is already done in the methods above for SID_ATTR_CHAR_FONT, SID_ATTR_CHAR_FONTHEIGHT, SID_ATTR_CHAR_WEIGHT, SID_ATTR_CHAR_POSTURE. This applies to the execute methods. In SW this is SwBaseShell::ExecTxtCtrl()/SwDrawTextShell::Execute()
Created attachment 12000 [details] updated patch to sc for 680 that ties to deal with Get/Execute Attr
KBH->OS, Thanks for the hints! Okay this time I have tried to focus on just sc I was not sure if I need to change both: GetAttrState() / ExectuteAttr() and GetTextAttrState() / ExecuteTextAttr() in sc/ource/ui/view/formatsh.cxx So I changed both! I also had to add a couple of rbinding Invalidate changes to make sure that the Language field got updated when the cell pointer changed to a new shell. I realize you are busy, but when you get a moment, please look at sc_680_langbox_20031217.patch and let me know if I am on the right track here. Hints and Corrections welcome! Thanks, Kevin
os->nn: Could you please take a look at the sc_680_langbox_20031217.patch
In formatsh.cxx, you need to add to those methods that are specified in formatsh.sdi. ExecuteTextAttr/GetTextAttrState contains the slots that can toggle, so ExecuteAttr/GetAttrState is probably the better place. The change in ExecuteTextAttr is also wrong, it reads from the wrong ItemSet. Your code in ExecuteAttr in the "if ( !pNewAttrs )" branch doesn't to anything useful, you could as well open the dialog then, as it's done for SID_ATTR_CHAR_FONT/SID_ATTR_CHAR_FONTHEIGHT. The change to editsh.cxx looks right. Something similar is also needed in drtxtob.cxx, for editing text in drawing objects.
set to OfficeLater
Do I understand correctly that this is not yet applied to MAIN (or what you call it). Atleast I can't seem to find any ChangeLanguage icon in the Debian/unstable package of OOo 1.1.3. I guess I'll vote for it...
In its current state, the patch is incomplete (as noted before) and can't be integrated. I don't know if anyone is actively working on it (I don't think so).
The presence of these patches was already mentioned in issue 1034, so the code isn't lost, but as a PATCH issue that can't be integrated and hasn't been touched in years, this is quite useless, so I'm closing it now.
closing