Created attachment 88050 [details] File with macro showing the bug Method isInUse() for page styles return FALSE always, even is the page style is used in the document. The atached document has a simple macro to check the issue. The macro is listed below for convenience. REM ***** BASIC ***** Sub Main oDocument = ThisComponent oTablePageStyles=oDocument.StyleFamilies.getbyName("PageStyles") ' set on all page styles For iL = 0 to oTablePageStyles.Count - 1 oEstilo = oTablePageStyles(iL) msgBox iL & " " & oEstilo.Name & " " & oEstilo.isInUse() Next End Sub
Created attachment 88455 [details] File with macro showing the bug Teste with LO 4.2.0, build b3aadaa58c7a5c28132da3d085ce39378fe69ce8 The macro detect style "Right page" but does not detect styles "pagestyle1" and "pagestyle2"
Suspicion: Bit InUse is not set in custom page styles either at creation time or when the custom style is applied to the page of the document. Styles and formatting window (F11) does not list applied custom styles in the example document
Changing component. Actually this is a Wrtter bug.
I confirm this Olivier Looks as if this is broken since 3.6 4.2.0 differs from 4.0.6 and 4.1.3 but still not OK. Anyway, with the test file that I used. Will attach that. Looks asif there is some random disorder.
Created attachment 90359 [details] test file as suggested: test the same with different pages and different page orders, will give different results, I guess
Just a small batktrace after put an breakpoint into SwXStyle::isInUse: #3 0xa91599a6 in SwDoc::IsUsed (this=0x87c6ae8, rModify=SwModify) at /home/marcos/gitroot/core/sw/source/core/doc/poolfmt.cxx:2328 #4 0xa98d1721 in SwDocStyleSheet::IsUsed (this=0xa88c07c4) at /home/marcos/gitroot/core/sw/source/ui/app/docstyle.cxx:1975 #5 0xa96e70d5 in SwXStyle::isInUse (this=0xa71a60c8) at /home/marcos/gitroot/core/sw/source/core/unocore/unostyle.cxx:1417 Maybe we need to take a look if there is something missing or if something needs to setup after style use or creation.
I could not reproduce with the current master. Steps to reproduce: 1 - Open the test document attached by Olivier 2 - insert some text in the first page 3 - Create a new page and insert some text too 4 - Change the page style to landscape 5 - Run the macro. Here it shows correctly. My master's HEAD is 0c0258ae9f7adfe17fc2e357b86006dbb4497ff4.
this looks suspicious: bool SwPageDesc::GetInfo( SfxPoolItem & rInfo ) const { if( !aMaster.GetInfo( rInfo ) ) return false; // found return aLeft.GetInfo( rInfo ); } if there is only one page in the document then only the SwPageDesc::m_FirstMaster (which was added in LO 4.0) is actually in use, the aMaster [right-page other than first] and aLeft [left-page other than first] are not. probably this needs to check m_FirstMaster and m_FirstLeft too. Marcos, do you have some time to try this out?
regression in 4.0.0 release, worked in 3.6.7.2
Verified in master. Patch OK.
Marcos Paulo de Souza committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=6131787afbb32e1e12aac4cf4f65625d11d39f08 Fix fdo#70807: Page Style method isInUse() broken 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.
Marcos Paulo de Souza committed a patch related to this issue. It has been pushed to "libreoffice-4-2": http://cgit.freedesktop.org/libreoffice/core/commit/?id=c47f102d8df5e413dbf70e9968ed913f2855787d&h=libreoffice-4-2 Fix fdo#70807: Page Style method isInUse() broken It will be available in LibreOffice 4.2. 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.
Marcos Paulo de Souza committed a patch related to this issue. It has been pushed to "libreoffice-4-1": http://cgit.freedesktop.org/libreoffice/core/commit/?id=63c2990d0e67e90f5445dac10c8c1f7919031482&h=libreoffice-4-1 Fix fdo#70807: Page Style method isInUse() broken It will be available in LibreOffice 4.1.5. 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.
great, Marcos fixed it
Marcos Paulo de Souza committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=16ae82c772cd818316a19ce303d349657f6cb863 fdo#70807: UT to verify used styles in document 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.
Marcos Paulo de Souza committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=b1236dd7e86f40e54b7efb6082fad0967edb92d2 fdo#70807: Improve unit test using custom styles 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.