includes of Win32 headers in LO are wrapped with #include <prewin.h> and #include <postwin.h> this is because old LO code, especially in "tools" and "vcl", defines types that have the same names as Win32 types, so the headers do a bunch of stupid macro hackery to rename the Win32 types so they don't collide with LO types. it would be obviously much simpler if the LO types simply had names that don't collide with Win32 types. "git grep" or ctags or opengrok.libreoffice.org should find the definitions of types in LO that are re-defined in the wrapper headers. there are several ways to clean up collisions: 1) if there is no equivalent in LO of the redefined type, it can just be removed from the wrapper header 2) in some cases it can be avoided to have the Win32 type and the LO type visible in the same LO source file by not including both the defining LO and Win32 headers 3) if the Win32 type is not a macro, then putting the LO type into a namespace and namespace-qualifying the uses should avoid the collisions 4) if the Win32 type is a macro, then adding a namespace-like prefix to the LO type is probably required
One note, that I sadly think needs to be spelled out: Please don't attempt to do this unless you actually have Windows, Visual Studio, etc and are able to build LibreOffice on Windows. Don't submit changes without verifying yourself that they don't break the compilation.
Tor Lillqvist committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=a8669b56b194a7cd6da771dfb9904710da24c0b4 fdo#82580: Win32 GetObject() simplification 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.
(In reply to comment #0) > 2) in some cases it can be avoided to have the Win32 type > and the LO type visible in the same LO source file > by not including both the defining LO and Win32 headers Note, that this could be complicated, because we (mostly) use precompiled headers on Windows, which include nearly all headers needed by a module. See for example oox/inc/pch/precompiled_oox.hxx, which includes all headers from the oox module. And thus avoiding to include one file could be problematic.
Personally I think we should do what Cygwin have done and create our own copy of the win32 header that only contains the definitions we need, thus minimizing the odds of conflict.
That is madness. We can't cross-compile a complete LibreOffice because the reverse-engineered headers provided by mingw-w64 are incomplete. And those headers have a very long history. So you expect us to be able to create something similar, and in a legally valid clean-room fashion, just like that?
Please don't just sign a bug to yourself out of the blue. That is not how it works.
Assign this bug to me. I think it is good start before refactoring god objects at gsoc.
It is enough to say you are working on this. If somebody else (another GSoC hopeful?) is rude enough to jump onto this task just at the same time (for a few weeks), we will notice, and take that as a sign that he/she is not good at cooperation.
any chance you need help on this?
Still not need help. Eclipse searchs well.
Darn ok. I will find another easy hack to be my first
Migrating Whiteboard tags to Keywords: (EasyHack DifficultyBeginner SkillCpp TopicCleanup ) [NinjaEdit]
JanI is default CC for Easy Hacks (Add Jan; remove LibreOffice Dev List from CC) [NinjaEdit]
Please be aware, that this easyhack is considered an important but large scale cosmetic change as described in https://wiki.documentfoundation.org/Development/LargeScaleChanges It was in decided by the ESC to close this kind of easyhacks, and send them directly as mail, to new contributors. https://lists.freedesktop.org/archives/libreoffice/2016-August/074920.html Please do not submit patches with many files !! This particular easyhack is kept open as an exception to the rule.
Miklos Vajna committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=a5a571307fb3306b74ab46b085cde6388270a770 tdf#82580 tools: rename Rectangle to tools::Rectangle It will be available in 5.4.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.
Re-evaluating the EasyHack in 2022 This enhancement is still relevant. Both prewin.h and postwin.h wrapper headers are still present and used in many files: $ git grep postwin.h|wc -l 57 $ git grep prewin.h|wc -l 54