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