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
35
36
37namespace sw {
38
39MoveText::MoveText(SwTextNode *const pD, sal_Int32 const nD, sal_Int32 const nS, sal_Int32 const nL)
40 : pDestNode(pD), nDestStart(nD), nSourceStart(nS), nLen(nL)
41{
42}
43
44InsertText::InsertText(const sal_Int32 nP, const sal_Int32 nL, const bool isInFMCommand, const bool isInFMResult)
46 , nPos( nP ), nLen( nL )
47 , isInsideFieldmarkCommand(isInFMCommand)
48 , isInsideFieldmarkResult(isInFMResult)
49{
50}
51
52DeleteText::DeleteText( const sal_Int32 nS, const sal_Int32 nL )
53 : SfxHint( SfxHintId::SwDeleteText ), nStart( nS ), nLen( nL )
54{
55}
56
57DeleteChar::DeleteChar( const sal_Int32 nPos )
59{
60}
61
62RedlineDelText::RedlineDelText(sal_Int32 const nS, sal_Int32 const nL)
63 : nStart(nS), nLen(nL)
64{
65}
66
67RedlineUnDelText::RedlineUnDelText(sal_Int32 const nS, sal_Int32 const nL)
68 : nStart(nS), nLen(nL)
69{
70}
71
72} // namespace sw
73
74SwUpdateAttr::SwUpdateAttr( sal_Int32 nS, sal_Int32 nE, sal_uInt16 nW )
75 : SwMsgPoolItem( RES_UPDATE_ATTR ), m_nStart( nS ), m_nEnd( nE ), m_nWhichAttr( nW )
76{
77}
78
79SwUpdateAttr::SwUpdateAttr( sal_Int32 nS, sal_Int32 nE, sal_uInt16 nW, std::vector<sal_uInt16> aW )
80 : SwMsgPoolItem( RES_UPDATE_ATTR ), m_nStart( nS ), m_nEnd( nE ), m_nWhichAttr( nW ), m_aWhichFmtAttrs(std::move( aW ))
81{
82}
83
86 pOut( pOutput )
87{
88 OSL_ENSURE( pOut, "No OutputDevice pointer" );
89}
90
92 : SwMsgPoolItem( RES_DOCPOS_UPDATE ), nDocPos(nDcPos)
93{
94}
95
98 m_pTable( pNewTable ), m_pHistory( nullptr ), m_nSplitLine( USHRT_MAX ),
99 m_eFlags( TBL_CALC )
100{
101 m_aData.pDelTable = nullptr;
103 OSL_ENSURE( m_pTable, "No Table pointer" );
104}
105
107 : SwMsgPoolItem( RES_AUTOFMT_DOCNODE ), pNodes( pNds )
108{
109}
110
113 m_bDelSet( false ),
114 m_pChgSet( &rSet ),
115 m_pTheChgdSet( &rTheSet )
116{
117}
118
121 m_bDelSet( true ),
122 m_pTheChgdSet( rChgSet.m_pTheChgdSet )
123{
124 m_pChgSet = new SwAttrSet( *rChgSet.m_pChgSet );
125}
126
128{
129 if( m_bDelSet )
130 delete m_pChgSet;
131}
132
133#ifdef DBG_UTIL
134void SwAttrSetChg::ClearItem( sal_uInt16 nWhch )
135{
136 OSL_ENSURE( m_bDelSet, "The Set may not be changed!" );
137 m_pChgSet->ClearItem( nWhch );
138}
139#endif
140
142 : SfxPoolItem( nWhch )
143{
144}
145
147{
148 assert( false && "SwMsgPoolItem knows no ==" );
149 return false;
150}
151
153{
154 OSL_FAIL( "SwMsgPoolItem knows no Clone" );
155 return nullptr;
156}
157
158#if OSL_DEBUG_LEVEL > 0
159const SfxPoolItem* GetDfltAttr( sal_uInt16 nWhich )
160{
161 OSL_ASSERT( nWhich < POOLATTR_END && nWhich >= POOLATTR_BEGIN );
162
163 SfxPoolItem *pHt = aAttrTab[ nWhich - POOLATTR_BEGIN ];
164 OSL_ENSURE( pHt, "GetDfltFormatAttr(): Dflt == 0" );
165 return pHt;
166}
167#else
168const SfxPoolItem* GetDfltAttr( sal_uInt16 nWhich )
169{
170 return aAttrTab[ nWhich - POOLATTR_BEGIN ];
171}
172#endif
173
175 SwMsgPoolItem( RES_VIRTPAGENUM_INFO ), m_pPage( nullptr ), m_pOrigPage( pPg ), m_pFrame( nullptr )
176{
177}
178
180 : SwMsgPoolItem( RES_FINDNEARESTNODE ), m_pNode( &rNd ), m_pFound( nullptr )
181{
182}
183
185{
186 if( &m_pNode->GetNodes() == &rNd.GetNodes() )
187 {
188 SwNodeOffset nIdx = rNd.GetIndex();
189 if( nIdx < m_pNode->GetIndex() &&
190 ( !m_pFound || nIdx > m_pFound->GetIndex() ) &&
191 nIdx > rNd.GetNodes().GetEndOfExtras().GetIndex() )
192 m_pFound = &rNd;
193 }
194}
195
196sal_uInt16 GetWhichOfScript( sal_uInt16 nWhich, sal_uInt16 nScript )
197{
198 static const sal_uInt16 aLangMap[3] =
200 static const sal_uInt16 aFontMap[3] =
202 static const sal_uInt16 aFontSizeMap[3] =
204 static const sal_uInt16 aWeightMap[3] =
206 static const sal_uInt16 aPostureMap[3] =
208
209 const sal_uInt16* pM;
210 switch( nWhich )
211 {
215 pM = aLangMap;
216 break;
217
218 case RES_CHRATR_FONT:
221 pM = aFontMap;
222 break;
223
227 pM = aFontSizeMap;
228 break;
229
233 pM = aWeightMap;
234 break;
235
239 pM = aPostureMap;
240 break;
241
242 default:
243 pM = nullptr;
244 }
245
246 sal_uInt16 nRet;
247 if( pM )
248 {
249 using namespace ::com::sun::star;
250 {
251 if( i18n::ScriptType::WEAK == nScript )
253 switch( nScript)
254 {
255 case i18n::ScriptType::COMPLEX:
256 ++pM;
257 [[fallthrough]];
258 case i18n::ScriptType::ASIAN:
259 ++pM;
260 [[fallthrough]];
261 default:
262 nRet = *pM;
263 }
264 }
265 }
266 else
267 nRet = nWhich;
268 return nRet;
269}
270
271/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
SwAttrSetChg(const SwAttrSet &rTheSet, SwAttrSet &rSet)
Definition: hints.cxx:111
SwAttrSet * m_pChgSet
what has changed
Definition: hints.hxx:309
void ClearItem(sal_uInt16 nWhichL)
Definition: hints.cxx:134
bool m_bDelSet
Definition: hints.hxx:308
virtual ~SwAttrSetChg() override
Definition: hints.cxx:127
SwAutoFormatGetDocNode(const SwNodes *pNds)
Definition: hints.cxx:106
SwDocPosUpdate(const SwTwips nDocPos)
Definition: hints.cxx:91
const SwNode * m_pFound
Definition: hints.hxx:351
const SwNode * m_pNode
Definition: hints.hxx:351
void CheckNode(const SwNode &rNd)
Definition: hints.cxx:184
SwFindNearestNode(const SwNode &rNd)
Definition: hints.cxx:179
SwFormatChg(SwFormat *pFormat)
Definition: hints.cxx:30
Base class for various Writer styles.
Definition: format.hxx:47
virtual bool operator==(const SfxPoolItem &) const override
Definition: hints.cxx:146
virtual SwMsgPoolItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: hints.cxx:152
SwMsgPoolItem(sal_uInt16 nWhich)
Definition: hints.cxx:141
Base class of the Writer document model elements.
Definition: node.hxx:98
SwNodeOffset GetIndex() const
Definition: node.hxx:312
SwNodes & GetNodes()
Node is in which nodes-array/doc?
Definition: node.hxx:744
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:249
SwRefMarkFieldUpdate(OutputDevice *)
Is sent if reference marks should be updated.
Definition: hints.cxx:84
const SwTable * m_pTable
Pointer to the current table.
Definition: hints.hxx:279
union SwTableFormulaUpdate::@26 m_aData
SwTableFormulaUpdate(const SwTable *)
Is sent if a table should be recalculated.
Definition: hints.cxx:96
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:111
SwUpdateAttr(sal_Int32 nS, sal_Int32 nE, sal_uInt16 nW)
Definition: hints.cxx:74
SwVirtPageNumInfo(const SwPageFrame *pPg)
Multiple attributes can be attached to a single paragraph / table The frame, in the end,...
Definition: hints.cxx:174
DeleteChar(const sal_Int32 nPos)
Definition: hints.cxx:57
DeleteText(sal_Int32 nS, sal_Int32 nL)
Definition: hints.cxx:52
InsertText(sal_Int32 nP, sal_Int32 nL, bool isInFMCommand, bool isInFMResult)
Definition: hints.cxx:44
MoveText(SwTextNode *pD, sal_Int32 nD, sal_Int32 nS, sal_Int32 nL)
Definition: hints.cxx:39
RedlineDelText(sal_Int32 nS, sal_Int32 nL)
Definition: hints.cxx:62
RedlineUnDelText(sal_Int32 nS, sal_Int32 nL)
Definition: hints.cxx:67
size_t m_nPos
SfxHintId
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< 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< 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< 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:159
sal_uInt16 GetWhichOfScript(sal_uInt16 nWhich, sal_uInt16 nScript)
Definition: hints.cxx:196
@ TBL_CALC
Definition: hints.hxx:269
LanguageType GetAppLanguage()
Definition: init.cxx:726
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