1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: frmpage.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
33 #ifdef SW_DLLIMPLEMENTATION
34 #undef SW_DLLIMPLEMENTATION
37 #include <com/sun/star/embed/Aspects.hpp>
38 #include <com/sun/star/embed/EmbedMisc.hpp>
46 #include <hintids.hxx>
47 #include <vcl/msgbox.hxx>
48 #include <vcl/mnemonic.hxx>
49 #include <svtools/urihelper.hxx>
50 #include <svtools/stritem.hxx>
51 #include <svx/impgrf.hxx>
52 #include <svx/htmlmode.hxx>
53 #include <svx/sizeitem.hxx>
54 #include <svx/opaqitem.hxx>
55 #include <svx/protitem.hxx>
56 #include <svx/prntitem.hxx>
57 #include <svx/brshitem.hxx>
58 #include <svx/ulspitem.hxx>
59 #include <svx/frmdiritem.hxx>
60 #include <svx/swframevalidation.hxx>
61 #include <sot/clsids.hxx>
63 #include <sfx2/viewfrm.hxx>
65 #include <fmteiro.hxx>
66 #include <fmtcnct.hxx>
69 #include <swmodule.hxx>
74 #include <viewopt.hxx>
78 #include <frmpage.hxx>
82 #include <uiitems.hxx>
83 // OD 19.09.2003 #i18732#
84 #include <fmtfollowtextflow.hxx>
90 #include <frmpage.hrc>
92 #include <sfx2/filedlghelper.hxx>
93 #include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
94 #include <com/sun/star/ui/dialogs/XFilePicker.hpp>
95 #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
96 #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
98 using namespace ::com::sun::star
;
99 using ::rtl::OUString
;
100 using namespace ::sfx2
;
102 #define SwFPos SvxSwFramePosString
106 SvxSwFramePosString::StringId eStrId
;
107 SvxSwFramePosString::StringId eMirrorStrId
;
114 SvxSwFramePosString::StringId eStrId
;
115 SvxSwFramePosString::StringId eMirrorStrId
;
120 struct StringIdPair_Impl
122 SvxSwFramePosString::StringId eHori
;
123 SvxSwFramePosString::StringId eVert
;
126 #define MAX_PERCENT_WIDTH 254L
127 #define MAX_PERCENT_HEIGHT 254L
129 // OD 19.09.2003 #i18732# - change order of alignments
130 #define LB_FRAME 0x00000001L // Textbereich des Absatzes
131 #define LB_PRTAREA 0x00000002L // Textbereich des Absatzes + Einzuege
132 #define LB_VERT_FRAME 0x00000004L // Vertikaler Textbereich des Absatzes
133 #define LB_VERT_PRTAREA 0x00000008L // Vertikaler Textbereich des Absatzes + Einzuege
134 #define LB_REL_FRM_LEFT 0x00000010L // Linker Absatzrand
135 #define LB_REL_FRM_RIGHT 0x00000020L // Rechter Absatzrand
137 #define LB_REL_PG_LEFT 0x00000040L // Linker Seitenrand
138 #define LB_REL_PG_RIGHT 0x00000080L // Rechter Seitenrand
139 #define LB_REL_PG_FRAME 0x00000100L // Gesamte Seite
140 #define LB_REL_PG_PRTAREA 0x00000200L // Textbereich der Seite
142 #define LB_FLY_REL_PG_LEFT 0x00000400L // Linker Rahmenrand
143 #define LB_FLY_REL_PG_RIGHT 0x00000800L // Rechter Rahmenrand
144 #define LB_FLY_REL_PG_FRAME 0x00001000L // Gesamte Rahmen
145 #define LB_FLY_REL_PG_PRTAREA 0x00002000L // Rahmeninneres
147 #define LB_REL_BASE 0x00010000L // Zeichenausrichtung Basis
148 #define LB_REL_CHAR 0x00020000L // Zeichenausrichtung Zeichen
149 #define LB_REL_ROW 0x00040000L // Zeichenausrichtung Zeile
151 // OD 10.11.2003 #i22305#
152 #define LB_FLY_VERT_FRAME 0x00100000L // vertical entire frame
153 #define LB_FLY_VERT_PRTAREA 0x00200000L // vertical frame text area
155 // OD 11.11.2003 #i22341#
156 #define LB_VERT_LINE 0x00400000L // vertical text line
158 static RelationMap __FAR_DATA aRelationMap
[] =
160 {SwFPos::FRAME
, SwFPos::FRAME
, LB_FRAME
, text::RelOrientation::FRAME
},
161 {SwFPos::PRTAREA
, SwFPos::PRTAREA
, LB_PRTAREA
, text::RelOrientation::PRINT_AREA
},
162 {SwFPos::REL_PG_LEFT
, SwFPos::MIR_REL_PG_LEFT
, LB_REL_PG_LEFT
, text::RelOrientation::PAGE_LEFT
},
163 {SwFPos::REL_PG_RIGHT
, SwFPos::MIR_REL_PG_RIGHT
, LB_REL_PG_RIGHT
, text::RelOrientation::PAGE_RIGHT
},
164 {SwFPos::REL_FRM_LEFT
, SwFPos::MIR_REL_FRM_LEFT
, LB_REL_FRM_LEFT
, text::RelOrientation::FRAME_LEFT
},
165 {SwFPos::REL_FRM_RIGHT
, SwFPos::MIR_REL_FRM_RIGHT
, LB_REL_FRM_RIGHT
, text::RelOrientation::FRAME_RIGHT
},
166 {SwFPos::REL_PG_FRAME
, SwFPos::REL_PG_FRAME
, LB_REL_PG_FRAME
, text::RelOrientation::PAGE_FRAME
},
167 {SwFPos::REL_PG_PRTAREA
, SwFPos::REL_PG_PRTAREA
, LB_REL_PG_PRTAREA
, text::RelOrientation::PAGE_PRINT_AREA
},
168 {SwFPos::REL_CHAR
, SwFPos::REL_CHAR
, LB_REL_CHAR
, text::RelOrientation::CHAR
},
170 {SwFPos::FLY_REL_PG_LEFT
, SwFPos::FLY_MIR_REL_PG_LEFT
, LB_FLY_REL_PG_LEFT
, text::RelOrientation::PAGE_LEFT
},
171 {SwFPos::FLY_REL_PG_RIGHT
, SwFPos::FLY_MIR_REL_PG_RIGHT
, LB_FLY_REL_PG_RIGHT
, text::RelOrientation::PAGE_RIGHT
},
172 {SwFPos::FLY_REL_PG_FRAME
, SwFPos::FLY_REL_PG_FRAME
, LB_FLY_REL_PG_FRAME
, text::RelOrientation::PAGE_FRAME
},
173 {SwFPos::FLY_REL_PG_PRTAREA
, SwFPos::FLY_REL_PG_PRTAREA
, LB_FLY_REL_PG_PRTAREA
, text::RelOrientation::PAGE_PRINT_AREA
},
175 {SwFPos::REL_BORDER
, SwFPos::REL_BORDER
, LB_VERT_FRAME
, text::RelOrientation::FRAME
},
176 {SwFPos::REL_PRTAREA
, SwFPos::REL_PRTAREA
, LB_VERT_PRTAREA
, text::RelOrientation::PRINT_AREA
},
178 // OD 10.11.2003 #i22305#
179 {SwFPos::FLY_REL_PG_FRAME
, SwFPos::FLY_REL_PG_FRAME
, LB_FLY_VERT_FRAME
, text::RelOrientation::FRAME
},
180 {SwFPos::FLY_REL_PG_PRTAREA
, SwFPos::FLY_REL_PG_PRTAREA
, LB_FLY_VERT_PRTAREA
, text::RelOrientation::PRINT_AREA
},
182 // OD 11.11.2003 #i22341#
183 {SwFPos::REL_LINE
, SwFPos::REL_LINE
, LB_VERT_LINE
, text::RelOrientation::TEXT_LINE
}
186 static RelationMap __FAR_DATA aAsCharRelationMap
[] =
188 {SwFPos::REL_BASE
, SwFPos::REL_BASE
, LB_REL_BASE
, text::RelOrientation::FRAME
},
189 {SwFPos::REL_CHAR
, SwFPos::REL_CHAR
, LB_REL_CHAR
, text::RelOrientation::FRAME
},
190 {SwFPos::REL_ROW
, SwFPos::REL_ROW
, LB_REL_ROW
, text::RelOrientation::FRAME
}
193 /*--------------------------------------------------------------------
194 Beschreibung: Seite verankert
195 --------------------------------------------------------------------*/
197 #define HORI_PAGE_REL (LB_REL_PG_FRAME|LB_REL_PG_PRTAREA|LB_REL_PG_LEFT| \
200 static FrmMap __FAR_DATA aHPageMap
[] =
202 {SwFPos::LEFT
, SwFPos::MIR_LEFT
, text::HoriOrientation::LEFT
, HORI_PAGE_REL
},
203 {SwFPos::RIGHT
, SwFPos::MIR_RIGHT
, text::HoriOrientation::RIGHT
, HORI_PAGE_REL
},
204 {SwFPos::CENTER_HORI
, SwFPos::CENTER_HORI
, text::HoriOrientation::CENTER
, HORI_PAGE_REL
},
205 {SwFPos::FROMLEFT
, SwFPos::MIR_FROMLEFT
, text::HoriOrientation::NONE
, HORI_PAGE_REL
}
208 static FrmMap __FAR_DATA aHPageHtmlMap
[] =
210 {SwFPos::FROMLEFT
, SwFPos::MIR_FROMLEFT
, text::HoriOrientation::NONE
, LB_REL_PG_FRAME
}
213 #define VERT_PAGE_REL (LB_REL_PG_FRAME|LB_REL_PG_PRTAREA)
215 static FrmMap __FAR_DATA aVPageMap
[] =
217 {SwFPos::TOP
, SwFPos::TOP
, text::VertOrientation::TOP
, VERT_PAGE_REL
},
218 {SwFPos::BOTTOM
, SwFPos::BOTTOM
, text::VertOrientation::BOTTOM
, VERT_PAGE_REL
},
219 {SwFPos::CENTER_VERT
, SwFPos::CENTER_VERT
, text::VertOrientation::CENTER
, VERT_PAGE_REL
},
220 {SwFPos::FROMTOP
, SwFPos::FROMTOP
, text::VertOrientation::NONE
, VERT_PAGE_REL
}
223 static FrmMap __FAR_DATA aVPageHtmlMap
[] =
225 {SwFPos::FROMTOP
, SwFPos::FROMTOP
, text::VertOrientation::NONE
, LB_REL_PG_FRAME
}
228 /*--------------------------------------------------------------------
229 Beschreibung: Rahmen verankert
230 --------------------------------------------------------------------*/
232 #define HORI_FRAME_REL (LB_FLY_REL_PG_FRAME|LB_FLY_REL_PG_PRTAREA| \
233 LB_FLY_REL_PG_LEFT|LB_FLY_REL_PG_RIGHT)
235 static FrmMap __FAR_DATA aHFrameMap
[] =
237 {SwFPos::LEFT
, SwFPos::MIR_LEFT
, text::HoriOrientation::LEFT
, HORI_FRAME_REL
},
238 {SwFPos::RIGHT
, SwFPos::MIR_RIGHT
, text::HoriOrientation::RIGHT
, HORI_FRAME_REL
},
239 {SwFPos::CENTER_HORI
, SwFPos::CENTER_HORI
, text::HoriOrientation::CENTER
, HORI_FRAME_REL
},
240 {SwFPos::FROMLEFT
, SwFPos::MIR_FROMLEFT
, text::HoriOrientation::NONE
, HORI_FRAME_REL
}
243 static FrmMap __FAR_DATA aHFlyHtmlMap
[] =
245 {SwFPos::LEFT
, SwFPos::MIR_LEFT
, text::HoriOrientation::LEFT
, LB_FLY_REL_PG_FRAME
},
246 {SwFPos::FROMLEFT
, SwFPos::MIR_FROMLEFT
, text::HoriOrientation::NONE
, LB_FLY_REL_PG_FRAME
}
249 // OD 19.09.2003 #i18732# - own vertical alignment map for to frame anchored objects
250 // OD 10.11.2003 #i22305#
251 #define VERT_FRAME_REL (LB_FLY_VERT_FRAME|LB_FLY_VERT_PRTAREA)
253 static FrmMap __FAR_DATA aVFrameMap
[] =
255 {SwFPos::TOP
, SwFPos::TOP
, text::VertOrientation::TOP
, VERT_FRAME_REL
},
256 {SwFPos::BOTTOM
, SwFPos::BOTTOM
, text::VertOrientation::BOTTOM
, VERT_FRAME_REL
},
257 {SwFPos::CENTER_VERT
, SwFPos::CENTER_VERT
, text::VertOrientation::CENTER
, VERT_FRAME_REL
},
258 {SwFPos::FROMTOP
, SwFPos::FROMTOP
, text::VertOrientation::NONE
, VERT_FRAME_REL
}
261 static FrmMap __FAR_DATA aVFlyHtmlMap
[] =
263 // OD 10.11.2003 #i22305#
264 {SwFPos::TOP
, SwFPos::TOP
, text::VertOrientation::TOP
, LB_FLY_VERT_FRAME
},
265 {SwFPos::FROMTOP
, SwFPos::FROMTOP
, text::VertOrientation::NONE
, LB_FLY_VERT_FRAME
}
268 /*--------------------------------------------------------------------
269 Beschreibung: Absatz verankert
270 --------------------------------------------------------------------*/
272 #define HORI_PARA_REL (LB_FRAME|LB_PRTAREA|LB_REL_PG_LEFT|LB_REL_PG_RIGHT| \
273 LB_REL_PG_FRAME|LB_REL_PG_PRTAREA|LB_REL_FRM_LEFT| \
276 static FrmMap __FAR_DATA aHParaMap
[] =
278 {SwFPos::LEFT
, SwFPos::MIR_LEFT
, text::HoriOrientation::LEFT
, HORI_PARA_REL
},
279 {SwFPos::RIGHT
, SwFPos::MIR_RIGHT
, text::HoriOrientation::RIGHT
, HORI_PARA_REL
},
280 {SwFPos::CENTER_HORI
, SwFPos::CENTER_HORI
, text::HoriOrientation::CENTER
, HORI_PARA_REL
},
281 {SwFPos::FROMLEFT
, SwFPos::MIR_FROMLEFT
, text::HoriOrientation::NONE
, HORI_PARA_REL
}
284 #define HTML_HORI_PARA_REL (LB_FRAME|LB_PRTAREA)
286 static FrmMap __FAR_DATA aHParaHtmlMap
[] =
288 {SwFPos::LEFT
, SwFPos::LEFT
, text::HoriOrientation::LEFT
, HTML_HORI_PARA_REL
},
289 {SwFPos::RIGHT
, SwFPos::RIGHT
, text::HoriOrientation::RIGHT
, HTML_HORI_PARA_REL
}
292 static FrmMap __FAR_DATA aHParaHtmlAbsMap
[] =
294 {SwFPos::LEFT
, SwFPos::MIR_LEFT
, text::HoriOrientation::LEFT
, HTML_HORI_PARA_REL
},
295 {SwFPos::RIGHT
, SwFPos::MIR_RIGHT
, text::HoriOrientation::RIGHT
, HTML_HORI_PARA_REL
}
298 // OD 19.09.2003 #i18732# - allow vertical alignment at page areas
299 #define VERT_PARA_REL (LB_VERT_FRAME|LB_VERT_PRTAREA| \
300 LB_REL_PG_FRAME|LB_REL_PG_PRTAREA)
302 static FrmMap __FAR_DATA aVParaMap
[] =
304 {SwFPos::TOP
, SwFPos::TOP
, text::VertOrientation::TOP
, VERT_PARA_REL
},
305 {SwFPos::BOTTOM
, SwFPos::BOTTOM
, text::VertOrientation::BOTTOM
, VERT_PARA_REL
},
306 {SwFPos::CENTER_VERT
, SwFPos::CENTER_VERT
, text::VertOrientation::CENTER
, VERT_PARA_REL
},
307 {SwFPos::FROMTOP
, SwFPos::FROMTOP
, text::VertOrientation::NONE
, VERT_PARA_REL
}
310 static FrmMap __FAR_DATA aVParaHtmlMap
[] =
312 {SwFPos::TOP
, SwFPos::TOP
, text::VertOrientation::TOP
, LB_VERT_PRTAREA
}
315 /*--------------------------------------------------------------------
316 Beschreibung: Relativ zum Zeichen verankert
317 --------------------------------------------------------------------*/
319 #define HORI_CHAR_REL (LB_FRAME|LB_PRTAREA|LB_REL_PG_LEFT|LB_REL_PG_RIGHT| \
320 LB_REL_PG_FRAME|LB_REL_PG_PRTAREA|LB_REL_FRM_LEFT| \
321 LB_REL_FRM_RIGHT|LB_REL_CHAR)
323 static FrmMap __FAR_DATA aHCharMap
[] =
325 {SwFPos::LEFT
, SwFPos::MIR_LEFT
, text::HoriOrientation::LEFT
, HORI_CHAR_REL
},
326 {SwFPos::RIGHT
, SwFPos::MIR_RIGHT
, text::HoriOrientation::RIGHT
, HORI_CHAR_REL
},
327 {SwFPos::CENTER_HORI
, SwFPos::CENTER_HORI
, text::HoriOrientation::CENTER
, HORI_CHAR_REL
},
328 {SwFPos::FROMLEFT
, SwFPos::MIR_FROMLEFT
, text::HoriOrientation::NONE
, HORI_CHAR_REL
}
331 #define HTML_HORI_CHAR_REL (LB_FRAME|LB_PRTAREA|LB_REL_CHAR)
333 static FrmMap __FAR_DATA aHCharHtmlMap
[] =
335 {SwFPos::LEFT
, SwFPos::LEFT
, text::HoriOrientation::LEFT
, HTML_HORI_CHAR_REL
},
336 {SwFPos::RIGHT
, SwFPos::RIGHT
, text::HoriOrientation::RIGHT
, HTML_HORI_CHAR_REL
}
339 static FrmMap __FAR_DATA aHCharHtmlAbsMap
[] =
341 {SwFPos::LEFT
, SwFPos::MIR_LEFT
, text::HoriOrientation::LEFT
, LB_PRTAREA
|LB_REL_CHAR
},
342 {SwFPos::RIGHT
, SwFPos::MIR_RIGHT
, text::HoriOrientation::RIGHT
, LB_PRTAREA
},
343 {SwFPos::FROMLEFT
, SwFPos::MIR_FROMLEFT
, text::HoriOrientation::NONE
, LB_REL_PG_FRAME
}
346 // OD 19.09.2003 #i18732# - allow vertical alignment at page areas
347 // OD 12.11.2003 #i22341# - handle <LB_REL_CHAR> on its own
348 #define VERT_CHAR_REL (LB_VERT_FRAME|LB_VERT_PRTAREA| \
349 LB_REL_PG_FRAME|LB_REL_PG_PRTAREA)
351 static FrmMap __FAR_DATA aVCharMap
[] =
353 // OD 11.11.2003 #i22341#
354 // introduce mappings for new vertical alignment at top of line <LB_VERT_LINE>
355 // and correct mapping for vertical alignment at character for position <FROM_BOTTOM>
356 // Note: Because of these adjustments the map becomes ambigous in its values
357 // <eStrId>/<eMirrorStrId> and <nAlign>. These ambiguities are considered
358 // in the methods <SwFrmPage::FillRelLB(..)>, <SwFrmPage::GetAlignment(..)>
359 // and <SwFrmPage::FillPosLB(..)>
360 {SwFPos::TOP
, SwFPos::TOP
, text::VertOrientation::TOP
, VERT_CHAR_REL
|LB_REL_CHAR
},
361 {SwFPos::BOTTOM
, SwFPos::BOTTOM
, text::VertOrientation::BOTTOM
, VERT_CHAR_REL
|LB_REL_CHAR
},
362 {SwFPos::BELOW
, SwFPos::BELOW
, text::VertOrientation::CHAR_BOTTOM
, LB_REL_CHAR
},
363 {SwFPos::CENTER_VERT
, SwFPos::CENTER_VERT
, text::VertOrientation::CENTER
, VERT_CHAR_REL
|LB_REL_CHAR
},
364 {SwFPos::FROMTOP
, SwFPos::FROMTOP
, text::VertOrientation::NONE
, VERT_CHAR_REL
},
365 {SwFPos::FROMBOTTOM
, SwFPos::FROMBOTTOM
, text::VertOrientation::NONE
, LB_REL_CHAR
|LB_VERT_LINE
},
366 {SwFPos::TOP
, SwFPos::TOP
, text::VertOrientation::LINE_TOP
, LB_VERT_LINE
},
367 {SwFPos::BOTTOM
, SwFPos::BOTTOM
, text::VertOrientation::LINE_BOTTOM
, LB_VERT_LINE
},
368 {SwFPos::CENTER_VERT
, SwFPos::CENTER_VERT
, text::VertOrientation::LINE_CENTER
, LB_VERT_LINE
}
372 static FrmMap __FAR_DATA aVCharHtmlMap
[] =
374 {SwFPos::BELOW
, SwFPos::BELOW
, text::VertOrientation::CHAR_BOTTOM
, LB_REL_CHAR
}
377 static FrmMap __FAR_DATA aVCharHtmlAbsMap
[] =
379 {SwFPos::TOP
, SwFPos::TOP
, text::VertOrientation::TOP
, LB_REL_CHAR
},
380 {SwFPos::BELOW
, SwFPos::BELOW
, text::VertOrientation::CHAR_BOTTOM
, LB_REL_CHAR
}
382 /*--------------------------------------------------------------------
383 Beschreibung: Als Zeichen verankert
384 --------------------------------------------------------------------*/
386 static FrmMap __FAR_DATA aVAsCharMap
[] =
388 {SwFPos::TOP
, SwFPos::TOP
, text::VertOrientation::TOP
, LB_REL_BASE
},
389 {SwFPos::BOTTOM
, SwFPos::BOTTOM
, text::VertOrientation::BOTTOM
, LB_REL_BASE
},
390 {SwFPos::CENTER_VERT
, SwFPos::CENTER_VERT
, text::VertOrientation::CENTER
, LB_REL_BASE
},
392 {SwFPos::TOP
, SwFPos::TOP
, text::VertOrientation::CHAR_TOP
, LB_REL_CHAR
},
393 {SwFPos::BOTTOM
, SwFPos::BOTTOM
, text::VertOrientation::CHAR_BOTTOM
, LB_REL_CHAR
},
394 {SwFPos::CENTER_VERT
, SwFPos::CENTER_VERT
, text::VertOrientation::CHAR_CENTER
, LB_REL_CHAR
},
396 {SwFPos::TOP
, SwFPos::TOP
, text::VertOrientation::LINE_TOP
, LB_REL_ROW
},
397 {SwFPos::BOTTOM
, SwFPos::BOTTOM
, text::VertOrientation::LINE_BOTTOM
, LB_REL_ROW
},
398 {SwFPos::CENTER_VERT
, SwFPos::CENTER_VERT
, text::VertOrientation::LINE_CENTER
, LB_REL_ROW
},
400 {SwFPos::FROMBOTTOM
, SwFPos::FROMBOTTOM
, text::VertOrientation::NONE
, LB_REL_BASE
}
403 static FrmMap __FAR_DATA aVAsCharHtmlMap
[] =
405 {SwFPos::TOP
, SwFPos::TOP
, text::VertOrientation::TOP
, LB_REL_BASE
},
406 {SwFPos::CENTER_VERT
, SwFPos::CENTER_VERT
, text::VertOrientation::CENTER
, LB_REL_BASE
},
408 {SwFPos::TOP
, SwFPos::TOP
, text::VertOrientation::CHAR_TOP
, LB_REL_CHAR
},
410 {SwFPos::TOP
, SwFPos::TOP
, text::VertOrientation::LINE_TOP
, LB_REL_ROW
},
411 {SwFPos::BOTTOM
, SwFPos::BOTTOM
, text::VertOrientation::LINE_BOTTOM
, LB_REL_ROW
},
412 {SwFPos::CENTER_VERT
, SwFPos::CENTER_VERT
, text::VertOrientation::LINE_CENTER
, LB_REL_ROW
}
415 static USHORT __FAR_DATA aPageRg
[] = {
416 RES_FRM_SIZE
, RES_FRM_SIZE
,
417 RES_VERT_ORIENT
, RES_ANCHOR
,
419 RES_FOLLOW_TEXT_FLOW
, RES_FOLLOW_TEXT_FLOW
,
422 static USHORT __FAR_DATA aAddPgRg
[] = {
423 RES_PROTECT
, RES_PROTECT
,
424 RES_PRINT
, RES_PRINT
,
425 FN_SET_FRM_NAME
, FN_SET_FRM_NAME
,
426 FN_SET_FRM_ALT_NAME
, FN_SET_FRM_ALT_NAME
,
430 /*--------------------------------------------------------------------
432 --------------------------------------------------------------------*/
434 size_t lcl_GetFrmMapCount( const FrmMap
* pMap
)
438 int aSizeOf
= sizeof(FrmMap
);
439 if( pMap
== aVParaHtmlMap
)
440 return sizeof(aVParaHtmlMap
) / aSizeOf
;
441 if( pMap
== aVAsCharHtmlMap
)
442 return sizeof(aVAsCharHtmlMap
) / aSizeOf
;
443 if( pMap
== aHParaHtmlMap
)
444 return sizeof(aHParaHtmlMap
) / aSizeOf
;
445 if( pMap
== aHParaHtmlAbsMap
)
446 return sizeof(aHParaHtmlAbsMap
) / aSizeOf
;
447 if ( pMap
== aVPageMap
)
448 return sizeof(aVPageMap
) / aSizeOf
;
449 if ( pMap
== aVPageHtmlMap
)
450 return sizeof(aVPageHtmlMap
) / aSizeOf
;
451 if ( pMap
== aVAsCharMap
)
452 return sizeof(aVAsCharMap
) / aSizeOf
;
453 if ( pMap
== aVParaMap
)
454 return sizeof(aVParaMap
) / aSizeOf
;
455 if ( pMap
== aHParaMap
)
456 return sizeof(aHParaMap
) / aSizeOf
;
457 if ( pMap
== aHFrameMap
)
458 return sizeof(aHFrameMap
) / aSizeOf
;
459 // OD 19.09.2003 #i18732# - own vertical alignment map for to frame anchored objects
460 if ( pMap
== aVFrameMap
)
461 return sizeof(aVFrameMap
) / aSizeOf
;
462 if ( pMap
== aHCharMap
)
463 return sizeof(aHCharMap
) / aSizeOf
;
464 if ( pMap
== aHCharHtmlMap
)
465 return sizeof(aHCharHtmlMap
) / aSizeOf
;
466 if ( pMap
== aHCharHtmlAbsMap
)
467 return sizeof(aHCharHtmlAbsMap
) / aSizeOf
;
468 if ( pMap
== aVCharMap
)
469 return sizeof(aVCharMap
) / aSizeOf
;
470 if ( pMap
== aVCharHtmlMap
)
471 return sizeof(aVCharHtmlMap
) / aSizeOf
;
472 if ( pMap
== aVCharHtmlAbsMap
)
473 return sizeof(aVCharHtmlAbsMap
) / aSizeOf
;
474 if ( pMap
== aHPageHtmlMap
)
475 return sizeof(aHPageHtmlMap
) / aSizeOf
;
476 if ( pMap
== aHFlyHtmlMap
)
477 return sizeof(aHFlyHtmlMap
) / aSizeOf
;
478 if ( pMap
== aVFlyHtmlMap
)
479 return sizeof(aVFlyHtmlMap
) / aSizeOf
;
480 return sizeof(aHPageMap
) / aSizeOf
;
484 /* -----------------------------08.08.2002 14:45------------------------------
486 ---------------------------------------------------------------------------*/
487 void lcl_InsertVectors(ListBox
& rBox
,
488 const ::std::vector
< String
>& rPrev
, const ::std::vector
< String
>& rThis
,
489 const ::std::vector
< String
>& rNext
, const ::std::vector
< String
>& rRemain
)
491 ::std::vector
< String
>::const_iterator aIt
;
493 for(aIt
= rPrev
.begin(); aIt
!= rPrev
.end(); aIt
++)
494 nEntry
= rBox
.InsertEntry(*aIt
);
495 for(aIt
= rThis
.begin(); aIt
!= rThis
.end(); aIt
++)
496 nEntry
= rBox
.InsertEntry(*aIt
);
497 for(aIt
= rNext
.begin(); aIt
!= rNext
.end(); aIt
++)
498 nEntry
= rBox
.InsertEntry(*aIt
);
499 rBox
.SetSeparatorPos(nEntry
);
500 //now insert all strings sorted
501 USHORT nStartPos
= rBox
.GetEntryCount();
503 for(aIt
= rPrev
.begin(); aIt
!= rPrev
.end(); aIt
++)
504 ::InsertStringSorted(*aIt
, rBox
, nStartPos
);
505 for(aIt
= rThis
.begin(); aIt
!= rThis
.end(); aIt
++)
506 ::InsertStringSorted(*aIt
, rBox
, nStartPos
);
507 for(aIt
= rNext
.begin(); aIt
!= rNext
.end(); aIt
++)
508 ::InsertStringSorted(*aIt
, rBox
, nStartPos
);
509 for(aIt
= rRemain
.begin(); aIt
!= rRemain
.end(); aIt
++)
510 ::InsertStringSorted(*aIt
, rBox
, nStartPos
);
513 /* -----------------------------20.08.2002 16:12------------------------------
515 ---------------------------------------------------------------------------*/
516 SvxSwFramePosString::StringId
lcl_ChangeResIdToVerticalOrRTL(SvxSwFramePosString::StringId eStringId
, BOOL bVertical
, BOOL bRTL
)
518 //special handling of STR_FROMLEFT
519 if(SwFPos::FROMLEFT
== eStringId
)
521 eStringId
= bVertical
?
522 bRTL
? SwFPos::FROMBOTTOM
: SwFPos::FROMTOP
:
523 bRTL
? SwFPos::FROMRIGHT
: SwFPos::FROMLEFT
;
528 //exchange horizontal strings with vertical strings and vice versa
529 static const StringIdPair_Impl aHoriIds
[] =
531 {SwFPos::LEFT
, SwFPos::TOP
},
532 {SwFPos::RIGHT
, SwFPos::BOTTOM
},
533 {SwFPos::CENTER_HORI
, SwFPos::CENTER_VERT
},
534 {SwFPos::FROMTOP
, SwFPos::FROMRIGHT
},
535 {SwFPos::REL_PG_LEFT
, SwFPos::REL_PG_TOP
},
536 {SwFPos::REL_PG_RIGHT
, SwFPos::REL_PG_BOTTOM
} ,
537 {SwFPos::REL_FRM_LEFT
, SwFPos::REL_FRM_TOP
},
538 {SwFPos::REL_FRM_RIGHT
, SwFPos::REL_FRM_BOTTOM
}
540 static const StringIdPair_Impl aVertIds
[] =
542 {SwFPos::TOP
, SwFPos::RIGHT
},
543 {SwFPos::BOTTOM
, SwFPos::LEFT
},
544 {SwFPos::CENTER_VERT
, SwFPos::CENTER_HORI
},
545 {SwFPos::FROMTOP
, SwFPos::FROMRIGHT
},
546 {SwFPos::REL_PG_TOP
, SwFPos::REL_PG_LEFT
},
547 {SwFPos::REL_PG_BOTTOM
, SwFPos::REL_PG_RIGHT
} ,
548 {SwFPos::REL_FRM_TOP
, SwFPos::REL_FRM_LEFT
},
549 {SwFPos::REL_FRM_BOTTOM
, SwFPos::REL_FRM_RIGHT
}
552 for(nIndex
= 0; nIndex
< sizeof(aHoriIds
) / sizeof(StringIdPair_Impl
); ++nIndex
)
554 if(aHoriIds
[nIndex
].eHori
== eStringId
)
556 eStringId
= aHoriIds
[nIndex
].eVert
;
561 for(nIndex
= 0; nIndex
< sizeof(aVertIds
) / sizeof(StringIdPair_Impl
); ++nIndex
)
563 if(aVertIds
[nIndex
].eHori
== eStringId
)
565 eStringId
= aVertIds
[nIndex
].eVert
;
573 // OD 12.11.2003 #i22341# - helper method in order to determine all possible
574 // listbox relations in a relation map for a given relation
575 ULONG
lcl_GetLBRelationsForRelations( const USHORT _nRel
)
577 ULONG nLBRelations
= 0L;
579 sal_uInt16 nRelMapSize
= sizeof(aRelationMap
) / sizeof(RelationMap
);
580 for ( sal_uInt16 nRelMapPos
= 0; nRelMapPos
< nRelMapSize
; ++nRelMapPos
)
582 if ( aRelationMap
[nRelMapPos
].nRelation
== _nRel
)
584 nLBRelations
|= aRelationMap
[nRelMapPos
].nLBRelation
;
591 // OD 14.11.2003 #i22341# - helper method on order to determine all possible
592 // listbox relations in a relation map for a given string ID
593 ULONG
lcl_GetLBRelationsForStrID( const FrmMap
* _pMap
,
594 const SvxSwFramePosString::StringId _eStrId
,
595 const bool _bUseMirrorStr
)
597 ULONG nLBRelations
= 0L;
599 size_t nRelMapSize
= lcl_GetFrmMapCount( _pMap
);
600 for ( size_t nRelMapPos
= 0; nRelMapPos
< nRelMapSize
; ++nRelMapPos
)
602 if ( ( !_bUseMirrorStr
&& _pMap
[nRelMapPos
].eStrId
== _eStrId
) ||
603 ( _bUseMirrorStr
&& _pMap
[nRelMapPos
].eMirrorStrId
== _eStrId
) )
605 nLBRelations
|= _pMap
[nRelMapPos
].nLBRelations
;
612 /*--------------------------------------------------------------------
613 Beschreibung: StandardRahmenTabPage
614 --------------------------------------------------------------------*/
618 void HandleAutoCB( BOOL _bChecked
, FixedText
& _rFT_man
, FixedText
& _rFT_auto
)
620 _rFT_man
.Show( !_bChecked
);
621 _rFT_auto
.Show( _bChecked
);
626 SwFrmPage::SwFrmPage ( Window
*pParent
, const SfxItemSet
&rSet
) :
627 SfxTabPage (pParent
, SW_RES(TP_FRM_STD
), rSet
),
629 aWidthFT (this, SW_RES(FT_WIDTH
)),
630 aWidthAutoFT (this, SW_RES(FT_WIDTH_AUTO
)),
631 aWidthED (this, SW_RES(ED_WIDTH
)),
632 aRelWidthCB (this, SW_RES(CB_REL_WIDTH
)),
633 aAutoWidthCB (this, SW_RES(CB_AUTOWIDTH
)),
634 aHeightFT (this, SW_RES(FT_HEIGHT
)),
635 aHeightAutoFT (this, SW_RES(FT_HEIGHT_AUTO
)),
636 aHeightED (this, SW_RES(ED_HEIGHT
)),
637 aRelHeightCB (this, SW_RES(CB_REL_HEIGHT
)),
638 aAutoHeightCB (this, SW_RES(CB_AUTOHEIGHT
)),
639 aFixedRatioCB (this, SW_RES(CB_FIXEDRATIO
)),
640 aRealSizeBT (this, SW_RES(BT_REALSIZE
)),
641 aSizeFL (this, SW_RES(FL_SIZE
)),
643 aTypeFL (this, SW_RES(FL_TYPE
)),
644 aTypeSepFL (this, SW_RES(FL_TYPE_SEP
)),
645 aAnchorAtPageRB (this, SW_RES(RB_ANCHOR_PAGE
)),
646 aAnchorAtParaRB (this, SW_RES(RB_ANCHOR_PARA
)),
647 aAnchorAtCharRB (this, SW_RES(RB_ANCHOR_AT_CHAR
)),
648 aAnchorAsCharRB (this, SW_RES(RB_ANCHOR_AS_CHAR
)),
649 aAnchorAtFrameRB(this, SW_RES(RB_ANCHOR_FRAME
)),
651 aHorizontalFT (this, SW_RES(FT_HORIZONTAL
)),
652 aHorizontalDLB (this, SW_RES(DLB_HORIZONTAL
)),
653 aAtHorzPosFT (this, SW_RES(FT_AT_HORZ_POS
)),
654 aAtHorzPosED (this, SW_RES(ED_AT_HORZ_POS
)),
655 aHoriRelationFT (this, SW_RES(FT_HORI_RELATION
)),
656 aHoriRelationLB (this, SW_RES(LB_HORI_RELATION
)),
657 aMirrorPagesCB (this, SW_RES(CB_MIRROR
)),
658 aVerticalFT (this, SW_RES(FT_VERTICAL
)),
659 aVerticalDLB (this, SW_RES(DLB_VERTICAL
)),
660 aAtVertPosFT (this, SW_RES(FT_AT_VERT_POS
)),
661 aAtVertPosED (this, SW_RES(ED_AT_VERT_POS
)),
662 aVertRelationFT (this, SW_RES(FT_VERT_RELATION
)),
663 aVertRelationLB (this, SW_RES(LB_VERT_RELATION
)),
664 // OD 19.09.2003 #i18732# - new checkbox
665 aFollowTextFlowCB(this, SW_RES(CB_FOLLOWTEXTFLOW
)),
666 aPositionFL (this, SW_RES(FL_POSITION
)),
668 aExampleWN (this, SW_RES(WN_BSP
)),
670 bAtHorzPosModified( FALSE
),
671 bAtVertPosModified( FALSE
),
676 bVerticalChanged(FALSE
),
677 bIsVerticalFrame(FALSE
),
678 bIsInRightToLeft(FALSE
),
684 fWidthHeightRatio(1.0),
685 // OD 12.11.2003 #i22341#
686 mpToCharCntntPos( NULL
),
688 nOldH(text::HoriOrientation::CENTER
),
689 nOldHRel(text::RelOrientation::FRAME
),
690 nOldV(text::VertOrientation::TOP
),
691 nOldVRel(text::RelOrientation::PRINT_AREA
),
696 SetExchangeSupport();
698 Link aLk
= LINK(this, SwFrmPage
, RangeModifyHdl
);
699 aWidthED
. SetLoseFocusHdl( aLk
);
700 aHeightED
. SetLoseFocusHdl( aLk
);
701 aAtHorzPosED
.SetLoseFocusHdl( aLk
);
702 aAtVertPosED
.SetLoseFocusHdl( aLk
);
703 // OD 25.09.2003 #i18732# - click handler for new checkbox
704 aFollowTextFlowCB
.SetClickHdl( aLk
);
706 aLk
= LINK(this, SwFrmPage
, ModifyHdl
);
707 aWidthED
. SetModifyHdl( aLk
);
708 aHeightED
. SetModifyHdl( aLk
);
709 aAtHorzPosED
.SetModifyHdl( aLk
);
710 aAtVertPosED
.SetModifyHdl( aLk
);
712 aLk
= LINK(this, SwFrmPage
, AnchorTypeHdl
);
713 aAnchorAtPageRB
.SetClickHdl( aLk
);
714 aAnchorAtParaRB
.SetClickHdl( aLk
);
715 aAnchorAtCharRB
.SetClickHdl( aLk
);
716 aAnchorAsCharRB
.SetClickHdl( aLk
);
717 aAnchorAtFrameRB
.SetClickHdl( aLk
);
719 aHorizontalDLB
.SetSelectHdl(LINK(this, SwFrmPage
, PosHdl
));
720 aVerticalDLB
. SetSelectHdl(LINK(this, SwFrmPage
, PosHdl
));
722 aHoriRelationLB
.SetSelectHdl(LINK(this, SwFrmPage
, RelHdl
));
723 aVertRelationLB
.SetSelectHdl(LINK(this, SwFrmPage
, RelHdl
));
725 aMirrorPagesCB
.SetClickHdl(LINK(this, SwFrmPage
, MirrorHdl
));
727 aLk
= LINK(this, SwFrmPage
, RelSizeClickHdl
);
728 aRelWidthCB
.SetClickHdl( aLk
);
729 aRelHeightCB
.SetClickHdl( aLk
);
731 aAutoWidthCB
.SetClickHdl( LINK( this, SwFrmPage
, AutoWidthClickHdl
) );
732 aAutoHeightCB
.SetClickHdl( LINK( this, SwFrmPage
, AutoHeightClickHdl
) );
735 /*--------------------------------------------------------------------
737 --------------------------------------------------------------------*/
739 SwFrmPage::~SwFrmPage()
743 SfxTabPage
* SwFrmPage::Create(Window
*pParent
, const SfxItemSet
&rSet
)
745 return new SwFrmPage( pParent
, rSet
);
750 void MoveControl( Control
& _rCtrl
, long _nOffsetY
)
752 Point
aPt( _rCtrl
.GetPosPixel() );
753 aPt
.Move( 0, _nOffsetY
);
754 _rCtrl
.SetPosPixel( aPt
);
758 void SwFrmPage::EnableGraficMode( void )
760 // #i39692# mustn't be called more than once
761 if(!aRealSizeBT
.IsVisible())
763 long nOffset1
= aRelWidthCB
.GetPosPixel().Y() - aAutoWidthCB
.GetPosPixel().Y();
764 long nOffset2
= nOffset1
+ aRelHeightCB
.GetPosPixel().Y() - aAutoHeightCB
.GetPosPixel().Y();
766 MoveControl( aHeightFT
, nOffset1
);
767 MoveControl( aHeightED
, nOffset1
);
768 MoveControl( aRelHeightCB
, nOffset1
);
769 MoveControl( aFixedRatioCB
, nOffset2
);
773 aAutoHeightCB
.Hide();
776 aHeightAutoFT
.Hide();
783 void SwFrmPage::Reset( const SfxItemSet
&rSet
)
786 SwWrtShell
* pSh
= bFormat
? ::GetActiveWrtShell() :
787 ((SwFrmDlg
*)GetParent()->GetParent())->GetWrtShell();
789 nHtmlMode
= ::GetHtmlMode(pSh
->GetView().GetDocShell());
790 bHtmlMode
= nHtmlMode
& HTMLMODE_ON
? TRUE
: FALSE
;
792 FieldUnit aMetric
= ::GetDfltMetric(bHtmlMode
);
793 SetMetric( aWidthED
, aMetric
);
794 SetMetric( aHeightED
, aMetric
);
795 SetMetric( aAtHorzPosED
, aMetric
);
796 SetMetric( aAtVertPosED
, aMetric
);
799 const SwFmtAnchor
& rAnchor
= (const SwFmtAnchor
&)rSet
.Get(RES_ANCHOR
);
803 // Bei Formaten keine Ankerbearbeitung
804 aAnchorAtPageRB
.Enable( FALSE
);
805 aAnchorAtParaRB
.Enable( FALSE
);
806 aAnchorAtCharRB
.Enable( FALSE
);
807 aAnchorAsCharRB
.Enable( FALSE
);
808 aAnchorAtFrameRB
.Enable( FALSE
);
809 aTypeFL
.Enable( FALSE
);
810 aFixedRatioCB
.Enable(FALSE
);
814 if (rAnchor
.GetAnchorId() != FLY_AT_FLY
&& !pSh
->IsFlyInFly())
815 aAnchorAtFrameRB
.Hide();
816 if(!bVerticalChanged
&& pSh
->IsFrmVertical(TRUE
, bIsInRightToLeft
))
818 String sHLabel
= aHorizontalFT
.GetText();
819 aHorizontalFT
.SetText(aVerticalFT
.GetText());
820 aVerticalFT
.SetText(sHLabel
);
821 bIsVerticalFrame
= TRUE
;
825 if ( nDlgType
== DLG_FRM_GRF
|| nDlgType
== DLG_FRM_OLE
)
827 ASSERT(pSh
, "shell not found");
828 const SfxPoolItem
* pItem
;
829 //OS: nur fuer die Variante Einfuegen/Grafik/Eigenschaften
830 if(SFX_ITEM_SET
== rSet
.GetItemState(FN_PARAM_GRF_REALSIZE
, FALSE
, &pItem
))
831 aGrfSize
= ((const SvxSizeItem
*)pItem
)->GetSize();
833 pSh
->GetGrfSize( aGrfSize
);
837 aRealSizeBT
.SetClickHdl(LINK(this, SwFrmPage
, RealSizeHdl
));
841 // aTypeFL.SetSizePixel(Size(aTypeFL.GetSizePixel().Width(), aSizeFL.GetSizePixel().Height()));
843 if ( nDlgType
== DLG_FRM_GRF
)
844 aFixedRatioCB
.Check( FALSE
);
848 SetText( SW_RESSTR(STR_OLE_INSERT
));
850 SetText( SW_RESSTR(STR_OLE_EDIT
));
855 // aTypeFL.SetSizePixel(Size(aTypeFL.GetSizePixel().Width(), aSizeFL.GetSizePixel().Height()));
856 aGrfSize
= ((const SwFmtFrmSize
&)rSet
.Get(RES_FRM_SIZE
)).GetSize();
859 //Prozenteingabe ermoeglichen.
860 aWidthED
. SetBaseValue( aWidthED
.Normalize(aGrfSize
.Width()), FUNIT_TWIP
);
861 aHeightED
.SetBaseValue( aHeightED
.Normalize(aGrfSize
.Height()), FUNIT_TWIP
);
862 //the available space is not yet known so the RefValue has to be calculated from size and relative size values
863 //this is needed only if relative values are already set
865 const SwFmtFrmSize
& rFrmSize
= (const SwFmtFrmSize
&)rSet
.Get(RES_FRM_SIZE
);
867 if (rFrmSize
.GetWidthPercent() != 0xff && rFrmSize
.GetWidthPercent() != 0)
869 //calculate the rerference value from the with and relative width values
870 sal_Int32 nSpace
= rFrmSize
.GetWidth() * 100 / rFrmSize
.GetWidthPercent();
871 aWidthED
. SetRefValue( nSpace
);
874 if (rFrmSize
.GetHeightPercent() != 0xff && rFrmSize
.GetHeightPercent() != 0)
876 //calculate the rerference value from the with and relative width values
877 sal_Int32 nSpace
= rFrmSize
.GetHeight() * 100 / rFrmSize
.GetHeightPercent();
878 aHeightED
.SetRefValue( nSpace
);
881 // Allgemeiner Initialisierungteil
882 switch(rAnchor
.GetAnchorId())
884 case FLY_PAGE
: aAnchorAtPageRB
.Check(); break;
885 case FLY_AT_CNTNT
: aAnchorAtParaRB
.Check(); break;
886 case FLY_AUTO_CNTNT
: aAnchorAtCharRB
.Check(); break;
887 case FLY_IN_CNTNT
: aAnchorAsCharRB
.Check(); break;
888 case FLY_AT_FLY
: aAnchorAtFrameRB
.Check();break;
889 default:; //prevent warning
892 // OD 12.11.2003 #i22341# - determine content position of character
893 // Note: content position can be NULL
894 mpToCharCntntPos
= rAnchor
.GetCntntAnchor();
896 // OD 19.09.2003 #i18732# - init checkbox value
898 const bool bFollowTextFlow
=
899 static_cast<const SwFmtFollowTextFlow
&>(rSet
.Get(RES_FOLLOW_TEXT_FLOW
)).GetValue();
900 aFollowTextFlowCB
.Check( bFollowTextFlow
);
905 if(nDlgType
== DLG_FRM_STD
&&
906 0 == (nHtmlMode
& HTMLMODE_FULL_ABS_POS
))
908 aHeightFT
.Enable( FALSE
);
909 aHeightED
.Enable( FALSE
);
910 aRelHeightCB
.Enable( FALSE
);
912 if( 0 == (nHtmlMode
& HTMLMODE_SOME_ABS_POS
))
914 if(GetAnchor() == FLY_PAGE
)
916 aAnchorAtParaRB
.Check();
918 aAnchorAtPageRB
.Enable(FALSE
);
920 aAutoHeightCB
.Enable(FALSE
);
921 aAutoWidthCB
.Enable(FALSE
);
922 aMirrorPagesCB
.Show(FALSE
);
923 if(nDlgType
== DLG_FRM_STD
)
924 aFixedRatioCB
.Enable(FALSE
);
925 // OD 19.09.2003 #i18732# - hide checkbox in HTML mode
926 aFollowTextFlowCB
.Show(FALSE
);
930 // OD 06.11.2003 #i18732# correct enable/disable of check box 'Mirror on..'
931 aMirrorPagesCB
.Enable(!aAnchorAsCharRB
.IsChecked());
933 // OD 06.11.2003 #i18732# - enable/disable check box 'Follow text flow'.
934 // OD 10.11.2003 #i22305# - enable check box 'Follow text
935 // flow' also for anchor type to-frame.
936 aFollowTextFlowCB
.Enable( aAnchorAtParaRB
.IsChecked() ||
937 aAnchorAtCharRB
.IsChecked() ||
938 aAnchorAtFrameRB
.IsChecked() );
942 aAtVertPosED
.SaveValue();
943 aAtHorzPosED
.SaveValue();
944 // OD 19.09.2003 #i18732#
945 aFollowTextFlowCB
.SaveValue();
947 bNoModifyHdl
= FALSE
;
949 aWidthED
.LockAutoCalculation(sal_True
);
950 aHeightED
.LockAutoCalculation(sal_True
);
951 RangeModifyHdl(&aWidthED
); // Alle Maximalwerte initial setzen
952 aHeightED
.LockAutoCalculation(sal_False
);
953 aWidthED
.LockAutoCalculation(sal_False
);
955 aAutoHeightCB
.SaveValue();
956 aAutoWidthCB
.SaveValue();
958 SwTwips nWidth
= static_cast< SwTwips
>(aWidthED
.DenormalizePercent(aWidthED
.GetValue(FUNIT_TWIP
)));
959 SwTwips nHeight
= static_cast< SwTwips
>(aHeightED
.DenormalizePercent(aHeightED
.GetValue(FUNIT_TWIP
)));
960 fWidthHeightRatio
= nHeight
? double(nWidth
) / double(nHeight
) : 1.0;
964 /*--------------------------------------------------------------------
965 Beschreibung: Attribute in den Set stopfen bei OK
966 --------------------------------------------------------------------*/
968 BOOL
SwFrmPage::FillItemSet(SfxItemSet
&rSet
)
971 SwWrtShell
* pSh
= bFormat
? ::GetActiveWrtShell()
972 : ((SwFrmDlg
*)GetParent()->GetParent())->GetWrtShell();
973 ASSERT( pSh
, "shell not found");
974 const SfxItemSet
& rOldSet
= GetItemSet();
975 const SfxPoolItem
* pOldItem
= 0;
977 RndStdIds eAnchorId
= (RndStdIds
)GetAnchor();
981 pOldItem
= GetOldItem(rSet
, RES_ANCHOR
);
982 if (bNew
|| !pOldItem
|| eAnchorId
!= ((const SwFmtAnchor
*)pOldItem
)->GetAnchorId())
984 SwFmtAnchor
aAnc( eAnchorId
, pSh
->GetPhyPageNum() );
985 bRet
= 0 != rSet
.Put( aAnc
);
991 SwFmtHoriOrient
aHoriOrient( (const SwFmtHoriOrient
&)
992 rOldSet
.Get(RES_HORI_ORIENT
) );
994 USHORT nMapPos
= GetMapPos(pHMap
, aHorizontalDLB
);
995 short nAlign
= GetAlignment(pHMap
, nMapPos
, aHorizontalDLB
, aHoriRelationLB
);
996 short nRel
= GetRelation(pHMap
, aHoriRelationLB
);
998 const sal_Int16 eHOri
= nAlign
;
999 const sal_Int16 eRel
= nRel
;
1001 aHoriOrient
.SetHoriOrient( eHOri
);
1002 aHoriOrient
.SetRelationOrient( eRel
);
1003 aHoriOrient
.SetPosToggle(aMirrorPagesCB
.IsChecked());
1005 BOOL bMod
= aAtHorzPosED
.GetText() != aAtHorzPosED
.GetSavedValue();
1006 bMod
|= aMirrorPagesCB
.GetState() != aMirrorPagesCB
.GetSavedValue();
1008 if ( eHOri
== text::HoriOrientation::NONE
&&
1009 (bNew
|| (bAtHorzPosModified
|| bMod
) || nOldH
!= eHOri
) )
1011 SwTwips nX
= static_cast< SwTwips
>(aAtHorzPosED
.Denormalize(aAtHorzPosED
.GetValue(FUNIT_TWIP
)));
1012 aHoriOrient
.SetPos( nX
);
1015 pOldItem
= GetOldItem(rSet
, FN_HORI_ORIENT
);
1017 if ((bNew
== bFormat
) && pOldItem
)
1019 bSame
= static_cast< BOOL
>(aHoriOrient
== (SwFmtHoriOrient
&)*pOldItem
);
1021 if ((bNew
&& !bFormat
) || ((bAtHorzPosModified
|| bMod
) && !bSame
))
1023 bRet
|= 0 != rSet
.Put( aHoriOrient
);
1029 // Ausrichtung Vertikal
1030 SwFmtVertOrient
aVertOrient( (const SwFmtVertOrient
&)
1031 rOldSet
.Get(RES_VERT_ORIENT
) );
1033 USHORT nMapPos
= GetMapPos(pVMap
, aVerticalDLB
);
1034 short nAlign
= GetAlignment(pVMap
, nMapPos
, aVerticalDLB
, aVertRelationLB
);
1035 short nRel
= GetRelation(pVMap
, aVertRelationLB
);
1037 const sal_Int16 eVOri
= nAlign
;
1038 const sal_Int16 eRel
= nRel
;
1040 aVertOrient
.SetVertOrient ( eVOri
);
1041 aVertOrient
.SetRelationOrient( eRel
);
1043 BOOL bMod
= aAtVertPosED
.GetText() != aAtVertPosED
.GetSavedValue();
1045 if ( eVOri
== text::VertOrientation::NONE
&&
1046 ( bNew
|| (bAtVertPosModified
|| bMod
) || nOldV
!= eVOri
) )
1048 // Vertikale Position
1049 // fuer zeichengebundene Rahmen Offset umrechenen
1050 SwTwips nY
= static_cast< SwTwips
>(aAtVertPosED
.Denormalize(aAtVertPosED
.GetValue(FUNIT_TWIP
)));
1051 if (eAnchorId
== FLY_IN_CNTNT
)
1053 aVertOrient
.SetPos( nY
);
1055 pOldItem
= GetOldItem(rSet
, FN_VERT_ORIENT
);
1057 if((bNew
== bFormat
) && pOldItem
)
1059 bSame
= static_cast< BOOL
>( bFormat
?
1060 aVertOrient
.GetVertOrient() == ((SwFmtVertOrient
*)pOldItem
)->GetVertOrient() &&
1061 aVertOrient
.GetRelationOrient() == ((SwFmtVertOrient
*)pOldItem
)->GetRelationOrient() &&
1062 aVertOrient
.GetPos() == ((SwFmtVertOrient
*)pOldItem
)->GetPos()
1064 : aVertOrient
== (SwFmtVertOrient
&)*pOldItem
);
1066 if( ( bNew
&& !bFormat
) || ((bAtVertPosModified
|| bMod
) && !bSame
))
1068 bRet
|= 0 != rSet
.Put( aVertOrient
);
1073 //Neuer Sonderfall: Ist die Groesse von pMgr(0, 0), so werden die
1074 //Eigenschaften fuer eine Grafik festgelegt, die noch gar nicht geladen
1075 //ist. Dann wird hier kein SetSize() gemacht, wenn die
1076 //Groesseneinstellungen vom Anwender nicht veraendert wurden.
1077 const SwFmtFrmSize
& rOldSize
= (const SwFmtFrmSize
& )rOldSet
.Get(RES_FRM_SIZE
);
1078 SwFmtFrmSize
aSz( rOldSize
);
1080 /* // Folgende Zeilen nur zum debuggen:
1081 BOOL bModified = aWidthED.IsValueModified();
1082 USHORT nOldWidth = rOldSize.GetWidth ();
1083 USHORT nWidth = aWidthED .GetValue();
1084 USHORT nMinWidth = aWidthED .GetMin();*/
1086 BOOL bValueModified
= (aWidthED
.IsValueModified() || aHeightED
.IsValueModified());
1087 BOOL bCheckChanged
= (aRelWidthCB
.GetSavedValue() != aRelWidthCB
.IsChecked()
1088 || aRelHeightCB
.GetSavedValue() != aRelHeightCB
.IsChecked());
1090 BOOL bLegalValue
= !(!rOldSize
.GetWidth () && !rOldSize
.GetHeight() &&
1091 aWidthED
.GetValue() == aWidthED
.GetMin() &&
1092 aHeightED
.GetValue() == aHeightED
.GetMin());
1094 if ((bNew
&& !bFormat
) || (bValueModified
|| bCheckChanged
) && bLegalValue
)
1096 sal_Int64 nNewWidth
= aWidthED
.DenormalizePercent(aWidthED
.GetRealValue(FUNIT_TWIP
));
1097 sal_Int64 nNewHeight
= aHeightED
.DenormalizePercent(aHeightED
.GetRealValue(FUNIT_TWIP
));
1098 aSz
.SetWidth (static_cast< SwTwips
>(nNewWidth
));
1099 aSz
.SetHeight(static_cast< SwTwips
>(nNewHeight
));
1101 if (aRelWidthCB
.IsChecked())
1103 aSz
.SetWidthPercent((BYTE
)Min( static_cast< sal_Int64
>(MAX_PERCENT_WIDTH
), aWidthED
.Convert(aWidthED
.NormalizePercent(nNewWidth
), FUNIT_TWIP
, FUNIT_CUSTOM
)));
1106 aSz
.SetWidthPercent(0);
1107 if (aRelHeightCB
.IsChecked())
1108 aSz
.SetHeightPercent((BYTE
)Min(static_cast< sal_Int64
>(MAX_PERCENT_HEIGHT
), aHeightED
.Convert(aHeightED
.NormalizePercent(nNewHeight
), FUNIT_TWIP
, FUNIT_CUSTOM
)));
1110 aSz
.SetHeightPercent(0);
1112 if (aFixedRatioCB
.IsChecked() && (aRelWidthCB
.IsChecked() ^ aRelHeightCB
.IsChecked()))
1114 if (aRelWidthCB
.IsChecked())
1115 aSz
.SetHeightPercent(0xff);
1117 aSz
.SetWidthPercent(0xff);
1120 if( !IsInGraficMode() )
1122 if( aAutoHeightCB
.GetState() != aAutoHeightCB
.GetSavedValue() )
1124 SwFrmSize eFrmSize
= (SwFrmSize
) aAutoHeightCB
.IsChecked()? ATT_MIN_SIZE
: ATT_FIX_SIZE
;
1125 if( eFrmSize
!= aSz
.GetHeightSizeType() )
1126 aSz
.SetHeightSizeType(eFrmSize
);
1128 if( aAutoWidthCB
.GetState() != aAutoWidthCB
.GetSavedValue() )
1130 SwFrmSize eFrmSize
= (SwFrmSize
) aAutoWidthCB
.IsChecked()? ATT_MIN_SIZE
: ATT_FIX_SIZE
;
1131 if( eFrmSize
!= aSz
.GetWidthSizeType() )
1132 aSz
.SetWidthSizeType( eFrmSize
);
1135 if( !bFormat
&& aFixedRatioCB
.GetSavedValue() != aFixedRatioCB
.IsChecked())
1136 bRet
|= 0 != rSet
.Put(SfxBoolItem(FN_KEEP_ASPECT_RATIO
, aFixedRatioCB
.IsChecked()));
1138 pOldItem
= GetOldItem(rSet
, RES_FRM_SIZE
);
1140 if ((pOldItem
&& aSz
!= *pOldItem
) || (!pOldItem
&& !bFormat
) ||
1142 (aSz
.GetWidth() > 0 || aSz
.GetWidthPercent() > 0) &&
1143 (aSz
.GetHeight() > 0 || aSz
.GetHeightPercent() > 0)))
1145 if (aSz
.GetHeightSizeType() == ATT_VAR_SIZE
) // VAR_SIZE gibts nicht bei Rahmen
1146 aSz
.SetHeightSizeType(ATT_MIN_SIZE
); // Bug #45776 (Vorlagen ohne Breite/Hoehe)
1148 bRet
|= 0 != rSet
.Put( aSz
);
1150 // OD 19.09.2003 #i18732#
1151 if(aFollowTextFlowCB
.IsChecked() != aFollowTextFlowCB
.GetSavedValue())
1153 bRet
|= 0 != rSet
.Put(SwFmtFollowTextFlow(aFollowTextFlowCB
.IsChecked()));
1158 /*--------------------------------------------------------------------
1159 Beschreibung: Horizontale und vertikale Pos initialisieren
1160 --------------------------------------------------------------------*/
1162 void SwFrmPage::InitPos(RndStdIds eId
,
1170 USHORT nPos
= aVerticalDLB
.GetSelectEntryPos();
1171 if ( nPos
!= LISTBOX_ENTRY_NOTFOUND
&& pVMap
)
1173 nOldV
= pVMap
[nPos
].nAlign
;
1175 nPos
= aVertRelationLB
.GetSelectEntryPos();
1176 if (nPos
!= LISTBOX_ENTRY_NOTFOUND
)
1177 nOldVRel
= ((RelationMap
*)aVertRelationLB
.GetEntryData(nPos
))->nRelation
;
1180 nPos
= aHorizontalDLB
.GetSelectEntryPos();
1181 if ( nPos
!= LISTBOX_ENTRY_NOTFOUND
&& pHMap
)
1183 nOldH
= pHMap
[nPos
].nAlign
;
1185 nPos
= aHoriRelationLB
.GetSelectEntryPos();
1186 if (nPos
!= LISTBOX_ENTRY_NOTFOUND
)
1187 nOldHRel
= ((RelationMap
*)aHoriRelationLB
.GetEntryData(nPos
))->nRelation
;
1190 BOOL bEnable
= TRUE
;
1191 if ( eId
== FLY_PAGE
)
1193 pVMap
= bHtmlMode
? aVPageHtmlMap
: aVPageMap
;
1194 pHMap
= bHtmlMode
? aHPageHtmlMap
: aHPageMap
;
1196 else if ( eId
== FLY_AT_FLY
)
1198 // OD 19.09.2003 #i18732# - own vertical alignment map for to frame
1199 // anchored objects.
1200 pVMap
= bHtmlMode
? aVFlyHtmlMap
: aVFrameMap
;
1201 pHMap
= bHtmlMode
? aHFlyHtmlMap
: aHFrameMap
;
1203 else if ( eId
== FLY_AT_CNTNT
)
1207 pVMap
= aVParaHtmlMap
;
1208 pHMap
= nHtmlMode
& HTMLMODE_SOME_ABS_POS
? aHParaHtmlAbsMap
: aHParaHtmlMap
;
1216 else if ( eId
== FLY_AUTO_CNTNT
)
1220 pVMap
= nHtmlMode
& HTMLMODE_SOME_ABS_POS
? aVCharHtmlAbsMap
: aVCharHtmlMap
;
1221 pHMap
= nHtmlMode
& HTMLMODE_SOME_ABS_POS
? aHCharHtmlAbsMap
: aHCharHtmlMap
;
1229 else if ( eId
== FLY_IN_CNTNT
)
1231 pVMap
= bHtmlMode
? aVAsCharHtmlMap
: aVAsCharMap
;
1235 aHorizontalDLB
.Enable( bEnable
);
1236 aHorizontalFT
.Enable( bEnable
);
1238 // aktuelle Pos selektieren
1240 if ( nH
== USHRT_MAX
)
1245 // OD 12.11.2003 #i22341# - pass <nHRel> as 3rd parameter to method <FillPosLB>
1246 USHORT nMapPos
= FillPosLB(pHMap
, nH
, nHRel
, aHorizontalDLB
);
1247 FillRelLB(pHMap
, nMapPos
, nH
, nHRel
, aHoriRelationLB
, aHoriRelationFT
);
1250 if ( nV
== USHRT_MAX
)
1255 // OD 12.11.2003 #i22341# - pass <nVRel> as 3rd parameter to method <FillPosLB>
1256 nMapPos
= FillPosLB(pVMap
, nV
, nVRel
, aVerticalDLB
);
1257 FillRelLB(pVMap
, nMapPos
, nV
, nVRel
, aVertRelationLB
, aVertRelationFT
);
1260 bEnable
= nH
== text::HoriOrientation::NONE
&& eId
!= FLY_IN_CNTNT
;//#61359# warum nicht in Formaten&& !bFormat;
1263 aAtHorzPosED
.SetValue( 0, FUNIT_TWIP
);
1264 if (nX
!= LONG_MAX
&& bHtmlMode
)
1265 aAtHorzPosED
.SetModifyFlag();
1270 aAtHorzPosED
.SetValue( aAtHorzPosED
.Normalize(nX
), FUNIT_TWIP
);
1272 aAtHorzPosFT
.Enable( bEnable
);
1273 aAtHorzPosED
.Enable( bEnable
);
1275 bEnable
= nV
== text::VertOrientation::NONE
&& !bFormat
;
1278 aAtVertPosED
.SetValue( 0, FUNIT_TWIP
);
1279 if(nY
!= LONG_MAX
&& bHtmlMode
)
1280 aAtVertPosED
.SetModifyFlag();
1284 if ( eId
== FLY_IN_CNTNT
)
1286 if ( nY
== LONG_MAX
)
1291 if ( nY
!= LONG_MAX
)
1292 aAtVertPosED
.SetValue( aAtVertPosED
.Normalize(nY
), FUNIT_TWIP
);
1294 aAtVertPosFT
.Enable( bEnable
);
1295 aAtVertPosED
.Enable( bEnable
);
1299 /*--------------------------------------------------------------------
1301 --------------------------------------------------------------------*/
1303 USHORT
SwFrmPage::FillPosLB(const FrmMap
* _pMap
,
1304 const USHORT _nAlign
,
1308 String sSelEntry
, sOldEntry
;
1309 sOldEntry
= _rLB
.GetSelectEntry();
1313 // OD 12.11.2003 #i22341# - determine all possible listbox relations for
1314 // given relation for map <aVCharMap>
1315 const ULONG nLBRelations
= (_pMap
!= aVCharMap
)
1317 : ::lcl_GetLBRelationsForRelations( _nRel
);
1320 size_t nCount
= ::lcl_GetFrmMapCount(_pMap
);
1321 for (size_t i
= 0; _pMap
&& i
< nCount
; ++i
)
1323 // #61359# Warum nicht von links/von innen bzw. von oben?
1324 // if (!bFormat || (pMap[i].eStrId != SwFPos::FROMLEFT && pMap[i].eStrId != SwFPos::FROMTOP))
1326 SvxSwFramePosString::StringId eStrId
= aMirrorPagesCB
.IsChecked() ? _pMap
[i
].eMirrorStrId
: _pMap
[i
].eStrId
;
1327 eStrId
= lcl_ChangeResIdToVerticalOrRTL(eStrId
, bIsVerticalFrame
, bIsInRightToLeft
);
1328 String
sEntry(aFramePosString
.GetString(eStrId
));
1329 if (_rLB
.GetEntryPos(sEntry
) == LISTBOX_ENTRY_NOTFOUND
)
1331 // bei zeichengebundenen Rahmen keine doppelten Eintraege einfuegen
1332 _rLB
.InsertEntry(sEntry
);
1334 // OD 12.11.2003 #i22341# - add condition to handle map <aVCharMap>
1335 // that is ambigous in the alignment.
1336 if ( _pMap
[i
].nAlign
== _nAlign
&&
1337 ( !(_pMap
== aVCharMap
) || _pMap
[i
].nLBRelations
& nLBRelations
) )
1344 _rLB
.SelectEntry(sSelEntry
);
1345 if (!_rLB
.GetSelectEntryCount())
1346 _rLB
.SelectEntry(sOldEntry
);
1348 if (!_rLB
.GetSelectEntryCount())
1349 _rLB
.SelectEntryPos(0);
1353 return GetMapPos(_pMap
, _rLB
);
1356 /*--------------------------------------------------------------------
1358 --------------------------------------------------------------------*/
1359 ULONG
SwFrmPage::FillRelLB( const FrmMap
* _pMap
,
1360 const USHORT _nLBSelPos
,
1361 const USHORT _nAlign
,
1367 ULONG nLBRelations
= 0;
1368 size_t nMapCount
= ::lcl_GetFrmMapCount(_pMap
);
1372 if (_nLBSelPos
< nMapCount
)
1374 if (_pMap
== aVAsCharHtmlMap
|| _pMap
== aVAsCharMap
)
1376 String
sOldEntry(_rLB
.GetSelectEntry());
1377 USHORT nRelCount
= sizeof(aAsCharRelationMap
) / sizeof(RelationMap
);
1378 SvxSwFramePosString::StringId eStrId
= _pMap
[_nLBSelPos
].eStrId
;
1380 for (size_t nMapPos
= 0; nMapPos
< nMapCount
; nMapPos
++)
1382 if (_pMap
[nMapPos
].eStrId
== eStrId
)
1384 nLBRelations
= _pMap
[nMapPos
].nLBRelations
;
1385 for (USHORT nRelPos
= 0; nRelPos
< nRelCount
; nRelPos
++)
1387 if (nLBRelations
& aAsCharRelationMap
[nRelPos
].nLBRelation
)
1389 SvxSwFramePosString::StringId sStrId1
= aAsCharRelationMap
[nRelPos
].eStrId
;
1391 sStrId1
= lcl_ChangeResIdToVerticalOrRTL(sStrId1
, bIsVerticalFrame
, bIsInRightToLeft
);
1392 String sEntry
= aFramePosString
.GetString(sStrId1
);
1393 USHORT nPos
= _rLB
.InsertEntry(sEntry
);
1394 _rLB
.SetEntryData(nPos
, &aAsCharRelationMap
[nRelPos
]);
1395 if (_pMap
[nMapPos
].nAlign
== _nAlign
)
1402 if (sSelEntry
.Len())
1403 _rLB
.SelectEntry(sSelEntry
);
1406 _rLB
.SelectEntry(sOldEntry
);
1408 if (!_rLB
.GetSelectEntryCount())
1410 for (USHORT i
= 0; i
< _rLB
.GetEntryCount(); i
++)
1412 RelationMap
*pEntry
= (RelationMap
*)_rLB
.GetEntryData(i
);
1413 if (pEntry
->nLBRelation
== LB_REL_CHAR
) // Default
1415 _rLB
.SelectEntryPos(i
);
1424 USHORT nRelCount
= sizeof(aRelationMap
) / sizeof(RelationMap
);
1426 // OD 14.11.2003 #i22341# - special handling for map <aVCharMap>,
1427 // because its ambigous in its <eStrId>/<eMirrorStrId>.
1428 if ( _pMap
== aVCharMap
)
1430 nLBRelations
= ::lcl_GetLBRelationsForStrID( _pMap
,
1431 ( aMirrorPagesCB
.IsChecked()
1432 ? _pMap
[_nLBSelPos
].eMirrorStrId
1433 : _pMap
[_nLBSelPos
].eStrId
),
1434 aMirrorPagesCB
.IsChecked() );
1438 nLBRelations
= _pMap
[_nLBSelPos
].nLBRelations
;
1441 for (ULONG nBit
= 1; nBit
< 0x80000000; nBit
<<= 1)
1443 if (nLBRelations
& nBit
)
1445 for (USHORT nRelPos
= 0; nRelPos
< nRelCount
; nRelPos
++)
1447 if (aRelationMap
[nRelPos
].nLBRelation
== nBit
)
1449 SvxSwFramePosString::StringId eStrId1
= aMirrorPagesCB
.IsChecked() ?
1450 aRelationMap
[nRelPos
].eMirrorStrId
: aRelationMap
[nRelPos
].eStrId
;
1451 eStrId1
= lcl_ChangeResIdToVerticalOrRTL(eStrId1
, bIsVerticalFrame
, bIsInRightToLeft
);
1452 String sEntry
= aFramePosString
.GetString(eStrId1
);
1453 USHORT nPos
= _rLB
.InsertEntry(sEntry
);
1454 _rLB
.SetEntryData(nPos
, &aRelationMap
[nRelPos
]);
1455 if (!sSelEntry
.Len() && aRelationMap
[nRelPos
].nRelation
== _nRel
)
1461 if (sSelEntry
.Len())
1462 _rLB
.SelectEntry(sSelEntry
);
1465 // Warscheinlich Ankerwechsel. Daher aehnliche Relation suchen
1468 case text::RelOrientation::FRAME
: _nRel
= text::RelOrientation::PAGE_FRAME
; break;
1469 case text::RelOrientation::PRINT_AREA
: _nRel
= text::RelOrientation::PAGE_PRINT_AREA
; break;
1470 case text::RelOrientation::PAGE_LEFT
: _nRel
= text::RelOrientation::FRAME_LEFT
; break;
1471 case text::RelOrientation::PAGE_RIGHT
: _nRel
= text::RelOrientation::FRAME_RIGHT
; break;
1472 case text::RelOrientation::FRAME_LEFT
: _nRel
= text::RelOrientation::PAGE_LEFT
; break;
1473 case text::RelOrientation::FRAME_RIGHT
: _nRel
= text::RelOrientation::PAGE_RIGHT
; break;
1474 case text::RelOrientation::PAGE_FRAME
: _nRel
= text::RelOrientation::FRAME
; break;
1475 case text::RelOrientation::PAGE_PRINT_AREA
: _nRel
= text::RelOrientation::PRINT_AREA
; break;
1478 if (_rLB
.GetEntryCount())
1480 RelationMap
*pEntry
= (RelationMap
*)_rLB
.GetEntryData(_rLB
.GetEntryCount() - 1);
1481 _nRel
= pEntry
->nRelation
;
1486 for (USHORT i
= 0; i
< _rLB
.GetEntryCount(); i
++)
1488 RelationMap
*pEntry
= (RelationMap
*)_rLB
.GetEntryData(i
);
1489 if (pEntry
->nRelation
== _nRel
)
1491 _rLB
.SelectEntryPos(i
);
1496 if (!_rLB
.GetSelectEntryCount())
1497 _rLB
.SelectEntryPos(0);
1502 _rLB
.Enable(_rLB
.GetEntryCount() != 0);
1503 _rFT
.Enable(_rLB
.GetEntryCount() != 0);
1507 return nLBRelations
;
1510 /*--------------------------------------------------------------------
1512 --------------------------------------------------------------------*/
1514 short SwFrmPage::GetRelation(FrmMap
* /*pMap*/, ListBox
&rRelationLB
)
1517 USHORT nPos
= rRelationLB
.GetSelectEntryPos();
1519 if (nPos
!= LISTBOX_ENTRY_NOTFOUND
)
1521 RelationMap
*pEntry
= (RelationMap
*)rRelationLB
.GetEntryData(nPos
);
1522 nRel
= pEntry
->nRelation
;
1528 /*--------------------------------------------------------------------
1530 --------------------------------------------------------------------*/
1532 short SwFrmPage::GetAlignment(FrmMap
*pMap
, USHORT nMapPos
,
1533 ListBox
&/*rAlignLB*/, ListBox
&rRelationLB
)
1537 // OD 14.11.2003 #i22341# - special handling also for map <aVCharMap>,
1538 // because it contains ambigous items for alignment
1539 if ( pMap
== aVAsCharHtmlMap
|| pMap
== aVAsCharMap
||
1542 if (rRelationLB
.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND
)
1544 ULONG nRel
= ((RelationMap
*)rRelationLB
.GetEntryData(rRelationLB
.GetSelectEntryPos()))->nLBRelation
;
1545 size_t nMapCount
= ::lcl_GetFrmMapCount(pMap
);
1546 SvxSwFramePosString::StringId eStrId
= pMap
[nMapPos
].eStrId
;
1548 for (size_t i
= 0; i
< nMapCount
; i
++)
1550 if (pMap
[i
].eStrId
== eStrId
)
1552 ULONG nLBRelations
= pMap
[i
].nLBRelations
;
1553 if (nLBRelations
& nRel
)
1555 nAlign
= pMap
[i
].nAlign
;
1563 nAlign
= pMap
[nMapPos
].nAlign
;
1568 /*--------------------------------------------------------------------
1570 --------------------------------------------------------------------*/
1572 USHORT
SwFrmPage::GetMapPos( const FrmMap
*pMap
, ListBox
&rAlignLB
)
1575 USHORT nLBSelPos
= rAlignLB
.GetSelectEntryPos();
1577 if (nLBSelPos
!= LISTBOX_ENTRY_NOTFOUND
)
1579 if (pMap
== aVAsCharHtmlMap
|| pMap
== aVAsCharMap
)
1581 size_t nMapCount
= ::lcl_GetFrmMapCount(pMap
);
1582 String
sSelEntry(rAlignLB
.GetSelectEntry());
1584 for (size_t i
= 0; i
< nMapCount
; i
++)
1586 SvxSwFramePosString::StringId eResId
= pMap
[i
].eStrId
;
1588 String sEntry
= aFramePosString
.GetString(eResId
);
1589 sEntry
= MnemonicGenerator::EraseAllMnemonicChars( sEntry
);
1591 if (sEntry
== sSelEntry
)
1593 nMapPos
= static_cast< USHORT
>(i
);
1599 nMapPos
= nLBSelPos
;
1605 /*--------------------------------------------------------------------
1607 --------------------------------------------------------------------*/
1609 RndStdIds
SwFrmPage::GetAnchor()
1611 RndStdIds nRet
= FLY_PAGE
;
1612 if(aAnchorAtParaRB
.IsChecked())
1613 nRet
= FLY_AT_CNTNT
;
1614 else if(aAnchorAtCharRB
.IsChecked())
1615 nRet
= FLY_AUTO_CNTNT
;
1616 else if(aAnchorAsCharRB
.IsChecked())
1617 nRet
= FLY_IN_CNTNT
;
1618 else if(aAnchorAtFrameRB
.IsChecked())
1623 /*--------------------------------------------------------------------
1624 Beschreibung: Bsp - Update
1625 --------------------------------------------------------------------*/
1627 void SwFrmPage::ActivatePage(const SfxItemSet
& rSet
)
1629 bNoModifyHdl
= TRUE
;
1631 bNoModifyHdl
= FALSE
;
1632 //lock PercentFields
1633 aWidthED
.LockAutoCalculation(sal_True
);
1634 aHeightED
.LockAutoCalculation(sal_True
);
1635 RangeModifyHdl(&aWidthED
); // Alle Maximalwerte initial setzen
1636 aHeightED
.LockAutoCalculation(sal_False
);
1637 aWidthED
.LockAutoCalculation(sal_False
);
1638 aFollowTextFlowCB
.SaveValue();
1641 int SwFrmPage::DeactivatePage(SfxItemSet
* _pSet
)
1645 FillItemSet( *_pSet
);
1647 //FillItemSet setzt den Anker nicht in den Set, wenn er mit dem
1648 //Original uebereinstimmt. Fuer die anderen Pages brauchen wir aber
1649 //den aktuellen Anker.
1650 SwWrtShell
* pSh
= bFormat
? ::GetActiveWrtShell()
1651 : ((SwFrmDlg
*)GetParent()->GetParent())->GetWrtShell();
1652 RndStdIds eAnchorId
= (RndStdIds
)GetAnchor();
1653 SwFmtAnchor
aAnc( eAnchorId
, pSh
->GetPhyPageNum() );
1660 /*--------------------------------------------------------------------
1661 Beschreibung: Links/rechts mit Innen/aussen tauschen
1662 --------------------------------------------------------------------*/
1664 IMPL_LINK( SwFrmPage
, MirrorHdl
, CheckBox
*, EMPTYARG
)
1666 RndStdIds eId
= GetAnchor();
1667 InitPos( eId
, USHRT_MAX
, 0, USHRT_MAX
, 0, LONG_MAX
, LONG_MAX
);
1672 /*--------------------------------------------------------------------
1674 --------------------------------------------------------------------*/
1676 IMPL_LINK( SwFrmPage
, RelSizeClickHdl
, CheckBox
*, pBtn
)
1678 if (pBtn
== &aRelWidthCB
)
1680 aWidthED
.ShowPercent(pBtn
->IsChecked());
1681 if(pBtn
->IsChecked())
1682 aWidthED
.MetricField::SetMax(MAX_PERCENT_WIDTH
);
1684 else // pBtn == &aRelHeightCB
1686 aHeightED
.ShowPercent(pBtn
->IsChecked());
1687 if(pBtn
->IsChecked())
1688 aHeightED
.MetricField::SetMax(MAX_PERCENT_HEIGHT
);
1691 if (pBtn
) // Nur wenn Handler durch Aenderung des Controllers gerufen wurde
1692 RangeModifyHdl(&aWidthED
); // Werte wieder korrigieren
1694 if (pBtn
== &aRelWidthCB
)
1695 ModifyHdl(&aWidthED
);
1696 else // pBtn == &aRelHeightCB
1697 ModifyHdl(&aHeightED
);
1702 /*--------------------------------------------------------------------
1703 Beschreibung: Bereichspruefung
1704 --------------------------------------------------------------------*/
1706 IMPL_LINK( SwFrmPage
, RangeModifyHdl
, Edit
*, EMPTYARG
)
1711 SwWrtShell
* pSh
= bFormat
? ::GetActiveWrtShell()
1712 :((SwFrmDlg
*)GetParent()->GetParent())->GetWrtShell();
1713 ASSERT(pSh
, "shell not found");
1714 SwFlyFrmAttrMgr
aMgr( bNew
, pSh
, (const SwAttrSet
&)GetItemSet() );
1715 SvxSwFrameValidation aVal
;
1717 aVal
.nAnchorType
= static_cast< USHORT
>(GetAnchor());
1718 aVal
.bAutoHeight
= aAutoHeightCB
.IsChecked();
1719 aVal
.bAutoWidth
= aAutoWidthCB
.IsChecked();
1720 aVal
.bMirror
= aMirrorPagesCB
.IsChecked();
1721 // OD 18.09.2003 #i18732#
1722 aVal
.bFollowTextFlow
= aFollowTextFlowCB
.IsChecked();
1726 // Ausrichtung Horizontal
1727 USHORT nMapPos
= GetMapPos(pHMap
, aHorizontalDLB
);
1728 short nAlign
= GetAlignment(pHMap
, nMapPos
, aHorizontalDLB
, aHoriRelationLB
);
1729 short nRel
= GetRelation(pHMap
, aHoriRelationLB
);
1731 aVal
.nHoriOrient
= nAlign
;
1732 aVal
.nHRelOrient
= nRel
;
1735 aVal
.nHoriOrient
= text::HoriOrientation::NONE
;
1739 // Ausrichtung Vertikal
1740 USHORT nMapPos
= GetMapPos(pVMap
, aVerticalDLB
);
1741 short nAlign
= GetAlignment(pVMap
, nMapPos
, aVerticalDLB
, aVertRelationLB
);
1742 short nRel
= GetRelation(pVMap
, aVertRelationLB
);
1744 aVal
.nVertOrient
= nAlign
;
1745 aVal
.nVRelOrient
= nRel
;
1748 aVal
.nVertOrient
= text::VertOrientation::NONE
;
1750 const long nAtHorzPosVal
= static_cast< long >(
1751 aAtHorzPosED
.Denormalize(aAtHorzPosED
.GetValue(FUNIT_TWIP
)) );
1752 const long nAtVertPosVal
= static_cast< long >(
1753 aAtVertPosED
.Denormalize(aAtVertPosED
.GetValue(FUNIT_TWIP
)) );
1755 aVal
.nHPos
= nAtHorzPosVal
;
1756 aVal
.nVPos
= nAtVertPosVal
;
1758 aMgr
.ValidateMetrics(aVal
, mpToCharCntntPos
, TRUE
); // Einmal, um Referenzwerte fuer prozentuale Werte zu erhalten
1760 // Referenzwerte fuer fuer Prozentwerte setzen (100%) ...
1761 aWidthED
.SetRefValue(aVal
.aPercentSize
.Width());
1762 aHeightED
.SetRefValue(aVal
.aPercentSize
.Height());
1764 // ... und damit Breite und Hoehe korrekt umrechnen
1765 SwTwips nWidth
= static_cast< SwTwips
>(aWidthED
. DenormalizePercent(aWidthED
.GetValue(FUNIT_TWIP
)));
1766 SwTwips nHeight
= static_cast< SwTwips
>(aHeightED
.DenormalizePercent(aHeightED
.GetValue(FUNIT_TWIP
)));
1767 aVal
.nWidth
= nWidth
;
1768 aVal
.nHeight
= nHeight
;
1770 aMgr
.ValidateMetrics(aVal
, mpToCharCntntPos
); // Nochmal um mit korrekter Breite und Hoehe alle restlichen Werte zu ermitteln
1772 // alle Spalten muessen passen
1773 if(GetTabDialog()->GetExampleSet() &&
1774 SFX_ITEM_DEFAULT
<= GetTabDialog()->GetExampleSet()->GetItemState(RES_COL
))
1776 const SwFmtCol
& rCol
= (const SwFmtCol
&)GetTabDialog()->GetExampleSet()->Get(RES_COL
);
1777 if ( rCol
.GetColumns().Count() > 1 )
1779 for ( USHORT i
= 0; i
< rCol
.GetColumns().Count(); ++i
)
1781 aVal
.nMinWidth
+= rCol
.GetColumns()[i
]->GetLeft() +
1782 rCol
.GetColumns()[i
]->GetRight() +
1785 aVal
.nMinWidth
-= MINFLY
;//einen hatten wir schon mit drin!
1789 nWidth
= aVal
.nWidth
;
1790 nHeight
= aVal
.nHeight
;
1792 // Mindestbreite auch fuer Vorlage
1793 aHeightED
.SetMin(aHeightED
.NormalizePercent(aVal
.nMinHeight
), FUNIT_TWIP
);
1794 aWidthED
. SetMin(aWidthED
.NormalizePercent(aVal
.nMinWidth
), FUNIT_TWIP
);
1796 SwTwips
nMaxWidth(aVal
.nMaxWidth
);
1797 SwTwips
nMaxHeight(aVal
.nMaxHeight
);
1799 if (aVal
.bAutoHeight
&& (nDlgType
== DLG_FRM_GRF
|| nDlgType
== DLG_FRM_OLE
))
1801 SwTwips nTmp
= Min(nWidth
* nMaxHeight
/ Max(nHeight
, 1L), nMaxHeight
);
1802 aWidthED
.SetMax(aWidthED
.NormalizePercent(nTmp
), FUNIT_TWIP
);
1804 nTmp
= Min(nHeight
* nMaxWidth
/ Max(nWidth
, 1L), nMaxWidth
);
1805 aHeightED
.SetMax(aWidthED
.NormalizePercent(nTmp
), FUNIT_TWIP
);
1809 SwTwips nTmp
= static_cast< SwTwips
>(aHeightED
.NormalizePercent(nMaxHeight
));
1810 aHeightED
.SetMax(nTmp
, FUNIT_TWIP
);
1812 nTmp
= static_cast< SwTwips
>(aWidthED
.NormalizePercent(nMaxWidth
));
1813 aWidthED
.SetMax(nTmp
, FUNIT_TWIP
);
1816 aAtHorzPosED
.SetMin(aAtHorzPosED
.Normalize(aVal
.nMinHPos
), FUNIT_TWIP
);
1817 aAtHorzPosED
.SetMax(aAtHorzPosED
.Normalize(aVal
.nMaxHPos
), FUNIT_TWIP
);
1818 if ( aVal
.nHPos
!= nAtHorzPosVal
)
1819 aAtHorzPosED
.SetValue(aAtHorzPosED
.Normalize(aVal
.nHPos
), FUNIT_TWIP
);
1821 SwTwips nUpperOffset
= aVal
.nAnchorType
== FLY_IN_CNTNT
? nUpperBorder
: 0;
1822 SwTwips nLowerOffset
= aVal
.nAnchorType
== FLY_IN_CNTNT
? nLowerBorder
: 0;
1824 aAtVertPosED
.SetMin(aAtVertPosED
.Normalize(aVal
.nMinVPos
+ nLowerOffset
+ nUpperOffset
), FUNIT_TWIP
);
1825 aAtVertPosED
.SetMax(aAtVertPosED
.Normalize(aVal
.nMaxVPos
), FUNIT_TWIP
);
1826 if ( aVal
.nVPos
!= nAtVertPosVal
)
1827 aAtVertPosED
.SetValue(aAtVertPosED
.Normalize(aVal
.nVPos
), FUNIT_TWIP
);
1832 IMPL_LINK( SwFrmPage
, AnchorTypeHdl
, RadioButton
*, EMPTYARG
)
1834 aMirrorPagesCB
.Enable(!aAnchorAsCharRB
.IsChecked());
1836 // OD 06.11.2003 #i18732# - enable check box 'Follow text flow' for anchor
1837 // type to-paragraph' and to-character
1838 // OD 10.11.2003 #i22305# - enable check box 'Follow text
1839 // flow' also for anchor type to-frame.
1840 aFollowTextFlowCB
.Enable( aAnchorAtParaRB
.IsChecked() ||
1841 aAnchorAtCharRB
.IsChecked() ||
1842 aAnchorAtFrameRB
.IsChecked() );
1844 RndStdIds eId
= GetAnchor();
1846 InitPos( eId
, USHRT_MAX
, 0, USHRT_MAX
, 0, LONG_MAX
, LONG_MAX
);
1851 PosHdl(&aHorizontalDLB
);
1852 PosHdl(&aVerticalDLB
);
1857 /*--------------------------------------------------------------------
1859 --------------------------------------------------------------------*/
1861 IMPL_LINK( SwFrmPage
, PosHdl
, ListBox
*, pLB
)
1863 BOOL bHori
= pLB
== &aHorizontalDLB
;
1864 ListBox
*pRelLB
= bHori
? &aHoriRelationLB
: &aVertRelationLB
;
1865 FixedText
*pRelFT
= bHori
? &aHoriRelationFT
: &aVertRelationFT
;
1866 FrmMap
*pMap
= bHori
? pHMap
: pVMap
;
1868 USHORT nMapPos
= GetMapPos(pMap
, *pLB
);
1869 short nAlign
= GetAlignment(pMap
, nMapPos
, *pLB
, *pRelLB
);
1873 BOOL bEnable
= text::HoriOrientation::NONE
== nAlign
;
1874 aAtHorzPosED
.Enable( bEnable
);
1875 aAtHorzPosFT
.Enable( bEnable
);
1879 BOOL bEnable
= text::VertOrientation::NONE
== nAlign
;
1880 aAtVertPosED
.Enable( bEnable
);
1881 aAtVertPosFT
.Enable( bEnable
);
1884 if (pLB
) // Nur wenn Handler durch Aenderung des Controllers gerufen wurde
1885 RangeModifyHdl( 0 );
1888 if (pLB
->GetSelectEntryCount())
1891 if (pRelLB
->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND
)
1892 nRel
= ((RelationMap
*)pRelLB
->GetEntryData(pRelLB
->GetSelectEntryPos()))->nRelation
;
1894 FillRelLB(pMap
, nMapPos
, nAlign
, nRel
, *pRelLB
, *pRelFT
);
1902 bAtHorzPosModified
= TRUE
;
1904 bAtVertPosModified
= TRUE
;
1906 // Sonderbehandlung fuer HTML-Mode mit horz-vert-Abhaengigkeiten
1907 if(bHtmlMode
&& nHtmlMode
&HTMLMODE_SOME_ABS_POS
&&
1908 FLY_AUTO_CNTNT
== (RndStdIds
)GetAnchor())
1913 // rechts ist nur unterhalb erlaubt - von links nur oben
1914 // von links am Zeichen -> unterhalb
1915 if((text::HoriOrientation::LEFT
== nAlign
|| text::HoriOrientation::RIGHT
== nAlign
) &&
1916 0 == aVerticalDLB
.GetSelectEntryPos())
1918 if(text::RelOrientation::FRAME
== nRel
)
1919 aVerticalDLB
.SelectEntryPos(1);
1921 aVerticalDLB
.SelectEntryPos(0);
1924 else if(text::HoriOrientation::LEFT
== nAlign
&& 1 == aVerticalDLB
.GetSelectEntryPos())
1926 aVerticalDLB
.SelectEntryPos(0);
1929 else if(text::HoriOrientation::NONE
== nAlign
&& 1 == aVerticalDLB
.GetSelectEntryPos())
1931 aVerticalDLB
.SelectEntryPos(0);
1935 PosHdl(&aVerticalDLB
);
1939 if(text::VertOrientation::TOP
== nAlign
)
1941 if(1 == aHorizontalDLB
.GetSelectEntryPos())
1943 aHorizontalDLB
.SelectEntryPos(0);
1946 aHoriRelationLB
.SelectEntryPos(1);
1948 else if(text::VertOrientation::CHAR_BOTTOM
== nAlign
)
1950 if(2 == aHorizontalDLB
.GetSelectEntryPos())
1952 aHorizontalDLB
.SelectEntryPos(0);
1955 aHoriRelationLB
.SelectEntryPos(0) ;
1958 PosHdl(&aHorizontalDLB
);
1965 /*--------------------------------------------------------------------
1966 Beschreibung: Horizontale Pos
1967 --------------------------------------------------------------------*/
1969 IMPL_LINK( SwFrmPage
, RelHdl
, ListBox
*, pLB
)
1971 BOOL bHori
= pLB
== &aHoriRelationLB
;
1976 bAtHorzPosModified
= TRUE
;
1978 bAtVertPosModified
= TRUE
;
1980 if(bHtmlMode
&& FLY_AUTO_CNTNT
== (RndStdIds
)GetAnchor()) // wieder Sonderbehandlung
1984 USHORT nRel
= GetRelation(pHMap
, aHoriRelationLB
);
1985 if(text::RelOrientation::PRINT_AREA
== nRel
&& 0 == aVerticalDLB
.GetSelectEntryPos())
1987 aVerticalDLB
.SelectEntryPos(1);
1989 else if(text::RelOrientation::CHAR
== nRel
&& 1 == aVerticalDLB
.GetSelectEntryPos())
1991 aVerticalDLB
.SelectEntryPos(0);
1995 if (pLB
) // Nur wenn Handler durch Aenderung des Controllers gerufen wurde
2002 IMPL_LINK_INLINE_START( SwFrmPage
, RealSizeHdl
, Button
*, EMPTYARG
)
2004 aWidthED
.SetUserValue( aWidthED
. NormalizePercent(aGrfSize
.Width() ), FUNIT_TWIP
);
2005 aHeightED
.SetUserValue(aHeightED
.NormalizePercent(aGrfSize
.Height()), FUNIT_TWIP
);
2006 fWidthHeightRatio
= aGrfSize
.Height() ? double(aGrfSize
.Width()) / double(aGrfSize
.Height()) : 1.0;
2010 IMPL_LINK_INLINE_END( SwFrmPage
, RealSizeHdl
, Button
*, EMPTYARG
)
2013 IMPL_LINK( SwFrmPage
, AutoWidthClickHdl
, void*, EMPTYARG
)
2015 if( !IsInGraficMode() )
2016 HandleAutoCB( aAutoWidthCB
.IsChecked(), aWidthFT
, aWidthAutoFT
);
2020 IMPL_LINK( SwFrmPage
, AutoHeightClickHdl
, void*, EMPTYARG
)
2022 if( !IsInGraficMode() )
2023 HandleAutoCB( aAutoHeightCB
.IsChecked(), aHeightFT
, aHeightAutoFT
);
2027 IMPL_LINK( SwFrmPage
, ModifyHdl
, Edit
*, pEdit
)
2029 SwTwips nWidth
= static_cast< SwTwips
>(aWidthED
.DenormalizePercent(aWidthED
.GetValue(FUNIT_TWIP
)));
2030 SwTwips nHeight
= static_cast< SwTwips
>(aHeightED
.DenormalizePercent(aHeightED
.GetValue(FUNIT_TWIP
)));
2031 if ( aFixedRatioCB
.IsChecked() )
2033 if ( pEdit
== &aWidthED
)
2035 nHeight
= SwTwips((double)nWidth
/ fWidthHeightRatio
);
2036 aHeightED
.SetPrcntValue(aHeightED
.NormalizePercent(nHeight
), FUNIT_TWIP
);
2038 else if(pEdit
== &aHeightED
)
2040 nWidth
= SwTwips((double)nHeight
* fWidthHeightRatio
);
2041 aWidthED
.SetPrcntValue(aWidthED
.NormalizePercent(nWidth
), FUNIT_TWIP
);
2044 fWidthHeightRatio
= nHeight
? double(nWidth
) / double(nHeight
) : 1.0;
2049 /*--------------------------------------------------------------------
2051 --------------------------------------------------------------------*/
2053 void SwFrmPage::UpdateExample()
2055 USHORT nPos
= aHorizontalDLB
.GetSelectEntryPos();
2056 if ( pHMap
&& nPos
!= LISTBOX_ENTRY_NOTFOUND
)
2058 USHORT nMapPos
= GetMapPos(pHMap
, aHorizontalDLB
);
2059 short nAlign
= GetAlignment(pHMap
, nMapPos
, aHorizontalDLB
, aHoriRelationLB
);
2060 short nRel
= GetRelation(pHMap
, aHoriRelationLB
);
2062 aExampleWN
.SetHAlign(nAlign
);
2063 aExampleWN
.SetHoriRel(nRel
);
2066 nPos
= aVerticalDLB
.GetSelectEntryPos();
2067 if ( pVMap
&& nPos
!= LISTBOX_ENTRY_NOTFOUND
)
2069 USHORT nMapPos
= GetMapPos(pVMap
, aVerticalDLB
);
2070 short nAlign
= GetAlignment(pVMap
, nMapPos
, aVerticalDLB
, aVertRelationLB
);
2071 short nRel
= GetRelation(pVMap
, aVertRelationLB
);
2073 aExampleWN
.SetVAlign(nAlign
);
2074 aExampleWN
.SetVertRel(nRel
);
2078 long nXPos
= static_cast< long >(aAtHorzPosED
.Denormalize(aAtHorzPosED
.GetValue(FUNIT_TWIP
)));
2079 long nYPos
= static_cast< long >(aAtVertPosED
.Denormalize(aAtVertPosED
.GetValue(FUNIT_TWIP
)));
2080 aExampleWN
.SetRelPos(Point(nXPos
, nYPos
));
2082 aExampleWN
.SetAnchor( static_cast< USHORT
>(GetAnchor()) );
2083 aExampleWN
.Invalidate();
2086 void SwFrmPage::Init(const SfxItemSet
& rSet
, BOOL bReset
)
2090 SwWrtShell
* pSh
= ((SwFrmDlg
*)GetParent()->GetParent())->GetWrtShell();
2093 const BOOL bSizeFixed
= pSh
->IsSelObjProtected( FLYPROTECT_FIXED
);
2095 aWidthED
.Enable( !bSizeFixed
);
2096 aHeightED
.Enable( !bSizeFixed
);
2098 // size controls for math OLE objects
2099 if ( DLG_FRM_OLE
== nDlgType
&& ! bNew
)
2101 // disable width and height for math objects
2102 const SvGlobalName
& rFactNm( pSh
->GetOLEObject()->getClassID() );
2104 struct _GlobalNameId
{
2107 BYTE b8
, b9
, b10
, b11
, b12
, b13
, b14
, b15
;
2108 } aGlbNmIds
[4] = { { SO3_SM_CLASSID_60
}, { SO3_SM_CLASSID_50
},
2109 { SO3_SM_CLASSID_40
}, { SO3_SM_CLASSID_30
} };
2111 for ( int i
= 0; i
< 4; ++i
) {
2112 const _GlobalNameId
& rId
= aGlbNmIds
[ i
];
2114 SvGlobalName
aGlbNm( rId
.n1
, rId
.n2
, rId
.n3
,
2115 rId
.b8
, rId
.b9
, rId
.b10
, rId
.b11
,
2116 rId
.b12
, rId
.b13
, rId
.b14
, rId
.b15
);
2118 if( rFactNm
== aGlbNm
)
2120 // disable size controls for math OLE objects
2123 aRelWidthCB
.Disable();
2124 aHeightFT
.Disable();
2125 aHeightED
.Disable();
2126 aRelHeightCB
.Disable();
2127 aFixedRatioCB
.Disable();
2128 aRealSizeBT
.Disable();
2133 // TODO/LATER: get correct aspect
2134 if(0 != (pSh
->GetOLEObject()->getStatus( embed::Aspects::MSOLE_CONTENT
) & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE
) )
2135 aRealSizeBT
.Disable();
2139 const SwFmtFrmSize
& rSize
= (const SwFmtFrmSize
&)rSet
.Get(RES_FRM_SIZE
);
2140 sal_Int64 nWidth
= aWidthED
.NormalizePercent(rSize
.GetWidth());
2141 sal_Int64 nHeight
= aHeightED
.NormalizePercent(rSize
.GetHeight());
2143 if (nWidth
!= aWidthED
.GetValue(FUNIT_TWIP
))
2147 // Wert wurde von Umlauf-Tabpage geaendert und muss
2148 // mit Modify-Flag gesetzt werden
2149 aWidthED
.SetUserValue(nWidth
, FUNIT_TWIP
);
2152 aWidthED
.SetPrcntValue(nWidth
, FUNIT_TWIP
);
2155 if (nHeight
!= aHeightED
.GetValue(FUNIT_TWIP
))
2159 // Wert wurde von Umlauf-Tabpage geaendert und muss
2160 // mit Modify-Flag gesetzt werden
2161 aHeightED
.SetUserValue(nHeight
, FUNIT_TWIP
);
2164 aHeightED
.SetPrcntValue(nHeight
, FUNIT_TWIP
);
2167 if (!IsInGraficMode())
2169 SwFrmSize eSize
= rSize
.GetHeightSizeType();
2170 BOOL bCheck
= eSize
!= ATT_FIX_SIZE
;
2171 aAutoHeightCB
.Check( bCheck
);
2172 HandleAutoCB( bCheck
, aHeightFT
, aHeightAutoFT
);
2173 if( eSize
== ATT_VAR_SIZE
)
2174 aHeightED
.SetValue( aHeightED
.GetMin(), FUNIT_NONE
);
2176 eSize
= rSize
.GetWidthSizeType();
2177 bCheck
= eSize
!= ATT_FIX_SIZE
;
2178 aAutoWidthCB
.Check( bCheck
);
2179 HandleAutoCB( bCheck
, aWidthFT
, aWidthAutoFT
);
2180 if( eSize
== ATT_VAR_SIZE
)
2181 aWidthED
.SetValue( aWidthED
.GetMin(), FUNIT_NONE
);
2185 SwWrtShell
* pSh
= ((SwFrmDlg
*)GetParent()->GetParent())->GetWrtShell();
2186 const SwFrmFmt
* pFmt
= pSh
->GetFlyFrmFmt();
2187 if( pFmt
&& pFmt
->GetChain().GetNext() )
2188 aAutoHeightCB
.Enable( FALSE
);
2192 aAutoHeightCB
.Hide();
2194 // Umlauf-Abstand fuer zeichengebundene Rahmen organisieren
2195 const SvxULSpaceItem
&rUL
= (const SvxULSpaceItem
&)rSet
.Get(RES_UL_SPACE
);
2196 nUpperBorder
= rUL
.GetUpper();
2197 nLowerBorder
= rUL
.GetLower();
2199 if(SFX_ITEM_SET
== rSet
.GetItemState(FN_KEEP_ASPECT_RATIO
))
2201 aFixedRatioCB
.Check(((const SfxBoolItem
&)rSet
.Get(FN_KEEP_ASPECT_RATIO
)).GetValue());
2202 aFixedRatioCB
.SaveValue();
2206 SwFmtCol
aCol( (const SwFmtCol
&)rSet
.Get(RES_COL
) );
2207 ::FitToActualSize( aCol
, (USHORT
)rSize
.GetWidth() );
2209 RndStdIds eAnchorId
= (RndStdIds
)GetAnchor();
2211 if ( bNew
&& !bFormat
)
2212 InitPos(eAnchorId
, USHRT_MAX
, 0, USHRT_MAX
, USHRT_MAX
, LONG_MAX
, LONG_MAX
);
2215 const SwFmtHoriOrient
& rHori
= (const SwFmtHoriOrient
&)rSet
.Get(RES_HORI_ORIENT
);
2216 const SwFmtVertOrient
& rVert
= (const SwFmtVertOrient
&)rSet
.Get(RES_VERT_ORIENT
);
2217 nOldH
= rHori
.GetHoriOrient();
2218 nOldHRel
= rHori
.GetRelationOrient();
2219 nOldV
= rVert
.GetVertOrient(),
2220 nOldVRel
= rVert
.GetRelationOrient();
2222 if (eAnchorId
== FLY_PAGE
)
2224 if (nOldHRel
== text::RelOrientation::FRAME
)
2225 nOldHRel
= text::RelOrientation::PAGE_FRAME
;
2226 else if (nOldHRel
== text::RelOrientation::PRINT_AREA
)
2227 nOldHRel
= text::RelOrientation::PAGE_PRINT_AREA
;
2228 if (nOldVRel
== text::RelOrientation::FRAME
)
2229 nOldVRel
= text::RelOrientation::PAGE_FRAME
;
2230 else if (nOldVRel
== text::RelOrientation::PRINT_AREA
)
2231 nOldVRel
= text::RelOrientation::PAGE_PRINT_AREA
;
2234 aMirrorPagesCB
.Check(rHori
.IsPosToggle());
2235 aMirrorPagesCB
.SaveValue();
2246 // Transparent fuers Bsp
2248 const SwFmtSurround
& rSurround
= (const SwFmtSurround
&)rSet
.Get(RES_SURROUND
);
2249 aExampleWN
.SetWrap ( static_cast< USHORT
>(rSurround
.GetSurround()) );
2251 if ( rSurround
.GetSurround() == SURROUND_THROUGHT
)
2253 const SvxOpaqueItem
& rOpaque
= (const SvxOpaqueItem
&)rSet
.Get(RES_OPAQUE
);
2254 aExampleWN
.SetTransparent(!rOpaque
.GetValue());
2257 // ggf auf Prozent umschalten
2258 RangeModifyHdl(&aWidthED
); // Referenzwerte setzen (fuer 100%)
2260 if (rSize
.GetWidthPercent() == 0xff || rSize
.GetHeightPercent() == 0xff)
2261 aFixedRatioCB
.Check(TRUE
);
2262 if (rSize
.GetWidthPercent() && rSize
.GetWidthPercent() != 0xff &&
2263 !aRelWidthCB
.IsChecked())
2265 aRelWidthCB
.Check(TRUE
);
2266 RelSizeClickHdl(&aRelWidthCB
);
2267 aWidthED
.SetPrcntValue(rSize
.GetWidthPercent(), FUNIT_CUSTOM
);
2269 if (rSize
.GetHeightPercent() && rSize
.GetHeightPercent() != 0xff &&
2270 !aRelHeightCB
.IsChecked())
2272 aRelHeightCB
.Check(TRUE
);
2273 RelSizeClickHdl(&aRelHeightCB
);
2274 aHeightED
.SetPrcntValue(rSize
.GetHeightPercent(), FUNIT_CUSTOM
);
2276 aRelWidthCB
.SaveValue();
2277 aRelHeightCB
.SaveValue();
2280 USHORT
* SwFrmPage::GetRanges()
2284 /* -----------------------------03.11.00 10:52--------------------------------
2286 ---------------------------------------------------------------------------*/
2287 void SwFrmPage::SetFormatUsed(BOOL bFmt
)
2292 aAnchorAtPageRB
.Hide();
2293 aAnchorAtParaRB
.Hide();
2294 aAnchorAtCharRB
.Hide();
2295 aAnchorAsCharRB
.Hide();
2296 aAnchorAtFrameRB
.Hide();
2300 // Point aSizePos = aSizeFL.GetPosPixel();
2301 // Size aSizeSize = aSizeFL.GetSizePixel();
2302 // aSizeSize.Width() = aTypeFL.GetPosPixel().X() +
2303 // aTypeFL.GetSizePixel().Width() - aSizePos.X();
2304 // aSizeFL.SetSizePixel(aSizeSize);
2308 /*--------------------------------------------------------------------
2310 --------------------------------------------------------------------*/
2312 SwGrfExtPage::SwGrfExtPage(Window
*pParent
, const SfxItemSet
&rSet
) :
2313 SfxTabPage( pParent
, SW_RES(TP_GRF_EXT
), rSet
),
2314 aMirrorFL (this, SW_RES( FL_MIRROR
)),
2315 aMirrorVertBox (this, SW_RES( CB_VERT
)),
2316 aMirrorHorzBox (this, SW_RES( CB_HOR
)),
2317 aAllPagesRB (this, SW_RES( RB_MIRROR_ALL_PAGES
)),
2318 aLeftPagesRB (this, SW_RES( RB_MIRROR_LEFT_PAGES
)),
2319 aRightPagesRB (this, SW_RES( RB_MIRROR_RIGHT_PAGES
)),
2320 aBmpWin (this, WN_BMP
, Graphic(), BitmapEx(SW_RES(BMP_EXAMPLE
)), BitmapEx(SW_RES(BMP_EXAMPLE_HC
)) ),
2321 aConnectFL (this, SW_RES( FL_CONNECT
)),
2322 aConnectFT (this, SW_RES( FT_CONNECT
)),
2323 aConnectED (this, SW_RES( ED_CONNECT
)),
2324 aBrowseBT (this, SW_RES( PB_BROWSE
)),
2329 SetExchangeSupport();
2330 aMirrorHorzBox
.SetClickHdl( LINK(this, SwGrfExtPage
, MirrorHdl
));
2331 aMirrorVertBox
.SetClickHdl( LINK(this, SwGrfExtPage
, MirrorHdl
));
2332 aBrowseBT
.SetClickHdl ( LINK(this, SwGrfExtPage
, BrowseHdl
));
2335 /*--------------------------------------------------------------------
2337 --------------------------------------------------------------------*/
2339 SwGrfExtPage::~SwGrfExtPage()
2344 /*--------------------------------------------------------------------
2346 --------------------------------------------------------------------*/
2348 SfxTabPage
* SwGrfExtPage::Create( Window
*pParent
, const SfxItemSet
&rSet
)
2350 return new SwGrfExtPage( pParent
, rSet
);
2353 /*--------------------------------------------------------------------
2355 --------------------------------------------------------------------*/
2357 void SwGrfExtPage::Reset(const SfxItemSet
&rSet
)
2359 const SfxPoolItem
* pItem
;
2360 USHORT nHtmlMode
= ::GetHtmlMode((const SwDocShell
*)SfxObjectShell::Current());
2361 bHtmlMode
= nHtmlMode
& HTMLMODE_ON
? TRUE
: FALSE
;
2363 if( SFX_ITEM_SET
== rSet
.GetItemState( FN_PARAM_GRF_CONNECT
, TRUE
, &pItem
)
2364 && ((const SfxBoolItem
*)pItem
)->GetValue() )
2367 aConnectED
.SetReadOnly(FALSE
);
2373 /*--------------------------------------------------------------------
2375 --------------------------------------------------------------------*/
2377 void SwGrfExtPage::ActivatePage(const SfxItemSet
& rSet
)
2379 const SvxProtectItem
& rProt
= (const SvxProtectItem
& )rSet
.Get(RES_PROTECT
);
2380 BOOL bProtCntnt
= rProt
.IsCntntProtected();
2382 const SfxPoolItem
* pItem
= 0;
2383 BOOL bEnable
= FALSE
;
2384 BOOL bEnableMirrorRB
= FALSE
;
2386 SfxItemState eState
= rSet
.GetItemState(RES_GRFATR_MIRRORGRF
, TRUE
, &pItem
);
2387 if( SFX_ITEM_UNKNOWN
!= eState
&& !bProtCntnt
&& !bHtmlMode
)
2389 if( SFX_ITEM_SET
!= eState
)
2390 pItem
= &rSet
.Get( RES_GRFATR_MIRRORGRF
);
2394 MirrorGraph eMirror
= static_cast< MirrorGraph
>(((const SwMirrorGrf
* )pItem
)->GetValue());
2397 case RES_MIRROR_GRAPH_DONT
: break;
2398 case RES_MIRROR_GRAPH_VERT
: aMirrorHorzBox
.Check(TRUE
); break;
2399 case RES_MIRROR_GRAPH_HOR
: aMirrorVertBox
.Check(TRUE
); break;
2400 case RES_MIRROR_GRAPH_BOTH
: aMirrorHorzBox
.Check(TRUE
);
2401 aMirrorVertBox
.Check(TRUE
);
2407 USHORT nPos
= ((const SwMirrorGrf
* )pItem
)->IsGrfToggle() ? 1 : 0;
2408 nPos
+= (eMirror
== RES_MIRROR_GRAPH_VERT
|| eMirror
== RES_MIRROR_GRAPH_BOTH
)
2411 bEnableMirrorRB
= nPos
!= 0;
2415 case 1: // Auf linken bzw geraden Seiten spiegeln
2416 aLeftPagesRB
.Check();
2417 aMirrorHorzBox
.Check(TRUE
);
2419 case 2: // Auf allen Seiten spiegeln
2420 aAllPagesRB
.Check();
2422 case 3: // Auf rechten bzw ungeraden Seiten spiegeln
2423 aRightPagesRB
.Check();
2426 aAllPagesRB
.Check();
2431 if( SFX_ITEM_SET
== rSet
.GetItemState( SID_ATTR_GRAF_GRAPHIC
, FALSE
, &pItem
) )
2433 const SvxBrushItem
& rBrush
= *(SvxBrushItem
*)pItem
;
2434 if( rBrush
.GetGraphicLink() )
2436 aGrfName
= aNewGrfName
= *rBrush
.GetGraphicLink();
2437 aConnectED
.SetText( aNewGrfName
);
2439 const Graphic
* pGrf
= rBrush
.GetGraphic();
2441 aBmpWin
.SetGraphic( *pGrf
);
2444 aAllPagesRB
.Enable(bEnableMirrorRB
);
2445 aLeftPagesRB
.Enable(bEnableMirrorRB
);
2446 aRightPagesRB
.Enable(bEnableMirrorRB
);
2447 aMirrorHorzBox
.Enable(bEnable
);
2448 aMirrorVertBox
.Enable(bEnable
);
2449 aMirrorFL
.Enable(bEnable
);
2451 aAllPagesRB
.SaveValue();
2452 aLeftPagesRB
.SaveValue();
2453 aRightPagesRB
.SaveValue();
2454 aMirrorHorzBox
.SaveValue();
2455 aMirrorVertBox
.SaveValue();
2457 aBmpWin
.MirrorHorz( aMirrorVertBox
.IsChecked() );
2458 aBmpWin
.MirrorVert( aMirrorHorzBox
.IsChecked() );
2459 aBmpWin
.Invalidate();
2462 /*--------------------------------------------------------------------
2464 --------------------------------------------------------------------*/
2466 BOOL
SwGrfExtPage::FillItemSet( SfxItemSet
&rSet
)
2468 BOOL bModified
= FALSE
;
2469 if ( aMirrorHorzBox
.GetSavedValue() != aMirrorHorzBox
.IsChecked() ||
2470 aMirrorVertBox
.GetSavedValue() != aMirrorVertBox
.IsChecked() ||
2471 aAllPagesRB
.GetSavedValue() != aAllPagesRB
.IsChecked() ||
2472 aLeftPagesRB
.GetSavedValue() != aLeftPagesRB
.IsChecked() ||
2473 aRightPagesRB
.GetSavedValue() != aRightPagesRB
.IsChecked())
2479 if (aMirrorHorzBox
.IsChecked() &&
2480 !aLeftPagesRB
.IsChecked())
2483 MirrorGraph eMirror
;
2484 eMirror
= aMirrorVertBox
.IsChecked() && bHori
?
2485 RES_MIRROR_GRAPH_BOTH
: bHori
?
2486 RES_MIRROR_GRAPH_VERT
: aMirrorVertBox
.IsChecked() ?
2487 RES_MIRROR_GRAPH_HOR
: RES_MIRROR_GRAPH_DONT
;
2489 BOOL bMirror
= !aAllPagesRB
.IsChecked();
2490 SwMirrorGrf
aMirror( eMirror
);
2491 aMirror
.SetGrfToggle(bMirror
);
2492 rSet
.Put( aMirror
);
2495 if( aGrfName
!= aNewGrfName
|| aConnectED
.IsModified() )
2498 aGrfName
= aConnectED
.GetText();
2499 rSet
.Put( SvxBrushItem( aGrfName
, aFilterName
, GPOS_LT
,
2500 SID_ATTR_GRAF_GRAPHIC
));
2504 /*--------------------------------------------------------------------
2506 --------------------------------------------------------------------*/
2508 int SwGrfExtPage::DeactivatePage(SfxItemSet
*_pSet
)
2511 FillItemSet( *_pSet
);
2515 /*--------------------------------------------------------------------
2517 --------------------------------------------------------------------*/
2519 IMPL_LINK( SwGrfExtPage
, BrowseHdl
, Button
*, EMPTYARG
)
2523 pGrfDlg
= new FileDialogHelper( SFXWB_GRAPHIC
);
2524 pGrfDlg
->SetTitle(SW_RESSTR(STR_EDIT_GRF
));
2526 pGrfDlg
->SetDisplayDirectory( aConnectED
.GetText() );
2527 uno::Reference
< ui::dialogs::XFilePicker
> xFP
= pGrfDlg
->GetFilePicker();
2528 uno::Reference
< ui::dialogs::XFilePickerControlAccess
> xCtrlAcc(xFP
, uno::UNO_QUERY
);
2529 sal_Bool bTrue
= sal_True
;
2530 uno::Any
aVal(&bTrue
, ::getBooleanCppuType());
2531 xCtrlAcc
->setValue( ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK
, 0, aVal
);
2533 if ( pGrfDlg
->Execute() == ERRCODE_NONE
)
2534 { // ausgewaehlten Filter merken
2535 aFilterName
= pGrfDlg
->GetCurrentFilter();
2536 aNewGrfName
= INetURLObject::decode( pGrfDlg
->GetPath(),
2538 INetURLObject::DECODE_UNAMBIGUOUS
,
2539 RTL_TEXTENCODING_UTF8
);
2540 aConnectED
.SetModifyFlag();
2541 aConnectED
.SetText( aNewGrfName
);
2542 //Spiegeln zuruecksetzen, da u. U. eine Bitmap
2543 //gegen eine andere Art von Grafik ausgetauscht worden ist,
2544 //die nicht gespiegelt werden kann.
2545 aMirrorVertBox
.Check(FALSE
);
2546 aMirrorHorzBox
.Check(FALSE
);
2547 aAllPagesRB
.Enable(FALSE
);
2548 aLeftPagesRB
.Enable(FALSE
);
2549 aRightPagesRB
.Enable(FALSE
);
2550 aBmpWin
.MirrorHorz(FALSE
);
2551 aBmpWin
.MirrorVert(FALSE
);
2554 ::LoadGraphic( pGrfDlg
->GetPath(), aEmptyStr
, aGraphic
);
2555 aBmpWin
.SetGraphic(aGraphic
);
2557 BOOL bEnable
= GRAPHIC_BITMAP
== aGraphic
.GetType() ||
2558 GRAPHIC_GDIMETAFILE
== aGraphic
.GetType();
2559 aMirrorVertBox
.Enable(bEnable
);
2560 aMirrorHorzBox
.Enable(bEnable
);
2561 aAllPagesRB
.Enable(bEnable
);
2562 aLeftPagesRB
.Enable(bEnable
);
2563 aRightPagesRB
.Enable(bEnable
);
2567 /*--------------------------------------------------------------------
2569 --------------------------------------------------------------------*/
2571 IMPL_LINK( SwGrfExtPage
, MirrorHdl
, CheckBox
*, EMPTYARG
)
2573 BOOL bEnable
= aMirrorHorzBox
.IsChecked();
2575 aBmpWin
.MirrorHorz( aMirrorVertBox
.IsChecked() );
2576 aBmpWin
.MirrorVert( bEnable
);
2578 aAllPagesRB
.Enable(bEnable
);
2579 aLeftPagesRB
.Enable(bEnable
);
2580 aRightPagesRB
.Enable(bEnable
);
2582 if (!aAllPagesRB
.IsChecked() && !aLeftPagesRB
.IsChecked() && !aRightPagesRB
.IsChecked())
2583 aAllPagesRB
.Check();
2588 /*--------------------------------------------------------------------
2589 Beschreibung: BeispielWindow
2590 --------------------------------------------------------------------*/
2592 BmpWindow::BmpWindow( Window
* pPar
, USHORT nId
,
2593 const Graphic
& rGraphic
, const BitmapEx
& rBmp
, const BitmapEx
& rBmpHC
) :
2594 Window(pPar
, SW_RES(nId
)),
2606 void BmpWindow::Paint( const Rectangle
& )
2609 Size
aPntSz( GetSizePixel() );
2612 aGrfSize
= ::GetGraphicSizeTwip(aGraphic
, this);
2613 //it should show the default bitmap also if no graphic can be found
2614 if(!aGrfSize
.Width() && !aGrfSize
.Height())
2615 aGrfSize
= PixelToLogic(aBmp
.GetSizePixel());
2617 long nRelGrf
= aGrfSize
.Width() * 100L / aGrfSize
.Height();
2618 long nRelWin
= aPntSz
.Width() * 100L / aPntSz
.Height();
2619 if(nRelGrf
< nRelWin
)
2621 const long nWidth
= aPntSz
.Width();
2622 aPntSz
.Width() = aPntSz
.Height() * nRelGrf
/100;
2624 aPntPos
.X() += nWidth
- aPntSz
.Width() ;
2629 aPntPos
.Y() += aPntSz
.Height();
2631 aPntSz
.Height() *= -1;
2635 aPntPos
.X() += aPntSz
.Width();
2637 aPntSz
.Width() *= -1;
2641 aGraphic
.Draw( this, aPntPos
, aPntSz
);
2644 bool bIsDark
= ( GetSettings().GetStyleSettings().GetWindowColor().IsDark() != FALSE
);
2645 DrawBitmapEx( aPntPos
, aPntSz
, bIsDark
? aBmpHC
: aBmp
);
2649 BmpWindow::~BmpWindow()
2653 void BmpWindow::SetGraphic(const Graphic
& rGrf
)
2656 Size aGrfSize
= ::GetGraphicSizeTwip(aGraphic
, this);
2657 bGraphic
= aGrfSize
.Width() && aGrfSize
.Height();
2661 /***************************************************************************
2662 Beschreibung: URL und ImageMap an Rahmen einstellen
2663 ***************************************************************************/
2666 SwFrmURLPage::SwFrmURLPage( Window
*pParent
, const SfxItemSet
&rSet
) :
2667 SfxTabPage(pParent
, SW_RES(TP_FRM_URL
), rSet
),
2668 aHyperLinkFL (this, SW_RES( FL_HYPERLINK
)),
2669 aURLFT (this, SW_RES( FT_URL
)),
2670 aURLED (this, SW_RES( ED_URL
)),
2671 aSearchPB (this, SW_RES( PB_SEARCH
)),
2672 aNameFT (this, SW_RES( FT_NAME
)),
2673 aNameED (this, SW_RES( ED_NAME
)),
2674 aFrameFT (this, SW_RES( FT_FRAME
)),
2675 aFrameCB (this, SW_RES( CB_FRAME
)),
2677 aImageFL (this, SW_RES( FL_IMAGE
)),
2678 aServerCB (this, SW_RES( CB_SERVER
)),
2679 aClientCB (this, SW_RES( CB_CLIENT
))
2682 aSearchPB
.SetClickHdl(LINK(this, SwFrmURLPage
, InsertFileHdl
));
2685 /***************************************************************************
2687 ***************************************************************************/
2689 SwFrmURLPage::~SwFrmURLPage()
2693 /***************************************************************************
2695 ***************************************************************************/
2697 void SwFrmURLPage::Reset( const SfxItemSet
&rSet
)
2699 const SfxPoolItem
* pItem
;
2700 if ( SFX_ITEM_SET
== rSet
.GetItemState( SID_DOCFRAME
, TRUE
, &pItem
))
2702 TargetList
* pList
= new TargetList
;
2703 ((const SfxFrameItem
*)pItem
)->GetFrame()->GetTargetList(*pList
);
2704 USHORT nCount
= (USHORT
)pList
->Count();
2708 for ( i
= 0; i
< nCount
; i
++ )
2710 aFrameCB
.InsertEntry(*pList
->GetObject(i
));
2712 for ( i
= nCount
; i
; i
-- )
2714 delete pList
->GetObject( i
- 1 );
2720 if ( SFX_ITEM_SET
== rSet
.GetItemState( RES_URL
, TRUE
, &pItem
) )
2722 const SwFmtURL
* pFmtURL
= (const SwFmtURL
*)pItem
;
2723 aURLED
.SetText( INetURLObject::decode( pFmtURL
->GetURL(),
2725 INetURLObject::DECODE_UNAMBIGUOUS
,
2726 RTL_TEXTENCODING_UTF8
));
2727 aNameED
.SetText( pFmtURL
->GetName());
2729 aClientCB
.Enable( pFmtURL
->GetMap() != 0 );
2730 aClientCB
.Check ( pFmtURL
->GetMap() != 0 );
2731 aServerCB
.Check ( pFmtURL
->IsServerMap() );
2733 aFrameCB
.SetText(pFmtURL
->GetTargetFrameName());
2734 aFrameCB
.SaveValue();
2737 aClientCB
.Enable( FALSE
);
2739 aServerCB
.SaveValue();
2740 aClientCB
.SaveValue();
2745 /***************************************************************************
2747 ***************************************************************************/
2749 BOOL
SwFrmURLPage::FillItemSet(SfxItemSet
&rSet
)
2751 BOOL bModified
= FALSE
;
2752 const SwFmtURL
* pOldURL
= (SwFmtURL
*)GetOldItem(rSet
, RES_URL
);
2755 pFmtURL
= (SwFmtURL
*)pOldURL
->Clone();
2757 pFmtURL
= new SwFmtURL();
2760 String sText
= aURLED
.GetText();
2762 if( pFmtURL
->GetURL() != sText
||
2763 pFmtURL
->GetName() != aNameED
.GetText() ||
2764 aServerCB
.IsChecked() != pFmtURL
->IsServerMap() )
2766 pFmtURL
->SetURL( sText
, aServerCB
.IsChecked() );
2767 pFmtURL
->SetName( aNameED
.GetText() );
2772 if(!aClientCB
.IsChecked() && pFmtURL
->GetMap() != 0)
2778 if(pFmtURL
->GetTargetFrameName() != aFrameCB
.GetText())
2780 pFmtURL
->SetTargetFrameName(aFrameCB
.GetText());
2788 /***************************************************************************
2790 ***************************************************************************/
2792 SfxTabPage
* SwFrmURLPage::Create(Window
*pParent
, const SfxItemSet
&rSet
)
2794 return new SwFrmURLPage( pParent
, rSet
);
2797 /***************************************************************************
2799 ***************************************************************************/
2801 IMPL_LINK( SwFrmURLPage
, InsertFileHdl
, PushButton
*, EMPTYARG
)
2803 FileDialogHelper
aDlgHelper( ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE
, 0 );
2804 uno::Reference
< ui::dialogs::XFilePicker
> xFP
= aDlgHelper
.GetFilePicker();
2808 String
sTemp(aURLED
.GetText());
2810 xFP
->setDisplayDirectory(sTemp
);
2812 catch( const uno::Exception
& rEx
)
2816 if( aDlgHelper
.Execute() == ERRCODE_NONE
)
2818 aURLED
.SetText( xFP
->getFiles().getConstArray()[0] );
2824 /* -----------------------------03.11.00 10:56--------------------------------
2826 ---------------------------------------------------------------------------*/
2827 void lcl_Move(Window
& rWin
, sal_Int32 nDiff
)
2829 Point
aPos(rWin
.GetPosPixel());
2831 rWin
.SetPosPixel(aPos
);
2834 /*-----------------13.11.96 13.15-------------------
2836 --------------------------------------------------*/
2838 SwFrmAddPage::SwFrmAddPage(Window
*pParent
, const SfxItemSet
&rSet
) :
2839 SfxTabPage(pParent
, SW_RES(TP_FRM_ADD
), rSet
),
2841 aNameFT (this, SW_RES(FT_NAME
)),
2842 aNameED (this, SW_RES(ED_NAME
)),
2843 aAltNameFT (this, SW_RES(FT_ALT_NAME
)),
2844 aAltNameED (this, SW_RES(ED_ALT_NAME
)),
2845 aPrevFT (this, SW_RES(FT_PREV
)),
2846 aPrevLB (this, SW_RES(LB_PREV
)),
2847 aNextFT (this, SW_RES(FT_NEXT
)),
2848 aNextLB (this, SW_RES(LB_NEXT
)),
2849 aNamesFL (this, SW_RES(FL_NAME
)),
2851 aProtectContentCB (this, SW_RES(CB_PROTECT_CONTENT
)),
2852 aProtectFrameCB (this, SW_RES(CB_PROTECT_FRAME
)),
2853 aProtectSizeCB (this, SW_RES(CB_PROTECT_SIZE
)),
2854 aProtectFL (this, SW_RES(FL_PROTECT
)),
2856 aEditInReadonlyCB (this, SW_RES(CB_EDIT_IN_READONLY
)),
2857 aPrintFrameCB (this, SW_RES(CB_PRINT_FRAME
)),
2858 aTextFlowFT (this, SW_RES(FT_TEXTFLOW
)),
2859 aTextFlowLB (this, SW_RES(LB_TEXTFLOW
)),
2861 aExtFL (this, SW_RES(FL_EXT
)),
2866 bHtmlMode(sal_False
),
2874 /*-----------------13.11.96 13.15-------------------
2876 --------------------------------------------------*/
2878 SwFrmAddPage::~SwFrmAddPage()
2882 /*-----------------13.11.96 13.15-------------------
2884 --------------------------------------------------*/
2886 SfxTabPage
* SwFrmAddPage::Create(Window
*pParent
, const SfxItemSet
&rSet
)
2888 return new SwFrmAddPage(pParent
, rSet
);
2891 /*-----------------13.11.96 13.14-------------------
2893 --------------------------------------------------*/
2895 void SwFrmAddPage::Reset(const SfxItemSet
&rSet
)
2897 const SfxPoolItem
* pItem
;
2898 USHORT nHtmlMode
= ::GetHtmlMode((const SwDocShell
*)SfxObjectShell::Current());
2899 bHtmlMode
= nHtmlMode
& HTMLMODE_ON
? TRUE
: FALSE
;
2902 aProtectContentCB
.Hide();
2903 aProtectFrameCB
.Hide();
2904 aProtectSizeCB
.Hide();
2905 aEditInReadonlyCB
.Hide();
2906 aPrintFrameCB
.Hide();
2910 if ( DLG_FRM_GRF
== nDlgType
|| DLG_FRM_OLE
== nDlgType
)
2912 aEditInReadonlyCB
.Hide();
2913 aPrintFrameCB
.SetPosPixel(aEditInReadonlyCB
.GetPosPixel());
2916 if(SFX_ITEM_SET
== rSet
.GetItemState(FN_SET_FRM_ALT_NAME
, FALSE
, &pItem
))
2918 aAltNameED
.SetText(((const SfxStringItem
*)pItem
)->GetValue());
2919 aAltNameED
.SaveValue();
2924 // Grafik einfuegen - Eigenschaften
2925 // bNew ist nicht gesetzt, deswegen ueber Selektion erkennen
2927 if(SFX_ITEM_SET
== rSet
.GetItemState(FN_SET_FRM_NAME
, FALSE
, &pItem
))
2929 aTmpName1
= ((const SfxStringItem
*)pItem
)->GetValue();
2932 DBG_ASSERT(pWrtSh
, "keine Shell?");
2933 if( bNew
|| !aTmpName1
.Len() )
2938 aTmpName1
= pWrtSh
->GetUniqueGrfName();
2941 aTmpName1
= pWrtSh
->GetUniqueOLEName();
2944 aTmpName1
= pWrtSh
->GetUniqueFrameName();
2948 aNameED
.SetText( aTmpName1
);
2949 aNameED
.SaveValue();
2953 aNameED
.Enable( FALSE
);
2954 aAltNameED
.Enable(FALSE
);
2955 aNameFT
.Enable( FALSE
);
2956 aAltNameFT
.Enable(FALSE
);
2957 aNamesFL
.Enable(FALSE
);
2959 if(nDlgType
== DLG_FRM_STD
&& aAltNameFT
.IsVisible())
2963 //move all controls one step up
2964 Window
* aWindows
[] =
2982 sal_Int32 nOffset
= aAltNameED
.GetPosPixel().Y() - aNameED
.GetPosPixel().Y();
2984 while(aWindows
[nIdx
])
2986 lcl_Move(*aWindows
[nIdx
++], nOffset
);
2991 aNameED
.SetModifyHdl(LINK(this, SwFrmAddPage
, EditModifyHdl
));
2996 SwFrmFmt
* pFmt
= pWrtSh
->GetFlyFrmFmt();
3000 const SwFmtChain
&rChain
= pFmt
->GetChain();
3001 const SwFlyFrmFmt
* pFlyFmt
;
3002 String sNextChain
, sPrevChain
;
3003 if ((pFlyFmt
= rChain
.GetPrev()) != 0)
3005 sPrevChain
= pFlyFmt
->GetName();
3008 if ((pFlyFmt
= rChain
.GetNext()) != 0)
3010 sNextChain
= pFlyFmt
->GetName();
3012 //determine chainable frames
3013 ::std::vector
< String
> aPrevPageFrames
;
3014 ::std::vector
< String
> aThisPageFrames
;
3015 ::std::vector
< String
> aNextPageFrames
;
3016 ::std::vector
< String
> aRemainFrames
;
3017 pWrtSh
->GetConnectableFrmFmts(*pFmt
, sNextChain
, FALSE
,
3018 aPrevPageFrames
, aThisPageFrames
, aNextPageFrames
, aRemainFrames
);
3019 lcl_InsertVectors(aPrevLB
, aPrevPageFrames
, aThisPageFrames
, aNextPageFrames
, aRemainFrames
);
3020 if(sPrevChain
.Len())
3022 if(LISTBOX_ENTRY_NOTFOUND
== aPrevLB
.GetEntryPos(sPrevChain
))
3023 aPrevLB
.InsertEntry(sPrevChain
, 1);
3024 aPrevLB
.SelectEntry(sPrevChain
);
3027 aPrevLB
.SelectEntryPos(0);
3028 aPrevPageFrames
.erase(aPrevPageFrames
.begin(), aPrevPageFrames
.end());
3029 aNextPageFrames
.erase(aNextPageFrames
.begin(), aNextPageFrames
.end());
3030 aThisPageFrames
.erase(aThisPageFrames
.begin(), aThisPageFrames
.end());
3031 aRemainFrames
.erase(aRemainFrames
.begin(), aRemainFrames
.end());
3034 pWrtSh
->GetConnectableFrmFmts(*pFmt
, sPrevChain
, TRUE
,
3035 aPrevPageFrames
, aThisPageFrames
, aNextPageFrames
, aRemainFrames
);
3036 lcl_InsertVectors(aNextLB
, aPrevPageFrames
, aThisPageFrames
, aNextPageFrames
, aRemainFrames
);
3037 if(sNextChain
.Len())
3039 if(LISTBOX_ENTRY_NOTFOUND
== aNextLB
.GetEntryPos(sNextChain
))
3040 aNextLB
.InsertEntry(sNextChain
, 1);
3041 aNextLB
.SelectEntry(sNextChain
);
3044 aNextLB
.SelectEntryPos(0);
3045 Link
aLink(LINK(this, SwFrmAddPage
, ChainModifyHdl
));
3046 aPrevLB
.SetSelectHdl(aLink
);
3047 aNextLB
.SetSelectHdl(aLink
);
3051 const SvxProtectItem
& rProt
= (const SvxProtectItem
& )rSet
.Get(RES_PROTECT
);
3052 aProtectFrameCB
.Check(rProt
.IsPosProtected());
3053 aProtectContentCB
.Check(rProt
.IsCntntProtected());
3054 aProtectSizeCB
.Check(rProt
.IsSizeProtected());
3056 const SwFmtEditInReadonly
& rEdit
= (const SwFmtEditInReadonly
& )rSet
.Get(RES_EDIT_IN_READONLY
);
3057 aEditInReadonlyCB
.Check(rEdit
.GetValue()); aEditInReadonlyCB
.SaveValue();
3060 const SvxPrintItem
& rPrt
= (const SvxPrintItem
&)rSet
.Get(RES_PRINT
);
3061 aPrintFrameCB
.Check(rPrt
.GetValue()); aPrintFrameCB
.SaveValue();
3064 SfxItemState eState
;
3065 if( (!bHtmlMode
|| (0 != (nHtmlMode
&HTMLMODE_SOME_STYLES
)))
3066 && DLG_FRM_GRF
!= nDlgType
&& DLG_FRM_OLE
!= nDlgType
&&
3067 SFX_ITEM_UNKNOWN
!= ( eState
= rSet
.GetItemState(
3068 RES_FRAMEDIR
, TRUE
)) )
3073 //vertical text flow is not possible in HTML
3076 ULONG nData
= FRMDIR_VERT_TOP_RIGHT
;
3077 aTextFlowLB
.RemoveEntry(aTextFlowLB
.GetEntryPos((void*)nData
));
3079 sal_uInt16 nPos
, nVal
= ((SvxFrameDirectionItem
&)rSet
.Get(RES_FRAMEDIR
)).GetValue();
3080 for( nPos
= aTextFlowLB
.GetEntryCount(); nPos
; )
3081 if( (sal_uInt16
)(long)aTextFlowLB
.GetEntryData( --nPos
) == nVal
)
3083 aTextFlowLB
.SelectEntryPos( nPos
);
3084 aTextFlowLB
.SaveValue();
3093 /*-----------------13.11.96 13.20-------------------
3095 --------------------------------------------------*/
3097 BOOL
SwFrmAddPage::FillItemSet(SfxItemSet
&rSet
)
3100 if (aNameED
.GetText() != aNameED
.GetSavedValue())
3101 bRet
|= 0 != rSet
.Put(SfxStringItem(FN_SET_FRM_NAME
, aNameED
.GetText()));
3102 if (aAltNameED
.GetText() != aAltNameED
.GetSavedValue())
3103 bRet
|= 0 != rSet
.Put(SfxStringItem(FN_SET_FRM_ALT_NAME
, aAltNameED
.GetText()));
3105 const SfxPoolItem
* pOldItem
;
3106 SvxProtectItem
aProt ( (const SvxProtectItem
& )GetItemSet().Get(RES_PROTECT
) );
3107 aProt
.SetCntntProtect( aProtectContentCB
.IsChecked() );
3108 aProt
.SetSizeProtect ( aProtectSizeCB
.IsChecked() );
3109 aProt
.SetPosProtect ( aProtectFrameCB
.IsChecked() );
3110 if ( 0 == (pOldItem
= GetOldItem(rSet
, FN_SET_PROTECT
)) ||
3111 aProt
!= *pOldItem
)
3112 bRet
|= 0 != rSet
.Put( aProt
);
3115 if ( (bChecked
= aEditInReadonlyCB
.IsChecked()) != aEditInReadonlyCB
.GetSavedValue() )
3116 bRet
|= 0 != rSet
.Put( SwFmtEditInReadonly( RES_EDIT_IN_READONLY
, bChecked
));
3118 if ( (bChecked
= aPrintFrameCB
.IsChecked()) != aPrintFrameCB
.GetSavedValue() )
3119 bRet
|= 0 != rSet
.Put( SvxPrintItem( RES_PRINT
, bChecked
));
3122 if( aTextFlowLB
.IsVisible() )
3124 sal_uInt16 nPos
= aTextFlowLB
.GetSelectEntryPos();
3125 if( nPos
!= aTextFlowLB
.GetSavedValue() )
3127 nPos
= (sal_uInt16
)(long)aTextFlowLB
.GetEntryData( nPos
);
3128 bRet
|= 0 != rSet
.Put( SvxFrameDirectionItem(
3129 (SvxFrameDirection
)nPos
, RES_FRAMEDIR
));
3134 const SwFrmFmt
* pFmt
= pWrtSh
->GetFlyFrmFmt();
3137 String sCurrentPrevChain
, sCurrentNextChain
;
3138 if(aPrevLB
.GetSelectEntryPos())
3139 sCurrentPrevChain
= aPrevLB
.GetSelectEntry();
3140 if(aNextLB
.GetSelectEntryPos())
3141 sCurrentNextChain
= aNextLB
.GetSelectEntry();
3142 const SwFmtChain
&rChain
= pFmt
->GetChain();
3143 const SwFlyFrmFmt
* pFlyFmt
;
3144 String sNextChain
, sPrevChain
;
3145 if ((pFlyFmt
= rChain
.GetPrev()) != 0)
3146 sPrevChain
= pFlyFmt
->GetName();
3148 if ((pFlyFmt
= rChain
.GetNext()) != 0)
3149 sNextChain
= pFlyFmt
->GetName();
3150 if(sPrevChain
!= sCurrentPrevChain
)
3151 bRet
|= 0 != rSet
.Put(SfxStringItem(FN_PARAM_CHAIN_PREVIOUS
, sCurrentPrevChain
));
3152 if(sNextChain
!= sCurrentNextChain
)
3153 bRet
|= 0 != rSet
.Put(SfxStringItem(FN_PARAM_CHAIN_NEXT
, sCurrentNextChain
));
3159 /*-----------------13.11.96 15.05-------------------
3161 --------------------------------------------------*/
3163 USHORT
* SwFrmAddPage::GetRanges()
3168 /*-----------------13.11.96 16.12-------------------
3170 --------------------------------------------------*/
3172 IMPL_LINK(SwFrmAddPage
, EditModifyHdl
, Edit
*, EMPTYARG
)
3174 BOOL bEnable
= 0 != aNameED
.GetText().Len();
3175 aAltNameED
.Enable(bEnable
);
3176 aAltNameFT
.Enable(bEnable
);
3180 //-----------------------------------------------------------------------------
3181 void SwFrmAddPage::SetFormatUsed(BOOL bFmt
)
3186 aNameFT
.Show(FALSE
);
3187 aNameED
.Show(FALSE
);
3188 aAltNameFT
.Show(FALSE
);
3189 aAltNameED
.Show(FALSE
);
3190 aPrevFT
.Show(FALSE
);
3191 aPrevLB
.Show(FALSE
);
3192 aNextFT
.Show(FALSE
);
3193 aNextLB
.Show(FALSE
);
3194 aNamesFL
.Show(FALSE
);
3196 sal_Int32 nDiff
= aExtFL
.GetPosPixel().Y() - aNamesFL
.GetPosPixel().Y();
3197 Window
* aWindows
[] =
3211 while(aWindows
[nIdx
])
3212 lcl_Move(*aWindows
[nIdx
++], nDiff
);
3215 /* -----------------------------08.08.2002 16:24------------------------------
3217 ---------------------------------------------------------------------------*/
3218 IMPL_LINK(SwFrmAddPage
, ChainModifyHdl
, ListBox
*, pBox
)
3220 String sCurrentPrevChain
, sCurrentNextChain
;
3221 if(aPrevLB
.GetSelectEntryPos())
3222 sCurrentPrevChain
= aPrevLB
.GetSelectEntry();
3223 if(aNextLB
.GetSelectEntryPos())
3224 sCurrentNextChain
= aNextLB
.GetSelectEntry();
3225 SwFrmFmt
* pFmt
= pWrtSh
->GetFlyFrmFmt();
3228 BOOL bNextBox
= &aNextLB
== pBox
;
3229 ListBox
& rChangeLB
= bNextBox
? aPrevLB
: aNextLB
;
3230 for(USHORT nEntry
= rChangeLB
.GetEntryCount(); nEntry
> 1; nEntry
--)
3231 rChangeLB
.RemoveEntry(nEntry
- 1);
3232 //determine chainable frames
3233 ::std::vector
< String
> aPrevPageFrames
;
3234 ::std::vector
< String
> aThisPageFrames
;
3235 ::std::vector
< String
> aNextPageFrames
;
3236 ::std::vector
< String
> aRemainFrames
;
3237 pWrtSh
->GetConnectableFrmFmts(*pFmt
, bNextBox
? sCurrentNextChain
: sCurrentPrevChain
, !bNextBox
,
3238 aPrevPageFrames
, aThisPageFrames
, aNextPageFrames
, aRemainFrames
);
3239 lcl_InsertVectors(rChangeLB
,
3240 aPrevPageFrames
, aThisPageFrames
, aNextPageFrames
, aRemainFrames
);
3241 String sToSelect
= bNextBox
? sCurrentPrevChain
: sCurrentNextChain
;
3242 if(rChangeLB
.GetEntryPos(sToSelect
) != LISTBOX_ENTRY_NOTFOUND
)
3243 rChangeLB
.SelectEntry(sToSelect
);
3245 rChangeLB
.SelectEntryPos(0);