1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_cui.hxx" 30 31 #include <cstddef> 32 #include <swpossizetabpage.hxx> 33 #include <dialmgr.hxx> 34 #include <svx/dlgutil.hxx> 35 #include <svx/anchorid.hxx> 36 #include <svl/aeitem.hxx> 37 #include <svx/swframevalidation.hxx> 38 #include <tools/debug.hxx> 39 #include <cuires.hrc> 40 #include <swpossizetabpage.hrc> 41 #include <svx/htmlmode.hxx> 42 #include <svx/svdview.hxx> 43 #include <svx/svdpagv.hxx> 44 #include <svx/rectenum.hxx> 45 #include <com/sun/star/text/TextContentAnchorType.hpp> 46 #include <com/sun/star/text/HoriOrientation.hpp> 47 #include <com/sun/star/text/VertOrientation.hpp> 48 #include <com/sun/star/text/RelOrientation.hpp> 49 #include <svx/dialogs.hrc> 50 51 using namespace ::com::sun::star::text; 52 #define SwFPos SvxSwFramePosString 53 54 struct FrmMap 55 { 56 SvxSwFramePosString::StringId eStrId; 57 SvxSwFramePosString::StringId eMirrorStrId; 58 short nAlign; 59 sal_uLong nLBRelations; 60 }; 61 62 struct RelationMap 63 { 64 SvxSwFramePosString::StringId eStrId; 65 SvxSwFramePosString::StringId eMirrorStrId; 66 sal_uLong nLBRelation; 67 short nRelation; 68 }; 69 struct StringIdPair_Impl 70 { 71 SvxSwFramePosString::StringId eHori; 72 SvxSwFramePosString::StringId eVert; 73 }; 74 75 #define LB_FRAME 0x00000001L // paragraph text area 76 #define LB_PRTAREA 0x00000002L // paragraph text area + indents 77 #define LB_VERT_FRAME 0x00000004L // vertical paragraph text area 78 #define LB_VERT_PRTAREA 0x00000008L // vertical paragraph text area + indents 79 #define LB_REL_FRM_LEFT 0x00000010L // left paragraph margin 80 #define LB_REL_FRM_RIGHT 0x00000020L // right paragraph margin 81 82 #define LB_REL_PG_LEFT 0x00000040L // left page margin 83 #define LB_REL_PG_RIGHT 0x00000080L // right page margin 84 #define LB_REL_PG_FRAME 0x00000100L // complete page 85 #define LB_REL_PG_PRTAREA 0x00000200L // text area of page 86 87 #define LB_FLY_REL_PG_LEFT 0x00000400L // left frame margin 88 #define LB_FLY_REL_PG_RIGHT 0x00000800L // right frame margin 89 #define LB_FLY_REL_PG_FRAME 0x00001000L // complete frame 90 #define LB_FLY_REL_PG_PRTAREA 0x00002000L // frame interior 91 92 #define LB_REL_BASE 0x00010000L // as char, relative to baseline 93 #define LB_REL_CHAR 0x00020000L // as char, relative to character 94 #define LB_REL_ROW 0x00040000L // as char, relative to line 95 96 // OD 10.11.2003 #i22305# 97 #define LB_FLY_VERT_FRAME 0x00100000L // vertical entire frame 98 #define LB_FLY_VERT_PRTAREA 0x00200000L // vertical frame text area 99 100 // OD 11.11.2003 #i22341# 101 #define LB_VERT_LINE 0x00400000L // vertical text line 102 103 static RelationMap __FAR_DATA aRelationMap[] = 104 { 105 {SwFPos::FRAME, SwFPos::FRAME, LB_FRAME, RelOrientation::FRAME}, 106 {SwFPos::PRTAREA, SwFPos::PRTAREA, LB_PRTAREA, RelOrientation::PRINT_AREA}, 107 {SwFPos::REL_PG_LEFT, SwFPos::MIR_REL_PG_LEFT, LB_REL_PG_LEFT, RelOrientation::PAGE_LEFT}, 108 {SwFPos::REL_PG_RIGHT, SwFPos::MIR_REL_PG_RIGHT, LB_REL_PG_RIGHT, RelOrientation::PAGE_RIGHT}, 109 {SwFPos::REL_FRM_LEFT, SwFPos::MIR_REL_FRM_LEFT, LB_REL_FRM_LEFT, RelOrientation::FRAME_LEFT}, 110 {SwFPos::REL_FRM_RIGHT, SwFPos::MIR_REL_FRM_RIGHT, LB_REL_FRM_RIGHT, RelOrientation::FRAME_RIGHT}, 111 {SwFPos::REL_PG_FRAME, SwFPos::REL_PG_FRAME, LB_REL_PG_FRAME, RelOrientation::PAGE_FRAME}, 112 {SwFPos::REL_PG_PRTAREA,SwFPos::REL_PG_PRTAREA, LB_REL_PG_PRTAREA, RelOrientation::PAGE_PRINT_AREA}, 113 {SwFPos::REL_CHAR, SwFPos::REL_CHAR, LB_REL_CHAR, RelOrientation::CHAR}, 114 115 {SwFPos::FLY_REL_PG_LEFT, SwFPos::FLY_MIR_REL_PG_LEFT, LB_FLY_REL_PG_LEFT, RelOrientation::PAGE_LEFT}, 116 {SwFPos::FLY_REL_PG_RIGHT, SwFPos::FLY_MIR_REL_PG_RIGHT, LB_FLY_REL_PG_RIGHT, RelOrientation::PAGE_RIGHT}, 117 {SwFPos::FLY_REL_PG_FRAME, SwFPos::FLY_REL_PG_FRAME, LB_FLY_REL_PG_FRAME, RelOrientation::PAGE_FRAME}, 118 {SwFPos::FLY_REL_PG_PRTAREA, SwFPos::FLY_REL_PG_PRTAREA, LB_FLY_REL_PG_PRTAREA, RelOrientation::PAGE_PRINT_AREA}, 119 120 {SwFPos::REL_BORDER, SwFPos::REL_BORDER, LB_VERT_FRAME, RelOrientation::FRAME}, 121 {SwFPos::REL_PRTAREA, SwFPos::REL_PRTAREA, LB_VERT_PRTAREA, RelOrientation::PRINT_AREA}, 122 123 // OD 10.11.2003 #i22305# 124 {SwFPos::FLY_REL_PG_FRAME, SwFPos::FLY_REL_PG_FRAME, LB_FLY_VERT_FRAME, RelOrientation::FRAME}, 125 {SwFPos::FLY_REL_PG_PRTAREA, SwFPos::FLY_REL_PG_PRTAREA, LB_FLY_VERT_PRTAREA, RelOrientation::PRINT_AREA}, 126 127 // OD 11.11.2003 #i22341# 128 {SwFPos::REL_LINE, SwFPos::REL_LINE, LB_VERT_LINE, RelOrientation::TEXT_LINE} 129 }; 130 131 static RelationMap __FAR_DATA aAsCharRelationMap[] = 132 { 133 {SwFPos::REL_BASE, SwFPos::REL_BASE, LB_REL_BASE, RelOrientation::FRAME}, 134 {SwFPos::REL_CHAR, SwFPos::REL_CHAR, LB_REL_CHAR, RelOrientation::FRAME}, 135 {SwFPos::REL_ROW, SwFPos::REL_ROW, LB_REL_ROW, RelOrientation::FRAME} 136 }; 137 138 /*-------------------------------------------------------------------- 139 Anchored at page 140 --------------------------------------------------------------------*/ 141 142 #define HORI_PAGE_REL (LB_REL_PG_FRAME|LB_REL_PG_PRTAREA|LB_REL_PG_LEFT| \ 143 LB_REL_PG_RIGHT) 144 145 static FrmMap __FAR_DATA aHPageMap[] = 146 { 147 {SwFPos::LEFT, SwFPos::MIR_LEFT, HoriOrientation::LEFT, HORI_PAGE_REL}, 148 {SwFPos::RIGHT, SwFPos::MIR_RIGHT, HoriOrientation::RIGHT, HORI_PAGE_REL}, 149 {SwFPos::CENTER_HORI,SwFPos::CENTER_HORI, HoriOrientation::CENTER, HORI_PAGE_REL}, 150 {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, HoriOrientation::NONE, HORI_PAGE_REL} 151 }; 152 153 static FrmMap __FAR_DATA aHPageHtmlMap[] = 154 { 155 {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, HoriOrientation::NONE, LB_REL_PG_FRAME} 156 }; 157 158 #define VERT_PAGE_REL (LB_REL_PG_FRAME|LB_REL_PG_PRTAREA) 159 160 static FrmMap __FAR_DATA aVPageMap[] = 161 { 162 {SwFPos::TOP, SwFPos::TOP, VertOrientation::TOP, VERT_PAGE_REL}, 163 {SwFPos::BOTTOM, SwFPos::BOTTOM, VertOrientation::BOTTOM, VERT_PAGE_REL}, 164 {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::CENTER, VERT_PAGE_REL}, 165 {SwFPos::FROMTOP, SwFPos::FROMTOP, VertOrientation::NONE, VERT_PAGE_REL} 166 }; 167 168 static FrmMap __FAR_DATA aVPageHtmlMap[] = 169 { 170 {SwFPos::FROMTOP, SwFPos::FROMTOP, VertOrientation::NONE, LB_REL_PG_FRAME} 171 }; 172 173 /*-------------------------------------------------------------------- 174 Anchored at frame 175 --------------------------------------------------------------------*/ 176 177 #define HORI_FRAME_REL (LB_FLY_REL_PG_FRAME|LB_FLY_REL_PG_PRTAREA| \ 178 LB_FLY_REL_PG_LEFT|LB_FLY_REL_PG_RIGHT) 179 180 static FrmMap __FAR_DATA aHFrameMap[] = 181 { 182 {SwFPos::LEFT, SwFPos::MIR_LEFT, HoriOrientation::LEFT, HORI_FRAME_REL}, 183 {SwFPos::RIGHT, SwFPos::MIR_RIGHT, HoriOrientation::RIGHT, HORI_FRAME_REL}, 184 {SwFPos::CENTER_HORI, SwFPos::CENTER_HORI, HoriOrientation::CENTER, HORI_FRAME_REL}, 185 {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, HoriOrientation::NONE, HORI_FRAME_REL} 186 }; 187 188 static FrmMap __FAR_DATA aHFlyHtmlMap[] = 189 { 190 {SwFPos::LEFT, SwFPos::MIR_LEFT, HoriOrientation::LEFT, LB_FLY_REL_PG_FRAME}, 191 {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, HoriOrientation::NONE, LB_FLY_REL_PG_FRAME} 192 }; 193 194 // OD 19.09.2003 #i18732# - own vertical alignment map for to frame anchored objects 195 // OD 10.11.2003 #i22305# 196 #define VERT_FRAME_REL (LB_VERT_FRAME|LB_FLY_VERT_PRTAREA) 197 198 static FrmMap __FAR_DATA aVFrameMap[] = 199 { 200 {SwFPos::TOP, SwFPos::TOP, VertOrientation::TOP, VERT_FRAME_REL}, 201 {SwFPos::BOTTOM, SwFPos::BOTTOM, VertOrientation::BOTTOM, VERT_FRAME_REL}, 202 {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::CENTER, VERT_FRAME_REL}, 203 {SwFPos::FROMTOP, SwFPos::FROMTOP, VertOrientation::NONE, VERT_FRAME_REL} 204 }; 205 206 static FrmMap __FAR_DATA aVFlyHtmlMap[] = 207 { 208 {SwFPos::TOP, SwFPos::TOP, VertOrientation::TOP, LB_FLY_VERT_FRAME}, 209 {SwFPos::FROMTOP, SwFPos::FROMTOP, VertOrientation::NONE, LB_FLY_VERT_FRAME} 210 }; 211 212 static FrmMap __FAR_DATA aVMultiSelectionMap[] = 213 { 214 {SwFPos::FROMTOP, SwFPos::FROMTOP, VertOrientation::NONE, 0} 215 }; 216 static FrmMap __FAR_DATA aHMultiSelectionMap[] = 217 { 218 {SwFPos::FROMLEFT, SwFPos::FROMLEFT, HoriOrientation::NONE, 0} 219 }; 220 221 /*-------------------------------------------------------------------- 222 Anchored at paragraph 223 --------------------------------------------------------------------*/ 224 225 #define HORI_PARA_REL (LB_FRAME|LB_PRTAREA|LB_REL_PG_LEFT|LB_REL_PG_RIGHT| \ 226 LB_REL_PG_FRAME|LB_REL_PG_PRTAREA|LB_REL_FRM_LEFT| \ 227 LB_REL_FRM_RIGHT) 228 229 static FrmMap __FAR_DATA aHParaMap[] = 230 { 231 {SwFPos::LEFT, SwFPos::MIR_LEFT, HoriOrientation::LEFT, HORI_PARA_REL}, 232 {SwFPos::RIGHT, SwFPos::MIR_RIGHT, HoriOrientation::RIGHT, HORI_PARA_REL}, 233 {SwFPos::CENTER_HORI, SwFPos::CENTER_HORI, HoriOrientation::CENTER, HORI_PARA_REL}, 234 {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, HoriOrientation::NONE, HORI_PARA_REL} 235 }; 236 237 #define HTML_HORI_PARA_REL (LB_FRAME|LB_PRTAREA) 238 239 static FrmMap __FAR_DATA aHParaHtmlMap[] = 240 { 241 {SwFPos::LEFT, SwFPos::LEFT, HoriOrientation::LEFT, HTML_HORI_PARA_REL}, 242 {SwFPos::RIGHT, SwFPos::RIGHT, HoriOrientation::RIGHT, HTML_HORI_PARA_REL} 243 }; 244 245 static FrmMap __FAR_DATA aHParaHtmlAbsMap[] = 246 { 247 {SwFPos::LEFT, SwFPos::MIR_LEFT, HoriOrientation::LEFT, HTML_HORI_PARA_REL}, 248 {SwFPos::RIGHT, SwFPos::MIR_RIGHT, HoriOrientation::RIGHT, HTML_HORI_PARA_REL} 249 }; 250 251 252 #define VERT_PARA_REL (LB_VERT_FRAME|LB_VERT_PRTAREA| \ 253 LB_REL_PG_FRAME|LB_REL_PG_PRTAREA) 254 255 static FrmMap __FAR_DATA aVParaMap[] = 256 { 257 {SwFPos::TOP, SwFPos::TOP, VertOrientation::TOP, VERT_PARA_REL}, 258 {SwFPos::BOTTOM, SwFPos::BOTTOM, VertOrientation::BOTTOM, VERT_PARA_REL}, 259 {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::CENTER, VERT_PARA_REL}, 260 {SwFPos::FROMTOP, SwFPos::FROMTOP, VertOrientation::NONE, VERT_PARA_REL} 261 }; 262 263 static FrmMap __FAR_DATA aVParaHtmlMap[] = 264 { 265 {SwFPos::TOP, SwFPos::TOP, VertOrientation::TOP, LB_VERT_PRTAREA} 266 }; 267 268 /*-------------------------------------------------------------------- 269 Anchored at character 270 --------------------------------------------------------------------*/ 271 272 #define HORI_CHAR_REL (LB_FRAME|LB_PRTAREA|LB_REL_PG_LEFT|LB_REL_PG_RIGHT| \ 273 LB_REL_PG_FRAME|LB_REL_PG_PRTAREA|LB_REL_FRM_LEFT| \ 274 LB_REL_FRM_RIGHT|LB_REL_CHAR) 275 276 static FrmMap __FAR_DATA aHCharMap[] = 277 { 278 {SwFPos::LEFT, SwFPos::MIR_LEFT, HoriOrientation::LEFT, HORI_CHAR_REL}, 279 {SwFPos::RIGHT, SwFPos::MIR_RIGHT, HoriOrientation::RIGHT, HORI_CHAR_REL}, 280 {SwFPos::CENTER_HORI, SwFPos::CENTER_HORI, HoriOrientation::CENTER, HORI_CHAR_REL}, 281 {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, HoriOrientation::NONE, HORI_CHAR_REL} 282 }; 283 284 #define HTML_HORI_CHAR_REL (LB_FRAME|LB_PRTAREA|LB_REL_CHAR) 285 286 static FrmMap __FAR_DATA aHCharHtmlMap[] = 287 { 288 {SwFPos::LEFT, SwFPos::LEFT, HoriOrientation::LEFT, HTML_HORI_CHAR_REL}, 289 {SwFPos::RIGHT, SwFPos::RIGHT, HoriOrientation::RIGHT, HTML_HORI_CHAR_REL} 290 }; 291 292 static FrmMap __FAR_DATA aHCharHtmlAbsMap[] = 293 { 294 {SwFPos::LEFT, SwFPos::MIR_LEFT, HoriOrientation::LEFT, LB_PRTAREA|LB_REL_CHAR}, 295 {SwFPos::RIGHT, SwFPos::MIR_RIGHT, HoriOrientation::RIGHT, LB_PRTAREA}, 296 {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, HoriOrientation::NONE, LB_REL_PG_FRAME} 297 }; 298 299 // OD 19.09.2003 #i18732# - allow vertical alignment at page areas 300 // OD 12.11.2003 #i22341# - handle <LB_REL_CHAR> on its own 301 #define VERT_CHAR_REL (LB_VERT_FRAME|LB_VERT_PRTAREA| \ 302 LB_REL_PG_FRAME|LB_REL_PG_PRTAREA) 303 304 static FrmMap __FAR_DATA aVCharMap[] = 305 { 306 // OD 11.11.2003 #i22341# 307 // introduce mappings for new vertical alignment at top of line <LB_VERT_LINE> 308 // and correct mapping for vertical alignment at character for position <FROM_BOTTOM> 309 // Note: Because of these adjustments the map becomes ambigous in its values 310 // <eStrId>/<eMirrorStrId> and <nAlign>. These ambiguities are considered 311 // in the methods <SwFrmPage::FillRelLB(..)>, <SwFrmPage::GetAlignment(..)> 312 // and <SwFrmPage::FillPosLB(..)> 313 {SwFPos::TOP, SwFPos::TOP, VertOrientation::TOP, VERT_CHAR_REL|LB_REL_CHAR}, 314 {SwFPos::BOTTOM, SwFPos::BOTTOM, VertOrientation::BOTTOM, VERT_CHAR_REL|LB_REL_CHAR}, 315 {SwFPos::BELOW, SwFPos::BELOW, VertOrientation::CHAR_BOTTOM, LB_REL_CHAR}, 316 {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::CENTER, VERT_CHAR_REL|LB_REL_CHAR}, 317 {SwFPos::FROMTOP, SwFPos::FROMTOP, VertOrientation::NONE, VERT_CHAR_REL}, 318 {SwFPos::FROMBOTTOM, SwFPos::FROMBOTTOM, VertOrientation::NONE, LB_REL_CHAR|LB_VERT_LINE}, 319 {SwFPos::TOP, SwFPos::TOP, VertOrientation::LINE_TOP, LB_VERT_LINE}, 320 {SwFPos::BOTTOM, SwFPos::BOTTOM, VertOrientation::LINE_BOTTOM, LB_VERT_LINE}, 321 {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::LINE_CENTER, LB_VERT_LINE} 322 }; 323 324 325 static FrmMap __FAR_DATA aVCharHtmlMap[] = 326 { 327 {SwFPos::BELOW, SwFPos::BELOW, VertOrientation::CHAR_BOTTOM, LB_REL_CHAR} 328 }; 329 330 static FrmMap __FAR_DATA aVCharHtmlAbsMap[] = 331 { 332 {SwFPos::TOP, SwFPos::TOP, VertOrientation::TOP, LB_REL_CHAR}, 333 {SwFPos::BELOW, SwFPos::BELOW, VertOrientation::CHAR_BOTTOM, LB_REL_CHAR} 334 }; 335 /*-------------------------------------------------------------------- 336 anchored as character 337 --------------------------------------------------------------------*/ 338 339 static FrmMap __FAR_DATA aVAsCharMap[] = 340 { 341 {SwFPos::TOP, SwFPos::TOP, VertOrientation::TOP, LB_REL_BASE}, 342 {SwFPos::BOTTOM, SwFPos::BOTTOM, VertOrientation::BOTTOM, LB_REL_BASE}, 343 {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::CENTER, LB_REL_BASE}, 344 345 {SwFPos::TOP, SwFPos::TOP, VertOrientation::CHAR_TOP, LB_REL_CHAR}, 346 {SwFPos::BOTTOM, SwFPos::BOTTOM, VertOrientation::CHAR_BOTTOM, LB_REL_CHAR}, 347 {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::CHAR_CENTER, LB_REL_CHAR}, 348 349 {SwFPos::TOP, SwFPos::TOP, VertOrientation::LINE_TOP, LB_REL_ROW}, 350 {SwFPos::BOTTOM, SwFPos::BOTTOM, VertOrientation::LINE_BOTTOM, LB_REL_ROW}, 351 {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::LINE_CENTER, LB_REL_ROW}, 352 353 {SwFPos::FROMBOTTOM, SwFPos::FROMBOTTOM, VertOrientation::NONE, LB_REL_BASE} 354 }; 355 356 static FrmMap __FAR_DATA aVAsCharHtmlMap[] = 357 { 358 {SwFPos::TOP, SwFPos::TOP, VertOrientation::TOP, LB_REL_BASE}, 359 {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::CENTER, LB_REL_BASE}, 360 361 {SwFPos::TOP, SwFPos::TOP, VertOrientation::CHAR_TOP, LB_REL_CHAR}, 362 363 {SwFPos::TOP, SwFPos::TOP, VertOrientation::LINE_TOP, LB_REL_ROW}, 364 {SwFPos::BOTTOM, SwFPos::BOTTOM, VertOrientation::LINE_BOTTOM, LB_REL_ROW}, 365 {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::LINE_CENTER, LB_REL_ROW} 366 }; 367 /*-- 05.03.2004 15:52:56--------------------------------------------------- 368 369 -----------------------------------------------------------------------*/ 370 std::size_t lcl_GetFrmMapCount(const FrmMap* pMap) 371 { 372 if ( pMap ) 373 { 374 std::size_t aSizeOf = sizeof(FrmMap); 375 if( pMap == aVParaHtmlMap) 376 return sizeof(aVParaHtmlMap) / aSizeOf; 377 if( pMap == aVAsCharHtmlMap) 378 return sizeof(aVAsCharHtmlMap) / aSizeOf; 379 if( pMap == aHParaHtmlMap) 380 return sizeof(aHParaHtmlMap) / aSizeOf; 381 if( pMap == aHParaHtmlAbsMap) 382 return sizeof(aHParaHtmlAbsMap) / aSizeOf; 383 if ( pMap == aVPageMap ) 384 return sizeof(aVPageMap) / aSizeOf; 385 if ( pMap == aVPageHtmlMap ) 386 return sizeof(aVPageHtmlMap) / aSizeOf; 387 if ( pMap == aVAsCharMap ) 388 return sizeof(aVAsCharMap) / aSizeOf; 389 if ( pMap == aVParaMap ) 390 return sizeof(aVParaMap) / aSizeOf; 391 if ( pMap == aHParaMap ) 392 return sizeof(aHParaMap) / aSizeOf; 393 if ( pMap == aHFrameMap ) 394 return sizeof(aHFrameMap) / aSizeOf; 395 // OD 19.09.2003 #i18732# - own vertical alignment map for to frame anchored objects 396 if ( pMap == aVFrameMap ) 397 return sizeof(aVFrameMap) / aSizeOf; 398 if ( pMap == aHCharMap ) 399 return sizeof(aHCharMap) / aSizeOf; 400 if ( pMap == aHCharHtmlMap ) 401 return sizeof(aHCharHtmlMap) / aSizeOf; 402 if ( pMap == aHCharHtmlAbsMap ) 403 return sizeof(aHCharHtmlAbsMap) / aSizeOf; 404 if ( pMap == aVCharMap ) 405 return sizeof(aVCharMap) / aSizeOf; 406 if ( pMap == aVCharHtmlMap ) 407 return sizeof(aVCharHtmlMap) / aSizeOf; 408 if ( pMap == aVCharHtmlAbsMap ) 409 return sizeof(aVCharHtmlAbsMap) / aSizeOf; 410 if ( pMap == aHPageHtmlMap ) 411 return sizeof(aHPageHtmlMap) / aSizeOf; 412 if ( pMap == aHFlyHtmlMap ) 413 return sizeof(aHFlyHtmlMap) / aSizeOf; 414 if ( pMap == aVFlyHtmlMap ) 415 return sizeof(aVFlyHtmlMap) / aSizeOf; 416 if( pMap == aVMultiSelectionMap) 417 return sizeof(aVMultiSelectionMap) / aSizeOf; 418 if( pMap == aHMultiSelectionMap) 419 return sizeof(aHMultiSelectionMap) / aSizeOf; 420 return sizeof(aHPageMap) / aSizeOf; 421 } 422 return 0; 423 } 424 /*-- 03.03.2004 12:21:33--------------------------------------------------- 425 426 -----------------------------------------------------------------------*/ 427 SvxSwFramePosString::StringId lcl_ChangeResIdToVerticalOrRTL( 428 SvxSwFramePosString::StringId eStringId, sal_Bool bVertical, sal_Bool bRTL) 429 { 430 //special handling of STR_FROMLEFT 431 if(SwFPos::FROMLEFT == eStringId) 432 { 433 eStringId = bVertical ? 434 bRTL ? SwFPos::FROMBOTTOM : SwFPos::FROMTOP : 435 bRTL ? SwFPos::FROMRIGHT : SwFPos::FROMLEFT; 436 return eStringId; 437 } 438 if(bVertical) 439 { 440 //exchange horizontal strings with vertical strings and vice versa 441 static const StringIdPair_Impl aHoriIds[] = 442 { 443 {SwFPos::LEFT, SwFPos::TOP}, 444 {SwFPos::RIGHT, SwFPos::BOTTOM}, 445 {SwFPos::CENTER_HORI, SwFPos::CENTER_VERT}, 446 {SwFPos::FROMTOP, SwFPos::FROMRIGHT}, 447 {SwFPos::REL_PG_LEFT, SwFPos::REL_PG_TOP}, 448 {SwFPos::REL_PG_RIGHT, SwFPos::REL_PG_BOTTOM} , 449 {SwFPos::REL_FRM_LEFT, SwFPos::REL_FRM_TOP}, 450 {SwFPos::REL_FRM_RIGHT, SwFPos::REL_FRM_BOTTOM} 451 }; 452 static const StringIdPair_Impl aVertIds[] = 453 { 454 {SwFPos::TOP, SwFPos::RIGHT}, 455 {SwFPos::BOTTOM, SwFPos::LEFT }, 456 {SwFPos::CENTER_VERT, SwFPos::CENTER_HORI}, 457 {SwFPos::FROMTOP, SwFPos::FROMRIGHT }, 458 {SwFPos::REL_PG_TOP, SwFPos::REL_PG_LEFT }, 459 {SwFPos::REL_PG_BOTTOM, SwFPos::REL_PG_RIGHT } , 460 {SwFPos::REL_FRM_TOP, SwFPos::REL_FRM_LEFT }, 461 {SwFPos::REL_FRM_BOTTOM, SwFPos::REL_FRM_RIGHT } 462 }; 463 sal_uInt16 nIndex; 464 for(nIndex = 0; nIndex < sizeof(aHoriIds) / sizeof(StringIdPair_Impl); ++nIndex) 465 { 466 if(aHoriIds[nIndex].eHori == eStringId) 467 { 468 eStringId = aHoriIds[nIndex].eVert; 469 return eStringId; 470 } 471 } 472 nIndex = 0; 473 for(nIndex = 0; nIndex < sizeof(aVertIds) / sizeof(StringIdPair_Impl); ++nIndex) 474 { 475 if(aVertIds[nIndex].eHori == eStringId) 476 { 477 eStringId = aVertIds[nIndex].eVert; 478 break; 479 } 480 } 481 } 482 return eStringId; 483 } 484 // OD 12.11.2003 #i22341# - helper method in order to determine all possible 485 // listbox relations in a relation map for a given relation 486 sal_uLong lcl_GetLBRelationsForRelations( const sal_uInt16 _nRel ) 487 { 488 sal_uLong nLBRelations = 0L; 489 490 sal_uInt16 nRelMapSize = sizeof(aRelationMap) / sizeof(RelationMap); 491 for ( sal_uInt16 nRelMapPos = 0; nRelMapPos < nRelMapSize; ++nRelMapPos ) 492 { 493 if ( aRelationMap[nRelMapPos].nRelation == _nRel ) 494 { 495 nLBRelations |= aRelationMap[nRelMapPos].nLBRelation; 496 } 497 } 498 499 return nLBRelations; 500 } 501 502 // OD 14.11.2003 #i22341# - helper method on order to determine all possible 503 // listbox relations in a relation map for a given string ID 504 sal_uLong lcl_GetLBRelationsForStrID( const FrmMap* _pMap, 505 const SvxSwFramePosString::StringId _eStrId, 506 const bool _bUseMirrorStr ) 507 { 508 sal_uLong nLBRelations = 0L; 509 510 std::size_t nRelMapSize = lcl_GetFrmMapCount( _pMap ); 511 for ( std::size_t nRelMapPos = 0; nRelMapPos < nRelMapSize; ++nRelMapPos ) 512 { 513 if ( ( !_bUseMirrorStr && _pMap[nRelMapPos].eStrId == _eStrId ) || 514 ( _bUseMirrorStr && _pMap[nRelMapPos].eMirrorStrId == _eStrId ) ) 515 { 516 nLBRelations |= _pMap[nRelMapPos].nLBRelations; 517 } 518 } 519 520 return nLBRelations; 521 } 522 /*-- 03.03.2004 12:21:33--------------------------------------------------- 523 524 -----------------------------------------------------------------------*/ 525 SvxSwPosSizeTabPage::SvxSwPosSizeTabPage( Window* pParent, const SfxItemSet& rInAttrs ) : 526 SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_SWPOSSIZE ), rInAttrs ), 527 #ifdef _MSC_VER 528 #pragma warning (disable : 4355) 529 #endif 530 m_aSizeFL( this, CUI_RES( FL_SIZE ) ), 531 m_aWidthFT( this, CUI_RES( FT_WIDTH ) ), 532 m_aWidthMF( this, CUI_RES( MF_WIDTH ) ), 533 m_aHeightFT( this, CUI_RES( FT_HEIGHT ) ), 534 m_aHeightMF( this, CUI_RES( MF_HEIGHT ) ), 535 m_aKeepRatioCB(this,CUI_RES( CB_KEEPRATIO) ), 536 m_aSeparatorFL(this,CUI_RES( FL_SEPARATOR) ), 537 538 m_aAnchorFL( this, CUI_RES( FL_ANCHOR ) ), 539 m_aToPageRB( this, CUI_RES( RB_TOPAGE ) ), 540 m_aToParaRB( this, CUI_RES( RB_TOPARA ) ), 541 m_aToCharRB( this, CUI_RES( RB_TOCHAR ) ), 542 m_aAsCharRB( this, CUI_RES( RB_ASCHAR ) ), 543 m_aToFrameRB( this, CUI_RES( RB_TOFRAME) ), 544 545 m_aProtectionFL( this, CUI_RES( FL_PROTECTION ) ), 546 m_aPositionCB( this, CUI_RES( CB_POSITION ) ), 547 m_aSizeCB( this, CUI_RES( CB_SIZE ) ), 548 549 m_aPositionFL( this, CUI_RES( FL_POSITION ) ), 550 m_aHoriFT( this, CUI_RES( FT_HORI ) ), 551 m_aHoriLB( this, CUI_RES( LB_HORI ) ), 552 m_aHoriByFT( this, CUI_RES( FT_HORIBY ) ), 553 m_aHoriByMF( this, CUI_RES( MF_HORIBY ) ), 554 m_aHoriToFT( this, CUI_RES( FT_HORITO ) ), 555 m_aHoriToLB( this, CUI_RES( LB_HORITO ) ), 556 557 m_aHoriMirrorCB( this, CUI_RES( CB_HORIMIRROR ) ), 558 559 m_aVertFT( this, CUI_RES( FT_VERT ) ), 560 m_aVertLB( this, CUI_RES( LB_VERT ) ), 561 m_aVertByFT( this, CUI_RES( FT_VERTBY ) ), 562 m_aVertByMF( this, CUI_RES( MF_VERTBY ) ), 563 m_aVertToFT( this, CUI_RES( FT_VERTTO ) ), 564 m_aVertToLB( this, CUI_RES( LB_VERTTO ) ), 565 566 m_aFollowCB( this, CUI_RES( CB_FOLLOW ) ), 567 m_aExampleWN( this, CUI_RES( WN_EXAMPLE ) ), 568 #ifdef _MSC_VER 569 #pragma warning (default : 4355) 570 #endif 571 m_pVMap( 0 ), 572 m_pHMap( 0 ), 573 m_pSdrView( 0 ), 574 m_nOldH(HoriOrientation::CENTER), 575 m_nOldHRel(RelOrientation::FRAME), 576 m_nOldV(VertOrientation::TOP), 577 m_nOldVRel(RelOrientation::PRINT_AREA), 578 m_fWidthHeightRatio(1.0), 579 m_nHtmlMode(0), 580 m_bHtmlMode(false), 581 m_bAtHoriPosModified(false), 582 m_bAtVertPosModified(false), 583 m_bIsVerticalFrame(false), 584 m_bPositioningDisabled(false), 585 m_bIsMultiSelection(false), 586 m_bIsInRightToLeft(false) 587 { 588 FreeResource(); 589 FieldUnit eDlgUnit = GetModuleFieldUnit( rInAttrs ); 590 SetFieldUnit( m_aHoriByMF, eDlgUnit, sal_True ); 591 SetFieldUnit( m_aVertByMF, eDlgUnit, sal_True ); 592 SetFieldUnit( m_aWidthMF , eDlgUnit, sal_True ); 593 SetFieldUnit( m_aHeightMF, eDlgUnit, sal_True ); 594 595 SetExchangeSupport(); 596 597 Link aLk = LINK(this, SvxSwPosSizeTabPage, RangeModifyHdl); 598 m_aWidthMF. SetLoseFocusHdl( aLk ); 599 m_aHeightMF. SetLoseFocusHdl( aLk ); 600 m_aHoriByMF.SetLoseFocusHdl( aLk ); 601 m_aVertByMF.SetLoseFocusHdl( aLk ); 602 m_aFollowCB.SetClickHdl( aLk ); 603 604 aLk = LINK(this, SvxSwPosSizeTabPage, ModifyHdl); 605 m_aWidthMF. SetModifyHdl( aLk ); 606 m_aHeightMF. SetModifyHdl( aLk ); 607 m_aHoriByMF.SetModifyHdl( aLk ); 608 m_aVertByMF.SetModifyHdl( aLk ); 609 610 aLk = LINK(this, SvxSwPosSizeTabPage, AnchorTypeHdl); 611 m_aToPageRB.SetClickHdl( aLk ); 612 m_aToParaRB.SetClickHdl( aLk ); 613 m_aToCharRB.SetClickHdl( aLk ); 614 m_aAsCharRB.SetClickHdl( aLk ); 615 m_aToFrameRB.SetClickHdl( aLk ); 616 617 m_aHoriLB.SetSelectHdl(LINK(this, SvxSwPosSizeTabPage, PosHdl)); 618 m_aVertLB. SetSelectHdl(LINK(this, SvxSwPosSizeTabPage, PosHdl)); 619 620 m_aHoriToLB.SetSelectHdl(LINK(this, SvxSwPosSizeTabPage, RelHdl)); 621 m_aVertToLB.SetSelectHdl(LINK(this, SvxSwPosSizeTabPage, RelHdl)); 622 623 m_aHoriMirrorCB.SetClickHdl(LINK(this, SvxSwPosSizeTabPage, MirrorHdl)); 624 m_aPositionCB.SetClickHdl(LINK(this, SvxSwPosSizeTabPage, ProtectHdl)); 625 } 626 /*-- 03.03.2004 12:21:33--------------------------------------------------- 627 628 -----------------------------------------------------------------------*/ 629 SvxSwPosSizeTabPage::~SvxSwPosSizeTabPage() 630 { 631 } 632 /*-- 03.03.2004 12:21:33--------------------------------------------------- 633 634 -----------------------------------------------------------------------*/ 635 SfxTabPage* SvxSwPosSizeTabPage::Create( Window* pParent, const SfxItemSet& rSet) 636 { 637 return new SvxSwPosSizeTabPage(pParent, rSet); 638 } 639 /*-- 05.03.2004 17:27:42--------------------------------------------------- 640 641 -----------------------------------------------------------------------*/ 642 sal_uInt16* SvxSwPosSizeTabPage::GetRanges() 643 { 644 static sal_uInt16 pSwPosRanges[] = 645 { 646 SID_ATTR_TRANSFORM_POS_X, 647 SID_ATTR_TRANSFORM_POS_Y, 648 SID_ATTR_TRANSFORM_PROTECT_POS, 649 SID_ATTR_TRANSFORM_PROTECT_POS, 650 SID_ATTR_TRANSFORM_INTERN, 651 SID_ATTR_TRANSFORM_INTERN, 652 SID_ATTR_TRANSFORM_ANCHOR, 653 SID_ATTR_TRANSFORM_VERT_ORIENT, 654 SID_ATTR_TRANSFORM_WIDTH, 655 SID_ATTR_TRANSFORM_SIZE_POINT, 656 SID_ATTR_TRANSFORM_PROTECT_POS, 657 SID_ATTR_TRANSFORM_INTERN, 658 SID_ATTR_TRANSFORM_AUTOWIDTH, 659 SID_ATTR_TRANSFORM_VERT_ORIENT, 660 SID_HTML_MODE, 661 SID_HTML_MODE, 662 SID_SW_FOLLOW_TEXT_FLOW, 663 SID_SW_FOLLOW_TEXT_FLOW, 664 SID_ATTR_TRANSFORM_HORI_POSITION, 665 SID_ATTR_TRANSFORM_VERT_POSITION, 666 0 667 }; 668 return pSwPosRanges; 669 } 670 /*-- 03.03.2004 12:21:34--------------------------------------------------- 671 672 -----------------------------------------------------------------------*/ 673 sal_Bool SvxSwPosSizeTabPage::FillItemSet( SfxItemSet& rSet) 674 { 675 bool bAnchorChanged = false; 676 short nAnchor = GetAnchorType(&bAnchorChanged); 677 sal_Bool bModified = sal_False; 678 if(bAnchorChanged) 679 { 680 rSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_ANCHOR, nAnchor)); 681 bModified |= sal_True; 682 } 683 if ( m_aPositionCB.GetState() != m_aPositionCB.GetSavedValue() ) 684 { 685 if( m_aPositionCB.GetState() == STATE_DONTKNOW ) 686 rSet.InvalidateItem( SID_ATTR_TRANSFORM_PROTECT_POS ); 687 else 688 rSet.Put( 689 SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_PROTECT_POS ), 690 m_aPositionCB.GetState() == STATE_CHECK ? sal_True : sal_False ) ); 691 bModified |= sal_True; 692 } 693 694 if ( m_aSizeCB.GetState() != m_aSizeCB.GetSavedValue() ) 695 { 696 if ( m_aSizeCB.GetState() == STATE_DONTKNOW ) 697 rSet.InvalidateItem( SID_ATTR_TRANSFORM_PROTECT_SIZE ); 698 else 699 rSet.Put( 700 SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_PROTECT_SIZE ), 701 m_aSizeCB.GetState() == STATE_CHECK ? sal_True : sal_False ) ); 702 bModified |= sal_True; 703 } 704 705 const SfxItemSet& rOldSet = GetItemSet(); 706 707 if(!m_bPositioningDisabled) 708 { 709 //on multiple selections the positioning is set via SdrView 710 if(m_bIsMultiSelection) 711 { 712 if( m_aHoriByMF.IsValueModified() || m_aVertByMF.IsValueModified() ) 713 { 714 long nHoriByPos = 715 static_cast<long>(m_aHoriByMF.Denormalize(m_aHoriByMF.GetValue(FUNIT_TWIP))); 716 long nVertByPos = 717 static_cast<long>(m_aVertByMF.Denormalize(m_aVertByMF.GetValue(FUNIT_TWIP))); 718 719 // Altes Rechteck mit CoreUnit 720 m_aRect = m_pSdrView->GetAllMarkedRect(); 721 m_pSdrView->GetSdrPageView()->LogicToPagePos( m_aRect ); 722 723 nHoriByPos += m_aAnchorPos.X(); 724 nVertByPos += m_aAnchorPos.Y(); 725 726 rSet.Put( SfxInt32Item( GetWhich( SID_ATTR_TRANSFORM_POS_X ), nHoriByPos ) ); 727 rSet.Put( SfxInt32Item( GetWhich( SID_ATTR_TRANSFORM_POS_Y ), nVertByPos ) ); 728 729 bModified |= sal_True; 730 } 731 } 732 else 733 { 734 if ( m_pHMap ) 735 { 736 const SfxInt16Item& rHoriOrient = 737 static_cast<const SfxInt16Item&>(rOldSet.Get( SID_ATTR_TRANSFORM_HORI_ORIENT)); 738 const SfxInt16Item& rHoriRelation = 739 static_cast<const SfxInt16Item&>(rOldSet.Get( SID_ATTR_TRANSFORM_HORI_RELATION)); 740 const SfxInt32Item& rHoriPosition = 741 static_cast<const SfxInt32Item&>(rOldSet.Get( SID_ATTR_TRANSFORM_HORI_POSITION)) ; 742 743 sal_uInt16 nMapPos = GetMapPos(m_pHMap, m_aHoriLB); 744 short nAlign = GetAlignment(m_pHMap, nMapPos, m_aHoriLB, m_aHoriToLB); 745 short nRel = GetRelation(m_pHMap, m_aHoriToLB); 746 const long nHoriByPos = 747 static_cast<long>(m_aHoriByMF.Denormalize(m_aHoriByMF.GetValue(FUNIT_TWIP))); 748 if ( 749 nAlign != rHoriOrient.GetValue() || 750 nRel != rHoriRelation.GetValue() || 751 (m_aHoriByMF.IsEnabled() && nHoriByPos != rHoriPosition.GetValue()) 752 ) 753 { 754 rSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_HORI_ORIENT, nAlign)); 755 rSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_HORI_RELATION, nRel)); 756 if(m_aHoriByMF.IsEnabled()) 757 rSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_HORI_POSITION, nHoriByPos)); 758 bModified |= sal_True; 759 } 760 } 761 if(m_aHoriMirrorCB.IsEnabled() && m_aHoriMirrorCB.IsChecked() != m_aHoriMirrorCB.GetSavedValue()) 762 bModified |= 0 != rSet.Put(SfxBoolItem(SID_ATTR_TRANSFORM_HORI_MIRROR, m_aHoriMirrorCB.IsChecked())); 763 764 if ( m_pVMap ) 765 { 766 const SfxInt16Item& rVertOrient = 767 static_cast<const SfxInt16Item&>(rOldSet.Get( SID_ATTR_TRANSFORM_VERT_ORIENT)); 768 const SfxInt16Item& rVertRelation = 769 static_cast<const SfxInt16Item&>(rOldSet.Get( SID_ATTR_TRANSFORM_VERT_RELATION)); 770 const SfxInt32Item& rVertPosition = 771 static_cast<const SfxInt32Item&>(rOldSet.Get( SID_ATTR_TRANSFORM_VERT_POSITION)); 772 773 sal_uInt16 nMapPos = GetMapPos(m_pVMap, m_aVertLB); 774 short nAlign = GetAlignment(m_pVMap, nMapPos, m_aVertLB, m_aVertToLB); 775 short nRel = GetRelation(m_pVMap, m_aVertToLB); 776 // --> OD 2004-10-21 #i34055# - convert vertical position for 777 // as-character anchored objects 778 long nVertByPos = 779 static_cast<long>(m_aVertByMF.Denormalize(m_aVertByMF.GetValue(FUNIT_TWIP))); 780 if ( GetAnchorType() == TextContentAnchorType_AS_CHARACTER ) 781 { 782 nVertByPos *= -1; 783 } 784 // <-- 785 if ( nAlign != rVertOrient.GetValue() || 786 nRel != rVertRelation.GetValue() || 787 ( m_aVertByMF.IsEnabled() && 788 nVertByPos != rVertPosition.GetValue() ) ) 789 { 790 rSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_VERT_ORIENT, nAlign)); 791 rSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_VERT_RELATION, nRel)); 792 if(m_aVertByMF.IsEnabled()) 793 rSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_VERT_POSITION, nVertByPos)); 794 bModified |= sal_True; 795 } 796 } 797 798 // OD 19.09.2003 #i18732# 799 if(m_aFollowCB.IsChecked() != m_aFollowCB.GetSavedValue()) 800 { 801 //Writer internal type - based on SfxBoolItem 802 const SfxPoolItem* pItem = GetItem( rOldSet, SID_SW_FOLLOW_TEXT_FLOW); 803 if(pItem) 804 { 805 SfxBoolItem* pFollow = static_cast<SfxBoolItem*>(pItem->Clone()); 806 pFollow->SetValue(m_aFollowCB.IsChecked()); 807 bModified |= 0 != rSet.Put(*pFollow); 808 delete pFollow; 809 } 810 } 811 } 812 } 813 if ( m_aWidthMF.IsValueModified() || m_aHeightMF.IsValueModified() ) 814 { 815 sal_uInt32 nWidth = static_cast<sal_uInt32>(m_aWidthMF.Denormalize(m_aWidthMF.GetValue(FUNIT_TWIP))); 816 sal_uInt32 nHeight = static_cast<sal_uInt32>(m_aHeightMF.Denormalize(m_aHeightMF.GetValue(FUNIT_TWIP))); 817 rSet.Put( SfxUInt32Item( GetWhich( SID_ATTR_TRANSFORM_WIDTH ), 818 (sal_uInt32) nWidth ) ); 819 rSet.Put( SfxUInt32Item( GetWhich( SID_ATTR_TRANSFORM_HEIGHT ), 820 (sal_uInt32) nHeight ) ); 821 //this item is required by SdrEditView::SetGeoAttrToMarked() 822 rSet.Put( SfxAllEnumItem( GetWhich( SID_ATTR_TRANSFORM_SIZE_POINT ), RP_LT ) ); 823 824 bModified |= sal_True; 825 } 826 827 return bModified; 828 } 829 /*-- 03.03.2004 12:21:34--------------------------------------------------- 830 831 -----------------------------------------------------------------------*/ 832 void SvxSwPosSizeTabPage::Reset( const SfxItemSet& rSet) 833 { 834 const SfxPoolItem* pItem = GetItem( rSet, SID_ATTR_TRANSFORM_ANCHOR ); 835 bool bInvalidateAnchor = false; 836 short nAnchorType = TextContentAnchorType_AT_PARAGRAPH; 837 if(pItem) 838 { 839 nAnchorType = static_cast<const SfxInt16Item*>(pItem)->GetValue(); 840 switch(nAnchorType) 841 { 842 case TextContentAnchorType_AT_PAGE: m_aToPageRB.Check(); break; 843 case TextContentAnchorType_AT_PARAGRAPH: m_aToParaRB.Check(); break; 844 case TextContentAnchorType_AT_CHARACTER: m_aToCharRB.Check(); break; 845 case TextContentAnchorType_AS_CHARACTER: m_aAsCharRB.Check(); break; 846 case TextContentAnchorType_AT_FRAME: m_aToFrameRB.Check(); break; 847 default : bInvalidateAnchor = true; 848 } 849 m_aToPageRB.SaveValue(); 850 m_aToParaRB.SaveValue(); 851 m_aToCharRB.SaveValue(); 852 m_aAsCharRB.SaveValue(); 853 m_aToFrameRB.SaveValue(); 854 } 855 if(bInvalidateAnchor) 856 { 857 m_aToPageRB.Enable( sal_False ); 858 m_aToParaRB.Enable( sal_False ); 859 m_aToCharRB.Enable( sal_False ); 860 m_aAsCharRB.Enable( sal_False ); 861 m_aToFrameRB.Enable( sal_False ); 862 } 863 864 pItem = GetItem( rSet, SID_ATTR_TRANSFORM_PROTECT_POS ); 865 if ( pItem ) 866 { 867 sal_Bool bProtected = ( ( const SfxBoolItem* )pItem )->GetValue(); 868 m_aPositionCB.SetState( bProtected ? STATE_CHECK : STATE_NOCHECK ); 869 m_aPositionCB.EnableTriState( sal_False ); 870 m_aSizeCB.Enable( !bProtected ); 871 } 872 else 873 { 874 m_aPositionCB.SetState( STATE_DONTKNOW ); 875 } 876 877 m_aPositionCB.SaveValue(); 878 879 pItem = GetItem( rSet, SID_ATTR_TRANSFORM_PROTECT_SIZE ); 880 881 if ( pItem ) 882 { 883 m_aSizeCB.SetState( ( (const SfxBoolItem*)pItem )->GetValue() 884 ? STATE_CHECK : STATE_NOCHECK ); 885 m_aSizeCB.EnableTriState( sal_False ); 886 } 887 else 888 m_aSizeCB.SetState( STATE_DONTKNOW ); 889 m_aSizeCB.SaveValue(); 890 891 pItem = GetItem( rSet, SID_HTML_MODE ); 892 if(pItem) 893 m_nHtmlMode = static_cast<const SfxUInt16Item*>(pItem)->GetValue(); 894 m_bHtmlMode = 0 != (m_bHtmlMode & HTMLMODE_ON); 895 896 pItem = GetItem( rSet, SID_ATTR_TRANSFORM_IN_VERTICAL_TEXT ); 897 if(pItem && static_cast<const SfxBoolItem*>(pItem)->GetValue()) 898 { 899 String sHLabel = m_aHoriFT.GetText(); 900 m_aHoriFT.SetText(m_aVertFT.GetText()); 901 m_aVertFT.SetText(sHLabel); 902 m_bIsVerticalFrame = true; 903 } 904 pItem = GetItem( rSet, SID_ATTR_TRANSFORM_IN_RTL_TEXT); 905 if(pItem) 906 m_bIsInRightToLeft = static_cast<const SfxBoolItem*>(pItem)->GetValue(); 907 908 pItem = GetItem( rSet, SID_SW_FOLLOW_TEXT_FLOW); 909 if(pItem) 910 { 911 const bool bFollowTextFlow = 912 static_cast<const SfxBoolItem*>(pItem)->GetValue(); 913 m_aFollowCB.Check( bFollowTextFlow ); 914 } 915 m_aFollowCB.SaveValue(); 916 917 if(m_bHtmlMode) 918 { 919 if( 0 == (m_nHtmlMode & HTMLMODE_FULL_ABS_POS)) 920 { 921 m_aHeightFT .Enable( sal_False ); 922 m_aHeightMF .Enable( sal_False ); 923 } 924 if( 0 == (m_nHtmlMode & HTMLMODE_SOME_ABS_POS)) 925 { 926 if(GetAnchorType() == TextContentAnchorType_AT_PAGE) 927 { 928 m_aToParaRB.Check(); 929 } 930 m_aToPageRB.Enable(sal_False); 931 } 932 m_aHoriMirrorCB.Show(sal_False); 933 m_aKeepRatioCB.Enable(sal_False); 934 // OD 19.09.2003 #i18732# - hide checkbox in HTML mode 935 m_aFollowCB.Show(sal_False); 936 } 937 else 938 { 939 // OD 06.11.2003 #i18732# correct enable/disable of check box 'Mirror on..' 940 m_aHoriMirrorCB.Enable(!m_aAsCharRB.IsChecked() && !m_bIsMultiSelection); 941 942 // OD 06.11.2003 #i18732# - enable/disable check box 'Follow text flow'. 943 m_aFollowCB.Enable( m_aToParaRB.IsChecked() || 944 m_aToCharRB.IsChecked() ); 945 } 946 947 pItem = GetItem( rSet, SID_ATTR_TRANSFORM_WIDTH ); 948 sal_Int32 nWidth = Max( pItem ? ( static_cast<const SfxUInt32Item*>(pItem)->GetValue()) : 0, (sal_uInt32)1 ); 949 950 m_aWidthMF.SetValue(m_aWidthMF.Normalize(nWidth), FUNIT_TWIP); 951 952 pItem = GetItem( rSet, SID_ATTR_TRANSFORM_HEIGHT ); 953 sal_Int32 nHeight = Max( pItem ? ( static_cast<const SfxUInt32Item*>(pItem)->GetValue()) : 0, (sal_uInt32)1 ); 954 m_aHeightMF.SetValue(m_aHeightMF.Normalize(nHeight), FUNIT_TWIP); 955 m_fWidthHeightRatio = nHeight ? double(nWidth) / double(nHeight) : 1.0; 956 957 if(!m_bPositioningDisabled) 958 { 959 pItem = GetItem( rSet, SID_ATTR_TRANSFORM_HORI_ORIENT); 960 if(pItem) 961 { 962 short nHoriOrientation = static_cast< const SfxInt16Item*>(pItem)->GetValue(); 963 m_nOldH = nHoriOrientation; 964 } 965 pItem = GetItem( rSet, SID_ATTR_TRANSFORM_VERT_ORIENT); 966 if(pItem) 967 { 968 short nVertOrientation = static_cast< const SfxInt16Item*>(pItem)->GetValue(); 969 m_nOldV = nVertOrientation; 970 } 971 pItem = GetItem( rSet, SID_ATTR_TRANSFORM_HORI_RELATION); 972 if(pItem) 973 { 974 m_nOldHRel = static_cast< const SfxInt16Item*>(pItem)->GetValue(); 975 } 976 977 pItem = GetItem( rSet, SID_ATTR_TRANSFORM_VERT_RELATION); 978 if(pItem) 979 { 980 m_nOldVRel = static_cast< const SfxInt16Item*>(pItem)->GetValue(); 981 } 982 pItem = GetItem( rSet, SID_ATTR_TRANSFORM_HORI_MIRROR); 983 if(pItem) 984 m_aHoriMirrorCB.Check(static_cast<const SfxBoolItem*>(pItem)->GetValue()); 985 m_aHoriMirrorCB.SaveValue(); 986 987 sal_Int32 nHoriPos = 0; 988 sal_Int32 nVertPos = 0; 989 pItem = GetItem( rSet, SID_ATTR_TRANSFORM_HORI_POSITION); 990 if(pItem) 991 nHoriPos = static_cast<const SfxInt32Item*>(pItem)->GetValue(); 992 pItem = GetItem( rSet, SID_ATTR_TRANSFORM_VERT_POSITION); 993 if(pItem) 994 nVertPos = static_cast<const SfxInt32Item*>(pItem)->GetValue(); 995 996 InitPos(nAnchorType, m_nOldH, m_nOldHRel, m_nOldV, m_nOldVRel, nHoriPos, nVertPos); 997 998 m_aVertByMF.SaveValue(); 999 m_aHoriByMF.SaveValue(); 1000 // OD 19.09.2003 #i18732# 1001 m_aFollowCB.SaveValue(); 1002 1003 RangeModifyHdl(&m_aWidthMF); // initially set maximum values 1004 } 1005 } 1006 /*-- 03.03.2004 12:21:35--------------------------------------------------- 1007 1008 -----------------------------------------------------------------------*/ 1009 int SvxSwPosSizeTabPage::DeactivatePage( SfxItemSet* _pSet ) 1010 { 1011 if( _pSet ) 1012 FillItemSet( *_pSet ); 1013 return( LEAVE_PAGE ); 1014 } 1015 /*-- 04.03.2004 09:14:41--------------------------------------------------- 1016 1017 -----------------------------------------------------------------------*/ 1018 void SvxSwPosSizeTabPage::EnableAnchorTypes(sal_uInt16 nAnchorEnable) 1019 { 1020 if((nAnchorEnable & SVX_OBJ_AT_FLY)) 1021 m_aToFrameRB.Show(); 1022 if(!(nAnchorEnable & SVX_OBJ_PAGE)) 1023 m_aToPageRB.Enable(sal_False); 1024 } 1025 /*-- 04.03.2004 09:33:33--------------------------------------------------- 1026 1027 -----------------------------------------------------------------------*/ 1028 short SvxSwPosSizeTabPage::GetAnchorType(bool* pbHasChanged) 1029 { 1030 short nRet = -1; 1031 RadioButton* pCheckedButton = 0; 1032 if(m_aToParaRB.IsEnabled()) 1033 { 1034 if(m_aToPageRB.IsChecked()) 1035 { 1036 nRet = TextContentAnchorType_AT_PAGE; 1037 pCheckedButton = &m_aToPageRB; 1038 } 1039 else if(m_aToParaRB.IsChecked()) 1040 { 1041 nRet = TextContentAnchorType_AT_PARAGRAPH; 1042 pCheckedButton = &m_aToParaRB; 1043 } 1044 else if(m_aToCharRB.IsChecked()) 1045 { 1046 nRet = TextContentAnchorType_AT_CHARACTER; 1047 pCheckedButton = &m_aToCharRB; 1048 } 1049 else if(m_aAsCharRB.IsChecked()) 1050 { 1051 nRet = TextContentAnchorType_AS_CHARACTER; 1052 pCheckedButton = &m_aAsCharRB; 1053 } 1054 else if(m_aToFrameRB.IsChecked()) 1055 { 1056 nRet = TextContentAnchorType_AT_FRAME; 1057 pCheckedButton = &m_aToFrameRB; 1058 } 1059 } 1060 if(pbHasChanged) 1061 { 1062 if(pCheckedButton) 1063 *pbHasChanged = pCheckedButton->IsChecked() != pCheckedButton->GetSavedValue(); 1064 else 1065 *pbHasChanged = false; 1066 } 1067 return nRet; 1068 } 1069 /*-- 05.03.2004 10:43:32--------------------------------------------------- 1070 1071 -----------------------------------------------------------------------*/ 1072 IMPL_LINK( SvxSwPosSizeTabPage, RangeModifyHdl, Edit *, EMPTYARG ) 1073 { 1074 if(m_bPositioningDisabled) 1075 return 0; 1076 SvxSwFrameValidation aVal; 1077 1078 aVal.nAnchorType = GetAnchorType(); 1079 aVal.bAutoHeight = false; 1080 aVal.bAutoWidth = false; 1081 aVal.bMirror = m_aHoriMirrorCB.IsChecked(); 1082 // OD 18.09.2003 #i18732# 1083 aVal.bFollowTextFlow = m_aFollowCB.IsChecked(); 1084 1085 if ( m_pHMap ) 1086 { 1087 // Ausrichtung Horizontal 1088 sal_uInt16 nMapPos = GetMapPos(m_pHMap, m_aHoriToLB); 1089 sal_uInt16 nAlign = GetAlignment(m_pHMap, nMapPos, m_aHoriLB, m_aHoriToLB); 1090 sal_uInt16 nRel = GetRelation(m_pHMap, m_aHoriToLB); 1091 1092 aVal.nHoriOrient = (short)nAlign; 1093 aVal.nHRelOrient = (short)nRel; 1094 } 1095 else 1096 aVal.nHoriOrient = HoriOrientation::NONE; 1097 1098 if ( m_pVMap ) 1099 { 1100 // Ausrichtung Vertikal 1101 sal_uInt16 nMapPos = GetMapPos(m_pVMap, m_aVertLB); 1102 sal_uInt16 nAlign = GetAlignment(m_pVMap, nMapPos, m_aVertLB, m_aVertToLB); 1103 sal_uInt16 nRel = GetRelation(m_pVMap, m_aVertToLB); 1104 1105 aVal.nVertOrient = (short)nAlign; 1106 aVal.nVRelOrient = (short)nRel; 1107 } 1108 else 1109 aVal.nVertOrient = VertOrientation::NONE; 1110 1111 const long nAtHorzPosVal = 1112 static_cast<long>(m_aHoriByMF.Denormalize(m_aHoriByMF.GetValue(FUNIT_TWIP))); 1113 const long nAtVertPosVal = 1114 static_cast<long>(m_aVertByMF.Denormalize(m_aVertByMF.GetValue(FUNIT_TWIP))); 1115 1116 aVal.nHPos = nAtHorzPosVal; 1117 aVal.nVPos = nAtVertPosVal; 1118 1119 sal_Int32 nWidth = static_cast<sal_uInt32>(m_aWidthMF. Denormalize(m_aWidthMF.GetValue(FUNIT_TWIP))); 1120 sal_Int32 nHeight = static_cast<sal_uInt32>(m_aHeightMF.Denormalize(m_aHeightMF.GetValue(FUNIT_TWIP))); 1121 aVal.nWidth = nWidth; 1122 aVal.nHeight = nHeight; 1123 1124 if(m_aValidateLink.IsSet()) 1125 m_aValidateLink.Call(&aVal); 1126 1127 nWidth = aVal.nWidth; 1128 nHeight = aVal.nHeight; 1129 1130 // Mindestbreite auch fuer Vorlage 1131 m_aHeightMF.SetMin(m_aHeightMF.Normalize(aVal.nMinHeight), FUNIT_TWIP); 1132 m_aWidthMF. SetMin(m_aWidthMF.Normalize(aVal.nMinWidth), FUNIT_TWIP); 1133 1134 sal_Int32 nMaxWidth(aVal.nMaxWidth); 1135 sal_Int32 nMaxHeight(aVal.nMaxHeight); 1136 1137 sal_Int64 nTmp = m_aHeightMF.Normalize(nMaxHeight); 1138 m_aHeightMF.SetMax(nTmp, FUNIT_TWIP); 1139 1140 nTmp = m_aWidthMF.Normalize(nMaxWidth); 1141 m_aWidthMF.SetMax(nTmp, FUNIT_TWIP); 1142 1143 m_aHoriByMF.SetMin(m_aHoriByMF.Normalize(aVal.nMinHPos), FUNIT_TWIP); 1144 m_aHoriByMF.SetMax(m_aHoriByMF.Normalize(aVal.nMaxHPos), FUNIT_TWIP); 1145 if ( aVal.nHPos != nAtHorzPosVal ) 1146 m_aHoriByMF.SetValue(m_aHoriByMF.Normalize(aVal.nHPos), FUNIT_TWIP); 1147 1148 m_aVertByMF.SetMin(m_aVertByMF.Normalize(aVal.nMinVPos ), FUNIT_TWIP); 1149 m_aVertByMF.SetMax(m_aVertByMF.Normalize(aVal.nMaxVPos), FUNIT_TWIP); 1150 if ( aVal.nVPos != nAtVertPosVal ) 1151 m_aVertByMF.SetValue(m_aVertByMF.Normalize(aVal.nVPos), FUNIT_TWIP); 1152 1153 return 0; 1154 } 1155 /*-- 05.03.2004 11:12:56--------------------------------------------------- 1156 1157 -----------------------------------------------------------------------*/ 1158 IMPL_LINK( SvxSwPosSizeTabPage, AnchorTypeHdl, RadioButton *, EMPTYARG ) 1159 { 1160 m_aHoriMirrorCB.Enable(!m_aAsCharRB.IsChecked() && !m_bIsMultiSelection); 1161 1162 // OD 06.11.2003 #i18732# - enable check box 'Follow text flow' for anchor 1163 // type to-paragraph' and to-character 1164 m_aFollowCB.Enable( m_aToParaRB.IsChecked() || m_aToCharRB.IsChecked() ); 1165 1166 short nId = GetAnchorType(); 1167 1168 InitPos( nId, USHRT_MAX, 0, USHRT_MAX, 0, LONG_MAX, LONG_MAX); 1169 RangeModifyHdl(0); 1170 1171 if(m_bHtmlMode) 1172 { 1173 PosHdl(&m_aHoriLB); 1174 PosHdl(&m_aVertLB); 1175 } 1176 return 0; 1177 } 1178 /*-- 05.03.2004 14:20:19--------------------------------------------------- 1179 1180 -----------------------------------------------------------------------*/ 1181 IMPL_LINK( SvxSwPosSizeTabPage, MirrorHdl, CheckBox *, EMPTYARG ) 1182 { 1183 short nId = GetAnchorType(); 1184 InitPos( nId, USHRT_MAX, 0, USHRT_MAX, 0, LONG_MAX, LONG_MAX); 1185 1186 return 0; 1187 } 1188 /*-- 05.03.2004 14:20:19--------------------------------------------------- 1189 1190 -----------------------------------------------------------------------*/ 1191 IMPL_LINK( SvxSwPosSizeTabPage, RelHdl, ListBox *, pLB ) 1192 { 1193 sal_Bool bHori = pLB == &m_aHoriToLB; 1194 1195 UpdateExample(); 1196 1197 if (bHori) 1198 m_bAtHoriPosModified = sal_True; 1199 else 1200 m_bAtVertPosModified = sal_True; 1201 1202 // OD 12.11.2003 #i22341# - following special handling no longer needed 1203 /* 1204 if (!bHori && m_pVMap == aVCharMap) 1205 { 1206 // Ausrichtung Vertikal 1207 String sEntry; 1208 sal_uInt16 nMapPos = GetMapPos(m_pVMap, m_aVertLB); 1209 sal_uInt16 nAlign = GetAlignment(m_pVMap, nMapPos, m_aVertLB, m_aVertToLB); 1210 sal_uInt16 nRel = GetRelation(m_pVMap, m_aVertToLB); 1211 1212 if (nRel == SwFPos::REL_CHAR) 1213 sEntry = m_aFramePosString.GetString(SwFPos::FROMBOTTOM); 1214 else 1215 sEntry = m_aFramePosString.GetString(SwFPos::FROMTOP); 1216 1217 sal_uInt16 nOldPos = m_aVertLB.GetSelectEntryPos(); 1218 1219 String sName = m_aVertLB.GetEntry(m_aVertLB.GetEntryCount() - 1); 1220 if (sName != sEntry) 1221 { 1222 m_aVertLB.RemoveEntry(m_aVertLB.GetEntryCount() - 1); 1223 m_aVertLB.InsertEntry(sEntry); 1224 m_aVertLB.SelectEntryPos(nOldPos); 1225 } 1226 } 1227 */ 1228 if(m_bHtmlMode && TextContentAnchorType_AT_CHARACTER == GetAnchorType()) // wieder Sonderbehandlung 1229 { 1230 if(bHori) 1231 { 1232 sal_uInt16 nRel = GetRelation(m_pHMap, m_aHoriToLB); 1233 if(RelOrientation::PRINT_AREA == nRel && 0 == m_aVertLB.GetSelectEntryPos()) 1234 { 1235 m_aVertLB.SelectEntryPos(1); 1236 } 1237 else if(RelOrientation::CHAR == nRel && 1 == m_aVertLB.GetSelectEntryPos()) 1238 { 1239 m_aVertLB.SelectEntryPos(0); 1240 } 1241 } 1242 } 1243 if (pLB) // Nur wenn Handler durch Aenderung des Controllers gerufen wurde 1244 RangeModifyHdl(0); 1245 1246 return 0; 1247 1248 } 1249 /*-- 05.03.2004 14:20:19--------------------------------------------------- 1250 1251 -----------------------------------------------------------------------*/ 1252 IMPL_LINK( SvxSwPosSizeTabPage, PosHdl, ListBox *, pLB ) 1253 { 1254 sal_Bool bHori = pLB == &m_aHoriLB; 1255 ListBox *pRelLB = bHori ? &m_aHoriToLB : &m_aVertToLB; 1256 FixedText *pRelFT = bHori ? &m_aHoriToFT : &m_aVertToFT; 1257 FrmMap *pMap = bHori ? m_pHMap : m_pVMap; 1258 1259 1260 sal_uInt16 nMapPos = GetMapPos(pMap, *pLB); 1261 sal_uInt16 nAlign = GetAlignment(pMap, nMapPos, *pLB, *pRelLB); 1262 1263 if (bHori) 1264 { 1265 sal_Bool bEnable = HoriOrientation::NONE == nAlign; 1266 m_aHoriByMF.Enable( bEnable ); 1267 m_aHoriByFT.Enable( bEnable ); 1268 } 1269 else 1270 { 1271 sal_Bool bEnable = VertOrientation::NONE == nAlign; 1272 m_aVertByMF.Enable( bEnable ); 1273 m_aVertByFT.Enable( bEnable ); 1274 } 1275 1276 if (pLB) // Nur wenn Handler durch Aenderung des Controllers gerufen wurde 1277 RangeModifyHdl( 0 ); 1278 1279 short nRel = 0; 1280 if (pLB->GetSelectEntryCount()) 1281 { 1282 1283 if (pRelLB->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND) 1284 nRel = ((RelationMap *)pRelLB->GetEntryData(pRelLB->GetSelectEntryPos()))->nRelation; 1285 1286 FillRelLB(pMap, nMapPos, nAlign, nRel, *pRelLB, *pRelFT); 1287 } 1288 else 1289 pRelLB->Clear(); 1290 1291 UpdateExample(); 1292 1293 if (bHori) 1294 m_bAtHoriPosModified = sal_True; 1295 else 1296 m_bAtVertPosModified = sal_True; 1297 1298 // Sonderbehandlung fuer HTML-Mode mit horz-vert-Abhaengigkeiten 1299 if(m_bHtmlMode && m_nHtmlMode & HTMLMODE_SOME_ABS_POS && 1300 TextContentAnchorType_AT_CHARACTER == GetAnchorType()) 1301 { 1302 sal_Bool bSet = sal_False; 1303 if(bHori) 1304 { 1305 // rechts ist nur unterhalb erlaubt - von links nur oben 1306 // von links am Zeichen -> unterhalb 1307 if((HoriOrientation::LEFT == nAlign || HoriOrientation::RIGHT == nAlign) && 1308 0 == m_aVertLB.GetSelectEntryPos()) 1309 { 1310 if(RelOrientation::FRAME == nRel) 1311 m_aVertLB.SelectEntryPos(1); 1312 else 1313 m_aVertLB.SelectEntryPos(0); 1314 bSet = sal_True; 1315 } 1316 else if(HoriOrientation::LEFT == nAlign && 1 == m_aVertLB.GetSelectEntryPos()) 1317 { 1318 m_aVertLB.SelectEntryPos(0); 1319 bSet = sal_True; 1320 } 1321 else if(HoriOrientation::NONE == nAlign && 1 == m_aVertLB.GetSelectEntryPos()) 1322 { 1323 m_aVertLB.SelectEntryPos(0); 1324 bSet = sal_True; 1325 } 1326 if(bSet) 1327 PosHdl(&m_aVertLB); 1328 } 1329 else 1330 { 1331 if(VertOrientation::TOP == nAlign) 1332 { 1333 if(1 == m_aHoriLB.GetSelectEntryPos()) 1334 { 1335 m_aHoriLB.SelectEntryPos(0); 1336 bSet = sal_True; 1337 } 1338 m_aHoriToLB.SelectEntryPos(1); 1339 } 1340 else if(VertOrientation::CHAR_BOTTOM == nAlign) 1341 { 1342 if(2 == m_aHoriLB.GetSelectEntryPos()) 1343 { 1344 m_aHoriLB.SelectEntryPos(0); 1345 bSet = sal_True; 1346 } 1347 m_aHoriToLB.SelectEntryPos(0) ; 1348 } 1349 if(bSet) 1350 PosHdl(&m_aHoriLB); 1351 } 1352 1353 } 1354 return 0; 1355 } 1356 /*-- 05.03.2004 14:20:19--------------------------------------------------- 1357 1358 -----------------------------------------------------------------------*/ 1359 IMPL_LINK( SvxSwPosSizeTabPage, ModifyHdl, Edit *, pEdit ) 1360 { 1361 sal_Int64 nWidth = m_aWidthMF.Denormalize(m_aWidthMF.GetValue(FUNIT_TWIP)); 1362 sal_Int64 nHeight = m_aHeightMF.Denormalize(m_aHeightMF.GetValue(FUNIT_TWIP)); 1363 if ( m_aKeepRatioCB.IsChecked() ) 1364 { 1365 if ( pEdit == &m_aWidthMF ) 1366 { 1367 nHeight = sal_Int64((double)nWidth / m_fWidthHeightRatio); 1368 m_aHeightMF.SetValue(m_aHeightMF.Normalize(nHeight), FUNIT_TWIP); 1369 } 1370 else if(pEdit == &m_aHeightMF) 1371 { 1372 nWidth = sal_Int64((double)nHeight * m_fWidthHeightRatio); 1373 m_aWidthMF.SetValue(m_aWidthMF.Normalize(nWidth), FUNIT_TWIP); 1374 } 1375 } 1376 m_fWidthHeightRatio = nHeight ? double(nWidth) / double(nHeight) : 1.0; 1377 UpdateExample(); 1378 return 0; 1379 } 1380 /*-- 11.03.2004 15:40:17--------------------------------------------------- 1381 1382 -----------------------------------------------------------------------*/ 1383 IMPL_LINK( SvxSwPosSizeTabPage, ProtectHdl, TriStateBox *, EMPTYARG) 1384 { 1385 m_aSizeCB.Enable(m_aPositionCB.IsEnabled() && !m_aPositionCB.IsChecked()); 1386 return 0; 1387 } 1388 /*-- 05.03.2004 14:20:19--------------------------------------------------- 1389 1390 -----------------------------------------------------------------------*/ 1391 short SvxSwPosSizeTabPage::GetRelation(FrmMap *, ListBox &rRelationLB) 1392 { 1393 short nRel = 0; 1394 sal_uInt16 nPos = rRelationLB.GetSelectEntryPos(); 1395 1396 if (nPos != LISTBOX_ENTRY_NOTFOUND) 1397 { 1398 RelationMap *pEntry = (RelationMap *)rRelationLB.GetEntryData(nPos); 1399 nRel = pEntry->nRelation; 1400 } 1401 1402 return nRel; 1403 } 1404 /*-- 05.03.2004 14:20:19--------------------------------------------------- 1405 1406 -----------------------------------------------------------------------*/ 1407 short SvxSwPosSizeTabPage::GetAlignment(FrmMap *pMap, sal_uInt16 nMapPos, ListBox &/*rAlignLB*/, ListBox &rRelationLB) 1408 { 1409 short nAlign = 0; 1410 1411 // OD 14.11.2003 #i22341# - special handling also for map <aVCharMap>, 1412 // because it contains ambigous items for alignment 1413 if (pMap == aVAsCharHtmlMap || pMap == aVAsCharMap || 1414 pMap == aVCharMap ) 1415 { 1416 if (rRelationLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND) 1417 { 1418 sal_uLong nRel = ((RelationMap *)rRelationLB.GetEntryData(rRelationLB.GetSelectEntryPos()))->nLBRelation; 1419 std::size_t nMapCount = ::lcl_GetFrmMapCount(pMap); 1420 SvxSwFramePosString::StringId eStrId = pMap[nMapPos].eStrId; 1421 1422 for (std::size_t i = 0; i < nMapCount; i++) 1423 { 1424 if (pMap[i].eStrId == eStrId) 1425 { 1426 sal_uLong nLBRelations = pMap[i].nLBRelations; 1427 if (nLBRelations & nRel) 1428 { 1429 nAlign = pMap[i].nAlign; 1430 break; 1431 } 1432 } 1433 } 1434 } 1435 } 1436 else if (pMap) 1437 nAlign = pMap[nMapPos].nAlign; 1438 1439 return nAlign; 1440 } 1441 /*-- 05.03.2004 14:20:19--------------------------------------------------- 1442 1443 -----------------------------------------------------------------------*/ 1444 sal_uInt16 SvxSwPosSizeTabPage::GetMapPos(FrmMap *pMap, ListBox &rAlignLB) 1445 { 1446 sal_uInt16 nMapPos = 0; 1447 sal_uInt16 nLBSelPos = rAlignLB.GetSelectEntryPos(); 1448 1449 if (nLBSelPos != LISTBOX_ENTRY_NOTFOUND) 1450 { 1451 if (pMap == aVAsCharHtmlMap || pMap == aVAsCharMap) 1452 { 1453 std::size_t nMapCount = ::lcl_GetFrmMapCount(pMap); 1454 String sSelEntry(rAlignLB.GetSelectEntry()); 1455 1456 for (std::size_t i = 0; i < nMapCount; i++) 1457 { 1458 SvxSwFramePosString::StringId eResId = pMap[i].eStrId; 1459 1460 String sEntry = m_aFramePosString.GetString(eResId); 1461 1462 if (sEntry == sSelEntry) 1463 { 1464 nMapPos = sal::static_int_cast< sal_uInt16 >(i); 1465 break; 1466 } 1467 } 1468 } 1469 else 1470 nMapPos = nLBSelPos; 1471 } 1472 1473 return nMapPos; 1474 } 1475 /*-- 05.03.2004 14:20:19--------------------------------------------------- 1476 1477 -----------------------------------------------------------------------*/ 1478 void SvxSwPosSizeTabPage::InitPos(short nAnchor, 1479 sal_uInt16 nH, 1480 sal_uInt16 nHRel, 1481 sal_uInt16 nV, 1482 sal_uInt16 nVRel, 1483 long nX, 1484 long nY) 1485 { 1486 sal_uInt16 nPos = m_aVertLB.GetSelectEntryPos(); 1487 if ( nPos != LISTBOX_ENTRY_NOTFOUND && m_pVMap ) 1488 { 1489 m_nOldV = m_pVMap[nPos].nAlign; 1490 nPos = m_aVertToLB.GetSelectEntryPos(); 1491 if (nPos != LISTBOX_ENTRY_NOTFOUND) 1492 m_nOldVRel = ((RelationMap *)m_aVertToLB.GetEntryData(nPos))->nRelation; 1493 } 1494 1495 nPos = m_aHoriLB.GetSelectEntryPos(); 1496 if ( nPos != LISTBOX_ENTRY_NOTFOUND && m_pHMap ) 1497 { 1498 m_nOldH = m_pHMap[nPos].nAlign; 1499 1500 nPos = m_aHoriToLB.GetSelectEntryPos(); 1501 if (nPos != LISTBOX_ENTRY_NOTFOUND) 1502 m_nOldHRel = ((RelationMap *)m_aHoriToLB.GetEntryData(nPos))->nRelation; 1503 } 1504 1505 sal_Bool bEnable = sal_True; 1506 if( m_bIsMultiSelection ) 1507 { 1508 m_pVMap = aVMultiSelectionMap; 1509 m_pHMap = aHMultiSelectionMap; 1510 } 1511 else if( nAnchor == TextContentAnchorType_AT_PAGE ) 1512 { 1513 m_pVMap = m_bHtmlMode ? aVPageHtmlMap : aVPageMap; 1514 m_pHMap = m_bHtmlMode ? aHPageHtmlMap : aHPageMap; 1515 } 1516 else if ( nAnchor == TextContentAnchorType_AT_FRAME ) 1517 { 1518 // OD 19.09.2003 #i18732# - own vertical alignment map for to frame 1519 // anchored objects. 1520 m_pVMap = m_bHtmlMode ? aVFlyHtmlMap : aVFrameMap; 1521 m_pHMap = m_bHtmlMode ? aHFlyHtmlMap : aHFrameMap; 1522 } 1523 else if ( nAnchor == TextContentAnchorType_AT_PARAGRAPH ) 1524 { 1525 if(m_bHtmlMode) 1526 { 1527 m_pVMap = aVParaHtmlMap; 1528 m_pHMap = m_nHtmlMode & HTMLMODE_SOME_ABS_POS ? aHParaHtmlAbsMap : aHParaHtmlMap; 1529 } 1530 else 1531 { 1532 m_pVMap = aVParaMap; 1533 m_pHMap = aHParaMap; 1534 } 1535 } 1536 else if ( nAnchor == TextContentAnchorType_AT_CHARACTER ) 1537 { 1538 if(m_bHtmlMode) 1539 { 1540 m_pVMap = m_nHtmlMode & HTMLMODE_SOME_ABS_POS ? aVCharHtmlAbsMap : aVCharHtmlMap; 1541 m_pHMap = m_nHtmlMode & HTMLMODE_SOME_ABS_POS ? aHCharHtmlAbsMap : aHCharHtmlMap; 1542 } 1543 else 1544 { 1545 m_pVMap = aVCharMap; 1546 m_pHMap = aHCharMap; 1547 } 1548 } 1549 else if ( nAnchor == TextContentAnchorType_AS_CHARACTER ) 1550 { 1551 m_pVMap = m_bHtmlMode ? aVAsCharHtmlMap : aVAsCharMap; 1552 m_pHMap = 0; 1553 bEnable = sal_False; 1554 } 1555 m_aHoriLB.Enable( bEnable ); 1556 m_aHoriFT.Enable( bEnable ); 1557 1558 // aktuelle Pos selektieren 1559 // Horizontal 1560 if ( nH == USHRT_MAX ) 1561 { 1562 nH = m_nOldH; 1563 nHRel = m_nOldHRel; 1564 } 1565 // OD 12.11.2003 #i22341# - pass <nHRel> as 3rd parameter to method <FillPosLB> 1566 sal_uInt16 nMapPos = FillPosLB(m_pHMap, nH, nHRel, m_aHoriLB); 1567 FillRelLB(m_pHMap, nMapPos, nH, nHRel, m_aHoriToLB, m_aHoriToFT); 1568 1569 // Vertikal 1570 if ( nV == USHRT_MAX ) 1571 { 1572 nV = m_nOldV; 1573 nVRel = m_nOldVRel; 1574 } 1575 // OD 12.11.2003 #i22341# - pass <nVRel> as 3rd parameter to method <FillPosLB> 1576 nMapPos = FillPosLB(m_pVMap, nV, nVRel, m_aVertLB); 1577 FillRelLB(m_pVMap, nMapPos, nV, nVRel, m_aVertToLB, m_aVertToFT); 1578 1579 // Edits init 1580 bEnable = nH == HoriOrientation::NONE && 1581 nAnchor != TextContentAnchorType_AS_CHARACTER;//#61359# warum nicht in Formaten&& !bFormat; 1582 if (!bEnable) 1583 { 1584 m_aHoriByMF.SetValue( 0, FUNIT_TWIP ); 1585 if (nX != LONG_MAX && m_bHtmlMode) 1586 m_aHoriByMF.SetModifyFlag(); 1587 } 1588 else if(m_bIsMultiSelection) 1589 { 1590 m_aHoriByMF.SetValue( m_aHoriByMF.Normalize(m_aRect.Left()), FUNIT_TWIP ); 1591 } 1592 else 1593 { 1594 if (nX != LONG_MAX) 1595 m_aHoriByMF.SetValue( m_aHoriByMF.Normalize(nX), FUNIT_TWIP ); 1596 } 1597 m_aHoriByFT.Enable( bEnable ); 1598 m_aHoriByMF.Enable( bEnable ); 1599 1600 bEnable = nV == VertOrientation::NONE; 1601 if ( !bEnable ) 1602 { 1603 m_aVertByMF.SetValue( 0, FUNIT_TWIP ); 1604 if(nY != LONG_MAX && m_bHtmlMode) 1605 m_aVertByMF.SetModifyFlag(); 1606 } 1607 else if(m_bIsMultiSelection) 1608 { 1609 m_aVertByMF.SetValue( m_aVertByMF.Normalize(m_aRect.Top()), FUNIT_TWIP ); 1610 } 1611 else 1612 { 1613 if ( nAnchor == TextContentAnchorType_AS_CHARACTER ) 1614 { 1615 if ( nY == LONG_MAX ) 1616 nY = 0; 1617 else 1618 nY *= -1; 1619 } 1620 if ( nY != LONG_MAX ) 1621 m_aVertByMF.SetValue( m_aVertByMF.Normalize(nY), FUNIT_TWIP ); 1622 } 1623 m_aVertByFT.Enable( bEnable ); 1624 m_aVertByMF.Enable( bEnable ); 1625 UpdateExample(); 1626 } 1627 /*-- 05.03.2004 14:20:19--------------------------------------------------- 1628 1629 -----------------------------------------------------------------------*/ 1630 void SvxSwPosSizeTabPage::UpdateExample() 1631 { 1632 sal_uInt16 nPos = m_aHoriLB.GetSelectEntryPos(); 1633 if ( m_pHMap && nPos != LISTBOX_ENTRY_NOTFOUND ) 1634 { 1635 sal_uInt16 nMapPos = GetMapPos(m_pHMap, m_aHoriLB); 1636 short nAlign = GetAlignment(m_pHMap, nMapPos, m_aHoriLB, m_aHoriToLB); 1637 short nRel = GetRelation(m_pHMap, m_aHoriToLB); 1638 1639 m_aExampleWN.SetHAlign(nAlign); 1640 m_aExampleWN.SetHoriRel(nRel); 1641 } 1642 1643 nPos = m_aVertLB.GetSelectEntryPos(); 1644 if ( m_pVMap && nPos != LISTBOX_ENTRY_NOTFOUND ) 1645 { 1646 sal_uInt16 nMapPos = GetMapPos(m_pVMap, m_aVertLB); 1647 sal_uInt16 nAlign = GetAlignment(m_pVMap, nMapPos, m_aVertLB, m_aVertToLB); 1648 sal_uInt16 nRel = GetRelation(m_pVMap, m_aVertToLB); 1649 1650 m_aExampleWN.SetVAlign(nAlign); 1651 m_aExampleWN.SetVertRel(nRel); 1652 } 1653 1654 // Size 1655 long nXPos = static_cast<long>(m_aHoriByMF.Denormalize(m_aHoriByMF.GetValue(FUNIT_TWIP))); 1656 long nYPos = static_cast<long>(m_aVertByMF.Denormalize(m_aVertByMF.GetValue(FUNIT_TWIP))); 1657 m_aExampleWN.SetRelPos(Point(nXPos, nYPos)); 1658 1659 m_aExampleWN.SetAnchor( GetAnchorType() ); 1660 m_aExampleWN.Invalidate(); 1661 } 1662 /*-- 05.03.2004 14:20:19--------------------------------------------------- 1663 1664 -----------------------------------------------------------------------*/ 1665 sal_uLong SvxSwPosSizeTabPage::FillRelLB(FrmMap *pMap, sal_uInt16 nMapPos, sal_uInt16 nAlign, 1666 sal_uInt16 nRel, ListBox &rLB, FixedText &rFT) 1667 { 1668 String sSelEntry; 1669 sal_uLong nLBRelations = 0; 1670 std::size_t nMapCount = ::lcl_GetFrmMapCount(pMap); 1671 1672 rLB.Clear(); 1673 1674 if (nMapPos < nMapCount) 1675 { 1676 if (pMap == aVAsCharHtmlMap || pMap == aVAsCharMap) 1677 { 1678 String sOldEntry(rLB.GetSelectEntry()); 1679 sal_uInt16 nRelCount = sizeof(aAsCharRelationMap) / sizeof(RelationMap); 1680 SvxSwFramePosString::StringId eStrId = pMap[nMapPos].eStrId; 1681 1682 for (std::size_t _nMapPos = 0; _nMapPos < nMapCount; _nMapPos++) 1683 { 1684 if (pMap[_nMapPos].eStrId == eStrId) 1685 { 1686 nLBRelations = pMap[_nMapPos].nLBRelations; 1687 for (sal_uInt16 nRelPos = 0; nRelPos < nRelCount; nRelPos++) 1688 { 1689 if (nLBRelations & aAsCharRelationMap[nRelPos].nLBRelation) 1690 { 1691 SvxSwFramePosString::StringId sStrId1 = aAsCharRelationMap[nRelPos].eStrId; 1692 1693 sStrId1 = lcl_ChangeResIdToVerticalOrRTL(sStrId1, m_bIsVerticalFrame, m_bIsInRightToLeft); 1694 String sEntry = m_aFramePosString.GetString(sStrId1); 1695 sal_uInt16 nPos = rLB.InsertEntry(sEntry); 1696 rLB.SetEntryData(nPos, &aAsCharRelationMap[nRelPos]); 1697 if (pMap[_nMapPos].nAlign == nAlign) 1698 sSelEntry = sEntry; 1699 break; 1700 } 1701 } 1702 } 1703 } 1704 if (sSelEntry.Len()) 1705 rLB.SelectEntry(sSelEntry); 1706 else 1707 { 1708 rLB.SelectEntry(sOldEntry); 1709 1710 if (!rLB.GetSelectEntryCount()) 1711 { 1712 for (sal_uInt16 i = 0; i < rLB.GetEntryCount(); i++) 1713 { 1714 RelationMap *pEntry = (RelationMap *)rLB.GetEntryData(i); 1715 if (pEntry->nLBRelation == LB_REL_CHAR) // Default 1716 { 1717 rLB.SelectEntryPos(i); 1718 break; 1719 } 1720 } 1721 } 1722 } 1723 } 1724 else 1725 { 1726 sal_uInt16 nRelCount = sizeof(aRelationMap) / sizeof(RelationMap); 1727 1728 // OD 14.11.2003 #i22341# - special handling for map <aVCharMap>, 1729 // because its ambigous in its <eStrId>/<eMirrorStrId>. 1730 if ( pMap == aVCharMap ) 1731 { 1732 nLBRelations = ::lcl_GetLBRelationsForStrID( pMap, 1733 ( m_aHoriMirrorCB.IsChecked() 1734 ? pMap[nMapPos].eMirrorStrId 1735 : pMap[nMapPos].eStrId ), 1736 m_aHoriMirrorCB.IsChecked() ); 1737 } 1738 else 1739 { 1740 nLBRelations = pMap[nMapPos].nLBRelations; 1741 } 1742 1743 for (sal_uLong nBit = 1; nBit < 0x80000000; nBit <<= 1) 1744 { 1745 if (nLBRelations & nBit) 1746 { 1747 for (sal_uInt16 nRelPos = 0; nRelPos < nRelCount; nRelPos++) 1748 { 1749 if (aRelationMap[nRelPos].nLBRelation == nBit) 1750 { 1751 SvxSwFramePosString::StringId sStrId1 = m_aHoriMirrorCB.IsChecked() ? aRelationMap[nRelPos].eMirrorStrId : aRelationMap[nRelPos].eStrId; 1752 sStrId1 = lcl_ChangeResIdToVerticalOrRTL(sStrId1, m_bIsVerticalFrame, m_bIsInRightToLeft); 1753 String sEntry = m_aFramePosString.GetString(sStrId1); 1754 sal_uInt16 nPos = rLB.InsertEntry(sEntry); 1755 rLB.SetEntryData(nPos, &aRelationMap[nRelPos]); 1756 if (!sSelEntry.Len() && aRelationMap[nRelPos].nRelation == nRel) 1757 sSelEntry = sEntry; 1758 } 1759 } 1760 } 1761 } 1762 if (sSelEntry.Len()) 1763 rLB.SelectEntry(sSelEntry); 1764 else 1765 { 1766 // Warscheinlich Ankerwechsel. Daher aehnliche Relation suchen 1767 switch (nRel) 1768 { 1769 case RelOrientation::FRAME: nRel = RelOrientation::PAGE_FRAME; break; 1770 case RelOrientation::PRINT_AREA: nRel = RelOrientation::PAGE_PRINT_AREA; break; 1771 case RelOrientation::PAGE_LEFT: nRel = RelOrientation::FRAME_LEFT; break; 1772 case RelOrientation::PAGE_RIGHT: nRel = RelOrientation::FRAME_RIGHT; break; 1773 case RelOrientation::FRAME_LEFT: nRel = RelOrientation::PAGE_LEFT; break; 1774 case RelOrientation::FRAME_RIGHT: nRel = RelOrientation::PAGE_RIGHT; break; 1775 case RelOrientation::PAGE_FRAME: nRel = RelOrientation::FRAME; break; 1776 case RelOrientation::PAGE_PRINT_AREA: nRel = RelOrientation::PRINT_AREA; break; 1777 1778 default: 1779 if (rLB.GetEntryCount()) 1780 { 1781 RelationMap *pEntry = (RelationMap *)rLB.GetEntryData(rLB.GetEntryCount() - 1); 1782 nRel = pEntry->nRelation; 1783 } 1784 break; 1785 } 1786 1787 for (sal_uInt16 i = 0; i < rLB.GetEntryCount(); i++) 1788 { 1789 RelationMap *pEntry = (RelationMap *)rLB.GetEntryData(i); 1790 if (pEntry->nRelation == nRel) 1791 { 1792 rLB.SelectEntryPos(i); 1793 break; 1794 } 1795 } 1796 1797 if (!rLB.GetSelectEntryCount()) 1798 rLB.SelectEntryPos(0); 1799 } 1800 } 1801 } 1802 1803 rLB.Enable(rLB.GetEntryCount() != 0); 1804 rFT.Enable(rLB.GetEntryCount() != 0); 1805 1806 RelHdl(&rLB); 1807 1808 return nLBRelations; 1809 } 1810 /*-- 05.03.2004 14:20:19--------------------------------------------------- 1811 1812 -----------------------------------------------------------------------*/ 1813 sal_uInt16 SvxSwPosSizeTabPage::FillPosLB(FrmMap *_pMap, 1814 sal_uInt16 _nAlign, 1815 const sal_uInt16 _nRel, 1816 ListBox &_rLB) 1817 { 1818 String sSelEntry, sOldEntry; 1819 sOldEntry = _rLB.GetSelectEntry(); 1820 1821 _rLB.Clear(); 1822 1823 // OD 12.11.2003 #i22341# - determine all possible listbox relations for 1824 // given relation for map <aVCharMap> 1825 const sal_uLong nLBRelations = (_pMap != aVCharMap) 1826 ? 0L 1827 : ::lcl_GetLBRelationsForRelations( _nRel ); 1828 1829 // Listbox fuellen 1830 std::size_t nCount = ::lcl_GetFrmMapCount(_pMap); 1831 for (std::size_t i = 0; _pMap && i < nCount; ++i) 1832 { 1833 // #61359# Warum nicht von links/von innen bzw. von oben? 1834 // if (!bFormat || (pMap[i].eStrId != SwFPos::FROMLEFT && pMap[i].eStrId != SwFPos::FROMTOP)) 1835 { 1836 SvxSwFramePosString::StringId eStrId = m_aHoriMirrorCB.IsChecked() ? _pMap[i].eMirrorStrId : _pMap[i].eStrId; 1837 eStrId = lcl_ChangeResIdToVerticalOrRTL(eStrId, m_bIsVerticalFrame, m_bIsInRightToLeft); 1838 String sEntry(m_aFramePosString.GetString(eStrId)); 1839 if (_rLB.GetEntryPos(sEntry) == LISTBOX_ENTRY_NOTFOUND) 1840 { 1841 // bei zeichengebundenen Rahmen keine doppelten Eintraege einfuegen 1842 _rLB.InsertEntry(sEntry); 1843 } 1844 // OD 12.11.2003 #i22341# - add condition to handle map <aVCharMap> 1845 // that is ambigous in the alignment. 1846 if ( _pMap[i].nAlign == _nAlign && 1847 ( !(_pMap == aVCharMap) || _pMap[i].nLBRelations & nLBRelations ) ) 1848 { 1849 sSelEntry = sEntry; 1850 } 1851 } 1852 } 1853 1854 _rLB.SelectEntry(sSelEntry); 1855 if (!_rLB.GetSelectEntryCount()) 1856 _rLB.SelectEntry(sOldEntry); 1857 1858 if (!_rLB.GetSelectEntryCount()) 1859 _rLB.SelectEntryPos(0); 1860 1861 PosHdl(&_rLB); 1862 1863 return GetMapPos(_pMap, _rLB); 1864 } 1865 /*-- 09.03.2004 15:37:50--------------------------------------------------- 1866 1867 -----------------------------------------------------------------------*/ 1868 void SvxSwPosSizeTabPage::SetView( const SdrView* pSdrView ) 1869 { 1870 m_pSdrView = pSdrView; 1871 if(!m_pSdrView) 1872 { 1873 DBG_ERROR("No SdrView* set"); 1874 return; 1875 } 1876 1877 // Setzen des Rechtecks und der Workingarea 1878 m_aRect = m_pSdrView->GetAllMarkedRect(); 1879 m_pSdrView->GetSdrPageView()->LogicToPagePos( m_aRect ); 1880 1881 // get WorkArea 1882 m_aWorkArea = m_pSdrView->GetWorkArea(); 1883 1884 // Beruecksichtigung Ankerposition (bei Writer) 1885 const SdrMarkList& rMarkList = m_pSdrView->GetMarkedObjectList(); 1886 if( rMarkList.GetMarkCount() >= 1 ) 1887 { 1888 const SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); 1889 m_aAnchorPos = pObj->GetAnchorPos(); 1890 1891 if( m_aAnchorPos != Point(0,0) ) // -> Writer 1892 { 1893 for( sal_uInt16 i = 1; i < rMarkList.GetMarkCount(); i++ ) 1894 { 1895 pObj = rMarkList.GetMark( i )->GetMarkedSdrObj(); 1896 if( m_aAnchorPos != pObj->GetAnchorPos() ) 1897 { 1898 // different anchor positions -> disable positioning 1899 m_aPositionFL.Enable(sal_False); 1900 m_aHoriFT.Enable(sal_False); 1901 m_aHoriLB.Enable(sal_False); 1902 m_aHoriByFT.Enable(sal_False); 1903 m_aHoriByMF.Enable(sal_False); 1904 m_aHoriToFT.Enable(sal_False); 1905 m_aHoriToLB.Enable(sal_False); 1906 m_aHoriMirrorCB.Enable(sal_False); 1907 m_aVertFT.Enable(sal_False); 1908 m_aVertLB.Enable(sal_False); 1909 m_aVertByFT.Enable(sal_False); 1910 m_aVertByMF.Enable(sal_False); 1911 m_aVertToFT.Enable(sal_False); 1912 m_aVertToLB.Enable(sal_False); 1913 m_aFollowCB.Enable(sal_False); 1914 m_aHoriByMF.SetText(String()); 1915 m_aVertByMF.SetText(String()); 1916 1917 m_bPositioningDisabled = true; 1918 return; 1919 } 1920 } 1921 } 1922 Point aPt = m_aAnchorPos * -1; 1923 Point aPt2 = aPt; 1924 1925 aPt += m_aWorkArea.TopLeft(); 1926 m_aWorkArea.SetPos( aPt ); 1927 1928 aPt2 += m_aRect.TopLeft(); 1929 m_aRect.SetPos( aPt2 ); 1930 } 1931 1932 // this should happen via SID_ATTR_TRANSFORM_AUTOSIZE 1933 if( rMarkList.GetMarkCount() == 1 ) 1934 { 1935 const SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); 1936 SdrObjKind eKind = (SdrObjKind) pObj->GetObjIdentifier(); 1937 if( ( pObj->GetObjInventor() == SdrInventor ) && 1938 ( eKind==OBJ_TEXT || eKind==OBJ_TITLETEXT || eKind==OBJ_OUTLINETEXT) && 1939 ( (SdrTextObj*) pObj )->HasText() ) 1940 { 1941 DBG_ERROR("AutoWidth/AutoHeight should be enabled"); 1942 } 1943 } 1944 else 1945 m_bIsMultiSelection = true; 1946 1947 // use page offset and recalculate 1948 Point aPt( m_pSdrView->GetSdrPageView()->GetPageOrigin() ); 1949 1950 // Massstab 1951 Fraction aUIScale = m_pSdrView->GetModel()->GetUIScale(); 1952 1953 // lcl_ScaleRect( m_aWorkArea, aUIScale ); 1954 // lcl_ScaleRect( m_aRect, aUIScale ); 1955 // lcl_ScalePoint( aPt, aUIScale ); 1956 1957 // Metrik konvertieren 1958 // int nDigits = maMtrPosX.GetDecimalDigits(); 1959 1960 // aPt = lcl_ConvertPoint( aPt, nDigits, (MapUnit) mePoolUnit, meDlgUnit ); 1961 // m_aWorkArea = lcl_ConvertRect( m_aWorkArea, nDigits, (MapUnit) mePoolUnit, meDlgUnit ); 1962 // m_aRect = lcl_ConvertRect( m_aRect, nDigits, (MapUnit) mePoolUnit, meDlgUnit ); 1963 1964 // use page offset 1965 // aPt *= -1; 1966 // aPt += m_aWorkArea.TopLeft(); 1967 // m_aWorkArea.SetPos( aPt ); 1968 1969 //SetMinMaxPosition(); 1970 } 1971 1972