Commit Graph

3996 Commits

Author SHA1 Message Date
6d249bec48 UBSan: Don't force sal_Int32/float values into sal_uInt32
...overload of TagLogger::attribute.  Not withstanding that function looks just
silly anyway.

Change-Id: I6cc3c5004884e564aac1397cab6eb6fae7a06f7e
2014-10-17 16:09:42 +02:00
fda06137cc Work around Clang 3.2 -Wnull-conversion bug
...by running all of writerfilter through loplugin:nullptr rewriter

Change-Id: Ie6ec5dd989dc2035ccd10941bc38e557e128be0f
2014-10-17 10:58:49 +02:00
9e7eb63989 DOCX import: parse <w:spacing>'s w:before/afterLines attribute
Change-Id: I63b3afda5e8915b562de51aa31e420c135f919ba
2014-10-17 10:19:41 +02:00
5f0721a359 writerfilter: Fix various Clang warnings
Change-Id: I733bcf8e02e659ef18ee9c2be4ad4e9f107fe7c6
2014-10-17 09:51:50 +02:00
9c6ddb1f03 error: use of undeclared identifier 'sResult'
Change-Id: I80f71b16896cd028c9b5d60b243fc5cd825d3c23
2014-10-17 09:22:08 +02:00
3beae0f05d DEBUG_DOMAINMAPPER -> DEBUG_WRITERFILTER
As it's used in the tokenizers as well.

Change-Id: I7a78cad0414c724f33b50315a45a5ff2c941f4db
2014-10-17 08:10:02 +02:00
585fea6e3e fix incremental build
Change-Id: I28dd6c72c665abd95be6d14dc629296850e03e1d
2014-10-17 07:48:15 +02:00
9401b1be34 writerfilter: make dmapper logging a runtime decision, not a buildtime one
It's still only enabled in debug builds, but it now requires an
environment variable, not rebuilding with dbglevel=2.

Change-Id: I970c7bfe0b3f547429ef37f37406a095a60c34ff
2014-10-16 21:12:34 +02:00
582ef22d3e fdo#84854 it seems long is not enough on 32 bit
Fraction used BigInt internally for computations, rational does nothing
like that.

Change-Id: I3e9b25074f979bc291208f7c6362c3c40eb77ff5
2014-10-16 17:44:44 +02:00
3be8ff052f fdo#77716 DOCX import: fix handling of user-defined Standard style
Change-Id: I2cbd9cc0848bfb302bfa0c463a810e7f8231e47b
2014-10-16 11:12:04 +02:00
7f71e99e3f writerfilter: check for DEBUG_DOMAINMAPPER, not OSL_DEBUG_LEVEL explicitly
Previously code only built if DEBUG_DOMAINMAPPER was exactly defined
with OSL_DEBUG_LEVEL was > 1, as they these conditions were used for the
same purpose. Change all this dmapper XML dumping code to consistently
use DEBUG_DOMAINMAPPER, so later it'll be possible to change when it's
defined without breaking the build.

Change-Id: I32442cf098162c7d7c9eb7c454094685ab654b74
2014-10-16 09:34:00 +02:00
bc9a5f00c6 writerfilter: fix include guard
Change-Id: I8c5c8a4e8fbb6e6a2e955c4f544786a2256e6342
2014-10-16 09:33:59 +02:00
12389025b5 DEBUG_WRAP_POLYGON_HANDLER would be never defined
Change-Id: I24e1379d136122906deddd298e456728b3be0956
2014-10-16 09:33:59 +02:00
cf1c3b5c5a writerfilter: call to SAL_WARN() is not expensive
So guards like '#if OSL_DEBUG_LEVEL > 0' around it can be dropped in
most cases. Also, dumping the hex value of token IDs no longer makes
sense, now that doctok is gone.

Change-Id: I2c0d466e4bdde63d271a83aa4e7eebb52294e363
2014-10-15 22:14:18 +02:00
ad9498f8b8 More -Werror,-Wunused-private-field
...detected with a modified trunk Clang with

> Index: lib/Sema/SemaDeclCXX.cpp
> ===================================================================
> --- lib/Sema/SemaDeclCXX.cpp	(revision 219190)
> +++ lib/Sema/SemaDeclCXX.cpp	(working copy)
> @@ -1917,9 +1917,10 @@
>    const Type *T = FD.getType()->getBaseElementTypeUnsafe();
>    // FIXME: Destruction of ObjC lifetime types has side-effects.
>    if (const CXXRecordDecl *RD = T->getAsCXXRecordDecl())
> -    return !RD->isCompleteDefinition() ||
> -           !RD->hasTrivialDefaultConstructor() ||
> -           !RD->hasTrivialDestructor();
> +    return !RD->hasAttr<WarnUnusedAttr>() &&
> +           (!RD->isCompleteDefinition() ||
> +            !RD->hasTrivialDefaultConstructor() ||
> +            !RD->hasTrivialDestructor());
>    return false;
>  }
>
> @@ -3517,9 +3518,11 @@
>    bool addFieldInitializer(CXXCtorInitializer *Init) {
>      AllToInit.push_back(Init);
>
> +#if 0
>      // Check whether this initializer makes the field "used".
>      if (Init->getInit()->HasSideEffects(S.Context))
>        S.UnusedPrivateFields.remove(Init->getAnyMember());
> +#endif
>
>      return false;
>    }

to warn about members of SAL_WARN_UNUSED-annotated class types, and warn about
initializations with side effects (cf.
<http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-October/039602.html>
"-Wunused-private-field distracted by side effects").

Change-Id: I3f3181c4eb8180ca28e1fa3dffc9dbe1002c6628
2014-10-15 15:58:56 +02:00
5a5d55a8a0 fdo#82860 RTF import: fix handling of SHAPE fields
No need to use fieldmarks for these.

Change-Id: I8d2c797f2b00be88e445dab0dd69cb1a9556c02c
2014-10-15 13:19:08 +02:00
75d0cbb2e8 fdo#82071 RTF import: get rid of unexpected underlining in TOC field
Regression from commit 9679e9c23216decb5f9f25f85b04cb3f25211111
(fdo#69649 Fix for pre-rendered Table Of Contents, 2013-12-30), now that
we handle hand-edited TOC, it's necessary to properly track correctly if
a property came from a style or as a direct formatting.

Fix RTFDocumentImpl::getProperties() to detect direct formatting that
cames from a char style and would result in attribute tokens.

Change-Id: Iab5a14770de43249961c280a5dc698200abc8f49
2014-10-14 22:10:01 +02:00
05874170fe Use comphelper::SequenceAsVector
Change-Id: I0af333551bdd32400b795d37de0d6240e68dd6b6
2014-10-13 21:53:48 +02:00
af5ebbf783 create a macro library for implementing bit-flags types
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>,
changed from a macro- to a template-based solution.  (Unfortunately MSVC 2012
does not support explicit conversion operators.  Worked around that with
explicit #ifs rather than some HAVE_EXPLICIT_CONVERSION_OPERATORS and
SAL_EXPLICIT_CONVERSION_OPERATOR ainticipating we hopefully soon move to a
baseline that requires unconditional support for them.)

Change-Id: I4a89643b218d247e8e4a861faba458ec6dfe1396
2014-10-13 17:45:57 +02:00
376dae8117 Avoid manual realloc, use comphelper::SequenceAsVector instead
Change-Id: I26c6bcf7361bbb787fcb4133d05b0a668fd72d01
2014-10-13 09:59:41 +02:00
22f92b8606 Remove dead code
Only doctok produced these tokens, so no need to handle them anymore.

Change-Id: Ied7df2515ac86562dd5ce782a1f01158fe3f684e
2014-10-12 16:26:02 +02:00
b92cfa8829 Clean up now unnecessary boost::bind() magic in RTFSdrImport::initShape()
Change-Id: Ie373098959f8b3e04fe955a08031a4221faab3cc
2014-10-12 16:26:02 +02:00
f99ebf4681 RTF filter: fix \acc* handling
The exporter didn't write circle and underdot at all.

Change-Id: Ia8f45f2b03fb14e9a0027ec24ee7f36adc8c018d
2014-10-12 16:26:01 +02:00
997ce52eb7 DOCX filter: fix <w:em> handling
The real news here is that "comma" and "dot" was swapped on export, the
rest is just a fixup of recent breakage.

Change-Id: I54045f5837652dc38a30361e21ced25aeaf58257
2014-10-12 16:26:01 +02:00
4c12951a03 Typo: compatability->compatibility
Change-Id: If0b98a30452a9d1fcc340173deb6856755926471
2014-10-12 13:00:46 +02:00
9abc806736 error C2677: binary '*' : no global operator found
Change-Id: I13899545421fa710a590cde042e142cdb3293c7c
2014-10-11 09:40:24 +02:00
f0e7d9eb64 writerfilter: drop support for simple list types without constants
In other words, from now it's a must to map ST_Foo simple types to
NS_ooxml::LN_something constants, and raw integers (which are hard to
grep and hard to track down where are they used) are no longer an
option.

Change-Id: I968b27bca3f64f6f4a382b87e2dbc499a3132ea2
2014-10-11 09:39:15 +02:00
510c358646 indentation fixes
Change-Id: I56664b455383f69137399e4c5fb28521ef813287
2014-10-10 20:15:21 +02:00
e34906d20c fdo#84679 RTF import: fix paragraph spacing handling in tables
Regression from commit 1be0a3fa9ebb22b607c54b47739d4467acfed259
(n#825305: writerfilter RTF import: override style properties like Word,
2014-06-17), we failed to do the proper deduplication in buffered
content, like tables. Fix this by adapting
RTFDocumentImpl::replayBuffer() to RTFDocumentImpl::checkNeedPap(),
which already did the proper deduplication.

To be fair, the inconsistency was there earlier since
9f5263c477b82fef5aa9c3e79fb6af92aa049e24 (fdo#44736 RTF import: ignore
direct formatting which equals to style, 2012-11-25), but it caused no
real harm earlier.

Change-Id: I0673408088d9d83768f0780ea92ece87913d03f3
2014-10-10 17:01:56 +02:00
95c45bc25d DOCX import: map <wp:effectExtent>
Change-Id: Ibdfdca37009df3f518133e85d1daef3a4fea9073
2014-10-10 14:15:58 +02:00
315693688d writerfilter: tokenize <wp:effectExtent> attributes
Change-Id: Ie4f4182e92dfd06b283dc86f5bfd611d7842a504
2014-10-10 11:53:56 +02:00
3bbfbed375 cid#1244941 Invalid iterator comparison
this is just a false+, but creating a local var will likely fix it

Change-Id: Ia02e04098a70102c70f5fe5ecd156eea6f40d2af
2014-10-10 10:14:16 +02:00
999fb81067 Use constants for ST_StyleType values
Change-Id: I57ca4ef567126321ab745c8d1d7290b66df23c05
2014-10-10 08:41:35 +02:00
47a2d7642d fdo#81356: convert Fraction to boost::rational<long> - wip
* Added rational util functions used by Fraction class not
  available in the boost::rational class.
* Replaced usage of Fraction by boost::rational<long>
* Removed code that relies on:
  1. fraction.IsValid() -- rational only allow valid values, ie
     denominator() != 0
  2. rational.denominator() == 0 -- always false
  3. rational.denominator() < 0 -- always false but implementation
     detail: http://www.boost.org/doc/libs/release/libs/rational/rational.html#Internal%20representation
* Simplified code that relies on:
  1. rational.denominator() != 0 -- always true
* BUGS EXIST because Fraction allows the creation of invalid values but
  boost::rational throws the exception boost::bad_rational

Change-Id: I84970a4956afb3f91ac0c8f726547466319420f9
Reviewed-on: https://gerrit.libreoffice.org/11551
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
2014-10-09 11:33:33 +00:00
6bd6e19534 Use constants for ST_TblStyleOverrideType values
Change-Id: I61a81bf1aab604d27441630dfb5d55f657211410
2014-10-09 08:59:41 +02:00
faea61ed3d Use constants for ST_PresetColorVal values
Again no need to adapt dmapper/rtftok for these, see commit
020f46d17065b8b00365eab7a809ce980ebfb59a (Use constants for ST_Em
values, 2014-10-07).

Change-Id: Ie67f7a4d251525b5f8799cf613bea56ad82f7a57
2014-10-08 20:13:36 +02:00
1f486806de Use constants for ST_CombineBrackets values
Change-Id: I307d7833fb5556c5509edd698b4b5ecd7b7a5fb3
2014-10-08 09:17:22 +02:00
e1cbaebe7f kde#52609 RTF import: fix memory leak
This is similar to f7ef84640258e4ee6ddc4cc5cbf58a2d89860afa (abi#2128
RTF import: fix memory leak, 2013-11-28).

Change-Id: Id57320466e6fb302ec8616ccc9f4f9429b8eff21
2014-10-07 18:14:34 +02:00
153af84762 DOCX import: handle section break right after a ToC field
The symptom was that during the handling of the XE field, we tried to
access the top of the text append stack, but the stack was empty.

The situation is the following:

1) There is a multi-page TOC field.
2) The page break inside the field is described using a section break,
featuring headers, and the header contains a field that we map to a
fieldmark.
3) There is an XE field after all this.

The root cause was that during parsing of the header, some of the state
should be stashed away and restored when we're done. The new
HeaderFooterContext does exactly this, and now the number of push/pop
calls on the text append context match again.

Change-Id: I10f259fd9edb8bd719ae5bc8a43ed5ef8c708071
2014-10-07 18:04:21 +02:00
45b8765550 fix nullptr/boost compile error
error: no match for ternary ‘operator?:’ in
‘((writerfilter::dmapper::DomainMapper_Impl*)this)->writerfilter::dmapper::DomainMapper_Impl::m_aFieldStack.std::stack<_Tp,
_Sequence>::empty<boost::shared_ptr<writerfilter::dmapper::FieldContext>,
std::deque<boost::shared_ptr<writerfilter::dmapper::FieldContext>,
std::allocator<boost::shared_ptr<writerfilter::dmapper::FieldContext> > > >() ?
nullptr :
((writerfilter::dmapper::DomainMapper_Impl*)this)->writerfilter::dmapper::DomainMapper_Impl::m_aFieldStack.std::stack<_Tp,
_Sequence>::top<boost::shared_ptr<writerfilter::dmapper::FieldContext>,
std::deque<boost::shared_ptr<writerfilter::dmapper::FieldContext>,
std::allocator<boost::shared_ptr<writerfilter::dmapper::FieldContext> > > >()’

Change-Id: I76c7507390bcf80f6ca722c4eedfd65c9a46952f
2014-10-07 16:16:45 +02:00
ee3b34878a coverity#735573 Logically dead code
Change-Id: I4635e974b7812ed5fbc95bd65b7108bb99235661
2014-10-07 14:29:56 +01:00
8ab5a090f6 -Werror=sign-compare
Change-Id: Ic96b85c5c4995f47781eceb6a426a29d8b7679ea
2014-10-07 13:05:02 +02:00
020f46d170 Use constants for ST_Em values
No need to adapt dmapper/rtftok for this one, as those do not handle
<w:em> ATM.

Change-Id: I88da1d0dae804e3d054b7d4158a81cb64cc4b600
2014-10-07 09:05:01 +02:00
fd7a21d7ea Use constants for ST_Shd values
Change-Id: If8fbccf946f589abead0803b7ecbc63ecfc656b2
2014-10-06 09:13:31 +02:00
abbcf82c26 Use constants for ST_Border values
Change-Id: Ie0f83fd7111942912b0abd61473e654cc2f02360
2014-10-05 12:37:23 +02:00
ef24a18e36 Use constants for ST_TabTlc values
Change-Id: Idd277a770a42d33a9c92f41f0452039eba60b6ce
2014-10-04 13:46:50 +02:00
ff978f9728 WaE: implicit conversion of NULL constant to 'boost::detail::sp_nullptr_t'
Change-Id: Id0f3345613ae3b9c19cc5f5845140fa1c067bee0
2014-10-03 18:53:47 +03:00
95b4f258c4 DOCX import: improve table style handling wrt. cell borders
The symptom was that some cell borders were missing. It's because in
Word, cell borders are additions to table borders, so if a table border
is single, but the cell border is none, then the outcome should be
single, not none. In Writer, this is a single UNO property, so if it's
set to SOLID then to NONE, the latter wins.

There are two situations where we now do the right thing:

1) style-cell-border is set, direct-cell-border is none -> outcome is
now inheriting (style-table-border, direct-table-border, etc.)

2) style-cell-border is none, direct-cell-border is none, but
direct-table-border is set -> outcome is now direct-table-border.

Change-Id: I320ae908c61221c8020e3b5323c31dec11c15b2f
2014-10-03 16:24:57 +02:00
9dbf817fe5 handle scope of w:pPrChange and w:rPrChange properly (bnc#821804)
Redlines changing formatting of runs and paragraphs are valid for the entire
run/paragraph, not just their existence in the XML. So store them
in the matching contexts, which will care of it, instead of the endtrackchange
stuff.

Change-Id: Ie583e4be14e8df95829852bfbbbe25aa0684f02e
2014-10-03 13:27:12 +02:00
b696963408 proper scoping for docx redline import (bnc#821804)
propagateCharacterPropertiesAsSet sends the properties only when ending
a text run (or maybe starting another one, I'm not quite sure), so it breaks
ordering by sending them later then expected (although it worked in many cases).
It's a question if propagateCharacterPropertiesAsSet is to be used by anything
actually, since it seems rather broken to use it in the ooxml frontend.
Using sendPropertiesWithId sends the properties properly at the right time,
as one would expect. I don't know why dmapper can't simply handle this on its
own, as I think it does handle entering and leaving other elements, but
spending more time on it with this overdesigned abomination, oh well.

Change-Id: Ie36c5f933ea3e6d789ea8f9e4ee3b60a5d1c920c
2014-10-03 13:26:38 +02:00