Issue 23518

Summary: Patch to add Language item to Object Toolbar
Product: Writer Reporter: fa <dan>
Component: codeAssignee: niklas.nebel
Status: CLOSED WONT_FIX QA Contact: issues@sw <issues>
Severity: Trivial    
Priority: P3 CC: issues, khendricks, okdsnfweu, pavel, stp
Version: OOo 1.1 RC5   
Target Milestone: ---   
Hardware: All   
OS: All   
Issue Type: PATCH Latest Confirmation in: ---
Developer Difficulty: ---
Issue Depends on:    
Issue Blocks: 1034, 10406, 16959, 23351    
Attachments:
Description Flags
cd to svx, patch -p0 < /path/to/patchfile
none
cd sw, patch -p0 < /path/to/patchfile
none
screenshot of Language item on toolbar
none
Tranlations for the word "Language"
none
replaces previous svx patch PLUS translations.patch
none
new tranlations patch (hopefully not messed up)
none
my *guess* at adding to sc
none
my *guess* at draw/impress
none
cumulative svx patch with Dan's work and my translations
none
Dan's code to add toolbar in sw
none
Patch to sc to add Lang to toolbar. cd to sc, patch -p0 < /path/to/patchfile
none
645 patch to sd to add Lang item in toolbar. cd to sd, patch -p0 < /path/to/patchfile
none
Version of Dan's sc patch for 680 builds
none
Version of Dan's sd patch for 680
none
updated patch to sc for 680 that ties to deal with Get/Execute Attr none

Description fa 2003-12-12 22:47:10 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
Comment 1 fa 2003-12-12 22:48:16 UTC
Created attachment 11915 [details]
cd to svx, patch -p0 < /path/to/patchfile
Comment 2 fa 2003-12-12 22:49:03 UTC
Created attachment 11916 [details]
cd sw, patch -p0 < /path/to/patchfile
Comment 3 fa 2003-12-12 22:49:32 UTC
starting
Comment 4 fa 2003-12-12 22:52:08 UTC
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...
Comment 5 fa 2003-12-12 22:56:40 UTC
Created attachment 11917 [details]
screenshot of Language item on toolbar
Comment 6 khendricks 2003-12-13 00:21:11 UTC
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 
 
Comment 7 khendricks 2003-12-14 18:38:05 UTC
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 
 
Comment 8 h.ilter 2003-12-15 11:41:24 UTC
Reassigned to AMA
Comment 9 khendricks 2003-12-15 14:33:08 UTC
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
Comment 10 fa 2003-12-15 16:06:51 UTC
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
Comment 11 andreas.martens 2003-12-15 16:44:36 UTC
Oliver, please have a look at this patch!
Comment 12 khendricks 2003-12-15 18:32:21 UTC
Created attachment 11964 [details]
Tranlations for the word "Language"
Comment 13 khendricks 2003-12-15 18:35:44 UTC
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 
 
Comment 14 khendricks 2003-12-15 18:55:58 UTC
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 
 
Comment 15 fa 2003-12-15 19:07:18 UTC
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...
Comment 16 fa 2003-12-15 20:11:21 UTC
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
Comment 17 fa 2003-12-15 20:12:18 UTC
Created attachment 11966 [details]
replaces previous svx patch PLUS translations.patch
Comment 18 khendricks 2003-12-15 20:46:38 UTC
Created attachment 11967 [details]
new tranlations patch (hopefully not messed up)
Comment 19 khendricks 2003-12-15 20:48:51 UTC
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 
 
Comment 20 khendricks 2003-12-15 21:43:14 UTC
Created attachment 11968 [details]
my *guess* at adding to sc
Comment 21 khendricks 2003-12-15 21:44:06 UTC
Created attachment 11969 [details]
my *guess* at draw/impress
Comment 22 khendricks 2003-12-15 21:46:52 UTC
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 
 
Comment 23 fa 2003-12-15 22:04:01 UTC
Ok, will await your cumulative patches and test tomorrow.
Comment 24 fa 2003-12-15 22:32:09 UTC
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 :)
Comment 25 khendricks 2003-12-16 13:14:58 UTC
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 
  
 
Comment 26 khendricks 2003-12-16 13:17:23 UTC
Created attachment 11974 [details]
cumulative svx patch with Dan's work and my translations
Comment 27 khendricks 2003-12-16 13:18:46 UTC
Created attachment 11975 [details]
Dan's code to add toolbar in sw
Comment 28 fa 2003-12-16 14:59:35 UTC
Created attachment 11976 [details]
Patch to sc to add Lang to toolbar.  cd to sc, patch -p0 < /path/to/patchfile
Comment 29 fa 2003-12-16 15:00:49 UTC
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...
Comment 30 khendricks 2003-12-16 15:20:05 UTC
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! 
 
 
Comment 31 fa 2003-12-16 15:57:28 UTC
Created attachment 11980 [details]
645 patch to sd to add Lang item in toolbar.  cd to sd, patch -p0 < /path/to/patchfile
Comment 32 fa 2003-12-16 15:57:53 UTC
Kevin,  attached a 645 patch for sd that works.
Comment 33 khendricks 2003-12-16 19:58:00 UTC
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 
 
Comment 34 khendricks 2003-12-16 20:08:55 UTC
Created attachment 11984 [details]
Version of Dan's sc patch for 680 builds
Comment 35 khendricks 2003-12-16 20:09:52 UTC
Created attachment 11985 [details]
Version of Dan's sd patch for 680
Comment 36 khendricks 2003-12-16 20:13:39 UTC
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 
 
Comment 37 khendricks 2003-12-17 02:29:59 UTC
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 
 
Comment 38 pavel 2003-12-17 06:42:45 UTC
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?
Comment 39 r 2003-12-17 07:23:27 UTC
+1 from Slovenian team. We could find this very useful.
Comment 40 Oliver Specht 2003-12-17 09:45:13 UTC
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() 
Comment 41 khendricks 2003-12-17 17:47:56 UTC
Created attachment 12000 [details]
updated patch to sc for 680 that ties to deal with Get/Execute Attr
Comment 42 khendricks 2003-12-17 17:54:02 UTC
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 
 
Comment 43 Oliver Specht 2004-05-14 15:04:47 UTC
os->nn: Could you please take a look at the sc_680_langbox_20031217.patch
Comment 44 niklas.nebel 2004-07-23 19:02:34 UTC
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.
Comment 45 ooo 2004-12-01 09:43:53 UTC
set to OfficeLater
Comment 46 quite 2005-03-13 12:51:12 UTC
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...
Comment 47 niklas.nebel 2006-03-08 17:36:17 UTC
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).
Comment 48 niklas.nebel 2006-09-01 17:27:32 UTC
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.
Comment 49 niklas.nebel 2006-09-01 17:28:34 UTC
closing