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