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