Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include <hintids.hxx>
31 : : #include "uitool.hxx"
32 : : #include <sfx2/app.hxx>
33 : : #include <svx/rulritem.hxx>
34 : : #include <editeng/tstpitem.hxx>
35 : : #include <sfx2/request.hxx>
36 : : #include <editeng/lrspitem.hxx>
37 : : #include <editeng/ulspitem.hxx>
38 : : #include <editeng/boxitem.hxx>
39 : : #include <editeng/frmdiritem.hxx>
40 : : #include <svl/eitem.hxx>
41 : : #include <svl/whiter.hxx>
42 : : #include <svx/ruler.hxx>
43 : : #include <editeng/protitem.hxx>
44 : : #include <svl/rectitem.hxx>
45 : : #include <sfx2/bindings.hxx>
46 : : #include <fmtfsize.hxx>
47 : : #include <fmthdft.hxx>
48 : : #include <fmtclds.hxx>
49 : : #include <fmtornt.hxx>
50 : : #include <frmatr.hxx>
51 : : #include <edtwin.hxx>
52 : : #include "view.hxx"
53 : : #include "wrtsh.hxx"
54 : : #include "basesh.hxx"
55 : : #include "cmdid.h"
56 : : #include "viewopt.hxx"
57 : : #include "tabcol.hxx"
58 : : #include "frmfmt.hxx" // FrameFormat
59 : : #include "pagedesc.hxx" // Aktuelles Seitenformat
60 : : #include "wview.hxx"
61 : : #include "fmtcol.hxx"
62 : : #include "section.hxx"
63 : :
64 : : #include "ndtxt.hxx"
65 : : #include "pam.hxx"
66 : :
67 : : #include <IDocumentSettingAccess.hxx>
68 : :
69 : : using namespace ::com::sun::star;
70 : :
71 : :
72 : : /*--------------------------------------------------------------------
73 : : Beschreibung: Debug-Methode
74 : : --------------------------------------------------------------------*/
75 : :
76 : : /*--------------------------------------------------------------------
77 : : Beschreibung: Columns eintueten
78 : : --------------------------------------------------------------------*/
79 : 0 : void lcl_FillSvxColumn(const SwFmtCol& rCol,
80 : : sal_uInt16 nTotalWidth,
81 : : SvxColumnItem& rColItem,
82 : : long nDistance)
83 : : {
84 : 0 : const SwColumns& rCols = rCol.GetColumns();
85 : 0 : sal_uInt16 nWidth = 0;
86 : :
87 [ # # ][ # # ]: 0 : sal_Bool bOrtho = rCol.IsOrtho() && rCols.size();
88 : 0 : long nInnerWidth = 0;
89 [ # # ]: 0 : if( bOrtho )
90 : : {
91 : 0 : nInnerWidth = nTotalWidth;
92 [ # # ]: 0 : for ( sal_uInt16 i = 0; i < rCols.size(); ++i )
93 : : {
94 : 0 : const SwColumn* pCol = &rCols[i];
95 : 0 : nInnerWidth -= pCol->GetLeft() + pCol->GetRight();
96 : : }
97 [ # # ]: 0 : if( nInnerWidth < 0 )
98 : 0 : nInnerWidth = 0;
99 : : else
100 : 0 : nInnerWidth /= rCols.size();
101 : : }
102 [ # # ]: 0 : for ( sal_uInt16 i = 0; i < rCols.size(); ++i )
103 : : {
104 [ # # ]: 0 : const SwColumn* pCol = &rCols[i];
105 : 0 : const sal_uInt16 nStart = sal_uInt16(pCol->GetLeft() + nWidth + nDistance);
106 [ # # ]: 0 : if( bOrtho )
107 : 0 : nWidth = static_cast< sal_uInt16 >(nWidth + nInnerWidth + pCol->GetLeft() + pCol->GetRight());
108 : : else
109 [ # # ]: 0 : nWidth = static_cast< sal_uInt16 >(nWidth + rCol.CalcColWidth(i, nTotalWidth));
110 : 0 : const sal_uInt16 nEnd = sal_uInt16(nWidth - pCol->GetRight() + nDistance);
111 : :
112 : 0 : SvxColumnDescription aColDesc(nStart, nEnd, sal_True);
113 [ # # ]: 0 : rColItem.Append(aColDesc);
114 : : }
115 : 0 : }
116 : :
117 : : /*--------------------------------------------------------------------
118 : : Beschreibung: ColumnItem in ColumnInfo ueberfuehren
119 : : --------------------------------------------------------------------*/
120 : 0 : void lcl_ConvertToCols(const SvxColumnItem& rColItem,
121 : : sal_uInt16 nTotalWidth,
122 : : SwFmtCol& rCols)
123 : : {
124 : : OSL_ENSURE( rCols.GetNumCols() == rColItem.Count(), "Column count mismatch" );
125 : : // ruler executes that change the columns shortly after the selection has changed
126 : : // can result in a crash
127 [ # # ]: 0 : if(rCols.GetNumCols() != rColItem.Count())
128 : 0 : return;
129 : :
130 : 0 : sal_uInt16 nLeft = 0;
131 : 0 : SwTwips nSumAll= 0; // Summiere alle Spalten und Raender auf
132 : :
133 : 0 : SwColumns& rArr = rCols.GetColumns();
134 : :
135 : : // Tabcols der Reihe nach
136 [ # # ]: 0 : for( sal_uInt16 i=0; i < rColItem.Count()-1; ++i )
137 : : {
138 : : OSL_ENSURE(rColItem[i+1].nStart >= rColItem[i].nEnd,"overlapping columns" );
139 : 0 : sal_uInt16 nStart = static_cast< sal_uInt16 >(rColItem[i+1].nStart);
140 : 0 : sal_uInt16 nEnd = static_cast< sal_uInt16 >(rColItem[i].nEnd);
141 [ # # ]: 0 : if(nStart < nEnd)
142 : 0 : nStart = nEnd;
143 : 0 : const sal_uInt16 nDiff = nStart - nEnd;
144 : 0 : const sal_uInt16 nRight = nDiff / 2;
145 : :
146 : 0 : sal_uInt16 nWidth = static_cast< sal_uInt16 >(rColItem[i].nEnd - rColItem[i].nStart);
147 : 0 : nWidth += nLeft + nRight;
148 : :
149 : 0 : SwColumn* pCol = &rArr[i];
150 : 0 : pCol->SetWishWidth( sal_uInt16(long(rCols.GetWishWidth()) * long(nWidth) /
151 : 0 : long(nTotalWidth) ));
152 : 0 : pCol->SetLeft( nLeft );
153 : 0 : pCol->SetRight( nRight );
154 : 0 : nSumAll += pCol->GetWishWidth();
155 : :
156 : 0 : nLeft = nRight;
157 : : }
158 : 0 : rArr[rColItem.Count()-1].SetLeft( nLeft );
159 : :
160 : : //Die Differenz aus der Gesamtwunschbreite und der Summe der bisher berechneten
161 : : // Spalten und Raender sollte die Breite der letzten Spalte ergeben.
162 : 0 : rArr[rColItem.Count()-1].SetWishWidth( rCols.GetWishWidth() - (sal_uInt16)nSumAll );
163 : :
164 : 0 : rCols.SetOrtho(sal_False, 0, 0 );
165 : : }
166 : :
167 : : /*--------------------------------------------------------------------
168 : : Beschreibung: Tabs loeschen
169 : : --------------------------------------------------------------------*/
170 : 670 : void lcl_EraseDefTabs(SvxTabStopItem& rTabStops)
171 : : {
172 : : // Def Tabs loeschen
173 [ + + ]: 1340 : for ( sal_uInt16 i = 0; i < rTabStops.Count(); )
174 : : {
175 : : // Hier auch den DefTab auf Null rausschmeissen
176 [ - + # # ]: 670 : if ( SVX_TAB_ADJUST_DEFAULT == rTabStops[i].GetAdjustment() ||
[ + - ]
177 : 0 : rTabStops[i].GetTabPos() == 0 )
178 : : {
179 : 670 : rTabStops.Remove(i);
180 : 670 : continue;
181 : : }
182 : 0 : ++i;
183 : : }
184 : 670 : }
185 : :
186 : : /*--------------------------------------------------------------------
187 : : Beschreibung: Seitenrand umdrehen
188 : : --------------------------------------------------------------------*/
189 : 692 : void SwView::SwapPageMargin(const SwPageDesc& rDesc, SvxLRSpaceItem& rLRSpace)
190 : : {
191 : : sal_uInt16 nPhyPage, nVirPage;
192 [ + - ]: 692 : GetWrtShell().GetPageNum( nPhyPage, nVirPage );
193 : :
194 [ - + ][ # # ]: 692 : if ( rDesc.GetUseOn() == nsUseOnPage::PD_MIRROR && (nPhyPage % 2) == 0 )
[ - + ]
195 : : {
196 : 0 : long nTmp = rLRSpace.GetRight();
197 : 0 : rLRSpace.SetRight( rLRSpace.GetLeft() );
198 : 0 : rLRSpace.SetLeft( nTmp );
199 : : }
200 : 692 : }
201 : :
202 : : /*--------------------------------------------------------------------
203 : : Beschreibung: Wenn der Rahmenrand verschoben wird, sollen die
204 : : Spaltentrenner an der gleichen absoluten Position bleiben
205 : : --------------------------------------------------------------------*/
206 : 0 : void lcl_Scale(long& nVal, long nScale)
207 : : {
208 : 0 : nVal *= nScale;
209 : 0 : nVal >>= 8;
210 : 0 : }
211 : :
212 : 0 : void ResizeFrameCols(SwFmtCol& rCol,
213 : : long nOldWidth,
214 : : long nNewWidth,
215 : : long nLeftDelta )
216 : : {
217 : 0 : SwColumns& rArr = rCol.GetColumns();
218 : 0 : long nWishSum = (long)rCol.GetWishWidth();
219 : 0 : long nWishDiff = (nWishSum * 100/nOldWidth * nNewWidth) / 100 - nWishSum;
220 : 0 : long nNewWishWidth = nWishSum + nWishDiff;
221 [ # # ]: 0 : if(nNewWishWidth > 0xffffl)
222 : : {
223 : : // wenn die Wunschbreite zu gross wird, dann muessen alle Werte passend skaliert werden
224 : 0 : long nScale = (0xffffl << 8)/ nNewWishWidth;
225 [ # # ]: 0 : for(sal_uInt16 i = 0; i < rArr.size(); i++)
226 : : {
227 [ # # ]: 0 : SwColumn* pCol = &rArr[i];
228 : 0 : long nVal = pCol->GetWishWidth();
229 : 0 : lcl_Scale(nVal, nScale);
230 : 0 : pCol->SetWishWidth((sal_uInt16) nVal);
231 : 0 : nVal = pCol->GetLeft();
232 : 0 : lcl_Scale(nVal, nScale);
233 : 0 : pCol->SetLeft((sal_uInt16) nVal);
234 : 0 : nVal = pCol->GetRight();
235 : 0 : lcl_Scale(nVal, nScale);
236 : 0 : pCol->SetRight((sal_uInt16) nVal);
237 : : }
238 : 0 : lcl_Scale(nNewWishWidth, nScale);
239 : 0 : lcl_Scale(nWishDiff, nScale);
240 : : }
241 : 0 : rCol.SetWishWidth( (sal_uInt16) (nNewWishWidth) );
242 : :
243 [ # # ][ # # ]: 0 : if( nLeftDelta >= 2 || nLeftDelta <= -2)
244 [ # # ][ # # ]: 0 : rArr.front().SetWishWidth(rArr.front().GetWishWidth() + (sal_uInt16)nWishDiff);
245 : : else
246 [ # # ][ # # ]: 0 : rArr.back().SetWishWidth(rArr.back().GetWishWidth() + (sal_uInt16)nWishDiff);
247 : : //reset auto width
248 [ # # ]: 0 : rCol.SetOrtho(sal_False, 0, 0 );
249 : 0 : }
250 : :
251 : : /*--------------------------------------------------------------------
252 : : Beschreibung: Hier werden alle Aenderungen der Tableiste
253 : : wieder in das Modell geschossen
254 : : --------------------------------------------------------------------*/
255 : 0 : void SwView::ExecTabWin( SfxRequest& rReq )
256 : : {
257 : 0 : SwWrtShell &rSh = GetWrtShell();
258 : 0 : const sal_uInt16 nFrmType = rSh.IsObjSelected() ?
259 : : FRMTYPE_DRAWOBJ :
260 [ # # ]: 0 : rSh.GetFrmType(0,sal_True);
261 : 0 : const sal_Bool bFrmSelection = rSh.IsFrmSelected();
262 : 0 : const sal_Bool bBrowse = rSh.GetViewOptions()->getBrowseMode();
263 : :
264 : 0 : const sal_uInt16 nSlot = rReq.GetSlot();
265 : 0 : const sal_uInt16 nDescId = rSh.GetCurPageDesc();
266 : 0 : const SwPageDesc& rDesc = rSh.GetPageDesc( nDescId );
267 : :
268 : 0 : const sal_Bool bVerticalWriting = rSh.IsInVerticalText();
269 : 0 : const SwFmtHeader& rHeaderFmt = rDesc.GetMaster().GetHeader();
270 : 0 : SwFrmFmt *pHeaderFmt = (SwFrmFmt*)rHeaderFmt.GetHeaderFmt();
271 : :
272 : 0 : const SwFmtFooter& rFooterFmt = rDesc.GetMaster().GetFooter();
273 : 0 : SwFrmFmt *pFooterFmt = (SwFrmFmt*)rFooterFmt.GetFooterFmt();
274 : :
275 : 0 : const SwFmtFrmSize &rFrmSize = rDesc.GetMaster().GetFrmSize();
276 : :
277 [ # # ]: 0 : const SwRect& rPageRect = rSh.GetAnyCurRect(RECT_PAGE);
278 [ # # ]: 0 : const long nPageWidth = bBrowse ? rPageRect.Width() : rFrmSize.GetWidth();
279 [ # # ]: 0 : const long nPageHeight = bBrowse ? rPageRect.Height() : rFrmSize.GetHeight();
280 : :
281 : 0 : sal_Bool bUnlockView = sal_False;
282 : 0 : rSh.StartAllAction();
283 : 0 : sal_Bool bSect = 0 != (nFrmType & FRMTYPE_COLSECT);
284 : :
285 [ # # # # : 0 : switch ( nSlot )
# # # ]
286 : : {
287 : : case SID_ATTR_LONG_LRSPACE:
288 : : {
289 : 0 : SvxLongLRSpaceItem aLongLR( (const SvxLongLRSpaceItem&)rReq.GetArgs()->
290 [ # # ][ # # ]: 0 : Get( SID_ATTR_LONG_LRSPACE ) );
291 [ # # ]: 0 : SvxLRSpaceItem aLR(RES_LR_SPACE);
292 [ # # ][ # # ]: 0 : if ( !bSect && (bFrmSelection || nFrmType & FRMTYPE_FLY_ANY) )
[ # # ]
293 : : {
294 [ # # ]: 0 : SwFrmFmt* pFmt = ((SwFrmFmt*)rSh.GetFlyFrmFmt());
295 [ # # ]: 0 : const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED);
296 : :
297 : 0 : sal_Bool bVerticalFrame(sal_False);
298 : : {
299 : : sal_Bool bRTL;
300 : : sal_Bool bVertL2R;
301 : : bVerticalFrame = ( bFrmSelection &&
302 [ # # ]: 0 : rSh.IsFrmVertical(sal_True, bRTL, bVertL2R) ) ||
303 [ # # ][ # # ]: 0 : ( !bFrmSelection && bVerticalWriting);
[ # # ][ # # ]
304 : : }
305 : : long nDeltaX = bVerticalFrame ?
306 : 0 : rRect.Right() - rPageRect.Right() + aLongLR.GetRight() :
307 [ # # ]: 0 : rPageRect.Left() + aLongLR.GetLeft() - rRect.Left();
308 : :
309 : 0 : SfxItemSet aSet( GetPool(), RES_FRM_SIZE, RES_FRM_SIZE,
310 : : RES_VERT_ORIENT, RES_HORI_ORIENT,
311 [ # # ]: 0 : RES_COL, RES_COL, 0 );
312 : :
313 [ # # ]: 0 : if(bVerticalFrame)
314 : : {
315 [ # # ][ # # ]: 0 : SwFmtVertOrient aVertOrient(pFmt->GetVertOrient());
316 : 0 : aVertOrient.SetVertOrient(text::VertOrientation::NONE);
317 : 0 : aVertOrient.SetPos(aVertOrient.GetPos() + nDeltaX );
318 [ # # ][ # # ]: 0 : aSet.Put( aVertOrient );
319 : : }
320 : : else
321 : : {
322 [ # # ][ # # ]: 0 : SwFmtHoriOrient aHoriOrient( pFmt->GetHoriOrient() );
323 : 0 : aHoriOrient.SetHoriOrient( text::HoriOrientation::NONE );
324 : 0 : aHoriOrient.SetPos( aHoriOrient.GetPos() + nDeltaX );
325 [ # # ][ # # ]: 0 : aSet.Put( aHoriOrient );
326 : : }
327 : :
328 [ # # ][ # # ]: 0 : SwFmtFrmSize aSize( pFmt->GetFrmSize() );
329 : 0 : long nOldWidth = (long) aSize.GetWidth();
330 : :
331 [ # # ]: 0 : if(aSize.GetWidthPercent())
332 : : {
333 : 0 : SwRect aRect;
334 [ # # ]: 0 : rSh.CalcBoundRect(aRect, FLY_AS_CHAR);
335 : 0 : long nPrtWidth = aRect.Width();
336 : 0 : aSize.SetWidthPercent(sal_uInt8((nPageWidth - aLongLR.GetLeft() - aLongLR.GetRight()) * 100 /nPrtWidth));
337 : : }
338 : : else
339 : : aSize.SetWidth( nPageWidth -
340 : 0 : (aLongLR.GetLeft() + aLongLR.GetRight()));
341 : :
342 [ # # ]: 0 : if( nFrmType & FRMTYPE_COLUMN )
343 : : {
344 [ # # ][ # # ]: 0 : SwFmtCol aCol(pFmt->GetCol());
345 : :
346 [ # # ]: 0 : ::ResizeFrameCols(aCol, nOldWidth, (long)aSize.GetWidth(), nDeltaX );
347 [ # # ][ # # ]: 0 : aSet.Put(aCol);
348 : : }
349 : :
350 [ # # ]: 0 : aSet.Put( aSize );
351 : :
352 [ # # ]: 0 : rSh.StartAction();
353 [ # # ]: 0 : rSh.Push();
354 [ # # ]: 0 : rSh.SetFlyFrmAttr( aSet );
355 : : //die Rahmenselektion wieder aufheben
356 [ # # ][ # # ]: 0 : if(!bFrmSelection && rSh.IsFrmSelected())
[ # # ][ # # ]
357 : : {
358 [ # # ]: 0 : rSh.UnSelectFrm();
359 [ # # ]: 0 : rSh.LeaveSelFrmMode();
360 : : }
361 [ # # ]: 0 : rSh.Pop();
362 [ # # ][ # # ]: 0 : rSh.EndAction();
[ # # ]
363 : : }
364 [ # # ]: 0 : else if ( nFrmType & ( FRMTYPE_HEADER | FRMTYPE_FOOTER ))
365 : : {
366 : : // Seitenraender rausrechnen
367 [ # # ]: 0 : long nOld = rDesc.GetMaster().GetLRSpace().GetLeft();
368 [ # # ]: 0 : aLongLR.SetLeft( nOld > aLongLR.GetLeft() ? 0 : aLongLR.GetLeft() - nOld );
369 : :
370 [ # # ]: 0 : nOld = rDesc.GetMaster().GetLRSpace().GetRight();
371 [ # # ]: 0 : aLongLR.SetRight( nOld > (sal_uInt16)aLongLR.GetRight() ? 0 : aLongLR.GetRight() - nOld );
372 : 0 : aLR.SetLeft((sal_uInt16)aLongLR.GetLeft());
373 : 0 : aLR.SetRight((sal_uInt16)aLongLR.GetRight());
374 : :
375 [ # # ][ # # ]: 0 : if ( nFrmType & FRMTYPE_HEADER && pHeaderFmt )
376 [ # # ]: 0 : pHeaderFmt->SetFmtAttr( aLR );
377 [ # # ][ # # ]: 0 : else if( nFrmType & FRMTYPE_FOOTER && pFooterFmt )
378 [ # # ]: 0 : pFooterFmt->SetFmtAttr( aLR );
379 : : }
380 [ # # ]: 0 : else if( nFrmType == FRMTYPE_DRAWOBJ)
381 : : {
382 [ # # ]: 0 : SwRect aRect( rSh.GetObjRect() );
383 : 0 : aRect.Left( aLongLR.GetLeft() + rPageRect.Left() );
384 : 0 : aRect.Right( rPageRect.Right() - aLongLR.GetRight());
385 [ # # ]: 0 : rSh.SetObjRect( aRect );
386 : : }
387 [ # # ][ # # ]: 0 : else if(bSect || rSh.IsDirectlyInSection())
[ # # ][ # # ]
388 : : {
389 : : //change the section indents and the columns if available
390 : : //at first determine the changes
391 [ # # ]: 0 : SwRect aSectRect = rSh.GetAnyCurRect(RECT_SECTION_PRT, 0);
392 [ # # ]: 0 : const SwRect aTmpRect = rSh.GetAnyCurRect(RECT_SECTION, 0);
393 : 0 : aSectRect.Pos() += aTmpRect.Pos();
394 : 0 : long nLeftDiff = aLongLR.GetLeft() - (long)(aSectRect.Left() - rPageRect.Left() );
395 : 0 : long nRightDiff = aLongLR.GetRight() - (long)( rPageRect.Right() - aSectRect.Right());
396 : : //change the LRSpaceItem of the section accordingly
397 [ # # ]: 0 : const SwSection* pCurrSect = rSh.GetCurrSection();
398 : 0 : const SwSectionFmt* pSectFmt = pCurrSect->GetFmt();
399 [ # # ][ # # ]: 0 : SvxLRSpaceItem aLRTmp = pSectFmt->GetLRSpace();
400 : 0 : aLRTmp.SetLeft(aLRTmp.GetLeft() + nLeftDiff);
401 : 0 : aLRTmp.SetRight(aLRTmp.GetRight() + nRightDiff);
402 [ # # ][ # # ]: 0 : SfxItemSet aSet(rSh.GetAttrPool(), RES_LR_SPACE, RES_LR_SPACE, RES_COL, RES_COL, 0L);
403 [ # # ]: 0 : aSet.Put(aLRTmp);
404 : : //change the first/last column
405 [ # # ]: 0 : if(bSect)
406 : : {
407 [ # # ][ # # ]: 0 : SwFmtCol aCols( pSectFmt->GetCol() );
408 : 0 : long nDiffWidth = nLeftDiff + nRightDiff;
409 [ # # ]: 0 : ::ResizeFrameCols(aCols, aSectRect.Width(), aSectRect.Width() - nDiffWidth, nLeftDiff );
410 [ # # ][ # # ]: 0 : aSet.Put( aCols );
411 : : }
412 [ # # ]: 0 : SwSectionData aData(*pCurrSect);
413 [ # # ][ # # ]: 0 : rSh.UpdateSection(rSh.GetSectionFmtPos(*pSectFmt), aData, &aSet);
[ # # ][ # # ]
[ # # ]
414 : : }
415 : : else
416 : : { // Seitenraender einstellen
417 : 0 : aLR.SetLeft((sal_uInt16)aLongLR.GetLeft());
418 : 0 : aLR.SetRight((sal_uInt16)aLongLR.GetRight());
419 [ # # ]: 0 : SwapPageMargin( rDesc, aLR );
420 [ # # ]: 0 : SwPageDesc aDesc( rDesc );
421 [ # # ]: 0 : aDesc.GetMaster().SetFmtAttr( aLR );
422 [ # # ][ # # ]: 0 : rSh.ChgPageDesc( nDescId, aDesc );
423 [ # # ][ # # ]: 0 : }
424 : : }
425 : 0 : break;
426 : : case SID_ATTR_LONG_ULSPACE:
427 : : {
428 : 0 : SvxLongULSpaceItem aLongULSpace( (const SvxLongULSpaceItem&)rReq.GetArgs()->
429 [ # # ][ # # ]: 0 : Get( SID_ATTR_LONG_ULSPACE ));
430 : :
431 [ # # ][ # # ]: 0 : if( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY )
432 : : {
433 [ # # ]: 0 : SwFrmFmt* pFmt = ((SwFrmFmt*)rSh.GetFlyFrmFmt());
434 [ # # ]: 0 : const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED);
435 : 0 : const long nDeltaY = rPageRect.Top() + aLongULSpace.GetUpper() - rRect.Top();
436 : 0 : const long nHeight = nPageHeight - (aLongULSpace.GetUpper() + aLongULSpace.GetLower());
437 : :
438 : 0 : SfxItemSet aSet( GetPool(), RES_FRM_SIZE, RES_FRM_SIZE,
439 [ # # ]: 0 : RES_VERT_ORIENT, RES_HORI_ORIENT, 0 );
440 : : //which of the orientation attributes is to be put depends on the frame's environment
441 : : sal_Bool bRTL;
442 : : sal_Bool bVertL2R;
443 [ # # ][ # # ]: 0 : if ( ( bFrmSelection &&
[ # # ][ # # ]
[ # # ]
444 [ # # ]: 0 : rSh.IsFrmVertical(sal_True, bRTL, bVertL2R ) ) ||
445 : : ( !bFrmSelection && bVerticalWriting ) )
446 : : {
447 [ # # ][ # # ]: 0 : SwFmtHoriOrient aHoriOrient(pFmt->GetHoriOrient());
448 : 0 : aHoriOrient.SetHoriOrient(text::HoriOrientation::NONE);
449 : 0 : aHoriOrient.SetPos(aHoriOrient.GetPos() + nDeltaY );
450 [ # # ][ # # ]: 0 : aSet.Put( aHoriOrient );
451 : : }
452 : : else
453 : : {
454 [ # # ][ # # ]: 0 : SwFmtVertOrient aVertOrient(pFmt->GetVertOrient());
455 : 0 : aVertOrient.SetVertOrient(text::VertOrientation::NONE);
456 : 0 : aVertOrient.SetPos(aVertOrient.GetPos() + nDeltaY );
457 [ # # ][ # # ]: 0 : aSet.Put( aVertOrient );
458 : : }
459 [ # # ][ # # ]: 0 : SwFmtFrmSize aSize(pFmt->GetFrmSize());
460 [ # # ]: 0 : if(aSize.GetHeightPercent())
461 : : {
462 : 0 : SwRect aRect;
463 [ # # ]: 0 : rSh.CalcBoundRect(aRect, FLY_AS_CHAR);
464 : 0 : long nPrtHeight = aRect.Height();
465 : 0 : aSize.SetHeightPercent(sal_uInt8(nHeight * 100 /nPrtHeight));
466 : : }
467 : : else
468 : 0 : aSize.SetHeight(nHeight );
469 : :
470 [ # # ]: 0 : aSet.Put( aSize );
471 [ # # ][ # # ]: 0 : rSh.SetFlyFrmAttr( aSet );
[ # # ]
472 : : }
473 [ # # ]: 0 : else if( nFrmType == FRMTYPE_DRAWOBJ )
474 : : {
475 [ # # ]: 0 : SwRect aRect( rSh.GetObjRect() );
476 : 0 : aRect.Top( aLongULSpace.GetUpper() + rPageRect.Top() );
477 : 0 : aRect.Bottom( rPageRect.Bottom() - aLongULSpace.GetLower() );
478 [ # # ]: 0 : rSh.SetObjRect( aRect ) ;
479 : : }
480 [ # # ][ # # ]: 0 : else if(bVerticalWriting && (bSect || rSh.IsDirectlyInSection()))
[ # # ][ # # ]
[ # # ]
481 : : {
482 : : //change the section indents and the columns if available
483 : : //at first determine the changes
484 [ # # ]: 0 : SwRect aSectRect = rSh.GetAnyCurRect(RECT_SECTION_PRT, 0);
485 [ # # ]: 0 : const SwRect aTmpRect = rSh.GetAnyCurRect(RECT_SECTION, 0);
486 : 0 : aSectRect.Pos() += aTmpRect.Pos();
487 : 0 : const long nLeftDiff = aLongULSpace.GetUpper() - (long)(aSectRect.Top() - rPageRect.Top());
488 : 0 : const long nRightDiff = aLongULSpace.GetLower() - (long)(nPageHeight - aSectRect.Bottom() + rPageRect.Top());
489 : : //change the LRSpaceItem of the section accordingly
490 [ # # ]: 0 : const SwSection* pCurrSect = rSh.GetCurrSection();
491 : 0 : const SwSectionFmt* pSectFmt = pCurrSect->GetFmt();
492 [ # # ][ # # ]: 0 : SvxLRSpaceItem aLR = pSectFmt->GetLRSpace();
493 : 0 : aLR.SetLeft(aLR.GetLeft() + nLeftDiff);
494 : 0 : aLR.SetRight(aLR.GetRight() + nRightDiff);
495 [ # # ][ # # ]: 0 : SfxItemSet aSet(rSh.GetAttrPool(), RES_LR_SPACE, RES_LR_SPACE, RES_COL, RES_COL, 0L);
496 [ # # ]: 0 : aSet.Put(aLR);
497 : : //change the first/last column
498 [ # # ]: 0 : if(bSect)
499 : : {
500 [ # # ][ # # ]: 0 : SwFmtCol aCols( pSectFmt->GetCol() );
501 : 0 : long nDiffWidth = nLeftDiff + nRightDiff;
502 [ # # ]: 0 : ::ResizeFrameCols(aCols, aSectRect.Height(), aSectRect.Height() - nDiffWidth, nLeftDiff );
503 [ # # ][ # # ]: 0 : aSet.Put( aCols );
504 : : }
505 [ # # ]: 0 : SwSectionData aData(*pCurrSect);
506 [ # # ][ # # ]: 0 : rSh.UpdateSection(rSh.GetSectionFmtPos(*pSectFmt), aData, &aSet);
[ # # ][ # # ]
[ # # ]
507 : : }
508 : : else
509 [ # # ]: 0 : { SwPageDesc aDesc( rDesc );
510 : :
511 [ # # ]: 0 : if ( nFrmType & ( FRMTYPE_HEADER | FRMTYPE_FOOTER ))
512 : : {
513 : :
514 [ # # ]: 0 : const sal_Bool bHead = nFrmType & FRMTYPE_HEADER ? sal_True : sal_False;
515 [ # # ][ # # ]: 0 : SvxULSpaceItem aUL( rDesc.GetMaster().GetULSpace() );
516 [ # # ]: 0 : if ( bHead )
517 : 0 : aUL.SetUpper( (sal_uInt16)aLongULSpace.GetUpper() );
518 : : else
519 : 0 : aUL.SetLower( (sal_uInt16)aLongULSpace.GetLower() );
520 [ # # ]: 0 : aDesc.GetMaster().SetFmtAttr( aUL );
521 : :
522 [ # # ][ # # ]: 0 : if( (bHead && pHeaderFmt) || (!bHead && pFooterFmt) )
[ # # ][ # # ]
523 : : {
524 : 0 : SwFmtFrmSize aSz( bHead ? pHeaderFmt->GetFrmSize() :
525 [ # # ][ # # ]: 0 : pFooterFmt->GetFrmSize() );
[ # # ][ # # ]
526 : 0 : aSz.SetHeightSizeType( ATT_FIX_SIZE );
527 : 0 : aSz.SetHeight(nPageHeight - aLongULSpace.GetLower() -
528 : 0 : aLongULSpace.GetUpper() );
529 [ # # ]: 0 : if ( bHead )
530 [ # # ]: 0 : pHeaderFmt->SetFmtAttr( aSz );
531 : : else
532 [ # # ][ # # ]: 0 : pFooterFmt->SetFmtAttr( aSz );
533 [ # # ]: 0 : }
534 : : }
535 : : else
536 : : {
537 [ # # ]: 0 : SvxULSpaceItem aUL(RES_UL_SPACE);
538 : 0 : aUL.SetUpper((sal_uInt16)aLongULSpace.GetUpper());
539 : 0 : aUL.SetLower((sal_uInt16)aLongULSpace.GetLower());
540 [ # # ][ # # ]: 0 : aDesc.GetMaster().SetFmtAttr(aUL);
541 : : }
542 : :
543 [ # # ][ # # ]: 0 : rSh.ChgPageDesc( nDescId, aDesc );
544 [ # # ]: 0 : }
545 : : }
546 : 0 : break;
547 : : case SID_ATTR_TABSTOP_VERTICAL:
548 : : case SID_ATTR_TABSTOP:
549 : : {
550 [ # # ]: 0 : sal_uInt16 nWhich = GetPool().GetWhich(nSlot);
551 : 0 : SvxTabStopItem aTabStops( (const SvxTabStopItem&)rReq.GetArgs()->
552 [ # # ][ # # ]: 0 : Get( nWhich ));
553 : 0 : aTabStops.SetWhich(RES_PARATR_TABSTOP);
554 : : const SvxTabStopItem& rDefTabs =
555 [ # # ]: 0 : (const SvxTabStopItem&)rSh.GetDefault(RES_PARATR_TABSTOP);
556 : :
557 : : // Default-Tab an Pos 0
558 [ # # ]: 0 : SfxItemSet aSet( GetPool(), RES_LR_SPACE, RES_LR_SPACE );
559 [ # # ]: 0 : rSh.GetCurAttr( aSet );
560 [ # # ]: 0 : const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&)aSet.Get(RES_LR_SPACE);
561 : :
562 [ # # ]: 0 : if ( rLR.GetTxtFirstLineOfst() < 0 )
563 : : {
564 [ # # ]: 0 : SvxTabStop aSwTabStop( 0, SVX_TAB_ADJUST_DEFAULT );
565 [ # # ]: 0 : aTabStops.Insert( aSwTabStop );
566 : : }
567 : :
568 : : // auffuellen mit Default-Tabs
569 [ # # ]: 0 : sal_uInt16 nDef = ::GetTabDist( rDefTabs );
570 [ # # ]: 0 : ::MakeDefTabs( nDef, aTabStops );
571 : :
572 [ # # ]: 0 : SwTxtFmtColl* pColl = rSh.GetCurTxtFmtColl();
573 [ # # ][ # # ]: 0 : if( pColl && pColl->IsAutoUpdateFmt() )
[ # # ]
574 : : {
575 [ # # ]: 0 : SfxItemSet aTmp(GetPool(), RES_PARATR_TABSTOP, RES_PARATR_TABSTOP);
576 [ # # ]: 0 : aTmp.Put(aTabStops);
577 [ # # ][ # # ]: 0 : rSh.AutoUpdatePara( pColl, aTmp );
578 : : }
579 : : else
580 [ # # ]: 0 : rSh.SetAttr( aTabStops );
581 [ # # ][ # # ]: 0 : break;
582 : : }
583 : : case SID_ATTR_PARA_LRSPACE_VERTICAL:
584 : : case SID_ATTR_PARA_LRSPACE:
585 : : {
586 : : SvxLRSpaceItem aParaMargin((const SvxLRSpaceItem&)rReq.
587 [ # # ][ # # ]: 0 : GetArgs()->Get(nSlot));
588 : :
589 : 0 : aParaMargin.SetRight( aParaMargin.GetRight() - nRightBorderDistance );
590 [ # # ]: 0 : aParaMargin.SetTxtLeft(aParaMargin.GetTxtLeft() - nLeftBorderDistance );
591 : :
592 : 0 : aParaMargin.SetWhich( RES_LR_SPACE );
593 [ # # ]: 0 : SwTxtFmtColl* pColl = rSh.GetCurTxtFmtColl();
594 : :
595 : : // #i23726#
596 [ # # ]: 0 : if (pNumRuleNodeFromDoc)
597 : : {
598 : : // --> #i42922# Mouse move of numbering label
599 : : // has to consider the left indent of the paragraph
600 [ # # ]: 0 : SfxItemSet aSet( GetPool(), RES_LR_SPACE, RES_LR_SPACE );
601 [ # # ]: 0 : rSh.GetCurAttr( aSet );
602 : : const SvxLRSpaceItem& rLR =
603 [ # # ]: 0 : static_cast<const SvxLRSpaceItem&>(aSet.Get(RES_LR_SPACE));
604 : :
605 [ # # ]: 0 : SwPosition aPos(*pNumRuleNodeFromDoc);
606 : : // #i90078#
607 [ # # ]: 0 : rSh.SetIndent( static_cast< short >(aParaMargin.GetTxtLeft() - rLR.GetTxtLeft()), aPos);
608 : : // #i42921# invalidate state of indent in order to get a ruler update.
609 : 0 : aParaMargin.SetWhich( nSlot );
610 [ # # ][ # # ]: 0 : GetViewFrame()->GetBindings().SetState( aParaMargin );
[ # # ]
611 : : }
612 [ # # ][ # # ]: 0 : else if( pColl && pColl->IsAutoUpdateFmt() )
[ # # ]
613 : : {
614 [ # # ]: 0 : SfxItemSet aSet(GetPool(), RES_LR_SPACE, RES_LR_SPACE);
615 [ # # ]: 0 : aSet.Put(aParaMargin);
616 [ # # ][ # # ]: 0 : rSh.AutoUpdatePara( pColl, aSet);
617 : : }
618 : : else
619 [ # # ]: 0 : rSh.SetAttr( aParaMargin );
620 : :
621 [ # # ]: 0 : if ( aParaMargin.GetTxtFirstLineOfst() < 0 )
622 : : {
623 [ # # ]: 0 : SfxItemSet aSet( GetPool(), RES_PARATR_TABSTOP, RES_PARATR_TABSTOP );
624 : :
625 [ # # ]: 0 : rSh.GetCurAttr( aSet );
626 [ # # ]: 0 : const SvxTabStopItem& rTabStops = (const SvxTabStopItem&)aSet.Get(RES_PARATR_TABSTOP);
627 : :
628 : : // Haben wir einen Tab an Stelle Null
629 : : sal_uInt16 i;
630 : :
631 [ # # ]: 0 : for ( i = 0; i < rTabStops.Count(); ++i )
632 [ # # ][ # # ]: 0 : if ( rTabStops[i].GetTabPos() == 0 )
633 : 0 : break;
634 : :
635 [ # # ]: 0 : if ( i >= rTabStops.Count() )
636 : : {
637 : : // Kein DefTab
638 [ # # ]: 0 : SvxTabStopItem aTabStops( RES_PARATR_TABSTOP );
639 [ # # ]: 0 : aTabStops = rTabStops;
640 : :
641 [ # # ]: 0 : ::lcl_EraseDefTabs(aTabStops);
642 : :
643 [ # # ]: 0 : SvxTabStop aSwTabStop( 0, SVX_TAB_ADJUST_DEFAULT );
644 [ # # ]: 0 : aTabStops.Insert(aSwTabStop);
645 : :
646 : : const SvxTabStopItem& rDefTabs =
647 [ # # ]: 0 : (const SvxTabStopItem&)rSh.GetDefault(RES_PARATR_TABSTOP);
648 [ # # ]: 0 : sal_uInt16 nDef = ::GetTabDist(rDefTabs);
649 [ # # ]: 0 : ::MakeDefTabs( nDef, aTabStops );
650 : :
651 [ # # ][ # # ]: 0 : if( pColl && pColl->IsAutoUpdateFmt())
[ # # ]
652 : : {
653 [ # # ]: 0 : SfxItemSet aSetTmp(GetPool(), RES_PARATR_TABSTOP, RES_PARATR_TABSTOP);
654 [ # # ]: 0 : aSetTmp.Put(aTabStops);
655 [ # # ][ # # ]: 0 : rSh.AutoUpdatePara( pColl, aSetTmp );
656 : : }
657 : : else
658 [ # # ][ # # ]: 0 : rSh.SetAttr( aTabStops );
659 [ # # ]: 0 : }
660 [ # # ]: 0 : }
661 : : }
662 : 0 : break;
663 : : case SID_RULER_BORDERS_VERTICAL:
664 : : case SID_RULER_BORDERS:
665 : : {
666 : : SvxColumnItem aColItem((const SvxColumnItem&)rReq.
667 [ # # ][ # # ]: 0 : GetArgs()->Get(nSlot));
668 : :
669 [ # # ][ # # ]: 0 : if( bSetTabColFromDoc || (!bSect && rSh.GetTableFmt()) )
[ # # ][ # # ]
[ # # ]
670 : : {
671 : : OSL_ENSURE(aColItem.Count(), "ColDesc is empty!!");
672 : :
673 : : const sal_Bool bSingleLine = ((const SfxBoolItem&)rReq.
674 [ # # ]: 0 : GetArgs()->Get(SID_RULER_ACT_LINE_ONLY)).GetValue();
675 : :
676 [ # # ]: 0 : SwTabCols aTabCols;
677 [ # # ]: 0 : if ( bSetTabColFromDoc )
678 [ # # ]: 0 : rSh.GetMouseTabCols( aTabCols, aTabColFromDocPos );
679 : : else
680 [ # # ]: 0 : rSh.GetTabCols(aTabCols);
681 : :
682 : : // linker Tabellenrand
683 : 0 : long nBorder = (long)(aColItem.GetLeft() - aTabCols.GetLeftMin());
684 : 0 : aTabCols.SetLeft( nBorder );
685 : :
686 [ # # ]: 0 : nBorder = (bVerticalWriting ? nPageHeight : nPageWidth) - aTabCols.GetLeftMin() - aColItem.GetRight();
687 : :
688 [ # # ]: 0 : if ( aColItem.GetRight() > 0 )
689 : 0 : aTabCols.SetRight( nBorder );
690 : :
691 : : // Tabcols der Reihe nach
692 : : // Die letzte Col wird durch den Rand definiert
693 : : //columns in right-to-left tables need to be mirrored
694 : : sal_Bool bIsTableRTL =
695 : 0 : IsTabColFromDoc() ?
696 : 0 : rSh.IsMouseTableRightToLeft(aTabColFromDocPos)
697 [ # # ][ # # ]: 0 : : rSh.IsTableRightToLeft();
[ # # ]
698 [ # # ]: 0 : if(bIsTableRTL)
699 : : {
700 : 0 : sal_uInt16 nColCount = aColItem.Count() - 1;
701 [ # # ][ # # ]: 0 : for ( sal_uInt16 i = 0; i < nColCount && i < aTabCols.Count(); ++i )
[ # # ][ # # ]
702 : : {
703 [ # # ]: 0 : const SvxColumnDescription& rCol = aColItem[nColCount - i];
704 [ # # ]: 0 : aTabCols[i] = aTabCols.GetRight() - rCol.nStart;
705 [ # # ]: 0 : aTabCols.SetHidden( i, !rCol.bVisible );
706 : : }
707 : : }
708 : : else
709 : : {
710 [ # # ][ # # ]: 0 : for ( sal_uInt16 i = 0; i < aColItem.Count()-1 && i < aTabCols.Count(); ++i )
[ # # ][ # # ]
711 : : {
712 [ # # ]: 0 : const SvxColumnDescription& rCol = aColItem[i];
713 [ # # ]: 0 : aTabCols[i] = rCol.nEnd + aTabCols.GetLeft();
714 [ # # ]: 0 : aTabCols.SetHidden( i, !rCol.bVisible );
715 : : }
716 : : }
717 : :
718 [ # # ]: 0 : if ( bSetTabColFromDoc )
719 : : {
720 [ # # ]: 0 : if( !rSh.IsViewLocked() )
721 : : {
722 : 0 : bUnlockView = sal_True;
723 : 0 : rSh.LockView( sal_True );
724 : : }
725 : : rSh.SetMouseTabCols( aTabCols, bSingleLine,
726 [ # # ]: 0 : aTabColFromDocPos );
727 : : }
728 : : else
729 [ # # ]: 0 : rSh.SetTabCols(aTabCols, bSingleLine);
730 : :
731 : : }
732 : : else
733 : : {
734 [ # # ][ # # ]: 0 : if ( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY || bSect)
[ # # ]
735 : : {
736 : 0 : SwSectionFmt *pSectFmt = 0;
737 [ # # ]: 0 : SfxItemSet aSet( GetPool(), RES_COL, RES_COL );
738 [ # # ]: 0 : if(bSect)
739 : : {
740 [ # # ]: 0 : const SwSection *pSect = rSh.GetAnySection();
741 : : OSL_ENSURE( pSect, "Which section?");
742 : 0 : pSectFmt = pSect->GetFmt();
743 : : }
744 : : else
745 : : {
746 [ # # ]: 0 : rSh.GetFlyFrmAttr( aSet );
747 : : }
748 : : SwFmtCol aCols(
749 : : bSect ?
750 : 0 : pSectFmt->GetCol() :
751 [ # # ][ # # ]: 0 : (const SwFmtCol&)aSet.Get( RES_COL, sal_False ));
[ # # ][ # # ]
752 [ # # ][ # # ]: 0 : SwRect aCurRect = rSh.GetAnyCurRect(bSect ? RECT_SECTION_PRT : RECT_FLY_PRT_EMBEDDED);
753 [ # # ]: 0 : const long lWidth = bVerticalWriting ? aCurRect.Height() : aCurRect.Width();
754 [ # # ]: 0 : ::lcl_ConvertToCols( aColItem, sal_uInt16(lWidth), aCols );
755 [ # # ]: 0 : aSet.Put( aCols );
756 [ # # ]: 0 : if(bSect)
757 [ # # ]: 0 : rSh.SetSectionAttr( aSet, pSectFmt );
758 : : else
759 : : {
760 [ # # ]: 0 : rSh.StartAction();
761 [ # # ]: 0 : rSh.Push();
762 [ # # ]: 0 : rSh.SetFlyFrmAttr( aSet );
763 : : //die Rahmenselektion wieder aufheben
764 [ # # ][ # # ]: 0 : if(!bFrmSelection && rSh.IsFrmSelected())
[ # # ][ # # ]
765 : : {
766 [ # # ]: 0 : rSh.UnSelectFrm();
767 [ # # ]: 0 : rSh.LeaveSelFrmMode();
768 : : }
769 [ # # ]: 0 : rSh.Pop();
770 [ # # ]: 0 : rSh.EndAction();
771 [ # # ][ # # ]: 0 : }
772 : : }
773 : : else
774 : : {
775 [ # # ][ # # ]: 0 : SwFmtCol aCols( rDesc.GetMaster().GetCol() );
776 [ # # ]: 0 : const SwRect aPrtRect = rSh.GetAnyCurRect(RECT_PAGE_PRT);
777 : : ::lcl_ConvertToCols( aColItem,
778 : 0 : sal_uInt16(bVerticalWriting ? aPrtRect.Height() : aPrtRect.Width()),
779 [ # # ][ # # ]: 0 : aCols );
780 [ # # ]: 0 : SwPageDesc aDesc( rDesc );
781 [ # # ]: 0 : aDesc.GetMaster().SetFmtAttr( aCols );
782 [ # # ][ # # ]: 0 : rSh.ChgPageDesc( rSh.GetCurPageDesc(), aDesc );
[ # # ][ # # ]
783 : : }
784 [ # # ]: 0 : }
785 : : }
786 : 0 : break;
787 : :
788 : : case SID_RULER_ROWS :
789 : : case SID_RULER_ROWS_VERTICAL:
790 : : {
791 : : SvxColumnItem aColItem((const SvxColumnItem&)rReq.
792 [ # # ][ # # ]: 0 : GetArgs()->Get(nSlot));
793 : :
794 [ # # ][ # # ]: 0 : if( bSetTabColFromDoc || (!bSect && rSh.GetTableFmt()) )
[ # # ][ # # ]
[ # # ]
795 : : {
796 : : OSL_ENSURE(aColItem.Count(), "ColDesc is empty!!");
797 : :
798 [ # # ]: 0 : SwTabCols aTabCols;
799 [ # # ]: 0 : if ( bSetTabRowFromDoc )
800 [ # # ]: 0 : rSh.GetMouseTabRows( aTabCols, aTabColFromDocPos );
801 : : else
802 [ # # ]: 0 : rSh.GetTabRows(aTabCols);
803 : :
804 [ # # ]: 0 : if ( bVerticalWriting )
805 : : {
806 : 0 : aTabCols.SetRight(nPageWidth - aColItem.GetRight() - aColItem.GetLeft());
807 : 0 : aTabCols.SetLeftMin(aColItem.GetLeft());
808 : : }
809 : : else
810 : : {
811 : 0 : long nBorder = nPageHeight - aTabCols.GetLeftMin() - aColItem.GetRight();
812 : 0 : aTabCols.SetRight( nBorder );
813 : : }
814 : :
815 [ # # ]: 0 : if(bVerticalWriting)
816 : : {
817 [ # # ]: 0 : for ( sal_uInt16 i = aColItem.Count() - 1; i; --i )
818 : : {
819 [ # # ]: 0 : const SvxColumnDescription& rCol = aColItem[i - 1];
820 : 0 : long nColumnPos = aTabCols.GetRight() - rCol.nEnd ;
821 [ # # ]: 0 : aTabCols[i - 1] = nColumnPos;
822 [ # # ]: 0 : aTabCols.SetHidden( i - 1, !rCol.bVisible );
823 : : }
824 : : }
825 : : else
826 : : {
827 [ # # ]: 0 : for ( sal_uInt16 i = 0; i < aColItem.Count()-1; ++i )
828 : : {
829 [ # # ]: 0 : const SvxColumnDescription& rCol = aColItem[i];
830 [ # # ]: 0 : aTabCols[i] = rCol.nEnd + aTabCols.GetLeft();
831 [ # # ]: 0 : aTabCols.SetHidden( i, !rCol.bVisible );
832 : : }
833 : : }
834 : 0 : sal_Bool bSingleLine = sal_False;
835 : : const SfxPoolItem* pSingleLine;
836 [ # # ][ # # ]: 0 : if( SFX_ITEM_SET == rReq.GetArgs()->GetItemState(SID_RULER_ACT_LINE_ONLY, sal_False, &pSingleLine))
837 : 0 : bSingleLine = ((const SfxBoolItem*)pSingleLine)->GetValue();
838 [ # # ]: 0 : if ( bSetTabRowFromDoc )
839 : : {
840 [ # # ]: 0 : if( !rSh.IsViewLocked() )
841 : : {
842 : 0 : bUnlockView = sal_True;
843 : 0 : rSh.LockView( sal_True );
844 : : }
845 [ # # ]: 0 : rSh.SetMouseTabRows( aTabCols, bSingleLine, aTabColFromDocPos );
846 : : }
847 : : else
848 [ # # ]: 0 : rSh.SetTabRows(aTabCols, bSingleLine);
849 [ # # ]: 0 : }
850 : : }
851 : 0 : break;
852 : :
853 : : default:
854 : : OSL_ENSURE( !this, "wrong SlotId");
855 : : }
856 : 0 : rSh.EndAllAction();
857 : :
858 [ # # ]: 0 : if( bUnlockView )
859 : 0 : rSh.LockView( sal_False );
860 : :
861 : 0 : bSetTabColFromDoc = bSetTabRowFromDoc = bTabColFromDoc = bTabRowFromDoc = sal_False;
862 : 0 : SetNumRuleNodeFromDoc(NULL);
863 : 0 : }
864 : :
865 : : /*--------------------------------------------------------------------
866 : : Beschreibung: Hier wird der Status der Tableiste ermittelt
867 : : sprich alle relevanten Attribute an der CursorPos
868 : : werden der Tableiste uebermittelt
869 : : --------------------------------------------------------------------*/
870 : 692 : void SwView::StateTabWin(SfxItemSet& rSet)
871 : : {
872 : 692 : SwWrtShell &rSh = GetWrtShell();
873 : :
874 [ - + ][ + - ]: 692 : const Point* pPt = IsTabColFromDoc() || IsTabRowFromDoc() ? &aTabColFromDocPos : 0;
875 [ + - ]: 692 : const sal_uInt16 nFrmType = rSh.IsObjSelected()
876 : : ? FRMTYPE_DRAWOBJ
877 [ + - ][ + - ]: 692 : : rSh.GetFrmType( pPt, sal_True );
878 : :
879 [ + - ]: 692 : const sal_Bool bFrmSelection = rSh.IsFrmSelected();
880 : 692 : const sal_Bool bBrowse = rSh.GetViewOptions()->getBrowseMode();
881 : : // PageOffset/Begrenzer
882 [ + - ]: 692 : const SwRect& rPageRect = rSh.GetAnyCurRect( RECT_PAGE, pPt );
883 [ + - ]: 692 : const SwRect& rPagePrtRect = rSh.GetAnyCurRect( RECT_PAGE_PRT, pPt );
884 : 692 : const long nPageWidth = rPageRect.Width();
885 : 692 : const long nPageHeight = rPageRect.Height();
886 : :
887 : : const SwPageDesc& rDesc = rSh.GetPageDesc(
888 : 692 : IsTabColFromDoc() || bTabRowFromDoc ?
889 [ - + ][ # # ]: 692 : rSh.GetMousePageDesc(aTabColFromDocPos) : rSh.GetCurPageDesc() );
[ + - ][ + - ]
[ + - ]
890 : :
891 [ + - ]: 692 : const SvxFrameDirectionItem& rFrameDir = rDesc.GetMaster().GetFrmDir();
892 [ + - ]: 692 : const sal_Bool bVerticalWriting = rSh.IsInVerticalText();
893 : :
894 : : //enable tab stop display on the rulers depending on the writing direction
895 : 692 : WinBits nRulerStyle = pHRuler->GetStyle() & ~WB_EXTRAFIELD;
896 [ + + ][ + - ]: 692 : pHRuler->SetStyle(bVerticalWriting||bBrowse ? nRulerStyle : nRulerStyle|WB_EXTRAFIELD);
[ + - ]
897 : 692 : nRulerStyle = pVRuler->GetStyle() & ~WB_EXTRAFIELD;
898 [ + - ][ - + ]: 692 : pVRuler->SetStyle(bVerticalWriting ? nRulerStyle|WB_EXTRAFIELD : nRulerStyle);
899 : :
900 : : //#i24363# tab stops relative to indent
901 [ + - ][ + - ]: 692 : bool bRelative = rSh.getIDocumentSettingAccess()->get(IDocumentSettingAccess::TABS_RELATIVE_TO_INDENT);
902 [ + - ]: 692 : pHRuler->SetTabsRelativeToIndent( bRelative );
903 [ + - ]: 692 : pVRuler->SetTabsRelativeToIndent( bRelative );
904 : :
905 [ + - ][ + - ]: 692 : SvxLRSpaceItem aPageLRSpace( rDesc.GetMaster().GetLRSpace() );
906 [ + - ]: 692 : SwapPageMargin( rDesc, aPageLRSpace );
907 : :
908 : 692 : SfxItemSet aCoreSet( GetPool(), RES_PARATR_TABSTOP, RES_PARATR_TABSTOP,
909 [ + - ]: 692 : RES_LR_SPACE, RES_UL_SPACE, 0 );
910 : : // get also the list level indent values merged as LR-SPACE item, if needed.
911 [ + - ]: 692 : rSh.GetCurAttr( aCoreSet, true );
912 [ + - ]: 692 : SelectionType nSelType = rSh.GetSelectionType();
913 : :
914 [ + - ]: 692 : SfxWhichIter aIter( rSet );
915 [ + - ]: 692 : sal_uInt16 nWhich = aIter.FirstWhich();
916 : 692 : sal_Bool bPutContentProtection = sal_False;
917 : :
918 [ + + ]: 10958 : while ( nWhich )
919 : : {
920 [ + + + + : 10266 : switch ( nWhich )
+ + + + +
+ + - ]
921 : : {
922 : : case SID_ATTR_LONG_LRSPACE:
923 : : {
924 : : SvxLongLRSpaceItem aLongLR( (long)aPageLRSpace.GetLeft(),
925 : : (long)aPageLRSpace.GetRight(),
926 [ + - ]: 686 : SID_ATTR_LONG_LRSPACE);
927 [ + + ]: 686 : if(bBrowse)
928 : : {
929 : 6 : aLongLR.SetLeft(rPagePrtRect.Left());
930 : 6 : aLongLR.SetRight(nPageWidth - rPagePrtRect.Right());
931 : : }
932 [ + - ][ - + ]: 686 : if ( ( nFrmType & FRMTYPE_HEADER || nFrmType & FRMTYPE_FOOTER ) &&
[ # # ]
933 : 0 : !(nFrmType & FRMTYPE_COLSECT) )
934 : : {
935 : : SwFrmFmt *pFmt = (SwFrmFmt*) (nFrmType & FRMTYPE_HEADER ?
936 [ # # ]: 0 : rDesc.GetMaster().GetHeader().GetHeaderFmt() :
937 [ # # ][ # # ]: 0 : rDesc.GetMaster().GetFooter().GetFooterFmt());
938 [ # # ]: 0 : if( pFmt )// #i80890# if rDesc is not the one belonging to the current page is might crash
939 : : {
940 [ # # ]: 0 : SwRect aRect( rSh.GetAnyCurRect( RECT_HEADERFOOTER, pPt));
941 [ # # ]: 0 : aRect.Pos() -= rSh.GetAnyCurRect( RECT_PAGE, pPt ).Pos();
942 [ # # ]: 0 : const SvxLRSpaceItem& aLR = pFmt->GetLRSpace();
943 : 0 : aLongLR.SetLeft ( (long)aLR.GetLeft() + (long)aRect.Left() );
944 : : aLongLR.SetRight( (nPageWidth -
945 : 0 : (long)aRect.Right() + (long)aLR.GetRight()));
946 : 0 : }
947 : : }
948 : : else
949 : : {
950 : 686 : SwRect aRect;
951 [ + - ][ + - ]: 686 : if( !bFrmSelection && ((nFrmType & FRMTYPE_COLSECT) || rSh.IsDirectlyInSection()) )
[ - + ][ - + ]
[ + - ]
952 : : {
953 [ # # ]: 0 : aRect = rSh.GetAnyCurRect(RECT_SECTION_PRT, pPt);
954 [ # # ]: 0 : const SwRect aTmpRect = rSh.GetAnyCurRect(RECT_SECTION, pPt);
955 : 0 : aRect.Pos() += aTmpRect.Pos();
956 : : }
957 : :
958 [ + - ][ - + ]: 686 : else if ( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY )
959 [ # # ]: 0 : aRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED, pPt);
960 [ - + ]: 686 : else if( nFrmType & FRMTYPE_DRAWOBJ)
961 [ # # ]: 0 : aRect = rSh.GetObjRect();
962 : :
963 [ - + ]: 686 : if( aRect.Width() )
964 : : {
965 : : // PAGES01
966 : : // make relative to page position:
967 : 0 : aLongLR.SetLeft ((long)( aRect.Left() - rPageRect.Left() ));
968 : 686 : aLongLR.SetRight((long)( rPageRect.Right() - aRect.Right()));
969 : : }
970 : : }
971 [ + - ]: 686 : if( nWhich == SID_ATTR_LONG_LRSPACE )
972 [ + - ]: 686 : rSet.Put( aLongLR );
973 : : else
974 : : {
975 : : SvxLRSpaceItem aLR( aLongLR.GetLeft(),
976 : : aLongLR.GetRight(),
977 : : 0, 0,
978 [ # # ]: 0 : nWhich);
979 [ # # ][ # # ]: 0 : rSet.Put(aLR);
980 : : }
981 [ + - ]: 686 : break;
982 : : }
983 : : case SID_ATTR_LONG_ULSPACE:
984 : : {
985 : : // Rand Seite Oben Unten
986 [ + - ][ + - ]: 686 : SvxULSpaceItem aUL( rDesc.GetMaster().GetULSpace() );
987 : 686 : SvxLongULSpaceItem aLongUL( (long)aUL.GetUpper(),
988 : 686 : (long)aUL.GetLower(),
989 [ + - ]: 686 : SID_ATTR_LONG_ULSPACE);
990 : :
991 [ + - ][ - + ]: 686 : if ( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY )
992 : : {
993 : : // Dokumentkoordinaten Frame auf Seitenkoordinaten umbrechen
994 [ # # ]: 0 : const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED, pPt);
995 : 0 : aLongUL.SetUpper((sal_uInt16)(rRect.Top() - rPageRect.Top() ));
996 : 0 : aLongUL.SetLower((sal_uInt16)(rPageRect.Bottom() - rRect.Bottom() ));
997 : : }
998 [ + - ][ - + ]: 686 : else if ( nFrmType & FRMTYPE_HEADER || nFrmType & FRMTYPE_FOOTER )
999 : : {
1000 [ # # ]: 0 : SwRect aRect( rSh.GetAnyCurRect( RECT_HEADERFOOTER, pPt));
1001 [ # # ]: 0 : aRect.Pos() -= rSh.GetAnyCurRect( RECT_PAGE, pPt ).Pos();
1002 : 0 : aLongUL.SetUpper( (sal_uInt16)aRect.Top() );
1003 : 0 : aLongUL.SetLower( (sal_uInt16)(nPageHeight - aRect.Bottom()) );
1004 : : }
1005 [ - + ]: 686 : else if( nFrmType & FRMTYPE_DRAWOBJ)
1006 : : {
1007 [ # # ]: 0 : const SwRect &rRect = rSh.GetObjRect();
1008 : 0 : aLongUL.SetUpper((rRect.Top() - rPageRect.Top()));
1009 : 0 : aLongUL.SetLower((rPageRect.Bottom() - rRect.Bottom()));
1010 : : }
1011 [ + + ]: 686 : else if(bBrowse)
1012 : : {
1013 : 6 : aLongUL.SetUpper(rPagePrtRect.Top());
1014 : 6 : aLongUL.SetLower(nPageHeight - rPagePrtRect.Bottom());
1015 : : }
1016 [ + - ]: 686 : if( nWhich == SID_ATTR_LONG_ULSPACE )
1017 [ + - ]: 686 : rSet.Put( aLongUL );
1018 : : else
1019 : : {
1020 : 0 : SvxULSpaceItem aULTmp((sal_uInt16)aLongUL.GetUpper(),
1021 : 0 : (sal_uInt16)aLongUL.GetLower(),
1022 [ # # ]: 0 : nWhich);
1023 [ # # ][ # # ]: 0 : rSet.Put(aULTmp);
1024 : : }
1025 [ + - ][ + - ]: 686 : break;
1026 : : }
1027 : : case SID_ATTR_TABSTOP_VERTICAL :
1028 : : case RES_PARATR_TABSTOP:
1029 : : {
1030 [ + - ][ + - ]: 5364 : if ( ISA( SwWebView ) ||
[ + + + -
+ - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + + ][ - + ]
[ # # ][ + + ]
1031 : 1340 : IsTabColFromDoc() ||
1032 : 1340 : IsTabRowFromDoc() ||
1033 : : ( nSelType & nsSelectionType::SEL_GRF ) ||
1034 : : ( nSelType & nsSelectionType::SEL_FRM ) ||
1035 : : ( nSelType & nsSelectionType::SEL_OLE ) ||
1036 [ + - ]: 1340 : ( SFX_ITEM_AVAILABLE > aCoreSet.GetItemState(RES_LR_SPACE) ) ||
1037 : : (!bVerticalWriting && (SID_ATTR_TABSTOP_VERTICAL == nWhich) ) ||
1038 : : ( bVerticalWriting && (RES_PARATR_TABSTOP == nWhich))
1039 : : )
1040 [ + - ]: 674 : rSet.DisableItem( nWhich );
1041 : : else
1042 : : {
1043 : : SvxTabStopItem aTabStops((const SvxTabStopItem&)
1044 [ + - ][ + - ]: 670 : aCoreSet.Get( RES_PARATR_TABSTOP ));
1045 : :
1046 : : const SvxTabStopItem& rDefTabs = (const SvxTabStopItem&)
1047 [ + - ]: 670 : rSh.GetDefault(RES_PARATR_TABSTOP);
1048 : :
1049 : : OSL_ENSURE(pHRuler, "why is there no ruler?");
1050 [ + - ]: 670 : long nDefTabDist = ::GetTabDist(rDefTabs);
1051 [ + - ]: 670 : pHRuler->SetDefTabDist( nDefTabDist );
1052 [ + - ]: 670 : pVRuler->SetDefTabDist( nDefTabDist );
1053 [ + - ]: 670 : ::lcl_EraseDefTabs(aTabStops);
1054 [ + - ][ + - ]: 670 : rSet.Put(aTabStops, nWhich);
1055 : : }
1056 : 1344 : break;
1057 : : }
1058 : : case SID_ATTR_PARA_LRSPACE_VERTICAL:
1059 : : case SID_ATTR_PARA_LRSPACE:
1060 : : {
1061 [ + - ][ + - ]: 1372 : if ( nSelType & nsSelectionType::SEL_GRF ||
[ + - ][ + - ]
[ + - ][ + + ]
[ - + ][ # # ]
1062 : : nSelType & nsSelectionType::SEL_FRM ||
1063 : : nSelType & nsSelectionType::SEL_OLE ||
1064 : : nFrmType == FRMTYPE_DRAWOBJ ||
1065 : : (!bVerticalWriting && (SID_ATTR_PARA_LRSPACE_VERTICAL == nWhich)) ||
1066 : : ( bVerticalWriting && (SID_ATTR_PARA_LRSPACE == nWhich))
1067 : : )
1068 : : {
1069 [ + - ]: 686 : rSet.DisableItem(nWhich);
1070 : : }
1071 : : else
1072 : : {
1073 [ + - ]: 686 : SvxLRSpaceItem aLR( RES_LR_SPACE );
1074 [ + - ]: 686 : if ( !IsTabColFromDoc() )
1075 : : {
1076 [ + - ]: 686 : aLR = (const SvxLRSpaceItem&)aCoreSet.Get(RES_LR_SPACE);
1077 : :
1078 : : // #i23726#
1079 [ - + ]: 686 : if (pNumRuleNodeFromDoc)
1080 : : {
1081 : 0 : short nOffset = static_cast< short >(aLR.GetTxtLeft() +
1082 : : // #i42922# Mouse move of numbering label
1083 : : // has to consider the left indent of the paragraph
1084 [ # # ]: 0 : pNumRuleNodeFromDoc->GetLeftMarginWithNum( sal_True ) );
1085 : :
1086 : : short nFLOffset;
1087 [ # # ]: 0 : pNumRuleNodeFromDoc->GetFirstLineOfsWithNum( nFLOffset );
1088 : :
1089 : 0 : aLR.SetLeft( nOffset + nFLOffset );
1090 : : }
1091 : : }
1092 : 686 : aLR.SetWhich(nWhich);
1093 [ + - ][ + - ]: 686 : rSet.Put(aLR);
1094 : : }
1095 : 1372 : break;
1096 : : }
1097 : : case SID_RULER_BORDER_DISTANCE:
1098 : : {
1099 : 686 : nLeftBorderDistance = 0;
1100 : 686 : nRightBorderDistance = 0;
1101 [ + - ][ + - ]: 686 : if ( nSelType & nsSelectionType::SEL_GRF ||
[ + - ][ - + ]
1102 : : nSelType & nsSelectionType::SEL_FRM ||
1103 : : nSelType & nsSelectionType::SEL_OLE ||
1104 : : nFrmType == FRMTYPE_DRAWOBJ )
1105 [ # # ]: 0 : rSet.DisableItem(SID_RULER_BORDER_DISTANCE);
1106 : : else
1107 : : {
1108 [ + - ]: 686 : SvxLRSpaceItem aDistLR(SID_RULER_BORDER_DISTANCE);
1109 [ - + ]: 686 : if(nFrmType & FRMTYPE_FLY_ANY)
1110 : : {
1111 [ # # ]: 0 : if( IsTabColFromDoc() )
1112 : : {
1113 [ # # ]: 0 : const SwRect& rFlyPrtRect = rSh.GetAnyCurRect( RECT_FLY_PRT_EMBEDDED, pPt );
1114 : 0 : aDistLR.SetLeft(rFlyPrtRect.Left());
1115 : 0 : aDistLR.SetRight(rFlyPrtRect.Left());
1116 : : }
1117 : : else
1118 : : {
1119 : 0 : SfxItemSet aCoreSet2( GetPool(),
1120 : : RES_BOX, RES_BOX,
1121 [ # # ]: 0 : SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0 );
1122 [ # # ]: 0 : SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
1123 [ # # ]: 0 : aCoreSet.Put( aBoxInfo );
1124 [ # # ]: 0 : rSh.GetFlyFrmAttr( aCoreSet );
1125 [ # # ]: 0 : const SvxBoxItem& rBox = (const SvxBoxItem&)aCoreSet.Get(RES_BOX);
1126 [ # # ]: 0 : aDistLR.SetLeft((sal_uInt16)rBox.GetDistance(BOX_LINE_LEFT ));
1127 [ # # ]: 0 : aDistLR.SetRight((sal_uInt16)rBox.GetDistance(BOX_LINE_RIGHT));
1128 : :
1129 : : //add the paragraph border distance
1130 : 0 : SfxItemSet aCoreSet1( GetPool(),
1131 : : RES_BOX, RES_BOX,
1132 [ # # ]: 0 : 0 );
1133 [ # # ]: 0 : rSh.GetCurAttr( aCoreSet1 );
1134 [ # # ]: 0 : const SvxBoxItem& rParaBox = (const SvxBoxItem&)aCoreSet1.Get(RES_BOX);
1135 [ # # ]: 0 : aDistLR.SetLeft(aDistLR.GetLeft() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_LEFT ));
1136 [ # # ][ # # ]: 0 : aDistLR.SetRight(aDistLR.GetRight() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_RIGHT));
[ # # ][ # # ]
1137 : : }
1138 [ # # ]: 0 : rSet.Put(aDistLR);
1139 : 0 : nLeftBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetLeft());
1140 : 0 : nRightBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetRight());
1141 : : }
1142 [ + - ][ + + ]: 1372 : else if ( IsTabColFromDoc() ||
[ + - ][ + - ]
[ + + ]
1143 [ + - ]: 686 : ( rSh.GetTableFmt() && !bFrmSelection &&
1144 : 5 : !(nFrmType & FRMTYPE_COLSECT ) ) )
1145 : : {
1146 : 5 : SfxItemSet aCoreSet2( GetPool(),
1147 : : RES_BOX, RES_BOX,
1148 [ + - ]: 5 : SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0 );
1149 [ + - ]: 5 : SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
1150 : 5 : aBoxInfo.SetTable(sal_False);
1151 : 5 : aBoxInfo.SetDist((sal_Bool) sal_True);
1152 [ + - ]: 5 : aCoreSet2.Put(aBoxInfo);
1153 [ + - ]: 5 : rSh.GetTabBorders( aCoreSet2 );
1154 [ + - ]: 5 : const SvxBoxItem& rBox = (const SvxBoxItem&)aCoreSet2.Get(RES_BOX);
1155 [ + - ]: 5 : aDistLR.SetLeft((sal_uInt16)rBox.GetDistance(BOX_LINE_LEFT ));
1156 [ + - ]: 5 : aDistLR.SetRight((sal_uInt16)rBox.GetDistance(BOX_LINE_RIGHT));
1157 : :
1158 : : //add the border distance of the paragraph
1159 [ + - ]: 5 : SfxItemSet aCoreSet1( GetPool(), RES_BOX, RES_BOX );
1160 [ + - ]: 5 : rSh.GetCurAttr( aCoreSet1 );
1161 [ + - ]: 5 : const SvxBoxItem& rParaBox = (const SvxBoxItem&)aCoreSet1.Get(RES_BOX);
1162 [ + - ]: 5 : aDistLR.SetLeft(aDistLR.GetLeft() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_LEFT ));
1163 [ + - ]: 5 : aDistLR.SetRight(aDistLR.GetRight() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_RIGHT));
1164 [ + - ]: 5 : rSet.Put(aDistLR);
1165 : 5 : nLeftBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetLeft());
1166 [ + - ][ + - ]: 5 : nRightBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetRight());
[ + - ]
1167 : : }
1168 [ + - ][ + - ]: 681 : else if ( !rSh.IsDirectlyInSection() )
1169 : : {
1170 : : //get the page/header/footer border distance
1171 : 681 : const SwFrmFmt& rMaster = rDesc.GetMaster();
1172 [ + - ]: 681 : const SvxBoxItem& rBox = (const SvxBoxItem&)rMaster.GetAttrSet().Get(RES_BOX);
1173 [ + - ]: 681 : aDistLR.SetLeft((sal_uInt16)rBox.GetDistance(BOX_LINE_LEFT ));
1174 [ + - ]: 681 : aDistLR.SetRight((sal_uInt16)rBox.GetDistance(BOX_LINE_RIGHT));
1175 : :
1176 : 681 : const SvxBoxItem* pBox = 0;
1177 [ - + ]: 681 : if(nFrmType & FRMTYPE_HEADER)
1178 : : {
1179 [ # # ]: 0 : rMaster.GetHeader();
1180 [ # # ]: 0 : const SwFmtHeader& rHeaderFmt = rMaster.GetHeader();
1181 : 0 : SwFrmFmt *pHeaderFmt = (SwFrmFmt*)rHeaderFmt.GetHeaderFmt();
1182 [ # # ]: 0 : if( pHeaderFmt )// #i80890# if rDesc is not the one belonging to the current page is might crash
1183 [ # # ]: 0 : pBox = & (const SvxBoxItem&)pHeaderFmt->GetBox();
1184 : : }
1185 [ - + ]: 681 : else if(nFrmType & FRMTYPE_FOOTER )
1186 : : {
1187 [ # # ]: 0 : const SwFmtFooter& rFooterFmt = rMaster.GetFooter();
1188 : 0 : SwFrmFmt *pFooterFmt = (SwFrmFmt*)rFooterFmt.GetFooterFmt();
1189 [ # # ]: 0 : if( pFooterFmt )// #i80890# if rDesc is not the one belonging to the current page is might crash
1190 [ # # ]: 0 : pBox = & (const SvxBoxItem&)pFooterFmt->GetBox();
1191 : : }
1192 [ - + ]: 681 : if(pBox)
1193 : : {
1194 [ # # ]: 0 : aDistLR.SetLeft((sal_uInt16)pBox->GetDistance(BOX_LINE_LEFT ));
1195 [ # # ]: 0 : aDistLR.SetRight((sal_uInt16)pBox->GetDistance(BOX_LINE_RIGHT));
1196 : : }
1197 : :
1198 : : //add the border distance of the paragraph
1199 : 681 : SfxItemSet aCoreSetTmp( GetPool(),
1200 : : RES_BOX, RES_BOX,
1201 [ + - ]: 681 : SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0 );
1202 [ + - ]: 681 : rSh.GetCurAttr( aCoreSetTmp );
1203 [ + - ]: 681 : const SvxBoxItem& rParaBox = (const SvxBoxItem&)aCoreSetTmp.Get(RES_BOX);
1204 [ + - ]: 681 : aDistLR.SetLeft(aDistLR.GetLeft() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_LEFT ));
1205 [ + - ]: 681 : aDistLR.SetRight(aDistLR.GetRight() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_RIGHT));
1206 [ + - ]: 681 : rSet.Put(aDistLR);
1207 : 681 : nLeftBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetLeft());
1208 [ + - ]: 681 : nRightBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetRight());
1209 [ + - ]: 686 : }
1210 : : }
1211 : : }
1212 : 686 : break;
1213 : : case SID_RULER_TEXT_RIGHT_TO_LEFT:
1214 : : {
1215 [ + - ][ + - ]: 686 : if ( nSelType & nsSelectionType::SEL_GRF ||
[ + - ][ - + ]
1216 : : nSelType & nsSelectionType::SEL_FRM ||
1217 : : nSelType & nsSelectionType::SEL_OLE ||
1218 : : nFrmType == FRMTYPE_DRAWOBJ)
1219 [ # # ]: 0 : rSet.DisableItem(nWhich);
1220 : : else
1221 : : {
1222 [ + - ]: 686 : sal_Bool bFlag = rSh.IsInRightToLeftText();
1223 [ + - ][ + - ]: 686 : rSet.Put(SfxBoolItem(nWhich, bFlag));
[ + - ]
1224 : : }
1225 : : }
1226 : 686 : break;
1227 : : case SID_RULER_BORDERS_VERTICAL:
1228 : : case SID_RULER_BORDERS:
1229 : : {
1230 : 1372 : sal_Bool bFrameHasVerticalColumns(sal_False);
1231 : : {
1232 : : sal_Bool bFrameRTL;
1233 : : sal_Bool bFrameVertL2R;
1234 [ + - ]: 1372 : bFrameHasVerticalColumns = rSh.IsFrmVertical(sal_False, bFrameRTL, bFrameVertL2R) &&
1235 [ - + ][ # # ]: 1372 : bFrmSelection;
1236 : : }
1237 : 1372 : sal_Bool bHasTable = ( IsTabColFromDoc() ||
1238 [ + - ]: 1372 : ( rSh.GetTableFmt() && !bFrmSelection &&
1239 [ + + ][ + - ]: 2744 : !(nFrmType & FRMTYPE_COLSECT ) ) );
[ + - ][ + - ]
1240 : :
1241 [ + + ][ + - ]: 1372 : sal_Bool bTableVertical = bHasTable && rSh.IsTableVertical();
[ - + ]
1242 : :
1243 [ + + ][ + + ]: 1372 : if(((SID_RULER_BORDERS_VERTICAL == nWhich) &&
[ - + ][ + - ]
[ + - ][ - + ]
[ # # ][ # # ]
[ + - ][ + + ]
[ + - ][ - + ]
[ # # ][ # # ]
[ - + ]
1244 : : ((bHasTable && !bTableVertical) ||
1245 : : (!bVerticalWriting && !bFrmSelection && !bHasTable ) ||
1246 : : ( bFrmSelection && !bFrameHasVerticalColumns))) ||
1247 : : ((SID_RULER_BORDERS == nWhich) &&
1248 : : ((bHasTable && bTableVertical) ||
1249 : : (bVerticalWriting && !bFrmSelection&& !bHasTable) || bFrameHasVerticalColumns)))
1250 [ + - ]: 686 : rSet.DisableItem(nWhich);
1251 [ + + ]: 686 : else if ( bHasTable )
1252 : : {
1253 [ + - ]: 5 : SwTabCols aTabCols;
1254 : : sal_uInt16 nNum;
1255 [ - + ]: 5 : if ( 0 != ( bSetTabColFromDoc = IsTabColFromDoc() ) )
1256 : : {
1257 [ # # ]: 0 : rSh.GetMouseTabCols( aTabCols, aTabColFromDocPos );
1258 [ # # ]: 0 : nNum = rSh.GetCurMouseTabColNum( aTabColFromDocPos );
1259 : : }
1260 : : else
1261 : : {
1262 [ + - ]: 5 : rSh.GetTabCols( aTabCols );
1263 [ + - ]: 5 : nNum = rSh.GetCurTabColNum();
1264 [ + - ][ - + ]: 5 : if(rSh.IsTableRightToLeft())
1265 [ # # ]: 0 : nNum = aTabCols.Count() - nNum;
1266 : : }
1267 : :
1268 : : OSL_ENSURE(nNum <= aTabCols.Count(), "TabCol not found");
1269 : 5 : const int nLft = aTabCols.GetLeftMin() + aTabCols.GetLeft();
1270 : : const int nRgt = (sal_uInt16)(bTableVertical ? nPageHeight : nPageWidth) -
1271 : 5 : (aTabCols.GetLeftMin() +
1272 [ - + ]: 10 : aTabCols.GetRight());
1273 : :
1274 : 5 : const sal_uInt16 nL = static_cast< sal_uInt16 >(nLft > 0 ? nLft : 0);
1275 : 5 : const sal_uInt16 nR = static_cast< sal_uInt16 >(nRgt > 0 ? nRgt : 0);
1276 : :
1277 [ + - ]: 5 : SvxColumnItem aColItem(nNum, nL, nR);
1278 : :
1279 : 5 : sal_uInt16 nStart = 0,
1280 : : nEnd;
1281 : :
1282 : : //columns in right-to-left tables need to be mirrored
1283 : : sal_Bool bIsTableRTL =
1284 : 5 : IsTabColFromDoc() ?
1285 : 0 : rSh.IsMouseTableRightToLeft(aTabColFromDocPos)
1286 [ # # ][ + - ]: 5 : : rSh.IsTableRightToLeft();
[ - + ]
1287 [ - + ]: 5 : if(bIsTableRTL)
1288 : : {
1289 [ # # ][ # # ]: 0 : for ( sal_uInt16 i = aTabCols.Count(); i ; --i )
1290 : : {
1291 [ # # ]: 0 : const SwTabColsEntry& rEntry = aTabCols.GetEntry( i - 1 );
1292 : 0 : nEnd = (sal_uInt16)aTabCols.GetRight();
1293 : 0 : nEnd = nEnd - (sal_uInt16)rEntry.nPos;
1294 : : SvxColumnDescription aColDesc( nStart, nEnd,
1295 : 0 : (sal_uInt16(aTabCols.GetRight() - rEntry.nMax)),
1296 : 0 : (sal_uInt16(aTabCols.GetRight() - rEntry.nMin)),
1297 [ # # ]: 0 : !aTabCols.IsHidden(i - 1) );
1298 [ # # ]: 0 : aColItem.Append(aColDesc);
1299 : 0 : nStart = nEnd;
1300 : : }
1301 : : SvxColumnDescription aColDesc(nStart,
1302 : 0 : aTabCols.GetRight() - aTabCols.GetLeft(), sal_True);
1303 [ # # ]: 0 : aColItem.Append(aColDesc);
1304 : : }
1305 : : else
1306 : : {
1307 [ + - ][ + + ]: 10 : for ( sal_uInt16 i = 0; i < aTabCols.Count(); ++i )
1308 : : {
1309 [ + - ]: 5 : const SwTabColsEntry& rEntry = aTabCols.GetEntry( i );
1310 : 5 : nEnd = static_cast< sal_uInt16 >(rEntry.nPos - aTabCols.GetLeft());
1311 : : SvxColumnDescription aColDesc( nStart, nEnd,
1312 : 5 : rEntry.nMin - aTabCols.GetLeft(), rEntry.nMax - aTabCols.GetLeft(),
1313 [ + - ]: 10 : !aTabCols.IsHidden(i) );
1314 [ + - ]: 5 : aColItem.Append(aColDesc);
1315 : 5 : nStart = nEnd;
1316 : : }
1317 : 5 : SvxColumnDescription aColDesc(nStart, aTabCols.GetRight() - aTabCols.GetLeft(),
1318 : : 0, 0,
1319 : 5 : sal_True);
1320 [ + - ]: 5 : aColItem.Append(aColDesc);
1321 : : }
1322 [ + - ][ + - ]: 5 : rSet.Put(aColItem, nWhich);
1323 : : }
1324 [ + - ][ - + ]: 681 : else if ( bFrmSelection || nFrmType & ( FRMTYPE_COLUMN | FRMTYPE_COLSECT ) )
1325 : : {
1326 : : // Aus Rahmen oder Seite ?
1327 : 0 : sal_uInt16 nNum = 0;
1328 [ # # ]: 0 : if(bFrmSelection)
1329 : : {
1330 [ # # ]: 0 : const SwFrmFmt* pFmt = rSh.GetFlyFrmFmt();
1331 [ # # ]: 0 : if(pFmt)
1332 [ # # ][ # # ]: 0 : nNum = pFmt->GetCol().GetNumCols();
1333 : : }
1334 : : else
1335 [ # # ]: 0 : nNum = rSh.GetCurColNum();
1336 : :
1337 [ # # ][ # # ]: 0 : if(
1338 : : //eigentlich sollte FRMTYPE_COLSECT nicht enthalten sein, wenn der Rahmen selektiert ist!
1339 : : !bFrmSelection &&
1340 : : nFrmType & FRMTYPE_COLSECT )
1341 : : {
1342 [ # # ]: 0 : const SwSection *pSect = rSh.GetAnySection(sal_False, pPt);
1343 : : OSL_ENSURE( pSect, "Which section?");
1344 [ # # ]: 0 : if( pSect )
1345 : : {
1346 : 0 : SwSectionFmt *pFmt = pSect->GetFmt();
1347 [ # # ]: 0 : const SwFmtCol& rCol = pFmt->GetCol();
1348 [ # # ][ # # ]: 0 : if(rSh.IsInRightToLeftText())
1349 : 0 : nNum = rCol.GetColumns().size() - nNum;
1350 : : else
1351 : 0 : --nNum;
1352 [ # # ]: 0 : SvxColumnItem aColItem(nNum);
1353 [ # # ]: 0 : SwRect aRect = rSh.GetAnyCurRect(RECT_SECTION_PRT, pPt);
1354 [ # # ]: 0 : const SwRect aTmpRect = rSh.GetAnyCurRect(RECT_SECTION, pPt);
1355 : :
1356 [ # # ][ # # ]: 0 : ::lcl_FillSvxColumn(rCol, sal_uInt16(bVerticalWriting ? aRect.Height() : aRect.Width()), aColItem, 0);
1357 : :
1358 [ # # ]: 0 : if(bVerticalWriting)
1359 : : {
1360 : 0 : aRect.Pos() += Point(aTmpRect.Left(), aTmpRect.Top());
1361 : 0 : aRect.Pos().Y() -= rPageRect.Top();
1362 : 0 : aColItem.SetLeft ((sal_uInt16)(aRect.Top()));
1363 : 0 : aColItem.SetRight((sal_uInt16)(nPageHeight - aRect.Bottom() ));
1364 : : }
1365 : : else
1366 : : {
1367 : 0 : aRect.Pos() += aTmpRect.Pos();
1368 : :
1369 : : // PAGES01
1370 : : // make relative to page position:
1371 : 0 : aColItem.SetLeft ((sal_uInt16)( aRect.Left() - rPageRect.Left() ));
1372 : 0 : aColItem.SetRight((sal_uInt16)( rPageRect.Right() - aRect.Right()));
1373 : : }
1374 [ # # ]: 0 : aColItem.SetOrtho(aColItem.CalcOrtho());
1375 : :
1376 [ # # ][ # # ]: 0 : rSet.Put(aColItem, nWhich);
1377 : 0 : }
1378 : : }
1379 [ # # ][ # # ]: 0 : else if( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY )
1380 : : {
1381 : : // Spalten in Rahmen
1382 [ # # ]: 0 : if ( nNum )
1383 : : {
1384 [ # # ]: 0 : const SwFrmFmt* pFmt = rSh.GetFlyFrmFmt() ;
1385 : :
1386 [ # # ]: 0 : const SwFmtCol& rCol = pFmt->GetCol();
1387 [ # # ][ # # ]: 0 : if(rSh.IsInRightToLeftText())
1388 : 0 : nNum = rCol.GetColumns().size() - nNum;
1389 : : else
1390 : 0 : nNum--;
1391 [ # # ]: 0 : SvxColumnItem aColItem(nNum);
1392 [ # # ]: 0 : const SwRect &rSizeRect = rSh.GetAnyCurRect(RECT_FLY_PRT_EMBEDDED, pPt);
1393 : :
1394 [ # # ][ # # ]: 0 : sal_Bool bUseVertical = bFrameHasVerticalColumns || (!bFrmSelection && bVerticalWriting);
[ # # ]
1395 [ # # ]: 0 : const long lWidth = bUseVertical ? rSizeRect.Height() : rSizeRect.Width();
1396 [ # # ]: 0 : const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED, pPt);
1397 [ # # ]: 0 : long nDist2 = ((bUseVertical ? rRect.Height() : rRect.Width()) - lWidth) /2;
1398 [ # # ]: 0 : ::lcl_FillSvxColumn(rCol, sal_uInt16(lWidth), aColItem, nDist2);
1399 : :
1400 [ # # ]: 0 : SfxItemSet aFrameSet(GetPool(), RES_LR_SPACE, RES_LR_SPACE);
1401 [ # # ]: 0 : rSh.GetFlyFrmAttr( aFrameSet );
1402 : :
1403 [ # # ]: 0 : if(bUseVertical)
1404 : : {
1405 : 0 : aColItem.SetLeft ((sal_uInt16)(rRect.Top()- rPageRect.Top()));
1406 : 0 : aColItem.SetRight((sal_uInt16)(nPageHeight + rPageRect.Top() - rRect.Bottom() ));
1407 : : }
1408 : : else
1409 : : {
1410 : 0 : aColItem.SetLeft ((sal_uInt16)(rRect.Left() - rPageRect.Left() ));
1411 : 0 : aColItem.SetRight((sal_uInt16)(rPageRect.Right() - rRect.Right() ));
1412 : : }
1413 : :
1414 [ # # ]: 0 : aColItem.SetOrtho(aColItem.CalcOrtho());
1415 : :
1416 [ # # ][ # # ]: 0 : rSet.Put(aColItem, nWhich);
[ # # ]
1417 : : }
1418 : : else
1419 [ # # ]: 0 : rSet.DisableItem(nWhich);
1420 : : }
1421 : : else
1422 : : { // Spalten auf der Seite
1423 : 0 : const SwFrmFmt& rMaster = rDesc.GetMaster();
1424 [ # # ][ # # ]: 0 : SwFmtCol aCol(rMaster.GetCol());
1425 [ # # ]: 0 : if(rFrameDir.GetValue() == FRMDIR_HORI_RIGHT_TOP)
1426 : 0 : nNum = aCol.GetColumns().size() - nNum;
1427 : : else
1428 : 0 : nNum--;
1429 : :
1430 [ # # ]: 0 : SvxColumnItem aColItem(nNum);
1431 [ # # ]: 0 : const SwRect aPrtRect = rSh.GetAnyCurRect(RECT_PAGE_PRT, pPt);
1432 [ # # ]: 0 : const SvxBoxItem& rBox = (const SvxBoxItem&)rMaster.GetFmtAttr(RES_BOX);
1433 [ # # ]: 0 : long nDist = rBox.GetDistance();
1434 : : ::lcl_FillSvxColumn(aCol,
1435 : 0 : sal_uInt16(bVerticalWriting ? aPrtRect.Height() : aPrtRect.Width() ),
1436 [ # # ][ # # ]: 0 : aColItem, nDist);
1437 : :
1438 [ # # ]: 0 : if(bBrowse)
1439 : : {
1440 : 0 : aColItem.SetLeft((sal_uInt16)rPagePrtRect.Left());
1441 : 0 : aColItem.SetRight(sal_uInt16(nPageWidth - rPagePrtRect.Right()));
1442 : : }
1443 : : else
1444 : : {
1445 : 0 : aColItem.SetLeft (aPageLRSpace.GetLeft());
1446 : 0 : aColItem.SetRight(aPageLRSpace.GetRight());
1447 : : }
1448 [ # # ]: 0 : aColItem.SetOrtho(aColItem.CalcOrtho());
1449 : :
1450 [ # # ][ # # ]: 0 : rSet.Put(aColItem, nWhich);
[ # # ]
1451 : 0 : }
1452 : : }
1453 : : else
1454 [ + - ]: 681 : rSet.DisableItem(nWhich);
1455 : 1372 : break;
1456 : : }
1457 : : case SID_RULER_ROWS :
1458 : : case SID_RULER_ROWS_VERTICAL:
1459 : : {
1460 : 1372 : sal_Bool bFrameHasVerticalColumns(sal_False);
1461 : : {
1462 : : sal_Bool bFrameRTL;
1463 : : sal_Bool bFrameVertL2R;
1464 [ + - ]: 1372 : bFrameHasVerticalColumns = rSh.IsFrmVertical(sal_False, bFrameRTL, bFrameVertL2R) &&
1465 [ - + ][ # # ]: 1372 : bFrmSelection;
1466 : : }
1467 : :
1468 [ + + ][ + - ]: 1372 : if(((SID_RULER_ROWS == nWhich) &&
[ - + ][ # # ]
[ # # ][ + - ]
[ - + ][ # # ]
[ - + ]
1469 : : ((!bVerticalWriting && !bFrmSelection) || (bFrmSelection && !bFrameHasVerticalColumns))) ||
1470 : : ((SID_RULER_ROWS_VERTICAL == nWhich) &&
1471 : : ((bVerticalWriting && !bFrmSelection) || bFrameHasVerticalColumns)))
1472 [ + - ]: 686 : rSet.DisableItem(nWhich);
1473 [ + - ][ + + ]: 1372 : else if ( IsTabRowFromDoc() ||
[ + - ][ + - ]
[ + + ]
1474 [ + - ]: 686 : ( rSh.GetTableFmt() && !bFrmSelection &&
1475 : 5 : !(nFrmType & FRMTYPE_COLSECT ) ) )
1476 : : {
1477 [ + - ]: 5 : SwTabCols aTabCols;
1478 : : //no current value necessary
1479 : 5 : sal_uInt16 nNum = 0;
1480 [ - + ]: 5 : if ( 0 != ( bSetTabRowFromDoc = IsTabRowFromDoc() ) )
1481 : : {
1482 [ # # ]: 0 : rSh.GetMouseTabRows( aTabCols, aTabColFromDocPos );
1483 : : }
1484 : : else
1485 : : {
1486 [ + - ]: 5 : rSh.GetTabRows( aTabCols );
1487 : : }
1488 : :
1489 : 5 : const int nLft = aTabCols.GetLeftMin();
1490 : : const int nRgt = (sal_uInt16)(bVerticalWriting ? nPageWidth : nPageHeight) -
1491 : 5 : (aTabCols.GetLeftMin() +
1492 [ - + ]: 10 : aTabCols.GetRight());
1493 : :
1494 : 5 : const sal_uInt16 nL = static_cast< sal_uInt16 >(nLft > 0 ? nLft : 0);
1495 : 5 : const sal_uInt16 nR = static_cast< sal_uInt16 >(nRgt > 0 ? nRgt : 0);
1496 : :
1497 [ + - ]: 5 : SvxColumnItem aColItem(nNum, nL, nR);
1498 : :
1499 : 5 : sal_uInt16 nStart = 0,
1500 : : nEnd;
1501 : :
1502 [ + - ][ + + ]: 10 : for ( sal_uInt16 i = 0; i < aTabCols.Count(); ++i )
1503 : : {
1504 [ + - ]: 5 : const SwTabColsEntry& rEntry = aTabCols.GetEntry( i );
1505 [ - + ]: 5 : if(bVerticalWriting)
1506 : : {
1507 : 0 : nEnd = sal_uInt16(aTabCols.GetRight() - rEntry.nPos);
1508 : : SvxColumnDescription aColDesc( nStart, nEnd,
1509 : 0 : aTabCols.GetRight() - rEntry.nMax, aTabCols.GetRight() - rEntry.nMin,
1510 [ # # ]: 0 : !aTabCols.IsHidden(i) );
1511 [ # # ]: 0 : aColItem.Append(aColDesc);
1512 : : }
1513 : : else
1514 : : {
1515 : 5 : nEnd = sal_uInt16(rEntry.nPos - aTabCols.GetLeft());
1516 : : SvxColumnDescription aColDesc( nStart, nEnd,
1517 : 5 : sal_uInt16(rEntry.nMin - aTabCols.GetLeft()), sal_uInt16(rEntry.nMax - aTabCols.GetLeft()),
1518 [ + - ]: 10 : !aTabCols.IsHidden(i) );
1519 [ + - ]: 5 : aColItem.Append(aColDesc);
1520 : : }
1521 : 5 : nStart = nEnd;
1522 : : }
1523 [ - + ]: 5 : if(bVerticalWriting)
1524 : 0 : nEnd = static_cast< sal_uInt16 >(aTabCols.GetRight());
1525 : : else
1526 : 5 : nEnd = static_cast< sal_uInt16 >(aTabCols.GetLeft());
1527 : : // put a position protection when the last row cannot be moved
1528 : : // due to a page break inside of a row
1529 [ - + ]: 5 : if(!aTabCols.IsLastRowAllowedToChange())
1530 : 0 : bPutContentProtection = sal_True;
1531 : :
1532 : : SvxColumnDescription aColDesc( nStart, nEnd,
1533 : : aTabCols.GetRight(), aTabCols.GetRight(),
1534 : 5 : sal_False );
1535 [ + - ]: 5 : aColItem.Append(aColDesc);
1536 : :
1537 [ + - ][ + - ]: 5 : rSet.Put(aColItem, nWhich);
1538 : : }
1539 : : else
1540 [ + - ]: 681 : rSet.DisableItem(nWhich);
1541 : : }
1542 : 1372 : break;
1543 : : case SID_RULER_PAGE_POS:
1544 : : {
1545 : : // PAGES01
1546 : : SvxPagePosSizeItem aPagePosSize(
1547 [ + - ]: 692 : Point( rPageRect.Left(), rPageRect.Top()) , nPageWidth, nPageHeight);
1548 : :
1549 [ + - ]: 692 : rSet.Put(aPagePosSize);
1550 [ + - ]: 692 : break;
1551 : : }
1552 : : case SID_RULER_LR_MIN_MAX:
1553 : : {
1554 [ + - ]: 692 : Rectangle aRectangle;
1555 [ - + ][ # # ]: 692 : if( ( nFrmType & FRMTYPE_COLSECT ) && !IsTabColFromDoc() &&
[ # # ][ - + ]
1556 : : ( nFrmType & ( FRMTYPE_TABLE|FRMTYPE_COLUMN ) ) )
1557 : : {
1558 [ # # ]: 0 : if( nFrmType & FRMTYPE_TABLE )
1559 : : {
1560 [ # # ]: 0 : const sal_uInt16 nNum = rSh.GetCurTabColNum();
1561 [ # # ]: 0 : SwTabCols aTabCols;
1562 [ # # ]: 0 : rSh.GetTabCols( aTabCols );
1563 : :
1564 : 0 : const int nLft = aTabCols.GetLeftMin() + aTabCols.GetLeft();
1565 : 0 : const int nRgt = (sal_uInt16)nPageWidth -(aTabCols.GetLeftMin() + aTabCols.GetRight());
1566 : :
1567 : 0 : const sal_uInt16 nL = static_cast< sal_uInt16 >(nLft > 0 ? nLft : 0);
1568 : 0 : const sal_uInt16 nR = static_cast< sal_uInt16 >(nRgt > 0 ? nRgt : 0);
1569 : :
1570 : 0 : aRectangle.Left() = nL;
1571 [ # # ]: 0 : if(nNum > 1)
1572 [ # # ]: 0 : aRectangle.Left() += aTabCols[nNum - 2];
1573 [ # # ]: 0 : if(nNum)
1574 : 0 : aRectangle.Left() += MINLAY;
1575 [ # # ][ # # ]: 0 : if(aTabCols.Count() <= nNum + 1 )
1576 : 0 : aRectangle.Right() = nR;
1577 : : else
1578 [ # # ]: 0 : aRectangle.Right() = nPageWidth - (nL + aTabCols[nNum + 1]);
1579 : :
1580 [ # # ][ # # ]: 0 : if(nNum < aTabCols.Count())
1581 : 0 : aRectangle.Right() += MINLAY;
1582 : : }
1583 : : else
1584 : : {
1585 [ # # ]: 0 : const SwFrmFmt* pFmt = rSh.GetFlyFrmFmt();
1586 : 0 : const SwFmtCol* pCols = pFmt ? &pFmt->GetCol():
1587 [ # # ][ # # ]: 0 : &rDesc.GetMaster().GetCol();
[ # # ]
1588 : 0 : const SwColumns& rCols = pCols->GetColumns();
1589 [ # # ]: 0 : sal_uInt16 nNum = rSh.GetCurOutColNum();
1590 : 0 : sal_uInt16 nCount = Min(sal_uInt16(nNum + 1), sal_uInt16(rCols.size()));
1591 : : const SwRect aRect( rSh.GetAnyCurRect( pFmt
1592 : : ? RECT_FLY_PRT_EMBEDDED
1593 [ # # ][ # # ]: 0 : : RECT_PAGE_PRT, pPt ));
1594 : : const SwRect aAbsRect( rSh.GetAnyCurRect( pFmt
1595 : : ? RECT_FLY_EMBEDDED
1596 [ # # ][ # # ]: 0 : : RECT_PAGE, pPt ));
1597 : :
1598 : : //die Breite im Rahmen bzw. innerhalbe der Seitenraender
1599 : 0 : const sal_uInt16 nTotalWidth = (sal_uInt16)aRect.Width();
1600 : : //die gesamte Rahmenbreite - die Differenz ist der doppelte Abstand zum Rand
1601 : 0 : const sal_uInt16 nOuterWidth = (sal_uInt16)aAbsRect.Width();
1602 : 0 : int nWidth = 0,
1603 : 0 : nStart = 0,
1604 : 0 : nEnd = 0;
1605 : 0 : aRectangle.Left() = 0;
1606 [ # # ]: 0 : for ( sal_uInt16 i = 0; i < nCount; ++i )
1607 : : {
1608 [ # # ]: 0 : const SwColumn* pCol = &rCols[i];
1609 : 0 : nStart = pCol->GetLeft() + nWidth;
1610 [ # # ]: 0 : if(i == nNum - 2)
1611 : 0 : aRectangle.Left() = nStart;
1612 [ # # ]: 0 : nWidth += pCols->CalcColWidth( i, nTotalWidth );
1613 : 0 : nEnd = nWidth - pCol->GetRight();
1614 : : }
1615 : 0 : aRectangle.Right() = rPageRect.Right() - nEnd;
1616 : 0 : aRectangle.Left() -= rPageRect.Left();
1617 : :
1618 [ # # ]: 0 : if(nNum > 1)
1619 : : {
1620 : 0 : aRectangle.Left() += MINLAY;
1621 : 0 : aRectangle.Left() += aRect.Left();
1622 : : }
1623 [ # # ]: 0 : if(pFmt) //Bereich in Rahmen - hier darf man bis zum Rand
1624 : 0 : aRectangle.Left() = aRectangle.Right() = 0;
1625 : : else
1626 : : {
1627 : : // das Rechteck an die richtige absolute Position verschieben
1628 : 0 : aRectangle.Left() += aAbsRect.Left();
1629 : 0 : aRectangle.Right() -= aAbsRect.Left();
1630 : : // Abstand zur Umrandung mit einbeziehen
1631 : 0 : aRectangle.Right() -= (nOuterWidth - nTotalWidth) / 2;
1632 : : }
1633 : :
1634 [ # # ]: 0 : if(nNum < rCols.size())
1635 : : {
1636 : 0 : aRectangle.Right() += MINLAY;
1637 : : }
1638 : : else
1639 : : // rechts ist jetzt nur noch der Seitenrand
1640 : 0 : aRectangle.Right() = 0;
1641 : :
1642 : :
1643 : : }
1644 : : }
1645 [ + + ][ - + ]: 692 : else if ( ((nFrmType & FRMTYPE_TABLE) || IsTabColFromDoc()) &&
[ + - ][ + + ]
1646 : : !bFrmSelection )
1647 : : {
1648 : : sal_Bool bColumn;
1649 [ - + ]: 5 : if ( IsTabColFromDoc() )
1650 [ # # ]: 0 : bColumn = rSh.GetCurMouseColNum( aTabColFromDocPos ) != 0;
1651 : : else
1652 : : bColumn = (nFrmType & (FRMTYPE_COLUMN|FRMTYPE_FLY_ANY|
1653 : : FRMTYPE_COLSECTOUTTAB)) ?
1654 [ - + ]: 5 : sal_True : sal_False;
1655 [ + - ]: 5 : if ( !bColumn )
1656 : : {
1657 [ - + ][ # # ]: 5 : if( nFrmType & FRMTYPE_FLY_ANY && IsTabColFromDoc() )
[ - + ]
1658 : : {
1659 : : SwRect aRect( rSh.GetAnyCurRect(
1660 [ # # ]: 0 : RECT_FLY_PRT_EMBEDDED, pPt ) );
1661 : 0 : aRect.Pos() += rSh.GetAnyCurRect( RECT_FLY_EMBEDDED,
1662 [ # # ]: 0 : pPt ).Pos();
1663 : :
1664 : 0 : aRectangle.Left() = aRect.Left() - rPageRect.Left();
1665 : 0 : aRectangle.Right() = rPageRect.Right() - aRect.Right();
1666 : : }
1667 [ - + ]: 5 : else if( bBrowse )
1668 : : {
1669 : 0 : aRectangle.Left() = rPagePrtRect.Left();
1670 : 0 : aRectangle.Right() = nPageWidth - rPagePrtRect.Right();
1671 : : }
1672 : : else
1673 : : {
1674 : 5 : aRectangle.Left() = aPageLRSpace.GetLeft();
1675 : 5 : aRectangle.Right() = aPageLRSpace.GetRight();
1676 : : }
1677 : : }
1678 : : else
1679 : : { //hier nur fuer Tabelle in mehrspaltigen Seiten und Rahmen
1680 [ # # ]: 0 : sal_Bool bSectOutTbl = (nFrmType & FRMTYPE_TABLE) ? sal_True : sal_False;
1681 [ # # ]: 0 : sal_Bool bFrame = (nFrmType & FRMTYPE_FLY_ANY) ? sal_True : sal_False;
1682 : : sal_Bool bColSct = (nFrmType & ( bSectOutTbl
1683 : : ? FRMTYPE_COLSECTOUTTAB
1684 : : : FRMTYPE_COLSECT )
1685 [ # # ][ # # ]: 0 : ) ? sal_True : sal_False;
1686 : : //Damit man auch mit der Mouse ziehen kann,
1687 : : //ohne in der Tabelle zu stehen
1688 : 0 : CurRectType eRecType = RECT_PAGE_PRT;
1689 : 0 : sal_uInt16 nNum = IsTabColFromDoc() ?
1690 : 0 : rSh.GetCurMouseColNum( aTabColFromDocPos ):
1691 [ # # ][ # # ]: 0 : rSh.GetCurOutColNum();
[ # # ]
1692 : 0 : const SwFrmFmt* pFmt = NULL;
1693 [ # # ]: 0 : if( bColSct )
1694 : : {
1695 : : eRecType = bSectOutTbl ? RECT_OUTTABSECTION
1696 [ # # ]: 0 : : RECT_SECTION;
1697 [ # # ]: 0 : const SwSection *pSect = rSh.GetAnySection( bSectOutTbl, pPt );
1698 : : OSL_ENSURE( pSect, "Which section?");
1699 : 0 : pFmt = pSect->GetFmt();
1700 : : }
1701 [ # # ]: 0 : else if( bFrame )
1702 : : {
1703 [ # # ]: 0 : pFmt = rSh.GetFlyFrmFmt();
1704 : 0 : eRecType = RECT_FLY_PRT_EMBEDDED;
1705 : : }
1706 : :
1707 : 0 : const SwFmtCol* pCols = pFmt ? &pFmt->GetCol():
1708 [ # # ][ # # ]: 0 : &rDesc.GetMaster().GetCol();
[ # # ]
1709 : 0 : const SwColumns& rCols = pCols->GetColumns();
1710 [ # # ]: 0 : const sal_uInt16 nBorder = pFmt ? pFmt->GetBox().GetDistance() :
1711 [ # # ][ # # ]: 0 : rDesc.GetMaster().GetBox().GetDistance();
[ # # ][ # # ]
1712 : :
1713 : : /* RECT_FLY_PRT_EMBEDDED returns the relative position to
1714 : : RECT_FLY_EMBEDDED
1715 : : the absolute position must be added here
1716 : : */
1717 [ # # ]: 0 : SwRect aRect( rSh.GetAnyCurRect( eRecType, pPt ) );
1718 [ # # ]: 0 : if(RECT_FLY_PRT_EMBEDDED == eRecType)
1719 : 0 : aRect.Pos() += rSh.GetAnyCurRect( RECT_FLY_EMBEDDED,
1720 [ # # ]: 0 : pPt ).Pos();
1721 : :
1722 : 0 : const sal_uInt16 nTotalWidth = (sal_uInt16)aRect.Width();
1723 : : //nStart und nEnd initialisieren fuer nNum == 0
1724 : 0 : int nWidth = 0,
1725 : 0 : nStart = 0,
1726 : 0 : nEnd = nTotalWidth;
1727 : :
1728 [ # # ]: 0 : if( nNum > rCols.size() )
1729 : : {
1730 : : OSL_ENSURE( !this, "wrong FmtCol is being edited!" );
1731 : 0 : nNum = rCols.size();
1732 : : }
1733 : :
1734 [ # # ]: 0 : for( sal_uInt16 i = 0; i < nNum; ++i )
1735 : : {
1736 [ # # ]: 0 : const SwColumn* pCol = &rCols[i];
1737 : 0 : nStart = pCol->GetLeft() + nWidth;
1738 [ # # ]: 0 : nWidth += pCols->CalcColWidth( i, nTotalWidth );
1739 : 0 : nEnd = nWidth - pCol->GetRight();
1740 : : }
1741 [ # # ]: 0 : if( bFrame | bColSct )
1742 : : {
1743 : 0 : aRectangle.Left() = aRect.Left() - rPageRect.Left() + nStart;
1744 : 0 : aRectangle.Right() = nPageWidth - aRectangle.Left() - nEnd + nStart;
1745 : : }
1746 [ # # ]: 0 : else if(!bBrowse)
1747 : : {
1748 : 0 : aRectangle.Left() = aPageLRSpace.GetLeft() + nStart;
1749 : 0 : aRectangle.Right() = nPageWidth - nEnd - aPageLRSpace.GetLeft();
1750 : : }
1751 : : else
1752 : : {
1753 : 0 : long nLeft = rPagePrtRect.Left();
1754 : 0 : aRectangle.Left() = nStart + nLeft;
1755 : 0 : aRectangle.Right() = nPageWidth - nEnd - nLeft;
1756 : : }
1757 [ # # ]: 0 : if(!bFrame)
1758 : : {
1759 : 0 : aRectangle.Left() += nBorder;
1760 : 0 : aRectangle.Right() -= nBorder;
1761 : : }
1762 : : }
1763 : : }
1764 [ - + ]: 687 : else if ( nFrmType & ( FRMTYPE_HEADER | FRMTYPE_FOOTER ))
1765 : : {
1766 : 0 : aRectangle.Left() = aPageLRSpace.GetLeft();
1767 : 0 : aRectangle.Right() = aPageLRSpace.GetRight();
1768 : : }
1769 : : else
1770 : 687 : aRectangle.Left() = aRectangle.Right() = 0;
1771 : :
1772 [ + - ]: 692 : SfxRectangleItem aLR( SID_RULER_LR_MIN_MAX , aRectangle);
1773 [ + - ][ + - ]: 692 : rSet.Put(aLR);
1774 : : }
1775 : 692 : break;
1776 : : case SID_RULER_PROTECT:
1777 : : {
1778 [ - + ]: 678 : if(bFrmSelection)
1779 : : {
1780 [ # # ]: 0 : sal_uInt8 nProtect = pWrtShell->IsSelObjProtected( FLYPROTECT_SIZE|FLYPROTECT_POS|FLYPROTECT_CONTENT );
1781 : :
1782 [ # # ]: 0 : SvxProtectItem aProt(SID_RULER_PROTECT);
1783 : 0 : aProt.SetCntntProtect((nProtect & FLYPROTECT_CONTENT) != 0);
1784 : 0 : aProt.SetSizeProtect ((nProtect & FLYPROTECT_SIZE) != 0);
1785 : 0 : aProt.SetPosProtect ((nProtect & FLYPROTECT_POS) != 0);
1786 [ # # ][ # # ]: 0 : rSet.Put(aProt);
1787 : : }
1788 : : else
1789 : : {
1790 [ + - ]: 678 : SvxProtectItem aProtect(SID_RULER_PROTECT);
1791 [ + + ][ + - ]: 678 : if(bBrowse && !(nFrmType & (FRMTYPE_DRAWOBJ|FRMTYPE_COLUMN)) && !rSh.GetTableFmt())
[ + - ][ + - ]
[ + + ]
1792 : : {
1793 : 5 : aProtect.SetSizeProtect(sal_True);
1794 : 5 : aProtect.SetPosProtect(sal_True);
1795 : : }
1796 [ + - ][ + - ]: 678 : rSet.Put(aProtect);
1797 : : }
1798 : : }
1799 : 678 : break;
1800 : : }
1801 [ + - ]: 10266 : nWhich = aIter.NextWhich();
1802 : : }
1803 [ - + ]: 692 : if(bPutContentProtection)
1804 : : {
1805 [ # # ]: 0 : SvxProtectItem aProtect(SID_RULER_PROTECT);
1806 : 0 : aProtect.SetCntntProtect(sal_True);
1807 [ # # ][ # # ]: 0 : rSet.Put(aProtect);
1808 [ + - ][ + - ]: 692 : }
[ + - ]
1809 : 692 : }
1810 : :
1811 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|