Files
libreoffice/sc/source/ui/inc/csvtablebox.hxx

151 lines
6.9 KiB
C++
Raw Normal View History

2010-10-27 12:43:08 +01:00
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
re-base on ALv2 code. Includes: Patches contributed by Herbert Duerr i#118735 prevent endless loop if vlookup/hlookup doesn't find anything http://svn.apache.org/viewvc?view=revision&revision=1239673 Patches contributed by Andre Fischer remove lp_solver http://svn.apache.org/viewvc?view=revision&revision=1199180 i#118160: Added external CoinMP library. http://svn.apache.org/viewvc?view=revision&revision=1233909 Patches contributed by Armin Le-Grand i#118485 - Styles for OLEs are not saved. http://svn.apache.org/viewvc?view=revision&revision=1182166 i#118524: apply patch, followup fixes to 118485 http://svn.apache.org/viewvc?view=revision&revision=1186077 Patches contributed by lihuiibm i#108860 - Fix range validation. http://svn.apache.org/viewvc?view=revision&revision=1242846 i#118954 Chart data will lost after copy to different file http://svn.apache.org/viewvc?view=revision&revision=1301345 Patches contributed by Ariel Constenla-Haile Fix Linux build breaker: extra qualification on member http://svn.apache.org/viewvc?view=revision&revision=1301591 i#118696 - i#118697 - Fix some Sheet Tab Color API issues http://svn.apache.org/viewvc?view=revision&revision=1225428 i#118697 - Fix uninitialized variable http://svn.apache.org/viewvc?view=revision&revision=1225859 i#118771 - ScUndoImportTab should preserve tab background color http://svn.apache.org/viewvc?view=revision&revision=1230356 i#118921 - Repaint linked sheet tab background color after updating link http://svn.apache.org/viewvc?view=revision&revision=1245177 i#118927 - Undo/Redo "Update Link" does not reset sheet tab color http://svn.apache.org/viewvc?view=revision&revision=1245241 i#118747 - Copy tab color when transferring sheets across documents http://svn.apache.org/viewvc?view=revision&revision=1230355 Patch contributed by Oliver Rainer-Wittman i#118012 - methods <ScBroadcastAreaSlot::AreaBroadcast(..)> and <ScBroadcastAreaSlot::AreaBroadcastInRange(..)> adapt stl-container iteration in order to avoid destroyed iterators during iteration. http://svn.apache.org/viewvc?view=revision&revision=1297916 Patches contributed by Mathias Bauer gnumake4 work variously http://svn.apache.org/viewvc?view=revision&revision=1394707 http://svn.apache.org/viewvc?view=revision&revision=1394326 http://svn.apache.org/viewvc?view=revision&revision=1396797 http://svn.apache.org/viewvc?view=revision&revision=1397315 Patch contributed by Daniel Rentz calc69: #i116936# fix VBA symbol Cells http://svn.apache.org/viewvc?view=revision&revision=1172135 Patches contributed by leiw: i#118546 CPU 100% on switched off AutoCalculate with Conditional Formatting on date values http://svn.apache.org/viewvc?view=revision&revision=1301380 Re-add new function documentation. Many various cleanups. Add missing calc66: #o11817313# also look at formula result number format, remove redundant binaries.
2012-11-30 12:23:25 +00:00
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
// ============================================================================
#ifndef _SC_CSVTABLEBOX_HXX
#define _SC_CSVTABLEBOX_HXX
#include <vcl/ctrl.hxx>
#include <vcl/scrbar.hxx>
#include "scdllapi.h"
#include "csvcontrol.hxx"
#include "csvruler.hxx"
#include "csvgrid.hxx"
class ListBox;
class ScAsciiOptions;
/* ============================================================================
Position: Positions between the characters (the dots in the ruler).
Character: The characters (the range from one position to the next).
Split: Positions which contain a split to divide characters into groups (columns).
Column: The range between two splits.
============================================================================ */
/** The control in the CSV import dialog that contains a ruler and a data grid
to visualize and modify the current import settings. */
class SC_DLLPUBLIC ScCsvTableBox : public ScCsvControl
{
private:
ScCsvLayoutData maData; /// Current layout data of the controls.
ScCsvRuler maRuler; /// The ruler for fixed width mode.
ScCsvGrid maGrid; /// Calc-like data table for fixed width mode.
ScrollBar maHScroll; /// Horizontal scroll bar.
ScrollBar maVScroll; /// Vertical scroll bar.
ScrollBarBox maScrollBox; /// For the bottom right edge.
Link maUpdateTextHdl; /// Updates all cell texts.
2002-08-01 11:48:33 +00:00
Link maColTypeHdl; /// Handler for exporting the column type.
2002-08-01 11:48:33 +00:00
ScCsvColStateVec maFixColStates; /// Column states in fixed width mode.
ScCsvColStateVec maSepColStates; /// Column states in separators mode.
sal_Int32 mnFixedWidth; /// Cached total width for fixed width mode.
bool mbFixedMode; /// false = Separators, true = Fixed width.
// ------------------------------------------------------------------------
public:
2002-08-15 08:29:12 +00:00
explicit ScCsvTableBox( Window* pParent, const ResId& rResId );
/** Finishes initialization. Must be called after constructing a new object. */
void Init();
2002-08-15 08:29:12 +00:00
// common table box handling ----------------------------------------------
public:
/** Sets the control to separators mode. */
void SetSeparatorsMode();
/** Sets the control to fixed width mode. */
void SetFixedWidthMode();
private:
/** Initializes the children controls (pos/size, scroll bars, ...). */
SC_DLLPRIVATE void InitControls();
/** Initializes size and position data of horizontal scrollbar. */
SC_DLLPRIVATE void InitHScrollBar();
/** Initializes size and position data of vertical scrollbar. */
SC_DLLPRIVATE void InitVScrollBar();
/** Calculates and sets valid position offset nearest to nPos. */
SC_DLLPRIVATE inline void ImplSetPosOffset( sal_Int32 nPos )
{ maData.mnPosOffset = Max( Min( nPos, GetMaxPosOffset() ), sal_Int32( 0 ) ); }
/** Calculates and sets valid line offset nearest to nLine. */
SC_DLLPRIVATE inline void ImplSetLineOffset( sal_Int32 nLine )
{ maData.mnLineOffset = Max( Min( nLine, GetMaxLineOffset() ), sal_Int32( 0 ) ); }
/** Moves controls (not cursors!) so that nPos becomes visible. */
SC_DLLPRIVATE void MakePosVisible( sal_Int32 nPos );
2002-08-15 08:29:12 +00:00
// cell contents ----------------------------------------------------------
public:
/** Fills all cells of all lines with the passed texts (Unicode strings). */
void SetUniStrings(
const rtl::OUString* pTextLines, const String& rSepChars,
2002-08-15 08:29:12 +00:00
sal_Unicode cTextSep, bool bMergeSep );
// column settings --------------------------------------------------------
public:
/** Reads UI strings for data types from the list box. */
void InitTypes( const ListBox& rListBox );
/** Returns the data type of the selected columns. */
inline sal_Int32 GetSelColumnType() const { return maGrid.GetSelColumnType(); }
/** Fills the options object with current column data. */
void FillColumnData( ScAsciiOptions& rOptions ) const;
// event handling ---------------------------------------------------------
2002-08-15 08:29:12 +00:00
public:
/** Sets a new handler for "update cell texts" requests. */
inline void SetUpdateTextHdl( const Link& rHdl ) { maUpdateTextHdl = rHdl; }
/** Returns the handler for "update cell texts" requests. */
inline const Link& GetUpdateTextHdl() const { return maUpdateTextHdl; }
/** Sets a new handler for "column selection changed" events. */
inline void SetColTypeHdl( const Link& rHdl ) { maColTypeHdl = rHdl; }
/** Returns the handler for "column selection changed" events. */
inline const Link& GetColTypeHdl() const { return maColTypeHdl; }
2002-08-15 08:29:12 +00:00
protected:
virtual void Resize();
virtual void DataChanged( const DataChangedEvent& rDCEvt );
private:
SC_DLLPRIVATE DECL_LINK( CsvCmdHdl, ScCsvControl* );
SC_DLLPRIVATE DECL_LINK( ScrollHdl, ScrollBar* );
SC_DLLPRIVATE DECL_LINK( ScrollEndHdl, ScrollBar* );
2002-08-15 08:29:12 +00:00
// accessibility ----------------------------------------------------------
public:
/** Creates and returns the accessible object of this control. */
virtual XAccessibleRef CreateAccessible();
protected:
/** Creates a new accessible object. */
virtual ScAccessibleCsvControl* ImplCreateAccessible();
};
// ============================================================================
#endif
2010-10-27 12:43:08 +01:00
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */