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 { 202*8a2dd8f0SOliver-Rainer Wittmann sal_uInt16 nPhyPage, nVirPage; 203*8a2dd8f0SOliver-Rainer Wittmann GetWrtShell().GetPageNum( nPhyPage, nVirPage ); 204cdf0e10cSrcweir 205*8a2dd8f0SOliver-Rainer Wittmann if ( rDesc.GetUseOn() == nsUseOnPage::PD_MIRROR && (nPhyPage % 2) == 0 ) 206*8a2dd8f0SOliver-Rainer Wittmann { 207cdf0e10cSrcweir long nTmp = rLRSpace.GetRight(); 208*8a2dd8f0SOliver-Rainer Wittmann rLRSpace.SetRight( rLRSpace.GetLeft() ); 209*8a2dd8f0SOliver-Rainer Wittmann rLRSpace.SetLeft( nTmp ); 210*8a2dd8f0SOliver-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 { 271*8a2dd8f0SOliver-Rainer Wittmann SwWrtShell &rSh = GetWrtShell(); 272*8a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nFrmType = rSh.IsObjSelected() ? 273*8a2dd8f0SOliver-Rainer Wittmann FRMTYPE_DRAWOBJ : 274*8a2dd8f0SOliver-Rainer Wittmann rSh.GetFrmType(0,sal_True); 275*8a2dd8f0SOliver-Rainer Wittmann const sal_Bool bFrmSelection = rSh.IsFrmSelected(); 276*8a2dd8f0SOliver-Rainer Wittmann const sal_Bool bBrowse = rSh.GetViewOptions()->getBrowseMode(); 277cdf0e10cSrcweir 278*8a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nSlot = rReq.GetSlot(); 279*8a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nDescId = rSh.GetCurPageDesc(); 280*8a2dd8f0SOliver-Rainer Wittmann const SwPageDesc& rDesc = rSh.GetPageDesc( nDescId ); 281cdf0e10cSrcweir 282cdf0e10cSrcweir const sal_Bool bVerticalWriting = rSh.IsInVerticalText(); 283cdf0e10cSrcweir const SwFmtHeader& rHeaderFmt = rDesc.GetMaster().GetHeader(); 284*8a2dd8f0SOliver-Rainer Wittmann SwFrmFmt *pHeaderFmt = (SwFrmFmt*)rHeaderFmt.GetHeaderFmt(); 285cdf0e10cSrcweir 286*8a2dd8f0SOliver-Rainer Wittmann const SwFmtFooter& rFooterFmt = rDesc.GetMaster().GetFooter(); 287*8a2dd8f0SOliver-Rainer Wittmann SwFrmFmt *pFooterFmt = (SwFrmFmt*)rFooterFmt.GetFooterFmt(); 288cdf0e10cSrcweir 289*8a2dd8f0SOliver-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 295*8a2dd8f0SOliver-Rainer Wittmann sal_Bool bUnlockView = sal_False; 296*8a2dd8f0SOliver-Rainer Wittmann rSh.StartAllAction(); 297*8a2dd8f0SOliver-Rainer Wittmann sal_Bool bSect = 0 != (nFrmType & FRMTYPE_COLSECT); 298cdf0e10cSrcweir 299*8a2dd8f0SOliver-Rainer Wittmann switch( nSlot ) 300*8a2dd8f0SOliver-Rainer Wittmann { 301cdf0e10cSrcweir case SID_ATTR_LONG_LRSPACE: 302*8a2dd8f0SOliver-Rainer Wittmann { 303*8a2dd8f0SOliver-Rainer Wittmann SvxLongLRSpaceItem aLongLR( (const SvxLongLRSpaceItem&)rReq.GetArgs()-> 304*8a2dd8f0SOliver-Rainer Wittmann Get( SID_ATTR_LONG_LRSPACE ) ); 305*8a2dd8f0SOliver-Rainer Wittmann SvxLRSpaceItem aLR(RES_LR_SPACE); 306*8a2dd8f0SOliver-Rainer Wittmann if ( !bSect && (bFrmSelection || nFrmType & FRMTYPE_FLY_ANY) ) 307cdf0e10cSrcweir { 308*8a2dd8f0SOliver-Rainer Wittmann SwFrmFmt* pFmt = ((SwFrmFmt*)rSh.GetFlyFrmFmt()); 309*8a2dd8f0SOliver-Rainer Wittmann const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED); 310*8a2dd8f0SOliver-Rainer Wittmann 311*8a2dd8f0SOliver-Rainer Wittmann sal_Bool bVerticalFrame(sal_False); 312*8a2dd8f0SOliver-Rainer Wittmann { 313*8a2dd8f0SOliver-Rainer Wittmann sal_Bool bRTL; 314*8a2dd8f0SOliver-Rainer Wittmann sal_Bool bVertL2R; 315*8a2dd8f0SOliver-Rainer Wittmann bVerticalFrame = ( bFrmSelection && 316*8a2dd8f0SOliver-Rainer Wittmann rSh.IsFrmVertical(sal_True, bRTL, bVertL2R) ) || 317*8a2dd8f0SOliver-Rainer Wittmann ( !bFrmSelection && bVerticalWriting); 318*8a2dd8f0SOliver-Rainer Wittmann } 319*8a2dd8f0SOliver-Rainer Wittmann long nDeltaX = bVerticalFrame ? 320*8a2dd8f0SOliver-Rainer Wittmann rRect.Right() - rPageRect.Right() + aLongLR.GetRight() : 321*8a2dd8f0SOliver-Rainer Wittmann rPageRect.Left() + aLongLR.GetLeft() - rRect.Left(); 322cdf0e10cSrcweir 323*8a2dd8f0SOliver-Rainer Wittmann SfxItemSet aSet( GetPool(), RES_FRM_SIZE, RES_FRM_SIZE, 324*8a2dd8f0SOliver-Rainer Wittmann RES_VERT_ORIENT, RES_HORI_ORIENT, 325*8a2dd8f0SOliver-Rainer Wittmann RES_COL, RES_COL, 0 ); 326*8a2dd8f0SOliver-Rainer Wittmann 327*8a2dd8f0SOliver-Rainer Wittmann if(bVerticalFrame) 328*8a2dd8f0SOliver-Rainer Wittmann { 329*8a2dd8f0SOliver-Rainer Wittmann SwFmtVertOrient aVertOrient(pFmt->GetVertOrient()); 330*8a2dd8f0SOliver-Rainer Wittmann aVertOrient.SetVertOrient(text::VertOrientation::NONE); 331*8a2dd8f0SOliver-Rainer Wittmann aVertOrient.SetPos(aVertOrient.GetPos() + nDeltaX ); 332*8a2dd8f0SOliver-Rainer Wittmann aSet.Put( aVertOrient ); 333*8a2dd8f0SOliver-Rainer Wittmann } 334*8a2dd8f0SOliver-Rainer Wittmann else 335*8a2dd8f0SOliver-Rainer Wittmann { 336*8a2dd8f0SOliver-Rainer Wittmann SwFmtHoriOrient aHoriOrient( pFmt->GetHoriOrient() ); 337*8a2dd8f0SOliver-Rainer Wittmann aHoriOrient.SetHoriOrient( text::HoriOrientation::NONE ); 338*8a2dd8f0SOliver-Rainer Wittmann aHoriOrient.SetPos( aHoriOrient.GetPos() + nDeltaX ); 339*8a2dd8f0SOliver-Rainer Wittmann aSet.Put( aHoriOrient ); 340*8a2dd8f0SOliver-Rainer Wittmann } 341*8a2dd8f0SOliver-Rainer Wittmann 342*8a2dd8f0SOliver-Rainer Wittmann SwFmtFrmSize aSize( pFmt->GetFrmSize() ); 343*8a2dd8f0SOliver-Rainer Wittmann long nOldWidth = (long) aSize.GetWidth(); 344*8a2dd8f0SOliver-Rainer Wittmann 345*8a2dd8f0SOliver-Rainer Wittmann if(aSize.GetWidthPercent()) 346*8a2dd8f0SOliver-Rainer Wittmann { 347*8a2dd8f0SOliver-Rainer Wittmann SwRect aRect; 348*8a2dd8f0SOliver-Rainer Wittmann rSh.CalcBoundRect(aRect, FLY_AS_CHAR); 349*8a2dd8f0SOliver-Rainer Wittmann long nPrtWidth = aRect.Width(); 350*8a2dd8f0SOliver-Rainer Wittmann aSize.SetWidthPercent(sal_uInt8((nPageWidth - aLongLR.GetLeft() - aLongLR.GetRight()) * 100 /nPrtWidth)); 351*8a2dd8f0SOliver-Rainer Wittmann } 352*8a2dd8f0SOliver-Rainer Wittmann else 353*8a2dd8f0SOliver-Rainer Wittmann aSize.SetWidth( nPageWidth - 354*8a2dd8f0SOliver-Rainer Wittmann (aLongLR.GetLeft() + aLongLR.GetRight())); 355*8a2dd8f0SOliver-Rainer Wittmann 356*8a2dd8f0SOliver-Rainer Wittmann if( nFrmType & FRMTYPE_COLUMN ) 357*8a2dd8f0SOliver-Rainer Wittmann { 358*8a2dd8f0SOliver-Rainer Wittmann SwFmtCol aCol(pFmt->GetCol()); 359*8a2dd8f0SOliver-Rainer Wittmann 360*8a2dd8f0SOliver-Rainer Wittmann ::ResizeFrameCols(aCol, nOldWidth, (long)aSize.GetWidth(), nDeltaX ); 361*8a2dd8f0SOliver-Rainer Wittmann aSet.Put(aCol); 362*8a2dd8f0SOliver-Rainer Wittmann } 363cdf0e10cSrcweir 364*8a2dd8f0SOliver-Rainer Wittmann aSet.Put( aSize ); 365*8a2dd8f0SOliver-Rainer Wittmann 366*8a2dd8f0SOliver-Rainer Wittmann rSh.StartAction(); 367*8a2dd8f0SOliver-Rainer Wittmann rSh.Push(); 368*8a2dd8f0SOliver-Rainer Wittmann rSh.SetFlyFrmAttr( aSet ); 369*8a2dd8f0SOliver-Rainer Wittmann //die Rahmenselektion wieder aufheben 370*8a2dd8f0SOliver-Rainer Wittmann if(!bFrmSelection && rSh.IsFrmSelected()) 371*8a2dd8f0SOliver-Rainer Wittmann { 372*8a2dd8f0SOliver-Rainer Wittmann rSh.UnSelectFrm(); 373*8a2dd8f0SOliver-Rainer Wittmann rSh.LeaveSelFrmMode(); 374*8a2dd8f0SOliver-Rainer Wittmann } 375*8a2dd8f0SOliver-Rainer Wittmann rSh.Pop(); 376*8a2dd8f0SOliver-Rainer Wittmann rSh.EndAction(); 377*8a2dd8f0SOliver-Rainer Wittmann } 378*8a2dd8f0SOliver-Rainer Wittmann else if ( nFrmType & ( FRMTYPE_HEADER | FRMTYPE_FOOTER )) 379cdf0e10cSrcweir { 380*8a2dd8f0SOliver-Rainer Wittmann // Seitenraender rausrechnen 381*8a2dd8f0SOliver-Rainer Wittmann long nOld = rDesc.GetMaster().GetLRSpace().GetLeft(); 382*8a2dd8f0SOliver-Rainer Wittmann aLongLR.SetLeft( nOld > aLongLR.GetLeft() ? 0 : aLongLR.GetLeft() - nOld ); 383*8a2dd8f0SOliver-Rainer Wittmann 384*8a2dd8f0SOliver-Rainer Wittmann nOld = rDesc.GetMaster().GetLRSpace().GetRight(); 385*8a2dd8f0SOliver-Rainer Wittmann aLongLR.SetRight( nOld > (sal_uInt16)aLongLR.GetRight() ? 0 : aLongLR.GetRight() - nOld ); 386*8a2dd8f0SOliver-Rainer Wittmann aLR.SetLeft((sal_uInt16)aLongLR.GetLeft()); 387*8a2dd8f0SOliver-Rainer Wittmann aLR.SetRight((sal_uInt16)aLongLR.GetRight()); 388*8a2dd8f0SOliver-Rainer Wittmann 389*8a2dd8f0SOliver-Rainer Wittmann if ( nFrmType & FRMTYPE_HEADER && pHeaderFmt ) 390*8a2dd8f0SOliver-Rainer Wittmann pHeaderFmt->SetFmtAttr( aLR ); 391*8a2dd8f0SOliver-Rainer Wittmann else if( nFrmType & FRMTYPE_FOOTER && pFooterFmt ) 392*8a2dd8f0SOliver-Rainer Wittmann pFooterFmt->SetFmtAttr( aLR ); 393cdf0e10cSrcweir } 394*8a2dd8f0SOliver-Rainer Wittmann else if( nFrmType == FRMTYPE_DRAWOBJ) 395cdf0e10cSrcweir { 396*8a2dd8f0SOliver-Rainer Wittmann SwRect aRect( rSh.GetObjRect() ); 397*8a2dd8f0SOliver-Rainer Wittmann aRect.Left( aLongLR.GetLeft() + rPageRect.Left() ); 398*8a2dd8f0SOliver-Rainer Wittmann aRect.Right( rPageRect.Right() - aLongLR.GetRight()); 399*8a2dd8f0SOliver-Rainer Wittmann rSh.SetObjRect( aRect ); 400cdf0e10cSrcweir } 401*8a2dd8f0SOliver-Rainer Wittmann else if(bSect || rSh.IsDirectlyInSection()) 402*8a2dd8f0SOliver-Rainer Wittmann { 403*8a2dd8f0SOliver-Rainer Wittmann //change the section indents and the columns if available 404*8a2dd8f0SOliver-Rainer Wittmann //at first determine the changes 405*8a2dd8f0SOliver-Rainer Wittmann SwRect aSectRect = rSh.GetAnyCurRect(RECT_SECTION_PRT, 0); 406*8a2dd8f0SOliver-Rainer Wittmann const SwRect aTmpRect = rSh.GetAnyCurRect(RECT_SECTION, 0); 407*8a2dd8f0SOliver-Rainer Wittmann aSectRect.Pos() += aTmpRect.Pos(); 408*8a2dd8f0SOliver-Rainer Wittmann long nLeftDiff = aLongLR.GetLeft() - (long)(aSectRect.Left() - rPageRect.Left() ); 409*8a2dd8f0SOliver-Rainer Wittmann long nRightDiff = aLongLR.GetRight() - (long)( rPageRect.Right() - aSectRect.Right()); 410*8a2dd8f0SOliver-Rainer Wittmann //change the LRSpaceItem of the section accordingly 411*8a2dd8f0SOliver-Rainer Wittmann const SwSection* pCurrSect = rSh.GetCurrSection(); 412*8a2dd8f0SOliver-Rainer Wittmann const SwSectionFmt* pSectFmt = pCurrSect->GetFmt(); 413*8a2dd8f0SOliver-Rainer Wittmann SvxLRSpaceItem aLRTmp = pSectFmt->GetLRSpace(); 414*8a2dd8f0SOliver-Rainer Wittmann aLRTmp.SetLeft(aLRTmp.GetLeft() + nLeftDiff); 415*8a2dd8f0SOliver-Rainer Wittmann aLRTmp.SetRight(aLRTmp.GetRight() + nRightDiff); 416*8a2dd8f0SOliver-Rainer Wittmann SfxItemSet aSet(rSh.GetAttrPool(), RES_LR_SPACE, RES_LR_SPACE, RES_COL, RES_COL, 0L); 417*8a2dd8f0SOliver-Rainer Wittmann aSet.Put(aLRTmp); 418*8a2dd8f0SOliver-Rainer Wittmann //change the first/last column 419*8a2dd8f0SOliver-Rainer Wittmann if(bSect) 420*8a2dd8f0SOliver-Rainer Wittmann { 421*8a2dd8f0SOliver-Rainer Wittmann SwFmtCol aCols( pSectFmt->GetCol() ); 422*8a2dd8f0SOliver-Rainer Wittmann long nDiffWidth = nLeftDiff + nRightDiff; 423*8a2dd8f0SOliver-Rainer Wittmann ::ResizeFrameCols(aCols, aSectRect.Width(), aSectRect.Width() - nDiffWidth, nLeftDiff ); 424*8a2dd8f0SOliver-Rainer Wittmann aSet.Put( aCols ); 425*8a2dd8f0SOliver-Rainer Wittmann } 426*8a2dd8f0SOliver-Rainer Wittmann SwSectionData aData(*pCurrSect); 427*8a2dd8f0SOliver-Rainer Wittmann rSh.UpdateSection(rSh.GetSectionFmtPos(*pSectFmt), aData, &aSet); 428*8a2dd8f0SOliver-Rainer Wittmann } 429*8a2dd8f0SOliver-Rainer Wittmann else 430*8a2dd8f0SOliver-Rainer Wittmann { // Seitenraender einstellen 431*8a2dd8f0SOliver-Rainer Wittmann aLR.SetLeft((sal_uInt16)aLongLR.GetLeft()); 432*8a2dd8f0SOliver-Rainer Wittmann aLR.SetRight((sal_uInt16)aLongLR.GetRight()); 433*8a2dd8f0SOliver-Rainer Wittmann SwapPageMargin( rDesc, aLR ); 434*8a2dd8f0SOliver-Rainer Wittmann SwPageDesc aDesc( rDesc ); 435*8a2dd8f0SOliver-Rainer Wittmann aDesc.GetMaster().SetFmtAttr( aLR ); 436*8a2dd8f0SOliver-Rainer Wittmann rSh.ChgPageDesc( nDescId, aDesc ); 437*8a2dd8f0SOliver-Rainer Wittmann } 438*8a2dd8f0SOliver-Rainer Wittmann } 439*8a2dd8f0SOliver-Rainer Wittmann break; 440cdf0e10cSrcweir 441*8a2dd8f0SOliver-Rainer Wittmann // apply new left and right margins to current page style 442*8a2dd8f0SOliver-Rainer Wittmann case SID_ATTR_PAGE_LRSPACE: 443*8a2dd8f0SOliver-Rainer Wittmann { 444*8a2dd8f0SOliver-Rainer Wittmann const SvxLongLRSpaceItem aLongLR( static_cast<const SvxLongLRSpaceItem&>(rReq.GetArgs()->Get( SID_ATTR_PAGE_LRSPACE )) ); 445*8a2dd8f0SOliver-Rainer Wittmann 446*8a2dd8f0SOliver-Rainer Wittmann SwPageDesc aDesc( rDesc ); 447*8a2dd8f0SOliver-Rainer Wittmann { 448*8a2dd8f0SOliver-Rainer Wittmann SvxLRSpaceItem aLR( RES_LR_SPACE ); 449*8a2dd8f0SOliver-Rainer Wittmann aLR.SetLeft((sal_uInt16)aLongLR.GetLeft()); 450*8a2dd8f0SOliver-Rainer Wittmann aLR.SetRight((sal_uInt16)aLongLR.GetRight()); 451*8a2dd8f0SOliver-Rainer Wittmann SwapPageMargin( rDesc, aLR ); 452*8a2dd8f0SOliver-Rainer Wittmann aDesc.GetMaster().SetFmtAttr( aLR ); 453*8a2dd8f0SOliver-Rainer Wittmann } 454*8a2dd8f0SOliver-Rainer Wittmann rSh.ChgPageDesc( nDescId, aDesc ); 455cdf0e10cSrcweir } 456*8a2dd8f0SOliver-Rainer Wittmann break; 457*8a2dd8f0SOliver-Rainer Wittmann 458cdf0e10cSrcweir case SID_ATTR_LONG_ULSPACE: 459*8a2dd8f0SOliver-Rainer Wittmann { 460*8a2dd8f0SOliver-Rainer Wittmann SvxLongULSpaceItem aLongULSpace( (const SvxLongULSpaceItem&)rReq.GetArgs()-> 461*8a2dd8f0SOliver-Rainer Wittmann Get( SID_ATTR_LONG_ULSPACE )); 462cdf0e10cSrcweir 463*8a2dd8f0SOliver-Rainer Wittmann if( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY ) 464cdf0e10cSrcweir { 465*8a2dd8f0SOliver-Rainer Wittmann SwFrmFmt* pFmt = ((SwFrmFmt*)rSh.GetFlyFrmFmt()); 466*8a2dd8f0SOliver-Rainer Wittmann const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED); 467*8a2dd8f0SOliver-Rainer Wittmann const long nDeltaY = rPageRect.Top() + aLongULSpace.GetUpper() - rRect.Top(); 468*8a2dd8f0SOliver-Rainer Wittmann const long nHeight = nPageHeight - (aLongULSpace.GetUpper() + aLongULSpace.GetLower()); 469*8a2dd8f0SOliver-Rainer Wittmann 470*8a2dd8f0SOliver-Rainer Wittmann SfxItemSet aSet( GetPool(), RES_FRM_SIZE, RES_FRM_SIZE, 471*8a2dd8f0SOliver-Rainer Wittmann RES_VERT_ORIENT, RES_HORI_ORIENT, 0 ); 472*8a2dd8f0SOliver-Rainer Wittmann //which of the orientation attributes is to be put depends on the frame's environment 473*8a2dd8f0SOliver-Rainer Wittmann sal_Bool bRTL; 474*8a2dd8f0SOliver-Rainer Wittmann sal_Bool bVertL2R; 475*8a2dd8f0SOliver-Rainer Wittmann if ( ( bFrmSelection && 476*8a2dd8f0SOliver-Rainer Wittmann rSh.IsFrmVertical(sal_True, bRTL, bVertL2R ) ) || 477*8a2dd8f0SOliver-Rainer Wittmann ( !bFrmSelection && bVerticalWriting ) ) 478*8a2dd8f0SOliver-Rainer Wittmann { 479*8a2dd8f0SOliver-Rainer Wittmann SwFmtHoriOrient aHoriOrient(pFmt->GetHoriOrient()); 480*8a2dd8f0SOliver-Rainer Wittmann aHoriOrient.SetHoriOrient(text::HoriOrientation::NONE); 481*8a2dd8f0SOliver-Rainer Wittmann aHoriOrient.SetPos(aHoriOrient.GetPos() + nDeltaY ); 482*8a2dd8f0SOliver-Rainer Wittmann aSet.Put( aHoriOrient ); 483*8a2dd8f0SOliver-Rainer Wittmann } 484*8a2dd8f0SOliver-Rainer Wittmann else 485*8a2dd8f0SOliver-Rainer Wittmann { 486*8a2dd8f0SOliver-Rainer Wittmann SwFmtVertOrient aVertOrient(pFmt->GetVertOrient()); 487*8a2dd8f0SOliver-Rainer Wittmann aVertOrient.SetVertOrient(text::VertOrientation::NONE); 488*8a2dd8f0SOliver-Rainer Wittmann aVertOrient.SetPos(aVertOrient.GetPos() + nDeltaY ); 489*8a2dd8f0SOliver-Rainer Wittmann aSet.Put( aVertOrient ); 490*8a2dd8f0SOliver-Rainer Wittmann } 491*8a2dd8f0SOliver-Rainer Wittmann SwFmtFrmSize aSize(pFmt->GetFrmSize()); 492*8a2dd8f0SOliver-Rainer Wittmann if(aSize.GetHeightPercent()) 493*8a2dd8f0SOliver-Rainer Wittmann { 494*8a2dd8f0SOliver-Rainer Wittmann SwRect aRect; 495*8a2dd8f0SOliver-Rainer Wittmann rSh.CalcBoundRect(aRect, FLY_AS_CHAR); 496*8a2dd8f0SOliver-Rainer Wittmann long nPrtHeight = aRect.Height(); 497*8a2dd8f0SOliver-Rainer Wittmann aSize.SetHeightPercent(sal_uInt8(nHeight * 100 /nPrtHeight)); 498*8a2dd8f0SOliver-Rainer Wittmann } 499*8a2dd8f0SOliver-Rainer Wittmann else 500*8a2dd8f0SOliver-Rainer Wittmann aSize.SetHeight(nHeight ); 501*8a2dd8f0SOliver-Rainer Wittmann 502*8a2dd8f0SOliver-Rainer Wittmann aSet.Put( aSize ); 503*8a2dd8f0SOliver-Rainer Wittmann rSh.SetFlyFrmAttr( aSet ); 504cdf0e10cSrcweir } 505*8a2dd8f0SOliver-Rainer Wittmann else if( nFrmType == FRMTYPE_DRAWOBJ ) 506cdf0e10cSrcweir { 507*8a2dd8f0SOliver-Rainer Wittmann SwRect aRect( rSh.GetObjRect() ); 508*8a2dd8f0SOliver-Rainer Wittmann aRect.Top( aLongULSpace.GetUpper() + rPageRect.Top() ); 509*8a2dd8f0SOliver-Rainer Wittmann aRect.Bottom( rPageRect.Bottom() - aLongULSpace.GetLower() ); 510*8a2dd8f0SOliver-Rainer Wittmann rSh.SetObjRect( aRect ) ; 511cdf0e10cSrcweir } 512*8a2dd8f0SOliver-Rainer Wittmann else if(bVerticalWriting && (bSect || rSh.IsDirectlyInSection())) 513*8a2dd8f0SOliver-Rainer Wittmann { 514*8a2dd8f0SOliver-Rainer Wittmann //change the section indents and the columns if available 515*8a2dd8f0SOliver-Rainer Wittmann //at first determine the changes 516*8a2dd8f0SOliver-Rainer Wittmann SwRect aSectRect = rSh.GetAnyCurRect(RECT_SECTION_PRT, 0); 517*8a2dd8f0SOliver-Rainer Wittmann const SwRect aTmpRect = rSh.GetAnyCurRect(RECT_SECTION, 0); 518*8a2dd8f0SOliver-Rainer Wittmann aSectRect.Pos() += aTmpRect.Pos(); 519*8a2dd8f0SOliver-Rainer Wittmann const long nLeftDiff = aLongULSpace.GetUpper() - (long)(aSectRect.Top() - rPageRect.Top()); 520*8a2dd8f0SOliver-Rainer Wittmann const long nRightDiff = aLongULSpace.GetLower() - (long)(nPageHeight - aSectRect.Bottom() + rPageRect.Top()); 521*8a2dd8f0SOliver-Rainer Wittmann //change the LRSpaceItem of the section accordingly 522*8a2dd8f0SOliver-Rainer Wittmann const SwSection* pCurrSect = rSh.GetCurrSection(); 523*8a2dd8f0SOliver-Rainer Wittmann const SwSectionFmt* pSectFmt = pCurrSect->GetFmt(); 524*8a2dd8f0SOliver-Rainer Wittmann SvxLRSpaceItem aLR = pSectFmt->GetLRSpace(); 525*8a2dd8f0SOliver-Rainer Wittmann aLR.SetLeft(aLR.GetLeft() + nLeftDiff); 526*8a2dd8f0SOliver-Rainer Wittmann aLR.SetRight(aLR.GetRight() + nRightDiff); 527*8a2dd8f0SOliver-Rainer Wittmann SfxItemSet aSet(rSh.GetAttrPool(), RES_LR_SPACE, RES_LR_SPACE, RES_COL, RES_COL, 0L); 528*8a2dd8f0SOliver-Rainer Wittmann aSet.Put(aLR); 529*8a2dd8f0SOliver-Rainer Wittmann //change the first/last column 530*8a2dd8f0SOliver-Rainer Wittmann if(bSect) 531*8a2dd8f0SOliver-Rainer Wittmann { 532*8a2dd8f0SOliver-Rainer Wittmann SwFmtCol aCols( pSectFmt->GetCol() ); 533*8a2dd8f0SOliver-Rainer Wittmann long nDiffWidth = nLeftDiff + nRightDiff; 534*8a2dd8f0SOliver-Rainer Wittmann ::ResizeFrameCols(aCols, aSectRect.Height(), aSectRect.Height() - nDiffWidth, nLeftDiff ); 535*8a2dd8f0SOliver-Rainer Wittmann aSet.Put( aCols ); 536*8a2dd8f0SOliver-Rainer Wittmann } 537*8a2dd8f0SOliver-Rainer Wittmann SwSectionData aData(*pCurrSect); 538*8a2dd8f0SOliver-Rainer Wittmann rSh.UpdateSection(rSh.GetSectionFmtPos(*pSectFmt), aData, &aSet); 539*8a2dd8f0SOliver-Rainer Wittmann } 540*8a2dd8f0SOliver-Rainer Wittmann else 541*8a2dd8f0SOliver-Rainer Wittmann { SwPageDesc aDesc( rDesc ); 542*8a2dd8f0SOliver-Rainer Wittmann 543*8a2dd8f0SOliver-Rainer Wittmann if ( nFrmType & ( FRMTYPE_HEADER | FRMTYPE_FOOTER )) 544*8a2dd8f0SOliver-Rainer Wittmann { 545*8a2dd8f0SOliver-Rainer Wittmann 546*8a2dd8f0SOliver-Rainer Wittmann const sal_Bool bHead = nFrmType & FRMTYPE_HEADER ? sal_True : sal_False; 547*8a2dd8f0SOliver-Rainer Wittmann SvxULSpaceItem aUL( rDesc.GetMaster().GetULSpace() ); 548*8a2dd8f0SOliver-Rainer Wittmann if ( bHead ) 549*8a2dd8f0SOliver-Rainer Wittmann aUL.SetUpper( (sal_uInt16)aLongULSpace.GetUpper() ); 550*8a2dd8f0SOliver-Rainer Wittmann else 551*8a2dd8f0SOliver-Rainer Wittmann aUL.SetLower( (sal_uInt16)aLongULSpace.GetLower() ); 552cdf0e10cSrcweir aDesc.GetMaster().SetFmtAttr( aUL ); 553cdf0e10cSrcweir 554*8a2dd8f0SOliver-Rainer Wittmann if( (bHead && pHeaderFmt) || (!bHead && pFooterFmt) ) 555cdf0e10cSrcweir { 556cdf0e10cSrcweir SwFmtFrmSize aSz( bHead ? pHeaderFmt->GetFrmSize() : 557*8a2dd8f0SOliver-Rainer Wittmann pFooterFmt->GetFrmSize() ); 558cdf0e10cSrcweir aSz.SetHeightSizeType( ATT_FIX_SIZE ); 559*8a2dd8f0SOliver-Rainer Wittmann aSz.SetHeight(nPageHeight - aLongULSpace.GetLower() - 560*8a2dd8f0SOliver-Rainer Wittmann aLongULSpace.GetUpper() ); 561*8a2dd8f0SOliver-Rainer Wittmann if ( bHead ) 562cdf0e10cSrcweir pHeaderFmt->SetFmtAttr( aSz ); 563*8a2dd8f0SOliver-Rainer Wittmann else 564cdf0e10cSrcweir pFooterFmt->SetFmtAttr( aSz ); 565cdf0e10cSrcweir } 566*8a2dd8f0SOliver-Rainer Wittmann } 567*8a2dd8f0SOliver-Rainer Wittmann else 568*8a2dd8f0SOliver-Rainer Wittmann { 569cdf0e10cSrcweir SvxULSpaceItem aUL(RES_UL_SPACE); 570*8a2dd8f0SOliver-Rainer Wittmann aUL.SetUpper((sal_uInt16)aLongULSpace.GetUpper()); 571*8a2dd8f0SOliver-Rainer Wittmann aUL.SetLower((sal_uInt16)aLongULSpace.GetLower()); 572cdf0e10cSrcweir aDesc.GetMaster().SetFmtAttr(aUL); 573*8a2dd8f0SOliver-Rainer Wittmann } 574cdf0e10cSrcweir 575*8a2dd8f0SOliver-Rainer Wittmann rSh.ChgPageDesc( nDescId, aDesc ); 576*8a2dd8f0SOliver-Rainer Wittmann } 577ff0525f2SOliver-Rainer Wittmann } 578*8a2dd8f0SOliver-Rainer Wittmann break; 579*8a2dd8f0SOliver-Rainer Wittmann 580*8a2dd8f0SOliver-Rainer Wittmann // apply new top and bottom margins to current page style 581*8a2dd8f0SOliver-Rainer Wittmann case SID_ATTR_PAGE_ULSPACE: 582ff0525f2SOliver-Rainer Wittmann { 583*8a2dd8f0SOliver-Rainer Wittmann SvxLongULSpaceItem aLongULSpace( 584*8a2dd8f0SOliver-Rainer Wittmann static_cast<const SvxLongULSpaceItem&>(rReq.GetArgs()->Get( SID_ATTR_PAGE_ULSPACE ) ) ); 585*8a2dd8f0SOliver-Rainer Wittmann 586*8a2dd8f0SOliver-Rainer Wittmann SwPageDesc aDesc( rDesc ); 587*8a2dd8f0SOliver-Rainer Wittmann { 588*8a2dd8f0SOliver-Rainer Wittmann SvxULSpaceItem aUL(RES_UL_SPACE); 589*8a2dd8f0SOliver-Rainer Wittmann aUL.SetUpper((sal_uInt16)aLongULSpace.GetUpper()); 590*8a2dd8f0SOliver-Rainer Wittmann aUL.SetLower((sal_uInt16)aLongULSpace.GetLower()); 591*8a2dd8f0SOliver-Rainer Wittmann aDesc.GetMaster().SetFmtAttr(aUL); 592*8a2dd8f0SOliver-Rainer Wittmann } 593*8a2dd8f0SOliver-Rainer Wittmann rSh.ChgPageDesc( nDescId, aDesc ); 594ff0525f2SOliver-Rainer Wittmann } 595*8a2dd8f0SOliver-Rainer Wittmann break; 596*8a2dd8f0SOliver-Rainer Wittmann 597*8a2dd8f0SOliver-Rainer Wittmann case SID_ATTR_PAGE_COLUMN: 598*8a2dd8f0SOliver-Rainer Wittmann { 599*8a2dd8f0SOliver-Rainer Wittmann const SfxInt16Item aColumnItem( (const SfxInt16Item&)rReq.GetArgs()->Get(nSlot) ); 600*8a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nPageColumnType = aColumnItem.GetValue(); 601*8a2dd8f0SOliver-Rainer Wittmann 602*8a2dd8f0SOliver-Rainer Wittmann // nPageColumnType = 603*8a2dd8f0SOliver-Rainer Wittmann // 1 - single-columned page 604*8a2dd8f0SOliver-Rainer Wittmann // 2 - two-columned page 605*8a2dd8f0SOliver-Rainer Wittmann // 3 - three-columned page 606*8a2dd8f0SOliver-Rainer Wittmann // 4 - two-columned page with left column width of 2/3 of page width 607*8a2dd8f0SOliver-Rainer Wittmann // 5 - two-columned page with right column width of 2/3 of page width 608*8a2dd8f0SOliver-Rainer Wittmann 609*8a2dd8f0SOliver-Rainer Wittmann sal_uInt16 nCount = 2; 610*8a2dd8f0SOliver-Rainer Wittmann if ( nPageColumnType == 1 ) 611*8a2dd8f0SOliver-Rainer Wittmann { 612*8a2dd8f0SOliver-Rainer Wittmann nCount = 0; 613*8a2dd8f0SOliver-Rainer Wittmann } 614*8a2dd8f0SOliver-Rainer Wittmann else if ( nPageColumnType == 3 ) 615*8a2dd8f0SOliver-Rainer Wittmann { 616*8a2dd8f0SOliver-Rainer Wittmann nCount = 3; 617*8a2dd8f0SOliver-Rainer Wittmann } 618ff0525f2SOliver-Rainer Wittmann 619*8a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nGutterWidth = 0; 620ff0525f2SOliver-Rainer Wittmann 621*8a2dd8f0SOliver-Rainer Wittmann const SvxLRSpaceItem aLR( rDesc.GetMaster().GetLRSpace() ); 622*8a2dd8f0SOliver-Rainer Wittmann const long nLeft = aLR.GetLeft(); 623*8a2dd8f0SOliver-Rainer Wittmann const long nRight = aLR.GetRight(); 624*8a2dd8f0SOliver-Rainer Wittmann const long nWidth = nPageWidth - nLeft - nRight; 625ff0525f2SOliver-Rainer Wittmann 626*8a2dd8f0SOliver-Rainer Wittmann SwFmtCol aCols( rDesc.GetMaster().GetCol() ); 627*8a2dd8f0SOliver-Rainer Wittmann aCols.Init( nCount, nGutterWidth, nWidth ); 628*8a2dd8f0SOliver-Rainer Wittmann aCols.SetWishWidth( nWidth ); 629*8a2dd8f0SOliver-Rainer Wittmann aCols.SetGutterWidth( nGutterWidth, nWidth ); 630*8a2dd8f0SOliver-Rainer Wittmann aCols.SetOrtho( sal_False, nGutterWidth, nWidth ); 631ff0525f2SOliver-Rainer Wittmann 632*8a2dd8f0SOliver-Rainer Wittmann long nColumnLeft = 0; 633*8a2dd8f0SOliver-Rainer Wittmann long nColumnRight = 0; 634*8a2dd8f0SOliver-Rainer Wittmann if ( nPageColumnType == 4 ) 635*8a2dd8f0SOliver-Rainer Wittmann { 636*8a2dd8f0SOliver-Rainer Wittmann nColumnRight = (long)(nWidth/3); 637*8a2dd8f0SOliver-Rainer Wittmann nColumnLeft = nWidth - nColumnRight; 638*8a2dd8f0SOliver-Rainer Wittmann aCols.GetColumns()[0]->SetWishWidth( nColumnLeft ); 639*8a2dd8f0SOliver-Rainer Wittmann aCols.GetColumns()[1]->SetWishWidth( nColumnRight ); 640*8a2dd8f0SOliver-Rainer Wittmann } 641*8a2dd8f0SOliver-Rainer Wittmann else if ( nPageColumnType == 5 ) 642*8a2dd8f0SOliver-Rainer Wittmann { 643*8a2dd8f0SOliver-Rainer Wittmann nColumnLeft = (long)(nWidth/3); 644*8a2dd8f0SOliver-Rainer Wittmann nColumnRight = nWidth - nColumnLeft; 645*8a2dd8f0SOliver-Rainer Wittmann aCols.GetColumns()[0]->SetWishWidth( nColumnLeft ); 646*8a2dd8f0SOliver-Rainer Wittmann aCols.GetColumns()[1]->SetWishWidth( nColumnRight ); 647*8a2dd8f0SOliver-Rainer Wittmann } 648*8a2dd8f0SOliver-Rainer Wittmann 649*8a2dd8f0SOliver-Rainer Wittmann SwPageDesc aDesc( rDesc ); 650*8a2dd8f0SOliver-Rainer Wittmann aDesc.GetMaster().SetFmtAttr( aCols ); 651*8a2dd8f0SOliver-Rainer Wittmann rSh.ChgPageDesc( rSh.GetCurPageDesc(), aDesc ); 652ff0525f2SOliver-Rainer Wittmann } 653*8a2dd8f0SOliver-Rainer Wittmann break; 654ff0525f2SOliver-Rainer Wittmann 655cdf0e10cSrcweir case SID_ATTR_TABSTOP_VERTICAL: 656cdf0e10cSrcweir case SID_ATTR_TABSTOP: 657*8a2dd8f0SOliver-Rainer Wittmann { 658*8a2dd8f0SOliver-Rainer Wittmann sal_uInt16 nWhich = GetPool().GetWhich(nSlot); 659*8a2dd8f0SOliver-Rainer Wittmann SvxTabStopItem aTabStops( (const SvxTabStopItem&)rReq.GetArgs()-> 660*8a2dd8f0SOliver-Rainer Wittmann Get( nWhich )); 661*8a2dd8f0SOliver-Rainer Wittmann aTabStops.SetWhich(RES_PARATR_TABSTOP); 662*8a2dd8f0SOliver-Rainer Wittmann const SvxTabStopItem& rDefTabs = 663*8a2dd8f0SOliver-Rainer Wittmann (const SvxTabStopItem&)rSh.GetDefault(RES_PARATR_TABSTOP); 664*8a2dd8f0SOliver-Rainer Wittmann 665*8a2dd8f0SOliver-Rainer Wittmann // Default-Tab an Pos 0 666*8a2dd8f0SOliver-Rainer Wittmann SfxItemSet aSet( GetPool(), RES_LR_SPACE, RES_LR_SPACE ); 667*8a2dd8f0SOliver-Rainer Wittmann rSh.GetCurAttr( aSet ); 668*8a2dd8f0SOliver-Rainer Wittmann const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&)aSet.Get(RES_LR_SPACE); 669cdf0e10cSrcweir 670*8a2dd8f0SOliver-Rainer Wittmann if ( rLR.GetTxtFirstLineOfst() < 0 ) 671*8a2dd8f0SOliver-Rainer Wittmann { 672*8a2dd8f0SOliver-Rainer Wittmann SvxTabStop aSwTabStop( 0, SVX_TAB_ADJUST_DEFAULT ); 673*8a2dd8f0SOliver-Rainer Wittmann aTabStops.Insert( aSwTabStop ); 674*8a2dd8f0SOliver-Rainer Wittmann } 675*8a2dd8f0SOliver-Rainer Wittmann 676*8a2dd8f0SOliver-Rainer Wittmann // auffuellen mit Default-Tabs 677*8a2dd8f0SOliver-Rainer Wittmann sal_uInt16 nDef = ::GetTabDist( rDefTabs ); 678*8a2dd8f0SOliver-Rainer Wittmann ::MakeDefTabs( nDef, aTabStops ); 679*8a2dd8f0SOliver-Rainer Wittmann 680*8a2dd8f0SOliver-Rainer Wittmann SwTxtFmtColl* pColl = rSh.GetCurTxtFmtColl(); 681*8a2dd8f0SOliver-Rainer Wittmann if( pColl && pColl->IsAutoUpdateFmt() ) 682*8a2dd8f0SOliver-Rainer Wittmann { 683*8a2dd8f0SOliver-Rainer Wittmann SfxItemSet aTmp(GetPool(), RES_PARATR_TABSTOP, RES_PARATR_TABSTOP); 684*8a2dd8f0SOliver-Rainer Wittmann aTmp.Put(aTabStops); 685*8a2dd8f0SOliver-Rainer Wittmann rSh.AutoUpdatePara( pColl, aTmp ); 686*8a2dd8f0SOliver-Rainer Wittmann } 687*8a2dd8f0SOliver-Rainer Wittmann else 688*8a2dd8f0SOliver-Rainer Wittmann rSh.SetAttr( aTabStops ); 689*8a2dd8f0SOliver-Rainer Wittmann break; 690*8a2dd8f0SOliver-Rainer Wittmann } 691cdf0e10cSrcweir 692cdf0e10cSrcweir case SID_ATTR_PARA_LRSPACE_VERTICAL: 693cdf0e10cSrcweir case SID_ATTR_PARA_LRSPACE: 694*8a2dd8f0SOliver-Rainer Wittmann { 695*8a2dd8f0SOliver-Rainer Wittmann SvxLRSpaceItem aParaMargin((const SvxLRSpaceItem&)rReq. 696*8a2dd8f0SOliver-Rainer Wittmann GetArgs()->Get(nSlot)); 697*8a2dd8f0SOliver-Rainer Wittmann if(nFrmType & FRMTYPE_FLY_ANY) 698cdf0e10cSrcweir { 699*8a2dd8f0SOliver-Rainer Wittmann sal_Bool bFirstColumn = sal_True; 700*8a2dd8f0SOliver-Rainer Wittmann sal_Bool bLastColumn = sal_True; 701*8a2dd8f0SOliver-Rainer Wittmann if(nFrmType & FRMTYPE_COLUMN) 702*8a2dd8f0SOliver-Rainer Wittmann { 703*8a2dd8f0SOliver-Rainer Wittmann sal_uInt16 nCurFrameCol = rSh.GetCurColNum() - 1; 704*8a2dd8f0SOliver-Rainer Wittmann bFirstColumn = !nCurFrameCol; 705*8a2dd8f0SOliver-Rainer Wittmann const SwFrmFmt* pFmt = rSh.GetFlyFrmFmt(); 706*8a2dd8f0SOliver-Rainer Wittmann const SwFmtCol* pCols = &pFmt->GetCol(); 707*8a2dd8f0SOliver-Rainer Wittmann const SwColumns& rCols = pCols->GetColumns(); 708*8a2dd8f0SOliver-Rainer Wittmann sal_uInt16 nColumnCount = rCols.Count(); 709*8a2dd8f0SOliver-Rainer Wittmann bLastColumn = nColumnCount == nCurFrameCol + 1; 710*8a2dd8f0SOliver-Rainer Wittmann } 711cdf0e10cSrcweir } 712*8a2dd8f0SOliver-Rainer Wittmann aParaMargin.SetRight( aParaMargin.GetRight() - nRightBorderDistance ); 713*8a2dd8f0SOliver-Rainer Wittmann aParaMargin.SetTxtLeft(aParaMargin.GetTxtLeft() - nLeftBorderDistance ); 714cdf0e10cSrcweir 715*8a2dd8f0SOliver-Rainer Wittmann aParaMargin.SetWhich( RES_LR_SPACE ); 716*8a2dd8f0SOliver-Rainer Wittmann SwTxtFmtColl* pColl = rSh.GetCurTxtFmtColl(); 717cdf0e10cSrcweir 718*8a2dd8f0SOliver-Rainer Wittmann // #i23726# 719*8a2dd8f0SOliver-Rainer Wittmann if (pNumRuleNodeFromDoc) 720*8a2dd8f0SOliver-Rainer Wittmann { 721*8a2dd8f0SOliver-Rainer Wittmann // --> FME 2005-02-22 #i42922# Mouse move of numbering label 722*8a2dd8f0SOliver-Rainer Wittmann // has to consider the left indent of the paragraph 723*8a2dd8f0SOliver-Rainer Wittmann SfxItemSet aSet( GetPool(), RES_LR_SPACE, RES_LR_SPACE ); 724*8a2dd8f0SOliver-Rainer Wittmann rSh.GetCurAttr( aSet ); 725*8a2dd8f0SOliver-Rainer Wittmann const SvxLRSpaceItem& rLR = 726cdf0e10cSrcweir static_cast<const SvxLRSpaceItem&>(aSet.Get(RES_LR_SPACE)); 727*8a2dd8f0SOliver-Rainer Wittmann // <-- 728*8a2dd8f0SOliver-Rainer Wittmann 729*8a2dd8f0SOliver-Rainer Wittmann SwPosition aPos(*pNumRuleNodeFromDoc); 730*8a2dd8f0SOliver-Rainer Wittmann // --> OD 2008-06-09 #i90078# 731*8a2dd8f0SOliver-Rainer Wittmann rSh.SetIndent( static_cast< short >(aParaMargin.GetTxtLeft() - rLR.GetTxtLeft()), aPos); 732*8a2dd8f0SOliver-Rainer Wittmann // <-- 733*8a2dd8f0SOliver-Rainer Wittmann // --> OD 2005-02-18 #i42921# - invalidate state of indent in order 734*8a2dd8f0SOliver-Rainer Wittmann // to get a ruler update. 735*8a2dd8f0SOliver-Rainer Wittmann aParaMargin.SetWhich( nSlot ); 736*8a2dd8f0SOliver-Rainer Wittmann GetViewFrame()->GetBindings().SetState( aParaMargin ); 737*8a2dd8f0SOliver-Rainer Wittmann // <-- 738*8a2dd8f0SOliver-Rainer Wittmann } 739*8a2dd8f0SOliver-Rainer Wittmann else if( pColl && pColl->IsAutoUpdateFmt() ) 740*8a2dd8f0SOliver-Rainer Wittmann { 741*8a2dd8f0SOliver-Rainer Wittmann SfxItemSet aSet(GetPool(), RES_LR_SPACE, RES_LR_SPACE); 742*8a2dd8f0SOliver-Rainer Wittmann aSet.Put(aParaMargin); 743*8a2dd8f0SOliver-Rainer Wittmann rSh.AutoUpdatePara( pColl, aSet); 744*8a2dd8f0SOliver-Rainer Wittmann } 745*8a2dd8f0SOliver-Rainer Wittmann else 746*8a2dd8f0SOliver-Rainer Wittmann rSh.SetAttr( aParaMargin ); 747cdf0e10cSrcweir 748*8a2dd8f0SOliver-Rainer Wittmann if ( aParaMargin.GetTxtFirstLineOfst() < 0 ) 749*8a2dd8f0SOliver-Rainer Wittmann { 750*8a2dd8f0SOliver-Rainer Wittmann SfxItemSet aSet( GetPool(), RES_PARATR_TABSTOP, RES_PARATR_TABSTOP ); 751*8a2dd8f0SOliver-Rainer Wittmann 752*8a2dd8f0SOliver-Rainer Wittmann rSh.GetCurAttr( aSet ); 753*8a2dd8f0SOliver-Rainer Wittmann const SvxTabStopItem& rTabStops = (const SvxTabStopItem&)aSet.Get(RES_PARATR_TABSTOP); 754*8a2dd8f0SOliver-Rainer Wittmann 755*8a2dd8f0SOliver-Rainer Wittmann // Haben wir einen Tab an Stelle Null 756*8a2dd8f0SOliver-Rainer Wittmann sal_uInt16 i; 757*8a2dd8f0SOliver-Rainer Wittmann 758*8a2dd8f0SOliver-Rainer Wittmann for ( i = 0; i < rTabStops.Count(); ++i ) 759*8a2dd8f0SOliver-Rainer Wittmann if ( rTabStops[i].GetTabPos() == 0 ) 760*8a2dd8f0SOliver-Rainer Wittmann break; 761*8a2dd8f0SOliver-Rainer Wittmann 762*8a2dd8f0SOliver-Rainer Wittmann if ( i >= rTabStops.Count() ) 763*8a2dd8f0SOliver-Rainer Wittmann { 764*8a2dd8f0SOliver-Rainer Wittmann // Kein DefTab 765*8a2dd8f0SOliver-Rainer Wittmann SvxTabStopItem aTabStops( RES_PARATR_TABSTOP ); 766*8a2dd8f0SOliver-Rainer Wittmann aTabStops = rTabStops; 767*8a2dd8f0SOliver-Rainer Wittmann 768*8a2dd8f0SOliver-Rainer Wittmann ::lcl_EraseDefTabs(aTabStops); 769*8a2dd8f0SOliver-Rainer Wittmann 770*8a2dd8f0SOliver-Rainer Wittmann SvxTabStop aSwTabStop( 0, SVX_TAB_ADJUST_DEFAULT ); 771*8a2dd8f0SOliver-Rainer Wittmann aTabStops.Insert(aSwTabStop); 772*8a2dd8f0SOliver-Rainer Wittmann 773*8a2dd8f0SOliver-Rainer Wittmann const SvxTabStopItem& rDefTabs = 774*8a2dd8f0SOliver-Rainer Wittmann (const SvxTabStopItem&)rSh.GetDefault(RES_PARATR_TABSTOP); 775*8a2dd8f0SOliver-Rainer Wittmann sal_uInt16 nDef = ::GetTabDist(rDefTabs); 776*8a2dd8f0SOliver-Rainer Wittmann ::MakeDefTabs( nDef, aTabStops ); 777*8a2dd8f0SOliver-Rainer Wittmann 778*8a2dd8f0SOliver-Rainer Wittmann if( pColl && pColl->IsAutoUpdateFmt()) 779*8a2dd8f0SOliver-Rainer Wittmann { 780*8a2dd8f0SOliver-Rainer Wittmann SfxItemSet aSetTmp(GetPool(), RES_PARATR_TABSTOP, RES_PARATR_TABSTOP); 781*8a2dd8f0SOliver-Rainer Wittmann aSetTmp.Put(aTabStops); 782*8a2dd8f0SOliver-Rainer Wittmann rSh.AutoUpdatePara( pColl, aSetTmp ); 783*8a2dd8f0SOliver-Rainer Wittmann } 784*8a2dd8f0SOliver-Rainer Wittmann else 785*8a2dd8f0SOliver-Rainer Wittmann rSh.SetAttr( aTabStops ); 786*8a2dd8f0SOliver-Rainer Wittmann } 787*8a2dd8f0SOliver-Rainer Wittmann } 788*8a2dd8f0SOliver-Rainer Wittmann } 789*8a2dd8f0SOliver-Rainer Wittmann break; 790cdf0e10cSrcweir 791cdf0e10cSrcweir case SID_RULER_BORDERS_VERTICAL: 792cdf0e10cSrcweir case SID_RULER_BORDERS: 793*8a2dd8f0SOliver-Rainer Wittmann { 794*8a2dd8f0SOliver-Rainer Wittmann SvxColumnItem aColItem((const SvxColumnItem&)rReq. 795*8a2dd8f0SOliver-Rainer Wittmann GetArgs()->Get(nSlot)); 796cdf0e10cSrcweir 797*8a2dd8f0SOliver-Rainer Wittmann if( bSetTabColFromDoc || (!bSect && rSh.GetTableFmt()) ) 798*8a2dd8f0SOliver-Rainer Wittmann { 799*8a2dd8f0SOliver-Rainer Wittmann ASSERT(aColItem.Count(), "ColDesc ist leer!!"); 800cdf0e10cSrcweir 801*8a2dd8f0SOliver-Rainer Wittmann const sal_Bool bSingleLine = ((const SfxBoolItem&)rReq. 802*8a2dd8f0SOliver-Rainer Wittmann GetArgs()->Get(SID_RULER_ACT_LINE_ONLY)).GetValue(); 803cdf0e10cSrcweir 804*8a2dd8f0SOliver-Rainer Wittmann SwTabCols aTabCols; 805*8a2dd8f0SOliver-Rainer Wittmann if ( bSetTabColFromDoc ) 806*8a2dd8f0SOliver-Rainer Wittmann rSh.GetMouseTabCols( aTabCols, aTabColFromDocPos ); 807*8a2dd8f0SOliver-Rainer Wittmann else 808*8a2dd8f0SOliver-Rainer Wittmann rSh.GetTabCols(aTabCols); 809cdf0e10cSrcweir 810*8a2dd8f0SOliver-Rainer Wittmann // linker Tabellenrand 811*8a2dd8f0SOliver-Rainer Wittmann long nBorder = (long)(aColItem.GetLeft() - aTabCols.GetLeftMin()); 812*8a2dd8f0SOliver-Rainer Wittmann aTabCols.SetLeft( nBorder ); 813cdf0e10cSrcweir 814*8a2dd8f0SOliver-Rainer Wittmann nBorder = (bVerticalWriting ? nPageHeight : nPageWidth) - aTabCols.GetLeftMin() - aColItem.GetRight(); 815cdf0e10cSrcweir 816cdf0e10cSrcweir #ifdef DEBUG 817*8a2dd8f0SOliver-Rainer Wittmann long nTmp1 = nPageWidth; 818*8a2dd8f0SOliver-Rainer Wittmann long nTmp2 = aTabCols.GetLeftMin() + nBorder; 819*8a2dd8f0SOliver-Rainer Wittmann (void)nTmp1; 820*8a2dd8f0SOliver-Rainer Wittmann (void)nTmp2; 821cdf0e10cSrcweir #endif 822cdf0e10cSrcweir 823*8a2dd8f0SOliver-Rainer Wittmann if ( aColItem.GetRight() > 0 ) 824*8a2dd8f0SOliver-Rainer Wittmann aTabCols.SetRight( nBorder ); 825cdf0e10cSrcweir 826*8a2dd8f0SOliver-Rainer Wittmann // Tabcols der Reihe nach 827*8a2dd8f0SOliver-Rainer Wittmann // Die letzte Col wird durch den Rand definiert 828*8a2dd8f0SOliver-Rainer Wittmann //columns in right-to-left tables need to be mirrored 829*8a2dd8f0SOliver-Rainer Wittmann sal_Bool bIsTableRTL = 830*8a2dd8f0SOliver-Rainer Wittmann IsTabColFromDoc() ? 831*8a2dd8f0SOliver-Rainer Wittmann rSh.IsMouseTableRightToLeft(aTabColFromDocPos) 832cdf0e10cSrcweir : rSh.IsTableRightToLeft(); 833*8a2dd8f0SOliver-Rainer Wittmann if(bIsTableRTL) 834*8a2dd8f0SOliver-Rainer Wittmann { 835*8a2dd8f0SOliver-Rainer Wittmann sal_uInt16 nColCount = aColItem.Count() - 1; 836*8a2dd8f0SOliver-Rainer Wittmann for ( sal_uInt16 i = 0; i < nColCount; ++i ) 837*8a2dd8f0SOliver-Rainer Wittmann { 838*8a2dd8f0SOliver-Rainer Wittmann const SvxColumnDescription& rCol = aColItem[nColCount - i]; 839*8a2dd8f0SOliver-Rainer Wittmann aTabCols[i] = aTabCols.GetRight() - rCol.nStart; 840*8a2dd8f0SOliver-Rainer Wittmann aTabCols.SetHidden( i, !rCol.bVisible ); 841*8a2dd8f0SOliver-Rainer Wittmann } 842*8a2dd8f0SOliver-Rainer Wittmann } 843*8a2dd8f0SOliver-Rainer Wittmann else 844*8a2dd8f0SOliver-Rainer Wittmann { 845*8a2dd8f0SOliver-Rainer Wittmann for ( sal_uInt16 i = 0; i < aColItem.Count()-1; ++i ) 846*8a2dd8f0SOliver-Rainer Wittmann { 847*8a2dd8f0SOliver-Rainer Wittmann const SvxColumnDescription& rCol = aColItem[i]; 848*8a2dd8f0SOliver-Rainer Wittmann aTabCols[i] = rCol.nEnd + aTabCols.GetLeft(); 849*8a2dd8f0SOliver-Rainer Wittmann aTabCols.SetHidden( i, !rCol.bVisible ); 850*8a2dd8f0SOliver-Rainer Wittmann } 851*8a2dd8f0SOliver-Rainer Wittmann } 852cdf0e10cSrcweir 853*8a2dd8f0SOliver-Rainer Wittmann if ( bSetTabColFromDoc ) 854*8a2dd8f0SOliver-Rainer Wittmann { 855*8a2dd8f0SOliver-Rainer Wittmann if( !rSh.IsViewLocked() ) 856*8a2dd8f0SOliver-Rainer Wittmann { 857*8a2dd8f0SOliver-Rainer Wittmann bUnlockView = sal_True; 858*8a2dd8f0SOliver-Rainer Wittmann rSh.LockView( sal_True ); 859*8a2dd8f0SOliver-Rainer Wittmann } 860*8a2dd8f0SOliver-Rainer Wittmann rSh.SetMouseTabCols( aTabCols, bSingleLine, 861*8a2dd8f0SOliver-Rainer Wittmann aTabColFromDocPos ); 862*8a2dd8f0SOliver-Rainer Wittmann } 863*8a2dd8f0SOliver-Rainer Wittmann else 864*8a2dd8f0SOliver-Rainer Wittmann rSh.SetTabCols(aTabCols, bSingleLine); 865cdf0e10cSrcweir 866*8a2dd8f0SOliver-Rainer Wittmann } 867*8a2dd8f0SOliver-Rainer Wittmann else 868*8a2dd8f0SOliver-Rainer Wittmann { 869*8a2dd8f0SOliver-Rainer Wittmann if ( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY || bSect) 870*8a2dd8f0SOliver-Rainer Wittmann { 871*8a2dd8f0SOliver-Rainer Wittmann SwSectionFmt *pSectFmt = 0; 872*8a2dd8f0SOliver-Rainer Wittmann SfxItemSet aSet( GetPool(), RES_COL, RES_COL ); 873*8a2dd8f0SOliver-Rainer Wittmann if(bSect) 874*8a2dd8f0SOliver-Rainer Wittmann { 875*8a2dd8f0SOliver-Rainer Wittmann const SwSection *pSect = rSh.GetAnySection(); 876*8a2dd8f0SOliver-Rainer Wittmann ASSERT( pSect, "Welcher Bereich?"); 877*8a2dd8f0SOliver-Rainer Wittmann pSectFmt = pSect->GetFmt(); 878*8a2dd8f0SOliver-Rainer Wittmann } 879*8a2dd8f0SOliver-Rainer Wittmann else 880*8a2dd8f0SOliver-Rainer Wittmann { 881*8a2dd8f0SOliver-Rainer Wittmann rSh.GetFlyFrmAttr( aSet ); 882*8a2dd8f0SOliver-Rainer Wittmann } 883*8a2dd8f0SOliver-Rainer Wittmann SwFmtCol aCols( 884*8a2dd8f0SOliver-Rainer Wittmann bSect ? 885*8a2dd8f0SOliver-Rainer Wittmann pSectFmt->GetCol() : 886*8a2dd8f0SOliver-Rainer Wittmann (const SwFmtCol&)aSet.Get( RES_COL, sal_False )); 887*8a2dd8f0SOliver-Rainer Wittmann SwRect aCurRect = rSh.GetAnyCurRect(bSect ? RECT_SECTION_PRT : RECT_FLY_PRT_EMBEDDED); 888*8a2dd8f0SOliver-Rainer Wittmann const long lWidth = bVerticalWriting ? aCurRect.Height() : aCurRect.Width(); 889*8a2dd8f0SOliver-Rainer Wittmann ::lcl_ConvertToCols( aColItem, sal_uInt16(lWidth), aCols ); 890*8a2dd8f0SOliver-Rainer Wittmann aSet.Put( aCols ); 891*8a2dd8f0SOliver-Rainer Wittmann if(bSect) 892*8a2dd8f0SOliver-Rainer Wittmann rSh.SetSectionAttr( aSet, pSectFmt ); 893*8a2dd8f0SOliver-Rainer Wittmann else 894*8a2dd8f0SOliver-Rainer Wittmann { 895*8a2dd8f0SOliver-Rainer Wittmann rSh.StartAction(); 896*8a2dd8f0SOliver-Rainer Wittmann rSh.Push(); 897*8a2dd8f0SOliver-Rainer Wittmann rSh.SetFlyFrmAttr( aSet ); 898*8a2dd8f0SOliver-Rainer Wittmann //die Rahmenselektion wieder aufheben 899*8a2dd8f0SOliver-Rainer Wittmann if(!bFrmSelection && rSh.IsFrmSelected()) 900*8a2dd8f0SOliver-Rainer Wittmann { 901*8a2dd8f0SOliver-Rainer Wittmann rSh.UnSelectFrm(); 902*8a2dd8f0SOliver-Rainer Wittmann rSh.LeaveSelFrmMode(); 903*8a2dd8f0SOliver-Rainer Wittmann } 904*8a2dd8f0SOliver-Rainer Wittmann rSh.Pop(); 905*8a2dd8f0SOliver-Rainer Wittmann rSh.EndAction(); 906*8a2dd8f0SOliver-Rainer Wittmann } 907*8a2dd8f0SOliver-Rainer Wittmann } 908*8a2dd8f0SOliver-Rainer Wittmann else 909*8a2dd8f0SOliver-Rainer Wittmann { 910*8a2dd8f0SOliver-Rainer Wittmann SwFmtCol aCols( rDesc.GetMaster().GetCol() ); 911*8a2dd8f0SOliver-Rainer Wittmann const SwRect aPrtRect = rSh.GetAnyCurRect(RECT_PAGE_PRT); 912*8a2dd8f0SOliver-Rainer Wittmann ::lcl_ConvertToCols( aColItem, 913*8a2dd8f0SOliver-Rainer Wittmann sal_uInt16(bVerticalWriting ? aPrtRect.Height() : aPrtRect.Width()), 914*8a2dd8f0SOliver-Rainer Wittmann aCols ); 915*8a2dd8f0SOliver-Rainer Wittmann SwPageDesc aDesc( rDesc ); 916*8a2dd8f0SOliver-Rainer Wittmann aDesc.GetMaster().SetFmtAttr( aCols ); 917*8a2dd8f0SOliver-Rainer Wittmann rSh.ChgPageDesc( rSh.GetCurPageDesc(), aDesc ); 918*8a2dd8f0SOliver-Rainer Wittmann } 919*8a2dd8f0SOliver-Rainer Wittmann } 920*8a2dd8f0SOliver-Rainer Wittmann } 921*8a2dd8f0SOliver-Rainer Wittmann break; 922cdf0e10cSrcweir 923*8a2dd8f0SOliver-Rainer Wittmann case SID_RULER_ROWS : 924*8a2dd8f0SOliver-Rainer Wittmann case SID_RULER_ROWS_VERTICAL: 925*8a2dd8f0SOliver-Rainer Wittmann { 926*8a2dd8f0SOliver-Rainer Wittmann SvxColumnItem aColItem((const SvxColumnItem&)rReq. 927*8a2dd8f0SOliver-Rainer Wittmann GetArgs()->Get(nSlot)); 928*8a2dd8f0SOliver-Rainer Wittmann 929*8a2dd8f0SOliver-Rainer Wittmann if( bSetTabColFromDoc || (!bSect && rSh.GetTableFmt()) ) 930*8a2dd8f0SOliver-Rainer Wittmann { 931*8a2dd8f0SOliver-Rainer Wittmann ASSERT(aColItem.Count(), "ColDesc ist leer!!"); 932*8a2dd8f0SOliver-Rainer Wittmann 933*8a2dd8f0SOliver-Rainer Wittmann SwTabCols aTabCols; 934*8a2dd8f0SOliver-Rainer Wittmann if ( bSetTabRowFromDoc ) 935*8a2dd8f0SOliver-Rainer Wittmann rSh.GetMouseTabRows( aTabCols, aTabColFromDocPos ); 936*8a2dd8f0SOliver-Rainer Wittmann else 937*8a2dd8f0SOliver-Rainer Wittmann rSh.GetTabRows(aTabCols); 938*8a2dd8f0SOliver-Rainer Wittmann 939*8a2dd8f0SOliver-Rainer Wittmann if ( bVerticalWriting ) 940*8a2dd8f0SOliver-Rainer Wittmann { 941*8a2dd8f0SOliver-Rainer Wittmann aTabCols.SetRight(nPageWidth - aColItem.GetRight() - aColItem.GetLeft()); 942*8a2dd8f0SOliver-Rainer Wittmann aTabCols.SetLeftMin(aColItem.GetLeft()); 943*8a2dd8f0SOliver-Rainer Wittmann } 944*8a2dd8f0SOliver-Rainer Wittmann else 945*8a2dd8f0SOliver-Rainer Wittmann { 946*8a2dd8f0SOliver-Rainer Wittmann long nBorder = nPageHeight - aTabCols.GetLeftMin() - aColItem.GetRight(); 947*8a2dd8f0SOliver-Rainer Wittmann aTabCols.SetRight( nBorder ); 948*8a2dd8f0SOliver-Rainer Wittmann } 949*8a2dd8f0SOliver-Rainer Wittmann 950*8a2dd8f0SOliver-Rainer Wittmann if(bVerticalWriting) 951*8a2dd8f0SOliver-Rainer Wittmann { 952*8a2dd8f0SOliver-Rainer Wittmann for ( sal_uInt16 i = aColItem.Count() - 1; i; --i ) 953*8a2dd8f0SOliver-Rainer Wittmann { 954*8a2dd8f0SOliver-Rainer Wittmann const SvxColumnDescription& rCol = aColItem[i - 1]; 955*8a2dd8f0SOliver-Rainer Wittmann long nColumnPos = aTabCols.GetRight() - rCol.nEnd ; 956*8a2dd8f0SOliver-Rainer Wittmann aTabCols[i - 1] = nColumnPos; 957*8a2dd8f0SOliver-Rainer Wittmann aTabCols.SetHidden( i - 1, !rCol.bVisible ); 958*8a2dd8f0SOliver-Rainer Wittmann } 959*8a2dd8f0SOliver-Rainer Wittmann } 960*8a2dd8f0SOliver-Rainer Wittmann else 961*8a2dd8f0SOliver-Rainer Wittmann { 962*8a2dd8f0SOliver-Rainer Wittmann for ( sal_uInt16 i = 0; i < aColItem.Count()-1; ++i ) 963*8a2dd8f0SOliver-Rainer Wittmann { 964*8a2dd8f0SOliver-Rainer Wittmann const SvxColumnDescription& rCol = aColItem[i]; 965*8a2dd8f0SOliver-Rainer Wittmann aTabCols[i] = rCol.nEnd + aTabCols.GetLeft(); 966*8a2dd8f0SOliver-Rainer Wittmann aTabCols.SetHidden( i, !rCol.bVisible ); 967*8a2dd8f0SOliver-Rainer Wittmann } 968*8a2dd8f0SOliver-Rainer Wittmann } 969*8a2dd8f0SOliver-Rainer Wittmann sal_Bool bSingleLine = sal_False; 970*8a2dd8f0SOliver-Rainer Wittmann const SfxPoolItem* pSingleLine; 971*8a2dd8f0SOliver-Rainer Wittmann if( SFX_ITEM_SET == rReq.GetArgs()->GetItemState(SID_RULER_ACT_LINE_ONLY, sal_False, &pSingleLine)) 972*8a2dd8f0SOliver-Rainer Wittmann bSingleLine = ((const SfxBoolItem*)pSingleLine)->GetValue(); 973*8a2dd8f0SOliver-Rainer Wittmann if ( bSetTabRowFromDoc ) 974*8a2dd8f0SOliver-Rainer Wittmann { 975*8a2dd8f0SOliver-Rainer Wittmann if( !rSh.IsViewLocked() ) 976*8a2dd8f0SOliver-Rainer Wittmann { 977*8a2dd8f0SOliver-Rainer Wittmann bUnlockView = sal_True; 978*8a2dd8f0SOliver-Rainer Wittmann rSh.LockView( sal_True ); 979*8a2dd8f0SOliver-Rainer Wittmann } 980*8a2dd8f0SOliver-Rainer Wittmann rSh.SetMouseTabRows( aTabCols, bSingleLine, aTabColFromDocPos ); 981*8a2dd8f0SOliver-Rainer Wittmann } 982*8a2dd8f0SOliver-Rainer Wittmann else 983*8a2dd8f0SOliver-Rainer Wittmann rSh.SetTabRows(aTabCols, bSingleLine); 984*8a2dd8f0SOliver-Rainer Wittmann } 985*8a2dd8f0SOliver-Rainer Wittmann } 986*8a2dd8f0SOliver-Rainer Wittmann break; 987cdf0e10cSrcweir 988cdf0e10cSrcweir default: 989*8a2dd8f0SOliver-Rainer Wittmann ASSERT( !this, "Falsche SlotId"); 990*8a2dd8f0SOliver-Rainer Wittmann } 991*8a2dd8f0SOliver-Rainer Wittmann rSh.EndAllAction(); 992cdf0e10cSrcweir 993*8a2dd8f0SOliver-Rainer Wittmann if( bUnlockView ) 994*8a2dd8f0SOliver-Rainer Wittmann rSh.LockView( sal_False ); 995cdf0e10cSrcweir 996cdf0e10cSrcweir bSetTabColFromDoc = bSetTabRowFromDoc = bTabColFromDoc = bTabRowFromDoc = sal_False; 997cdf0e10cSrcweir SetNumRuleNodeFromDoc(NULL); 998cdf0e10cSrcweir } 999cdf0e10cSrcweir 1000cdf0e10cSrcweir /*-------------------------------------------------------------------- 1001cdf0e10cSrcweir Beschreibung: Hier wird der Status der Tableiste ermittelt 1002cdf0e10cSrcweir sprich alle relevanten Attribute an der CursorPos 1003cdf0e10cSrcweir werden der Tableiste uebermittelt 1004cdf0e10cSrcweir --------------------------------------------------------------------*/ 1005cdf0e10cSrcweir 1006cdf0e10cSrcweir 1007cdf0e10cSrcweir void SwView::StateTabWin(SfxItemSet& rSet) 1008cdf0e10cSrcweir { 1009*8a2dd8f0SOliver-Rainer Wittmann SwWrtShell &rSh = GetWrtShell(); 1010cdf0e10cSrcweir 1011cdf0e10cSrcweir const Point* pPt = IsTabColFromDoc() || IsTabRowFromDoc() ? &aTabColFromDocPos : 0; 1012*8a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nFrmType = rSh.IsObjSelected() 1013*8a2dd8f0SOliver-Rainer Wittmann ? FRMTYPE_DRAWOBJ 1014*8a2dd8f0SOliver-Rainer Wittmann : rSh.GetFrmType( pPt, sal_True ); 1015*8a2dd8f0SOliver-Rainer Wittmann 1016*8a2dd8f0SOliver-Rainer Wittmann const sal_Bool bFrmSelection = rSh.IsFrmSelected(); 1017*8a2dd8f0SOliver-Rainer Wittmann const sal_Bool bBrowse = rSh.GetViewOptions()->getBrowseMode(); 1018*8a2dd8f0SOliver-Rainer Wittmann // PageOffset/Begrenzer 1019*8a2dd8f0SOliver-Rainer Wittmann const SwRect& rPageRect = rSh.GetAnyCurRect( RECT_PAGE, pPt ); 1020*8a2dd8f0SOliver-Rainer Wittmann const SwRect& rPagePrtRect = rSh.GetAnyCurRect( RECT_PAGE_PRT, pPt ); 1021*8a2dd8f0SOliver-Rainer Wittmann const long nPageWidth = rPageRect.Width(); 1022*8a2dd8f0SOliver-Rainer Wittmann const long nPageHeight = rPageRect.Height(); 1023cdf0e10cSrcweir 1024cdf0e10cSrcweir const SwPageDesc& rDesc = rSh.GetPageDesc( 1025cdf0e10cSrcweir IsTabColFromDoc() || bTabRowFromDoc ? 1026cdf0e10cSrcweir rSh.GetMousePageDesc(aTabColFromDocPos) : rSh.GetCurPageDesc() ); 1027cdf0e10cSrcweir 1028cdf0e10cSrcweir const SvxFrameDirectionItem& rFrameDir = rDesc.GetMaster().GetFrmDir(); 1029cdf0e10cSrcweir const sal_Bool bVerticalWriting = rSh.IsInVerticalText(); 1030cdf0e10cSrcweir 1031cdf0e10cSrcweir //enable tab stop display on the rulers depending on the writing direction 1032cdf0e10cSrcweir WinBits nRulerStyle = pHRuler->GetStyle() & ~WB_EXTRAFIELD; 1033cdf0e10cSrcweir pHRuler->SetStyle(bVerticalWriting||bBrowse ? nRulerStyle : nRulerStyle|WB_EXTRAFIELD); 1034cdf0e10cSrcweir nRulerStyle = pVRuler->GetStyle() & ~WB_EXTRAFIELD; 1035cdf0e10cSrcweir pVRuler->SetStyle(bVerticalWriting ? nRulerStyle|WB_EXTRAFIELD : nRulerStyle); 1036cdf0e10cSrcweir 1037cdf0e10cSrcweir //#i24363# tab stops relative to indent 1038cdf0e10cSrcweir bool bRelative = rSh.getIDocumentSettingAccess()->get(IDocumentSettingAccess::TABS_RELATIVE_TO_INDENT); 1039cdf0e10cSrcweir pHRuler->SetTabsRelativeToIndent( bRelative ); 1040cdf0e10cSrcweir pVRuler->SetTabsRelativeToIndent( bRelative ); 1041cdf0e10cSrcweir 1042cdf0e10cSrcweir SvxLRSpaceItem aPageLRSpace( rDesc.GetMaster().GetLRSpace() ); 1043*8a2dd8f0SOliver-Rainer Wittmann SwapPageMargin( rDesc, aPageLRSpace ); 1044cdf0e10cSrcweir 1045*8a2dd8f0SOliver-Rainer Wittmann SfxItemSet aCoreSet( GetPool(), RES_PARATR_TABSTOP, RES_PARATR_TABSTOP, 1046*8a2dd8f0SOliver-Rainer Wittmann RES_LR_SPACE, RES_UL_SPACE, 0 ); 1047cdf0e10cSrcweir // get also the list level indent values merged as LR-SPACE item, if needed. 1048cdf0e10cSrcweir rSh.GetCurAttr( aCoreSet, true ); 1049cdf0e10cSrcweir SelectionType nSelType = rSh.GetSelectionType(); 1050cdf0e10cSrcweir 1051*8a2dd8f0SOliver-Rainer Wittmann SfxWhichIter aIter( rSet ); 1052*8a2dd8f0SOliver-Rainer Wittmann sal_uInt16 nWhich = aIter.FirstWhich(); 1053cdf0e10cSrcweir sal_Bool bPutContentProtection = sal_False; 1054cdf0e10cSrcweir 1055ff0525f2SOliver-Rainer Wittmann while ( nWhich ) 1056ff0525f2SOliver-Rainer Wittmann { 1057ff0525f2SOliver-Rainer Wittmann switch ( nWhich ) 1058ff0525f2SOliver-Rainer Wittmann { 1059*8a2dd8f0SOliver-Rainer Wittmann case SID_ATTR_PAGE_COLUMN: 1060ff0525f2SOliver-Rainer Wittmann { 1061*8a2dd8f0SOliver-Rainer Wittmann sal_uInt16 nColumnType = 0; 1062*8a2dd8f0SOliver-Rainer Wittmann 1063*8a2dd8f0SOliver-Rainer Wittmann const SwFrmFmt& rMaster = rDesc.GetMaster(); 1064*8a2dd8f0SOliver-Rainer Wittmann SwFmtCol aCol(rMaster.GetCol()); 1065*8a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nCols = aCol.GetNumCols(); 1066*8a2dd8f0SOliver-Rainer Wittmann if ( nCols == 0 ) 1067*8a2dd8f0SOliver-Rainer Wittmann { 1068*8a2dd8f0SOliver-Rainer Wittmann nColumnType = 1; 1069*8a2dd8f0SOliver-Rainer Wittmann } 1070*8a2dd8f0SOliver-Rainer Wittmann else if ( nCols == 2 ) 1071*8a2dd8f0SOliver-Rainer Wittmann { 1072*8a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nColLeft = aCol.CalcPrtColWidth(0, aCol.GetWishWidth()); 1073*8a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nColRight = aCol.CalcPrtColWidth(1, aCol.GetWishWidth()); 1074*8a2dd8f0SOliver-Rainer Wittmann 1075*8a2dd8f0SOliver-Rainer Wittmann if ( abs(nColLeft - nColRight) <= 10 ) 1076*8a2dd8f0SOliver-Rainer Wittmann { 1077*8a2dd8f0SOliver-Rainer Wittmann nColumnType = 2; 1078*8a2dd8f0SOliver-Rainer Wittmann } 1079*8a2dd8f0SOliver-Rainer Wittmann else if( abs(nColLeft - nColRight*2) < 20 ) 1080*8a2dd8f0SOliver-Rainer Wittmann { 1081*8a2dd8f0SOliver-Rainer Wittmann nColumnType = 4; 1082*8a2dd8f0SOliver-Rainer Wittmann } 1083*8a2dd8f0SOliver-Rainer Wittmann else if( abs(nColLeft*2 - nColRight) < 20 ) 1084*8a2dd8f0SOliver-Rainer Wittmann { 1085*8a2dd8f0SOliver-Rainer Wittmann nColumnType = 5; 1086*8a2dd8f0SOliver-Rainer Wittmann } 1087*8a2dd8f0SOliver-Rainer Wittmann } 1088*8a2dd8f0SOliver-Rainer Wittmann else if( nCols == 3 ) 1089*8a2dd8f0SOliver-Rainer Wittmann { 1090*8a2dd8f0SOliver-Rainer Wittmann nColumnType = 3; 1091*8a2dd8f0SOliver-Rainer Wittmann } 1092*8a2dd8f0SOliver-Rainer Wittmann 1093*8a2dd8f0SOliver-Rainer Wittmann rSet.Put( SfxInt16Item( SID_ATTR_PAGE_COLUMN, nColumnType ) ); 1094ff0525f2SOliver-Rainer Wittmann } 1095*8a2dd8f0SOliver-Rainer Wittmann break; 1096ff0525f2SOliver-Rainer Wittmann 1097*8a2dd8f0SOliver-Rainer Wittmann case SID_ATTR_LONG_LRSPACE: 1098*8a2dd8f0SOliver-Rainer Wittmann { 1099*8a2dd8f0SOliver-Rainer Wittmann SvxLongLRSpaceItem aLongLR( (long)aPageLRSpace.GetLeft(), 1100*8a2dd8f0SOliver-Rainer Wittmann (long)aPageLRSpace.GetRight(), 1101*8a2dd8f0SOliver-Rainer Wittmann SID_ATTR_LONG_LRSPACE); 1102*8a2dd8f0SOliver-Rainer Wittmann if(bBrowse) 1103ff0525f2SOliver-Rainer Wittmann { 1104*8a2dd8f0SOliver-Rainer Wittmann aLongLR.SetLeft(rPagePrtRect.Left()); 1105*8a2dd8f0SOliver-Rainer Wittmann aLongLR.SetRight(nPageWidth - rPagePrtRect.Right()); 1106ff0525f2SOliver-Rainer Wittmann } 1107*8a2dd8f0SOliver-Rainer Wittmann if ( ( nFrmType & FRMTYPE_HEADER || nFrmType & FRMTYPE_FOOTER ) && 1108*8a2dd8f0SOliver-Rainer Wittmann !(nFrmType & FRMTYPE_COLSECT) ) 1109ff0525f2SOliver-Rainer Wittmann { 1110*8a2dd8f0SOliver-Rainer Wittmann SwFrmFmt *pFmt = (SwFrmFmt*) (nFrmType & FRMTYPE_HEADER ? 1111*8a2dd8f0SOliver-Rainer Wittmann rDesc.GetMaster().GetHeader().GetHeaderFmt() : 1112*8a2dd8f0SOliver-Rainer Wittmann rDesc.GetMaster().GetFooter().GetFooterFmt()); 1113*8a2dd8f0SOliver-Rainer Wittmann if( pFmt )// #i80890# if rDesc is not the one belonging to the current page is might crash 1114*8a2dd8f0SOliver-Rainer Wittmann { 1115*8a2dd8f0SOliver-Rainer Wittmann SwRect aRect( rSh.GetAnyCurRect( RECT_HEADERFOOTER, pPt)); 1116*8a2dd8f0SOliver-Rainer Wittmann aRect.Pos() -= rSh.GetAnyCurRect( RECT_PAGE, pPt ).Pos(); 1117*8a2dd8f0SOliver-Rainer Wittmann const SvxLRSpaceItem& aLR = pFmt->GetLRSpace(); 1118*8a2dd8f0SOliver-Rainer Wittmann aLongLR.SetLeft ( (long)aLR.GetLeft() + (long)aRect.Left() ); 1119*8a2dd8f0SOliver-Rainer Wittmann aLongLR.SetRight( (nPageWidth - 1120*8a2dd8f0SOliver-Rainer Wittmann (long)aRect.Right() + (long)aLR.GetRight())); 1121*8a2dd8f0SOliver-Rainer Wittmann } 1122ff0525f2SOliver-Rainer Wittmann } 1123*8a2dd8f0SOliver-Rainer Wittmann else 1124ff0525f2SOliver-Rainer Wittmann { 1125*8a2dd8f0SOliver-Rainer Wittmann SwRect aRect; 1126*8a2dd8f0SOliver-Rainer Wittmann if( !bFrmSelection && ((nFrmType & FRMTYPE_COLSECT) || rSh.IsDirectlyInSection()) ) 1127*8a2dd8f0SOliver-Rainer Wittmann { 1128*8a2dd8f0SOliver-Rainer Wittmann aRect = rSh.GetAnyCurRect(RECT_SECTION_PRT, pPt); 1129*8a2dd8f0SOliver-Rainer Wittmann const SwRect aTmpRect = rSh.GetAnyCurRect(RECT_SECTION, pPt); 1130*8a2dd8f0SOliver-Rainer Wittmann aRect.Pos() += aTmpRect.Pos(); 1131*8a2dd8f0SOliver-Rainer Wittmann } 1132*8a2dd8f0SOliver-Rainer Wittmann 1133*8a2dd8f0SOliver-Rainer Wittmann else if ( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY ) 1134*8a2dd8f0SOliver-Rainer Wittmann aRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED, pPt); 1135*8a2dd8f0SOliver-Rainer Wittmann else if( nFrmType & FRMTYPE_DRAWOBJ) 1136*8a2dd8f0SOliver-Rainer Wittmann aRect = rSh.GetObjRect(); 1137*8a2dd8f0SOliver-Rainer Wittmann 1138*8a2dd8f0SOliver-Rainer Wittmann if( aRect.Width() ) 1139*8a2dd8f0SOliver-Rainer Wittmann { 1140*8a2dd8f0SOliver-Rainer Wittmann // PAGES01 1141*8a2dd8f0SOliver-Rainer Wittmann // make relative to page position: 1142*8a2dd8f0SOliver-Rainer Wittmann aLongLR.SetLeft ((long)( aRect.Left() - rPageRect.Left() )); 1143*8a2dd8f0SOliver-Rainer Wittmann aLongLR.SetRight((long)( rPageRect.Right() - aRect.Right())); 1144*8a2dd8f0SOliver-Rainer Wittmann } 1145ff0525f2SOliver-Rainer Wittmann } 1146*8a2dd8f0SOliver-Rainer Wittmann if( nWhich == SID_ATTR_LONG_LRSPACE ) 1147*8a2dd8f0SOliver-Rainer Wittmann rSet.Put( aLongLR ); 1148*8a2dd8f0SOliver-Rainer Wittmann else 1149*8a2dd8f0SOliver-Rainer Wittmann { 1150*8a2dd8f0SOliver-Rainer Wittmann SvxLRSpaceItem aLR( aLongLR.GetLeft(), 1151*8a2dd8f0SOliver-Rainer Wittmann aLongLR.GetRight(), 1152*8a2dd8f0SOliver-Rainer Wittmann 0, 0, 1153*8a2dd8f0SOliver-Rainer Wittmann nWhich); 1154*8a2dd8f0SOliver-Rainer Wittmann rSet.Put(aLR); 1155*8a2dd8f0SOliver-Rainer Wittmann } 1156*8a2dd8f0SOliver-Rainer Wittmann break; 1157ff0525f2SOliver-Rainer Wittmann } 1158*8a2dd8f0SOliver-Rainer Wittmann 1159*8a2dd8f0SOliver-Rainer Wittmann // provide left and right margins of current page style 1160*8a2dd8f0SOliver-Rainer Wittmann case SID_ATTR_PAGE_LRSPACE: 1161ff0525f2SOliver-Rainer Wittmann { 1162*8a2dd8f0SOliver-Rainer Wittmann SvxLongLRSpaceItem aLongLR( 1163*8a2dd8f0SOliver-Rainer Wittmann (long)aPageLRSpace.GetLeft(), 1164*8a2dd8f0SOliver-Rainer Wittmann (long)aPageLRSpace.GetRight(), 1165*8a2dd8f0SOliver-Rainer Wittmann SID_ATTR_PAGE_LRSPACE ); 1166*8a2dd8f0SOliver-Rainer Wittmann rSet.Put( aLongLR ); 1167ff0525f2SOliver-Rainer Wittmann } 1168*8a2dd8f0SOliver-Rainer Wittmann break; 1169ff0525f2SOliver-Rainer Wittmann 1170*8a2dd8f0SOliver-Rainer Wittmann case SID_ATTR_LONG_ULSPACE: 1171*8a2dd8f0SOliver-Rainer Wittmann { 1172*8a2dd8f0SOliver-Rainer Wittmann // Rand Seite Oben Unten 1173*8a2dd8f0SOliver-Rainer Wittmann SvxULSpaceItem aUL( rDesc.GetMaster().GetULSpace() ); 1174*8a2dd8f0SOliver-Rainer Wittmann SvxLongULSpaceItem aLongUL( (long)aUL.GetUpper(), 1175*8a2dd8f0SOliver-Rainer Wittmann (long)aUL.GetLower(), 1176*8a2dd8f0SOliver-Rainer Wittmann SID_ATTR_LONG_ULSPACE); 1177*8a2dd8f0SOliver-Rainer Wittmann 1178*8a2dd8f0SOliver-Rainer Wittmann if ( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY ) 1179*8a2dd8f0SOliver-Rainer Wittmann { 1180*8a2dd8f0SOliver-Rainer Wittmann // Dokumentkoordinaten Frame auf Seitenkoordinaten umbrechen 1181*8a2dd8f0SOliver-Rainer Wittmann const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED, pPt); 1182*8a2dd8f0SOliver-Rainer Wittmann aLongUL.SetUpper((sal_uInt16)(rRect.Top() - rPageRect.Top() )); 1183*8a2dd8f0SOliver-Rainer Wittmann aLongUL.SetLower((sal_uInt16)(rPageRect.Bottom() - rRect.Bottom() )); 1184*8a2dd8f0SOliver-Rainer Wittmann } 1185*8a2dd8f0SOliver-Rainer Wittmann else if ( nFrmType & FRMTYPE_HEADER || nFrmType & FRMTYPE_FOOTER ) 1186cdf0e10cSrcweir { 1187cdf0e10cSrcweir SwRect aRect( rSh.GetAnyCurRect( RECT_HEADERFOOTER, pPt)); 1188cdf0e10cSrcweir aRect.Pos() -= rSh.GetAnyCurRect( RECT_PAGE, pPt ).Pos(); 1189*8a2dd8f0SOliver-Rainer Wittmann aLongUL.SetUpper( (sal_uInt16)aRect.Top() ); 1190*8a2dd8f0SOliver-Rainer Wittmann aLongUL.SetLower( (sal_uInt16)(nPageHeight - aRect.Bottom()) ); 1191cdf0e10cSrcweir } 1192*8a2dd8f0SOliver-Rainer Wittmann else if( nFrmType & FRMTYPE_DRAWOBJ) 1193cdf0e10cSrcweir { 1194*8a2dd8f0SOliver-Rainer Wittmann const SwRect &rRect = rSh.GetObjRect(); 1195*8a2dd8f0SOliver-Rainer Wittmann aLongUL.SetUpper((rRect.Top() - rPageRect.Top())); 1196*8a2dd8f0SOliver-Rainer Wittmann aLongUL.SetLower((rPageRect.Bottom() - rRect.Bottom())); 1197cdf0e10cSrcweir } 1198*8a2dd8f0SOliver-Rainer Wittmann else if(bBrowse) 1199*8a2dd8f0SOliver-Rainer Wittmann { 1200*8a2dd8f0SOliver-Rainer Wittmann aLongUL.SetUpper(rPagePrtRect.Top()); 1201*8a2dd8f0SOliver-Rainer Wittmann aLongUL.SetLower(nPageHeight - rPagePrtRect.Bottom()); 1202*8a2dd8f0SOliver-Rainer Wittmann } 1203*8a2dd8f0SOliver-Rainer Wittmann if( nWhich == SID_ATTR_LONG_ULSPACE ) 1204*8a2dd8f0SOliver-Rainer Wittmann rSet.Put( aLongUL ); 1205*8a2dd8f0SOliver-Rainer Wittmann else 1206*8a2dd8f0SOliver-Rainer Wittmann { 1207*8a2dd8f0SOliver-Rainer Wittmann SvxULSpaceItem aULTmp((sal_uInt16)aLongUL.GetUpper(), 1208*8a2dd8f0SOliver-Rainer Wittmann (sal_uInt16)aLongUL.GetLower(), 1209*8a2dd8f0SOliver-Rainer Wittmann nWhich); 1210*8a2dd8f0SOliver-Rainer Wittmann rSet.Put(aULTmp); 1211*8a2dd8f0SOliver-Rainer Wittmann } 1212*8a2dd8f0SOliver-Rainer Wittmann break; 1213*8a2dd8f0SOliver-Rainer Wittmann } 1214*8a2dd8f0SOliver-Rainer Wittmann 1215*8a2dd8f0SOliver-Rainer Wittmann // provide top and bottom margins of current page style 1216*8a2dd8f0SOliver-Rainer Wittmann case SID_ATTR_PAGE_ULSPACE: 1217*8a2dd8f0SOliver-Rainer Wittmann { 1218*8a2dd8f0SOliver-Rainer Wittmann const SvxULSpaceItem aUL( rDesc.GetMaster().GetULSpace() ); 1219*8a2dd8f0SOliver-Rainer Wittmann SvxLongULSpaceItem aLongUL( 1220*8a2dd8f0SOliver-Rainer Wittmann (long)aUL.GetUpper(), 1221*8a2dd8f0SOliver-Rainer Wittmann (long)aUL.GetLower(), 1222*8a2dd8f0SOliver-Rainer Wittmann SID_ATTR_PAGE_ULSPACE ); 1223*8a2dd8f0SOliver-Rainer Wittmann 1224*8a2dd8f0SOliver-Rainer Wittmann rSet.Put( aLongUL ); 1225*8a2dd8f0SOliver-Rainer Wittmann } 1226*8a2dd8f0SOliver-Rainer Wittmann break; 1227cdf0e10cSrcweir 1228cdf0e10cSrcweir case SID_ATTR_TABSTOP_VERTICAL : 1229cdf0e10cSrcweir case RES_PARATR_TABSTOP: 1230*8a2dd8f0SOliver-Rainer Wittmann { 1231*8a2dd8f0SOliver-Rainer Wittmann if ( ISA( SwWebView ) || 1232*8a2dd8f0SOliver-Rainer Wittmann IsTabColFromDoc() || 1233*8a2dd8f0SOliver-Rainer Wittmann IsTabRowFromDoc() || 1234*8a2dd8f0SOliver-Rainer Wittmann ( nSelType & nsSelectionType::SEL_GRF) || 1235*8a2dd8f0SOliver-Rainer Wittmann (nSelType & nsSelectionType::SEL_FRM) || 1236*8a2dd8f0SOliver-Rainer Wittmann (nSelType & nsSelectionType::SEL_OLE) || 1237cdf0e10cSrcweir SFX_ITEM_AVAILABLE > aCoreSet.GetItemState(RES_LR_SPACE)|| 1238cdf0e10cSrcweir (!bVerticalWriting && (SID_ATTR_TABSTOP_VERTICAL == nWhich))|| 1239cdf0e10cSrcweir (bVerticalWriting && (RES_PARATR_TABSTOP == nWhich)) 1240*8a2dd8f0SOliver-Rainer Wittmann ) 1241*8a2dd8f0SOliver-Rainer Wittmann rSet.DisableItem( nWhich ); 1242*8a2dd8f0SOliver-Rainer Wittmann else 1243*8a2dd8f0SOliver-Rainer Wittmann { 1244*8a2dd8f0SOliver-Rainer Wittmann SvxTabStopItem aTabStops((const SvxTabStopItem&) 1245*8a2dd8f0SOliver-Rainer Wittmann aCoreSet.Get( RES_PARATR_TABSTOP )); 1246*8a2dd8f0SOliver-Rainer Wittmann 1247*8a2dd8f0SOliver-Rainer Wittmann const SvxTabStopItem& rDefTabs = (const SvxTabStopItem&) 1248*8a2dd8f0SOliver-Rainer Wittmann rSh.GetDefault(RES_PARATR_TABSTOP); 1249*8a2dd8f0SOliver-Rainer Wittmann 1250*8a2dd8f0SOliver-Rainer Wittmann DBG_ASSERT(pHRuler, "warum ist das Lineal nicht da?"); 1251*8a2dd8f0SOliver-Rainer Wittmann long nDefTabDist = ::GetTabDist(rDefTabs); 1252*8a2dd8f0SOliver-Rainer Wittmann pHRuler->SetDefTabDist( nDefTabDist ); 1253*8a2dd8f0SOliver-Rainer Wittmann pVRuler->SetDefTabDist( nDefTabDist ); 1254*8a2dd8f0SOliver-Rainer Wittmann ::lcl_EraseDefTabs(aTabStops); 1255*8a2dd8f0SOliver-Rainer Wittmann rSet.Put(aTabStops, nWhich); 1256*8a2dd8f0SOliver-Rainer Wittmann } 1257*8a2dd8f0SOliver-Rainer Wittmann break; 1258*8a2dd8f0SOliver-Rainer Wittmann } 1259*8a2dd8f0SOliver-Rainer Wittmann 1260cdf0e10cSrcweir case SID_ATTR_PARA_LRSPACE_VERTICAL: 1261cdf0e10cSrcweir case SID_ATTR_PARA_LRSPACE: 1262*8a2dd8f0SOliver-Rainer Wittmann { 1263*8a2dd8f0SOliver-Rainer Wittmann if ( nSelType & nsSelectionType::SEL_GRF || 1264*8a2dd8f0SOliver-Rainer Wittmann nSelType & nsSelectionType::SEL_FRM || 1265*8a2dd8f0SOliver-Rainer Wittmann nSelType & nsSelectionType::SEL_OLE || 1266cdf0e10cSrcweir nFrmType == FRMTYPE_DRAWOBJ || 1267cdf0e10cSrcweir (!bVerticalWriting && (SID_ATTR_PARA_LRSPACE_VERTICAL == nWhich))|| 1268cdf0e10cSrcweir (bVerticalWriting && (SID_ATTR_PARA_LRSPACE == nWhich)) 1269cdf0e10cSrcweir ) 1270cdf0e10cSrcweir { 1271*8a2dd8f0SOliver-Rainer Wittmann rSet.DisableItem(nWhich); 1272*8a2dd8f0SOliver-Rainer Wittmann } 1273*8a2dd8f0SOliver-Rainer Wittmann else 1274*8a2dd8f0SOliver-Rainer Wittmann { 1275*8a2dd8f0SOliver-Rainer Wittmann SvxLRSpaceItem aLR( RES_LR_SPACE ); 1276*8a2dd8f0SOliver-Rainer Wittmann if ( !IsTabColFromDoc() ) 1277cdf0e10cSrcweir { 1278*8a2dd8f0SOliver-Rainer Wittmann aLR = (const SvxLRSpaceItem&)aCoreSet.Get(RES_LR_SPACE); 1279*8a2dd8f0SOliver-Rainer Wittmann 1280*8a2dd8f0SOliver-Rainer Wittmann // #i23726# 1281*8a2dd8f0SOliver-Rainer Wittmann if (pNumRuleNodeFromDoc) 1282*8a2dd8f0SOliver-Rainer Wittmann { 1283*8a2dd8f0SOliver-Rainer Wittmann short nOffset = static_cast< short >(aLR.GetTxtLeft() + 1284*8a2dd8f0SOliver-Rainer Wittmann // --> FME 2005-02-22 #i42922# Mouse move of numbering label 1285*8a2dd8f0SOliver-Rainer Wittmann // has to consider the left indent of the paragraph 1286*8a2dd8f0SOliver-Rainer Wittmann pNumRuleNodeFromDoc->GetLeftMarginWithNum( sal_True ) ); 1287*8a2dd8f0SOliver-Rainer Wittmann // <-- 1288*8a2dd8f0SOliver-Rainer Wittmann 1289*8a2dd8f0SOliver-Rainer Wittmann short nFLOffset; 1290*8a2dd8f0SOliver-Rainer Wittmann pNumRuleNodeFromDoc->GetFirstLineOfsWithNum( nFLOffset ); 1291*8a2dd8f0SOliver-Rainer Wittmann 1292*8a2dd8f0SOliver-Rainer Wittmann aLR.SetLeft( nOffset + nFLOffset ); 1293*8a2dd8f0SOliver-Rainer Wittmann } 1294cdf0e10cSrcweir } 1295*8a2dd8f0SOliver-Rainer Wittmann aLR.SetWhich(nWhich); 1296*8a2dd8f0SOliver-Rainer Wittmann rSet.Put(aLR); 1297cdf0e10cSrcweir } 1298*8a2dd8f0SOliver-Rainer Wittmann break; 1299*8a2dd8f0SOliver-Rainer Wittmann } 1300*8a2dd8f0SOliver-Rainer Wittmann 1301cdf0e10cSrcweir case SID_RULER_BORDER_DISTANCE: 1302*8a2dd8f0SOliver-Rainer Wittmann { 1303*8a2dd8f0SOliver-Rainer Wittmann nLeftBorderDistance = 0; 1304*8a2dd8f0SOliver-Rainer Wittmann nRightBorderDistance = 0; 1305*8a2dd8f0SOliver-Rainer Wittmann if ( nSelType & nsSelectionType::SEL_GRF || 1306*8a2dd8f0SOliver-Rainer Wittmann nSelType & nsSelectionType::SEL_FRM || 1307*8a2dd8f0SOliver-Rainer Wittmann nSelType & nsSelectionType::SEL_OLE || 1308*8a2dd8f0SOliver-Rainer Wittmann nFrmType == FRMTYPE_DRAWOBJ ) 1309*8a2dd8f0SOliver-Rainer Wittmann rSet.DisableItem(SID_RULER_BORDER_DISTANCE); 1310*8a2dd8f0SOliver-Rainer Wittmann else 1311*8a2dd8f0SOliver-Rainer Wittmann { 1312*8a2dd8f0SOliver-Rainer Wittmann SvxLRSpaceItem aDistLR(SID_RULER_BORDER_DISTANCE); 1313*8a2dd8f0SOliver-Rainer Wittmann if(nFrmType & FRMTYPE_FLY_ANY) 1314*8a2dd8f0SOliver-Rainer Wittmann { 1315*8a2dd8f0SOliver-Rainer Wittmann if( IsTabColFromDoc() ) 1316*8a2dd8f0SOliver-Rainer Wittmann { 1317*8a2dd8f0SOliver-Rainer Wittmann const SwRect& rFlyPrtRect = rSh.GetAnyCurRect( RECT_FLY_PRT_EMBEDDED, pPt ); 1318*8a2dd8f0SOliver-Rainer Wittmann aDistLR.SetLeft(rFlyPrtRect.Left()); 1319*8a2dd8f0SOliver-Rainer Wittmann aDistLR.SetRight(rFlyPrtRect.Left()); 1320*8a2dd8f0SOliver-Rainer Wittmann } 1321*8a2dd8f0SOliver-Rainer Wittmann else 1322*8a2dd8f0SOliver-Rainer Wittmann { 1323*8a2dd8f0SOliver-Rainer Wittmann SfxItemSet aCoreSet2( GetPool(), 1324*8a2dd8f0SOliver-Rainer Wittmann RES_BOX, RES_BOX, 1325*8a2dd8f0SOliver-Rainer Wittmann SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0 ); 1326*8a2dd8f0SOliver-Rainer Wittmann SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER ); 1327*8a2dd8f0SOliver-Rainer Wittmann aCoreSet.Put( aBoxInfo ); 1328*8a2dd8f0SOliver-Rainer Wittmann rSh.GetFlyFrmAttr( aCoreSet ); 1329*8a2dd8f0SOliver-Rainer Wittmann const SvxBoxItem& rBox = (const SvxBoxItem&)aCoreSet.Get(RES_BOX); 1330*8a2dd8f0SOliver-Rainer Wittmann aDistLR.SetLeft((sal_uInt16)rBox.GetDistance(BOX_LINE_LEFT )); 1331*8a2dd8f0SOliver-Rainer Wittmann aDistLR.SetRight((sal_uInt16)rBox.GetDistance(BOX_LINE_RIGHT)); 1332*8a2dd8f0SOliver-Rainer Wittmann 1333*8a2dd8f0SOliver-Rainer Wittmann //add the paragraph border distance 1334*8a2dd8f0SOliver-Rainer Wittmann SfxItemSet aCoreSet1( GetPool(), 1335*8a2dd8f0SOliver-Rainer Wittmann RES_BOX, RES_BOX, 1336*8a2dd8f0SOliver-Rainer Wittmann 0 ); 1337*8a2dd8f0SOliver-Rainer Wittmann rSh.GetCurAttr( aCoreSet1 ); 1338*8a2dd8f0SOliver-Rainer Wittmann const SvxBoxItem& rParaBox = (const SvxBoxItem&)aCoreSet1.Get(RES_BOX); 1339*8a2dd8f0SOliver-Rainer Wittmann aDistLR.SetLeft(aDistLR.GetLeft() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_LEFT )); 1340*8a2dd8f0SOliver-Rainer Wittmann aDistLR.SetRight(aDistLR.GetRight() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_RIGHT)); 1341*8a2dd8f0SOliver-Rainer Wittmann } 1342*8a2dd8f0SOliver-Rainer Wittmann rSet.Put(aDistLR); 1343*8a2dd8f0SOliver-Rainer Wittmann nLeftBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetLeft()); 1344*8a2dd8f0SOliver-Rainer Wittmann nRightBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetRight()); 1345*8a2dd8f0SOliver-Rainer Wittmann } 1346*8a2dd8f0SOliver-Rainer Wittmann else if ( IsTabColFromDoc() || 1347*8a2dd8f0SOliver-Rainer Wittmann ( rSh.GetTableFmt() && !bFrmSelection && 1348*8a2dd8f0SOliver-Rainer Wittmann !(nFrmType & FRMTYPE_COLSECT ) ) ) 1349*8a2dd8f0SOliver-Rainer Wittmann { 1350*8a2dd8f0SOliver-Rainer Wittmann SfxItemSet aCoreSet2( GetPool(), 1351*8a2dd8f0SOliver-Rainer Wittmann RES_BOX, RES_BOX, 1352*8a2dd8f0SOliver-Rainer Wittmann SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0 ); 1353cdf0e10cSrcweir SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER ); 1354*8a2dd8f0SOliver-Rainer Wittmann aBoxInfo.SetTable(sal_False); 1355*8a2dd8f0SOliver-Rainer Wittmann aBoxInfo.SetDist((sal_Bool) sal_True); 1356*8a2dd8f0SOliver-Rainer Wittmann aCoreSet2.Put(aBoxInfo); 1357*8a2dd8f0SOliver-Rainer Wittmann rSh.GetTabBorders( aCoreSet2 ); 1358*8a2dd8f0SOliver-Rainer Wittmann const SvxBoxItem& rBox = (const SvxBoxItem&)aCoreSet2.Get(RES_BOX); 1359cdf0e10cSrcweir aDistLR.SetLeft((sal_uInt16)rBox.GetDistance(BOX_LINE_LEFT )); 1360cdf0e10cSrcweir aDistLR.SetRight((sal_uInt16)rBox.GetDistance(BOX_LINE_RIGHT)); 1361cdf0e10cSrcweir 1362*8a2dd8f0SOliver-Rainer Wittmann //add the border distance of the paragraph 1363cdf0e10cSrcweir SfxItemSet aCoreSet1( GetPool(), 1364*8a2dd8f0SOliver-Rainer Wittmann RES_BOX, RES_BOX, 1365*8a2dd8f0SOliver-Rainer Wittmann 0 ); 1366cdf0e10cSrcweir rSh.GetCurAttr( aCoreSet1 ); 1367cdf0e10cSrcweir const SvxBoxItem& rParaBox = (const SvxBoxItem&)aCoreSet1.Get(RES_BOX); 1368*8a2dd8f0SOliver-Rainer Wittmann aDistLR.SetLeft(aDistLR.GetLeft() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_LEFT )); 1369*8a2dd8f0SOliver-Rainer Wittmann aDistLR.SetRight(aDistLR.GetRight() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_RIGHT)); 1370*8a2dd8f0SOliver-Rainer Wittmann rSet.Put(aDistLR); 1371*8a2dd8f0SOliver-Rainer Wittmann nLeftBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetLeft()); 1372*8a2dd8f0SOliver-Rainer Wittmann nRightBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetRight()); 1373cdf0e10cSrcweir } 1374*8a2dd8f0SOliver-Rainer Wittmann else if ( !rSh.IsDirectlyInSection() ) 1375cdf0e10cSrcweir { 1376*8a2dd8f0SOliver-Rainer Wittmann //get the page/header/footer border distance 1377*8a2dd8f0SOliver-Rainer Wittmann const SwFrmFmt& rMaster = rDesc.GetMaster(); 1378*8a2dd8f0SOliver-Rainer Wittmann const SvxBoxItem& rBox = (const SvxBoxItem&)rMaster.GetAttrSet().Get(RES_BOX); 1379*8a2dd8f0SOliver-Rainer Wittmann aDistLR.SetLeft((sal_uInt16)rBox.GetDistance(BOX_LINE_LEFT )); 1380*8a2dd8f0SOliver-Rainer Wittmann aDistLR.SetRight((sal_uInt16)rBox.GetDistance(BOX_LINE_RIGHT)); 1381cdf0e10cSrcweir 1382*8a2dd8f0SOliver-Rainer Wittmann const SvxBoxItem* pBox = 0; 1383*8a2dd8f0SOliver-Rainer Wittmann if(nFrmType & FRMTYPE_HEADER) 1384*8a2dd8f0SOliver-Rainer Wittmann { 1385*8a2dd8f0SOliver-Rainer Wittmann rMaster.GetHeader(); 1386*8a2dd8f0SOliver-Rainer Wittmann const SwFmtHeader& rHeaderFmt = rMaster.GetHeader(); 1387*8a2dd8f0SOliver-Rainer Wittmann SwFrmFmt *pHeaderFmt = (SwFrmFmt*)rHeaderFmt.GetHeaderFmt(); 1388*8a2dd8f0SOliver-Rainer Wittmann if( pHeaderFmt )// #i80890# if rDesc is not the one belonging to the current page is might crash 1389*8a2dd8f0SOliver-Rainer Wittmann pBox = & (const SvxBoxItem&)pHeaderFmt->GetBox(); 1390*8a2dd8f0SOliver-Rainer Wittmann } 1391*8a2dd8f0SOliver-Rainer Wittmann else if(nFrmType & FRMTYPE_FOOTER ) 1392*8a2dd8f0SOliver-Rainer Wittmann { 1393*8a2dd8f0SOliver-Rainer Wittmann const SwFmtFooter& rFooterFmt = rMaster.GetFooter(); 1394*8a2dd8f0SOliver-Rainer Wittmann SwFrmFmt *pFooterFmt = (SwFrmFmt*)rFooterFmt.GetFooterFmt(); 1395*8a2dd8f0SOliver-Rainer Wittmann if( pFooterFmt )// #i80890# if rDesc is not the one belonging to the current page is might crash 1396*8a2dd8f0SOliver-Rainer Wittmann pBox = & (const SvxBoxItem&)pFooterFmt->GetBox(); 1397*8a2dd8f0SOliver-Rainer Wittmann } 1398*8a2dd8f0SOliver-Rainer Wittmann if(pBox) 1399*8a2dd8f0SOliver-Rainer Wittmann { 1400*8a2dd8f0SOliver-Rainer Wittmann aDistLR.SetLeft((sal_uInt16)pBox->GetDistance(BOX_LINE_LEFT )); 1401*8a2dd8f0SOliver-Rainer Wittmann aDistLR.SetRight((sal_uInt16)pBox->GetDistance(BOX_LINE_RIGHT)); 1402*8a2dd8f0SOliver-Rainer Wittmann } 1403*8a2dd8f0SOliver-Rainer Wittmann 1404*8a2dd8f0SOliver-Rainer Wittmann //add the border distance of the paragraph 1405*8a2dd8f0SOliver-Rainer Wittmann SfxItemSet aCoreSetTmp( GetPool(), 1406*8a2dd8f0SOliver-Rainer Wittmann RES_BOX, RES_BOX, 1407*8a2dd8f0SOliver-Rainer Wittmann SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0 ); 1408*8a2dd8f0SOliver-Rainer Wittmann rSh.GetCurAttr( aCoreSetTmp ); 1409*8a2dd8f0SOliver-Rainer Wittmann const SvxBoxItem& rParaBox = (const SvxBoxItem&)aCoreSetTmp.Get(RES_BOX); 1410*8a2dd8f0SOliver-Rainer Wittmann aDistLR.SetLeft(aDistLR.GetLeft() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_LEFT )); 1411*8a2dd8f0SOliver-Rainer Wittmann aDistLR.SetRight(aDistLR.GetRight() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_RIGHT)); 1412*8a2dd8f0SOliver-Rainer Wittmann rSet.Put(aDistLR); 1413*8a2dd8f0SOliver-Rainer Wittmann nLeftBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetLeft()); 1414*8a2dd8f0SOliver-Rainer Wittmann nRightBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetRight()); 1415*8a2dd8f0SOliver-Rainer Wittmann } 1416cdf0e10cSrcweir } 1417cdf0e10cSrcweir } 1418*8a2dd8f0SOliver-Rainer Wittmann break; 1419*8a2dd8f0SOliver-Rainer Wittmann 1420cdf0e10cSrcweir case SID_RULER_TEXT_RIGHT_TO_LEFT: 1421cdf0e10cSrcweir { 1422*8a2dd8f0SOliver-Rainer Wittmann if ( nSelType & nsSelectionType::SEL_GRF || 1423*8a2dd8f0SOliver-Rainer Wittmann nSelType & nsSelectionType::SEL_FRM || 1424*8a2dd8f0SOliver-Rainer Wittmann nSelType & nsSelectionType::SEL_OLE || 1425*8a2dd8f0SOliver-Rainer Wittmann nFrmType == FRMTYPE_DRAWOBJ) 1426*8a2dd8f0SOliver-Rainer Wittmann rSet.DisableItem(nWhich); 1427*8a2dd8f0SOliver-Rainer Wittmann else 1428*8a2dd8f0SOliver-Rainer Wittmann { 1429*8a2dd8f0SOliver-Rainer Wittmann sal_Bool bFlag = rSh.IsInRightToLeftText(); 1430*8a2dd8f0SOliver-Rainer Wittmann rSet.Put(SfxBoolItem(nWhich, bFlag)); 1431*8a2dd8f0SOliver-Rainer Wittmann } 1432cdf0e10cSrcweir } 1433*8a2dd8f0SOliver-Rainer Wittmann break; 1434*8a2dd8f0SOliver-Rainer Wittmann 1435cdf0e10cSrcweir case SID_RULER_BORDERS_VERTICAL: 1436cdf0e10cSrcweir case SID_RULER_BORDERS: 1437cdf0e10cSrcweir { 1438*8a2dd8f0SOliver-Rainer Wittmann sal_Bool bFrameHasVerticalColumns(sal_False); 1439*8a2dd8f0SOliver-Rainer Wittmann { 1440*8a2dd8f0SOliver-Rainer Wittmann sal_Bool bFrameRTL; 1441*8a2dd8f0SOliver-Rainer Wittmann sal_Bool bFrameVertL2R; 1442*8a2dd8f0SOliver-Rainer Wittmann bFrameHasVerticalColumns = rSh.IsFrmVertical(sal_False, bFrameRTL, bFrameVertL2R) && 1443*8a2dd8f0SOliver-Rainer Wittmann bFrmSelection; 1444*8a2dd8f0SOliver-Rainer Wittmann } 1445*8a2dd8f0SOliver-Rainer Wittmann sal_Bool bHasTable = ( IsTabColFromDoc() || 1446cdf0e10cSrcweir ( rSh.GetTableFmt() && !bFrmSelection && 1447cdf0e10cSrcweir !(nFrmType & FRMTYPE_COLSECT ) ) ); 1448cdf0e10cSrcweir 1449*8a2dd8f0SOliver-Rainer Wittmann sal_Bool bTableVertical = bHasTable && rSh.IsTableVertical(); 1450cdf0e10cSrcweir 1451*8a2dd8f0SOliver-Rainer Wittmann if( ( (SID_RULER_BORDERS_VERTICAL == nWhich) && 1452cdf0e10cSrcweir ((bHasTable && !bTableVertical)|| 1453*8a2dd8f0SOliver-Rainer Wittmann (!bVerticalWriting && !bFrmSelection && !bHasTable ) || (bFrmSelection && !bFrameHasVerticalColumns)) ) || 1454*8a2dd8f0SOliver-Rainer Wittmann ((SID_RULER_BORDERS == nWhich) && 1455cdf0e10cSrcweir ((bHasTable && bTableVertical)|| 1456*8a2dd8f0SOliver-Rainer Wittmann (bVerticalWriting && !bFrmSelection&& !bHasTable) || bFrameHasVerticalColumns))) 1457*8a2dd8f0SOliver-Rainer Wittmann rSet.DisableItem(nWhich); 1458*8a2dd8f0SOliver-Rainer Wittmann else if ( bHasTable ) 1459*8a2dd8f0SOliver-Rainer Wittmann { 1460*8a2dd8f0SOliver-Rainer Wittmann SwTabCols aTabCols; 1461*8a2dd8f0SOliver-Rainer Wittmann sal_uInt16 nNum; 1462*8a2dd8f0SOliver-Rainer Wittmann if ( 0 != ( bSetTabColFromDoc = IsTabColFromDoc() ) ) 1463*8a2dd8f0SOliver-Rainer Wittmann { 1464*8a2dd8f0SOliver-Rainer Wittmann rSh.GetMouseTabCols( aTabCols, aTabColFromDocPos ); 1465*8a2dd8f0SOliver-Rainer Wittmann nNum = rSh.GetCurMouseTabColNum( aTabColFromDocPos ); 1466*8a2dd8f0SOliver-Rainer Wittmann } 1467*8a2dd8f0SOliver-Rainer Wittmann else 1468*8a2dd8f0SOliver-Rainer Wittmann { 1469*8a2dd8f0SOliver-Rainer Wittmann rSh.GetTabCols( aTabCols ); 1470*8a2dd8f0SOliver-Rainer Wittmann nNum = rSh.GetCurTabColNum(); 1471*8a2dd8f0SOliver-Rainer Wittmann if(rSh.IsTableRightToLeft()) 1472*8a2dd8f0SOliver-Rainer Wittmann nNum = aTabCols.Count() - nNum; 1473*8a2dd8f0SOliver-Rainer Wittmann } 1474cdf0e10cSrcweir 1475*8a2dd8f0SOliver-Rainer Wittmann ASSERT(nNum <= aTabCols.Count(), "TabCol not found"); 1476*8a2dd8f0SOliver-Rainer Wittmann const int nLft = aTabCols.GetLeftMin() + aTabCols.GetLeft(); 1477*8a2dd8f0SOliver-Rainer Wittmann const int nRgt = (sal_uInt16)(bTableVertical ? nPageHeight : nPageWidth) - 1478*8a2dd8f0SOliver-Rainer Wittmann (aTabCols.GetLeftMin() + 1479*8a2dd8f0SOliver-Rainer Wittmann aTabCols.GetRight()); 1480*8a2dd8f0SOliver-Rainer Wittmann 1481*8a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nL = static_cast< sal_uInt16 >(nLft > 0 ? nLft : 0); 1482*8a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nR = static_cast< sal_uInt16 >(nRgt > 0 ? nRgt : 0); 1483*8a2dd8f0SOliver-Rainer Wittmann 1484*8a2dd8f0SOliver-Rainer Wittmann SvxColumnItem aColItem(nNum, nL, nR); 1485*8a2dd8f0SOliver-Rainer Wittmann 1486*8a2dd8f0SOliver-Rainer Wittmann sal_uInt16 nStart = 0, 1487*8a2dd8f0SOliver-Rainer Wittmann nEnd; 1488*8a2dd8f0SOliver-Rainer Wittmann 1489*8a2dd8f0SOliver-Rainer Wittmann //columns in right-to-left tables need to be mirrored 1490*8a2dd8f0SOliver-Rainer Wittmann sal_Bool bIsTableRTL = 1491*8a2dd8f0SOliver-Rainer Wittmann IsTabColFromDoc() ? 1492*8a2dd8f0SOliver-Rainer Wittmann rSh.IsMouseTableRightToLeft(aTabColFromDocPos) 1493cdf0e10cSrcweir : rSh.IsTableRightToLeft(); 1494*8a2dd8f0SOliver-Rainer Wittmann if(bIsTableRTL) 1495cdf0e10cSrcweir { 1496*8a2dd8f0SOliver-Rainer Wittmann for ( sal_uInt16 i = aTabCols.Count(); i ; --i ) 1497*8a2dd8f0SOliver-Rainer Wittmann { 1498*8a2dd8f0SOliver-Rainer Wittmann const SwTabColsEntry& rEntry = aTabCols.GetEntry( i - 1 ); 1499*8a2dd8f0SOliver-Rainer Wittmann nEnd = (sal_uInt16)aTabCols.GetRight(); 1500*8a2dd8f0SOliver-Rainer Wittmann nEnd = nEnd - (sal_uInt16)rEntry.nPos; 1501*8a2dd8f0SOliver-Rainer Wittmann SvxColumnDescription aColDesc( nStart, nEnd, 1502*8a2dd8f0SOliver-Rainer Wittmann (sal_uInt16(aTabCols.GetRight() - rEntry.nMax)), 1503*8a2dd8f0SOliver-Rainer Wittmann (sal_uInt16(aTabCols.GetRight() - rEntry.nMin)), 1504*8a2dd8f0SOliver-Rainer Wittmann !aTabCols.IsHidden(i - 1) ); 1505*8a2dd8f0SOliver-Rainer Wittmann aColItem.Append(aColDesc); 1506*8a2dd8f0SOliver-Rainer Wittmann nStart = nEnd; 1507*8a2dd8f0SOliver-Rainer Wittmann } 1508*8a2dd8f0SOliver-Rainer Wittmann SvxColumnDescription aColDesc(nStart, 1509*8a2dd8f0SOliver-Rainer Wittmann aTabCols.GetRight() - aTabCols.GetLeft(), sal_True); 1510cdf0e10cSrcweir aColItem.Append(aColDesc); 1511cdf0e10cSrcweir } 1512*8a2dd8f0SOliver-Rainer Wittmann else 1513cdf0e10cSrcweir { 1514*8a2dd8f0SOliver-Rainer Wittmann for ( sal_uInt16 i = 0; i < aTabCols.Count(); ++i ) 1515*8a2dd8f0SOliver-Rainer Wittmann { 1516*8a2dd8f0SOliver-Rainer Wittmann const SwTabColsEntry& rEntry = aTabCols.GetEntry( i ); 1517*8a2dd8f0SOliver-Rainer Wittmann nEnd = static_cast< sal_uInt16 >(rEntry.nPos - aTabCols.GetLeft()); 1518*8a2dd8f0SOliver-Rainer Wittmann SvxColumnDescription aColDesc( nStart, nEnd, 1519cdf0e10cSrcweir rEntry.nMin - aTabCols.GetLeft(), rEntry.nMax - aTabCols.GetLeft(), 1520*8a2dd8f0SOliver-Rainer Wittmann !aTabCols.IsHidden(i) ); 1521*8a2dd8f0SOliver-Rainer Wittmann aColItem.Append(aColDesc); 1522*8a2dd8f0SOliver-Rainer Wittmann nStart = nEnd; 1523*8a2dd8f0SOliver-Rainer Wittmann } 1524*8a2dd8f0SOliver-Rainer Wittmann SvxColumnDescription aColDesc(nStart, aTabCols.GetRight() - aTabCols.GetLeft(), 1525*8a2dd8f0SOliver-Rainer Wittmann 0, 0, 1526*8a2dd8f0SOliver-Rainer Wittmann sal_True); 1527cdf0e10cSrcweir aColItem.Append(aColDesc); 1528cdf0e10cSrcweir } 1529*8a2dd8f0SOliver-Rainer Wittmann rSet.Put(aColItem, nWhich); 1530cdf0e10cSrcweir } 1531*8a2dd8f0SOliver-Rainer Wittmann else if ( bFrmSelection || nFrmType & ( FRMTYPE_COLUMN | FRMTYPE_COLSECT ) ) 1532*8a2dd8f0SOliver-Rainer Wittmann { 1533*8a2dd8f0SOliver-Rainer Wittmann // Aus Rahmen oder Seite ? 1534*8a2dd8f0SOliver-Rainer Wittmann sal_uInt16 nNum = 0; 1535*8a2dd8f0SOliver-Rainer Wittmann if(bFrmSelection) 1536*8a2dd8f0SOliver-Rainer Wittmann { 1537*8a2dd8f0SOliver-Rainer Wittmann const SwFrmFmt* pFmt = rSh.GetFlyFrmFmt(); 1538*8a2dd8f0SOliver-Rainer Wittmann if(pFmt) 1539*8a2dd8f0SOliver-Rainer Wittmann nNum = pFmt->GetCol().GetNumCols(); 1540*8a2dd8f0SOliver-Rainer Wittmann } 1541*8a2dd8f0SOliver-Rainer Wittmann else 1542*8a2dd8f0SOliver-Rainer Wittmann nNum = rSh.GetCurColNum(); 1543*8a2dd8f0SOliver-Rainer Wittmann 1544*8a2dd8f0SOliver-Rainer Wittmann if( 1545*8a2dd8f0SOliver-Rainer Wittmann //eigentlich sollte FRMTYPE_COLSECT nicht enthalten sein, wenn der Rahmen selektiert ist! 1546*8a2dd8f0SOliver-Rainer Wittmann !bFrmSelection && 1547*8a2dd8f0SOliver-Rainer Wittmann nFrmType & FRMTYPE_COLSECT ) 1548*8a2dd8f0SOliver-Rainer Wittmann { 1549*8a2dd8f0SOliver-Rainer Wittmann const SwSection *pSect = rSh.GetAnySection(sal_False, pPt); 1550*8a2dd8f0SOliver-Rainer Wittmann ASSERT( pSect, "Welcher Bereich?"); 1551*8a2dd8f0SOliver-Rainer Wittmann if( pSect ) 1552*8a2dd8f0SOliver-Rainer Wittmann { 1553*8a2dd8f0SOliver-Rainer Wittmann SwSectionFmt *pFmt = pSect->GetFmt(); 1554*8a2dd8f0SOliver-Rainer Wittmann const SwFmtCol& rCol = pFmt->GetCol(); 1555*8a2dd8f0SOliver-Rainer Wittmann if(rSh.IsInRightToLeftText()) 1556*8a2dd8f0SOliver-Rainer Wittmann nNum = rCol.GetColumns().Count() - nNum; 1557*8a2dd8f0SOliver-Rainer Wittmann else 1558*8a2dd8f0SOliver-Rainer Wittmann --nNum; 1559*8a2dd8f0SOliver-Rainer Wittmann SvxColumnItem aColItem(nNum); 1560*8a2dd8f0SOliver-Rainer Wittmann SwRect aRect = rSh.GetAnyCurRect(RECT_SECTION_PRT, pPt); 1561*8a2dd8f0SOliver-Rainer Wittmann const SwRect aTmpRect = rSh.GetAnyCurRect(RECT_SECTION, pPt); 1562*8a2dd8f0SOliver-Rainer Wittmann 1563*8a2dd8f0SOliver-Rainer Wittmann ::lcl_FillSvxColumn(rCol, sal_uInt16(bVerticalWriting ? aRect.Height() : aRect.Width()), aColItem, 0); 1564*8a2dd8f0SOliver-Rainer Wittmann 1565*8a2dd8f0SOliver-Rainer Wittmann if(bVerticalWriting) 1566*8a2dd8f0SOliver-Rainer Wittmann { 1567*8a2dd8f0SOliver-Rainer Wittmann aRect.Pos() += Point(aTmpRect.Left(), aTmpRect.Top()); 1568*8a2dd8f0SOliver-Rainer Wittmann aRect.Pos().Y() -= rPageRect.Top(); 1569*8a2dd8f0SOliver-Rainer Wittmann aColItem.SetLeft ((sal_uInt16)(aRect.Top())); 1570*8a2dd8f0SOliver-Rainer Wittmann aColItem.SetRight((sal_uInt16)(nPageHeight - aRect.Bottom() )); 1571*8a2dd8f0SOliver-Rainer Wittmann } 1572*8a2dd8f0SOliver-Rainer Wittmann else 1573*8a2dd8f0SOliver-Rainer Wittmann { 1574*8a2dd8f0SOliver-Rainer Wittmann aRect.Pos() += aTmpRect.Pos(); 1575*8a2dd8f0SOliver-Rainer Wittmann 1576*8a2dd8f0SOliver-Rainer Wittmann // PAGES01 1577*8a2dd8f0SOliver-Rainer Wittmann // make relative to page position: 1578*8a2dd8f0SOliver-Rainer Wittmann aColItem.SetLeft ((sal_uInt16)( aRect.Left() - rPageRect.Left() )); 1579*8a2dd8f0SOliver-Rainer Wittmann aColItem.SetRight((sal_uInt16)( rPageRect.Right() - aRect.Right())); 1580*8a2dd8f0SOliver-Rainer Wittmann } 1581*8a2dd8f0SOliver-Rainer Wittmann aColItem.SetOrtho(aColItem.CalcOrtho()); 1582*8a2dd8f0SOliver-Rainer Wittmann 1583*8a2dd8f0SOliver-Rainer Wittmann rSet.Put(aColItem, nWhich); 1584*8a2dd8f0SOliver-Rainer Wittmann } 1585*8a2dd8f0SOliver-Rainer Wittmann } 1586*8a2dd8f0SOliver-Rainer Wittmann else if( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY ) 1587*8a2dd8f0SOliver-Rainer Wittmann { 1588*8a2dd8f0SOliver-Rainer Wittmann // Spalten in Rahmen 1589*8a2dd8f0SOliver-Rainer Wittmann if ( nNum ) 1590*8a2dd8f0SOliver-Rainer Wittmann { 1591*8a2dd8f0SOliver-Rainer Wittmann const SwFrmFmt* pFmt = rSh.GetFlyFrmFmt() ; 1592*8a2dd8f0SOliver-Rainer Wittmann 1593*8a2dd8f0SOliver-Rainer Wittmann const SwFmtCol& rCol = pFmt->GetCol(); 1594*8a2dd8f0SOliver-Rainer Wittmann if(rSh.IsInRightToLeftText()) 1595*8a2dd8f0SOliver-Rainer Wittmann nNum = rCol.GetColumns().Count() - nNum; 1596*8a2dd8f0SOliver-Rainer Wittmann else 1597*8a2dd8f0SOliver-Rainer Wittmann nNum--; 1598*8a2dd8f0SOliver-Rainer Wittmann SvxColumnItem aColItem(nNum); 1599*8a2dd8f0SOliver-Rainer Wittmann const SwRect &rSizeRect = rSh.GetAnyCurRect(RECT_FLY_PRT_EMBEDDED, pPt); 1600*8a2dd8f0SOliver-Rainer Wittmann 1601*8a2dd8f0SOliver-Rainer Wittmann sal_Bool bUseVertical = bFrameHasVerticalColumns || (!bFrmSelection && bVerticalWriting); 1602*8a2dd8f0SOliver-Rainer Wittmann const long lWidth = bUseVertical ? rSizeRect.Height() : rSizeRect.Width(); 1603*8a2dd8f0SOliver-Rainer Wittmann const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED, pPt); 1604*8a2dd8f0SOliver-Rainer Wittmann long nDist2 = ((bUseVertical ? rRect.Height() : rRect.Width()) - lWidth) /2; 1605*8a2dd8f0SOliver-Rainer Wittmann ::lcl_FillSvxColumn(rCol, sal_uInt16(lWidth), aColItem, nDist2); 1606*8a2dd8f0SOliver-Rainer Wittmann 1607*8a2dd8f0SOliver-Rainer Wittmann SfxItemSet aFrameSet(GetPool(), RES_LR_SPACE, RES_LR_SPACE); 1608*8a2dd8f0SOliver-Rainer Wittmann rSh.GetFlyFrmAttr( aFrameSet ); 1609*8a2dd8f0SOliver-Rainer Wittmann 1610*8a2dd8f0SOliver-Rainer Wittmann if(bUseVertical) 1611*8a2dd8f0SOliver-Rainer Wittmann { 1612*8a2dd8f0SOliver-Rainer Wittmann aColItem.SetLeft ((sal_uInt16)(rRect.Top()- rPageRect.Top())); 1613*8a2dd8f0SOliver-Rainer Wittmann aColItem.SetRight((sal_uInt16)(nPageHeight + rPageRect.Top() - rRect.Bottom() )); 1614*8a2dd8f0SOliver-Rainer Wittmann } 1615*8a2dd8f0SOliver-Rainer Wittmann else 1616*8a2dd8f0SOliver-Rainer Wittmann { 1617*8a2dd8f0SOliver-Rainer Wittmann aColItem.SetLeft ((sal_uInt16)(rRect.Left() - rPageRect.Left() )); 1618*8a2dd8f0SOliver-Rainer Wittmann aColItem.SetRight((sal_uInt16)(rPageRect.Right() - rRect.Right() )); 1619*8a2dd8f0SOliver-Rainer Wittmann } 1620*8a2dd8f0SOliver-Rainer Wittmann 1621*8a2dd8f0SOliver-Rainer Wittmann aColItem.SetOrtho(aColItem.CalcOrtho()); 1622*8a2dd8f0SOliver-Rainer Wittmann 1623*8a2dd8f0SOliver-Rainer Wittmann rSet.Put(aColItem, nWhich); 1624*8a2dd8f0SOliver-Rainer Wittmann } 1625*8a2dd8f0SOliver-Rainer Wittmann else 1626*8a2dd8f0SOliver-Rainer Wittmann rSet.DisableItem(nWhich); 1627*8a2dd8f0SOliver-Rainer Wittmann } 1628*8a2dd8f0SOliver-Rainer Wittmann else 1629*8a2dd8f0SOliver-Rainer Wittmann { // Spalten auf der Seite 1630*8a2dd8f0SOliver-Rainer Wittmann const SwFrmFmt& rMaster = rDesc.GetMaster(); 1631*8a2dd8f0SOliver-Rainer Wittmann SwFmtCol aCol(rMaster.GetCol()); 1632*8a2dd8f0SOliver-Rainer Wittmann if(rFrameDir.GetValue() == FRMDIR_HORI_RIGHT_TOP) 1633*8a2dd8f0SOliver-Rainer Wittmann nNum = aCol.GetColumns().Count() - nNum; 1634*8a2dd8f0SOliver-Rainer Wittmann else 1635*8a2dd8f0SOliver-Rainer Wittmann nNum--; 1636*8a2dd8f0SOliver-Rainer Wittmann 1637*8a2dd8f0SOliver-Rainer Wittmann SvxColumnItem aColItem(nNum); 1638*8a2dd8f0SOliver-Rainer Wittmann const SwRect aPrtRect = rSh.GetAnyCurRect(RECT_PAGE_PRT, pPt); 1639*8a2dd8f0SOliver-Rainer Wittmann const SvxBoxItem& rBox = (const SvxBoxItem&)rMaster.GetFmtAttr(RES_BOX); 1640*8a2dd8f0SOliver-Rainer Wittmann long nDist = rBox.GetDistance(); 1641*8a2dd8f0SOliver-Rainer Wittmann ::lcl_FillSvxColumn(aCol, 1642*8a2dd8f0SOliver-Rainer Wittmann sal_uInt16(bVerticalWriting ? aPrtRect.Height() : aPrtRect.Width() ), 1643*8a2dd8f0SOliver-Rainer Wittmann aColItem, nDist); 1644*8a2dd8f0SOliver-Rainer Wittmann 1645*8a2dd8f0SOliver-Rainer Wittmann if(bBrowse) 1646*8a2dd8f0SOliver-Rainer Wittmann { 1647*8a2dd8f0SOliver-Rainer Wittmann aColItem.SetLeft((sal_uInt16)rPagePrtRect.Left()); 1648*8a2dd8f0SOliver-Rainer Wittmann aColItem.SetRight(sal_uInt16(nPageWidth - rPagePrtRect.Right())); 1649*8a2dd8f0SOliver-Rainer Wittmann } 1650*8a2dd8f0SOliver-Rainer Wittmann else 1651*8a2dd8f0SOliver-Rainer Wittmann { 1652*8a2dd8f0SOliver-Rainer Wittmann aColItem.SetLeft (aPageLRSpace.GetLeft()); 1653*8a2dd8f0SOliver-Rainer Wittmann aColItem.SetRight(aPageLRSpace.GetRight()); 1654*8a2dd8f0SOliver-Rainer Wittmann } 1655*8a2dd8f0SOliver-Rainer Wittmann aColItem.SetOrtho(aColItem.CalcOrtho()); 1656*8a2dd8f0SOliver-Rainer Wittmann 1657*8a2dd8f0SOliver-Rainer Wittmann rSet.Put(aColItem, nWhich); 1658*8a2dd8f0SOliver-Rainer Wittmann } 1659*8a2dd8f0SOliver-Rainer Wittmann } 1660*8a2dd8f0SOliver-Rainer Wittmann else 1661*8a2dd8f0SOliver-Rainer Wittmann rSet.DisableItem(nWhich); 1662*8a2dd8f0SOliver-Rainer Wittmann break; 1663*8a2dd8f0SOliver-Rainer Wittmann } 1664cdf0e10cSrcweir 1665cdf0e10cSrcweir case SID_RULER_ROWS : 1666cdf0e10cSrcweir case SID_RULER_ROWS_VERTICAL: 1667cdf0e10cSrcweir { 1668*8a2dd8f0SOliver-Rainer Wittmann sal_Bool bFrameHasVerticalColumns(sal_False); 1669*8a2dd8f0SOliver-Rainer Wittmann { 1670*8a2dd8f0SOliver-Rainer Wittmann sal_Bool bFrameRTL; 1671*8a2dd8f0SOliver-Rainer Wittmann sal_Bool bFrameVertL2R; 1672*8a2dd8f0SOliver-Rainer Wittmann bFrameHasVerticalColumns = rSh.IsFrmVertical(sal_False, bFrameRTL, bFrameVertL2R) && 1673*8a2dd8f0SOliver-Rainer Wittmann bFrmSelection; 1674*8a2dd8f0SOliver-Rainer Wittmann } 1675cdf0e10cSrcweir 1676*8a2dd8f0SOliver-Rainer Wittmann if( ( (SID_RULER_ROWS == nWhich) && 1677cdf0e10cSrcweir ((!bVerticalWriting && !bFrmSelection) || (bFrmSelection && !bFrameHasVerticalColumns)) ) || 1678*8a2dd8f0SOliver-Rainer Wittmann ((SID_RULER_ROWS_VERTICAL == nWhich) && 1679cdf0e10cSrcweir ((bVerticalWriting && !bFrmSelection) || bFrameHasVerticalColumns))) 1680*8a2dd8f0SOliver-Rainer Wittmann rSet.DisableItem(nWhich); 1681*8a2dd8f0SOliver-Rainer Wittmann else if ( IsTabRowFromDoc() || 1682cdf0e10cSrcweir ( rSh.GetTableFmt() && !bFrmSelection && 1683cdf0e10cSrcweir !(nFrmType & FRMTYPE_COLSECT ) ) ) 1684cdf0e10cSrcweir { 1685*8a2dd8f0SOliver-Rainer Wittmann SwTabCols aTabCols; 1686*8a2dd8f0SOliver-Rainer Wittmann //no current value necessary 1687*8a2dd8f0SOliver-Rainer Wittmann sal_uInt16 nNum = 0; 1688*8a2dd8f0SOliver-Rainer Wittmann if ( 0 != ( bSetTabRowFromDoc = IsTabRowFromDoc() ) ) 1689*8a2dd8f0SOliver-Rainer Wittmann { 1690*8a2dd8f0SOliver-Rainer Wittmann rSh.GetMouseTabRows( aTabCols, aTabColFromDocPos ); 1691*8a2dd8f0SOliver-Rainer Wittmann } 1692*8a2dd8f0SOliver-Rainer Wittmann else 1693*8a2dd8f0SOliver-Rainer Wittmann { 1694*8a2dd8f0SOliver-Rainer Wittmann rSh.GetTabRows( aTabCols ); 1695*8a2dd8f0SOliver-Rainer Wittmann } 1696cdf0e10cSrcweir 1697*8a2dd8f0SOliver-Rainer Wittmann // ASSERT(nNum <= aTabCols.Count(), "TabCol not found"); 1698*8a2dd8f0SOliver-Rainer Wittmann const int nLft = aTabCols.GetLeftMin(); 1699*8a2dd8f0SOliver-Rainer Wittmann const int nRgt = (sal_uInt16)(bVerticalWriting ? nPageWidth : nPageHeight) - 1700*8a2dd8f0SOliver-Rainer Wittmann (aTabCols.GetLeftMin() + 1701*8a2dd8f0SOliver-Rainer Wittmann aTabCols.GetRight()); 1702cdf0e10cSrcweir 1703*8a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nL = static_cast< sal_uInt16 >(nLft > 0 ? nLft : 0); 1704*8a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nR = static_cast< sal_uInt16 >(nRgt > 0 ? nRgt : 0); 1705cdf0e10cSrcweir 1706*8a2dd8f0SOliver-Rainer Wittmann SvxColumnItem aColItem(nNum, nL, nR); 1707cdf0e10cSrcweir 1708*8a2dd8f0SOliver-Rainer Wittmann sal_uInt16 nStart = 0, 1709*8a2dd8f0SOliver-Rainer Wittmann nEnd; 1710cdf0e10cSrcweir 1711*8a2dd8f0SOliver-Rainer Wittmann for ( sal_uInt16 i = 0; i < aTabCols.Count(); ++i ) 1712*8a2dd8f0SOliver-Rainer Wittmann { 1713*8a2dd8f0SOliver-Rainer Wittmann const SwTabColsEntry& rEntry = aTabCols.GetEntry( i ); 1714*8a2dd8f0SOliver-Rainer Wittmann if(bVerticalWriting) 1715*8a2dd8f0SOliver-Rainer Wittmann { 1716*8a2dd8f0SOliver-Rainer Wittmann nEnd = sal_uInt16(aTabCols.GetRight() - rEntry.nPos); 1717*8a2dd8f0SOliver-Rainer Wittmann SvxColumnDescription aColDesc( nStart, nEnd, 1718*8a2dd8f0SOliver-Rainer Wittmann aTabCols.GetRight() - rEntry.nMax, aTabCols.GetRight() - rEntry.nMin, 1719*8a2dd8f0SOliver-Rainer Wittmann !aTabCols.IsHidden(i) ); 1720*8a2dd8f0SOliver-Rainer Wittmann aColItem.Append(aColDesc); 1721*8a2dd8f0SOliver-Rainer Wittmann } 1722*8a2dd8f0SOliver-Rainer Wittmann else 1723*8a2dd8f0SOliver-Rainer Wittmann { 1724*8a2dd8f0SOliver-Rainer Wittmann nEnd = sal_uInt16(rEntry.nPos - aTabCols.GetLeft()); 1725*8a2dd8f0SOliver-Rainer Wittmann SvxColumnDescription aColDesc( nStart, nEnd, 1726cdf0e10cSrcweir sal_uInt16(rEntry.nMin - aTabCols.GetLeft()), sal_uInt16(rEntry.nMax - aTabCols.GetLeft()), 1727*8a2dd8f0SOliver-Rainer Wittmann !aTabCols.IsHidden(i) ); 1728*8a2dd8f0SOliver-Rainer Wittmann aColItem.Append(aColDesc); 1729*8a2dd8f0SOliver-Rainer Wittmann } 1730*8a2dd8f0SOliver-Rainer Wittmann nStart = nEnd; 1731*8a2dd8f0SOliver-Rainer Wittmann } 1732*8a2dd8f0SOliver-Rainer Wittmann if(bVerticalWriting) 1733*8a2dd8f0SOliver-Rainer Wittmann nEnd = static_cast< sal_uInt16 >(aTabCols.GetRight()); 1734*8a2dd8f0SOliver-Rainer Wittmann else 1735*8a2dd8f0SOliver-Rainer Wittmann nEnd = static_cast< sal_uInt16 >(aTabCols.GetLeft()); 1736*8a2dd8f0SOliver-Rainer Wittmann // put a position protection when the last row cannot be moved 1737*8a2dd8f0SOliver-Rainer Wittmann // due to a page break inside of a row 1738*8a2dd8f0SOliver-Rainer Wittmann if(!aTabCols.IsLastRowAllowedToChange()) 1739*8a2dd8f0SOliver-Rainer Wittmann bPutContentProtection = sal_True; 1740*8a2dd8f0SOliver-Rainer Wittmann 1741*8a2dd8f0SOliver-Rainer Wittmann SvxColumnDescription aColDesc( nStart, nEnd, 1742*8a2dd8f0SOliver-Rainer Wittmann aTabCols.GetRight(), aTabCols.GetRight(), 1743*8a2dd8f0SOliver-Rainer Wittmann sal_False ); 1744*8a2dd8f0SOliver-Rainer Wittmann aColItem.Append(aColDesc); 1745*8a2dd8f0SOliver-Rainer Wittmann 1746*8a2dd8f0SOliver-Rainer Wittmann rSet.Put(aColItem, nWhich); 1747cdf0e10cSrcweir } 1748cdf0e10cSrcweir else 1749*8a2dd8f0SOliver-Rainer Wittmann rSet.DisableItem(nWhich); 1750cdf0e10cSrcweir } 1751*8a2dd8f0SOliver-Rainer Wittmann break; 1752cdf0e10cSrcweir 1753*8a2dd8f0SOliver-Rainer Wittmann case SID_RULER_PAGE_POS: 1754*8a2dd8f0SOliver-Rainer Wittmann { 1755*8a2dd8f0SOliver-Rainer Wittmann // PAGES01 1756*8a2dd8f0SOliver-Rainer Wittmann SvxPagePosSizeItem aPagePosSize( 1757*8a2dd8f0SOliver-Rainer Wittmann Point( rPageRect.Left(), rPageRect.Top()) , nPageWidth, nPageHeight); 1758cdf0e10cSrcweir 1759*8a2dd8f0SOliver-Rainer Wittmann rSet.Put(aPagePosSize); 1760*8a2dd8f0SOliver-Rainer Wittmann break; 1761*8a2dd8f0SOliver-Rainer Wittmann } 1762cdf0e10cSrcweir 1763*8a2dd8f0SOliver-Rainer Wittmann case SID_RULER_LR_MIN_MAX: 1764*8a2dd8f0SOliver-Rainer Wittmann { 1765*8a2dd8f0SOliver-Rainer Wittmann Rectangle aRectangle; 1766*8a2dd8f0SOliver-Rainer Wittmann if( ( nFrmType & FRMTYPE_COLSECT ) && !IsTabColFromDoc() && 1767*8a2dd8f0SOliver-Rainer Wittmann ( nFrmType & ( FRMTYPE_TABLE|FRMTYPE_COLUMN ) ) ) 1768*8a2dd8f0SOliver-Rainer Wittmann { 1769*8a2dd8f0SOliver-Rainer Wittmann if( nFrmType & FRMTYPE_TABLE ) 1770*8a2dd8f0SOliver-Rainer Wittmann { 1771*8a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nNum = rSh.GetCurTabColNum(); 1772*8a2dd8f0SOliver-Rainer Wittmann SwTabCols aTabCols; 1773*8a2dd8f0SOliver-Rainer Wittmann rSh.GetTabCols( aTabCols ); 1774*8a2dd8f0SOliver-Rainer Wittmann 1775*8a2dd8f0SOliver-Rainer Wittmann const int nLft = aTabCols.GetLeftMin() + aTabCols.GetLeft(); 1776*8a2dd8f0SOliver-Rainer Wittmann const int nRgt = (sal_uInt16)nPageWidth -(aTabCols.GetLeftMin() + aTabCols.GetRight()); 1777*8a2dd8f0SOliver-Rainer Wittmann 1778*8a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nL = static_cast< sal_uInt16 >(nLft > 0 ? nLft : 0); 1779*8a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nR = static_cast< sal_uInt16 >(nRgt > 0 ? nRgt : 0); 1780*8a2dd8f0SOliver-Rainer Wittmann 1781*8a2dd8f0SOliver-Rainer Wittmann aRectangle.Left() = nL; 1782*8a2dd8f0SOliver-Rainer Wittmann if(nNum > 1) 1783*8a2dd8f0SOliver-Rainer Wittmann aRectangle.Left() += aTabCols[nNum - 2]; 1784*8a2dd8f0SOliver-Rainer Wittmann if(nNum) 1785*8a2dd8f0SOliver-Rainer Wittmann aRectangle.Left() += MINLAY; 1786*8a2dd8f0SOliver-Rainer Wittmann if(aTabCols.Count() <= nNum + 1 ) 1787*8a2dd8f0SOliver-Rainer Wittmann aRectangle.Right() = nR; 1788*8a2dd8f0SOliver-Rainer Wittmann else 1789*8a2dd8f0SOliver-Rainer Wittmann aRectangle.Right() = nPageWidth - (nL + aTabCols[nNum + 1]); 1790*8a2dd8f0SOliver-Rainer Wittmann 1791*8a2dd8f0SOliver-Rainer Wittmann if(nNum < aTabCols.Count()) 1792*8a2dd8f0SOliver-Rainer Wittmann aRectangle.Right() += MINLAY; 1793*8a2dd8f0SOliver-Rainer Wittmann } 1794*8a2dd8f0SOliver-Rainer Wittmann else 1795*8a2dd8f0SOliver-Rainer Wittmann { 1796*8a2dd8f0SOliver-Rainer Wittmann const SwFrmFmt* pFmt = rSh.GetFlyFrmFmt(); 1797*8a2dd8f0SOliver-Rainer Wittmann const SwFmtCol* pCols = pFmt ? &pFmt->GetCol(): 1798*8a2dd8f0SOliver-Rainer Wittmann &rDesc.GetMaster().GetCol(); 1799*8a2dd8f0SOliver-Rainer Wittmann const SwColumns& rCols = pCols->GetColumns(); 1800*8a2dd8f0SOliver-Rainer Wittmann sal_uInt16 nNum = rSh.GetCurOutColNum(); 1801*8a2dd8f0SOliver-Rainer Wittmann sal_uInt16 nCount = Min(sal_uInt16(nNum + 1), rCols.Count()); 1802*8a2dd8f0SOliver-Rainer Wittmann const SwRect aRect( rSh.GetAnyCurRect( pFmt 1803*8a2dd8f0SOliver-Rainer Wittmann ? RECT_FLY_PRT_EMBEDDED 1804*8a2dd8f0SOliver-Rainer Wittmann : RECT_PAGE_PRT, pPt )); 1805*8a2dd8f0SOliver-Rainer Wittmann const SwRect aAbsRect( rSh.GetAnyCurRect( pFmt 1806*8a2dd8f0SOliver-Rainer Wittmann ? RECT_FLY_EMBEDDED 1807*8a2dd8f0SOliver-Rainer Wittmann : RECT_PAGE, pPt )); 1808*8a2dd8f0SOliver-Rainer Wittmann 1809*8a2dd8f0SOliver-Rainer Wittmann //die Breite im Rahmen bzw. innerhalbe der Seitenraender 1810*8a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nTotalWidth = (sal_uInt16)aRect.Width(); 1811*8a2dd8f0SOliver-Rainer Wittmann //die gesamte Rahmenbreite - die Differenz ist der doppelte Abstand zum Rand 1812*8a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nOuterWidth = (sal_uInt16)aAbsRect.Width(); 1813*8a2dd8f0SOliver-Rainer Wittmann int nWidth = 0, 1814*8a2dd8f0SOliver-Rainer Wittmann nStart = 0, 1815*8a2dd8f0SOliver-Rainer Wittmann nEnd = 0; 1816*8a2dd8f0SOliver-Rainer Wittmann aRectangle.Left() = 0; 1817*8a2dd8f0SOliver-Rainer Wittmann for ( sal_uInt16 i = 0; i < nCount; ++i ) 1818*8a2dd8f0SOliver-Rainer Wittmann { 1819*8a2dd8f0SOliver-Rainer Wittmann SwColumn* pCol = rCols[i]; 1820*8a2dd8f0SOliver-Rainer Wittmann nStart = pCol->GetLeft() + nWidth; 1821*8a2dd8f0SOliver-Rainer Wittmann if(i == nNum - 2) 1822*8a2dd8f0SOliver-Rainer Wittmann aRectangle.Left() = nStart; 1823*8a2dd8f0SOliver-Rainer Wittmann nWidth += pCols->CalcColWidth( i, nTotalWidth ); 1824*8a2dd8f0SOliver-Rainer Wittmann nEnd = nWidth - pCol->GetRight(); 1825*8a2dd8f0SOliver-Rainer Wittmann } 1826*8a2dd8f0SOliver-Rainer Wittmann aRectangle.Right() = rPageRect.Right() - nEnd; 1827*8a2dd8f0SOliver-Rainer Wittmann aRectangle.Left() -= rPageRect.Left(); 1828*8a2dd8f0SOliver-Rainer Wittmann 1829*8a2dd8f0SOliver-Rainer Wittmann if(nNum > 1) 1830*8a2dd8f0SOliver-Rainer Wittmann { 1831*8a2dd8f0SOliver-Rainer Wittmann aRectangle.Left() += MINLAY; 1832*8a2dd8f0SOliver-Rainer Wittmann aRectangle.Left() += aRect.Left(); 1833*8a2dd8f0SOliver-Rainer Wittmann } 1834*8a2dd8f0SOliver-Rainer Wittmann if(pFmt) //Bereich in Rahmen - hier darf man bis zum Rand 1835*8a2dd8f0SOliver-Rainer Wittmann aRectangle.Left() = aRectangle.Right() = 0; 1836*8a2dd8f0SOliver-Rainer Wittmann else 1837*8a2dd8f0SOliver-Rainer Wittmann { 1838*8a2dd8f0SOliver-Rainer Wittmann // das Rechteck an die richtige absolute Position verschieben 1839*8a2dd8f0SOliver-Rainer Wittmann aRectangle.Left() += aAbsRect.Left(); 1840*8a2dd8f0SOliver-Rainer Wittmann aRectangle.Right() -= aAbsRect.Left(); 1841*8a2dd8f0SOliver-Rainer Wittmann // Abstand zur Umrandung mit einbeziehen 1842*8a2dd8f0SOliver-Rainer Wittmann aRectangle.Right() -= (nOuterWidth - nTotalWidth) / 2; 1843*8a2dd8f0SOliver-Rainer Wittmann } 1844*8a2dd8f0SOliver-Rainer Wittmann 1845*8a2dd8f0SOliver-Rainer Wittmann if(nNum < rCols.Count()) 1846*8a2dd8f0SOliver-Rainer Wittmann { 1847*8a2dd8f0SOliver-Rainer Wittmann aRectangle.Right() += MINLAY; 1848*8a2dd8f0SOliver-Rainer Wittmann } 1849*8a2dd8f0SOliver-Rainer Wittmann else 1850*8a2dd8f0SOliver-Rainer Wittmann // rechts ist jetzt nur noch der Seitenrand 1851*8a2dd8f0SOliver-Rainer Wittmann aRectangle.Right() = 0; 1852cdf0e10cSrcweir 1853*8a2dd8f0SOliver-Rainer Wittmann 1854*8a2dd8f0SOliver-Rainer Wittmann } 1855*8a2dd8f0SOliver-Rainer Wittmann } 1856*8a2dd8f0SOliver-Rainer Wittmann else if ( ((nFrmType & FRMTYPE_TABLE) || IsTabColFromDoc()) && 1857*8a2dd8f0SOliver-Rainer Wittmann !bFrmSelection ) 1858*8a2dd8f0SOliver-Rainer Wittmann { 1859*8a2dd8f0SOliver-Rainer Wittmann sal_Bool bColumn; 1860*8a2dd8f0SOliver-Rainer Wittmann if ( IsTabColFromDoc() ) 1861*8a2dd8f0SOliver-Rainer Wittmann bColumn = rSh.GetCurMouseColNum( aTabColFromDocPos ) != 0; 1862*8a2dd8f0SOliver-Rainer Wittmann else 1863*8a2dd8f0SOliver-Rainer Wittmann bColumn = (nFrmType & (FRMTYPE_COLUMN|FRMTYPE_FLY_ANY|FRMTYPE_COLSECTOUTTAB)) 1864*8a2dd8f0SOliver-Rainer Wittmann ? sal_True 1865*8a2dd8f0SOliver-Rainer Wittmann : sal_False; 1866*8a2dd8f0SOliver-Rainer Wittmann if ( !bColumn ) 1867*8a2dd8f0SOliver-Rainer Wittmann { 1868*8a2dd8f0SOliver-Rainer Wittmann if( nFrmType & FRMTYPE_FLY_ANY && IsTabColFromDoc() ) 1869*8a2dd8f0SOliver-Rainer Wittmann { 1870*8a2dd8f0SOliver-Rainer Wittmann SwRect aRect( rSh.GetAnyCurRect( 1871*8a2dd8f0SOliver-Rainer Wittmann RECT_FLY_PRT_EMBEDDED, pPt ) ); 1872*8a2dd8f0SOliver-Rainer Wittmann aRect.Pos() += rSh.GetAnyCurRect( RECT_FLY_EMBEDDED, 1873*8a2dd8f0SOliver-Rainer Wittmann pPt ).Pos(); 1874*8a2dd8f0SOliver-Rainer Wittmann 1875*8a2dd8f0SOliver-Rainer Wittmann aRectangle.Left() = aRect.Left() - rPageRect.Left(); 1876*8a2dd8f0SOliver-Rainer Wittmann aRectangle.Right() = rPageRect.Right() - aRect.Right(); 1877*8a2dd8f0SOliver-Rainer Wittmann } 1878*8a2dd8f0SOliver-Rainer Wittmann else if( bBrowse ) 1879*8a2dd8f0SOliver-Rainer Wittmann { 1880*8a2dd8f0SOliver-Rainer Wittmann aRectangle.Left() = rPagePrtRect.Left(); 1881*8a2dd8f0SOliver-Rainer Wittmann aRectangle.Right() = nPageWidth - rPagePrtRect.Right(); 1882*8a2dd8f0SOliver-Rainer Wittmann } 1883*8a2dd8f0SOliver-Rainer Wittmann else 1884*8a2dd8f0SOliver-Rainer Wittmann { 1885*8a2dd8f0SOliver-Rainer Wittmann aRectangle.Left() = aPageLRSpace.GetLeft(); 1886*8a2dd8f0SOliver-Rainer Wittmann aRectangle.Right() = aPageLRSpace.GetRight(); 1887*8a2dd8f0SOliver-Rainer Wittmann } 1888*8a2dd8f0SOliver-Rainer Wittmann } 1889*8a2dd8f0SOliver-Rainer Wittmann else 1890*8a2dd8f0SOliver-Rainer Wittmann { //hier nur fuer Tabelle in mehrspaltigen Seiten und Rahmen 1891*8a2dd8f0SOliver-Rainer Wittmann sal_Bool bSectOutTbl = (nFrmType & FRMTYPE_TABLE) ? sal_True : sal_False; 1892*8a2dd8f0SOliver-Rainer Wittmann sal_Bool bFrame = (nFrmType & FRMTYPE_FLY_ANY) ? sal_True : sal_False; 1893*8a2dd8f0SOliver-Rainer Wittmann sal_Bool bColSct = (nFrmType & ( bSectOutTbl 1894*8a2dd8f0SOliver-Rainer Wittmann ? FRMTYPE_COLSECTOUTTAB 1895*8a2dd8f0SOliver-Rainer Wittmann : FRMTYPE_COLSECT ) 1896*8a2dd8f0SOliver-Rainer Wittmann ) ? sal_True : sal_False; 1897*8a2dd8f0SOliver-Rainer Wittmann //Damit man auch mit der Mouse ziehen kann, 1898*8a2dd8f0SOliver-Rainer Wittmann //ohne in der Tabelle zu stehen 1899*8a2dd8f0SOliver-Rainer Wittmann CurRectType eRecType = RECT_PAGE_PRT; 1900*8a2dd8f0SOliver-Rainer Wittmann sal_uInt16 nNum = IsTabColFromDoc() ? 1901*8a2dd8f0SOliver-Rainer Wittmann rSh.GetCurMouseColNum( aTabColFromDocPos ): 1902*8a2dd8f0SOliver-Rainer Wittmann rSh.GetCurOutColNum(); 1903*8a2dd8f0SOliver-Rainer Wittmann const SwFrmFmt* pFmt = NULL; 1904*8a2dd8f0SOliver-Rainer Wittmann if( bColSct ) 1905*8a2dd8f0SOliver-Rainer Wittmann { 1906*8a2dd8f0SOliver-Rainer Wittmann eRecType = bSectOutTbl ? RECT_OUTTABSECTION 1907*8a2dd8f0SOliver-Rainer Wittmann : RECT_SECTION; 1908*8a2dd8f0SOliver-Rainer Wittmann const SwSection *pSect = rSh.GetAnySection( bSectOutTbl, pPt ); 1909*8a2dd8f0SOliver-Rainer Wittmann ASSERT( pSect, "Welcher Bereich?"); 1910*8a2dd8f0SOliver-Rainer Wittmann pFmt = pSect->GetFmt(); 1911*8a2dd8f0SOliver-Rainer Wittmann } 1912*8a2dd8f0SOliver-Rainer Wittmann else if( bFrame ) 1913*8a2dd8f0SOliver-Rainer Wittmann { 1914*8a2dd8f0SOliver-Rainer Wittmann pFmt = rSh.GetFlyFrmFmt(); 1915*8a2dd8f0SOliver-Rainer Wittmann eRecType = RECT_FLY_PRT_EMBEDDED; 1916*8a2dd8f0SOliver-Rainer Wittmann } 1917*8a2dd8f0SOliver-Rainer Wittmann 1918*8a2dd8f0SOliver-Rainer Wittmann const SwFmtCol* pCols = pFmt ? &pFmt->GetCol(): 1919*8a2dd8f0SOliver-Rainer Wittmann &rDesc.GetMaster().GetCol(); 1920*8a2dd8f0SOliver-Rainer Wittmann const SwColumns& rCols = pCols->GetColumns(); 1921*8a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nBorder = pFmt ? pFmt->GetBox().GetDistance() : 1922*8a2dd8f0SOliver-Rainer Wittmann rDesc.GetMaster().GetBox().GetDistance(); 1923*8a2dd8f0SOliver-Rainer Wittmann 1924*8a2dd8f0SOliver-Rainer Wittmann /* RECT_FLY_PRT_EMBEDDED returns the relative position to 1925*8a2dd8f0SOliver-Rainer Wittmann RECT_FLY_EMBEDDED 1926*8a2dd8f0SOliver-Rainer Wittmann the absolute position must be added here 1927*8a2dd8f0SOliver-Rainer Wittmann */ 1928*8a2dd8f0SOliver-Rainer Wittmann SwRect aRect( rSh.GetAnyCurRect( eRecType, pPt ) ); 1929*8a2dd8f0SOliver-Rainer Wittmann if(RECT_FLY_PRT_EMBEDDED == eRecType) 1930*8a2dd8f0SOliver-Rainer Wittmann aRect.Pos() += rSh.GetAnyCurRect( RECT_FLY_EMBEDDED, 1931*8a2dd8f0SOliver-Rainer Wittmann pPt ).Pos(); 1932*8a2dd8f0SOliver-Rainer Wittmann 1933*8a2dd8f0SOliver-Rainer Wittmann const sal_uInt16 nTotalWidth = (sal_uInt16)aRect.Width(); 1934*8a2dd8f0SOliver-Rainer Wittmann //nStart und nEnd initialisieren fuer nNum == 0 1935*8a2dd8f0SOliver-Rainer Wittmann int nWidth = 0, 1936*8a2dd8f0SOliver-Rainer Wittmann nStart = 0, 1937*8a2dd8f0SOliver-Rainer Wittmann nEnd = nTotalWidth; 1938*8a2dd8f0SOliver-Rainer Wittmann 1939*8a2dd8f0SOliver-Rainer Wittmann if( nNum > rCols.Count() ) 1940*8a2dd8f0SOliver-Rainer Wittmann { 1941*8a2dd8f0SOliver-Rainer Wittmann ASSERT( !this, "es wird auf dem falschen FmtCol gearbeitet!" ); 1942*8a2dd8f0SOliver-Rainer Wittmann nNum = rCols.Count(); 1943*8a2dd8f0SOliver-Rainer Wittmann } 1944*8a2dd8f0SOliver-Rainer Wittmann 1945*8a2dd8f0SOliver-Rainer Wittmann for( sal_uInt16 i = 0; i < nNum; ++i ) 1946*8a2dd8f0SOliver-Rainer Wittmann { 1947*8a2dd8f0SOliver-Rainer Wittmann SwColumn* pCol = rCols[i]; 1948*8a2dd8f0SOliver-Rainer Wittmann nStart = pCol->GetLeft() + nWidth; 1949*8a2dd8f0SOliver-Rainer Wittmann nWidth += pCols->CalcColWidth( i, nTotalWidth ); 1950*8a2dd8f0SOliver-Rainer Wittmann nEnd = nWidth - pCol->GetRight(); 1951*8a2dd8f0SOliver-Rainer Wittmann } 1952*8a2dd8f0SOliver-Rainer Wittmann if( bFrame | bColSct ) 1953*8a2dd8f0SOliver-Rainer Wittmann { 1954*8a2dd8f0SOliver-Rainer Wittmann aRectangle.Left() = aRect.Left() - rPageRect.Left() + nStart; 1955*8a2dd8f0SOliver-Rainer Wittmann aRectangle.Right() = nPageWidth - aRectangle.Left() - nEnd + nStart; 1956*8a2dd8f0SOliver-Rainer Wittmann } 1957*8a2dd8f0SOliver-Rainer Wittmann else if(!bBrowse) 1958*8a2dd8f0SOliver-Rainer Wittmann { 1959*8a2dd8f0SOliver-Rainer Wittmann aRectangle.Left() = aPageLRSpace.GetLeft() + nStart; 1960*8a2dd8f0SOliver-Rainer Wittmann aRectangle.Right() = nPageWidth - nEnd - aPageLRSpace.GetLeft(); 1961*8a2dd8f0SOliver-Rainer Wittmann } 1962*8a2dd8f0SOliver-Rainer Wittmann else 1963*8a2dd8f0SOliver-Rainer Wittmann { 1964*8a2dd8f0SOliver-Rainer Wittmann long nLeft = rPagePrtRect.Left(); 1965*8a2dd8f0SOliver-Rainer Wittmann aRectangle.Left() = nStart + nLeft; 1966*8a2dd8f0SOliver-Rainer Wittmann aRectangle.Right() = nPageWidth - nEnd - nLeft; 1967*8a2dd8f0SOliver-Rainer Wittmann } 1968*8a2dd8f0SOliver-Rainer Wittmann if(!bFrame) 1969*8a2dd8f0SOliver-Rainer Wittmann { 1970*8a2dd8f0SOliver-Rainer Wittmann aRectangle.Left() += nBorder; 1971*8a2dd8f0SOliver-Rainer Wittmann aRectangle.Right() -= nBorder; 1972*8a2dd8f0SOliver-Rainer Wittmann } 1973*8a2dd8f0SOliver-Rainer Wittmann } 1974*8a2dd8f0SOliver-Rainer Wittmann } 1975*8a2dd8f0SOliver-Rainer Wittmann else if ( nFrmType & ( FRMTYPE_HEADER | FRMTYPE_FOOTER )) 1976*8a2dd8f0SOliver-Rainer Wittmann { 1977*8a2dd8f0SOliver-Rainer Wittmann aRectangle.Left() = aPageLRSpace.GetLeft(); 1978*8a2dd8f0SOliver-Rainer Wittmann aRectangle.Right() = aPageLRSpace.GetRight(); 1979*8a2dd8f0SOliver-Rainer Wittmann } 1980*8a2dd8f0SOliver-Rainer Wittmann else 1981*8a2dd8f0SOliver-Rainer Wittmann aRectangle.Left() = aRectangle.Right() = 0; 1982*8a2dd8f0SOliver-Rainer Wittmann 1983*8a2dd8f0SOliver-Rainer Wittmann SfxRectangleItem aLR( SID_RULER_LR_MIN_MAX , aRectangle); 1984*8a2dd8f0SOliver-Rainer Wittmann rSet.Put(aLR); 1985*8a2dd8f0SOliver-Rainer Wittmann } 1986*8a2dd8f0SOliver-Rainer Wittmann break; 1987*8a2dd8f0SOliver-Rainer Wittmann 1988*8a2dd8f0SOliver-Rainer Wittmann case SID_RULER_PROTECT: 1989*8a2dd8f0SOliver-Rainer Wittmann { 1990*8a2dd8f0SOliver-Rainer Wittmann if(bFrmSelection) 1991*8a2dd8f0SOliver-Rainer Wittmann { 1992*8a2dd8f0SOliver-Rainer Wittmann sal_uInt8 nProtect = pWrtShell->IsSelObjProtected( FLYPROTECT_SIZE|FLYPROTECT_POS|FLYPROTECT_CONTENT ); 1993*8a2dd8f0SOliver-Rainer Wittmann 1994*8a2dd8f0SOliver-Rainer Wittmann SvxProtectItem aProt(SID_RULER_PROTECT); 1995*8a2dd8f0SOliver-Rainer Wittmann aProt.SetCntntProtect((nProtect & FLYPROTECT_CONTENT) != 0); 1996*8a2dd8f0SOliver-Rainer Wittmann aProt.SetSizeProtect ((nProtect & FLYPROTECT_SIZE) != 0); 1997*8a2dd8f0SOliver-Rainer Wittmann aProt.SetPosProtect ((nProtect & FLYPROTECT_POS) != 0); 1998*8a2dd8f0SOliver-Rainer Wittmann rSet.Put(aProt); 1999*8a2dd8f0SOliver-Rainer Wittmann } 2000*8a2dd8f0SOliver-Rainer Wittmann else 2001*8a2dd8f0SOliver-Rainer Wittmann { 2002*8a2dd8f0SOliver-Rainer Wittmann SvxProtectItem aProtect(SID_RULER_PROTECT); 2003*8a2dd8f0SOliver-Rainer Wittmann if(bBrowse && !(nFrmType & (FRMTYPE_DRAWOBJ|FRMTYPE_COLUMN)) && !rSh.GetTableFmt()) 2004*8a2dd8f0SOliver-Rainer Wittmann { 2005*8a2dd8f0SOliver-Rainer Wittmann aProtect.SetSizeProtect(sal_True); 2006*8a2dd8f0SOliver-Rainer Wittmann aProtect.SetPosProtect(sal_True); 2007*8a2dd8f0SOliver-Rainer Wittmann } 2008*8a2dd8f0SOliver-Rainer Wittmann rSet.Put(aProtect); 2009*8a2dd8f0SOliver-Rainer Wittmann } 2010*8a2dd8f0SOliver-Rainer Wittmann } 2011*8a2dd8f0SOliver-Rainer Wittmann break; 2012*8a2dd8f0SOliver-Rainer Wittmann } 2013*8a2dd8f0SOliver-Rainer Wittmann nWhich = aIter.NextWhich(); 2014*8a2dd8f0SOliver-Rainer Wittmann } 2015cdf0e10cSrcweir if(bPutContentProtection) 2016cdf0e10cSrcweir { 2017cdf0e10cSrcweir SvxProtectItem aProtect(SID_RULER_PROTECT); 2018cdf0e10cSrcweir aProtect.SetCntntProtect(sal_True); 2019cdf0e10cSrcweir rSet.Put(aProtect); 2020cdf0e10cSrcweir } 2021cdf0e10cSrcweir } 2022cdf0e10cSrcweir 2023cdf0e10cSrcweir 2024