Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <com/sun/star/embed/Aspects.hpp>
21 : #include <com/sun/star/embed/EmbedMisc.hpp>
22 :
23 : #include <cmdid.h>
24 : #include <helpid.h>
25 : #include <hintids.hxx>
26 : #include <vcl/msgbox.hxx>
27 : #include <vcl/mnemonic.hxx>
28 : #include <svl/urihelper.hxx>
29 : #include <svl/stritem.hxx>
30 : #include <sfx2/htmlmode.hxx>
31 : #include <editeng/sizeitem.hxx>
32 : #include <editeng/opaqitem.hxx>
33 : #include <editeng/protitem.hxx>
34 : #include <editeng/prntitem.hxx>
35 : #include <editeng/brushitem.hxx>
36 : #include <editeng/ulspitem.hxx>
37 : #include <editeng/frmdiritem.hxx>
38 : #include <svx/swframevalidation.hxx>
39 : #include <comphelper/classids.hxx>
40 :
41 : #include <sfx2/viewfrm.hxx>
42 : #include <fmturl.hxx>
43 : #include <fmteiro.hxx>
44 : #include <fmtcnct.hxx>
45 : #include <view.hxx>
46 : #include <wrtsh.hxx>
47 : #include <swmodule.hxx>
48 : #include <uitool.hxx>
49 : #include <docsh.hxx>
50 : #include <viewopt.hxx>
51 : #include <frmatr.hxx>
52 : #include <frmdlg.hxx>
53 : #include <frmmgr.hxx>
54 : #include <frmpage.hxx>
55 : #include <wrap.hxx>
56 : #include <colmgr.hxx>
57 : #include <grfatr.hxx>
58 : #include <uiitems.hxx>
59 : #include <fmtfollowtextflow.hxx>
60 : #include <editeng/adjustitem.hxx>
61 : #include <svx/sdtaitm.hxx>
62 : #include <sal/macros.h>
63 :
64 : #include <frmui.hrc>
65 : #include <sfx2/filedlghelper.hxx>
66 : #include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
67 : #include <com/sun/star/ui/dialogs/XFilePicker.hpp>
68 : #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
69 : #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
70 : #include <vcl/graphicfilter.hxx>
71 :
72 : using namespace ::com::sun::star;
73 : using namespace ::sfx2;
74 :
75 : #define SwFPos SvxSwFramePosString
76 :
77 : struct FrmMap
78 : {
79 : SvxSwFramePosString::StringId eStrId;
80 : SvxSwFramePosString::StringId eMirrorStrId;
81 : sal_Int16 nAlign;
82 : sal_uLong nLBRelations;
83 : };
84 :
85 : struct RelationMap
86 : {
87 : SvxSwFramePosString::StringId eStrId;
88 : SvxSwFramePosString::StringId eMirrorStrId;
89 : sal_uLong nLBRelation;
90 : sal_Int16 nRelation;
91 : };
92 :
93 : struct StringIdPair_Impl
94 : {
95 : SvxSwFramePosString::StringId eHori;
96 : SvxSwFramePosString::StringId eVert;
97 : };
98 :
99 : #define MAX_PERCENT_WIDTH 254L
100 : #define MAX_PERCENT_HEIGHT 254L
101 :
102 : #define LB_FRAME 0x00000001L // text region of the paragraph
103 : #define LB_PRTAREA 0x00000002L // text region of the paragraph + indentions
104 : #define LB_VERT_FRAME 0x00000004L // vertical text region of the paragraph
105 : #define LB_VERT_PRTAREA 0x00000008L // vertival text region of the paragraph + indentions
106 : #define LB_REL_FRM_LEFT 0x00000010L // left paragraph edge
107 : #define LB_REL_FRM_RIGHT 0x00000020L // right paragraph edge
108 :
109 : #define LB_REL_PG_LEFT 0x00000040L // left page edge
110 : #define LB_REL_PG_RIGHT 0x00000080L // right page edge
111 : #define LB_REL_PG_FRAME 0x00000100L // whole page
112 : #define LB_REL_PG_PRTAREA 0x00000200L // text region of the page
113 :
114 : #define LB_FLY_REL_PG_LEFT 0x00000400L // left frame edge
115 : #define LB_FLY_REL_PG_RIGHT 0x00000800L // right frame edge
116 : #define LB_FLY_REL_PG_FRAME 0x00001000L // whole frame
117 : #define LB_FLY_REL_PG_PRTAREA 0x00002000L // inside of the frame
118 :
119 : #define LB_REL_BASE 0x00010000L // character alignment Base
120 : #define LB_REL_CHAR 0x00020000L // character alignment Character
121 : #define LB_REL_ROW 0x00040000L // character alignment Row
122 :
123 : #define LB_FLY_VERT_FRAME 0x00100000L // vertical entire frame
124 : #define LB_FLY_VERT_PRTAREA 0x00200000L // vertical frame text area
125 :
126 : #define LB_VERT_LINE 0x00400000L // vertical text line
127 :
128 : static RelationMap aRelationMap[] =
129 : {
130 : {SwFPos::FRAME, SwFPos::FRAME, LB_FRAME, text::RelOrientation::FRAME},
131 : {SwFPos::PRTAREA, SwFPos::PRTAREA, LB_PRTAREA, text::RelOrientation::PRINT_AREA},
132 : {SwFPos::REL_PG_LEFT, SwFPos::MIR_REL_PG_LEFT, LB_REL_PG_LEFT, text::RelOrientation::PAGE_LEFT},
133 : {SwFPos::REL_PG_RIGHT, SwFPos::MIR_REL_PG_RIGHT, LB_REL_PG_RIGHT, text::RelOrientation::PAGE_RIGHT},
134 : {SwFPos::REL_FRM_LEFT, SwFPos::MIR_REL_FRM_LEFT, LB_REL_FRM_LEFT, text::RelOrientation::FRAME_LEFT},
135 : {SwFPos::REL_FRM_RIGHT, SwFPos::MIR_REL_FRM_RIGHT, LB_REL_FRM_RIGHT, text::RelOrientation::FRAME_RIGHT},
136 : {SwFPos::REL_PG_FRAME, SwFPos::REL_PG_FRAME, LB_REL_PG_FRAME, text::RelOrientation::PAGE_FRAME},
137 : {SwFPos::REL_PG_PRTAREA, SwFPos::REL_PG_PRTAREA, LB_REL_PG_PRTAREA, text::RelOrientation::PAGE_PRINT_AREA},
138 : {SwFPos::REL_CHAR, SwFPos::REL_CHAR, LB_REL_CHAR, text::RelOrientation::CHAR},
139 :
140 : {SwFPos::FLY_REL_PG_LEFT, SwFPos::FLY_MIR_REL_PG_LEFT, LB_FLY_REL_PG_LEFT, text::RelOrientation::PAGE_LEFT},
141 : {SwFPos::FLY_REL_PG_RIGHT, SwFPos::FLY_MIR_REL_PG_RIGHT, LB_FLY_REL_PG_RIGHT, text::RelOrientation::PAGE_RIGHT},
142 : {SwFPos::FLY_REL_PG_FRAME, SwFPos::FLY_REL_PG_FRAME, LB_FLY_REL_PG_FRAME, text::RelOrientation::PAGE_FRAME},
143 : {SwFPos::FLY_REL_PG_PRTAREA, SwFPos::FLY_REL_PG_PRTAREA, LB_FLY_REL_PG_PRTAREA, text::RelOrientation::PAGE_PRINT_AREA},
144 :
145 : {SwFPos::REL_BORDER, SwFPos::REL_BORDER, LB_VERT_FRAME, text::RelOrientation::FRAME},
146 : {SwFPos::REL_PRTAREA, SwFPos::REL_PRTAREA, LB_VERT_PRTAREA, text::RelOrientation::PRINT_AREA},
147 :
148 : {SwFPos::FLY_REL_PG_FRAME, SwFPos::FLY_REL_PG_FRAME, LB_FLY_VERT_FRAME, text::RelOrientation::FRAME},
149 : {SwFPos::FLY_REL_PG_PRTAREA, SwFPos::FLY_REL_PG_PRTAREA, LB_FLY_VERT_PRTAREA, text::RelOrientation::PRINT_AREA},
150 :
151 : {SwFPos::REL_LINE, SwFPos::REL_LINE, LB_VERT_LINE, text::RelOrientation::TEXT_LINE}
152 : };
153 :
154 : static RelationMap aAsCharRelationMap[] =
155 : {
156 : {SwFPos::REL_BASE, SwFPos::REL_BASE, LB_REL_BASE, text::RelOrientation::FRAME},
157 : {SwFPos::REL_CHAR, SwFPos::REL_CHAR, LB_REL_CHAR, text::RelOrientation::FRAME},
158 : {SwFPos::REL_ROW, SwFPos::REL_ROW, LB_REL_ROW, text::RelOrientation::FRAME}
159 : };
160 :
161 : /*--------------------------------------------------------------------
162 : Description: site anchored
163 : --------------------------------------------------------------------*/
164 : #define HORI_PAGE_REL (LB_REL_PG_FRAME|LB_REL_PG_PRTAREA|LB_REL_PG_LEFT| \
165 : LB_REL_PG_RIGHT)
166 :
167 : static FrmMap aHPageMap[] =
168 : {
169 : {SwFPos::LEFT, SwFPos::MIR_LEFT, text::HoriOrientation::LEFT, HORI_PAGE_REL},
170 : {SwFPos::RIGHT, SwFPos::MIR_RIGHT, text::HoriOrientation::RIGHT, HORI_PAGE_REL},
171 : {SwFPos::CENTER_HORI, SwFPos::CENTER_HORI, text::HoriOrientation::CENTER, HORI_PAGE_REL},
172 : {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, HORI_PAGE_REL}
173 : };
174 :
175 : static FrmMap aHPageHtmlMap[] =
176 : {
177 : {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, LB_REL_PG_FRAME}
178 : };
179 :
180 : #define VERT_PAGE_REL (LB_REL_PG_FRAME|LB_REL_PG_PRTAREA)
181 :
182 : static FrmMap aVPageMap[] =
183 : {
184 : {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, VERT_PAGE_REL},
185 : {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::BOTTOM, VERT_PAGE_REL},
186 : {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CENTER, VERT_PAGE_REL},
187 : {SwFPos::FROMTOP, SwFPos::FROMTOP, text::VertOrientation::NONE, VERT_PAGE_REL}
188 : };
189 :
190 : static FrmMap aVPageHtmlMap[] =
191 : {
192 : {SwFPos::FROMTOP, SwFPos::FROMTOP, text::VertOrientation::NONE, LB_REL_PG_FRAME}
193 : };
194 :
195 : /*--------------------------------------------------------------------
196 : Description: frame anchored
197 : --------------------------------------------------------------------*/
198 : #define HORI_FRAME_REL (LB_FLY_REL_PG_FRAME|LB_FLY_REL_PG_PRTAREA| \
199 : LB_FLY_REL_PG_LEFT|LB_FLY_REL_PG_RIGHT)
200 :
201 : static FrmMap aHFrameMap[] =
202 : {
203 : {SwFPos::LEFT, SwFPos::MIR_LEFT, text::HoriOrientation::LEFT, HORI_FRAME_REL},
204 : {SwFPos::RIGHT, SwFPos::MIR_RIGHT, text::HoriOrientation::RIGHT, HORI_FRAME_REL},
205 : {SwFPos::CENTER_HORI, SwFPos::CENTER_HORI, text::HoriOrientation::CENTER, HORI_FRAME_REL},
206 : {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, HORI_FRAME_REL}
207 : };
208 :
209 : static FrmMap aHFlyHtmlMap[] =
210 : {
211 : {SwFPos::LEFT, SwFPos::MIR_LEFT, text::HoriOrientation::LEFT, LB_FLY_REL_PG_FRAME},
212 : {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, LB_FLY_REL_PG_FRAME}
213 : };
214 :
215 : // own vertical alignment map for objects anchored to frame
216 : #define VERT_FRAME_REL (LB_FLY_VERT_FRAME|LB_FLY_VERT_PRTAREA)
217 :
218 : static FrmMap aVFrameMap[] =
219 : {
220 : {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, VERT_FRAME_REL},
221 : {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::BOTTOM, VERT_FRAME_REL},
222 : {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CENTER, VERT_FRAME_REL},
223 : {SwFPos::FROMTOP, SwFPos::FROMTOP, text::VertOrientation::NONE, VERT_FRAME_REL}
224 : };
225 :
226 : static FrmMap aVFlyHtmlMap[] =
227 : {
228 : {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, LB_FLY_VERT_FRAME},
229 : {SwFPos::FROMTOP, SwFPos::FROMTOP, text::VertOrientation::NONE, LB_FLY_VERT_FRAME}
230 : };
231 :
232 : /*--------------------------------------------------------------------
233 : Description: paragraph anchored
234 : --------------------------------------------------------------------*/
235 : #define HORI_PARA_REL (LB_FRAME|LB_PRTAREA|LB_REL_PG_LEFT|LB_REL_PG_RIGHT| \
236 : LB_REL_PG_FRAME|LB_REL_PG_PRTAREA|LB_REL_FRM_LEFT| \
237 : LB_REL_FRM_RIGHT)
238 :
239 : static FrmMap aHParaMap[] =
240 : {
241 : {SwFPos::LEFT, SwFPos::MIR_LEFT, text::HoriOrientation::LEFT, HORI_PARA_REL},
242 : {SwFPos::RIGHT, SwFPos::MIR_RIGHT, text::HoriOrientation::RIGHT, HORI_PARA_REL},
243 : {SwFPos::CENTER_HORI, SwFPos::CENTER_HORI, text::HoriOrientation::CENTER, HORI_PARA_REL},
244 : {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, HORI_PARA_REL}
245 : };
246 :
247 : #define HTML_HORI_PARA_REL (LB_FRAME|LB_PRTAREA)
248 :
249 : static FrmMap aHParaHtmlMap[] =
250 : {
251 : {SwFPos::LEFT, SwFPos::LEFT, text::HoriOrientation::LEFT, HTML_HORI_PARA_REL},
252 : {SwFPos::RIGHT, SwFPos::RIGHT, text::HoriOrientation::RIGHT, HTML_HORI_PARA_REL}
253 : };
254 :
255 : static FrmMap aHParaHtmlAbsMap[] =
256 : {
257 : {SwFPos::LEFT, SwFPos::MIR_LEFT, text::HoriOrientation::LEFT, HTML_HORI_PARA_REL},
258 : {SwFPos::RIGHT, SwFPos::MIR_RIGHT, text::HoriOrientation::RIGHT, HTML_HORI_PARA_REL}
259 : };
260 :
261 : // allow vertical alignment at page areas
262 : #define VERT_PARA_REL (LB_VERT_FRAME|LB_VERT_PRTAREA| \
263 : LB_REL_PG_FRAME|LB_REL_PG_PRTAREA)
264 :
265 : static FrmMap aVParaMap[] =
266 : {
267 : {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, VERT_PARA_REL},
268 : {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::BOTTOM, VERT_PARA_REL},
269 : {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CENTER, VERT_PARA_REL},
270 : {SwFPos::FROMTOP, SwFPos::FROMTOP, text::VertOrientation::NONE, VERT_PARA_REL}
271 : };
272 :
273 : static FrmMap aVParaHtmlMap[] =
274 : {
275 : {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, LB_VERT_PRTAREA}
276 : };
277 :
278 : /*--------------------------------------------------------------------
279 : Description: anchored relative to the character
280 : --------------------------------------------------------------------*/
281 : #define HORI_CHAR_REL (LB_FRAME|LB_PRTAREA|LB_REL_PG_LEFT|LB_REL_PG_RIGHT| \
282 : LB_REL_PG_FRAME|LB_REL_PG_PRTAREA|LB_REL_FRM_LEFT| \
283 : LB_REL_FRM_RIGHT|LB_REL_CHAR)
284 :
285 : static FrmMap aHCharMap[] =
286 : {
287 : {SwFPos::LEFT, SwFPos::MIR_LEFT, text::HoriOrientation::LEFT, HORI_CHAR_REL},
288 : {SwFPos::RIGHT, SwFPos::MIR_RIGHT, text::HoriOrientation::RIGHT, HORI_CHAR_REL},
289 : {SwFPos::CENTER_HORI, SwFPos::CENTER_HORI, text::HoriOrientation::CENTER, HORI_CHAR_REL},
290 : {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, HORI_CHAR_REL}
291 : };
292 :
293 : #define HTML_HORI_CHAR_REL (LB_FRAME|LB_PRTAREA|LB_REL_CHAR)
294 :
295 : static FrmMap aHCharHtmlMap[] =
296 : {
297 : {SwFPos::LEFT, SwFPos::LEFT, text::HoriOrientation::LEFT, HTML_HORI_CHAR_REL},
298 : {SwFPos::RIGHT, SwFPos::RIGHT, text::HoriOrientation::RIGHT, HTML_HORI_CHAR_REL}
299 : };
300 :
301 : static FrmMap aHCharHtmlAbsMap[] =
302 : {
303 : {SwFPos::LEFT, SwFPos::MIR_LEFT, text::HoriOrientation::LEFT, LB_PRTAREA|LB_REL_CHAR},
304 : {SwFPos::RIGHT, SwFPos::MIR_RIGHT, text::HoriOrientation::RIGHT, LB_PRTAREA},
305 : {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, LB_REL_PG_FRAME}
306 : };
307 :
308 : // allow vertical alignment at page areas
309 : #define VERT_CHAR_REL (LB_VERT_FRAME|LB_VERT_PRTAREA| \
310 : LB_REL_PG_FRAME|LB_REL_PG_PRTAREA)
311 :
312 : static FrmMap aVCharMap[] =
313 : {
314 : // introduce mappings for new vertical alignment at top of line <LB_VERT_LINE>
315 : // and correct mapping for vertical alignment at character for position <FROM_BOTTOM>
316 : // Note: Because of these adjustments the map becomes ambigous in its values
317 : // <eStrId>/<eMirrorStrId> and <nAlign>. These ambiguities are considered
318 : // in the methods <SwFrmPage::FillRelLB(..)>, <SwFrmPage::GetAlignment(..)>
319 : // and <SwFrmPage::FillPosLB(..)>
320 : {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, VERT_CHAR_REL|LB_REL_CHAR},
321 : {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::BOTTOM, VERT_CHAR_REL|LB_REL_CHAR},
322 : {SwFPos::BELOW, SwFPos::BELOW, text::VertOrientation::CHAR_BOTTOM, LB_REL_CHAR},
323 : {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CENTER, VERT_CHAR_REL|LB_REL_CHAR},
324 : {SwFPos::FROMTOP, SwFPos::FROMTOP, text::VertOrientation::NONE, VERT_CHAR_REL},
325 : {SwFPos::FROMBOTTOM, SwFPos::FROMBOTTOM, text::VertOrientation::NONE, LB_REL_CHAR|LB_VERT_LINE},
326 : {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::LINE_TOP, LB_VERT_LINE},
327 : {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::LINE_BOTTOM, LB_VERT_LINE},
328 : {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::LINE_CENTER, LB_VERT_LINE}
329 : };
330 :
331 : static FrmMap aVCharHtmlMap[] =
332 : {
333 : {SwFPos::BELOW, SwFPos::BELOW, text::VertOrientation::CHAR_BOTTOM, LB_REL_CHAR}
334 : };
335 :
336 : static FrmMap aVCharHtmlAbsMap[] =
337 : {
338 : {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, LB_REL_CHAR},
339 : {SwFPos::BELOW, SwFPos::BELOW, text::VertOrientation::CHAR_BOTTOM, LB_REL_CHAR}
340 : };
341 :
342 : /*--------------------------------------------------------------------
343 : Description: anchored as character
344 : --------------------------------------------------------------------*/
345 : static FrmMap aVAsCharMap[] =
346 : {
347 : {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, LB_REL_BASE},
348 : {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::BOTTOM, LB_REL_BASE},
349 : {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CENTER, LB_REL_BASE},
350 :
351 : {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::CHAR_TOP, LB_REL_CHAR},
352 : {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::CHAR_BOTTOM, LB_REL_CHAR},
353 : {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CHAR_CENTER, LB_REL_CHAR},
354 :
355 : {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::LINE_TOP, LB_REL_ROW},
356 : {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::LINE_BOTTOM, LB_REL_ROW},
357 : {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::LINE_CENTER, LB_REL_ROW},
358 :
359 : {SwFPos::FROMBOTTOM, SwFPos::FROMBOTTOM, text::VertOrientation::NONE, LB_REL_BASE}
360 : };
361 :
362 : static FrmMap aVAsCharHtmlMap[] =
363 : {
364 : {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, LB_REL_BASE},
365 : {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CENTER, LB_REL_BASE},
366 :
367 : {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::CHAR_TOP, LB_REL_CHAR},
368 :
369 : {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::LINE_TOP, LB_REL_ROW},
370 : {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::LINE_BOTTOM, LB_REL_ROW},
371 : {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::LINE_CENTER, LB_REL_ROW}
372 : };
373 :
374 : static sal_uInt16 aPageRg[] = {
375 : RES_FRM_SIZE, RES_FRM_SIZE,
376 : RES_VERT_ORIENT, RES_ANCHOR,
377 : RES_COL, RES_COL,
378 : RES_FOLLOW_TEXT_FLOW, RES_FOLLOW_TEXT_FLOW,
379 : 0
380 : };
381 : static sal_uInt16 aAddPgRg[] = {
382 : RES_PROTECT, RES_PROTECT,
383 : RES_PRINT, RES_PRINT,
384 : FN_SET_FRM_NAME, FN_SET_FRM_NAME,
385 : FN_SET_FRM_ALT_NAME, FN_SET_FRM_ALT_NAME,
386 : 0
387 : };
388 :
389 0 : static size_t lcl_GetFrmMapCount( const FrmMap* pMap)
390 : {
391 0 : if ( pMap )
392 : {
393 0 : if( pMap == aVParaHtmlMap)
394 0 : return SAL_N_ELEMENTS(aVParaHtmlMap);
395 0 : if( pMap == aVAsCharHtmlMap)
396 0 : return SAL_N_ELEMENTS(aVAsCharHtmlMap);
397 0 : if( pMap == aHParaHtmlMap)
398 0 : return SAL_N_ELEMENTS(aHParaHtmlMap);
399 0 : if( pMap == aHParaHtmlAbsMap)
400 0 : return SAL_N_ELEMENTS(aHParaHtmlAbsMap);
401 0 : if ( pMap == aVPageMap )
402 0 : return SAL_N_ELEMENTS(aVPageMap);
403 0 : if ( pMap == aVPageHtmlMap )
404 0 : return SAL_N_ELEMENTS(aVPageHtmlMap);
405 0 : if ( pMap == aVAsCharMap )
406 0 : return SAL_N_ELEMENTS(aVAsCharMap);
407 0 : if ( pMap == aVParaMap )
408 0 : return SAL_N_ELEMENTS(aVParaMap);
409 0 : if ( pMap == aHParaMap )
410 0 : return SAL_N_ELEMENTS(aHParaMap);
411 0 : if ( pMap == aHFrameMap )
412 0 : return SAL_N_ELEMENTS(aHFrameMap);
413 0 : if ( pMap == aVFrameMap )
414 0 : return SAL_N_ELEMENTS(aVFrameMap);
415 0 : if ( pMap == aHCharMap )
416 0 : return SAL_N_ELEMENTS(aHCharMap);
417 0 : if ( pMap == aHCharHtmlMap )
418 0 : return SAL_N_ELEMENTS(aHCharHtmlMap);
419 0 : if ( pMap == aHCharHtmlAbsMap )
420 0 : return SAL_N_ELEMENTS(aHCharHtmlAbsMap);
421 0 : if ( pMap == aVCharMap )
422 0 : return SAL_N_ELEMENTS(aVCharMap);
423 0 : if ( pMap == aVCharHtmlMap )
424 0 : return SAL_N_ELEMENTS(aVCharHtmlMap);
425 0 : if ( pMap == aVCharHtmlAbsMap )
426 0 : return SAL_N_ELEMENTS(aVCharHtmlAbsMap);
427 0 : if ( pMap == aHPageHtmlMap )
428 0 : return SAL_N_ELEMENTS(aHPageHtmlMap);
429 0 : if ( pMap == aHFlyHtmlMap )
430 0 : return SAL_N_ELEMENTS(aHFlyHtmlMap);
431 0 : if ( pMap == aVFlyHtmlMap )
432 0 : return SAL_N_ELEMENTS(aVFlyHtmlMap);
433 0 : return SAL_N_ELEMENTS(aHPageMap);
434 : }
435 0 : return 0;
436 : }
437 :
438 0 : static void lcl_InsertVectors(ListBox& rBox,
439 : const ::std::vector< OUString >& rPrev, const ::std::vector< OUString >& rThis,
440 : const ::std::vector< OUString >& rNext, const ::std::vector< OUString >& rRemain)
441 : {
442 0 : ::std::vector< OUString >::const_iterator aIt;
443 0 : sal_Int32 nEntry = 0;
444 0 : for(aIt = rPrev.begin(); aIt != rPrev.end(); ++aIt)
445 0 : nEntry = rBox.InsertEntry(*aIt);
446 0 : for(aIt = rThis.begin(); aIt != rThis.end(); ++aIt)
447 0 : nEntry = rBox.InsertEntry(*aIt);
448 0 : for(aIt = rNext.begin(); aIt != rNext.end(); ++aIt)
449 0 : nEntry = rBox.InsertEntry(*aIt);
450 0 : rBox.SetSeparatorPos(nEntry);
451 : //now insert all strings sorted
452 0 : const sal_Int32 nStartPos = rBox.GetEntryCount();
453 :
454 0 : for(aIt = rPrev.begin(); aIt != rPrev.end(); ++aIt)
455 0 : ::InsertStringSorted(*aIt, rBox, nStartPos );
456 0 : for(aIt = rThis.begin(); aIt != rThis.end(); ++aIt)
457 0 : ::InsertStringSorted(*aIt, rBox, nStartPos );
458 0 : for(aIt = rNext.begin(); aIt != rNext.end(); ++aIt)
459 0 : ::InsertStringSorted(*aIt, rBox, nStartPos );
460 0 : for(aIt = rRemain.begin(); aIt != rRemain.end(); ++aIt)
461 0 : ::InsertStringSorted(*aIt, rBox, nStartPos );
462 0 : }
463 :
464 : // --> OD 2009-08-31 #mongolianlayout#
465 : // add input parameter
466 0 : static SvxSwFramePosString::StringId lcl_ChangeResIdToVerticalOrRTL(SvxSwFramePosString::StringId eStringId, bool bVertical, sal_Bool bVerticalL2R, sal_Bool bRTL)
467 : {
468 : //special handling of STR_FROMLEFT
469 0 : if ( SwFPos::FROMLEFT == eStringId )
470 : {
471 : eStringId = bVertical
472 : ? ( bRTL
473 : ? SwFPos::FROMBOTTOM
474 : : SwFPos::FROMTOP )
475 : : ( bRTL
476 : ? SwFPos::FROMRIGHT
477 0 : : SwFPos::FROMLEFT );
478 0 : return eStringId;
479 : }
480 : // --> OD 2009-08-31 #mongolianlayout#
481 : // special handling of STR_FROMTOP in case of mongolianlayout (vertical left-to-right)
482 0 : if ( SwFPos::FROMTOP == eStringId &&
483 0 : bVertical && bVerticalL2R )
484 : {
485 0 : eStringId = SwFPos::FROMLEFT;
486 0 : return eStringId;
487 : }
488 0 : if ( bVertical )
489 : {
490 : //exchange horizontal strings with vertical strings and vice versa
491 : static const StringIdPair_Impl aHoriIds[] =
492 : {
493 : {SwFPos::LEFT, SwFPos::TOP},
494 : {SwFPos::RIGHT, SwFPos::BOTTOM},
495 : {SwFPos::CENTER_HORI, SwFPos::CENTER_VERT},
496 : {SwFPos::FROMTOP, SwFPos::FROMRIGHT},
497 : {SwFPos::REL_PG_LEFT, SwFPos::REL_PG_TOP},
498 : {SwFPos::REL_PG_RIGHT, SwFPos::REL_PG_BOTTOM} ,
499 : {SwFPos::REL_FRM_LEFT, SwFPos::REL_FRM_TOP},
500 : {SwFPos::REL_FRM_RIGHT, SwFPos::REL_FRM_BOTTOM}
501 : };
502 : static const StringIdPair_Impl aVertIds[] =
503 : {
504 : {SwFPos::TOP, SwFPos::RIGHT},
505 : {SwFPos::BOTTOM, SwFPos::LEFT },
506 : {SwFPos::CENTER_VERT, SwFPos::CENTER_HORI},
507 : {SwFPos::FROMTOP, SwFPos::FROMRIGHT },
508 : {SwFPos::REL_PG_TOP, SwFPos::REL_PG_LEFT },
509 : {SwFPos::REL_PG_BOTTOM, SwFPos::REL_PG_RIGHT } ,
510 : {SwFPos::REL_FRM_TOP, SwFPos::REL_FRM_LEFT },
511 : {SwFPos::REL_FRM_BOTTOM, SwFPos::REL_FRM_RIGHT }
512 : };
513 : // --> OD 2009-08-31 #monglianlayout#
514 : static const StringIdPair_Impl aVertL2RIds[] =
515 : {
516 : {SwFPos::TOP, SwFPos::LEFT },
517 : {SwFPos::BOTTOM, SwFPos::RIGHT },
518 : {SwFPos::CENTER_VERT, SwFPos::CENTER_HORI },
519 : {SwFPos::FROMTOP, SwFPos::FROMLEFT },
520 : {SwFPos::REL_PG_TOP, SwFPos::REL_PG_LEFT },
521 : {SwFPos::REL_PG_BOTTOM, SwFPos::REL_PG_RIGHT } ,
522 : {SwFPos::REL_FRM_TOP, SwFPos::REL_FRM_LEFT },
523 : {SwFPos::REL_FRM_BOTTOM, SwFPos::REL_FRM_RIGHT }
524 : };
525 0 : for(size_t nIndex = 0; nIndex < SAL_N_ELEMENTS(aHoriIds); ++nIndex)
526 : {
527 0 : if(aHoriIds[nIndex].eHori == eStringId)
528 : {
529 0 : eStringId = aHoriIds[nIndex].eVert;
530 0 : return eStringId;
531 : }
532 : }
533 0 : for(size_t nIndex = 0; nIndex < SAL_N_ELEMENTS(aVertIds); ++nIndex)
534 : {
535 : // --> OD 2009-08-31 #mongolianlayout#
536 0 : if ( !bVerticalL2R )
537 : {
538 0 : if(aVertIds[nIndex].eHori == eStringId)
539 : {
540 0 : eStringId = aVertIds[nIndex].eVert;
541 0 : break;
542 : }
543 : }
544 : else
545 : {
546 0 : if(aVertL2RIds[nIndex].eHori == eStringId)
547 : {
548 0 : eStringId = aVertL2RIds[nIndex].eVert;
549 0 : break;
550 : }
551 : }
552 : }
553 : }
554 0 : return eStringId;
555 : }
556 :
557 : // helper method in order to determine all possible
558 : // listbox relations in a relation map for a given relation
559 0 : static sal_uLong lcl_GetLBRelationsForRelations( const sal_Int16 _nRel )
560 : {
561 0 : sal_uLong nLBRelations = 0L;
562 :
563 0 : const size_t nRelMapSize = SAL_N_ELEMENTS(aRelationMap);
564 0 : for ( size_t nRelMapPos = 0; nRelMapPos < nRelMapSize; ++nRelMapPos )
565 : {
566 0 : if ( aRelationMap[nRelMapPos].nRelation == _nRel )
567 : {
568 0 : nLBRelations |= aRelationMap[nRelMapPos].nLBRelation;
569 : }
570 : }
571 :
572 0 : return nLBRelations;
573 : }
574 :
575 : // helper method on order to determine all possible
576 : // listbox relations in a relation map for a given string ID
577 0 : static sal_uLong lcl_GetLBRelationsForStrID( const FrmMap* _pMap,
578 : const SvxSwFramePosString::StringId _eStrId,
579 : const bool _bUseMirrorStr )
580 : {
581 0 : sal_uLong nLBRelations = 0L;
582 :
583 0 : size_t nRelMapSize = lcl_GetFrmMapCount( _pMap );
584 0 : for ( size_t nRelMapPos = 0; nRelMapPos < nRelMapSize; ++nRelMapPos )
585 : {
586 0 : if ( ( !_bUseMirrorStr && _pMap[nRelMapPos].eStrId == _eStrId ) ||
587 0 : ( _bUseMirrorStr && _pMap[nRelMapPos].eMirrorStrId == _eStrId ) )
588 : {
589 0 : nLBRelations |= _pMap[nRelMapPos].nLBRelations;
590 : }
591 : }
592 :
593 0 : return nLBRelations;
594 : }
595 :
596 : /*--------------------------------------------------------------------
597 : Description: standard frame TabPage
598 : --------------------------------------------------------------------*/
599 : namespace
600 : {
601 0 : void HandleAutoCB( sal_Bool _bChecked, FixedText& _rFT_man, FixedText& _rFT_auto, MetricField& _rPF_Edit)
602 : {
603 0 : _rFT_man.Show( !_bChecked );
604 0 : _rFT_auto.Show( _bChecked );
605 0 : OUString accName = _bChecked ? _rFT_auto.GetText() : _rFT_man.GetText();
606 0 : _rPF_Edit.SetAccessibleName(accName);
607 0 : }
608 : }
609 :
610 0 : SwFrmPage::SwFrmPage(Window *pParent, const SfxItemSet &rSet)
611 : : SfxTabPage(pParent, "FrmTypePage",
612 : "modules/swriter/ui/frmtypepage.ui", rSet)
613 : ,
614 : bAtHorzPosModified( sal_False ),
615 : bAtVertPosModified( sal_False ),
616 : bFormat(sal_False),
617 : bNew(sal_True),
618 : bNoModifyHdl(sal_True),
619 : // --> OD 2009-08-31 #mongolianlayout# - no used
620 : // bVerticalChanged(sal_False),
621 : bIsVerticalFrame(false),
622 : bIsVerticalL2R(sal_False),
623 : bIsInRightToLeft(sal_False),
624 : bHtmlMode(sal_False),
625 : nHtmlMode(0),
626 : nUpperBorder(0),
627 : nLowerBorder(0),
628 : fWidthHeightRatio(1.0),
629 : mpToCharCntntPos( NULL ),
630 :
631 : nOldH(text::HoriOrientation::CENTER),
632 : nOldHRel(text::RelOrientation::FRAME),
633 : nOldV(text::VertOrientation::TOP),
634 : nOldVRel(text::RelOrientation::PRINT_AREA),
635 : pVMap( 0 ),
636 : pHMap( 0 ),
637 : m_bAllowVertPositioning( true ),
638 : m_bIsMathOLE( false ),
639 0 : m_bIsMathBaselineAlignment( true )
640 : {
641 0 : get(m_pWidthFT, "widthft");
642 0 : get(m_pWidthAutoFT, "autowidthft");
643 0 : m_aWidthED.set(get<MetricField>("width"));
644 0 : get(m_pRelWidthCB, "relwidth");
645 0 : get(m_pRelWidthRelationLB, "relwidthrelation");
646 0 : get(m_pAutoWidthCB, "autowidth");
647 :
648 0 : get(m_pHeightFT, "heightft");
649 0 : get(m_pHeightAutoFT, "autoheightft");
650 0 : m_aHeightED.set(get<MetricField>("height"));
651 0 : get(m_pRelHeightCB, "relheight");
652 0 : get(m_pRelHeightRelationLB, "relheightrelation");
653 0 : get(m_pAutoHeightCB, "autoheight");
654 :
655 0 : get(m_pFixedRatioCB, "ratio");
656 0 : get(m_pRealSizeBT, "origsize");
657 :
658 0 : get(m_pAnchorFrame, "anchorframe");
659 0 : get(m_pAnchorAtPageRB, "topage");
660 0 : get(m_pAnchorAtParaRB, "topara");
661 0 : get(m_pAnchorAtCharRB, "tochar");
662 0 : get(m_pAnchorAsCharRB, "aschar");
663 0 : get(m_pAnchorAtFrameRB, "toframe");
664 :
665 0 : get(m_pHorizontalFT, "horiposft");
666 0 : get(m_pHorizontalDLB, "horipos");
667 0 : get(m_pAtHorzPosFT, "horibyft");
668 0 : get(m_pAtHorzPosED, "byhori");
669 0 : get(m_pHoriRelationFT, "horitoft");
670 0 : get(m_pHoriRelationLB, "horianchor");
671 :
672 0 : get(m_pMirrorPagesCB, "mirror");
673 :
674 0 : get(m_pVerticalFT, "vertposft");
675 0 : get(m_pVerticalDLB, "vertpos");
676 0 : get(m_pAtVertPosFT, "vertbyft");
677 0 : get(m_pAtVertPosED, "byvert");
678 0 : get(m_pVertRelationFT, "verttoft");
679 0 : get(m_pVertRelationLB, "vertanchor");
680 :
681 0 : get(m_pFollowTextFlowCB, "followtextflow");
682 0 : get(m_pExampleWN, "preview");
683 :
684 0 : m_pAtHorzPosED->set_width_request(m_pAtHorzPosED->GetOptimalSize().Width());
685 0 : m_pAtHorzPosED->set_width_request(m_pAtVertPosED->GetOptimalSize().Width());
686 :
687 0 : setOptimalFrmWidth();
688 0 : setOptimalRelWidth();
689 :
690 0 : SetExchangeSupport();
691 :
692 0 : Link aLk = LINK(this, SwFrmPage, RangeModifyHdl);
693 0 : m_aWidthED.SetLoseFocusHdl( aLk );
694 0 : m_aHeightED.SetLoseFocusHdl( aLk );
695 0 : m_pAtHorzPosED->SetLoseFocusHdl( aLk );
696 0 : m_pAtVertPosED->SetLoseFocusHdl( aLk );
697 0 : m_pFollowTextFlowCB->SetClickHdl( aLk );
698 :
699 0 : aLk = LINK(this, SwFrmPage, ModifyHdl);
700 0 : m_aWidthED.SetModifyHdl( aLk );
701 0 : m_aHeightED.SetModifyHdl( aLk );
702 0 : m_pAtHorzPosED->SetModifyHdl( aLk );
703 0 : m_pAtVertPosED->SetModifyHdl( aLk );
704 :
705 0 : aLk = LINK(this, SwFrmPage, AnchorTypeHdl);
706 0 : m_pAnchorAtPageRB->SetClickHdl( aLk );
707 0 : m_pAnchorAtParaRB->SetClickHdl( aLk );
708 0 : m_pAnchorAtCharRB->SetClickHdl( aLk );
709 0 : m_pAnchorAsCharRB->SetClickHdl( aLk );
710 0 : m_pAnchorAtFrameRB->SetClickHdl( aLk );
711 :
712 0 : m_pHorizontalDLB->SetSelectHdl(LINK(this, SwFrmPage, PosHdl));
713 0 : m_pVerticalDLB-> SetSelectHdl(LINK(this, SwFrmPage, PosHdl));
714 :
715 0 : m_pHoriRelationLB->SetSelectHdl(LINK(this, SwFrmPage, RelHdl));
716 0 : m_pVertRelationLB->SetSelectHdl(LINK(this, SwFrmPage, RelHdl));
717 :
718 0 : m_pMirrorPagesCB->SetClickHdl(LINK(this, SwFrmPage, MirrorHdl));
719 :
720 0 : aLk = LINK(this, SwFrmPage, RelSizeClickHdl);
721 0 : m_pRelWidthCB->SetClickHdl( aLk );
722 0 : m_pRelHeightCB->SetClickHdl( aLk );
723 :
724 0 : m_pAutoWidthCB->SetClickHdl( LINK( this, SwFrmPage, AutoWidthClickHdl ) );
725 0 : m_pAutoHeightCB->SetClickHdl( LINK( this, SwFrmPage, AutoHeightClickHdl ) );
726 0 : }
727 :
728 : namespace
729 : {
730 : struct FrmMaps
731 : {
732 : FrmMap *pMap;
733 : size_t nCount;
734 : };
735 : }
736 :
737 0 : void SwFrmPage::setOptimalFrmWidth()
738 : {
739 : const FrmMaps aMaps[] = {
740 : { aHPageMap, SAL_N_ELEMENTS(aHPageMap) },
741 : { aHPageHtmlMap, SAL_N_ELEMENTS(aHPageHtmlMap) },
742 : { aVPageMap, SAL_N_ELEMENTS(aVPageMap) },
743 : { aVPageHtmlMap, SAL_N_ELEMENTS(aVPageHtmlMap) },
744 : { aHFrameMap, SAL_N_ELEMENTS(aHFrameMap) },
745 : { aHFlyHtmlMap, SAL_N_ELEMENTS(aHFlyHtmlMap) },
746 : { aVFrameMap, SAL_N_ELEMENTS(aVFrameMap) },
747 : { aVFlyHtmlMap, SAL_N_ELEMENTS(aVFrameMap) },
748 : { aHParaMap, SAL_N_ELEMENTS(aHParaMap) },
749 : { aHParaHtmlMap, SAL_N_ELEMENTS(aHParaHtmlMap) },
750 : { aHParaHtmlAbsMap, SAL_N_ELEMENTS(aHParaHtmlAbsMap) },
751 : { aVParaMap, SAL_N_ELEMENTS(aVParaMap) },
752 : { aVParaHtmlMap, SAL_N_ELEMENTS(aVParaHtmlMap) },
753 : { aHCharMap, SAL_N_ELEMENTS(aHCharMap) },
754 : { aHCharHtmlMap, SAL_N_ELEMENTS(aHCharHtmlMap) },
755 : { aHCharHtmlAbsMap, SAL_N_ELEMENTS(aHCharHtmlAbsMap) },
756 : { aVCharMap, SAL_N_ELEMENTS(aVCharMap) },
757 : { aVCharHtmlMap, SAL_N_ELEMENTS(aVCharHtmlMap) },
758 : { aVCharHtmlAbsMap, SAL_N_ELEMENTS(aVCharHtmlAbsMap) },
759 : { aVAsCharMap, SAL_N_ELEMENTS(aVAsCharMap) },
760 : { aVAsCharHtmlMap, SAL_N_ELEMENTS(aVAsCharHtmlMap) }
761 0 : };
762 :
763 0 : std::vector<SvxSwFramePosString::StringId> aFrames;
764 0 : for (size_t i = 0; i < SAL_N_ELEMENTS(aMaps); ++i)
765 : {
766 0 : for (size_t j = 0; j < aMaps[i].nCount; ++j)
767 : {
768 0 : aFrames.push_back(aMaps[i].pMap[j].eStrId);
769 0 : aFrames.push_back(aMaps[i].pMap[j].eMirrorStrId);
770 : }
771 : }
772 :
773 0 : std::sort(aFrames.begin(), aFrames.end());
774 0 : aFrames.erase(std::unique(aFrames.begin(), aFrames.end()), aFrames.end());
775 :
776 0 : for (std::vector<SvxSwFramePosString::StringId>::const_iterator aI = aFrames.begin(), aEnd = aFrames.end();
777 : aI != aEnd; ++aI)
778 : {
779 0 : m_pHorizontalDLB->InsertEntry(aFramePosString.GetString(*aI));
780 : }
781 :
782 0 : Size aBiggest(m_pHorizontalDLB->GetOptimalSize());
783 0 : m_pHorizontalDLB->set_width_request(aBiggest.Width());
784 0 : m_pVerticalDLB->set_width_request(aBiggest.Width());
785 0 : m_pHorizontalDLB->Clear();
786 0 : }
787 :
788 : namespace
789 : {
790 : struct RelationMaps
791 : {
792 : RelationMap *pMap;
793 : size_t nCount;
794 : };
795 : }
796 :
797 0 : void SwFrmPage::setOptimalRelWidth()
798 : {
799 : const RelationMaps aMaps[] = {
800 : { aRelationMap, SAL_N_ELEMENTS(aRelationMap) },
801 : { aAsCharRelationMap, SAL_N_ELEMENTS(aAsCharRelationMap) }
802 0 : };
803 :
804 0 : std::vector<SvxSwFramePosString::StringId> aRels;
805 0 : for (size_t i = 0; i < SAL_N_ELEMENTS(aMaps); ++i)
806 : {
807 0 : for (size_t j = 0; j < aMaps[i].nCount; ++j)
808 : {
809 0 : aRels.push_back(aMaps[i].pMap[j].eStrId);
810 0 : aRels.push_back(aMaps[i].pMap[j].eMirrorStrId);
811 : }
812 : }
813 :
814 0 : std::sort(aRels.begin(), aRels.end());
815 0 : aRels.erase(std::unique(aRels.begin(), aRels.end()), aRels.end());
816 :
817 0 : for (std::vector<SvxSwFramePosString::StringId>::const_iterator aI = aRels.begin(), aEnd = aRels.end();
818 : aI != aEnd; ++aI)
819 : {
820 0 : m_pHoriRelationLB->InsertEntry(aFramePosString.GetString(*aI));
821 : }
822 :
823 0 : Size aBiggest(m_pHoriRelationLB->GetOptimalSize());
824 0 : m_pHoriRelationLB->set_width_request(aBiggest.Width());
825 0 : m_pVertRelationLB->set_width_request(aBiggest.Width());
826 0 : m_pRelWidthRelationLB->set_width_request(aBiggest.Width());
827 0 : m_pRelHeightRelationLB->set_width_request(aBiggest.Width());
828 0 : m_pHoriRelationLB->Clear();
829 0 : }
830 :
831 0 : SwFrmPage::~SwFrmPage()
832 : {
833 0 : }
834 :
835 0 : SfxTabPage* SwFrmPage::Create(Window *pParent, const SfxItemSet &rSet)
836 : {
837 0 : return new SwFrmPage( pParent, rSet );
838 : }
839 :
840 0 : void SwFrmPage::EnableGraficMode( void )
841 : {
842 : // i#39692 - mustn't be called more than once
843 0 : if(!m_pRealSizeBT->IsVisible())
844 : {
845 0 : m_pWidthFT->Show();
846 0 : m_pWidthAutoFT->Hide();
847 0 : m_pAutoHeightCB->Hide();
848 :
849 0 : m_pHeightFT->Show();
850 0 : m_pHeightAutoFT->Hide();
851 0 : m_pAutoWidthCB->Hide();
852 :
853 0 : m_pRealSizeBT->Show();
854 : }
855 0 : }
856 :
857 0 : SwWrtShell *SwFrmPage::getFrmDlgParentShell()
858 : {
859 0 : return ((SwFrmDlg*)GetParentDialog())->GetWrtShell();
860 : }
861 :
862 0 : void SwFrmPage::Reset( const SfxItemSet &rSet )
863 : {
864 : SwWrtShell* pSh = bFormat ? ::GetActiveWrtShell() :
865 0 : getFrmDlgParentShell();
866 :
867 0 : nHtmlMode = ::GetHtmlMode(pSh->GetView().GetDocShell());
868 0 : bHtmlMode = nHtmlMode & HTMLMODE_ON ? sal_True : sal_False;
869 :
870 0 : FieldUnit aMetric = ::GetDfltMetric(bHtmlMode);
871 0 : m_aWidthED.SetMetric(aMetric);
872 0 : m_aHeightED.SetMetric(aMetric);
873 0 : SetMetric( *m_pAtHorzPosED, aMetric );
874 0 : SetMetric( *m_pAtVertPosED, aMetric );
875 :
876 0 : const SfxPoolItem* pItem = NULL;
877 0 : const SwFmtAnchor& rAnchor = (const SwFmtAnchor&)rSet.Get(RES_ANCHOR);
878 :
879 0 : if (SFX_ITEM_SET == rSet.GetItemState(FN_OLE_IS_MATH, false, &pItem))
880 0 : m_bIsMathOLE = ((const SfxBoolItem*)pItem)->GetValue();
881 0 : if (SFX_ITEM_SET == rSet.GetItemState(FN_MATH_BASELINE_ALIGNMENT, false, &pItem))
882 0 : m_bIsMathBaselineAlignment = ((const SfxBoolItem*)pItem)->GetValue();
883 0 : EnableVerticalPositioning( !(m_bIsMathOLE && m_bIsMathBaselineAlignment
884 0 : && FLY_AS_CHAR == rAnchor.GetAnchorId()) );
885 :
886 0 : if (bFormat)
887 : {
888 : // at formats no anchor editing
889 0 : m_pAnchorFrame->Enable(false);
890 0 : m_pFixedRatioCB->Enable(false);
891 : }
892 : else
893 : {
894 0 : if (rAnchor.GetAnchorId() != FLY_AT_FLY && !pSh->IsFlyInFly())
895 0 : m_pAnchorAtFrameRB->Hide();
896 : // --> OD 2009-08-31 #mongolianlayout#
897 : // if ( !bVerticalChanged && pSh->IsFrmVertical(sal_True, bIsInRightToLeft) )
898 0 : if ( pSh->IsFrmVertical( sal_True, bIsInRightToLeft, bIsVerticalL2R ) )
899 : {
900 0 : OUString sHLabel = m_pHorizontalFT->GetText();
901 0 : m_pHorizontalFT->SetText(m_pVerticalFT->GetText());
902 0 : m_pVerticalFT->SetText(sHLabel);
903 0 : bIsVerticalFrame = true;
904 : }
905 : }
906 :
907 0 : if ( sDlgType == "PictureDialog" || sDlgType == "ObjectDialog" )
908 : {
909 : OSL_ENSURE(pSh , "shell not found");
910 : //OS: only for the variant Insert/Graphic/Properties
911 0 : if(SFX_ITEM_SET == rSet.GetItemState(FN_PARAM_GRF_REALSIZE, false, &pItem))
912 0 : aGrfSize = ((const SvxSizeItem*)pItem)->GetSize();
913 : else
914 0 : pSh->GetGrfSize( aGrfSize );
915 :
916 0 : if ( !bNew )
917 : {
918 0 : m_pRealSizeBT->SetClickHdl(LINK(this, SwFrmPage, RealSizeHdl));
919 0 : EnableGraficMode();
920 : }
921 :
922 0 : if ( sDlgType == "PictureDialog" )
923 0 : m_pFixedRatioCB->Check( false );
924 : else
925 : {
926 0 : if ( bNew )
927 0 : SetText( SW_RESSTR(STR_OLE_INSERT));
928 : else
929 0 : SetText( SW_RESSTR(STR_OLE_EDIT));
930 : }
931 : }
932 : else
933 : {
934 0 : aGrfSize = ((const SwFmtFrmSize&)rSet.Get(RES_FRM_SIZE)).GetSize();
935 : }
936 :
937 : // entering procent value made possible
938 0 : m_aWidthED.SetBaseValue( m_aWidthED.Normalize(aGrfSize.Width()), FUNIT_TWIP );
939 0 : m_aHeightED.SetBaseValue( m_aHeightED.Normalize(aGrfSize.Height()), FUNIT_TWIP );
940 : //the available space is not yet known so the RefValue has to be calculated from size and relative size values
941 : //this is needed only if relative values are already set
942 :
943 0 : const SwFmtFrmSize& rFrmSize = (const SwFmtFrmSize&)rSet.Get(RES_FRM_SIZE);
944 :
945 0 : m_pRelWidthRelationLB->InsertEntry(aFramePosString.GetString(SwFPos::FRAME));
946 0 : m_pRelWidthRelationLB->InsertEntry(aFramePosString.GetString(SwFPos::REL_PG_FRAME));
947 0 : if (rFrmSize.GetWidthPercent() != 0xff && rFrmSize.GetWidthPercent() != 0)
948 : {
949 : //calculate the rerference value from the with and relative width values
950 0 : sal_Int32 nSpace = rFrmSize.GetWidth() * 100 / rFrmSize.GetWidthPercent();
951 0 : m_aWidthED.SetRefValue( nSpace );
952 :
953 0 : m_pRelWidthRelationLB->Enable();
954 : }
955 : else
956 0 : m_pRelWidthRelationLB->Disable();
957 :
958 0 : m_pRelHeightRelationLB->InsertEntry(aFramePosString.GetString(SwFPos::FRAME));
959 0 : m_pRelHeightRelationLB->InsertEntry(aFramePosString.GetString(SwFPos::REL_PG_FRAME));
960 0 : if (rFrmSize.GetHeightPercent() != 0xff && rFrmSize.GetHeightPercent() != 0)
961 : {
962 : //calculate the rerference value from the with and relative width values
963 0 : sal_Int32 nSpace = rFrmSize.GetHeight() * 100 / rFrmSize.GetHeightPercent();
964 0 : m_aHeightED.SetRefValue( nSpace );
965 :
966 0 : m_pRelHeightRelationLB->Enable();
967 : }
968 : else
969 0 : m_pRelHeightRelationLB->Disable();
970 :
971 : // general initialisation part
972 0 : switch(rAnchor.GetAnchorId())
973 : {
974 0 : case FLY_AT_PAGE: m_pAnchorAtPageRB->Check(); break;
975 0 : case FLY_AT_PARA: m_pAnchorAtParaRB->Check(); break;
976 0 : case FLY_AT_CHAR: m_pAnchorAtCharRB->Check(); break;
977 0 : case FLY_AS_CHAR: m_pAnchorAsCharRB->Check(); break;
978 0 : case FLY_AT_FLY: m_pAnchorAtFrameRB->Check();break;
979 : default:; //prevent warning
980 : }
981 :
982 : // i#22341 - determine content position of character
983 : // Note: content position can be NULL
984 0 : mpToCharCntntPos = rAnchor.GetCntntAnchor();
985 :
986 : // i#18732 - init checkbox value
987 : {
988 : const bool bFollowTextFlow =
989 0 : static_cast<const SwFmtFollowTextFlow&>(rSet.Get(RES_FOLLOW_TEXT_FLOW)).GetValue();
990 0 : m_pFollowTextFlowCB->Check( bFollowTextFlow );
991 : }
992 :
993 0 : if(bHtmlMode)
994 : {
995 0 : m_pAutoHeightCB->Enable(false);
996 0 : m_pAutoWidthCB->Enable(false);
997 0 : m_pMirrorPagesCB->Show(false);
998 0 : if (sDlgType == "FrameDialog")
999 0 : m_pFixedRatioCB->Enable(false);
1000 : // i#18732 hide checkbox in HTML mode
1001 0 : m_pFollowTextFlowCB->Show(false);
1002 : }
1003 : else
1004 : {
1005 : // enable/disable of check box 'Mirror on..'
1006 0 : m_pMirrorPagesCB->Enable(!m_pAnchorAsCharRB->IsChecked());
1007 :
1008 : // enable/disable check box 'Follow text flow'.
1009 : // enable check box 'Follow text
1010 : // flow' also for anchor type to-frame.
1011 0 : m_pFollowTextFlowCB->Enable( m_pAnchorAtParaRB->IsChecked() ||
1012 0 : m_pAnchorAtCharRB->IsChecked() ||
1013 0 : m_pAnchorAtFrameRB->IsChecked() );
1014 : }
1015 :
1016 0 : Init( rSet, sal_True );
1017 0 : m_pAtVertPosED->SaveValue();
1018 0 : m_pAtHorzPosED->SaveValue();
1019 0 : m_pFollowTextFlowCB->SaveValue();
1020 :
1021 0 : bNoModifyHdl = sal_False;
1022 : //lock PercentFields
1023 0 : m_aWidthED.LockAutoCalculation(true);
1024 0 : m_aHeightED.LockAutoCalculation(true);
1025 0 : RangeModifyHdl(&m_aWidthED); // set all maximum values initially
1026 0 : m_aHeightED.LockAutoCalculation(false);
1027 0 : m_aWidthED.LockAutoCalculation(false);
1028 :
1029 0 : m_pAutoHeightCB->SaveValue();
1030 0 : m_pAutoWidthCB->SaveValue();
1031 :
1032 0 : SwTwips nWidth = static_cast< SwTwips >(m_aWidthED.DenormalizePercent(m_aWidthED.GetValue(FUNIT_TWIP)));
1033 0 : SwTwips nHeight = static_cast< SwTwips >(m_aHeightED.DenormalizePercent(m_aHeightED.GetValue(FUNIT_TWIP)));
1034 0 : fWidthHeightRatio = nHeight ? double(nWidth) / double(nHeight) : 1.0;
1035 0 : }
1036 :
1037 : /*--------------------------------------------------------------------
1038 : Description: stuff attributes into the set when OK
1039 : --------------------------------------------------------------------*/
1040 0 : bool SwFrmPage::FillItemSet(SfxItemSet &rSet)
1041 : {
1042 0 : bool bRet = false;
1043 : SwWrtShell* pSh = bFormat ? ::GetActiveWrtShell()
1044 0 : : getFrmDlgParentShell();
1045 : OSL_ENSURE( pSh , "shell not found");
1046 0 : const SfxItemSet& rOldSet = GetItemSet();
1047 0 : const SfxPoolItem* pOldItem = 0;
1048 :
1049 0 : RndStdIds eAnchorId = (RndStdIds)GetAnchor();
1050 :
1051 0 : if ( !bFormat )
1052 : {
1053 0 : pOldItem = GetOldItem(rSet, RES_ANCHOR);
1054 0 : if (bNew || !pOldItem || eAnchorId != ((const SwFmtAnchor*)pOldItem)->GetAnchorId())
1055 : {
1056 0 : SwFmtAnchor aAnc( eAnchorId, pSh->GetPhyPageNum() );
1057 0 : bRet = 0 != rSet.Put( aAnc );
1058 : }
1059 : }
1060 :
1061 0 : if ( pHMap )
1062 : {
1063 : SwFmtHoriOrient aHoriOrient( (const SwFmtHoriOrient&)
1064 0 : rOldSet.Get(RES_HORI_ORIENT) );
1065 :
1066 0 : const sal_Int32 nMapPos = GetMapPos(pHMap, *m_pHorizontalDLB);
1067 0 : const sal_Int16 eHOri = GetAlignment(pHMap, nMapPos, *m_pHorizontalDLB, *m_pHoriRelationLB);
1068 0 : const sal_Int16 eRel = GetRelation(pHMap, *m_pHoriRelationLB);
1069 :
1070 0 : aHoriOrient.SetHoriOrient( eHOri );
1071 0 : aHoriOrient.SetRelationOrient( eRel );
1072 0 : aHoriOrient.SetPosToggle(m_pMirrorPagesCB->IsChecked());
1073 :
1074 0 : bool bMod = m_pAtHorzPosED->GetText() != m_pAtHorzPosED->GetSavedValue();
1075 0 : bMod |= m_pMirrorPagesCB->GetState() != m_pMirrorPagesCB->GetSavedValue();
1076 :
1077 0 : if ( eHOri == text::HoriOrientation::NONE &&
1078 0 : (bNew || (bAtHorzPosModified || bMod) || nOldH != eHOri ) )
1079 : {
1080 0 : SwTwips nX = static_cast< SwTwips >(m_pAtHorzPosED->Denormalize(m_pAtHorzPosED->GetValue(FUNIT_TWIP)));
1081 0 : aHoriOrient.SetPos( nX );
1082 : }
1083 :
1084 0 : pOldItem = GetOldItem(rSet, FN_HORI_ORIENT);
1085 0 : sal_Bool bSame = sal_False;
1086 0 : if ((bNew == bFormat) && pOldItem)
1087 : {
1088 0 : bSame = static_cast< sal_Bool >(aHoriOrient == (SwFmtHoriOrient&)*pOldItem);
1089 : }
1090 0 : if ((bNew && !bFormat) || ((bAtHorzPosModified || bMod) && !bSame))
1091 : {
1092 0 : bRet |= 0 != rSet.Put( aHoriOrient );
1093 0 : }
1094 : }
1095 :
1096 0 : if ( pVMap )
1097 : {
1098 : // alignment vertical
1099 : SwFmtVertOrient aVertOrient( (const SwFmtVertOrient&)
1100 0 : rOldSet.Get(RES_VERT_ORIENT) );
1101 :
1102 0 : const sal_Int32 nMapPos = GetMapPos(pVMap, *m_pVerticalDLB);
1103 0 : const sal_Int16 eVOri = GetAlignment(pVMap, nMapPos, *m_pVerticalDLB, *m_pVertRelationLB);
1104 0 : const sal_Int16 eRel = GetRelation(pVMap, *m_pVertRelationLB);
1105 :
1106 0 : aVertOrient.SetVertOrient ( eVOri);
1107 0 : aVertOrient.SetRelationOrient( eRel );
1108 :
1109 0 : sal_Bool bMod = m_pAtVertPosED->GetText() != m_pAtVertPosED->GetSavedValue();
1110 :
1111 0 : if ( eVOri == text::VertOrientation::NONE &&
1112 0 : ( bNew || (bAtVertPosModified || bMod) || nOldV != eVOri) )
1113 : {
1114 : // vertival position
1115 : // recalculate offset for character bound frames
1116 0 : SwTwips nY = static_cast< SwTwips >(m_pAtVertPosED->Denormalize(m_pAtVertPosED->GetValue(FUNIT_TWIP)));
1117 0 : if (eAnchorId == FLY_AS_CHAR)
1118 : {
1119 0 : nY *= -1;
1120 : }
1121 0 : aVertOrient.SetPos( nY );
1122 : }
1123 0 : pOldItem = GetOldItem(rSet, FN_VERT_ORIENT);
1124 0 : sal_Bool bSame = sal_False;
1125 0 : if((bNew == bFormat) && pOldItem)
1126 : {
1127 : bSame = static_cast< sal_Bool >( bFormat ?
1128 0 : aVertOrient.GetVertOrient() == ((SwFmtVertOrient*)pOldItem)->GetVertOrient() &&
1129 0 : aVertOrient.GetRelationOrient() == ((SwFmtVertOrient*)pOldItem)->GetRelationOrient() &&
1130 0 : aVertOrient.GetPos() == ((SwFmtVertOrient*)pOldItem)->GetPos()
1131 :
1132 0 : : aVertOrient == (SwFmtVertOrient&)*pOldItem );
1133 : }
1134 0 : if( ( bNew && !bFormat ) || ((bAtVertPosModified || bMod) && !bSame ))
1135 : {
1136 0 : bRet |= 0 != rSet.Put( aVertOrient );
1137 0 : }
1138 : }
1139 :
1140 : // set size
1141 : // new exception: when the size of pMgr(, 0), then the properties
1142 : // for a graphic that isn't even loaded, are set. Then no SetSize
1143 : // is done here when the size settings were not changed by the
1144 : // user.
1145 0 : const SwFmtFrmSize& rOldSize = (const SwFmtFrmSize& )rOldSet.Get(RES_FRM_SIZE);
1146 0 : SwFmtFrmSize aSz( rOldSize );
1147 :
1148 0 : sal_Int32 nRelWidthRelation = m_pRelWidthRelationLB->GetSelectEntryPos();
1149 0 : if (nRelWidthRelation != LISTBOX_ENTRY_NOTFOUND)
1150 : {
1151 0 : if (nRelWidthRelation == 0)
1152 0 : aSz.SetWidthPercentRelation(text::RelOrientation::FRAME);
1153 0 : else if (nRelWidthRelation == 1)
1154 0 : aSz.SetWidthPercentRelation(text::RelOrientation::PAGE_FRAME);
1155 : }
1156 0 : sal_Int32 nRelHeightRelation = m_pRelHeightRelationLB->GetSelectEntryPos();
1157 0 : if (nRelHeightRelation != LISTBOX_ENTRY_NOTFOUND)
1158 : {
1159 0 : if (nRelHeightRelation == 0)
1160 0 : aSz.SetHeightPercentRelation(text::RelOrientation::FRAME);
1161 0 : else if (nRelHeightRelation == 1)
1162 0 : aSz.SetHeightPercentRelation(text::RelOrientation::PAGE_FRAME);
1163 : }
1164 :
1165 0 : bool bValueModified = (m_aWidthED.IsValueModified() || m_aHeightED.IsValueModified());
1166 0 : bool bCheckChanged = (m_pRelWidthCB->GetSavedValue() != TriState(m_pRelWidthCB->IsChecked())
1167 0 : || m_pRelHeightCB->GetSavedValue() != TriState(m_pRelHeightCB->IsChecked()));
1168 :
1169 0 : bool bLegalValue = !(!rOldSize.GetWidth () && !rOldSize.GetHeight() &&
1170 0 : m_aWidthED .GetValue() == m_aWidthED .GetMin() &&
1171 0 : m_aHeightED.GetValue() == m_aHeightED.GetMin());
1172 :
1173 0 : if ((bNew && !bFormat) || ((bValueModified || bCheckChanged) && bLegalValue))
1174 : {
1175 0 : sal_Int64 nNewWidth = m_aWidthED.DenormalizePercent(m_aWidthED.GetRealValue(FUNIT_TWIP));
1176 0 : sal_Int64 nNewHeight = m_aHeightED.DenormalizePercent(m_aHeightED.GetRealValue(FUNIT_TWIP));
1177 0 : aSz.SetWidth (static_cast< SwTwips >(nNewWidth));
1178 0 : aSz.SetHeight(static_cast< SwTwips >(nNewHeight));
1179 :
1180 0 : if (m_pRelWidthCB->IsChecked())
1181 : {
1182 0 : aSz.SetWidthPercent((sal_uInt8)std::min( static_cast< sal_Int64 >(MAX_PERCENT_WIDTH), m_aWidthED.Convert(m_aWidthED.NormalizePercent(nNewWidth), FUNIT_TWIP, FUNIT_CUSTOM)));
1183 : }
1184 : else
1185 0 : aSz.SetWidthPercent(0);
1186 0 : if (m_pRelHeightCB->IsChecked())
1187 0 : aSz.SetHeightPercent((sal_uInt8)std::min(static_cast< sal_Int64 >(MAX_PERCENT_HEIGHT), m_aHeightED.Convert(m_aHeightED.NormalizePercent(nNewHeight), FUNIT_TWIP, FUNIT_CUSTOM)));
1188 : else
1189 0 : aSz.SetHeightPercent(0);
1190 :
1191 0 : if (m_pFixedRatioCB->IsChecked() && (m_pRelWidthCB->IsChecked() != m_pRelHeightCB->IsChecked()))
1192 : {
1193 0 : if (m_pRelWidthCB->IsChecked())
1194 0 : aSz.SetHeightPercent(0xff);
1195 : else
1196 0 : aSz.SetWidthPercent(0xff);
1197 : }
1198 : }
1199 0 : if( !IsInGraficMode() )
1200 : {
1201 0 : if( m_pAutoHeightCB->GetState() != m_pAutoHeightCB->GetSavedValue() )
1202 : {
1203 0 : SwFrmSize eFrmSize = m_pAutoHeightCB->IsChecked()? ATT_MIN_SIZE : ATT_FIX_SIZE;
1204 0 : if( eFrmSize != aSz.GetHeightSizeType() )
1205 0 : aSz.SetHeightSizeType(eFrmSize);
1206 : }
1207 0 : if( m_pAutoWidthCB->GetState() != m_pAutoWidthCB->GetSavedValue() )
1208 : {
1209 0 : SwFrmSize eFrmSize = m_pAutoWidthCB->IsChecked()? ATT_MIN_SIZE : ATT_FIX_SIZE;
1210 0 : if( eFrmSize != aSz.GetWidthSizeType() )
1211 0 : aSz.SetWidthSizeType( eFrmSize );
1212 : }
1213 : }
1214 0 : if( !bFormat && m_pFixedRatioCB->GetSavedValue() != TriState(m_pFixedRatioCB->IsChecked()))
1215 0 : bRet |= 0 != rSet.Put(SfxBoolItem(FN_KEEP_ASPECT_RATIO, m_pFixedRatioCB->IsChecked()));
1216 :
1217 0 : pOldItem = GetOldItem(rSet, RES_FRM_SIZE);
1218 :
1219 0 : if ((pOldItem && aSz != *pOldItem) || (!pOldItem && !bFormat) ||
1220 0 : (bFormat &&
1221 0 : (aSz.GetWidth() > 0 || aSz.GetWidthPercent() > 0) &&
1222 0 : (aSz.GetHeight() > 0 || aSz.GetHeightPercent() > 0)))
1223 : {
1224 0 : if (aSz.GetHeightSizeType() == ATT_VAR_SIZE) // there is no VAR_SIZE in frames
1225 0 : aSz.SetHeightSizeType(ATT_MIN_SIZE);
1226 :
1227 0 : bRet |= 0 != rSet.Put( aSz );
1228 : }
1229 0 : if(TriState(m_pFollowTextFlowCB->IsChecked()) != m_pFollowTextFlowCB->GetSavedValue())
1230 : {
1231 0 : bRet |= 0 != rSet.Put(SwFmtFollowTextFlow(m_pFollowTextFlowCB->IsChecked()));
1232 : }
1233 0 : return bRet;
1234 : }
1235 :
1236 : /*--------------------------------------------------------------------
1237 : Description: initialise horizonal and vertical Pos
1238 : --------------------------------------------------------------------*/
1239 0 : void SwFrmPage::InitPos(RndStdIds eId,
1240 : sal_Int16 nH,
1241 : sal_Int16 nHRel,
1242 : sal_Int16 nV,
1243 : sal_Int16 nVRel,
1244 : long nX,
1245 : long nY)
1246 : {
1247 0 : sal_Int32 nPos = m_pVerticalDLB->GetSelectEntryPos();
1248 0 : if ( nPos != LISTBOX_ENTRY_NOTFOUND && pVMap )
1249 : {
1250 0 : nOldV = pVMap[nPos].nAlign;
1251 :
1252 0 : nPos = m_pVertRelationLB->GetSelectEntryPos();
1253 0 : if (nPos != LISTBOX_ENTRY_NOTFOUND)
1254 0 : nOldVRel = ((RelationMap *)m_pVertRelationLB->GetEntryData(nPos))->nRelation;
1255 : }
1256 :
1257 0 : nPos = m_pHorizontalDLB->GetSelectEntryPos();
1258 0 : if ( nPos != LISTBOX_ENTRY_NOTFOUND && pHMap )
1259 : {
1260 0 : nOldH = pHMap[nPos].nAlign;
1261 :
1262 0 : nPos = m_pHoriRelationLB->GetSelectEntryPos();
1263 0 : if (nPos != LISTBOX_ENTRY_NOTFOUND)
1264 0 : nOldHRel = ((RelationMap *)m_pHoriRelationLB->GetEntryData(nPos))->nRelation;
1265 : }
1266 :
1267 0 : sal_Bool bEnable = sal_True;
1268 0 : if ( eId == FLY_AT_PAGE )
1269 : {
1270 0 : pVMap = bHtmlMode ? aVPageHtmlMap : aVPageMap;
1271 0 : pHMap = bHtmlMode ? aHPageHtmlMap : aHPageMap;
1272 : }
1273 0 : else if ( eId == FLY_AT_FLY )
1274 : {
1275 : // own vertical alignment map for to frame
1276 : // anchored objects.
1277 0 : pVMap = bHtmlMode ? aVFlyHtmlMap : aVFrameMap;
1278 0 : pHMap = bHtmlMode ? aHFlyHtmlMap : aHFrameMap;
1279 : }
1280 0 : else if ( eId == FLY_AT_PARA )
1281 : {
1282 0 : if(bHtmlMode)
1283 : {
1284 0 : pVMap = aVParaHtmlMap;
1285 0 : pHMap = aHParaHtmlAbsMap;
1286 : }
1287 : else
1288 : {
1289 0 : pVMap = aVParaMap;
1290 0 : pHMap = aHParaMap;
1291 : }
1292 : }
1293 0 : else if ( eId == FLY_AT_CHAR )
1294 : {
1295 0 : if(bHtmlMode)
1296 : {
1297 0 : pVMap = aVCharHtmlAbsMap;
1298 0 : pHMap = aHCharHtmlAbsMap;
1299 : }
1300 : else
1301 : {
1302 0 : pVMap = aVCharMap;
1303 0 : pHMap = aHCharMap;
1304 : }
1305 : }
1306 0 : else if ( eId == FLY_AS_CHAR )
1307 : {
1308 0 : pVMap = bHtmlMode ? aVAsCharHtmlMap : aVAsCharMap;
1309 0 : pHMap = 0;
1310 0 : bEnable = sal_False;
1311 : }
1312 0 : m_pHorizontalDLB->Enable( bEnable );
1313 0 : m_pHorizontalFT->Enable( bEnable );
1314 :
1315 : // select current Pos
1316 : // horizontal
1317 0 : if ( nH < 0 )
1318 : {
1319 0 : nH = nOldH;
1320 0 : nHRel = nOldHRel;
1321 : }
1322 0 : sal_Int32 nMapPos = FillPosLB(pHMap, nH, nHRel, *m_pHorizontalDLB);
1323 0 : FillRelLB(pHMap, nMapPos, nH, nHRel, *m_pHoriRelationLB, *m_pHoriRelationFT);
1324 :
1325 : // vertical
1326 0 : if ( nV < 0 )
1327 : {
1328 0 : nV = nOldV;
1329 0 : nVRel = nOldVRel;
1330 : }
1331 0 : nMapPos = FillPosLB(pVMap, nV, nVRel, *m_pVerticalDLB);
1332 0 : FillRelLB(pVMap, nMapPos, nV, nVRel, *m_pVertRelationLB, *m_pVertRelationFT);
1333 :
1334 0 : bEnable = nH == text::HoriOrientation::NONE && eId != FLY_AS_CHAR;
1335 0 : if (!bEnable)
1336 : {
1337 0 : m_pAtHorzPosED->SetValue( 0, FUNIT_TWIP );
1338 0 : if (nX != LONG_MAX && bHtmlMode)
1339 0 : m_pAtHorzPosED->SetModifyFlag();
1340 : }
1341 : else
1342 : {
1343 0 : if (nX != LONG_MAX)
1344 0 : m_pAtHorzPosED->SetValue( m_pAtHorzPosED->Normalize(nX), FUNIT_TWIP );
1345 : }
1346 0 : m_pAtHorzPosFT->Enable( bEnable );
1347 0 : m_pAtHorzPosED->Enable( bEnable );
1348 :
1349 0 : bEnable = nV == text::VertOrientation::NONE;
1350 0 : if ( !bEnable )
1351 : {
1352 0 : m_pAtVertPosED->SetValue( 0, FUNIT_TWIP );
1353 0 : if(nY != LONG_MAX && bHtmlMode)
1354 0 : m_pAtVertPosED->SetModifyFlag();
1355 : }
1356 : else
1357 : {
1358 0 : if ( eId == FLY_AS_CHAR )
1359 : {
1360 0 : if ( nY == LONG_MAX )
1361 0 : nY = 0;
1362 : else
1363 0 : nY *= -1;
1364 : }
1365 0 : if ( nY != LONG_MAX )
1366 0 : m_pAtVertPosED->SetValue( m_pAtVertPosED->Normalize(nY), FUNIT_TWIP );
1367 : }
1368 0 : m_pAtVertPosFT->Enable( bEnable && m_bAllowVertPositioning );
1369 0 : m_pAtVertPosED->Enable( bEnable && m_bAllowVertPositioning );
1370 0 : UpdateExample();
1371 0 : }
1372 :
1373 0 : sal_Int32 SwFrmPage::FillPosLB(const FrmMap* _pMap,
1374 : const sal_Int16 _nAlign,
1375 : const sal_Int16 _nRel,
1376 : ListBox& _rLB )
1377 : {
1378 0 : OUString sSelEntry;
1379 0 : const OUString sOldEntry = _rLB.GetSelectEntry();
1380 :
1381 0 : _rLB.Clear();
1382 :
1383 : // i#22341 determine all possible listbox relations for
1384 : // given relation for map <aVCharMap>
1385 : const sal_uLong nLBRelations = (_pMap != aVCharMap)
1386 : ? 0L
1387 0 : : ::lcl_GetLBRelationsForRelations( _nRel );
1388 :
1389 : // fill Listbox
1390 0 : size_t nCount = ::lcl_GetFrmMapCount(_pMap);
1391 0 : for (size_t i = 0; _pMap && i < nCount; ++i)
1392 : {
1393 : // Why not from the left/from inside or from above?
1394 : {
1395 0 : SvxSwFramePosString::StringId eStrId = m_pMirrorPagesCB->IsChecked() ? _pMap[i].eMirrorStrId : _pMap[i].eStrId;
1396 : // --> OD 2009-08-31 #mongolianlayout#
1397 : eStrId = lcl_ChangeResIdToVerticalOrRTL( eStrId,
1398 : bIsVerticalFrame,
1399 : bIsVerticalL2R,
1400 0 : bIsInRightToLeft);
1401 0 : OUString sEntry(aFramePosString.GetString(eStrId));
1402 0 : if (_rLB.GetEntryPos(sEntry) == LISTBOX_ENTRY_NOTFOUND)
1403 : {
1404 : // don't insert entries when frames are character bound
1405 0 : _rLB.InsertEntry(sEntry);
1406 : }
1407 : // i#22341 - add condition to handle map <aVCharMap>
1408 : // that is ambigous in the alignment.
1409 0 : if ( _pMap[i].nAlign == _nAlign &&
1410 0 : ( !(_pMap == aVCharMap) || _pMap[i].nLBRelations & nLBRelations ) )
1411 : {
1412 0 : sSelEntry = sEntry;
1413 0 : }
1414 : }
1415 : }
1416 :
1417 0 : _rLB.SelectEntry(sSelEntry);
1418 0 : if (!_rLB.GetSelectEntryCount())
1419 0 : _rLB.SelectEntry(sOldEntry);
1420 :
1421 0 : if (!_rLB.GetSelectEntryCount())
1422 0 : _rLB.SelectEntryPos(0);
1423 :
1424 0 : PosHdl(&_rLB);
1425 :
1426 0 : return GetMapPos(_pMap, _rLB);
1427 : }
1428 :
1429 0 : sal_uLong SwFrmPage::FillRelLB( const FrmMap* _pMap,
1430 : const sal_uInt16 _nLBSelPos,
1431 : const sal_Int16 _nAlign,
1432 : const sal_Int16 _nRel,
1433 : ListBox& _rLB,
1434 : FixedText& _rFT )
1435 : {
1436 0 : OUString sSelEntry;
1437 0 : sal_uLong nLBRelations = 0;
1438 0 : size_t nMapCount = ::lcl_GetFrmMapCount(_pMap);
1439 :
1440 0 : _rLB.Clear();
1441 :
1442 0 : if (_nLBSelPos < nMapCount)
1443 : {
1444 0 : if (_pMap == aVAsCharHtmlMap || _pMap == aVAsCharMap)
1445 : {
1446 0 : const OUString sOldEntry(_rLB.GetSelectEntry());
1447 0 : const size_t nRelCount = SAL_N_ELEMENTS(aAsCharRelationMap);
1448 0 : SvxSwFramePosString::StringId eStrId = _pMap[_nLBSelPos].eStrId;
1449 :
1450 0 : for (size_t nMapPos = 0; nMapPos < nMapCount; nMapPos++)
1451 : {
1452 0 : if (_pMap[nMapPos].eStrId == eStrId)
1453 : {
1454 0 : nLBRelations = _pMap[nMapPos].nLBRelations;
1455 0 : for (size_t nRelPos = 0; nRelPos < nRelCount; ++nRelPos)
1456 : {
1457 0 : if (nLBRelations & aAsCharRelationMap[nRelPos].nLBRelation)
1458 : {
1459 0 : SvxSwFramePosString::StringId sStrId1 = aAsCharRelationMap[nRelPos].eStrId;
1460 :
1461 : // --> OD 2009-08-31 #mongolianlayout#
1462 : sStrId1 =
1463 : lcl_ChangeResIdToVerticalOrRTL( sStrId1,
1464 : bIsVerticalFrame,
1465 : bIsVerticalL2R,
1466 0 : bIsInRightToLeft);
1467 0 : const OUString sEntry = aFramePosString.GetString(sStrId1);
1468 0 : sal_Int32 nPos = _rLB.InsertEntry(sEntry);
1469 0 : _rLB.SetEntryData(nPos, &aAsCharRelationMap[nRelPos]);
1470 0 : if (_pMap[nMapPos].nAlign == _nAlign)
1471 0 : sSelEntry = sEntry;
1472 0 : break;
1473 : }
1474 : }
1475 : }
1476 : }
1477 0 : if (!sSelEntry.isEmpty())
1478 0 : _rLB.SelectEntry(sSelEntry);
1479 : else
1480 : {
1481 0 : _rLB.SelectEntry(sOldEntry);
1482 :
1483 0 : if (!_rLB.GetSelectEntryCount())
1484 : {
1485 0 : for (sal_Int32 i = 0; i < _rLB.GetEntryCount(); i++)
1486 : {
1487 0 : RelationMap *pEntry = (RelationMap *)_rLB.GetEntryData(i);
1488 0 : if (pEntry->nLBRelation == LB_REL_CHAR) // default
1489 : {
1490 0 : _rLB.SelectEntryPos(i);
1491 0 : break;
1492 : }
1493 : }
1494 : }
1495 0 : }
1496 : }
1497 : else
1498 : {
1499 : // special handling for map <aVCharMap>,
1500 : // because its ambigous in its <eStrId>/<eMirrorStrId>.
1501 0 : if ( _pMap == aVCharMap )
1502 : {
1503 : nLBRelations = ::lcl_GetLBRelationsForStrID( _pMap,
1504 0 : ( m_pMirrorPagesCB->IsChecked()
1505 0 : ? _pMap[_nLBSelPos].eMirrorStrId
1506 0 : : _pMap[_nLBSelPos].eStrId),
1507 0 : m_pMirrorPagesCB->IsChecked() );
1508 : }
1509 : else
1510 : {
1511 0 : nLBRelations = _pMap[_nLBSelPos].nLBRelations;
1512 : }
1513 :
1514 0 : const size_t nRelCount = SAL_N_ELEMENTS(aRelationMap);
1515 :
1516 0 : for (sal_uLong nBit = 1; nBit < 0x80000000; nBit <<= 1)
1517 : {
1518 0 : if (nLBRelations & nBit)
1519 : {
1520 0 : for (size_t nRelPos = 0; nRelPos < nRelCount; ++nRelPos)
1521 : {
1522 0 : if (aRelationMap[nRelPos].nLBRelation == nBit)
1523 : {
1524 0 : SvxSwFramePosString::StringId eStrId1 = m_pMirrorPagesCB->IsChecked() ?
1525 0 : aRelationMap[nRelPos].eMirrorStrId : aRelationMap[nRelPos].eStrId;
1526 : // --> OD 2009-08-31 #mongolianlayout#
1527 : eStrId1 =
1528 : lcl_ChangeResIdToVerticalOrRTL( eStrId1,
1529 : bIsVerticalFrame,
1530 : bIsVerticalL2R,
1531 0 : bIsInRightToLeft);
1532 0 : const OUString sEntry = aFramePosString.GetString(eStrId1);
1533 0 : sal_Int32 nPos = _rLB.InsertEntry(sEntry);
1534 0 : _rLB.SetEntryData(nPos, &aRelationMap[nRelPos]);
1535 0 : if (sSelEntry.isEmpty() && aRelationMap[nRelPos].nRelation == _nRel)
1536 0 : sSelEntry = sEntry;
1537 : }
1538 : }
1539 : }
1540 : }
1541 0 : if (!sSelEntry.isEmpty())
1542 0 : _rLB.SelectEntry(sSelEntry);
1543 : else
1544 : {
1545 : // Probably anchor switch. So look for similar relation
1546 0 : sal_Int16 nSimRel = -1;
1547 0 : switch (_nRel)
1548 : {
1549 : case text::RelOrientation::FRAME:
1550 0 : nSimRel = text::RelOrientation::PAGE_FRAME;
1551 0 : break;
1552 : case text::RelOrientation::PRINT_AREA:
1553 0 : nSimRel = text::RelOrientation::PAGE_PRINT_AREA;
1554 0 : break;
1555 : case text::RelOrientation::PAGE_LEFT:
1556 0 : nSimRel = text::RelOrientation::FRAME_LEFT;
1557 0 : break;
1558 : case text::RelOrientation::PAGE_RIGHT:
1559 0 : nSimRel = text::RelOrientation::FRAME_RIGHT;
1560 0 : break;
1561 : case text::RelOrientation::FRAME_LEFT:
1562 0 : nSimRel = text::RelOrientation::PAGE_LEFT;
1563 0 : break;
1564 : case text::RelOrientation::FRAME_RIGHT:
1565 0 : nSimRel = text::RelOrientation::PAGE_RIGHT;
1566 0 : break;
1567 : case text::RelOrientation::PAGE_FRAME:
1568 0 : nSimRel = text::RelOrientation::FRAME;
1569 0 : break;
1570 : case text::RelOrientation::PAGE_PRINT_AREA:
1571 0 : nSimRel = text::RelOrientation::PRINT_AREA;
1572 0 : break;
1573 :
1574 : default:
1575 0 : if (_rLB.GetEntryCount())
1576 : {
1577 0 : RelationMap *pEntry = (RelationMap *)_rLB.GetEntryData(_rLB.GetEntryCount() - 1);
1578 0 : nSimRel = pEntry->nRelation;
1579 : }
1580 0 : break;
1581 : }
1582 :
1583 0 : for (sal_Int32 i = 0; i < _rLB.GetEntryCount(); i++)
1584 : {
1585 0 : RelationMap *pEntry = (RelationMap *)_rLB.GetEntryData(i);
1586 0 : if (pEntry->nRelation == nSimRel)
1587 : {
1588 0 : _rLB.SelectEntryPos(i);
1589 0 : break;
1590 : }
1591 : }
1592 :
1593 0 : if (!_rLB.GetSelectEntryCount())
1594 0 : _rLB.SelectEntryPos(0);
1595 : }
1596 : }
1597 : }
1598 :
1599 0 : const bool bEnable = _rLB.GetEntryCount() != 0
1600 0 : && (&_rLB != m_pVertRelationLB || m_bAllowVertPositioning);
1601 0 : _rLB.Enable( bEnable );
1602 0 : _rFT.Enable( bEnable );
1603 :
1604 0 : RelHdl(&_rLB);
1605 :
1606 0 : return nLBRelations;
1607 : }
1608 :
1609 0 : sal_Int16 SwFrmPage::GetRelation(FrmMap * /*pMap*/, ListBox &rRelationLB)
1610 : {
1611 0 : const sal_Int32 nPos = rRelationLB.GetSelectEntryPos();
1612 :
1613 0 : if (nPos != LISTBOX_ENTRY_NOTFOUND)
1614 : {
1615 0 : RelationMap *pEntry = (RelationMap *)rRelationLB.GetEntryData(nPos);
1616 0 : return pEntry->nRelation;
1617 : }
1618 :
1619 0 : return 0;
1620 : }
1621 :
1622 0 : sal_Int16 SwFrmPage::GetAlignment(FrmMap *pMap, sal_Int32 nMapPos,
1623 : ListBox &/*rAlignLB*/, ListBox &rRelationLB)
1624 : {
1625 0 : if (!pMap || nMapPos < 0)
1626 0 : return 0;
1627 :
1628 0 : const size_t nMapCount = ::lcl_GetFrmMapCount(pMap);
1629 :
1630 0 : if (static_cast<size_t>(nMapPos) >= nMapCount)
1631 0 : return 0;
1632 :
1633 : // i#22341 special handling also for map <aVCharMap>,
1634 : // because it contains ambigous items for alignment
1635 0 : if ( pMap != aVAsCharHtmlMap && pMap != aVAsCharMap && pMap != aVCharMap )
1636 0 : return pMap[nMapPos].nAlign;
1637 :
1638 0 : if (rRelationLB.GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND)
1639 0 : return 0;
1640 :
1641 : const RelationMap *const pRelationMap = (const RelationMap *const )
1642 0 : rRelationLB.GetEntryData(rRelationLB.GetSelectEntryPos());
1643 0 : const sal_uLong nRel = pRelationMap->nLBRelation;
1644 0 : const SvxSwFramePosString::StringId eStrId = pMap[nMapPos].eStrId;
1645 :
1646 0 : for (size_t i = 0; i < nMapCount; ++i)
1647 : {
1648 0 : if (pMap[i].eStrId == eStrId && (pMap[i].nLBRelations & nRel))
1649 0 : return pMap[i].nAlign;
1650 : }
1651 :
1652 0 : return 0;
1653 : }
1654 :
1655 0 : sal_Int32 SwFrmPage::GetMapPos( const FrmMap *pMap, ListBox &rAlignLB )
1656 : {
1657 0 : sal_Int32 nMapPos = 0;
1658 0 : sal_Int32 nLBSelPos = rAlignLB.GetSelectEntryPos();
1659 :
1660 0 : if (nLBSelPos != LISTBOX_ENTRY_NOTFOUND)
1661 : {
1662 0 : if (pMap == aVAsCharHtmlMap || pMap == aVAsCharMap)
1663 : {
1664 0 : const size_t nMapCount = ::lcl_GetFrmMapCount(pMap);
1665 0 : const OUString sSelEntry(rAlignLB.GetSelectEntry());
1666 :
1667 0 : for (size_t i = 0; i < nMapCount; i++)
1668 : {
1669 0 : SvxSwFramePosString::StringId eResId = pMap[i].eStrId;
1670 :
1671 0 : OUString sEntry = aFramePosString.GetString(eResId);
1672 0 : sEntry = MnemonicGenerator::EraseAllMnemonicChars( sEntry );
1673 :
1674 0 : if (sEntry == sSelEntry)
1675 : {
1676 0 : nMapPos = static_cast< sal_Int32 >(i);
1677 0 : break;
1678 : }
1679 0 : }
1680 : }
1681 : else
1682 0 : nMapPos = nLBSelPos;
1683 : }
1684 :
1685 0 : return nMapPos;
1686 : }
1687 :
1688 0 : RndStdIds SwFrmPage::GetAnchor()
1689 : {
1690 0 : RndStdIds nRet = FLY_AT_PAGE;
1691 0 : if(m_pAnchorAtParaRB->IsChecked())
1692 : {
1693 0 : nRet = FLY_AT_PARA;
1694 : }
1695 0 : else if(m_pAnchorAtCharRB->IsChecked())
1696 : {
1697 0 : nRet = FLY_AT_CHAR;
1698 : }
1699 0 : else if(m_pAnchorAsCharRB->IsChecked())
1700 : {
1701 0 : nRet = FLY_AS_CHAR;
1702 : }
1703 0 : else if(m_pAnchorAtFrameRB->IsChecked())
1704 : {
1705 0 : nRet = FLY_AT_FLY;
1706 : }
1707 0 : return nRet;
1708 : }
1709 :
1710 : /*--------------------------------------------------------------------
1711 : Description: Bsp - Update
1712 : --------------------------------------------------------------------*/
1713 0 : void SwFrmPage::ActivatePage(const SfxItemSet& rSet)
1714 : {
1715 0 : bNoModifyHdl = sal_True;
1716 0 : Init(rSet);
1717 0 : bNoModifyHdl = sal_False;
1718 : //lock PercentFields
1719 0 : m_aWidthED.LockAutoCalculation(true);
1720 0 : m_aHeightED.LockAutoCalculation(true);
1721 0 : RangeModifyHdl(&m_aWidthED); // set all maximum values initially
1722 0 : m_aHeightED.LockAutoCalculation(false);
1723 0 : m_aWidthED.LockAutoCalculation(false);
1724 0 : m_pFollowTextFlowCB->SaveValue();
1725 0 : }
1726 :
1727 0 : int SwFrmPage::DeactivatePage(SfxItemSet * _pSet)
1728 : {
1729 0 : if ( _pSet )
1730 : {
1731 0 : FillItemSet( *_pSet );
1732 :
1733 : //FillItemSet doesn't set the anchor into the set when it matches
1734 : //the original. But for the other pages we need the current anchor.
1735 : SwWrtShell* pSh = bFormat ? ::GetActiveWrtShell()
1736 0 : : getFrmDlgParentShell();
1737 0 : RndStdIds eAnchorId = (RndStdIds)GetAnchor();
1738 0 : SwFmtAnchor aAnc( eAnchorId, pSh->GetPhyPageNum() );
1739 0 : _pSet->Put( aAnc );
1740 : }
1741 :
1742 0 : return sal_True;
1743 : }
1744 :
1745 : /*--------------------------------------------------------------------
1746 : Description: swap left/right with inside/outside
1747 : --------------------------------------------------------------------*/
1748 0 : IMPL_LINK_NOARG(SwFrmPage, MirrorHdl)
1749 : {
1750 0 : RndStdIds eId = GetAnchor();
1751 0 : InitPos( eId, -1, 0, -1, 0, LONG_MAX, LONG_MAX);
1752 :
1753 0 : return 0;
1754 : }
1755 :
1756 0 : IMPL_LINK( SwFrmPage, RelSizeClickHdl, CheckBox *, pBtn )
1757 : {
1758 0 : if (pBtn == m_pRelWidthCB)
1759 : {
1760 0 : m_aWidthED.ShowPercent(pBtn->IsChecked());
1761 0 : m_pRelWidthRelationLB->Enable(pBtn->IsChecked());
1762 0 : if(pBtn->IsChecked())
1763 0 : m_aWidthED.get()->SetMax(MAX_PERCENT_WIDTH);
1764 : }
1765 : else // pBtn == m_pRelHeightCB
1766 : {
1767 0 : m_aHeightED.ShowPercent(pBtn->IsChecked());
1768 0 : m_pRelHeightRelationLB->Enable(pBtn->IsChecked());
1769 0 : if(pBtn->IsChecked())
1770 0 : m_aHeightED.get()->SetMax(MAX_PERCENT_HEIGHT);
1771 : }
1772 :
1773 0 : RangeModifyHdl(m_aWidthED.get()); // correct the values again
1774 :
1775 0 : if (pBtn == m_pRelWidthCB)
1776 0 : ModifyHdl(m_aWidthED.get());
1777 : else // pBtn == m_pRelHeightCB
1778 0 : ModifyHdl(m_aHeightED.get());
1779 :
1780 0 : return 0;
1781 : }
1782 :
1783 : /*--------------------------------------------------------------------
1784 : Description: range check
1785 : --------------------------------------------------------------------*/
1786 0 : IMPL_LINK_NOARG(SwFrmPage, RangeModifyHdl)
1787 : {
1788 0 : if (bNoModifyHdl)
1789 0 : return 0;
1790 :
1791 : SwWrtShell* pSh = bFormat ? ::GetActiveWrtShell()
1792 0 : : getFrmDlgParentShell();
1793 : OSL_ENSURE(pSh , "shell not found");
1794 0 : SwFlyFrmAttrMgr aMgr( bNew, pSh, (const SwAttrSet&)GetItemSet() );
1795 0 : SvxSwFrameValidation aVal;
1796 :
1797 0 : aVal.nAnchorType = static_cast< sal_Int16 >(GetAnchor());
1798 0 : aVal.bAutoHeight = m_pAutoHeightCB->IsChecked();
1799 0 : aVal.bAutoWidth = m_pAutoWidthCB->IsChecked();
1800 0 : aVal.bMirror = m_pMirrorPagesCB->IsChecked();
1801 0 : aVal.bFollowTextFlow = m_pFollowTextFlowCB->IsChecked();
1802 :
1803 0 : if ( pHMap )
1804 : {
1805 : // alignment horizonal
1806 0 : const sal_Int32 nMapPos = GetMapPos(pHMap, *m_pHorizontalDLB);
1807 0 : aVal.nHoriOrient = GetAlignment(pHMap, nMapPos, *m_pHorizontalDLB, *m_pHoriRelationLB);
1808 0 : aVal.nHRelOrient = GetRelation(pHMap, *m_pHoriRelationLB);
1809 : }
1810 : else
1811 0 : aVal.nHoriOrient = text::HoriOrientation::NONE;
1812 :
1813 0 : if ( pVMap )
1814 : {
1815 : // alignment vertical
1816 0 : const sal_Int32 nMapPos = GetMapPos(pVMap, *m_pVerticalDLB);
1817 0 : aVal.nVertOrient = GetAlignment(pVMap, nMapPos, *m_pVerticalDLB, *m_pVertRelationLB);
1818 0 : aVal.nVRelOrient = GetRelation(pVMap, *m_pVertRelationLB);
1819 : }
1820 : else
1821 0 : aVal.nVertOrient = text::VertOrientation::NONE;
1822 :
1823 : const long nAtHorzPosVal = static_cast< long >(
1824 0 : m_pAtHorzPosED->Denormalize(m_pAtHorzPosED->GetValue(FUNIT_TWIP)) );
1825 : const long nAtVertPosVal = static_cast< long >(
1826 0 : m_pAtVertPosED->Denormalize(m_pAtVertPosED->GetValue(FUNIT_TWIP)) );
1827 :
1828 0 : aVal.nHPos = nAtHorzPosVal;
1829 0 : aVal.nVPos = nAtVertPosVal;
1830 :
1831 0 : aMgr.ValidateMetrics(aVal, mpToCharCntntPos, true); // one time, to get reference values for percental values
1832 :
1833 : // set reference values for percental values (100%) ...
1834 0 : m_aWidthED.SetRefValue(aVal.aPercentSize.Width());
1835 0 : m_aHeightED.SetRefValue(aVal.aPercentSize.Height());
1836 :
1837 : // ... and correctly convert width and height with it
1838 0 : SwTwips nWidth = static_cast< SwTwips >(m_aWidthED. DenormalizePercent(m_aWidthED.GetValue(FUNIT_TWIP)));
1839 0 : SwTwips nHeight = static_cast< SwTwips >(m_aHeightED.DenormalizePercent(m_aHeightED.GetValue(FUNIT_TWIP)));
1840 0 : aVal.nWidth = nWidth;
1841 0 : aVal.nHeight = nHeight;
1842 :
1843 0 : aMgr.ValidateMetrics(aVal, mpToCharCntntPos); // one more time, to determine all remaining values with correct width and height.
1844 :
1845 : // all columns have to be correct
1846 0 : if(GetTabDialog()->GetExampleSet() &&
1847 0 : SFX_ITEM_DEFAULT <= GetTabDialog()->GetExampleSet()->GetItemState(RES_COL))
1848 : {
1849 0 : const SwFmtCol& rCol = (const SwFmtCol&)GetTabDialog()->GetExampleSet()->Get(RES_COL);
1850 0 : if ( rCol.GetColumns().size() > 1 )
1851 : {
1852 0 : for ( size_t i = 0; i < rCol.GetColumns().size(); ++i )
1853 : {
1854 0 : aVal.nMinWidth += rCol.GetColumns()[i].GetLeft() +
1855 0 : rCol.GetColumns()[i].GetRight() +
1856 0 : MINFLY;
1857 : }
1858 0 : aVal.nMinWidth -= MINFLY;//one was already in there!
1859 : }
1860 : }
1861 :
1862 0 : nWidth = aVal.nWidth;
1863 0 : nHeight = aVal.nHeight;
1864 :
1865 : // minimum range also for template
1866 0 : m_aHeightED.SetMin(m_aHeightED.NormalizePercent(aVal.nMinHeight), FUNIT_TWIP);
1867 0 : m_aWidthED. SetMin(m_aWidthED.NormalizePercent(aVal.nMinWidth), FUNIT_TWIP);
1868 :
1869 0 : SwTwips nMaxWidth(aVal.nMaxWidth);
1870 0 : SwTwips nMaxHeight(aVal.nMaxHeight);
1871 :
1872 0 : if (aVal.bAutoHeight && (sDlgType == "PictureDialog" || sDlgType == "ObjectDialog"))
1873 : {
1874 0 : SwTwips nTmp = std::min(nWidth * nMaxHeight / std::max(nHeight, 1L), nMaxHeight);
1875 0 : m_aWidthED.SetMax(m_aWidthED.NormalizePercent(nTmp), FUNIT_TWIP);
1876 :
1877 0 : nTmp = std::min(nHeight * nMaxWidth / std::max(nWidth, 1L), nMaxWidth);
1878 0 : m_aHeightED.SetMax(m_aWidthED.NormalizePercent(nTmp), FUNIT_TWIP);
1879 : }
1880 : else
1881 : {
1882 0 : SwTwips nTmp = static_cast< SwTwips >(m_aHeightED.NormalizePercent(nMaxHeight));
1883 0 : m_aHeightED.SetMax(nTmp, FUNIT_TWIP);
1884 :
1885 0 : nTmp = static_cast< SwTwips >(m_aWidthED.NormalizePercent(nMaxWidth));
1886 0 : m_aWidthED.SetMax(nTmp, FUNIT_TWIP);
1887 : }
1888 :
1889 0 : m_pAtHorzPosED->SetMin(m_pAtHorzPosED->Normalize(aVal.nMinHPos), FUNIT_TWIP);
1890 0 : m_pAtHorzPosED->SetMax(m_pAtHorzPosED->Normalize(aVal.nMaxHPos), FUNIT_TWIP);
1891 0 : if ( aVal.nHPos != nAtHorzPosVal )
1892 0 : m_pAtHorzPosED->SetValue(m_pAtHorzPosED->Normalize(aVal.nHPos), FUNIT_TWIP);
1893 :
1894 0 : const SwTwips nUpperOffset = (aVal.nAnchorType == FLY_AS_CHAR)
1895 0 : ? nUpperBorder : 0;
1896 0 : const SwTwips nLowerOffset = (aVal.nAnchorType == FLY_AS_CHAR)
1897 0 : ? nLowerBorder : 0;
1898 :
1899 0 : m_pAtVertPosED->SetMin(m_pAtVertPosED->Normalize(aVal.nMinVPos + nLowerOffset + nUpperOffset), FUNIT_TWIP);
1900 0 : m_pAtVertPosED->SetMax(m_pAtVertPosED->Normalize(aVal.nMaxVPos), FUNIT_TWIP);
1901 0 : if ( aVal.nVPos != nAtVertPosVal )
1902 0 : m_pAtVertPosED->SetValue(m_pAtVertPosED->Normalize(aVal.nVPos), FUNIT_TWIP);
1903 :
1904 0 : return 0;
1905 : }
1906 :
1907 0 : IMPL_LINK_NOARG(SwFrmPage, AnchorTypeHdl)
1908 : {
1909 0 : m_pMirrorPagesCB->Enable(!m_pAnchorAsCharRB->IsChecked());
1910 :
1911 : // i#18732 - enable check box 'Follow text flow' for anchor
1912 : // type to-paragraph' and to-character
1913 : // i#22305 - enable check box 'Follow text
1914 : // flow' also for anchor type to-frame.
1915 0 : m_pFollowTextFlowCB->Enable( m_pAnchorAtParaRB->IsChecked() ||
1916 0 : m_pAnchorAtCharRB->IsChecked() ||
1917 0 : m_pAnchorAtFrameRB->IsChecked() );
1918 :
1919 0 : RndStdIds eId = GetAnchor();
1920 :
1921 0 : InitPos( eId, -1, 0, -1, 0, LONG_MAX, LONG_MAX);
1922 0 : RangeModifyHdl(0);
1923 :
1924 0 : if(bHtmlMode)
1925 : {
1926 0 : PosHdl(m_pHorizontalDLB);
1927 0 : PosHdl(m_pVerticalDLB);
1928 : }
1929 :
1930 0 : EnableVerticalPositioning( !(m_bIsMathOLE && m_bIsMathBaselineAlignment
1931 0 : && FLY_AS_CHAR == eId) );
1932 :
1933 0 : return 0;
1934 : }
1935 :
1936 0 : IMPL_LINK( SwFrmPage, PosHdl, ListBox *, pLB )
1937 : {
1938 0 : bool bHori = pLB == m_pHorizontalDLB;
1939 0 : ListBox *pRelLB = bHori ? m_pHoriRelationLB : m_pVertRelationLB;
1940 0 : FixedText *pRelFT = bHori ? m_pHoriRelationFT : m_pVertRelationFT;
1941 0 : FrmMap *pMap = bHori ? pHMap : pVMap;
1942 :
1943 0 : const sal_Int32 nMapPos = GetMapPos(pMap, *pLB);
1944 0 : const sal_Int16 nAlign = GetAlignment(pMap, nMapPos, *pLB, *pRelLB);
1945 :
1946 0 : if (bHori)
1947 : {
1948 0 : sal_Bool bEnable = text::HoriOrientation::NONE == nAlign;
1949 0 : m_pAtHorzPosED->Enable( bEnable );
1950 0 : m_pAtHorzPosFT->Enable( bEnable );
1951 : }
1952 : else
1953 : {
1954 0 : sal_Bool bEnable = text::VertOrientation::NONE == nAlign && m_bAllowVertPositioning;
1955 0 : m_pAtVertPosED->Enable( bEnable );
1956 0 : m_pAtVertPosFT->Enable( bEnable );
1957 : }
1958 :
1959 0 : RangeModifyHdl( 0 );
1960 :
1961 0 : sal_Int16 nRel = 0;
1962 0 : if (pLB->GetSelectEntryCount())
1963 : {
1964 :
1965 0 : if (pRelLB->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND)
1966 0 : nRel = ((RelationMap *)pRelLB->GetEntryData(pRelLB->GetSelectEntryPos()))->nRelation;
1967 :
1968 0 : FillRelLB(pMap, nMapPos, nAlign, nRel, *pRelLB, *pRelFT);
1969 : }
1970 : else
1971 0 : pRelLB->Clear();
1972 :
1973 0 : UpdateExample();
1974 :
1975 0 : if (bHori)
1976 0 : bAtHorzPosModified = sal_True;
1977 : else
1978 0 : bAtVertPosModified = sal_True;
1979 :
1980 : // special treatment for HTML-Mode with horizonal-vertical-dependencies
1981 0 : if(bHtmlMode && (FLY_AT_CHAR == GetAnchor()))
1982 : {
1983 0 : bool bSet = false;
1984 0 : if(bHori)
1985 : {
1986 : // right is allowed only above - from the left only above
1987 : // from the left at character -> below
1988 0 : if((text::HoriOrientation::LEFT == nAlign || text::HoriOrientation::RIGHT == nAlign) &&
1989 0 : 0 == m_pVerticalDLB->GetSelectEntryPos())
1990 : {
1991 0 : if(text::RelOrientation::FRAME == nRel)
1992 0 : m_pVerticalDLB->SelectEntryPos(1);
1993 : else
1994 0 : m_pVerticalDLB->SelectEntryPos(0);
1995 0 : bSet = true;
1996 : }
1997 0 : else if(text::HoriOrientation::LEFT == nAlign && 1 == m_pVerticalDLB->GetSelectEntryPos())
1998 : {
1999 0 : m_pVerticalDLB->SelectEntryPos(0);
2000 0 : bSet = true;
2001 : }
2002 0 : else if(text::HoriOrientation::NONE == nAlign && 1 == m_pVerticalDLB->GetSelectEntryPos())
2003 : {
2004 0 : m_pVerticalDLB->SelectEntryPos(0);
2005 0 : bSet = true;
2006 : }
2007 0 : if(bSet)
2008 0 : PosHdl(m_pVerticalDLB);
2009 : }
2010 : else
2011 : {
2012 0 : if(text::VertOrientation::TOP == nAlign)
2013 : {
2014 0 : if(1 == m_pHorizontalDLB->GetSelectEntryPos())
2015 : {
2016 0 : m_pHorizontalDLB->SelectEntryPos(0);
2017 0 : bSet = true;
2018 : }
2019 0 : m_pHoriRelationLB->SelectEntryPos(1);
2020 : }
2021 0 : else if(text::VertOrientation::CHAR_BOTTOM == nAlign)
2022 : {
2023 0 : if(2 == m_pHorizontalDLB->GetSelectEntryPos())
2024 : {
2025 0 : m_pHorizontalDLB->SelectEntryPos(0);
2026 0 : bSet = true;
2027 : }
2028 0 : m_pHoriRelationLB->SelectEntryPos(0) ;
2029 : }
2030 0 : if(bSet)
2031 0 : PosHdl(m_pHorizontalDLB);
2032 : }
2033 :
2034 : }
2035 0 : return 0;
2036 : }
2037 :
2038 : /*--------------------------------------------------------------------
2039 : Description: horizontal Pos
2040 : --------------------------------------------------------------------*/
2041 0 : IMPL_LINK( SwFrmPage, RelHdl, ListBox *, pLB )
2042 : {
2043 0 : bool bHori = pLB == m_pHoriRelationLB;
2044 :
2045 0 : UpdateExample();
2046 :
2047 0 : if (bHori)
2048 0 : bAtHorzPosModified = sal_True;
2049 : else
2050 0 : bAtVertPosModified = sal_True;
2051 :
2052 0 : if (bHtmlMode && (FLY_AT_CHAR == GetAnchor()))
2053 : {
2054 0 : if(bHori)
2055 : {
2056 0 : const sal_Int16 nRel = GetRelation(pHMap, *m_pHoriRelationLB);
2057 0 : if(text::RelOrientation::PRINT_AREA == nRel && 0 == m_pVerticalDLB->GetSelectEntryPos())
2058 : {
2059 0 : m_pVerticalDLB->SelectEntryPos(1);
2060 : }
2061 0 : else if(text::RelOrientation::CHAR == nRel && 1 == m_pVerticalDLB->GetSelectEntryPos())
2062 : {
2063 0 : m_pVerticalDLB->SelectEntryPos(0);
2064 : }
2065 : }
2066 : }
2067 0 : if (pLB) // Only when Handler was called by changing of the controller
2068 0 : RangeModifyHdl(0);
2069 :
2070 0 : return 0;
2071 : }
2072 :
2073 0 : IMPL_LINK_NOARG_INLINE_START(SwFrmPage, RealSizeHdl)
2074 : {
2075 0 : m_aWidthED.SetUserValue( m_aWidthED. NormalizePercent(aGrfSize.Width() ), FUNIT_TWIP);
2076 0 : m_aHeightED.SetUserValue(m_aHeightED.NormalizePercent(aGrfSize.Height()), FUNIT_TWIP);
2077 0 : fWidthHeightRatio = aGrfSize.Height() ? double(aGrfSize.Width()) / double(aGrfSize.Height()) : 1.0;
2078 0 : UpdateExample();
2079 0 : return 0;
2080 : }
2081 0 : IMPL_LINK_NOARG_INLINE_END(SwFrmPage, RealSizeHdl)
2082 :
2083 0 : IMPL_LINK_NOARG(SwFrmPage, AutoWidthClickHdl)
2084 : {
2085 0 : if( !IsInGraficMode() )
2086 0 : HandleAutoCB( m_pAutoWidthCB->IsChecked(), *m_pWidthFT, *m_pWidthAutoFT, *m_aWidthED.get() );
2087 0 : return 0;
2088 : }
2089 :
2090 0 : IMPL_LINK_NOARG(SwFrmPage, AutoHeightClickHdl)
2091 : {
2092 0 : if( !IsInGraficMode() )
2093 0 : HandleAutoCB( m_pAutoHeightCB->IsChecked(), *m_pHeightFT, *m_pHeightAutoFT, *m_aWidthED.get() );
2094 0 : return 0;
2095 : }
2096 :
2097 0 : IMPL_LINK( SwFrmPage, ModifyHdl, Edit *, pEdit )
2098 : {
2099 0 : SwTwips nWidth = static_cast< SwTwips >(m_aWidthED.DenormalizePercent(m_aWidthED.GetValue(FUNIT_TWIP)));
2100 0 : SwTwips nHeight = static_cast< SwTwips >(m_aHeightED.DenormalizePercent(m_aHeightED.GetValue(FUNIT_TWIP)));
2101 0 : if ( m_pFixedRatioCB->IsChecked() )
2102 : {
2103 0 : if (pEdit == m_aWidthED.get())
2104 : {
2105 0 : nHeight = SwTwips((double)nWidth / fWidthHeightRatio);
2106 0 : m_aHeightED.SetPrcntValue(m_aHeightED.NormalizePercent(nHeight), FUNIT_TWIP);
2107 : }
2108 0 : else if (pEdit == m_aHeightED.get())
2109 : {
2110 0 : nWidth = SwTwips((double)nHeight * fWidthHeightRatio);
2111 0 : m_aWidthED.SetPrcntValue(m_aWidthED.NormalizePercent(nWidth), FUNIT_TWIP);
2112 : }
2113 : }
2114 0 : fWidthHeightRatio = nHeight ? double(nWidth) / double(nHeight) : 1.0;
2115 0 : UpdateExample();
2116 0 : return 0;
2117 : }
2118 :
2119 0 : void SwFrmPage::UpdateExample()
2120 : {
2121 0 : sal_Int32 nPos = m_pHorizontalDLB->GetSelectEntryPos();
2122 0 : if ( pHMap && nPos != LISTBOX_ENTRY_NOTFOUND )
2123 : {
2124 0 : const sal_Int32 nMapPos = GetMapPos(pHMap, *m_pHorizontalDLB);
2125 0 : m_pExampleWN->SetHAlign(GetAlignment(pHMap, nMapPos, *m_pHorizontalDLB, *m_pHoriRelationLB));
2126 0 : m_pExampleWN->SetHoriRel(GetRelation(pHMap, *m_pHoriRelationLB));
2127 : }
2128 :
2129 0 : nPos = m_pVerticalDLB->GetSelectEntryPos();
2130 0 : if ( pVMap && nPos != LISTBOX_ENTRY_NOTFOUND )
2131 : {
2132 0 : const sal_Int32 nMapPos = GetMapPos(pVMap, *m_pVerticalDLB);
2133 0 : m_pExampleWN->SetVAlign(GetAlignment(pVMap, nMapPos, *m_pVerticalDLB, *m_pVertRelationLB));
2134 0 : m_pExampleWN->SetVertRel(GetRelation(pVMap, *m_pVertRelationLB));
2135 : }
2136 :
2137 : // size
2138 0 : long nXPos = static_cast< long >(m_pAtHorzPosED->Denormalize(m_pAtHorzPosED->GetValue(FUNIT_TWIP)));
2139 0 : long nYPos = static_cast< long >(m_pAtVertPosED->Denormalize(m_pAtVertPosED->GetValue(FUNIT_TWIP)));
2140 0 : m_pExampleWN->SetRelPos(Point(nXPos, nYPos));
2141 :
2142 0 : m_pExampleWN->SetAnchor( static_cast< sal_Int16 >(GetAnchor()) );
2143 0 : m_pExampleWN->Invalidate();
2144 0 : }
2145 :
2146 0 : void SwFrmPage::Init(const SfxItemSet& rSet, sal_Bool bReset)
2147 : {
2148 0 : if(!bFormat)
2149 : {
2150 0 : SwWrtShell* pSh = getFrmDlgParentShell();
2151 :
2152 : // size
2153 0 : const sal_Bool bSizeFixed = pSh->IsSelObjProtected( FLYPROTECT_FIXED );
2154 :
2155 0 : m_aWidthED .Enable( !bSizeFixed );
2156 0 : m_aHeightED.Enable( !bSizeFixed );
2157 :
2158 : // size controls for math OLE objects
2159 0 : if ( sDlgType == "ObjectDialog" && ! bNew )
2160 : {
2161 : // disable width and height for math objects
2162 0 : const SvGlobalName& rFactNm( pSh->GetOLEObject()->getClassID() );
2163 :
2164 : struct _GlobalNameId {
2165 : sal_uInt32 n1;
2166 : sal_uInt16 n2, n3;
2167 : sal_uInt8 b8, b9, b10, b11, b12, b13, b14, b15;
2168 : } aGlbNmIds[4] = { { SO3_SM_CLASSID_60 }, { SO3_SM_CLASSID_50 },
2169 0 : { SO3_SM_CLASSID_40 }, { SO3_SM_CLASSID_30 } };
2170 :
2171 0 : for ( int i = 0; i < 4; ++i ) {
2172 0 : const _GlobalNameId& rId = aGlbNmIds[ i ];
2173 :
2174 : SvGlobalName aGlbNm( rId.n1, rId.n2, rId.n3,
2175 : rId.b8, rId.b9, rId.b10, rId.b11,
2176 0 : rId.b12, rId.b13, rId.b14, rId.b15 );
2177 :
2178 0 : if( rFactNm == aGlbNm )
2179 : {
2180 : // disable size controls for math OLE objects
2181 0 : m_pWidthFT->Disable();
2182 0 : m_aWidthED.Disable();
2183 0 : m_pRelWidthCB->Disable();
2184 0 : m_pHeightFT->Disable();
2185 0 : m_aHeightED.Disable();
2186 0 : m_pRelHeightCB->Disable();
2187 0 : m_pFixedRatioCB->Disable();
2188 0 : m_pRealSizeBT->Disable();
2189 0 : break;
2190 : }
2191 0 : }
2192 :
2193 : // TODO/LATER: get correct aspect
2194 0 : if(0 != (pSh->GetOLEObject()->getStatus( embed::Aspects::MSOLE_CONTENT ) & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE ) )
2195 0 : m_pRealSizeBT->Disable();
2196 : }
2197 : }
2198 :
2199 0 : const SwFmtFrmSize& rSize = (const SwFmtFrmSize&)rSet.Get(RES_FRM_SIZE);
2200 0 : sal_Int64 nWidth = m_aWidthED.NormalizePercent(rSize.GetWidth());
2201 0 : sal_Int64 nHeight = m_aHeightED.NormalizePercent(rSize.GetHeight());
2202 :
2203 0 : if (nWidth != m_aWidthED.GetValue(FUNIT_TWIP))
2204 : {
2205 0 : if(!bReset)
2206 : {
2207 : // value was changed by circulation-Tabpage and
2208 : // has to be set with Modify-Flag
2209 0 : m_aWidthED.SetUserValue(nWidth, FUNIT_TWIP);
2210 : }
2211 : else
2212 0 : m_aWidthED.SetPrcntValue(nWidth, FUNIT_TWIP);
2213 : }
2214 :
2215 0 : if (nHeight != m_aHeightED.GetValue(FUNIT_TWIP))
2216 : {
2217 0 : if (!bReset)
2218 : {
2219 : // values was changed by circulation-Tabpage and
2220 : // has to be set with Modify-Flag
2221 0 : m_aHeightED.SetUserValue(nHeight, FUNIT_TWIP);
2222 : }
2223 : else
2224 0 : m_aHeightED.SetPrcntValue(nHeight, FUNIT_TWIP);
2225 : }
2226 :
2227 0 : if (!IsInGraficMode())
2228 : {
2229 0 : SwFrmSize eSize = rSize.GetHeightSizeType();
2230 0 : sal_Bool bCheck = eSize != ATT_FIX_SIZE;
2231 0 : m_pAutoHeightCB->Check( bCheck );
2232 0 : HandleAutoCB( bCheck, *m_pHeightFT, *m_pHeightAutoFT, *m_aWidthED.get() );
2233 0 : if( eSize == ATT_VAR_SIZE )
2234 0 : m_aHeightED.SetValue( m_aHeightED.GetMin(), FUNIT_NONE );
2235 :
2236 0 : eSize = rSize.GetWidthSizeType();
2237 0 : bCheck = eSize != ATT_FIX_SIZE;
2238 0 : m_pAutoWidthCB->Check( bCheck );
2239 0 : HandleAutoCB( bCheck, *m_pWidthFT, *m_pWidthAutoFT, *m_aWidthED.get() );
2240 0 : if( eSize == ATT_VAR_SIZE )
2241 0 : m_aWidthED.SetValue( m_aWidthED.GetMin(), FUNIT_NONE );
2242 :
2243 0 : if ( !bFormat )
2244 : {
2245 0 : SwWrtShell* pSh = getFrmDlgParentShell();
2246 0 : const SwFrmFmt* pFmt = pSh->GetFlyFrmFmt();
2247 0 : if( pFmt && pFmt->GetChain().GetNext() )
2248 0 : m_pAutoHeightCB->Enable( false );
2249 : }
2250 : }
2251 : else
2252 0 : m_pAutoHeightCB->Hide();
2253 :
2254 : // organise circulation-gap for character bound frames
2255 0 : const SvxULSpaceItem &rUL = (const SvxULSpaceItem &)rSet.Get(RES_UL_SPACE);
2256 0 : nUpperBorder = rUL.GetUpper();
2257 0 : nLowerBorder = rUL.GetLower();
2258 :
2259 0 : if(SFX_ITEM_SET == rSet.GetItemState(FN_KEEP_ASPECT_RATIO))
2260 : {
2261 0 : m_pFixedRatioCB->Check(((const SfxBoolItem&)rSet.Get(FN_KEEP_ASPECT_RATIO)).GetValue());
2262 0 : m_pFixedRatioCB->SaveValue();
2263 : }
2264 :
2265 : // columns
2266 0 : SwFmtCol aCol( (const SwFmtCol&)rSet.Get(RES_COL) );
2267 0 : ::FitToActualSize( aCol, (sal_uInt16)rSize.GetWidth() );
2268 :
2269 0 : RndStdIds eAnchorId = (RndStdIds)GetAnchor();
2270 :
2271 0 : if ( bNew && !bFormat )
2272 0 : InitPos(eAnchorId, -1, 0, -1, 0, LONG_MAX, LONG_MAX);
2273 : else
2274 : {
2275 0 : const SwFmtHoriOrient& rHori = (const SwFmtHoriOrient&)rSet.Get(RES_HORI_ORIENT);
2276 0 : const SwFmtVertOrient& rVert = (const SwFmtVertOrient&)rSet.Get(RES_VERT_ORIENT);
2277 0 : nOldH = rHori.GetHoriOrient();
2278 0 : nOldHRel = rHori.GetRelationOrient();
2279 0 : nOldV = rVert.GetVertOrient(),
2280 0 : nOldVRel = rVert.GetRelationOrient();
2281 :
2282 0 : if (eAnchorId == FLY_AT_PAGE)
2283 : {
2284 0 : if (nOldHRel == text::RelOrientation::FRAME)
2285 0 : nOldHRel = text::RelOrientation::PAGE_FRAME;
2286 0 : else if (nOldHRel == text::RelOrientation::PRINT_AREA)
2287 0 : nOldHRel = text::RelOrientation::PAGE_PRINT_AREA;
2288 0 : if (nOldVRel == text::RelOrientation::FRAME)
2289 0 : nOldVRel = text::RelOrientation::PAGE_FRAME;
2290 0 : else if (nOldVRel == text::RelOrientation::PRINT_AREA)
2291 0 : nOldVRel = text::RelOrientation::PAGE_PRINT_AREA;
2292 : }
2293 :
2294 0 : m_pMirrorPagesCB->Check(rHori.IsPosToggle());
2295 0 : m_pMirrorPagesCB->SaveValue();
2296 :
2297 : InitPos(eAnchorId,
2298 : nOldH,
2299 : nOldHRel,
2300 : nOldV,
2301 : nOldVRel,
2302 : rHori.GetPos(),
2303 0 : rVert.GetPos());
2304 : }
2305 :
2306 : // transparent for example
2307 : // circulation for example
2308 0 : const SwFmtSurround& rSurround = (const SwFmtSurround&)rSet.Get(RES_SURROUND);
2309 0 : m_pExampleWN->SetWrap ( static_cast< sal_uInt16 >(rSurround.GetSurround()) );
2310 :
2311 0 : if ( rSurround.GetSurround() == SURROUND_THROUGHT )
2312 : {
2313 0 : const SvxOpaqueItem& rOpaque = (const SvxOpaqueItem&)rSet.Get(RES_OPAQUE);
2314 0 : m_pExampleWN->SetTransparent(!rOpaque.GetValue());
2315 : }
2316 :
2317 : // switch to percent if applicable
2318 0 : RangeModifyHdl(&m_aWidthED); // set reference values (for 100%)
2319 :
2320 0 : if (rSize.GetWidthPercent() == 0xff || rSize.GetHeightPercent() == 0xff)
2321 0 : m_pFixedRatioCB->Check(true);
2322 0 : if (rSize.GetWidthPercent() && rSize.GetWidthPercent() != 0xff &&
2323 0 : !m_pRelWidthCB->IsChecked())
2324 : {
2325 0 : m_pRelWidthCB->Check(true);
2326 0 : RelSizeClickHdl(m_pRelWidthCB);
2327 0 : m_aWidthED.SetPrcntValue(rSize.GetWidthPercent(), FUNIT_CUSTOM);
2328 : }
2329 0 : if (rSize.GetHeightPercent() && rSize.GetHeightPercent() != 0xff &&
2330 0 : !m_pRelHeightCB->IsChecked())
2331 : {
2332 0 : m_pRelHeightCB->Check(true);
2333 0 : RelSizeClickHdl(m_pRelHeightCB);
2334 0 : m_aHeightED.SetPrcntValue(rSize.GetHeightPercent(), FUNIT_CUSTOM);
2335 : }
2336 0 : m_pRelWidthCB->SaveValue();
2337 0 : m_pRelHeightCB->SaveValue();
2338 :
2339 0 : if (rSize.GetWidthPercentRelation() == text::RelOrientation::PAGE_FRAME)
2340 0 : m_pRelWidthRelationLB->SelectEntryPos(1);
2341 : else
2342 0 : m_pRelWidthRelationLB->SelectEntryPos(0);
2343 :
2344 0 : if (rSize.GetHeightPercentRelation() == text::RelOrientation::PAGE_FRAME)
2345 0 : m_pRelHeightRelationLB->SelectEntryPos(1);
2346 : else
2347 0 : m_pRelHeightRelationLB->SelectEntryPos(0);
2348 0 : }
2349 :
2350 0 : sal_uInt16* SwFrmPage::GetRanges()
2351 : {
2352 0 : return aPageRg;
2353 : }
2354 :
2355 0 : void SwFrmPage::SetFormatUsed(sal_Bool bFmt)
2356 : {
2357 0 : bFormat = bFmt;
2358 0 : if(bFormat)
2359 : {
2360 0 : m_pAnchorFrame->Hide();
2361 : }
2362 0 : }
2363 :
2364 0 : void SwFrmPage::EnableVerticalPositioning( bool bEnable )
2365 : {
2366 0 : m_bAllowVertPositioning = bEnable;
2367 0 : m_pVerticalFT->Enable( bEnable );
2368 0 : m_pVerticalDLB->Enable( bEnable );
2369 0 : m_pAtVertPosFT->Enable( bEnable );
2370 0 : m_pAtVertPosED->Enable( bEnable );
2371 0 : m_pVertRelationFT->Enable( bEnable );
2372 0 : m_pVertRelationLB->Enable( bEnable );
2373 0 : }
2374 :
2375 0 : SwGrfExtPage::SwGrfExtPage(Window *pParent, const SfxItemSet &rSet)
2376 : : SfxTabPage(pParent, "PicturePage",
2377 : "modules/swriter/ui/picturepage.ui", rSet)
2378 0 : , pGrfDlg(0)
2379 : {
2380 0 : get(m_pMirror, "flipframe");
2381 0 : get(m_pMirrorVertBox, "vert");
2382 0 : get(m_pMirrorHorzBox, "hori");
2383 0 : get(m_pAllPagesRB, "allpages");
2384 0 : get(m_pLeftPagesRB, "leftpages");
2385 0 : get(m_pRightPagesRB, "rightpages");
2386 0 : get(m_pConnectED, "entry");
2387 0 : get(m_pBrowseBT, "browse");
2388 0 : get(m_pBmpWin, "preview");
2389 0 : m_pBmpWin->SetBitmapEx(get<FixedImage>("fallback")->GetImage().GetBitmapEx());
2390 :
2391 0 : SetExchangeSupport();
2392 0 : m_pMirrorHorzBox->SetClickHdl( LINK(this, SwGrfExtPage, MirrorHdl));
2393 0 : m_pMirrorVertBox->SetClickHdl( LINK(this, SwGrfExtPage, MirrorHdl));
2394 0 : m_pBrowseBT->SetClickHdl ( LINK(this, SwGrfExtPage, BrowseHdl));
2395 0 : }
2396 :
2397 0 : SwGrfExtPage::~SwGrfExtPage()
2398 : {
2399 0 : delete pGrfDlg;
2400 0 : }
2401 :
2402 0 : SfxTabPage* SwGrfExtPage::Create( Window *pParent, const SfxItemSet &rSet )
2403 : {
2404 0 : return new SwGrfExtPage( pParent, rSet );
2405 : }
2406 :
2407 0 : void SwGrfExtPage::Reset(const SfxItemSet &rSet)
2408 : {
2409 : const SfxPoolItem* pItem;
2410 0 : const sal_uInt16 nHtmlMode = ::GetHtmlMode((const SwDocShell*)SfxObjectShell::Current());
2411 0 : bHtmlMode = nHtmlMode & HTMLMODE_ON ? sal_True : sal_False;
2412 :
2413 0 : if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_GRF_CONNECT, true, &pItem)
2414 0 : && ((const SfxBoolItem *)pItem)->GetValue() )
2415 : {
2416 0 : m_pBrowseBT->Enable();
2417 0 : m_pConnectED->SetReadOnly(false);
2418 : }
2419 :
2420 0 : ActivatePage(rSet);
2421 0 : }
2422 :
2423 0 : void SwGrfExtPage::ActivatePage(const SfxItemSet& rSet)
2424 : {
2425 0 : const SvxProtectItem& rProt = (const SvxProtectItem& )rSet.Get(RES_PROTECT);
2426 0 : sal_Bool bProtCntnt = rProt.IsCntntProtected();
2427 :
2428 0 : const SfxPoolItem* pItem = 0;
2429 0 : sal_Bool bEnable = sal_False;
2430 0 : sal_Bool bEnableMirrorRB = sal_False;
2431 :
2432 0 : SfxItemState eState = rSet.GetItemState(RES_GRFATR_MIRRORGRF, true, &pItem);
2433 0 : if( SFX_ITEM_UNKNOWN != eState && !bProtCntnt && !bHtmlMode )
2434 : {
2435 0 : if( SFX_ITEM_SET != eState )
2436 0 : pItem = &rSet.Get( RES_GRFATR_MIRRORGRF );
2437 :
2438 0 : bEnable = sal_True;
2439 :
2440 0 : MirrorGraph eMirror = static_cast< MirrorGraph >(((const SwMirrorGrf* )pItem)->GetValue());
2441 0 : switch( eMirror )
2442 : {
2443 0 : case RES_MIRROR_GRAPH_DONT: break;
2444 0 : case RES_MIRROR_GRAPH_VERT: m_pMirrorHorzBox->Check(true); break;
2445 0 : case RES_MIRROR_GRAPH_HOR: m_pMirrorVertBox->Check(true); break;
2446 0 : case RES_MIRROR_GRAPH_BOTH: m_pMirrorHorzBox->Check(true);
2447 0 : m_pMirrorVertBox->Check(true);
2448 0 : break;
2449 : default:
2450 : ;
2451 : }
2452 :
2453 0 : const int nPos = (((const SwMirrorGrf* )pItem)->IsGrfToggle() ? 1 : 0)
2454 0 : + ((eMirror == RES_MIRROR_GRAPH_VERT || eMirror == RES_MIRROR_GRAPH_BOTH) ? 2 : 0);
2455 :
2456 0 : bEnableMirrorRB = nPos != 0;
2457 :
2458 0 : switch (nPos)
2459 : {
2460 : case 1: // mirror at left / even pages
2461 0 : m_pLeftPagesRB->Check();
2462 0 : m_pMirrorHorzBox->Check(true);
2463 0 : break;
2464 : case 2: // mirror on all pages
2465 0 : m_pAllPagesRB->Check();
2466 0 : break;
2467 : case 3: // mirror on right / odd pages
2468 0 : m_pRightPagesRB->Check();
2469 0 : break;
2470 : default:
2471 0 : m_pAllPagesRB->Check();
2472 0 : break;
2473 : }
2474 : }
2475 :
2476 0 : if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_GRAF_GRAPHIC, false, &pItem ) )
2477 : {
2478 0 : const SvxBrushItem& rBrush = *(SvxBrushItem*)pItem;
2479 0 : if( !rBrush.GetGraphicLink().isEmpty() )
2480 : {
2481 0 : aGrfName = aNewGrfName = rBrush.GetGraphicLink();
2482 0 : m_pConnectED->SetText( aNewGrfName );
2483 : }
2484 0 : OUString referer;
2485 : SfxStringItem const * it = static_cast<SfxStringItem const *>(
2486 0 : rSet.GetItem(SID_REFERER));
2487 0 : if (it != 0) {
2488 0 : referer = it->GetValue();
2489 : }
2490 0 : const Graphic* pGrf = rBrush.GetGraphic(referer);
2491 0 : if( pGrf )
2492 0 : m_pBmpWin->SetGraphic( *pGrf );
2493 : }
2494 :
2495 0 : m_pAllPagesRB->Enable(bEnableMirrorRB);
2496 0 : m_pLeftPagesRB->Enable(bEnableMirrorRB);
2497 0 : m_pRightPagesRB->Enable(bEnableMirrorRB);
2498 0 : m_pMirror->Enable(bEnable);
2499 :
2500 0 : m_pAllPagesRB->SaveValue();
2501 0 : m_pLeftPagesRB->SaveValue();
2502 0 : m_pRightPagesRB->SaveValue();
2503 0 : m_pMirrorHorzBox->SaveValue();
2504 0 : m_pMirrorVertBox->SaveValue();
2505 :
2506 0 : m_pBmpWin->MirrorHorz( m_pMirrorVertBox->IsChecked() );
2507 0 : m_pBmpWin->MirrorVert( m_pMirrorHorzBox->IsChecked() );
2508 0 : m_pBmpWin->Invalidate();
2509 0 : }
2510 :
2511 0 : bool SwGrfExtPage::FillItemSet( SfxItemSet &rSet )
2512 : {
2513 0 : sal_Bool bModified = sal_False;
2514 0 : if ( m_pMirrorHorzBox->GetSavedValue() != TriState(m_pMirrorHorzBox->IsChecked()) ||
2515 0 : m_pMirrorVertBox->GetSavedValue() != TriState(m_pMirrorVertBox->IsChecked()) ||
2516 0 : m_pAllPagesRB->GetSavedValue() != m_pAllPagesRB->IsChecked() ||
2517 0 : m_pLeftPagesRB->GetSavedValue() != m_pLeftPagesRB->IsChecked() ||
2518 0 : m_pRightPagesRB->GetSavedValue() != m_pRightPagesRB->IsChecked())
2519 : {
2520 0 : bModified = sal_True;
2521 :
2522 0 : bool bHori = false;
2523 :
2524 0 : if (m_pMirrorHorzBox->IsChecked() &&
2525 0 : !m_pLeftPagesRB->IsChecked())
2526 0 : bHori = true;
2527 :
2528 : MirrorGraph eMirror;
2529 0 : eMirror = m_pMirrorVertBox->IsChecked() && bHori ?
2530 : RES_MIRROR_GRAPH_BOTH : bHori ?
2531 0 : RES_MIRROR_GRAPH_VERT : m_pMirrorVertBox->IsChecked() ?
2532 0 : RES_MIRROR_GRAPH_HOR : RES_MIRROR_GRAPH_DONT;
2533 :
2534 0 : sal_Bool bMirror = !m_pAllPagesRB->IsChecked();
2535 0 : SwMirrorGrf aMirror( eMirror );
2536 0 : aMirror.SetGrfToggle(bMirror );
2537 0 : rSet.Put( aMirror );
2538 : }
2539 :
2540 0 : if( aGrfName != aNewGrfName || m_pConnectED->IsModified() )
2541 : {
2542 0 : bModified = sal_True;
2543 0 : aGrfName = m_pConnectED->GetText();
2544 : rSet.Put( SvxBrushItem( aGrfName, aFilterName, GPOS_LT,
2545 0 : SID_ATTR_GRAF_GRAPHIC ));
2546 : }
2547 0 : return bModified;
2548 : }
2549 :
2550 0 : int SwGrfExtPage::DeactivatePage(SfxItemSet *_pSet)
2551 : {
2552 0 : if( _pSet )
2553 0 : FillItemSet( *_pSet );
2554 0 : return sal_True;
2555 : }
2556 :
2557 0 : IMPL_LINK_NOARG(SwGrfExtPage, BrowseHdl)
2558 : {
2559 0 : if(!pGrfDlg)
2560 : {
2561 : pGrfDlg = new FileDialogHelper(
2562 : ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW,
2563 0 : SFXWB_GRAPHIC );
2564 0 : pGrfDlg->SetTitle(get<VclFrame>("linkframe")->get_label());
2565 : }
2566 0 : pGrfDlg->SetDisplayDirectory( m_pConnectED->GetText() );
2567 0 : uno::Reference < ui::dialogs::XFilePicker > xFP = pGrfDlg->GetFilePicker();
2568 0 : uno::Reference < ui::dialogs::XFilePickerControlAccess > xCtrlAcc(xFP, uno::UNO_QUERY);
2569 0 : sal_Bool bTrue = sal_True;
2570 0 : uno::Any aVal(&bTrue, ::getBooleanCppuType());
2571 0 : xCtrlAcc->setValue( ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, aVal);
2572 :
2573 0 : if ( pGrfDlg->Execute() == ERRCODE_NONE )
2574 : { // remember selected filter
2575 0 : aFilterName = pGrfDlg->GetCurrentFilter();
2576 0 : aNewGrfName = INetURLObject::decode( pGrfDlg->GetPath(),
2577 : '%',
2578 : INetURLObject::DECODE_UNAMBIGUOUS,
2579 0 : RTL_TEXTENCODING_UTF8 );
2580 0 : m_pConnectED->SetModifyFlag();
2581 0 : m_pConnectED->SetText( aNewGrfName );
2582 : //reset mirrors because maybe a Bitmap was swapped with
2583 : //another type of graphic that cannot be mirrored.
2584 0 : m_pMirrorVertBox->Check(false);
2585 0 : m_pMirrorHorzBox->Check(false);
2586 0 : m_pAllPagesRB->Enable(false);
2587 0 : m_pLeftPagesRB->Enable(false);
2588 0 : m_pRightPagesRB->Enable(false);
2589 0 : m_pBmpWin->MirrorHorz(sal_False);
2590 0 : m_pBmpWin->MirrorVert(sal_False);
2591 :
2592 0 : Graphic aGraphic;
2593 0 : GraphicFilter::LoadGraphic( pGrfDlg->GetPath(), aEmptyOUStr, aGraphic );
2594 0 : m_pBmpWin->SetGraphic(aGraphic);
2595 :
2596 0 : sal_Bool bEnable = GRAPHIC_BITMAP == aGraphic.GetType() ||
2597 0 : GRAPHIC_GDIMETAFILE == aGraphic.GetType();
2598 0 : m_pMirrorVertBox->Enable(bEnable);
2599 0 : m_pMirrorHorzBox->Enable(bEnable);
2600 0 : m_pAllPagesRB->Enable(bEnable);
2601 0 : m_pLeftPagesRB->Enable(bEnable);
2602 0 : m_pRightPagesRB->Enable(bEnable);
2603 : }
2604 0 : return 0;
2605 : }
2606 :
2607 0 : IMPL_LINK_NOARG(SwGrfExtPage, MirrorHdl)
2608 : {
2609 0 : sal_Bool bEnable = m_pMirrorHorzBox->IsChecked();
2610 :
2611 0 : m_pBmpWin->MirrorHorz( m_pMirrorVertBox->IsChecked() );
2612 0 : m_pBmpWin->MirrorVert( bEnable );
2613 :
2614 0 : m_pAllPagesRB->Enable(bEnable);
2615 0 : m_pLeftPagesRB->Enable(bEnable);
2616 0 : m_pRightPagesRB->Enable(bEnable);
2617 :
2618 0 : if (!m_pAllPagesRB->IsChecked() && !m_pLeftPagesRB->IsChecked() && !m_pRightPagesRB->IsChecked())
2619 0 : m_pAllPagesRB->Check();
2620 :
2621 0 : return 0;
2622 : }
2623 :
2624 : /*--------------------------------------------------------------------
2625 : Description: example window
2626 : --------------------------------------------------------------------*/
2627 0 : BmpWindow::BmpWindow(Window* pPar, WinBits nStyle)
2628 : : Window(pPar, nStyle)
2629 : , bHorz(false)
2630 : , bVert(false)
2631 : , bGraphic(false)
2632 0 : , bLeftAlign(false)
2633 : {
2634 : // #i119307# use background, the graphic might have transparency
2635 0 : SetBackground(Wallpaper(Color(COL_WHITE)));
2636 0 : }
2637 :
2638 0 : Size BmpWindow::GetOptimalSize() const
2639 : {
2640 0 : return LogicToPixel(Size(127 , 66), MapMode(MAP_APPFONT));
2641 : }
2642 :
2643 0 : extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeBmpWindow(Window *pParent, VclBuilder::stringmap &)
2644 : {
2645 0 : return new BmpWindow(pParent, 0);
2646 : }
2647 :
2648 0 : void BmpWindow::Paint( const Rectangle& )
2649 : {
2650 0 : Point aPntPos;
2651 0 : Size aPntSz( GetSizePixel() );
2652 0 : Size aGrfSize;
2653 0 : if(bGraphic)
2654 0 : aGrfSize = ::GetGraphicSizeTwip(aGraphic, this);
2655 : //it should show the default bitmap also if no graphic can be found
2656 0 : if(!aGrfSize.Width() && !aGrfSize.Height())
2657 0 : aGrfSize = PixelToLogic(aBmp.GetSizePixel());
2658 :
2659 0 : long nRelGrf = aGrfSize.Width() * 100L / aGrfSize.Height();
2660 0 : long nRelWin = aPntSz.Width() * 100L / aPntSz.Height();
2661 0 : if(nRelGrf < nRelWin)
2662 : {
2663 0 : const long nWidth = aPntSz.Width();
2664 : // if we use a replacement preview, try to draw at original size
2665 0 : if ( !bGraphic && ( aGrfSize.Width() <= aPntSz.Width() ) && ( aGrfSize.Height() <= aPntSz.Height() ) )
2666 : {
2667 0 : const long nHeight = aPntSz.Height();
2668 0 : aPntSz.Width() = aGrfSize.Width();
2669 0 : aPntSz.Height() = aGrfSize.Height();
2670 0 : aPntPos.Y() += (nHeight - aPntSz.Height()) / 2;
2671 : }
2672 : else
2673 0 : aPntSz.Width() = aPntSz.Height() * nRelGrf /100;
2674 :
2675 0 : if(!bLeftAlign)
2676 0 : aPntPos.X() += nWidth - aPntSz.Width() ;
2677 : }
2678 :
2679 0 : if ( bHorz )
2680 : {
2681 0 : aPntPos.Y() += aPntSz.Height();
2682 0 : aPntPos.Y() --;
2683 0 : aPntSz.Height() *= -1;
2684 : }
2685 0 : if ( bVert )
2686 : {
2687 0 : aPntPos.X() += aPntSz.Width();
2688 0 : aPntPos.X()--;
2689 0 : aPntSz.Width() *= -1;
2690 : }
2691 :
2692 : // #i119307# clear window background, the graphic might have transparency
2693 0 : Erase();
2694 :
2695 0 : if ( bGraphic )
2696 0 : aGraphic.Draw( this, aPntPos, aPntSz );
2697 : else
2698 : {
2699 0 : DrawBitmapEx( aPntPos, aPntSz, aBmp );
2700 : }
2701 0 : }
2702 :
2703 0 : BmpWindow::~BmpWindow()
2704 : {
2705 0 : }
2706 :
2707 0 : void BmpWindow::SetGraphic(const Graphic& rGrf)
2708 : {
2709 0 : aGraphic = rGrf;
2710 0 : Size aGrfSize = ::GetGraphicSizeTwip(aGraphic, this);
2711 0 : bGraphic = aGrfSize.Width() && aGrfSize.Height();
2712 0 : Invalidate();
2713 0 : }
2714 :
2715 0 : void BmpWindow::SetBitmapEx(const BitmapEx& rBmp)
2716 : {
2717 0 : aBmp = rBmp;
2718 0 : Invalidate();
2719 0 : }
2720 :
2721 : /***************************************************************************
2722 : Description: set URL and ImageMap at frames
2723 : ***************************************************************************/
2724 0 : SwFrmURLPage::SwFrmURLPage( Window *pParent, const SfxItemSet &rSet ) :
2725 0 : SfxTabPage(pParent, "FrmURLPage" , "modules/swriter/ui/frmurlpage.ui", rSet)
2726 : {
2727 0 : get(pURLED,"url");
2728 0 : get(pSearchPB,"search");
2729 0 : get(pNameED,"name");
2730 0 : get(pFrameCB,"frame");
2731 :
2732 0 : get(pServerCB,"server");
2733 0 : get(pClientCB,"client");
2734 :
2735 0 : pSearchPB->SetClickHdl(LINK(this, SwFrmURLPage, InsertFileHdl));
2736 0 : }
2737 :
2738 0 : SwFrmURLPage::~SwFrmURLPage()
2739 : {
2740 0 : }
2741 :
2742 0 : void SwFrmURLPage::Reset( const SfxItemSet &rSet )
2743 : {
2744 : const SfxPoolItem* pItem;
2745 0 : if ( SFX_ITEM_SET == rSet.GetItemState( SID_DOCFRAME, true, &pItem))
2746 : {
2747 0 : TargetList* pList = new TargetList;
2748 0 : ((const SfxFrameItem*)pItem)->GetFrame()->GetTargetList(*pList);
2749 0 : if( !pList->empty() )
2750 : {
2751 0 : size_t nCount = pList->size();
2752 0 : for ( size_t i = 0; i < nCount; i++ )
2753 : {
2754 0 : pFrameCB->InsertEntry( pList->at( i ) );
2755 : }
2756 : }
2757 0 : delete pList;
2758 : }
2759 :
2760 0 : if ( SFX_ITEM_SET == rSet.GetItemState( RES_URL, true, &pItem ) )
2761 : {
2762 0 : const SwFmtURL* pFmtURL = (const SwFmtURL*)pItem;
2763 : pURLED->SetText( INetURLObject::decode( pFmtURL->GetURL(),
2764 : '%',
2765 : INetURLObject::DECODE_UNAMBIGUOUS,
2766 0 : RTL_TEXTENCODING_UTF8 ));
2767 0 : pNameED->SetText( pFmtURL->GetName());
2768 :
2769 0 : pClientCB->Enable( pFmtURL->GetMap() != 0 );
2770 0 : pClientCB->Check ( pFmtURL->GetMap() != 0 );
2771 0 : pServerCB->Check ( pFmtURL->IsServerMap() );
2772 :
2773 0 : pFrameCB->SetText(pFmtURL->GetTargetFrameName());
2774 0 : pFrameCB->SaveValue();
2775 : }
2776 : else
2777 0 : pClientCB->Enable( false );
2778 :
2779 0 : pServerCB->SaveValue();
2780 0 : pClientCB->SaveValue();
2781 0 : }
2782 :
2783 0 : bool SwFrmURLPage::FillItemSet(SfxItemSet &rSet)
2784 : {
2785 0 : sal_Bool bModified = sal_False;
2786 0 : const SwFmtURL* pOldURL = (SwFmtURL*)GetOldItem(rSet, RES_URL);
2787 : SwFmtURL* pFmtURL;
2788 0 : if(pOldURL)
2789 0 : pFmtURL = (SwFmtURL*)pOldURL->Clone();
2790 : else
2791 0 : pFmtURL = new SwFmtURL();
2792 :
2793 : {
2794 0 : const OUString sText = pURLED->GetText();
2795 :
2796 0 : if( pFmtURL->GetURL() != sText ||
2797 0 : pFmtURL->GetName() != pNameED->GetText() ||
2798 0 : pServerCB->IsChecked() != pFmtURL->IsServerMap() )
2799 : {
2800 0 : pFmtURL->SetURL( sText, pServerCB->IsChecked() );
2801 0 : pFmtURL->SetName( pNameED->GetText() );
2802 0 : bModified = sal_True;
2803 0 : }
2804 : }
2805 :
2806 0 : if(!pClientCB->IsChecked() && pFmtURL->GetMap() != 0)
2807 : {
2808 0 : pFmtURL->SetMap(0);
2809 0 : bModified = sal_True;
2810 : }
2811 :
2812 0 : if(pFmtURL->GetTargetFrameName() != pFrameCB->GetText())
2813 : {
2814 0 : pFmtURL->SetTargetFrameName(pFrameCB->GetText());
2815 0 : bModified = sal_True;
2816 : }
2817 0 : rSet.Put(*pFmtURL);
2818 0 : delete pFmtURL;
2819 0 : return bModified;
2820 : }
2821 :
2822 0 : SfxTabPage* SwFrmURLPage::Create(Window *pParent, const SfxItemSet &rSet)
2823 : {
2824 0 : return new SwFrmURLPage( pParent, rSet );
2825 : }
2826 :
2827 0 : IMPL_LINK_NOARG(SwFrmURLPage, InsertFileHdl)
2828 : {
2829 0 : FileDialogHelper aDlgHelper( ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, 0 );
2830 0 : uno::Reference < ui::dialogs::XFilePicker > xFP = aDlgHelper.GetFilePicker();
2831 :
2832 : try
2833 : {
2834 0 : const OUString sTemp(pURLED->GetText());
2835 0 : if(!sTemp.isEmpty())
2836 0 : xFP->setDisplayDirectory(sTemp);
2837 : }
2838 0 : catch( const uno::Exception& rEx )
2839 : {
2840 : (void) rEx;
2841 : }
2842 0 : if( aDlgHelper.Execute() == ERRCODE_NONE )
2843 : {
2844 0 : pURLED->SetText( xFP->getFiles().getConstArray()[0] );
2845 : }
2846 :
2847 0 : return 0;
2848 : }
2849 :
2850 0 : SwFrmAddPage::SwFrmAddPage(Window *pParent, const SfxItemSet &rSet)
2851 : : SfxTabPage(pParent, "FrmAddPage" , "modules/swriter/ui/frmaddpage.ui", rSet)
2852 : , pWrtSh(0)
2853 : , bHtmlMode(sal_False)
2854 : , bFormat(sal_False)
2855 0 : , bNew(sal_False)
2856 : {
2857 0 : get(pNameFrame, "nameframe");
2858 0 : get(pNameFT,"name_label");
2859 0 : get(pNameED,"name");
2860 0 : get(pAltNameFT,"altname_label");
2861 0 : get(pAltNameED,"altname");
2862 0 : get(pPrevFT,"prev_label");
2863 0 : get(pPrevLB,"prev");
2864 0 : get(pNextFT,"next_label");
2865 0 : get(pNextLB,"next");
2866 :
2867 0 : get(pProtectFrame,"protect");
2868 0 : get(pProtectContentCB,"protectcontent");
2869 0 : get(pProtectFrameCB,"protectframe");
2870 0 : get(pProtectSizeCB,"protectsize");
2871 :
2872 0 : get(m_pContentAlignFrame, "contentalign");
2873 0 : get(m_pVertAlignLB,"vertalign");
2874 :
2875 0 : get(pPropertiesFrame,"properties");
2876 0 : get(pEditInReadonlyCB,"editinreadonly");
2877 0 : get(pPrintFrameCB,"printframe");
2878 0 : get(pTextFlowFT,"textflow_label");
2879 0 : get(pTextFlowLB,"textflow");
2880 :
2881 0 : }
2882 :
2883 0 : SwFrmAddPage::~SwFrmAddPage()
2884 : {
2885 0 : }
2886 :
2887 0 : SfxTabPage* SwFrmAddPage::Create(Window *pParent, const SfxItemSet &rSet)
2888 : {
2889 0 : return new SwFrmAddPage(pParent, rSet);
2890 : }
2891 :
2892 0 : void SwFrmAddPage::Reset(const SfxItemSet &rSet )
2893 : {
2894 : const SfxPoolItem* pItem;
2895 0 : sal_uInt16 nHtmlMode = ::GetHtmlMode((const SwDocShell*)SfxObjectShell::Current());
2896 0 : bHtmlMode = nHtmlMode & HTMLMODE_ON ? sal_True : sal_False;
2897 0 : if (bHtmlMode)
2898 : {
2899 0 : pProtectFrame->Hide();
2900 0 : pEditInReadonlyCB->Hide();
2901 0 : pPrintFrameCB->Hide();
2902 : }
2903 0 : if (sDlgType == "PictureDialog" || sDlgType == "ObjectDialog")
2904 : {
2905 0 : pEditInReadonlyCB->Hide();
2906 0 : if (bHtmlMode)
2907 : {
2908 0 : pPropertiesFrame->Hide();
2909 : }
2910 0 : m_pContentAlignFrame->Hide();
2911 : }
2912 :
2913 0 : if(SFX_ITEM_SET == rSet.GetItemState(FN_SET_FRM_ALT_NAME, false, &pItem))
2914 : {
2915 0 : pAltNameED->SetText(((const SfxStringItem*)pItem)->GetValue());
2916 0 : pAltNameED->SaveValue();
2917 : }
2918 :
2919 0 : if(!bFormat)
2920 : {
2921 : // insert graphic - properties
2922 : // bNew is not set, so recognise by selection
2923 0 : OUString aTmpName1;
2924 0 : if(SFX_ITEM_SET == rSet.GetItemState(FN_SET_FRM_NAME, false, &pItem))
2925 : {
2926 0 : aTmpName1 = ((const SfxStringItem*)pItem)->GetValue();
2927 : }
2928 :
2929 : OSL_ENSURE(pWrtSh, "keine Shell?");
2930 0 : if( bNew || aTmpName1.isEmpty() )
2931 : {
2932 0 : if (sDlgType == "PictureDialog")
2933 0 : aTmpName1 = pWrtSh->GetUniqueGrfName();
2934 0 : else if (sDlgType == "ObjectDialog")
2935 0 : aTmpName1 = pWrtSh->GetUniqueOLEName();
2936 : else
2937 0 : aTmpName1 = pWrtSh->GetUniqueFrameName();
2938 : }
2939 :
2940 0 : pNameED->SetText( aTmpName1 );
2941 0 : pNameED->SaveValue();
2942 : }
2943 : else
2944 : {
2945 0 : pNameED->Enable( false );
2946 0 : pAltNameED->Enable(false);
2947 0 : pNameFT->Enable( false );
2948 0 : pAltNameFT->Enable(false);
2949 : }
2950 0 : if (sDlgType == "FrameDialog" && pAltNameFT->IsVisible())
2951 : {
2952 0 : pAltNameFT->Hide();
2953 0 : pAltNameED->Hide();
2954 : }
2955 : else
2956 : {
2957 0 : pNameED->SetModifyHdl(LINK(this, SwFrmAddPage, EditModifyHdl));
2958 : }
2959 :
2960 0 : if (!bNew)
2961 : {
2962 0 : SwFrmFmt* pFmt = pWrtSh->GetFlyFrmFmt();
2963 :
2964 0 : if (pFmt)
2965 : {
2966 0 : const SwFmtChain &rChain = pFmt->GetChain();
2967 : const SwFlyFrmFmt* pFlyFmt;
2968 0 : OUString sNextChain, sPrevChain;
2969 0 : if ((pFlyFmt = rChain.GetPrev()) != 0)
2970 : {
2971 0 : sPrevChain = pFlyFmt->GetName();
2972 : }
2973 :
2974 0 : if ((pFlyFmt = rChain.GetNext()) != 0)
2975 : {
2976 0 : sNextChain = pFlyFmt->GetName();
2977 : }
2978 : //determine chainable frames
2979 0 : ::std::vector< OUString > aPrevPageFrames;
2980 0 : ::std::vector< OUString > aThisPageFrames;
2981 0 : ::std::vector< OUString > aNextPageFrames;
2982 0 : ::std::vector< OUString > aRemainFrames;
2983 : pWrtSh->GetConnectableFrmFmts(*pFmt, sNextChain, sal_False,
2984 0 : aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames );
2985 0 : lcl_InsertVectors(*pPrevLB, aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames);
2986 0 : if(!sPrevChain.isEmpty())
2987 : {
2988 0 : if(LISTBOX_ENTRY_NOTFOUND == pPrevLB->GetEntryPos(sPrevChain))
2989 0 : pPrevLB->InsertEntry(sPrevChain, 1);
2990 0 : pPrevLB->SelectEntry(sPrevChain);
2991 : }
2992 : else
2993 0 : pPrevLB->SelectEntryPos(0);
2994 0 : aPrevPageFrames.erase(aPrevPageFrames.begin(), aPrevPageFrames.end());
2995 0 : aNextPageFrames.erase(aNextPageFrames.begin(), aNextPageFrames.end());
2996 0 : aThisPageFrames.erase(aThisPageFrames.begin(), aThisPageFrames.end());
2997 0 : aRemainFrames.erase(aRemainFrames.begin(), aRemainFrames.end());
2998 :
2999 : pWrtSh->GetConnectableFrmFmts(*pFmt, sPrevChain, sal_True,
3000 0 : aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames );
3001 0 : lcl_InsertVectors(*pNextLB, aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames);
3002 0 : if(!sNextChain.isEmpty())
3003 : {
3004 0 : if(LISTBOX_ENTRY_NOTFOUND == pNextLB->GetEntryPos(sNextChain))
3005 0 : pNextLB->InsertEntry(sNextChain, 1);
3006 0 : pNextLB->SelectEntry(sNextChain);
3007 : }
3008 : else
3009 0 : pNextLB->SelectEntryPos(0);
3010 0 : Link aLink(LINK(this, SwFrmAddPage, ChainModifyHdl));
3011 0 : pPrevLB->SetSelectHdl(aLink);
3012 0 : pNextLB->SetSelectHdl(aLink);
3013 : }
3014 : }
3015 : // Pos Protected
3016 0 : const SvxProtectItem& rProt = (const SvxProtectItem& )rSet.Get(RES_PROTECT);
3017 0 : pProtectFrameCB->Check(rProt.IsPosProtected());
3018 0 : pProtectContentCB->Check(rProt.IsCntntProtected());
3019 0 : pProtectSizeCB->Check(rProt.IsSizeProtected());
3020 :
3021 0 : const SwFmtEditInReadonly& rEdit = (const SwFmtEditInReadonly& )rSet.Get(RES_EDIT_IN_READONLY);
3022 0 : pEditInReadonlyCB->Check(rEdit.GetValue()); pEditInReadonlyCB->SaveValue();
3023 :
3024 : // print
3025 0 : const SvxPrintItem& rPrt = (const SvxPrintItem&)rSet.Get(RES_PRINT);
3026 0 : pPrintFrameCB->Check(rPrt.GetValue()); pPrintFrameCB->SaveValue();
3027 :
3028 : // textflow
3029 : SfxItemState eState;
3030 0 : if( (!bHtmlMode || (0 != (nHtmlMode&HTMLMODE_SOME_STYLES)))
3031 0 : && sDlgType != "PictureDialog" && sDlgType != "ObjectDialog" &&
3032 : SFX_ITEM_UNKNOWN != ( eState = rSet.GetItemState(
3033 : RES_FRAMEDIR, true )) )
3034 : {
3035 0 : pTextFlowFT->Show();
3036 0 : pTextFlowLB->Show();
3037 :
3038 : //vertical text flow is not possible in HTML
3039 0 : if(bHtmlMode)
3040 : {
3041 0 : sal_uLong nData = FRMDIR_VERT_TOP_RIGHT;
3042 0 : pTextFlowLB->RemoveEntry(pTextFlowLB->GetEntryPos((void*)nData));
3043 : }
3044 0 : sal_uInt16 nVal = ((SvxFrameDirectionItem&)rSet.Get(RES_FRAMEDIR)).GetValue();
3045 : sal_Int32 nPos;
3046 0 : for( nPos = pTextFlowLB->GetEntryCount(); nPos; )
3047 0 : if( (sal_uInt16)(sal_IntPtr)pTextFlowLB->GetEntryData( --nPos ) == nVal )
3048 0 : break;
3049 0 : pTextFlowLB->SelectEntryPos( nPos );
3050 0 : pTextFlowLB->SaveValue();
3051 : }
3052 : else
3053 : {
3054 0 : pTextFlowFT->Hide();
3055 0 : pTextFlowLB->Hide();
3056 : }
3057 :
3058 : // Content alignment
3059 0 : if ( rSet.GetItemState(RES_TEXT_VERT_ADJUST) > SFX_ITEM_AVAILABLE )
3060 : {
3061 0 : SdrTextVertAdjust nAdjust = ((const SdrTextVertAdjustItem&)rSet.Get(RES_TEXT_VERT_ADJUST)).GetValue();
3062 0 : sal_Int32 nPos = 0;
3063 0 : switch(nAdjust)
3064 : {
3065 0 : case SDRTEXTVERTADJUST_TOP: nPos = 0; break;
3066 : case SDRTEXTVERTADJUST_CENTER:
3067 0 : case SDRTEXTVERTADJUST_BLOCK: nPos = 1; break;
3068 0 : case SDRTEXTVERTADJUST_BOTTOM: nPos = 2; break;
3069 : }
3070 0 : m_pVertAlignLB->SelectEntryPos(nPos);
3071 : }
3072 0 : m_pVertAlignLB->SaveValue();
3073 0 : }
3074 :
3075 0 : bool SwFrmAddPage::FillItemSet(SfxItemSet &rSet)
3076 : {
3077 0 : bool bRet = false;
3078 0 : if (pNameED->GetText() != pNameED->GetSavedValue())
3079 0 : bRet |= 0 != rSet.Put(SfxStringItem(FN_SET_FRM_NAME, pNameED->GetText()));
3080 0 : if (pAltNameED->GetText() != pAltNameED->GetSavedValue())
3081 0 : bRet |= 0 != rSet.Put(SfxStringItem(FN_SET_FRM_ALT_NAME, pAltNameED->GetText()));
3082 :
3083 : const SfxPoolItem* pOldItem;
3084 0 : SvxProtectItem aProt ( (const SvxProtectItem& )GetItemSet().Get(RES_PROTECT) );
3085 0 : aProt.SetCntntProtect( pProtectContentCB->IsChecked() );
3086 0 : aProt.SetSizeProtect ( pProtectSizeCB->IsChecked() );
3087 0 : aProt.SetPosProtect ( pProtectFrameCB->IsChecked() );
3088 0 : if ( 0 == (pOldItem = GetOldItem(rSet, FN_SET_PROTECT)) ||
3089 0 : aProt != *pOldItem )
3090 0 : bRet |= 0 != rSet.Put( aProt);
3091 :
3092 : sal_Bool bChecked;
3093 0 : if ( (bChecked = pEditInReadonlyCB->IsChecked()) != pEditInReadonlyCB->GetSavedValue() )
3094 0 : bRet |= 0 != rSet.Put( SwFmtEditInReadonly( RES_EDIT_IN_READONLY, bChecked));
3095 :
3096 0 : if ( (bChecked = pPrintFrameCB->IsChecked()) != pPrintFrameCB->GetSavedValue() )
3097 0 : bRet |= 0 != rSet.Put( SvxPrintItem( RES_PRINT, bChecked));
3098 :
3099 : // textflow
3100 0 : if( pTextFlowLB->IsVisible() )
3101 : {
3102 0 : sal_Int32 nPos = pTextFlowLB->GetSelectEntryPos();
3103 0 : if( nPos != pTextFlowLB->GetSavedValue() )
3104 : {
3105 0 : sal_uInt16 nData = (sal_uInt16)(sal_IntPtr)pTextFlowLB->GetEntryData( nPos );
3106 : bRet |= 0 != rSet.Put( SvxFrameDirectionItem(
3107 0 : (SvxFrameDirection)nData, RES_FRAMEDIR ));
3108 : }
3109 : }
3110 0 : if(pWrtSh)
3111 : {
3112 0 : const SwFrmFmt* pFmt = pWrtSh->GetFlyFrmFmt();
3113 0 : if (pFmt)
3114 : {
3115 0 : OUString sCurrentPrevChain, sCurrentNextChain;
3116 0 : if(pPrevLB->GetSelectEntryPos())
3117 0 : sCurrentPrevChain = pPrevLB->GetSelectEntry();
3118 0 : if(pNextLB->GetSelectEntryPos())
3119 0 : sCurrentNextChain = pNextLB->GetSelectEntry();
3120 0 : const SwFmtChain &rChain = pFmt->GetChain();
3121 : const SwFlyFrmFmt* pFlyFmt;
3122 0 : OUString sNextChain, sPrevChain;
3123 0 : if ((pFlyFmt = rChain.GetPrev()) != 0)
3124 0 : sPrevChain = pFlyFmt->GetName();
3125 :
3126 0 : if ((pFlyFmt = rChain.GetNext()) != 0)
3127 0 : sNextChain = pFlyFmt->GetName();
3128 0 : if(sPrevChain != sCurrentPrevChain)
3129 0 : bRet |= 0 != rSet.Put(SfxStringItem(FN_PARAM_CHAIN_PREVIOUS, sCurrentPrevChain));
3130 0 : if(sNextChain != sCurrentNextChain)
3131 0 : bRet |= 0 != rSet.Put(SfxStringItem(FN_PARAM_CHAIN_NEXT, sCurrentNextChain));
3132 : }
3133 : }
3134 :
3135 0 : if(m_pVertAlignLB->GetSelectEntryPos() != m_pVertAlignLB->GetSavedValue())
3136 : {
3137 : SdrTextVertAdjust nAdjust;
3138 0 : switch(m_pVertAlignLB->GetSelectEntryPos())
3139 : {
3140 : default:
3141 0 : case 0 : nAdjust = SDRTEXTVERTADJUST_TOP; break;
3142 0 : case 1 : nAdjust = SDRTEXTVERTADJUST_CENTER; break;
3143 0 : case 2 : nAdjust = SDRTEXTVERTADJUST_BOTTOM; break;
3144 : }
3145 0 : bRet |= 0 != rSet.Put(SdrTextVertAdjustItem(nAdjust, RES_TEXT_VERT_ADJUST));
3146 : }
3147 :
3148 0 : return bRet;
3149 : }
3150 :
3151 0 : sal_uInt16* SwFrmAddPage::GetRanges()
3152 : {
3153 0 : return aAddPgRg;
3154 : }
3155 :
3156 0 : IMPL_LINK_NOARG(SwFrmAddPage, EditModifyHdl)
3157 : {
3158 0 : sal_Bool bEnable = !pNameED->GetText().isEmpty();
3159 0 : pAltNameED->Enable(bEnable);
3160 0 : pAltNameFT->Enable(bEnable);
3161 :
3162 0 : return 0;
3163 : }
3164 :
3165 0 : void SwFrmAddPage::SetFormatUsed(sal_Bool bFmt)
3166 : {
3167 0 : bFormat = bFmt;
3168 0 : if (bFormat)
3169 : {
3170 0 : pNameFrame->Hide();
3171 : }
3172 0 : }
3173 :
3174 0 : IMPL_LINK(SwFrmAddPage, ChainModifyHdl, ListBox*, pBox)
3175 : {
3176 0 : OUString sCurrentPrevChain, sCurrentNextChain;
3177 0 : if(pPrevLB->GetSelectEntryPos())
3178 0 : sCurrentPrevChain = pPrevLB->GetSelectEntry();
3179 0 : if(pNextLB->GetSelectEntryPos())
3180 0 : sCurrentNextChain = pNextLB->GetSelectEntry();
3181 0 : SwFrmFmt* pFmt = pWrtSh->GetFlyFrmFmt();
3182 0 : if (pFmt)
3183 : {
3184 0 : bool bNextBox = pNextLB == pBox;
3185 0 : ListBox& rChangeLB = bNextBox ? *pPrevLB : *pNextLB;
3186 0 : for(sal_Int32 nEntry = rChangeLB.GetEntryCount(); nEntry > 1; nEntry--)
3187 0 : rChangeLB.RemoveEntry(nEntry - 1);
3188 : //determine chainable frames
3189 0 : ::std::vector< OUString > aPrevPageFrames;
3190 0 : ::std::vector< OUString > aThisPageFrames;
3191 0 : ::std::vector< OUString > aNextPageFrames;
3192 0 : ::std::vector< OUString > aRemainFrames;
3193 0 : pWrtSh->GetConnectableFrmFmts(*pFmt, bNextBox ? sCurrentNextChain : sCurrentPrevChain, !bNextBox,
3194 0 : aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames );
3195 : lcl_InsertVectors(rChangeLB,
3196 0 : aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames);
3197 0 : const OUString sToSelect = bNextBox ? sCurrentPrevChain : sCurrentNextChain;
3198 0 : if(rChangeLB.GetEntryPos(sToSelect) != LISTBOX_ENTRY_NOTFOUND)
3199 0 : rChangeLB.SelectEntry(sToSelect);
3200 : else
3201 0 : rChangeLB.SelectEntryPos(0);
3202 :
3203 : }
3204 0 : return 0;
3205 0 : }
3206 :
3207 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|