Commit Graph

33 Commits

Author SHA1 Message Date
Miklos Vajna
fdb50cd32e SwTextBoxHelper::syncProperty: handle RES_TEXT_VERT_ADJUST
So that vertical text adjustment of the shape is reflected in the
textbox layout.

Change-Id: I887d51928fe4d37db08864374e0cea54f80953b5
2014-06-25 12:30:52 +02:00
Miklos Vajna
7596e26fd2 Add SwTextBoxHelper::findShapes
It builds a textbox -> shape map, so methods interested to pick the
shape instead of a shape's textbox can call it and act accordingly if
their textbox is in the map.

Change-Id: I0f30d64a284eb461f462ed6c0a36c88271153f04
2014-06-24 17:47:40 +02:00
Noel Grandin
e2080e70fe new compilerplugin returnbyref
Find places where we are returning a pointer to something, where we can
be returning a reference.
e.g.
   class A {
     struct X x;
     public X* getX() { return &x; }
   }
which can be:
     public X& getX() { return x; }

Change-Id: I796fd23fd36a18aedf6e36bc28f8fab4f518c6c7
2014-06-24 11:34:21 +02:00
Miklos Vajna
34d4658584 SwDrawContact: recaclc textbox size on shape adjustment change as well
Change-Id: I65abec66d56f2bf83e28c85589638cea5f3a7a0c
2014-06-20 18:03:26 +02:00
Miklos Vajna
23d8fd8dcd SwDrawContact::Changed: sync position/size between draw shape and its textbox
This takes care of moving / resizing the textbox when the draw shape has
been resized.

Change-Id: If4c6f0bcdd03e00e3e49b0d30de3e1d0595977d4
2014-06-20 16:53:51 +02:00
Miklos Vajna
8ba6d7a809 SwDoc::SetFlyFrmAttr: sync position between draw shape and its textbox
The effect of this is that if you move around a shape (having a textbox)
with the keyboard or mouse, then the position of the textbox is now also
adjusted as you would expect it, as a user.

Change-Id: Ie079f8c7b76e9a97095e4233eded5bda514cf405
2014-06-19 17:16:32 +02:00
Miklos Vajna
b577c99adc sw, writerfilter: identation fixes
Change-Id: I1f1db08447006515e7e6842792241aca992984c0
2014-06-14 11:38:32 +02:00
Miklos Vajna
77c3c53cff SwXShape: getter for ChainNext/PrevName UNO property
Change-Id: I7e4fffabf6b1d96a458a3afd141f86d0e4565230
2014-06-13 22:09:32 +02:00
Miklos Vajna
db6f15ab21 SwXShape: add ChainName UNO property
Shapes may not have a unique name, but TextFrames always have. So in
order to be able to link shapes with textboxes, provide a ChainName
property that's the name of the underlying TextFrame. This kills two
birds with one stone:

- we can have a unique name for each shape
- the names can be used for TextFrame linking, as they are valid
  TextFrame names

Change-Id: Ie96f267d392d9fe5388c5eacff9b873f1639054c
2014-06-13 20:07:16 +02:00
Miklos Vajna
599643ec94 SwXShape: add ChainNext/PrevName UNO property
At the moment it's only possible to set this property, and it only sets
the same property of the underlying textbox, if there is any.

Change-Id: I9f168f69a8e92a1b26f21e653a05c97e2e32297c
2014-06-13 20:07:16 +02:00
Miklos Vajna
da22fb668d SwTextBoxHelper::syncProperty: handle FN_TEXT_RANGE
The TextRange property of a shape is its anchor position: if that's
adjusted, then also set the textbox's RES_ANCHOR to the new position.

Without this, e.g. shapes anchored in headers have their textboxes
anchored in the body text, CppunitTest_sw_ooxmlexport's testfdo78420 is
a reproducer.

Change-Id: I83ed09875c3f0360c581c331507ad2b9d05ffb3a
2014-06-13 10:58:17 +02:00
Miklos Vajna
02f2d886c8 SwDoc::CopyFlyInFlyImpl: factor out textbox code into SwTextBoxHelper
Also, let the new SwTextBoxHelper::restoreLinks() restore also the
RES_CNTNT of the *old* draw formats, not only the link between the new
draw and fly formats.

This allows properly preserving the link between draw and fly formats,
when they are in the header (and so copied in and out variously).

Change-Id: I101ff06533e2ea27abea8bed171ed69c9649ebe8
2014-06-13 10:58:17 +02:00
Miklos Vajna
ff1c74f53a SwTextBoxHelper::findTextBox: add an UNO version
Export filters don't have access to SwXShape, and it's probably good to
have that way.

Change-Id: I039bafec10d2fde7c7acdcfad5b07068a2a519f1
2014-06-06 14:24:26 +02:00
Caolán McNamara
4da7559ab3 coverity#1219787 Explicit null dereferenced
Change-Id: Idb13242d25583b1c323b5a20ecc10f10b8b82465
2014-06-06 11:32:57 +01:00
Miklos Vajna
445b58a829 SwTextBoxHelper::queryInterface: handle css::text::XTextRange as well
Change-Id: If56d7cab269a76062ee75bb1a9484f154b72c4d7
2014-06-03 16:15:10 +02:00
Caolán McNamara
074079b909 coverity#1219786 Dereference after null check
Change-Id: I95608ce08b9fffada10bc1a1f6903b50aa78fe9a
2014-06-02 16:59:58 +01:00
Miklos Vajna
8007579865 SwTextBoxHelper: take care of position after a CustomShapeGeometry change
This is required by the ODF import, as that sets the CustomShapeGeometry
after setting other properties (like Transformation, which includes the
position/size).

Change-Id: I299a1b302d55b3753a0a6b2142ea173f5f134b39
2014-06-02 11:40:03 +02:00
Miklos Vajna
24d8bcc763 SwTextBoxHelper: handle size when it's set before CustomShapeGeometry
E.g. the ODF import won't set an explicit size, it'll just set a
Transformation property, and a CustomShapeGeometry one, which contains
the textbox rectangle.

Change-Id: I9ac7ab5a324dc9c7c5ce3196fee8d257b7426f41
2014-05-30 18:04:23 +02:00
Miklos Vajna
ac687b4d6a SwTextBoxHelper: use UNO_NAME_* constants
Change-Id: Ie2ce95f46c19fa6c693619242a65bccc442a7fe7
2014-05-29 14:43:44 +02:00
Miklos Vajna
6823b19257 SwTextBoxHelper::syncProperty(): no need to pass the property name
Change-Id: Ic2f6ae15fd81826d2bc6f8796e33c3c93b34e240
2014-05-29 14:43:44 +02:00
Miklos Vajna
3e26685360 SwTextBoxHelper::create(): initialize position
The situation is a bit more complicated here,
drawing::XCustomShapeEngine returns the text rectangle in absolute
coordinates, but that's on the drawpage. So count the relative
coordinates, and then just adjust the position we got from the original
shape.

Change-Id: Ibfbc183e5170037c8c281d61ce802a19a7acda17
2014-05-29 14:43:44 +02:00
Miklos Vajna
ad8aeb6e02 SwTextBoxHelper::create(): initialize size
On import, syncProperty() takes care of this, but in case the user
interactively adds a textbox, when we need to handle the size in
create() as well.

Change-Id: I9428a682dbf70550bdfd081900e8098aeb64d38f
2014-05-29 14:43:44 +02:00
Miklos Vajna
31c4c834b8 SwTextBoxHelper: extract getTextRectangle() from syncProperty()
Change-Id: I6265247593571ffba4cbda7f87bdde1e943aff51
2014-05-28 15:57:11 +02:00
Miklos Vajna
6971e5f32d SwTextBoxHelper: set textbox Surround for inline shapes
Change-Id: I25167b28397db185cdf9fe5844feecb5a16cc13e
2014-05-27 22:13:20 +02:00
Miklos Vajna
4782e774e3 SwTextBoxHelper::findTextBox: only draw frames can have textboxes
Change-Id: I4ff9f87120a9ba392aee205641e17c12cb30649b
2014-05-27 09:32:45 +02:00
Miklos Vajna
0f884b27fd let SwTextBoxHelper::findTextBoxes() take a const SwDoc
Change-Id: Icb1540b93f4117999b755d4d5fd387f1228250aa
2014-05-27 09:32:45 +02:00
Miklos Vajna
69578bf06d SwXDrawPage::getByIndex(): ignore textboxes
Change-Id: I643ca4268e15af1882adb168af152835ef216cd9
2014-05-27 09:32:44 +02:00
Miklos Vajna
f1dae10ca5 SwXDrawPage::getCount(): ignore textboxes
Change-Id: I579cc0242f6901175162b169813e4465d52952a0
2014-05-27 09:32:44 +02:00
Miklos Vajna
ae59502b20 SwXShape: return the right XText implementaation in the TextBox case
Change-Id: Iac31bd4b3b1918f857feff9045df473e9b1d3d2b
2014-05-27 09:32:44 +02:00
Miklos Vajna
f8ef170acf SwXShape: allow setting TextBox property to false
Change-Id: I23d79fc3f5c020c86296bfc84bb0824e1ca68228
2014-05-27 09:32:44 +02:00
Miklos Vajna
0baec97070 SwTextBoxHelper::syncProperty(): avoid crash on not-yet-inserted shape
Change-Id: I3308ba685b4066ea6849e8002e9d98cc5264c368
2014-05-27 09:32:43 +02:00
Miklos Vajna
f1ada85a95 SwXShape: new bool TextBox property
Change-Id: Iae588c817ea17b6b2c2d3f2818ee5f94ed6f4e96
2014-05-27 09:32:43 +02:00
Miklos Vajna
72159041cb Initial SwTextBoxHelper
Change-Id: I2674d72a2ba7bf49f102e09ed8435445c9687bb2
2014-05-27 09:32:42 +02:00