1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xeview.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
34 #include "document.hxx"
35 #include "scextopt.hxx"
36 #include "viewopti.hxx"
38 #include "xestyle.hxx"
40 #include <oox/core/tokens.hxx>
44 // Workbook view settings records =============================================
46 XclExpWindow1::XclExpWindow1( const XclExpRoot
& rRoot
) :
47 XclExpRecord( EXC_ID_WINDOW1
, 18 ),
51 const ScViewOptions
& rViewOpt
= rRoot
.GetDoc().GetViewOptions();
52 ::set_flag( mnFlags
, EXC_WIN1_HOR_SCROLLBAR
, rViewOpt
.GetOption( VOPT_HSCROLL
) );
53 ::set_flag( mnFlags
, EXC_WIN1_VER_SCROLLBAR
, rViewOpt
.GetOption( VOPT_VSCROLL
) );
54 ::set_flag( mnFlags
, EXC_WIN1_TABBAR
, rViewOpt
.GetOption( VOPT_TABCONTROLS
) );
56 double fTabBarWidth
= rRoot
.GetExtDocOptions().GetDocSettings().mfTabBarWidth
;
57 if( (0.0 <= fTabBarWidth
) && (fTabBarWidth
<= 1.0) )
58 mnTabBarSize
= static_cast< sal_uInt16
>( fTabBarWidth
* 1000.0 + 0.5 );
61 void XclExpWindow1::SaveXml( XclExpXmlStream
& rStrm
)
63 const XclExpTabInfo
& rTabInfo
= rStrm
.GetRoot().GetTabInfo();
65 rStrm
.GetCurrentStream()->singleElement( XML_workbookView
,
66 // OOXTODO: XML_visibility, // ST_visibilty
67 // OOXTODO: XML_minimized, // bool
68 XML_showHorizontalScroll
, XclXmlUtils::ToPsz( ::get_flag( mnFlags
, EXC_WIN1_HOR_SCROLLBAR
) ),
69 XML_showVerticalScroll
, XclXmlUtils::ToPsz( ::get_flag( mnFlags
, EXC_WIN1_VER_SCROLLBAR
) ),
70 XML_showSheetTabs
, XclXmlUtils::ToPsz( ::get_flag( mnFlags
, EXC_WIN1_TABBAR
) ),
73 XML_windowWidth
, OString::valueOf( (sal_Int32
)0x4000 ).getStr(),
74 XML_windowHeight
, OString::valueOf( (sal_Int32
)0x2000 ).getStr(),
75 XML_tabRatio
, OString::valueOf( (sal_Int32
)mnTabBarSize
).getStr(),
76 XML_firstSheet
, OString::valueOf( (sal_Int32
)rTabInfo
.GetFirstVisXclTab() ).getStr(),
77 XML_activeTab
, OString::valueOf( (sal_Int32
)rTabInfo
.GetDisplayedXclTab() ).getStr(),
78 // OOXTODO: XML_autoFilterDateGrouping, // bool; AUTOFILTER12? 87Eh
82 void XclExpWindow1::WriteBody( XclExpStream
& rStrm
)
84 const XclExpTabInfo
& rTabInfo
= rStrm
.GetRoot().GetTabInfo();
86 rStrm
<< sal_uInt16( 0 ) // X position of the window
87 << sal_uInt16( 0 ) // Y position of the window
88 << sal_uInt16( 0x4000 ) // width of the window
89 << sal_uInt16( 0x2000 ) // height of the window
91 << rTabInfo
.GetDisplayedXclTab()
92 << rTabInfo
.GetFirstVisXclTab()
93 << rTabInfo
.GetXclSelectedCount()
97 // Sheet view settings records ================================================
99 XclExpWindow2::XclExpWindow2( const XclExpRoot
& rRoot
,
100 const XclTabViewData
& rData
, sal_uInt32 nGridColorId
) :
101 XclExpRecord( EXC_ID_WINDOW2
, (rRoot
.GetBiff() == EXC_BIFF8
) ? 18 : 10 ),
102 maGridColor( rData
.maGridColor
),
103 mnGridColorId( nGridColorId
),
105 maFirstXclPos( rData
.maFirstXclPos
),
106 mnNormalZoom( rData
.mnNormalZoom
),
107 mnPageZoom( rData
.mnPageZoom
)
109 ::set_flag( mnFlags
, EXC_WIN2_SHOWFORMULAS
, rData
.mbShowFormulas
);
110 ::set_flag( mnFlags
, EXC_WIN2_SHOWGRID
, rData
.mbShowGrid
);
111 ::set_flag( mnFlags
, EXC_WIN2_SHOWHEADINGS
, rData
.mbShowHeadings
);
112 ::set_flag( mnFlags
, EXC_WIN2_FROZEN
, rData
.mbFrozenPanes
);
113 ::set_flag( mnFlags
, EXC_WIN2_SHOWZEROS
, rData
.mbShowZeros
);
114 ::set_flag( mnFlags
, EXC_WIN2_DEFGRIDCOLOR
, rData
.mbDefGridColor
);
115 ::set_flag( mnFlags
, EXC_WIN2_MIRRORED
, rData
.mbMirrored
);
116 ::set_flag( mnFlags
, EXC_WIN2_SHOWOUTLINE
, rData
.mbShowOutline
);
117 ::set_flag( mnFlags
, EXC_WIN2_FROZENNOSPLIT
, rData
.mbFrozenPanes
);
118 ::set_flag( mnFlags
, EXC_WIN2_SELECTED
, rData
.mbSelected
);
119 ::set_flag( mnFlags
, EXC_WIN2_DISPLAYED
, rData
.mbDisplayed
);
120 ::set_flag( mnFlags
, EXC_WIN2_PAGEBREAKMODE
, rData
.mbPageMode
);
123 void XclExpWindow2::WriteBody( XclExpStream
& rStrm
)
125 const XclExpRoot
& rRoot
= rStrm
.GetRoot();
130 switch( rRoot
.GetBiff() )
135 rStrm
<< maGridColor
;
138 rStrm
<< rRoot
.GetPalette().GetColorIndex( mnGridColorId
)
144 default: DBG_ERROR_BIFF();
148 // ----------------------------------------------------------------------------
150 XclExpScl::XclExpScl( sal_uInt16 nZoom
) :
151 XclExpRecord( EXC_ID_SCL
, 4 ),
159 void XclExpScl::Shorten( sal_uInt16 nFactor
)
161 while( (mnNum
% nFactor
== 0) && (mnDenom
% nFactor
== 0) )
163 mnNum
= mnNum
/ nFactor
;
164 mnDenom
= mnDenom
/ nFactor
;
168 void XclExpScl::WriteBody( XclExpStream
& rStrm
)
170 DBG_ASSERT_BIFF( rStrm
.GetRoot().GetBiff() >= EXC_BIFF4
);
171 rStrm
<< mnNum
<< mnDenom
;
174 // ----------------------------------------------------------------------------
176 XclExpPane::XclExpPane( const XclTabViewData
& rData
) :
177 XclExpRecord( EXC_ID_PANE
, 10 ),
178 mnSplitX( rData
.mnSplitX
),
179 mnSplitY( rData
.mnSplitY
),
180 maSecondXclPos( rData
.maSecondXclPos
),
181 mnActivePane( rData
.mnActivePane
)
183 DBG_ASSERT( rData
.IsSplit(), "XclExpPane::XclExpPane - no PANE record for unsplit view" );
186 static const char* lcl_GetActivePane( sal_uInt8 nActivePane
)
188 switch( nActivePane
)
190 case EXC_PANE_TOPLEFT
: return "topLeft"; //break;
191 case EXC_PANE_TOPRIGHT
: return "topRight"; //break;
192 case EXC_PANE_BOTTOMLEFT
: return "bottomLeft"; //break;
193 case EXC_PANE_BOTTOMRIGHT
: return "bottomRight"; //break;
195 return "**error: lcl_GetActivePane";
198 void XclExpPane::SaveXml( XclExpXmlStream
& rStrm
)
200 rStrm
.GetCurrentStream()->singleElement( XML_pane
,
201 XML_xSplit
, OString::valueOf( (sal_Int32
)mnSplitX
).getStr(),
202 XML_ySplit
, OString::valueOf( (sal_Int32
)mnSplitY
).getStr(),
203 XML_topLeftCell
, XclXmlUtils::ToOString( maSecondXclPos
).getStr(),
204 XML_activePane
, lcl_GetActivePane( mnActivePane
),
205 // OOXTODO: XML_state,
209 void XclExpPane::WriteBody( XclExpStream
& rStrm
)
215 if( rStrm
.GetRoot().GetBiff() >= EXC_BIFF5
)
216 rStrm
<< sal_uInt8( 0 );
219 // ----------------------------------------------------------------------------
221 XclExpSelection::XclExpSelection( const XclTabViewData
& rData
, sal_uInt8 nPane
) :
222 XclExpRecord( EXC_ID_SELECTION
, 15 ),
225 if( const XclSelectionData
* pSelData
= rData
.GetSelectionData( nPane
) )
226 maSelData
= *pSelData
;
228 // find the cursor position in the selection list (or add it)
229 XclRangeList
& rXclSel
= maSelData
.maXclSelection
;
231 for( XclRangeList::const_iterator aIt
= rXclSel
.begin(), aEnd
= rXclSel
.end(); !bFound
&& (aIt
!= aEnd
); ++aIt
)
232 if( (bFound
= aIt
->Contains( maSelData
.maXclCursor
)) == true )
233 maSelData
.mnCursorIdx
= static_cast< sal_uInt16
>( aIt
- rXclSel
.begin() );
234 /* Cursor cell not found in list? (e.g. inactive pane, or removed in
235 ConvertRangeList(), because Calc cursor on invalid pos)
236 -> insert the valid Excel cursor. */
239 maSelData
.mnCursorIdx
= static_cast< sal_uInt16
>( rXclSel
.size() );
240 rXclSel
.push_back( XclRange( maSelData
.maXclCursor
) );
244 void XclExpSelection::SaveXml( XclExpXmlStream
& rStrm
)
246 rStrm
.GetCurrentStream()->singleElement( XML_selection
,
247 XML_pane
, lcl_GetActivePane( mnPane
),
248 XML_activeCell
, XclXmlUtils::ToOString( maSelData
.maXclCursor
).getStr(),
249 XML_activeCellId
, OString::valueOf( (sal_Int32
) maSelData
.mnCursorIdx
).getStr(),
250 XML_sqref
, XclXmlUtils::ToOString( maSelData
.maXclSelection
).getStr(),
254 void XclExpSelection::WriteBody( XclExpStream
& rStrm
)
256 rStrm
<< mnPane
// pane for this selection
257 << maSelData
.maXclCursor
// cell cursor
258 << maSelData
.mnCursorIdx
; // index to range containing cursor
259 maSelData
.maXclSelection
.Write( rStrm
, false );
262 // ----------------------------------------------------------------------------
264 XclExpTabBgColor::XclExpTabBgColor( const XclTabViewData
& rTabViewData
) :
265 XclExpRecord( EXC_ID_SHEETEXT
, 18 ),
266 mrTabViewData( rTabViewData
)
269 //TODO Fix savexml...
270 /*void XclExpTabBgColor::SaveXml( XclExpXmlStream& rStrm )
274 void XclExpTabBgColor::WriteBody( XclExpStream
& rStrm
)
276 if ( mrTabViewData
.IsDefaultTabBgColor() )
278 sal_uInt16 rt
= 0x0862; //rt
279 sal_uInt16 grbitFrt
= 0x0000; //grbit must be set to 0
280 sal_uInt32 unused
= 0x00000000; //Use twice...
281 sal_uInt32 cb
= 0x00000014; // Record Size, may be larger in future...
282 sal_uInt16 reserved
= 0x0000; //trailing bits are 0
283 sal_uInt16 TabBgColorIndex
;
284 XclExpPalette
& rPal
= rStrm
.GetRoot().GetPalette();
285 TabBgColorIndex
= rPal
.GetColorIndex(mrTabViewData
.mnTabBgColorId
);
286 if (TabBgColorIndex
< 8 || TabBgColorIndex
> 63 ) // only numbers 8 - 63 are valid numbers
287 TabBgColorIndex
= 127; //Excel specs: 127 makes excel ignore tab color information.
288 rStrm
<< rt
<< grbitFrt
<< unused
<< unused
<< cb
<< TabBgColorIndex
<< reserved
;
291 // Sheet view settings ========================================================
295 /** Converts a Calc zoom factor into an Excel zoom factor. Returns 0 for a default zoom value. */
296 sal_uInt16
lclGetXclZoom( long nScZoom
, sal_uInt16 nDefXclZoom
)
298 sal_uInt16 nXclZoom
= limit_cast
< sal_uInt16
>( nScZoom
, EXC_ZOOM_MIN
, EXC_ZOOM_MAX
);
299 return (nXclZoom
== nDefXclZoom
) ? 0 : nXclZoom
;
304 // ----------------------------------------------------------------------------
306 XclExpTabViewSettings::XclExpTabViewSettings( const XclExpRoot
& rRoot
, SCTAB nScTab
) :
308 mnGridColorId( XclExpPalette::GetColorIdFromIndex( EXC_COLOR_WINDOWTEXT
) )
310 // *** sheet flags ***
312 const XclExpTabInfo
& rTabInfo
= GetTabInfo();
313 maData
.mbSelected
= rTabInfo
.IsSelectedTab( nScTab
);
314 maData
.mbDisplayed
= rTabInfo
.IsDisplayedTab( nScTab
);
315 maData
.mbMirrored
= rTabInfo
.IsMirroredTab( nScTab
);
317 const ScViewOptions
& rViewOpt
= GetDoc().GetViewOptions();
318 maData
.mbShowFormulas
= rViewOpt
.GetOption( VOPT_FORMULAS
);
319 maData
.mbShowHeadings
= rViewOpt
.GetOption( VOPT_HEADER
);
320 maData
.mbShowZeros
= rViewOpt
.GetOption( VOPT_NULLVALS
);
321 maData
.mbShowOutline
= rViewOpt
.GetOption( VOPT_OUTLINER
);
323 // *** sheet options: cursor, selection, splits, grid color, zoom ***
325 if( const ScExtTabSettings
* pTabSett
= GetExtDocOptions().GetTabSettings( nScTab
) )
327 const ScExtTabSettings
& rTabSett
= *pTabSett
;
328 XclExpAddressConverter
& rAddrConv
= GetAddressConverter();
330 // first visible cell in top-left pane
331 if( (rTabSett
.maFirstVis
.Col() >= 0) && (rTabSett
.maFirstVis
.Row() >= 0) )
332 maData
.maFirstXclPos
= rAddrConv
.CreateValidAddress( rTabSett
.maFirstVis
, false );
334 // first visible cell in additional pane(s)
335 if( (rTabSett
.maSecondVis
.Col() >= 0) && (rTabSett
.maSecondVis
.Row() >= 0) )
336 maData
.maSecondXclPos
= rAddrConv
.CreateValidAddress( rTabSett
.maSecondVis
, false );
339 switch( rTabSett
.meActivePane
)
341 case SCEXT_PANE_TOPLEFT
: maData
.mnActivePane
= EXC_PANE_TOPLEFT
; break;
342 case SCEXT_PANE_TOPRIGHT
: maData
.mnActivePane
= EXC_PANE_TOPRIGHT
; break;
343 case SCEXT_PANE_BOTTOMLEFT
: maData
.mnActivePane
= EXC_PANE_BOTTOMLEFT
; break;
344 case SCEXT_PANE_BOTTOMRIGHT
: maData
.mnActivePane
= EXC_PANE_BOTTOMRIGHT
; break;
347 // freeze/split position
348 maData
.mbFrozenPanes
= rTabSett
.mbFrozenPanes
;
349 if( maData
.mbFrozenPanes
)
351 /* Frozen panes: handle split position as row/column positions.
352 #i35812# Excel uses number of visible rows/columns, Calc uses position of freeze. */
353 SCCOL nFreezeScCol
= rTabSett
.maFreezePos
.Col();
354 if( (0 < nFreezeScCol
) && (nFreezeScCol
<= GetXclMaxPos().Col()) )
355 maData
.mnSplitX
= static_cast< sal_uInt16
>( nFreezeScCol
) - maData
.maFirstXclPos
.mnCol
;
356 SCROW nFreezeScRow
= rTabSett
.maFreezePos
.Row();
357 if( (0 < nFreezeScRow
) && (nFreezeScRow
<= GetXclMaxPos().Row()) )
358 maData
.mnSplitY
= static_cast< sal_uInt16
>( nFreezeScRow
) - maData
.maFirstXclPos
.mnRow
;
359 // if both splits are left out (address overflow), remove the frozen flag
360 maData
.mbFrozenPanes
= maData
.IsSplit();
362 // #i20671# frozen panes: mostright/mostbottom pane is active regardless of cursor position
363 if( maData
.HasPane( EXC_PANE_BOTTOMRIGHT
) )
364 maData
.mnActivePane
= EXC_PANE_BOTTOMRIGHT
;
365 else if( maData
.HasPane( EXC_PANE_TOPRIGHT
) )
366 maData
.mnActivePane
= EXC_PANE_TOPRIGHT
;
367 else if( maData
.HasPane( EXC_PANE_BOTTOMLEFT
) )
368 maData
.mnActivePane
= EXC_PANE_BOTTOMLEFT
;
372 // split window: position is in twips
373 maData
.mnSplitX
= ulimit_cast
< sal_uInt16
>( rTabSett
.maSplitPos
.X() );
374 maData
.mnSplitY
= ulimit_cast
< sal_uInt16
>( rTabSett
.maSplitPos
.Y() );
378 CreateSelectionData( EXC_PANE_TOPLEFT
, rTabSett
.maCursor
, rTabSett
.maSelection
);
379 CreateSelectionData( EXC_PANE_TOPRIGHT
, rTabSett
.maCursor
, rTabSett
.maSelection
);
380 CreateSelectionData( EXC_PANE_BOTTOMLEFT
, rTabSett
.maCursor
, rTabSett
.maSelection
);
381 CreateSelectionData( EXC_PANE_BOTTOMRIGHT
, rTabSett
.maCursor
, rTabSett
.maSelection
);
384 const Color
& rGridColor
= rTabSett
.maGridColor
;
385 maData
.mbDefGridColor
= rGridColor
.GetColor() == COL_AUTO
;
386 if( !maData
.mbDefGridColor
)
388 if( GetBiff() == EXC_BIFF8
)
389 mnGridColorId
= GetPalette().InsertColor( rGridColor
, EXC_COLOR_GRID
);
391 maData
.maGridColor
= rGridColor
;
393 maData
.mbShowGrid
= rTabSett
.mbShowGrid
;
395 // view mode and zoom
396 maData
.mbPageMode
= (GetBiff() == EXC_BIFF8
) && rTabSett
.mbPageMode
;
397 maData
.mnNormalZoom
= lclGetXclZoom( rTabSett
.mnNormalZoom
, EXC_WIN2_NORMALZOOM_DEF
);
398 maData
.mnPageZoom
= lclGetXclZoom( rTabSett
.mnPageZoom
, EXC_WIN2_PAGEZOOM_DEF
);
399 maData
.mnCurrentZoom
= maData
.mbPageMode
? maData
.mnPageZoom
: maData
.mnNormalZoom
;
402 if ( GetBiff() == EXC_BIFF8
&& !rTabSett
.IsDefaultTabBgColor() )
404 XclExpPalette
& rPal
= GetPalette();
405 maData
.maTabBgColor
= rTabSett
.maTabBgColor
;
406 maData
.mnTabBgColorId
= rPal
.InsertColor(maData
.maTabBgColor
, EXC_COLOR_TABBG
, EXC_COLOR_NOTABBG
);
411 void XclExpTabViewSettings::Save( XclExpStream
& rStrm
)
413 WriteWindow2( rStrm
);
416 WriteSelection( rStrm
, EXC_PANE_TOPLEFT
);
417 WriteSelection( rStrm
, EXC_PANE_TOPRIGHT
);
418 WriteSelection( rStrm
, EXC_PANE_BOTTOMLEFT
);
419 WriteSelection( rStrm
, EXC_PANE_BOTTOMRIGHT
);
420 WriteTabBgColor( rStrm
);
423 static void lcl_WriteSelection( XclExpXmlStream
& rStrm
, const XclTabViewData
& rData
, sal_uInt8 nPane
)
425 if( rData
.HasPane( nPane
) )
426 XclExpSelection( rData
, nPane
).SaveXml( rStrm
);
429 OString
lcl_GetZoom( sal_uInt16 nZoom
)
432 return OString::valueOf( (sal_Int32
)nZoom
);
433 return OString( "100" );
436 void XclExpTabViewSettings::SaveXml( XclExpXmlStream
& rStrm
)
438 sax_fastparser::FSHelperPtr
& rWorksheet
= rStrm
.GetCurrentStream();
439 rWorksheet
->startElement( XML_sheetViews
, FSEND
);
440 rWorksheet
->startElement( XML_sheetView
,
441 XML_windowProtection
, XclXmlUtils::ToPsz( maData
.mbFrozenPanes
),
442 XML_showFormulas
, XclXmlUtils::ToPsz( maData
.mbShowFormulas
),
443 XML_showGridLines
, XclXmlUtils::ToPsz( maData
.mbShowGrid
),
444 XML_showRowColHeaders
, XclXmlUtils::ToPsz( maData
.mbShowHeadings
),
445 XML_showZeros
, XclXmlUtils::ToPsz( maData
.mbShowZeros
),
446 XML_rightToLeft
, XclXmlUtils::ToPsz( maData
.mbMirrored
),
447 XML_tabSelected
, XclXmlUtils::ToPsz( maData
.mbSelected
),
448 // OOXTODO: XML_showRuler,
449 XML_showOutlineSymbols
, XclXmlUtils::ToPsz( maData
.mbShowOutline
),
450 XML_defaultGridColor
, mnGridColorId
== XclExpPalette::GetColorIdFromIndex( EXC_COLOR_WINDOWTEXT
) ? "true" : "false",
451 // OOXTODO: XML_showWhiteSpace,
452 XML_view
, maData
.mbPageMode
? "pageBreakPreview" : "normal", // OOXTODO: pageLayout
453 XML_topLeftCell
, XclXmlUtils::ToOString( maData
.maFirstXclPos
).getStr(),
454 XML_colorId
, OString::valueOf( (sal_Int32
) rStrm
.GetRoot().GetPalette().GetColorIndex( mnGridColorId
) ).getStr(),
455 XML_zoomScale
, lcl_GetZoom( maData
.mnCurrentZoom
).getStr(),
456 XML_zoomScaleNormal
, lcl_GetZoom( maData
.mnNormalZoom
).getStr(),
457 // OOXTODO: XML_zoomScaleSheetLayoutView,
458 XML_zoomScalePageLayoutView
, lcl_GetZoom( maData
.mnPageZoom
).getStr(),
459 XML_workbookViewId
, "0", // OOXTODO? 0-based index of document(xl/workbook.xml)/workbook/bookviews/workbookView
460 // should always be 0, as we only generate 1 such element.
462 if( maData
.IsSplit() )
464 XclExpPane
aPane( maData
);
465 aPane
.SaveXml( rStrm
);
467 lcl_WriteSelection( rStrm
, maData
, EXC_PANE_TOPLEFT
);
468 lcl_WriteSelection( rStrm
, maData
, EXC_PANE_TOPRIGHT
);
469 lcl_WriteSelection( rStrm
, maData
, EXC_PANE_BOTTOMLEFT
);
470 lcl_WriteSelection( rStrm
, maData
, EXC_PANE_BOTTOMRIGHT
);
471 rWorksheet
->endElement( XML_sheetView
);
472 // OOXTODO: XML_extLst
473 rWorksheet
->endElement( XML_sheetViews
);
476 // private --------------------------------------------------------------------
478 void XclExpTabViewSettings::CreateSelectionData( sal_uInt8 nPane
,
479 const ScAddress
& rCursor
, const ScRangeList
& rSelection
)
481 if( maData
.HasPane( nPane
) )
483 XclSelectionData
& rSelData
= maData
.CreateSelectionData( nPane
);
485 // first step: use top-left visible cell as cursor
486 rSelData
.maXclCursor
.mnCol
= ((nPane
== EXC_PANE_TOPLEFT
) || (nPane
== EXC_PANE_BOTTOMLEFT
)) ?
487 maData
.maFirstXclPos
.mnCol
: maData
.maSecondXclPos
.mnCol
;
488 rSelData
.maXclCursor
.mnRow
= ((nPane
== EXC_PANE_TOPLEFT
) || (nPane
== EXC_PANE_TOPRIGHT
)) ?
489 maData
.maFirstXclPos
.mnRow
: maData
.maSecondXclPos
.mnRow
;
491 // second step, active pane: create actual selection data with current cursor position
492 if( nPane
== maData
.mnActivePane
)
494 XclExpAddressConverter
& rAddrConv
= GetAddressConverter();
495 // cursor position (keep top-left pane position from above, if rCursor is invalid)
496 if( (rCursor
.Col() >= 0) && (rCursor
.Row() >= 0) )
497 rSelData
.maXclCursor
= rAddrConv
.CreateValidAddress( rCursor
, false );
499 rAddrConv
.ConvertRangeList( rSelData
.maXclSelection
, rSelection
, false );
504 void XclExpTabViewSettings::WriteWindow2( XclExpStream
& rStrm
) const
506 // #i43553# GCC 3.3 parse error
507 // XclExpWindow2( GetRoot(), maData, mnGridColorId ).Save( rStrm );
508 XclExpWindow2
aWindow2( GetRoot(), maData
, mnGridColorId
);
509 aWindow2
.Save( rStrm
);
512 void XclExpTabViewSettings::WriteScl( XclExpStream
& rStrm
) const
514 if( maData
.mnCurrentZoom
!= 0 )
515 XclExpScl( maData
.mnCurrentZoom
).Save( rStrm
);
518 void XclExpTabViewSettings::WritePane( XclExpStream
& rStrm
) const
520 if( maData
.IsSplit() )
521 // #i43553# GCC 3.3 parse error
522 // XclExpPane( GetRoot(), maData ).Save( rStrm );
524 XclExpPane
aPane( maData
);
529 void XclExpTabViewSettings::WriteSelection( XclExpStream
& rStrm
, sal_uInt8 nPane
) const
531 if( maData
.HasPane( nPane
) )
532 XclExpSelection( maData
, nPane
).Save( rStrm
);
535 void XclExpTabViewSettings::WriteTabBgColor( XclExpStream
& rStrm
) const
537 if ( !maData
.IsDefaultTabBgColor() )
538 XclExpTabBgColor( maData
).Save( rStrm
);
540 // ============================================================================