Bug 93438 - Impress generate abnormal style when copy-pasting from Writer with Chinese UI
Summary: Impress generate abnormal style when copy-pasting from Writer with Chinese UI
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Impress (show other bugs)
Version:
(earliest affected)
3.6.0.4 release
Hardware: Other All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:5.1.0 target:5.0.4
Keywords:
: 75181 91091 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-08-15 00:22 UTC by Mark Hung
Modified: 2016-10-25 19:17 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Error message (36.21 KB, image/png)
2015-08-15 00:22 UTC, Mark Hung
Details
Style with empty name was created. (79.18 KB, image/png)
2015-08-21 17:53 UTC, Mark Hung
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Hung 2015-08-15 00:22:09 UTC
Created attachment 117925 [details]
Error message

Copy and paste from Writer to Impress and the Impress file can't be saved.
Comment 1 Jacques Guilleron 2015-08-15 16:08:47 UTC
Hi Mark,

I don't reproduce using 
LO 4.4.4.3 Build ID: 2c39ebcf046445232b798108aa8a7e7d89552ea8 Locale : fr_FR
OS : Windows 7 Home Premium.
Did you try to rename your profile?
https://wiki.documentfoundation.org/UserProfile
Comment 2 Mark Hung 2015-08-18 05:26:34 UTC
Sorry that I picked the wrong version.

Version:4.4.3.2
Build ID:88805f81e9fe61362df02b9941de8e38a9b5fd16
Locale:zh_TW
OS: Windows 7 Professional (on both 64bit and 32bit OS)

Rename profile doesn't work.
Comment 3 Mark Hung 2015-08-21 17:53:25 UTC
Created attachment 118076 [details]
Style with empty name was created.

Pasting Chinese text in Windows ( not sure if this happens under other language settings ) creates a style with empty name. It raise an exception in XMLStyleExport::exportStyleFamily(). Following macro helps ( if newer version isn't available ):

Sub FixODPEmptyStyleName
  Dim oStyleFamilies As Variant
  Dim oStylePool As Variant
  Dim oStyle As Variant
  Dim sName As String
  Dim nCount As Long
  Dim nIndex As Long
  nIndex = 0
  oStyleFamilies = ThisComponent.getStyleFamilies()
  oStylePool = oStyleFamilies.getByName("graphics")  
  nCount = oStylePool.getCount()
  For i = 0 to nCount-1
  	oStyle = oStylePool.getByIndex(i)
	sName = oStyle.getName()
	if sName = "" then
 	 	oStyle.setName("Style"+Int(Rnd()*100000))
	end if
  Next i
End Sub
Comment 4 Mark Hung 2015-08-29 09:36:10 UTC
When user use Chinese UI, style names are converted to Chinese. However when paste special ( with RTF), Chinese stylenames weren't handled properly, breaking into multiple token so that it generate abnormal styles with empty name.
Comment 5 Commit Notification 2015-08-31 01:32:15 UTC
Mark Hung committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=0955bfed86e55f823fb9686f52dbffc36558b5d5

Fix tdf#93438 Impress generate abnormal style when copy-pasting

It will be available in 5.1.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 6 Miklos Vajna 2015-09-23 12:32:50 UTC
*** Bug 91091 has been marked as a duplicate of this bug. ***
Comment 7 Mark Hung 2015-09-27 08:01:56 UTC
*** Bug 75181 has been marked as a duplicate of this bug. ***
Comment 8 Commit Notification 2015-11-02 11:09:40 UTC
Mark Hung committed a patch related to this issue.
It has been pushed to "libreoffice-5-0":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=52f3eb47aa42bd1a2a61088706cd3c729e274fc0&h=libreoffice-5-0

Fix tdf#93438 Impress generate abnormal style when copy-pasting

It will be available in 5.0.4.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.