/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * 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 INCLUDED_SW_INC_TBLAFMT_HXX #define INCLUDED_SW_INC_TBLAFMT_HXX /* * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * * The structure of table auto formatting should not be changed. It is used * by different code of Writer and Calc. If a change is necessary, the * source code of both applications must be changed! * * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
*/
class SvNumberFormatter; class SwTable; class SwXTextCellStyle; class SwXTextTableStyle;
class SW_DLLPUBLIC SwAutoFormatProps : public AutoFormatBase
{ private: // Writer specific
std::unique_ptr<SvxFrameDirectionItem> m_aTextOrientation;
std::unique_ptr<SwFormatVertOrient> m_aVerticalAlignment;
// number format
OUString m_sNumFormatString;
LanguageType m_eSysLanguage;
LanguageType m_eNumFormatLanguage;
/* @remarks A table has a number of lines. These lines seem to correspond with rows, except in the case of rows spanning more than one line. Each line contains a number of boxes/cells.
AutoFormat properties are retrieved and stored in a grid of 16 table boxes. A sampling approach is used to read the data. 4 lines are picked, and 4 boxes are picked from each.
The line picking and box picking algorithms are similar. We start at the first line/box, and pick lines/boxes one by one for a maximum of 3. The 4th line/box is the last line/box in the current table/line. If we hit the end of lines/boxes, the last line/box encountered is picked several times.
For example, in a 2x3 table, the 4 lines will be [0, 1, 1, 1]. In each line, the boxes will be [0, 1, 2, 2]. In a 6x5 table, the 4 lines will be [0, 1, 2, 4] and the boxes per line will be [0, 1, 2, 5].
As you can see, property extraction/application is lossless for tables that are 4x4 or smaller (and in fact has a bit of redundancy). For larger tables, we lose any individual cell formatting for the range [(3,rows - 1) -> (3, cols - 1)]. That formatting is replaced by formatting from the saved cells:
The properties saved are divided into three categories: 1. Character properties: Font, font size, weight, etc. 2. Box properties: Box, cell background 3. Table properties: Properties that are set in the Table->Table Properties dialog.
Character and box properties are stored per cell (and are lossy for tables larger than 4x4). Table properties are stored per-table, and are lossless.
*/ class SW_DLLPUBLIC SwTableAutoFormat
{ friendclass SwDocTest; friendvoid FinitCore(); // To destroy default pointer. static SwBoxAutoFormat* s_pDefaultBoxAutoFormat;
void UpdateFromSet( sal_uInt8 nPos, const SfxItemSet& rSet,
SwTableAutoFormatUpdateFlags eFlags, SvNumberFormatter const * ); // bCellSpansToEndV means either "single-row table", or "a cell that spans several rows till the // bottom of the table", i.e. "include the bottom border properties in the set, in addition to // the properties of its starting position (when eFlags include Box)". // bCellSpansToEndH means either "single-column table", or "a cell that spans several columns // till the right of the table", i.e. "include the right border properties in the set, in // addition to the properties of its starting position (when eFlags include Box)". void UpdateToSet( sal_uInt8 nPos, bool bCellSpansToEndV, bool bCellSpansToEndH,
SfxItemSet& rSet, SwTableAutoFormatUpdateFlags eFlags,
SvNumberFormatter* ) const ;
/// Check if style is hidden. bool IsHidden() const { return m_bHidden; } /// Check if style is defined by user. bool IsUserDefined() const { return m_bUserDefined; }
/// Set if style is hidden. void SetHidden(bool bHidden) { m_bHidden = bHidden; } /// Set if style is user defined. void SetUserDefined(bool bUserDefined) { m_bUserDefined = bUserDefined; }
/// These methods returns what style (row or column) is applied first on given Cell bool FirstRowEndColumnIsRow(); bool FirstRowStartColumnIsRow(); bool LastRowEndColumnIsRow(); bool LastRowStartColumnIsRow(); bool HasHeaderRow() const;
/// Returns the cell's name postfix. eg. ".1"
OUString GetTableTemplateCellSubName(const SwBoxAutoFormat& rBoxFormat) const; /// Returns a vector of indexes in aBoxAutoFormat array. Returned indexes points to cells which are mapped to a table-template. staticconst std::vector<sal_Int32>& GetTableTemplateMap();
/** * Calculates the relevant position in the table autoformat for a given * cell in a given table.
*/ static sal_uInt8 CountPos(sal_uInt32 nCol, sal_uInt32 nCols, sal_uInt32 nRow, sal_uInt32 nRows);
};
/// Add a copy of rBoxFormat void AddBoxFormat(const SwBoxAutoFormat& rBoxFormat, const UIName& sName); void RemoveBoxFormat(const OUString& sName); void ChangeBoxFormatName(std::u16string_view sFromName, const UIName& sToName); /// If found returns its name. If not found returns an empty UIName
UIName GetBoxFormatName(const SwBoxAutoFormat& rBoxFormat) const; /// If found returns a ptr to a BoxFormat. If not found returns nullptr
SwBoxAutoFormat* GetBoxFormat(const UIName& sName) const;
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.