1efeef26fSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file 5efeef26fSAndrew Rist * distributed with this work for additional information 6efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the 8efeef26fSAndrew Rist * "License"); you may not use this file except in compliance 9efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at 10efeef26fSAndrew Rist * 11efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12efeef26fSAndrew Rist * 13efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing, 14efeef26fSAndrew Rist * software distributed under the License is distributed on an 15efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16efeef26fSAndrew Rist * KIND, either express or implied. See the License for the 17efeef26fSAndrew Rist * specific language governing permissions and limitations 18efeef26fSAndrew Rist * under the License. 19efeef26fSAndrew Rist * 20efeef26fSAndrew Rist *************************************************************/ 21efeef26fSAndrew Rist 22efeef26fSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sw.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir 28cdf0e10cSrcweir #include <tools/list.hxx> 29cdf0e10cSrcweir 30cdf0e10cSrcweir #include <hintids.hxx> 31cdf0e10cSrcweir #include "uitool.hxx" 32cdf0e10cSrcweir #include <sfx2/app.hxx> 33cdf0e10cSrcweir #include <svx/rulritem.hxx> 34cdf0e10cSrcweir #include <editeng/tstpitem.hxx> 35cdf0e10cSrcweir #include <sfx2/request.hxx> 36cdf0e10cSrcweir #include <editeng/lrspitem.hxx> 37cdf0e10cSrcweir #include <editeng/ulspitem.hxx> 38cdf0e10cSrcweir #include <editeng/boxitem.hxx> 39cdf0e10cSrcweir #include <editeng/frmdiritem.hxx> 40cdf0e10cSrcweir #include <svl/eitem.hxx> 41cdf0e10cSrcweir #include <svl/whiter.hxx> 42cdf0e10cSrcweir #include <svx/ruler.hxx> 43cdf0e10cSrcweir #include <editeng/protitem.hxx> 44cdf0e10cSrcweir #include <svl/rectitem.hxx> 45cdf0e10cSrcweir #include <sfx2/bindings.hxx> 46cdf0e10cSrcweir #include <fmtfsize.hxx> 47cdf0e10cSrcweir #include <fmthdft.hxx> 48cdf0e10cSrcweir #include <fmtclds.hxx> 49cdf0e10cSrcweir #include <fmtornt.hxx> 50cdf0e10cSrcweir #include <frmatr.hxx> 51cdf0e10cSrcweir #include <edtwin.hxx> 52cdf0e10cSrcweir #include "view.hxx" 53cdf0e10cSrcweir #include "wrtsh.hxx" 54cdf0e10cSrcweir #include "basesh.hxx" 55cdf0e10cSrcweir #include "cmdid.h" 56cdf0e10cSrcweir #include "viewopt.hxx" 57cdf0e10cSrcweir #include "tabcol.hxx" 58cdf0e10cSrcweir #include "frmfmt.hxx" // FrameFormat 59cdf0e10cSrcweir #include "pagedesc.hxx" // Aktuelles Seitenformat 60cdf0e10cSrcweir #include "wview.hxx" 61cdf0e10cSrcweir #include "fmtcol.hxx" 62cdf0e10cSrcweir #include "section.hxx" 63cdf0e10cSrcweir 64cdf0e10cSrcweir // -> #i23726# 65cdf0e10cSrcweir #include "ndtxt.hxx" 66cdf0e10cSrcweir #include "pam.hxx" 67cdf0e10cSrcweir // <- #i23726# 68cdf0e10cSrcweir 69cdf0e10cSrcweir #include <IDocumentSettingAccess.hxx> 70cdf0e10cSrcweir 71cdf0e10cSrcweir using namespace ::com::sun::star; 72cdf0e10cSrcweir 73cdf0e10cSrcweir 74cdf0e10cSrcweir /*-------------------------------------------------------------------- 75cdf0e10cSrcweir Beschreibung: Debug-Methode 76cdf0e10cSrcweir --------------------------------------------------------------------*/ 77cdf0e10cSrcweir 78cdf0e10cSrcweir 79cdf0e10cSrcweir /*-------------------------------------------------------------------- 80cdf0e10cSrcweir Beschreibung: Columns eintueten 81cdf0e10cSrcweir --------------------------------------------------------------------*/ 82cdf0e10cSrcweir 83cdf0e10cSrcweir 84cdf0e10cSrcweir void lcl_FillSvxColumn(const SwFmtCol& rCol, 85cdf0e10cSrcweir sal_uInt16 nTotalWidth, 86cdf0e10cSrcweir SvxColumnItem& rColItem, 87cdf0e10cSrcweir long nDistance) 88cdf0e10cSrcweir { 89cdf0e10cSrcweir const SwColumns& rCols = rCol.GetColumns(); 90cdf0e10cSrcweir sal_uInt16 nWidth = 0; 91cdf0e10cSrcweir 92cdf0e10cSrcweir sal_Bool bOrtho = rCol.IsOrtho() && rCols.Count(); 93cdf0e10cSrcweir long nInnerWidth = 0; 94cdf0e10cSrcweir if( bOrtho ) 95cdf0e10cSrcweir { 96cdf0e10cSrcweir nInnerWidth = nTotalWidth; 97cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < rCols.Count(); ++i ) 98cdf0e10cSrcweir { 99cdf0e10cSrcweir SwColumn* pCol = rCols[i]; 100cdf0e10cSrcweir nInnerWidth -= pCol->GetLeft() + pCol->GetRight(); 101cdf0e10cSrcweir } 102cdf0e10cSrcweir if( nInnerWidth < 0 ) 103cdf0e10cSrcweir nInnerWidth = 0; 104cdf0e10cSrcweir else 105cdf0e10cSrcweir nInnerWidth /= rCols.Count(); 106cdf0e10cSrcweir } 107cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < rCols.Count(); ++i ) 108cdf0e10cSrcweir { 109cdf0e10cSrcweir SwColumn* pCol = rCols[i]; 110cdf0e10cSrcweir const sal_uInt16 nStart = sal_uInt16(pCol->GetLeft() + nWidth + nDistance); 111cdf0e10cSrcweir if( bOrtho ) 112cdf0e10cSrcweir nWidth = static_cast< sal_uInt16 >(nWidth + nInnerWidth + pCol->GetLeft() + pCol->GetRight()); 113cdf0e10cSrcweir else 114cdf0e10cSrcweir nWidth = static_cast< sal_uInt16 >(nWidth + rCol.CalcColWidth(i, nTotalWidth)); 115cdf0e10cSrcweir const sal_uInt16 nEnd = sal_uInt16(nWidth - pCol->GetRight() + nDistance); 116cdf0e10cSrcweir 117cdf0e10cSrcweir SvxColumnDescription aColDesc(nStart, nEnd, sal_True); 118cdf0e10cSrcweir rColItem.Append(aColDesc); 119cdf0e10cSrcweir } 120cdf0e10cSrcweir } 121cdf0e10cSrcweir 122cdf0e10cSrcweir /*-------------------------------------------------------------------- 123cdf0e10cSrcweir Beschreibung: ColumnItem in ColumnInfo ueberfuehren 124cdf0e10cSrcweir --------------------------------------------------------------------*/ 125cdf0e10cSrcweir 126cdf0e10cSrcweir 127cdf0e10cSrcweir void lcl_ConvertToCols(const SvxColumnItem& rColItem, 128cdf0e10cSrcweir sal_uInt16 nTotalWidth, 129cdf0e10cSrcweir SwFmtCol& rCols) 130cdf0e10cSrcweir { 131cdf0e10cSrcweir ASSERT( rCols.GetNumCols() == rColItem.Count(), "Column count mismatch" ); 132cdf0e10cSrcweir // #126939# ruler executes that change the columns shortly after the selection has changed 133cdf0e10cSrcweir // can result in a crash 134cdf0e10cSrcweir if(rCols.GetNumCols() != rColItem.Count()) 135cdf0e10cSrcweir return; 136cdf0e10cSrcweir 137cdf0e10cSrcweir sal_uInt16 nLeft = 0; 138cdf0e10cSrcweir SwTwips nSumAll= 0; // Summiere alle Spalten und Raender auf 139cdf0e10cSrcweir 140cdf0e10cSrcweir SwColumns& rArr = rCols.GetColumns(); 141cdf0e10cSrcweir 142cdf0e10cSrcweir // Tabcols der Reihe nach 143cdf0e10cSrcweir for( sal_uInt16 i=0; i < rColItem.Count()-1; ++i ) 144cdf0e10cSrcweir { 145cdf0e10cSrcweir DBG_ASSERT(rColItem[i+1].nStart >= rColItem[i].nEnd,"\201berlappende Spalten" ); 146cdf0e10cSrcweir sal_uInt16 nStart = static_cast< sal_uInt16 >(rColItem[i+1].nStart); 147cdf0e10cSrcweir sal_uInt16 nEnd = static_cast< sal_uInt16 >(rColItem[i].nEnd); 148cdf0e10cSrcweir if(nStart < nEnd) 149cdf0e10cSrcweir nStart = nEnd; 150cdf0e10cSrcweir const sal_uInt16 nDiff = nStart - nEnd; 151cdf0e10cSrcweir const sal_uInt16 nRight = nDiff / 2; 152cdf0e10cSrcweir 153cdf0e10cSrcweir sal_uInt16 nWidth = static_cast< sal_uInt16 >(rColItem[i].nEnd - rColItem[i].nStart); 154cdf0e10cSrcweir nWidth += nLeft + nRight; 155cdf0e10cSrcweir 156cdf0e10cSrcweir SwColumn* pCol = rArr[i]; 157cdf0e10cSrcweir pCol->SetWishWidth( sal_uInt16(long(rCols.GetWishWidth()) * long(nWidth) / 158cdf0e10cSrcweir long(nTotalWidth) )); 159cdf0e10cSrcweir pCol->SetLeft( nLeft ); 160cdf0e10cSrcweir pCol->SetRight( nRight ); 161cdf0e10cSrcweir nSumAll += pCol->GetWishWidth(); 162cdf0e10cSrcweir 163cdf0e10cSrcweir nLeft = nRight; 164cdf0e10cSrcweir } 165cdf0e10cSrcweir rArr[rColItem.Count()-1]->SetLeft( nLeft ); 166cdf0e10cSrcweir 167cdf0e10cSrcweir //Die Differenz aus der Gesamtwunschbreite und der Summe der bisher berechneten 168cdf0e10cSrcweir // Spalten und Raender sollte die Breite der letzten Spalte ergeben. 169cdf0e10cSrcweir rArr[rColItem.Count()-1]->SetWishWidth( rCols.GetWishWidth() - (sal_uInt16)nSumAll ); 170cdf0e10cSrcweir 171cdf0e10cSrcweir rCols.SetOrtho(sal_False, 0, 0 ); 172cdf0e10cSrcweir } 173cdf0e10cSrcweir 174cdf0e10cSrcweir /*-------------------------------------------------------------------- 175cdf0e10cSrcweir Beschreibung: Tabs loeschen 176cdf0e10cSrcweir --------------------------------------------------------------------*/ 177cdf0e10cSrcweir 178cdf0e10cSrcweir 179cdf0e10cSrcweir void lcl_EraseDefTabs(SvxTabStopItem& rTabStops) 180cdf0e10cSrcweir { 181cdf0e10cSrcweir // Def Tabs loeschen 182cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < rTabStops.Count(); ) 183cdf0e10cSrcweir { 184cdf0e10cSrcweir // Hier auch den DefTab auf Null rausschmeissen 185cdf0e10cSrcweir if ( SVX_TAB_ADJUST_DEFAULT == rTabStops[i].GetAdjustment() || 186cdf0e10cSrcweir rTabStops[i].GetTabPos() == 0 ) 187cdf0e10cSrcweir { 188cdf0e10cSrcweir rTabStops.Remove(i); 189cdf0e10cSrcweir continue; 190cdf0e10cSrcweir } 191cdf0e10cSrcweir ++i; 192cdf0e10cSrcweir } 193cdf0e10cSrcweir } 194cdf0e10cSrcweir 195cdf0e10cSrcweir /*-------------------------------------------------------------------- 196cdf0e10cSrcweir Beschreibung: Seitenrand umdrehen 197cdf0e10cSrcweir --------------------------------------------------------------------*/ 198cdf0e10cSrcweir 199cdf0e10cSrcweir 200cdf0e10cSrcweir void SwView::SwapPageMargin(const SwPageDesc& rDesc, SvxLRSpaceItem& rLRSpace) 201cdf0e10cSrcweir { 2028a2dd8f0SOliver-Rainer Wittmann sal_uInt16 nPhyPage, nVirPage; 2038a2dd8f0SOliver-Rainer Wittmann GetWrtShell().GetPageNum( nPhyPage, nVirPage ); 204cdf0e10cSrcweir 2058a2dd8f0SOliver-Rainer Wittmann if ( rDesc.GetUseOn() == nsUseOnPage::PD_MIRROR && (nPhyPage % 2) == 0 ) 2068a2dd8f0SOliver-Rainer Wittmann { 207cdf0e10cSrcweir long nTmp = rLRSpace.GetRight(); 2088a2dd8f0SOliver-Rainer Wittmann rLRSpace.SetRight( rLRSpace.GetLeft() ); 2098a2dd8f0SOliver-Rainer Wittmann rLRSpace.SetLeft( nTmp ); 2108a2dd8f0SOliver-Rainer Wittmann } 211cdf0e10cSrcweir } 212cdf0e10cSrcweir 213cdf0e10cSrcweir /*-------------------------------------------------------------------- 214cdf0e10cSrcweir Beschreibung: Wenn der Rahmenrand verschoben wird, sollen die 215cdf0e10cSrcweir Spaltentrenner an der gleichen absoluten Position bleiben 216cdf0e10cSrcweir --------------------------------------------------------------------*/ 217cdf0e10cSrcweir 218cdf0e10cSrcweir 219cdf0e10cSrcweir void lcl_Scale(long& nVal, long nScale) 220cdf0e10cSrcweir { 221cdf0e10cSrcweir nVal *= nScale; 222cdf0e10cSrcweir nVal >>= 8; 223cdf0e10cSrcweir } 224cdf0e10cSrcweir 225cdf0e10cSrcweir void ResizeFrameCols(SwFmtCol& rCol, 226cdf0e10cSrcweir long nOldWidth, 227cdf0e10cSrcweir long nNewWidth, 228cdf0e10cSrcweir long nLeftDelta ) 229cdf0e10cSrcweir { 230cdf0e10cSrcweir SwColumns& rArr = rCol.GetColumns(); 231cdf0e10cSrcweir long nWishSum = (long)rCol.GetWishWidth(); 232cdf0e10cSrcweir long nWishDiff = (nWishSum * 100/nOldWidth * nNewWidth) / 100 - nWishSum; 233cdf0e10cSrcweir long nNewWishWidth = nWishSum + nWishDiff; 234cdf0e10cSrcweir if(nNewWishWidth > 0xffffl) 235cdf0e10cSrcweir { 236cdf0e10cSrcweir // wenn die Wunschbreite zu gross wird, dann muessen alle Werte passend skaliert werden 237cdf0e10cSrcweir long nScale = (0xffffl << 8)/ nNewWishWidth; 238cdf0e10cSrcweir for(sal_uInt16 i = 0; i < rArr.Count(); i++) 239cdf0e10cSrcweir { 240cdf0e10cSrcweir SwColumn* pCol = rArr.GetObject(i); 241cdf0e10cSrcweir long nVal = pCol->GetWishWidth(); 242cdf0e10cSrcweir lcl_Scale(nVal, nScale); 243cdf0e10cSrcweir pCol->SetWishWidth((sal_uInt16) nVal); 244cdf0e10cSrcweir nVal = pCol->GetLeft(); 245cdf0e10cSrcweir lcl_Scale(nVal, nScale); 246cdf0e10cSrcweir pCol->SetLeft((sal_uInt16) nVal); 247cdf0e10cSrcweir nVal = pCol->GetRight(); 248cdf0e10cSrcweir lcl_Scale(nVal, nScale); 249cdf0e10cSrcweir pCol->SetRight((sal_uInt16) nVal); 250cdf0e10cSrcweir } 251cdf0e10cSrcweir lcl_Scale(nNewWishWidth, nScale); 252cdf0e10cSrcweir lcl_Scale(nWishDiff, nScale); 253cdf0e10cSrcweir } 254cdf0e10cSrcweir rCol.SetWishWidth( (sal_uInt16) (nNewWishWidth) ); 255cdf0e10cSrcweir 256cdf0e10cSrcweir if( nLeftDelta >= 2 || nLeftDelta <= -2) 257cdf0e10cSrcweir rArr[0]->SetWishWidth(rArr[0]->GetWishWidth() + (sal_uInt16)nWishDiff); 258cdf0e10cSrcweir else 259cdf0e10cSrcweir rArr[rArr.Count()-1]->SetWishWidth(rArr[rArr.Count()-1]->GetWishWidth() + (sal_uInt16)nWishDiff); 260cdf0e10cSrcweir //reset auto width 261cdf0e10cSrcweir rCol.SetOrtho(sal_False, 0, 0 ); 262cdf0e10cSrcweir } 263cdf0e10cSrcweir /*-------------------------------------------------------------------- 264cdf0e10cSrcweir Beschreibung: Hier werden alle Aenderungen der Tableiste 265cdf0e10cSrcweir wieder in das Modell geschossen 266cdf0e10cSrcweir --------------------------------------------------------------------*/ 267cdf0e10cSrcweir 268cdf0e10cSrcweir 269cdf0e10cSrcweir void SwView::ExecTabWin( SfxRequest& rReq ) 270cdf0e10cSrcweir { 2718a2dd8f0SOliver-Rainer Wittmann SwWrtShell &rSh = GetWrtShell(); 2728a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nFrmType = rSh.IsObjSelected() ? 2738a2dd8f0SOliver-Rainer Wittmann FRMTYPE_DRAWOBJ : 2748a2dd8f0SOliver-Rainer Wittmann rSh.GetFrmType(0,sal_True); 2758a2dd8f0SOliver-Rainer Wittmann const sal_Bool bFrmSelection = rSh.IsFrmSelected(); 2768a2dd8f0SOliver-Rainer Wittmann const sal_Bool bBrowse = rSh.GetViewOptions()->getBrowseMode(); 277cdf0e10cSrcweir 2788a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nSlot = rReq.GetSlot(); 2798a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nDescId = rSh.GetCurPageDesc(); 2808a2dd8f0SOliver-Rainer Wittmann const SwPageDesc& rDesc = rSh.GetPageDesc( nDescId ); 281cdf0e10cSrcweir 282cdf0e10cSrcweir const sal_Bool bVerticalWriting = rSh.IsInVerticalText(); 283cdf0e10cSrcweir const SwFmtHeader& rHeaderFmt = rDesc.GetMaster().GetHeader(); 2848a2dd8f0SOliver-Rainer Wittmann SwFrmFmt *pHeaderFmt = (SwFrmFmt*)rHeaderFmt.GetHeaderFmt(); 285cdf0e10cSrcweir 2868a2dd8f0SOliver-Rainer Wittmann const SwFmtFooter& rFooterFmt = rDesc.GetMaster().GetFooter(); 2878a2dd8f0SOliver-Rainer Wittmann SwFrmFmt *pFooterFmt = (SwFrmFmt*)rFooterFmt.GetFooterFmt(); 288cdf0e10cSrcweir 2898a2dd8f0SOliver-Rainer Wittmann const SwFmtFrmSize &rFrmSize = rDesc.GetMaster().GetFrmSize(); 290cdf0e10cSrcweir 291cdf0e10cSrcweir const SwRect& rPageRect = rSh.GetAnyCurRect(RECT_PAGE); 292cdf0e10cSrcweir const long nPageWidth = bBrowse ? rPageRect.Width() : rFrmSize.GetWidth(); 293cdf0e10cSrcweir const long nPageHeight = bBrowse ? rPageRect.Height() : rFrmSize.GetHeight(); 294cdf0e10cSrcweir 2958a2dd8f0SOliver-Rainer Wittmann sal_Bool bUnlockView = sal_False; 2968a2dd8f0SOliver-Rainer Wittmann rSh.StartAllAction(); 2978a2dd8f0SOliver-Rainer Wittmann sal_Bool bSect = 0 != (nFrmType & FRMTYPE_COLSECT); 298cdf0e10cSrcweir 2998a2dd8f0SOliver-Rainer Wittmann switch( nSlot ) 3008a2dd8f0SOliver-Rainer Wittmann { 301cdf0e10cSrcweir case SID_ATTR_LONG_LRSPACE: 3028a2dd8f0SOliver-Rainer Wittmann { 3038a2dd8f0SOliver-Rainer Wittmann SvxLongLRSpaceItem aLongLR( (const SvxLongLRSpaceItem&)rReq.GetArgs()-> 3048a2dd8f0SOliver-Rainer Wittmann Get( SID_ATTR_LONG_LRSPACE ) ); 3058a2dd8f0SOliver-Rainer Wittmann SvxLRSpaceItem aLR(RES_LR_SPACE); 3068a2dd8f0SOliver-Rainer Wittmann if ( !bSect && (bFrmSelection || nFrmType & FRMTYPE_FLY_ANY) ) 307cdf0e10cSrcweir { 3088a2dd8f0SOliver-Rainer Wittmann SwFrmFmt* pFmt = ((SwFrmFmt*)rSh.GetFlyFrmFmt()); 3098a2dd8f0SOliver-Rainer Wittmann const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED); 3108a2dd8f0SOliver-Rainer Wittmann 3118a2dd8f0SOliver-Rainer Wittmann sal_Bool bVerticalFrame(sal_False); 3128a2dd8f0SOliver-Rainer Wittmann { 3138a2dd8f0SOliver-Rainer Wittmann sal_Bool bRTL; 3148a2dd8f0SOliver-Rainer Wittmann sal_Bool bVertL2R; 3158a2dd8f0SOliver-Rainer Wittmann bVerticalFrame = ( bFrmSelection && 3168a2dd8f0SOliver-Rainer Wittmann rSh.IsFrmVertical(sal_True, bRTL, bVertL2R) ) || 3178a2dd8f0SOliver-Rainer Wittmann ( !bFrmSelection && bVerticalWriting); 3188a2dd8f0SOliver-Rainer Wittmann } 3198a2dd8f0SOliver-Rainer Wittmann long nDeltaX = bVerticalFrame ? 3208a2dd8f0SOliver-Rainer Wittmann rRect.Right() - rPageRect.Right() + aLongLR.GetRight() : 3218a2dd8f0SOliver-Rainer Wittmann rPageRect.Left() + aLongLR.GetLeft() - rRect.Left(); 322cdf0e10cSrcweir 3238a2dd8f0SOliver-Rainer Wittmann SfxItemSet aSet( GetPool(), RES_FRM_SIZE, RES_FRM_SIZE, 3248a2dd8f0SOliver-Rainer Wittmann RES_VERT_ORIENT, RES_HORI_ORIENT, 3258a2dd8f0SOliver-Rainer Wittmann RES_COL, RES_COL, 0 ); 3268a2dd8f0SOliver-Rainer Wittmann 3278a2dd8f0SOliver-Rainer Wittmann if(bVerticalFrame) 3288a2dd8f0SOliver-Rainer Wittmann { 3298a2dd8f0SOliver-Rainer Wittmann SwFmtVertOrient aVertOrient(pFmt->GetVertOrient()); 3308a2dd8f0SOliver-Rainer Wittmann aVertOrient.SetVertOrient(text::VertOrientation::NONE); 3318a2dd8f0SOliver-Rainer Wittmann aVertOrient.SetPos(aVertOrient.GetPos() + nDeltaX ); 3328a2dd8f0SOliver-Rainer Wittmann aSet.Put( aVertOrient ); 3338a2dd8f0SOliver-Rainer Wittmann } 3348a2dd8f0SOliver-Rainer Wittmann else 3358a2dd8f0SOliver-Rainer Wittmann { 3368a2dd8f0SOliver-Rainer Wittmann SwFmtHoriOrient aHoriOrient( pFmt->GetHoriOrient() ); 3378a2dd8f0SOliver-Rainer Wittmann aHoriOrient.SetHoriOrient( text::HoriOrientation::NONE ); 3388a2dd8f0SOliver-Rainer Wittmann aHoriOrient.SetPos( aHoriOrient.GetPos() + nDeltaX ); 3398a2dd8f0SOliver-Rainer Wittmann aSet.Put( aHoriOrient ); 3408a2dd8f0SOliver-Rainer Wittmann } 3418a2dd8f0SOliver-Rainer Wittmann 3428a2dd8f0SOliver-Rainer Wittmann SwFmtFrmSize aSize( pFmt->GetFrmSize() ); 3438a2dd8f0SOliver-Rainer Wittmann long nOldWidth = (long) aSize.GetWidth(); 3448a2dd8f0SOliver-Rainer Wittmann 3458a2dd8f0SOliver-Rainer Wittmann if(aSize.GetWidthPercent()) 3468a2dd8f0SOliver-Rainer Wittmann { 3478a2dd8f0SOliver-Rainer Wittmann SwRect aRect; 3488a2dd8f0SOliver-Rainer Wittmann rSh.CalcBoundRect(aRect, FLY_AS_CHAR); 3498a2dd8f0SOliver-Rainer Wittmann long nPrtWidth = aRect.Width(); 3508a2dd8f0SOliver-Rainer Wittmann aSize.SetWidthPercent(sal_uInt8((nPageWidth - aLongLR.GetLeft() - aLongLR.GetRight()) * 100 /nPrtWidth)); 3518a2dd8f0SOliver-Rainer Wittmann } 3528a2dd8f0SOliver-Rainer Wittmann else 3538a2dd8f0SOliver-Rainer Wittmann aSize.SetWidth( nPageWidth - 3548a2dd8f0SOliver-Rainer Wittmann (aLongLR.GetLeft() + aLongLR.GetRight())); 3558a2dd8f0SOliver-Rainer Wittmann 3568a2dd8f0SOliver-Rainer Wittmann if( nFrmType & FRMTYPE_COLUMN ) 3578a2dd8f0SOliver-Rainer Wittmann { 3588a2dd8f0SOliver-Rainer Wittmann SwFmtCol aCol(pFmt->GetCol()); 3598a2dd8f0SOliver-Rainer Wittmann 3608a2dd8f0SOliver-Rainer Wittmann ::ResizeFrameCols(aCol, nOldWidth, (long)aSize.GetWidth(), nDeltaX ); 3618a2dd8f0SOliver-Rainer Wittmann aSet.Put(aCol); 3628a2dd8f0SOliver-Rainer Wittmann } 363cdf0e10cSrcweir 3648a2dd8f0SOliver-Rainer Wittmann aSet.Put( aSize ); 3658a2dd8f0SOliver-Rainer Wittmann 3668a2dd8f0SOliver-Rainer Wittmann rSh.StartAction(); 3678a2dd8f0SOliver-Rainer Wittmann rSh.Push(); 3688a2dd8f0SOliver-Rainer Wittmann rSh.SetFlyFrmAttr( aSet ); 3698a2dd8f0SOliver-Rainer Wittmann //die Rahmenselektion wieder aufheben 3708a2dd8f0SOliver-Rainer Wittmann if(!bFrmSelection && rSh.IsFrmSelected()) 3718a2dd8f0SOliver-Rainer Wittmann { 3728a2dd8f0SOliver-Rainer Wittmann rSh.UnSelectFrm(); 3738a2dd8f0SOliver-Rainer Wittmann rSh.LeaveSelFrmMode(); 3748a2dd8f0SOliver-Rainer Wittmann } 3758a2dd8f0SOliver-Rainer Wittmann rSh.Pop(); 3768a2dd8f0SOliver-Rainer Wittmann rSh.EndAction(); 3778a2dd8f0SOliver-Rainer Wittmann } 3788a2dd8f0SOliver-Rainer Wittmann else if ( nFrmType & ( FRMTYPE_HEADER | FRMTYPE_FOOTER )) 379cdf0e10cSrcweir { 3808a2dd8f0SOliver-Rainer Wittmann // Seitenraender rausrechnen 3818a2dd8f0SOliver-Rainer Wittmann long nOld = rDesc.GetMaster().GetLRSpace().GetLeft(); 3828a2dd8f0SOliver-Rainer Wittmann aLongLR.SetLeft( nOld > aLongLR.GetLeft() ? 0 : aLongLR.GetLeft() - nOld ); 3838a2dd8f0SOliver-Rainer Wittmann 3848a2dd8f0SOliver-Rainer Wittmann nOld = rDesc.GetMaster().GetLRSpace().GetRight(); 3858a2dd8f0SOliver-Rainer Wittmann aLongLR.SetRight( nOld > (sal_uInt16)aLongLR.GetRight() ? 0 : aLongLR.GetRight() - nOld ); 3868a2dd8f0SOliver-Rainer Wittmann aLR.SetLeft((sal_uInt16)aLongLR.GetLeft()); 3878a2dd8f0SOliver-Rainer Wittmann aLR.SetRight((sal_uInt16)aLongLR.GetRight()); 3888a2dd8f0SOliver-Rainer Wittmann 3898a2dd8f0SOliver-Rainer Wittmann if ( nFrmType & FRMTYPE_HEADER && pHeaderFmt ) 3908a2dd8f0SOliver-Rainer Wittmann pHeaderFmt->SetFmtAttr( aLR ); 3918a2dd8f0SOliver-Rainer Wittmann else if( nFrmType & FRMTYPE_FOOTER && pFooterFmt ) 3928a2dd8f0SOliver-Rainer Wittmann pFooterFmt->SetFmtAttr( aLR ); 393cdf0e10cSrcweir } 3948a2dd8f0SOliver-Rainer Wittmann else if( nFrmType == FRMTYPE_DRAWOBJ) 395cdf0e10cSrcweir { 3968a2dd8f0SOliver-Rainer Wittmann SwRect aRect( rSh.GetObjRect() ); 3978a2dd8f0SOliver-Rainer Wittmann aRect.Left( aLongLR.GetLeft() + rPageRect.Left() ); 3988a2dd8f0SOliver-Rainer Wittmann aRect.Right( rPageRect.Right() - aLongLR.GetRight()); 3998a2dd8f0SOliver-Rainer Wittmann rSh.SetObjRect( aRect ); 400cdf0e10cSrcweir } 4018a2dd8f0SOliver-Rainer Wittmann else if(bSect || rSh.IsDirectlyInSection()) 4028a2dd8f0SOliver-Rainer Wittmann { 4038a2dd8f0SOliver-Rainer Wittmann //change the section indents and the columns if available 4048a2dd8f0SOliver-Rainer Wittmann //at first determine the changes 4058a2dd8f0SOliver-Rainer Wittmann SwRect aSectRect = rSh.GetAnyCurRect(RECT_SECTION_PRT, 0); 4068a2dd8f0SOliver-Rainer Wittmann const SwRect aTmpRect = rSh.GetAnyCurRect(RECT_SECTION, 0); 4078a2dd8f0SOliver-Rainer Wittmann aSectRect.Pos() += aTmpRect.Pos(); 4088a2dd8f0SOliver-Rainer Wittmann long nLeftDiff = aLongLR.GetLeft() - (long)(aSectRect.Left() - rPageRect.Left() ); 4098a2dd8f0SOliver-Rainer Wittmann long nRightDiff = aLongLR.GetRight() - (long)( rPageRect.Right() - aSectRect.Right()); 4108a2dd8f0SOliver-Rainer Wittmann //change the LRSpaceItem of the section accordingly 4118a2dd8f0SOliver-Rainer Wittmann const SwSection* pCurrSect = rSh.GetCurrSection(); 4128a2dd8f0SOliver-Rainer Wittmann const SwSectionFmt* pSectFmt = pCurrSect->GetFmt(); 4138a2dd8f0SOliver-Rainer Wittmann SvxLRSpaceItem aLRTmp = pSectFmt->GetLRSpace(); 4148a2dd8f0SOliver-Rainer Wittmann aLRTmp.SetLeft(aLRTmp.GetLeft() + nLeftDiff); 4158a2dd8f0SOliver-Rainer Wittmann aLRTmp.SetRight(aLRTmp.GetRight() + nRightDiff); 4168a2dd8f0SOliver-Rainer Wittmann SfxItemSet aSet(rSh.GetAttrPool(), RES_LR_SPACE, RES_LR_SPACE, RES_COL, RES_COL, 0L); 4178a2dd8f0SOliver-Rainer Wittmann aSet.Put(aLRTmp); 4188a2dd8f0SOliver-Rainer Wittmann //change the first/last column 4198a2dd8f0SOliver-Rainer Wittmann if(bSect) 4208a2dd8f0SOliver-Rainer Wittmann { 4218a2dd8f0SOliver-Rainer Wittmann SwFmtCol aCols( pSectFmt->GetCol() ); 4228a2dd8f0SOliver-Rainer Wittmann long nDiffWidth = nLeftDiff + nRightDiff; 4238a2dd8f0SOliver-Rainer Wittmann ::ResizeFrameCols(aCols, aSectRect.Width(), aSectRect.Width() - nDiffWidth, nLeftDiff ); 4248a2dd8f0SOliver-Rainer Wittmann aSet.Put( aCols ); 4258a2dd8f0SOliver-Rainer Wittmann } 4268a2dd8f0SOliver-Rainer Wittmann SwSectionData aData(*pCurrSect); 4278a2dd8f0SOliver-Rainer Wittmann rSh.UpdateSection(rSh.GetSectionFmtPos(*pSectFmt), aData, &aSet); 4288a2dd8f0SOliver-Rainer Wittmann } 4298a2dd8f0SOliver-Rainer Wittmann else 4308a2dd8f0SOliver-Rainer Wittmann { // Seitenraender einstellen 4318a2dd8f0SOliver-Rainer Wittmann aLR.SetLeft((sal_uInt16)aLongLR.GetLeft()); 4328a2dd8f0SOliver-Rainer Wittmann aLR.SetRight((sal_uInt16)aLongLR.GetRight()); 4338a2dd8f0SOliver-Rainer Wittmann SwapPageMargin( rDesc, aLR ); 4348a2dd8f0SOliver-Rainer Wittmann SwPageDesc aDesc( rDesc ); 4358a2dd8f0SOliver-Rainer Wittmann aDesc.GetMaster().SetFmtAttr( aLR ); 4368a2dd8f0SOliver-Rainer Wittmann rSh.ChgPageDesc( nDescId, aDesc ); 4378a2dd8f0SOliver-Rainer Wittmann } 4388a2dd8f0SOliver-Rainer Wittmann } 4398a2dd8f0SOliver-Rainer Wittmann break; 440cdf0e10cSrcweir 4418a2dd8f0SOliver-Rainer Wittmann // apply new left and right margins to current page style 4428a2dd8f0SOliver-Rainer Wittmann case SID_ATTR_PAGE_LRSPACE: 4438a2dd8f0SOliver-Rainer Wittmann { 4448a2dd8f0SOliver-Rainer Wittmann const SvxLongLRSpaceItem aLongLR( static_cast<const SvxLongLRSpaceItem&>(rReq.GetArgs()->Get( SID_ATTR_PAGE_LRSPACE )) ); 4458a2dd8f0SOliver-Rainer Wittmann 4468a2dd8f0SOliver-Rainer Wittmann SwPageDesc aDesc( rDesc ); 4478a2dd8f0SOliver-Rainer Wittmann { 4488a2dd8f0SOliver-Rainer Wittmann SvxLRSpaceItem aLR( RES_LR_SPACE ); 4498a2dd8f0SOliver-Rainer Wittmann aLR.SetLeft((sal_uInt16)aLongLR.GetLeft()); 4508a2dd8f0SOliver-Rainer Wittmann aLR.SetRight((sal_uInt16)aLongLR.GetRight()); 4518a2dd8f0SOliver-Rainer Wittmann SwapPageMargin( rDesc, aLR ); 4528a2dd8f0SOliver-Rainer Wittmann aDesc.GetMaster().SetFmtAttr( aLR ); 4538a2dd8f0SOliver-Rainer Wittmann } 4548a2dd8f0SOliver-Rainer Wittmann rSh.ChgPageDesc( nDescId, aDesc ); 455cdf0e10cSrcweir } 4568a2dd8f0SOliver-Rainer Wittmann break; 4578a2dd8f0SOliver-Rainer Wittmann 458cdf0e10cSrcweir case SID_ATTR_LONG_ULSPACE: 4598a2dd8f0SOliver-Rainer Wittmann { 4608a2dd8f0SOliver-Rainer Wittmann SvxLongULSpaceItem aLongULSpace( (const SvxLongULSpaceItem&)rReq.GetArgs()-> 4618a2dd8f0SOliver-Rainer Wittmann Get( SID_ATTR_LONG_ULSPACE )); 462cdf0e10cSrcweir 4638a2dd8f0SOliver-Rainer Wittmann if( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY ) 464cdf0e10cSrcweir { 4658a2dd8f0SOliver-Rainer Wittmann SwFrmFmt* pFmt = ((SwFrmFmt*)rSh.GetFlyFrmFmt()); 4668a2dd8f0SOliver-Rainer Wittmann const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED); 4678a2dd8f0SOliver-Rainer Wittmann const long nDeltaY = rPageRect.Top() + aLongULSpace.GetUpper() - rRect.Top(); 4688a2dd8f0SOliver-Rainer Wittmann const long nHeight = nPageHeight - (aLongULSpace.GetUpper() + aLongULSpace.GetLower()); 4698a2dd8f0SOliver-Rainer Wittmann 4708a2dd8f0SOliver-Rainer Wittmann SfxItemSet aSet( GetPool(), RES_FRM_SIZE, RES_FRM_SIZE, 4718a2dd8f0SOliver-Rainer Wittmann RES_VERT_ORIENT, RES_HORI_ORIENT, 0 ); 4728a2dd8f0SOliver-Rainer Wittmann //which of the orientation attributes is to be put depends on the frame's environment 4738a2dd8f0SOliver-Rainer Wittmann sal_Bool bRTL; 4748a2dd8f0SOliver-Rainer Wittmann sal_Bool bVertL2R; 4758a2dd8f0SOliver-Rainer Wittmann if ( ( bFrmSelection && 4768a2dd8f0SOliver-Rainer Wittmann rSh.IsFrmVertical(sal_True, bRTL, bVertL2R ) ) || 4778a2dd8f0SOliver-Rainer Wittmann ( !bFrmSelection && bVerticalWriting ) ) 4788a2dd8f0SOliver-Rainer Wittmann { 4798a2dd8f0SOliver-Rainer Wittmann SwFmtHoriOrient aHoriOrient(pFmt->GetHoriOrient()); 4808a2dd8f0SOliver-Rainer Wittmann aHoriOrient.SetHoriOrient(text::HoriOrientation::NONE); 4818a2dd8f0SOliver-Rainer Wittmann aHoriOrient.SetPos(aHoriOrient.GetPos() + nDeltaY ); 4828a2dd8f0SOliver-Rainer Wittmann aSet.Put( aHoriOrient ); 4838a2dd8f0SOliver-Rainer Wittmann } 4848a2dd8f0SOliver-Rainer Wittmann else 4858a2dd8f0SOliver-Rainer Wittmann { 4868a2dd8f0SOliver-Rainer Wittmann SwFmtVertOrient aVertOrient(pFmt->GetVertOrient()); 4878a2dd8f0SOliver-Rainer Wittmann aVertOrient.SetVertOrient(text::VertOrientation::NONE); 4888a2dd8f0SOliver-Rainer Wittmann aVertOrient.SetPos(aVertOrient.GetPos() + nDeltaY ); 4898a2dd8f0SOliver-Rainer Wittmann aSet.Put( aVertOrient ); 4908a2dd8f0SOliver-Rainer Wittmann } 4918a2dd8f0SOliver-Rainer Wittmann SwFmtFrmSize aSize(pFmt->GetFrmSize()); 4928a2dd8f0SOliver-Rainer Wittmann if(aSize.GetHeightPercent()) 4938a2dd8f0SOliver-Rainer Wittmann { 4948a2dd8f0SOliver-Rainer Wittmann SwRect aRect; 4958a2dd8f0SOliver-Rainer Wittmann rSh.CalcBoundRect(aRect, FLY_AS_CHAR); 4968a2dd8f0SOliver-Rainer Wittmann long nPrtHeight = aRect.Height(); 4978a2dd8f0SOliver-Rainer Wittmann aSize.SetHeightPercent(sal_uInt8(nHeight * 100 /nPrtHeight)); 4988a2dd8f0SOliver-Rainer Wittmann } 4998a2dd8f0SOliver-Rainer Wittmann else 5008a2dd8f0SOliver-Rainer Wittmann aSize.SetHeight(nHeight ); 5018a2dd8f0SOliver-Rainer Wittmann 5028a2dd8f0SOliver-Rainer Wittmann aSet.Put( aSize ); 5038a2dd8f0SOliver-Rainer Wittmann rSh.SetFlyFrmAttr( aSet ); 504cdf0e10cSrcweir } 5058a2dd8f0SOliver-Rainer Wittmann else if( nFrmType == FRMTYPE_DRAWOBJ ) 506cdf0e10cSrcweir { 5078a2dd8f0SOliver-Rainer Wittmann SwRect aRect( rSh.GetObjRect() ); 5088a2dd8f0SOliver-Rainer Wittmann aRect.Top( aLongULSpace.GetUpper() + rPageRect.Top() ); 5098a2dd8f0SOliver-Rainer Wittmann aRect.Bottom( rPageRect.Bottom() - aLongULSpace.GetLower() ); 5108a2dd8f0SOliver-Rainer Wittmann rSh.SetObjRect( aRect ) ; 511cdf0e10cSrcweir } 5128a2dd8f0SOliver-Rainer Wittmann else if(bVerticalWriting && (bSect || rSh.IsDirectlyInSection())) 5138a2dd8f0SOliver-Rainer Wittmann { 5148a2dd8f0SOliver-Rainer Wittmann //change the section indents and the columns if available 5158a2dd8f0SOliver-Rainer Wittmann //at first determine the changes 5168a2dd8f0SOliver-Rainer Wittmann SwRect aSectRect = rSh.GetAnyCurRect(RECT_SECTION_PRT, 0); 5178a2dd8f0SOliver-Rainer Wittmann const SwRect aTmpRect = rSh.GetAnyCurRect(RECT_SECTION, 0); 5188a2dd8f0SOliver-Rainer Wittmann aSectRect.Pos() += aTmpRect.Pos(); 5198a2dd8f0SOliver-Rainer Wittmann const long nLeftDiff = aLongULSpace.GetUpper() - (long)(aSectRect.Top() - rPageRect.Top()); 5208a2dd8f0SOliver-Rainer Wittmann const long nRightDiff = aLongULSpace.GetLower() - (long)(nPageHeight - aSectRect.Bottom() + rPageRect.Top()); 5218a2dd8f0SOliver-Rainer Wittmann //change the LRSpaceItem of the section accordingly 5228a2dd8f0SOliver-Rainer Wittmann const SwSection* pCurrSect = rSh.GetCurrSection(); 5238a2dd8f0SOliver-Rainer Wittmann const SwSectionFmt* pSectFmt = pCurrSect->GetFmt(); 5248a2dd8f0SOliver-Rainer Wittmann SvxLRSpaceItem aLR = pSectFmt->GetLRSpace(); 5258a2dd8f0SOliver-Rainer Wittmann aLR.SetLeft(aLR.GetLeft() + nLeftDiff); 5268a2dd8f0SOliver-Rainer Wittmann aLR.SetRight(aLR.GetRight() + nRightDiff); 5278a2dd8f0SOliver-Rainer Wittmann SfxItemSet aSet(rSh.GetAttrPool(), RES_LR_SPACE, RES_LR_SPACE, RES_COL, RES_COL, 0L); 5288a2dd8f0SOliver-Rainer Wittmann aSet.Put(aLR); 5298a2dd8f0SOliver-Rainer Wittmann //change the first/last column 5308a2dd8f0SOliver-Rainer Wittmann if(bSect) 5318a2dd8f0SOliver-Rainer Wittmann { 5328a2dd8f0SOliver-Rainer Wittmann SwFmtCol aCols( pSectFmt->GetCol() ); 5338a2dd8f0SOliver-Rainer Wittmann long nDiffWidth = nLeftDiff + nRightDiff; 5348a2dd8f0SOliver-Rainer Wittmann ::ResizeFrameCols(aCols, aSectRect.Height(), aSectRect.Height() - nDiffWidth, nLeftDiff ); 5358a2dd8f0SOliver-Rainer Wittmann aSet.Put( aCols ); 5368a2dd8f0SOliver-Rainer Wittmann } 5378a2dd8f0SOliver-Rainer Wittmann SwSectionData aData(*pCurrSect); 5388a2dd8f0SOliver-Rainer Wittmann rSh.UpdateSection(rSh.GetSectionFmtPos(*pSectFmt), aData, &aSet); 5398a2dd8f0SOliver-Rainer Wittmann } 5408a2dd8f0SOliver-Rainer Wittmann else 5418a2dd8f0SOliver-Rainer Wittmann { SwPageDesc aDesc( rDesc ); 5428a2dd8f0SOliver-Rainer Wittmann 5438a2dd8f0SOliver-Rainer Wittmann if ( nFrmType & ( FRMTYPE_HEADER | FRMTYPE_FOOTER )) 5448a2dd8f0SOliver-Rainer Wittmann { 5458a2dd8f0SOliver-Rainer Wittmann 5468a2dd8f0SOliver-Rainer Wittmann const sal_Bool bHead = nFrmType & FRMTYPE_HEADER ? sal_True : sal_False; 5478a2dd8f0SOliver-Rainer Wittmann SvxULSpaceItem aUL( rDesc.GetMaster().GetULSpace() ); 5488a2dd8f0SOliver-Rainer Wittmann if ( bHead ) 5498a2dd8f0SOliver-Rainer Wittmann aUL.SetUpper( (sal_uInt16)aLongULSpace.GetUpper() ); 5508a2dd8f0SOliver-Rainer Wittmann else 5518a2dd8f0SOliver-Rainer Wittmann aUL.SetLower( (sal_uInt16)aLongULSpace.GetLower() ); 552cdf0e10cSrcweir aDesc.GetMaster().SetFmtAttr( aUL ); 553cdf0e10cSrcweir 5548a2dd8f0SOliver-Rainer Wittmann if( (bHead && pHeaderFmt) || (!bHead && pFooterFmt) ) 555cdf0e10cSrcweir { 556cdf0e10cSrcweir SwFmtFrmSize aSz( bHead ? pHeaderFmt->GetFrmSize() : 5578a2dd8f0SOliver-Rainer Wittmann pFooterFmt->GetFrmSize() ); 558cdf0e10cSrcweir aSz.SetHeightSizeType( ATT_FIX_SIZE ); 5598a2dd8f0SOliver-Rainer Wittmann aSz.SetHeight(nPageHeight - aLongULSpace.GetLower() - 5608a2dd8f0SOliver-Rainer Wittmann aLongULSpace.GetUpper() ); 5618a2dd8f0SOliver-Rainer Wittmann if ( bHead ) 562cdf0e10cSrcweir pHeaderFmt->SetFmtAttr( aSz ); 5638a2dd8f0SOliver-Rainer Wittmann else 564cdf0e10cSrcweir pFooterFmt->SetFmtAttr( aSz ); 565cdf0e10cSrcweir } 5668a2dd8f0SOliver-Rainer Wittmann } 5678a2dd8f0SOliver-Rainer Wittmann else 5688a2dd8f0SOliver-Rainer Wittmann { 569cdf0e10cSrcweir SvxULSpaceItem aUL(RES_UL_SPACE); 5708a2dd8f0SOliver-Rainer Wittmann aUL.SetUpper((sal_uInt16)aLongULSpace.GetUpper()); 5718a2dd8f0SOliver-Rainer Wittmann aUL.SetLower((sal_uInt16)aLongULSpace.GetLower()); 572cdf0e10cSrcweir aDesc.GetMaster().SetFmtAttr(aUL); 5738a2dd8f0SOliver-Rainer Wittmann } 574cdf0e10cSrcweir 5758a2dd8f0SOliver-Rainer Wittmann rSh.ChgPageDesc( nDescId, aDesc ); 5768a2dd8f0SOliver-Rainer Wittmann } 577ff0525f2SOliver-Rainer Wittmann } 5788a2dd8f0SOliver-Rainer Wittmann break; 5798a2dd8f0SOliver-Rainer Wittmann 5808a2dd8f0SOliver-Rainer Wittmann // apply new top and bottom margins to current page style 5818a2dd8f0SOliver-Rainer Wittmann case SID_ATTR_PAGE_ULSPACE: 582ff0525f2SOliver-Rainer Wittmann { 5838a2dd8f0SOliver-Rainer Wittmann SvxLongULSpaceItem aLongULSpace( 5848a2dd8f0SOliver-Rainer Wittmann static_cast<const SvxLongULSpaceItem&>(rReq.GetArgs()->Get( SID_ATTR_PAGE_ULSPACE ) ) ); 5858a2dd8f0SOliver-Rainer Wittmann 5868a2dd8f0SOliver-Rainer Wittmann SwPageDesc aDesc( rDesc ); 5878a2dd8f0SOliver-Rainer Wittmann { 5888a2dd8f0SOliver-Rainer Wittmann SvxULSpaceItem aUL(RES_UL_SPACE); 5898a2dd8f0SOliver-Rainer Wittmann aUL.SetUpper((sal_uInt16)aLongULSpace.GetUpper()); 5908a2dd8f0SOliver-Rainer Wittmann aUL.SetLower((sal_uInt16)aLongULSpace.GetLower()); 5918a2dd8f0SOliver-Rainer Wittmann aDesc.GetMaster().SetFmtAttr(aUL); 5928a2dd8f0SOliver-Rainer Wittmann } 5938a2dd8f0SOliver-Rainer Wittmann rSh.ChgPageDesc( nDescId, aDesc ); 594ff0525f2SOliver-Rainer Wittmann } 5958a2dd8f0SOliver-Rainer Wittmann break; 5968a2dd8f0SOliver-Rainer Wittmann 5978a2dd8f0SOliver-Rainer Wittmann case SID_ATTR_PAGE_COLUMN: 5988a2dd8f0SOliver-Rainer Wittmann { 5998a2dd8f0SOliver-Rainer Wittmann const SfxInt16Item aColumnItem( (const SfxInt16Item&)rReq.GetArgs()->Get(nSlot) ); 6008a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nPageColumnType = aColumnItem.GetValue(); 6018a2dd8f0SOliver-Rainer Wittmann 6028a2dd8f0SOliver-Rainer Wittmann // nPageColumnType = 6038a2dd8f0SOliver-Rainer Wittmann // 1 - single-columned page 6048a2dd8f0SOliver-Rainer Wittmann // 2 - two-columned page 6058a2dd8f0SOliver-Rainer Wittmann // 3 - three-columned page 6068a2dd8f0SOliver-Rainer Wittmann // 4 - two-columned page with left column width of 2/3 of page width 6078a2dd8f0SOliver-Rainer Wittmann // 5 - two-columned page with right column width of 2/3 of page width 6088a2dd8f0SOliver-Rainer Wittmann 6098a2dd8f0SOliver-Rainer Wittmann sal_uInt16 nCount = 2; 6108a2dd8f0SOliver-Rainer Wittmann if ( nPageColumnType == 1 ) 6118a2dd8f0SOliver-Rainer Wittmann { 6128a2dd8f0SOliver-Rainer Wittmann nCount = 0; 6138a2dd8f0SOliver-Rainer Wittmann } 6148a2dd8f0SOliver-Rainer Wittmann else if ( nPageColumnType == 3 ) 6158a2dd8f0SOliver-Rainer Wittmann { 6168a2dd8f0SOliver-Rainer Wittmann nCount = 3; 6178a2dd8f0SOliver-Rainer Wittmann } 618ff0525f2SOliver-Rainer Wittmann 6198a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nGutterWidth = 0; 620ff0525f2SOliver-Rainer Wittmann 6218a2dd8f0SOliver-Rainer Wittmann const SvxLRSpaceItem aLR( rDesc.GetMaster().GetLRSpace() ); 6228a2dd8f0SOliver-Rainer Wittmann const long nLeft = aLR.GetLeft(); 6238a2dd8f0SOliver-Rainer Wittmann const long nRight = aLR.GetRight(); 6248a2dd8f0SOliver-Rainer Wittmann const long nWidth = nPageWidth - nLeft - nRight; 625ff0525f2SOliver-Rainer Wittmann 6268a2dd8f0SOliver-Rainer Wittmann SwFmtCol aCols( rDesc.GetMaster().GetCol() ); 6278a2dd8f0SOliver-Rainer Wittmann aCols.Init( nCount, nGutterWidth, nWidth ); 6288a2dd8f0SOliver-Rainer Wittmann aCols.SetWishWidth( nWidth ); 6298a2dd8f0SOliver-Rainer Wittmann aCols.SetGutterWidth( nGutterWidth, nWidth ); 6308a2dd8f0SOliver-Rainer Wittmann aCols.SetOrtho( sal_False, nGutterWidth, nWidth ); 631ff0525f2SOliver-Rainer Wittmann 6328a2dd8f0SOliver-Rainer Wittmann long nColumnLeft = 0; 6338a2dd8f0SOliver-Rainer Wittmann long nColumnRight = 0; 6348a2dd8f0SOliver-Rainer Wittmann if ( nPageColumnType == 4 ) 6358a2dd8f0SOliver-Rainer Wittmann { 6368a2dd8f0SOliver-Rainer Wittmann nColumnRight = (long)(nWidth/3); 6378a2dd8f0SOliver-Rainer Wittmann nColumnLeft = nWidth - nColumnRight; 6388a2dd8f0SOliver-Rainer Wittmann aCols.GetColumns()[0]->SetWishWidth( nColumnLeft ); 6398a2dd8f0SOliver-Rainer Wittmann aCols.GetColumns()[1]->SetWishWidth( nColumnRight ); 6408a2dd8f0SOliver-Rainer Wittmann } 6418a2dd8f0SOliver-Rainer Wittmann else if ( nPageColumnType == 5 ) 6428a2dd8f0SOliver-Rainer Wittmann { 6438a2dd8f0SOliver-Rainer Wittmann nColumnLeft = (long)(nWidth/3); 6448a2dd8f0SOliver-Rainer Wittmann nColumnRight = nWidth - nColumnLeft; 6458a2dd8f0SOliver-Rainer Wittmann aCols.GetColumns()[0]->SetWishWidth( nColumnLeft ); 6468a2dd8f0SOliver-Rainer Wittmann aCols.GetColumns()[1]->SetWishWidth( nColumnRight ); 6478a2dd8f0SOliver-Rainer Wittmann } 6488a2dd8f0SOliver-Rainer Wittmann 6498a2dd8f0SOliver-Rainer Wittmann SwPageDesc aDesc( rDesc ); 6508a2dd8f0SOliver-Rainer Wittmann aDesc.GetMaster().SetFmtAttr( aCols ); 6518a2dd8f0SOliver-Rainer Wittmann rSh.ChgPageDesc( rSh.GetCurPageDesc(), aDesc ); 652ff0525f2SOliver-Rainer Wittmann } 6538a2dd8f0SOliver-Rainer Wittmann break; 654ff0525f2SOliver-Rainer Wittmann 655cdf0e10cSrcweir case SID_ATTR_TABSTOP_VERTICAL: 656cdf0e10cSrcweir case SID_ATTR_TABSTOP: 6578a2dd8f0SOliver-Rainer Wittmann { 6588a2dd8f0SOliver-Rainer Wittmann sal_uInt16 nWhich = GetPool().GetWhich(nSlot); 6598a2dd8f0SOliver-Rainer Wittmann SvxTabStopItem aTabStops( (const SvxTabStopItem&)rReq.GetArgs()-> 6608a2dd8f0SOliver-Rainer Wittmann Get( nWhich )); 6618a2dd8f0SOliver-Rainer Wittmann aTabStops.SetWhich(RES_PARATR_TABSTOP); 6628a2dd8f0SOliver-Rainer Wittmann const SvxTabStopItem& rDefTabs = 6638a2dd8f0SOliver-Rainer Wittmann (const SvxTabStopItem&)rSh.GetDefault(RES_PARATR_TABSTOP); 6648a2dd8f0SOliver-Rainer Wittmann 6658a2dd8f0SOliver-Rainer Wittmann // Default-Tab an Pos 0 6668a2dd8f0SOliver-Rainer Wittmann SfxItemSet aSet( GetPool(), RES_LR_SPACE, RES_LR_SPACE ); 6678a2dd8f0SOliver-Rainer Wittmann rSh.GetCurAttr( aSet ); 6688a2dd8f0SOliver-Rainer Wittmann const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&)aSet.Get(RES_LR_SPACE); 669cdf0e10cSrcweir 6708a2dd8f0SOliver-Rainer Wittmann if ( rLR.GetTxtFirstLineOfst() < 0 ) 6718a2dd8f0SOliver-Rainer Wittmann { 6728a2dd8f0SOliver-Rainer Wittmann SvxTabStop aSwTabStop( 0, SVX_TAB_ADJUST_DEFAULT ); 6738a2dd8f0SOliver-Rainer Wittmann aTabStops.Insert( aSwTabStop ); 6748a2dd8f0SOliver-Rainer Wittmann } 6758a2dd8f0SOliver-Rainer Wittmann 6768a2dd8f0SOliver-Rainer Wittmann // auffuellen mit Default-Tabs 6778a2dd8f0SOliver-Rainer Wittmann sal_uInt16 nDef = ::GetTabDist( rDefTabs ); 6788a2dd8f0SOliver-Rainer Wittmann ::MakeDefTabs( nDef, aTabStops ); 6798a2dd8f0SOliver-Rainer Wittmann 6808a2dd8f0SOliver-Rainer Wittmann SwTxtFmtColl* pColl = rSh.GetCurTxtFmtColl(); 6818a2dd8f0SOliver-Rainer Wittmann if( pColl && pColl->IsAutoUpdateFmt() ) 6828a2dd8f0SOliver-Rainer Wittmann { 6838a2dd8f0SOliver-Rainer Wittmann SfxItemSet aTmp(GetPool(), RES_PARATR_TABSTOP, RES_PARATR_TABSTOP); 6848a2dd8f0SOliver-Rainer Wittmann aTmp.Put(aTabStops); 6858a2dd8f0SOliver-Rainer Wittmann rSh.AutoUpdatePara( pColl, aTmp ); 6868a2dd8f0SOliver-Rainer Wittmann } 6878a2dd8f0SOliver-Rainer Wittmann else 6888a2dd8f0SOliver-Rainer Wittmann rSh.SetAttr( aTabStops ); 6898a2dd8f0SOliver-Rainer Wittmann break; 6908a2dd8f0SOliver-Rainer Wittmann } 691cdf0e10cSrcweir 692cdf0e10cSrcweir case SID_ATTR_PARA_LRSPACE_VERTICAL: 693cdf0e10cSrcweir case SID_ATTR_PARA_LRSPACE: 6948a2dd8f0SOliver-Rainer Wittmann { 6958a2dd8f0SOliver-Rainer Wittmann SvxLRSpaceItem aParaMargin((const SvxLRSpaceItem&)rReq. 6968a2dd8f0SOliver-Rainer Wittmann GetArgs()->Get(nSlot)); 6978a2dd8f0SOliver-Rainer Wittmann if(nFrmType & FRMTYPE_FLY_ANY) 698cdf0e10cSrcweir { 6998a2dd8f0SOliver-Rainer Wittmann sal_Bool bFirstColumn = sal_True; 7008a2dd8f0SOliver-Rainer Wittmann sal_Bool bLastColumn = sal_True; 7018a2dd8f0SOliver-Rainer Wittmann if(nFrmType & FRMTYPE_COLUMN) 7028a2dd8f0SOliver-Rainer Wittmann { 7038a2dd8f0SOliver-Rainer Wittmann sal_uInt16 nCurFrameCol = rSh.GetCurColNum() - 1; 7048a2dd8f0SOliver-Rainer Wittmann bFirstColumn = !nCurFrameCol; 7058a2dd8f0SOliver-Rainer Wittmann const SwFrmFmt* pFmt = rSh.GetFlyFrmFmt(); 7068a2dd8f0SOliver-Rainer Wittmann const SwFmtCol* pCols = &pFmt->GetCol(); 7078a2dd8f0SOliver-Rainer Wittmann const SwColumns& rCols = pCols->GetColumns(); 7088a2dd8f0SOliver-Rainer Wittmann sal_uInt16 nColumnCount = rCols.Count(); 7098a2dd8f0SOliver-Rainer Wittmann bLastColumn = nColumnCount == nCurFrameCol + 1; 7108a2dd8f0SOliver-Rainer Wittmann } 711cdf0e10cSrcweir } 7128a2dd8f0SOliver-Rainer Wittmann aParaMargin.SetRight( aParaMargin.GetRight() - nRightBorderDistance ); 7138a2dd8f0SOliver-Rainer Wittmann aParaMargin.SetTxtLeft(aParaMargin.GetTxtLeft() - nLeftBorderDistance ); 714cdf0e10cSrcweir 7158a2dd8f0SOliver-Rainer Wittmann aParaMargin.SetWhich( RES_LR_SPACE ); 7168a2dd8f0SOliver-Rainer Wittmann SwTxtFmtColl* pColl = rSh.GetCurTxtFmtColl(); 717cdf0e10cSrcweir 7188a2dd8f0SOliver-Rainer Wittmann // #i23726# 7198a2dd8f0SOliver-Rainer Wittmann if (pNumRuleNodeFromDoc) 7208a2dd8f0SOliver-Rainer Wittmann { 7218a2dd8f0SOliver-Rainer Wittmann // --> FME 2005-02-22 #i42922# Mouse move of numbering label 7228a2dd8f0SOliver-Rainer Wittmann // has to consider the left indent of the paragraph 7238a2dd8f0SOliver-Rainer Wittmann SfxItemSet aSet( GetPool(), RES_LR_SPACE, RES_LR_SPACE ); 7248a2dd8f0SOliver-Rainer Wittmann rSh.GetCurAttr( aSet ); 7258a2dd8f0SOliver-Rainer Wittmann const SvxLRSpaceItem& rLR = 726cdf0e10cSrcweir static_cast<const SvxLRSpaceItem&>(aSet.Get(RES_LR_SPACE)); 7278a2dd8f0SOliver-Rainer Wittmann // <-- 7288a2dd8f0SOliver-Rainer Wittmann 7298a2dd8f0SOliver-Rainer Wittmann SwPosition aPos(*pNumRuleNodeFromDoc); 7308a2dd8f0SOliver-Rainer Wittmann // --> OD 2008-06-09 #i90078# 7318a2dd8f0SOliver-Rainer Wittmann rSh.SetIndent( static_cast< short >(aParaMargin.GetTxtLeft() - rLR.GetTxtLeft()), aPos); 7328a2dd8f0SOliver-Rainer Wittmann // <-- 7338a2dd8f0SOliver-Rainer Wittmann // --> OD 2005-02-18 #i42921# - invalidate state of indent in order 7348a2dd8f0SOliver-Rainer Wittmann // to get a ruler update. 7358a2dd8f0SOliver-Rainer Wittmann aParaMargin.SetWhich( nSlot ); 7368a2dd8f0SOliver-Rainer Wittmann GetViewFrame()->GetBindings().SetState( aParaMargin ); 7378a2dd8f0SOliver-Rainer Wittmann // <-- 7388a2dd8f0SOliver-Rainer Wittmann } 7398a2dd8f0SOliver-Rainer Wittmann else if( pColl && pColl->IsAutoUpdateFmt() ) 7408a2dd8f0SOliver-Rainer Wittmann { 7418a2dd8f0SOliver-Rainer Wittmann SfxItemSet aSet(GetPool(), RES_LR_SPACE, RES_LR_SPACE); 7428a2dd8f0SOliver-Rainer Wittmann aSet.Put(aParaMargin); 7438a2dd8f0SOliver-Rainer Wittmann rSh.AutoUpdatePara( pColl, aSet); 7448a2dd8f0SOliver-Rainer Wittmann } 7458a2dd8f0SOliver-Rainer Wittmann else 7468a2dd8f0SOliver-Rainer Wittmann rSh.SetAttr( aParaMargin ); 747cdf0e10cSrcweir 7488a2dd8f0SOliver-Rainer Wittmann if ( aParaMargin.GetTxtFirstLineOfst() < 0 ) 7498a2dd8f0SOliver-Rainer Wittmann { 7508a2dd8f0SOliver-Rainer Wittmann SfxItemSet aSet( GetPool(), RES_PARATR_TABSTOP, RES_PARATR_TABSTOP ); 7518a2dd8f0SOliver-Rainer Wittmann 7528a2dd8f0SOliver-Rainer Wittmann rSh.GetCurAttr( aSet ); 7538a2dd8f0SOliver-Rainer Wittmann const SvxTabStopItem& rTabStops = (const SvxTabStopItem&)aSet.Get(RES_PARATR_TABSTOP); 7548a2dd8f0SOliver-Rainer Wittmann 7558a2dd8f0SOliver-Rainer Wittmann // Haben wir einen Tab an Stelle Null 7568a2dd8f0SOliver-Rainer Wittmann sal_uInt16 i; 7578a2dd8f0SOliver-Rainer Wittmann 7588a2dd8f0SOliver-Rainer Wittmann for ( i = 0; i < rTabStops.Count(); ++i ) 7598a2dd8f0SOliver-Rainer Wittmann if ( rTabStops[i].GetTabPos() == 0 ) 7608a2dd8f0SOliver-Rainer Wittmann break; 7618a2dd8f0SOliver-Rainer Wittmann 7628a2dd8f0SOliver-Rainer Wittmann if ( i >= rTabStops.Count() ) 7638a2dd8f0SOliver-Rainer Wittmann { 7648a2dd8f0SOliver-Rainer Wittmann // Kein DefTab 7658a2dd8f0SOliver-Rainer Wittmann SvxTabStopItem aTabStops( RES_PARATR_TABSTOP ); 7668a2dd8f0SOliver-Rainer Wittmann aTabStops = rTabStops; 7678a2dd8f0SOliver-Rainer Wittmann 7688a2dd8f0SOliver-Rainer Wittmann ::lcl_EraseDefTabs(aTabStops); 7698a2dd8f0SOliver-Rainer Wittmann 7708a2dd8f0SOliver-Rainer Wittmann SvxTabStop aSwTabStop( 0, SVX_TAB_ADJUST_DEFAULT ); 7718a2dd8f0SOliver-Rainer Wittmann aTabStops.Insert(aSwTabStop); 7728a2dd8f0SOliver-Rainer Wittmann 7738a2dd8f0SOliver-Rainer Wittmann const SvxTabStopItem& rDefTabs = 7748a2dd8f0SOliver-Rainer Wittmann (const SvxTabStopItem&)rSh.GetDefault(RES_PARATR_TABSTOP); 7758a2dd8f0SOliver-Rainer Wittmann sal_uInt16 nDef = ::GetTabDist(rDefTabs); 7768a2dd8f0SOliver-Rainer Wittmann ::MakeDefTabs( nDef, aTabStops ); 7778a2dd8f0SOliver-Rainer Wittmann 7788a2dd8f0SOliver-Rainer Wittmann if( pColl && pColl->IsAutoUpdateFmt()) 7798a2dd8f0SOliver-Rainer Wittmann { 7808a2dd8f0SOliver-Rainer Wittmann SfxItemSet aSetTmp(GetPool(), RES_PARATR_TABSTOP, RES_PARATR_TABSTOP); 7818a2dd8f0SOliver-Rainer Wittmann aSetTmp.Put(aTabStops); 7828a2dd8f0SOliver-Rainer Wittmann rSh.AutoUpdatePara( pColl, aSetTmp ); 7838a2dd8f0SOliver-Rainer Wittmann } 7848a2dd8f0SOliver-Rainer Wittmann else 7858a2dd8f0SOliver-Rainer Wittmann rSh.SetAttr( aTabStops ); 7868a2dd8f0SOliver-Rainer Wittmann } 7878a2dd8f0SOliver-Rainer Wittmann } 7888a2dd8f0SOliver-Rainer Wittmann } 7898a2dd8f0SOliver-Rainer Wittmann break; 790cdf0e10cSrcweir 791*766ce4d0SZheng Fan case SID_ATTR_PARA_ULSPACE: 792*766ce4d0SZheng Fan { 793*766ce4d0SZheng Fan SvxULSpaceItem aParaMargin((const SvxULSpaceItem&)rReq. 794*766ce4d0SZheng Fan GetArgs()->Get(nSlot)); 795*766ce4d0SZheng Fan 796*766ce4d0SZheng Fan long nUDist = 0; 797*766ce4d0SZheng Fan long nLDist = 0; 798*766ce4d0SZheng Fan aParaMargin.SetUpper( aParaMargin.GetUpper() - nUDist ); 799*766ce4d0SZheng Fan aParaMargin.SetLower(aParaMargin.GetLower() - nLDist); 800*766ce4d0SZheng Fan 801*766ce4d0SZheng Fan aParaMargin.SetWhich( RES_UL_SPACE ); 802*766ce4d0SZheng Fan SwTxtFmtColl* pColl = rSh.GetCurTxtFmtColl(); 803*766ce4d0SZheng Fan if( pColl && pColl->IsAutoUpdateFmt() ) 804*766ce4d0SZheng Fan { 805*766ce4d0SZheng Fan SfxItemSet aSet(GetPool(), RES_UL_SPACE, RES_UL_SPACE); 806*766ce4d0SZheng Fan aSet.Put(aParaMargin); 807*766ce4d0SZheng Fan rSh.AutoUpdatePara( pColl, aSet); 808*766ce4d0SZheng Fan } 809*766ce4d0SZheng Fan else 810*766ce4d0SZheng Fan rSh.SetAttr( aParaMargin ); 811*766ce4d0SZheng Fan } 812*766ce4d0SZheng Fan break; 813*766ce4d0SZheng Fan 814cdf0e10cSrcweir case SID_RULER_BORDERS_VERTICAL: 815cdf0e10cSrcweir case SID_RULER_BORDERS: 8168a2dd8f0SOliver-Rainer Wittmann { 8178a2dd8f0SOliver-Rainer Wittmann SvxColumnItem aColItem((const SvxColumnItem&)rReq. 8188a2dd8f0SOliver-Rainer Wittmann GetArgs()->Get(nSlot)); 819cdf0e10cSrcweir 8208a2dd8f0SOliver-Rainer Wittmann if( bSetTabColFromDoc || (!bSect && rSh.GetTableFmt()) ) 8218a2dd8f0SOliver-Rainer Wittmann { 8228a2dd8f0SOliver-Rainer Wittmann ASSERT(aColItem.Count(), "ColDesc ist leer!!"); 823cdf0e10cSrcweir 8248a2dd8f0SOliver-Rainer Wittmann const sal_Bool bSingleLine = ((const SfxBoolItem&)rReq. 8258a2dd8f0SOliver-Rainer Wittmann GetArgs()->Get(SID_RULER_ACT_LINE_ONLY)).GetValue(); 826cdf0e10cSrcweir 8278a2dd8f0SOliver-Rainer Wittmann SwTabCols aTabCols; 8288a2dd8f0SOliver-Rainer Wittmann if ( bSetTabColFromDoc ) 8298a2dd8f0SOliver-Rainer Wittmann rSh.GetMouseTabCols( aTabCols, aTabColFromDocPos ); 8308a2dd8f0SOliver-Rainer Wittmann else 8318a2dd8f0SOliver-Rainer Wittmann rSh.GetTabCols(aTabCols); 832cdf0e10cSrcweir 8338a2dd8f0SOliver-Rainer Wittmann // linker Tabellenrand 8348a2dd8f0SOliver-Rainer Wittmann long nBorder = (long)(aColItem.GetLeft() - aTabCols.GetLeftMin()); 8358a2dd8f0SOliver-Rainer Wittmann aTabCols.SetLeft( nBorder ); 836cdf0e10cSrcweir 8378a2dd8f0SOliver-Rainer Wittmann nBorder = (bVerticalWriting ? nPageHeight : nPageWidth) - aTabCols.GetLeftMin() - aColItem.GetRight(); 838cdf0e10cSrcweir 839cdf0e10cSrcweir #ifdef DEBUG 8408a2dd8f0SOliver-Rainer Wittmann long nTmp1 = nPageWidth; 8418a2dd8f0SOliver-Rainer Wittmann long nTmp2 = aTabCols.GetLeftMin() + nBorder; 8428a2dd8f0SOliver-Rainer Wittmann (void)nTmp1; 8438a2dd8f0SOliver-Rainer Wittmann (void)nTmp2; 844cdf0e10cSrcweir #endif 845cdf0e10cSrcweir 8468a2dd8f0SOliver-Rainer Wittmann if ( aColItem.GetRight() > 0 ) 8478a2dd8f0SOliver-Rainer Wittmann aTabCols.SetRight( nBorder ); 848cdf0e10cSrcweir 8498a2dd8f0SOliver-Rainer Wittmann // Tabcols der Reihe nach 8508a2dd8f0SOliver-Rainer Wittmann // Die letzte Col wird durch den Rand definiert 8518a2dd8f0SOliver-Rainer Wittmann //columns in right-to-left tables need to be mirrored 8528a2dd8f0SOliver-Rainer Wittmann sal_Bool bIsTableRTL = 8538a2dd8f0SOliver-Rainer Wittmann IsTabColFromDoc() ? 8548a2dd8f0SOliver-Rainer Wittmann rSh.IsMouseTableRightToLeft(aTabColFromDocPos) 855cdf0e10cSrcweir : rSh.IsTableRightToLeft(); 8568a2dd8f0SOliver-Rainer Wittmann if(bIsTableRTL) 8578a2dd8f0SOliver-Rainer Wittmann { 8588a2dd8f0SOliver-Rainer Wittmann sal_uInt16 nColCount = aColItem.Count() - 1; 8598a2dd8f0SOliver-Rainer Wittmann for ( sal_uInt16 i = 0; i < nColCount; ++i ) 8608a2dd8f0SOliver-Rainer Wittmann { 8618a2dd8f0SOliver-Rainer Wittmann const SvxColumnDescription& rCol = aColItem[nColCount - i]; 8628a2dd8f0SOliver-Rainer Wittmann aTabCols[i] = aTabCols.GetRight() - rCol.nStart; 8638a2dd8f0SOliver-Rainer Wittmann aTabCols.SetHidden( i, !rCol.bVisible ); 8648a2dd8f0SOliver-Rainer Wittmann } 8658a2dd8f0SOliver-Rainer Wittmann } 8668a2dd8f0SOliver-Rainer Wittmann else 8678a2dd8f0SOliver-Rainer Wittmann { 8688a2dd8f0SOliver-Rainer Wittmann for ( sal_uInt16 i = 0; i < aColItem.Count()-1; ++i ) 8698a2dd8f0SOliver-Rainer Wittmann { 8708a2dd8f0SOliver-Rainer Wittmann const SvxColumnDescription& rCol = aColItem[i]; 8718a2dd8f0SOliver-Rainer Wittmann aTabCols[i] = rCol.nEnd + aTabCols.GetLeft(); 8728a2dd8f0SOliver-Rainer Wittmann aTabCols.SetHidden( i, !rCol.bVisible ); 8738a2dd8f0SOliver-Rainer Wittmann } 8748a2dd8f0SOliver-Rainer Wittmann } 875cdf0e10cSrcweir 8768a2dd8f0SOliver-Rainer Wittmann if ( bSetTabColFromDoc ) 8778a2dd8f0SOliver-Rainer Wittmann { 8788a2dd8f0SOliver-Rainer Wittmann if( !rSh.IsViewLocked() ) 8798a2dd8f0SOliver-Rainer Wittmann { 8808a2dd8f0SOliver-Rainer Wittmann bUnlockView = sal_True; 8818a2dd8f0SOliver-Rainer Wittmann rSh.LockView( sal_True ); 8828a2dd8f0SOliver-Rainer Wittmann } 8838a2dd8f0SOliver-Rainer Wittmann rSh.SetMouseTabCols( aTabCols, bSingleLine, 8848a2dd8f0SOliver-Rainer Wittmann aTabColFromDocPos ); 8858a2dd8f0SOliver-Rainer Wittmann } 8868a2dd8f0SOliver-Rainer Wittmann else 8878a2dd8f0SOliver-Rainer Wittmann rSh.SetTabCols(aTabCols, bSingleLine); 888cdf0e10cSrcweir 8898a2dd8f0SOliver-Rainer Wittmann } 8908a2dd8f0SOliver-Rainer Wittmann else 8918a2dd8f0SOliver-Rainer Wittmann { 8928a2dd8f0SOliver-Rainer Wittmann if ( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY || bSect) 8938a2dd8f0SOliver-Rainer Wittmann { 8948a2dd8f0SOliver-Rainer Wittmann SwSectionFmt *pSectFmt = 0; 8958a2dd8f0SOliver-Rainer Wittmann SfxItemSet aSet( GetPool(), RES_COL, RES_COL ); 8968a2dd8f0SOliver-Rainer Wittmann if(bSect) 8978a2dd8f0SOliver-Rainer Wittmann { 8988a2dd8f0SOliver-Rainer Wittmann const SwSection *pSect = rSh.GetAnySection(); 8998a2dd8f0SOliver-Rainer Wittmann ASSERT( pSect, "Welcher Bereich?"); 9008a2dd8f0SOliver-Rainer Wittmann pSectFmt = pSect->GetFmt(); 9018a2dd8f0SOliver-Rainer Wittmann } 9028a2dd8f0SOliver-Rainer Wittmann else 9038a2dd8f0SOliver-Rainer Wittmann { 9048a2dd8f0SOliver-Rainer Wittmann rSh.GetFlyFrmAttr( aSet ); 9058a2dd8f0SOliver-Rainer Wittmann } 9068a2dd8f0SOliver-Rainer Wittmann SwFmtCol aCols( 9078a2dd8f0SOliver-Rainer Wittmann bSect ? 9088a2dd8f0SOliver-Rainer Wittmann pSectFmt->GetCol() : 9098a2dd8f0SOliver-Rainer Wittmann (const SwFmtCol&)aSet.Get( RES_COL, sal_False )); 9108a2dd8f0SOliver-Rainer Wittmann SwRect aCurRect = rSh.GetAnyCurRect(bSect ? RECT_SECTION_PRT : RECT_FLY_PRT_EMBEDDED); 9118a2dd8f0SOliver-Rainer Wittmann const long lWidth = bVerticalWriting ? aCurRect.Height() : aCurRect.Width(); 9128a2dd8f0SOliver-Rainer Wittmann ::lcl_ConvertToCols( aColItem, sal_uInt16(lWidth), aCols ); 9138a2dd8f0SOliver-Rainer Wittmann aSet.Put( aCols ); 9148a2dd8f0SOliver-Rainer Wittmann if(bSect) 9158a2dd8f0SOliver-Rainer Wittmann rSh.SetSectionAttr( aSet, pSectFmt ); 9168a2dd8f0SOliver-Rainer Wittmann else 9178a2dd8f0SOliver-Rainer Wittmann { 9188a2dd8f0SOliver-Rainer Wittmann rSh.StartAction(); 9198a2dd8f0SOliver-Rainer Wittmann rSh.Push(); 9208a2dd8f0SOliver-Rainer Wittmann rSh.SetFlyFrmAttr( aSet ); 9218a2dd8f0SOliver-Rainer Wittmann //die Rahmenselektion wieder aufheben 9228a2dd8f0SOliver-Rainer Wittmann if(!bFrmSelection && rSh.IsFrmSelected()) 9238a2dd8f0SOliver-Rainer Wittmann { 9248a2dd8f0SOliver-Rainer Wittmann rSh.UnSelectFrm(); 9258a2dd8f0SOliver-Rainer Wittmann rSh.LeaveSelFrmMode(); 9268a2dd8f0SOliver-Rainer Wittmann } 9278a2dd8f0SOliver-Rainer Wittmann rSh.Pop(); 9288a2dd8f0SOliver-Rainer Wittmann rSh.EndAction(); 9298a2dd8f0SOliver-Rainer Wittmann } 9308a2dd8f0SOliver-Rainer Wittmann } 9318a2dd8f0SOliver-Rainer Wittmann else 9328a2dd8f0SOliver-Rainer Wittmann { 9338a2dd8f0SOliver-Rainer Wittmann SwFmtCol aCols( rDesc.GetMaster().GetCol() ); 9348a2dd8f0SOliver-Rainer Wittmann const SwRect aPrtRect = rSh.GetAnyCurRect(RECT_PAGE_PRT); 9358a2dd8f0SOliver-Rainer Wittmann ::lcl_ConvertToCols( aColItem, 9368a2dd8f0SOliver-Rainer Wittmann sal_uInt16(bVerticalWriting ? aPrtRect.Height() : aPrtRect.Width()), 9378a2dd8f0SOliver-Rainer Wittmann aCols ); 9388a2dd8f0SOliver-Rainer Wittmann SwPageDesc aDesc( rDesc ); 9398a2dd8f0SOliver-Rainer Wittmann aDesc.GetMaster().SetFmtAttr( aCols ); 9408a2dd8f0SOliver-Rainer Wittmann rSh.ChgPageDesc( rSh.GetCurPageDesc(), aDesc ); 9418a2dd8f0SOliver-Rainer Wittmann } 9428a2dd8f0SOliver-Rainer Wittmann } 9438a2dd8f0SOliver-Rainer Wittmann } 9448a2dd8f0SOliver-Rainer Wittmann break; 945cdf0e10cSrcweir 9468a2dd8f0SOliver-Rainer Wittmann case SID_RULER_ROWS : 9478a2dd8f0SOliver-Rainer Wittmann case SID_RULER_ROWS_VERTICAL: 9488a2dd8f0SOliver-Rainer Wittmann { 9498a2dd8f0SOliver-Rainer Wittmann SvxColumnItem aColItem((const SvxColumnItem&)rReq. 9508a2dd8f0SOliver-Rainer Wittmann GetArgs()->Get(nSlot)); 9518a2dd8f0SOliver-Rainer Wittmann 9528a2dd8f0SOliver-Rainer Wittmann if( bSetTabColFromDoc || (!bSect && rSh.GetTableFmt()) ) 9538a2dd8f0SOliver-Rainer Wittmann { 9548a2dd8f0SOliver-Rainer Wittmann ASSERT(aColItem.Count(), "ColDesc ist leer!!"); 9558a2dd8f0SOliver-Rainer Wittmann 9568a2dd8f0SOliver-Rainer Wittmann SwTabCols aTabCols; 9578a2dd8f0SOliver-Rainer Wittmann if ( bSetTabRowFromDoc ) 9588a2dd8f0SOliver-Rainer Wittmann rSh.GetMouseTabRows( aTabCols, aTabColFromDocPos ); 9598a2dd8f0SOliver-Rainer Wittmann else 9608a2dd8f0SOliver-Rainer Wittmann rSh.GetTabRows(aTabCols); 9618a2dd8f0SOliver-Rainer Wittmann 9628a2dd8f0SOliver-Rainer Wittmann if ( bVerticalWriting ) 9638a2dd8f0SOliver-Rainer Wittmann { 9648a2dd8f0SOliver-Rainer Wittmann aTabCols.SetRight(nPageWidth - aColItem.GetRight() - aColItem.GetLeft()); 9658a2dd8f0SOliver-Rainer Wittmann aTabCols.SetLeftMin(aColItem.GetLeft()); 9668a2dd8f0SOliver-Rainer Wittmann } 9678a2dd8f0SOliver-Rainer Wittmann else 9688a2dd8f0SOliver-Rainer Wittmann { 9698a2dd8f0SOliver-Rainer Wittmann long nBorder = nPageHeight - aTabCols.GetLeftMin() - aColItem.GetRight(); 9708a2dd8f0SOliver-Rainer Wittmann aTabCols.SetRight( nBorder ); 9718a2dd8f0SOliver-Rainer Wittmann } 9728a2dd8f0SOliver-Rainer Wittmann 9738a2dd8f0SOliver-Rainer Wittmann if(bVerticalWriting) 9748a2dd8f0SOliver-Rainer Wittmann { 9758a2dd8f0SOliver-Rainer Wittmann for ( sal_uInt16 i = aColItem.Count() - 1; i; --i ) 9768a2dd8f0SOliver-Rainer Wittmann { 9778a2dd8f0SOliver-Rainer Wittmann const SvxColumnDescription& rCol = aColItem[i - 1]; 9788a2dd8f0SOliver-Rainer Wittmann long nColumnPos = aTabCols.GetRight() - rCol.nEnd ; 9798a2dd8f0SOliver-Rainer Wittmann aTabCols[i - 1] = nColumnPos; 9808a2dd8f0SOliver-Rainer Wittmann aTabCols.SetHidden( i - 1, !rCol.bVisible ); 9818a2dd8f0SOliver-Rainer Wittmann } 9828a2dd8f0SOliver-Rainer Wittmann } 9838a2dd8f0SOliver-Rainer Wittmann else 9848a2dd8f0SOliver-Rainer Wittmann { 9858a2dd8f0SOliver-Rainer Wittmann for ( sal_uInt16 i = 0; i < aColItem.Count()-1; ++i ) 9868a2dd8f0SOliver-Rainer Wittmann { 9878a2dd8f0SOliver-Rainer Wittmann const SvxColumnDescription& rCol = aColItem[i]; 9888a2dd8f0SOliver-Rainer Wittmann aTabCols[i] = rCol.nEnd + aTabCols.GetLeft(); 9898a2dd8f0SOliver-Rainer Wittmann aTabCols.SetHidden( i, !rCol.bVisible ); 9908a2dd8f0SOliver-Rainer Wittmann } 9918a2dd8f0SOliver-Rainer Wittmann } 9928a2dd8f0SOliver-Rainer Wittmann sal_Bool bSingleLine = sal_False; 9938a2dd8f0SOliver-Rainer Wittmann const SfxPoolItem* pSingleLine; 9948a2dd8f0SOliver-Rainer Wittmann if( SFX_ITEM_SET == rReq.GetArgs()->GetItemState(SID_RULER_ACT_LINE_ONLY, sal_False, &pSingleLine)) 9958a2dd8f0SOliver-Rainer Wittmann bSingleLine = ((const SfxBoolItem*)pSingleLine)->GetValue(); 9968a2dd8f0SOliver-Rainer Wittmann if ( bSetTabRowFromDoc ) 9978a2dd8f0SOliver-Rainer Wittmann { 9988a2dd8f0SOliver-Rainer Wittmann if( !rSh.IsViewLocked() ) 9998a2dd8f0SOliver-Rainer Wittmann { 10008a2dd8f0SOliver-Rainer Wittmann bUnlockView = sal_True; 10018a2dd8f0SOliver-Rainer Wittmann rSh.LockView( sal_True ); 10028a2dd8f0SOliver-Rainer Wittmann } 10038a2dd8f0SOliver-Rainer Wittmann rSh.SetMouseTabRows( aTabCols, bSingleLine, aTabColFromDocPos ); 10048a2dd8f0SOliver-Rainer Wittmann } 10058a2dd8f0SOliver-Rainer Wittmann else 10068a2dd8f0SOliver-Rainer Wittmann rSh.SetTabRows(aTabCols, bSingleLine); 10078a2dd8f0SOliver-Rainer Wittmann } 10088a2dd8f0SOliver-Rainer Wittmann } 10098a2dd8f0SOliver-Rainer Wittmann break; 1010cdf0e10cSrcweir 1011cdf0e10cSrcweir default: 10128a2dd8f0SOliver-Rainer Wittmann ASSERT( !this, "Falsche SlotId"); 10138a2dd8f0SOliver-Rainer Wittmann } 10148a2dd8f0SOliver-Rainer Wittmann rSh.EndAllAction(); 1015cdf0e10cSrcweir 10168a2dd8f0SOliver-Rainer Wittmann if( bUnlockView ) 10178a2dd8f0SOliver-Rainer Wittmann rSh.LockView( sal_False ); 1018cdf0e10cSrcweir 1019cdf0e10cSrcweir bSetTabColFromDoc = bSetTabRowFromDoc = bTabColFromDoc = bTabRowFromDoc = sal_False; 1020cdf0e10cSrcweir SetNumRuleNodeFromDoc(NULL); 1021cdf0e10cSrcweir } 1022cdf0e10cSrcweir 1023cdf0e10cSrcweir /*-------------------------------------------------------------------- 1024cdf0e10cSrcweir Beschreibung: Hier wird der Status der Tableiste ermittelt 1025cdf0e10cSrcweir sprich alle relevanten Attribute an der CursorPos 1026cdf0e10cSrcweir werden der Tableiste uebermittelt 1027cdf0e10cSrcweir --------------------------------------------------------------------*/ 1028cdf0e10cSrcweir 1029cdf0e10cSrcweir 1030cdf0e10cSrcweir void SwView::StateTabWin(SfxItemSet& rSet) 1031cdf0e10cSrcweir { 10328a2dd8f0SOliver-Rainer Wittmann SwWrtShell &rSh = GetWrtShell(); 1033cdf0e10cSrcweir 1034cdf0e10cSrcweir const Point* pPt = IsTabColFromDoc() || IsTabRowFromDoc() ? &aTabColFromDocPos : 0; 10358a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nFrmType = rSh.IsObjSelected() 10368a2dd8f0SOliver-Rainer Wittmann ? FRMTYPE_DRAWOBJ 10378a2dd8f0SOliver-Rainer Wittmann : rSh.GetFrmType( pPt, sal_True ); 10388a2dd8f0SOliver-Rainer Wittmann 10398a2dd8f0SOliver-Rainer Wittmann const sal_Bool bFrmSelection = rSh.IsFrmSelected(); 10408a2dd8f0SOliver-Rainer Wittmann const sal_Bool bBrowse = rSh.GetViewOptions()->getBrowseMode(); 10418a2dd8f0SOliver-Rainer Wittmann // PageOffset/Begrenzer 10428a2dd8f0SOliver-Rainer Wittmann const SwRect& rPageRect = rSh.GetAnyCurRect( RECT_PAGE, pPt ); 10438a2dd8f0SOliver-Rainer Wittmann const SwRect& rPagePrtRect = rSh.GetAnyCurRect( RECT_PAGE_PRT, pPt ); 10448a2dd8f0SOliver-Rainer Wittmann const long nPageWidth = rPageRect.Width(); 10458a2dd8f0SOliver-Rainer Wittmann const long nPageHeight = rPageRect.Height(); 1046cdf0e10cSrcweir 1047cdf0e10cSrcweir const SwPageDesc& rDesc = rSh.GetPageDesc( 1048cdf0e10cSrcweir IsTabColFromDoc() || bTabRowFromDoc ? 1049cdf0e10cSrcweir rSh.GetMousePageDesc(aTabColFromDocPos) : rSh.GetCurPageDesc() ); 1050cdf0e10cSrcweir 1051cdf0e10cSrcweir const SvxFrameDirectionItem& rFrameDir = rDesc.GetMaster().GetFrmDir(); 1052cdf0e10cSrcweir const sal_Bool bVerticalWriting = rSh.IsInVerticalText(); 1053cdf0e10cSrcweir 1054cdf0e10cSrcweir //enable tab stop display on the rulers depending on the writing direction 1055cdf0e10cSrcweir WinBits nRulerStyle = pHRuler->GetStyle() & ~WB_EXTRAFIELD; 1056cdf0e10cSrcweir pHRuler->SetStyle(bVerticalWriting||bBrowse ? nRulerStyle : nRulerStyle|WB_EXTRAFIELD); 1057cdf0e10cSrcweir nRulerStyle = pVRuler->GetStyle() & ~WB_EXTRAFIELD; 1058cdf0e10cSrcweir pVRuler->SetStyle(bVerticalWriting ? nRulerStyle|WB_EXTRAFIELD : nRulerStyle); 1059cdf0e10cSrcweir 1060cdf0e10cSrcweir //#i24363# tab stops relative to indent 1061cdf0e10cSrcweir bool bRelative = rSh.getIDocumentSettingAccess()->get(IDocumentSettingAccess::TABS_RELATIVE_TO_INDENT); 1062cdf0e10cSrcweir pHRuler->SetTabsRelativeToIndent( bRelative ); 1063cdf0e10cSrcweir pVRuler->SetTabsRelativeToIndent( bRelative ); 1064cdf0e10cSrcweir 1065cdf0e10cSrcweir SvxLRSpaceItem aPageLRSpace( rDesc.GetMaster().GetLRSpace() ); 10668a2dd8f0SOliver-Rainer Wittmann SwapPageMargin( rDesc, aPageLRSpace ); 1067cdf0e10cSrcweir 10688a2dd8f0SOliver-Rainer Wittmann SfxItemSet aCoreSet( GetPool(), RES_PARATR_TABSTOP, RES_PARATR_TABSTOP, 10698a2dd8f0SOliver-Rainer Wittmann RES_LR_SPACE, RES_UL_SPACE, 0 ); 1070cdf0e10cSrcweir // get also the list level indent values merged as LR-SPACE item, if needed. 1071cdf0e10cSrcweir rSh.GetCurAttr( aCoreSet, true ); 1072cdf0e10cSrcweir SelectionType nSelType = rSh.GetSelectionType(); 1073cdf0e10cSrcweir 10748a2dd8f0SOliver-Rainer Wittmann SfxWhichIter aIter( rSet ); 10758a2dd8f0SOliver-Rainer Wittmann sal_uInt16 nWhich = aIter.FirstWhich(); 1076cdf0e10cSrcweir sal_Bool bPutContentProtection = sal_False; 1077cdf0e10cSrcweir 1078ff0525f2SOliver-Rainer Wittmann while ( nWhich ) 1079ff0525f2SOliver-Rainer Wittmann { 1080ff0525f2SOliver-Rainer Wittmann switch ( nWhich ) 1081ff0525f2SOliver-Rainer Wittmann { 10828a2dd8f0SOliver-Rainer Wittmann case SID_ATTR_PAGE_COLUMN: 1083ff0525f2SOliver-Rainer Wittmann { 10848a2dd8f0SOliver-Rainer Wittmann sal_uInt16 nColumnType = 0; 10858a2dd8f0SOliver-Rainer Wittmann 10868a2dd8f0SOliver-Rainer Wittmann const SwFrmFmt& rMaster = rDesc.GetMaster(); 10878a2dd8f0SOliver-Rainer Wittmann SwFmtCol aCol(rMaster.GetCol()); 10888a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nCols = aCol.GetNumCols(); 10898a2dd8f0SOliver-Rainer Wittmann if ( nCols == 0 ) 10908a2dd8f0SOliver-Rainer Wittmann { 10918a2dd8f0SOliver-Rainer Wittmann nColumnType = 1; 10928a2dd8f0SOliver-Rainer Wittmann } 10938a2dd8f0SOliver-Rainer Wittmann else if ( nCols == 2 ) 10948a2dd8f0SOliver-Rainer Wittmann { 10958a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nColLeft = aCol.CalcPrtColWidth(0, aCol.GetWishWidth()); 10968a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nColRight = aCol.CalcPrtColWidth(1, aCol.GetWishWidth()); 10978a2dd8f0SOliver-Rainer Wittmann 10988a2dd8f0SOliver-Rainer Wittmann if ( abs(nColLeft - nColRight) <= 10 ) 10998a2dd8f0SOliver-Rainer Wittmann { 11008a2dd8f0SOliver-Rainer Wittmann nColumnType = 2; 11018a2dd8f0SOliver-Rainer Wittmann } 11028a2dd8f0SOliver-Rainer Wittmann else if( abs(nColLeft - nColRight*2) < 20 ) 11038a2dd8f0SOliver-Rainer Wittmann { 11048a2dd8f0SOliver-Rainer Wittmann nColumnType = 4; 11058a2dd8f0SOliver-Rainer Wittmann } 11068a2dd8f0SOliver-Rainer Wittmann else if( abs(nColLeft*2 - nColRight) < 20 ) 11078a2dd8f0SOliver-Rainer Wittmann { 11088a2dd8f0SOliver-Rainer Wittmann nColumnType = 5; 11098a2dd8f0SOliver-Rainer Wittmann } 11108a2dd8f0SOliver-Rainer Wittmann } 11118a2dd8f0SOliver-Rainer Wittmann else if( nCols == 3 ) 11128a2dd8f0SOliver-Rainer Wittmann { 11138a2dd8f0SOliver-Rainer Wittmann nColumnType = 3; 11148a2dd8f0SOliver-Rainer Wittmann } 11158a2dd8f0SOliver-Rainer Wittmann 11168a2dd8f0SOliver-Rainer Wittmann rSet.Put( SfxInt16Item( SID_ATTR_PAGE_COLUMN, nColumnType ) ); 1117ff0525f2SOliver-Rainer Wittmann } 11188a2dd8f0SOliver-Rainer Wittmann break; 1119ff0525f2SOliver-Rainer Wittmann 11208a2dd8f0SOliver-Rainer Wittmann case SID_ATTR_LONG_LRSPACE: 11218a2dd8f0SOliver-Rainer Wittmann { 11228a2dd8f0SOliver-Rainer Wittmann SvxLongLRSpaceItem aLongLR( (long)aPageLRSpace.GetLeft(), 11238a2dd8f0SOliver-Rainer Wittmann (long)aPageLRSpace.GetRight(), 11248a2dd8f0SOliver-Rainer Wittmann SID_ATTR_LONG_LRSPACE); 11258a2dd8f0SOliver-Rainer Wittmann if(bBrowse) 1126ff0525f2SOliver-Rainer Wittmann { 11278a2dd8f0SOliver-Rainer Wittmann aLongLR.SetLeft(rPagePrtRect.Left()); 11288a2dd8f0SOliver-Rainer Wittmann aLongLR.SetRight(nPageWidth - rPagePrtRect.Right()); 1129ff0525f2SOliver-Rainer Wittmann } 11308a2dd8f0SOliver-Rainer Wittmann if ( ( nFrmType & FRMTYPE_HEADER || nFrmType & FRMTYPE_FOOTER ) && 11318a2dd8f0SOliver-Rainer Wittmann !(nFrmType & FRMTYPE_COLSECT) ) 1132ff0525f2SOliver-Rainer Wittmann { 11338a2dd8f0SOliver-Rainer Wittmann SwFrmFmt *pFmt = (SwFrmFmt*) (nFrmType & FRMTYPE_HEADER ? 11348a2dd8f0SOliver-Rainer Wittmann rDesc.GetMaster().GetHeader().GetHeaderFmt() : 11358a2dd8f0SOliver-Rainer Wittmann rDesc.GetMaster().GetFooter().GetFooterFmt()); 11368a2dd8f0SOliver-Rainer Wittmann if( pFmt )// #i80890# if rDesc is not the one belonging to the current page is might crash 11378a2dd8f0SOliver-Rainer Wittmann { 11388a2dd8f0SOliver-Rainer Wittmann SwRect aRect( rSh.GetAnyCurRect( RECT_HEADERFOOTER, pPt)); 11398a2dd8f0SOliver-Rainer Wittmann aRect.Pos() -= rSh.GetAnyCurRect( RECT_PAGE, pPt ).Pos(); 11408a2dd8f0SOliver-Rainer Wittmann const SvxLRSpaceItem& aLR = pFmt->GetLRSpace(); 11418a2dd8f0SOliver-Rainer Wittmann aLongLR.SetLeft ( (long)aLR.GetLeft() + (long)aRect.Left() ); 11428a2dd8f0SOliver-Rainer Wittmann aLongLR.SetRight( (nPageWidth - 11438a2dd8f0SOliver-Rainer Wittmann (long)aRect.Right() + (long)aLR.GetRight())); 11448a2dd8f0SOliver-Rainer Wittmann } 1145ff0525f2SOliver-Rainer Wittmann } 11468a2dd8f0SOliver-Rainer Wittmann else 1147ff0525f2SOliver-Rainer Wittmann { 11488a2dd8f0SOliver-Rainer Wittmann SwRect aRect; 11498a2dd8f0SOliver-Rainer Wittmann if( !bFrmSelection && ((nFrmType & FRMTYPE_COLSECT) || rSh.IsDirectlyInSection()) ) 11508a2dd8f0SOliver-Rainer Wittmann { 11518a2dd8f0SOliver-Rainer Wittmann aRect = rSh.GetAnyCurRect(RECT_SECTION_PRT, pPt); 11528a2dd8f0SOliver-Rainer Wittmann const SwRect aTmpRect = rSh.GetAnyCurRect(RECT_SECTION, pPt); 11538a2dd8f0SOliver-Rainer Wittmann aRect.Pos() += aTmpRect.Pos(); 11548a2dd8f0SOliver-Rainer Wittmann } 11558a2dd8f0SOliver-Rainer Wittmann 11568a2dd8f0SOliver-Rainer Wittmann else if ( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY ) 11578a2dd8f0SOliver-Rainer Wittmann aRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED, pPt); 11588a2dd8f0SOliver-Rainer Wittmann else if( nFrmType & FRMTYPE_DRAWOBJ) 11598a2dd8f0SOliver-Rainer Wittmann aRect = rSh.GetObjRect(); 11608a2dd8f0SOliver-Rainer Wittmann 11618a2dd8f0SOliver-Rainer Wittmann if( aRect.Width() ) 11628a2dd8f0SOliver-Rainer Wittmann { 11638a2dd8f0SOliver-Rainer Wittmann // PAGES01 11648a2dd8f0SOliver-Rainer Wittmann // make relative to page position: 11658a2dd8f0SOliver-Rainer Wittmann aLongLR.SetLeft ((long)( aRect.Left() - rPageRect.Left() )); 11668a2dd8f0SOliver-Rainer Wittmann aLongLR.SetRight((long)( rPageRect.Right() - aRect.Right())); 11678a2dd8f0SOliver-Rainer Wittmann } 1168ff0525f2SOliver-Rainer Wittmann } 11698a2dd8f0SOliver-Rainer Wittmann if( nWhich == SID_ATTR_LONG_LRSPACE ) 11708a2dd8f0SOliver-Rainer Wittmann rSet.Put( aLongLR ); 11718a2dd8f0SOliver-Rainer Wittmann else 11728a2dd8f0SOliver-Rainer Wittmann { 11738a2dd8f0SOliver-Rainer Wittmann SvxLRSpaceItem aLR( aLongLR.GetLeft(), 11748a2dd8f0SOliver-Rainer Wittmann aLongLR.GetRight(), 11758a2dd8f0SOliver-Rainer Wittmann 0, 0, 11768a2dd8f0SOliver-Rainer Wittmann nWhich); 11778a2dd8f0SOliver-Rainer Wittmann rSet.Put(aLR); 11788a2dd8f0SOliver-Rainer Wittmann } 11798a2dd8f0SOliver-Rainer Wittmann break; 1180ff0525f2SOliver-Rainer Wittmann } 11818a2dd8f0SOliver-Rainer Wittmann 11828a2dd8f0SOliver-Rainer Wittmann // provide left and right margins of current page style 11838a2dd8f0SOliver-Rainer Wittmann case SID_ATTR_PAGE_LRSPACE: 1184ff0525f2SOliver-Rainer Wittmann { 11858a2dd8f0SOliver-Rainer Wittmann SvxLongLRSpaceItem aLongLR( 11868a2dd8f0SOliver-Rainer Wittmann (long)aPageLRSpace.GetLeft(), 11878a2dd8f0SOliver-Rainer Wittmann (long)aPageLRSpace.GetRight(), 11888a2dd8f0SOliver-Rainer Wittmann SID_ATTR_PAGE_LRSPACE ); 11898a2dd8f0SOliver-Rainer Wittmann rSet.Put( aLongLR ); 1190ff0525f2SOliver-Rainer Wittmann } 11918a2dd8f0SOliver-Rainer Wittmann break; 1192ff0525f2SOliver-Rainer Wittmann 11938a2dd8f0SOliver-Rainer Wittmann case SID_ATTR_LONG_ULSPACE: 11948a2dd8f0SOliver-Rainer Wittmann { 11958a2dd8f0SOliver-Rainer Wittmann // Rand Seite Oben Unten 11968a2dd8f0SOliver-Rainer Wittmann SvxULSpaceItem aUL( rDesc.GetMaster().GetULSpace() ); 11978a2dd8f0SOliver-Rainer Wittmann SvxLongULSpaceItem aLongUL( (long)aUL.GetUpper(), 11988a2dd8f0SOliver-Rainer Wittmann (long)aUL.GetLower(), 11998a2dd8f0SOliver-Rainer Wittmann SID_ATTR_LONG_ULSPACE); 12008a2dd8f0SOliver-Rainer Wittmann 12018a2dd8f0SOliver-Rainer Wittmann if ( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY ) 12028a2dd8f0SOliver-Rainer Wittmann { 12038a2dd8f0SOliver-Rainer Wittmann // Dokumentkoordinaten Frame auf Seitenkoordinaten umbrechen 12048a2dd8f0SOliver-Rainer Wittmann const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED, pPt); 12058a2dd8f0SOliver-Rainer Wittmann aLongUL.SetUpper((sal_uInt16)(rRect.Top() - rPageRect.Top() )); 12068a2dd8f0SOliver-Rainer Wittmann aLongUL.SetLower((sal_uInt16)(rPageRect.Bottom() - rRect.Bottom() )); 12078a2dd8f0SOliver-Rainer Wittmann } 12088a2dd8f0SOliver-Rainer Wittmann else if ( nFrmType & FRMTYPE_HEADER || nFrmType & FRMTYPE_FOOTER ) 1209cdf0e10cSrcweir { 1210cdf0e10cSrcweir SwRect aRect( rSh.GetAnyCurRect( RECT_HEADERFOOTER, pPt)); 1211cdf0e10cSrcweir aRect.Pos() -= rSh.GetAnyCurRect( RECT_PAGE, pPt ).Pos(); 12128a2dd8f0SOliver-Rainer Wittmann aLongUL.SetUpper( (sal_uInt16)aRect.Top() ); 12138a2dd8f0SOliver-Rainer Wittmann aLongUL.SetLower( (sal_uInt16)(nPageHeight - aRect.Bottom()) ); 1214cdf0e10cSrcweir } 12158a2dd8f0SOliver-Rainer Wittmann else if( nFrmType & FRMTYPE_DRAWOBJ) 1216cdf0e10cSrcweir { 12178a2dd8f0SOliver-Rainer Wittmann const SwRect &rRect = rSh.GetObjRect(); 12188a2dd8f0SOliver-Rainer Wittmann aLongUL.SetUpper((rRect.Top() - rPageRect.Top())); 12198a2dd8f0SOliver-Rainer Wittmann aLongUL.SetLower((rPageRect.Bottom() - rRect.Bottom())); 1220cdf0e10cSrcweir } 12218a2dd8f0SOliver-Rainer Wittmann else if(bBrowse) 12228a2dd8f0SOliver-Rainer Wittmann { 12238a2dd8f0SOliver-Rainer Wittmann aLongUL.SetUpper(rPagePrtRect.Top()); 12248a2dd8f0SOliver-Rainer Wittmann aLongUL.SetLower(nPageHeight - rPagePrtRect.Bottom()); 12258a2dd8f0SOliver-Rainer Wittmann } 12268a2dd8f0SOliver-Rainer Wittmann if( nWhich == SID_ATTR_LONG_ULSPACE ) 12278a2dd8f0SOliver-Rainer Wittmann rSet.Put( aLongUL ); 12288a2dd8f0SOliver-Rainer Wittmann else 12298a2dd8f0SOliver-Rainer Wittmann { 12308a2dd8f0SOliver-Rainer Wittmann SvxULSpaceItem aULTmp((sal_uInt16)aLongUL.GetUpper(), 12318a2dd8f0SOliver-Rainer Wittmann (sal_uInt16)aLongUL.GetLower(), 12328a2dd8f0SOliver-Rainer Wittmann nWhich); 12338a2dd8f0SOliver-Rainer Wittmann rSet.Put(aULTmp); 12348a2dd8f0SOliver-Rainer Wittmann } 12358a2dd8f0SOliver-Rainer Wittmann break; 12368a2dd8f0SOliver-Rainer Wittmann } 12378a2dd8f0SOliver-Rainer Wittmann 12388a2dd8f0SOliver-Rainer Wittmann // provide top and bottom margins of current page style 12398a2dd8f0SOliver-Rainer Wittmann case SID_ATTR_PAGE_ULSPACE: 12408a2dd8f0SOliver-Rainer Wittmann { 12418a2dd8f0SOliver-Rainer Wittmann const SvxULSpaceItem aUL( rDesc.GetMaster().GetULSpace() ); 12428a2dd8f0SOliver-Rainer Wittmann SvxLongULSpaceItem aLongUL( 12438a2dd8f0SOliver-Rainer Wittmann (long)aUL.GetUpper(), 12448a2dd8f0SOliver-Rainer Wittmann (long)aUL.GetLower(), 12458a2dd8f0SOliver-Rainer Wittmann SID_ATTR_PAGE_ULSPACE ); 12468a2dd8f0SOliver-Rainer Wittmann 12478a2dd8f0SOliver-Rainer Wittmann rSet.Put( aLongUL ); 12488a2dd8f0SOliver-Rainer Wittmann } 12498a2dd8f0SOliver-Rainer Wittmann break; 1250cdf0e10cSrcweir 1251cdf0e10cSrcweir case SID_ATTR_TABSTOP_VERTICAL : 1252cdf0e10cSrcweir case RES_PARATR_TABSTOP: 12538a2dd8f0SOliver-Rainer Wittmann { 12548a2dd8f0SOliver-Rainer Wittmann if ( ISA( SwWebView ) || 12558a2dd8f0SOliver-Rainer Wittmann IsTabColFromDoc() || 12568a2dd8f0SOliver-Rainer Wittmann IsTabRowFromDoc() || 12578a2dd8f0SOliver-Rainer Wittmann ( nSelType & nsSelectionType::SEL_GRF) || 12588a2dd8f0SOliver-Rainer Wittmann (nSelType & nsSelectionType::SEL_FRM) || 12598a2dd8f0SOliver-Rainer Wittmann (nSelType & nsSelectionType::SEL_OLE) || 1260cdf0e10cSrcweir SFX_ITEM_AVAILABLE > aCoreSet.GetItemState(RES_LR_SPACE)|| 1261cdf0e10cSrcweir (!bVerticalWriting && (SID_ATTR_TABSTOP_VERTICAL == nWhich))|| 1262cdf0e10cSrcweir (bVerticalWriting && (RES_PARATR_TABSTOP == nWhich)) 12638a2dd8f0SOliver-Rainer Wittmann ) 12648a2dd8f0SOliver-Rainer Wittmann rSet.DisableItem( nWhich ); 12658a2dd8f0SOliver-Rainer Wittmann else 12668a2dd8f0SOliver-Rainer Wittmann { 12678a2dd8f0SOliver-Rainer Wittmann SvxTabStopItem aTabStops((const SvxTabStopItem&) 12688a2dd8f0SOliver-Rainer Wittmann aCoreSet.Get( RES_PARATR_TABSTOP )); 12698a2dd8f0SOliver-Rainer Wittmann 12708a2dd8f0SOliver-Rainer Wittmann const SvxTabStopItem& rDefTabs = (const SvxTabStopItem&) 12718a2dd8f0SOliver-Rainer Wittmann rSh.GetDefault(RES_PARATR_TABSTOP); 12728a2dd8f0SOliver-Rainer Wittmann 12738a2dd8f0SOliver-Rainer Wittmann DBG_ASSERT(pHRuler, "warum ist das Lineal nicht da?"); 12748a2dd8f0SOliver-Rainer Wittmann long nDefTabDist = ::GetTabDist(rDefTabs); 12758a2dd8f0SOliver-Rainer Wittmann pHRuler->SetDefTabDist( nDefTabDist ); 12768a2dd8f0SOliver-Rainer Wittmann pVRuler->SetDefTabDist( nDefTabDist ); 12778a2dd8f0SOliver-Rainer Wittmann ::lcl_EraseDefTabs(aTabStops); 12788a2dd8f0SOliver-Rainer Wittmann rSet.Put(aTabStops, nWhich); 12798a2dd8f0SOliver-Rainer Wittmann } 12808a2dd8f0SOliver-Rainer Wittmann break; 12818a2dd8f0SOliver-Rainer Wittmann } 12828a2dd8f0SOliver-Rainer Wittmann 1283cdf0e10cSrcweir case SID_ATTR_PARA_LRSPACE_VERTICAL: 1284cdf0e10cSrcweir case SID_ATTR_PARA_LRSPACE: 12858a2dd8f0SOliver-Rainer Wittmann { 12868a2dd8f0SOliver-Rainer Wittmann if ( nSelType & nsSelectionType::SEL_GRF || 12878a2dd8f0SOliver-Rainer Wittmann nSelType & nsSelectionType::SEL_FRM || 12888a2dd8f0SOliver-Rainer Wittmann nSelType & nsSelectionType::SEL_OLE || 1289cdf0e10cSrcweir nFrmType == FRMTYPE_DRAWOBJ || 1290cdf0e10cSrcweir (!bVerticalWriting && (SID_ATTR_PARA_LRSPACE_VERTICAL == nWhich))|| 1291cdf0e10cSrcweir (bVerticalWriting && (SID_ATTR_PARA_LRSPACE == nWhich)) 1292cdf0e10cSrcweir ) 1293cdf0e10cSrcweir { 12948a2dd8f0SOliver-Rainer Wittmann rSet.DisableItem(nWhich); 12958a2dd8f0SOliver-Rainer Wittmann } 12968a2dd8f0SOliver-Rainer Wittmann else 12978a2dd8f0SOliver-Rainer Wittmann { 12988a2dd8f0SOliver-Rainer Wittmann SvxLRSpaceItem aLR( RES_LR_SPACE ); 12998a2dd8f0SOliver-Rainer Wittmann if ( !IsTabColFromDoc() ) 1300cdf0e10cSrcweir { 13018a2dd8f0SOliver-Rainer Wittmann aLR = (const SvxLRSpaceItem&)aCoreSet.Get(RES_LR_SPACE); 13028a2dd8f0SOliver-Rainer Wittmann 13038a2dd8f0SOliver-Rainer Wittmann // #i23726# 13048a2dd8f0SOliver-Rainer Wittmann if (pNumRuleNodeFromDoc) 13058a2dd8f0SOliver-Rainer Wittmann { 13068a2dd8f0SOliver-Rainer Wittmann short nOffset = static_cast< short >(aLR.GetTxtLeft() + 13078a2dd8f0SOliver-Rainer Wittmann // --> FME 2005-02-22 #i42922# Mouse move of numbering label 13088a2dd8f0SOliver-Rainer Wittmann // has to consider the left indent of the paragraph 13098a2dd8f0SOliver-Rainer Wittmann pNumRuleNodeFromDoc->GetLeftMarginWithNum( sal_True ) ); 13108a2dd8f0SOliver-Rainer Wittmann // <-- 13118a2dd8f0SOliver-Rainer Wittmann 13128a2dd8f0SOliver-Rainer Wittmann short nFLOffset; 13138a2dd8f0SOliver-Rainer Wittmann pNumRuleNodeFromDoc->GetFirstLineOfsWithNum( nFLOffset ); 13148a2dd8f0SOliver-Rainer Wittmann 13158a2dd8f0SOliver-Rainer Wittmann aLR.SetLeft( nOffset + nFLOffset ); 13168a2dd8f0SOliver-Rainer Wittmann } 1317cdf0e10cSrcweir } 13188a2dd8f0SOliver-Rainer Wittmann aLR.SetWhich(nWhich); 13198a2dd8f0SOliver-Rainer Wittmann rSet.Put(aLR); 1320cdf0e10cSrcweir } 13218a2dd8f0SOliver-Rainer Wittmann break; 13228a2dd8f0SOliver-Rainer Wittmann } 13238a2dd8f0SOliver-Rainer Wittmann 1324*766ce4d0SZheng Fan case SID_ATTR_PARA_ULSPACE: 1325*766ce4d0SZheng Fan { 1326*766ce4d0SZheng Fan SvxULSpaceItem aUL = (const SvxULSpaceItem&)aCoreSet.Get(RES_UL_SPACE); 1327*766ce4d0SZheng Fan aUL.SetWhich(nWhich); 1328*766ce4d0SZheng Fan 1329*766ce4d0SZheng Fan SfxItemState e = aCoreSet.GetItemState(RES_UL_SPACE); 1330*766ce4d0SZheng Fan if( e >= SFX_ITEM_AVAILABLE ) 1331*766ce4d0SZheng Fan rSet.Put( aUL ); 1332*766ce4d0SZheng Fan else 1333*766ce4d0SZheng Fan rSet.InvalidateItem(nWhich); 1334*766ce4d0SZheng Fan } 1335*766ce4d0SZheng Fan break; 1336*766ce4d0SZheng Fan 1337cdf0e10cSrcweir case SID_RULER_BORDER_DISTANCE: 13388a2dd8f0SOliver-Rainer Wittmann { 13398a2dd8f0SOliver-Rainer Wittmann nLeftBorderDistance = 0; 13408a2dd8f0SOliver-Rainer Wittmann nRightBorderDistance = 0; 13418a2dd8f0SOliver-Rainer Wittmann if ( nSelType & nsSelectionType::SEL_GRF || 13428a2dd8f0SOliver-Rainer Wittmann nSelType & nsSelectionType::SEL_FRM || 13438a2dd8f0SOliver-Rainer Wittmann nSelType & nsSelectionType::SEL_OLE || 13448a2dd8f0SOliver-Rainer Wittmann nFrmType == FRMTYPE_DRAWOBJ ) 13458a2dd8f0SOliver-Rainer Wittmann rSet.DisableItem(SID_RULER_BORDER_DISTANCE); 13468a2dd8f0SOliver-Rainer Wittmann else 13478a2dd8f0SOliver-Rainer Wittmann { 13488a2dd8f0SOliver-Rainer Wittmann SvxLRSpaceItem aDistLR(SID_RULER_BORDER_DISTANCE); 13498a2dd8f0SOliver-Rainer Wittmann if(nFrmType & FRMTYPE_FLY_ANY) 13508a2dd8f0SOliver-Rainer Wittmann { 13518a2dd8f0SOliver-Rainer Wittmann if( IsTabColFromDoc() ) 13528a2dd8f0SOliver-Rainer Wittmann { 13538a2dd8f0SOliver-Rainer Wittmann const SwRect& rFlyPrtRect = rSh.GetAnyCurRect( RECT_FLY_PRT_EMBEDDED, pPt ); 13548a2dd8f0SOliver-Rainer Wittmann aDistLR.SetLeft(rFlyPrtRect.Left()); 13558a2dd8f0SOliver-Rainer Wittmann aDistLR.SetRight(rFlyPrtRect.Left()); 13568a2dd8f0SOliver-Rainer Wittmann } 13578a2dd8f0SOliver-Rainer Wittmann else 13588a2dd8f0SOliver-Rainer Wittmann { 13598a2dd8f0SOliver-Rainer Wittmann SfxItemSet aCoreSet2( GetPool(), 13608a2dd8f0SOliver-Rainer Wittmann RES_BOX, RES_BOX, 13618a2dd8f0SOliver-Rainer Wittmann SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0 ); 13628a2dd8f0SOliver-Rainer Wittmann SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER ); 13638a2dd8f0SOliver-Rainer Wittmann aCoreSet.Put( aBoxInfo ); 13648a2dd8f0SOliver-Rainer Wittmann rSh.GetFlyFrmAttr( aCoreSet ); 13658a2dd8f0SOliver-Rainer Wittmann const SvxBoxItem& rBox = (const SvxBoxItem&)aCoreSet.Get(RES_BOX); 13668a2dd8f0SOliver-Rainer Wittmann aDistLR.SetLeft((sal_uInt16)rBox.GetDistance(BOX_LINE_LEFT )); 13678a2dd8f0SOliver-Rainer Wittmann aDistLR.SetRight((sal_uInt16)rBox.GetDistance(BOX_LINE_RIGHT)); 13688a2dd8f0SOliver-Rainer Wittmann 13698a2dd8f0SOliver-Rainer Wittmann //add the paragraph border distance 13708a2dd8f0SOliver-Rainer Wittmann SfxItemSet aCoreSet1( GetPool(), 13718a2dd8f0SOliver-Rainer Wittmann RES_BOX, RES_BOX, 13728a2dd8f0SOliver-Rainer Wittmann 0 ); 13738a2dd8f0SOliver-Rainer Wittmann rSh.GetCurAttr( aCoreSet1 ); 13748a2dd8f0SOliver-Rainer Wittmann const SvxBoxItem& rParaBox = (const SvxBoxItem&)aCoreSet1.Get(RES_BOX); 13758a2dd8f0SOliver-Rainer Wittmann aDistLR.SetLeft(aDistLR.GetLeft() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_LEFT )); 13768a2dd8f0SOliver-Rainer Wittmann aDistLR.SetRight(aDistLR.GetRight() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_RIGHT)); 13778a2dd8f0SOliver-Rainer Wittmann } 13788a2dd8f0SOliver-Rainer Wittmann rSet.Put(aDistLR); 13798a2dd8f0SOliver-Rainer Wittmann nLeftBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetLeft()); 13808a2dd8f0SOliver-Rainer Wittmann nRightBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetRight()); 13818a2dd8f0SOliver-Rainer Wittmann } 13828a2dd8f0SOliver-Rainer Wittmann else if ( IsTabColFromDoc() || 13838a2dd8f0SOliver-Rainer Wittmann ( rSh.GetTableFmt() && !bFrmSelection && 13848a2dd8f0SOliver-Rainer Wittmann !(nFrmType & FRMTYPE_COLSECT ) ) ) 13858a2dd8f0SOliver-Rainer Wittmann { 13868a2dd8f0SOliver-Rainer Wittmann SfxItemSet aCoreSet2( GetPool(), 13878a2dd8f0SOliver-Rainer Wittmann RES_BOX, RES_BOX, 13888a2dd8f0SOliver-Rainer Wittmann SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0 ); 1389cdf0e10cSrcweir SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER ); 13908a2dd8f0SOliver-Rainer Wittmann aBoxInfo.SetTable(sal_False); 13918a2dd8f0SOliver-Rainer Wittmann aBoxInfo.SetDist((sal_Bool) sal_True); 13928a2dd8f0SOliver-Rainer Wittmann aCoreSet2.Put(aBoxInfo); 13938a2dd8f0SOliver-Rainer Wittmann rSh.GetTabBorders( aCoreSet2 ); 13948a2dd8f0SOliver-Rainer Wittmann const SvxBoxItem& rBox = (const SvxBoxItem&)aCoreSet2.Get(RES_BOX); 1395cdf0e10cSrcweir aDistLR.SetLeft((sal_uInt16)rBox.GetDistance(BOX_LINE_LEFT )); 1396cdf0e10cSrcweir aDistLR.SetRight((sal_uInt16)rBox.GetDistance(BOX_LINE_RIGHT)); 1397cdf0e10cSrcweir 13988a2dd8f0SOliver-Rainer Wittmann //add the border distance of the paragraph 1399cdf0e10cSrcweir SfxItemSet aCoreSet1( GetPool(), 14008a2dd8f0SOliver-Rainer Wittmann RES_BOX, RES_BOX, 14018a2dd8f0SOliver-Rainer Wittmann 0 ); 1402cdf0e10cSrcweir rSh.GetCurAttr( aCoreSet1 ); 1403cdf0e10cSrcweir const SvxBoxItem& rParaBox = (const SvxBoxItem&)aCoreSet1.Get(RES_BOX); 14048a2dd8f0SOliver-Rainer Wittmann aDistLR.SetLeft(aDistLR.GetLeft() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_LEFT )); 14058a2dd8f0SOliver-Rainer Wittmann aDistLR.SetRight(aDistLR.GetRight() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_RIGHT)); 14068a2dd8f0SOliver-Rainer Wittmann rSet.Put(aDistLR); 14078a2dd8f0SOliver-Rainer Wittmann nLeftBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetLeft()); 14088a2dd8f0SOliver-Rainer Wittmann nRightBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetRight()); 1409cdf0e10cSrcweir } 14108a2dd8f0SOliver-Rainer Wittmann else if ( !rSh.IsDirectlyInSection() ) 1411cdf0e10cSrcweir { 14128a2dd8f0SOliver-Rainer Wittmann //get the page/header/footer border distance 14138a2dd8f0SOliver-Rainer Wittmann const SwFrmFmt& rMaster = rDesc.GetMaster(); 14148a2dd8f0SOliver-Rainer Wittmann const SvxBoxItem& rBox = (const SvxBoxItem&)rMaster.GetAttrSet().Get(RES_BOX); 14158a2dd8f0SOliver-Rainer Wittmann aDistLR.SetLeft((sal_uInt16)rBox.GetDistance(BOX_LINE_LEFT )); 14168a2dd8f0SOliver-Rainer Wittmann aDistLR.SetRight((sal_uInt16)rBox.GetDistance(BOX_LINE_RIGHT)); 1417cdf0e10cSrcweir 14188a2dd8f0SOliver-Rainer Wittmann const SvxBoxItem* pBox = 0; 14198a2dd8f0SOliver-Rainer Wittmann if(nFrmType & FRMTYPE_HEADER) 14208a2dd8f0SOliver-Rainer Wittmann { 14218a2dd8f0SOliver-Rainer Wittmann rMaster.GetHeader(); 14228a2dd8f0SOliver-Rainer Wittmann const SwFmtHeader& rHeaderFmt = rMaster.GetHeader(); 14238a2dd8f0SOliver-Rainer Wittmann SwFrmFmt *pHeaderFmt = (SwFrmFmt*)rHeaderFmt.GetHeaderFmt(); 14248a2dd8f0SOliver-Rainer Wittmann if( pHeaderFmt )// #i80890# if rDesc is not the one belonging to the current page is might crash 14258a2dd8f0SOliver-Rainer Wittmann pBox = & (const SvxBoxItem&)pHeaderFmt->GetBox(); 14268a2dd8f0SOliver-Rainer Wittmann } 14278a2dd8f0SOliver-Rainer Wittmann else if(nFrmType & FRMTYPE_FOOTER ) 14288a2dd8f0SOliver-Rainer Wittmann { 14298a2dd8f0SOliver-Rainer Wittmann const SwFmtFooter& rFooterFmt = rMaster.GetFooter(); 14308a2dd8f0SOliver-Rainer Wittmann SwFrmFmt *pFooterFmt = (SwFrmFmt*)rFooterFmt.GetFooterFmt(); 14318a2dd8f0SOliver-Rainer Wittmann if( pFooterFmt )// #i80890# if rDesc is not the one belonging to the current page is might crash 14328a2dd8f0SOliver-Rainer Wittmann pBox = & (const SvxBoxItem&)pFooterFmt->GetBox(); 14338a2dd8f0SOliver-Rainer Wittmann } 14348a2dd8f0SOliver-Rainer Wittmann if(pBox) 14358a2dd8f0SOliver-Rainer Wittmann { 14368a2dd8f0SOliver-Rainer Wittmann aDistLR.SetLeft((sal_uInt16)pBox->GetDistance(BOX_LINE_LEFT )); 14378a2dd8f0SOliver-Rainer Wittmann aDistLR.SetRight((sal_uInt16)pBox->GetDistance(BOX_LINE_RIGHT)); 14388a2dd8f0SOliver-Rainer Wittmann } 14398a2dd8f0SOliver-Rainer Wittmann 14408a2dd8f0SOliver-Rainer Wittmann //add the border distance of the paragraph 14418a2dd8f0SOliver-Rainer Wittmann SfxItemSet aCoreSetTmp( GetPool(), 14428a2dd8f0SOliver-Rainer Wittmann RES_BOX, RES_BOX, 14438a2dd8f0SOliver-Rainer Wittmann SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0 ); 14448a2dd8f0SOliver-Rainer Wittmann rSh.GetCurAttr( aCoreSetTmp ); 14458a2dd8f0SOliver-Rainer Wittmann const SvxBoxItem& rParaBox = (const SvxBoxItem&)aCoreSetTmp.Get(RES_BOX); 14468a2dd8f0SOliver-Rainer Wittmann aDistLR.SetLeft(aDistLR.GetLeft() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_LEFT )); 14478a2dd8f0SOliver-Rainer Wittmann aDistLR.SetRight(aDistLR.GetRight() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_RIGHT)); 14488a2dd8f0SOliver-Rainer Wittmann rSet.Put(aDistLR); 14498a2dd8f0SOliver-Rainer Wittmann nLeftBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetLeft()); 14508a2dd8f0SOliver-Rainer Wittmann nRightBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetRight()); 14518a2dd8f0SOliver-Rainer Wittmann } 1452cdf0e10cSrcweir } 1453cdf0e10cSrcweir } 14548a2dd8f0SOliver-Rainer Wittmann break; 14558a2dd8f0SOliver-Rainer Wittmann 1456cdf0e10cSrcweir case SID_RULER_TEXT_RIGHT_TO_LEFT: 1457cdf0e10cSrcweir { 14588a2dd8f0SOliver-Rainer Wittmann if ( nSelType & nsSelectionType::SEL_GRF || 14598a2dd8f0SOliver-Rainer Wittmann nSelType & nsSelectionType::SEL_FRM || 14608a2dd8f0SOliver-Rainer Wittmann nSelType & nsSelectionType::SEL_OLE || 14618a2dd8f0SOliver-Rainer Wittmann nFrmType == FRMTYPE_DRAWOBJ) 14628a2dd8f0SOliver-Rainer Wittmann rSet.DisableItem(nWhich); 14638a2dd8f0SOliver-Rainer Wittmann else 14648a2dd8f0SOliver-Rainer Wittmann { 14658a2dd8f0SOliver-Rainer Wittmann sal_Bool bFlag = rSh.IsInRightToLeftText(); 14668a2dd8f0SOliver-Rainer Wittmann rSet.Put(SfxBoolItem(nWhich, bFlag)); 14678a2dd8f0SOliver-Rainer Wittmann } 1468cdf0e10cSrcweir } 14698a2dd8f0SOliver-Rainer Wittmann break; 14708a2dd8f0SOliver-Rainer Wittmann 1471cdf0e10cSrcweir case SID_RULER_BORDERS_VERTICAL: 1472cdf0e10cSrcweir case SID_RULER_BORDERS: 1473cdf0e10cSrcweir { 14748a2dd8f0SOliver-Rainer Wittmann sal_Bool bFrameHasVerticalColumns(sal_False); 14758a2dd8f0SOliver-Rainer Wittmann { 14768a2dd8f0SOliver-Rainer Wittmann sal_Bool bFrameRTL; 14778a2dd8f0SOliver-Rainer Wittmann sal_Bool bFrameVertL2R; 14788a2dd8f0SOliver-Rainer Wittmann bFrameHasVerticalColumns = rSh.IsFrmVertical(sal_False, bFrameRTL, bFrameVertL2R) && 14798a2dd8f0SOliver-Rainer Wittmann bFrmSelection; 14808a2dd8f0SOliver-Rainer Wittmann } 14818a2dd8f0SOliver-Rainer Wittmann sal_Bool bHasTable = ( IsTabColFromDoc() || 1482cdf0e10cSrcweir ( rSh.GetTableFmt() && !bFrmSelection && 1483cdf0e10cSrcweir !(nFrmType & FRMTYPE_COLSECT ) ) ); 1484cdf0e10cSrcweir 14858a2dd8f0SOliver-Rainer Wittmann sal_Bool bTableVertical = bHasTable && rSh.IsTableVertical(); 1486cdf0e10cSrcweir 14878a2dd8f0SOliver-Rainer Wittmann if( ( (SID_RULER_BORDERS_VERTICAL == nWhich) && 1488cdf0e10cSrcweir ((bHasTable && !bTableVertical)|| 14898a2dd8f0SOliver-Rainer Wittmann (!bVerticalWriting && !bFrmSelection && !bHasTable ) || (bFrmSelection && !bFrameHasVerticalColumns)) ) || 14908a2dd8f0SOliver-Rainer Wittmann ((SID_RULER_BORDERS == nWhich) && 1491cdf0e10cSrcweir ((bHasTable && bTableVertical)|| 14928a2dd8f0SOliver-Rainer Wittmann (bVerticalWriting && !bFrmSelection&& !bHasTable) || bFrameHasVerticalColumns))) 14938a2dd8f0SOliver-Rainer Wittmann rSet.DisableItem(nWhich); 14948a2dd8f0SOliver-Rainer Wittmann else if ( bHasTable ) 14958a2dd8f0SOliver-Rainer Wittmann { 14968a2dd8f0SOliver-Rainer Wittmann SwTabCols aTabCols; 14978a2dd8f0SOliver-Rainer Wittmann sal_uInt16 nNum; 14988a2dd8f0SOliver-Rainer Wittmann if ( 0 != ( bSetTabColFromDoc = IsTabColFromDoc() ) ) 14998a2dd8f0SOliver-Rainer Wittmann { 15008a2dd8f0SOliver-Rainer Wittmann rSh.GetMouseTabCols( aTabCols, aTabColFromDocPos ); 15018a2dd8f0SOliver-Rainer Wittmann nNum = rSh.GetCurMouseTabColNum( aTabColFromDocPos ); 15028a2dd8f0SOliver-Rainer Wittmann } 15038a2dd8f0SOliver-Rainer Wittmann else 15048a2dd8f0SOliver-Rainer Wittmann { 15058a2dd8f0SOliver-Rainer Wittmann rSh.GetTabCols( aTabCols ); 15068a2dd8f0SOliver-Rainer Wittmann nNum = rSh.GetCurTabColNum(); 15078a2dd8f0SOliver-Rainer Wittmann if(rSh.IsTableRightToLeft()) 15088a2dd8f0SOliver-Rainer Wittmann nNum = aTabCols.Count() - nNum; 15098a2dd8f0SOliver-Rainer Wittmann } 1510cdf0e10cSrcweir 15118a2dd8f0SOliver-Rainer Wittmann ASSERT(nNum <= aTabCols.Count(), "TabCol not found"); 15128a2dd8f0SOliver-Rainer Wittmann const int nLft = aTabCols.GetLeftMin() + aTabCols.GetLeft(); 15138a2dd8f0SOliver-Rainer Wittmann const int nRgt = (sal_uInt16)(bTableVertical ? nPageHeight : nPageWidth) - 15148a2dd8f0SOliver-Rainer Wittmann (aTabCols.GetLeftMin() + 15158a2dd8f0SOliver-Rainer Wittmann aTabCols.GetRight()); 15168a2dd8f0SOliver-Rainer Wittmann 15178a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nL = static_cast< sal_uInt16 >(nLft > 0 ? nLft : 0); 15188a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nR = static_cast< sal_uInt16 >(nRgt > 0 ? nRgt : 0); 15198a2dd8f0SOliver-Rainer Wittmann 15208a2dd8f0SOliver-Rainer Wittmann SvxColumnItem aColItem(nNum, nL, nR); 15218a2dd8f0SOliver-Rainer Wittmann 15228a2dd8f0SOliver-Rainer Wittmann sal_uInt16 nStart = 0, 15238a2dd8f0SOliver-Rainer Wittmann nEnd; 15248a2dd8f0SOliver-Rainer Wittmann 15258a2dd8f0SOliver-Rainer Wittmann //columns in right-to-left tables need to be mirrored 15268a2dd8f0SOliver-Rainer Wittmann sal_Bool bIsTableRTL = 15278a2dd8f0SOliver-Rainer Wittmann IsTabColFromDoc() ? 15288a2dd8f0SOliver-Rainer Wittmann rSh.IsMouseTableRightToLeft(aTabColFromDocPos) 1529cdf0e10cSrcweir : rSh.IsTableRightToLeft(); 15308a2dd8f0SOliver-Rainer Wittmann if(bIsTableRTL) 1531cdf0e10cSrcweir { 15328a2dd8f0SOliver-Rainer Wittmann for ( sal_uInt16 i = aTabCols.Count(); i ; --i ) 15338a2dd8f0SOliver-Rainer Wittmann { 15348a2dd8f0SOliver-Rainer Wittmann const SwTabColsEntry& rEntry = aTabCols.GetEntry( i - 1 ); 15358a2dd8f0SOliver-Rainer Wittmann nEnd = (sal_uInt16)aTabCols.GetRight(); 15368a2dd8f0SOliver-Rainer Wittmann nEnd = nEnd - (sal_uInt16)rEntry.nPos; 15378a2dd8f0SOliver-Rainer Wittmann SvxColumnDescription aColDesc( nStart, nEnd, 15388a2dd8f0SOliver-Rainer Wittmann (sal_uInt16(aTabCols.GetRight() - rEntry.nMax)), 15398a2dd8f0SOliver-Rainer Wittmann (sal_uInt16(aTabCols.GetRight() - rEntry.nMin)), 15408a2dd8f0SOliver-Rainer Wittmann !aTabCols.IsHidden(i - 1) ); 15418a2dd8f0SOliver-Rainer Wittmann aColItem.Append(aColDesc); 15428a2dd8f0SOliver-Rainer Wittmann nStart = nEnd; 15438a2dd8f0SOliver-Rainer Wittmann } 15448a2dd8f0SOliver-Rainer Wittmann SvxColumnDescription aColDesc(nStart, 15458a2dd8f0SOliver-Rainer Wittmann aTabCols.GetRight() - aTabCols.GetLeft(), sal_True); 1546cdf0e10cSrcweir aColItem.Append(aColDesc); 1547cdf0e10cSrcweir } 15488a2dd8f0SOliver-Rainer Wittmann else 1549cdf0e10cSrcweir { 15508a2dd8f0SOliver-Rainer Wittmann for ( sal_uInt16 i = 0; i < aTabCols.Count(); ++i ) 15518a2dd8f0SOliver-Rainer Wittmann { 15528a2dd8f0SOliver-Rainer Wittmann const SwTabColsEntry& rEntry = aTabCols.GetEntry( i ); 15538a2dd8f0SOliver-Rainer Wittmann nEnd = static_cast< sal_uInt16 >(rEntry.nPos - aTabCols.GetLeft()); 15548a2dd8f0SOliver-Rainer Wittmann SvxColumnDescription aColDesc( nStart, nEnd, 1555cdf0e10cSrcweir rEntry.nMin - aTabCols.GetLeft(), rEntry.nMax - aTabCols.GetLeft(), 15568a2dd8f0SOliver-Rainer Wittmann !aTabCols.IsHidden(i) ); 15578a2dd8f0SOliver-Rainer Wittmann aColItem.Append(aColDesc); 15588a2dd8f0SOliver-Rainer Wittmann nStart = nEnd; 15598a2dd8f0SOliver-Rainer Wittmann } 15608a2dd8f0SOliver-Rainer Wittmann SvxColumnDescription aColDesc(nStart, aTabCols.GetRight() - aTabCols.GetLeft(), 15618a2dd8f0SOliver-Rainer Wittmann 0, 0, 15628a2dd8f0SOliver-Rainer Wittmann sal_True); 1563cdf0e10cSrcweir aColItem.Append(aColDesc); 1564cdf0e10cSrcweir } 15658a2dd8f0SOliver-Rainer Wittmann rSet.Put(aColItem, nWhich); 1566cdf0e10cSrcweir } 15678a2dd8f0SOliver-Rainer Wittmann else if ( bFrmSelection || nFrmType & ( FRMTYPE_COLUMN | FRMTYPE_COLSECT ) ) 15688a2dd8f0SOliver-Rainer Wittmann { 15698a2dd8f0SOliver-Rainer Wittmann // Aus Rahmen oder Seite ? 15708a2dd8f0SOliver-Rainer Wittmann sal_uInt16 nNum = 0; 15718a2dd8f0SOliver-Rainer Wittmann if(bFrmSelection) 15728a2dd8f0SOliver-Rainer Wittmann { 15738a2dd8f0SOliver-Rainer Wittmann const SwFrmFmt* pFmt = rSh.GetFlyFrmFmt(); 15748a2dd8f0SOliver-Rainer Wittmann if(pFmt) 15758a2dd8f0SOliver-Rainer Wittmann nNum = pFmt->GetCol().GetNumCols(); 15768a2dd8f0SOliver-Rainer Wittmann } 15778a2dd8f0SOliver-Rainer Wittmann else 15788a2dd8f0SOliver-Rainer Wittmann nNum = rSh.GetCurColNum(); 15798a2dd8f0SOliver-Rainer Wittmann 15808a2dd8f0SOliver-Rainer Wittmann if( 15818a2dd8f0SOliver-Rainer Wittmann //eigentlich sollte FRMTYPE_COLSECT nicht enthalten sein, wenn der Rahmen selektiert ist! 15828a2dd8f0SOliver-Rainer Wittmann !bFrmSelection && 15838a2dd8f0SOliver-Rainer Wittmann nFrmType & FRMTYPE_COLSECT ) 15848a2dd8f0SOliver-Rainer Wittmann { 15858a2dd8f0SOliver-Rainer Wittmann const SwSection *pSect = rSh.GetAnySection(sal_False, pPt); 15868a2dd8f0SOliver-Rainer Wittmann ASSERT( pSect, "Welcher Bereich?"); 15878a2dd8f0SOliver-Rainer Wittmann if( pSect ) 15888a2dd8f0SOliver-Rainer Wittmann { 15898a2dd8f0SOliver-Rainer Wittmann SwSectionFmt *pFmt = pSect->GetFmt(); 15908a2dd8f0SOliver-Rainer Wittmann const SwFmtCol& rCol = pFmt->GetCol(); 15918a2dd8f0SOliver-Rainer Wittmann if(rSh.IsInRightToLeftText()) 15928a2dd8f0SOliver-Rainer Wittmann nNum = rCol.GetColumns().Count() - nNum; 15938a2dd8f0SOliver-Rainer Wittmann else 15948a2dd8f0SOliver-Rainer Wittmann --nNum; 15958a2dd8f0SOliver-Rainer Wittmann SvxColumnItem aColItem(nNum); 15968a2dd8f0SOliver-Rainer Wittmann SwRect aRect = rSh.GetAnyCurRect(RECT_SECTION_PRT, pPt); 15978a2dd8f0SOliver-Rainer Wittmann const SwRect aTmpRect = rSh.GetAnyCurRect(RECT_SECTION, pPt); 15988a2dd8f0SOliver-Rainer Wittmann 15998a2dd8f0SOliver-Rainer Wittmann ::lcl_FillSvxColumn(rCol, sal_uInt16(bVerticalWriting ? aRect.Height() : aRect.Width()), aColItem, 0); 16008a2dd8f0SOliver-Rainer Wittmann 16018a2dd8f0SOliver-Rainer Wittmann if(bVerticalWriting) 16028a2dd8f0SOliver-Rainer Wittmann { 16038a2dd8f0SOliver-Rainer Wittmann aRect.Pos() += Point(aTmpRect.Left(), aTmpRect.Top()); 16048a2dd8f0SOliver-Rainer Wittmann aRect.Pos().Y() -= rPageRect.Top(); 16058a2dd8f0SOliver-Rainer Wittmann aColItem.SetLeft ((sal_uInt16)(aRect.Top())); 16068a2dd8f0SOliver-Rainer Wittmann aColItem.SetRight((sal_uInt16)(nPageHeight - aRect.Bottom() )); 16078a2dd8f0SOliver-Rainer Wittmann } 16088a2dd8f0SOliver-Rainer Wittmann else 16098a2dd8f0SOliver-Rainer Wittmann { 16108a2dd8f0SOliver-Rainer Wittmann aRect.Pos() += aTmpRect.Pos(); 16118a2dd8f0SOliver-Rainer Wittmann 16128a2dd8f0SOliver-Rainer Wittmann // PAGES01 16138a2dd8f0SOliver-Rainer Wittmann // make relative to page position: 16148a2dd8f0SOliver-Rainer Wittmann aColItem.SetLeft ((sal_uInt16)( aRect.Left() - rPageRect.Left() )); 16158a2dd8f0SOliver-Rainer Wittmann aColItem.SetRight((sal_uInt16)( rPageRect.Right() - aRect.Right())); 16168a2dd8f0SOliver-Rainer Wittmann } 16178a2dd8f0SOliver-Rainer Wittmann aColItem.SetOrtho(aColItem.CalcOrtho()); 16188a2dd8f0SOliver-Rainer Wittmann 16198a2dd8f0SOliver-Rainer Wittmann rSet.Put(aColItem, nWhich); 16208a2dd8f0SOliver-Rainer Wittmann } 16218a2dd8f0SOliver-Rainer Wittmann } 16228a2dd8f0SOliver-Rainer Wittmann else if( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY ) 16238a2dd8f0SOliver-Rainer Wittmann { 16248a2dd8f0SOliver-Rainer Wittmann // Spalten in Rahmen 16258a2dd8f0SOliver-Rainer Wittmann if ( nNum ) 16268a2dd8f0SOliver-Rainer Wittmann { 16278a2dd8f0SOliver-Rainer Wittmann const SwFrmFmt* pFmt = rSh.GetFlyFrmFmt() ; 16288a2dd8f0SOliver-Rainer Wittmann 16298a2dd8f0SOliver-Rainer Wittmann const SwFmtCol& rCol = pFmt->GetCol(); 16308a2dd8f0SOliver-Rainer Wittmann if(rSh.IsInRightToLeftText()) 16318a2dd8f0SOliver-Rainer Wittmann nNum = rCol.GetColumns().Count() - nNum; 16328a2dd8f0SOliver-Rainer Wittmann else 16338a2dd8f0SOliver-Rainer Wittmann nNum--; 16348a2dd8f0SOliver-Rainer Wittmann SvxColumnItem aColItem(nNum); 16358a2dd8f0SOliver-Rainer Wittmann const SwRect &rSizeRect = rSh.GetAnyCurRect(RECT_FLY_PRT_EMBEDDED, pPt); 16368a2dd8f0SOliver-Rainer Wittmann 16378a2dd8f0SOliver-Rainer Wittmann sal_Bool bUseVertical = bFrameHasVerticalColumns || (!bFrmSelection && bVerticalWriting); 16388a2dd8f0SOliver-Rainer Wittmann const long lWidth = bUseVertical ? rSizeRect.Height() : rSizeRect.Width(); 16398a2dd8f0SOliver-Rainer Wittmann const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED, pPt); 16408a2dd8f0SOliver-Rainer Wittmann long nDist2 = ((bUseVertical ? rRect.Height() : rRect.Width()) - lWidth) /2; 16418a2dd8f0SOliver-Rainer Wittmann ::lcl_FillSvxColumn(rCol, sal_uInt16(lWidth), aColItem, nDist2); 16428a2dd8f0SOliver-Rainer Wittmann 16438a2dd8f0SOliver-Rainer Wittmann SfxItemSet aFrameSet(GetPool(), RES_LR_SPACE, RES_LR_SPACE); 16448a2dd8f0SOliver-Rainer Wittmann rSh.GetFlyFrmAttr( aFrameSet ); 16458a2dd8f0SOliver-Rainer Wittmann 16468a2dd8f0SOliver-Rainer Wittmann if(bUseVertical) 16478a2dd8f0SOliver-Rainer Wittmann { 16488a2dd8f0SOliver-Rainer Wittmann aColItem.SetLeft ((sal_uInt16)(rRect.Top()- rPageRect.Top())); 16498a2dd8f0SOliver-Rainer Wittmann aColItem.SetRight((sal_uInt16)(nPageHeight + rPageRect.Top() - rRect.Bottom() )); 16508a2dd8f0SOliver-Rainer Wittmann } 16518a2dd8f0SOliver-Rainer Wittmann else 16528a2dd8f0SOliver-Rainer Wittmann { 16538a2dd8f0SOliver-Rainer Wittmann aColItem.SetLeft ((sal_uInt16)(rRect.Left() - rPageRect.Left() )); 16548a2dd8f0SOliver-Rainer Wittmann aColItem.SetRight((sal_uInt16)(rPageRect.Right() - rRect.Right() )); 16558a2dd8f0SOliver-Rainer Wittmann } 16568a2dd8f0SOliver-Rainer Wittmann 16578a2dd8f0SOliver-Rainer Wittmann aColItem.SetOrtho(aColItem.CalcOrtho()); 16588a2dd8f0SOliver-Rainer Wittmann 16598a2dd8f0SOliver-Rainer Wittmann rSet.Put(aColItem, nWhich); 16608a2dd8f0SOliver-Rainer Wittmann } 16618a2dd8f0SOliver-Rainer Wittmann else 16628a2dd8f0SOliver-Rainer Wittmann rSet.DisableItem(nWhich); 16638a2dd8f0SOliver-Rainer Wittmann } 16648a2dd8f0SOliver-Rainer Wittmann else 16658a2dd8f0SOliver-Rainer Wittmann { // Spalten auf der Seite 16668a2dd8f0SOliver-Rainer Wittmann const SwFrmFmt& rMaster = rDesc.GetMaster(); 16678a2dd8f0SOliver-Rainer Wittmann SwFmtCol aCol(rMaster.GetCol()); 16688a2dd8f0SOliver-Rainer Wittmann if(rFrameDir.GetValue() == FRMDIR_HORI_RIGHT_TOP) 16698a2dd8f0SOliver-Rainer Wittmann nNum = aCol.GetColumns().Count() - nNum; 16708a2dd8f0SOliver-Rainer Wittmann else 16718a2dd8f0SOliver-Rainer Wittmann nNum--; 16728a2dd8f0SOliver-Rainer Wittmann 16738a2dd8f0SOliver-Rainer Wittmann SvxColumnItem aColItem(nNum); 16748a2dd8f0SOliver-Rainer Wittmann const SwRect aPrtRect = rSh.GetAnyCurRect(RECT_PAGE_PRT, pPt); 16758a2dd8f0SOliver-Rainer Wittmann const SvxBoxItem& rBox = (const SvxBoxItem&)rMaster.GetFmtAttr(RES_BOX); 16768a2dd8f0SOliver-Rainer Wittmann long nDist = rBox.GetDistance(); 16778a2dd8f0SOliver-Rainer Wittmann ::lcl_FillSvxColumn(aCol, 16788a2dd8f0SOliver-Rainer Wittmann sal_uInt16(bVerticalWriting ? aPrtRect.Height() : aPrtRect.Width() ), 16798a2dd8f0SOliver-Rainer Wittmann aColItem, nDist); 16808a2dd8f0SOliver-Rainer Wittmann 16818a2dd8f0SOliver-Rainer Wittmann if(bBrowse) 16828a2dd8f0SOliver-Rainer Wittmann { 16838a2dd8f0SOliver-Rainer Wittmann aColItem.SetLeft((sal_uInt16)rPagePrtRect.Left()); 16848a2dd8f0SOliver-Rainer Wittmann aColItem.SetRight(sal_uInt16(nPageWidth - rPagePrtRect.Right())); 16858a2dd8f0SOliver-Rainer Wittmann } 16868a2dd8f0SOliver-Rainer Wittmann else 16878a2dd8f0SOliver-Rainer Wittmann { 16888a2dd8f0SOliver-Rainer Wittmann aColItem.SetLeft (aPageLRSpace.GetLeft()); 16898a2dd8f0SOliver-Rainer Wittmann aColItem.SetRight(aPageLRSpace.GetRight()); 16908a2dd8f0SOliver-Rainer Wittmann } 16918a2dd8f0SOliver-Rainer Wittmann aColItem.SetOrtho(aColItem.CalcOrtho()); 16928a2dd8f0SOliver-Rainer Wittmann 16938a2dd8f0SOliver-Rainer Wittmann rSet.Put(aColItem, nWhich); 16948a2dd8f0SOliver-Rainer Wittmann } 16958a2dd8f0SOliver-Rainer Wittmann } 16968a2dd8f0SOliver-Rainer Wittmann else 16978a2dd8f0SOliver-Rainer Wittmann rSet.DisableItem(nWhich); 16988a2dd8f0SOliver-Rainer Wittmann break; 16998a2dd8f0SOliver-Rainer Wittmann } 1700cdf0e10cSrcweir 1701cdf0e10cSrcweir case SID_RULER_ROWS : 1702cdf0e10cSrcweir case SID_RULER_ROWS_VERTICAL: 1703cdf0e10cSrcweir { 17048a2dd8f0SOliver-Rainer Wittmann sal_Bool bFrameHasVerticalColumns(sal_False); 17058a2dd8f0SOliver-Rainer Wittmann { 17068a2dd8f0SOliver-Rainer Wittmann sal_Bool bFrameRTL; 17078a2dd8f0SOliver-Rainer Wittmann sal_Bool bFrameVertL2R; 17088a2dd8f0SOliver-Rainer Wittmann bFrameHasVerticalColumns = rSh.IsFrmVertical(sal_False, bFrameRTL, bFrameVertL2R) && 17098a2dd8f0SOliver-Rainer Wittmann bFrmSelection; 17108a2dd8f0SOliver-Rainer Wittmann } 1711cdf0e10cSrcweir 17128a2dd8f0SOliver-Rainer Wittmann if( ( (SID_RULER_ROWS == nWhich) && 1713cdf0e10cSrcweir ((!bVerticalWriting && !bFrmSelection) || (bFrmSelection && !bFrameHasVerticalColumns)) ) || 17148a2dd8f0SOliver-Rainer Wittmann ((SID_RULER_ROWS_VERTICAL == nWhich) && 1715cdf0e10cSrcweir ((bVerticalWriting && !bFrmSelection) || bFrameHasVerticalColumns))) 17168a2dd8f0SOliver-Rainer Wittmann rSet.DisableItem(nWhich); 17178a2dd8f0SOliver-Rainer Wittmann else if ( IsTabRowFromDoc() || 1718cdf0e10cSrcweir ( rSh.GetTableFmt() && !bFrmSelection && 1719cdf0e10cSrcweir !(nFrmType & FRMTYPE_COLSECT ) ) ) 1720cdf0e10cSrcweir { 17218a2dd8f0SOliver-Rainer Wittmann SwTabCols aTabCols; 17228a2dd8f0SOliver-Rainer Wittmann //no current value necessary 17238a2dd8f0SOliver-Rainer Wittmann sal_uInt16 nNum = 0; 17248a2dd8f0SOliver-Rainer Wittmann if ( 0 != ( bSetTabRowFromDoc = IsTabRowFromDoc() ) ) 17258a2dd8f0SOliver-Rainer Wittmann { 17268a2dd8f0SOliver-Rainer Wittmann rSh.GetMouseTabRows( aTabCols, aTabColFromDocPos ); 17278a2dd8f0SOliver-Rainer Wittmann } 17288a2dd8f0SOliver-Rainer Wittmann else 17298a2dd8f0SOliver-Rainer Wittmann { 17308a2dd8f0SOliver-Rainer Wittmann rSh.GetTabRows( aTabCols ); 17318a2dd8f0SOliver-Rainer Wittmann } 1732cdf0e10cSrcweir 17338a2dd8f0SOliver-Rainer Wittmann // ASSERT(nNum <= aTabCols.Count(), "TabCol not found"); 17348a2dd8f0SOliver-Rainer Wittmann const int nLft = aTabCols.GetLeftMin(); 17358a2dd8f0SOliver-Rainer Wittmann const int nRgt = (sal_uInt16)(bVerticalWriting ? nPageWidth : nPageHeight) - 17368a2dd8f0SOliver-Rainer Wittmann (aTabCols.GetLeftMin() + 17378a2dd8f0SOliver-Rainer Wittmann aTabCols.GetRight()); 1738cdf0e10cSrcweir 17398a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nL = static_cast< sal_uInt16 >(nLft > 0 ? nLft : 0); 17408a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nR = static_cast< sal_uInt16 >(nRgt > 0 ? nRgt : 0); 1741cdf0e10cSrcweir 17428a2dd8f0SOliver-Rainer Wittmann SvxColumnItem aColItem(nNum, nL, nR); 1743cdf0e10cSrcweir 17448a2dd8f0SOliver-Rainer Wittmann sal_uInt16 nStart = 0, 17458a2dd8f0SOliver-Rainer Wittmann nEnd; 1746cdf0e10cSrcweir 17478a2dd8f0SOliver-Rainer Wittmann for ( sal_uInt16 i = 0; i < aTabCols.Count(); ++i ) 17488a2dd8f0SOliver-Rainer Wittmann { 17498a2dd8f0SOliver-Rainer Wittmann const SwTabColsEntry& rEntry = aTabCols.GetEntry( i ); 17508a2dd8f0SOliver-Rainer Wittmann if(bVerticalWriting) 17518a2dd8f0SOliver-Rainer Wittmann { 17528a2dd8f0SOliver-Rainer Wittmann nEnd = sal_uInt16(aTabCols.GetRight() - rEntry.nPos); 17538a2dd8f0SOliver-Rainer Wittmann SvxColumnDescription aColDesc( nStart, nEnd, 17548a2dd8f0SOliver-Rainer Wittmann aTabCols.GetRight() - rEntry.nMax, aTabCols.GetRight() - rEntry.nMin, 17558a2dd8f0SOliver-Rainer Wittmann !aTabCols.IsHidden(i) ); 17568a2dd8f0SOliver-Rainer Wittmann aColItem.Append(aColDesc); 17578a2dd8f0SOliver-Rainer Wittmann } 17588a2dd8f0SOliver-Rainer Wittmann else 17598a2dd8f0SOliver-Rainer Wittmann { 17608a2dd8f0SOliver-Rainer Wittmann nEnd = sal_uInt16(rEntry.nPos - aTabCols.GetLeft()); 17618a2dd8f0SOliver-Rainer Wittmann SvxColumnDescription aColDesc( nStart, nEnd, 1762cdf0e10cSrcweir sal_uInt16(rEntry.nMin - aTabCols.GetLeft()), sal_uInt16(rEntry.nMax - aTabCols.GetLeft()), 17638a2dd8f0SOliver-Rainer Wittmann !aTabCols.IsHidden(i) ); 17648a2dd8f0SOliver-Rainer Wittmann aColItem.Append(aColDesc); 17658a2dd8f0SOliver-Rainer Wittmann } 17668a2dd8f0SOliver-Rainer Wittmann nStart = nEnd; 17678a2dd8f0SOliver-Rainer Wittmann } 17688a2dd8f0SOliver-Rainer Wittmann if(bVerticalWriting) 17698a2dd8f0SOliver-Rainer Wittmann nEnd = static_cast< sal_uInt16 >(aTabCols.GetRight()); 17708a2dd8f0SOliver-Rainer Wittmann else 17718a2dd8f0SOliver-Rainer Wittmann nEnd = static_cast< sal_uInt16 >(aTabCols.GetLeft()); 17728a2dd8f0SOliver-Rainer Wittmann // put a position protection when the last row cannot be moved 17738a2dd8f0SOliver-Rainer Wittmann // due to a page break inside of a row 17748a2dd8f0SOliver-Rainer Wittmann if(!aTabCols.IsLastRowAllowedToChange()) 17758a2dd8f0SOliver-Rainer Wittmann bPutContentProtection = sal_True; 17768a2dd8f0SOliver-Rainer Wittmann 17778a2dd8f0SOliver-Rainer Wittmann SvxColumnDescription aColDesc( nStart, nEnd, 17788a2dd8f0SOliver-Rainer Wittmann aTabCols.GetRight(), aTabCols.GetRight(), 17798a2dd8f0SOliver-Rainer Wittmann sal_False ); 17808a2dd8f0SOliver-Rainer Wittmann aColItem.Append(aColDesc); 17818a2dd8f0SOliver-Rainer Wittmann 17828a2dd8f0SOliver-Rainer Wittmann rSet.Put(aColItem, nWhich); 1783cdf0e10cSrcweir } 1784cdf0e10cSrcweir else 17858a2dd8f0SOliver-Rainer Wittmann rSet.DisableItem(nWhich); 1786cdf0e10cSrcweir } 17878a2dd8f0SOliver-Rainer Wittmann break; 1788cdf0e10cSrcweir 17898a2dd8f0SOliver-Rainer Wittmann case SID_RULER_PAGE_POS: 17908a2dd8f0SOliver-Rainer Wittmann { 17918a2dd8f0SOliver-Rainer Wittmann // PAGES01 17928a2dd8f0SOliver-Rainer Wittmann SvxPagePosSizeItem aPagePosSize( 17938a2dd8f0SOliver-Rainer Wittmann Point( rPageRect.Left(), rPageRect.Top()) , nPageWidth, nPageHeight); 1794cdf0e10cSrcweir 17958a2dd8f0SOliver-Rainer Wittmann rSet.Put(aPagePosSize); 17968a2dd8f0SOliver-Rainer Wittmann break; 17978a2dd8f0SOliver-Rainer Wittmann } 1798cdf0e10cSrcweir 17998a2dd8f0SOliver-Rainer Wittmann case SID_RULER_LR_MIN_MAX: 18008a2dd8f0SOliver-Rainer Wittmann { 18018a2dd8f0SOliver-Rainer Wittmann Rectangle aRectangle; 18028a2dd8f0SOliver-Rainer Wittmann if( ( nFrmType & FRMTYPE_COLSECT ) && !IsTabColFromDoc() && 18038a2dd8f0SOliver-Rainer Wittmann ( nFrmType & ( FRMTYPE_TABLE|FRMTYPE_COLUMN ) ) ) 18048a2dd8f0SOliver-Rainer Wittmann { 18058a2dd8f0SOliver-Rainer Wittmann if( nFrmType & FRMTYPE_TABLE ) 18068a2dd8f0SOliver-Rainer Wittmann { 18078a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nNum = rSh.GetCurTabColNum(); 18088a2dd8f0SOliver-Rainer Wittmann SwTabCols aTabCols; 18098a2dd8f0SOliver-Rainer Wittmann rSh.GetTabCols( aTabCols ); 18108a2dd8f0SOliver-Rainer Wittmann 18118a2dd8f0SOliver-Rainer Wittmann const int nLft = aTabCols.GetLeftMin() + aTabCols.GetLeft(); 18128a2dd8f0SOliver-Rainer Wittmann const int nRgt = (sal_uInt16)nPageWidth -(aTabCols.GetLeftMin() + aTabCols.GetRight()); 18138a2dd8f0SOliver-Rainer Wittmann 18148a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nL = static_cast< sal_uInt16 >(nLft > 0 ? nLft : 0); 18158a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nR = static_cast< sal_uInt16 >(nRgt > 0 ? nRgt : 0); 18168a2dd8f0SOliver-Rainer Wittmann 18178a2dd8f0SOliver-Rainer Wittmann aRectangle.Left() = nL; 18188a2dd8f0SOliver-Rainer Wittmann if(nNum > 1) 18198a2dd8f0SOliver-Rainer Wittmann aRectangle.Left() += aTabCols[nNum - 2]; 18208a2dd8f0SOliver-Rainer Wittmann if(nNum) 18218a2dd8f0SOliver-Rainer Wittmann aRectangle.Left() += MINLAY; 18228a2dd8f0SOliver-Rainer Wittmann if(aTabCols.Count() <= nNum + 1 ) 18238a2dd8f0SOliver-Rainer Wittmann aRectangle.Right() = nR; 18248a2dd8f0SOliver-Rainer Wittmann else 18258a2dd8f0SOliver-Rainer Wittmann aRectangle.Right() = nPageWidth - (nL + aTabCols[nNum + 1]); 18268a2dd8f0SOliver-Rainer Wittmann 18278a2dd8f0SOliver-Rainer Wittmann if(nNum < aTabCols.Count()) 18288a2dd8f0SOliver-Rainer Wittmann aRectangle.Right() += MINLAY; 18298a2dd8f0SOliver-Rainer Wittmann } 18308a2dd8f0SOliver-Rainer Wittmann else 18318a2dd8f0SOliver-Rainer Wittmann { 18328a2dd8f0SOliver-Rainer Wittmann const SwFrmFmt* pFmt = rSh.GetFlyFrmFmt(); 18338a2dd8f0SOliver-Rainer Wittmann const SwFmtCol* pCols = pFmt ? &pFmt->GetCol(): 18348a2dd8f0SOliver-Rainer Wittmann &rDesc.GetMaster().GetCol(); 18358a2dd8f0SOliver-Rainer Wittmann const SwColumns& rCols = pCols->GetColumns(); 18368a2dd8f0SOliver-Rainer Wittmann sal_uInt16 nNum = rSh.GetCurOutColNum(); 18378a2dd8f0SOliver-Rainer Wittmann sal_uInt16 nCount = Min(sal_uInt16(nNum + 1), rCols.Count()); 18388a2dd8f0SOliver-Rainer Wittmann const SwRect aRect( rSh.GetAnyCurRect( pFmt 18398a2dd8f0SOliver-Rainer Wittmann ? RECT_FLY_PRT_EMBEDDED 18408a2dd8f0SOliver-Rainer Wittmann : RECT_PAGE_PRT, pPt )); 18418a2dd8f0SOliver-Rainer Wittmann const SwRect aAbsRect( rSh.GetAnyCurRect( pFmt 18428a2dd8f0SOliver-Rainer Wittmann ? RECT_FLY_EMBEDDED 18438a2dd8f0SOliver-Rainer Wittmann : RECT_PAGE, pPt )); 18448a2dd8f0SOliver-Rainer Wittmann 18458a2dd8f0SOliver-Rainer Wittmann //die Breite im Rahmen bzw. innerhalbe der Seitenraender 18468a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nTotalWidth = (sal_uInt16)aRect.Width(); 18478a2dd8f0SOliver-Rainer Wittmann //die gesamte Rahmenbreite - die Differenz ist der doppelte Abstand zum Rand 18488a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nOuterWidth = (sal_uInt16)aAbsRect.Width(); 18498a2dd8f0SOliver-Rainer Wittmann int nWidth = 0, 18508a2dd8f0SOliver-Rainer Wittmann nStart = 0, 18518a2dd8f0SOliver-Rainer Wittmann nEnd = 0; 18528a2dd8f0SOliver-Rainer Wittmann aRectangle.Left() = 0; 18538a2dd8f0SOliver-Rainer Wittmann for ( sal_uInt16 i = 0; i < nCount; ++i ) 18548a2dd8f0SOliver-Rainer Wittmann { 18558a2dd8f0SOliver-Rainer Wittmann SwColumn* pCol = rCols[i]; 18568a2dd8f0SOliver-Rainer Wittmann nStart = pCol->GetLeft() + nWidth; 18578a2dd8f0SOliver-Rainer Wittmann if(i == nNum - 2) 18588a2dd8f0SOliver-Rainer Wittmann aRectangle.Left() = nStart; 18598a2dd8f0SOliver-Rainer Wittmann nWidth += pCols->CalcColWidth( i, nTotalWidth ); 18608a2dd8f0SOliver-Rainer Wittmann nEnd = nWidth - pCol->GetRight(); 18618a2dd8f0SOliver-Rainer Wittmann } 18628a2dd8f0SOliver-Rainer Wittmann aRectangle.Right() = rPageRect.Right() - nEnd; 18638a2dd8f0SOliver-Rainer Wittmann aRectangle.Left() -= rPageRect.Left(); 18648a2dd8f0SOliver-Rainer Wittmann 18658a2dd8f0SOliver-Rainer Wittmann if(nNum > 1) 18668a2dd8f0SOliver-Rainer Wittmann { 18678a2dd8f0SOliver-Rainer Wittmann aRectangle.Left() += MINLAY; 18688a2dd8f0SOliver-Rainer Wittmann aRectangle.Left() += aRect.Left(); 18698a2dd8f0SOliver-Rainer Wittmann } 18708a2dd8f0SOliver-Rainer Wittmann if(pFmt) //Bereich in Rahmen - hier darf man bis zum Rand 18718a2dd8f0SOliver-Rainer Wittmann aRectangle.Left() = aRectangle.Right() = 0; 18728a2dd8f0SOliver-Rainer Wittmann else 18738a2dd8f0SOliver-Rainer Wittmann { 18748a2dd8f0SOliver-Rainer Wittmann // das Rechteck an die richtige absolute Position verschieben 18758a2dd8f0SOliver-Rainer Wittmann aRectangle.Left() += aAbsRect.Left(); 18768a2dd8f0SOliver-Rainer Wittmann aRectangle.Right() -= aAbsRect.Left(); 18778a2dd8f0SOliver-Rainer Wittmann // Abstand zur Umrandung mit einbeziehen 18788a2dd8f0SOliver-Rainer Wittmann aRectangle.Right() -= (nOuterWidth - nTotalWidth) / 2; 18798a2dd8f0SOliver-Rainer Wittmann } 18808a2dd8f0SOliver-Rainer Wittmann 18818a2dd8f0SOliver-Rainer Wittmann if(nNum < rCols.Count()) 18828a2dd8f0SOliver-Rainer Wittmann { 18838a2dd8f0SOliver-Rainer Wittmann aRectangle.Right() += MINLAY; 18848a2dd8f0SOliver-Rainer Wittmann } 18858a2dd8f0SOliver-Rainer Wittmann else 18868a2dd8f0SOliver-Rainer Wittmann // rechts ist jetzt nur noch der Seitenrand 18878a2dd8f0SOliver-Rainer Wittmann aRectangle.Right() = 0; 1888cdf0e10cSrcweir 18898a2dd8f0SOliver-Rainer Wittmann 18908a2dd8f0SOliver-Rainer Wittmann } 18918a2dd8f0SOliver-Rainer Wittmann } 18928a2dd8f0SOliver-Rainer Wittmann else if ( ((nFrmType & FRMTYPE_TABLE) || IsTabColFromDoc()) && 18938a2dd8f0SOliver-Rainer Wittmann !bFrmSelection ) 18948a2dd8f0SOliver-Rainer Wittmann { 18958a2dd8f0SOliver-Rainer Wittmann sal_Bool bColumn; 18968a2dd8f0SOliver-Rainer Wittmann if ( IsTabColFromDoc() ) 18978a2dd8f0SOliver-Rainer Wittmann bColumn = rSh.GetCurMouseColNum( aTabColFromDocPos ) != 0; 18988a2dd8f0SOliver-Rainer Wittmann else 18998a2dd8f0SOliver-Rainer Wittmann bColumn = (nFrmType & (FRMTYPE_COLUMN|FRMTYPE_FLY_ANY|FRMTYPE_COLSECTOUTTAB)) 19008a2dd8f0SOliver-Rainer Wittmann ? sal_True 19018a2dd8f0SOliver-Rainer Wittmann : sal_False; 19028a2dd8f0SOliver-Rainer Wittmann if ( !bColumn ) 19038a2dd8f0SOliver-Rainer Wittmann { 19048a2dd8f0SOliver-Rainer Wittmann if( nFrmType & FRMTYPE_FLY_ANY && IsTabColFromDoc() ) 19058a2dd8f0SOliver-Rainer Wittmann { 19068a2dd8f0SOliver-Rainer Wittmann SwRect aRect( rSh.GetAnyCurRect( 19078a2dd8f0SOliver-Rainer Wittmann RECT_FLY_PRT_EMBEDDED, pPt ) ); 19088a2dd8f0SOliver-Rainer Wittmann aRect.Pos() += rSh.GetAnyCurRect( RECT_FLY_EMBEDDED, 19098a2dd8f0SOliver-Rainer Wittmann pPt ).Pos(); 19108a2dd8f0SOliver-Rainer Wittmann 19118a2dd8f0SOliver-Rainer Wittmann aRectangle.Left() = aRect.Left() - rPageRect.Left(); 19128a2dd8f0SOliver-Rainer Wittmann aRectangle.Right() = rPageRect.Right() - aRect.Right(); 19138a2dd8f0SOliver-Rainer Wittmann } 19148a2dd8f0SOliver-Rainer Wittmann else if( bBrowse ) 19158a2dd8f0SOliver-Rainer Wittmann { 19168a2dd8f0SOliver-Rainer Wittmann aRectangle.Left() = rPagePrtRect.Left(); 19178a2dd8f0SOliver-Rainer Wittmann aRectangle.Right() = nPageWidth - rPagePrtRect.Right(); 19188a2dd8f0SOliver-Rainer Wittmann } 19198a2dd8f0SOliver-Rainer Wittmann else 19208a2dd8f0SOliver-Rainer Wittmann { 19218a2dd8f0SOliver-Rainer Wittmann aRectangle.Left() = aPageLRSpace.GetLeft(); 19228a2dd8f0SOliver-Rainer Wittmann aRectangle.Right() = aPageLRSpace.GetRight(); 19238a2dd8f0SOliver-Rainer Wittmann } 19248a2dd8f0SOliver-Rainer Wittmann } 19258a2dd8f0SOliver-Rainer Wittmann else 19268a2dd8f0SOliver-Rainer Wittmann { //hier nur fuer Tabelle in mehrspaltigen Seiten und Rahmen 19278a2dd8f0SOliver-Rainer Wittmann sal_Bool bSectOutTbl = (nFrmType & FRMTYPE_TABLE) ? sal_True : sal_False; 19288a2dd8f0SOliver-Rainer Wittmann sal_Bool bFrame = (nFrmType & FRMTYPE_FLY_ANY) ? sal_True : sal_False; 19298a2dd8f0SOliver-Rainer Wittmann sal_Bool bColSct = (nFrmType & ( bSectOutTbl 19308a2dd8f0SOliver-Rainer Wittmann ? FRMTYPE_COLSECTOUTTAB 19318a2dd8f0SOliver-Rainer Wittmann : FRMTYPE_COLSECT ) 19328a2dd8f0SOliver-Rainer Wittmann ) ? sal_True : sal_False; 19338a2dd8f0SOliver-Rainer Wittmann //Damit man auch mit der Mouse ziehen kann, 19348a2dd8f0SOliver-Rainer Wittmann //ohne in der Tabelle zu stehen 19358a2dd8f0SOliver-Rainer Wittmann CurRectType eRecType = RECT_PAGE_PRT; 19368a2dd8f0SOliver-Rainer Wittmann sal_uInt16 nNum = IsTabColFromDoc() ? 19378a2dd8f0SOliver-Rainer Wittmann rSh.GetCurMouseColNum( aTabColFromDocPos ): 19388a2dd8f0SOliver-Rainer Wittmann rSh.GetCurOutColNum(); 19398a2dd8f0SOliver-Rainer Wittmann const SwFrmFmt* pFmt = NULL; 19408a2dd8f0SOliver-Rainer Wittmann if( bColSct ) 19418a2dd8f0SOliver-Rainer Wittmann { 19428a2dd8f0SOliver-Rainer Wittmann eRecType = bSectOutTbl ? RECT_OUTTABSECTION 19438a2dd8f0SOliver-Rainer Wittmann : RECT_SECTION; 19448a2dd8f0SOliver-Rainer Wittmann const SwSection *pSect = rSh.GetAnySection( bSectOutTbl, pPt ); 19458a2dd8f0SOliver-Rainer Wittmann ASSERT( pSect, "Welcher Bereich?"); 19468a2dd8f0SOliver-Rainer Wittmann pFmt = pSect->GetFmt(); 19478a2dd8f0SOliver-Rainer Wittmann } 19488a2dd8f0SOliver-Rainer Wittmann else if( bFrame ) 19498a2dd8f0SOliver-Rainer Wittmann { 19508a2dd8f0SOliver-Rainer Wittmann pFmt = rSh.GetFlyFrmFmt(); 19518a2dd8f0SOliver-Rainer Wittmann eRecType = RECT_FLY_PRT_EMBEDDED; 19528a2dd8f0SOliver-Rainer Wittmann } 19538a2dd8f0SOliver-Rainer Wittmann 19548a2dd8f0SOliver-Rainer Wittmann const SwFmtCol* pCols = pFmt ? &pFmt->GetCol(): 19558a2dd8f0SOliver-Rainer Wittmann &rDesc.GetMaster().GetCol(); 19568a2dd8f0SOliver-Rainer Wittmann const SwColumns& rCols = pCols->GetColumns(); 19578a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nBorder = pFmt ? pFmt->GetBox().GetDistance() : 19588a2dd8f0SOliver-Rainer Wittmann rDesc.GetMaster().GetBox().GetDistance(); 19598a2dd8f0SOliver-Rainer Wittmann 19608a2dd8f0SOliver-Rainer Wittmann /* RECT_FLY_PRT_EMBEDDED returns the relative position to 19618a2dd8f0SOliver-Rainer Wittmann RECT_FLY_EMBEDDED 19628a2dd8f0SOliver-Rainer Wittmann the absolute position must be added here 19638a2dd8f0SOliver-Rainer Wittmann */ 19648a2dd8f0SOliver-Rainer Wittmann SwRect aRect( rSh.GetAnyCurRect( eRecType, pPt ) ); 19658a2dd8f0SOliver-Rainer Wittmann if(RECT_FLY_PRT_EMBEDDED == eRecType) 19668a2dd8f0SOliver-Rainer Wittmann aRect.Pos() += rSh.GetAnyCurRect( RECT_FLY_EMBEDDED, 19678a2dd8f0SOliver-Rainer Wittmann pPt ).Pos(); 19688a2dd8f0SOliver-Rainer Wittmann 19698a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nTotalWidth = (sal_uInt16)aRect.Width(); 19708a2dd8f0SOliver-Rainer Wittmann //nStart und nEnd initialisieren fuer nNum == 0 19718a2dd8f0SOliver-Rainer Wittmann int nWidth = 0, 19728a2dd8f0SOliver-Rainer Wittmann nStart = 0, 19738a2dd8f0SOliver-Rainer Wittmann nEnd = nTotalWidth; 19748a2dd8f0SOliver-Rainer Wittmann 19758a2dd8f0SOliver-Rainer Wittmann if( nNum > rCols.Count() ) 19768a2dd8f0SOliver-Rainer Wittmann { 19778a2dd8f0SOliver-Rainer Wittmann ASSERT( !this, "es wird auf dem falschen FmtCol gearbeitet!" ); 19788a2dd8f0SOliver-Rainer Wittmann nNum = rCols.Count(); 19798a2dd8f0SOliver-Rainer Wittmann } 19808a2dd8f0SOliver-Rainer Wittmann 19818a2dd8f0SOliver-Rainer Wittmann for( sal_uInt16 i = 0; i < nNum; ++i ) 19828a2dd8f0SOliver-Rainer Wittmann { 19838a2dd8f0SOliver-Rainer Wittmann SwColumn* pCol = rCols[i]; 19848a2dd8f0SOliver-Rainer Wittmann nStart = pCol->GetLeft() + nWidth; 19858a2dd8f0SOliver-Rainer Wittmann nWidth += pCols->CalcColWidth( i, nTotalWidth ); 19868a2dd8f0SOliver-Rainer Wittmann nEnd = nWidth - pCol->GetRight(); 19878a2dd8f0SOliver-Rainer Wittmann } 19888a2dd8f0SOliver-Rainer Wittmann if( bFrame | bColSct ) 19898a2dd8f0SOliver-Rainer Wittmann { 19908a2dd8f0SOliver-Rainer Wittmann aRectangle.Left() = aRect.Left() - rPageRect.Left() + nStart; 19918a2dd8f0SOliver-Rainer Wittmann aRectangle.Right() = nPageWidth - aRectangle.Left() - nEnd + nStart; 19928a2dd8f0SOliver-Rainer Wittmann } 19938a2dd8f0SOliver-Rainer Wittmann else if(!bBrowse) 19948a2dd8f0SOliver-Rainer Wittmann { 19958a2dd8f0SOliver-Rainer Wittmann aRectangle.Left() = aPageLRSpace.GetLeft() + nStart; 19968a2dd8f0SOliver-Rainer Wittmann aRectangle.Right() = nPageWidth - nEnd - aPageLRSpace.GetLeft(); 19978a2dd8f0SOliver-Rainer Wittmann } 19988a2dd8f0SOliver-Rainer Wittmann else 19998a2dd8f0SOliver-Rainer Wittmann { 20008a2dd8f0SOliver-Rainer Wittmann long nLeft = rPagePrtRect.Left(); 20018a2dd8f0SOliver-Rainer Wittmann aRectangle.Left() = nStart + nLeft; 20028a2dd8f0SOliver-Rainer Wittmann aRectangle.Right() = nPageWidth - nEnd - nLeft; 20038a2dd8f0SOliver-Rainer Wittmann } 20048a2dd8f0SOliver-Rainer Wittmann if(!bFrame) 20058a2dd8f0SOliver-Rainer Wittmann { 20068a2dd8f0SOliver-Rainer Wittmann aRectangle.Left() += nBorder; 20078a2dd8f0SOliver-Rainer Wittmann aRectangle.Right() -= nBorder; 20088a2dd8f0SOliver-Rainer Wittmann } 20098a2dd8f0SOliver-Rainer Wittmann } 20108a2dd8f0SOliver-Rainer Wittmann } 20118a2dd8f0SOliver-Rainer Wittmann else if ( nFrmType & ( FRMTYPE_HEADER | FRMTYPE_FOOTER )) 20128a2dd8f0SOliver-Rainer Wittmann { 20138a2dd8f0SOliver-Rainer Wittmann aRectangle.Left() = aPageLRSpace.GetLeft(); 20148a2dd8f0SOliver-Rainer Wittmann aRectangle.Right() = aPageLRSpace.GetRight(); 20158a2dd8f0SOliver-Rainer Wittmann } 20168a2dd8f0SOliver-Rainer Wittmann else 20178a2dd8f0SOliver-Rainer Wittmann aRectangle.Left() = aRectangle.Right() = 0; 20188a2dd8f0SOliver-Rainer Wittmann 20198a2dd8f0SOliver-Rainer Wittmann SfxRectangleItem aLR( SID_RULER_LR_MIN_MAX , aRectangle); 20208a2dd8f0SOliver-Rainer Wittmann rSet.Put(aLR); 20218a2dd8f0SOliver-Rainer Wittmann } 20228a2dd8f0SOliver-Rainer Wittmann break; 20238a2dd8f0SOliver-Rainer Wittmann 20248a2dd8f0SOliver-Rainer Wittmann case SID_RULER_PROTECT: 20258a2dd8f0SOliver-Rainer Wittmann { 20268a2dd8f0SOliver-Rainer Wittmann if(bFrmSelection) 20278a2dd8f0SOliver-Rainer Wittmann { 20288a2dd8f0SOliver-Rainer Wittmann sal_uInt8 nProtect = pWrtShell->IsSelObjProtected( FLYPROTECT_SIZE|FLYPROTECT_POS|FLYPROTECT_CONTENT ); 20298a2dd8f0SOliver-Rainer Wittmann 20308a2dd8f0SOliver-Rainer Wittmann SvxProtectItem aProt(SID_RULER_PROTECT); 20318a2dd8f0SOliver-Rainer Wittmann aProt.SetCntntProtect((nProtect & FLYPROTECT_CONTENT) != 0); 20328a2dd8f0SOliver-Rainer Wittmann aProt.SetSizeProtect ((nProtect & FLYPROTECT_SIZE) != 0); 20338a2dd8f0SOliver-Rainer Wittmann aProt.SetPosProtect ((nProtect & FLYPROTECT_POS) != 0); 20348a2dd8f0SOliver-Rainer Wittmann rSet.Put(aProt); 20358a2dd8f0SOliver-Rainer Wittmann } 20368a2dd8f0SOliver-Rainer Wittmann else 20378a2dd8f0SOliver-Rainer Wittmann { 20388a2dd8f0SOliver-Rainer Wittmann SvxProtectItem aProtect(SID_RULER_PROTECT); 20398a2dd8f0SOliver-Rainer Wittmann if(bBrowse && !(nFrmType & (FRMTYPE_DRAWOBJ|FRMTYPE_COLUMN)) && !rSh.GetTableFmt()) 20408a2dd8f0SOliver-Rainer Wittmann { 20418a2dd8f0SOliver-Rainer Wittmann aProtect.SetSizeProtect(sal_True); 20428a2dd8f0SOliver-Rainer Wittmann aProtect.SetPosProtect(sal_True); 20438a2dd8f0SOliver-Rainer Wittmann } 20448a2dd8f0SOliver-Rainer Wittmann rSet.Put(aProtect); 20458a2dd8f0SOliver-Rainer Wittmann } 20468a2dd8f0SOliver-Rainer Wittmann } 20478a2dd8f0SOliver-Rainer Wittmann break; 20488a2dd8f0SOliver-Rainer Wittmann } 20498a2dd8f0SOliver-Rainer Wittmann nWhich = aIter.NextWhich(); 20508a2dd8f0SOliver-Rainer Wittmann } 2051cdf0e10cSrcweir if(bPutContentProtection) 2052cdf0e10cSrcweir { 2053cdf0e10cSrcweir SvxProtectItem aProtect(SID_RULER_PROTECT); 2054cdf0e10cSrcweir aProtect.SetCntntProtect(sal_True); 2055cdf0e10cSrcweir rSet.Put(aProtect); 2056cdf0e10cSrcweir } 2057cdf0e10cSrcweir } 2058cdf0e10cSrcweir 2059cdf0e10cSrcweir 2060