1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include "document.hxx"
22 #include "scextopt.hxx"
23 #include "viewopti.hxx"
25 #include "xestyle.hxx"
27 using namespace ::oox
;
29 // Workbook view settings records =============================================
31 XclExpWindow1::XclExpWindow1( const XclExpRoot
& rRoot
)
32 : XclExpRecord(EXC_ID_WINDOW1
, 18)
36 const ScViewOptions
& rViewOpt
= rRoot
.GetDoc().GetViewOptions();
37 ::set_flag( mnFlags
, EXC_WIN1_HOR_SCROLLBAR
, rViewOpt
.GetOption( VOPT_HSCROLL
) );
38 ::set_flag( mnFlags
, EXC_WIN1_VER_SCROLLBAR
, rViewOpt
.GetOption( VOPT_VSCROLL
) );
39 ::set_flag( mnFlags
, EXC_WIN1_TABBAR
, rViewOpt
.GetOption( VOPT_TABCONTROLS
) );
41 double fTabBarWidth
= rRoot
.GetExtDocOptions().GetDocSettings().mfTabBarWidth
;
42 if( (0.0 <= fTabBarWidth
) && (fTabBarWidth
<= 1.0) )
43 mnTabBarSize
= static_cast< sal_uInt16
>( fTabBarWidth
* 1000.0 + 0.5 );
46 void XclExpWindow1::SaveXml( XclExpXmlStream
& rStrm
)
48 const XclExpTabInfo
& rTabInfo
= rStrm
.GetRoot().GetTabInfo();
50 rStrm
.GetCurrentStream()->singleElement( XML_workbookView
,
51 // OOXTODO: XML_visibility, // ST_visibilty
52 // OOXTODO: XML_minimized, // bool
53 XML_showHorizontalScroll
, XclXmlUtils::ToPsz( ::get_flag( mnFlags
, EXC_WIN1_HOR_SCROLLBAR
) ),
54 XML_showVerticalScroll
, XclXmlUtils::ToPsz( ::get_flag( mnFlags
, EXC_WIN1_VER_SCROLLBAR
) ),
55 XML_showSheetTabs
, XclXmlUtils::ToPsz( ::get_flag( mnFlags
, EXC_WIN1_TABBAR
) ),
58 XML_windowWidth
, OString::number( 0x4000 ).getStr(),
59 XML_windowHeight
, OString::number( 0x2000 ).getStr(),
60 XML_tabRatio
, OString::number( mnTabBarSize
).getStr(),
61 XML_firstSheet
, OString::number( rTabInfo
.GetFirstVisXclTab() ).getStr(),
62 XML_activeTab
, OString::number( rTabInfo
.GetDisplayedXclTab() ).getStr(),
63 // OOXTODO: XML_autoFilterDateGrouping, // bool; AUTOFILTER12? 87Eh
67 void XclExpWindow1::WriteBody( XclExpStream
& rStrm
)
69 const XclExpTabInfo
& rTabInfo
= rStrm
.GetRoot().GetTabInfo();
71 rStrm
<< sal_uInt16( 0 ) // X position of the window
72 << sal_uInt16( 0 ) // Y position of the window
73 << sal_uInt16( 0x4000 ) // width of the window
74 << sal_uInt16( 0x2000 ) // height of the window
76 << rTabInfo
.GetDisplayedXclTab()
77 << rTabInfo
.GetFirstVisXclTab()
78 << rTabInfo
.GetXclSelectedCount()
82 // Sheet view settings records ================================================
84 XclExpWindow2::XclExpWindow2( const XclExpRoot
& rRoot
,
85 const XclTabViewData
& rData
, sal_uInt32 nGridColorId
) :
86 XclExpRecord( EXC_ID_WINDOW2
, (rRoot
.GetBiff() == EXC_BIFF8
) ? 18 : 10 ),
87 maGridColor( rData
.maGridColor
),
88 mnGridColorId( nGridColorId
),
90 maFirstXclPos( rData
.maFirstXclPos
),
91 mnNormalZoom( rData
.mnNormalZoom
),
92 mnPageZoom( rData
.mnPageZoom
)
94 ::set_flag( mnFlags
, EXC_WIN2_SHOWFORMULAS
, rData
.mbShowFormulas
);
95 ::set_flag( mnFlags
, EXC_WIN2_SHOWGRID
, rData
.mbShowGrid
);
96 ::set_flag( mnFlags
, EXC_WIN2_SHOWHEADINGS
, rData
.mbShowHeadings
);
97 ::set_flag( mnFlags
, EXC_WIN2_FROZEN
, rData
.mbFrozenPanes
);
98 ::set_flag( mnFlags
, EXC_WIN2_SHOWZEROS
, rData
.mbShowZeros
);
99 ::set_flag( mnFlags
, EXC_WIN2_DEFGRIDCOLOR
, rData
.mbDefGridColor
);
100 ::set_flag( mnFlags
, EXC_WIN2_MIRRORED
, rData
.mbMirrored
);
101 ::set_flag( mnFlags
, EXC_WIN2_SHOWOUTLINE
, rData
.mbShowOutline
);
102 ::set_flag( mnFlags
, EXC_WIN2_FROZENNOSPLIT
, rData
.mbFrozenPanes
);
103 ::set_flag( mnFlags
, EXC_WIN2_SELECTED
, rData
.mbSelected
);
104 ::set_flag( mnFlags
, EXC_WIN2_DISPLAYED
, rData
.mbDisplayed
);
105 ::set_flag( mnFlags
, EXC_WIN2_PAGEBREAKMODE
, rData
.mbPageMode
);
108 void XclExpWindow2::WriteBody( XclExpStream
& rStrm
)
110 const XclExpRoot
& rRoot
= rStrm
.GetRoot();
115 switch( rRoot
.GetBiff() )
120 rStrm
<< maGridColor
;
123 rStrm
<< rRoot
.GetPalette().GetColorIndex( mnGridColorId
)
129 default: DBG_ERROR_BIFF();
133 XclExpScl::XclExpScl( sal_uInt16 nZoom
) :
134 XclExpRecord( EXC_ID_SCL
, 4 ),
142 void XclExpScl::Shorten( sal_uInt16 nFactor
)
144 while( (mnNum
% nFactor
== 0) && (mnDenom
% nFactor
== 0) )
146 mnNum
= mnNum
/ nFactor
;
147 mnDenom
= mnDenom
/ nFactor
;
151 void XclExpScl::WriteBody( XclExpStream
& rStrm
)
153 OSL_ENSURE_BIFF( rStrm
.GetRoot().GetBiff() >= EXC_BIFF4
);
154 rStrm
<< mnNum
<< mnDenom
;
157 XclExpPane::XclExpPane( const XclTabViewData
& rData
) :
158 XclExpRecord( EXC_ID_PANE
, 10 ),
159 mnSplitX( rData
.mnSplitX
),
160 mnSplitY( rData
.mnSplitY
),
161 maSecondXclPos( rData
.maSecondXclPos
),
162 mnActivePane( rData
.mnActivePane
),
163 mbFrozenPanes( rData
.mbFrozenPanes
)
165 OSL_ENSURE( rData
.IsSplit(), "XclExpPane::XclExpPane - no PANE record for unsplit view" );
168 static const char* lcl_GetActivePane( sal_uInt8 nActivePane
)
170 switch( nActivePane
)
172 case EXC_PANE_TOPLEFT
: return "topLeft";
173 case EXC_PANE_TOPRIGHT
: return "topRight";
174 case EXC_PANE_BOTTOMLEFT
: return "bottomLeft";
175 case EXC_PANE_BOTTOMRIGHT
: return "bottomRight";
177 return "**error: lcl_GetActivePane";
180 void XclExpPane::SaveXml( XclExpXmlStream
& rStrm
)
182 rStrm
.GetCurrentStream()->singleElement( XML_pane
,
183 XML_xSplit
, OString::number( mnSplitX
).getStr(),
184 XML_ySplit
, OString::number( mnSplitY
).getStr(),
185 XML_topLeftCell
, XclXmlUtils::ToOString( rStrm
.GetRoot().GetStringBuf(), maSecondXclPos
).getStr(),
186 XML_activePane
, lcl_GetActivePane( mnActivePane
),
187 XML_state
, mbFrozenPanes
? "frozen" : "split",
191 void XclExpPane::WriteBody( XclExpStream
& rStrm
)
194 << static_cast<sal_uInt16
>( mnSplitY
)
197 if( rStrm
.GetRoot().GetBiff() >= EXC_BIFF5
)
198 rStrm
<< sal_uInt8( 0 );
201 XclExpSelection::XclExpSelection( const XclTabViewData
& rData
, sal_uInt8 nPane
) :
202 XclExpRecord( EXC_ID_SELECTION
, 15 ),
205 if( const XclSelectionData
* pSelData
= rData
.GetSelectionData( nPane
) )
206 maSelData
= *pSelData
;
208 // find the cursor position in the selection list (or add it)
209 XclRangeList
& rXclSel
= maSelData
.maXclSelection
;
211 for( XclRangeVector::const_iterator aIt
= rXclSel
.begin(), aEnd
= rXclSel
.end(); !bFound
&& (aIt
!= aEnd
); ++aIt
)
212 if( (bFound
= aIt
->Contains( maSelData
.maXclCursor
)) )
213 maSelData
.mnCursorIdx
= static_cast< sal_uInt16
>( aIt
- rXclSel
.begin() );
214 /* Cursor cell not found in list? (e.g. inactive pane, or removed in
215 ConvertRangeList(), because Calc cursor on invalid pos)
216 -> insert the valid Excel cursor. */
219 maSelData
.mnCursorIdx
= static_cast< sal_uInt16
>( rXclSel
.size() );
220 rXclSel
.push_back( XclRange( maSelData
.maXclCursor
) );
224 void XclExpSelection::SaveXml( XclExpXmlStream
& rStrm
)
226 rStrm
.GetCurrentStream()->singleElement( XML_selection
,
227 XML_pane
, lcl_GetActivePane( mnPane
),
228 XML_activeCell
, XclXmlUtils::ToOString( rStrm
.GetRoot().GetStringBuf(), maSelData
.maXclCursor
).getStr(),
229 XML_activeCellId
, OString::number( maSelData
.mnCursorIdx
).getStr(),
230 XML_sqref
, XclXmlUtils::ToOString( maSelData
.maXclSelection
).getStr(),
234 void XclExpSelection::WriteBody( XclExpStream
& rStrm
)
236 rStrm
<< mnPane
// pane for this selection
237 << maSelData
.maXclCursor
// cell cursor
238 << maSelData
.mnCursorIdx
; // index to range containing cursor
239 maSelData
.maXclSelection
.Write( rStrm
, false );
242 XclExpTabBgColor::XclExpTabBgColor( const XclTabViewData
& rTabViewData
) :
243 XclExpRecord( EXC_ID_SHEETEXT
, 18 ),
244 mrTabViewData( rTabViewData
)
247 //TODO Fix savexml...
248 /*void XclExpTabBgColor::SaveXml( XclExpXmlStream& rStrm )
252 void XclExpTabBgColor::WriteBody( XclExpStream
& rStrm
)
254 if ( mrTabViewData
.IsDefaultTabBgColor() )
256 sal_uInt16 rt
= 0x0862; //rt
257 sal_uInt16 grbitFrt
= 0x0000; //grbit must be set to 0
258 sal_uInt32 unused
= 0x00000000; //Use twice...
259 sal_uInt32 cb
= 0x00000014; // Record Size, may be larger in future...
260 sal_uInt16 reserved
= 0x0000; //trailing bits are 0
261 sal_uInt16 TabBgColorIndex
;
262 XclExpPalette
& rPal
= rStrm
.GetRoot().GetPalette();
263 TabBgColorIndex
= rPal
.GetColorIndex(mrTabViewData
.mnTabBgColorId
);
264 if (TabBgColorIndex
< 8 || TabBgColorIndex
> 63 ) // only numbers 8 - 63 are valid numbers
265 TabBgColorIndex
= 127; //Excel specs: 127 makes excel ignore tab color information.
266 rStrm
<< rt
<< grbitFrt
<< unused
<< unused
<< cb
<< TabBgColorIndex
<< reserved
;
269 // Sheet view settings ========================================================
273 /** Converts a Calc zoom factor into an Excel zoom factor. Returns 0 for a default zoom value. */
274 sal_uInt16
lclGetXclZoom( long nScZoom
, sal_uInt16 nDefXclZoom
)
276 sal_uInt16 nXclZoom
= limit_cast
< sal_uInt16
>( nScZoom
, EXC_ZOOM_MIN
, EXC_ZOOM_MAX
);
277 return (nXclZoom
== nDefXclZoom
) ? 0 : nXclZoom
;
282 XclExpTabViewSettings::XclExpTabViewSettings( const XclExpRoot
& rRoot
, SCTAB nScTab
) :
284 mnGridColorId( XclExpPalette::GetColorIdFromIndex( EXC_COLOR_WINDOWTEXT
) )
286 // *** sheet flags ***
288 const XclExpTabInfo
& rTabInfo
= GetTabInfo();
289 maData
.mbSelected
= rTabInfo
.IsSelectedTab( nScTab
);
290 maData
.mbDisplayed
= rTabInfo
.IsDisplayedTab( nScTab
);
291 maData
.mbMirrored
= rTabInfo
.IsMirroredTab( nScTab
);
293 const ScViewOptions
& rViewOpt
= GetDoc().GetViewOptions();
294 maData
.mbShowFormulas
= rViewOpt
.GetOption( VOPT_FORMULAS
);
295 maData
.mbShowHeadings
= rViewOpt
.GetOption( VOPT_HEADER
);
296 maData
.mbShowZeros
= rViewOpt
.GetOption( VOPT_NULLVALS
);
297 maData
.mbShowOutline
= rViewOpt
.GetOption( VOPT_OUTLINER
);
299 // *** sheet options: cursor, selection, splits, grid color, zoom ***
301 if( const ScExtTabSettings
* pTabSett
= GetExtDocOptions().GetTabSettings( nScTab
) )
303 const ScExtTabSettings
& rTabSett
= *pTabSett
;
304 XclExpAddressConverter
& rAddrConv
= GetAddressConverter();
306 // first visible cell in top-left pane
307 if( (rTabSett
.maFirstVis
.Col() >= 0) && (rTabSett
.maFirstVis
.Row() >= 0) )
308 maData
.maFirstXclPos
= rAddrConv
.CreateValidAddress( rTabSett
.maFirstVis
, false );
310 // first visible cell in additional pane(s)
311 if( (rTabSett
.maSecondVis
.Col() >= 0) && (rTabSett
.maSecondVis
.Row() >= 0) )
312 maData
.maSecondXclPos
= rAddrConv
.CreateValidAddress( rTabSett
.maSecondVis
, false );
315 switch( rTabSett
.meActivePane
)
317 case SCEXT_PANE_TOPLEFT
: maData
.mnActivePane
= EXC_PANE_TOPLEFT
; break;
318 case SCEXT_PANE_TOPRIGHT
: maData
.mnActivePane
= EXC_PANE_TOPRIGHT
; break;
319 case SCEXT_PANE_BOTTOMLEFT
: maData
.mnActivePane
= EXC_PANE_BOTTOMLEFT
; break;
320 case SCEXT_PANE_BOTTOMRIGHT
: maData
.mnActivePane
= EXC_PANE_BOTTOMRIGHT
; break;
323 // freeze/split position
324 maData
.mbFrozenPanes
= rTabSett
.mbFrozenPanes
;
325 if( maData
.mbFrozenPanes
)
327 /* Frozen panes: handle split position as row/column positions.
328 #i35812# Excel uses number of visible rows/columns, Calc uses position of freeze. */
329 SCCOL nFreezeScCol
= rTabSett
.maFreezePos
.Col();
330 if( (0 < nFreezeScCol
) && (nFreezeScCol
<= GetXclMaxPos().Col()) )
331 maData
.mnSplitX
= static_cast< sal_uInt16
>( nFreezeScCol
) - maData
.maFirstXclPos
.mnCol
;
332 SCROW nFreezeScRow
= rTabSett
.maFreezePos
.Row();
333 if( (0 < nFreezeScRow
) && (nFreezeScRow
<= GetXclMaxPos().Row()) )
334 maData
.mnSplitY
= static_cast< sal_uInt32
>( nFreezeScRow
) - maData
.maFirstXclPos
.mnRow
;
335 // if both splits are left out (address overflow), remove the frozen flag
336 maData
.mbFrozenPanes
= maData
.IsSplit();
338 // #i20671# frozen panes: mostright/mostbottom pane is active regardless of cursor position
339 if( maData
.HasPane( EXC_PANE_BOTTOMRIGHT
) )
340 maData
.mnActivePane
= EXC_PANE_BOTTOMRIGHT
;
341 else if( maData
.HasPane( EXC_PANE_TOPRIGHT
) )
342 maData
.mnActivePane
= EXC_PANE_TOPRIGHT
;
343 else if( maData
.HasPane( EXC_PANE_BOTTOMLEFT
) )
344 maData
.mnActivePane
= EXC_PANE_BOTTOMLEFT
;
348 // split window: position is in twips
349 maData
.mnSplitX
= static_cast<sal_uInt16
>(rTabSett
.maSplitPos
.X());
350 maData
.mnSplitY
= static_cast<sal_uInt32
>(rTabSett
.maSplitPos
.Y());
354 CreateSelectionData( EXC_PANE_TOPLEFT
, rTabSett
.maCursor
, rTabSett
.maSelection
);
355 CreateSelectionData( EXC_PANE_TOPRIGHT
, rTabSett
.maCursor
, rTabSett
.maSelection
);
356 CreateSelectionData( EXC_PANE_BOTTOMLEFT
, rTabSett
.maCursor
, rTabSett
.maSelection
);
357 CreateSelectionData( EXC_PANE_BOTTOMRIGHT
, rTabSett
.maCursor
, rTabSett
.maSelection
);
360 const Color
& rGridColor
= rTabSett
.maGridColor
;
361 maData
.mbDefGridColor
= rGridColor
.GetColor() == COL_AUTO
;
362 if( !maData
.mbDefGridColor
)
364 if( GetBiff() == EXC_BIFF8
)
365 mnGridColorId
= GetPalette().InsertColor( rGridColor
, EXC_COLOR_GRID
);
367 maData
.maGridColor
= rGridColor
;
369 maData
.mbShowGrid
= rTabSett
.mbShowGrid
;
371 // view mode and zoom
372 maData
.mbPageMode
= (GetBiff() == EXC_BIFF8
) && rTabSett
.mbPageMode
;
373 maData
.mnNormalZoom
= lclGetXclZoom( rTabSett
.mnNormalZoom
, EXC_WIN2_NORMALZOOM_DEF
);
374 maData
.mnPageZoom
= lclGetXclZoom( rTabSett
.mnPageZoom
, EXC_WIN2_PAGEZOOM_DEF
);
375 maData
.mnCurrentZoom
= maData
.mbPageMode
? maData
.mnPageZoom
: maData
.mnNormalZoom
;
379 if ( GetBiff() == EXC_BIFF8
&& !GetDoc().IsDefaultTabBgColor(nScTab
) )
381 XclExpPalette
& rPal
= GetPalette();
382 maData
.maTabBgColor
= GetDoc().GetTabBgColor(nScTab
);
383 maData
.mnTabBgColorId
= rPal
.InsertColor(maData
.maTabBgColor
, EXC_COLOR_TABBG
, EXC_COLOR_NOTABBG
);
387 void XclExpTabViewSettings::Save( XclExpStream
& rStrm
)
389 WriteWindow2( rStrm
);
392 WriteSelection( rStrm
, EXC_PANE_TOPLEFT
);
393 WriteSelection( rStrm
, EXC_PANE_TOPRIGHT
);
394 WriteSelection( rStrm
, EXC_PANE_BOTTOMLEFT
);
395 WriteSelection( rStrm
, EXC_PANE_BOTTOMRIGHT
);
396 WriteTabBgColor( rStrm
);
399 static void lcl_WriteSelection( XclExpXmlStream
& rStrm
, const XclTabViewData
& rData
, sal_uInt8 nPane
)
401 if( rData
.HasPane( nPane
) )
402 XclExpSelection( rData
, nPane
).SaveXml( rStrm
);
405 static OString
lcl_GetZoom( sal_uInt16 nZoom
)
408 return OString::number( nZoom
);
409 return OString( "100" );
412 void XclExpTabViewSettings::SaveXml( XclExpXmlStream
& rStrm
)
414 sax_fastparser::FSHelperPtr
& rWorksheet
= rStrm
.GetCurrentStream();
415 rWorksheet
->startElement( XML_sheetViews
, FSEND
);
416 rWorksheet
->startElement( XML_sheetView
,
417 XML_windowProtection
, XclXmlUtils::ToPsz( maData
.mbFrozenPanes
),
418 XML_showFormulas
, XclXmlUtils::ToPsz( maData
.mbShowFormulas
),
419 XML_showGridLines
, XclXmlUtils::ToPsz( maData
.mbShowGrid
),
420 XML_showRowColHeaders
, XclXmlUtils::ToPsz( maData
.mbShowHeadings
),
421 XML_showZeros
, XclXmlUtils::ToPsz( maData
.mbShowZeros
),
422 XML_rightToLeft
, XclXmlUtils::ToPsz( maData
.mbMirrored
),
423 XML_tabSelected
, XclXmlUtils::ToPsz( maData
.mbSelected
),
424 // OOXTODO: XML_showRuler,
425 XML_showOutlineSymbols
, XclXmlUtils::ToPsz( maData
.mbShowOutline
),
426 XML_defaultGridColor
, mnGridColorId
== XclExpPalette::GetColorIdFromIndex( EXC_COLOR_WINDOWTEXT
) ? "true" : "false",
427 // OOXTODO: XML_showWhiteSpace,
428 XML_view
, maData
.mbPageMode
? "pageBreakPreview" : "normal", // OOXTODO: pageLayout
429 XML_topLeftCell
, XclXmlUtils::ToOString( rStrm
.GetRoot().GetStringBuf(), maData
.maFirstXclPos
).getStr(),
430 XML_colorId
, OString::number( rStrm
.GetRoot().GetPalette().GetColorIndex( mnGridColorId
) ).getStr(),
431 XML_zoomScale
, lcl_GetZoom( maData
.mnCurrentZoom
).getStr(),
432 XML_zoomScaleNormal
, lcl_GetZoom( maData
.mnNormalZoom
).getStr(),
433 // OOXTODO: XML_zoomScaleSheetLayoutView,
434 XML_zoomScalePageLayoutView
, lcl_GetZoom( maData
.mnPageZoom
).getStr(),
435 XML_workbookViewId
, "0", // OOXTODO? 0-based index of document(xl/workbook.xml)/workbook/bookviews/workbookView
436 // should always be 0, as we only generate 1 such element.
438 if( maData
.IsSplit() )
440 XclExpPane
aPane( maData
);
441 aPane
.SaveXml( rStrm
);
443 lcl_WriteSelection( rStrm
, maData
, EXC_PANE_TOPLEFT
);
444 lcl_WriteSelection( rStrm
, maData
, EXC_PANE_TOPRIGHT
);
445 lcl_WriteSelection( rStrm
, maData
, EXC_PANE_BOTTOMLEFT
);
446 lcl_WriteSelection( rStrm
, maData
, EXC_PANE_BOTTOMRIGHT
);
447 rWorksheet
->endElement( XML_sheetView
);
448 // OOXTODO: XML_extLst
449 rWorksheet
->endElement( XML_sheetViews
);
452 // private --------------------------------------------------------------------
454 void XclExpTabViewSettings::CreateSelectionData( sal_uInt8 nPane
,
455 const ScAddress
& rCursor
, const ScRangeList
& rSelection
)
457 if( maData
.HasPane( nPane
) )
459 XclSelectionData
& rSelData
= maData
.CreateSelectionData( nPane
);
461 // first step: use top-left visible cell as cursor
462 rSelData
.maXclCursor
.mnCol
= ((nPane
== EXC_PANE_TOPLEFT
) || (nPane
== EXC_PANE_BOTTOMLEFT
)) ?
463 maData
.maFirstXclPos
.mnCol
: maData
.maSecondXclPos
.mnCol
;
464 rSelData
.maXclCursor
.mnRow
= ((nPane
== EXC_PANE_TOPLEFT
) || (nPane
== EXC_PANE_TOPRIGHT
)) ?
465 maData
.maFirstXclPos
.mnRow
: maData
.maSecondXclPos
.mnRow
;
467 // second step, active pane: create actual selection data with current cursor position
468 if( nPane
== maData
.mnActivePane
)
470 XclExpAddressConverter
& rAddrConv
= GetAddressConverter();
471 // cursor position (keep top-left pane position from above, if rCursor is invalid)
472 if( (rCursor
.Col() >= 0) && (rCursor
.Row() >= 0) )
473 rSelData
.maXclCursor
= rAddrConv
.CreateValidAddress( rCursor
, false );
475 rAddrConv
.ConvertRangeList( rSelData
.maXclSelection
, rSelection
, false );
480 void XclExpTabViewSettings::WriteWindow2( XclExpStream
& rStrm
) const
482 // #i43553# GCC 3.3 parse error
483 // XclExpWindow2( GetRoot(), maData, mnGridColorId ).Save( rStrm );
484 XclExpWindow2
aWindow2( GetRoot(), maData
, mnGridColorId
);
485 aWindow2
.Save( rStrm
);
488 void XclExpTabViewSettings::WriteScl( XclExpStream
& rStrm
) const
490 if( maData
.mnCurrentZoom
!= 0 )
491 XclExpScl( maData
.mnCurrentZoom
).Save( rStrm
);
494 void XclExpTabViewSettings::WritePane( XclExpStream
& rStrm
) const
496 if( maData
.IsSplit() )
497 // #i43553# GCC 3.3 parse error
498 // XclExpPane( GetRoot(), maData ).Save( rStrm );
500 XclExpPane
aPane( maData
);
505 void XclExpTabViewSettings::WriteSelection( XclExpStream
& rStrm
, sal_uInt8 nPane
) const
507 if( maData
.HasPane( nPane
) )
508 XclExpSelection( maData
, nPane
).Save( rStrm
);
511 void XclExpTabViewSettings::WriteTabBgColor( XclExpStream
& rStrm
) const
513 if ( !maData
.IsDefaultTabBgColor() )
514 XclExpTabBgColor( maData
).Save( rStrm
);
517 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */