Commit Graph

2276 Commits

Author SHA1 Message Date
2d35baed5e bnc#800714 SwTxtFrm::FormatAdjust: still call SplitFrm if we have columns
Regression from c5a8a2c3cbcee0175127a0662e3d820ea4deea22 (sw34bf05:
i#84870 - method <SwTxtFrm::FormatAdjust(..)> - do not split text frame
which only contains on as-character anchored object, 2011-03-11), the
i#84870 fix was for a document which didn't have columns, and didn't
consider that this causes a layout loop in case:

1) There are two paragraphs in a section, having multiple columns.

2) The second paragraph has fo:keep-together="always".

In this case originally we tried to call SplitFrm(), realized that it
didn't help, and then gave up. But after the change, we kept trying to
satisfy the two conflicting requirements (balance content in the 3
columns vs keep the second paragraph with the first one).

Fix the problem by not calling SplitFrm() only in case we're not inside
columns.

Change-Id: I64e969ef5e8f519314f5613f8e6fae626ae085ce
2014-10-14 16:38:57 +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
d0d64225d8 convert SWFMTFLD_ #defines to an enum
Change-Id: I5daf6436fd049410c4863a4b065c9abd95b5d361
Reviewed-on: https://gerrit.libreoffice.org/11928
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
2014-10-12 05:21:24 +00: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
d7606a6ab5 coverity#1242736 Unused value
unused since

commit 17714047583c7b55c9951846eadffdca98b1680f
Date:   Wed May 22 06:40:48 2002 +0000
    #99282# CTL - Replaced GetGlyphBoundRect by GetTextBoundRect for drop caps

Change-Id: Ic2a5fdbb0c2f66268c60f86d6596d66ad24b7712
2014-10-08 20:45:14 +01:00
969941f996 Related: fdo#58277 if the SwFrm is not IsValid so are its portions
i.e. they don't necessarily match the SwTxtNode anymore, e.g.
content deleted from node, SwFrm is invalid, old portions
refer to old offsets not new ones yet

Change-Id: I755051cd647aa7bb203a6e1f815193fb6ec39191
2014-10-06 12:16:33 +01:00
7f5ed82282 Speed up SwAttrIter::GetNextAttr()
The inner loop which iterates over the characters of
m_pTxtNode->GetTxt() is already bounded to the length of the
string, so there's no need to pay the price of checking its length
for each array position

Change-Id: I7674ea2b46db75fea30dd016b96ec932068fd73b
Reviewed-on: https://gerrit.libreoffice.org/11784
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
2014-10-03 07:30:02 +00:00
8f9bc93ba3 coverity#1242441 Identical code for different branches
before

commit 887b3a35628b349e7934f2ae7c220a1cc17c3e63
Date:   Fri Jun 13 17:52:30 2014 +0200
    loplugin:staticcall

this looked like

SwFtnFrm *pFtnFrm = bEndn ? pEndBoss->FindFtn( pSource, pFtn ) :
                            pFtnBoss->FindFtn( pSource, pFtn );

which superficially seemed to have different if else branches

Change-Id: I450c8080d503489902f16cc756ff9f7013971388
2014-10-01 20:29:01 +01:00
4687ce0675 Constify dumpAsXml and friends
All these dump functions should never change the dumped objects
so 'const' all of them.

Change-Id: Id83422e3950a73e48feb4708fbd4c251506997e0
2014-10-01 10:32:43 +02:00
c9d4a2887c fdo#82577: Handle PolyPolygon
Put the TOOLS PolyPolygon class in the tools namespace. Avoids clash with the Windows
PolyPolygon typedef.

Change-Id: I811ecbb3d55ba4ce66e4555a8586f60fcd57fb66
2014-09-30 11:47:41 +02:00
8dbde0845a fdo#82577: Handle Region
Put the VCL Region class in the vcl namespace. Avoids clash with the X11
Region typedef.

Change-Id: I6e008111df7cf37121fbc3eaabd44a8306338291
2014-09-30 09:58:23 +02:00
86af599c81 Resolves fdo#84283: Export to PDF with footnotes in tables crash
Don't crash when there's no rectangles

Change-Id: I7e713025cacd449f708176254e05d40c0929577f
Reviewed-on: https://gerrit.libreoffice.org/11634
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2014-09-25 12:23:42 +00:00
23e1fc277d loplugin: cstylecast, update PTR_CAST macro to use static_cast
I introduce a template method into the PTR_CAST machinery
to maintain constness.
There is now a FIXME in sd/../docshell.cxx because I needed
to use a dynamic_cast there to work around the games it appears
to be playing with OLE in-place activation.

Signed-off-by: Stephan Bergmann <sbergman@redhat.com>,
dropping the GCC-extension, unnecessary use of typeof from tools/rtti.hxx

Change-Id: Iba5ace1aa27e02b34fcc91af1e658c43371afd03
2014-09-23 17:27:47 +02:00
60e78fbb80 fdo#82577: Handle Font
Put the VCL Font class in the vcl namespace. Avoids clash with the X11
Font typedef.

Change-Id: I1a84f7cad8b31697b9860a3418f7dff794ff6537
2014-09-18 08:54:37 +02:00
a762204a5d Typos
Change-Id: Icf850c4b7b146a82a5638a3cd88ad02f3171aff3
2014-09-17 21:15:33 +02:00
ea733ab5b6 Turn SfxItemState into a C++11 scoped enumeration
...to gain further confidence in the claim "that none of the existing
code tries to uses combinations of these enum values"
(d92602c5b13d0a60439d86c5a033d124178726ca "more fixes for SfxItemState")

Change-Id: I987922d945e8738e38adfde83b869adf3ff35b13
Reviewed-on: https://gerrit.libreoffice.org/11384
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
2014-09-12 06:08:32 +00:00
0a26e27d78 sal_uInt16: use more proper types, avoid unneeded casts, constify
Change-Id: Ic30441307eaa391868ffbb85a67d1c0327258084
2014-09-06 12:12:32 +02:00
ba0498a696 Use more suitable integer types, avoid conversions, constify
Change-Id: I6b7a3b763ea3e2dc6d327c61668fa413fbc60a07
2014-09-06 12:12:32 +02:00
aaa5ed55b1 No need to differentiate between 1 and 2: only !=0 matters
Change-Id: I981472a0b33c6f35f87d891fc7b70c92e621bf95
2014-09-06 12:12:31 +02:00
bce2c9d473 Reduce scope and avoid casts at each call-place
Change-Id: Iade7f5e174b74ea156c0e0bafc5c7c72e4b86dbd
2014-09-06 12:12:31 +02:00
6f8a26668e sal_uInt16 to more proper types
Change-Id: I3728f29e6cb869b3b5e27afd2c1dcdf857fd96de
2014-09-06 12:12:31 +02:00
a219bbb62f Simplify by early bailout
Change-Id: I9815ced0495f3066f8b6477794f33bbd77c613ca
2014-09-06 12:12:30 +02:00
6f9f11d4a3 sal_uInt16 to more proper types, group a test into a bool
Change-Id: I4763e1dfd3d674d36063bada83373a6e45c97303
2014-09-06 12:12:30 +02:00
4f31a00fd0 sal_uInt16 to more proper types, constify
Change-Id: Ic587040d62eb02cc2e1907eee2190e0af95d959d
2014-09-06 12:12:30 +02:00
7ea772887b Use arithmetic instead of while loop
Change-Id: I35738f09ec562815f74643a547505efb6d9a0bfe
2014-09-06 12:12:29 +02:00
bbf64c7802 sal_uInt16 to more proper types, constify, avoid unneeded casts
Change-Id: I6e7d2c9861e9e004a48595d77b919c37409142f1
2014-09-06 12:12:29 +02:00
dab5d58acc SwNoteURL: remove Count and GetURLNote, used only internally
Directly access data member and switch from sal_uInt16 to size_t

Change-Id: I8544463dabc099aa94ae0281e636dbf7835c23b4
2014-09-06 12:12:29 +02:00
bdf00bafb4 Simplify by early bailout
Change-Id: Id6697760f6037f3a11d5b72d1727e48fb3ec6b56
2014-09-06 12:12:29 +02:00
55e866c5c1 Remove unneeded cast
Change-Id: Ia5ed84488d14e6e779d62e9903c1350b703ad3c6
2014-09-06 12:12:28 +02:00
043d405472 Use for loops and more proper integer types, constify
Change-Id: I3d4dc54f4178b5607dc75352696228410d08e38e
2014-09-06 12:12:28 +02:00
04ee8ea4bd Remove unneeded local scope
Change-Id: I51fe6e130006fdca547abe99a44117f710d1e776
2014-09-06 12:12:28 +02:00
c49faa1447 Use enumeration directly
Change-Id: I5b537bb863eafa9e508c7298c611b0d1c0145d77
2014-09-06 12:12:27 +02:00
bc3b71a93e sal_uInt16 to more proper types, constify
Change-Id: I2924f1f8c6ac0e82340293f92656541ffecbcf24
2014-09-06 12:12:27 +02:00
e24a3daf04 Use more proper types, constify, avoid unneeded conversions
Change-Id: I7f1f587c39b9221363e90aea2cf7ed468ce5aac0
2014-09-06 12:12:26 +02:00
dc92503119 Use more proper types, constify, avoid magic numbers
Change-Id: I15d0fd7de815398ae7323209c5e1d3613b722401
2014-09-06 12:12:26 +02:00
698ee302a2 sal_uInt16 to more proper types
Change-Id: I2ad19b46825650f448f921e2bbc1b71ec6314be8
2014-09-06 12:12:26 +02:00
e510bd6362 sal_uInt16: use more proper types, avoid unneeded conversions, constify
Change-Id: I1ee108cca17964e20a9cd780d07f8912d6828fdc
2014-09-06 12:12:26 +02:00
4d8701537f SwSortedObjs: Count() to size() and use size_t consistently
Change-Id: I80fa39e9790a0dfff9d4afb534be119eb593b60d
2014-09-06 12:12:25 +02:00
7b1989ca67 sal_uInt16 to sal_Int32
Change-Id: Ib254f645718e461648a28ef0a9e0875a077b32f6
2014-09-06 12:09:07 +02:00
55f44820f2 Avoid temporary OUStrings
Change-Id: If178bdbf13bbea3eb810267f207855bf6e2a6bda
2014-09-06 12:09:06 +02:00
72e7a1c211 sal_uInt16 to sal_Int32
Change-Id: Ie88f25149e12fecb4f932954ddbe7adc868acfc2
2014-09-06 12:09:06 +02:00
da44e4cce8 Use size_t consistently, constify, reduce scope
Change-Id: Ie5de70645becc5ac584f1b3ffe6048969d2a19a9
2014-09-06 12:08:13 +02:00
794d5ac4ac vcl: use enum for complex text layout constants
Since these constants are bitfield flags, we define some methods to make
working with them reasonably type safe.

Move the definitions to outdevstate.hxx, since we need the values there,
and that appears to be the "root most" header file.

Also dump TEXT_LAYOUT_BIDI_LTR constant, since it means the same thing
as TEXT_LAYOUT_DEFAULT (ie. 0), and leaving it in causes people to write
weird code thinking that it's a real flag.

Change-Id: Iddab86cd6c78181ceb8caa48e77e1f5a8e526343
Reviewed-on: https://gerrit.libreoffice.org/10676
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2014-08-20 09:01:26 -05:00
15295ab6db Refactored SwDoc::GetEditShell .
Removed its output paramater as GetCurrentViewShell should be
used instead and added a const version.

Change-Id: Iad8b57553b6e93e3472ce8c6905d08e8d49af770
2014-08-19 21:57:06 +02:00
d21d5a7261 drop unnecessary shl.hxx includes
Change-Id: Ieb984987c4a4f888a563377e0500444b12f43506
2014-08-18 12:59:49 +01:00
eb8d716fb5 warning C4800: 'int' : forcing value to bool 'true' or 'false'
Change-Id: Iae7dd3944d1d01020c8a3ab1ac4bb2e94e01541e
2014-08-17 05:15:22 +02:00
5494954b26 Refactored IDocumentLayoutAccess out of SwDoc.
Into the new class DocumentLayoutManager.

Change-Id: I02d0cfcc63633d0bdab380508b2ef563187fd269
2014-08-12 23:26:38 +02:00
9d43f6d2c4 Refactored IDocumentLineNumberAccess.
This interface is obsolete and was deleted.

Change-Id: I56d37814f6e43f083ab3d199237ade06db287e18
2014-08-12 23:26:37 +02:00
69e5f335ab Refactored IDocumentFieldsAccess out of SwDoc.
Into the new class DocumentFieldsManager.
Removed SwDoc::_MakeFldList because it is not defined anywhere.
Also moved a few non interface methods that belong to the manager.

Change-Id: Icefd7ca7adcbb05a18d6fae0529fc54150b862fd
2014-08-12 23:26:36 +02:00
274f1811b9 Refactored IDocumentRedlineAccess out of SwDoc.
Into the new class DocumentRedlineManager.
Added an non const version of GetRedlineTbl to the interface.
Also Moved SetAutoFmtRedlineComment which is not part of interface.

Change-Id: I600d5821d5d5831557f5fc5375fb1203fe67a295
2014-08-12 23:26:36 +02:00