1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: swpossizetabpage.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
34 #ifdef SVX_DLLIMPLEMENTATION
35 #undef SVX_DLLIMPLEMENTATION
39 #include <swpossizetabpage.hxx>
40 #include <svx/dialmgr.hxx>
41 #include <dlgutil.hxx>
42 #include <anchorid.hxx>
43 #include <svtools/aeitem.hxx>
44 #include <swframevalidation.hxx>
45 #include <tools/debug.hxx>
46 #include <svx/dialogs.hrc>
47 #include <swpossizetabpage.hrc>
48 #include <htmlmode.hxx>
49 #include <svx/svdview.hxx>
50 #include <svx/svdpagv.hxx>
51 #include <svx/rectenum.hxx>
52 #include <com/sun/star/text/TextContentAnchorType.hpp>
53 #include <com/sun/star/text/HoriOrientation.hpp>
54 #include <com/sun/star/text/VertOrientation.hpp>
55 #include <com/sun/star/text/RelOrientation.hpp>
57 using namespace ::com::sun::star::text
;
58 #define SwFPos SvxSwFramePosString
62 SvxSwFramePosString::StringId eStrId
;
63 SvxSwFramePosString::StringId eMirrorStrId
;
70 SvxSwFramePosString::StringId eStrId
;
71 SvxSwFramePosString::StringId eMirrorStrId
;
75 struct StringIdPair_Impl
77 SvxSwFramePosString::StringId eHori
;
78 SvxSwFramePosString::StringId eVert
;
81 #define LB_FRAME 0x00000001L // paragraph text area
82 #define LB_PRTAREA 0x00000002L // paragraph text area + indents
83 #define LB_VERT_FRAME 0x00000004L // vertical paragraph text area
84 #define LB_VERT_PRTAREA 0x00000008L // vertical paragraph text area + indents
85 #define LB_REL_FRM_LEFT 0x00000010L // left paragraph margin
86 #define LB_REL_FRM_RIGHT 0x00000020L // right paragraph margin
88 #define LB_REL_PG_LEFT 0x00000040L // left page margin
89 #define LB_REL_PG_RIGHT 0x00000080L // right page margin
90 #define LB_REL_PG_FRAME 0x00000100L // complete page
91 #define LB_REL_PG_PRTAREA 0x00000200L // text area of page
93 #define LB_FLY_REL_PG_LEFT 0x00000400L // left frame margin
94 #define LB_FLY_REL_PG_RIGHT 0x00000800L // right frame margin
95 #define LB_FLY_REL_PG_FRAME 0x00001000L // complete frame
96 #define LB_FLY_REL_PG_PRTAREA 0x00002000L // frame interior
98 #define LB_REL_BASE 0x00010000L // as char, relative to baseline
99 #define LB_REL_CHAR 0x00020000L // as char, relative to character
100 #define LB_REL_ROW 0x00040000L // as char, relative to line
102 // OD 10.11.2003 #i22305#
103 #define LB_FLY_VERT_FRAME 0x00100000L // vertical entire frame
104 #define LB_FLY_VERT_PRTAREA 0x00200000L // vertical frame text area
106 // OD 11.11.2003 #i22341#
107 #define LB_VERT_LINE 0x00400000L // vertical text line
109 static RelationMap __FAR_DATA aRelationMap
[] =
111 {SwFPos::FRAME
, SwFPos::FRAME
, LB_FRAME
, RelOrientation::FRAME
},
112 {SwFPos::PRTAREA
, SwFPos::PRTAREA
, LB_PRTAREA
, RelOrientation::PRINT_AREA
},
113 {SwFPos::REL_PG_LEFT
, SwFPos::MIR_REL_PG_LEFT
, LB_REL_PG_LEFT
, RelOrientation::PAGE_LEFT
},
114 {SwFPos::REL_PG_RIGHT
, SwFPos::MIR_REL_PG_RIGHT
, LB_REL_PG_RIGHT
, RelOrientation::PAGE_RIGHT
},
115 {SwFPos::REL_FRM_LEFT
, SwFPos::MIR_REL_FRM_LEFT
, LB_REL_FRM_LEFT
, RelOrientation::FRAME_LEFT
},
116 {SwFPos::REL_FRM_RIGHT
, SwFPos::MIR_REL_FRM_RIGHT
, LB_REL_FRM_RIGHT
, RelOrientation::FRAME_RIGHT
},
117 {SwFPos::REL_PG_FRAME
, SwFPos::REL_PG_FRAME
, LB_REL_PG_FRAME
, RelOrientation::PAGE_FRAME
},
118 {SwFPos::REL_PG_PRTAREA
,SwFPos::REL_PG_PRTAREA
, LB_REL_PG_PRTAREA
, RelOrientation::PAGE_PRINT_AREA
},
119 {SwFPos::REL_CHAR
, SwFPos::REL_CHAR
, LB_REL_CHAR
, RelOrientation::CHAR
},
121 {SwFPos::FLY_REL_PG_LEFT
, SwFPos::FLY_MIR_REL_PG_LEFT
, LB_FLY_REL_PG_LEFT
, RelOrientation::PAGE_LEFT
},
122 {SwFPos::FLY_REL_PG_RIGHT
, SwFPos::FLY_MIR_REL_PG_RIGHT
, LB_FLY_REL_PG_RIGHT
, RelOrientation::PAGE_RIGHT
},
123 {SwFPos::FLY_REL_PG_FRAME
, SwFPos::FLY_REL_PG_FRAME
, LB_FLY_REL_PG_FRAME
, RelOrientation::PAGE_FRAME
},
124 {SwFPos::FLY_REL_PG_PRTAREA
, SwFPos::FLY_REL_PG_PRTAREA
, LB_FLY_REL_PG_PRTAREA
, RelOrientation::PAGE_PRINT_AREA
},
126 {SwFPos::REL_BORDER
, SwFPos::REL_BORDER
, LB_VERT_FRAME
, RelOrientation::FRAME
},
127 {SwFPos::REL_PRTAREA
, SwFPos::REL_PRTAREA
, LB_VERT_PRTAREA
, RelOrientation::PRINT_AREA
},
129 // OD 10.11.2003 #i22305#
130 {SwFPos::FLY_REL_PG_FRAME
, SwFPos::FLY_REL_PG_FRAME
, LB_FLY_VERT_FRAME
, RelOrientation::FRAME
},
131 {SwFPos::FLY_REL_PG_PRTAREA
, SwFPos::FLY_REL_PG_PRTAREA
, LB_FLY_VERT_PRTAREA
, RelOrientation::PRINT_AREA
},
133 // OD 11.11.2003 #i22341#
134 {SwFPos::REL_LINE
, SwFPos::REL_LINE
, LB_VERT_LINE
, RelOrientation::TEXT_LINE
}
137 static RelationMap __FAR_DATA aAsCharRelationMap
[] =
139 {SwFPos::REL_BASE
, SwFPos::REL_BASE
, LB_REL_BASE
, RelOrientation::FRAME
},
140 {SwFPos::REL_CHAR
, SwFPos::REL_CHAR
, LB_REL_CHAR
, RelOrientation::FRAME
},
141 {SwFPos::REL_ROW
, SwFPos::REL_ROW
, LB_REL_ROW
, RelOrientation::FRAME
}
144 /*--------------------------------------------------------------------
146 --------------------------------------------------------------------*/
148 #define HORI_PAGE_REL (LB_REL_PG_FRAME|LB_REL_PG_PRTAREA|LB_REL_PG_LEFT| \
151 static FrmMap __FAR_DATA aHPageMap
[] =
153 {SwFPos::LEFT
, SwFPos::MIR_LEFT
, HoriOrientation::LEFT
, HORI_PAGE_REL
},
154 {SwFPos::RIGHT
, SwFPos::MIR_RIGHT
, HoriOrientation::RIGHT
, HORI_PAGE_REL
},
155 {SwFPos::CENTER_HORI
,SwFPos::CENTER_HORI
, HoriOrientation::CENTER
, HORI_PAGE_REL
},
156 {SwFPos::FROMLEFT
, SwFPos::MIR_FROMLEFT
, HoriOrientation::NONE
, HORI_PAGE_REL
}
159 static FrmMap __FAR_DATA aHPageHtmlMap
[] =
161 {SwFPos::FROMLEFT
, SwFPos::MIR_FROMLEFT
, HoriOrientation::NONE
, LB_REL_PG_FRAME
}
164 #define VERT_PAGE_REL (LB_REL_PG_FRAME|LB_REL_PG_PRTAREA)
166 static FrmMap __FAR_DATA aVPageMap
[] =
168 {SwFPos::TOP
, SwFPos::TOP
, VertOrientation::TOP
, VERT_PAGE_REL
},
169 {SwFPos::BOTTOM
, SwFPos::BOTTOM
, VertOrientation::BOTTOM
, VERT_PAGE_REL
},
170 {SwFPos::CENTER_VERT
, SwFPos::CENTER_VERT
, VertOrientation::CENTER
, VERT_PAGE_REL
},
171 {SwFPos::FROMTOP
, SwFPos::FROMTOP
, VertOrientation::NONE
, VERT_PAGE_REL
}
174 static FrmMap __FAR_DATA aVPageHtmlMap
[] =
176 {SwFPos::FROMTOP
, SwFPos::FROMTOP
, VertOrientation::NONE
, LB_REL_PG_FRAME
}
179 /*--------------------------------------------------------------------
181 --------------------------------------------------------------------*/
183 #define HORI_FRAME_REL (LB_FLY_REL_PG_FRAME|LB_FLY_REL_PG_PRTAREA| \
184 LB_FLY_REL_PG_LEFT|LB_FLY_REL_PG_RIGHT)
186 static FrmMap __FAR_DATA aHFrameMap
[] =
188 {SwFPos::LEFT
, SwFPos::MIR_LEFT
, HoriOrientation::LEFT
, HORI_FRAME_REL
},
189 {SwFPos::RIGHT
, SwFPos::MIR_RIGHT
, HoriOrientation::RIGHT
, HORI_FRAME_REL
},
190 {SwFPos::CENTER_HORI
, SwFPos::CENTER_HORI
, HoriOrientation::CENTER
, HORI_FRAME_REL
},
191 {SwFPos::FROMLEFT
, SwFPos::MIR_FROMLEFT
, HoriOrientation::NONE
, HORI_FRAME_REL
}
194 static FrmMap __FAR_DATA aHFlyHtmlMap
[] =
196 {SwFPos::LEFT
, SwFPos::MIR_LEFT
, HoriOrientation::LEFT
, LB_FLY_REL_PG_FRAME
},
197 {SwFPos::FROMLEFT
, SwFPos::MIR_FROMLEFT
, HoriOrientation::NONE
, LB_FLY_REL_PG_FRAME
}
200 // OD 19.09.2003 #i18732# - own vertical alignment map for to frame anchored objects
201 // OD 10.11.2003 #i22305#
202 #define VERT_FRAME_REL (LB_VERT_FRAME|LB_FLY_VERT_PRTAREA)
204 static FrmMap __FAR_DATA aVFrameMap
[] =
206 {SwFPos::TOP
, SwFPos::TOP
, VertOrientation::TOP
, VERT_FRAME_REL
},
207 {SwFPos::BOTTOM
, SwFPos::BOTTOM
, VertOrientation::BOTTOM
, VERT_FRAME_REL
},
208 {SwFPos::CENTER_VERT
, SwFPos::CENTER_VERT
, VertOrientation::CENTER
, VERT_FRAME_REL
},
209 {SwFPos::FROMTOP
, SwFPos::FROMTOP
, VertOrientation::NONE
, VERT_FRAME_REL
}
212 static FrmMap __FAR_DATA aVFlyHtmlMap
[] =
214 {SwFPos::TOP
, SwFPos::TOP
, VertOrientation::TOP
, LB_FLY_VERT_FRAME
},
215 {SwFPos::FROMTOP
, SwFPos::FROMTOP
, VertOrientation::NONE
, LB_FLY_VERT_FRAME
}
218 static FrmMap __FAR_DATA aVMultiSelectionMap
[] =
220 {SwFPos::FROMTOP
, SwFPos::FROMTOP
, VertOrientation::NONE
, 0}
222 static FrmMap __FAR_DATA aHMultiSelectionMap
[] =
224 {SwFPos::FROMLEFT
, SwFPos::FROMLEFT
, HoriOrientation::NONE
, 0}
227 /*--------------------------------------------------------------------
228 Anchored at paragraph
229 --------------------------------------------------------------------*/
231 #define HORI_PARA_REL (LB_FRAME|LB_PRTAREA|LB_REL_PG_LEFT|LB_REL_PG_RIGHT| \
232 LB_REL_PG_FRAME|LB_REL_PG_PRTAREA|LB_REL_FRM_LEFT| \
235 static FrmMap __FAR_DATA aHParaMap
[] =
237 {SwFPos::LEFT
, SwFPos::MIR_LEFT
, HoriOrientation::LEFT
, HORI_PARA_REL
},
238 {SwFPos::RIGHT
, SwFPos::MIR_RIGHT
, HoriOrientation::RIGHT
, HORI_PARA_REL
},
239 {SwFPos::CENTER_HORI
, SwFPos::CENTER_HORI
, HoriOrientation::CENTER
, HORI_PARA_REL
},
240 {SwFPos::FROMLEFT
, SwFPos::MIR_FROMLEFT
, HoriOrientation::NONE
, HORI_PARA_REL
}
243 #define HTML_HORI_PARA_REL (LB_FRAME|LB_PRTAREA)
245 static FrmMap __FAR_DATA aHParaHtmlMap
[] =
247 {SwFPos::LEFT
, SwFPos::LEFT
, HoriOrientation::LEFT
, HTML_HORI_PARA_REL
},
248 {SwFPos::RIGHT
, SwFPos::RIGHT
, HoriOrientation::RIGHT
, HTML_HORI_PARA_REL
}
251 static FrmMap __FAR_DATA aHParaHtmlAbsMap
[] =
253 {SwFPos::LEFT
, SwFPos::MIR_LEFT
, HoriOrientation::LEFT
, HTML_HORI_PARA_REL
},
254 {SwFPos::RIGHT
, SwFPos::MIR_RIGHT
, HoriOrientation::RIGHT
, HTML_HORI_PARA_REL
}
258 #define VERT_PARA_REL (LB_VERT_FRAME|LB_VERT_PRTAREA| \
259 LB_REL_PG_FRAME|LB_REL_PG_PRTAREA)
261 static FrmMap __FAR_DATA aVParaMap
[] =
263 {SwFPos::TOP
, SwFPos::TOP
, VertOrientation::TOP
, VERT_PARA_REL
},
264 {SwFPos::BOTTOM
, SwFPos::BOTTOM
, VertOrientation::BOTTOM
, VERT_PARA_REL
},
265 {SwFPos::CENTER_VERT
, SwFPos::CENTER_VERT
, VertOrientation::CENTER
, VERT_PARA_REL
},
266 {SwFPos::FROMTOP
, SwFPos::FROMTOP
, VertOrientation::NONE
, VERT_PARA_REL
}
269 static FrmMap __FAR_DATA aVParaHtmlMap
[] =
271 {SwFPos::TOP
, SwFPos::TOP
, VertOrientation::TOP
, LB_VERT_PRTAREA
}
274 /*--------------------------------------------------------------------
275 Anchored at character
276 --------------------------------------------------------------------*/
278 #define HORI_CHAR_REL (LB_FRAME|LB_PRTAREA|LB_REL_PG_LEFT|LB_REL_PG_RIGHT| \
279 LB_REL_PG_FRAME|LB_REL_PG_PRTAREA|LB_REL_FRM_LEFT| \
280 LB_REL_FRM_RIGHT|LB_REL_CHAR)
282 static FrmMap __FAR_DATA aHCharMap
[] =
284 {SwFPos::LEFT
, SwFPos::MIR_LEFT
, HoriOrientation::LEFT
, HORI_CHAR_REL
},
285 {SwFPos::RIGHT
, SwFPos::MIR_RIGHT
, HoriOrientation::RIGHT
, HORI_CHAR_REL
},
286 {SwFPos::CENTER_HORI
, SwFPos::CENTER_HORI
, HoriOrientation::CENTER
, HORI_CHAR_REL
},
287 {SwFPos::FROMLEFT
, SwFPos::MIR_FROMLEFT
, HoriOrientation::NONE
, HORI_CHAR_REL
}
290 #define HTML_HORI_CHAR_REL (LB_FRAME|LB_PRTAREA|LB_REL_CHAR)
292 static FrmMap __FAR_DATA aHCharHtmlMap
[] =
294 {SwFPos::LEFT
, SwFPos::LEFT
, HoriOrientation::LEFT
, HTML_HORI_CHAR_REL
},
295 {SwFPos::RIGHT
, SwFPos::RIGHT
, HoriOrientation::RIGHT
, HTML_HORI_CHAR_REL
}
298 static FrmMap __FAR_DATA aHCharHtmlAbsMap
[] =
300 {SwFPos::LEFT
, SwFPos::MIR_LEFT
, HoriOrientation::LEFT
, LB_PRTAREA
|LB_REL_CHAR
},
301 {SwFPos::RIGHT
, SwFPos::MIR_RIGHT
, HoriOrientation::RIGHT
, LB_PRTAREA
},
302 {SwFPos::FROMLEFT
, SwFPos::MIR_FROMLEFT
, HoriOrientation::NONE
, LB_REL_PG_FRAME
}
305 // OD 19.09.2003 #i18732# - allow vertical alignment at page areas
306 // OD 12.11.2003 #i22341# - handle <LB_REL_CHAR> on its own
307 #define VERT_CHAR_REL (LB_VERT_FRAME|LB_VERT_PRTAREA| \
308 LB_REL_PG_FRAME|LB_REL_PG_PRTAREA)
310 static FrmMap __FAR_DATA aVCharMap
[] =
312 // OD 11.11.2003 #i22341#
313 // introduce mappings for new vertical alignment at top of line <LB_VERT_LINE>
314 // and correct mapping for vertical alignment at character for position <FROM_BOTTOM>
315 // Note: Because of these adjustments the map becomes ambigous in its values
316 // <eStrId>/<eMirrorStrId> and <nAlign>. These ambiguities are considered
317 // in the methods <SwFrmPage::FillRelLB(..)>, <SwFrmPage::GetAlignment(..)>
318 // and <SwFrmPage::FillPosLB(..)>
319 {SwFPos::TOP
, SwFPos::TOP
, VertOrientation::TOP
, VERT_CHAR_REL
|LB_REL_CHAR
},
320 {SwFPos::BOTTOM
, SwFPos::BOTTOM
, VertOrientation::BOTTOM
, VERT_CHAR_REL
|LB_REL_CHAR
},
321 {SwFPos::BELOW
, SwFPos::BELOW
, VertOrientation::CHAR_BOTTOM
, LB_REL_CHAR
},
322 {SwFPos::CENTER_VERT
, SwFPos::CENTER_VERT
, VertOrientation::CENTER
, VERT_CHAR_REL
|LB_REL_CHAR
},
323 {SwFPos::FROMTOP
, SwFPos::FROMTOP
, VertOrientation::NONE
, VERT_CHAR_REL
},
324 {SwFPos::FROMBOTTOM
, SwFPos::FROMBOTTOM
, VertOrientation::NONE
, LB_REL_CHAR
|LB_VERT_LINE
},
325 {SwFPos::TOP
, SwFPos::TOP
, VertOrientation::LINE_TOP
, LB_VERT_LINE
},
326 {SwFPos::BOTTOM
, SwFPos::BOTTOM
, VertOrientation::LINE_BOTTOM
, LB_VERT_LINE
},
327 {SwFPos::CENTER_VERT
, SwFPos::CENTER_VERT
, VertOrientation::LINE_CENTER
, LB_VERT_LINE
}
331 static FrmMap __FAR_DATA aVCharHtmlMap
[] =
333 {SwFPos::BELOW
, SwFPos::BELOW
, VertOrientation::CHAR_BOTTOM
, LB_REL_CHAR
}
336 static FrmMap __FAR_DATA aVCharHtmlAbsMap
[] =
338 {SwFPos::TOP
, SwFPos::TOP
, VertOrientation::TOP
, LB_REL_CHAR
},
339 {SwFPos::BELOW
, SwFPos::BELOW
, VertOrientation::CHAR_BOTTOM
, LB_REL_CHAR
}
341 /*--------------------------------------------------------------------
342 anchored as character
343 --------------------------------------------------------------------*/
345 static FrmMap __FAR_DATA aVAsCharMap
[] =
347 {SwFPos::TOP
, SwFPos::TOP
, VertOrientation::TOP
, LB_REL_BASE
},
348 {SwFPos::BOTTOM
, SwFPos::BOTTOM
, VertOrientation::BOTTOM
, LB_REL_BASE
},
349 {SwFPos::CENTER_VERT
, SwFPos::CENTER_VERT
, VertOrientation::CENTER
, LB_REL_BASE
},
351 {SwFPos::TOP
, SwFPos::TOP
, VertOrientation::CHAR_TOP
, LB_REL_CHAR
},
352 {SwFPos::BOTTOM
, SwFPos::BOTTOM
, VertOrientation::CHAR_BOTTOM
, LB_REL_CHAR
},
353 {SwFPos::CENTER_VERT
, SwFPos::CENTER_VERT
, VertOrientation::CHAR_CENTER
, LB_REL_CHAR
},
355 {SwFPos::TOP
, SwFPos::TOP
, VertOrientation::LINE_TOP
, LB_REL_ROW
},
356 {SwFPos::BOTTOM
, SwFPos::BOTTOM
, VertOrientation::LINE_BOTTOM
, LB_REL_ROW
},
357 {SwFPos::CENTER_VERT
, SwFPos::CENTER_VERT
, VertOrientation::LINE_CENTER
, LB_REL_ROW
},
359 {SwFPos::FROMBOTTOM
, SwFPos::FROMBOTTOM
, VertOrientation::NONE
, LB_REL_BASE
}
362 static FrmMap __FAR_DATA aVAsCharHtmlMap
[] =
364 {SwFPos::TOP
, SwFPos::TOP
, VertOrientation::TOP
, LB_REL_BASE
},
365 {SwFPos::CENTER_VERT
, SwFPos::CENTER_VERT
, VertOrientation::CENTER
, LB_REL_BASE
},
367 {SwFPos::TOP
, SwFPos::TOP
, VertOrientation::CHAR_TOP
, LB_REL_CHAR
},
369 {SwFPos::TOP
, SwFPos::TOP
, VertOrientation::LINE_TOP
, LB_REL_ROW
},
370 {SwFPos::BOTTOM
, SwFPos::BOTTOM
, VertOrientation::LINE_BOTTOM
, LB_REL_ROW
},
371 {SwFPos::CENTER_VERT
, SwFPos::CENTER_VERT
, VertOrientation::LINE_CENTER
, LB_REL_ROW
}
373 /*-- 05.03.2004 15:52:56---------------------------------------------------
375 -----------------------------------------------------------------------*/
376 std::size_t lcl_GetFrmMapCount(const FrmMap
* pMap
)
380 std::size_t aSizeOf
= sizeof(FrmMap
);
381 if( pMap
== aVParaHtmlMap
)
382 return sizeof(aVParaHtmlMap
) / aSizeOf
;
383 if( pMap
== aVAsCharHtmlMap
)
384 return sizeof(aVAsCharHtmlMap
) / aSizeOf
;
385 if( pMap
== aHParaHtmlMap
)
386 return sizeof(aHParaHtmlMap
) / aSizeOf
;
387 if( pMap
== aHParaHtmlAbsMap
)
388 return sizeof(aHParaHtmlAbsMap
) / aSizeOf
;
389 if ( pMap
== aVPageMap
)
390 return sizeof(aVPageMap
) / aSizeOf
;
391 if ( pMap
== aVPageHtmlMap
)
392 return sizeof(aVPageHtmlMap
) / aSizeOf
;
393 if ( pMap
== aVAsCharMap
)
394 return sizeof(aVAsCharMap
) / aSizeOf
;
395 if ( pMap
== aVParaMap
)
396 return sizeof(aVParaMap
) / aSizeOf
;
397 if ( pMap
== aHParaMap
)
398 return sizeof(aHParaMap
) / aSizeOf
;
399 if ( pMap
== aHFrameMap
)
400 return sizeof(aHFrameMap
) / aSizeOf
;
401 // OD 19.09.2003 #i18732# - own vertical alignment map for to frame anchored objects
402 if ( pMap
== aVFrameMap
)
403 return sizeof(aVFrameMap
) / aSizeOf
;
404 if ( pMap
== aHCharMap
)
405 return sizeof(aHCharMap
) / aSizeOf
;
406 if ( pMap
== aHCharHtmlMap
)
407 return sizeof(aHCharHtmlMap
) / aSizeOf
;
408 if ( pMap
== aHCharHtmlAbsMap
)
409 return sizeof(aHCharHtmlAbsMap
) / aSizeOf
;
410 if ( pMap
== aVCharMap
)
411 return sizeof(aVCharMap
) / aSizeOf
;
412 if ( pMap
== aVCharHtmlMap
)
413 return sizeof(aVCharHtmlMap
) / aSizeOf
;
414 if ( pMap
== aVCharHtmlAbsMap
)
415 return sizeof(aVCharHtmlAbsMap
) / aSizeOf
;
416 if ( pMap
== aHPageHtmlMap
)
417 return sizeof(aHPageHtmlMap
) / aSizeOf
;
418 if ( pMap
== aHFlyHtmlMap
)
419 return sizeof(aHFlyHtmlMap
) / aSizeOf
;
420 if ( pMap
== aVFlyHtmlMap
)
421 return sizeof(aVFlyHtmlMap
) / aSizeOf
;
422 if( pMap
== aVMultiSelectionMap
)
423 return sizeof(aVMultiSelectionMap
) / aSizeOf
;
424 if( pMap
== aHMultiSelectionMap
)
425 return sizeof(aHMultiSelectionMap
) / aSizeOf
;
426 return sizeof(aHPageMap
) / aSizeOf
;
430 /*-- 03.03.2004 12:21:33---------------------------------------------------
432 -----------------------------------------------------------------------*/
433 SvxSwFramePosString::StringId
lcl_ChangeResIdToVerticalOrRTL(
434 SvxSwFramePosString::StringId eStringId
, BOOL bVertical
, BOOL bRTL
)
436 //special handling of STR_FROMLEFT
437 if(SwFPos::FROMLEFT
== eStringId
)
439 eStringId
= bVertical
?
440 bRTL
? SwFPos::FROMBOTTOM
: SwFPos::FROMTOP
:
441 bRTL
? SwFPos::FROMRIGHT
: SwFPos::FROMLEFT
;
446 //exchange horizontal strings with vertical strings and vice versa
447 static const StringIdPair_Impl aHoriIds
[] =
449 {SwFPos::LEFT
, SwFPos::TOP
},
450 {SwFPos::RIGHT
, SwFPos::BOTTOM
},
451 {SwFPos::CENTER_HORI
, SwFPos::CENTER_VERT
},
452 {SwFPos::FROMTOP
, SwFPos::FROMRIGHT
},
453 {SwFPos::REL_PG_LEFT
, SwFPos::REL_PG_TOP
},
454 {SwFPos::REL_PG_RIGHT
, SwFPos::REL_PG_BOTTOM
} ,
455 {SwFPos::REL_FRM_LEFT
, SwFPos::REL_FRM_TOP
},
456 {SwFPos::REL_FRM_RIGHT
, SwFPos::REL_FRM_BOTTOM
}
458 static const StringIdPair_Impl aVertIds
[] =
460 {SwFPos::TOP
, SwFPos::RIGHT
},
461 {SwFPos::BOTTOM
, SwFPos::LEFT
},
462 {SwFPos::CENTER_VERT
, SwFPos::CENTER_HORI
},
463 {SwFPos::FROMTOP
, SwFPos::FROMRIGHT
},
464 {SwFPos::REL_PG_TOP
, SwFPos::REL_PG_LEFT
},
465 {SwFPos::REL_PG_BOTTOM
, SwFPos::REL_PG_RIGHT
} ,
466 {SwFPos::REL_FRM_TOP
, SwFPos::REL_FRM_LEFT
},
467 {SwFPos::REL_FRM_BOTTOM
, SwFPos::REL_FRM_RIGHT
}
470 for(nIndex
= 0; nIndex
< sizeof(aHoriIds
) / sizeof(StringIdPair_Impl
); ++nIndex
)
472 if(aHoriIds
[nIndex
].eHori
== eStringId
)
474 eStringId
= aHoriIds
[nIndex
].eVert
;
479 for(nIndex
= 0; nIndex
< sizeof(aVertIds
) / sizeof(StringIdPair_Impl
); ++nIndex
)
481 if(aVertIds
[nIndex
].eHori
== eStringId
)
483 eStringId
= aVertIds
[nIndex
].eVert
;
490 // OD 12.11.2003 #i22341# - helper method in order to determine all possible
491 // listbox relations in a relation map for a given relation
492 ULONG
lcl_GetLBRelationsForRelations( const USHORT _nRel
)
494 ULONG nLBRelations
= 0L;
496 sal_uInt16 nRelMapSize
= sizeof(aRelationMap
) / sizeof(RelationMap
);
497 for ( sal_uInt16 nRelMapPos
= 0; nRelMapPos
< nRelMapSize
; ++nRelMapPos
)
499 if ( aRelationMap
[nRelMapPos
].nRelation
== _nRel
)
501 nLBRelations
|= aRelationMap
[nRelMapPos
].nLBRelation
;
508 // OD 14.11.2003 #i22341# - helper method on order to determine all possible
509 // listbox relations in a relation map for a given string ID
510 ULONG
lcl_GetLBRelationsForStrID( const FrmMap
* _pMap
,
511 const SvxSwFramePosString::StringId _eStrId
,
512 const bool _bUseMirrorStr
)
514 ULONG nLBRelations
= 0L;
516 std::size_t nRelMapSize
= lcl_GetFrmMapCount( _pMap
);
517 for ( std::size_t nRelMapPos
= 0; nRelMapPos
< nRelMapSize
; ++nRelMapPos
)
519 if ( ( !_bUseMirrorStr
&& _pMap
[nRelMapPos
].eStrId
== _eStrId
) ||
520 ( _bUseMirrorStr
&& _pMap
[nRelMapPos
].eMirrorStrId
== _eStrId
) )
522 nLBRelations
|= _pMap
[nRelMapPos
].nLBRelations
;
528 /*-- 03.03.2004 12:21:33---------------------------------------------------
530 -----------------------------------------------------------------------*/
531 SvxSwPosSizeTabPage::SvxSwPosSizeTabPage( Window
* pParent
, const SfxItemSet
& rInAttrs
) :
532 SfxTabPage( pParent
, SVX_RES( RID_SVXPAGE_SWPOSSIZE
), rInAttrs
),
534 #pragma warning (disable : 4355)
536 m_aSizeFL( this, SVX_RES( FL_SIZE
) ),
537 m_aWidthFT( this, SVX_RES( FT_WIDTH
) ),
538 m_aWidthMF( this, SVX_RES( MF_WIDTH
) ),
539 m_aHeightFT( this, SVX_RES( FT_HEIGHT
) ),
540 m_aHeightMF( this, SVX_RES( MF_HEIGHT
) ),
541 m_aKeepRatioCB(this,SVX_RES( CB_KEEPRATIO
) ),
542 m_aSeparatorFL(this,SVX_RES( FL_SEPARATOR
) ),
544 m_aAnchorFL( this, SVX_RES( FL_ANCHOR
) ),
545 m_aToPageRB( this, SVX_RES( RB_TOPAGE
) ),
546 m_aToParaRB( this, SVX_RES( RB_TOPARA
) ),
547 m_aToCharRB( this, SVX_RES( RB_TOCHAR
) ),
548 m_aAsCharRB( this, SVX_RES( RB_ASCHAR
) ),
549 m_aToFrameRB( this, SVX_RES( RB_TOFRAME
) ),
551 m_aProtectionFL( this, SVX_RES( FL_PROTECTION
) ),
552 m_aPositionCB( this, SVX_RES( CB_POSITION
) ),
553 m_aSizeCB( this, SVX_RES( CB_SIZE
) ),
555 m_aPositionFL( this, SVX_RES( FL_POSITION
) ),
556 m_aHoriFT( this, SVX_RES( FT_HORI
) ),
557 m_aHoriLB( this, SVX_RES( LB_HORI
) ),
558 m_aHoriByFT( this, SVX_RES( FT_HORIBY
) ),
559 m_aHoriByMF( this, SVX_RES( MF_HORIBY
) ),
560 m_aHoriToFT( this, SVX_RES( FT_HORITO
) ),
561 m_aHoriToLB( this, SVX_RES( LB_HORITO
) ),
563 m_aHoriMirrorCB( this, SVX_RES( CB_HORIMIRROR
) ),
565 m_aVertFT( this, SVX_RES( FT_VERT
) ),
566 m_aVertLB( this, SVX_RES( LB_VERT
) ),
567 m_aVertByFT( this, SVX_RES( FT_VERTBY
) ),
568 m_aVertByMF( this, SVX_RES( MF_VERTBY
) ),
569 m_aVertToFT( this, SVX_RES( FT_VERTTO
) ),
570 m_aVertToLB( this, SVX_RES( LB_VERTTO
) ),
572 m_aFollowCB( this, SVX_RES( CB_FOLLOW
) ),
573 m_aExampleWN( this, SVX_RES( WN_EXAMPLE
) ),
575 #pragma warning (default : 4355)
580 m_nOldH(HoriOrientation::CENTER
),
581 m_nOldHRel(RelOrientation::FRAME
),
582 m_nOldV(VertOrientation::TOP
),
583 m_nOldVRel(RelOrientation::PRINT_AREA
),
584 m_fWidthHeightRatio(1.0),
587 m_bAtHoriPosModified(false),
588 m_bAtVertPosModified(false),
589 m_bIsVerticalFrame(false),
590 m_bPositioningDisabled(false),
591 m_bIsMultiSelection(false),
592 m_bIsInRightToLeft(false)
595 FieldUnit eDlgUnit
= GetModuleFieldUnit( &rInAttrs
);
596 SetFieldUnit( m_aHoriByMF
, eDlgUnit
, TRUE
);
597 SetFieldUnit( m_aVertByMF
, eDlgUnit
, TRUE
);
598 SetFieldUnit( m_aWidthMF
, eDlgUnit
, TRUE
);
599 SetFieldUnit( m_aHeightMF
, eDlgUnit
, TRUE
);
601 SetExchangeSupport();
603 Link aLk
= LINK(this, SvxSwPosSizeTabPage
, RangeModifyHdl
);
604 m_aWidthMF
. SetLoseFocusHdl( aLk
);
605 m_aHeightMF
. SetLoseFocusHdl( aLk
);
606 m_aHoriByMF
.SetLoseFocusHdl( aLk
);
607 m_aVertByMF
.SetLoseFocusHdl( aLk
);
608 m_aFollowCB
.SetClickHdl( aLk
);
610 aLk
= LINK(this, SvxSwPosSizeTabPage
, ModifyHdl
);
611 m_aWidthMF
. SetModifyHdl( aLk
);
612 m_aHeightMF
. SetModifyHdl( aLk
);
613 m_aHoriByMF
.SetModifyHdl( aLk
);
614 m_aVertByMF
.SetModifyHdl( aLk
);
616 aLk
= LINK(this, SvxSwPosSizeTabPage
, AnchorTypeHdl
);
617 m_aToPageRB
.SetClickHdl( aLk
);
618 m_aToParaRB
.SetClickHdl( aLk
);
619 m_aToCharRB
.SetClickHdl( aLk
);
620 m_aAsCharRB
.SetClickHdl( aLk
);
621 m_aToFrameRB
.SetClickHdl( aLk
);
623 m_aHoriLB
.SetSelectHdl(LINK(this, SvxSwPosSizeTabPage
, PosHdl
));
624 m_aVertLB
. SetSelectHdl(LINK(this, SvxSwPosSizeTabPage
, PosHdl
));
626 m_aHoriToLB
.SetSelectHdl(LINK(this, SvxSwPosSizeTabPage
, RelHdl
));
627 m_aVertToLB
.SetSelectHdl(LINK(this, SvxSwPosSizeTabPage
, RelHdl
));
629 m_aHoriMirrorCB
.SetClickHdl(LINK(this, SvxSwPosSizeTabPage
, MirrorHdl
));
630 m_aPositionCB
.SetClickHdl(LINK(this, SvxSwPosSizeTabPage
, ProtectHdl
));
632 /*-- 03.03.2004 12:21:33---------------------------------------------------
634 -----------------------------------------------------------------------*/
635 SvxSwPosSizeTabPage::~SvxSwPosSizeTabPage()
638 /*-- 03.03.2004 12:21:33---------------------------------------------------
640 -----------------------------------------------------------------------*/
641 SfxTabPage
* SvxSwPosSizeTabPage::Create( Window
* pParent
, const SfxItemSet
& rSet
)
643 return new SvxSwPosSizeTabPage(pParent
, rSet
);
645 /*-- 05.03.2004 17:27:42---------------------------------------------------
647 -----------------------------------------------------------------------*/
648 USHORT
* SvxSwPosSizeTabPage::GetRanges()
650 static USHORT pSwPosRanges
[] =
652 SID_ATTR_TRANSFORM_POS_X
,
653 SID_ATTR_TRANSFORM_POS_Y
,
654 SID_ATTR_TRANSFORM_PROTECT_POS
,
655 SID_ATTR_TRANSFORM_PROTECT_POS
,
656 SID_ATTR_TRANSFORM_INTERN
,
657 SID_ATTR_TRANSFORM_INTERN
,
658 SID_ATTR_TRANSFORM_ANCHOR
,
659 SID_ATTR_TRANSFORM_VERT_ORIENT
,
660 SID_ATTR_TRANSFORM_WIDTH
,
661 SID_ATTR_TRANSFORM_SIZE_POINT
,
662 SID_ATTR_TRANSFORM_PROTECT_POS
,
663 SID_ATTR_TRANSFORM_INTERN
,
664 SID_ATTR_TRANSFORM_AUTOWIDTH
,
665 SID_ATTR_TRANSFORM_VERT_ORIENT
,
668 SID_SW_FOLLOW_TEXT_FLOW
,
669 SID_SW_FOLLOW_TEXT_FLOW
,
670 SID_ATTR_TRANSFORM_HORI_POSITION
,
671 SID_ATTR_TRANSFORM_VERT_POSITION
,
676 /*-- 03.03.2004 12:21:34---------------------------------------------------
678 -----------------------------------------------------------------------*/
679 BOOL
SvxSwPosSizeTabPage::FillItemSet( SfxItemSet
& rSet
)
681 bool bAnchorChanged
= false;
682 short nAnchor
= GetAnchorType(&bAnchorChanged
);
683 BOOL bModified
= FALSE
;
686 rSet
.Put(SfxInt16Item(SID_ATTR_TRANSFORM_ANCHOR
, nAnchor
));
689 if ( m_aPositionCB
.GetState() != m_aPositionCB
.GetSavedValue() )
691 if( m_aPositionCB
.GetState() == STATE_DONTKNOW
)
692 rSet
.InvalidateItem( SID_ATTR_TRANSFORM_PROTECT_POS
);
695 SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_PROTECT_POS
),
696 m_aPositionCB
.GetState() == STATE_CHECK
? TRUE
: FALSE
) );
700 if ( m_aSizeCB
.GetState() != m_aSizeCB
.GetSavedValue() )
702 if ( m_aSizeCB
.GetState() == STATE_DONTKNOW
)
703 rSet
.InvalidateItem( SID_ATTR_TRANSFORM_PROTECT_SIZE
);
706 SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_PROTECT_SIZE
),
707 m_aSizeCB
.GetState() == STATE_CHECK
? TRUE
: FALSE
) );
711 const SfxItemSet
& rOldSet
= GetItemSet();
713 if(!m_bPositioningDisabled
)
715 //on multiple selections the positioning is set via SdrView
716 if(m_bIsMultiSelection
)
718 if( m_aHoriByMF
.IsValueModified() || m_aVertByMF
.IsValueModified() )
721 static_cast<long>(m_aHoriByMF
.Denormalize(m_aHoriByMF
.GetValue(FUNIT_TWIP
)));
723 static_cast<long>(m_aVertByMF
.Denormalize(m_aVertByMF
.GetValue(FUNIT_TWIP
)));
725 // Altes Rechteck mit CoreUnit
726 m_aRect
= m_pSdrView
->GetAllMarkedRect();
727 m_pSdrView
->GetSdrPageView()->LogicToPagePos( m_aRect
);
729 nHoriByPos
+= m_aAnchorPos
.X();
730 nVertByPos
+= m_aAnchorPos
.Y();
732 rSet
.Put( SfxInt32Item( GetWhich( SID_ATTR_TRANSFORM_POS_X
), nHoriByPos
) );
733 rSet
.Put( SfxInt32Item( GetWhich( SID_ATTR_TRANSFORM_POS_Y
), nVertByPos
) );
742 const SfxInt16Item
& rHoriOrient
=
743 static_cast<const SfxInt16Item
&>(rOldSet
.Get( SID_ATTR_TRANSFORM_HORI_ORIENT
));
744 const SfxInt16Item
& rHoriRelation
=
745 static_cast<const SfxInt16Item
&>(rOldSet
.Get( SID_ATTR_TRANSFORM_HORI_RELATION
));
746 const SfxInt32Item
& rHoriPosition
=
747 static_cast<const SfxInt32Item
&>(rOldSet
.Get( SID_ATTR_TRANSFORM_HORI_POSITION
)) ;
749 USHORT nMapPos
= GetMapPos(m_pHMap
, m_aHoriLB
);
750 short nAlign
= GetAlignment(m_pHMap
, nMapPos
, m_aHoriLB
, m_aHoriToLB
);
751 short nRel
= GetRelation(m_pHMap
, m_aHoriToLB
);
752 const long nHoriByPos
=
753 static_cast<long>(m_aHoriByMF
.Denormalize(m_aHoriByMF
.GetValue(FUNIT_TWIP
)));
755 nAlign
!= rHoriOrient
.GetValue() ||
756 nRel
!= rHoriRelation
.GetValue() ||
757 (m_aHoriByMF
.IsEnabled() && nHoriByPos
!= rHoriPosition
.GetValue())
760 rSet
.Put(SfxInt16Item(SID_ATTR_TRANSFORM_HORI_ORIENT
, nAlign
));
761 rSet
.Put(SfxInt16Item(SID_ATTR_TRANSFORM_HORI_RELATION
, nRel
));
762 if(m_aHoriByMF
.IsEnabled())
763 rSet
.Put(SfxInt32Item(SID_ATTR_TRANSFORM_HORI_POSITION
, nHoriByPos
));
767 if(m_aHoriMirrorCB
.IsEnabled() && m_aHoriMirrorCB
.IsChecked() != m_aHoriMirrorCB
.GetSavedValue())
768 bModified
|= 0 != rSet
.Put(SfxBoolItem(SID_ATTR_TRANSFORM_HORI_MIRROR
, m_aHoriMirrorCB
.IsChecked()));
772 const SfxInt16Item
& rVertOrient
=
773 static_cast<const SfxInt16Item
&>(rOldSet
.Get( SID_ATTR_TRANSFORM_VERT_ORIENT
));
774 const SfxInt16Item
& rVertRelation
=
775 static_cast<const SfxInt16Item
&>(rOldSet
.Get( SID_ATTR_TRANSFORM_VERT_RELATION
));
776 const SfxInt32Item
& rVertPosition
=
777 static_cast<const SfxInt32Item
&>(rOldSet
.Get( SID_ATTR_TRANSFORM_VERT_POSITION
));
779 USHORT nMapPos
= GetMapPos(m_pVMap
, m_aVertLB
);
780 short nAlign
= GetAlignment(m_pVMap
, nMapPos
, m_aVertLB
, m_aVertToLB
);
781 short nRel
= GetRelation(m_pVMap
, m_aVertToLB
);
782 // --> OD 2004-10-21 #i34055# - convert vertical position for
783 // as-character anchored objects
785 static_cast<long>(m_aVertByMF
.Denormalize(m_aVertByMF
.GetValue(FUNIT_TWIP
)));
786 if ( GetAnchorType() == TextContentAnchorType_AS_CHARACTER
)
791 if ( nAlign
!= rVertOrient
.GetValue() ||
792 nRel
!= rVertRelation
.GetValue() ||
793 ( m_aVertByMF
.IsEnabled() &&
794 nVertByPos
!= rVertPosition
.GetValue() ) )
796 rSet
.Put(SfxInt16Item(SID_ATTR_TRANSFORM_VERT_ORIENT
, nAlign
));
797 rSet
.Put(SfxInt16Item(SID_ATTR_TRANSFORM_VERT_RELATION
, nRel
));
798 if(m_aVertByMF
.IsEnabled())
799 rSet
.Put(SfxInt32Item(SID_ATTR_TRANSFORM_VERT_POSITION
, nVertByPos
));
804 // OD 19.09.2003 #i18732#
805 if(m_aFollowCB
.IsChecked() != m_aFollowCB
.GetSavedValue())
807 //Writer internal type - based on SfxBoolItem
808 const SfxPoolItem
* pItem
= GetItem( rOldSet
, SID_SW_FOLLOW_TEXT_FLOW
);
811 SfxBoolItem
* pFollow
= static_cast<SfxBoolItem
*>(pItem
->Clone());
812 pFollow
->SetValue(m_aFollowCB
.IsChecked());
813 bModified
|= 0 != rSet
.Put(*pFollow
);
819 if ( m_aWidthMF
.IsValueModified() || m_aHeightMF
.IsValueModified() )
821 sal_uInt32 nWidth
= static_cast<sal_uInt32
>(m_aWidthMF
.Denormalize(m_aWidthMF
.GetValue(FUNIT_TWIP
)));
822 sal_uInt32 nHeight
= static_cast<sal_uInt32
>(m_aHeightMF
.Denormalize(m_aHeightMF
.GetValue(FUNIT_TWIP
)));
823 rSet
.Put( SfxUInt32Item( GetWhich( SID_ATTR_TRANSFORM_WIDTH
),
825 rSet
.Put( SfxUInt32Item( GetWhich( SID_ATTR_TRANSFORM_HEIGHT
),
826 (UINT32
) nHeight
) );
827 //this item is required by SdrEditView::SetGeoAttrToMarked()
828 rSet
.Put( SfxAllEnumItem( GetWhich( SID_ATTR_TRANSFORM_SIZE_POINT
), RP_LT
) );
835 /*-- 03.03.2004 12:21:34---------------------------------------------------
837 -----------------------------------------------------------------------*/
838 void SvxSwPosSizeTabPage::Reset( const SfxItemSet
& rSet
)
840 const SfxPoolItem
* pItem
= GetItem( rSet
, SID_ATTR_TRANSFORM_ANCHOR
);
841 bool bInvalidateAnchor
= false;
842 short nAnchorType
= TextContentAnchorType_AT_PARAGRAPH
;
845 nAnchorType
= static_cast<const SfxInt16Item
*>(pItem
)->GetValue();
848 case TextContentAnchorType_AT_PAGE
: m_aToPageRB
.Check(); break;
849 case TextContentAnchorType_AT_PARAGRAPH
: m_aToParaRB
.Check(); break;
850 case TextContentAnchorType_AT_CHARACTER
: m_aToCharRB
.Check(); break;
851 case TextContentAnchorType_AS_CHARACTER
: m_aAsCharRB
.Check(); break;
852 case TextContentAnchorType_AT_FRAME
: m_aToFrameRB
.Check(); break;
853 default : bInvalidateAnchor
= true;
855 m_aToPageRB
.SaveValue();
856 m_aToParaRB
.SaveValue();
857 m_aToCharRB
.SaveValue();
858 m_aAsCharRB
.SaveValue();
859 m_aToFrameRB
.SaveValue();
861 if(bInvalidateAnchor
)
863 m_aToPageRB
.Enable( FALSE
);
864 m_aToParaRB
.Enable( FALSE
);
865 m_aToCharRB
.Enable( FALSE
);
866 m_aAsCharRB
.Enable( FALSE
);
867 m_aToFrameRB
.Enable( FALSE
);
870 pItem
= GetItem( rSet
, SID_ATTR_TRANSFORM_PROTECT_POS
);
873 sal_Bool bProtected
= ( ( const SfxBoolItem
* )pItem
)->GetValue();
874 m_aPositionCB
.SetState( bProtected
? STATE_CHECK
: STATE_NOCHECK
);
875 m_aPositionCB
.EnableTriState( FALSE
);
876 m_aSizeCB
.Enable( !bProtected
);
880 m_aPositionCB
.SetState( STATE_DONTKNOW
);
883 m_aPositionCB
.SaveValue();
885 pItem
= GetItem( rSet
, SID_ATTR_TRANSFORM_PROTECT_SIZE
);
889 m_aSizeCB
.SetState( ( (const SfxBoolItem
*)pItem
)->GetValue()
890 ? STATE_CHECK
: STATE_NOCHECK
);
891 m_aSizeCB
.EnableTriState( FALSE
);
894 m_aSizeCB
.SetState( STATE_DONTKNOW
);
895 m_aSizeCB
.SaveValue();
897 pItem
= GetItem( rSet
, SID_HTML_MODE
);
899 m_nHtmlMode
= static_cast<const SfxUInt16Item
*>(pItem
)->GetValue();
900 m_bHtmlMode
= 0 != (m_bHtmlMode
& HTMLMODE_ON
);
902 pItem
= GetItem( rSet
, SID_ATTR_TRANSFORM_IN_VERTICAL_TEXT
);
903 if(pItem
&& static_cast<const SfxBoolItem
*>(pItem
)->GetValue())
905 String sHLabel
= m_aHoriFT
.GetText();
906 m_aHoriFT
.SetText(m_aVertFT
.GetText());
907 m_aVertFT
.SetText(sHLabel
);
908 m_bIsVerticalFrame
= true;
910 pItem
= GetItem( rSet
, SID_ATTR_TRANSFORM_IN_RTL_TEXT
);
912 m_bIsInRightToLeft
= static_cast<const SfxBoolItem
*>(pItem
)->GetValue();
914 pItem
= GetItem( rSet
, SID_SW_FOLLOW_TEXT_FLOW
);
917 const bool bFollowTextFlow
=
918 static_cast<const SfxBoolItem
*>(pItem
)->GetValue();
919 m_aFollowCB
.Check( bFollowTextFlow
);
921 m_aFollowCB
.SaveValue();
925 if( 0 == (m_nHtmlMode
& HTMLMODE_FULL_ABS_POS
))
927 m_aHeightFT
.Enable( FALSE
);
928 m_aHeightMF
.Enable( FALSE
);
930 if( 0 == (m_nHtmlMode
& HTMLMODE_SOME_ABS_POS
))
932 if(GetAnchorType() == TextContentAnchorType_AT_PAGE
)
936 m_aToPageRB
.Enable(FALSE
);
938 m_aHoriMirrorCB
.Show(FALSE
);
939 m_aKeepRatioCB
.Enable(FALSE
);
940 // OD 19.09.2003 #i18732# - hide checkbox in HTML mode
941 m_aFollowCB
.Show(FALSE
);
945 // OD 06.11.2003 #i18732# correct enable/disable of check box 'Mirror on..'
946 m_aHoriMirrorCB
.Enable(!m_aAsCharRB
.IsChecked() && !m_bIsMultiSelection
);
948 // OD 06.11.2003 #i18732# - enable/disable check box 'Follow text flow'.
949 m_aFollowCB
.Enable( m_aToParaRB
.IsChecked() ||
950 m_aToCharRB
.IsChecked() );
953 pItem
= GetItem( rSet
, SID_ATTR_TRANSFORM_WIDTH
);
954 sal_Int32 nWidth
= Max( pItem
? ( static_cast<const SfxUInt32Item
*>(pItem
)->GetValue()) : 0, (UINT32
)1 );
956 m_aWidthMF
.SetValue(m_aWidthMF
.Normalize(nWidth
), FUNIT_TWIP
);
958 pItem
= GetItem( rSet
, SID_ATTR_TRANSFORM_HEIGHT
);
959 sal_Int32 nHeight
= Max( pItem
? ( static_cast<const SfxUInt32Item
*>(pItem
)->GetValue()) : 0, (UINT32
)1 );
960 m_aHeightMF
.SetValue(m_aHeightMF
.Normalize(nHeight
), FUNIT_TWIP
);
961 m_fWidthHeightRatio
= nHeight
? double(nWidth
) / double(nHeight
) : 1.0;
963 if(!m_bPositioningDisabled
)
965 pItem
= GetItem( rSet
, SID_ATTR_TRANSFORM_HORI_ORIENT
);
968 short nHoriOrientation
= static_cast< const SfxInt16Item
*>(pItem
)->GetValue();
969 m_nOldH
= nHoriOrientation
;
971 pItem
= GetItem( rSet
, SID_ATTR_TRANSFORM_VERT_ORIENT
);
974 short nVertOrientation
= static_cast< const SfxInt16Item
*>(pItem
)->GetValue();
975 m_nOldV
= nVertOrientation
;
977 pItem
= GetItem( rSet
, SID_ATTR_TRANSFORM_HORI_RELATION
);
980 m_nOldHRel
= static_cast< const SfxInt16Item
*>(pItem
)->GetValue();
983 pItem
= GetItem( rSet
, SID_ATTR_TRANSFORM_VERT_RELATION
);
986 m_nOldVRel
= static_cast< const SfxInt16Item
*>(pItem
)->GetValue();
988 pItem
= GetItem( rSet
, SID_ATTR_TRANSFORM_HORI_MIRROR
);
990 m_aHoriMirrorCB
.Check(static_cast<const SfxBoolItem
*>(pItem
)->GetValue());
991 m_aHoriMirrorCB
.SaveValue();
993 sal_Int32 nHoriPos
= 0;
994 sal_Int32 nVertPos
= 0;
995 pItem
= GetItem( rSet
, SID_ATTR_TRANSFORM_HORI_POSITION
);
997 nHoriPos
= static_cast<const SfxInt32Item
*>(pItem
)->GetValue();
998 pItem
= GetItem( rSet
, SID_ATTR_TRANSFORM_VERT_POSITION
);
1000 nVertPos
= static_cast<const SfxInt32Item
*>(pItem
)->GetValue();
1002 InitPos(nAnchorType
, m_nOldH
, m_nOldHRel
, m_nOldV
, m_nOldVRel
, nHoriPos
, nVertPos
);
1004 m_aVertByMF
.SaveValue();
1005 m_aHoriByMF
.SaveValue();
1006 // OD 19.09.2003 #i18732#
1007 m_aFollowCB
.SaveValue();
1009 RangeModifyHdl(&m_aWidthMF
); // initially set maximum values
1012 /*-- 03.03.2004 12:21:35---------------------------------------------------
1014 -----------------------------------------------------------------------*/
1015 int SvxSwPosSizeTabPage::DeactivatePage( SfxItemSet
* _pSet
)
1018 FillItemSet( *_pSet
);
1019 return( LEAVE_PAGE
);
1021 /*-- 04.03.2004 09:14:41---------------------------------------------------
1023 -----------------------------------------------------------------------*/
1024 void SvxSwPosSizeTabPage::EnableAnchorTypes(USHORT nAnchorEnable
)
1026 if((nAnchorEnable
& SVX_OBJ_AT_FLY
))
1027 m_aToFrameRB
.Show();
1028 if(!(nAnchorEnable
& SVX_OBJ_PAGE
))
1029 m_aToPageRB
.Enable(FALSE
);
1031 /*-- 04.03.2004 09:33:33---------------------------------------------------
1033 -----------------------------------------------------------------------*/
1034 short SvxSwPosSizeTabPage::GetAnchorType(bool* pbHasChanged
)
1037 RadioButton
* pCheckedButton
= 0;
1038 if(m_aToParaRB
.IsEnabled())
1040 if(m_aToPageRB
.IsChecked())
1042 nRet
= TextContentAnchorType_AT_PAGE
;
1043 pCheckedButton
= &m_aToPageRB
;
1045 else if(m_aToParaRB
.IsChecked())
1047 nRet
= TextContentAnchorType_AT_PARAGRAPH
;
1048 pCheckedButton
= &m_aToParaRB
;
1050 else if(m_aToCharRB
.IsChecked())
1052 nRet
= TextContentAnchorType_AT_CHARACTER
;
1053 pCheckedButton
= &m_aToCharRB
;
1055 else if(m_aAsCharRB
.IsChecked())
1057 nRet
= TextContentAnchorType_AS_CHARACTER
;
1058 pCheckedButton
= &m_aAsCharRB
;
1060 else if(m_aToFrameRB
.IsChecked())
1062 nRet
= TextContentAnchorType_AT_FRAME
;
1063 pCheckedButton
= &m_aToFrameRB
;
1069 *pbHasChanged
= pCheckedButton
->IsChecked() != pCheckedButton
->GetSavedValue();
1071 *pbHasChanged
= false;
1075 /*-- 05.03.2004 10:43:32---------------------------------------------------
1077 -----------------------------------------------------------------------*/
1078 IMPL_LINK( SvxSwPosSizeTabPage
, RangeModifyHdl
, Edit
*, EMPTYARG
)
1080 if(m_bPositioningDisabled
)
1082 SvxSwFrameValidation aVal
;
1084 aVal
.nAnchorType
= GetAnchorType();
1085 aVal
.bAutoHeight
= false;
1086 aVal
.bAutoWidth
= false;
1087 aVal
.bMirror
= m_aHoriMirrorCB
.IsChecked();
1088 // OD 18.09.2003 #i18732#
1089 aVal
.bFollowTextFlow
= m_aFollowCB
.IsChecked();
1093 // Ausrichtung Horizontal
1094 USHORT nMapPos
= GetMapPos(m_pHMap
, m_aHoriToLB
);
1095 USHORT nAlign
= GetAlignment(m_pHMap
, nMapPos
, m_aHoriLB
, m_aHoriToLB
);
1096 USHORT nRel
= GetRelation(m_pHMap
, m_aHoriToLB
);
1098 aVal
.nHoriOrient
= (short)nAlign
;
1099 aVal
.nHRelOrient
= (short)nRel
;
1102 aVal
.nHoriOrient
= HoriOrientation::NONE
;
1106 // Ausrichtung Vertikal
1107 USHORT nMapPos
= GetMapPos(m_pVMap
, m_aVertLB
);
1108 USHORT nAlign
= GetAlignment(m_pVMap
, nMapPos
, m_aVertLB
, m_aVertToLB
);
1109 USHORT nRel
= GetRelation(m_pVMap
, m_aVertToLB
);
1111 aVal
.nVertOrient
= (short)nAlign
;
1112 aVal
.nVRelOrient
= (short)nRel
;
1115 aVal
.nVertOrient
= VertOrientation::NONE
;
1117 const long nAtHorzPosVal
=
1118 static_cast<long>(m_aHoriByMF
.Denormalize(m_aHoriByMF
.GetValue(FUNIT_TWIP
)));
1119 const long nAtVertPosVal
=
1120 static_cast<long>(m_aVertByMF
.Denormalize(m_aVertByMF
.GetValue(FUNIT_TWIP
)));
1122 aVal
.nHPos
= nAtHorzPosVal
;
1123 aVal
.nVPos
= nAtVertPosVal
;
1125 sal_Int32 nWidth
= static_cast<sal_uInt32
>(m_aWidthMF
. Denormalize(m_aWidthMF
.GetValue(FUNIT_TWIP
)));
1126 sal_Int32 nHeight
= static_cast<sal_uInt32
>(m_aHeightMF
.Denormalize(m_aHeightMF
.GetValue(FUNIT_TWIP
)));
1127 aVal
.nWidth
= nWidth
;
1128 aVal
.nHeight
= nHeight
;
1130 if(m_aValidateLink
.IsSet())
1131 m_aValidateLink
.Call(&aVal
);
1133 nWidth
= aVal
.nWidth
;
1134 nHeight
= aVal
.nHeight
;
1136 // Mindestbreite auch fuer Vorlage
1137 m_aHeightMF
.SetMin(m_aHeightMF
.Normalize(aVal
.nMinHeight
), FUNIT_TWIP
);
1138 m_aWidthMF
. SetMin(m_aWidthMF
.Normalize(aVal
.nMinWidth
), FUNIT_TWIP
);
1140 sal_Int32
nMaxWidth(aVal
.nMaxWidth
);
1141 sal_Int32
nMaxHeight(aVal
.nMaxHeight
);
1143 sal_Int64 nTmp
= m_aHeightMF
.Normalize(nMaxHeight
);
1144 m_aHeightMF
.SetMax(nTmp
, FUNIT_TWIP
);
1146 nTmp
= m_aWidthMF
.Normalize(nMaxWidth
);
1147 m_aWidthMF
.SetMax(nTmp
, FUNIT_TWIP
);
1149 m_aHoriByMF
.SetMin(m_aHoriByMF
.Normalize(aVal
.nMinHPos
), FUNIT_TWIP
);
1150 m_aHoriByMF
.SetMax(m_aHoriByMF
.Normalize(aVal
.nMaxHPos
), FUNIT_TWIP
);
1151 if ( aVal
.nHPos
!= nAtHorzPosVal
)
1152 m_aHoriByMF
.SetValue(m_aHoriByMF
.Normalize(aVal
.nHPos
), FUNIT_TWIP
);
1154 m_aVertByMF
.SetMin(m_aVertByMF
.Normalize(aVal
.nMinVPos
), FUNIT_TWIP
);
1155 m_aVertByMF
.SetMax(m_aVertByMF
.Normalize(aVal
.nMaxVPos
), FUNIT_TWIP
);
1156 if ( aVal
.nVPos
!= nAtVertPosVal
)
1157 m_aVertByMF
.SetValue(m_aVertByMF
.Normalize(aVal
.nVPos
), FUNIT_TWIP
);
1161 /*-- 05.03.2004 11:12:56---------------------------------------------------
1163 -----------------------------------------------------------------------*/
1164 IMPL_LINK( SvxSwPosSizeTabPage
, AnchorTypeHdl
, RadioButton
*, EMPTYARG
)
1166 m_aHoriMirrorCB
.Enable(!m_aAsCharRB
.IsChecked() && !m_bIsMultiSelection
);
1168 // OD 06.11.2003 #i18732# - enable check box 'Follow text flow' for anchor
1169 // type to-paragraph' and to-character
1170 m_aFollowCB
.Enable( m_aToParaRB
.IsChecked() || m_aToCharRB
.IsChecked() );
1172 short nId
= GetAnchorType();
1174 InitPos( nId
, USHRT_MAX
, 0, USHRT_MAX
, 0, LONG_MAX
, LONG_MAX
);
1184 /*-- 05.03.2004 14:20:19---------------------------------------------------
1186 -----------------------------------------------------------------------*/
1187 IMPL_LINK( SvxSwPosSizeTabPage
, MirrorHdl
, CheckBox
*, EMPTYARG
)
1189 short nId
= GetAnchorType();
1190 InitPos( nId
, USHRT_MAX
, 0, USHRT_MAX
, 0, LONG_MAX
, LONG_MAX
);
1194 /*-- 05.03.2004 14:20:19---------------------------------------------------
1196 -----------------------------------------------------------------------*/
1197 IMPL_LINK( SvxSwPosSizeTabPage
, RelHdl
, ListBox
*, pLB
)
1199 BOOL bHori
= pLB
== &m_aHoriToLB
;
1204 m_bAtHoriPosModified
= TRUE
;
1206 m_bAtVertPosModified
= TRUE
;
1208 // OD 12.11.2003 #i22341# - following special handling no longer needed
1210 if (!bHori && m_pVMap == aVCharMap)
1212 // Ausrichtung Vertikal
1214 USHORT nMapPos = GetMapPos(m_pVMap, m_aVertLB);
1215 USHORT nAlign = GetAlignment(m_pVMap, nMapPos, m_aVertLB, m_aVertToLB);
1216 USHORT nRel = GetRelation(m_pVMap, m_aVertToLB);
1218 if (nRel == SwFPos::REL_CHAR)
1219 sEntry = m_aFramePosString.GetString(SwFPos::FROMBOTTOM);
1221 sEntry = m_aFramePosString.GetString(SwFPos::FROMTOP);
1223 USHORT nOldPos = m_aVertLB.GetSelectEntryPos();
1225 String sName = m_aVertLB.GetEntry(m_aVertLB.GetEntryCount() - 1);
1226 if (sName != sEntry)
1228 m_aVertLB.RemoveEntry(m_aVertLB.GetEntryCount() - 1);
1229 m_aVertLB.InsertEntry(sEntry);
1230 m_aVertLB.SelectEntryPos(nOldPos);
1234 if(m_bHtmlMode
&& TextContentAnchorType_AT_CHARACTER
== GetAnchorType()) // wieder Sonderbehandlung
1238 USHORT nRel
= GetRelation(m_pHMap
, m_aHoriToLB
);
1239 if(RelOrientation::PRINT_AREA
== nRel
&& 0 == m_aVertLB
.GetSelectEntryPos())
1241 m_aVertLB
.SelectEntryPos(1);
1243 else if(RelOrientation::CHAR
== nRel
&& 1 == m_aVertLB
.GetSelectEntryPos())
1245 m_aVertLB
.SelectEntryPos(0);
1249 if (pLB
) // Nur wenn Handler durch Aenderung des Controllers gerufen wurde
1255 /*-- 05.03.2004 14:20:19---------------------------------------------------
1257 -----------------------------------------------------------------------*/
1258 IMPL_LINK( SvxSwPosSizeTabPage
, PosHdl
, ListBox
*, pLB
)
1260 BOOL bHori
= pLB
== &m_aHoriLB
;
1261 ListBox
*pRelLB
= bHori
? &m_aHoriToLB
: &m_aVertToLB
;
1262 FixedText
*pRelFT
= bHori
? &m_aHoriToFT
: &m_aVertToFT
;
1263 FrmMap
*pMap
= bHori
? m_pHMap
: m_pVMap
;
1266 USHORT nMapPos
= GetMapPos(pMap
, *pLB
);
1267 USHORT nAlign
= GetAlignment(pMap
, nMapPos
, *pLB
, *pRelLB
);
1271 BOOL bEnable
= HoriOrientation::NONE
== nAlign
;
1272 m_aHoriByMF
.Enable( bEnable
);
1273 m_aHoriByFT
.Enable( bEnable
);
1277 BOOL bEnable
= VertOrientation::NONE
== nAlign
;
1278 m_aVertByMF
.Enable( bEnable
);
1279 m_aVertByFT
.Enable( bEnable
);
1282 if (pLB
) // Nur wenn Handler durch Aenderung des Controllers gerufen wurde
1283 RangeModifyHdl( 0 );
1286 if (pLB
->GetSelectEntryCount())
1289 if (pRelLB
->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND
)
1290 nRel
= ((RelationMap
*)pRelLB
->GetEntryData(pRelLB
->GetSelectEntryPos()))->nRelation
;
1292 FillRelLB(pMap
, nMapPos
, nAlign
, nRel
, *pRelLB
, *pRelFT
);
1300 m_bAtHoriPosModified
= TRUE
;
1302 m_bAtVertPosModified
= TRUE
;
1304 // Sonderbehandlung fuer HTML-Mode mit horz-vert-Abhaengigkeiten
1305 if(m_bHtmlMode
&& m_nHtmlMode
& HTMLMODE_SOME_ABS_POS
&&
1306 TextContentAnchorType_AT_CHARACTER
== GetAnchorType())
1311 // rechts ist nur unterhalb erlaubt - von links nur oben
1312 // von links am Zeichen -> unterhalb
1313 if((HoriOrientation::LEFT
== nAlign
|| HoriOrientation::RIGHT
== nAlign
) &&
1314 0 == m_aVertLB
.GetSelectEntryPos())
1316 if(RelOrientation::FRAME
== nRel
)
1317 m_aVertLB
.SelectEntryPos(1);
1319 m_aVertLB
.SelectEntryPos(0);
1322 else if(HoriOrientation::LEFT
== nAlign
&& 1 == m_aVertLB
.GetSelectEntryPos())
1324 m_aVertLB
.SelectEntryPos(0);
1327 else if(HoriOrientation::NONE
== nAlign
&& 1 == m_aVertLB
.GetSelectEntryPos())
1329 m_aVertLB
.SelectEntryPos(0);
1337 if(VertOrientation::TOP
== nAlign
)
1339 if(1 == m_aHoriLB
.GetSelectEntryPos())
1341 m_aHoriLB
.SelectEntryPos(0);
1344 m_aHoriToLB
.SelectEntryPos(1);
1346 else if(VertOrientation::CHAR_BOTTOM
== nAlign
)
1348 if(2 == m_aHoriLB
.GetSelectEntryPos())
1350 m_aHoriLB
.SelectEntryPos(0);
1353 m_aHoriToLB
.SelectEntryPos(0) ;
1362 /*-- 05.03.2004 14:20:19---------------------------------------------------
1364 -----------------------------------------------------------------------*/
1365 IMPL_LINK( SvxSwPosSizeTabPage
, ModifyHdl
, Edit
*, pEdit
)
1367 sal_Int64 nWidth
= m_aWidthMF
.Denormalize(m_aWidthMF
.GetValue(FUNIT_TWIP
));
1368 sal_Int64 nHeight
= m_aHeightMF
.Denormalize(m_aHeightMF
.GetValue(FUNIT_TWIP
));
1369 if ( m_aKeepRatioCB
.IsChecked() )
1371 if ( pEdit
== &m_aWidthMF
)
1373 nHeight
= sal_Int64((double)nWidth
/ m_fWidthHeightRatio
);
1374 m_aHeightMF
.SetValue(m_aHeightMF
.Normalize(nHeight
), FUNIT_TWIP
);
1376 else if(pEdit
== &m_aHeightMF
)
1378 nWidth
= sal_Int64((double)nHeight
* m_fWidthHeightRatio
);
1379 m_aWidthMF
.SetValue(m_aWidthMF
.Normalize(nWidth
), FUNIT_TWIP
);
1382 m_fWidthHeightRatio
= nHeight
? double(nWidth
) / double(nHeight
) : 1.0;
1386 /*-- 11.03.2004 15:40:17---------------------------------------------------
1388 -----------------------------------------------------------------------*/
1389 IMPL_LINK( SvxSwPosSizeTabPage
, ProtectHdl
, TriStateBox
*, EMPTYARG
)
1391 m_aSizeCB
.Enable(m_aPositionCB
.IsEnabled() && !m_aPositionCB
.IsChecked());
1394 /*-- 05.03.2004 14:20:19---------------------------------------------------
1396 -----------------------------------------------------------------------*/
1397 short SvxSwPosSizeTabPage::GetRelation(FrmMap
*, ListBox
&rRelationLB
)
1400 USHORT nPos
= rRelationLB
.GetSelectEntryPos();
1402 if (nPos
!= LISTBOX_ENTRY_NOTFOUND
)
1404 RelationMap
*pEntry
= (RelationMap
*)rRelationLB
.GetEntryData(nPos
);
1405 nRel
= pEntry
->nRelation
;
1410 /*-- 05.03.2004 14:20:19---------------------------------------------------
1412 -----------------------------------------------------------------------*/
1413 short SvxSwPosSizeTabPage::GetAlignment(FrmMap
*pMap
, USHORT nMapPos
, ListBox
&/*rAlignLB*/, ListBox
&rRelationLB
)
1417 // OD 14.11.2003 #i22341# - special handling also for map <aVCharMap>,
1418 // because it contains ambigous items for alignment
1419 if (pMap
== aVAsCharHtmlMap
|| pMap
== aVAsCharMap
||
1422 if (rRelationLB
.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND
)
1424 ULONG nRel
= ((RelationMap
*)rRelationLB
.GetEntryData(rRelationLB
.GetSelectEntryPos()))->nLBRelation
;
1425 std::size_t nMapCount
= ::lcl_GetFrmMapCount(pMap
);
1426 SvxSwFramePosString::StringId eStrId
= pMap
[nMapPos
].eStrId
;
1428 for (std::size_t i
= 0; i
< nMapCount
; i
++)
1430 if (pMap
[i
].eStrId
== eStrId
)
1432 ULONG nLBRelations
= pMap
[i
].nLBRelations
;
1433 if (nLBRelations
& nRel
)
1435 nAlign
= pMap
[i
].nAlign
;
1443 nAlign
= pMap
[nMapPos
].nAlign
;
1447 /*-- 05.03.2004 14:20:19---------------------------------------------------
1449 -----------------------------------------------------------------------*/
1450 USHORT
SvxSwPosSizeTabPage::GetMapPos(FrmMap
*pMap
, ListBox
&rAlignLB
)
1453 USHORT nLBSelPos
= rAlignLB
.GetSelectEntryPos();
1455 if (nLBSelPos
!= LISTBOX_ENTRY_NOTFOUND
)
1457 if (pMap
== aVAsCharHtmlMap
|| pMap
== aVAsCharMap
)
1459 std::size_t nMapCount
= ::lcl_GetFrmMapCount(pMap
);
1460 String
sSelEntry(rAlignLB
.GetSelectEntry());
1462 for (std::size_t i
= 0; i
< nMapCount
; i
++)
1464 SvxSwFramePosString::StringId eResId
= pMap
[i
].eStrId
;
1466 String sEntry
= m_aFramePosString
.GetString(eResId
);
1468 if (sEntry
== sSelEntry
)
1470 nMapPos
= sal::static_int_cast
< USHORT
>(i
);
1476 nMapPos
= nLBSelPos
;
1481 /*-- 05.03.2004 14:20:19---------------------------------------------------
1483 -----------------------------------------------------------------------*/
1484 void SvxSwPosSizeTabPage::InitPos(short nAnchor
,
1492 USHORT nPos
= m_aVertLB
.GetSelectEntryPos();
1493 if ( nPos
!= LISTBOX_ENTRY_NOTFOUND
&& m_pVMap
)
1495 m_nOldV
= m_pVMap
[nPos
].nAlign
;
1496 nPos
= m_aVertToLB
.GetSelectEntryPos();
1497 if (nPos
!= LISTBOX_ENTRY_NOTFOUND
)
1498 m_nOldVRel
= ((RelationMap
*)m_aVertToLB
.GetEntryData(nPos
))->nRelation
;
1501 nPos
= m_aHoriLB
.GetSelectEntryPos();
1502 if ( nPos
!= LISTBOX_ENTRY_NOTFOUND
&& m_pHMap
)
1504 m_nOldH
= m_pHMap
[nPos
].nAlign
;
1506 nPos
= m_aHoriToLB
.GetSelectEntryPos();
1507 if (nPos
!= LISTBOX_ENTRY_NOTFOUND
)
1508 m_nOldHRel
= ((RelationMap
*)m_aHoriToLB
.GetEntryData(nPos
))->nRelation
;
1511 BOOL bEnable
= TRUE
;
1512 if( m_bIsMultiSelection
)
1514 m_pVMap
= aVMultiSelectionMap
;
1515 m_pHMap
= aHMultiSelectionMap
;
1517 else if( nAnchor
== TextContentAnchorType_AT_PAGE
)
1519 m_pVMap
= m_bHtmlMode
? aVPageHtmlMap
: aVPageMap
;
1520 m_pHMap
= m_bHtmlMode
? aHPageHtmlMap
: aHPageMap
;
1522 else if ( nAnchor
== TextContentAnchorType_AT_FRAME
)
1524 // OD 19.09.2003 #i18732# - own vertical alignment map for to frame
1525 // anchored objects.
1526 m_pVMap
= m_bHtmlMode
? aVFlyHtmlMap
: aVFrameMap
;
1527 m_pHMap
= m_bHtmlMode
? aHFlyHtmlMap
: aHFrameMap
;
1529 else if ( nAnchor
== TextContentAnchorType_AT_PARAGRAPH
)
1533 m_pVMap
= aVParaHtmlMap
;
1534 m_pHMap
= m_nHtmlMode
& HTMLMODE_SOME_ABS_POS
? aHParaHtmlAbsMap
: aHParaHtmlMap
;
1538 m_pVMap
= aVParaMap
;
1539 m_pHMap
= aHParaMap
;
1542 else if ( nAnchor
== TextContentAnchorType_AT_CHARACTER
)
1546 m_pVMap
= m_nHtmlMode
& HTMLMODE_SOME_ABS_POS
? aVCharHtmlAbsMap
: aVCharHtmlMap
;
1547 m_pHMap
= m_nHtmlMode
& HTMLMODE_SOME_ABS_POS
? aHCharHtmlAbsMap
: aHCharHtmlMap
;
1551 m_pVMap
= aVCharMap
;
1552 m_pHMap
= aHCharMap
;
1555 else if ( nAnchor
== TextContentAnchorType_AS_CHARACTER
)
1557 m_pVMap
= m_bHtmlMode
? aVAsCharHtmlMap
: aVAsCharMap
;
1561 m_aHoriLB
.Enable( bEnable
);
1562 m_aHoriFT
.Enable( bEnable
);
1564 // aktuelle Pos selektieren
1566 if ( nH
== USHRT_MAX
)
1571 // OD 12.11.2003 #i22341# - pass <nHRel> as 3rd parameter to method <FillPosLB>
1572 USHORT nMapPos
= FillPosLB(m_pHMap
, nH
, nHRel
, m_aHoriLB
);
1573 FillRelLB(m_pHMap
, nMapPos
, nH
, nHRel
, m_aHoriToLB
, m_aHoriToFT
);
1576 if ( nV
== USHRT_MAX
)
1581 // OD 12.11.2003 #i22341# - pass <nVRel> as 3rd parameter to method <FillPosLB>
1582 nMapPos
= FillPosLB(m_pVMap
, nV
, nVRel
, m_aVertLB
);
1583 FillRelLB(m_pVMap
, nMapPos
, nV
, nVRel
, m_aVertToLB
, m_aVertToFT
);
1586 bEnable
= nH
== HoriOrientation::NONE
&&
1587 nAnchor
!= TextContentAnchorType_AS_CHARACTER
;//#61359# warum nicht in Formaten&& !bFormat;
1590 m_aHoriByMF
.SetValue( 0, FUNIT_TWIP
);
1591 if (nX
!= LONG_MAX
&& m_bHtmlMode
)
1592 m_aHoriByMF
.SetModifyFlag();
1594 else if(m_bIsMultiSelection
)
1596 m_aHoriByMF
.SetValue( m_aHoriByMF
.Normalize(m_aRect
.Left()), FUNIT_TWIP
);
1601 m_aHoriByMF
.SetValue( m_aHoriByMF
.Normalize(nX
), FUNIT_TWIP
);
1603 m_aHoriByFT
.Enable( bEnable
);
1604 m_aHoriByMF
.Enable( bEnable
);
1606 bEnable
= nV
== VertOrientation::NONE
;
1609 m_aVertByMF
.SetValue( 0, FUNIT_TWIP
);
1610 if(nY
!= LONG_MAX
&& m_bHtmlMode
)
1611 m_aVertByMF
.SetModifyFlag();
1613 else if(m_bIsMultiSelection
)
1615 m_aVertByMF
.SetValue( m_aVertByMF
.Normalize(m_aRect
.Top()), FUNIT_TWIP
);
1619 if ( nAnchor
== TextContentAnchorType_AS_CHARACTER
)
1621 if ( nY
== LONG_MAX
)
1626 if ( nY
!= LONG_MAX
)
1627 m_aVertByMF
.SetValue( m_aVertByMF
.Normalize(nY
), FUNIT_TWIP
);
1629 m_aVertByFT
.Enable( bEnable
);
1630 m_aVertByMF
.Enable( bEnable
);
1633 /*-- 05.03.2004 14:20:19---------------------------------------------------
1635 -----------------------------------------------------------------------*/
1636 void SvxSwPosSizeTabPage::UpdateExample()
1638 USHORT nPos
= m_aHoriLB
.GetSelectEntryPos();
1639 if ( m_pHMap
&& nPos
!= LISTBOX_ENTRY_NOTFOUND
)
1641 USHORT nMapPos
= GetMapPos(m_pHMap
, m_aHoriLB
);
1642 short nAlign
= GetAlignment(m_pHMap
, nMapPos
, m_aHoriLB
, m_aHoriToLB
);
1643 short nRel
= GetRelation(m_pHMap
, m_aHoriToLB
);
1645 m_aExampleWN
.SetHAlign(nAlign
);
1646 m_aExampleWN
.SetHoriRel(nRel
);
1649 nPos
= m_aVertLB
.GetSelectEntryPos();
1650 if ( m_pVMap
&& nPos
!= LISTBOX_ENTRY_NOTFOUND
)
1652 USHORT nMapPos
= GetMapPos(m_pVMap
, m_aVertLB
);
1653 USHORT nAlign
= GetAlignment(m_pVMap
, nMapPos
, m_aVertLB
, m_aVertToLB
);
1654 USHORT nRel
= GetRelation(m_pVMap
, m_aVertToLB
);
1656 m_aExampleWN
.SetVAlign(nAlign
);
1657 m_aExampleWN
.SetVertRel(nRel
);
1661 long nXPos
= static_cast<long>(m_aHoriByMF
.Denormalize(m_aHoriByMF
.GetValue(FUNIT_TWIP
)));
1662 long nYPos
= static_cast<long>(m_aVertByMF
.Denormalize(m_aVertByMF
.GetValue(FUNIT_TWIP
)));
1663 m_aExampleWN
.SetRelPos(Point(nXPos
, nYPos
));
1665 m_aExampleWN
.SetAnchor( GetAnchorType() );
1666 m_aExampleWN
.Invalidate();
1668 /*-- 05.03.2004 14:20:19---------------------------------------------------
1670 -----------------------------------------------------------------------*/
1671 ULONG
SvxSwPosSizeTabPage::FillRelLB(FrmMap
*pMap
, USHORT nMapPos
, USHORT nAlign
,
1672 USHORT nRel
, ListBox
&rLB
, FixedText
&rFT
)
1675 ULONG nLBRelations
= 0;
1676 std::size_t nMapCount
= ::lcl_GetFrmMapCount(pMap
);
1680 if (nMapPos
< nMapCount
)
1682 if (pMap
== aVAsCharHtmlMap
|| pMap
== aVAsCharMap
)
1684 String
sOldEntry(rLB
.GetSelectEntry());
1685 USHORT nRelCount
= sizeof(aAsCharRelationMap
) / sizeof(RelationMap
);
1686 SvxSwFramePosString::StringId eStrId
= pMap
[nMapPos
].eStrId
;
1688 for (std::size_t _nMapPos
= 0; _nMapPos
< nMapCount
; _nMapPos
++)
1690 if (pMap
[_nMapPos
].eStrId
== eStrId
)
1692 nLBRelations
= pMap
[_nMapPos
].nLBRelations
;
1693 for (USHORT nRelPos
= 0; nRelPos
< nRelCount
; nRelPos
++)
1695 if (nLBRelations
& aAsCharRelationMap
[nRelPos
].nLBRelation
)
1697 SvxSwFramePosString::StringId sStrId1
= aAsCharRelationMap
[nRelPos
].eStrId
;
1699 sStrId1
= lcl_ChangeResIdToVerticalOrRTL(sStrId1
, m_bIsVerticalFrame
, m_bIsInRightToLeft
);
1700 String sEntry
= m_aFramePosString
.GetString(sStrId1
);
1701 USHORT nPos
= rLB
.InsertEntry(sEntry
);
1702 rLB
.SetEntryData(nPos
, &aAsCharRelationMap
[nRelPos
]);
1703 if (pMap
[_nMapPos
].nAlign
== nAlign
)
1710 if (sSelEntry
.Len())
1711 rLB
.SelectEntry(sSelEntry
);
1714 rLB
.SelectEntry(sOldEntry
);
1716 if (!rLB
.GetSelectEntryCount())
1718 for (USHORT i
= 0; i
< rLB
.GetEntryCount(); i
++)
1720 RelationMap
*pEntry
= (RelationMap
*)rLB
.GetEntryData(i
);
1721 if (pEntry
->nLBRelation
== LB_REL_CHAR
) // Default
1723 rLB
.SelectEntryPos(i
);
1732 USHORT nRelCount
= sizeof(aRelationMap
) / sizeof(RelationMap
);
1734 // OD 14.11.2003 #i22341# - special handling for map <aVCharMap>,
1735 // because its ambigous in its <eStrId>/<eMirrorStrId>.
1736 if ( pMap
== aVCharMap
)
1738 nLBRelations
= ::lcl_GetLBRelationsForStrID( pMap
,
1739 ( m_aHoriMirrorCB
.IsChecked()
1740 ? pMap
[nMapPos
].eMirrorStrId
1741 : pMap
[nMapPos
].eStrId
),
1742 m_aHoriMirrorCB
.IsChecked() );
1746 nLBRelations
= pMap
[nMapPos
].nLBRelations
;
1749 for (ULONG nBit
= 1; nBit
< 0x80000000; nBit
<<= 1)
1751 if (nLBRelations
& nBit
)
1753 for (USHORT nRelPos
= 0; nRelPos
< nRelCount
; nRelPos
++)
1755 if (aRelationMap
[nRelPos
].nLBRelation
== nBit
)
1757 SvxSwFramePosString::StringId sStrId1
= m_aHoriMirrorCB
.IsChecked() ? aRelationMap
[nRelPos
].eMirrorStrId
: aRelationMap
[nRelPos
].eStrId
;
1758 sStrId1
= lcl_ChangeResIdToVerticalOrRTL(sStrId1
, m_bIsVerticalFrame
, m_bIsInRightToLeft
);
1759 String sEntry
= m_aFramePosString
.GetString(sStrId1
);
1760 USHORT nPos
= rLB
.InsertEntry(sEntry
);
1761 rLB
.SetEntryData(nPos
, &aRelationMap
[nRelPos
]);
1762 if (!sSelEntry
.Len() && aRelationMap
[nRelPos
].nRelation
== nRel
)
1768 if (sSelEntry
.Len())
1769 rLB
.SelectEntry(sSelEntry
);
1772 // Warscheinlich Ankerwechsel. Daher aehnliche Relation suchen
1775 case RelOrientation::FRAME
: nRel
= RelOrientation::PAGE_FRAME
; break;
1776 case RelOrientation::PRINT_AREA
: nRel
= RelOrientation::PAGE_PRINT_AREA
; break;
1777 case RelOrientation::PAGE_LEFT
: nRel
= RelOrientation::FRAME_LEFT
; break;
1778 case RelOrientation::PAGE_RIGHT
: nRel
= RelOrientation::FRAME_RIGHT
; break;
1779 case RelOrientation::FRAME_LEFT
: nRel
= RelOrientation::PAGE_LEFT
; break;
1780 case RelOrientation::FRAME_RIGHT
: nRel
= RelOrientation::PAGE_RIGHT
; break;
1781 case RelOrientation::PAGE_FRAME
: nRel
= RelOrientation::FRAME
; break;
1782 case RelOrientation::PAGE_PRINT_AREA
: nRel
= RelOrientation::PRINT_AREA
; break;
1785 if (rLB
.GetEntryCount())
1787 RelationMap
*pEntry
= (RelationMap
*)rLB
.GetEntryData(rLB
.GetEntryCount() - 1);
1788 nRel
= pEntry
->nRelation
;
1793 for (USHORT i
= 0; i
< rLB
.GetEntryCount(); i
++)
1795 RelationMap
*pEntry
= (RelationMap
*)rLB
.GetEntryData(i
);
1796 if (pEntry
->nRelation
== nRel
)
1798 rLB
.SelectEntryPos(i
);
1803 if (!rLB
.GetSelectEntryCount())
1804 rLB
.SelectEntryPos(0);
1809 rLB
.Enable(rLB
.GetEntryCount() != 0);
1810 rFT
.Enable(rLB
.GetEntryCount() != 0);
1814 return nLBRelations
;
1816 /*-- 05.03.2004 14:20:19---------------------------------------------------
1818 -----------------------------------------------------------------------*/
1819 USHORT
SvxSwPosSizeTabPage::FillPosLB(FrmMap
*_pMap
,
1824 String sSelEntry
, sOldEntry
;
1825 sOldEntry
= _rLB
.GetSelectEntry();
1829 // OD 12.11.2003 #i22341# - determine all possible listbox relations for
1830 // given relation for map <aVCharMap>
1831 const ULONG nLBRelations
= (_pMap
!= aVCharMap
)
1833 : ::lcl_GetLBRelationsForRelations( _nRel
);
1836 std::size_t nCount
= ::lcl_GetFrmMapCount(_pMap
);
1837 for (std::size_t i
= 0; _pMap
&& i
< nCount
; ++i
)
1839 // #61359# Warum nicht von links/von innen bzw. von oben?
1840 // if (!bFormat || (pMap[i].eStrId != SwFPos::FROMLEFT && pMap[i].eStrId != SwFPos::FROMTOP))
1842 SvxSwFramePosString::StringId eStrId
= m_aHoriMirrorCB
.IsChecked() ? _pMap
[i
].eMirrorStrId
: _pMap
[i
].eStrId
;
1843 eStrId
= lcl_ChangeResIdToVerticalOrRTL(eStrId
, m_bIsVerticalFrame
, m_bIsInRightToLeft
);
1844 String
sEntry(m_aFramePosString
.GetString(eStrId
));
1845 if (_rLB
.GetEntryPos(sEntry
) == LISTBOX_ENTRY_NOTFOUND
)
1847 // bei zeichengebundenen Rahmen keine doppelten Eintraege einfuegen
1848 _rLB
.InsertEntry(sEntry
);
1850 // OD 12.11.2003 #i22341# - add condition to handle map <aVCharMap>
1851 // that is ambigous in the alignment.
1852 if ( _pMap
[i
].nAlign
== _nAlign
&&
1853 ( !(_pMap
== aVCharMap
) || _pMap
[i
].nLBRelations
& nLBRelations
) )
1860 _rLB
.SelectEntry(sSelEntry
);
1861 if (!_rLB
.GetSelectEntryCount())
1862 _rLB
.SelectEntry(sOldEntry
);
1864 if (!_rLB
.GetSelectEntryCount())
1865 _rLB
.SelectEntryPos(0);
1869 return GetMapPos(_pMap
, _rLB
);
1871 /*-- 09.03.2004 15:37:50---------------------------------------------------
1873 -----------------------------------------------------------------------*/
1874 void SvxSwPosSizeTabPage::SetView( const SdrView
* pSdrView
)
1876 m_pSdrView
= pSdrView
;
1879 DBG_ERROR("No SdrView* set");
1883 // Setzen des Rechtecks und der Workingarea
1884 m_aRect
= m_pSdrView
->GetAllMarkedRect();
1885 m_pSdrView
->GetSdrPageView()->LogicToPagePos( m_aRect
);
1888 m_aWorkArea
= m_pSdrView
->GetWorkArea();
1890 // Beruecksichtigung Ankerposition (bei Writer)
1891 const SdrMarkList
& rMarkList
= m_pSdrView
->GetMarkedObjectList();
1892 if( rMarkList
.GetMarkCount() >= 1 )
1894 const SdrObject
* pObj
= rMarkList
.GetMark( 0 )->GetMarkedSdrObj();
1895 m_aAnchorPos
= pObj
->GetAnchorPos();
1897 if( m_aAnchorPos
!= Point(0,0) ) // -> Writer
1899 for( USHORT i
= 1; i
< rMarkList
.GetMarkCount(); i
++ )
1901 pObj
= rMarkList
.GetMark( i
)->GetMarkedSdrObj();
1902 if( m_aAnchorPos
!= pObj
->GetAnchorPos() )
1904 // different anchor positions -> disable positioning
1905 m_aPositionFL
.Enable(FALSE
);
1906 m_aHoriFT
.Enable(FALSE
);
1907 m_aHoriLB
.Enable(FALSE
);
1908 m_aHoriByFT
.Enable(FALSE
);
1909 m_aHoriByMF
.Enable(FALSE
);
1910 m_aHoriToFT
.Enable(FALSE
);
1911 m_aHoriToLB
.Enable(FALSE
);
1912 m_aHoriMirrorCB
.Enable(FALSE
);
1913 m_aVertFT
.Enable(FALSE
);
1914 m_aVertLB
.Enable(FALSE
);
1915 m_aVertByFT
.Enable(FALSE
);
1916 m_aVertByMF
.Enable(FALSE
);
1917 m_aVertToFT
.Enable(FALSE
);
1918 m_aVertToLB
.Enable(FALSE
);
1919 m_aFollowCB
.Enable(FALSE
);
1920 m_aHoriByMF
.SetText(String());
1921 m_aVertByMF
.SetText(String());
1923 m_bPositioningDisabled
= true;
1928 Point aPt
= m_aAnchorPos
* -1;
1931 aPt
+= m_aWorkArea
.TopLeft();
1932 m_aWorkArea
.SetPos( aPt
);
1934 aPt2
+= m_aRect
.TopLeft();
1935 m_aRect
.SetPos( aPt2
);
1938 // this should happen via SID_ATTR_TRANSFORM_AUTOSIZE
1939 if( rMarkList
.GetMarkCount() == 1 )
1941 const SdrObject
* pObj
= rMarkList
.GetMark( 0 )->GetMarkedSdrObj();
1942 SdrObjKind eKind
= (SdrObjKind
) pObj
->GetObjIdentifier();
1943 if( ( pObj
->GetObjInventor() == SdrInventor
) &&
1944 ( eKind
==OBJ_TEXT
|| eKind
==OBJ_TITLETEXT
|| eKind
==OBJ_OUTLINETEXT
) &&
1945 ( (SdrTextObj
*) pObj
)->HasText() )
1947 DBG_ERROR("AutoWidth/AutoHeight should be enabled");
1951 m_bIsMultiSelection
= true;
1953 // use page offset and recalculate
1954 Point
aPt( m_pSdrView
->GetSdrPageView()->GetPageOrigin() );
1957 Fraction aUIScale
= m_pSdrView
->GetModel()->GetUIScale();
1959 // lcl_ScaleRect( m_aWorkArea, aUIScale );
1960 // lcl_ScaleRect( m_aRect, aUIScale );
1961 // lcl_ScalePoint( aPt, aUIScale );
1963 // Metrik konvertieren
1964 // int nDigits = maMtrPosX.GetDecimalDigits();
1966 // aPt = lcl_ConvertPoint( aPt, nDigits, (MapUnit) mePoolUnit, meDlgUnit );
1967 // m_aWorkArea = lcl_ConvertRect( m_aWorkArea, nDigits, (MapUnit) mePoolUnit, meDlgUnit );
1968 // m_aRect = lcl_ConvertRect( m_aRect, nDigits, (MapUnit) mePoolUnit, meDlgUnit );
1972 // aPt += m_aWorkArea.TopLeft();
1973 // m_aWorkArea.SetPos( aPt );
1975 //SetMinMaxPosition();