LibreOffice Module sw (master) 1
hints.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include <com/sun/star/i18n/ScriptType.hpp>
21#include <hintids.hxx>
22#include <hints.hxx>
23#include <ndtxt.hxx>
24#include <swtypes.hxx>
26#include <utility>
27#include <vcl/outdev.hxx>
28#include <osl/diagnose.h>
29
31 : SwMsgPoolItem( RES_FMT_CHG ), pChangedFormat( pFormat )
32{
33}
34
35SwInsText::SwInsText(sal_Int32 const nP, sal_Int32 const nL, bool const isInFMCommand, bool const isInFMResult)
37 , nPos( nP ), nLen( nL )
38 , isInsideFieldmarkCommand(isInFMCommand)
39 , isInsideFieldmarkResult(isInFMResult)
40{
41}
42
43SwDelChr::SwDelChr( sal_Int32 nP )
45{
46}
47
48SwDelText::SwDelText( sal_Int32 nS, sal_Int32 nL )
49 : SwMsgPoolItem( RES_DEL_TXT ), nStart( nS ), nLen( nL )
50{
51}
52
53namespace sw {
54
55MoveText::MoveText(SwTextNode *const pD, sal_Int32 const nD, sal_Int32 const nS, sal_Int32 const nL)
56 : pDestNode(pD), nDestStart(nD), nSourceStart(nS), nLen(nL)
57{
58}
59
60RedlineDelText::RedlineDelText(sal_Int32 const nS, sal_Int32 const nL)
61 : nStart(nS), nLen(nL)
62{
63}
64
65RedlineUnDelText::RedlineUnDelText(sal_Int32 const nS, sal_Int32 const nL)
66 : nStart(nS), nLen(nL)
67{
68}
69
70} // namespace sw
71
72SwUpdateAttr::SwUpdateAttr( sal_Int32 nS, sal_Int32 nE, sal_uInt16 nW )
73 : SwMsgPoolItem( RES_UPDATE_ATTR ), m_nStart( nS ), m_nEnd( nE ), m_nWhichAttr( nW )
74{
75}
76
77SwUpdateAttr::SwUpdateAttr( sal_Int32 nS, sal_Int32 nE, sal_uInt16 nW, std::vector<sal_uInt16> aW )
78 : SwMsgPoolItem( RES_UPDATE_ATTR ), m_nStart( nS ), m_nEnd( nE ), m_nWhichAttr( nW ), m_aWhichFmtAttrs(std::move( aW ))
79{
80}
81
84 pOut( pOutput )
85{
86 OSL_ENSURE( pOut, "No OutputDevice pointer" );
87}
88
90 : SwMsgPoolItem( RES_DOCPOS_UPDATE ), nDocPos(nDcPos)
91{
92}
93
96 m_pTable( pNewTable ), m_pHistory( nullptr ), m_nSplitLine( USHRT_MAX ),
97 m_eFlags( TBL_CALC )
98{
99 m_aData.pDelTable = nullptr;
101 OSL_ENSURE( m_pTable, "No Table pointer" );
102}
103
105 : SwMsgPoolItem( RES_AUTOFMT_DOCNODE ), pNodes( pNds )
106{
107}
108
111 m_bDelSet( false ),
112 m_pChgSet( &rSet ),
113 m_pTheChgdSet( &rTheSet )
114{
115}
116
119 m_bDelSet( true ),
120 m_pTheChgdSet( rChgSet.m_pTheChgdSet )
121{
122 m_pChgSet = new SwAttrSet( *rChgSet.m_pChgSet );
123}
124
126{
127 if( m_bDelSet )
128 delete m_pChgSet;
129}
130
131#ifdef DBG_UTIL
132void SwAttrSetChg::ClearItem( sal_uInt16 nWhch )
133{
134 OSL_ENSURE( m_bDelSet, "The Set may not be changed!" );
135 m_pChgSet->ClearItem( nWhch );
136}
137#endif
138
140 : SfxPoolItem( nWhch )
141{
142}
143
145{
146 assert( false && "SwMsgPoolItem knows no ==" );
147 return false;
148}
149
151{
152 OSL_FAIL( "SwMsgPoolItem knows no Clone" );
153 return nullptr;
154}
155
156#if OSL_DEBUG_LEVEL > 0
157const SfxPoolItem* GetDfltAttr( sal_uInt16 nWhich )
158{
159 OSL_ASSERT( nWhich < POOLATTR_END && nWhich >= POOLATTR_BEGIN );
160
161 SfxPoolItem *pHt = aAttrTab[ nWhich - POOLATTR_BEGIN ];
162 OSL_ENSURE( pHt, "GetDfltFormatAttr(): Dflt == 0" );
163 return pHt;
164}
165#else
166const SfxPoolItem* GetDfltAttr( sal_uInt16 nWhich )
167{
168 return aAttrTab[ nWhich - POOLATTR_BEGIN ];
169}
170#endif
171
173 SwMsgPoolItem( RES_VIRTPAGENUM_INFO ), m_pPage( nullptr ), m_pOrigPage( pPg ), m_pFrame( nullptr )
174{
175}
176
178 : SwMsgPoolItem( RES_FINDNEARESTNODE ), m_pNode( &rNd ), m_pFound( nullptr )
179{
180}
181
183{
184 if( &m_pNode->GetNodes() == &rNd.GetNodes() )
185 {
186 SwNodeOffset nIdx = rNd.GetIndex();
187 if( nIdx < m_pNode->GetIndex() &&
188 ( !m_pFound || nIdx > m_pFound->GetIndex() ) &&
189 nIdx > rNd.GetNodes().GetEndOfExtras().GetIndex() )
190 m_pFound = &rNd;
191 }
192}
193
194sal_uInt16 GetWhichOfScript( sal_uInt16 nWhich, sal_uInt16 nScript )
195{
196 static const sal_uInt16 aLangMap[3] =
198 static const sal_uInt16 aFontMap[3] =
200 static const sal_uInt16 aFontSizeMap[3] =
202 static const sal_uInt16 aWeightMap[3] =
204 static const sal_uInt16 aPostureMap[3] =
206
207 const sal_uInt16* pM;
208 switch( nWhich )
209 {
213 pM = aLangMap;
214 break;
215
216 case RES_CHRATR_FONT:
219 pM = aFontMap;
220 break;
221
225 pM = aFontSizeMap;
226 break;
227
231 pM = aWeightMap;
232 break;
233
237 pM = aPostureMap;
238 break;
239
240 default:
241 pM = nullptr;
242 }
243
244 sal_uInt16 nRet;
245 if( pM )
246 {
247 using namespace ::com::sun::star;
248 {
249 if( i18n::ScriptType::WEAK == nScript )
251 switch( nScript)
252 {
253 case i18n::ScriptType::COMPLEX:
254 ++pM;
255 [[fallthrough]];
256 case i18n::ScriptType::ASIAN:
257 ++pM;
258 [[fallthrough]];
259 default:
260 nRet = *pM;
261 }
262 }
263 }
264 else
265 nRet = nWhich;
266 return nRet;
267}
268
269/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
SwAttrSetChg(const SwAttrSet &rTheSet, SwAttrSet &rSet)
Definition: hints.cxx:109
SwAttrSet * m_pChgSet
what has changed
Definition: hints.hxx:294
void ClearItem(sal_uInt16 nWhichL)
Definition: hints.cxx:132
bool m_bDelSet
Definition: hints.hxx:293
virtual ~SwAttrSetChg() override
Definition: hints.cxx:125
SwAutoFormatGetDocNode(const SwNodes *pNds)
Definition: hints.cxx:104
SwDelChr(sal_Int32 nP)
Definition: hints.cxx:43
SwDelText(sal_Int32 nS, sal_Int32 nL)
Definition: hints.cxx:48
SwDocPosUpdate(const SwTwips nDocPos)
Definition: hints.cxx:89
const SwNode * m_pFound
Definition: hints.hxx:336
const SwNode * m_pNode
Definition: hints.hxx:336
void CheckNode(const SwNode &rNd)
Definition: hints.cxx:182
SwFindNearestNode(const SwNode &rNd)
Definition: hints.cxx:177
SwFormatChg(SwFormat *pFormat)
Definition: hints.cxx:30
Base class for various Writer styles.
Definition: format.hxx:47
SwInsText(sal_Int32 nP, sal_Int32 nL, bool isInFMCommand, bool isInFMResult)
Definition: hints.cxx:35
virtual bool operator==(const SfxPoolItem &) const override
Definition: hints.cxx:144
virtual SwMsgPoolItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: hints.cxx:150
SwMsgPoolItem(sal_uInt16 nWhich)
Definition: hints.cxx:139
Base class of the Writer document model elements.
Definition: node.hxx:84
SwNodeOffset GetIndex() const
Definition: node.hxx:296
SwNodes & GetNodes()
Node is in which nodes-array/doc?
Definition: node.hxx:721
SwNode & GetEndOfExtras() const
This is the last EndNode of a special section.
Definition: ndarr.hxx:163
A page of the document layout.
Definition: pagefrm.hxx:58
VclPtr< OutputDevice > pOut
pointer to the current output device
Definition: hints.hxx:234
SwRefMarkFieldUpdate(OutputDevice *)
Is sent if reference marks should be updated.
Definition: hints.cxx:82
const SwTable * m_pTable
Pointer to the current table.
Definition: hints.hxx:264
union SwTableFormulaUpdate::@26 m_aData
SwTableFormulaUpdate(const SwTable *)
Is sent if a table should be recalculated.
Definition: hints.cxx:94
SwTable is one table in the document model, containing rows (which contain cells).
Definition: swtable.hxx:113
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:86
SwUpdateAttr(sal_Int32 nS, sal_Int32 nE, sal_uInt16 nW)
Definition: hints.cxx:72
SwVirtPageNumInfo(const SwPageFrame *pPg)
Multiple attributes can be attached to a single paragraph / table The frame, in the end,...
Definition: hints.cxx:172
MoveText(SwTextNode *pD, sal_Int32 nD, sal_Int32 nS, sal_Int32 nL)
Definition: hints.cxx:55
RedlineDelText(sal_Int32 nS, sal_Int32 nL)
Definition: hints.cxx:60
RedlineUnDelText(sal_Int32 nS, sal_Int32 nL)
Definition: hints.cxx:65
constexpr TypedWhichId< SwVirtPageNumInfo > RES_VIRTPAGENUM_INFO(180)
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_CTL_FONTSIZE(28)
constexpr TypedWhichId< SwRefMarkFieldUpdate > RES_REFMARKFLD_UPDATE(168)
constexpr sal_uInt16 POOLATTR_BEGIN(HINT_BEGIN)
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_CJK_FONT(22)
constexpr TypedWhichId< SwDelChr > RES_DEL_CHR(165)
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_FONTSIZE(8)
constexpr TypedWhichId< SwFindNearestNode > RES_FINDNEARESTNODE(184)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_LANGUAGE(10)
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_WEIGHT(15)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CTL_LANGUAGE(29)
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_CJK_FONTSIZE(23)
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_CTL_FONT(27)
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_CTL_WEIGHT(31)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CJK_LANGUAGE(24)
constexpr TypedWhichId< SwDelText > RES_DEL_TXT(166)
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_CTL_POSTURE(30)
constexpr TypedWhichId< SwDocPosUpdate > RES_DOCPOS_UPDATE(169)
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_POSTURE(11)
constexpr TypedWhichId< SwFormatChg > RES_FMT_CHG(162)
SwDfltAttrTab aAttrTab
constexpr TypedWhichId< SwAttrSetChg > RES_ATTRSET_CHG(163)
constexpr TypedWhichId< SwTableFormulaUpdate > RES_TABLEFML_UPDATE(170)
constexpr TypedWhichId< SwAutoFormatGetDocNode > RES_AUTOFMT_DOCNODE(173)
constexpr TypedWhichId< SwUpdateAttr > RES_UPDATE_ATTR(167)
constexpr TypedWhichId< SwInsText > RES_INS_TXT(164)
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_CJK_WEIGHT(26)
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_FONT(7)
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_CJK_POSTURE(25)
const SfxPoolItem * GetDfltAttr(sal_uInt16 nWhich)
Get the default attribute from corresponding default attribute table.
Definition: hints.cxx:157
sal_uInt16 GetWhichOfScript(sal_uInt16 nWhich, sal_uInt16 nScript)
Definition: hints.cxx:194
@ TBL_CALC
Definition: hints.hxx:254
LanguageType GetAppLanguage()
Definition: init.cxx:725
sal_uInt16 nPos
sal_Int16 GetI18NScriptTypeOfLanguage(LanguageType nLang)
Dialog to specify the properties of date form field.
static SfxItemSet & rSet
tools::Long SwTwips
Definition: swtypes.hxx:51
oslFileHandle & pOut