LibreOffice Module sc (master)  1
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
XclImpHFConverter Class Reference

Converts an Excel header/footer string into three edit engine text objects. More...

#include <xihelper.hxx>

Inheritance diagram for XclImpHFConverter:
[legend]
Collaboration diagram for XclImpHFConverter:
[legend]

Classes

struct  XclImpHFPortionInfo
 Contains all information about a header/footer portion. More...
 

Public Member Functions

 XclImpHFConverter (const XclImpHFConverter &)=delete
 delete copy constructor More...
 
const XclImpHFConverteroperator= (const XclImpHFConverter &)=delete
 delete copy-assignment operator More...
 
 XclImpHFConverter (const XclImpRoot &rRoot)
 
virtual ~XclImpHFConverter () override
 
void ParseString (const OUString &rHFString)
 Parses the passed string and creates three new edit engine text objects. More...
 
void FillToItemSet (SfxItemSet &rItemSet, sal_uInt16 nWhichId) const
 Creates a ScPageHFItem and inserts it into the passed item set. More...
 
sal_Int32 GetTotalHeight () const
 Returns the total height of the converted header or footer in twips. More...
 

Private Types

enum  XclImpHFPortion {
  EXC_HF_LEFT,
  EXC_HF_CENTER,
  EXC_HF_RIGHT,
  EXC_HF_PORTION_COUNT
}
 Enumerates the supported header/footer portions. More...
 
typedef ::std::unique_ptr< XclFontDataXclFontDataPtr
 

Private Member Functions

XclImpHFPortionInfoGetCurrInfo ()
 Returns the current edit engine text object. More...
 
XclImpHFPortionInfo::EditTextObjectRefGetCurrObj ()
 Returns the current edit engine text object. More...
 
ESelectionGetCurrSel ()
 Returns the current selection. More...
 
sal_uInt16 GetMaxLineHeight (XclImpHFPortion ePortion) const
 Returns the maximum line height of the specified portion. More...
 
void UpdateMaxLineHeight (XclImpHFPortion ePortion)
 Updates the maximum line height of the specified portion, using the current font size. More...
 
void UpdateCurrMaxLineHeight ()
 Updates the current maximum line height, using the current font size. More...
 
void SetAttribs ()
 Sets the font attributes at the current selection. More...
 
void ResetFontData ()
 Resets font data to application default font. More...
 
void InsertText ()
 Inserts maCurrText into edit engine and adjusts the current selection object. More...
 
void InsertField (const SvxFieldItem &rFieldItem)
 Inserts the passed text field and adjusts the current selection object. More...
 
void InsertLineBreak ()
 Inserts a line break and adjusts the current selection object. More...
 
void CreateCurrObject ()
 Creates the edit engine text object of current portion from edit engine. More...
 
void SetNewPortion (XclImpHFPortion eNew)
 Changes current header/footer portion to eNew. More...
 

Private Attributes

EditEnginemrEE
 
std::vector< XclImpHFPortionInfomaInfos
 The header/footer edit engine. More...
 
OUStringBuffer maCurrText
 Edit engine text objects for all portions. More...
 
XclFontDataPtr mxFontData
 Current text to insert into edit engine. More...
 
XclImpHFPortion meCurrObj
 Font data of current text. More...
 

Additional Inherited Members

- Protected Member Functions inherited from XclImpRoot
 XclImpRoot (XclImpRootData &rImpRootData)
 
const XclImpRootGetRoot () const
 Returns this root instance - for code readability in derived classes. More...
 
XclImpRootGetRoot ()
 
void SetCodePage (sal_uInt16 nCodePage)
 Sets a code page read from a CODEPAGE record for byte string import. More...
 
void InitializeTable (SCTAB nScTab)
 Is called when import filter starts importing a single sheet (all BIFF versions). More...
 
void FinalizeTable ()
 Is called when import filter stops importing a single sheet (all BIFF versions). More...
 
XclImpAddressConverterGetAddressConverter () const
 Returns the address converter. More...
 
XclImpFormulaCompilerGetFormulaCompiler () const
 Returns the formula converter. More...
 
ExcelToScGetOldFmlaConverter () const
 Returns the old formula converter. More...
 
XclImpSstGetSst () const
 Returns the shared string table. More...
 
XclImpPaletteGetPalette () const
 Returns the color buffer. More...
 
XclImpFontBufferGetFontBuffer () const
 Returns the font buffer. More...
 
XclImpNumFmtBufferGetNumFmtBuffer () const
 Returns the number format buffer. More...
 
XclImpXFBufferGetXFBuffer () const
 Returns the cell formatting attributes buffer. More...
 
XclImpXFRangeBufferGetXFRangeBuffer () const
 Returns the buffer of XF index ranges for a sheet. More...
 
ScRangeListTabsGetPrintAreaBuffer () const
 Returns the buffer that contains all print areas in the document. More...
 
ScRangeListTabsGetTitleAreaBuffer () const
 Returns the buffer that contains all print titles in the document. More...
 
XclImpTabInfoGetTabInfo () const
 Returns the buffer that contains the sheet creation order. More...
 
XclImpNameManagerGetNameManager () const
 Returns the buffer that contains internal defined names. More...
 
XclImpLinkManagerGetLinkManager () const
 Returns the link manager. More...
 
XclImpObjectManagerGetObjectManager () const
 Returns the drawing object manager. More...
 
XclImpSheetDrawingGetCurrSheetDrawing () const
 Returns the drawing container of the current sheet. More...
 
XclImpCondFormatManagerGetCondFormatManager () const
 Returns the conditional formatting manager. More...
 
XclImpValidationManagerGetValidationManager () const
 
XclImpAutoFilterBufferGetFilterManager () const
 Returns the filter manager. More...
 
XclImpWebQueryBufferGetWebQueryBuffer () const
 Returns the web query buffer. More...
 
XclImpPivotTableManagerGetPivotTableManager () const
 Returns the pivot table manager. More...
 
XclImpSheetProtectBufferGetSheetProtectBuffer () const
 Returns the sheet protection options of the current sheet. More...
 
XclImpDocProtectBufferGetDocProtectBuffer () const
 Returns the document protection options. More...
 
XclImpPageSettingsGetPageSettings () const
 Returns the page settings of the current sheet. More...
 
XclImpDocViewSettingsGetDocViewSettings () const
 Returns the view settings of the entire document. More...
 
XclImpTabViewSettingsGetTabViewSettings () const
 Returns the view settings of the current sheet. More...
 
bool HasBasic () const
 Returns true, if the document contains a VB project. More...
 
void SetHasBasic ()
 Called to indicate that the document contains a VB project. More...
 
void ReadCodeName (XclImpStream &rStrm, bool bGlobals)
 Reads the CODENAME record and inserts the codename into the document. More...
 
ScDocumentImportGetDocImport ()
 
- Protected Member Functions inherited from XclRoot
 XclRoot (XclRootData &rRootData)
 
 XclRoot (const XclRoot &rRoot)
 
virtual ~XclRoot ()
 
XclRootoperator= (const XclRoot &rRoot)
 
RootDataGetOldRoot () const
 Returns old RootData struct. More...
 
XclBiff GetBiff () const
 Returns the current BIFF version of the importer/exporter. More...
 
XclOutput GetOutput () const
 Returns the current output format of the importer/exporter. More...
 
bool IsImport () const
 Returns true, if currently a document is imported. More...
 
rtl_TextEncoding GetTextEncoding () const
 Returns the text encoding to import/export byte strings. More...
 
LanguageType GetSysLanguage () const
 Returns the system language, i.e. More...
 
LanguageType GetDocLanguage () const
 Returns the document language. More...
 
LanguageType GetUILanguage () const
 Returns the UI language. More...
 
sal_Int16 GetDefApiScript () const
 Returns the default script type, e.g. More...
 
long GetCharWidth () const
 Returns the width of the '0' character (default font) for the current printer (twips). More...
 
bool IsInGlobals () const
 Returns the current Calc sheet index. More...
 
SCTAB GetCurrScTab () const
 Returns the current Calc sheet index. More...
 
sal_Int32 GetHmmFromPixelX (double fPixelX) const
 Calculates the width of the passed number of pixels in 1/100 mm. More...
 
sal_Int32 GetHmmFromPixelY (double fPixelY) const
 Calculates the height of the passed number of pixels in 1/100 mm. More...
 
SfxMediumGetMedium () const
 Returns the medium to import from. More...
 
const OUString & GetDocUrl () const
 Returns the document URL of the imported/exported file. More...
 
const OUString & GetBasePath () const
 Returns the base path of the imported/exported file. More...
 
const OUString & GetUserName () const
 Returns the current user name. More...
 
css::uno::Sequence< css::beans::NamedValue > RequestEncryptionData (::comphelper::IDocPasswordVerifier &rVerifier) const
 Requests and verifies a password from the medium or the user. More...
 
const tools::SvRef< SotStorage > & GetRootStorage () const
 Returns the OLE2 root storage of the imported/exported file. More...
 
bool HasVbaStorage () const
 Returns true, if the document contains a VBA storage. More...
 
tools::SvRef< SotStorageOpenStorage (tools::SvRef< SotStorage > const &xStrg, const OUString &rStrgName) const
 Tries to open a storage as child of the specified storage for reading or writing. More...
 
tools::SvRef< SotStorageOpenStorage (const OUString &rStrgName) const
 Tries to open a storage as child of the root storage for reading or writing. More...
 
tools::SvRef< SotStorageStreamOpenStream (tools::SvRef< SotStorage > const &xStrg, const OUString &rStrmName) const
 Tries to open a new stream in the specified storage for reading or writing. More...
 
tools::SvRef< SotStorageStreamOpenStream (const OUString &rStrmName) const
 Tries to open a new stream in the root storage for reading or writing. More...
 
ScDocumentGetDoc () const
 Returns reference to the destination document (import) or source document (export). More...
 
SfxObjectShellGetDocShell () const
 Returns the object shell of the Calc document. More...
 
ScModelObjGetDocModelObj () const
 Returns the object model of the Calc document. More...
 
OutputDeviceGetPrinter () const
 Returns pointer to the printer of the Calc document. More...
 
ScStyleSheetPoolGetStyleSheetPool () const
 Returns the style sheet pool of the Calc document. More...
 
ScRangeNameGetNamedRanges () const
 Returns the defined names container of the Calc document. More...
 
SdrPageGetSdrPage (SCTAB nScTab) const
 Returns the drawing layer page of the passed sheet, if present. More...
 
SvNumberFormatterGetFormatter () const
 Returns the number formatter of the Calc document. More...
 
DateTime GetNullDate () const
 Returns the null date of the current number formatter. More...
 
sal_uInt16 GetBaseYear () const
 Returns the base year depending on the current null date (1900 or 1904). More...
 
double GetDoubleFromDateTime (const DateTime &rDateTime) const
 Converts a date/time value to a floating-point value. More...
 
DateTime GetDateTimeFromDouble (double fValue) const
 Converts a floating-point value to a date/time value. More...
 
ScEditEngineDefaulterGetEditEngine () const
 Returns the edit engine for import/export of rich strings etc. More...
 
ScHeaderEditEngineGetHFEditEngine () const
 Returns the edit engine for import/export of headers/footers. More...
 
EditEngineGetDrawEditEngine () const
 Returns the edit engine for import/export of drawing text boxes. More...
 
XclFontPropSetHelperGetFontPropSetHelper () const
 Returns the property set helper for fonts. More...
 
XclChPropSetHelperGetChartPropSetHelper () const
 Returns the property set helper for the chart filters. More...
 
ScExtDocOptionsGetExtDocOptions () const
 Returns the extended document options. More...
 
XclTracerGetTracer () const
 Returns the filter tracer. More...
 
const ScAddressGetScMaxPos () const
 Returns the highest possible cell address in a Calc document. More...
 
const ScAddressGetXclMaxPos () const
 Returns the highest possible cell address in an Excel document (using current BIFF version). More...
 
const ScAddressGetMaxPos () const
 Returns the highest possible cell address valid in Calc and Excel (using current BIFF version). More...
 
void SetDocLanguage (LanguageType eLang)
 Sets the document language. More...
 
void SetUILanguage (LanguageType eLang)
 Sets the UI language, i.e. More...
 
void SetTextEncoding (rtl_TextEncoding eTextEnc)
 Sets the text encoding to import/export byte strings. More...
 
void SetCharWidth (const XclFontData &rFontData)
 Sets the width of the '0' character (default font) for the current printer (twips). More...
 
void SetCurrScTab (SCTAB nScTab)
 Sets the current Calc sheet index. More...
 
void IncCurrScTab ()
 Increases the current Calc sheet index by 1. More...
 
- Static Protected Member Functions inherited from XclImpRoot
static OUString GetScAddInName (const OUString &rXclName)
 Returns the Calc add-in function name for an Excel function name. More...
 
- Static Protected Member Functions inherited from XclRoot
static const OUStringLiteral & GetDefaultPassword ()
 Returns the default password used for stream encryption. More...
 

Detailed Description

Converts an Excel header/footer string into three edit engine text objects.

Header/footer content is divided into three parts: Left, center and right portion. All formatting information is encoded in the Excel string using special character sequences. A control sequence starts with the ampersand character.

Supported control sequences: &L start of left portion &C start of center portion &R start of right portion &P current page number &N page count &D current date &T current time &A table name &F file name without path (see also &Z&F) &Z file path without file name (converted to full file name, see also &Z&F) &Z&F file path and name &U underlining on/off &E double underlining on/off &S strikeout characters on/off &X superscript on/off &Y subscript on/off &"fontname,fontstyle" use font with name 'fontname' and style 'fontstyle' &fontheight set font height in points ('fontheight' is a decimal value)

Known but unsupported control sequences: &G picture

Definition at line 164 of file xihelper.hxx.

Member Typedef Documentation

typedef ::std::unique_ptr< XclFontData > XclImpHFConverter::XclFontDataPtr
private

Definition at line 184 of file xihelper.hxx.

Member Enumeration Documentation

Enumerates the supported header/footer portions.

Enumerator
EXC_HF_LEFT 
EXC_HF_CENTER 
EXC_HF_RIGHT 
EXC_HF_PORTION_COUNT 

Definition at line 187 of file xihelper.hxx.

Constructor & Destructor Documentation

XclImpHFConverter::XclImpHFConverter ( const XclImpHFConverter )
delete

delete copy constructor

XclImpHFConverter::XclImpHFConverter ( const XclImpRoot rRoot)
explicit

Definition at line 264 of file xihelper.cxx.

XclImpHFConverter::~XclImpHFConverter ( )
overridevirtual

Definition at line 272 of file xihelper.cxx.

Member Function Documentation

void XclImpHFConverter::CreateCurrObject ( )
private

Creates the edit engine text object of current portion from edit engine.

Definition at line 565 of file xihelper.cxx.

References EditEngine::CreateTextObject(), GetCurrObj(), InsertText(), mrEE, and SetAttribs().

Referenced by ParseString(), and SetNewPortion().

void XclImpHFConverter::FillToItemSet ( SfxItemSet rItemSet,
sal_uInt16  nWhichId 
) const
XclImpHFPortionInfo& XclImpHFConverter::GetCurrInfo ( )
inlineprivate

Returns the current edit engine text object.

Definition at line 202 of file xihelper.hxx.

References maInfos, and meCurrObj.

Referenced by GetCurrObj(), GetCurrSel(), and InsertLineBreak().

XclImpHFPortionInfo::EditTextObjectRef& XclImpHFConverter::GetCurrObj ( )
inlineprivate

Returns the current edit engine text object.

Definition at line 204 of file xihelper.hxx.

References GetCurrInfo(), and XclImpHFConverter::XclImpHFPortionInfo::mxObj.

Referenced by CreateCurrObject(), and SetNewPortion().

ESelection& XclImpHFConverter::GetCurrSel ( )
inlineprivate

Returns the current selection.

Definition at line 206 of file xihelper.hxx.

References GetCurrInfo(), and XclImpHFConverter::XclImpHFPortionInfo::maSel.

Referenced by InsertField(), InsertLineBreak(), InsertText(), and SetAttribs().

sal_uInt16 XclImpHFConverter::GetMaxLineHeight ( XclImpHFPortion  ePortion) const
private

Returns the maximum line height of the specified portion.

Definition at line 493 of file xihelper.cxx.

References maInfos, and mxFontData.

Referenced by InsertLineBreak(), and ParseString().

sal_Int32 XclImpHFConverter::GetTotalHeight ( ) const

Returns the total height of the converted header or footer in twips.

Definition at line 485 of file xihelper.cxx.

References EXC_HF_CENTER, EXC_HF_LEFT, EXC_HF_RIGHT, maInfos, and mnHeight.

Referenced by XclImpPageSettings::Finalize().

void XclImpHFConverter::InsertField ( const SvxFieldItem rFieldItem)
private

Inserts the passed text field and adjusts the current selection object.

Definition at line 547 of file xihelper.cxx.

References GetCurrSel(), mrEE, ESelection::nEndPara, ESelection::nEndPos, EditEngine::QuickInsertField(), and UpdateCurrMaxLineHeight().

Referenced by ParseString().

void XclImpHFConverter::InsertLineBreak ( )
private
void XclImpHFConverter::InsertText ( )
private

Inserts maCurrText into edit engine and adjusts the current selection object.

The text shall not contain a newline character. The text will be cleared after insertion.

Definition at line 535 of file xihelper.cxx.

References GetCurrSel(), maCurrText, mrEE, ESelection::nEndPara, ESelection::nEndPos, EditEngine::QuickInsertText(), and UpdateCurrMaxLineHeight().

Referenced by CreateCurrObject(), and ParseString().

const XclImpHFConverter& XclImpHFConverter::operator= ( const XclImpHFConverter )
delete

delete copy-assignment operator

void XclImpHFConverter::ParseString ( const OUString &  rHFString)

Parses the passed string and creates three new edit engine text objects.

State of the parser.

Read text, search for functions.

Read function (token following a '&').

Read font name ('&' is followed by '"', reads until next '"' or ',').

Read font style name (font part after ',', reads until next '"').

Read font height ('&' is followed by num. digits, reads until non-digit).

Definition at line 276 of file xihelper.cxx.

References CreateCurrObject(), EE_FEATURE_FIELD(), EMPTY_OUSTRING, EXC_FONTESC_NONE, EXC_FONTESC_SUB, EXC_FONTESC_SUPER, EXC_FONTUNDERL_DOUBLE, EXC_FONTUNDERL_NONE, EXC_FONTUNDERL_SINGLE, EXC_HF_CENTER, EXC_HF_LEFT, EXC_HF_PORTION_COUNT, EXC_HF_RIGHT, GetMaxLineHeight(), InsertField(), InsertLineBreak(), InsertText(), maCurrText, maInfos, meCurrObj, mrEE, mxFontData, pChar, ResetFontData(), SetAttribs(), SetNewPortion(), and EditEngine::SetText().

Referenced by XclImpPageSettings::Finalize().

void XclImpHFConverter::ResetFontData ( )
private

Resets font data to application default font.

Definition at line 524 of file xihelper.cxx.

References EXC_FONT_APP, XclImpRoot::GetFontBuffer(), XclImpFont::GetFontData(), and mxFontData.

Referenced by ParseString(), and SetNewPortion().

void XclImpHFConverter::SetAttribs ( )
private

Sets the font attributes at the current selection.

After that, the start position of the current selection object is adjusted to the end of the selection.

Definition at line 510 of file xihelper.cxx.

References GetCurrSel(), EditEngine::GetEmptyItemSet(), XclImpRoot::GetRoot(), HeaderFooter, mrEE, mxFontData, ESelection::nEndPara, ESelection::nEndPos, ESelection::nStartPara, ESelection::nStartPos, and EditEngine::QuickSetAttribs().

Referenced by CreateCurrObject(), and ParseString().

void XclImpHFConverter::SetNewPortion ( XclImpHFPortion  eNew)
private

Changes current header/footer portion to eNew.

Creates text object of current portion and reinitializes edit engine.

Definition at line 572 of file xihelper.cxx.

References CreateCurrObject(), EMPTY_OUSTRING, GetCurrObj(), meCurrObj, mrEE, ResetFontData(), and EditEngine::SetText().

Referenced by ParseString().

void XclImpHFConverter::UpdateCurrMaxLineHeight ( )
private

Updates the current maximum line height, using the current font size.

Definition at line 505 of file xihelper.cxx.

References meCurrObj, and UpdateMaxLineHeight().

Referenced by InsertField(), and InsertText().

void XclImpHFConverter::UpdateMaxLineHeight ( XclImpHFPortion  ePortion)
private

Updates the maximum line height of the specified portion, using the current font size.

Definition at line 499 of file xihelper.cxx.

References maInfos, and mxFontData.

Referenced by UpdateCurrMaxLineHeight().

Member Data Documentation

OUStringBuffer XclImpHFConverter::maCurrText
private

Edit engine text objects for all portions.

Definition at line 242 of file xihelper.hxx.

Referenced by InsertText(), and ParseString().

std::vector< XclImpHFPortionInfo > XclImpHFConverter::maInfos
private

The header/footer edit engine.

Definition at line 241 of file xihelper.hxx.

Referenced by FillToItemSet(), GetCurrInfo(), GetMaxLineHeight(), GetTotalHeight(), ParseString(), and UpdateMaxLineHeight().

XclImpHFPortion XclImpHFConverter::meCurrObj
private

Font data of current text.

Definition at line 244 of file xihelper.hxx.

Referenced by GetCurrInfo(), InsertLineBreak(), ParseString(), SetNewPortion(), and UpdateCurrMaxLineHeight().

EditEngine& XclImpHFConverter::mrEE
private
XclFontDataPtr XclImpHFConverter::mxFontData
private

Current text to insert into edit engine.

Definition at line 243 of file xihelper.hxx.

Referenced by GetMaxLineHeight(), ParseString(), ResetFontData(), SetAttribs(), and UpdateMaxLineHeight().


The documentation for this class was generated from the following files: